diff --git a/cvsroot/CVSROOT/checkoutlist b/cvsroot/CVSROOT/checkoutlist deleted file mode 100644 index 2921bffcd..000000000 --- a/cvsroot/CVSROOT/checkoutlist +++ /dev/null @@ -1,13 +0,0 @@ -# The "checkoutlist" file is used to support additional version controlled -# administrative files in $CVSROOT/CVSROOT, such as template files. -# -# The first entry on a line is a filename which will be checked out from -# the corresponding RCS file in the $CVSROOT/CVSROOT directory. -# The remainder of the line is an error message to use if the file cannot -# be checked out. -# -# File format: -# -# [][] -# -# comment lines begin with '#' diff --git a/cvsroot/CVSROOT/commitinfo b/cvsroot/CVSROOT/commitinfo deleted file mode 100644 index b19e7b7a6..000000000 --- a/cvsroot/CVSROOT/commitinfo +++ /dev/null @@ -1,15 +0,0 @@ -# The "commitinfo" file is used to control pre-commit checks. -# The filter on the right is invoked with the repository and a list -# of files to check. A non-zero exit of the filter program will -# cause the commit to be aborted. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being committed to, relative -# to the $CVSROOT. For the first match that is found, then the remainder -# of the line is the name of the filter to run. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". diff --git a/cvsroot/CVSROOT/config b/cvsroot/CVSROOT/config deleted file mode 100644 index 92c150bf7..000000000 --- a/cvsroot/CVSROOT/config +++ /dev/null @@ -1,21 +0,0 @@ -# Set this to "no" if pserver shouldn't check system users/passwords -#SystemAuth=no - -# Put CVS lock files in this directory rather than directly in the repository. -#LockDir=/var/lock/cvs - -# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top -# level of the new working directory when using the `cvs checkout' -# command. -#TopLevelAdmin=no - -# Set `LogHistory' to `all' or `TOEFWUPCGMAR' to log all transactions to the -# history file, or a subset as needed (ie `TMAR' logs all write operations) -#LogHistory=TOEFWUPCGMAR - -# Set `RereadLogAfterVerify' to `always' (the default) to allow the verifymsg -# script to change the log message. Set it to `stat' to force CVS to verify# that the file has changed before reading it (this can take up to an extra -# second per directory being committed, so it is not recommended for large -# repositories. Set it to `never' (the previous CVS behavior) to prevent -# verifymsg scripts from changing the log message. -#RereadLogAfterVerify=always diff --git a/cvsroot/CVSROOT/cvswrappers b/cvsroot/CVSROOT/cvswrappers deleted file mode 100644 index 56ac066ef..000000000 --- a/cvsroot/CVSROOT/cvswrappers +++ /dev/null @@ -1,26 +0,0 @@ -# This file affects handling of files based on their names. -# -# The -t/-f options allow one to treat directories of files -# as a single file, or to transform a file in other ways on -# its way in and out of CVS. -# -# The -m option specifies whether CVS attempts to merge files. -# -# The -k option specifies keyword expansion (e.g. -kb for binary). -# -# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers) -# -# wildcard [option value][option value]... -# -# where option is one of -# -f from cvs filter value: path to filter -# -t to cvs filter value: path to filter -# -m update methodology value: MERGE or COPY -# -k expansion mode value: b, o, kkv, &c -# -# and value is a single-quote delimited value. -# For example: -*.gif -kb -*.jar -kb -*.zip -kb - diff --git a/cvsroot/CVSROOT/editinfo b/cvsroot/CVSROOT/editinfo deleted file mode 100644 index d78886c15..000000000 --- a/cvsroot/CVSROOT/editinfo +++ /dev/null @@ -1,21 +0,0 @@ -# The "editinfo" file is used to allow verification of logging -# information. It works best when a template (as specified in the -# rcsinfo file) is provided for the logging procedure. Given a -# template with locations for, a bug-id number, a list of people who -# reviewed the code before it can be checked in, and an external -# process to catalog the differences that were code reviewed, the -# following test can be applied to the code: -# -# Making sure that the entered bug-id number is correct. -# Validating that the code that was reviewed is indeed the code being -# checked in (using the bug-id number or a seperate review -# number to identify this particular code set.). -# -# If any of the above test failed, then the commit would be aborted. -# -# Actions such as mailing a copy of the report to each reviewer are -# better handled by an entry in the loginfo file. -# -# One thing that should be noted is the the ALL keyword is not -# supported. There can be only one entry that matches a given -# repository. diff --git a/cvsroot/CVSROOT/loginfo b/cvsroot/CVSROOT/loginfo deleted file mode 100644 index 25588bdcc..000000000 --- a/cvsroot/CVSROOT/loginfo +++ /dev/null @@ -1,33 +0,0 @@ -# The "loginfo" file controls where "cvs commit" log information -# is sent. The first entry on a line is a regular expression which must match -# the directory that the change is being made to, relative to the -# $CVSROOT. If a match is found, then the remainder of the line is a filter -# program that should expect log information on its standard input. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name ALL appears as a regular expression it is always used -# in addition to the first matching regex or DEFAULT. -# -# You may specify a format string as part of the -# filter. The string is composed of a `%' followed -# by a single format character, or followed by a set of format -# characters surrounded by `{' and `}' as separators. The format -# characters are: -# -# s = file name -# V = old version number (pre-checkin) -# v = new version number (post-checkin) -# t = tag or branch name -# -# For example: -#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog -# or -#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog -# -# This line sends all changes to the build module to the project admin. -# It is recommended that someone be watching this module -# as it shouldn't need to be modified very often. -build/ /cvsroot/sitedocs/CVSROOT/cvstools/syncmail %{sVv} coover-oss@users.sourceforge.net - diff --git a/cvsroot/CVSROOT/modules b/cvsroot/CVSROOT/modules deleted file mode 100644 index 62b5df0f0..000000000 --- a/cvsroot/CVSROOT/modules +++ /dev/null @@ -1,33 +0,0 @@ -# Three different line formats are valid: -# key -a aliases... -# key [options] directory -# key [options] directory files... -# -# Where "options" are composed of: -# -i prog Run "prog" on "cvs commit" from top-level of module. -# -o prog Run "prog" on "cvs checkout" of module. -# -e prog Run "prog" on "cvs export" of module. -# -t prog Run "prog" on "cvs rtag" of module. -# -u prog Run "prog" on "cvs update" of module. -# -d dir Place module in directory "dir" instead of module name. -# -l Top-level directory only -- do not recurse. -# -# NOTE: If you change any of the "Run" options above, you'll have to -# release and re-checkout any working directories of these modules. -# -# And "directory" is a path to a directory relative to $CVSROOT. -# -# The "-a" option specifies an alias. An alias is interpreted as if -# everything on the right of the "-a" had been typed on the command line. -# -# You can encode a module within a module by using the special '&' -# character to interpose another module into the current module. This -# can be useful for creating a module that consists of many directories -# spread out over the entire source repository. - -access -a src/com/ibm/as400/access -qcdemo -a demos/qcdemo - -# add an alias for "all" -all -a . - diff --git a/cvsroot/CVSROOT/notify b/cvsroot/CVSROOT/notify deleted file mode 100644 index 74ae6f9e9..000000000 --- a/cvsroot/CVSROOT/notify +++ /dev/null @@ -1,12 +0,0 @@ -# The "notify" file controls where notifications from watches set by -# "cvs watch add" or "cvs edit" are sent. The first entry on a line is -# a regular expression which is tested against the directory that the -# change is being made to, relative to the $CVSROOT. If it matches, -# then the remainder of the line is a filter program that should contain -# one occurrence of %s for the user to notify, and information on its -# standard input. -# -# "ALL" or "DEFAULT" can be used in place of the regular expression. -# -# For example: -#ALL mail -s "CVS notification" %s diff --git a/cvsroot/CVSROOT/rcsinfo b/cvsroot/CVSROOT/rcsinfo deleted file mode 100644 index 49e59f4d0..000000000 --- a/cvsroot/CVSROOT/rcsinfo +++ /dev/null @@ -1,13 +0,0 @@ -# The "rcsinfo" file is used to control templates with which the editor -# is invoked on commit and import. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being made to, relative to the -# $CVSROOT. For the first match that is found, then the remainder of the -# line is the name of the file that contains the template. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". diff --git a/cvsroot/CVSROOT/taginfo b/cvsroot/CVSROOT/taginfo deleted file mode 100644 index 274a46dd5..000000000 --- a/cvsroot/CVSROOT/taginfo +++ /dev/null @@ -1,20 +0,0 @@ -# The "taginfo" file is used to control pre-tag checks. -# The filter on the right is invoked with the following arguments: -# -# $1 -- tagname -# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d -# $3 -- repository -# $4-> file revision [file revision ...] -# -# A non-zero exit of the filter program will cause the tag to be aborted. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being committed to, relative -# to the $CVSROOT. For the first match that is found, then the remainder -# of the line is the name of the filter to run. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". diff --git a/cvsroot/CVSROOT/verifymsg b/cvsroot/CVSROOT/verifymsg deleted file mode 100644 index 86f747ce2..000000000 --- a/cvsroot/CVSROOT/verifymsg +++ /dev/null @@ -1,21 +0,0 @@ -# The "verifymsg" file is used to allow verification of logging -# information. It works best when a template (as specified in the -# rcsinfo file) is provided for the logging procedure. Given a -# template with locations for, a bug-id number, a list of people who -# reviewed the code before it can be checked in, and an external -# process to catalog the differences that were code reviewed, the -# following test can be applied to the code: -# -# Making sure that the entered bug-id number is correct. -# Validating that the code that was reviewed is indeed the code being -# checked in (using the bug-id number or a seperate review -# number to identify this particular code set.). -# -# If any of the above test failed, then the commit would be aborted. -# -# Actions such as mailing a copy of the report to each reviewer are -# better handled by an entry in the loginfo file. -# -# One thing that should be noted is the the ALL keyword is not -# supported. There can be only one entry that matches a given -# repository. diff --git a/cvsroot/build/.classpath b/cvsroot/build/.classpath deleted file mode 100644 index ea8367d40..000000000 --- a/cvsroot/build/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/cvsroot/build/.project b/cvsroot/build/.project deleted file mode 100644 index 7adef2444..000000000 --- a/cvsroot/build/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - build - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/cvsroot/build/.settings/org.eclipse.wst.validation.prefs b/cvsroot/build/.settings/org.eclipse.wst.validation.prefs deleted file mode 100644 index 5e7922dd4..000000000 --- a/cvsroot/build/.settings/org.eclipse.wst.validation.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Wed Mar 03 12:21:50 CST 2010 -DELEGATES_PREFERENCE=delegateValidatorList -USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.wst.wsi.ui.internal.WSIMessageValidator; -USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.wst.wsi.ui.internal.WSIMessageValidator; -USER_PREFERENCE=overrideGlobalPreferencesfalse -eclipse.preferences.version=1 -override=false -suspend=false -vf.version=3 diff --git a/cvsroot/build/CopyrightInsertionTask$Constant.class b/cvsroot/build/CopyrightInsertionTask$Constant.class deleted file mode 100644 index 66b017b5b..000000000 Binary files a/cvsroot/build/CopyrightInsertionTask$Constant.class and /dev/null differ diff --git a/cvsroot/build/CopyrightInsertionTask.class b/cvsroot/build/CopyrightInsertionTask.class deleted file mode 100644 index 414e9cd30..000000000 Binary files a/cvsroot/build/CopyrightInsertionTask.class and /dev/null differ diff --git a/cvsroot/build/CopyrightInsertionTask.java b/cvsroot/build/CopyrightInsertionTask.java deleted file mode 100644 index 295edabba..000000000 --- a/cvsroot/build/CopyrightInsertionTask.java +++ /dev/null @@ -1,332 +0,0 @@ -import java.io.*; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.taskdefs.MatchingTask; - - -public class CopyrightInsertionTask extends MatchingTask -{ - private static final String copyrightStringPart1_ = "Copyright (C) "; - private static final String copyrightStringPart2_ = "1997-2010"; - private static final String copyrightStringPart3_ = " International Business Machines Corporation and others."; - private static final String copyrightString_ = copyrightStringPart1_ + copyrightStringPart2_ + copyrightStringPart3_; - private static final int copyrightStringLength_ = copyrightString_.length(); - - private boolean verbose_; - - private File destDir_; // directory where the *.class files are located - - private int numFilesProcessed_ = 0; // count of class files processed - private int numFilesStamped_ = 0; // count of class files stamped - private int numFilesAlreadyStamped_ = 0; // count of class files already stamped - - public void setDestdir(File destDir) - { - destDir_ = destDir; - } - - public void setVerbose(boolean verbose) - { - verbose_ = verbose; - } - - - // Executes the task. - public void execute() throws BuildException - { - DirectoryScanner scanner = getDirectoryScanner(destDir_); - String[] classFileNames = scanner.getIncludedFiles(); - - for (int i=0; i 0x7F) // not a single-byte char - { - i++; - byte b = (byte)bytes[i]; - validate(b); - if (b > 0xBF) // not a double-byte char - { - i++; - byte c = (byte)bytes[i]; - validate(c); - ch = ((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f); - } - else // is a double-byte - { - ch = ((a & 0x1f) << 6) + (b & 0x3f); - } - } - else // is a single-byte - { - ch = a; - } - name.append((char)ch); - i++; - } - name_ = name.toString(); - } - - private /*static*/ void validate(byte x) - { - if (x==0x0 || x>=0xf0) - throw new NullPointerException("Invalid byte: "+x); - } - } - -} diff --git a/cvsroot/build/Jdbc40Task.class b/cvsroot/build/Jdbc40Task.class deleted file mode 100644 index e3bf41ac9..000000000 Binary files a/cvsroot/build/Jdbc40Task.class and /dev/null differ diff --git a/cvsroot/build/Jdbc40Task.java b/cvsroot/build/Jdbc40Task.java deleted file mode 100644 index 12d1fcbf1..000000000 --- a/cvsroot/build/Jdbc40Task.java +++ /dev/null @@ -1,266 +0,0 @@ -import java.io.*; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.taskdefs.MatchingTask; - - -public class Jdbc40Task extends MatchingTask -{ - static final String copyright = "Copyright (C) 2009-2010 International Business Machines Corporation and others."; - - private boolean verbose_; - - private File destDir_; // destination directory -- contains files which will be reprocessed - // existing files will be overwritten by processed source files - private File srcDir_; // source directory where source files will come from - - private int numFilesProcessed_ = 0; // count of class files processed - - public void setDestdir(File destDir) - { - destDir_ = destDir; - } - - public void setSrcdir (File srcDir) { - srcDir_ = srcDir; - } - - public void setVerbose(boolean verbose) - { - verbose_ = verbose; - } - - - // Executes the task. - public void execute() throws BuildException - { - BuildException lastException = null; - DirectoryScanner scanner = getDirectoryScanner(destDir_); - String[] destFileNames = scanner.getIncludedFiles(); - - for (int i=0; i 0) { - createJdbc40File(filename); - } - } catch (BuildException e) { - System.out.println(e.toString()); - lastException = e; - } - - numFilesProcessed_++; - } - - System.out.println("Number of files processed: " + numFilesProcessed_); - if (lastException != null) throw lastException ; - } - - final static int STATE_NONE=0; - final static int STATE_IFDEF40=1; - final static int STATE_IFNDEF40=2; - - final static int FOUND_NONE=0; - final static int FOUND_IFDEF40=1; - final static int FOUND_IFNDEF40=2; - final static int FOUND_ENDIF=3; - final static int FOUND_COMMENT=4; /* is any type of comment begin/end found */ - final static int FOUND_JDBC40DOC = 5; - - private int getLineType(String line, String filename, int lineNumber) { - String originalLine = line; - int typeCode = FOUND_NONE; - line = line.trim(); - if (line.indexOf("/*") == 0) { - line = line.substring(2).trim(); - if (line.indexOf("ifdef")== 0) { - line = line.substring(5).trim(); - if (line.indexOf("JDBC40") == 0) { - typeCode = FOUND_IFDEF40; - line = line.substring(6).trim(); - if (line.length() > 0) { - System.out.println("Warning. Incorrect ifdef line '"+originalLine+"' at "+filename+":"+lineNumber); - } - } - } else if (line.indexOf("ifndef")== 0) { - line = line.substring(6).trim(); - if (line.indexOf("JDBC40") == 0) { - typeCode = FOUND_IFNDEF40; - line = line.substring(6).trim(); - if (line.indexOf("*/") != 0) { - System.out.println("Warning. Incorrect ifndef line '"+originalLine+"' at "+filename+":"+lineNumber); - } - } - } else if (line.indexOf("endif") == 0) { - line = line.substring(5).trim(); - if (line.indexOf("*/") == 0) { - typeCode = FOUND_ENDIF; - } else { - System.out.println("Warning. Invalid /* endif */ structure: '"+line+"' at "+filename+":"+lineNumber); - } - } else { - typeCode = FOUND_COMMENT; - } - } else if (line.indexOf("endif") == 0) { - line = line.substring(5).trim(); - if (line.indexOf("*/") == 0) { - typeCode = FOUND_ENDIF; - } else { - System.out.println("Warning. Invalid endif */ structure: '"+line+"' at "+filename+":"+lineNumber); - } - } else if (line.indexOf("endif") > 0) { - System.out.println("Warning. Invalid endif... structure: '"+line+"' at "+filename+":"+lineNumber); - } else if (line.indexOf("//") == 0) { - line = line.substring(2).trim(); - if (line.indexOf("JDBC40DOC") == 0) { - typeCode = FOUND_JDBC40DOC; - } else if (line.indexOf("JDBC40DOC") > 0) { - System.out.println("Warning. Invalid JDBC40DOC after // line '"+line+"' at "+filename+":"+lineNumber); - } - } else if (line.indexOf("JDBC40DOC") > 0) { - System.out.println("Warning. Invalid JDBC40DOC line '"+line+"' at "+filename+":"+lineNumber); - } else if (line.indexOf("/*") > 0) { - typeCode = FOUND_COMMENT; - } else if (line.indexOf("*/") > 0) { - typeCode = FOUND_COMMENT; - } - - return typeCode; - } - - private void createJdbc40File(String filename) throws BuildException { - int lineNumber = 0; - try - { - long start = System.currentTimeMillis(); - - File inputFile = new File(srcDir_+"/"+filename); - File outputFile = new File(destDir_+"/"+filename); - - PrintWriter writer = new PrintWriter(outputFile); - BufferedReader reader = new BufferedReader(new FileReader(inputFile)); - - int state = STATE_NONE; - int linetype = 0; - int stateChangeLineNumber = 0; - String line = reader.readLine(); - while (line != null) { - lineNumber++; - linetype = getLineType(line,filename,lineNumber); - switch(state) { - case STATE_NONE: - switch (linetype) { - case FOUND_NONE: - case FOUND_COMMENT: - break; - case FOUND_IFDEF40: - state = STATE_IFDEF40; - stateChangeLineNumber = lineNumber; - line = "/* ifdef JDBC40 */"; - break; - case FOUND_IFNDEF40: - state = STATE_IFNDEF40; - stateChangeLineNumber = lineNumber; - line = "/* ifndef JDBC40 "; - break; - case FOUND_JDBC40DOC: - line = removeJdbc40Doc(line); - break; - case FOUND_ENDIF: - writer.close(); - throw new Exception("FOUND INVALID ENDIF:"+stateChangeLineNumber+" '"+line+ "' AT "+filename+":" + lineNumber); - } - break; - case STATE_IFDEF40: - switch (linetype) { - case FOUND_NONE: - break; - case FOUND_IFDEF40: - case FOUND_IFNDEF40: - writer.close(); - throw new Exception("FOUND INVALID IFDEF (currently processing IFDEF:"+stateChangeLineNumber+") '" + line - + "' AT "+filename+":" + lineNumber); - case FOUND_ENDIF: - state = STATE_NONE; - stateChangeLineNumber = lineNumber; - line = "/* endif */ "; - break; - case FOUND_COMMENT: - System.out.println("WARNING: found comment in line '"+line+"' processing IFDEF:"+stateChangeLineNumber+") '" + line - + "' AT "+filename+":" + lineNumber); - break; - case FOUND_JDBC40DOC: - line = removeJdbc40Doc(line); - break; - } - break; - case STATE_IFNDEF40: - switch (linetype) { - case FOUND_NONE: - break; - case FOUND_IFDEF40: - case FOUND_IFNDEF40: - writer.close(); - throw new Exception("FOUND INVALID IFDEF (currently processing IFNDEF:"+stateChangeLineNumber+") '" + line - + "' AT "+filename+":" + lineNumber); - case FOUND_ENDIF: - state = STATE_NONE; - stateChangeLineNumber = lineNumber; - line = " endif */ "; - break; - case FOUND_COMMENT: - System.out.println("WARNING: found comment in line '"+line+"' processing IFNDEF:"+stateChangeLineNumber+") '" + line - + "' AT "+filename+":" + lineNumber); - break; - case FOUND_JDBC40DOC: - System.out.println("WARNING: found JDBC40DOC in line '"+line+"' processing IFNDEF:"+stateChangeLineNumber+") '" + line - + "' AT "+filename+":" + lineNumber); - - break; - } - break; - } - writer.println(line); - line = reader.readLine(); - } - writer.close(); - - long end = System.currentTimeMillis(); - - if (verbose_) System.out.println("Processed. Time: "+(end-start)+" ms"); - } - catch (sun.io.MalformedInputException e) { - System.out.println("MalformedInputException processing "+filename+ " line : "+lineNumber); - e.printStackTrace(); - Throwable cause = e.getCause(); - while (cause != null ) { - System.out.println("----------caused by --------------------"); - cause.printStackTrace(); - cause = cause.getCause(); - } - throw new BuildException(e); - - } - catch (Exception e) { - System.out.println("Exception processing "+filename+ " line : "+lineNumber); - e.printStackTrace(); - throw new BuildException(e); - } - } - -private String removeJdbc40Doc(String line) { - int index = line.indexOf("JDBC40DOC"); - if (index > 0) { - return line.substring(index+9); - } - System.out.println("WARNING: did not find JDBC40DOC when processing removeJdbc40Doc"); - return line; -} - - -} diff --git a/cvsroot/build/PCMLTask.class b/cvsroot/build/PCMLTask.class deleted file mode 100644 index bcaeb1041..000000000 Binary files a/cvsroot/build/PCMLTask.class and /dev/null differ diff --git a/cvsroot/build/PCMLTask.java b/cvsroot/build/PCMLTask.java deleted file mode 100644 index f8f033a2c..000000000 --- a/cvsroot/build/PCMLTask.java +++ /dev/null @@ -1,81 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PCMLTask.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -import org.apache.tools.ant.*; -import org.apache.tools.ant.taskdefs.*; -import org.apache.tools.ant.types.*; -import java.io.*; - -/** - * ANT task used to generate serialized PCML files. -**/ -public class PCMLTask extends MatchingTask -{ - static final String copyright = "Copyright (C) 1997-2002 International Business Machines Corporation and others."; - - private File srcDir_; - private File destDir_; - private Path classpath_; - - public void setClasspath(Path s) - { - classpath_ = s; - } - - public void setSrcdir(File srcDir) - { - srcDir_ = srcDir; - } - - public void setDestdir(File destDir) - { - destDir_ = destDir; - } - - public void execute() throws BuildException - { - DirectoryScanner scanner = getDirectoryScanner(srcDir_); - String[] f = scanner.getIncludedFiles(); - - Java java = (Java)project.createTask("java"); - java.clearArgs(); - java.setClassname("com.ibm.as400.data.ProgramCallDocument"); - java.setClasspath(classpath_); - java.setFork(true); // Otherwise JDK 1.4 throws NoClassDefFoundError on sun/reflect/SerializationConstructorAccessorImpl - Commandline.Argument arg1 = java.createArg(); - arg1.setValue("-serialize"); - Commandline.Argument arg2 = java.createArg(); - for (int i=0; i - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - WARNING: Generated javadoc will be missing some information. - Can't find one of: - ${include}/servlet.jar - ${include}/midpapi10.jar - ${include}/cldcapi10.jar - ${include}/jui400.jar - ${include}/sslightx.zip - - - - - - - - - - - - - - - - - - - - - Pre-verifying Micro Edition classes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Available Ant targets for the JTOpen build script include: - - all - - clean, clean-dist, clean-javadoc, clean-output - - clean-source - - compile - - compile-micro - - copyright - - init - - jar, jar-jt400, jar-jt400Micro, jar-jt400Native, jar-jt400Proxy, jar-jt400Servlet - - javadoc, checkJavadocIncludes - - micro, micro-preverify - - pcml - - source - - usage - - zip, zip-javadoc, zip-source - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/build/buildEclipse.xml b/cvsroot/build/buildEclipse.xml deleted file mode 100644 index d8a0e528c..000000000 --- a/cvsroot/build/buildEclipse.xml +++ /dev/null @@ -1,1199 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - WARNING: Generated javadoc will be missing some information. - Can't find one of: - ${include}/servlet.jar - ${include}/midpapi10.jar - ${include}/cldcapi10.jar - ${include}/jui400.jar - ${include}/sslightx.zip - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Pre-verifying Micro Edition classes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Available Ant targets for the JTOpen build script include: - - all - - clean, clean-dist, clean-javadoc, clean-output - - clean-source - - compile - - compile-micro - - copyright - - init - - jar, jar-jt400, jar-jt400Micro, jar-jt400Native, jar-jt400Proxy, jar-jt400Servlet - - javadoc, checkJavadocIncludes - - micro, micro-preverify - - pcml - - source - - usage - - zip, zip-javadoc, zip-source - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/build/java.sql.Driver b/cvsroot/build/java.sql.Driver deleted file mode 100644 index b4e8a9875..000000000 --- a/cvsroot/build/java.sql.Driver +++ /dev/null @@ -1 +0,0 @@ -com.ibm.as400.access.AS400JDBCDriver \ No newline at end of file diff --git a/cvsroot/build/jt400Micro_manifest.txt b/cvsroot/build/jt400Micro_manifest.txt deleted file mode 100644 index 10f2ab012..000000000 --- a/cvsroot/build/jt400Micro_manifest.txt +++ /dev/null @@ -1,18 +0,0 @@ -Manifest-Version: 1.0 - -Name: com/ibm/as400/access/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.access -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/micro/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.micro -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - diff --git a/cvsroot/build/jt400Native_manifest.txt b/cvsroot/build/jt400Native_manifest.txt deleted file mode 100644 index 186c09b78..000000000 --- a/cvsroot/build/jt400Native_manifest.txt +++ /dev/null @@ -1,557 +0,0 @@ -Manifest-Version: 1.0 - -Name: com/ibm/as400/access/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.access -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/access/list/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.access.list -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/data/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.data -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/micro/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.micro -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/resource/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.resource -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/security/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.security -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/security/auth/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.security.auth -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/util/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.util -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/util/commtrace/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.util.commtrace -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/util/html/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.util.html -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/util/servlet/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.util.servlet -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: utilities/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: utilities -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/access/AFPResource.class -Java-Bean: True - -Name: com/ibm/as400/access/AFPResourceList.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400Array.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400CertificateUserProfileUtil.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400CertificateUtil.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400CertificateVldlUtil.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400ConnectionPool.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400File.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400FileRecordDescription.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400FTP.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400JDBCConnectionPool.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400JDBCConnectionPoolDataSource.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400JDBCDataSource.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400JDBCRowSet.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400JDBCXADataSource.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400Structure.class -Java-Bean: True - -Name: com/ibm/as400/access/BaseDataQueue.class -Java-Bean: True - -Name: com/ibm/as400/access/CharacterDataArea.class -Java-Bean: True - -Name: com/ibm/as400/access/ClusteredHashTable.class -Java-Bean: True - -Name: com/ibm/as400/access/ClusteredHashTableEntry.class -Java-Bean: True - -Name: com/ibm/as400/access/Command.class -Java-Bean: True - -Name: com/ibm/as400/access/CommandCall.class -Java-Bean: True - -Name: com/ibm/as400/access/CommandList.class -Java-Bean: True - -Name: com/ibm/as400/access/ConnectionPool.class -Java-Bean: True - -Name: com/ibm/as400/access/DataArea.class -Java-Bean: True - -Name: com/ibm/as400/access/DataQueueAttributes.class -Java-Bean: True - -Name: com/ibm/as400/access/DataQueue.class -Java-Bean: True - -Name: com/ibm/as400/access/DecimalDataArea.class -Java-Bean: True - -Name: com/ibm/as400/access/EnvironmentVariable.class -Java-Bean: True - -Name: com/ibm/as400/access/EnvironmentVariableList.class -Java-Bean: True - -Name: com/ibm/as400/access/FTP.class -Java-Bean: True - -Name: com/ibm/as400/access/IFSFile.class -Java-Bean: True - -Name: com/ibm/as400/access/IFSFileInputStream.class -Java-Bean: True - -Name: com/ibm/as400/access/IFSFileOutputStream.class -Java-Bean: True - -Name: com/ibm/as400/access/IFSRandomAccessFile.class -Java-Bean: True - -Name: com/ibm/as400/access/IFSTextFileInputStream.class -Java-Bean: True - -Name: com/ibm/as400/access/IFSTextFileOutputStream.class -Java-Bean: True - -Name: com/ibm/as400/access/JavaApplicationCall.class -Java-Bean: True - -Name: com/ibm/as400/access/Job.class -Java-Bean: True - -Name: com/ibm/as400/access/JobList.class -Java-Bean: True - -Name: com/ibm/as400/access/JobLog.class -Java-Bean: True - -Name: com/ibm/as400/access/KeyedDataQueue.class -Java-Bean: True - -Name: com/ibm/as400/access/KeyedFile.class -Java-Bean: True - -Name: com/ibm/as400/access/LocalDataArea.class -Java-Bean: True - -Name: com/ibm/as400/access/LogicalDataArea.class -Java-Bean: True - -Name: com/ibm/as400/access/MessageFile.class -Java-Bean: True - -Name: com/ibm/as400/access/MessageQueue.class -Java-Bean: True - -Name: com/ibm/as400/access/NetServer.class -Java-Bean: True - -Name: com/ibm/as400/access/NetServerFileShare.class -Java-Bean: True - -Name: com/ibm/as400/access/NetServerPrintShare.class -Java-Bean: True - -Name: com/ibm/as400/access/OutputQueue.class -Java-Bean: True - -Name: com/ibm/as400/access/OutputQueueList.class -Java-Bean: True - -Name: com/ibm/as400/access/PanelGroup.class -Java-Bean: True - -Name: com/ibm/as400/access/Printer.class -Java-Bean: True - -Name: com/ibm/as400/access/PrinterFile.class -Java-Bean: True - -Name: com/ibm/as400/access/PrinterFileList.class -Java-Bean: True - -Name: com/ibm/as400/access/PrinterList.class -Java-Bean: True - -Name: com/ibm/as400/access/PrintObject.class -Java-Bean: True - -Name: com/ibm/as400/access/PrintObjectList.class -Java-Bean: True - -Name: com/ibm/as400/access/ProductLicense.class -Java-Bean: True - -Name: com/ibm/as400/access/ProgramCall.class -Java-Bean: True - -Name: com/ibm/as400/access/ProgramParameter.class -Java-Bean: True - -Name: com/ibm/as400/access/QSYSObjectPathName.class -Java-Bean: True - -Name: com/ibm/as400/access/Record.class -Java-Bean: True - -Name: com/ibm/as400/access/RecordFormat.class -Java-Bean: True - -Name: com/ibm/as400/access/SecureAS400.class -Java-Bean: True - -Name: com/ibm/as400/access/SequentialFile.class -Java-Bean: True - -Name: com/ibm/as400/access/ServiceProgramCall.class -Java-Bean: True - -Name: com/ibm/as400/access/SpooledFileList.class -Java-Bean: True - -Name: com/ibm/as400/access/SystemPool.class -Java-Bean: True - -Name: com/ibm/as400/access/SystemStatus.class -Java-Bean: True - -Name: com/ibm/as400/access/SystemValue.class -Java-Bean: True - -Name: com/ibm/as400/access/SystemValueGroup.class -Java-Bean: True - -Name: com/ibm/as400/access/SystemValueList.class -Java-Bean: True - -Name: com/ibm/as400/access/User.class -Java-Bean: True - -Name: com/ibm/as400/access/UserList.class -Java-Bean: True - -Name: com/ibm/as400/access/UserSpace.class -Java-Bean: True - -Name: com/ibm/as400/access/WriterJobList.class -Java-Bean: True - -Name: com/ibm/as400/resource/Resource.class -Java-Bean: True - -Name: com/ibm/as400/resource/ResourceList.class -Java-Bean: True - -Name: com/ibm/as400/resource/RIFSFile.class -Java-Bean: True - -Name: com/ibm/as400/resource/RIFSFileList.class -Java-Bean: True - -Name: com/ibm/as400/resource/RJavaProgram.class -Java-Bean: True - -Name: com/ibm/as400/resource/RJob.class -Java-Bean: True - -Name: com/ibm/as400/resource/RJobList.class -Java-Bean: True - -Name: com/ibm/as400/resource/RJobLog.class -Java-Bean: True - -Name: com/ibm/as400/resource/RMessageQueue.class -Java-Bean: True - -Name: com/ibm/as400/resource/RPrinter.class -Java-Bean: True - -Name: com/ibm/as400/resource/RPrinterList.class -Java-Bean: True - -Name: com/ibm/as400/resource/RSoftwareResource.class -Java-Bean: True - -Name: com/ibm/as400/resource/RUser.class -Java-Bean: True - -Name: com/ibm/as400/resource/RUserList.class -Java-Bean: True - -Name: com/ibm/as400/util/html/BidiOrdering.class -Java-Bean: True - -Name: com/ibm/as400/util/html/ButtonFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/CheckboxFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/FileFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/FileListElement.class -Java-Bean: True - -Name: com/ibm/as400/util/html/FileTreeElement.class -Java-Bean: True - -Name: com/ibm/as400/util/html/FormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/GridLayoutFormPanel.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HiddenFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLAlign.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLApplet.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLForm.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLHead.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLHeading.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLHyperlink.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLImage.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLList.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLListItem.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLMeta.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLParameter.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLServlet.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLTable.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLTableCaption.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLTableCell.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLTableHeader.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLTableRow.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLTagAttributes.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLText.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLTree.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLTreeElement.class -Java-Bean: True - -Name: com/ibm/as400/util/html/ImageFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/LabelFormElement.class -Java-Bean: True - -Name: com/ibm/as400/util/html/LineLayoutFormPanel.class -Java-Bean: True - -Name: com/ibm/as400/util/html/OrderedList.class -Java-Bean: True - -Name: com/ibm/as400/util/html/OrderedListItem.class -Java-Bean: True - -Name: com/ibm/as400/util/html/PasswordFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/RadioFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/RadioFormInputGroup.class -Java-Bean: True - -Name: com/ibm/as400/util/html/ResetFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/SelectFormElement.class -Java-Bean: True - -Name: com/ibm/as400/util/html/SelectOption.class -Java-Bean: True - -Name: com/ibm/as400/util/html/SubmitFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/TextAreaFormElement.class -Java-Bean: True - -Name: com/ibm/as400/util/html/TextFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/ToggleFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/UnorderedList.class -Java-Bean: True - -Name: com/ibm/as400/util/html/UnorderedListItem.class -Java-Bean: True - -Name: com/ibm/as400/util/servlet/ListMetaData.class -Java-Bean: True - -Name: com/ibm/as400/util/servlet/ListRowData.class -Java-Bean: True - -Name: com/ibm/as400/util/servlet/RecordFormatMetaData.class -Java-Bean: True - -Name: com/ibm/as400/util/servlet/RecordListRowData.class -Java-Bean: True - -Name: com/ibm/as400/util/servlet/ResourceListRowData.class -Java-Bean: True - -Name: com/ibm/as400/util/servlet/ServletHyperlink.class -Java-Bean: True - -Name: com/ibm/as400/util/servlet/SQLResultSetMetaData.class -Java-Bean: True - -Name: com/ibm/as400/util/servlet/SQLResultSetRowData.class -Java-Bean: True - -Name: com/ibm/as400/security/auth/AS400Credential.class -Java-Bean: True - -Name: com/ibm/as400/security/auth/AS400Principal.class -Java-Bean: True - -Name: com/ibm/as400/security/auth/ProfileHandleCredential.class -Java-Bean: True - -Name: com/ibm/as400/security/auth/ProfileTokenCredential.class -Java-Bean: True - -Name: com/ibm/as400/security/auth/UserProfilePrincipal.class -Java-Bean: True - diff --git a/cvsroot/build/jt400Proxy_manifest.txt b/cvsroot/build/jt400Proxy_manifest.txt deleted file mode 100644 index 3b50c450c..000000000 --- a/cvsroot/build/jt400Proxy_manifest.txt +++ /dev/null @@ -1,26 +0,0 @@ -Manifest-Version: 1.0 - -Name: com/ibm/as400/access/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.access -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/security/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.security -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/security/auth/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.security.auth -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - diff --git a/cvsroot/build/jt400Servlet_manifest.txt b/cvsroot/build/jt400Servlet_manifest.txt deleted file mode 100644 index be5c1cbfc..000000000 --- a/cvsroot/build/jt400Servlet_manifest.txt +++ /dev/null @@ -1,191 +0,0 @@ -Manifest-Version: 1.0 - -Name: com/ibm/as400/access/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.access -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/util/html/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.util.html -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/util/servlet/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.util.servlet -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/util/html/FileFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/FileListElement.class -Java-Bean: True - -Name: com/ibm/as400/util/html/FileTreeElement.class -Java-Bean: True - -Name: com/ibm/as400/util/html/FormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/GridLayoutFormPanel.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HiddenFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLAlign.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLApplet.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLForm.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLHead.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLHeading.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLHyperlink.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLImage.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLList.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLListItem.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLMeta.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLParameter.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLServlet.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLTable.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLTableCaption.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLTableCell.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLTableHeader.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLTableRow.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLTagAttributes.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLText.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLTree.class -Java-Bean: True - -Name: com/ibm/as400/util/html/HTMLTreeElement.class -Java-Bean: True - -Name: com/ibm/as400/util/html/ImageFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/LabelFormElement.class -Java-Bean: True - -Name: com/ibm/as400/util/html/LineLayoutFormPanel.class -Java-Bean: True - -Name: com/ibm/as400/util/html/OrderedList.class -Java-Bean: True - -Name: com/ibm/as400/util/html/OrderedListItem.class -Java-Bean: True - -Name: com/ibm/as400/util/html/PasswordFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/RadioFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/RadioFormInputGroup.class -Java-Bean: True - -Name: com/ibm/as400/util/html/ResetFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/SelectFormElement.class -Java-Bean: True - -Name: com/ibm/as400/util/html/SelectOption.class -Java-Bean: True - -Name: com/ibm/as400/util/html/SubmitFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/TextAreaFormElement.class -Java-Bean: True - -Name: com/ibm/as400/util/html/TextFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/ToggleFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/UnorderedList.class -Java-Bean: True - -Name: com/ibm/as400/util/html/UnorderedListItem.class -Java-Bean: True - -Name: com/ibm/as400/util/html/BidiOrdering.class -Java-Bean: True - -Name: com/ibm/as400/util/html/ButtonFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/html/CheckboxFormInput.class -Java-Bean: True - -Name: com/ibm/as400/util/servlet/ListMetaData.class -Java-Bean: True - -Name: com/ibm/as400/util/servlet/ListRowData.class -Java-Bean: True - -Name: com/ibm/as400/util/servlet/RecordFormatMetaData.class -Java-Bean: True - -Name: com/ibm/as400/util/servlet/RecordListRowData.class -Java-Bean: True - -Name: com/ibm/as400/util/servlet/ResourceListRowData.class -Java-Bean: True - -Name: com/ibm/as400/util/servlet/ServletHyperlink.class -Java-Bean: True - -Name: com/ibm/as400/util/servlet/SQLResultSetMetaData.class -Java-Bean: True - -Name: com/ibm/as400/util/servlet/SQLResultSetRowData.class -Java-Bean: True - diff --git a/cvsroot/build/jt400_manifest.txt b/cvsroot/build/jt400_manifest.txt deleted file mode 100644 index d98475dad..000000000 --- a/cvsroot/build/jt400_manifest.txt +++ /dev/null @@ -1,528 +0,0 @@ -Manifest-Version: 1.0 - -Name: com/ibm/as400/access/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.access -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/access/list/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.access.list -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/data/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.data -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/micro/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.micro -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/resource/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.resource -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/security/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.security -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/security/auth/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.security.auth -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/util/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.util -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/util/commtrace/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.util.commtrace -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/vaccess/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: com.ibm.as400.vaccess -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: utilities/ -Specification-Title: IBM Toolbox for Java -Specification-Version: 7.1.0.5 -Specification-Vendor: IBM Corporation -Implementation-Title: utilities -Implementation-Version: JTOpen 7.4 -Implementation-Vendor: IBM Corporation and others - -Name: com/ibm/as400/access/AFPResource.class -Java-Bean: True - -Name: com/ibm/as400/access/AFPResourceList.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400Array.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400CertificateUserProfileUtil.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400CertificateUtil.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400CertificateVldlUtil.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400ConnectionPool.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400File.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400FileRecordDescription.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400FTP.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400JDBCConnectionPool.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400JDBCConnectionPoolDataSource.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400JDBCDataSource.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400JDBCRowSet.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400JDBCXADataSource.class -Java-Bean: True - -Name: com/ibm/as400/access/AS400Structure.class -Java-Bean: True - -Name: com/ibm/as400/access/BaseDataQueue.class -Java-Bean: True - -Name: com/ibm/as400/access/CharacterDataArea.class -Java-Bean: True - -Name: com/ibm/as400/access/ClusteredHashTable.class -Java-Bean: True - -Name: com/ibm/as400/access/ClusteredHashTableEntry.class -Java-Bean: True - -Name: com/ibm/as400/access/Command.class -Java-Bean: True - -Name: com/ibm/as400/access/CommandCall.class -Java-Bean: True - -Name: com/ibm/as400/access/CommandList.class -Java-Bean: True - -Name: com/ibm/as400/access/ConnectionPool.class -Java-Bean: True - -Name: com/ibm/as400/access/DataArea.class -Java-Bean: True - -Name: com/ibm/as400/access/DataQueueAttributes.class -Java-Bean: True - -Name: com/ibm/as400/access/DataQueue.class -Java-Bean: True - -Name: com/ibm/as400/access/DecimalDataArea.class -Java-Bean: True - -Name: com/ibm/as400/access/EnvironmentVariable.class -Java-Bean: True - -Name: com/ibm/as400/access/EnvironmentVariableList.class -Java-Bean: True - -Name: com/ibm/as400/access/FTP.class -Java-Bean: True - -Name: com/ibm/as400/access/IFSFile.class -Java-Bean: True - -Name: com/ibm/as400/access/IFSFileInputStream.class -Java-Bean: True - -Name: com/ibm/as400/access/IFSFileOutputStream.class -Java-Bean: True - -Name: com/ibm/as400/access/IFSRandomAccessFile.class -Java-Bean: True - -Name: com/ibm/as400/access/IFSTextFileInputStream.class -Java-Bean: True - -Name: com/ibm/as400/access/IFSTextFileOutputStream.class -Java-Bean: True - -Name: com/ibm/as400/access/JavaApplicationCall.class -Java-Bean: True - -Name: com/ibm/as400/access/Job.class -Java-Bean: True - -Name: com/ibm/as400/access/JobList.class -Java-Bean: True - -Name: com/ibm/as400/access/JobLog.class -Java-Bean: True - -Name: com/ibm/as400/access/KeyedDataQueue.class -Java-Bean: True - -Name: com/ibm/as400/access/KeyedFile.class -Java-Bean: True - -Name: com/ibm/as400/access/LocalDataArea.class -Java-Bean: True - -Name: com/ibm/as400/access/LogicalDataArea.class -Java-Bean: True - -Name: com/ibm/as400/access/MessageFile.class -Java-Bean: True - -Name: com/ibm/as400/access/MessageQueue.class -Java-Bean: True - -Name: com/ibm/as400/access/NetServer.class -Java-Bean: True - -Name: com/ibm/as400/access/NetServerFileShare.class -Java-Bean: True - -Name: com/ibm/as400/access/NetServerPrintShare.class -Java-Bean: True - -Name: com/ibm/as400/access/OutputQueue.class -Java-Bean: True - -Name: com/ibm/as400/access/OutputQueueList.class -Java-Bean: True - -Name: com/ibm/as400/access/PanelGroup.class -Java-Bean: True - -Name: com/ibm/as400/access/Printer.class -Java-Bean: True - -Name: com/ibm/as400/access/PrinterFile.class -Java-Bean: True - -Name: com/ibm/as400/access/PrinterFileList.class -Java-Bean: True - -Name: com/ibm/as400/access/PrinterList.class -Java-Bean: True - -Name: com/ibm/as400/access/PrintObject.class -Java-Bean: True - -Name: com/ibm/as400/access/PrintObjectList.class -Java-Bean: True - -Name: com/ibm/as400/access/ProductLicense.class -Java-Bean: True - -Name: com/ibm/as400/access/ProgramCall.class -Java-Bean: True - -Name: com/ibm/as400/access/ProgramParameter.class -Java-Bean: True - -Name: com/ibm/as400/access/QSYSObjectPathName.class -Java-Bean: True - -Name: com/ibm/as400/access/Record.class -Java-Bean: True - -Name: com/ibm/as400/access/RecordFormat.class -Java-Bean: True - -Name: com/ibm/as400/access/SecureAS400.class -Java-Bean: True - -Name: com/ibm/as400/access/SequentialFile.class -Java-Bean: True - -Name: com/ibm/as400/access/ServiceProgramCall.class -Java-Bean: True - -Name: com/ibm/as400/access/SpooledFileList.class -Java-Bean: True - -Name: com/ibm/as400/access/SystemPool.class -Java-Bean: True - -Name: com/ibm/as400/access/SystemStatus.class -Java-Bean: True - -Name: com/ibm/as400/access/SystemValue.class -Java-Bean: True - -Name: com/ibm/as400/access/SystemValueGroup.class -Java-Bean: True - -Name: com/ibm/as400/access/SystemValueList.class -Java-Bean: True - -Name: com/ibm/as400/access/User.class -Java-Bean: True - -Name: com/ibm/as400/access/UserList.class -Java-Bean: True - -Name: com/ibm/as400/access/UserSpace.class -Java-Bean: True - -Name: com/ibm/as400/access/WriterJobList.class -Java-Bean: True - -Name: com/ibm/as400/resource/Resource.class -Java-Bean: True - -Name: com/ibm/as400/resource/ResourceList.class -Java-Bean: True - -Name: com/ibm/as400/resource/RIFSFile.class -Java-Bean: True - -Name: com/ibm/as400/resource/RIFSFileList.class -Java-Bean: True - -Name: com/ibm/as400/resource/RJavaProgram.class -Java-Bean: True - -Name: com/ibm/as400/resource/RJob.class -Java-Bean: True - -Name: com/ibm/as400/resource/RJobList.class -Java-Bean: True - -Name: com/ibm/as400/resource/RJobLog.class -Java-Bean: True - -Name: com/ibm/as400/resource/RMessageQueue.class -Java-Bean: True - -Name: com/ibm/as400/resource/RPrinter.class -Java-Bean: True - -Name: com/ibm/as400/resource/RPrinterList.class -Java-Bean: True - -Name: com/ibm/as400/resource/RSoftwareResource.class -Java-Bean: True - -Name: com/ibm/as400/resource/RUser.class -Java-Bean: True - -Name: com/ibm/as400/resource/RUserList.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/AS400DetailsModel.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/AS400DetailsPane.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/AS400ExplorerPane.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/AS400JDBCDataSourcePane.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/AS400ListModel.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/AS400ListPane.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/AS400TreeModel.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/AS400TreePane.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/CommandCallButton.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/CommandCallMenuItem.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/DataQueueDocument.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/ErrorDialogAdapter.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/IFSTextFileDocument.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/KeyedDataQueueDocument.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/ProgramCallButton.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/ProgramCallMenuItem.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/RecordListFormPane.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/RecordListTableModel.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/RecordListTablePane.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/ResourceListDetailsModel.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/ResourceListDetailsPane.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/ResourceListModel.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/ResourceListPane.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/SpooledFileViewer.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/SQLConnection.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/SQLQueryBuilderPane.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/SQLResultSetFormPane.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/SQLResultSetTableModel.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/SQLResultSetTablePane.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/SQLStatementButton.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/SQLStatementDocument.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/SQLStatementMenuItem.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/VActionAdapter.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/VIFSDirectory.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/VJavaApplicationCall.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/VJob.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/VJobList.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/VMessageList.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/VMessageQueue.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/VPrinter.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/VPrinterOutput.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/VPrinters.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/VPropertiesAction.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/VSystemPool.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/VSystemStatus.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/VSystemValueList.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/VUserList.class -Java-Bean: True - -Name: com/ibm/as400/vaccess/WorkingCursorAdapter.class -Java-Bean: True - -Name: com/ibm/as400/security/auth/AS400Credential.class -Java-Bean: True - -Name: com/ibm/as400/security/auth/AS400Principal.class -Java-Bean: True - -Name: com/ibm/as400/security/auth/ProfileHandleCredential.class -Java-Bean: True - -Name: com/ibm/as400/security/auth/ProfileTokenCredential.class -Java-Bean: True - -Name: com/ibm/as400/security/auth/UserProfilePrincipal.class -Java-Bean: True - diff --git a/cvsroot/build/micro.includes b/cvsroot/build/micro.includes deleted file mode 100644 index 5e7da711a..000000000 --- a/cvsroot/build/micro.includes +++ /dev/null @@ -1,30 +0,0 @@ -#--------------------------------------------------- -# Package these in the jt400Micro.jar file. -#--------------------------------------------------- - -com/ibm/as400/micro/AS400.class -com/ibm/as400/micro/CommandCall.class -com/ibm/as400/micro/DataQueue.class -com/ibm/as400/micro/JdbcMeConnection.class -com/ibm/as400/micro/JdbcMeDriver.class -com/ibm/as400/micro/JdbcMeException.class -com/ibm/as400/micro/JdbcMeLiveResultSet.class -com/ibm/as400/micro/JdbcMeOfflineData.class -com/ibm/as400/micro/JdbcMeOfflineMidpData.class -com/ibm/as400/micro/JdbcMeOfflinePalmData.class -com/ibm/as400/micro/JdbcMeOfflineResultSet.class -com/ibm/as400/micro/JdbcMeResultSetMetaData.class -com/ibm/as400/micro/JdbcMeStatement.class -com/ibm/as400/micro/MEConstants.class -com/ibm/as400/micro/MEException.class -com/ibm/as400/micro/ProgramCall.class - -java/sql/Connection.class -java/sql/DriverManager.class -java/sql/PreparedStatement.class -java/sql/ResultSet.class -java/sql/ResultSetMetaData.class -java/sql/SQLException.class -java/sql/Statement.class -java/sql/Types.class - diff --git a/cvsroot/build/proxy.includes b/cvsroot/build/proxy.includes deleted file mode 100644 index 0340fe57b..000000000 --- a/cvsroot/build/proxy.includes +++ /dev/null @@ -1,347 +0,0 @@ -#--------------------------------------------------- -# Package these in the jt400Proxy.jar file. -#--------------------------------------------------- - -#--------------------------------------------------- -# Proxy infrastructure -#--------------------------------------------------- -com/ibm/as400/access/AbstractProxyImpl.class -com/ibm/as400/access/Px*CV.class -com/ibm/as400/access/Px*DS*.class -com/ibm/as400/access/PxEventSupport.class -com/ibm/as400/access/ProxyClientConnection.class -com/ibm/as400/access/ProxyClientConnection$$SecondaryFinalizerThread_.class -com/ibm/as400/access/ProxyConstants.class -com/ibm/as400/access/ProxyException.class -com/ibm/as400/access/ProxyFactoryImpl.class -com/ibm/as400/access/ProxyImpl.class -com/ibm/as400/access/ProxyReturnValue.class -com/ibm/as400/access/Px*Parm.class -com/ibm/as400/access/PxClientConnectionAdapter.class -com/ibm/as400/access/PxClientReadDaemon.class -com/ibm/as400/access/PxSecureSocketContainer*.class -com/ibm/as400/access/PxSocketContainer*.class -com/ibm/as400/access/PxTable.class -com/ibm/as400/access/RetryInputStream.class - -#--------------------------------------------------- -# Proxy Client Keyring -#--------------------------------------------------- -com/ibm/as400/access/KeyRing.class - -#--------------------------------------------------- -# Toolbox infrastructure -#--------------------------------------------------- -com/ibm/as400/access/AS400.class -com/ibm/as400/access/AS400$$*.class -com/ibm/as400/access/AS400Exception.class -com/ibm/as400/access/AS400Impl.class -com/ibm/as400/access/AS400ImplProxy.class -com/ibm/as400/access/AS400SecurityException.class -com/ibm/as400/access/ConnectionDroppedException.class -com/ibm/as400/access/ConnectionEvent.class -com/ibm/as400/access/ConnectionListener.class -com/ibm/as400/access/ConversionMaps.class -com/ibm/as400/access/Copyright.class -com/ibm/as400/access/CurrentUser.class -com/ibm/as400/access/ErrorCompletingRequestException.class -com/ibm/as400/access/ExecutionEnvironment.class -com/ibm/as400/access/ExtendedIOException.class -com/ibm/as400/access/IllegalObjectTypeException.class -com/ibm/as400/access/IllegalPathNameException.class -com/ibm/as400/access/InternalErrorException.class -com/ibm/as400/access/MessageDialog.class -com/ibm/as400/access/ObjectDoesNotExistException.class -com/ibm/as400/access/ObjectAlreadyExistsException.class -com/ibm/as400/access/QSYSObjectPathName.class -com/ibm/as400/access/RequestNotSupportedException.class -com/ibm/as400/access/ReturnCodeException.class -com/ibm/as400/access/SecureAS400.class -com/ibm/as400/access/SSLOptions.class -com/ibm/as400/access/ServerStartupException.class -com/ibm/as400/access/ServerVersion.class -com/ibm/as400/access/SignonConverter.class -com/ibm/as400/access/SignonInfo.class -com/ibm/as400/access/SocketContainer.class -com/ibm/as400/access/SocketProperties.class -com/ibm/as400/access/StoppableThread.class -com/ibm/as400/access/SystemProperties.class - -#--------------------------------------------------- -# Command call -#--------------------------------------------------- -com/ibm/as400/access/ActionCompletedEvent.class -com/ibm/as400/access/ActionCompletedListener.class -com/ibm/as400/access/AS400Message.class -com/ibm/as400/access/CommandCall.class -com/ibm/as400/access/MessageFile.class - -#--------------------------------------------------- -# Core Toolbox function -#--------------------------------------------------- -com/ibm/as400/access/AS400Signon*.class -com/ibm/as400/access/ChangePasswordDialog.class -com/ibm/as400/access/ExtendedIllegalArgumentException.class -com/ibm/as400/access/ExtendedIllegalStateException.class -com/ibm/as400/access/PasswordDialog.class -com/ibm/as400/access/ResourceBundleLoader.class -com/ibm/as400/access/Trace.class -com/ibm/as400/access/ToolboxLogger.class -com/ibm/as400/access/SignonEvent.class -com/ibm/as400/access/*SignonHandler*.class - -#--------------------------------------------------- -# Data areas -#--------------------------------------------------- -com/ibm/as400/access/*DataArea.class -com/ibm/as400/access/DataAreaEvent.class -com/ibm/as400/access/DataAreaImpl.class -com/ibm/as400/access/DataAreaImplProxy.class -com/ibm/as400/access/DataAreaListener.class - -#--------------------------------------------------- -# Data queues -#--------------------------------------------------- -com/ibm/as400/access/BaseDataQueueImpl.class -com/ibm/as400/access/BaseDataQueueImplProxy.class -com/ibm/as400/access/*DataQueue.class -com/ibm/as400/access/*DataQueueEntry.class -com/ibm/as400/access/DataQueueAttributes.class -com/ibm/as400/access/DataQueueEvent.class -com/ibm/as400/access/DataQueueListener.class -com/ibm/as400/access/DQ*Record.class -com/ibm/as400/access/ObjectEvent.class -com/ibm/as400/access/ObjectListener.class - -#--------------------------------------------------- -# Data description and conversion -#--------------------------------------------------- -com/ibm/as400/access/AS400Array.class -com/ibm/as400/access/AS400BidiTransform.class -com/ibm/as400/access/AS400Bin2.class -com/ibm/as400/access/AS400Bin4.class -com/ibm/as400/access/AS400Bin8.class -com/ibm/as400/access/AS400ByteArray.class -com/ibm/as400/access/AS400DataType.class -com/ibm/as400/access/AS400Float4.class -com/ibm/as400/access/AS400Float8.class -com/ibm/as400/access/AS400PackedDecimal.class -com/ibm/as400/access/AS400Structure.class -com/ibm/as400/access/AS400Text.class -com/ibm/as400/access/AS400UnsignedBin2.class -com/ibm/as400/access/AS400UnsignedBin4.class -com/ibm/as400/access/AS400ZonedDecimal.class -com/ibm/as400/access/BinaryConverter.class -com/ibm/as400/access/BidiFlag.class -com/ibm/as400/access/BidiFlagSet.class -com/ibm/as400/access/BidiStringType.class -com/ibm/as400/access/BidiConversionProperties.class -com/ibm/as400/access/BidiTransform.class -com/ibm/as400/access/Converter.class -com/ibm/as400/access/ConverterImpl.class -com/ibm/as400/access/ConverterImplProxy.class -com/ibm/as400/access/*FieldDescription.class - -#--------------------------------------------------- -# IFS -#--------------------------------------------------- -com/ibm/as400/access/FileEvent.class -com/ibm/as400/access/FileListener.class -com/ibm/as400/access/IFSCachedAttributes.class -com/ibm/as400/access/IFSFile.class -com/ibm/as400/access/IFSFileDescriptor.class -com/ibm/as400/access/IFSFileDescriptorImpl.class -com/ibm/as400/access/IFSFileDescriptorImplProxy.class -com/ibm/as400/access/IFSFileEnumeration.class -com/ibm/as400/access/IFSFileFilter.class -com/ibm/as400/access/IFSFileImpl.class -com/ibm/as400/access/IFSFileImplProxy.class -com/ibm/as400/access/IFSFileInputStream.class -com/ibm/as400/access/IFSFileInputStreamImpl.class -com/ibm/as400/access/IFSFileInputStreamImplProxy.class -com/ibm/as400/access/IFSFileOutputStream.class -com/ibm/as400/access/IFSFileOutputStreamImpl.class -com/ibm/as400/access/IFSFileOutputStreamImplProxy.class -com/ibm/as400/access/IFSJavaFile.class -com/ibm/as400/access/IFSKey.class -com/ibm/as400/access/IFSRandomAccessFile.class -com/ibm/as400/access/IFSRandomAccessFileImpl.class -com/ibm/as400/access/IFSRandomAccessFileImplProxy.class -com/ibm/as400/access/IFSTextFileInputStream.class -com/ibm/as400/access/IFSTextFileOutputStream.class - -#--------------------------------------------------- -# JDBC -#--------------------------------------------------- -com/ibm/as400/access/AS400JDBCDriver.class -com/ibm/as400/access/JDDataSourceURL.class -com/ibm/as400/access/JDProperties.class -com/ibm/as400/access/JD*Proxy.class -com/ibm/as400/access/JDTrace.class -com/ibm/as400/access/SerializableInputStream.class -com/ibm/as400/access/SerializableReader.class -com/ibm/as400/access/ToolboxWrapper.class - -#--------------------------------------------------- -# Print -#--------------------------------------------------- -com/ibm/as400/access/AFPResource.class -com/ibm/as400/access/AFPResourceImplProxy.class -com/ibm/as400/access/AFPResourceList.class -com/ibm/as400/access/AFPResourceListImplProxy.class -com/ibm/as400/access/NPAttr*.class -com/ibm/as400/access/NPCodePoint.class -com/ibm/as400/access/NPConstants.class -com/ibm/as400/access/NPCPAttribute.class -com/ibm/as400/access/NPCPAttributeIDList.class -com/ibm/as400/access/NPCPAttributeValue.class -com/ibm/as400/access/NPCPID.class -com/ibm/as400/access/NPCPIDAFPResource.class -com/ibm/as400/access/NPCPIDLibrary.class -com/ibm/as400/access/NPCPIDOutQ.class -com/ibm/as400/access/NPCPIDPrinter.class -com/ibm/as400/access/NPCPIDPrinterFile.class -com/ibm/as400/access/NPCPIDSplF.class -com/ibm/as400/access/NPCPIDWriter.class -com/ibm/as400/access/NPCPSelection.class -com/ibm/as400/access/NPCPSelOutQ.class -com/ibm/as400/access/NPCPSelPrtD.class -com/ibm/as400/access/NPCPSelPrtF.class -com/ibm/as400/access/NPCPSelRes.class -com/ibm/as400/access/NPCPSelSplF.class -com/ibm/as400/access/NPCPSelWrtJ.class -com/ibm/as400/access/OutputQueue.class -com/ibm/as400/access/OutputQueueEvent.class -com/ibm/as400/access/OutputQueueImpl.class -com/ibm/as400/access/OutputQueueImplProxy.class -com/ibm/as400/access/OutputQueueList.class -com/ibm/as400/access/OutputQueueListImplProxy.class -com/ibm/as400/access/OutputQueueListener.class -com/ibm/as400/access/PrintObject.class -com/ibm/as400/access/PrintObjectImpl.class -com/ibm/as400/access/PrintObjectImplProxy.class -com/ibm/as400/access/PrintObjectInputStream.class -com/ibm/as400/access/PrintObjectInputStreamImpl.class -com/ibm/as400/access/PrintObjectInputStreamImplProxy.class -com/ibm/as400/access/PrintObjectList.class -com/ibm/as400/access/PrintObjectList$$*.class -com/ibm/as400/access/PrintObjectListEvent.class -com/ibm/as400/access/PrintObjectListImpl.class -com/ibm/as400/access/PrintObjectListImplProxy.class -com/ibm/as400/access/PrintObjectListListener.class -com/ibm/as400/access/PrintObjectPageInputStream.class -com/ibm/as400/access/PrintObjectPageInputStreamImpl.class -com/ibm/as400/access/PrintObjectPageInputStreamImplProxy.class -com/ibm/as400/access/PrintObjectTransformedInputStream.class -com/ibm/as400/access/PrintObjectTransformedInputStreamImpl.class -com/ibm/as400/access/PrintObjectTransformedInputStreamImplProxy.class -com/ibm/as400/access/PrintParameterList.class -com/ibm/as400/access/Printer.class -com/ibm/as400/access/PrinterImplProxy.class -com/ibm/as400/access/PrinterFile.class -com/ibm/as400/access/PrinterFileImpl.class -com/ibm/as400/access/PrinterFileImplProxy.class -com/ibm/as400/access/PrinterFileList.class -com/ibm/as400/access/PrinterFileListImplProxy.class -com/ibm/as400/access/PrinterList.class -com/ibm/as400/access/PrinterListImplProxy.class -com/ibm/as400/access/SCSFontData.class -com/ibm/as400/access/SCS*Writer.class -com/ibm/as400/access/SpooledFile.class -com/ibm/as400/access/SpooledFileImpl.class -com/ibm/as400/access/SpooledFileImplProxy.class -com/ibm/as400/access/SpooledFileList.class -com/ibm/as400/access/SpooledFileListImplProxy.class -com/ibm/as400/access/SpooledFileOutputStream.class -com/ibm/as400/access/SpooledFileOutputStreamImpl.class -com/ibm/as400/access/SpooledFileOutputStreamImplProxy.class -com/ibm/as400/access/WriterJob.class -com/ibm/as400/access/WriterJobImpl.class -com/ibm/as400/access/WriterJobImplProxy.class -com/ibm/as400/access/WriterJobList.class -com/ibm/as400/access/WriterJobListImplProxy.class - -#--------------------------------------------------- -# Program call and service program call -#--------------------------------------------------- -com/ibm/as400/access/ProgramCall.class -com/ibm/as400/access/RemoteCommandImpl.class -com/ibm/as400/access/RemoteCommandImplProxy.class -com/ibm/as400/access/ProgramParameter.class -com/ibm/as400/access/ServiceProgramCall.class - -#--------------------------------------------------- -# Record level access -#--------------------------------------------------- -com/ibm/as400/access/AS400File.class -com/ibm/as400/access/AS400FileConstants.class -com/ibm/as400/access/AS400FileImpl.class -com/ibm/as400/access/AS400FileImplProxy.class -com/ibm/as400/access/AS400FileRecordDescription.class -com/ibm/as400/access/AS400FileRecordDescriptionImpl.class -com/ibm/as400/access/AS400FileRecordDescriptionImplProxy.class -com/ibm/as400/access/AS400FileRecordDescriptionEvent.class -com/ibm/as400/access/AS400FileRecordDescriptionListener.class -com/ibm/as400/access/KeyedFile.class -com/ibm/as400/access/SequentialFile.class -com/ibm/as400/access/Record.class -com/ibm/as400/access/RecordDescriptionEvent.class -com/ibm/as400/access/RecordDescriptionListener.class -com/ibm/as400/access/RecordFormat.class - -#--------------------------------------------------- -# Security - The AS400 class did not allow a signon -# with JDK 1.2 unless we added these -# to jt400Proxy.jar. -#--------------------------------------------------- -com/ibm/as400/security/SecurityMRI.class -com/ibm/as400/security/SecurityMRI_*.class -com/ibm/as400/security/auth/AS400Credential.class -com/ibm/as400/security/auth/AS400CredentialEvent.class -com/ibm/as400/security/auth/AS400CredentialImpl.class -com/ibm/as400/security/auth/AS400CredentialListener.class -com/ibm/as400/security/auth/AS400BasicAuthenticationCredential.class -com/ibm/as400/security/auth/AS400BasicAuthenticationPrincipal.class -com/ibm/as400/security/auth/AS400SwappableCredential.class -com/ibm/as400/security/auth/AS400Principal.class -com/ibm/as400/security/auth/AuthenticationSystem.class -com/ibm/as400/security/auth/DestroyFailedException.class -com/ibm/as400/security/auth/ProfileTokenCredential.class -com/ibm/as400/security/auth/ProfileTokenImpl.class -com/ibm/as400/security/auth/RefreshAgent.class -com/ibm/as400/security/auth/RefreshFailedException.class -com/ibm/as400/security/auth/RetrieveFailedException.class -com/ibm/as400/security/auth/SwapFailedException.class -com/ibm/as400/security/auth/UserProfilePrincipal.class - -#--------------------------------------------------- -# User spaces -#--------------------------------------------------- -com/ibm/as400/access/UserSpace.class -com/ibm/as400/access/UserSpaceImpl.class -com/ibm/as400/access/UserSpaceImplProxy.class -com/ibm/as400/access/UserSpaceEvent.class -com/ibm/as400/access/UserSpaceListener.class - -com/ibm/as400/access/jt400Proxy_copyright.txt - -#----- -# MRI -#----- -com/ibm/as400/access/CoreMRI.class -com/ibm/as400/access/CoreMRI_en.class -com/ibm/as400/access/CoreMRI_en_US.class -com/ibm/as400/access/JDMRI.class -com/ibm/as400/access/JDMRI_en.class -com/ibm/as400/access/JDMRI_en_US.class -com/ibm/as400/access/MRI.class -com/ibm/as400/access/MRI_en.class -com/ibm/as400/access/MRI_en_US.class - -#--------------------------------------------------- -# Security - The AS400 class did not allow a signon -# with JDK 1.2 unless we added these -# to jt400Proxy.jar. -#--------------------------------------------------- -com/ibm/as400/security/SecurityMRI.class -com/ibm/as400/security/SecurityMRI_*.class diff --git a/cvsroot/changes.html b/cvsroot/changes.html deleted file mode 100644 index 7167ccbe3..000000000 --- a/cvsroot/changes.html +++ /dev/null @@ -1,1377 +0,0 @@ - - -JTOpen CHANGES - - -

IBM Toolbox for Java - JTOpen version

-
-Copyright (C) 1997-2011 International Business Machines Corporation and
-others. All rights reserved.
-
-File: CHANGES
-Last updated: February 23, 2011
-The term "JTOpen" refers to the open source software product
-"IBM Toolbox for Java" plus any additional enhancements provided by
-the open source community. JTOpen, which is supported by IBM and
-governed by the IBM Public License, as well as its Java source code,
-is contained in the open source repository located off of:
-http://sourceforge.net/projects/jt400.
-
-The terms "Toolbox" and "Toolbox LPP" refer to the IBM Licensed Program Product
-"IBM Toolbox for Java" which is supported by IBM and can be obtained from the
-IBM Toolbox for Java web site:
-http://www.ibm.com/systems/i/software/toolbox/.
-
- - - - - - - - - - - -

Known deficiencies

-
-Several Toolbox methods have parameters or return values that are of type Date,
-Calendar, or GregorianCalendar. Some of these methods assume that the client
-Java application is running in the same time zone as the IBM i server.
-This behavior is long-standing, and will be corrected in a future Toolbox release.
-
-The constructor for the RFML component's primary class (RecordFormatDocument)
-fails on Sun's 1.4.2 JVM and on IBM's "Classic" i5/OS 1.4.2 JVM,
-with the following error:
-    org.xml.sax.SAXNotRecognizedException
-    Feature: http://apache.org/xml/features/continue-after-fatal-error
-
-Several classes in deprecated package com.ibm.as400.vaccess are known to
-fail to serialize when running in Java 6 JVMs.  These classes include:
-    AS400DetailsPane
-    AS400ExplorerPane
-    AS400ListPane
-    VActionAdapter
-
- - -
-

Contents

-Fixes and enhancements in JTOpen 7.3
-Fixes and enhancements in JTOpen 7.2
-Fixes and enhancements in JTOpen 7.1
-Fixes and enhancements in JTOpen 7.0
-Fixes and enhancements in JTOpen 6.7
-Fixes and enhancements in JTOpen 6.6
-Fixes and enhancements in JTOpen 6.5.1
-Fixes and enhancements in JTOpen 6.5
-Fixes and enhancements in JTOpen 6.4
-Fixes and enhancements in JTOpen 6.3
-Fixes and enhancements in JTOpen 6.2
-Fixes and enhancements in JTOpen 6.1
-Fixes and enhancements in JTOpen 6.0
-Fixes and enhancements in JTOpen 5.4
-Fixes and enhancements in JTOpen 5.3
-Fixes and enhancements in JTOpen 5.2
-Fixes and enhancements in JTOpen 5.1.1
-Fixes and enhancements in JTOpen 5.1
-Fixes and enhancements in JTOpen 5.0
-Fixes and enhancements in JTOpen 4.9
-Fixes and enhancements in JTOpen 4.8
-Fixes and enhancements in JTOpen 4.7
-Fixes and enhancements in JTOpen 4.6
-Fixes and enhancements in JTOpen 4.5.1
-Fixes and enhancements in JTOpen 4.5
-Fixes and enhancements in JTOpen 4.4
-Fixes and enhancements in JTOpen 4.3.1
-Fixes and enhancements in JTOpen 4.3
-Fixes and enhancements in JTOpen 4.2
-Fixes and enhancements in JTOpen 4.1
-Fixes and enhancements in JTOpen 4.0 -

- -


-

Fixes and enhancements in JTOpen 7.3 (released 2011-02-23)

-
-
-- Various: Code Cleanup 
-- Various:  Trace enhancements 
-- IFSFile : Clarified that IFSFile.getFreeSpace() returns Long.MAX_VALUE if storage limit is 'no maximum'. 
-- QSYSObjectPathName :  Fixed bug: IASP is forgotten by setLibraryName(), setMemberName(), setObjectName(), setObjectType(). 
-- JDBC:  Clarify Javadoc for setBinaryStream. 
-- JDBC:  Delay reading of Binary Stream until Execute 
-- JDBC:  Fix Statement.setQueryTimeout(0) for first set 
-- JDBC:  Fix leaking DBStorage objects 
-- JDBC:  For autogenerated keys use NEW TABLE instead of FINAL TABLE 
-
-
-
-

Fixes and enhancements in JTOpen 7.2 (released 2010-11-30)

-
-
-- Various: Javadoc enhancements.  Improved code comments.
-- Various: Improved error tracing and trace messages. 
-- Various: Code cleanup.
-- Various: Fix Vetoable for JDK 1.6
-- Various: Fixed bug when requested list is very large.  Corrected semantics of 'listOffset' parameter in listXXX() methods of classes HistoryList, JobList, JobLog, MessageQueue, ObjectList, and UserList. Consolidated common code into ListUtilities. 
-
-- AS400:  Password Cache Fixes 
-- AS400:  In getCcsid(), make an effort to arrive at a CCSID value other than 0 or 65535.
-- AS400: Added method getTimeZone(), and deprecated getSystemTimeZone(). 
-- AS400File: In AS400FileRecordDescription.addFieldDescription(), set additional keyword values: ALIAS, REFFIL, REFFLD, REFFMT, REFLIB, COLHDG. 
-- AS400File:  Added missing code, to obtain value for CURRENT_NUMBER_OF_RECORDS.
-- AS400File: When creating physical file via CRTPF, default MBR() to *FILE rather than *FIRST.
-- AS400File: Added methods to get/set REFFIL, REFLIB, and REFFMT. 
-- CommandLine: Added new method: CommandLineArgument.isOptionSpecified().
-- CommandLine: Exploit class 'CommandLineArguments' to parse the command-line invocation options.
-- Connection: If NoRouteToHostException in getSocketConnection(), retry to 'ipv6-localhost'. 
-- ConnectionPool: Added method AS400ConnectionPool.removeFromPool(AS400). (jlee-oss)
-- ConnectionPool: Added property: enforceMaxPoolSize. (jlee-oss)
-- Data: DAMRI: Added DATA_LENGTH_OUT_OF_RANGE. Enhanced other messages. 
-- Datatypes:  Fixed bug in AS400UnsignedBin8.toBytes(Object,byte[],int).
-- Datatypes:  Added constant: AS400DataType.TYPE_TIME. Deprecated constant: AS400DataType.TYPE_TIME_OF_DAY. 
-- Datatypes: Added methods to AS400Timestamp: toDate() and toTimestamp(). Added internal support for \*DTS format. (jlee-oss)
-- Datatypes: Exploit the AS400Timestamp class's new \*DTS support, when parsing \*DTS fields. 
-- Datatypes: Throw IllegalArgumentException if bad format specified on constructor for Date or Time.
-- Data conversion: Added constructors and methods to support new type converters (AS400Bin1, AS400UnsignedBin1, AS400UnsignedBin8). 
-- Data conversion: Adding mappings for additional regions.
-- JavaApplication: Trace a suggestion to check for firewalls, if error in JavaApplicationCall.run(). 
-- JavaProgram: Check for IBM i VRM higher than 7.1.   
-- JDBC: Use SoftReferences to avoid out of memory exception. 
-- JDBC: Clarify javadoc:  Only six characters of the SQL package name are used. 
-- JDBC: Update javadoc for maximum blocked input rows.
-- JDBC: Fix autogenerated key interfaces for AS400JDBCConnectionHandle.
-- JDBC: Scope Locators to cursor for *NONE isolation
-- IFS: Restored original behavior of IFSFile.exists(): Return false if profile is denied access. 
-- Pcml: Enhancements to support exploitation by PCML.
-- Pcml: Added support for new data types.
-- RemoteCommand: When forcing a disconnect because of an error, swallow any exceptions incurred during the attempt to disconnect. 
-- RemoteCommand: Disregard override CCSID value of 65535.
-- SpooolFile: Fixed bug in SpooledFileList.getStartTimeFilter().
-- System: Added property: SystemProperties.throwSAXExceptionIfParseError.
-- UDFS: Added methods to set and query the UDFS 'preferred storage unit' attribute. 
-- UDFS:  Corrected typographical code bug. 
-- User: If invalid profile name specified on constructor, trace a warning but don't throw exception.
-
-
-
- - - -
-

Fixes and enhancements in JTOpen 7.1 (released 2010-08-27)

-
-- Various: Added or improved error messages and trace messages.
-- Various: Javadoc enhancements.  Improved code comments.
-- Various: Code cleanup.
-- Various: Removed unused variables.
-- Connection pool: Added support for connection pool pretesting.
-- Connection pool: If the returned connection didn't originate in this pool, disconnect it.
-- Connection pool: Remove connection from list before disconnecting services.
-- Connection: AS400ThreadedServer: Trace use of thread.interrupt.
-- Connection: AS400: Added method getSystemTimeZone().
-- Connection: Added new property: fallbackCCSID. (Contributed by Tim Hurman.)
-- Connection: Cleanup native method loading.
-- Data conversion: AS400BidiTransform: Eliminated method convertDataToHostCCSID().
-- Data conversion: Added data converters for IBM i data types: date, time, timestamp, signed bin1, unsigned bin1, unsigned bin8.
-- Data conversion: Bidi: When deciding ST5 versus ST10, consider user profile CCSID and whether system is V5R1.
-- FTP: FTPThread: Put the wait() into a loop.
-- IFS: FileAttributes: Deprecated misspelled method getJounalingStartTime(); replaced it with getJournalingStartTime().
-- JDBC: AS400JDBCSQLXML: Fixed "unsigned byte" problem.
-- JDBC: AS400JDBCStatement: Correct interrupted thread statement leak.
-- JDBC: Correct setting of JDBC cursor hold properties.
-- JDBC: AS400JDBCResultSetMetaData: Fix isAutoIncrement() when extended metadata is off.
-- JDBC: AS400JDBCStatement: Fix execute() to return syntax error from database engine.
-- JDBC: Fix XML type info for pre JDBC 4.0.
-- JDBC: Fix buffer pooling.
-- JDBC: Fix missing method exception in JDError.
-- JDBC: Handle comma as decimal float separator.
-- Message: AS400Message.getText() and .load(): If returned text is blank, but substitution data is non-blank, copy substitution data to text.
-- Permission: PermissionAccess: Don't uppercase file name for /QOpenSys file system.
-- Ping: AS400JPing: Added pingAllServices(). Call Thread.interrupt() instead of Thread.stop(). Trace socket properties when pinging DDM server.
-- Print: Fixed bug uppercasing special character '@'.
-- Product license: Added trace statements.
-- RLA: Added constants to class DDMTerm.
-- RLA: Added trace message when parsing DDM reply data stream.
-- Save file: SaveFileEntry: Added hashCode() method.
-- Trace: Correct NPE when changing tracing.
-- User space: Added new UserSpace native methods.
-
- -
-

Fixes and enhancements in JTOpen 7.0 (released 2010-05-14)

-
-- Various: Added or improved error messages and trace messages.
-- Various: Javadoc enhancements.  Improved code comments.
-- Data conversion: Refined the default behaviors for Bidi conversion.
-- Connection pool: Improved tracing of connection pool management events.
-- Connection: Added PASE-specific native methods with unique names, to eliminate socket errors due to PASE/ILE ambiguity.
-- Connection: Catch AccessControlException during static initialization of AS400Credential.
-- Connection: Eliminated limitation on getJobs() method, regarding the RECORDACCESS service.
-- Connection: Enabled AS400.generateToken() methods to work with proxy server.
-- Connection: Improved tracing of authentication scheme.
-- Data area: Enabled/fixed read(byte[]) methods when running in proxy mode.
-- Data conversion: Added BIDI_STRING_TYPE_NONE (-1) as a value for JDBC property 'bidi string type'.
-- Data conversion: Changed default Bidi string type from 'Implicit LTR' to 'Implicit Contextual LTR'.
-- Data conversion: Eliminated method AS400BidiTransform.convertDataToHostCCSID().
-- Data conversion: Eliminated unused internal method in AS400DecFloat.
-- Data conversion: Fixed NullPointerException in AS400BidiTransform.convertDataFromHostCCSID().
-- Data conversion: If host CCSID is 13488 or 1200, default to a Bidi 'string type' of 5.
-- Data conversion: If throw NumberFormatException (for packed or zoned decimal), trace field bytes.
-- Data conversion: Modified CharConverter(ccsid,system) to tolerate null-valued 'system' argument.
-- Data conversion: Refined determination of default 'string type': Consider whether the system's default CCSID is a Bidi CCSID.
-- Data conversion: Reset value of BidiStringType.DEFAULT to original value of 0 (which now maps to ST5).
-- Date conversion: Don't trace stack-trace of NullPointerException from TimeZone.getTimeZone().
-- IFS: Fix bug in IFSFileEnumeration.nextElement(), observed in /QNTC.
-- IFS: Fixed several proxy methods to call correct rethrowX() method.
-- JDBC: Added "use block update" connection property.
-- JDBC: Added 'maximum blocked input rows' connection property.
-- JDBC: Allow DatabaseMetaData.getFunctions() call to V5R4.
-- JDBC: Buffer synchronization fixes.
-- JDBC: Code cleanup.
-- JDBC: Correct JDUtilities.streamToBytes().
-- JDBC: Correct syntax error for Insert statement.
-- JDBC: Fix to not return array out of bounds exception when bad char data is converted.
-- JDBC: Fix update counts for batched insert statements.
-- JDBC: JDBC40 single source restructure.
-- JDBC: Minimize buffer usage for blocked insert.
-- Job: Fixed bug: Job.loadInformation() doesn't clear cached 'job status' value.
-- NetServer: Tolerate blanks values returned for 'encrypted password' and 'logon type'.
-- NetServer: Updated with new API fields that were added in V6R1.
-- Proxy: Changed an 'error' trace message to 'diagnostic'.
-- Proxy: Made CredentialVault and its subclasses Serializable, to fix ProxyServer problem introduced in JTOpen 6.7.
-- RLA: Commented-out unused methods in DDMRequestDataStream.
-- RLA: Performance improvement in KeyedFile.readNextEqual() and readPreviousEqual().
-- Spooled file: Removed non-public attributes from javadoc for SpooledFile.sendTCP() method.
-- Trace: If we created our PrintWriter internally (based on a file), close it when replacing it.
-- Trace: Incorporate systemName/jobName in receiver thread names, for more useful traces.
-- User: Added new method: User.refresh().
-- User: Check for (and reject) user profile name '*NONE'.
-
- -
-

Fixes and enhancements in JTOpen 6.7 (released 2010-02-05)

-
-- Various: Added and improved error messages and trace messages.
-- Various: Corrected html tags.
-- Various: Fixes for potential bugs identified by static analysis.
-- Various: Javadoc enhancements.  Improved code comments.
-- Admin: Declared class SystemProperties as 'public', to allow access from test drivers and other Toolbox packages.
-- Connection pool: Added trace message to indicate maintenance daemon ending.
-- Connection pool: In ConnectionPool and AS400ConnectionPool, added new methods setCCSID() and getCCSID().
-- Connection pool: Improved tracing of pool management events.
-- Connection: Added method getUserId(forceRefresh) to AS400.
-- Connection: Added new method: AS400.connectToPort().
-- Connection: Ensure that failure during attempt to connect, doesn't leave connection in inconsistent state.
-- Connection: In AS400 class, improved tracing of authentication scheme.
-- Connection: In AS400 class, loosen definition of 'numeric profile name' when implicitly prepending 'Q' to profile name.
-- Connection: In AS400ThreadedServer, if SocketException during disconnect(), trace a 'diagnostic' instead of an 'error'.
-- Data conversion: In CharConverter, added checks for null-valued arguments.
-- Data conversion: Added more complete Bidi support.
-- Date conversion: If unable to determine server time zone, assume same as client.
-- IFS: Added new constructor IFSFile(IFSFile directory,String filename).
-- IFS: In IFSFileDescriptor, changed lock object from a Boolean to an Object.
-- JDBC: Added more complete Bidi support.
-- JDBC: Change XML trim of declaration to match Native driver.
-- JDBC: Fix Array max size of element data.
-- JDBC: Fix SQL array and non-array types in same output parm procedure.
-- JDBC: Fix SQL array of decimals to handle null elements.
-- JDBC: Fix XML DOM source for non-locators.
-- JDBC: Fix XML declaration trim when using SQLXML interface.
-- JDBC: Fix XML offset of stream.
-- JDBC: Fix XML UTF-8 chars of more than 1 byte in length.
-- JDBC: Fix bugs in SQL arrays when elements are null or length of zero.
-- JDBC: Fix for array of dates.
-- JDBC: Fix setting the binary stream once and re-executing SQL statement.
-- JDBC: Fix update of XML in result set.
-- JDBC: In AS400JDBCArrayResultSet, fix for missing variable.
-- JDBC: In AS400JDBCResultSet, fix XML update after update to null value.
-- JDBC: Make JDSQLTokenizer eligible for garbage collection after use.
-- JDBC: Updated 'database name' property description.
-- JDBC: XML ascii stream fix.
-- JDBC: XML declaration fix.
-- JDBC: Zero out varchars of length less than 256 for RLE compression.
-- NetServer: Corrected commitChanges(fileShare) to not assume that the share pathname is specified in Unicode.
-- Object description: In ObjectDescription, added new constructor. Consolidated data members.
-- PCML: Eliminated StringIndexOutOfBoundsException in PcmlMessageLog.
-- Permission: Added a clone() method to UserPermission.
-- Permission: Correctly handle embedded quotes in paths.
-- Permission: Eliminated 'Cloneable' designation on Permission class.
-- Product license: Added a readObj() method to ProductLicense.
-- Product: Product.isInstalled(): If product isn't installed, avoid logging CPF0C1F.
-- QSYS object types: Protect internal representation by returning copy of array.
-- QSYSObjectPathName: Added new method: toQualifiedObjectName().
-- Save file: Added equals() and toString() methods to SaveFileEntry.
-- Trace: Added method toHexString(byte) to Trace.
-- Trace: Added support for dynamic tracing.
-
- -
-

Fixes and enhancements in JTOpen 6.6 (released 2009-09-11)

-
-- Various: Eliminated trace calls that were redundant with thrown exceptions.
-- Various: Improved construction of InternalErrorExceptions.
-- Various: For threadsafe API's and CL's, perform internal calls on-thread when allowed by properties.
-- Various: Javadoc enhancements.
-- Beans: Corrected EventSetDescriptor argument, to eliminate ExceptionInInitializerError on some JVMs.
-- Build: Include JarMaker classes in jt400Native.jar
-- Command call, Program call: Restore cross-version serializability between old/new releases of JTOpen.
-- Command call: Refined processing of threadSafe property.
-- Connection: Added system property: AS400.guiAvailable.
-- Connection: Don't print stack trace if class NativeVersion not found.
-- Connection: In setGSS* methods, clear any prior signon info.
-- Connection: New infrastructure to support use of auto-renewing Profile Tokens.
-- Connection: Normalized trace calls. Eliminated trace calls that were redundant with thrown exceptions.
-- Connection: Re-enable Toolbox native PASE code.
-- Data conversion: (AS400Structure) Made defaultValue_ non-static. Synchronized access to elements_ and defaultValue_. Throw ExtendedIllegalArgumentException instead of ArrayIndexOutOfBoundsException.
-- Date conversion: Made 'public' the DateTimeConverter.timeZoneForSystem() method.
-- IFS: Added IFSFile methods: getParentFile(), getPathPointedTo(), and isSourcePhysicalFile().
-- IFS: For default IFSFile objects, changed getParent() to return null instead of "/".  Side effect: For default VIFSFile and VIFSDirectory objects, getParentDirectory() will now return null instead of "/".
-- IFS: Renamed some internal methods for better maintainability.
-- IFS: Support new File methods introduced in Java 6.0.
-- JDBC: Add stronger date, time, and timestamp validation.
-- JDBC: Add wrapper methods around set/update Default to match JCC's new names.
-- JDBC: Allow JDBC connection properties to propagate to Native JDBC driver.
-- JDBC: Change lob locator block size to 1MB for Stream input.
-- JDBC: Corrected an empty-string comparison in initializeAS400().
-- JDBC: Fix AS400JDBCResultSet.updateSQLXML to handle null values.
-- JDBC: Fix JDBC 4.0 XML internal encoding check.
-- JDBC: Fix SQL Array output parm index.
-- JDBC: Fix for XML with no declaration to default to UTF-8.
-- JDBC: Fix for setting an SQLXML object into a Blob/Clob column.
-- JDBC: Fix in CallableStatement.getArray method to support SQL Arrays.
-- JDBC: Fix metadata statement leak.
-- JDBC: Fix to SQL Array output parm filtering.
-- JDBC: Fix to XML zero length stream.
-- JDBC: Fix to double-byte clob when reader/stream length is not specified.
-- JDBC: Fix to multi-row merge.
-- JDBC: Fix update and set SQLXML for null data.
-- JDBC: Fix updateSQLXML for null data.
-- JDBC: Handle JDBC readers and input streams with length not specified.
-- JDBC: Multi-row update support.
-- JDBC: New XML message.
-- JDBC: New functionality for XML and Array support.
-- JDBC: Port of new XML code to JDBC 3.0.
-- JDBC: Remove incorrect catch block.
-- JDBC: Remove some references to old versions and rename IBM i.
-- JDBC: Separate login timeout property from socket time out.
-- JDBC: Trim XML encoding when PS.setString() is used.
-- JDBC: XML binary stream fix to not trim off XML declaration.
-- JDBC: XML double-byte/single-byte when CCSID does not match conversion bug fix.
-- JDBC: XML fix to account for byte order mark in UTF-15be string.
-- JarMaker: Added component: PCML. Rearranged constants for better readability. Renamed some private constants.
-- Object description: Improved performance of refresh(). Exploit QUSROBJD format OBJD0100.
-- Permission: Added new Permission constructor with 'followLinks' parameter. Added isFollowSymbolicLinks().
-- Permission: Improved messages in some thrown exceptions.
-- Product: Eliminated 'NullPointerException: featureID' along certain paths.
-- Program call: (ServiceProgramCall) Added check for more than 7 parameters.
-- Program call: Added new method: suggestThreadSafe().
-- Program call: Added new streamlined runProgram() method.
-- Program call: Added static utility method getDefaultThreadSafety().
-- QSYS object types: Added new type: SQLXSR.
-- RFML: Added clarifying comment.
-- Security: Added checks for null keyRingName.
-- Trace: Added new variation of printByteArray().
-- Trace: Tolerate null arguments in log() methods.
-- User space: Call UserSpace API's on-thread by default.
-- User space: Respect setting of 'mustUseSockets' property when calling programs internally.
-- User: Changed User.exists() method to call CHKOBJ instead of QSYRUSRI.
-
- -
-

Fixes and enhancements in JTOpen 6.5.1 (released 2009-05-20)

-
-- Connection: Re-enable default on-thread execution of ProfileToken calls. (Added 2009-06-05)
-- Data area:  Fixed breakage in JTOpen 6.5: NoClassDefFoundError on Sun JVM's.
-- Print:      Fixed breakage in JTOpen 6.5: NoClassDefFoundError on Sun JVM's.
-- User space: Fixed breakage in JTOpen 6.5: NoClassDefFoundError on Sun JVM's.
-
- -
-

Fixes and enhancements in JTOpen 6.5 (released 2009-05-08)

-
-- INCOMPATIBLE CHANGE:
-  The getJob() method is eliminated from classes CommandCall and ProgramCall.
-  Applications that reference this method will no longer compile or execute.
-  Use method getServerJob() instead.
-
-- BEHAVIOR CHANGE:
-  Formerly, when running natively on IBM i, by default the Toolbox looked-up
-  the designated thread-safety of CL commands, and called thread-safe CL's
-  on-thread to optimize performance.
-  Similarly, when running natively on IBM i, by default the Toolbox called
-  certain IBM i API's "on-thread" (in the job of the JVM) if the API's were
-  known to be thread-safe.
-  This introduced problems where successive CL's and programs would be called
-  in 2 different jobs (on-thread versus off-thread).
-  The new default is to simply call all CL's and programs via the Remote
-  Command Host Server.
-  To restore the previous CommandCall behavior, set Java system property:
-  com.ibm.as400.access.CommandCall.threadSafe=lookup
-  To instruct the Toolbox to call all programs on-thread, set the property:
-  com.ibm.as400.access.ProgramCall.threadSafe=true
-  However, setting threadSafe=true is not advised unless your application
-  is known to call only thread-safe programs.
-
-- Various: Changes to support modified default command thread-safety behavior.
-- Various: Javadoc updates.
-- Various: Renamed private constant names and variables for better readability.
-- Various: Enhancements suggested by static analysis:
-                  - Added hashCode() methods.
-                  - Eliminated redundant String.toString() calls.
-                  - Eliminated unnecessary null-checks.
-                  - Eliminated unused variables.
-                  - Improved synchronization.
-                  - Ensure that opened streams get closed.
-                  - Streamlined try/catch logic.
-                  - Trace all caught exceptions.
-- Build: Added JPing to jt400Native.jar
-- Command call: Removed method getJob(). Method was deprecated on 2003-01-22.
-- Command call: Added tracing to track on/off-thread calls, and CL thread-safety lookups.
-- Command call: Eliminated default thread-safety lookup when calling CL commands natively.
-- Command call: Changed trace category of the 'on/off thread toggle' message to DIAGNOSTIC.
-- Connection pool: Tolerate null password on constructor.
-- Connection: Relaxed definition of 'numeric password' when prepending 'Q'.
-- Connection: Added trace messages.
-- Connection: Added method: AS400.isConnectionAlive(service).
-- Connection: Check for null, before dereferencing listeners.
-- Connection: Fix PASE socket close(), so it is not called twice.
-- Connection: Fix PASE socket pair leak.
-- Connection: Temporarily disable PASE optimizations until socket issues can be resolved.
-- Connection: Fix native library load when running with multiple war files and classloaders.
-- Connection: Made 'public' the method AS400.canUseNativeOptimizations().
-- IFS: Added methods to FileAttributes: containsTemporaryObjects() and isTemporaryObject().
-- IFS: Added static getFreeSpace() method.
-- IFS: For IFSFile.getSubtype(): Retrieve codepage of extended attribute values.
-- IFS: Trace the returned extended attribute values.
-- JDBC: Add 'skip locks' option to concurrent access property.
-- JDBC: Add new JDBC 4.0 flag for sysibm stored procedure metadata source.
-- JDBC: Fix AS400JDBCDriver.connect() with clone set to false.
-- JDBC: Fix JDBC 4.0 getHoldability() method to check for isolation level of *NONE.
-- JDBC: Fix ResultSet.updateRow() method when CCSID is not known.
-- JDBC: Fix commit/rollback to not close cursors when isolation level is *none.
-- JDBC: Fix erroneous NullPointerException in JDBC trace.
-- JDBC: Fix for 'fetch direct' only if cursor is read-only and insensitive.
-- JDBC: Fix for JDBC Graphic datatype length with ccsid 65535.
-- JDBC: Fix getIsolation() method to return *none if it is really *none.
-- JDBC: Fix isAutoIncrement() method to close correct PreparedStatement.
-- JDBC: Fix to get updated date info in getVersionColumns() method.
-- JDBC: Fix to search 'system' part of library list when calling stored procedures.
-- JDBC: Fix truncation error when inserting large BigDecimal into double column.
-- JDBC: Fix truncation error when setting BigDecimal in float/real columns.
-- JDBC: Fix when to prevent incorrect NullPointerException while trace is on.
-- JDBC: Temporary workaround for known Sun Hotspot 1.6 JIT defect.
-- JarMaker: Generate digests correctly. Close all streams when done.
-- JavaApplicationCall: Added trace call.
-- Job: Added method: commitChanges(boolean mustStayOnThread).
-- Message: Eliminate NullPointerException if load() called on internally-created AS400Message.
-- Print: Added getAFPInputStream.  Deprecated getInputACIPMergedStream.
-- Print: Enhance Error Diagnosis.
-- Print: Throw exception if fail to connect to Print Server.
-- Program call: Added new method: ServiceProgramCall.setAlignOn16Bytes().
-- Program call: Removed method getJob(). Method was deprecated on 2003-01-22.
-- Proxy: Eliminated calls to System.gc() and runFinalizersOnExit().
-- RLA: Added method: getLibraryName()
-- Trace: Added error message in logLoadPath().
-- Trace: Added method: log(int,String,String).
-- Trace: Check for null argument in new log() method.
-- Trace: Made the printByteArray() methods package-scoped.
-
- -
-

Fixes and enhancements in JTOpen 6.4 (released 2008-12-12)

-
-- Various: Javadoc updates.
-- Various: Enhancements suggested by static analysis.
-- Command call: Log a warning if sequential calls switch between on-thread and off-thread.
-- Connection pool: Enhance AS400ConnectionPool to support ProfileTokenCredentials.
-- Connection pool: Fix pool maintenance daemon so as to disconnect active connections,
-  only when a connection exceeds its maxUseTime limit.
-- Connection: Added method AS400.isConnectionAlive().
-- Connection: Fix bug in portmapper port.
-- Data conversion: Eliminated possible arithmetic overflow.
-- Data conversion: Fix JTOpen bug 2120228: ConvTableJavaMap is not appropriately synchronized.
-- Data conversion: Resynchronized with updated system converter tables.
-- Date conversion: Optional parameters for QWCCVTDT only valid for V5R3 and beyond.
-- Date conversion: Streamlined design, based on assumption that all dates are in timezone of system.
-- FTP: Check for null-valued changes_, vetos_ before referencing.
-- FTP: Improved synchronization.  Ensure that streams always get closed.
-- FTP: Tolerate delimiters other than '|' in EPSV response.
-- JDBC: Add Currently Committed support.
-- JDBC: Add code to make use of hostserver's fetch-direct function.
-- JDBC: Add property "secure current user" to allow JDBC connections with "" or *current when running on the IBM i host.
-- JDBC: Documentation rename of "default schema/library" to "default SQL schema".
-- JDBC: Fix AS400JDBCResultSetMetadata.isAutoIncrement() method to get more accurate information.
-- JDBC: Fix bug in delimited schema in connection URL.
-- JDBC: Fix bug in getCatalogSeparator being able to access connection.
-- JDBC: Fix bug in getMoreResults(int) so that CLOSE_CURRENT_RESULT does not throw exception.
-- JDBC: Fix bug when locators are freed more than once.
-- JDBC: Fix for connection property "driver=native" when hostname is localhost.
-- JDBC: Fix for quoted schema names in URL.
-- JDBC: Fix misc resources that are opened but not closed properly.
-- JDBC: Fix stored procedure flavor of AS400JDBCDatabaseMetaData resultset.getStatement() so it returns null per JDBC spec.
-- JDBC: Fix typo in secure current user description.
-- JDBC: Fix when using userid in URL and using connection property driver.
-- JDBC: Force signon GUI dialog to display when id/password are "" or "*current".
-- JarMaker: Recognize -xsd as abbreviation for -excludeSomeDependencies.
-- JarMaker: If not JDBC or RLA, don't follow dependencies from ClassDecoupler.
-- JarMaker: Verify number of bytes skipped. Call readUnsignedShort() instead of readShort().
-- Message file: Added FIRST and NEXT options to getMessage() methods. (Enhancement submitted by David Gibbs.)
-- Micro edition: Modified skipBytes() to return actual number of bytes skipped.
-- PCML: Added more PCML trace points.
-- PTF: Added 'get' methods for creationDate and serverIPLRequired.
-- QSYSObjectPathName: Added static non-public validatePath() method.
-- RLA: Added parameter validation and more tracing.
-- RLA: Set field description text.  Removed 'serializable' designation.  Added check for no records returned from DSPFFD.
-- System pool: Eliminated 2 obsolete non-public constructors. Added parameter validation.
-- System status: Exploit new SystemPool constructors.
-- Trace: In finalize(), close all writers (except when they're built on System.out).
-- User: Added getters/setters for userExpirationAction, userExpirationDate, userExpirationInterval, userEntitlementRequired.
-- User: Additional fixes not included in the associated PTF's: Serializability bug, and NullPointerException in new utility method 'isBlanks'.
-- User space: Improved synchronization.
-
- -
-

Fixes and enhancements in JTOpen 6.3 (released 2008-08-29)

-
-- Various: Javadoc updates.
-- Admin: Updated this file (changes.html) so component names are consistent.
-- Command call: Changed scope of getThreadSafetyProperty() from private to package. 
-- Command call: Refined tracking of missing V5R4 PTF for QCDRCMDI (SI29629).
-- Connection pool: Fix bug to reuse connections which have a maxLifetime of 0.
-- Connection: Added AS400 properties: mustAddLanguageLibrary, mustUseSuppliedProfile.
-- Connection: Added AS400 properties: mustUseSockets, mustUseNetSockets, threadUsed.
-- Connection: Ensure that the socket never gets left open.
-- Connection: Fix code so that applets do not get AccessControlException.
-- Connection: Only try to load PASE library when on V6R1 or higher.
-- Connection: Fix for JTOpen bug 2039039: Set another timeout when opening a socket connection.
-- Data area: Honor setting of threadSafe property.
-- Data conversion: Modification to handling of Date convert(*CURRENT) to adjust to local time.
-- Data conversion: Added method AS400DataType.getJavaType().
-- Data conversion: Regenerated conversion tables for CCSIDs 835 and 4931.
-- JDBC: Add support for getSQLXML on Blob columns, for consistency with native JDBC driver.
-- JDBC: Allow userid/password in URL to override blanks in parameters.
-- JDBC: Fix ResultSet navigation for various relative scrolling.
-- JDBC: Fix cast exception for DBClob when written as a locator. 
-- JDBC: Fix double JDBC driver registration with DriverManager.registerDriver().
-- JDBC: Fix generated keys truncation. 
-- JDBC: Fix lob locator update and retrieval from AS400JDBCResultSet. 
-- JDBC: Fix logic so that ResultSet.relative(1) is same as ResultSet.next().
-- JDBC: Fix long schema bug in library list.
-- JDBC: Fix stream helper method.
-- JDBC: Fix server trace bug.
-- JDBC: Fix typo in byteLength variable.
-- JDBC: Get database metadata from SYSIBM stored procedures if "metadata source" property is set to 1.
-- JDBC: Ignore Warnings to allow users to specify list of SQL states to cause JDBC to ignore and not issue warnings. 
-- JDBC: Misc XML fixes to not rely on external parsers.
-- JDBC: More resultset cursor navigation fixes for various abnormal scrolling. 
-- JDBC: Prohibit accidental JDBC Connection with userid or password of "". 
-- JDBC: Use connection property "translate hex" value in the algorithm to generate extended dynamic sql package name.
-- Messages: Added new MessageFile.getMessage() method, with additional CCSID parameters. 
-- NetServer: Deprecated class; use ISeriesNetServer instead.
-- Object description: Fixed StringIndexOutOfBoundsException.
-- Object description: New method ObjectDescription.getObjectLockList(). 
-- PTF: Added constants to represent new V6R1 status values.
-- Print: Added method Printer.setAttributes(), to match functionality of RPrinter. 
-- RLA: Changes to verifyS38MSGRM() to better handle ClassCastException.
-- System pool: Added 2 constructors, and isValidNameForSharedPool().
-- System pool: Eliminated logic errors.  Strip trailing blanks from returned String-valued attributes. 
-- System value: Enhanced javadoc and code comments. 
-- Trace: Add more tracing for invalid passwords.
-- Trace: Added tracing of connection ID.
-- Trace: Skip stack trace for "Class com.ibm.as400.access.Properties not found".
-- Trace: If incorrect reply datastream header: Trace bytes, and disregard stream. 
-- Trace: Streamlined trace messages for 'GSSToken not available' and non-fatal ClassNotFoundException.
-- User: Add getObjectsOwned() method.
-
- -
-

Fixes and enhancements in JTOpen 6.2 (released 2008-04-30)

-
-- Various: Javadoc updates.
-- Various: Corrected EventSetDescriptor argument, to eliminate IntrospectionException on some JVMs.
-- Build: Fix for JTOpen bug 1924271: In build.xml, specify encoding for javac calls.
-- Build: Removed JDBC version designation.
-- Command call: When running programs/commands natively, set secondary language directory to match client locale.
-- Connection pool: Check for connection expiration when connection returned to pool.
-- Connection pool: Use SoftReference to eliminate circular reference and potential memory leak.
-- Connection pool: Added diagnostic trace for when an active but expired JDBC connection is closed.
-- Connection: Added null pointer check in AS400.getJobs().
-- Connection: Corrected misspelled constant name.
-- Connection: Use socket timeout when connecting if running in Java 1.4 or higher.
-- Data area: Added methods to read/write unconverted bytes.
-- Data conversion: Added setters and getters for numeral shaping, Bidi expand alef.
-- Data conversion: Eliminated possible ArrayIndexOutOfBoundsException in ConvTableReader.fillCache(), for example when incorrect data CCSID is specified.
-- Data conversion: Made the Mlog class non-public.
-- IFS: Modifications for IFSFile.clearCachedAttributes() to clear all cached attributes.
-- IFS: Enable operation on files larger than 2 gigabytes: IFSFileOutputStreamImplRemote.write(), IFSRandomAccessFile.seek().
-- IFS: Updates to IFSFile.java and IFSJavaFile.java for symbolic link objects.
-- JDBC: Add text "Connection.rollback()" to "autocommit exception" property description.
-- JDBC: Add text "rollback" to "autocommit exception" property description and javadoc.
-- JDBC: AS400JDBCDriver: Added JDBC version indicator.
-- JDBC: Auto-commit property.
-- JDBC: Beginning with Version 6 Release 1 of i5/OS, you must have *JOBCTL special authority for setQueryTimeout().
-- JDBC: Change to not use sql package cache if the statement contains a lob since it could be a lob or lob locator on other connections.
-- JDBC: Close statements to avoid statement leak.
-- JDBC: Fix error when Statement.setMaxRows(count) is same number of rows in a resultset.
-- JDBC: Fix for setCharacterStream to take into account multi-byte chars.
-- JDBC: Fix for time when hour is 24 and minute is not 00.
-- JDBC: Fix to signal truncation of data in CCSID 5035.
-- JDBC: Get timeout property from DriverManager.getLoginTimeout.
-- JDBC: Implementation of Decfloat SNaN.
-- JDBC: Login timeout added to DriverManager properties.
-- JDBC: Login timeout in milliseconds.
-- JDBC: Make the 'autocommit exception' property effective for rollback.
-- JDBC: XA Connection fixed to close cursor after commit.
-- JDBC: Starting in V6R1, user must have *JOBCTL special authority to use query storage limit.
-- JDBC: Starting in JDK 1.5, for numeric and decimal column types, exploit BigDecimal.toPlainString().
-- NetServer: Fix for IseriesNetServer.java for authority check IOSYSCFG to include groups that a user belongs to.
-- Permission: Changes due to regression test. Permission.java
-- Permission: Updates to process QSYS IASP objects: Permission, PermissionAccessQSYS, and QSYSObjectPathName.
-- Print: Fix for JTOpen bug 1551918: PrintObjectList: openSynchronously() twice.
-- RLA: Fix for JTOpen bug 1847680: Introspection of Record fails due to bad RecordBeanInfo.java. Original problem reported in JTOpen bug 1779593: Correct EventSet for VetoablePropertyChange.
-- Trace: Added tracing of connection ID.
-- Trace: Added tracing of load source.
-- Trace: Fix for JTOpen bug 1889391: Synchronized access to static variable SimpleDateFormat.
-- Trace: Limit redundant checks for multiple Toolbox versions.
-- Utilities: AboutToolbox: Added check for supported JDBC version.
-
- -
-

Fixes and enhancements in JTOpen 6.1 (released 2008-01-04)

-
-- Various:  Javadoc updates.
-- AS400:  Eliminate swallowed NullPointerException.
-- AS400:  If no Properties class found, trace a Diagnostic instead of a Warning.
-- Command call:  Add support to follow proxy command chain. Exploit PTF if V5R4.
-- IFS:  Correctly recognize QSYS objects, particularly PRTF objects.
-- IFS:  Eliminate double close requests from finalizer.
-- JDBC:  Add check for closed resultset when checking holdability.
-- JDBC:  Client Functional Level update.
-- JDBC:  Fix for cursor holdability of stored procedures.
-- JDBC:  Fix timestamp so that 24:00 on day n does not advance to 24:00 on day n+1.
-- JDBC:  Fix to ignore some warnings when sqlState starts with 00 or 02.
-- JDBC:  Get scroll type from cursor attrs if exist.
-- JDBC:  Match Native driver truncation on future releases when PreparedStatement.setString() is used.
-- JDBC:  Method JDLobLocator.free() not supported on V5R4 or earlier releases of System i.
-- JDBC:  NVARCHAR length fix.
-- JDBC:  Return "NCHAR"  and "NVARCHAR" from getTypeName() for CCSIDs 13488 and 1200.
-- JDBC:  Return first occurrence of column when calling ResultSet.findColumn(String) when there are more than one column with same name.
-- JDBC:  Update getDatabaseMajorVersion and getDatabaseMinorVersion to reflect actual versions from host server.
-- JDBC:  isReadOnly method fix.
-- JDBC:  Fix for non-capitalized schema names in getProcedureColumns method.
-- JDBC:  Fix storesMixedCaseQuotedIdentifiers method to return false.
-- JDBC:  Do not re-use stale variables in reply datastream objects.
-- PCML:  Fix for JTOpen bug 1778759 - set the global isXPCML variable.
-- Permissions:  Permissions.commit() sensitivity of DLO object.
-- Print:  Add additional supported CPI values to SCS5553Writer.
-- RLA:  Add Note to readNextEqual() methods regarding locking.
-- RLA:  Change to ignore *NONE keys in addKeyFieldDescription().
-- RLA:  Corrected field length calculation for DBCS VARCHAR and VARGRAPHIC fields.
-- RLA:  Fix for JTOpen bug 1796143 - Writing to a multiple format file fails.
-- System pool:  Improve handling of shared pools.
-- Vaccess: Deprecated last remaining un-deprecated class in package com.ibm.as400.vaccess: AS400JDBCDataSourcePane.
-
- -
-

Fixes and enhancements in JTOpen 6.0 (released 2007-08-20)

-
-- Connection pool:  Added a check to verify connection is not in use when checking the max lifetime and removing a connection from the pool.
-- Data area:  Fix for JTOpen bug 1737692 - allow users to write data containing single-quote characters.
-- Data conversion:  Updated various converter tables.
-- FTP:  Add support for EPSV and EPRT.
-- IFS:  Updated getCanonicalPath() to remove '.' and '..' from paths.
-- IFS:  Updated listObjectAttrs() to see if a file handle has already been opened.
-- IFS:  Replaced get32bit() call which was treating 4-byte byte stream fields as signed with BinaryConverter methods.
-- IFS:  Changes to IFSFile.enumerateFiles() to better handle when objects are filtered.
-- IFS:  Updated to search by restart name if accessing QSYS.LIB in an IASP.
-- JarMaker:  Updated AS400ToolboxJarMaker to extend ToolboxJarMaker.
-- JDBC:  Added various getters/setters to AS400JDBCDataSource to match URL style properties.
-- JDBC:  Added getServerJobIdentifier() to JDConnectionProxy.
-- JDBC:  Return names in DatabaseMetaData.getPrimaryKeys() instead of null.
-- JDBC:  Added new class AS400JDBCStatementListener.
-- JDBC:  Fix error when Double value is infinity and getFloat(x) is called.
-- JDBC:  Updated read/write flag for DataTruncation warnings and exceptions.
-- JDBC:  Updated DataSource getUser() method to retrieve user from AS400 object.
-- JDBC:  Added check for closed cursor in absolute method.
-- JDBC:  Updated setPoolable() method name in JDStatementProxy.
-- JDBC:  Allow delimited libraries in library list.
-- JDBC:  Updated DatabaseMetaData.getProcedures() to return correct procedure name.
-- JDBC:  Allow rollback to throw XAException on a non-zero return code.
-- JDBC:  Added "variable field compression" connection property.
-- JDBC:  Added statement listener support.
-- JDBC:  Throw exception on Connection.commit() if auto-commit is enabled.
-- JDBC:  Fix performace related bug that caused ResultSet not to close after cursor was implicitly closed.
-- JDBC:  Use SQLState instead of SQLCode for flag of errors/warnings.
-- JDBC:  Retrieve cursor attributes from a stored procedure.
-- Job list:  Fix for JTOpen Bug 1728765 - allow more than one value for the selection criteriat that are suppose to allow multiple values.
-- Job log:  Added the ability to retrieve all attributes for a message.
-- Job log:  Updated javadoc to list attributes that can be accessed for a QueuedMessage object.
-- Object description:  Modified exists() method to handle CPF9811 message.
-- ObjectList:  Fix for JTOpen Bug 1725312 - fix to allocate correct storage amount for getObjects().
-- ObjectList:  Updated javadoc for getObject() to indicate that the listOffset parameter may be greater than "or equal to" zero.
-- ObjectList:  Updated addObjectAuthorityCritiria() to enforce documented interface restrictions.
-- QueuedMessage:  Added the ability to retrieve all attributes for a Job Log message.
-- System pool:  Added the ability to set the "system-related pool identifier".
-- System status:  Added the ability to set the "system-related pool identifier".
-- Trace:  Fix to ensure tracing is off if a category is not set.
-
- -
-

Fixes and enhancements in JTOpen 5.4 (released 2007-04-18)

-
-- Various:  Updated iSeries and server references in comments, text.
-- Various:  Javadoc updates.
-- Connection: Support new messages from sign-on server.
-- Connection: Added additional change password return codes.
-- Data conversion:  Fix array out of bounds error so we throw SQLException back with single character input.
-- File:  Fixed record cache so that positionCursor() works regardless of the blocking factor.   
-- IFS:  Updatated javadoc for list, listFiles and enumerateFiles methods.
-- IFS:  Updated to throw an exception if access is denied to a directory and to search by restart name if accessing QSYS.LIB in an IASP.
-- JDBC:  Added Close on EOF support.
-- JDBC:  Added support for setting client information. 
-- JDBC:  Added support to turn on/off database host server tracing.
-- JDBC:  Allow sort=job to not throw exception, but use default.
-- JDBC:  Added stored procedure support for getIndexInfo. 
-- JDBC:  Added support for stored procedure result sets date and time format.
-- JDBC:  ResultSet.getRow() fix to return correct number after inserting new rows.
-- JDBC:  Updated data truncation exception support.
-- JDBC:  Strip out comments in statements greater than 2M in V5R4.
-- JDBC:  Added query storage limit connection property.
-- NetServer:  Fix to createPrintShare().
-- NetServer:  Fixed bug in parameter validation in setTextConversionEnablement()
-- Object description:  Added support to list objects in an auxiliary storage pool (ASP) and to get the object descriptions.
-- Object description:  Added support for returning the asp device name on the path.
-- ObjectList:  Added support to list objects in an auxiliary storage pool (ASP) and to get the object descriptions.
-- Permissions:  Updated setDataAuthority() for *AUTL.
-- Permissions:  Changes to allow DLOPermission to work with the QDLS root folder.
-- Print:  Retrieving invalid spooled file attributes.
-- Product:  Changes so that when running natively user space will use sockets instead of native method calls. 
-- PTF:  Changes so that when running natively user space will use sockets instead of native method calls. 
-- QSYSObjectPathName:  Fix parsing of eszett and other 1 to N uppercasing characters.
-- Save file:  Changes so that when running natively user space will use sockets instead of native method calls. 
-- Security: Support new messages from sign-on server.
-- Security: Added additional change password return codes.
-- Spooled file:  Retrieving invalid spooled file attributes.
-- User space:  Changes so that when running natively user space will use sockets instead of native method calls to avoid error indicating that JT4PTF and JT4USRSPC user space could not be found.
-
- -
-

Fixes and enhancements in JTOpen 5.3 (released 2006-12-18)

-
-- Various:  Updated iSeries and server references in comments, text.
-- Various:  Javadoc updates.
-- Build:  Fixed various build warnings for JDK 1.5.
-- Connection:  Allow GSS credential to change.
-- Data area: Provide more useful exception information.
-- IFS:  Fixed bug that made IFSFile.setCCSID() a no-op.
-- JDBC:  Only send/update sort sequence if not set to default (hex).
-- JDBC:  Added query storage limit support.
-- JDBC:  Fixed JTOpen 1292204 - Garbage Collector impacts JDBC connection pool activity.
-- JDBC:  Added default column value support.
-- JDBC:  Updated max columns in group by support.
-- JDBC:  Updated query optimize goal documentation.
-- JDBC:  Fixed batch update support to use the correct information in a BatchUpdateException.
-- JDBC:  Various performance improvements.
-- JDBC:  Fix to allow a forward-only sensitive cursor.
-- NetServer:  Corrected behavior of getTextConversionEnablement()
-- PCML:  Provide more useful exception information, especially when PCML source document not found.
-- Program call:  Provide more useful exception information.
-- System resource:  Provide more useful exception information.
-- UDFS:  Added new classes IFSIoctlRep, IFSIoctlReq, and UDFS for user-defined file system support.
-
- -
-

Fixes and enhancements in JTOpen 5.2 (released 2006-08-28)

-
-- Various:  Updated iSeries and server references in comments, text.
-- Various:  Updated javadoc and property descriptions.
-- Build:  Updated for new cvs server access.
-- Build:  Updated for changes to the J2ME Toolkit. 
-- Data conversion:  Enhanced trace messages.
-- Data conversion:  Fixed recently introduced inconsistency with java.io.Reader.
-- IFS:  Added new classes ErrnoException, FileAttributes, and ObjectReferences.
-- IFS:  Eliminated compareTo(Object) method for JDK 1.5 compatibility.
-- IFS:  Better handling of 'access denied errors.
-- IFS:  Fixed JTOpen bug 1481835: Tolerate zero-length writes and reads. 
-- JDBC:  Fixed 'thread used' property to propagate it to AS400 object.
-- JDBC:  Various performance changes.
-- JDBC:  Updated client functional level.
-- JDBC:  Added 'metadata source' connection property.
-- JDBC:  Fix so convertFromRawBytes() is not called unexpectedly when using addBatch() with CallableStatement objects.
-- JDBC:  Fixed bug in USA time format.
-- JDBC:  Added clonable support to AS400JDBCDataSource.
-- JDBC:  Various tracing improvements.
-- JDBC:  Changes to not block data if a sensitive cursor is being used.
-- JDBC:  Close generated keys result set if Statement.close() is closed or if the statement is re-executed.
-- Object description:  Fixed bug where Boolean attributes are sometimes reported as Strings. 
-- Object description:  Fix ClassCastException retrieving SAVE_SIZE.
-- Open list:  Renamed 'enum' variable.
-- PCML:  Removed performance bottleneck by un-synchronizing a method.
-- PCML:  Close opened streams in 'finally' clause.
-- PCML:  Allow leftmost bit to be on for byte field init values.
-- PCML:  Improved error messages. 
-- Print:  CPU performance fix due to recursive paint events in SpooledFileViewer.
-- RFML:  Close opened streams in 'finally' clause.
-- PTF group:  Updated for Native support.
-- System value:  Various updates.
-- Trace:  Updated for JDK 1.5 misbehavior in LogManager.getLogger().
-
- -
-

Fixes and enhancements in JTOpen 5.1.1 (released 2006-04-26)

-
-- System pool:  Fixed incorrect ObjectDoesNotExistException from SystemPool objects generated from SystemStatus.
-- Trace:  Added milliseconds to timestamps.
-
- -
-

Fixes and enhancements in JTOpen 5.1 (released 2006-04-19)

-
-- Various:  Updated javadoc and code comments.
-- Connection:  Avoided potential StringIndexOutOfBoundsException in trace.  
-- Connection:  Added new properties to prevent use of current user and Unix domain sockets.
-- Connection:  Improved warning messages.
-- Connection pool:  Fixed JTOpen Bug 1459369:  Added support to terminate maintenance thread when pool is closed.
-- Data conversion:  Enhanced Bidi support.
-- FTP:  Added support so FTP datastreams use CRLF.
-- IFS:  Added new IFSFile methods:  setSorted() and getOwnerName().
-- IFS:  Un-deprecated classes IFSTextFileInputStream and IFSTextFileOutputStream.
-- IFS:  Added support for files larger than 2 gigabytes.  This support is only available when running to V6R1 or higher.
-- JarMaker:  Deprecated class AS400ToolboxJarMaker; replaced by ToolboxJarMaker.
-- JDBC:  Added new classes AS400JDBCManagedConnectionPoolDataSource and AS400JDBCManagedDataSource. 
-- JDBC:  Added self-managed pooling JDBC datasource.
-- JDBC:  Added new AS400JDBCDataSource method:  setProperties().
-- JDBC:  Added new 'translate boolean' connection property.
-- JDBC:  Various performance updates when searching for a field by field name.
-- JDBC:  Reset auto commit and the isolation level to the auto commit and isolation level being used before xa_start after xa_end is called.
-- JDBC:  Fix to calculate length correctly for a double-byte clob locator.
-- Object description:  Return LAST_USED_DATE as a Date type.
-- Program call:  Fix for JTOpen bug 1426019:  Document library list behavior.
-- RFML:  Added 'keyfield' attribute to RFML data element.
-- System pool:  Added additional properties.
-- System status:  Added additional properties.
-- Trace:  Do not map THREAD category to a Java logging level.
-
- -
-

Fixes and enhancements in JTOpen 5.0 (released 2006-01-16)

-
-- Various: Eliminated potential NullPointerExceptions.
-- Build: Include the AboutToolbox class in the native JAR.
-- Data conversioon:  Updated mappings for certain characters.
-- JDBC:  Added delimited name support. 
-- JDBC:  Added 'XA loosely coupled support', 'keepAlive', 'sendBufferSize', and 'receiveBufferSize' connection properties.
-- JDBC:  Eliminated possible hang in AS400JDBCConnection.cancel().
-- JDBC:  Updated DatabaseMetaData.getMaxTablesInSelect() to return correct value by release.
-- JDBC:  Added support for ALIAS table types.
-- Job:  Eliminated possible division-by-zero error.
-- RFML:  Eliminated possible division-by-zero error.
-
- -
-

Fixes and enhancements in JTOpen 4.9 (released 2005-10-28)

-
-- Various: J2SE 5.0 compatibility: Added append() method, required by Appendable; renamed variables named 'enum'.
-- Various: Updated javadoc and code comments.
-- Build: Removed Unix domain sockets from jt400.jar
-- Build: Removed flawed check in build.xml for existence of 'cvs.exe'.
-- Connection: Fixed JTOpen bug 1224014: PasswordExpirationDate inexact when NOMAX.
-- Data conversion: Add Euro and Circled R.
-- Data queue: Fixed garbage in sender information.
-- FTP: Eliminated hang in get() if file member not found.
-- IFS: Fixed 'File In Use' error from IFSFileReader and IFSFileWriter.
-- IFS: Handle reading more that 16 megabytes of data.
-- JDBC: Accept 'Character' instance as argument to PreparedStatement.setObject() when setting CHAR column.
-- JDBC: Added 'char' to list returned by DatabaseMetaData.getStringFunctions().
-- JDBC: Added support in AS400JDBCInputStream for mark/reset.
-- JDBC: Avoid possible deadlock in AS400JDBCConnectionHandle.finalizer(). 
-- JDBC: Check for null column descriptors in ResultSetMetaData.
-- JDBC: Improved handling of delimited names.
-- JDBC: Improved handling of return codes 438 and 443 from stored procedures.
-- JDBC: Added 'ALIAS' to reported list of supported table type.
-- JarMaker: Updated dependency list for 'IFS' component.
-- Job list: Fixed JobList sort list field lengths.
-- Message queue: Fixed divide by zero when list empty.
-- Message queue: Fixed reply type in receive method.
-- PCML: Corrected error message in case of insufficient input data.
-- Print: Allow SpooledFile constucted with 5 attribute to behave like 8 attribute constructed if server version/release supports additional attributes.
-- Print: Do not output SVF or SHF at start of each page unless application specifically sets by using method setHorizontalFormat() and setVerticalFormat().
-- Print: Fixes to ISeriesPrinter and SpooledFileOpenList.
-- QSYSObjectPathName: Selectively uppercase characters when composing *NAME values.
-- RFML: Eliminated inaccurate precalculation of required byte array length.
-- RLA: Improved description text in NumberFormatExceptions from AS400PackedDecimal and AS400ZonedDecimal.
-- Trace: Added support for Java logging (JSR 47).
-- User space: Added trace for file server QTEMP.
-
- -
-

Fixes and enhancements in JTOpen 4.8 (released 2005-06-20)

-
-- Various: Call setThreadSafe() only if threadsafe property not set.
-- Various: Javadoc fixes and enhancements.
-- Various: Native method updates.
-- Data conversion: Additional Bidi transform options.
-- IFS: Tolerate quotes within filenames.
-- JDBC: Added support for 2 MB SQL Statements, 128 byte column names, database host server trace, and added the query optimize goal property.
-- JDBC: Allow TMRESUME on a start() request if the server supports it.
-- JDBC: Allow a Timestamp to be retrieved from a TIME field.
-- JDBC: Allow extended column descriptors to be returned for a stored procedure result set.
-- JDBC: Allow retrieval of Aliases on a call to DatabaseMetaData.getTables().
-- JDBC: Catch ExtendedIllegalArgumentException from AS400PackedDecimal.toBytes() or AS400ZonedDecimal.toBytes(); convert to an SQLException.
-- JDBC: Catch StringIndexOutOfBoundsException when constructing a BigDecimal with a String.
-- JDBC: Changed the Internal Driver Error to a Data Type Mismatch error in convertToRawBytes().
-- JDBC: Fixed JTOpen Bug 1150395. Page backwards using relative() through a result set.
-- JDBC: Fixed JTOpen Bug 1155804. Improved collection pool cleanup logic.
-- JDBC: Pass the result set type to JDServerRowCache.
-- JDBC: Removed the literal space from the strip function.
-- JDBC: Reset data lengths and offsets based on the server format, if VLC compression was not used on a subsequent fetch.
-- JDBC: Retrieve the most recently used connection from the pool.
-- JDBC: Return VARCHAR for the Type Name and 12 for the type for a Long Varchar.
-- JDBC: Send a zero length package name when we ask for a normal prepare.
-- JDBC: Send empty Package name code point when doing a normal prepare and extended dynamic support is requested.
-- JDBC: Turn auto-commit back on and set the commitment control parser option when an XA transaction is ended.
-- Job: Added JOB_LOG_OUTPUT property.
-- Job list: Joblist.load() hangs with certain selection criteria.
-- Message queue: Fixed overflow in calculating receiver variable size.
-- Print: Added print attribute ATTR_PUBINF.
-- QSYS object types: Added new and missing object types.
-- RLA: Added Record.getFieldAsBytes() methods.
-- Resource: Deprecated package com.ibm.as400.resource
-- System status: Added getters for 4 additional properties.
-- System status: Added method getProcessorSharingAttribute().
-- System value: Corrected data type for QTHDRSCAFN.
-- Utilities: Deprecated class utilities.AS400ToolboxInstaller
-- Vaccess: Deprecated package com.ibm.as400.vaccess
-
- -
-

Fixes and enhancements in JTOpen 4.7 (released 2005-02-25)

-
-- Various: Deleted unnecessary static "Copyright" string.
-- Various: Javadoc updates, including those reported by Jack Woehr.
-- Connection: Added SecureAS400 constructor that takes a profile token.
-- Connection: Added pluggable signon handler (SignonHandler).
-- Connection: Attempt to detect and warn if multiple Toolbox versions on path.
-- IFS: Deprecated confusing IFSRandomAccessFile constructor, added a better one.
-- JDBC: Added a connect method.
-- JDBC: Added support for variable length field compression.
-- JDBC: Check for null SocketProperties before setting it on the AS400 object.
-- JDBC: Do not resend isolation level if it is same as current value.
-- JDBC: Fixed JTOpen Bug 4034. Use job CCSID if column label CCSID is 65535.
-- JDBC: Fixed JTOpen Bug 4121.  See if command contains "SELECT" after uppercasing.
-- JDBC: Fixed JTOpen Bug 4148. Always close PreparedStatement used to update row.
-- JDBC: Make sure serverCommitMode_ always maps to the JDBC isolation level.
-- JDBC: Output DISTINCT for TYPE_NAME of distinct column in DatabaseMetaData.getColumns().
-- JDBC: Return column name from data format when there is no column label.
-- JDBC: Send new isolation level for XA transactions.
-- JDBC: Throw SQLException when convert to raw bytes, except in some cases.
-- JavaApplicationCall: Added getCommandCall().
-- Job: Fixed JTOpen bug 1143395. Update max library list size.
-- Job: Throw exception when read-only value is specified on setValue().
-- Message queue: Retrieve user's message queue instead of assuming default path.
-- Object description: Added new method getValueAsString().
-- Permission: Preserve leading/trailing blanks in filename.
-- Print: Add ATTR_AUTOEND to attribute list.
-- Print: Added getInputStream() that takes a PrintParameterList as a parameter.
-- Print: Clarified that certain attributes are only available when a Writer is active to the Printer.
-- Print: Method getAttributeName(): Add AT_READ_BUFFERS_SEQ.
-- RFML: Fixed ArrayIndexOutOfBoundsException in RecordFormatDocument.toByteArray().
-- RFML: Improved error message when RFML doc is missing header.
-- RFML: Relocated excess-input check in setValues().
-- RLA: Enable authentication to DDM server with a profile token.
-- Security: CPF3C3C message from ProfileTokenCredential.
-- Subsystem: Added Subsystem class.
-
- -
-

Fixes and enhancements in JTOpen 4.6 (released 2004-10-25)

-
-- Various: Updated OS/400 and AS/400 references in comments, text.
-- Various: Minor documentation updates.
-- Various: Removed private getCopyright() method.
-- Build: Updated readme to refer to build.xml.
-- Build: Updated JDK level check in build.xml.
-- Connection: Fixed localhost IllegalStateException. (AS400)
-- Call stack: Added new class CallStackEntry.
-- Data conversion: Fix mixed byte buffering problem. (ConvTableReader)
-- FTP: Use separate thread to monitor ServerSocket when in "active" mode.
-- IFS: Throw IOException instead of ClosedChannelException. (IFSFileInputStream)
-- IFS: Changed name of directory created by IFSFileSystemView.createNewFolder().
-- JDBC: Added check for locators when batching.
-- JDBC: Set the socket properties on AS400 object before getting a connection.
-- JDBC: Minor performance improvement. (JDProperties)
-- JDBC: Added "rollback cursor hold" property to hold a cursor over a rollback.
-- PCML: Eliminated performance bottleneck in PcmlDocument.
-- Permission: Fixed filename character conversion bug.
-- Print: Fixed JTOpen bugs 3686 and 3694.  NullPointerException when holding spooled file that is completed.
-- Print: Added spooled file attributes ATTR_JOBCCSID, ATTR_JOBCCSID.
-- Print: Spooled file save/restore.
-- RLA: Synchronized incrementation of DCLNAME. (AS400FileImplRemote)
-- User: Added setters to User class.
-- User: Added V5R3 "local password management" property.
-- User: Added ability to filter by name in UserList.
-
- -
-

Fixes and enhancements in JTOpen 4.5.1 (not announced publicly)

-
-- Various: Updated OS/400 and AS/400 references in comments, text.
-- Various: Added serialVersionUID where missing.
-- Connection: Added ability to specify NLV on AS400.setLocale().
-- Connection: Clarified javadoc for AS400.setLocale() method.
-- Connection: Specified units for get/set methods of SocketProperties class.
-- IFS: Added new classes IFSFileReader and IFSFileWriter.
-- IFS: Upgraded IFSFileSystemView class to work with newer JDK's.
-- IFS: Corrected behavior of IFSJavaFile.isAbsolute().
-- JDBC: Fixed JTOpen Bug 4025.  Accommodate *LIBL not included in list_ array.
-- JDBC: Fixed JTOpen Bug 4013.  Don't ignore "thread used" connection property.
-- JDBC: Clarified javadoc: "cursor hold" only applies to commits, not rollbacks.
-- JDBC: Added more toolbox trace support to data source interface.
-- JDBC: Fixed proxy tracing.
-- PCML: Added method ProgramCallDocument.serialize(OutputStream).
-- Print: Added PrintObject attributes ATTR_DATE_END and ATTR_TIME_END.
-- Save file: Added new component to represent "save files".
-- Security: Removed unnecessary serializability from AS400Certificate* classes.
-- System value: Added new system values.
-
- -
-

Fixes and enhancements in JTOpen 4.5 (released 2004-08-06)

-
-- Data conversion: Tolerate multiple versions of Toolbox in classpath (ConvTable1200).
-- FTP: Added support for active mode.
-- IFS: Improved error messages in IFSFileImplRemote.
-- IFS: Added method IFSFile.setCCSID().
-- IFS: Fixed behavior of IFSFile.getFreeSpace().
-- JDBC: Added new LOB locator support.
-- JDBC: Added option to not fully close statement until transaction boundary.
-- Job: Added method Job.loadInformation(attributes).
-- Object description: Don't automatically uppercase library & object names.
-
- -
-

Fixes and enhancements in JTOpen 4.4 (released 2004-06-30)

-
-- CommandHelpRetriever: Use relative column widths on syntax summary table.
-- Connection: Decoupled JDBC and DDM from AS400 object, to improve effectiveness of AS400ToolboxJarMaker.
-- Connection pool: Added getSystemNames(), getUsers(system), and getConnectedUsers(system).
-- Connection pool: Fixed JTOpen Bug 3384.  (AS400ConnectionPool unnecessarily creates objects)
-- Connection pool: Fixed JTOpen Bug 3863.  (NullPointerException when connection returned to pool)
-- Data conversion: Fixed tables for CCSIDs 424, 862, 1200.
-- Data conversion: Added ability to return Double objects instead of BigDecimal objects on toObject() calls.
-- Data conversion: Allow BidiStringType.None as valid value.
-- Data queue: Fixed proxy delete() method.
-- Documentation: Various javadoc fixes, additions, and enhancements.
-- IFS: Fixed JTOpen Bug 3722. (ClassCastException in IFSFileDescriptorImplRemote)
-- IFS: Added IFSFile methods setPatternMatching(), getPatternMatching().
-- JDBC: Miscellaneous minor enhancements.
-- JDBC: Fixed JTOpen Bug 3605.  (Cleanup after failed creation of prepared stmt)
-- JDBC: Fixed JTOpen Bug 3655.  (AS400JDBCConnectionPool.fill())
-- JDBC: Fixed JTOpen Bug 3801.  (Check for null values from DatabaseMetaData.getTables())
-- JDBC: Fixed JTOpen Bug 3818.  (Normalize DATE milliseconds)
-- JDBC: Additional tracing activation method.
-- JDBC: Performance improvement in SQL statement parsing.
-- JDBC: Return "" for base table name if no column descriptors are returned.
-- List: Check the 'list status indicator' returned by QGY* API's.
-- Message queue: Fixed RMessageQueue string buffer problem.
-- NetServer: Added getters to ISeriesNetServer for pending attribute values.
-- PCML: Added ProgramCallDocument.getProgramCall().
-- RLA: Performance improvements.
-- RFML: Fixed JTOpen Bug 3953.  (Deserializing RecordFormatDocument)
-- System value: Improved handling of invalid QDATE values.
-
- -
-

Fixes and enhancements in JTOpen 4.3.1 (released 2004-04-27)

-
-- Build: Removed unnecessary -R option on checkout commands in build.xml.
-- Connection: Added ability to pass GSS Credential to system object.
-- FTP: Update lastMessage value more consistently.
-- JDBC: Fixed bug that caused reduced performance and memory leakage.
-- PCML: Removed unnecessary Xalan runtime dependency in PcmlSAXParser.
-
- -
-

Fixes and enhancements in JTOpen 4.3 (released 2004-04-02)

-
-- Build: Added BidiConversionProperties to proxy jar.
-- Build: Added SystemProperties.class to jt400Servlet.jar.
-- CommandHelpRetriever: Added generateHTMLBytes() method.
-- CommandHelpRetriever: Set charset to UTF-8 instead of ISO-8859-1.
-- CommandHelpRetriever: Javadoc for generateHTML() now indicates the charset is UTF-8.
-- Data conversion: Added constant BidiStringType.NONE.
-- Data conversion: Fixed possible thread-safety issue with Bidi conversion.
-- Data conversion: Various fixes and enhancements related to Bidi conversion.
-- Data conversion: Added class BidiConversionProperties.
-- Documentation: Various javadoc fixes, additions, and enhancements.
-- IFS: Fixed bug in IFSFile.mkdirs().
-- JDBC: DatabaseMetaData.getColumns(): Allow CHAR()/VARCHAR() FOR BIT DATA to be displayed instead of CHAR/VARCHAR.
-- JDBC: Added check for server functional level before setting Ctl timeout and lock wait.
-- JDBC: Added method AS400JDBCDriver.connect(AS400 system, boolean clone).
-- JDBC: Catch exceptions in the finalize() methods in AS400JDBCStatement and AS400JDBCResultSet.
-- JDBC: Allow binary string constants in the form of x'1234' and X'1234'.
-- JDBC: Treat the first character in an odd-length String or char[] as the lower nibble of a byte instead of the last character.
-- JDBC: Avoid optimization problem with JDK 1.3 BigDecimal.compareTo() method.
-- JDBC: AS400JDBCResultSet.updateRow() now uses the base column name instead of the column label.
-- JDBC: Changed SQLDBClobLocator.writeToServer() to use number of characters instead of number of bytes for the start offset.
-- JDBC: Changed autoCommit to trueAutoCommit to align with connection string property "true auto commit".
-- JDBC: JDBCProperties: Changed "bidirectional string type" to "bidi string type".
-- JDBC: SQLResultSetTableModel: Removed beforeFirst() call since stored procedures might not return a scrollable cursor if one is requested.
-- JDBC: AS400JDBCResultSet now returns null if a data mapping error occurs.
-- JDBC: SQLResultSetTableModel will now output "++++++++++++++" when a data mapping error occurs.
-- JDBC: Use BidiConversionProperties class instead on only Bidi string type.
-- JDBC: Added two connection properties "bidi implicit reordering" and "bidi numeric ordering".
-- Job: Return -1 on getQueuePriority() if job's status is *OUTQ.
-- Job list: Trace a warning message if there are open enumerations returned by a JobList and the JobList is being closed.
-- Job list: Invalidate all JobEnumerations created from a JobList which has been closed.
-- Object description: Tolerate additional error message in exists().
-- Print: Formdef is now handled on the server.
-- Print: Maintain lowercase for certain attributes.
-- Print: Retrieve AT_SYS_DRV_PGM attribute.  Added ATTR_CHR_RTT_CMDS attribute.
-- RFML: Rethrow IOException as SAXException on call to DefaultHandler.resolveEntity(), for compatibility with the IBM JDK.
-- RLA: Handle *NONE key field names in logical files.
-- Spooled file: Retrieve ATTR_CHR_RTT_CMDS attribute.
-- Spooled file: Don't retrieve ATTR_DATE_END or ATTR_TIME_END.
-- User space: *SYSTEM domain was being sent to the server as *SYSTFM on a create().
-
- -
-

Fixes and enhancements in JTOpen 4.2 (released 2003-12-23)

-
-- Build: Created task to insert copyright strings into JTOpen-built class files.
-- Build: Added copyright strings to binary class files in CVS.
-- Build: Added an IdentityToken stub since we currently cannot ship EIM with JTOpen.
-- Connection: Support EIM "identity tokens" for authentication.
-- Connection: Added serialVersionUID to SocketProperties.
-- Connection: Added AS400.setDDMRDB() method to set the IASP/RDB to use for record-level access (RLA).
-- Connection: Added AS400.getSocketProperties().
-- Connection pool: Fixed bug #3727 - Don't synchronize the entire pool in order to get one connection out.
-- Connection pool: Added socket properties.
-- Connection pool: Allow null password.
-- Connection pool: Set thread name on maintenance thread.
-- Connection pool: Don't start maintenance thread if threadUsed is false.
-- Data conversion: Added another variant of CharConverter.byteArrayToString() and stringToByteArray().
-- Data conversion: Enhanced Bidi algorithms.
-- Data conversion: Directly support CCSID 1208 (UTF-8).
-- Data queue: Updates to allow user to write to a data queue without having read authority.
-- HTML: Properly allow multiple options to be selected in a SelectFormElement.
-- IFS: Fixed list attribute calls on files larger than 2 gigabytes.
-- IFS: Changed VRM check.
-- JDBC: Added a JDBC trace category; log to the Toolbox trace, log stream, and log writer separately.
-- JDBC: Changed major driver version to 6.0.
-- JDBC: Allow read-only sensitive cursors.
-- JDBC: Changed exception text for data type mismatches on date, time, and timestamp types.
-- JDBC: Support scrollable stored procedure result sets when the server does.
-- JDBC: Get the long table names when calling getExportedKeys().
-- JDBC: Support new auto-commit and commit levels provided by server.
-- JDBC: Updated cursor sensitivity handling; use asensitive cursors as default for ResultSet.TYPE_SCROLL_SENSITIVE.
-- JDBC: Added NTS support.
-- JDBC: Use underlying column name when updating a row that has a column with an alias.
-- JDBC: Minor performance improvements in statement batching.
-- Job: Do not allow ELAPSED statistics constants to be retrievable attributes on JobList.
-- NetServer: Deprecated NetServer* classes; replaced with new ISeriesNetServer* classes.
-- NetServer: Added KERBEROS_OR_PASSWORDS authentication method constant.
-- Open list: Added IPP attribute, job system name filter, and date filter to SpooledFileOpenList.
-- Open list: Change STATUS_PRINTING constant for SpooledFileOpenList to match what the API expects (*PRINTER).
-- Open list: Fixed null job system name on items in SpooledFileOpenList.
-- Open list: Status filter on SpooledFileOpenList should have been a String array.
-- PCML: Updated class loading scheme so PCML files can be found under Websphere and Eclipse.
-- Permission: Updated the way object names and CL command strings are treated to handle NLS issues.
-- Permission: Changed thread-safe settings on underlying CL commands so that they will work natively.
-- Permission: Added setPrimaryGroup().
-- Permission: Support Unicode object path names when the server does.
-- Print: Added PrintObject.getSingleAttribute() methods.
-- Product: Fixed user space error when calling getPTFs() natively.
-- Program call: Fixed no program object with no message option.
-- Proxy: Fixed ArrayIndexOutOfBoundsException in ProgramCall.
-- PTF: Return message help of "None" for a status of NOT_LOADED.
-- PTF: Fixed isPreReq() and isCoReq().
-- Resource: Deprecated this package in favor of function in the access package.
-- RLA: Updated record format field names to match output from DSPFFD.
-- User: Added exists().
-- User space: Updated to create with optimum alignment.
-- Utilities: Added comment that specifies column widths for CommandHelpRetriever.
-- Vaccess: Fix for checkboxes in AS400JDBCDataSourcePaneGUI under JDK 1.4.
-
- -
-

Fixes and enhancements in JTOpen 4.1 (released 2003-08-13)

-
-- Build: Include build directory in src.zip.
-- Build: Added xpcml.xsd to jt400.jar and jt400Native.jar
-- Build: Added com.ibm.as400.access.list package.
-- Build: Use old StringBuffer.append() method in RJobLog and HTMLDocument for compatibility with JDK 1.3.
-- Comm trace: Added reverse.
-- Connection: Open sourced AS400ImplRemote.
-- Connection: Support extra GSS/Kerberos option of authentication for portlet environment.
-- Connection: Catch socket properties exceptions when tracing is active.
-- Connection pool: Moved inner classes to their own external definitions, to avoid possible JIT errors.
-- Connection pool: Check for null in AS400JDBCConnectionPool.setDataSource().
-- Connection pool: Ensure AS400 object is connected when it is retrieved from the pool.
-- Data areas: Cleaned up implementation of subclass delete() methods.
-- Data conversion: Added NLV mapping for zh_CN.
-- Data conversion: Added getInstanceType() methods to AS400DataType classes for performance.
-- Data conversion: Added CCSID 17584 (subset of 1200).
-- Data conversion: Removed _en and _en_US resource bundles, they were a performance hit and are not needed.
-- Data conversion: Added localeToNLV() methods on NLS class.
-- Data conversion: Fixed AS400Text.toBytes() for CCSIDs 13488 and 61952.
-- Data conversion: Made BinaryConverter.bytesToString() and stringToBytes() public.
-- Directory entries: Default to USER_PROFILE, "*" when no selection IDs are added.
-- Environment variables: Fixed problems with service program call.
-- FTP: Use APPE instead of APPEND to work with non-OS/400 FTP servers.
-- HTML: Throw exception if listener is null on form and table converters.
-- IFS: Added copyTo() functionality.
-- IFS: Added isSymbolicLink().
-- Javadoc: Added doc-files subdirectories and updated references in all source parts.
-- Javadoc: Added CCSID list and component list documentation, linked to from utilities.AS400ToolboxJarMaker.
-- Javadoc: Minor updates to micro JDBC driver.
-- Javadoc: Added example to JobList.addJobSelectionCriteria().
-- Javadoc: Minor fixes to FTP classes.
-- JDBC: Minor description string updates to AS400JDBCDataSourcePaneGUI.
-- JDBC: Post data truncation warning when the database has a mapping error.
-- JDBC: Perform case insensitive search for parameter indices to match the JDBC spec.
-- JDBC: Pad with correct space character in CLOBs.
-- JDBC: Fixed string index in CLOBs when locators are used.
-- JDBC: Added loginTimeout and serverTraceCategories properties to data source.
-- JDBC: Fixed translateHex property in data source.
-- JDBC: Added materialized query table support.
-- JDBC: Added static cursor support.
-- JDBC: Throw data type mismatch when length on setBinaryStream() is greater than the stream length, except on locators.
-- JDBC: Throw data truncation when length on setBinaryStream() is greater than the column size.
-- JDBC: ResultSetMetaData.getTableName() now calls getBaseTableName().
-- JDBC: Changed how cursor sensitivity is used.
-- JDBC: Changed how output parameters are registered and retrieved.
-- JDBC: Fixed proxy support for BLOBs and CLOBs.
-- JDBC: Alias VARBIN and BINARY VARYING to VARBINARY.
-- JDBC: Changed radix from decimal (10) to binary (2) on double, float, and real columns.
-- JDBC: Support setting a URL for char and graphic columns.
-- JDBC: Changed setBytes() to expect byte[].class instead of Byte.class.
-- JDBC: Added proxy support for ParameterMetaData.
-- JDBC: Set table name from first SELECT FROM TABLE only, in the case of a subquery.
-- JDBC: Changes to how the default schema is added to the library list.
-- Job: Return empty array when JobList length is 0.
-- Messages: Added option to get the user who sent the message as well as the initial user of the job. 
-- Messages: Fixed MessageFile.replaceText() to use the correct indices.
-- Messages: Support more than 10 messages returned from a remote command or API call.
-- NetServer: Added new ISeriesNetServer classes to replace the ones that relied on PCML/Resource framework.
-- Object: Only call API on-thread if Toolbox property is set.
-- Object: Added ObjectDescription.exists().
-- Open list: Added new package com.ibm.as400.access.list.
-- Open list: Added SpooledFileOpenList classes to use in place of regular SpooledFile classes for performance.
-- PCML: Added support to PCML for XPCML, using XML schemas.
-- PCML: Updated xsl and xsd definitions.
-- PCML: Removed dependency on XML parser when using serialized PCML.
-- PCML: Handle extendable elements in XPCML.
-- PCML: Handle non-qualified transform file name.
-- PCML: Support PCML/XPCML documents via an InputStream.
-- Print: Added ISeriesPrinter class to use remote command server instead of network print server for performance.
-- Print: Added more print attributes to print classes such as AFPResource and SpooledFile.
-- PTF: Added getRelationship(), fixed pre-req and co-req methods.
-- User: Added more constants.
-- Utilities: Added AboutToolbox class to utilities package, to determine which version of jt400.jar is used.
-- Utilities: Handle old and new tags in gencmddoc.
-
- -
-

Fixes and enhancements in JTOpen 4.0 (released 2003-04-30)

-
-- Build: Compile with JDK 1.4 to eliminate dependencies, target JDK 1.1.
-- Build: Updated manifest files with new JTOpen version number.
-- Build: Removed PDML task; separated native optimization classes.
-- Build: Added class files to repository to avoid SSLight as a build requirement.
-- Build: Require JDK 1.4.1 to avoid javadoc and ToolboxME errors.
-- Build: Changed SQLData classes to use a getter instead of overridden static to avoid Jikes issues.
-- Build: Various javadoc fixes to pacify JDK 1.4.1 javadoc tool.
-- Build: Removed calls to StringBuffer.append(StringBuffer) to avoid Sun compatibility issue across JDK levels.
-- Command: Add product library to library list before refreshing panel group information.
-- Command: Separated getXMLXXX() methods so as not to rely on system command information.
-- Command call: Deprecated getJob() in favor of getServerJob().
-- Connection pool: Changed ConnectionListEvent.getSource() to always return an AS400 object.
-- Connection pool: Added synchronization; throw exception if PooledConnection is in use.
-- Data conversion: CCSID 1200 is now UTF-16; CCSID 1202 is now little endian UCS-2.
-- Data conversion: Fixed ArrayIndexOutOfBoundsException in ConvTableReader.
-- Data conversion: Bidi strings are now padded before conversion algorithm is applied, instead of after.
-- Data conversion: Changed packed and zoned decimals to have 63-digit maximum instead of 31.
-- Directory entry: Fixed getMailServiceLevel().
-- HTML: Support XSL-FO tags.
-- HTML: Added FileListElement.list(HTMLTableConverter) method.
-- Javadoc: Removed reference to AS400snameFormatter from CharConverter class.
-- Javadoc: Fixed PTF.getIPLRequired().
-- Javadoc: Fixed AS400ToolboxJarMaker link to Job class.
-- Javadoc: Updated SpooledFile.
-- Javadoc: Added javadoc regarding QTEMP.LIB to IFSFile.
-- Javadoc: Corrected javadoc for DirectoryEntry.getCountry().
-- Javadoc: Generate javadoc for com.ibm.as400.util.commtrace package.
-- Javadoc: Handle com.ibm.as400.security.auth package.
-- Javadoc: Fixed example in DirectoryEntryList.
-- JDBC: Update counts now return SUCCESS_NO_INFO on a blocked insert.
-- JDBC: Support ROWID column type.
-- JDBC: Performance improvement to SQLData types - use integer type instead of instanceof.
-- JDBC: Adjusted minimum divide scale property.
-- JDBC: Binary types now support Strings of hexadecimal characters.
-- JDBC: Workaround for JIT bug in JDk 1.3 while parsing SQL statements.
-- JDBC: Changed to report correct maximum precision for various data types according to SQL Reference.
-- JDBC: Changed Blob and Clob datastreams to use new host server truncation codepoint for writing.
-- JDBC: Changed behavior of mixed case column names to ignore case unless surrounded by quotes.
-- JDBC: Fixed NullPointerException in ResultSet.getBytes().
-- JDBC: Changed DatabaseMetaData.supportsResultSetType() to return TYPE_SCROLL_INSENSITIVE.
-- JDBC: Fixed data truncation bugs and warnings.
-- JDBC: Removed limitation of 32K statements in batch.
-- JDBC: Added AS400JDBCConnectionHandle.getServerJobIdentifier().
-- JDBC: Trace LOB locator handles.
-- JDBC: Support retrieving base table name for each column.
-- JDBC: Allow length on setXXX(InputStream) methods to differ from actual amount of data in InputStream.
-- JDBC: Added QAQQINI library name property.
-- JDBC: Handle statements with missing closing parenthetical mark.
-- JDBC: Additional tracing for server attributes.
-- JDBC: Do extra validation of decimal position and scale properties.
-- JDBC: Support 63-digit decimal precision; use UTF-16 for default client encoding.
-- JDBC: Fixed typecast and max/min value bugs in SQLBigint.
-- JDBC: Support unencoded passwords in a data source Reference object.
-- JDBC: PreparedStatement now remains useable after a batch execute.
-- JDBC: Trace property no longer turns off Toolbox trace when set to its default.
-- JDBC: Handle scientific notation numbers that have no decimal point.
-- JDBC: Properly calculate stream length for Unicode Readers.
-- JDBC: Trace object ID in SQLExceptions.
-- JDBC: Fixes for erroneous commas in SQL statements.
-- JDBC: Many fixes for LOB support.
-- JDBC: Work around Brazil time zone issue.
-- JDBC: Issue warning when 1000 open statements are reached per connection.
-- JDBC: AS400JDBCDataSource can now be constructed with an AS400 object.
-- JDBC: Ensure LOB classes do not break JDBC 1.0 clients.
-- JDBC: Literal prefix for binary strings changed to "X'" instead of "'".
-- JDBC: Fixed DatabaseMetaData.supportsTransactionIsolationLevel().
-- JDBC: Use 819 (ISO) instead of 13488 (UCS-2) in toAsciiStream().
-- JDBC: LOB locators now write to the server when necessary.
-- JDBC: Correctly handle LOB locators when executing batch statements.
-- JDBC: Added "toolbox trace" property.
-- JDBC: Fixed issues with running to a Toolbox ProxyServer.
-- JDBC: Added properties for package CCSID, min divide scale, max precision, and max scale.
-- JDBC: Avoid rounding errors when parsing big integers.
-- JDBC: Issue data truncation warning on a read.
-- Job log: Added writeMessage(boolean onThread).
-- Messages: Updated tracing; avoid NullPointerException in AS400Message.getPath().
-- Panel group: Changed help identifier constructor to not throw an exception if library/object name is blank.
-- Panel group: Mark QUHRHLPT API as threadsafe.
-- PCML: (Bug #3538) Use context class loader to avoid issues in Websphere.
-- PCML: Serializing a PCML file now uses a BufferedOutputStream.
-- Print: Extra message information added.
-- Program call: Deprecated getJob() in favor of getServerJob().
-- QSYS object types: Support TIMZON and PDFMAP.
-- Security: Refreshed codebase from Toolbox LPP; open sourced.
-- Security: Changes to authentication token generation.
-- Servlet: Support XSL-FO tags.
-- System value: Support QTHDRSCAFN and QTHDRSCADJ.
-- User: Updated javadoc and synchronization in UserList.
-- User space: Added constants; allow *USER.
-- Utilities: Support specifying alternate panel group to retrieve help text in CommandHelpRetriever.
-- Utilities: CommandHelpRetriever now generates UIM template source.
-- Utilities: Changed space character generation in CommandHelpRetriever.
-- Utilities: Gracefully handle CPF6250 messages in CommandHelpRetriever.
-- Utilities: Fixed unnecessary dependencies on the JDBC classes by the AS400 object in JarMaker.
-- Utilities: Made CommandHelpRetriever's output directory non-static.
-
-
- - diff --git a/cvsroot/contrib/.project b/cvsroot/contrib/.project deleted file mode 100644 index 1b9df611e..000000000 --- a/cvsroot/contrib/.project +++ /dev/null @@ -1,11 +0,0 @@ - - - contrib - - - - - - - - diff --git a/cvsroot/contrib/com/ibm/as400/access/PersistenceException.java b/cvsroot/contrib/com/ibm/as400/access/PersistenceException.java deleted file mode 100644 index 86725fe17..000000000 --- a/cvsroot/contrib/com/ibm/as400/access/PersistenceException.java +++ /dev/null @@ -1,107 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PersistenceException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2001-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * Thrown when an error occurs accessing resources on the system. - * - * @author Thomas Johnson (tom.johnson@kingland.com), Kingland Systems Corporation - */ -public class PersistenceException extends Exception { - - AS400Message[] messageList_ = null; -/** - * Default constructor. - */ -public PersistenceException() { - super(); -} -/** - * Constructs an exception based on a list of system messages. - * - * @param messageList - * com.ibm.as400.access.AS400Message[] - */ -public PersistenceException(AS400Message[] messageList) { - this(messageList, ""); -} -/** - * Constructs an exception based on a list of system messages - * and detail string. - * - * @param messageList - * com.ibm.as400.access.AS400Message[] - * @param s - * java.lang.String - */ -public PersistenceException(AS400Message[] messageList, String s) { - this(s); - setMessageList(messageList); -} -/** - * Constructs an exception with the given detail string. - * - * @param s - * java.lang.String - */ -public PersistenceException(String s) { - super(s); -} -/** - * Constructs an exception with detail provided by the given throwable. - * - * @param t - * java.lang.Throwable - */ -public PersistenceException(Throwable t) { - this(t.toString()); -} -/** - * Returns the list of associated system messages; null if not available. - * - * @return - * com.ibm.as400.access.AS400Message[] - */ -public AS400Message[] getMessageList() { - return messageList_; -} -/** - * Sets the list of associated system messages. - * - * @param messageList - * com.ibm.as400.access.AS400Message[] - */ -private void setMessageList(AS400Message[] messageList) { - messageList_ = messageList; -} -/** - * Returns a string representation of the object. - * - * @return - * java.lang.String - */ -public String toString() { - StringBuffer sb = new StringBuffer(super.toString()); - AS400Message[] list = getMessageList(); - - if (list != null) - for(int i=0; i - * Note: The ability to find and modify the list is dependent on - * the access rights of the signed-on user profile to the - * validation list. - * - * @author Thomas Johnson (tom.johnson@kingland.com), Kingland Systems Corporation - */ -public class ValidationList { - - private static int LISTBUFFER_LENGTH_INITIAL = 32768; //32K - private static int LISTBUFFER_LENGTH_NEXT = 524288; //512K - - private AS400 as400_ = null; - private AS400Structure listInfo_ = null; - private AS400Structure vlde0100_ = null; - private QSYSObjectPathName path_ = null; - private String description_ = null; -/** - * Constructs a validation list. - *

- * Note: The AS400 and Path properties must be set prior to taking - * action against the object. - */ -public ValidationList() { - super(); -} -/** - * Constructs a validation list for the given system. - *

- * Note: The Path property must be set prior to taking action against - * the object. - * - * @param as400 - * the system - * - */ -public ValidationList(AS400 as400) { - this(); - setAS400(as400); -} -/** - * Constructs a validation list for the given system and path. - * - * @param as400 - * com.ibm.as400.access.AS400 - * @param path - * com.ibm.as400.access.QSYSObjectPathName - * - */ -public ValidationList(AS400 as400, QSYSObjectPathName path) { - this(); - setAS400(as400); - setPath(path); -} -/** - * Constructs a validation list for the given system - * and object/library names. - * - * @param as400 - * com.ibm.as400.access.AS400 - * @param obj - * java.lang.String - * @param lib - * java.lang.String - */ -public ValidationList(AS400 as400, String obj, String lib) { - this(); - setAS400(as400); - setPath(new QSYSObjectPathName(lib, obj, "vldl")); -} -/** - * Adds the entry to the validation list. - * - * @param entry - * ValidationListEntry - * @exception PersistenceException - * If an error occurs while calling the IBM i APIs. - */ -public void addEntry(ValidationListEntry entry) throws PersistenceException { - ProgramCall pgm = new ProgramCall(getAS400()); - ProgramParameter[] parmList = new ProgramParameter[6]; - try { - pgm.setProgram(QSYSObjectPathName.toPath("QSYS", "QSYADVLE", "PGM"), parmList); - } catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - - // Refer to documentation for the QSYADVLE Security API for a complete description of parameters - parmList[0] = getQualifiedNameParm(); - parmList[1] = new ProgramParameter(entry.getEntryID().toBytes()); - parmList[2] = new ProgramParameter(entry.getDataToEncrypt().toBytes()); - parmList[3] = new ProgramParameter(entry.getUnencryptedData().toBytes()); - parmList[4] = new ProgramParameter(entry.getAttributeInfo().toBytes()); - parmList[5] = new ProgramParameter(new AS400Bin4().toBytes(0)); - - runProgram(pgm); -} -/** - * Alters the entry in the validation list. - * - * @param entry - * ValidationListEntry - * @exception PersistenceException - * If an error occurs while calling the IBM i APIs. - */ -public void changeEntry(ValidationListEntry entry) throws PersistenceException { - ProgramCall pgm = new ProgramCall(getAS400()); - ProgramParameter[] parmList = new ProgramParameter[6]; - try { - pgm.setProgram(QSYSObjectPathName.toPath("QSYS", "QSYCHVLE", "PGM"), parmList); - } catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - - // Refer to documentation for the QSYCHVLE Security API for a complete description of parameters - parmList[0] = getQualifiedNameParm(); - parmList[1] = new ProgramParameter(entry.getEntryID().toBytes()); - parmList[2] = new ProgramParameter(entry.getDataToEncrypt().toBytes()); - parmList[3] = new ProgramParameter(entry.getUnencryptedData().toBytes()); - parmList[4] = new ProgramParameter(entry.getAttributeInfo().toBytes()); - parmList[5] = new ProgramParameter(new AS400Bin4().toBytes(0)); - - runProgram(pgm); -} -/** - * Close the current list of entries maintained on the system. - *

- * The list is opened by the initial call to the list API. In doing so, the entire - * contents of the list is retrieved as a snapshot and stored in a buffer on the - * IBM i system. The list contents can then be retrieved from the pre-filled - * buffer, in whole or in part, at the convenience of the application by using a - * system-provided handle. The handle is used to close the list when the - * application has completed processing of all entries. - * - * @param handle byte[] - * @exception PersistenceException - * If an error occurs while calling the IBM i APIs. - */ -private void closeList(byte[] handle) throws PersistenceException { - ProgramCall pgm = new ProgramCall(getAS400()); - ProgramParameter[] parmList = new ProgramParameter[2]; - try { - pgm.setProgram(QSYSObjectPathName.toPath("QGY", "QGYCLST", "PGM"), parmList); - } catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - - // Refer to documentation for the QGYCLST generic list API for a complete description of parameters - parmList[0] = new ProgramParameter(new AS400ByteArray(handle.length).toBytes(handle)); - parmList[1] = new ProgramParameter(new AS400Bin4().toBytes(0)); - - runProgram(pgm); -} -/** - * Creates the validation list on the IBM i system. - * - * @exception PersistenceException - * If an error occurs while calling the IBM i command. - */ -public void create() throws PersistenceException { - String obj = getPath().getObjectName(); - String lib = getPath().getLibraryName(); - - CommandCall cmd = new CommandCall(getAS400(), - "CRTVLDL VLDL("+lib+"/"+obj+") TEXT('"+getDescription()+"')"); - runCommand(cmd); -} -/** - * Deletes the validation list from the IBM i system. - * - * @exception PersistenceException - * If an error occurs while calling the IBM i command. - */ -public void delete() throws PersistenceException { - String obj = getPath().getObjectName(); - String lib = getPath().getLibraryName(); - - CommandCall cmd = new CommandCall(getAS400(), - "DLTVLDL VLDL("+lib+"/"+obj+")"); - runCommand(cmd); -} -/** - * Sets contents of the string buffer at the given offset from the specified string. - * - * @param buffer - * java.lang.StringBuffer - * @param offset - * int - * @param s - * java.lang.String - */ -private void fillStringBuffer(StringBuffer buffer, int offset, String s) { - for (int i=0; i - * The ccsid parameter indicates the ccsid used to store the identifier in the - * entry on the IBM i system. This apparently needs to be an exact match in order to - * find the entry as it was originally inserted. - *

- * No attribute values are retrieved for the entry. - * - * @param identifier - * java.lang.String - * @param ccsid - * int - * @return - * ValidationListEntry - * @exception PersistenceException - * If an error occurs while calling the IBM i APIs. - */ -public ValidationListEntry findEntry(String identifier, int ccsid) throws PersistenceException { - return findEntry(identifier, ccsid, new ValidationListAttribute[0]); -} -/** - * Returns an entry from the validation list with the given identifier and attributes. - *

- * The ccsid parameter indicates the ccsid used to store the identifier in the - * entry on the IBM i system. This apparently needs to be an exact match in order to - * find the entry as it was originally inserted. - *

- * The attributes parameter indicates the list of attributes to retrieve for - * the entry. Each attribute specified must contain a valid identifier. - * - * @param identifier - * java.lang.String - * @param ccsid - * int - * @param attributes - * ValidationListAttribute[] - * @return - * ValidationListEntry - * @exception PersistenceException - * If an error occurs while calling the IBM i APIs. - */ -public ValidationListEntry findEntry(String identifier, int ccsid, ValidationListAttribute[] attributes) throws PersistenceException { - ValidationListEntry entry = new ValidationListEntry(); - - ProgramCall pgm = new ProgramCall(getAS400()); - ProgramParameter[] parmList = new ProgramParameter[6]; - try { - pgm.setProgram(QSYSObjectPathName.toPath("QSYS", "QSYFDVLE", "PGM"), parmList); - } catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - - ValidationListTranslatedData entryID = - new ValidationListTranslatedData(identifier, ccsid, getAS400()); - ValidationListAttributeInfo attrInfo = - new ValidationListAttributeInfo(attributes); - - // Refer to documentation for the QSYFDVLE Security API for a complete description of parameters - parmList[0] = getQualifiedNameParm(); - parmList[1] = new ProgramParameter(entryID.toBytes()); - parmList[2] = new ProgramParameter(attrInfo.toBytes()); - parmList[3] = new ProgramParameter(entry.getByteLength()); - parmList[4] = new ProgramParameter(attrInfo.getByteLength()); - parmList[5] = new ProgramParameter(new AS400Bin4().toBytes(0)); - - runProgram(pgm); - - entry.init(parmList[3].getOutputData(), 0); - attrInfo.setAttributesData(parmList[4].getOutputData(), 0); - entry.setAttributeInfo(attrInfo); - - return entry; -} -/** - * Returns the IBM i system containing the validation list. - * - * @return com.ibm.as400.access.AS400 - */ -public AS400 getAS400() { - return as400_; -} -/** - * Returns the text description for the validation list object. - *

- * Note: Only returned if set by the setDescription() method. - * - * @return java.lang.String - */ -public String getDescription() { - if (description_ != null) - return description_; - return ""; -} -/** - * Returns all entries from the validation list. - *

- * Note: The list is opened by the initial call to the list API. In doing so, the entire - * contents of the list is retrieved as a snapshot and stored in a buffer on the - * IBM i system. The list contents can then be retrieved from the pre-filled - * buffer, in whole or in part, at the convenience of the application by using a - * system-provided handle. The handle is used to close the list when the - * application has completed processing of all entries. - *

- * Currently the entire list is built and retrieved synchronously by this method. - * This could potentially be changed to allow for additional processing options, - * such as asynchronous building of the list, retrieving only a subset of - * entries, etc. For now we just keep it simple. - * - * @exception PersistenceException - * If an error occurs while calling the IBM i APIs. - */ -public ValidationListEntry[] getEntries() throws PersistenceException { - - ProgramCall pgm = new ProgramCall(getAS400()); - ProgramParameter[] parmList = new ProgramParameter[7]; - int bufferLength = LISTBUFFER_LENGTH_INITIAL; - try { - pgm.setProgram(QSYSObjectPathName.toPath("QGY", "QSYOLVLE", "PGM"), parmList); - } catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - - // Refer to documentation for the QSYOLVLE Security API for a complete description of parameters - parmList[0] = new ProgramParameter(bufferLength); - parmList[1] = new ProgramParameter(new AS400Bin4().toBytes(bufferLength)); - parmList[2] = new ProgramParameter(getListInfoStruct().getByteLength()); - parmList[3] = new ProgramParameter(new AS400Bin4().toBytes(-1)); // List is built synchronously - parmList[4] = new ProgramParameter(new AS400Text(8, getAS400()).toBytes("VLDE0100")); - parmList[5] = getQualifiedNameParm(); - parmList[6] = new ProgramParameter(new AS400Bin4().toBytes(0)); - - // Open/initialize the list - runProgram(pgm); - - Object[] listInfo = (Object[])getListInfoStruct().toObject(parmList[2].getOutputData()); - ValidationListEntry[] list = new ValidationListEntry[((Integer)listInfo[0]).intValue()]; - - byte[] listHandle = (byte[])listInfo[2]; - int listPosition = ((Integer)listInfo[1]).intValue(); - - // Process the entries retrieved on the initial call - parseEntries(list, 0, parmList[0].getOutputData(), listPosition); - - // Continue to fetch more entries until the entire list is retrieved - while (listPosition < list.length) { - listPosition += getNextEntries(listHandle, listPosition, list); - } - - // Close/cleanup the list - closeList(listHandle); - return list; -} -/** - * Returns the structure used to convert values for a list information parameter. - *

- * This structure is referenced when calling the QSYOLVLE and QGYGTLE APIs to retrieve - * the initial and subsequent lists of entries from the validation list, respectively. - * - * @return com.ibm.as400.access.AS400Structure - */ -private AS400Structure getListInfoStruct() { - if (listInfo_ == null) - listInfo_ = new AS400Structure( - new AS400DataType[] { - new AS400Bin4(), // Total records - new AS400Bin4(), // Records returned - new AS400ByteArray(4), // Request handle - new AS400Bin4(), // Record length - new AS400Text(1, as400_), // Info complete indicator - new AS400ByteArray(13), // Date/time created (unconverted) - new AS400Text(1, as400_), // List status indicator - new AS400ByteArray(1), // Reserved - new AS400Bin4(), // Length of info returned - new AS400Bin4() // First record in buffer - }); - return listInfo_; -} -/** - * Retrieve the next group of entries from the buffered list. - *

- * The list is opened by the initial call to the list API. In doing so, the entire - * contents of the list is retrieved as a snapshot and stored in a buffer on the - * IBM i system. The list contents can then be retrieved from the pre-filled - * buffer, in whole or in part, at the convenience of the application by using a - * system-provided handle. The handle is used to close the list when the - * application has completed processing of all entries. - *

- * This method accepts the handle and starting position for retrieving the next - * group of entries. All entries retrieved are stored in the list, and the - * number of entries retrieved is returned. - *

- * The current implementation calls for all remaining entries to be retrieved in one - * pass. If necessary, however, this method could be called multiple times as - * necessary to fill in the remaining list items. - * - * @param listHandle - * byte[] - * @param listPosition - * int - * @param list - * ValidationListEntry[] - * @return - * The number of entries retrieved. - * @exception PersistenceException - * If an error occurs while calling the IBM i APIs. - */ -private int getNextEntries(byte[] listHandle, int listPosition, ValidationListEntry[] list) throws PersistenceException { - int recordsToReturn = list.length - listPosition; - int recordsReturned = 0; - - if (recordsToReturn > 0) { - ProgramCall pgm = new ProgramCall(getAS400()); - ProgramParameter[] parmList = new ProgramParameter[7]; - - // Try & retrieve all remaining entries in a single call; keeps it simple for now - int bufferLength = LISTBUFFER_LENGTH_NEXT; - try { - pgm.setProgram(QSYSObjectPathName.toPath("QGY", "QGYGTLE", "PGM"), parmList); - } catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - - // Refer to documentation for the QGYGTLE generic list API for a complete description of parameters - parmList[0] = new ProgramParameter(bufferLength); - parmList[1] = new ProgramParameter(new AS400Bin4().toBytes(bufferLength)); - parmList[2] = new ProgramParameter(listHandle); - parmList[3] = new ProgramParameter(getListInfoStruct().getByteLength()); - parmList[4] = new ProgramParameter(new AS400Bin4().toBytes(recordsToReturn)); - parmList[5] = new ProgramParameter(new AS400Bin4().toBytes(listPosition+1)); // 1-based - parmList[6] = new ProgramParameter(new AS400Bin4().toBytes(0)); - - runProgram(pgm); - - Object[] listInfo = (Object[])getListInfoStruct().toObject(parmList[3].getOutputData()); - recordsReturned = ((Integer)listInfo[1]).intValue(); - parseEntries(list, listPosition, parmList[0].getOutputData(), recordsReturned); - } - return recordsReturned; -} -/** - * Returns the number of entries in the validation list. - * - * @exception PersistenceException - * If an error occurs while calling the IBM i APIs. - */ -public int getNumberOfEntries() throws PersistenceException { - ProgramCall pgm = new ProgramCall(getAS400()); - ProgramParameter[] parmList = new ProgramParameter[7]; - int bufferLength = 512; - try { - pgm.setProgram(QSYSObjectPathName.toPath("QGY", "QSYOLVLE", "PGM"), parmList); - } catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - - // Refer to documentation for the QSYOLVLE Security API for a complete description of parameters - parmList[0] = new ProgramParameter(bufferLength); - parmList[1] = new ProgramParameter(new AS400Bin4().toBytes(bufferLength)); - parmList[2] = new ProgramParameter(getListInfoStruct().getByteLength()); - parmList[3] = new ProgramParameter(new AS400Bin4().toBytes(-1)); // List is built synchronously - parmList[4] = new ProgramParameter(new AS400Text(8, getAS400()).toBytes("VLDE0100")); - parmList[5] = getQualifiedNameParm(); - parmList[6] = new ProgramParameter(new AS400Bin4().toBytes(0)); - - // Open the list - runProgram(pgm); - - // Retrieve list information - Object[] listInfo = (Object[])getListInfoStruct().toObject(parmList[2].getOutputData()); - - // Close the list - closeList((byte[])listInfo[2]); - - // Return the retrieved info - return ((Integer)listInfo[0]).intValue(); -} -/** - * Returns the location (library context) of the validation list. - * - * @return com.ibm.as400.access.QSYSObjectPathName - */ -public QSYSObjectPathName getPath() { - return path_; -} -/** - * Returns a program parameter to be used for IBM i Toolbox program calls that - * require the qualifed name of the validation list. - *

- * The object name is set into the first 10 bytes of the parameter value. - * The library name is set into the next 10 bytes of the parameter value. - * - * @return com.ibm.as400.access.ProgramParameter - */ -protected ProgramParameter getQualifiedNameParm() { - StringBuffer buffer = new StringBuffer(" "); - - fillStringBuffer(buffer, 0, getPath().getObjectName()); - fillStringBuffer(buffer, 10, getPath().getLibraryName()); - - return new ProgramParameter( - ProgramParameter.PASS_BY_REFERENCE, - new AS400Text(20, getAS400()).toBytes(buffer.toString())); -} -/** - * Returns the structure used to parse entries returned by the list APIs. - *

- * This structure is referenced when parsing entries returned by calls to the - * QSYOLVLE and QGYGTLE APIs. - * - * @return com.ibm.as400.access.AS400Structure - */ -private AS400Structure getVlde0100Struct() { - if (vlde0100_ == null) - vlde0100_ = new AS400Structure( - new AS400DataType[] { - new AS400Bin4(), // Length of entry - new AS400Bin4(), // Displacement to entry ID - new AS400Bin4(), // Length of entry ID - new AS400Bin4(), // CCSID of entry ID - new AS400Bin4(), // Displacement to encrypted data - new AS400Bin4(), // Length of encrypted data - new AS400Bin4(), // CCSID of encrypted data - new AS400Bin4(), // Displacement to entry data - new AS400Bin4(), // Length of entry data - new AS400Bin4() // CCSID of entry data - }); - return vlde0100_; -} -/** - * Handles an unexpected exception that was caught as the result of invoking an IBM i - * API or command. The exception is wrapped and surfaced as a PersistenceException. - * - * @exception PersistenceException - */ -private void handleUnexpectedAS400Exception(Throwable e) throws PersistenceException { - throw new PersistenceException(e); -} -/** - * Handles unexpected messages that was received as the result of invoking an IBM i - * API or command. The messages are wrapped and surfaced as a PersistenceException. - * - * @exception PersistenceException - */ -private void handleUnexpectedAS400Messages(AS400Message[] messages) throws PersistenceException { - throw new PersistenceException(messages); -} -/** - * Parse the validation list entries from the raw (IBM i) bytes of a specified buffer. - *

- * Beginning with the specified start position, the parsed bytes are inserted - * as ValidationListEntry objects into the list. The list is assumed to be - * large enough to contain all the parsed entries. The buffer is assumed - * to contain numberInBuffer entries. - * - * @param list - * ValidationListEntry[] - * @param start - * int - * @param buffer - * byte[] - * @param numberInBuffer - * int - */ -private void parseEntries( - ValidationListEntry[] list, - int start, - byte[] buffer, - int numberInBuffer) -{ - int position = 0; - for (int i=0; i - * Beginning with the specified start position, bytes are returned - * from the buffer up to the given length. - * - * @param buffer byte[] - * @param position int - * @param length int - * @return byte[] - */ -private byte[] parseEntryData(byte[] buffer, int start, int length) { - byte[] bytes = new byte[length]; - System.arraycopy(buffer, start, bytes, 0, length); - return bytes; -} -/** - * Deletes the entry from the validation list. - *

- * Note: The AS400 and Path properties must be set prior to calling - * this method. - * - * @param entry - * ValidationListEntry - * @exception PersistenceException - * If an error occurs while calling the IBM i validation list APIs. - */ -public void removeEntry(ValidationListEntry entry) throws PersistenceException { - ProgramCall pgm = new ProgramCall(getAS400()); - ProgramParameter[] parmList = new ProgramParameter[3]; - - // Refer to documentation for the QSYRMVLE Security API for a complete description of parameters - try { - pgm.setProgram(QSYSObjectPathName.toPath("QSYS", "QSYRMVLE", "PGM"), parmList); - } catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - - parmList[0] = getQualifiedNameParm(); - parmList[1] = new ProgramParameter(entry.getEntryID().toBytes()); - parmList[2] = new ProgramParameter(new AS400Bin4().toBytes(0)); - - runProgram(pgm); -} -/** - * Run the given IBM i command. - * - * @param c - * com.ibm.as400.access.CommandCall - * @exception PersistenceException - * If the command is not successful or an unexpected exception occurs. - */ -private void runCommand(CommandCall c) throws PersistenceException { - boolean success = false; - try {success = c.run();} - catch (Exception e) { handleUnexpectedAS400Exception(e); } - if (!success) - handleUnexpectedAS400Messages(c.getMessageList()); -} -/** - * Run the given IBM i program call. - * - * @param p - * com.ibm.as400.access.ProgramCall - * @exception PersistenceException - * If the command is not successful or an unexpected exception occurs. - */ -private void runProgram(ProgramCall p) throws PersistenceException { - // Try up to 5 times if object is locked (message CPF9803) - int i = 0; - boolean success = false; - boolean lockedObj = false; - PersistenceException err; - do { - try { - success = false; - lockedObj = false; - err = null; - - // Pause (if not first time through the loop) - try { - if (i > 0) Thread.sleep(5000); - } catch (InterruptedException ie) {} - - // Run the program - try { - success = p.run(); - } catch (Exception e) { - handleUnexpectedAS400Exception(e); - } - - if (!success) { - // Check available messages on the program call - AS400Message[] msgs = p.getMessageList(); - if (msgs != null) - for (int j = 0; !lockedObj && j 0) Thread.sleep(5000); } - catch (InterruptedException ie) {}; - - // Run the service program - runProgram(spc); - errno = (spc.getReturnValueFormat() == ServiceProgramCall.RETURN_INTEGER - && spc.getIntegerReturnValue() == 0) - ? 0 - : spc.getErrno(); - } while (++i < 5 && errno == 3406); - - // Check for abnormal error condition - if (errno == 0) - return; - PersistenceException pe = new PersistenceException( - new StringBuffer("Procedure named " - ).append(spc.getProcedureName() - ).append(" failed with errorno " - ).append(errno - ).toString()); - throw pe; -} -/** - * Sets the IBM i system containing the validation list. - * - * @param as400 com.ibm.as400.access.AS400 - */ -public void setAS400(AS400 as400) { - as400_ = as400; -} -/** - * Sets the text description for the validation list object. - *

- * Note: Only recognized if set prior to invoking the create() method. - * - * @param s java.lang.String - */ -public void setDescription(String s) { - description_ = s; -} -/** - * Sets the location (library context) of the validation list. - * - * @param path com.ibm.as400.access.QSYSObjectPathName - */ -public void setPath(QSYSObjectPathName path) { - path_ = path; -} -/** - * Verify that the encrypted information specified for the given entry is correct. - *

- * The EntryID and DataToEncrypt must be specified for the entry prior - * to verification. Returns true if the data to encrypt matches the data already - * encrypted for the entry at that ID on the IBM i; otherwise returns false. - * - * @param entry - * ValidationListEntry - * @return boolean - * @exception PersistenceException - * If an error occurs while calling the IBM i APIs. - */ -public boolean verifyEntry(ValidationListEntry entry) throws PersistenceException { - // Note: length of ID & data to encrypt must be in range accepted by API - int len = entry.getDataToEncrypt().getBytes().length; - if (len < 1 || len > 600) - return false; - len = entry.getEntryID().getBytes().length; - if (len < 1 || len > 100) - return false; - - // Create & prime the program parameters - ProgramParameter[] parmList = new ProgramParameter[3]; - parmList[0] = getQualifiedNameParm(); - parmList[1] = new ProgramParameter( - ProgramParameter.PASS_BY_REFERENCE, entry.getEntryID().toBytes()); - parmList[2] = new ProgramParameter( - ProgramParameter.PASS_BY_REFERENCE, entry.getDataToEncrypt().toBytes()); - ServiceProgramCall sPGMCall = new ServiceProgramCall(getAS400()); - - // Refer to documentation for the QsyVerifyValidationLstEntry Security API for a complete description of parameters - try { - sPGMCall.setProgram("/QSYS.LIB/QSYVLDL.SRVPGM", parmList); - sPGMCall.setProcedureName("QsyVerifyValidationLstEntry"); - sPGMCall.setReturnValueFormat(ServiceProgramCall.RETURN_INTEGER); - } catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - - runServiceProgram(sPGMCall); - return sPGMCall.getIntegerReturnValue() == 0; -} -} diff --git a/cvsroot/contrib/com/ibm/as400/access/ValidationListAttribute.java b/cvsroot/contrib/com/ibm/as400/access/ValidationListAttribute.java deleted file mode 100644 index 5e888c8f3..000000000 --- a/cvsroot/contrib/com/ibm/as400/access/ValidationListAttribute.java +++ /dev/null @@ -1,369 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ValidationListAttribute.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2001-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * Represents an attribute assigned to an - * entry in a validation list. Each validation list entry may contain one or more - * attributes. For each attribute, there is an associated value. - * - * @author Thomas Johnson (tom.johnson@kingland.com), Kingland Systems Corporation - */ -public class ValidationListAttribute { - - private AS400 as400_ = null; - private AS400Structure attribEntry_ = null; - private ValidationListAttributeData data_ = null; - private String identifier_ = null; - private int maxValueLength_ = 1; - private int location_ = 0; - private int type_ = 0; -/** - * Constructs a validation list attribute. - */ -public ValidationListAttribute() { - super(); -} -/** - * Constructs a validation list attribute. - *

- * The as400 is used to translate the assigned identifier when converted - * to IBM i bytes. - * - * @param as400 - * com.ibm.as400.access.AS400 - */ -public ValidationListAttribute(AS400 as400) { - this(); - setAS400(as400); -} -/** - * Returns the system assigned to the attribute. - *

- * Used to translate the assigned identifier when converted to IBM i bytes. - * - * @return com.ibm.as400.access.AS400 - */ -public AS400 getAS400() { - return as400_; -} -/** - * Returns the attribute's parameter structure when written to IBM i bytes. - *

- * This structure includes only the fixed fields for the parameter. - * - * @return com.ibm.as400.access.AS400Structure - */ -private AS400Structure getAttribEntryStruct() { - if (attribEntry_ == null) - attribEntry_ = new AS400Structure( - new AS400DataType[] { - new AS400Bin4(), // Length of entry - new AS400Bin4(), // Location - new AS400Bin4(), // Type - new AS400Bin4(), // Displacement to identifier - new AS400Bin4() // Length of identifier - }); - return attribEntry_; -} -/** - * Returns the total length of the corresponding structure when this object is - * written to IBM i bytes for use by the validation list APIs. - *

- * The size varies based on usage of the receiver. If there is no associated data, - * it is assumed that the structure being written is to identify an attribute - * to be retrieved (eg. find an entry). If there is associated data, it is assumed - * the structure will be used when adding a new entry or changing an existing - * entry. - * - * @return int - */ -public int getByteLength() { - ValidationListTranslatedData data = getData(); - - // start with the length of all fixed fields for the struct. - // if data is null, assume bytes are to be written for an operation to retrieve the data. - // refer to QSYADVLE/QSYCHVLE/QSYFDVLE doc for structure definition. - int total = (data == null) ? 24 : 28; - - // add variable length of attribute identifier - total += getIdentifier().length(); - - // if applicable, add variable length of attribute data - if (data != null) - total += data.getByteLength(); - - // return nearest multiple of 4 - int mod = total % 4; - if (mod > 0) - total += (4-mod); - return total; -} -/** - * Returns the data associated with the attribute. - *

- * This value is required when the attribute is referenced to add a new entry or change - * an existing entry. It should not be set when the attribute is used to identify - * values to retrieve (eg. when finding an entry). - * - * @return ValidationListAttributeData - */ -public ValidationListAttributeData getData() { - return data_; -} -/** - * Returns the identifier of the attribute. - *

- * For system-defined attributes, the allowed values are: - *

    - *
  • QsyEncryptData - Associated with the data to encrypt. - *

    - * If the QsyEncryptData attribute is set to 0, the data to be encrypted can only - * be used to verify an entry and cannot be retrieved later. This is the default. - *

    - * If the attribute is set to 1, the data to be encrypted can be used to verify an entry - * and can potentially be returned on a find operation. The system value QRETSVRSEC - * (Retain system security data) has the final say in determining if the data can be - * retrieved from the entry. If the system value is set to 0 (Do not retain data), the - * entry will be added, but the data to be encrypted will not be stored with the entry - * and cannot be retrieved. If the system value is set to 1 (Retain data), - * then the data to be encrypted will be stored (in encrypted form) with the entry - * and can be retrieved. - *

- * - * @return java.lang.String - */ -public String getIdentifier() { - return identifier_; -} -/** - * Indicates where the attribute should be stored. The allowed values are: - *
    - *
  • 0 - The attribute is stored in the validation list object. - *
- * - * @return int - */ -public int getLocation() { - return location_; -} -/** - * Returns the maximum length of the value associated with the attribute. - *

- * This value is referenced when invoking APIs that need to indicate a - * length for the buffer used to retrieve the attribute value. - * - * @return int - */ -public int getMaximumValueLength() { - return maxValueLength_; -} -/** - * Returns the attribute type. The allowed values are: - *

    - *
  • 0 - This is a system-defined attribute. - *
- * - * @return int - */ -public int getType() { - return type_; -} -/** - * Sets the system assigned to the attribute. - *

- * Used to translate the assigned identifier when converted to IBM i bytes. - * - * @param as400 com.ibm.as400.access.AS400 - */ -public void setAS400(AS400 as400) { - as400_ = as400; -} -/** - * Sets the data associated with the attribute. - *

- * This value is required when the attribute is referenced to add a new entry or change - * an existing entry. It should not be set when the attribute is used to identify - * values to retrieve (eg. when finding an entry). - * - * @param data - * ValidationListAttributeData - */ -public void setData(ValidationListAttributeData data) { - data_ = data; -} -/** - * Sets the identifier of the attribute. - *

- * For system-defined attributes, the allowed values are: - *

    - *
  • QsyEncryptData - Associated with the data to encrypt. - *

    - * If the QsyEncryptData attribute is set to 0, the data to be encrypted can only - * be used to verify an entry and cannot be retrieved later. This is the default. - *

    - * If the attribute was set to 1, the data to be encrypted can be used to verify an entry - * and can potentially be returned on a find operation. The system value QRETSVRSEC - * (Retain system security data) has the final say in determining if the data can be - * retrieved from the entry. If the system value is set to 0 (Do not retain data), the - * entry will be added, but the data to be encrypted will not be stored with the entry - * and cannot be retrieved. If the system value is set to 1 (Retain data), - * then the data to be encrypted will be stored (in encrypted form) with the entry - * and can be retrieved. - *

- * - * @param s java.lang.String - */ -public void setIdentifier(String s) { - identifier_ = s; -} -/** - * Indicates where the attribute should be stored. The allowed values are: - *
    - *
  • 0 - The attribute is stored in the validation list object. - *
- * - * @param location int - */ -public void setLocation(int location) { - location_ = location; -} -/** - * Sets the maximum length of the value associated with the attribute. - *

- * This value is referenced when invoking APIs that need to indicate a - * length for the buffer used to retrieve the attribute value. - * - * @param length int - */ -public void setMaximumValueLength(int length) { - maxValueLength_ = length; -} -/** - * Returns the attribute type. The allowed values are: - *

    - *
  • 0 - This is a system-defined attribute. - *
- * - * @param type int - */ -public void setType(int type) { - type_ = type; -} -/** - * Returns the byte array resulting from converting this object to a structure - * usable by the system APIs. - * - * @return byte[] - */ -public byte[] toBytes() { - byte[] buffer = - new byte[getByteLength()]; - toBytes(buffer, 0); - return buffer; -} -/** - * Converts this object to a structure usable by the system APIs. - *

- * The IBM i bytes are inserted into the buffer starting at the given - * offset. The total number of bytes inserted is returned. - * - * @param buffer byte[] - * @param offset int - * @return int - */ -public int toBytes(byte[] buffer, int offset) { - // check if data has been filled in for the attribute - // if not, assume bytes being written are for an operation to retrieve the data - if (getData() == null) - return toBytesNoData(buffer, offset); - - // offset in structure for the attribute id (refer to QSYADVLE/QSYCHVLE doc) - int struct_offset_id = 28; - // length of attribute id; currently assumes sbcs - int struct_length_id = getIdentifier().length(); - // total length of attribute entry; must be multiple of 4 - int struct_total_len = getByteLength(); - - // declare objects for common fixed position fields - Integer[] fixedData = { - new Integer(struct_total_len), // total length - new Integer(getLocation()), // attribute location - new Integer(getType()), // attribute type - new Integer(struct_offset_id), // displacement to identifier - new Integer(struct_length_id) // length of identifier - }; - - int position = offset; - - // write common fixed position fields - position += getAttribEntryStruct().toBytes(fixedData, buffer, position); - // write displacement of attribute data - position += new AS400Bin4().toBytes( - struct_offset_id + struct_length_id, buffer, position); - // write length of attribute data - position += new AS400Bin4().toBytes( - getData().getByteLength(), buffer, position); - // write attribute identifier - position += new AS400Text(struct_length_id, getAS400()).toBytes( - getIdentifier(), buffer, position); - // write attribute data - position += getData().toBytes(buffer, position); - - return struct_total_len; -} -/** - * Converts the attribute and any associated data to a structure usable by the - * system APIs. - *

- * The IBM i bytes are inserted into the buffer starting at the given - * offset. The total number of bytes inserted is returned. - *

- * This method writes the bytes in a format expected when the attribute data is - * currently unknown and expected to be retrieved into another buffer by the - * API call. No attribute data is included. - * - * @return int - */ -private int toBytesNoData(byte[] buffer, int offset) { - // offset in structure for the attribute id (refer to QSYFVLE doc) - int struct_offset_id = 24; - // length of attribute id; currently assumes sbcs - int struct_length_id = getIdentifier().length(); - // total length of attribute entry; must be multiple of 4 - int struct_total_len = getByteLength(); - - // declare objects for common fixed position fields - Integer[] fixedData = { - new Integer(struct_total_len), // total length - new Integer(getLocation()), // attribute location - new Integer(getType()), // attribute type - new Integer(struct_offset_id), // displacement to identifier - new Integer(struct_length_id) // length of identifier - }; - - int position = offset; - - // write common fixed position fields - position += getAttribEntryStruct().toBytes(fixedData, buffer, position); - // write # bytes to be provided for the attribute in receiver buffer - position += new AS400Bin4().toBytes( - 24 + getMaximumValueLength(), buffer, position); // 24 is from QSYFDVLE API doc - // write attribute identifier - position += new AS400Text(struct_length_id, getAS400()).toBytes( - getIdentifier(), buffer, position); - - return struct_total_len; -} -} diff --git a/cvsroot/contrib/com/ibm/as400/access/ValidationListAttributeData.java b/cvsroot/contrib/com/ibm/as400/access/ValidationListAttributeData.java deleted file mode 100644 index 1c9adc82e..000000000 --- a/cvsroot/contrib/com/ibm/as400/access/ValidationListAttributeData.java +++ /dev/null @@ -1,70 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ValidationListAttributeData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2001-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * Represents the value of a validation - * list attribute. Each validation list entry may contain one or more attributes. - * For each attribute, there is an associated value. This class models - * the value. The same information is present as in the superclass - * ValidationListTranslatedData, but the order and location of - * the information in the corresponding API structures differ. - * - * @author Thomas Johnson (tom.johnson@kingland.com), Kingland Systems Corporation - */ -public class ValidationListAttributeData extends ValidationListTranslatedData { - -/** - * Constructs a ValidationListTranslatedData. - */ -public ValidationListAttributeData() { - super(); -} -/** - * Constructs a ValidationListTranslatedData from a structure stored as IBM i bytes. - *

- * The offset indicates the starting position of the structure in the - * given buffer. - * - * @param buffer byte[] - * @param offset int - */ -public ValidationListAttributeData(byte[] buffer, int offset) { - super(buffer, offset); -} -/** - * Returns the offset of CCSID information in the structure when the receiver - * is written to IBM i bytes. - * @return int - */ -protected int getWriteOffsetCcsid() { - return 0; -} -/** - * Returns the offset of the length of the translated bytes when the receiver - * is written to an IBM i byte structure. - * @return int - */ -protected int getWriteOffsetTByteLength() { - return 4; -} -/** - * Returns the offset of the translated bytes when the receiver is written to an - * IBM i byte structure. - * @return int - */ -protected int getWriteOffsetTBytes() { - return 16; -} -} diff --git a/cvsroot/contrib/com/ibm/as400/access/ValidationListAttributeInfo.java b/cvsroot/contrib/com/ibm/as400/access/ValidationListAttributeInfo.java deleted file mode 100644 index 6df6cc7f9..000000000 --- a/cvsroot/contrib/com/ibm/as400/access/ValidationListAttributeInfo.java +++ /dev/null @@ -1,145 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ValidationListAttributeInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2001-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * Encapsulates all attribute information - * assigned to an entry in a validation list. Each validation list entry may contain - * one or more attributes. - * - * @author Thomas Johnson (tom.johnson@kingland.com), Kingland Systems Corporation - */ -public class ValidationListAttributeInfo { - - private ValidationListAttribute[] attributes_ = null; -/** - * Constructs a ValidationListAttributeInfo. - */ -public ValidationListAttributeInfo() { - super(); -} -/** - * Constructs a ValidationListAttributeInfo with the given attributes. - * - * @param attributes - * ValidationListAttribute[] - */ -public ValidationListAttributeInfo(ValidationListAttribute[] attributes) { - super(); - setAttributes(attributes); -} -/** - * Returns the attributes assigned to the receiver. - * - * @return ValidationListAttribute[] - */ -public ValidationListAttribute[] getAttributes() { - if (attributes_ == null) - attributes_ = new ValidationListAttribute[0]; - return attributes_; -} -/** - * Returns the total length of the corresponding structure when this object is - * written to IBM i bytes for use by the validation list APIs. - * - * @return int - */ -public int getByteLength() { - int total = 4; - for(int i = 0; i < getAttributes().length; i++) - total += getAttributes()[i].getByteLength(); - return total; -} -/** - * Returns the total length of the corresponding structure when this object is - * written to IBM i bytes for use by the validation list APIs. - * - * @return int - */ -public int getByteLengthForNativeCall() { - int total = 4; // Number of attributes - total += 12; // Reserved - for(int i = 0; i < getAttributes().length; i++) - total += getAttributes()[i].getByteLength(); - return total; -} -/** - * Sets the attributes assigned to the receiver. - * - * @param attributes - * ValidationListAttribute[] - */ -public void setAttributes(ValidationListAttribute[] attributes) { - attributes_ = attributes; -} -/** - * Sets the data for assigned attributes from the IBM i bytes in the specified buffer. - *

- * This method is called when finding an entry with specific attributes. The attribute identifiers - * are provided as input to the API, and a buffer is returned with the corresponding - * attribute values. It is expected that this object was also used to specify the attributes - * to retrieve. That way, the contents and order of attribute values in the buffer should - * exactly match those assigned to this object. - *

- * Refer to documentation for the QSYFDVLE Security API for a complete description of parameters. - * - * @param buffer byte[] - * @param offset int - */ -public void setAttributesData(byte[] buffer, int offset) { - ValidationListAttribute[] attribs = getAttributes(); - - int entrySize; // total size of the entry for a single attribute in the struct - int dataStructOffset = 12; // from struct defined for output attribute in QSYFDVLE doc - int position = offset; // current position in the buffer - - for (int i = 0; i < attribs.length; i++) { - entrySize = new AS400Bin4().toInt(buffer, position); - attribs[i].setData(new ValidationListAttributeData(buffer, position+dataStructOffset)); - position += entrySize; - } -} -/** - * Returns the byte array resulting from converting this object to a structure - * usable by the system APIs. - * - * @return byte[] - */ -public byte[] toBytes() { - byte[] buffer = - new byte[getByteLength()]; - toBytes(buffer, 0); - return buffer; -} -/** - * Converts this object to a structure usable by the system APIs. - *

- * The IBM i bytes are inserted into the buffer starting at the given - * offset. The total number of bytes inserted is returned. - * - * @param buffer byte[] - * @param offset int - * @return int - */ -public int toBytes(byte[] buffer, int offset) { - // write number of attributes - new AS400Bin4().toBytes(getAttributes().length, buffer, offset); - int position = offset + 4; - - // write attributes - for (int i = 0; i < getAttributes().length; i++) - position += getAttributes()[i].toBytes(buffer, position); - return position; -} -} diff --git a/cvsroot/contrib/com/ibm/as400/access/ValidationListDataToEncrypt.java b/cvsroot/contrib/com/ibm/as400/access/ValidationListDataToEncrypt.java deleted file mode 100644 index 0a3208204..000000000 --- a/cvsroot/contrib/com/ibm/as400/access/ValidationListDataToEncrypt.java +++ /dev/null @@ -1,86 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ValidationListDataToEncrypt.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2001-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * Used to specify the data to - * encrypt when adding or changing a validation list entry. - * - * @author Thomas Johnson (tom.johnson@kingland.com), Kingland Systems Corporation - */ -public class ValidationListDataToEncrypt extends ValidationListTranslatedData { - -/** - * Constructs a ValidationListDataToEncrypt. - */ -public ValidationListDataToEncrypt() { - super(); -} -/** - * Constructs a ValidationListDataToEncrypt from a structure stored as IBM i bytes. - *

- * The offset indicates the starting position of the structure in the - * given buffer. - * - * @param buffer byte[] - * @param offset int - */ -public ValidationListDataToEncrypt(byte[] buffer, int offset) { - super(buffer, offset); -} -/** - * Constructs a ValidationListDataToEncrypt from the specified IBM i bytes - * which are encoded in the given ccsid. - * - * @param ccsid int - * @param bytes byte[] - */ -public ValidationListDataToEncrypt(int ccsid, byte[] bytes) { - super(ccsid, bytes); -} -/** - * Constructs a ValidationListDataToEncrypt from the given string. - *

- * The translated bytes are derived by converting the string to IBM i bytes - * using the given ccsid. The as400 is required to perform the - * conversion from text to bytes. A ccsid of 0 indicates to use the ccsid - * of the current user. - * - * @param s java.lang.String - * @param ccsid int - * @param as400 com.ibm.as400.access.AS400 - */ -public ValidationListDataToEncrypt(String s, int ccsid, AS400 as400) { - super(s, ccsid, as400); -} -/** - * Returns the length to be specified in the written IBM i byte structure - * if the assigned data is null. - *

- * Typically this value is 0. However, there are some cases where - * other values must be returned to maintain proper behavior. For - * example, when changing an entry a structure must be specified for the - * data to encrypt, even if the encrypted data should not be changed. - * However, if the data length in the structure is set to 0 instead of -1, - * the existing encrypted data is wiped out. This is undesirable since - * we don't always want the encrypted data changed. We might want to - * modify the unencrypted data (i.e. user statistics) while leaving - * the encrypted data (i.e. user password) unchanged. - * - * @return int - */ -protected int getWriteNullDataLength() { - return -1; -} -} diff --git a/cvsroot/contrib/com/ibm/as400/access/ValidationListEntry.java b/cvsroot/contrib/com/ibm/as400/access/ValidationListEntry.java deleted file mode 100644 index fcb9bc27a..000000000 --- a/cvsroot/contrib/com/ibm/as400/access/ValidationListEntry.java +++ /dev/null @@ -1,221 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ValidationListEntry.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2001-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * Represents an entry in a system validation list. - * - * @author Thomas Johnson (tom.johnson@kingland.com), Kingland Systems Corporation - */ -public class ValidationListEntry { - - private ValidationListTranslatedData entryID_ = null; - private ValidationListTranslatedData encryptedData_ = null; - private ValidationListTranslatedData unencryptedData_ = null; - private ValidationListDataToEncrypt dataToEncrypt_ = null; - private ValidationListAttributeInfo attrInfo_ = null; -/** - * Constructs a ValidationListEntry. - */ -public ValidationListEntry() { - super(); -} -/** - * Constructs a ValidationListEntry from a structure stored as IBM i bytes. - *

- * The offset indicates the starting position of the structure - * in the given buffer. - * - * @param buffer byte[] - * @param offset int - */ -public ValidationListEntry(byte[] buffer, int offset) { - this(); - init(buffer, offset); -} -/** - * Returns the object containing all attribute information associated with the entry. - *

- * Attributes and associated values can be assigned by the application prior to - * adding an entry. When finding an entry, the identifiers for attributes to retrieve - * are set by the application prior to the find. The corresponding attribute values - * are filled in as a result of the find operation. - * - * @return ValidationListAttributeInfo - */ -public ValidationListAttributeInfo getAttributeInfo() { - if (attrInfo_ == null) - attrInfo_ = new ValidationListAttributeInfo(); - return attrInfo_; -} -/** - * Returns the total length of the corresponding structure when this object is - * written to IBM i bytes for use by the validation list APIs. - *

- * Note: The length 1724 is dictated by the API definition (i.e. QSYFDVLE). - * - * @return int - */ -public int getByteLength() { - return 1724; -} -/** - * Returns the information to encrypt when the entry is subsequently inserted or updated. - *

- * This differs from the EncryptedData property in that the latter, if present, - * reflects the data currently encrypted for the entry. - *

- * If the QsyEncryptData attribute is set to 0, the data to be encrypted can only - * be used to verify an entry and cannot be retrieved later. This is the default. - *

- * If the attribute was set to 1, the data to be encrypted can be used to verify an entry - * and can potentially be returned on a find operation. The system value QRETSVRSEC - * (Retain system security data) has the final say in determining if the data can be - * retrieved from the entry. If the system value is set to 0 (Do not retain data), the - * entry will be added, but the data to be encrypted will not be stored with the entry - * and cannot be retrieved. If the system value is set to 1 (Retain data), - * then the data to be encrypted will be stored (in encrypted form) with the entry - * and can be retrieved. - * - * @return ValidationListDataToEncrypt - */ -public ValidationListDataToEncrypt getDataToEncrypt() { - if (dataToEncrypt_ == null) - dataToEncrypt_ = new ValidationListDataToEncrypt(); - return dataToEncrypt_; -} -/** - * Returns the information currently encrypted for the entry in the validation list. - *

- * Note: The encrypted data may or may not be retrievable based on the value set - * for the QsyEncryptData attribute when the entry was inserted. - * - * @return ValidationListTranslatedData - * @see #getDataToEncrypt - */ -public ValidationListTranslatedData getEncryptedData() { - if (encryptedData_ == null) - encryptedData_ = new ValidationListTranslatedData(); - return encryptedData_; -} -/** - * Returns the translated data containing the entry identifier. - * - * @return ValidationListTranslatedData - */ -public ValidationListTranslatedData getEntryID() { - if (entryID_ == null) - entryID_ = new ValidationListTranslatedData(); - return entryID_; -} -/** - * Returns the unencrypted data for the entry. - * - * @return ValidationListTranslatedData - */ -public ValidationListTranslatedData getUnencryptedData() { - if (unencryptedData_ == null) - unencryptedData_ = new ValidationListTranslatedData(); - return unencryptedData_; -} -/** - * Initialize a ValidationListEntry from a structure stored as IBM i bytes. - *

- * The offset indicates the starting position of the structure - * in the given buffer. - * - * @param buffer byte[] - * @param offset int - */ -public void init(byte[] buffer, int offset) { - // offset to non-encrypted data - int struct_offset_data = 716; - // offset to encrypted data - int struct_offset_encrypted = 108; - // offset to identifier data - int struct_offset_id = 0; - - setEntryID(new ValidationListTranslatedData(buffer, offset + struct_offset_id)); - setEncryptedData(new ValidationListTranslatedData(buffer, offset + struct_offset_encrypted)); - setUnencryptedData(new ValidationListTranslatedData(buffer, offset + struct_offset_data)); -} -/** - * Sets the object containing all attribute information associated with the entry. - *

- * Attributes and associated values can be assigned by the application prior to - * adding an entry. When finding an entry, the identifiers for attributes to retrieve - * are set by the application prior to the find. The corresponding attribute values - * are filled in as a result of the find operation. - * - * @param info - * ValidationListAttributeInfo - */ -public void setAttributeInfo(ValidationListAttributeInfo info) { - attrInfo_ = info; -} -/** - * Sets the information to encrypt when the entry is subsequently inserted or updated. - *

- * This differs from the EncryptedData property in that the latter, if present, - * reflects the data currently encrypted for the entry. - *

- * If the QsyEncryptData attribute is set to 0, the data to be encrypted can only - * be used to verify an entry and cannot be retrieved later. This is the default. - *

- * If the attribute was set to 1, the data to be encrypted can be used to verify an entry - * and can potentially be returned on a find operation. The system value QRETSVRSEC - * (Retain system security data) has the final say in determining if the data can be - * retrieved from the entry. If the system value is set to 0 (Do not retain data), the - * entry will be added, but the data to be encrypted will not be stored with the entry - * and cannot be retrieved. If the system value is set to 1 (Retain data), - * then the data to be encrypted will be stored (in encrypted form) with the entry - * and can be retrieved. - * - * @param dataToEncrypt - * ValidationListDataToEncrypt - */ -public void setDataToEncrypt(ValidationListDataToEncrypt dataToEncrypt) { - dataToEncrypt_ = dataToEncrypt; -} -/** - * Sets the information currently encrypted for the entry in the validation list. - *

- * Note: The encrypted data may or may not be retrievable based on the value set - * for the QsyEncryptData attribute when the entry was inserted. - * - * @param encryptedData - * ValidationListTranslatedData - */ -public void setEncryptedData(ValidationListTranslatedData encryptedData) { - encryptedData_ = encryptedData; -} -/** - * Sets the translated data containing the entry identifier. - * - * @param entryID - * ValidationListTranslatedData - */ -public void setEntryID(ValidationListTranslatedData entryID) { - entryID_ = entryID; -} -/** - * Sets the unencrypted data for the entry. - * - * @param data - * ValidationListTranslatedData - */ -public void setUnencryptedData(ValidationListTranslatedData data) { - unencryptedData_ = data; -} -} diff --git a/cvsroot/contrib/com/ibm/as400/access/ValidationListTranslatedData.java b/cvsroot/contrib/com/ibm/as400/access/ValidationListTranslatedData.java deleted file mode 100644 index 16f8cc3d4..000000000 --- a/cvsroot/contrib/com/ibm/as400/access/ValidationListTranslatedData.java +++ /dev/null @@ -1,410 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ValidationListTranslatedData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2001-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * Represents language-specific information - * that is assigned in a standardized format to a validation list entry. - * This could be information in the non-encrypted data, encrypted data, or - * identifier portion of a validation list entry. Maximum lengths for each - * are 1000, 600, and 100 bytes, respectively. - * - * @author Thomas Johnson (tom.johnson@kingland.com), Kingland Systems Corporation - */ -public class ValidationListTranslatedData { - - private byte[] bytes_ = null; - private int ccsid_ = 0; -/** - * Constructs a ValidationListTranslatedData. - */ -public ValidationListTranslatedData() { - super(); -} -/** - * Constructs a ValidationListTranslatedData from a structure stored as IBM i bytes. - *

- * The offset indicates the starting position of the structure in the - * given buffer. - * - * @param buffer byte[] - * @param offset int - */ -public ValidationListTranslatedData(byte[] buffer, int offset) { - this(); - - int dataLength =(new AS400Bin4().toInt(buffer, offset + getReadOffsetTByteLength())); - setCcsid(new AS400Bin4().toInt(buffer, offset + getReadOffsetCcsid())); - setBytes((byte[])( - new AS400ByteArray(dataLength).toObject( - buffer, offset + getReadOffsetTBytes()))); -} -/** - * Constructs a ValidationListTranslatedData from the specified IBM i bytes - * which are encoded in the given ccsid. - * - * @param ccsid int - * @param bytes byte[] - */ -public ValidationListTranslatedData(int ccsid, byte[] bytes) { - this(); - setCcsid(ccsid); - setBytes(bytes); -} -/** - * Constructs a ValidationListTranslatedData from the given string. - *

- * The translated bytes are derived by converting the string to IBM i bytes - * using the given ccsid. The as400 is required to perform the - * conversion from text to bytes. A ccsid of 0 indicates to use the ccsid - * of the current user. - * - * @param s java.lang.String - * @param ccsid int - * @param as400 com.ibm.as400.access.AS400 - */ -public ValidationListTranslatedData(String s, int ccsid, AS400 as400) { - this(); - setBytes(s, ccsid, as400); -} -/** - * Returns the total length of the corresponding structure when this object is - * written to IBM i bytes for use by the validation list APIs. - *

- * This is the length of the entire structure, not just the translated bytes. - * - * @return int - */ -public int getByteLength() { - // Assumes variable length data (the translated bytes) will always occur at end - int total = getWriteOffsetTBytes(); - if (getBytes() != null) - total += getBytes().length; - return total; -} -/** - * Returns the IBM i bytes comprising the translated data. - *

- * For text conversion, the bytes will be interpreted using the assigned ccsid. - * - * @return byte[] - */ -public byte[] getBytes() { - return bytes_; -} -/** - * Returns the coded character set identifier used to encode the translated bytes. - *

- * Valid CCSID values are in the range 1 through 65535. The special value 0 - * can be used to indicate the default CCSID for the current user (when - * the validation list APIs are invoked on the system). In some cases, - * primarily attribute data, the special value -1 is also allowed. This - * indicates that no CCSID value is stored with the data (i.e. binary data, - * where no conversion is required). - * - * @return int - */ -public int getCcsid() { - return ccsid_; -} -/** - * Returns the offset of CCSID information in the structure when the receiver is - * read from IBM i bytes. - * @return int - */ -protected int getReadOffsetCcsid() { - return 4; -} -/** - * Returns the offset of the length of the translated bytes when the receiver - * is read from a IBM i byte structure. - * @return int - */ -protected int getReadOffsetTByteLength() { - return 0; -} -/** - * Returns the offset of the translated bytes when the receiver is read from an - * IBM i byte structure. - * @return int - */ -protected int getReadOffsetTBytes() { - return 8; -} -/** - * Returns the result of converting the assigned IBM i bytes to a Java String - * using the assigned CCSID. Returns null if the assigned ccsid is -1, since - * the bytes do not represent text. - *

- * The as400 is required to perform the conversion. - * - * @param as400 com.ibm.as400.access.AS400 - * @return java.lang.String -*/ -public String getString(AS400 as400) { - int ccsid = getCcsid(); - - // check null or non-text value - if (bytes_ == null || ccsid == -1) - return null; - // check unicode; no conversion required - if (ccsid == 13488) - return new String(bytes_); - // check for default ccsid for current user id - if (ccsid == 0) - ccsid = as400.getCcsid(); - - return - (String)new AS400Text(bytes_.length, ccsid, as400).toObject(bytes_); -} -/** - * Returns the length to be specified in the written IBM i byte structure - * if the assigned data is null. - *

- * Typically this value is set to 0. However, there are some cases where - * other values must be specified to maintain proper behavior. For - * example, when changing an entry a structure must be specified for the - * data to encrypt, even if the encrypted data should not be changed. - * However, if the data length in the structure is set to 0 instead of -1, - * the existing encrypted data is wiped out. This is undesirable since - * we don't always want the encrypted data changed. We might want to - * modify the unencrypted data (i.e. user statistics) while leaving - * the encrypted data (i.e. user password) unchanged. - * - * @return int - */ -protected int getWriteNullDataLength() { - return 0; -} -/** - * Returns the offset of CCSID information in the structure when the receiver - * is written to IBM i bytes. - * @return int - */ -protected int getWriteOffsetCcsid() { - return getReadOffsetCcsid(); -} -/** - * Returns the offset of the length of the translated bytes when the receiver - * is written to an IBM i byte structure. - * @return int - */ -protected int getWriteOffsetTByteLength() { - return getReadOffsetTByteLength(); -} -/** - * Returns the offset of the translated bytes when the receiver is written to an - * IBM i byte structure. - * @return int - */ -protected int getWriteOffsetTBytes() { - return getReadOffsetTBytes(); -} -/** - * Indicates whether the given CCSID is valid for tagging IBM i data. - * @return true if valid; false if not. - */ -protected boolean isValidCcsid(int ccsid) { - boolean isValid = false; - switch(ccsid) { - // Universal Character Set (UCS-2 and UTF-8) - case 13488: // UCS-2 Level 1 - - // CCSIDs for EBCDIC Group 1 (Latin-1) Countries - case 37: // USA, Canada (S/370), Netherlands, Portugal, Brazil, Australia, New Zealand - case 256: // Word Processing, Netherlands - case 273: // Austria, Germany - case 277: // Denmark, Norway - case 278: // Finland, Sweden - case 280: // Italy - case 284: // Spain, Latin America (Spanish) - case 285: // United Kingdom - case 297: // France - case 500: // Belgium, Canada (AS/400), Switzerland, International Latin-1 - case 871: // Iceland - case 924: // Latin-0 - case 1140: // USA, Canada (S/370), Netherlands, Portugal, Brazil, Australia, New Zealand - case 1141: // Austria, Germany - case 1142: // Denmark, Norway - case 1143: // Finland, Sweden - case 1144: // Italy - case 1145: // Spain, Latin America (Spanish) - case 1146: // United Kingdom - case 1147: // France - case 1148: // Belgium, Canada (AS/400), Switzerland, International Latin-1 - case 1149: // Iceland - - // CCSIDs for EBCDIC Group 1a (Non-Latin-1 SBCS) Countries - case 420: // Arabic (Type 4)Visual LTR - case 423: // Greek - case 424: // Hebrew(Type 4) - case 870: // Latin-2 Multilingual - case 875: // Greek - case 880: // Cyrillic Multilingual - case 905: // Turkey Latin-3 Multilingual - case 918: // Urdu - case 1025: // Cyrillic Multilingual - case 1026: // Turkey Latin-5 - case 1097: // Farsi - case 1112: // Baltic Multilingual - case 1122: // Estonia - case 1123: // Ukraine - case 8612: // Arabic (Type 5) - case 8616: // Hebrew (Type 6) - case 12708: // Arabic (Type 7) - case 62211: // Hebrew (Type 5) - case 62224: // Arabic (Type 6) - case 62235: // Hebrew (Type 10) - - // SBCS CCSIDs for EBCDIC Group 2 (DBCS) Countries - case 290: // Japan Katakana (extended) - case 833: // Korea (extended) - case 836: // Simplified Chinese (extended) - case 838: // Thailand (extended) - case 1027: // Japan English (extended) - case 1130: // Vietnam - case 1132: // Lao - case 9030: // Thailand (extended) - case 13121: // Korea Windows - case 13124: // Traditional Chinese - case 28709: // Traditional Chinese (extended) - - // DBCS CCSIDs for EBCDIC Group 2 (DBCS) Countries - case 300: // Japan - including 4370 user-defined characters (UDC) - case 834: // Korea - including 1880 UDC - case 835: // Traditional Chinese - including 6204 UDC - case 837: // Simplified Chinese - including 1880 UDC - case 4396: // Japan - including 1880 UDC - case 4930: // Korea Windows - case 4933: // Simplified Chinese - - // Mixed CCSIDs for EBCDIC Group 2 (DBCS) Countries - case 930: // Japan Katakana/Kanji (extended) - including 4370 UDC - case 933: // Korea (extended) - including 1880 UDC - case 935: // Simplified Chinese (extended) - including 1880 UDC - case 937: // Traditional Chinese (extended) - including 4370 UDC - case 939: // Japan English/Kanji (extended) - including 4370 UDC - case 1364: // Korea (extended) - case 1388: // Traditional Chinese - case 5026: // Japan Katakana/Kanji (extended) - including 1880 UDC) - case 5035: // Japan English/Kanji (extended) - including 1880 UDC - isValid = true; - } - return isValid; -} -/** - * Sets the IBM i bytes comprising the translated data. - *

- * For text conversion, the bytes will be interpreted using the assigned ccsid. - * - * @param bytes byte[] - */ -public void setBytes(byte[] bytes) { - bytes_ = bytes; -} -/** - * Sets the bytes comprising the translated data from the given string. - *

- * The translated bytes are derived by converting the string to IBM i bytes - * using the given ccsid. The as400 is required to perform the - * conversion from text to bytes. A ccsid of 0 indicates to use the ccsid - * of the current user. - * - * @param s java.lang.String - * @param ccsid int - * @param as400 com.ibm.as400.access.AS400 - */ -public void setBytes(String s, int ccsid, AS400 as400) { - // if 0, store the current ccsid since it will be used in the conversion - if (ccsid == 0) - ccsid = as400.getCcsid(); - setCcsid(ccsid); - - // check for unicode ccsid (no conversion required) - if (ccsid == 13488) { - setBytes(s.getBytes()); - return; - } - - // assume a maximum buffer of (2 * length of the string) to allow for double-byte - // the buffer will automatically be padded with blanks during conversion - // blanks are then trimmed - int len = s.length() * 2; - byte[] buffer = new AS400Text(len, ccsid, as400).toBytes(s); - while (len > 0) - if (buffer[len-1] != 0x40) break; - else len--; - - byte[] trimmed = new byte[len]; - System.arraycopy(buffer, 0, trimmed, 0, len); - setBytes(trimmed); -} -/** - * Sets the coded character set identifier used to encode the translated bytes. - *

- * Valid CCSID values are in the range 1 through 65535. The special value 0 - * can be used to indicate the default CCSID for the current user (when - * the validation list APIs are invoked on the system). In some cases, - * primarily attribute data, the special value -1 is also allowed. This - * indicates that no CCSID value is stored with the data (i.e. binary data, - * where no conversion is required). - * - * @param ccsid int - */ -public void setCcsid(int ccsid) { - // Note: Compensate for IBM HTTP Internet User tools, which appear to - // sometimes insert entries with invalid CCSID identifiers. - // If not valid, assume 37 as a default. - // CCSIDs <= 0 are sometimes used to indicate special values - // when tagging attribute data, etc. - ccsid_ = (ccsid <= 0 || isValidCcsid(ccsid)) ? ccsid : 37; -} -/** - * Returns the byte array resulting from converting this object to a structure - * usable by the system APIs. - * - * @return byte[] - */ -public byte[] toBytes() { - byte[] buffer = - new byte[getByteLength()]; - toBytes(buffer, 0); - return buffer; -} -/** - * Converts this object to a byte structure usable by the system APIs. - *

- * The IBM i bytes are inserted into the buffer starting at the given - * offset. The total number of bytes inserted is returned. - * - * @param buffer byte[] - * @param offset int - * @return int - */ -public int toBytes(byte[] buffer, int offset) { - byte[] bytes = getBytes(); - int byteLength = (bytes == null) ? getWriteNullDataLength() : bytes.length; - - // write length of translated bytes - new AS400Bin4().toBytes(byteLength, buffer, offset + getWriteOffsetTByteLength()); - // write ccsid - new AS400Bin4().toBytes(getCcsid(), buffer, offset + getWriteOffsetCcsid()); - // write translated bytes - if (byteLength > 0) - System.arraycopy( - bytes, 0, buffer, offset+getWriteOffsetTBytes(), byteLength); - - return getByteLength(); -} -} diff --git a/cvsroot/contrib/com/ibm/as400/util/AS400ClassPathOptimizer.java b/cvsroot/contrib/com/ibm/as400/util/AS400ClassPathOptimizer.java deleted file mode 100644 index 3857c73f1..000000000 --- a/cvsroot/contrib/com/ibm/as400/util/AS400ClassPathOptimizer.java +++ /dev/null @@ -1,296 +0,0 @@ - -package com.ibm.as400.util; - -import com.ibm.as400.access.*; -import com.ibm.as400.resource.*; -import java.io.PrintStream; -import java.util.StringTokenizer; -import java.util.Enumeration; -import java.util.*; - - - -/** - * This class is used to optimize an AS400 classpath using the CRTJVAPGM command. - * The original need was a software update/install procedure that needed to make sure - * all the classes in the classpath were optimized at the appropriate levels. We - * needed something that didn't recompile classes if they were already optimized, as - * our app was large (over 10MB) and it could take several hours and LOTS of cpu to - * optimize at level 40. We needed something that did "touch up" optimizations. - * Here is an example of how you can use it... - * - *

- *	public static void main(String args[]) throws Exception {
- *
- *		String classpath = "/home/toronto/DEV/:/home/toronto/DEV/server.jar:" +
- *      	"/home/toronto/DEV/preprocessor.jar:/qibm/ProdData/HTTP/Public/jt400/lib/jt400.jar:" +
- *			"/qibm/proddata/java400/jt400ntv.jar:/home/toronto/DEV/collections.jar:" +
- *			"/home/toronto/DEV/antlr.jar:/home/toronto/DEV/crimson.jar:/home/toronto/DEV/xalan.jar:" +
- *			"/home/toronto/DEV/jaxp.jar:";
- *
- *		AS400 as400 = new AS400( "mysystem", "user", "password" );
- *		AS400ClassPathOptimizer cpo = new AS400ClassPathOptimizer( as400, classpath );
- *
- *		cpo.setOptimizationLevel( cpo.LEVEL_40 );
- *		cpo.setLicensedInternalCodeOptions( cpo.LICOPT_NOPRERESOLVEEXTREF );
- *
- *		// submit the optimizations and exit since this could take some time
- *		cpo.setOptimizeInParallel( true );
- *
- *		// so we can see the details of what it is doing...
- *		cpo.setOutputLog( System.out );
- *
- *		// submit the optimizations
- *		cpo.optimize();
- *
- *		System.exit( 0 );
- *	}
- * 
- * @author Glen Marchesani -**/ -public class AS400ClassPathOptimizer { - -//------------------------------------------------------------------------------ -// constants - - public static final int NO_OPTIMIZATION = 0; - public static final int LEVEL_10 = 10; - public static final int LEVEL_20 = 20; - public static final int LEVEL_30 = 30; - public static final int LEVEL_40 = 40; - - public static final String LICOPT_NOPRERESOLVEEXTREF = "NOPRERESOLVEEXTREF"; - -//------------------------------------------------------------------------------ -// instance variables - - private AS400 as400_; - private CommandCall commandCall_; - private String classpath_; - - private boolean wait_ = false; - - private boolean optimizeInParallel_ = false; - private int optimizationLevel_= NO_OPTIMIZATION; - private boolean optimizeDirectories_ = false; - - private String licensedInternalCodeOptions_ = LICOPT_NOPRERESOLVEEXTREF; - - private PrintStream out_; - -//------------------------------------------------------------------------------ -// constructors - - public AS400ClassPathOptimizer() { - this( null, null ); - } - - public AS400ClassPathOptimizer( AS400 as400 ) { - this( as400, null ); - } - - public AS400ClassPathOptimizer( AS400 as400, String classpath ) { - setAS400( as400 ); - setClasspath( classpath ); - } - -//------------------------------------------------------------------------------ -// methods - - - /** - * set the AS400 classpath to opimize. valid path separators are ; and : - * - */ - public void setClasspath( String classpath ) { - classpath_ = classpath; - } - - public void setAS400( AS400 as400 ) { - as400_ = as400; - } - - /** - * if true the optimize() method will wait for all CRTJVAPGM commands to end - * before it returns. Otherwise - * - */ - public void setWaitForOptimizations( boolean s ) { - wait_ = s; - } - - public boolean isWaitForOptimizations() { - return wait_; - } - - - /** - * if true run each CRTJVAPGM in a separate job. Using a value of true setting will ignore the "wait for optimizations" attribute. - * if false will run each CRTJVAPGM in serial waiting for the first to end before the next CRTJBAPGM is run. - * - */ - public void setOptimizeInParallel( boolean s ) { - optimizeInParallel_ = s; - } - - public void setOptimizeDirectories( boolean b ) { - optimizeDirectories_ = b; - } - - public boolean isOptimizeInParallel() { - return optimizeInParallel_; - } - - public String getLicensedInternalCodeOptions() { - return licensedInternalCodeOptions_; - } - - /** - * Sets the value to use on the CRTJVAPGM LICOPT parameter - */ - public void setLicensedInternalCodeOptions( String s ) { - licensedInternalCodeOptions_ = s; - } - - - /** - * Set the level to optimize classes to. Note that if a class/jar/zip is currently - * optimized at say level 30 and you set this at level 20 then no optimization will be done. - * - * This is not the case for optimizing a directory. If you optimize a directory the whole directory - * will be reoptimized to the level set. This is due to performance of checking the - * optimization level of say 400 classes in a directory versus making a single call - * to the CRTJVAPGM which. The single call to CRTJVAPGM (to optimize the entire directory) is almost always quicker than - * checking the 400 classes individually plus the time to optimize the classes individually. - * - */ - public void setOptimizationLevel( int level ) { - optimizationLevel_ = level; - } - - - public void setOutputLog( PrintStream out ) { - out_ = out; - } - - public void optimize() throws Exception { - - if ( optimizeInParallel_ ) { - wait_ = false; - } - - run(); - - } - - - public void run() throws Exception { - - logit( "classpath=" + classpath_ ); - logit( "wait=" + wait_ ); - logit( "optimizationLevel=" + optimizationLevel_ ); - logit( "optimizeDirectories=" + optimizeDirectories_ ); - logit( "optimizeInParallel=" + optimizeInParallel_ ); - logit( "licensedInternalCodeOptions=" + licensedInternalCodeOptions_ ); - - StringTokenizer st = new StringTokenizer( classpath_, ";:" ); - - while( st.hasMoreTokens() ) { - - String path = st.nextToken(); - - IFSFile file = new IFSFile( as400_, path ); - - if ( file.isDirectory() && optimizeDirectories_ == false ) { - logit( path + " is a directory and optimize directories is false." ); - } else if ( file.isAbsolute() && file.exists() == false ) { - logit( path + " does not exist." ); - } else if ( file.isAbsolute() == false ) { - logit( path + " must be an absolute path to be optimized." ); - } else { - - int level = retrieveOptimizationLevel( file ); - - if ( level < optimizationLevel_ ) { - optimize( file ); - logit( path + " currently optimized at level " + level + " optimizing to level " + optimizationLevel_ ); - } else { - logit( path + " currently optimized at level " + level + " not optimizing." ); - } - } - } - } - - - private void optimize( IFSFile file ) throws Exception { - - String command = getOptimizationCommand( file ); - - if ( wait_ ) { - runCommand( command ); - } else if ( optimizeInParallel_ ) { - runCommand( "SBMJOB JOB(CRTJVAPGM) CMD(" + command + ")" ); - } - } - - - void logit( String msg ) { - if ( out_ != null ) { - out_.println( msg ); - } - } - - - private String getOptimizationCommand( IFSFile file ) throws Exception { - - StringBuffer sb = new StringBuffer(); - - sb.append( "CRTJVAPGM " ); - sb.append( "CLSF(" + file.getAbsolutePath() + ") " ); - sb.append( "OPTIMIZE(" + optimizationLevel_ + ") " ); - - if ( file.isDirectory() && optimizeDirectories_ ) { - sb.append( "SUBTREE(*ALL) " ); - } - - if ( licensedInternalCodeOptions_ != null ) { - sb.append( "LICOPT(" + licensedInternalCodeOptions_ + ") " ); - } - - return sb.toString(); - } - - - void runCommand( String command ) throws Exception { - - if ( commandCall_ == null ) { - commandCall_ = new CommandCall( as400_ ); - } - - logit( command ); - - boolean status = commandCall_.run( command ); - - if ( status == false ) { - AS400Message[] log = commandCall_.getMessageList(); - logit( "error running command " + command ); - for ( int i=0; i - - demos - - - - - - - - diff --git a/cvsroot/demos/ToolboxME/JdbcDemo.java b/cvsroot/demos/ToolboxME/JdbcDemo.java deleted file mode 100644 index e2963ee5c..000000000 --- a/cvsroot/demos/ToolboxME/JdbcDemo.java +++ /dev/null @@ -1,834 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////// -// -// ToolboxME for iSeries example. This program demonstrates how your wireless -// device can connect to an iSeries server and use JDBC to perform work on a -// remote database. -// -////////////////////////////////////////////////////////////////////////////////// - -import java.sql.*; // SQL Interfaces provided by JdbcMe -import com.ibm.as400.micro.*; // JdbcMe implementation -import java.awt.*; -import java.awt.event.*; -import java.io.*; -import javax.microedition.io.*; // Part of the CLDC specification -import de.kawt.*; // Part of the CLDC specification - -class DemoConstants -{ - // These constants are actually used mainly by the demo - // for the JDBC driver. The Jdbc and JDBC application - // creator IDs ( http://www.palmos.com/dev ) - // are reserved at palm computing. - public static final int demoAppID = 0x4a444243; // JDBC - // Make the dbCreator something else so that the - // user can actually see the Palm DB seperately from - // the JdbcDemo application. - public static final int dbCreator = 0x4a444231; // JDB1 - public static final int dbType = 0x4a444231; // JDB1 -} - -/** - * Little configuration dialog box to display the - * current connections/statements, the - * URL being used, user id and password - */ -class ConfigurationDialog extends Dialog implements ActionListener -{ - TextField data; - ConfigurationDialog(Frame w) - { - super(w, "Configuration"); - - // Show/Modify current URL connection - data = new TextField(JdbcDemo.mainFrame.jdbcPanel.url); - add("Center", data); - - // Ok button. - Panel panel = new Panel(); - Button button = new Button("Ok"); - button.addActionListener(this); - panel.add(button); - add("South", panel); - pack(); - } - - public void actionPerformed(ActionEvent e) - { - JdbcDemo.mainFrame.jdbcPanel.url = data.getText(); - data = null; - setVisible(false); - } -} - -/** - * Little configuration dialog box to display the - * current connections/statements, the - * URL being used, user id and password - */ -class MultiChoiceDialog extends Dialog implements ActionListener -{ - Choice task; - ActionListener theListener; - MultiChoiceDialog(Frame w, String title, String prompt, String choices[], ActionListener it) - { - super(w, title); - theListener = it; - - // Show/Modify current URL connection - Label txt = new Label(prompt); - add("West", txt); - task = new Choice(); - for (int i=0; i=count; ++i) - { - data.add(rs.getString(i)); - } - } - data.repaint(); - } - catch (Exception e) - { - JdbcDemo.mainFrame.exceptionFeedback(e); - } - } - - - /** - * Move to the previous row in the result set. - **/ - public void goPrevRow() - { - try - { - if (rs == null || rsmd == null) - return; - - int count = rsmd.getColumnCount(); - int i; - data.removeAll(); - if (!rs.previous()) - data.add("Start of data"); - else - { - for (i=1; i<=count; ++i) - { - data.add(rs.getString(i)); - } - } - data.repaint(); - } - catch (Exception e) - { - JdbcDemo.mainFrame.exceptionFeedback(e); - } - } - - /** - * Perform a query and store the results in the local devices database - **/ - public void goResultsToPalmDB() - { - try - { - if (stmtObject == null) - { - FeedbackDialog dialog = new FeedbackDialog(JdbcDemo.mainFrame, "Skip", "No Statement"); - dialog.show(); - dialog = null; - return; - } - - boolean results = ((JdbcMeStatement)stmtObject).executeToOfflineData(sql.getText(), "JdbcResultSet", DemoConstants.dbCreator, DemoConstants.dbType); - if (!results) - { - FeedbackDialog dialog = new FeedbackDialog(JdbcDemo.mainFrame, "No Data", "Not a query"); - dialog.show(); - dialog = null; - return; - } - data.removeAll(); - data.add("Updated Palm DB 'JdbcResultSet'"); - data.repaint(); - } - catch (Exception e) - { - JdbcDemo.mainFrame.exceptionFeedback(e); - } - } - - - /** - * Perform a query from the database that resides on the palm device. - **/ - public void goQueryFromPalmDB() - { - try - { - if (rs != null) - { - rs.close(); - rs = null; - } - rs = new JdbcMeOfflineResultSet ("JdbcResultSet", DemoConstants.dbCreator, DemoConstants.dbType); - rsmd = rs.getMetaData(); - // If we want to debug some output, this - // method can be used to dump the contents - // of the PalmDB represented by the result set - // (Uses System.out so its mostly useful in - // the Palm emulator when debugging your - // applications. - // ((JdbcMeOfflineResultSet)rs).dumpDB(true); - - // show the first row. - goNextRow(); - } - catch (SQLException e) - { - JdbcDemo.mainFrame.exceptionFeedback(e); - } - } -} - -public class JdbcDemo extends Frame -{ - /** An ActionListener that ends the application. Only - * one is required, and can be reused - */ - private static ActionListener exitActionListener = null; - /** - * The main application in this process. - */ - static JdbcDemo mainFrame = null; - - JdbcPanel jdbcPanel = null; - - public static ActionListener getExitActionListener() - { - if (exitActionListener == null) - { - exitActionListener = new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - System.exit(0); - } - }; - } - return exitActionListener; - } - - /** - * Demo Constructor - **/ - public JdbcDemo() - { - super("Jdbc Demo"); - setLayout(new BorderLayout()); - - jdbcPanel = new JdbcPanel(); - add("Center", jdbcPanel); - - addWindowListener(new WindowAdapter() - { - public void windowClosing(WindowEvent e) - { - System.exit(0); - } - }); - setSize(200,300); - pack(); - } - - public void exceptionFeedback(Exception e) - { - Dialog dialog = new FeedbackDialog(JdbcDemo.mainFrame, e); - dialog.show(); - dialog = null; - } - - /** - * Main method. - **/ - public static void main(String args[]) - { - try - { - mainFrame = new JdbcDemo(); - mainFrame.show(); - mainFrame.jdbcPanel.goConfigure(); - } - catch (Exception e) - { - System.exit(1); - } - } -} diff --git a/cvsroot/demos/ToolboxME/JdbcMidpBid.java b/cvsroot/demos/ToolboxME/JdbcMidpBid.java deleted file mode 100644 index 6d1bb86c0..000000000 --- a/cvsroot/demos/ToolboxME/JdbcMidpBid.java +++ /dev/null @@ -1,522 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////// -// -// ToolboxME for iSeries example. This program is an example MIDlet that shows how -// you might code a JdbcMe application for the MIDP profile. Refer to the -// startApp, pauseApp, destroyApp and commandAction methods to see how it handles -// each requested transition. -// -////////////////////////////////////////////////////////////////////////////////// - -import javax.microedition.midlet.*; -import javax.microedition.lcdui.*; -import java.sql.*; -import javax.microedition.rms.*; - -import com.ibm.as400.micro.*; - - -public class JdbcMidpBid extends MIDlet implements CommandListener -{ - private static int BID_PROPERTY = 0; - private Display display; - - private TextField urlText = new TextField("urltext", "jdbc:as400://mySystem;user=myUid;password=myPwd;", 65, TextField.ANY); - private TextField jdbcmeText = new TextField("jdbcmetext", "meserver=myMEServer", 40, TextField.ANY); - private TextField jdbcmeTraceText = new TextField("jdbcmetracetext", "0", 10, TextField.ANY); - private final static String GETBIDS = "No bids are available, select here to download bids"; - private List main = new List("JdbcMe Bid Demo", Choice.IMPLICIT); - private List listings = null; - private Form aboutBox; - private Form bidForm; - private Form settingsForm; - private int bidRow = 0; - private String bidTarget = null; - private String bidTargetKey = null; - private TextField bidText = new TextField("bidtext", "", 10, TextField.NUMERIC); - private Form errorForm = null; - - private Command exitCommand = new Command("Exit", Command.SCREEN, 0); - private Command backCommand = new Command("Back", Command.SCREEN, 0); - private Command cancelCommand = new Command("Cancel", Command.SCREEN, 0); - private Command goCommand = new Command("Go", Command.SCREEN, 1); - private Displayable onErrorGoBackTo = null; - - /* - * Construct a new JdbcMidpBid. - */ - public JdbcMidpBid() - { - display = Display.getDisplay(this); - } - - /** - * Show the main screen - */ - public void startApp() - { - main.append("Show Bids", null); - main.append("Get New Bids", null); - main.append("Settings", null); - main.append("About", null); - main.addCommand(exitCommand); - main.setCommandListener(this); - - display.setCurrent(main); - } - - public void commandAction(Command c, Displayable s) - { - // All exitCommand processing is the same. - if (c == exitCommand) - { - destroyApp(false); - notifyDestroyed(); - return; - } - if (s instanceof List) - { - List current = (List)s; - - // An action occurred on the main page - if (current == main) - { - int idx = current.getSelectedIndex(); - switch (idx) - { - case 0: // Show current bids - showBids(); - break; - case 1: // Get New Bids - getNewBids(); - break; - case 2: // Settings - doSettings(); - break; - case 3: // About - aboutBox(); - break; - default : - break; - } - return; - } // current == main - - // An action occurred on the listings page - if (current == listings) - { - if (c == backCommand) - { - display.setCurrent(main); - return; - } - if (c == List.SELECT_COMMAND) - { - int idx = listings.getSelectedIndex(); - String stext = listings.getString(idx); - if (stext.equals(GETBIDS)) - { - getNewBids(); - return; - } - int commaIdx = stext.indexOf(','); - bidTargetKey = stext.substring(0, commaIdx); - bidTarget = stext.substring(commaIdx+1) + "\n"; - // Also keep track of which offline result set row - // This is. It happens to be the same as the index - // in the list. - bidRow = idx; - - bidOnProperty(); - } - } // current == listings - return; - } // instanceof List - if (s instanceof Form) - { - Form current = (Form)s; - if (current == errorForm) - { - if (c == backCommand) - display.setCurrent(onErrorGoBackTo); - - return; - } // errorForm - if (current == settingsForm) - { - if (c == backCommand) - { - // Done with settings. - display.setCurrent(main); - settingsForm = null; - return; - } - } // settingsForm - if (current == aboutBox) - { - if (c == backCommand) - { - // Done with about box. - display.setCurrent(main); - aboutBox = null; - return; - } - } - if (current == bidForm) - { - if (c == cancelCommand) - { - display.setCurrent(listings); - bidForm = null; - return; - } - if (c == goCommand) - { - submitBid(); - if (display.getCurrent() != bidForm) - { - // If we're no longer positioned at the - // bidForm, we will get rid of it. - bidForm = null; - } - return; - } - return; - } // current == bidForm - } // instanceof Form - } - - public void aboutBox() - { - aboutBox = new Form("aboutbox"); - aboutBox.setTitle("About"); - aboutBox.append(new StringItem("", "Midp RealEstate example for JdbcMe ")); - aboutBox.addCommand(backCommand); - aboutBox.setCommandListener(this); - display.setCurrent(aboutBox); - } - - /** - * The settings form. - */ - public void doSettings() - { - settingsForm = new Form("settingsform"); - settingsForm.setTitle("Settings"); - settingsForm.append(new StringItem("", "DB URL")); - settingsForm.append(urlText); - settingsForm.append(new StringItem("", "JdbcMe server")); - settingsForm.append(jdbcmeText); - settingsForm.append(new StringItem("", "Trace")); - - settingsForm.addCommand(backCommand); - settingsForm.setCommandListener(this); - display.setCurrent(settingsForm); - } - - - /** - * Show the bid screen for the bid target - * that we selected. - */ - public void bidOnProperty() - { - StringItem item = new StringItem("", bidTarget); - - bidText = new TextField("bidtext", "", 10, TextField.NUMERIC); - bidText.setString(""); - - bidForm = new Form("bidform"); - bidForm.setTitle("Submit a bid for:"); - BID_PROPERTY = 0; - bidForm.append(item); - bidForm.append(new StringItem("", "Your bid:")); - bidForm.append(bidText); - bidForm.addCommand(cancelCommand); - bidForm.addCommand(goCommand); - bidForm.setCommandListener(this); - display.setCurrent(bidForm); - } - - /** - * Update the listings card with the - * current list of bids that we're interested in. - */ - public void getNewBids() - { - // Reset the old listing - listings = null; - listings = new List("JdbcMe Bids", Choice.IMPLICIT); - java.sql.Connection conn = null; - Statement stmt = null; - try - { - conn = DriverManager.getConnection(urlText.getString() + ";" + jdbcmeText.getString()); - - stmt = conn.createStatement(); - - // Since we don't want the prepared statement to persist, - // a normal statement is really better in this environemnt. - String sql = "select mls, address, currentbid from qjdbcme.realestate where currentbid <> 0"; - - boolean results =((JdbcMeStatement)stmt).executeToOfflineData(sql,"JdbcMidpBidListings",0, 0); - if (results) - { - setupListingsFromOfflineData(); - } - else - { - listings.append("No bids found", null); - listings.addCommand(backCommand); - listings.setCommandListener(this); - } - } - catch (Exception e) - { - // Currently no valid listings retrieved, so lets - // reset it to empty. - listings = new List("JdbcMe Bids", Choice.IMPLICIT); - listings.append(GETBIDS, null); - listings.addCommand(backCommand); - listings.setCommandListener(this); - - // Return to main after showing the error. - showError(main, e); - return; - } - finally - { - if (conn != null) - { - try - { - conn.close(); - } - catch (Exception e) - { - } - } - conn = null; - stmt = null; - } - showBids(); - } - - public void setupListingsFromOfflineData() - { - // Skip the first four rows in the record store - // (eyecatcher, version, num columns, sql column - // types) - // and each subsequent row in the record store is - // a single column. Our query returns 3 columns which - // we'll return concatenated as a single string. - ResultSet rs = null; - listings.addCommand(backCommand); - listings.setCommandListener(this); - try - { - int i = 5; - int max = 0; - StringBuffer buf = new StringBuffer(20); - - // Creator and dbtype unused in MIDP - rs = new JdbcMeOfflineResultSet("JdbcMidpBidListings", 0, 0); - if (rs == null) - { - // New listings... - listings = new List("JdbcMe Bids", Choice.IMPLICIT); - listings.append(GETBIDS, null); - listings.addCommand(backCommand); - listings.setCommandListener(this); - return; - } - - i = 0; - String s = null; - while (rs.next()) - { - ++i; - - s = rs.getString(1); - buf.append(s); - - buf.append(","); - s = rs.getString(2); - buf.append(s); - - buf.append(", $"); - s = rs.getString(3); - buf.append(s); - - listings.append(buf.toString(), null); - buf.setLength(0); - } - - if (i == 0) - { - listings.append("No bids found", null); - return; - } - } - catch (Exception e) - { - // Currently no valid listings retrieved, so lets - // reset it to empty. - listings = new List("JdbcMe Bids", Choice.IMPLICIT); - listings.append(GETBIDS, null); - listings.addCommand(backCommand); - listings.setCommandListener(this); - - // Return to main after showing the error. - showError(main, e); - return; - } - finally - { - if (rs != null) - { - try - { - rs.close(); - } - catch (Exception e) - { - } - rs = null; - } - System.gc(); - } - } - - /** - * Update the listings card with the - * current list of bids that we're interested in. - */ - public void submitBid() - { - java.sql.Connection conn = null; - Statement stmt = null; - try - { - conn = DriverManager.getConnection(urlText.getString() + ";" + jdbcmeText.getString()); - - stmt = conn.createStatement(); - - // Since we don't want the prepared statement to persist, - // a normal statement is really better in this environemnt. - StringBuffer buf = new StringBuffer(100); - buf.append("Update QJdbcMe.RealEstate Set CurrentBid = "); - buf.append(bidText.getString()); - buf.append(" Where MLS = '"); - buf.append(bidTargetKey); - buf.append("' and CurrentBid < "); - buf.append(bidText.getString()); - String sql = buf.toString(); - - int updated = stmt.executeUpdate(sql); - if (updated == 1) - { - // BID Accepted. - String oldS = listings.getString(bidRow); - int commaIdx = bidTarget.indexOf(','); - String bidAddr = bidTarget.substring(0, commaIdx); - - String newS = bidTargetKey + "," + bidAddr + ", $" + bidText.getString(); - - ResultSet rs = null; - try - { - // Creator and dbtype unused in MIDP - rs = new JdbcMeOfflineResultSet("JdbcMidpBidListings", 0, 0); - rs.absolute(bidRow+1); - rs.updateString(3, bidText.getString()); - rs.close(); - } - catch (Exception e) - { - if (rs != null) - rs.close(); - } - - // Also update our live list of that result set. - listings.set(bidRow, newS, null); - display.setCurrent(listings); - conn.commit(); - } - else - { - conn.rollback(); - throw new SQLException("Failed to bid, someone beat you to it"); - } - } - catch (SQLException e) - { - // Return to the bid form after showing the error. - showError(bidForm, e); - return; - } - finally - { - if (conn != null) - { - try - { - conn.close(); - } - catch (Exception e) - { - } - } - conn = null; - stmt = null; - } - - // Exit without exception, then show the current bids - showBids(); - } - - /** - * Show an error condition. - */ - public void showError(Displayable d, Exception e) - { - String s = e.toString(); - - onErrorGoBackTo = d; - errorForm = new Form("Error"); - errorForm.setTitle("SQL Error"); - errorForm.append(new StringItem("", s)); - errorForm.addCommand(backCommand); - errorForm.setCommandListener(this); - display.setCurrent(errorForm); - } - - /** - * Show the current bids. - */ - public void showBids() - { - if (listings == null) - { - // If we have no current listings, lets set - // them up. - listings = new List("JdbcMe Bids", Choice.IMPLICIT); - setupListingsFromOfflineData(); - } - display.setCurrent(listings); - } - - /** - * Time to pause, free any space we don't need right now. - */ - public void pauseApp() - { - display.setCurrent(null); - } - - /** - * Destroy must cleanup everything. - */ - public void destroyApp(boolean unconditional) - { - } -} diff --git a/cvsroot/demos/ToolboxME/PrimeRealEstateDB.java b/cvsroot/demos/ToolboxME/PrimeRealEstateDB.java deleted file mode 100644 index f3387ee09..000000000 --- a/cvsroot/demos/ToolboxME/PrimeRealEstateDB.java +++ /dev/null @@ -1,293 +0,0 @@ -import java.util.*; -import java.sql.*; - -/** - * This class connects to a target iSeries database - * and primes the target system with the database - * schema, tables, stored procedures required by - * the JdbcMidpBid demo application. This is a - * one time setup for each you plan on running to. - *

- * This class loads the AS/400 Native JDBC driver - * or the IBM Toolbox for Java driver to perform the prime. - *

- * Set the CLASSPATH to point to the Naitve or Toolbox - * driver then run the java program like the following: - *

- * java PrimeRealEstateDB jdbc:as400://myAS400 myUid myPwd - * - **/ -public class PrimeRealEstateDB -{ - java.sql.Connection conn; - public PrimeRealEstateDB(Connection conn) - { - this.conn = conn; - } - public void run() throws SQLException { - Statement stmt = conn.createStatement(); - try - { - System.out.println("Try: Create Collection QJdbcMe"); - stmt.execute("Create collection QJdbcMe"); - } - catch (Exception e) - { - try - { - System.out.println("Try: Create Schema QJdbcMe"); - stmt.execute("Create Schema QJdbcMe"); - } - catch (Exception ex) - { - } - } - try - { - System.out.println("Try: Drop Table QJdbcMe.RECalendar"); - stmt.execute("Drop Table QJdbcMe.RECalendar"); - } - catch (Exception e) - { - } - // Not in a try block. This must work - System.out.println("Create Table QJdbcMe.RECalendar"); - stmt.execute("Create Table QJdbcMe.RECalendar " - +"(" - +"Mls CHAR(6) NOT NULL WITH DEFAULT, " - +"ApptDate CHAR(10) NOT NULL WITH DEFAULT, " - +"ApptTime CHAR(5) NOT NULL WITH DEFAULT," - +"Unique (" - +" Mls, ApptDate, ApptTime" - +" )" - +")"); - try - { - System.out.println("Try: Drop Procedure QJdbcMe.RESchedule"); - stmt.execute("Drop Procedure QJdbcMe.RESchedule"); - } - catch (Exception e) - { - } - try - { - System.out.println("Create Procedure QJdbcMe.RESchedule"); - stmt.execute("Create Procedure" - +" QJdbcMe.RESchedule" - +" ( IN MlsP CHAR (6), in ApptDateP CHAR(10)" - +" ,IN ApptTimeP CHAR (5) )" - +" RESULT SETS 1" - +" LANGUAGE SQL NOT DETERMINISTIC" - +" BEGIN" - +" Declare c1 cursor for select ApptDate || ' ' || ApptTime" - +" from QJdbcMe.RECalendar " - +" where MLS = MlsP and ApptDate = ApptDateP and" - +" ApptTime = ApptTimeP;" - +" Insert into QJdbcMe.RECalendar values(MlsP, ApptDateP, ApptTimeP);" - +" Open c1;" - +" Set Result Sets Cursor c1;" - +" end"); - } - catch (Exception e) - { - System.err.println("================================================\n"+ - "WARNING WARNING SQL Stored procedure didn't work\n"); - System.err.println("JdbcRealEstate 'schedule showing' won't work\n"+ - "================================================"); - } - try - { - System.out.println("Try: Drop Table QJdbcMe.RealEstate"); - stmt.execute("Drop Table QJdbcMe.RealEstate"); - } - catch (Exception e) - { - } - // Not in a try block. This must work - System.out.println("Create Table QJdbcMe.RealEstate"); - stmt.execute("Create Table QJdbcMe.RealEstate " - +"(" - +"Mls CHAR(6) NOT NULL WITH DEFAULT, " - +"Address VARCHAR(25), " - +"City VARCHAR(25), " - +"State CHAR(2)," - +"Zip CHAR(5)," - - +"YearBuilt CHAR(4)," - +"Style VARCHAR(15)," - +"SqFt INT, " - +"Bedrooms INT, " - +"Baths INT, " - - +"Acres FLOAT, " - +"GarageStalls INT, " - +"Price DECIMAL ( 11, 2) , " - +"CurrentBid DECIMAL ( 11, 2) , " - - +"Primary Key (MLS)" - +")"); - - PreparedStatement pStmt = conn.prepareStatement - ("Insert Into QJdbcMe.RealEstate values(" - +"?, ?, ?, ?, ?, " - +"?, ?, ?, ?, ?, " - +"?, ?, ?, ?" - +")"); - - // Not in a try block. This must work - PrimeRow primeRows = new PrimeRow(14); - int countRows = primeRows.numRowCapable(); - System.out.println("Insert rows into QJdbcMe.RealEstate..."); - for (int i=0; i [ ]"); - System.exit(1); - } - try - { - Class.forName("com.ibm.db2.jdbc.app.DB2Driver"); - } - catch (Exception e) - { - System.out.println("Didn't find class com.ibm.db2.jdbc.app.DB2Driver"); - } - try - { - Class.forName("COM.ibm.db2.jdbc.app.DB2Driver"); - } - catch (Exception e) - { - System.out.println("Didn't find class COM.ibm.db2.jdbc.app.DB2Driver"); - } - try - { - Class.forName("com.ibm.as400.access.AS400JDBCDriver"); - } - catch (Exception e) - { - System.out.println("Didn't find class com.ibm.as400.access.AS400JDBCDriver"); - } - - try - { - Connection conn; - if (args.length == 1) - { - conn = DriverManager.getConnection(args[0]); - } - else - { - conn = DriverManager.getConnection(args[0], args[1], args[2]); - } - conn.setAutoCommit(false); - - try - { - PrimeRealEstateDB p = new PrimeRealEstateDB(conn); - p.run(); - conn.commit(); - } - catch (Exception e) - { - System.out.println("Error, will rollback... Error:" + e); - e.printStackTrace(); - try - { - conn.rollback(); - } - catch (Exception ex) - { - System.out.println("Rollback Failed: " + ex); - } - } - finally - { - try - { - conn.close(); - } - catch (Exception e) - { - } - } - } - catch (Exception e) - { - System.out.println("Error, will rollback... Error:" + e); - e.printStackTrace(); - } - System.exit(0); - } -} - -/** - * A little abstraction that contains all of the - * rows of data that our RealEstate demo will use. - */ -class PrimeRow -{ - public final static int ExpectedColumns = 14; - public static final String rows[] = { - // 1 2 3 4 5 6 7 8 9 10 11 12 13 14 - // mls address city state zip year style sqft bedrooms baths acre garage Price Current Bid - "JDBCA0", "9321 22th St SW", "Rochester", "MN", "55902", "1970", "Hide-out", "3000", "5", "3", "0.25", "3", "109000.99", "0", - "JDBCA1", "3605 Hwy 52 N", "Rochester", "MN", "55906", "1948", "Commercial", "100000", "6000", "250", "40.5", "0", "999999999.99", "0", - "JDBCA2", "11 Buy IBM Stock", "Rochester", "MN", "55901", "2000", "Mansion", "3500", "6", "4", "3", "4", "199000.00", "222000.00", - "JDBCA3", "12 Use IBM Software", "Rochester", "MN", "55901", "2000", "Mansion", "3500", "6", "4", "3", "4", "189000.00", "201000.00", - "JDBCA4", "450 OS/400 Way", "Rochester", "MN", "55901", "2000", "2 Story" , "3000", "7", "5", "3", "9", "201000.00", "210000.00", - "JDBCA5", "1 Microsoft Way", "Redmond" , "WA", "20911", "1980", "Commercial", "40000", "2500", "100", "5.0", "0", "10099.79", "0", - "JDBCA6", "2 Microsoft Way", "Redmond" , "WA", "20911", "2001", "Commercial", "30000", "2400", "90", "3.0", "0", "10099.69", "0", - "JDBCA7", "101 IBM Chip Rd", "Rochester", "MN", "55906", "1980", "Split" , "1700", "2", "2", "0.25", "1", "114000.00", "0", - "JDBCA8", "115 IBM Disk Drive", "Rochester", "MN", "55906", "1981", "Rambler" , "2200", "3", "2", "0.25", "2", "129000.00", "0", - "JDBCA9", "987 Tech. Ct NE", "Rochester", "MN", "55906", "1989", "Multi-lvl", "2400", "4", "2", "0.25", "2", "169000.00", "0", - "JDBCB1", "10 Elm Street", "Somewhere", "MN", "55911", "1965", "2 story" , "2100", "3", "2", "0.25", "2", "103000.00", "0", - "JDBCB2", "11 Elm Street", "Somewhere", "MN", "55911", "1966", "2 story" , "1900", "3", "2", "0.25", "2", "101000.00", "0", - "JDBCB3", "12 Elm Street", "Somewhere", "MN", "55911", "1967", "2 story" , "2200", "3", "2", "0.25", "2", "89000.00", "92000.00", - "JDBCB4", "13 Elm Street", "Somewhere", "MN", "55911", "1968", "2 story" , "1500", "2", "1", "0.25", "2", "29000.00", "10000.00", - "JDBCB5", "14 Elm Street", "Somewhere", "MN", "55911", "1967", "2 story" , "2400", "3", "2", "0.25", "2", "79000.00", "0", - "JDBCB6", "15 Elm Street", "Somewhere", "MN", "55911", "1966", "2 story" , "2500", "3", "2", "0.25", "2", "101000.00", "0", - "JDBCB7", "16 Elm Street", "Somewhere", "MN", "55911", "1965", "2 story" , "2600", "3", "2", "0.25", "2", "110000.00", "0", - }; - java.sql.Connection conn; - - public PrimeRow(int numColumns) throws IllegalArgumentException { - if (numColumns != ExpectedColumns) - { - throw new IllegalArgumentException("Table Change? Expected " + ExpectedColumns + - " columns"); - - } - } - public int numRowCapable() - { - return(rows.length / ExpectedColumns); - } - public void setRow(PreparedStatement stmt, int row) - throws SQLException, IllegalArgumentException { - if (row > numRowCapable()) - { - throw new IllegalArgumentException("Invalid Row: row(" + row + - ") >= maxRow(" + numRowCapable() + ")"); - } - for (int i=0; i - -

- - - - - - - - - - - - - - - - - - diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCCommandButtonPanel.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCCommandButtonPanel.java deleted file mode 100644 index fe44b6c04..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCCommandButtonPanel.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * QCCommandButtonPanel.java - * - * Created on July 13, 2000, 3:52 PM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** A panel to continually reinstance the CommandCallButton since one can't - * effectively change servers once setServer() has been called. - * @author jax - * @version 1.0 - */ -public class QCCommandButtonPanel extends javax.swing.JPanel { - - /** Creates new form QCCommandButtonPanel - */ - public QCCommandButtonPanel() { - initComponents (); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the FormEditor. - */ - private void initComponents () {//GEN-BEGIN:initComponents - commandCallButton1 = new com.ibm.as400.vaccess.CommandCallButton (); - setLayout (new java.awt.BorderLayout ()); - - commandCallButton1.setText ("Run a Command"); - - - add (commandCallButton1, java.awt.BorderLayout.CENTER); - - }//GEN-END:initComponents - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private com.ibm.as400.vaccess.CommandCallButton commandCallButton1; - // End of variables declaration//GEN-END:variables - - /** Returns the CommandCallButton instance currently active in this panel. - * @return The current CommandCallButton which is reinstanced - * every time the server is changed, since you can't - * effectively setServer() more than once. - */ - public com.ibm.as400.vaccess.CommandCallButton getButton() { - return commandCallButton1; - } - /** Reinstance the CommandCallButton because that object can't have setServer() - * called on it multiple times per design. - * @param text The label for the button. - */ - public synchronized void renew(String text) { - remove(commandCallButton1); - commandCallButton1 = new com.ibm.as400.vaccess.CommandCallButton (); - commandCallButton1.setText (text); - add (commandCallButton1, java.awt.BorderLayout.CENTER); - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCCommandButtonPanelBeanInfo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCCommandButtonPanelBeanInfo.java deleted file mode 100644 index 043ac5980..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCCommandButtonPanelBeanInfo.java +++ /dev/null @@ -1,315 +0,0 @@ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.beans.*; - -public class QCCommandButtonPanelBeanInfo extends SimpleBeanInfo { - - // Property identifiers //GEN-FIRST:Properties - private static final int PROPERTY_optimizedDrawingEnabled = 0; - private static final int PROPERTY_colorModel = 1; - private static final int PROPERTY_minimumSize = 2; - private static final int PROPERTY_visible = 3; - private static final int PROPERTY_toolkit = 4; - private static final int PROPERTY_displayable = 5; - private static final int PROPERTY_opaque = 6; - private static final int PROPERTY_requestFocusEnabled = 7; - private static final int PROPERTY_enabled = 8; - private static final int PROPERTY_autoscrolls = 9; - private static final int PROPERTY_y = 10; - private static final int PROPERTY_x = 11; - private static final int PROPERTY_accessibleContext = 12; - private static final int PROPERTY_componentOrientation = 13; - private static final int PROPERTY_components = 14; - private static final int PROPERTY_managingFocus = 15; - private static final int PROPERTY_inputMethodRequests = 16; - private static final int PROPERTY_border = 17; - private static final int PROPERTY_locale = 18; - private static final int PROPERTY_insets = 19; - private static final int PROPERTY_UIClassID = 20; - private static final int PROPERTY_graphics = 21; - private static final int PROPERTY_minimumSizeSet = 22; - private static final int PROPERTY_actionMap = 23; - private static final int PROPERTY_maximumSizeSet = 24; - private static final int PROPERTY_alignmentY = 25; - private static final int PROPERTY_alignmentX = 26; - private static final int PROPERTY_locationOnScreen = 27; - private static final int PROPERTY_cursor = 28; - private static final int PROPERTY_registeredKeyStrokes = 29; - private static final int PROPERTY_preferredSizeSet = 30; - private static final int PROPERTY_visibleRect = 31; - private static final int PROPERTY_bounds = 32; - private static final int PROPERTY_inputContext = 33; - private static final int PROPERTY_class = 34; - private static final int PROPERTY_focusTraversable = 35; - private static final int PROPERTY_font = 36; - private static final int PROPERTY_inputVerifier = 37; - private static final int PROPERTY_lightweight = 38; - private static final int PROPERTY_paintingTile = 39; - private static final int PROPERTY_maximumSize = 40; - private static final int PROPERTY_layout = 41; - private static final int PROPERTY_treeLock = 42; - private static final int PROPERTY_verifyInputWhenFocusTarget = 43; - private static final int PROPERTY_button = 44; - private static final int PROPERTY_foreground = 45; - private static final int PROPERTY_preferredSize = 46; - private static final int PROPERTY_debugGraphicsOptions = 47; - private static final int PROPERTY_doubleBuffered = 48; - private static final int PROPERTY_showing = 49; - private static final int PROPERTY_nextFocusableComponent = 50; - private static final int PROPERTY_parent = 51; - private static final int PROPERTY_peer = 52; - private static final int PROPERTY_componentCount = 53; - private static final int PROPERTY_graphicsConfiguration = 54; - private static final int PROPERTY_height = 55; - private static final int PROPERTY_valid = 56; - private static final int PROPERTY_focusCycleRoot = 57; - private static final int PROPERTY_width = 58; - private static final int PROPERTY_toolTipText = 59; - private static final int PROPERTY_background = 60; - private static final int PROPERTY_validateRoot = 61; - private static final int PROPERTY_topLevelAncestor = 62; - private static final int PROPERTY_dropTarget = 63; - private static final int PROPERTY_rootPane = 64; - private static final int PROPERTY_name = 65; - private static final int PROPERTY_component = 66; - - // Property array - private static PropertyDescriptor[] properties = new PropertyDescriptor[67]; - - static { - try { - properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor ( "optimizedDrawingEnabled", QCCommandButtonPanel.class, "isOptimizedDrawingEnabled", null ); - properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", QCCommandButtonPanel.class, "getColorModel", null ); - properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", QCCommandButtonPanel.class, "getMinimumSize", "setMinimumSize" ); - properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", QCCommandButtonPanel.class, "isVisible", "setVisible" ); - properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", QCCommandButtonPanel.class, "getToolkit", null ); - properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", QCCommandButtonPanel.class, "isDisplayable", null ); - properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", QCCommandButtonPanel.class, "isOpaque", "setOpaque" ); - properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor ( "requestFocusEnabled", QCCommandButtonPanel.class, "isRequestFocusEnabled", "setRequestFocusEnabled" ); - properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", QCCommandButtonPanel.class, "isEnabled", "setEnabled" ); - properties[PROPERTY_autoscrolls] = new PropertyDescriptor ( "autoscrolls", QCCommandButtonPanel.class, "getAutoscrolls", "setAutoscrolls" ); - properties[PROPERTY_y] = new PropertyDescriptor ( "y", QCCommandButtonPanel.class, "getY", null ); - properties[PROPERTY_x] = new PropertyDescriptor ( "x", QCCommandButtonPanel.class, "getX", null ); - properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", QCCommandButtonPanel.class, "getAccessibleContext", null ); - properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", QCCommandButtonPanel.class, "getComponentOrientation", "setComponentOrientation" ); - properties[PROPERTY_components] = new PropertyDescriptor ( "components", QCCommandButtonPanel.class, "getComponents", null ); - properties[PROPERTY_managingFocus] = new PropertyDescriptor ( "managingFocus", QCCommandButtonPanel.class, "isManagingFocus", null ); - properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", QCCommandButtonPanel.class, "getInputMethodRequests", null ); - properties[PROPERTY_border] = new PropertyDescriptor ( "border", QCCommandButtonPanel.class, "getBorder", "setBorder" ); - properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", QCCommandButtonPanel.class, "getLocale", "setLocale" ); - properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", QCCommandButtonPanel.class, "getInsets", null ); - properties[PROPERTY_UIClassID] = new PropertyDescriptor ( "UIClassID", QCCommandButtonPanel.class, "getUIClassID", null ); - properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", QCCommandButtonPanel.class, "getGraphics", null ); - properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor ( "minimumSizeSet", QCCommandButtonPanel.class, "isMinimumSizeSet", null ); - properties[PROPERTY_actionMap] = new PropertyDescriptor ( "actionMap", QCCommandButtonPanel.class, "getActionMap", "setActionMap" ); - properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor ( "maximumSizeSet", QCCommandButtonPanel.class, "isMaximumSizeSet", null ); - properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", QCCommandButtonPanel.class, "getAlignmentY", "setAlignmentY" ); - properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", QCCommandButtonPanel.class, "getAlignmentX", "setAlignmentX" ); - properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", QCCommandButtonPanel.class, "getLocationOnScreen", null ); - properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", QCCommandButtonPanel.class, "getCursor", "setCursor" ); - properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor ( "registeredKeyStrokes", QCCommandButtonPanel.class, "getRegisteredKeyStrokes", null ); - properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor ( "preferredSizeSet", QCCommandButtonPanel.class, "isPreferredSizeSet", null ); - properties[PROPERTY_visibleRect] = new PropertyDescriptor ( "visibleRect", QCCommandButtonPanel.class, "getVisibleRect", null ); - properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", QCCommandButtonPanel.class, "getBounds", "setBounds" ); - properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", QCCommandButtonPanel.class, "getInputContext", null ); - properties[PROPERTY_class] = new PropertyDescriptor ( "class", QCCommandButtonPanel.class, "getClass", null ); - properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", QCCommandButtonPanel.class, "isFocusTraversable", null ); - properties[PROPERTY_font] = new PropertyDescriptor ( "font", QCCommandButtonPanel.class, "getFont", "setFont" ); - properties[PROPERTY_inputVerifier] = new PropertyDescriptor ( "inputVerifier", QCCommandButtonPanel.class, "getInputVerifier", "setInputVerifier" ); - properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", QCCommandButtonPanel.class, "isLightweight", null ); - properties[PROPERTY_paintingTile] = new PropertyDescriptor ( "paintingTile", QCCommandButtonPanel.class, "isPaintingTile", null ); - properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", QCCommandButtonPanel.class, "getMaximumSize", "setMaximumSize" ); - properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", QCCommandButtonPanel.class, "getLayout", "setLayout" ); - properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", QCCommandButtonPanel.class, "getTreeLock", null ); - properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor ( "verifyInputWhenFocusTarget", QCCommandButtonPanel.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget" ); - properties[PROPERTY_button] = new PropertyDescriptor ( "button", QCCommandButtonPanel.class, "getButton", null ); - properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", QCCommandButtonPanel.class, "getForeground", "setForeground" ); - properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", QCCommandButtonPanel.class, "getPreferredSize", "setPreferredSize" ); - properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor ( "debugGraphicsOptions", QCCommandButtonPanel.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions" ); - properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", QCCommandButtonPanel.class, "isDoubleBuffered", "setDoubleBuffered" ); - properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", QCCommandButtonPanel.class, "isShowing", null ); - properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor ( "nextFocusableComponent", QCCommandButtonPanel.class, "getNextFocusableComponent", "setNextFocusableComponent" ); - properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", QCCommandButtonPanel.class, "getParent", null ); - properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", QCCommandButtonPanel.class, "getPeer", null ); - properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", QCCommandButtonPanel.class, "getComponentCount", null ); - properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", QCCommandButtonPanel.class, "getGraphicsConfiguration", null ); - properties[PROPERTY_height] = new PropertyDescriptor ( "height", QCCommandButtonPanel.class, "getHeight", null ); - properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", QCCommandButtonPanel.class, "isValid", null ); - properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor ( "focusCycleRoot", QCCommandButtonPanel.class, "isFocusCycleRoot", null ); - properties[PROPERTY_width] = new PropertyDescriptor ( "width", QCCommandButtonPanel.class, "getWidth", null ); - properties[PROPERTY_toolTipText] = new PropertyDescriptor ( "toolTipText", QCCommandButtonPanel.class, "getToolTipText", "setToolTipText" ); - properties[PROPERTY_background] = new PropertyDescriptor ( "background", QCCommandButtonPanel.class, "getBackground", "setBackground" ); - properties[PROPERTY_validateRoot] = new PropertyDescriptor ( "validateRoot", QCCommandButtonPanel.class, "isValidateRoot", null ); - properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor ( "topLevelAncestor", QCCommandButtonPanel.class, "getTopLevelAncestor", null ); - properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", QCCommandButtonPanel.class, "getDropTarget", "setDropTarget" ); - properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", QCCommandButtonPanel.class, "getRootPane", null ); - properties[PROPERTY_name] = new PropertyDescriptor ( "name", QCCommandButtonPanel.class, "getName", "setName" ); - properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", QCCommandButtonPanel.class, null, null, "getComponent", null ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Properties - - // Here you can add code for customizing the properties array. - -}//GEN-LAST:Properties - - // EventSet identifiers//GEN-FIRST:Events - private static final int EVENT_mouseMotionListener = 0; - private static final int EVENT_ancestorListener = 1; - private static final int EVENT_inputMethodListener = 2; - private static final int EVENT_componentListener = 3; - private static final int EVENT_hierarchyBoundsListener = 4; - private static final int EVENT_mouseListener = 5; - private static final int EVENT_focusListener = 6; - private static final int EVENT_propertyChangeListener = 7; - private static final int EVENT_keyListener = 8; - private static final int EVENT_hierarchyListener = 9; - private static final int EVENT_containerListener = 10; - private static final int EVENT_vetoableChangeListener = 11; - - // EventSet array - private static EventSetDescriptor[] eventSets = new EventSetDescriptor[12]; - - static { - try { - eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( QCCommandButtonPanel.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[0], "addMouseMotionListener", "removeMouseMotionListener" ); - eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( QCCommandButtonPanel.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[0], "addAncestorListener", "removeAncestorListener" ); - eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( QCCommandButtonPanel.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[0], "addInputMethodListener", "removeInputMethodListener" ); - eventSets[EVENT_componentListener] = new EventSetDescriptor ( QCCommandButtonPanel.class, "componentListener", java.awt.event.ComponentListener.class, new String[0], "addComponentListener", "removeComponentListener" ); - eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( QCCommandButtonPanel.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[0], "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); - eventSets[EVENT_mouseListener] = new EventSetDescriptor ( QCCommandButtonPanel.class, "mouseListener", java.awt.event.MouseListener.class, new String[0], "addMouseListener", "removeMouseListener" ); - eventSets[EVENT_focusListener] = new EventSetDescriptor ( QCCommandButtonPanel.class, "focusListener", java.awt.event.FocusListener.class, new String[0], "addFocusListener", "removeFocusListener" ); - eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( QCCommandButtonPanel.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[0], "addPropertyChangeListener", "removePropertyChangeListener" ); - eventSets[EVENT_keyListener] = new EventSetDescriptor ( QCCommandButtonPanel.class, "keyListener", java.awt.event.KeyListener.class, new String[0], "addKeyListener", "removeKeyListener" ); - eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( QCCommandButtonPanel.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[0], "addHierarchyListener", "removeHierarchyListener" ); - eventSets[EVENT_containerListener] = new EventSetDescriptor ( QCCommandButtonPanel.class, "containerListener", java.awt.event.ContainerListener.class, new String[0], "addContainerListener", "removeContainerListener" ); - eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( QCCommandButtonPanel.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[0], "addVetoableChangeListener", "removeVetoableChangeListener" ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Events - - // Here you can add code for customizing the event sets array. - -}//GEN-LAST:Events - - private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef - private static java.awt.Image iconColor32 = null; - private static java.awt.Image iconMono16 = null; - private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef - private static String iconNameC16 = null;//GEN-BEGIN:Icons - private static String iconNameC32 = null; - private static String iconNameM16 = null; - private static String iconNameM32 = null;//GEN-END:Icons - - private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx - private static int defaultEventIndex = -1;//GEN-END:Idx - - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

- * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } - - /** - * Gets the beans EventSetDescriptors. - * - * @return An array of EventSetDescriptors describing the kinds of - * events fired by this bean. May return null if the information - * should be obtained by automatic analysis. - */ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSets; - } - - /** - * A bean may have a "default" property that is the property that will - * mostly commonly be initially chosen for update by human's who are - * customizing the bean. - * @return Index of default property in the PropertyDescriptor array - * returned by getPropertyDescriptors. - *

Returns -1 if there is no default property. - */ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** - * A bean may have a "default" event that is the event that will - * mostly commonly be used by human's when using the bean. - * @return Index of default event in the EventSetDescriptor array - * returned by getEventSetDescriptors. - *

Returns -1 if there is no default event. - */ - public int getDefaultEventIndex() { - return defaultPropertyIndex; - } - - /** - * This method returns an image object that can be used to - * represent the bean in toolboxes, toolbars, etc. Icon images - * will typically be GIFs, but may in future include other formats. - *

- * Beans aren't required to provide icons and may return null from - * this method. - *

- * There are four possible flavors of icons (16x16 color, - * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only - * support a single icon we recommend supporting 16x16 color. - *

- * We recommend that icons have a "transparent" background - * so they can be rendered onto an existing background. - * - * @param iconKind The kind of icon requested. This should be - * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, - * ICON_MONO_16x16, or ICON_MONO_32x32. - * @return An image object representing the requested icon. May - * return null if no suitable icon is available. - */ - public java.awt.Image getIcon(int iconKind) { - switch ( iconKind ) { - case ICON_COLOR_16x16: - if ( iconNameC16 == null ) - return null; - else { - if( iconColor16 == null ) - iconColor16 = loadImage( iconNameC16 ); - return iconColor16; - } - case ICON_COLOR_32x32: - if ( iconNameC32 == null ) - return null; - else { - if( iconColor32 == null ) - iconColor32 = loadImage( iconNameC32 ); - return iconColor32; - } - case ICON_MONO_16x16: - if ( iconNameM16 == null ) - return null; - else { - if( iconMono16 == null ) - iconMono16 = loadImage( iconNameM16 ); - return iconMono16; - } - case ICON_MONO_32x32: - if ( iconNameM32 == null ) - return null; - else { - if( iconNameM32 == null ) - iconMono32 = loadImage( iconNameM32 ); - return iconMono32; - } - } - return null; - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCCommandPanel.form b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCCommandPanel.form deleted file mode 100644 index 978cfd438..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCCommandPanel.form +++ /dev/null @@ -1,94 +0,0 @@ - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCCommandPanel.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCCommandPanel.java deleted file mode 100644 index 07a5ac217..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCCommandPanel.java +++ /dev/null @@ -1,296 +0,0 @@ -/* - * QCCommandPanel.java - * - * Created on July 12, 2000, 11:19 AM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** A panel to add to a notebook that has a CommandCallButton. - * @author jax - * @version 1.0 - */ -public class QCCommandPanel extends javax.swing.JPanel implements QCServiceClient { - - private QCMgr manager; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCServiceRecord serviceRecord; - - private com.ibm.as400.vaccess.ErrorDialogAdapter errorDialogAdapter; - /** Creates new form QCCommandPanel */ - public QCCommandPanel() { - initComponents (); - } - - /** Create a QCCommandPanel on an instance of an AS400. - * @param as400 An AS400 object - */ - public QCCommandPanel(com.ibm.as400.access.AS400 as400) { - this(); - setAS400(as400); - } - /** Create a command panel on a QCMgr.This method is not useful and is going away. - * @param mgr A QCMgr - */ - public QCCommandPanel(QCMgr mgr) { - this(); - setManager(mgr); - } - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the FormEditor. - */ - private void initComponents () {//GEN-BEGIN:initComponents - jTextArea1 = new javax.swing.JTextArea (); - jPanel1 = new javax.swing.JPanel (); - qCCommandButtonPanel1 = new com.SoftWoehr.JTOpenContrib.QCDemo.QCCommandButtonPanel (); - commandTextField = new javax.swing.JTextField (); - systemButton = new javax.swing.JButton (); - systemNameTextField = new javax.swing.JTextField (); - aS400DetailsPane1 = new com.ibm.as400.vaccess.AS400DetailsPane (); - setLayout (new java.awt.BorderLayout ()); - - jTextArea1.setEditable (false); - - - add (jTextArea1, java.awt.BorderLayout.NORTH); - - jPanel1.setLayout (new java.awt.GridLayout (2, 2)); - - - jPanel1.add (qCCommandButtonPanel1); - - commandTextField.setPreferredSize (new java.awt.Dimension(4, 40)); - commandTextField.setToolTipText ("Type the command you wish to execute, then hit Enter. This sets the CommandButton to the command."); - commandTextField.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - commandTextFieldActionPerformed (evt); - } - } - ); - - jPanel1.add (commandTextField); - - systemButton.setToolTipText ("Sets the system to the one you typed in."); - systemButton.setText ("Set System"); - systemButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - systemButtonActionPerformed (evt); - } - } - ); - - jPanel1.add (systemButton); - - systemNameTextField.setToolTipText ("Type in the system name on which you wish to execute a command."); - systemNameTextField.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - systemNameTextFieldActionPerformed (evt); - } - } - ); - - jPanel1.add (systemNameTextField); - - - add (jPanel1, java.awt.BorderLayout.SOUTH); - - - - add (aS400DetailsPane1, java.awt.BorderLayout.CENTER); - - }//GEN-END:initComponents - - // Hitting ENTER in the System textfield has the same effect as pressing the System button. - private void systemNameTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_systemNameTextFieldActionPerformed - // Add your handling code here: - if (null != serviceRecord) { - try { // let go of the service from manager - manager.freeService(serviceRecord); - } - catch (Exception e) { - e.printStackTrace(); - } - serviceRecord = null; - } - try { - serviceRecord = manager.getService("qcmgr:" + systemNameTextField.getText() + "/COMMAND", this); - } - catch (Exception e) { - e.printStackTrace(); - } - setAS400(serviceRecord.as400); - }//GEN-LAST:event_systemNameTextFieldActionPerformed - - private void commandTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_commandTextFieldActionPerformed - // Add your handling code here: - try { - getButton().setCommand(commandTextField.getText()); - } - catch (java.beans.PropertyVetoException e1) { - e1.printStackTrace (); - } - getButton().setText(commandTextField.getText()); - }//GEN-LAST:event_commandTextFieldActionPerformed - - // Hitting ENTER in the System textfield has the same effect as pressing the System button. - private void systemButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_systemButtonActionPerformed - // Add your handling code here: - if (null != serviceRecord) { - try { // let go of the service from manager - manager.freeService(serviceRecord); - } - catch (Exception e) { - e.printStackTrace(); - } - serviceRecord = null; - } - try { - serviceRecord = manager.getService("qcmgr:" + systemNameTextField.getText() + "/COMMAND", this); - } - catch (Exception e) { - e.printStackTrace(); - } - setAS400(serviceRecord.as400); - - }//GEN-LAST:event_systemButtonActionPerformed - - private void commandCallButtonActionCompleted (com.ibm.as400.access.ActionCompletedEvent evt) {//GEN-FIRST:event_commandCallButtonActionCompleted - // Add your handling code here: - jTextArea1.setText(jTextArea1.getText() + "Command completion notification received.\n"); - - // Cast the source of the event to a - // CommandCallButton. - com.ibm.as400.vaccess.CommandCallButton sourceButton = (com.ibm.as400.vaccess.CommandCallButton) evt.getSource (); - - // Get the list of AS/400 messages - // that the command generated. - com.ibm.as400.access.AS400Message[] messageList = sourceButton.getMessageList (); - com.ibm.as400.vaccess.VMessageList vMessageList = new com.ibm.as400.vaccess.VMessageList(messageList); - try { - aS400DetailsPane1.setRoot(vMessageList); - aS400DetailsPane1.load(); - } - catch (java.beans.PropertyVetoException e) { - e.printStackTrace(); - } - - // Handle message list manually. - /* - for (int i = 0; i < messageList.length; i++) { - jTextArea1.setText(jTextArea1.getText() + messageList[i].getText() + "\n"); - } - */ - }//GEN-LAST:event_commandCallButtonActionCompleted - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JTextArea jTextArea1; - private javax.swing.JPanel jPanel1; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCCommandButtonPanel qCCommandButtonPanel1; - private javax.swing.JTextField commandTextField; - private javax.swing.JButton systemButton; - private javax.swing.JTextField systemNameTextField; - private com.ibm.as400.vaccess.AS400DetailsPane aS400DetailsPane1; - // End of variables declaration//GEN-END:variables - - /** Re-instances of the CommandCallButton in the QCButtonPanel. Button gets - * reinstanced a lot because you can't effectively call setServer() more - * than once on an instance. - * @param as400 The AS400 object for the re-instanced CommandCallButton. - */ - public void setAS400(com.ibm.as400.access.AS400 as400) { - qCCommandButtonPanel1.renew(commandTextField.getText()); - attachCommandCompletedListener(); - getButton().addErrorListener(errorDialogAdapter); - try { - qCCommandButtonPanel1.getButton().setSystem(as400); - } - catch (java.beans.PropertyVetoException e1) { - e1.printStackTrace (); - } - reinstanceCommandFromTextEntry(); // Set button label - } - - /** Gets the command button's AS400 instance. - * @return The AS400 object used by the command button. - */ - public com.ibm.as400.access.AS400 getAS400() { - return getButton().getSystem(); - } - /** Resets the command button's text and command string - * from user input. - */ - public void reinstanceCommandFromTextEntry() { - String text = commandTextField.getText(); - if (null != text) { - if (!text.equals("")) { - getButton().setText(commandTextField.getText()); - try { - getButton().setCommand(commandTextField.getText()); - } - catch (java.beans.PropertyVetoException e1) { - e1.printStackTrace (); - } - } - else { - getButton().setText("Run a Command"); - try { - getButton().setCommand(""); - } - catch (java.beans.PropertyVetoException e1) { - e1.printStackTrace (); - } - } - } - else { - getButton().setText("Run a Command"); - try { - getButton().setCommand(""); - } - catch (java.beans.PropertyVetoException e1) { - e1.printStackTrace (); - } - } - } - /** Sets the QCMgr object which will handle AS400 instances for this client. - * @param mgr A QCMgr object. - */ - public void setManager(QCMgr mgr) { - manager = mgr; - } - /** Connects the ErrorDialogAdapter with any as400.vaccess components present. - * @param eda An instance of an ErrorDialogAdapter already associated - * with a suitable Frame. - */ - public void propagateEDA(com.ibm.as400.vaccess.ErrorDialogAdapter eda) { - errorDialogAdapter=eda; - getButton().addErrorListener(eda); - aS400DetailsPane1.addErrorListener(eda); - } - /** Required implementantion of the QCServiceClient interface. Releases the - * AS400 object provided by the server. - * @param sr The service record which represents the AS400 to be - * relinquished. - */ - public void relinquish(QCServiceRecord sr) { - // setAS400(null); // Can't do this ... ah, well ... - serviceRecord = null; - } - private void attachCommandCompletedListener() { - getButton().addActionCompletedListener (new com.ibm.as400.access.ActionCompletedListener () { - public void actionCompleted (com.ibm.as400.access.ActionCompletedEvent evt) - { - commandCallButtonActionCompleted(evt); - } - }); - } - private com.ibm.as400.vaccess.CommandCallButton getButton() { - return qCCommandButtonPanel1.getButton(); - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCCommandPanelBeanInfo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCCommandPanelBeanInfo.java deleted file mode 100644 index e8a7d4a48..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCCommandPanelBeanInfo.java +++ /dev/null @@ -1,315 +0,0 @@ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.beans.*; - -public class QCCommandPanelBeanInfo extends SimpleBeanInfo { - - // Property identifiers //GEN-FIRST:Properties - private static final int PROPERTY_visible = 0; - private static final int PROPERTY_accessibleContext = 1; - private static final int PROPERTY_managingFocus = 2; - private static final int PROPERTY_componentCount = 3; - private static final int PROPERTY_width = 4; - private static final int PROPERTY_foreground = 5; - private static final int PROPERTY_y = 6; - private static final int PROPERTY_x = 7; - private static final int PROPERTY_focusTraversable = 8; - private static final int PROPERTY_registeredKeyStrokes = 9; - private static final int PROPERTY_class = 10; - private static final int PROPERTY_AS400 = 11; - private static final int PROPERTY_preferredSizeSet = 12; - private static final int PROPERTY_enabled = 13; - private static final int PROPERTY_rootPane = 14; - private static final int PROPERTY_debugGraphicsOptions = 15; - private static final int PROPERTY_height = 16; - private static final int PROPERTY_minimumSizeSet = 17; - private static final int PROPERTY_insets = 18; - private static final int PROPERTY_optimizedDrawingEnabled = 19; - private static final int PROPERTY_validateRoot = 20; - private static final int PROPERTY_border = 21; - private static final int PROPERTY_parent = 22; - private static final int PROPERTY_bounds = 23; - private static final int PROPERTY_cursor = 24; - private static final int PROPERTY_lightweight = 25; - private static final int PROPERTY_displayable = 26; - private static final int PROPERTY_verifyInputWhenFocusTarget = 27; - private static final int PROPERTY_toolkit = 28; - private static final int PROPERTY_visibleRect = 29; - private static final int PROPERTY_locale = 30; - private static final int PROPERTY_graphics = 31; - private static final int PROPERTY_valid = 32; - private static final int PROPERTY_components = 33; - private static final int PROPERTY_showing = 34; - private static final int PROPERTY_nextFocusableComponent = 35; - private static final int PROPERTY_colorModel = 36; - private static final int PROPERTY_inputMethodRequests = 37; - private static final int PROPERTY_dropTarget = 38; - private static final int PROPERTY_name = 39; - private static final int PROPERTY_treeLock = 40; - private static final int PROPERTY_autoscrolls = 41; - private static final int PROPERTY_inputVerifier = 42; - private static final int PROPERTY_preferredSize = 43; - private static final int PROPERTY_minimumSize = 44; - private static final int PROPERTY_peer = 45; - private static final int PROPERTY_inputContext = 46; - private static final int PROPERTY_focusCycleRoot = 47; - private static final int PROPERTY_background = 48; - private static final int PROPERTY_layout = 49; - private static final int PROPERTY_componentOrientation = 50; - private static final int PROPERTY_topLevelAncestor = 51; - private static final int PROPERTY_maximumSizeSet = 52; - private static final int PROPERTY_actionMap = 53; - private static final int PROPERTY_font = 54; - private static final int PROPERTY_maximumSize = 55; - private static final int PROPERTY_graphicsConfiguration = 56; - private static final int PROPERTY_alignmentY = 57; - private static final int PROPERTY_requestFocusEnabled = 58; - private static final int PROPERTY_locationOnScreen = 59; - private static final int PROPERTY_alignmentX = 60; - private static final int PROPERTY_toolTipText = 61; - private static final int PROPERTY_paintingTile = 62; - private static final int PROPERTY_doubleBuffered = 63; - private static final int PROPERTY_UIClassID = 64; - private static final int PROPERTY_opaque = 65; - private static final int PROPERTY_component = 66; - - // Property array - private static PropertyDescriptor[] properties = new PropertyDescriptor[67]; - - static { - try { - properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", QCCommandPanel.class, "isVisible", "setVisible" ); - properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", QCCommandPanel.class, "getAccessibleContext", null ); - properties[PROPERTY_managingFocus] = new PropertyDescriptor ( "managingFocus", QCCommandPanel.class, "isManagingFocus", null ); - properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", QCCommandPanel.class, "getComponentCount", null ); - properties[PROPERTY_width] = new PropertyDescriptor ( "width", QCCommandPanel.class, "getWidth", null ); - properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", QCCommandPanel.class, "getForeground", "setForeground" ); - properties[PROPERTY_y] = new PropertyDescriptor ( "y", QCCommandPanel.class, "getY", null ); - properties[PROPERTY_x] = new PropertyDescriptor ( "x", QCCommandPanel.class, "getX", null ); - properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", QCCommandPanel.class, "isFocusTraversable", null ); - properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor ( "registeredKeyStrokes", QCCommandPanel.class, "getRegisteredKeyStrokes", null ); - properties[PROPERTY_class] = new PropertyDescriptor ( "class", QCCommandPanel.class, "getClass", null ); - properties[PROPERTY_AS400] = new PropertyDescriptor ( "AS400", QCCommandPanel.class, "getAS400", "setAS400" ); - properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor ( "preferredSizeSet", QCCommandPanel.class, "isPreferredSizeSet", null ); - properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", QCCommandPanel.class, "isEnabled", "setEnabled" ); - properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", QCCommandPanel.class, "getRootPane", null ); - properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor ( "debugGraphicsOptions", QCCommandPanel.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions" ); - properties[PROPERTY_height] = new PropertyDescriptor ( "height", QCCommandPanel.class, "getHeight", null ); - properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor ( "minimumSizeSet", QCCommandPanel.class, "isMinimumSizeSet", null ); - properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", QCCommandPanel.class, "getInsets", null ); - properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor ( "optimizedDrawingEnabled", QCCommandPanel.class, "isOptimizedDrawingEnabled", null ); - properties[PROPERTY_validateRoot] = new PropertyDescriptor ( "validateRoot", QCCommandPanel.class, "isValidateRoot", null ); - properties[PROPERTY_border] = new PropertyDescriptor ( "border", QCCommandPanel.class, "getBorder", "setBorder" ); - properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", QCCommandPanel.class, "getParent", null ); - properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", QCCommandPanel.class, "getBounds", "setBounds" ); - properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", QCCommandPanel.class, "getCursor", "setCursor" ); - properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", QCCommandPanel.class, "isLightweight", null ); - properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", QCCommandPanel.class, "isDisplayable", null ); - properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor ( "verifyInputWhenFocusTarget", QCCommandPanel.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget" ); - properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", QCCommandPanel.class, "getToolkit", null ); - properties[PROPERTY_visibleRect] = new PropertyDescriptor ( "visibleRect", QCCommandPanel.class, "getVisibleRect", null ); - properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", QCCommandPanel.class, "getLocale", "setLocale" ); - properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", QCCommandPanel.class, "getGraphics", null ); - properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", QCCommandPanel.class, "isValid", null ); - properties[PROPERTY_components] = new PropertyDescriptor ( "components", QCCommandPanel.class, "getComponents", null ); - properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", QCCommandPanel.class, "isShowing", null ); - properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor ( "nextFocusableComponent", QCCommandPanel.class, "getNextFocusableComponent", "setNextFocusableComponent" ); - properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", QCCommandPanel.class, "getColorModel", null ); - properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", QCCommandPanel.class, "getInputMethodRequests", null ); - properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", QCCommandPanel.class, "getDropTarget", "setDropTarget" ); - properties[PROPERTY_name] = new PropertyDescriptor ( "name", QCCommandPanel.class, "getName", "setName" ); - properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", QCCommandPanel.class, "getTreeLock", null ); - properties[PROPERTY_autoscrolls] = new PropertyDescriptor ( "autoscrolls", QCCommandPanel.class, "getAutoscrolls", "setAutoscrolls" ); - properties[PROPERTY_inputVerifier] = new PropertyDescriptor ( "inputVerifier", QCCommandPanel.class, "getInputVerifier", "setInputVerifier" ); - properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", QCCommandPanel.class, "getPreferredSize", "setPreferredSize" ); - properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", QCCommandPanel.class, "getMinimumSize", "setMinimumSize" ); - properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", QCCommandPanel.class, "getPeer", null ); - properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", QCCommandPanel.class, "getInputContext", null ); - properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor ( "focusCycleRoot", QCCommandPanel.class, "isFocusCycleRoot", null ); - properties[PROPERTY_background] = new PropertyDescriptor ( "background", QCCommandPanel.class, "getBackground", "setBackground" ); - properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", QCCommandPanel.class, "getLayout", "setLayout" ); - properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", QCCommandPanel.class, "getComponentOrientation", "setComponentOrientation" ); - properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor ( "topLevelAncestor", QCCommandPanel.class, "getTopLevelAncestor", null ); - properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor ( "maximumSizeSet", QCCommandPanel.class, "isMaximumSizeSet", null ); - properties[PROPERTY_actionMap] = new PropertyDescriptor ( "actionMap", QCCommandPanel.class, "getActionMap", "setActionMap" ); - properties[PROPERTY_font] = new PropertyDescriptor ( "font", QCCommandPanel.class, "getFont", "setFont" ); - properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", QCCommandPanel.class, "getMaximumSize", "setMaximumSize" ); - properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", QCCommandPanel.class, "getGraphicsConfiguration", null ); - properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", QCCommandPanel.class, "getAlignmentY", "setAlignmentY" ); - properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor ( "requestFocusEnabled", QCCommandPanel.class, "isRequestFocusEnabled", "setRequestFocusEnabled" ); - properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", QCCommandPanel.class, "getLocationOnScreen", null ); - properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", QCCommandPanel.class, "getAlignmentX", "setAlignmentX" ); - properties[PROPERTY_toolTipText] = new PropertyDescriptor ( "toolTipText", QCCommandPanel.class, "getToolTipText", "setToolTipText" ); - properties[PROPERTY_paintingTile] = new PropertyDescriptor ( "paintingTile", QCCommandPanel.class, "isPaintingTile", null ); - properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", QCCommandPanel.class, "isDoubleBuffered", "setDoubleBuffered" ); - properties[PROPERTY_UIClassID] = new PropertyDescriptor ( "UIClassID", QCCommandPanel.class, "getUIClassID", null ); - properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", QCCommandPanel.class, "isOpaque", "setOpaque" ); - properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", QCCommandPanel.class, null, null, "getComponent", null ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Properties - - // Here you can add code for customizing the properties array. - -}//GEN-LAST:Properties - - // EventSet identifiers//GEN-FIRST:Events - private static final int EVENT_mouseMotionListener = 0; - private static final int EVENT_ancestorListener = 1; - private static final int EVENT_inputMethodListener = 2; - private static final int EVENT_componentListener = 3; - private static final int EVENT_hierarchyBoundsListener = 4; - private static final int EVENT_mouseListener = 5; - private static final int EVENT_focusListener = 6; - private static final int EVENT_propertyChangeListener = 7; - private static final int EVENT_keyListener = 8; - private static final int EVENT_hierarchyListener = 9; - private static final int EVENT_containerListener = 10; - private static final int EVENT_vetoableChangeListener = 11; - - // EventSet array - private static EventSetDescriptor[] eventSets = new EventSetDescriptor[12]; - - static { - try { - eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( QCCommandPanel.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[0], "addMouseMotionListener", "removeMouseMotionListener" ); - eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( QCCommandPanel.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[0], "addAncestorListener", "removeAncestorListener" ); - eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( QCCommandPanel.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[0], "addInputMethodListener", "removeInputMethodListener" ); - eventSets[EVENT_componentListener] = new EventSetDescriptor ( QCCommandPanel.class, "componentListener", java.awt.event.ComponentListener.class, new String[0], "addComponentListener", "removeComponentListener" ); - eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( QCCommandPanel.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[0], "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); - eventSets[EVENT_mouseListener] = new EventSetDescriptor ( QCCommandPanel.class, "mouseListener", java.awt.event.MouseListener.class, new String[0], "addMouseListener", "removeMouseListener" ); - eventSets[EVENT_focusListener] = new EventSetDescriptor ( QCCommandPanel.class, "focusListener", java.awt.event.FocusListener.class, new String[0], "addFocusListener", "removeFocusListener" ); - eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( QCCommandPanel.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[0], "addPropertyChangeListener", "removePropertyChangeListener" ); - eventSets[EVENT_keyListener] = new EventSetDescriptor ( QCCommandPanel.class, "keyListener", java.awt.event.KeyListener.class, new String[0], "addKeyListener", "removeKeyListener" ); - eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( QCCommandPanel.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[0], "addHierarchyListener", "removeHierarchyListener" ); - eventSets[EVENT_containerListener] = new EventSetDescriptor ( QCCommandPanel.class, "containerListener", java.awt.event.ContainerListener.class, new String[0], "addContainerListener", "removeContainerListener" ); - eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( QCCommandPanel.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[0], "addVetoableChangeListener", "removeVetoableChangeListener" ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Events - - // Here you can add code for customizing the event sets array. - -}//GEN-LAST:Events - - private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef - private static java.awt.Image iconColor32 = null; - private static java.awt.Image iconMono16 = null; - private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef - private static String iconNameC16 = null;//GEN-BEGIN:Icons - private static String iconNameC32 = null; - private static String iconNameM16 = null; - private static String iconNameM32 = null;//GEN-END:Icons - - private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx - private static int defaultEventIndex = -1;//GEN-END:Idx - - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

- * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } - - /** - * Gets the beans EventSetDescriptors. - * - * @return An array of EventSetDescriptors describing the kinds of - * events fired by this bean. May return null if the information - * should be obtained by automatic analysis. - */ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSets; - } - - /** - * A bean may have a "default" property that is the property that will - * mostly commonly be initially chosen for update by human's who are - * customizing the bean. - * @return Index of default property in the PropertyDescriptor array - * returned by getPropertyDescriptors. - *

Returns -1 if there is no default property. - */ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** - * A bean may have a "default" event that is the event that will - * mostly commonly be used by human's when using the bean. - * @return Index of default event in the EventSetDescriptor array - * returned by getEventSetDescriptors. - *

Returns -1 if there is no default event. - */ - public int getDefaultEventIndex() { - return defaultPropertyIndex; - } - - /** - * This method returns an image object that can be used to - * represent the bean in toolboxes, toolbars, etc. Icon images - * will typically be GIFs, but may in future include other formats. - *

- * Beans aren't required to provide icons and may return null from - * this method. - *

- * There are four possible flavors of icons (16x16 color, - * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only - * support a single icon we recommend supporting 16x16 color. - *

- * We recommend that icons have a "transparent" background - * so they can be rendered onto an existing background. - * - * @param iconKind The kind of icon requested. This should be - * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, - * ICON_MONO_16x16, or ICON_MONO_32x32. - * @return An image object representing the requested icon. May - * return null if no suitable icon is available. - */ - public java.awt.Image getIcon(int iconKind) { - switch ( iconKind ) { - case ICON_COLOR_16x16: - if ( iconNameC16 == null ) - return null; - else { - if( iconColor16 == null ) - iconColor16 = loadImage( iconNameC16 ); - return iconColor16; - } - case ICON_COLOR_32x32: - if ( iconNameC32 == null ) - return null; - else { - if( iconColor32 == null ) - iconColor32 = loadImage( iconNameC32 ); - return iconColor32; - } - case ICON_MONO_16x16: - if ( iconNameM16 == null ) - return null; - else { - if( iconMono16 == null ) - iconMono16 = loadImage( iconNameM16 ); - return iconMono16; - } - case ICON_MONO_32x32: - if ( iconNameM32 == null ) - return null; - else { - if( iconNameM32 == null ) - iconMono32 = loadImage( iconNameM32 ); - return iconMono32; - } - } - return null; - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCDemo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCDemo.java deleted file mode 100644 index 12cd4057d..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCDemo.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * QCDemo.java - * - * Created on July 18, 2000, 3:36 PM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** - * - * @author jax - * @version - */ -public class QCDemo extends Object { - - /** Creates new QCDemo */ - public QCDemo() { - } - - /** - * @param args the command line arguments - */ - public static void main (String args[]) { - new QCTopFrame ().show (); - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCDetailsPane.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCDetailsPane.java deleted file mode 100644 index bb43dbf65..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCDetailsPane.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * QCDetailsPane.java - * - * A wrapper around com.ibm.as400.vaccess.AS400DetailsPane to - * allow us to polymorphically switch panes in a panel. - * - * Created on July 16, 2000, 2:06 AM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** A wrapper around a JTOpen pane type to allow polymorphism. - * @author jax - * @version 1.0 - */ -public class QCDetailsPane extends com.ibm.as400.vaccess.AS400DetailsPane implements QCVNodeDisplayer { - - /** Creates new QCExplorer */ - public QCDetailsPane() { - } - - /** Sets the node as root for the pane. - * @param v The VNode to be setRoot by the pane. - */ - public void setRoot(com.ibm.as400.vaccess.VNode v) { - try { - super.setRoot(v); - } - catch (java.beans.PropertyVetoException e) { - e.printStackTrace(); - } - } - - /** Add the pane to the Container. - * @param c The Container to be added to. - */ - public void addTo(java.awt.Container c) { - c.add(this); - } - - /** Add error dialog as listener. - * @param eda The ErrorDialogAdapter to add. - */ - public void addErrorListener(com.ibm.as400.vaccess.ErrorDialogAdapter eda) { - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCDetailsPaneBeanInfo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCDetailsPaneBeanInfo.java deleted file mode 100644 index e0109fddf..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCDetailsPaneBeanInfo.java +++ /dev/null @@ -1,337 +0,0 @@ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.beans.*; - -public class QCDetailsPaneBeanInfo extends SimpleBeanInfo { - - // Property identifiers //GEN-FIRST:Properties - private static final int PROPERTY_locale = 0; - private static final int PROPERTY_alignmentY = 1; - private static final int PROPERTY_alignmentX = 2; - private static final int PROPERTY_treeLock = 3; - private static final int PROPERTY_focusTraversable = 4; - private static final int PROPERTY_displayable = 5; - private static final int PROPERTY_topLevelAncestor = 6; - private static final int PROPERTY_showing = 7; - private static final int PROPERTY_allowActions = 8; - private static final int PROPERTY_paintingTile = 9; - private static final int PROPERTY_opaque = 10; - private static final int PROPERTY_y = 11; - private static final int PROPERTY_inputVerifier = 12; - private static final int PROPERTY_x = 13; - private static final int PROPERTY_verifyInputWhenFocusTarget = 14; - private static final int PROPERTY_graphics = 15; - private static final int PROPERTY_toolTipText = 16; - private static final int PROPERTY_UIClassID = 17; - private static final int PROPERTY_bounds = 18; - private static final int PROPERTY_selectionModel = 19; - private static final int PROPERTY_border = 20; - private static final int PROPERTY_background = 21; - private static final int PROPERTY_requestFocusEnabled = 22; - private static final int PROPERTY_width = 23; - private static final int PROPERTY_model = 24; - private static final int PROPERTY_class = 25; - private static final int PROPERTY_components = 26; - private static final int PROPERTY_selectedObject = 27; - private static final int PROPERTY_maximumSize = 28; - private static final int PROPERTY_validateRoot = 29; - private static final int PROPERTY_focusCycleRoot = 30; - private static final int PROPERTY_height = 31; - private static final int PROPERTY_toolkit = 32; - private static final int PROPERTY_inputContext = 33; - private static final int PROPERTY_name = 34; - private static final int PROPERTY_root = 35; - private static final int PROPERTY_visibleRect = 36; - private static final int PROPERTY_rowSelectionAllowed = 37; - private static final int PROPERTY_enabled = 38; - private static final int PROPERTY_actionContext = 39; - private static final int PROPERTY_debugGraphicsOptions = 40; - private static final int PROPERTY_inputMethodRequests = 41; - private static final int PROPERTY_colorModel = 42; - private static final int PROPERTY_foreground = 43; - private static final int PROPERTY_visible = 44; - private static final int PROPERTY_font = 45; - private static final int PROPERTY_optimizedDrawingEnabled = 46; - private static final int PROPERTY_actionMap = 47; - private static final int PROPERTY_parent = 48; - private static final int PROPERTY_preferredSize = 49; - private static final int PROPERTY_doubleBuffered = 50; - private static final int PROPERTY_lightweight = 51; - private static final int PROPERTY_valid = 52; - private static final int PROPERTY_minimumSizeSet = 53; - private static final int PROPERTY_columnModel = 54; - private static final int PROPERTY_peer = 55; - private static final int PROPERTY_autoscrolls = 56; - private static final int PROPERTY_minimumSize = 57; - private static final int PROPERTY_registeredKeyStrokes = 58; - private static final int PROPERTY_graphicsConfiguration = 59; - private static final int PROPERTY_layout = 60; - private static final int PROPERTY_nextFocusableComponent = 61; - private static final int PROPERTY_maximumSizeSet = 62; - private static final int PROPERTY_locationOnScreen = 63; - private static final int PROPERTY_preferredSizeSet = 64; - private static final int PROPERTY_cursor = 65; - private static final int PROPERTY_managingFocus = 66; - private static final int PROPERTY_insets = 67; - private static final int PROPERTY_componentOrientation = 68; - private static final int PROPERTY_componentCount = 69; - private static final int PROPERTY_rootPane = 70; - private static final int PROPERTY_accessibleContext = 71; - private static final int PROPERTY_selectedObjects = 72; - private static final int PROPERTY_dropTarget = 73; - private static final int PROPERTY_confirm = 74; - private static final int PROPERTY_component = 75; - - // Property array - private static PropertyDescriptor[] properties = new PropertyDescriptor[76]; - - static { - try { - properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", QCDetailsPane.class, "getLocale", "setLocale" ); - properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", QCDetailsPane.class, "getAlignmentY", "setAlignmentY" ); - properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", QCDetailsPane.class, "getAlignmentX", "setAlignmentX" ); - properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", QCDetailsPane.class, "getTreeLock", null ); - properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", QCDetailsPane.class, "isFocusTraversable", null ); - properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", QCDetailsPane.class, "isDisplayable", null ); - properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor ( "topLevelAncestor", QCDetailsPane.class, "getTopLevelAncestor", null ); - properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", QCDetailsPane.class, "isShowing", null ); - properties[PROPERTY_allowActions] = new PropertyDescriptor ( "allowActions", QCDetailsPane.class, "getAllowActions", "setAllowActions" ); - properties[PROPERTY_paintingTile] = new PropertyDescriptor ( "paintingTile", QCDetailsPane.class, "isPaintingTile", null ); - properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", QCDetailsPane.class, "isOpaque", "setOpaque" ); - properties[PROPERTY_y] = new PropertyDescriptor ( "y", QCDetailsPane.class, "getY", null ); - properties[PROPERTY_inputVerifier] = new PropertyDescriptor ( "inputVerifier", QCDetailsPane.class, "getInputVerifier", "setInputVerifier" ); - properties[PROPERTY_x] = new PropertyDescriptor ( "x", QCDetailsPane.class, "getX", null ); - properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor ( "verifyInputWhenFocusTarget", QCDetailsPane.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget" ); - properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", QCDetailsPane.class, "getGraphics", null ); - properties[PROPERTY_toolTipText] = new PropertyDescriptor ( "toolTipText", QCDetailsPane.class, "getToolTipText", "setToolTipText" ); - properties[PROPERTY_UIClassID] = new PropertyDescriptor ( "UIClassID", QCDetailsPane.class, "getUIClassID", null ); - properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", QCDetailsPane.class, "getBounds", "setBounds" ); - properties[PROPERTY_selectionModel] = new PropertyDescriptor ( "selectionModel", QCDetailsPane.class, "getSelectionModel", "setSelectionModel" ); - properties[PROPERTY_border] = new PropertyDescriptor ( "border", QCDetailsPane.class, "getBorder", "setBorder" ); - properties[PROPERTY_background] = new PropertyDescriptor ( "background", QCDetailsPane.class, "getBackground", "setBackground" ); - properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor ( "requestFocusEnabled", QCDetailsPane.class, "isRequestFocusEnabled", "setRequestFocusEnabled" ); - properties[PROPERTY_width] = new PropertyDescriptor ( "width", QCDetailsPane.class, "getWidth", null ); - properties[PROPERTY_model] = new PropertyDescriptor ( "model", QCDetailsPane.class, "getModel", null ); - properties[PROPERTY_class] = new PropertyDescriptor ( "class", QCDetailsPane.class, "getClass", null ); - properties[PROPERTY_components] = new PropertyDescriptor ( "components", QCDetailsPane.class, "getComponents", null ); - properties[PROPERTY_selectedObject] = new PropertyDescriptor ( "selectedObject", QCDetailsPane.class, "getSelectedObject", null ); - properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", QCDetailsPane.class, "getMaximumSize", "setMaximumSize" ); - properties[PROPERTY_validateRoot] = new PropertyDescriptor ( "validateRoot", QCDetailsPane.class, "isValidateRoot", null ); - properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor ( "focusCycleRoot", QCDetailsPane.class, "isFocusCycleRoot", null ); - properties[PROPERTY_height] = new PropertyDescriptor ( "height", QCDetailsPane.class, "getHeight", null ); - properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", QCDetailsPane.class, "getToolkit", null ); - properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", QCDetailsPane.class, "getInputContext", null ); - properties[PROPERTY_name] = new PropertyDescriptor ( "name", QCDetailsPane.class, "getName", "setName" ); - properties[PROPERTY_root] = new PropertyDescriptor ( "root", QCDetailsPane.class, "getRoot", "setRoot" ); - properties[PROPERTY_visibleRect] = new PropertyDescriptor ( "visibleRect", QCDetailsPane.class, "getVisibleRect", null ); - properties[PROPERTY_rowSelectionAllowed] = new PropertyDescriptor ( "rowSelectionAllowed", QCDetailsPane.class, "getRowSelectionAllowed", "setRowSelectionAllowed" ); - properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", QCDetailsPane.class, "isEnabled", "setEnabled" ); - properties[PROPERTY_actionContext] = new PropertyDescriptor ( "actionContext", QCDetailsPane.class, "getActionContext", null ); - properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor ( "debugGraphicsOptions", QCDetailsPane.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions" ); - properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", QCDetailsPane.class, "getInputMethodRequests", null ); - properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", QCDetailsPane.class, "getColorModel", null ); - properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", QCDetailsPane.class, "getForeground", "setForeground" ); - properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", QCDetailsPane.class, "isVisible", "setVisible" ); - properties[PROPERTY_font] = new PropertyDescriptor ( "font", QCDetailsPane.class, "getFont", "setFont" ); - properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor ( "optimizedDrawingEnabled", QCDetailsPane.class, "isOptimizedDrawingEnabled", null ); - properties[PROPERTY_actionMap] = new PropertyDescriptor ( "actionMap", QCDetailsPane.class, "getActionMap", "setActionMap" ); - properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", QCDetailsPane.class, "getParent", null ); - properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", QCDetailsPane.class, "getPreferredSize", "setPreferredSize" ); - properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", QCDetailsPane.class, "isDoubleBuffered", "setDoubleBuffered" ); - properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", QCDetailsPane.class, "isLightweight", null ); - properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", QCDetailsPane.class, "isValid", null ); - properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor ( "minimumSizeSet", QCDetailsPane.class, "isMinimumSizeSet", null ); - properties[PROPERTY_columnModel] = new PropertyDescriptor ( "columnModel", QCDetailsPane.class, "getColumnModel", null ); - properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", QCDetailsPane.class, "getPeer", null ); - properties[PROPERTY_autoscrolls] = new PropertyDescriptor ( "autoscrolls", QCDetailsPane.class, "getAutoscrolls", "setAutoscrolls" ); - properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", QCDetailsPane.class, "getMinimumSize", "setMinimumSize" ); - properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor ( "registeredKeyStrokes", QCDetailsPane.class, "getRegisteredKeyStrokes", null ); - properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", QCDetailsPane.class, "getGraphicsConfiguration", null ); - properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", QCDetailsPane.class, "getLayout", "setLayout" ); - properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor ( "nextFocusableComponent", QCDetailsPane.class, "getNextFocusableComponent", "setNextFocusableComponent" ); - properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor ( "maximumSizeSet", QCDetailsPane.class, "isMaximumSizeSet", null ); - properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", QCDetailsPane.class, "getLocationOnScreen", null ); - properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor ( "preferredSizeSet", QCDetailsPane.class, "isPreferredSizeSet", null ); - properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", QCDetailsPane.class, "getCursor", "setCursor" ); - properties[PROPERTY_managingFocus] = new PropertyDescriptor ( "managingFocus", QCDetailsPane.class, "isManagingFocus", null ); - properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", QCDetailsPane.class, "getInsets", null ); - properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", QCDetailsPane.class, "getComponentOrientation", "setComponentOrientation" ); - properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", QCDetailsPane.class, "getComponentCount", null ); - properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", QCDetailsPane.class, "getRootPane", null ); - properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", QCDetailsPane.class, "getAccessibleContext", null ); - properties[PROPERTY_selectedObjects] = new PropertyDescriptor ( "selectedObjects", QCDetailsPane.class, "getSelectedObjects", null ); - properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", QCDetailsPane.class, "getDropTarget", "setDropTarget" ); - properties[PROPERTY_confirm] = new PropertyDescriptor ( "confirm", QCDetailsPane.class, "getConfirm", "setConfirm" ); - properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", QCDetailsPane.class, null, null, "getComponent", null ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Properties - - // Here you can add code for customizing the properties array. - -}//GEN-LAST:Properties - - // EventSet identifiers//GEN-FIRST:Events - private static final int EVENT_mouseMotionListener = 0; - private static final int EVENT_inputMethodListener = 1; - private static final int EVENT_ancestorListener = 2; - private static final int EVENT_componentListener = 3; - private static final int EVENT_hierarchyBoundsListener = 4; - private static final int EVENT_mouseListener = 5; - private static final int EVENT_focusListener = 6; - private static final int EVENT_listSelectionListener = 7; - private static final int EVENT_propertyChangeListener = 8; - private static final int EVENT_keyListener = 9; - private static final int EVENT_hierarchyListener = 10; - private static final int EVENT_containerListener = 11; - private static final int EVENT_vetoableChangeListener = 12; - private static final int EVENT_errorListener = 13; - - // EventSet array - private static EventSetDescriptor[] eventSets = new EventSetDescriptor[14]; - - static { - try { - eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( QCDetailsPane.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[0], "addMouseMotionListener", "removeMouseMotionListener" ); - eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( QCDetailsPane.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[0], "addInputMethodListener", "removeInputMethodListener" ); - eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( QCDetailsPane.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[0], "addAncestorListener", "removeAncestorListener" ); - eventSets[EVENT_componentListener] = new EventSetDescriptor ( QCDetailsPane.class, "componentListener", java.awt.event.ComponentListener.class, new String[0], "addComponentListener", "removeComponentListener" ); - eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( QCDetailsPane.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[0], "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); - eventSets[EVENT_mouseListener] = new EventSetDescriptor ( QCDetailsPane.class, "mouseListener", java.awt.event.MouseListener.class, new String[0], "addMouseListener", "removeMouseListener" ); - eventSets[EVENT_focusListener] = new EventSetDescriptor ( QCDetailsPane.class, "focusListener", java.awt.event.FocusListener.class, new String[0], "addFocusListener", "removeFocusListener" ); - eventSets[EVENT_listSelectionListener] = new EventSetDescriptor ( QCDetailsPane.class, "listSelectionListener", javax.swing.event.ListSelectionListener.class, new String[0], "addListSelectionListener", "removeListSelectionListener" ); - eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( QCDetailsPane.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[0], "addPropertyChangeListener", "removePropertyChangeListener" ); - eventSets[EVENT_keyListener] = new EventSetDescriptor ( QCDetailsPane.class, "keyListener", java.awt.event.KeyListener.class, new String[0], "addKeyListener", "removeKeyListener" ); - eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( QCDetailsPane.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[0], "addHierarchyListener", "removeHierarchyListener" ); - eventSets[EVENT_containerListener] = new EventSetDescriptor ( QCDetailsPane.class, "containerListener", java.awt.event.ContainerListener.class, new String[0], "addContainerListener", "removeContainerListener" ); - eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( QCDetailsPane.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[0], "addVetoableChangeListener", "removeVetoableChangeListener" ); - eventSets[EVENT_errorListener] = new EventSetDescriptor ( QCDetailsPane.class, "errorListener", com.ibm.as400.vaccess.ErrorListener.class, new String[0], "addErrorListener", "removeErrorListener" ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Events - - // Here you can add code for customizing the event sets array. - -}//GEN-LAST:Events - - private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef - private static java.awt.Image iconColor32 = null; - private static java.awt.Image iconMono16 = null; - private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef - private static String iconNameC16 = null;//GEN-BEGIN:Icons - private static String iconNameC32 = null; - private static String iconNameM16 = null; - private static String iconNameM32 = null;//GEN-END:Icons - - private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx - private static int defaultEventIndex = -1;//GEN-END:Idx - - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

- * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } - - /** - * Gets the beans EventSetDescriptors. - * - * @return An array of EventSetDescriptors describing the kinds of - * events fired by this bean. May return null if the information - * should be obtained by automatic analysis. - */ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSets; - } - - /** - * A bean may have a "default" property that is the property that will - * mostly commonly be initially chosen for update by human's who are - * customizing the bean. - * @return Index of default property in the PropertyDescriptor array - * returned by getPropertyDescriptors. - *

Returns -1 if there is no default property. - */ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** - * A bean may have a "default" event that is the event that will - * mostly commonly be used by human's when using the bean. - * @return Index of default event in the EventSetDescriptor array - * returned by getEventSetDescriptors. - *

Returns -1 if there is no default event. - */ - public int getDefaultEventIndex() { - return defaultPropertyIndex; - } - - /** - * This method returns an image object that can be used to - * represent the bean in toolboxes, toolbars, etc. Icon images - * will typically be GIFs, but may in future include other formats. - *

- * Beans aren't required to provide icons and may return null from - * this method. - *

- * There are four possible flavors of icons (16x16 color, - * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only - * support a single icon we recommend supporting 16x16 color. - *

- * We recommend that icons have a "transparent" background - * so they can be rendered onto an existing background. - * - * @param iconKind The kind of icon requested. This should be - * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, - * ICON_MONO_16x16, or ICON_MONO_32x32. - * @return An image object representing the requested icon. May - * return null if no suitable icon is available. - */ - public java.awt.Image getIcon(int iconKind) { - switch ( iconKind ) { - case ICON_COLOR_16x16: - if ( iconNameC16 == null ) - return null; - else { - if( iconColor16 == null ) - iconColor16 = loadImage( iconNameC16 ); - return iconColor16; - } - case ICON_COLOR_32x32: - if ( iconNameC32 == null ) - return null; - else { - if( iconColor32 == null ) - iconColor32 = loadImage( iconNameC32 ); - return iconColor32; - } - case ICON_MONO_16x16: - if ( iconNameM16 == null ) - return null; - else { - if( iconMono16 == null ) - iconMono16 = loadImage( iconNameM16 ); - return iconMono16; - } - case ICON_MONO_32x32: - if ( iconNameM32 == null ) - return null; - else { - if( iconNameM32 == null ) - iconMono32 = loadImage( iconNameM32 ); - return iconMono32; - } - } - return null; - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCExplorerPane.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCExplorerPane.java deleted file mode 100644 index 1598637f7..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCExplorerPane.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * QCExplorerPane.java - * - * A wrapper around com.ibm.as400.vaccess.AS400ExplorerPane to - * allow us to polymorphically switch panes in a panel. - * - * Created on July 16, 2000, 2:06 AM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** A wrapper around a JTOpen pane type to allow polymorphism. - * @author jax - * @version 1.0 - */ -public class QCExplorerPane extends com.ibm.as400.vaccess.AS400ExplorerPane implements QCVNodeDisplayer { - - /** Creates new QCExplorer */ - public QCExplorerPane() { - } - - /** Sets the node as root for the pane. - * @param v The VNode to be setRoot by the pane. - */ - public void setRoot(com.ibm.as400.vaccess.VNode v) { - try { - super.setRoot(v); - } - catch (java.beans.PropertyVetoException e) { - e.printStackTrace(); - } - } - - /** Add the pane to the Container. - * @param c The Container to be added to. - */ - public void addTo(java.awt.Container c) { - c.add(this); - } - - /** Add error dialog as listener. - * @param eda The ErrorDialogAdapter to add. - */ - public void addErrorListener(com.ibm.as400.vaccess.ErrorDialogAdapter eda) { - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCExplorerPaneBeanInfo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCExplorerPaneBeanInfo.java deleted file mode 100644 index c727b213e..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCExplorerPaneBeanInfo.java +++ /dev/null @@ -1,343 +0,0 @@ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.beans.*; - -public class QCExplorerPaneBeanInfo extends SimpleBeanInfo { - - // Property identifiers //GEN-FIRST:Properties - private static final int PROPERTY_parent = 0; - private static final int PROPERTY_focusCycleRoot = 1; - private static final int PROPERTY_class = 2; - private static final int PROPERTY_validateRoot = 3; - private static final int PROPERTY_visible = 4; - private static final int PROPERTY_actionMap = 5; - private static final int PROPERTY_toolTipText = 6; - private static final int PROPERTY_focusTraversable = 7; - private static final int PROPERTY_inputMethodRequests = 8; - private static final int PROPERTY_insets = 9; - private static final int PROPERTY_requestFocusEnabled = 10; - private static final int PROPERTY_actionContext = 11; - private static final int PROPERTY_visibleRect = 12; - private static final int PROPERTY_minimumSize = 13; - private static final int PROPERTY_locale = 14; - private static final int PROPERTY_paintingTile = 15; - private static final int PROPERTY_showing = 16; - private static final int PROPERTY_componentOrientation = 17; - private static final int PROPERTY_inputVerifier = 18; - private static final int PROPERTY_y = 19; - private static final int PROPERTY_root = 20; - private static final int PROPERTY_x = 21; - private static final int PROPERTY_treeModel = 22; - private static final int PROPERTY_selectedObject = 23; - private static final int PROPERTY_dropTarget = 24; - private static final int PROPERTY_layout = 25; - private static final int PROPERTY_toolkit = 26; - private static final int PROPERTY_components = 27; - private static final int PROPERTY_background = 28; - private static final int PROPERTY_foreground = 29; - private static final int PROPERTY_allowActions = 30; - private static final int PROPERTY_valid = 31; - private static final int PROPERTY_maximumSizeSet = 32; - private static final int PROPERTY_inputContext = 33; - private static final int PROPERTY_detailsColumnModel = 34; - private static final int PROPERTY_bounds = 35; - private static final int PROPERTY_rootPane = 36; - private static final int PROPERTY_accessibleContext = 37; - private static final int PROPERTY_name = 38; - private static final int PROPERTY_graphics = 39; - private static final int PROPERTY_treeSelectionModel = 40; - private static final int PROPERTY_font = 41; - private static final int PROPERTY_displayable = 42; - private static final int PROPERTY_preferredSize = 43; - private static final int PROPERTY_doubleBuffered = 44; - private static final int PROPERTY_lightweight = 45; - private static final int PROPERTY_enabled = 46; - private static final int PROPERTY_UIClassID = 47; - private static final int PROPERTY_border = 48; - private static final int PROPERTY_minimumSizeSet = 49; - private static final int PROPERTY_autoscrolls = 50; - private static final int PROPERTY_colorModel = 51; - private static final int PROPERTY_confirm = 52; - private static final int PROPERTY_locationOnScreen = 53; - private static final int PROPERTY_debugGraphicsOptions = 54; - private static final int PROPERTY_height = 55; - private static final int PROPERTY_detailsRoot = 56; - private static final int PROPERTY_cursor = 57; - private static final int PROPERTY_width = 58; - private static final int PROPERTY_graphicsConfiguration = 59; - private static final int PROPERTY_opaque = 60; - private static final int PROPERTY_detailsSelectionModel = 61; - private static final int PROPERTY_selectedObjects = 62; - private static final int PROPERTY_registeredKeyStrokes = 63; - private static final int PROPERTY_componentCount = 64; - private static final int PROPERTY_maximumSize = 65; - private static final int PROPERTY_treeLock = 66; - private static final int PROPERTY_nextFocusableComponent = 67; - private static final int PROPERTY_verifyInputWhenFocusTarget = 68; - private static final int PROPERTY_managingFocus = 69; - private static final int PROPERTY_peer = 70; - private static final int PROPERTY_optimizedDrawingEnabled = 71; - private static final int PROPERTY_topLevelAncestor = 72; - private static final int PROPERTY_preferredSizeSet = 73; - private static final int PROPERTY_alignmentY = 74; - private static final int PROPERTY_alignmentX = 75; - private static final int PROPERTY_detailsModel = 76; - private static final int PROPERTY_component = 77; - - // Property array - private static PropertyDescriptor[] properties = new PropertyDescriptor[78]; - - static { - try { - properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", QCExplorerPane.class, "getParent", null ); - properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor ( "focusCycleRoot", QCExplorerPane.class, "isFocusCycleRoot", null ); - properties[PROPERTY_class] = new PropertyDescriptor ( "class", QCExplorerPane.class, "getClass", null ); - properties[PROPERTY_validateRoot] = new PropertyDescriptor ( "validateRoot", QCExplorerPane.class, "isValidateRoot", null ); - properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", QCExplorerPane.class, "isVisible", "setVisible" ); - properties[PROPERTY_actionMap] = new PropertyDescriptor ( "actionMap", QCExplorerPane.class, "getActionMap", "setActionMap" ); - properties[PROPERTY_toolTipText] = new PropertyDescriptor ( "toolTipText", QCExplorerPane.class, "getToolTipText", "setToolTipText" ); - properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", QCExplorerPane.class, "isFocusTraversable", null ); - properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", QCExplorerPane.class, "getInputMethodRequests", null ); - properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", QCExplorerPane.class, "getInsets", null ); - properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor ( "requestFocusEnabled", QCExplorerPane.class, "isRequestFocusEnabled", "setRequestFocusEnabled" ); - properties[PROPERTY_actionContext] = new PropertyDescriptor ( "actionContext", QCExplorerPane.class, "getActionContext", null ); - properties[PROPERTY_visibleRect] = new PropertyDescriptor ( "visibleRect", QCExplorerPane.class, "getVisibleRect", null ); - properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", QCExplorerPane.class, "getMinimumSize", "setMinimumSize" ); - properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", QCExplorerPane.class, "getLocale", "setLocale" ); - properties[PROPERTY_paintingTile] = new PropertyDescriptor ( "paintingTile", QCExplorerPane.class, "isPaintingTile", null ); - properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", QCExplorerPane.class, "isShowing", null ); - properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", QCExplorerPane.class, "getComponentOrientation", "setComponentOrientation" ); - properties[PROPERTY_inputVerifier] = new PropertyDescriptor ( "inputVerifier", QCExplorerPane.class, "getInputVerifier", "setInputVerifier" ); - properties[PROPERTY_y] = new PropertyDescriptor ( "y", QCExplorerPane.class, "getY", null ); - properties[PROPERTY_root] = new PropertyDescriptor ( "root", QCExplorerPane.class, "getRoot", "setRoot" ); - properties[PROPERTY_x] = new PropertyDescriptor ( "x", QCExplorerPane.class, "getX", null ); - properties[PROPERTY_treeModel] = new PropertyDescriptor ( "treeModel", QCExplorerPane.class, "getTreeModel", null ); - properties[PROPERTY_selectedObject] = new PropertyDescriptor ( "selectedObject", QCExplorerPane.class, "getSelectedObject", null ); - properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", QCExplorerPane.class, "getDropTarget", "setDropTarget" ); - properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", QCExplorerPane.class, "getLayout", "setLayout" ); - properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", QCExplorerPane.class, "getToolkit", null ); - properties[PROPERTY_components] = new PropertyDescriptor ( "components", QCExplorerPane.class, "getComponents", null ); - properties[PROPERTY_background] = new PropertyDescriptor ( "background", QCExplorerPane.class, "getBackground", "setBackground" ); - properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", QCExplorerPane.class, "getForeground", "setForeground" ); - properties[PROPERTY_allowActions] = new PropertyDescriptor ( "allowActions", QCExplorerPane.class, "getAllowActions", "setAllowActions" ); - properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", QCExplorerPane.class, "isValid", null ); - properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor ( "maximumSizeSet", QCExplorerPane.class, "isMaximumSizeSet", null ); - properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", QCExplorerPane.class, "getInputContext", null ); - properties[PROPERTY_detailsColumnModel] = new PropertyDescriptor ( "detailsColumnModel", QCExplorerPane.class, "getDetailsColumnModel", null ); - properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", QCExplorerPane.class, "getBounds", "setBounds" ); - properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", QCExplorerPane.class, "getRootPane", null ); - properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", QCExplorerPane.class, "getAccessibleContext", null ); - properties[PROPERTY_name] = new PropertyDescriptor ( "name", QCExplorerPane.class, "getName", "setName" ); - properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", QCExplorerPane.class, "getGraphics", null ); - properties[PROPERTY_treeSelectionModel] = new PropertyDescriptor ( "treeSelectionModel", QCExplorerPane.class, "getTreeSelectionModel", "setTreeSelectionModel" ); - properties[PROPERTY_font] = new PropertyDescriptor ( "font", QCExplorerPane.class, "getFont", "setFont" ); - properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", QCExplorerPane.class, "isDisplayable", null ); - properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", QCExplorerPane.class, "getPreferredSize", "setPreferredSize" ); - properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", QCExplorerPane.class, "isDoubleBuffered", "setDoubleBuffered" ); - properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", QCExplorerPane.class, "isLightweight", null ); - properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", QCExplorerPane.class, "isEnabled", "setEnabled" ); - properties[PROPERTY_UIClassID] = new PropertyDescriptor ( "UIClassID", QCExplorerPane.class, "getUIClassID", null ); - properties[PROPERTY_border] = new PropertyDescriptor ( "border", QCExplorerPane.class, "getBorder", "setBorder" ); - properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor ( "minimumSizeSet", QCExplorerPane.class, "isMinimumSizeSet", null ); - properties[PROPERTY_autoscrolls] = new PropertyDescriptor ( "autoscrolls", QCExplorerPane.class, "getAutoscrolls", "setAutoscrolls" ); - properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", QCExplorerPane.class, "getColorModel", null ); - properties[PROPERTY_confirm] = new PropertyDescriptor ( "confirm", QCExplorerPane.class, "getConfirm", "setConfirm" ); - properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", QCExplorerPane.class, "getLocationOnScreen", null ); - properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor ( "debugGraphicsOptions", QCExplorerPane.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions" ); - properties[PROPERTY_height] = new PropertyDescriptor ( "height", QCExplorerPane.class, "getHeight", null ); - properties[PROPERTY_detailsRoot] = new PropertyDescriptor ( "detailsRoot", QCExplorerPane.class, "getDetailsRoot", null ); - properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", QCExplorerPane.class, "getCursor", "setCursor" ); - properties[PROPERTY_width] = new PropertyDescriptor ( "width", QCExplorerPane.class, "getWidth", null ); - properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", QCExplorerPane.class, "getGraphicsConfiguration", null ); - properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", QCExplorerPane.class, "isOpaque", "setOpaque" ); - properties[PROPERTY_detailsSelectionModel] = new PropertyDescriptor ( "detailsSelectionModel", QCExplorerPane.class, "getDetailsSelectionModel", "setDetailsSelectionModel" ); - properties[PROPERTY_selectedObjects] = new PropertyDescriptor ( "selectedObjects", QCExplorerPane.class, "getSelectedObjects", null ); - properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor ( "registeredKeyStrokes", QCExplorerPane.class, "getRegisteredKeyStrokes", null ); - properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", QCExplorerPane.class, "getComponentCount", null ); - properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", QCExplorerPane.class, "getMaximumSize", "setMaximumSize" ); - properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", QCExplorerPane.class, "getTreeLock", null ); - properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor ( "nextFocusableComponent", QCExplorerPane.class, "getNextFocusableComponent", "setNextFocusableComponent" ); - properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor ( "verifyInputWhenFocusTarget", QCExplorerPane.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget" ); - properties[PROPERTY_managingFocus] = new PropertyDescriptor ( "managingFocus", QCExplorerPane.class, "isManagingFocus", null ); - properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", QCExplorerPane.class, "getPeer", null ); - properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor ( "optimizedDrawingEnabled", QCExplorerPane.class, "isOptimizedDrawingEnabled", null ); - properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor ( "topLevelAncestor", QCExplorerPane.class, "getTopLevelAncestor", null ); - properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor ( "preferredSizeSet", QCExplorerPane.class, "isPreferredSizeSet", null ); - properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", QCExplorerPane.class, "getAlignmentY", "setAlignmentY" ); - properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", QCExplorerPane.class, "getAlignmentX", "setAlignmentX" ); - properties[PROPERTY_detailsModel] = new PropertyDescriptor ( "detailsModel", QCExplorerPane.class, "getDetailsModel", null ); - properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", QCExplorerPane.class, null, null, "getComponent", null ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Properties - - // Here you can add code for customizing the properties array. - -}//GEN-LAST:Properties - - // EventSet identifiers//GEN-FIRST:Events - private static final int EVENT_mouseMotionListener = 0; - private static final int EVENT_ancestorListener = 1; - private static final int EVENT_inputMethodListener = 2; - private static final int EVENT_componentListener = 3; - private static final int EVENT_hierarchyBoundsListener = 4; - private static final int EVENT_focusListener = 5; - private static final int EVENT_mouseListener = 6; - private static final int EVENT_listSelectionListener = 7; - private static final int EVENT_treeSelectionListener = 8; - private static final int EVENT_propertyChangeListener = 9; - private static final int EVENT_keyListener = 10; - private static final int EVENT_hierarchyListener = 11; - private static final int EVENT_containerListener = 12; - private static final int EVENT_vetoableChangeListener = 13; - private static final int EVENT_errorListener = 14; - - // EventSet array - private static EventSetDescriptor[] eventSets = new EventSetDescriptor[15]; - - static { - try { - eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( QCExplorerPane.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[0], "addMouseMotionListener", "removeMouseMotionListener" ); - eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( QCExplorerPane.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[0], "addAncestorListener", "removeAncestorListener" ); - eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( QCExplorerPane.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[0], "addInputMethodListener", "removeInputMethodListener" ); - eventSets[EVENT_componentListener] = new EventSetDescriptor ( QCExplorerPane.class, "componentListener", java.awt.event.ComponentListener.class, new String[0], "addComponentListener", "removeComponentListener" ); - eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( QCExplorerPane.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[0], "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); - eventSets[EVENT_focusListener] = new EventSetDescriptor ( QCExplorerPane.class, "focusListener", java.awt.event.FocusListener.class, new String[0], "addFocusListener", "removeFocusListener" ); - eventSets[EVENT_mouseListener] = new EventSetDescriptor ( QCExplorerPane.class, "mouseListener", java.awt.event.MouseListener.class, new String[0], "addMouseListener", "removeMouseListener" ); - eventSets[EVENT_listSelectionListener] = new EventSetDescriptor ( QCExplorerPane.class, "listSelectionListener", javax.swing.event.ListSelectionListener.class, new String[0], "addListSelectionListener", "removeListSelectionListener" ); - eventSets[EVENT_treeSelectionListener] = new EventSetDescriptor ( QCExplorerPane.class, "treeSelectionListener", javax.swing.event.TreeSelectionListener.class, new String[0], "addTreeSelectionListener", "removeTreeSelectionListener" ); - eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( QCExplorerPane.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[0], "addPropertyChangeListener", "removePropertyChangeListener" ); - eventSets[EVENT_keyListener] = new EventSetDescriptor ( QCExplorerPane.class, "keyListener", java.awt.event.KeyListener.class, new String[0], "addKeyListener", "removeKeyListener" ); - eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( QCExplorerPane.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[0], "addHierarchyListener", "removeHierarchyListener" ); - eventSets[EVENT_containerListener] = new EventSetDescriptor ( QCExplorerPane.class, "containerListener", java.awt.event.ContainerListener.class, new String[0], "addContainerListener", "removeContainerListener" ); - eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( QCExplorerPane.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[0], "addVetoableChangeListener", "removeVetoableChangeListener" ); - eventSets[EVENT_errorListener] = new EventSetDescriptor ( QCExplorerPane.class, "errorListener", com.ibm.as400.vaccess.ErrorListener.class, new String[0], "addErrorListener", "removeErrorListener" ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Events - - // Here you can add code for customizing the event sets array. - -}//GEN-LAST:Events - - private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef - private static java.awt.Image iconColor32 = null; - private static java.awt.Image iconMono16 = null; - private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef - private static String iconNameC16 = null;//GEN-BEGIN:Icons - private static String iconNameC32 = null; - private static String iconNameM16 = null; - private static String iconNameM32 = null;//GEN-END:Icons - - private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx - private static int defaultEventIndex = -1;//GEN-END:Idx - - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

- * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } - - /** - * Gets the beans EventSetDescriptors. - * - * @return An array of EventSetDescriptors describing the kinds of - * events fired by this bean. May return null if the information - * should be obtained by automatic analysis. - */ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSets; - } - - /** - * A bean may have a "default" property that is the property that will - * mostly commonly be initially chosen for update by human's who are - * customizing the bean. - * @return Index of default property in the PropertyDescriptor array - * returned by getPropertyDescriptors. - *

Returns -1 if there is no default property. - */ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** - * A bean may have a "default" event that is the event that will - * mostly commonly be used by human's when using the bean. - * @return Index of default event in the EventSetDescriptor array - * returned by getEventSetDescriptors. - *

Returns -1 if there is no default event. - */ - public int getDefaultEventIndex() { - return defaultPropertyIndex; - } - - /** - * This method returns an image object that can be used to - * represent the bean in toolboxes, toolbars, etc. Icon images - * will typically be GIFs, but may in future include other formats. - *

- * Beans aren't required to provide icons and may return null from - * this method. - *

- * There are four possible flavors of icons (16x16 color, - * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only - * support a single icon we recommend supporting 16x16 color. - *

- * We recommend that icons have a "transparent" background - * so they can be rendered onto an existing background. - * - * @param iconKind The kind of icon requested. This should be - * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, - * ICON_MONO_16x16, or ICON_MONO_32x32. - * @return An image object representing the requested icon. May - * return null if no suitable icon is available. - */ - public java.awt.Image getIcon(int iconKind) { - switch ( iconKind ) { - case ICON_COLOR_16x16: - if ( iconNameC16 == null ) - return null; - else { - if( iconColor16 == null ) - iconColor16 = loadImage( iconNameC16 ); - return iconColor16; - } - case ICON_COLOR_32x32: - if ( iconNameC32 == null ) - return null; - else { - if( iconColor32 == null ) - iconColor32 = loadImage( iconNameC32 ); - return iconColor32; - } - case ICON_MONO_16x16: - if ( iconNameM16 == null ) - return null; - else { - if( iconMono16 == null ) - iconMono16 = loadImage( iconNameM16 ); - return iconMono16; - } - case ICON_MONO_32x32: - if ( iconNameM32 == null ) - return null; - else { - if( iconNameM32 == null ) - iconMono32 = loadImage( iconNameM32 ); - return iconMono32; - } - } - return null; - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCHash.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCHash.java deleted file mode 100644 index 65b56d0c0..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCHash.java +++ /dev/null @@ -1,172 +0,0 @@ -/* QCHash.java -- contain AS400 instances - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.util.*; -import com.ibm.as400.access.*; - -public class QCHash extends Object -{ - private Hashtable serverInstances = new Hashtable(); - -public QCHash () {} - - /** Returns a string representation of the Hash and its members. - * @return A String representation. - */ - public String toString() { - StringBuffer result = new StringBuffer(); - for (Enumeration e = serverInstances.elements() ; e.hasMoreElements() ;) - { - result.append(e.nextElement().toString()); - } /* End for*/ - result.append(super.toString()); - return new String(result); - } - - protected void finalize () throws Throwable - { /* Called by garbage collector in case no longer referenced*/ - super.finalize(); - } - - /** Clear all keys */ - public void clear () throws UnsupportedOperationException -{ serverInstances.clear(); } - - /** Map in an object */ - public AS400 put(String key, AS400 object) { - return (AS400) serverInstances.put(key, object); - } - - /** Get a server by name */ - public AS400 get(String key) { - return (AS400) serverInstances.get(key); - } - - /** Remove a server by name */ - public AS400 remove(String key) { - return (AS400) serverInstances.remove(key); - } - - /** Contains the server named? */ - public boolean containsServerNamed (String key) { - return serverInstances.containsKey(key); - } - - /** Contains reference to the identical unique AS400 object */ - public boolean containsServer(AS400 as400) { - return serverInstances.containsValue(as400); - } - - /** Number of elements */ -public int size () { return serverInstances.size();} - - /** Enumeration of keys */ -public Enumeration keys () { return serverInstances.keys();} - - /** Enumeration of elements elements */ -public Enumeration elements () { return serverInstances.elements();} - - /** Is empty? */ -public boolean isEmpty () { return serverInstances.isEmpty();} - - /** Test QCHash */ - public static void main (String argv[]) { - AS400 moe = new AS400("MOE"); - AS400 joe = new AS400("JOE"); - - QCHash qchash = new QCHash(); - - System.out.println("Adding MOE"); - qchash.put("Moe", moe); - - System.out.println("Adding JOE"); - qchash.put("Joe", joe); - - System.out.println("Does the QCHash contain Moe?"); - if (qchash.containsServerNamed("Moe")) - { - System.out.println("Yes."); - } - else - { - System.out.println("No."); - } /* End if*/ - - System.out.println("Does the QCHash contain Joe?"); - if (qchash.containsServerNamed("Joe")) - { - System.out.println("Yes."); - } - else - { - System.out.println("No."); - } /* End if*/ - - System.out.println("Joe as string:"); - System.out.println(qchash.get("Joe").toString()); - - System.out.println("Moe as string:"); - System.out.println(qchash.get("Moe").toString()); - - System.out.println("QCHash to string."); - System.out.println(qchash.toString()); - - System.out.println("Removing Moe"); - qchash.remove("Moe"); - - System.out.println("Does the QCHash contain Moe?"); - if (qchash.containsServerNamed("Moe")) - { - System.out.println("Yes."); - } - else - { - System.out.println("No."); - } /* End if*/ - - System.out.println("Does the QCHash contain Joe?"); - if (qchash.containsServerNamed("Joe")) - { - System.out.println("Yes."); - } - else - { - System.out.println("No."); - } /* End if*/ - - System.out.println("Removing Joe"); - qchash.remove("Joe"); - - System.out.println("Does the QCHash contain Moe?"); - if (qchash.containsServerNamed("Moe")) - { - System.out.println("Yes."); - } - else - { - System.out.println("No."); - } /* End if*/ - - System.out.println("Does the QCHash contain Joe?"); - if (qchash.containsServerNamed("Joe")) - { - System.out.println("Yes."); - } - else - { - System.out.println("No."); - } /* End if*/ - - System.out.println(""); - System.out.println(""); - System.out.println(""); - System.out.println(""); - - } -} /* End of QCHash class*/ diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCIFSPanel.form b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCIFSPanel.form deleted file mode 100644 index 19a368c16..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCIFSPanel.form +++ /dev/null @@ -1,165 +0,0 @@ - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCIFSPanel.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCIFSPanel.java deleted file mode 100644 index 5fb799930..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCIFSPanel.java +++ /dev/null @@ -1,392 +0,0 @@ -/* - * IFSPanel.java - * - * Created on July 15, 2000, 3:30 PM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** Panel to hold AS400IFSDirectory. Has extra interior panel to change the display - * pane. - * @author jax - * @version 1.0 - */ -public class QCIFSPanel extends javax.swing.JPanel implements com.SoftWoehr.JTOpenContrib.QCDemo.QCServiceClient { - - private QCMgr manager; - private java.lang.String serverName; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCServiceRecord serviceRecord; - private com.ibm.as400.vaccess.ErrorDialogAdapter errorDialogAdapter; - - /** Holds the transient pane since we allow users to switch pane types. - * The member as400ExplorerPane is an artifact of the IDE. - * NOT CURRENTLY USED. - */ - private QCVNodeDisplayer browsingPane; - - /** Creates new form IFSPanel */ - public QCIFSPanel() { - initComponents (); - QCExplorerPane ep = new QCExplorerPane(); - aS400ExplorerPane1 = ep; // Chuck the pane the IDE adds to the code. - browsingPane = ep; // From now on, "browsingPane" is the view. - jPanel1.removeAll(); - ep.addTo(jPanel1); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the FormEditor. - */ - private void initComponents () {//GEN-BEGIN:initComponents - vIFSDirectory = new com.ibm.as400.vaccess.VIFSDirectory (); - jPanel1 = new javax.swing.JPanel (); - aS400ExplorerPane1 = new com.ibm.as400.vaccess.AS400ExplorerPane (); - jPanel2 = new javax.swing.JPanel (); - pathButton = new javax.swing.JButton (); - pathTextField = new javax.swing.JTextField (); - systemButton = new javax.swing.JButton (); - systemTextField = new javax.swing.JTextField (); - jPanel3 = new javax.swing.JPanel (); - explorerButton = new javax.swing.JButton (); - detailsButton = new javax.swing.JButton (); - listButton = new javax.swing.JButton (); - treeButton = new javax.swing.JButton (); - - setLayout (new java.awt.BorderLayout ()); - - jPanel1.setToolTipText ("Offers different views of the Integrated File System."); - - - jPanel1.add (aS400ExplorerPane1); - - - add (jPanel1, java.awt.BorderLayout.CENTER); - - jPanel2.setLayout (new java.awt.GridLayout (2, 2)); - - pathButton.setToolTipText ("Click to set the path to the IFS path you entered."); - pathButton.setText ("Set IFS Path"); - pathButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - pathButtonActionPerformed (evt); - } - } - ); - - jPanel2.add (pathButton); - - pathTextField.setToolTipText ("Enter the IFS path you wish to browse."); - pathTextField.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - pathTextFieldActionPerformed (evt); - } - } - ); - - jPanel2.add (pathTextField); - - systemButton.setToolTipText ("Click to set the system to the name you entered."); - systemButton.setText ("Set System"); - systemButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - systemButtonActionPerformed (evt); - } - } - ); - - jPanel2.add (systemButton); - - systemTextField.setToolTipText ("Enter the name of the system you wish to browse."); - systemTextField.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - systemTextFieldActionPerformed (evt); - } - } - ); - - jPanel2.add (systemTextField); - - - add (jPanel2, java.awt.BorderLayout.SOUTH); - - jPanel3.setLayout (new java.awt.GridLayout (1, 4)); - - explorerButton.setToolTipText ("Set the view to an explorer view."); - explorerButton.setText ("Explorer"); - explorerButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - explorerButtonActionPerformed (evt); - } - } - ); - - jPanel3.add (explorerButton); - - detailsButton.setToolTipText ("Set the view to a details view."); - detailsButton.setText ("Details"); - detailsButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - detailsButtonActionPerformed (evt); - } - } - ); - - jPanel3.add (detailsButton); - - listButton.setToolTipText ("Set the view to a list view."); - listButton.setText ("List"); - listButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - listButtonActionPerformed (evt); - } - } - ); - - jPanel3.add (listButton); - - treeButton.setToolTipText ("Set the view to a tree view."); - treeButton.setText ("Tree"); - treeButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - treeButtonActionPerformed (evt); - } - } - ); - - jPanel3.add (treeButton); - - - add (jPanel3, java.awt.BorderLayout.NORTH); - - }//GEN-END:initComponents - - // Pushing the button and hitting ENTER in the corresponding field produces the same result. - private void pathTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pathTextFieldActionPerformed - // Add your handling code here: - pathButtonActionPerformed(evt); - }//GEN-LAST:event_pathTextFieldActionPerformed - // Pushing the button and hitting ENTER in the corresponding field produces the same result. - private void systemTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_systemTextFieldActionPerformed - // Add your handling code here: - systemButtonActionPerformed (evt); - }//GEN-LAST:event_systemTextFieldActionPerformed - // Change view style. - private void treeButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_treeButtonActionPerformed - // Add your handling code here: - // Changing the view can take some time. - java.awt.Cursor currentCursor = getCursor(); - setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR)); - reinstanceBrowsingPane(new QCTreePane()); - // The wait is over. - setCursor(currentCursor); - repaint(1000); - }//GEN-LAST:event_treeButtonActionPerformed - // Change view style. - private void listButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_listButtonActionPerformed - // Add your handling code here: - // Changing the view can take some time. - java.awt.Cursor currentCursor = getCursor(); - setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR)); - reinstanceBrowsingPane(new QCListPane()); - // The wait is over. - setCursor(currentCursor); - repaint(1000); - }//GEN-LAST:event_listButtonActionPerformed - // Change view style. - private void detailsButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_detailsButtonActionPerformed - // Add your handling code here: - // Changing the view can take some time. - java.awt.Cursor currentCursor = getCursor(); - setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR)); - reinstanceBrowsingPane(new QCDetailsPane()); - // The wait is over. - setCursor(currentCursor); - repaint(1000); - }//GEN-LAST:event_detailsButtonActionPerformed - // Change view style. - private void explorerButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_explorerButtonActionPerformed - // Add your handling code here: - // Changing the view can take some time. - java.awt.Cursor currentCursor = getCursor(); - setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR)); - reinstanceBrowsingPane(new QCExplorerPane()); - // The wait is over. - setCursor(currentCursor); - repaint(1000); - }//GEN-LAST:event_explorerButtonActionPerformed - // Pushing the button and hitting ENTER in the corresponding field produces the same result. - private void systemButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_systemButtonActionPerformed - // Add your handling code here: - reinstanceServerFromTextEntry(); - }//GEN-LAST:event_systemButtonActionPerformed - // Pushing the button and hitting ENTER in the corresponding field produces the same result. - private void pathButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pathButtonActionPerformed - // Add your handling code here: - - // Make sure we have a system. - reinstanceServerFromTextEntry(); - - // Loading the directory can take some time! - java.awt.Cursor currentCursor = getCursor(); - setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR)); - - // Can't change path of a loaded VIFSDirectory. - // Might as well each time re-instance the VIFSDirectory - // since pushing the button requests a reload anyway. - reinstanceIFSDirectory(); - - try - { - loadPath(); - }/* End try*/ - - catch (Exception e) - { - e.printStackTrace(System.err); - }/* End catch*/ - - // setExplorerPaneRoot() - setBrowserPaneRoot(); - - // The wait is over. - setCursor(currentCursor); - - }//GEN-LAST:event_pathButtonActionPerformed - - private synchronized void reinstanceBrowsingPane(QCVNodeDisplayer vnd) { - jPanel1.removeAll(); // Discard current display pane. - - browsingPane = vnd; // Instance our variable of record. - - setBrowserPaneRoot(); // Apply the vnode. - - if (null != errorDialogAdapter) { // Add the error listener. - browsingPane.addErrorListener(errorDialogAdapter); - } - - browsingPane.addTo(jPanel1); // Add pane to visible display. - } - - private synchronized void reinstanceServerFromTextEntry() { - String newName = systemTextField.getText(); - if (null == serverName) { - serverName = ""; - } - if (null != newName) { - if (!newName.equals("")) { - if (!newName.equals(serverName)) { - serverName = newName; - if (null != serviceRecord) { - - try { // let go of the service from manager - manager.freeService(serviceRecord); - } - catch (Exception e) { - e.printStackTrace(); - } - serviceRecord = null; - } - try { - serviceRecord = manager.getService("qcmgr:" + serverName + "/FILE", this); - } - catch (Exception e) { - e.printStackTrace(); - } - } - } - } - } - - private synchronized void reinstanceIFSDirectory () { - vIFSDirectory = new com.ibm.as400.vaccess.VIFSDirectory(); - if (null != serviceRecord) { - try { - vIFSDirectory.setSystem(serviceRecord.as400); - } - catch (java.beans.PropertyVetoException e) { - e.printStackTrace(); - } - } - setPath(); - if (null != errorDialogAdapter) { - vIFSDirectory.addErrorListener(errorDialogAdapter); - } - } - - private void setExplorerPaneRoot() { - if (null != vIFSDirectory) { - try { - aS400ExplorerPane1.setRoot(vIFSDirectory); - } - catch (java.beans.PropertyVetoException e) { - e.printStackTrace(); - } - } - } - private void setBrowserPaneRoot() { - if (null != vIFSDirectory) { - browsingPane.setRoot(vIFSDirectory); - } - } - - private void loadPath() { - vIFSDirectory.load(); - } - - private void setPath() { - try { - vIFSDirectory.setPath(pathTextField.getText()); - } - catch (java.beans.PropertyVetoException e) { - e.printStackTrace(); - } - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private com.ibm.as400.vaccess.VIFSDirectory vIFSDirectory; - private javax.swing.JPanel jPanel1; - private com.ibm.as400.vaccess.AS400ExplorerPane aS400ExplorerPane1; - private javax.swing.JPanel jPanel2; - private javax.swing.JButton pathButton; - private javax.swing.JTextField pathTextField; - private javax.swing.JButton systemButton; - private javax.swing.JTextField systemTextField; - private javax.swing.JPanel jPanel3; - private javax.swing.JButton explorerButton; - private javax.swing.JButton detailsButton; - private javax.swing.JButton listButton; - private javax.swing.JButton treeButton; - // End of variables declaration//GEN-END:variables - - /** Sets the QCMgr object which will handle AS400 instances for this client. - * @param mgr A QCMgr object. - */ - public void setManager(QCMgr mgr) { - manager = mgr; - } - - /** Connects the ErrorDialogAdapter with any as400.vaccess components present. - * @param eda An instance of an ErrorDialogAdapter already associated - * with a suitable Frame. - */ - public void propagateEDA(com.ibm.as400.vaccess.ErrorDialogAdapter eda) { - errorDialogAdapter=eda; - browsingPane.addErrorListener(eda); - vIFSDirectory.addErrorListener(eda); - } - /** Required implementantion of the QCServiceClient interface. Releases the - * AS400 object provided by the server. - * @param sr The service record which represents the AS400 to be - * relinquished. - */ - public void relinquish(QCServiceRecord sr) { - serviceRecord = null; - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCIFSPanelBeanInfo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCIFSPanelBeanInfo.java deleted file mode 100644 index 0d0fb7243..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCIFSPanelBeanInfo.java +++ /dev/null @@ -1,315 +0,0 @@ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.beans.*; - -public class QCIFSPanelBeanInfo extends SimpleBeanInfo { - - // Property identifiers //GEN-FIRST:Properties - private static final int PROPERTY_optimizedDrawingEnabled = 0; - private static final int PROPERTY_colorModel = 1; - private static final int PROPERTY_minimumSize = 2; - private static final int PROPERTY_visible = 3; - private static final int PROPERTY_toolkit = 4; - private static final int PROPERTY_displayable = 5; - private static final int PROPERTY_opaque = 6; - private static final int PROPERTY_requestFocusEnabled = 7; - private static final int PROPERTY_enabled = 8; - private static final int PROPERTY_autoscrolls = 9; - private static final int PROPERTY_y = 10; - private static final int PROPERTY_x = 11; - private static final int PROPERTY_accessibleContext = 12; - private static final int PROPERTY_componentOrientation = 13; - private static final int PROPERTY_components = 14; - private static final int PROPERTY_managingFocus = 15; - private static final int PROPERTY_inputMethodRequests = 16; - private static final int PROPERTY_border = 17; - private static final int PROPERTY_locale = 18; - private static final int PROPERTY_insets = 19; - private static final int PROPERTY_UIClassID = 20; - private static final int PROPERTY_graphics = 21; - private static final int PROPERTY_minimumSizeSet = 22; - private static final int PROPERTY_actionMap = 23; - private static final int PROPERTY_maximumSizeSet = 24; - private static final int PROPERTY_alignmentY = 25; - private static final int PROPERTY_alignmentX = 26; - private static final int PROPERTY_locationOnScreen = 27; - private static final int PROPERTY_cursor = 28; - private static final int PROPERTY_registeredKeyStrokes = 29; - private static final int PROPERTY_preferredSizeSet = 30; - private static final int PROPERTY_visibleRect = 31; - private static final int PROPERTY_bounds = 32; - private static final int PROPERTY_inputContext = 33; - private static final int PROPERTY_class = 34; - private static final int PROPERTY_focusTraversable = 35; - private static final int PROPERTY_font = 36; - private static final int PROPERTY_inputVerifier = 37; - private static final int PROPERTY_lightweight = 38; - private static final int PROPERTY_paintingTile = 39; - private static final int PROPERTY_maximumSize = 40; - private static final int PROPERTY_layout = 41; - private static final int PROPERTY_treeLock = 42; - private static final int PROPERTY_verifyInputWhenFocusTarget = 43; - private static final int PROPERTY_foreground = 44; - private static final int PROPERTY_preferredSize = 45; - private static final int PROPERTY_debugGraphicsOptions = 46; - private static final int PROPERTY_doubleBuffered = 47; - private static final int PROPERTY_showing = 48; - private static final int PROPERTY_nextFocusableComponent = 49; - private static final int PROPERTY_parent = 50; - private static final int PROPERTY_peer = 51; - private static final int PROPERTY_componentCount = 52; - private static final int PROPERTY_manager = 53; - private static final int PROPERTY_graphicsConfiguration = 54; - private static final int PROPERTY_height = 55; - private static final int PROPERTY_valid = 56; - private static final int PROPERTY_focusCycleRoot = 57; - private static final int PROPERTY_width = 58; - private static final int PROPERTY_toolTipText = 59; - private static final int PROPERTY_background = 60; - private static final int PROPERTY_validateRoot = 61; - private static final int PROPERTY_topLevelAncestor = 62; - private static final int PROPERTY_dropTarget = 63; - private static final int PROPERTY_rootPane = 64; - private static final int PROPERTY_name = 65; - private static final int PROPERTY_component = 66; - - // Property array - private static PropertyDescriptor[] properties = new PropertyDescriptor[67]; - - static { - try { - properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor ( "optimizedDrawingEnabled", QCIFSPanel.class, "isOptimizedDrawingEnabled", null ); - properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", QCIFSPanel.class, "getColorModel", null ); - properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", QCIFSPanel.class, "getMinimumSize", "setMinimumSize" ); - properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", QCIFSPanel.class, "isVisible", "setVisible" ); - properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", QCIFSPanel.class, "getToolkit", null ); - properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", QCIFSPanel.class, "isDisplayable", null ); - properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", QCIFSPanel.class, "isOpaque", "setOpaque" ); - properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor ( "requestFocusEnabled", QCIFSPanel.class, "isRequestFocusEnabled", "setRequestFocusEnabled" ); - properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", QCIFSPanel.class, "isEnabled", "setEnabled" ); - properties[PROPERTY_autoscrolls] = new PropertyDescriptor ( "autoscrolls", QCIFSPanel.class, "getAutoscrolls", "setAutoscrolls" ); - properties[PROPERTY_y] = new PropertyDescriptor ( "y", QCIFSPanel.class, "getY", null ); - properties[PROPERTY_x] = new PropertyDescriptor ( "x", QCIFSPanel.class, "getX", null ); - properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", QCIFSPanel.class, "getAccessibleContext", null ); - properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", QCIFSPanel.class, "getComponentOrientation", "setComponentOrientation" ); - properties[PROPERTY_components] = new PropertyDescriptor ( "components", QCIFSPanel.class, "getComponents", null ); - properties[PROPERTY_managingFocus] = new PropertyDescriptor ( "managingFocus", QCIFSPanel.class, "isManagingFocus", null ); - properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", QCIFSPanel.class, "getInputMethodRequests", null ); - properties[PROPERTY_border] = new PropertyDescriptor ( "border", QCIFSPanel.class, "getBorder", "setBorder" ); - properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", QCIFSPanel.class, "getLocale", "setLocale" ); - properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", QCIFSPanel.class, "getInsets", null ); - properties[PROPERTY_UIClassID] = new PropertyDescriptor ( "UIClassID", QCIFSPanel.class, "getUIClassID", null ); - properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", QCIFSPanel.class, "getGraphics", null ); - properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor ( "minimumSizeSet", QCIFSPanel.class, "isMinimumSizeSet", null ); - properties[PROPERTY_actionMap] = new PropertyDescriptor ( "actionMap", QCIFSPanel.class, "getActionMap", "setActionMap" ); - properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor ( "maximumSizeSet", QCIFSPanel.class, "isMaximumSizeSet", null ); - properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", QCIFSPanel.class, "getAlignmentY", "setAlignmentY" ); - properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", QCIFSPanel.class, "getAlignmentX", "setAlignmentX" ); - properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", QCIFSPanel.class, "getLocationOnScreen", null ); - properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", QCIFSPanel.class, "getCursor", "setCursor" ); - properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor ( "registeredKeyStrokes", QCIFSPanel.class, "getRegisteredKeyStrokes", null ); - properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor ( "preferredSizeSet", QCIFSPanel.class, "isPreferredSizeSet", null ); - properties[PROPERTY_visibleRect] = new PropertyDescriptor ( "visibleRect", QCIFSPanel.class, "getVisibleRect", null ); - properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", QCIFSPanel.class, "getBounds", "setBounds" ); - properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", QCIFSPanel.class, "getInputContext", null ); - properties[PROPERTY_class] = new PropertyDescriptor ( "class", QCIFSPanel.class, "getClass", null ); - properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", QCIFSPanel.class, "isFocusTraversable", null ); - properties[PROPERTY_font] = new PropertyDescriptor ( "font", QCIFSPanel.class, "getFont", "setFont" ); - properties[PROPERTY_inputVerifier] = new PropertyDescriptor ( "inputVerifier", QCIFSPanel.class, "getInputVerifier", "setInputVerifier" ); - properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", QCIFSPanel.class, "isLightweight", null ); - properties[PROPERTY_paintingTile] = new PropertyDescriptor ( "paintingTile", QCIFSPanel.class, "isPaintingTile", null ); - properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", QCIFSPanel.class, "getMaximumSize", "setMaximumSize" ); - properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", QCIFSPanel.class, "getLayout", "setLayout" ); - properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", QCIFSPanel.class, "getTreeLock", null ); - properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor ( "verifyInputWhenFocusTarget", QCIFSPanel.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget" ); - properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", QCIFSPanel.class, "getForeground", "setForeground" ); - properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", QCIFSPanel.class, "getPreferredSize", "setPreferredSize" ); - properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor ( "debugGraphicsOptions", QCIFSPanel.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions" ); - properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", QCIFSPanel.class, "isDoubleBuffered", "setDoubleBuffered" ); - properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", QCIFSPanel.class, "isShowing", null ); - properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor ( "nextFocusableComponent", QCIFSPanel.class, "getNextFocusableComponent", "setNextFocusableComponent" ); - properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", QCIFSPanel.class, "getParent", null ); - properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", QCIFSPanel.class, "getPeer", null ); - properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", QCIFSPanel.class, "getComponentCount", null ); - properties[PROPERTY_manager] = new PropertyDescriptor ( "manager", QCIFSPanel.class, null, "setManager" ); - properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", QCIFSPanel.class, "getGraphicsConfiguration", null ); - properties[PROPERTY_height] = new PropertyDescriptor ( "height", QCIFSPanel.class, "getHeight", null ); - properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", QCIFSPanel.class, "isValid", null ); - properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor ( "focusCycleRoot", QCIFSPanel.class, "isFocusCycleRoot", null ); - properties[PROPERTY_width] = new PropertyDescriptor ( "width", QCIFSPanel.class, "getWidth", null ); - properties[PROPERTY_toolTipText] = new PropertyDescriptor ( "toolTipText", QCIFSPanel.class, "getToolTipText", "setToolTipText" ); - properties[PROPERTY_background] = new PropertyDescriptor ( "background", QCIFSPanel.class, "getBackground", "setBackground" ); - properties[PROPERTY_validateRoot] = new PropertyDescriptor ( "validateRoot", QCIFSPanel.class, "isValidateRoot", null ); - properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor ( "topLevelAncestor", QCIFSPanel.class, "getTopLevelAncestor", null ); - properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", QCIFSPanel.class, "getDropTarget", "setDropTarget" ); - properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", QCIFSPanel.class, "getRootPane", null ); - properties[PROPERTY_name] = new PropertyDescriptor ( "name", QCIFSPanel.class, "getName", "setName" ); - properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", QCIFSPanel.class, null, null, "getComponent", null ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Properties - - // Here you can add code for customizing the properties array. - -}//GEN-LAST:Properties - - // EventSet identifiers//GEN-FIRST:Events - private static final int EVENT_mouseMotionListener = 0; - private static final int EVENT_ancestorListener = 1; - private static final int EVENT_inputMethodListener = 2; - private static final int EVENT_componentListener = 3; - private static final int EVENT_hierarchyBoundsListener = 4; - private static final int EVENT_mouseListener = 5; - private static final int EVENT_focusListener = 6; - private static final int EVENT_propertyChangeListener = 7; - private static final int EVENT_keyListener = 8; - private static final int EVENT_hierarchyListener = 9; - private static final int EVENT_containerListener = 10; - private static final int EVENT_vetoableChangeListener = 11; - - // EventSet array - private static EventSetDescriptor[] eventSets = new EventSetDescriptor[12]; - - static { - try { - eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( QCIFSPanel.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[0], "addMouseMotionListener", "removeMouseMotionListener" ); - eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( QCIFSPanel.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[0], "addAncestorListener", "removeAncestorListener" ); - eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( QCIFSPanel.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[0], "addInputMethodListener", "removeInputMethodListener" ); - eventSets[EVENT_componentListener] = new EventSetDescriptor ( QCIFSPanel.class, "componentListener", java.awt.event.ComponentListener.class, new String[0], "addComponentListener", "removeComponentListener" ); - eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( QCIFSPanel.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[0], "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); - eventSets[EVENT_mouseListener] = new EventSetDescriptor ( QCIFSPanel.class, "mouseListener", java.awt.event.MouseListener.class, new String[0], "addMouseListener", "removeMouseListener" ); - eventSets[EVENT_focusListener] = new EventSetDescriptor ( QCIFSPanel.class, "focusListener", java.awt.event.FocusListener.class, new String[0], "addFocusListener", "removeFocusListener" ); - eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( QCIFSPanel.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[0], "addPropertyChangeListener", "removePropertyChangeListener" ); - eventSets[EVENT_keyListener] = new EventSetDescriptor ( QCIFSPanel.class, "keyListener", java.awt.event.KeyListener.class, new String[0], "addKeyListener", "removeKeyListener" ); - eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( QCIFSPanel.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[0], "addHierarchyListener", "removeHierarchyListener" ); - eventSets[EVENT_containerListener] = new EventSetDescriptor ( QCIFSPanel.class, "containerListener", java.awt.event.ContainerListener.class, new String[0], "addContainerListener", "removeContainerListener" ); - eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( QCIFSPanel.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[0], "addVetoableChangeListener", "removeVetoableChangeListener" ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Events - - // Here you can add code for customizing the event sets array. - -}//GEN-LAST:Events - - private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef - private static java.awt.Image iconColor32 = null; - private static java.awt.Image iconMono16 = null; - private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef - private static String iconNameC16 = null;//GEN-BEGIN:Icons - private static String iconNameC32 = null; - private static String iconNameM16 = null; - private static String iconNameM32 = null;//GEN-END:Icons - - private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx - private static int defaultEventIndex = -1;//GEN-END:Idx - - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

- * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } - - /** - * Gets the beans EventSetDescriptors. - * - * @return An array of EventSetDescriptors describing the kinds of - * events fired by this bean. May return null if the information - * should be obtained by automatic analysis. - */ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSets; - } - - /** - * A bean may have a "default" property that is the property that will - * mostly commonly be initially chosen for update by human's who are - * customizing the bean. - * @return Index of default property in the PropertyDescriptor array - * returned by getPropertyDescriptors. - *

Returns -1 if there is no default property. - */ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** - * A bean may have a "default" event that is the event that will - * mostly commonly be used by human's when using the bean. - * @return Index of default event in the EventSetDescriptor array - * returned by getEventSetDescriptors. - *

Returns -1 if there is no default event. - */ - public int getDefaultEventIndex() { - return defaultPropertyIndex; - } - - /** - * This method returns an image object that can be used to - * represent the bean in toolboxes, toolbars, etc. Icon images - * will typically be GIFs, but may in future include other formats. - *

- * Beans aren't required to provide icons and may return null from - * this method. - *

- * There are four possible flavors of icons (16x16 color, - * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only - * support a single icon we recommend supporting 16x16 color. - *

- * We recommend that icons have a "transparent" background - * so they can be rendered onto an existing background. - * - * @param iconKind The kind of icon requested. This should be - * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, - * ICON_MONO_16x16, or ICON_MONO_32x32. - * @return An image object representing the requested icon. May - * return null if no suitable icon is available. - */ - public java.awt.Image getIcon(int iconKind) { - switch ( iconKind ) { - case ICON_COLOR_16x16: - if ( iconNameC16 == null ) - return null; - else { - if( iconColor16 == null ) - iconColor16 = loadImage( iconNameC16 ); - return iconColor16; - } - case ICON_COLOR_32x32: - if ( iconNameC32 == null ) - return null; - else { - if( iconColor32 == null ) - iconColor32 = loadImage( iconNameC32 ); - return iconColor32; - } - case ICON_MONO_16x16: - if ( iconNameM16 == null ) - return null; - else { - if( iconMono16 == null ) - iconMono16 = loadImage( iconNameM16 ); - return iconMono16; - } - case ICON_MONO_32x32: - if ( iconNameM32 == null ) - return null; - else { - if( iconNameM32 == null ) - iconMono32 = loadImage( iconNameM32 ); - return iconMono32; - } - } - return null; - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCJdbcURL.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCJdbcURL.java deleted file mode 100644 index da5e31694..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCJdbcURL.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * QCJdbcURL.java - * - * Created on July 19, 2000, 9:44 PM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** A class to canonicalize JDBC URL's. - * @author jax - * @version 1.0 - */ -public class QCJdbcURL extends Object { - - /** Protocol portion of JDBC URL. - */ - public String protocol; - /** Driver portion of JDBC URL. - */ - public String driver; - /** Server portion of JDBC URL. - */ - public String server; - /** Optional arguments portion of JDBC URL, e.g., "?user=fred&password=blue" - */ - public java.util.Vector arguments; - - /** Creates new QCJdbcURL */ - public QCJdbcURL() { - } - - /** Create a URL representation from a URL string. - * @param url The URL string of the form jdbc:driver:server<options> - */ - public QCJdbcURL(java.lang.String url) { - parseURL(url); - } - - /** Parse a string URL into the fields of this object. - * @param url The URL string. - */ - public void parseURL(java.lang.String url) { - java.util.StringTokenizer st; - StringBuffer urlInProcess = new StringBuffer(url); - protocol = null; driver = null; server = null; arguments = null; - st = new java.util.StringTokenizer(urlInProcess.toString(), ":", false); - - // Get the protocol if we have any string. - if (st.hasMoreTokens()) { - protocol = st.nextToken(); - - // Lose the head of the url as passed in. - try { - // Delete the protocol header. - urlInProcess.delete(0, protocol.length()); - } - catch (StringIndexOutOfBoundsException e) { - e.printStackTrace(); - } - } - - // Get the driver if we have anything left. - if (st.hasMoreElements()) { - driver = st.nextToken(); - - // Lose that bit of the url as passed in. - try { - // Delete the colon that must have been there along with the driver name. - urlInProcess.delete(0, 1 + driver.length()); - } - catch (StringIndexOutOfBoundsException e) { - e.printStackTrace(); - } - } - // Now delete the trailing colon and any server-leading "//". - while (urlInProcess.length() >0) { - if ((urlInProcess.charAt(0) == ':') | (urlInProcess.charAt(0) == '/')) { - try { - urlInProcess.deleteCharAt(0); - } - catch (StringIndexOutOfBoundsException e) { - e.printStackTrace(); - } - } - else { // Else we are done with this step. - break; - } - } - - // Create a new tokenizer to process server and remaining arguments. - st = new java.util.StringTokenizer(urlInProcess.toString(), "&?;", true); - - // Get server name - if (st.hasMoreTokens()) { - server = st.nextToken(); - - try { - urlInProcess.delete(0, server.length()); - } - catch (StringIndexOutOfBoundsException e) { - e.printStackTrace(); - } - } - - // See if we need a Vector to hold arguments. - if (st.hasMoreTokens()) { - arguments = new java.util.Vector(10,10); - } - while (st.hasMoreTokens()) { - StringBuffer s = new StringBuffer(st.nextToken()); - if (((s.charAt(0) == '&') - | (s.charAt(0) == '?') - | (s.charAt(0) == ';')) - & st.hasMoreTokens()) - { - s.append(st.nextToken()); - } - arguments.add(s.toString()); - } - } - - /** Returns a string representation of the URL. - * @return The string for the URL. - */ - public String getURL() { - StringBuffer result = new StringBuffer(); - if (null != protocol) { - result.append(protocol + ":"); - if (null != driver) { - result.append(driver + ":"); - if (driver.equals("as400") - | driver.equals("postgresql")) - { - result.append("//"); - } - if (null != server) { - result.append(server); - if (null != arguments) { - for (java.util.Enumeration e = arguments.elements() ; e.hasMoreElements() ;) { - result.append(e.nextElement().toString()); - } - } - } - } - } - return result.toString(); - } - - /** Just testing. Pass this main() a string URL to parse and it will - * parse it and display the parts and its string reconstruction of same. - * @param argv argv[0] == A URL to parse. - */ - public static void main(String[] argv) { - QCJdbcURL url = new QCJdbcURL(argv[0]); - - if (url.protocol != null) { - System.out.println("Protocol: " + url.protocol); - } - - if (url.driver != null) { - System.out.println("Driver: " + url.driver); - } - - if (url.server != null) { - System.out.println("Server: " + url.server); - } - - if (url.arguments != null) { - for (java.util.Enumeration e = url.arguments.elements() ; e.hasMoreElements() ;) { - System.out.println("Argument: " + e.nextElement()); - } - } - System.out.println(url.getURL()); - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCJobListPanel.form b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCJobListPanel.form deleted file mode 100644 index 4411117bb..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCJobListPanel.form +++ /dev/null @@ -1,140 +0,0 @@ - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCJobListPanel.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCJobListPanel.java deleted file mode 100644 index 98e708c79..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCJobListPanel.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * QCJobListPanel.java - * - * Created on July 14, 2000, 9:07 PM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** Holds Job List display. - * @author jax - * @version 1.0 - */ -public class QCJobListPanel extends javax.swing.JPanel implements com.SoftWoehr.JTOpenContrib.QCDemo.QCServiceClient { - - private QCMgr manager; - private java.lang.String serverName; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCServiceRecord serviceRecord; - private com.ibm.as400.vaccess.ErrorDialogAdapter errorDialogAdapter; - - /** Creates new form QCJobListPanel */ - public QCJobListPanel() { - initComponents (); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the FormEditor. - */ - private void initComponents () {//GEN-BEGIN:initComponents - vJobList1 = new com.ibm.as400.vaccess.VJobList (); - aS400DetailsPane1 = new com.ibm.as400.vaccess.AS400DetailsPane (); - jPanel1 = new javax.swing.JPanel (); - systemLabel = new javax.swing.JLabel (); - systemTextField = new javax.swing.JTextField (); - listButton = new javax.swing.JButton (); - jobNameTextField = new javax.swing.JTextField (); - jobNumberTextField = new javax.swing.JTextField (); - jobUserTextField = new javax.swing.JTextField (); - jobNameLabel = new javax.swing.JLabel (); - jobNumberLabel = new javax.swing.JLabel (); - jobUserLabel = new javax.swing.JLabel (); - jobListLabel = new javax.swing.JLabel (); - - setLayout (new java.awt.BorderLayout ()); - - - - add (aS400DetailsPane1, java.awt.BorderLayout.CENTER); - - jPanel1.setLayout (new java.awt.GridLayout (3, 3)); - jPanel1.setToolTipText ("Shows a job list from the system you choose."); - - systemLabel.setText ("System"); - systemLabel.setToolTipText ("Enter the system name at the right."); - systemLabel.setHorizontalAlignment (javax.swing.SwingConstants.RIGHT); - - jPanel1.add (systemLabel); - - systemTextField.setToolTipText ("Enter the name of the system for which you want a job list."); - - jPanel1.add (systemTextField); - - listButton.setToolTipText ("Click here to get the list of jobs you selected."); - listButton.setText ("Get Job LIst"); - listButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - listButtonActionPerformed (evt); - } - } - ); - - jPanel1.add (listButton); - - jobNameTextField.setToolTipText ("Enter the job name or *ALL."); - jobNameTextField.setText ("*ALL"); - - jPanel1.add (jobNameTextField); - - jobNumberTextField.setToolTipText ("Enter the job number or *ALL."); - jobNumberTextField.setText ("*ALL"); - - jPanel1.add (jobNumberTextField); - - jobUserTextField.setToolTipText ("Enter the user name or *ALL."); - jobUserTextField.setText ("*ALL"); - - jPanel1.add (jobUserTextField); - - jobNameLabel.setText ("Job Name"); - jobNameLabel.setToolTipText ("Above, enter the job name or *ALL."); - jobNameLabel.setHorizontalAlignment (javax.swing.SwingConstants.CENTER); - - jPanel1.add (jobNameLabel); - - jobNumberLabel.setText ("Job Number"); - jobNumberLabel.setToolTipText ("Above, enter the job number or *ALL."); - jobNumberLabel.setHorizontalAlignment (javax.swing.SwingConstants.CENTER); - - jPanel1.add (jobNumberLabel); - - jobUserLabel.setText ("User"); - jobUserLabel.setToolTipText ("Above, enter the user name or *ALL."); - jobUserLabel.setHorizontalAlignment (javax.swing.SwingConstants.CENTER); - - jPanel1.add (jobUserLabel); - - - add (jPanel1, java.awt.BorderLayout.SOUTH); - - jobListLabel.setText ("A list of jobs on the server."); - jobListLabel.setToolTipText ("Fill in the fields at the bottom and press the button to get a list of jobs."); - jobListLabel.setHorizontalAlignment (javax.swing.SwingConstants.CENTER); - - - add (jobListLabel, java.awt.BorderLayout.NORTH); - - }//GEN-END:initComponents - - private void listButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_listButtonActionPerformed - // Add your handling code here: - - // Could take a while. - java.awt.Cursor cursor = getCursor(); - setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR)); - - // Be sure we have a server and job list. - reinstanceServerFromTextEntry(); - reinstanceJobList(); - - // If all is well, go get it. - if (null != vJobList1 && null != serviceRecord) { - setJobConstraints(); - loadJobs(); - setDetailsPaneRoot(); - } - - // The wait is over. - setCursor(cursor); - repaint(500); - }//GEN-LAST:event_listButtonActionPerformed - - private synchronized void reinstanceServerFromTextEntry() { - String newName = systemTextField.getText(); - if (null == serverName) { - serverName = ""; - } - if (null != newName) { - if (!newName.equals("")) { - if (!newName.equals(serverName)) { - serverName = newName; - if (null != serviceRecord) { - - try { // let go of the service from manager - manager.freeService(serviceRecord); - } - catch (Exception e) { - e.printStackTrace(); - } - serviceRecord = null; - } - try { - serviceRecord = manager.getService("qcmgr:" + serverName + "/COMMAND", this); - } - catch (Exception e) { - e.printStackTrace(); - } - } - } - } - } - private synchronized void reinstanceJobList () { - vJobList1 = new com.ibm.as400.vaccess.VJobList(serviceRecord.as400); - if (null != errorDialogAdapter) { - vJobList1.addErrorListener(errorDialogAdapter); - } - } - - private void setDetailsPaneRoot() { - if (null != vJobList1) { - try { - aS400DetailsPane1.setRoot(vJobList1); - } - catch (java.beans.PropertyVetoException e) { - e.printStackTrace(); - } - } - } - - private void loadJobs() { - vJobList1.load(); - } - - private void setJobConstraints() { - try { - vJobList1.setName(jobNameTextField.getText()); - vJobList1.setNumber(jobNumberTextField.getText()); - vJobList1.setUser(jobUserTextField.getText()); - } - catch (java.beans.PropertyVetoException e) { - e.printStackTrace(); - } - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private com.ibm.as400.vaccess.VJobList vJobList1; - private com.ibm.as400.vaccess.AS400DetailsPane aS400DetailsPane1; - private javax.swing.JPanel jPanel1; - private javax.swing.JLabel systemLabel; - private javax.swing.JTextField systemTextField; - private javax.swing.JButton listButton; - private javax.swing.JTextField jobNameTextField; - private javax.swing.JTextField jobNumberTextField; - private javax.swing.JTextField jobUserTextField; - private javax.swing.JLabel jobNameLabel; - private javax.swing.JLabel jobNumberLabel; - private javax.swing.JLabel jobUserLabel; - private javax.swing.JLabel jobListLabel; - // End of variables declaration//GEN-END:variables - - /** Sets the QCMgr object which will handle AS400 instances for this client. - * @param mgr A QCMgr object. - */ - public void setManager(QCMgr mgr) { - manager = mgr; - } - - /** Connects the ErrorDialogAdapter with any as400.vaccess components present. - * @param eda An instance of an ErrorDialogAdapter already associated - * with a suitable Frame. - */ - public void propagateEDA(com.ibm.as400.vaccess.ErrorDialogAdapter eda) { - errorDialogAdapter=eda; - aS400DetailsPane1.addErrorListener(eda); - vJobList1.addErrorListener(eda); - } - /** Required implementantion of the QCServiceClient interface. Releases the - * AS400 object provided by the server. - * @param sr The service record which represents the AS400 to be - * relinquished. - */ - public void relinquish(QCServiceRecord sr) { - serviceRecord = null; - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCJobListPanelBeanInfo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCJobListPanelBeanInfo.java deleted file mode 100644 index 202e635c6..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCJobListPanelBeanInfo.java +++ /dev/null @@ -1,315 +0,0 @@ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.beans.*; - -public class QCJobListPanelBeanInfo extends SimpleBeanInfo { - - // Property identifiers //GEN-FIRST:Properties - private static final int PROPERTY_optimizedDrawingEnabled = 0; - private static final int PROPERTY_colorModel = 1; - private static final int PROPERTY_minimumSize = 2; - private static final int PROPERTY_visible = 3; - private static final int PROPERTY_toolkit = 4; - private static final int PROPERTY_displayable = 5; - private static final int PROPERTY_opaque = 6; - private static final int PROPERTY_requestFocusEnabled = 7; - private static final int PROPERTY_enabled = 8; - private static final int PROPERTY_autoscrolls = 9; - private static final int PROPERTY_y = 10; - private static final int PROPERTY_x = 11; - private static final int PROPERTY_accessibleContext = 12; - private static final int PROPERTY_componentOrientation = 13; - private static final int PROPERTY_components = 14; - private static final int PROPERTY_managingFocus = 15; - private static final int PROPERTY_inputMethodRequests = 16; - private static final int PROPERTY_border = 17; - private static final int PROPERTY_locale = 18; - private static final int PROPERTY_insets = 19; - private static final int PROPERTY_UIClassID = 20; - private static final int PROPERTY_graphics = 21; - private static final int PROPERTY_minimumSizeSet = 22; - private static final int PROPERTY_actionMap = 23; - private static final int PROPERTY_maximumSizeSet = 24; - private static final int PROPERTY_alignmentY = 25; - private static final int PROPERTY_alignmentX = 26; - private static final int PROPERTY_locationOnScreen = 27; - private static final int PROPERTY_cursor = 28; - private static final int PROPERTY_registeredKeyStrokes = 29; - private static final int PROPERTY_preferredSizeSet = 30; - private static final int PROPERTY_visibleRect = 31; - private static final int PROPERTY_bounds = 32; - private static final int PROPERTY_inputContext = 33; - private static final int PROPERTY_class = 34; - private static final int PROPERTY_focusTraversable = 35; - private static final int PROPERTY_font = 36; - private static final int PROPERTY_inputVerifier = 37; - private static final int PROPERTY_lightweight = 38; - private static final int PROPERTY_paintingTile = 39; - private static final int PROPERTY_maximumSize = 40; - private static final int PROPERTY_layout = 41; - private static final int PROPERTY_treeLock = 42; - private static final int PROPERTY_verifyInputWhenFocusTarget = 43; - private static final int PROPERTY_foreground = 44; - private static final int PROPERTY_preferredSize = 45; - private static final int PROPERTY_debugGraphicsOptions = 46; - private static final int PROPERTY_doubleBuffered = 47; - private static final int PROPERTY_showing = 48; - private static final int PROPERTY_nextFocusableComponent = 49; - private static final int PROPERTY_parent = 50; - private static final int PROPERTY_peer = 51; - private static final int PROPERTY_componentCount = 52; - private static final int PROPERTY_manager = 53; - private static final int PROPERTY_graphicsConfiguration = 54; - private static final int PROPERTY_height = 55; - private static final int PROPERTY_valid = 56; - private static final int PROPERTY_focusCycleRoot = 57; - private static final int PROPERTY_width = 58; - private static final int PROPERTY_toolTipText = 59; - private static final int PROPERTY_background = 60; - private static final int PROPERTY_validateRoot = 61; - private static final int PROPERTY_topLevelAncestor = 62; - private static final int PROPERTY_dropTarget = 63; - private static final int PROPERTY_rootPane = 64; - private static final int PROPERTY_name = 65; - private static final int PROPERTY_component = 66; - - // Property array - private static PropertyDescriptor[] properties = new PropertyDescriptor[67]; - - static { - try { - properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor ( "optimizedDrawingEnabled", QCJobListPanel.class, "isOptimizedDrawingEnabled", null ); - properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", QCJobListPanel.class, "getColorModel", null ); - properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", QCJobListPanel.class, "getMinimumSize", "setMinimumSize" ); - properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", QCJobListPanel.class, "isVisible", "setVisible" ); - properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", QCJobListPanel.class, "getToolkit", null ); - properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", QCJobListPanel.class, "isDisplayable", null ); - properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", QCJobListPanel.class, "isOpaque", "setOpaque" ); - properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor ( "requestFocusEnabled", QCJobListPanel.class, "isRequestFocusEnabled", "setRequestFocusEnabled" ); - properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", QCJobListPanel.class, "isEnabled", "setEnabled" ); - properties[PROPERTY_autoscrolls] = new PropertyDescriptor ( "autoscrolls", QCJobListPanel.class, "getAutoscrolls", "setAutoscrolls" ); - properties[PROPERTY_y] = new PropertyDescriptor ( "y", QCJobListPanel.class, "getY", null ); - properties[PROPERTY_x] = new PropertyDescriptor ( "x", QCJobListPanel.class, "getX", null ); - properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", QCJobListPanel.class, "getAccessibleContext", null ); - properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", QCJobListPanel.class, "getComponentOrientation", "setComponentOrientation" ); - properties[PROPERTY_components] = new PropertyDescriptor ( "components", QCJobListPanel.class, "getComponents", null ); - properties[PROPERTY_managingFocus] = new PropertyDescriptor ( "managingFocus", QCJobListPanel.class, "isManagingFocus", null ); - properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", QCJobListPanel.class, "getInputMethodRequests", null ); - properties[PROPERTY_border] = new PropertyDescriptor ( "border", QCJobListPanel.class, "getBorder", "setBorder" ); - properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", QCJobListPanel.class, "getLocale", "setLocale" ); - properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", QCJobListPanel.class, "getInsets", null ); - properties[PROPERTY_UIClassID] = new PropertyDescriptor ( "UIClassID", QCJobListPanel.class, "getUIClassID", null ); - properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", QCJobListPanel.class, "getGraphics", null ); - properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor ( "minimumSizeSet", QCJobListPanel.class, "isMinimumSizeSet", null ); - properties[PROPERTY_actionMap] = new PropertyDescriptor ( "actionMap", QCJobListPanel.class, "getActionMap", "setActionMap" ); - properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor ( "maximumSizeSet", QCJobListPanel.class, "isMaximumSizeSet", null ); - properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", QCJobListPanel.class, "getAlignmentY", "setAlignmentY" ); - properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", QCJobListPanel.class, "getAlignmentX", "setAlignmentX" ); - properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", QCJobListPanel.class, "getLocationOnScreen", null ); - properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", QCJobListPanel.class, "getCursor", "setCursor" ); - properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor ( "registeredKeyStrokes", QCJobListPanel.class, "getRegisteredKeyStrokes", null ); - properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor ( "preferredSizeSet", QCJobListPanel.class, "isPreferredSizeSet", null ); - properties[PROPERTY_visibleRect] = new PropertyDescriptor ( "visibleRect", QCJobListPanel.class, "getVisibleRect", null ); - properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", QCJobListPanel.class, "getBounds", "setBounds" ); - properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", QCJobListPanel.class, "getInputContext", null ); - properties[PROPERTY_class] = new PropertyDescriptor ( "class", QCJobListPanel.class, "getClass", null ); - properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", QCJobListPanel.class, "isFocusTraversable", null ); - properties[PROPERTY_font] = new PropertyDescriptor ( "font", QCJobListPanel.class, "getFont", "setFont" ); - properties[PROPERTY_inputVerifier] = new PropertyDescriptor ( "inputVerifier", QCJobListPanel.class, "getInputVerifier", "setInputVerifier" ); - properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", QCJobListPanel.class, "isLightweight", null ); - properties[PROPERTY_paintingTile] = new PropertyDescriptor ( "paintingTile", QCJobListPanel.class, "isPaintingTile", null ); - properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", QCJobListPanel.class, "getMaximumSize", "setMaximumSize" ); - properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", QCJobListPanel.class, "getLayout", "setLayout" ); - properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", QCJobListPanel.class, "getTreeLock", null ); - properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor ( "verifyInputWhenFocusTarget", QCJobListPanel.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget" ); - properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", QCJobListPanel.class, "getForeground", "setForeground" ); - properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", QCJobListPanel.class, "getPreferredSize", "setPreferredSize" ); - properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor ( "debugGraphicsOptions", QCJobListPanel.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions" ); - properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", QCJobListPanel.class, "isDoubleBuffered", "setDoubleBuffered" ); - properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", QCJobListPanel.class, "isShowing", null ); - properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor ( "nextFocusableComponent", QCJobListPanel.class, "getNextFocusableComponent", "setNextFocusableComponent" ); - properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", QCJobListPanel.class, "getParent", null ); - properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", QCJobListPanel.class, "getPeer", null ); - properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", QCJobListPanel.class, "getComponentCount", null ); - properties[PROPERTY_manager] = new PropertyDescriptor ( "manager", QCJobListPanel.class, null, "setManager" ); - properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", QCJobListPanel.class, "getGraphicsConfiguration", null ); - properties[PROPERTY_height] = new PropertyDescriptor ( "height", QCJobListPanel.class, "getHeight", null ); - properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", QCJobListPanel.class, "isValid", null ); - properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor ( "focusCycleRoot", QCJobListPanel.class, "isFocusCycleRoot", null ); - properties[PROPERTY_width] = new PropertyDescriptor ( "width", QCJobListPanel.class, "getWidth", null ); - properties[PROPERTY_toolTipText] = new PropertyDescriptor ( "toolTipText", QCJobListPanel.class, "getToolTipText", "setToolTipText" ); - properties[PROPERTY_background] = new PropertyDescriptor ( "background", QCJobListPanel.class, "getBackground", "setBackground" ); - properties[PROPERTY_validateRoot] = new PropertyDescriptor ( "validateRoot", QCJobListPanel.class, "isValidateRoot", null ); - properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor ( "topLevelAncestor", QCJobListPanel.class, "getTopLevelAncestor", null ); - properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", QCJobListPanel.class, "getDropTarget", "setDropTarget" ); - properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", QCJobListPanel.class, "getRootPane", null ); - properties[PROPERTY_name] = new PropertyDescriptor ( "name", QCJobListPanel.class, "getName", "setName" ); - properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", QCJobListPanel.class, null, null, "getComponent", null ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Properties - - // Here you can add code for customizing the properties array. - -}//GEN-LAST:Properties - - // EventSet identifiers//GEN-FIRST:Events - private static final int EVENT_mouseMotionListener = 0; - private static final int EVENT_ancestorListener = 1; - private static final int EVENT_inputMethodListener = 2; - private static final int EVENT_componentListener = 3; - private static final int EVENT_hierarchyBoundsListener = 4; - private static final int EVENT_mouseListener = 5; - private static final int EVENT_focusListener = 6; - private static final int EVENT_propertyChangeListener = 7; - private static final int EVENT_keyListener = 8; - private static final int EVENT_hierarchyListener = 9; - private static final int EVENT_containerListener = 10; - private static final int EVENT_vetoableChangeListener = 11; - - // EventSet array - private static EventSetDescriptor[] eventSets = new EventSetDescriptor[12]; - - static { - try { - eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( QCJobListPanel.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[0], "addMouseMotionListener", "removeMouseMotionListener" ); - eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( QCJobListPanel.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[0], "addAncestorListener", "removeAncestorListener" ); - eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( QCJobListPanel.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[0], "addInputMethodListener", "removeInputMethodListener" ); - eventSets[EVENT_componentListener] = new EventSetDescriptor ( QCJobListPanel.class, "componentListener", java.awt.event.ComponentListener.class, new String[0], "addComponentListener", "removeComponentListener" ); - eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( QCJobListPanel.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[0], "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); - eventSets[EVENT_mouseListener] = new EventSetDescriptor ( QCJobListPanel.class, "mouseListener", java.awt.event.MouseListener.class, new String[0], "addMouseListener", "removeMouseListener" ); - eventSets[EVENT_focusListener] = new EventSetDescriptor ( QCJobListPanel.class, "focusListener", java.awt.event.FocusListener.class, new String[0], "addFocusListener", "removeFocusListener" ); - eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( QCJobListPanel.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[0], "addPropertyChangeListener", "removePropertyChangeListener" ); - eventSets[EVENT_keyListener] = new EventSetDescriptor ( QCJobListPanel.class, "keyListener", java.awt.event.KeyListener.class, new String[0], "addKeyListener", "removeKeyListener" ); - eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( QCJobListPanel.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[0], "addHierarchyListener", "removeHierarchyListener" ); - eventSets[EVENT_containerListener] = new EventSetDescriptor ( QCJobListPanel.class, "containerListener", java.awt.event.ContainerListener.class, new String[0], "addContainerListener", "removeContainerListener" ); - eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( QCJobListPanel.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[0], "addVetoableChangeListener", "removeVetoableChangeListener" ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Events - - // Here you can add code for customizing the event sets array. - -}//GEN-LAST:Events - - private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef - private static java.awt.Image iconColor32 = null; - private static java.awt.Image iconMono16 = null; - private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef - private static String iconNameC16 = null;//GEN-BEGIN:Icons - private static String iconNameC32 = null; - private static String iconNameM16 = null; - private static String iconNameM32 = null;//GEN-END:Icons - - private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx - private static int defaultEventIndex = -1;//GEN-END:Idx - - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

- * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } - - /** - * Gets the beans EventSetDescriptors. - * - * @return An array of EventSetDescriptors describing the kinds of - * events fired by this bean. May return null if the information - * should be obtained by automatic analysis. - */ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSets; - } - - /** - * A bean may have a "default" property that is the property that will - * mostly commonly be initially chosen for update by human's who are - * customizing the bean. - * @return Index of default property in the PropertyDescriptor array - * returned by getPropertyDescriptors. - *

Returns -1 if there is no default property. - */ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** - * A bean may have a "default" event that is the event that will - * mostly commonly be used by human's when using the bean. - * @return Index of default event in the EventSetDescriptor array - * returned by getEventSetDescriptors. - *

Returns -1 if there is no default event. - */ - public int getDefaultEventIndex() { - return defaultPropertyIndex; - } - - /** - * This method returns an image object that can be used to - * represent the bean in toolboxes, toolbars, etc. Icon images - * will typically be GIFs, but may in future include other formats. - *

- * Beans aren't required to provide icons and may return null from - * this method. - *

- * There are four possible flavors of icons (16x16 color, - * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only - * support a single icon we recommend supporting 16x16 color. - *

- * We recommend that icons have a "transparent" background - * so they can be rendered onto an existing background. - * - * @param iconKind The kind of icon requested. This should be - * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, - * ICON_MONO_16x16, or ICON_MONO_32x32. - * @return An image object representing the requested icon. May - * return null if no suitable icon is available. - */ - public java.awt.Image getIcon(int iconKind) { - switch ( iconKind ) { - case ICON_COLOR_16x16: - if ( iconNameC16 == null ) - return null; - else { - if( iconColor16 == null ) - iconColor16 = loadImage( iconNameC16 ); - return iconColor16; - } - case ICON_COLOR_32x32: - if ( iconNameC32 == null ) - return null; - else { - if( iconColor32 == null ) - iconColor32 = loadImage( iconNameC32 ); - return iconColor32; - } - case ICON_MONO_16x16: - if ( iconNameM16 == null ) - return null; - else { - if( iconMono16 == null ) - iconMono16 = loadImage( iconNameM16 ); - return iconMono16; - } - case ICON_MONO_32x32: - if ( iconNameM32 == null ) - return null; - else { - if( iconNameM32 == null ) - iconMono32 = loadImage( iconNameM32 ); - return iconMono32; - } - } - return null; - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCListPane.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCListPane.java deleted file mode 100644 index 50d9e4181..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCListPane.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * QCListPane.java - * - * A wrapper around com.ibm.as400.vaccess.AS400ListPane to - * allow us to polymorphically switch panes in a panel. - * - * Created on July 16, 2000, 2:06 AM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** A wrapper around a JTOpen pane type to allow polymorphism. - * @author jax - * @version 1.0 - */ -public class QCListPane extends com.ibm.as400.vaccess.AS400ListPane implements QCVNodeDisplayer { - - /** Creates new QCExplorer */ - public QCListPane() { - } - - /** Sets the node as root for the pane. - * @param v The VNode to be setRoot by the pane. - */ - public void setRoot(com.ibm.as400.vaccess.VNode v) { - try { - super.setRoot(v); - } - catch (java.beans.PropertyVetoException e) { - e.printStackTrace(); - } - } - - /** Add the pane to the Container. - * @param c The Container to be added to. - */ - public void addTo(java.awt.Container c) { - c.add(this); - } - - /** Add error dialog as listener. - * @param eda The ErrorDialogAdapter to add. - */ - public void addErrorListener(com.ibm.as400.vaccess.ErrorDialogAdapter eda) { - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCListPaneBeanInfo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCListPaneBeanInfo.java deleted file mode 100644 index a9e86fbe8..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCListPaneBeanInfo.java +++ /dev/null @@ -1,335 +0,0 @@ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.beans.*; - -public class QCListPaneBeanInfo extends SimpleBeanInfo { - - // Property identifiers //GEN-FIRST:Properties - private static final int PROPERTY_toolkit = 0; - private static final int PROPERTY_rootPane = 1; - private static final int PROPERTY_visible = 2; - private static final int PROPERTY_topLevelAncestor = 3; - private static final int PROPERTY_treeLock = 4; - private static final int PROPERTY_maximumSize = 5; - private static final int PROPERTY_peer = 6; - private static final int PROPERTY_nextFocusableComponent = 7; - private static final int PROPERTY_componentOrientation = 8; - private static final int PROPERTY_focusCycleRoot = 9; - private static final int PROPERTY_validateRoot = 10; - private static final int PROPERTY_selectionModel = 11; - private static final int PROPERTY_colorModel = 12; - private static final int PROPERTY_model = 13; - private static final int PROPERTY_components = 14; - private static final int PROPERTY_y = 15; - private static final int PROPERTY_x = 16; - private static final int PROPERTY_enabled = 17; - private static final int PROPERTY_opaque = 18; - private static final int PROPERTY_valid = 19; - private static final int PROPERTY_verifyInputWhenFocusTarget = 20; - private static final int PROPERTY_bounds = 21; - private static final int PROPERTY_inputVerifier = 22; - private static final int PROPERTY_autoscrolls = 23; - private static final int PROPERTY_optimizedDrawingEnabled = 24; - private static final int PROPERTY_displayable = 25; - private static final int PROPERTY_allowActions = 26; - private static final int PROPERTY_toolTipText = 27; - private static final int PROPERTY_locale = 28; - private static final int PROPERTY_locationOnScreen = 29; - private static final int PROPERTY_layout = 30; - private static final int PROPERTY_requestFocusEnabled = 31; - private static final int PROPERTY_parent = 32; - private static final int PROPERTY_minimumSizeSet = 33; - private static final int PROPERTY_foreground = 34; - private static final int PROPERTY_font = 35; - private static final int PROPERTY_graphics = 36; - private static final int PROPERTY_UIClassID = 37; - private static final int PROPERTY_width = 38; - private static final int PROPERTY_class = 39; - private static final int PROPERTY_lightweight = 40; - private static final int PROPERTY_accessibleContext = 41; - private static final int PROPERTY_name = 42; - private static final int PROPERTY_showing = 43; - private static final int PROPERTY_confirm = 44; - private static final int PROPERTY_componentCount = 45; - private static final int PROPERTY_border = 46; - private static final int PROPERTY_minimumSize = 47; - private static final int PROPERTY_registeredKeyStrokes = 48; - private static final int PROPERTY_doubleBuffered = 49; - private static final int PROPERTY_debugGraphicsOptions = 50; - private static final int PROPERTY_height = 51; - private static final int PROPERTY_insets = 52; - private static final int PROPERTY_paintingTile = 53; - private static final int PROPERTY_focusTraversable = 54; - private static final int PROPERTY_alignmentY = 55; - private static final int PROPERTY_alignmentX = 56; - private static final int PROPERTY_root = 57; - private static final int PROPERTY_selectedObjects = 58; - private static final int PROPERTY_dropTarget = 59; - private static final int PROPERTY_managingFocus = 60; - private static final int PROPERTY_preferredSize = 61; - private static final int PROPERTY_selectedObject = 62; - private static final int PROPERTY_background = 63; - private static final int PROPERTY_inputContext = 64; - private static final int PROPERTY_preferredSizeSet = 65; - private static final int PROPERTY_cursor = 66; - private static final int PROPERTY_visibleRowCount = 67; - private static final int PROPERTY_maximumSizeSet = 68; - private static final int PROPERTY_actionMap = 69; - private static final int PROPERTY_actionContext = 70; - private static final int PROPERTY_inputMethodRequests = 71; - private static final int PROPERTY_graphicsConfiguration = 72; - private static final int PROPERTY_visibleRect = 73; - private static final int PROPERTY_component = 74; - - // Property array - private static PropertyDescriptor[] properties = new PropertyDescriptor[75]; - - static { - try { - properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", QCListPane.class, "getToolkit", null ); - properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", QCListPane.class, "getRootPane", null ); - properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", QCListPane.class, "isVisible", "setVisible" ); - properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor ( "topLevelAncestor", QCListPane.class, "getTopLevelAncestor", null ); - properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", QCListPane.class, "getTreeLock", null ); - properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", QCListPane.class, "getMaximumSize", "setMaximumSize" ); - properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", QCListPane.class, "getPeer", null ); - properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor ( "nextFocusableComponent", QCListPane.class, "getNextFocusableComponent", "setNextFocusableComponent" ); - properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", QCListPane.class, "getComponentOrientation", "setComponentOrientation" ); - properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor ( "focusCycleRoot", QCListPane.class, "isFocusCycleRoot", null ); - properties[PROPERTY_validateRoot] = new PropertyDescriptor ( "validateRoot", QCListPane.class, "isValidateRoot", null ); - properties[PROPERTY_selectionModel] = new PropertyDescriptor ( "selectionModel", QCListPane.class, "getSelectionModel", "setSelectionModel" ); - properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", QCListPane.class, "getColorModel", null ); - properties[PROPERTY_model] = new PropertyDescriptor ( "model", QCListPane.class, "getModel", null ); - properties[PROPERTY_components] = new PropertyDescriptor ( "components", QCListPane.class, "getComponents", null ); - properties[PROPERTY_y] = new PropertyDescriptor ( "y", QCListPane.class, "getY", null ); - properties[PROPERTY_x] = new PropertyDescriptor ( "x", QCListPane.class, "getX", null ); - properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", QCListPane.class, "isEnabled", "setEnabled" ); - properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", QCListPane.class, "isOpaque", "setOpaque" ); - properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", QCListPane.class, "isValid", null ); - properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor ( "verifyInputWhenFocusTarget", QCListPane.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget" ); - properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", QCListPane.class, "getBounds", "setBounds" ); - properties[PROPERTY_inputVerifier] = new PropertyDescriptor ( "inputVerifier", QCListPane.class, "getInputVerifier", "setInputVerifier" ); - properties[PROPERTY_autoscrolls] = new PropertyDescriptor ( "autoscrolls", QCListPane.class, "getAutoscrolls", "setAutoscrolls" ); - properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor ( "optimizedDrawingEnabled", QCListPane.class, "isOptimizedDrawingEnabled", null ); - properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", QCListPane.class, "isDisplayable", null ); - properties[PROPERTY_allowActions] = new PropertyDescriptor ( "allowActions", QCListPane.class, "getAllowActions", "setAllowActions" ); - properties[PROPERTY_toolTipText] = new PropertyDescriptor ( "toolTipText", QCListPane.class, "getToolTipText", "setToolTipText" ); - properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", QCListPane.class, "getLocale", "setLocale" ); - properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", QCListPane.class, "getLocationOnScreen", null ); - properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", QCListPane.class, "getLayout", "setLayout" ); - properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor ( "requestFocusEnabled", QCListPane.class, "isRequestFocusEnabled", "setRequestFocusEnabled" ); - properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", QCListPane.class, "getParent", null ); - properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor ( "minimumSizeSet", QCListPane.class, "isMinimumSizeSet", null ); - properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", QCListPane.class, "getForeground", "setForeground" ); - properties[PROPERTY_font] = new PropertyDescriptor ( "font", QCListPane.class, "getFont", "setFont" ); - properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", QCListPane.class, "getGraphics", null ); - properties[PROPERTY_UIClassID] = new PropertyDescriptor ( "UIClassID", QCListPane.class, "getUIClassID", null ); - properties[PROPERTY_width] = new PropertyDescriptor ( "width", QCListPane.class, "getWidth", null ); - properties[PROPERTY_class] = new PropertyDescriptor ( "class", QCListPane.class, "getClass", null ); - properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", QCListPane.class, "isLightweight", null ); - properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", QCListPane.class, "getAccessibleContext", null ); - properties[PROPERTY_name] = new PropertyDescriptor ( "name", QCListPane.class, "getName", "setName" ); - properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", QCListPane.class, "isShowing", null ); - properties[PROPERTY_confirm] = new PropertyDescriptor ( "confirm", QCListPane.class, "getConfirm", "setConfirm" ); - properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", QCListPane.class, "getComponentCount", null ); - properties[PROPERTY_border] = new PropertyDescriptor ( "border", QCListPane.class, "getBorder", "setBorder" ); - properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", QCListPane.class, "getMinimumSize", "setMinimumSize" ); - properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor ( "registeredKeyStrokes", QCListPane.class, "getRegisteredKeyStrokes", null ); - properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", QCListPane.class, "isDoubleBuffered", "setDoubleBuffered" ); - properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor ( "debugGraphicsOptions", QCListPane.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions" ); - properties[PROPERTY_height] = new PropertyDescriptor ( "height", QCListPane.class, "getHeight", null ); - properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", QCListPane.class, "getInsets", null ); - properties[PROPERTY_paintingTile] = new PropertyDescriptor ( "paintingTile", QCListPane.class, "isPaintingTile", null ); - properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", QCListPane.class, "isFocusTraversable", null ); - properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", QCListPane.class, "getAlignmentY", "setAlignmentY" ); - properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", QCListPane.class, "getAlignmentX", "setAlignmentX" ); - properties[PROPERTY_root] = new PropertyDescriptor ( "root", QCListPane.class, "getRoot", "setRoot" ); - properties[PROPERTY_selectedObjects] = new PropertyDescriptor ( "selectedObjects", QCListPane.class, "getSelectedObjects", null ); - properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", QCListPane.class, "getDropTarget", "setDropTarget" ); - properties[PROPERTY_managingFocus] = new PropertyDescriptor ( "managingFocus", QCListPane.class, "isManagingFocus", null ); - properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", QCListPane.class, "getPreferredSize", "setPreferredSize" ); - properties[PROPERTY_selectedObject] = new PropertyDescriptor ( "selectedObject", QCListPane.class, "getSelectedObject", null ); - properties[PROPERTY_background] = new PropertyDescriptor ( "background", QCListPane.class, "getBackground", "setBackground" ); - properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", QCListPane.class, "getInputContext", null ); - properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor ( "preferredSizeSet", QCListPane.class, "isPreferredSizeSet", null ); - properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", QCListPane.class, "getCursor", "setCursor" ); - properties[PROPERTY_visibleRowCount] = new PropertyDescriptor ( "visibleRowCount", QCListPane.class, "getVisibleRowCount", "setVisibleRowCount" ); - properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor ( "maximumSizeSet", QCListPane.class, "isMaximumSizeSet", null ); - properties[PROPERTY_actionMap] = new PropertyDescriptor ( "actionMap", QCListPane.class, "getActionMap", "setActionMap" ); - properties[PROPERTY_actionContext] = new PropertyDescriptor ( "actionContext", QCListPane.class, "getActionContext", null ); - properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", QCListPane.class, "getInputMethodRequests", null ); - properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", QCListPane.class, "getGraphicsConfiguration", null ); - properties[PROPERTY_visibleRect] = new PropertyDescriptor ( "visibleRect", QCListPane.class, "getVisibleRect", null ); - properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", QCListPane.class, null, null, "getComponent", null ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Properties - - // Here you can add code for customizing the properties array. - -}//GEN-LAST:Properties - - // EventSet identifiers//GEN-FIRST:Events - private static final int EVENT_mouseMotionListener = 0; - private static final int EVENT_inputMethodListener = 1; - private static final int EVENT_ancestorListener = 2; - private static final int EVENT_componentListener = 3; - private static final int EVENT_hierarchyBoundsListener = 4; - private static final int EVENT_mouseListener = 5; - private static final int EVENT_focusListener = 6; - private static final int EVENT_listSelectionListener = 7; - private static final int EVENT_propertyChangeListener = 8; - private static final int EVENT_keyListener = 9; - private static final int EVENT_hierarchyListener = 10; - private static final int EVENT_containerListener = 11; - private static final int EVENT_vetoableChangeListener = 12; - private static final int EVENT_errorListener = 13; - - // EventSet array - private static EventSetDescriptor[] eventSets = new EventSetDescriptor[14]; - - static { - try { - eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( QCListPane.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[0], "addMouseMotionListener", "removeMouseMotionListener" ); - eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( QCListPane.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[0], "addInputMethodListener", "removeInputMethodListener" ); - eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( QCListPane.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[0], "addAncestorListener", "removeAncestorListener" ); - eventSets[EVENT_componentListener] = new EventSetDescriptor ( QCListPane.class, "componentListener", java.awt.event.ComponentListener.class, new String[0], "addComponentListener", "removeComponentListener" ); - eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( QCListPane.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[0], "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); - eventSets[EVENT_mouseListener] = new EventSetDescriptor ( QCListPane.class, "mouseListener", java.awt.event.MouseListener.class, new String[0], "addMouseListener", "removeMouseListener" ); - eventSets[EVENT_focusListener] = new EventSetDescriptor ( QCListPane.class, "focusListener", java.awt.event.FocusListener.class, new String[0], "addFocusListener", "removeFocusListener" ); - eventSets[EVENT_listSelectionListener] = new EventSetDescriptor ( QCListPane.class, "listSelectionListener", javax.swing.event.ListSelectionListener.class, new String[0], "addListSelectionListener", "removeListSelectionListener" ); - eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( QCListPane.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[0], "addPropertyChangeListener", "removePropertyChangeListener" ); - eventSets[EVENT_keyListener] = new EventSetDescriptor ( QCListPane.class, "keyListener", java.awt.event.KeyListener.class, new String[0], "addKeyListener", "removeKeyListener" ); - eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( QCListPane.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[0], "addHierarchyListener", "removeHierarchyListener" ); - eventSets[EVENT_containerListener] = new EventSetDescriptor ( QCListPane.class, "containerListener", java.awt.event.ContainerListener.class, new String[0], "addContainerListener", "removeContainerListener" ); - eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( QCListPane.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[0], "addVetoableChangeListener", "removeVetoableChangeListener" ); - eventSets[EVENT_errorListener] = new EventSetDescriptor ( QCListPane.class, "errorListener", com.ibm.as400.vaccess.ErrorListener.class, new String[0], "addErrorListener", "removeErrorListener" ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Events - - // Here you can add code for customizing the event sets array. - -}//GEN-LAST:Events - - private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef - private static java.awt.Image iconColor32 = null; - private static java.awt.Image iconMono16 = null; - private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef - private static String iconNameC16 = null;//GEN-BEGIN:Icons - private static String iconNameC32 = null; - private static String iconNameM16 = null; - private static String iconNameM32 = null;//GEN-END:Icons - - private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx - private static int defaultEventIndex = -1;//GEN-END:Idx - - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

- * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } - - /** - * Gets the beans EventSetDescriptors. - * - * @return An array of EventSetDescriptors describing the kinds of - * events fired by this bean. May return null if the information - * should be obtained by automatic analysis. - */ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSets; - } - - /** - * A bean may have a "default" property that is the property that will - * mostly commonly be initially chosen for update by human's who are - * customizing the bean. - * @return Index of default property in the PropertyDescriptor array - * returned by getPropertyDescriptors. - *

Returns -1 if there is no default property. - */ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** - * A bean may have a "default" event that is the event that will - * mostly commonly be used by human's when using the bean. - * @return Index of default event in the EventSetDescriptor array - * returned by getEventSetDescriptors. - *

Returns -1 if there is no default event. - */ - public int getDefaultEventIndex() { - return defaultPropertyIndex; - } - - /** - * This method returns an image object that can be used to - * represent the bean in toolboxes, toolbars, etc. Icon images - * will typically be GIFs, but may in future include other formats. - *

- * Beans aren't required to provide icons and may return null from - * this method. - *

- * There are four possible flavors of icons (16x16 color, - * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only - * support a single icon we recommend supporting 16x16 color. - *

- * We recommend that icons have a "transparent" background - * so they can be rendered onto an existing background. - * - * @param iconKind The kind of icon requested. This should be - * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, - * ICON_MONO_16x16, or ICON_MONO_32x32. - * @return An image object representing the requested icon. May - * return null if no suitable icon is available. - */ - public java.awt.Image getIcon(int iconKind) { - switch ( iconKind ) { - case ICON_COLOR_16x16: - if ( iconNameC16 == null ) - return null; - else { - if( iconColor16 == null ) - iconColor16 = loadImage( iconNameC16 ); - return iconColor16; - } - case ICON_COLOR_32x32: - if ( iconNameC32 == null ) - return null; - else { - if( iconColor32 == null ) - iconColor32 = loadImage( iconNameC32 ); - return iconColor32; - } - case ICON_MONO_16x16: - if ( iconNameM16 == null ) - return null; - else { - if( iconMono16 == null ) - iconMono16 = loadImage( iconNameM16 ); - return iconMono16; - } - case ICON_MONO_32x32: - if ( iconNameM32 == null ) - return null; - else { - if( iconNameM32 == null ) - iconMono32 = loadImage( iconNameM32 ); - return iconMono32; - } - } - return null; - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCMgr.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCMgr.java deleted file mode 100644 index dd78f18ce..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCMgr.java +++ /dev/null @@ -1,400 +0,0 @@ -/* - * QCMgr.java - * - * Created on July 12, 2000, 2:37 AM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.util.*; -import com.ibm.as400.access.AS400; - -/** Simple manager for multiple shared AS400 connections. Clients of class - * QCServiceClient make a request for a server and service. The server is - * an AS400. The service is one of the services AS400.FILE etc. A service - * record is returned, which is resubmitted by the client to relinquish - * the service. The AS400 connection is a public data member of that - * service record. The QCMgr instance can also indicate to the QCServiceClient - * that its connection is about to become invalid by calling the client's - * interface function {@link QCServiceClient.relinquish()} - * - * The URL for the service request is of the form: - * - *

 qcmgr:serverName/SERVICE 
- * - * e.g., qcmgr:ANAS400/FILE - * - * A QCMgr maintains one com.ibm.as400.access.AS400 object for each server. - * If you wish to have multiple instances of server objects, instance multiple - * QCMgr's. - * - * @author jax - * @version 1.0 - */ -public class QCMgr extends Object { - - private QCHash serverHash = new QCHash(); - private QCServiceHash serviceHash = new QCServiceHash(); - - /** This exception is thrown if the "url" submitted for a service - * request is unrecognized. - */ - public class QCUnknownProtocolException extends java.lang.Exception { - QCUnknownProtocolException(String s) { super(s); } - } - - /** This is thrown if a request is made for an unknown or unsupported service. - */ - public class QCUnknownServiceException extends java.lang.Exception { - QCUnknownServiceException(String s) { super(s); } - } - - /** Thrown if an invalid service record is returned by a client to the - * call {@link freeService()}. - */ - public class QCInvalidServiceRecordException extends java.lang.Exception { - QCInvalidServiceRecordException(String s) { super(s); } - } - - /** Class used to parse the requests made for service. - */ - public class Locator { - - String locator; - - Locator (String representation) { locator = representation; } - - public String toHashName () - throws QCUnknownProtocolException - { - String hashName =""; - StringTokenizer tokenizer = new StringTokenizer(locator); - try - { - String protocol= tokenizer.nextToken(":"); - if (!protocol.equals("qcmgr")) - { - throw new QCUnknownProtocolException("QC Unknown protocol: " + protocol); - } /* End if*/ - } /* End try*/ - - catch (NoSuchElementException e) - { - e.printStackTrace(System.err); - } /* End catch*/ - - try - { - hashName = tokenizer.nextToken(":/"); - } /* End try*/ - - catch (NoSuchElementException e) - { - e.printStackTrace(System.err); - } /* End catch*/ - - return hashName; - } - - public String toServerName () - throws QCUnknownProtocolException - { - return toHashName(); - } - - - public String toServiceName () - throws QCUnknownProtocolException - { - String serviceName = ""; - StringTokenizer tokenizer = new StringTokenizer(locator); - try - { - String protocol= tokenizer.nextToken(":"); - if (!protocol.equals("qcmgr")) - { - throw new QCUnknownProtocolException("QC Unknown protocol: " + protocol); - } /* End if*/ - } /* End try*/ - - catch (NoSuchElementException e) - { - e.printStackTrace(System.err); - } /* End catch*/ - - try - { - tokenizer.nextToken("/"); - } /* End try*/ - - catch (NoSuchElementException e) - { - e.printStackTrace(System.err); - } /* End catch*/ - try - { - serviceName = tokenizer.nextToken("/"); - } /* End try*/ - - catch (NoSuchElementException e) - { - e.printStackTrace(System.err); - } /* End catch*/ - return serviceName; - } - - public int toService () - throws QCUnknownProtocolException - { - return convertServiceName(toServiceName()); - } - - - public int convertServiceName(String serviceName) { - int service = -1; - if (serviceName.equals ("COMMAND")) - { - service = AS400.COMMAND; - } - else if (serviceName.equals ("DATAQUEUE")) - { - service = AS400.DATAQUEUE; - } - else if (serviceName.equals ("FILE")) - { - service = AS400.FILE; - } /* End if*/ - else if (serviceName.equals ("PRINT")) - { - service = AS400.PRINT; - } /* End if*/ - else if (serviceName.equals ("RECORDACCESS")) - { - service = AS400.RECORDACCESS; - } /* End if*/ - return service; - } - - public String toProtocol () - { - String protocol = ":NONE:"; - StringTokenizer tokenizer = new StringTokenizer(locator); - try - { - protocol= tokenizer.nextToken(":"); - } /* End try*/ - catch (NoSuchElementException e) - { - e.printStackTrace(System.err); - } /* End catch*/ - return protocol; - } - } - - /** Creates new QCMgr */ - public QCMgr() { - - } - - /** Find a server if we have already created it. - * Create it if not already present. - */ - public AS400 getServer(String serverName,String hashName) { - AS400 a = serverHash.get(hashName); - if (null == a) { - a = new AS400 (serverName); - serverHash.put(serverName, a); - } - return a; - } - - /** Create a new service record */ - public QCServiceRecord createServiceRecord(String serverName,int service,AS400 as400,QCServiceClient client) throws QCUnknownServiceException { - switch (service) - { - case AS400.COMMAND: // Constant indicating the Command AS/400 service. - case AS400.DATAQUEUE: // Constant indicating the Dataqueue AS/400 service. - case AS400.FILE: // Constant indicating the File AS/400 service. - case AS400.PRINT: // Constant indicating the Print AS/400 service. - case AS400.RECORDACCESS: // Constant indicating the Record Access AS/400 service. - break; - default: - throw new QCUnknownServiceException("Unknown service: " + service); - } /* End switch*/ - - QCServiceRecord sr = new QCServiceRecord (serverName, service, as400, client); - return sr; - } - - /** This function accepts a URL-like request from a {@link QCServiceClient} for a - * com.ibm.as400.access.AS400 service on a server. A service record is - * returned which contains the reference to the server. The service record - * is passed back to QCMgr when the QCServiceClient is done with the service. - * @param representation A string of the form qcmgr:server/service - * - * where server is the name of the desired server and - * service is one of the service names for the AS400 - * object, e.g., FILE PRINT etc. - * @param client The client must implement the interface {@link QCServiceClient}. - * @throws QCUnknownServiceException If the name of the service is not recoqnized. - * @throws QCUnknownProtocolException If the "protocol" portion of the URL is not qcmgr. - * @return A QCServiceRecord which can be examined to obtain reference to the AS400 instance being represented. This record is passed back to the QCMgr in the functi{@link on freeServ}ice when the client is done with the service - */ - public QCServiceRecord getService(String representation,QCServiceClient client) throws QCUnknownServiceException, QCUnknownProtocolException { - Locator locator = new Locator(representation); - - final String serverName = locator.toServerName(); - final String hashName = locator.toHashName(); - final int service = locator.toService(); - - AS400 as400 = getServer(serverName,hashName); - - QCServiceRecord sr = - createServiceRecord(serverName, - service, - as400, - client); - - serviceHash.put(sr, as400); - return sr; - } - - /** A QCServiceClient uses this function to inform the QCMgr that the - * service which was obtained is no longer needed by the client. - * @param sr The QCServiceRecord obtained by a call to {@link QCMgr.getService()} - * @throws QCInvalidServiceRecordException If the service record isn't valid. - */ - public void freeService(QCServiceRecord sr) throws QCInvalidServiceRecordException { - if (!serviceHash.containsServiceRecord(sr)) - { - throw new QCInvalidServiceRecordException("Invalid service record: " + sr.toString()); - } - serviceHash.remove(sr); - if (!serviceHash.containsServer(sr.as400)) - { - AS400 as400 = serverHash.remove(sr.serverName); - if (as400.isConnected()) - { - as400.disconnectAllServices(); - } /* End if*/ - } /* End if*/ - else if (!serviceHash.anyServiceClients(sr.as400, sr.service)) { - if (sr.as400.isConnected(sr.service)) - { - sr.as400.disconnectService(sr.service); - } /* End if*/ - } /* End if*/ - } - - /** - * Extract protocol portion of the representation of a service request. - * @param representation - * @return - */ - public String toProtocol(String representation) { - return new Locator(representation).toProtocol(); - } - - /** - * Extract server portion of the representation of a service request. - * @param representation - * @throws QCUnknownProtocolException - * @return - */ - public String toServerName(String representation) throws QCUnknownProtocolException { - return new Locator(representation).toServerName(); - } - - /** - * Extract service portion of the representation of a service request. - * @param representation - * @throws QCUnknownProtocolException - * @return - */ - public String toServiceName(String representation) throws QCUnknownProtocolException { - return new Locator(representation).toServiceName(); - } - - /** - * Extract service portion of the representation of a service request - * and convert it to an AS400 service number. - * @param representation - * @throws QCUnknownProtocolException - * @return - */ - public int toService(String representation) throws QCUnknownProtocolException { - return new Locator(representation).toService(); - } - - /** Return a string representing an AS400 service from its integer value. - * @param service Integer representing an AS400 service constant. - * @return The string name of the service represented by the int. - */ - public String intToServiceName (int service) { - String result = "Unknown"; - switch (service) - { - case AS400.COMMAND: // Constant indicating the Command AS/400 service. - result = "COMMAND"; - break; - case AS400.DATAQUEUE: // Constant indicating the Dataqueue AS/400 service. - result = "DATAQUEUE"; - break; - case AS400.FILE: // Constant indicating the File AS/400 service. - result = "FILE"; - break; - case AS400.PRINT: // Constant indicating the Print AS/400 service. - result = "PRINT"; - break; - case AS400.RECORDACCESS: // Constant indicating the Record Access AS/400 service. - result = "RECORDACCESS"; - break; - } - return result; - } - - /** Return a string illustrating all current service records. - * @return A string of the form server,service\n ... repeated - * for as many service records as exist. - */ - public String serviceRecordsToString () { - StringBuffer result = new StringBuffer(); - for (Enumeration e = serviceHash.keys(); e.hasMoreElements();) { - QCServiceRecord sr = (QCServiceRecord) e.nextElement(); - result.append(sr.serverName + "," + intToServiceName(sr.service) + "\n"); - } - return result.toString(); - } - - /** Return a string listing the servers active */ - public String serversToString () { - StringBuffer result = new StringBuffer(); - for (Enumeration e = serverHash.keys(); e.hasMoreElements();) { - result.append((String) e.nextElement() + ","); - } - return result.toString(); - } - - /** Test QCMgr. - * @param argv Not used. - */ - public static void main(String[] argv) { - QCMgr q = new QCMgr(); - try - { - System.out.println("Protocol == " + q.toProtocol(argv[0])); - System.out.println("System == " + q.toServerName(argv[0])); - System.out.println("Service == " + q.toServiceName(argv[0])); - System.out.println("Service# == " + q.toService(argv[0])); - } /* End try*/ - catch (Exception e) - { - e.printStackTrace(System.err); - } /* End catch*/ - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCMgrViewer.form b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCMgrViewer.form deleted file mode 100644 index e32e00292..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCMgrViewer.form +++ /dev/null @@ -1,53 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCMgrViewer.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCMgrViewer.java deleted file mode 100644 index 361099637..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCMgrViewer.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * QCMgrViewer.java - * - * Created on July 22, 2000, 5:52 PM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** - * - * @author jax - * @version - */ -public class QCMgrViewer extends javax.swing.JPanel { - - private QCMgr manager; - - /** Creates new form QCMgrViewer */ - public QCMgrViewer() { - initComponents (); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the FormEditor. - */ - private void initComponents () {//GEN-BEGIN:initComponents - refreshButton = new javax.swing.JButton (); - connectionViewerTextArea = new javax.swing.JTextArea (); - connectionViewerLabel = new javax.swing.JLabel (); - setLayout (new java.awt.BorderLayout ()); - addFocusListener (new java.awt.event.FocusAdapter () { - public void focusGained (java.awt.event.FocusEvent evt) { - formFocusGained (evt); - } - } - ); - - refreshButton.setToolTipText ("Refreshes view of connection manager service sessions."); - refreshButton.setText ("Refresh"); - refreshButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - refreshButtonActionPerformed (evt); - } - } - ); - - - add (refreshButton, java.awt.BorderLayout.SOUTH); - - connectionViewerTextArea.setToolTipText ("Shows the managed connections currently active when you press the Refresh button."); - connectionViewerTextArea.setEnabled (false); - - - add (connectionViewerTextArea, java.awt.BorderLayout.CENTER); - - connectionViewerLabel.setText ("Connection manager service session active in this notebook."); - connectionViewerLabel.setToolTipText ("Connections in this notebook are pooled by a simple connection manager."); - connectionViewerLabel.setHorizontalAlignment (javax.swing.SwingConstants.CENTER); - - - add (connectionViewerLabel, java.awt.BorderLayout.NORTH); - - }//GEN-END:initComponents - - private void formFocusGained (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_formFocusGained - // Add your handling code here: - refresh(); - }//GEN-LAST:event_formFocusGained - - private void refreshButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshButtonActionPerformed - // Add your handling code here: - refresh(); - }//GEN-LAST:event_refreshButtonActionPerformed - - private void refresh() { - if (null != manager) { - // Set the header for servers. - connectionViewerTextArea.setText("Server instances currently active:\n\n"); - java.util.StringTokenizer servers = new java.util.StringTokenizer(manager.serversToString(),","); - - // Get the servers. - while (servers.hasMoreTokens()) { - connectionViewerTextArea.append(servers.nextToken() + " "); - } - - // Make some space. - connectionViewerTextArea.append("\n\n"); - - // Set the header for the service connections - connectionViewerTextArea.append("Service connections currently active:\n\n"); - - // Get the service connections. - java.util.StringTokenizer records = new java.util.StringTokenizer(manager.serviceRecordsToString(),"\n"); - while (records.hasMoreTokens()) { - java.util.StringTokenizer record = new java.util.StringTokenizer(records.nextToken(), ","); - if (record.hasMoreTokens()) { - connectionViewerTextArea.append("Server: " + record.nextToken() + "\n"); - } - if (record.hasMoreTokens()) { - connectionViewerTextArea.append("Service: " + record.nextToken() + "\n\n"); - } - } - - // Done. - repaint(500); - } - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton refreshButton; - private javax.swing.JTextArea connectionViewerTextArea; - private javax.swing.JLabel connectionViewerLabel; - // End of variables declaration//GEN-END:variables - - /** Sets the manager for this component to poll for service connections. */ - public void setManager (QCMgr mgr) { - manager = mgr; - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCMgrViewerBeanInfo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCMgrViewerBeanInfo.java deleted file mode 100644 index d92681a4f..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCMgrViewerBeanInfo.java +++ /dev/null @@ -1,315 +0,0 @@ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.beans.*; - -public class QCMgrViewerBeanInfo extends SimpleBeanInfo { - - // Property identifiers //GEN-FIRST:Properties - private static final int PROPERTY_font = 0; - private static final int PROPERTY_componentCount = 1; - private static final int PROPERTY_height = 2; - private static final int PROPERTY_width = 3; - private static final int PROPERTY_insets = 4; - private static final int PROPERTY_opaque = 5; - private static final int PROPERTY_displayable = 6; - private static final int PROPERTY_optimizedDrawingEnabled = 7; - private static final int PROPERTY_name = 8; - private static final int PROPERTY_managingFocus = 9; - private static final int PROPERTY_dropTarget = 10; - private static final int PROPERTY_parent = 11; - private static final int PROPERTY_layout = 12; - private static final int PROPERTY_y = 13; - private static final int PROPERTY_x = 14; - private static final int PROPERTY_graphicsConfiguration = 15; - private static final int PROPERTY_treeLock = 16; - private static final int PROPERTY_bounds = 17; - private static final int PROPERTY_minimumSize = 18; - private static final int PROPERTY_registeredKeyStrokes = 19; - private static final int PROPERTY_minimumSizeSet = 20; - private static final int PROPERTY_inputContext = 21; - private static final int PROPERTY_UIClassID = 22; - private static final int PROPERTY_showing = 23; - private static final int PROPERTY_paintingTile = 24; - private static final int PROPERTY_cursor = 25; - private static final int PROPERTY_enabled = 26; - private static final int PROPERTY_colorModel = 27; - private static final int PROPERTY_rootPane = 28; - private static final int PROPERTY_accessibleContext = 29; - private static final int PROPERTY_focusCycleRoot = 30; - private static final int PROPERTY_visible = 31; - private static final int PROPERTY_valid = 32; - private static final int PROPERTY_componentOrientation = 33; - private static final int PROPERTY_autoscrolls = 34; - private static final int PROPERTY_nextFocusableComponent = 35; - private static final int PROPERTY_background = 36; - private static final int PROPERTY_debugGraphicsOptions = 37; - private static final int PROPERTY_lightweight = 38; - private static final int PROPERTY_doubleBuffered = 39; - private static final int PROPERTY_graphics = 40; - private static final int PROPERTY_topLevelAncestor = 41; - private static final int PROPERTY_validateRoot = 42; - private static final int PROPERTY_locale = 43; - private static final int PROPERTY_toolkit = 44; - private static final int PROPERTY_preferredSize = 45; - private static final int PROPERTY_visibleRect = 46; - private static final int PROPERTY_peer = 47; - private static final int PROPERTY_components = 48; - private static final int PROPERTY_toolTipText = 49; - private static final int PROPERTY_verifyInputWhenFocusTarget = 50; - private static final int PROPERTY_maximumSizeSet = 51; - private static final int PROPERTY_manager = 52; - private static final int PROPERTY_requestFocusEnabled = 53; - private static final int PROPERTY_actionMap = 54; - private static final int PROPERTY_inputVerifier = 55; - private static final int PROPERTY_focusTraversable = 56; - private static final int PROPERTY_preferredSizeSet = 57; - private static final int PROPERTY_foreground = 58; - private static final int PROPERTY_maximumSize = 59; - private static final int PROPERTY_class = 60; - private static final int PROPERTY_inputMethodRequests = 61; - private static final int PROPERTY_alignmentY = 62; - private static final int PROPERTY_alignmentX = 63; - private static final int PROPERTY_locationOnScreen = 64; - private static final int PROPERTY_border = 65; - private static final int PROPERTY_component = 66; - - // Property array - private static PropertyDescriptor[] properties = new PropertyDescriptor[67]; - - static { - try { - properties[PROPERTY_font] = new PropertyDescriptor ( "font", QCMgrViewer.class, "getFont", "setFont" ); - properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", QCMgrViewer.class, "getComponentCount", null ); - properties[PROPERTY_height] = new PropertyDescriptor ( "height", QCMgrViewer.class, "getHeight", null ); - properties[PROPERTY_width] = new PropertyDescriptor ( "width", QCMgrViewer.class, "getWidth", null ); - properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", QCMgrViewer.class, "getInsets", null ); - properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", QCMgrViewer.class, "isOpaque", "setOpaque" ); - properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", QCMgrViewer.class, "isDisplayable", null ); - properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor ( "optimizedDrawingEnabled", QCMgrViewer.class, "isOptimizedDrawingEnabled", null ); - properties[PROPERTY_name] = new PropertyDescriptor ( "name", QCMgrViewer.class, "getName", "setName" ); - properties[PROPERTY_managingFocus] = new PropertyDescriptor ( "managingFocus", QCMgrViewer.class, "isManagingFocus", null ); - properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", QCMgrViewer.class, "getDropTarget", "setDropTarget" ); - properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", QCMgrViewer.class, "getParent", null ); - properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", QCMgrViewer.class, "getLayout", "setLayout" ); - properties[PROPERTY_y] = new PropertyDescriptor ( "y", QCMgrViewer.class, "getY", null ); - properties[PROPERTY_x] = new PropertyDescriptor ( "x", QCMgrViewer.class, "getX", null ); - properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", QCMgrViewer.class, "getGraphicsConfiguration", null ); - properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", QCMgrViewer.class, "getTreeLock", null ); - properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", QCMgrViewer.class, "getBounds", "setBounds" ); - properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", QCMgrViewer.class, "getMinimumSize", "setMinimumSize" ); - properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor ( "registeredKeyStrokes", QCMgrViewer.class, "getRegisteredKeyStrokes", null ); - properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor ( "minimumSizeSet", QCMgrViewer.class, "isMinimumSizeSet", null ); - properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", QCMgrViewer.class, "getInputContext", null ); - properties[PROPERTY_UIClassID] = new PropertyDescriptor ( "UIClassID", QCMgrViewer.class, "getUIClassID", null ); - properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", QCMgrViewer.class, "isShowing", null ); - properties[PROPERTY_paintingTile] = new PropertyDescriptor ( "paintingTile", QCMgrViewer.class, "isPaintingTile", null ); - properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", QCMgrViewer.class, "getCursor", "setCursor" ); - properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", QCMgrViewer.class, "isEnabled", "setEnabled" ); - properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", QCMgrViewer.class, "getColorModel", null ); - properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", QCMgrViewer.class, "getRootPane", null ); - properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", QCMgrViewer.class, "getAccessibleContext", null ); - properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor ( "focusCycleRoot", QCMgrViewer.class, "isFocusCycleRoot", null ); - properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", QCMgrViewer.class, "isVisible", "setVisible" ); - properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", QCMgrViewer.class, "isValid", null ); - properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", QCMgrViewer.class, "getComponentOrientation", "setComponentOrientation" ); - properties[PROPERTY_autoscrolls] = new PropertyDescriptor ( "autoscrolls", QCMgrViewer.class, "getAutoscrolls", "setAutoscrolls" ); - properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor ( "nextFocusableComponent", QCMgrViewer.class, "getNextFocusableComponent", "setNextFocusableComponent" ); - properties[PROPERTY_background] = new PropertyDescriptor ( "background", QCMgrViewer.class, "getBackground", "setBackground" ); - properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor ( "debugGraphicsOptions", QCMgrViewer.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions" ); - properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", QCMgrViewer.class, "isLightweight", null ); - properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", QCMgrViewer.class, "isDoubleBuffered", "setDoubleBuffered" ); - properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", QCMgrViewer.class, "getGraphics", null ); - properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor ( "topLevelAncestor", QCMgrViewer.class, "getTopLevelAncestor", null ); - properties[PROPERTY_validateRoot] = new PropertyDescriptor ( "validateRoot", QCMgrViewer.class, "isValidateRoot", null ); - properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", QCMgrViewer.class, "getLocale", "setLocale" ); - properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", QCMgrViewer.class, "getToolkit", null ); - properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", QCMgrViewer.class, "getPreferredSize", "setPreferredSize" ); - properties[PROPERTY_visibleRect] = new PropertyDescriptor ( "visibleRect", QCMgrViewer.class, "getVisibleRect", null ); - properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", QCMgrViewer.class, "getPeer", null ); - properties[PROPERTY_components] = new PropertyDescriptor ( "components", QCMgrViewer.class, "getComponents", null ); - properties[PROPERTY_toolTipText] = new PropertyDescriptor ( "toolTipText", QCMgrViewer.class, "getToolTipText", "setToolTipText" ); - properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor ( "verifyInputWhenFocusTarget", QCMgrViewer.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget" ); - properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor ( "maximumSizeSet", QCMgrViewer.class, "isMaximumSizeSet", null ); - properties[PROPERTY_manager] = new PropertyDescriptor ( "manager", QCMgrViewer.class, null, "setManager" ); - properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor ( "requestFocusEnabled", QCMgrViewer.class, "isRequestFocusEnabled", "setRequestFocusEnabled" ); - properties[PROPERTY_actionMap] = new PropertyDescriptor ( "actionMap", QCMgrViewer.class, "getActionMap", "setActionMap" ); - properties[PROPERTY_inputVerifier] = new PropertyDescriptor ( "inputVerifier", QCMgrViewer.class, "getInputVerifier", "setInputVerifier" ); - properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", QCMgrViewer.class, "isFocusTraversable", null ); - properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor ( "preferredSizeSet", QCMgrViewer.class, "isPreferredSizeSet", null ); - properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", QCMgrViewer.class, "getForeground", "setForeground" ); - properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", QCMgrViewer.class, "getMaximumSize", "setMaximumSize" ); - properties[PROPERTY_class] = new PropertyDescriptor ( "class", QCMgrViewer.class, "getClass", null ); - properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", QCMgrViewer.class, "getInputMethodRequests", null ); - properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", QCMgrViewer.class, "getAlignmentY", "setAlignmentY" ); - properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", QCMgrViewer.class, "getAlignmentX", "setAlignmentX" ); - properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", QCMgrViewer.class, "getLocationOnScreen", null ); - properties[PROPERTY_border] = new PropertyDescriptor ( "border", QCMgrViewer.class, "getBorder", "setBorder" ); - properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", QCMgrViewer.class, null, null, "getComponent", null ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Properties - - // Here you can add code for customizing the properties array. - -}//GEN-LAST:Properties - - // EventSet identifiers//GEN-FIRST:Events - private static final int EVENT_mouseMotionListener = 0; - private static final int EVENT_ancestorListener = 1; - private static final int EVENT_inputMethodListener = 2; - private static final int EVENT_componentListener = 3; - private static final int EVENT_hierarchyBoundsListener = 4; - private static final int EVENT_mouseListener = 5; - private static final int EVENT_focusListener = 6; - private static final int EVENT_propertyChangeListener = 7; - private static final int EVENT_keyListener = 8; - private static final int EVENT_hierarchyListener = 9; - private static final int EVENT_containerListener = 10; - private static final int EVENT_vetoableChangeListener = 11; - - // EventSet array - private static EventSetDescriptor[] eventSets = new EventSetDescriptor[12]; - - static { - try { - eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( QCMgrViewer.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[0], "addMouseMotionListener", "removeMouseMotionListener" ); - eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( QCMgrViewer.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[0], "addAncestorListener", "removeAncestorListener" ); - eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( QCMgrViewer.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[0], "addInputMethodListener", "removeInputMethodListener" ); - eventSets[EVENT_componentListener] = new EventSetDescriptor ( QCMgrViewer.class, "componentListener", java.awt.event.ComponentListener.class, new String[0], "addComponentListener", "removeComponentListener" ); - eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( QCMgrViewer.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[0], "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); - eventSets[EVENT_mouseListener] = new EventSetDescriptor ( QCMgrViewer.class, "mouseListener", java.awt.event.MouseListener.class, new String[0], "addMouseListener", "removeMouseListener" ); - eventSets[EVENT_focusListener] = new EventSetDescriptor ( QCMgrViewer.class, "focusListener", java.awt.event.FocusListener.class, new String[0], "addFocusListener", "removeFocusListener" ); - eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( QCMgrViewer.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[0], "addPropertyChangeListener", "removePropertyChangeListener" ); - eventSets[EVENT_keyListener] = new EventSetDescriptor ( QCMgrViewer.class, "keyListener", java.awt.event.KeyListener.class, new String[0], "addKeyListener", "removeKeyListener" ); - eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( QCMgrViewer.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[0], "addHierarchyListener", "removeHierarchyListener" ); - eventSets[EVENT_containerListener] = new EventSetDescriptor ( QCMgrViewer.class, "containerListener", java.awt.event.ContainerListener.class, new String[0], "addContainerListener", "removeContainerListener" ); - eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( QCMgrViewer.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[0], "addVetoableChangeListener", "removeVetoableChangeListener" ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Events - - // Here you can add code for customizing the event sets array. - -}//GEN-LAST:Events - - private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef - private static java.awt.Image iconColor32 = null; - private static java.awt.Image iconMono16 = null; - private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef - private static String iconNameC16 = null;//GEN-BEGIN:Icons - private static String iconNameC32 = null; - private static String iconNameM16 = null; - private static String iconNameM32 = null;//GEN-END:Icons - - private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx - private static int defaultEventIndex = -1;//GEN-END:Idx - - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

- * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } - - /** - * Gets the beans EventSetDescriptors. - * - * @return An array of EventSetDescriptors describing the kinds of - * events fired by this bean. May return null if the information - * should be obtained by automatic analysis. - */ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSets; - } - - /** - * A bean may have a "default" property that is the property that will - * mostly commonly be initially chosen for update by human's who are - * customizing the bean. - * @return Index of default property in the PropertyDescriptor array - * returned by getPropertyDescriptors. - *

Returns -1 if there is no default property. - */ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** - * A bean may have a "default" event that is the event that will - * mostly commonly be used by human's when using the bean. - * @return Index of default event in the EventSetDescriptor array - * returned by getEventSetDescriptors. - *

Returns -1 if there is no default event. - */ - public int getDefaultEventIndex() { - return defaultPropertyIndex; - } - - /** - * This method returns an image object that can be used to - * represent the bean in toolboxes, toolbars, etc. Icon images - * will typically be GIFs, but may in future include other formats. - *

- * Beans aren't required to provide icons and may return null from - * this method. - *

- * There are four possible flavors of icons (16x16 color, - * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only - * support a single icon we recommend supporting 16x16 color. - *

- * We recommend that icons have a "transparent" background - * so they can be rendered onto an existing background. - * - * @param iconKind The kind of icon requested. This should be - * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, - * ICON_MONO_16x16, or ICON_MONO_32x32. - * @return An image object representing the requested icon. May - * return null if no suitable icon is available. - */ - public java.awt.Image getIcon(int iconKind) { - switch ( iconKind ) { - case ICON_COLOR_16x16: - if ( iconNameC16 == null ) - return null; - else { - if( iconColor16 == null ) - iconColor16 = loadImage( iconNameC16 ); - return iconColor16; - } - case ICON_COLOR_32x32: - if ( iconNameC32 == null ) - return null; - else { - if( iconColor32 == null ) - iconColor32 = loadImage( iconNameC32 ); - return iconColor32; - } - case ICON_MONO_16x16: - if ( iconNameM16 == null ) - return null; - else { - if( iconMono16 == null ) - iconMono16 = loadImage( iconNameM16 ); - return iconMono16; - } - case ICON_MONO_32x32: - if ( iconNameM32 == null ) - return null; - else { - if( iconNameM32 == null ) - iconMono32 = loadImage( iconNameM32 ); - return iconMono32; - } - } - return null; - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCNotebookPanel.form b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCNotebookPanel.form deleted file mode 100644 index 033909cb8..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCNotebookPanel.form +++ /dev/null @@ -1,133 +0,0 @@ - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCNotebookPanel.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCNotebookPanel.java deleted file mode 100644 index 2035f9601..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCNotebookPanel.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * QCNotebookPanel.java - * - * Created on July 12, 2000, 1:54 AM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** A notebook to hold useful panels of as400.vaccess components. - * @author jax - * @version 1.0 - */ -public class QCNotebookPanel extends javax.swing.JPanel { - - private com.SoftWoehr.JTOpenContrib.QCDemo.QCMgr manager; - /** Creates new form QCNotebookPanel */ - public QCNotebookPanel() { - initComponents (); - manager = new com.SoftWoehr.JTOpenContrib.QCDemo.QCMgr (); - setManagers(); - qCSQLQueryBuilderPanel1.setResultTable(qCSQLResultSetTablePanel1); - qCSQLQueryBuilderPanel1.setResultForm(qCSQLResultSetFormPanel1); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the FormEditor. - */ - private void initComponents () {//GEN-BEGIN:initComponents - jTabbedPane1 = new javax.swing.JTabbedPane (); - qCCommandPanel1 = new com.SoftWoehr.JTOpenContrib.QCDemo.QCCommandPanel (); - qCIFSPanel1 = new com.SoftWoehr.JTOpenContrib.QCDemo.QCIFSPanel (); - qCUserListPanel1 = new com.SoftWoehr.JTOpenContrib.QCDemo.QCUserListPanel (); - qCJobListPanel1 = new com.SoftWoehr.JTOpenContrib.QCDemo.QCJobListPanel (); - qCPrinterListPanel1 = new com.SoftWoehr.JTOpenContrib.QCDemo.QCPrinterListPanel (); - qCSpooledFileViewerPanel1 = new com.SoftWoehr.JTOpenContrib.QCDemo.QCSpooledFileViewerPanel (); - qCSQLQueryBuilderPanel1 = new com.SoftWoehr.JTOpenContrib.QCDemo.QCSQLQueryBuilderPanel (); - qCSQLResultSetTablePanel1 = new com.SoftWoehr.JTOpenContrib.QCDemo.QCSQLResultSetTablePanel (); - qCSQLResultSetFormPanel1 = new com.SoftWoehr.JTOpenContrib.QCDemo.QCSQLResultSetFormPanel (); - qCMgrViewer1 = new com.SoftWoehr.JTOpenContrib.QCDemo.QCMgrViewer (); - setLayout (new java.awt.BorderLayout ()); - - jTabbedPane1.setPreferredSize (new java.awt.Dimension(450, 350)); - - qCCommandPanel1.setPreferredSize (new java.awt.Dimension(450, 380)); - qCCommandPanel1.setName (""); - qCCommandPanel1.setToolTipText ("Uses an AS400 Command Button to execute a command on a server."); - - jTabbedPane1.addTab ("Command", null, qCCommandPanel1, "Click here for Command page."); - - - jTabbedPane1.addTab ("IFS Viewer", qCIFSPanel1); - - - jTabbedPane1.addTab ("User List", null, qCUserListPanel1, "Click here to get a list of users."); - - qCJobListPanel1.setPreferredSize (new java.awt.Dimension(450, 380)); - qCJobListPanel1.setToolTipText ("Shows Job List on system of your choice."); - - jTabbedPane1.addTab ("JobList", null, qCJobListPanel1, "Click here for Job List page."); - - - jTabbedPane1.addTab ("Printer List", qCPrinterListPanel1); - - - jTabbedPane1.addTab ("Spooled File Viewer", qCSpooledFileViewerPanel1); - - - jTabbedPane1.addTab ("SQL Query Builder", qCSQLQueryBuilderPanel1); - - qCSQLResultSetTablePanel1.setToolTipText ("Shows the results of queries issued by the SQL Query Builder."); - - jTabbedPane1.addTab ("SQL Result Table", qCSQLResultSetTablePanel1); - - - jTabbedPane1.addTab ("SQL Result Form", qCSQLResultSetFormPanel1); - - - jTabbedPane1.addTab ("Connection Manager Viewer", qCMgrViewer1); - - - add (jTabbedPane1, java.awt.BorderLayout.CENTER); - - }//GEN-END:initComponents - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JTabbedPane jTabbedPane1; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCCommandPanel qCCommandPanel1; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCIFSPanel qCIFSPanel1; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCUserListPanel qCUserListPanel1; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCJobListPanel qCJobListPanel1; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCPrinterListPanel qCPrinterListPanel1; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCSpooledFileViewerPanel qCSpooledFileViewerPanel1; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCSQLQueryBuilderPanel qCSQLQueryBuilderPanel1; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCSQLResultSetTablePanel qCSQLResultSetTablePanel1; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCSQLResultSetFormPanel qCSQLResultSetFormPanel1; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCMgrViewer qCMgrViewer1; - // End of variables declaration//GEN-END:variables - - /** Propagates an ErrorDialogAdapter to those as400.vaccess components which need it. - * @param eda An instance of ErrorDialogAdapter already associated - * with a suitable frame. - */ - public void propagateEDA(com.ibm.as400.vaccess.ErrorDialogAdapter eda) { - qCCommandPanel1.propagateEDA(eda); - qCJobListPanel1.propagateEDA(eda); - qCUserListPanel1.propagateEDA(eda); - qCIFSPanel1.propagateEDA(eda); - qCPrinterListPanel1.propagateEDA(eda); - qCSpooledFileViewerPanel1.propagateEDA(eda); - qCSQLQueryBuilderPanel1.propagateEDA(eda); - qCSQLResultSetTablePanel1.propagateEDA(eda); - } - - private void setManagers() { - qCCommandPanel1.setManager(manager); - qCJobListPanel1.setManager(manager); - qCUserListPanel1.setManager(manager); - qCIFSPanel1.setManager(manager); - qCPrinterListPanel1.setManager(manager); - qCSpooledFileViewerPanel1.setManager(manager); - qCMgrViewer1.setManager(manager); - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCNotebookPanelBeanInfo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCNotebookPanelBeanInfo.java deleted file mode 100644 index 906a03009..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCNotebookPanelBeanInfo.java +++ /dev/null @@ -1,313 +0,0 @@ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.beans.*; - -public class QCNotebookPanelBeanInfo extends SimpleBeanInfo { - - // Property identifiers //GEN-FIRST:Properties - private static final int PROPERTY_font = 0; - private static final int PROPERTY_componentCount = 1; - private static final int PROPERTY_height = 2; - private static final int PROPERTY_width = 3; - private static final int PROPERTY_insets = 4; - private static final int PROPERTY_opaque = 5; - private static final int PROPERTY_displayable = 6; - private static final int PROPERTY_optimizedDrawingEnabled = 7; - private static final int PROPERTY_name = 8; - private static final int PROPERTY_managingFocus = 9; - private static final int PROPERTY_dropTarget = 10; - private static final int PROPERTY_parent = 11; - private static final int PROPERTY_layout = 12; - private static final int PROPERTY_y = 13; - private static final int PROPERTY_x = 14; - private static final int PROPERTY_graphicsConfiguration = 15; - private static final int PROPERTY_treeLock = 16; - private static final int PROPERTY_bounds = 17; - private static final int PROPERTY_minimumSize = 18; - private static final int PROPERTY_registeredKeyStrokes = 19; - private static final int PROPERTY_minimumSizeSet = 20; - private static final int PROPERTY_inputContext = 21; - private static final int PROPERTY_UIClassID = 22; - private static final int PROPERTY_showing = 23; - private static final int PROPERTY_paintingTile = 24; - private static final int PROPERTY_cursor = 25; - private static final int PROPERTY_enabled = 26; - private static final int PROPERTY_colorModel = 27; - private static final int PROPERTY_rootPane = 28; - private static final int PROPERTY_accessibleContext = 29; - private static final int PROPERTY_focusCycleRoot = 30; - private static final int PROPERTY_visible = 31; - private static final int PROPERTY_valid = 32; - private static final int PROPERTY_componentOrientation = 33; - private static final int PROPERTY_autoscrolls = 34; - private static final int PROPERTY_nextFocusableComponent = 35; - private static final int PROPERTY_background = 36; - private static final int PROPERTY_debugGraphicsOptions = 37; - private static final int PROPERTY_lightweight = 38; - private static final int PROPERTY_doubleBuffered = 39; - private static final int PROPERTY_graphics = 40; - private static final int PROPERTY_topLevelAncestor = 41; - private static final int PROPERTY_validateRoot = 42; - private static final int PROPERTY_locale = 43; - private static final int PROPERTY_toolkit = 44; - private static final int PROPERTY_preferredSize = 45; - private static final int PROPERTY_visibleRect = 46; - private static final int PROPERTY_peer = 47; - private static final int PROPERTY_components = 48; - private static final int PROPERTY_toolTipText = 49; - private static final int PROPERTY_verifyInputWhenFocusTarget = 50; - private static final int PROPERTY_maximumSizeSet = 51; - private static final int PROPERTY_requestFocusEnabled = 52; - private static final int PROPERTY_actionMap = 53; - private static final int PROPERTY_inputVerifier = 54; - private static final int PROPERTY_focusTraversable = 55; - private static final int PROPERTY_preferredSizeSet = 56; - private static final int PROPERTY_foreground = 57; - private static final int PROPERTY_maximumSize = 58; - private static final int PROPERTY_class = 59; - private static final int PROPERTY_inputMethodRequests = 60; - private static final int PROPERTY_alignmentY = 61; - private static final int PROPERTY_alignmentX = 62; - private static final int PROPERTY_locationOnScreen = 63; - private static final int PROPERTY_border = 64; - private static final int PROPERTY_component = 65; - - // Property array - private static PropertyDescriptor[] properties = new PropertyDescriptor[66]; - - static { - try { - properties[PROPERTY_font] = new PropertyDescriptor ( "font", QCNotebookPanel.class, "getFont", "setFont" ); - properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", QCNotebookPanel.class, "getComponentCount", null ); - properties[PROPERTY_height] = new PropertyDescriptor ( "height", QCNotebookPanel.class, "getHeight", null ); - properties[PROPERTY_width] = new PropertyDescriptor ( "width", QCNotebookPanel.class, "getWidth", null ); - properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", QCNotebookPanel.class, "getInsets", null ); - properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", QCNotebookPanel.class, "isOpaque", "setOpaque" ); - properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", QCNotebookPanel.class, "isDisplayable", null ); - properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor ( "optimizedDrawingEnabled", QCNotebookPanel.class, "isOptimizedDrawingEnabled", null ); - properties[PROPERTY_name] = new PropertyDescriptor ( "name", QCNotebookPanel.class, "getName", "setName" ); - properties[PROPERTY_managingFocus] = new PropertyDescriptor ( "managingFocus", QCNotebookPanel.class, "isManagingFocus", null ); - properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", QCNotebookPanel.class, "getDropTarget", "setDropTarget" ); - properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", QCNotebookPanel.class, "getParent", null ); - properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", QCNotebookPanel.class, "getLayout", "setLayout" ); - properties[PROPERTY_y] = new PropertyDescriptor ( "y", QCNotebookPanel.class, "getY", null ); - properties[PROPERTY_x] = new PropertyDescriptor ( "x", QCNotebookPanel.class, "getX", null ); - properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", QCNotebookPanel.class, "getGraphicsConfiguration", null ); - properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", QCNotebookPanel.class, "getTreeLock", null ); - properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", QCNotebookPanel.class, "getBounds", "setBounds" ); - properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", QCNotebookPanel.class, "getMinimumSize", "setMinimumSize" ); - properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor ( "registeredKeyStrokes", QCNotebookPanel.class, "getRegisteredKeyStrokes", null ); - properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor ( "minimumSizeSet", QCNotebookPanel.class, "isMinimumSizeSet", null ); - properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", QCNotebookPanel.class, "getInputContext", null ); - properties[PROPERTY_UIClassID] = new PropertyDescriptor ( "UIClassID", QCNotebookPanel.class, "getUIClassID", null ); - properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", QCNotebookPanel.class, "isShowing", null ); - properties[PROPERTY_paintingTile] = new PropertyDescriptor ( "paintingTile", QCNotebookPanel.class, "isPaintingTile", null ); - properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", QCNotebookPanel.class, "getCursor", "setCursor" ); - properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", QCNotebookPanel.class, "isEnabled", "setEnabled" ); - properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", QCNotebookPanel.class, "getColorModel", null ); - properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", QCNotebookPanel.class, "getRootPane", null ); - properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", QCNotebookPanel.class, "getAccessibleContext", null ); - properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor ( "focusCycleRoot", QCNotebookPanel.class, "isFocusCycleRoot", null ); - properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", QCNotebookPanel.class, "isVisible", "setVisible" ); - properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", QCNotebookPanel.class, "isValid", null ); - properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", QCNotebookPanel.class, "getComponentOrientation", "setComponentOrientation" ); - properties[PROPERTY_autoscrolls] = new PropertyDescriptor ( "autoscrolls", QCNotebookPanel.class, "getAutoscrolls", "setAutoscrolls" ); - properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor ( "nextFocusableComponent", QCNotebookPanel.class, "getNextFocusableComponent", "setNextFocusableComponent" ); - properties[PROPERTY_background] = new PropertyDescriptor ( "background", QCNotebookPanel.class, "getBackground", "setBackground" ); - properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor ( "debugGraphicsOptions", QCNotebookPanel.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions" ); - properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", QCNotebookPanel.class, "isLightweight", null ); - properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", QCNotebookPanel.class, "isDoubleBuffered", "setDoubleBuffered" ); - properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", QCNotebookPanel.class, "getGraphics", null ); - properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor ( "topLevelAncestor", QCNotebookPanel.class, "getTopLevelAncestor", null ); - properties[PROPERTY_validateRoot] = new PropertyDescriptor ( "validateRoot", QCNotebookPanel.class, "isValidateRoot", null ); - properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", QCNotebookPanel.class, "getLocale", "setLocale" ); - properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", QCNotebookPanel.class, "getToolkit", null ); - properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", QCNotebookPanel.class, "getPreferredSize", "setPreferredSize" ); - properties[PROPERTY_visibleRect] = new PropertyDescriptor ( "visibleRect", QCNotebookPanel.class, "getVisibleRect", null ); - properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", QCNotebookPanel.class, "getPeer", null ); - properties[PROPERTY_components] = new PropertyDescriptor ( "components", QCNotebookPanel.class, "getComponents", null ); - properties[PROPERTY_toolTipText] = new PropertyDescriptor ( "toolTipText", QCNotebookPanel.class, "getToolTipText", "setToolTipText" ); - properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor ( "verifyInputWhenFocusTarget", QCNotebookPanel.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget" ); - properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor ( "maximumSizeSet", QCNotebookPanel.class, "isMaximumSizeSet", null ); - properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor ( "requestFocusEnabled", QCNotebookPanel.class, "isRequestFocusEnabled", "setRequestFocusEnabled" ); - properties[PROPERTY_actionMap] = new PropertyDescriptor ( "actionMap", QCNotebookPanel.class, "getActionMap", "setActionMap" ); - properties[PROPERTY_inputVerifier] = new PropertyDescriptor ( "inputVerifier", QCNotebookPanel.class, "getInputVerifier", "setInputVerifier" ); - properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", QCNotebookPanel.class, "isFocusTraversable", null ); - properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor ( "preferredSizeSet", QCNotebookPanel.class, "isPreferredSizeSet", null ); - properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", QCNotebookPanel.class, "getForeground", "setForeground" ); - properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", QCNotebookPanel.class, "getMaximumSize", "setMaximumSize" ); - properties[PROPERTY_class] = new PropertyDescriptor ( "class", QCNotebookPanel.class, "getClass", null ); - properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", QCNotebookPanel.class, "getInputMethodRequests", null ); - properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", QCNotebookPanel.class, "getAlignmentY", "setAlignmentY" ); - properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", QCNotebookPanel.class, "getAlignmentX", "setAlignmentX" ); - properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", QCNotebookPanel.class, "getLocationOnScreen", null ); - properties[PROPERTY_border] = new PropertyDescriptor ( "border", QCNotebookPanel.class, "getBorder", "setBorder" ); - properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", QCNotebookPanel.class, null, null, "getComponent", null ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Properties - - // Here you can add code for customizing the properties array. - -}//GEN-LAST:Properties - - // EventSet identifiers//GEN-FIRST:Events - private static final int EVENT_mouseMotionListener = 0; - private static final int EVENT_ancestorListener = 1; - private static final int EVENT_inputMethodListener = 2; - private static final int EVENT_componentListener = 3; - private static final int EVENT_hierarchyBoundsListener = 4; - private static final int EVENT_mouseListener = 5; - private static final int EVENT_focusListener = 6; - private static final int EVENT_propertyChangeListener = 7; - private static final int EVENT_keyListener = 8; - private static final int EVENT_hierarchyListener = 9; - private static final int EVENT_containerListener = 10; - private static final int EVENT_vetoableChangeListener = 11; - - // EventSet array - private static EventSetDescriptor[] eventSets = new EventSetDescriptor[12]; - - static { - try { - eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( QCNotebookPanel.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[0], "addMouseMotionListener", "removeMouseMotionListener" ); - eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( QCNotebookPanel.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[0], "addAncestorListener", "removeAncestorListener" ); - eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( QCNotebookPanel.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[0], "addInputMethodListener", "removeInputMethodListener" ); - eventSets[EVENT_componentListener] = new EventSetDescriptor ( QCNotebookPanel.class, "componentListener", java.awt.event.ComponentListener.class, new String[0], "addComponentListener", "removeComponentListener" ); - eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( QCNotebookPanel.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[0], "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); - eventSets[EVENT_mouseListener] = new EventSetDescriptor ( QCNotebookPanel.class, "mouseListener", java.awt.event.MouseListener.class, new String[0], "addMouseListener", "removeMouseListener" ); - eventSets[EVENT_focusListener] = new EventSetDescriptor ( QCNotebookPanel.class, "focusListener", java.awt.event.FocusListener.class, new String[0], "addFocusListener", "removeFocusListener" ); - eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( QCNotebookPanel.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[0], "addPropertyChangeListener", "removePropertyChangeListener" ); - eventSets[EVENT_keyListener] = new EventSetDescriptor ( QCNotebookPanel.class, "keyListener", java.awt.event.KeyListener.class, new String[0], "addKeyListener", "removeKeyListener" ); - eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( QCNotebookPanel.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[0], "addHierarchyListener", "removeHierarchyListener" ); - eventSets[EVENT_containerListener] = new EventSetDescriptor ( QCNotebookPanel.class, "containerListener", java.awt.event.ContainerListener.class, new String[0], "addContainerListener", "removeContainerListener" ); - eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( QCNotebookPanel.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[0], "addVetoableChangeListener", "removeVetoableChangeListener" ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Events - - // Here you can add code for customizing the event sets array. - -}//GEN-LAST:Events - - private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef - private static java.awt.Image iconColor32 = null; - private static java.awt.Image iconMono16 = null; - private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef - private static String iconNameC16 = null;//GEN-BEGIN:Icons - private static String iconNameC32 = null; - private static String iconNameM16 = null; - private static String iconNameM32 = null;//GEN-END:Icons - - private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx - private static int defaultEventIndex = -1;//GEN-END:Idx - - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

- * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } - - /** - * Gets the beans EventSetDescriptors. - * - * @return An array of EventSetDescriptors describing the kinds of - * events fired by this bean. May return null if the information - * should be obtained by automatic analysis. - */ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSets; - } - - /** - * A bean may have a "default" property that is the property that will - * mostly commonly be initially chosen for update by human's who are - * customizing the bean. - * @return Index of default property in the PropertyDescriptor array - * returned by getPropertyDescriptors. - *

Returns -1 if there is no default property. - */ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** - * A bean may have a "default" event that is the event that will - * mostly commonly be used by human's when using the bean. - * @return Index of default event in the EventSetDescriptor array - * returned by getEventSetDescriptors. - *

Returns -1 if there is no default event. - */ - public int getDefaultEventIndex() { - return defaultPropertyIndex; - } - - /** - * This method returns an image object that can be used to - * represent the bean in toolboxes, toolbars, etc. Icon images - * will typically be GIFs, but may in future include other formats. - *

- * Beans aren't required to provide icons and may return null from - * this method. - *

- * There are four possible flavors of icons (16x16 color, - * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only - * support a single icon we recommend supporting 16x16 color. - *

- * We recommend that icons have a "transparent" background - * so they can be rendered onto an existing background. - * - * @param iconKind The kind of icon requested. This should be - * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, - * ICON_MONO_16x16, or ICON_MONO_32x32. - * @return An image object representing the requested icon. May - * return null if no suitable icon is available. - */ - public java.awt.Image getIcon(int iconKind) { - switch ( iconKind ) { - case ICON_COLOR_16x16: - if ( iconNameC16 == null ) - return null; - else { - if( iconColor16 == null ) - iconColor16 = loadImage( iconNameC16 ); - return iconColor16; - } - case ICON_COLOR_32x32: - if ( iconNameC32 == null ) - return null; - else { - if( iconColor32 == null ) - iconColor32 = loadImage( iconNameC32 ); - return iconColor32; - } - case ICON_MONO_16x16: - if ( iconNameM16 == null ) - return null; - else { - if( iconMono16 == null ) - iconMono16 = loadImage( iconNameM16 ); - return iconMono16; - } - case ICON_MONO_32x32: - if ( iconNameM32 == null ) - return null; - else { - if( iconNameM32 == null ) - iconMono32 = loadImage( iconNameM32 ); - return iconMono32; - } - } - return null; - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCPrinterListPanel.form b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCPrinterListPanel.form deleted file mode 100644 index 958196ead..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCPrinterListPanel.form +++ /dev/null @@ -1,89 +0,0 @@ - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCPrinterListPanel.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCPrinterListPanel.java deleted file mode 100644 index 5878d9624..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCPrinterListPanel.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * QCPrinterListPanel.java - * - * Created on July 18, 2000, 6:41 PM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** Panel to list printers in an explorer view. - * @author jax - * @version 1.0 - */ -public class QCPrinterListPanel extends javax.swing.JPanel implements QCServiceClient { - - private QCMgr manager; - private java.lang.String serverName; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCServiceRecord serviceRecord; - private com.ibm.as400.vaccess.ErrorDialogAdapter errorDialogAdapter; - - /** Creates new form QCPrinterListPanel */ - public QCPrinterListPanel() { - initComponents (); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the FormEditor. - */ - private void initComponents () {//GEN-BEGIN:initComponents - vPrinters1 = new com.ibm.as400.vaccess.VPrinters (); - aS400ExplorerPane = new com.ibm.as400.vaccess.AS400ExplorerPane (); - jPanel1 = new javax.swing.JPanel (); - filterButton = new javax.swing.JButton (); - filterTextField = new javax.swing.JTextField (); - systemLabel = new javax.swing.JLabel (); - systemTextField = new javax.swing.JTextField (); - - setLayout (new java.awt.BorderLayout ()); - setPreferredSize (new java.awt.Dimension(300, 250)); - - - - add (aS400ExplorerPane, java.awt.BorderLayout.CENTER); - - jPanel1.setLayout (new java.awt.GridLayout (2, 2)); - jPanel1.setToolTipText ("Displays a list of printers."); - - filterButton.setToolTipText ("Gets printer list per your specification."); - filterButton.setText ("Get Printer List"); - filterButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - filterButtonActionPerformed (evt); - } - } - ); - - jPanel1.add (filterButton); - - filterTextField.setToolTipText ("Enter printer name or printer name* or *ALL."); - filterTextField.setText ("*ALL"); - filterTextField.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - filterTextFieldActionPerformed (evt); - } - } - ); - - jPanel1.add (filterTextField); - - systemLabel.setText ("System"); - systemLabel.setToolTipText ("Enter the system name at right."); - systemLabel.setHorizontalAlignment (javax.swing.SwingConstants.RIGHT); - - jPanel1.add (systemLabel); - - systemTextField.setToolTipText ("Name of AS/400 to connect with."); - - jPanel1.add (systemTextField); - - - add (jPanel1, java.awt.BorderLayout.SOUTH); - - }//GEN-END:initComponents - - // Pressing the button and pressing ENTER do the same. - private void filterTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filterTextFieldActionPerformed - // Add your handling code here: - filterButtonActionPerformed(evt); - }//GEN-LAST:event_filterTextFieldActionPerformed - - // Pressing the button and pressing ENTER do the same. - private void filterButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filterButtonActionPerformed - // Add your handling code here: - - // Loading the printers can take some time! - java.awt.Cursor currentCursor = jPanel1.getCursor(); - setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR)); - - // Make sure we have a server. - reinstanceServerFromTextEntry(); - - // Can't change path of a loaded VIFSDirectory. - // Might as well each time re-instance the VIFSDirectory - // since pushing the button requests a reload anyway. - reinstancePrinterList(); - - // Set the path from the string gadget. - try { - vPrinters1.setPrinterFilter(filterTextField.getText()); - } - - catch (java.beans.PropertyVetoException e) { - e.printStackTrace(); - } - - // Load the data. - try - { - vPrinters1.load(); - }/* End try*/ - - catch (Exception e) - { - e.printStackTrace(); - }/* End catch*/ - - // Set the pane's root (model) to the current VPrinters object. - setPaneRoot(); - - // The wait is over. - setCursor(currentCursor); - - }//GEN-LAST:event_filterButtonActionPerformed - - private synchronized void reinstanceServerFromTextEntry() { - String newName = systemTextField.getText(); - if (null == serverName) { - serverName = ""; - } - if (null != newName) { - if (!newName.equals("")) { - if (!newName.equals(serverName)) { - serverName = newName; - if (null != serviceRecord) { - - try { // let go of the service from manager - manager.freeService(serviceRecord); - } - catch (Exception e) { - e.printStackTrace(); - } - serviceRecord = null; - } - try { - serviceRecord = manager.getService("qcmgr:" + serverName + "/PRINT", this); - } - catch (Exception e) { - e.printStackTrace(); - } - } - } - } - } - - private synchronized void reinstancePrinterList () { - if (null != serviceRecord) { - vPrinters1 = new com.ibm.as400.vaccess.VPrinters(serviceRecord.as400); - if (null != errorDialogAdapter) { - vPrinters1.addErrorListener(errorDialogAdapter); - } - } - } - - private void setPaneRoot() { - if (null != vPrinters1) { - try { - aS400ExplorerPane.setRoot(vPrinters1); - } - catch (java.beans.PropertyVetoException e) { - e.printStackTrace(); - } - } - } - - private void loadPrinters () { - vPrinters1.load(); - } - // Variables declaration - do not modify//GEN-BEGIN:variables - private com.ibm.as400.vaccess.VPrinters vPrinters1; - private com.ibm.as400.vaccess.AS400ExplorerPane aS400ExplorerPane; - private javax.swing.JPanel jPanel1; - private javax.swing.JButton filterButton; - private javax.swing.JTextField filterTextField; - private javax.swing.JLabel systemLabel; - private javax.swing.JTextField systemTextField; - // End of variables declaration//GEN-END:variables - - /** Sets the QCMgr object which will handle AS400 instances for this client. - * @param mgr A QCMgr object. - */ - public void setManager(QCMgr mgr) { - manager = mgr; - } - - /** Connects the ErrorDialogAdapter with any as400.vaccess components present. - * @param eda An instance of an ErrorDialogAdapter already associated - * with a suitable Frame. - */ - public void propagateEDA(com.ibm.as400.vaccess.ErrorDialogAdapter eda) { - errorDialogAdapter=eda; - aS400ExplorerPane.addErrorListener(eda); - vPrinters1.addErrorListener(eda); - } - /** Required implementantion of the QCServiceClient interface. Releases the - * AS400 object provided by the server. - * @param sr The service record which represents the AS400 to be - * relinquished. - */ - public void relinquish(QCServiceRecord sr) { - serviceRecord = null; - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCPrinterListPanelBeanInfo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCPrinterListPanelBeanInfo.java deleted file mode 100644 index b7c456052..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCPrinterListPanelBeanInfo.java +++ /dev/null @@ -1,315 +0,0 @@ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.beans.*; - -public class QCPrinterListPanelBeanInfo extends SimpleBeanInfo { - - // Property identifiers //GEN-FIRST:Properties - private static final int PROPERTY_optimizedDrawingEnabled = 0; - private static final int PROPERTY_colorModel = 1; - private static final int PROPERTY_minimumSize = 2; - private static final int PROPERTY_visible = 3; - private static final int PROPERTY_toolkit = 4; - private static final int PROPERTY_displayable = 5; - private static final int PROPERTY_opaque = 6; - private static final int PROPERTY_requestFocusEnabled = 7; - private static final int PROPERTY_enabled = 8; - private static final int PROPERTY_autoscrolls = 9; - private static final int PROPERTY_y = 10; - private static final int PROPERTY_x = 11; - private static final int PROPERTY_accessibleContext = 12; - private static final int PROPERTY_componentOrientation = 13; - private static final int PROPERTY_components = 14; - private static final int PROPERTY_managingFocus = 15; - private static final int PROPERTY_inputMethodRequests = 16; - private static final int PROPERTY_border = 17; - private static final int PROPERTY_locale = 18; - private static final int PROPERTY_insets = 19; - private static final int PROPERTY_UIClassID = 20; - private static final int PROPERTY_graphics = 21; - private static final int PROPERTY_minimumSizeSet = 22; - private static final int PROPERTY_actionMap = 23; - private static final int PROPERTY_maximumSizeSet = 24; - private static final int PROPERTY_alignmentY = 25; - private static final int PROPERTY_alignmentX = 26; - private static final int PROPERTY_locationOnScreen = 27; - private static final int PROPERTY_cursor = 28; - private static final int PROPERTY_registeredKeyStrokes = 29; - private static final int PROPERTY_preferredSizeSet = 30; - private static final int PROPERTY_visibleRect = 31; - private static final int PROPERTY_bounds = 32; - private static final int PROPERTY_inputContext = 33; - private static final int PROPERTY_class = 34; - private static final int PROPERTY_focusTraversable = 35; - private static final int PROPERTY_font = 36; - private static final int PROPERTY_inputVerifier = 37; - private static final int PROPERTY_lightweight = 38; - private static final int PROPERTY_paintingTile = 39; - private static final int PROPERTY_maximumSize = 40; - private static final int PROPERTY_layout = 41; - private static final int PROPERTY_treeLock = 42; - private static final int PROPERTY_verifyInputWhenFocusTarget = 43; - private static final int PROPERTY_foreground = 44; - private static final int PROPERTY_preferredSize = 45; - private static final int PROPERTY_debugGraphicsOptions = 46; - private static final int PROPERTY_doubleBuffered = 47; - private static final int PROPERTY_showing = 48; - private static final int PROPERTY_nextFocusableComponent = 49; - private static final int PROPERTY_parent = 50; - private static final int PROPERTY_peer = 51; - private static final int PROPERTY_componentCount = 52; - private static final int PROPERTY_manager = 53; - private static final int PROPERTY_graphicsConfiguration = 54; - private static final int PROPERTY_height = 55; - private static final int PROPERTY_valid = 56; - private static final int PROPERTY_focusCycleRoot = 57; - private static final int PROPERTY_width = 58; - private static final int PROPERTY_toolTipText = 59; - private static final int PROPERTY_background = 60; - private static final int PROPERTY_validateRoot = 61; - private static final int PROPERTY_topLevelAncestor = 62; - private static final int PROPERTY_dropTarget = 63; - private static final int PROPERTY_rootPane = 64; - private static final int PROPERTY_name = 65; - private static final int PROPERTY_component = 66; - - // Property array - private static PropertyDescriptor[] properties = new PropertyDescriptor[67]; - - static { - try { - properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor ( "optimizedDrawingEnabled", QCPrinterListPanel.class, "isOptimizedDrawingEnabled", null ); - properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", QCPrinterListPanel.class, "getColorModel", null ); - properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", QCPrinterListPanel.class, "getMinimumSize", "setMinimumSize" ); - properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", QCPrinterListPanel.class, "isVisible", "setVisible" ); - properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", QCPrinterListPanel.class, "getToolkit", null ); - properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", QCPrinterListPanel.class, "isDisplayable", null ); - properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", QCPrinterListPanel.class, "isOpaque", "setOpaque" ); - properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor ( "requestFocusEnabled", QCPrinterListPanel.class, "isRequestFocusEnabled", "setRequestFocusEnabled" ); - properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", QCPrinterListPanel.class, "isEnabled", "setEnabled" ); - properties[PROPERTY_autoscrolls] = new PropertyDescriptor ( "autoscrolls", QCPrinterListPanel.class, "getAutoscrolls", "setAutoscrolls" ); - properties[PROPERTY_y] = new PropertyDescriptor ( "y", QCPrinterListPanel.class, "getY", null ); - properties[PROPERTY_x] = new PropertyDescriptor ( "x", QCPrinterListPanel.class, "getX", null ); - properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", QCPrinterListPanel.class, "getAccessibleContext", null ); - properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", QCPrinterListPanel.class, "getComponentOrientation", "setComponentOrientation" ); - properties[PROPERTY_components] = new PropertyDescriptor ( "components", QCPrinterListPanel.class, "getComponents", null ); - properties[PROPERTY_managingFocus] = new PropertyDescriptor ( "managingFocus", QCPrinterListPanel.class, "isManagingFocus", null ); - properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", QCPrinterListPanel.class, "getInputMethodRequests", null ); - properties[PROPERTY_border] = new PropertyDescriptor ( "border", QCPrinterListPanel.class, "getBorder", "setBorder" ); - properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", QCPrinterListPanel.class, "getLocale", "setLocale" ); - properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", QCPrinterListPanel.class, "getInsets", null ); - properties[PROPERTY_UIClassID] = new PropertyDescriptor ( "UIClassID", QCPrinterListPanel.class, "getUIClassID", null ); - properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", QCPrinterListPanel.class, "getGraphics", null ); - properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor ( "minimumSizeSet", QCPrinterListPanel.class, "isMinimumSizeSet", null ); - properties[PROPERTY_actionMap] = new PropertyDescriptor ( "actionMap", QCPrinterListPanel.class, "getActionMap", "setActionMap" ); - properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor ( "maximumSizeSet", QCPrinterListPanel.class, "isMaximumSizeSet", null ); - properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", QCPrinterListPanel.class, "getAlignmentY", "setAlignmentY" ); - properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", QCPrinterListPanel.class, "getAlignmentX", "setAlignmentX" ); - properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", QCPrinterListPanel.class, "getLocationOnScreen", null ); - properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", QCPrinterListPanel.class, "getCursor", "setCursor" ); - properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor ( "registeredKeyStrokes", QCPrinterListPanel.class, "getRegisteredKeyStrokes", null ); - properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor ( "preferredSizeSet", QCPrinterListPanel.class, "isPreferredSizeSet", null ); - properties[PROPERTY_visibleRect] = new PropertyDescriptor ( "visibleRect", QCPrinterListPanel.class, "getVisibleRect", null ); - properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", QCPrinterListPanel.class, "getBounds", "setBounds" ); - properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", QCPrinterListPanel.class, "getInputContext", null ); - properties[PROPERTY_class] = new PropertyDescriptor ( "class", QCPrinterListPanel.class, "getClass", null ); - properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", QCPrinterListPanel.class, "isFocusTraversable", null ); - properties[PROPERTY_font] = new PropertyDescriptor ( "font", QCPrinterListPanel.class, "getFont", "setFont" ); - properties[PROPERTY_inputVerifier] = new PropertyDescriptor ( "inputVerifier", QCPrinterListPanel.class, "getInputVerifier", "setInputVerifier" ); - properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", QCPrinterListPanel.class, "isLightweight", null ); - properties[PROPERTY_paintingTile] = new PropertyDescriptor ( "paintingTile", QCPrinterListPanel.class, "isPaintingTile", null ); - properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", QCPrinterListPanel.class, "getMaximumSize", "setMaximumSize" ); - properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", QCPrinterListPanel.class, "getLayout", "setLayout" ); - properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", QCPrinterListPanel.class, "getTreeLock", null ); - properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor ( "verifyInputWhenFocusTarget", QCPrinterListPanel.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget" ); - properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", QCPrinterListPanel.class, "getForeground", "setForeground" ); - properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", QCPrinterListPanel.class, "getPreferredSize", "setPreferredSize" ); - properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor ( "debugGraphicsOptions", QCPrinterListPanel.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions" ); - properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", QCPrinterListPanel.class, "isDoubleBuffered", "setDoubleBuffered" ); - properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", QCPrinterListPanel.class, "isShowing", null ); - properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor ( "nextFocusableComponent", QCPrinterListPanel.class, "getNextFocusableComponent", "setNextFocusableComponent" ); - properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", QCPrinterListPanel.class, "getParent", null ); - properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", QCPrinterListPanel.class, "getPeer", null ); - properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", QCPrinterListPanel.class, "getComponentCount", null ); - properties[PROPERTY_manager] = new PropertyDescriptor ( "manager", QCPrinterListPanel.class, null, "setManager" ); - properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", QCPrinterListPanel.class, "getGraphicsConfiguration", null ); - properties[PROPERTY_height] = new PropertyDescriptor ( "height", QCPrinterListPanel.class, "getHeight", null ); - properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", QCPrinterListPanel.class, "isValid", null ); - properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor ( "focusCycleRoot", QCPrinterListPanel.class, "isFocusCycleRoot", null ); - properties[PROPERTY_width] = new PropertyDescriptor ( "width", QCPrinterListPanel.class, "getWidth", null ); - properties[PROPERTY_toolTipText] = new PropertyDescriptor ( "toolTipText", QCPrinterListPanel.class, "getToolTipText", "setToolTipText" ); - properties[PROPERTY_background] = new PropertyDescriptor ( "background", QCPrinterListPanel.class, "getBackground", "setBackground" ); - properties[PROPERTY_validateRoot] = new PropertyDescriptor ( "validateRoot", QCPrinterListPanel.class, "isValidateRoot", null ); - properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor ( "topLevelAncestor", QCPrinterListPanel.class, "getTopLevelAncestor", null ); - properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", QCPrinterListPanel.class, "getDropTarget", "setDropTarget" ); - properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", QCPrinterListPanel.class, "getRootPane", null ); - properties[PROPERTY_name] = new PropertyDescriptor ( "name", QCPrinterListPanel.class, "getName", "setName" ); - properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", QCPrinterListPanel.class, null, null, "getComponent", null ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Properties - - // Here you can add code for customizing the properties array. - -}//GEN-LAST:Properties - - // EventSet identifiers//GEN-FIRST:Events - private static final int EVENT_mouseMotionListener = 0; - private static final int EVENT_ancestorListener = 1; - private static final int EVENT_inputMethodListener = 2; - private static final int EVENT_componentListener = 3; - private static final int EVENT_hierarchyBoundsListener = 4; - private static final int EVENT_mouseListener = 5; - private static final int EVENT_focusListener = 6; - private static final int EVENT_propertyChangeListener = 7; - private static final int EVENT_keyListener = 8; - private static final int EVENT_hierarchyListener = 9; - private static final int EVENT_containerListener = 10; - private static final int EVENT_vetoableChangeListener = 11; - - // EventSet array - private static EventSetDescriptor[] eventSets = new EventSetDescriptor[12]; - - static { - try { - eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( QCPrinterListPanel.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[0], "addMouseMotionListener", "removeMouseMotionListener" ); - eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( QCPrinterListPanel.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[0], "addAncestorListener", "removeAncestorListener" ); - eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( QCPrinterListPanel.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[0], "addInputMethodListener", "removeInputMethodListener" ); - eventSets[EVENT_componentListener] = new EventSetDescriptor ( QCPrinterListPanel.class, "componentListener", java.awt.event.ComponentListener.class, new String[0], "addComponentListener", "removeComponentListener" ); - eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( QCPrinterListPanel.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[0], "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); - eventSets[EVENT_mouseListener] = new EventSetDescriptor ( QCPrinterListPanel.class, "mouseListener", java.awt.event.MouseListener.class, new String[0], "addMouseListener", "removeMouseListener" ); - eventSets[EVENT_focusListener] = new EventSetDescriptor ( QCPrinterListPanel.class, "focusListener", java.awt.event.FocusListener.class, new String[0], "addFocusListener", "removeFocusListener" ); - eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( QCPrinterListPanel.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[0], "addPropertyChangeListener", "removePropertyChangeListener" ); - eventSets[EVENT_keyListener] = new EventSetDescriptor ( QCPrinterListPanel.class, "keyListener", java.awt.event.KeyListener.class, new String[0], "addKeyListener", "removeKeyListener" ); - eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( QCPrinterListPanel.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[0], "addHierarchyListener", "removeHierarchyListener" ); - eventSets[EVENT_containerListener] = new EventSetDescriptor ( QCPrinterListPanel.class, "containerListener", java.awt.event.ContainerListener.class, new String[0], "addContainerListener", "removeContainerListener" ); - eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( QCPrinterListPanel.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[0], "addVetoableChangeListener", "removeVetoableChangeListener" ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Events - - // Here you can add code for customizing the event sets array. - -}//GEN-LAST:Events - - private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef - private static java.awt.Image iconColor32 = null; - private static java.awt.Image iconMono16 = null; - private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef - private static String iconNameC16 = null;//GEN-BEGIN:Icons - private static String iconNameC32 = null; - private static String iconNameM16 = null; - private static String iconNameM32 = null;//GEN-END:Icons - - private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx - private static int defaultEventIndex = -1;//GEN-END:Idx - - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

- * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } - - /** - * Gets the beans EventSetDescriptors. - * - * @return An array of EventSetDescriptors describing the kinds of - * events fired by this bean. May return null if the information - * should be obtained by automatic analysis. - */ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSets; - } - - /** - * A bean may have a "default" property that is the property that will - * mostly commonly be initially chosen for update by human's who are - * customizing the bean. - * @return Index of default property in the PropertyDescriptor array - * returned by getPropertyDescriptors. - *

Returns -1 if there is no default property. - */ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** - * A bean may have a "default" event that is the event that will - * mostly commonly be used by human's when using the bean. - * @return Index of default event in the EventSetDescriptor array - * returned by getEventSetDescriptors. - *

Returns -1 if there is no default event. - */ - public int getDefaultEventIndex() { - return defaultPropertyIndex; - } - - /** - * This method returns an image object that can be used to - * represent the bean in toolboxes, toolbars, etc. Icon images - * will typically be GIFs, but may in future include other formats. - *

- * Beans aren't required to provide icons and may return null from - * this method. - *

- * There are four possible flavors of icons (16x16 color, - * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only - * support a single icon we recommend supporting 16x16 color. - *

- * We recommend that icons have a "transparent" background - * so they can be rendered onto an existing background. - * - * @param iconKind The kind of icon requested. This should be - * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, - * ICON_MONO_16x16, or ICON_MONO_32x32. - * @return An image object representing the requested icon. May - * return null if no suitable icon is available. - */ - public java.awt.Image getIcon(int iconKind) { - switch ( iconKind ) { - case ICON_COLOR_16x16: - if ( iconNameC16 == null ) - return null; - else { - if( iconColor16 == null ) - iconColor16 = loadImage( iconNameC16 ); - return iconColor16; - } - case ICON_COLOR_32x32: - if ( iconNameC32 == null ) - return null; - else { - if( iconColor32 == null ) - iconColor32 = loadImage( iconNameC32 ); - return iconColor32; - } - case ICON_MONO_16x16: - if ( iconNameM16 == null ) - return null; - else { - if( iconMono16 == null ) - iconMono16 = loadImage( iconNameM16 ); - return iconMono16; - } - case ICON_MONO_32x32: - if ( iconNameM32 == null ) - return null; - else { - if( iconNameM32 == null ) - iconMono32 = loadImage( iconNameM32 ); - return iconMono32; - } - } - return null; - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLQueryBuilderPanel.form b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLQueryBuilderPanel.form deleted file mode 100644 index d1e2c3e9f..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLQueryBuilderPanel.form +++ /dev/null @@ -1,187 +0,0 @@ - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLQueryBuilderPanel.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLQueryBuilderPanel.java deleted file mode 100644 index 0337ba84c..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLQueryBuilderPanel.java +++ /dev/null @@ -1,344 +0,0 @@ -/* - * QCSQLQueryBuilderPanel.java - * - * Created on July 19, 2000, 6:46 PM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** A panel to display an SQLQueryBuilder. - * @author jax - * @version 1.0 - */ -public class QCSQLQueryBuilderPanel extends javax.swing.JPanel { - - private com.ibm.as400.vaccess.SQLConnection sqlConnection; - private com.ibm.as400.vaccess.ErrorDialogAdapter errorDialogAdapter; - private boolean useCustomDriver = false; - private QCSQLResultSetTablePanel resultTable; - private QCSQLResultSetFormPanel resultForm; - private java.util.Vector classesInstanced = new java.util.Vector(4,4); - - private javax.swing.ButtonGroup buttonGroup; - - /** Creates new form QCSQLQueryBuilderPanel */ - public QCSQLQueryBuilderPanel() { - initComponents (); - establishButtonGroup(); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the FormEditor. - */ - private void initComponents () {//GEN-BEGIN:initComponents - sessionPanel = new javax.swing.JPanel (); - urlPanel = new javax.swing.JPanel (); - urlTextField = new javax.swing.JTextField (); - connectButton = new javax.swing.JButton (); - driverTypePanel = new javax.swing.JPanel (); - as400RadioButton = new javax.swing.JRadioButton (); - sunJDBCRadioButton4 = new javax.swing.JRadioButton (); - postgresqlRadioButton = new javax.swing.JRadioButton (); - customRadioButton = new javax.swing.JRadioButton (); - driverClassNameTextField = new javax.swing.JTextField (); - sQLQueryBuilderPane1 = new com.ibm.as400.vaccess.SQLQueryBuilderPane (); - queryButtonPanel = new javax.swing.JPanel (); - queryToTableButton = new javax.swing.JButton (); - queryToFormButton = new javax.swing.JButton (); - setLayout (new java.awt.BorderLayout ()); - - sessionPanel.setLayout (new java.awt.GridLayout (2, 1)); - - urlPanel.setLayout (new java.awt.GridLayout (2, 1)); - - urlTextField.setToolTipText ("Enter a valid SQLConnection URL of the form jdbc:://"); - urlTextField.setText ("jdbc:"); - - urlPanel.add (urlTextField); - - connectButton.setToolTipText ("Connects to the JDBC URL you entered above."); - connectButton.setText ("Connect Now"); - connectButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - connectButtonActionPerformed (evt); - } - } - ); - - urlPanel.add (connectButton); - - sessionPanel.add (urlPanel); - - driverTypePanel.setLayout (new java.awt.GridLayout (1, 5)); - driverTypePanel.setBorder (new javax.swing.border.TitledBorder("Set driver type in URL")); - - as400RadioButton.setToolTipText ("Edits the URL above to reflect your driver choice. Feel free to customize the URL afterwards."); - as400RadioButton.setBorder (new javax.swing.border.TitledBorder("")); - as400RadioButton.setText ("JTOpen"); - as400RadioButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - as400RadioButtonActionPerformed (evt); - } - } - ); - - driverTypePanel.add (as400RadioButton); - - sunJDBCRadioButton4.setToolTipText ("Edits the URL above to reflect your driver choice. Feel free to customize the URL afterwards."); - sunJDBCRadioButton4.setText ("Sun JDBC"); - sunJDBCRadioButton4.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - sunJDBCRadioButton4ActionPerformed (evt); - } - } - ); - - driverTypePanel.add (sunJDBCRadioButton4); - - postgresqlRadioButton.setToolTipText ("Edits the URL above to reflect your driver choice. Feel free to customize the URL afterwards."); - postgresqlRadioButton.setText ("PostgreSQL"); - postgresqlRadioButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - postgresqlRadioButtonActionPerformed (evt); - } - } - ); - - driverTypePanel.add (postgresqlRadioButton); - - customRadioButton.setToolTipText ("Please enter driver name in the entry field next to the button."); - customRadioButton.setText ("Custom"); - customRadioButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - customRadioButtonActionPerformed (evt); - } - } - ); - - driverTypePanel.add (customRadioButton); - - - driverTypePanel.add (driverClassNameTextField); - - sessionPanel.add (driverTypePanel); - - - add (sessionPanel, java.awt.BorderLayout.NORTH); - - - - add (sQLQueryBuilderPane1, java.awt.BorderLayout.CENTER); - - queryButtonPanel.setLayout (new java.awt.GridLayout (1, 2)); - - queryToTableButton.setToolTipText ("Shows the results of the query in table form on the SQL Result Table tab."); - queryToTableButton.setText ("Do Query with Results to Table"); - queryToTableButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - queryToTableButtonActionPerformed (evt); - } - } - ); - - queryButtonPanel.add (queryToTableButton); - - queryToFormButton.setToolTipText ("Shows the results of the query in table form on the SQL Result Form tab."); - queryToFormButton.setText ("Do Query with Results to Form"); - queryToFormButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - queryToFormButtonActionPerformed (evt); - } - } - ); - - queryButtonPanel.add (queryToFormButton); - - - add (queryButtonPanel, java.awt.BorderLayout.SOUTH); - - }//GEN-END:initComponents - - private void queryToFormButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_queryToFormButtonActionPerformed - // Add your handling code here: - if (null != sQLQueryBuilderPane1.getConnection() & null != sQLQueryBuilderPane1.getQuery()) { - resultForm.doQuery(sQLQueryBuilderPane1.getConnection(), sQLQueryBuilderPane1.getQuery()); - } - }//GEN-LAST:event_queryToFormButtonActionPerformed - - private void queryToTableButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_queryToTableButtonActionPerformed - // Add your handling code here: - if (null != sQLQueryBuilderPane1.getConnection() & null != sQLQueryBuilderPane1.getQuery()) { - resultTable.doQuery(sQLQueryBuilderPane1.getConnection(), sQLQueryBuilderPane1.getQuery()); - } - }//GEN-LAST:event_queryToTableButtonActionPerformed - - private void connectButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connectButtonActionPerformed - // Add your handling code here: - - // Free resources by closing previous connection. - if (null != sQLQueryBuilderPane1.getConnection()) { - try { - sQLQueryBuilderPane1.getConnection().close(); - } - catch (java.sql.SQLException e) { - e.printStackTrace(System.err); - } - } - - // Process the URL. - QCJdbcURL url = new QCJdbcURL(urlTextField.getText()); - urlTextField.setText(url.getURL()); - - // Load the driver if necessary. - try { - instanceDriver(url.driver); - } - catch (java.lang.ClassNotFoundException e) { - e.printStackTrace(System.err); - } - catch (java.sql.SQLException e) { - e.printStackTrace(System.err); - } - - // Attempt the connection. - sqlConnection = new com.ibm.as400.vaccess.SQLConnection(urlTextField.getText()); - try { - sQLQueryBuilderPane1.setConnection(sqlConnection); - sQLQueryBuilderPane1.load(); - } - - catch (java.beans.PropertyVetoException e) { - e.printStackTrace(System.err); - } - }//GEN-LAST:event_connectButtonActionPerformed - - private void sunJDBCRadioButton4ActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sunJDBCRadioButton4ActionPerformed - // Add your handling code here: - useCustomDriver = false; - QCJdbcURL url = new QCJdbcURL(urlTextField.getText()); - url.protocol = "jdbc"; - url.driver = "odbc"; - urlTextField.setText(url.getURL()); - }//GEN-LAST:event_sunJDBCRadioButton4ActionPerformed - - private void postgresqlRadioButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_postgresqlRadioButtonActionPerformed - // Add your handling code here: - useCustomDriver = false; - QCJdbcURL url = new QCJdbcURL(urlTextField.getText()); - url.protocol = "jdbc"; - url.driver = "postgresql"; - urlTextField.setText(url.getURL()); - }//GEN-LAST:event_postgresqlRadioButtonActionPerformed - - private void as400RadioButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_as400RadioButtonActionPerformed - // Add your handling code here: - useCustomDriver = false; - QCJdbcURL url = new QCJdbcURL(urlTextField.getText()); - url.protocol = "jdbc"; - url.driver = "as400"; - urlTextField.setText(url.getURL()); - }//GEN-LAST:event_as400RadioButtonActionPerformed - - private void customRadioButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_customRadioButtonActionPerformed - // Add your handling code here: - useCustomDriver = true; - QCJdbcURL url = new QCJdbcURL(urlTextField.getText()); - url.protocol = "jdbc"; - url.driver = "PLEASE_EDIT_THIS_DRIVER_URL"; - urlTextField.setText(url.getURL()); - }//GEN-LAST:event_customRadioButtonActionPerformed - - // Make sure that drivers get loaded. - private void instanceDriver(String urlDriver) - throws java.sql.SQLException, java.lang.ClassNotFoundException { - - java.lang.Class driverClass; - - if (useCustomDriver) { // Assumes static ctor, - // modify if you have to explicitly registerDriver() - driverClass = Class.forName(driverClassNameTextField.getText()); - if (!classesInstanced.contains(driverClass)) { - classesInstanced.add(driverClass); - } - } - - else if (urlDriver.equals("as400")) { - driverClass = Class.forName("com.ibm.as400.access.AS400JDBCDriver"); - if (!classesInstanced.contains(driverClass)) { - java.sql.DriverManager.registerDriver (new com.ibm.as400.access.AS400JDBCDriver()); - classesInstanced.add(driverClass); - } - } - - else if (urlDriver.equals("jdbc")) { - driverClass = Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); - if (!classesInstanced.contains(driverClass)) { - classesInstanced.add(driverClass); - } - } - - else if (urlDriver.equals("postgresql")) { - driverClass = Class.forName("postgresql.Driver"); - if (!classesInstanced.contains(driverClass)) { - classesInstanced.add(driverClass); - } - } - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JPanel sessionPanel; - private javax.swing.JPanel urlPanel; - private javax.swing.JTextField urlTextField; - private javax.swing.JButton connectButton; - private javax.swing.JPanel driverTypePanel; - private javax.swing.JRadioButton as400RadioButton; - private javax.swing.JRadioButton sunJDBCRadioButton4; - private javax.swing.JRadioButton postgresqlRadioButton; - private javax.swing.JRadioButton customRadioButton; - private javax.swing.JTextField driverClassNameTextField; - private com.ibm.as400.vaccess.SQLQueryBuilderPane sQLQueryBuilderPane1; - private javax.swing.JPanel queryButtonPanel; - private javax.swing.JButton queryToTableButton; - private javax.swing.JButton queryToFormButton; - // End of variables declaration//GEN-END:variables - - private void establishButtonGroup() { - buttonGroup = new javax.swing.ButtonGroup(); - buttonGroup.add(as400RadioButton); - buttonGroup.add(sunJDBCRadioButton4); - buttonGroup.add(postgresqlRadioButton); - buttonGroup.add(customRadioButton); - } - - /** Set the SQLResultSetTable in which the query will be executed - * and results displayed when user presses the appropriate button. - * @param tp A QCSQLResultsSetTablePane. - */ - public void setResultTable(QCSQLResultSetTablePanel tp) { - resultTable = tp; - } - - /** Set the SQLResultSetForm in which the query will be executed - * and results displayed when user presses the appropriate button. - * @param fp A QCSQLResultSetForm - */ - public void setResultForm(QCSQLResultSetFormPanel fp) { - resultForm = fp; - } - - /** Connects the ErrorDialogAdapter with any as400.vaccess components present. - * @param eda An instance of an ErrorDialogAdapter already associated - * with a suitable Frame. - */ - public void propagateEDA(com.ibm.as400.vaccess.ErrorDialogAdapter eda) { - errorDialogAdapter=eda; - sQLQueryBuilderPane1.addErrorListener(eda); - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLQueryBuilderPanelBeanInfo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLQueryBuilderPanelBeanInfo.java deleted file mode 100644 index 4db1aa6b5..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLQueryBuilderPanelBeanInfo.java +++ /dev/null @@ -1,313 +0,0 @@ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.beans.*; - -public class QCSQLQueryBuilderPanelBeanInfo extends SimpleBeanInfo { - - // Property identifiers //GEN-FIRST:Properties - private static final int PROPERTY_optimizedDrawingEnabled = 0; - private static final int PROPERTY_colorModel = 1; - private static final int PROPERTY_minimumSize = 2; - private static final int PROPERTY_visible = 3; - private static final int PROPERTY_toolkit = 4; - private static final int PROPERTY_displayable = 5; - private static final int PROPERTY_opaque = 6; - private static final int PROPERTY_requestFocusEnabled = 7; - private static final int PROPERTY_enabled = 8; - private static final int PROPERTY_autoscrolls = 9; - private static final int PROPERTY_y = 10; - private static final int PROPERTY_x = 11; - private static final int PROPERTY_accessibleContext = 12; - private static final int PROPERTY_componentOrientation = 13; - private static final int PROPERTY_components = 14; - private static final int PROPERTY_managingFocus = 15; - private static final int PROPERTY_inputMethodRequests = 16; - private static final int PROPERTY_border = 17; - private static final int PROPERTY_locale = 18; - private static final int PROPERTY_insets = 19; - private static final int PROPERTY_UIClassID = 20; - private static final int PROPERTY_graphics = 21; - private static final int PROPERTY_minimumSizeSet = 22; - private static final int PROPERTY_actionMap = 23; - private static final int PROPERTY_maximumSizeSet = 24; - private static final int PROPERTY_alignmentY = 25; - private static final int PROPERTY_alignmentX = 26; - private static final int PROPERTY_locationOnScreen = 27; - private static final int PROPERTY_cursor = 28; - private static final int PROPERTY_registeredKeyStrokes = 29; - private static final int PROPERTY_preferredSizeSet = 30; - private static final int PROPERTY_visibleRect = 31; - private static final int PROPERTY_bounds = 32; - private static final int PROPERTY_inputContext = 33; - private static final int PROPERTY_class = 34; - private static final int PROPERTY_focusTraversable = 35; - private static final int PROPERTY_font = 36; - private static final int PROPERTY_inputVerifier = 37; - private static final int PROPERTY_lightweight = 38; - private static final int PROPERTY_paintingTile = 39; - private static final int PROPERTY_maximumSize = 40; - private static final int PROPERTY_layout = 41; - private static final int PROPERTY_treeLock = 42; - private static final int PROPERTY_verifyInputWhenFocusTarget = 43; - private static final int PROPERTY_foreground = 44; - private static final int PROPERTY_preferredSize = 45; - private static final int PROPERTY_debugGraphicsOptions = 46; - private static final int PROPERTY_doubleBuffered = 47; - private static final int PROPERTY_showing = 48; - private static final int PROPERTY_nextFocusableComponent = 49; - private static final int PROPERTY_parent = 50; - private static final int PROPERTY_peer = 51; - private static final int PROPERTY_componentCount = 52; - private static final int PROPERTY_graphicsConfiguration = 53; - private static final int PROPERTY_height = 54; - private static final int PROPERTY_valid = 55; - private static final int PROPERTY_focusCycleRoot = 56; - private static final int PROPERTY_width = 57; - private static final int PROPERTY_toolTipText = 58; - private static final int PROPERTY_background = 59; - private static final int PROPERTY_validateRoot = 60; - private static final int PROPERTY_topLevelAncestor = 61; - private static final int PROPERTY_dropTarget = 62; - private static final int PROPERTY_rootPane = 63; - private static final int PROPERTY_name = 64; - private static final int PROPERTY_component = 65; - - // Property array - private static PropertyDescriptor[] properties = new PropertyDescriptor[66]; - - static { - try { - properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor ( "optimizedDrawingEnabled", QCSQLQueryBuilderPanel.class, "isOptimizedDrawingEnabled", null ); - properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", QCSQLQueryBuilderPanel.class, "getColorModel", null ); - properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", QCSQLQueryBuilderPanel.class, "getMinimumSize", "setMinimumSize" ); - properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", QCSQLQueryBuilderPanel.class, "isVisible", "setVisible" ); - properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", QCSQLQueryBuilderPanel.class, "getToolkit", null ); - properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", QCSQLQueryBuilderPanel.class, "isDisplayable", null ); - properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", QCSQLQueryBuilderPanel.class, "isOpaque", "setOpaque" ); - properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor ( "requestFocusEnabled", QCSQLQueryBuilderPanel.class, "isRequestFocusEnabled", "setRequestFocusEnabled" ); - properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", QCSQLQueryBuilderPanel.class, "isEnabled", "setEnabled" ); - properties[PROPERTY_autoscrolls] = new PropertyDescriptor ( "autoscrolls", QCSQLQueryBuilderPanel.class, "getAutoscrolls", "setAutoscrolls" ); - properties[PROPERTY_y] = new PropertyDescriptor ( "y", QCSQLQueryBuilderPanel.class, "getY", null ); - properties[PROPERTY_x] = new PropertyDescriptor ( "x", QCSQLQueryBuilderPanel.class, "getX", null ); - properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", QCSQLQueryBuilderPanel.class, "getAccessibleContext", null ); - properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", QCSQLQueryBuilderPanel.class, "getComponentOrientation", "setComponentOrientation" ); - properties[PROPERTY_components] = new PropertyDescriptor ( "components", QCSQLQueryBuilderPanel.class, "getComponents", null ); - properties[PROPERTY_managingFocus] = new PropertyDescriptor ( "managingFocus", QCSQLQueryBuilderPanel.class, "isManagingFocus", null ); - properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", QCSQLQueryBuilderPanel.class, "getInputMethodRequests", null ); - properties[PROPERTY_border] = new PropertyDescriptor ( "border", QCSQLQueryBuilderPanel.class, "getBorder", "setBorder" ); - properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", QCSQLQueryBuilderPanel.class, "getLocale", "setLocale" ); - properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", QCSQLQueryBuilderPanel.class, "getInsets", null ); - properties[PROPERTY_UIClassID] = new PropertyDescriptor ( "UIClassID", QCSQLQueryBuilderPanel.class, "getUIClassID", null ); - properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", QCSQLQueryBuilderPanel.class, "getGraphics", null ); - properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor ( "minimumSizeSet", QCSQLQueryBuilderPanel.class, "isMinimumSizeSet", null ); - properties[PROPERTY_actionMap] = new PropertyDescriptor ( "actionMap", QCSQLQueryBuilderPanel.class, "getActionMap", "setActionMap" ); - properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor ( "maximumSizeSet", QCSQLQueryBuilderPanel.class, "isMaximumSizeSet", null ); - properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", QCSQLQueryBuilderPanel.class, "getAlignmentY", "setAlignmentY" ); - properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", QCSQLQueryBuilderPanel.class, "getAlignmentX", "setAlignmentX" ); - properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", QCSQLQueryBuilderPanel.class, "getLocationOnScreen", null ); - properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", QCSQLQueryBuilderPanel.class, "getCursor", "setCursor" ); - properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor ( "registeredKeyStrokes", QCSQLQueryBuilderPanel.class, "getRegisteredKeyStrokes", null ); - properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor ( "preferredSizeSet", QCSQLQueryBuilderPanel.class, "isPreferredSizeSet", null ); - properties[PROPERTY_visibleRect] = new PropertyDescriptor ( "visibleRect", QCSQLQueryBuilderPanel.class, "getVisibleRect", null ); - properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", QCSQLQueryBuilderPanel.class, "getBounds", "setBounds" ); - properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", QCSQLQueryBuilderPanel.class, "getInputContext", null ); - properties[PROPERTY_class] = new PropertyDescriptor ( "class", QCSQLQueryBuilderPanel.class, "getClass", null ); - properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", QCSQLQueryBuilderPanel.class, "isFocusTraversable", null ); - properties[PROPERTY_font] = new PropertyDescriptor ( "font", QCSQLQueryBuilderPanel.class, "getFont", "setFont" ); - properties[PROPERTY_inputVerifier] = new PropertyDescriptor ( "inputVerifier", QCSQLQueryBuilderPanel.class, "getInputVerifier", "setInputVerifier" ); - properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", QCSQLQueryBuilderPanel.class, "isLightweight", null ); - properties[PROPERTY_paintingTile] = new PropertyDescriptor ( "paintingTile", QCSQLQueryBuilderPanel.class, "isPaintingTile", null ); - properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", QCSQLQueryBuilderPanel.class, "getMaximumSize", "setMaximumSize" ); - properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", QCSQLQueryBuilderPanel.class, "getLayout", "setLayout" ); - properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", QCSQLQueryBuilderPanel.class, "getTreeLock", null ); - properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor ( "verifyInputWhenFocusTarget", QCSQLQueryBuilderPanel.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget" ); - properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", QCSQLQueryBuilderPanel.class, "getForeground", "setForeground" ); - properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", QCSQLQueryBuilderPanel.class, "getPreferredSize", "setPreferredSize" ); - properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor ( "debugGraphicsOptions", QCSQLQueryBuilderPanel.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions" ); - properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", QCSQLQueryBuilderPanel.class, "isDoubleBuffered", "setDoubleBuffered" ); - properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", QCSQLQueryBuilderPanel.class, "isShowing", null ); - properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor ( "nextFocusableComponent", QCSQLQueryBuilderPanel.class, "getNextFocusableComponent", "setNextFocusableComponent" ); - properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", QCSQLQueryBuilderPanel.class, "getParent", null ); - properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", QCSQLQueryBuilderPanel.class, "getPeer", null ); - properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", QCSQLQueryBuilderPanel.class, "getComponentCount", null ); - properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", QCSQLQueryBuilderPanel.class, "getGraphicsConfiguration", null ); - properties[PROPERTY_height] = new PropertyDescriptor ( "height", QCSQLQueryBuilderPanel.class, "getHeight", null ); - properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", QCSQLQueryBuilderPanel.class, "isValid", null ); - properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor ( "focusCycleRoot", QCSQLQueryBuilderPanel.class, "isFocusCycleRoot", null ); - properties[PROPERTY_width] = new PropertyDescriptor ( "width", QCSQLQueryBuilderPanel.class, "getWidth", null ); - properties[PROPERTY_toolTipText] = new PropertyDescriptor ( "toolTipText", QCSQLQueryBuilderPanel.class, "getToolTipText", "setToolTipText" ); - properties[PROPERTY_background] = new PropertyDescriptor ( "background", QCSQLQueryBuilderPanel.class, "getBackground", "setBackground" ); - properties[PROPERTY_validateRoot] = new PropertyDescriptor ( "validateRoot", QCSQLQueryBuilderPanel.class, "isValidateRoot", null ); - properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor ( "topLevelAncestor", QCSQLQueryBuilderPanel.class, "getTopLevelAncestor", null ); - properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", QCSQLQueryBuilderPanel.class, "getDropTarget", "setDropTarget" ); - properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", QCSQLQueryBuilderPanel.class, "getRootPane", null ); - properties[PROPERTY_name] = new PropertyDescriptor ( "name", QCSQLQueryBuilderPanel.class, "getName", "setName" ); - properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", QCSQLQueryBuilderPanel.class, null, null, "getComponent", null ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Properties - - // Here you can add code for customizing the properties array. - -}//GEN-LAST:Properties - - // EventSet identifiers//GEN-FIRST:Events - private static final int EVENT_mouseMotionListener = 0; - private static final int EVENT_ancestorListener = 1; - private static final int EVENT_inputMethodListener = 2; - private static final int EVENT_componentListener = 3; - private static final int EVENT_hierarchyBoundsListener = 4; - private static final int EVENT_mouseListener = 5; - private static final int EVENT_focusListener = 6; - private static final int EVENT_propertyChangeListener = 7; - private static final int EVENT_keyListener = 8; - private static final int EVENT_hierarchyListener = 9; - private static final int EVENT_containerListener = 10; - private static final int EVENT_vetoableChangeListener = 11; - - // EventSet array - private static EventSetDescriptor[] eventSets = new EventSetDescriptor[12]; - - static { - try { - eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( QCSQLQueryBuilderPanel.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[0], "addMouseMotionListener", "removeMouseMotionListener" ); - eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( QCSQLQueryBuilderPanel.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[0], "addAncestorListener", "removeAncestorListener" ); - eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( QCSQLQueryBuilderPanel.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[0], "addInputMethodListener", "removeInputMethodListener" ); - eventSets[EVENT_componentListener] = new EventSetDescriptor ( QCSQLQueryBuilderPanel.class, "componentListener", java.awt.event.ComponentListener.class, new String[0], "addComponentListener", "removeComponentListener" ); - eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( QCSQLQueryBuilderPanel.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[0], "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); - eventSets[EVENT_mouseListener] = new EventSetDescriptor ( QCSQLQueryBuilderPanel.class, "mouseListener", java.awt.event.MouseListener.class, new String[0], "addMouseListener", "removeMouseListener" ); - eventSets[EVENT_focusListener] = new EventSetDescriptor ( QCSQLQueryBuilderPanel.class, "focusListener", java.awt.event.FocusListener.class, new String[0], "addFocusListener", "removeFocusListener" ); - eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( QCSQLQueryBuilderPanel.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[0], "addPropertyChangeListener", "removePropertyChangeListener" ); - eventSets[EVENT_keyListener] = new EventSetDescriptor ( QCSQLQueryBuilderPanel.class, "keyListener", java.awt.event.KeyListener.class, new String[0], "addKeyListener", "removeKeyListener" ); - eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( QCSQLQueryBuilderPanel.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[0], "addHierarchyListener", "removeHierarchyListener" ); - eventSets[EVENT_containerListener] = new EventSetDescriptor ( QCSQLQueryBuilderPanel.class, "containerListener", java.awt.event.ContainerListener.class, new String[0], "addContainerListener", "removeContainerListener" ); - eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( QCSQLQueryBuilderPanel.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[0], "addVetoableChangeListener", "removeVetoableChangeListener" ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Events - - // Here you can add code for customizing the event sets array. - -}//GEN-LAST:Events - - private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef - private static java.awt.Image iconColor32 = null; - private static java.awt.Image iconMono16 = null; - private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef - private static String iconNameC16 = null;//GEN-BEGIN:Icons - private static String iconNameC32 = null; - private static String iconNameM16 = null; - private static String iconNameM32 = null;//GEN-END:Icons - - private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx - private static int defaultEventIndex = -1;//GEN-END:Idx - - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

- * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } - - /** - * Gets the beans EventSetDescriptors. - * - * @return An array of EventSetDescriptors describing the kinds of - * events fired by this bean. May return null if the information - * should be obtained by automatic analysis. - */ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSets; - } - - /** - * A bean may have a "default" property that is the property that will - * mostly commonly be initially chosen for update by human's who are - * customizing the bean. - * @return Index of default property in the PropertyDescriptor array - * returned by getPropertyDescriptors. - *

Returns -1 if there is no default property. - */ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** - * A bean may have a "default" event that is the event that will - * mostly commonly be used by human's when using the bean. - * @return Index of default event in the EventSetDescriptor array - * returned by getEventSetDescriptors. - *

Returns -1 if there is no default event. - */ - public int getDefaultEventIndex() { - return defaultPropertyIndex; - } - - /** - * This method returns an image object that can be used to - * represent the bean in toolboxes, toolbars, etc. Icon images - * will typically be GIFs, but may in future include other formats. - *

- * Beans aren't required to provide icons and may return null from - * this method. - *

- * There are four possible flavors of icons (16x16 color, - * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only - * support a single icon we recommend supporting 16x16 color. - *

- * We recommend that icons have a "transparent" background - * so they can be rendered onto an existing background. - * - * @param iconKind The kind of icon requested. This should be - * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, - * ICON_MONO_16x16, or ICON_MONO_32x32. - * @return An image object representing the requested icon. May - * return null if no suitable icon is available. - */ - public java.awt.Image getIcon(int iconKind) { - switch ( iconKind ) { - case ICON_COLOR_16x16: - if ( iconNameC16 == null ) - return null; - else { - if( iconColor16 == null ) - iconColor16 = loadImage( iconNameC16 ); - return iconColor16; - } - case ICON_COLOR_32x32: - if ( iconNameC32 == null ) - return null; - else { - if( iconColor32 == null ) - iconColor32 = loadImage( iconNameC32 ); - return iconColor32; - } - case ICON_MONO_16x16: - if ( iconNameM16 == null ) - return null; - else { - if( iconMono16 == null ) - iconMono16 = loadImage( iconNameM16 ); - return iconMono16; - } - case ICON_MONO_32x32: - if ( iconNameM32 == null ) - return null; - else { - if( iconNameM32 == null ) - iconMono32 = loadImage( iconNameM32 ); - return iconMono32; - } - } - return null; - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetFormPanel.form b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetFormPanel.form deleted file mode 100644 index adb2b2509..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetFormPanel.form +++ /dev/null @@ -1,31 +0,0 @@ - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetFormPanel.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetFormPanel.java deleted file mode 100644 index 62a05881e..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetFormPanel.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * QCSQLResultSetFormPanel.java - * - * Created on July 21, 2000, 2:33 PM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** Shows result sets from the QCSQLQueryBuilderPanel - * @author jax - * @version 1.0 - */ -public class QCSQLResultSetFormPanel extends javax.swing.JPanel { - - private com.ibm.as400.vaccess.ErrorDialogAdapter errorDialogAdapter; - - /** Creates new form QCSQLResultSetFormPanel */ - public QCSQLResultSetFormPanel() { - initComponents (); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the FormEditor. - */ - private void initComponents () {//GEN-BEGIN:initComponents - sQLResultSetFormPane1 = new com.ibm.as400.vaccess.SQLResultSetFormPane (); - jLabel1 = new javax.swing.JLabel (); - setLayout (new java.awt.BorderLayout ()); - - - - add (sQLResultSetFormPane1, java.awt.BorderLayout.CENTER); - - jLabel1.setText ("Results of a query in the SQL Query Builder which are only valid if that connection is still active."); - jLabel1.setHorizontalAlignment (javax.swing.SwingConstants.CENTER); - - - add (jLabel1, java.awt.BorderLayout.NORTH); - - }//GEN-END:initComponents - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private com.ibm.as400.vaccess.SQLResultSetFormPane sQLResultSetFormPane1; - private javax.swing.JLabel jLabel1; - // End of variables declaration//GEN-END:variables - - /** Runs the query passed to this instance by the QCSQLQueryBuilder. - * @param connection A valid SQLConnection - * @param query A valid SQLQuery - */ - public void doQuery(com.ibm.as400.vaccess.SQLConnection connection,String query) { - try { - sQLResultSetFormPane1.setConnection(connection); - sQLResultSetFormPane1.setQuery(query); - sQLResultSetFormPane1.load(); - } - catch (java.beans.PropertyVetoException e) { - e.printStackTrace(System.err); - } - } - - /** Connects the ErrorDialogAdapter with any as400.vaccess components present. - * @param eda An instance of an ErrorDialogAdapter already associated - * with a suitable Frame. - */ - public void propagateEDA(com.ibm.as400.vaccess.ErrorDialogAdapter eda) { - errorDialogAdapter=eda; - sQLResultSetFormPane1.addErrorListener(eda); - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetFormPanelBeanInfo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetFormPanelBeanInfo.java deleted file mode 100644 index 42fd92a3e..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetFormPanelBeanInfo.java +++ /dev/null @@ -1,313 +0,0 @@ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.beans.*; - -public class QCSQLResultSetFormPanelBeanInfo extends SimpleBeanInfo { - - // Property identifiers //GEN-FIRST:Properties - private static final int PROPERTY_optimizedDrawingEnabled = 0; - private static final int PROPERTY_colorModel = 1; - private static final int PROPERTY_minimumSize = 2; - private static final int PROPERTY_visible = 3; - private static final int PROPERTY_toolkit = 4; - private static final int PROPERTY_displayable = 5; - private static final int PROPERTY_opaque = 6; - private static final int PROPERTY_requestFocusEnabled = 7; - private static final int PROPERTY_enabled = 8; - private static final int PROPERTY_autoscrolls = 9; - private static final int PROPERTY_y = 10; - private static final int PROPERTY_x = 11; - private static final int PROPERTY_accessibleContext = 12; - private static final int PROPERTY_componentOrientation = 13; - private static final int PROPERTY_components = 14; - private static final int PROPERTY_managingFocus = 15; - private static final int PROPERTY_inputMethodRequests = 16; - private static final int PROPERTY_border = 17; - private static final int PROPERTY_locale = 18; - private static final int PROPERTY_insets = 19; - private static final int PROPERTY_UIClassID = 20; - private static final int PROPERTY_graphics = 21; - private static final int PROPERTY_minimumSizeSet = 22; - private static final int PROPERTY_actionMap = 23; - private static final int PROPERTY_maximumSizeSet = 24; - private static final int PROPERTY_alignmentY = 25; - private static final int PROPERTY_alignmentX = 26; - private static final int PROPERTY_locationOnScreen = 27; - private static final int PROPERTY_cursor = 28; - private static final int PROPERTY_registeredKeyStrokes = 29; - private static final int PROPERTY_preferredSizeSet = 30; - private static final int PROPERTY_visibleRect = 31; - private static final int PROPERTY_bounds = 32; - private static final int PROPERTY_inputContext = 33; - private static final int PROPERTY_class = 34; - private static final int PROPERTY_focusTraversable = 35; - private static final int PROPERTY_font = 36; - private static final int PROPERTY_inputVerifier = 37; - private static final int PROPERTY_lightweight = 38; - private static final int PROPERTY_paintingTile = 39; - private static final int PROPERTY_maximumSize = 40; - private static final int PROPERTY_layout = 41; - private static final int PROPERTY_treeLock = 42; - private static final int PROPERTY_verifyInputWhenFocusTarget = 43; - private static final int PROPERTY_foreground = 44; - private static final int PROPERTY_preferredSize = 45; - private static final int PROPERTY_debugGraphicsOptions = 46; - private static final int PROPERTY_doubleBuffered = 47; - private static final int PROPERTY_showing = 48; - private static final int PROPERTY_nextFocusableComponent = 49; - private static final int PROPERTY_parent = 50; - private static final int PROPERTY_peer = 51; - private static final int PROPERTY_componentCount = 52; - private static final int PROPERTY_graphicsConfiguration = 53; - private static final int PROPERTY_height = 54; - private static final int PROPERTY_valid = 55; - private static final int PROPERTY_focusCycleRoot = 56; - private static final int PROPERTY_width = 57; - private static final int PROPERTY_toolTipText = 58; - private static final int PROPERTY_background = 59; - private static final int PROPERTY_validateRoot = 60; - private static final int PROPERTY_topLevelAncestor = 61; - private static final int PROPERTY_dropTarget = 62; - private static final int PROPERTY_rootPane = 63; - private static final int PROPERTY_name = 64; - private static final int PROPERTY_component = 65; - - // Property array - private static PropertyDescriptor[] properties = new PropertyDescriptor[66]; - - static { - try { - properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor ( "optimizedDrawingEnabled", QCSQLResultSetFormPanel.class, "isOptimizedDrawingEnabled", null ); - properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", QCSQLResultSetFormPanel.class, "getColorModel", null ); - properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", QCSQLResultSetFormPanel.class, "getMinimumSize", "setMinimumSize" ); - properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", QCSQLResultSetFormPanel.class, "isVisible", "setVisible" ); - properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", QCSQLResultSetFormPanel.class, "getToolkit", null ); - properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", QCSQLResultSetFormPanel.class, "isDisplayable", null ); - properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", QCSQLResultSetFormPanel.class, "isOpaque", "setOpaque" ); - properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor ( "requestFocusEnabled", QCSQLResultSetFormPanel.class, "isRequestFocusEnabled", "setRequestFocusEnabled" ); - properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", QCSQLResultSetFormPanel.class, "isEnabled", "setEnabled" ); - properties[PROPERTY_autoscrolls] = new PropertyDescriptor ( "autoscrolls", QCSQLResultSetFormPanel.class, "getAutoscrolls", "setAutoscrolls" ); - properties[PROPERTY_y] = new PropertyDescriptor ( "y", QCSQLResultSetFormPanel.class, "getY", null ); - properties[PROPERTY_x] = new PropertyDescriptor ( "x", QCSQLResultSetFormPanel.class, "getX", null ); - properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", QCSQLResultSetFormPanel.class, "getAccessibleContext", null ); - properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", QCSQLResultSetFormPanel.class, "getComponentOrientation", "setComponentOrientation" ); - properties[PROPERTY_components] = new PropertyDescriptor ( "components", QCSQLResultSetFormPanel.class, "getComponents", null ); - properties[PROPERTY_managingFocus] = new PropertyDescriptor ( "managingFocus", QCSQLResultSetFormPanel.class, "isManagingFocus", null ); - properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", QCSQLResultSetFormPanel.class, "getInputMethodRequests", null ); - properties[PROPERTY_border] = new PropertyDescriptor ( "border", QCSQLResultSetFormPanel.class, "getBorder", "setBorder" ); - properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", QCSQLResultSetFormPanel.class, "getLocale", "setLocale" ); - properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", QCSQLResultSetFormPanel.class, "getInsets", null ); - properties[PROPERTY_UIClassID] = new PropertyDescriptor ( "UIClassID", QCSQLResultSetFormPanel.class, "getUIClassID", null ); - properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", QCSQLResultSetFormPanel.class, "getGraphics", null ); - properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor ( "minimumSizeSet", QCSQLResultSetFormPanel.class, "isMinimumSizeSet", null ); - properties[PROPERTY_actionMap] = new PropertyDescriptor ( "actionMap", QCSQLResultSetFormPanel.class, "getActionMap", "setActionMap" ); - properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor ( "maximumSizeSet", QCSQLResultSetFormPanel.class, "isMaximumSizeSet", null ); - properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", QCSQLResultSetFormPanel.class, "getAlignmentY", "setAlignmentY" ); - properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", QCSQLResultSetFormPanel.class, "getAlignmentX", "setAlignmentX" ); - properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", QCSQLResultSetFormPanel.class, "getLocationOnScreen", null ); - properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", QCSQLResultSetFormPanel.class, "getCursor", "setCursor" ); - properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor ( "registeredKeyStrokes", QCSQLResultSetFormPanel.class, "getRegisteredKeyStrokes", null ); - properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor ( "preferredSizeSet", QCSQLResultSetFormPanel.class, "isPreferredSizeSet", null ); - properties[PROPERTY_visibleRect] = new PropertyDescriptor ( "visibleRect", QCSQLResultSetFormPanel.class, "getVisibleRect", null ); - properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", QCSQLResultSetFormPanel.class, "getBounds", "setBounds" ); - properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", QCSQLResultSetFormPanel.class, "getInputContext", null ); - properties[PROPERTY_class] = new PropertyDescriptor ( "class", QCSQLResultSetFormPanel.class, "getClass", null ); - properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", QCSQLResultSetFormPanel.class, "isFocusTraversable", null ); - properties[PROPERTY_font] = new PropertyDescriptor ( "font", QCSQLResultSetFormPanel.class, "getFont", "setFont" ); - properties[PROPERTY_inputVerifier] = new PropertyDescriptor ( "inputVerifier", QCSQLResultSetFormPanel.class, "getInputVerifier", "setInputVerifier" ); - properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", QCSQLResultSetFormPanel.class, "isLightweight", null ); - properties[PROPERTY_paintingTile] = new PropertyDescriptor ( "paintingTile", QCSQLResultSetFormPanel.class, "isPaintingTile", null ); - properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", QCSQLResultSetFormPanel.class, "getMaximumSize", "setMaximumSize" ); - properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", QCSQLResultSetFormPanel.class, "getLayout", "setLayout" ); - properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", QCSQLResultSetFormPanel.class, "getTreeLock", null ); - properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor ( "verifyInputWhenFocusTarget", QCSQLResultSetFormPanel.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget" ); - properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", QCSQLResultSetFormPanel.class, "getForeground", "setForeground" ); - properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", QCSQLResultSetFormPanel.class, "getPreferredSize", "setPreferredSize" ); - properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor ( "debugGraphicsOptions", QCSQLResultSetFormPanel.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions" ); - properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", QCSQLResultSetFormPanel.class, "isDoubleBuffered", "setDoubleBuffered" ); - properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", QCSQLResultSetFormPanel.class, "isShowing", null ); - properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor ( "nextFocusableComponent", QCSQLResultSetFormPanel.class, "getNextFocusableComponent", "setNextFocusableComponent" ); - properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", QCSQLResultSetFormPanel.class, "getParent", null ); - properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", QCSQLResultSetFormPanel.class, "getPeer", null ); - properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", QCSQLResultSetFormPanel.class, "getComponentCount", null ); - properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", QCSQLResultSetFormPanel.class, "getGraphicsConfiguration", null ); - properties[PROPERTY_height] = new PropertyDescriptor ( "height", QCSQLResultSetFormPanel.class, "getHeight", null ); - properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", QCSQLResultSetFormPanel.class, "isValid", null ); - properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor ( "focusCycleRoot", QCSQLResultSetFormPanel.class, "isFocusCycleRoot", null ); - properties[PROPERTY_width] = new PropertyDescriptor ( "width", QCSQLResultSetFormPanel.class, "getWidth", null ); - properties[PROPERTY_toolTipText] = new PropertyDescriptor ( "toolTipText", QCSQLResultSetFormPanel.class, "getToolTipText", "setToolTipText" ); - properties[PROPERTY_background] = new PropertyDescriptor ( "background", QCSQLResultSetFormPanel.class, "getBackground", "setBackground" ); - properties[PROPERTY_validateRoot] = new PropertyDescriptor ( "validateRoot", QCSQLResultSetFormPanel.class, "isValidateRoot", null ); - properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor ( "topLevelAncestor", QCSQLResultSetFormPanel.class, "getTopLevelAncestor", null ); - properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", QCSQLResultSetFormPanel.class, "getDropTarget", "setDropTarget" ); - properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", QCSQLResultSetFormPanel.class, "getRootPane", null ); - properties[PROPERTY_name] = new PropertyDescriptor ( "name", QCSQLResultSetFormPanel.class, "getName", "setName" ); - properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", QCSQLResultSetFormPanel.class, null, null, "getComponent", null ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Properties - - // Here you can add code for customizing the properties array. - -}//GEN-LAST:Properties - - // EventSet identifiers//GEN-FIRST:Events - private static final int EVENT_mouseMotionListener = 0; - private static final int EVENT_ancestorListener = 1; - private static final int EVENT_inputMethodListener = 2; - private static final int EVENT_componentListener = 3; - private static final int EVENT_hierarchyBoundsListener = 4; - private static final int EVENT_mouseListener = 5; - private static final int EVENT_focusListener = 6; - private static final int EVENT_propertyChangeListener = 7; - private static final int EVENT_keyListener = 8; - private static final int EVENT_hierarchyListener = 9; - private static final int EVENT_containerListener = 10; - private static final int EVENT_vetoableChangeListener = 11; - - // EventSet array - private static EventSetDescriptor[] eventSets = new EventSetDescriptor[12]; - - static { - try { - eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( QCSQLResultSetFormPanel.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[0], "addMouseMotionListener", "removeMouseMotionListener" ); - eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( QCSQLResultSetFormPanel.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[0], "addAncestorListener", "removeAncestorListener" ); - eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( QCSQLResultSetFormPanel.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[0], "addInputMethodListener", "removeInputMethodListener" ); - eventSets[EVENT_componentListener] = new EventSetDescriptor ( QCSQLResultSetFormPanel.class, "componentListener", java.awt.event.ComponentListener.class, new String[0], "addComponentListener", "removeComponentListener" ); - eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( QCSQLResultSetFormPanel.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[0], "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); - eventSets[EVENT_mouseListener] = new EventSetDescriptor ( QCSQLResultSetFormPanel.class, "mouseListener", java.awt.event.MouseListener.class, new String[0], "addMouseListener", "removeMouseListener" ); - eventSets[EVENT_focusListener] = new EventSetDescriptor ( QCSQLResultSetFormPanel.class, "focusListener", java.awt.event.FocusListener.class, new String[0], "addFocusListener", "removeFocusListener" ); - eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( QCSQLResultSetFormPanel.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[0], "addPropertyChangeListener", "removePropertyChangeListener" ); - eventSets[EVENT_keyListener] = new EventSetDescriptor ( QCSQLResultSetFormPanel.class, "keyListener", java.awt.event.KeyListener.class, new String[0], "addKeyListener", "removeKeyListener" ); - eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( QCSQLResultSetFormPanel.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[0], "addHierarchyListener", "removeHierarchyListener" ); - eventSets[EVENT_containerListener] = new EventSetDescriptor ( QCSQLResultSetFormPanel.class, "containerListener", java.awt.event.ContainerListener.class, new String[0], "addContainerListener", "removeContainerListener" ); - eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( QCSQLResultSetFormPanel.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[0], "addVetoableChangeListener", "removeVetoableChangeListener" ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Events - - // Here you can add code for customizing the event sets array. - -}//GEN-LAST:Events - - private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef - private static java.awt.Image iconColor32 = null; - private static java.awt.Image iconMono16 = null; - private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef - private static String iconNameC16 = null;//GEN-BEGIN:Icons - private static String iconNameC32 = null; - private static String iconNameM16 = null; - private static String iconNameM32 = null;//GEN-END:Icons - - private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx - private static int defaultEventIndex = -1;//GEN-END:Idx - - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

- * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } - - /** - * Gets the beans EventSetDescriptors. - * - * @return An array of EventSetDescriptors describing the kinds of - * events fired by this bean. May return null if the information - * should be obtained by automatic analysis. - */ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSets; - } - - /** - * A bean may have a "default" property that is the property that will - * mostly commonly be initially chosen for update by human's who are - * customizing the bean. - * @return Index of default property in the PropertyDescriptor array - * returned by getPropertyDescriptors. - *

Returns -1 if there is no default property. - */ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** - * A bean may have a "default" event that is the event that will - * mostly commonly be used by human's when using the bean. - * @return Index of default event in the EventSetDescriptor array - * returned by getEventSetDescriptors. - *

Returns -1 if there is no default event. - */ - public int getDefaultEventIndex() { - return defaultPropertyIndex; - } - - /** - * This method returns an image object that can be used to - * represent the bean in toolboxes, toolbars, etc. Icon images - * will typically be GIFs, but may in future include other formats. - *

- * Beans aren't required to provide icons and may return null from - * this method. - *

- * There are four possible flavors of icons (16x16 color, - * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only - * support a single icon we recommend supporting 16x16 color. - *

- * We recommend that icons have a "transparent" background - * so they can be rendered onto an existing background. - * - * @param iconKind The kind of icon requested. This should be - * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, - * ICON_MONO_16x16, or ICON_MONO_32x32. - * @return An image object representing the requested icon. May - * return null if no suitable icon is available. - */ - public java.awt.Image getIcon(int iconKind) { - switch ( iconKind ) { - case ICON_COLOR_16x16: - if ( iconNameC16 == null ) - return null; - else { - if( iconColor16 == null ) - iconColor16 = loadImage( iconNameC16 ); - return iconColor16; - } - case ICON_COLOR_32x32: - if ( iconNameC32 == null ) - return null; - else { - if( iconColor32 == null ) - iconColor32 = loadImage( iconNameC32 ); - return iconColor32; - } - case ICON_MONO_16x16: - if ( iconNameM16 == null ) - return null; - else { - if( iconMono16 == null ) - iconMono16 = loadImage( iconNameM16 ); - return iconMono16; - } - case ICON_MONO_32x32: - if ( iconNameM32 == null ) - return null; - else { - if( iconNameM32 == null ) - iconMono32 = loadImage( iconNameM32 ); - return iconMono32; - } - } - return null; - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetTablePanel.form b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetTablePanel.form deleted file mode 100644 index c5ec300f4..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetTablePanel.form +++ /dev/null @@ -1,31 +0,0 @@ - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetTablePanel.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetTablePanel.java deleted file mode 100644 index 37d85f714..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetTablePanel.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * QCSQLResultSetTablePanel.java - * - * Created on July 21, 2000, 2:33 PM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** Shows result sets from the QCSQLQueryBuilderPanel - * @author jax - * @version 1.0 - */ -public class QCSQLResultSetTablePanel extends javax.swing.JPanel { - - private com.ibm.as400.vaccess.ErrorDialogAdapter errorDialogAdapter; - - /** Creates new form QCSQLResultSetTablePanel */ - public QCSQLResultSetTablePanel() { - initComponents (); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the FormEditor. - */ - private void initComponents () {//GEN-BEGIN:initComponents - sQLResultSetTablePane1 = new com.ibm.as400.vaccess.SQLResultSetTablePane (); - jLabel1 = new javax.swing.JLabel (); - setLayout (new java.awt.BorderLayout ()); - - - - add (sQLResultSetTablePane1, java.awt.BorderLayout.CENTER); - - jLabel1.setText ("Results of a query in the SQL Query Builder which are only valid if that connection is still active."); - jLabel1.setHorizontalAlignment (javax.swing.SwingConstants.CENTER); - - - add (jLabel1, java.awt.BorderLayout.NORTH); - - }//GEN-END:initComponents - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private com.ibm.as400.vaccess.SQLResultSetTablePane sQLResultSetTablePane1; - private javax.swing.JLabel jLabel1; - // End of variables declaration//GEN-END:variables - - /** Runs the query passed to this instance by the QCSQLQueryBuilder. - * @param connection A valid SQLConnection - * @param query A valid SQLQuery - */ - public void doQuery (com.ibm.as400.vaccess.SQLConnection connection, String query) { - try { - sQLResultSetTablePane1.setConnection(connection); - sQLResultSetTablePane1.setQuery(query); - sQLResultSetTablePane1.load(); - } - catch (java.beans.PropertyVetoException e) { - e.printStackTrace(System.err); - } - } - - /** Connects the ErrorDialogAdapter with any as400.vaccess components present. - * @param eda An instance of an ErrorDialogAdapter already associated - * with a suitable Frame. - */ - public void propagateEDA(com.ibm.as400.vaccess.ErrorDialogAdapter eda) { - errorDialogAdapter=eda; - sQLResultSetTablePane1.addErrorListener(eda); - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetTablePanelBeanInfo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetTablePanelBeanInfo.java deleted file mode 100644 index 36c8cbe6c..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSQLResultSetTablePanelBeanInfo.java +++ /dev/null @@ -1,313 +0,0 @@ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.beans.*; - -public class QCSQLResultSetTablePanelBeanInfo extends SimpleBeanInfo { - - // Property identifiers //GEN-FIRST:Properties - private static final int PROPERTY_optimizedDrawingEnabled = 0; - private static final int PROPERTY_colorModel = 1; - private static final int PROPERTY_minimumSize = 2; - private static final int PROPERTY_visible = 3; - private static final int PROPERTY_toolkit = 4; - private static final int PROPERTY_displayable = 5; - private static final int PROPERTY_opaque = 6; - private static final int PROPERTY_requestFocusEnabled = 7; - private static final int PROPERTY_enabled = 8; - private static final int PROPERTY_autoscrolls = 9; - private static final int PROPERTY_y = 10; - private static final int PROPERTY_x = 11; - private static final int PROPERTY_accessibleContext = 12; - private static final int PROPERTY_componentOrientation = 13; - private static final int PROPERTY_components = 14; - private static final int PROPERTY_managingFocus = 15; - private static final int PROPERTY_inputMethodRequests = 16; - private static final int PROPERTY_border = 17; - private static final int PROPERTY_locale = 18; - private static final int PROPERTY_insets = 19; - private static final int PROPERTY_UIClassID = 20; - private static final int PROPERTY_graphics = 21; - private static final int PROPERTY_minimumSizeSet = 22; - private static final int PROPERTY_actionMap = 23; - private static final int PROPERTY_maximumSizeSet = 24; - private static final int PROPERTY_alignmentY = 25; - private static final int PROPERTY_alignmentX = 26; - private static final int PROPERTY_locationOnScreen = 27; - private static final int PROPERTY_cursor = 28; - private static final int PROPERTY_registeredKeyStrokes = 29; - private static final int PROPERTY_preferredSizeSet = 30; - private static final int PROPERTY_visibleRect = 31; - private static final int PROPERTY_bounds = 32; - private static final int PROPERTY_inputContext = 33; - private static final int PROPERTY_class = 34; - private static final int PROPERTY_focusTraversable = 35; - private static final int PROPERTY_font = 36; - private static final int PROPERTY_inputVerifier = 37; - private static final int PROPERTY_lightweight = 38; - private static final int PROPERTY_paintingTile = 39; - private static final int PROPERTY_maximumSize = 40; - private static final int PROPERTY_layout = 41; - private static final int PROPERTY_treeLock = 42; - private static final int PROPERTY_verifyInputWhenFocusTarget = 43; - private static final int PROPERTY_foreground = 44; - private static final int PROPERTY_preferredSize = 45; - private static final int PROPERTY_debugGraphicsOptions = 46; - private static final int PROPERTY_doubleBuffered = 47; - private static final int PROPERTY_showing = 48; - private static final int PROPERTY_nextFocusableComponent = 49; - private static final int PROPERTY_parent = 50; - private static final int PROPERTY_peer = 51; - private static final int PROPERTY_componentCount = 52; - private static final int PROPERTY_graphicsConfiguration = 53; - private static final int PROPERTY_height = 54; - private static final int PROPERTY_valid = 55; - private static final int PROPERTY_focusCycleRoot = 56; - private static final int PROPERTY_width = 57; - private static final int PROPERTY_toolTipText = 58; - private static final int PROPERTY_background = 59; - private static final int PROPERTY_validateRoot = 60; - private static final int PROPERTY_topLevelAncestor = 61; - private static final int PROPERTY_dropTarget = 62; - private static final int PROPERTY_rootPane = 63; - private static final int PROPERTY_name = 64; - private static final int PROPERTY_component = 65; - - // Property array - private static PropertyDescriptor[] properties = new PropertyDescriptor[66]; - - static { - try { - properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor ( "optimizedDrawingEnabled", QCSQLResultSetTablePanel.class, "isOptimizedDrawingEnabled", null ); - properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", QCSQLResultSetTablePanel.class, "getColorModel", null ); - properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", QCSQLResultSetTablePanel.class, "getMinimumSize", "setMinimumSize" ); - properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", QCSQLResultSetTablePanel.class, "isVisible", "setVisible" ); - properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", QCSQLResultSetTablePanel.class, "getToolkit", null ); - properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", QCSQLResultSetTablePanel.class, "isDisplayable", null ); - properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", QCSQLResultSetTablePanel.class, "isOpaque", "setOpaque" ); - properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor ( "requestFocusEnabled", QCSQLResultSetTablePanel.class, "isRequestFocusEnabled", "setRequestFocusEnabled" ); - properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", QCSQLResultSetTablePanel.class, "isEnabled", "setEnabled" ); - properties[PROPERTY_autoscrolls] = new PropertyDescriptor ( "autoscrolls", QCSQLResultSetTablePanel.class, "getAutoscrolls", "setAutoscrolls" ); - properties[PROPERTY_y] = new PropertyDescriptor ( "y", QCSQLResultSetTablePanel.class, "getY", null ); - properties[PROPERTY_x] = new PropertyDescriptor ( "x", QCSQLResultSetTablePanel.class, "getX", null ); - properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", QCSQLResultSetTablePanel.class, "getAccessibleContext", null ); - properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", QCSQLResultSetTablePanel.class, "getComponentOrientation", "setComponentOrientation" ); - properties[PROPERTY_components] = new PropertyDescriptor ( "components", QCSQLResultSetTablePanel.class, "getComponents", null ); - properties[PROPERTY_managingFocus] = new PropertyDescriptor ( "managingFocus", QCSQLResultSetTablePanel.class, "isManagingFocus", null ); - properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", QCSQLResultSetTablePanel.class, "getInputMethodRequests", null ); - properties[PROPERTY_border] = new PropertyDescriptor ( "border", QCSQLResultSetTablePanel.class, "getBorder", "setBorder" ); - properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", QCSQLResultSetTablePanel.class, "getLocale", "setLocale" ); - properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", QCSQLResultSetTablePanel.class, "getInsets", null ); - properties[PROPERTY_UIClassID] = new PropertyDescriptor ( "UIClassID", QCSQLResultSetTablePanel.class, "getUIClassID", null ); - properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", QCSQLResultSetTablePanel.class, "getGraphics", null ); - properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor ( "minimumSizeSet", QCSQLResultSetTablePanel.class, "isMinimumSizeSet", null ); - properties[PROPERTY_actionMap] = new PropertyDescriptor ( "actionMap", QCSQLResultSetTablePanel.class, "getActionMap", "setActionMap" ); - properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor ( "maximumSizeSet", QCSQLResultSetTablePanel.class, "isMaximumSizeSet", null ); - properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", QCSQLResultSetTablePanel.class, "getAlignmentY", "setAlignmentY" ); - properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", QCSQLResultSetTablePanel.class, "getAlignmentX", "setAlignmentX" ); - properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", QCSQLResultSetTablePanel.class, "getLocationOnScreen", null ); - properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", QCSQLResultSetTablePanel.class, "getCursor", "setCursor" ); - properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor ( "registeredKeyStrokes", QCSQLResultSetTablePanel.class, "getRegisteredKeyStrokes", null ); - properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor ( "preferredSizeSet", QCSQLResultSetTablePanel.class, "isPreferredSizeSet", null ); - properties[PROPERTY_visibleRect] = new PropertyDescriptor ( "visibleRect", QCSQLResultSetTablePanel.class, "getVisibleRect", null ); - properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", QCSQLResultSetTablePanel.class, "getBounds", "setBounds" ); - properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", QCSQLResultSetTablePanel.class, "getInputContext", null ); - properties[PROPERTY_class] = new PropertyDescriptor ( "class", QCSQLResultSetTablePanel.class, "getClass", null ); - properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", QCSQLResultSetTablePanel.class, "isFocusTraversable", null ); - properties[PROPERTY_font] = new PropertyDescriptor ( "font", QCSQLResultSetTablePanel.class, "getFont", "setFont" ); - properties[PROPERTY_inputVerifier] = new PropertyDescriptor ( "inputVerifier", QCSQLResultSetTablePanel.class, "getInputVerifier", "setInputVerifier" ); - properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", QCSQLResultSetTablePanel.class, "isLightweight", null ); - properties[PROPERTY_paintingTile] = new PropertyDescriptor ( "paintingTile", QCSQLResultSetTablePanel.class, "isPaintingTile", null ); - properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", QCSQLResultSetTablePanel.class, "getMaximumSize", "setMaximumSize" ); - properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", QCSQLResultSetTablePanel.class, "getLayout", "setLayout" ); - properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", QCSQLResultSetTablePanel.class, "getTreeLock", null ); - properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor ( "verifyInputWhenFocusTarget", QCSQLResultSetTablePanel.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget" ); - properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", QCSQLResultSetTablePanel.class, "getForeground", "setForeground" ); - properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", QCSQLResultSetTablePanel.class, "getPreferredSize", "setPreferredSize" ); - properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor ( "debugGraphicsOptions", QCSQLResultSetTablePanel.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions" ); - properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", QCSQLResultSetTablePanel.class, "isDoubleBuffered", "setDoubleBuffered" ); - properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", QCSQLResultSetTablePanel.class, "isShowing", null ); - properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor ( "nextFocusableComponent", QCSQLResultSetTablePanel.class, "getNextFocusableComponent", "setNextFocusableComponent" ); - properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", QCSQLResultSetTablePanel.class, "getParent", null ); - properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", QCSQLResultSetTablePanel.class, "getPeer", null ); - properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", QCSQLResultSetTablePanel.class, "getComponentCount", null ); - properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", QCSQLResultSetTablePanel.class, "getGraphicsConfiguration", null ); - properties[PROPERTY_height] = new PropertyDescriptor ( "height", QCSQLResultSetTablePanel.class, "getHeight", null ); - properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", QCSQLResultSetTablePanel.class, "isValid", null ); - properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor ( "focusCycleRoot", QCSQLResultSetTablePanel.class, "isFocusCycleRoot", null ); - properties[PROPERTY_width] = new PropertyDescriptor ( "width", QCSQLResultSetTablePanel.class, "getWidth", null ); - properties[PROPERTY_toolTipText] = new PropertyDescriptor ( "toolTipText", QCSQLResultSetTablePanel.class, "getToolTipText", "setToolTipText" ); - properties[PROPERTY_background] = new PropertyDescriptor ( "background", QCSQLResultSetTablePanel.class, "getBackground", "setBackground" ); - properties[PROPERTY_validateRoot] = new PropertyDescriptor ( "validateRoot", QCSQLResultSetTablePanel.class, "isValidateRoot", null ); - properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor ( "topLevelAncestor", QCSQLResultSetTablePanel.class, "getTopLevelAncestor", null ); - properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", QCSQLResultSetTablePanel.class, "getDropTarget", "setDropTarget" ); - properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", QCSQLResultSetTablePanel.class, "getRootPane", null ); - properties[PROPERTY_name] = new PropertyDescriptor ( "name", QCSQLResultSetTablePanel.class, "getName", "setName" ); - properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", QCSQLResultSetTablePanel.class, null, null, "getComponent", null ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Properties - - // Here you can add code for customizing the properties array. - -}//GEN-LAST:Properties - - // EventSet identifiers//GEN-FIRST:Events - private static final int EVENT_mouseMotionListener = 0; - private static final int EVENT_ancestorListener = 1; - private static final int EVENT_inputMethodListener = 2; - private static final int EVENT_componentListener = 3; - private static final int EVENT_hierarchyBoundsListener = 4; - private static final int EVENT_mouseListener = 5; - private static final int EVENT_focusListener = 6; - private static final int EVENT_propertyChangeListener = 7; - private static final int EVENT_keyListener = 8; - private static final int EVENT_hierarchyListener = 9; - private static final int EVENT_containerListener = 10; - private static final int EVENT_vetoableChangeListener = 11; - - // EventSet array - private static EventSetDescriptor[] eventSets = new EventSetDescriptor[12]; - - static { - try { - eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( QCSQLResultSetTablePanel.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[0], "addMouseMotionListener", "removeMouseMotionListener" ); - eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( QCSQLResultSetTablePanel.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[0], "addAncestorListener", "removeAncestorListener" ); - eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( QCSQLResultSetTablePanel.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[0], "addInputMethodListener", "removeInputMethodListener" ); - eventSets[EVENT_componentListener] = new EventSetDescriptor ( QCSQLResultSetTablePanel.class, "componentListener", java.awt.event.ComponentListener.class, new String[0], "addComponentListener", "removeComponentListener" ); - eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( QCSQLResultSetTablePanel.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[0], "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); - eventSets[EVENT_mouseListener] = new EventSetDescriptor ( QCSQLResultSetTablePanel.class, "mouseListener", java.awt.event.MouseListener.class, new String[0], "addMouseListener", "removeMouseListener" ); - eventSets[EVENT_focusListener] = new EventSetDescriptor ( QCSQLResultSetTablePanel.class, "focusListener", java.awt.event.FocusListener.class, new String[0], "addFocusListener", "removeFocusListener" ); - eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( QCSQLResultSetTablePanel.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[0], "addPropertyChangeListener", "removePropertyChangeListener" ); - eventSets[EVENT_keyListener] = new EventSetDescriptor ( QCSQLResultSetTablePanel.class, "keyListener", java.awt.event.KeyListener.class, new String[0], "addKeyListener", "removeKeyListener" ); - eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( QCSQLResultSetTablePanel.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[0], "addHierarchyListener", "removeHierarchyListener" ); - eventSets[EVENT_containerListener] = new EventSetDescriptor ( QCSQLResultSetTablePanel.class, "containerListener", java.awt.event.ContainerListener.class, new String[0], "addContainerListener", "removeContainerListener" ); - eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( QCSQLResultSetTablePanel.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[0], "addVetoableChangeListener", "removeVetoableChangeListener" ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Events - - // Here you can add code for customizing the event sets array. - -}//GEN-LAST:Events - - private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef - private static java.awt.Image iconColor32 = null; - private static java.awt.Image iconMono16 = null; - private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef - private static String iconNameC16 = null;//GEN-BEGIN:Icons - private static String iconNameC32 = null; - private static String iconNameM16 = null; - private static String iconNameM32 = null;//GEN-END:Icons - - private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx - private static int defaultEventIndex = -1;//GEN-END:Idx - - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

- * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } - - /** - * Gets the beans EventSetDescriptors. - * - * @return An array of EventSetDescriptors describing the kinds of - * events fired by this bean. May return null if the information - * should be obtained by automatic analysis. - */ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSets; - } - - /** - * A bean may have a "default" property that is the property that will - * mostly commonly be initially chosen for update by human's who are - * customizing the bean. - * @return Index of default property in the PropertyDescriptor array - * returned by getPropertyDescriptors. - *

Returns -1 if there is no default property. - */ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** - * A bean may have a "default" event that is the event that will - * mostly commonly be used by human's when using the bean. - * @return Index of default event in the EventSetDescriptor array - * returned by getEventSetDescriptors. - *

Returns -1 if there is no default event. - */ - public int getDefaultEventIndex() { - return defaultPropertyIndex; - } - - /** - * This method returns an image object that can be used to - * represent the bean in toolboxes, toolbars, etc. Icon images - * will typically be GIFs, but may in future include other formats. - *

- * Beans aren't required to provide icons and may return null from - * this method. - *

- * There are four possible flavors of icons (16x16 color, - * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only - * support a single icon we recommend supporting 16x16 color. - *

- * We recommend that icons have a "transparent" background - * so they can be rendered onto an existing background. - * - * @param iconKind The kind of icon requested. This should be - * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, - * ICON_MONO_16x16, or ICON_MONO_32x32. - * @return An image object representing the requested icon. May - * return null if no suitable icon is available. - */ - public java.awt.Image getIcon(int iconKind) { - switch ( iconKind ) { - case ICON_COLOR_16x16: - if ( iconNameC16 == null ) - return null; - else { - if( iconColor16 == null ) - iconColor16 = loadImage( iconNameC16 ); - return iconColor16; - } - case ICON_COLOR_32x32: - if ( iconNameC32 == null ) - return null; - else { - if( iconColor32 == null ) - iconColor32 = loadImage( iconNameC32 ); - return iconColor32; - } - case ICON_MONO_16x16: - if ( iconNameM16 == null ) - return null; - else { - if( iconMono16 == null ) - iconMono16 = loadImage( iconNameM16 ); - return iconMono16; - } - case ICON_MONO_32x32: - if ( iconNameM32 == null ) - return null; - else { - if( iconNameM32 == null ) - iconMono32 = loadImage( iconNameM32 ); - return iconMono32; - } - } - return null; - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCServiceClient.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCServiceClient.java deleted file mode 100644 index 2993b3b9e..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCServiceClient.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * QCServiceClient.java - * - * Created on July 12, 2000, 3:54 PM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** An interface representing application objects which request services from - * the QCMgr. - * @author jax - * @version 1.0 - */ -public interface QCServiceClient { - - /** Called by a QCMgr, this function indicates that a service record supplied - * earlier by the QCMGr to the QCServiceClient instance will no longer be valid - * after this call completes. - * @param sr The service record which the QCMgr is indicating will no longer be valid after the relinquish completes. - */ - public void relinquish(QCServiceRecord sr); -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCServiceHash.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCServiceHash.java deleted file mode 100644 index c105bdf5a..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCServiceHash.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * QCServiceHash.java - * - * Created on July 12, 2000, 3:50 PM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.util.*; - -/** - * - * @author jax - * @version - */ -public class QCServiceHash extends Object { - - private Hashtable serviceSessions; - - /** Creates new QCServiceHash */ - public QCServiceHash() { - serviceSessions = new Hashtable(); - } - - /** Clear all keys - * @throws UnsupportedOperationException - */ - public void clear () throws UnsupportedOperationException { - serviceSessions.clear(); - } - - /** Map in an object - * @param key - * @param object - * @return - */ - public com.ibm.as400.access.AS400 put(QCServiceRecord key, com.ibm.as400.access.AS400 object) { - serviceSessions.put(key, object); - return object; - } - - /** Get a server by name - * @param key - * @return - */ - public com.ibm.as400.access.AS400 get(QCServiceRecord key) { - return (com.ibm.as400.access.AS400) serviceSessions.get(key); - } - - /** Remove a server by name - * @param key - * @return - */ - public com.ibm.as400.access.AS400 remove(QCServiceRecord key) { - return (com.ibm.as400.access.AS400) serviceSessions.remove(key); - } - - /** Contains the server named? - * @param key - * @return - */ - public boolean containsServiceRecord(QCServiceRecord key) { - return serviceSessions.containsKey(key); - } - - /** Contains reference to the identical unique AS400 object - * @param as400 - * @return - */ - public boolean containsServer(com.ibm.as400.access.AS400 as400) { - return serviceSessions.containsValue(as400); - } - - /** Are any clients left of system as400 using service service? - * @param as400 An AS400 system which might currently be connected. - * @param service One of the AS400 service constants. - * @return true if any client is still active on system as400 using service service. - */ - public boolean anyServiceClients(com.ibm.as400.access.AS400 as400,int service) { - return false; - } - /** Number of elements - * @return - */ - public int size () { - return serviceSessions.size(); - } - - /** All service records */ - public Enumeration keys () { - return serviceSessions.keys(); - } - - /** Enumeration of elements elements - * @return - */ - public Enumeration elements () { - return serviceSessions.elements(); - } - - /** Is empty? - * @return - */ - public boolean isEmpty () { - return serviceSessions.isEmpty(); - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCServiceRecord.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCServiceRecord.java deleted file mode 100644 index 80a2e89b7..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCServiceRecord.java +++ /dev/null @@ -1,28 +0,0 @@ -/* QCServiceRecord.java - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -public class QCServiceRecord { - public final String serverName; - public final int service; - public final com.ibm.as400.access.AS400 as400; - public final QCServiceClient client; - - QCServiceRecord (String svrName, - int svc, - com.ibm.as400.access.AS400 a400, - QCServiceClient cli - ) - { - serverName = svrName; - service = svc; - as400 = a400; - client = cli; - } - } diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSpooledFileViewerPanel.form b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSpooledFileViewerPanel.form deleted file mode 100644 index b87a7a2b6..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSpooledFileViewerPanel.form +++ /dev/null @@ -1,144 +0,0 @@ - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSpooledFileViewerPanel.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSpooledFileViewerPanel.java deleted file mode 100644 index 712b6bd00..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSpooledFileViewerPanel.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * QCSpooledFileViewerPanel.java - * - * Created on July 18, 2000, 9:26 PM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** Panel to hold a spool file viewer pane. - * @author jax - * @version 1.0 - */ -public class QCSpooledFileViewerPanel extends javax.swing.JPanel implements QCServiceClient { - - private QCMgr manager; - private java.lang.String serverName; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCServiceRecord serviceRecord; - private com.ibm.as400.vaccess.ErrorDialogAdapter errorDialogAdapter; - - /** Creates new form QCSpooledFileViewerPanel */ - public QCSpooledFileViewerPanel() { - initComponents (); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the FormEditor. - */ - private void initComponents () {//GEN-BEGIN:initComponents - spooledFileViewer1 = new com.ibm.as400.vaccess.SpooledFileViewer (); - jPanel1 = new javax.swing.JPanel (); - systemTextField = new javax.swing.JTextField (); - nameTextField = new javax.swing.JTextField (); - numberTextField = new javax.swing.JTextField (); - systemLabel = new javax.swing.JLabel (); - nameLabel = new javax.swing.JLabel (); - numberLabel = new javax.swing.JLabel (); - jobNameTextField = new javax.swing.JTextField (); - jobUserTextField = new javax.swing.JTextField (); - jobNumberTextField = new javax.swing.JTextField (); - jobNameLabel = new javax.swing.JLabel (); - jobUserLabel = new javax.swing.JLabel (); - jobNumberLabel = new javax.swing.JLabel (); - getSpoolFileButton = new javax.swing.JButton (); - setLayout (new java.awt.BorderLayout ()); - - - - add (spooledFileViewer1, java.awt.BorderLayout.CENTER); - - jPanel1.setLayout (new java.awt.GridLayout (4, 3)); - - systemTextField.setToolTipText ("Enter the name of the system on which the spool file resides."); - - jPanel1.add (systemTextField); - - nameTextField.setToolTipText ("Enter the name of the spool file."); - - jPanel1.add (nameTextField); - - numberTextField.setToolTipText ("Enter the spool file number."); - - jPanel1.add (numberTextField); - - systemLabel.setText ("System"); - - jPanel1.add (systemLabel); - - nameLabel.setText ("Name"); - - jPanel1.add (nameLabel); - - numberLabel.setText ("Number"); - - jPanel1.add (numberLabel); - - jobNameTextField.setToolTipText ("Enter the name of the job which produced the spool file."); - - jPanel1.add (jobNameTextField); - - jobUserTextField.setToolTipText ("Enter the username of the account which produced the spool file."); - - jPanel1.add (jobUserTextField); - - jobNumberTextField.setToolTipText ("Enter the number of the job which created the spool file."); - - jPanel1.add (jobNumberTextField); - - jobNameLabel.setText ("Job Name"); - - jPanel1.add (jobNameLabel); - - jobUserLabel.setText ("Job User"); - - jPanel1.add (jobUserLabel); - - jobNumberLabel.setText ("Job Number"); - - jPanel1.add (jobNumberLabel); - - - add (jPanel1, java.awt.BorderLayout.NORTH); - - getSpoolFileButton.setToolTipText ("Fill in the fields at the top of the window, then press this button to view the spool file."); - getSpoolFileButton.setText ("View Spool File"); - getSpoolFileButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - getSpoolFileButtonActionPerformed (evt); - } - } - ); - - - add (getSpoolFileButton, java.awt.BorderLayout.SOUTH); - - }//GEN-END:initComponents - - private void getSpoolFileButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_getSpoolFileButtonActionPerformed - // Add your handling code here: - - // Loading the directory can take some time! - java.awt.Cursor currentCursor = jPanel1.getCursor(); - setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR)); - - reinstanceServerFromTextEntry(); // Get our AS400 object. - - // Set the spooled file viewer to the loaded spooled file. - com.ibm.as400.access.SpooledFile spooledFile = - new com.ibm.as400.access.SpooledFile - (serviceRecord.as400, nameTextField.getText(), new Integer(numberTextField.getText()).intValue(), - jobNameTextField.getText(), jobUserTextField.getText(), jobNumberTextField.getText()); - - try { - spooledFileViewer1.setSpooledFile(spooledFile); - spooledFileViewer1.load(); - } - - catch (java.beans.PropertyVetoException e) { - e.printStackTrace(); - } - catch (java.io.IOException e) { - e.printStackTrace(); - } - - // The wait is over. - setCursor(currentCursor); - }//GEN-LAST:event_getSpoolFileButtonActionPerformed - - private synchronized void reinstanceServerFromTextEntry() { - String newName = systemTextField.getText(); - if (null == serverName) { - serverName = ""; - } - if (null != newName) { - if (!newName.equals("")) { - if (!newName.equals(serverName)) { - serverName = newName; - if (null != serviceRecord) { - - try { // let go of the service from manager - manager.freeService(serviceRecord); - } - catch (Exception e) { - e.printStackTrace(); - } - serviceRecord = null; - } - try { - serviceRecord = manager.getService("qcmgr:" + serverName + "/PRINT", this); - } - catch (Exception e) { - e.printStackTrace(); - } - } - } - } - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private com.ibm.as400.vaccess.SpooledFileViewer spooledFileViewer1; - private javax.swing.JPanel jPanel1; - private javax.swing.JTextField systemTextField; - private javax.swing.JTextField nameTextField; - private javax.swing.JTextField numberTextField; - private javax.swing.JLabel systemLabel; - private javax.swing.JLabel nameLabel; - private javax.swing.JLabel numberLabel; - private javax.swing.JTextField jobNameTextField; - private javax.swing.JTextField jobUserTextField; - private javax.swing.JTextField jobNumberTextField; - private javax.swing.JLabel jobNameLabel; - private javax.swing.JLabel jobUserLabel; - private javax.swing.JLabel jobNumberLabel; - private javax.swing.JButton getSpoolFileButton; - // End of variables declaration//GEN-END:variables - /** Sets the QCMgr object which will handle AS400 instances for this client. - * @param mgr A QCMgr object. - */ - public void setManager(QCMgr mgr) { - manager = mgr; - } - - /** Connects the ErrorDialogAdapter with any as400.vaccess components present. - * @param eda An instance of an ErrorDialogAdapter already associated - * with a suitable Frame. - */ - public void propagateEDA(com.ibm.as400.vaccess.ErrorDialogAdapter eda) { - errorDialogAdapter=eda; - spooledFileViewer1.addErrorListener(eda); - } - /** Required implementantion of the QCServiceClient interface. Releases the - * AS400 object provided by the server. - * @param sr The service record which represents the AS400 to be - * relinquished. - */ - public void relinquish(QCServiceRecord sr) { - serviceRecord = null; - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSpooledFileViewerPanelBeanInfo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSpooledFileViewerPanelBeanInfo.java deleted file mode 100644 index 4c17f866c..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCSpooledFileViewerPanelBeanInfo.java +++ /dev/null @@ -1,315 +0,0 @@ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.beans.*; - -public class QCSpooledFileViewerPanelBeanInfo extends SimpleBeanInfo { - - // Property identifiers //GEN-FIRST:Properties - private static final int PROPERTY_optimizedDrawingEnabled = 0; - private static final int PROPERTY_colorModel = 1; - private static final int PROPERTY_minimumSize = 2; - private static final int PROPERTY_visible = 3; - private static final int PROPERTY_toolkit = 4; - private static final int PROPERTY_displayable = 5; - private static final int PROPERTY_opaque = 6; - private static final int PROPERTY_requestFocusEnabled = 7; - private static final int PROPERTY_enabled = 8; - private static final int PROPERTY_autoscrolls = 9; - private static final int PROPERTY_y = 10; - private static final int PROPERTY_x = 11; - private static final int PROPERTY_accessibleContext = 12; - private static final int PROPERTY_componentOrientation = 13; - private static final int PROPERTY_components = 14; - private static final int PROPERTY_managingFocus = 15; - private static final int PROPERTY_inputMethodRequests = 16; - private static final int PROPERTY_border = 17; - private static final int PROPERTY_locale = 18; - private static final int PROPERTY_insets = 19; - private static final int PROPERTY_UIClassID = 20; - private static final int PROPERTY_graphics = 21; - private static final int PROPERTY_minimumSizeSet = 22; - private static final int PROPERTY_actionMap = 23; - private static final int PROPERTY_maximumSizeSet = 24; - private static final int PROPERTY_alignmentY = 25; - private static final int PROPERTY_alignmentX = 26; - private static final int PROPERTY_locationOnScreen = 27; - private static final int PROPERTY_cursor = 28; - private static final int PROPERTY_registeredKeyStrokes = 29; - private static final int PROPERTY_preferredSizeSet = 30; - private static final int PROPERTY_visibleRect = 31; - private static final int PROPERTY_bounds = 32; - private static final int PROPERTY_inputContext = 33; - private static final int PROPERTY_class = 34; - private static final int PROPERTY_focusTraversable = 35; - private static final int PROPERTY_font = 36; - private static final int PROPERTY_inputVerifier = 37; - private static final int PROPERTY_lightweight = 38; - private static final int PROPERTY_paintingTile = 39; - private static final int PROPERTY_maximumSize = 40; - private static final int PROPERTY_layout = 41; - private static final int PROPERTY_treeLock = 42; - private static final int PROPERTY_verifyInputWhenFocusTarget = 43; - private static final int PROPERTY_foreground = 44; - private static final int PROPERTY_preferredSize = 45; - private static final int PROPERTY_debugGraphicsOptions = 46; - private static final int PROPERTY_doubleBuffered = 47; - private static final int PROPERTY_showing = 48; - private static final int PROPERTY_nextFocusableComponent = 49; - private static final int PROPERTY_parent = 50; - private static final int PROPERTY_peer = 51; - private static final int PROPERTY_componentCount = 52; - private static final int PROPERTY_manager = 53; - private static final int PROPERTY_graphicsConfiguration = 54; - private static final int PROPERTY_height = 55; - private static final int PROPERTY_valid = 56; - private static final int PROPERTY_focusCycleRoot = 57; - private static final int PROPERTY_width = 58; - private static final int PROPERTY_toolTipText = 59; - private static final int PROPERTY_background = 60; - private static final int PROPERTY_validateRoot = 61; - private static final int PROPERTY_topLevelAncestor = 62; - private static final int PROPERTY_dropTarget = 63; - private static final int PROPERTY_rootPane = 64; - private static final int PROPERTY_name = 65; - private static final int PROPERTY_component = 66; - - // Property array - private static PropertyDescriptor[] properties = new PropertyDescriptor[67]; - - static { - try { - properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor ( "optimizedDrawingEnabled", QCSpooledFileViewerPanel.class, "isOptimizedDrawingEnabled", null ); - properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", QCSpooledFileViewerPanel.class, "getColorModel", null ); - properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", QCSpooledFileViewerPanel.class, "getMinimumSize", "setMinimumSize" ); - properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", QCSpooledFileViewerPanel.class, "isVisible", "setVisible" ); - properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", QCSpooledFileViewerPanel.class, "getToolkit", null ); - properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", QCSpooledFileViewerPanel.class, "isDisplayable", null ); - properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", QCSpooledFileViewerPanel.class, "isOpaque", "setOpaque" ); - properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor ( "requestFocusEnabled", QCSpooledFileViewerPanel.class, "isRequestFocusEnabled", "setRequestFocusEnabled" ); - properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", QCSpooledFileViewerPanel.class, "isEnabled", "setEnabled" ); - properties[PROPERTY_autoscrolls] = new PropertyDescriptor ( "autoscrolls", QCSpooledFileViewerPanel.class, "getAutoscrolls", "setAutoscrolls" ); - properties[PROPERTY_y] = new PropertyDescriptor ( "y", QCSpooledFileViewerPanel.class, "getY", null ); - properties[PROPERTY_x] = new PropertyDescriptor ( "x", QCSpooledFileViewerPanel.class, "getX", null ); - properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", QCSpooledFileViewerPanel.class, "getAccessibleContext", null ); - properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", QCSpooledFileViewerPanel.class, "getComponentOrientation", "setComponentOrientation" ); - properties[PROPERTY_components] = new PropertyDescriptor ( "components", QCSpooledFileViewerPanel.class, "getComponents", null ); - properties[PROPERTY_managingFocus] = new PropertyDescriptor ( "managingFocus", QCSpooledFileViewerPanel.class, "isManagingFocus", null ); - properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", QCSpooledFileViewerPanel.class, "getInputMethodRequests", null ); - properties[PROPERTY_border] = new PropertyDescriptor ( "border", QCSpooledFileViewerPanel.class, "getBorder", "setBorder" ); - properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", QCSpooledFileViewerPanel.class, "getLocale", "setLocale" ); - properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", QCSpooledFileViewerPanel.class, "getInsets", null ); - properties[PROPERTY_UIClassID] = new PropertyDescriptor ( "UIClassID", QCSpooledFileViewerPanel.class, "getUIClassID", null ); - properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", QCSpooledFileViewerPanel.class, "getGraphics", null ); - properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor ( "minimumSizeSet", QCSpooledFileViewerPanel.class, "isMinimumSizeSet", null ); - properties[PROPERTY_actionMap] = new PropertyDescriptor ( "actionMap", QCSpooledFileViewerPanel.class, "getActionMap", "setActionMap" ); - properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor ( "maximumSizeSet", QCSpooledFileViewerPanel.class, "isMaximumSizeSet", null ); - properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", QCSpooledFileViewerPanel.class, "getAlignmentY", "setAlignmentY" ); - properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", QCSpooledFileViewerPanel.class, "getAlignmentX", "setAlignmentX" ); - properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", QCSpooledFileViewerPanel.class, "getLocationOnScreen", null ); - properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", QCSpooledFileViewerPanel.class, "getCursor", "setCursor" ); - properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor ( "registeredKeyStrokes", QCSpooledFileViewerPanel.class, "getRegisteredKeyStrokes", null ); - properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor ( "preferredSizeSet", QCSpooledFileViewerPanel.class, "isPreferredSizeSet", null ); - properties[PROPERTY_visibleRect] = new PropertyDescriptor ( "visibleRect", QCSpooledFileViewerPanel.class, "getVisibleRect", null ); - properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", QCSpooledFileViewerPanel.class, "getBounds", "setBounds" ); - properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", QCSpooledFileViewerPanel.class, "getInputContext", null ); - properties[PROPERTY_class] = new PropertyDescriptor ( "class", QCSpooledFileViewerPanel.class, "getClass", null ); - properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", QCSpooledFileViewerPanel.class, "isFocusTraversable", null ); - properties[PROPERTY_font] = new PropertyDescriptor ( "font", QCSpooledFileViewerPanel.class, "getFont", "setFont" ); - properties[PROPERTY_inputVerifier] = new PropertyDescriptor ( "inputVerifier", QCSpooledFileViewerPanel.class, "getInputVerifier", "setInputVerifier" ); - properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", QCSpooledFileViewerPanel.class, "isLightweight", null ); - properties[PROPERTY_paintingTile] = new PropertyDescriptor ( "paintingTile", QCSpooledFileViewerPanel.class, "isPaintingTile", null ); - properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", QCSpooledFileViewerPanel.class, "getMaximumSize", "setMaximumSize" ); - properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", QCSpooledFileViewerPanel.class, "getLayout", "setLayout" ); - properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", QCSpooledFileViewerPanel.class, "getTreeLock", null ); - properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor ( "verifyInputWhenFocusTarget", QCSpooledFileViewerPanel.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget" ); - properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", QCSpooledFileViewerPanel.class, "getForeground", "setForeground" ); - properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", QCSpooledFileViewerPanel.class, "getPreferredSize", "setPreferredSize" ); - properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor ( "debugGraphicsOptions", QCSpooledFileViewerPanel.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions" ); - properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", QCSpooledFileViewerPanel.class, "isDoubleBuffered", "setDoubleBuffered" ); - properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", QCSpooledFileViewerPanel.class, "isShowing", null ); - properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor ( "nextFocusableComponent", QCSpooledFileViewerPanel.class, "getNextFocusableComponent", "setNextFocusableComponent" ); - properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", QCSpooledFileViewerPanel.class, "getParent", null ); - properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", QCSpooledFileViewerPanel.class, "getPeer", null ); - properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", QCSpooledFileViewerPanel.class, "getComponentCount", null ); - properties[PROPERTY_manager] = new PropertyDescriptor ( "manager", QCSpooledFileViewerPanel.class, null, "setManager" ); - properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", QCSpooledFileViewerPanel.class, "getGraphicsConfiguration", null ); - properties[PROPERTY_height] = new PropertyDescriptor ( "height", QCSpooledFileViewerPanel.class, "getHeight", null ); - properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", QCSpooledFileViewerPanel.class, "isValid", null ); - properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor ( "focusCycleRoot", QCSpooledFileViewerPanel.class, "isFocusCycleRoot", null ); - properties[PROPERTY_width] = new PropertyDescriptor ( "width", QCSpooledFileViewerPanel.class, "getWidth", null ); - properties[PROPERTY_toolTipText] = new PropertyDescriptor ( "toolTipText", QCSpooledFileViewerPanel.class, "getToolTipText", "setToolTipText" ); - properties[PROPERTY_background] = new PropertyDescriptor ( "background", QCSpooledFileViewerPanel.class, "getBackground", "setBackground" ); - properties[PROPERTY_validateRoot] = new PropertyDescriptor ( "validateRoot", QCSpooledFileViewerPanel.class, "isValidateRoot", null ); - properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor ( "topLevelAncestor", QCSpooledFileViewerPanel.class, "getTopLevelAncestor", null ); - properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", QCSpooledFileViewerPanel.class, "getDropTarget", "setDropTarget" ); - properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", QCSpooledFileViewerPanel.class, "getRootPane", null ); - properties[PROPERTY_name] = new PropertyDescriptor ( "name", QCSpooledFileViewerPanel.class, "getName", "setName" ); - properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", QCSpooledFileViewerPanel.class, null, null, "getComponent", null ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Properties - - // Here you can add code for customizing the properties array. - -}//GEN-LAST:Properties - - // EventSet identifiers//GEN-FIRST:Events - private static final int EVENT_mouseMotionListener = 0; - private static final int EVENT_ancestorListener = 1; - private static final int EVENT_inputMethodListener = 2; - private static final int EVENT_componentListener = 3; - private static final int EVENT_hierarchyBoundsListener = 4; - private static final int EVENT_mouseListener = 5; - private static final int EVENT_focusListener = 6; - private static final int EVENT_propertyChangeListener = 7; - private static final int EVENT_keyListener = 8; - private static final int EVENT_hierarchyListener = 9; - private static final int EVENT_containerListener = 10; - private static final int EVENT_vetoableChangeListener = 11; - - // EventSet array - private static EventSetDescriptor[] eventSets = new EventSetDescriptor[12]; - - static { - try { - eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( QCSpooledFileViewerPanel.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[0], "addMouseMotionListener", "removeMouseMotionListener" ); - eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( QCSpooledFileViewerPanel.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[0], "addAncestorListener", "removeAncestorListener" ); - eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( QCSpooledFileViewerPanel.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[0], "addInputMethodListener", "removeInputMethodListener" ); - eventSets[EVENT_componentListener] = new EventSetDescriptor ( QCSpooledFileViewerPanel.class, "componentListener", java.awt.event.ComponentListener.class, new String[0], "addComponentListener", "removeComponentListener" ); - eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( QCSpooledFileViewerPanel.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[0], "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); - eventSets[EVENT_mouseListener] = new EventSetDescriptor ( QCSpooledFileViewerPanel.class, "mouseListener", java.awt.event.MouseListener.class, new String[0], "addMouseListener", "removeMouseListener" ); - eventSets[EVENT_focusListener] = new EventSetDescriptor ( QCSpooledFileViewerPanel.class, "focusListener", java.awt.event.FocusListener.class, new String[0], "addFocusListener", "removeFocusListener" ); - eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( QCSpooledFileViewerPanel.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[0], "addPropertyChangeListener", "removePropertyChangeListener" ); - eventSets[EVENT_keyListener] = new EventSetDescriptor ( QCSpooledFileViewerPanel.class, "keyListener", java.awt.event.KeyListener.class, new String[0], "addKeyListener", "removeKeyListener" ); - eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( QCSpooledFileViewerPanel.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[0], "addHierarchyListener", "removeHierarchyListener" ); - eventSets[EVENT_containerListener] = new EventSetDescriptor ( QCSpooledFileViewerPanel.class, "containerListener", java.awt.event.ContainerListener.class, new String[0], "addContainerListener", "removeContainerListener" ); - eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( QCSpooledFileViewerPanel.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[0], "addVetoableChangeListener", "removeVetoableChangeListener" ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Events - - // Here you can add code for customizing the event sets array. - -}//GEN-LAST:Events - - private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef - private static java.awt.Image iconColor32 = null; - private static java.awt.Image iconMono16 = null; - private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef - private static String iconNameC16 = null;//GEN-BEGIN:Icons - private static String iconNameC32 = null; - private static String iconNameM16 = null; - private static String iconNameM32 = null;//GEN-END:Icons - - private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx - private static int defaultEventIndex = -1;//GEN-END:Idx - - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

- * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } - - /** - * Gets the beans EventSetDescriptors. - * - * @return An array of EventSetDescriptors describing the kinds of - * events fired by this bean. May return null if the information - * should be obtained by automatic analysis. - */ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSets; - } - - /** - * A bean may have a "default" property that is the property that will - * mostly commonly be initially chosen for update by human's who are - * customizing the bean. - * @return Index of default property in the PropertyDescriptor array - * returned by getPropertyDescriptors. - *

Returns -1 if there is no default property. - */ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** - * A bean may have a "default" event that is the event that will - * mostly commonly be used by human's when using the bean. - * @return Index of default event in the EventSetDescriptor array - * returned by getEventSetDescriptors. - *

Returns -1 if there is no default event. - */ - public int getDefaultEventIndex() { - return defaultPropertyIndex; - } - - /** - * This method returns an image object that can be used to - * represent the bean in toolboxes, toolbars, etc. Icon images - * will typically be GIFs, but may in future include other formats. - *

- * Beans aren't required to provide icons and may return null from - * this method. - *

- * There are four possible flavors of icons (16x16 color, - * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only - * support a single icon we recommend supporting 16x16 color. - *

- * We recommend that icons have a "transparent" background - * so they can be rendered onto an existing background. - * - * @param iconKind The kind of icon requested. This should be - * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, - * ICON_MONO_16x16, or ICON_MONO_32x32. - * @return An image object representing the requested icon. May - * return null if no suitable icon is available. - */ - public java.awt.Image getIcon(int iconKind) { - switch ( iconKind ) { - case ICON_COLOR_16x16: - if ( iconNameC16 == null ) - return null; - else { - if( iconColor16 == null ) - iconColor16 = loadImage( iconNameC16 ); - return iconColor16; - } - case ICON_COLOR_32x32: - if ( iconNameC32 == null ) - return null; - else { - if( iconColor32 == null ) - iconColor32 = loadImage( iconNameC32 ); - return iconColor32; - } - case ICON_MONO_16x16: - if ( iconNameM16 == null ) - return null; - else { - if( iconMono16 == null ) - iconMono16 = loadImage( iconNameM16 ); - return iconMono16; - } - case ICON_MONO_32x32: - if ( iconNameM32 == null ) - return null; - else { - if( iconNameM32 == null ) - iconMono32 = loadImage( iconNameM32 ); - return iconMono32; - } - } - return null; - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCTopFrame.form b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCTopFrame.form deleted file mode 100644 index 4f8d6faa0..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCTopFrame.form +++ /dev/null @@ -1,54 +0,0 @@ - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCTopFrame.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCTopFrame.java deleted file mode 100644 index 7816521bc..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCTopFrame.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * QCTopFrame.java - * - * Created on July 15, 2000, 9:24 PM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** The top-level frame for the QCDemo. - * @author jax - * @version 1.0 - */ -public class QCTopFrame extends javax.swing.JFrame { - - /** Error dialog for the as400 vaccess classes to share. - */ - public com.ibm.as400.vaccess.ErrorDialogAdapter errorDialogAdapter; - - /** Creates new form QCTopFrame */ - public QCTopFrame() { - initComponents (); - pack (); - initStuff(); - initMenus(); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the FormEditor. - */ - private void initComponents () {//GEN-BEGIN:initComponents - fileMenuBar = new javax.swing.JMenuBar (); - fileMenu = new javax.swing.JMenu (); - qCNotebookPanel1 = new com.SoftWoehr.JTOpenContrib.QCDemo.QCNotebookPanel (); - - fileMenu.setText ("File"); - - fileMenuBar.add (fileMenu); - setTitle ("SoftWoehr QCDemo 1.0"); - addWindowListener (new java.awt.event.WindowAdapter () { - public void windowClosing (java.awt.event.WindowEvent evt) { - exitForm (evt); - } - } - ); - - qCNotebookPanel1.setPreferredSize (new java.awt.Dimension(600, 500)); - - - getContentPane ().add (qCNotebookPanel1, java.awt.BorderLayout.CENTER); - - setJMenuBar (fileMenuBar); - - }//GEN-END:initComponents - - /** Exit the Application */ - private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm - System.exit (0); - }//GEN-LAST:event_exitForm - - /** Run QCDemo. - * @param args the command line arguments - */ - public static void main (String args[]) { - new QCTopFrame ().show (); - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JMenuBar fileMenuBar; - private javax.swing.JMenu fileMenu; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCNotebookPanel qCNotebookPanel1; - // End of variables declaration//GEN-END:variables - - private void initStuff () { - errorDialogAdapter = new com.ibm.as400.vaccess.ErrorDialogAdapter(this); - qCNotebookPanel1.propagateEDA(errorDialogAdapter); - } - - private void initMenus () { - javax.swing.JMenuItem exitItem = new javax.swing.JMenuItem("Exit", java.awt.event.KeyEvent.VK_X); - javax.swing.JMenuItem aboutItem = new javax.swing.JMenuItem("About", java.awt.event.KeyEvent.VK_A); - exitItem.addActionListener(new java.awt.event.ActionListener () { - public void actionPerformed(java.awt.event.ActionEvent a) { - System.exit(0); - } - }); - aboutItem.addActionListener(new java.awt.event.ActionListener () { - public void actionPerformed(java.awt.event.ActionEvent a) { - javax.swing.JOptionPane.showMessageDialog(null, "SoftWoehr QCDemo 1.0\nCopyright *C* 2000, Jack J. Woehr jax@well.com http://www.well.com/user/jax/SoftWoehr\nCopyright *C* 2000 International Business Machines Corporation and others. All Rights Reserved.", "About QCDemo 1.0", javax.swing.JOptionPane.INFORMATION_MESSAGE); - } - }); - fileMenu.add(exitItem); - fileMenu.add(aboutItem); - } - - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCTopFrameBeanInfo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCTopFrameBeanInfo.java deleted file mode 100644 index 5dff91e72..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCTopFrameBeanInfo.java +++ /dev/null @@ -1,299 +0,0 @@ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.beans.*; - -public class QCTopFrameBeanInfo extends SimpleBeanInfo { - - // Property identifiers //GEN-FIRST:Properties - private static final int PROPERTY_x = 0; - private static final int PROPERTY_owner = 1; - private static final int PROPERTY_background = 2; - private static final int PROPERTY_rootPane = 3; - private static final int PROPERTY_dropTarget = 4; - private static final int PROPERTY_graphics = 5; - private static final int PROPERTY_name = 6; - private static final int PROPERTY_locationOnScreen = 7; - private static final int PROPERTY_bounds = 8; - private static final int PROPERTY_components = 9; - private static final int PROPERTY_layout = 10; - private static final int PROPERTY_JMenuBar = 11; - private static final int PROPERTY_glassPane = 12; - private static final int PROPERTY_accessibleContext = 13; - private static final int PROPERTY_defaultCloseOperation = 14; - private static final int PROPERTY_font = 15; - private static final int PROPERTY_cursorType = 16; - private static final int PROPERTY_cursor = 17; - private static final int PROPERTY_preferredSize = 18; - private static final int PROPERTY_focusTraversable = 19; - private static final int PROPERTY_width = 20; - private static final int PROPERTY_iconImage = 21; - private static final int PROPERTY_maximumSize = 22; - private static final int PROPERTY_enabled = 23; - private static final int PROPERTY_treeLock = 24; - private static final int PROPERTY_ownedWindows = 25; - private static final int PROPERTY_visible = 26; - private static final int PROPERTY_insets = 27; - private static final int PROPERTY_resizable = 28; - private static final int PROPERTY_contentPane = 29; - private static final int PROPERTY_state = 30; - private static final int PROPERTY_title = 31; - private static final int PROPERTY_lightweight = 32; - private static final int PROPERTY_componentCount = 33; - private static final int PROPERTY_menuBar = 34; - private static final int PROPERTY_parent = 35; - private static final int PROPERTY_componentOrientation = 36; - private static final int PROPERTY_opaque = 37; - private static final int PROPERTY_showing = 38; - private static final int PROPERTY_inputContext = 39; - private static final int PROPERTY_locale = 40; - private static final int PROPERTY_valid = 41; - private static final int PROPERTY_foreground = 42; - private static final int PROPERTY_colorModel = 43; - private static final int PROPERTY_warningString = 44; - private static final int PROPERTY_doubleBuffered = 45; - private static final int PROPERTY_class = 46; - private static final int PROPERTY_layeredPane = 47; - private static final int PROPERTY_minimumSize = 48; - private static final int PROPERTY_toolkit = 49; - private static final int PROPERTY_peer = 50; - private static final int PROPERTY_inputMethodRequests = 51; - private static final int PROPERTY_height = 52; - private static final int PROPERTY_displayable = 53; - private static final int PROPERTY_alignmentY = 54; - private static final int PROPERTY_graphicsConfiguration = 55; - private static final int PROPERTY_alignmentX = 56; - private static final int PROPERTY_focusOwner = 57; - private static final int PROPERTY_y = 58; - private static final int PROPERTY_component = 59; - - // Property array - private static PropertyDescriptor[] properties = new PropertyDescriptor[60]; - - static { - try { - properties[PROPERTY_x] = new PropertyDescriptor ( "x", QCTopFrame.class, "getX", null ); - properties[PROPERTY_owner] = new PropertyDescriptor ( "owner", QCTopFrame.class, "getOwner", null ); - properties[PROPERTY_background] = new PropertyDescriptor ( "background", QCTopFrame.class, "getBackground", "setBackground" ); - properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", QCTopFrame.class, "getRootPane", null ); - properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", QCTopFrame.class, "getDropTarget", "setDropTarget" ); - properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", QCTopFrame.class, "getGraphics", null ); - properties[PROPERTY_name] = new PropertyDescriptor ( "name", QCTopFrame.class, "getName", "setName" ); - properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", QCTopFrame.class, "getLocationOnScreen", null ); - properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", QCTopFrame.class, "getBounds", "setBounds" ); - properties[PROPERTY_components] = new PropertyDescriptor ( "components", QCTopFrame.class, "getComponents", null ); - properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", QCTopFrame.class, "getLayout", "setLayout" ); - properties[PROPERTY_JMenuBar] = new PropertyDescriptor ( "JMenuBar", QCTopFrame.class, "getJMenuBar", "setJMenuBar" ); - properties[PROPERTY_glassPane] = new PropertyDescriptor ( "glassPane", QCTopFrame.class, "getGlassPane", "setGlassPane" ); - properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", QCTopFrame.class, "getAccessibleContext", null ); - properties[PROPERTY_defaultCloseOperation] = new PropertyDescriptor ( "defaultCloseOperation", QCTopFrame.class, "getDefaultCloseOperation", "setDefaultCloseOperation" ); - properties[PROPERTY_font] = new PropertyDescriptor ( "font", QCTopFrame.class, "getFont", "setFont" ); - properties[PROPERTY_cursorType] = new PropertyDescriptor ( "cursorType", QCTopFrame.class, "getCursorType", null ); - properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", QCTopFrame.class, "getCursor", "setCursor" ); - properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", QCTopFrame.class, "getPreferredSize", null ); - properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", QCTopFrame.class, "isFocusTraversable", null ); - properties[PROPERTY_width] = new PropertyDescriptor ( "width", QCTopFrame.class, "getWidth", null ); - properties[PROPERTY_iconImage] = new PropertyDescriptor ( "iconImage", QCTopFrame.class, "getIconImage", "setIconImage" ); - properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", QCTopFrame.class, "getMaximumSize", null ); - properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", QCTopFrame.class, "isEnabled", "setEnabled" ); - properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", QCTopFrame.class, "getTreeLock", null ); - properties[PROPERTY_ownedWindows] = new PropertyDescriptor ( "ownedWindows", QCTopFrame.class, "getOwnedWindows", null ); - properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", QCTopFrame.class, "isVisible", "setVisible" ); - properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", QCTopFrame.class, "getInsets", null ); - properties[PROPERTY_resizable] = new PropertyDescriptor ( "resizable", QCTopFrame.class, "isResizable", "setResizable" ); - properties[PROPERTY_contentPane] = new PropertyDescriptor ( "contentPane", QCTopFrame.class, "getContentPane", "setContentPane" ); - properties[PROPERTY_state] = new PropertyDescriptor ( "state", QCTopFrame.class, "getState", "setState" ); - properties[PROPERTY_title] = new PropertyDescriptor ( "title", QCTopFrame.class, "getTitle", "setTitle" ); - properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", QCTopFrame.class, "isLightweight", null ); - properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", QCTopFrame.class, "getComponentCount", null ); - properties[PROPERTY_menuBar] = new PropertyDescriptor ( "menuBar", QCTopFrame.class, "getMenuBar", "setMenuBar" ); - properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", QCTopFrame.class, "getParent", null ); - properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", QCTopFrame.class, "getComponentOrientation", "setComponentOrientation" ); - properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", QCTopFrame.class, "isOpaque", null ); - properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", QCTopFrame.class, "isShowing", null ); - properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", QCTopFrame.class, "getInputContext", null ); - properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", QCTopFrame.class, "getLocale", "setLocale" ); - properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", QCTopFrame.class, "isValid", null ); - properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", QCTopFrame.class, "getForeground", "setForeground" ); - properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", QCTopFrame.class, "getColorModel", null ); - properties[PROPERTY_warningString] = new PropertyDescriptor ( "warningString", QCTopFrame.class, "getWarningString", null ); - properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", QCTopFrame.class, "isDoubleBuffered", null ); - properties[PROPERTY_class] = new PropertyDescriptor ( "class", QCTopFrame.class, "getClass", null ); - properties[PROPERTY_layeredPane] = new PropertyDescriptor ( "layeredPane", QCTopFrame.class, "getLayeredPane", "setLayeredPane" ); - properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", QCTopFrame.class, "getMinimumSize", null ); - properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", QCTopFrame.class, "getToolkit", null ); - properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", QCTopFrame.class, "getPeer", null ); - properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", QCTopFrame.class, "getInputMethodRequests", null ); - properties[PROPERTY_height] = new PropertyDescriptor ( "height", QCTopFrame.class, "getHeight", null ); - properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", QCTopFrame.class, "isDisplayable", null ); - properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", QCTopFrame.class, "getAlignmentY", null ); - properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", QCTopFrame.class, "getGraphicsConfiguration", null ); - properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", QCTopFrame.class, "getAlignmentX", null ); - properties[PROPERTY_focusOwner] = new PropertyDescriptor ( "focusOwner", QCTopFrame.class, "getFocusOwner", null ); - properties[PROPERTY_y] = new PropertyDescriptor ( "y", QCTopFrame.class, "getY", null ); - properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", QCTopFrame.class, null, null, "getComponent", null ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Properties - - // Here you can add code for customizing the properties array. - -}//GEN-LAST:Properties - - // EventSet identifiers//GEN-FIRST:Events - private static final int EVENT_mouseMotionListener = 0; - private static final int EVENT_inputMethodListener = 1; - private static final int EVENT_componentListener = 2; - private static final int EVENT_hierarchyBoundsListener = 3; - private static final int EVENT_mouseListener = 4; - private static final int EVENT_focusListener = 5; - private static final int EVENT_propertyChangeListener = 6; - private static final int EVENT_windowListener = 7; - private static final int EVENT_keyListener = 8; - private static final int EVENT_hierarchyListener = 9; - private static final int EVENT_containerListener = 10; - - // EventSet array - private static EventSetDescriptor[] eventSets = new EventSetDescriptor[11]; - - static { - try { - eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( QCTopFrame.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[0], "addMouseMotionListener", "removeMouseMotionListener" ); - eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( QCTopFrame.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[0], "addInputMethodListener", "removeInputMethodListener" ); - eventSets[EVENT_componentListener] = new EventSetDescriptor ( QCTopFrame.class, "componentListener", java.awt.event.ComponentListener.class, new String[0], "addComponentListener", "removeComponentListener" ); - eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( QCTopFrame.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[0], "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); - eventSets[EVENT_mouseListener] = new EventSetDescriptor ( QCTopFrame.class, "mouseListener", java.awt.event.MouseListener.class, new String[0], "addMouseListener", "removeMouseListener" ); - eventSets[EVENT_focusListener] = new EventSetDescriptor ( QCTopFrame.class, "focusListener", java.awt.event.FocusListener.class, new String[0], "addFocusListener", "removeFocusListener" ); - eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( QCTopFrame.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[0], "addPropertyChangeListener", "removePropertyChangeListener" ); - eventSets[EVENT_windowListener] = new EventSetDescriptor ( QCTopFrame.class, "windowListener", java.awt.event.WindowListener.class, new String[0], "addWindowListener", "removeWindowListener" ); - eventSets[EVENT_keyListener] = new EventSetDescriptor ( QCTopFrame.class, "keyListener", java.awt.event.KeyListener.class, new String[0], "addKeyListener", "removeKeyListener" ); - eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( QCTopFrame.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[0], "addHierarchyListener", "removeHierarchyListener" ); - eventSets[EVENT_containerListener] = new EventSetDescriptor ( QCTopFrame.class, "containerListener", java.awt.event.ContainerListener.class, new String[0], "addContainerListener", "removeContainerListener" ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Events - - // Here you can add code for customizing the event sets array. - -}//GEN-LAST:Events - - private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef - private static java.awt.Image iconColor32 = null; - private static java.awt.Image iconMono16 = null; - private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef - private static String iconNameC16 = null;//GEN-BEGIN:Icons - private static String iconNameC32 = null; - private static String iconNameM16 = null; - private static String iconNameM32 = null;//GEN-END:Icons - - private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx - private static int defaultEventIndex = -1;//GEN-END:Idx - - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

- * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } - - /** - * Gets the beans EventSetDescriptors. - * - * @return An array of EventSetDescriptors describing the kinds of - * events fired by this bean. May return null if the information - * should be obtained by automatic analysis. - */ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSets; - } - - /** - * A bean may have a "default" property that is the property that will - * mostly commonly be initially chosen for update by human's who are - * customizing the bean. - * @return Index of default property in the PropertyDescriptor array - * returned by getPropertyDescriptors. - *

Returns -1 if there is no default property. - */ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** - * A bean may have a "default" event that is the event that will - * mostly commonly be used by human's when using the bean. - * @return Index of default event in the EventSetDescriptor array - * returned by getEventSetDescriptors. - *

Returns -1 if there is no default event. - */ - public int getDefaultEventIndex() { - return defaultPropertyIndex; - } - - /** - * This method returns an image object that can be used to - * represent the bean in toolboxes, toolbars, etc. Icon images - * will typically be GIFs, but may in future include other formats. - *

- * Beans aren't required to provide icons and may return null from - * this method. - *

- * There are four possible flavors of icons (16x16 color, - * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only - * support a single icon we recommend supporting 16x16 color. - *

- * We recommend that icons have a "transparent" background - * so they can be rendered onto an existing background. - * - * @param iconKind The kind of icon requested. This should be - * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, - * ICON_MONO_16x16, or ICON_MONO_32x32. - * @return An image object representing the requested icon. May - * return null if no suitable icon is available. - */ - public java.awt.Image getIcon(int iconKind) { - switch ( iconKind ) { - case ICON_COLOR_16x16: - if ( iconNameC16 == null ) - return null; - else { - if( iconColor16 == null ) - iconColor16 = loadImage( iconNameC16 ); - return iconColor16; - } - case ICON_COLOR_32x32: - if ( iconNameC32 == null ) - return null; - else { - if( iconColor32 == null ) - iconColor32 = loadImage( iconNameC32 ); - return iconColor32; - } - case ICON_MONO_16x16: - if ( iconNameM16 == null ) - return null; - else { - if( iconMono16 == null ) - iconMono16 = loadImage( iconNameM16 ); - return iconMono16; - } - case ICON_MONO_32x32: - if ( iconNameM32 == null ) - return null; - else { - if( iconNameM32 == null ) - iconMono32 = loadImage( iconNameM32 ); - return iconMono32; - } - } - return null; - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCTreePane.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCTreePane.java deleted file mode 100644 index 3c9109ad2..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCTreePane.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * QCTreePane.java - * - * A wrapper around com.ibm.as400.vaccess.AS400TreePane to - * allow us to polymorphically switch panes in a panel. - * - * Created on July 16, 2000, 2:06 AM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** A wrapper around a JTOpen pane type to allow polymorphism. - * @author jax - * @version 1.0 - */ -public class QCTreePane extends com.ibm.as400.vaccess.AS400TreePane implements QCVNodeDisplayer { - - /** Creates new QCExplorer */ - public QCTreePane() { - } - - /** Sets the node as root for the pane. - * @param v The VNode to be setRoot by the pane. - */ - public void setRoot(com.ibm.as400.vaccess.VNode v) { - try { - super.setRoot(v); - } - catch (java.beans.PropertyVetoException e) { - e.printStackTrace(); - } - } - - /** Add the pane to the Container. - * @param c The Container to be added to. - */ - public void addTo(java.awt.Container c) { - c.add(this); - } - - /** Add error dialog as listener. - * @param eda The ErrorDialogAdapter to add. - */ - public void addErrorListener(com.ibm.as400.vaccess.ErrorDialogAdapter eda) { - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCTreePaneBeanInfo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCTreePaneBeanInfo.java deleted file mode 100644 index db441c98a..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCTreePaneBeanInfo.java +++ /dev/null @@ -1,333 +0,0 @@ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.beans.*; - -public class QCTreePaneBeanInfo extends SimpleBeanInfo { - - // Property identifiers //GEN-FIRST:Properties - private static final int PROPERTY_nextFocusableComponent = 0; - private static final int PROPERTY_validateRoot = 1; - private static final int PROPERTY_font = 2; - private static final int PROPERTY_selectionModel = 3; - private static final int PROPERTY_colorModel = 4; - private static final int PROPERTY_selectedObject = 5; - private static final int PROPERTY_alignmentY = 6; - private static final int PROPERTY_alignmentX = 7; - private static final int PROPERTY_y = 8; - private static final int PROPERTY_x = 9; - private static final int PROPERTY_accessibleContext = 10; - private static final int PROPERTY_layout = 11; - private static final int PROPERTY_preferredSize = 12; - private static final int PROPERTY_inputMethodRequests = 13; - private static final int PROPERTY_verifyInputWhenFocusTarget = 14; - private static final int PROPERTY_toolkit = 15; - private static final int PROPERTY_displayable = 16; - private static final int PROPERTY_class = 17; - private static final int PROPERTY_root = 18; - private static final int PROPERTY_autoscrolls = 19; - private static final int PROPERTY_insets = 20; - private static final int PROPERTY_cursor = 21; - private static final int PROPERTY_showing = 22; - private static final int PROPERTY_model = 23; - private static final int PROPERTY_preferredSizeSet = 24; - private static final int PROPERTY_components = 25; - private static final int PROPERTY_focusTraversable = 26; - private static final int PROPERTY_visible = 27; - private static final int PROPERTY_background = 28; - private static final int PROPERTY_UIClassID = 29; - private static final int PROPERTY_graphicsConfiguration = 30; - private static final int PROPERTY_inputContext = 31; - private static final int PROPERTY_registeredKeyStrokes = 32; - private static final int PROPERTY_valid = 33; - private static final int PROPERTY_locale = 34; - private static final int PROPERTY_componentOrientation = 35; - private static final int PROPERTY_graphics = 36; - private static final int PROPERTY_peer = 37; - private static final int PROPERTY_locationOnScreen = 38; - private static final int PROPERTY_name = 39; - private static final int PROPERTY_foreground = 40; - private static final int PROPERTY_actionMap = 41; - private static final int PROPERTY_topLevelAncestor = 42; - private static final int PROPERTY_paintingTile = 43; - private static final int PROPERTY_focusCycleRoot = 44; - private static final int PROPERTY_enabled = 45; - private static final int PROPERTY_lightweight = 46; - private static final int PROPERTY_dropTarget = 47; - private static final int PROPERTY_opaque = 48; - private static final int PROPERTY_componentCount = 49; - private static final int PROPERTY_maximumSizeSet = 50; - private static final int PROPERTY_confirm = 51; - private static final int PROPERTY_toolTipText = 52; - private static final int PROPERTY_height = 53; - private static final int PROPERTY_doubleBuffered = 54; - private static final int PROPERTY_border = 55; - private static final int PROPERTY_minimumSizeSet = 56; - private static final int PROPERTY_actionContext = 57; - private static final int PROPERTY_treeLock = 58; - private static final int PROPERTY_width = 59; - private static final int PROPERTY_managingFocus = 60; - private static final int PROPERTY_maximumSize = 61; - private static final int PROPERTY_minimumSize = 62; - private static final int PROPERTY_allowActions = 63; - private static final int PROPERTY_visibleRect = 64; - private static final int PROPERTY_debugGraphicsOptions = 65; - private static final int PROPERTY_optimizedDrawingEnabled = 66; - private static final int PROPERTY_requestFocusEnabled = 67; - private static final int PROPERTY_parent = 68; - private static final int PROPERTY_inputVerifier = 69; - private static final int PROPERTY_rootPane = 70; - private static final int PROPERTY_bounds = 71; - private static final int PROPERTY_selectedObjects = 72; - private static final int PROPERTY_component = 73; - - // Property array - private static PropertyDescriptor[] properties = new PropertyDescriptor[74]; - - static { - try { - properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor ( "nextFocusableComponent", QCTreePane.class, "getNextFocusableComponent", "setNextFocusableComponent" ); - properties[PROPERTY_validateRoot] = new PropertyDescriptor ( "validateRoot", QCTreePane.class, "isValidateRoot", null ); - properties[PROPERTY_font] = new PropertyDescriptor ( "font", QCTreePane.class, "getFont", "setFont" ); - properties[PROPERTY_selectionModel] = new PropertyDescriptor ( "selectionModel", QCTreePane.class, "getSelectionModel", "setSelectionModel" ); - properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", QCTreePane.class, "getColorModel", null ); - properties[PROPERTY_selectedObject] = new PropertyDescriptor ( "selectedObject", QCTreePane.class, "getSelectedObject", null ); - properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", QCTreePane.class, "getAlignmentY", "setAlignmentY" ); - properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", QCTreePane.class, "getAlignmentX", "setAlignmentX" ); - properties[PROPERTY_y] = new PropertyDescriptor ( "y", QCTreePane.class, "getY", null ); - properties[PROPERTY_x] = new PropertyDescriptor ( "x", QCTreePane.class, "getX", null ); - properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", QCTreePane.class, "getAccessibleContext", null ); - properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", QCTreePane.class, "getLayout", "setLayout" ); - properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", QCTreePane.class, "getPreferredSize", "setPreferredSize" ); - properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", QCTreePane.class, "getInputMethodRequests", null ); - properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor ( "verifyInputWhenFocusTarget", QCTreePane.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget" ); - properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", QCTreePane.class, "getToolkit", null ); - properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", QCTreePane.class, "isDisplayable", null ); - properties[PROPERTY_class] = new PropertyDescriptor ( "class", QCTreePane.class, "getClass", null ); - properties[PROPERTY_root] = new PropertyDescriptor ( "root", QCTreePane.class, "getRoot", "setRoot" ); - properties[PROPERTY_autoscrolls] = new PropertyDescriptor ( "autoscrolls", QCTreePane.class, "getAutoscrolls", "setAutoscrolls" ); - properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", QCTreePane.class, "getInsets", null ); - properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", QCTreePane.class, "getCursor", "setCursor" ); - properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", QCTreePane.class, "isShowing", null ); - properties[PROPERTY_model] = new PropertyDescriptor ( "model", QCTreePane.class, "getModel", null ); - properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor ( "preferredSizeSet", QCTreePane.class, "isPreferredSizeSet", null ); - properties[PROPERTY_components] = new PropertyDescriptor ( "components", QCTreePane.class, "getComponents", null ); - properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", QCTreePane.class, "isFocusTraversable", null ); - properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", QCTreePane.class, "isVisible", "setVisible" ); - properties[PROPERTY_background] = new PropertyDescriptor ( "background", QCTreePane.class, "getBackground", "setBackground" ); - properties[PROPERTY_UIClassID] = new PropertyDescriptor ( "UIClassID", QCTreePane.class, "getUIClassID", null ); - properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", QCTreePane.class, "getGraphicsConfiguration", null ); - properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", QCTreePane.class, "getInputContext", null ); - properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor ( "registeredKeyStrokes", QCTreePane.class, "getRegisteredKeyStrokes", null ); - properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", QCTreePane.class, "isValid", null ); - properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", QCTreePane.class, "getLocale", "setLocale" ); - properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", QCTreePane.class, "getComponentOrientation", "setComponentOrientation" ); - properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", QCTreePane.class, "getGraphics", null ); - properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", QCTreePane.class, "getPeer", null ); - properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", QCTreePane.class, "getLocationOnScreen", null ); - properties[PROPERTY_name] = new PropertyDescriptor ( "name", QCTreePane.class, "getName", "setName" ); - properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", QCTreePane.class, "getForeground", "setForeground" ); - properties[PROPERTY_actionMap] = new PropertyDescriptor ( "actionMap", QCTreePane.class, "getActionMap", "setActionMap" ); - properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor ( "topLevelAncestor", QCTreePane.class, "getTopLevelAncestor", null ); - properties[PROPERTY_paintingTile] = new PropertyDescriptor ( "paintingTile", QCTreePane.class, "isPaintingTile", null ); - properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor ( "focusCycleRoot", QCTreePane.class, "isFocusCycleRoot", null ); - properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", QCTreePane.class, "isEnabled", "setEnabled" ); - properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", QCTreePane.class, "isLightweight", null ); - properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", QCTreePane.class, "getDropTarget", "setDropTarget" ); - properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", QCTreePane.class, "isOpaque", "setOpaque" ); - properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", QCTreePane.class, "getComponentCount", null ); - properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor ( "maximumSizeSet", QCTreePane.class, "isMaximumSizeSet", null ); - properties[PROPERTY_confirm] = new PropertyDescriptor ( "confirm", QCTreePane.class, "getConfirm", "setConfirm" ); - properties[PROPERTY_toolTipText] = new PropertyDescriptor ( "toolTipText", QCTreePane.class, "getToolTipText", "setToolTipText" ); - properties[PROPERTY_height] = new PropertyDescriptor ( "height", QCTreePane.class, "getHeight", null ); - properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", QCTreePane.class, "isDoubleBuffered", "setDoubleBuffered" ); - properties[PROPERTY_border] = new PropertyDescriptor ( "border", QCTreePane.class, "getBorder", "setBorder" ); - properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor ( "minimumSizeSet", QCTreePane.class, "isMinimumSizeSet", null ); - properties[PROPERTY_actionContext] = new PropertyDescriptor ( "actionContext", QCTreePane.class, "getActionContext", null ); - properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", QCTreePane.class, "getTreeLock", null ); - properties[PROPERTY_width] = new PropertyDescriptor ( "width", QCTreePane.class, "getWidth", null ); - properties[PROPERTY_managingFocus] = new PropertyDescriptor ( "managingFocus", QCTreePane.class, "isManagingFocus", null ); - properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", QCTreePane.class, "getMaximumSize", "setMaximumSize" ); - properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", QCTreePane.class, "getMinimumSize", "setMinimumSize" ); - properties[PROPERTY_allowActions] = new PropertyDescriptor ( "allowActions", QCTreePane.class, "getAllowActions", "setAllowActions" ); - properties[PROPERTY_visibleRect] = new PropertyDescriptor ( "visibleRect", QCTreePane.class, "getVisibleRect", null ); - properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor ( "debugGraphicsOptions", QCTreePane.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions" ); - properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor ( "optimizedDrawingEnabled", QCTreePane.class, "isOptimizedDrawingEnabled", null ); - properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor ( "requestFocusEnabled", QCTreePane.class, "isRequestFocusEnabled", "setRequestFocusEnabled" ); - properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", QCTreePane.class, "getParent", null ); - properties[PROPERTY_inputVerifier] = new PropertyDescriptor ( "inputVerifier", QCTreePane.class, "getInputVerifier", "setInputVerifier" ); - properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", QCTreePane.class, "getRootPane", null ); - properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", QCTreePane.class, "getBounds", "setBounds" ); - properties[PROPERTY_selectedObjects] = new PropertyDescriptor ( "selectedObjects", QCTreePane.class, "getSelectedObjects", null ); - properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", QCTreePane.class, null, null, "getComponent", null ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Properties - - // Here you can add code for customizing the properties array. - -}//GEN-LAST:Properties - - // EventSet identifiers//GEN-FIRST:Events - private static final int EVENT_mouseMotionListener = 0; - private static final int EVENT_inputMethodListener = 1; - private static final int EVENT_ancestorListener = 2; - private static final int EVENT_componentListener = 3; - private static final int EVENT_hierarchyBoundsListener = 4; - private static final int EVENT_mouseListener = 5; - private static final int EVENT_focusListener = 6; - private static final int EVENT_treeSelectionListener = 7; - private static final int EVENT_propertyChangeListener = 8; - private static final int EVENT_keyListener = 9; - private static final int EVENT_hierarchyListener = 10; - private static final int EVENT_containerListener = 11; - private static final int EVENT_vetoableChangeListener = 12; - private static final int EVENT_errorListener = 13; - - // EventSet array - private static EventSetDescriptor[] eventSets = new EventSetDescriptor[14]; - - static { - try { - eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( QCTreePane.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[0], "addMouseMotionListener", "removeMouseMotionListener" ); - eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( QCTreePane.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[0], "addInputMethodListener", "removeInputMethodListener" ); - eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( QCTreePane.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[0], "addAncestorListener", "removeAncestorListener" ); - eventSets[EVENT_componentListener] = new EventSetDescriptor ( QCTreePane.class, "componentListener", java.awt.event.ComponentListener.class, new String[0], "addComponentListener", "removeComponentListener" ); - eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( QCTreePane.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[0], "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); - eventSets[EVENT_mouseListener] = new EventSetDescriptor ( QCTreePane.class, "mouseListener", java.awt.event.MouseListener.class, new String[0], "addMouseListener", "removeMouseListener" ); - eventSets[EVENT_focusListener] = new EventSetDescriptor ( QCTreePane.class, "focusListener", java.awt.event.FocusListener.class, new String[0], "addFocusListener", "removeFocusListener" ); - eventSets[EVENT_treeSelectionListener] = new EventSetDescriptor ( QCTreePane.class, "treeSelectionListener", javax.swing.event.TreeSelectionListener.class, new String[0], "addTreeSelectionListener", "removeTreeSelectionListener" ); - eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( QCTreePane.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[0], "addPropertyChangeListener", "removePropertyChangeListener" ); - eventSets[EVENT_keyListener] = new EventSetDescriptor ( QCTreePane.class, "keyListener", java.awt.event.KeyListener.class, new String[0], "addKeyListener", "removeKeyListener" ); - eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( QCTreePane.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[0], "addHierarchyListener", "removeHierarchyListener" ); - eventSets[EVENT_containerListener] = new EventSetDescriptor ( QCTreePane.class, "containerListener", java.awt.event.ContainerListener.class, new String[0], "addContainerListener", "removeContainerListener" ); - eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( QCTreePane.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[0], "addVetoableChangeListener", "removeVetoableChangeListener" ); - eventSets[EVENT_errorListener] = new EventSetDescriptor ( QCTreePane.class, "errorListener", com.ibm.as400.vaccess.ErrorListener.class, new String[0], "addErrorListener", "removeErrorListener" ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Events - - // Here you can add code for customizing the event sets array. - -}//GEN-LAST:Events - - private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef - private static java.awt.Image iconColor32 = null; - private static java.awt.Image iconMono16 = null; - private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef - private static String iconNameC16 = null;//GEN-BEGIN:Icons - private static String iconNameC32 = null; - private static String iconNameM16 = null; - private static String iconNameM32 = null;//GEN-END:Icons - - private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx - private static int defaultEventIndex = -1;//GEN-END:Idx - - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

- * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } - - /** - * Gets the beans EventSetDescriptors. - * - * @return An array of EventSetDescriptors describing the kinds of - * events fired by this bean. May return null if the information - * should be obtained by automatic analysis. - */ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSets; - } - - /** - * A bean may have a "default" property that is the property that will - * mostly commonly be initially chosen for update by human's who are - * customizing the bean. - * @return Index of default property in the PropertyDescriptor array - * returned by getPropertyDescriptors. - *

Returns -1 if there is no default property. - */ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** - * A bean may have a "default" event that is the event that will - * mostly commonly be used by human's when using the bean. - * @return Index of default event in the EventSetDescriptor array - * returned by getEventSetDescriptors. - *

Returns -1 if there is no default event. - */ - public int getDefaultEventIndex() { - return defaultPropertyIndex; - } - - /** - * This method returns an image object that can be used to - * represent the bean in toolboxes, toolbars, etc. Icon images - * will typically be GIFs, but may in future include other formats. - *

- * Beans aren't required to provide icons and may return null from - * this method. - *

- * There are four possible flavors of icons (16x16 color, - * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only - * support a single icon we recommend supporting 16x16 color. - *

- * We recommend that icons have a "transparent" background - * so they can be rendered onto an existing background. - * - * @param iconKind The kind of icon requested. This should be - * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, - * ICON_MONO_16x16, or ICON_MONO_32x32. - * @return An image object representing the requested icon. May - * return null if no suitable icon is available. - */ - public java.awt.Image getIcon(int iconKind) { - switch ( iconKind ) { - case ICON_COLOR_16x16: - if ( iconNameC16 == null ) - return null; - else { - if( iconColor16 == null ) - iconColor16 = loadImage( iconNameC16 ); - return iconColor16; - } - case ICON_COLOR_32x32: - if ( iconNameC32 == null ) - return null; - else { - if( iconColor32 == null ) - iconColor32 = loadImage( iconNameC32 ); - return iconColor32; - } - case ICON_MONO_16x16: - if ( iconNameM16 == null ) - return null; - else { - if( iconMono16 == null ) - iconMono16 = loadImage( iconNameM16 ); - return iconMono16; - } - case ICON_MONO_32x32: - if ( iconNameM32 == null ) - return null; - else { - if( iconNameM32 == null ) - iconMono32 = loadImage( iconNameM32 ); - return iconMono32; - } - } - return null; - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCUserListPanel.form b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCUserListPanel.form deleted file mode 100644 index 071b226cd..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCUserListPanel.form +++ /dev/null @@ -1,83 +0,0 @@ - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCUserListPanel.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCUserListPanel.java deleted file mode 100644 index 176dc54ec..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCUserListPanel.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * QCUserListPanel.java - * - * Created on July 14, 2000, 9:07 PM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** Panel to hold AS400UserListPane. - * @author jax - * @version 1.0 - */ -public class QCUserListPanel extends javax.swing.JPanel implements com.SoftWoehr.JTOpenContrib.QCDemo.QCServiceClient { - - private QCMgr manager; - private java.lang.String serverName; - private com.SoftWoehr.JTOpenContrib.QCDemo.QCServiceRecord serviceRecord; - private com.ibm.as400.vaccess.ErrorDialogAdapter errorDialogAdapter; - - /** Creates new form QCUserListPanel */ - public QCUserListPanel() { - initComponents (); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the FormEditor. - */ - private void initComponents () {//GEN-BEGIN:initComponents - vUserList1 = new com.ibm.as400.vaccess.VUserList (); - aS400DetailsPane1 = new com.ibm.as400.vaccess.AS400DetailsPane (); - jPanel1 = new javax.swing.JPanel (); - systemLabel = new javax.swing.JLabel (); - systemTextField = new javax.swing.JTextField (); - listButton = new javax.swing.JButton (); - userListLabel = new javax.swing.JLabel (); - - setLayout (new java.awt.BorderLayout ()); - - - - add (aS400DetailsPane1, java.awt.BorderLayout.CENTER); - - jPanel1.setLayout (new java.awt.GridLayout (1, 3)); - - systemLabel.setText ("System name"); - systemLabel.setHorizontalAlignment (javax.swing.SwingConstants.RIGHT); - - jPanel1.add (systemLabel); - - systemTextField.setToolTipText ("Enter system name for user list."); - systemTextField.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - systemTextFieldActionPerformed (evt); - } - } - ); - - jPanel1.add (systemTextField); - - listButton.setToolTipText ("Get a list of user on system you selected."); - listButton.setText ("Get User LIst"); - listButton.addActionListener (new java.awt.event.ActionListener () { - public void actionPerformed (java.awt.event.ActionEvent evt) { - listButtonActionPerformed (evt); - } - } - ); - - jPanel1.add (listButton); - - - add (jPanel1, java.awt.BorderLayout.SOUTH); - - userListLabel.setText ("A list of users on the server."); - userListLabel.setToolTipText ("Fill in the system name below and press the button to get a list of users."); - userListLabel.setHorizontalAlignment (javax.swing.SwingConstants.CENTER); - - - add (userListLabel, java.awt.BorderLayout.NORTH); - - }//GEN-END:initComponents - - // Hitting ENTER in the textfield is the same as pressing the button. - private void systemTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_systemTextFieldActionPerformed - // Add your handling code here: - listButtonActionPerformed (evt); - }//GEN-LAST:event_systemTextFieldActionPerformed - - // Hitting ENTER in the textfield is the same as pressing the button. - private void listButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_listButtonActionPerformed - // Add your handling code here: - java.awt.Cursor cursor = getCursor(); - setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR)); - reinstanceServerFromTextEntry(); - reinstanceUserList(); - if (null != vUserList1 && null != serviceRecord) { - loadUsers(); - setDetailsPaneRoot(); - } - setCursor(cursor); - }//GEN-LAST:event_listButtonActionPerformed - - private synchronized void reinstanceServerFromTextEntry() { - String newName = systemTextField.getText(); - if (null == serverName) { - serverName = ""; - } - if (null != newName) { - if (!newName.equals("")) { - if (!newName.equals(serverName)) { - serverName = newName; - if (null != serviceRecord) { - - try { // let go of the service from manager - manager.freeService(serviceRecord); - } - catch (Exception e) { - e.printStackTrace(); - } - serviceRecord = null; - } - try { - serviceRecord = manager.getService("qcmgr:" + serverName + "/COMMAND", this); - } - catch (Exception e) { - e.printStackTrace(); - } - } - } - } - } - private synchronized void reinstanceUserList () { - vUserList1 = new com.ibm.as400.vaccess.VUserList(serviceRecord.as400); - if (null != errorDialogAdapter) { - vUserList1.addErrorListener(errorDialogAdapter); - } - } - - private void setDetailsPaneRoot() { - if (null != vUserList1) { - try { - aS400DetailsPane1.setRoot(vUserList1); - } - catch (java.beans.PropertyVetoException e) { - e.printStackTrace(); - } - } - } - - private void loadUsers () { - vUserList1.load(); - } - // Variables declaration - do not modify//GEN-BEGIN:variables - private com.ibm.as400.vaccess.VUserList vUserList1; - private com.ibm.as400.vaccess.AS400DetailsPane aS400DetailsPane1; - private javax.swing.JPanel jPanel1; - private javax.swing.JLabel systemLabel; - private javax.swing.JTextField systemTextField; - private javax.swing.JButton listButton; - private javax.swing.JLabel userListLabel; - // End of variables declaration//GEN-END:variables - - /** Sets the QCMgr object which will handle AS400 instances for this client. - * @param mgr A QCMgr object. - */ - public void setManager(QCMgr mgr) { - manager = mgr; - } - - /** Connects the ErrorDialogAdapter with any as400.vaccess components present. - * @param eda An instance of an ErrorDialogAdapter already associated - * with a suitable Frame. - */ - public void propagateEDA(com.ibm.as400.vaccess.ErrorDialogAdapter eda) { - errorDialogAdapter=eda; - aS400DetailsPane1.addErrorListener(eda); - vUserList1.addErrorListener(eda); - } - /** Required implementantion of the QCServiceClient interface. Releases the - * AS400 object provided by the server. - * @param sr The service record which represents the AS400 to be - * relinquished. - */ - public void relinquish(QCServiceRecord sr) { - serviceRecord = null; - } -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCUserListPanelBeanInfo.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCUserListPanelBeanInfo.java deleted file mode 100644 index 42175c888..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCUserListPanelBeanInfo.java +++ /dev/null @@ -1,315 +0,0 @@ -package com.SoftWoehr.JTOpenContrib.QCDemo; - -import java.beans.*; - -public class QCUserListPanelBeanInfo extends SimpleBeanInfo { - - // Property identifiers //GEN-FIRST:Properties - private static final int PROPERTY_optimizedDrawingEnabled = 0; - private static final int PROPERTY_colorModel = 1; - private static final int PROPERTY_minimumSize = 2; - private static final int PROPERTY_visible = 3; - private static final int PROPERTY_toolkit = 4; - private static final int PROPERTY_displayable = 5; - private static final int PROPERTY_opaque = 6; - private static final int PROPERTY_requestFocusEnabled = 7; - private static final int PROPERTY_enabled = 8; - private static final int PROPERTY_autoscrolls = 9; - private static final int PROPERTY_y = 10; - private static final int PROPERTY_x = 11; - private static final int PROPERTY_accessibleContext = 12; - private static final int PROPERTY_componentOrientation = 13; - private static final int PROPERTY_components = 14; - private static final int PROPERTY_managingFocus = 15; - private static final int PROPERTY_inputMethodRequests = 16; - private static final int PROPERTY_border = 17; - private static final int PROPERTY_locale = 18; - private static final int PROPERTY_insets = 19; - private static final int PROPERTY_UIClassID = 20; - private static final int PROPERTY_graphics = 21; - private static final int PROPERTY_minimumSizeSet = 22; - private static final int PROPERTY_actionMap = 23; - private static final int PROPERTY_maximumSizeSet = 24; - private static final int PROPERTY_alignmentY = 25; - private static final int PROPERTY_alignmentX = 26; - private static final int PROPERTY_locationOnScreen = 27; - private static final int PROPERTY_cursor = 28; - private static final int PROPERTY_registeredKeyStrokes = 29; - private static final int PROPERTY_preferredSizeSet = 30; - private static final int PROPERTY_visibleRect = 31; - private static final int PROPERTY_bounds = 32; - private static final int PROPERTY_inputContext = 33; - private static final int PROPERTY_class = 34; - private static final int PROPERTY_focusTraversable = 35; - private static final int PROPERTY_font = 36; - private static final int PROPERTY_inputVerifier = 37; - private static final int PROPERTY_lightweight = 38; - private static final int PROPERTY_paintingTile = 39; - private static final int PROPERTY_maximumSize = 40; - private static final int PROPERTY_layout = 41; - private static final int PROPERTY_treeLock = 42; - private static final int PROPERTY_verifyInputWhenFocusTarget = 43; - private static final int PROPERTY_foreground = 44; - private static final int PROPERTY_preferredSize = 45; - private static final int PROPERTY_debugGraphicsOptions = 46; - private static final int PROPERTY_doubleBuffered = 47; - private static final int PROPERTY_showing = 48; - private static final int PROPERTY_nextFocusableComponent = 49; - private static final int PROPERTY_parent = 50; - private static final int PROPERTY_peer = 51; - private static final int PROPERTY_componentCount = 52; - private static final int PROPERTY_manager = 53; - private static final int PROPERTY_graphicsConfiguration = 54; - private static final int PROPERTY_height = 55; - private static final int PROPERTY_valid = 56; - private static final int PROPERTY_focusCycleRoot = 57; - private static final int PROPERTY_width = 58; - private static final int PROPERTY_toolTipText = 59; - private static final int PROPERTY_background = 60; - private static final int PROPERTY_validateRoot = 61; - private static final int PROPERTY_topLevelAncestor = 62; - private static final int PROPERTY_dropTarget = 63; - private static final int PROPERTY_rootPane = 64; - private static final int PROPERTY_name = 65; - private static final int PROPERTY_component = 66; - - // Property array - private static PropertyDescriptor[] properties = new PropertyDescriptor[67]; - - static { - try { - properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor ( "optimizedDrawingEnabled", QCUserListPanel.class, "isOptimizedDrawingEnabled", null ); - properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", QCUserListPanel.class, "getColorModel", null ); - properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", QCUserListPanel.class, "getMinimumSize", "setMinimumSize" ); - properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", QCUserListPanel.class, "isVisible", "setVisible" ); - properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", QCUserListPanel.class, "getToolkit", null ); - properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", QCUserListPanel.class, "isDisplayable", null ); - properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", QCUserListPanel.class, "isOpaque", "setOpaque" ); - properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor ( "requestFocusEnabled", QCUserListPanel.class, "isRequestFocusEnabled", "setRequestFocusEnabled" ); - properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", QCUserListPanel.class, "isEnabled", "setEnabled" ); - properties[PROPERTY_autoscrolls] = new PropertyDescriptor ( "autoscrolls", QCUserListPanel.class, "getAutoscrolls", "setAutoscrolls" ); - properties[PROPERTY_y] = new PropertyDescriptor ( "y", QCUserListPanel.class, "getY", null ); - properties[PROPERTY_x] = new PropertyDescriptor ( "x", QCUserListPanel.class, "getX", null ); - properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", QCUserListPanel.class, "getAccessibleContext", null ); - properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", QCUserListPanel.class, "getComponentOrientation", "setComponentOrientation" ); - properties[PROPERTY_components] = new PropertyDescriptor ( "components", QCUserListPanel.class, "getComponents", null ); - properties[PROPERTY_managingFocus] = new PropertyDescriptor ( "managingFocus", QCUserListPanel.class, "isManagingFocus", null ); - properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", QCUserListPanel.class, "getInputMethodRequests", null ); - properties[PROPERTY_border] = new PropertyDescriptor ( "border", QCUserListPanel.class, "getBorder", "setBorder" ); - properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", QCUserListPanel.class, "getLocale", "setLocale" ); - properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", QCUserListPanel.class, "getInsets", null ); - properties[PROPERTY_UIClassID] = new PropertyDescriptor ( "UIClassID", QCUserListPanel.class, "getUIClassID", null ); - properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", QCUserListPanel.class, "getGraphics", null ); - properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor ( "minimumSizeSet", QCUserListPanel.class, "isMinimumSizeSet", null ); - properties[PROPERTY_actionMap] = new PropertyDescriptor ( "actionMap", QCUserListPanel.class, "getActionMap", "setActionMap" ); - properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor ( "maximumSizeSet", QCUserListPanel.class, "isMaximumSizeSet", null ); - properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", QCUserListPanel.class, "getAlignmentY", "setAlignmentY" ); - properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", QCUserListPanel.class, "getAlignmentX", "setAlignmentX" ); - properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", QCUserListPanel.class, "getLocationOnScreen", null ); - properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", QCUserListPanel.class, "getCursor", "setCursor" ); - properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor ( "registeredKeyStrokes", QCUserListPanel.class, "getRegisteredKeyStrokes", null ); - properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor ( "preferredSizeSet", QCUserListPanel.class, "isPreferredSizeSet", null ); - properties[PROPERTY_visibleRect] = new PropertyDescriptor ( "visibleRect", QCUserListPanel.class, "getVisibleRect", null ); - properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", QCUserListPanel.class, "getBounds", "setBounds" ); - properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", QCUserListPanel.class, "getInputContext", null ); - properties[PROPERTY_class] = new PropertyDescriptor ( "class", QCUserListPanel.class, "getClass", null ); - properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", QCUserListPanel.class, "isFocusTraversable", null ); - properties[PROPERTY_font] = new PropertyDescriptor ( "font", QCUserListPanel.class, "getFont", "setFont" ); - properties[PROPERTY_inputVerifier] = new PropertyDescriptor ( "inputVerifier", QCUserListPanel.class, "getInputVerifier", "setInputVerifier" ); - properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", QCUserListPanel.class, "isLightweight", null ); - properties[PROPERTY_paintingTile] = new PropertyDescriptor ( "paintingTile", QCUserListPanel.class, "isPaintingTile", null ); - properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", QCUserListPanel.class, "getMaximumSize", "setMaximumSize" ); - properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", QCUserListPanel.class, "getLayout", "setLayout" ); - properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", QCUserListPanel.class, "getTreeLock", null ); - properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor ( "verifyInputWhenFocusTarget", QCUserListPanel.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget" ); - properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", QCUserListPanel.class, "getForeground", "setForeground" ); - properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", QCUserListPanel.class, "getPreferredSize", "setPreferredSize" ); - properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor ( "debugGraphicsOptions", QCUserListPanel.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions" ); - properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", QCUserListPanel.class, "isDoubleBuffered", "setDoubleBuffered" ); - properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", QCUserListPanel.class, "isShowing", null ); - properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor ( "nextFocusableComponent", QCUserListPanel.class, "getNextFocusableComponent", "setNextFocusableComponent" ); - properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", QCUserListPanel.class, "getParent", null ); - properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", QCUserListPanel.class, "getPeer", null ); - properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", QCUserListPanel.class, "getComponentCount", null ); - properties[PROPERTY_manager] = new PropertyDescriptor ( "manager", QCUserListPanel.class, null, "setManager" ); - properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", QCUserListPanel.class, "getGraphicsConfiguration", null ); - properties[PROPERTY_height] = new PropertyDescriptor ( "height", QCUserListPanel.class, "getHeight", null ); - properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", QCUserListPanel.class, "isValid", null ); - properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor ( "focusCycleRoot", QCUserListPanel.class, "isFocusCycleRoot", null ); - properties[PROPERTY_width] = new PropertyDescriptor ( "width", QCUserListPanel.class, "getWidth", null ); - properties[PROPERTY_toolTipText] = new PropertyDescriptor ( "toolTipText", QCUserListPanel.class, "getToolTipText", "setToolTipText" ); - properties[PROPERTY_background] = new PropertyDescriptor ( "background", QCUserListPanel.class, "getBackground", "setBackground" ); - properties[PROPERTY_validateRoot] = new PropertyDescriptor ( "validateRoot", QCUserListPanel.class, "isValidateRoot", null ); - properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor ( "topLevelAncestor", QCUserListPanel.class, "getTopLevelAncestor", null ); - properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", QCUserListPanel.class, "getDropTarget", "setDropTarget" ); - properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", QCUserListPanel.class, "getRootPane", null ); - properties[PROPERTY_name] = new PropertyDescriptor ( "name", QCUserListPanel.class, "getName", "setName" ); - properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", QCUserListPanel.class, null, null, "getComponent", null ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Properties - - // Here you can add code for customizing the properties array. - -}//GEN-LAST:Properties - - // EventSet identifiers//GEN-FIRST:Events - private static final int EVENT_mouseMotionListener = 0; - private static final int EVENT_ancestorListener = 1; - private static final int EVENT_inputMethodListener = 2; - private static final int EVENT_componentListener = 3; - private static final int EVENT_hierarchyBoundsListener = 4; - private static final int EVENT_mouseListener = 5; - private static final int EVENT_focusListener = 6; - private static final int EVENT_propertyChangeListener = 7; - private static final int EVENT_keyListener = 8; - private static final int EVENT_hierarchyListener = 9; - private static final int EVENT_containerListener = 10; - private static final int EVENT_vetoableChangeListener = 11; - - // EventSet array - private static EventSetDescriptor[] eventSets = new EventSetDescriptor[12]; - - static { - try { - eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( QCUserListPanel.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[0], "addMouseMotionListener", "removeMouseMotionListener" ); - eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( QCUserListPanel.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[0], "addAncestorListener", "removeAncestorListener" ); - eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( QCUserListPanel.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[0], "addInputMethodListener", "removeInputMethodListener" ); - eventSets[EVENT_componentListener] = new EventSetDescriptor ( QCUserListPanel.class, "componentListener", java.awt.event.ComponentListener.class, new String[0], "addComponentListener", "removeComponentListener" ); - eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( QCUserListPanel.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[0], "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); - eventSets[EVENT_mouseListener] = new EventSetDescriptor ( QCUserListPanel.class, "mouseListener", java.awt.event.MouseListener.class, new String[0], "addMouseListener", "removeMouseListener" ); - eventSets[EVENT_focusListener] = new EventSetDescriptor ( QCUserListPanel.class, "focusListener", java.awt.event.FocusListener.class, new String[0], "addFocusListener", "removeFocusListener" ); - eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( QCUserListPanel.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[0], "addPropertyChangeListener", "removePropertyChangeListener" ); - eventSets[EVENT_keyListener] = new EventSetDescriptor ( QCUserListPanel.class, "keyListener", java.awt.event.KeyListener.class, new String[0], "addKeyListener", "removeKeyListener" ); - eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( QCUserListPanel.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[0], "addHierarchyListener", "removeHierarchyListener" ); - eventSets[EVENT_containerListener] = new EventSetDescriptor ( QCUserListPanel.class, "containerListener", java.awt.event.ContainerListener.class, new String[0], "addContainerListener", "removeContainerListener" ); - eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( QCUserListPanel.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[0], "addVetoableChangeListener", "removeVetoableChangeListener" ); - } - catch( IntrospectionException e) {}//GEN-HEADEREND:Events - - // Here you can add code for customizing the event sets array. - -}//GEN-LAST:Events - - private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef - private static java.awt.Image iconColor32 = null; - private static java.awt.Image iconMono16 = null; - private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef - private static String iconNameC16 = null;//GEN-BEGIN:Icons - private static String iconNameC32 = null; - private static String iconNameM16 = null; - private static String iconNameM32 = null;//GEN-END:Icons - - private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx - private static int defaultEventIndex = -1;//GEN-END:Idx - - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

- * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } - - /** - * Gets the beans EventSetDescriptors. - * - * @return An array of EventSetDescriptors describing the kinds of - * events fired by this bean. May return null if the information - * should be obtained by automatic analysis. - */ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSets; - } - - /** - * A bean may have a "default" property that is the property that will - * mostly commonly be initially chosen for update by human's who are - * customizing the bean. - * @return Index of default property in the PropertyDescriptor array - * returned by getPropertyDescriptors. - *

Returns -1 if there is no default property. - */ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** - * A bean may have a "default" event that is the event that will - * mostly commonly be used by human's when using the bean. - * @return Index of default event in the EventSetDescriptor array - * returned by getEventSetDescriptors. - *

Returns -1 if there is no default event. - */ - public int getDefaultEventIndex() { - return defaultPropertyIndex; - } - - /** - * This method returns an image object that can be used to - * represent the bean in toolboxes, toolbars, etc. Icon images - * will typically be GIFs, but may in future include other formats. - *

- * Beans aren't required to provide icons and may return null from - * this method. - *

- * There are four possible flavors of icons (16x16 color, - * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only - * support a single icon we recommend supporting 16x16 color. - *

- * We recommend that icons have a "transparent" background - * so they can be rendered onto an existing background. - * - * @param iconKind The kind of icon requested. This should be - * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, - * ICON_MONO_16x16, or ICON_MONO_32x32. - * @return An image object representing the requested icon. May - * return null if no suitable icon is available. - */ - public java.awt.Image getIcon(int iconKind) { - switch ( iconKind ) { - case ICON_COLOR_16x16: - if ( iconNameC16 == null ) - return null; - else { - if( iconColor16 == null ) - iconColor16 = loadImage( iconNameC16 ); - return iconColor16; - } - case ICON_COLOR_32x32: - if ( iconNameC32 == null ) - return null; - else { - if( iconColor32 == null ) - iconColor32 = loadImage( iconNameC32 ); - return iconColor32; - } - case ICON_MONO_16x16: - if ( iconNameM16 == null ) - return null; - else { - if( iconMono16 == null ) - iconMono16 = loadImage( iconNameM16 ); - return iconMono16; - } - case ICON_MONO_32x32: - if ( iconNameM32 == null ) - return null; - else { - if( iconNameM32 == null ) - iconMono32 = loadImage( iconNameM32 ); - return iconMono32; - } - } - return null; - } - -} diff --git a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCVNodeDisplayer.java b/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCVNodeDisplayer.java deleted file mode 100644 index 489ef344e..000000000 --- a/cvsroot/demos/qcdemo/com/SoftWoehr/JTOpenContrib/QCDemo/QCVNodeDisplayer.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * QCVNodeDisplayer.java - * - * Created on July 16, 2000, 2:03 AM - * - * This is free open source software distributed under the IBM Public License found - * on the World Wide Web at http://oss.software.ibm.com/developerworks/opensource/license10.html - * Copyright *C* 2000, Jack J. Woehr, PO Box 51, Golden, CO 80402-0051 USA jax@well.com - * Copyright *C* 2000, International Business Machines Corporation and others. All Rights Reserved. - */ - -package com.SoftWoehr.JTOpenContrib.QCDemo; - -/** Another interface substituting for dual inheritance in Java. This - * allows a little polymorphism with AS400 panes. - * @author jax - * @version 1.0 - */ -public interface QCVNodeDisplayer { - /** AS400 pane sets its root VNode. - * @param v The VNode with data for the view pane. - */ - public void setRoot(com.ibm.as400.vaccess.VNode v); - /** Add this AS400 pane to an AWT Component. - * @param c The Component to which this pane is to be added. - */ - public void addTo(java.awt.Container c); - /** Set the ErrorDialogAdapter handling errors for this AS400 pane. - * @param eda An ErrorDialogAdapter attached to Frame. - */ - public void addErrorListener(com.ibm.as400.vaccess.ErrorDialogAdapter eda); -} diff --git a/cvsroot/demos/qcdemo/html/images/QCCommandPanel.jpg b/cvsroot/demos/qcdemo/html/images/QCCommandPanel.jpg deleted file mode 100644 index a8a963068..000000000 Binary files a/cvsroot/demos/qcdemo/html/images/QCCommandPanel.jpg and /dev/null differ diff --git a/cvsroot/demos/qcdemo/html/images/QCCommandPanelBad.jpg b/cvsroot/demos/qcdemo/html/images/QCCommandPanelBad.jpg deleted file mode 100644 index b2d0e0336..000000000 Binary files a/cvsroot/demos/qcdemo/html/images/QCCommandPanelBad.jpg and /dev/null differ diff --git a/cvsroot/demos/qcdemo/html/images/QCConnectionManagerViewer.jpg b/cvsroot/demos/qcdemo/html/images/QCConnectionManagerViewer.jpg deleted file mode 100644 index b7dcf2883..000000000 Binary files a/cvsroot/demos/qcdemo/html/images/QCConnectionManagerViewer.jpg and /dev/null differ diff --git a/cvsroot/demos/qcdemo/html/images/QCIFSPanel.jpg b/cvsroot/demos/qcdemo/html/images/QCIFSPanel.jpg deleted file mode 100644 index 10b307ad2..000000000 Binary files a/cvsroot/demos/qcdemo/html/images/QCIFSPanel.jpg and /dev/null differ diff --git a/cvsroot/demos/qcdemo/html/images/QCJobListPanel.jpg b/cvsroot/demos/qcdemo/html/images/QCJobListPanel.jpg deleted file mode 100644 index f4994e310..000000000 Binary files a/cvsroot/demos/qcdemo/html/images/QCJobListPanel.jpg and /dev/null differ diff --git a/cvsroot/demos/qcdemo/html/images/QCPrinterListPanel.jpg b/cvsroot/demos/qcdemo/html/images/QCPrinterListPanel.jpg deleted file mode 100644 index bde1ee487..000000000 Binary files a/cvsroot/demos/qcdemo/html/images/QCPrinterListPanel.jpg and /dev/null differ diff --git a/cvsroot/demos/qcdemo/html/images/QCSQLQueryBuilderPanel.jpg b/cvsroot/demos/qcdemo/html/images/QCSQLQueryBuilderPanel.jpg deleted file mode 100644 index 4ac6677a1..000000000 Binary files a/cvsroot/demos/qcdemo/html/images/QCSQLQueryBuilderPanel.jpg and /dev/null differ diff --git a/cvsroot/demos/qcdemo/html/images/QCSQLResultFormPanel.jpg b/cvsroot/demos/qcdemo/html/images/QCSQLResultFormPanel.jpg deleted file mode 100644 index b8522a075..000000000 Binary files a/cvsroot/demos/qcdemo/html/images/QCSQLResultFormPanel.jpg and /dev/null differ diff --git a/cvsroot/demos/qcdemo/html/images/QCSQLResultTablePanel.jpg b/cvsroot/demos/qcdemo/html/images/QCSQLResultTablePanel.jpg deleted file mode 100644 index eb02cf351..000000000 Binary files a/cvsroot/demos/qcdemo/html/images/QCSQLResultTablePanel.jpg and /dev/null differ diff --git a/cvsroot/demos/qcdemo/html/images/QCSpooledFilePanel.jpg b/cvsroot/demos/qcdemo/html/images/QCSpooledFilePanel.jpg deleted file mode 100644 index 13ce1841f..000000000 Binary files a/cvsroot/demos/qcdemo/html/images/QCSpooledFilePanel.jpg and /dev/null differ diff --git a/cvsroot/demos/qcdemo/html/images/QCUserListPanel.jpg b/cvsroot/demos/qcdemo/html/images/QCUserListPanel.jpg deleted file mode 100644 index 2cea07679..000000000 Binary files a/cvsroot/demos/qcdemo/html/images/QCUserListPanel.jpg and /dev/null differ diff --git a/cvsroot/demos/qcdemo/html/index.html b/cvsroot/demos/qcdemo/html/index.html deleted file mode 100644 index 8e716116b..000000000 --- a/cvsroot/demos/qcdemo/html/index.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - SoftWoehr QCDemo - - - -

-

-SoftWoehr QCDemo

- -
Copyright 2000, Jack -J. Woehr -
P.O. Box 51, Golden, Colorado 80402-0051
- -

-Table of Contents

- - - -

-About QCDemo

-QCDemo demonstrates using the AS/400 -Java Beans contained in the JTOpen -project to remotely connect to and explore your AS/400 midrange computer. -The name "QC" stands for Quatre Cent, i.e., 400 :-) -

QCDemo comes with full source code which is released under an open source -license so that you may modify it to use this source on your own project -if you find it useful or helpful. -

QCDemo is a tabbed notebook. Each tabbed page demostrates one or more -JTOpen beans. -

The QCDemo tabbed notebook was developed using Sun -Forte for Java. All the .form files which go with the Forte project -are included, but are not necessary to build and/or modify QCDemo for your -use. -

-DISCLAIMER

-USE AT YOUR OWN RISK. THERE IS NO GUARANTEE OR WARANTEE FOR THIS -FREE SOFTWARE. QCDemo can modify files and settings on any AS/400 -to which it is connected. To the best of our belief, it performs exactly -what you direct it to do, which is dangerous enough, isn't it? Other slightly -dangerous aspects of JTOpen itself include the following: -
    -
  • -Your logins are real AS400 logins!
  • - -
      -
    • -Three password failures and OS/400 may lock you out of your account until -QSECOFR deals with it.
    • -
    - -
  • -YOUR LOGINS ARE ENCRYPTED BUT YOUR DATA GO OVER THE NETWORK UNENCRYPTED.
  • - -
      -
    • -There is indeed a SecureAS400 component in the JTOpen toolkit, but your -author didn't use it in QCDemo.
    • -
    -
- -

-Thanks!

- The author thanks the International -Business Machines Corporation for participating in the open source -community and notes all the fine work done by open source enthusiasts both -working for IBM and as customers of IBM on so many IBM platforms. And thanks -to you for trying out QCDemo and reporting -any problems you find. -

Fairmount, Colorado July, 2000 - - diff --git a/cvsroot/demos/qcdemo/html/progman.html b/cvsroot/demos/qcdemo/html/progman.html deleted file mode 100644 index eb8952150..000000000 --- a/cvsroot/demos/qcdemo/html/progman.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - SoftWoehr QCDemo Programmer Manual - - - -

-

-SoftWoehr QCDemo Programmer -Manual

- -
Copyright 2000, Jack J. Woehr -
P.O. Box 51, Golden, Colorado 80402-0051
- -

-Table of Contents

- - - -

-Overview

-The QCDemo classes in the package com.SoftWoehr.JTOpenContrib.QCDemo implement -the tabbed notebook described the QCDemo User Manual.  -All source is present alongside the classes in the qcdemo.jar -file; unpack the jar to see the source. -

Also present in the jar are the NetBeans -forms which were produced by the design tool. They are included for the -convenience of NetBeans/Sun Forte users, but are not necessary to compile, -modify or run the application. -

Source code documentation in Javadoc form -is also provided, though in some cases it is perfunctory. -

-Design -of the QCDemo package

-Well, it wasn't so much designed as it grew. The author was experimenting -with NetBeans and JTOpen -at the same time. One aspect of the current age of interactive development -environments is that in the MVC Model-View-Controller paradigm, the controller -tends to get shoved aside, chopped up and parcelled out between graphic -components. -

To some extent, we have tried to avoid this, but much more could be -and should have been done. Therefore, we do not present the application -architecture we have adopted in the course of this two-week programming -lark as representative of our thoughts on application architecture. There -is a QCMgr class which manages shared connections; it is simplistic but -correct as far as it goes. Contrarily, references to the JTOpen ErrorDialogAdapter -shared by all the QCDemo classes that use that facility are manually passed -from component to component at initialization rather than being mantained -by a manager class. -

We are more convinced than ever that -

    -
  • -Shared facilities should reside in a central manager.
  • - -
  • -References to the manager should be provided to the components.
  • - -
      -
    • -A simple way to do this is via static methods of the manager class which -maintain a vector of manager instances identified by some URL which -the clients can pass to obtain the original reference.
    • -
    - -
  • -Components should call public functions of the manager for services.
  • -
-Even in an IDE there is no problem in doing this, witness the QCMgr class -and supporting classes of QCDemo. However, IDE's tend to make it appear -simpler to skip this factoring out of the controller. We wish to assure -you that the savings only go as far as trivial applications the size of -QCDemo. Were this application to grow any larger, it would be necessary -to complete the postponed factoring. -

Fairmount, Colorado July, 2000 -
  - - diff --git a/cvsroot/demos/qcdemo/html/userman.html b/cvsroot/demos/qcdemo/html/userman.html deleted file mode 100644 index 99f0f7caf..000000000 --- a/cvsroot/demos/qcdemo/html/userman.html +++ /dev/null @@ -1,464 +0,0 @@ - - - - - - - - SoftWoehr QCDemo User Manual - - - -

-

-SoftWoehr QCDemo User -Manual

- -
Copyright 2000, Jack J. Woehr -
P.O. Box 51, Golden, Colorado 80402-0051
- -

-Table of Contents

- - - -

-DISCLAIMER

-USE AT YOUR OWN RISK. THERE IS NO GUARANTEE OR WARANTEE FOR THIS -FREE SOFTWARE. QCDemo can modify files and settings on any AS/400 -to which it is connected. To the best of our belief, it performs exactly -what you direct it to do, which is dangerous enough, isn't it? Other slightly -dangerous aspects of JTOpen itself include the following: -
    -
  • -Your logins are real AS400 logins!
  • - -
      -
    • -Three password failures and OS/400 may lock you out of your account until -QSECOFR deals with it.
    • -
    - -
  • -YOUR LOGINS ARE ENCRYPTED BUT YOUR DATA GO OVER THE NETWORK UNENCRYPTED.
  • - -
      -
    • -There is indeed a SecureAS400 component in the JTOpen toolkit, but your -author didn't use it in QCDemo.
    • -
    -
- -

-System Requirements

-To run QCDemo you need the following which are not provided with QCDemo: -
    -
  • -The Java environment.
  • - -
      -
    • -We have only tested QCDemo on Java -1.3.
    • -
    - -
  • -IBM's JTOpen -toolkit for the AS/400.
  • - -
  • -An AS/400 which is accessible via TCP/IP from the machine on which QCDemo -runs.
  • - -
      -
    • -We have not tested QCDemo running on an AS/400 under the RemoteAWT.
    • -
    -
- -

-Launching QCDemo

-Make sure the following are in your classpath, or add them via the -classpath -argument to the Java environment: -
    -
  • -The JTOpen jar file jt400.jar
  • - -
  • -The QCDemo jar file qcdemo.jar
  • -
-The main class of the QCDemo jar file is -
com.SoftWoehr.JTOpenContrib.QCDemo.QCDemo
-Enter a command appropriate to your installation to run the main class -of the QCDemo jar file, such as -
java com.SoftWoehr.JTOpenContrib.QCDemo.QCDemo
- -

-General -Considerations

-QCDemo opens a window with a tabbed notebook in it. Each tab demonstrates -one or more beans from the JTOpen project and offers access to different -resources. The tabs should be self-explanatory. Use the widgets which the -tab pane presents to operate on your AS/400, or flip to another tab to -perform a different task. Please remember when you are connected to -your AS/400 that any changes you make using QCDemo are real! -

Each tab pane allows you to make a connection to an AS/400 independently -of the other tab panes. Thus, all the tab panes can be connected to the -same AS/400 or to different AS/400s. You can change the connection of any -page. Connections are managed centrally so that resources are used economically. -There is a tab pane for seeing the managed connections; its tab says "Connection -Manager". -

Help for using QCDemo is provided by this document and by flyover text -which pops up over different fields and buttons if you leave the mouse -pointer sitting over these fields and buttons for a few seconds. -

Much of the data returned by JT400 components is in the form of graphic -objects having their own popup menus. Try right-clicking on graphic objects -returned in the windows of QCDemo; often more information can be returned -and operations performed on the target AS400 in this fashion. -

-The Individual -Tabs

-There are currently ten (10) tabs to the QCDemo notebook. They are described -and illustrated below in their notebook order. -

-The Command -Tab

-The Command Tab illustrates JTOpen's AS400CommandButto and allows you to -execute a non-interactive command on the AS/400. You are informed of completion -of the command and any error messages are returned. -
    -
  1. -Enter the name of the server.
  2. - -
  3. -Press the Set System button.
  4. - -
  5. -Enter the command and press enter.
  6. - -
  7. -The command button is now set to the command and its legend changes.
  8. - -
  9. -Press the button to execute the command.
  10. - -
  11. -Wait for the completion message before continuing.
  12. -
-Below, the execution of a successful command is illustrated. -

QCDemo Command Tab -

Below, the execution of an unsuccessful command is illustrated. -

QCDemo Command Tab after a bad command -

-The IFS Tab

-The IFS Tab allows you to navigate the file system. Clicking on graphic -objects returned frequently returns more information. Please note that -while your author has set the hourglass "wait" cursor for the original -load of the IFS data, the returned graphic components don't do the same. -Therefore, if you click on an object and the window seems to lock up, it's -just the component fetching more data. -
    -
  1. -Enter the system name
  2. - -
  3. -Press the Set System button.
  4. - -
  5. -Enter the IFS path you wish to explore.
  6. - -
  7. -Press the Set IFS Path button.
  8. -
-You may also switch views between -
    -
  • -Explorer
  • - -
  • -Details
  • - -
  • -List
  • - -
  • -Tree
  • -
-views by using the clearly labeled buttons provided for this purpose. -

Below, a session with the IFS Tab in an explorer view is illustrated. -

-

-The User List -Tab

-The User List Tab returns a list of those users whose profiles you are -authorized to access on the server of your choice. -
    -
  1. -Enter the system name.
  2. - -
  3. -Press the Get User List button.
  4. -
-Below, a session with the User List Tab is illustrated. -

QCDemo User List Tab -

-The Job List -Tab

-The Job List Tab returns a list of active jobs you are authorized to access -on the server of your choice. -
    -
  1. -Enter the system name.
  2. - -
  3. -Enter the selection criteria or *ALL.
  4. - -
  5. -Press the Get User List button.
  6. -
-NOTE that if you ask for jobs you aren't authorized to see, you -may receive many, many error dialog popups, one after another, one or two -for each job! -

Below, a session with the Job List Tab is illustrated. -

QCDemo Job List Panel -

-The Printer -List Tab

-The Printer List Tab returns a list of printers and documents on the server -of your choice. -
    -
  1. -Enter the system name.
  2. - -
  3. -Enter the selection criteria or *ALL.
  4. - -
  5. -Press the Get Printer List button.
  6. -
-NOTE that this panel may come up with the separator bar all the -way over to the left hiding the printer list. Just grab the bar with the -mouse and slide it to the right. (See Bugs.) -

Click on a printer to see its documents. -

Below, a session with the Printer List Tab is illustrated. -

QCDemo Printer List Panel -

-The -Spooled File Viewer Tab

-The Spooled File Viewer Tab returns a printable WYSIWYG view of spooled -files on the server of your choice. -
    -
  1. -Enter the system name.
  2. - -
  3. -Enter the spooled file name.
  4. - -
  5. -Enter the spooled file number
  6. - -
  7. -Enter the job name which produced the spooled file.
  8. - -
  9. -Enter the user name which produced the spooled file.
  10. - -
  11. -Enter the job number which produced the spooled file.
  12. - -
  13. -Press the View Spool File button.
  14. -
-NOTE that since graphic data is transferred in this operation it -may take a bit of time. -

Below, a session with the Spooled File Viewer Tab is illustrated. -

QCDemo Spooled File Viewer Tab -

-The -SQL Query Builder Tab

-The SQL Query Builder Tab presents a JTOpen SQL Query Builder pane. You -can create SQL queries and execute them, sending the results to either -the SQL Result Table Tab or the -SQL -Result Form Tab. -
    -
  1. -Choose a driver from the radio buttons offered. The URL will then be partially -filled in by QCDemo.
  2. - -
      -
    • -If you choose "Custom" you must enter the full classname of the driver -you wish to load, as well as edit the JDBC URL to suit what that driver -expects.
    • - -
        -
      • -QCDemo assumes that the custom driver possesses a class static method which -will register the driver. QCDemo does not attempt to register the custom -driver.
      • -
      -
    - -
  3. -Finish the partial URL by adding the server name and any other JDBC URL -information such as
  4. - -
      -
    • -Database
    • - -
    • -Username
    • - -
    • -Password
    • -
    - -
  5. -Press the Connect Now button.
  6. - -
  7. -If you connect successfully, you are now ready to formulate queries.
  8. - -
      -
    • -See the JTOpen documentation for more information on using the SQL Query -Builder itself.
    • -
    - -
  9. -When you wish to execute the query, press either Do Query button depending -on which Result Tab you wish the results of your query to go to.
  10. - -
  11. -Flip to the Result Tab of your choice to see the results of your query.
  12. -
-Below, a session with SQL Query Builder Tab is illustrated. -

QCDemo SQL Query Builder Tab -

See also the SQL Result Table Tab -and SQL Result Form Tab. -

-The -SQL Result Table Tab

-The SQL Result Table Tab shows the results of using the SQL -Query Builder Tab in a table, as illustrated below. -

QCDemo SQL Query Result Table Tab -

-The -SQL Result Form Tab

-The SQL Result Table Tab shows the results of using the SQL -Query Builder Tab in a form, as illustrated below. -

QCDemo SQL Result Form Tab -

-The -Connection Manager Tab

-The Connection Manager Tab shows the QCDemo simple connection manager's -current status. This view does not update itself. You must push the Refresh -button to update the view. -

The display of the Connection Manager Tab is illustrated below. -

QCDemo Connection Manager Tab -

There is more information about the Connection Manager in the QCDemo -Programmer Manual. -

-Bugs

- -
    -
  • -Your author has not really mastered window resizing issues with JTOpen -JavaBean component windows. With certain panels such as the IFS -Tab, when they load their data they occasionally resize themselves -so that either their draggable panel separator bar is over to one side -of the screen hiding the data, or they redraw a bit small. You can usually -straighten this effect out by moving separator bars with your mouse.
  • - -
  • -Some panels misbehave a bit if you fail to connect or if you repeatedly -do not log on correctly. Usually poking around with the mouse (not too -much or too rapidly!) and waiting a while will straighten this out.
  • - -
      -
    • -Some of the JTOpen components themselves are not terribly graceful about -a large number of errors, e.g., when you ask for a list of all jobs and -there are many jobs which you don't have authorization for. Try it yourself -if you are bored but patient!
    • -
    - -
  • -The connection manager is extremely simplistic and serves only as an illustration, -e.g.:
  • - -
      -
    • -It thinks AS400 and as400 are two different machines.
    • - -
    • -It may have the service names wrong for the services actually used.
    • -
    - -
  • -Your author was learning the Sun Forte IDE at the same time as experimenting -with JTOpen. You will notice some of the panels are better designed than -others. The better designed ones were done later in the week :-).
  • - -
  • -Please report other bugs you find to the author, Jack -J. Woehr (jax@well.com)
  • -
-Fairmount, Colorado July, 2000 - - diff --git a/cvsroot/demos/validationlist/com/kingland/as400/access/util/ChangeValidationListEntry.java b/cvsroot/demos/validationlist/com/kingland/as400/access/util/ChangeValidationListEntry.java deleted file mode 100644 index 705789d85..000000000 --- a/cvsroot/demos/validationlist/com/kingland/as400/access/util/ChangeValidationListEntry.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.kingland.as400.access.util; - -import com.ibm.as400.access.*; -import com.kingland.as400.access.*; - -/** - * Copyright � 2001, International Business Machines Corporation and others. All Rights Reserved. - ** - *

- * Example program to change the contents of an AS/400 validation list entry. - *

- * Call syntax: ChangeValidationListEntry validationListPath ccsid - * oneWayEncrypted[*YES|*NO] entryID encryptedData unencryptedData - *
- * Example: ChangeValidationListEntry /qsys.lib/qgpl.lib/test.vldl 37 *yes bob password data - * - * @author Thomas Johnson (tom.johnson@kingland.com), Kingland Systems Corporation - */ -public class ChangeValidationListEntry extends ValidationListUtil { - static final String COPYRIGHT = - "Copyright � 2001, International Business Machines Corporation and others. All Rights Reserved."; -/** - * Default constructor. - */ -private ChangeValidationListEntry() { - super(); -} -/** - * ChangeValidationListEntry constructor. - */ -public ChangeValidationListEntry(String vldlPath, int ccsid, boolean oneWayEncrypt) { - this(); - ccsid_ = ccsid; - oneWayEncrypt_ = oneWayEncrypt; - vldl_ = new ValidationList( - getAS400(), new QSYSObjectPathName(vldlPath)); -} - -/** - * Starts the application. - * @param args an array of command-line arguments - */ -public static void main(java.lang.String[] args) { - // Check for correct number of arguments - if (args.length < 6) { - syntaxNotCorrect(); - return; - } - try { - // Run the app - new ChangeValidationListEntry( args[0], new Integer(args[1]).intValue(), !args[2].equalsIgnoreCase("*NO") - ).chgwebusr( - args[3], - args[4], - args[5]); - } catch (Exception e) { - e.printStackTrace(); - } finally { - System.exit(0); - } -} -/** - * Displays output indicating the expected syntax. - */ -private static void syntaxNotCorrect() { - System.out.println(""); - System.out.println("Parameters are not correct. Expected syntax is:"); - System.out.println(""); - System.out.println("ChangeValidationListUser validationListPath oneWayEncrypted[*YES|*NO] ccsid "+ - "entryID encryptedData unencryptedData"); - System.out.println(""); - System.out.println("For example:"); - System.out.println(""); - System.out.println(" ChangeValidationListUser /qsys.lib/qgpl.lib/test.vldl 37 *yes bob password newData"); - System.out.println(""); - System.out.println(""); -} - -/** - * Services the request. - * - * @param id - * The entry ID to change. - * @param pwd - * The new encrypted data. - * @param data - * The new unencrypted data. - */ -protected void chgwebusr(String id, String pwd, String data) { - ValidationListEntry vle = new ValidationListEntry(); - - try { - // Assign the entry ID - vle.setEntryID( - new ValidationListTranslatedData(id, ccsid_, getAS400())); - // Assign the encrypted data (i.e. password) - vle.setDataToEncrypt( - new ValidationListDataToEncrypt(pwd, ccsid_, getAS400())); - // Assign the attribute indicating one or two-way encryption - vle.setAttributeInfo( - new ValidationListAttributeInfo( - new ValidationListAttribute[] - { getEncryptAttribute() })); - // Assign the unencrypted data - vle.setUnencryptedData( - new ValidationListTranslatedData(data, ccsid_, getAS400())); - // Perform the change - vldl_.changeEntry(vle); - } - catch (PersistenceException pe) { - pe.printStackTrace(); - } -} -} \ No newline at end of file diff --git a/cvsroot/demos/validationlist/com/kingland/as400/access/util/CompareValidationListEntries.java b/cvsroot/demos/validationlist/com/kingland/as400/access/util/CompareValidationListEntries.java deleted file mode 100644 index edb33c2c0..000000000 --- a/cvsroot/demos/validationlist/com/kingland/as400/access/util/CompareValidationListEntries.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.kingland.as400.access.util; - -import com.ibm.as400.access.*; -import com.kingland.as400.access.*; -import java.util.*; - -/** - * Copyright � 2001, International Business Machines Corporation and others. All Rights Reserved. - ** - *

- * Example program to compare the contents of two AS/400 validation lists. - * Differences are printed to standard output. - *

- * Call syntax: CompareValidationListEntries validationListPath1 validationListPath2 - *
- * Example: CompareValidationListEntries /qsys.lib/qgpl.lib/test1.vldl /qsys.lib/qgpl.lib/test2.vldl - * - * @author Thomas Johnson (tom.johnson@kingland.com), Kingland Systems Corporation - */ -public class CompareValidationListEntries extends ValidationListUtil { - static final String COPYRIGHT = - "Copyright � 2001, International Business Machines Corporation and others. All Rights Reserved."; -/** - * Default constructor. - */ -public CompareValidationListEntries() { - super(); -} -/** - * Print a list of differences (ids & non-encrypted data) to System.out - */ -public void compare(String vldlPath1, String vldlPath2) { - AS400 as400 = getAS400(); - ValidationList vl1 = new ValidationList(as400, new QSYSObjectPathName(vldlPath1)); - ValidationList vl2 = new ValidationList(as400, new QSYSObjectPathName(vldlPath2)); - - ValidationListEntry vle1, vle2; - ValidationListEntry[] entries1, entries2 = new ValidationListEntry[0]; - Hashtable vl2Hash = null; - - // Cumulative statistics - int addCount = 0; - int deleteCount = 0; - int changeCount = 0; - - try { - // Print report header - System.out.println("*** Comparing source... "+vldlPath1); - System.out.println("*** To target ......... "+vldlPath2); - System.out.println(); - - // Retrieve all entries for each list - entries1 = vl1.getEntries(); - entries2 = vl2.getEntries(); - - System.out.println(" Source contains "+entries1.length+" entries..."); - System.out.println(" Target contains "+entries2.length+" entries..."); - System.out.println(); - - // Create a hash from the target list, keyed on ID - vl2Hash = new Hashtable(); - for (int i=0; i - * Example program to delete a specific entry from a validation list. - *

- * Call syntax: DeleteValidationListEntry validationListPath ccsid entryID - *
- * Example: DeleteValidationListEntry /qsys.lib/qgpl.lib/test.vldl 37 bob - * - * @author Thomas Johnson (tom.johnson@kingland.com), Kingland Systems Corporation - */ -public class DeleteValidationListEntry extends ValidationListUtil { - static final String COPYRIGHT = - "Copyright � 2001, International Business Machines Corporation and others. All Rights Reserved."; -/** - * Default constructor. - */ -private DeleteValidationListEntry() { - super(); -} -/** - * DeleteValidationListEntry constructor. - */ -public DeleteValidationListEntry(String vldlPath, int ccsid) { - this(); - ccsid_ = ccsid; - vldl_ = new ValidationList( - getAS400(), new QSYSObjectPathName(vldlPath)); -} - -/** - * Starts the application. - * @param args an array of command-line arguments - */ -public static void main(java.lang.String[] args) { - // Check for correct number of arguments - if (args.length < 3) { - syntaxNotCorrect(); - return; - } - try { - // Run the app - new DeleteValidationListEntry( args[0], new Integer(args[1]).intValue() - ).dltEntry(args[2]); - } catch (Exception e) { - e.printStackTrace(); - } finally { - System.exit(0); - } -} -/** - * Displays output indicating the expected syntax. - */ -private static void syntaxNotCorrect() { - System.out.println(""); - System.out.println("Parameters are not correct. Expected syntax is:"); - System.out.println(""); - System.out.println("DeleteValidationListEntry validationListPath ccsid entryID"); - System.out.println(""); - System.out.println("For example:"); - System.out.println(""); - System.out.println(" DeleteValidationListEntry /qsys.lib/qgpl.lib/test.vldl 37 bob"); - System.out.println(""); - System.out.println(""); -} - -/** - * Services the request. - * - * @param id - * The ID of the entry to delete. - */ -protected void dltEntry(String id) { - try { - ValidationListEntry entry = new ValidationListEntry(); - entry.setEntryID( - new ValidationListTranslatedData(id, ccsid_, getAS400())); - vldl_.removeEntry(entry); - } - catch (PersistenceException pe) { - pe.printStackTrace(); - } -} -} \ No newline at end of file diff --git a/cvsroot/demos/validationlist/com/kingland/as400/access/util/InsertValidationListEntry.java b/cvsroot/demos/validationlist/com/kingland/as400/access/util/InsertValidationListEntry.java deleted file mode 100644 index 5fe3ab250..000000000 --- a/cvsroot/demos/validationlist/com/kingland/as400/access/util/InsertValidationListEntry.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.kingland.as400.access.util; - -import com.ibm.as400.access.*; -import com.kingland.as400.access.*; - -/** - * Copyright � 2001, International Business Machines Corporation and others. All Rights Reserved. - ** - *

- * Example program to insert an AS/400 validation list entry. - *

- * Call syntax: InsertValidationListEntry validationListPath ccsid - * oneWayEncrypted[*YES|*NO] entryID encryptedData unencryptedData - *
- * Example: InsertValidationListEntry /qsys.lib/qgpl.lib/test.vldl 37 *yes bob password data - * - * @author Thomas Johnson (tom.johnson@kingland.com), Kingland Systems Corporation - */ -public class InsertValidationListEntry extends ValidationListUtil { - static final String COPYRIGHT = - "Copyright � 2001, International Business Machines Corporation and others. All Rights Reserved."; -/** - * Default constructor. - */ -private InsertValidationListEntry() { - super(); -} -/** - * InsertValidationListEntry constructor. - */ -public InsertValidationListEntry(String vldlPath, int ccsid, boolean oneWayEncrypt) { - this(); - ccsid_ = ccsid; - oneWayEncrypt_ = oneWayEncrypt; - vldl_ = new ValidationList( - getAS400(), new QSYSObjectPathName(vldlPath)); -} - -/** - * Starts the application. - * @param args an array of command-line arguments - */ -public static void main(java.lang.String[] args) { - // Check for correct number of arguments - if (args.length < 6) { - syntaxNotCorrect(); - return; - } - try { - // Run the app - new InsertValidationListEntry( args[0], new Integer(args[1]).intValue(), !args[2].equalsIgnoreCase("*NO") - ).addwebusr( - args[3], - args[4], - args[5]); - } catch (Exception e) { - e.printStackTrace(); - } finally { - System.exit(0); - } -} -/** - * Displays output indicating the expected syntax. - */ -private static void syntaxNotCorrect() { - System.out.println(""); - System.out.println("Parameters are not correct. Expected syntax is:"); - System.out.println(""); - System.out.println("InsertValidationListEntry validationListPath oneWayEncrypted[*YES|*NO] ccsid "+ - "entryID encryptedData unencryptedData"); - System.out.println(""); - System.out.println("For example:"); - System.out.println(""); - System.out.println(" InsertValidationListEntry /qsys.lib/qgpl.lib/test.vldl 37 *yes bob password data"); - System.out.println(""); - System.out.println(""); -} - -/** - * Services the request. - * - * @param id - * The entry ID to add. - * @param pwd - * The encrypted data. - * @param data - * The unencrypted data. - */ -protected void addwebusr(String id, String pwd, String data) { - ValidationListEntry vle = new ValidationListEntry(); - - try { - // Assign the entry ID - vle.setEntryID( - new ValidationListTranslatedData(id, ccsid_, getAS400())); - // Assign the encrypted data (i.e. password) - vle.setDataToEncrypt( - new ValidationListDataToEncrypt(pwd, ccsid_, getAS400())); - // Assign the attribute indicating one or two-way encryption - vle.setAttributeInfo( - new ValidationListAttributeInfo( - new ValidationListAttribute[] - { getEncryptAttribute() })); - // Assign the unencrypted data - vle.setUnencryptedData( - new ValidationListTranslatedData(data, ccsid_, getAS400())); - // Perform the add - vldl_.addEntry(vle); - } - catch (PersistenceException pe) { - pe.printStackTrace(); - } -} -} \ No newline at end of file diff --git a/cvsroot/demos/validationlist/com/kingland/as400/access/util/ListValidationListEntries.java b/cvsroot/demos/validationlist/com/kingland/as400/access/util/ListValidationListEntries.java deleted file mode 100644 index f56dc6965..000000000 --- a/cvsroot/demos/validationlist/com/kingland/as400/access/util/ListValidationListEntries.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.kingland.as400.access.util; - -import com.ibm.as400.access.*; -import com.kingland.as400.access.*; - -/** - * Copyright � 2001, International Business Machines Corporation and others. All Rights Reserved. - ** - *

- * Example program to list the entries in an AS/400 validation list. - *

- * Call syntax: ListValidationListEntries validationListPath - *
- * Example: ListValidationListEntries /qsys.lib/qgpl.lib/test.vldl - * - * @author Thomas Johnson (tom.johnson@kingland.com), Kingland Systems Corporation - */ -public class ListValidationListEntries extends ValidationListUtil { - static final String COPYRIGHT = - "Copyright � 2001, International Business Machines Corporation and others. All Rights Reserved."; -/** - * Default constructor. - */ -public ListValidationListEntries() { - super(); -} -/** - * Print a list of entries (ids & non-encrypted data) to System.out - */ -public void displayEntries(String vldlPath) { - AS400 as400 = getAS400(); - ValidationList vl = new ValidationList(as400, new QSYSObjectPathName(vldlPath)); - ValidationListEntry vle; - ValidationListEntry[] entries = new ValidationListEntry[0]; - - try { - // Print report header - System.out.println("*** Listing source... "+vldlPath); - // Retrieve all entries - entries = vl.getEntries(); - System.out.println(" Source contains "+entries.length+" entries..."); - System.out.println(); - - // Now run through the list and display - String id; - for (int i=0; i"+id+" "); - System.out.print("Unencrypted data==>"+entries[i].getUnencryptedData().getString(as400)); - System.out.println(); - } catch (Exception e) { - System.out.println(e); - } - } - } catch (Exception e) { - e.printStackTrace(); - } -} -/** - * Starts the application. - * @param args an array of command-line arguments - */ -public static void main(java.lang.String[] args) { - // Check for correct number of arguments - if (args.length < 1) { - syntaxNotCorrect(); - return; - } - try { - // Run the app - new ListValidationListEntries().displayEntries(args[0]); - } catch (Exception e) { - e.printStackTrace(); - } finally { - System.exit(0); - } -} -/** - * Displays output indicating the expected syntax. - */ -private static void syntaxNotCorrect() { - System.out.println(""); - System.out.println("Parameters are not correct. Expected syntax is:"); - System.out.println(""); - System.out.println(" ListValidationListEntries validationListPath"); - System.out.println(""); - System.out.println("For example:"); - System.out.println(""); - System.out.println(" ListValidationListEntries /qsys.lib/qgpl.lib/test.vldl"); - System.out.println(""); - System.out.println(""); -} -} \ No newline at end of file diff --git a/cvsroot/demos/validationlist/com/kingland/as400/access/util/RetrieveValidationListEntryEncryptedData.java b/cvsroot/demos/validationlist/com/kingland/as400/access/util/RetrieveValidationListEntryEncryptedData.java deleted file mode 100644 index 0258cd957..000000000 --- a/cvsroot/demos/validationlist/com/kingland/as400/access/util/RetrieveValidationListEntryEncryptedData.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.kingland.as400.access.util; - -import com.ibm.as400.access.*; -import com.kingland.as400.access.*; - -/** - * Copyright � 2001, International Business Machines Corporation and others. All Rights Reserved. - ** - *

- * Example program to retrieve and display the encrypted information stored - * in a validation list entry. - *

- * Note: Encrypted information cannot be retrieved if one-way encrypted on insertion into - * the validation list. - *

- * Call syntax: RetrieveValidationListEntryEncryptedData validationListPath ccsid entryID - *
- * Example: RetrieveValidationListEntryEncryptedData /qsys.lib/qgpl.lib/test.vldl 37 bob - * - * @author Thomas Johnson (tom.johnson@kingland.com), Kingland Systems Corporation - */ -public class RetrieveValidationListEntryEncryptedData { - static final String COPYRIGHT = - "Copyright � 2001, International Business Machines Corporation and others. All Rights Reserved."; -/** - * Default constructor. - */ -public RetrieveValidationListEntryEncryptedData() { - super(); -} - -/** - * Starts the application. - * @param args an array of command-line arguments - */ -public static void main(java.lang.String[] args) { - // Check for correct number of arguments - if (args.length < 3) { - syntaxNotCorrect(); - return; - } - try { - // Run the app - new RetrieveValidationListEntryEncryptedData().findEntry( - args[0], - new Integer(args[1]).intValue(), - args[2]); - } catch (Exception e) { - e.printStackTrace(); - } finally { - System.exit(0); - } -} -/** - * Displays output indicating the expected syntax. - */ -private static void syntaxNotCorrect() { - System.out.println(""); - System.out.println("Parameters are not correct. Expected syntax is:"); - System.out.println(""); - System.out.println(" RetrieveValidationListEntryEncryptedData validationListPath ccsid entryID"); - System.out.println(""); - System.out.println("For example:"); - System.out.println(""); - System.out.println(" RetrieveValidationListEntryEncryptedData /qsys.lib/qgpl.lib/test.vldl 37 bob"); - System.out.println(""); - System.out.println(""); -} - -/** - * Find & print the entry (id & encrypted data) to System.out - */ -public void findEntry(String vldlPath, int ccsid, String id) { - AS400 as400 = new AS400(); - ValidationList vldl = new ValidationList(as400, new QSYSObjectPathName(vldlPath)); - - ValidationListAttributeData attrData = new ValidationListAttributeData(); - attrData.setCcsid(-1); - attrData.setBytes(new AS400Text(1, 65535, as400).toBytes("1")); - - ValidationListAttribute[] attrs = new ValidationListAttribute[1]; - ValidationListAttribute attr = new ValidationListAttribute(as400); - attr.setIdentifier("QsyEncryptData"); - attrs[0] = attr; - - try { - ValidationListEntry entry = vldl.findEntry(id, ccsid, attrs); - System.out.println("Encrypted data==>"+entry.getEncryptedData().getString(as400)); - } catch (Exception e) { - System.out.println("Encrypted data not retrieved."); - e.printStackTrace(); - } -} -} \ No newline at end of file diff --git a/cvsroot/demos/validationlist/com/kingland/as400/access/util/ValidationListUtil.java b/cvsroot/demos/validationlist/com/kingland/as400/access/util/ValidationListUtil.java deleted file mode 100644 index 4434217c5..000000000 --- a/cvsroot/demos/validationlist/com/kingland/as400/access/util/ValidationListUtil.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.kingland.as400.access.util; - -import com.ibm.as400.access.*; -import com.kingland.as400.access.*; - -/** - * Copyright � 2001, International Business Machines Corporation and others. All Rights Reserved. - ** - *

- * Abstract superclass for validation list utilities & examples. - * - * @author Thomas Johnson (tom.johnson@kingland.com), Kingland Systems Corporation - */ -abstract class ValidationListUtil { - static final String COPYRIGHT = - "Copyright � 2001, International Business Machines Corporation and others. All Rights Reserved."; - - protected int ccsid_ = 37; - protected ValidationList vldl_ = null; - protected boolean oneWayEncrypt_ = true; - - protected AS400 as400_ = null; - -/** - * Return the AS/400 system object. - * @return com.ibm.as400.access.AS400 - */ -protected AS400 getAS400() { - if (as400_ == null) - as400_ = new AS400(); - return as400_; -} - -/** - * Returns a QsyEncryptData attribute based on the oneWayEncrypt_ field. - *

- * When the attribute value is '0', the encrypted data (i.e. password) cannot be retrieved. - *

- * Note: The system value QRETSVRSEC (Retain server security data) still has the final say - * in determining if the original data is allowed to be stored with the entry. - * - * @return - * com.kingland.as400.access.ValidationListAttribute - */ -protected ValidationListAttribute getEncryptAttribute() { - ValidationListAttribute attr = null; - - attr = new ValidationListAttribute(getAS400()); - attr.setIdentifier("QsyEncryptData"); - ValidationListAttributeData attrData = new ValidationListAttributeData(); - attrData.setCcsid(-1); - attrData.setBytes(new AS400Text(1, 65535, getAS400() - ).toBytes(oneWayEncrypt_ ? "0" : "1")); - attr.setData(attrData); - - return attr; -} -} \ No newline at end of file diff --git a/cvsroot/include/.project b/cvsroot/include/.project deleted file mode 100644 index 8df4542bb..000000000 --- a/cvsroot/include/.project +++ /dev/null @@ -1,11 +0,0 @@ - - - include - - - - - - - - diff --git a/cvsroot/include/com/ibm/as400/access/KeyRing.class b/cvsroot/include/com/ibm/as400/access/KeyRing.class deleted file mode 100644 index 541e1d1f0..000000000 Binary files a/cvsroot/include/com/ibm/as400/access/KeyRing.class and /dev/null differ diff --git a/cvsroot/include/com/ibm/as400/access/PSSecureServerSocketContainer.class b/cvsroot/include/com/ibm/as400/access/PSSecureServerSocketContainer.class deleted file mode 100644 index 99bc1d9a5..000000000 Binary files a/cvsroot/include/com/ibm/as400/access/PSSecureServerSocketContainer.class and /dev/null differ diff --git a/cvsroot/include/com/ibm/as400/access/PSSecureServerSocketContainer.java b/cvsroot/include/com/ibm/as400/access/PSSecureServerSocketContainer.java deleted file mode 100644 index 17e77a309..000000000 --- a/cvsroot/include/com/ibm/as400/access/PSSecureServerSocketContainer.java +++ /dev/null @@ -1,139 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PSSecureServerSocketContainer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.access; - -import com.ibm.sslight.SSLContext; -import com.ibm.sslight.SSLException; -import com.ibm.sslight.SSLServerSocket; -import com.ibm.sslight.SSLSocket; -import java.io.IOException; -import java.net.ServerSocket; -import java.net.Socket; - - - -/** -The PSSecureServerSocketContainer class represents a wrapper -around an SSL server socket. -**/ -class PSSecureServerSocketContainer -extends PSServerSocketContainerAdapter -{ - - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - - // MRI. - private static final String NAME_ = ResourceBundleLoader.getText ("PROXY_SERVER_SECURE_CONTAINER"); - - - - -/** -Constructs a PSSecureServerSocketContainer object. - -@param port The port. - -@exception IOException If an error occurs. -**/ - public PSSecureServerSocketContainer (int port, String keyringName, String keyringPwd) //$B1C - throws IOException - { - super (createSSLServerSocket (port, keyringName, keyringPwd)); //$B1C - } - - - -/** -Accepts a connection to the socket. - -@return The socket for the connection. - -@exception IOException If an error occurs. -**/ - public Socket accept () - throws IOException - { - boolean connected = false; //$B1A - SSLSocket socket = null; //$B1A - - // Continue to accept connections even if there is an SSLException. That exception - // may be due to an invalid Keyring. The detailed error trace will give more - // information as to why the proxy did not accept the SSL connection. - // If a connection is made, then we return the SSLSocket. //$B1A - while (!connected) //$B1A - { - try - { - socket = (SSLSocket) ((SSLServerSocket) serverSocket_).accept (null); //$B1C - - if (Trace.isTraceOn ()) - PxSecureSocketContainer.traceSSLSocket (socket); - - connected = true; //$B1A - } - catch (SSLException e) - { - if (Trace.isTraceOn()) //$B1C - Trace.logSSL(Trace.DIAGNOSTIC, e.getCategory(), e.getError(), e.getInt1()); //$B1C - - connected = false; //$B1A - } - } - return socket; //$B1C - } - - - -/** -Creates an SSL server socket. - -@param port The port. -@return The server socket. - -@exception IOException If an error occurs. -**/ - private static ServerSocket createSSLServerSocket (int port, String keyringName, String keyringPwd) //$B1C - throws IOException - { - SSLContext context = PxSecureSocketContainer.initializeServerSSLContext (keyringName, keyringPwd);//$B1C - if (context == null) //$B1A - return null; //$B1A - else //$B1A - return new SSLServerSocket (port, context); - } - - - -/** -Indicates if the socket is secure. -**/ - public boolean isSecure () - { - return true; - } - - -/** -Returns the name of this container. - -@return The name of this container. -**/ - public String toString () - { - return NAME_; - } - - - -} diff --git a/cvsroot/include/com/ibm/as400/access/PxSecureSocketContainer.class b/cvsroot/include/com/ibm/as400/access/PxSecureSocketContainer.class deleted file mode 100644 index e13ffa48b..000000000 Binary files a/cvsroot/include/com/ibm/as400/access/PxSecureSocketContainer.class and /dev/null differ diff --git a/cvsroot/include/com/ibm/as400/access/PxSecureSocketContainer.java b/cvsroot/include/com/ibm/as400/access/PxSecureSocketContainer.java deleted file mode 100644 index b0f1869f2..000000000 --- a/cvsroot/include/com/ibm/as400/access/PxSecureSocketContainer.java +++ /dev/null @@ -1,205 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxSecureSocketContainer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.net.Socket; -import java.util.Date; - -import com.ibm.sslight.SSLCert; -import com.ibm.sslight.SSLContext; -import com.ibm.sslight.SSLSocket; -import com.ibm.sslight.SSLightKeyRing; -import com.ibm.sslight.SSLException; - -// The PxSecureSocketContainer class represents a wrapper around an SSL socket. -class PxSecureSocketContainer extends PxSocketContainerAdapter -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - // Constructs a PxSecureSocketContainer object. - // @param hostName The host name. - // @param port The port. - // @exception IOException If an error occurs. - public PxSecureSocketContainer(String hostName, int port, SSLOptions sslOptions) throws IOException - { - super(createSSLSocket(hostName, port, sslOptions)); - } - - // Creates an SSL socket. - // @param hostName The host name. - // @param port The port. - // @return The socket. - // @exception IOException If an error occurs. - private static Socket createSSLSocket(String hostName, int port, SSLOptions sslOptions) throws IOException - { - SSLContext context = initializeClientSSLContext(sslOptions); - SSLSocket socket = null; - try - { - socket = new SSLSocket(hostName, port, context, SSLSocket.CLIENT, null); - } - catch(SSLException e) - { - Trace.logSSL(Trace.DIAGNOSTIC, e.getCategory(), e.getError(), e.getInt1()); - throw e; // @B2A - } - if (Trace.isTraceOn()) traceSSLSocket(socket); - return socket; - } - - // Initializes the Proxy Clients SSL context. - // @return The context. - // @exception IOException If an error occurs. - static SSLContext initializeClientSSLContext(SSLOptions sslOptions) throws IOException - { - // Create the SSL context. - SSLContext context = new SSLContext(); - if (Trace.isTraceOn()) context.debug = true; - - // Load the key ring. - if (sslOptions.keyRingData_ == null) - { - try - { - SSLightKeyRing ring = (SSLightKeyRing)Class.forName(sslOptions.keyRingName_).newInstance(); - sslOptions.keyRingData_ = ring.getKeyRingData(); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Error loading key ring:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - boolean success = context.importKeyRings(sslOptions.keyRingData_, sslOptions.keyRingPassword_); - - // Trace the cipher suites. - if (Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "Import key rings successful = " + success + "."); - String[] cipherSuites = context.getEnabledCipherSuites(); - Trace.log(Trace.DIAGNOSTIC, "Enabled cipher suites:"); - for (int i = 0; i < cipherSuites.length; ++i) - { - Trace.log(Trace.DIAGNOSTIC, " " + cipherSuites[i]); - } - } - - return context; - } - - // Initializes the Proxy Servers SSL context. - // @param keyringName The name of the proxy servers keyring. - // @param keyringPwd The password to the proxy servers keyring. - // @return The context. - // @exception IOException If an error occurs. - static SSLContext initializeServerSSLContext(String keyringName, String keyringPwd)throws IOException - { - // Create the SSL context. - SSLContext context = null; - - // Load the key ring. - SSLightKeyRing keyRing = null; - boolean success = false; - try - { - keyRing = (SSLightKeyRing) Class.forName(keyringName).newInstance(); - String keyRingData = keyRing.getKeyRingData(); - - context = new SSLContext(); - - if (Trace.isTraceOn()) - context.debug = true; - - success = context.importKeyRings(keyRingData, keyringPwd); - } - catch (SSLException e) //$B1A - { //$B1A - context = null; //$B1A - if (Trace.isTraceOn()) //$B1A - Trace.logSSL(Trace.DIAGNOSTIC, e.getCategory(), e.getError(), e.getInt1()); //$B1A - } //$B1A - catch (InstantiationException e) - { - Trace.log(Trace.ERROR, "Unable to instantiate key ring object:", e); - } - catch (IllegalAccessException e) - { - Trace.log(Trace.ERROR, "Unable to access key ring object:", e); - } - catch (ClassNotFoundException e) - { - Verbose.println(" java.lang.ClassNotFoundException: " + keyringName); - Trace.log(Trace.ERROR, "Unable to locate key ring class:", e); - } - catch (NoClassDefFoundError e) - { - Verbose.println(" java.lang.NoClassDefFoundError: " + keyringName); - Trace.log(Trace.ERROR, "Unable to locate key ring class:", e); - } - - // Trace the cipher suites. - if (Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "Import key rings successful = " + success + "."); - - if (context != null) - { - String[] cipherSuites = context.getEnabledCipherSuites(); - Trace.log(Trace.DIAGNOSTIC, "Enabled cipher suites:"); - for (int i = 0; i < cipherSuites.length; ++i) - { - Trace.log(Trace.DIAGNOSTIC, " " + cipherSuites[i]); - } - } - } - - return context; - } - - // Logs trace information about an SSL socket. - // @param socket The socket. - static void traceSSLSocket(SSLSocket socket) - { - if (Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "SSL connection established."); - Trace.log(Trace.DIAGNOSTIC, "Cipher suite = " + socket.getCipherSuite() + "."); - Trace.log(Trace.DIAGNOSTIC, "Compression method = " + socket.getCompressionMethod() + "."); - - SSLCert[] peerCertificateChain = socket.getPeerCertificateChain(); - if (peerCertificateChain != null) - { - Trace.log(Trace.DIAGNOSTIC, "Peer certificate: " + peerCertificateChain[0].getKeyInfo() + " bits."); - int[] components = { SSLCert.CN, SSLCert.OU, SSLCert.O, SSLCert.C, SSLCert.L }; - for (int i = 0; i < components.length; ++i) - { - String nameComponent = peerCertificateChain[0].getNameComponent(SSLCert.SUBJECT, components[i]); - if (nameComponent != null) - { - Trace.log(Trace.DIAGNOSTIC, "Name component[" + i + "] = " + nameComponent + "."); - } - else - { - Trace.log(Trace.DIAGNOSTIC, "Name component[" + i + "] = (null)."); - } - } - Date[] validity = peerCertificateChain[0].getValidity(); - if (validity != null) - { - Trace.log(Trace.DIAGNOSTIC, "Valid from " + validity[0] + " to " + validity[1] + "."); - } - } - } - } -} diff --git a/cvsroot/include/com/ibm/as400/access/SocketContainerSSL.class b/cvsroot/include/com/ibm/as400/access/SocketContainerSSL.class deleted file mode 100644 index f7c7be6ec..000000000 Binary files a/cvsroot/include/com/ibm/as400/access/SocketContainerSSL.class and /dev/null differ diff --git a/cvsroot/include/com/ibm/as400/access/SocketContainerSSL.java b/cvsroot/include/com/ibm/as400/access/SocketContainerSSL.java deleted file mode 100644 index 7f4778851..000000000 --- a/cvsroot/include/com/ibm/as400/access/SocketContainerSSL.java +++ /dev/null @@ -1,122 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SocketContainerSSL.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.Socket; -import java.util.Date; - -import com.ibm.sslight.SSLCert; -import com.ibm.sslight.SSLContext; -import com.ibm.sslight.SSLSocket; -import com.ibm.sslight.SSLightKeyRing; - -// SocketContainerSSL contains a socket capable of SSL communications. -class SocketContainerSSL extends SocketContainer -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - private SSLSocket sslSocket_; - - void setProperties(Socket socket, String serviceName, String systemName, int port, SSLOptions options) throws IOException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "SocketContainerSSL: create SSLContext"); - SSLContext context = new SSLContext(); - - if (Trace.isTraceOn()) - { - context.debug = true; - } - - if (options.keyRingData_ == null) - { - try - { - SSLightKeyRing ring = (SSLightKeyRing)Class.forName(options.keyRingName_).newInstance(); - options.keyRingData_ = ring.getKeyRingData(); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Error loading key ring:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - context.importKeyRings(options.keyRingData_, options.keyRingPassword_); - - if (Trace.isTraceOn()) - { - String[] cipher_suites = context.getEnabledCipherSuites(); - Trace.log(Trace.DIAGNOSTIC, "Enabled cipher suites:"); - for (int i = 0; i < cipher_suites.length; ++i) - { - Trace.log(Trace.DIAGNOSTIC, " " + cipher_suites[i]); - } - } - - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "SocketContainerSSL: create SSLSocket"); - sslSocket_ = new SSLSocket(socket, false, context, SSLSocket.CLIENT, null); - if (Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "SSL connection established"); - Trace.log(Trace.DIAGNOSTIC, " cipher suite: " + sslSocket_.getCipherSuite()); - Trace.log(Trace.DIAGNOSTIC, " compression method: " + sslSocket_.getCompressionMethod()); - - SSLCert[] chain = sslSocket_.getPeerCertificateChain(); - if (chain != null) - { - Trace.log(Trace.DIAGNOSTIC, "Peer Certificate:"); - Trace.log(Trace.DIAGNOSTIC, chain[0].getKeyInfo() + " bits"); - int[] components = {SSLCert.CN, SSLCert.OU, SSLCert.O, SSLCert.C, SSLCert.L}; - for (int i = 0; i < components.length; ++i) - { - String nameComponent = chain[0].getNameComponent(SSLCert.SUBJECT, components[i]); - if (nameComponent != null) - { - Trace.log(Trace.DIAGNOSTIC, nameComponent); - } - else - { - Trace.log(Trace.DIAGNOSTIC, ""); - } - } - Date[] validity = chain[0].getValidity(); - if (validity != null) - { - Trace.log(Trace.DIAGNOSTIC, "Valid From: " + validity[0]); - Trace.log(Trace.DIAGNOSTIC, " To: " + validity[1]); - } - } - } - } - - void close() throws IOException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "SocketContainerSSL: close"); - sslSocket_.close(); - } - - InputStream getInputStream() throws IOException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "SocketContainerSSL: getInputStream"); - return sslSocket_.getInputStream(); - } - - OutputStream getOutputStream() throws IOException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "SocketContainerSSL: getOutputStream"); - return sslSocket_.getOutputStream(); - } -} diff --git a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_CONNOPT.pdml.ser b/cvsroot/include/com/ibm/as400/vaccess/AJDSP_CONNOPT.pdml.ser deleted file mode 100644 index 319f5db19..000000000 Binary files a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_CONNOPT.pdml.ser and /dev/null differ diff --git a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_FORMAT.pdml.ser b/cvsroot/include/com/ibm/as400/vaccess/AJDSP_FORMAT.pdml.ser deleted file mode 100644 index dc0048c04..000000000 Binary files a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_FORMAT.pdml.ser and /dev/null differ diff --git a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_GENERAL.pdml.ser b/cvsroot/include/com/ibm/as400/vaccess/AJDSP_GENERAL.pdml.ser deleted file mode 100644 index c3625a8a6..000000000 Binary files a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_GENERAL.pdml.ser and /dev/null differ diff --git a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_LANGUAGE.pdml.ser b/cvsroot/include/com/ibm/as400/vaccess/AJDSP_LANGUAGE.pdml.ser deleted file mode 100644 index e6b3b8044..000000000 Binary files a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_LANGUAGE.pdml.ser and /dev/null differ diff --git a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_OTHER.pdml.ser b/cvsroot/include/com/ibm/as400/vaccess/AJDSP_OTHER.pdml.ser deleted file mode 100644 index 76762f7f8..000000000 Binary files a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_OTHER.pdml.ser and /dev/null differ diff --git a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_PACKAGE.pdml.ser b/cvsroot/include/com/ibm/as400/vaccess/AJDSP_PACKAGE.pdml.ser deleted file mode 100644 index 0d2187ac4..000000000 Binary files a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_PACKAGE.pdml.ser and /dev/null differ diff --git a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_PERFORMANCE.pdml.ser b/cvsroot/include/com/ibm/as400/vaccess/AJDSP_PERFORMANCE.pdml.ser deleted file mode 100644 index 3eadbe3c5..000000000 Binary files a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_PERFORMANCE.pdml.ser and /dev/null differ diff --git a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_SERVER.pdml.ser b/cvsroot/include/com/ibm/as400/vaccess/AJDSP_SERVER.pdml.ser deleted file mode 100644 index 105fde3ac..000000000 Binary files a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_SERVER.pdml.ser and /dev/null differ diff --git a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_TABBEDPANE.pdml.ser b/cvsroot/include/com/ibm/as400/vaccess/AJDSP_TABBEDPANE.pdml.ser deleted file mode 100644 index 7ed2ade9a..000000000 Binary files a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_TABBEDPANE.pdml.ser and /dev/null differ diff --git a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_TRANSLATION.pdml.ser b/cvsroot/include/com/ibm/as400/vaccess/AJDSP_TRANSLATION.pdml.ser deleted file mode 100644 index 18e5b6b57..000000000 Binary files a/cvsroot/include/com/ibm/as400/vaccess/AJDSP_TRANSLATION.pdml.ser and /dev/null differ diff --git a/cvsroot/include/com/sun/kjava/Database.class b/cvsroot/include/com/sun/kjava/Database.class deleted file mode 100644 index 02444cba6..000000000 Binary files a/cvsroot/include/com/sun/kjava/Database.class and /dev/null differ diff --git a/cvsroot/include/utilities/KeyringDB.class b/cvsroot/include/utilities/KeyringDB.class deleted file mode 100644 index 0fe2c2930..000000000 Binary files a/cvsroot/include/utilities/KeyringDB.class and /dev/null differ diff --git a/cvsroot/jdbc40/.classpath b/cvsroot/jdbc40/.classpath deleted file mode 100644 index f8367783f..000000000 --- a/cvsroot/jdbc40/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/cvsroot/jdbc40/.externalToolBuilders/build build.xml [Builder].launch b/cvsroot/jdbc40/.externalToolBuilders/build build.xml [Builder].launch deleted file mode 100644 index fcd2607cc..000000000 --- a/cvsroot/jdbc40/.externalToolBuilders/build build.xml [Builder].launch +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/jdbc40/.project b/cvsroot/jdbc40/.project deleted file mode 100644 index 04747b71e..000000000 --- a/cvsroot/jdbc40/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jdbc40 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - - diff --git a/cvsroot/jdbc40/.settings/org.eclipse.jdt.core.prefs b/cvsroot/jdbc40/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 00d179b9c..000000000 --- a/cvsroot/jdbc40/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,70 +0,0 @@ -#Wed Mar 03 11:07:23 CST 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/cvsroot/jdbc40/.settings/org.eclipse.ltk.core.refactoring.prefs b/cvsroot/jdbc40/.settings/org.eclipse.ltk.core.refactoring.prefs deleted file mode 100644 index a58eda8d4..000000000 --- a/cvsroot/jdbc40/.settings/org.eclipse.ltk.core.refactoring.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Thu Jan 28 11:31:44 CST 2010 -eclipse.preferences.version=1 -org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCArrayResultSet.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCArrayResultSet.java deleted file mode 100644 index 9ac67cfcf..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCArrayResultSet.java +++ /dev/null @@ -1,4229 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// - -//JTOpen (IBM Toolbox for Java - OSS version) - -//Filename: AS400JDBCArrayResultSet.java - -//The source code contained herein is licensed under the IBM Public License -//Version 1.0, which has been approved by the Open Source Initiative. -//Copyright (C) 2009-2009 International Business Machines Corporation and -//others. All rights reserved. - -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.access; - - -import java.net.MalformedURLException; -import java.sql.ResultSet; -import java.sql.SQLException; - -//@array new class -/** AS400JDBCArrayResultSet is a JDBC ResultSet that contains Array data. This is a client-side only object. This is used to navigating through - * returned data from IBM i DB2 using Toolbox JDBC. No updates will be functional nor will they be sent back to the host server. - * Note that this ResultSet is limited in its functionality since it is not tied back to a cursor in the database. - * Its primary purpose is for retrieving data back from the database. - **/ -public class AS400JDBCArrayResultSet -/* ifdef JDBC40 */ -extends ToolboxWrapper -/* endif */ -implements ResultSet -{ - - private int holdability_; // Used by JDBC 40 - private int concurrency_; - private int fetchDirection_; - private int fetchSize_; - private int type_; - /* same as in AS400JDBCArray, the data_ array contains either Objects or SQLData. If SQLData, then it will - * do any needed conversion between types. If the data is an Ojbect (like Integer), then we will not do any - * conversion. - */ - private Object[][] data_; // column based data. - private int numberOfColumns_; - private int numberOfRows_; - private java.util.HashMap columnNameToIndexCache_; - - - //////Info from AS400JDBCArray - - private SQLData contentTemplate_; - private boolean isSQLData_; - - private int vrm_; - AS400JDBCConnection con_; //future use - /////////////////// - - - private boolean openOnClient_; - private int currentRowInRowset_; - private int wasNull_; - - - private java.util.Calendar calendar_; - static final private int WAS_NULL_UNSET = 0; - static final private int WAS_NULL = 1; - static final private int WAS_NOT_NULL = 2; - - /** - Constructs an AS400JDBCArrayResultSet object. - - @param contents An java array of data. - @param contentTemplate An instance of SQLData child class. - @param isSQLData Specifies if contents array content is an SQLData subclass type. - @param dataType Data type. - @param vrm Version - @param con Connection. - **/ - AS400JDBCArrayResultSet ( Object[] contents , SQLData contentTemplate, boolean isSQLData, int dataType, int vrm, AS400JDBCConnection con) - { - Object[][] data = new Object[2][]; - // initialize "INDEX" column - if(isSQLData) - { - data[0] = new SQLInteger[contents.length]; //@arrayrs //since array data will be sqlX, then make the index sqlInteger also - for (int i = 0; i < contents.length; i++) - { - try{ - SQLInteger si = (SQLInteger)SQLDataFactory.newData("INTEGER", Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, 37, null, vrm_, null); - data[0][i] = si; - ((SQLInteger)data[0][i]).set(i + 1); - }catch(Exception e){ - //should neve happen - - } - } - }else - { - data[0] = new Integer[contents.length]; - for (int i = 0; i < contents.length; i++) - { - try{ - data[0][i] = new Integer(i + 1); - }catch(Exception e){ - //should neve happen - - } - } - } - // initialize "VALUE" column - data[1] = contents; - contentTemplate_ = contentTemplate; - isSQLData_ = isSQLData; - - vrm_ = vrm; - con_ = con; - - String[] columnNames = new String[] { "INDEX", "VALUE" }; - - init ( CONCUR_READ_ONLY, TYPE_SCROLL_INSENSITIVE, java.sql.ResultSet.FETCH_FORWARD, 1, data, columnNames); - } - - /** - This method initializes this object. - - @param concurrency The concurrency of the resultset. - @param type The resultset type. - @param fetchDirection The Direction of the resultset. - @param fetchSize Size of fetch. - @param data Array of data objects - @param columnNames Names of columns. - **/ - void init ( int concurrency, int type, int fetchDirection, int fetchSize, - Object[][] data, String[] columnNames) - { - holdability_ = java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT; - concurrency_ = concurrency; - fetchDirection_ = fetchDirection; - fetchSize_ = fetchSize; - type_ = type; //TYPE_SCROLL_INSENSITIVE - data_ = data; - numberOfColumns_ = data.length; - // if it's an empty result set, there will be zero columns - // and thus zero rows. - if (numberOfColumns_ > 0) numberOfRows_ = data[0].length; - - columnNameToIndexCache_ = new java.util.HashMap (); - for (int i = 0; i < columnNames.length; i++) - columnNameToIndexCache_.put (columnNames[i], new Integer (i + 1)); - - - openOnClient_ = true; - currentRowInRowset_ = -1; - - } - - /** - Closes this ResultSet - - @exception SQLException If an error occurs. - **/ - public void close () throws java.sql.SQLException - { - openOnClient_ = false; - } - - private java.util.Calendar getCalendar (java.util.TimeZone timeZone) - { - calendar_ = (calendar_ != null) ? calendar_ : new java.util.GregorianCalendar (); - calendar_.setTimeZone (timeZone); - return calendar_; - } - - private final void checkThatResultSetTypeIsScrollable () throws java.sql.SQLException - { - if (type_ == java.sql.ResultSet.TYPE_FORWARD_ONLY) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - // ---------------------- cursor position methods ---------------------- - - /** - Indicates if the cursor is positioned before the first row. - - @return true if the cursor is positioned before the first row; - false if the cursor is not positioned before the first - row or if the result set contains no rows. - - @exception SQLException If the result set is not open. - **/ - public boolean isBeforeFirst () throws java.sql.SQLException - { - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - boolean result = (currentRowInRowset_ == -1); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "isBeforeFirst"); - return result; - } - - /** - Indicates if the cursor is positioned after the last row. - - @return true if the cursor is positioned after the last row; - false if the cursor is not positioned after the last - row or if the result set contains no rows. - - @exception SQLException If the result set is not open. - **/ - public boolean isAfterLast () throws java.sql.SQLException - { - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - boolean result = (currentRowInRowset_ == numberOfRows_); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "isAfterLast"); - return result; - } - - /** - Indicates if the cursor is positioned on the first row. - - @return true if the cursor is positioned on the first row; - false if the cursor is not positioned on the first - row or the row number can not be determined. - - @exception SQLException If the result set is not open. - **/ - public boolean isFirst () throws java.sql.SQLException - { - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - boolean result = (currentRowInRowset_ == 0); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "isFirst"); - return result; - } - - /** - Indicates if the cursor is positioned on the last row. - - @return true if the cursor is positioned on the last row; - false if the cursor is not positioned on the last - row or the row number can not be determined. - - @exception SQLException If the result set is not open. - **/ - public boolean isLast () throws java.sql.SQLException - { - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - boolean result = (currentRowInRowset_ == (numberOfRows_ - 1)); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "isLast"); - return result; - } - - /** - Sets cursor position before the first row. - - @exception SQLException If the result set is not open. - **/ - public void beforeFirst () throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "beforeFirst"); - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - wasNull_ = WAS_NULL_UNSET; - currentRowInRowset_ = -1; - } - - /** - Positions the cursor after the last row. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public void afterLast () throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "afterLast"); - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - wasNull_ = WAS_NULL_UNSET; - currentRowInRowset_ = numberOfRows_; - } - - /** - Positions the cursor to the first row. - - @return true if the requested cursor position is - valid; false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public boolean first () throws java.sql.SQLException - { - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - wasNull_ = WAS_NULL_UNSET; - boolean isValidCursorPosition; - if (numberOfRows_ == 0) - isValidCursorPosition = false; - else { - isValidCursorPosition = true; - currentRowInRowset_ = 0; - } - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "first"); - return isValidCursorPosition; - } - - /** - Positions the cursor to the last row. - - @return true if the requested cursor position is - valid; false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public boolean last () throws java.sql.SQLException - { - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - wasNull_ = WAS_NULL_UNSET; - boolean isValidCursorPosition; - if (numberOfRows_ == 0) - isValidCursorPosition = false; - else { - isValidCursorPosition = true; - currentRowInRowset_ = numberOfRows_ - 1; - } - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "last"); - return isValidCursorPosition; - } - - /** - Positions the cursor to the previous row. - - @return true if the requested cursor position is - valid; false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public boolean previous () throws java.sql.SQLException - { - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - wasNull_ = WAS_NULL_UNSET; - boolean isValidCursorPosition; - currentRowInRowset_--; - if (currentRowInRowset_ >= 0) - isValidCursorPosition = true; - else { - isValidCursorPosition = false; - currentRowInRowset_ = -1; - } - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "previous"); - return isValidCursorPosition; - } - - /** - Positions the cursor to the next row. - - @return true if the requested cursor position is valid; false - if there are no more rows. - - @exception SQLException If the result set is not open, - or an error occurs. - **/ - public boolean next () throws java.sql.SQLException - { - checkForClosedResultSet (); - wasNull_ = WAS_NULL_UNSET; - boolean isValidCursorPosition; - currentRowInRowset_++; - if (currentRowInRowset_ <= (numberOfRows_ - 1)) - isValidCursorPosition = true; - else { - isValidCursorPosition = false; - currentRowInRowset_ = numberOfRows_; - } - if (!isValidCursorPosition && type_ == java.sql.ResultSet.TYPE_FORWARD_ONLY) - close (); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "next"); - return isValidCursorPosition; - } - - /** - Positions the cursor to an absolute row number. - - @param row The absolute row number. If the absolute row - number is positive, this positions the cursor - with respect to the beginning of the result set. - If the absolute row number is negative, this - positions the cursor with respect to the end - of result set. - @return true if the requested cursor position is - valid; false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - the row number is 0, - or an error occurs. - */ - public boolean absolute (int row) throws java.sql.SQLException - { - //if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "absolute " + row); - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - wasNull_ = WAS_NULL_UNSET; - boolean isValidCursorPosition; - - if (row >= 0) - currentRowInRowset_ = row - 1; - else - currentRowInRowset_ = row + numberOfRows_; - - if (currentRowInRowset_ >= 0 && currentRowInRowset_ <= (numberOfRows_ - 1)) - isValidCursorPosition = true; - else { - isValidCursorPosition = false; - if (currentRowInRowset_ < 0) - currentRowInRowset_ = -1; - else - currentRowInRowset_ = numberOfRows_; - } - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "absolute"); - return isValidCursorPosition; - } - - /** - Positions the cursor to a relative row number. - -

Attempting to move beyond the first row positions the - cursor before the first row. Attempting to move beyond the last - row positions the cursor after the last row. - - @param rows The relative row number. If the relative row - number is positive, this positions the cursor - after the current position. If the relative - row number is negative, this positions the - cursor before the current position. If the - relative row number is 0, then the cursor - position does not change. - @return true if the requested cursor position is - valid, false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - the cursor is not positioned on a valid row, - or an error occurs. - */ - public boolean relative (int rows) throws java.sql.SQLException - { - //if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "relative", rows); - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - wasNull_ = WAS_NULL_UNSET; - boolean isValidCursorPosition; - currentRowInRowset_ += rows; - - if (currentRowInRowset_ >= 0 && currentRowInRowset_ <= (numberOfRows_ - 1)) - isValidCursorPosition = true; - else { - isValidCursorPosition = false; - if (currentRowInRowset_ < 0) - currentRowInRowset_ = -1; - else - currentRowInRowset_ = numberOfRows_; - } - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "relative"); - return isValidCursorPosition; - } - - // ---------------------- state getter and setter methods ---------------------- - - /** - Returns the result set concurrency. - - @return The result set concurrency. Valid values are: -

    -
  • CONCUR_READ_ONLY -
  • CONCUR_UPDATABLE -
- - - @exception SQLException If the result set is not open. - **/ - public int getConcurrency () throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getConcurrency"); - checkForClosedResultSet (); - return concurrency_; - } - - /** - Returns the result set type. - - @return The result set type. Valid values are: -
    -
  • TYPE_FORWARD_ONLY -
  • TYPE_SCROLL_INSENSITIVE -
  • TYPE_SCROLL_SENSITIVE -
- - - @exception SQLException If the result set is not open. - **/ - public int getType () throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getType"); - checkForClosedResultSet (); - return type_; - } - - /** - Returns the fetch direction. - - @return The fetch direction. - Valid values are: -
    -
  • FETCH_FORWARD -
  • FETCH_REVERSE -
  • FETCH_UNKNOWN -
- - @exception SQLException If the result is not open. - **/ - public int getFetchDirection () throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getFetchDirection"); - checkForClosedResultSet (); - return fetchDirection_; - } - - /** - Sets the direction in which the rows in a result set are - processed. - - @param direction The fetch direction for processing rows. - Valid values are: -
    -
  • FETCH_FORWARD -
  • FETCH_REVERSE -
  • FETCH_UNKNOWN -
- The default is the statement's fetch - direction. - - @exception SQLException If the result set is not open, - the result set is scrollable - and the input value is not - ResultSet.FETCH_FORWARD, - or the input value is not valid. - **/ - public void setFetchDirection (int direction) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "setFetchDirection"); - checkForClosedResultSet (); - switch (direction) { - case java.sql.ResultSet.FETCH_FORWARD: - case java.sql.ResultSet.FETCH_REVERSE: - case java.sql.ResultSet.FETCH_UNKNOWN: - fetchDirection_ = direction; - break; - default: - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - } - - /** - Returns the fetch size. - - @return The fetch size. - - @exception SQLException If the result is not open. - **/ - public int getFetchSize () throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getFetchSize"); - checkForClosedResultSet (); - return fetchSize_; - } - - /** - Sets the number of rows to be fetched from the database when more - rows are needed. This may be changed at any time. If the value - specified is zero, then the driver will choose an appropriate - fetch size. - - - @param rows The number of rows. This must be greater than - or equal to 0 and less than or equal to the - maximum rows limit. The default is the - statement's fetch size. - - @exception SQLException If the result set is not open - or the input value is not valid. - **/ - public void setFetchSize (int rows) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "setFetchSize"); - checkForClosedResultSet (); - if (rows < 0) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - fetchSize_ = rows; - } - - /** - Returns the name of the SQL cursor in use by the result set. - - @return The cursor name. - - @exception SQLException If the result is not open. - **/ - public String getCursorName () throws java.sql.SQLException - { - String cursorName = null; - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getCursorName"); - checkForClosedResultSet (); - return cursorName; - } - - /** - Returns the ResultSetMetaData object that describes the - result set's columns. ResultSetMetadata on Array columns is not supported and the - getMetaData method will return null. - - @return The metadata object. - - @exception SQLException If an error occurs. - **/ - public java.sql.ResultSetMetaData getMetaData () throws java.sql.SQLException - { - java.sql.ResultSetMetaData metaData = null;//new AS400JDBCResultSetMetaData ("", 2, "", new JDSimpleRow(new String[0], new SQLData[0], new int[0]), null, null, null); //@arrmd - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getMetaData"); - checkForClosedResultSet (); - return metaData; - } - - /** - Returns the statement for this result set. - - @return The statement for this result set, or null if the - result set was returned by a DatabaseMetaData - catalog method. - - @exception SQLException If an error occurs. - **/ - public java.sql.Statement getStatement () throws java.sql.SQLException - { - java.sql.Statement statement = null; - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getStatement"); - checkForClosedResultSet (); - return statement; - } - - /** - Returns the first warning reported for the result set. - Subsequent warnings may be chained to this warning. - - @return The first warning or null if no warnings - have been reported. - - @exception SQLException If an error occurs. - **/ - public java.sql.SQLWarning getWarnings () throws java.sql.SQLException - { - java.sql.SQLWarning warnings = null; - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getWarnings"); - checkForClosedResultSet (); - return warnings; - } - - /** - Clears all warnings that have been reported for the result set. - After this call, getWarnings() returns null until a new warning - is reported for the result set. - - @exception SQLException If an error occurs. - **/ - public void clearWarnings () throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "clearWarnings"); - checkForClosedResultSet (); - } - - /** - Returns the column index for the specified column name. - - @param columnName The column name. - @return The column index (1-based). - - @exception SQLException If the result set is not open - or the column name is not found. - **/ - public int findColumn (String columnName) throws java.sql.SQLException - { - //if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "findColumn", columnName); - checkForClosedResultSet (); - int column = findColumnX (columnName); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "findColumn"); - return column; - } - - private final int findColumnX (String columnName) throws java.sql.SQLException - { - Integer index = (Integer) columnNameToIndexCache_.get (columnName.toUpperCase ()); - if (index != null) - return index.intValue (); - else - { - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - return -1;//never happens - } - - } - - /** - Retrieves the current row number. The first row is number 1, the second number 2, and so on. - - @return The current row number (1-based), or 0 if the current row - is not valid. - - @exception SQLException If the result set is not open. - **/ - public int getRow () throws java.sql.SQLException - { - checkForClosedResultSet (); - int row; - if (currentRowInRowset_ >= 0 && currentRowInRowset_ <= (numberOfRows_ - 1)) - row = currentRowInRowset_ + 1; - else - row = 0; - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getRow"); - return row; - } - - /** - Indicates if the last column read has the value of SQL NULL. - - @return true if the value is SQL NULL; - false otherwise. - - @exception SQLException If the result set is not open. - **/ - public boolean wasNull () throws java.sql.SQLException - { - checkForClosedResultSet (); - if (wasNull_ == WAS_NULL_UNSET) - JDError.throwSQLException (JDError.EXC_CURSOR_POSITION_INVALID); - boolean result = (wasNull_ == WAS_NULL); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "wasNull"); - return result; - } - - // ---------------------- get on column methods ---------------------- - /** - Returns the value of a column as a Java boolean value. - - @param column The column name. - @return The column value or false if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public boolean getBoolean (int column) throws java.sql.SQLException - { - checkGetterPreconditions (column); - - Object[] columnData = data_[column - 1]; - boolean result = false; //@nulllocalarrelem - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getBoolean(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getBoolean(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBoolean"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java boolean value. - - @param columnName The column name. - @return The column value or false if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public boolean getBoolean (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBoolean"); - return getBoolean (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Java byte value. - - @param column The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public byte getByte (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - Object[] columnData = data_[column - 1]; - - byte result = 0; - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getByte(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getByte(); - } - } - - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getByte"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java byte value. - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public byte getByte (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getByte"); - return getByte (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Java short value. - - @param column The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public short getShort (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - short result = 0; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getShort(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getShort(); - } - } - - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getShort"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java short value. - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public short getShort (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getShort"); - return getShort (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Java int value. - - @param column The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public int getInt (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - int result = 0; //@nulllocalarrelem - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getInt(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getInt(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getInt"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java int value. - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public int getInt (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getInt"); - return getInt (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Java long value. - - @param column The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public long getLong (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - long result = 0; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getLong(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getLong(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getLong"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java long value. - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public long getLong (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getLong"); - return getLong (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Java float value. - - @param column The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public float getFloat (int column) throws java.sql.SQLException - { - checkGetterPreconditions (column); - float result = 0; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getFloat(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getFloat(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getFloat"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java float value. - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public float getFloat (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getFloat"); - return getFloat (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Java double value. - - @param column The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public double getDouble (int column) throws java.sql.SQLException - { - checkGetterPreconditions (column); - double result = 0; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getDouble(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getDouble(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getDouble"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java double value. - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public double getDouble (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getDouble"); - return getDouble (findColumnX (columnName)); - } - - /** - Returns the value of a column as a BigDecimal object. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public java.math.BigDecimal getBigDecimal (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - java.math.BigDecimal result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getBigDecimal(-1); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getBigDecimal(-1); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBigDecimal"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a BigDecimal object. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public java.math.BigDecimal getBigDecimal (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBigDecimal"); - return getBigDecimal (findColumnX (columnName)); - } - - /** - Returns the value of a column as a BigDecimal object. - - @param column The column index (1-based). - @param scale The number of digits after the decimal. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the scale is not valid, or the - requested conversion is not valid. - - @deprecated Use getBigDecimal(int) instead. - @see #getBigDecimal(int) - **/ - public java.math.BigDecimal getBigDecimal (int column, int scale) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBigDecimal " + column + " " + scale); - return getBigDecimal (column).setScale (scale); - } - - /** - Returns the value of a column as a BigDecimal object. - - @param columnName The column name. - @param scale The number of digits after the decimal. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the scale is not valid, or the - requested conversion is not valid. - - @deprecated Use getBigDecimal(int) instead. - @see #getBigDecimal(int) - **/ - public java.math.BigDecimal getBigDecimal (String columnName, int scale) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBigDecimal " + columnName + " " + scale); - return getBigDecimal (findColumnX (columnName), scale); - } - - /** - Returns the value of a column as a java.sql.Date object using - the default calendar. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - synchronized public java.sql.Date getDate (int column) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getDate"); - return getDateX (column, java.util.TimeZone.getDefault ()); - } - - /** - Returns the value of a column as a java.sql.Date object using - the default calendar. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.sql.Date getDate (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getDate"); - return getDate (findColumnX (columnName)); - } - - /** - Returns the value of a column as a java.sql.Time object using the - default calendar. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - synchronized public java.sql.Time getTime (int column) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getTime"); - return getTimeX (column, java.util.TimeZone.getDefault ()); - } - - /** - Returns the value of a column as a java.sql.Time object using the - default calendar. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.sql.Time getTime (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getTime"); - return getTime (findColumnX (columnName)); - } - - /** - Returns the value of a column as a java.sql.Timestamp object - using the default calendar. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - synchronized public java.sql.Timestamp getTimestamp (int column) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getTimestamp"); - return getTimestampX (column, java.util.TimeZone.getDefault ()); - } - - /** - Returns the value of a column as a java.sql.Timestamp object - using the default calendar. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.sql.Timestamp getTimestamp (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getTimestamp"); - return getTimestamp (findColumnX (columnName)); - } - - /** - Returns the value of a column as a java.sql.Date object using - a calendar other than the default. - - @param column The column index (1-based). - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the calendar is null, or the - requested conversion is not valid. - **/ - synchronized public java.sql.Date getDate (int column, java.util.Calendar calendar) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getDate " + column ); - - java.sql.Date result = getDateX (column, calendar.getTimeZone ()); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getDate"); - return result; - } - - /** - Returns the value of a column as a java.sql.Date object using - a calendar other than the default. - - @param columnName The column name. - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the calendar is null, or the - requested conversion is not valid. - **/ - public java.sql.Date getDate (String columnName, java.util.Calendar calendar) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getDate " + columnName ); - return getDate (findColumnX (columnName), calendar); - } - - private java.sql.Date getDateX (int column, java.util.TimeZone timeZone) throws java.sql.SQLException - { - checkGetterPreconditions (column); - java.sql.Date date = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - date = ((SQLData)columnData[currentRowInRowset_]).getDate(getCalendar(timeZone)); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], getCalendar(timeZone), -1); - date = contentTemplate_.getDate(getCalendar(timeZone)); - } - } - - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return date; - } - - /** - Returns the value of a column as a java.sql.Time object using the - default calendar. - - @param column The column index (1-based). - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - synchronized public java.sql.Time getTime (int column, java.util.Calendar calendar) throws java.sql.SQLException - { - java.sql.Time result = getTimeX (column, calendar.getTimeZone ()); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getTime"); - return result; - } - - /** - Returns the value of a column as a java.sql.Time object using the - default calendar. - - @param columnName The column name. - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.sql.Time getTime (String columnName, java.util.Calendar calendar) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getTime"); - return getTime (findColumnX (columnName), calendar); - } - - private java.sql.Time getTimeX (int column, java.util.TimeZone timeZone) throws java.sql.SQLException - { - checkGetterPreconditions (column); - java.sql.Time time = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - time = ((SQLData)columnData[currentRowInRowset_]).getTime(getCalendar(timeZone)); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], getCalendar(timeZone), -1); - time = contentTemplate_.getTime(getCalendar(timeZone)); - } - } - - - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return time; - } - - /** - Returns the value of a column as a java.sql.Timestamp object - using a calendar other than the default. - - @param column The column index (1-based). - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the calendar is null, or the - requested conversion is not valid. - **/ - synchronized public java.sql.Timestamp getTimestamp (int column, java.util.Calendar calendar) throws java.sql.SQLException - { - java.sql.Timestamp result = getTimestampX (column, calendar.getTimeZone ()); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getTimestamp"); - return result; - } - - /** - Returns the value of a column as a java.sql.Timestamp object - using a calendar other than the default. - - @param columnName The column name. - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the calendar is null, or the - requested conversion is not valid. - **/ - public java.sql.Timestamp getTimestamp (String columnName, java.util.Calendar calendar) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getTimestamp"); - return getTimestamp (findColumnX (columnName), calendar); - } - - private java.sql.Timestamp getTimestampX (int column, java.util.TimeZone timeZone) throws java.sql.SQLException - { - checkGetterPreconditions (column); - java.sql.Timestamp timestamp = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - timestamp = ((SQLData)columnData[currentRowInRowset_]).getTimestamp(getCalendar(timeZone)); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], getCalendar(timeZone), -1); - timestamp = contentTemplate_.getTimestamp(getCalendar(timeZone)); - } - } - - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return timestamp; - } - - /** - Returns the value of a column as a Java byte array. - -

This can also be used to get values from columns - with other types. The values are returned in their - native IBM i format. This is not supported for - result sets returned by a DatabaseMetaData object. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public byte[] getBytes (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - byte[] result = null; - Object[] columnData = data_[column - 1]; - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getBytes(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getBytes(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBytes"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java byte array. - -

This can also be used to get values from columns - with other types. The values are returned in their - native IBM i format. This is not supported for - result sets returned by a DatabaseMetaData object. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public byte[] getBytes (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBytes"); - return getBytes (findColumnX (columnName)); - } - - /** - Returns the value of a column as a String object. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - synchronized public String getString (int column) throws java.sql.SQLException - { - checkGetterPreconditions (column); - String result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getString(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getString(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getString"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a String object. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public String getString (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getString"); - return getString (findColumnX (columnName)); - } - - /** - Returns the value of a column as a stream of uninterpreted - bytes. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.io.InputStream getBinaryStream (int column) throws java.sql.SQLException - { - checkGetterPreconditions (column); - java.io.InputStream result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getBinaryStream(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getBinaryStream(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBinaryStream"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a stream of uninterpreted - bytes. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.io.InputStream getBinaryStream (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBinaryStream"); - return getBinaryStream (findColumnX (columnName)); - } - - /** - Returns the value of a column as a stream of ASCII - characters. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public java.io.InputStream getAsciiStream (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - java.io.InputStream result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getAsciiStream(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getAsciiStream(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getAsciiStream"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - - /** - Returns the value of a column as a stream of ASCII - characters. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public java.io.InputStream getAsciiStream (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getAsciiStream"); - return getAsciiStream (findColumnX (columnName)); - } - - - /** - Returns the value of a column as a stream of Unicode - characters. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - - @deprecated Use getCharacterStream(int) instead. - @see #getCharacterStream(int) - **/ - public java.io.InputStream getUnicodeStream (int column) throws java.sql.SQLException - { - checkGetterPreconditions (column); - java.io.InputStream result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getUnicodeStream(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getUnicodeStream(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getUnicodeStream"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a stream of Unicode - characters. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - - @deprecated Use getCharacterStream(String) instead. - @see #getCharacterStream(String) - **/ - public java.io.InputStream getUnicodeStream (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getUnicodeStream"); - return getUnicodeStream (findColumnX (columnName)); - } - - /** - Returns the value of a column as a character stream. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - */ - public java.io.Reader getCharacterStream (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - java.io.Reader result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - result = ((SQLData)columnData[currentRowInRowset_]).getCharacterStream(); - } - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getCharacterStream(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getCharacterStream"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a character stream. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - */ - public java.io.Reader getCharacterStream (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getCharacterStream"); - return getCharacterStream (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Blob object. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.sql.Blob getBlob (int column) throws java.sql.SQLException - { - checkGetterPreconditions (column); - java.sql.Blob result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getBlob(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getBlob(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBlob"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Blob object. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.sql.Blob getBlob (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBlob"); - return getBlob (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Clob object. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.sql.Clob getClob (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - java.sql.Clob result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getClob(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getClob(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getClob"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Clob object. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.sql.Clob getClob (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getClob"); - return getClob (findColumnX (columnName)); - } - - /** - Returns the value of a column as an Array object. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException - **/ - public java.sql.Array getArray (int column) throws java.sql.SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - /** - Returns the value of a column as an Array object. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException - **/ - public java.sql.Array getArray (String columnName) throws java.sql.SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - /** - Returns the value of a column as a Ref object. - DB2 for IBM i does not support structured types. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support structured types. - **/ - public java.sql.Ref getRef (int column) throws java.sql.SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - /** - Returns the value of a column as a Ref object. - DB2 for IBM i does not support structured types. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support structured types. - **/ - public java.sql.Ref getRef (String columnName) throws java.sql.SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - /** - Returns the value of an SQL DATALINK output parameter as a - java.net.URL object. - - @param column The column index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed or - the requested conversion is not valid. - **/ - public java.net.URL getURL (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - java.net.URL result = null; - Object[] columnData = data_[column - 1]; - String stringResult = null; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - stringResult = ((SQLData)columnData[currentRowInRowset_]).getString(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - stringResult = contentTemplate_.getString(); - } - } - - try - { - if(stringResult == null) - result = null; - else - result = new java.net.URL(stringResult); - } - catch(MalformedURLException e) - { - JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID, e); - result = null; - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getURL"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of an SQL DATALINK output parameter as a - java.net.URL object. - - @param columnName The column name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed or - the requested conversion is not valid. - **/ - public java.net.URL getURL (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getURL"); - return getURL (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Java Object. - This can be used to get values from columns with all - SQL types. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public Object getObject (int column) throws java.sql.SQLException - { - checkGetterPreconditions (column); - Object[] columnData = data_[column - 1]; - Object result = null; - - if(isSQLData_) - { - - if(columnData[currentRowInRowset_] != null) //@nullelem - result = ((SQLData)columnData[currentRowInRowset_]).getObject(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getObject(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getObject"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java Object. - This can be used to get values from columns with all - SQL types. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public Object getObject (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getObject"); - return getObject (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Java Object. - - @param column The column index (1-based). - @param map The type map. This is not used. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the type map is null, or the - requested conversion is not valid. - **/ - public Object getObject (int column, java.util.Map map) throws java.sql.SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - /** - Returns the value of a column as a Java Object. - - @param columnName The column name. - @param map The type map. This is not used. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the type map is null, or the - requested conversion is not valid. - **/ - public Object getObject (String columnName, java.util.Map map) throws java.sql.SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - // ---------------------- update on column methods ---------------------- - - /** - Updates a column in the current row using SQL NULL. - - @param column The column index (1-based). - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateNull (int column) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNull"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using SQL NULL. - - @param columnName The column name. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateNull (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNull"); - updateNull (findColumnX (columnName)); - } - - /** - Updates a column in the current row using a Java byte value. - The driver converts this to an SQL SMALLINT value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateByte (int column, byte x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateByte"); - checkUpdatePreconditions (column); - } - - - /** - Updates a column in the current row using a Java byte value. - The driver converts this to an SQL SMALLINT value. - - @param columnName The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateByte (String columnName, byte x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateByte"); - updateByte (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a Java boolean value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBoolean (int column, boolean x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBoolean"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java boolean value. - - @param columnName The column name. - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBoolean (String columnName, boolean x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBoolean"); - updateBoolean (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a Java short value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateShort (int column, short x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateShort"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java short value. - - @param columnName The column name. - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateShort (String columnName, short x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateShort"); - updateShort (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a Java int value. - The driver converts this to an SQL INTEGER value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateInt (int column, int x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateInt"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java int value. - The driver converts this to an SQL INTEGER value. - - @param columnName The column name. - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateInt (String columnName, int x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateInt"); - updateInt (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a Java long value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateLong (int column, long x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateLong"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java long value. - - @param columnName The column name. - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateLong (String columnName, long x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateLong"); - updateLong (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a Java float value. - The driver converts this to an SQL REAL value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateFloat (int column, float x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateFloat"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java float value. - The driver converts this to an SQL REAL value. - - @param columnName The column name. - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateFloat (String columnName, float x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateFloat"); - updateFloat (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a Java double value. - The driver converts this to an SQL DOUBLE value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateDouble (int column, double x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateDouble"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java double value. - The driver converts this to an SQL DOUBLE value. - - @param columnName The column name. - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateDouble (String columnName, double x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateDouble"); - updateDouble (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a BigDecimal value. The - driver converts this to an SQL NUMERIC value. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBigDecimal (int column, java.math.BigDecimal x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBigDecimal"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a BigDecimal value. The - driver converts this to an SQL NUMERIC value. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBigDecimal (String columnName, java.math.BigDecimal x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBigDecimal"); - updateBigDecimal (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a java.sql.Date value. - The driver converts this to an SQL DATE value. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateDate (int column, java.sql.Date x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateDate"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a java.sql.Date value. - The driver converts this to an SQL DATE value. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateDate (String columnName, java.sql.Date x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateDate"); - updateDate (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a java.sql.Time value. - The driver converts this to an SQL TIME value. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateTime (int column, java.sql.Time x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateTime"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a java.sql.Time value. - The driver converts this to an SQL TIME value. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateTime (String columnName, java.sql.Time x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateTime"); - updateTime (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a java.sql.Timestamp value. - The driver converts this to an SQL TIMESTAMP value. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateTimestamp (int column, java.sql.Timestamp x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateTimestamp"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a java.sql.Timestamp value. - The driver converts this to an SQL TIMESTAMP value. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateTimestamp (String columnName, java.sql.Timestamp x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateTimestamp"); - updateTimestamp (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a Java byte array value. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBytes (int column, byte x[]) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBytes"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java byte array value. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBytes (String columnName, byte x[]) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBytes"); - updateBytes (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a String value. - The driver converts this to an SQL VARCHAR value. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public void updateString (int column, String x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateString"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a String value. - The driver converts this to an SQL VARCHAR value. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public void updateString (String columnName, String x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateString"); - updateString (findColumnX (columnName), x); - } - - /** - * Updates the designated column with a binary stream value, which will have - * the specified number of bytes. - * @param column column index - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateBinaryStream (int column, java.io.InputStream x, int length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBinaryStream"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with a binary stream value, which will have - * the specified number of bytes. - * @param columnName column index - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateBinaryStream (String columnName, java.io.InputStream x, int length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBinaryStream"); - updateBinaryStream (findColumnX (columnName), x, length); - } - - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * @param column - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateAsciiStream (int column, java.io.InputStream x, int length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateAsciiStream"); - checkUpdatePreconditions (column); - } - - - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * @param columnName - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateAsciiStream (String columnName, java.io.InputStream x, int length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateAsciiStream"); - updateAsciiStream (findColumnX (columnName), x, length); - } - - /** - Updates a column in the current row using a Reader value. - The driver reads the data from the Reader as needed until no more - characters are available. The driver converts this to an SQL VARCHAR - value. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - @param length The length. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid, - the length is not valid, or an error - happens while reading the input stream. - **/ - public void updateCharacterStream (int column, java.io.Reader x, int length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateCharacterStream"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Reader value. - The driver reads the data from the Reader as needed until no more - characters are available. The driver converts this to an SQL VARCHAR - value. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - @param length The length. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid, - the length is not valid, or an error - happens while reading the input stream. - **/ - public void updateCharacterStream (String columnName, java.io.Reader x, int length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateCharacterStream"); - updateCharacterStream (findColumnX (columnName), x, length); - } - - /** - Updates a column in the current row using a Java Blob value. - The driver converts this to an SQL BLOB value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBlob (int column, java.sql.Blob x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBlob"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java Blob value. - The driver converts this to an SQL BLOB value. - - @param columnName The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBlob (String columnName, java.sql.Blob x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBlob"); - updateBlob (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a Java Clob value. - The driver converts this to an SQL CLOB value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateClob (int column, java.sql.Clob x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateClob"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java Clob value. - The driver converts this to an SQL CLOB value. - - @param columnName The column name. - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateClob (String columnName, java.sql.Clob x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateClob"); - updateClob (findColumnX (columnName), x); - } - - /** - Updates the value of a column as an Array object. - - @param column The column index (1-based). - @param x The column value or null if the value is SQL NULL. - - @exception SQLException - **/ - public void updateArray (int column, java.sql.Array x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateArray"); - checkUpdatePreconditions (column); - } - - /** - Updates the value of a column as an Array object. - - @param columnName The column index (1-based). - @param x The column value or null if the value is SQL NULL. - - @exception SQLException - **/ - public void updateArray (String columnName, java.sql.Array x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateArray"); - updateArray (findColumnX (columnName), x); - } - - /** - Updates the value of an SQL REF output parameter as a Ref value. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException - **/ - public void updateRef (int column, java.sql.Ref x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateRef"); - checkUpdatePreconditions (column); - } - - /** - Updates the value of an SQL REF output parameter as a Ref value. - - @param columnName The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException - **/ - public void updateRef (String columnName, java.sql.Ref x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateRef"); - updateRef (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using an Object value. - The driver converts this to a value of an SQL type, depending on - the type of the specified value. The JDBC specification defines - a standard mapping from Java types to SQL types. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public void updateObject (int column, Object x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateObject"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using an Object value. - The driver converts this to a value of an SQL type, depending on - the type of the specified value. The JDBC specification defines - a standard mapping from Java types to SQL types. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public void updateObject (String columnName, Object x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateObject"); - updateObject (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using an Object value. - The driver converts this to a value of an SQL type, depending on - the type of the specified value. The JDBC specification defines - a standard mapping from Java types to SQL types. - - @param column The column index. - @param x The column value or null to update - the value to SQL NULL. - @param scale The scale. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public void updateObject (int column, Object x, int scale) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateObject"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using an Object value. - The driver converts this to a value of an SQL type, depending on - the type of the specified value. The JDBC specification defines - a standard mapping from Java types to SQL types. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - @param scale The scale. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public void updateObject (String columnName, Object x, int scale) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateObject"); - updateObject (findColumnX (columnName), x, scale); - } - - /** - Indicates if the current row has been updated. This driver does - not support this method. - - @return Always false. - - @exception SQLException If an error occurs. - **/ - public boolean rowUpdated () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return false; - } - - /** - Indicates if the current row has been inserted. This driver does - not support this method. - - @return Always false. - - @exception SQLException If an error occurs. - **/ - public boolean rowInserted () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return false; - } - - /** - Indicates if the current row has been deleted. A result set - of type TYPE_SCROLL_INSENSITIVE may contain rows that have - been deleted. - - @return true if current row has been deleted; false otherwise. - - @exception SQLException If an error occurs. - **/ - public boolean rowDeleted () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return false; - } - - /** - Inserts the contents of the insert row into the result set - and the database. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on the insert row, - a column that is not nullable was not specified, - or an error occurs. - **/ - public void insertRow () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - - } - - /** - Cancels all pending updates that have been made since the last - call to updateRow(). - - @exception SQLException If the result set is not open - or the result set is not updatable. - **/ - public void updateRow () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - /** - Deletes the current row from the result set and the database. - After deleting a row, the cursor position is no longer valid, - so it must be explicitly repositioned. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the cursor is positioned on the insert row, - or an error occurs. - **/ - public void deleteRow () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - /** - Refreshes the current row from the database. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - the cursor is not positioned on a row, - the cursor is positioned on the - insert row or an error occurs. - **/ - public void refreshRow () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - /** - Cancels all pending updates that have been made since the last - call to updateRow(). - - @exception SQLException If the result set is not open - or the result set is not updatable. - **/ - public void cancelRowUpdates () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - /** - Positions the cursor to the insert row. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - the result set is not updatable, - or an error occurs. - **/ - public void moveToInsertRow () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - /** - Positions the cursor to the current row. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public void moveToCurrentRow () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - // ---------------------- condition checking helper methods ---------------------- - - private final void checkForClosedResultSet () throws java.sql.SQLException - { - if (!openOnClient_) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - private final void checkForValidColumnIndex (int column) throws java.sql.SQLException - { - if (column < 1 || column > numberOfColumns_) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - private final void checkForValidPosition () throws java.sql.SQLException - { - if (currentRowInRowset_ < 0 || currentRowInRowset_ > (numberOfRows_ - 1)) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - private final void checkForConcurrency () throws java.sql.SQLException - { - if (concurrency_ != java.sql.ResultSet.CONCUR_UPDATABLE) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - private final void checkGetterPreconditions (int column) throws java.sql.SQLException - { - checkForClosedResultSet (); - checkForValidColumnIndex (column); - checkForValidPosition (); - } - - private final void checkUpdatePreconditions (int column) throws java.sql.SQLException - { - checkForClosedResultSet (); - checkForValidColumnIndex (column); - checkForConcurrency (); - } - - private final void checkUpdatePreconditions () throws java.sql.SQLException - { - checkForClosedResultSet (); - checkForConcurrency (); - } - - // ---------- JDBC 4 methods ---------- - - /** - Indicates if the result set is closed. - - @return true if this result set is closed; - false otherwise. - **/ - public boolean isClosed () throws java.sql.SQLException - { - return !openOnClient_; - } - - /** - * Retrieves the holdability. - * @throws SQLException if a database error occurs - */ - public int getHoldability () throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getHoldability"); - checkForClosedResultSet (); - return holdability_; - } - - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @param column - * @exception SQLException if a database access error occurs - */ - public java.io.Reader getNCharacterStream (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - java.io.Reader result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getNCharacterStream(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getNCharacterStream(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getNCharacterStream"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @param columnName - * @exception SQLException if a database access error occurs - */ - public java.io.Reader getNCharacterStream (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getNCharacterStream"); - return getNCharacterStream (findColumnX (columnName)); - } - - - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a NClob object - * in the Java programming language. - * - * @param column - * @return a NClob object representing the SQL - * NCLOB value in the specified column - * @exception SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurss - */ -/* ifdef JDBC40 */ - public java.sql.NClob getNClob (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - java.sql.NClob result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getNClob(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getNClob(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getNClob"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } -/* endif */ - - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a NClob object - * in the Java programming language. - * - * @param columnName - * @return a NClob object representing the SQL - * NCLOB value in the specified column - * @exception SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurss - */ -/* ifdef JDBC40 */ - public java.sql.NClob getNClob (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getNClob"); - return getNClob (findColumnX (columnName)); - } - -/* endif */ - - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param column - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - */ - public String getNString (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - String result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getNString(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getNString(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getNString"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnName - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - */ - public String getNString (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getNString"); - return getNString (findColumnX (columnName)); - } - - /** - * Retrieves the value of the designated column in the current row of this - * ResultSet object as a java.sql.RowId object in the Java - * programming language. - * - * @param column The column number - * @return the column value ; if the value is a SQL NULL the - * value returned is null - * @throws SQLException if a database access error occurs - */ -/* ifdef JDBC40 */ - public java.sql.RowId getRowId (int column) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getRowId"); - checkGetterPreconditions (column); - java.sql.RowId result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getRowId(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getRowId(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getRowId"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } -/* endif */ - - /** - * Retrieves the value of the designated column in the current row of this - * ResultSet object as a java.sql.RowId object in the Java - * programming language. - * - * @param columnName The column name - * @return the column value ; if the value is a SQL NULL the - * value returned is null - * @throws SQLException if a database access error occurs - */ -/* ifdef JDBC40 */ - public java.sql.RowId getRowId (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getRowId"); - return getRowId (findColumnX (columnName)); - } -/* endif */ - - /** - * Retrieves the value of the designated column in the current row of - * this ResultSet as a - * java.sql.SQLXML object in the Java programming language. - * @param column - * @return a SQLXML object that maps an SQL XML value - * @throws SQLException if a database access error occurs - */ -/* ifdef JDBC40 */ - public java.sql.SQLXML getSQLXML (int column) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getSQLXML"); - checkGetterPreconditions (column); - java.sql.SQLXML result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getSQLXML(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getSQLXML(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getSQLXML"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } -/* endif */ - - /** - * Retrieves the value of the designated column in the current row of - * this ResultSet as a - * java.sql.SQLXML object in the Java programming language. - * @param columnName - * @return a SQLXML object that maps an SQL XML value - * @throws SQLException if a database access error occurs - */ -/* ifdef JDBC40 */ - public java.sql.SQLXML getSQLXML (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getSQLXML"); - return getSQLXML (findColumnX (columnName)); - } -/* endif */ - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - - * @param column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream (int column, java.io.InputStream x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateAsciiStream"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * @param columnName - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream (String columnName, java.io.InputStream x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateAsciiStream"); - updateAsciiStream (findColumnX (columnName), x); - } - - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * @param column - * @param x the new column value - * @param length - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream (int column, java.io.InputStream x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateAsciiStream"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * @param columnName - * @param x the new column value - * @param length - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream (String columnName, java.io.InputStream x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateAsciiStream"); - updateAsciiStream (findColumnX (columnName), x, length); - } - - /** - * Updates the designated column with a binary stream value. - * - * @param column - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateBinaryStream (int column, java.io.InputStream x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBinaryStream"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with a binary stream value. - * - * @param columnName - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateBinaryStream (String columnName, java.io.InputStream x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBinaryStream"); - updateBinaryStream (findColumnX (columnName), x); - } - - /** - * Updates the designated column with a binary stream value. - * - * @param column - * @param x the new column value - * @param length - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateBinaryStream (int column, java.io.InputStream x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBinaryStream"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with a binary stream value. - * - * @param columnName - * @param x the new column value - * @param length - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateBinaryStream (String columnName, java.io.InputStream x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBinaryStream"); - updateBinaryStream (findColumnX (columnName), x, length); - } - - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - * - * @param column - * @param x An object that contains the data to set the parameter value to. - * @exception SQLException if the columnIndex is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob (int column, java.io.InputStream x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBlob"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - * - * @param columnName - * @param x An object that contains the data to set the parameter value to. - * @exception SQLException if the columnIndex is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob (String columnName, java.io.InputStream x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBlob" ); - updateBlob (findColumnX (columnName), x); - } - - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - * - * @param column - * @param x An object that contains the data to set the parameter value to. - * @param length - * @exception SQLException if the columnIndex is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob (int column, java.io.InputStream x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBlob" ); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - * - * @param columnName - * @param x An object that contains the data to set the parameter value to. - * @param length - * @exception SQLException if the columnIndex is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateBlob (String columnName, java.io.InputStream x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBlob" ); - updateBlob (findColumnX (columnName), x, length); - } - - /** - * Updates the designated column with a character stream value. - * - * @param column - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateCharacterStream (int column, java.io.Reader x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateCharacterStream" ); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with a character stream value. - * - * @param columnName - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateCharacterStream (String columnName, java.io.Reader x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateCharacterStream" ); - updateCharacterStream (findColumnX (columnName), x); - } - - /** - * Updates the designated column with a character stream value. - * - * @param column - * @param x the new column value - * @param length - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateCharacterStream (int column, java.io.Reader x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateCharacterStream"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with a character stream value. - * - * @param columnName - * @param x the new column value - * @param length - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateCharacterStream (String columnName, java.io.Reader x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateCharacterStream"); - updateCharacterStream (findColumnX (columnName), x, length); - } - - /** - * Updates the designated column using the given Reader - * object. - * - * @param column - * @param x An object that contains the data to set the parameter value to. - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateClob (int column, java.io.Reader x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateClob"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column using the given Reader - * object. - * - * @param columnName - * @param x An object that contains the data to set the parameter value to. - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateClob (String columnName, java.io.Reader x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateClob"); - updateClob (findColumnX (columnName), x); - } - - /** - * Updates the designated column using the given Reader - * object. - * - * @param column - * @param x An object that contains the data to set the parameter value to. - * @param length - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateClob (int column, java.io.Reader x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateClob"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column using the given Reader - * object. - * - * @param columnName - * @param x An object that contains the data to set the parameter value to. - * @param length - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateClob (String columnName, java.io.Reader x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateClob"); - updateClob (findColumnX (columnName), x, length); - } - - /** - * Updates the designated column with a character stream value. - * - * @param column - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream (int column, java.io.Reader x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNCharacterStream"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with a character stream value. - * - * @param columnName - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream (String columnName, java.io.Reader x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNCharacterStream"); - updateNCharacterStream (findColumnX (columnName), x); - } - - /** - * Updates the designated column with a character stream value. - * - * @param column - * @param x the new column value - * @param length - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream (int column, java.io.Reader x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNCharacterStream"); - checkUpdatePreconditions (column); - } - - - /** - * Updates the designated column with a character stream value. - * - * @param columnName - * @param x the new column value - * @param length - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream (String columnName, java.io.Reader x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNCharacterStream" ); - updateNCharacterStream (findColumnX (columnName), x, length); - } - - /** - * Updates the designated column using the given Reader - * - * @param column - * @param x An object that contains the data to set the parameter value to. - * @throws SQLException if the columnIndex is not valid; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public void updateNClob (int column, java.sql.NClob x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNClob" ); - checkUpdatePreconditions (column); - } -/* endif */ - - /** - * Updates the designated column using the given Reader - * - * @param columnName - * @param x An object that contains the data to set the parameter value to. - * @throws SQLException if the columnIndex is not valid; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public void updateNClob (String columnName, java.sql.NClob x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNClob" ); - updateNClob (findColumnX (columnName), x); - } -/* endif */ - /** - * Updates the designated column using the given Reader - * - * @param column - * @param x An object that contains the data to set the parameter value to. - * @throws SQLException if the columnIndex is not valid; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob (int column, java.io.Reader x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNClob" ); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column using the given Reader - * - * @param columnName - * @param x An object that contains the data to set the parameter value to. - * @throws SQLException if the columnIndex is not valid; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob (String columnName, java.io.Reader x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNClob" ); - updateNClob (findColumnX (columnName), x); - } - - /** - * Updates the designated column using the given Reader - * - * @param column - * @param x An object that contains the data to set the parameter value to. - * @param length - * @throws SQLException if the columnIndex is not valid; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob (int column, java.io.Reader x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNClob"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column using the given Reader - * - * @param columnName - * @param x An object that contains the data to set the parameter value to. - * @param length - * @throws SQLException if the columnIndex is not valid; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob (String columnName, java.io.Reader x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNClob"); - updateNClob (findColumnX (columnName), x, length); - } - - /** - * Updates the designated column with a String value. - * It is intended for use when updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param column - * @param x The value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - */ - public void updateNString (int column, String x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNString" ); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with a String value. - * It is intended for use when updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnName - * @param x The value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - */ - public void updateNString (String columnName, String x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNString" ); - updateNString (findColumnX (columnName), x); - } - - /** - * Updates the designated column with a RowId value. - * - * @param column - * @param x the column value - * @throws SQLException if a database access occurs - */ -/* ifdef JDBC40 */ - - public void updateRowId (int column, java.sql.RowId x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateRowId"); - checkUpdatePreconditions (column); - } -/* endif */ - /** - * Updates the designated column with a RowId value. - * - * @param columnName - * @param x the column value - * @throws SQLException if a database access occurs - */ -/* ifdef JDBC40 */ - public void updateRowId (String columnName, java.sql.RowId x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateRowId"); - updateRowId (findColumnX (columnName), x); - } -/* endif */ - /** - * Updates the designated column with a java.sql.SQLXML value. - * - * @param column - * @param x The value for the column to be updated - * @throws SQLException if a database access error occurs - */ -/* ifdef JDBC40 */ - - public void updateSQLXML (int column, java.sql.SQLXML x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateSQLXML"); - checkUpdatePreconditions (column); - } -/* endif */ - /** - * Updates the designated column with a java.sql.SQLXML value. - * - * @param columnName - * @param x The value for the column to be updated - * @throws SQLException if a database access error occurs - */ -/* ifdef JDBC40 */ - - public void updateSQLXML (String columnName, java.sql.SQLXML x) throws java.sql.SQLException - { - updateSQLXML (findColumnX (columnName), x); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateSQLXML"); - } -/* endif */ - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCArrayResultSet", "java.sql.ResultSet" }; - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCBlob.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCBlob.java deleted file mode 100644 index ff8e56872..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCBlob.java +++ /dev/null @@ -1,427 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCBlob.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.sql.Blob; -import java.sql.SQLException; - -// Note: This code in this class requires understanding of bit manipulation -// and sign extension. Do not attempt to rework this code if you do not -// have a grasp of these concepts. - -// Currently, the database host server only supports 2 GB LOBs. Therefore, -// we validate any long parameters to make sure they are not greater than -// the maximum positive value for a 4-byte int (2 GB). This has the added -// bonus of being able to cast the long down to an int without worrying -// about sign extension. There are some cases where we could allow the -// user to pass in a long greater than 2 GB, but for consistency, we will -// throw an exception. - -// Offset refers to a 0-based index. Position refers to a 1-based index. - - -/** - * The AS400JDBCBlob class provides access to binary large - * objects. The data is valid only within the current - * transaction. -**/ -public class AS400JDBCBlob implements Blob -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private byte[] data_; - private int maxLength_; - static final int MAX_LOB_SIZE = 2147483647; //@PDA jdbc40 - same as native driver - -/** -Constructs an AS400JDBCBlob object. The data is contained -in the raw byte array. No further communication with the IBM i system -is necessary. - -@param data The BLOB data. -**/ - AS400JDBCBlob(byte[] data, int maxLength) - { - data_ = data; - maxLength_ = maxLength; - } - - - -/** -Returns the entire BLOB as a stream of uninterpreted bytes. - -@return The stream. - -@exception SQLException If an error occurs. -**/ - public synchronized InputStream getBinaryStream() throws SQLException - { - //Following Native, throw HY010 after free() has been called - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - return new ByteArrayInputStream(data_); - } - - - -/** -Returns part of the contents of the BLOB. - -@param position The start position within the BLOB (1-based). -@param length The length to return. -@return The contents. - -@exception SQLException If the start position is not valid, - if the length is not valid, - or an error occurs. -**/ - public synchronized byte[] getBytes(long position, int length) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int offset = (int)position-1; - if (offset < 0 || length < 0 || (offset + length) > data_.length) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - int lengthToUse = data_.length - offset; - if (lengthToUse < 0) return new byte[0]; - if (lengthToUse > length) lengthToUse = length; - - byte[] result = new byte[lengthToUse]; - System.arraycopy(data_, offset, result, 0, lengthToUse); - return result; - } - - - -/** -Returns the length of the BLOB. - -@return The length of the BLOB, in bytes. - -@exception SQLException If an error occurs. -**/ - public synchronized long length() throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - return data_.length; - } - - -/** -Returns the position at which a pattern is found in the BLOB. - -@param pattern The pattern. -@param position The position within the BLOB to begin - searching (1-based). -@return The position at which the pattern - is found, or -1 if the pattern is not - found. - -@exception SQLException If the pattern is null, - the position is not valid, - or an error occurs. -**/ - public synchronized long position(byte[] pattern, long position) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - int offset = (int)position-1; - if (pattern == null || offset < 0 || offset >= data_.length) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } else { - - int end = data_.length - pattern.length; - - for (int i=offset; i<=end; ++i) - { - int j = 0; - while (j < pattern.length && data_[i+j] == pattern[j]) ++j; - if (j == pattern.length) return i+1; - } - } - return -1; - } - - -/** -Returns the position at which a pattern is found in the BLOB. - -@param pattern The pattern. -@param position The position within the BLOB to begin - searching (1-based). -@return The position at which the pattern - is found, or -1 if the pattern is not - found. - -@exception SQLException If the pattern is null, - the position is not valid, - or an error occurs. -**/ - public synchronized long position(Blob pattern, long position) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int offset = (int)position-1; - if (pattern == null || offset < 0 || offset >= data_.length) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } else { - - int patternLength = (int)pattern.length(); - if (patternLength > data_.length || patternLength < 0) return -1; - - int end = data_.length - patternLength; - - byte[] bytePattern = pattern.getBytes(1L, patternLength); //@CRS - Get all bytes for now, improve this later. - - for (int i=offset; i<=end; ++i) - { - int j = 0; - while (j < patternLength && data_[i+j] == bytePattern[j]) ++j; - if (j == patternLength) return i+1; - } - } - return -1; - } - - - - /** - Returns a stream that an application can use to write to this BLOB. - The stream begins at position positionToStartWriting. - - @param position The position (1-based) in the BLOB where writes should start. - @return An OutputStream object to which data can be written by an application. - @exception SQLException If there is an error accessing the BLOB or if the position - specified is greater than the length of the BLOB. - **/ - public OutputStream setBinaryStream(long position) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - if (position <= 0 || position > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - return new AS400JDBCBlobOutputStream(this, position); - } - - /** - * This is not part of the JDBC interface. - **/ - synchronized int setByte(long position, byte data) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int offset = (int)position-1; - - if (offset < 0 || offset >= maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - int newSize = offset + 1; - if (newSize < 0) newSize = 0x7FFFFFFF; - if (newSize > data_.length) - { - byte[] temp = data_; - data_ = new byte[newSize]; - System.arraycopy(temp, 0, data_, 0, temp.length); - } - int numBytes = newSize - offset; - if (numBytes > 0) - { - data_[offset] = data; - return 1; - } - return 0; - } - - - - /** - Writes an array of bytes to this BLOB, starting at position positionToStartWriting - in the BLOB. - - @param position The position (1-based) in the BLOB where writes should start. - @param bytesToWrite The array of bytes to be written to this BLOB. - @return The number of bytes written to the BLOB. - - @exception SQLException If there is an error accessing the BLOB or if the position - specified is greater than the length of the BLOB. - **/ - public synchronized int setBytes(long position, byte[] bytesToWrite) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int offset = (int)position-1; - - if (offset < 0 || offset >= maxLength_ || bytesToWrite == null) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - // We will write as many bytes as we can. If our internal byte array - // would overflow past the 2 GB boundary, we don't throw an error, we just - // return the number of bytes that were set. - int newSize = offset + bytesToWrite.length; - if (newSize < 0) newSize = 0x7FFFFFFF; // In case the addition resulted in overflow. - if (newSize > data_.length) - { - byte[] temp = data_; - data_ = new byte[newSize]; - System.arraycopy(temp, 0, data_, 0, temp.length); - } - int numBytes = newSize - offset; - System.arraycopy(bytesToWrite, 0, data_, offset, numBytes); - - return numBytes; - } - - - - /** - Writes all or part of the byte array the application passes in to this BLOB, - starting at position position in the BLOB. - The BLOB will be truncated after the last byte written. The lengthOfWrite - bytes written will start from offset in the bytes that were provided by the - application. - - @param position The position (1-based) in the BLOB where writes should start. - @param bytesToWrite The array of bytes to be written to this BLOB. - @param offset The offset into the array at which to start reading bytes (0-based). - @param lengthOfWrite The number of bytes to be written to the BLOB from the array of bytes. - @return The number of bytes written. - - @exception SQLException If there is an error accessing the BLOB or if the position - specified is greater than the length of the BLOB. - **/ - public synchronized int setBytes(long position, byte[] bytesToWrite, int offset, int lengthOfWrite) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int blobOffset = (int)position-1; - if (blobOffset < 0 || blobOffset >= maxLength_ || - bytesToWrite == null || offset < 0 || lengthOfWrite < 0 || (offset+lengthOfWrite) > bytesToWrite.length || - (blobOffset+lengthOfWrite) > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - // We will write as many bytes as we can. If our internal byte array - // would overflow past the 2 GB boundary, we don't throw an error, we just - // return the number of bytes that were set. - int newSize = blobOffset + lengthOfWrite; - if (newSize < 0) newSize = 0x7FFFFFFF; // In case the addition resulted in overflow. - if (newSize > data_.length) - { - byte[] temp = data_; - data_ = new byte[newSize]; - System.arraycopy(temp, 0, data_, 0, temp.length); - } - int numBytes = newSize - blobOffset; - System.arraycopy(bytesToWrite, offset, data_, blobOffset, numBytes); - - return numBytes; - } - - - - /** - Truncates this BLOB to a length of lengthOfBLOB bytes. - - @param lengthOfBLOB The length, in bytes, that this BLOB should be after - truncation. - - @exception SQLException If there is an error accessing the BLOB. - **/ - public synchronized void truncate(long lengthOfBLOB) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int length = (int)lengthOfBLOB; - if (length < 0 || length > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - byte[] temp = data_; - data_ = new byte[length]; - int numToCopy = length < temp.length ? length : temp.length; - System.arraycopy(temp, 0, data_, 0, numToCopy); - } - - - // @PDA jdbc40 - /** - * This method frees the Blob object and releases the - * resources that it holds. The object is invalid once the free - * method is called. If free is called multiple times, the - * subsequent calls to free are treated as a no-op. - * - * @throws SQLException - * if an error occurs releasing the Blob's resources - */ - public synchronized void free() throws SQLException - { - data_ = null; //@pda make available for GC - } - - // @PDA jdbc40 - /** - * Returns an InputStream object that contains a partial - * Blob value, starting with the byte specified by pos, which - * is length bytes in length. - * - * @param pos - * the offset to the first byte of the partial value to be - * retrieved. The first byte in the Blob is at - * position 1 - * @param length - * the length in bytes of the partial value to be retrieved - * @return InputStream through which the partial - * Blob value can be read. - * @throws SQLException - * if pos is less than 1 or if pos is greater than the number of - * bytes in the Blob or if pos + length is - * greater than the number of bytes in the Blob - */ - public synchronized InputStream getBinaryStream(long pos, long length) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - return new ByteArrayInputStream(data_, (int)pos, (int)length); - } - - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCBlobLocator.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCBlobLocator.java deleted file mode 100644 index ccff02555..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCBlobLocator.java +++ /dev/null @@ -1,500 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCBlobLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.OutputStream; -import java.sql.Blob; -import java.sql.SQLException; - -// Note: This code in this class requires understanding of bit manipulation -// and sign extension. Do not attempt to rework this code if you do not -// have a grasp of these concepts. - -// Currently, the database host server only supports 2 GB LOBs. Therefore, -// we validate any long parameters to make sure they are not greater than -// the maximum positive value for a 4-byte int (2 GB). This has the added -// bonus of being able to cast the long down to an int without worrying -// about sign extension. There are some cases where we could allow the -// user to pass in a long greater than 2 GB, but for consistency, we will -// throw an exception. - -// Offset refers to a 0-based index. Position refers to a 1-based index. - - -/** -The AS400JDBCBlobLocator class provides access to binary large -objects. The data is valid only within the current -transaction. -**/ -public class AS400JDBCBlobLocator implements Blob -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - - JDLobLocator locator_; - Object savedObject_; // This is our InputStream or byte[] or whatever that needs to be written if we are batching. - int savedScale_; // This is our length that goes with our savedObject_. - - private byte[] cache_; - private int cacheOffset_; - private static final byte[] INIT_CACHE = new byte[0]; - private int maxLength_; - -/** -Constructs an AS400JDBCBlobLocator object. The data for the -BLOB will be retrieved as requested, directly from the -IBM i system, using the locator handle. - -@param locator The locator. -**/ - AS400JDBCBlobLocator(JDLobLocator locator, Object savedObject, int savedScale) - { - locator_ = locator; - savedObject_ = savedObject; - savedScale_ = savedScale; - maxLength_ = locator_.getMaxLength(); - } - - - -/** -Returns the entire BLOB as a stream of uninterpreted bytes. - -@return The stream. - -@exception SQLException If an error occurs. -**/ - public InputStream getBinaryStream() throws SQLException - { - //Following Native, throw HY010 after free() has been called. Note: NullPointerException if synchronized(null-ref) - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - return new AS400JDBCInputStream(locator_); - } - } - - - -/** -Returns part of the contents of the BLOB. - -@param position The position within the BLOB (1-based). -@param length The length to return. -@return The contents. - -@exception SQLException If the position is not valid, - if the length is not valid, - or an error occurs. -**/ - public byte[] getBytes(long position, int length) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int offset = (int)position-1; - if (offset < 0 || length < 0 || (offset + length) > locator_.getLength()) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - int lengthToUse = (int)locator_.getLength() - offset; - if (lengthToUse <= 0) return new byte[0]; - if (lengthToUse > length) lengthToUse = length; - - DBLobData data = locator_.retrieveData(offset, lengthToUse); - int actualLength = data.getLength(); - byte[] bytes = new byte[actualLength]; - System.arraycopy(data.getRawBytes(), data.getOffset(), bytes, 0, actualLength); - return bytes; - } - } - - - -/** -Returns the handle to this BLOB locator in the database. - -@return The handle to this locator in the database. -**/ - int getHandle() throws SQLException //@free called from rs.updateValue(), which in turn will throw exc back to rs.updateX() caller - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - return locator_.getHandle(); - } - - - -/** -Returns the length of the BLOB. - -@return The length of the BLOB, in bytes. - -@exception SQLException If an error occurs. -**/ - public long length() throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - return locator_.getLength(); - } - } - - // Used for position(). - private void initCache() - { - cacheOffset_ = 0; - cache_ = INIT_CACHE; - } - - // Used for position(). - private int getCachedByte(int index) throws SQLException - { - int realIndex = index - cacheOffset_; - if (realIndex >= cache_.length) - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - int len = (int)locator_.getLength(); - if (len < 0) len = 0x7FFFFFFF; - if ((blockSize+index) > len) blockSize = len-index; - cache_ = getBytes(index+1, blockSize); - cacheOffset_ = index; - realIndex = 0; - } - if (cache_.length == 0) return -1; - return cache_[realIndex]; - } - - -/** -Returns the position at which a pattern is found in the BLOB. - -@param pattern The pattern. -@param position The position within the BLOB to begin - searching (1-based). -@return The offset into the BLOB at which the pattern was found, - or -1 if the pattern was not found or the pattern was a byte - array of length 0. - -@exception SQLException If the position is not valid or an error occurs. -**/ - public long position(byte[] pattern, long position) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int offset = (int)position-1; - if (pattern == null || offset < 0 || offset >= locator_.getLength()) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - int end = (int)locator_.getLength() - pattern.length; - - // We use a cache of bytes so we don't have to read in the entire - // contents of the BLOB. - initCache(); - - for (int i=offset; i<=end; ++i) - { - int j = 0; - int cachedByte = getCachedByte(i+j); - while (j < pattern.length && cachedByte != -1 && pattern[j] == (byte)cachedByte) - { - ++j; - cachedByte = getCachedByte(i+j); - } - if (j == pattern.length) return i+1; - } - return -1; - } - } - - - -/** -Returns the position at which a pattern is found in the BLOB. - -@param pattern The pattern. -@param position The position within the BLOB to begin - searching (1-based). -@return The offset into the BLOB at which the pattern was found, - or -1 if the pattern was not found or the pattern was a byte - array of length 0. - -@exception SQLException If the position is not valid or an error occurs. -**/ - public long position(Blob pattern, long position) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int offset = (int)position-1; - if (pattern == null || offset < 0 || offset >= locator_.getLength()) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - int patternLength = (int)pattern.length(); - int locatorLength = (int)locator_.getLength(); - if (patternLength > locatorLength || patternLength < 0) return -1; - - int end = locatorLength - patternLength; - - byte[] bytePattern = pattern.getBytes(1L, patternLength); //@CRS - Get all bytes for now, improve this later. - - // We use a cache of bytes so we don't have to read in the entire - // contents of the BLOB. - initCache(); - - for (int i=offset; i<=end; ++i) - { - int j = 0; - int cachedByte = getCachedByte(i+j); - while (j < patternLength && cachedByte != -1 && bytePattern[j] == (byte)cachedByte) - { - ++j; - cachedByte = getCachedByte(i+j); - } - if (j == patternLength) return i+1; - } - - return -1; - } - } - - - /** - Returns a stream that an application can use to write to this BLOB. - The stream begins at position position. - - @param position The position (1-based) in the BLOB where writes should start. - @return An OutputStream object to which data can be written by an application. - @exception SQLException If there is an error accessing the BLOB or if the position - specified is greater than the length of the BLOB. - **/ - public OutputStream setBinaryStream(long position) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - if (position <= 0 || position > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - return new AS400JDBCBlobLocatorOutputStream(this, position); - } - - - - /** - Writes an array of bytes to this BLOB, starting at position position - in the BLOB. - - @param position The position (1-based) in the BLOB where writes should start. - @param bytesToWrite The array of bytes to be written to this BLOB. - @return The number of bytes written to the BLOB. - - @exception SQLException If there is an error accessing the BLOB or if the position - specified is greater than the length of the BLOB. - **/ - public int setBytes(long position, byte[] bytesToWrite) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int offset = (int)position-1; - - if (offset < 0 || offset >= maxLength_ || bytesToWrite == null) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - // We will write as many bytes as we can. If the byte array - // would overflow past the 2 GB boundary, we don't throw an error, we just - // return the number of bytes that could be set. - int newSize = offset + bytesToWrite.length; - if (newSize < 0) newSize = 0x7FFFFFFF; // In case the addition resulted in overflow. - int numBytes = newSize - offset; - if (numBytes != bytesToWrite.length) - { - byte[] temp = bytesToWrite; - bytesToWrite = new byte[numBytes]; - System.arraycopy(temp, 0, bytesToWrite, 0, numBytes); - } - - // We don't really know if all of these bytes can be written until we go to - // the system, so we just return the byte[] length as the number written. - locator_.writeData((long)offset, bytesToWrite, false); //@K1A - return bytesToWrite.length; - } - } - - - - /** - Writes all or part of the byte array the application passes in to this BLOB, - starting at position position in the BLOB. - The lengthOfWrite - bytes written will start from offset in the bytes that were provided by the - application. - - @param position The position (1-based) in the BLOB where writes should start. - @param bytesToWrite The array of bytes to be written to this BLOB. - @param offset The offset into the array at which to start reading bytes (0-based). - @param lengthOfWrite The number of bytes to be written to the BLOB from the array of bytes. - @return The number of bytes written. - - @exception SQLException If there is an error accessing the BLOB or if the position - specified is greater than the length of the BLOB. - **/ - public int setBytes(long position, byte[] bytesToWrite, int offset, int lengthOfWrite) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int blobOffset = (int)position-1; - if (blobOffset < 0 || blobOffset >= maxLength_ || - bytesToWrite == null || offset < 0 || lengthOfWrite < 0 || (offset+lengthOfWrite) > bytesToWrite.length || - (blobOffset+lengthOfWrite) > maxLength_) - { - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - // We will write as many bytes as we can. If the byte array - // would overflow past the 2 GB boundary, we don't throw an error, we just - // return the number of bytes that could be set. - int newSize = blobOffset + lengthOfWrite; - if (newSize < 0) newSize = 0x7FFFFFFF; // In case the addition resulted in overflow. - int numBytes = newSize - blobOffset; - int realLength = (numBytes < lengthOfWrite ? numBytes : lengthOfWrite); - byte[] newData = new byte[realLength]; - System.arraycopy(bytesToWrite, offset, newData, 0, lengthOfWrite); - - // We don't really know if all of these bytes can be written until we go to - // the system, so we just return the byte[] length as the number written. - locator_.writeData((long)blobOffset, newData, false); //@K1A - return newData.length; - } - } - - - - /** - Truncates this BLOB to a length of lengthOfBLOB bytes. - - @param lengthOfBLOB The length, in bytes, that this BLOB should be after - truncation. - - @exception SQLException If there is an error accessing the BLOB or if the length - specified is greater than the length of the BLOB. - **/ - public void truncate(long lengthOfBLOB) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int length = (int)lengthOfBLOB; - if (length < 0 || length > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - // The host server does not currently provide a way for us - // to truncate the temp space used to hold the locator data, - // so we just keep track of it ourselves. This should work, - // since the temp space on the system should only be valid - // within the scope of our transaction/connection. That means - // there's no reason to go to the system to update the data, - // since no other process can get at it. - locator_.writeData(length, new byte[0], 0, 0, true); //@K1A - } - } - - //@PDA 550 - /** - * This method frees the Blob object and releases the - * resources that it holds. The object is invalid once the free - * method is called. If free is called multiple times, the - * subsequent calls to free are treated as a no-op. - * - * @throws SQLException - * if an error occurs releasing the Blob's resources - */ - public void free() throws SQLException //@sync - { - if(locator_ == null) - return; //no-op - - synchronized(locator_) //@sync - { - locator_.free(); - - locator_ = null; //@pda make objects available for GC - savedObject_ = null; - cache_ = null; - } - } - - - // @PDA jdbc40 - /** - * Returns an InputStream object that contains a partial - * Blob value, starting with the byte specified by pos, which - * is length bytes in length. - * - * @param pos - * the offset to the first byte of the partial value to be - * retrieved. The first byte in the Blob is at - * position 1 - * @param length - * the length in bytes of the partial value to be retrieved - * @return InputStream through which the partial - * Blob value can be read. - * @throws SQLException - * if pos is less than 1 or if pos is greater than the number of - * bytes in the Blob or if pos + length is - * greater than the number of bytes in the Blob - */ - public InputStream getBinaryStream(long pos, long length) throws SQLException //@sync - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - return new AS400JDBCInputStream(locator_, pos, length); - } - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCCallableStatement.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCCallableStatement.java deleted file mode 100644 index 451fad1dc..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCCallableStatement.java +++ /dev/null @@ -1,4413 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCCallableStatement.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; //@G4A -import java.io.Reader; //@G4A -import java.math.BigDecimal; -import java.net.MalformedURLException; //@G4A -import java.net.URL; //@G4A -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -import java.sql.Clob; -import java.sql.DataTruncation; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -/* endif */ -import java.sql.Ref; -/* ifdef JDBC40 */ -import java.sql.ResultSet; //@G4A -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -import java.sql.Statement; //@G4A -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.sql.Types; -import java.util.Calendar; -import java.util.Map; -/* ifdef JDBC40 */ -import java.util.Hashtable; //@G4A -import java.util.Vector; -/* endif */ - - -/** -

The AS400JDBCCallableStatement class runs a stored procedure. -Use Connection.prepareCall() to create new CallableStatement -objects. - -

Parameters are indexed sequentially, by number, starting -at 1. The caller must register output parameters before executing -the stored procedure. - -

The new JDK 1.4 methods add the ability to -retrieve information by column name in addition to column index. -Be aware you will see better performance accessing columns by their -index rather than accessing them by their name. -**/ -public class AS400JDBCCallableStatement -extends AS400JDBCPreparedStatement -implements CallableStatement -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - static final int NO_VALIDATION_ = -9999; - - private int[] registeredTypes_; // array of types to track what the user registers the output parm as - private boolean[] registered_; // array of booleans to keep track of which parameters were registered - - private boolean returnValueParameterRegistered_; // @E2A - private boolean wasNull_; - private boolean wasDataMappingError_; - - //private String[] parameterNames_; //@PDD jdbc40 move to preparedStatement - private int maxToLog_ = 10000; // Log value of parameter markers up to this length // @G7A - - /** - Constructs an AS400JDBCCallableStatement object. - - @param connection The connection to the system. - @param id The id. - @param transactionManager The transaction manager for the connection. - @param packageManager The package manager for the connection. - @param blockCriteria The block criteria. - @param blockSize The block size (in KB). - @param sqlStatement The SQL statement. - @parma packageCriteria The package criteria. - @param resultSetType The result set type. - @param resultSetConcurrency The result set concurrency. - @param resultSetHoldability The result set holdability. - @param generatedKeysRequested The generated keys requested. - - @exception SQLException If the SQL statement contains a syntax - error or an error occurs. - **/ - AS400JDBCCallableStatement(AS400JDBCConnection connection, - int id, - JDTransactionManager transactionManager, - JDPackageManager packageManager, - String blockCriteria, - int blockSize, - JDSQLStatement sqlStatement, - String packageCriteria, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability, //@G4A - int generatedKeysRequested) //@G4A - throws SQLException - { - // Turn off pre-fetch, since the output parameter values - // come back as result data. If we prefetched data, - // we would not be able to differentiate between - // pre-fetched data from the output parameter values. - super(connection, id, transactionManager, - packageManager, blockCriteria, blockSize, - false, sqlStatement, true, packageCriteria, - resultSetType, resultSetConcurrency, resultSetHoldability, - generatedKeysRequested); - - registeredTypes_ = new int[parameterCount_]; - registered_ = new boolean[parameterCount_]; - for(int i = 0; i < parameterCount_; ++i) - { - registered_[i] = false; - } - - returnValueParameterRegistered_ = false; // @E2A - - wasNull_ = false; - wasDataMappingError_ = false; - } - - // @C1A - /** - Performs common operations needed before an execute. - - @param sqlStatement The SQL statement. - @param request The execute request. - - @exception SQLException If an error occurs. - **/ - void commonExecuteBefore(JDSQLStatement sqlStatement, DBSQLRequestDS request) - throws SQLException - { - // Validate each parameters. If a parameter is not an - // output parameter, then it is okay for it not to have been - // registered. However, if an output parameter was not - // registered, we throw an exception. - for(int i = 0; i < parameterCount_; ++i) - if((registered_[i] == false) && (parameterRow_.isOutput(i+1))) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_COUNT_MISMATCH); - - super.commonExecuteBefore(sqlStatement, request); - } - - //@G4A - /* - Find the column index that matches this parameter name. - @param parameterName The parameter name to change into a column index (1-based). - */ - //@PDD jdbc40 move method to preparedStatement - /*int findParameterIndex(String parameterName) - throws SQLException - { - // Throw an exception if null was passed in - if(parameterName == null) - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - // Throw an exception if the Statement is closed (FUNCTION SEQUENCE) - if(isClosed()) - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - - boolean caseSensitive = false; - int count = 0; - int returnParm = 0; - - // determine if our search should be case insensitive or not - if(parameterName.startsWith("\"") && parameterName.endsWith("\"")) // assume no leading or trailing blanks - - { - parameterName = JDUtilities.stripOuterDoubleQuotes(parameterName); - - caseSensitive = true; - } - - // If we have a cache created, try to find the column name in it. - if(parameterNames_ != null) - { - // Look up the mapping in our cache. - while(count < parameterNames_.length) - { - if (parameterNames_[count] != null) - { - if((caseSensitive && parameterNames_[count].equals(parameterName)) - || (!caseSensitive && parameterNames_[count].equalsIgnoreCase(parameterName))) - { - returnParm = count+1; - break; - } - } - - ++count; - } - } - else - { - // Else, create a new hash table to hold all the column name/number mappings. - parameterNames_ = new String[parameterCount_]; - - // Cache all the parm names and numbers. - Statement s = null; //@scan1 - ResultSet rs = null; //@scan1 - try{ - s = connection_.createStatement(); - String catalogSeparator = ""; //@74A Added a check for the naming used. Need to use separator appropriate to naming. - if (connection_.getProperties().equals (JDProperties.NAMING, JDProperties.NAMING_SQL)) //@74A - catalogSeparator = "."; //@74A - else //@74A - catalogSeparator = "/"; //@74A - - String schema = sqlStatement_.getSchema(); - if(schema == null || schema.equals("")) // no schema in statement - { // Derive the schema. - schema = connection_.getDefaultSchema(true); // get raw value - - if(schema == null) // No default SQL schema was set on the connection url, or by the libraries connection property. - { - if(catalogSeparator.equals(".")) // using sql naming - { - schema = connection_.getUserName(); // set to user profile - } - else // using system naming - { - // Retrieve the library list from the IBM i - Use ROI Retrieve Library List. - ResultSet rs1 = JDUtilities.getLibraries(this, connection_, null, true); - Vector libListV = new Vector(); - while(rs1.next()) { - libListV.addElement(rs1.getString(1)); - } - rs1.close(); //@SS - String[] libList = new String[libListV.size()]; - libListV.toArray(libList); - - // Get a result set that we can scroll forward/backward through. - Statement s1 = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - rs = s1.executeQuery("SELECT ROUTINE_SCHEMA FROM QSYS2" - + catalogSeparator - + "SYSPROCS WHERE ROUTINE_NAME='" - + unquote(sqlStatement_.getProcedure()) - + "' AND IN_PARMS + OUT_PARMS + INOUT_PARMS = " - + parameterCount_);//@scan1 - if(!rs.next()) - JDError.throwSQLException(this, JDError.EXC_INTERNAL); // didn't find the procedure in any schema - - // If we get this far, at least one schema contains a procedure similar to ours. - boolean found = false; - for(int i=0; i parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.ARRAY) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - Array value = (data == null) ? null : data.getArray(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL ARRAY output parameter as an Array value. - DB2 for IBM i does not support arrays. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - **/ - public Array getArray(String parameterName) - throws SQLException - { - return getArray(findParameterIndex(parameterName)); //@array3 - } - - // JDBC 2.0 - /** - Returns the value of an SQL NUMERIC or DECIMAL output parameter as a - BigDecimal object. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public BigDecimal getBigDecimal(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registeredTypes_[parameterIndex-1] == -1) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.NUMERIC && registeredTypes_[parameterIndex-1] != Types.DECIMAL) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - BigDecimal value = (data == null) ? null : data.getBigDecimal(-1); - testDataTruncation(parameterIndex, data); - return value; - } - } - - /** - Returns the value of an SQL NUMERIC or DECIMAL output parameter as a - BigDecimal object. - - @param parameterIndex The parameter index (1-based). - @param scale The number of digits after the decimal. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the scale is not valid, - the statement was not executed, or - the requested conversion is not valid. - - @deprecated Use getBigDecimal(int) or getBigDecimal(String) instead. - @see #getBigDecimal(int) - **/ - public BigDecimal getBigDecimal(int parameterIndex, int scale) - throws SQLException - { - // Check for negative scale. - if(scale < 0) - JDError.throwSQLException(this, JDError.EXC_SCALE_INVALID); - - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.NUMERIC && registeredTypes_[parameterIndex-1] != Types.DECIMAL) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - BigDecimal value = (data == null) ? null : data.getBigDecimal(scale); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL NUMERIC or DECIMAL output parameter as a - BigDecimal object. - - @param parameterName The parameter name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public BigDecimal getBigDecimal(String parameterName) - throws SQLException - { - return getBigDecimal(findParameterIndex(parameterName)); - } - - // JDBC 2.0 - /** - Returns the value of an SQL BLOB output parameter as a Blob value. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Blob getBlob(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.BLOB) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - Blob value = (data == null) ? null : data.getBlob(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL BLOB output parameter as a Blob value. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Blob getBlob(String parameterName) - throws SQLException - { - return getBlob(findParameterIndex(parameterName)); - } - - /** - Returns the value of an SQL SMALLINT output parameter as a - Java boolean. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or false if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIT, but DB2 for IBM i - // does not support that. - // - public boolean getBoolean(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - // 16 is the value of Types.BOOLEAN added for JDK 1.4 - if(registeredTypes_[parameterIndex-1] != Types.SMALLINT && - registeredTypes_[parameterIndex-1] != Types.TINYINT && - registeredTypes_[parameterIndex-1] != 16) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - boolean value = (data == null) ? false : data.getBoolean(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL SMALLINT output parameter as a - Java boolean. - - @param parameterName The parameter name. - @return The parameter value or false if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIT, but DB2 for IBM i - // does not support that. - // - public boolean getBoolean(String parameterName) - throws SQLException - { - return getBoolean(findParameterIndex(parameterName)); - } - - /** - Returns the value of an SQL SMALLINT output parameter as a - Java byte. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid, - or an error occurs. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL TINYINT, but DB2 for IBM i - // does not support that. - // - public byte getByte(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.SMALLINT && registeredTypes_[parameterIndex-1] != Types.TINYINT) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - byte value = (data == null) ? 0 : data.getByte(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL SMALLINT output parameter as a - Java byte. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid, - or an error occurs. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL TINYINT, but DB2 for IBM i - // does not support that. - // - public byte getByte(String parameterName) - throws SQLException - { - return getByte(findParameterIndex(parameterName)); - } - - /** - Returns the value of an SQL BINARY or VARBINARY output parameter as a - Java byte array. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public byte[] getBytes(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - //if(registeredTypes_[parameterIndex-1] != Types.BINARY && registeredTypes_[parameterIndex-1] != Types.VARBINARY) - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - byte[] value = (data == null) ? null : data.getBytes(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL BINARY or VARBINARY output parameter as a - Java byte array. - - @param parameterName The parameter name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public byte[] getBytes(String parameterName) - throws SQLException - { - return getBytes(findParameterIndex(parameterName)); - } - - // JDBC 2.0 - /** - Returns the value of an SQL CLOB output parameter as a Clob value. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Clob getClob(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.CLOB) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - Clob value = (data == null) ? null : data.getClob(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL CLOB output parameter as a Clob value. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Clob getClob(String parameterName) - throws SQLException - { - return getClob(findParameterIndex(parameterName)); - } - - /** - Returns the value of an SQL DATE output parameter as a - java.sql.Date object using the default calendar. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Date getDate(int parameterIndex) - throws SQLException - { - return getDate(parameterIndex, Calendar.getInstance()); - } - - // JDBC 2.0 - /** - Returns the value of an SQL DATE output parameter as a - java.sql.Date object using a calendar other than the default. - - @param parameterIndex The parameter index (1-based). - @param calendar The calendar. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, - the calendar is null, or - the requested conversion is not valid. - **/ - public Date getDate(int parameterIndex, Calendar calendar) - throws SQLException - { - // Check for null calendar. - if(calendar == null) - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.DATE) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - Date value = (data == null) ? null : data.getDate(calendar); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL DATE output parameter as a - java.sql.Date object using the default calendar. - - @param parameterName The parameter name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - - public Date getDate(String parameterName) - throws SQLException - { - return getDate(findParameterIndex(parameterName)); - } - - // JDBC 2.0 - /** - Returns the value of an SQL DATE output parameter as a - java.sql.Date object using a calendar other than the default. - - @param parameterName The parameter name. - @param calendar The calendar. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, - the calendar is null, or - the requested conversion is not valid. - **/ - public Date getDate(String parameterName, Calendar calendar) - throws SQLException - { - return getDate(findParameterIndex(parameterName), calendar); - } - - /** - Returns the value of an SQL DOUBLE or FLOAT output parameter as a - Java double. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public double getDouble(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.DOUBLE && registeredTypes_[parameterIndex-1] != Types.FLOAT) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - double value = (data == null) ? 0 : data.getDouble(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL DOUBLE or FLOAT output parameter as a - Java double. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public double getDouble(String parameterName) - throws SQLException - { - return getDouble(findParameterIndex(parameterName)); - } - - /** - Returns the value of an SQL REAL or FLOAT output parameter as a - Java float. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public float getFloat(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.REAL && registeredTypes_[parameterIndex-1] != Types.FLOAT) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - float value = (data == null) ? 0 : data.getFloat(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL REAL or FLOAT output parameter as a - Java float. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public float getFloat(String parameterName) - throws SQLException - { - return getFloat(findParameterIndex(parameterName)); - } - - /** - Returns the value of an SQL INTEGER output parameter as a - Java int. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public int getInt(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.INTEGER) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - int value = (data == null) ? 0 : data.getInt(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL INTEGER output parameter as a - Java int. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public int getInt(String parameterName) - throws SQLException - { - return getInt(findParameterIndex(parameterName)); - } - - // @D0C - /** - If the connected system supports SQL BIGINT data, this returns - the value of an SQL BIGINT output parameter as a Java long. - Otherwise, this returns the value of an SQL INTEGER output - parameter as a Java long. SQL BIGINT data is supported on V4R5 - and later. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIGINT, but DB2 for IBM i - // does not support that until V4R5. - // - public long getLong(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(connection_.getVRM() >= JDUtilities.vrm450) - { - if(registeredTypes_[parameterIndex-1] != Types.BIGINT) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - else - { - if(registeredTypes_[parameterIndex-1] != Types.INTEGER) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - long value = (data == null) ? 0 : data.getLong(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - If the connected system supports SQL BIGINT data, this returns - the value of an SQL BIGINT output parameter as a Java long. - Otherwise, this returns the value of an SQL INTEGER output - parameter as a Java long. SQL BIGINT data is supported on V4R5 - and later. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIGINT, but DB2 for IBM i - // does not support that until V4R5. - // - public long getLong(String parameterName) - throws SQLException - { - return getLong(findParameterIndex(parameterName)); - } - - /** - Returns the value of an output parameter as a Java Object. - The type of the object corresponds to the SQL type that was - registered for this parameter using registerOutParameter(). - When the parameter is a user-defined type, then the - connection's type map is used to create the object. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Object getObject(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - if(data == null) - return null; - Object value = (data == null) ? null : data.getObject(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - // JDBC 2.0 - /** - Returns the value of an output parameter as a Java Object. - This driver does not support the type map. - - @param parameterIndex The parameter index (1-based). - @param typeMap The type map. This is not used. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Object getObject(int parameterIndex, Map typeMap) - throws SQLException - { - // Check for null type map, even though we don't use it. - if(typeMap == null) - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - return getObject(parameterIndex); - } - - //@G4A JDBC 3.0 - /** - Returns the value of an output parameter as a Java Object. - The type of the object corresponds to the SQL type that was - registered for this parameter using registerOutParameter(). - When the parameter is a user-defined type, then the - connection's type map is used to create the object. - - @param parameterName The parameter name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Object getObject(String parameterName) - throws SQLException - { - return getObject(findParameterIndex(parameterName)); - } - - //@G4A JDBC 3.0 - /** - Returns the value of an output parameter as a Java Object. - This driver does not support the type map. - - @param parameterName The parameter name. - @param typeMap The type map. This is not used. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Object getObject(String parameterName, Map typeMap) - throws SQLException - { - return getObject(findParameterIndex(parameterName)); - } - - // JDBC 2.0 - /** - Returns the value of an SQL REF output parameter as a Ref value. - DB2 for IBM i does not support structured types. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support REFs. - **/ - public Ref getRef(int parameterIndex) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL REF output parameter as a Ref value. - DB2 for IBM i does not support structured types. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support REFs. - **/ - public Ref getRef(String parameterName) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - /** - Returns the value of an SQL SMALLINT output parameter as a - Java short value. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public short getShort(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.SMALLINT) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - short value = (data == null) ? 0 : data.getShort(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL SMALLINT output parameter as a - Java short value. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public short getShort(String parameterName) - throws SQLException - { - return getShort(findParameterIndex(parameterName)); - } - - /** - Returns the value of an SQL CHAR or VARCHAR output - parameter as a Java String object. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public String getString(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - //if(registeredTypes_[parameterIndex-1] != Types.CHAR && registeredTypes_[parameterIndex-1] != Types.VARCHAR) - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - String value = (data == null) ? null : data.getString(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL CHAR or VARCHAR output - parameter as a Java String object. - - @param parameterName The parameter name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public String getString(String parameterName) - throws SQLException - { - return getString(findParameterIndex(parameterName)); - } - - /** - Returns the value of an SQL TIME output parameter as a - java.sql.Time object using the default calendar. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Time getTime(int parameterIndex) - throws SQLException - { - return getTime(parameterIndex, Calendar.getInstance()); - } - - // JDBC 2.0 - /** - Returns the value of an SQL TIME output parameter as a - java.sql.Time object using a calendar other than the - default. - - @param parameterIndex The parameter index (1-based). - @param calendar The calendar. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, - the calendar is null, or - the requested conversion is not valid. - **/ - public Time getTime(int parameterIndex, Calendar calendar) - throws SQLException - { - // Check for null calendar. - if(calendar == null) - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.TIME) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - Time value = (data == null) ? null : data.getTime(calendar); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL TIME output parameter as a - java.sql.Time object using the default calendar. - - @param parameterName The parameter name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Time getTime(String parameterName) - throws SQLException - { - return getTime(findParameterIndex(parameterName)); - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL TIME output parameter as a - java.sql.Time object using a calendar other than the - default. - - @param parameterName The parameter name. - @param calendar The calendar. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, - the calendar is null, or - the requested conversion is not valid. - **/ - public Time getTime(String parameterName, Calendar calendar) - throws SQLException - { - return getTime(findParameterIndex(parameterName), calendar); - } - - /** - Returns the value of an SQL TIMESTAMP output parameter as a - java.sql.Timestamp object using the default calendar. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Timestamp getTimestamp(int parameterIndex) - throws SQLException - { - return getTimestamp(parameterIndex, Calendar.getInstance()); - } - - // JDBC 2.0 - /** - Returns the value of an SQL TIMESTAMP output parameter as a - java.sql.Timestamp object using a calendar other than the - default. - - @param parameterIndex The parameter index (1-based). - @param calendar The calendar. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, - the calendar is null, or - the requested conversion is not valid. - **/ - public Timestamp getTimestamp(int parameterIndex, Calendar calendar) - throws SQLException - { - // Check for null calendar. - if(calendar == null) - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.TIMESTAMP) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - Timestamp value = (data == null) ? null : data.getTimestamp(calendar); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL TIMESTAMP output parameter as a - java.sql.Timestamp object using the default calendar. - - @param parameterName The parameter name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Timestamp getTimestamp(String parameterName) - throws SQLException - { - return getTimestamp(findParameterIndex(parameterName)); - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL TIMESTAMP output parameter as a - java.sql.Timestamp object using a calendar other than the - default. - - @param parameterName The parameter name. - @param calendar The calendar. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, - the calendar is null, or - the requested conversion is not valid. - **/ - public Timestamp getTimestamp(String parameterName, Calendar calendar) - throws SQLException - { - return getTimestamp(findParameterIndex(parameterName), calendar); - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL DATALINK output parameter as a - java.net.URL object. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed or - the requested conversion is not valid. - **/ - public URL getURL(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.CHAR && - registeredTypes_[parameterIndex-1] != Types.VARCHAR && - registeredTypes_[parameterIndex-1] != Types.DATALINK) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - String value = (data == null) ? null : data.getString(); - testDataTruncation(parameterIndex, data); - - try - { - return new java.net.URL(value); - } - catch(MalformedURLException e) - { - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID, e); - return null; - } - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL DATALINK output parameter as a - java.net.URL object. - - @param parameterName The parameter name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the name is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed or - the requested conversion is not valid. - **/ - public URL getURL(String parameterName) - throws SQLException - { - return getURL(findParameterIndex(parameterName)); - } - - /** - Returns the value for an output parameter for the specified - index, and performs all appropriate validation. Also checks - for SQL NULL. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - private SQLData getValue(int parameterIndex) - throws SQLException - { - // Verify that the statement has been executed. - if(! executed_) - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - - // Get the data and check for SQL NULL. - SQLData data = parameterRow_.getSQLData(parameterIndex); - wasNull_ = parameterRow_.isNull(parameterIndex); - wasDataMappingError_ = parameterRow_.isDataMappingError(parameterIndex); - - return wasNull_ ? null : data; - } - - /** - Registers the type for an output parameter. Before - executing the stored procedure call, explicitly - register the type of each output parameter. When - reading the value of an output parameter, use a - get method that corresponds to the registered type. A - parameter that is used for both input and output can not - be registered with a different type than was used when - it was set. - - @param parameterIndex The parameter index (1-based). - @param sqlType The SQL type code defined in java.sql.Types. - @param scale The number of digits after the decimal - if sqlType is DECIMAL or NUMERIC. - - @exception SQLException If the index is not valid, - the scale is not valid, - the parameter is not an output parameter, - or the requested conversion is not valid. - **/ - public void registerOutParameter(int parameterIndex, - int sqlType, - int scale) - throws SQLException - { - synchronized(internalLock_) - { // @E1A - checkOpen(); - - // Check if the parameter index refers to the return value parameter. @E2A - // If so, it must be registed as an INTEGER. @E2A - // If it is not parameter index 1, then decrement the parameter index, @E2A - // since we are "faking" the return value parameter. @E2A - if(useReturnValueParameter_) - { // @E2A - if(parameterIndex == 1) - { // @E2A - if(sqlType != Types.INTEGER) // @E2A - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); // @E2A - returnValueParameterRegistered_ = true; // @E2A - return; // @E2A - } // @E2A - else // @E2A - --parameterIndex; // @E2A - } // @E2A - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Validate the scale. - if(scale < 0) - JDError.throwSQLException(this, JDError.EXC_SCALE_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - registeredTypes_[parameterIndex-1] = sqlType; - registered_[parameterIndex-1] = true; - } - } - - /** - Registers the type for an output parameter. Before - executing the stored procedure call, explicitly - register the type of each output parameter. When - reading the value of an output parameter, use a - get method that corresponds to the registered type. A - parameter that is used for both input and output can not - be registered with a different type than was used when - it was set. - - @param parameterIndex The parameter index (1-based). - @param sqlType The SQL type code defined in java.sql.Types. - - @exception SQLException If the index is not valid, - the parameter is not an output parameter, - or the requested conversion is not valid. - **/ - public void registerOutParameter(int parameterIndex, int sqlType) - throws SQLException - { - registerOutParameter(parameterIndex, sqlType, 0); - } - - // @A1 - Added for JDK 2.0RC1 - typeName can be ignored, since it is not relevant to the AS/400. - /** - Registers the type for an output parameter. Before - executing the stored procedure call, explicitly - register the type of each output parameter. When - reading the value of an output parameter, use a - get method that corresponds to the registered type. A - parameter that is used for both input and output can not - be registered with a different type than was used when - it was set. - - @param parameterIndex The parameter index (1-based). - @param sqlType The SQL type code defined in java.sql.Types. - @param typeName The fully-qualified name of an SQL structured type. This value will be ignored. - - @exception SQLException If the index is not valid, - the parameter is not an output parameter, - or the requested conversion is not valid. - **/ - public void registerOutParameter(int parameterIndex, int sqlType, String typeName) - throws SQLException - { - registerOutParameter(parameterIndex, sqlType, 0); - } - - //@G4A JDBC 3.0 - /** - Registers the type for an output parameter. Before - executing the stored procedure call, explicitly - register the type of each output parameter. When - reading the value of an output parameter, use a - get method that corresponds to the registered type. A - parameter that is used for both input and output can not - be registered with a different type than was used when - it was set. - - @param parameterName The parameter name. - @param sqlType The SQL type code defined in java.sql.Types. - - @exception SQLException If the index is not valid, - the parameter is not an output parameter, - or the requested conversion is not valid. - **/ - public void registerOutParameter(String parameterName, int sqlType) - throws SQLException - { - registerOutParameter(findParameterIndex(parameterName), sqlType, 0); - } - - //@G4A JDBC 3.0 - /** - Registers the type for an output parameter. Before - executing the stored procedure call, explicitly - register the type of each output parameter. When - reading the value of an output parameter, use a - get method that corresponds to the registered type. A - parameter that is used for both input and output can not - be registered with a different type than was used when - it was set. - - @param parameterName The parameter name. - @param sqlType The SQL type code defined in java.sql.Types. - @param scale The number of digits after the decimal - if sqlType is DECIMAL or NUMERIC. - - @exception SQLException If the index is not valid, - the scale is not valid, - the parameter is not an output parameter, - or the requested conversion is not valid. - **/ - public void registerOutParameter(String parameterName, int sqlType, int scale) - throws SQLException - { - registerOutParameter(findParameterIndex(parameterName), sqlType, scale); - } - - //@G4A JDBC 3.0 - /** - Registers the type for an output parameter. Before - executing the stored procedure call, explicitly - register the type of each output parameter. When - reading the value of an output parameter, use a - get method that corresponds to the registered type. A - parameter that is used for both input and output can not - be registered with a different type than was used when - it was set. - - @param parameterName The parameter name. - @param sqlType The SQL type code defined in java.sql.Types. - @param typeName The fully-qualified name of an SQL structured type. This value will be ignored. - - @exception SQLException If the index is not valid, - the parameter is not an output parameter, - or the requested conversion is not valid. - **/ - public void registerOutParameter(String parameterName, int sqlType, String typeName) - throws SQLException - { - registerOutParameter(findParameterIndex(parameterName), sqlType, 0); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to an ASCII stream value. The driver - reads the data from the stream as needed until no more bytes - are available. The driver converts this to an SQL VARCHAR - value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param length The number of bytes in the stream. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - the length is not valid, - the input stream does not contain all - ASCII characters, or an error occurs - while reading the input stream. - **/ - public void setAsciiStream(String parameterName, InputStream parameterValue, int length) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setAsciiStream()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); // @G7A - } // @G7A - - setAsciiStream(findParameterIndex(parameterName), parameterValue, length); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a BigDecimal value. The driver converts - this to an SQL NUMERIC value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, or the parameter - is not an input parameter. - **/ - public void setBigDecimal(String parameterName, BigDecimal parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setBigDecimal()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setBigDecimal(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a binary stream value. The driver - reads the data from the stream as needed until no more bytes - are available. The driver converts this to an SQL VARBINARY - value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param length The number of bytes in the stream. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - the length is not valid, or - an error occurs while reading the - input stream. - **/ - public void setBinaryStream(String parameterName, InputStream parameterValue, int length) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setBinaryStream()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); // @G7A - } // @G7A - - setBinaryStream(findParameterIndex(parameterName), parameterValue, length); - } - - /** - Sets an input parameter to a Java boolean value. The driver - converts this to an SQL SMALLINT value. - - @param parameterName The parameter name. - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the parameterName is not valid, or - the parameter is not an input parameter. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIT, but DB2 for IBM i - // does not support that. - // - public void setBoolean(String parameterName, boolean parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setBoolean()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue); // @G7A - } // @G7A - - setBoolean(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a Java byte value. The driver - converts this to an SQL SMALLINT value. - - @param parameterName The parameter name. - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or - the parameter is not an input parameter. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL TINYINT, but DB2 for IBM i - // does not support that. - // - public void setByte(String parameterName, byte parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setByte()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue); // @G7A - } // @G7A - - setByte(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a Java byte array value. The driver - converts this to an SQL VARBINARY value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or the parameter - is not an input parameter. - **/ - public void setBytes(String parameterName, byte[] parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setBytes()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setBytes(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a character stream value. The driver - reads the data from the character stream as needed until no more - characters are available. The driver converts this to an SQL - VARCHAR value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param length The number of bytes in the reader. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - the length is not valid, - or an error occurs while reading the - character stream - **/ - public void setCharacterStream(String parameterName, Reader parameterValue, int length) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setCharacterStream()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); // @G7A - } // @G7A - - setCharacterStream(findParameterIndex(parameterName), parameterValue, length); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a java.sql.Date value using the - default calendar. The driver converts this to an SQL DATE - value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or the parameter - is not an input parameter. - - **/ - public void setDate(String parameterName, Date parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setDate()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setDate(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a java.sql.Date value using a - calendar other than the default. The driver converts this - to an SQL DATE value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param cal The calendar. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - or the calendar is null. - - **/ - public void setDate(String parameterName, Date parameterValue, Calendar cal) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setDate()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setDate(findParameterIndex(parameterName), parameterValue, cal); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a Java double value. The driver - converts this to an SQL DOUBLE value. - - @param parameterName The parameter name. - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the parameter name is not valid or - the parameter is not an input parameter. - **/ - public void setDouble(String parameterName, double parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setDouble()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue); // @G7A - } // @G7A - - setDouble(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a Java float value. The driver - converts this to an SQL REAL value. - - @param parameterName The parameter name. - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or - the parameter is not an input parameter. - **/ - // - // Note: The JDBC 1.22 specification states that this - // method should set an SQL FLOAT value. However, - // all tables map float to REAL. Otherwise, - // nothing is symetrical and certain INOUT - // parameters do not work. - // - public void setFloat(String parameterName, float parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setFloat()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue); // @G7A - } // @G7A - - setFloat(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a Java int value. The driver - converts this to an SQL INTEGER value. - - @param parameterName The parameter name. - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the parameter name is not valid or - the parameter is not an input parameter. - **/ - public void setInt(String parameterName, int parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setInt()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue); // @G7A - } // @G7A - - setInt(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a Java long value. - If the connected system supports SQL BIGINT data, the driver - converts this to an SQL BIGINT value. Otherwise, the driver - converts this to an SQL INTEGER value. SQL BIGINT data is - supported on V4R5 and later. - - @param parameterName The parameter name. - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or - the parameter is not an input parameter. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIGINT, but DB2 for IBM i - // does not support that until V4R5. - // - public void setLong(String parameterName, long parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setLong()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue); // @G7A - } // @G7A - - setLong(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to SQL NULL. - - @param parameterName The parameter name. - @param sqlType The SQL type code defined in java.sql.Types. - - @exception SQLException If the statement is not open, - the parameterName is not valid, - the parameter is not an input parameter, - or the SQL type is not valid. - **/ - public void setNull(String parameterName, int sqlType) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setNull()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - } // @G7A - - setNull(findParameterIndex(parameterName), sqlType); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to SQL NULL. - - @param parameterName The parameter name. - @param sqlType The SQL type code defined in java.sql.Types. - @param typeName The fully-qualified name of an SQL structured type. This value will be ignored. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - or the SQL type is not valid. - **/ - public void setNull(String parameterName, int sqlType, String typeName) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setNull()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - } // @G7A - - setNull(findParameterIndex(parameterName), sqlType, typeName); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to an Object value. The driver converts - this to a value of an SQL type, depending on the type of the - specified value. The JDBC specification defines a standard - mapping from Java types to SQL types. In the cases where a - SQL type is not supported by DB2 for IBM i, the - next closest matching type - is used. -
If proxy support is in use, the Object must be serializable. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - the type of value is not supported, - or the parameter is not serializable - (when proxy support is in use). - **/ - public void setObject(String parameterName, Object parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setObject()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " type: " + parameterValue.getClass().getName()); // @G7A - } // @G7A - - setObject(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to an Object value. The driver converts - this to a value with the specified SQL type. -
If proxy support is in use, the Object must be serializable. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param targetSqlType The SQL type code defined in java.sql.Types. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - the SQL type is not valid, - the scale is not valid, - or the parameter is not serializable - (when proxy support is in use). - **/ - public void setObject(String parameterName, Object parameterValue, int targetSqlType) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setObject()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " type: " + parameterValue.getClass().getName()); // @G7A - } // @G7A - - setObject(findParameterIndex(parameterName), parameterValue, targetSqlType); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to an Object value. The driver converts - this to a value with the specified SQL type. -
If proxy support is in use, the Object must be serializable. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param targetSqlType The SQL type code defined in java.sql.Types. - @param scale The number of digits after the decimal - if sqlType is DECIMAL or NUMERIC. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - the SQL type is not valid, - the scale is not valid, - or the parameter is not serializable - (when proxy support is in use). - **/ - public void setObject(String parameterName, Object parameterValue, int targetSqlType, int scale) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setObject()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " type: " + parameterValue.getClass().getName()); // @G7A - } // @G7A - - setObject(findParameterIndex(parameterName), parameterValue, targetSqlType, scale); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a Java short value. The driver - converts this to an SQL SMALLINT value. - - @param parameterName The parameter name. - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the parameter name is not valid or - the parameter is not an input parameter. - **/ - public void setShort(String parameterName, short parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setShort()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue); // @G7A - } // @G7A - - setShort(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a String value. The driver - converts this to an SQL VARCHAR value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or the parameter - is not an input parameter. - **/ - public void setString(String parameterName, String parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setString()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else if(parameterValue.length() > maxToLog_) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + parameterValue.length()); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue); // @G7A - } // @G7A - - setString(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a java.sql.Time value using the - default calendar. The driver converts this to an SQL TIME value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or the parameter - is not an input parameter. - **/ - public void setTime(String parameterName, Time parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setTime()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setTime(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a java.sql.Time value using a calendar - other than the default. The driver converts this to an SQL TIME - value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param cal The calendar. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - or the calendar is null. - **/ - public void setTime(String parameterName, Time parameterValue, Calendar cal) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setTime()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setTime(findParameterIndex(parameterName), parameterValue, cal); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a java.sql.Timestamp value using the - default calendar. The driver converts this to an SQL TIMESTAMP - value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or the parameter - is not an input parameter. - **/ - public void setTimestamp(String parameterName, Timestamp parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setTimeStamp()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setTimestamp(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a java.sql.Timestamp value using a - calendar other than the default. The driver converts this to - an SQL TIMESTAMP value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param cal The calendar. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - or the calendar is null. - **/ - public void setTimestamp(String parameterName, Timestamp parameterValue, Calendar cal) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setTimeStamp()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setTimestamp(findParameterIndex(parameterName), parameterValue, cal); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a URL value. The driver converts this to an - SQL DATALINK value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or the parameter - is not an input parameter. - **/ - public void setURL(String parameterName, URL parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setURL()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setURL(findParameterIndex(parameterName), parameterValue); - } - - /** - Tests if a DataTruncation occurred on the read of a piece of - data and posts a DataTruncation warning if so. - - @param parameterIndex The parameter index (1-based). - @param data The data that was read, or null for SQL NULL. - **/ - private void testDataTruncation(int parameterIndex, SQLData data) - { - if(wasDataMappingError_) - { - postWarning(new DataTruncation(parameterIndex, true, true, -1, -1)); - } - - if(data != null) - { - int truncated = data.getTruncated(); - if(truncated > 0) - { - int actualSize = data.getActualSize(); - postWarning(new DataTruncation(parameterIndex, true, true, actualSize, actualSize - truncated)); - } - } - } - - //@pdd jdbc40 move method to preparedStatement - //@pdd private static final String unquote(String name) - //@pdd { - //@pdd return JDUtilities.prepareForSingleQuotes(name, true); - //@pdd } - - //@pdd jdbc40 move methodto preparedStatement - //@pdd private static final String unquoteNoUppercase(String name) - //@pdd { - //@pdd return JDUtilities.prepareForSingleQuotes(name, false); - //@pdd } - - /** - Indicates if the last parameter read has the - value of SQL NULL. - - @return true if the value is SQL NULL; - false otherwise. - - @exception SQLException If the statement is not open. - **/ - public boolean wasNull() - throws SQLException - { - synchronized(internalLock_) - { // @E1A - checkOpen(); - return wasNull_; - } - } - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCCallableStatement", "java.sql.CallableStatement" }; - } - - //@PDA jdbc40 - /** - * Retrieves the value of the designated parameter as a - * java.io.Reader object in the Java programming language. - * - * @return a java.io.Reader object that contains the parameter - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - */ - public Reader getCharacterStream(int parameterIndex) throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - Reader value = (data == null) ? null : data.getCharacterStream(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@PDA jdbc40 - /** - * Retrieves the value of the designated parameter as a - * java.io.Reader object in the Java programming language. - * - * @param parameterName the name of the parameter - * @return a java.io.Reader object that contains the parameter - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public Reader getCharacterStream(String parameterName) throws SQLException - { - return getCharacterStream(findParameterIndex(parameterName)); - } - - //@PDA jdbc40 - /** - * Retrieves the value of the designated parameter as a - * java.io.Reader object in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR parameters. - * - * @return a java.io.Reader object that contains the parameter - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public Reader getNCharacterStream(int parameterIndex) throws SQLException - { - - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - Reader value = (data == null) ? null : data.getNCharacterStream(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@PDA jdbc40 - /** - * Retrieves the value of the designated parameter as a - * java.io.Reader object in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR parameters. - * - * @param parameterName the name of the parameter - * @return a java.io.Reader object that contains the parameter - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public Reader getNCharacterStream(String parameterName) throws SQLException - { - return getNCharacterStream(findParameterIndex(parameterName)); - } - - //@PDA jdbc40 - /** - * Retrieves the value of the designated JDBC NCLOB parameter as a - * java.sql.NClob object in the Java programming language. - * - * @param parameterIndex the first parameter is 1, the second is 2, and - * so on - * @return the parameter value as a NClob object in the - * Java programming language. If the value was SQL NULL, the - * value null is returned. - * @exception SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public NClob getNClob(int parameterIndex) throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.CLOB) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - NClob value = (data == null) ? null : data.getNClob(); - testDataTruncation(parameterIndex, data); - return value; - } - } -/* endif */ - - //@PDA jdbc40 - /** - * Retrieves the value of a JDBC NCLOB parameter as a - * java.sql.NClob object in the Java programming language. - * @param parameterName the name of the parameter - * @return the parameter value as a NClob object in the - * Java programming language. If the value was SQL NULL, - * the value null is returned. - * @exception SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public NClob getNClob(String parameterName) throws SQLException - { - return getNClob(findParameterIndex(parameterName)); - } -/* endif */ - - //@PDA jdbc40 - /** - * Retrieves the value of the designated NCHAR, - * NVARCHAR - * or LONGNVARCHAR parameter as - * a String in the Java programming language. - *

- * For the fixed-length type JDBC NCHAR, - * the String object - * returned has exactly the same value the SQL - * NCHAR value had in the - * database, including any padding added by the database. - * - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @return a String object that maps an - * NCHAR, NVARCHAR or LONGNVARCHAR value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setNString - */ - public String getNString(int parameterIndex) throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - String value = (data == null) ? null : data.getNString(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@PDA jdbc40 - /** - * Retrieves the value of the designated NCHAR, - * NVARCHAR - * or LONGNVARCHAR parameter as - * a String in the Java programming language. - *

- * For the fixed-length type JDBC NCHAR, - * the String object - * returned has exactly the same value the SQL - * NCHAR value had in the - * database, including any padding added by the database. - * - * @param parameterName the name of the parameter - * @return a String object that maps an - * NCHAR, NVARCHAR or LONGNVARCHAR value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setNString - */ - public String getNString(String parameterName) throws SQLException - { - return getNString(findParameterIndex(parameterName)); - } - - //@PDA jdbc40 - /** - * Retrieves the value of the designated JDBC ROWID parameter as a - * java.sql.RowId object. - * - * @param parameterIndex the first parameter is 1, the second is 2,... - * @return a RowId object that represents the JDBC ROWID - * value is used as the designated parameter. If the parameter contains - * a SQL NULL, then a null value is returned. - * @throws SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public RowId getRowId(int parameterIndex) throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - RowId value = (data == null) ? null : data.getRowId(); - testDataTruncation(parameterIndex, data); - return value; - } - } -/* endif */ - - //@PDA jdbc40 - /** - * Retrieves the value of the designated JDBC ROWID parameter as a - * java.sql.RowId object. - * - * @param parameterName the name of the parameter - * @return a RowId object that represents the JDBC ROWID - * value is used as the designated parameter. If the parameter contains - * a SQL NULL, then a null value is returned. - * @throws SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public RowId getRowId(String parameterName) throws SQLException - { - return getRowId(findParameterIndex(parameterName)); - } -/* endif */ - - //@PDA jdbc40 - /** - * Retrieves the value of the designated SQL XML parameter as a - * java.sql.SQLXML object in the Java programming language. - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @return a SQLXML object that maps an SQL XML value - * @throws SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public SQLXML getSQLXML(int parameterIndex) throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - SQLXML value = (data == null) ? null : data.getSQLXML(); - testDataTruncation(parameterIndex, data); - return value; - } - } -/* endif */ - - //@PDA jdbc40 - /** - * Retrieves the value of the designated SQL XML parameter as a - * java.sql.SQLXML object in the Java programming language. - * @param parameterName the name of the parameter - * @return a SQLXML object that maps an SQL XML value - * @throws SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public SQLXML getSQLXML(String parameterName) throws SQLException - { - return getSQLXML(findParameterIndex(parameterName)); - } -/* endif */ - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterName the name of the parameter - * @param x the Java input stream that contains the ASCII parameter value - * @param length the number of bytes in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setAsciiStream()"); - if(x == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); - } - - setAsciiStream(findParameterIndex(parameterName), x, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the stream - * as needed until end-of-file is reached. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterName the name of the parameter - * @param x the java input stream which contains the binary parameter value - * @param length the number of bytes in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method. - */ - public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setBinaryStream()"); - if(x == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); - } - - setBinaryStream(findParameterIndex(parameterName), x, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Blob object. - * The driver converts this to an SQL BLOB value when it - * sends it to the database. - * - * @param parameterName the name of the parameter - * @param x a Blob object that maps an SQL BLOB value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setBlob(String parameterName, Blob x) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setBlob()"); - if(x == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + x.length()); - } - - setBlob(findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a InputStream object. The InputStream must contain the number - * of characters specified by length, otherwise a SQLException will be - * generated when the CallableStatement is executed. - * This method differs from the setBinaryStream (int, InputStream, int) - * method because it informs the driver that the parameter value should be - * sent to the system as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be sent to the system as a LONGVARBINARY or a BLOB - * - * @param parameterName the name of the parameter to be set - * - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @throws SQLException if parameterIndex does not correspond - * to a parameter marker in the SQL statement, or if the length specified - * is less than zero; if the number of bytes in the inputStream does not match - * the specfied length; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * - */ - public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setBlob()"); - if(inputStream == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); - } - - setBlob(findParameterIndex(parameterName), inputStream, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterName the name of the parameter - * @param reader the java.io.Reader object that - * contains the UNICODE data used as the designated parameter - * @param length the number of characters in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setCharacterStream()"); - if(reader == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); - } - - setCharacterStream(findParameterIndex(parameterName), reader, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Clob object. - * The driver converts this to an SQL CLOB value when it - * sends it to the database. - * - * @param parameterName the name of the parameter - * @param x a Clob object that maps an SQL CLOB value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setClob(String parameterName, Clob x) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setClob()"); - if(x == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + x.length()); - } - - setClob(findParameterIndex(parameterName), x); - - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the CallableStatement is executed. - * This method differs from the setCharacterStream (int, Reader, int) method - * because it informs the driver that the parameter value should be sent to - * the system as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the system as a LONGVARCHAR or a CLOB - * @param parameterName the name of the parameter to be set - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if the length specified is less than zero; - * a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * - */ - public void setClob(String parameterName, Reader reader, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setClob()"); - if(reader == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); - } - - setClob(findParameterIndex(parameterName), reader, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * @param parameterName the name of the parameter to be set - * @param value the parameter value - * @param length the number of characters in the parameter data. - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setNCharacterStream()"); - if(value == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); - } - - setNCharacterStream(findParameterIndex(parameterName), value, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a java.sql.NClob object. The object - * implements the java.sql.NClob interface. This NClob - * object maps to a SQL NCLOB. - * @param parameterName the name of the parameter to be set - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public void setNClob(String parameterName, NClob value) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setNClob()"); - if(value == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + value.length()); - } - - setNClob(findParameterIndex(parameterName), value); - } -/* endif */ - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the CallableStatement is executed. - * This method differs from the setCharacterStream (int, Reader, int) method - * because it informs the driver that the parameter value should be sent to - * the system as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the system as a LONGNVARCHAR or a NCLOB - * - * @param parameterName the name of the parameter to be set - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if the length specified is less than zero; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setNClob(String parameterName, Reader reader, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setNClob()"); - if(reader == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); - } - - setNClob(findParameterIndex(parameterName), reader, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given String object. - * The driver converts this to a SQL NCHAR or - * NVARCHAR or LONGNVARCHAR - * @param parameterName the name of the parameter to be set - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setNString(String parameterName, String value) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setNString()"); - if(value == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else if(value.length() > maxToLog_) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + value.length()); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + value); - } - - setNString(findParameterIndex(parameterName), value); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.RowId object. The - * driver converts this to a SQL ROWID when it sends it to the - * database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @throws SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public void setRowId(String parameterName, RowId x) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setRowId()"); - if(x == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + x.toString()); - } - - setRowId(findParameterIndex(parameterName), x); - } -/* endif */ - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.SQLXML object. The driver converts this to an - * SQL XML value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param xmlObject a SQLXML object that maps an SQL XML value - * @throws SQLException if a database access error occurs, - * this method is called on a closed CallableStatement or - * the java.xml.transform.Result, - * Writer or OutputStream has not been closed for the SQLXML object - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setClob()"); - if(xmlObject == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + xmlObject.toString().length()); - } - - setSQLXML(findParameterIndex(parameterName), xmlObject); - } -/* endif */ - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setAsciiStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param x the Java input stream that contains the ASCII parameter value - * @exception SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setAsciiStream(String parameterName, InputStream x) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setAsciiStream(String, InputStream)"); - if(x == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - } - - setAsciiStream(findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the - * stream as needed until end-of-file is reached. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setBinaryStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param x the java input stream which contains the binary parameter value - * @exception SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setBinaryStream(String parameterName, InputStream x) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setBinaryStream(String, InputStream)"); - if(x == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - } - - setBinaryStream(findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a InputStream object. - * This method differs from the setBinaryStream (int, InputStream) - * method because it informs the driver that the parameter value should be - * sent to the system as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be sent to the system as a LONGVARBINARY or a BLOB - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setBlob which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param inputStream An object that contains the data to set the parameter - * value to. - * @throws SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setBlob(String parameterName, InputStream inputStream) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setBlob(String, InputStream)"); - if(inputStream == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - } - - setBlob(findParameterIndex(parameterName), inputStream); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Reader - * object. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setCharacterStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param reader the java.io.Reader object that contains the - * Unicode data - * @exception SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setCharacterStream(String parameterName, Reader reader) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setCharacterStream(String, Reader)"); - if(reader == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - } - - setCharacterStream(findParameterIndex(parameterName), reader); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the system as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the system as a LONGVARCHAR or a CLOB - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setClob which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or this method is called on - * a closed CallableStatement - * - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setClob(String parameterName, Reader reader) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setClob(String, Reader)"); - if(reader == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - } - - setClob(findParameterIndex(parameterName), reader); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNCharacterStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param value the parameter value - * @throws SQLException if parameterName does not correspond to a named - * parameter; if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs; or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setNCharacterStream(String parameterName, Reader value) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setNCharacterStream(String, Reader)"); - if(value == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - } - - setNCharacterStream(findParameterIndex(parameterName), value); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the system as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the system as a LONGNVARCHAR or a NCLOB - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNClob which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if parameterName does not correspond to a named - * parameter; if the driver does not support national character sets; - * if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - */ - public void setNClob(String parameterName, Reader reader) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setNClob(String, Reader)"); - if(reader == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - } - - setNClob(findParameterIndex(parameterName), reader); - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCClob.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCClob.java deleted file mode 100644 index 7efd61beb..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCClob.java +++ /dev/null @@ -1,517 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCClob.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Reader; - -import java.io.UnsupportedEncodingException; -import java.io.Writer; -import java.io.CharArrayReader; -import java.sql.Clob; -import java.sql.SQLException; - -// Note: This code in this class requires understanding of bit manipulation -// and sign extension. Do not attempt to rework this code if you do not -// have a grasp of these concepts. - -// Currently, the database host server only supports 2 GB LOBs. Therefore, -// we validate any long parameters to make sure they are not greater than -// the maximum positive value for a 4-byte int (2 GB). This has the added -// bonus of being able to cast the long down to an int without worrying -// about sign extension. There are some cases where we could allow the -// user to pass in a long greater than 2 GB, but for consistency, we will -// throw an exception. - -// Offset refers to a 0-based index. Position refers to a 1-based index. - - -/** -The AS400JDBCClob class provides access to character large -objects. The data is valid only within the current -transaction. -**/ -public class AS400JDBCClob implements Clob -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - protected char[] data_; //@pdc jdbc40 - protected int maxLength_; //@pdc jdbc40 - static final int MAX_LOB_SIZE = 2147483647; //@PDA jdbc40 same as native driver. (if column is a DBCLOB the limit is 1,073,741,823) - private boolean isXML_ = false; //@xmltrim true if this data originated from a native XML column type - -/** -Constructs an AS400JDBCClob object. The data is contained -in the String. No further communication with the IBM i system is necessary. - -@param data The CLOB data. -**/ - AS400JDBCClob(String data, int maxLength) - { - data_ = data.toCharArray(); - maxLength_ = maxLength; - } - - - AS400JDBCClob(char[] data) - { - data_ = data; - } - - //@xmltrim - /** - Constructs an AS400JDBCClob object. The data is contained - in the String. No further communication with the IBM i system is necessary. - If this clob has a source of a columne of type XML, then any getX method that returns xml as string will trim the xml declaration. - - @param data The CLOB data. - @param maxLength - @param isXML flag to signal if source is xml - **/ - AS400JDBCClob(String data, int maxLength, boolean isXML) - { - data_ = data.toCharArray(); - maxLength_ = maxLength; - isXML_ = isXML; - } - - //@xmltrim - AS400JDBCClob(char[] data, boolean isXML) - { - data_ = data; - isXML_ = isXML; - } - - - -/** -Returns the entire CLOB as a stream of ASCII characters. - -@return The stream. - -@exception SQLException If an error occurs. -**/ - public synchronized InputStream getAsciiStream() throws SQLException - { - //Following Native, throw HY010 after free() has been called - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - try - { - if(isXML_)//@xmltrim - return new ByteArrayInputStream((JDUtilities.stripXMLDeclaration(new String(data_))).getBytes("ISO8859_1")); //@xmltrim - else - return new ByteArrayInputStream((new String(data_)).getBytes("ISO8859_1")); - } - catch (UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - -/** -Returns the entire CLOB as a character stream. - -@return The stream. - -@exception SQLException If an error occurs. -**/ - public synchronized Reader getCharacterStream() throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - if(isXML_)//@xmltrim - return new CharArrayReader( JDUtilities.stripXMLDeclaration( new String(data_) ).toCharArray()); //@xmltrim - else - return new CharArrayReader(data_); - } - - - -/** -Returns part of the contents of the CLOB. - -@param position The start position within the CLOB (1-based). -@param length The length to return. -@return The contents. - -@exception SQLException If the start position is not valid, - if the length is not valid, - or an error occurs. -**/ - public synchronized String getSubString(long position, int length) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int offset = (int)position-1; - if (offset < 0 || length < 0 || (offset + length) > data_.length) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - //@xmltrim - if(isXML_) - { - data_ = JDUtilities.stripXMLDeclaration( new String(data_) ).toCharArray(); - } - - int lengthToUse = data_.length - offset; - if (lengthToUse < 0) return ""; - if (lengthToUse > length) lengthToUse = length; - - char[] result = new char[lengthToUse]; - System.arraycopy(data_, offset, result, 0, lengthToUse); - return new String(result); - } - - - -/** -Returns the length of the CLOB. - -@return The length of the CLOB, in characters. - -@exception SQLException If an error occurs. -**/ - public long length() throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - return data_.length; - } - - - -/** -Returns the position at which a pattern is found in the CLOB. - -@param pattern The pattern. -@param position The position within the CLOB to begin - searching (1-based). -@return The position at which the pattern - is found, or -1 if the pattern is not - found. - -@exception SQLException If the pattern is null, - the position is not valid, - or an error occurs. -**/ - public synchronized long position(String pattern, long position) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int offset = (int)position-1; - if (pattern == null || offset < 0 || offset >= data_.length) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - char[] charPattern = pattern.toCharArray(); - int end = data_.length - charPattern.length; - - for (int i=offset; i<=end; ++i) - { - int j = 0; - while (j < charPattern.length && data_[i+j] == charPattern[j]) ++j; - if (j == charPattern.length) return i+1; - } - - return -1; - } - - - -/** -Returns the position at which a pattern is found in the CLOB. - -@param pattern The pattern. -@param position The position within the CLOB to begin - searching (1-based). -@return The position at which the pattern - is found, or -1 if the pattern is not - found. - -@exception SQLException If the pattern is null, - the position is not valid, - or an error occurs. -**/ - public synchronized long position(Clob pattern, long position) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int offset = (int)position-1; - if (pattern == null || offset < 0 || offset >= data_.length) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - int patternLength = (int)pattern.length(); - if (patternLength > data_.length || patternLength < 0) return -1; - - int end = data_.length - patternLength; - - char[] charPattern = pattern.getSubString(1L, patternLength).toCharArray(); //@CRS - Get all the chars for now, improve this later. - - for (int i=offset; i<=end; ++i) - { - int j = 0; - while (j < charPattern.length && data_[i+j] == charPattern[j]) ++j; - if (j == charPattern.length) return i+1; - } - return -1; - } - - - /** - Returns a stream that an application can use to write Ascii characters to this CLOB. - The stream begins at position position, and the CLOB will be truncated - after the last character of the write. - - @param position The position (1-based) in the CLOB where writes should start. - @return An OutputStream object to which data can be written by an application. - @exception SQLException If there is an error accessing the CLOB or if the position - specified is greater than the length of the CLOB. - **/ - public OutputStream setAsciiStream(long position) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - if (position <= 0 || position > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - try - { - return new AS400JDBCClobOutputStream(this, position, ConvTable.getTable(819, null)); - } - catch (UnsupportedEncodingException e) - { - // Should never happen. - JDError.throwSQLException(JDError.EXC_INTERNAL, e); - return null; - } - } - - - - /** - Returns a stream that an application can use to write a stream of Unicode characters to - this CLOB. The stream begins at position position, and the CLOB will - be truncated after the last character of the write. - - @param position The position (1-based) in the CLOB where writes should start. - @return An OutputStream object to which data can be written by an application. - @exception SQLException If there is an error accessing the CLOB or if the position - specified is greater than the length of the CLOB. - **/ - public Writer setCharacterStream(long position) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - if (position <= 0 || position > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - return new AS400JDBCWriter(this, position); - } - - - - /** - Writes a String to this CLOB, starting at position position. The CLOB - will be truncated after the last character written. - - @param position The position (1-based) in the CLOB where writes should start. - @param stringToWrite The string that will be written to the CLOB. - @return The number of characters that were written. - - @exception SQLException If there is an error accessing the CLOB or if the position - specified is greater than the length of the CLOB. - **/ - public synchronized int setString(long position, String stringToWrite) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int offset = (int)position-1; - - if (offset < 0 || offset >= maxLength_ || stringToWrite == null) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - // We will write as many chars as we can. If our internal char array - // would overflow past the 2 GB boundary, we don't throw an error, we just - // return the number of chars that were set. - char[] charsToWrite = stringToWrite.toCharArray(); - int newSize = offset + charsToWrite.length; - if (newSize < 0) newSize = 0x7FFFFFFF; // In case the addition resulted in overflow. - if (newSize > data_.length) - { - char[] temp = data_; - data_ = new char[newSize]; - System.arraycopy(temp, 0, data_, 0, temp.length); - int numPad = offset - temp.length; //Determine if we need to Pad with single byte space before we write the new data_ @K1A - //the number of spaces we need to pad is equal to the offset we want to start writing at minus the length of the current clob(temp) @K1A - for(int i=0; iposition in the CLOB. - The CLOB will be truncated after the last character written. The lengthOfWrite - characters written will start from offset in the string that was provided by the - application. - - @param position The position (1-based) in the CLOB where writes should start. - @param string The string that will be written to the CLOB. - @param offset The offset into string to start reading characters (0-based). - @param lengthOfWrite The number of characters to write. - @return The number of characters written. - - @exception SQLException If there is an error accessing the CLOB value or if the position - specified is greater than the length of the CLOB. - **/ - public synchronized int setString(long position, String string, int offset, int lengthOfWrite) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int clobOffset = (int)position-1; - if (clobOffset < 0 || clobOffset >= maxLength_ || - string == null || offset < 0 || lengthOfWrite < 0 || (offset+lengthOfWrite) > string.length() || - (clobOffset+lengthOfWrite) > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - // We will write as many chars as we can. If our internal char array - // would overflow past the 2 GB boundary, we don't throw an error, we just - // return the number of chars that were set. - char[] charsToWrite = string.toCharArray(); - int newSize = clobOffset + lengthOfWrite; - if (newSize < 0) newSize = 0x7FFFFFFF; // In case the addition resulted in overflow. - if (newSize > data_.length) - { - char[] temp = data_; - data_ = new char[newSize]; - System.arraycopy(temp, 0, data_, 0, temp.length); - int numPad = offset - temp.length; //Determine if we need to Pad with single byte space before we write the new data_ @K1A - //the number of spaces we need to pad is equal to the offset we want to start writing at minus the length of the current clob(temp) @K1A - for(int i=0; ilengthOfCLOB characters. - - @param lengthOfCLOB The length, in characters, that this CLOB should be after - truncation. - - @exception SQLException If there is an error accessing the CLOB or if the length - specified is greater than the length of the CLOB. - **/ - public synchronized void truncate(long lengthOfCLOB) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int length = (int)lengthOfCLOB; - if (length < 0 || length > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - char[] temp = data_; - data_ = new char[length]; - int numToCopy = length < temp.length ? length : temp.length; - System.arraycopy(temp, 0, data_, 0, numToCopy); - } - - // @PDA jdbc40 - /** - * This method frees the Clob object and releases the - * resources the resources that it holds. The object is invalid once the - * free method is called. If free is called - * multiple times, the subsequent calls to free are treated - * as a no-op. - * - * @throws SQLException - * if an error occurs releasing the Clob's resources - */ - public synchronized void free() throws SQLException - { - data_ = null; //@pda make available for GC - } - - // @PDA jdbc40 - /** - * Returns a Reader object that contains a partial - * Clob value, starting with the character specified by pos, - * which is length characters in length. - * - * @param pos - * the offset to the first character of the partial value to be - * retrieved. The first character in the Clob is at position 1. - * @param length - * the length in characters of the partial value to be retrieved. - * @return Reader through which the partial Clob - * value can be read. - * @throws SQLException - * if pos is less than 1 or if pos is greater than the number of - * characters in the Clob or if pos + length is - * greater than the number of characters in the - * Clob - */ - public synchronized Reader getCharacterStream(long pos, long length) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - if(isXML_ )//@xmltrim - return new CharArrayReader( JDUtilities.stripXMLDeclaration( new String(data_)).toCharArray(), (int) pos-1, (int)length); //@xmltrim - else - return new CharArrayReader(data_, (int) pos-1, (int)length); - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCClobLocator.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCClobLocator.java deleted file mode 100644 index f48e370a4..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCClobLocator.java +++ /dev/null @@ -1,664 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCClobLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -import java.io.OutputStream; -import java.io.Reader; -import java.io.UnsupportedEncodingException; -import java.io.Writer; -import java.sql.Clob; -import java.sql.SQLException; - - -// Note: This code in this class requires understanding of bit manipulation -// and sign extension. Do not attempt to rework this code if you do not -// have a grasp of these concepts. - -// Currently, the database host server only supports 2 GB LOBs. Therefore, -// we validate any long parameters to make sure they are not greater than -// the maximum positive value for a 4-byte int (2 GB). This has the added -// bonus of being able to cast the long down to an int without worrying -// about sign extension. There are some cases where we could allow the -// user to pass in a long greater than 2 GB, but for consistency, we will -// throw an exception. - -// Offset refers to a 0-based index. Position refers to a 1-based index. - -// In the event that the column in the database is a DBCLOB, know that -// JDLobLocator knows that it is graphic and will correctly convert -// the byte offsets and lengths into character offsets and lengths. - -/** -The AS400JDBCClobLocator class provides access to character large -objects. The data is valid only within the current -transaction. -**/ -public class AS400JDBCClobLocator implements Clob -{ - protected ConvTable converter_; //@pdc jdbc40 - JDLobLocator locator_; - - Object savedObject_; // This is our InputStream or byte[] or whatever that needs to be written if we are batching. - int savedScale_; // This is our length that goes with our savedObject_. - - private char[] cache_; - private int cacheOffset_; - private static final char[] INIT_CACHE = new char[0]; - - //private int truncate_ = -1; - protected int maxLength_; // The max length in LOB-characters. See JDLobLocator. //@pdc jdbc40 - private boolean isXML_ = false; //@xml3 true if this data originated from a native XML column type - - /** - Constructs an AS400JDBCClobLocator object. The data for the - CLOB will be retrieved as requested, directly from the - IBM i system, using the locator handle. - - @param locator The locator. - @param converter The text converter. - **/ - AS400JDBCClobLocator(JDLobLocator locator, ConvTable converter, Object savedObject, int savedScale) - { - locator_ = locator; - converter_ = converter; - savedObject_ = savedObject; - savedScale_ = savedScale; - maxLength_ = locator_.getMaxLength(); - } - - //@xml3 new constructor - /** - Constructs an AS400JDBCClobLocator object. The data for the - CLOB will be retrieved as requested, directly from the - IBM i system, using the locator handle. - If this clob has a source of a columne of type XML, then any getX method that returns xml as string will trim the xml declaration. - - @param locator The locator. - @param converter The text converter. - @param savedObject Input data - @param savedScale Inpuat scale of data - @param isXML Flag that stream is from an XML column type (needed to strip xml declaration) - **/ - AS400JDBCClobLocator(JDLobLocator locator, ConvTable converter, Object savedObject, int savedScale, boolean isXML) - { - this(locator, converter, savedObject, savedScale); - isXML_ = isXML; - } - - - /** - Returns the entire CLOB as a stream of ASCII characters. - - @return The stream. - - @exception SQLException If an error occurs. - **/ - public InputStream getAsciiStream() throws SQLException - { - //Following Native, throw HY010 after free() has been called. Note: NullPointerException if synchronized(null-ref) - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - try - { - //@xml3 if xml column, remove xml declaration via ConvTableReader - return new ReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(locator_), converter_.getCcsid(), converter_.bidiStringType_, isXML_), 819); // ISO 8859-1. //@xml3 - } - catch (UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - } - - - - /** - Returns the entire CLOB as a character stream. - - @return The stream. - - @exception SQLException If an error occurs. - **/ - public Reader getCharacterStream() throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - try - { - //@xml3 if xml column, remove xml declaration via ConvTableReader - return new ConvTableReader(new AS400JDBCInputStream(locator_), converter_.getCcsid(), converter_.bidiStringType_, isXML_); //@xml3 - } - catch (UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - } - - - -/** -Returns the handle to this CLOB locator in the database. - -@return The handle to this locator in the databaes. -**/ - int getHandle()throws SQLException //@free called from rs.updateValue(), which in turn will throw exc back to rs.updateX() caller - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - return locator_.getHandle(); - } - - - - /** - Returns part of the contents of the CLOB. - - @param position The position within the CLOB (1-based). - @param length The number of characters to return. - @return The contents. - - @exception SQLException If the position is not valid, - if the length is not valid, - or an error occurs. - **/ - public String getSubString(long position, int length) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int offset = (int)position-1; - if (offset < 0 || length < 0 || (offset + length) > length()) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - int lengthToUse = (int)length() - offset; - if (lengthToUse < 0) return ""; - if (lengthToUse > length) lengthToUse = length; - - - - //@xml4 if xml column, remove xml declaration via ConvTableReader - if(isXML_) - { - ConvTableReader r = null; - try{ - r = new ConvTableReader(new AS400JDBCInputStream( locator_), converter_.getCcsid(), converter_.bidiStringType_, isXML_); //@xml4 - r.skip(offset); //@xml4 ConvTableReader will already have skipped XML header if column is XML type - return r.read(lengthToUse); //@xml4 - } - catch ( Exception e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - finally{ - try{ - if (r != null ) r.close(); - }catch(Exception ee){} - } - } - - DBLobData data = locator_.retrieveData(offset, lengthToUse); - int actualLength = data.getLength(); - return converter_.byteArrayToString(data.getRawBytes(), data.getOffset(), actualLength); - } - } - - - - /** - Returns the length of the current contents of the CLOB in characters. - - @return The length of the CLOB in characters. - - @exception SQLException If an error occurs. - **/ - public long length() throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - return locator_.getLength(); - } - } - - - // Used for position(). - private void initCache() - { - cacheOffset_ = 0; - cache_ = INIT_CACHE; - } - - // Used for position(). - private int getCachedChar(int index) throws SQLException - { - int realIndex = index - cacheOffset_; - if (realIndex >= cache_.length) - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - int len = (int)length(); - if (len < 0) len = 0x7FFFFFFF; - if ((blockSize+index) > len) blockSize = len-index; - cache_ = getSubString(index+1, blockSize).toCharArray(); - cacheOffset_ = index; - realIndex = 0; - } - if (cache_.length == 0) return -1; - return cache_[realIndex]; - } - - - - /** - Returns the position at which a pattern is found in the CLOB. - This method is not supported. - - @param pattern The pattern. - @param position The position within the CLOB to begin - searching (1-based). -@return The position in the CLOB at which the pattern was found, - or -1 if the pattern was not found. - - @exception SQLException If the pattern is null, - the position is not valid, - or an error occurs. - **/ - public long position(String pattern, long position) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int offset = (int)position-1; - if (pattern == null || offset < 0 || offset >= length()) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - char[] charPattern = pattern.toCharArray(); - int end = (int)length() - charPattern.length; - - // We use a cache of chars so we don't have to read in the entire - // contents of the CLOB. - initCache(); - - for (int i=offset; i<=end; ++i) - { - int j = 0; - int cachedChar = getCachedChar(i+j); - while (j < charPattern.length && cachedChar != -1 && charPattern[j] == cachedChar) - { - ++j; - cachedChar = getCachedChar(i+j); - } - if (j == charPattern.length) return i+1; - } - return -1; - } - } - - - - /** - Returns the position at which a pattern is found in the CLOB. - This method is not supported. - - @param pattern The pattern. - @param position The position within the CLOB to begin - searching (1-based). -@return The position in the CLOB at which the pattern was found, - or -1 if the pattern was not found. - - @exception SQLException If the pattern is null, - the position is not valid, - or an error occurs. - **/ - public long position(Clob pattern, long position) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int offset = (int)position-1; - if (pattern == null || offset < 0 || offset >= length()) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - int patternLength = (int)pattern.length(); - int locatorLength = (int)length(); - if (patternLength > locatorLength || patternLength < 0) return -1; - - int end = locatorLength - patternLength; - - char[] charPattern = pattern.getSubString(1L, patternLength).toCharArray(); //@CRS - Get all chars for now, improve this later. - - // We use a cache of chars so we don't have to read in the entire - // contents of the CLOB. - initCache(); - - for (int i=offset; i<=end; ++i) - { - int j = 0; - int cachedChar = getCachedChar(i+j); - while (j < patternLength && cachedChar != -1 && charPattern[j] == cachedChar) - { - ++j; - cachedChar = getCachedChar(i+j); - } - if (j == patternLength) return i+1; - } - - return -1; - } - } - - - /** - Returns a stream that an application can use to write Ascii characters to this CLOB. - The stream begins at position position, and the CLOB will be truncated - after the last character of the write. - - @param position The position (1-based) in the CLOB where writes should start. - @return An OutputStream object to which data can be written by an application. - @exception SQLException If there is an error accessing the CLOB or if the position - specified is greater than the length of the CLOB. - **/ - public OutputStream setAsciiStream(long position) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - if (position <= 0 || position > maxLength_) - { - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - try - { - return new AS400JDBCClobLocatorOutputStream(this, position, ConvTable.getTable(819, null)); - } - catch (UnsupportedEncodingException e) - { - // Should never happen. - JDError.throwSQLException(JDError.EXC_INTERNAL, e); - return null; - } - } - - - - /** - Returns a stream that an application can use to write a stream of Unicode characters to - this CLOB. The stream begins at position position, and the CLOB will - be truncated after the last character of the write. - - @param position The position (1-based) in the CLOB where writes should start. - @return An OutputStream object to which data can be written by an application. - @exception SQLException If there is an error accessing the CLOB or if the position - specified is greater than the length of the CLOB. - - **/ - public Writer setCharacterStream(long position) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - if (position <= 0 || position > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - return new AS400JDBCWriter(this, position); - } - - - - /** - Writes a String to this CLOB, starting at position position. The CLOB - will be truncated after the last character written. - - @param position The position (1-based) in the CLOB where writes should start. - @param stringToWrite The string that will be written to the CLOB. - @return The number of characters that were written. - - @exception SQLException If there is an error accessing the CLOB or if the position - specified is greater than the length of the CLOB. - - **/ - public int setString(long position, String stringToWrite) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int offset = (int)position-1; - - if (offset < 0 || offset >= maxLength_ || stringToWrite == null) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - // We will write as many chars as we can. If our internal char array - // would overflow past the 2 GB boundary, we don't throw an error, we just - // return the number of chars that were set. - char[] charsToWrite = stringToWrite.toCharArray(); - int newSize = offset + charsToWrite.length; - if (newSize < 0) newSize = 0x7FFFFFFF; // In case the addition resulted in overflow. - int numChars = newSize - offset; - if (numChars != charsToWrite.length) - { - char[] temp = charsToWrite; - charsToWrite = new char[newSize]; - System.arraycopy(temp, 0, charsToWrite, 0, numChars); - } - - // We don't really know if all of these chars can be written until we go to - // the system, so we just return the char[] length as the number written. - byte[] bytesToWrite = converter_.stringToByteArray(charsToWrite, 0, charsToWrite.length); - locator_.writeData((long)offset, bytesToWrite, false); //@K1A - return charsToWrite.length; - } - } - - - - /** - Writes a String to this CLOB, starting at position position in the CLOB. - The CLOB will be truncated after the last character written. The lengthOfWrite - characters written will start from offset in the string that was provided by the - application. - - @param position The position (1-based) in the CLOB where writes should start. - @param string The string that will be written to the CLOB. - @param offset The offset into string to start reading characters (0-based). - @param lengthOfWrite The number of characters to write. - @return The number of characters written. - - @exception SQLException If there is an error accessing the CLOB value or if the position - specified is greater than the length of the CLOB. - - **/ - public int setString(long position, String string, int offset, int lengthOfWrite) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int clobOffset = (int)position-1; - if (clobOffset < 0 || clobOffset >= maxLength_ || - string == null || offset < 0 || lengthOfWrite < 0 || (offset+lengthOfWrite) > string.length() || - (clobOffset+lengthOfWrite) > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - // We will write as many chars as we can. If our internal char array - // would overflow past the 2 GB boundary, we don't throw an error, we just - // return the number of chars that were set. - int newSize = clobOffset + lengthOfWrite; - if (newSize < 0) newSize = 0x7FFFFFFF; // In case the addition resulted in overflow. - int numChars = newSize - clobOffset; - int realLength = (numChars < lengthOfWrite ? numChars : lengthOfWrite); - char[] charsToWrite = new char[realLength]; - string.getChars(offset, offset + numChars, charsToWrite, 0); //@K2C - - // We don't really know if all of these chars can be written until we go to - // the system, so we just return the char[] length as the number written. - byte[] bytesToWrite = converter_.stringToByteArray(charsToWrite, 0, charsToWrite.length); - locator_.writeData((long)clobOffset, bytesToWrite, false); //@k1A - return charsToWrite.length; - } - } - - - - /** - Truncates this CLOB to a length of lengthOfCLOB characters. - - @param lengthOfCLOB The length, in characters, that this CLOB should be after - truncation. - - @exception SQLException If there is an error accessing the CLOB or if the length - specified is greater than the length of the CLOB. - - **/ - public void truncate(long lengthOfCLOB) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int length = (int)lengthOfCLOB; - if (length < 0 || length > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - //truncate_ = length; - - // The host server does not currently provide a way for us - // to truncate the temp space used to hold the locator data, - // so we just keep track of it ourselves. This should work, - // since the temp space on the system should only be valid - // within the scope of our transaction/connection. That means - // there's no reason to go to the system to update the data, - // since no other process can get at it. - locator_.writeData(length, new byte[0], 0, 0, true); //@k1A - } - } - - //@PDA 550 - /** - * This method frees the Clob object and releases the - * resources that it holds. The object is invalid once the - * free method is called. If free is called - * multiple times, the subsequent calls to free are treated - * as a no-op. - * - * @throws SQLException - * if an error occurs releasing the Clob's resources - */ - public void free() throws SQLException //@sync - { - if(locator_ == null) - return; //no-op - - synchronized(locator_) //@sync - { - locator_.free(); - - locator_ = null; //@pda make objects available for GC - converter_ = null; - savedObject_ = null; - cache_ = null; - } - } - - // @PDA jdbc40 - /** - * Returns a Reader object that contains a partial - * Clob value, starting with the character specified by pos, - * which is length characters in length. - * - * @param pos - * the offset to the first character of the partial value to be - * retrieved. The first character in the Clob is at position 1. - * @param length - * the length in characters of the partial value to be retrieved. - * @return Reader through which the partial Clob - * value can be read. - * @throws SQLException - * if pos is less than 1 or if pos is greater than the number of - * characters in the Clob or if pos + length is - * greater than the number of characters in the - * Clob - */ - public Reader getCharacterStream(long pos, long length) throws SQLException //@sync - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) //@sync - { - if (pos < 1 || (pos - 1 + length) > locator_.getMaxLength() || length < 0 ) //@pdc change parm check like getSubString - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - Reader r = null; - - try - { - //@xml3 if xml column, remove xml declaration via ConvTableReader - r = new ConvTableReader(new AS400JDBCInputStream( locator_), converter_.getCcsid(), converter_.bidiStringType_, isXML_); //@xml3 - r.skip(pos); - return r; - } - catch (UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - catch (IOException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCConnection.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCConnection.java deleted file mode 100644 index beb61d19e..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCConnection.java +++ /dev/null @@ -1,5163 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCConnection.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -/* ifdef JDBC40 */ -import java.sql.ClientInfoStatus; -import java.sql.SQLClientInfoException; -/* endif */ -import java.sql.Clob; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -/* ifdef JDBC40 */ -import java.sql.NClob; -/* endif */ -import java.sql.Driver; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.SQLWarning; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Statement; -import java.sql.Savepoint; // @E10a -import java.sql.Struct; -import java.util.Enumeration; // @DAA -/* ifdef JDBC40 */ -import java.util.HashMap; -/* endif */ -import java.util.Map; -import java.util.Properties; -import java.util.Vector; -/* ifdef JDBC40 */ -import java.util.concurrent.locks.ReentrantLock; -/* endif */ - - -/** -

The AS400JDBCConnection class provides a JDBC connection -to a specific DB2 for IBM i database. Use -DriverManager.getConnection() to create new AS400JDBCConnection -objects. - -

There are many optional properties that can be specified -when the connection is created. Properties can be specified either -as part of the URL or in a java.util.Properties object. See -JDBC properties for a complete -list of properties supported by the AS400JDBCDriver. - -

Note that a connection may contain at most 9999 open -statements. -**/ -// -// Implementation notes: -// -// 1. Each connection and statement has an "id" associated with -// it. All ids are unique within a connection, and this -// uniqueness is maintained by the id table for each -// connection. -// -// The id is used as a convention for assigning each -// connection and statement its own ORS (Operation Result -// Set) on the IBM i as well as assigning each statement -// its own RPB (Request Parameter Block). -// -// Every communication to the database requires a connection -// and an id within that connection. -// -// 2. It is a requirement that no finalize() methods need to -// receive a reply from the IBM i system. Because of the way the -// AS400Server class is implemented, certain scenarios where -// this is the case will result in deadlock. The AS400Server -// class provides sendAndDiscardReply() specifically to avoid -// this problem. -// -// Within the JDBC driver, finalize() usually calls one or more -// close() methods. Therefore, this requirement is also -// imposed on close() methods. -// -// 3. All requests for the connection and the related objects in -// its context should be sent via a variation of one of the -// sendXXX() methods. This makes debugging cleaner. -// -public class AS400JDBCConnection -/* ifdef JDBC40 */ -extends ToolboxWrapper -/* endif */ -implements Connection -{ - - private class CancelLock extends Object {} //@C7A - private class HeldRequestsLock extends Object {} //@C7A - - // Turn this flag on to prevent this Connection object from establishing an actual connection to the IBM i system. This is useful when doing multi-threaded stress testing on the Toolbox's built-in JDBC connection pool manager, where we create/delete massive numbers of connections. - // For production, this flag _must_ be set to 'false'. - private static final boolean TESTING_THREAD_SAFETY = false; //@CPMa - - // This is a compile time flag for doing simple - // communications traces. - // - // The choices are: - // 0 = No communication trace (for production code). - // 1 = Only request and reply ids. - // 2 = Request and reply ids and contents. - // - // Note that the LL (length) and parameter count for - // requests will not be accurate, since they have not yet - // been set at the time when the request is dumped. - // - private static final int DEBUG_COMM_TRACE_ = 0; - - - - // This is a compile time flag for temporarily disabling - // request chaining. This can be useful when a request - // is failing, but all we see is an error class == 7, - // return code == -1000. This means a chain request - // failed. - // - // The choices are: - // true = Enable request chaining (for production code). - // false = Disable request chaining. - // - // @E5D private static final boolean DEBUG_REQUEST_CHAINING_ = true; - - - - // This is a compile time flag for forcing the use of - // extended datastream formats. This can be useful when - // testing extended formats, but the IBM i system is not reporting - // the correct VRM. - // - // The choices are: - // true = Force extended datastream formats. - // false = Decide based on system VRM (for production code). - // - // @E9D private static final boolean FORCE_EXTENDED_FORMATS_ = false; - - // @F8 -- the key change is to put a 1 in the 7th position. That 1 is the "ODBC" flag. - // The IBM i passes it along to database to enable correct package caching of - // "where current of" statements. This flag affects only package caching. - private static final String CLIENT_FUNCTIONAL_LEVEL_= "V7R1M01 "; // @EDA F8c H2c pdc 610 - - private static final int DRDA_SCROLLABLE_CUTOFF_ = 129; // @B1A - private static final int DRDA_SCROLLABLE_MAX_ = 255; // @DAA - private static final int INITIAL_STATEMENT_TABLE_SIZE_ = 256; // @DAA - static final int UNICODE_CCSID_ = 13488; // @E3C - - // The max number of open statements per connection. If this @DAA - // changes, then change the relevant sentence in the javadoc, too. @DAA - static final int MAX_STATEMENTS_ = 9999; // @DAC - private final boolean[] assigned_ = new boolean[MAX_STATEMENTS_]; //@P0C - - static final int DATA_COMPRESSION_NONE_ = 0; // @ECA - static final int DATA_COMPRESSION_OLD_ = 1; // @ECA - static final int DATA_COMPRESSION_RLE_ = 0x3832; // @ECA @EIC @EJC - - - // Private data. - private AS400ImplRemote as400_; - private AS400 as400PublicClassObj_; // Prevents garbage collection. - //@P0D private BitSet assigned_; // @DAC - private boolean cancelling_; // @E8A - private CancelLock cancelLock_ = new CancelLock(); // @E8A@C7C - private String catalog_; - boolean checkStatementHoldability_ = false; // @F3A //@XAC - private boolean closing_; // @D4A - ConvTable converter_; //@P0C - private int dataCompression_ = -1; // @ECA - private JDDataSourceURL dataSourceUrl_; - private boolean drda_; // @B1A - private String defaultSchema_; - private boolean extendedFormats_; - // @E2D private ConverterImplRemote graphicConverter_; - // @E2D private boolean graphicConverterLoaded_; - private Vector heldRequests_; // @E5A - private HeldRequestsLock heldRequestsLock_ = new HeldRequestsLock(); // @E5A@C7C - private int holdability_ = AS400JDBCResultSet.HOLDABILITY_NOT_SPECIFIED; // @G4A - private int id_; - private AS400JDBCDatabaseMetaData metaData_; - private JDPackageManager packageManager_; - private JDProperties properties_; - private boolean readOnly_; - //@P0D private BitSet requestPending_; // @DAC - //@P1Dprivate final boolean[] requestPending_ = new boolean[MAX_STATEMENTS_]; //@P0A - private AS400Server server_; - private int serverFunctionalLevel_; // @E7A - private String serverJobIdentifier_ = null; // @E8A - private SQLWarning sqlWarning_; - private Vector statements_; // @DAC - JDTransactionManager transactionManager_; // @E10c - static final ConvTable unicodeConverter_ = new ConvTable13488(); // @E3A @P0C - ConvTable packageCCSID_Converter = null; //Bidi-HCG - int vrm_; // @D0A @E10c - - // declare the user-supplied value for server trace. The constants for - // the definition of each bit in the bit map are defined in Trace.java - private int traceServer_ = 0; // @j1a - - // set to true if database host server tracing is started via the setDBHostServerTrace method - private boolean databaseHostServerTrace_ = false; // @2KR - - private boolean mustSpecifyForUpdate_ = true; // @j31 - - //counter to keep track of number of open statements - private int statementCount_ = 0; //@K1A - private boolean thousandStatements_ = false; //@K1A - - private String qaqqiniLibrary_ = null; //@K2A - - //@KBA Specifies level of autocommit support to use. - // If V5R2 or earlier use old support of running SET TRANSACTION STATEMENTS (0) - // If "true autocommit" connection property is false - run autocommit under *NONE isolation (1) - // If "true autocommit" connection property is true - run with specified isolation (2) - int newAutoCommitSupport_ = 1; //@KBA - - private boolean wrappedInsert_ = false; // @GKA - //@pda 550 client info - //Names for clientInfo identifiers. DatabaseMetadata also will use these names - static final String applicationNamePropertyName_ = "ApplicationName"; - static final String clientUserPropertyName_ = "ClientUser"; - static final String clientHostnamePropertyName_ = "ClientHostname"; - static final String clientAccountingPropertyName_ = "ClientAccounting"; - static final String clientProgramIDPropertyName_ = "ClientProgramID"; //@pda - - //@pda 550 client info values - private String applicationName_ = ""; //@pdc so can be added to Properties object in getClientInfo() - private String clientUser_ = ""; //@pdc - private String clientHostname_ = ""; //@pdc - private String clientAccounting_ = ""; //@pdc - private String clientProgramID_ = ""; //@pdc - - private int concurrentAccessResolution_ = AS400JDBCDataSource.CONCURRENTACCESS_NOT_SET; //@cc1 - - private boolean doUpdateDeleteBlocking_ = false; //@A2A - private int maximumBlockedInputRows_ = 32000; //@A6A - - /** - Static initializer. Initializes the reply data streams - that we expect to receive. - **/ - static - { - // The database server will only return 1 type of reply. - //@P0D AS400Server.addReplyStream (new DBReplyRequestedDS (), - AS400Server.addReplyStream(DBDSPool.getDBReplyRequestedDS(), //@P0A - AS400.DATABASE); - } - - - - // The default constructor reserved for use within the package. - AS400JDBCConnection () //@A3A - { - } - - - - // @A3D Deleted constructor: - // AS400JDBCConnection (JDDataSourceURL dataSourceUrl, JDProperties properties) - // throws SQLException - - - - // @E8A - /** - Cancels a statement within this connection. - - @param id The ID of the statement. - - @exception SQLException If the statement cannot be executed. - **/ - void cancel(int id) - throws SQLException - { - // Lock out all other operations for this connection. - synchronized(cancelLock_) - { - if (TESTING_THREAD_SAFETY) return; // in certain testing modes, don't contact the system - cancelling_ = true; - AS400JDBCConnection cancelConnection = null; - try - { - // If the server job identifier was returned, and the system is at a - // functional level 5 or greater, then use the job identifier to issue - // the cancel from another connection. Otherwise, do nothing. - if ((serverJobIdentifier_ != null) && (serverFunctionalLevel_ >= 5)) - { - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Cancelling statement " + id); - - // Create another connection to issue the cancel. - cancelConnection = new AS400JDBCConnection(); - - //AS400 system = new AS400(as400PublicClassObj_); - //cancelConnection.setSystem(system); - - cancelConnection.setProperties(dataSourceUrl_, properties_, as400_, true); - - // Send the cancel request. - DBSQLRequestDS request = null; - DBReplyRequestedDS cancelReply = null; - try - { - request = DBDSPool.getDBSQLRequestDS(DBSQLRequestDS.FUNCTIONID_CANCEL, id_, - DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); - request.setJobIdentifier(serverJobIdentifier_, converter_); - cancelReply = cancelConnection.sendAndReceive (request); - - int errorClass = cancelReply.getErrorClass(); - int returnCode = cancelReply.getReturnCode(); - if (errorClass != 0) - JDError.throwSQLException(this, id_, errorClass, returnCode); - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - finally - { - if (request != null) { - request.returnToPool(); request = null; - } - if (cancelReply != null) { - cancelReply.returnToPool(); cancelReply = null; - } - } - } - else - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Cancel of statement " + id + " requested, but is not supported by system"); - } - } - finally - { - // always need to close the connection - if (cancelConnection != null) { - try { cancelConnection.close(); } - catch (Throwable e) {} // ignore any exceptions - } - - // Let others back in. - cancelling_ = false; - cancelLock_.notifyAll(); - } - } - } - - - - /** - Checks that the specified SQL statement can be executed. - This decision is based on the access specified by the caller - and the read only mode. - - @param sqlStatement The SQL statement. - - @exception SQLException If the statement cannot be executed. - **/ - void checkAccess (JDSQLStatement sqlStatement) - throws SQLException - { - String access = properties_.getString (JDProperties.ACCESS); - - // If we only have read only access, then anything other - // than a SELECT can not be executed. - if ((access.equalsIgnoreCase (JDProperties.ACCESS_READ_ONLY)) - && (! sqlStatement.isSelect ())) - JDError.throwSQLException (this, JDError.EXC_ACCESS_MISMATCH); - - // If we have read call access, then anything other than - // a SELECT or CALL can not be executed. - if (((readOnly_) - || ((access.equalsIgnoreCase (JDProperties.ACCESS_READ_CALL)))) - && (! sqlStatement.isSelect()) - && (! sqlStatement.isProcedureCall())) - JDError.throwSQLException (this, JDError.EXC_ACCESS_MISMATCH); - } - - - - // @E8A - /** - Checks to see if we are cancelling a statement. If so, wait until the - cancel is done. If not, go ahead. - **/ - private void checkCancel() - { - synchronized(cancelLock_) - { - if (cancelling_) - { - try - { - cancelLock_.wait(); - } - catch (InterruptedException e) - { - // Ignore. - } - } - } - } - - - //@F3A - /** - Checks if what the user passed in for holdability is valid. - **/ - private boolean checkHoldabilityConstants (int holdability) - { - if ((holdability == AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT) || - (holdability == AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT) || - (holdability == AS400JDBCResultSet.HOLDABILITY_NOT_SPECIFIED)) - { - return true; - } - return false; - } - - - /** - Checks that the connection is open. Public methods - that require an open connection should call this first. - - @exception SQLException If the connection is not open. - **/ - void checkOpen () - throws SQLException - { - if (TESTING_THREAD_SAFETY) return; // in certain testing modes, don't contact IBM i system - if (server_ == null) - JDError.throwSQLException (this, JDError.EXC_CONNECTION_NONE); - } - - - - /** - Clears all warnings that have been reported for the connection. - After this call, getWarnings() returns null until a new warning - is reported for the connection. - - @exception SQLException If an error occurs. - **/ - public void clearWarnings () - throws SQLException - { - sqlWarning_ = null; - } - - - - /** - Releases the connection's resources immediately instead of waiting - for them to be automatically released. This rolls back any active - transactions, closes all statements that are running in the context - of the connection, and disconnects from the IBM i system. - - @exception SQLException If an error occurs. - **/ - // - // Implementation notes: - // - // 1. We do not have to worry about thread synchronization here, - // since the AS400Server object handles it. - // - // 2. It is a requirement to not get replies during a finalize() - // method. Since finalize() calls this method, this requirement - // applies here, too. - // - public void close () - throws SQLException - { - // @D4A - // Avoid recursion. When we close associated statements, they try - // to close this connection. - if (closing_) return; - closing_ = true; - - // If this is already closed, then just do nothing. - // - // The spec does not define what happens when a connection - // is closed multiple times. The official word from the Sun - // JDBC team is that "the driver's behavior in this case - // is implementation defined. Applications that do this are - // non-portable." - if (isClosed ()) - return; - - // partial close (moved rollback and closing of all the statements). @E1 - pseudoClose(); - - // Disconnect from the system. - if (server_ != null) - { - - // @B3 It turns out that we were closing the connection, - // @B3 then the AS400Server object was in its disconnectServer() - // @B3 method. Since the AS400Server object needs to do other - // @B3 cleanup, we still need to call it. - - // @B3D try { - // @B3D DBSQLEndCommDS request = new DBSQLEndCommDS ( - // @B3D DBSQLEndCommDS.FUNCTIONID_END_COMMUNICATION, - // @B3D id_, 0, 0); - // @B3D send (request); - // @B3D } - // @B3D catch (Exception e) { - // @B3D JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - // @B3D } - - - - - as400_.disconnectServer (server_); - server_ = null; - } - - if (JDTrace.isTraceOn()) - JDTrace.logClose (this); - } - - - - // @E4C - /** - Commits all changes made since the previous commit or - rollback and releases any database locks currently held by - the connection. This has no effect when the connection - is in auto-commit mode. - -

This method can not be called when the connection is part - of a distributed transaction. See - AS400JDBCXAResource for more information. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public void commit () - throws SQLException - { - checkOpen (); - - if (!transactionManager_.isLocalTransaction()) // @E4A - JDError.throwSQLException (this, JDError.EXC_TXN_STATE_INVALID); // @E4A - - // Note: CPS 72CSHT support - if (transactionManager_.getAutoCommit () && properties_.getBoolean(JDProperties.AUTOCOMMIT_EXCEPTION)) //@CE1 - JDError.throwSQLException (this, JDError.EXC_FUNCTION_SEQUENCE); //@CE1 - - // Note: Intuitively, it seems like if we are in - // auto-commit mode, that we should not need to - // do anything for an explicit commit. However, - // somewhere along the line, the system gets - // confused, so we go ahead an send the commit - // anyway. - - transactionManager_.commit (); - - // @F3 If cursor hold property is false, then mark the cursors closed. Don't worry here - // @F3 about whether their statement level holdability is different; we will check that - // @F3 within AS400JDBCStatement.markCursorsClosed(). - // @F3 If the user has changed any statement's holdability, then we need to go through - // @F3 the enumeration to see if there are ones where we may need to close our cursors - // @F3 or internal result sets. - // @F3 Passing true to markCursorsClosed means we called this method from rollback(). - if (transactionManager_.getHoldIndicator() == JDTransactionManager.CURSOR_HOLD_FALSE // @B4A - || (checkStatementHoldability_ && getVRM() >= JDUtilities.vrm520)) // @F3A - markCursorsClosed(false); // @B4A - - if(!getAutoCommit() && properties_.getBoolean(JDProperties.HOLD_STATEMENTS )) //@KBL if auto commit is off, check to see if any statements have been partially closed //@PDA additional HOLD_STATEMENTS check - markStatementsClosed(); //@KBL - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Transaction commit"); - } - - - //@F3A - /** - Sets a flag for whether the user has changed the holdability for any of the statements that - came from this connection. As of JDBC 3.0, the user can specify a statement-level holdability - that is different from the statement-level holdability. Rather than always going through all - of the statements to see if any of their holidabilities is different, we will mark this flag if - the user changes any of the statement holdabilities. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - void setCheckStatementHoldability(boolean check) - { - checkStatementHoldability_ = check; - } - - - - /** - Corrects the result set type based on the result set concurrency - and posts a warning. - - @param resultSetType The result set type. - @param resultSetConcurrency The result set concurrency. - @return The correct result set type. - **/ - private int correctResultSetType (int resultSetType, - int resultSetConcurrency) - throws SQLException // @EGA - { - int newResultSetType = (resultSetConcurrency == ResultSet.CONCUR_UPDATABLE) - ? ResultSet.TYPE_SCROLL_SENSITIVE : ResultSet.TYPE_SCROLL_INSENSITIVE; - postWarning (JDError.getSQLWarning (JDError.WARN_OPTION_VALUE_CHANGED)); - return newResultSetType; - } - - - - /** - Creates a Statement object for executing SQL statements without - parameters. If the same SQL statement is executed many times, it - is more efficient to use prepareStatement(). - -

Result sets created using the statement will be type - ResultSet.TYPE_FORWARD_ONLY and concurrency - ResultSet.CONCUR_READ_ONLY. - - @return The statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, or an - error occurs. - **/ - public Statement createStatement () - throws SQLException - { - return createStatement (ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY, getInternalHoldability()); //@G4C - } - - - - // JDBC 2.0 - /** - Creates a Statement object for executing SQL statements without - parameters. If the same SQL statement is executed many times, it - is more efficient to use prepareStatement(). - - @param resultSetType The result set type. Valid values are: -

    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @param resultSetConcurrency The result set concurrency. Valid values are: -
    -
  • ResultSet.CONCUR_READ_ONLY -
  • ResultSet.CONCUR_UPDATABLE -
- @return The statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type or currency is not supported, - or an error occurs. - **/ - public Statement createStatement (int resultSetType, - int resultSetConcurrency) - throws SQLException - { - return createStatement (resultSetType, //@G4A - resultSetConcurrency, getInternalHoldability()); //@G4A - //@G4M Moved code to createStatement (int, int, int) - } - - - //@G4A JDBC 3.0 - /** - Creates a Statement object for executing SQL statements without - parameters. If the same SQL statement is executed many times, it - is more efficient to use prepareStatement(). - -

Full functionality of this method requires support in OS/400 V5R2 - or IBM i. If connecting to OS/400 V5R1 or earlier, the value for - resultSetHoldability will be ignored. - - @param resultSetType The result set type. Valid values are: -

    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @param resultSetConcurrency The result set concurrency. Valid values are: -
    -
  • ResultSet.CONCUR_READ_ONLY -
  • ResultSet.CONCUR_UPDATABLE -
- @param resultSetHoldability The result set holdability. Valid values are: -
    -
  • ResultSet.HOLD_CURSORS_OVER_COMMIT -
  • ResultSet.CLOSE_CURSORS_AT_COMMIT -
- @return The statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type, currency, or holdability is not supported, - or an error occurs. - @since Modification 5 - **/ - public Statement createStatement (int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - // Validation. - checkOpen (); - if (! metaData_.supportsResultSetConcurrency (resultSetType, resultSetConcurrency)) - resultSetType = correctResultSetType (resultSetType, resultSetConcurrency); - - if (!checkHoldabilityConstants (resultSetHoldability)) //@F3A - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); //@F3A - - // Create the statement. - int statementId = getUnusedId (resultSetType); // @B1C - AS400JDBCStatement statement = new AS400JDBCStatement (this, - statementId, transactionManager_, packageManager_, - properties_.getString (JDProperties.BLOCK_CRITERIA), - properties_.getInt (JDProperties.BLOCK_SIZE), - properties_.getBoolean (JDProperties.PREFETCH), - properties_.getString (JDProperties.PACKAGE_CRITERIA), // @A2A - resultSetType, resultSetConcurrency, resultSetHoldability, //@G4A - AS400JDBCStatement.GENERATED_KEYS_NOT_SPECIFIED); //@G4A - statements_.addElement(statement); // @DAC - statementCount_++; //@K1A - if(thousandStatements_ == false && statementCount_ == 1000) //@K1A - { //@K1A - thousandStatements_ = true; //@K1A - //post warning //@K1A - postWarning(JDError.getSQLWarning(JDError.WARN_1000_OPEN_STATEMENTS)); //@K1A - } //@K1A - - if (JDTrace.isTraceOn()) //@F4A - { //@F4A - int size = statements_.size(); //@F4A - if (size % 256 == 0) //@F4A - { //@F4A - JDTrace.logInformation (this, "Warning: Open handle count now: " + size); //@F4A - } //@F4A - } //@F4A - - return statement; - } - - - - - /** - Outputs debug information for a request. This should only be used - for debugging the JDBC driver and is not intended for production code. - - @param request The request. - **/ - private void debug (DBBaseRequestDS request) - { - if (DEBUG_COMM_TRACE_ >= 1) - System.out.println ("Server request: " - + Integer.toString (request.getServerID(), 16).toUpperCase() - + ":" + Integer.toString (request.getReqRepID(), 16).toUpperCase() - + "."); - if (DEBUG_COMM_TRACE_ >= 2) - request.dump (System.out); - } - - - - /** - Outputs debug information for a reply. This should only be used - for debugging the JDBC driver and is not intended for production code. - - @param reply The reply. - **/ - private void debug (DBReplyRequestedDS reply) - { - if (DEBUG_COMM_TRACE_ >= 1) - System.out.println ("Server reply: " - + Integer.toString (reply.getServerID(), 16).toUpperCase() - + ":" + Integer.toString (reply.getReturnDataFunctionId(), 16).toUpperCase() - + "."); - if (DEBUG_COMM_TRACE_ >= 2) - reply.dump (System.out); - - int returnCode = ((DBReplyRequestedDS) reply).getReturnCode(); - - if (DEBUG_COMM_TRACE_ >= 1) - { - int errorClass = ((DBReplyRequestedDS) reply).getErrorClass(); - if ((errorClass != 0) || (returnCode != 0)) - System.out.println ("Server error = " + errorClass + ":" - + returnCode + "."); - } - } - - - - /** - Closes the connection if not explicitly closed by the caller. - - @exception Throwable If an error occurs. - **/ - protected void finalize () - throws Throwable - { - if (! isClosed ()) { - JDTrace.logInformation (this, "WARNING: Finalizer thread closing connection object."); - close (); - } - super.finalize (); - } - - - - /** - Returns the AS400 object for this connection. - - @return The AS400 object. - **/ - AS400Impl getAS400 () - throws SQLException // @EGA - { - return as400_; - } - - - - /** - Returns the auto-commit state. - - @return true if the connection is in auto-commit mode; - false otherwise. - - @exception SQLException If the connection is not open. - **/ - public boolean getAutoCommit () - throws SQLException - { - checkOpen (); - return transactionManager_.getAutoCommit (); - } - - - - /** - Returns the catalog name. - - @return The catalog name. - - @exception SQLException If the connection is not open. - **/ - public String getCatalog () - throws SQLException - { - checkOpen (); - return catalog_; - } - - //@cc1 - /** - * This method returns the concurrent access resolution setting. - * This method has no effect on IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @return The concurrent access resolution setting. Possible return valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public int getConcurrentAccessResolution () - { - return concurrentAccessResolution_; - } - - /** - Returns the converter for this connection. - - @return The converter. - **/ - //@P0D ConverterImplRemote getConverter () - //@P0D throws SQLException // @EGA - //@P0D { - //@P0D return converter_; - //@P0D } - - - - /** - Returns the converter for the specified CCSID, unless - it is 0 or 65535 (i.e. probably set for a non-text field), in - which case it returns the converter for this connection. - This is useful for code that handles all types of fields - in a generic manner. - - @param ccsid The CCSID. - @return The converter. - - @exception SQLException If the CCSID is not valid. - **/ - ConvTable getConverter (int ccsid) //@P0C - throws SQLException - { - try - { - if (ccsid == 0 || ccsid == 1 || ccsid == 65535 || ccsid == -1) return converter_; //@P0C - //@P0D switch (ccsid) - //@P0D { // @E3A - //@P0D case 65535: //@ELC // @E3A - //@P0D case 0: // @E3A - //@P0D case 1: // @E3A - //@P0D return converter_; // @E3A - //@P0D case UNICODE_CCSID_: // @E3A - //@P0D if (unicodeConverter_ == null) // @E3A - //@P0D unicodeConverter_ = ConverterImplRemote.getConverter(13488, as400_); // @E3A - //@P0D return unicodeConverter_; // @E3A - //@P0D default: // @E3A - //@P0D return ConverterImplRemote.getConverter (ccsid, as400_); // @E3C - //@P0D } // @E3A - return ConvTable.getTable(ccsid, null); //@P0A - } - catch (UnsupportedEncodingException e) - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - // @ECA - /** - Returns the style of data compression. - - @return The style of data compression. Possible values are DATA_COMPRESSION_NONE_, - DATA_COMPRESSION_OLD_, and DATA_COMPRESSION_RLE_. - **/ - int getDataCompression() // @ECA - { // @ECA - return dataCompression_; // @ECA - } // @ECA - - - - /** - Returns the default SQL schema. - - @return The default SQL schema, or QGPL if none was - specified. - **/ - String getDefaultSchema () - throws SQLException // @EGA - { - return((defaultSchema_ == null) ? "QGPL" : defaultSchema_); - } - - - //@DELIMa - /** - Returns the default SQL schema. - - @param returnRawValue Indicates what to return if default SQL schema has not been set. If true, return raw value; if false, then return QGPL rather than null. - @return The default SQL schema. If returnRawValue==false and no default SQL schema was specified, then return QGPL rather than null. - **/ - String getDefaultSchema (boolean returnRawValue) - throws SQLException - { - return((returnRawValue || defaultSchema_ != null) ? defaultSchema_ : "QGPL"); - } - - - //@G4A JDBC 3.0 - /** - Returns the holdability of ResultSets created from this connection. - - @return The cursor holdability. Valid values are ResultSet.HOLD_CURSORS_OVER_COMMIT and - ResultSet.CLOSE_CURSORS_AT_COMMIT. The holdability is derived in this order - of precedence: -
    -
  • 1. The holdability specified using the method setHoldability(int) - if this method was called. -
  • 2. The value of the cursor hold - driver property.
- Full functionality of #1 requires support in OS/400 - V5R2 or IBM i. If connecting to OS/400 V5R1 or earlier, - the value specified on this method will be ignored and the default holdability - will be the value of #2. - - @exception SQLException If the connection is not open. - @since Modification 5 - **/ - public int getHoldability () - throws SQLException - { - checkOpen (); - // If holdability has been set, return its value. - if ((holdability_ == AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT) || - (holdability_ == AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT)) - { - return holdability_; - } - // Else, holdability either equals AS400JDBCResultSet.HOLDABILITY_NOT_SPECIFIED - // or has an incorrect value (shouldn't be able to happen). - // Return the holdability determined by seeing what the cursor hold driver property - // was set to. Default is HOLD_CURSORS_AT_COMMIT. - else - { - if (transactionManager_.getHoldIndicator() == JDTransactionManager.CURSOR_HOLD_TRUE) - return AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT; - else if (transactionManager_.getHoldIndicator() == JDTransactionManager.CURSOR_HOLD_FALSE) - return AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT; - // Hold indicator will be set to -1 if the user gave us a bad number in setHoldIndicator(). - // We threw an exception there, so throw another exception here, then return default - // value for driver. - else - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL); - return AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT; - } - } - } - - - //@DELIMa - /** - Returns the ID of the connection. - @return The connection ID. - **/ - int getID() - { - return id_; - } - - - //@G4A JDBC 3.0 - /** - Returns the holdability of ResultSets created from this connection. - Use this method internally to return the value specified if the user has called - setHoldability(int), or HOLDABILITY_NOT_SPECIFIED if that - method hasn't been called, meaning to use the old behavior and not the new code - point for cursor holdability. - - @return The cursor holdability. Valid values are - AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT, - AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT, - and AS400JDBCResultSet.HOLDABILITY_NOT_SPECIFIED. - - @since Modification 5 - **/ - int getInternalHoldability () - { - return holdability_; - } - - - - // @E2D /** - // @E2D Returns the graphic converter for this connection. - // @E2D - // @E2D @return The graphic converter. - // @E2D - // @E2D @exception SQLException If no graphic converter was loaded. - // @E2D **/ - // @E2D // - // @E2D // Implementation note: - // @E2D // - // @E2D // * Graphic data is pure double-byte, so we will need a - // @E2D // different converter for that. If there is no associated - // @E2D // double-byte CCSID, or the converter can not be loaded, - // @E2D // then we should throw an exception. We wait to load this, - // @E2D // since the majority of callers do not need this converter. - // @E2D // - // @E2D ConverterImplRemote getGraphicConverter () - // @E2D throws SQLException - // @E2D { - // @E2D // If the graphic converter has not yet been loaded, - // @E2D // then do so. - // @E2D if (graphicConverterLoaded_ == false) { - // @E2D int serverGraphicCCSID = ExecutionEnvironment.getAssociatedDbcsCcsid (converter_.getCcsid ()); - // @E2D if (serverGraphicCCSID != -1) { - // @E2D try { - // @E2D graphicConverter_ = ConverterImplRemote.getConverter (serverGraphicCCSID, as400_); - // @E2D } - // @E2D catch (UnsupportedEncodingException e) { - // @E2D graphicConverter_ = null; - // @E2D } - // @E2D } - // @E2D - // @E2D if (JDTrace.isTraceOn ()) { - // @E2D if (graphicConverter_ != null) - // @E2D JDTrace.logInformation (this, "Server graphic CCSID = " + serverGraphicCCSID); - // @E2D else - // @E2D JDTrace.logInformation (this, "No graphic CCSID was loaded"); - // @E2D } - // @E2D } - // @E2D - // @E2D // Return the graphic converter, or throw an exception. - // @E2D if (graphicConverter_ == null) - // @E2D JDError.throwSQLException (this, JDError.EXC_CCSID_INVALID); - // @E2D return graphicConverter_; - // @E2D } - - - - /** - Returns the DatabaseMetaData object that describes the - connection's tables, supported SQL grammar, stored procedures, - capabilities and more. - - @return The metadata object. - - @exception SQLException If an error occurs. - **/ - public DatabaseMetaData getMetaData () - throws SQLException - { - // We allow a user to get this object even if the - // connection is closed. - - return metaData_; - } - - - - /** - Returns the connection properties. - - @return The connection properties. - **/ - JDProperties getProperties () - throws SQLException // @EGA - { - return properties_; - } - - - - // @E8A - /** - Returns the job identifier of the host server job corresponding to this connection. - Every JDBC connection is associated with a host server job on the IBM i system. The - format is: -
    -
  • 10 character job name -
  • 10 character user name -
  • 6 character job number -
- -

Note: Since this method is not defined in the JDBC Connection interface, - you typically need to cast a Connection object to AS400JDBCConnection in order - to call this method: -

-    String serverJobIdentifier = ((AS400JDBCConnection)connection).getServerJobIdentifier();
-    
- - @return The server job identifier, or null if not known. - **/ - public String getServerJobIdentifier() // @E8A - { // @E8A - return serverJobIdentifier_; // @E8A - } // @E8A - - - - - int getServerFunctionalLevel() // @EEA - { // @EEA - return serverFunctionalLevel_; // @EEA - } // @EEA - - - // @EHA - /** - Returns the system object which is managing the connection to the system. - -

Note: Since this method is not defined in the JDBC Connection interface, - you typically need to cast a Connection object to AS400JDBCConnection in order - to call this method: -

-    AS400 system = ((AS400JDBCConnection)connection).getSystem();
-    
- - @return The system. - **/ - // Implementation note: Don't use this object internally because we could be running in a proxy environment - // The purpose of this method is to simply hold the full AS400 object so it can be retrieved from the Connection - public AS400 getSystem() // @EHA - { // @EHA - return as400PublicClassObj_; // @EHA - } // @EHA - - - - - - /** - Returns the transaction isolation level. - - @return The transaction isolation level. Possible - values are: -
    -
  • TRANSACTION_NONE -
  • TRANSACTION_READ_UNCOMMITTED -
  • TRANSACTION_READ_COMMITTED -
  • TRANSACTION_REPEATABLE_READ -
- - @exception SQLException If the connection is not open. - **/ - public int getTransactionIsolation () - throws SQLException - { - checkOpen (); - return transactionManager_.getIsolation (); - } - - - - JDTransactionManager getTransactionManager() // @E4A - { // @E4A - return transactionManager_; // @E4A - } // @E4A - - - - // JDBC 2.0 - /** - Returns the type map. - -

This driver does not support the type map. - - @return The type map. - - @exception SQLException This exception is always thrown. - **/ - public Map getTypeMap () - throws SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - - - // @B1C - /** - Returns the next unused id. - - @param resultSetType The result set type. This is - relevant only when the connection - is being used for DRDA. - @return The next unused id. - **/ - // - // Implementation note: This method needs to be synchronized - // so that the same id does not get assigned twice. - // - private int getUnusedId (int resultSetType) //@P0C - throws SQLException - { - synchronized(assigned_) //@P1A - { - // Note: We will always assume id 0 is being used, - // since that represents the connection itself. - - // If this connection is being used for DRDA, then we - // must use statement ids of 1-128 for non-scrollable - // cursors and 129-255 for scrollable cursors. - if (drda_) - { - if (resultSetType == ResultSet.TYPE_FORWARD_ONLY) - { - for (int i = 1; i < DRDA_SCROLLABLE_CUTOFF_; ++i) - { - //@P0Dif (assigned_.get(i) == false) - //@P0D{ // @DAC - //@P0D assigned_.set(i); // @DAC - //@P0D return i; - //@P0D} - if (!assigned_[i]) //@P0A - { - assigned_[i] = true; //@P0A - return i; //@P0A - } - } - } - else - { - for (int i = DRDA_SCROLLABLE_CUTOFF_; i < DRDA_SCROLLABLE_MAX_; ++i) - { // @DAC - //@P0Dif (assigned_.get(i) == false) - //@P0D{ // @DAC - //@P0D assigned_.set(i); // @DAC - //@P0D return i; - //@P0D} - if (!assigned_[i]) //@P0A - { - assigned_[i] = true; //@P0A - return i; //@P0A - } - } - } - } - - // If this connection is NOT being used for DRDA, then - // we can use any statement id. - else - { - for (int i = 1; i < MAX_STATEMENTS_; ++i) - { - //@P0Dif (assigned_.get(i) == false) - //@P0D{ // @DAC - //@P0D assigned_.set(i); // @DAC - //@P0D return i; - //@P0D} - if (!assigned_[i]) //@P0A - { - assigned_[i] = true; //@P0A - return i; //@P0A - } - } - } - - // All ids are being used. - JDError.throwSQLException (this, JDError.EXC_MAX_STATEMENTS_EXCEEDED); - return -1; - } - } - - - - // @j31a new method -- Must the user have "for update" on their - // SQL statement to guarantee an updatable cursor? The answer is - // no for v5r2 and v5r1 systems with a PTF. For V5R1 systems - // without the PTF, v4r5, and earlier, the answer is yes. - boolean getMustSpecifyForUpdate () - { - return mustSpecifyForUpdate_; - } - - - - - - /** - Returns the URL for the connection's database. - - @return The URL for the database. - **/ - String getURL () - throws SQLException // @EGA - { - return dataSourceUrl_.toString (); - } - - - - /** - Returns the user name as currently signed on to the system. - - @return The user name. - **/ - String getUserName () - throws SQLException // @EGA - { - if (TESTING_THREAD_SAFETY) // in certain testing modes, don't contact IBM i system - { - String userName = as400_.getUserId (); - if (userName == null || userName.length() == 0) { - userName = as400PublicClassObj_.getUserId(); - } - return userName; - } - - return as400_.getUserId (); - } - - - - int getVRM() // @D0A - throws SQLException // @EGA - { // @D0A - return vrm_; // @D0A - } // @D0A - - - - /** - Returns the first warning reported for the connection. - Subsequent warnings may be chained to this warning. - - @return The first warning or null if no warnings - have been reported. - - @exception SQLException If an error occurs. - **/ - public SQLWarning getWarnings () - throws SQLException - { - return sqlWarning_; - } - - - - /** - Indicates if the specified cursor name is already used - in the connection. - - @return true if the cursor name is already used; - false otherwise. - **/ - boolean isCursorNameUsed (String cursorName) - throws SQLException // @EGA - { - Enumeration list = statements_.elements(); // @DAA - while (list.hasMoreElements()) - { // @DAC - if (((AS400JDBCStatement)list.nextElement()).getCursorName().equalsIgnoreCase(cursorName)) // @DAC - return true; - } - return false; - } - - - - /** - Indicates if the connection is closed. - - @return true if the connection is closed; false - otherwise. - - @exception SQLException If an error occurs. - **/ - public boolean isClosed () - throws SQLException - { - if (TESTING_THREAD_SAFETY) return false; // in certain testing modes, don't contact IBM i system - - if (server_ == null) // @EFC - return true; // @EFA - if (!server_.isConnected()) - { // @EFA - server_ = null; // @EFA - return true; // @EFA - } // @EFA - else // @EFA - return false; // @EFA - } - - - - /** - Indicates if the connection is in read-only mode. - - @return true if the connection is in read-only mode; - false otherwise. - - @exception SQLException If the connection is not open. - **/ - public boolean isReadOnly () - throws SQLException - { - checkOpen (); - return((readOnly_) || isReadOnlyAccordingToProperties()); // @CPMc - } - - // Called by AS400JDBCPooledConnection. - boolean isReadOnlyAccordingToProperties() - throws SQLException - { - checkOpen (); - return((properties_.getString (JDProperties.ACCESS).equalsIgnoreCase (JDProperties.ACCESS_READ_ONLY)) - || (properties_.getString (JDProperties.ACCESS).equalsIgnoreCase (JDProperties.ACCESS_READ_CALL))); - } - - - // @B4A - /** - Marks all of the cursors as closed. - - @param isRollback True if we called this from rollback(), false if we called this from commit(). - **/ - void markCursorsClosed(boolean isRollback) //@F3C //@XAC - throws SQLException //@F2A - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Testing to see if cursors should be held."); //@F3C - - Enumeration list = statements_.elements(); // @DAA - while (list.hasMoreElements()) // @DAC - { //@KBL - AS400JDBCStatement statement = (AS400JDBCStatement)list.nextElement(); //@KBL - //@KBLD ((AS400JDBCStatement)list.nextElement()).markCursorClosed(isRollback); // @DAC @F3C - // If the statement is held open, all of the result sets have already been closed - if(!statement.isHoldStatement()) //@KBL - statement.markCursorClosed(isRollback); //@KBL - } //@KBL - } - - //@KBL - /* - If a statement associated with locators has been partially closed, finish closing the statement object. - A statement may become partially closed if the user closed the statement and set the "hold statements" connection - property to true when making the connection. Additionally, the statement must have been used to access a locator. - */ - private void markStatementsClosed() - { - if(!statements_.isEmpty()) - { - // Make a clone of the vector, since it will be modified as each statement - // closes itself. - // @KBL Close any statements the user called close on that were associated with locators. - Vector statements = (Vector)statements_.clone(); - Enumeration list = statements.elements(); - while (list.hasMoreElements()) - { - AS400JDBCStatement statement = (AS400JDBCStatement)list.nextElement(); - try - { - if(statement.isHoldStatement()) - { - statement.setAssociatedWithLocators(false); - statement.finishClosing(); - } - } - catch (SQLException e) - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Closing statement after rollback failed: " + e.getMessage()); - } - } - } - } - - //@GKA - // Note: This method is used when the user supplies either the column indexes or names - // to the execute/executeUpdate/prepareStatement method. - /* - * Prepares and executes the statement needed to retrieve generated keys. - */ - String makeGeneratedKeySelectStatement(String sql, int[] columnIndexes, String[] columnNames) - throws SQLException - { - if(columnIndexes != null) - { - //verify there is a column index in the specified array - if(columnIndexes.length == 0) - JDError.throwSQLException(JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - //Prepare a statement in order to retrieve the column names associated with the indexes specified in the array - //wrapper the statement with a select * from final table - // @B4C. Use NEW TABLE instead of FINAL TABLE. With FINAL TABLE, the query will fail if - // AFTER INSERT TRIGGERS are present. Since it is unlikely that AFTER INSERT triggers will - // change the autogenerated keys, NEW TABLE is used. - StringBuffer selectAll = new StringBuffer("SELECT * FROM NEW TABLE("); - selectAll.append(sql); - selectAll.append(")"); - PreparedStatement genPrepStat = prepareStatement(selectAll.toString()); - - // retrieve the JDServerRow object associated with this statement. It contains the column name info. - JDServerRow results = ((AS400JDBCPreparedStatement)genPrepStat).getResultRow(); - columnNames = new String[columnIndexes.length]; - try{ - for(int j=0; jResult sets created using the statement will be type - ResultSet.TYPE_FORWARD_ONLY and concurrency - ResultSet.CONCUR_READ_ONLY. - - @param sql The SQL stored procedure call. - @return The callable statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, or an - error occurs. - **/ - public CallableStatement prepareCall (String sql) - throws SQLException - { - return prepareCall (sql, ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY, getInternalHoldability()); //@G4A - } - - - - // JDBC 2.0 - /** - Precompiles an SQL stored procedure call with optional input - and output parameters and stores it in a CallableStatement - object. This object can be used to efficiently call the SQL - stored procedure multiple times. - - @param sql The SQL statement. - @param resultSetType The result set type. Valid values are: -

    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @param resultSetConcurrency The result set concurrency. Valid values are: -
    -
  • ResultSet.CONCUR_READ_ONLY -
  • ResultSet.CONCUR_UPDATABLE -
- @return The prepared statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type or currency is not valid, - or an error occurs. - **/ - public CallableStatement prepareCall (String sql, - int resultSetType, - int resultSetConcurrency) - throws SQLException - { - return prepareCall(sql, resultSetType, resultSetConcurrency, - getInternalHoldability()); //@G4A - //@G4M Moved code below - } - - - //@G4A JDBC 3.0 - /** - Precompiles an SQL stored procedure call with optional input - and output parameters and stores it in a CallableStatement - object. This object can be used to efficiently call the SQL - stored procedure multiple times. - -

Full functionality of this method requires support in OS/400 V5R2 - or IBM i. If connecting to OS/400 V5R1 or earlier, the value for - resultSetHoldability will be ignored. - - @param sql The SQL statement. - @param resultSetType The result set type. Valid values are: -

    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @param resultSetConcurrency The result set concurrency. Valid values are: -
    -
  • ResultSet.CONCUR_READ_ONLY -
  • ResultSet.CONCUR_UPDATABLE -
- @return The prepared statement object. - @param resultSetHoldability The result set holdability. Valid values are: -
    -
  • ResultSet.HOLD_CURSORS_OVER_COMMIT -
  • ResultSet.CLOSE_CURSORS_AT_COMMIT -
- @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type, currency, or holdability is not valid, - or an error occurs. - @since Modification 5 - **/ - public CallableStatement prepareCall (String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - // Validation. - checkOpen (); - if (! metaData_.supportsResultSetConcurrency (resultSetType, resultSetConcurrency)) - resultSetType = correctResultSetType (resultSetType, resultSetConcurrency); - - if (!checkHoldabilityConstants(resultSetHoldability)) //@F3A - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); //@F3A - - // Create the statement. - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - properties_.getString (JDProperties.DECIMAL_SEPARATOR), true, - properties_.getString (JDProperties.PACKAGE_CRITERIA), this); // @A2A @G4A - int statementId = getUnusedId (resultSetType); // @B1C - AS400JDBCCallableStatement statement = new AS400JDBCCallableStatement (this, - statementId, transactionManager_, packageManager_, - properties_.getString (JDProperties.BLOCK_CRITERIA), - properties_.getInt (JDProperties.BLOCK_SIZE), - sqlStatement, - properties_.getString (JDProperties.PACKAGE_CRITERIA), - resultSetType, resultSetConcurrency, resultSetHoldability, //@G4A - AS400JDBCStatement.GENERATED_KEYS_NOT_SPECIFIED); //@G4A - statements_.addElement(statement); // @DAC - statementCount_++; //@K1A - if(thousandStatements_ == false && statementCount_ == 1000) //@K1A - { //@K1A - thousandStatements_ = true; //@K1A - //post warning //@K1A - postWarning(JDError.getSQLWarning(JDError.WARN_1000_OPEN_STATEMENTS)); //@K1A - } //@K1A - - if (JDTrace.isTraceOn()) //@F4A - { //@F4A - int size = statements_.size(); //@F4A - if (size % 256 == 0) //@F4A - { //@F4A - JDTrace.logInformation (this, "Warning: Open handle count now: " + size); //@F4A - } //@F4A - } //@F4A - - return statement; - } - - - - - /** - Precompiles an SQL statement with optional input parameters - and stores it in a PreparedStatement object. This object can - be used to efficiently execute this SQL statement - multiple times. - -

Result sets created using the statement will be type - ResultSet.TYPE_FORWARD_ONLY and concurrency - ResultSet.CONCUR_READ_ONLY. - - @param sql The SQL statement. - @return The prepared statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, or an - error occurs. - **/ - public PreparedStatement prepareStatement (String sql) - throws SQLException - { - return prepareStatement (sql, ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY, - getInternalHoldability()); //@G4A - } - - - - //@G4A - //JDBC 3.0 - /** - Precompiles an SQL statement with optional input parameters - and stores it in a PreparedStatement object. This object can - be used to efficiently execute this SQL statement - multiple times. - -

This method requires OS/400 V5R2 or IBM i. If connecting to OS/400 V5R1 or earlier, an exception will be - thrown. - -

Result sets created using the statement will be type - ResultSet.TYPE_FORWARD_ONLY and concurrency - ResultSet.CONCUR_READ_ONLY. - - @param sql The SQL statement. - @param autoGeneratedKeys Whether to return auto generated keys. Valid values are: -

    -
  • Statement.RETURN_GENERATED_KEYS -
  • Statement.NO_GENERATED_KEYS -
- @return The prepared statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, - if connecting to OS/400 V5R1 or earlier, - an error occurs. - @since Modification 5 - **/ - public PreparedStatement prepareStatement (String sql, int autoGeneratedKeys) - throws SQLException - { - if (getVRM() < JDUtilities.vrm520) //@F5A - JDError.throwSQLException(this, JDError.EXC_FUNCTION_NOT_SUPPORTED); //@F5A - - // Validation. - checkOpen (); - - // Create the statement. - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - properties_.getString (JDProperties.DECIMAL_SEPARATOR), true, - properties_.getString (JDProperties.PACKAGE_CRITERIA), this); // @A2A @G4A - - if(getVRM() >= JDUtilities.vrm610 && autoGeneratedKeys==Statement.RETURN_GENERATED_KEYS) //@GKA added new generated key support - { - // check if it is an insert statement. - // Note: this should be false if the statement was wrappered with a SELECT - // when prepareStatement(String sql, int[] columnIndex) or - // prepareStatement(String sql, String[] columnNames) was called. - if(sqlStatement.isInsert_) - { - //wrapper the statement - String selectStatement = makeGeneratedKeySelectStatement(sql); - sqlStatement = new JDSQLStatement (selectStatement, properties_.getString(JDProperties.DECIMAL_SEPARATOR), true, - properties_.getString(JDProperties.PACKAGE_CRITERIA), this); - wrappedInsert_ = true; - - } - } - int statementId = getUnusedId (ResultSet.TYPE_FORWARD_ONLY); // @B1C - - if(wrappedInsert_) - { - sqlStatement.setSelectFromInsert(true); - wrappedInsert_ = false; - } - - AS400JDBCPreparedStatement statement = new AS400JDBCPreparedStatement (this, - statementId, transactionManager_, packageManager_, - properties_.getString (JDProperties.BLOCK_CRITERIA), - properties_.getInt (JDProperties.BLOCK_SIZE), - properties_.getBoolean (JDProperties.PREFETCH), - sqlStatement, false, - properties_.getString (JDProperties.PACKAGE_CRITERIA), - ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, - getInternalHoldability(), autoGeneratedKeys); //@G4A - statements_.addElement(statement); // @DAC - statementCount_++; //@K1A - if(thousandStatements_ == false && statementCount_ == 1000) //@K1A - { //@K1A - thousandStatements_ = true; //@K1A - //post warning //@K1A - postWarning(JDError.getSQLWarning(JDError.WARN_1000_OPEN_STATEMENTS)); //@K1A - } //@K1A - - if (JDTrace.isTraceOn()) //@F4A - { //@F4A - int size = statements_.size(); //@F4A - if (size % 256 == 0) //@F4A - { //@F4A - JDTrace.logInformation (this, "Warning: Open handle count now: " + size); //@F4A - } //@F4A - } //@F4A - - return statement; - } - - - - - // JDBC 2.0 - /** - Precompiles an SQL statement with optional input parameters - and stores it in a PreparedStatement object. This object can - be used to efficiently execute this SQL statement - multiple times. - -

Result sets created using the statement will be holdability - ResultSet.CLOSE_CURSORS_AT_COMMIT. - - @param sql The SQL statement. - @param resultSetType The result set type. Valid values are: -

    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @param resultSetConcurrency The result set concurrency. Valid values are: -
    -
  • ResultSet.CONCUR_READ_ONLY -
  • ResultSet.CONCUR_UPDATABLE -
- @return The prepared statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type or currency is not valid, - or an error occurs. - **/ - public PreparedStatement prepareStatement (String sql, - int resultSetType, - int resultSetConcurrency) - throws SQLException - { - return prepareStatement (sql, resultSetType, //@G4A - resultSetConcurrency, getInternalHoldability()); //@G4A - //@G4M Moved code to next method. - } - - - //@G4A - // JDBC 3.0 - /** - Precompiles an SQL statement with optional input parameters - and stores it in a PreparedStatement object. This object can - be used to efficiently execute this SQL statement - multiple times. - - @param sql The SQL statement. - @param resultSetType The result set type. Valid values are: -
    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @param resultSetConcurrency The result set concurrency. Valid values are: -
    -
  • ResultSet.CONCUR_READ_ONLY -
  • ResultSet.CONCUR_UPDATABLE -
- @param resultSetHoldability The result set holdability. Valid values are: -
    -
  • ResultSet.HOLD_CURSORS_OVER_COMMIT -
  • ResultSet.CLOSE_CURSORS_AT_COMMIT -
- @return The prepared statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type, currency, or holdability is not valid, - or an error occurs. - **/ - public PreparedStatement prepareStatement (String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - // Validation. - checkOpen (); - if (! metaData_.supportsResultSetConcurrency (resultSetType, resultSetConcurrency)) - resultSetType = correctResultSetType (resultSetType, resultSetConcurrency); - - if (!checkHoldabilityConstants(resultSetHoldability)) //@F3A - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); //@F3A - - // Create the statement. - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - properties_.getString (JDProperties.DECIMAL_SEPARATOR), true, - properties_.getString (JDProperties.PACKAGE_CRITERIA), this); // @A2A @G4A - int statementId = getUnusedId (resultSetType); // @B1C - AS400JDBCPreparedStatement statement = new AS400JDBCPreparedStatement (this, - statementId, transactionManager_, packageManager_, - properties_.getString (JDProperties.BLOCK_CRITERIA), - properties_.getInt (JDProperties.BLOCK_SIZE), - properties_.getBoolean (JDProperties.PREFETCH), - sqlStatement, false, - properties_.getString (JDProperties.PACKAGE_CRITERIA), - resultSetType, resultSetConcurrency, resultSetHoldability, //@G4A - AS400JDBCStatement.GENERATED_KEYS_NOT_SPECIFIED); //@G4A - statements_.addElement(statement); // @DAC - statementCount_++; //@K1A - if(thousandStatements_ == false && statementCount_ == 1000) //@K1A - { //@K1A - thousandStatements_ = true; //@K1A - //post warning //@K1A - postWarning(JDError.getSQLWarning(JDError.WARN_1000_OPEN_STATEMENTS)); //@K1A - } //@K1A - - if (JDTrace.isTraceOn()) //@F4A - { //@F4A - int size = statements_.size(); //@F4A - if (size % 256 == 0) //@F4A - { //@F4A - JDTrace.logInformation (this, "Warning: Open handle count now: " + size); //@F4A - } //@F4A - } //@F4A - - return statement; - } - - // @G4 new method - /** - * Precompiles an SQL statement with optional input parameters - * and stores it in a PreparedStatement object. This object can - * be used to efficiently execute this SQL statement - * multiple times. - * - *

This method is not supported when connecting to IBM i V5R4 or earlier systems. - * - * @param sql The SQL statement. - * @param columnIndexes An array of column indexes indicating the columns that should be returned from the inserted row or rows. - * @return The prepared statement object. - * @exception java.sql.SQLException - If connecting to IBM i V5R4 or earlier systems, - * the connection is not open, - * the maximum number of statements for this connection has been reached, - * or an error occurs. - * @since Modification 5 - **/ - public PreparedStatement prepareStatement (String sql, int[] columnIndexes) - throws SQLException - { - if(getVRM() >= JDUtilities.vrm610) //@GKA added support for generated keys - { - // Validation - checkOpen(); - - //Create a JDSQLStatement - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - properties_.getString (JDProperties.DECIMAL_SEPARATOR), true, - properties_.getString (JDProperties.PACKAGE_CRITERIA), this); - //Check if the statement is an insert - if(sqlStatement.isInsert_){ - wrappedInsert_ = true; - return prepareStatement(makeGeneratedKeySelectStatement(sql, columnIndexes, null), Statement.RETURN_GENERATED_KEYS); - } - else // treat like prepareStatement(sql) was called - return prepareStatement(sql); - } - else //@GKA Throw an exception. V5R4 and earlier does not support retrieving generated keys by column index. - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - } - - - // @G4 new method - /** - * Precompiles an SQL statement with optional input parameters - * and stores it in a PreparedStatement object. This object can - * be used to efficiently execute this SQL statement - * multiple times. - * - *

This method is not supported when connecting to IBM i V5R4 or earlier systems. - * - * @param sql The SQL statement. - * @param columnNames An array of column names indicating the columns that should be returned from the inserted row or rows. - * @return The prepared statement object. - * @exception java.sql.SQLException - If connecting to IBM i V5R4 or earlier systems, - * the connection is not open, - * the maximum number of statements for this connection has been reached, - * or an error occurs. - * @since Modification 5 - **/ - public PreparedStatement prepareStatement (String sql, String[] columnNames) - throws SQLException - { - if(getVRM() >= JDUtilities.vrm610) //@GKA added generated key support - { - //Validation - checkOpen(); - - //Create a JDSQLStatement - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - properties_.getString (JDProperties.DECIMAL_SEPARATOR), true, - properties_.getString (JDProperties.PACKAGE_CRITERIA), this); - //Check if the statement is an insert - if(sqlStatement.isInsert_){ - wrappedInsert_ = true; - return prepareStatement(makeGeneratedKeySelectStatement(sql, null, columnNames), Statement.RETURN_GENERATED_KEYS); - } - else // treat like prepareStatement(sql) was called - return prepareStatement(sql); - } - else //@GKA Throw an exception. V5R4 and earlier does not support retrieving generated keys by column name. - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - } - - - - //@E10a new method - void processSavepointRequest(String savepointStatement) - throws SQLException - { - // must be OS/400 v5r2 or IBM i - if (vrm_ < JDUtilities.vrm520) - JDError.throwSQLException(this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - - // cannot do savepoints on XA transactions - if (!transactionManager_.isLocalTransaction()) - JDError.throwSQLException (this, JDError.EXC_TXN_STATE_INVALID); - - // cannot do savepoints if autocommit on - if (getAutoCommit()) - JDError.throwSQLException(this, JDError.EXC_TXN_STATE_INVALID); - - Statement statement = null; //@scan1 - try{ - statement = createStatement(); - - statement.executeUpdate(savepointStatement); - - }finally //@scan1 - { - if(statement != null) //@scan1 - statement.close(); - - } - } - - - - - - - - /** - Partial closing of the connection. - @exception SQLException If a database error occurs. - **/ - void pseudoClose() throws SQLException // @E1 - { - // Rollback before closing. - if ((transactionManager_.isLocalTransaction()) && (transactionManager_.isLocalActive())) // @E4A - rollback (); - - // Close all statements that are running in the context of this connection. - // Make a clone of the vector, since it will be modified as each statement @DAA - // closes itself. // @DAA - // @j4 change -- close may throw a SQLException. Log that error and keep going. - // Since the user called close we won't return until we tried to close all - // statements. - Vector statements = (Vector)statements_.clone(); // @DAA - Enumeration list = statements.elements(); // @DAA - while (list.hasMoreElements()) // @DAC - { - // @DAC - AS400JDBCStatement statement = (AS400JDBCStatement)list.nextElement(); // @DAA - try - { // @J4a - if(statement.isHoldStatement()) //@KBL user already called close, now completely close it - { //@KBL - statement.setAssociatedWithLocators(false); //@KBL - statement.finishClosing(); //@KBL - } //@KBL - // @J4a - if (! statement.isClosed()) // @DAC - statement.close(); // @DAC - } // @J4a - catch (SQLException e) // @J4a - { - // @J4a - if (JDTrace.isTraceOn()) // @J4a - JDTrace.logInformation (this, "Closing statement while closing connection failed: " + e.getMessage()); // @j4a - } // @J4a - } - - // @j1a clean up any IBM i debug that is going on. This entire block - // is new for @J1 - if (traceServer_ > 0 || databaseHostServerTrace_) // @2KRC - { - // Get the job identifier because we need the id (it is part of some - // of our trace files). I know I could have saved it from - // the start-trace code but tracing is not performance critical so - // why make the object bigger by storing trace stuff as member data. - String serverJobIdentifier = getServerJobIdentifier(); - - // Same for this flag. Don't want to grow the object by saving - // this as member data. - boolean preV5R1 = true; - boolean SQLNaming = properties_.getString(JDProperties.NAMING).equals(JDProperties.NAMING_SQL); - - try - { - preV5R1 = getVRM() <= JDUtilities.vrm450; - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to end server job tracing failed, could not get server VRM"); - } - - boolean endedTraceJob = false; //@540 Used to determine if ENDTRC has already been done. - // End trace-job - if ((traceServer_ & ServerTrace.JDBC_TRACE_SERVER_JOB) > 0) - { - try - { - if (preV5R1) - JDUtilities.runCommand(this, "QSYS/TRCJOB SET(*OFF) OUTPUT(*PRINT)", SQLNaming); - else - { - JDUtilities.runCommand(this, "QSYS/ENDTRC SSNID(QJT" + - serverJobIdentifier.substring(20) + - ") DTAOPT(*LIB) DTALIB(QUSRSYS) RPLDTA(*YES) PRTTRC(*YES)", SQLNaming ); - - JDUtilities.runCommand(this, "QSYS/DLTTRC DTAMBR(QJT" + - serverJobIdentifier.substring(20) + - ") DTALIB(QUSRSYS)", SQLNaming ); - } - endedTraceJob = true; //@540 - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to end server job tracing failed"); - } - } - - //@540 End database host server trace job - // Database Host Server Trace is supported on V5R3+ - if(getVRM() >= JDUtilities.vrm530 && !endedTraceJob) - { - // Only issue ENDTRC if not already done. - if(((traceServer_ & ServerTrace.JDBC_TRACE_DATABASE_HOST_SERVER) > 0) || databaseHostServerTrace_) // @2KRC - { - // end database host server trace - try{ - JDUtilities.runCommand(this, "QSYS/ENDTRC SSNID(QJT" + - serverJobIdentifier.substring(20) + - ") DTAOPT(*LIB) DTALIB(QUSRSYS) RPLDTA(*YES) PRTTRC(*YES)", SQLNaming ); - - JDUtilities.runCommand(this, "QSYS/DLTTRC DTAMBR(QJT" + - serverJobIdentifier.substring(20) + - ") DTALIB(QUSRSYS)", SQLNaming ); - } - catch(Exception e){ - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to end database host server tracing failed."); - } - } - } - - // End debug-job - if ((traceServer_ & ServerTrace.JDBC_DEBUG_SERVER_JOB) > 0) - { - try - { - JDUtilities.runCommand(this, "QSYS/ENDDBG", SQLNaming); - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to end server job tracing failed, could not end debug on server job "); - } - } - - // End the database monitor - if ((traceServer_ & ServerTrace.JDBC_START_DATABASE_MONITOR) > 0) - { - try - { - JDUtilities.runCommand(this, "QSYS/ENDDBMON", SQLNaming); - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to end server job tracing failed, could not end database monitor"); - } - } - - // Dump out SQL information - if (((traceServer_ & ServerTrace.JDBC_SAVE_SQL_INFORMATION) > 0) && !preV5R1) - { - try - { - JDUtilities.runCommand(this, "QSYS/PRTSQLINF *JOB", SQLNaming); - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to end server job tracing failed, could not print SQL information"); - } - } - - // Dump the joblog - if ((traceServer_ & ServerTrace.JDBC_SAVE_SERVER_JOBLOG) > 0) - { - try - { - JDUtilities.runCommand(this, "QSYS/DSPJOBLOG JOB(*) OUTPUT(*PRINT)", SQLNaming); - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to end server job tracing failed, could not save job log"); - } - } - - // If the user set our flag to turn on client tracing then turn it back off. - // This may turn off tracing even though the user wanted it on for some other - // reason but there is no way for this code to know why tracing was turned on. - // It does know this interface is one reason it is on so we will assume it - // is the only reason and will turn it off here. - if ((traceServer_ & ServerTrace.JDBC_TRACE_CLIENT) > 0) - JDTrace.setTraceOn(false); - } - } - - - // @E10a new method - /** - * Removes the given Savepoint object from the current transaction. - * Any reference to the savepoint after it has been removed will - * cause an SQLException to be thrown. - * - * @param savepoint the savepoint to be removed. - * - * @exception SQLException if a database access error occurs or the given Savepoint - * is not a valid savepoint in the current transaction. - * - * @since Modification 5 - **/ - public void releaseSavepoint(Savepoint savepoint) - throws SQLException - { - if (savepoint == null) - throw new NullPointerException("savepoint"); - - AS400JDBCSavepoint sp = (AS400JDBCSavepoint) savepoint; - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Releasing savepoint " + sp.getName()); - - if (sp.getStatus() != AS400JDBCSavepoint.ACTIVE) - JDError.throwSQLException(this, JDError.EXC_SAVEPOINT_DOES_NOT_EXIST); - - String SQLCommand = "RELEASE SAVEPOINT " + sp.getName(); - - processSavepointRequest(SQLCommand); - - sp.setStatus(AS400JDBCSavepoint.CLOSED); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Savepoint " + sp.getName() + " released."); - } - - - - - - - - // @E4C - /** - Drops all changes made since the previous commit or - rollback and releases any database locks currently held by - the connection. This has no effect when the connection - is in auto-commit mode. - -

This method can not be called when the connection is part - of a distributed transaction. See - AS400JDBCXAResource for more information. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public void rollback () - throws SQLException - { - checkOpen (); - - if (!transactionManager_.isLocalTransaction()) // @E4A - JDError.throwSQLException (this, JDError.EXC_TXN_STATE_INVALID); // @E4A - - if (transactionManager_.getAutoCommit () && properties_.getBoolean(JDProperties.AUTOCOMMIT_EXCEPTION)) - JDError.throwSQLException (this, JDError.EXC_FUNCTION_SEQUENCE); - - if (! transactionManager_.getAutoCommit ()) - { - transactionManager_.rollback (); - - // @F3 Mark all cursors closed on a rollback. Don't worry here - // @F3 about whether their statement level holdability is different; we will check - // @F3 that within Statement.markCursorsClosed(). - - // @F3D if (transactionManager_.getHoldIndicator() == JDTransactionManager.CURSOR_HOLD_FALSE // @B4A - // @F3 Passing true means we called markCursorClosed from rollback. - markCursorsClosed(true); // @B4A @F3C - - if(properties_.getBoolean(JDProperties.HOLD_STATEMENTS )) //@PDA additional HOLD_STATEMENTS check - markStatementsClosed(); //@KBL - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Transaction rollback"); - } - } - - // @E10 new method - /** - * Undoes all changes made after the specified Savepoint was set. - * - * @param savepoint the savepoint to be rolled back to. - * - * @exception SQLException if a database access error occurs, the Savepoint - * is no longer valid, or this Connection - * is currently in auto-commit mode. - * @since Modification 5 - **/ - public void rollback(Savepoint savepoint) - throws SQLException - { - if (savepoint == null) - throw new NullPointerException("savepoint"); - - - AS400JDBCSavepoint sp = (AS400JDBCSavepoint) savepoint; - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Rollback with savepoint " + sp.getName()); - - if (sp.getStatus() != AS400JDBCSavepoint.ACTIVE) - JDError.throwSQLException(this, JDError.EXC_SAVEPOINT_DOES_NOT_EXIST); - - String SQLCommand = "ROLLBACK TO SAVEPOINT " + sp.getName(); - - processSavepointRequest(SQLCommand); - - sp.setStatus(AS400JDBCSavepoint.CLOSED); - - if(properties_.getBoolean(JDProperties.HOLD_STATEMENTS )) //@PDA additional HOLD_STATEMENTS check - markStatementsClosed(); //@KBL - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Rollback with savepoint " + sp.getName() + " complete."); - } - - - - - - - /** - Sends a request data stream to the system using the - connection's id and does not expect a reply. - - @param request The request. - - @exception SQLException If an error occurs. - **/ - // - // See implementation notes for sendAndReceive(). - // - void send (DBBaseRequestDS request) - throws SQLException - { - send (request, id_, true); - } - - - - /** - Sends a request data stream to the system and does not - expect a reply. - - @param request The request. - @param id The id. - - @exception SQLException If an error occurs. - **/ - // - // See implementation notes for sendAndReceive(). - // - void send (DBBaseRequestDS request, int id) - throws SQLException - { - send (request, id, true); - } - - - - /** - Sends a request data stream to the system and does not - expect a reply. - - @param request The request. - @param id The id. - @param leavePending Indicates if the request should - be left pending. This indicates - whether or not to base the next - request on this one. - - @exception SQLException If an error occurs. - **/ - // - // See implementation notes for sendAndReceive(). - // - void send (DBBaseRequestDS request, int id, boolean leavePending) - throws SQLException - { - checkCancel(); // @E8A - checkOpen(); // @W1a - - try - { - // Since we are just calling send() (instead of sendAndReceive()), // @EAA - // make sure we are not asking the system for a reply. Otherwise, // @EAA - // the reply will come back and it will get held in the AS400 // @EAA - // read daemon indefinitely - - a memory leak. // @EAA - if (JDTrace.isTraceOn()) - { // @EAA - if (request.getOperationResultBitmap() != 0) // @EAA - JDTrace.logInformation (this, "Reply requested but not collected:" + request.getReqRepID()); // @EAA - } // @EAA - - request.setBasedOnORSHandle (0); // @DAC @EKC - DBReplyRequestedDS reply = null; - - if (dataCompression_ == DATA_COMPRESSION_RLE_) - { // @ECA - request.addOperationResultBitmap(DBBaseRequestDS.ORS_BITMAP_REQUEST_RLE_COMPRESSION); // @ECA - request.addOperationResultBitmap(DBBaseRequestDS.ORS_BITMAP_REPLY_RLE_COMPRESSION); // @ECA - request.compress(); // @ECA - } // @ECA - - DataStream actualRequest; // @E5A - synchronized(heldRequestsLock_) - { // @E5A - if (heldRequests_ != null) // @E5A - actualRequest = new DBConcatenatedRequestDS(heldRequests_, request); // @E5A - else // @E5A - actualRequest = request; // @E5A - heldRequests_ = null; // @E5A - - server_.send(actualRequest); // @E5A @F7M -//@P1D requestPending_[id] = leavePending; //@P0A @F7M - } // @E5A - - // @E5D if (DEBUG_REQUEST_CHAINING_ == true) { - //@P0D if (leavePending) // @DAA - //@P0D requestPending_.set(id); // @DAC - //@P0D else // @DAA - //@P0D requestPending_.clear(id); // @DAA - - // @E5D } - // @E5D else { - // @E5D request.addOperationResultBitmap (DBBaseRequestDS.ORS_BITMAP_RETURN_DATA); - // @E5D reply = (DBReplyRequestedDS) server_.sendAndReceive (request); - // @E5D requestPending_[id] = false; - // @E5D } - - if (DEBUG_COMM_TRACE_ > 0) - { - debug (request); - // @E5D if (DEBUG_REQUEST_CHAINING_ == false) - // @E5D debug (reply); - } - } - // @J5D catch (ConnectionDroppedException e) { // @C1A - // @J5D server_ = null; // @D8 - // @J5D request.freeCommunicationsBuffer(); // @EMa - // @J5D JDError.throwSQLException (this, JDError.EXC_CONNECTION_NONE, e); // @C1A - // @J5D } // @C1A - catch (IOException e) - { // @J5A - server_ = null; // @J5A - //@P0D request.freeCommunicationsBuffer(); // @J5A - JDError.throwSQLException (this, JDError.EXC_COMMUNICATION_LINK_FAILURE, e); // @J5A - } // @J5A - catch (Exception e) - { - //@P0D request.freeCommunicationsBuffer(); // @EMa - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - } - - - - // @EBD /** - // @EBD Sends a request data stream to the system and discards - // @EBD the reply. - // @EBD - // @EBD @param request The request. - // @EBD @param id The id. - // @EBD @param leavePending Indicates if the request should - // @EBD be left pending. This indicates - // @EBD whether or not to base the next - // @EBD request on this one. - // @EBD - // @EBD @exception SQLException If an error occurs. - // @EBD **/ - // @EBD // - // @EBD // See implementation notes for sendAndReceive(). - // @EBD // - // @EBD void sendAndDiscardReply (DBBaseRequestDS request, int id) - // @EBD throws SQLException - // @EBD { - // @EBD checkCancel(); // @E8A - // @EBD - // @EBD try { - // @EBD request.setBasedOnORSHandle (0); //@EKC - // @EBD - // @EBD DataStream actualRequest; // @E5A - // @EBD synchronized(heldRequestsLock_) { // @E5A - // @EBD if (heldRequests_ != null) // @E5A - // @EBD actualRequest = new DBConcatenatedRequestDS(heldRequests_, request); // @E5A - // @EBD else // @E5A - // @EBD actualRequest = request; // @E5A - // @EBD heldRequests_ = null; // @E5A - // @EBD } // @E5A - // @EBD - // @EBD server_.sendAndDiscardReply(actualRequest); // @E5C - // @EBD requestPending_[id] = false; - // @EBD - // @EBD if (DEBUG_COMM_TRACE_ > 0) - // @EBD debug (request); - // @EBD } - // @EBD catch (ConnectionDroppedException e) { // @C1A - // @EBD server_ = null; // @D8 - // @EBD JDError.throwSQLException (this, JDError.EXC_CONNECTION_NONE, e); // @C1A - // @EBD } // @C1A - // @EBD catch (Exception e) { - // @EBD JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - // @EBD } - // @EBD } - - - - // @E5A - /** - Holds a request until the next explicit request. It will - be concatenated at the beginning of the next request. - - @param request The request. - @param id The id. - - @exception SQLException If an error occurs. - **/ - // - // See implementation notes for sendAndReceive(). - // - void sendAndHold(DBBaseRequestDS request, int id) - throws SQLException - { - checkCancel(); // @E8A - checkOpen(); // @W1a - - try - { - // Since we are just calling send() (instead of sendAndReceive()), // @EAA - // make sure we are not asking the system for a reply. Otherwise, // @EAA - // the reply will come back and it will get held in the AS400 // @EAA - // read daemon indefinitely - - a memory leak. // @EAA - if (JDTrace.isTraceOn()) - { // @EAA - if (request.getOperationResultBitmap() != 0) // @EAA - JDTrace.logInformation (this, "Reply requested but not collected:" + request.getReqRepID()); // @EAA - } // @EAA - - request.setBasedOnORSHandle(0); // @DAC @EKC - - if (dataCompression_ == DATA_COMPRESSION_RLE_) - { // @ECA - request.addOperationResultBitmap(DBBaseRequestDS.ORS_BITMAP_REQUEST_RLE_COMPRESSION); // @ECA - request.addOperationResultBitmap(DBBaseRequestDS.ORS_BITMAP_REPLY_RLE_COMPRESSION); // @ECA - request.compress(); // @ECA - } // @ECA - - synchronized(heldRequestsLock_) - { - if (heldRequests_ == null) - heldRequests_ = new Vector(); - heldRequests_.addElement(request); - } - - //@P0D requestPending_.set(id); // @DAC -//@P1D requestPending_[id] = true; //@P0A - - if (DEBUG_COMM_TRACE_ > 0) - { - debug (request); - System.out.println("This request was HELD."); - } - } - // Note: No need to check for an IOException in this method, since we don't contact the system. @J5A - catch (Exception e) - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - } - - - - /** - Sends a request data stream to the system using the - connection's id and returns the corresponding reply from - the system. - - @param request The request. - @return The reply. - - @exception SQLException If an error occurs. - **/ - // - // See implementation notes for sendAndReceive(). - // - DBReplyRequestedDS sendAndReceive (DBBaseRequestDS request) - throws SQLException - { - return sendAndReceive (request, id_); - } - - - - /** - Sends a request data stream to the system and returns the - corresponding reply from the system. - - @param request The request. - @param id The id. - @return The reply. - - @exception SQLException If an error occurs. - **/ - // - // Implementation notes: - // - // 1. We do not have to worry about thread synchronization - // here, since the AS400Server object handles it. - // - // 2. The based on id is used to chain requests for the - // same ORS without needing to get a reply for each one. - // If a request fails, then all subsequent requests will - // too, and the results from the original failure will - // ultimately be returned. - // - // Initially, the based on id is set to 0. After a - // request is sent the based on id is set to the statement's - // id, so that subsequent requests will base on this id. - // Finally, when a reply is retrieved, the based on id - // is reset to 0. - // - // The status of the based on id depends on whether a - // request is pending, which is maintained in the id table. - // - DBReplyRequestedDS sendAndReceive (DBBaseRequestDS request, int id) - throws SQLException - { - checkCancel(); // @E8A - checkOpen(); // @W1a - - DBReplyRequestedDS reply = null; - - try - { - request.setBasedOnORSHandle (0); // @DAC @EKC - - if (dataCompression_ == DATA_COMPRESSION_RLE_) - { // @ECA - request.addOperationResultBitmap(DBBaseRequestDS.ORS_BITMAP_REQUEST_RLE_COMPRESSION); // @ECA - request.addOperationResultBitmap(DBBaseRequestDS.ORS_BITMAP_REPLY_RLE_COMPRESSION); // @ECA - request.compress(); // @ECA - } // @ECA - - DataStream actualRequest; // @E5A - synchronized(heldRequestsLock_) - { // @E5A - if (heldRequests_ != null) // @E5A - actualRequest = new DBConcatenatedRequestDS(heldRequests_, request); // @E5A - else // @E5A - actualRequest = request; // @E5A - heldRequests_ = null; // @E5A - - reply = (DBReplyRequestedDS)server_.sendAndReceive(actualRequest); // @E5C @F7M - //@P0D requestPending_.clear(id); -//@P1D requestPending_[id] = false; //@P0A @F7M - } // @E5A - - reply.parse(dataCompression_); // @E5A - // @DAC - - if (DEBUG_COMM_TRACE_ > 0) - { - debug (request); - debug (reply); - } - } - // @J5D catch (ConnectionDroppedException e) { // @C1A - // @J5D server_ = null; // @D8 - // @J5D request.freeCommunicationsBuffer(); // @EMa - // @J5D JDError.throwSQLException (this, JDError.EXC_CONNECTION_NONE, e); // @C1A - // @J5D } // @C1A - catch (IOException e) - { // @J5A - server_ = null; // @J5A - //@P0D request.freeCommunicationsBuffer(); // @J5A - JDError.throwSQLException (this, JDError.EXC_COMMUNICATION_LINK_FAILURE, e); // @J5A - } // @J5A - catch (Exception e) - { - //@P0D request.freeCommunicationsBuffer(); // @EMa - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - // if (DBDSPool.monitor) { - // reply.setAllocatedLocation(); - // } - - return(DBReplyRequestedDS) reply; - } - - - - // @E4C - /** - Sets the auto-commit mode. If the connection is in auto-commit - mode, then all of its SQL statements are executed and committed - as individual transactions. Otherwise, its SQL statements are - grouped into transactions that are terminated by either a commit - or rollback. - -

By default, the connection is in auto-commit mode. The - commit occurs when the statement execution completes or the - next statement execute occurs, whichever comes first. In the - case of statements returning a result set, the statement - execution completes when the last row of the result set has - been retrieved or the result set has been closed. In advanced - cases, a single statement may return multiple results as well - as output parameter values. Here the commit occurs when all results - and output parameter values have been retrieved. - -

The auto-commit mode is always false when the connection is part - of a distributed transaction. See - AS400JDBCXAResource for more information. - - @param autoCommit true to turn on auto-commit mode, false to - turn it off. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public void setAutoCommit (boolean autoCommit) - throws SQLException - { - checkOpen (); - if (TESTING_THREAD_SAFETY) return; // in certain testing modes, don't contact IBM i system - - transactionManager_.setAutoCommit (autoCommit); - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Auto commit", transactionManager_.getAutoCommit ()); - } - - - - /** - This method is not supported. - - @exception SQLException If the connection is not open. - **/ - public void setCatalog (String catalog) - throws SQLException - { - checkOpen (); - - // No-op. - } - - //@cc1 - /** - * This method sets concurrent access resolution. This method overrides the setting of ConcurrentAccessResolution on the datasource or connection - * URL properties. This changes the setting for this connection only. This method has no effect on - * IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @param concurrentAccessResolution The current access resolution setting. Possible valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public void setConcurrentAccessResolution (int concurrentAccessResolution) throws SQLException - { - - DBSQLAttributesDS request = null; - DBReplyRequestedDS reply = null; - try - { - if (getVRM() >= JDUtilities.vrm710) - { - request = DBDSPool.getDBSQLAttributesDS(DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); - - //get value of concurrent access resolution. - int car = properties_.getInt(JDProperties.CONCURRENT_ACCESS_RESOLUTION); - //here, we also allow resetting back to default 0 - //pass value of concurrent access resolution into the hostserver request. - request.setConcurrentAccessResolution( car ); - - reply = sendAndReceive(request); - int errorClass = reply.getErrorClass(); - if (errorClass != 0) - JDError.throwSQLException(this, id_, errorClass, reply.getReturnCode()); - } - } catch( Exception e) - { - JDError.throwSQLException( this, JDError.EXC_INTERNAL, e); - } finally - { - if (request != null) { - request.returnToPool(); request=null; - } - if (reply != null) { - reply.returnToPool(); reply = null; // Can return -- only errorClass accessed - } - } - - concurrentAccessResolution_ = concurrentAccessResolution; - } - - - /** - Sets the eWLM Correlator. It is assumed a valid correlator value is used. - If the value is null, all ARM/eWLM implementation will be turned off. - eWLM correlators require IBM i V5R3 or later systems. This request is ignored when running to OS/400 V5R2 or earlier systems. - - @param bytes The eWLM correlator value - **/ - public void setDB2eWLMCorrelator(byte[] bytes) - throws SQLException //@eWLM - { - if(vrm_ >= JDUtilities.vrm530) - { - DBSQLAttributesDS request = null; - DBReplyRequestedDS reply = null; - try - { - if(bytes == null) - { - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Correlator is null"); - } - request = DBDSPool.getDBSQLAttributesDS (DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); - request.seteWLMCorrelator(bytes); - reply = sendAndReceive(request); - int errorClass = reply.getErrorClass(); - if(errorClass != 0) - JDError.throwSQLException(this, id_, errorClass, reply.getReturnCode()); - } - catch(DBDataStreamException e) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - if (reply != null) { reply.returnToPool(); reply = null; } // Return to pool since only errorClass accessed - } - } - } - - - // @B1A - /** - Sets whether the connection is being used for DRDA. - - @param drda true if the connection is being used for DRDA, - false otherwise. - **/ - void setDRDA (boolean drda) - throws SQLException // @EGA - { - drda_ = drda; - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, "DRDA", drda_); - } - - - //@G4A JDBC 3.0 - /** - Sets the holdability of ResultSets created from this connection. - -

Full functionality of this method requires OS/400 V5R2 - or IBM i. If connecting to OS/400 V5R1 or earlier, all - cursors for the connection will be changed to the value of the variable - holdability. - - @param holdability The cursor holdability. - Valid values are ResultSet.HOLD_CURSORS_OVER_COMMIT or - ResultSet.CLOSE_CURSORS_AT_COMMIT. - - @exception SQLException If the connection is not open - or the value passed in is not valid. - @since Modification 5 - **/ - public void setHoldability (int holdability) - throws SQLException - { - checkOpen (); - if (TESTING_THREAD_SAFETY) return; // in certain testing modes, don't contact IBM i system - - if (!checkHoldabilityConstants(holdability)) //@F3A - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); //@F3A - - holdability_ = holdability; - - if (holdability == AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT) //@F5A - transactionManager_.setHoldIndicator(JDProperties.CURSORHOLD_FALSE); //@F5A - else if (holdability == AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT) //@F5A - transactionManager_.setHoldIndicator(JDProperties.CURSORHOLD_TRUE); //@F5A - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Holdability", holdability_); - } - - - - //@D4A - void setProperties (JDDataSourceURL dataSourceUrl, JDProperties properties, - AS400 as400) - throws SQLException - { - if (TESTING_THREAD_SAFETY) // in certain testing modes, don't contact IBM i system - { - as400PublicClassObj_ = as400; - } - else - { - try - { - as400.connectService (AS400.DATABASE); - } - catch (AS400SecurityException e) - { //@D5C - JDError.throwSQLException (this, JDError.EXC_CONNECTION_REJECTED, e); - } - catch (IOException e) - { //@D5C - JDError.throwSQLException (this, JDError.EXC_CONNECTION_UNABLE, e); - } - finally //@dbldrvr - { //@dbldrvr - //Since driver is registered twice in DriverManager via DriverManager.registerDriver(new AS400JDBCDriver()), - //remove extra driver references now so we don't waste resources by continuing to try, and also so we don't lock out id if pwd is not correct. - Enumeration en = DriverManager.getDrivers(); //@dbldrvr - Driver firstDriver = null; //@dbldrvr - Driver nextDriver = null; //@dbldrvr - while (en.hasMoreElements()) //@dbldrvr - { //@dbldrvr - nextDriver = (Driver) en.nextElement(); //@dbldrvr - if(nextDriver instanceof AS400JDBCDriver) //@dbldrvr - { //@dbldrvr - if(firstDriver == null) //@dbldrvr - firstDriver = nextDriver; //@dbldrvr - else //@dbldrvr - DriverManager.deregisterDriver(nextDriver); //@dbldrvr - } //@dbldrvr - } //@dbldrvr - } //@dbldrvr - } - - setProperties (dataSourceUrl, properties, as400.getImpl()); - } - - - void setProperties(JDDataSourceURL dataSourceUrl, JDProperties properties, AS400Impl as400) - throws SQLException - { - setProperties(dataSourceUrl, properties, as400, false); - } - - //@A3A - This logic formerly resided in the ctor. - void setProperties (JDDataSourceURL dataSourceUrl, JDProperties properties, AS400Impl as400, boolean newServer) - throws SQLException - { - // Initialization. - as400_ = (AS400ImplRemote) as400; //@A3A - //@P0D assigned_ = new BitSet(INITIAL_STATEMENT_TABLE_SIZE_); // @DAC - dataSourceUrl_ = dataSourceUrl; - extendedFormats_ = false; - properties_ = properties; - //Set the real default for METADATA SOURCE property since we now know the hostsrvr version - if(properties_.getString(JDProperties.METADATA_SOURCE).equals(JDProperties.METADATA_SOURCE_HOST_VERSION_DEFAULT)) //@mdsp - { //@mdsp - if(as400_.getVRM() < JDUtilities.vrm710) //@mdsp //@710 take effect after 710 (ie. not 615) - properties_.setString(JDProperties.METADATA_SOURCE, JDProperties.METADATA_SOURCE_ROI); //@mdsp - else //@mdsp - properties_.setString(JDProperties.METADATA_SOURCE, JDProperties.METADATA_SOURCE_STORED_PROCEDURE); //@mdsp - } //@mdsp - - //@P0D requestPending_ = new BitSet(INITIAL_STATEMENT_TABLE_SIZE_); // @DAC - statements_ = new Vector(INITIAL_STATEMENT_TABLE_SIZE_); // @DAC - if(!TESTING_THREAD_SAFETY && as400_.getVRM() <= JDUtilities.vrm520) //@KBA //if V5R2 or less use old support of issuing set transaction statements - newAutoCommitSupport_ = 0; //@KBA - else if(!properties_.getBoolean(JDProperties.TRUE_AUTO_COMMIT)) //@KBA //@true //run autocommit with *NONE isolation level - newAutoCommitSupport_ = 1; //@KBA - else //@KBA - newAutoCommitSupport_ = 2; //@KBA //run autocommit with specified isolation level - - - if (as400_.getVRM() >= JDUtilities.vrm710) { - doUpdateDeleteBlocking_ = properties_.getBoolean(JDProperties.DO_UPDATE_DELETE_BLOCKING); //@A2A - } - - maximumBlockedInputRows_ = properties_.getInt(JDProperties.MAXIMUM_BLOCKED_INPUT_ROWS); // @A6A - if ( maximumBlockedInputRows_ > 32000 ) maximumBlockedInputRows_ = 32000; // @A6A - if ( maximumBlockedInputRows_ < 1 ) maximumBlockedInputRows_ = 1; // @A6A - - // Issue any warnings. - if (dataSourceUrl_.isExtraPathSpecified ()) - postWarning (JDError.getSQLWarning (JDError.WARN_URL_EXTRA_IGNORED)); - if (dataSourceUrl_.isPortSpecified ()) - postWarning (JDError.getSQLWarning (JDError.WARN_URL_EXTRA_IGNORED)); - if (properties.isExtraPropertySpecified ()) - postWarning (JDError.getSQLWarning (JDError.WARN_PROPERTY_EXTRA_IGNORED)); - - // Initialize the library list. - String urlSchema = dataSourceUrl_.getSchema (); - if (urlSchema == null) - JDError.throwSQLException (this, JDError.WARN_URL_SCHEMA_INVALID); - - JDLibraryList libraryList = new JDLibraryList ( - properties_.getString (JDProperties.LIBRARIES), urlSchema, - properties_.getString (JDProperties.NAMING)); // @B2C - defaultSchema_ = libraryList.getDefaultSchema (); - - // The connection gets an id automatically, but never - // creates an RPB on the system. There should never be a need - // to create an RPB on the system for a connection, but an - // id is needed for retrieving Operational Result Sets (ORS) - // for errors, etc. - - // Initialize a transaction manager for this connection. - transactionManager_ = new JDTransactionManager (this, id_, - properties_.getString (JDProperties.TRANSACTION_ISOLATION), - properties_.getBoolean (JDProperties.AUTO_COMMIT)); //@AC1 - - transactionManager_.setHoldIndicator(properties_.getString(JDProperties.CURSOR_HOLD)); // @D9 - - // If the hold properties are specified, make sure they are set locally - if (properties_.getString(JDProperties.CURSOR_HOLD) != null) { - if (transactionManager_.getHoldIndicator() == JDTransactionManager.CURSOR_HOLD_TRUE) - holdability_ = AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT; - else if (transactionManager_.getHoldIndicator() == JDTransactionManager.CURSOR_HOLD_FALSE) - holdability_ = AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT; - } - - // Initialize the read-only mode to true if the access - // property says read only. - readOnly_ = (properties_.equals (JDProperties.ACCESS, - JDProperties.ACCESS_READ_ONLY)); - - - // Determine the amount of system tracing that should be started. Trace - // can be started by either a JDBC property or the ServerTrace class. Our value - // will be the combination of the two (instead of one overriding the other). - traceServer_ = properties_.getInt(JDProperties.TRACE_SERVER) | - ServerTrace.getJDBCServerTraceCategories(); // @j1a //@SSa logical OR - - // Determine if a QAQQINI library name was specified. The library can be set using //@K2A - // a JDBC property. //@k2A - qaqqiniLibrary_ = properties_.getString(JDProperties.QAQQINILIB); //@K2A - - //@A3D - // Initialize the conversation. - //open (); - - //@A3A - // Connect. - if (JDTrace.isTraceOn()) // @F6a - { // @F6a - JDTrace.logInformation("Toolbox for Java - " + Copyright.version); // @F6a - JDTrace.logInformation("JDBC Level: " + JDUtilities.JDBCLevel_); // @F6a - } // @F6a - - if (!TESTING_THREAD_SAFETY) // in certain testing modes, we don't contact IBM i system - { - try - { - server_ = as400_.getConnection (AS400.DATABASE, newServer); - } - catch (AS400SecurityException e) - { - JDError.throwSQLException (this, JDError.EXC_CONNECTION_REJECTED, e); - } - catch (IOException e) - { - JDError.throwSQLException (this, JDError.EXC_CONNECTION_UNABLE, e); - } - } - - // Initialize the catalog name at this point to be the system - // name. After we exchange attributes, we can change it to - // the actual name. - catalog_ = dataSourceUrl.getServerName(); // @D7A - if (catalog_.length() == 0) // @D7A - catalog_ = as400_.getSystemName ().toUpperCase (); // @A3A - - setServerAttributes (); - libraryList.addOnServer (this, id_); - - // @E7D // Initialize a transaction manager for this connection. Turn on @E7A - // @E7D // new auto-commit support when the server functional level is @E7A - // @E7D // greater than or equal to 3. @E7A - // @E7D boolean newAutoCommitSupport = (serverFunctionalLevel_ >= 3); // @E7A - // @E7D transactionManager_.setNewAutoCommitSupport(newAutoCommitSupport); // @E7A - - // We keep a metadata object around for quick access. - // The metadata object should share the id of the - // connection, since it operates on a connection-wide - // scope. - metaData_ = new AS400JDBCDatabaseMetaData (this, id_); - - // The conversation was initialized to a certain - // transaction isolation. It is now time to turn on auto- - // commit by default. - if(newAutoCommitSupport_ == 0) //KBA V5R2 or less so do what we always have - transactionManager_.setAutoCommit (true); - - // Initialize the package manager. - packageManager_ = new JDPackageManager (this, id_, properties_, - transactionManager_.getCommitMode ()); - - // Trace messages. - if (JDTrace.isTraceOn()) - { - JDTrace.logOpen (this, null); // @J33a - JDTrace.logProperty (this, "Auto commit", transactionManager_.getAutoCommit ()); - JDTrace.logProperty (this, "Read only", readOnly_); - JDTrace.logProperty (this, "Transaction isolation", transactionManager_.getIsolation ()); - if (packageManager_.isEnabled ()) - JDTrace.logInformation (this, "SQL package = " - + packageManager_.getLibraryName() + "/" - + packageManager_.getName ()); - } - - - // @j1a Trace the server job if the user asked us to. Tracing - // can be turned on via a URL property, the Trace class, the DataSource - // object, or a system property. - if (traceServer_ > 0) - { - // Get the server job id. We will both dump this to the trace - // and use it to uniquely label some of the files. - String serverJobIdentifier = getServerJobIdentifier(); - String serverJobId = serverJobIdentifier.substring(20).trim() + "/" + - serverJobIdentifier.substring(10, 19).trim() + "/" + - serverJobIdentifier.substring( 0, 10).trim(); - - // Dump the server job id - JDTrace.logDataEvenIfTracingIsOff(this, Copyright.version); - JDTrace.logDataEvenIfTracingIsOff(this, serverJobId); - JDTrace.logDataEvenIfTracingIsOff(this, "Server functional level: " + getServerFunctionalLevel()); // @E7A - - - // Determine system level. Some commands are slightly different - // to v5r1 machines. - boolean preV5R1 = true; - boolean SQLNaming = properties_.getString(JDProperties.NAMING).equals(JDProperties.NAMING_SQL); - try - { - preV5R1 = getVRM() <= JDUtilities.vrm450; - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to start server job tracing failed, could not get server VRM"); - } - - // Start client tracing if the flag is on and trace isn't already running - if (((traceServer_ & ServerTrace.JDBC_TRACE_CLIENT) > 0) && (! JDTrace.isTraceOn())) - JDTrace.setTraceOn(true); - - // No matter what type of tracing is turned on, alter the server - // job so more stuff is saved in the job log. - try - { - JDUtilities.runCommand(this, "QSYS/CHGJOB LOG(4 00 *SECLVL) LOGCLPGM(*YES)", SQLNaming); - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to start server job tracing failed, could not change log level"); - } - - // Optionally start debug on the database server job - if ((traceServer_ & ServerTrace.JDBC_DEBUG_SERVER_JOB) > 0) - { - try - { - JDUtilities.runCommand(this, "QSYS/STRDBG UPDPROD(*YES)", SQLNaming); - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to start server job tracing failed, could not start debug on server job "); - } - } - - // Optionally start the database monitor - if ((traceServer_ & ServerTrace.JDBC_START_DATABASE_MONITOR) > 0) - { - try - { - JDUtilities.runCommand(this, "QSYS/STRDBMON OUTFILE(QUSRSYS/QJT" + - serverJobIdentifier.substring(20) + - ") JOB(*) TYPE(*DETAIL)", SQLNaming ); - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to start server job tracing failed, could not start database monitor"); - } - } - - boolean traceServerJob = ((traceServer_ & ServerTrace.JDBC_TRACE_SERVER_JOB) > 0); //@540 - //@540 Database Host Server Trace is supported on V5R3 and later systems - boolean traceDatabaseHostServer = ((getVRM() >= JDUtilities.vrm530) && ((traceServer_ & ServerTrace.JDBC_TRACE_DATABASE_HOST_SERVER) > 0)); //@540 - // Optionally start trace on the database server job or database host server - //@540D if ((traceServer_ & ServerTrace.JDBC_TRACE_SERVER_JOB) > 0) - if(traceServerJob || traceDatabaseHostServer) //@540 - { - try - { - if (preV5R1 && traceServerJob) //@540 added check for traceServerJob - JDUtilities.runCommand(this, "QSYS/TRCJOB MAXSTG(16000)", SQLNaming); - else{ - if(!traceDatabaseHostServer){ //@540 trace only server job - JDUtilities.runCommand(this, "QSYS/STRTRC SSNID(QJT" + - serverJobIdentifier.substring(20) + - ") JOB(*) MAXSTG(128000)", SQLNaming); - } - else if(!traceServerJob){ //@540 trace only database host server - if(getVRM() == JDUtilities.vrm530){ //@540 run command for V5R3 - JDUtilities.runCommand(this, "QSYS/STRTRC SSNID(QJT" + //@540 - serverJobIdentifier.substring(20) + //@540 - ") JOB(*) MAXSTG(128000) JOBTRCTYPE(*TRCTYPE) " + //@540 - "TRCTYPE((TESTA *INFO))", SQLNaming); //@540 - } - else{ //@540 run command for V5R4 and higher - JDUtilities.runCommand(this, "QSYS/STRTRC SSNID(QJT" + //@540 - serverJobIdentifier.substring(20) + //@540 - ") JOB(*) MAXSTG(128000) JOBTRCTYPE(*TRCTYPE) " + //@540 - "TRCTYPE((*DBHSVR *INFO))", SQLNaming); //@540 - } - } //@540 - else{ //@540 start both server job and database host server trace - if(getVRM() == JDUtilities.vrm530){ //@540 run command for V5R3 - JDUtilities.runCommand(this, "QSYS/STRTRC SSNID(QJT" + //@540 - serverJobIdentifier.substring(20) + //@540 - ") JOB(*) MAXSTG(128000) JOBTRCTYPE(*ALL) " + //@540 - "TRCTYPE((TESTA *INFO))", SQLNaming); //@540 - } - else{ //@540 run V5R4 and higher command - JDUtilities.runCommand(this, "QSYS/STRTRC SSNID(QJT" + //@540 - serverJobIdentifier.substring(20) + //@540 - ") JOB(*) MAXSTG(128000) JOBTRCTYPE(*ALL) " + //@540 - "TRCTYPE((*DBHSVR *INFO))", SQLNaming); //@540 - } - } - } - } - catch (Exception e) - { - if(traceServerJob && !traceDatabaseHostServer) //@540 - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to start server job tracing failed, could not trace server job"); - else if(traceDatabaseHostServer && !traceServerJob) //@540 - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to start database host server tracing failed, could not trace server job"); //@540 - else //@540 - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to start server job and database host server tracing failed, could not trace server job"); //@540 - } - } - } - - //@K2A Issue Change Query Attributes command if user specified QAQQINI library name - if(qaqqiniLibrary_.length() > 0 && !qaqqiniLibrary_.equals("null")) - { - boolean SQLNaming = properties_.getString(JDProperties.NAMING).equals(JDProperties.NAMING_SQL); - try - { - JDUtilities.runCommand(this, "CHGQRYA QRYOPTLIB(" + qaqqiniLibrary_ + ")", SQLNaming ); - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to issue Change Query Attributes command using QAQQINI Library name failed."); - } - } - } - - - - /** - Sets the read-only mode. This will provide read-only - access to the database. Read-only mode can be useful by - enabling certain database optimizations. If the caller - specified "read only" or "read call" for the "access" property, - then the read-only mode cannot be set to false. The read-only - mode cannot be changed while in the middle of a transaction. - -

This method can not be called when the connection is part - of a distributed transaction. See - AS400JDBCXAResource for more information. - - @exception SQLException If the connection is not open, - a transaction is active, or the - "access" property is set to "read - only". - **/ - public void setReadOnly (boolean readOnly) - throws SQLException - { - checkOpen (); - - if (transactionManager_.isLocalActive () || transactionManager_.isGlobalActive()) // @E4C - JDError.throwSQLException (this, JDError.EXC_TXN_STATE_INVALID); // @E4C - - if ((readOnly == false) - && ((properties_.getString (JDProperties.ACCESS).equalsIgnoreCase (JDProperties.ACCESS_READ_ONLY)) - || (properties_.getString (JDProperties.ACCESS).equalsIgnoreCase (JDProperties.ACCESS_READ_CALL)))) - JDError.throwSQLException (this, JDError.EXC_ACCESS_MISMATCH); - - readOnly_ = readOnly; - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Read only", readOnly_); - } - - - - - // @E10 new method - /** - * Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it. - *

    - *
  • Named savepoints must be unique. A savepoint name cannot be reused until the savepoint is released, committed, or rolled back. - *
  • Savepoints are valid only if autocommit is off. An exception is thrown if autocommit is enabled. - *
  • Savepoints are not valid across XA connections. An exception is thrown if the connection is an XA connection. - *
  • Savepoints require OS/400 V5R2 or IBM i. An exception is thrown if connecting to OS/400 V5R1 or earlier. - *
  • If the connection option is set to keep cursors open after a traditional rollback, cursors will remain open after a rollback to a savepoint. - *
- * - * @return The new Savepoint object. - * @exception SQLException if a database access error occurs or this Connection object is currently in auto-commit mode. - * @since Modification 5 - **/ - public Savepoint setSavepoint() - throws SQLException - { - return setSavepoint(null, AS400JDBCSavepoint.getNextId()); - } - - // @E10 new method - /** - * Creates a named savepoint in the current transaction and returns the new Savepoint object that represents it. - *
    - *
  • Named savepoints must be unique. A savepoint name cannot be reused until the savepoint is released, committed, or rolled back. - *
  • Savepoints are valid only if autocommit is off. An exception is thrown if autocommit is enabled. - *
  • Savepoints are not valid across XA connections. An exception is thrown if the connection is an XA connection. - *
  • Savepoints require OS/400 V5R2 or IBM i. An exception is thrown if connecting to OS/400 V5R1 or earlier. - *
  • If the connection option is set to keep cursors open after a traditional rollback, cursors will remain open after a rollback to a savepoint. - *
- * @param name A String containing the name of the savepoint - * @return The new Savepoint object. - * @exception SQLException if a database access error occurs or this Connection object is currently in auto-commit mode. - * @since Modification 5 - **/ - public Savepoint setSavepoint(String name) - throws SQLException - { - if (name == null) - throw new NullPointerException("name"); - - return setSavepoint(name, 0); - } - - // @E10 new method - private Savepoint setSavepoint(String name, int id) - throws SQLException - { - if (id > 0) - name = "T_JDBCINTERNAL_" + id; - - // When creating the savepoint specify retain cursors. That is the - // only option supported by the IBM i system at this time. We have to specify - // it because the SQL default is close cursors. Since we need to use - // an option other than the default we have to specify it on the statement. - // Plus, the system will return an error if we don't specify it. - processSavepointRequest("SAVEPOINT " + name + " ON ROLLBACK RETAIN CURSORS" ); - - return(Savepoint)(Object) new AS400JDBCSavepoint(name, id); - } - - - - - - - - /** - Sets the server attributes. - - @param libraryList The library list. - - @exception SQLException If an error occurs. - **/ - private void setServerAttributes () - throws SQLException - { - if (TESTING_THREAD_SAFETY) return; // in certain testing modes, don't contact IBM i system - DBReplyRequestedDS reply = null; - try - { - vrm_ = as400_.getVRM(); // @D0A @ECM - - //@P0C - DBSQLAttributesDS request = null; - int decimalSeparator, dateFormat, dateSeparator, timeFormat, timeSeparator; - DBReplyServerAttributes serverAttributes = null; - try - { - request = DBDSPool.getDBSQLAttributesDS (DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); //@P0C - - // We need to set a temporary CCSID just for this - // request, since we use this request to get the - // actual CCSID. - //@P0D ConverterImplRemote tempConverter = - //@P0D ConverterImplRemote.getConverter (as400_.getCcsid(), as400_); - ConvTable tempConverter = ConvTable.getTable(as400_.getCcsid(), null); //@P0A - - - // @E2D // Do not set the client CCSID. We do not want - // @E2D // the system to convert data, since we are going - // @E2D // to do all conersion on the client. By not telling - // @E2D // the system our CCSID, then we achieve this. - // @E2D // - // @E2D // Note that the database host server documentation - // @E2D // states that when we do this, the CCSID values - // @E2D // in data formats may be incorrect and that we - // @E2D // should always use the server job's CCSID. - - // Set the client CCSID to Unicode. // @E2A - - // @M0C - As of v5r3m0 we allow the client CCSID to be 1200 (UTF-16) which - // will cause our statement to flow in 1200 and our package to be 1200 - - //Bidi-HCG allow any ccsid or "system" to use ccsid of AS400 object - //Bidi-HCG start - String sendCCSID = properties_.getString(JDProperties.PACKAGE_CCSID); - - int sendCCSIDInt; - int hostCCSID; - if(this.getSystem() == null) //@pdcbidi - hostCCSID = 37; - else - hostCCSID = this.getSystem().getCcsid(); - int default_ccsid = Integer.parseInt(JDProperties.PACKAGE_CCSID_UCS2); - - if( sendCCSID.equalsIgnoreCase("system")) - sendCCSIDInt = hostCCSID; - else { - try{ - if((sendCCSIDInt = Integer.valueOf(sendCCSID).intValue()) <= 0) - sendCCSIDInt = default_ccsid; - if(vrm_ < JDUtilities.vrm530 && sendCCSIDInt == 1200) - sendCCSIDInt = default_ccsid; - } catch(Exception e) { - sendCCSIDInt = default_ccsid; - } - } - - packageCCSID_Converter = ConvTable.getTable(sendCCSIDInt, null); - properties_.setString(JDProperties.PACKAGE_CCSID, (new Integer(sendCCSIDInt)).toString()); - request.setClientCCSID(sendCCSIDInt); - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Client CCSID = " + sendCCSIDInt); - //Bidi-HCG end - - // This language feature code is used to tell the - // system what language to send error messages in. - // If that language is not installed on the system, - // we get messages back in the default language that - // was installed on the system. - // - String nlv = as400_.getNLV(); // @F1C - request.setLanguageFeatureCode(nlv); // @EDC - - if (JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "Setting server NLV = " + nlv); - - // Client functional level. - request.setClientFunctionalLevel(CLIENT_FUNCTIONAL_LEVEL_); // @EDC - - if (JDTrace.isTraceOn ()) // @EDC - JDTrace.logInformation (this, "Client functional level = " + CLIENT_FUNCTIONAL_LEVEL_); // @EDC - - // Sort sequence. - if (! properties_.equals (JDProperties.SORT, JDProperties.SORT_HEX)) //@pdc only send if not default (hex) - { - JDSortSequence sortSequence = new JDSortSequence ( - properties_.getString (JDProperties.SORT), - properties_.getString (JDProperties.SORT_LANGUAGE), - properties_.getString (JDProperties.SORT_TABLE), - properties_.getString (JDProperties.SORT_WEIGHT)); - request.setNLSSortSequence (sortSequence.getType (), - sortSequence.getTableFile (), - sortSequence.getTableLibrary (), - sortSequence.getLanguageId (), - tempConverter); - } - - request.setTranslateIndicator (0xF0); // @E2C - request.setDRDAPackageSize (1); - //Note: newAutoCommitSupport is trueAutoCommitSupport - if(!(newAutoCommitSupport_ == 0)) //@KBA V5R3 or greater so run with new support - { //@AC1 - if(properties_.getBoolean(JDProperties.AUTO_COMMIT)) //@AC1 - request.setAutoCommit(0xE8); //@KBA Turn on auto commit - else //@AC1 - request.setAutoCommit(0xD5); //@AC1 - } //@AC1 - - if((newAutoCommitSupport_ == 1) && (properties_.getBoolean(JDProperties.AUTO_COMMIT))) //@KBA //@AC1 (only set to *NONE if autocommit is on) - request.setCommitmentControlLevelParserOption(0); //@KBA Run under *NONE when in autocommit - else //@KBA Run under default isolation level - request.setCommitmentControlLevelParserOption (transactionManager_.getCommitMode ()); - - // Server attributes based on property values. - // These all match the index within the property's - // choices. - dateFormat = properties_.getIndex (JDProperties.DATE_FORMAT); - if (dateFormat != -1) - request.setDateFormatParserOption (dateFormat); - - dateSeparator = properties_.getIndex (JDProperties.DATE_SEPARATOR); - if (dateSeparator != -1) - request.setDateSeparatorParserOption (dateSeparator); - - timeFormat = properties_.getIndex (JDProperties.TIME_FORMAT); - if (timeFormat != -1) - request.setTimeFormatParserOption (timeFormat); - - timeSeparator = properties_.getIndex (JDProperties.TIME_SEPARATOR); - if (timeSeparator != -1) - request.setTimeSeparatorParserOption (timeSeparator); - - decimalSeparator = properties_.getIndex (JDProperties.DECIMAL_SEPARATOR); - if (decimalSeparator != -1) - request.setDecimalSeparatorParserOption (decimalSeparator); - - request.setNamingConventionParserOption (properties_.getIndex (JDProperties.NAMING)); - - // Do not set the ignore decimal data error parser option. - - // If the system supports RLE data compression, then use it. @ECA - // Otherwise, use the old-style data compression. @ECA - if (properties_.getBoolean(JDProperties.DATA_COMPRESSION)) - { // @ECA - if (vrm_ >= JDUtilities.vrm510) - { // @ECA - dataCompression_ = DATA_COMPRESSION_RLE_; // @ECA - request.setDataCompressionOption(0); // @ECA - if (JDTrace.isTraceOn ()) // @ECA - JDTrace.logInformation (this, "Data compression = RLE"); // @ECA - } // @ECA - else - { // @ECA - dataCompression_ = DATA_COMPRESSION_OLD_; // @ECA - request.setDataCompressionOption(1); // @D3A @ECC - if (JDTrace.isTraceOn ()) // @ECA - JDTrace.logInformation (this, "Data compression = old"); // @ECA - } // @ECA - } // @ECA - else - { // @ECA - dataCompression_ = DATA_COMPRESSION_NONE_; // @ECA - request.setDataCompressionOption(0); // @ECA - if (JDTrace.isTraceOn ()) // @ECA - JDTrace.logInformation (this, "Data compression = none"); // @ECA - } // @ECA - - // Default SQL schema. - if (defaultSchema_ != null) - request.setDefaultSQLLibraryName (defaultSchema_, tempConverter); - - // There is no need to tell the system what our code - // page is, nor is there any reason to get a translation - // table back from the system at this point. This - // will be handled later by the Converter class. - - // I haven't found a good reason to set the ambiguous select - // option. ODBC sets it only when block criteria is "unless - // FOR UPDATE OF", but it causes some problems for JDBC. - // The difference is that ODBC has the luxury of setting cursor - // concurrency. - - request.setPackageAddStatementAllowed (properties_.getBoolean (JDProperties.PACKAGE_ADD) ? 1 : 0); - - // If the system is at V4R4 or later, then set some more attributes. - if (vrm_ >= JDUtilities.vrm440) - { // @D0C @E9C - // @E9D || (FORCE_EXTENDED_FORMATS_)) { - - if(vrm_ >= JDUtilities.vrm540) //@540 use new Super Extended Formats - request.setUseExtendedFormatsIndicator(0xF2); //@540 - else //@540 - request.setUseExtendedFormatsIndicator (0xF1); - - // Although we publish a max lob threshold of 16777216, @E6A - // the system can only handle 15728640. We do it this @E6A - // way to match ODBC. @E6A - int lobThreshold = properties_.getInt (JDProperties.LOB_THRESHOLD); // @E6A - if (lobThreshold <= 0) // @E6A - request.setLOBFieldThreshold(0); // @E6A - else if (lobThreshold >= 15728640) // @E6A - request.setLOBFieldThreshold(15728640); // @E6A - else // @E6A - request.setLOBFieldThreshold(lobThreshold); // @E6C - - extendedFormats_ = true; - } - - // Set the default select statement type to be read-only (OS/400 v5r1 - // and earlier the default was updatable). If the app requests updatable - // statements we will now specify "updatable" on the RPB. Do this - // only to V5R1 systems with the needed PTF, and V5R2 and later systems - // because they have the fix needed to support - // altering the cursor type in the RPB. (AmbiguousSelectOption(1) - // means read-only) - if (vrm_ >= JDUtilities.vrm520) // @J3a - { // @J3a - request.setAmbiguousSelectOption(1); // @J3a - mustSpecifyForUpdate_ = false; // @J31a - - if(vrm_ >= JDUtilities.vrm710){ //@710 //@128sch - //@710 - Client support information - indicate our support for ROWID data type, true autocommit - // and 128 byte column names and 128 length schemas - request.setClientSupportInformation(0xF0000000); - if(JDTrace.isTraceOn()){ - JDTrace.logInformation(this, "ROWID supported = true"); - JDTrace.logInformation(this, "True auto-commit supported = true"); - JDTrace.logInformation(this, "128 byte column names supported = true"); - JDTrace.logInformation(this, "128 length schema names supported = true"); - } - - } - else if(vrm_ >= JDUtilities.vrm540){ //@540 for IBM i V5R4 and later, 128 byte column names are supported - //@540 - Client support information - indicate our support for ROWID data type, true autocommit - // and 128 byte column names - request.setClientSupportInformation(0xE0000000); - if(JDTrace.isTraceOn()){ - JDTrace.logInformation(this, "ROWID supported = true"); - JDTrace.logInformation(this, "True auto-commit supported = true"); - JDTrace.logInformation(this, "128 byte column names supported = true"); - } - - } - else if (vrm_ >= JDUtilities.vrm530) //@KBA For IBM i V5R3 and later true auto commit support is supported. - { - // @KBA - Client support information - indicate our support for ROWID data type and - // true auto-commit - request.setClientSupportInformation(0xC0000000); //@KBC - if(JDTrace.isTraceOn()) //@KBA - { //@KBA - JDTrace.logInformation(this, "ROWID supported = true"); //@KBA - JDTrace.logInformation(this, "True auto-commit supported = true"); //@KBA - } //@KBA - } //@KBA - else //@KBA - { //@KBA - // @M0A - Client support information - indicate our support for ROWID data type - request.setClientSupportInformation(0x80000000); - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "ROWID supported = true"); - } //@KBA - } - - // @M0A - added support for 63 digit decimal precision - if(vrm_ >= JDUtilities.vrm530) - { - int maximumPrecision = properties_.getInt(JDProperties.MAXIMUM_PRECISION); - int maximumScale = properties_.getInt(JDProperties.MAXIMUM_SCALE); - int minimumDivideScale = properties_.getInt(JDProperties.MINIMUM_DIVIDE_SCALE); - - // make sure that if scale is >31 we set precision to 63 - // this is a requirement of host server to avoid a PWS0009 - if(maximumScale > 31) - maximumPrecision = 63; - - request.setDecimalPrecisionIndicators(maximumPrecision, maximumScale, minimumDivideScale); - - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "Maximum decimal precision = " + maximumPrecision); - JDTrace.logInformation(this, "Maximum decimal scale = " + maximumScale); - JDTrace.logInformation(this, "Minimum divide scale = " + minimumDivideScale); - } - - // @M0A - added support of hex constant parser option - int parserOption = properties_.getIndex(JDProperties.TRANSLATE_HEX); - if(parserOption != -1) - { - request.setHexConstantParserOption(parserOption); - if(JDTrace.isTraceOn()) - { - String msg = (parserOption == 0) ? "Translate hex = character" : "Translate hex = binary"; - JDTrace.logInformation(this, msg); - } - } - - //@KBL - added support for hold/not hold locators - // Specifies whether input locators should be allocated as type hold locators or not hold locators. - // If the locators are of type hold, they will not be released when a commit is done. - boolean holdLocators = properties_.getBoolean(JDProperties.HOLD_LOCATORS); - if(!holdLocators) // Only need to set it if it is false, by default host server sets them to hold. - { - request.setInputLocatorType(0xD5); - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Hold Locators = " + holdLocators); - } - - //@KBL - added support for locator persistance. The JDBC specification says locators should be - // scoped to the transaction (ie. commit, rollback, or connection.close()) if auto commit is off - // host server added two options for the optional Locator Persistence ('3830'x') connection attribute: - // 0 -- Locators without the hold property are freed when cursor closed (locators scoped to the cursor). - // 1 -- Locators without the hold property are freed when the transaction is completed (locators scoped to the transaction). - // - // By default this is set to 0 by the host server, but to comply with the JDBC specification, - // we should always set it to 1. - // Note: this only applies when auto commit is off. The property has no effect if auto commit is on. - // Locators are always scoped to the cursor when auto-commit is on. - request.setLocatorPersistence(1); - } - - //@540 - if(vrm_ >= JDUtilities.vrm540){ - - //Set the query optimization goal - // 0 = Optimize query for first block of data (*ALLIO) when extended dynamic packages are used; Optimize query for entire result set (*FIRSTIO) when packages are not used (default) //@PDC update comment to reflect host server default - // 1 = Optimize query for first block of data (*FIRSTIO) - // 2 = Optimize query for entire result set (*ALLIO) - int queryOptimizeGoal = properties_.getInt (JDProperties.QUERY_OPTIMIZE_GOAL); - if(queryOptimizeGoal != 0){ // Only need to send if we are not using the default - if(queryOptimizeGoal == 1) - request.setQueryOptimizeGoal(0xC6); - else if(queryOptimizeGoal == 2) - request.setQueryOptimizeGoal(0xC1); - } - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "query optimize goal = " + queryOptimizeGoal); - } - - //@550 Query Storage Limit Support - if(vrm_ >= JDUtilities.vrm610){ - //Set the query storage limit - int queryStorageLimit = properties_.getInt(JDProperties.QUERY_STORAGE_LIMIT); - if(queryStorageLimit != -1) // Only need to send if we are not using the default of *NOMAX (-1) - { - if(queryStorageLimit < -1) - request.setQueryStorageLimit(-1); - else if(queryStorageLimit > AS400JDBCDataSource.MAX_STORAGE_LIMIT) // if larger than the max just set to max - request.setQueryStorageLimit(2147352578); - else - request.setQueryStorageLimit(queryStorageLimit); - } - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "query storage limit = " + queryStorageLimit); - } - - if (JDTrace.isTraceOn ()) - { - if (extendedFormats_) - JDTrace.logInformation (this, "Using extended datastreams"); - else - JDTrace.logInformation (this, "Using original datastreams"); - } - - // Send an RDB name to the system only if connecting to - // v5r2 and newer versions of IBM i - if (vrm_ >= JDUtilities.vrm520) // @J2a - { - // @J2a - StringBuffer RDBName = new StringBuffer(properties_.getString (JDProperties.DATABASE_NAME)); // @J2a - if (RDBName.length() > 0) // @J2a - { - // @J2a - RDBName.append(" "); // @J2a - RDBName.setLength(18); // @J2a - request.setRDBName(RDBName.toString().toUpperCase(), tempConverter); // @J2a - if (JDTrace.isTraceOn ()) // @J2a - JDTrace.logInformation (this, "RDB Name = -->" + RDBName + "<--"); // @J2a - } // @J2a - } // @J2a - - //@PDA 550 client interface info settings - //These three settings cannot be updated by user apps. - //This gives driver information to host server for any logging or future diagnostics. - if (vrm_ >= JDUtilities.vrm610) - { - //these strings are not mri translated for future diagnostic tools, searching etc on host server - request.setInterfaceType( "JDBC", tempConverter); - request.setInterfaceName( "IBM Toolbox for Java", tempConverter); - request.setInterfaceLevel( AS400JDBCDriver.DRIVER_LEVEL_, tempConverter); - - //@DFA 550 decfloat rounding mode - short roundingMode = 0; //@DFA - String roundingModeStr = properties_.getString(JDProperties.DECFLOAT_ROUNDING_MODE); //@DFA - if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_EVEN)) //@DFA - roundingMode = 0; //@DFA - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_UP)) //@DFA - roundingMode = 6; //@DFA - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_DOWN)) //@DFA - roundingMode = 2; //@DFA - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_CEILING)) //@DFA - roundingMode = 3; //@DFA - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_FLOOR)) //@DFA - roundingMode = 4; //@DFA - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_UP)) //@DFA - roundingMode = 1; //@DFA - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_DOWN)) //@DFA - roundingMode = 5; //@DFA - - //only need to send request if not default 0 (half even) - if(roundingMode != 0) //@DFA - request.setDecfloatRoundingMode(roundingMode); //@DFA - - //@eof Close on EOF - request.setCloseEOF( 0xE8) ; - - } - - //@710 - if (vrm_ >= JDUtilities.vrm710) - { - int car = properties_.getInt(JDProperties.CONCURRENT_ACCESS_RESOLUTION); //@cc1 - if( !(properties_.getString(JDProperties.CONCURRENT_ACCESS_RESOLUTION)).equals( JDProperties.CONCURRENTACCESS_NOT_SET )) //@cc1 - { //@cc1 - request.setConcurrentAccessResolution( car ); //@cc1 - //Use instance variable to to "current setting". - //This will allow the Connection setting to override DataSource - //setting for future updates to this property from the Connection object. //@cc1 - concurrentAccessResolution_ = car; //@cc1 - } //@cc1 - } - - // Send the request and process the reply. - reply = sendAndReceive (request); - - int errorClass = reply.getErrorClass(); - int returnCode = reply.getReturnCode(); - - // Sort sequence attribute cannot be set. - if ((errorClass == 7) - && ((returnCode == 301) || (returnCode == 303))) - postWarning (JDError.getSQLWarning (this, id_, errorClass, returnCode)); - - // Language feature code id was not changed. This is caused - // when the secondary language can not be added to the library - // list, and shows up as a PWS0003. - else if ((errorClass == 7) && (returnCode == 304)) - postWarning (JDError.getSQLWarning (this, id_, errorClass, returnCode)); - - // -704 is RDB (IASP) does not exist. We do not go back to the system to get - // error info since they are sending an invalid attribute exception when the - // IASP is not found. We can create a better error than that. - else if ((errorClass == 7) && (returnCode == -704)) // @J2a - { // @J2a - try // @J2a - { // @J2a - close(); // @J2a - } // @J2a - catch (Exception e) {} // eat errors on close // @J2a - JDError.throwSQLException(this, JDError.EXC_RDB_DOES_NOT_EXIST); // @J2a - } // @J2a - - // Other system errors. - else if (errorClass != 0) - JDError.throwSQLException (this, this, id_, errorClass, returnCode); - - // Process the returned server attributes. - serverAttributes = reply.getServerAttributes (); - } - finally - { - if (request != null) { - request.returnToPool(); request = null; - } - // We cannot return the reply to the pool while it is still being used in the serverAttributes structure - // if (reply != null) reply.returnToPool(); - } - - // The CCSID that comes back is a mixed CCSID (i.e. mixed - // SBCS and DBCS). This will be the CCSID that all - // non-graphic data will be returned as for this - // connection, so we own the converter here. - int serverCCSID = serverAttributes.getServerCCSID(); - //@P0D converter_ = ConverterImplRemote.getConverter (serverCCSID, as400_); - converter_ = ConvTable.getTable(serverCCSID, null); //@P0A - - // Get the server functional level. It comes back as in the @E7A - // format VxRxMx9999. @E7A - String serverFunctionalLevelAsString = serverAttributes.getServerFunctionalLevel(converter_); // @E7A - try - { // @E7A - serverFunctionalLevel_ = Integer.parseInt(serverFunctionalLevelAsString.substring(6)); // @E7A - } // @E7A - catch (NumberFormatException e) - { // @E7A - serverFunctionalLevel_ = 0; // @E7A - } // @E7A - - // Get the job number, but only if . @E8A - if (serverFunctionalLevel_ >= 5) // @E8A - serverJobIdentifier_ = serverAttributes.getServerJobIdentifier(converter_); // @E8A - - // User no longer needs to specify "for update" on their SQL - // statements if running to v5r1 with a PTF. (V5R2 and later - // is handled in another piece of code) - if ((vrm_ == JDUtilities.vrm510) && //@J31a - ( serverFunctionalLevel_ >= 10)) //@J31a - mustSpecifyForUpdate_ = false; //@J31a - - if (JDTrace.isTraceOn ()) - { // @C2C - int v = (vrm_ & 0xffff0000) >>> 16; // @D1A - int r = (vrm_ & 0x0000ff00) >>> 8; // @D1A - int m = (vrm_ & 0x000000ff); // @D1A - JDTrace.logInformation (this, "JDBC driver major version = " // @C2A - + AS400JDBCDriver.MAJOR_VERSION_); // @C2A - //Check version - V5R2 and earlier run on OS/400, V5R3 and later run on IBM i - if(((v==5) && (r>=3)) || (v>5)) - JDTrace.logInformation(this, "IBM i VRM = V" + v - + "R" + r + "M" + m); - else - JDTrace.logInformation (this, "OS/400 VRM = V" + v // @C2A - + "R" + r + "M" + m); // @C2A - JDTrace.logInformation (this, "Server CCSID = " + serverCCSID); - JDTrace.logInformation(this, "Server functional level = " // @E7A - + serverFunctionalLevelAsString // @E7A - + " (" + serverFunctionalLevel_ + ")"); // @E7A - - StringBuffer buffer = new StringBuffer(); // @E8A - if (serverJobIdentifier_ == null) // @E8A - buffer.append("Not available"); // @E8A - else - { // @E8A - buffer.append(serverJobIdentifier_.substring(20, 26).trim()); // job number // @E8A - buffer.append('/'); // @E8A - buffer.append(serverJobIdentifier_.substring(10, 20).trim()); // user name // @E8A - buffer.append('/'); // @E8A - buffer.append(serverJobIdentifier_.substring(0, 10).trim()); // job name // @E8A - } // @E8A - JDTrace.logInformation(this, "Server job identifier = " + buffer); // @E8A - } // @C2A - - // @E2D // Wait to load graphic converter until it is needed. - // @E2D graphicConverter_ = null; - // @E2D graphicConverterLoaded_ = false; - - // Get the catalog name from the RDB entry. If no RDB entry is - // set on the system, then use the system name from the AS400 object - // (which originally came from the URL). - String rdbEntry = serverAttributes.getRelationalDBName (converter_).trim(); - if ((rdbEntry.length() > 0) && (! rdbEntry.equalsIgnoreCase ("*N"))) - catalog_ = rdbEntry; - - // In the cases where defaults come from the server - // job, get the defaults for properties that were not set. - if (decimalSeparator == -1) - { - switch (serverAttributes.getDecimalSeparatorPO ()) - { - case 0: - properties_.setString (JDProperties.DECIMAL_SEPARATOR, JDProperties.DECIMAL_SEPARATOR_PERIOD); - break; - case 1: - properties_.setString (JDProperties.DECIMAL_SEPARATOR, JDProperties.DECIMAL_SEPARATOR_COMMA); - break; - } - } - - if (dateFormat == -1) - { - switch (serverAttributes.getDateFormatPO ()) - { - case 0: - properties_.setString (JDProperties.DATE_FORMAT, JDProperties.DATE_FORMAT_JULIAN); - break; - case 1: - properties_.setString (JDProperties.DATE_FORMAT, JDProperties.DATE_FORMAT_MDY); - break; - case 2: - properties_.setString (JDProperties.DATE_FORMAT, JDProperties.DATE_FORMAT_DMY); - break; - case 3: - properties_.setString (JDProperties.DATE_FORMAT, JDProperties.DATE_FORMAT_YMD); - break; - case 4: - properties_.setString (JDProperties.DATE_FORMAT, JDProperties.DATE_FORMAT_USA); - break; - case 5: - properties_.setString (JDProperties.DATE_FORMAT, JDProperties.DATE_FORMAT_ISO); - break; - case 6: - properties_.setString (JDProperties.DATE_FORMAT, JDProperties.DATE_FORMAT_EUR); - break; - case 7: - properties_.setString (JDProperties.DATE_FORMAT, JDProperties.DATE_FORMAT_JIS); - break; - } - } - - if (dateSeparator == -1) - { - switch (serverAttributes.getDateSeparatorPO ()) - { - case 0: - properties_.setString (JDProperties.DATE_SEPARATOR, JDProperties.DATE_SEPARATOR_SLASH); - break; - case 1: - properties_.setString (JDProperties.DATE_SEPARATOR, JDProperties.DATE_SEPARATOR_DASH); - break; - case 2: - properties_.setString (JDProperties.DATE_SEPARATOR, JDProperties.DATE_SEPARATOR_PERIOD); - break; - case 3: - properties_.setString (JDProperties.DATE_SEPARATOR, JDProperties.DATE_SEPARATOR_COMMA); - break; - case 4: - properties_.setString (JDProperties.DATE_SEPARATOR, JDProperties.DATE_SEPARATOR_SPACE); - break; - } - } - - if (timeFormat == -1) - { - switch (serverAttributes.getTimeFormatPO ()) - { - case 0: - properties_.setString (JDProperties.TIME_FORMAT, JDProperties.TIME_FORMAT_HMS); - break; - case 1: - properties_.setString (JDProperties.TIME_FORMAT, JDProperties.TIME_FORMAT_USA); - break; - case 2: - properties_.setString (JDProperties.TIME_FORMAT, JDProperties.TIME_FORMAT_ISO); - break; - case 3: - properties_.setString (JDProperties.TIME_FORMAT, JDProperties.TIME_FORMAT_EUR); - break; - case 4: - properties_.setString (JDProperties.TIME_FORMAT, JDProperties.TIME_FORMAT_JIS); - break; - } - } - - if (timeSeparator == -1) - { - switch (serverAttributes.getTimeSeparatorPO ()) - { - case 0: - properties_.setString (JDProperties.TIME_SEPARATOR, JDProperties.TIME_SEPARATOR_COLON); - break; - case 1: - properties_.setString (JDProperties.TIME_SEPARATOR, JDProperties.TIME_SEPARATOR_PERIOD); - break; - case 2: - properties_.setString (JDProperties.TIME_SEPARATOR, JDProperties.TIME_SEPARATOR_COMMA); - break; - case 3: - properties_.setString (JDProperties.TIME_SEPARATOR, JDProperties.TIME_SEPARATOR_SPACE); - break; - } - } - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - // @J5D catch (IOException e) { - catch (UnsupportedEncodingException e) - { // @J5C - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - finally - { - // Don't return the reply to the pool until the very end, - // as it is used by the DBReplyServerAttributes object - if (reply != null) { reply.returnToPool(); reply = null; } - } - } - - - - //@A3A - // Implementation note: Don't use this object internally because we could be running in a proxy environment - // The purpose of this method is to simply hold the full AS400 object so it can be retrieved from the Connection - void setSystem (AS400 as400) - throws SQLException // @EGA - { - as400PublicClassObj_ = as400; - } - - - - // @D2C - /** - Sets the transaction isolation level. The transaction - isolation level cannot be changed while in the middle of - a transaction. - -

JDBC and DB2 for IBM i use different terminology for transaction - isolation levels. The following table provides a terminology - mapping: - -

- - - - - -
IBM i isolation levelJDBC transaction isolation level
*CHG TRANSACTION_READ_UNCOMMITTED
*CS TRANSACTION_READ_COMMITTED
*ALL TRANSACTION_READ_REPEATABLE_READ
*RR TRANSACTION_SERIALIZABLE
- - @param level The transaction isolation level. Possible - values are: -

    -
  • TRANSACTION_READ_UNCOMMITTED -
  • TRANSACTION_READ_COMMITTED -
  • TRANSACTION_REPEATABLE_READ -
  • TRANSACTION_SERIALIZABLE -
- - @exception SQLException If the connection is not open, - the input level is not valid - or unsupported, or a transaction - is active. - **/ - public void setTransactionIsolation (int level) - throws SQLException - { - checkOpen (); - - transactionManager_.setIsolation (level); - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Transaction isolation", transactionManager_.getIsolation ()); - } - - - - // JDBC 2.0 - /** - Sets the type map to be used for distinct and structured - types. - -

Note: Distinct types are supported by DB2 for IBM i, but - are not externalized by the IBM Toolbox for Java JDBC driver. - In other words, distinct types behave as if they are the underlying - type. Structured types are not supported by DB2 for IBM i. - Consequently, this driver does not support the type map. - - @param typeMap The type map. - - @exception SQLException This exception is always thrown. - **/ - public void setTypeMap (Map typeMap) - throws SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - - - /** - Returns the connection's catalog name. This is the - name of the IBM i system. - - @return The catalog name. - **/ - public String toString () - { - return catalog_; - } - - - - /** - Indicates if the connection is using extended formats. - - @return true if the connection is using extended formats, false - otherwise. - **/ - boolean useExtendedFormats () - throws SQLException // @EGA - { - return extendedFormats_; - } - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCConnection", "java.sql.Connection" }; - } - - - - //@PDA jdbc40 - /** - * Returns true if the connection has not been closed and is still valid. - * The driver shall submit a query on the connection or use some other - * mechanism that positively verifies the connection is still valid when - * this method is called. - *

- * The query submitted by the driver to validate the connection shall be - * executed in the context of the current transaction. - * - * @param timeout - The time in seconds to wait for the database operation - * used to validate the connection to complete. If - * the timeout period expires before the operation - * completes, this method returns false. A value of - * 0 indicates a timeout is not applied to the - * database operation. Note that currently the timeout - * value is not used. - *

- * @return true if the connection is valid, false otherwise - * @exception SQLException if a database access error occurs. - */ -/* ifdef JDBC40 */ - public boolean isValid(int timeout) throws SQLException - { - DBSQLRequestDS request = null; - DBReplyRequestedDS reply = null; - int errorClass = 0; - int returnCode = 0; - ReentrantLock lock = new ReentrantLock(); - - try - { - // inner class to run timer in sep thread - class CommTimer implements Runnable - { - - Thread otherThread; - ReentrantLock lock; - int timeout; - - public void run() - { - try - { - Thread.sleep(timeout * 1000); - lock.lockInterruptibly(); //lock, so only one thread can call interrupt - otherThread.interrupt(); - - }catch(InterruptedException ie) - { - //interrupted from notifyThread because request/reply is done. just return from run() - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Connection.isValid timer interrupted and stopped"); - } - - } - - public CommTimer(Thread otherThread, int timeout, ReentrantLock lock ) - { - this.otherThread = otherThread; - this.timeout = timeout; - this.lock = lock; - } - }; - - CommTimer timer = new CommTimer( Thread.currentThread(), timeout, lock); //pass in ref to main thread so timer can interrupt if blocked on IO - Thread t = new Thread(timer); - t.start(); //sleeps for timeout and then interrupts main thread if it is still blocked on IO - - try - { - request = DBDSPool.getDBSQLRequestDS(DBSQLRequestDS.FUNCTIONID_TEST_CONNECTION, id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); - reply = sendAndReceive(request); - - lock.lockInterruptibly(); //lock, so only one thread can call interrupt - t.interrupt(); //stop timer thread - errorClass = reply.getErrorClass(); - returnCode = reply.getReturnCode(); - - }catch(Exception ex) - { - //interruptedException is wrapped in sqlException - //if exception occurs, just return false since connection is not valid - //this happens if timer ends before sendAndReceive returns - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Connection.isValid timed out or could not verify valid connection"); - return false; - } - - if(errorClass == 7 && returnCode == -201) - return true; - else - return false; - - } - catch(Exception e) - { - //implmentation note: if any exception happens, just return false, since conn is not valid - return false; - } - finally - { - if (request != null) { - request.returnToPool(); request = null; - } - if (reply != null) { - reply.returnToPool(); reply = null; // commented out code - } - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Connection.isValid call complete"); - } - - } - -/* endif */ - - - - //@PDA 550 client info - /** - * Sets the value of the client info property specified by name to the - * value specified by value. - *

- * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver - * and the maximum length that may be specified for each property. - *

- * The driver stores the value specified in a suitable location in the - * database. For example in a special register, session parameter, or - * system table column. For efficiency the driver may defer setting the - * value in the database until the next time a statement is executed or - * prepared. Other than storing the client information in the appropriate - * place in the database, these methods shall not alter the behavior of - * the connection in anyway. The values supplied to these methods are - * used for accounting, diagnostics and debugging purposes only. - *

- * The driver shall generate a warning if the client info name specified - * is not recognized by the driver. - *

- * If the value specified to this method is greater than the maximum - * length for the property the driver may either truncate the value and - * generate a warning or generate a SQLException. If the driver - * generates a SQLException, the value specified was not set on the - * connection. - *

- * The following client info properties are supported in Toobox for Java. - *

- *

    - *
  • ApplicationName - The name of the application currently utilizing - * the connection
  • - *
  • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
  • - *
  • ClientHostname - The hostname of the computer the application - * using the connection is running on.
  • - *
  • ClientAccounting - Client accounting information.
  • - *
  • ClientProgramID - The client program identification.
  • - *
- *

- * @param name The name of the client info property to set - * @param value The value to set the client info property to. If the - * value is null, the current value of the specified - * property is cleared. - *

- * @throws SQLClientInfoException if the database returns an error while - * setting the client info value on the database server. - *

- */ - public void setClientInfo(String name, String value) -/* ifdef JDBC40 */ - throws SQLClientInfoException -/* endif */ -/* ifndef JDBC40 - throws SQLException - endif */ - { - - DBSQLAttributesDS request = null; - DBReplyRequestedDS setClientInfoReply = null; - ConvTable tempConverter = null; - - String oldValue = null; //save in case we get error from host db - - // in order to reset if null value is passed in, use empty string - if (value == null) - value = ""; - - try - { - if (getVRM() >= JDUtilities.vrm610) - { - request = DBDSPool.getDBSQLAttributesDS(DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); - tempConverter = ConvTable.getTable(as400_.getCcsid(), null); - } - - if (name.equals(applicationNamePropertyName_)) - { - oldValue = applicationName_; - applicationName_ = value; - if (getVRM() >= JDUtilities.vrm610) - request.setClientInfoApplicationName(value, tempConverter); - - } else if (name.equals(clientUserPropertyName_)) - { - oldValue = clientUser_; - clientUser_ = value; - if (getVRM() >= JDUtilities.vrm610) - request.setClientInfoClientUser(value, tempConverter); - - } else if (name.equals(clientAccountingPropertyName_)) - { - oldValue = clientAccounting_; - clientAccounting_ = value; - if (getVRM() >= JDUtilities.vrm610) - request.setClientInfoClientAccounting(value, tempConverter); - - } else if (name.equals(clientHostnamePropertyName_)) - { - oldValue = clientHostname_; - clientHostname_ = value; - if (getVRM() >= JDUtilities.vrm610) - request.setClientInfoClientHostname(value, tempConverter); - - } else if (name.equals(clientProgramIDPropertyName_)) //@PDA add block for ProgramID - { - oldValue = clientProgramID_; - clientProgramID_ = value; - if (getVRM() >= JDUtilities.vrm610) - request.setClientInfoProgramID(value, tempConverter); - - } else - { - oldValue = null; - // post generic syntax error for invalid clientInfo name - postWarning(JDError.getSQLWarning(JDError.EXC_SYNTAX_ERROR)); - } - - if ((getVRM() >= JDUtilities.vrm610) && (oldValue != null)) - { - setClientInfoReply = sendAndReceive(request); - int errorClass = setClientInfoReply.getErrorClass(); - //throw SQLException - if (errorClass != 0) - JDError.throwSQLException(this, id_, errorClass, setClientInfoReply.getReturnCode()); - - } - } catch (Exception e) - { - //reset old value - if (name.equals(applicationNamePropertyName_)) - applicationName_ = oldValue; - else if (name.equals(clientUserPropertyName_)) - clientUser_ = oldValue; - else if (name.equals(clientAccountingPropertyName_)) - clientAccounting_ = oldValue; - else if (name.equals(clientHostnamePropertyName_)) - clientHostname_ = oldValue; - else if (name.equals(clientProgramIDPropertyName_)) //@pda - clientProgramID_ = oldValue; -/* ifdef JDBC40 */ - - //@PDD jdbc40 merge HashMap m = new HashMap(); - HashMap m = new HashMap(); - m.put(name, ClientInfoStatus.REASON_UNKNOWN); - JDError.throwSQLClientInfoException( this, JDError.EXC_INTERNAL, e, m ); - -/* endif */ -/* ifndef JDBC40 - JDError.throwSQLException( this, JDError.EXC_INTERNAL, e); - endif */ - } finally - { - if (request != null) { - request.returnToPool(); request = null; - } - if (setClientInfoReply != null) { - setClientInfoReply.returnToPool(); setClientInfoReply = null; // only error class used - } - } - } - - //@PDA 550 client info - /** - * Sets the value of the connection's client info properties. The - * Properties object contains the names and values of the - * client info properties to be set. The set of client info properties - * contained in the properties list replaces the current set of client info - * properties on the connection. If a property that is currently set on the - * connection is not present in the properties list, that property is - * cleared. Specifying an empty properties list will clear all of the - * properties on the connection. See - * setClientInfo (String, String) for more information. - *

- * If an error occurs in setting any of the client info properties, a - * ClientInfoException is thrown. The - * ClientInfoException contains information indicating which - * client info properties were not set. The state of the client information - * is unknown because some databases do not allow multiple client info - * properties to be set atomically. For those databases, one or more - * properties may have been set before the error occurred. - *

- * - * The following client info properties are supported in Toobox for Java. - *

- *

    - *
  • ApplicationName - The name of the application currently utilizing - * the connection
  • - *
  • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
  • - *
  • ClientHostname - The hostname of the computer the application - * using the connection is running on.
  • - *
  • ClientAccounting - Client accounting information.
  • - *
  • ClientProgramID - The client program identification.
  • - *
- *

- * - * @param properties - * the list of client info properties to set - *

- * @throws SQLClientInfoException - * if the database returns an error while setting the - * clientInfo values on the database - *

- */ - public void setClientInfo(Properties properties) -/* ifdef JDBC40 */ - throws SQLClientInfoException -/* endif */ -/* ifndef JDBC40 - throws SQLException - endif */ - { - String newApplicationName = properties.getProperty(applicationNamePropertyName_); - String newClientHostname = properties.getProperty(clientHostnamePropertyName_); - String newClientUser = properties.getProperty(clientUserPropertyName_); - String newClientAccounting = properties.getProperty(clientAccountingPropertyName_); - String newClientProgramID = properties.getProperty(clientProgramIDPropertyName_); //@pda - - //In order to reset if null value is passed in, use empty string - //per javadoc, clear its value if not specified in properties - if (newApplicationName == null) - newApplicationName = ""; - if (newClientHostname == null) - newClientHostname = ""; - if (newClientUser == null) - newClientUser = ""; - if (newClientAccounting == null) - newClientAccounting = ""; - if (newClientProgramID == null) //@PDA - newClientProgramID = ""; - - DBSQLAttributesDS request = null; - DBReplyRequestedDS setClientInfoReply = null; - ConvTable tempConverter = null; - try - { - if (getVRM() >= JDUtilities.vrm610) - { - request = DBDSPool.getDBSQLAttributesDS(DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); - tempConverter = ConvTable.getTable(as400_.getCcsid(), null); - - request.setClientInfoApplicationName(newApplicationName, tempConverter); - - request.setClientInfoClientUser(newClientUser, tempConverter); - - request.setClientInfoClientAccounting(newClientAccounting, tempConverter); - - request.setClientInfoClientHostname(newClientHostname, tempConverter); - - request.setClientInfoProgramID(newClientProgramID, tempConverter); //@pda - - setClientInfoReply = sendAndReceive(request); - int errorClass = setClientInfoReply.getErrorClass(); - if (errorClass != 0) - JDError.throwSQLException(this, id_, errorClass, setClientInfoReply.getReturnCode()); - } - - //update local values after request/reply in case of exception - applicationName_ = newApplicationName; - clientHostname_ = newClientHostname; - clientUser_ = newClientUser; - clientAccounting_ = newClientAccounting; - clientProgramID_ = newClientProgramID; - - } catch( Exception e) - { -/* ifdef JDBC40 */ - //create Map for exception constructor - //@PDD jdbc40 merge HashMap m = new HashMap(); - HashMap m = new HashMap(); - Enumeration clientInfoNames = properties.keys(); - while( clientInfoNames.hasMoreElements()) - { - String clientInfoName = (String)clientInfoNames.nextElement(); - m.put(clientInfoName, ClientInfoStatus.REASON_UNKNOWN); - } - JDError.throwSQLClientInfoException( this, JDError.EXC_INTERNAL, e, m); - -/* endif */ -/* ifndef JDBC40 - JDError.throwSQLException( this, JDError.EXC_INTERNAL, e); - endif */ - } finally - { - if (request != null) { - request.returnToPool(); request = null; - } - if (setClientInfoReply != null) { - setClientInfoReply.returnToPool(); setClientInfoReply=null; // only error class used - } - } - - } - - //@PDA 550 client info - /** - * Returns the value of the client info property specified by name. This - * method may return null if the specified client info property has not - * been set and does not have a default value. This method will also - * return null if the specified client info property name is not supported - * by the driver. - *

- * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver. - *

- * - * The following client info properties are supported in Toobox for Java. - *

- *

    - *
  • ApplicationName - The name of the application currently utilizing - * the connection
  • - *
  • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
  • - *
  • ClientHostname - The hostname of the computer the application - * using the connection is running on.
  • - *
  • ClientAccounting - Client accounting information.
  • - *
  • ClientProgramID - The client program identification.
  • - *
- *

- * @param name The name of the client info property to retrieve - *

- * @return The value of the client info property specified - *

- * @throws SQLException if the database returns an error when - * fetching the client info value from the database. - *

- * see java.sql.DatabaseMetaData#getClientInfoProperties - */ - public String getClientInfo(String name) throws SQLException - { - if (name.equals(applicationNamePropertyName_)) - return applicationName_; - else if (name.equals(clientUserPropertyName_)) - return clientUser_; - else if (name.equals(clientAccountingPropertyName_)) - return clientAccounting_; - else if (name.equals(clientHostnamePropertyName_)) - return clientHostname_; - else if (name.equals(clientProgramIDPropertyName_)) //@pda - return clientProgramID_; - else - { - //post generic syntax error for invalid clientInfo name - //since javadoc for setClientInfo(String,String) says to generate warning, we will do same here and return null - postWarning(JDError.getSQLWarning(JDError.EXC_SYNTAX_ERROR)); - return null; - } - } - - //@PDA 550 client info - /** - * Returns a list containing the name and current value of each client info - * property supported by the driver. The value of a client info property - * may be null if the property has not been set and does not have a - * default value. - *

- * - * The following client info properties are supported in Toobox for Java. - *

- *

    - *
  • ApplicationName - The name of the application currently utilizing - * the connection
  • - *
  • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
  • - *
  • ClientHostname - The hostname of the computer the application - * using the connection is running on.
  • - *
  • ClientAccounting - Client accounting information.
  • - *
  • ClientProgramID - The client program identification.
  • - *
- *

- * @return A Properties object that contains the name and current value of - * each of the client info properties supported by the driver. - *

- * @throws SQLException if the database returns an error when - * fetching the client info values from the database - */ - public Properties getClientInfo() throws SQLException - { - Properties props = new Properties(); - props.setProperty(applicationNamePropertyName_, applicationName_); - props.setProperty(clientAccountingPropertyName_, clientAccounting_); - props.setProperty(clientHostnamePropertyName_, clientHostname_); - props.setProperty(clientUserPropertyName_, clientUser_); - props.setProperty(clientProgramIDPropertyName_, clientProgramID_); //@pda - return props; - } - - - - - - //@PDA jdbc40 - /** - * Constructs an object that implements the Clob interface. The object - * returned initially contains no data. The setAsciiStream, - * setCharacterStream and setString methods of - * the Clob interface may be used to add data to the Clob. - * @return An object that implements the Clob interface - * @throws SQLException if an object that implements the - * Clob interface can not be constructed. - * - */ - public Clob createClob() throws SQLException - { - return new AS400JDBCClob("", AS400JDBCClob.MAX_LOB_SIZE); - } - - //@PDA jdbc40 - /** - * Constructs an object that implements the Blob interface. The object - * returned initially contains no data. The setBinaryStream and - * setBytes methods of the Blob interface may be used to add data to - * the Blob. - * @return An object that implements the Blob interface - * @throws SQLException if an object that implements the - * Blob interface can not be constructed - * - */ - public Blob createBlob() throws SQLException - { - return new AS400JDBCBlob(new byte[0], AS400JDBCBlob.MAX_LOB_SIZE); //@pdc 0 len array - } - - //@PDA jdbc40 - /** - * Constructs an object that implements the NClob interface. The object - * returned initially contains no data. The setAsciiStream, - * setCharacterStream and setString methods of the NClob interface may - * be used to add data to the NClob. - * @return An object that implements the NClob interface - * @throws SQLException if an object that implements the - * NClob interface can not be constructed. - * - */ -/* ifdef JDBC40 */ - public NClob createNClob() throws SQLException - { - return new AS400JDBCNClob("", AS400JDBCNClob.MAX_LOB_SIZE); - } -/* endif */ - - //@PDA jdbc40 - /** - * Constructs an object that implements the SQLXML interface. The object - * returned initially contains no data. The createXMLStreamWriter object and - * setString method of the SQLXML interface may be used to add data to the SQLXML - * object. - * @return An object that implements the SQLXML interface - * @throws SQLException if an object that implements the SQLXML interface can not - * be constructed - */ -/* ifdef JDBC40 */ - public SQLXML createSQLXML() throws SQLException - { - return new AS400JDBCSQLXML("", AS400JDBCSQLXML.MAX_XML_SIZE); - } -/* endif */ - - //@PDA //@array - /** - * Factory method for creating Array objects. - * - * @param typeName the SQL name of the type the elements of the array map to. The typeName is a - * database-specific name which may be the name of a built-in type, a user-defined type or a standard SQL type supported by this database. This - * is the value returned by Array.getBaseTypeName - * For Toolbox, the typeName will correspond to a typename in java.sql.Types. - * - * @param elements the elements that populate the returned object - * @return an Array object whose elements map to the specified SQL type - * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - */ - public Array createArrayOf(String typeName, Object[] elements) throws SQLException - { - //@array - return new AS400JDBCArray(typeName, elements, this.vrm_, this); - } - - //@PDA jdbc40 - /** - * Factory method for creating Struct objects. - * - * @param typeName the SQL type name of the SQL structured type that this Struct - * object maps to. The typeName is the name of a user-defined type that - * has been defined for this database. It is the value returned by - * Struct.getSQLTypeName. - * @param attributes the attributes that populate the returned object - * @return a Struct object that maps to the given SQL type and is populated with the given attributes - * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - */ - public Struct createStruct(String typeName, Object[] attributes) throws SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - - //@2KRA - /** - * Starts or stops the Database Host Server trace for this connection. - * Note: This method is only supported when running to IBM i V5R3 or later - * and is ignored if you specified to turn on database host server tracing - * using the 'server trace' connection property. - * @param trace true to start database host server tracing, false to end it. - */ - public void setDBHostServerTrace(boolean trace){ - try{ - if(getVRM() >= JDUtilities.vrm530){ - // See if tracing was specified by server trace property - // Server Job Trace - boolean traceServerJob = ((traceServer_ & ServerTrace.JDBC_TRACE_SERVER_JOB) > 0); - // Database Host Server Trace - boolean traceDatabaseHostServer = (((traceServer_ & ServerTrace.JDBC_TRACE_DATABASE_HOST_SERVER) > 0)); - String serverJobIdentifier = getServerJobIdentifier(); - boolean SQLNaming = properties_.getString(JDProperties.NAMING).equals(JDProperties.NAMING_SQL); - - if(!traceDatabaseHostServer){ // database host server trace was not already started - if(trace) // user requested tracing be turned on - { - try{ - if(getVRM() == JDUtilities.vrm530){ // run command for V5R3 - JDUtilities.runCommand(this, "QSYS/STRTRC SSNID(QJT" + - serverJobIdentifier.substring(20) + - ") JOB(*) MAXSTG(128000) JOBTRCTYPE(*TRCTYPE) " + - "TRCTYPE((TESTA *INFO))", SQLNaming); - } - else{ // run command for V5R4 and higher - JDUtilities.runCommand(this, "QSYS/STRTRC SSNID(QJT" + - serverJobIdentifier.substring(20) + - ") JOB(*) MAXSTG(128000) JOBTRCTYPE(*TRCTYPE) " + - "TRCTYPE((*DBHSVR *INFO))", SQLNaming); - } - databaseHostServerTrace_ = true; - }catch(Exception e){ - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to start database host server tracing failed, could not trace server job"); - } - } - else // user requested tracing be turned off - { - // Only issue ENDTRC if not already done. - if(!traceServerJob) // turn off it we don't have to wait to turn off server job tracing - { - try{ - JDUtilities.runCommand(this, "QSYS/ENDTRC SSNID(QJT" + - serverJobIdentifier.substring(20) + - ") DTAOPT(*LIB) DTALIB(QUSRSYS) RPLDTA(*YES) PRTTRC(*YES)", SQLNaming ); - - JDUtilities.runCommand(this, "QSYS/DLTTRC DTAMBR(QJT" + - serverJobIdentifier.substring(20) + - ") DTALIB(QUSRSYS)", SQLNaming ); - databaseHostServerTrace_ = false; - } - catch(Exception e){ - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to end database host server tracing failed."); - } - } - } - } - } - }catch(SQLException e){ - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Attempt to start/stop database host server tracing failed."); - } - - } - - - //@A2A - public boolean doUpdateDeleteBlocking() { - return doUpdateDeleteBlocking_; - } - - // @A6A - public int getMaximumBlockedInputRows() { - return maximumBlockedInputRows_; - } - - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCConnectionHandle.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCConnectionHandle.java deleted file mode 100644 index ff845b3bf..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCConnectionHandle.java +++ /dev/null @@ -1,2007 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCConnectionHandle.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import javax.sql.ConnectionEvent; -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -/* ifdef JDBC40 */ -import java.sql.SQLClientInfoException; -/* endif */ -import java.sql.Clob; -import java.sql.Connection; //@A5A -import java.sql.DatabaseMetaData; -/* ifdef JDBC40 */ -import java.sql.NClob; -/* endif */ -import java.sql.PreparedStatement; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Savepoint; //@A6A -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.Statement; -import java.sql.Struct; -import java.util.Map; -import java.util.Properties; //@pda client info - -/** -* The AS400JDBCConnectionHandle class represents an AS400JDBCConnection object -* that can be used in a AS400JDBCPooledConnection. -* -*

Creating a handle to a connection object allows the connection to be reused. -* The connection handle acts like a normal Connection object and should be closed -* after an application is done using it so it can be reused. -* -*

-* The following example obtains a connection handle to a pooled connection. -*

-* // Create a data source for making the connection. -* AS400JDBCConnectionPoolDataSource dataSource = new AS400JDBCConnectionPoolDataSource("CheeseDataBase"); -* datasource.setServerName("myAS400"); -* datasource.setUser("Mickey Mouse"); -* datasource.setPassword("IAMNORAT"); -* -* // Get a PooledConnection and get the connection handle to the database. -* AS400JDBCPooledConnection pooledConnection = datasource.getPooledConnection(); -* Connection connection = pooledConnection.getConnection(); -* -* ... work with the handle as if it is a normal connection. -* -* // Close the connection handle to it make available again for reuse. -* connection.close(); -*
-* -**/ -public class AS400JDBCConnectionHandle -/* ifdef JDBC40 */ -extends ToolboxWrapper -/* endif */ -implements Connection //@A5A -//@A5D extends AS400JDBCConnection -{ - - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private AS400JDBCPooledConnection pooledConnection_ = null; - private AS400JDBCConnection connection_ = null; - - /** - * Constructs an AS400JDBCConnectionHandle object. - * @param pooledConnection The pooled connection from which the handle originated. - * @param connection The physical connection that the handle represents. - **/ - AS400JDBCConnectionHandle(AS400JDBCPooledConnection pooledConnection, AS400JDBCConnection connection) - { - if (pooledConnection == null) - throw new NullPointerException("pooledConnection"); - pooledConnection_ = pooledConnection; - - if (connection == null) - throw new NullPointerException("connection"); - connection_ = connection; - } - - //@pda handle - /** - * Invalidates the connection. - * A AS400JDBCPooledConnection can get expired and moved back to available queue. So this - * handle class needs a way for AS400JDBCPooledConnection to notify it of this change in state. - * This way, when finalize() is called by GC we will not try to double-close the connection. - * Without this method, it is possible for two handles to have references to the same pooledConnection. - **/ - void invalidate() - { - connection_ = null; - pooledConnection_ = null; - } - - /** - * Checks that the specified SQL statement can be executed. - * This decision is based on the access specified by the caller - * and the read only mode. - * - * @param sqlStatement The SQL statement. - * @exception SQLException If the statement cannot be executed. - **/ - void checkAccess (JDSQLStatement sqlStatement) throws SQLException - { - validateConnection(); - try { - connection_.checkAccess(sqlStatement); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - - - /** - * Checks that the connection is open. Public methods - * that require an open connection should call this first. - * - * @exception SQLException If the connection is not open. - **/ - void checkOpen() throws SQLException - { - validateConnection(); - try { - connection_.checkOpen(); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - - - /** - * Clears all warnings that have been reported for the connection. - * After this call, getWarnings() returns null until a new warning - * is reported for the connection. - * - * @exception SQLException If an error occurs. - **/ - public void clearWarnings() throws SQLException - { - validateConnection(); - connection_.clearWarnings(); - } - - - - /** - * Closes the handle to the connection. This does not close the - * underlying physical connection to the database. The handle is - * set to an unuseable state. - * - * @exception SQLException If an error occurs. - **/ - public synchronized void close() throws SQLException - { - if (connection_ == null) return; - - try { - // Rollback and close the open statements. - // Note: Leave the physical connection open, so it can get re-used. - connection_.pseudoClose(); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - finally { - // notify the pooled connection. - pooledConnection_.fireConnectionCloseEvent(new ConnectionEvent(pooledConnection_)); - - connection_ = null; - pooledConnection_ = null; - } - } - - /** - * Commits all changes made since the previous commit or - * rollback and releases any database locks currently held by - * the connection. This has no effect when the connection - * is in auto-commit mode. - * - * @exception SQLException If the connection is not open - * or an error occurs. - **/ - public void commit() throws SQLException - { - validateConnection(); - try { - connection_.commit(); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - /** - * Creates a Statement object for executing SQL statements without - * parameters. If the same SQL statement is executed many times, it - * is more efficient to use prepareStatement(). - * - *

Result sets created using the statement will be type - * ResultSet.TYPE_FORWARD_ONLY and concurrency - * ResultSet.CONCUR_READ_ONLY. - * - * @return The statement object. - * - * @exception SQLException If the connection is not open, the maximum number - * of statements for this connection has been reached, or an error occured. - **/ - public Statement createStatement() throws SQLException - { - validateConnection(); - return connection_.createStatement(); - } - - - /** - * Creates a Statement object for executing SQL statements without - * parameters. If the same SQL statement is executed many times, it - * is more efficient to use prepareStatement(). - * - * @param resultSetType The result set type. Valid values are: - *

    - *
  • ResultSet.TYPE_FORWARD_ONLY - *
  • ResultSet.TYPE_SCROLL_INSENSITIVE - *
  • ResultSet.TYPE_SCROLL_SENSITIVE - *
- * @param resultSetConcurrency The result set concurrency. Valid values are: - *
    - *
  • ResultSet.CONCUR_READ_ONLY - *
  • ResultSet.CONCUR_UPDATABLE - *
- * @return The statement object. - * - * @exception SQLException If the connection is not open, the maximum number of statements - * for this connection has been reached, the result type or currency - * is not supported, or an error occured. - **/ - public Statement createStatement (int resultSetType, int resultSetConcurrency) throws SQLException - { - validateConnection(); - return connection_.createStatement(resultSetType, resultSetConcurrency); - } - - - //@A6A - /** - Creates a Statement object for executing SQL statements without - parameters. If the same SQL statement is executed many times, it - is more efficient to use prepareStatement(). - -

Full functionality of this method requires support in OS/400 V5R2 - or IBM i. If connecting to OS/400 V5R1 or earlier, the value for - resultSetHoldability will be ignored. - - @param resultSetType The result set type. Valid values are: -

    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @param resultSetConcurrency The result set concurrency. Valid values are: -
    -
  • ResultSet.CONCUR_READ_ONLY -
  • ResultSet.CONCUR_UPDATABLE -
- @param resultSetHoldability The result set holdability. Valid values are: -
    -
  • ResultSet.HOLD_CURSORS_OVER_COMMIT -
  • ResultSet.CLOSE_CURSORS_AT_COMMIT -
- @return The statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type, currency, or holdability is not supported, - or an error occurs. - @since Modification 5 - **/ - public Statement createStatement (int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - validateConnection(); - return connection_.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability); - } - - - /** - * Closes the connection if not explicitly closed by the caller. - * - * @exception Throwable If an error occurs. - **/ - protected void finalize () - throws Throwable - { - //@A5D Removed validateConnection() because it was throwing SQL08003 exceptions if - //@A5D connection_ was null by the time the garbage collector ran. From a finalizer, - //@A5D we don't want to be throwing exceptions. - //@A5D validateConnection(); - //@A5D connection_.finalize(); - try - { //@A5A //@A5A - close(); //@A5A - } //@A5A - catch (SQLException e) //@A5A - { //@A5A - if (JDTrace.isTraceOn()) //@A5A - JDTrace.logInformation (this, "Finalize on a connection handle threw exception: " + e.getMessage()); //@A5A - } //@A5A - } - - - //@CPMa - /** - * If the exception is a fatal connection error, fires a connectionErrorOccurred event. - * We're looking for any kind of error that would indicate that the connection - * should not be re-used after it's returned to the connection pool. - **/ - private final void fireEventIfErrorFatal(SQLException e) - { - String sqlState = e.getSQLState(); - if (sqlState.equals(JDError.EXC_ACCESS_MISMATCH) || - sqlState.equals(JDError.EXC_CONNECTION_NONE) || - sqlState.equals(JDError.EXC_CONNECTION_REJECTED) || - sqlState.equals(JDError.EXC_CONNECTION_UNABLE) || - sqlState.equals(JDError.EXC_COMMUNICATION_LINK_FAILURE) || - sqlState.equals(JDError.EXC_INTERNAL) || - sqlState.equals(JDError.EXC_SERVER_ERROR) || - sqlState.equals(JDError.EXC_RDB_DOES_NOT_EXIST)) - { - pooledConnection_.fatalConnectionErrorOccurred_ = true; - pooledConnection_.fireConnectionErrorEvent(new ConnectionEvent(pooledConnection_, e)); - } - } - - /** - * Returns the AS400 object for this connection. - * - * @return The AS400 object. - **/ - AS400Impl getAS400 () - throws SQLException // @A3A - { - validateConnection(); - return connection_.getAS400(); - } - - /** - * Returns the auto-commit state. - * - * @return true if the connection is in auto-commit mode; false otherwise. - * @exception SQLException If the connection is not open. - **/ - public boolean getAutoCommit() throws SQLException - { - validateConnection(); - return connection_.getAutoCommit(); - } - - //@cc1 - /** - * This method returns the concurrent access resolution setting. - * This method has no effect on IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @return The concurrent access resolution setting. Possible return valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public int getConcurrentAccessResolution () throws SQLException - { - validateConnection(); - return connection_.getConcurrentAccessResolution(); - } - - /** - * Returns the catalog name. - * - * @return The catalog name. - * @exception SQLException If the connection is not open. - **/ - public String getCatalog () - throws SQLException - { - validateConnection(); - return connection_.getCatalog(); - } - - - - /** - * Returns the converter for this connection. - * - * @return The converter. - **/ - ConvTable getConverter () //@P0C - throws SQLException // @A3A - { - validateConnection(); - return connection_.converter_; //@P0C - } - - /** - * Returns the converter for the specified CCSID, unless - * it is 0 or -1 (i.e. probably set for a non-text field), in - * which case it returns the converter for this connection. - * This is useful for code that handles all types of fields - * in a generic manner. - * - * @param ccsid The CCSID. - * @return The converter. - * @exception SQLException If the CCSID is not valid. - **/ - ConvTable getConverter (int ccsid) //@P0C - throws SQLException - { - validateConnection(); - return connection_.getConverter(ccsid); - } - - - - /** - * Returns the default SQL schema. - * - * @return The default SQL schema, or QGPL if none was specified. - **/ - String getDefaultSchema () - throws SQLException // @A3A - { - validateConnection(); - return connection_.getDefaultSchema(); - } - - // @A1D /** - // @A1D * Returns the graphic converter for this connection. - // @A1D * - // @A1D * @return The graphic converter. - // @A1D * @exception SQLException If no graphic converter was loaded. - // @A1D **/ - // @A1D ConverterImplRemote getGraphicConverter () throws SQLException - // @A1D { - // @A1D validateConnection(); - // @A1D return connection_.getGraphicConverter(); - // @A1D } - - - //@A6A - /** - Returns the holdability of ResultSets created from this connection. - - @return The cursor holdability. Valid values are ResultSet.HOLD_CURSORS_OVER_COMMIT and - ResultSet.CLOSE_CURSORS_AT_COMMIT. The holdability is derived in this order - of precedence: -
    -
  • 1. The holdability specified using the method setHoldability(int) - if this method was called. -
  • 2. The value of the cursor hold - driver property.
- Full functionality of #1 requires support in OS/400 - V5R2 or IBM i. If connecting to OS/400 V5R1 or earlier, - the value specified on this method will be ignored and the default holdability - will be the value of #2. - - @exception SQLException If the connection is not open. - @since Modification 5 - **/ - public int getHoldability () - throws SQLException - { - validateConnection(); - return connection_.getHoldability(); - } - - - //@A4A - /** - * Returns the DatabaseMetaData object that describes the - * connection's tables, supported SQL grammar, stored procedures, - * capabilities and more. - * - * @return The metadata object. - * - * @exception SQLException If an error occurs. - **/ - public DatabaseMetaData getMetaData () - throws SQLException - { - // We allow a user to get this object even if the - // connection is closed. - //@pdc above comment not true anymore - validateConnection(); //@pda since adding invalidate(), connection_ can be null - return connection_.getMetaData(); - } - - - /** - * Returns the connection properties. - * - * @return The connection properties. - **/ - JDProperties getProperties () - throws SQLException // @A3A - { - validateConnection(); - return connection_.getProperties(); - } - - /** - * Returns the job identifier of the host server job corresponding to this connection. - * Every JDBC connection is associated with a host server job on the system. The - * format is: - *
    - *
  • 10 character job name - *
  • 10 character user name - *
  • 6 character job number - *
- * - *

Note: Since this method is not defined in the JDBC Connection interface, - * you typically need to cast a Connection object returned from PooledConnection.getConnection() - * to an AS400JDBCConnectionHandle in order to call this method: - *

-  *  String serverJobIdentifier = ((AS400JDBCConnectionHandle)connection).getServerJobIdentifier();
-  *  
- * - * @return The server job identifier, or null if not known. - * @exception SQLException If the connection is not open. - **/ - public String getServerJobIdentifier() throws SQLException - { - validateConnection(); - return connection_.getServerJobIdentifier(); - } - - //@pda - /** - Returns the system object which is managing the connection to the system. -

Warning: This method should be used with extreme caution. This bypasses - the normal connection pool's connection reclaiming mechanisms. -

Note: Since this method is not defined in the JDBC Connection interface, - you typically need to cast a Connection object to AS400JDBCConnectionHandle in order - to call this method: -

-  AS400 system = ((AS400JDBCConnectionHandle)connection).getSystem();
-  
- - @return The system. - **/ - public AS400 getSystem() - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Warning: returning pooled connection's AS400 object directly to user."); - return connection_.getSystem(); - } - - - /** - * Returns the transaction isolation level. - * - * @return The transaction isolation level. Possible - * values are: - *
    - *
  • TRANSACTION_NONE - *
  • TRANSACTION_READ_UNCOMMITTED - *
  • TRANSACTION_READ_COMMITTED - *
  • TRANSACTION_REPEATABLE_READ - *
- * - * @exception SQLException If the connection is not open. - **/ - public int getTransactionIsolation() throws SQLException - { - validateConnection(); - return connection_.getTransactionIsolation(); - } - - /** - * Returns the type map. - * - *

This driver does not support the type map. - * - * @return The type map. - * @exception SQLException This exception is always thrown. - **/ - public Map getTypeMap() throws SQLException - { - validateConnection(); - return connection_.getTypeMap(); - } - - - /** - * Returns the URL for the connection's database. - * - * @return The URL for the database. - **/ - String getURL () - throws SQLException // @A3A - { - validateConnection(); - return connection_.getURL(); - } - - /** - * Returns the user name as currently signed on to the system. - * - * @return The user name. - **/ - String getUserName () - throws SQLException // @A3A - { - validateConnection(); - return connection_.getUserName(); - } - - - /** - * Returns the VRM. - **/ - int getVRM() - throws SQLException // @A3A - { - validateConnection(); - return connection_.getVRM(); - } - - /** - * Returns the first warning reported for the connection. - * Subsequent warnings may be chained to this warning. - * - * @return The first warning or null if no warnings - * have been reported. - * - * @exception SQLException If an error occurs. - **/ - public SQLWarning getWarnings() throws SQLException - { - validateConnection(); - return connection_.getWarnings(); - } - - /** - * Indicates if the specified cursor name is already used - * in the connection. - * - * @return true if the cursor name is already used; false otherwise. - **/ - boolean isCursorNameUsed (String cursorName) - throws SQLException // @A3A - { - validateConnection(); - return connection_.isCursorNameUsed(cursorName); - } - - /** - * Indicates if the connection is closed. - * - * @return true if the connection is closed; false otherwise. - * @exception SQLException If an error occurs. - **/ - public boolean isClosed() throws SQLException - { - if (connection_ == null) - return true; - else - return false; - } - - - - /** - * Indicates if the connection is in read-only mode. - * - * @return true if the connection is in read-only mode; false otherwise. - * @exception SQLException If the connection is not open. - **/ - public boolean isReadOnly() throws SQLException - { - validateConnection(); - return connection_.isReadOnly(); - } - - /** - * Returns the native form of an SQL statement without - * executing it. The JDBC driver converts all SQL statements - * from the JDBC SQL grammar into the native DB2 for IBM i - * SQL grammar prior to executing them. - * - * @param sql The SQL statement in terms of the JDBC SQL grammar. - * @return The translated SQL statement in the native - * DB2 for IBM i SQL grammar. - * - * @exception SQLException If the SQL statement has a syntax error. - **/ - public String nativeSQL (String sql) throws SQLException - { - validateConnection(); - return connection_.nativeSQL(sql); - } - - /** - * Notifies the connection that a statement in its context has been closed. - * - * @param statement The statement. - * @param id The statement's id. - **/ - void notifyClose (AS400JDBCStatement statement, int id) - throws SQLException // @A3A - { - validateConnection(); - connection_.notifyClose(statement, id); - } - - /** - * Posts a warning for the connection. - * - * @param sqlWarning The warning. - **/ - void postWarning (SQLWarning sqlWarning) - throws SQLException // @A3A - { - validateConnection(); - connection_.postWarning(sqlWarning); - } - - /** - * Precompiles an SQL stored procedure call with optional input - * and output parameters and stores it in a CallableStatement - * object. This object can be used to efficiently call the SQL - * stored procedure multiple times. - * - *

Result sets created using the statement will be type - * ResultSet.TYPE_FORWARD_ONLY and concurrency - * ResultSet.CONCUR_READ_ONLY. - * - * @param sql The SQL stored procedure call. - * @return The callable statement object. - * - * @exception SQLException If the connection is not open, - * the maximum number of statements - * for this connection has been reached, or an - * error occurs. - **/ - public CallableStatement prepareCall (String sql) throws SQLException - { - validateConnection(); - return connection_.prepareCall(sql); - } - - /** - * Precompiles an SQL stored procedure call with optional input - * and output parameters and stores it in a CallableStatement - * object. This object can be used to efficiently call the SQL - * stored procedure multiple times. - * - * @param sql The SQL statement. - * @param resultSetType The result set type. Valid values are: - *

    - *
  • ResultSet.TYPE_FORWARD_ONLY - *
  • ResultSet.TYPE_SCROLL_INSENSITIVE - *
  • ResultSet.TYPE_SCROLL_SENSITIVE - *
- * @param resultSetConcurrency The result set concurrency. Valid values are: - *
    - *
  • ResultSet.CONCUR_READ_ONLY - *
  • ResultSet.CONCUR_UPDATABLE - *
- * @return The prepared statement object. - * - * @exception SQLException If the connection is not open, the maximum number of statements - * for this connection has been reached, the result type or currency - * is not valid, or an error occurs. - **/ - public CallableStatement prepareCall (String sql, int resultSetType, int resultSetConcurrency) - throws SQLException - { - validateConnection(); - return connection_.prepareCall(sql, resultSetType, resultSetConcurrency); - } - - - //@G4A JDBC 3.0 - /** - Precompiles an SQL stored procedure call with optional input - and output parameters and stores it in a CallableStatement - object. This object can be used to efficiently call the SQL - stored procedure multiple times. - -

Full functionality of this method requires support in OS/400 V5R2 - or IBM i. If connecting to OS/400 V5R1 or earlier, the value for - resultSetHoldability will be ignored. - - @param sql The SQL statement. - @param resultSetType The result set type. Valid values are: -

    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @param resultSetConcurrency The result set concurrency. Valid values are: -
    -
  • ResultSet.CONCUR_READ_ONLY -
  • ResultSet.CONCUR_UPDATABLE -
- @return The prepared statement object. - @param resultSetHoldability The result set holdability. Valid values are: -
    -
  • ResultSet.HOLD_CURSORS_OVER_COMMIT -
  • ResultSet.CLOSE_CURSORS_AT_COMMIT -
- @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type, currency, or holdability is not valid, - or an error occurs. - @since Modification 5 - **/ - public CallableStatement prepareCall (String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - validateConnection(); - return connection_.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability); - } - - - /** - * Precompiles an SQL statement with optional input parameters - * and stores it in a PreparedStatement object. This object can - * be used to efficiently execute this SQL statement multiple times. - * - *

Result sets created using the statement will be type - * ResultSet.TYPE_FORWARD_ONLY and concurrency - * ResultSet.CONCUR_READ_ONLY. - * - * @param sql The SQL statement. - * @return The prepared statement object. - * - * @exception SQLException If the connection is not open, - * the maximum number of statements - * for this connection has been reached, or an - * error occurs. - **/ - public PreparedStatement prepareStatement (String sql) throws SQLException - { - validateConnection(); - return connection_.prepareStatement(sql); - } - - - - //@A6A - /** -Precompiles an SQL statement with optional input parameters -and stores it in a PreparedStatement object. This object can -be used to efficiently execute this SQL statement -multiple times. - -

This method requires OS/400 V5R2 or IBM i. If connecting to OS/400 V5R1 or earlier, an exception will be -thrown. - -

Result sets created using the statement will be type -ResultSet.TYPE_FORWARD_ONLY and concurrency -ResultSet.CONCUR_READ_ONLY. - -@param sql The SQL statement. -@param autoGeneratedKeys Whether to return auto generated keys. Valid values are: -

    -
  • Statement.RETURN_GENERATED_KEYS -
  • Statement.NO_GENERATED_KEYS -
-@return The prepared statement object. - -@exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, - if connecting to OS/400 V5R1 or earlier, - an error occurs. -@since Modification 5 -**/ - public PreparedStatement prepareStatement (String sql, int autoGeneratedKeys) - throws SQLException - { - validateConnection(); - return connection_.prepareStatement(sql, autoGeneratedKeys); - } - - - // @A6A - /** - * Precompiles an SQL statement with optional input parameters - * and stores it in a PreparedStatement object. This object can - * be used to efficiently execute this SQL statement - * multiple times. - * - *

This method is not supported. An SQLException is always thrown. - * - * @param sql The SQL statement. - * @param columnIndexes An array of column indexes indicating the columns that should be returned from the inserted row or rows. - * @return An SQLException is always thrown. This method is not supported. - * @exception java.sql.SQLException - Always thrown because the Toolbox JDBC driver does does not support this method. - * @since Modification 5 - **/ - public PreparedStatement prepareStatement (String sql, int[] columnIndexes) - throws SQLException - { - validateConnection(); - return connection_.prepareStatement(sql, columnIndexes); - } - - - /** - * Precompiles an SQL statement with optional input parameters - * and stores it in a PreparedStatement object. This object can - * be used to efficiently execute this SQL statement - * multiple times. - * - * @param sql The SQL statement. - * @param resultSetType The result set type. Valid values are: - *

    - *
  • ResultSet.TYPE_FORWARD_ONLY - *
  • ResultSet.TYPE_SCROLL_INSENSITIVE - *
  • ResultSet.TYPE_SCROLL_SENSITIVE - *
- * @param resultSetConcurrency The result set concurrency. Valid values are: - *
    - *
  • ResultSet.CONCUR_READ_ONLY - *
  • ResultSet.CONCUR_UPDATABLE - *
- * @return The prepared statement object. - * - * @exception SQLException If the connection is not open, - * the maximum number of statements - * for this connection has been reached, the - * result type or currency is not valid, - * or an error occurs. - **/ - public PreparedStatement prepareStatement (String sql, int resultSetType, int resultSetConcurrency) - throws SQLException - { - validateConnection(); - return connection_.prepareStatement(sql, resultSetType, resultSetConcurrency); - } - - - //@A6A - /** - Precompiles an SQL statement with optional input parameters - and stores it in a PreparedStatement object. This object can - be used to efficiently execute this SQL statement - multiple times. - - @param sql The SQL statement. - @param resultSetType The result set type. Valid values are: -
    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @param resultSetConcurrency The result set concurrency. Valid values are: -
    -
  • ResultSet.CONCUR_READ_ONLY -
  • ResultSet.CONCUR_UPDATABLE -
- @param resultSetHoldability The result set holdability. Valid values are: -
    -
  • ResultSet.HOLD_CURSORS_OVER_COMMIT -
  • ResultSet.CLOSE_CURSORS_AT_COMMIT -
- @return The prepared statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type, currency, or holdability is not valid, - or an error occurs. - **/ - public PreparedStatement prepareStatement (String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - validateConnection(); - return connection_.prepareStatement (sql, resultSetType, resultSetConcurrency, resultSetHoldability); - } - - - // @A6A - /** - * Precompiles an SQL statement with optional input parameters - * and stores it in a PreparedStatement object. This object can - * be used to efficiently execute this SQL statement - * multiple times. - * - *

This method is not supported. An SQLException is always thrown. - * - * @param sql The SQL statement. - * @param columnNames An array of column names indicating the columns that should be returned from the inserted row or rows. - * @return An SQLException is always thrown. This method is not supported. - * @exception java.sql.SQLException - Always thrown because the Toolbox JDBC driver does does not support this method. - * @since Modification 5 - **/ - public PreparedStatement prepareStatement (String sql, String[] columnNames) - throws SQLException - { - // Auto generated keys now supported for some releases.. Let the connection - // handle the exception. - - validateConnection(); - return connection_.prepareStatement(sql, columnNames); - } - - - // @A6A - /** - * Removes the given Savepoint object from the current transaction. - * Any reference to the savepoint after it has been removed will - * cause an SQLException to be thrown. - * - * @param savepoint the savepoint to be removed. - * - * @exception SQLException if a database access error occurs or the given Savepoint - * is not a valid savepoint in the current transaction. - * - * @since Modification 5 - **/ - public void releaseSavepoint(Savepoint savepoint) - throws SQLException - { - validateConnection(); - try { - connection_.releaseSavepoint(savepoint); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - - /** - * Drops all changes made since the previous commit or - * rollback and releases any database locks currently held by - * the connection. This has no effect when the connection - * is in auto-commit mode. - * - * @exception SQLException If the connection is not open - * or an error occurs. - **/ - public void rollback () throws SQLException - { - validateConnection(); - try { - connection_.rollback(); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - - // @A6A - /** - * Undoes all changes made after the specified Savepoint was set. - * - * @param savepoint the savepoint to be rolled back to. - * - * @exception SQLException if a database access error occurs, the Savepoint - * is no longer valid, or this Connection - * is currently in auto-commit mode. - * @since Modification 5 - **/ - public void rollback(Savepoint savepoint) - throws SQLException - { - validateConnection(); - try { - connection_.rollback(savepoint); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - - /** - * Sends a request data stream to the system using the - * connection's id and does not expect a reply. - * - * @param request The request. - * - * @exception SQLException If an error occurs. - **/ - void send (DBBaseRequestDS request) throws SQLException - { - validateConnection(); - try { - connection_.send (request); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - /** - * Sends a request data stream to the system and does not - * expect a reply. - * - * @param request The request. - * @param id The id. - * - * @exception SQLException If an error occurs. - **/ - void send (DBBaseRequestDS request, int id) throws SQLException - { - validateConnection(); - try { - connection_.send(request, id); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - /** - * Sends a request data stream to the system and does not - * expect a reply. - * - * @param request The request. - * @param id The id. - * @param leavePending Indicates if the request should - * be left pending. This indicates - * whether or not to base the next - * request on this one. - * - * @exception SQLException If an error occurs. - **/ - void send (DBBaseRequestDS request, int id, boolean leavePending) throws SQLException - { - validateConnection(); - try { - connection_.send(request, id, leavePending); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - // @A2D /** - // @A2D * Sends a request data stream to the system and discards the reply. - // @A2D * - // @A2D * @param request The request. - // @A2D * @param id The id. - // @A2D * @param leavePending Indicates if the request should - // @A2D * be left pending. This indicates - // @A2D * whether or not to base the next - // @A2D * request on this one. - // @A2D * - // @A2D * @exception SQLException If an error occurs. - // @A2D **/ - // @A2D void sendAndDiscardReply (DBBaseRequestDS request, int id) throws SQLException - // @A2D { - // @A2D validateConnection(); - // @A2D connection_.sendAndDiscardReply(request, id); - // @A2D } - - /** - * Sends a request data stream to the system using the - * connection's id and returns the corresponding reply from - * the system. - * - * @param request The request. - * @return The reply. - * - * @exception SQLException If an error occurs. - **/ - DBReplyRequestedDS sendAndReceive (DBBaseRequestDS request) throws SQLException - { - validateConnection(); - try { - return connection_.sendAndReceive(request); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - /** - * Sends a request data stream to the system and returns the - * corresponding reply from the system. - * - * @param request The request. - * @param id The id. - * @return The reply. - * - * @exception SQLException If an error occurs. - **/ - DBReplyRequestedDS sendAndReceive (DBBaseRequestDS request, int id) throws SQLException - { - validateConnection(); - try { - return connection_.sendAndReceive(request, id); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - /** - * Sets the auto-commit mode. If the connection is in auto-commit - * mode, then all of its SQL statements are executed and committed - * as individual transactions. Otherwise, its SQL statements are - * grouped into transactions that are terminated by either a commit - * or rollback. - * - *

By default, the connection is in auto-commit mode. The - * commit occurs when the statement execution completes or the - * next statement execute occurs, whichever comes first. In the - * case of statements returning a result set, the statement - * execution completes when the last row of the result set has - * been retrieved or the result set has been closed. In advanced - * cases, a single statement may return multiple results as well - * as output parameter values. Here the commit occurs when all results - * and output parameter values have been retrieved. - * - * @param autoCommit true to turn on auto-commit mode, false to - * turn it off. - * - * @exception SQLException If the connection is not open - * or an error occurs. - **/ - public void setAutoCommit (boolean autoCommit) throws SQLException - { - validateConnection(); - try { - connection_.setAutoCommit(autoCommit); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - - //@cc1 - /** - * This method sets concurrent access resolution. This method overrides the setting of ConcurrentAccessResolution on the datasource or connection - * URL properties. This changes the setting for this connection only. This method has no effect on - * IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @param concurrentAccessResolution The current access resolution setting. Possible valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public void setConcurrentAccessResolution (int concurrentAccessResolution) throws SQLException - { - validateConnection(); - connection_.setConcurrentAccessResolution(concurrentAccessResolution); - } - - /** - Sets the eWLM Correlator. It is assumed a valid correlator value is used. - If the value is null, all ARM/eWLM implementation will be turned off. - eWLM correlators require i5/OS V5R3 or later systems. This request is ignored when running to OS/400 V5R2 or earlier systems. - - @param bytes The eWLM correlator value - **/ - public void setDB2eWLMCorrelator(byte[] bytes) - throws SQLException //@eWLM - { - validateConnection(); - connection_.setDB2eWLMCorrelator(bytes); - } - - /** - * This method is not supported. - * @exception SQLException If the connection is not open. - **/ - public void setCatalog (String catalog) throws SQLException - { - validateConnection(); - connection_.setCatalog(catalog); - } - - /** - * Sets whether the connection is being used for DRDA. - * - * @param drda true if the connection is being used for DRDA; false otherwise. - **/ - void setDRDA (boolean drda) - throws SQLException // @A3A - { - validateConnection(); - connection_.setDRDA(drda); - } - - - //@A6A - /** - Sets the holdability of ResultSets created from this connection. - -

Full functionality of this method requires OS/400 V5R2 - or IBM i. If connecting to OS/400 V5R1 or earlier, all - cursors for the connection will be changed to the value of the variable - holdability. - - @param holdability The cursor holdability. - Valid values are ResultSet.HOLD_CURSORS_OVER_COMMIT or - ResultSet.CLOSE_CURSORS_AT_COMMIT. - - @exception SQLException If the connection is not open - or the value passed in is not valid. - @since Modification 5 - **/ - public void setHoldability (int holdability) - throws SQLException - { - validateConnection(); - connection_.setHoldability(holdability); - } - - - /** - * Sets the connection properties. - **/ - void setProperties (JDDataSourceURL dataSourceUrl, JDProperties properties, AS400 as400) - throws SQLException - { - validateConnection(); - try { - connection_.setProperties(dataSourceUrl, properties, as400); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - - /** - * Sets the properties. - **/ - void setProperties (JDDataSourceURL dataSourceUrl, JDProperties properties, AS400Impl as400) - throws SQLException - { - validateConnection(); - try { - connection_.setProperties(dataSourceUrl, properties, as400); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - /** - * Sets the read-only mode. This will provide read-only - * access to the database. Read-only mode can be useful by - * enabling certain database optimizations. If the caller - * specified "read only" or "read call" for the "access" property, - * then the read-only mode cannot be set to false. The read-only - * mode cannot be changed while in the middle of a transaction. - * - * @param readOnly true to set the connection to read-only mode; - * false to set the connection to read-write mode. - * - * @exception SQLException If the connection is not open, - * a transaction is active, or the - * "access" property is set to "read - * only". - **/ - public void setReadOnly (boolean readOnly) - throws SQLException - { - validateConnection(); - connection_.setReadOnly(readOnly); - } - - - // @A6A - /** - * Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it. - *

    - *
  • Named savepoints must be unique. A savepoint name cannot be reused until the savepoint is released, committed, or rolled back. - *
  • Savepoints are valid only if autocommit is off. An exception is thrown if autocommit is enabled. - *
  • Savepoints are not valid across XA connections. An exception is thrown if the connection is an XA connection. - *
  • Savepoints require OS/400 V5R2 or IBM i. An exception is thrown if connecting to OS/400 V5R1 or earlier. - *
  • If the connection option is set to keep cursors open after a traditional rollback, cursors will remain open after a rollback to a savepoint. - *
- * - * @return The new Savepoint object. - * @exception SQLException if a database access error occurs or this Connection object is currently in auto-commit mode. - * @since Modification 5 - **/ - public Savepoint setSavepoint() - throws SQLException - { - validateConnection(); - return connection_.setSavepoint(); - } - - - // @A6 - /** - * Creates a named savepoint in the current transaction and returns the new Savepoint object that represents it. - *
    - *
  • Named savepoints must be unique. A savepoint name cannot be reused until the savepoint is released, committed, or rolled back. - *
  • Savepoints are valid only if autocommit is off. An exception is thrown if autocommit is enabled. - *
  • Savepoints are not valid across XA connections. An exception is thrown if the connection is an XA connection. - *
  • Savepoints require OS/400 V5R2 or IBM i. An exception is thrown if connecting to OS/400 V5R1 or earlier. - *
  • If the connection option is set to keep cursors open after a traditional rollback, cursors will remain open after a rollback to a savepoint. - *
- * @param name A String containing the name of the savepoint - * @return The new Savepoint object. - * @exception SQLException if a database access error occurs or this Connection object is currently in auto-commit mode. - * @since Modification 5 - **/ - public Savepoint setSavepoint(String name) - throws SQLException - { - validateConnection(); - return connection_.setSavepoint(name); - } - - /** - * - **/ - void setSystem (AS400 as400) - throws SQLException // @A3A - { - validateConnection(); - connection_.setSystem(as400); - } - - /** - * Sets the transaction isolation level. The transaction - * isolation level cannot be changed while in the middle of - * a transaction. - * - *

JDBC and DB2 for IBM i use different terminology for transaction - * isolation levels. The following table provides a terminology - * mapping: - * - *

- * - * - * - * - * - *
DB2 for IBM i isolation levelJDBC transaction isolation level
*CHG TRANSACTION_READ_UNCOMMITTED
*CS TRANSACTION_READ_COMMITTED
*ALL TRANSACTION_READ_REPEATABLE_READ
*RR TRANSACTION_SERIALIZABLE
- * - * @param level The transaction isolation level. Possible values are: - *

    - *
  • TRANSACTION_READ_UNCOMMITTED - *
  • TRANSACTION_READ_COMMITTED - *
  • TRANSACTION_REPEATABLE_READ - *
  • TRANSACTION_SERIALIZABLE - *
- * - * @exception SQLException If the connection is not open, the input level is not valid - * or unsupported, or a transaction is active. - **/ - public void setTransactionIsolation (int level) - throws SQLException - { - validateConnection(); - connection_.setTransactionIsolation(level); - } - - - - /** - * Sets the type map to be used for distinct and structured types. - * - *

Note: Distinct types are supported by DB2 for IBM i, but - * are not externalized by the IBM Toolbox for Java JDBC driver. - * In other words, distinct types behave as if they are the underlying - * type. Structured types are not supported by DB2 for IBM i. - * Consequently, this driver does not support the type map. - * - * @param typeMap The type map. - * @exception SQLException This exception is always thrown. - **/ - public void setTypeMap (Map typeMap) throws SQLException - { - validateConnection(); - connection_.setTypeMap(typeMap); - } - - - - /** - * Returns the connection's catalog name. - * This is the name of the IBM i system. - * @return The catalog name. - **/ - public String toString () - { - if (connection_ != null) // @A3C - return connection_.toString(); - else // @A3A - return super.toString(); // @A3A - } - - - - /** - * Indicates if the connection is using extended formats. - * @return true if the connection is using extended formats, false otherwise. - **/ - boolean useExtendedFormats () - throws SQLException // @A3A - { - validateConnection(); - return connection_.useExtendedFormats(); - } - - - /** - * Validates that the connection has not been closed. - **/ - private void validateConnection() - throws SQLException // @A3A - { - if (connection_ == null) - { - // This would indicate that close() has been called on this handle. - // Note: It does _not_ indicate that the actual physical connection has experienced a fatal connection error. Therefore, we don't call fireConnectionErrorEvent() in this case. - JDTrace.logInformation (this, "The connection is closed."); // @A7C - JDError.throwSQLException (JDError.EXC_CONNECTION_NONE); // @A3C - } - } - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.Connection" }; //@pdc can't be a as400jdbcconnection wrapper because an attempt to cast as such would fail - } - - - //@PDA jdbc40 - /** - * Returns true if the connection has not been closed and is still valid. - * The driver shall submit a query on the connection or use some other - * mechanism that positively verifies the connection is still valid when - * this method is called. - *

- * The query submitted by the driver to validate the connection shall be - * executed in the context of the current transaction. - * - * @param timeout - The time in seconds to wait for the database operation - * used to validate the connection to complete. If - * the timeout period expires before the operation - * completes, this method returns false. A value of - * 0 indicates a timeout is not applied to the - * database operation. Note that currently the timeout - * value is not used. - *

- * @return true if the connection is valid, false otherwise - * @exception SQLException if a database access error occurs. - */ -/* ifdef JDBC40 */ - public boolean isValid(int timeout) throws SQLException - { - validateConnection(); - return connection_.isValid(timeout); - } -/* endif */ - - //@PDA jdbc40 - - // @PDA 550 client info - /** - * Sets the value of the connection's client info properties. The - * Properties object contains the names and values of the - * client info properties to be set. The set of client info properties - * contained in the properties list replaces the current set of client info - * properties on the connection. If a property that is currently set on the - * connection is not present in the properties list, that property is - * cleared. Specifying an empty properties list will clear all of the - * properties on the connection. See - * setClientInfo (String, String) for more information. - *

- * If an error occurs in setting any of the client info properties, a - * ClientInfoException is thrown. The - * ClientInfoException contains information indicating which - * client info properties were not set. The state of the client information - * is unknown because some databases do not allow multiple client info - * properties to be set atomically. For those databases, one or more - * properties may have been set before the error occurred. - *

- * The following client info properties are supported in Toobox for Java. - *

- *

    - *
  • ApplicationName - The name of the application currently utilizing - * the connection
  • - *
  • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
  • - *
  • ClientHostname - The hostname of the computer the application - * using the connection is running on.
  • - *
  • ClientAccounting - Client accounting information.
  • - *
  • ClientProgramID - The client program identification.
  • - *
- *

- * - * @param properties - * the list of client info properties to set - *

- * @throws SQLException - * if the database server returns an error while setting the - * clientInfo values on the database server - *

- * see java.sql.Connection#setClientInfo(String, String) - * setClientInfo(String, String) - */ - public void setClientInfo(Properties properties) -/* ifdef JDBC40 */ - throws SQLClientInfoException -/* endif */ -/* ifndef JDBC40 - throws SQLException - endif */ - { -/* ifdef JDBC40 */ - try { -/* endif */ - validateConnection(); -/* ifdef JDBC40 */ - }catch(SQLException e) - { - SQLClientInfoException clientIE = new SQLClientInfoException(e.getMessage(), e.getSQLState(), null); - throw clientIE; - } -/* endif */ - - - connection_.setClientInfo(properties); - } /* setClientInfo */ - - - //@PDA 550 client info - /** - * Returns the value of the client info property specified by name. This - * method may return null if the specified client info property has not - * been set and does not have a default value. This method will also - * return null if the specified client info property name is not supported - * by the driver. - *

- * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver. - *

- * The following client info properties are supported in Toobox for Java. - *

- *

    - *
  • ApplicationName - The name of the application currently utilizing - * the connection
  • - *
  • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
  • - *
  • ClientHostname - The hostname of the computer the application - * using the connection is running on.
  • - *
  • ClientAccounting - Client accounting information.
  • - *
  • ClientProgramID - The client program identification.
  • - *
- *

- * @param name The name of the client info property to retrieve - *

- * @return The value of the client info property specified - *

- * @throws SQLException if the database server returns an error when - * fetching the client info value from the database. - *

- * see java.sql.DatabaseMetaData#getClientInfoProperties - */ - public String getClientInfo(String name) throws SQLException - { - validateConnection(); - return connection_.getClientInfo(name); - } - - - - //@PDA 550 client info - /** - * Returns a list containing the name and current value of each client info - * property supported by the driver. The value of a client info property - * may be null if the property has not been set and does not have a - * default value. - *

- * The following client info properties are supported in Toobox for Java. - *

- *

    - *
  • ApplicationName - The name of the application currently utilizing - * the connection
  • - *
  • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
  • - *
  • ClientHostname - The hostname of the computer the application - * using the connection is running on.
  • - *
  • ClientAccounting - Client accounting information.
  • - *
  • ClientProgramID - The client program identification.
  • - *
- *

- * @return A Properties object that contains the name and current value of - * each of the client info properties supported by the driver. - *

- * @throws SQLException if the database server returns an error when - * fetching the client info values from the database - */ - public Properties getClientInfo() throws SQLException - { - validateConnection(); - return connection_.getClientInfo(); - } - - //@PDA jdbc40 - /** - * Constructs an object that implements the Clob interface. The object - * returned initially contains no data. The setAsciiStream, - * setCharacterStream and setString methods of - * the Clob interface may be used to add data to the Clob. - * @return An object that implements the Clob interface - * @throws SQLException if an object that implements the - * Clob interface can not be constructed. - * - */ - public Clob createClob() throws SQLException - { - validateConnection(); - return connection_.createClob(); - } - - //@PDA jdbc40 - /** - * Constructs an object that implements the Blob interface. The object - * returned initially contains no data. The setBinaryStream and - * setBytes methods of the Blob interface may be used to add data to - * the Blob. - * @return An object that implements the Blob interface - * @throws SQLException if an object that implements the - * Blob interface can not be constructed - * - */ - public Blob createBlob() throws SQLException - { - validateConnection(); - return connection_.createBlob(); - } - - - - - //@PDA jdbc40 - /** - * Constructs an object that implements the NClob interface. The object - * returned initially contains no data. The setAsciiStream, - * setCharacterStream and setString methods of the NClob interface may - * be used to add data to the NClob. - * @return An object that implements the NClob interface - * @throws SQLException if an object that implements the - * NClob interface can not be constructed. - * - */ -/* ifdef JDBC40 */ - public NClob createNClob() throws SQLException - { - validateConnection(); - return connection_.createNClob(); - } -/* endif */ - - //@PDA jdbc40 - /** - * Constructs an object that implements the SQLXML interface. The object - * returned initially contains no data. The createXmlStreamWriter object and - * setString method of the SQLXML interface may be used to add data to the SQLXML - * object. - * @return An object that implements the SQLXML interface - * @throws SQLException if an object that implements the SQLXML interface can not - * be constructed - */ -/* ifdef JDBC40 */ - public SQLXML createSQLXML() throws SQLException - { - validateConnection(); - return connection_.createSQLXML(); - } -/* endif */ - - //@PDA jdbc40 - /** - * Factory method for creating Array objects. - * - * @param typeName the SQL name of the type the elements of the array map to. The typeName is a - * database-specific name which may be the name of a built-in type, a user-defined type or a standard SQL type supported by this database. This - * is the value returned by Array.getBaseTypeName - * @param elements the elements that populate the returned object - * @return an Array object whose elements map to the specified SQL type - * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - */ - public Array createArrayOf(String typeName, Object[] elements) throws SQLException - { - validateConnection(); - return connection_.createArrayOf(typeName, elements); - } - - //@PDA jdbc40 - /** - * Factory method for creating Struct objects. - * - * @param typeName the SQL type name of the SQL structured type that this Struct - * object maps to. The typeName is the name of a user-defined type that - * has been defined for this database. It is the value returned by - * Struct.getSQLTypeName. - * @param attributes the attributes that populate the returned object - * @return a Struct object that maps to the given SQL type and is populated with the given attributes - * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - */ - public Struct createStruct(String typeName, Object[] attributes) throws SQLException - { - validateConnection(); - return connection_.createStruct(typeName, attributes); - } - - - //@PDA 550 client info - /** - * Sets the value of the client info property specified by name to the - * value specified by value. - *

- * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver - * and the maximum length that may be specified for each property. - *

- * The driver stores the value specified in a suitable location in the - * database. For example in a special register, session parameter, or - * system table column. For efficiency the driver may defer setting the - * value in the database until the next time a statement is executed or - * prepared. Other than storing the client information in the appropriate - * place in the database, these methods shall not alter the behavior of - * the connection in anyway. The values supplied to these methods are - * used for accounting, diagnostics and debugging purposes only. - *

- * The driver shall generate a warning if the client info name specified - * is not recognized by the driver. - *

- * If the value specified to this method is greater than the maximum - * length for the property the driver may either truncate the value and - * generate a warning or generate a SQLException. If the driver - * generates a SQLException, the value specified was not set on the - * connection. - *

- * The following client info properties are supported in Toobox for Java. - *

- *

    - *
  • ApplicationName - The name of the application currently utilizing - * the connection
  • - *
  • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
  • - *
  • ClientHostname - The hostname of the computer the application - * using the connection is running on.
  • - *
  • ClientAccounting - Client accounting information.
  • - *
  • ClientProgramID - The client program identification.
  • - *
- *

- * @param name The name of the client info property to set - * @param value The value to set the client info property to. If the - * value is null, the current value of the specified - * property is cleared. - *

- * @throws SQLException if the database server returns an error while - * setting the client info value on the database server. - *

- */ - public void setClientInfo(String name, String value) -/* ifdef JDBC40 */ - throws SQLClientInfoException -/* endif */ -/* ifndef JDBC40 - throws SQLException - endif */ - { -/* ifdef JDBC40 */ - try { -/* endif */ - validateConnection(); -/* ifdef JDBC40 */ - }catch(SQLException e) - { - SQLClientInfoException clientIE = new SQLClientInfoException(e.getMessage(), e.getSQLState(), null); - throw clientIE; - } -/* endif */ - - connection_.setClientInfo(name, value); - } - - //@2KRA - /** - * Starts or stops the Database Host Server trace for this connection. - * Note: This method is only supported when running to i5/OS V5R3 or later - * and is ignored if you specified to turn on database host server tracingfs - * using the 'server trace' connection property. - * @param trace true to start database host server tracing, false to end it. - */ - public void setDBHostServerTrace(boolean trace) throws SQLException { //@pdc -/* ifdef JDBC40 */ - try { -/* endif */ - validateConnection(); -/* ifdef JDBC40 */ - }catch(SQLException e) - { - SQLClientInfoException clientIE = new SQLClientInfoException(e.getMessage(), e.getSQLState(), null); - throw clientIE; - } -/* endif */ - connection_.setDBHostServerTrace(trace); - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCConnectionPoolDataSource.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCConnectionPoolDataSource.java deleted file mode 100644 index 0c727ef6a..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCConnectionPoolDataSource.java +++ /dev/null @@ -1,444 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCConnectionPoolDataSource.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.sql.SQLException; -import javax.naming.*; -import javax.sql.ConnectionPoolDataSource; -import javax.sql.PooledConnection; - -/** -* The AS400JDBCConnectionPoolDataSource class represents a factory for -* AS400PooledConnection objects. -* -*

-* The following is an example that creates an AS400JDBCConnectionPoolDataSource object -* that can be used to cache JDBC connections. -* -*

-* // Create a data source for making the connection. -* AS400JDBCConnectionPoolDataSource dataSource = new AS400JDBCConnectionPoolDataSource("myAS400"); -* datasource.setUser("myUser"); -* datasource.setPassword("MYPWD"); -* -* // Get the PooledConnection. -* PooledConnection pooledConnection = datasource.getPooledConnection(); -*
-**/ -public class AS400JDBCConnectionPoolDataSource extends AS400JDBCDataSource implements ConnectionPoolDataSource, Referenceable, Serializable -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - //@B2D private transient AS400JDBCConnectionPool connectionPool_; //@A2A - - //@B2D private int initialPoolSize_ = 0; //@B0A - //@B2D private int maxIdleTime_ = 3600; //@B0A - //@B2D private int maxPoolSize_ = 0; //@B0A - //@B2D //private int maxStatements_ = 0; //@B0A - Ignore. Use package caching instead. - //@B2D private int minPoolSize_ = 0; //@B0A - //@B2D private int propertyCycle_ = 300; //@B0A - - /** - * Constructs a default AS400JDBCConnectionPoolDataSource object. - **/ - public AS400JDBCConnectionPoolDataSource() - { - super(); - //@B2D initializeTransient(); //@A2A - } - - /** - * Constructs an AS400JDBCConnectionPoolDataSource with the specified serverName. - * @param serverName The IBM i system name. - **/ - public AS400JDBCConnectionPoolDataSource(String serverName) - { - super(serverName); - //@B2D initializeTransient(); //@A2A - } - - /** - * Constructs an AS400JDBCConnectionPoolDataSource with the specified signon information. - * @param serverName The IBM i system name. - * @param user The user id. - * @param password The password. - **/ - public AS400JDBCConnectionPoolDataSource(String serverName, String user, String password) - { - super(serverName, user, password); - //@B2D initializeTransient(); //@A2A - } - - //@A1A - /** - * Constructs an AS400JDBCConnectionPoolDataSource with the specified signon information - * to use for SSL communications with the system. - * @param serverName The IBM i system name. - * @param user The user id. - * @param password The password. - * @param keyRingName The key ring class name to be used for SSL communications with the system. - * @param keyRingPassword The password for the key ring class to be used for SSL communications with the system. - **/ - public AS400JDBCConnectionPoolDataSource(String serverName, String user, String password, - String keyRingName, String keyRingPassword) - { - super(serverName, user, password, keyRingName, keyRingPassword); - //@B2D initializeTransient(); //@A2A - } - - // @F0A - added the following constructor to avoid some object construction - /** - * Constructs an AS400JDBCConnectionPoolDataSource from the specified Reference - * @param reference to retrieve DataSource properties from - **/ - AS400JDBCConnectionPoolDataSource(Reference reference) { - super(reference); - } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Returns the number of connections this pool contains when it is created. - //@B2D * @return The number of pooled connections. The default value is 0. - //@B2D **/ - //@B2D public int getInitialPoolSize() - //@B2D { - //@B2D return initialPoolSize_; - //@B2D } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Returns the maximum amount of time (in seconds) that a pooled - //@B2D * connection in this pool is allowed to remain idle before it is - //@B2D * automatically closed. A value of 0 indicates pooled connections - //@B2D * are never automatically closed. - //@B2D * @return The maximum idle time for a pooled connection in seconds. - //@B2D * The default value is 1 hour (3600 seconds). - //@B2D **/ - //@B2D public int getMaxIdleTime() - //@B2D { - //@B2D return maxIdleTime_; - //@B2D } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Returns the maximum number of connections this connection pool - //@B2D * contains. A value of 0 indicates there is no maximum. - //@B2D * @return The maximum number of connections in the pool. The default - //@B2D * value is 0 (no maximum). - //@B2D **/ - //@B2D public int getMaxPoolSize() - //@B2D { - //@B2D return maxPoolSize_; - //@B2D } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Returns the maximum number of statements this connection pool - //@B2D * should keep open. A value of 0 indicates that no statements - //@B2D * will be cached. - //@B2D * @return The maximum number of cached open statements. The default - //@B2D * value is 0 (no caching). - //@B2D **/ - //@B2D // Note: We don't support statement caching this way. - //@B2D // That's what package caching is for. - //@B2D // public int getMaxStatements() - //@B2D // { - //@B2D // return maxStatements_; - //@B2D // } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Returns the minimum number of connections this connection pool - //@B2D * contains. A value of 0 indicates there is no minimum and connections - //@B2D * are created as they are needed. - //@B2D * @return The minimum number of available connections in the pool. The - //@B2D * default value is 0. - //@B2D **/ - //@B2D public int getMinPoolSize() - //@B2D { - //@B2D return minPoolSize_; - //@B2D } - - - /** - * Returns a pooled connection that is connected to the IBM i system. - * @return A pooled connection. - * @exception SQLException If a database error occurs. - **/ - public PooledConnection getPooledConnection() throws SQLException - { - PooledConnection pc = new AS400JDBCPooledConnection(getConnection()); - - log("PooledConnection created"); - return pc; - - //@B2D //Get a connection from the connection pool. - //@B2D PooledConnection pc = null; //@A2A - //@B2D try - //@B2D { //@A2A - //@B2D connect(); //@B0A - //@B2D pc = connectionPool_.getPooledConnection(); //@A2C - //@B2D - //@B2D log("PooledConnection created"); - //@B2D return pc; - //@B2D } - //@B2D catch (ConnectionPoolException cpe) //@A2A - //@B2D { - //@B2D //@A2A - //@B2D JDError.throwSQLException (JDError.EXC_INTERNAL, cpe); //@A2A - //@B2D } - //@B2D return pc; //@A2M - } - - /** - * Returns a pooled connection that is connected to the IBM i system. - * @param user The userid for the connection. - * @param password The password for the connection. - * @return A pooled connection. - * @exception SQLException If a database error occurs. - **/ - public PooledConnection getPooledConnection(String user, String password) throws SQLException - { - PooledConnection pc = new AS400JDBCPooledConnection(getConnection(user,password)); - - log("PooledConnection created"); - return pc; - - //@B2D PooledConnection pc = null; //@A2A - //@B2D try - //@B2D { //@A2A - //@B2D connect(); //@B0A - //@B2D // Set user and password if user has not been set in the datasource yet. - //@B2D if (getUser().equals("")) //@A2A - //@B2D { - //@B2D //@A2A - //@B2D setUser(user); //@A2A - //@B2D setPassword(password); //@A2A - //@B2D } //@A2A - //@B2D // If the user specified is not equal to the user of the datasource, - //@B2D // throw an ExtendedIllegalStateException. - //@B2D user = user.toUpperCase(); //@A2A - //@B2D if (!(getUser().equals(user))) //@A2A - //@B2D { - //@B2D //@A2A - //@B2D Trace.log(Trace.ERROR, "User in data source already set."); //@A2A - //@B2D throw new ExtendedIllegalStateException("user", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); //@A2A - //@B2D } //@A2A - //@B2D pc = connectionPool_.getPooledConnection(); //@A2C - //@B2D - //@B2D log("PooledConnection created"); - //@B2D } - //@B2D catch (ConnectionPoolException cpe) //@A2A - //@B2D { - //@B2D //@A2A - //@B2D JDError.throwSQLException (JDError.EXC_INTERNAL, cpe); //@A2A - //@B2D } - //@B2D return pc; //@A2M - } - - - //@B2D //@B0A - Is it OK to have a maintenance thread according to the EJB spec? - //@B2D // Don't we have to run without creating additional threads? - //@B2D /** - //@B2D * Returns the interval (in seconds) between runs of this pool's - //@B2D * maintenance thread. The maintenance thread enforces this pool's - //@B2D * connections and statements so that they conform to the specified - //@B2D * minimum and maximum pool sizes, idle time, and maximum number of - //@B2D * open statements. - //@B2D * @return The number of seconds that this pool should wait before enforcing - //@B2D * its properties. The default value is 5 minutes (300 seconds). - //@B2D **/ - //@B2D public int getPropertyCycle() - //@B2D { - //@B2D return propertyCycle_; - //@B2D } - - - /** - * Returns the Reference object for the data source object. - * This is used by JNDI when bound in a JNDI naming service. - * Contains the information necessary to reconstruct the data source - * object when it is later retrieved from JNDI via an object factory. - * - * @return A Reference object for the data source object. - * @exception NamingException If a naming error occurs resolving the object. - **/ - public Reference getReference() throws NamingException - { - Reference ref = new Reference(this.getClass().getName(), - "com.ibm.as400.access.AS400JDBCObjectFactory", - null); - - Reference dsRef = super.getReference(); - for (int i=0; i< dsRef.size(); i++) - ref.add( dsRef.get(i) ); - - return ref; - } - - - //@B2D //@A2A - //@B2D /** - //@B2D * Initializes the transient data for object de-serialization. - //@B2D **/ - //@B2D private void initializeTransient() - //@B2D { - //@B2D connectionPool_ = new AS400JDBCConnectionPool(this); - //@B2D } - - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - //@B2D initializeTransient(); //@A2A - } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Sets the number of connections this pool contains when it is created. - //@B2D * @param initialPoolSize The number of pooled connections. Valid values - //@B2D * are 0 or greater. - //@B2D **/ - //@B2D public void setInitialPoolSize(int initialPoolSize) - //@B2D { - //@B2D String property = "initialPoolSize"; - //@B2D if (initialPoolSize < 0) - //@B2D { - //@B2D throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - //@B2D } - //@B2D if (!connected_) - //@B2D { - //@B2D Integer old = new Integer(initialPoolSize_); - //@B2D initialPoolSize_ = initialPoolSize; - //@B2D changes_.firePropertyChange(property, old, new Integer(initialPoolSize_)); - //@B2D } - //@B2D else - //@B2D { - //@B2D throw new ExtendedIllegalStateException(property, ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - //@B2D } - //@B2D } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Sets the maximum amount of time (in seconds) that a pooled - //@B2D * connection in this pool is allowed to remain idle before it is - //@B2D * automatically closed. A value of 0 indicates pooled connections - //@B2D * are never automatically closed. - //@B2D * @param maxIdleTime The maximum idle time for a pooled connection in seconds. - //@B2D * Valid values are 0 or greater. - //@B2D **/ - //@B2D public void setMaxIdleTime(int maxIdleTime) - //@B2D { - //@B2D String property = "maxIdleTime"; - //@B2D Integer old = new Integer(maxIdleTime_); - //@B2D maxIdleTime_ = maxIdleTime; - //@B2D changes_.firePropertyChange(property, old, new Integer(maxIdleTime_)); - //@B2D } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Sets the maximum number of connections this connection pool - //@B2D * contains. A value of 0 indicates there is no maximum. - //@B2D * @param maxPoolSize The maximum number of connections in this pool. - //@B2D * Valid values are 0 or greater. - //@B2D **/ - //@B2D public void setMaxPoolSize(int maxPoolSize) - //@B2D { - //@B2D String property = "maxPoolSize"; - //@B2D Integer old = new Integer(maxPoolSize_); - //@B2D maxPoolSize_ = maxPoolSize; - //@B2D changes_.firePropertyChange(property, old, new Integer(maxPoolSize_)); - //@B2D } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Sets the maximum number of statements this connection pool - //@B2D * should keep open. A value of 0 indicates that no statements - //@B2D * will be cached. - //@B2D * @param maxStatements The maximum number of cached open statements. - //@B2D * Valid values are 0 or greater. - //@B2D **/ - //@B2D // Note: Use package caching to get statement caching. - //@B2D /* public void setMaxStatements(int maxStatements) - //@B2D { - //@B2D String property = "maxStatements"; - //@B2D Integer old = new Integer(maxStatements_); - //@B2D maxStatements_ = maxStatements; - //@B2D changes_.firePropertyChange(property, old, new Integer(maxStatements_)); - //@B2D } - //@B2D */ - - - //@B2D //@B0A - //@B2D /** - //@B2D * Sets the minimum number of connections this connection pool - //@B2D * contains. A value of 0 indicates there is no minimum and connections - //@B2D * are created as they are needed. - //@B2D * @param minPoolSize The minimum number of available connections in the pool. - //@B2D * Valid values are 0 or greater. - //@B2D **/ - //@B2D public void setMinPoolSize(int minPoolSize) - //@B2D { - //@B2D String property = "minPoolSize"; - //@B2D Integer old = new Integer(minPoolSize_); - //@B2D minPoolSize_ = minPoolSize; - //@B2D changes_.firePropertyChange(property, old, new Integer(minPoolSize_)); - //@B2D } - - - //@B2D //@B0A - Is it OK to have a maintenance thread according to the EJB spec? - //@B2D // Don't we have to run without creating additional threads? - //@B2D /** - //@B2D * Sets the interval (in seconds) between runs of this pool's - //@B2D * maintenance thread. The maintenance thread enforces this pool's - //@B2D * connections and statements so that they conform to the specified - //@B2D * minimum and maximum pool sizes, idle time, and maximum number of - //@B2D * open statements. A value of 0 indicates that a maintenance thread - //@B2D * should not be created. - //@B2D * @param The number of seconds that this pool should wait before enforcing - //@B2D * its properties. Valid values are 0 or greater. - //@B2D **/ - //@B2D public void setPropertyCycle(int propertyCycle) - //@B2D { - //@B2D String property = "propertyCycle"; - //@B2D Integer old = new Integer(propertyCycle_); - //@B2D propertyCycle_ = propertyCycle; - //@B2D changes_.firePropertyChange(property, old, new Integer(propertyCycle_)); - //@B2D } - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCConnectionPoolDataSource", "java.sql.ConnectionPoolDataSource" }; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCDataSource.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCDataSource.java deleted file mode 100644 index b036c764a..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCDataSource.java +++ /dev/null @@ -1,5200 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCDataSource.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.PrintWriter; -import java.io.Serializable; -import java.sql.Connection; -import java.sql.DriverPropertyInfo; -import java.sql.SQLException; -import java.util.Enumeration; -import java.util.Properties; -import java.util.Random; // @J3a -import javax.sql.DataSource; // JDBC2.0 std-ext -import javax.naming.NamingException; // JNDI -import javax.naming.Reference; // JNDI -import javax.naming.Referenceable; // JNDI -import javax.naming.StringRefAddr; // JNDI - -/** -* The AS400JDBCDataSource class represents a factory for IBM i database connections. -* -*

The following is an example that creates an AS400JDBCDataSource object and creates a -* connection to the database. -* -*

-* // Create a data source for making the connection. -* AS400JDBCDataSource datasource = new AS400JDBCDataSource("myAS400"); -* datasource.setUser("myUser"); -* datasource.setPassword("MYPWD"); - -* // Create a database connection to the system. -* Connection connection = datasource.getConnection(); -*
-* -*

The following example registers an AS400JDBCDataSource object with JNDI and then -* uses the object returned from JNDI to obtain a database connection. -*

-* // Create a data source to the IBM i database. -* AS400JDBCDataSource dataSource = new AS400JDBCDataSource(); -* dataSource.setServerName("myAS400"); -* -* // Register the datasource with the Java Naming and Directory Interface (JNDI). -* Hashtable env = new Hashtable(); -* env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); -* Context context = new InitialContext(env); -* context.bind("jdbc/customer", dataSource); -* -* // Return an AS400JDBCDataSource object from JNDI and get a connection. -* AS400JDBCDataSource datasource = (AS400JDBCDataSource) context.lookup("jdbc/customer"); -* Connection connection = datasource.getConnection("myUser", "MYPWD"); -*
-**/ -public class AS400JDBCDataSource -/* ifdef JDBC40 */ -extends ToolboxWrapper -/* endif */ - -implements DataSource, Referenceable, Serializable, Cloneable //@PDC 550 -{ - static final long serialVersionUID = 4L; - - - - /** - * Implementation notes: - * The properties listed in com.ibm.as400.access.JDProperties should also be included here. - **/ - - // Constants - private static final String DATABASE_NAME = "databaseName"; - private static final String DATASOURCE_NAME = "dataSourceName"; - private static final String DESCRIPTION = "description"; - private static final String SERVER_NAME = "serverName"; - private static final String USER = "userName"; - private static final String KEY_RING_NAME = "keyring"; // @F0A - private static final String PASSWORD = "pw"; // @F0A - private static final String KEY_RING_PASSWORD = "keyringpw"; // @F0A - private static final String SECURE = "secure"; // @F0A - private static final String SAVE_PASSWORD = "savepw"; // @F0A - private static final String PLAIN_TEXT_PASSWORD = "pwd"; //@K1A - private static final String TRUE_ = "true"; - private static final String FALSE_ = "false"; - private static final String TOOLBOX_DRIVER = "jdbc:as400:"; - private static final int MAX_THRESHOLD = 16777216; // Maximum threshold (bytes). @A3C, @A4A - static final int MAX_SCALE = 63; // Maximum decimal scale - - // socket options to store away in JNDI - private static final String SOCKET_KEEP_ALIVE = "soKeepAlive"; // @F1A - private static final String SOCKET_RECEIVE_BUFFER_SIZE = "soReceiveBufferSize"; // @F1A - private static final String SOCKET_SEND_BUFFER_SIZE = "soSendBufferSize"; // @F1A - private static final String SOCKET_LINGER = "soLinger"; // @F1A - private static final String SOCKET_TIMEOUT = "soTimeout"; // @F1A - private static final String SOCKET_LOGIN_TIMEOUT = "loginTimeout"; // @st3 - private static final String SOCKET_TCP_NO_DELAY = "soTCPNoDelay"; // @F1A - - // Data source properties. - transient private AS400 as400_; // AS400 object used to store and encrypt the password. - // @J2d private String databaseName_ = ""; // Database name. @A6C - private String dataSourceName_ = ""; // Data source name. @A6C - private String description_ = ""; // Data source description. @A6C - private JDProperties properties_; // IBM i connection properties. - private SocketProperties sockProps_; // IBM i socket properties @F1A - transient private PrintWriter writer_; // The EventLog print writer. @C7c - transient private EventLog log_; //@C7c - - private String serialServerName_; // system name used in serialization. - private String serialUserName_; // User used in serialization. - private String serialKeyRingName_; //@B4A // Key ring name used in serialization. - transient PropertyChangeSupport changes_; //@B0C - private boolean isSecure_ = false; //@B4A - - // Handles loading the appropriate resource bundle - // private static ResourceBundleLoader loader_; //@A9A - - - // In mod 5 support was added to optionally serialize the password with the - // rest of the properties. By default this is off. setSavePasswordWhenSerialized(true) - // must be called to save the password. By calling this the application takes - // responsibility for protecting the serialized bytes. The password is not saved in the - // clear. The password string is confused so that something more than just looking at the - // serialized bytes must be done to see the password. - private char[] serialPWBytes_ = null; //@J3a - private char[] serialKeyRingPWBytes_ = null; //@J3a - private boolean savePasswordWhenSerialized_ = false; //@J3a by default, don't save password!!!! - - /** - * The maximum storage space in megabytes, that can be used to execute a query. - **/ - public static final int MAX_STORAGE_LIMIT = 2147352578; // Maximum query storage limit @550 - - - /** - Start tracing the JDBC client. This is the same as setting - property "trace=true"; Note the constant is not public. - It is defined only to be compatible with ODBC - The numeric value of this constant is 1. - **/ - static final int TRACE_CLIENT = 1; // @j1a - - /** - Start the database monitor on the JDBC server job. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 2. - **/ - public static final int SERVER_TRACE_START_DATABASE_MONITOR = 2; // @j1a - - /** - Start debug on the JDBC server job. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 4. - **/ - public static final int SERVER_TRACE_DEBUG_SERVER_JOB = 4; // @j1a - - /** - Save the joblog when the JDBC server job ends. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 8. - **/ - public static final int SERVER_TRACE_SAVE_SERVER_JOBLOG = 8; // @j1a - - /** - Start job trace on the JDBC server job. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 16. - **/ - public static final int SERVER_TRACE_TRACE_SERVER_JOB = 16; // @j1a - - /** - Save SQL information. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 32. - **/ - public static final int SERVER_TRACE_SAVE_SQL_INFORMATION = 32; // @j1a - - - //@cc1 - /** - * CONCURRENTACCESS_NOT_SET - Indicates that currently committed behavior is not - * requested explicitly by the client. - */ - public final static int CONCURRENTACCESS_NOT_SET = 0; - //@cc1 - /** - * CONCURRENTACCESS_USE_CURRENTLY_COMMITTED - Indicates that the currently committed - * behavior is requested at the server. - */ - public final static int CONCURRENTACCESS_USE_CURRENTLY_COMMITTED = 1; - //@cc1 - /** - * CONCURRENTACCESS_WAIT_FOR_OUTCOME - Indicates that the readers will - * wait on the writers during lock contention. - */ - public final static int CONCURRENTACCESS_WAIT_FOR_OUTCOME = 2; - //@cc1 - /** - * CONCURRENTACCESS_SKIP_LOCKS - Indicates that the readers will - * skip locks. - */ - public final static int CONCURRENTACCESS_SKIP_LOCKS = 3; - - - /** - * Constructs a default AS400JDBCDataSource object. - **/ - public AS400JDBCDataSource() - { - initializeTransient(); - properties_ = new JDProperties(null, null); - sockProps_ = new SocketProperties(); - } - - /** - * Constructs an AS400JDBCDataSource object to the specified serverName. - * @param serverName The name of the IBM i system. - **/ - public AS400JDBCDataSource(String serverName) - { - this(); - - setServerName(serverName); - } - - /** - * Constructs an AS400JDBCDataSource object with the specified signon information. - * @param serverName The name of the IBM i system. - * @param user The user id. - * @param password The user password. - **/ - public AS400JDBCDataSource(String serverName, String user, String password) - { - this(); - - setServerName(serverName); - setUser(user); - setPassword(password); - } - - //@K1A - /** - * Constructs an AS400JDBCDataSource object with the specified AS400 object - * @param as400 The AS400 object - **/ - public AS400JDBCDataSource(AS400 as400) - { - this(); - - as400_ = as400; - if( as400 instanceof SecureAS400 ) - setSecure(true); - - } - - //@B4A - /** - * Constructs an AS400JDBCDataSource object with the specified signon information - * to use for SSL communications with the system. - * @param serverName The name of the IBM i system. - * @param user The user id. - * @param password The user password. - * @param keyRingName The key ring class name to be used for SSL communications with the system. - * @param keyRingPassword The password for the key ring class to be used for SSL communications with the system. - **/ - public AS400JDBCDataSource(String serverName, String user, String password, - String keyRingName, String keyRingPassword) - { - this(); - - setSecure(true); // @F0M - - try - { - as400_ = new SecureAS400(as400_); - ((SecureAS400)as400_).setKeyRingName(keyRingName, keyRingPassword); - } - catch (PropertyVetoException pe) - { /* will never happen */ - } - serialKeyRingName_ = keyRingName; - - // @J3 There is no get/set keyring name / password methods so they really aren't bean - // properties, but in v5r1 the keyring name is saved as if it is a property. Since - // the code saved the name we will also save the password. - serialKeyRingPWBytes_ = xpwConfuse(keyRingPassword); //@J3a // @F0M (changed from keyRingName to keyRingPassword) - - setServerName(serverName); - setUser(user); - setPassword(password); - } - - // @F0A - Added the following constructor to avoid creating some extra objects - /** - * Constructs an AS400JDBCDataSource object from the specified Reference object - * @param reference to retrieve the DataSource properties from - **/ - AS400JDBCDataSource(Reference reference) { - /* - * Implementation note: This method is called from AS400JDBCObjectFactory.getObjectInstance - */ - - // check to make sure our reference is not null - if (reference == null) - throw new NullPointerException("reference"); - - // set up property change support - changes_ = new PropertyChangeSupport(this); - - // set up the as400 object - if (((String)reference.get(SECURE).getContent()).equalsIgnoreCase(TRUE_)) { - isSecure_ = true; - as400_ = new SecureAS400(); - - // since the as400 object is secure, get the key ring info - serialKeyRingName_ = (String)reference.get(KEY_RING_NAME).getContent(); - if (reference.get(KEY_RING_PASSWORD) != null) - serialKeyRingPWBytes_ = ((String)reference.get(KEY_RING_PASSWORD).getContent()).toCharArray(); - else - serialKeyRingPWBytes_ = null; - - try { - if (serialKeyRingPWBytes_ != null && serialKeyRingPWBytes_.length > 0) - ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_, xpwDeconfuse(serialKeyRingPWBytes_)); - else - ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_); - } catch (PropertyVetoException pve) { /* Will never happen */ } - - } else { - isSecure_ = false; - as400_ = new AS400(); - } - - // must initialize the JDProperties so the property change checks dont get a NullPointerException - properties_ = new JDProperties(null, null); - - Properties properties = new Properties(); - sockProps_ = new SocketProperties(); - - Enumeration list = reference.getAll(); - while (list.hasMoreElements()) - { - StringRefAddr refAddr = (StringRefAddr)list.nextElement(); - String property = refAddr.getType(); - String value = (String)reference.get(property).getContent(); - - // constant identifiers were used to store in JNDI - // all of these were handled already so do not put them in the properties - if (property.equals(DATABASE_NAME)) - setDatabaseName(value); - else if (property.equals(DATASOURCE_NAME)) - setDataSourceName(value); - else if (property.equals(DESCRIPTION)) - setDescription(value); - else if (property.equals(SERVER_NAME)) - setServerName(value); - else if (property.equals(USER)) - setUser(value); - else if(property.equals(PLAIN_TEXT_PASSWORD)) { //@K1A - //set the password //@K1A - setPassword(value); //@K1A - } - else if (property.equals(PASSWORD)) { - if(reference.get(PLAIN_TEXT_PASSWORD) != null) //@K1A - { //@K1A - setPassword((String)reference.get(PLAIN_TEXT_PASSWORD).getContent()); //@K1A - } //@K1A - else //@K1A - { //@K1A - // get the password back from the serialized char[] - serialPWBytes_ = value.toCharArray(); - // decode the password and set it on the as400 - as400_.setPassword(xpwDeconfuse(serialPWBytes_)); - } //@K1A - } - else if (property.equals(SAVE_PASSWORD)) { - // set the savePasswordWhenSerialized_ flag - savePasswordWhenSerialized_ = value.equals(TRUE_) ? true : false; - } else if (property.equals(SECURE) || property.equals(KEY_RING_NAME) || property.equals(KEY_RING_PASSWORD)) { - // do nothing for these keys, they have already been handled - } - else if (property.equals(SOCKET_KEEP_ALIVE)) { - sockProps_.setKeepAlive((value.equals(TRUE_)? true : false)); - } - else if (property.equals(SOCKET_RECEIVE_BUFFER_SIZE)) { - sockProps_.setReceiveBufferSize(Integer.parseInt(value)); - } - else if (property.equals(SOCKET_SEND_BUFFER_SIZE)) { - sockProps_.setSendBufferSize(Integer.parseInt(value)); - } - else if (property.equals(SOCKET_LINGER)) { - sockProps_.setSoLinger(Integer.parseInt(value)); - } - else if (property.equals(SOCKET_TIMEOUT)) { - sockProps_.setSoTimeout(Integer.parseInt(value)); - } - else if (property.equals(SOCKET_LOGIN_TIMEOUT)) { //@st3 - sockProps_.setLoginTimeout(Integer.parseInt(value)); //@st3 - } - else if (property.equals(SOCKET_TCP_NO_DELAY)) { - sockProps_.setTcpNoDelay((value.equals(TRUE_)? true : false)); - } - else - { - properties.put(property, value); - } - } - properties_ = new JDProperties(properties, null); - - // get the prompt property and set it back in the as400 object - String prmpt = properties_.getString(JDProperties.PROMPT); - if (prmpt != null && prmpt.equalsIgnoreCase(FALSE_)) - setPrompt(false); - else if (prmpt != null && prmpt.equalsIgnoreCase(TRUE_)) - setPrompt(true); - - } - - /** - * Adds a PropertyChangeListener. The specified PropertyChangeListener's - * propertyChange method is called each time the value of any bound - * property is changed. - * @see #removePropertyChangeListener - * @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - changes_.addPropertyChangeListener(listener); - - as400_.addPropertyChangeListener(listener); - } - - //@PDA 550 - clone - /** - * Method to create a clone of AS400JDBCDataSource. This does a shallow - * copy, with the exception of JDProperties, which also gets cloned. - */ - public Object clone() - { - try - { - Trace.log(Trace.INFORMATION, "AS400JDBCDataSource.close()"); - AS400JDBCDataSource clone = (AS400JDBCDataSource) super.clone(); - clone.properties_ = (JDProperties) this.properties_.clone(); - return clone; - } catch (CloneNotSupportedException e) - { // This should never happen. - Trace.log(Trace.ERROR, e); - throw new UnsupportedOperationException("clone()"); - } - } - - /** - * Returns the level of database access for the connection. - * @return The access level. Valid values include: "all" (all SQL statements allowed), - * "read call" (SELECT and CALL statements allowed), and "read only" (SELECT statements only). - * The default value is "all". - **/ - public String getAccess() - { - return properties_.getString(JDProperties.ACCESS); - } - - // @C9 new method - /** - * Returns what behaviors of the Toolbox JDBC driver have been overridden. - * Multiple behaviors can be overridden in combination by adding - * the constants and passing that sum on the setBehaviorOverride() method. - * @return The behaviors that have been overridden. - *

The return value is a combination of the following: - *

    - *
  • 1 - Do not throw an exception if Statement.executeQuery() or - * PreparedStatement.executeQuery() do not return a result set. - * Instead, return null for the result set. - *
- * - **/ - public int getBehaviorOverride() - { - return properties_.getInt(JDProperties.BEHAVIOR_OVERRIDE); - } - - //@B2A - /** - * Returns the output string type of bidi data. See - * BidiStringType for more information and valid values. -1 will be returned - * if the value has not been set. - **/ - public int getBidiStringType() //@B3C - { - String value = properties_.getString(JDProperties.BIDI_STRING_TYPE); //@B3C - try - { //@B3A //@B3A - return Integer.parseInt (value); //@B3A - } //@B3A - catch (NumberFormatException nfe) // if value is "", that is, not set //@B3A - { //@B3A - return -1; //@B3A - } //@B3A - } - - - /** - * Returns the criteria for retrieving data from the system in - * blocks of records. Specifying a non-zero value for this property - * will reduce the frequency of communication to the system, and - * therefore increase performance. - * @return The block criteria. - *

Valid values include: - *

    - *
  • 0 (no record blocking) - *
  • 1 (block if FOR FETCH ONLY is specified) - *
  • 2 (block if FOR UPDATE is specified) - The default value. - *
- **/ - public int getBlockCriteria() - { - return properties_.getInt(JDProperties.BLOCK_CRITERIA); - } - - /** - * Returns the block size in kilobytes to retrieve from the system and - * cache on the client. This property has no effect unless the block criteria - * property is non-zero. Larger block sizes reduce the frequency of - * communication to the system, and therefore may increase performance. - * @return The block size in kilobytes. - *

Valid values include: - *

    - *
  • 0 - *
  • 8 - *
  • 16 - *
  • 32 - The default value. - *
  • 64 - *
  • 128 - *
  • 256 - *
  • 512 - *
- **/ - public int getBlockSize() - { - return properties_.getInt(JDProperties.BLOCK_SIZE); - } - - - /** - * Returns the database connection. - * @return The connection. - * @exception SQLException If a database error occurs. - **/ - public Connection getConnection() throws SQLException - { - //if the object was created with a keyring, or if the user asks for the object - //to be secure, clone a SecureAS400 object; otherwise, clone an AS400 object - if (isSecure_ || isSecure()) //@B4A //@C2C - return getConnection(new SecureAS400(as400_)); //@B4A - else //@B4A - return getConnection(new AS400(as400_)); - } - - - // @J3 Nothing to change here. The password is serialized only when passed on the c'tor - // or via the settors. That is, "bean properties" are affected only when using the - // c'tor specifying system, uid, and pwd, or the settors are used. The bean properties - // are not affected if this method is used, or if the default c'tor is used such - // that our sign-on dialog is used to get system, uid and pwd from the user. - /** - * Returns the database connection using the specified user and password. - * @param user The database user. - * @param password The database password. - * @return The connection - * @exception SQLException If a database error occurs. - **/ - public Connection getConnection(String user, String password) throws SQLException - { - // Validate the parameters. - //@pw3 Add way to get old behavior allowing "" (!but also need to allow new behavior of allowing null is/passwd so customers can slowly migrate) - String secureCurrentUser = SystemProperties.getProperty (SystemProperties.JDBC_SECURE_CURRENT_USER); //@pw3 - boolean isSecureCurrentUser = true; //@pw3 - //if system property or jdbc property is set to false then secure current user code is not used - //null value for system property means not specified...so true by default - if(((secureCurrentUser != null) && (Boolean.valueOf(secureCurrentUser).booleanValue() == false)) || !isSecureCurrentUser()) //@pw3 - isSecureCurrentUser = false; //@pw3 - - boolean forcePrompt = false; //@prompt - - //check if "". - if ("".equals(user)) //@pw1 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (this, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - if ("".equals(password)) //@pw1 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (this, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - - //Next, hack for nulls to work on IBM i - //New security: replace null with "" to mimic old behavior to allow null logons...disallowing "" above. - if (user == null) //@pw1 - user = ""; //@pw1 - if (password == null) //@pw1 - password = ""; //@pw1 - - //check for *current - if (user.compareToIgnoreCase("*CURRENT") == 0) //@pw1 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (this, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 - forcePrompt = true; //@prompt - } //@pw3 - - } //@pw1 - if (password.compareToIgnoreCase("*CURRENT") == 0) //@pw1 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (this, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - - AS400 as400Object; - - //if the object was created with a keyring, or if the user asks for the object - //to be secure, clone a SecureAS400 object; otherwise, clone an AS400 object - if (isSecure_ || isSecure()) //@C2A - { //@C2A - as400Object = new SecureAS400(getServerName(), user, password); //@C2A - } //@C2A - else - { //@C2A //@C2A - as400Object = new AS400(getServerName(), user, password); //@C2A - } //@C2A - - try //@PDA - { //@PDA - if(!as400_.isThreadUsed()) //@PDA - as400Object.setThreadUsed(false); //true by default //@PDA - } catch (PropertyVetoException pve) //@PDA - { /*ignore*/ //@PDA - } //@PDA - - //set gui available on the new object to false if user turned prompting off - try - { //@C2A - if (!isPrompt()) //@C2A - as400Object.setGuiAvailable(false); //@C2A - } //@C2A - catch (PropertyVetoException pve) //@C2A - { /*ignore*/ //@C2A - } //@C2A - - if(forcePrompt) //@prompt - as400Object.forcePrompt(); //@prompt - - return getConnection(as400Object); //@C2A - - //@C2D return getConnection(new AS400(getServerName(), user, password)); - } - - - /** - * Creates the database connection based on the signon and property information. - * @param as400 The AS400 object used to make the connection. - * @exception SQLException If a database error occurs. - **/ - private Connection getConnection(AS400 as400) throws SQLException - { - // Set the socket properties, if there are any, on the AS400 object before making a connection. - if(sockProps_ != null){ - as400.setSocketProperties(sockProps_); - }else - { - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "sockProps_: null"); - } - - AS400JDBCConnection connection = null; - - connection = new AS400JDBCConnection(); - - connection.setSystem(as400); - connection.setProperties(new JDDataSourceURL(TOOLBOX_DRIVER + "//" + as400.getSystemName()), properties_, as400); //@C1C - - log(ResourceBundleLoader.getText("AS400_JDBC_DS_CONN_CREATED")); //@A9C - return connection; - } - - //@cc1 - /** - * This method returns the concurrent access resolution setting. - * This method has no effect on IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @return The concurrent access resolution setting. Possible return valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public int getConcurrentAccessResolution () - { - return properties_.getInt(JDProperties.CONCURRENT_ACCESS_RESOLUTION); - } - - //@C8A - /** - * Returns the value of the cursor sensitivity property. If the resultSetType is - * ResultSet.TYPE_FORWARD_ONLY or ResultSet.TYPE_SCROLL_SENSITIVE, the value of this property - * will control what cursor sensitivity is requested from the database. If the resultSetType - * is ResultSet.TYPE_SCROLL_INSENSITIVE, this property will be ignored. - * @return The cursor sensitivity. - *

Valid values include: - *

    - *
  • "asensitive" - *
  • "insensitive" - *
  • "sensitive" - *
- * The default is "asensitive". - * - * This property is ignored when connecting to systems - * running OS/400 V5R1 and earlier. - **/ - public String getCursorSensitivity() - { - return properties_.getString(JDProperties.CURSOR_SENSITIVITY); - } - - - /** - * Returns the database name property. For more information see - * the documentation for the setDatabaseName() method in this class. - * @return The database name. - **/ - public String getDatabaseName() - { - // @J2d return databaseName_; - return properties_.getString(JDProperties.DATABASE_NAME); // @J2a - } - - /** - * Returns the data source name property. - * This property is used to name an underlying data source when connection pooling is used. - * @return The data source name. - **/ - public String getDataSourceName() - { - return dataSourceName_; - } - - /** - * Returns the IBM i date format used in date literals within SQL statements. - * @return The date format. - *

Valid values include: - *

    - *
  • "mdy" - *
  • "dmy" - *
  • "ymd" - *
  • "usa" - *
  • "iso" - *
  • "eur" - *
  • "jis" - *
  • "julian" - *
  • "" (server job value) - default. - *
- * The default is based on the server job. - **/ - public String getDateFormat() - { - return properties_.getString(JDProperties.DATE_FORMAT); - } - - /** - * Returns the IBM i date separator used in date literals within SQL statements. - * This property has no effect unless the "data format" property is set to: - * "julian", "mdy", "dmy", or "ymd". - * @return The date separator. - *

Valid values include: - *

    - *
  • "/" (slash) - *
  • "-" (dash) - *
  • "." (period) - *
  • "," (comma) - *
  • " " (space) - *
  • "" (server job value) - default. - *
- * The default value is based on the server job. - **/ - public String getDateSeparator() - { - return properties_.getString(JDProperties.DATE_SEPARATOR); - } - - //@DFA - /** - * Returns the decfloat rounding mode. - * @return The decfloat rounding mode. - *

Valid values include: - *

    - *
  • "half even" - default - *
  • "half up" - *
  • "down" - *
  • "ceiling" - *
  • "floor" - *
  • "half down" - *
  • "up" - *
- **/ - public String getDecfloatRoundingMode() - { - return properties_.getString(JDProperties.DECFLOAT_ROUNDING_MODE); - } - - /** - * Returns the IBM i decimal separator used in numeric literals within SQL statements. - * @return The decimal separator. - *

Valid values include: - *

    - *
  • "." (period) - *
  • "," (comma) - *
  • "" (server job value) - default. - *
- * The default value is based on the server job. - **/ - public String getDecimalSeparator() - { - return properties_.getString(JDProperties.DECIMAL_SEPARATOR); - } - - //@igwrn - /** - * Returns the ignore warnings property. - * Specifies a list of SQL states for which the driver should not create warning objects. - * @return The ignore warnings. - **/ - public String getIgnoreWarnings() - { - return properties_.getString(JDProperties.IGNORE_WARNINGS); - } - - - /** - * Returns the description of the data source. - * @return The description. - **/ - public String getDescription() - { - return description_; - } - - // @A2A - /** - * Returns the JDBC driver implementation. - * This property has no - * effect if the "secondary URL" property is set. - * This property cannot be set to "native" if the - * environment is not an IBM i Java Virtual Machine. - *

Valid values include: - *

    - *
  • "toolbox" (use the IBM Toolbox for Java JDBC driver) - *
  • "native" (use the IBM Developer Kit for Java JDBC driver) - *
- * The default value is "toolbox". - * Note: Not supported in a connection pool. - **/ - public String getDriver() - { - return properties_.getString(JDProperties.DRIVER); - } - - /** - * Returns the amount of detail for error messages originating from - * the IBM i system. - * @return The error message level. - * Valid values include: "basic" and "full". The default value is "basic". - **/ - public String getErrors() - { - return properties_.getString(JDProperties.ERRORS); - } - - /** - * Returns the IBM i system libraries to add to the server job's library list. - * The libraries are delimited by commas or spaces, and - * "*LIBL" may be used as a place holder for the server job's - * current library list. The library list is used for resolving - * unqualified stored procedure calls and finding schemas in - * DatabaseMetaData catalog methods. If "*LIBL" is not specified, - * the specified libraries will replace the server job's current library list. - * @return The library list. - **/ - public String getLibraries() - { - return properties_.getString(JDProperties.LIBRARIES); - } - - /** - * Returns the maximum LOB (large object) size in bytes that - * can be retrieved as part of a result set. LOBs that are larger - * than this threshold will be retrieved in pieces using extra - * communication to the system. Larger LOB thresholds will reduce - * the frequency of communication to the system, but will download - * more LOB data, even if it is not used. Smaller LOB thresholds may - * increase frequency of communication to the system, but will only - * download LOB data as it is needed. - * @return The lob threshold. Valid range is 0-16777216. - * The default value is 32768. - **/ - public int getLobThreshold() - { - return properties_.getInt(JDProperties.LOB_THRESHOLD); - } - - /** - * Returns the timeout value in seconds. - * Note: This value is not used or supported. - * The timeout value is determined by the IBM i system. - * @return the maximum time in seconds that this data source can wait while attempting to connect to a database. - **/ - public int getLoginTimeout() - { - return properties_.getInt(JDProperties.LOGIN_TIMEOUT); - } - - /** - * Returns the log writer for this data source. - * @return The log writer for this data source. - * @exception SQLException If a database error occurs. - **/ - public PrintWriter getLogWriter() throws SQLException - { - return writer_; - } - - //@PDA - /** - * Indicates how to retrieve DatabaseMetaData. - * If set to 0, database metadata will be retrieved through the ROI data flow. - * If set to 1, database metadata will be retrieved by calling system stored procedures. - * The methods that currently are available through stored procedures are: - * getColumnPrivileges - * @return the metadata setting. - * The default value is 1. - **/ - public int getMetaDataSource() - { - return properties_.getInt(JDProperties.METADATA_SOURCE); - } - - //@dup - /** - * Indicates how to retrieve DatabaseMetaData. - * If set to 0, database metadata will be retrieved through the ROI data flow. - * If set to 1, database metadata will be retrieved by calling system stored procedures. - * The methods that currently are available through stored procedures are: - * getColumnPrivileges - * @return the metadata setting. - * The default value is 1. - * Note: this method is the same as getMetaDataSource() so that it corresponds to the connection property name - **/ - public int getMetadataSource() - { - return getMetaDataSource(); - } - - /** - * Returns the naming convention used when referring to tables. - * @return The naming convention. Valid values include: "sql" (e.g. schema.table) - * and "system" (e.g. schema/table). The default value is "sql". - **/ - public String getNaming() - { - return properties_.getString(JDProperties.NAMING); - } - - /** - * Returns the base name of the SQL package. Note that only the - * first six characters are used to generate the name of the SQL package on the system. - * This property has no effect unless - * the extended dynamic property is set to true. In addition, this property - * must be set if the extended dynamic property is set to true. - * @return The base name of the SQL package. - **/ - public String getPackage() - { - return properties_.getString(JDProperties.PACKAGE); - } - - /** - * Returns the type of SQL statement to be stored in the SQL package. This can - * be useful to improve the performance of complex join conditions. This - * property has no effect unless the extended dynamic property is set to true. - * @return The type of SQL statement. - * Valid values include: "default" (only store SQL statements with parameter - * markers in the package) and "select" (store all SQL SELECT statements - * in the package). The default value is "default". - **/ - public String getPackageCriteria() - { - return properties_.getString(JDProperties.PACKAGE_CRITERIA); - } - - /** - * Returns the action to take when SQL package errors occur. When an SQL package - * error occurs, the driver will optionally throw an SQLException or post a - * warning to the Connection, based on the value of this property. This property - * has no effect unless the extended dynamic property is set to true. - * @return The action to take when SQL errors occur. - * Valid values include: "exception", "warning", and "none". The default value is "warning". - **/ - public String getPackageError() - { - return properties_.getString(JDProperties.PACKAGE_ERROR); - } - /** - * Returns the library for the SQL package. This property has no effect unless - * the extended dynamic property is set to true. - * @return The SQL package library. The default package library is "QGPL". - **/ - public String getPackageLibrary() - { - return properties_.getString(JDProperties.PACKAGE_LIBRARY); - } - - /** - * Returns the name of the proxy server. - * @return The proxy server. - **/ - public String getProxyServer() - { - return properties_.getString(JDProperties.PROXY_SERVER); - } - - /** - * Returns the Reference object for the data source object. - * This is used by JNDI when bound in a JNDI naming service. - * Contains the information necessary to reconstruct the data source - * object when it is later retrieved from JNDI via an object factory. - * - * @return A Reference object of the data source object. - * @exception NamingException If a naming error occurs in resolving the object. - **/ - public Reference getReference() throws NamingException - { - - Trace.log(Trace.INFORMATION, "AS400JDBCDataSource.getReference"); - - Reference ref = new Reference(this.getClass().getName(), - "com.ibm.as400.access.AS400JDBCObjectFactory", - null); - - // Add the JDBC properties. - DriverPropertyInfo[] propertyList = properties_.getInfo(); - for (int i=0; i< propertyList.length; i++) - { - if (propertyList[i].value != null) - ref.add(new StringRefAddr(propertyList[i].name, propertyList[i].value)); - } - - // Add the Socket options - if (sockProps_.keepAliveSet_) ref.add(new StringRefAddr(SOCKET_KEEP_ALIVE, (sockProps_.keepAlive_ ? "true" : "false"))); - if (sockProps_.receiveBufferSizeSet_) ref.add(new StringRefAddr(SOCKET_RECEIVE_BUFFER_SIZE, Integer.toString(sockProps_.receiveBufferSize_))); - if (sockProps_.sendBufferSizeSet_) ref.add(new StringRefAddr(SOCKET_SEND_BUFFER_SIZE, Integer.toString(sockProps_.sendBufferSize_))); - if (sockProps_.soLingerSet_) ref.add(new StringRefAddr(SOCKET_LINGER, Integer.toString(sockProps_.soLinger_))); - if (sockProps_.soTimeoutSet_) ref.add(new StringRefAddr(SOCKET_TIMEOUT, Integer.toString(sockProps_.soTimeout_))); - if (sockProps_.loginTimeoutSet_) ref.add(new StringRefAddr(SOCKET_LOGIN_TIMEOUT, Integer.toString(sockProps_.loginTimeout_))); //@st3 - if (sockProps_.tcpNoDelaySet_) ref.add(new StringRefAddr(SOCKET_TCP_NO_DELAY, (sockProps_.tcpNoDelay_ ? "true" : "false"))); - - // Add the data source properties. (unique constant identifiers for storing in JNDI). - if (getDatabaseName() != null) - ref.add(new StringRefAddr(DATABASE_NAME, getDatabaseName())); - if (getDataSourceName() != null) - ref.add(new StringRefAddr(DATASOURCE_NAME, getDataSourceName())); - if (getDescription() != null) - ref.add(new StringRefAddr(DESCRIPTION, getDescription())); - ref.add(new StringRefAddr(SERVER_NAME, getServerName())); - ref.add(new StringRefAddr(USER, getUser())); - ref.add(new StringRefAddr(KEY_RING_NAME, serialKeyRingName_)); // @F0A - if (savePasswordWhenSerialized_) { // @F0A - ref.add(new StringRefAddr(PASSWORD, new String(serialPWBytes_))); // @F0A - if (serialKeyRingPWBytes_ != null) // @F0A - ref.add(new StringRefAddr(KEY_RING_PASSWORD, new String(serialKeyRingPWBytes_))); // @F0A - else // @F0A - ref.add(new StringRefAddr(KEY_RING_PASSWORD, null)); // @F0A - } // @F0A - ref.add(new StringRefAddr(SECURE, (isSecure_ ? TRUE_ : FALSE_))); // @F0A - ref.add(new StringRefAddr(SAVE_PASSWORD, (savePasswordWhenSerialized_ ? TRUE_ : FALSE_))); // @F0A - - return ref; - } - - /** - * Returns the source of the text for REMARKS columns in ResultSets returned - * by DatabaseMetaData methods. - * @return The text source. - * Valid values include: "sql" (SQL object comment) and "system" (IBM i object description). - * The default value is "system". - **/ - public String getRemarks() - { - return properties_.getString(JDProperties.REMARKS); - } - - /** - * Returns the secondary URL. - * @return The secondary URL. - **/ - public String getSecondaryUrl() - { - return properties_.getString(JDProperties.SECONDARY_URL); - } - - //@dup - /** - * Returns the secondary URL. - * @return The secondary URL. - * Note: this method is the same as setSecondaryUrl() so that it corresponds to the connection property name - **/ - public String getSecondaryURL() - { - return getSecondaryUrl(); - } - - - /** - * Returns the name of the IBM i system. - * @return The system name. - **/ - public String getServerName() - { - return as400_.getSystemName(); - } - - - // @j1 new method - /** - * Returns the level of tracing started on the JDBC server job. - * If tracing is enabled, tracing is started when - * the client connects to the system and ends when the connection - * is disconnected. Tracing must be started before connecting to - * the system since the client enables system tracing only at connect time. - * Trace data is collected in spooled files on the system. Multiple - * levels of tracing can be turned on in combination by adding - * the constants and passing that sum on the set method. For example, - *
-    *  dataSource.setServerTraceCategories(AS400JDBCDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
-    *  
- * @return The tracing level. - *

The value is a combination of the following: - *

    - *
  • SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job. - * The numeric value of this constant is 2. - *
  • SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job. - * The numeric value of this constant is 4. - *
  • SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends. - * The numeric value of this constant is 8. - *
  • SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job. - * The numeric value of this constant is 16. - *
  • SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information. - * The numeric value of this constant is 32. - *
- * - *

- * Tracing the JDBC server job will use significant amounts of system resources. - * Additional processor resource is used to collect the data, and additional - * storage is used to save the data. Turn on tracing only to debug - * a problem as directed by IBM service. - * - **/ - public int getServerTraceCategories() - { - return properties_.getInt(JDProperties.TRACE_SERVER); - } - - //@dup - /** - * Returns the level of tracing started on the JDBC server job. - * If tracing is enabled, tracing is started when - * the client connects to the system and ends when the connection - * is disconnected. Tracing must be started before connecting to - * the system since the client enables system tracing only at connect time. - * Trace data is collected in spooled files on the system. Multiple - * levels of tracing can be turned on in combination by adding - * the constants and passing that sum on the set method. For example, - *

-     *  dataSource.setServerTraceCategories(AS400JDBCDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
-     *  
- * @return The tracing level. - *

The value is a combination of the following: - *

    - *
  • SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job. - * The numeric value of this constant is 2. - *
  • SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job. - * The numeric value of this constant is 4. - *
  • SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends. - * The numeric value of this constant is 8. - *
  • SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job. - * The numeric value of this constant is 16. - *
  • SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information. - * The numeric value of this constant is 32. - *
- * - *

- * Tracing the JDBC server job will use significant amounts of system resources. - * Additional processor resource is used to collect the data, and additional - * storage is used to save the data. Turn on tracing only to debug - * a problem as directed by IBM service. - * - * Note: this method is the same as getServerTraceCategories() so that it corresponds to the connection property name - **/ - public int getServerTrace() - { - return getServerTraceCategories(); - } - - //@STIMEOUT - /** - * Gets the socket timeout option in milliseconds. - * @return The value of the socket timeout option. - **/ - public int getSocketTimeout() - { - return getSoTimeout(); - } - - /** - * Returns how the system sorts records before sending them to the - * client. - * @return The sort value. - *

Valid values include: - *

    - *
  • "hex" (base the sort on hexadecimal values) - *
  • "language" (base the sort on the language set in the sort language property) - *
  • "table" (base the sort on the sort sequence table set in the sort table property) - *
- * The default value is "hex". - **/ - public String getSort() - { - return properties_.getString(JDProperties.SORT); - } - - /** - * Returns the three-character language id to use for selection of a sort sequence. - * @return The three-character language id. - * The default value is ENU. - **/ - public String getSortLanguage() - { - return properties_.getString(JDProperties.SORT_LANGUAGE); - } - - /** - * Returns the library and file name of a sort sequence table stored on the - * system. - * @return The qualified sort table name. - **/ - public String getSortTable() - { - return properties_.getString(JDProperties.SORT_TABLE); - } - - /** - * Returns how the system treats case while sorting records. - * @return The sort weight. - * Valid values include: "shared" (upper- and lower-case characters are sorted as the - * same character) and "unique" (upper- and lower-case characters are sorted as - * different characters). The default value is "shared". - **/ - public String getSortWeight() - { - return properties_.getString(JDProperties.SORT_WEIGHT); - } - - /** - * Returns the time format used in time literals with SQL statements. - * @return The time format. - *

Valid values include: - *

    - *
  • "hms" - *
  • "usa" - *
  • "iso" - *
  • "eur" - *
  • "jis" - *
  • "" (server job value) - default. - *
- * The default value is based on the server job. - **/ - public String getTimeFormat() - { - return properties_.getString(JDProperties.TIME_FORMAT); - } - - /** - * Returns the time separator used in time literals within SQL - * statements. - * @return The time separator. - *

Valid values include: - *

    - *
  • ":" (colon) - *
  • "." (period) - *
  • "," (comma) - *
  • " " (space) - *
  • "" (server job value) - default. - *
- * The default value is based on the server job. - **/ - public String getTimeSeparator() - { - return properties_.getString(JDProperties.TIME_SEPARATOR); - } - - - /** - * Returns the system's transaction isolation. - * @return The transaction isolation level. - *

Valid values include: - *

    - *
  • "none" - *
  • "read uncommitted" - The default value. - *
  • "read committed" - *
  • "repeatable read" - *
  • "serializable" - *
- **/ - public String getTransactionIsolation() - { - return properties_.getString(JDProperties.TRANSACTION_ISOLATION); - } - - - // @J3 No change needeadd code here. UID already properly serialized - /** - * Returns the database user property. - * @return The user. - **/ - public String getUser() - { - return as400_.getUserId(); - } - - // @K3A - /** - * Returns the QAQQINI library name. - * @return The QAQQINI library name. - **/ - public String getQaqqiniLibrary() - { - return properties_.getString(JDProperties.QAQQINILIB); - } - - //@dup - /** - * Returns the QAQQINI library name. - * @return The QAQQINI library name. - * Note: this method is the same as getQaqqiniLibrary() so that it corresponds to the connection property name - **/ - public String getQaqqinilib() - { - return getQaqqiniLibrary(); - } - - - //@540 - /** - * Returns the goal the IBM i system should use with optimization of queries. - * @return the goal the IBM i system should use with optimization of queries. - *

Valid values include: - *

    - *
  • 0 = Optimize query for first block of data (*ALLIO) when extended dynamic packages are used; Optimize query for entire result set (*FIRSTIO) when packages are not used
  • - *
  • 1 = Optimize query for first block of data (*FIRSTIO)
  • - *
  • 2 = Optimize query for entire result set (*ALLIO)
  • - *
- * The default value is 0. - **/ - public int getQueryOptimizeGoal() - { - return properties_.getInt(JDProperties.QUERY_OPTIMIZE_GOAL); - } - - //@550 - /** - * Returns the storage limit in megabytes, that should be used for statements executing a query in a connection. - * Note, this setting is ignored when running to i5/OS V5R4 or earlier - * You must have *JOBCTL special authority to use query storage limit with Version 6 Release 1 of IBM i. - *

Valid values are -1 to MAX_STORAGE_LIMIT megabytes. - * The default value is -1 meaning there is no limit. - **/ - public int getQueryStorageLimit() - { - return properties_.getInt(JDProperties.QUERY_STORAGE_LIMIT); - } - - //@540 - /** - * Indicates whether lock sharing is allowed for loosely coupled transaction branches. - * @return the lock sharing setting. - *

Valid values include: - *

    - *
  • 0 = Locks cannot be shared
  • - *
  • 1 = Locks can be shared
  • - *
- * The default value is 0. - **/ - public int getXALooselyCoupledSupport() - { - return properties_.getInt(JDProperties.XA_LOOSELY_COUPLED_SUPPORT); - } - - /** - * Initializes the transient data for object de-serialization. - **/ - private void initializeTransient() - { - Trace.log(Trace.INFORMATION, "AS400JDBCDataSource.initializeTransient"); - - changes_ = new PropertyChangeSupport(this); - - if (isSecure_) //@B4A - as400_ = new SecureAS400(); //@B4A - else //@B4A - as400_ = new AS400(); - - // Reinitialize the serverName, user, password, keyRingName, etc. - if (serialServerName_ != null) - setServerName(serialServerName_); - - if (serialUserName_ != null) - { // @J3a - setUser(serialUserName_); - - if ((serialPWBytes_ != null) && // @J3a - (serialPWBytes_.length > 0)) // @J3a - { // @J3a - as400_.setPassword(xpwDeconfuse(serialPWBytes_)); // @J3a - } // @J3a - } - - try - { - if (serialKeyRingName_ != null && isSecure_) //@B4A - { //@J3a - if ((serialKeyRingPWBytes_ != null) && //@J3a - (serialKeyRingPWBytes_.length > 0)) //@J3a - { //@J3a - String keyRingPassword = xpwDeconfuse(serialKeyRingPWBytes_); // @J3a - ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_, keyRingPassword); //@J3A - } //@J3a - else - { //@J3a //@J3a - ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_); //@B4A - } //@J3a - } //@J3a - } - catch (PropertyVetoException pve) - { /* Will never happen */ - } - - // @J4 Make sure the prompt flag is correctly de-serialized. The problem was - // the flag would get serialized with the rest of the properties - // (in the properties_ object), but the flag would never be applied - // to the AS400 object when de-serialzed. De-serialization puts the - // flag back in properties_ but that does no good unless the value - // is passed on to the AS400 object. That is what the new code does. - // There is no affect on normal "new" objects since at the time this - // method is called properties_ is null. - try - { //@J4A //@J4A - if (properties_ != null) //@J4A - if (!isPrompt()) //@J4A - as400_.setGuiAvailable(false); //@J4A - } //@J4A - catch (PropertyVetoException pve) //@J4A - { /* Will never happen */ //@J4A - } //@J4A - - } - - //@KBA - /** - * Indicates whether true auto commit support is used. - * @return true if true auto commit support is used; false otherwise. - * The default value is false. - **/ - public boolean isTrueAutoCommit() - { - return properties_.getBoolean(JDProperties.TRUE_AUTO_COMMIT); //@true - } - - //@dup - /** - * Indicates whether true auto commit support is used. - * @return true if true auto commit support is used; false otherwise. - * The default value is false. - * Note: this method is the same as isTrueAutoCommit() so that it corresponds to the connection property name - **/ - public boolean isTrueAutocommit() - { - return isTrueAutoCommit(); - } - - - //@K54 - /** - * Indicates whether variable-length fields are compressed. - * @return true if variable-length fields are compressed; false otherwise. - * The default value is true. - **/ - public boolean isVariableFieldCompression() - { - return properties_.getBoolean(JDProperties.VARIABLE_FIELD_COMPRESSION); - } - - //@AC1 - /** - * Returns whether auto-commit mode is the default connection mode for new connections. - * @return Auto commit. - * The default value is true. - **/ - public boolean isAutoCommit() - { - return properties_.getBoolean(JDProperties.AUTO_COMMIT); - } - - //@CE1 - /** - * Returns whether commit or rollback throws SQLException when autocommit is enabled. - * @return Autocommit Exception. - * The default value is false. - **/ - public boolean isAutocommitException() - { - return properties_.getBoolean(JDProperties.AUTOCOMMIT_EXCEPTION); - } - - //@K24 - /** - * Indicates whether bidi implicit reordering is used. - * @return true if bidi implicit reordering is used; false otherwise. - * The default value is true. - **/ - public boolean isBidiImplicitReordering() - { - return properties_.getBoolean(JDProperties.BIDI_IMPLICIT_REORDERING); - } - - //@K24 - /** - * Indicates whether bidi numeric ordering round trip is used. - * @return true if bidi numeric ordering round trip is used; false otherwise. - * The default value is false. - **/ - public boolean isBidiNumericOrdering() - { - return properties_.getBoolean(JDProperties.BIDI_NUMERIC_ORDERING); - } - - /** - * Indicates whether a big decimal value is returned. - * @return true if a big decimal is returned; false otherwise. - * The default value is true. - **/ - public boolean isBigDecimal() - { - return properties_.getBoolean(JDProperties.BIG_DECIMAL); - } - - /** - * Indicates whether the cursor is held. - * @return true if the cursor is held; false otherwise. - * The default value is true. - **/ - public boolean isCursorHold() - { - return properties_.getBoolean(JDProperties.CURSOR_HOLD); - } - - /** - * Indicates whether data compression is used. - * @return true if data compression is used; false otherwise. - * The default value is true. - **/ - public boolean isDataCompression() - { - return properties_.getBoolean(JDProperties.DATA_COMPRESSION); - } - - /** - * Indicates whether data truncation is used. - * @return true if data truncation is used; false otherwise. - * The default value is true. - **/ - public boolean isDataTruncation() - { - return properties_.getBoolean(JDProperties.DATA_TRUNCATION); - } - - /** - * Indicates whether extended dynamic support is used. Extended dynamic - * support provides a mechanism for caching dynamic SQL statements on - * the system. The first time a particular SQL statement is prepared, it is - * stored in an SQL package on the system. - * If the package does not exist, it will be automatically created. - * On subsequent prepares of the - * same SQL statement, the system can skip a significant part of the - * processing by using information stored in the SQL package. - * @return true if extended dynamic support is used; false otherwise. - * The default value is not to use extended dynamic support. - **/ - public boolean isExtendedDynamic() - { - return properties_.getBoolean(JDProperties.EXTENDED_DYNAMIC); - } - - - // @C3A - /** - * Indicates whether the driver should request extended metadata from the - * IBM i system. If this property is set to true, the accuracy of the information - * that is returned from ResultSetMetaData methods getColumnLabel(int), - * isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased. - * In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this - * property set to true. However, performance will be slower with this - * property on. Leave this property set to its default (false) unless you - * need more specific information from those methods. - * - * For example, without this property turned on, isSearchable(int) will - * always return true even though the correct answer may be false because - * the driver does not have enough information from the system to make a judgment. Setting - * this property to true forces the driver to get the correct data from the IBM i system. - * - * @return true if extended metadata will be requested; false otherwise. - * The default value is false. - **/ - - public boolean isExtendedMetaData() - { - return properties_.getBoolean(JDProperties.EXTENDED_METADATA); - } - - //@dup - /** - * Indicates whether the driver should request extended metadata from the - * IBM i system. If this property is set to true, the accuracy of the information - * that is returned from ResultSetMetaData methods getColumnLabel(int), - * isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased. - * In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this - * property set to true. However, performance will be slower with this - * property on. Leave this property set to its default (false) unless you - * need more specific information from those methods. - * - * For example, without this property turned on, isSearchable(int) will - * always return true even though the correct answer may be false because - * the driver does not have enough information from the system to make a judgment. Setting - * this property to true forces the driver to get the correct data from the IBM i system. - * - * @return true if extended metadata will be requested; false otherwise. - * The default value is false. - * Note: this method is the same as isExtendedMetaData() so that it corresponds to the connection property name - **/ - - public boolean isExtendedMetadata() - { - return isExtendedMetaData(); - } - - - // @W1a - /** - * Indicates whether the IBM i system fully opens a file when performing a query. - * By default the system optimizes opens so they perform better. In - * certain cases an optimized open will fail. In some - * cases a query will fail when a database performance monitor - * is turned on even though the same query works with the monitor - * turned off. In this case set the full open property to true. - * This disables optimization on the system. - * @return true if files are fully opened; false otherwise. - * The default value is false. - **/ - public boolean isFullOpen() - { - return properties_.getBoolean(JDProperties.FULL_OPEN); - } - - //@dmy - /** - * Indicates whether the temporary fix for JVM 1.6 is enabled. - * @return true if enabled; false otherwise. - * The default value is true. - **/ - public boolean isJvm16Synchronize() - { - return properties_.getBoolean(JDProperties.JVM16_SYNCHRONIZE); - } - - // @A1A - /** - * Indicates whether to delay closing cursors until subsequent requests. - * @return true to delay closing cursors until subsequent requests; false otherwise. - * The default value is false. - **/ - public boolean isLazyClose() - { - return properties_.getBoolean(JDProperties.LAZY_CLOSE); - } - - //@KBL - /** - * Indicates whether input locators are of type hold. - * @return true if input locators are of type hold; false otherwise. - * The default value is true. - **/ - public boolean isHoldInputLocators() - { - return properties_.getBoolean(JDProperties.HOLD_LOCATORS); - } - - /** - * Indicates whether to add newly prepared statements to the - * SQL package specified on the "package" property. This property - * has no effect unless the extended dynamic property is set to true; - * @return true If newly prepared statements should be added to the SQL package specified - * on the "package" property; false otherwise. - * The default value is true. - **/ - public boolean isPackageAdd() - { - return properties_.getBoolean(JDProperties.PACKAGE_ADD); - } - - /** - * Indicates whether a subset of the SQL package information is cached in client memory. - * Caching SQL packages locally - * reduces the amount of communication to the IBM i system for prepares and describes. This - * property has no effect unless the extended dynamic property is set to true. - * @return true if caching is used; false otherwise. - * The defalut value is false. - **/ - public boolean isPackageCache() - { - return properties_.getBoolean(JDProperties.PACKAGE_CACHE); - } - - //@C6D Deprecated method. - /** - * Indicates whether SQL packages are cleared when they become full. This method - * has been deprecated. Package clearing and the decision for the - * threshold where package clearing is needed is now handled - * automatically by the database. - * @return Always false. This method is deprecated. - * @deprecated - **/ - public boolean isPackageClear() - { - //@C6D return properties_.getBoolean(JDProperties.PACKAGE_CLEAR); - return false; //@C6A - } - - /** - * Indicates whether data is prefetched upon executing a SELECT statement. - * This will increase performance when accessing the initial rows in the result set. - * @return If prefetch is used; false otherwise. - * The default value is prefetch data. - **/ - public boolean isPrefetch() - { - return properties_.getBoolean(JDProperties.PREFETCH); - } - - /** - * Indicates whether the user is prompted if a user name or password is - * needed to connect to the IBM i system. If a connection can not be made - * without prompting the user, and this property is set to false, then an - * attempt to connect will fail throwing an exception. - * @return true if the user is prompted for signon information; false otherwise. - * The default value is false. - **/ - public boolean isPrompt() - { - return properties_.getBoolean(JDProperties.PROMPT); - } - - //@K94 - /** - * Indicates whether the cursor is held after a rollback. - * @return true if the cursor is held; false otherwise. - * The default value is false. - **/ - public boolean isRollbackCursorHold() - { - return properties_.getBoolean(JDProperties.ROLLBACK_CURSOR_HOLD); - } - - //@KBL - /** - * Indicates whether statements remain open until a transaction boundary when autocommit is off and they - * are associated with Lob locators. - * @return true if statements are only closed at transaction boundaries; false otherwise. - * The default value is false. - **/ - public boolean isHoldStatements() - { - return properties_.getBoolean(JDProperties.HOLD_STATEMENTS); - } - - // @J3 new method - /** - * Indicates whether the password is saved locally with the rest of - * the properties when this data source object is serialized. - *

- * If the password is saved, it is up to the application to protect - * the serialized form of the object because it contains all necessary - * information to connect to the IBM i system. The default is false. It - * is a security risk to save the password with the rest of the - * properties so by default the password is not saved. If the programmer - * chooses to accept this risk, call setSavePasswordWhenSerialized(true) - * to force the Toolbox to save the password with the other properties - * when the data source object is serialized. - * @return true if the password is saved with the rest of the properties when the - * data source object is serialized; false otherwise. - * The default value is false. - **/ - public boolean isSavePasswordWhenSerialized() - { - return savePasswordWhenSerialized_; - } - - - - - - /** - * Indicates whether a Secure Socket Layer (SSL) connection is used to communicate - * with the IBM i system. SSL connections are only available when connecting to systems - * at V4R4 or later. - * @return true if Secure Socket Layer connection is used; false otherwise. - * The default value is false. - **/ - public boolean isSecure() - { - return properties_.getBoolean(JDProperties.SECURE); - } - - //@pw3 - /** - * Returns the secure current user setting. True indicates to disallow "" and *current for user name and password. - * @return The secure current user setting. - **/ - public boolean isSecureCurrentUser() - { - return properties_.getBoolean(JDProperties.SECURE_CURRENT_USER); - } - - /** - * Indicates whether a thread is used. - * @return true if a thread is used; false otherwise. - * The default value is true. - **/ - public boolean isThreadUsed() - { - return properties_.getBoolean(JDProperties.THREAD_USED); - } - - /** - * Indicates whether trace messages should be logged. - * @return true if trace message are logged; false otherwise. - * The default value is false. - **/ - public boolean isTrace() - { - return properties_.getBoolean(JDProperties.TRACE); - } - - /** - * Indicates whether binary data is translated. If this property is set - * to true, then BINARY and VARBINARY fields are treated as CHAR and - * VARCHAR fields. - * @return true if binary data is translated; false otherwise. - * The default value is false. - **/ - public boolean isTranslateBinary() - { - return properties_.getBoolean(JDProperties.TRANSLATE_BINARY); - } - - //@PDA - /** - * Indicates how Boolean objects are interpreted when setting the value - * for a character field/parameter using the PreparedStatement.setObject(), - * CallableStatement.setObject() or ResultSet.updateObject() methods. Setting the - * property to "true", would store the Boolean object in the character field as either - * "true" or "false". Setting the property to "false", would store the Boolean object - * in the character field as either "1" or "0". - * @return true if boolean data is translated; false otherwise. - * The default value is true. - **/ - public boolean isTranslateBoolean() - { - return properties_.getBoolean(JDProperties.TRANSLATE_BOOLEAN); - } - - - /** - * Indicates whether blocking is used for update and delete operations - * @return true if enabled; false otherwise. - * The default value is false. - **/ - public boolean isUseBlockUpdate() - { - return properties_.getBoolean(JDProperties.DO_UPDATE_DELETE_BLOCKING); - } - - - /** - * Logs a message to the event log. - * @param message The message to log. - **/ - void log(String message) - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, message); - - if (log_ != null) - log_.log(message); - } - - /** - * Logs an exception and message to the event log. - * @param property The property to log. - * @param value The property value to log. - **/ - private void logProperty(String property, String value) - { - if (Trace.isTraceOn()) - JDTrace.logProperty (this, property, value); - - //@A8D if (log_ != null) - //@A8D log_.log(property + ": " + value); - } - - /** - * Deserializes and initializes transient data. - * @exception ClassNotFoundException If the class cannot be found. - * @exception IOException If an I/O exception occurs. - **/ - private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException - { - in.defaultReadObject(); - initializeTransient(); - } - - /** - * Removes the PropertyChangeListener. - * If the PropertyChangeListener is not in the list, nothing is done. - * @param listener The PropertyChangeListener. - * @see #addPropertyChangeListener - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - changes_.removePropertyChangeListener(listener); - - as400_.removePropertyChangeListener(listener); //@K1C changed to removePropertyChangeListener instead of addPropertyChangeListener - } - - /** - * Sets the level of database access for the connection. - * @param access The access level. - *

Valid values include: - *

    - *
  • "all" (all SQL statements allowed) - *
  • "read call" (SELECT and CALL statements allowed) - *
  • "read only" (SELECT statements only) - *
- * The default value is "all". - **/ - public void setAccess(String access) - { - String property = "access"; - - if (access == null) - throw new NullPointerException(property); - validateProperty(property, access, JDProperties.ACCESS); - - String old = getAccess(); - properties_.setString(JDProperties.ACCESS, access); - - changes_.firePropertyChange(property, old, access); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + access); //@A8C - } - - //@AC1 - /** - * Sets whether auto-commit mode is the default connection mode for new connections. - * @param value - * The default value is true. - **/ - public void setAutoCommit(boolean value) - { - String property = "autoCommit"; - Boolean oldValue = new Boolean(isAutoCommit()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.AUTO_COMMIT, TRUE_); - else - properties_.setString(JDProperties.AUTO_COMMIT, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - //@CE1 - /** - * Sets whether commit or rollback throws SQLException when autocommit is enabled. - * @param value - * The default value is false. - **/ - public void setAutocommitException(boolean value) - { - String property = "autocommitException"; - Boolean oldValue = new Boolean(isAutocommitException()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.AUTOCOMMIT_EXCEPTION, TRUE_); - else - properties_.setString(JDProperties.AUTOCOMMIT_EXCEPTION, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - //@KBA - /** - * Sets whether true auto commit support is used. - * @param value true if true auto commit support should be used; false otherwise. - * The default value is false. - **/ - public void setTrueAutoCommit(boolean value) - { - String property = "trueAutoCommit"; - Boolean oldValue = new Boolean(isTrueAutoCommit()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.TRUE_AUTO_COMMIT, TRUE_); //@true - else - properties_.setString(JDProperties.TRUE_AUTO_COMMIT, FALSE_); //@true - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - //@dup - /** - * Sets whether true auto commit support is used. - * @param value true if true auto commit support should be used; false otherwise. - * The default value is false. - * Note: this method is the same as setTrueAutoCommit() so that it corresponds to the connection property nameproperty name - **/ - public void setTrueAutocommit(boolean value) - { - setTrueAutoCommit(value); - } - - - // @C9 new method - /** - * Sets the Toolbox JDBC Driver behaviors to override. Multiple - * behaviors can be changed in combination by adding - * the constants and passing that sum on the this method. - * @param behaviors The driver behaviors to override. - *

Valid values include: - *

    - *
  • 1 - Do not throw an exception if Statement.executeQuery() or - * PreparedStatement.executeQuery() do not return a result set. - * Instead, return null for the result set. - *
- * - * Carefully consider the result of overriding the default behavior of the - * driver. For example, setting the value of this property to 1 means - * the driver will no longer throw an exception even though the JDBC 3.0 - * specification states throwing an exception is the correct behavior. - * Be sure your application correctly handles the altered behavior. - * - **/ - public void setBehaviorOverride(int behaviors) - { - String property = "behaviorOverride"; - - Integer oldValue = new Integer(getBehaviorOverride()); - Integer newValue = new Integer(behaviors); - - properties_.setString(JDProperties.BEHAVIOR_OVERRIDE, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + behaviors); - } - - - - - //@B2A - /** - * Sets the output string type of bidi data. See - * BidiStringType for more information and valid values. - **/ - public void setBidiStringType(int bidiStringType) //@B3C - { - String property = "bidiStringType"; //@B3C - - //@B3D if (bidiStringType == null) - //@B3D throw new NullPointerException(property); - Integer oldBidiStringType = new Integer(getBidiStringType()); //@B3A - Integer newBidiStringType = new Integer(bidiStringType); //@B3A - - validateProperty(property, newBidiStringType.toString(), JDProperties.BIDI_STRING_TYPE); //@B3C - - properties_.setString(JDProperties.BIDI_STRING_TYPE, newBidiStringType.toString()); //@B3C - - changes_.firePropertyChange(property, oldBidiStringType, newBidiStringType); //@B3C - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + bidiStringType); - } - - //@K24 - /** - * Sets whether bidi implicit reordering is used. - * In this version, the parameter is used to determine whether Bidi layout - * transformation should be applied to meta-data such as columns names. - * @param value true if implicit reordering should be used; false otherwise. - * The default value is true. - **/ - public void setBidiImplicitReordering(boolean value) - { - String property = "bidiImplicitReordering"; - Boolean oldValue = new Boolean(isBidiImplicitReordering()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.BIDI_IMPLICIT_REORDERING, TRUE_); - else - properties_.setString(JDProperties.BIDI_IMPLICIT_REORDERING, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - //@K24 - /** - * Sets whether bidi numeric ordering round trip is used. - * @param value true if numeric ordering round trip should be used; false otherwise. - * The default value is false. - **/ - public void setBidiNumericOrdering(boolean value) - { - String property = "bidiNumericOrdering"; - Boolean oldValue = new Boolean(isBidiNumericOrdering()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.BIDI_NUMERIC_ORDERING, TRUE_); - else - properties_.setString(JDProperties.BIDI_NUMERIC_ORDERING, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - /** - * Sets whether a big decimal value is returned. - * @param value true if a big decimal is returned; false otherwise. - * The default value is true. - **/ - public void setBigDecimal(boolean value) - { - String property = "bigDecimal"; - Boolean oldValue = new Boolean(isBigDecimal()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.BIG_DECIMAL, TRUE_); - else - properties_.setString(JDProperties.BIG_DECIMAL, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + value); //@A8C - } - - /** - * Sets the criteria for retrieving data from the IBM i system in - * blocks of records. Specifying a non-zero value for this property - * will reduce the frequency of communication to the system, and - * therefore increase performance. - * @param blockCriteria The block criteria. - *

Valid values include: - *

    - *
  • 0 (no record blocking) - *
  • 1 (block if FOR FETCH ONLY is specified) - *
  • 2 (block if FOR UPDATE is specified) - The default value. - *
- **/ - public void setBlockCriteria(int blockCriteria) - { - String property = "blockCriteria"; - Integer oldCriteria = new Integer(getBlockCriteria()); - Integer newCriteria = new Integer(blockCriteria); - - validateProperty(property, newCriteria.toString(), JDProperties.BLOCK_CRITERIA); - - properties_.setString(JDProperties.BLOCK_CRITERIA, newCriteria.toString()); - changes_.firePropertyChange(property, oldCriteria, newCriteria); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + blockCriteria); //@A8C - } - - /** - * Sets the block size in kilobytes to retrieve from the IBM i system and - * cache on the client. This property has no effect unless the block criteria - * property is non-zero. Larger block sizes reduce the frequency of - * communication to the system, and therefore may increase performance. - * @param blockSize The block size in kilobytes. - *

Valid values include: - *

    - *
  • 0 - *
  • 8 - *
  • 16 - *
  • 32 - The default value. - *
  • 64 - *
  • 128 - *
  • 256 - *
  • 512 - *
- **/ - public void setBlockSize(int blockSize) - { - String property = "blockSize"; - - Integer oldBlockSize = new Integer(getBlockSize()); - Integer newBlockSize = new Integer(blockSize); - - validateProperty(property, newBlockSize.toString(), JDProperties.BLOCK_SIZE); - - properties_.setString(JDProperties.BLOCK_SIZE, new Integer(blockSize).toString()); - changes_.firePropertyChange(property, oldBlockSize, newBlockSize); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + blockSize); //@A8C - } - - //@cc1 - /** - * This method sets concurrent access resolution. This method overrides the setting of ConcurrentAccessResolution on the datasource or connection - * URL properties. This method has no effect on - * IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @param concurrentAccessResolution The current access resolution setting. Possible valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public void setConcurrentAccessResolution (int concurrentAccessResolution) - { - String property = "concurrentAccessResolution"; - - Integer oldValue = new Integer(getConcurrentAccessResolution()); - Integer newValue = new Integer(concurrentAccessResolution); - - validateProperty(property, newValue.toString(), JDProperties.CONCURRENT_ACCESS_RESOLUTION); - - properties_.setString(JDProperties.CONCURRENT_ACCESS_RESOLUTION, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + concurrentAccessResolution ); - } - - //@C8A - /** - * Sets the cursor sensitivity to be requested from the database. If the resultSetType is - * ResultSet.TYPE_FORWARD_ONLY or ResultSet.TYPE_SCROLL_SENSITIVE, the value of this property - * will control what cursor sensitivity is requested from the database. If the resultSetType - * is ResultSet.TYPE_SCROLL_INSENSITIVE, this property will be ignored. - * - *

Valid values include: - *

    - *
  • "asensitive" - *
  • "insensitive" - *
  • "sensitive" - *
- * The default is "asensitive". - * - * This property is ignored when connecting to systems - * running OS/400 V5R1 and earlier. - **/ - public void setCursorSensitivity(String cursorSensitivity) - { - String property = "cursorSensitivity"; - - String oldCursorSensitivity = getCursorSensitivity(); - String newCursorSensitivity = cursorSensitivity; - - validateProperty(property, newCursorSensitivity, JDProperties.CURSOR_SENSITIVITY); - - properties_.setString(JDProperties.CURSOR_SENSITIVITY, cursorSensitivity); - changes_.firePropertyChange(property, oldCursorSensitivity, newCursorSensitivity); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + cursorSensitivity); - } - - - /** - * Sets whether the cursor is held. - * @param cursorHold true if the cursor is held; false otherwise. The default value is true. - **/ - public void setCursorHold(boolean cursorHold) - { - String property = "cursorHold"; - Boolean oldHold = new Boolean(isCursorHold()); - Boolean newHold = new Boolean(cursorHold); - - if (cursorHold) - properties_.setString(JDProperties.CURSOR_HOLD, TRUE_); - else - properties_.setString(JDProperties.CURSOR_HOLD, FALSE_); - - changes_.firePropertyChange(property, oldHold, newHold); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + cursorHold); //@A8C - } - - /** - * Sets the database name. - * This property is ignored when connecting to systems - * running OS/400 V5R1 and earlier. - * If a database name is specified it must exist in the relational - * database directory on the system. Use CL command WRKRDBDIRE - * to view the directory. - * The following criteria are used to determine - * which database is accessed: - *
    - *
  1. If a database name is specified, that database is used. Attempts - * to connect will fail if the database does not exist. - *
  2. If special value *SYSBAS is specified, the system default database is used. - *
  3. If a database name is not specified, the database specified - * in the job description for the user profile is used. - *
  4. If a database name is not specified and a database is not specified - * in the job description for the user profile, the system default - * database is used. - *
- * @param databaseName The database name or *SYSBAS. - **/ - public void setDatabaseName(String databaseName) - { - String property = DATABASE_NAME; - - if (databaseName == null) - throw new NullPointerException(property); - - String old = getDatabaseName(); - - // @J2d databaseName_ = databaseName; - // @J2d changes_.firePropertyChange(property, old, databaseName); - // @J2d logProperty("database", databaseName_); - - properties_.setString(JDProperties.DATABASE_NAME, databaseName); // @J2a - changes_.firePropertyChange(property, old, databaseName); // @J2a - // @J2a - if (JDTrace.isTraceOn()) // @J2a - JDTrace.logInformation (this, property + ": " + databaseName); // @J2a - } - - /** - * Sets whether to use data compression. The default value is true. - * @param compression true if data compression is used; false otherwise. - **/ - public void setDataCompression(boolean compression) - { - Boolean oldCompression = new Boolean(isDataCompression()); - Boolean newCompression = new Boolean(compression); - - if (compression) - properties_.setString(JDProperties.DATA_COMPRESSION, TRUE_); - else - properties_.setString(JDProperties.DATA_COMPRESSION, FALSE_); - - changes_.firePropertyChange("dataCompression", oldCompression, newCompression); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "dataCompression: " + compression); //@A8C - } - - /** - * Sets the data source name. - * This property can be used for connection pooling implementations. - * @param dataSourceName The data source name. - **/ - public void setDataSourceName(String dataSourceName) - { - String property = DATASOURCE_NAME; - - if (dataSourceName == null) - throw new NullPointerException(property); - - String old = getDataSourceName(); - - dataSourceName_ = dataSourceName; - - changes_.firePropertyChange(property, old, dataSourceName); - - logProperty("dataSource", dataSourceName_); - } - - /** - * Sets whether to use data truncation. The default value is true. - * @param truncation true if data truncation is used; false otherwise. - **/ - public void setDataTruncation(boolean truncation) - { - Boolean oldTruncation = new Boolean(isDataTruncation()); - Boolean newTruncation = new Boolean(truncation); - - if (truncation) - properties_.setString(JDProperties.DATA_TRUNCATION, TRUE_); - else - properties_.setString(JDProperties.DATA_TRUNCATION, FALSE_); - - changes_.firePropertyChange("dataTruncation", oldTruncation, newTruncation); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "dataTruncation: " + truncation); //@A8C - } - - /** - * Sets the date format used in date literals within SQL statements. - * @param dateFormat The date format. - *

Valid values include: - *

    - *
  • "mdy" - *
  • "dmy" - *
  • "ymd" - *
  • "usa" - *
  • "iso" - *
  • "eur" - *
  • "jis" - *
  • "julian" - *
  • "" (server job value) - default. - *
- * The default is based on the server job. - **/ - public void setDateFormat(String dateFormat) - { - String property = "dateFormat"; - - if (dateFormat == null) - throw new NullPointerException(property); - validateProperty(property, dateFormat, JDProperties.DATE_FORMAT); - - String old = getDateFormat(); - - properties_.setString(JDProperties.DATE_FORMAT, dateFormat); - - changes_.firePropertyChange(property, old, dateFormat); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + dateFormat); //@A8C - } - - /** - * Sets the date separator used in date literals within SQL statements. - * This property has no effect unless the "data format" property is set to: - * "julian", "mdy", "dmy", or "ymd". - * @param dateSeparator The date separator. - *

Valid values include: - *

    - *
  • "/" (slash) - *
  • "-" (dash) - *
  • "." (period) - *
  • "," (comma) - *
  • " " (space) - *
  • "" (server job value) - default. - *
- * The default value is based on the server job. - **/ - public void setDateSeparator(String dateSeparator) - { - String property = "dateSeparator"; - if (dateSeparator == null) - throw new NullPointerException(property); - validateProperty(property, dateSeparator, JDProperties.DATE_SEPARATOR); - - String old = getDateSeparator(); - - properties_.setString(JDProperties.DATE_SEPARATOR, dateSeparator); - - changes_.firePropertyChange(property, old, dateSeparator); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + dateSeparator); //@A8C - } - - //@DFA - /** - * Sets the decfloat rounding mode. - * @param decfloatRoundingMode The decfloat rounding mode. - *

Valid values include: - *

    - *
  • "half even" - default - *
  • "half up" - *
  • "down" - *
  • "ceiling" - *
  • "floor" - *
  • "half down" - *
  • "up" - *
- **/ - public void setDecfloatRoundingMode(String decfloatRoundingMode) - { - String property = "decfloatRoundingMode"; - if (decfloatRoundingMode == null) - throw new NullPointerException(property); - validateProperty(property, decfloatRoundingMode, JDProperties.DECFLOAT_ROUNDING_MODE); - - String old = getDecfloatRoundingMode(); - - properties_.setString(JDProperties.DECFLOAT_ROUNDING_MODE, decfloatRoundingMode); - - changes_.firePropertyChange(property, old, decfloatRoundingMode); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + decfloatRoundingMode); - } - - /** - * Sets the decimal separator used in numeric literals within SQL - * statements. - * @param decimalSeparator The decimal separator. - *

Valid values include: - *

    - *
  • "." (period) - *
  • "," (comma) - *
  • "" (server job value) - default. - *
- * The default value is based on the server job. - **/ - public void setDecimalSeparator(String decimalSeparator) - { - String property = "decimalSeparator"; - if (decimalSeparator == null) - throw new NullPointerException(property); - validateProperty(property, decimalSeparator, JDProperties.DECIMAL_SEPARATOR); - - String old = getDecimalSeparator(); - - properties_.setString(JDProperties.DECIMAL_SEPARATOR, decimalSeparator); - - changes_.firePropertyChange(property, old, decimalSeparator); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + decimalSeparator); //@A8C - } - - //@igwrn - /** - * Sets the ignore warnings property. - * @param ignoreWarnings Specifies a list of SQL states for which the driver should not create warning objects. - **/ - public void setIgnoreWarnings(String ignoreWarnings) - { - String property = "ignoreWarnings"; - if (ignoreWarnings == null) - throw new NullPointerException(property); - - String old = getIgnoreWarnings(); - - properties_.setString(JDProperties.IGNORE_WARNINGS, ignoreWarnings); - - changes_.firePropertyChange(property, old, ignoreWarnings); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + ignoreWarnings); - } - - /** - * Sets the data source description. - * @param description The description. - **/ - public void setDescription(String description) - { - String property = DESCRIPTION; - if (description == null) - throw new NullPointerException(property); - - String old = getDescription(); - - description_ = description; - - changes_.firePropertyChange(property, old, description); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + description); //@A8C - } - - /** - * Sets how the IBM i system sorts records before sending them to the client. - * @param sort The sort value. - *

Valid values include: - *

    - *
  • "hex" (base the sort on hexadecimal values) - *
  • "language" (base the sort on the language set in the sort language property) - *
  • "table" (base the sort on the sort sequence table set in the sort table property). - *
- * The default value is "hex". - **/ - public void setSort(String sort) - { - String property = "sort"; - if (sort == null) - throw new NullPointerException(property); - - //@JOB fix to allow "sort=job" but use default value - if(sort.equals("job")) //@JOB - { //@JOB - if (JDTrace.isTraceOn()) //@JOB - JDTrace.logInformation (this, property + ": " + getSort() + " (warning: " + getSort() + " will be used since sort=job is not valid)"); //@JOB - return; //return and allow default setting to be used //@JOB - } //@JOB - - - validateProperty(property, sort, JDProperties.SORT); - String old = getSort(); - - properties_.setString(JDProperties.SORT, sort); - - changes_.firePropertyChange(property, old, sort); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + sort); //@A8C - } - - /** - * Sets the amount of detail to be returned in the message for errors - * occurring on the IBM i system. - * @param errors The error message level. - * Valid values include: "basic" and "full". The default value is "basic". - **/ - public void setErrors(String errors) - { - String property = "errors"; - if (errors == null) - throw new NullPointerException(property); - validateProperty(property, errors, JDProperties.ERRORS); - - String old = getErrors(); - properties_.setString(JDProperties.ERRORS, errors); - - changes_.firePropertyChange(property, old, errors); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + errors); //@A8C - } - - /** - * Sets whether to use extended dynamic support. Extended dynamic - * support provides a mechanism for caching dynamic SQL statements on - * the IBM i system. The first time a particular SQL statement is prepared, it is - * stored in an SQL package on the system. - * If the package does not exist, it will be automatically created. - * On subsequent prepares of the - * same SQL statement, the system can skip a significant part of the - * processing by using information stored in the SQL package. If this - * is set to "true", then a package name must be set using the "package" - * property. - * @param extendedDynamic If extended dynamic support is used; false otherwise. - * The default value is not to use extended dynamic support. - **/ - public void setExtendedDynamic(boolean extendedDynamic) - { - Boolean oldValue = new Boolean(isExtendedDynamic()); - Boolean newValue = new Boolean(extendedDynamic); - - if (extendedDynamic) - properties_.setString(JDProperties.EXTENDED_DYNAMIC, TRUE_); - else - properties_.setString(JDProperties.EXTENDED_DYNAMIC, FALSE_); - - changes_.firePropertyChange("extendedDynamic", oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "extendedDynamic: " + extendedDynamic); //@A8C - } - - // @C3A - /** - * Sets whether the driver should request extended metadata from the - * IBM i system. This property is ignored when connecting to systems - * running OS/400 V5R1 and earlier. - * If this property is set to true and connecting to a system running - * OS/400 V5R2 or IBM i, the accuracy of the information - * that is returned from ResultSetMetaData methods getColumnLabel(int), - * isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased. - * In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this - * property set to true. However, performance will be slower with this - * property on. Leave this property set to its default (false) unless you - * need more specific information from those methods. - * - * For example, without this property turned on, isSearchable(int) will - * always return true even though the correct answer may be false because - * the driver does not have enough information from the system to make a judgment. Setting - * this property to true forces the driver to get the correct data from the system. - * - * @param extendedMetaData True to request extended metadata from the system, false otherwise. - * The default value is false. - **/ - public void setExtendedMetaData(boolean extendedMetaData) - { - Boolean oldValue = new Boolean(isExtendedMetaData()); - Boolean newValue = new Boolean(extendedMetaData); - - if (extendedMetaData) - properties_.setString(JDProperties.EXTENDED_METADATA, TRUE_); - else - properties_.setString(JDProperties.EXTENDED_METADATA, FALSE_); - - changes_.firePropertyChange("extendedMetaData", oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "extendedMetaData: " + extendedMetaData); - } - - //@dup - /** - * Sets whether the driver should request extended metadata from the - * IBM i system. This property is ignored when connecting to systems - * running OS/400 V5R1 and earlier. - * If this property is set to true and connecting to a system running - * OS/400 V5R2 or IBM i, the accuracy of the information - * that is returned from ResultSetMetaData methods getColumnLabel(int), - * isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased. - * In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this - * property set to true. However, performance will be slower with this - * property on. Leave this property set to its default (false) unless you - * need more specific information from those methods. - * - * For example, without this property turned on, isSearchable(int) will - * always return true even though the correct answer may be false because - * the driver does not have enough information from the system to make a judgment. Setting - * this property to true forces the driver to get the correct data from the system. - * - * @param extendedMetaData True to request extended metadata from the system, false otherwise. - * The default value is false. - * Note: this method is the same as setExtendedMetaData() so that it corresponds to the connection property name - **/ - public void setExtendedMetadata(boolean extendedMetaData) - { - setExtendedMetaData(extendedMetaData); - } - - - // @W1a new method - /** - * Sets whether to fully open a file when performing a query. - * By default the IBM i system optimizes opens so they perform better. - * In most cases optimization functions correctly and improves - * performance. Running a query repeatedly - * when a database performance monitor is turned on may fail - * because of the optimization, however. - * Leave this property set to its default (false) until - * you experience errors running queries with monitors - * turned on. At that time set the property to true which - * will disable the optimization. - * @param fullOpen True to fully open a file (turn off optimizations), false - * to allow optimizations. The default value is false. - **/ - public void setFullOpen(boolean fullOpen) - { - Boolean oldValue = new Boolean(isFullOpen()); - Boolean newValue = new Boolean(fullOpen); - - if (fullOpen) - properties_.setString(JDProperties.FULL_OPEN, TRUE_); - else - properties_.setString(JDProperties.FULL_OPEN, FALSE_); - - changes_.firePropertyChange("fullOpen", oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "fullOpen: " + fullOpen); - } - - //@KBL - /** - * Sets whether input locators are allocated as hold locators. - * @param value true if locators should be allocated as hold locators; false otherwise. - * The default value is true. - **/ - public void setHoldInputLocators(boolean value) - { - String property = "holdInputLocators"; - Boolean oldValue = new Boolean(isHoldInputLocators()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.HOLD_LOCATORS, TRUE_); - else - properties_.setString(JDProperties.HOLD_LOCATORS, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - //@KBL - /** - * Sets whether statements should remain open until a transaction boundary when autocommit is off - * and they are associated with Lob locators. - * @param value true if statements should remain open; false otherwise. - * The default value is false. - **/ - public void setHoldStatements(boolean value) - { - String property = "holdStatements"; - Boolean oldValue = new Boolean(isHoldStatements()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.HOLD_STATEMENTS, TRUE_); - else - properties_.setString(JDProperties.HOLD_STATEMENTS, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - //@dmy - /** - * Indicates whether the temporary fix for JVM 1.6 is enabled. - * @param value true if JVM 1.6 fix is enabled; false otherwise. - * The default value is true. - **/ - public void setJvm16Synchronize(boolean value) - { - String property = "jvm16 synchronize"; - Boolean oldValue = new Boolean(isJvm16Synchronize()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.JVM16_SYNCHRONIZE, TRUE_); - else - properties_.setString(JDProperties.JVM16_SYNCHRONIZE, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - // @A1A - /** - * Sets whether to delay closing cursors until subsequent requests. - * @param lazyClose true to delay closing cursors until subsequent requests; false otherwise. - The default value is false. - **/ - public void setLazyClose(boolean lazyClose) - { - Boolean oldValue = new Boolean(isLazyClose()); - Boolean newValue = new Boolean(lazyClose); - - if (lazyClose) - properties_.setString(JDProperties.LAZY_CLOSE, TRUE_); - else - properties_.setString(JDProperties.LAZY_CLOSE, FALSE_); - - changes_.firePropertyChange("lazyClose", oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "lazyClose: " + lazyClose); //@A8C - } - - /** - * Sets the libraries to add to the server job's library list. - * The libraries are delimited by commas or spaces, and - * "*LIBL" may be used as a place holder for the server job's - * current library list. The library list is used for resolving - * unqualified stored procedure calls and finding schemas in - * DatabaseMetaData catalog methods. If "*LIBL" is not specified, - * the specified libraries will replace the server job's - * current library list. - * @param libraries The library list. - **/ - public void setLibraries(String libraries) - { - String property = "libraries"; - if (libraries == null) - throw new NullPointerException("libraries"); - - String old = getLibraries(); - properties_.setString(JDProperties.LIBRARIES, libraries); - - changes_.firePropertyChange(property, old, libraries); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + libraries); //@A8C - } - - /** - * Sets the maximum LOB (large object) size in bytes that - * can be retrieved as part of a result set. LOBs that are larger - * than this threshold will be retrieved in pieces using extra - * communication to the IBM i system. Larger LOB thresholds will reduce - * the frequency of communication to the system, but will download - * more LOB data, even if it is not used. Smaller LOB thresholds may - * increase frequency of communication to the system, but will only - * download LOB data as it is needed. - * - * @param threshold The lob threshold. Valid range is 0-16777216. - * The default value is 32768. - **/ - public void setLobThreshold(int threshold) - { - String property = "threshold"; - if (threshold < 0 || threshold > MAX_THRESHOLD) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - Integer oldValue = new Integer(getLobThreshold()); - Integer newValue = new Integer(threshold); - - properties_.setString(JDProperties.LOB_THRESHOLD, new Integer(threshold).toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + threshold); //@A8C - } - - /** - * Sets the maximum time in seconds that this data source can wait while attempting to connect to a database. - * A value of zero specifies that the timeout is the system default if one exists; otherwise it specifies that - * there is no timeout. The default value is initially zero. - * @param timeout The login timeout in seconds. - **/ - public void setLoginTimeout(int timeout) throws SQLException - { - - //@STIMEOUT setSoTimeout(timeout * 1000); //@K5A setSoTimeout takes milliseconds as a parameter //@STIMEOUT separate login and socket timeout into two separtate properties - sockProps_.setLoginTimeout(timeout * 1000); //@st3 - String property = "loginTimeout"; //@K5A - - Integer oldValue = new Integer(getLoginTimeout()); //@K5A - Integer newValue = new Integer(timeout); //@K5A - - properties_.setString(JDProperties.LOGIN_TIMEOUT, newValue.toString()); //@K5A - - changes_.firePropertyChange(property, oldValue, newValue); //@K5A - - if (JDTrace.isTraceOn()) //@K5A - JDTrace.logInformation (this, property + ": " + timeout); //@K5A - - //@K5D JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - /** - * Sets the log writer for this data source. - * @param writer The log writer; to disable, set to null. - * @exception SQLException If a database error occurs. - **/ - public void setLogWriter(PrintWriter writer) throws SQLException - { - String property = "writer"; - - //@C4D if (writer == null) - //@C4D throw new NullPointerException(property); - - PrintWriter old = getLogWriter(); - writer_ = writer; - changes_.firePropertyChange(property, old, writer); - - if (writer == null) //@C4A - { //@C4A - log_ = null; //@C4A - return; //@C4A - } //@C4A - - log_ = new EventLog(writer); - } - - //@PDA - /** - * Sets how to retrieve DatabaseMetaData. - * If set to 0, database metadata will be retrieved through the ROI data flow. - * If set to 1, database metadata will be retrieved by calling system stored procedures. - * The methods that currently are available through stored procedures are: - * getColumnPrivileges - * @param mds The setting for metadata source - * The default value is 1. - **/ - public void setMetaDataSource(int mds) - { - String property = "metaDataSource"; - - Integer oldValue = new Integer(getMetaDataSource()); - Integer newValue = new Integer(mds); - - properties_.setString(JDProperties.METADATA_SOURCE, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + mds); - } - - - //@dup - /** - * Sets how to retrieve DatabaseMetaData. - * If set to 0, database metadata will be retrieved through the ROI data flow. - * If set to 1, database metadata will be retrieved by calling system stored procedures. - * The methods that currently are available through stored procedures are: - * getColumnPrivileges - * @param mds The setting for metadata source - * The default value is 1. - * Note: this method is the same as setMetaDataSource() so that it corresponds to the connection property name - **/ - public void setMetadataSource(int mds) - { - setMetaDataSource(mds); - } - - - /** - * Sets the naming convention used when referring to tables. - * @param naming The naming convention. Valid values include: "sql" (e.g. schema.table) - * and "system" (e.g. schema/table). The default value is "sql". - **/ - public void setNaming(String naming) - { - String property = "naming"; - if (naming == null) - throw new NullPointerException("naming"); - validateProperty(property, naming, JDProperties.NAMING); - - String old = getNaming(); - properties_.setString(JDProperties.NAMING, naming); - - changes_.firePropertyChange(property, old, naming); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + naming); //@A8C - } - - /** - * Sets the base name of the SQL package. Note that only the - * first six characters are used to generate the name of the SQL package on the IBM i system. - * This property has no effect unless - * the extended dynamic property is set to true. In addition, this property - * must be set if the extended dynamic property is set to true. - * @param packageName The base name of the SQL package. - **/ - public void setPackage(String packageName) - { - String property = "packageName"; - if (packageName == null) - throw new NullPointerException(property); - - String old = getPackage(); - properties_.setString(JDProperties.PACKAGE, packageName); - - changes_.firePropertyChange(property, old, packageName); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + packageName); //@A8C - } - - /** - * Sets whether to add newly prepared statements to the SQL package - * specified on the "package" property. This property - * has no effect unless the extended dynamic property is set to true. - * @param add If newly prepared statements should be added to the SQL package specified on - * the "package" property; false otherwise. - * The default value is true. - **/ - public void setPackageAdd(boolean add) - { - Boolean oldValue = new Boolean(isPackageAdd()); - Boolean newValue = new Boolean(add); - - if (add) - properties_.setString(JDProperties.PACKAGE_ADD, TRUE_); - else - properties_.setString(JDProperties.PACKAGE_ADD, FALSE_); - - changes_.firePropertyChange("packageAdd", oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "packageAdd: " + add); //@A8C - } - - /** - * Sets whether to cache a subset of the SQL package information in client memory. - * Caching SQL packages locally - * reduces the amount of communication to the IBM i system for prepares and describes. This - * property has no effect unless the extended dynamic property is set to true. - * @param cache If caching is used; false otherwise. The default value is false. - **/ - public void setPackageCache(boolean cache) - { - Boolean oldValue = new Boolean(isPackageCache()); - Boolean newValue = new Boolean(cache); - - if (cache) - properties_.setString(JDProperties.PACKAGE_CACHE, TRUE_); - else - properties_.setString(JDProperties.PACKAGE_CACHE, FALSE_); - - changes_.firePropertyChange("packageCache", oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "packageCache: " + cache); //@A8C - } - - - //@C6C Changed javadoc since package clearing is now done automatically - //@C6C by the database. - /** - * Sets whether to clear SQL packages when they become full. This method - * has been deprecated. Package clearing and the decision for the - * threshold where package clearing is needed is now handled - * automatically by the database. - * @param clear If the SQL package are cleared when full; false otherwise. - * @deprecated - **/ - public void setPackageClear(boolean clear) - { - //@C6D Package clearing and the decision for the - //@C6D threshold where package clearing is needed is now handled - //@C6D automatically by the database. - - //@C6D Boolean oldValue = new Boolean(isPackageClear()); - //@C6D Boolean newValue = new Boolean(clear); - - //@C6D String value = null; - //@C6D if (clear) - //@C6D properties_.setString(JDProperties.PACKAGE_CLEAR, TRUE_); - //@C6D else - //@C6D properties_.setString(JDProperties.PACKAGE_CLEAR, FALSE_); - - //@C6D changes_.firePropertyChange("packageClear", oldValue, newValue); - - //@C6D if (JDTrace.isTraceOn()) //@A8C - //@C6D JDTrace.logInformation (this, "packageClear: " + clear); //@A8C - } - - - /** - * Sets the type of SQL statement to be stored in the SQL package. This can - * be useful to improve the performance of complex join conditions. This - * property has no effect unless the extended dynamic property is set to true. - * @param packageCriteria The type of SQL statement. - * Valid values include: "default" (only store SQL statements with parameter - * markers in the package), and "select" (store all SQL SELECT statements - * in the package). The default value is "default". - **/ - public void setPackageCriteria(String packageCriteria) - { - String property = "packageCriteria"; - - if (packageCriteria == null) - throw new NullPointerException(property); - validateProperty(property, packageCriteria, JDProperties.PACKAGE_CRITERIA); - - String old = getPackageCriteria(); - properties_.setString(JDProperties.PACKAGE_CRITERIA, packageCriteria); - - changes_.firePropertyChange(property, old, packageCriteria); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + packageCriteria); //@A8C - } - - /** - * Sets the action to take when SQL package errors occur. When an SQL package - * error occurs, the driver will optionally throw an SQLException or post a - * warning to the Connection, based on the value of this property. This property - * has no effect unless the extended dynamic property is set to true. - * @param packageError The action when SQL errors occur. - * Valid values include: "exception", "warning", and "none". The default value is "warning". - **/ - public void setPackageError(String packageError) - { - String property = "packageError"; - if (packageError == null) - throw new NullPointerException(property); - validateProperty(property, packageError, JDProperties.PACKAGE_ERROR); - - String old = getPackageError(); - properties_.setString(JDProperties.PACKAGE_ERROR, packageError); - - changes_.firePropertyChange(property, old, packageError); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + packageError); //@A8C - } - /** - * Sets the library for the SQL package. This property has no effect unless - * the extended dynamic property is set to true. - * @param packageLibrary The SQL package library. The default package library is "QGPL". - **/ - public void setPackageLibrary(String packageLibrary) - { - String property = "packageLibrary"; - if (packageLibrary == null) - throw new NullPointerException(property); - - String old = getPackageLibrary(); - properties_.setString(JDProperties.PACKAGE_LIBRARY, packageLibrary); - - changes_.firePropertyChange(property, old, packageLibrary); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + packageLibrary); //@A8C - } - - /** - * Sets the database password. - * @param password The password. - **/ - public void setPassword(String password) - { - as400_.setPassword(password); - serialPWBytes_ = xpwConfuse(password); //@J3a - log(ResourceBundleLoader.getText("AS400_JDBC_DS_PASSWORD_SET")); //@A9C - } - - /** - * Sets whether to prefetch data upon executing a SELECT statement. - * This will increase performance when accessing the initial rows in the result set. - * @param prefetch If prefetch is used; false otherwise. - * The default value is to prefectch data. - **/ - public void setPrefetch(boolean prefetch) - { - Boolean oldValue = new Boolean(isPrefetch()); - Boolean newValue = new Boolean(prefetch); - - if (prefetch) - properties_.setString(JDProperties.PREFETCH, TRUE_); - else - properties_.setString(JDProperties.PREFETCH, FALSE_); - - changes_.firePropertyChange("prefetch", oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "prefetch: " + prefetch); //@A8C - } - - /** - * Sets whether the user should be prompted if a user name or password is - * needed to connect to the IBM i system. If a connection can not be made - * without prompting the user, and this property is set to false, then an - * attempt to connect will fail. - * @param prompt true if the user is prompted for signon information; false otherwise. - * The default value is false. - **/ - public void setPrompt(boolean prompt) - { - Boolean oldValue = new Boolean(isPrompt()); - Boolean newValue = new Boolean(prompt); - - if (prompt) - properties_.setString(JDProperties.PROMPT, TRUE_); - else - properties_.setString(JDProperties.PROMPT, FALSE_); - - try - { //@C2A - as400_.setGuiAvailable(prompt); //@C2A - } //@C2A - catch (PropertyVetoException vp) //@C2A - { /* ignore */ //@C2A - } //@C2A - - changes_.firePropertyChange("prompt", oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "prompt: " + prompt); //@A8C - } - - // @F0D - Removed unused method - ///** - //* Sets the JDBC properties. - //* @param Properties The JDBC properties list. - //**/ - //void setProperties(Reference reference) - //{ - // /* - // * Implementation note: This method is called from AS400JDBCObjectFactory.getObjectInstance - // */ - // if (reference == null) - // throw new NullPointerException("reference"); - // - // Properties properties = new Properties(); - // - // Enumeration list = reference.getAll(); - // while (list.hasMoreElements()) - // { - // StringRefAddr refAddr = (StringRefAddr)list.nextElement(); - // String property = refAddr.getType(); - // String value = (String)reference.get(property).getContent(); - // - // if (property.equals(DATABASE_NAME)) // constant identifiers were used to store in JNDI. - // setDatabaseName(value); - // else if (property.equals(DATASOURCE_NAME)) - // setDataSourceName(value); - // else if (property.equals(DESCRIPTION)) - // setDescription(value); - // else if (property.equals(SERVER_NAME)) - // setServerName(value); - // else if (property.equals(USER)) - // setUser(value); - // else if (property.equals(PASSWORD)) { - // // get the password back from the serialized char[] - // serialPWBytes_ = value.toCharArray(); - // // decode the password and set it on the as400 - // as400_.setPassword(xpwDeconfuse(serialPWBytes_)); - // } - // else if (property.equals(KEY_RING_NAME)) { - // // set the key ring name - // serialKeyRingName_ = value; - // } - // else if (property.equals(KEY_RING_PASSWORD)) { - // // get the key ring password back from the serialized char[] - // if (value != null) - // serialKeyRingPWBytes_ = value.toCharArray(); - // } - // else if (property.equals(SECURE)) { - // // set the isSecure_ flag - // isSecure_ = value.equals(TRUE_) ? true : false; - // } - // else if (property.equals(SAVE_PASSWORD)) { - // // set the savePasswordWhenSerialized_ flag - // savePasswordWhenSerialized_ = value.equals(TRUE_) ? true : false; - // } - // else - // { - // properties.put(property, value); - // } - // } - // properties_ = new JDProperties(properties, null); - // - // // get the prompt property and set it back in the as400 object - // String prmpt = properties_.getString(JDProperties.PROMPT); - // if (prmpt != null && prmpt.equalsIgnoreCase(FALSE_)) - // setPrompt(false); - // else if (prmpt != null && prmpt.equalsIgnoreCase(TRUE_)) - // setPrompt(true); - // - // // if the system is secure create a SecureAS400 object - // if (isSecure_) { - // try - // { - // as400_ = new SecureAS400(as400_); - // ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_, xpwDeconfuse(serialKeyRingPWBytes_)); - // } - // catch (PropertyVetoException pe) - // { /* will never happen */ - // } - // } - //} - - //@PDA - /** - * Sets the properties based on ";" delimited string of properties, in same - * fashion as URL properties specified with - * DriverManager.getConnection(urlProperties). This method simply parses - * property string and then calls setPropertes(Properties). This method is - * intended as an enhancement so that the user does not have to write new - * code to call the setters for new/deleted properties. - * - * @param propertiesString list of ";" delimited properties - */ - public void setProperties(String propertiesString) - { - //use existing JDDatasourceURL to parse properties string like Connection does - //but first have to add dummy protocol so we can re-use parsing code - propertiesString = "jdbc:as400://dummyhost;" + propertiesString; - JDDataSourceURL dsURL = new JDDataSourceURL(propertiesString); - //returns only properties specified in propertyString.. (none of - // JDProperties defaults) - Properties properties = dsURL.getProperties(); - setProperties(properties); - } - - //@PDA - /** - * Sets the properties for this datasource. This method is intended as an - * enhancement so that the user does not have to write new code to call the - * setters for new/deleted properties. - * - * @param newProperties object containing updated property values - */ - public void setProperties(Properties newProperties) - { - //1. turn on/off tracing per new props - //2. set needed AS400JDBCDataSource instance variables - //3. set socket props - //4. propagate newProperties to existing properties_ object - - // Check first thing to see if the trace property is - // turned on. This way we can trace everything, including - // the important stuff like loading the properties. - - // If trace property was set to true, turn on tracing. If trace property - // was set to false, - // turn off tracing. If trace property was not set, do not change. - if (JDProperties.isTraceSet(newProperties, null) == JDProperties.TRACE_SET_ON) - { - if (!JDTrace.isTraceOn()) - JDTrace.setTraceOn(true); - } else if (JDProperties.isTraceSet(newProperties, null) == JDProperties.TRACE_SET_OFF) - { - if (JDTrace.isTraceOn()) - JDTrace.setTraceOn(false); - } - - // If toolbox trace is set to datastream. Turn on datastream tracing. - if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_DATASTREAM) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDatastreamOn(true); - } - // If toolbox trace is set to diagnostic. Turn on diagnostic tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_DIAGNOSTIC) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDiagnosticOn(true); - } - // If toolbox trace is set to error. Turn on error tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_ERROR) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceErrorOn(true); - } - // If toolbox trace is set to information. Turn on information tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_INFORMATION) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceInformationOn(true); - } - // If toolbox trace is set to warning. Turn on warning tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_WARNING) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceWarningOn(true); - } - // If toolbox trace is set to conversion. Turn on conversion tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_CONVERSION) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceConversionOn(true); - } - // If toolbox trace is set to proxy. Turn on proxy tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_PROXY) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceProxyOn(true); - } - // If toolbox trace is set to pcml. Turn on pcml tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_PCML) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTracePCMLOn(true); - } - // If toolbox trace is set to jdbc. Turn on jdbc tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_JDBC) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceJDBCOn(true); - } - // If toolbox trace is set to all. Turn on tracing for all categories. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_ALL) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceAllOn(true); - } - // If toolbox trace is set to thread. Turn on thread tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_THREAD) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceThreadOn(true); - } - // If toolbox trace is set to none. Turn off tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_NONE) - { - if (Trace.isTraceOn()) - { - Trace.setTraceOn(false); - } - } - - //next we need to set instance vars (via setX() methods) - //or setup socket properties or set in properties_ - //Note: this is similar to AS400JDBCDataSource(Reference reference)logic - - Enumeration e = newProperties.keys(); - while (e.hasMoreElements()) - { - String propertyName = (String) e.nextElement(); - String propertyValue = (String) newProperties.getProperty(propertyName); - - int propIndex = JDProperties.getPropertyIndex(propertyName); - - //some of the setter methods also set the properties_ below - if (propIndex == JDProperties.DATABASE_NAME) - setDatabaseName(propertyValue); - else if (propIndex == JDProperties.USER) - setUser(propertyValue); - else if (propIndex == JDProperties.PASSWORD) - setPassword(properties_.getString(JDProperties.PASSWORD)); - else if (propIndex == JDProperties.SECURE) - setSecure(propertyValue.equals(TRUE_) ? true : false); - else if (propIndex == JDProperties.KEEP_ALIVE) - setKeepAlive(propertyValue.equals(TRUE_) ? true : false); - else if (propIndex == JDProperties.RECEIVE_BUFFER_SIZE) - setReceiveBufferSize(Integer.parseInt(propertyValue)); - else if (propIndex == JDProperties.SEND_BUFFER_SIZE) - setSendBufferSize(Integer.parseInt(propertyValue)); - else if (propIndex == JDProperties.PROMPT) - setPrompt(propertyValue.equals(TRUE_) ? true : false); - else if (propIndex == JDProperties.KEY_RING_NAME){ - //at this time, decided to not allow this due to security and fact that there is no setKeyRingName() method - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Property: " + propertyName + " can only be changed in AS400JDBCDataSource constructor"); - } else if (propIndex == JDProperties.KEY_RING_PASSWORD){ - //at this time, decided to not allow this due to security and fact that there is no setKeyRingPassword() method - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Property: " + propertyName + " can only be changed in AS400JDBCDataSource constructor"); - } else if (propIndex != -1) - { - properties_.setString(propIndex, propertyValue); - } - } - - } - - /** - * Sets the name of the proxy server. - * @param proxyServer The proxy server. - **/ - public void setProxyServer(String proxyServer) - { - String property = "proxyServer"; - if (proxyServer == null) - throw new NullPointerException(property); - - String old = getProxyServer(); - properties_.setString(JDProperties.PROXY_SERVER, proxyServer); - - changes_.firePropertyChange(property, old, proxyServer); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + proxyServer); //@A8C - } - - /** - * Sets the source of the text for REMARKS columns in ResultSets returned - * by DatabaseMetaData methods. - * @param remarks The text source. - * Valid values include: "sql" (SQL object comment) and "system" (IBM i object description). - * The default value is "system". - **/ - public void setRemarks(String remarks) - { - String property = "remarks"; - if (remarks == null) - throw new NullPointerException("remarks"); - validateProperty(property, remarks, JDProperties.REMARKS); - - String old = getRemarks(); - properties_.setString(JDProperties.REMARKS, remarks); - - changes_.firePropertyChange(property, old, remarks); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + remarks); //@A8C - } - - //@K94 - /** - * Sets whether the cursor is held after a rollback. - * @param cursorHold true if the cursor is held; false otherwise. The default value is false. - **/ - public void setRollbackCursorHold(boolean cursorHold) - { - String property = "rollbackCursorHold"; - Boolean oldHold = new Boolean(isRollbackCursorHold()); - Boolean newHold = new Boolean(cursorHold); - - if (cursorHold) - properties_.setString(JDProperties.ROLLBACK_CURSOR_HOLD, TRUE_); - else - properties_.setString(JDProperties.ROLLBACK_CURSOR_HOLD, FALSE_); - - changes_.firePropertyChange(property, oldHold, newHold); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + cursorHold); - } - - /** - * Sets the secondary URL to be used for a connection on the middle-tier's - * DriverManager in a multiple tier environment, if it is different than - * already specified. This property allows you to use this driver to connect - * to databases other than DB2 for IBM i. Use a backslash as an escape character - * before backslashes and semicolons in the URL. - * @param url The secondary URL. - **/ - public void setSecondaryUrl(String url) - { - if (url == null) - throw new NullPointerException("url"); - - String old = getSecondaryUrl(); - properties_.setString(JDProperties.SECONDARY_URL, url); - - changes_.firePropertyChange("secondaryUrl", old, url); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "secondaryUrl: " + url); //@A8C - } - - //@dup - /** - * Sets the secondary URL to be used for a connection on the middle-tier's - * DriverManager in a multiple tier environment, if it is different than - * already specified. This property allows you to use this driver to connect - * to databases other than DB2 for IBM i. Use a backslash as an escape character - * before backslashes and semicolons in the URL. - * @param url The secondary URL. - * Note: this method is the same as setSecondaryUrl() so that it corresponds to the connection property name - **/ - public void setSecondaryURL(String url) - { - setSecondaryUrl(url); - } - - /** - * Sets whether a Secure Socket Layer (SSL) connection is used to communicate - * with the IBM i system. SSL connections are only available when connecting to systems - * at V4R4 or later. - * @param secure true if Secure Socket Layer connection is used; false otherwise. - * The default value is false. - **/ - public void setSecure(boolean secure) - { - Boolean oldValue = new Boolean(isSecure()); - Boolean newValue = new Boolean(secure); - - //Do not allow user to change to not secure if they constructed the data source with - //a keyring. - if (!secure && isSecure_) //@C2A - { //@C2A - throw new ExtendedIllegalStateException("secure", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); //@C2A - } //@C2A - - // keep away the secure flag // @F0A - isSecure_ = secure; // @F0A - - if (secure) - properties_.setString(JDProperties.SECURE, TRUE_); - else - properties_.setString(JDProperties.SECURE, FALSE_); - - changes_.firePropertyChange("secure", oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "secure: " + secure); //@A8C - } - - //@pw3 - /** - * Sets whether to disallow "" and *current as user name and password. - * True indicates to disallow "" and *current for user name and password. - * @param secureCurrentUser The secure current user setting. - **/ - public void setSecureCurrentUser(boolean secureCurrentUser) - { - String property = "secureCurrentUser"; - Boolean oldVal = new Boolean(isSecureCurrentUser()); - Boolean newVal = new Boolean(secureCurrentUser); - - if (secureCurrentUser) - properties_.setString(JDProperties.SECURE_CURRENT_USER, TRUE_); - else - properties_.setString(JDProperties.SECURE_CURRENT_USER, FALSE_); - - changes_.firePropertyChange(property, oldVal, newVal); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + secureCurrentUser); - } - - - /** - * Sets the IBM i system name. - * @param serverName The system name. - **/ - public void setServerName(String serverName) - { - String property = SERVER_NAME; - if (serverName == null) - throw new NullPointerException(property); - - String old = getServerName(); - - // keep away the name to serialize // @F0A - serialServerName_ = serverName; // @F0A - - try - { - as400_.setSystemName(serverName); - } - catch (PropertyVetoException pv) - { /* ignore */ - } - - changes_.firePropertyChange(property, old, serverName); - - logProperty ("server name", as400_.getSystemName()); - } - - - // @j1 new method - /** - * Enables tracing of the JDBC server job. - * If tracing is enabled, tracing is started when - * the client connects to the IBM i system, and ends when the connection - * is disconnected. Tracing must be started before connecting to - * the system since the client enables tracing only at connect time. - * - *

- * Trace data is collected in spooled files on the system. Multiple - * levels of tracing can be turned on in combination by adding - * the constants and passing that sum on the set method. For example, - *

-    *  dataSource.setServerTraceCategories(AS400JDBCDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
-    *  
- * @param traceCategories level of tracing to start. - *

Valid values include: - *

    - *
  • SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job. - * The numeric value of this constant is 2. - *
  • SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job. - * The numeric value of this constant is 4. - *
  • SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends. - * The numeric value of this constant is 8. - *
  • SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job. - * The numeric value of this constant is 16. - *
  • SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information. - * The numeric value of this constant is 32. - *
- *

- * Tracing the JDBC server job will use significant amounts of system resources. - * Additional processor resource is used to collect the data, and additional - * storage is used to save the data. Turn on tracing only to debug - * a problem as directed by IBM service. - * - * - **/ - public void setServerTraceCategories(int traceCategories) - { - String property = "serverTrace"; - - Integer oldValue = new Integer(getServerTraceCategories()); - Integer newValue = new Integer(traceCategories); - - properties_.setString(JDProperties.TRACE_SERVER, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + traceCategories); - } - - //@dup - /** - * Enables tracing of the JDBC server job. - * If tracing is enabled, tracing is started when - * the client connects to the IBM i system, and ends when the connection - * is disconnected. Tracing must be started before connecting to - * the system since the client enables tracing only at connect time. - * - *

- * Trace data is collected in spooled files on the system. Multiple - * levels of tracing can be turned on in combination by adding - * the constants and passing that sum on the set method. For example, - *

-     *  dataSource.setServerTraceCategories(AS400JDBCDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
-     *  
- * @param traceCategories level of tracing to start. - *

Valid values include: - *

    - *
  • SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job. - * The numeric value of this constant is 2. - *
  • SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job. - * The numeric value of this constant is 4. - *
  • SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends. - * The numeric value of this constant is 8. - *
  • SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job. - * The numeric value of this constant is 16. - *
  • SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information. - * The numeric value of this constant is 32. - *
- *

- * Tracing the JDBC server job will use significant amounts of system resources. - * Additional processor resource is used to collect the data, and additional - * storage is used to save the data. Turn on tracing only to debug - * a problem as directed by IBM service. - * - * Note: this method is the same as setServerTraceCategories() so that it corresponds to the connection property name - **/ - public void setServerTrace(int traceCategories) - { - setServerTraceCategories(traceCategories); - } - - - // @A2A - /** - * Sets the JDBC driver implementation. - * This property has no - * effect if the "secondary URL" property is set. - * This property cannot be set to "native" if the - * environment is not an IBM i Java Virtual Machine. - * param driver The driver value. - *

Valid values include: - *

    - *
  • "toolbox" (use the IBM Toolbox for Java JDBC driver) - *
  • "native" (use the IBM Developer Kit for Java JDBC driver) - *
- * The default value is "toolbox". - * Note: Not supported in a connection pool. - **/ - public void setDriver(String driver) - { - String property = "driver"; - if (driver == null) - throw new NullPointerException(property); - - validateProperty(property, driver, JDProperties.DRIVER); - String old = getDriver(); - - properties_.setString(JDProperties.DRIVER, driver); - - changes_.firePropertyChange(property, old, driver); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + driver); //@A8C - } - - // @J3 new method - /** - * Sets whether to save the password locally with the rest of the properties when - * this data source object is serialized. - *

- * If the password is saved, it is up to the application to protect - * the serialized form of the object because it contains all necessary - * information to connect to the IBM i system. The default is false. It - * is a security risk to save the password with the rest of the - * properties so by default the password is not saved. If the application - * programmer chooses to accept this risk, set this property to true - * to force the Toolbox to save the password with the other properties - * when the data source object is serialized. - * - * @param savePassword true if the password is saved; false otherwise. - * The default value is false - **/ - public void setSavePasswordWhenSerialized(boolean savePassword) - { - String property = "savePasswordWhenSerialized"; //@C5A - - boolean oldValue = isSavePasswordWhenSerialized(); //@C5A - boolean newValue = savePassword; //@C5A - - savePasswordWhenSerialized_ = savePassword; - - changes_.firePropertyChange(property, oldValue, newValue); //@C5A - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "save password: " + savePassword); - } - - - /** - * Sets the three-character language id to use for selection of a sort sequence. - * This property has no effect unless the sort property is set to "language". - * @param language The three-character language id. - * The default value is ENU. - **/ - public void setSortLanguage(String language) - { - if (language == null) - throw new NullPointerException("language"); - - String old = getSortLanguage(); - properties_.setString(JDProperties.SORT_LANGUAGE, language); - - changes_.firePropertyChange("sortLanguage", old, language); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "sortLanguage: " + language); //@A8C - } - - /** - * Sets the library and file name of a sort sequence table stored on the - * IBM i system. - * This property has no effect unless the sort property is set to "table". - * The default is an empty String (""). - * @param table The qualified sort table name. - **/ - public void setSortTable(String table) - { - if (table == null) - throw new NullPointerException("table"); - - String old = getSortTable(); - properties_.setString(JDProperties.SORT_TABLE, table); - - changes_.firePropertyChange("sortTable", old, table); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "sortTable: " + table); //@A8C - } - - /** - * Sets how the IBM i system treats case while sorting records. This property - * has no effect unless the sort property is set to "language". - * @param sortWeight The sort weight. - * Valid values include: "shared" (upper- and lower-case characters are sorted as the - * same character) and "unique" (upper- and lower-case characters are sorted as - * different characters). The default value is "shared". - **/ - public void setSortWeight(String sortWeight) - { - String property = "sortWeight"; - if (sortWeight == null) - throw new NullPointerException(property); - - validateProperty(property, sortWeight, JDProperties.SORT_WEIGHT); - - String old = getSortWeight(); - properties_.setString(JDProperties.SORT_WEIGHT, sortWeight); - - changes_.firePropertyChange(property, old, sortWeight); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + sortWeight); //@A8C - } - - /** - * Sets whether a thread is used. - * @param threadUsed true if a thread is used; false otherwise. - * The default value is true. - **/ - public void setThreadUsed(boolean threadUsed) - { - Boolean oldValue = new Boolean(isThreadUsed()); - Boolean newValue = new Boolean(threadUsed); - - if (threadUsed) - properties_.setString(JDProperties.THREAD_USED, TRUE_); - else - properties_.setString(JDProperties.THREAD_USED, FALSE_); - - try - { - as400_.setThreadUsed(threadUsed); - } - catch (PropertyVetoException pve) - { /* Will never happen */ - } - - changes_.firePropertyChange("threadUsed", oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "threadUsed: " + threadUsed); //@A8C - } - - /** - * Sets the time format used in time literals with SQL statements. - * @param timeFormat The time format. - *

Valid values include: - *

    - *
  • "hms" - *
  • "usa" - *
  • "iso" - *
  • "eur" - *
  • "jis" - *
  • "" (server job value) - default. - *
- * The default value is based on the server job. - **/ - public void setTimeFormat(String timeFormat) - { - String property = "timeFormat"; - if (timeFormat == null) - throw new NullPointerException(property); - validateProperty(property, timeFormat, JDProperties.TIME_FORMAT); - - String old = getTimeFormat(); - properties_.setString(JDProperties.TIME_FORMAT, timeFormat); - - changes_.firePropertyChange(property, old, timeFormat); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + timeFormat); //@A8C - } - - /** - * Sets the time separator used in time literals within SQL statements. - * This property has no effect unless the time format property is set to "hms". - * @param timeSeparator The time separator. - *

Valid values include: - *

    - *
  • ":" (colon) - *
  • "." (period) - *
  • "," (comma) - *
  • " " (space) - *
  • "" (server job value) - default. - *
- * The default value is based on the server job. - **/ - public void setTimeSeparator(String timeSeparator) - { - String property = "timeSeparator"; - if (timeSeparator == null) - throw new NullPointerException(property); - validateProperty(property, timeSeparator, JDProperties.TIME_SEPARATOR); - - String old = getTimeSeparator(); - properties_.setString(JDProperties.TIME_SEPARATOR, timeSeparator); - - changes_.firePropertyChange(property, old, timeSeparator); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + timeSeparator); //@A8C - } - - /** - * Sets whether trace messages should be logged. Trace messages are - * useful for debugging programs that call JDBC. However, there is a - * performance penalty associated with logging trace messages, so this - * property should only be set to true for debugging. Trace messages - * are logged to System.out. - * @param trace true if trace message are logged; false otherwise. - * The default value is false. - **/ - public void setTrace(boolean trace) - { - Boolean oldValue = new Boolean(isTrace()); - Boolean newValue = new Boolean(trace); - - if (trace) - properties_.setString(JDProperties.TRACE, TRUE_); - else - properties_.setString(JDProperties.TRACE, FALSE_); - - changes_.firePropertyChange("trace", oldValue, newValue); - - if (trace) - { - if (!JDTrace.isTraceOn ()) - JDTrace.setTraceOn (true); - } - else - JDTrace.setTraceOn (false); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "trace: " + trace); //@A8C - } - - - /** - * Sets the IBM i system's transaction isolation. - * @param transactionIsolation The transaction isolation level. - *

Valid values include: - *

    - *
  • "none" - *
  • "read uncommitted" - The default value. - *
  • "read committed" - *
  • "repeatable read" - *
  • "serializable" - *
- **/ - public void setTransactionIsolation(String transactionIsolation) - { - String property = "transactionIsolation"; - - if (transactionIsolation == null) - throw new NullPointerException(property); - validateProperty(property, transactionIsolation, JDProperties.TRANSACTION_ISOLATION); - - String old = getTransactionIsolation(); - - properties_.setString(JDProperties.TRANSACTION_ISOLATION, transactionIsolation); - - changes_.firePropertyChange(property, old, transactionIsolation); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + transactionIsolation); //@A8C - } - - /** - * Sets whether binary data is translated. If this property is set - * to true, then BINARY and VARBINARY fields are treated as CHAR and - * VARCHAR fields. - * @param translate true if binary data is translated; false otherwise. - * The default value is false. - **/ - public void setTranslateBinary(boolean translate) - { - String property = "translateBinary"; - - Boolean oldValue = new Boolean(isTranslateBinary()); - Boolean newValue = new Boolean(translate); - - if (translate) - properties_.setString(JDProperties.TRANSLATE_BINARY, TRUE_); - else - properties_.setString(JDProperties.TRANSLATE_BINARY, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + translate); //@A8C - } - - //@PDA - /** - * Sets how Boolean objects are interpreted when setting the value - * for a character field/parameter using the PreparedStatement.setObject(), - * CallableStatement.setObject() or ResultSet.updateObject() methods. Setting the - * property to "true", would store the Boolean object in the character field as either - * "true" or "false". Setting the property to "false", would store the Boolean object - * in the character field as either "1" or "0". - * @param translate true if boolean data is translated; false otherwise. - * The default value is true. - **/ - public void setTranslateBoolean(boolean translate) - { - String property = "translateBoolean"; - - Boolean oldValue = new Boolean(isTranslateBoolean()); - Boolean newValue = new Boolean(translate); - - if (translate) - properties_.setString(JDProperties.TRANSLATE_BOOLEAN, TRUE_); - else - properties_.setString(JDProperties.TRANSLATE_BOOLEAN, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + translate); - } - - - /** - * Indicates whether blocking should be used for updates and delete. - * @param value true if blocking is used for updates and deletes. - * The default value is false. - **/ - public void setUseBlockUpdate(boolean value) - { - String property = JDProperties.DO_UPDATE_DELETE_BLOCKING_ ; - Boolean oldValue = new Boolean(isUseBlockUpdate()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.DO_UPDATE_DELETE_BLOCKING, TRUE_); - else - properties_.setString(JDProperties.DO_UPDATE_DELETE_BLOCKING, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - - /** - * Sets the database user. - * @param user The user. - **/ - public void setUser(String user) - { - String property = "user"; - - String old = getUser(); - - // save away the user to serialize // @F0A - serialUserName_ = user; // @F0A - - try - { - as400_.setUserId(user); - } - catch (PropertyVetoException vp) - { /* ignore */ - } - - changes_.firePropertyChange(property, old, user); - - logProperty ("user", as400_.getUserId()); - } - - //@K54 - /** - * Specifies whether variable-length fields should be compressed. - * @param compress true if variable-length fields should be compressed; false otherwise. - * The default value is true. - **/ - public void setVariableFieldCompression(boolean compress) - { - String property = "variableFieldCompression"; - - Boolean oldValue = new Boolean(isVariableFieldCompression()); - Boolean newValue = new Boolean(compress); - - if (compress) - properties_.setString(JDProperties.VARIABLE_FIELD_COMPRESSION, TRUE_); - else - properties_.setString(JDProperties.VARIABLE_FIELD_COMPRESSION, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + compress); - } - - // @F1A Added the below methods to set socket options - /** - * Gets the socket keepalive option. - * @return The value of the socket keepalive option. - **/ - public boolean getKeepAlive() - { - return sockProps_.isKeepAlive(); - } - - /** - * Gets the socket receive buffer size option. NOTE: This does not get - * the actual receive buffer size, only the option which is used as a hint - * by the underlying socket code. - * @return The value of the socket receive buffer size option. - **/ - public int getReceiveBufferSize() - { - return sockProps_.getReceiveBufferSize(); - } - - /** - * Gets the socket send buffer size option. NOTE: This does not get - * the actual send buffer size, only the option which is used as a hint - * by the underlying socket code. - * @return The value of the socket send buffer size option. - **/ - public int getSendBufferSize() - { - return sockProps_.getSendBufferSize(); - } - - /** - * Gets the socket linger option in seconds. - * @return The value of the socket linger option. - **/ - public int getSoLinger() - { - return sockProps_.getSoLinger(); - } - - /** - * Gets the socket timeout option in milliseconds. - * @return The value of the socket timeout option. - **/ - public int getSoTimeout() - { - return sockProps_.getSoTimeout(); - } - - /** - * Gets the socket TCP no delay option. - * @return The value of the socket TCP no delay option. - **/ - public boolean getTcpNoDelay() - { - return sockProps_.isTcpNoDelay(); - } - - /** - * This property allows the turning on of socket keep alive. - * @param keepAlive The keepalive option value. - **/ - public void setKeepAlive(boolean keepAlive) - { - sockProps_.setKeepAlive(keepAlive); - } - - /** - * This property sets the receive buffer size socket option to the - * specified value. The receive buffer size option is used as a hint - * for the size to set the underlying network I/O buffers. Increasing - * the receive buffer size can increase the performance of network - * I/O for high-volume connection, while decreasing it can help reduce - * the backlog of incoming data. This value must be greater than 0. - * @param size The socket receive buffer size option value. - **/ - public void setReceiveBufferSize(int size) - { - sockProps_.setReceiveBufferSize(size); - } - - /** - * This property sets the send buffer size socket option to the - * specified value. The send buffer size option is used by the - * platform's networking code as a hint for the size to set the - * underlying network I/O buffers. This value must be greater - * than 0. - * @param size The socket send buffer size option value. - **/ - public void setSendBufferSize(int size) - { - sockProps_.setSendBufferSize(size); - } - - /** - * This property allows the turning on of socket linger with the - * specified linger time in seconds. The maxium value for this - * property is platform specific. - * @param seconds The socket linger option value. - **/ - public void setSoLinger(int seconds) - { - sockProps_.setSoLinger(seconds); - } - - /** - * This property enables/disables socket timeout with the - * specified value in milliseconds. A timeout value must be - * greater than zero, a value of zero for this property indicates - * infinite timeout. - * @param milliseconds The socket timeout option value. - **/ - public void setSoTimeout(int milliseconds) - { - sockProps_.setSoTimeout(milliseconds); - } - - //@STIMEOUT - /** - * This property enables/disables socket timeout with the - * specified value in milliseconds. A timeout value must be - * greater than zero, a value of zero for this property indicates - * infinite timeout. - * @param milliseconds The socket timeout option value. - **/ - public void setSocketTimeout(int milliseconds) - { - setSoTimeout(milliseconds); - } - - /** - * This property allows the turning on of the TCP no delay socket option. - * @param noDelay The socket TCP no delay option value. - **/ - public void setTcpNoDelay(boolean noDelay) - { - sockProps_.setTcpNoDelay(noDelay); - } - // @F1A End of new socket option methods - - // @M0A - added support for sending statements in UTF-16 and storing them in a UTF-16 package - /** - * Gets the package CCSID property, which indicates the - * CCSID in which statements are sent to the IBM i system and - * also the CCSID of the package they are stored in. - * Default value: 13488 - * @return The value of the package CCSID property. - **/ - public int getPackageCCSID() - { - return properties_.getInt(JDProperties.PACKAGE_CCSID); - } - - //@dup - /** - * Gets the package CCSID property, which indicates the - * CCSID in which statements are sent to the IBM i system and - * also the CCSID of the package they are stored in. - * Default value: 13488 - * @return The value of the package CCSID property. - * Note: this method is the same as getPackageCCSID() so that it corresponds to the connection property name - **/ - public int getPackageCcsid() - { - return getPackageCCSID(); - } - - // @M0A - /** - * Sets the package CCSID property, which indicates the - * CCSID in which statements are sent to the IBM i system and - * also the CCSID of the package they are stored in. - * Recommended values: 1200(UTF-16) and 13488 (UCS-2). - * See BidiStringType for Bidi considerations. - * Default value: 13488 - * @param ccsid The package CCSID. - **/ - public void setPackageCCSID(int ccsid) - { - String property = "packageCCSID"; - - Integer oldPackageCCSID = new Integer(getPackageCCSID()); - Integer newPackageCCSID = new Integer(ccsid); - - validateProperty(property, newPackageCCSID.toString(), JDProperties.PACKAGE_CCSID); - - properties_.setString(JDProperties.PACKAGE_CCSID, newPackageCCSID.toString()); - - changes_.firePropertyChange(property, oldPackageCCSID, newPackageCCSID); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + ccsid); - } - - //@dup - /** - * Sets the package CCSID property, which indicates the - * CCSID in which statements are sent to the IBM i system and - * also the CCSID of the package they are stored in. - * Recommended values: 1200(UTF-16) and 13488 (UCS-2). - * See BidiStringType for Bidi considerations. - * Default value: 13488 - * @param ccsid The package CCSID. - * Note: this method is the same as setPackageCCSID() so that it corresponds to the connection property name - **/ - public void setPackageCcsid(int ccsid) - { - setPackageCCSID(ccsid); - } - - // @M0A - added support for 63 digit decimal precision - /** - * Gets the minimum divide scale property. This property ensures the scale - * of the result of decimal division is never less than its specified value. - * Valid values: 0-9. 0 is default. - * @return The minimum divide scale. - **/ - public int getMinimumDivideScale() - { - return properties_.getInt(JDProperties.MINIMUM_DIVIDE_SCALE); - } - - /** - * Gets the maximum block input rows. This property indicates the - * number of rows sent to the database engine for a block insert - * operation. Valid values: 1-32000. 32000 is default. - * @return The maximum block input rows - */ - public int getMaximumBlockedInputRows() { - return properties_.getInt(JDProperties.MAXIMUM_BLOCKED_INPUT_ROWS); - } - - // @M0A - /** - * Gets the maximum precision property. This property indicates the - * maximum decimal precision the IBM i system should use. - * Valid values: 31 or 63. 31 is default. - * @return The maximum precision. - **/ - public int getMaximumPrecision() - { - return properties_.getInt(JDProperties.MAXIMUM_PRECISION); - } - - // @M0A - /** - * Gets the maximum scale property. This property indicates the - * maximum decimal scale the IBM i system should use. - * Valid values: 0-63. 31 is default. - * @return The maximum scale. - **/ - public int getMaximumScale() - { - return properties_.getInt(JDProperties.MAXIMUM_SCALE); - } - - // @M0A - /** - * Sets the minimum divide scale property. This property ensures the scale - * of the result of decimal division is never less than its specified value. - * Valid values: 0-9. 0 is default. - * @param scale The minimum divide scale. - **/ - public void setMinimumDivideScale(int scale) - { - String property = "minimumDivideScale"; - - Integer oldValue = new Integer(getMinimumDivideScale()); - Integer newValue = new Integer(scale); - - validateProperty(property, newValue.toString(), JDProperties.MINIMUM_DIVIDE_SCALE); - - properties_.setString(JDProperties.MINIMUM_DIVIDE_SCALE, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + scale); - } - - // @A6A - /** - * Sets the maximum blocked input rows. This property indicates the - * maximum number of rows sent to the database engine for a blocked - * input operation. Valid values: 1-32000. 32000 is the default - * @param maximumBlockedInputRows The maximum number of input rows - */ - public void setMaximumBlockedInputRows(int maximumBlockedInputRows) - { - String property = "maximumBlockedInputRows"; - - Integer oldValue = new Integer(getMaximumBlockedInputRows()); - Integer newValue = new Integer(maximumBlockedInputRows); - - if (maximumBlockedInputRows < 0 || maximumBlockedInputRows > 32000) { - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (maximumBlockedInputRows == 0) { - maximumBlockedInputRows = 32000; - } - - properties_.setString(JDProperties.MAXIMUM_BLOCKED_INPUT_ROWS, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + maximumBlockedInputRows); - } - - - // @M0A - /** - * Sets the maximum precision property. This property indicates the - * maximum decimal precision the IBM i system should use. - * Valid values: 31 or 63. 31 is default. - * @param precision The maximum precision. - **/ - public void setMaximumPrecision(int precision) - { - String property = "maximumPrecision"; - - Integer oldValue = new Integer(getMaximumPrecision()); - Integer newValue = new Integer(precision); - - validateProperty(property, newValue.toString(), JDProperties.MAXIMUM_PRECISION); - - properties_.setString(JDProperties.MAXIMUM_PRECISION, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + precision); - } - - // @M0A - /** - * Sets the maximum scale property. This property indicates the - * maximum decimal scale the IBM i system should use. - * Valid values: 0-63. 31 is default. - * @param scale The maximum scale. - **/ - public void setMaximumScale(int scale) - { - String property = "maximumScale"; - - Integer oldValue = new Integer(getMaximumScale()); - Integer newValue = new Integer(scale); - - // validate the new value - validateProperty(property, newValue.toString(), JDProperties.MAXIMUM_SCALE); - - properties_.setString(JDProperties.MAXIMUM_SCALE, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + scale); - } - - // @M0A - added support for hex constant parser option - /** - * Gets the translate hex property, which indicates how - * the parser will treat hexadecimal literals. - * @return The value of the translate hex property. - *

Valid values include: - *

    - *
  • "character" (Interpret hexadecimal constants as character data) - *
  • "binary" (Interpret hexadecimal constants as binary data) - *
- * The default value is "character". - **/ - public String getTranslateHex() - { - return properties_.getString(JDProperties.TRANSLATE_HEX); - } - - // @M0A - /** - * Sets the translate hex property, which indicates how - * the parser will treat hexadecimal literals. - * @param parseOption The hex constant parser option. - *

Valid values include: - *

    - *
  • "character" (Interpret hexadecimal constants as character data) - *
  • "binary" (Interpret hexadecimal constants as binary data) - *
- * The default value is "character". - **/ - public void setTranslateHex(String parseOption) - { - String property = "translateHex"; - - String oldOption = getTranslateHex(); - String newOption = parseOption; - - validateProperty(property, newOption, JDProperties.TRANSLATE_HEX); - - properties_.setString(JDProperties.TRANSLATE_HEX, newOption); - - changes_.firePropertyChange(property, oldOption, newOption); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + parseOption); - } - - //@K3A - /** - * Sets the QAQQINI library name. - * @param libraryName The QAQQINI library name. - **/ - public void setQaqqiniLibrary(String libraryName) - { - String property = "qaqqiniLibrary"; - if (libraryName == null) - throw new NullPointerException(property); - - String old = getQaqqiniLibrary(); - properties_.setString(JDProperties.QAQQINILIB, libraryName); - - changes_.firePropertyChange(property, old, libraryName); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + libraryName); - } - - //@dup - /** - * Sets the QAQQINI library name. - * @param libraryName The QAQQINI library name. - * Note: this method is the same as setQaqqiniLibrary() so that it corresponds to the connection property name - **/ - public void setQaqqinilib(String libraryName) - { - setQaqqiniLibrary(libraryName); - } - - /** - * Sets the goal the IBM i system should use with optimization of queries. - * This setting corresponds with the system's QAQQINI option called OPTIMIZATION_GOAL. - * Note, this setting is ignored when running to V5R3 IBM i or earlier - * @param goal - the optimization goal - *

Valid values include: - *

    - *
  • 0 = Optimize query for first block of data (*ALLIO) when extended dynamic packages are used; Optimize query for entire result set (*FIRSTIO) when packages are not used
  • - *
  • 1 = Optimize query for first block of data (*FIRSTIO)
  • - *
  • 2 = Optimize query for entire result set (*ALLIO)
  • - *
- * The default value is 0. - **/ - public void setQueryOptimizeGoal(int goal) - { - String property = "queryOptimizeGoal"; - - Integer oldValue = new Integer(getQueryOptimizeGoal()); - Integer newValue = new Integer(goal); - - properties_.setString(JDProperties.QUERY_OPTIMIZE_GOAL, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + goal); - } - - //@550 - /** - * Sets the storage limit in megabytes, that should be used for statements executing a query in a connection. - * Note, this setting is ignored when running to i5/OS V5R4 or earlier - * You must have *JOBCTL special authority to use query storage limit with Version 6 Release 1 of IBM i. - * @param limit the storage limit (in megabytes) - *

Valid values are -1 to MAX_STORAGE_LIMIT megabytes. - * The default value is -1 meaning there is no limit. - **/ - public void setQueryStorageLimit(int limit) - { - String property = "queryStorageLimit"; - - if (limit < -1 || limit > MAX_STORAGE_LIMIT) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - Integer oldValue = new Integer(getQueryStorageLimit()); - Integer newValue = new Integer(limit); - - properties_.setString(JDProperties.QUERY_STORAGE_LIMIT, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + limit); - } - - //@540 - /** - * Sets whether lock sharing is allowed for loosely coupled transaction branches. - * Note, this setting is ignored when running to V5R3 IBM i or earlier. - * @param lcs - the "loosely coupled support" setting - *

Valid values include: - *

    - *
  • 0 = Locks cannot be shared
  • - *
  • 1 = Locks can be shared
  • - *
- * The default value is 0. - **/ - public void setXALooselyCoupledSupport(int lcs) - { - String property = "xaLooselyCoupledSupport"; - - Integer oldValue = new Integer(getXALooselyCoupledSupport()); - Integer newValue = new Integer(lcs); - - properties_.setString(JDProperties.XA_LOOSELY_COUPLED_SUPPORT, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + lcs); - } - - //K2A - /** - * Returns the toolbox trace category. - * @return The toolbox trace category. - *

Valid values include: - *

    - *
  • "none" - The default value. - *
  • "datastream" - *
  • "diagnostic" - *
  • "error" - *
  • "information" - *
  • "warning" - *
  • "conversion" - *
  • "proxy" - *
  • "pcml" - *
  • "jdbc" - *
  • "all" - *
  • "thread" - *
- **/ - public String getToolboxTraceCategory() - { - return properties_.getString(JDProperties.TRACE_TOOLBOX); - } - - //@dup - /** - * Returns the toolbox trace category. - * @return The toolbox trace category. - *

Valid values include: - *

    - *
  • "none" - The default value. - *
  • "datastream" - *
  • "diagnostic" - *
  • "error" - *
  • "information" - *
  • "warning" - *
  • "conversion" - *
  • "proxy" - *
  • "pcml" - *
  • "jdbc" - *
  • "all" - *
  • "thread" - *
- * Note: this method is the same as getToolboxTraceCategory() so that it corresponds to the connection property name - **/ - public String getToolboxTrace() - { - return getToolboxTraceCategory(); - } - - // @K2A - /** - * Sets the toolbox trace category, which indicates - * what trace points and diagnostic messages should be logged. - * @param traceCategory The category option. - *

Valid values include: - *

    - *
  • "none" - *
  • "datastream" - *
  • "diagnostic" - *
  • "error" - *
  • "information" - *
  • "warning" - *
  • "conversion" - *
  • "proxy" - *
  • "pcml" - *
  • "jdbc" - *
  • "all" - *
  • "thread" - *
- * The default value is "none". - **/ - public void setToolboxTraceCategory(String traceCategory) - { - String property = "toolboxTrace"; - - String oldOption = getToolboxTraceCategory(); - String newOption = traceCategory; - - validateProperty(property, newOption, JDProperties.TRACE_TOOLBOX); - - properties_.setString(JDProperties.TRACE_TOOLBOX, newOption); - - changes_.firePropertyChange(property, oldOption, newOption); - - if(!traceCategory.equals("") && !traceCategory.equals("none")) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - if(traceCategory.equals("datastream")) - Trace.setTraceDatastreamOn(true); - else if(traceCategory.equals("diagnostic")) - Trace.setTraceDiagnosticOn(true); - else if(traceCategory.equals("error")) - Trace.setTraceErrorOn(true); - else if(traceCategory.equals("information")) - Trace.setTraceInformationOn(true); - else if(traceCategory.equals("warning")) - Trace.setTraceWarningOn(true); - else if(traceCategory.equals("conversion")) - Trace.setTraceConversionOn(true); - else if(traceCategory.equals("proxy")) - Trace.setTraceProxyOn(true); - else if(traceCategory.equals("pcml")) - Trace.setTracePCMLOn(true); - else if(traceCategory.equals("jdbc")) - Trace.setTraceJDBCOn(true); - else if(traceCategory.equals("all")) - Trace.setTraceAllOn(true); - else if(traceCategory.equals("thread")) - Trace.setTraceThreadOn(true); - } - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + traceCategory); - } - - //@dup - /** - * Sets the toolbox trace category, which indicates - * what trace points and diagnostic messages should be logged. - * @param traceCategory The category option. - *

Valid values include: - *

    - *
  • "none" - *
  • "datastream" - *
  • "diagnostic" - *
  • "error" - *
  • "information" - *
  • "warning" - *
  • "conversion" - *
  • "proxy" - *
  • "pcml" - *
  • "jdbc" - *
  • "all" - *
  • "thread" - *
- * The default value is "none". - * Note: this method is the same as setToolboxTraceCategory() so that it corresponds to the connection property name - **/ - public void setToolboxTrace(String traceCategory) - { - setToolboxTraceCategory(traceCategory); - } - - /** - * Validates the property value. - * @param property The property name. - * @param value The property value. - * @param index The property index. - **/ - private void validateProperty(String property, String value, int index) - { - if (value.length() != 0) - { // @A7A - DriverPropertyInfo[] info = properties_.getInfo(); - String[] choices = info[index].choices; - - //Bidi-HCG start - //exception for "package ccsid" - it can accept any integer - if(index == JDProperties.PACKAGE_CCSID){ - try{ - int ccsid = Integer.valueOf(value).intValue(); - if(ccsid < 1) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - return; - }catch(NumberFormatException e){ - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - //Bidi-HCG end - - boolean notValid = true; - int current = 0; - while (notValid && current < choices.length) - { - if (value.equalsIgnoreCase(choices[current])) - notValid = false; - else - current++; - } - if (notValid) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } // @A7A - } - - /** - * Serializes the IBM i system and user information. - * @param out The output stream. - * @exception IOException If a file I/O error occurs. - **/ - private void writeObject(ObjectOutputStream out) throws IOException - { - Trace.log(Trace.INFORMATION, "AS400JDBCDataSource.writeObject"); - // @F0D String server = getServerName(); - // @F0D if (!server.equals("")) - // @F0D serialServerName_ = server; - - // @F0D String user = getUser(); - // @F0D if (!user.equals("")) - // @F0D serialUserName_ = user; - - if (!savePasswordWhenSerialized_) //@J3a - { //@J3a - serialPWBytes_ = null; //@J3a - serialKeyRingPWBytes_ = null; //@J3a - } //@J3a - - // Serialize the object. - out.defaultWriteObject(); - } - - /** - * Returns the string representation of the object. - * @return The string representation. - **/ - public String toString() - { - /* - * Implementation note: Used only for tracing information. - */ - String name = getDataSourceName(); - if (name == null) - name = ""; - return name; - } - - // @J3 new method. - // Twiddle password bytes. - private static char[] xpwConfuse(String info) - { - Random rng = new Random(); - byte[] adderBytes = new byte[18]; - rng.nextBytes(adderBytes); - char[] adder = BinaryConverter.byteArrayToCharArray(adderBytes); - - byte[] maskBytes = new byte[14]; - rng.nextBytes(maskBytes); - char[] mask = BinaryConverter.byteArrayToCharArray(maskBytes); - - char[] infoBytes = xencode(adder, mask, info.toCharArray()); - char[] returnBytes = new char[info.length() + 16]; - System.arraycopy(adder, 0, returnBytes, 0, 9); - System.arraycopy(mask, 0, returnBytes, 9, 7); - System.arraycopy(infoBytes, 0, returnBytes, 16, info.length()); - - return returnBytes; - } - - // @J3 new method. - // Get clear password bytes back. - private static String xpwDeconfuse(char[] info) - { - char[] adder = new char[9]; - System.arraycopy(info, 0, adder, 0, 9); - char[] mask = new char[7]; - System.arraycopy(info, 9, mask, 0, 7); - char[] infoBytes = new char[info.length - 16]; - System.arraycopy(info, 16, infoBytes, 0, info.length - 16); - - return new String(xdecode(adder, mask, infoBytes)); - } - - // @J3 new method - // Scramble some bytes. - private static char[] xencode(char[] adder, char[] mask, char[] bytes) - { - if (bytes == null) return null; - int length = bytes.length; - char[] buf = new char[length]; - for (int i = 0; i < length; ++i) - { - buf[i] = (char)(bytes[i] + adder[i % 9]); - } - for (int i = 0; i < length; ++i) - { - buf[i] = (char)(buf[i] ^ mask[i % 7]); - } - return buf; - } - - - // @J3 new method. - private static char[] xdecode(char[] adder, char[] mask, char[] bytes) - { - int length = bytes.length; - char[] buf = new char[length]; - for (int i = 0; i < length; ++i) - { - buf[i] = (char)(mask[i % 7] ^ bytes[i]); - } - for (int i = 0; i < length; ++i) - { - buf[i] = (char)(buf[i] - adder[i % 9]); - } - return buf; - } - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCDataSource", "javax.sql.DataSource" }; - } - - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCDatabaseMetaData.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCDatabaseMetaData.java deleted file mode 100644 index 43fb7bbf7..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCDatabaseMetaData.java +++ /dev/null @@ -1,7911 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCDatabaseMetaData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.CallableStatement; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -/* ifdef JDBC40 */ -import java.sql.RowIdLifetime; -/* endif */ -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Types; -import java.util.Vector; // @D0A - - - -// @E4C -/** -The AS400JDBCDatabaseMetaData class provides information -about the database as a whole. - -

Some of the methods in this class take arguments that are -pattern strings. Such arguments are suffixed with "Pattern". -Within a pattern string, "%" means match any substring of zero -or more characters, and "_" means match exactly one character. -Only entries matching the pattern string are returned. - -

For example, if the schemaPattern argument for getTables() -is "H%WO_LD", then the following schemas might match -the pattern, provided they exist on the system: -

-HELLOWORLD
-HIWORLD
-HWORLD
-HELLOWOULD
-HIWOULD
-
- -

Many of the methods here return lists of information in -result sets. You can use the normal ResultSet methods to -retrieve data from these result sets. The format of the -result sets are described in the JDBC interface specification. - -

Schema and table names that are passed as input to methods -in this class are implicitly uppercased unless enclosed in -double-quotes. -**/ - -//----------------------------------------------------------- -// Using nulls and empty strings for catalog functions -// -// When the parameter is NOT search pattern capable and: -// null is specified for: -// catalog (system) - parameter is ignored -// schema (library) - use default SQL schema -// The default SQL schema can be -// set in the URL. If not -// specified in URL, the first -// library specified in the library -// properties is used as the -// default SQL schema. -// If no default SQL schema exists, -// QGPL is used. -// table (file) - empty result set is returned -// column (field) - empty result set is returned -// empty string is specified for: -// catalog (system) - empty result set is returned -// schema (library) - empty result set is returned -// table (file) - empty result set is returned -// column (field) - empty result set is returned -// -// -// When the parameter is search pattern capable and: -// null is specified for: -// schemaPattern (library) - no value sent to system. -// System default of -// *USRLIBL is used. -// tablePattern (file) - no value sent to system -// system default of *ALL used -// empty string is specified for: -// schemaPattern (library) - empty result set is returned -// tablePattern (file) - empty result set is returned -// -// -//---------------------------------------------------------- - -public class AS400JDBCDatabaseMetaData -/* ifdef JDBC40 */ -extends ToolboxWrapper -/* endif */ - -implements DatabaseMetaData -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - - //New constants for JDBC 3.0. - public static final int sqlStateXOpen = 1; - public static final int sqlStateSQL99 = 2; - - - // Private data. - private AS400JDBCConnection connection_; - private int id_; - private SQLConversionSettings settings_; - - //@mdsp misc constants for sysibm stored procedures - final static int SQL_NO_NULLS = 0; //@mdsp - final static int SQL_NULLABLE = 1; //@mdsp - final static int SQL_NULLABLE_UNKNOWN = 2; //@mdsp - final static int SQL_BEST_ROWID = 1; //@mdsp - final static int SQL_ROWVER = 2; //@mdsp - static final String EMPTY_STRING = ""; //@mdsp - static final String MATCH_ALL = "%"; //@mdsp - - - private static final String VIEW = "VIEW"; //@mdsp - private static final String TABLE = "TABLE"; //@mdsp - private static final String SYSTEM_TABLE = "SYSTEM TABLE"; //@mdsp - private static final String ALIAS = "ALIAS"; //@mdsp - private static final String MQT = "MATERIALIZED QUERY TABLE"; //@mdsp - private static final String SYNONYM = "SYNONYM"; //@mdsp - private static final String FAKE_VALUE = "QCUJOFAKE"; //@mdsp - private static final int SQL_ALL_TYPES = 0; //@mdsp - - // the DB2 SQL reference says this should be 2147483647 but we return 1 less to allow for NOT NULL columns - static final int MAX_LOB_LENGTH = 2147483646; //@xml3 - - - - /** - Constructs an AS400JDBCDatabaseMetaData object. - - @param connection The connection to the system. - @param id The ID the caller has assigned to this - AS400JDBCDatabaseMetaData. - **/ - AS400JDBCDatabaseMetaData (AS400JDBCConnection connection, int id) - throws SQLException - { - connection_ = connection; - settings_ = new SQLConversionSettings (connection); - id_ = id; - } - - - - /** - Indicates if all of the procedures returned by getProcedures() can be - called by the current user. - - @return Always false. This driver cannot determine if all of the procedures - can be called by the current user. - @exception SQLException This exception is never thrown. - **/ - public boolean allProceduresAreCallable () - throws SQLException - { - return false; - } - - - - /** - Indicates if all of the tables returned by getTables() can be - SELECTed by the current user. - - @return Always false. This driver cannot determine if all of the tables - returned by getTables() can be selected by the current user. - @exception SQLException This exception is never thrown. - **/ - public boolean allTablesAreSelectable () - throws SQLException - { - return false; - } - - - - /** - Indicates if a data definition statement within a transaction - can force the transaction to commit. - - @return Always false. A data definition statement within a transaction - does not force the transaction to commit. - @exception SQLException This exception is never thrown. - **/ - public boolean dataDefinitionCausesTransactionCommit () - throws SQLException - { - return false; - } - - - - /** - Indicates if a data definition statement within a transaction is - ignored. - - @return Always false. A data definition statement within a - transaction is not ignored. - @exception SQLException This exception is never thrown. - **/ - public boolean dataDefinitionIgnoredInTransactions () - throws SQLException - { - return false; - } - - - - // JDBC 2.0 - /** - Indicates if visible deletes to a result set of the specified type - can be detected by calling ResultSet.rowDeleted(). If visible - deletes cannot be detected, then rows are removed from the - result set as they are deleted. - - @param resultSetType The result set type. Value values are: -

    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @return Always false. Deletes can not be detected - by calling ResultSet.rowDeleted(). - - @exception SQLException If the result set type is not valid. - **/ - public boolean deletesAreDetected (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return false; - } - - - - /** - Indicates if getMaxRowSize() includes blobs when computing the - maximum length of a single row. - - @return Always true. getMaxRowSize() does include blobs when - computing the maximum length of a single row. - @exception SQLException This exception is never thrown. - **/ - public boolean doesMaxRowSizeIncludeBlobs () - throws SQLException - { - return true; - } - - - - //@G4A - /** - Returns a ResultSet containing a description of type attributes available in a - specified catalog. - - This method only applies to the attributes of a - structured type. Distinct types are stored in the datatypes - catalog, not the attributes catalog. Since DB2 for IBM i does not support - structured types at this time, an empty ResultSet will always be returned - for calls to this method. - - @param catalog The catalog name. - @param schemaPattern The schema name pattern. - @param typeNamePattern The type name pattern. - @param attributeNamePattern The attribute name pattern. - - @return The empty ResultSet - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public ResultSet getAttributes (String catalog, String schemaPattern, - String typeNamePattern, String attributeNamePattern) - throws SQLException - { - // We return an empty result set because this is not supported by our driver - Statement statement = connection_.createStatement(); - return statement.executeQuery("SELECT VARCHAR('1', 128) AS TYPE_CAT, " + - "VARCHAR('2', 128) AS TYPE_SCHEM, " + - "VARCHAR('3', 128) AS TYPE_NAME, " + - "VARCHAR('4', 128) AS ATTR_NAME, " + - "SMALLINT(5) AS DATA_TYPE, " + - "VARCHAR('6', 128) AS ATTR_TYPE_NAME, " + - "INT(7) AS ATTR_SIZE, " + - "INT(8) AS DECIMAL_DIGITS, " + - "INT(9) AS NUM_PREC_RADIX, " + - "INT(10) AS NULLABLE, " + - "VARCHAR('11', 128) AS REMARKS, " + - "VARCHAR('12', 128) AS ATTR_DEF, " + - "INT(13) AS SQL_DATA_TYPE, " + - "INT(14) AS SQL_DATETIME_SUB, " + - "INT(15) AS CHAR_OCTET_LENGTH, " + - "INT(16) AS ORDINAL_POSITION, " + - "VARCHAR('17', 128) AS IS_NULLABLE, " + - "VARCHAR('18', 128) AS SCOPE_CATALOG, " + - "VARCHAR('19', 128) AS SCOPE_SCHEMA, " + - "VARCHAR('20', 128) AS SCOPE_TABLE, " + - "SMALLINT(21) AS SOURCE_DATA_TYPE " + - "FROM QSYS2" + getCatalogSeparator() + - "SYSTYPES WHERE 1 = 2 FOR FETCH ONLY "); - } - - - - /** - Returns a description of a table's optimal set of columns - that uniquely identifies a row. - - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schema The schema name. If null is specified, the - default SQL schema specified in the URL is used. - If null is specified and a default SQL schema was not - specified in the URL, the first library specified - in the libraries properties file is used. - If null is specified and a default SQL schema was - not specified in the URL and a library was not - specified in the libraries properties file, - QGPL is used. - If empty string is specified, an empty result set will - be returned. - @param table The table name. If null or empty string is specified, - an empty result set is returned. - @param scope The scope of interest. Valid values are: - bestRowTemporary and bestRowTransaction. - bestRowSession is not allowed because - it cannot be guaranteed that - the row will remain valid for the session. - If bestRowSession is specified, an empty result - set is returned. - If bestRowTransaction is specified, - autocommit is false, and transaction is set to repeatable read, - then results is returned; otherwise, an empty result set - is returned. - @param nullable The value indicating if columns that are nullable should be included. - @return The ResultSet containing a table's optimal - set of columns that uniquely identify a row. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getBestRowIdentifier (String catalog, - String schema, - String table, - int scope, - boolean nullable) - throws SQLException - { - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc3 - DBReplyRequestedDS getBestRowIdentifierReply = null; - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cstmt = connection_.prepareCall("call SYSIBM" + getCatalogSeparator () + "SQLSPECIALCOLUMNS(?,?,?,?,?,?,?)"); - - cstmt.setShort(1, (short)SQL_BEST_ROWID); - cstmt.setString(2, normalize(catalog)); - cstmt.setString(3, normalize(schema)); - cstmt.setString(4, normalize(table)); - cstmt.setShort(5, (short) scope); - if (nullable) { - cstmt.setShort(6, (short) SQL_NULLABLE); - } else { - cstmt.setShort(6, (short) SQL_NO_NULLS); - } - cstmt.setString(7, - "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - cstmt.execute(); - - ResultSet rs = cstmt.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cstmt.close(); //@mdrs2 - - return rs; //@mdrs - } - - // Initialize the format of the result set. - String[] fieldNames = { "SCOPE", - "COLUMN_NAME", - "DATA_TYPE", - "TYPE_NAME", - "COLUMN_SIZE", - "BUFFER_LENGTH", - "DECIMAL_DIGITS", - "PSEUDO_COLUMN", - }; - - SQLData[] sqlData = { new SQLSmallint (vrm), // scope //@trunc3 - new SQLVarchar (128, settings_), // column name - new SQLSmallint (vrm), // data type //@trunc3 - new SQLVarchar (128, settings_), // type name - new SQLInteger (vrm), // column size //@trunc3 - new SQLInteger (vrm), // buffer length //@trunc3 - new SQLSmallint (vrm), // decimal digits //@trunc3 - new SQLSmallint (vrm), // pseudo column //@trunc3 - }; - - int[] fieldNullables = { columnNoNulls, // scope - columnNoNulls, // column name - columnNoNulls, // data type - columnNoNulls, // type name - columnNoNulls, // column size - columnNoNulls, // buffer length - columnNoNulls, // decimal digits - columnNoNulls, // pseudo column - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if (!isCatalogValid(catalog) || // catalog is empty string - - // schema is not null and is empty string - ((schema != null) && (schema.length()==0)) || - - // Table is null - (table==null) || - - // Table is empty string - (table.length()==0 ) || - - // Scope. - // If bestRowSession is specified, return empty set - // since it can not be guaranteed that the row will - // remain valid for the session. - // If bestRowTemporary is specified, return results. - // If bestRowTransaction is specified and autocommit - // is true or transaction is not repeatableRead, return - // empty result set - - ((scope == bestRowSession) || - - ( (scope == bestRowTransaction) && - ( (connection_.getAutoCommit()==true) || - (connection_.getTransactionIsolation() != Connection.TRANSACTION_REPEATABLE_READ))))) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - - else - { // parameter values are valid, build request & send - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_SPECIAL_COLUMN_INFO , - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - - - // Set the library name - if (schema == null) - { // use default SQL schema or qgpl - request.setLibraryName(connection_.getDefaultSchema(), connection_.converter_); //@P0C - } - else request.setLibraryName(normalize(schema), connection_.converter_); // @E4C @P0C - - // Set the table name - request.setFileName(normalize(table), connection_.converter_); // @E4C @P0C - - - // Set the Field Information to Return Bitmap - // Return library, table, and column - - request.setSpecialColumnsReturnInfoBitmap(0x1F000000); - - - // Set the short / long file and field name indicator - request.setFileShortOrLongNameIndicator(0xF0); // Long - - // Set if columns are nullable - request.setSpecialColumnsNullableIndicator(nullable ? - 0xF1 : 0xF0); - - //-------------------------------------------------------- - // Send the request and cache all results from the system - //-------------------------------------------------------- - if (getBestRowIdentifierReply != null) { getBestRowIdentifierReply.returnToPool(); getBestRowIdentifierReply=null; } - getBestRowIdentifierReply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = getBestRowIdentifierReply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = getBestRowIdentifierReply.getReturnCode(); - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - // Get the data format and result data - DBDataFormat dataFormat = getBestRowIdentifierReply.getDataFormat(); - DBData resultData = getBestRowIdentifierReply.getResultData(); - if (resultData != null) - { - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache(row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - JDFieldMap[] maps = new JDFieldMap[8]; - maps[0] = new JDHardcodedFieldMap(new Short ((short) scope)); // scope - maps[1] = new JDSimpleFieldMap (1); // column name - maps[2] = new JDDataTypeFieldMap (2, 4, 3, 5, 0, connection_.getVRM(), connection_.getProperties()); // @M0C // data type - converted to short //@KKB pass 0 for ccsid since cannot get ccsid from host server - maps[3] = new JDSimpleFieldMap (2); // type name - maps[4] = new JDSimpleFieldMap (4); // column size (length) - maps[5] = new JDHardcodedFieldMap(new Integer (0)); // buffer length - maps[6] = new JDSimpleFieldMap (5); // decimal digits (scale) - maps[7] = new JDHardcodedFieldMap(new Short ((short) versionColumnNotPseudo)); - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - else - rowCache = new JDSimpleRowCache(formatRow); - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // Cannot return to pool yet because array in use by resultData. Pased to result set to be closed there - // if (getBestRowIdentifierReply != null) getBestRowIdentifierReply.returnToPool(); - } - } - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), "BestRowIdentifier", connection_, getBestRowIdentifierReply); //@in2 - } - - - - - - /** - Returns the catalog name available in this database. This - will return a ResultSet with a single row, whose value is - the IBM i system name. - - @return The ResultSet containing the IBM i system name. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getCatalogs () - throws SQLException - { - connection_.checkOpen (); - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cstmt = connection_.prepareCall("CALL SYSIBM" + getCatalogSeparator() + "SQLTABLES(?,?,?,?,?)"); - - cstmt.setString(1, "%"); - cstmt.setString(2, "%"); - cstmt.setString(3, "%"); - cstmt.setString(4, "%"); - cstmt.setString(5, "DATATYPE='JDBC';GETCATALOGS=1;CURSORHOLD=1"); - cstmt.execute(); - ResultSet rs = cstmt.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cstmt.close(); //@mdrs2 - - return rs; //@mdrs - } - - String[] fieldNames = {"TABLE_CAT"}; - SQLData[] sqlData = { new SQLVarchar (128, settings_)}; - int[] fieldNullables = {columnNoNulls}; // Catalog Name - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - Object[][] data = { { connection_.getCatalog()}}; - boolean[][] nulls = {{false}}; - boolean[][] dataMappingErrors = {{false}}; - - // If running to a system running OS/400 v5r2 or IBM i the list can contain more than just the system - // name (when IASPs are on the system). Try to retrieve that list. Note - // if getting the list fails we will still return a result set containing - // one item -- the name of the system. We just built that result set - // (the previous six lines of code) and that is what we will return. That - // result set will be consistent with the result set returned when connecting - // to OS/400 v5r1 or earlier versions. If getting the list works we will - // build and return a new result set containing data retrieved from the system. - if (connection_.getVRM() >= JDUtilities.vrm520) // @F1a - { // @F1a - try - { // @F1a // @F1a - Vector RDBEntries = new Vector(); // @F1a - - Statement statement = null; //@scan1 - ResultSet rs = null; //@scan1 - try - { - statement = connection_.createStatement(); // @F1a - rs = statement.executeQuery("SELECT LOCATION FROM QSYS2" + getCatalogSeparator() + "SYSCATALOGS WHERE RDBTYPE = 'LOCAL' AND RDBASPSTAT='AVAILABLE' "); // @F1a - while (rs.next()) // @F1a - { // @F1a - RDBEntries.add(rs.getString(1).trim()); // @F1a - } - }finally //@scan1 - { - try{ - if(rs != null) - rs.close(); - }catch(Exception e){} //allow next close to execute - if(statement != null) - statement.close(); - } - int count = RDBEntries.size(); // @F1a - if (count > 0) // @F1a - { // @F1a - data = new Object[count][1]; // @F1a - nulls = new boolean[count][1]; // @F1a - dataMappingErrors = new boolean[count][1]; - for (int i=0; i= 30; //@F2A @j4a - - String[] fieldNames = null; //@F2C - SQLData[] sqlData = null; //@F2C - int[] fieldNullables = null; //@F2C - //@F2A Result sets must be different depending on whether we are running under JDBC 3.0 - //@pda jdbc40 is also contained in same block as jdbc30, since this file is jdbc40 only compiled. - int vrm = connection_.getVRM(); //@trunc3 - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cs = connection_.prepareCall("CALL SYSIBM" + getCatalogSeparator() + "SQLCOLUMNS(?,?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, normalize(schemaPattern)); - cs.setString(3, normalize(tablePattern)); - cs.setString(4, normalize(columnPattern)); -/* ifdef JDBC40 */ - cs.setString(5, "DATATYPE='JDBC';JDBCVER='4.0';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); //@ver4 -/* endif */ -/* ifndef JDBC40 - cs.setString(5, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - endif */ - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - - // Create an return the result set for the request. - // Note: This will failed until SQLCOLUMNS returns more columns - // return new DB2RSGetColumns40(x, isTransactional); - } - - if (!isJDBC3) //@F2A - { - // Set up the result set in the format required by JDBC - fieldNames = new String[] {"TABLE_CAT", - "TABLE_SCHEM", - "TABLE_NAME", - "COLUMN_NAME", - "DATA_TYPE", - "TYPE_NAME", - "COLUMN_SIZE", - "BUFFER_LENGTH", - "DECIMAL_DIGITS", - "NUM_PREC_RADIX", - "NULLABLE", - "REMARKS", - "COLUMN_DEF", - "SQL_DATA_TYPE", - "SQL_DATETIME_SUB", - "CHAR_OCTET_LENGTH", - "ORDINAL_POSITION", - "IS_NULLABLE", - }; - - sqlData = new SQLData[] { new SQLVarchar (128, settings_), // catalog - new SQLVarchar (128, settings_), // library - new SQLVarchar (128, settings_), // table - new SQLVarchar (128, settings_), // column - new SQLSmallint (vrm), // data type //@trunc3 - new SQLVarchar (128, settings_), // type name - new SQLInteger (vrm), // column size //@trunc3 - new SQLInteger (vrm), // buffer length //@trunc3 - new SQLInteger (vrm), // decimal digits //@trunc3 - new SQLInteger (vrm), // radix //@trunc3 - new SQLInteger (vrm), // nullable //@trunc3 - new SQLVarchar (254, settings_), // remarks - new SQLVarchar ((connection_.getVRM() >= JDUtilities.vrm610) ? 2000 : 254, settings_), // column def //@550 Column default value support - new SQLInteger (vrm), // sql data type //@trunc3 - new SQLInteger (vrm), // datetime sub //@trunc3 - new SQLInteger (vrm), // octet length //@trunc3 - new SQLInteger (vrm), // ordinal //@trunc3 - new SQLVarchar (254, settings_), // is nullable - }; - - fieldNullables = new int[] {columnNullable, // catalog - columnNullable, // library - columnNoNulls, // table - columnNoNulls, // column - columnNoNulls, // data type - columnNoNulls, // type name - columnNoNulls, // column size - columnNoNulls, // buffer length - columnNoNulls, // decimal digits - columnNoNulls, // radix - columnNoNulls, // nullable - columnNullable, // remarks - columnNullable, // column def - columnNoNulls, // sql data type - columnNoNulls, // datetime sub - columnNoNulls, // octet length - columnNoNulls, // ordinal - columnNoNulls, // is nullable - }; - } - else - { //@F2A - // Set up the result set in the format required by JDBC - fieldNames = new String[] {"TABLE_CAT", - "TABLE_SCHEM", - "TABLE_NAME", - "COLUMN_NAME", - "DATA_TYPE", - "TYPE_NAME", - "COLUMN_SIZE", - "BUFFER_LENGTH", - "DECIMAL_DIGITS", - "NUM_PREC_RADIX", - "NULLABLE", - "REMARKS", - "COLUMN_DEF", - "SQL_DATA_TYPE", - "SQL_DATETIME_SUB", - "CHAR_OCTET_LENGTH", - "ORDINAL_POSITION", - "IS_NULLABLE", -/* ifdef JDBC40 */ - "SCOPE_CATLOG", //@G4A -/* endif */ -/* ifndef JDBC40 - "SCOPE_CATALOG", //@G4A - endif */ - "SCOPE_SCHEMA", //@G4A - "SCOPE_TABLE", //@G4A -/* ifndef JDBC40 - "SOURCE_DATA_TYPE" //@G4A - endif */ -/* ifdef JDBC40 */ - "SOURCE_DATA_TYPE", //@G4A - "IS_AUTOINCREMENT" //jdbc40 -/* endif */ - }; - - sqlData = new SQLData[] { new SQLVarchar (128, settings_), // catalog - new SQLVarchar (128, settings_), // library - new SQLVarchar (128, settings_), // table - new SQLVarchar (128, settings_), // column - new SQLSmallint (vrm), // data type //@trunc3 - new SQLVarchar (128, settings_), // type name - new SQLInteger (vrm), // column size //@trunc3 - new SQLInteger (vrm), // buffer length //@trunc3 - new SQLInteger (vrm), // decimal digits //@trunc3 - new SQLInteger (vrm), // radix //@trunc3 - new SQLInteger (vrm), // nullable //@trunc3 - new SQLVarchar (254, settings_), // remarks - new SQLVarchar ((connection_.getVRM() >= JDUtilities.vrm610) ? 2000 : 254, settings_), // column def - new SQLInteger (vrm), // sql data type //@trunc3 - new SQLInteger (vrm), // datetime sub //@trunc3 - new SQLInteger (vrm), // octet length //@trunc3 - new SQLInteger (vrm), // ordinal //@trunc3 - new SQLVarchar (254, settings_), // is nullable - new SQLVarchar (128, settings_), // scope catalog //@G4A - new SQLVarchar (128, settings_), // scope schema //@G4A - new SQLVarchar (128, settings_), // scope table //@G4A - new SQLSmallint (vrm), // source data type //@G4A //@trunc3 -/* ifdef JDBC40 */ - new SQLVarchar (128, settings_), // is autoincrement //jdbc40 -/* endif */ - }; - - fieldNullables = new int[] {columnNullable, // catalog - columnNullable, // library - columnNoNulls, // table - columnNoNulls, // column - columnNoNulls, // data type - columnNoNulls, // type name - columnNoNulls, // column size - columnNoNulls, // buffer length - columnNoNulls, // decimal digits - columnNoNulls, // radix - columnNoNulls, // nullable - columnNullable, // remarks - columnNullable, // column def - columnNoNulls, // sql data type - columnNoNulls, // datetime sub - columnNoNulls, // octet length - columnNoNulls, // ordinal - columnNoNulls, // is nullable - columnNullable, // scope catalog //@G4A - columnNullable, // scope schema //@G4A - columnNullable, // scope table //@G4A - columnNullable, // source data type //@G4A -/* ifdef JDBC40 */ - columnNoNulls, // is autoincrement //jdbc40 -/* endif */ - }; - } - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows that - // are readable one at a time - try - { - - - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - if (!isCatalogValid(catalog) || // catalog is empty string - - // schema is not null and is empty string - ((schemaPattern != null) && (schemaPattern.length()==0)) || - - // table is not null and is empty string - ((tablePattern != null) && (tablePattern.length()==0)) || - - // columnPattern is not null and is empty string - ((columnPattern != null) && (columnPattern.length()==0))) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - - //-------------------------------------------------- - // Set the parameters for the request - //-------------------------------------------------- - - - else - { // parameter values are valid, continue to build request - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_FIELD_INFO, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - // Set the Library Name and Library Name Search Pattern parameters - // If null, do not set parameter. The system default value of - // *USRLIBL is used - if (schemaPattern != null) - { - JDSearchPattern schema = new JDSearchPattern(schemaPattern); - request.setLibraryName (normalize(schema.getPatternString()), connection_.converter_); // @E4C @P0C - request.setLibraryNameSearchPatternIndicator(schema.getIndicator()); - } - - - - // Set the Table Name and Table Name Search Pattern parameters - // If null, do not set parameter. The system default value of - // *ALL is used. - if (tablePattern!=null) - { - JDSearchPattern table = new JDSearchPattern(tablePattern); - request.setFileName (normalize(table.getPatternString()), connection_.converter_); // @E4C @P0C - request.setFileNameSearchPatternIndicator(table.getIndicator()); - } - - - // Set the Field Name and Field Name Search Pattern parameters - // If null, do not set parameter. The system default value of - // *ALL is used. - if (columnPattern!=null) - { - JDSearchPattern field = new JDSearchPattern(columnPattern); - request.setFieldName (field.getPatternString(), connection_.converter_); //@P0C - request.setFieldNameSearchPatternIndicator(field.getIndicator()); - } - - - // Set the short / long file and field name indicator - request.setFileShortOrLongNameIndicator(0xF0); // Long - - // Set the Field Information to Return Bitmap - // Return everything but the reserved fields - if(connection_.getVRM() >= JDUtilities.vrm610) //@550 column default value support - request.setFieldReturnInfoBitmap(0xEFF70000); //@550 request column default, 16th bit - else //@550 - request.setFieldReturnInfoBitmap(0xEFF60000); // @E3C //@KKB changed from EFF20000 inorder to request CCSID - - - // Set the Field Information Order By Indicator parameter - // Order by: Schema and File and Ordinal Position. - request.setFieldInformationOrderByIndicator (2); // @E5C - - - //------------------------------------------------------- - // Send the request and cache all results from the system - //------------------------------------------------------- - reply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = reply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = reply.getReturnCode(); - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - // Get the data format and result data - DBDataFormat dataFormat = reply.getDataFormat(); - DBData resultData = reply.getResultData(); - - // Put the data format into a row format object - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - - // Put the result data into a row cache - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache(row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - - // Create the mapped row format that is returned in the - // result set. - // This does not actual move the data, it just sets up - // the mapping. - JDFieldMap[] maps = null; //@F2C - if (!isJDBC3) //@F2A - maps = new JDFieldMap[18]; - else -/* ifdef JDBC40 */ - maps = new JDFieldMap[23]; //@G4A //jdbc40 -/* endif */ -/* ifndef JDBC40 - maps = new JDFieldMap[22]; //@G4A - endif */ - - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog ()); - maps[1] = new JDSimpleFieldMap (1); // library - maps[2] = new JDSimpleFieldMap (3); // table - maps[3] = new JDSimpleFieldMap (4); // column - maps[4] = new JDDataTypeFieldMap (6, 7, 10, 11, 12, connection_.getVRM(), connection_.getProperties()); // @M0C // Data type //@KKB include ccsid - maps[5] = new JDLocalNameFieldMap (6, 7, 10, 11, 12, connection_.getVRM(), connection_.getProperties()); // @M0C // Type name //@KKB include ccsid - maps[6] = new JDPrecisionFieldMap (6, 7, 10, 11, 12, connection_.getVRM(), connection_.getProperties()); // @M0C // column size (length) //@KKB include ccsid - maps[7] = new JDHardcodedFieldMap(new Integer(0)); // Buffer - not used - maps[8] = new JDScaleFieldMap (6, 7, 10, 11, 12, connection_.getVRM(), connection_.getProperties()); // @M0C // decimal digits (scale) //@KKB include ccsid - maps[9] = new JDSimpleFieldMap (9); // radix - maps[10] = new JDNullableIntegerFieldMap(8); // is null capable? - - if (connection_.getProperties().equals (JDProperties.REMARKS, JDProperties.REMARKS_SQL)) - maps[11] = new JDSimpleFieldMap (2); // return remarks - else - maps[11] = new JDSimpleFieldMap (5); // return text - - // Always return null if V5R4 or earlier - if(connection_.getVRM() <= JDUtilities.vrm540) //@550 column default value support - maps[12] = new JDHardcodedFieldMap (new SQLVarchar(0, settings_), true, false); // column def - else //@550 return what we are returned - maps[12] = new JDSimpleFieldMap(14); - - // Per JDBC api - not used - hardcode to 0 - maps[13] = new JDHardcodedFieldMap (new Integer (0)); // SQL data type - - // Per JDBC api - not used - hardcode to 0 - maps[14] = new JDHardcodedFieldMap (new Integer (0)); // SQL datetime - - maps[15] = new JDCharOctetLengthFieldMap(6, 7, 10, 11, 12, connection_.getVRM(), connection_.getProperties()); // octet // @M0C //@KKB include ccsid - - // If the server functional level is 7 or greater, then ordinal @E3A - // position is supported. Otherwise, just hardcode to -1. @E3A - if (connection_.getServerFunctionalLevel() >= 7) // @E3A - maps[16] = new JDSimpleFieldMap(13); // @E3A //@KKB changed from 12 since requesting ccsid - else // @E3A - maps[16] = new JDHardcodedFieldMap(new Integer(-1)); - - maps[17] = new JDNullableStringFieldMap(8); // is Nullable - - //@G4A The below fields will all return null. They are not supported - //@G4A by our database. - if (isJDBC3) //@F2A - { - maps[18] = new JDHardcodedFieldMap ("", true, false); // scope catalog //@G4A - maps[19] = new JDHardcodedFieldMap ("", true, false); // scope schema //@G4A - maps[20] = new JDHardcodedFieldMap ("", true, false); // scope table //@G4A - maps[21] = new JDHardcodedFieldMap (new Short((short) 0)); // source data type //@G4A -/* ifdef JDBC40 */ - maps[22] = new JDHardcodedFieldMap (""); // is autoincrement "" till switch to sysibm //jdbc40 -/* endif */ - } - - // Create the mapped row cache that is returned in the - // result set - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } // end of else blank - - } // End of try block - - catch (DBDataStreamException e) - { - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - // Return the results - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "Columns", connection_, reply); //@in2 - - } // End of getColumns - - - - // JDBC 2.0 - /** - Returns the connection for this metadata. - - @return The connection for this metadata. - - @exception SQLException This exception is never thrown. - **/ - public Connection getConnection () - throws SQLException - { - return connection_; - } - - - - - /** - Returns a description of the foreign key columns in the - foreign key table that references the primary key columns - of the primary key table. This is a description of how - the primary table imports the foreign table's key. - - @param primaryCatalog The catalog name. If null is specified, - this parameter is ignored. If - empty string is specified, an empty - result set is returned. - @param primarySchema The name of the schema where the primary table - is located. - If null is specified, the - default SQL schema specified in the URL is used. - If null is specified and a default SQL schema was not - specified in the URL, the first library specified - in the libraries properties file is used. - If null is specified,a default SQL schema was - not specified in the URL, and a library was not - specified in the libraries properties file, - QGPL is used. - If empty string is specified, an empty result - set is returned. - @param primaryTable The primary table name. If null or empty string - is specified, an empty result set is returned. - @param foreignCatalog The catalog name. If null is specified, - this parameter is ignored. If - empty string is specified, an empty - result set is returned. - @param foreignSchema The name of the schema where the primary table - is located. If null is specified, the - default SQL schema specified in the URL is used. - If null is specified and a default SQL schema was not - specified in the URL, the first library specified - in the libraries properties file is used. - If null is specified, a default SQL schema was - not specified in the URL, and a library was not - specified in the libraries properties file, - QGPL is used. - If empty string is specified, - an empty result set is returned. - @param foreignTable The foreign table name. If null or empty string - is specified, an empty result set is returned. - @return The ResultSet containing the description of the - foreign key columns in the foreign key table that - references the primary key columns of the primary - key table. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - - //-------------------------------------------------// - // The system returns the following: - // 0 = cascade - // 1 = No action or restrict - // 2 = set null or set default - // - // JDBC has 5 possible values: - // importedKeyNoAction - // importedKeyCascade - // importedKeySetNull - // importedKeySetDefault - // importedKeyRestrict - // - // Since the system groups together - // some of the values, all of the - // possible JDBC values can not be returned. - // - // For Update Rule, the only values - // supported by the system are - // no action and restrict. Since - // the value of 1 is returned for - // both no action and restrict, - // the value of importKeyRestrict - // will always be returned for the - // update rule. - // - // For Delete Rule - // the following is returned. It is - // consistent with the ODBC implementation. - // if 0 from system = importedKeyCascade - // if 1 from system = importedKeyRestrict - // if 2 from system = importedKeySetNull - // - // - // importedKeyNoAction and importedKeySetDefault - // will not be returned. - //-------------------------------------------------// - - public ResultSet getCrossReference (String primaryCatalog, - String primarySchema, - String primaryTable, - String foreignCatalog, - String foreignSchema, - String foreignTable) - throws SQLException - { - DBReplyRequestedDS reply = null; - - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc3 - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cs = connection_.prepareCall( - "CALL SYSIBM"+ getCatalogSeparator() +"SQLFOREIGNKEYS(?,?,?,?,?,?,?)"); - - cs.setString(1, normalize(primaryCatalog)); - cs.setString(2, normalize(primarySchema)); - cs.setString(3, normalize(primaryTable)); - cs.setString(4, normalize(foreignCatalog)); - cs.setString(5, normalize(foreignSchema)); - cs.setString(6, normalize(foreignTable)); - cs.setString(7, "DATATYPE='JDBC';EXPORTEDKEY=0;IMPORTEDKEY=0;DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - //-------------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - String[] fieldNames = {"PKTABLE_CAT", - "PKTABLE_SCHEM", - "PKTABLE_NAME", - "PKCOLUMN_NAME", - "FKTABLE_CAT", - "FKTABLE_SCHEM", - "FKTABLE_NAME", - "FKCOLUMN_NAME", - "KEY_SEQ", - "UPDATE_RULE", - "DELETE_RULE", - "FK_NAME", - "PK_NAME", - "DEFERRABILITY", - }; - - SQLData[] sqlData = { new SQLVarchar (128, settings_), // pk catalog - new SQLVarchar (128, settings_), // pk schema - new SQLVarchar (128, settings_), // pk table - new SQLVarchar (128, settings_), // pk column - new SQLVarchar (128, settings_), // fk catalog - new SQLVarchar (128, settings_), // fk schema - new SQLVarchar (128, settings_), // fk table - new SQLVarchar (128, settings_), // fk column - new SQLSmallint (vrm), // key seq //@trunc3 - new SQLSmallint (vrm), // update rule //@trunc3 - new SQLSmallint (vrm), // delete rule //@trunc3 - new SQLVarchar (128, settings_), // fk name - new SQLVarchar (128, settings_), // pk name - new SQLSmallint (vrm), // deferrability //@trunc3 - }; - - int[] fieldNullables = {columnNullable, // pk catalog - columnNullable, // pk schema - columnNoNulls, // pk table - columnNoNulls, // pk column - columnNullable, // fk catalog - columnNullable, // fk schema - columnNoNulls, // fk table - columnNoNulls, // fk column - columnNoNulls, // key seq - columnNoNulls, // update rule - columnNoNulls, // delete rule - columnNullable, // fk name - columnNullable, // pk name - columnNoNulls, // deferrability - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows - // that are readable one at a time. - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if ((!isCatalogValid(primaryCatalog)) || // primarycatalog is empty string - (!isCatalogValid(foreignCatalog)) || // foreigncatalog is empty string - - // primarySchema is not null and is empty string - ((primarySchema != null) && (primarySchema.length()==0)) || - // foreignSchema is not null and is empty string - ((foreignSchema != null) && (foreignSchema.length()==0)) || - - // primaryTable is null or empty string - (primaryTable==null) || (primaryTable.length()==0 ) || - // foreignTable is null or empty string - (foreignTable==null) || (foreignTable.length()==0 )) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - else - { // parameter values are valid, build request & send - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_FOREIGN_KEY_INFO , - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - // Set the primary key file library name - if (primarySchema == null) - { // use default SQL schema or qgpl - request.setPrimaryKeyFileLibraryName(normalize(connection_.getDefaultSchema()), connection_.converter_); // @E4C @P0C - } - else request.setPrimaryKeyFileLibraryName(normalize(primarySchema), connection_.converter_); // @E4C @P0C - - // Set the foreign key file library name - if (foreignSchema == null) - { // use default SQL schema or qgpl - request.setForeignKeyFileLibraryName(normalize(connection_.getDefaultSchema()), connection_.converter_); // @E4C @P0C - } - else request.setForeignKeyFileLibraryName(normalize(foreignSchema), connection_.converter_); // @E4C @P0C - - - // Set the primary key table name - request.setPrimaryKeyFileName(normalize(primaryTable), connection_.converter_); // @E4C @P0C - - // Set the foreign key table name - request.setForeignKeyFileName(normalize(foreignTable), connection_.converter_); // @E4C @P0C - - // Set the Foreign key Information to Return Bitmap - request.setForeignKeyReturnInfoBitmap(0xBBE00000); - - //Get the long file name - request.setFileShortOrLongNameIndicator (0xF0); // @PDA Long table names. - - //-------------------------------------------------------- - // Send the request and cache all results from the system - //-------------------------------------------------------- - - reply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = reply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = reply.getReturnCode(); - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - // Get the data format and result data - DBDataFormat dataFormat = reply.getDataFormat(); - DBData resultData = reply.getResultData(); - if (resultData != null) - { - - // Put the data format into a row format object - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - - // Put the result data into a row cache - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache(row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - - // Create the mapped row format that is returned in the - // result set. - // This does not actual move the data, it just sets up - // the mapping. - - JDFieldMap[] maps = new JDFieldMap[14]; - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog ()); - - maps[1] = new JDSimpleFieldMap (1); // pk schema - maps[2] = new JDSimpleFieldMap (2); // pk table - maps[3] = new JDSimpleFieldMap (3); // pk column - maps[4] = new JDHardcodedFieldMap (connection_.getCatalog ()); - maps[5] = new JDSimpleFieldMap (4); // fk schema - maps[6] = new JDSimpleFieldMap (5); // fk table - maps[7] = new JDSimpleFieldMap (6); // fk column - maps[8] = new JDSimpleFieldMap (7); // key seq - maps[9] = new JDUpdateDeleteRuleFieldMap (8); // update rule - maps[10] = new JDUpdateDeleteRuleFieldMap (9); // delete rule - maps[11] = new JDHardcodedFieldMap(new SQLVarchar(0, settings_), true, false); - maps[12] = new JDHardcodedFieldMap(new SQLVarchar(0, settings_), true, false); - maps[13] = new JDHardcodedFieldMap(new Short ((short) importedKeyNotDeferrable)); - - // Create the mapped row cache that is returned in the - // result set - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - else - rowCache = new JDSimpleRowCache(formatRow); - - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } // End of else to build and send request - } // End of try block - - catch (DBDataStreamException e) - { - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - - // Return the results - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), "CrossReference", connection_, reply); //@in2 - - } // End of getCrossReference - - - - /** - Returns the major version number of the database. - - @return The major version number. - @since Modification 5 - **/ - public int getDatabaseMajorVersion () - { - //return 5; //@610 - - //@610 get this dynamically since we can now have version 5 or 6 - int defaultVersion = 0; //since we do not want to change signature to throw exception, have default as 0 - try - { - String v = getDatabaseProductVersion(); - int dotIndex = v.indexOf('.'); - if (dotIndex > 0) - { - v = v.substring(0,dotIndex); - defaultVersion = Integer.parseInt(v); - } - }catch(Exception e) - { - //should not happen - } - - return defaultVersion; - } - - - /** - Returns the minor version number of the database. - - @return The minor version number. - @since Modification 5 - **/ - public int getDatabaseMinorVersion () - { - //return 0; //@610 - - //@610 get this dynamically since we can now as Native driver does - int defaultVersion = 0; - try - { - String v = getDatabaseProductVersion(); - int dotIndex = v.indexOf('.'); - if (dotIndex > 0) - { - v = v.substring(dotIndex+1); - dotIndex = v.indexOf('.'); - if (dotIndex > 0) - { - v = v.substring(0,dotIndex); - } - - defaultVersion = Integer.parseInt(v); - - } - }catch(Exception e) - { - //should not happen - } - return defaultVersion; - - } - - - /** - Returns the name of this database product. - - @return The database product name. - - @exception SQLException This exception is never thrown. - **/ - public String getDatabaseProductName () - throws SQLException - { - return AS400JDBCDriver.DATABASE_PRODUCT_NAME_; // @D2C - } - - - - /** - Returns the version of this database product. - - @return The product version. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public String getDatabaseProductVersion () - throws SQLException - { - // The ODBC specification suggests the - // format "vv.rr.mmmm product-specific". - // Although the JDBC specification does not - // mention this format, I will adopt it anyway. - // - // The format of the product-specific part is - // "VxRxmx". I am not sure why the "m" is lowercase, - // but somebody somewhere said this is normal, and - // its a nit anyway. - connection_.checkOpen(); - AS400ImplRemote as400_ = (AS400ImplRemote) connection_.getAS400 (); - int v, r, m; - try - { - int vrm = as400_.getVRM (); - v = (vrm & 0xffff0000) >>> 16; // @D1C - r = (vrm & 0x0000ff00) >>> 8; // @D1C - m = (vrm & 0x000000ff); // @D1C - } - catch (Exception e) - { - JDError.throwSQLException (this, JDError.EXC_CONNECTION_NONE); - return null; - } - - StringBuffer buffer = new StringBuffer (); - buffer.append (JDUtilities.padZeros (v, 2)); - buffer.append ("."); - buffer.append (JDUtilities.padZeros (r, 2)); - buffer.append ("."); - buffer.append (JDUtilities.padZeros (m, 4)); - buffer.append (" V"); - buffer.append (v); - buffer.append ("R"); - buffer.append (r); - buffer.append ("m"); - buffer.append (m); - return buffer.toString (); - } - - - - /** - Returns the default transaction isolation level. - - @return The default transaction isolation level. - - @exception SQLException This exception is never thrown. - **/ - public int getDefaultTransactionIsolation () - throws SQLException - { - String levelAsString = connection_.getProperties ().getString (JDProperties.TRANSACTION_ISOLATION); - return JDTransactionManager.mapStringToLevel (levelAsString); - } - - - - /** - Returns the major version number for this JDBC driver. - - @return The major version number. - **/ - public int getDriverMajorVersion () - { - return AS400JDBCDriver.MAJOR_VERSION_; - } - - - - /** - Returns the minor version number for this JDBC driver. - - @return The minor version number. - **/ - public int getDriverMinorVersion () - { - return AS400JDBCDriver.MINOR_VERSION_; - } - - - - /** - Returns the name of this JDBC driver. - - @return The driver name. - - @exception SQLException This exception is never thrown. - **/ - public String getDriverName () - throws SQLException - { - return AS400JDBCDriver.DRIVER_NAME_; // @D2C - } - - - - /** - Returns the version of this JDBC driver. - - @return The driver version. - - @exception SQLException This exception is never thrown. - **/ - public String getDriverVersion () - throws SQLException - { - return AS400JDBCDriver.MAJOR_VERSION_+ "."+ AS400JDBCDriver.MINOR_VERSION_; - } - - - - /** - Returns a description of the foreign key columns that - reference a table's primary key columns. This is the - foreign keys exported by a table. - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schema The schema name. If null is specified, the - default SQL schema specified in the URL is used. - If null is specified and a default SQL schema was not - specified in the URL, the first library specified - in the libraries properties file is used. - If null is specified, a default SQL schema was - not specified in the URL, and a library was not - specified in the libraries properties file, - QGPL is used. - If empty string is specified, an empty result set will - be returned. - @param table The table name. If null or empty string is specified, - an empty result set is returned. - - @return The ResultSet containing the description of the - foreign key columns that reference a table's - primary key columns. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getExportedKeys (String catalog, - String schema, - String table) - throws SQLException - { - DBReplyRequestedDS reply = null; - - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc3 - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cs = connection_.prepareCall("CALL SYSIBM" + getCatalogSeparator() + "SQLFOREIGNKEYS(?,?,?,?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, normalize(schema)); - cs.setString(3, normalize(table)); - cs.setString(4, normalize(catalog)); - cs.setString(5, EMPTY_STRING); - cs.setString(6, EMPTY_STRING); - cs.setString(7, "DATATYPE='JDBC';EXPORTEDKEY=1; CURSORHOLD=1"); - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - - //-------------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - - String[] fieldNames = {"PKTABLE_CAT", - "PKTABLE_SCHEM", - "PKTABLE_NAME", - "PKCOLUMN_NAME", - "FKTABLE_CAT", - "FKTABLE_SCHEM", - "FKTABLE_NAME", - "FKCOLUMN_NAME", - "KEY_SEQ", - "UPDATE_RULE", - "DELETE_RULE", - "FK_NAME", - "PK_NAME", - "DEFERRABILITY", - }; - - SQLData[] sqlData = { new SQLVarchar (128, settings_), // pk catalog - new SQLVarchar (128, settings_), // pk schema - new SQLVarchar (128, settings_), // pk table - new SQLVarchar (128, settings_), // pk column - new SQLVarchar (128, settings_), // fk catalog - new SQLVarchar (128, settings_), // fk schema - new SQLVarchar (128, settings_), // fk table - new SQLVarchar (128, settings_), // fk column - new SQLSmallint (vrm), // key seq //@trunc3 - new SQLSmallint (vrm), // update rule //@trunc3 - new SQLSmallint (vrm), // delete rule //@trunc3 - new SQLVarchar (128, settings_), // fk name - new SQLVarchar (128, settings_), // pk name - new SQLSmallint (vrm), // deferrability //@trunc3 - }; - int[] fieldNullables = {columnNullable, // pk catalog - columnNullable, // pk schema - columnNoNulls, // pk table - columnNoNulls, // pk column - columnNullable, // fk catalog - columnNullable, // fk schema - columnNoNulls, // fk table - columnNoNulls, // fk column - columnNoNulls, // key seq - columnNoNulls, // update rule - columnNoNulls, // delete rule - columnNullable, // fk name - columnNullable, // pk name - columnNoNulls, // deferrability - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows - // that are readable one at a time. - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if ((!isCatalogValid(catalog)) || // catalog is empty string - - - // schema is not null and is empty string - ((schema != null) && (schema.length()==0)) || - - // table is null or empty string - (table==null) || (table.length()==0 )) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - else - { // parameter values are valid, build request & send - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_FOREIGN_KEY_INFO , - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - - // Set the primary key file library name - if (schema == null) - { // use default SQL schema or qgpl - request.setPrimaryKeyFileLibraryName(normalize(connection_.getDefaultSchema()), connection_.converter_); // @E4C @P0C - } - else request.setPrimaryKeyFileLibraryName(normalize(schema), connection_.converter_); // @E4C @P0C - - - - // Set the primary key table name - request.setPrimaryKeyFileName(normalize(table), connection_.converter_); // @E4C @P0C - - - // Set the Foreign key Information to Return Bitmap - //@F4 As of base v4r4, host server can return primary and foreign key names. - //@F4 Even this has nothing to do with lobs, borrow the constant as - //@F4 it checks for v4r4. - if (connection_.getVRM() >= JDUtilities.vrm440) //@F4A - request.setForeignKeyReturnInfoBitmap(0xBBF80000); //@F4A - else //@F4A - request.setForeignKeyReturnInfoBitmap(0xBBE00000); - - //Get the long file name - request.setFileShortOrLongNameIndicator (0xF0); // @KBA Long table names. - - - //-------------------------------------------------------- - // Send the request and cache all results from the system - //-------------------------------------------------------- - - reply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = reply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = reply.getReturnCode(); - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - // Get the data format and result data - DBDataFormat dataFormat = reply.getDataFormat(); - DBData resultData = reply.getResultData(); - - if (resultData != null) - { - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache (row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - - JDFieldMap[] maps = new JDFieldMap[14]; - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog ()); - maps[1] = new JDSimpleDelimitedFieldMap (1); // pk schema //@PDC code to remove quotes - maps[2] = new JDSimpleFieldMap (2); // pk table - maps[3] = new JDSimpleFieldMap (3); // pk column - maps[4] = new JDHardcodedFieldMap (connection_.getCatalog ()); - maps[5] = new JDSimpleDelimitedFieldMap (4); // fk schema //@PDC code to remove quotes - maps[6] = new JDSimpleFieldMap (5); // fk table - maps[7] = new JDSimpleFieldMap (6); // fk column - maps[8] = new JDSimpleFieldMap (7); // key seq - maps[9] = new JDSimpleFieldMap (8); // update rule - maps[10] = new JDSimpleFieldMap (9); // delete rule - if (connection_.getVRM() >= JDUtilities.vrm440) //@F4A - { - maps[11] = new JDSimpleDelimitedFieldMap (10); //@F4A //@PDC code to remove quotes - maps[12] = new JDSimpleDelimitedFieldMap (11); //@F4A //@PDC code to remove quotes - } - else - { //@F4A - maps[11] = new JDHardcodedFieldMap (new SQLVarchar(0, settings_), true, false); - maps[12] = new JDHardcodedFieldMap (new SQLVarchar(0, settings_), true, false); - } - maps[13] = new JDHardcodedFieldMap (new Short ((short) importedKeyNotDeferrable)); - - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - else - rowCache = new JDSimpleRowCache(formatRow); - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } - } - catch (DBDataStreamException e) - { - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "ExportedKeys", connection_, reply); //@in2 - } - - - - /** - Returns all of the "extra" characters that can be used in - unquoted identifier names (those beyond a-z, A-Z, 0-9, - and _). - - @return The String containing the "extra" characters. - - @exception SQLException This exception is never thrown. - **/ - public String getExtraNameCharacters () - throws SQLException - { - return "$@#"; - } - - - - /** - Returns the string used to quote SQL identifiers. - - @return The quote string. - - @exception SQLException This exception is never thrown. - **/ - public String getIdentifierQuoteString () - throws SQLException - { - return "\""; - } - - - - /** - Returns a description of the primary key columns that are - referenced by a table's foreign key columns. This is the - primary keys imported by a table. - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schema The schema name. If null is specified, the - default SQL schema specified in the URL is used. - If null is specified and a default SQL schema was not - specified in the URL, the first library specified - in the libraries properties file is used. - If null is specified, a default SQL schema was - not specified in the URL, and a library was not - specified in the libraries properties file, - QGPL is used. - If empty string is specified, an empty result set will - be returned. - @param table The table name. If null or empty string is specified, - an empty result set is returned. - - @return The ResultSets containing the description of the primary - key columns that are referenced by a table's foreign - key columns. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getImportedKeys (String catalog, - String schema, - String table) - throws SQLException - { - DBReplyRequestedDS reply = null; - - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc3 - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - - CallableStatement cs = connection_.prepareCall("CALL SYSIBM"+ getCatalogSeparator() +"SQLFOREIGNKEYS(?,?,?,?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, null); - cs.setString(3, null); - cs.setString(4, normalize(catalog)); - cs.setString(5, normalize(schema)); - cs.setString(6, normalize(table)); - cs.setString(7, "DATATYPE='JDBC';IMPORTEDKEY=1; CURSORHOLD=1"); - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - //-------------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - String[] fieldNames = {"PKTABLE_CAT", - "PKTABLE_SCHEM", - "PKTABLE_NAME", - "PKCOLUMN_NAME", - "FKTABLE_CAT", - "FKTABLE_SCHEM", - "FKTABLE_NAME", - "FKCOLUMN_NAME", - "KEY_SEQ", - "UPDATE_RULE", - "DELETE_RULE", - "FK_NAME", - "PK_NAME", - "DEFERRABILITY", - }; - - SQLData[] sqlData = { new SQLVarchar (128, settings_), // pk catalog - new SQLVarchar (128, settings_), // pk schema - new SQLVarchar (128, settings_), // pk table - new SQLVarchar (128, settings_), // pk column - new SQLVarchar (128, settings_), // fk catalog - new SQLVarchar (128, settings_), // fk schema - new SQLVarchar (128, settings_), // fk table - new SQLVarchar (128, settings_), // fk column - new SQLSmallint (vrm), // key seq //@trunc3 - new SQLSmallint (vrm), // update rule //@trunc3 - new SQLSmallint (vrm), // delete rule //@trunc3 - new SQLVarchar (128, settings_), // fk name - new SQLVarchar (128, settings_), // pk name - new SQLSmallint (vrm), // deferrability //@trunc3 - }; - - int[] fieldNullables = {columnNullable, // pk catalog - columnNullable, // pk schema - columnNoNulls, // pk table - columnNoNulls, // pk column - columnNullable, // fk catalog - columnNullable, // fk schema - columnNoNulls, // fk table - columnNoNulls, // fk column - columnNoNulls, // key seq - columnNoNulls, // update rule - columnNoNulls, // delete rule - columnNullable, // fk name - columnNullable, // pk name - columnNoNulls, // deferrability - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows - // that are readable one at a time. - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if ((!isCatalogValid(catalog)) || // catalog is empty string - - // schema is not null and is empty string - ((schema != null) && (schema.length()==0)) || - - // table is null or empty string - (table==null) || (table.length()==0 )) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - else - { // parameter values are valid, build request & send - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_FOREIGN_KEY_INFO , - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - - - - // Set the foreign key file library name - if (schema == null) - { // use default SQL schema or qgpl - request.setForeignKeyFileLibraryName(normalize(connection_.getDefaultSchema()), connection_.converter_); // @E4C - } - else request.setForeignKeyFileLibraryName(normalize(schema), connection_.converter_); // @E4C - - - // Set the foreign key table name - request.setForeignKeyFileName(normalize(table), connection_.converter_); // @E4C - - // Set the Foreign key Information to Return Bitmap - //@F4 As of base v4r4, host server can return primary and foreign key names. - //@F4 Even this has nothing to do with lobs, borrow the constant as - //@F4 it checks for v4r4. - if (connection_.getVRM() >= JDUtilities.vrm440) //@F4A - request.setForeignKeyReturnInfoBitmap(0xBBF80000); //@F4A - else //@F4A - request.setForeignKeyReturnInfoBitmap(0xBBE00000); - - // This is not documented in the LIPI, but it happens to work! @E2A - request.setFileShortOrLongNameIndicator(0xF0); // @E2A - - //-------------------------------------------------------- - // Send the request and cache all results from the system - //-------------------------------------------------------- - - reply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = reply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = reply.getReturnCode(); - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - DBDataFormat dataFormat = reply.getDataFormat(); - DBData resultData = reply.getResultData(); - if (resultData != null) - { - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache(row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - JDFieldMap[] maps = new JDFieldMap[14]; - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog ()); - maps[1] = new JDSimpleDelimitedFieldMap (1); // pk schema //@PDC code to remove quotes - maps[2] = new JDSimpleFieldMap (2); // pk table - maps[3] = new JDSimpleFieldMap (3); // pk column - maps[4] = new JDHardcodedFieldMap (connection_.getCatalog ()); - maps[5] = new JDSimpleDelimitedFieldMap (4); // fk schema //@PDC code to remove quotes - maps[6] = new JDSimpleFieldMap (5); // fk table - maps[7] = new JDSimpleFieldMap (6); // fk column - maps[8] = new JDSimpleFieldMap (7); // key seq - maps[9] = new JDSimpleFieldMap (8); // update rule - maps[10] = new JDSimpleFieldMap (9); // delete rule - if (connection_.getVRM() >= JDUtilities.vrm440) //@F4A - { - maps[11] = new JDSimpleDelimitedFieldMap (10); //@F4A //@PDC code to remove quotes - maps[12] = new JDSimpleDelimitedFieldMap (11); //@F4A //@PDC code to remove quotes - } - else - { //@F4A - maps[11] = new JDHardcodedFieldMap(new SQLVarchar(0, settings_), true, false); - maps[12] = new JDHardcodedFieldMap(new SQLVarchar(0, settings_), true, false); - } - maps[13] = new JDHardcodedFieldMap(new Short ((short) importedKeyNotDeferrable)); - - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - else - rowCache = new JDSimpleRowCache(formatRow); - - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } // End of else to build and send request - } // End of try block - - catch (DBDataStreamException e) - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - // Return the results - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "ImportedKeys", connection_, reply); //@in2 - } - - - - /** - Returns a description of a table's indexes and statistics. - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schema The schema name. If null is specified, the - default SQL schema specified in the URL is used. - If null is specified and a default SQL schema was not - specified in the URL, the first library specified - in the libraries properties file is used. - If null is specified, a default SQL schema was - not specified in the URL, and a library was not - specified in the libraries properties file, - QGPL is used. - If empty string is specified, an empty result set will - be returned. - @param table The table name. If null or empty string is specified, - an empty result set is returned. - @param unique The value indicating if unique indexes should be returned. - If true, only indexes for unique values is returned. - If false, all indexes is returned. - @param approximate The value indicating if the result is allowed to reflect - approximate or out-of-date values. This value is ignored. - @return The ResultSet containing the description of a table's indexes - and statistics. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getIndexInfo (String catalog, - String schema, - String table, - boolean unique, - boolean approximate) - throws SQLException - { - DBReplyRequestedDS reply = null; - - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc3 - - String metadataSourceProperty = connection_.getProperties().getString(JDProperties.METADATA_SOURCE); - //@pda 550 derived keys support. change to call sysibm.SQLSTATISTICS --start - //@mdsp comment //note always call SP in v6r1 and later. ROI was lacking in this area. - if (connection_.getVRM() >= JDUtilities.vrm610 - || (metadataSourceProperty - .equals(JDProperties.METADATA_SOURCE_STORED_PROCEDURE))) { - short iUnique; - short reserved = 0; - - if (unique) - iUnique = 0; - else - iUnique = 1; - - //Set the library name - if(schema != null) - schema = normalize(schema); - - // Set the table name - if(table != null) - table = normalize(table); - - /* - sysibm.SQLStatistics( - CatalogName varchar(128), - SchemaName varchar(128), - TableName varchar(128), - Unique Smallint, - Reserved Smallint, - Options varchar(4000)) - */ - CallableStatement cstmt = connection_.prepareCall("call SYSIBM" + getCatalogSeparator () + "SQLSTATISTICS(?,?,?,?,?,?)"); - - cstmt.setString(1, normalize(catalog)); - cstmt.setString(2, normalize(schema)); - cstmt.setString(3, normalize(table)); - cstmt.setShort(4, iUnique); - cstmt.setShort(5, reserved); - cstmt.setString(6, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - cstmt.execute(); - - ResultSet rs = cstmt.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cstmt.close(); //@mdrs2 - - return rs; //@mdrs - - } - //@pda 550 derived keys support. change to call sysibm.SQLSTATISTICS --end - - //-------------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - String[] fieldNames = {"TABLE_CAT", - "TABLE_SCHEM", - "TABLE_NAME", - "NON_UNIQUE", - "INDEX_QUALIFIER", - "INDEX_NAME", - "TYPE", - "ORDINAL_POSITION", - "COLUMN_NAME", - "ASC_OR_DESC", - "CARDINALITY", - "PAGES", - "FILTER_CONDITION", - }; - - SQLData[] sqlData = { new SQLVarchar (128, settings_), // catalog - new SQLVarchar (128, settings_), // schema - new SQLVarchar (128, settings_), // table - // when instantiating the non-unique small int - // pass in a boolean and it will give it the - // right value - new SQLSmallint (vrm), // non-unique - boolean //@trunc3 - new SQLVarchar (128, settings_), // index qualifier - new SQLVarchar (128, settings_), // index name - new SQLSmallint (vrm), // type //@trunc3 - new SQLSmallint (vrm), // ordinal position //@trunc3 - new SQLVarchar (128, settings_), // column name - new SQLVarchar (1, settings_), // sort sequence - new SQLInteger (vrm), // cardinality - new SQLInteger (vrm), // pages //@trunc3 - new SQLVarchar (128, settings_), // filter condition - }; - - int[] fieldNullables = { columnNullable, // catalog - columnNullable, // schema - columnNoNulls, // table - columnNoNulls, // non-unique - columnNullable, // index qualifier - columnNullable, // index name - columnNoNulls, // type - columnNoNulls, // ordinal position - columnNullable, // column name - columnNullable, // sort sequence - columnNoNulls, // cardinality - columnNoNulls, // pages - columnNullable, // filter condition - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows - // that are readable one at a time. - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if ((!isCatalogValid(catalog)) || // catalog is empty string - - // schema is not null and is empty string - ((schema != null) && (schema.length()==0)) || - - // table is null or empty string - (table==null) || (table.length()==0 )) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - else - { // parameter values are valid, build request & send - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_INDEX_INFO , - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - // Set the library name - if (schema == null) - { // use default SQL schema or qgpl - request.setLibraryName(normalize(connection_.getDefaultSchema()), connection_.converter_); // @E4C - } - else request.setLibraryName(normalize(schema), connection_.converter_); // @E4C - - - // Set the table name - request.setFileName(normalize(table), connection_.converter_); // @E4C - - // Set the long file name indicator - request.setFileShortOrLongNameIndicator (0xF0); // Long table names - - // Set the index unique rule - if (unique) - { // true - return indices for unique values - request.setIndexUniqueRule(0x01); - } - else - { - request.setIndexUniqueRule(0x04); - } - - // Set the Index Information to Return Bitmap - request.setIndexReturnInfoBitmap(0xBDC00000); - - - - //-------------------------------------------------------- - // Send the request and cache all results from the system - //-------------------------------------------------------- - - reply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = reply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = reply.getReturnCode(); - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - // Get the data format and result data - DBDataFormat dataFormat = reply.getDataFormat(); - DBData resultData = reply.getResultData(); - if (resultData != null) - { - - // Put the data format into a row object - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - - // Put the result data into a row cache - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache(row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - - // Create the mapped row format that is returned in the - // result set. - // This does not actual move the data, it just sets up - // the mapping. - JDFieldMap[] maps = new JDFieldMap[13]; - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog ()); - - maps[1] = new JDSimpleFieldMap (1); // schema - maps[2] = new JDSimpleFieldMap (2); // table - maps[3] = new JDNonUniqueFieldMap (3); // non-unique - maps[4] = new JDSimpleFieldMap (4); // index library name - maps[5] = new JDSimpleFieldMap (5); // index name - maps[6] = new JDHardcodedFieldMap(new Short ((short) tableIndexOther)); // type - - maps[7] = new JDSimpleFieldMap (7); // ordinal position - maps[8] = new JDSimpleFieldMap (6); // column name - maps[9] = new JDSimpleFieldMap (8); // sort sequence (collation) - // cardinality unknown - maps[10] = new JDHardcodedFieldMap(new Integer(-1)); - // number of pages unknown - maps[11] = new JDHardcodedFieldMap(new Integer(-1)); - maps[12] = new JDHardcodedFieldMap(new SQLVarchar(0, settings_), true, false); - - // Create the mapped row cache that is returned in the - // result set - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - else - rowCache = new JDSimpleRowCache(formatRow); - - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } // End of else to build and send request - } // End of try block - - catch (DBDataStreamException e) - { - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - // Return the results - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "IndexInfo", connection_, reply); //@in2 - - } // End of getIndexInfo - - - - //@G4A - /** - Returns the JDBC major version number. - - @return The JDBC major version number. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public int getJDBCMajorVersion () - throws SQLException - { - return AS400JDBCDriver.JDBC_MAJOR_VERSION_; //@pdc - } - - - - //@G4A - /** - Returns the JDBC minor version number. - - @return The JDBC minor version number. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public int getJDBCMinorVersion () - throws SQLException - { - return AS400JDBCDriver.JDBC_MINOR_VERSION_; //@pdc - } - - - - - /** - Returns the maximum length for an inline binary literal. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxBinaryLiteralLength () - throws SQLException - { - return 32739; - } - - - - /** - Returns the maximum length for a catalog name. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxCatalogNameLength () - throws SQLException - { - return 10; - } - - - - /** - Returns the maximum length for a character literal. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxCharLiteralLength () - throws SQLException - { - return 32739; - } - - - - /** - Returns the maximum length for a column name. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxColumnNameLength () - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm540) //@540 - return 128; //@540 - else - return 30; - } - - - - /** - Returns the maximum number of columns in a GROUP BY clause. - - @return The maximum number of columns. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxColumnsInGroupBy () - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm610) //@550 max columns in group by support - return 8000; //@550 - else //@550 - return 120; - } - - - - /** - Returns the maximum number of columns allowed in an index. - - @return The maximum number of columns. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxColumnsInIndex () - throws SQLException - { - return 120; - } - - - - /** - Returns the maximum number of columns in an ORDER BY clause. - - @return The maximum number of columns. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxColumnsInOrderBy () - throws SQLException - { - return 10000; - } - - - - /** - Returns the maximum number of columns in a SELECT list. - - @return The maximum number of columns. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxColumnsInSelect () - throws SQLException - { - return 8000; - } - - - - /** - Returns the maximum number of columns in a table. - - @return The maximum number of columns. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxColumnsInTable () - throws SQLException - { - return 8000; - } - - - - /** - Returns the number of active connections you can have at a time - to this database. - - @return The maximum number of connections or 0 - if no limit. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxConnections () - throws SQLException - { - // There is no limit. The specification does - // not come right out and say "0 means no limit", - // but that is how ODBC and many other parts - // of JDBC work. - return 0; - } - - - - /** - Returns the maximum cursor name length. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxCursorNameLength () - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm610) //@550A - return AS400JDBCStatement.MAX_CURSOR_NAME_LENGTH; - else //@550A - return AS400JDBCStatement.MAX_CURSOR_NAME_LENGTH_PRE_V6R1; //@550A - } - - - - /** - Returns the maximum length of an index. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxIndexLength () - throws SQLException - { - return 2000; - } - - - - /** - Returns the maximum length of a procedure name. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxProcedureNameLength () - throws SQLException - { - return 128; - } - - - - /** - Returns the maximum length of a single row. - - @return The maximum length (in bytes). - @exception SQLException This exception is never thrown. - **/ - public int getMaxRowSize () - throws SQLException - { - return 32766; - } - - - - /** - Returns the maximum length allowed for a schema name. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxSchemaNameLength () - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm710) //@128sch - return 128; //@128sch - else //@128sch - return 10; - } - - - - /** - Returns the maximum length of an SQL statement. - - @return The maximum length. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxStatementLength () - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm540) //@540 - return 1048576; //@540 Statement text is always sent in 2 byte Unicode, so the maximum statement length in characters will always be 1 MB - else //@540 - return 32767; - } - - - - /** - Returns the number of active statements you can have open at one - time. - - @return The maximum number of statements or 0 - if no limit. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxStatements () - throws SQLException - { - return AS400JDBCConnection.MAX_STATEMENTS_; // @D3C - } - - - - /** - Returns the maximum length of a table name. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxTableNameLength () - throws SQLException - { - return 128; - } - - - - /** - Returns the maximum number of tables in a SELECT. - - @return The maximum number of tables. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxTablesInSelect () - throws SQLException - { - if (connection_.getVRM() >= JDUtilities.vrm540) // New in V5R4M0 @PDC - return 1000; //@pdc - else - return 32; - } - - - - /** - Returns the maximum length of a user name. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxUserNameLength () - throws SQLException - { - return 10; - } - - - - /** - Returns the list of supported math functions. - - @return The list of supported math functions, separated by commas. - - @exception SQLException This exception is never thrown. - **/ - public String getNumericFunctions () - throws SQLException - { - // @J0A added try/catch because we are now sending the system VRM - return JDEscapeClause.getNumericFunctions(connection_.getVRM()); // @J0M changed to send host version - } - - - - /** - Returns a description of the primary key columns. - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schema The schema name. If null is specified, the - default SQL schema specified in the URL is used. - If null is specified and a default SQL schema was not - specified in the URL, the first library specified - in the libraries properties file is used. - If null is specified, a default SQL schema was - not specified in the URL, and a library was not - specified in the libraries properties file, - QGPL is used. - If empty string is specified, an empty result set will - be returned. - @param table The table name. If null or empty string is specified, - an empty result set is returned. - - @return The ResultSet containing the description of the primary - key columns. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getPrimaryKeys (String catalog, - String schema, - String table) - throws SQLException - { - DBReplyRequestedDS reply = null; - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cs = connection_.prepareCall("CALL SYSIBM"+ getCatalogSeparator () +"SQLPRIMARYKEYS(?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, normalize(schema)); - cs.setString(3, normalize(table)); - cs.setString(4, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - //-------------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - String[] fieldNames = {"TABLE_CAT", - "TABLE_SCHEM", - "TABLE_NAME", - "COLUMN_NAME", - "KEY_SEQ", - "PK_NAME", - }; - - SQLData[] sqlData = { new SQLVarchar (128, settings_), // pk catalog - new SQLVarchar (128, settings_), // pk schema - new SQLVarchar (128, settings_), // pk table - new SQLVarchar (128, settings_), // pk column - new SQLSmallint (vrm), // key seq //@trunc3 - new SQLVarchar (128, settings_), // pk name - }; - - int[] fieldNullables = {columnNullable, // pk catalog - columnNullable, // pk schema - columnNoNulls, // pk table - columnNoNulls, // pk column - columnNoNulls, // key seq - columnNullable, // pk name - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows - // that are readable one at a time. - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if ((!isCatalogValid(catalog)) || // catalog is empty string - - // schema is not null and is empty string - ((schema != null) && (schema.length()==0)) || - - // table is null or empty string - (table==null) || (table.length()==0 )) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - else - { // parameter values are valid, build request & send - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_PRIMARY_KEY_INFO , - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - - // Set the primary key file library name - if (schema == null) - { // use default SQL schema or qgpl - request.setPrimaryKeyFileLibraryName(normalize(connection_.getDefaultSchema()), connection_.converter_); // @E4C - } - else request.setPrimaryKeyFileLibraryName(normalize(schema), connection_.converter_); // @E4C - - - // Set the primary key table name - request.setPrimaryKeyFileName(normalize(table), connection_.converter_); // @E4C - - // Set the primary key Information to Return Bitmap - request.setPrimaryKeyReturnInfoBitmap(0xBC000000); //@pdc - - // This is not documented in the LIPI, but it happens to work! @E2A - request.setFileShortOrLongNameIndicator(0xF0); // @E2A - - //-------------------------------------------------------- - // Send the request and cache all results from the system - //-------------------------------------------------------- - - reply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = reply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = reply.getReturnCode(); - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - // Get the data format and result data - DBDataFormat dataFormat = reply.getDataFormat(); - DBData resultData = reply.getResultData(); - if (resultData != null) - { - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache (row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - // Create the mapped row format that is returned in the - // result set. - // This does not actual move the data, it just sets up - // the mapping. - // boolean nullValue = true; // used when hardcoding null - JDFieldMap[] maps = new JDFieldMap[6]; - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog ()); - maps[1] = new JDSimpleDelimitedFieldMap (1); // pk schema //@PDC code to remove quotes - maps[2] = new JDSimpleFieldMap (2); // pk table - maps[3] = new JDSimpleFieldMap (3); // pk column - maps[4] = new JDCharToShortFieldMap (4); // key seq - //maps[5] = new JDHardcodedFieldMap (new SQLVarchar (0, settings_), true, false); //@pdd - maps[5] = new JDSimpleFieldMap (5); //@pda - - // Create the mapped row cache that is returned in the - // result set - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - else - rowCache = new JDSimpleRowCache(formatRow); - - } - finally - { - if (request != null) { request.returnToPool(); request= null; } - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } // End of else to build and send request - } // End of try block - - catch (DBDataStreamException e) - { - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - // Return the results - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "PrimaryKeys", connection_, reply); //@in2 - } - - - - /** - Returns a description of a catalog's stored procedure - parameters and result columns. - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schemaPattern The schema name pattern. If null is specified, - it will not be included in the selection - criteria. If empty string - is specified, an empty result set is returned. - @param procedurePattern The procedure name pattern. If null is specified, - it will not be included in the selection criteria. - If empty string - is specified, an empty result set is returned. - @param columnPattern The column name pattern. If null is specified, - it will not be included in the selection criteria. - If empty string - is specified, an empty result set is returned. - - @return The ResultSet containing the description of the - catalog's stored procedure parameters and result - columns. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getProcedureColumns (String catalog, - String schemaPattern, - String procedurePattern, - String columnPattern) - throws SQLException - { - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc3 - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cs = connection_.prepareCall("CALL SYSIBM"+ getCatalogSeparator () + "SQLPROCEDURECOLS(?,?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, normalize(schemaPattern)); - cs.setString(3, normalize(procedurePattern)); - cs.setString(4, normalize(columnPattern)); -/* ifdef JDBC40 */ - cs.setString(5, "DATATYPE='JDBC';JDBCVER='4.0';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); //@ver4 -/* endif */ -/* ifndef JDBC40 - cs.setString(5, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - endif */ - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - - } - - //-------------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - String[] fieldNames = { "PROCEDURE_CAT", - "PROCEDURE_SCHEM", - "PROCEDURE_NAME", - "COLUMN_NAME", - "COLUMN_TYPE", - "DATA_TYPE", - "TYPE_NAME", - "PRECISION", - "LENGTH", - "SCALE", - "RADIX", - "NULLABLE", - "REMARKS" - }; - - SQLData[] sqlData = { new SQLVarchar (128, settings_), // catalog - new SQLVarchar (128, settings_), // schema - new SQLVarchar (128, settings_), // procedure - new SQLVarchar (128, settings_), // column name - new SQLSmallint (vrm), // column type //@trunc3 - new SQLSmallint (vrm), // data type //@trunc3 - new SQLVarchar (128, settings_), // type name - new SQLInteger (vrm), // precision //@trunc3 - new SQLInteger (vrm), // length //@trunc3 - new SQLSmallint (vrm), // scale //@trunc3 - new SQLInteger (vrm), // radix //@trunc3 - new SQLSmallint (vrm), // nullable //@trunc3 - new SQLVarchar (2000, settings_) // remarks - }; - - int[] fieldNullables = { - columnNullable, // catalog - columnNullable, // schema - columnNoNulls, // Procedure name - columnNoNulls, // column name - columnNoNulls, // column type - columnNoNulls, // data type - columnNoNulls, // type name - columnNoNulls, // precision - columnNoNulls, // length - columnNoNulls, // scale - columnNoNulls, // radix - columnNoNulls, // nullable - columnNoNulls // remarks - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if ((!isCatalogValid(catalog)) || // catalog is empty string - - // schema is not null and is empty string - ((schemaPattern != null) && (schemaPattern.length()==0)) || - - // procedure is not null and is empty string - ((procedurePattern != null) && (procedurePattern.length()==0)) || - - // column is not null and is empty string - ((columnPattern != null) && (columnPattern.length()==0))) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - else - - { // Parameters are valid, build request and send - StringBuffer selectStmt = new StringBuffer(); - selectStmt.append ("SELECT SPECIFIC_SCHEMA, SPECIFIC_NAME, PARAMETER_NAME, PARAMETER_MODE, "); - selectStmt.append ("DATA_TYPE, NUMERIC_PRECISION, CHARACTER_MAXIMUM_LENGTH, NUMERIC_SCALE, "); - selectStmt.append ("NUMERIC_PRECISION_RADIX, IS_NULLABLE, LONG_COMMENT "); - selectStmt.append ("FROM QSYS2" + getCatalogSeparator() + "SYSPARMS "); // use . or / - - - - - if (schemaPattern !=null) - { - JDSearchPattern schema = new JDSearchPattern (normalize(schemaPattern)); //@pdc normalize - String schemaWhereClause = schema.getSQLWhereClause("SPECIFIC_SCHEMA"); - selectStmt.append("WHERE " + schemaWhereClause); - } - - - if (procedurePattern !=null) - { - JDSearchPattern procedure = new JDSearchPattern (procedurePattern); - if (schemaPattern!=null) - { // Where clause already exists, add AND - selectStmt.append (" AND "); - } - - else - { // Where clause does not exist, add WHERE - selectStmt.append (" WHERE "); - } - - String procedureWhereClause = procedure.getSQLWhereClause("SPECIFIC_NAME"); - selectStmt.append(procedureWhereClause); - } - - - if (columnPattern!=null) - { // if null, no where clause is sent - JDSearchPattern column = new JDSearchPattern (columnPattern); - if ((schemaPattern!=null) || (procedurePattern!=null)) - { // Where clause already exists, add AND - selectStmt.append (" AND "); - } - else - { // Where clause does not exist, add WHERE - selectStmt.append (" WHERE "); - } - - String columnWhereClause = column.getSQLWhereClause("PARAMETER_NAME"); - selectStmt.append(columnWhereClause); - - } - - - - - // Add order by - selectStmt.append ("ORDER BY SPECIFIC_SCHEMA, SPECIFIC_NAME, ORDINAL_POSITION"); // Added ORDINAL_POSITION to fix JTOpen bug 3646, SYSPARMS table doesn't always have parameters in physical right order - - // Create statement object and do Execute Query - AS400JDBCStatement statement_ = null; //@scan1 - AS400JDBCResultSet serverResultSet = null; //@scan1 - JDRowCache serverRowCache = null; - try - { - statement_ = (AS400JDBCStatement)connection_.createStatement(); // caste needed - serverResultSet = (AS400JDBCResultSet) statement_.executeQuery (selectStmt.toString()); - - serverRowCache = new JDSimpleRowCache(serverResultSet.getRowCache()); - - - JDFieldMap[] maps = new JDFieldMap[13]; - - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog()); - maps[1] = new JDSimpleFieldMap (1); // schema - maps[2] = new JDSimpleFieldMap (2); // procedure - maps[3] = new JDHandleNullFieldMap (3, ""); // parameter name (col name) - maps[4] = new JDParameterModeFieldMap(4); // Parameter mode (col type) - - maps[5] = new JDDataTypeFieldMap(5, 7, 6, 8, 0, connection_.getVRM(), connection_.getProperties()); // @M0C // data type - converts from string to short //@KKB pass 0 for ccsid - maps[6] = new JDSimpleFieldMap (5); // type name - - maps[7] = new JDHandleNullFieldMap (6, new Integer (0)); // precision - maps[8] = new JDHandleNullFieldMap (7, new Integer (0)); // length - - maps[9] = new JDHandleNullFieldMap (8, new Short ((short) 0)); // scale - maps[10] = new JDHandleNullFieldMap (9, new Short ((short) 0)); // radix - - maps[11] = new JDNullableSmallintFieldMap(10); // nullable - is Nullable - maps[12] = new JDHandleNullFieldMap (11, ""); // remarks - long comment - - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - - }finally //@scan1 - { - try{ - if(serverResultSet != null) - serverResultSet.close(); - }catch(Exception e){} //allow next close to execute - if(statement_ != null) - statement_.close (); - } - } // End of else build request and send - - - } // End of try block - - catch (SQLException e) - { - // System.out.println(e); - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "ProcedureColumns", connection_, null); //@in2 - - } // End of getProcedureColumns - - - - /** - Returns the description of the stored procedures available - in a catalog. - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schemaPattern The schema name pattern. If null is specified, - it will not be included in the selection - criteria. If empty string - is specified, an empty result set is returned. - @param procedurePattern The procedure name pattern. If null is specified, - it will not be included in the selection - criteria. If empty string - is specified, an empty result set is returned. - - @return The ResultSet containing the description of the - stored procedures available in the catalog. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getProcedures (String catalog, - String schemaPattern, - String procedurePattern) - throws SQLException - { - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc3 - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cs = connection_.prepareCall("CALL SYSIBM"+ getCatalogSeparator () + "SQLPROCEDURES(?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, normalize(schemaPattern)); - cs.setString(3, normalize(procedurePattern)); - cs.setString(4, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - //-------------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - String[] fieldNames = { "PROCEDURE_CAT", - "PROCEDURE_SCHEM", - "PROCEDURE_NAME", - "RESERVED1", - "RESERVED2", - "RESERVED3", - "REMARKS", -/* ifdef JDBC40 */ - "PROCEDURE_TYPE", - "SPECIFIC_NAME" //@JDBC40 -/* endif */ -/* ifndef JDBC40 - "PROCEDURE_TYPE" - endif */ - }; - - SQLData[] sqlData = { new SQLVarchar (128, settings_), // catalog - new SQLVarchar (128, settings_), // schema - new SQLVarchar (128, settings_), // procedure - new SQLInteger (vrm), // reserved //@trunc3 - new SQLInteger (vrm), // reserved //@trunc3 - new SQLInteger (vrm), // reserved //@trunc3 - new SQLVarchar (2000, settings_), // remarks -/* ifdef JDBC40 */ - new SQLSmallint (vrm), // procedure type //@trunc3 - new SQLVarchar (128, settings_) // specific name //@JDBC40 - -/* endif */ -/* ifndef JDBC40 - new SQLSmallint (vrm) // procedure type //@trunc3 - endif */ - }; - - int[] fieldNullables = { - columnNullable, // Procedure catalog - columnNullable, // Procedure schema - columnNoNulls, // Procedure name - columnNullable, // Reserved 1 - columnNullable, // Reserved 2 - columnNullable, // Reserved 3 - columnNoNulls, // Remarks -/* ifdef JDBC40 */ - columnNoNulls, // Procedure type - columnNoNulls // Specific name //@JDBC40 -/* endif */ -/* ifndef JDBC40 - columnNoNulls // Procedure type - endif */ - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if ((!isCatalogValid(catalog)) || // catalog is empty string - - // schema is not null and is empty string - ((schemaPattern != null) && (schemaPattern.length()==0)) || - - // procedure is not null and is empty string - ((procedurePattern!=null) && (procedurePattern.length()==0))) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - else - { // Parameters are valid, build request and send - StringBuffer selectStmt = new StringBuffer(); -/* ifdef JDBC40 */ - selectStmt.append ("SELECT ROUTINE_SCHEMA, ROUTINE_NAME, REMARKS, RESULTS, SPECIFIC_NAME ");//@PROC //@JDBC40 -/* endif */ -/* ifndef JDBC40 - selectStmt.append ("SELECT ROUTINE_SCHEMA, ROUTINE_NAME, REMARKS, RESULTS ");//@PROC - endif */ - selectStmt.append ("FROM QSYS2" + getCatalogSeparator() + "SYSPROCS "); // use . or / - - - - if (schemaPattern !=null) - { - JDSearchPattern schema = new JDSearchPattern (schemaPattern); - String schemaWhereClause = schema.getSQLWhereClause("ROUTINE_SCHEMA");//@PROC - selectStmt.append("WHERE " + schemaWhereClause); - } - - - if (procedurePattern !=null) - { - JDSearchPattern procedure = new JDSearchPattern (procedurePattern); - if (schemaPattern!=null) - { // Where clause already exists, add AND - selectStmt.append (" AND "); - } - - else - { // Where clause does not exist, add WHERE - selectStmt.append (" WHERE "); - } - - String procedureWhereClause = procedure.getSQLWhereClause("ROUTINE_NAME");//@PROC - selectStmt.append(procedureWhereClause); - } - - - - // Add order by - selectStmt.append (" ORDER BY ROUTINE_SCHEMA, ROUTINE_NAME");//@PROC - - - // Create statement object and do Execute Query - AS400JDBCStatement statement_ = (AS400JDBCStatement)connection_.createStatement(); // caste needed - - AS400JDBCResultSet serverResultSet = (AS400JDBCResultSet) statement_.executeQuery (selectStmt.toString()); - - JDRowCache serverRowCache = new JDSimpleRowCache(serverResultSet.getRowCache()); - statement_.close (); -/* ifdef JDBC40 */ - JDFieldMap[] maps = new JDFieldMap[9]; -/* endif */ -/* ifndef JDBC40 - JDFieldMap[] maps = new JDFieldMap[8]; - endif */ - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog()); - maps[1] = new JDSimpleFieldMap (1); // schema - maps[2] = new JDSimpleFieldMap (2); // procedure - maps[3] = new JDHardcodedFieldMap (new Integer (0)); - maps[4] = new JDHardcodedFieldMap (new Integer (0)); - maps[5] = new JDHardcodedFieldMap (new Integer (0)); - maps[6] = new JDHandleNullFieldMap (3, ""); // remarks - maps[7] = new JDProcTypeFieldMap (4); -/* ifdef JDBC40 */ - maps[8] = new JDSimpleFieldMap (5); //@jdbc40 -/* endif */ - - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - - } // End of else build request and send - - - } // End of try block - - catch (SQLException e) - { - // System.out.println(e); - // e.printStackTrace(); // method on throwable object - // @B1D JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - throw e; // @B1A - } - - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "Procedures", connection_, null); //@in2 - - } - - - - /** - Returns the DB2 for IBM i SQL term for "procedure". - - @return The term for "procedure". - - @exception SQLException This exception is never thrown. - **/ - public String getProcedureTerm () - throws SQLException - { - return AS400JDBCDriver.getResource ("PROCEDURE_TERM"); - } - - - - //@G4A - /** - Retrieves the default holdability of this ResultSet object. Holdability is - whether ResultSet objects are kept open when the statement is committed. - - @return Always ResultSet.HOLD_CURSORS_OVER_COMMIT. - - @exception SQLException This exception is never thrown. - - @since Modification 5 - **/ - public int getResultSetHoldability () - throws SQLException - { - return AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT; - } - - - - /** - Returns the schema names available in this database. - This will return a ResultSet with a list of all the - libraries. - - @return The ResultSet containing the list of all the libraries. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getSchemas () - throws SQLException - { - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cs = connection_.prepareCall("CALL SYSIBM"+ getCatalogSeparator () + "SQLTABLES(?,?,?,?,?)"); - - cs.setString(1, "%"); - cs.setString(2, "%"); - cs.setString(3, "%"); - cs.setString(4, "%"); - cs.setString(5, "DATATYPE='JDBC';GETSCHEMAS=1;CURSORHOLD=1"); - cs.execute(); - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - return JDUtilities.getLibraries(this, connection_, settings_, false); //@DELIMa - } - - - - /** - Returns the DB2 for IBM i SQL term for "schema". - - @return The term for schema. - - @exception SQLException This exception is never thrown. - **/ - public String getSchemaTerm () - throws SQLException - { - return AS400JDBCDriver.getResource ("SCHEMA_TERM"); - } - - - - /** - Returns the string used to escape wildcard characters. - This is the string that can be used to escape '_' or '%' - in string patterns. - - @return The escape string. - - @exception SQLException This exception is never thrown. - **/ - public String getSearchStringEscape () - throws SQLException - { - return JDSearchPattern.getEscape (); - } - - - - /** - Returns the list of all of the database's SQL keywords - that are not also SQL92 keywords. - - @return The list of SQL keywords, separated by commas. - - @exception SQLException This exception is never thrown. - **/ - public String getSQLKeywords () - throws SQLException - { - return "AFTER,ALIAS,ALLOW,APPLICATION,ASSOCIATE,ASUTIME,AUDIT," + // @J2M - "AUX,AUXILIARY,BEFORE,BINARY," + // @J2A - "BUFFERPOOL,CACHE,CALL,CALLED,CAPTURE,CARDINALITY,CCSID,CLUSTER," + // @J2A - "COLLECTION,COLLID,COMMENT,CONCAT,CONDITION,CONTAINS,COUNT_BIG," + // @J2A - "CURRENT_LC_CTYPE," + // @J2A - "CURRENT_PATH,CURRENT_SERVER,CURRENT_TIMEZONE,CYCLE,DATA," + // @J2A - "DATABASE,DAYS," + // @J2A - "DB2GENERAL,DB2GENRL,DB2SQL,DBINFO,DEFAULTS,DEFINITION," + // @J2A - "DETERMINISTIC," + // @J2A - "DISALLOW,DO,DSNHATTR,DSSIZE,DYNAMIC,EACH,EDITPROC,ELSEIF," + // @J2A - "ENCODING,END-EXEC1," + // @J2A - "ERASE,EXCLUDING,EXIT,FENCED,FIELDPROC,FILE,FINAL,FREE,FUNCTION," + // @J2A - "GENERAL," + // @J2A - "GENERATED,GRAPHIC,HANDLER,HOLD,HOURS,IF,INCLUDING,INCREMENT," + // @J2A - "INDEX," + // @J2A - "INHERIT,INOUT,INTEGRITY,ISOBID,ITERATE,JAR,JAVA,LABEL,LC_CTYPE," + // @J2A - "LEAVE," + // @J2A - "LINKTYPE,LOCALE,LOCATOR,LOCATORS,LOCK,LOCKMAX,LOCKSIZE,LONG,LOOP," + // @J2A - "MAXVALUE,MICROSECOND,MICROSECONDS,MINUTES,MINVALUE,MODE,MODIFIES," + // @J2A - "MONTHS," + // @J2A - "NEW,NEW_TABLE,NOCACHE,NOCYCLE,NODENAME,NODENUMBER,NOMAXVALUE," + // @J2A - "NOMINVALUE," + // @J2A - "NOORDER,NULLS,NUMPARTS,OBID,OLD,OLD_TABLE,OPTIMIZATION,OPTIMIZE," + // @J2A - "OUT,OVERRIDING,PACKAGE,PARAMETER,PART,PARTITION,PATH,PIECESIZE," + // @J2A - "PLAN," + // @J2A - "PRIQTY,PROGRAM,PSID,QUERYNO,READS,RECOVERY,REFERENCING,RELEASE," + // @J2A - "RENAME,REPEAT,RESET,RESIGNAL,RESTART,RESULT,RESULT_SET_LOCATOR," + // @J2A - "RETURN," + // @J2A - "RETURNS,ROUTINE,ROW,RRN,RUN,SAVEPOINT,SCRATCHPAD,SECONDS,SECQTY," + // @J2A - "SECURITY,SENSITIVE,SIGNAL,SIMPLE,SOURCE,SPECIFIC,SQLID,STANDARD," + // @J2A - "START,STATIC,STAY,STOGROUP,STORES,STYLE,SUBPAGES,SYNONYM,SYSFUN," + // @J2A - "SYSIBM," + // @J2A - "SYSPROC,SYSTEM,TABLESPACE,TRIGGER,TYPE,UNDO,UNTIL,VALIDPROC," + // @J2A - "VARIABLE," + // @J2A - "VARIANT,VCAT,VOLUMES,WHILE,WLM,YEARS"; // @J2A - } - - - - //@G4A - /** - Indicates whether the SQLSTATEs returned by SQLException.getSQLState is X/Open SQL CLI or - SQL99. - - @return Always sqlStateSQL99. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public int getSQLStateType () - throws SQLException - { - return AS400JDBCDatabaseMetaData.sqlStateSQL99; - } - - - - /** - Returns the list of supported string functions. - - @return The list of supported string functions, separated by commas. - - @exception SQLException This exception is never thrown. - **/ - public String getStringFunctions () - throws SQLException - { - // @J0A added try/catch because we are now sending the system VMR - return JDEscapeClause.getStringFunctions(connection_.getVRM()); // @J0M changed to send host version - } - - - - //@G4A - /** - Returns a ResultSet containing descriptions of the table hierarchies - in a schema. - - This method only applies to the attributes of a - structured type. Distinct types are stored in the datatypes - catalog, not the attributes catalog. Since DB2 for IBM i does not support - structured types at this time, an empty ResultSet will always be returned - for calls to this method. - - @param catalog The catalog name. - @param schemaPattern The schema name pattern. - @param typeNamePattern The type name pattern. - - @return The empty ResultSet - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public ResultSet getSuperTables (String catalog, String schemaPattern, String typeNamePattern) - throws SQLException - { - // We return an empty result set because this is not supported by our driver - Statement statement = connection_.createStatement(); - return statement.executeQuery("SELECT VARCHAR('1', 128) AS TYPE_CAT, " + - "VARCHAR('2', 128) AS TYPE_SCHEM, " + - "VARCHAR('3', 128) AS TYPE_NAME, " + - "VARCHAR('4', 128) AS SUPERTYPE_NAME " + - "FROM QSYS2" + getCatalogSeparator() + - "SYSTYPES WHERE 1 = 2 FOR FETCH ONLY "); - } - - - - //@G4A - /** - Returns a ResultSet containing descriptions of user-defined type hierarchies - in a schema. - - This method only applies to the attributes of a - structured type. Distinct types are stored in the datatypes - catalog, not the attributes catalog. Since DB2 for IBM i does not support - structured types at this time, an empty ResultSet will always be returned - for calls to this method. - - @param catalog The catalog name. - @param schemaPattern The schema name pattern. - @param typeNamePattern The type name pattern. - - @return The empty result set - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public ResultSet getSuperTypes (String catalog, String schemaPattern, String typeNamePattern) - throws SQLException - { - // We return an empty result set because this is not supported by our driver - Statement statement = connection_.createStatement(); - return statement.executeQuery("SELECT VARCHAR('1', 128) AS TYPE_CAT, " + - "VARCHAR('2', 128) AS TYPE_SCHEM, " + - "VARCHAR('3', 128) AS TYPE_NAME, " + - "VARCHAR('4', 128) AS SUPERTYPE_CAT, " + - "VARCHAR('5', 128) AS SUPERTYPE_SCHEM, " + - "VARCHAR('6', 128) AS SUPERTYPE_NAME " + - "FROM QSYS2" + getCatalogSeparator() + - "SYSTYPES WHERE 1 = 2 FOR FETCH ONLY "); - } - - - - /** - Returns the list of supported system functions. - - @return The list of supported system functions, separated by commas. - - @exception SQLException This exception is never thrown. - **/ - public String getSystemFunctions () - throws SQLException - { - // @J0A added try/catch because we are now sending the system VMR - return JDEscapeClause.getSystemFunctions(connection_.getVRM()); // @J0M changed to send host version - } - - - - /** - Returns the description of the access rights for each table - available in a catalog. Note that a table privilege applies - to one or more columns in a table. - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schemaPattern The schema name pattern. - If the "metadata source" connection property is set to 0 - and null is specified, no value is sent to the system and - the default of *USRLIBL is used. - If the "metadata source" connection property is set to 1 - and null is specified, then information from all schemas - will be returned. - - If empty string is specified, an empty - result set is returned. - @param tablePattern The table name. If null is specified, - no value is sent to the system and the system - default of *ALL is used. If empty string - is specified, an empty result set is returned. - @return The ResultSet containing the description of the - access rights for each table available in the - catalog. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getTablePrivileges (String catalog, - String schemaPattern, - String tablePattern) - throws SQLException - { - DBReplyRequestedDS reply = null; - connection_.checkOpen (); - // int vrm = connection_.getVRM(); //@trunc3 - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cs = connection_.prepareCall("CALL SYSIBM"+ getCatalogSeparator () + "SQLTABLEPRIVILEGES(?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, normalize(schemaPattern)); - cs.setString(3, normalize(tablePattern)); - cs.setString(4, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - //----------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - String[] fieldNames = {"TABLE_CAT", - "TABLE_SCHEM", - "TABLE_NAME", - "GRANTOR", - "GRANTEE", - "PRIVILEGE", - "IS_GRANTABLE", - }; - - - SQLData[] sqlData = { new SQLVarchar (128, settings_), // catalog - new SQLVarchar (128, settings_), // library - new SQLVarchar (128, settings_), // table - new SQLVarchar (128, settings_), // grantor - new SQLVarchar (128, settings_), // grantee - new SQLVarchar (128, settings_), // privilege - new SQLVarchar (3, settings_), // is_grantable - }; - - int[] fieldNullables = {columnNullable, // catalog - columnNullable, // library - columnNoNulls, // table - columnNullable, // grantor - columnNoNulls, // grantee - columnNoNulls, // privilege - columnNullable, // is_grantable - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows - // that are readable one at a time. - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - if (!isCatalogValid(catalog) || // catalog is empty string - - // schema is not null and is empty string - ((schemaPattern != null) && (schemaPattern.length()==0)) || - - // table is not null and is empty string - ((tablePattern != null) && (tablePattern.length()==0))) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - - else - { // parameter values are valid, build request & send - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_FILE_INFO, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - // Set the library name and search pattern indicator - // If null, do not set parameter. The system default - // value of *USRLIBL is used. - if (schemaPattern!=null) - { - JDSearchPattern schema = new JDSearchPattern(schemaPattern); - request.setLibraryName(normalize(schema.getPatternString()), connection_.converter_); // @E4C - request.setLibraryNameSearchPatternIndicator(schema.getIndicator()); - } - - - - // Set the table name and search pattern indicator - // If null, do not set parameter. The system default - // value of *ALL is used. - if (tablePattern!=null) - { - JDSearchPattern table = new JDSearchPattern(tablePattern); - request.setFileName(normalize(table.getPatternString()),connection_.converter_); // @E4C - request.setFileNameSearchPatternIndicator(table.getIndicator()); - } - - request.setFileShortOrLongNameIndicator (0xF0); // Long table names - - - request.setFileReturnInfoBitmap (0xA1000000); // Return bitmap - - // Order the results by table type, table schema, table name - request.setFileInfoOrderByIndicator (2); - - - //-------------------------------------------------------- - // Send the request and cache all results from the system - //-------------------------------------------------------- - - reply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = reply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = reply.getReturnCode(); - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - - // Get the data format and result data - DBDataFormat dataFormat = reply.getDataFormat(); - DBData resultData = reply.getResultData(); - - // Put the data format into a row object - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - - // Put the result data into a row cache - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache (row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - - // Create the mapped row format that is returned in the - // result set. - // This does not actual move the data, it just sets up - // the mapping. - JDFieldMap[] maps = new JDFieldMap[7]; - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog ()); - maps[1] = new JDSimpleFieldMap (1); // library - maps[2] = new JDSimpleFieldMap (2); // table - maps[3] = new JDHardcodedFieldMap ("", true, false); // grantor - maps[4] = new JDHardcodedFieldMap (getUserName ()); // grantee - return userid - maps[5] = new JDPrivilegeFieldMap (3); // privilege - maps[6] = new JDHardcodedFieldMap ("", true, false); // is_grantable - - // Create the mapped row cache that is returned in the - // result set - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - - } - finally - { - if (request != null) { request.returnToPool(); request = null;} - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } // End of else to build and send request - } // End of try block - - catch (DBDataStreamException e) - { - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - // Return the results - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "TablePrivileges", connection_, reply); //@in2 //@G4C - } - - - - /** - Returns the description of the tables available in a catalog. - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schemaPattern The schema name pattern. - If the "metadata source" connection property is set to 0 - and null is specified, no value is sent to the system and - the default of *USRLIBL is used. - If the "metadata source" connection property is set to 1 - and null is specified, then information from all schemas - will be returned. If an empty string - is specified, an empty result set is returned. - @param tablePattern The table name pattern. If null is specified, - no value is sent to the system and the system - default of *ALL is used. If empty string - is specified, an empty result set is returned. - @param tableTypes The list of table types to include, or null to - include all table types. Valid types are: - TABLE, VIEW, SYSTEM TABLE, MATERIALIZED QUERY TABLE, and ALIAS. - @return The ResultSet containing the description of the - tables available in the catalog. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getTables (String catalog, - String schemaPattern, - String tablePattern, - String tableTypes[]) - throws SQLException - { - DBReplyRequestedDS reply = null; - - connection_.checkOpen ();// Verify that a connection - // is available for use. Exception - // is thrown if not available - - // int vrm = connection_.getVRM(); //@trunc3 - - - //@mdsp SYSIBM SP Call and Native logic - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - // Handle processing the array of table types. - //bite the bullet and follow Native JDBC logic - boolean rsEmpty = false; - String typeString = EMPTY_STRING; - if (!rsEmpty) { - int i; - int stringsInList = 0; - - if (tableTypes != null) { - for (i = 0; i < tableTypes.length; i++) { - String check = tableTypes[i]; - - if ((check.equalsIgnoreCase(VIEW)) || - (check.equalsIgnoreCase(TABLE)) || - (check.equalsIgnoreCase(SYSTEM_TABLE)) || - (check.equalsIgnoreCase(ALIAS)) || - (check.equalsIgnoreCase(SYNONYM)) || - (check.equalsIgnoreCase(MQT))) - { - - if (check.equalsIgnoreCase(SYNONYM)) { - check = ALIAS; - } - stringsInList++; - if (stringsInList > 1) - typeString = typeString.concat(","); - typeString = typeString.concat(check); - } - } - - // If there were no valid types, ensure an empty result set. - if (stringsInList == 0) - rsEmpty = true; - } - } - - // If an empty result set is to be generated, produce the values to - // do so here. - if (rsEmpty) { - schemaPattern = FAKE_VALUE; - tablePattern = FAKE_VALUE; - typeString = typeString.concat(TABLE); //@scan1 - } - - - CallableStatement cs = connection_.prepareCall("CALL SYSIBM" + getCatalogSeparator () - + "SQLTABLES(?,?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, normalize(schemaPattern)); - cs.setString(3, normalize(tablePattern)); - cs.setString(4, normalize(typeString)); - cs.setString(5, - "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - cs.execute(); - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - - } - - - //----------------------------------------------------- - // Set up the result set in the format required by JDBC - //----------------------------------------------------- - - boolean isJDBC3 = JDUtilities.JDBCLevel_ >= 30; //@F2A @j4a - - String[] fieldNames = null; //@F2C - SQLData[] sqlData = null; //@F2C - int[] fieldNullables = null; //@F2C - if (!isJDBC3) //@F2A - { - fieldNames = new String[] { "TABLE_CAT", - "TABLE_SCHEM", - "TABLE_NAME", - "TABLE_TYPE", - "REMARKS"}; - - sqlData = new SQLData[] { new SQLVarchar (128, settings_), - new SQLVarchar (128, settings_), - new SQLVarchar (128, settings_), - new SQLVarchar (128, settings_), - new SQLVarchar (254, settings_)}; - - - fieldNullables = new int[] {columnNullable, // Table catalog - columnNullable, // Table schema - columnNoNulls, // Table name - columnNoNulls, // Table type - columnNoNulls}; // Remarks - } - else - { - fieldNames = new String[] { "TABLE_CAT", - "TABLE_SCHEM", - "TABLE_NAME", - "TABLE_TYPE", - "REMARKS", - "TYPE_CAT", //@G4A - "TYPE_SCHEM", //@G4A - "TYPE_NAME", //@G4A - "SELF_REFERENCING_COL_NAME", //@G4A - "REF_GENERATION"}; //@G4A - - sqlData = new SQLData[] { new SQLVarchar (128, settings_), - new SQLVarchar (128, settings_), - new SQLVarchar (128, settings_), - new SQLVarchar (128, settings_), - new SQLVarchar (254, settings_), - new SQLVarchar (128, settings_), //@G4A - new SQLVarchar (128, settings_), //@G4A - new SQLVarchar (128, settings_), //@G4A - new SQLVarchar (128, settings_), //@G4A - new SQLVarchar (128, settings_)}; //@G4A - - - fieldNullables = new int[] {columnNullable, // Table catalog - columnNullable, // Table schema - columnNoNulls, // Table name - columnNoNulls, // Table type - columnNoNulls, // Remarks - columnNullable, // Types catalog //@G4A - columnNullable, // Types schema //@G4A - columnNullable, // Type name //@G4A - columnNullable, // Self referencing column name //@G4A - columnNullable}; // Reference generation //@G4A - } - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows that - // are readable one at a time - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - if (!isCatalogValid(catalog) || // catalog is empty string - - // schema is not null and is empty string - ((schemaPattern != null) && (schemaPattern.length()==0)) || - - // table is not null and is empty string - ((tablePattern != null) && (tablePattern.length()==0))) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - - else - { // schema, table, and catalog are valid, create and send request - - //------------------------------------------------------- - // Set the file attribute parm of the Retrieve File - // Information (ROI) function based on the types array - // provided. ROI uses the following values: - // '0001'x = all files - // '0002'x = physical files and alias files //@K3C changed to match host server LIPI - // '0003'x = logical files and alias files //@K3C - // '0004'x = tables and alias files //@K3C - // '0005'x = views and alias files //@K3C - // '0006'x = system tables - // '0007'x = tables and views and alias files //@K3C - // '0008'x = tables and system tables and alias files //@K3C - // '0009'x = views and system tables and alias files //@K3C - // '000A'x = alias files //@K1A - // '000B'x = tables and materialized query tables //@K1A - // '000C'x = views and materialized query tables //@K1A - // '000D'x = system tables and materialized query tables //@K1A - // '000E'x = tables, views, and materialized query tables //@K1A - // '000F'x = tables, system tables, and materialized query tables //@K1A - // '0010'x = views, system tables, and materizlized query tables //@K1A - // '0011'x = materialized query tables //@K1A - // - // Options '000B'x - '0011'x are for V5R3 or higher systems - // - // If null is specified, file attributes is set to 1. - // - // If none of the above values are specified, file - // attribute is set to -1 and an empty result set will - // be created. No request is sent to the system. - //-------------------------------------------------------- - int fileAttribute; - boolean needToRemoveAliases = true; //@K3A - if (tableTypes != null) - { - boolean typeTable = false; // false = don't include table type - boolean typeView = false; - boolean typeSystemTable = false; - boolean typeMQTable = false; //@K1A - boolean typeAlias = false; //@K3A - - // Walk thru table types to determine which ones we need to include - for (int i = 0; i < tableTypes.length; ++i) - { - if (tableTypes[i].equalsIgnoreCase ("TABLE")) - typeTable = true; // Include tables - else if (tableTypes[i].equalsIgnoreCase ("VIEW")) - typeView = true; // Include views - else if (tableTypes[i].equalsIgnoreCase ("SYSTEM TABLE")) - typeSystemTable = true; // Include system tables - else if (tableTypes[i].equalsIgnoreCase ("MATERIALIZED QUERY TABLE") && connection_.getVRM() >= JDUtilities.vrm530) //@K1A - typeMQTable = true; //@K1A - else if(tableTypes[i].equalsIgnoreCase("ALIAS")) //@K3A - typeAlias = true; //@K3A - } // end of for loop - - if(typeAlias) //@K3A - needToRemoveAliases = false; //@K3A - - if (typeTable) - { - if (typeView) - { - if (typeSystemTable) - fileAttribute = 1; // All - else if(typeMQTable) //@K1A - { - fileAttribute = 14; //tables, views, and MQT's //@K1A - needToRemoveAliases = false; //@K3A no aliases are returned - } - else - fileAttribute = 7; // Tables and views - } - else if(typeSystemTable) //@K1A Not Views - { //@K1A - if(typeMQTable) //@K1A - { - fileAttribute = 15; //@K1A - needToRemoveAliases = false; //@K3A no aliases are returned - } - else //@K1A - fileAttribute = 8; // Tables and system tables - } //@K1A - else if(typeMQTable) //@K1A Not Views and not system tables - { //@K1A - fileAttribute = 11; //@K1A - needToRemoveAliases = false; //@K3A no aliases are returned - } //@K1A - else - fileAttribute = 4; // Tables - } // end of if typeTable - else if(typeMQTable) //@K1A - { //@K1A - if(typeView) //@K1A - { //@K1A - if(typeSystemTable) //@K1A - fileAttribute = 16; //views, system tables, and MQT's //@K1A - else //@K1A - fileAttribute = 12; //views and MQT's //@K1A - } //@K1A - else if(typeSystemTable) //@K1A - fileAttribute = 13; //system tables and MQT's //@K1A - else //@K1A - fileAttribute = 17; //MQT's //@K1A - needToRemoveAliases = false; //@K3A no aliases are returned - } //@K1A - else - { // Not tables - if (typeView) - { - if (typeSystemTable) - fileAttribute = 9; // Views and system tables - else - fileAttribute = 5; // Views - } - else - { - if (typeSystemTable) - { - fileAttribute = 6; // System tables - needToRemoveAliases = false; //@K3A no aliases are returned - } - else if(typeAlias && connection_.getVRM() >= JDUtilities.vrm430) //@K3A Aliases are only supported on V4R3 and higher - fileAttribute = 10; //@K3A - else - fileAttribute = -1; // Unknown type - // Will return empty results - } - } // End of not tables else - } // End of if tables != nulls - else - { - // Table types was set to null which implies all - // types are to be returned - fileAttribute = 1; // All - } - - - //------------------------------------------------ - // Create the request to Retrieve File Information - //------------------------------------------------ - if (fileAttribute != -1) - { // If -1, return empty set - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_FILE_INFO, id_, - DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT - + DBBaseRequestDS.ORS_BITMAP_RESULT_DATA,0); - - - //-------------------------------------------------- - // Set the parameters for the request - //-------------------------------------------------- - - - // Set the Library Name and Library Name Search Pattern parameters - // If null, do not set parameter. The system default value of - // *USRLIBL is used. - if (schemaPattern != null) - { // use default SQL schema or qgpl - JDSearchPattern schema = new JDSearchPattern(schemaPattern); - request.setLibraryName (normalize(schema.getPatternString()), connection_.converter_); // @E4C - request.setLibraryNameSearchPatternIndicator(schema.getIndicator()); - } - - - - // Set the Table Name and Table Name Search Pattern parameters - // If null, do not set parameter. The system default value of - // *ALL is used. - if (tablePattern!=null) - { - JDSearchPattern table = new JDSearchPattern(tablePattern); - request.setFileName (normalize(table.getPatternString()), connection_.converter_); // @E4C - request.setFileNameSearchPatternIndicator(table.getIndicator()); - } - - - - // Set other parameters - request.setFileShortOrLongNameIndicator (0xF0); // Long table names. - request.setFileAttribute (fileAttribute); - - // Set the information to return. Always return the - // library name, file name, and file attribute (ODBC - // type). Also return either the remarks or the file - // text depending on what the "remarks" attribute - // is set to. - - // Get the current value for the "remarks" property - // and check to see if it is sql or system - // connection_.getProperties() returns the JDProperties - // object - - - if (connection_.getProperties().equals - (JDProperties.REMARKS, JDProperties.REMARKS_SQL)) - { - request.setFileReturnInfoBitmap (0xF0000000); // return remarks - } - else - { - request.setFileReturnInfoBitmap (0xB4000000); // return text - } - - // Order the results by table type, table schema, table name - // This is the same as ordering by tables on the system - request.setFileInfoOrderByIndicator (2); - - - //------------------------------------------------------- - // Send the request and cache all results from the system - //------------------------------------------------------- - - reply = connection_.sendAndReceive (request); - - // Check for errors - throw exception if errors - // were returned - int errorClass = reply.getErrorClass(); - if (errorClass != 0) - { - int returnCode = reply.getReturnCode(); - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - - // Get the data format and result data - // The result data is parsed via JDServerRow getData - DBDataFormat dataFormat = reply.getDataFormat (); - DBData resultData = reply.getResultData (); - if (resultData != null) - { - // If the user didn't request aliases - if(needToRemoveAliases) //@K3A - parseResultData(resultData, dataFormat); //@K3A - - // Put the data format into a row format. Handles data types - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - - // Put the result data into a row cache - // ServerRowCache needs rowFormat to get offset and other info - // Only need this with this type of row cache (not with simple) - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache(row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - - // This is not actually moving data, it just sets up the mapping - JDFieldMap[] maps = null; //@F2C - if (!isJDBC3) //@F2A - maps = new JDFieldMap[5]; - else - maps = new JDFieldMap[10]; - - if (connection_.getProperties().equals - (JDProperties.REMARKS, JDProperties.REMARKS_SQL)) - { - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog()); - maps[1] = new JDSimpleFieldMap (1); // schema // @A3C @E4C - maps[2] = new JDSimpleFieldMap (3); // table - maps[3] = new JDTableTypeFieldMap (4); // table type - maps[4] = new JDSimpleFieldMap (2); // remarks - //@G4A The below fields will all return null. We have distinct types - //@G4A instead of abstract types here, so a request returns no - //@G4A type information. - if (isJDBC3) - { - maps[5] = new JDHardcodedFieldMap ("", true, false); // types catalog //@G4A - maps[6] = new JDHardcodedFieldMap ("", true, false); // types schema //@G4A - maps[7] = new JDHardcodedFieldMap ("", true, false); // type name //@G4A - maps[8] = new JDHardcodedFieldMap ("", true, false); // self referencing col name //@G4A - maps[9] = new JDHardcodedFieldMap ("", true, false); // ref generation //@G4A - } - } - - else - { // Get file text instead of remarks - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog()); - maps[1] = new JDSimpleFieldMap (1); // schema // @A3C @E4C - maps[2] = new JDSimpleFieldMap (2); // table - maps[3] = new JDTableTypeFieldMap (3); // table type - maps[4] = new JDSimpleFieldMap (4); // File text - //@G4A The below fields will all return null. We have distinct types - //@G4A instead of abstract types here, so a request returns no - //@G4A type information. - if (isJDBC3) - { - maps[5] = new JDHardcodedFieldMap ("", true, false); // types catalog //@G4A - maps[6] = new JDHardcodedFieldMap ("", true, false); // types schema //@G4A - maps[7] = new JDHardcodedFieldMap ("", true, false); // type name //@G4A - maps[8] = new JDHardcodedFieldMap ("", true, false); // self referencing col name //@G4A - maps[9] = new JDHardcodedFieldMap ("", true, false); // ref generation //@G4A - } - } - - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - - } - else - rowCache = new JDSimpleRowCache(formatRow); - - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } // End of if file attribute != -1 - else - { // result set should be empty. - rowCache = new JDSimpleRowCache(formatRow); - } - - } // End of else to create and send request - - } // End of try block - - catch (DBDataStreamException e) - { - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "Tables", connection_, reply); //@in2 - } - -//@K3A -// Parses the result data from the system to determine if any aliases were returned. - void parseResultData(DBData resultData, DBDataFormat dataFormat) { - try{ - byte[] rawBytes = resultData.getRawBytes(); - int rowCount = resultData.getRowCount(); - int columnOffset = dataFormat.getFieldLength(0); // schema - columnOffset += dataFormat.getFieldLength(1); // table - int tableTypeLength = dataFormat.getFieldLength(2); // table type - SQLChar tableType = new SQLChar(tableTypeLength, settings_); // create an sql char ojbect to get the table type - int aliasCount = 0; - ConvTable ccsidConverter = connection_.getConverter(dataFormat.getFieldCCSID(2)); - for(int i=0; i= JDUtilities.vrm530))) //@5WXVJX - typeSamples.addElement(new SQLCharForBitData(32765, settings_)); // @M0A - typeSamples.addElement(new SQLDate(settings_, -1)); // @D0C @550C - typeSamples.addElement(new SQLDecimal(31, 31, settings_, connection_.getVRM(), connection_.getProperties())); // @M0C - typeSamples.addElement(new SQLDouble(settings_)); // @D0C - typeSamples.addElement(new SQLFloat(settings_)); // @D0C - typeSamples.addElement(new SQLGraphic(16382, settings_, -1)); //@cca1 - typeSamples.addElement(new SQLInteger(vrm)); //@trunc3 // @D0C - typeSamples.addElement(new SQLNumeric(31, 31, settings_, connection_.getVRM(), connection_.getProperties())); // @M0C - typeSamples.addElement(new SQLReal(settings_)); // @D0C - typeSamples.addElement(new SQLSmallint(vrm)); //@trunc3 // @D0C - typeSamples.addElement(new SQLTime(settings_, -1)); // @D0C @550C - typeSamples.addElement(new SQLTimestamp(settings_)); // @D0C - //typeSamples.addElement(new SQLLongVarchar(32739, settings_)); //Change to report LONG VARCHAR as VARCHAR to be consistent with other clients. - typeSamples.addElement(new SQLLongVargraphic(16369, settings_)); - typeSamples.addElement(new SQLLongVarcharForBitData(32739, settings_)); - typeSamples.addElement(new SQLVarchar(32739, settings_)); // @D0C - if((connection_.getVRM() < JDUtilities.vrm530) || (translateHexAsChar && (connection_.getVRM() >= JDUtilities.vrm530))) //@5WXVJX - typeSamples.addElement(new SQLVarcharForBitData(32739, settings_)); // @M0A - typeSamples.addElement(new SQLVargraphic(16369, settings_, -1)); //@cca1 - - if (connection_.getVRM() >= JDUtilities.vrm440) - { // @B4D B5A @D0C - typeSamples.addElement(new SQLDatalink(32717, settings_)); - typeSamples.addElement(new SQLBlob(MAX_LOB_LENGTH, settings_)); // @B4D B5A @D0C //@xml3 - typeSamples.addElement(new SQLClob(MAX_LOB_LENGTH, settings_)); // @B4D B5A @D0C @E1C //@xml3 - typeSamples.addElement(new SQLDBClob(1073741822, settings_)); - } // @B4D B5A - - if (connection_.getVRM() >= JDUtilities.vrm450) // @D0A - typeSamples.addElement(new SQLBigint(vrm)); //@trunc3 // @D0A - - // @M0A - added support for binary, varbinary, and rowid data types - if(connection_.getVRM() >= JDUtilities.vrm520) - { - typeSamples.addElement(new SQLRowID(settings_)); - } - - if(connection_.getVRM() >= JDUtilities.vrm530) - { - if(!translateHexAsChar) //@5WXVJX - { - typeSamples.addElement(new SQLBinary(32765, settings_)); - typeSamples.addElement(new SQLVarbinary(32739, settings_)); - } - } - if(connection_.getVRM() >= JDUtilities.vrm610) //@dfa - { //@dfa - //note that on hostserver both 16 and 34 are one type (stored proc returns one type) - typeSamples.addElement(new SQLDecFloat34( settings_, connection_.getVRM(), connection_.getProperties())); //@dfa - } //@dfa - // @M0A - end new support - - int numberOfTypes = typeSamples.size(); // @D0C - int numberOfFields = sqlData.length; - Object[][] data = new Object[numberOfTypes][]; - boolean[][] nulls = new boolean[numberOfTypes][]; - boolean[][] dataMappingErrors = new boolean[numberOfTypes][]; - for (int i = 0; i < numberOfTypes; ++i) - { - data[i] = new Object[numberOfFields]; - nulls[i] = new boolean[numberOfFields]; - dataMappingErrors[i] = new boolean[numberOfFields]; - - SQLData typeSample = (SQLData) typeSamples.elementAt(i); // @D0C - data[i][0] = typeSample.getTypeName (); // @D0C - data[i][1] = new Short ((short) typeSample.getType ()); // @D0C - data[i][2] = new Integer (typeSample.getMaximumPrecision()); // @D0C - - String literalPrefix = typeSample.getLiteralPrefix (); // @D0C - if (literalPrefix == null) - { - data[i][3] = ""; - nulls[i][3] = true; - } - else - data[i][3] = literalPrefix; - - String literalSuffix = typeSample.getLiteralSuffix (); // @D0C - if (literalSuffix == null) - { - data[i][4] = ""; - nulls[i][4] = true; - } - else - data[i][4] = literalSuffix; - - String createParameters = typeSample.getCreateParameters (); // @D0C - if (createParameters == null) - { - data[i][5] = ""; - nulls[i][5] = true; - } - else - data[i][5] = createParameters; - - data[i][6] = new Short ((short) typeNullable); - data[i][7] = new Boolean (typeSample.isText ()); // @D0C - data[i][8] = new Short ((short) typeSearchable); - data[i][9] = new Boolean (! typeSample.isSigned ()); // @D0C - data[i][10] = new Boolean (false); - data[i][11] = new Boolean (false); - - String localName = typeSample.getLocalName (); // @D0C - if (localName == null) - { - data[i][12] = ""; - nulls[i][12] = true; - } - else - data[i][12] = localName; - - data[i][13] = new Short ((short) typeSample.getMinimumScale ()); // @D0C - data[i][14] = new Short ((short) typeSample.getMaximumScale ()); // @D0C - data[i][15] = new Integer (0); - data[i][16] = new Integer (0); - data[i][17] = new Integer (typeSample.getRadix ()); // @D0C - } - - JDSimpleRowCache rowCache = new JDSimpleRowCache(formatRow, data, nulls, dataMappingErrors); - - return new AS400JDBCResultSet (rowCache, - connection_.getCatalog(), "Type Info", connection_, null); //@in2 - - - - - } - - - - // JDBC 2.0 - /** - Returns the description of the user-defined types - available in a catalog. - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schemaPattern The schema name pattern. - If the "metadata source" connection property is set to 0 - and null is specified, no value is sent to the system and - the default of *USRLIBL is used. - If the "metadata source" connection property is set to 1 - and null is specified, then information from all schemas - will be returned. - If an empty string - is specified, an empty result set is returned. - @param typeNamePattern The type name pattern. If null is specified, - no value is sent to the system and the system - default of *ALL is used. If empty string - is specified, an empty result set is returned. - @param types The list of user-defined types to include, or null to - include all user-defined types. Valid types are: - JAVA_OBJECT, STRUCT, and DISTINCT. - @return The ResultSet containing the description of the - user-defined available in the catalog. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - // - // Implementation note: - // - // 1. I was worried about cases where one distinct type is created - // based on another distinct type. This would cause problems - // because the source type would no longer identify a system - // predefined type and we would have to follow the chain until - // we found a system predefined type. - // - // It turns out that this is not an issue. In the "JDBC Tutorial and - // Reference", section 3.5.5 "Creating a DISTINCT type", it says: - // "A DISTINCT type is always based on another data type, which must - // be a predefined type. ... a DISTINCT type cannot be based - // on a UDT." ("UDT" means user-defined type.) - // So we can make the assumption that the source type - // always identifies a system predefined type. - // - public ResultSet getUDTs (String catalog, - String schemaPattern, - String typeNamePattern, - int[] types) - throws SQLException - { - connection_.checkOpen (); - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - - - - CallableStatement cs = connection_.prepareCall("CALL SYSIBM" + getCatalogSeparator()+ "SQLUDTS(?,?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, normalize(schemaPattern)); - cs.setString(3, normalize(typeNamePattern)); - StringBuffer typesStringBuffer = new StringBuffer(); - int stringsInList = 0; - - if (types != null) { - for (int i = 0; i < types.length; i++) { - if (stringsInList > 0) { - typesStringBuffer.append(","); - } - typesStringBuffer.append(types[i]); - stringsInList++; - } - } - - cs.setString(4, typesStringBuffer.toString()); -/* ifdef JDBC40 */ - cs.setString(5, "DATATYPE='JDBC';JDBCVER='4.0';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); //@ver4 -/* endif */ -/* ifndef JDBC40 - cs.setString(5, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - endif */ - cs.execute(); - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - int vrm = connection_.getVRM(); //@trunc3 - boolean isJDBC3 = JDUtilities.JDBCLevel_ >= 30; //@F2A @j4a - - String[] fieldNames = null; //@F2C - SQLData[] sqlData = null; //@F2C - int[] fieldNullables = null; //@F2C - if (!isJDBC3) //@F2A - { - // Set up the result set in the format required by JDBC - fieldNames = new String[] { "TYPE_CAT", - "TYPE_SCHEM", - "TYPE_NAME", - "CLASS_NAME", - "DATA_TYPE", - "REMARKS", - }; - - sqlData = new SQLData[] { new SQLVarchar (128, settings_), // type catalog - new SQLVarchar (128, settings_), // type schema - new SQLVarchar (128, settings_), // type name - new SQLVarchar (128, settings_), // class name - new SQLSmallint (vrm), // data type //@trunc3 - new SQLVarchar (2000, settings_), // remarks - }; - - fieldNullables = new int[] { columnNullable, // type catalog - columnNullable, // type schema - columnNoNulls, // type name - columnNoNulls, // class name - columnNoNulls, // data type - columnNoNulls, // remarks - }; - } - else - { - // Set up the result set in the format required by JDBC 3.0 - fieldNames = new String[] { "TYPE_CAT", - "TYPE_SCHEM", - "TYPE_NAME", - "CLASS_NAME", - "DATA_TYPE", - "REMARKS", - "BASE_TYPE" //@G4A - }; - - sqlData = new SQLData[] { new SQLVarchar (128, settings_), // type catalog - new SQLVarchar (128, settings_), // type schema - new SQLVarchar (128, settings_), // type name - new SQLVarchar (128, settings_), // class name - new SQLSmallint (vrm), // data type //@trunc3 - new SQLVarchar (2000, settings_), // remarks - new SQLSmallint (vrm), // base type //@G4A //@trunc3 - }; - - fieldNullables = new int[] { columnNullable, // type catalog - columnNullable, // type schema - columnNoNulls, // type name - columnNoNulls, // class name - columnNoNulls, // data type - columnNoNulls, // remarks - columnNullable, // base type //@G4A - }; - - } - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - JDRowCache rowCache = null; - - // We only support DISTINCT in the types array. Determine - // if this was passed as one of the elements. If null is - // passed, that is like looking for everything, so make that - // work like DISTINCT was passed. - boolean distinctPassed = false; - if (types == null) - distinctPassed = true; - else - { - for (int i = 0; i < types.length; ++i) - if (types[i] == Types.DISTINCT) - { - distinctPassed = true; - break; - } - } - - // Check for conditions that would result in an empty - // result set. - if ((! isCatalogValid (catalog)) - || ((schemaPattern != null) && (schemaPattern.length () == 0)) - || ((typeNamePattern != null) && (typeNamePattern.length () == 0)) - || (distinctPassed == false)) - rowCache = new JDSimpleRowCache (formatRow); - - // Otherwise, build a request and send. There is - // no builtin request for UDTs in the ROI server, - // so we implement this using a query on a catalog. - else - { - - // Build up the query, - StringBuffer select = new StringBuffer (); - select.append ("SELECT USER_DEFINED_TYPE_SCHEMA, " // @B2C - + "USER_DEFINED_TYPE_NAME, " // @B2C - + "SOURCE_TYPE, REMARKS"); - if (isJDBC3) //@F2A - { - select.append (", SMALLINT (CASE SOURCE_TYPE " // @G4A - + "WHEN 'BIGINT' THEN -5 WHEN 'CHAR' THEN 1 " // @G4A - + "WHEN 'CHARACTER' THEN 1 WHEN 'GRAPHIC' THEN 1 " // @G4A - + "WHEN 'NUMERIC' THEN 2 WHEN 'DECIMAL' THEN 3 " // @G4A - + "WHEN 'INTEGER' THEN 4 WHEN 'SMALLINT' THEN 5 " // @G4A - + "WHEN 'REAL' THEN 6 WHEN 'FLOAT' THEN 8 " // @G4A - + "WHEN 'DOUBLE' THEN 8 WHEN 'DOUBLE PRECISION' THEN 8 " // @G4A - + "WHEN 'VARCHAR' THEN 12 WHEN 'VARGRAPHIC' THEN 12 " // @G4A - + "WHEN 'DATALINK' THEN 70 WHEN 'DATE' THEN 91 " // @G4A - + "WHEN 'TIME' THEN 92 WHEN 'TIMESTMP' THEN 93 " // @G4A - + "WHEN 'TIMESTAMP' THEN 93 WHEN 'BLOB' THEN 2004 " // @G4A - + "WHEN 'CLOB' THEN 2005 WHEN 'DBCLOB' THEN 2005 " // @G4A - + "ELSE NULL END)"); - } - - select.append (" FROM QSYS2"); //@B2C @F2M - select.append (getCatalogSeparator ()); - select.append ("SYSTYPES " ); - - StringBuffer where = new StringBuffer (); - if (schemaPattern != null) - { - JDSearchPattern searchPattern = new JDSearchPattern (schemaPattern); - where.append (searchPattern.getSQLWhereClause ("USER_DEFINED_TYPE_SCHEMA")); // @B2C - } - if (typeNamePattern != null) - { - JDSearchPattern searchPattern = new JDSearchPattern (typeNamePattern); - if (where.length () > 0) - where.append (" AND "); - where.append (searchPattern.getSQLWhereClause ("USER_DEFINED_TYPE_NAME")); // @B2C - } - - if (where.length () > 0) - { - select.append (" WHERE "); - //@J4c JDK 1.4 added a StringBuffer.append(StringBuffer) method. Do a toString() - // here just in case we compile against 1.4 but run against 1.3. In that - // case we would get 'method not found' - select.append (where.toString()); - } - - select.append (" ORDER BY USER_DEFINED_TYPE_SCHEMA, USER_DEFINED_TYPE_NAME"); // @B2C - - // Run the query. - try - { - Statement statement = connection_.createStatement(); - ResultSet serverResultSet = statement.executeQuery (select.toString()); - JDRowCache serverRowCache = new JDSimpleRowCache (((AS400JDBCResultSet) serverResultSet).getRowCache ()); - statement.close (); - - // Set up the maps. - JDFieldMap[] maps = null; //@F2C - if (!isJDBC3) //@F2A - { - maps = new JDFieldMap[] { - new JDHardcodedFieldMap (connection_.getCatalog ()), // type catalog - new JDSimpleFieldMap (1), // type schema - new JDSimpleFieldMap (2), // type name - new JDClassNameFieldMap (3, settings_, connection_.getVRM(), connection_.getProperties()), // class name // @B3C // @M0C - new JDHardcodedFieldMap (new Integer (Types.DISTINCT)), // data type - new JDHandleNullFieldMap (4, ""), // remarks // @B3C - }; - } - else - { - maps = new JDFieldMap[] { - new JDHardcodedFieldMap (connection_.getCatalog ()), // type catalog - new JDSimpleFieldMap (1), // type schema - new JDSimpleFieldMap (2), // type name - new JDClassNameFieldMap (3, settings_, connection_.getVRM(), connection_.getProperties()), // class name // @B3C // @M0C - new JDHardcodedFieldMap (new Integer (Types.DISTINCT)), // data type - new JDHandleNullFieldMap (4, ""), // remarks // @B3C - new JDSimpleFieldMap (5) // base type // @G4A - }; - - } - - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - catch (SQLException e) - { - - // If the system does not have this table, then - // force an empty result set. This just means - // that UDTs are not supported (which is true - // for pre-V4R4 systems). - if (e.getErrorCode () == -204) - rowCache = new JDSimpleRowCache (formatRow); - else - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - } - - // Return the result set. - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), "UDTs", connection_, null); //@in2 - } - - - - /** - Returns the URL for this database. - - @return The URL for this database. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public String getURL () - throws SQLException - { - connection_.checkOpen (); - return connection_.getURL(); - } - - - - /** - Returns the current user name as known to the database. - - @return The current user name as known to the database. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public String getUserName () - throws SQLException - { - connection_.checkOpen (); - return connection_.getUserName(); - } - - - - /** - Returns a description of a table's columns that are automatically - updated when any value in a row is updated. - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schema The schema name. If null is specified, the - default SQL schema specified in the URL is used. - If null is specified and a default SQL schema was not - specified in the URL, the first library specified - in the libraries properties file is used. - If null is specified, a default SQL schema was - not specified in the URL, and a library was not - specified in the libraries properties file, - QGPL is used. - If empty string is specified, an empty result set will - be returned. - @param table The table name. If null or empty string is specified, - an empty result set is returned. - - @return The ResultSet containing the description of the - table's columns that are automatically updated - when any value in a row is updated. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getVersionColumns (String catalog, - String schema, - String table) - throws SQLException - { - DBReplyRequestedDS reply = null; - - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc3 - - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - - CallableStatement cs = connection_.prepareCall("CALL SYSIBM" + getCatalogSeparator() + "SQLSPECIALCOLUMNS(?,?,?,?, ?,?,?)"); - - cs.setShort(1, (short) SQL_ROWVER); - cs.setString(2, normalize(catalog)); - cs.setString(3, normalize(schema)); - cs.setString(4, normalize(table)); - cs.setShort(5, (short) 0); - cs.setShort(6, (short) 1); - cs.setString(7, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - //-------------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - String[] fieldNames = {"SCOPE", - "COLUMN_NAME", - "DATA_TYPE", - "TYPE_NAME", - "COLUMN_SIZE", - "BUFFER_LENGTH", - "DECIMAL_DIGITS", - "PSEUDO_COLUMN", - }; - - SQLData[] sqlData = { new SQLSmallint (vrm), // scope //@trunc3 - new SQLVarchar (128, settings_), // column name - new SQLSmallint (vrm), // data type //@trunc3 - new SQLVarchar (128, settings_), // type name - new SQLInteger (vrm), // column size //@trunc3 - new SQLInteger (vrm), // buffer length //@trunc3 - new SQLSmallint (vrm), // decimal digits //@trunc3 - new SQLSmallint (vrm), // pseudo column //@trunc3 - }; - - int[] fieldNullables = {columnNoNulls, // scope - columnNoNulls, // column name - columnNoNulls, // data type - columnNoNulls, // type name - columnNoNulls, // column size - columnNoNulls, // buffer length - columnNoNulls, // decimal digits - columnNoNulls, // pseudo column - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, - sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows - // that are readable one at a time. - - - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if (!isCatalogValid(catalog) || // catalog is empty string - - // schema is not null and is empty string - ((schema != null) && (schema.length()==0)) || - - // Table is null - (table==null) || - - // Table is empty string - (table.length()==0 )) - { // Return empty result set - rowCache = new JDSimpleRowCache (formatRow); - } - - else - { // parameter values are valid, build request & send - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_SPECIAL_COLUMN_INFO , - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - - - // Set the library name - if (schema == null) - { // use default SQL schema or qgpl - request.setLibraryName(normalize(connection_.getDefaultSchema()), connection_.converter_); // @E4C - } - else request.setLibraryName(normalize(schema), connection_.converter_); // @E4C - - // Set the table name - request.setFileName(normalize(table), connection_.converter_); // @E4C - - - // Set the Field Information to Return Bitmap - // Return library, table, and column - request.setSpecialColumnsReturnInfoBitmap(0x1F800000); //@rchg set 8th bit for row change timestamp column information - - - // Set the short / long file and field name indicator - request.setFileShortOrLongNameIndicator(0xF0); // Long - - // Set columns nullable indicator to allows nullable columns - request.setSpecialColumnsNullableIndicator(0xF1); - - - //-------------------------------------------------------- - // Send the request and cache all results from the system - //-------------------------------------------------------- - - reply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = reply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = reply.getReturnCode(); - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - // Get the data format and result data - DBDataFormat dataFormat = reply.getDataFormat(); - DBData resultData = reply.getResultData(); - if (resultData != null) - { - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - JDRowCache serverRowCache = new JDSimpleRowCache (new JDServerRowCache (row, connection_, id_, - 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - - // Create the mapped row format that is returned in the - // result set. - // This does not actual move the data, it just sets up - // the mapping. - JDFieldMap[] maps = new JDFieldMap[8]; - maps[0] = new JDHardcodedFieldMap (new Short ((short) 0)); // scope - maps[1] = new JDSimpleFieldMap (1); // column name - maps[2] = new JDDataTypeFieldMap (2, 3, 3, 5, 0, connection_.getVRM(), connection_.getProperties()); // @M0C // data type - converted to short //@KKB added 0 for ccsid since not given to us by host server - maps[3] = new JDSimpleFieldMap (2); // type name - maps[4] = new JDSimpleFieldMap (3); // column size (precision) - maps[5] = new JDSimpleFieldMap(4); // buffer length - maps[6] = new JDSimpleFieldMap (5); // decimal digits (scale) - maps[7] = new JDHardcodedFieldMap (new Short ((short) versionColumnNotPseudo)); - - // Create the mapped row cache that is returned in the - // result set - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - else - rowCache = new JDSimpleRowCache (formatRow); - - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } // End of else to build and send request - } // End of try block - - catch (DBDataStreamException e) - { - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - // Return the results - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "VersionColumns", connection_, reply); //@in2 - } - - - - // JDBC 2.0 - /** - Indicates if visible inserts to a result set of the specified type - can be detected by calling ResultSet.rowInserted(). - - @param resultSetType The result set type. Value values are: -
    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @return Always false. Inserts can not be detected - by calling ResultSet.rowInserted(). - - @exception SQLException If the result set type is not valid. - **/ - public boolean insertsAreDetected (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return false; - } - - - - /** - Indicates if a catalog appears at the start or the end of - a qualified name. - - @return Always true. A catalog appears at the start of a - qualified name. - - @exception SQLException This exception is never thrown. - **/ - public boolean isCatalogAtStart () - throws SQLException - { - return true; - } - - - - /** - Indicates if the specified catalog is valid for a query. - If false is returned, any query using that catalog will - be empty since the catalog does not refer to the current - connection's catalog. - - @param catalog The catalog name. "" for no catalog - or null to drop catalog from the - selection criteria. - @return true if catalog name is valid; false otherwise - - @exception SQLException This exception is never thrown. - **/ - private boolean isCatalogValid (String catalog) - throws SQLException - { - if (catalog == null) - return true; - - return(catalog.equalsIgnoreCase (connection_.getCatalog()) - || (catalog.equalsIgnoreCase ("localhost"))); - } - - - - /** - Indicates if the database is in read-only mode. - - @return true if in read-only mode; false otherwise. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public boolean isReadOnly () - throws SQLException - { - connection_.checkOpen (); - return connection_.isReadOnly (); - } - - - //@F3A - /** - Indicates if updateable LOB methods update a copy of the LOB or if updates - are made directly to the LOB. True is returned if updateable lob methods - update a copy of the LOB, false is returned if updates are made directly - to the LOB. - - @return Always true. Updateable lob methods update a copy of the LOB. - ResultSet.updateRow() must be called to update the LOB in the DB2 for IBM i database. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public boolean locatorsUpdateCopy () - throws SQLException - { - return true; - } - - - - // @E4A - // The database is not case-sensitive except when names are quoted with double - // quotes. The host server flows are case-sensitive, so I will uppercase - // everything to save the caller from having to do so. - private String normalize(String mixedCaseName) - { - if(mixedCaseName == null) //@mdsp - return null; //@mdsp - - if (mixedCaseName.length() > 2) - { - if (mixedCaseName.charAt(0) == '"') - return JDUtilities.stripOutDoubleEmbededQuotes(mixedCaseName); //@PDC mixedCaseName.substring(1, mixedCaseName.length() - 1); - } - return mixedCaseName.toUpperCase(); - } - - - - /** - Indicates if concatenations between null and non-null values - are null. - - - @return Always true. Concatenations between null and non-null - values are null. - - @exception SQLException This exception is never thrown. - **/ - public boolean nullPlusNonNullIsNull () - throws SQLException - { - return true; - } - - - - /** - Indicates if null values are sorted at the end regardless of sort - order. - - @return Always false. Null values are not sorted at the end - regardless of sort order. - - @exception SQLException This exception is never thrown. - **/ - public boolean nullsAreSortedAtEnd () - throws SQLException - { - return false; - } - - - - /** - Indicates if null values are sorted at the start regardless of sort - order. - - @return Always false. Null values are not sorted at the start - regardless of sort order. - - @exception SQLException This exception is never thrown. - **/ - public boolean nullsAreSortedAtStart () - throws SQLException - { - return false; - } - - - - /** - Indicates if null values are sorted high. - - @return Always true. Null values are sorted high. - - @exception SQLException This exception is never thrown. - **/ - public boolean nullsAreSortedHigh () - throws SQLException - { - return true; - } - - - - /** - Indicates if null values are sorted low. - - @return Always false. Null values are not sorted low. - - @exception SQLException This exception is never thrown. - **/ - public boolean nullsAreSortedLow () - throws SQLException - { - return false; - } - - - - // JDBC 2.0 - /** - Indicates if deletes made by others are visible. - - @param resultSetType The result set type. Value values are: -
    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @return true if deletes made by others - are visible; false otherwise. - - @exception SQLException If the result set type is not valid. - **/ - public boolean othersDeletesAreVisible (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return(resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE); - } - - - - // JDBC 2.0 - /** - Indicates if inserts made by others are visible. - - @param resultSetType The result set type. Value values are: -
    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @return true if inserts made by others - are visible; false otherwise. - - @exception SQLException If the result set type is not valid. - **/ - public boolean othersInsertsAreVisible (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return(resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE); - } - - - - // JDBC 2.0 - /** - Indicates if updates made by others are visible. - - @param resultSetType The result set type. Value values are: -
    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @return true if updates made by others - are visible; false otherwise. - - @exception SQLException If the result set type is not valid. - **/ - public boolean othersUpdatesAreVisible (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return(resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE); - } - - - - // JDBC 2.0 - /** - Indicates if a result set's own deletes are visible. - - @param resultSetType The result set type. Value values are: -
    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @return true if the result set's own deletes - are visible; false otherwise. - - @exception SQLException If the result set type is not valid. - **/ - public boolean ownDeletesAreVisible (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return(resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE); - } - - - - // JDBC 2.0 - /** - Indicates if a result set's own inserts are visible. - - @param resultSetType The result set type. Value values are: -
    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @return true if the result set's own inserts - are visible; false otherwise. - - @exception SQLException If the result set type is not valid. - **/ - public boolean ownInsertsAreVisible (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return(resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE); - } - - - - // JDBC 2.0 - /** - Indicates if a result set's own updates are visible. - - @param resultSetType The result set type. Value values are: -
    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @return true if the result set's own updates - are visible; false otherwise. - - @exception SQLException If the result set type is not valid. - **/ - public boolean ownUpdatesAreVisible (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return(resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE); - } - - - - /** - Indicates if the database treats mixed case, unquoted SQL identifiers - as case insensitive and stores them in lowercase. - - @return Always false. The database does not treat mixed case, - unquoted SQL identifiers as case insensitive and store - them in lowercase. - - @exception SQLException This exception is never thrown. - **/ - public boolean storesLowerCaseIdentifiers () - throws SQLException - { - return false; - } - - - - /** - Indicates if the database treats mixed case, quoted SQL identifiers - as case insensitive and stores them in lowercase. - - @return Always false. The database does not treat mixed case, quoted - SQL identifiers as case insensitive and store them in - lowercase. - - @exception SQLException This exception is never thrown. - */ - public boolean storesLowerCaseQuotedIdentifiers () - throws SQLException - { - return false; - } - - - - /** - Indicates if the database treats mixed case, unquoted SQL identifiers - as case insensitive and stores them in mixed case. - - @return Always false. The database does not treat mixed case, unquoted - SQL identifiers as case insensitive and store them in - mixed case. - - @exception SQLException This exception is never thrown. - **/ - public boolean storesMixedCaseIdentifiers () - throws SQLException - { - return false; - } - - - - /** - Indicates if the database treats mixed case, quoted SQL identifiers - as case insensitive and stores them in mixed case. - - @return Always false. The database does not treat mixed case, quoted - SQL identifiers as case insensitive and store them in - mixed case. - - @exception SQLException This exception is never thrown. - **/ - public boolean storesMixedCaseQuotedIdentifiers () - throws SQLException - { - // @A2C changed from false to true - return false; //@pdc match other drivers - } - - - - /** - Indicates if the database treats mixed case, unquoted SQL identifiers - as case insensitive and stores them in uppercase. - - @return Always true. The database does treat mixed case, unquoted - SQL identifiers as case insensitive and store them - in uppercase. - - @exception SQLException This exception is never thrown. - **/ - public boolean storesUpperCaseIdentifiers () - throws SQLException - { - return true; - } - - - - /** - Indicates if the database treats mixed case, quoted SQL identifiers - as case insensitive and stores them in uppercase. - - @return Always false. The database does not treat mixed case, quoted - SQL identifiers as case insensitive and store them - in uppercase. - - @exception SQLException This exception is never thrown. - **/ - public boolean storesUpperCaseQuotedIdentifiers () - throws SQLException - { - return false; - } - - - - /** - Indicates if ALTER TABLE with ADD COLUMN is supported. - - @return Always true. ALTER TABLE with ADD COLUMN is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsAlterTableWithAddColumn () - throws SQLException - { - // @A2C Changed from false to true - return true; - } - - - - /** - Indicates if ALTER TABLE with DROP COLUMN is supported. - - @return Always true. ALTER TABLE with DROP COLUMN is not supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsAlterTableWithDropColumn () - throws SQLException - { - // @A2C Changed from false to true - return true; - } - - - - /** - Indicates if the ANSI92 entry-level SQL grammar is supported. - - @return Always true. The ANSI92 entry-level SQL grammar is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsANSI92EntryLevelSQL () - throws SQLException - { - // ANSI92EntryLevelSQL is supported for V4R2 and beyond - // true is always returned since it is checked for compliance. - return true; - - } - - - - /** - Indicates if the ANSI92, full SQL grammar is supported. - - @return Always false. ANSI92, full SQL grammar is not supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsANSI92FullSQL () - throws SQLException - { - return false; - } - - - - /** - Indicates if the ANSI92 intermediate-level SQL grammar is supported. - - @return Always false. ANSI92 intermediate-level SQL grammar is not supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsANSI92IntermediateSQL () - throws SQLException - { - return false; - } - - - - // JDBC 2.0 - /** - Indicates if the batch updates are supported. - - @return Always true. Batch updates are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsBatchUpdates () - throws SQLException - { - return true; - } - - - - /** - Indicates if a catalog name can be used in a data manipulation - statement. - - @return Always false. A catalog name can not be used in a data manipulation - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsCatalogsInDataManipulation () - throws SQLException - { - // @A2 Changed from true to false. - return false; - } - - - - /** - Indicates if a catalog name can be used in an index definition - statement. - - @return Always false. A catalog name can not be used in an index definition - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsCatalogsInIndexDefinitions () - throws SQLException - { - // @A2C Changed from true to false - return false; - } - - - - /** - Indicates if a catalog name can be used in a privilege definition - statement. - - @return Always false. A catalog name can not be used in a privilege definition - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsCatalogsInPrivilegeDefinitions () - throws SQLException - { - // @A2C Changed from true to false - return false; - } - - - - /** - Indicates if a catalog name can be used in a procedure call - statement. - - @return Always false. A catalog name can not be used in a procedure call - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsCatalogsInProcedureCalls () - throws SQLException - { - // @A2C Changed from true to false - return false; - } - - - - /** - Indicates if a catalog name can be used in a table definition - statement. - - @return Always false. A catalog name can not be used in a table definition - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsCatalogsInTableDefinitions () - throws SQLException - { - // @A2C Changed from true to false - return false; - } - - - - /** - Indicates if column aliasing is supported. Column aliasing means - that the SQL AS clause can be used to provide names for - computed columns or to provide alias names for column - as required. - - @return Always true. Column aliasing is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsColumnAliasing () - throws SQLException - { - return true; - } - - - - /** - Indicates if the CONVERT function between SQL types is supported. - - @return true if the CONVERT function between SQL types is supported; - false otherwise. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsConvert () - throws SQLException - { - return JDEscapeClause.supportsConvert (); - } - - - - /** - Indicates if CONVERT between the given SQL types is supported. - - @param fromType The SQL type code defined in java.sql.Types. - @param toType The SQL type code defined in java.sql.Types. - @return true if CONVERT between the given SQL types is supported; - false otherwise. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsConvert (int fromType, int toType) - throws SQLException - { - return JDEscapeClause.supportsConvert (fromType, toType); - } - - - - /** - Indicates if the ODBC Core SQL grammar is supported. - - @return Always true. The ODBC Core SQL grammar is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsCoreSQLGrammar () - throws SQLException - { - return true; - } - - - - /** - Indicates if the correlated subqueries are supported. - - @return Always true. Correlated subqueries are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsCorrelatedSubqueries () - throws SQLException - { - return true; - } - - - - /** - Indicates if both data definition and data manipulation statements - are supported within a transaction. - - @return Always true. Data definition and data manipulation statements - are both supported within a transaction. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsDataDefinitionAndDataManipulationTransactions () - throws SQLException - { - return true; - } - - - - /** - Indicates if data manipulation statements are supported within a transaction. - - @return Always false. Data manipulation statements are not supported within - a transaction. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsDataManipulationTransactionsOnly () - throws SQLException - { - // @A2C Changed from true to false - return false; - } - - - - /** - Indicates if table correlation names are supported, and if so, are they - restricted to be different from the names of the tables. - - @return Always false. Table correlation names are not restricted - to be different from the names of the tables. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsDifferentTableCorrelationNames () - throws SQLException - { - return false; - } - - - - /** - Indicates if expressions in ORDER BY lists are supported. - - @return Always false. Expression in ORDER BY lists are not supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsExpressionsInOrderBy () - throws SQLException - { - return false; - } - - - - /** - Indicates if the ODBC Extended SQL grammar is supported. - - @return Always false. The ODBC Extended SQL grammar is not supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsExtendedSQLGrammar () - throws SQLException - { - return false; - } - - - - /** - Indicates if full nested outer joins are supported. - - @return Always false. Full nested outer joins are not supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsFullOuterJoins () - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm610) //@550 - return true; //@550 - else //@550 - return false; - } - - - - //@G4A - /** - Indicates if, after a statement is executed, auto-generated keys can be retrieved - using the method Statement.getGeneratedKeys(). - - @return True if the user is connecting to a system running OS/400 V5R2 - or IBM i, otherwise false. Auto-generated keys are supported - only if connecting to a system running OS/400 V5R2 or IBM i. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public boolean supportsGetGeneratedKeys () - throws SQLException - { - if (connection_.getVRM() >= JDUtilities.vrm520) - return true; - else - return false; - } - - - - /** - Indicates if some form of the GROUP BY clause is supported. - - @return Always true. Some form of GROUP BY clause is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsGroupBy () - throws SQLException - { - return true; - } - - - - /** - Indicates if a GROUP BY clause can add columns not in the SELECT - provided it specifies all of the columns in the SELECT. - - @return Always true. A GROUP BY clause can add columns not in the SELECT - provided it specifies all of the columns in the SELECT. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsGroupByBeyondSelect () - throws SQLException - { - return true; - } - - - - /** - Indicates if a GROUP BY clause can use columns not in the SELECT. - - @return Always true. A GROUP BY clause can use columns not in the SELECT. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsGroupByUnrelated () - throws SQLException - { - return true; - } - - - - /** - Indicates if the SQL Integrity Enhancement Facility is supported. - - @return Always false. The SQL Integrity Enhancement Facility is not - supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsIntegrityEnhancementFacility () - throws SQLException - { - return false; - } - - - - /** - Indicates if the escape character in LIKE clauses is supported. - - @return Always true. The escape character in LIKE clauses is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsLikeEscapeClause () - throws SQLException - { - return true; - } - - - - /** - Indicates if there is limited support for outer joins. - - @return Always true. There is limited support for outer joins. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsLimitedOuterJoins () - throws SQLException - { - return true; - } - - - - /** - Indicates if the ODBC Minimum SQL grammar is supported. - - @return Always true. The ODBC Minimum SQL grammar is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsMinimumSQLGrammar () - throws SQLException - { - return true; - } - - - - /** - Indicates if the database treats mixed case, unquoted SQL - identifiers as case sensitive and stores - them in mixed case. - - @return Always false. The database does not treat mixed case, - unquoted SQL identifiers as case sensitive and as - a result store them in mixed case. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsMixedCaseIdentifiers () - throws SQLException - { - return false; - } - - - - /** - Indicates if the database treats mixed case, quoted SQL - identifiers as case sensitive and as a result stores - them in mixed case. - - @return Always true. The database does treat mixed case, quoted SQL - identifiers as case sensitive and stores - them in mixed case. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsMixedCaseQuotedIdentifiers () - throws SQLException - { - return true; - } - - - - //@G4A - /** - Indicates if multiple result sets can be returned from a - CallableStatement simultaneously. - - @return Always false. Multiple open result sets from a single execute - are not supported by the Toolbox driver. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public boolean supportsMultipleOpenResults () - throws SQLException - { - return false; - } - - - - /** - Indicates if multiple result sets from a single execute are - supported. - - @return Always true. Multiple result sets from a single execute - are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsMultipleResultSets () - throws SQLException - { - return true; - } - - - - /** - Indicates if multiple transactions can be open at once (on - different connections). - - @return Always true. Multiple transactions can be open at - once on different connections. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsMultipleTransactions () - throws SQLException - { - return true; - } - - - - //@G4A - /** - Indicates if using parameter names to specify parameters on - callable statements are supported. - - @return Always true. An application can use parameter names - to specify parameters on callable statements. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public boolean supportsNamedParameters () - throws SQLException - { - return true; - } - - - - /** - Indicates if columns can be defined as non-nullable. - - @return Always true. Columns can be defined as non-nullable. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsNonNullableColumns () - throws SQLException - { - return true; - } - - - - /** - Indicates if cursors can remain open across commits. - - @return Always true. Cursors can remain open across commits. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsOpenCursorsAcrossCommit () - throws SQLException - { - return true; - } - - - - /** - Indicates if cursors can remain open across rollback. - - @return Always true. Cursors can remain open across rollback. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsOpenCursorsAcrossRollback () - throws SQLException - { - return true; - } - - - - /** - Indicates if statements can remain open across commits. - - @return Always true. Statements can remain open across commits. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsOpenStatementsAcrossCommit () - throws SQLException - { - return true; - } - - - - /** - Indicates if statements can remain open across rollback. - - @return Always true. Statements can remain open across rollback. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsOpenStatementsAcrossRollback () - throws SQLException - { - return true; - } - - - - /** - Indicates if an ORDER BY clause can use columns not in the SELECT. - - @return Always false. ORDER BY cannot use columns not in the SELECT. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsOrderByUnrelated () - throws SQLException - { - return false; - } - - - - /** - Indicates if some form of outer join is supported. - - @return Always true. Some form of outer join is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsOuterJoins () - throws SQLException - { - return true; - } - - - - /** - Indicates if positioned DELETE is supported. - - @return Always true. Positioned DELETE is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsPositionedDelete () - throws SQLException - { - return true; - } - - - - /** - Indicates if positioned UPDATE is supported. - - @return Always true. Positioned UPDATE is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsPositionedUpdate () - throws SQLException - { - return true; - } - - - - // JDBC 2.0 // @C0C - /** - Indicates if the specified result set concurrency is supported - for the specified result set type. - -

This chart describes the combinations of result set concurrency - and type that this driver supports: -

- - - - - -

CONCUR_READ_ONLYCONCUR_UPDATABLE
TYPE_FORWARD_ONLYYesYes
TYPE_SCROLL_INSENSITIVEYesNo
TYPE_SCROLL_SENSITIVEYesYes
-
- - @param resultSetType The result set type. Valid values are: -

    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @param resultSetConcurrency The result set concurrency. Valid values are: -
    -
  • ResultSet.CONCUR_READ_ONLY -
  • ResultSet.CONCUR_UPDATABLE -
- @return true if the specified result set - concurrency is supported for the specified - result set type; false otherwise. - - @exception SQLException If the result set type or result set - concurrency is not valid. - **/ - // - // Implementation note: - // - // The unsupported combinations are dictated by the DB2 - // cursor support. - // - public boolean supportsResultSetConcurrency (int resultSetType, int resultSetConcurrency) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - // Validate the result set concurrency. - if ((resultSetConcurrency != ResultSet.CONCUR_READ_ONLY) - && (resultSetConcurrency != ResultSet.CONCUR_UPDATABLE)) - JDError.throwSQLException (this, JDError.EXC_CONCURRENCY_INVALID); - - // Cases that we don't support. - //@K2D if (((resultSetConcurrency == ResultSet.CONCUR_READ_ONLY) - //@K2D && (resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE)) - //@K2D || ((resultSetConcurrency == ResultSet.CONCUR_UPDATABLE) - //@K2D && (resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE))) - if((resultSetConcurrency == ResultSet.CONCUR_UPDATABLE) //@K2A - && (resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE)) //@K2A - return false; - - // We support all other cases. - return true; - } - - - - //@G4A - /** - Indicates if a type of result set holdability is supported. The two - types are ResultSet.HOLD_CURSORS_OVER_COMMIT and ResultSet.CLOSE_CURSORS_AT_COMMIT. - - @return True if the user is connecting to a system running OS/400 - V5R2 or IBM i, otherwise false. Both types of result set - holidability are supported if connecting to OS/400 V5R2 or IBM i. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public boolean supportsResultSetHoldability (int resultSetHoldability) - throws SQLException - { - if (connection_.getVRM() >= JDUtilities.vrm520) - return true; - else - return false; - } - - - - //@G4A - /** - Indicates if savepoints are supported. - - @return True if the user is connecting to a system running - OS/400 V5R2 or IBM i, otherwise false. Savepoints are supported - only if connecting to OS/400 V5R2 or IBM i. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public boolean supportsSavepoints () - throws SQLException - { - // Note we check only the system level. We don't need to - // check JDBC/JDK level because if running prior to JDBC 3.0 - // the app cannot call this method (it does not exist - // in the interface). - if (connection_.getVRM() >= JDUtilities.vrm520) - return true; - else - return false; - } - - - - // JDBC 2.0 - /** - Indicates if the specified result set type is supported. - - @param resultSetType The result set type. Valid values are: -
    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @return true for ResultSet.TYPE_FORWARD_ONLY - ResultSet.TYPE_SCROLL_SENSITIVE. and - ResultSet.TYPE_SCROLL_INSENSITIVE. - - @exception SQLException If the result set type is not valid. - **/ - public boolean supportsResultSetType (int resultSetType) - throws SQLException - { - switch(resultSetType) - { - case ResultSet.TYPE_FORWARD_ONLY: - case ResultSet.TYPE_SCROLL_SENSITIVE: - case ResultSet.TYPE_SCROLL_INSENSITIVE: - return true; - default: - JDError.throwSQLException (this, JDError.EXC_CONCURRENCY_INVALID); - return false; - } - } - - - - /** - Indicates if a schema name can be used in a data manipulation - statement. - - @return Always true. A schema name can be used in a data - manipulation statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSchemasInDataManipulation () - throws SQLException - { - return true; - } - - - - /** - Indicates if a schema name can be used in an index definition - statement. - - @return Always true. A schema name can be used in an index definition - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSchemasInIndexDefinitions () - throws SQLException - { - return true; - } - - - - /** - Indicates if a schema name be can used in a privilege definition - statement. - - @return Always true. A schema name can be used in a privilege definition - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSchemasInPrivilegeDefinitions () - throws SQLException - { - return true; - } - - - - /** - Indicates if a schema name be can used in a procedure call - statement. - - @return Always true. A schema name can be used in a procedure call - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSchemasInProcedureCalls () - throws SQLException - { - return true; - } - - - - /** - Indicates if a schema name can be used in a table definition - statement. - - @return Always true. A schema name can be used in a table definition - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSchemasInTableDefinitions () - throws SQLException - { - return true; - } - - - - /** - Indicates if SELECT for UPDATE is supported. - - @return Always true. SELECT for UPDATE is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSelectForUpdate () - throws SQLException - { - return true; - } - - - - //@B0A - We don't support this directly. Use package caching instead. - /** - * Indicates if statement pooling is supported. - * @return Always false. Statement pooling is not supported at this time. - **/ - public boolean supportsStatementPooling() - { - return false; - } - - - /** - Indicates if stored procedure calls using the stored procedure - escape syntax are supported. - - @return Always true. Stored procedure calls using the stored - procedure escape syntax are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsStoredProcedures () - throws SQLException - { - return true; - } - - - - - /** - Indicates if subqueries in comparisons are supported. - - @return Always true. Subqueries in comparisons are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSubqueriesInComparisons () - throws SQLException - { - return true; - } - - - - /** - Indicates if subqueries in EXISTS expressions are supported. - - @return Always true. Subqueries in EXISTS expressions are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSubqueriesInExists () - throws SQLException - { - return true; - } - - - - /** - Indicates if subqueries in IN expressions are supported. - - @return Always true. Subqueries in IN expressions are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSubqueriesInIns () - throws SQLException - { - return true; - } - - - - /** - Indicates if subqueries in quantified expressions are supported. - - @return Always true. Subqueries in quantified expressions are - supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSubqueriesInQuantifieds () - throws SQLException - { - return true; - } - - - - /** - Indicates if table correlation names are supported. - - @return Always true. Table correlation names are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsTableCorrelationNames () - throws SQLException - { - return true; - } - - - - /** - Indicates if the database supports the given transaction - isolation level. - - @param transactionIsolationLevel One of the Connection.TRANSACTION_* - values. - @return Always true. All transaction isolation - levels are supported. - - @exception SQLException If the transaction isolation level is not valid. - **/ - public boolean supportsTransactionIsolationLevel (int transactionIsolationLevel) - throws SQLException - { - // Validate the transaction isolation level. - if ((transactionIsolationLevel != Connection.TRANSACTION_NONE) - && (transactionIsolationLevel != Connection.TRANSACTION_READ_UNCOMMITTED) - && (transactionIsolationLevel != Connection.TRANSACTION_READ_COMMITTED) - && (transactionIsolationLevel != Connection.TRANSACTION_REPEATABLE_READ) - && (transactionIsolationLevel != Connection.TRANSACTION_SERIALIZABLE)) - JDError.throwSQLException (this, JDError.EXC_CONCURRENCY_INVALID); - - if(transactionIsolationLevel == Connection.TRANSACTION_NONE) - { - return false; // we have determined that we do not support JDBC's idea of TRANSACTION_NONE - } - else - { - return true; - } - } - - - - /** - Indicates if transactions are supported. - - @return Always true. Transactions are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsTransactions () - throws SQLException - { - return true; - } - - - - /** - Indicates if SQL UNION is supported. - - @return Always true. SQL UNION is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsUnion () - throws SQLException - { - return true; - } - - - - /** - Indicates if SQL UNION ALL is supported. - - @return Always true. SQL UNION ALL is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsUnionAll () - throws SQLException - { - return true; - } - - - - /** - Returns the name of the catalog. - - @return The name of the catalog. - **/ - public String toString () - { - try - { - return connection_.getCatalog(); - } - catch (SQLException e) - { - return super.toString (); - } - } - - - - // JDBC 2.0 - /** - Indicates if visible updates to a result set of the specified type - can be detected by calling ResultSet.rowUpdated(). - - @param resultSetType The result set type. Value values are: -
    -
  • ResultSet.TYPE_FORWARD_ONLY -
  • ResultSet.TYPE_SCROLL_INSENSITIVE -
  • ResultSet.TYPE_SCROLL_SENSITIVE -
- @return Always false. Updates can not be detected - by calling ResultSet.rowUpdated(). - - @exception SQLException If the result set type is not valid. - **/ - public boolean updatesAreDetected (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return false; - } - - - - /** - Indicates if the database uses a file for each table. - - @return Always false. The database does not use a file for each - table. - - @exception SQLException This exception is never thrown. - **/ - public boolean usesLocalFilePerTable () - throws SQLException - { - return false; - } - - - - /** - Indicates if the database stores tables in a local file. - - @return Always false. The database does not store tables in a local - file. - - @exception SQLException This exception is never thrown. - **/ - public boolean usesLocalFiles () - throws SQLException - { - return false; - } - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCDatabaseMetaData", "java.sql.DatabaseMetaData" }; - } - - - //@PDA jdbc40 - /** - * Retrieves whether a SQLException thrown while autoCommit is true indicates - * that all open ResultSets are closed, even ones that are holdable. When a SQLException occurs while - * autocommit is true, it is vendor specific whether the JDBC driver responds with a commit operation, a - * rollback operation, or by doing neither a commit nor a rollback. A potential result of this difference - * is in whether or not holdable ResultSets are closed. - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean autoCommitFailureClosesAllResultSets() throws SQLException - { - return false; //toolbox returns false based on current behavoir - } - - //@PDA jdbc40 - /** - * Retrieves a list of the client info properties - * that the driver supports. The result set contains the following columns - *

- *

    - *
  1. NAME String=> The name of the client info property
    - *
  2. MAX_LEN int=> The maximum length of the value for the property
    - *
  3. DEFAULT_VALUE String=> The default value of the property
    - *
  4. DESCRIPTION String=> A description of the property. This will typically - * contain information as to where this property is - * stored in the database. - *
- *

- * The ResultSet is sorted by the NAME column in ascending order - *

- * @return A ResultSet object; each row is a supported client info - * property - *

- * @exception SQLException if a database access error occurs - *

- */ - public ResultSet getClientInfoProperties() throws SQLException - { - // Set up the result set. - int vrm = connection_.getVRM(); //@trunc3 - String[] fieldNames = { "NAME", "MAX_LEN", "DEFAULT_VALUE", "DESCRIPTION" }; - SQLData[] sqlData = { new SQLVarchar(32, settings_), new SQLInteger(vrm), new SQLVarchar(32, settings_), new SQLVarchar(1024, settings_) }; //trunc3 - int[] fieldNullables = {columnNoNulls, columnNoNulls, columnNoNulls, columnNoNulls}; // table types can not be null - - Object[][] data = { { "ApplicationName", new Integer(255), "", AS400JDBCDriver.getResource ("CLIENT_INFO_DESC_APPLICATIONNAME") }, - { "ClientUser", new Integer(255), "", AS400JDBCDriver.getResource ("CLIENT_INFO_DESC_CLIENTUSER")}, - { "ClientHostname", new Integer(255), "", AS400JDBCDriver.getResource ("CLIENT_INFO_DESC_CLIENTHOSTNAME")}, - { "ClientAccounting", new Integer(255), "", AS400JDBCDriver.getResource ("CLIENT_INFO_DESC_CLIENTACCOUNTING")}, - { "ClientProgramID", new Integer(255), "", AS400JDBCDriver.getResource ("CLIENT_INFO_DESC_CLIENTPROGRAMID")}}; //@pdc programID - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - JDSimpleRowCache rowCache = new JDSimpleRowCache(formatRow, data); - - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "Client Info", connection_, null); //@in2 - } - - - //@PDA jdbc40 - /** - * Indicates whether or not this data source supports the SQL ROWID type, - * and if so the lifetime for which a RowId object remains valid. - *

- * The returned int values have the following relationship: - *

-      *     ROWID_UNSUPPORTED < ROWID_VALID_OTHER < ROWID_VALID_TRANSACTION
-      *         < ROWID_VALID_SESSION < ROWID_VALID_FOREVER
-      * 
- * so conditional logic such as - *
-      *     if (metadata.getRowIdLifetime() > DatabaseMetaData.ROWID_VALID_TRANSACTION)
-      * 
- * can be used. Valid Forever means valid across all Sessions, and valid for - * a Session means valid across all its contained Transactions. - * - * @throws SQLException if a database access error occurs - */ -/* ifdef JDBC40 */ - public RowIdLifetime getRowIdLifetime() throws SQLException - { - return RowIdLifetime.ROWID_VALID_FOREVER; //toolbox rowid is forever - } -/* endif */ - - //@PDA jdbc40 - /** - * Retrieves the schema names available in this database. The results - * are ordered by schema name. - * - *

The schema column is: - *

    - *
  1. TABLE_SCHEM String => schema name - *
  2. TABLE_CATALOG String => catalog name (may be null) - *
- * - * - * @param catalog a catalog name; must match the catalog name as it is stored - * in the database;"" retrieves those without a catalog; null means catalog - * name should not be used to narrow down the search. - * @param schemaPattern a schema name; must match the schema name as it is - * stored in the database; null means - * schema name should not be used to narrow down the search. - * @return a ResultSet object in which each row is a - * schema decription - * @exception SQLException if a database access error occurs - * @see #getSearchStringEscape - */ - public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException - { - connection_.checkOpen(); - - CallableStatement cstmt = connection_.prepareCall("call SYSIBM" + getCatalogSeparator() + "SQLTABLES (?, ?, ?, ?, ?)"); - - cstmt.setString(1, normalize(catalog)); - cstmt.setString(2, normalize(schemaPattern)); - cstmt.setString(3, "%"); //@mdsp - cstmt.setString(4, "%"); //@mdsp - cstmt.setObject(5, "DATATYPE='JDBC';GETSCHEMAS=2;CURSORHOLD=1"); - cstmt.execute(); //@mdrs - ResultSet rs = cstmt.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cstmt.close(); //@mdrs2 - - return rs; //@mdrs - } - - - //@PDA jdbc40 - /** - * Retrieves whether this database supports invoking user-defined or vendor functions - * using the stored procedure escape syntax. - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException - { - // toolbox does not support this - return false; - } - - - //@PDA jdbc40 - /** - * Retrieves a description of the user functions available in the given - * catalog. - *

- * Only system and user function descriptions matching the schema and - * function name criteria are returned. They are ordered by - * FUNCTION_CAT, FUNCTION_SCHEM, - * FUNCTION_NAME and - * SPECIFIC_ NAME. - * - *

Each function description has the the following columns: - *

    - *
  1. FUNCTION_CAT String => function catalog (may be null) - *
  2. FUNCTION_SCHEM String => function schema (may be null) - *
  3. FUNCTION_NAME String => function name. This is the name - * used to invoke the function - *
  4. REMARKS String => explanatory comment on the function - *
  5. FUNCTION_TYPE short => kind of function: - *
      - *
    • functionResultUnknown - Cannot determine if a return value - * or table will be returned - *
    • functionNoTable- Does not return a table - *
    • functionReturnsTable - Returns a table - *
    - *
  6. SPECIFIC_NAME String => the name which uniquely identifies - * this function within its schema. This is a user specified, or DBMS - * generated, name that may be different then the FUNCTION_NAME - * for example with overload functions - *
- *

- * A user may not have permissions to execute any of the functions that are - * returned by getFunctions - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schemaPattern a schema name pattern; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param functionNamePattern a function name pattern; must match the - * function name as it is stored in the database - * @return ResultSet - each row is a function description - * @exception SQLException if a database access error occurs - * @see #getSearchStringEscape - */ - public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException - { - connection_.checkOpen(); - - // @A3 Not sure why this was not supported, since the stored procedure exists on V5R4 - // if(connection_.getVRM() < JDUtilities.vrm610) //@pda HSTSRVR support not PTFing support to v5r4 - // { - // JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - // return null; - //} - - /* - SYSIBM.SQLFunctions( - CatalogName varchar(128), - SchemaName varchar(128), - FunctionName varchar(128), - Options varchar(4000)) - */ - - CallableStatement cstmt = connection_.prepareCall("call SYSIBM" + getCatalogSeparator() + "SQLFUNCTIONS ( ?, ?, ?, ?)"); - - cstmt.setString(1, normalize(catalog)); - cstmt.setString(2, normalize(schemaPattern)); - cstmt.setString(3, normalize(functionNamePattern)); - cstmt.setObject(4, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); //@mdsp - cstmt.execute(); //@mdrs - ResultSet rs = cstmt.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cstmt.close(); //@mdrs2 - - return rs; //@mdrs - } - - - //@pda jdbc40 - /** - * Retrieves a description of the given catalog's system or user - * function parameters and return type. - * - *

Only descriptions matching the schema, function and - * parameter name criteria are returned. They are ordered by - * FUNCTION_CAT, FUNCTION_SCHEM, - * FUNCTION_NAME and - * SPECIFIC_ NAME. Within this, the return value, - * if any, is first. Next are the parameter descriptions in call - * order. The column descriptions follow in column number order. - * - *

Each row in the ResultSet - * is a parameter description, column description or - * return type description with the following fields: - *

    - *
  1. FUNCTION_CAT String => function catalog (may be null) - *
  2. FUNCTION_SCHEM String => function schema (may be null) - *
  3. FUNCTION_NAME String => function name. This is the name - * used to invoke the function - *
  4. COLUMN_NAME String => column/parameter name - *
  5. COLUMN_TYPE Short => kind of column/parameter: - *
      - *
    • functionColumnUnknown - nobody knows - *
    • functionColumnIn - IN parameter - *
    • functionColumnInOut - INOUT parameter - *
    • functionColumnOut - OUT parameter - *
    • functionColumnReturn - function return value - *
    • functionColumnResult - Indicates that the parameter or column - * is a column in the ResultSet - *
    - *
  6. DATA_TYPE int => SQL type from java.sql.Types - *
  7. TYPE_NAME String => SQL type name, for a UDT type the - * type name is fully qualified - *
  8. PRECISION int => precision - *
  9. LENGTH int => length in bytes of data - *
  10. SCALE short => scale - null is returned for data types where - * SCALE is not applicable. - *
  11. RADIX short => radix - *
  12. NULLABLE short => can it contain NULL. - *
      - *
    • functionNoNulls - does not allow NULL values - *
    • functionNullable - allows NULL values - *
    • functionNullableUnknown - nullability unknown - *
    - *
  13. REMARKS String => comment describing column/parameter - *
  14. CHAR_OCTET_LENGTH int => the maximum length of binary - * and character based parameters or columns. For any other datatype the returned value - * is a NULL - *
  15. ORDINAL_POSITION int => the ordinal position, starting - * from 1, for the input and output parameters. A value of 0 - * is returned if this row describes the function's return value. - * For result set columns, it is the - * ordinal position of the column in the result set starting from 1. - *
  16. IS_NULLABLE String => ISO rules are used to determine - * the nullability for a parameter or column. - *
      - *
    • YES --- if the parameter or column can include NULLs - *
    • NO --- if the parameter or column cannot include NULLs - *
    • empty string --- if the nullability for the - * parameter or column is unknown - *
    - *
  17. SPECIFIC_NAME String => the name which uniquely identifies - * this function within its schema. This is a user specified, or DBMS - * generated, name that may be different then the FUNCTION_NAME - * for example with overload functions - *
- * - *

The PRECISION column represents the specified column size for the given - * parameter or column. - * For numeric data, this is the maximum precision. For character data, this is the length in characters. - * For datetime datatypes, this is the length in characters of the String representation (assuming the - * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, - * this is the length in bytes. Null is returned for data types where the - * column size is not applicable. - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schemaPattern a schema name pattern; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param functionNamePattern a procedure name pattern; must match the - * function name as it is stored in the database - * @param columnNamePattern a parameter name pattern; must match the - * parameter or column name as it is stored in the database - * @return ResultSet - each row describes a - * user function parameter, column or return type - * - * @exception SQLException if a database access error occurs - * @see #getSearchStringEscape - */ - public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException - { - //@PDA add support to call stored procedure - connection_.checkOpen(); - - //@A3D Allow this to occur to V5R4 - // if(connection_.getVRM() < JDUtilities.vrm610) //@pda HSTSRVR support not PTFing support to v5r4 - // { - // JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - // return null; - // } - /* - SQLFunctionCols( - CatalogName varchar(128), - SchemaName varchar(128), - FuncName varchar(128), - ParamName varchar(128), - Options varchar(4000)) - */ - - CallableStatement cstmt = connection_.prepareCall("call SYSIBM" + getCatalogSeparator() + "SQLFUNCTIONCOLS ( ?, ?, ?, ?, ?)"); - - cstmt.setString(1, normalize(catalog)); - cstmt.setString(2, normalize(schemaPattern)); - cstmt.setString(3, normalize(functionNamePattern)); - cstmt.setString(4, normalize(columnNamePattern)); -/* ifdef JDBC40 */ - cstmt.setObject(5, "DATATYPE='JDBC';JDBCVER='4.0';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); //@mdsp //@ver -/* endif */ -/* ifndef JDBC40 - cstmt.setObject(5, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); //@mdsp - endif */ - cstmt.execute();//@mdrs - ResultSet rs = cstmt.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cstmt.close(); //@mdrs2 - - return rs; //@mdrs - } - - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCDriver.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCDriver.java deleted file mode 100644 index d26064477..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCDriver.java +++ /dev/null @@ -1,1469 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCDriver.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; // @B9A -import java.net.InetAddress; // @C2A -import java.sql.Connection; -import java.sql.Driver; -import java.sql.DriverManager; -import java.sql.DriverPropertyInfo; -import java.sql.SQLException; -import java.util.Properties; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - - - -/** -A JDBC 3.0/4.0 driver that accesses DB2 for IBM i databases. - -

To use this driver, the application or caller must register -the driver with the JDBC DriverManager. This class also registers -itself automatically when it is loaded. - -

After registering the driver, applications make connection -requests to the DriverManager, which dispatches them to the -appropriate driver. This driver accepts connection requests -for databases specified by the URLs that match the following syntax: - -

-jdbc:as400://system-name/default-schema;properties
-
- -

The driver uses the specified system name to connect -to a corresponding IBM i system. If a system name is not -specified, then the user will be prompted. - -

The default SQL schema is optional and the driver uses it to resolve -unqualified names in SQL statements. If no default SQL schema is set, then -the driver resolves unqualified names based on the naming convention -for the connection. If SQL naming is being used, and no default SQL schema -is set, then the driver resolves unqualified names using the schema with -the same name as the user. If system naming is being used, and no -default SQL schema is set, then the driver resolves unqualified names using -the server job's library list. See -JDBC properties -for more details on how to set the naming convention -and library list. - -

Several properties can optionally be set within the URL. They are -separated by semicolons and are in the form: -

-name1=value1;name2=value2;...
-
-See -JDBC properties -for a complete list of properties supported by this driver. - -

The following example URL specifies a connection to the -database on system mysystem.helloworld.com with -mylibrary as the default SQL schema. The connection will -use the system naming convention and return full error messages: -

-jdbc:as400://mysystem.helloworld.com/mylibrary;naming=system;errors=full
-
-**/ -// -// Implementation note: -// -// 1. A goal stated in the JDBC specification is to keep -// the Driver class as small and standalone as possible, -// so that it can be quickly loaded when choosing a -// driver for a particular database. -// -// 2. It was proposed that we also accept URLs with the -// "db2" subprotocol. This would make us consistent with -// other IBM drivers. In addition, it would also allow -// developers to hardcode URLs in programs and they would -// run as-is with both this driver and the "native" driver. -// -// We realized, though, that if running on a client with -// both this driver and another DB2 client for that platform, -// how do the drivers differentiate themselves? Therefore -// we are chosing NOT to recognized the "db2" subprotocol. -// Instead, suggest to developers to externalize the URL -// to users, rather than hardcoding it. -// - -// -// Toolbox driver change log -// -// Flag YYYYMMDD Reason -// ----- -------- --------------- -// @A1 20100406 Correct Syntax Error on Insert -// @A2 20100407 Update/Delete Blocking fix -// @A3 20100407 Allow DMD.getFunctions call on V5R4 -// @A4 20100415 Fix update counts for batched update -// @A5 20100430 Correct JDUtilities.streamToBytes -// @A6 20100503 maximum blocked input rows property / Free storage used by blocked updates. -// @A7 20100506 buffer synchronization / remove Class.forName() contention / gc tracing -// @A8 20100507 minimize buffer usage for blocked insert -// @A9 20100720 Fix AS400JDBCResultSetMetaData.isAutoIncrement() when extended metadata is off -// @AA 20100805 Fix AS400JDBCStatement.execute to return syntax error from database engine. -// @AB 20101108 Make sure locators are scoped to cursor when isolation level = *NONE -// -// @B1 20101203 Call Trace.logLoadPath when loading class, so trace indicated where driver was loaded from. -// Also trace JVM information. -// @B2 20101209 Fix Statement.setQueryTimeout -// @B3 20101209 Delay reading of input stream until execute -// @B4 20101215 Use NEW TABLE instead of FINAL table for autogenerated keys. -// @B5 20110105 Fix leaking DBStorage objects. -// @B6 20110114 Fix SQLResultSetTablePane -// @C1 20110119 Message File enhancement from David Gibbs -// @C2 20110121 CommandHelpRetriever fixes for empty help text. -// @C3 20110122 Make sure returnToPool is associated with nulling object. (Not Marked) -// @C4 20110217 Stored procedure scrollable cursor fixes. -// @C5 20110221 RLA Bidi Conversion -// @C6 20110224 Change JVM16 synchronization to not be default behavior -// @C7 20110303 Identify Generic Objects (replace with subclasses) -//-------------------------------------------------------------------- - - -public class AS400JDBCDriver -implements java.sql.Driver -{ - // Constants. - - static final int MAJOR_VERSION_ = Copyright.MAJOR_VERSION; - static final int MINOR_VERSION_ = Copyright.MINOR_VERSION; - static final String DATABASE_PRODUCT_NAME_ = "DB2 UDB for AS/400"; // @D0A - static final String DRIVER_NAME_ = "AS/400 Toolbox for Java JDBC Driver"; // @D0C @C5C @C6C - static final String DRIVER_LEVEL_ = Copyright.DRIVER_LEVEL; - -/* ifdef JDBC40 */ - public static final int JDBC_MAJOR_VERSION_ = 4; // JDBC spec version: 4.0 -/* endif */ -/* ifndef JDBC40 - public static final int JDBC_MAJOR_VERSION_ = 3; // JDBC spec version: 3.0 - endif */ - public static final int JDBC_MINOR_VERSION_ = 0; - - - // This string "9999:9999" is returned when resource - // bundle errors occur. No significance to this string, - // except that Client Access used to use it. It would - // probably be more helpful to return some other string. - // - private static final String MRI_NOT_FOUND_ = "9999:9999"; - - - - // Private data. - - // Toolbox resources needed in proxy jar file. @A1C - private static ResourceBundle resources_; - // Toolbox resources NOT needed in proxy jar file. @A1A - private static ResourceBundle resources2_; - - private static final String CLASSNAME = "com.ibm.as400.access.AS400JDBCDriver"; - - - /** - Static initializer. Registers the JDBC driver with the JDBC - driver manager and loads the appropriate resource bundle for - the current locale. - **/ - static { - try - { - // Log where the toolbox is loaded from @B1A - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - - DriverManager.registerDriver (new AS400JDBCDriver ()); - resources_ = ResourceBundle.getBundle ("com.ibm.as400.access.JDMRI"); - resources2_ = ResourceBundle.getBundle ("com.ibm.as400.access.JDMRI2"); - // Note: When using the proxy jar file, we do not expect to find JDMRI2. - } - catch (MissingResourceException e) - { - - // Catch the exception. This is because exceptions - // thrown from static initializers are hard to debug. - // Instead, we will handle the error when the - // driver needs to get at particular methods. - // See getResource(). - } - catch (SQLException e) - { - // Ignore. - } - } - - - - /** - Indicates if the driver understands how to connect - to the database named by the URL. - - @param url The URL for the database. - @return true if the driver understands how - to connect to the database; false - otherwise. - - @exception SQLException If an error occurs. - **/ - public boolean acceptsURL (String url) - throws SQLException - { - JDDataSourceURL dataSourceUrl = new JDDataSourceURL (url); - return dataSourceUrl.isValid (); - } - - - - /** - Connects to the database named by the specified URL. - There are many optional properties that can be specified. - Properties can be specified either as part of the URL or in - a java.util.Properties object. See -JDBC properties - for a complete list of properties - supported by this driver. - - @param url The URL for the database. - @param info The connection properties. - @return The connection to the database or null if - the driver does not understand how to connect - to the database. - - @exception SQLException If the driver is unable to make the connection. - **/ - public java.sql.Connection connect (String url, - Properties info) - throws SQLException - { - // Check first thing to see if the trace property is - // turned on. This way we can trace everything, including - // the important stuff like loading the properties. - JDDataSourceURL dataSourceUrl = new JDDataSourceURL (url); - Properties urlProperties = dataSourceUrl.getProperties (); - - // If trace property was set to true, turn on tracing. If trace property was set to false, - // turn off tracing. If trace property was not set, do not change. - if (JDProperties.isTraceSet (urlProperties, info) == JDProperties.TRACE_SET_ON) - { //@B5C - if (! JDTrace.isTraceOn ()) - JDTrace.setTraceOn (true); - } - else if (JDProperties.isTraceSet (urlProperties, info) == JDProperties.TRACE_SET_OFF) //@B5A - { - //@B5A - if (JDTrace.isTraceOn ()) //@B5A - JDTrace.setTraceOn (false); //@B5A - } //@B5A - //@B4D Deleted lines because trace should not be set off just because property - //@B4D not specified. - //@B4D else - //@B4D JDTrace.setTraceOn (false); - - // If toolbox trace is set to datastream. Turn on datastream tracing. - if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_DATASTREAM) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDatastreamOn(true); - } - // If toolbox trace is set to diagnostic. Turn on diagnostic tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_DIAGNOSTIC) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDiagnosticOn(true); - } - // If toolbox trace is set to error. Turn on error tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_ERROR) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceErrorOn(true); - } - // If toolbox trace is set to information. Turn on information tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_INFORMATION) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceInformationOn(true); - } - // If toolbox trace is set to warning. Turn on warning tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_WARNING) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceWarningOn(true); - } - // If toolbox trace is set to conversion. Turn on conversion tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_CONVERSION) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceConversionOn(true); - } - // If toolbox trace is set to proxy. Turn on proxy tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_PROXY) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceProxyOn(true); - } - // If toolbox trace is set to pcml. Turn on pcml tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_PCML) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTracePCMLOn(true); - } - // If toolbox trace is set to jdbc. Turn on jdbc tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_JDBC) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceJDBCOn(true); - } - // If toolbox trace is set to all. Turn on tracing for all categories. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_ALL) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceAllOn(true); - } - // If toolbox trace is set to thread. Turn on thread tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_THREAD) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceThreadOn(true); - } - // If toolbox trace is set to none. Turn off tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_NONE) - { - //@K1A - if (Trace.isTraceOn()) - { - Trace.setTraceOn(false); - } - } - - JDProperties jdProperties = new JDProperties (urlProperties, info); - - // Initialize the connection if the URL is valid. - Connection connection = null; //@A0C - if (dataSourceUrl.isValid ()) - connection = initializeConnection (dataSourceUrl, jdProperties, - info); //@A0C - - return connection; - } - - - //@B5A - /** - Connects to the database on the specified system. -

Note: Since this method is not defined in the JDBC Driver interface, - you typically need to create a Driver object in order - to call this method: -

-	AS400JDBCDriver d = new AS400JDBCDriver();
-	AS400 o = new AS400(myAS400, myUserId, myPwd);
-	Connection c = d.connect (o);
-	
- - - @param system The IBM i system to connect. - @return The connection to the database or null if - the driver does not understand how to connect - to the database. - - @exception SQLException If the driver is unable to make the connection. - **/ - public java.sql.Connection connect (AS400 system) - throws SQLException - { - if (system == null) - throw new NullPointerException("system"); - - if (system instanceof SecureAS400) - return initializeConnection(new SecureAS400(system)); - else - return initializeConnection(new AS400(system)); - - // Initialize the connection. - //@B7D Connection connection = null; - //@B7D connection = initializeConnection (o); - //@B7D return connection; - } - - //@KKB - /** - Connects to the database on the specified system. -

Note: Since this method is not defined in the JDBC Driver interface, - you typically need to create a Driver object in order - to call this method: -

-	AS400JDBCDriver d = new AS400JDBCDriver();
-	AS400 o = new AS400(myAS400, myUserId, myPwd);
-	Connection c = d.connect (o, false);
-	
- - - @param system The IBM i system to connect. - @param clone True if the AS400 object should be cloned, false otherwises - @return The connection to the database or null if - the driver does not understand how to connect - to the database. - - @exception SQLException If the driver is unable to make the connection. - **/ - public java.sql.Connection connect (AS400 system, boolean clone) - throws SQLException - { - if (system == null) - throw new NullPointerException("system"); - - if(!clone) //Do not clone the AS400 object, use the one passed in - return initializeConnection(system); - else //clone the AS400 object - return connect(system); - } - - - //@D4A - /** - Connects to the database on the specified system. -

Note: Since this method is not defined in the JDBC Driver interface, - you typically need to create a Driver object in order - to call this method: -

-	AS400JDBCDriver d = new AS400JDBCDriver();
-	AS400 o = new AS400(myAS400, myUserId, myPwd);
-        String mySchema = "defaultSchema";
-        Properties prop = new Properties();
-	Connection c = d.connect (o, prop, mySchema, false);
-	
- - - @param system The IBM i system to connect. - @param info The connection properties. - @param schema The default SQL schema or null meaning no default SQL schema specified. - @param clone True if the AS400 object should be cloned, false otherwises - @return The connection to the database or null if - the driver does not understand how to connect - to the database. - - @exception SQLException If the driver is unable to make the connection. - **/ - public java.sql.Connection connect (AS400 system, Properties info, String schema, boolean clone) - throws SQLException - { - if (system == null) - throw new NullPointerException("system"); - - if (info == null) - throw new NullPointerException("properties"); - - //@PDD not needed, just pass in null to isXTraceSet(null, info) below - //Properties urlProperties = new Properties(); - - // Check first thing to see if the trace property is - // turned on. This way we can trace everything, including - // the important stuff like loading the properties. - - // If trace property was set to true, turn on tracing. If trace property was set to false, - // turn off tracing. If trace property was not set, do not change. - if (JDProperties.isTraceSet (null, info) == JDProperties.TRACE_SET_ON) - { - if (! JDTrace.isTraceOn ()) - JDTrace.setTraceOn (true); - } - else if (JDProperties.isTraceSet (null, info) == JDProperties.TRACE_SET_OFF) - { - if (JDTrace.isTraceOn ()) - JDTrace.setTraceOn (false); - } - - // If toolbox trace is set to datastream. Turn on datastream tracing. - if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_DATASTREAM) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDatastreamOn(true); - } - // If toolbox trace is set to diagnostic. Turn on diagnostic tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_DIAGNOSTIC) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDiagnosticOn(true); - } - // If toolbox trace is set to error. Turn on error tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_ERROR) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceErrorOn(true); - } - // If toolbox trace is set to information. Turn on information tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_INFORMATION) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceInformationOn(true); - } - // If toolbox trace is set to warning. Turn on warning tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_WARNING) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceWarningOn(true); - } - // If toolbox trace is set to conversion. Turn on conversion tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_CONVERSION) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceConversionOn(true); - } - // If toolbox trace is set to proxy. Turn on proxy tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_PROXY) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceProxyOn(true); - } - // If toolbox trace is set to pcml. Turn on pcml tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_PCML) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTracePCMLOn(true); - } - // If toolbox trace is set to jdbc. Turn on jdbc tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_JDBC) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceJDBCOn(true); - } - // If toolbox trace is set to all. Turn on tracing for all categories. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_ALL) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceAllOn(true); - } - // If toolbox trace is set to thread. Turn on thread tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_THREAD) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceThreadOn(true); - } - // If toolbox trace is set to none. Turn off tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_NONE) - { - if (Trace.isTraceOn()) - { - Trace.setTraceOn(false); - } - } - - if(!clone) //Do not clone the AS400 object, use the one passed in - return initializeConnection(schema, info, system); - else //clone the AS400 object - { - if(system instanceof SecureAS400) - return initializeConnection(schema, info, new SecureAS400(system)); - else - return initializeConnection(schema, info, new AS400(system)); - } - } - - //@B5A - /** - Connects to the database on the specified system. - There are many optional properties that can be specified. - Properties can be specified in - a java.util.Properties object. See -JDBC properties - for a complete list of properties - supported by this driver. - -

Note: Since this method is not defined in the JDBC Driver interface, - you typically need to create a Driver object in order - to call this method: -

-	AS400JDBCDriver d = new AS400JDBCDriver();
-	String mySchema = "defaultSchema";
-	Properties p = new Properties();
-	AS400 o = new AS400(myAS400, myUserId, myPwd);
-	Connection c = d.connect (o, p, mySchema);
-	
- - @param system The IBM i system to connect. - @param info The connection properties. - @param schema The default SQL schema or null meaning no default SQL schema specified. - @return The connection to the database or null if - the driver does not understand how to connect - to the database. - - @exception SQLException If the driver is unable to make the connection. - **/ - public java.sql.Connection connect (AS400 system, Properties info, String schema) - throws SQLException - { - if (system == null) - throw new NullPointerException("system"); - - if (info == null) - throw new NullPointerException("properties"); - - //@B7D AS400 o = new AS400(system); - //@PDD not needed, just pass in null to isXTraceSet(null, info) below - //Properties urlProperties = new Properties(); - - // Check first thing to see if the trace property is - // turned on. This way we can trace everything, including - // the important stuff like loading the properties. - - // If trace property was set to true, turn on tracing. If trace property was set to false, - // turn off tracing. If trace property was not set, do not change. - if (JDProperties.isTraceSet (null, info) == JDProperties.TRACE_SET_ON) - { - if (! JDTrace.isTraceOn ()) - JDTrace.setTraceOn (true); - } - else if (JDProperties.isTraceSet (null, info) == JDProperties.TRACE_SET_OFF) - { - if (JDTrace.isTraceOn ()) - JDTrace.setTraceOn (false); - } - - // If toolbox trace is set to datastream. Turn on datastream tracing. - if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_DATASTREAM) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDatastreamOn(true); - } - // If toolbox trace is set to diagnostic. Turn on diagnostic tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_DIAGNOSTIC) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDiagnosticOn(true); - } - // If toolbox trace is set to error. Turn on error tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_ERROR) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceErrorOn(true); - } - // If toolbox trace is set to information. Turn on information tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_INFORMATION) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceInformationOn(true); - } - // If toolbox trace is set to warning. Turn on warning tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_WARNING) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceWarningOn(true); - } - // If toolbox trace is set to conversion. Turn on conversion tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_CONVERSION) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceConversionOn(true); - } - // If toolbox trace is set to proxy. Turn on proxy tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_PROXY) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceProxyOn(true); - } - // If toolbox trace is set to pcml. Turn on pcml tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_PCML) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTracePCMLOn(true); - } - // If toolbox trace is set to jdbc. Turn on jdbc tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_JDBC) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceJDBCOn(true); - } - // If toolbox trace is set to all. Turn on tracing for all categories. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_ALL) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceAllOn(true); - } - // If toolbox trace is set to thread. Turn on thread tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_THREAD) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceThreadOn(true); - } - // If toolbox trace is set to none. Turn off tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_NONE) - { - //@K1A - if (Trace.isTraceOn()) - { - Trace.setTraceOn(false); - } - } - - //@PDD not used JDProperties jdProperties = new JDProperties (null, info); - - if (system instanceof SecureAS400) - return initializeConnection(schema, info, new SecureAS400(system)); - else - return initializeConnection(schema, info, new AS400(system)); - // Initialize the connection if the URL is valid. - //@B7D Connection connection = null; - //@B7D connection = initializeConnection (schema, info, o); - - //@B7D return connection; - } - - - - - /** - Returns the driver's major version number. - - @return The major version number. - **/ - public int getMajorVersion () - { - return MAJOR_VERSION_; - } - - - - /** - Returns the driver's minor version number. - - @return The minor version number. - **/ - public int getMinorVersion () - { - return MINOR_VERSION_; - } - - - - /** - Returns an array of DriverPropertyInfo objects that - describe the properties that are supported by this - driver. - - @param url The URL for the database. - @param info The connection properties. - @return The descriptions of all possible properties or null if - the driver does not understand how to connect to the - database. - - @exception SQLException If an error occurs. - **/ - public DriverPropertyInfo[] getPropertyInfo (String url, - Properties info) - throws SQLException - { - JDDataSourceURL dataSourceUrl = new JDDataSourceURL (url); - - DriverPropertyInfo[] dpi = null; - if (dataSourceUrl.isValid ()) - { - JDProperties properties = new JDProperties (dataSourceUrl.getProperties(), info); - dpi = properties.getInfo (); - } - - return dpi; - } - - - - /** - Returns a resource from the resource bundle. - - @param key The resource key. - @return The resource String. - **/ - static String getResource (String key) - { - // If the resource bundle or resource is not found, - // do not thrown an exception. Instead, return a - // default string. This is because some JVMs will - // not recover quite right from such errors, and - // claim a security exception (e.g. Netscape starts - // looking in the client class path, which is - // not allowed.) - // - String resource; - if (resources_ == null) - resource = MRI_NOT_FOUND_; - else - { - try - { - resource = resources_.getString (key); - } - catch (MissingResourceException e) - { - if (resources2_ == null) //@A1A - resource = MRI_NOT_FOUND_; //@A1A - else - { //@A1A - try - { //@A1A - resource = resources2_.getString (key); //@A1A - } //@A1A - catch (MissingResourceException e1) - { //@A1A - JDTrace.logInformation (AS400JDBCDriver.class, - "Missing resource [" + key + "]"); //@A1A - resource = MRI_NOT_FOUND_; - } - } - } - } - - return resource; - } - - - - //@B3A - This logic was formerly in the initializeConnection() method. - static AS400 initializeAS400(JDDataSourceURL dataSourceUrl, - JDProperties jdProperties, - Properties info) - throws SQLException //@pw1 - { - // We must handle the different combinations of input - // user names and passwords. - String serverName = dataSourceUrl.getServerName(); - String userName = jdProperties.getString (JDProperties.USER); - String password = jdProperties.getString (JDProperties.PASSWORD); - String prompt = jdProperties.getString (JDProperties.PROMPT); // @B8C - boolean secure = jdProperties.getBoolean (JDProperties.SECURE); - String keyRingName = jdProperties.getString (JDProperties.KEY_RING_NAME); //@B9A - String keyRingPassword = jdProperties.getString (JDProperties.KEY_RING_PASSWORD); //@B9A - boolean useThreads = jdProperties.getBoolean(JDProperties.THREAD_USED); - - //@pw1 Decided to leave connections via AS400() as-is and just implement to mimic Native JDBC - //@pw1 info contains args from DriverMangager.getConnection(args) - //@pw1 jdProperties does not represent null values. Both null and "" have a value of "". - //@pw1 if info contains id/pass of "" then they must not be "" in jdProperties (allowing jdProperties to override) - //@pw1 throw exception if info id/pass == "" and change info id/pass to "" if they are null - //@pw3 Add way to get old behavior allowing "" (!but also need to allow new behavior of allowing null is/passwd so customers can slowly migrate) - //check if "". - - String secureCurrentUser = SystemProperties.getProperty (SystemProperties.JDBC_SECURE_CURRENT_USER); //@pw3 - boolean isSecureCurrentUser = true; //@pw3 - //if system property or jdbc property is set to false then secure current user code is not used - //null value for system property means not specified...so true by default - if(((secureCurrentUser != null) && (Boolean.valueOf(secureCurrentUser).booleanValue() == false)) || !jdProperties.getBoolean(JDProperties.SECURE_CURRENT_USER)) //@pw3 - isSecureCurrentUser = false; //@pw3 - - if(info == null) - info = new Properties(); - String userParm = info.getProperty("user"); //@pw1 - String passwordParm = info.getProperty("password"); //@pw1 - boolean forcePrompt = false; //@prompt - if ("".equals(userName) && "".equals(userParm)) //@pw1 //@pw2 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (AS400JDBCDriver.class, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 //@prompt - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - if ("".equals(password) && "".equals(passwordParm)) //@pw1 //@pw2 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (AS400JDBCDriver.class, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 //@prompt - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - - if(userParm != null) //@pw1 - { //@pw1 - //check for *current //@pw1 - if (userParm.compareToIgnoreCase("*CURRENT") == 0) //@pw1 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (AS400JDBCDriver.class, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - } //@pw1 - else //@pw1 - { //@pw1 - //since info is null, jdProperty must not be "" or *current, but it can be the default value (ie not set by user) - if(userName != JDProperties.EMPTY_) //@pw1 - { //@pw1 - //userName was updated by app - if( userName.equals("") || (userName.compareToIgnoreCase("*CURRENT") == 0)) //@pw1 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (AS400JDBCDriver.class, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - } //@pw1 - } //@pw1 - - if(passwordParm != null) //@pw1 - { //@pw1 - if (passwordParm.compareToIgnoreCase("*CURRENT") == 0) //@pw1 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (AS400JDBCDriver.class, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - } //@pw1 - else //@pw1 - { //@pw1 - //since info is null, jdProperty must not be "" or *current, but it can be the default value (ie not set by user) - if(password != JDProperties.EMPTY_) //@pw1 - { //@pw1 - //password was updated by app - if( password.equals("") || (password.compareToIgnoreCase("*CURRENT") == 0)) //@pw1 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (AS400JDBCDriver.class, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - } //@pw1 - } //@pw1 - - - // Create the AS400 object, so we can create a Connection via loadImpl2. - AS400 as400 = null; - if (secure) - { - if (serverName.length() == 0) - as400 = new SecureAS400 (); - else if (userName.length() == 0) - as400 = new SecureAS400 (serverName); - else if (password.length() == 0) - as400 = new SecureAS400 (serverName, userName); - else - as400 = new SecureAS400 (serverName, userName, password); - if (keyRingName != null && keyRingPassword != null && !keyRingName.equals("")) //@B9A @C1C - { - try - { //@B9A - ((SecureAS400)as400).setKeyRingName(keyRingName, keyRingPassword); //@B9A - } //@B9A - catch (PropertyVetoException pve) //@B9A - { /*Will never happen*/ - } //@B9A - } //@B9A - } - else - { - if (serverName.length() == 0) - as400 = new AS400 (); - else if (userName.length() == 0) - as400 = new AS400 (serverName); - else if (password.length() == 0) - as400 = new AS400 (serverName, userName); - else - as400 = new AS400 (serverName, userName, password); - } - - // Determine when the signon GUI can be presented.. - try - { - if (!prompt.equals(JDProperties.NOT_SPECIFIED)) // @B8A - as400.setGuiAvailable(jdProperties.getBoolean(JDProperties.PROMPT)); // @B8C - } - catch (java.beans.PropertyVetoException e) - { - // This will never happen, as there are no listeners. - } - - //Determine if threads should be used in communication with the host servers - try{ - if(!useThreads) - as400.setThreadUsed(useThreads); - } - catch(java.beans.PropertyVetoException e){ - } - if(forcePrompt) //@prompt - as400.forcePrompt(); //@prompt - return as400; - } - - - //@A0A - This logic was formerly in the AS400JDBCConnection ctor and open() method. - private Connection initializeConnection (JDDataSourceURL dataSourceUrl, - JDProperties jdProperties, - Properties info) - throws SQLException - { - //@B7D Connection connection = null; - AS400 as400 = null; - boolean proxyServerWasSpecifiedInUrl = false; - boolean proxyServerWasSpecifiedInProperties = false; - boolean proxyServerWasSpecified = false; - - //@C4A Check for native driver only if driver property is not set to Toolbox - String driverImplementation = jdProperties.getString(JDProperties.DRIVER); //@C4M - if (!driverImplementation.equals(JDProperties.DRIVER_TOOLBOX)) //@C4A - { //@C4A - // @B2A - // Determine whether the native driver is available. - Driver nativeDriver; - try - { - nativeDriver = (Driver)Class.forName("com.ibm.db2.jdbc.app.DB2Driver").newInstance(); - if (JDTrace.isTraceOn()) // @C2A - JDTrace.logInformation(this, "Native IBM Developer Kit for Java JDBC driver implementation was loaded"); // @C2A - } - catch (Throwable e) - { - nativeDriver = null; - } - - // @B2A - // Decide which JDBC driver implementation to use. If the - // native driver is available AND there is no secondary URL - // available AND the "driver" property was not set to "toolbox", - // then use the native driver implementation. - //@C4M String driverImplementation = jdProperties.getString(JDProperties.DRIVER); - if ((nativeDriver != null) - && (dataSourceUrl.getSecondaryURL().length() == 0)) - //@C4D Already checked above && (!driverImplementation.equals(JDProperties.DRIVER_TOOLBOX))) - { - //@C3M - boolean isLocal = false; // @C2A - String serverName = dataSourceUrl.getServerName(); // @C2A - if (serverName.length() == 0 || serverName.equalsIgnoreCase("localhost")) // @C2A //@locala - isLocal = true; // @C2A - else { // @C2A - try { // @C2A - InetAddress localInet = InetAddress.getLocalHost(); // @C2A - InetAddress[] remoteInet = InetAddress.getAllByName(serverName); // @C2A - for (int i = 0; i < remoteInet.length; ++i) { // @C2A - if (localInet.equals(remoteInet[i])) { // @C2A - isLocal = true; // @C2A - } // @C2A - } // @C2A - } // @C2A - catch (Throwable e) { // @C2A - // Ignore. We will just assume that we are not local. @C2A - } // @C2A - } - - if (isLocal) { // @C2A - if (JDTrace.isTraceOn()) // @C2A - JDTrace.logInformation(this, "Connection is local"); // @C2A - String nativeURL = dataSourceUrl.getNativeURL(); - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Using native IBM Developer Kit for Java JDBC driver implementation");//@native don't print passwd - return nativeDriver.connect(nativeURL, info); - } // @C2A - } - }//@C4A - // @C2D else - // @C2D { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Using IBM Toolbox for Java JDBC driver implementation"); - // @C2D } - - // @A0A - // See if a proxy server was specified. - //if (jdProperties.getIndex (JDProperties.PROXY_SERVER) != -1) //@A3D - if (jdProperties.getString(JDProperties.PROXY_SERVER).length() != 0) //@A3C - proxyServerWasSpecifiedInUrl = true; - if (SystemProperties.getProperty (SystemProperties.AS400_PROXY_SERVER) != null) - proxyServerWasSpecifiedInProperties = true; - if (proxyServerWasSpecifiedInUrl || proxyServerWasSpecifiedInProperties) - proxyServerWasSpecified = true; - - // If no proxy server was specified, and there is a secondary URL, - // simply pass the secondary URL to the DriverManager and ask it for - // an appropriate Connection object. - if (!proxyServerWasSpecified) - { - String secondaryUrl = dataSourceUrl.getSecondaryURL (); - if (secondaryUrl.length() != 0) - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, - "Secondary URL [" + secondaryUrl + "]"); - return DriverManager.getConnection (secondaryUrl, info); - } - } - - as400 = initializeAS400(dataSourceUrl, jdProperties, info); // @B3C - - if (proxyServerWasSpecifiedInUrl) - { - // A proxy server was specified in URL, - // so we need to inform the AS400 object. - - //boolean proxyServerSecure = jdProperties.getBoolean (JDProperties.PROXY_SERVER_SECURE); // TBD - String proxyServerNameAndPort = jdProperties.getString (JDProperties.PROXY_SERVER); - // Note: The PROXY_SERVER property is of the form: - // hostName[:portNumber] - // where portNumber is optional. - try - { - as400.setProxyServer (proxyServerNameAndPort); - //as400.setProxyServerSecure (proxyServerSecure); // TBD - } - catch (java.beans.PropertyVetoException e) - { - } // Will never happen. - } - - //@B6C Moved common code to prepareConnection. - return prepareConnection(as400, dataSourceUrl, info, jdProperties); - } - - - //@B5A - private Connection initializeConnection (AS400 as400) - throws SQLException - { - JDDataSourceURL dataSourceUrl = new JDDataSourceURL(null); - Properties info = new Properties(); - JDProperties jdProperties = new JDProperties(null, info); - - //@B6C Moved common code to prepareConnection. - return prepareConnection(as400, dataSourceUrl, info, jdProperties); - } - - - //@B5A - private Connection initializeConnection (String schema, Properties info, AS400 as400) - throws SQLException - { - boolean proxyServerWasSpecifiedInUrl = false; - - String url = null; - if (schema != null) //@B6A - url = "jdbc:as400://" + as400.getSystemName() + "/" + schema; - else //@B6A - url = "jdbc:as400://" + as400.getSystemName(); //@B6A - JDDataSourceURL dataSourceUrl = new JDDataSourceURL(url); - - JDProperties jdProperties = new JDProperties(null, info); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Using IBM Toolbox for Java JDBC driver implementation"); - - // See if a proxy server was specified. - if (jdProperties.getString(JDProperties.PROXY_SERVER).length() != 0) - proxyServerWasSpecifiedInUrl = true; - - if (proxyServerWasSpecifiedInUrl) - { - // A proxy server was specified in URL, so we need to inform the AS400 object. - - //boolean proxyServerSecure = jdProperties.getBoolean (JDProperties.PROXY_SERVER_SECURE);// TBD - String proxyServerNameAndPort = jdProperties.getString (JDProperties.PROXY_SERVER); - // Note: The PROXY_SERVER property is of the form: - // hostName[:portNumber] - // where portNumber is optional. - try - { - as400.setProxyServer (proxyServerNameAndPort); - //as400.setProxyServerSecure (proxyServerSecure); // TBD - } - catch (java.beans.PropertyVetoException e) - { - } // Will never happen. - } - - //@B6C Moved common code to prepareConnection. - return prepareConnection(as400, dataSourceUrl, info, jdProperties); - } - - - /** - Indicates if the driver is a genuine JDBC compliant driver. - - @return Always true. - **/ - public boolean jdbcCompliant () - { - return true; - } - - - //@B6A -- This logic was formerly in the initializeConnection() method. - private Connection prepareConnection(AS400 as400, JDDataSourceURL dataSourceUrl, - Properties info, JDProperties jdProperties) - throws SQLException - { - - // set socket properties - SocketProperties sockProps = null; - - //if == "", then take platform defaults...do not set - //only get/set properties is one is updated - if( jdProperties.getString(JDProperties.KEEP_ALIVE).equals("") == false) - { - if(sockProps == null) - sockProps = as400.getSocketProperties(); - sockProps.setKeepAlive(jdProperties.getBoolean(JDProperties.KEEP_ALIVE)); - } - if( jdProperties.getString(JDProperties.RECEIVE_BUFFER_SIZE).equals("") == false) - { - if(sockProps == null) - sockProps = as400.getSocketProperties(); - sockProps.setReceiveBufferSize( jdProperties.getInt(JDProperties.RECEIVE_BUFFER_SIZE)); - } - if( jdProperties.getString(JDProperties.SEND_BUFFER_SIZE).equals("") == false) - { - if(sockProps == null) - sockProps = as400.getSocketProperties(); - sockProps.setSendBufferSize(jdProperties.getInt(JDProperties.SEND_BUFFER_SIZE)); - } - - //@timeout2 - //First get setting from DriverManager, then override with property updates - if(!as400.arePropertiesFrozen()) //@timeout3 AS400JDBCDriver.connect(clone=false) cannot update props. We don't know if DriverManager.setLoginTimeout() has been updated. - { - if(sockProps == null) - sockProps = as400.getSocketProperties(); - sockProps.setLoginTimeout(DriverManager.getLoginTimeout() * 1000); //@STIMEOUT - } - - //@timeout - if( jdProperties.getString(JDProperties.LOGIN_TIMEOUT).equals("") == false) - { - if(sockProps == null) - sockProps = as400.getSocketProperties(); - sockProps.setLoginTimeout(jdProperties.getInt(JDProperties.LOGIN_TIMEOUT) * 1000); //@STIMEOUT - } - - //@STIMEOUT - if( jdProperties.getString(JDProperties.SOCKET_TIMEOUT).equals("") == false) - { - if(sockProps == null) - sockProps = as400.getSocketProperties(); - sockProps.setSoTimeout(jdProperties.getInt(JDProperties.SOCKET_TIMEOUT)); //@STIMEOUT already in milliseconds - } - - - if(sockProps != null) - as400.setSocketProperties(sockProps); - - // Create the appropriate kind of Connection object. - Connection connection = (Connection) as400.loadImpl2 ( - "com.ibm.as400.access.AS400JDBCConnection", - "com.ibm.as400.access.JDConnectionProxy"); - - // Set the properties on the Connection object. - if (connection != null) - { - - // @A2D Class[] argClasses = new Class[] { JDDataSourceURL.class, - // @A2D JDProperties.class, - // @A2D AS400.class }; - // @A2D Object[] argValues = new Object[] { dataSourceUrl, - // @A2D jdProperties, - // @A2D as400 }; - // @A2D try { - // Hand off the public AS400 object to keep it from getting - // garbage-collected. - Class clazz = connection.getClass (); - // @A2D Method method = clazz.getDeclaredMethod ("setSystem", - // @A2D new Class[] { AS400.class }); - // @A2D method.invoke (connection, new Object[] { as400 }); - - // @A2D method = clazz.getDeclaredMethod ("setProperties", argClasses); - // @A2D method.invoke (connection, argValues); - - String className = clazz.getName(); - if (className.equals("com.ibm.as400.access.AS400JDBCConnection")) - { - ((AS400JDBCConnection)connection).setSystem(as400); - ((AS400JDBCConnection)connection).setProperties(dataSourceUrl, jdProperties, as400); - } - else if (className.equals("com.ibm.as400.access.JDConnectionProxy")) - { - ((JDConnectionProxy)connection).setSystem(as400); - ((JDConnectionProxy)connection).setProperties(dataSourceUrl, jdProperties, as400); - } - // @A2D } - // @A2D catch (NoSuchMethodException e) { - // @A2D JDTrace.logInformation (this, - // @A2D "Could not resolve setProperties() method"); - // @A2D throw new InternalErrorException (InternalErrorException.UNEXPECTED_EXCEPTION); - // @A2D } - // @A2D catch (IllegalAccessException e) { - // @A2D JDTrace.logInformation (this, - // @A2D "Could not access setProperties() method"); - // @A2D throw new InternalErrorException (InternalErrorException.UNEXPECTED_EXCEPTION); - // @A2D } - // @A2D catch (InvocationTargetException e) { - // @A2D Throwable e2 = e.getTargetException (); - // @A2D if (e2 instanceof SQLException) - // @A2D throw (SQLException) e2; - // @A2D else if (e2 instanceof RuntimeException) - // @A2D throw (RuntimeException) e2; - // @A2D else if (e2 instanceof Error) - // @A2D throw (Error) e2; - // @A2D else { - // @A2D JDTrace.logInformation (this, - // @A2D "Could not invoke setProperties() method"); - // @A2D throw new InternalErrorException (InternalErrorException.UNEXPECTED_EXCEPTION); - // @A2D } - // @A2D } - } - return connection; - } - - - - - /** - Returns the name of the driver. - - @return The driver name. - **/ - public String toString () - { - return DRIVER_NAME_; // @D0C - } - - - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCInputStream.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCInputStream.java deleted file mode 100644 index 6989267f7..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCInputStream.java +++ /dev/null @@ -1,357 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCInputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.IOException; -/* ifdef JDBC40 */ -import java.sql.DriverManager; -/* endif */ -import java.sql.SQLException; - - - -/** -

The AS400JDBCInputStream class provides access to binary data -using an input stream. The data is valid only within the current -transaction. -**/ -// -// Implementation notes: -// -// 1. This implementation deals specifically with binary data -// that is retrieved upon request with the locator handle. -// The case where the binary data comes in full with the result -// set can be stored directly in a ByteArrayInputStream. -// -// 2. We do not worry about buffering or caching, since the caller -// can just wrap this in a BufferedInputStream if they want that. -// -class AS400JDBCInputStream extends InputStream -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - private boolean closed_; - private JDLobLocator locator_; - private long offset_; - private long length_; //@pda jdbc40 - - private long mark_ = 0; - -/** -Constructs an AS400JDBCInputStream object. The data for the -binary stream will be retrieved as requested, directly from the -system, using the locator handle. - -@param locator The locator. -**/ - AS400JDBCInputStream(JDLobLocator locator) - { - locator_ = locator; - offset_ = 0; - closed_ = false; - try //@pda jdbc40 set length (for sub-streams) - { - length_ = locator.getLength(); - }catch(SQLException e) - { - length_ = 0; - closed_ = true; - } - - } - - //@pda jdbc40 new constructor - /** - Constructs an AS400JDBCInputStream object. The data for the - binary stream will be retrieved as requested, directly from the - system, using the locator handle. - - @param locator The locator. - @param pos The starting position. - @param length The length of the stream. - **/ - AS400JDBCInputStream(JDLobLocator locator, long pos, long length) - { - locator_ = locator; - offset_ = pos; - length_ = length; - closed_ = false; - long actualLen; - try - { - actualLen = locator.getLength(); - - }catch(SQLException e) - { - actualLen = 0; - closed_ = true; - } - if(length_ > actualLen) - length_ = actualLen; - } - -/** -Returns the number of bytes that can be read without blocking. - -@return The number of bytes that can be read without blocking. - -@exception IOException If an input/output error occurs. -**/ - public synchronized int available() throws IOException - { - if (closed_) throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - - long returnValue = 0; - // try //@PDd jdbc40 - // { //@PDd jdbc40 - returnValue = length_ - offset_; //@PDC jdbc40 - - if (returnValue < 0) returnValue = 0; - // } //@PDd jdbc40 - // catch (SQLException e) //@PDd jdbc40 - // { //@PDd jdbc40 - // if (JDTrace.isTraceOn()) //@PDd jdbc40 - // { //@PDd jdbc40 - // JDTrace.logInformation(this, "Error in available"); //@PDd jdbc40 - // e.printStackTrace(DriverManager.getLogStream()); //@PDd jdbc40 - // closed_ = true; //@PDd jdbc40 - // } //@PDd jdbc40 - // throw new IOException(e.getMessage()); //@PDd jdbc40 - // } //@PDd jdbc40 - - if (returnValue > 0x7FFFFFFF) returnValue = 0x7FFFFFFF; - - return(int)returnValue; - } - - - -/** -Closes the stream and releases any associated system resources. - -@exception IOException If an input/output error occurs. -**/ - public synchronized void close() throws IOException - { - closed_ = true; - } - - - -/** -Marks the current position in the stream. - -@param readLimit The read limit. -@see #reset() -**/ - public void mark(int readLimit) - { - mark_ = offset_; - } - - - -/** -Indicates if mark() and reset() are supported. - -@return true -**/ - public boolean markSupported() - { - return true; - } - - - -/** -Reads the next byte of data. This method blocks until data is -available, the end of the stream is detected, or an exception -is thrown. - -@return The next byte of data as an int in the range 0 to 255, - or -1 if no more data is available. - -@exception IOException If an input/output error occurs. -**/ - public synchronized int read() throws IOException - { - int returnValue = -1; - - byte[] data = new byte[1]; // Yes, we allocate each time, but the user shouldn't be calling this method if they want performance to be good. - if (read(data, 0, 1) > 0) returnValue = data[0] & 0x00FF; - - return returnValue; - } - - - -/** -Reads bytes of data. This method blocks until -data is available, the end of the stream is detected, or an -exception is thrown. - -@param data The byte array to fill with data. This method - will read as much data as possible to fill - the array. -@return The number of bytes of data read, - or -1 if no more data is available. - -@exception IOException If an input/output error occurs. -**/ - public synchronized int read(byte[] data) throws IOException - { - return read(data, 0, data.length); - } - - - -/** -Reads bytes of data. This method blocks until -data is available, the end of the stream is detected, or an -exception is thrown. - -@param data The byte array to fill with data. This method - will read as much data as possible to fill - the array. All data may not be available to - read from the stream at once, only when this - method returns -1 can you be sure all of the - data was read. -@param start The start position in the array. -@param length The maximum number of bytes to read. -@return The number of bytes of data read, - or -1 if no more data is available. - -@exception IOException If an input/output error occurs. -**/ - public synchronized int read(byte[] data, int start, int length) throws IOException - { - if (data == null) throw new NullPointerException("data"); - - if (closed_) throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - - if ((start < 0) || (start > data.length)) - { - throw new ExtendedIllegalArgumentException("start", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if ((length < 0) || (start + length > data.length))//@pdc locator_.retrieveData(,len) does not fail if len is greater that available length - { - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Added this to prevent trying to read past the end of the stream. - if (length == 0) - { - return 0; - } - - try - { - if (offset_ >= length_) //@PDC jdbc40 - { - //@CRS - Is this really the end? Or is the end getMaxLength()? - return -1; - } - - //@CRS: Can lengthRead ever be greater than length? - if (locator_.isGraphic()) length = length / 2; - DBLobData lobData = locator_.retrieveData(offset_, length); - int lengthRead = lobData.getLength(); - if (lengthRead == 0) - { - closed_ = true; - return -1; - } - else - { - System.arraycopy(lobData.getRawBytes(), lobData.getOffset(), data, start, lengthRead); - offset_ += locator_.isGraphic() ? lengthRead / 2: lengthRead; - return lengthRead; - } - } - catch (SQLException e) - { - if (JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "Error in read" + e.getMessage()); //@pdc - //@pdd e.printStackTrace(DriverManager.getLogStream()); - closed_ = true; - } - throw new IOException(e.getMessage()); - } - } - - - -/** -Repositions to the marked position. -If mark() has not been called, repositions to the beginning of the stream. - -@exception IOException If an input/output error occurs. -@see #mark(int) -**/ - public void reset() throws IOException - { - offset_ = mark_; - } - - -/** -Skips over and discards data. - -@param length The maximum number of bytes to skip. If negative, - no bytes are skipped. -@return The number of bytes skipped. - -@exception IOException If an input/output error occurs. -**/ - public synchronized long skip(long length) throws IOException - { - if (closed_) - { - throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - } - if (length < 0) - { - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (length == 0) return 0; - //try //@PDD jdbc40 - //{ //@PDD jdbc40 - long newOffset = length + offset_; - long len = length_; //@PDC jdbc40 - - if (newOffset > len) - { - length = len - offset_; - offset_ = len; - } - else - { - offset_ = offset_ + length; - } - return length; - //} //@PDD jdbc40 - //catch (SQLException e) //@PDD jdbc40 - //{ //@PDD jdbc40 - // if (JDTrace.isTraceOn()) //@PDD jdbc40 - // { //@PDD jdbc40 - // JDTrace.logInformation(this, "Error in skip"); //@PDD jdbc40 - // e.printStackTrace(DriverManager.getLogStream()); //@PDD jdbc40 - // } //@PDD jdbc40 - // closed_ = true; //@PDD jdbc40 - // throw new IOException(e.getMessage()); //@PDD jdbc40 - //} //@PDD jdbc40 - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCManagedDataSource.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCManagedDataSource.java deleted file mode 100644 index 6a553186b..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCManagedDataSource.java +++ /dev/null @@ -1,4643 +0,0 @@ -// TBD - Cross-link with corresponding non-managed class. -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCManagedDataSource.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2005-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.PrintWriter; -import java.io.Serializable; -import java.sql.Connection; -import java.sql.DriverPropertyInfo; -import java.sql.SQLException; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.Properties; -import java.util.Random; -import javax.sql.DataSource; -import javax.naming.NamingException; -import javax.naming.Reference; -import javax.naming.Referenceable; -import javax.naming.StringRefAddr; -import javax.naming.InitialContext; -import javax.naming.Context; - -// Note that there is no inheritance/extension relationship between DataSource and ConnectionPoolDataSource. Applications code to DataSource, whereas ConnectionPoolDataSource is used internally by application servers, etc. - -// Note: We currently have no requirement to provide a managed pooling implementation of javax.sql.XADataSource. - -/** - This implementation of javax.sql.DataSource can be used to produce Connection objects that will automatically participate in connection pooling, and are managed by the Toolbox's built-in connection pooling manager. - -

- A DataSource is a factory for connections to the physical data source that this DataSource object represents. - An alternative to the DriverManager facility, a DataSource object is the preferred means of getting a connection. - An object that implements the DataSource interface will typically be registered with a naming service based on the - Java Naming and Directory (JNDI) API. -

- A DataSource object has properties that can be modified when necessary. For example, if the data source is moved to a - different system, the property for the system can be changed. The benefit is that because the data source's properties - can be changed, any code accessing that data source does not need to be changed. -

- A driver that is accessed via a DataSource object does not register itself with the DriverManager. Rather, a DataSource o - bject is retrieved though a lookup operation and then used to create a Connection object. With a basic implementation, - the connection obtained through a DataSource object is identical to a connection obtained through the DriverManager facility. -

- Caution: To avoid the pitfalls of "double-managed" pools, do not use this class in conjunction with a separate - connection pool manager, such as that available in WebSphere. When a separate pool manager is provided, - use {@link AS400JDBCDataSource AS400JDBCDataSource} instead. - - @see AS400JDBCManagedConnectionPoolDataSource - @see AS400JDBCDataSource - @see AS400JDBCConnectionPoolDataSource - @see AS400JDBCXADataSource - **/ -public class AS400JDBCManagedDataSource -/* ifdef JDBC40 */ -extends ToolboxWrapper -/* endif */ - -implements DataSource, Referenceable, Serializable, Cloneable //@PDC 550 -{ - private static final long serialVersionUID = 1L; -static final String copyright = "Copyright (C) 2005-2010 International Business Machines Corporation and others."; - private static final boolean DEBUG = false; - - - /** - Implementation notes: - The properties listed in com.ibm.as400.access.JDProperties should also be included here. - **/ - - // Note: - // There are three kinds of data sources: - // 1. Basic DataSource (javax.sql.DataSource). Provides a getConnection() method that returns an instance of java.sql.Connection. - // 2. Data source class implemented to provide connection pooling (javax.sql.ConnectionPoolDataSource). Provides a getPooledConnection() method that returns an instance of javax.sql.PooledConnection. - // 3. Data Source class implemented to provide distributed transactions (javax.sql.XADataSource). Provides a getXAConnection() method that returns an instance of javax.sql.XAConnection. - - // Constants - private static final String DATASOURCE_NAME = "dataSourceName"; - private static final String DESCRIPTION = "description"; - private static final String SERVER_NAME = "serverName"; - private static final String USER = "user"; // same as JDProperties.USER_ - private static final String KEY_RING_NAME = "key ring name"; // same as JDProperties.KEY_RING_NAME_ - private static final String PASSWORD = "pw"; // same as JDProperties.PASSWORD_ - private static final String KEY_RING_PASSWORD = "key ring password"; // same as JDProperties.KEY_RING_PASSWORD_ - private static final String SECURE = "secure"; // same as JDProperties.SECURE_ - private static final String SAVE_PASSWORD = "savepw"; - private static final String PLAIN_TEXT_PASSWORD = "pwd"; - private static final String TRUE_ = "true"; - private static final String FALSE_ = "false"; - private static final String TOOLBOX_DRIVER = "jdbc:as400:"; - private static final int MAX_THRESHOLD = 16777216; // Maximum threshold (bytes). - - // socket options to store away in JNDI - private static final String SOCKET_KEEP_ALIVE = "soKeepAlive"; - // JDProperties: "keep alive" - private static final String SOCKET_RECEIVE_BUFFER_SIZE = "soReceiveBufferSize"; - // JDProperties: "receive buffer size" - private static final String SOCKET_SEND_BUFFER_SIZE = "soSendBufferSize"; - // JDProperties: "send buffer size" - private static final String SOCKET_LINGER = "soLinger"; - private static final String SOCKET_TIMEOUT = "soTimeout"; - private static final String SOCKET_TCP_NO_DELAY = "soTCPNoDelay"; - - // Standard data source properties. (See JDBC Tutorial p. 567, table 16.1) - - transient private AS400 as400_; // Object used to store and encrypt the password. - private String dataSourceName_; // Data source name. - private String description_; // Data source description. - // Note: A "networkProtocol" property is not provided. The Toolbox JDBC driver uses only 1 protocol, specified in the JDProperties. - // Note: For security, password value is stored in serialPWBytes_, and no getPassword() method is provided. - private char[] serialPWBytes_; - private int pwHashcode_; // hashed password - // Note: A "portNumber" property is not provided. It is specified in the JDProperties. - // Note: A "roleName" property is not provided. - private String serialServerName_; // system name used in serialization. - private String serialUserName_; // User name used in serialization. - - // Additional properties. - - private String serialKeyRingName_; // Key ring name used in serialization. - private boolean isSecure_; - private char[] serialKeyRingPWBytes_; - private boolean savePasswordWhenSerialized_; // By default, don't save password!!!! - private JDProperties properties_ = new JDProperties(); // system connection properties. - private SocketProperties sockProps_ = new SocketProperties(); // socket properties - - // Internal utility fields. - - transient private PrintWriter writer_; // The EventLog print writer. - transient EventLog log_; - - transient private AS400JDBCManagedConnectionPoolDataSource cpds_; - - // Handles loading the appropriate resource bundle - // private static ResourceBundleLoader loader_; - - private boolean dataSourceNameSpecified_; - transient private JDConnectionPoolManager poolManager_; - transient private boolean poolManagerInitialized_; - - transient private JDConnectionPoolKey defaultConnectionPoolKey_; - transient private boolean connectionKeyNeedsUpdate_ = true; - - transient private boolean inUse_; - - /** - * The maximum storage space that can be used to execute a query. - **/ - public static final int MAX_STORAGE_LIMIT = AS400JDBCDataSource.MAX_STORAGE_LIMIT; // Maximum query storage limit @550 - - /** - Start tracing the JDBC client. This is the same as setting - property "trace=true"; Note the constant is not public. - It is defined only to be compatible with ODBC - The numeric value of this constant is 1. - **/ - static final int TRACE_CLIENT = AS400JDBCDataSource.TRACE_CLIENT; - - /** - Start the database monitor on the JDBC server job. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 2. - **/ - public static final int SERVER_TRACE_START_DATABASE_MONITOR = AS400JDBCDataSource.SERVER_TRACE_START_DATABASE_MONITOR; - - /** - Start debug on the JDBC server job. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 4. - **/ - public static final int SERVER_TRACE_DEBUG_SERVER_JOB = AS400JDBCDataSource.SERVER_TRACE_DEBUG_SERVER_JOB; - - /** - Save the joblog when the JDBC server job ends. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 8. - **/ - public static final int SERVER_TRACE_SAVE_SERVER_JOBLOG = AS400JDBCDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG; - - /** - Start job trace on the JDBC server job. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 16. - **/ - public static final int SERVER_TRACE_TRACE_SERVER_JOB = AS400JDBCDataSource.SERVER_TRACE_TRACE_SERVER_JOB; - - /** - Save SQL information. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 32. - **/ - public static final int SERVER_TRACE_SAVE_SQL_INFORMATION = AS400JDBCDataSource.SERVER_TRACE_SAVE_SQL_INFORMATION; - - - /** - Constructs a default AS400JDBCManagedDataSource object. - **/ - public AS400JDBCManagedDataSource() - { - initializeTransient(); - } - - /** - Constructs an AS400JDBCManagedDataSource object to the specified serverName. - @param serverName The name of the IBM i system. - **/ - public AS400JDBCManagedDataSource(String serverName) - { - this(); - - setServerName(serverName); - } - - /** - Constructs an AS400JDBCManagedDataSource object with the specified signon information. - @param serverName The name of the IBM i system. - @param user The user id. - @param password The user password. - **/ - public AS400JDBCManagedDataSource(String serverName, String user, String password) - { - this(); - - setServerName(serverName); - setUser(user); - setPassword(password); - } - - - // Note: We do not provide a constructor that takes an AS400 object, - // because we need to capture the password so we can use it as part of the pool key. - - - /** - Constructs an AS400JDBCManagedDataSource object with the specified signon information - to use for SSL communications with the IBM i system. - @param serverName The name of the system. - @param user The user id. - @param password The user password. - @param keyRingName The key ring class name to be used for SSL communications with the system. - @param keyRingPassword The password for the key ring class to be used for SSL communications with the system. - **/ - public AS400JDBCManagedDataSource(String serverName, String user, String password, - String keyRingName, String keyRingPassword) - { - this(); - - setSecure(true); - - try - { - as400_ = new SecureAS400(as400_); - ((SecureAS400)as400_).setKeyRingName(keyRingName, keyRingPassword); - } - catch (PropertyVetoException pe) {} // will never happen - - serialKeyRingName_ = keyRingName; - - // There is no get/set keyring name / password methods so they really aren't bean - // properties, but in v5r1 the keyring name is saved as if it is a property. Since - // the code saved the name we will also save the password. - serialKeyRingPWBytes_ = xpwConfuse(keyRingPassword); - - setServerName(serverName); - setUser(user); - setPassword(password); - } - - - /** - Constructs an AS400JDBCManagedDataSource object from the specified Reference object - @param reference The reference to retrieve the DataSource properties from - **/ - AS400JDBCManagedDataSource(Reference reference) - { - // Implementation note: This method is called from AS400JDBCObjectFactory.getObjectInstance - - if (reference == null) - throw new NullPointerException("reference"); - - Properties properties = new Properties(); - - // Set up the as400 object. - if (((String)reference.get(SECURE).getContent()).equalsIgnoreCase(TRUE_)) - { - isSecure_ = true; - as400_ = new SecureAS400(); - - // Since the as400 object is secure, get the key ring info. - serialKeyRingName_ = (String)reference.get(KEY_RING_NAME).getContent(); - // Note: Even though JDProperties has a "key ring" properties, we choose not to add them. - if (reference.get(KEY_RING_PASSWORD) != null) - serialKeyRingPWBytes_ = ((String)reference.get(KEY_RING_PASSWORD).getContent()).toCharArray(); - else - serialKeyRingPWBytes_ = null; - - try { - if (serialKeyRingPWBytes_ != null && serialKeyRingPWBytes_.length > 0) { - ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_, xpwDeconfuse(serialKeyRingPWBytes_)); - } - else { - ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_); - } - } catch (PropertyVetoException pve) {} // Will never happen - - } - else - { - isSecure_ = false; - as400_ = new AS400(); - } - // Note that we allow the SECURE property to also get added to JDProperties in the loop below. - - boolean isConnectionPoolDataSource = (this instanceof AS400JDBCManagedConnectionPoolDataSource); - - Enumeration list = reference.getAll(); - while (list.hasMoreElements()) - { - StringRefAddr refAddr = (StringRefAddr)list.nextElement(); - String property = refAddr.getType(); - String value = (String)reference.get(property).getContent(); - - // Constant identifiers were used to store in JNDI. - // Perform special handling for properties that don't get included in JDProperties. - - if (property.equals(DATASOURCE_NAME)) { - setDataSourceName(value); - } - else if (property.equals(DESCRIPTION)) - setDescription(value); - else if (property.equals(SERVER_NAME)) - setServerName(value); - else if (property.equals(USER)) { - setUser(value); - properties.put(property, value); // This value needs to go into JDProperties also. - } - else if (property.equals(PLAIN_TEXT_PASSWORD)) { - //set the password - setPassword(value); - } - else if (property.equals(PASSWORD)) - { - if (reference.get(PLAIN_TEXT_PASSWORD) != null) - { - setPassword((String)reference.get(PLAIN_TEXT_PASSWORD).getContent()); - } - else - { - // get the password back from the serialized char[] - if (value != null) { - serialPWBytes_ = value.toCharArray(); - pwHashcode_ = xpwDeconfuse(serialPWBytes_).hashCode(); - // decode the password and set it on the as400 - as400_.setPassword(xpwDeconfuse(serialPWBytes_)); - } - } - } - else if (property.equals(SAVE_PASSWORD)) { - // set the savePasswordWhenSerialized_ flag - savePasswordWhenSerialized_ = value.equals(TRUE_) ? true : false; - } - else if (/*property.equals(SECURE) ||*/ property.equals(KEY_RING_NAME) || property.equals(KEY_RING_PASSWORD)) { - // Do nothing for these keys. They've already been handled prior to loop, - // and we don't want them added to JDProperties. - } - else if (property.equals(SOCKET_KEEP_ALIVE)) { - sockProps_.setKeepAlive((value.equals(TRUE_)? true : false)); - } - else if (property.equals(SOCKET_RECEIVE_BUFFER_SIZE)) { - sockProps_.setReceiveBufferSize(Integer.parseInt(value)); - } - else if (property.equals(SOCKET_SEND_BUFFER_SIZE)) { - sockProps_.setSendBufferSize(Integer.parseInt(value)); - } - else if (property.equals(SOCKET_LINGER)) { - sockProps_.setSoLinger(Integer.parseInt(value)); - } - else if (property.equals(SOCKET_TIMEOUT)) { - sockProps_.setSoTimeout(Integer.parseInt(value)); - } - else if (property.equals(SOCKET_TCP_NO_DELAY)) { - sockProps_.setTcpNoDelay((value.equals(TRUE_)? true : false)); - } - else if (isConnectionPoolDataSource && - AS400JDBCManagedConnectionPoolDataSource.isConnectionPoolProperty(property)) { - // Ignore this property, the subclass will consume it. - if (DEBUG) logDiagnostic("AS400JDBCManagedDataSource(Reference) is ignoring connection pool property \"" + property + "\""); - } - else { // It's neither a "socket property" nor a property that needs special handling. - properties.put(property, value); // Assume it goes into JDProperties. - } - } // 'while' loop - - properties_ = new JDProperties(properties, null); - if (sockProps_.isAnyOptionSet()) { // only need to set if not default - as400_.setSocketProperties(sockProps_); - } - - // Get the prompt property and set it back in the as400 object. - String prmpt = properties_.getString(JDProperties.PROMPT); - if (prmpt != null && prmpt.equalsIgnoreCase(FALSE_)) - setPrompt(false); - else if (prmpt != null && prmpt.equalsIgnoreCase(TRUE_)) - setPrompt(true); - } - - - /** - Verifies the health of the connection pool. For example: That the connection counts are consistent with the connection list lengths, and that all the daemons are still running. -

Note: This method is provided for use as a diagnostic tool only. It temporarily "freezes" the connection pool while it collects statistics and examines the pool state. - @param logStatistics If true, additional information is logged. - @return true if connection pool exists and appears healthy; false otherwise. - **/ - public boolean checkPoolHealth(boolean logStatistics) - { - if (poolManager_ == null) { - logWarning("Connection pool does not exist"); - return false; - } - else return poolManager_.checkHealth(logStatistics); - } - - - // For exclusive use within this class and by AS400JDBCManagedConnectionPoolDataSource. - /** - Returns the database connection. - @return The connection. - @throws SQLException If a database error occurs. - **/ - final AS400JDBCConnection createPhysicalConnection() throws SQLException - { - // If we have an AS400JDBCManagedConnectionPoolDataSource, delegate the connection creation. - if (cpds_ != null) { - return cpds_.createPhysicalConnection(); - } - else - { - AS400 as400Object = null; - - // If the object was created with a keyring, or if the user asks for the object - // to be secure, clone a SecureAS400 object; otherwise, clone an AS400 object. - if (isSecure_ || isSecure()) { - as400Object = new SecureAS400(as400_); - } - else { - as400Object = new AS400(as400_); - } - if (sockProps_.isAnyOptionSet()) { // only need to set if not default - as400Object.setSocketProperties(sockProps_); - } - - return createPhysicalConnection(as400Object); - } - } - - - // For exclusive use within this class and by AS400JDBCManagedConnectionPoolDataSource. - /** - Returns the database connection using the specified user and password. - @param user The database user. - @param password The database password. - @return The connection - @throws SQLException If a database error occurs. - **/ - final AS400JDBCConnection createPhysicalConnection(String user, String password) throws SQLException - { - // Validate the parameters. - if (user == null) - throw new NullPointerException("user"); - if (password == null) - throw new NullPointerException("password"); - - // If we have an AS400JDBCManagedConnectionPoolDataSource, delegate the connection creation. - if (cpds_ != null) { - return cpds_.createPhysicalConnection(user, password); - } - else - { - AS400 as400Object = null; - - // If the object was created with a keyring, or if the user asks for the object - // to be secure, clone a SecureAS400 object; otherwise, clone an AS400 object. - if (isSecure_ || isSecure()) { - as400Object = new SecureAS400(as400_); - } - else { - as400Object = new AS400(as400_); - } - try { - as400Object.setUserId(user); - as400Object.setPassword(password); - } - catch (PropertyVetoException pve) {} // will never happen - - // Set GUI available on the new object to false if user turned prompting off. - try { - if (!isPrompt()) { - as400Object.setGuiAvailable(false); - } - } - catch (PropertyVetoException pve) {} // this will never happen - - if (sockProps_.isAnyOptionSet()) { // only need to set if not default - as400Object.setSocketProperties(sockProps_); - } - - return createPhysicalConnection(as400Object); - } - } - - - /** - Utility method to creates the database connection based on the signon and property information. - @param as400 The AS400 object used to make the connection. - @throws SQLException If a database error occurs. - **/ - private AS400JDBCConnection createPhysicalConnection(AS400 as400) throws SQLException - { - AS400JDBCConnection connection = new AS400JDBCConnection(); - - connection.setProperties(new JDDataSourceURL(TOOLBOX_DRIVER + "//" + as400.getSystemName()), properties_, as400); // Note: This also does an AS400.connectService() to the database host server. - - if (JDTrace.isTraceOn() || log_ != null) logInformation(ResourceBundleLoader.getText("AS400_JDBC_DS_CONN_CREATED")); - return connection; - } - - - //@PDA 550 - clone - /** - * Method to create a clone of AS400JDBCManagedDataSource. This does a shallow - * copy, with the exception of JDProperties, which also gets cloned. - */ - public Object clone() - { - try - { - AS400JDBCManagedDataSource clone = (AS400JDBCManagedDataSource) super.clone(); - clone.properties_ = (JDProperties) this.properties_.clone(); - return clone; - } catch (CloneNotSupportedException e) - { // This should never happen. - Trace.log(Trace.ERROR, e); - throw new UnsupportedOperationException("clone()"); - } - } - - - /** - Shuts down the connection pool in an orderly manner. Closes all connections in the pool. - @throws Throwable If an error occurs. - **/ - public void closePool() - { - if (poolManager_ != null) poolManager_.closePool(); - } - - - /** - Returns the level of database access for the connection. - @return The access level. Valid values include: "all" (all SQL statements allowed), - "read call" (SELECT and CALL statements allowed), and "read only" (SELECT statements only). - The default value is "all". - **/ - public String getAccess() - { - return properties_.getString(JDProperties.ACCESS); - } - - /** - Returns what behaviors of the Toolbox JDBC driver have been overridden. - Multiple behaviors can be overridden in combination by adding - the constants and passing that sum on the setBehaviorOverride() method. - @return The behaviors that have been overridden. -

The return value is a combination of the following: -

    -
  • 1 - Do not throw an exception if Statement.executeQuery() or - PreparedStatement.executeQuery() do not return a result set. - Instead, return null for the result set. -
- **/ - public int getBehaviorOverride() - { - return properties_.getInt(JDProperties.BEHAVIOR_OVERRIDE); - } - - /** - Returns the output string type of bidi data. See - BidiStringType for more information and valid values. -1 will be returned - if the value has not been set. - **/ - public int getBidiStringType() - { - String value = properties_.getString(JDProperties.BIDI_STRING_TYPE); - try - { - return Integer.parseInt (value); - } - catch (NumberFormatException nfe) // if value is "", that is, not set - { - return -1; - } - } - - - /** - Returns the criteria for retrieving data from the system in - blocks of records. Specifying a non-zero value for this property - will reduce the frequency of communication to the system, and - therefore increase performance. - @return The block criteria. -

Valid values include: -

    -
  • 0 (no record blocking) -
  • 1 (block if FOR FETCH ONLY is specified) -
  • 2 (block if FOR UPDATE is specified) - The default value. -
- **/ - public int getBlockCriteria() - { - return properties_.getInt(JDProperties.BLOCK_CRITERIA); - } - - /** - Returns the block size in kilobytes to retrieve from the IBM i system and - cache on the client. This property has no effect unless the block criteria - property is non-zero. Larger block sizes reduce the frequency of - communication to the system, and therefore may increase performance. - @return The block size in kilobytes. -

Valid values include: -

    -
  • 0 -
  • 8 -
  • 16 -
  • 32 - The default value. -
  • 64 -
  • 128 -
  • 256 -
  • 512 -
- **/ - public int getBlockSize() - { - return properties_.getInt(JDProperties.BLOCK_SIZE); - } - - //@cc1 - /** - * This method returns the concurrent access resolution setting. - * This method has no effect on IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @return The concurrent access resolution setting. Possible return valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public int getConcurrentAccessResolution () - { - return properties_.getInt(JDProperties.CONCURRENT_ACCESS_RESOLUTION); - } - - // method required by javax.sql.DataSource - /** - Returns a database connection. -
Note: If a dataSourceName has been specified (via {@link #setDataSourceName setDataSourceName()}, this method will return a pooled connection. Otherwise it will return a non-pooled connection. -

If pooling, the very first call to one of the getConnection() methods for this class will create and initialize the connection pool, and may have slow response. Therefore it is advisable for the application to make an initial "dummy" call to getConnection(). -
If the connection pool is at or near capacity, a non-pooled connection may be returned. -

It is the responsibility of the caller to ultimately call Connection.close() to release the connection, even if the connection has become unusable. - @return The connection. - @throws SQLException If a database error occurs. - @see #setDataSourceName - **/ - public Connection getConnection() throws SQLException - { - // Note: This method will return either an AS400JDBCConnection or an AS400JDBCConnectionHandle. - Connection connection; - - if (dataSourceNameSpecified_) // A datasource name has been specified, so use pooling. - { - connection = getConnectionFromPool(null, null); // 'null' indicates "use default key". - // Returns a connection handle or null. - - // The pooling implementation can return null if it can't produce a - // connection for the user. It is still our job to return a valid - // connection so drop back to returning a non-pooled connection at - // this point. - if (connection == null) - { - connection = createPhysicalConnection(); - } - } - else // No datasource name has been specified, so return raw (unpooled) connection. - { - if (JDTrace.isTraceOn() || log_ != null) { - logWarning("No datasource name was specified, so connections will not be pooled"); - } - // The connection is not linked to a pooled connection. Return a non-pooled connection. - connection = createPhysicalConnection(); - } - - if (DEBUG) - { - // Verify that the connection is for the correct user. - if (connection instanceof AS400JDBCConnection) - { - AS400JDBCConnection conn = (AS400JDBCConnection)connection; - String userForConn = conn.getUserName(); - if (!userForConn.equalsIgnoreCase(cpds_.getUser())) { - logError("MDS.getConnection() is returning a connection with incorrect user: [" + userForConn +"]"); - } - } - else if (connection instanceof AS400JDBCConnectionHandle) { - AS400JDBCConnectionHandle conn = (AS400JDBCConnectionHandle)connection; - String userForConn = conn.getUserName(); - if (!userForConn.equalsIgnoreCase(cpds_.getUser())) { - logError("MDS.getConnection() is returning a connectionHandle with incorrect user: [" + userForConn +"]"); - } - } - else { - logError("MDS.getConnection() is returning an instance of " + connection.getClass().getName()); - } - } - - return connection; - } - - // method required by javax.sql.DataSource - /** - Returns a database connection using the specified user and password. -
Note: If a dataSourceName has been specified (via {@link #setDataSourceName setDataSourceName()}, this method will return a pooled connection. Otherwise it will return a non-pooled connection. -

If pooling, the very first call to one of the getConnection() methods for this class will create and initialize the connection pool, and may have slow response. Therefore it is advisable for the application to make an initial "dummy" call to getConnection(). -
If the connection pool is at or near capacity, a non-pooled connection may be returned. -

It is the responsibility of the caller to ultimately call Connection.close() to release the connection, even if the connection has become unusable. - @param user The database user. - @param password The database password. - @return The connection - @throws SQLException If a database error occurs. - @see #setDataSourceName - **/ - public Connection getConnection(String user, String password) throws SQLException - { - // Note: This method will return either an AS400JDBCConnection or an AS400JDBCConnectionHandle. - - // Validate the parameters. - if (user == null) - throw new NullPointerException("user"); - if (password == null) - throw new NullPointerException("password"); - - Connection connection = null; - if (dataSourceNameSpecified_) // A datasource name has been specified, so use pooling. - { - // Note: xpwConfuse() generates different output each time it's called against the same password, so we can't use it bo build the pool key. - JDConnectionPoolKey key = new JDConnectionPoolKey(user, password.hashCode()); - connection = getConnectionFromPool(key, password); // Returns a connection handle or null. - - // The pooling implementation can return null if it can't produce a - // connection for the user. It is still our job to return a valid - // connection so drop back to returning a non-pooled connection at - // this point. - if (connection == null) - { - connection = createPhysicalConnection(user, password); - } - } - else // No datasource name has been specified, so return raw (unpooled) connection. - { - if (JDTrace.isTraceOn() || log_ != null) { - logWarning("No datasource name was specified, so connections will not be pooled"); - } - // The connection is not linked to a pooled connection. Return a non-pooled connection. - connection = createPhysicalConnection(user, password); - } - - if (DEBUG) - { - // Verify that the connection is for the correct user. - if (connection instanceof AS400JDBCConnection) { - AS400JDBCConnection conn = (AS400JDBCConnection)connection; - String userForConn = conn.getUserName(); - if (!userForConn.equalsIgnoreCase(user)) { - logError("MDS.getConnection("+user+") is returning a connection with incorrect user: [" + userForConn +"]"); - } - } - else if (connection instanceof AS400JDBCConnectionHandle) { - AS400JDBCConnectionHandle conn = (AS400JDBCConnectionHandle)connection; - String userForConn = conn.getUserName(); - if (!userForConn.equalsIgnoreCase(user)) { - logError("MDS.getConnection("+user+") is returning a connectionHandle with incorrect user: [" + userForConn +"]"); - } - } - else { - logError("MDS.getConnection() is returning an instance of " + connection.getClass().getName()); - } - } - - return connection; - } - - - /** - Returns a database connection from the pool, or null if the connection pool is at or near capacity. - - @param key The connection pool key. 'null' indicates that the default key is to be used. - @return The connection. May return null if pool is at or near capacity. - @throws SQLException If a database error occurs. - **/ - private final AS400JDBCConnectionHandle getConnectionFromPool(JDConnectionPoolKey key, String password) throws SQLException - { - // Note: This method generally returns an AS400JDBCPooledConnection. If the connection pool is full or nonexistent, it may return an (unpooled) AS400JDBCConnection. - - AS400JDBCConnectionHandle connection = null; - - if (!poolManagerInitialized_) { - initializeConnectionPool(); // this sets inUse_ to true - } - - connection = poolManager_.getConnection(key, password); - if (connection == null) - { - if (JDTrace.isTraceOn() || log_ != null) - logWarning("Connection pool is at or near capacity, so returning a non-pooled connection"); - // Note: If the 'enforceMaxPoolSize' property were set to true, then JDConnectionPoolManager.getConnection() would have thrown an exception if the pool is full and no connection is available. Since no exception was thrown, we can assume that the property is not set. - } - - return connection; - } - - - // For exclusive use within this class and by JDConnectionPoolManager. - final JDConnectionPoolKey getConnectionPoolKey() - { - // See if we need to update our connection pool key. - if (connectionKeyNeedsUpdate_) - { - if (defaultConnectionPoolKey_ == null) - { - defaultConnectionPoolKey_ = new JDConnectionPoolKey(serialUserName_, pwHashcode_); - } - else // key already exists, so just update it - { - defaultConnectionPoolKey_.update(serialUserName_, pwHashcode_); - } - } - - connectionKeyNeedsUpdate_ = false; - return defaultConnectionPoolKey_; - } - - - /** - Returns the value of the cursorSensitivity property. If the resultSetType is - ResultSet.TYPE_FORWARD_ONLY or ResultSet.TYPE_SCROLL_SENSITIVE, the value of this property - will control what cursor sensitivity is requested from the database. If the resultSetType - is ResultSet.TYPE_SCROLL_INSENSITIVE, this property will be ignored. - @return The cursor sensitivity. -

Valid values include: -

    -
  • "asensitive" -
  • "insensitive" -
  • "sensitive" -
- The default is "asensitive". - This property is ignored when connecting to systems - running V5R1 and earlier versions of OS/400. - **/ - public String getCursorSensitivity() - { - return properties_.getString(JDProperties.CURSOR_SENSITIVITY); - } - - - /** - Returns the value of the databaseName property. For more information see - the documentation for the setDatabaseName() method in this class. - @return The database name. - **/ - public String getDatabaseName() - { - return properties_.getString(JDProperties.DATABASE_NAME); - } - - /** - Returns the value of the dataSourceName property. - This property is used to name an underlying data source when connection pooling is used. - @return The data source name. - **/ - public String getDataSourceName() - { - return (dataSourceName_ == null ? "" : dataSourceName_); - } - - /** - Returns the date format used in date literals within SQL statements. - @return The date format. -

Valid values include: -

    -
  • "mdy" -
  • "dmy" -
  • "ymd" -
  • "usa" -
  • "iso" -
  • "eur" -
  • "jis" -
  • "julian" -
  • "" (server job value) - default. -
- The default is based on the server job. - **/ - public String getDateFormat() - { - return properties_.getString(JDProperties.DATE_FORMAT); - } - - /** - Returns the date separator used in date literals within SQL statements. - This property has no effect unless the "data format" property is set to: - "julian", "mdy", "dmy", or "ymd". - @return The date separator. -

Valid values include: -

    -
  • "/" (slash) -
  • "-" (dash) -
  • "." (period) -
  • "," (comma) -
  • " " (space) -
  • "" (server job value) - default. -
- The default value is based on the server job. - **/ - public String getDateSeparator() - { - return properties_.getString(JDProperties.DATE_SEPARATOR); - } - - //@DFA - /** - Returns the decfloat rounding mode. - @return The decfloat rounding mode. -

Valid values include: -

    -
  • "half even" - default -
  • "half up" -
  • "down" -
  • "ceiling" -
  • "floor" -
  • "half down" -
  • "up" -
- **/ - public String getDecfloatRoundingMode() - { - return properties_.getString(JDProperties.DECFLOAT_ROUNDING_MODE); - } - - /** - Returns the decimal separator used in numeric literals within SQL statements. - @return The decimal separator. -

Valid values include: -

    -
  • "." (period) -
  • "," (comma) -
  • "" (server job value) - default. -
- The default value is based on the server job. - **/ - public String getDecimalSeparator() - { - return properties_.getString(JDProperties.DECIMAL_SEPARATOR); - } - - //@igwrn - /** - * Returns the ignore warnings property. - * Specifies a list of SQL states for which the driver should not create warning objects. - * @return The ignore warnings. - **/ - public String getIgnoreWarnings() - { - return properties_.getString(JDProperties.IGNORE_WARNINGS); - } - - /** - Returns the description of the data source. - @return The description. - **/ - public String getDescription() - { - return (description_ == null ? "" : description_); - } - - /** - Returns the JDBC driver implementation. - This property has no - effect if the "secondary URL" property is set. - This property cannot be set to "native" if the - environment is not an IBM i Java Virtual - Machine. -

Valid values include: -

    -
  • "toolbox" (use the IBM Toolbox for Java JDBC driver) -
  • "native" (use the IBM Developer Kit for Java JDBC driver) -
- The default value is "toolbox". - Note: Not supported in a connection pool. - **/ - public String getDriver() - { - return properties_.getString(JDProperties.DRIVER); - } - - /** - Returns the amount of detail for error messages originating from - the IBM i system. - @return The error message level. - Valid values include: "basic" and "full". The default value is "basic". - **/ - public String getErrors() - { - return properties_.getString(JDProperties.ERRORS); - } - - /** - Returns the libraries to add to the server job's library list. - The libraries are delimited by commas or spaces, and - "*LIBL" may be used as a place holder for the server job's - current library list. The library list is used for resolving - unqualified stored procedure calls and finding schemas in - DatabaseMetaData catalog methods. If "*LIBL" is not specified, - the specified libraries will replace the server job's current library list. - @return The library list. - **/ - public String getLibraries() - { - return properties_.getString(JDProperties.LIBRARIES); - } - - /** - Returns the maximum LOB (large object) size in bytes that - can be retrieved as part of a result set. LOBs that are larger - than this threshold will be retrieved in pieces using extra - communication to the IBM i system. Larger LOB thresholds will reduce - the frequency of communication to the system, but will download - more LOB data, even if it is not used. Smaller LOB thresholds may - increase frequency of communication to the system, but will only - download LOB data as it is needed. - @return The lob threshold. Valid range is 0-16777216. - The default value is 32768. - **/ - public int getLobThreshold() - { - return properties_.getInt(JDProperties.LOB_THRESHOLD); - } - - // method required by javax.sql.DataSource - /** - Returns the timeout value in seconds. -
Note: This value is not used or supported by the Toolbox JDBC driver. - Rather, the timeout value is determined by the IBM i system. - @return the maximum time in seconds that this data source can wait while attempting to connect to a database. - **/ - public int getLoginTimeout() - { - return properties_.getInt(JDProperties.LOGIN_TIMEOUT); - } - - // method required by javax.sql.DataSource - /** - Returns the log writer for this data source. - @return The log writer for this data source. - @throws SQLException If a database error occurs. - **/ - public PrintWriter getLogWriter() throws SQLException - { - return writer_; - } - - //@PDA - /** - * Indicates how to retrieve DatabaseMetaData. - * If set to 0, database metadata will be retrieved through the ROI data flow. - * If set to 1, database metadata will be retrieved by calling system stored procedures. - * The methods that currently are available through stored procedures are: - * getColumnPrivileges - * @return the metadata setting. - * The default value is 1. - **/ - public int getMetaDataSource() - { - return properties_.getInt(JDProperties.METADATA_SOURCE); - } - - //@dup - /** - * Indicates how to retrieve DatabaseMetaData. - * If set to 0, database metadata will be retrieved through the ROI data flow. - * If set to 1, database metadata will be retrieved by calling system stored procedures. - * The methods that currently are available through stored procedures are: - * getColumnPrivileges - * @return the metadata setting. - * The default value is 1. - * Note: this method is the same as getMetaDataSource() so that it corresponds to the connection property name - **/ - public int getMetadataSource() - { - return getMetaDataSource(); - } - - - /** - Returns the naming convention used when referring to tables. - @return The naming convention. Valid values include: "sql" (e.g. schema.table) - and "system" (e.g. schema/table). The default value is "sql". - **/ - public String getNaming() - { - return properties_.getString(JDProperties.NAMING); - } - - /** - Returns the base name of the SQL package. Note that only the - first six characters are used to generate the name of the SQL package on the IBM i system. - This property has no effect unless - the extended dynamic property is set to true. In addition, this property - must be set if the extended dynamic property is set to true. - @return The base name of the SQL package. - **/ - public String getPackage() - { - return properties_.getString(JDProperties.PACKAGE); - } - - /** - Returns the type of SQL statement to be stored in the SQL package. This can - be useful to improve the performance of complex join conditions. This - property has no effect unless the extended dynamic property is set to true. - @return The type of SQL statement. - Valid values include: "default" (only store SQL statements with parameter - markers in the package) and "select" (store all SQL SELECT statements - in the package). The default value is "default". - **/ - public String getPackageCriteria() - { - return properties_.getString(JDProperties.PACKAGE_CRITERIA); - } - - /** - Returns the action to take when SQL package errors occur. When an SQL package - error occurs, the driver will optionally throw an SQLException or post a - warning to the Connection, based on the value of this property. This property - has no effect unless the extended dynamic property is set to true. - @return The action to take when SQL errors occur. - Valid values include: "exception", "warning", and "none". The default value is "warning". - **/ - public String getPackageError() - { - return properties_.getString(JDProperties.PACKAGE_ERROR); - } - - /** - Returns the library for the SQL package. This property has no effect unless - the extended dynamic property is set to true. - @return The SQL package library. The default package library is "QGPL". - **/ - public String getPackageLibrary() - { - return properties_.getString(JDProperties.PACKAGE_LIBRARY); - } - - - // Note: This method must never be public. It is provided for exclusive use by AS400JDBCManagedConnectionPoolDataSource. - /** - Returns the password bytes. - @return The password bytes. - **/ - final char[] getPWBytes() - { - return serialPWBytes_; - } - - /** - Returns the name of the proxy server. - @return The proxy server. - **/ - public String getProxyServer() - { - return properties_.getString(JDProperties.PROXY_SERVER); - } - - /** - Returns the "query optimize goal" property - @return The optimization goal -

Possible values include: -

    -
  • 0 = Optimize query for first block of data (*ALLIO) when extended dynamic packages are used; Optimize query for entire result set (*FIRSTIO) when packages are not used
  • -
  • 1 = Optimize query for first block of data (*FIRSTIO)
  • -
  • 2 = Optimize query for entire result set (*ALLIO)
  • -
- **/ - public int getQueryOptimizeGoal() - { - return properties_.getInt(JDProperties.QUERY_OPTIMIZE_GOAL); - } - - //@550 - /** - * Returns the storage limit in megabytes, that should be used for statements executing a query in a connection. - * Note, this setting is ignored when running to i5/OS V5R4 or earlier - *

Valid values are -1 to MAX_STORAGE_LIMIT megabytes. - * The default value is -1 meaning there is no limit. - **/ - public int getQueryStorageLimit() - { - return properties_.getInt(JDProperties.QUERY_STORAGE_LIMIT); - } - - - // method required by javax.naming.Referenceable - /** - Returns the Reference object for the data source object. - This is used by JNDI when bound in a JNDI naming service. - Contains the information necessary to reconstruct the data source - object when it is later retrieved from JNDI via an object factory. - * - @return A Reference object of the data source object. - @throws NamingException If a naming error occurs in resolving the object. - **/ - public Reference getReference() throws NamingException - { - Reference ref = new Reference(this.getClass().getName(), - "com.ibm.as400.access.AS400JDBCObjectFactory", - null); - - // Add the JDBC properties. - DriverPropertyInfo[] propertyList = properties_.getInfo(); - for (int i=0; i< propertyList.length; i++) - { - if (propertyList[i].value != null) - ref.add(new StringRefAddr(propertyList[i].name, propertyList[i].value)); - } - - // Add the Socket options - if (sockProps_.keepAliveSet_) ref.add(new StringRefAddr(SOCKET_KEEP_ALIVE, (sockProps_.keepAlive_ ? "true" : "false"))); - if (sockProps_.receiveBufferSizeSet_) ref.add(new StringRefAddr(SOCKET_RECEIVE_BUFFER_SIZE, Integer.toString(sockProps_.receiveBufferSize_))); - if (sockProps_.sendBufferSizeSet_) ref.add(new StringRefAddr(SOCKET_SEND_BUFFER_SIZE, Integer.toString(sockProps_.sendBufferSize_))); - if (sockProps_.soLingerSet_) ref.add(new StringRefAddr(SOCKET_LINGER, Integer.toString(sockProps_.soLinger_))); - if (sockProps_.soTimeoutSet_) ref.add(new StringRefAddr(SOCKET_TIMEOUT, Integer.toString(sockProps_.soTimeout_))); - if (sockProps_.tcpNoDelaySet_) ref.add(new StringRefAddr(SOCKET_TCP_NO_DELAY, (sockProps_.tcpNoDelay_ ? "true" : "false"))); - - // Add the data source properties. (unique constant identifiers for storing in JNDI). - if (dataSourceName_ != null) - ref.add(new StringRefAddr(DATASOURCE_NAME, dataSourceName_)); - if (description_ != null) - ref.add(new StringRefAddr(DESCRIPTION, description_)); - ref.add(new StringRefAddr(SERVER_NAME, getServerName())); - ref.add(new StringRefAddr(USER, getUser())); - ref.add(new StringRefAddr(KEY_RING_NAME, serialKeyRingName_)); - if (savePasswordWhenSerialized_) { - if (serialPWBytes_ != null) - ref.add(new StringRefAddr(PASSWORD, new String(serialPWBytes_))); - else - ref.add(new StringRefAddr(PASSWORD, null)); - if (serialKeyRingPWBytes_ != null) - ref.add(new StringRefAddr(KEY_RING_PASSWORD, new String(serialKeyRingPWBytes_))); - else - ref.add(new StringRefAddr(KEY_RING_PASSWORD, null)); - } - ref.add(new StringRefAddr(SAVE_PASSWORD, (savePasswordWhenSerialized_ ? TRUE_ : FALSE_))); - - return ref; - } - - /** - Returns the source of the text for REMARKS columns in ResultSets returned - by DatabaseMetaData methods. - @return The text source. - Valid values include: "sql" (SQL object comment) and "system" (IBM i object description). - The default value is "system". - **/ - public String getRemarks() - { - return properties_.getString(JDProperties.REMARKS); - } - - /** - Returns the secondary URL. - @return The secondary URL. - **/ - public String getSecondaryUrl() - { - return properties_.getString(JDProperties.SECONDARY_URL); - } - - - //@dup - /** - * Returns the secondary URL. - * @return The secondary URL. - * Note: this method is the same as setSecondaryUrl() so that it corresponds to the connection property name - **/ - public String getSecondaryURL() - { - return getSecondaryUrl(); - } - - - /** - Returns the value of the serverName property. - @return The system name. - **/ - public String getServerName() - { - return as400_.getSystemName(); - } - - - /** - Returns the level of tracing started on the JDBC server job. - If tracing is enabled, tracing is started when - the client connects to the IBM i system and ends when the connection - is disconnected. Tracing must be started before connecting to - the system since the client enables tracing only at connect time. - Trace data is collected in spooled files on the system. Multiple - levels of tracing can be turned on in combination by adding - the constants and passing that sum on the set method. For example, -

-   dataSource.setServerTraceCategories(AS400JDBCManagedDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCManagedDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
-   
- @return The tracing level. -

The value is a combination of the following: -

    -
  • SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job. - The numeric value of this constant is 2. -
  • SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job. - The numeric value of this constant is 4. -
  • SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends. - The numeric value of this constant is 8. -
  • SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job. - The numeric value of this constant is 16. -
  • SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information. - The numeric value of this constant is 32. -
- * -

- Tracing the JDBC server job will use significant amounts of system resources. - Additional processor resource is used to collect the data, and additional - storage is used to save the data. Turn on tracing only to debug - a problem as directed by IBM service. - * - **/ - public int getServerTraceCategories() - { - return properties_.getInt(JDProperties.TRACE_SERVER); - } - - //@dup - /** - Returns the level of tracing started on the JDBC server job. - If tracing is enabled, tracing is started when - the client connects to the IBM i system and ends when the connection - is disconnected. Tracing must be started before connecting to - the system since the client enables tracing only at connect time. - Trace data is collected in spooled files on the system. Multiple - levels of tracing can be turned on in combination by adding - the constants and passing that sum on the set method. For example, -

-   dataSource.setServerTraceCategories(AS400JDBCManagedDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCManagedDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
-   
- @return The tracing level. -

The value is a combination of the following: -

    -
  • SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job. - The numeric value of this constant is 2. -
  • SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job. - The numeric value of this constant is 4. -
  • SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends. - The numeric value of this constant is 8. -
  • SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job. - The numeric value of this constant is 16. -
  • SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information. - The numeric value of this constant is 32. -
- * -

- Tracing the JDBC server job will use significant amounts of system resources. - Additional processor resource is used to collect the data, and additional - storage is used to save the data. Turn on tracing only to debug - a problem as directed by IBM service. - * - * Note: this method is the same as getServerTraceCategories() so that it corresponds to the connection property name - **/ - public int getServerTrace() - { - return getServerTraceCategories(); - } - - //@STIMEOUT - /** - * Gets the socket timeout option in milliseconds. - * @return The value of the socket timeout option. - **/ - public long getSocketTimeout() - { - return getSoTimeout(); - } - - - /** - Returns how the IBM i system sorts records before sending them to the - client. - @return The sort value. -

Valid values include: -

    -
  • "hex" (base the sort on hexadecimal values) -
  • "language" (base the sort on the language set in the sort language property) -
  • "table" (base the sort on the sort sequence table set in the sort table property) -
- The default value is "hex". - **/ - public String getSort() - { - return properties_.getString(JDProperties.SORT); - } - - /** - Returns the three-character language id to use for selection of a sort sequence. - @return The three-character language id. - The default value is ENU. - **/ - public String getSortLanguage() - { - return properties_.getString(JDProperties.SORT_LANGUAGE); - } - - /** - Returns the library and file name of a sort sequence table stored on the - IBM i system. - @return The qualified sort table name. - **/ - public String getSortTable() - { - return properties_.getString(JDProperties.SORT_TABLE); - } - - /** - Returns how the IBM i system treats case while sorting records. - @return The sort weight. - Valid values include: "shared" (upper- and lower-case characters are sorted as the - same character) and "unique" (upper- and lower-case characters are sorted as - different characters). The default value is "shared". - **/ - public String getSortWeight() - { - return properties_.getString(JDProperties.SORT_WEIGHT); - } - - /** - Returns the time format used in time literals with SQL statements. - @return The time format. -

Valid values include: -

    -
  • "hms" -
  • "usa" -
  • "iso" -
  • "eur" -
  • "jis" -
  • "" (server job value) - default. -
- The default value is based on the server job. - **/ - public String getTimeFormat() - { - return properties_.getString(JDProperties.TIME_FORMAT); - } - - /** - Returns the time separator used in time literals within SQL - statements. - @return The time separator. -

Valid values include: -

    -
  • ":" (colon) -
  • "." (period) -
  • "," (comma) -
  • " " (space) -
  • "" (server job value) - default. -
- The default value is based on the server job. - **/ - public String getTimeSeparator() - { - return properties_.getString(JDProperties.TIME_SEPARATOR); - } - - - /** - Returns the IBM i system's transaction isolation. - @return The transaction isolation level. -

Valid values include: -

    -
  • "none" -
  • "read uncommitted" - The default value. -
  • "read committed" -
  • "repeatable read" -
  • "serializable" -
- **/ - public String getTransactionIsolation() - { - return properties_.getString(JDProperties.TRANSACTION_ISOLATION); - } - - /** - Returns the QAQQINI library name. - @return The QAQQINI library name. - **/ - public String getQaqqiniLibrary() - { - return properties_.getString(JDProperties.QAQQINILIB); - } - - //@dup - /** - * Returns the QAQQINI library name. - * @return The QAQQINI library name. - * Note: this method is the same as getQaqqiniLibrary() so that it corresponds to the connection property name - **/ - public String getQaqqinilib() - { - return getQaqqiniLibrary(); - } - - - /** - Returns the value of the 'user' property. - @return The user. - **/ - public String getUser() - { - //return properties_.getString(JDProperties.USER); //PDD - return as400_.getUserId(); //@PDA if running on host, could be default id - } - - /** - Returns the value of the "XA loosely couple support" property. - This indicates whether lock sharing is allowed for loosely coupled transaction branches. - @return The "XA loosely coupled support" setting. -

Possible values include: -

    -
  • 0 = Locks cannot be shared
  • -
  • 1 = Locks can be shared
  • -
- **/ - public int getXALooselyCoupledSupport() - { - return properties_.getInt(JDProperties.XA_LOOSELY_COUPLED_SUPPORT); - } - - - /** - Initializes the connection pool and the built-in pool manager. - If dataSourceName property has not been set (via {@link #setDataSourceName setDataSourceName()}, this method does nothing. -
This method gets called upon the first invocation of {@link #getConnection() getConnection()} or {@link getConnection(String,String) getConnection(user,password)}. - @throws SQLException If a database error occurs. - **/ - void initializeConnectionPool() throws SQLException - { - if (!dataSourceNameSpecified_) - { - logWarning("No datasource name was specified, so connections will not be pooled"); - return; - } - synchronized(this) { /*@A7A */ - inUse_ = true; - } - if (poolManager_ == null) - { - try - { - // Assume that the Context.INITIAL_CONTEXT_FACTORY system property has been set. - Context ctx = new InitialContext(); - cpds_ = (AS400JDBCManagedConnectionPoolDataSource)ctx.lookup(dataSourceName_); - if (cpds_ == null) { - logError("Data source name is not bound in JNDI: " + dataSourceName_); - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - } - - getConnectionPoolKey(); // initialize the default connection pool key - poolManager_ = new JDConnectionPoolManager(this, cpds_); - // Implementation note: The JNDI lookup() tends to lose the LogWriter value of cpds_, so we need to give the pool manager access to our own LogWriter. - } - catch (NamingException ne) - { - ne.printStackTrace(); - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - } - } - - poolManagerInitialized_ = true; - } - - /** - Initializes the transient data for object de-serialization. - **/ - private final void initializeTransient() - { - poolManager_ = null; - poolManagerInitialized_ = false; - defaultConnectionPoolKey_ = null; - connectionKeyNeedsUpdate_ = true; - if (isSecure_) - as400_ = new SecureAS400(); - else - as400_ = new AS400(); - - if (sockProps_.isAnyOptionSet()) { // only need to set if not default - as400_.setSocketProperties(sockProps_); - } - - // Reinitialize the serverName, user, password, keyRingName, etc. - if (serialServerName_ != null) - setServerName(serialServerName_); - - if (serialUserName_ != null) - { - setUser(serialUserName_); - - if ((serialPWBytes_ != null) && - (serialPWBytes_.length > 0)) - { - as400_.setPassword(xpwDeconfuse(serialPWBytes_)); - } - } - - try - { - if (serialKeyRingName_ != null && isSecure_) - { - if ((serialKeyRingPWBytes_ != null) && - (serialKeyRingPWBytes_.length > 0)) - { - String keyRingPassword = xpwDeconfuse(serialKeyRingPWBytes_); - ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_, keyRingPassword); - } - else - { - ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_); - } - } - } - catch (PropertyVetoException pve) {} // will never happen - - // Make sure the prompt flag is correctly de-serialized. The problem was - // the flag would get serialized with the rest of the properties - // (in the properties_ object), but the flag would never be applied - // to the AS400 object when de-serialzed. De-serialization puts the - // flag back in properties_ but that does no good unless the value - // is passed on to the AS400 object. That is what the new code does. - // There is no affect on normal "new" objects since at the time this - // method is called properties_ is null. - try - { - if (properties_ != null) - { - if (!isPrompt()) { - as400_.setGuiAvailable(false); - } - } - } - catch (PropertyVetoException pve) {} // will never happen - - synchronized(this) { //@A7A - inUse_ = false; - } - - } - - /** - Invalidates all pooled connections for the specified user/password. - All current available (unallocated) connections for this user/password are closed. - As active connections with this user/password are returned to the pool, they are closed. - @param user The database user. - @param password The database password. - **/ - public void invalidate(String user, String password) - { - invalidate(user, (password == null ? null : xpwConfuse(password))); - } - - /** - Invalidates pooled connections for the specified user/password. - All current available (unallocated) connections for this user/password are closed. - As active (in-use) connections with this user/password are returned to the pool, they are closed. - @param user The database user. - @param password The database password. - **/ - private final void invalidate(String user, char[] pwBytes) - { - int hash = (pwBytes == null ? 0 : xpwDeconfuse(pwBytes).hashCode()); - JDConnectionPoolKey key = new JDConnectionPoolKey(user, hash); - if (poolManager_ != null) poolManager_.invalidate(key); - } - - //@AC1 - /** - * Returns whether auto-commit mode is the default connection mode for new connections. - * @return Auto commit. - * The default value is true. - **/ - public boolean isAutoCommit() - { - return properties_.getBoolean(JDProperties.AUTO_COMMIT); - } - - //@CE1 - /** - * Returns whether commit or rollback throws SQLException when autocommit is enabled. - * @return Autocommit Exception. - * The default value is false. - **/ - public boolean isAutocommitException() - { - return properties_.getBoolean(JDProperties.AUTOCOMMIT_EXCEPTION); - } - - /** - Indicates whether bidi implicit reordering is used. - @return true if bidi implicit reordering is used; false otherwise. - The default value is true. - **/ - public boolean isBidiImplicitReordering() - { - return properties_.getBoolean(JDProperties.BIDI_IMPLICIT_REORDERING); - } - - /** - Indicates whether bidi numeric ordering round trip is used. - @return true if bidi numeric ordering round trip is used; false otherwise. - The default value is false. - **/ - public boolean isBidiNumericOrdering() - { - return properties_.getBoolean(JDProperties.BIDI_NUMERIC_ORDERING); - } - - /** - Indicates whether a big decimal value is returned. - @return true if a big decimal is returned; false otherwise. - The default value is true. - **/ - public boolean isBigDecimal() - { - return properties_.getBoolean(JDProperties.BIG_DECIMAL); - } - - /** - Indicates whether the cursor is held. - @return true if the cursor is held; false otherwise. - The default value is true. - **/ - public boolean isCursorHold() - { - return properties_.getBoolean(JDProperties.CURSOR_HOLD); - } - - /** - Indicates whether data compression is used. - @return true if data compression is used; false otherwise. - The default value is true. - **/ - public boolean isDataCompression() - { - return properties_.getBoolean(JDProperties.DATA_COMPRESSION); - } - - /** - Indicates whether data truncation is used. - @return true if data truncation is used; false otherwise. - The default value is true. - **/ - public boolean isDataTruncation() - { - return properties_.getBoolean(JDProperties.DATA_TRUNCATION); - } - - /** - Indicates whether extended dynamic support is used. Extended dynamic - support provides a mechanism for caching dynamic SQL statements on - the IBM i system. The first time a particular SQL statement is prepared, it is - stored in an SQL package on the system. - If the package does not exist, it will be automatically created. - On subsequent prepares of the - same SQL statement, the system can skip a significant part of the - processing by using information stored in the SQL package. - @return true if extended dynamic support is used; false otherwise. - The default value is not to use extended dynamic support. - **/ - public boolean isExtendedDynamic() - { - return properties_.getBoolean(JDProperties.EXTENDED_DYNAMIC); - } - - /** - Indicates whether the driver should request extended metadata from the - IBM i system. If this property is set to true, the accuracy of the information - that is returned from ResultSetMetaData methods getColumnLabel(int), - isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased. - In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this - property set to true. However, performance will be slower with this - property on. Leave this property set to its default (false) unless you - need more specific information from those methods. - * - For example, without this property turned on, isSearchable(int) will - always return true even though the correct answer may be false because - the driver does not have enough information from the system to make a judgment. Setting - this property to true forces the driver to get the correct data from the system. - * - @return true if extended metadata will be requested; false otherwise. - The default value is false. - **/ - - public boolean isExtendedMetaData() - { - return properties_.getBoolean(JDProperties.EXTENDED_METADATA); - } - - - //@dup - /** - * Indicates whether the driver should request extended metadata from the - * IBM i system. If this property is set to true, the accuracy of the information - * that is returned from ResultSetMetaData methods getColumnLabel(int), - * isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased. - * In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this - * property set to true. However, performance will be slower with this - * property on. Leave this property set to its default (false) unless you - * need more specific information from those methods. - * - * For example, without this property turned on, isSearchable(int) will - * always return true even though the correct answer may be false because - * the driver does not have enough information from the system to make a judgment. Setting - * this property to true forces the driver to get the correct data from the IBM i system. - * - * @return true if extended metadata will be requested; false otherwise. - * The default value is false. - * Note: this method is the same as isExtendedMetaData() so that it corresponds to the connection property name - **/ - - public boolean isExtendedMetadata() - { - return isExtendedMetaData(); - } - - - /** - Indicates whether the IBM i system fully opens a file when performing a query. - By default the system optimizes opens so they perform better. In - certain cases an optimized open will fail. In some - cases a query will fail when a database performance monitor - is turned on even though the same query works with the monitor - turned off. In this case set the full open property to true. - This disables optimization on the system. - @return true if files are fully opened; false otherwise. - The default value is false. - **/ - public boolean isFullOpen() - { - return properties_.getBoolean(JDProperties.FULL_OPEN); - } - - /** - Returns the value of the "hold input locators" property - @return true If input locators are held. - **/ - public boolean isHoldInputLocators() - { - return properties_.getBoolean(JDProperties.HOLD_LOCATORS); - } - - - /** - Returns the value of the "hold statements" property - @return true If statements are held. - **/ - public boolean isHoldStatements() - { - return properties_.getBoolean(JDProperties.HOLD_STATEMENTS); - } - - - /** - Indicates whether the pool is in use; that is, whether it contains any connections. - Used for checking state conditions. The default is false. - @return true if the pool is in use; false otherwise. - **/ - private synchronized final boolean isInUse() // @A7C - { - return inUse_; - } - - //@dmy - /** - * Indicates whether the temporary fix for JVM 1.6 is enabled. - * @return true if enabled; false otherwise. - * The default value is true. - **/ - public boolean isJvm16Synchronize() - { - return properties_.getBoolean(JDProperties.JVM16_SYNCHRONIZE); - } - - /** - Indicates whether to delay closing cursors until subsequent requests. - @return true to delay closing cursors until subsequent requests; false otherwise. - The default value is false. - **/ - public boolean isLazyClose() - { - return properties_.getBoolean(JDProperties.LAZY_CLOSE); - } - - /** - Indicates whether to add newly prepared statements to the - SQL package specified on the "package" property. This property - has no effect unless the extended dynamic property is set to true; - @return true If newly prepared statements should be added to the SQL package specified - on the "package" property; false otherwise. - The default value is true. - **/ - public boolean isPackageAdd() - { - return properties_.getBoolean(JDProperties.PACKAGE_ADD); - } - - /** - Indicates whether a subset of the SQL package information is cached in client memory. - Caching SQL packages locally - reduces the amount of communication to the IBM i system for prepares and describes. This - property has no effect unless the extended dynamic property is set to true. - @return true if caching is used; false otherwise. - The defalut value is false. - **/ - public boolean isPackageCache() - { - return properties_.getBoolean(JDProperties.PACKAGE_CACHE); - } - - /** - Indicates whether SQL packages are cleared when they become full. This method - has been deprecated. Package clearing and the decision for the - threshold where package clearing is needed is now handled - automatically by the database. - @return Always false. This method is deprecated. - @deprecated - **/ - public boolean isPackageClear() - { - return false; - } - - /** - Indicates whether data is prefetched upon executing a SELECT statement. - This will increase performance when accessing the initial rows in the result set. - @return If prefetch is used; false otherwise. - The default value is prefetch data. - **/ - public boolean isPrefetch() - { - return properties_.getBoolean(JDProperties.PREFETCH); - } - - /** - Indicates whether the user is prompted if a user name or password is - needed to connect to the IBM i system. If a connection can not be made - without prompting the user, and this property is set to false, then an - attempt to connect will fail throwing an exception. - @return true if the user is prompted for signon information; false otherwise. - The default value is false. - **/ - public boolean isPrompt() - { - return properties_.getBoolean(JDProperties.PROMPT); - } - - /** - Returns the value of the "rollback cursor hold" property. - @return true if cursors are held across rollbacks; false otherwise. - **/ - public boolean isRollbackCursorHold() - { - return properties_.getBoolean(JDProperties.ROLLBACK_CURSOR_HOLD); - } - - /** - Indicates whether the password is saved locally with the rest of - the properties when this data source object is serialized. -

- If the password is saved, it is up to the application to protect - the serialized form of the object because it contains all necessary - information to connect to the IBM i system. The default is false. It - is a security risk to save the password with the rest of the - properties so by default the password is not saved. If the programmer - chooses to accept this risk, call setSavePasswordWhenSerialized(true) - to force the Toolbox to save the password with the other properties - when the data source object is serialized. - @return true if the password is saved with the rest of the properties when the - data source object is serialized; false otherwise. - The default value is false. - **/ - public boolean isSavePasswordWhenSerialized() - { - return savePasswordWhenSerialized_; - } - - /** - Indicates whether a Secure Socket Layer (SSL) connection is used to communicate - with the IBM i system. SSL connections are only available when connecting to systems - at V4R4 or later. - @return true if Secure Socket Layer connection is used; false otherwise. - The default value is false. - **/ - public boolean isSecure() - { - return properties_.getBoolean(JDProperties.SECURE); - } - - //@pw3 - /** - * Returns the secure current user setting. True indicates to disallow "" and *current for user name and password. - * @return The secure current user setting. - **/ - public boolean isSecureCurrentUser() - { - return properties_.getBoolean(JDProperties.SECURE_CURRENT_USER); - } - - /** - Indicates whether a thread is used. - @return true if a thread is used; false otherwise. - The default value is true. - **/ - public boolean isThreadUsed() - { - return properties_.getBoolean(JDProperties.THREAD_USED); - } - - /** - Indicates whether trace messages should be logged. - @return true if trace message are logged; false otherwise. - The default value is false. - **/ - public boolean isTrace() - { - return properties_.getBoolean(JDProperties.TRACE); - } - - /** - Indicates whether binary data is translated. If this property is set - to true, then BINARY and VARBINARY fields are treated as CHAR and - VARCHAR fields. - @return true if binary data is translated; false otherwise. - The default value is false. - **/ - public boolean isTranslateBinary() - { - return properties_.getBoolean(JDProperties.TRANSLATE_BINARY); - } - - //@PDA - /** - * Indicates how Boolean objects are interpreted when setting the value - * for a character field/parameter using the PreparedStatement.setObject(), - * CallableStatement.setObject() or ResultSet.updateObject() methods. Setting the - * property to "true", would store the Boolean object in the character field as either - * "true" or "false". Setting the property to "false", would store the Boolean object - * in the character field as either "1" or "0". - * @return true if boolean data is translated; false otherwise. - * The default value is true. - **/ - public boolean isTranslateBoolean() - { - return properties_.getBoolean(JDProperties.TRANSLATE_BOOLEAN); - } - - - /** - Indicates whether true auto commit support is used. - @return true if true auto commit support is used; false otherwise. - The default value is false. - **/ - public boolean isTrueAutoCommit() - { - return properties_.getBoolean(JDProperties.TRUE_AUTO_COMMIT); //@true - } - - //@dup - /** - * Indicates whether true auto commit support is used. - * @return true if true auto commit support is used; false otherwise. - * The default value is false. - * Note: this method is the same as isTrueAutoCommit() so that it corresponds to the connection property name - **/ - public boolean isTrueAutocommit() - { - return isTrueAutoCommit(); - } - - - /** - Logs an exception and message to the event log. - @param property The property to log. - @param value The property value to log. - **/ - void logProperty(String property, String value) - { - // NOTE: JDTrace logs nothing unless JDTrace.isTraceOn() is true. - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, property, value); - } - - final void logDiagnostic(String text) - { - // Note: Currently this method is implemented identically to logInformation(). - // At some future point, we may want to add unique behavior to it. - // In the meantime, it is a placeholder. - if (JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, text); - if (log_ != null) log_.log(text); - } - } - - final void logError(String text) - { - String msg = "ERROR: " + text; - JDTrace.logInformation (this, msg); - if (log_ != null) log_.log(msg); - else if (DEBUG) System.out.println(msg); - } - - final void logException(String text, Exception e) - { - JDTrace.logException (this, text, e); - if (log_ != null) log_.log(text, e); - else if (DEBUG) { - System.out.println(text); - e.printStackTrace(); - } - } - - - final void logInformation(String text) - { - // NOTE: JDTrace logs nothing unless JDTrace.isTraceOn() is true. - if (JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, text); - if (log_ != null) log_.log(text); - } - } - - final void logWarning(String text) - { - String msg = "WARNING: " + text; - JDTrace.logInformation (this, msg); - if (log_ != null) log_.log(msg); - else if (DEBUG) System.out.println(msg); - } - - /** - Deserializes and initializes transient data. - @throws ClassNotFoundException If the class cannot be found. - @throws IOException If an I/O exception occurs. - **/ - private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException - { - in.defaultReadObject(); - initializeTransient(); - } - - - /** - Sets the level of database access for the connection. - @param access The access level. -

Valid values include: -

    -
  • "all" (all SQL statements allowed) -
  • "read call" (SELECT and CALL statements allowed) -
  • "read only" (SELECT statements only) -
- The default value is "all". - **/ - public void setAccess(String access) - { - final String property = "access"; - - if (access == null) - throw new NullPointerException(property); - validateProperty(property, access, JDProperties.ACCESS); - - properties_.setString(JDProperties.ACCESS, access); - // Note: The JDProperties.setString() logs the property change. - } - - - //@AC1 - /** - * Sets whether auto-commit mode is the default connection mode for new connections. - * @param value - * The default value is true. - **/ - public void setAutoCommit(boolean value) - { - if (value) - properties_.setString(JDProperties.AUTO_COMMIT, TRUE_); - else - properties_.setString(JDProperties.AUTO_COMMIT, FALSE_); - - } - - //@CE1 - /** - * Sets whether commit or rollback throws SQLException when autocommit is enabled. - * @param value - * The default value is false. - **/ - public void setAutocommitException(boolean value) - { - if (value) - properties_.setString(JDProperties.AUTOCOMMIT_EXCEPTION, TRUE_); - else - properties_.setString(JDProperties.AUTOCOMMIT_EXCEPTION, FALSE_); - - } - - /** - Sets whether true auto commit support is used. - @param value true if true auto commit support should be used; false otherwise. - The default value is false. - **/ - public void setTrueAutoCommit(boolean value) - { - if (value) - properties_.setString(JDProperties.TRUE_AUTO_COMMIT, TRUE_); //@true - else - properties_.setString(JDProperties.TRUE_AUTO_COMMIT, FALSE_); //@true - } - - - //@dup - /** - * Sets whether true auto commit support is used. - * @param value true if true auto commit support should be used; false otherwise. - * The default value is false. - * Note: this method is the same as setTrueAutoCommit() so that it corresponds to the connection property nameproperty name - **/ - public void setTrueAutocommit(boolean value) - { - setTrueAutoCommit(value); - } - - - /** - Sets the Toolbox JDBC Driver behaviors to override. Multiple - behaviors can be changed in combination by adding - the constants and passing that sum on the this method. - @param behaviors The driver behaviors to override. -

Valid values include: -

    -
  • 1 - Do not throw an exception if Statement.executeQuery() or - PreparedStatement.executeQuery() do not return a result set. - Instead, return null for the result set. -
- * - Carefully consider the result of overriding the default behavior of the - driver. For example, setting the value of this property to 1 means - the driver will no longer thrown an exception even though the JDBC 3.0 - specification states throwing an exception is the correct behavior. - Be sure your application correctly handles the altered behavior. - * - **/ - public void setBehaviorOverride(int behaviors) - { - properties_.setString(JDProperties.BEHAVIOR_OVERRIDE, Integer.toString(behaviors)); - } - - /** - Sets the output string type of bidi data. See - BidiStringType for more information and valid values. - **/ - public void setBidiStringType(int bidiStringType) - { - final String property = "bidiStringType"; - - validateProperty(property, Integer.toString(bidiStringType), JDProperties.BIDI_STRING_TYPE); - - properties_.setString(JDProperties.BIDI_STRING_TYPE, Integer.toString(bidiStringType)); - } - - /** - Sets whether bidi implicit reordering is used. - In this version, the parameter is used to determine whether Bidi layout - transformation should be applied to meta-data such as columns names. - @param value true if implicit reordering should be used; false otherwise. - The default value is true. - **/ - public void setBidiImplicitReordering(boolean value) - { - if (value) - properties_.setString(JDProperties.BIDI_IMPLICIT_REORDERING, TRUE_); - else - properties_.setString(JDProperties.BIDI_IMPLICIT_REORDERING, FALSE_); - } - - /** - Sets whether bidi numeric ordering round trip is used. - @param value true if numeric ordering round trip should be used; false otherwise. - The default value is false. - **/ - public void setBidiNumericOrdering(boolean value) - { - if (value) - properties_.setString(JDProperties.BIDI_NUMERIC_ORDERING, TRUE_); - else - properties_.setString(JDProperties.BIDI_NUMERIC_ORDERING, FALSE_); - } - - /** - Sets whether a big decimal value is returned. - @param value true if a big decimal is returned; false otherwise. - The default value is true. - **/ - public void setBigDecimal(boolean value) - { - if (value) - properties_.setString(JDProperties.BIG_DECIMAL, TRUE_); - else - properties_.setString(JDProperties.BIG_DECIMAL, FALSE_); - } - - /** - Sets the criteria for retrieving data from the IBM i system in - blocks of records. Specifying a non-zero value for this property - will reduce the frequency of communication to the system, and - therefore increase performance. - @param blockCriteria The block criteria. -

Valid values include: -

    -
  • 0 (no record blocking) -
  • 1 (block if FOR FETCH ONLY is specified) -
  • 2 (block if FOR UPDATE is specified) - The default value. -
- **/ - public void setBlockCriteria(int blockCriteria) - { - final String property = "blockCriteria"; - - validateProperty(property, Integer.toString(blockCriteria), JDProperties.BLOCK_CRITERIA); - - properties_.setString(JDProperties.BLOCK_CRITERIA, Integer.toString(blockCriteria)); - } - - /** - Sets the block size in kilobytes to retrieve from the IBM i system and - cache on the client. This property has no effect unless the block criteria - property is non-zero. Larger block sizes reduce the frequency of - communication to the system, and therefore may increase performance. - @param blockSize The block size in kilobytes. -

Valid values include: -

    -
  • 0 -
  • 8 -
  • 16 -
  • 32 - The default value. -
  • 64 -
  • 128 -
  • 256 -
  • 512 -
- **/ - public void setBlockSize(int blockSize) - { - final String property = "blockSize"; - - validateProperty(property, Integer.toString(blockSize), JDProperties.BLOCK_SIZE); - - properties_.setString(JDProperties.BLOCK_SIZE, new Integer(blockSize).toString()); - } - - //@cc1 - /** - * This method sets concurrent access resolution. This method overrides the setting of ConcurrentAccessResolution on the datasource or connection - * URL properties. This method has no effect on - * IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @param concurrentAccessResolution The current access resolution setting. Possible valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public void setConcurrentAccessResolution (int concurrentAccessResolution) - { - String property = "concurrentAccessResolution"; - - validateProperty(property, Integer.toString(concurrentAccessResolution), JDProperties.CONCURRENT_ACCESS_RESOLUTION); - - properties_.setString(JDProperties.CONCURRENT_ACCESS_RESOLUTION, Integer.toString(concurrentAccessResolution)); - } - - /** - Sets the cursor sensitivity to be requested from the database. If the resultSetType is - ResultSet.TYPE_FORWARD_ONLY or ResultSet.TYPE_SCROLL_SENSITIVE, the value of this property - will control what cursor sensitivity is requested from the database. If the resultSetType - is ResultSet.TYPE_SCROLL_INSENSITIVE, this property will be ignored. -

Valid values include: -

    -
  • "asensitive" -
  • "insensitive" -
  • "sensitive" -
- The default is "asensitive". - This property is ignored when connecting to systems - running V5R1 and earlier versions of OS/400. - **/ - public void setCursorSensitivity(String cursorSensitivity) - { - final String property = "cursorSensitivity"; - - validateProperty(property, cursorSensitivity, JDProperties.CURSOR_SENSITIVITY); - - properties_.setString(JDProperties.CURSOR_SENSITIVITY, cursorSensitivity); - } - - - /** - Sets whether the cursor is held. - @param cursorHold true if the cursor is held; false otherwise. The default value is true. - **/ - public void setCursorHold(boolean cursorHold) - { - if (cursorHold) - properties_.setString(JDProperties.CURSOR_HOLD, TRUE_); - else - properties_.setString(JDProperties.CURSOR_HOLD, FALSE_); - } - - /** - Sets the databaseName property. - This property is ignored when connecting to systems - running V5R1 and earlier versions of OS/400. - If a database name is specified it must exist in the relational - database directory on the IBM i system. Use IBM i command WRKRDBDIRE - to view the directory. - The following criteria are used to determine - which database is accessed: -
    -
  1. If a database name is specified, that database is used. Attempts - to connect will fail if the database does not exist. -
  2. If special value *SYSBAS is specified, the system default database is used. -
  3. If a database name is not specified, the database specified - in the job description for the user profile is used. -
  4. If a database name is not specified and a database is not specified - in the job description for the user profile, the system default - database is used. -
- @param databaseName The database name or *SYSBAS. - @throws ExtendedIllegalStateException If the data source is already in use. - **/ - public void setDatabaseName(String databaseName) - { - final String property = "databaseName"; - - if (isInUse()) { - logError("Data source is already in use"); - throw new ExtendedIllegalStateException(property, ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (databaseName == null) - throw new NullPointerException(property); - - properties_.setString(JDProperties.DATABASE_NAME, databaseName); - - connectionKeyNeedsUpdate_ = true; - } - - /** - Sets whether to use data compression. The default value is true. - @param compression true if data compression is used; false otherwise. - **/ - public void setDataCompression(boolean compression) - { - if (compression) - properties_.setString(JDProperties.DATA_COMPRESSION, TRUE_); - else - properties_.setString(JDProperties.DATA_COMPRESSION, FALSE_); - } - - /** - Sets the dataSourceName property. - This property can be used for connection pooling implementations. - dataSourceName is assumed to be bound (via JNDI) to an instance of {@link AS400JDBCManagedConnectionPoolDataSource AS400JDBCManagedConnectionPoolDataSource}. -

- Note: The properties of the specified datasource will override all similarly-named properties of this object. For example, if the specified datasource has a "serverName" property, then that value will be used by {@link #getConnection getConnection()}, and any value set via {@link #setServerName setServerName()} will be disregarded. -

- Note: If a dataSourceName is not specified, the {@link #getConnection getConnection()} methods will simply return non-pooled connections. - @param dataSourceName The data source name. - @throws ExtendedIllegalStateException If the data source is already in use. - **/ - public void setDataSourceName(String dataSourceName) - { - final String property = DATASOURCE_NAME; - - if (isInUse()) { - logError("Data source is already in use"); - throw new ExtendedIllegalStateException(property, ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (dataSourceName == null) - throw new NullPointerException(property); - - dataSourceName_ = dataSourceName; - dataSourceNameSpecified_ = true; - - logProperty(property, dataSourceName_); - } - - /** - Sets whether to use data truncation. The default value is true. - @param truncation true if data truncation is used; false otherwise. - **/ - public void setDataTruncation(boolean truncation) - { - if (truncation) - properties_.setString(JDProperties.DATA_TRUNCATION, TRUE_); - else - properties_.setString(JDProperties.DATA_TRUNCATION, FALSE_); - } - - /** - Sets the date format used in date literals within SQL statements. - @param dateFormat The date format. -

Valid values include: -

    -
  • "mdy" -
  • "dmy" -
  • "ymd" -
  • "usa" -
  • "iso" -
  • "eur" -
  • "jis" -
  • "julian" -
  • "" (server job value) - default. -
- The default is based on the server job. - **/ - public void setDateFormat(String dateFormat) - { - final String property = "dateFormat"; - - if (dateFormat == null) - throw new NullPointerException(property); - validateProperty(property, dateFormat, JDProperties.DATE_FORMAT); - - properties_.setString(JDProperties.DATE_FORMAT, dateFormat); - } - - /** - Sets the date separator used in date literals within SQL statements. - This property has no effect unless the "data format" property is set to: - "julian", "mdy", "dmy", or "ymd". - @param dateSeparator The date separator. -

Valid values include: -

    -
  • "/" (slash) -
  • "-" (dash) -
  • "." (period) -
  • "," (comma) -
  • " " (space) -
  • "" (server job value) - default. -
- The default value is based on the server job. - **/ - public void setDateSeparator(String dateSeparator) - { - final String property = "dateSeparator"; - if (dateSeparator == null) - throw new NullPointerException(property); - validateProperty(property, dateSeparator, JDProperties.DATE_SEPARATOR); - - properties_.setString(JDProperties.DATE_SEPARATOR, dateSeparator); - } - - //@DFA - /** - Sets the decfloat rounding mode. - @param decfloatRoundingMode The decfloat rounding mode. -

Valid values include: -

    -
  • "half even" - default -
  • "half up" -
  • "down" -
  • "ceiling" -
  • "floor" -
  • "half down" -
  • "up" -
- **/ - public void setDecfloatRoundingMode(String decfloatRoundingMode) - { - String property = "decfloatRoundingMode"; - if (decfloatRoundingMode == null) - throw new NullPointerException(property); - validateProperty(property, decfloatRoundingMode, JDProperties.DECFLOAT_ROUNDING_MODE); - - getDecfloatRoundingMode(); - - properties_.setString(JDProperties.DECFLOAT_ROUNDING_MODE, decfloatRoundingMode); - } - - /** - Sets the decimal separator used in numeric literals within SQL - statements. - @param decimalSeparator The decimal separator. -

Valid values include: -

    -
  • "." (period) -
  • "," (comma) -
  • "" (server job value) - default. -
- The default value is based on the server job. - **/ - public void setDecimalSeparator(String decimalSeparator) - { - final String property = "decimalSeparator"; - if (decimalSeparator == null) - throw new NullPointerException(property); - validateProperty(property, decimalSeparator, JDProperties.DECIMAL_SEPARATOR); - - properties_.setString(JDProperties.DECIMAL_SEPARATOR, decimalSeparator); - } - - //@igwrn - /** - * Sets the ignore warnings property. - * @param ignoreWarnings Specifies a list of SQL states for which the driver should not create warning objects. - **/ - public void setIgnoreWarnings(String ignoreWarnings) - { - String property = "ignoreWarnings"; - if (ignoreWarnings == null) - throw new NullPointerException(property); - - properties_.setString(JDProperties.IGNORE_WARNINGS, ignoreWarnings); - } - - /** - Sets the data source description. - @param description The description. - **/ - public void setDescription(String description) - { - final String property = DESCRIPTION; - if (description == null) - throw new NullPointerException(property); - - description_ = description; - logProperty(property, description_); - } - - /** - Sets how the IBM i system sorts records before sending them to the client. - @param sort The sort value. -

Valid values include: -

    -
  • "hex" (base the sort on hexadecimal values) -
  • "language" (base the sort on the language set in the sort language property) -
  • "table" (base the sort on the sort sequence table set in the sort table property). -
- The default value is "hex". - **/ - public void setSort(String sort) - { - final String property = "sort"; - if (sort == null) - throw new NullPointerException(property); - - //@JOB fix to allow "sort=job" but use default value - if(sort.equals("job")) //@JOB - { //@JOB - if (JDTrace.isTraceOn()) //@JOB - JDTrace.logInformation (this, property + ": " + getSort() + " (warning: " + getSort() + " will be used since sort=job is not valid)"); //@JOB - return; //return and allow default setting to be used //@JOB - } //@JOB - - validateProperty(property, sort, JDProperties.SORT); - - properties_.setString(JDProperties.SORT, sort); - } - - /** - Sets the amount of detail to be returned in the message for errors - occurring on the IBM i system. - @param errors The error message level. - Valid values include: "basic" and "full". The default value is "basic". - **/ - public void setErrors(String errors) - { - final String property = "errors"; - if (errors == null) - throw new NullPointerException(property); - validateProperty(property, errors, JDProperties.ERRORS); - - properties_.setString(JDProperties.ERRORS, errors); - } - - /** - Sets whether to use extended dynamic support. Extended dynamic - support provides a mechanism for caching dynamic SQL statements on - the IBM i system. The first time a particular SQL statement is prepared, it is - stored in an SQL package on the system. - If the package does not exist, it will be automatically created. - On subsequent prepares of the - same SQL statement, the system can skip a significant part of the - processing by using information stored in the SQL package. If this - is set to "true", then a package name must be set using the "package" - property. - @param extendedDynamic If extended dynamic support is used; false otherwise. - The default value is not to use extended dynamic support. - **/ - public void setExtendedDynamic(boolean extendedDynamic) - { - if (extendedDynamic) - properties_.setString(JDProperties.EXTENDED_DYNAMIC, TRUE_); - else - properties_.setString(JDProperties.EXTENDED_DYNAMIC, FALSE_); - } - - /** - Sets whether the driver should request extended metadata from the - IBM i system. This property is ignored when connecting to systems - running V5R1 and earlier versions of OS/400. - If this property is set to true and connecting to a system running - V5R2 or later version of IBM i, the accuracy of the information - that is returned from ResultSetMetaData methods getColumnLabel(int), - isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased. - In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this - property set to true. However, performance will be slower with this - property on. Leave this property set to its default (false) unless you - need more specific information from those methods. - * - For example, without this property turned on, isSearchable(int) will - always return true even though the correct answer may be false because - the driver does not have enough information from the system to make a judgment. Setting - this property to true forces the driver to get the correct data from the system. - * - @param extendedMetaData True to request extended metadata from the system, false otherwise. - The default value is false. - **/ - public void setExtendedMetaData(boolean extendedMetaData) - { - if (extendedMetaData) - properties_.setString(JDProperties.EXTENDED_METADATA, TRUE_); - else - properties_.setString(JDProperties.EXTENDED_METADATA, FALSE_); - } - - - - //@dup - /** - * Sets whether the driver should request extended metadata from the - * IBM i system. This property is ignored when connecting to systems - * running OS/400 V5R1 and earlier. - * If this property is set to true and connecting to a system running - * OS/400 V5R2 or IBM i, the accuracy of the information - * that is returned from ResultSetMetaData methods getColumnLabel(int), - * isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased. - * In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this - * property set to true. However, performance will be slower with this - * property on. Leave this property set to its default (false) unless you - * need more specific information from those methods. - * - * For example, without this property turned on, isSearchable(int) will - * always return true even though the correct answer may be false because - * the driver does not have enough information from the system to make a judgment. Setting - * this property to true forces the driver to get the correct data from the system. - * - * @param extendedMetaData True to request extended metadata from the system, false otherwise. - * The default value is false. - * Note: this method is the same as setExtendedMetaData() so that it corresponds to the connection property name - **/ - public void setExtendedMetadata(boolean extendedMetaData) - { - setExtendedMetaData(extendedMetaData); - } - - - /** - Sets whether to fully open a file when performing a query. - By default the IBM i system optimizes opens so they perform better. - In most cases optimization functions correctly and improves - performance. Running a query repeatedly - when a database performance monitor is turned on may fail - because of the optimization, however. - Leave this property set to its default (false) until - you experience errors running queries with monitors - turned on. At that time set the property to true which - will disable the optimization. - @param fullOpen True to fully open a file (turn off optimizations), false - to allow optimizations. The default value is false. - **/ - public void setFullOpen(boolean fullOpen) - { - if (fullOpen) - properties_.setString(JDProperties.FULL_OPEN, TRUE_); - else - properties_.setString(JDProperties.FULL_OPEN, FALSE_); - } - - - /** - Sets the "hold input locators" property - @param hold True to hold input locators. The default value is true. - **/ - public void setHoldInputLocators(boolean hold) - { - if (hold) - properties_.setString(JDProperties.HOLD_LOCATORS, TRUE_); - else - properties_.setString(JDProperties.HOLD_LOCATORS, FALSE_); - } - - - /** - Sets the "hold statements" property - @param hold True to hold statements. The default value is false. - **/ - public void setHoldStatements(boolean hold) - { - if (hold) - properties_.setString(JDProperties.HOLD_STATEMENTS, TRUE_); - else - properties_.setString(JDProperties.HOLD_STATEMENTS, FALSE_); - } - - //@dmy - /** - * Indicates whether the temporary fix for JVM 1.6 is enabled. - * @param value true if JVM 1.6 fix is enabled; false otherwise. - * The default value is true. - **/ - public void setJvm16Synchronize(boolean value) - { - if (value) - properties_.setString(JDProperties.JVM16_SYNCHRONIZE, TRUE_); - else - properties_.setString(JDProperties.JVM16_SYNCHRONIZE, FALSE_); - } - - /** - Sets whether to delay closing cursors until subsequent requests. - @param lazyClose true to delay closing cursors until subsequent requests; false otherwise. - The default value is false. - **/ - public void setLazyClose(boolean lazyClose) - { - if (lazyClose) - properties_.setString(JDProperties.LAZY_CLOSE, TRUE_); - else - properties_.setString(JDProperties.LAZY_CLOSE, FALSE_); - } - - /** - Sets the libraries to add to the server job's library list. - The libraries are delimited by commas or spaces, and - "*LIBL" may be used as a place holder for the server job's - current library list. The library list is used for resolving - unqualified stored procedure calls and finding schemas in - DatabaseMetaData catalog methods. If "*LIBL" is not specified, - the specified libraries will replace the server job's - current library list. - @param libraries The library list. - **/ - public void setLibraries(String libraries) - { - final String property = "libraries"; - if (libraries == null) - throw new NullPointerException(property); - properties_.setString(JDProperties.LIBRARIES, libraries); - } - - /** - Sets the maximum LOB (large object) size in bytes that - can be retrieved as part of a result set. LOBs that are larger - than this threshold will be retrieved in pieces using extra - communication to the IBM i system. Larger LOB thresholds will reduce - the frequency of communication to the system, but will download - more LOB data, even if it is not used. Smaller LOB thresholds may - increase frequency of communication to the system, but will only - download LOB data as it is needed. - * - @param threshold The lob threshold. Valid range is 0-16777216. - The default value is 32768. - **/ - public void setLobThreshold(int threshold) - { - final String property = "threshold"; - if (threshold < 0 || threshold > MAX_THRESHOLD) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - properties_.setString(JDProperties.LOB_THRESHOLD, new Integer(threshold).toString()); - } - - // method required by javax.sql.DataSource - /** - Sets the maximum time in seconds that this data source can wait while attempting to connect to a database. - A value of zero specifies that the timeout is the system default if one exists; otherwise it specifies that - there is no timeout. The default value is initially zero. -
Note: This value is not used or supported by the Toolbox JDBC driver. - Rather, the timeout value is determined by the IBM i system. - @param timeout The login timeout in seconds. - **/ - public void setLoginTimeout(int timeout) throws SQLException - { - //This sets the socket timeout - //@STIMEOUT setSoTimeout(timeout * 1000); //@STIMEOUT separate login and socket timeout into two separtate properties - - properties_.setString(JDProperties.LOGIN_TIMEOUT, Integer.toString(timeout)); - } - - // method required by javax.sql.DataSource - /** - Sets the log writer for this data source. -

Note: The specified PrintWriter might not be retained when an object is obtained via JNDI, that is, by a call to javax.naming.Context.lookup(). Therefore, use this method only on the DataSource object that is used directly by your application (rather than on the "template" DataSource object that was bound in JNDI). - @param writer The log writer; to disable, set to null. - @throws SQLException If a database error occurs. - **/ - public void setLogWriter(PrintWriter writer) throws SQLException - { - writer_ = writer; - logProperty("logWriter", (writer_ == null ? "null" : writer_.toString())); - - if (writer == null) - { - log_ = null; - } - else - { - log_ = new EventLog(writer); - } - } - - //@PDA - /** - * Sets how to retrieve DatabaseMetaData. - * If set to 0, database metadata will be retrieved through the ROI data flow. - * If set to 1, database metadata will be retrieved by calling system stored procedures. - * The methods that currently are available through stored procedures are: - * getColumnPrivileges - * @param mds The setting for metadata source - * The default value is 1. - **/ - public void setMetaDataSource(int mds) - { - Integer newValue = new Integer(mds); - - properties_.setString(JDProperties.METADATA_SOURCE, newValue.toString()); - - } - - //@dup - /** - * Sets how to retrieve DatabaseMetaData. - * If set to 0, database metadata will be retrieved through the ROI data flow. - * If set to 1, database metadata will be retrieved by calling system stored procedures. - * The methods that currently are available through stored procedures are: - * getColumnPrivileges - * @param mds The setting for metadata source - * The default value is 1. - * Note: this method is the same as setMetaDataSource() so that it corresponds to the connection property name - **/ - public void setMetadataSource(int mds) - { - setMetaDataSource(mds); - } - - - /** - Sets the naming convention used when referring to tables. - @param naming The naming convention. Valid values include: "sql" (e.g. schema.table) - and "system" (e.g. schema/table). The default value is "sql". - **/ - public void setNaming(String naming) - { - final String property = "naming"; - if (naming == null) - throw new NullPointerException(property); - validateProperty(property, naming, JDProperties.NAMING); - - properties_.setString(JDProperties.NAMING, naming); - } - - /** - Sets the base name of the SQL package. Note that only the - first six characters are used to generate the name of the SQL package on the IBM i system. - This property has no effect unless - the extended dynamic property is set to true. In addition, this property - must be set if the extended dynamic property is set to true. - @param packageName The base name of the SQL package. - **/ - public void setPackage(String packageName) - { - final String property = "packageName"; - if (packageName == null) - throw new NullPointerException(property); - - properties_.setString(JDProperties.PACKAGE, packageName); - } - - /** - Sets whether to add newly prepared statements to the SQL package - specified on the "package" property. This property - has no effect unless the extended dynamic property is set to true. - @param add True if newly prepared statements should be added to the SQL package specified on - the "package" property; false otherwise. - The default value is true. - **/ - public void setPackageAdd(boolean add) - { - if (add) - properties_.setString(JDProperties.PACKAGE_ADD, TRUE_); - else - properties_.setString(JDProperties.PACKAGE_ADD, FALSE_); - } - - /** - Sets whether to cache a subset of the SQL package information in client memory. - Caching SQL packages locally - reduces the amount of communication to the IBM i system for prepares and describes. This - property has no effect unless the extended dynamic property is set to true. - @param cache True if caching is used; false otherwise. The default value is false. - **/ - public void setPackageCache(boolean cache) - { - if (cache) - properties_.setString(JDProperties.PACKAGE_CACHE, TRUE_); - else - properties_.setString(JDProperties.PACKAGE_CACHE, FALSE_); - } - - /** - Sets whether to clear SQL packages when they become full. This method - has been deprecated. Package clearing and the decision for the - threshold where package clearing is needed is now handled - automatically by the database. - @param clear If the SQL package are cleared when full; false otherwise. - @deprecated - **/ - public void setPackageClear(boolean clear) - { - } - - /** - Sets the type of SQL statement to be stored in the SQL package. This can - be useful to improve the performance of complex join conditions. This - property has no effect unless the extended dynamic property is set to true. - @param packageCriteria The type of SQL statement. - Valid values include: "default" (only store SQL statements with parameter - markers in the package), and "select" (store all SQL SELECT statements - in the package). The default value is "default". - **/ - public void setPackageCriteria(String packageCriteria) - { - final String property = "packageCriteria"; - - if (packageCriteria == null) - throw new NullPointerException(property); - validateProperty(property, packageCriteria, JDProperties.PACKAGE_CRITERIA); - - properties_.setString(JDProperties.PACKAGE_CRITERIA, packageCriteria); - } - - /** - Sets the action to take when SQL package errors occur. When an SQL package - error occurs, the driver will optionally throw an SQLException or post a - warning to the Connection, based on the value of this property. This property - has no effect unless the extended dynamic property is set to true. - @param packageError The action when SQL errors occur. - Valid values include: "exception", "warning", and "none". The default value is "warning". - **/ - public void setPackageError(String packageError) - { - final String property = "packageError"; - if (packageError == null) - throw new NullPointerException(property); - validateProperty(property, packageError, JDProperties.PACKAGE_ERROR); - - properties_.setString(JDProperties.PACKAGE_ERROR, packageError); - } - - /** - Sets the library for the SQL package. This property has no effect unless - the extended dynamic property is set to true. - @param packageLibrary The SQL package library. The default package library is "QGPL". - **/ - public void setPackageLibrary(String packageLibrary) - { - final String property = "packageLibrary"; - if (packageLibrary == null) - throw new NullPointerException(property); - - properties_.setString(JDProperties.PACKAGE_LIBRARY, packageLibrary); - } - - /** - Sets the 'password' property. - @param password The password. - **/ - public void setPassword(String password) - { - final String property = "password"; - if (password == null) - throw new NullPointerException(property); - - char[] newSerialPWBytes = xpwConfuse(password); - if (!Arrays.equals(newSerialPWBytes, serialPWBytes_)) { - as400_.setPassword(password); - invalidate(getUser(), serialPWBytes_); // invalidate any pooled connections with old password - serialPWBytes_ = newSerialPWBytes; - pwHashcode_ = password.hashCode(); - - connectionKeyNeedsUpdate_ = true; - // Note: We deliberately do _not_ store the password into properties_. - } - logInformation(ResourceBundleLoader.getText("AS400_JDBC_DS_PASSWORD_SET")); - logProperty(property, "***"); - } - - /** - Sets whether to prefetch data upon executing a SELECT statement. - This will increase performance when accessing the initial rows in the result set. - @param prefetch If prefetch is used; false otherwise. - The default value is to prefectch data. - **/ - public void setPrefetch(boolean prefetch) - { - if (prefetch) - properties_.setString(JDProperties.PREFETCH, TRUE_); - else - properties_.setString(JDProperties.PREFETCH, FALSE_); - } - - /** - Sets whether the user should be prompted if a user name or password is - needed to connect to the IBM i system. If a connection can not be made - without prompting the user, and this property is set to false, then an - attempt to connect will fail. - @param prompt true if the user is prompted for signon information; false otherwise. - The default value is false. - **/ - public void setPrompt(boolean prompt) - { - if (prompt) - properties_.setString(JDProperties.PROMPT, TRUE_); - else - properties_.setString(JDProperties.PROMPT, FALSE_); - - try - { - as400_.setGuiAvailable(prompt); - } - catch (PropertyVetoException vp) {} // this will never happen - } - - //@PDA - /** - * Sets the properties based on ";" delimited string of properties, in same - * fashion as URL properties specified with - * DriverManager.getConnection(urlProperties). This method simply parses - * property string and then calls setPropertes(Properties). This method is - * intended as an enhancement so that the user does not have to write new - * code to call the setters for new/deleted properties. - * - * @param propertiesString list of ";" delimited properties - */ - public void setProperties(String propertiesString) - { - //use existing JDDatasourceURL to parse properties string like Connection does - //but first have to add dummy protocol so we can re-use parsing code - propertiesString = "jdbc:as400://dummyhost;" + propertiesString; - JDDataSourceURL dsURL = new JDDataSourceURL(propertiesString); - //returns only properties specified in propertyString.. (none of - // JDProperties defaults) - Properties properties = dsURL.getProperties(); - setProperties(properties); - } - - //@PDA - /** - * Sets the properties for this datasource. This method is intended as an - * enhancement so that the user does not have to write new code to call the - * setters for new/deleted properties. - * - * @param newProperties object containing updated property values - */ - public void setProperties(Properties newProperties) - { - //1. turn on/off tracing per new props - //2. set needed AS400JDBCManagedDataSource instance variables - //3. set socket props - //4. propagate newProperties to existing properties_ object - - // Check first thing to see if the trace property is - // turned on. This way we can trace everything, including - // the important stuff like loading the properties. - - // If trace property was set to true, turn on tracing. If trace property - // was set to false, - // turn off tracing. If trace property was not set, do not change. - if (JDProperties.isTraceSet(newProperties, null) == JDProperties.TRACE_SET_ON) - { - if (!JDTrace.isTraceOn()) - JDTrace.setTraceOn(true); - } else if (JDProperties.isTraceSet(newProperties, null) == JDProperties.TRACE_SET_OFF) - { - if (JDTrace.isTraceOn()) - JDTrace.setTraceOn(false); - } - - // If toolbox trace is set to datastream. Turn on datastream tracing. - if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_DATASTREAM) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDatastreamOn(true); - } - // If toolbox trace is set to diagnostic. Turn on diagnostic tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_DIAGNOSTIC) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDiagnosticOn(true); - } - // If toolbox trace is set to error. Turn on error tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_ERROR) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceErrorOn(true); - } - // If toolbox trace is set to information. Turn on information tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_INFORMATION) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceInformationOn(true); - } - // If toolbox trace is set to warning. Turn on warning tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_WARNING) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceWarningOn(true); - } - // If toolbox trace is set to conversion. Turn on conversion tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_CONVERSION) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceConversionOn(true); - } - // If toolbox trace is set to proxy. Turn on proxy tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_PROXY) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceProxyOn(true); - } - // If toolbox trace is set to pcml. Turn on pcml tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_PCML) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTracePCMLOn(true); - } - // If toolbox trace is set to jdbc. Turn on jdbc tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_JDBC) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceJDBCOn(true); - } - // If toolbox trace is set to all. Turn on tracing for all categories. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_ALL) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceAllOn(true); - } - // If toolbox trace is set to thread. Turn on thread tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_THREAD) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceThreadOn(true); - } - // If toolbox trace is set to none. Turn off tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_NONE) - { - if (Trace.isTraceOn()) - { - Trace.setTraceOn(false); - } - } - - //next we need to set instance vars (via setX() methods) - //or setup socket properties or set in properties_ - //Note: this is similar to AS400JDBCManagedDataSource(Reference reference)logic - - Enumeration e = newProperties.keys(); - while (e.hasMoreElements()) - { - String propertyName = (String) e.nextElement(); - String propertyValue = (String) newProperties.getProperty(propertyName); - - int propIndex = JDProperties.getPropertyIndex(propertyName); - - //some of the setter methods also set the properties_ below - if (propIndex == JDProperties.DATABASE_NAME) - setDatabaseName(propertyValue); - else if (propIndex == JDProperties.USER) - setUser(propertyValue); - else if (propIndex == JDProperties.PASSWORD) - setPassword(properties_.getString(JDProperties.PASSWORD)); - else if (propIndex == JDProperties.SECURE) - setSecure(propertyValue.equals(TRUE_) ? true : false); - else if (propIndex == JDProperties.KEEP_ALIVE) - setKeepAlive(propertyValue.equals(TRUE_) ? true : false); - else if (propIndex == JDProperties.RECEIVE_BUFFER_SIZE) - setReceiveBufferSize(Integer.parseInt(propertyValue)); - else if (propIndex == JDProperties.SEND_BUFFER_SIZE) - setSendBufferSize(Integer.parseInt(propertyValue)); - else if (propIndex == JDProperties.PROMPT) - setPrompt(propertyValue.equals(TRUE_) ? true : false); - else if (propIndex == JDProperties.KEY_RING_NAME){ - //at this time, decided to not allow this due to security and fact that there is no setKeyRingName() method - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Property: " + propertyName + " can only be changed in AS400JDBCManagedDataSource constructor"); - } else if (propIndex == JDProperties.KEY_RING_PASSWORD){ - //at this time, decided to not allow this due to security and fact that there is no setKeyRingPassword() method - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Property: " + propertyName + " can only be changed in AS400JDBCManagedDataSource constructor"); - } else if (propIndex != -1) - { - properties_.setString(propIndex, propertyValue); - } - } - } - - - /** - Sets the name of the proxy server. - @param proxyServer The proxy server. - **/ - public void setProxyServer(String proxyServer) - { - final String property = "proxyServer"; - if (proxyServer == null) - throw new NullPointerException(property); - - properties_.setString(JDProperties.PROXY_SERVER, proxyServer); - } - - /** - Sets the "query optimize goal" property - @param goal - the optimization goal -

Valid values include: -

    -
  • 0 = Optimize query for first block of data (*ALLIO) when extended dynamic packages are used; Optimize query for entire result set (*FIRSTIO) when packages are not used
  • -
  • 1 = Optimize query for first block of data (*FIRSTIO)
  • -
  • 2 = Optimize query for entire result set (*ALLIO)
  • -
- The default value is 0. - **/ - public void setQueryOptimizeGoal(int goal) - { - String property = "queryOptimizeGoal"; - validateProperty(property, Integer.toString(goal), JDProperties.QUERY_OPTIMIZE_GOAL); - - properties_.setString(JDProperties.QUERY_OPTIMIZE_GOAL, Integer.toString(goal)); - } - - //@550 - /** - * Sets the storage limit in megabytes, that should be used for statements executing a query in a connection. - * Note, this setting is ignored when running to i5/OS V5R4 or earlier - * @param limit - the storage limit (in megabytes) - *

Valid values are -1 to MAX_STORAGE_LIMIT megabytes. - * The default value is -1 meaning there is no limit. - **/ - public void setQueryStorageLimit(int limit) - { - String property = "queryStorageLimit"; - - if (limit < -1 || limit > MAX_STORAGE_LIMIT) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - properties_.setString(JDProperties.QUERY_STORAGE_LIMIT, Integer.toString(limit)); - } - - /** - Sets the source of the text for REMARKS columns in ResultSets returned - by DatabaseMetaData methods. - @param remarks The text source. - Valid values include: "sql" (SQL object comment) and "system" (IBM i object description). - The default value is "system". - **/ - public void setRemarks(String remarks) - { - final String property = "remarks"; - if (remarks == null) - throw new NullPointerException(property); - validateProperty(property, remarks, JDProperties.REMARKS); - - properties_.setString(JDProperties.REMARKS, remarks); - } - - /** - Sets the "rollback cursor hold" property - @param hold True to hold cursor across rollbacks. The default value is false. - **/ - public void setRollbackCursorHold(boolean hold) - { - if (hold) - properties_.setString(JDProperties.ROLLBACK_CURSOR_HOLD, TRUE_); - else - properties_.setString(JDProperties.ROLLBACK_CURSOR_HOLD, FALSE_); - } - - /** - Sets the secondary URL to be used for a connection on the middle-tier's - DriverManager in a multiple tier environment, if it is different than - already specified. This property allows you to use this driver to connect - to databases other than DB2 for IBM i. Use a backslash as an escape character - before backslashes and semicolons in the URL. - @param url The secondary URL. - **/ - public void setSecondaryUrl(String url) - { - if (url == null) - throw new NullPointerException("url"); - - properties_.setString(JDProperties.SECONDARY_URL, url); - } - - //@dup - /** - * Sets the secondary URL to be used for a connection on the middle-tier's - * DriverManager in a multiple tier environment, if it is different than - * already specified. This property allows you to use this driver to connect - * to databases other than DB2 for IBM i. Use a backslash as an escape character - * before backslashes and semicolons in the URL. - * @param url The secondary URL. - * Note: this method is the same as setSecondaryUrl() so that it corresponds to the connection property name - **/ - public void setSecondaryURL(String url) - { - setSecondaryUrl(url); - } - - - /** - Sets whether a Secure Socket Layer (SSL) connection is used to communicate - with the IBM i system. SSL connections are only available when connecting to systems - at V4R4 or later. - @param secure true if Secure Socket Layer connection is used; false otherwise. - The default value is false. - @throws ExtendedIllegalStateException If the data source was constructed with a keyring and secure is false. - **/ - public void setSecure(boolean secure) - { - // Do not allow user to change to not secure if they constructed the data source with - // a keyring. - if (!secure && isSecure_) - { - throw new ExtendedIllegalStateException("secure", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // Keep local copy for convenience. - isSecure_ = secure; - - if (secure) - properties_.setString(JDProperties.SECURE, TRUE_); - else - properties_.setString(JDProperties.SECURE, FALSE_); - } - - - //@pw3 - /** - * Sets whether to disallow "" and *current as user name and password. - * True indicates to disallow "" and *current for user name and password. - * @param secureCurrentUser The secure current user setting. - **/ - public void setSecureCurrentUser(boolean secureCurrentUser) - { - if (secureCurrentUser) - properties_.setString(JDProperties.SECURE_CURRENT_USER, TRUE_); - else - properties_.setString(JDProperties.SECURE_CURRENT_USER, FALSE_); - } - - - /** - Sets the serverName property. - @param serverName The system name. - @throws ExtendedIllegalStateException If the data source is already in use. - **/ - public void setServerName(String serverName) - { - final String property = SERVER_NAME; - - if (isInUse()) { - logError("Data source is already in use"); - throw new ExtendedIllegalStateException(property, ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (serverName == null) - throw new NullPointerException(property); - - // Save away the name to serialize. - serialServerName_ = serverName; // Note: There is no associated JDProperties entry. - - try - { - as400_.setSystemName(serverName); - } - catch (PropertyVetoException pv) {} // will never happen - - connectionKeyNeedsUpdate_ = true; - - logProperty(property, as400_.getSystemName()); - } - - - /** - Enables tracing of the JDBC server job. - If tracing is enabled, tracing is started when - the client connects to the IBM i system, and ends when the connection - is disconnected. Tracing must be started before connecting to - the system since the client enables tracing only at connect time. - * -

- Trace data is collected in spooled files on the system. Multiple - levels of tracing can be turned on in combination by adding - the constants and passing that sum on the set method. For example, -

-   dataSource.setServerTraceCategories(AS400JDBCManagedDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCManagedDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
-   
- @param traceCategories level of tracing to start. -

Valid values include: -

    -
  • SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job. - The numeric value of this constant is 2. -
  • SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job. - The numeric value of this constant is 4. -
  • SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends. - The numeric value of this constant is 8. -
  • SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job. - The numeric value of this constant is 16. -
  • SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information. - The numeric value of this constant is 32. -
-

- Tracing the JDBC server job will use significant amounts of system resources. - Additional processor resource is used to collect the data, and additional - storage is used to save the data. Turn on tracing only to debug - a problem as directed by IBM service. - * - * - **/ - public void setServerTraceCategories(int traceCategories) - { - properties_.setString(JDProperties.TRACE_SERVER, Integer.toString(traceCategories)); - } - - /** - Enables tracing of the JDBC server job. - If tracing is enabled, tracing is started when - the client connects to the IBM i system, and ends when the connection - is disconnected. Tracing must be started before connecting to - the system since the client enables tracing only at connect time. - * -

- Trace data is collected in spooled files on the system. Multiple - levels of tracing can be turned on in combination by adding - the constants and passing that sum on the set method. For example, -

-   dataSource.setServerTraceCategories(AS400JDBCManagedDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCManagedDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
-   
- @param traceCategories level of tracing to start. -

Valid values include: -

    -
  • SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job. - The numeric value of this constant is 2. -
  • SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job. - The numeric value of this constant is 4. -
  • SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends. - The numeric value of this constant is 8. -
  • SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job. - The numeric value of this constant is 16. -
  • SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information. - The numeric value of this constant is 32. -
-

- Tracing the JDBC server job will use significant amounts of system resources. - Additional processor resource is used to collect the data, and additional - storage is used to save the data. Turn on tracing only to debug - a problem as directed by IBM service. - * Note: this method is the same as setServerTraceCategories() so that it corresponds to the connection property name - **/ - public void setServerTrace(int traceCategories) - { - setServerTraceCategories(traceCategories); - } - - /** - Sets the JDBC driver implementation. - This property has no - effect if the "secondary URL" property is set. - This property cannot be set to "native" if the - environment is not an IBM i Java Virtual - Machine. - param driver The driver value. -

Valid values include: -

    -
  • "toolbox" (use the IBM Toolbox for Java JDBC driver) -
  • "native" (use the IBM Developer Kit for Java JDBC driver) -
- The default value is "toolbox". - Note: Not supported in a connection pool. - **/ - public void setDriver(String driver) - { - final String property = "driver"; - if (driver == null) - throw new NullPointerException(property); - - validateProperty(property, driver, JDProperties.DRIVER); - - properties_.setString(JDProperties.DRIVER, driver); - } - - /** - Sets whether to save the password locally with the rest of the properties when - this data source object is serialized. -

- If the password is saved, it is up to the application to protect - the serialized form of the object because it contains all necessary - information to connect to the IBM i system. The default is false. It - is a security risk to save the password with the rest of the - properties so by default the password is not saved. If the application - programmer chooses to accept this risk, set this property to true - to force the Toolbox to save the password with the other properties - when the data source object is serialized. - * - @param savePassword true if the password is saved; false otherwise. - The default value is false - **/ - public void setSavePasswordWhenSerialized(boolean savePassword) - { - final String property = "savePasswordWhenSerialized"; - - savePasswordWhenSerialized_ = savePassword; - - logProperty(property, String.valueOf(savePasswordWhenSerialized_)); //@jvm13 Boolean.toString(savePasswordWhenSerialized_)); - } - - //@STIMEOUT - /** - * This property enables/disables socket timeout with the - * specified value in milliseconds. A timeout value must be - * greater than zero, a value of zero for this property indicates - * infinite timeout. - * @param milliseconds The socket timeout option value. - **/ - public void setSocketTimeout(int milliseconds) - { - setSoTimeout(milliseconds); - } - - /** - Sets the three-character language id to use for selection of a sort sequence. - This property has no effect unless the sort property is set to "language". - @param language The three-character language id. - The default value is ENU. - **/ - public void setSortLanguage(String language) - { - if (language == null) - throw new NullPointerException("language"); - - properties_.setString(JDProperties.SORT_LANGUAGE, language); - } - - /** - Sets the library and file name of a sort sequence table stored on the - IBM i system. - This property has no effect unless the sort property is set to "table". - The default is an empty String (""). - @param table The qualified sort table name. - **/ - public void setSortTable(String table) - { - if (table == null) - throw new NullPointerException("table"); - - properties_.setString(JDProperties.SORT_TABLE, table); - } - - /** - Sets how the IBM i system treats case while sorting records. This property - has no effect unless the sort property is set to "language". - @param sortWeight The sort weight. - Valid values include: "shared" (upper- and lower-case characters are sorted as the - same character) and "unique" (upper- and lower-case characters are sorted as - different characters). The default value is "shared". - **/ - public void setSortWeight(String sortWeight) - { - final String property = "sortWeight"; - if (sortWeight == null) - throw new NullPointerException(property); - - validateProperty(property, sortWeight, JDProperties.SORT_WEIGHT); - - properties_.setString(JDProperties.SORT_WEIGHT, sortWeight); - } - - /** - Sets whether a thread is used. - @param threadUsed true if a thread is used; false otherwise. - The default value is true. - **/ - public void setThreadUsed(boolean threadUsed) - { - if (threadUsed) - properties_.setString(JDProperties.THREAD_USED, TRUE_); - else - properties_.setString(JDProperties.THREAD_USED, FALSE_); - } - - /** - Sets the time format used in time literals with SQL statements. - @param timeFormat The time format. -

Valid values include: -

    -
  • "hms" -
  • "usa" -
  • "iso" -
  • "eur" -
  • "jis" -
  • "" (server job value) - default. -
- The default value is based on the server job. - **/ - public void setTimeFormat(String timeFormat) - { - final String property = "timeFormat"; - if (timeFormat == null) - throw new NullPointerException(property); - validateProperty(property, timeFormat, JDProperties.TIME_FORMAT); - - properties_.setString(JDProperties.TIME_FORMAT, timeFormat); - } - - /** - Sets the time separator used in time literals within SQL statements. - This property has no effect unless the time format property is set to "hms". - @param timeSeparator The time separator. -

Valid values include: -

    -
  • ":" (colon) -
  • "." (period) -
  • "," (comma) -
  • " " (space) -
  • "" (server job value) - default. -
- The default value is based on the server job. - **/ - public void setTimeSeparator(String timeSeparator) - { - final String property = "timeSeparator"; - if (timeSeparator == null) - throw new NullPointerException(property); - validateProperty(property, timeSeparator, JDProperties.TIME_SEPARATOR); - - properties_.setString(JDProperties.TIME_SEPARATOR, timeSeparator); - } - - /** - Sets whether trace messages should be logged. Trace messages are - useful for debugging programs that call JDBC. However, there is a - performance penalty associated with logging trace messages, so this - property should only be set to true for debugging. Trace messages - are logged to System.out. - @param trace true if trace message are logged; false otherwise. - The default value is false. - **/ - public void setTrace(boolean trace) - { - if (trace) - properties_.setString(JDProperties.TRACE, TRUE_); - else - properties_.setString(JDProperties.TRACE, FALSE_); - - if (trace) - { - if (!JDTrace.isTraceOn ()) - JDTrace.setTraceOn (true); - } - else - JDTrace.setTraceOn (false); - } - - - /** - Sets the IBM i system's transaction isolation. - @param transactionIsolation The transaction isolation level. -

Valid values include: -

    -
  • "none" -
  • "read uncommitted" - The default value. -
  • "read committed" -
  • "repeatable read" -
  • "serializable" -
- **/ - public void setTransactionIsolation(String transactionIsolation) - { - final String property = "transactionIsolation"; - - if (transactionIsolation == null) - throw new NullPointerException(property); - validateProperty(property, transactionIsolation, JDProperties.TRANSACTION_ISOLATION); - - properties_.setString(JDProperties.TRANSACTION_ISOLATION, transactionIsolation); - } - - /** - Sets whether binary data is translated. If this property is set - to true, then BINARY and VARBINARY fields are treated as CHAR and - VARCHAR fields. - @param translate true if binary data is translated; false otherwise. - The default value is false. - **/ - public void setTranslateBinary(boolean translate) - { - if (translate) - properties_.setString(JDProperties.TRANSLATE_BINARY, TRUE_); - else - properties_.setString(JDProperties.TRANSLATE_BINARY, FALSE_); - } - - //@PDA - /** - * Sets how Boolean objects are interpreted when setting the value - * for a character field/parameter using the PreparedStatement.setObject(), - * CallableStatement.setObject() or ResultSet.updateObject() methods. Setting the - * property to "true", would store the Boolean object in the character field as either - * "true" or "false". Setting the property to "false", would store the Boolean object - * in the character field as either "1" or "0". - * @param translate if boolean data is translated; false otherwise. - * The default value is true. - **/ - public void setTranslateBoolean(boolean translate) - { - if (translate) - properties_.setString(JDProperties.TRANSLATE_BOOLEAN, TRUE_); - else - properties_.setString(JDProperties.TRANSLATE_BOOLEAN, FALSE_); - } - - - /** - Sets the 'user' property. - @param user The user. - @throws ExtendedIllegalStateException If the data source is already in use. - **/ - public void setUser(String user) - { - final String property = "user"; - - if (isInUse()) { - logError("Data source is already in use"); - throw new ExtendedIllegalStateException(property, ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // save away the user to serialize - serialUserName_ = user; - - properties_.setString(JDProperties.USER, user); - - try { - as400_.setUserId(user); - } - catch (PropertyVetoException vp) {} // this will never happen - - connectionKeyNeedsUpdate_ = true; - } - - /** - Sets whether lock sharing is allowed for loosely coupled transaction branches. - Note, this setting is ignored when running to V5R3 IBM i or earlier. - @param lcs - the "XA loosely coupled support" setting -

Valid values include: -

    -
  • 0 = Locks cannot be shared
  • -
  • 1 = Locks can be shared
  • -
- The default value is 0. - **/ - public void setXALooselyCoupledSupport(int lcs) - { - String property = "xaLooselyCoupledSupport"; - validateProperty(property, Integer.toString(lcs), JDProperties.XA_LOOSELY_COUPLED_SUPPORT); - - properties_.setString(JDProperties.XA_LOOSELY_COUPLED_SUPPORT, Integer.toString(lcs)); - } - - - /** - Gets the socket 'keepalive' option. - @return The value of the keepalive option. - **/ - public boolean isKeepAlive() - { - return sockProps_.isKeepAlive(); - } - - /** - Gets the socket 'receive buffer size' option. NOTE: This does not get - the actual receive buffer size, only the option which is used as a hint - by the underlying socket code. - @return The value of the receive buffer size option. - **/ - public int getReceiveBufferSize() - { - return sockProps_.getReceiveBufferSize(); - } - - /** - Gets the socket 'send buffer size' option. NOTE: This does not get - the actual send buffer size, only the option which is used as a hint - by the underlying socket code. - @return The value of the send buffer size option. - **/ - public int getSendBufferSize() - { - return sockProps_.getSendBufferSize(); - } - - /** - Gets the socket 'linger' option, in milliseconds. - @return The value of the linger option. - **/ - public long getSoLinger() - { - return (long)(1000*sockProps_.getSoLinger()); - } - - /** - Gets the socket 'timeout' option in milliseconds. - @return The value of the timeout option. - **/ - public long getSoTimeout() - { - return (long)sockProps_.getSoTimeout(); - } - - /** - Gets the socket 'TCP no delay' option. - @return The value of the TCP no delay option. - **/ - public boolean isTcpNoDelay() - { - return sockProps_.isTcpNoDelay(); - } - - /** - Turns on the socket 'keepAlive' property. - @param keepAlive The keepalive option value. - **/ - public void setKeepAlive(boolean keepAlive) - { - sockProps_.setKeepAlive(keepAlive); - logProperty("keepAlive", String.valueOf(keepAlive)); //@jvm13 Boolean.toString(keepAlive)); - } - - /** - Sets the socket 'receive buffer size' option to the - specified value. The receive buffer size option is used as a hint - for the size to set the underlying network I/O buffers. Increasing - the receive buffer size can increase the performance of network - I/O for high-volume connection, while decreasing it can help reduce - the backlog of incoming data. This value must be greater than 0. - @param size The receive buffer size option value. - **/ - public void setReceiveBufferSize(int size) - { - sockProps_.setReceiveBufferSize(size); - logProperty("receiveBufferSize", Integer.toString(size)); - } - - /** - Sets the socket 'send buffer size' option to the - specified value. The send buffer size option is used by the - platform's networking code as a hint for the size to set the - underlying network I/O buffers. This value must be greater - than 0. - @param size The send buffer size option value. - **/ - public void setSendBufferSize(int size) - { - sockProps_.setSendBufferSize(size); - logProperty("sendBufferSize", Integer.toString(size)); - } - - /** - Sets the socket 'linger' property to the - specified linger time in milliseconds. The maximum value for this - property is platform specific. - @param milliseconds The linger option value. - **/ - public void setSoLinger(long milliseconds) - { - final String property = "soLinger"; - - if (milliseconds > Integer.MAX_VALUE) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - sockProps_.setSoLinger((int)(milliseconds/1000)); // called method expects seconds - logProperty(property, Long.toString(milliseconds)); - } - - /** - Enables/disables socket timeout with the - specified value in milliseconds. A timeout value must be - greater than zero, a value of zero for this property indicates - infinite timeout. - @param milliseconds The timeout option value. - **/ - public void setSoTimeout(long milliseconds) - { - final String property = "soTimeout"; - - if (milliseconds > Integer.MAX_VALUE) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - sockProps_.setSoTimeout((int)milliseconds); - logProperty(property, Long.toString(milliseconds)); - } - - /** - Sets the socket 'TCP no delay' option. - @param noDelay The TCP no delay option value. - **/ - public void setTcpNoDelay(boolean noDelay) - { - sockProps_.setTcpNoDelay(noDelay); - logProperty("tcpNoDelay", String.valueOf(noDelay)); //@jvm13 Boolean.toString(noDelay)); - } - - /** - Gets the package CCSID property, which indicates the - CCSID in which statements are sent to the IBM i system and - also the CCSID of the package they are stored in. - Default value: 13488 - @return The value of the package CCSID property. - **/ - public int getPackageCCSID() - { - return properties_.getInt(JDProperties.PACKAGE_CCSID); - } - - - //@dup - /** - * Gets the package CCSID property, which indicates the - * CCSID in which statements are sent to the IBM i system and - * also the CCSID of the package they are stored in. - * Default value: 13488 - * @return The value of the package CCSID property. - * Note: this method is the same as getPackageCCSID() so that it corresponds to the connection property name - **/ - public int getPackageCcsid() - { - return getPackageCCSID(); - } - - - /** - Sets the package CCSID property, which indicates the - CCSID in which statements are sent to the IBM i system and - also the CCSID of the package they are stored in. - Recommended values: 1200(UTF-16) and 13488 (UCS-2). - See BidiStringType for Bidi considerations. - Default value: 13488 - @param ccsid The package CCSID. - **/ - public void setPackageCCSID(int ccsid) - { - final String property = "packageCCSID"; - - validateProperty(property, Integer.toString(ccsid), JDProperties.PACKAGE_CCSID); - - properties_.setString(JDProperties.PACKAGE_CCSID, Integer.toString(ccsid)); - } - - //@dup - /** - * Sets the package CCSID property, which indicates the - * CCSID in which statements are sent to the IBM i system and - * also the CCSID of the package they are stored in. - * Recommended values: 1200(UTF-16) and 13488 (UCS-2). - * See BidiStringType for Bidi considerations. - * Default value: 13488 - * @param ccsid The package CCSID. - * Note: this method is the same as setPackageCCSID() so that it corresponds to the connection property name - **/ - public void setPackageCcsid(int ccsid) - { - setPackageCCSID(ccsid); - } - - - /** - Gets the minimum divide scale property. This property ensures the scale - of the result of decimal division is never less than its specified value. - Valid values: 0-9. 0 is default. - @return The minimum divide scale. - **/ - public int getMinimumDivideScale() - { - return properties_.getInt(JDProperties.MINIMUM_DIVIDE_SCALE); - } - - /** - * Gets the maximum block input rows. This property indicates the - * number of rows sent to the database engine for a block insert - * operation. Valid values: 1-32000. 32000 is default. - * @return The maximum block input rows - */ - public int getMaximumBlockedInputRows() - { - return properties_.getInt(JDProperties.MAXIMUM_BLOCKED_INPUT_ROWS); - } - - - - /** - Gets the maximum precision property. This property indicates the - maximum decimal precision the IBM i system should use. - Valid values: 31 or 63. 31 is default. - @return The maximum precision. - **/ - public int getMaximumPrecision() - { - return properties_.getInt(JDProperties.MAXIMUM_PRECISION); - } - - /** - Gets the maximum scale property. This property indicates the - maximum decimal scale the IBM i system should use. - Valid values: 0-63. 31 is default. - @return The maximum scale. - **/ - public int getMaximumScale() - { - return properties_.getInt(JDProperties.MAXIMUM_SCALE); - } - - /** - Sets the minimum divide scale property. This property ensures the scale - of the result of decimal division is never less than its specified value. - Valid values: 0-9. 0 is default. - @param scale The minimum divide scale. - **/ - public void setMinimumDivideScale(int scale) - { - final String property = "minimumDivideScale"; - - validateProperty(property, Integer.toString(scale), JDProperties.MINIMUM_DIVIDE_SCALE); - - properties_.setString(JDProperties.MINIMUM_DIVIDE_SCALE, Integer.toString(scale)); - } - - - // @A6A - /** - * Sets the maximum blocked input rows. This property indicates the - * maximum number of rows sent to the database engine for a blocked - * input operation. Valid values: 1-32000. 32000 is the default - * @param maximumBlockedInputRows The maximum number of input rows - */ - - public void setMaximumBlockedInputRows(int maximumBlockedInputRows) - { - final String property = "maximumBlockedInputRows"; - - validateProperty(property, Integer.toString(maximumBlockedInputRows), JDProperties.MAXIMUM_BLOCKED_INPUT_ROWS); - - properties_.setString(JDProperties.MAXIMUM_PRECISION, Integer.toString(maximumBlockedInputRows)); - } - - - /** - Sets the maximum precision property. This property indicates the - maximum decimal precision the IBM i system should use. - Valid values: 31 or 63. 31 is default. - @param precision The maximum precision. - **/ - public void setMaximumPrecision(int precision) - { - final String property = "maximumPrecision"; - - validateProperty(property, Integer.toString(precision), JDProperties.MAXIMUM_PRECISION); - - properties_.setString(JDProperties.MAXIMUM_PRECISION, Integer.toString(precision)); - } - - /** - Sets the maximum scale property. This property indicates the - maximum decimal scale the IBM i system should use. - Valid values: 0-63. 31 is default. - @param scale The maximum scale. - **/ - public void setMaximumScale(int scale) - { - final String property = "maximumScale"; - - // validate the new value - validateProperty(property, Integer.toString(scale), JDProperties.MAXIMUM_SCALE); - - properties_.setString(JDProperties.MAXIMUM_SCALE, Integer.toString(scale)); - } - - /** - Gets the translate hex property, which indicates how - the parser will treat hexadecimal literals. - @return The value of the translate hex property. -

Valid values include: -

    -
  • "character" (Interpret hexadecimal constants as character data) -
  • "binary" (Interpret hexadecimal constants as binary data) -
- The default value is "character". - **/ - public String getTranslateHex() - { - return properties_.getString(JDProperties.TRANSLATE_HEX); - } - - /** - Sets the translate hex property, which indicates how - the parser will treat hexadecimal literals. - @param parseOption The hex constant parser option. -

Valid values include: -

    -
  • "character" (Interpret hexadecimal constants as character data) -
  • "binary" (Interpret hexadecimal constants as binary data) -
- The default value is "character". - **/ - public void setTranslateHex(String parseOption) - { - final String property = "translateHex"; - - validateProperty(property, parseOption, JDProperties.TRANSLATE_HEX); - - properties_.setString(JDProperties.TRANSLATE_HEX, parseOption); - } - - /** - Sets the QAQQINI library name. - @param libraryName The QAQQINI library name. - **/ - public void setQaqqiniLibrary(String libraryName) - { - final String property = "qaqqiniLibrary"; - if (libraryName == null) - throw new NullPointerException(property); - - properties_.setString(JDProperties.QAQQINILIB, libraryName); - } - - //@dup - /** - * Sets the QAQQINI library name. - * @param libraryName The QAQQINI library name. - * Note: this method is the same as setQaqqiniLibrary() so that it corresponds to the connection property name - **/ - public void setQaqqinilib(String libraryName) - { - setQaqqiniLibrary(libraryName); - } - - /** - Returns the toolbox trace category. - @return The toolbox trace category. -

Valid values include: -

    -
  • "none" - The default value. -
  • "datastream" -
  • "diagnostic" -
  • "error" -
  • "information" -
  • "warning" -
  • "conversion" -
  • "proxy" -
  • "pcml" -
  • "jdbc" -
  • "all" -
  • "thread" -
- **/ - public String getToolboxTraceCategory() - { - return properties_.getString(JDProperties.TRACE_TOOLBOX); - } - - - //@dup - /** - * Returns the toolbox trace category. - * @return The toolbox trace category. - *

Valid values include: - *

    - *
  • "none" - The default value. - *
  • "datastream" - *
  • "diagnostic" - *
  • "error" - *
  • "information" - *
  • "warning" - *
  • "conversion" - *
  • "proxy" - *
  • "pcml" - *
  • "jdbc" - *
  • "all" - *
  • "thread" - *
- * Note: this method is the same as getToolboxTraceCategory() so that it corresponds to the connection property name - **/ - public String getToolboxTrace() - { - return getToolboxTraceCategory(); - } - - - /** - Sets the toolbox trace category, which indicates - what trace points and diagnostic messages should be logged. - @param traceCategory The category option. -

Valid values include: -

    -
  • "none" -
  • "datastream" -
  • "diagnostic" -
  • "error" -
  • "information" -
  • "warning" -
  • "conversion" -
  • "proxy" -
  • "pcml" -
  • "jdbc" -
  • "all" -
  • "thread" -
- The default value is "none". - **/ - public void setToolboxTraceCategory(String traceCategory) - { - final String property = "toolboxTrace"; - - validateProperty(property, traceCategory, JDProperties.TRACE_TOOLBOX); - - properties_.setString(JDProperties.TRACE_TOOLBOX, traceCategory); - } - - - //@dup - /** - * Sets the toolbox trace category, which indicates - * what trace points and diagnostic messages should be logged. - * @param traceCategory The category option. - *

Valid values include: - *

    - *
  • "none" - *
  • "datastream" - *
  • "diagnostic" - *
  • "error" - *
  • "information" - *
  • "warning" - *
  • "conversion" - *
  • "proxy" - *
  • "pcml" - *
  • "jdbc" - *
  • "all" - *
  • "thread" - *
- * The default value is "none". - * Note: this method is the same as setToolboxTraceCategory() so that it corresponds to the connection property name - **/ - public void setToolboxTrace(String traceCategory) - { - setToolboxTraceCategory(traceCategory); - } - - /** - Validates the property value. - @param property The property name. - @param value The property value. - @param index The property index. - **/ - private final void validateProperty(String property, String value, int index) - { - if (value.length() != 0) - { - DriverPropertyInfo[] info = properties_.getInfo(); - String[] choices = info[index].choices; - - //Bidi-HCG start - //exception for "package ccsid" - it can accept any integer - if(index == JDProperties.PACKAGE_CCSID){ - try{ - int ccsid = Integer.valueOf(value).intValue(); - if(ccsid < 1) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - return; - }catch(NumberFormatException e){ - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - //Bidi-HCG end - - boolean notValid = true; - int current = 0; - while (notValid && current < choices.length) - { - if (value.equalsIgnoreCase(choices[current])) - notValid = false; - else - current++; - } - if (notValid) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - /** - Serializes the IBM i system and user information. - @param out The output stream. - @throws IOException If a file I/O error occurs. - **/ - private void writeObject(ObjectOutputStream out) throws IOException - { - if (!savePasswordWhenSerialized_) - { - serialPWBytes_ = null; - pwHashcode_ = 0; - - serialKeyRingPWBytes_ = null; - } - - // Serialize the object. - out.defaultWriteObject(); - } - - /** - Returns the string representation of the object. - @return The string representation. - **/ - public String toString() - { - /* - Implementation note: Used only for tracing information. - */ - return getDataSourceName(); - } - - // Twiddle password bytes. - // Note: This method generates different output each time it's called against the same password. - private static final char[] xpwConfuse(String info) - { - Random rng = new Random(); - byte[] adderBytes = new byte[18]; - rng.nextBytes(adderBytes); - char[] adder = BinaryConverter.byteArrayToCharArray(adderBytes); - - byte[] maskBytes = new byte[14]; - rng.nextBytes(maskBytes); - char[] mask = BinaryConverter.byteArrayToCharArray(maskBytes); - - char[] infoBytes = xencode(adder, mask, info.toCharArray()); - char[] returnBytes = new char[info.length() + 16]; - System.arraycopy(adder, 0, returnBytes, 0, 9); - System.arraycopy(mask, 0, returnBytes, 9, 7); - System.arraycopy(infoBytes, 0, returnBytes, 16, info.length()); - - return returnBytes; - } - - // Get clear password bytes back. - private static final String xpwDeconfuse(char[] info) - { - char[] adder = new char[9]; - System.arraycopy(info, 0, adder, 0, 9); - char[] mask = new char[7]; - System.arraycopy(info, 9, mask, 0, 7); - char[] infoBytes = new char[info.length - 16]; - System.arraycopy(info, 16, infoBytes, 0, info.length - 16); - - return new String(xdecode(adder, mask, infoBytes)); - } - - // Scramble some bytes. - private static final char[] xencode(char[] adder, char[] mask, char[] bytes) - { - if (bytes == null) return null; - int length = bytes.length; - char[] buf = new char[length]; - for (int i = 0; i < length; ++i) - { - buf[i] = (char)(bytes[i] + adder[i % 9]); - } - for (int i = 0; i < length; ++i) - { - buf[i] = (char)(buf[i] ^ mask[i % 7]); - } - return buf; - } - - private static final char[] xdecode(char[] adder, char[] mask, char[] bytes) - { - int length = bytes.length; - char[] buf = new char[length]; - for (int i = 0; i < length; ++i) - { - buf[i] = (char)(mask[i % 7] ^ bytes[i]); - } - for (int i = 0; i < length; ++i) - { - buf[i] = (char)(buf[i] - adder[i % 9]); - } - return buf; - } - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCManagedDataSource", "javax.sql.DataSource" }; - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCNClob.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCNClob.java deleted file mode 100644 index c11805a3f..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCNClob.java +++ /dev/null @@ -1,60 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCNClob.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/* ifdef JDBC40 */ -import java.sql.NClob; -/* endif */ - -/** - * The AS400JDBCNClob class provides access to character large objects. The data - * is valid only within the current transaction. - */ - -//@PDA jdbc40 new class - -public class AS400JDBCNClob extends AS400JDBCClob -/* ifdef JDBC40 */ - implements NClob -/* endif */ -{ - - - /** - * Constructs an AS400JDBCNClob object. The data is contained in the String. - * No further communication with the IBM i system is necessary. - * - * @param data - * The NClob data. - * @param maxLength - * The max length - */ - AS400JDBCNClob(String data, int maxLength) - { - super(data, maxLength); - } - - /** - * Constructs an AS400JDBCNClob object. The data is contained in the char array. - * No further communication with the IBM i system is necessary. - * - * @param data - * The NClob data. - */ - AS400JDBCNClob(char[] data) - { - super(data); - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCNClobLocator.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCNClobLocator.java deleted file mode 100644 index 3fe81cde4..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCNClobLocator.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCNClobLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/* ifdef JDBC40 */ -import java.sql.NClob; -/* endif */ - -//@PDA jdbc40 new class - - -public class AS400JDBCNClobLocator extends AS400JDBCClobLocator -/* ifdef JDBC40 */ -implements NClob -/* endif */ -{ - - /** - Constructs an AS400JDBCNClobLocator object. The data for the - CLOB will be retrieved as requested, directly from the - IBM i system, using the locator handle. - - @param locator The locator. - @param converter The text converter. - @param savedObject The input savedOjbect. - @param savedScale The saved scale. - **/ - AS400JDBCNClobLocator(JDLobLocator locator, ConvTable converter, Object savedObject, int savedScale) - { - super(locator, converter, savedObject, savedScale); - } - - //@xml4 new constructor - /** - Constructs an AS400JDBCNClobLocator object. The data for the - CLOB will be retrieved as requested, directly from the - IBM i system, using the locator handle. - If this clob has a source of a column of type XML, then any getX method that returns xml as string will trim the xml declaration. - - @param locator The locator. - @param converter The text converter. - @param savedObject The input savedOjbect. - @param savedScale The saved scale. - @param isXML Flag that stream is from an XML column type (needed to strip xml declaration) - **/ - AS400JDBCNClobLocator(JDLobLocator locator, ConvTable converter, Object savedObject, int savedScale, boolean isXML) - { - super(locator, converter, savedObject, savedScale, isXML); - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCParameterMetaData.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCParameterMetaData.java deleted file mode 100644 index fec7d3893..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCParameterMetaData.java +++ /dev/null @@ -1,207 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCParameterMetaData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.ParameterMetaData; -import java.sql.SQLException; - - -/** -The AS400JDBCParameterMetaData class can be used to retrieve information about the parameters -of a PreparedStatement. - -Use PreparedStatement.getParameterMetaData() to create new ParameterMetaData objects. -**/ -public class AS400JDBCParameterMetaData -/* ifdef JDBC40 */ -extends ToolboxWrapper -/* endif */ - implements ParameterMetaData -{ - final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - - // Private data. - private AS400JDBCPreparedStatement prepStmt_; - - - - /** - Constructs an AS400JDBCParameterMetaData object. - **/ - AS400JDBCParameterMetaData (AS400JDBCPreparedStatement prepStmt) - { - prepStmt_ = prepStmt; - } - - - - /** - Returns the fully-qualified name of the Java class of the specified parameter. - - @param parameterIndex The parameter index (1-based). - @return The fully-qualified name of the Java class. - - @exception SQLException If the prepared statement is not open. - **/ - public String getParameterClassName (int parameterIndex) - throws SQLException - { - return prepStmt_.getParameterClassName(parameterIndex); - } - - - - /** - Returns the number of parameters in this ParameterMetaData object. - - @return The number of parameters in the ParameterMetaData object. - - @exception SQLException If the prepared statement is not open. - **/ - public int getParameterCount () - throws SQLException - { - return prepStmt_.getParameterCount(); - } - - - - /** - Returns the mode of the specified parameter or if that information is unknown. - - @param parameterIndex The parameter index (1-based). - @return The mode of the parameter. Valid values are - ParameterMetaData.parameterModeIn, - ParameterMetaData.parameterModeOut, - ParameterMetaData.parameterModeInOut, and - ParameterMetaData.parameterModeUnknown. - - @exception SQLException If the prepared statement is not open. - **/ - public int getParameterMode (int parameterIndex) - throws SQLException - { - return prepStmt_.getParameterMode(parameterIndex); - } - - - - /** - Returns the SQL type of the specified parameter. - - @param parameterIndex The parameter index (1-based). - @return The SQL type of the parameter. - - @exception SQLException If the prepared statement is not open. - **/ - public int getParameterType (int parameterIndex) - throws SQLException - { - return prepStmt_.getParameterType(parameterIndex); - } - - - - /** - Returns the database-specific type name of the specified parameter. - - @param parameterIndex The parameter index (1-based). - @return The type name of the parameter. - - @exception SQLException If the prepared statement is not open. - **/ - public String getParameterTypeName (int parameterIndex) - throws SQLException - { - return prepStmt_.getParameterTypeName(parameterIndex); - } - - - - /** - Returns the number of decimal digits of the specified parameter. - - @param parameterIndex The parameter index (1-based). - @return The precision of the parameter. - - @exception SQLException If the prepared statement is not open. - **/ - public int getPrecision (int parameterIndex) - throws SQLException - { - return prepStmt_.getPrecision(parameterIndex); - } - - - - /** - Returns the number of digits to the right of the decimal point - of the specified parameter. - - @param parameterIndex The parameter index (1-based). - @return The scale of the parameter. - - @exception SQLException If the prepared statement is not open. - **/ - public int getScale (int parameterIndex) - throws SQLException - { - return prepStmt_.getScale(parameterIndex); - } - - - - /** - Returns if the specified parameter can be null or that information is unknown. - - @param parameterIndex The parameter index (1-based). - @return Returns if the parameter can be null. The valid values are - ParameterMetaData.parameterNoNulls, - ParameterMetaData.parameterNullable, and - ParameterMetaData.parameterNullableUnknown. - - @exception SQLException If the prepared statement is not open. - **/ - public int isNullable (int parameterIndex) - throws SQLException - { - return prepStmt_.isNullable(parameterIndex); - } - - - - /** - Returns if values can be signed numbers for the specified parameter. - - @param parameterIndex The parameter index (1-based). - @return Returns true if values for the specified parameter - can be signed numbers, false otherwise. - - @exception SQLException If the prepared statement is not open. - **/ - public boolean isSigned (int parameterIndex) - throws SQLException - { - return prepStmt_.isSigned(parameterIndex); - } - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCParameterMetaData", "java.sql.ParameterMetaData" }; - } - -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCPooledConnection.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCPooledConnection.java deleted file mode 100644 index 0ee42f4ed..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCPooledConnection.java +++ /dev/null @@ -1,471 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCPooledConnection.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import javax.sql.ConnectionEvent; -import javax.sql.ConnectionEventListener; -import javax.sql.PooledConnection; -/* ifdef JDBC40 */ -import javax.sql.StatementEventListener; -/* endif */ - -import java.sql.Connection; -import java.sql.SQLException; -import java.lang.ref.SoftReference; - -/** -* The AS400JDBCPooledConnection class represents a connection object -* that provides hooks for connection pool management. This object is returned -* by the {@link com.ibm.as400.access.AS400JDBCConnectionPoolDataSource#getPooledConnection AS400JDBCConnectionPoolDataSource.getPooledConnection()} method. -* -* The following example creates an AS400JDBCPooledConnection object that can be used to cache JDBC connections. -* -*
-* // Create a data source for making the connection. -* AS400JDBCConnectionPoolDataSource dataSource = new AS400JDBCConnectionPoolDataSource("myAS400"); -* datasource.setUser("Mickey Mouse"); -* datasource.setPassword("IAMNORAT"); -* -* // Get a PooledConnection and get the connection handle to the database. -* AS400JDBCPooledConnection pooledConnection = datasource.getPooledConnection(); -* Connection connection = pooledConnection.getConnection(); -* -* ... work with the connection handle. -* -* // Close the connection handle to make available for reuse (physical connection not closed). -* connection.close(); -* -* // Reuse the connection somewhere else. -* Connection reusedConnection = pooledConnection.getConnection(); -* ... work with the connection handle. -* reusedConnection.close(); -* -* // Close the physical connection. -* pooledConnection.close(); -*
-* -*

-* AS400JDBCPooledConnection objects generate the following events: -*

    -*
  • javax.sql.ConnectionEvent - The events fired are:
  • -*
      -*
    • connectionClosed
    • -*
    • connectionErrorOccurred
    • -*
    -*
-**/ -public class AS400JDBCPooledConnection implements PooledConnection -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - private AS400JDBCConnection connection_; // The database connection. -//@CRS - If we maintain a [direct] reference to the handle, and the user doesn't call close(), it -// will never get closed because it will never get garbage collected. -// Instead, we are a listener to the handle, so we know when either the user or the -// garbage collector closes it. At that point, this PooledConnection is no longer -// considered "in use" and can hand out a new handle when someone calls getConnection(). - -//@pda (bug reported) A AS400JDBCPooledConnection can get expired and moved back to available queue. So this -// handle class needs a way for AS400JDBCPooledConnection to notify it of this change in state. -// This way, when finalize() is called by GC we will not try to double-close the connection. -// Without this method, it is possible for two handles to have references to the same pooledConnection. -// After we are done with handle_, we must set it to null, so AS400JDBCConnectionHandle can be GCed. -// In order for the handle to be GCed, a leaked connection has to be Expired and have handle_ set to null -// upon returning to available queue. - private SoftReference handle_; // The handle to the connection. //@pdc make use of reference to handle - // This is a soft reference to an AS400JDBCConnectionHandle object. - // DESIGN NOTE: - // We use a soft reference (rather than a direct reference) in order to avoid - // having circular/mutual direct references between the handle and the connection. - // In some scenarios, such circular references can prevent such pairs of objects - // from being garbage-collected; which can result in memory leaks. - // Advantage of a soft reference: If the connection requester gives up their - // reference to the handle but neglects to call close() first, - // then the only remaining reference to the handle is the soft reference - // from the associated AS400JDBCPooledConnection. - // The garbage collector will then notice that the only reference to the handle - // is a soft reference; and the GC will then collect/remove the handle. - - private PoolItemProperties properties_; // The usage properties. - private AS400JDBCConnectionEventSupport eventManager_; - - private int hashCode_; //@CPMa - - // The following fields are reserved for use by JDConnectionPoolManager. //@CPMa - JDConnectionPoolKey poolKey_; // connection-pool key for this connection - long timeWhenCreated_; // time when this connection was created. - long timeWhenPoolStatusLastModified_; // time when this connection's pooling status last changed. - boolean fatalConnectionErrorOccurred_; // this clues the pool manager not to reuse connection - - - /** - * Constructs an AS400JDBCPooledConnection object. - * @param connection The physical connection to be pooled. - * @exception SQLException If a database error occurs. - **/ - AS400JDBCPooledConnection(Connection connection) throws SQLException - { - if (connection == null) throw new NullPointerException("connection"); - connection_ = (AS400JDBCConnection)connection; - - properties_ = new PoolItemProperties(); - eventManager_ = new AS400JDBCConnectionEventSupport(); - hashCode_ = connection_.hashCode(); - timeWhenCreated_ = System.currentTimeMillis(); - - if (JDTrace.isTraceOn()) //@G2A - { - JDTrace.logInformation(this, "A new AS400JDBCPooledConnection was created"); //@G2A - } - } - - - /** - * Adds a ConnectionEventListener. - * @param listener The listener. - **/ - public void addConnectionEventListener(ConnectionEventListener listener) - { - eventManager_.addConnectionEventListener(listener); - } - - - /** - * Closes the physical connection. - * @exception SQLException If an error occurs closing the connection. - **/ - public synchronized void close() throws SQLException - { - if (connection_.isClosed()) return; - // Note: AS400JDBCConnectionHandle.close() calls fireConnectionCloseEvent(). - - connection_.close(); // close the physical connection - - // Reset the usage timers. - properties_.clear(); - - if (JDTrace.isTraceOn()) - { //@G2C - JDTrace.logInformation(this, "close() was called on this AS400JDBCPooledConnection"); //@G2C - } - } - - - //@G4A JDBC 3.0 - /** - * Closes all the Statement objects that have been opened by this PooledConnection - * object. This method is not supported. - * @exception SQLException Always thrown because this method is not supported. - **/ - public void closeAll() throws SQLException - { - JDError.throwSQLException(JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - - // JDConnectionPoolManager needs this when identifying returned connections. - public boolean equals(Object obj) - { - if (obj == null) return false; - try - { - AS400JDBCPooledConnection pc = (AS400JDBCPooledConnection)obj; - return (connection_.equals(pc.connection_)); - } - catch (Throwable e) { - return false; - } - } - - // Needed for good hashing. - public int hashCode() - { - return hashCode_; - } - - - // Note: The following method is called by AS400JDBCConnectionHandle.close(). - /** - * Fire the connection closed event. - * @param event The ConnectionEvent. - **/ - void fireConnectionCloseEvent(ConnectionEvent event) - { - returned(); // Reset the pooledConnection. - eventManager_.fireCloseEvent(event); // Notify the pool. - } - - - // Note: The following method is called by AS400JDBCConnectionHandle.close(). - /** - * Fire the connection error event. - * @param event The ConnectionEvent. - **/ - void fireConnectionErrorEvent(ConnectionEvent event) - { - // Don't bother cleaning up the connection, it won't get re-used. - eventManager_.fireErrorEvent(event); // Notify the pool. - } - - /** - * Returns the connection handle to the database. Only one connection handle can be open - * at a time for any given AS400JDBCPooledConnection object. - * @return The connection handle. - * @exception SQLException If a database error occurs or if this PooledConnection is already in use. - **/ - public synchronized Connection getConnection() throws SQLException - { - if (JDTrace.isTraceOn()) //@G2C - { - JDTrace.logInformation(this, "AS400JDBCPooledConnection.getConnection() was called"); //@G2C - } - return getConnectionHandle(); - } - - - // Used by JDConnectionPoolManager. //@CPMa - /** - * Returns the connection handle to the database. Only one connection handle can be open - * at a time for any given AS400JDBCPooledConnection object. - * @return The connection handle. - * @exception SQLException If a database error occurs or if this PooledConnection is already in use. - **/ - synchronized final AS400JDBCConnectionHandle getConnectionHandle() throws SQLException - { - if (connection_.isClosed()) - { - if (JDTrace.isTraceOn()) // @G2A - { - JDTrace.logInformation(this, "This AS400JDBCPooledConnection is invalid because connection is closed."); // @G2A - } - JDError.throwSQLException(this, JDError.EXC_CONNECTION_NONE); //@G2A - } - - // Note: The JDBC Tutorial says that if PooledConnection.getConnection() is called while already in use, this should close the existing connection. "The purpose of allowing the server to invoke the method getConnection a 2nd time is to give the application server a way to take a connection away from an application and give it to someone else. This will probably rarely happen, but the capability is there." - // However, we haven't had a request for this behavior, so we just throw an exception instead. - if (isInUse()) - { - if (JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "This AS400JDBCPooledConnection is already in use."); - } - JDError.throwSQLException(this, JDError.EXC_CONNECTION_UNABLE); // Is this the right thing to throw here? - } - - // Start the connection tracking timers. - setInUse(true); - - AS400JDBCConnectionHandle handle = new AS400JDBCConnectionHandle(this, connection_); //@pdc handle - handle_ = new SoftReference(handle); - return handle; //@pda handle - } - - - // For exclusive use by JDConnectionPoolManager. //@CPMa - final JDConnectionPoolKey getPoolKey() - { - return poolKey_; - } - - - AS400JDBCConnection getInternalConnection() //@G1A - { //@G1A - return connection_; //@G1A - } //@G1A - - - /** - * Returns the elapsed time the connection has been idle waiting in the pool. - * @return The idle time (milliseconds). - **/ - public long getInactivityTime() - { - return properties_.getInactivityTime(); - } - - - /** - * Returns the elapsed time the connection has been in use. - * @return The elapsed time (milliseconds). - **/ - public long getInUseTime() - { - return properties_.getInUseTime(); - } - - - /** - * Returns the elapsed time the pooled connection has been alive. - * @return The elapsed time (milliseconds). - **/ - public long getLifeSpan() - { - return properties_.getLifeSpan(); - } - - - /** - * Returns the number of times the pooled connection has been used. - * @return The number of times used. - **/ - public int getUseCount() - { - return properties_.getUseCount(); - } - - - /** - * Ping the connection to check the status. - * @return true if the connection is active; false otherwise. - **/ - boolean isConnected() throws SQLException // @A3A - { - return connection_.getAS400().isConnected(AS400.DATABASE); - } - - - /** - * Determine whether the connection is still alive. - * @return true if the connection is alive; false otherwise. - **/ - boolean isConnectionAlive() throws SQLException - { - return connection_.getAS400().isConnectionAlive(AS400.DATABASE); - } - - - /** - * Indicates if the pooled connection is in use. - * @return true if the pooled connection is in use; false otherwise. - **/ - public boolean isInUse() - { - return properties_.isInUse(); - } - - - /** - * Removes a ConnectionEventListener. - * @param listener The listener to be removed. - **/ - public void removeConnectionEventListener(ConnectionEventListener listener) - { - eventManager_.removeConnectionEventListener(listener); - } - - - /** - * Returns the connection after usage. - * Update the connection timers and invalidate connection handle. - **/ - synchronized void returned() - { - if (JDTrace.isTraceOn()) //@G2C - { - JDTrace.logInformation(this, "This AS400JDBCPooledConnection is being returned."); //@G2C - } - - // Reset the timers. - setInUse(false); - - try { //@CPMa - connection_.clearWarnings(); // This seems safe and reasonable enough. - connection_.setHoldability(AS400JDBCResultSet.HOLDABILITY_NOT_SPECIFIED); // This is the default for all new instances of AS400JDBCConnection. - boolean readOnly = connection_.isReadOnlyAccordingToProperties(); // Get default from props. - connection_.setReadOnly(readOnly); // In case the user forgot to reset. - connection_.setAutoCommit(true); // Ditto. - if (handle_ != null) //@pda handle - { - AS400JDBCConnectionHandle handle = (AS400JDBCConnectionHandle)handle_.get(); - if (handle != null) - { - handle.invalidate(); //@pda Invalidate the handle. - // So if this pooledConnection gets expired then also need to invalidate handle (remove reference from handle to pooledConnection). - //if the handle gets GCed (due to connection leak), then handle.finalize() will not try to close this pooledConnection, which could have been already assigned to a new handle. - //(ie prevent two handles from pointing to one pooledConnection) - } - handle_ = null; //remove reference also, so handle is free for GC. - } - } - catch (SQLException e) { - JDTrace.logException(this, "Exception while resetting properties of returned connection.", e); - } - - // Note: We can assume that if the connection has been used and then returned to the pool, it has been sufficiently cleaned-up/reset by AS400JDBCConnectionHandle.close(), which calls AS400JDBCConnection.pseudoClose(), which does any needed rollbacks and/or statement closing. //@CPMa - } - - - /** - * Sets the connection timer values based on the active usage state of the connection. - * @param inUse true if the connection is currently active; false otherwise. - **/ - synchronized void setInUse(boolean inUse) - { - properties_.setInUse(inUse); - } - - - // For exclusive use by JDConnectionPoolManager. //@CPMa - final void setPoolKey(JDConnectionPoolKey key) - { - poolKey_ = key; - } - - //@PDA jdbc40 - /** - * Registers a StatementEventListener with this PooledConnection object. Components that - * wish to be notified when PreparedStatements created by the - * connection are closed or are detected to be invalid may use this method - * to register a StatementEventListener with this PooledConnection object. - *

- * @param listener an component which implements the StatementEventListener - * interface that is to be registered with this PooledConnection object - */ -/* ifdef JDBC40 */ - public void addStatementEventListener(StatementEventListener listener) - { - //Currently toolbox does not have a pooledStatemnt. - - //Method can not throw SQLException in current driver - //For now just do nothing in this method. - if (JDTrace.isTraceOn()) //@G2C - { - JDTrace.logInformation(this, "AS400JDBCPooledConnection.addStatementEventListener is called, but is N/A."); - } - } -/* endif */ - - //@PDA jdbc40 - /** - * Removes the specified StatementEventListener from the list of - * components that will be notified when the driver detects that a - * PreparedStatement has been closed or is invalid. - *

- * @param listener the component which implements the - * StatementEventListener interface that was previously - * registered with this PooledConnection object - */ -/* ifdef JDBC40 */ - public void removeStatementEventListener(StatementEventListener listener) - { - //Method can not throw SQLException - //For now just do nothing - if (JDTrace.isTraceOn()) //@G2C - { - JDTrace.logInformation(this, "AS400JDBCPooledConnection.removeStatementEventListener is called, but is N/A."); - } - } -/* endif */ - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCPreparedStatement.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCPreparedStatement.java deleted file mode 100644 index 1a182dd89..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCPreparedStatement.java +++ /dev/null @@ -1,4334 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCPreparedStatement.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.net.URL; -import java.sql.Array; -import java.sql.BatchUpdateException; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.DataTruncation; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -/* endif */ -import java.sql.ParameterMetaData; -import java.sql.PreparedStatement; -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -/* ifdef JDBC40 */ -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Statement; -import java.sql.Time; -import java.sql.Timestamp; -import java.sql.Types; -import java.util.Calendar; -import java.util.Enumeration; -import java.util.Vector; - - -/** -

The AS400JDBCPreparedStatement class precompiles and stores an -SQL statement. This provides the ability to efficiently run -the statement multiple times. In addition, the statement may -contain parameters. Use Connection.prepareStatement() to create -new PreparedStatement objects. - -

When setting input parameter values, the caller must specify types -that are compatible with the defined SQL type of the input parameter. -For example, if the input parameter has SQL type INTEGER, then the -caller must call setInt() to set the IN parameter value. If -arbitrary type conversions are required, then use setObject() with -a target SQL type. - -

For method that sets parameters, the application should not modify the parameter - value until after the execute completes. Modifying a value - between the setXXXX method and the execute method may result in unpredictable - behavior. -**/ -// -// Implementation notes: -// -// 1. See implementation note in AS400JDBCStatement.java about -// "private protected" methods. -// -// @F2A -// 2. We need to support ?=CALL statements. This is where the stored -// procedure returns an INTEGER value, and we treat it as the -// first parameter marker. The database and host server support -// the return value, but not as a parameter marker. Consequently, -// we have to fake it as the first parameter marker. If this appears, -// in the SQL statement, we strip it off and maintain this separately. -// Of course in that case we are always mapping the caller's parameter -// indices to the database's indices by decrementing by 1 as needed. -// -// @G8c -// 3. If there is a return value (ie ?=call xxxx) and the parameter -// index is 1 then return data for the return value (always an Integer). -// If not, decrement the parm index by one because internally the return -// value doesn't count. If there is no return value the count is correct -// so don't do anything in that case. Also, the database supports returning -// only integers so the metadata will always be an SQLInteger. -// -public class AS400JDBCPreparedStatement extends AS400JDBCStatement implements PreparedStatement -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - - private boolean dataTruncation_; // @B5A - private int descriptorHandle_; - boolean executed_; // private protected - private boolean outputParametersExpected_; - int parameterCount_; // private protected - int parameterInputCount_; // private protected //@array4 - boolean batchExecute_; // private protected @G9A - private int[] parameterLengths_; - private int[] parameterOffsets_; - private boolean[] parameterNulls_; - private boolean[] parameterDefaults_; //@EIA - private boolean[] parameterUnassigned_; //@EIA - private String[] parameterNames_; //@pda jdbc40 - //@re-prep move to statement JDServerRow JDServerRow parameterRow_; // private protected - Vector batchParameterRows_; // private protected @G9A - private int parameterTotalSize_; - private int indicatorTotalSize_; //@array Used with array containing data only. Is total size of all indicators (including array element indicators) - private int headerTotalSize_; //@array Used to calculate size of stream header - boolean[] parameterSet_; // private protected - private boolean prepared_; - private JDServerRow resultRow_; - SQLInteger returnValueParameter_; // private protected @F2A - JDSQLStatement sqlStatement_; // @G4c (used by callable statement) - boolean useReturnValueParameter_; // private protected @F2A - private int maxToLog_ = 10000; // Log value of parameter markers up to this length // @H1A - - private int containsLocator_ = LOCATOR_UNKNOWN; - private static final int LOCATOR_UNKNOWN = -1; - private static final int LOCATOR_NOT_FOUND = 0; - private static final int LOCATOR_FOUND = 1; - - private static final short INDICATOR_NULL = -1; //@EIA - private static final short INDICATOR_DEFAULT = -5; //@EIA - private static final short INDICATOR_UNASSIGNED = -7; //@EIA - private boolean isjvm16Synchronizer;//@dmy - private static boolean isjvm16SynchronizerStatic;//@dmy - - static { - // Changed 2/21/2011 to not use unless the JDBC.jvm16Synchronize property is true. @C6A - - /* - Here is some information from service about this error. - -Yes, this trace code was added for a very ugly issue that showed up when customers started moving to Java 6. -While trying to debug it, we found that the trace points ended up changing the behavior, so they were -altered to trace to a dummy stream so that it would workaround Sun's bug. -The CPS discussion item was 7LXN87. - -Here's the contents of our KB doc on the issue: - -Abstract -A problem with the Sun HotSpot Server in the 1.6 JDK causes a variety of errors. - -Problem Summary: -A problem was introduced into the version 1.6 JDK (Java Development Kit) and -JRE (Java Runtime Environment) from Sun. The problem was introduced somewhere between - update number 7 and update 12, which can cause a number of problems. Java version 1.6.0_7 works; -however, version 1.6.0_12 produces the errors. The problem is specific to the HotSpot Server which is -something like an optimizing compiler that is designed to provide the best operating speed for long-running -applications similar to a Web server. The problem seems to always manifest itself by 'removing' parameters -that had been bound to a statement. However, it is not possible to know that this has occurred without -tracing the application. The outward symptoms are exceptions which will vary depending on what data is -missing. The common errors that have been reported are as follows: - -SQLException: Descriptor index not valid -CPD4374 - Field HVR000n and value N not compatible. <-- where N might a variety of different numbers -SQL0302 - Conversion error on host variable or parameter *N. <-- where n might a variety of different numbers -SQL0406 - Conversion error on assignment to column N. <-- where N might a variety of different numbers - -Resolution: -The problem has been reported to Sun; however, at this time, no fix is available from them. -We have found three ways to circumvent the problem: - -1. Do not use JDK 1.6. -2. Use JVM property -client (this turns off performance code in Sun Hotspot). -3. Use JVM property -XX:CompileCommand=exclude,com/ibm/as400/access/AS400JDBCPreparedStatement,commonExecuteBefore (more selectively, turn off part of Hotspot). -4. Use the latest version of jt400.jar (currently 6.6). Additional trace points that were added while searching for the source of the problem appear to have changed the Hotspot behavior. - - - -Update 2/24/2011. This was probably a problem with the buffer synchonization. Before JTOpen 7.1, a flag -was set to indicate that a buffer was available. This flag did not utilize any synchronization. In JTOpen 7.1, -the buffer management code was restructure to used synchronzation. - -A recreate for the original problem was found. It failed using the JTOpen 6.4 jar. We then used a jar -with the change the set the default isjvm16SynchronizerStatic to false and set the default -value of the property to false. The problem did not occur with the jar file. -*/ - - - - //Temporary fix for jvm 1.6 memroy stomp issue. (remove //@dmy code when jvm issue is resolved) - //This fix will just trace a few extra traces to a dummy stream - //if system property or jdbc property is set to false then extra trace is not executed - //null value for system property means not specified...so true by default - String jvm16Synchronize = SystemProperties.getProperty (SystemProperties.JDBC_JVM16_SYNCHRONIZE); //@dmy - isjvm16SynchronizerStatic = false; //@dmy //false by default @C6C - if((jvm16Synchronize != null) && (Boolean.valueOf(jvm16Synchronize.trim()).booleanValue() == true)) { - try{ //@dmy - Class.forName("java.sql.SQLXML"); //@dmy - isjvm16SynchronizerStatic = true; //@dmy - }catch(Exception e){ //@dmy - isjvm16SynchronizerStatic = false; //@dmy - } - - } else { - //@dmy - isjvm16SynchronizerStatic = false; //@dmy - } - - } - // @C6C -- Changed to remove the dummy PrimWriter. The dummy PrintWriter uses a - // 16k buffer of storage. This causes storage problems when a lot of statements are - // cached. Instead we'll use the write(byte[]) method instead of the buffered print writer - // - //@dmy private dummy outputstream - OutputStream dummyOutputStream = new OutputStream() { - int b1 = 0; - public synchronized void write(int b) throws IOException { b1 = b; } - - }; - - // Any method that can deal with extremely large data values must be prepared - // to deal with them in blocks instead of as one giant unit. This value is - // used to determine the size of each block. Eventually, we might externalize - // this value so that users can set it as they see fit. - static final int LOB_BLOCK_SIZE = 1000000; //@pdc Match Native JDBC Driver for IBM i - - /** - Constructs an AS400JDBCPreparedStatement object. - - @param connection The connection to the system. - @param id The id. - @param transactionManager The transaction manager for the connection. - @param packageManager The package manager for the connection. - @param blockCriteria The block criteria. - @param blockSize The block size (in KB). - @param prefetch Indicates if prefetching data. - @param sqlStatement The SQL statement. - @param outputParametersExpected Indicates if output parameters are expected. - @param packageCriteria The package criteria. - @param resultSetType The result set type. - @param resultSetConcurrency The result set concurrency. - @param resultSetHoldability The result set holdability. - @param autoGeneratedKeys The auto-generated keys requested - - @exception SQLException If the SQL statement contains a syntax - error or an error occurs. - **/ - AS400JDBCPreparedStatement (AS400JDBCConnection connection, - int id, - JDTransactionManager transactionManager, - JDPackageManager packageManager, - String blockCriteria, - int blockSize, - boolean prefetch, - JDSQLStatement sqlStatement, - boolean outputParametersExpected, - String packageCriteria, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability, //@G4A - int autoGeneratedKeys) //@G4A - throws SQLException - { - super (connection, id, transactionManager, - packageManager, blockCriteria, blockSize, - prefetch, packageCriteria, resultSetType, - resultSetConcurrency, resultSetHoldability, autoGeneratedKeys); - - //@dmy - //Temporary fix for jvm 1.6 memroy stomp issue. (remove //@dmy code when jvm issue is resolved) - //This fix will just trace a few extra traces to a dummy stream - //if system property or jdbc property is set to false then extra trace is not executed - //null value for system property means not specified...so true by default - isjvm16Synchronizer = isjvm16SynchronizerStatic; - if( connection_.getProperties().getBoolean(JDProperties.JVM16_SYNCHRONIZE)) //@dmy - isjvm16Synchronizer = true; //@dmy@C6C - - - batchExecute_ = false; // @G9A - outputParametersExpected_ = outputParametersExpected; - parameterCount_ = sqlStatement.countParameters(); - parameterInputCount_ = 0; //@array4 calculate while we prepare - parameterLengths_ = new int[parameterCount_]; - parameterNulls_ = new boolean[parameterCount_]; - parameterDefaults_ = new boolean[parameterCount_]; //@EIA - parameterUnassigned_ = new boolean[parameterCount_]; //@EIA - parameterOffsets_ = new int[parameterCount_]; - parameterSet_ = new boolean[parameterCount_]; - sqlStatement_ = sqlStatement; - useReturnValueParameter_ = sqlStatement.hasReturnValueParameter(); // @F2A - - if(useReturnValueParameter_) // @F2A - returnValueParameter_ = new SQLInteger(connection_.getVRM()); // @F2A //@trunc3 - - if(JDTrace.isTraceOn()) - { // @D1A @F2C - JDTrace.logInformation (this, "isjvm16Synchronizer="+isjvm16Synchronizer); // @C6A - JDTrace.logInformation (this, "Preparing [" + sqlStatement_ + "]"); // @D1A - if(useReturnValueParameter_) // @F2A - JDTrace.logInformation(this, "Suppressing return value parameter (?=CALL)"); // @F2A - } // @F2A - - // Do not allow statements to be immediately - // executed. If we did not do this, then some - // statements would get executed at prepare time. - allowImmediate_ = false; - - // Prepare. - prepared_ = true; - //@L1A Added try catch block around commonPrepare() for JTOpen Bug #3605 Statement not fully closed on error. - // If an error occurs in the preparing of the statement, we need to close any resources used by the PreparedStatement object. - try{ - resultRow_ = commonPrepare(sqlStatement_); - }catch(SQLException e){ - close(); - throw e; - } - executed_ = false; - - dataTruncation_ = connection.getProperties().getBoolean(JDProperties.DATA_TRUNCATION); - - clearParameters(); - } - - - - // JDBC 2.0 - /** - Adds the set of parameters to the current batch. - - @exception SQLException If the statement is not open or - an input parameter has not been set. - **/ - public void addBatch() throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - Object[] parameters = new Object[parameterCount_]; - for(int i = 0; i < parameterCount_; ++i) - { - // Statements with output or inout parameters are not allowed in the batch. - if(parameterRow_.isOutput(i+1)) JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // If an input parameter is not set, we throw an exception. - if(!parameterSet_[i]) JDError.throwSQLException(this, JDError.EXC_PARAMETER_COUNT_MISMATCH); - - //@KBA Need to check for locators even if the parameter is null - // If we don't check for locators and the first row had locator fields that are all null, the LOCATOR_FOUND - // flag was not being set. This meant that we thought we could batch when executeBatch() was called. We cannot - // batch when locators are being used. - SQLData sqlData = parameterRow_.getSQLData(i+1); //@KBA - // Save the parameter in the array. If it's null, just leave it null. - if(!parameterNulls_[i]) - { - //@KBD SQLData sqlData = parameterRow_.getSQLData(i+1); - //For default and unassigned extended indicator values, we use Byte to contain the indicator flag - if(parameterDefaults_[i]) //@EIA - parameters[i] = new Byte("1"); //default //@EIA - else if(parameterUnassigned_[i]) //@EIA - parameters[i] = new Byte("2"); //unassigned //@EIA - else //@EIA - parameters[i] = sqlData.getObject(); - //@KBD if(containsLocator_ == LOCATOR_UNKNOWN) - //@KBD { - //@KBD int sqlType = sqlData.getSQLType(); - //@KBD if (sqlType == SQLData.CLOB_LOCATOR || - //@KBD sqlType == SQLData.BLOB_LOCATOR || - //@KBD sqlType == SQLData.DBCLOB_LOCATOR) - //@KBD { - //@KBD containsLocator_ = LOCATOR_FOUND; - //@KBD } - //@KBD } - } - - //@KBA check to see if the parameter is a locator field - if(containsLocator_ == LOCATOR_UNKNOWN) //@KBA - { //@KBA - int sqlType = sqlData.getSQLType(); //@KBA - if (sqlType == SQLData.CLOB_LOCATOR || //@KBA - sqlType == SQLData.BLOB_LOCATOR || //@KBA - sqlType == SQLData.DBCLOB_LOCATOR || //@KBA //@pdc jdbc40 -/* ifdef JDBC40 */ - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 -/* endif */ - sqlType == SQLData.XML_LOCATOR) //@xml3 - { //@KBA - containsLocator_ = LOCATOR_FOUND; //@KBA - } //@KBA - } //@KBA - } - if(containsLocator_ == LOCATOR_UNKNOWN) containsLocator_ = LOCATOR_NOT_FOUND; - - if(batch_ == null) batch_ = new Vector(); //@P0A - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "addBatch()"); - batch_.addElement(parameters); - } - } - - - - // JDBC 2.0 - /** - Adds an SQL statement to the current batch of SQL statements. - -

Do not use this form of addBatch() on a prepared statement. - - @param sql The SQL statement to be added to the current batch. - This can be any SQL statement that does not return - a result set. - - @exception SQLException This exception is always thrown. - **/ - public void addBatch(String sql) throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); // @B1C - } - - - - // @BAA - /** - Creates or changes the descriptor, which describes the parameter - marker format. - - @exception SQLException If an error occurs. - **/ - private void changeDescriptor() - throws SQLException - { - // If a parameter that is not an input parameter has - // not been set, we still include it in the format. - // - // Note that we set the native type, length, scale and - // precision of each parameter in the descriptor. - // That means that if the user sets a new parameter - // value that changes one of these, then the - // descriptor needs to be changed. - // - DBSQLDescriptorDS request2 = null; //@P0C - try - { - descriptorHandle_ = id_; - //@P0CDBSQLDescriptorDS request2 = new DBSQLDescriptorDS (DBSQLDescriptorDS.FUNCTIONID_CHANGE_DESCRIPTOR, - //@P0C id_, 0, descriptorHandle_); - request2 = DBDSPool.getDBSQLDescriptorDS(DBSQLDescriptorDS.FUNCTIONID_CHANGE_DESCRIPTOR, id_, 0, descriptorHandle_); //@P0C - - DBDataFormat parameterMarkerDataFormat; - if(connection_.useExtendedFormats ()) - { - //@540 We are going to continue using DBExtendedDataFormat for this part. We use an empty string for the parameter name so we don't need 128 bytes - parameterMarkerDataFormat = new DBExtendedDataFormat (parameterCount_); - } - else - parameterMarkerDataFormat = new DBOriginalDataFormat (parameterCount_); - request2.setParameterMarkerDataFormat (parameterMarkerDataFormat); - - parameterMarkerDataFormat.setConsistencyToken (1); - parameterMarkerDataFormat.setRecordSize (parameterTotalSize_); - - if(isjvm16Synchronizer) { - try { - dummyOutputStream.write(("!!!changeDescriptor: totalParameterLength_ = " + parameterTotalSize_).getBytes()); //@dmy@C6C - } catch (Exception e) { - - } - } - - for(int i = 0; i < parameterCount_; ++i) - { - SQLData sqlData = parameterRow_.getSQLData (i+1); - - parameterMarkerDataFormat.setFieldDescriptionLength (i); - if(sqlData.getNativeType() == SQLData.NATIVE_ARRAY) //@array - { //@array - int arrayLen = ((SQLArray)sqlData).getArrayCount(); //@array - if(arrayLen > 0) //@array - parameterMarkerDataFormat.setFieldLength (i, parameterLengths_[i]/arrayLen); //@array - else //@array - parameterMarkerDataFormat.setFieldLength (i, parameterLengths_[i]); //@array - } //@array - else //@array - { - parameterMarkerDataFormat.setFieldLength (i, parameterLengths_[i]); - } - parameterMarkerDataFormat.setFieldCCSID (i, parameterRow_.getCCSID (i+1)); - - parameterMarkerDataFormat.setFieldNameLength (i, 0); - parameterMarkerDataFormat.setFieldNameCCSID (i, 0); - parameterMarkerDataFormat.setFieldName (i, "", connection_.converter_); //@P0C - - //@array (arrays sent in as the element type and zda will know they are arrays) - if(sqlData.getNativeType() == SQLData.NATIVE_ARRAY) //@array - { //@array - parameterMarkerDataFormat.setFieldSQLType (i, - (short) (((SQLArray)sqlData).getElementNativeType() | 0x0001)); //@array - } //@array - else - { - parameterMarkerDataFormat.setFieldSQLType (i, - (short) (sqlData.getNativeType() | 0x0001)); - } - - parameterMarkerDataFormat.setFieldScale (i, - (short) sqlData.getScale()); - parameterMarkerDataFormat.setFieldPrecision (i, - (short) sqlData.getPrecision()); - if(isjvm16Synchronizer) { - try { - dummyOutputStream.write(("!!!changeDescriptor: Parameter " + (i+1) + " length = " + parameterLengths_[i]).getBytes()); //@C6C - } catch (Exception e) { - - } - } - } - - connection_.send (request2, descriptorHandle_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Descriptor " + descriptorHandle_ + " created or changed"); - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - finally - { //@P0C - - if(isjvm16Synchronizer){ - if (request2 != null) { - try { - dummyOutputStream.write(("!!!changeDescriptor.inUser_(false): request2-id=" + request2.hashCode()).getBytes()); //@C6C - } catch (Exception e) {}; - } - } - if(request2 != null) { request2.returnToPool(); request2= null; } //@P0C - } - } - - - - /** - Releases the resources used by the current input parameter - values. In general, input parameter values remain in effect - for repeated executions of the prepared statement. Setting an - input parameter value to a new value automatically clears its - previous value. - - @exception SQLException If the statement is not open. - **/ - public void clearParameters () - throws SQLException - { - synchronized(internalLock_) - { // @F1A - checkOpen (); - - for(int i = 0; i < parameterCount_; ++i) - { - // @E1D parameterLengths_[i] = 0; - parameterNulls_[i] = false; - parameterDefaults_[i] = false; //@EIA - parameterUnassigned_[i] = false; //@EIA - // @E1D parameterOffsets_[i] = 0; - parameterSet_[i] = false; - } - - // @E1D parameterTotalSize_ = 0; - - if(useReturnValueParameter_) // @F2A - returnValueParameter_.set(0); // @F2A - } - } - - - - /** - Releases the prepared statement's resources immediately instead of - waiting for them to be automatically released. This closes the - current result set. - - @exception SQLException If an error occurs. - **/ - public void close () - throws SQLException - { - synchronized(internalLock_) - { // @F1A - // If this is already closed, then just do nothing. - // - // The spec does not define what happens when a connection - // is closed multiple times. The official word from the Sun - // JDBC team is that "the driver's behavior in this case - // is implementation defined. Applications that do this are - // non-portable." - if(isClosed ()) - return; - - // If a descriptor was created somewhere along - // the lines, then delete it now. - if(descriptorHandle_ != 0) - { - //@P0CDBSQLDescriptorDS request = new DBSQLDescriptorDS ( - //@P0C DBSQLDescriptorDS.FUNCTIONID_DELETE_DESCRIPTOR, - //@P0C id_, 0, descriptorHandle_); - DBSQLDescriptorDS request = null; //@P0C - try - { //@P0C - request = DBDSPool.getDBSQLDescriptorDS(DBSQLDescriptorDS.FUNCTIONID_DELETE_DESCRIPTOR, id_, 0, descriptorHandle_); //@P0C - - connection_.send (request, descriptorHandle_); - } - finally - { //@P0C - if(isjvm16Synchronizer) { - try { - dummyOutputStream.write(("!!!close.inUser_(false): request-id=" + request.hashCode()).getBytes()); // @C6C - } catch (Exception e) { - - } - } - if(request != null) { request.returnToPool(); request = null; } //@P0C - } - - descriptorHandle_ = 0; - } - - super.close (); - } - } - - - - /** - Performs common operations needed after an execute. - - @param sqlStatement The SQL statement. - @param reply The execute reply. - - @exception SQLException If an error occurs. - **/ - void commonExecuteAfter (JDSQLStatement sqlStatement, - DBReplyRequestedDS reply) // private protected - throws SQLException - { - super.commonExecuteAfter (sqlStatement, reply); - - if(prepared_) - { - - DBData resultData = null; - if(outputParametersExpected_) - resultData = reply.getResultData (); - - // Store the output parameters, if needed. - if((outputParametersExpected_) && (resultData != null)) - { - parameterRow_.setServerData (resultData); - parameterRow_.setRowIndex (0); - } - - // Handle the return value parameter, if needed. @F2A - try - { // @F2A - if(useReturnValueParameter_) // @F2A - returnValueParameter_.set(reply.getSQLCA().getErrd (1)); // @F2A //@G3C - } // @F2A - catch(DBDataStreamException e) - { // @F2A - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); // @F2A - } // @F2A - } - } - - - - /** - Performs common operations needed before an execute. - - @param sqlStatement The SQL statement. - @param request The execute request. - - @exception SQLException If an error occurs. - **/ - void commonExecuteBefore(JDSQLStatement sqlStatement, DBSQLRequestDS request) throws SQLException - { - super.commonExecuteBefore (sqlStatement, request); - - if(prepared_) - { - // Close the result set before executing again. - closeResultSet (JDCursor.REUSE_YES); - - // Validate each parameters. If a parameter is not an - // input parameter, then it is okay for it not to have been - // set. However, if an input parameter was not set, - // we throw an exception. - boolean outputExpected_ = false; // @K2A We do not want to increment our row index in commonExecuteAfter() if there are no output parameters - for(int i = 0; i < parameterCount_; ++i) - { - if(!parameterSet_[i] && parameterRow_.isInput(i+1)) - { - JDError.throwSQLException (this, JDError.EXC_PARAMETER_COUNT_MISMATCH); - } - - if(parameterRow_.isOutput(i+1)) // @K2A - outputExpected_ = true; // @K2A - if(parameterRow_.isInput(i+1)) //@array4 - parameterInputCount_ ++; //@array4 - } - if(!outputExpected_) // @K2A - outputParametersExpected_ = false; // @K2A - - // Create the descriptor if needed. This should only - // be done once (on the first execute for the prepared - // statement). - if((parameterCount_ > 0) && (descriptorHandle_ == 0)) - { - // Get the offset and length for each parameter. - // We just use the information that came in the parameter - // marker format from reply for the prepare. - parameterTotalSize_ = 0; - indicatorTotalSize_ = 0; //@array - headerTotalSize_ = 2; //@array start with 2 since column count is 2 bytes - for(int i = 0; i < parameterCount_; ++i) - { - if(!parameterRow_.containsArray_ || parameterRow_.isInput(i+1)) //@array4 - { - SQLData sqlData = parameterRow_.getSQLData(i+1); //@array - int arrayLen = 1; //@array 1 by default so size can be multiplied for non arrays also - // boolean arrayIndicatorSet = false; //@array - if(sqlData.getType() == java.sql.Types.ARRAY) //@array - { - arrayLen = ((SQLArray)sqlData).getArrayCount(); //@array - if (parameterNulls_[i] || parameterDefaults_[i] || parameterUnassigned_[i]) //@array - headerTotalSize_ += 4; //@array space for x9911ffff - else - headerTotalSize_ += 12; //@array (array column requires 12 bytes in header x9911) //@array2 - } - else - { - //non array value - headerTotalSize_ += 8; //@array (assuming row has array. x9912 is length 8) - } - //@array set input (to host) array lengths of data - //@array if null array or 0 length array, then data length is 0 - parameterLengths_[i] = parameterRow_.getLength (i+1) * arrayLen; //@array 0, 1, or more datatype-length blocks - parameterOffsets_[i] = parameterTotalSize_; - parameterTotalSize_ += parameterLengths_[i]; - - indicatorTotalSize_ += (arrayLen*2);//@array - } - - if(isjvm16Synchronizer) { - try { - dummyOutputStream.write(("!!!commonExecuteBefore: Parameter " + (i+1) + " length = " + parameterLengths_[i] ).getBytes()); //@C6C - - } catch (Exception e) { - } - } - } - if(isjvm16Synchronizer) { - try { - dummyOutputStream.write(("!!!commonExecuteBefore: totalParameterLength_ = " + parameterTotalSize_).getBytes()); //@C6C - } catch (Exception e) { - } - } - changeDescriptor(); - } - - // Add the parameter information to the execute request. - try - { - request.setStatementType(sqlStatement.getNativeType()); - - // Set the descriptor handle. - request.setParameterMarkerDescriptorHandle (descriptorHandle_); - - // If there are any parameters, then send the parameter - // values with the execute data stream. Only the - // input parameters are included here. - if(parameterCount_ > 0) - { - // In building the parameter marker data, we may discover that the // @BAA - // descriptor needs to be changed. If so, we will need to change the // @BAA - // descriptor, then rebuild the parameter marker data based on that // @BAA - // change. This is implemented using a do-while, but it should never // @BAA - // have to loop more than once, since the second time through (in a // @BAA - // particular execute) every thing should be great. // @BAA - boolean descriptorChangeNeeded = false; - - do - { - descriptorChangeNeeded = false; // Reset our flag every time through the loop. - - // Allocate the space for the Extended Parameter Marker Data @G9A - // This is the amount of space for all of the rows' data and indicators @G9A - DBData parameterMarkerData; - int rowCount = batchExecute_ ? batchParameterRows_.size() : 1; - //@array create new x382f here if parms contain array - if(parameterRow_.containsArray_) //@array - { //@array - parameterMarkerData = new DBVariableData(parameterInputCount_, 2, headerTotalSize_, indicatorTotalSize_, parameterTotalSize_); //@array x382f codepoint //@array4 - } //@array - else if(connection_.useExtendedFormats ()) - { - parameterMarkerData = new DBExtendedData(rowCount, parameterCount_, 2, parameterTotalSize_); - } - else - { - parameterMarkerData = new DBOriginalData(rowCount, parameterCount_, 2, parameterTotalSize_); - } - for(int rowLoop = 0; rowLoop < rowCount; ++rowLoop) // @G9a - { - Object[] parameters = null; // @G9A - if(batchExecute_) // @G9A - { - // @G9A - //@CRS - Don't need to synch around this because we have been called - // by executeBatch() which is already inside the synch block. - parameters = (Object[])batchParameterRows_.get(rowLoop); // @G9A - } // @G9A - - // If this is the first of multiple rows. Set the Parameter Marker @G9A - // Data code point and consistency token only once @G9A - if(rowLoop == 0) // @G9A - { - request.setParameterMarkerData (parameterMarkerData); - parameterMarkerData.setConsistencyToken (1); // @G9M - } // @G9A - - int rowDataOffset = parameterMarkerData.getRowDataOffset(rowLoop); // @G9C - for(int i = 0; i < parameterCount_; ++i) - { - // @G1 -- zero out the comm buffer if the parameter marker is null. - // If the buffer is not zero'ed out old data will be sent to - // the system possibily messing up a future request. - if((batchExecute_ && (parameters[i] == null || parameters[i] instanceof Byte)) || // @G9A //@EIC - (!batchExecute_ && (parameterNulls_[i] || parameterDefaults_[i] || parameterUnassigned_[i]))) // @B9C @G9C //@EIC - { - short indicatorValue = INDICATOR_NULL; //@EIA - if( batchExecute_ ) //@EIA - { //@EIA - if( parameters[i] == null ) //@EIA - indicatorValue = INDICATOR_NULL; //@EIA - else if( ((Byte)parameters[i]).byteValue() == 1 ) //@EIA - indicatorValue = INDICATOR_DEFAULT; //@EIA - else if( ((Byte)parameters[i]).byteValue() == 2 ) //@EIA - indicatorValue = INDICATOR_UNASSIGNED; //@EIA - } //@EIA - else //@EIA - { //@EIA - if( parameterNulls_[i] ) //@EIA - indicatorValue = INDICATOR_NULL; //@EIA - else if( parameterDefaults_[i] ) //@EIA - indicatorValue = INDICATOR_DEFAULT; //@EIA - else if ( parameterUnassigned_[i] ) //@EIA - indicatorValue = INDICATOR_UNASSIGNED; //@EIA - } //@EIA - - SQLData sqlData = parameterRow_.getSQLType(i+1); //@array - - //@array Don't set indicator here for null array, since setting header below will set it - if(sqlData.getType() != java.sql.Types.ARRAY) - parameterMarkerData.setIndicator(rowLoop, i, indicatorValue); // @G1a @G9C @EIC - - //@array only zero-out data on non-arrays - //If the whole array is null, then we do not even include blank data in the stream since a null array has space for values (just 0X9911ffff in header of 0X382f) - if(sqlData.getType() != java.sql.Types.ARRAY) //@array - { - byte[] parameterData = parameterMarkerData.getRawBytes(); // @G1a - int parameterDataOffset = rowDataOffset + parameterOffsets_[i]; // @G1a - int parameterDataLength = parameterLengths_[i] + parameterDataOffset; - for(int z=parameterDataOffset; z < parameterDataLength; parameterData[z++] = 0x00); - } - - //@array If the row contains an array, then we must also set the columnInfo in stream header - if(parameterRow_.containsArray_ && parameterRow_.isInput(i+1)) //@array //@array4 - { //@array - int arrayLen = -1; //@array - int elementType = -1; //@array - int size = -1; //@array - if(sqlData.getType() == java.sql.Types.ARRAY) //@array - { //@array - arrayLen = ((SQLArray)sqlData).getArrayCount(); //@array - elementType = ((SQLArray)sqlData).getElementNativeType(); //@array - size = parameterRow_.getLength(i+1); //@array - } //@array - ((DBVariableData)parameterMarkerData).setHeaderColumnInfo(i, (short)sqlData.getNativeType(), (short)indicatorValue, (short)elementType, size, (short)arrayLen); //@array - } //@array - } - else - { - SQLData sqlData = parameterRow_.getSQLType(i+1); //@array - if(!parameterRow_.containsArray_ || parameterRow_.isInput(i+1)) //@array4 - { - //Setting array null value here for elements inside of array) - if(sqlData.getType() == java.sql.Types.ARRAY ) //@array - { //@array - //iterate through elements and set null indicators. Array as a whole null is not set here (see above) - for (int e = 0 ; e < ((SQLArray)sqlData).getArrayCount() ; e++) //@array - { //@array - if(((SQLArray)sqlData).isElementNull(e)) //@array - parameterMarkerData.setIndicator(0, i, -1); //@array - else //@array - parameterMarkerData.setIndicator(0, i, 0); //@array - } //@array - }else - { - parameterMarkerData.setIndicator(rowLoop, i, (short) 0); // @G9C - } - } - ConvTable ccsidConverter = connection_.getConverter (parameterRow_.getCCSID (i+1)); //@P0C - - // Convert the data to bytes into the parameter marker data. // @BAA - // If there is an exception here, it means that there were // @BAA - // not enough bytes in the descriptor for the conversion. // @BAA - // If so, we get the correct length via getPrecision() // @BAA - // (assume the SQLData implementation has updated its own // @BAA - // precision as needed). // @BAA - int correctLength = -1; // @BAA - - // Put each row's values back into the SQL data type for their respective columns. - if(batchExecute_) - { - //@CRS If the type is a locator, we pass -1 here so the locator will know - // not to reset its length, because the length wasn't saved with the - // parameter when addBatch() was called, but since we reuse the SQLData - // objects, it's still saved off inside the SQLLocator. - setValue(i+1, parameters[i], null, -1); - } - - //SQLData sqlData = parameterRow_.getSQLType(i+1); // @BAC @P0C @G9C //@array move above - - try - { - if(!parameterRow_.containsArray_ || parameterRow_.isInput(i+1)) //@array4 (if array then only send input parm data) - { - //@CRS - This is the only place convertToRawBytes is ever called. - sqlData.convertToRawBytes(parameterMarkerData.getRawBytes(), rowDataOffset + parameterOffsets_[i], ccsidConverter); - if(ccsidConverter.getCcsid() == 5035) //@trnc this is not caught at setX() time - testDataTruncation(i+1, sqlData); //@trnc - } - - //@array If the row contains an array, then we must also set the columnInfo in stream header - if(parameterRow_.containsArray_ && parameterRow_.isInput(i+1)) //@array //@array4 - { //@array - //Set the stream header info for each column in addition to data in rawbytes above. - int arrayLen = -1; //@array - int elementType = -1; //@array - int size = parameterRow_.getLength(i+1); //@array - if(sqlData.getType() == java.sql.Types.ARRAY) //@array - { //@array - arrayLen = ((SQLArray)sqlData).getArrayCount(); //@array - elementType = ((SQLArray)sqlData).getElementNativeType(); //@array - } //@array - ((DBVariableData)parameterMarkerData).setHeaderColumnInfo(i, (short)sqlData.getNativeType(), (short)0, (short)elementType, size, (short)arrayLen); //@array - } //@array - - } - catch(SQLException e) - { - if(e.getSQLState().trim().equals("HY000")) //AN INTERNAL DRIVER ERROR - { - //Check error to see if it was thrown from another error - if(parameterRow_.containsArray_) //@array always use prepare/describe lengths - throw e; //@array - if(e.getMessage().indexOf("Change Descriptor") != -1){ - correctLength = sqlData.getPrecision(); // @BAA - } - else - throw e; - } - else throw e; - } // @BAA - - // If the length needed is larger than what was allocated in // @BAA - // the descriptor, then change the descriptor, and start // @BAA - // again. // @BAA - if(correctLength >= 0) - { - descriptorChangeNeeded = true; // @BAA - parameterLengths_[i] = correctLength; // @BAA - parameterTotalSize_ = parameterOffsets_[i] + correctLength; // @BAA - if((i+1) < parameterCount_) - { - for(int j = i+1; j < parameterCount_; ++j) - { - parameterOffsets_[j] = parameterTotalSize_; // @BAA - parameterTotalSize_ += parameterLengths_[j]; // @BAA - } // @BAA - } // @BAA - } // @BAA - } - } - if(descriptorChangeNeeded) changeDescriptor(); - } - } while(descriptorChangeNeeded); - request.setParameterMarkerBlockIndicator (0); - } - - // If we are expecting output parameters - // to be returned, then ask for them as result data. - if(outputParametersExpected_) request.addOperationResultBitmap(DBSQLRequestDS.ORS_BITMAP_RESULT_DATA); - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - } - } - - - - /** - Performs common operations needed after a prepare. - - @param sqlStatement The SQL statement. - @param reply The prepare reply. - - @exception SQLException If an error occurs. - **/ - void commonPrepareAfter(JDSQLStatement sqlStatement, DBReplyRequestedDS reply) throws SQLException - { - super.commonPrepareAfter(sqlStatement, reply); - - if(prepared_) - { - parameterRow_ = new JDServerRow(connection_, id_, reply.getParameterMarkerFormat(), settings_); - } - } - - - - /** - Performs common operations needed before a prepare. - - @param sqlStatement The SQL statement. - @param request The prepare request. - - @exception SQLException If an error occurs. - **/ - void commonPrepareBefore(JDSQLStatement sqlStatement, DBSQLRequestDS request) throws SQLException - { - super.commonPrepareBefore(sqlStatement, request); - - if(prepared_) - { - request.addOperationResultBitmap(DBSQLRequestDS.ORS_BITMAP_PARAMETER_MARKER_FORMAT); - } - } - - - - /** - Performs common operations in leiu of a prepare. - - @param sqlStatement The SQL statement. - @param statementIndex The cached statement index. - - @exception SQLException If an error occurs. - **/ - void commonPrepareBypass(JDSQLStatement sqlStatement, int statementIndex) throws SQLException - { - super.commonPrepareBypass(sqlStatement, statementIndex); - - if(prepared_) - { - parameterRow_ = new JDServerRow(connection_, id_, packageManager_.getCachedParameterMarkerFormat(statementIndex), settings_); - } - } - - - - /** - Runs an SQL statement that may return multiple result sets. - This closes the current result set and clears warnings - before executing the SQL statement again. - -

Under some situations, a single SQL statement may return - multiple result sets, an update count, or both. This might occur - either when executing a stored procedure that returns multiple - result sets or when dynamically executing an unknown SQL string. - -

Use Statement.getMoreResults(), Statement.getResultSet(), - and Statement.getUpdateCount() to navigate through multiple - result sets, an update count, or both. - - @return true if a result set was returned; false - if an update count was returned or nothing - was returned. - - @exception SQLException If the statement is not open, - the query timeout limit is - exceeded, or an error occurs. - **/ - public boolean execute() throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - if(!prepared_) - { - resultRow_ = commonPrepare(sqlStatement_); - prepared_ = true; - } - - commonExecute(sqlStatement_, resultRow_); - executed_ = true; - - return(resultSet_ != null); - } - } - - - - /** - Runs an SQL statement that may return multiple - result sets. This closes the current result set - and clears warnings before executing a new SQL statement. - -

Do not use this form of execute() on a prepared statement. - - @param sql The SQL statement. - @return true if a result set was returned, false - if an update count was returned or nothing - was returned. - - @exception SQLException This exception is always thrown. - **/ - public boolean execute (String sql) - throws SQLException - { - /* @B1D - // Call the super class execute() method. Note that this - // results in the prepare of a different statement, so the - // we must mark ours and not prepared. - prepared_ = false; - - return super.execute (sql); - */ - JDError.throwSQLException (this, JDError.EXC_FUNCTION_SEQUENCE); // @B1A - return false; // @B1A - } - - - //@GAA - /** - Runs an SQL statement that may return multiple result sets and - makes any auto-generated keys available for retrieval using - Statement.getGeneratedKeys(). This closes the current result set - and clears warnings before executing the new SQL statement. - -

Do not use this form of execute() on a prepared statement. - - @param sql The SQL statement. - @param autoGeneratedKeys Indicates whether auto-generated keys should be made available for - retrieval. Valid values are Statement.RETURN_GENERATED_KEYS and - Statement.NO_GENERATED_KEYS. - @return true if a result set was returned, false - if an update count was returned or nothing - was returned. - - @exception SQLException This exception is always thrown. - @since Modification 5 - **/ - public boolean execute (String sql, int autoGeneratedKeys) - throws SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_SEQUENCE); - return false; // @B1A - } - - - /** - Runs the batch of SQL statements. Batch updates can be used - to submit a set of SQL statements together as a single unit. - The SQL statements are run in the order in which they were - added to the batch. The batch is cleared after the SQL statements - are run. In addition, this closes the current result set and - clears warnings before executing the new SQL statement. - -

When batch updates are run, autocommit should usually be turned off. - This allows the caller to decide whether or not to commit the - transaction in the event that an error occurs and some of the - SQL statements in a batch fail to run. - - @return An array of row counts for the SQL statements that are run. - The array contains one element for each statement in the - batch of SQL statements. The array is ordered according to - the order in which the SQL statements were added to the batch. - - @exception SQLException If the statement is not open, - an SQL statement contains a syntax - error, the query timeout limit is - exceeded, an SQL statement returns - a result set, or an error occurs. - **/ - public int[] executeBatch() throws SQLException - { - synchronized(internalLock_) - { // @F1A - checkOpen(); - - if(batch_ == null || batch_.size() == 0) return new int[0]; - - batchParameterRows_ = new Vector(); - - int batchSize = batch_.size(); - int[] updateCounts = new int[batchSize]; - - int numSuccessful = 0; // Number of successfully executed statements in the batch. - - boolean canBatch = true; - //boolean notInsert = false; //@blksql - - try - { - // Only INSERTs can be batched, UPDATE statements must still be done one at a time. - //if(!(sqlStatement_.isInsert_)) //@blksql - //{ - // canBatch = false; - // notInsert = true; - //} - - if(!(sqlStatement_.canBatch())) - { - canBatch = false; - } - - // For sure we have a locator, so we can't batch it, - // because the host server only reserves space for one locator handle. - if(containsLocator_ == LOCATOR_FOUND) - { - canBatch = false; - } - - // Set the batch execute flag so common execute knows to use the list @G9A - // of parameter rows. @G9A - batchExecute_ = true; // @G9A - rowsInserted_ = 0; // @G9A - - // Prepare the statement if it is not already done. - if(!prepared_) - { - //@H7 Native type should ONLY be BLOCK_INSERT if the statement is of type - //@H7 "INSERT INTO MYTABLE ? ROWS VALUES (?,?)" with a ROWS VALUES clause, - //@H7 not just if we are going to send the values as a batch to the system. - //@H7 We determine whether the statement is of that form in - //@H7 JDSQLStatement.java, not here. - //@H7D sqlStatement_.setNativeType(JDSQLStatement.TYPE_BLOCK_INSERT); // @G9A - resultRow_ = commonPrepare(sqlStatement_); - prepared_ = true; - // See if the prepare returned a ResultSet. If so, error out now to avoid - // opening a cursor. Note some stored procedures won't return a ResultSet - // until the execute, so we check in both places. - if(resultSet_ != null) - { - closeResultSet(JDCursor.REUSE_YES); - JDError.throwSQLException(this, JDError.EXC_CURSOR_STATE_INVALID); - } - } - - // Execute. - if(canBatch) - { - int maximumBlockedInputRows = connection_.getMaximumBlockedInputRows(); - Enumeration list = batch_.elements(); - int count = 0; //@K1A Added support for allowing more than 32000 SQL Statements to be batched and run - int totalUpdateCount = 0; /* @A4A*/ - while (list.hasMoreElements()) - { - batchParameterRows_.add(list.nextElement()); - count++; //@K1A - if(count == maximumBlockedInputRows && list.hasMoreElements())//@K1A Checks if 32000 statements have been added to the batch, if so execute the first 32000, then continue processing the batch - { //@K1A - if(JDTrace.isTraceOn()) JDTrace.logInformation(this, "Begin batching via server-side with "+batchParameterRows_.size()+" rows."); //@K1A - commonExecute(sqlStatement_, resultRow_); //@K1A - totalUpdateCount += updateCount_; /* @A4A*/ - batchParameterRows_.clear(); //@K1A - - if (resultSet_ != null) //@K1A - { //@K1A - closeResultSet(JDCursor.REUSE_YES); //@K1A - JDError.throwSQLException(this, JDError.EXC_CURSOR_STATE_INVALID); //@K1A - } //@K1A - count = 0; //@K1A set the count for the number of statements in the batch back to zero - } //@K1A - } - if(JDTrace.isTraceOn()) JDTrace.logInformation(this, "Begin batching via server-side with "+batchParameterRows_.size()+" rows."); - commonExecute(sqlStatement_, resultRow_); - totalUpdateCount += updateCount_; /* @A4A*/ - batchParameterRows_.clear(); - if(resultSet_ != null) - { - closeResultSet(JDCursor.REUSE_YES); - JDError.throwSQLException(this, JDError.EXC_CURSOR_STATE_INVALID); - } - numSuccessful = batchSize; - // The host server does not currently report the update counts for each statement in - // the batch. We use -2 here because that is the constant for Statement.SUCCESS_NO_INFO - // as of JDBC 3.0 and JDK 1.4. When we change to build against JDK 1.4 instead of 1.3, - // we can change this to use the actual constant. - // However, if the total number of updated rows is the same as the batch size then - // we can set each of the update counts to 1. @A4A - - // Only set the count to one if the statement is an insert statement. - // The logic in JDSQLStatement only allows in insert to be batched if it is of the - // form insert ... VALUES(?,?,?) ... Any other form will not be batched - int updateCount = -2; - if ( batchSize == totalUpdateCount && sqlStatement_.isInsert_) { - updateCount = 1; - } - for(int i=0; iDo not use this form of executeQuery() on a prepared statement. - - @param sql The SQL statement. - @return The result set that contains the data produced - by the query. - - @exception SQLException This exception is always thrown. - **/ - public ResultSet executeQuery (String sql) - throws SQLException - { - /* @B1D - // Call the super class execute() method. Note that this - // results in the prepare of a different statement, so the - // we must mark ours and not prepared. - prepared_ = false; - - return super.executeQuery (sql); - */ - JDError.throwSQLException (this, JDError.EXC_FUNCTION_SEQUENCE); // @B1A - return null; // @B1A - } - - - - /** - Runs an SQL INSERT, UPDATE, or DELETE statement, or any - SQL statement that does not return a result set. - This closes the current result set and clears warnings - before executing the SQL statement again. - - @return Either the row count for INSERT, UPDATE, or - DELETE, or 0 for SQL statements that - return nothing. - - @exception SQLException If the statement is not open, - the query timeout limit is - exceeded, the statement returns - a result set, an input parameter - has not been set, or an error occurs. - **/ - public int executeUpdate() throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - // Prepare and execute. Check for a result set in both - // places. It is best to catch it after the prepare (so - // we don't open a cursor), but with some stored procedures, - // we can't catch it until the execute. - - // Prepare the statement if it is not already done. - if(!prepared_) - { - resultRow_ = commonPrepare(sqlStatement_); - prepared_ = true; - if(resultRow_ != null) JDError.throwSQLException(this, JDError.EXC_CURSOR_STATE_INVALID); - } - - // Execute. - commonExecute(sqlStatement_, resultRow_); - executed_ = true; - - if(resultSet_ != null) - { - closeResultSet(JDCursor.REUSE_YES); - JDError.throwSQLException(this, JDError.EXC_CURSOR_STATE_INVALID); - } - - return updateCount_; - } - } - - - - /** - Runs an SQL INSERT, UPDATE, or DELETE statement, or any - SQL statement that does not return a result set. - This closes the current result set and clears warnings - before executing a new SQL statement. - -

Do not use this form of executeUpdate() on a prepared statement. - - @param sql The SQL statement. - @return Either the row count for INSERT, UPDATE, or - DELETE, or 0 for SQL statements that - return nothing. - - @exception SQLException This exception is always thrown. - **/ - public int executeUpdate (String sql) - throws SQLException - { - /* @B1D - // Call the super class execute() method. Note that this - // results in the prepare of a different statement, so the - // we must mark ours and not prepared. - prepared_ = false; - - return super.executeUpdate (sql); - */ - JDError.throwSQLException (this, JDError.EXC_FUNCTION_SEQUENCE); // @B1A - return 0; // @B1A - } - - - - //@GAA - /** - Runs an SQL INSERT, UPDATE, or DELETE statement, or any - SQL statement that does not return a result set and - makes any auto-generated keys available for retrieval using - Statement.getGeneratedKeys(). - This closes the current result set and clears warnings - before executing the new SQL statement. - -

Do not use this form of executeUpdate() on a prepared statement. - - @param sql The SQL statement. - @return Either the row count for INSERT, UPDATE, or - DELETE, or 0 for SQL statements that - return nothing. - - @exception SQLException This exception is always thrown. - @since Modification 5 - **/ - public int executeUpdate (String sql, int autoGeneratedKeys) - throws SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_SEQUENCE); - return 0; - } - - - - // JDBC 2.0 - /** - Returns the ResultSetMetaData object that describes the - result set's columns. Null is returned if the statement - does not return a result set. In the following example - rsmd is null since the statement does not return a result set. -

 
-    PreparedStatement ps   = connection.prepareStatement("INSERT INTO COLLECTION.TABLE VALUES(?)");
-    ResultSetMetaData rsmd = ps.getMetaData();
-    
- - @return The metadata object, or null if the statement does not return a result set. - - @exception SQLException If the statement is not open. - **/ - public ResultSetMetaData getMetaData () - throws SQLException - { - synchronized(internalLock_) - { // @F1A - checkOpen (); - - if(resultRow_ == null) // @H6a - return null; // @H6a - - ConvTable convTable = null; // @G6A - DBExtendedColumnDescriptors extendedDescriptors = getExtendedColumnDescriptors(); // @G6A - // If we have extendedDescriptors, send a ConvTable to convert them, else pass null // @G6A - if(extendedDescriptors != null) // @G6A - { - // @G6A - convTable = ((AS400JDBCConnection)connection_).converter_; // @G6A - } // @G6A - return new AS400JDBCResultSetMetaData (connection_.getCatalog (), - resultSetConcurrency_, cursor_.getName (), resultRow_, - extendedDescriptors, convTable, connection_); //@in1 // @G6A - } - } - - - - // @G4A - // Return the class name of a parameter for ParameterMetaData support. - String getParameterClassName (int param) - throws SQLException - { - if(param > getParameterCount() || param < 1) - { - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - synchronized(internalLock_) - { - checkOpen (); - - if(useReturnValueParameter_) // @G8a - { - // @G8a - if(param == 1) // @G8a - return returnValueParameter_.getJavaClassName(); // @G8a - else // @G8a - param--; // @G8a - } // @G8a - - return parameterRow_.getSQLData(param).getJavaClassName(); - } - } - - - - // @G4A - // Return the parameter count for ParameterMetaData support. - int getParameterCount () - throws SQLException - { - synchronized(internalLock_) - { - checkOpen (); - if(useReturnValueParameter_) - { - return parameterCount_ + 1; - } - return parameterCount_; - } - } - - - - // @G4A JDBC 3.0 - /** - Returns the number, types, and properties of a PreparedStatement - object's parameters. - - @return The ParameterMetaData object that describes this - prepared statement object. - - @exception SQLException If the statement is not open. - @since Modification 5 - **/ - public ParameterMetaData getParameterMetaData() - throws SQLException - { - synchronized(internalLock_) - { - checkOpen (); - return(ParameterMetaData)(Object) new AS400JDBCParameterMetaData (this); - } - } - - - - // @G4A - // Return the mode of a parameter for ParameterMetaData support. - int getParameterMode (int param) - throws SQLException - { - if(param > getParameterCount() || param < 1) - { - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - synchronized(internalLock_) - { - checkOpen (); - - if(useReturnValueParameter_) // @G8a - { - // @G8a - if(param == 1) // @G8a - return ParameterMetaData.parameterModeOut; // @G8a - else // @G8a - param--; // @G8a - } // @G8a - - boolean input = parameterRow_.isInput(param); - boolean output = parameterRow_.isOutput(param); - - if(input && output) - { - return ParameterMetaData.parameterModeInOut; - } - else if(input) - { - return ParameterMetaData.parameterModeIn; - } - else if(output) - { - return ParameterMetaData.parameterModeOut; - } - else - return ParameterMetaData.parameterModeUnknown; - } - } - - - - // @G4A - // Return the type of a parameter for ParameterMetaData support. - int getParameterType (int param) - throws SQLException - { - if(param > getParameterCount() || param < 1) - { - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - synchronized(internalLock_) - { - checkOpen (); - - if(useReturnValueParameter_) // @G8a - { - // @G8a - if(param == 1) // @G8a - return returnValueParameter_.getType(); // @G8a - else // @G8a - param--; // @G8a - } // @G8a - - return parameterRow_.getSQLData(param).getType(); - } - } - - - - // @G4A - // Return the type name of a parameter for ParameterMetaData support. - String getParameterTypeName (int param) - throws SQLException - { - if(param > getParameterCount() || param < 1) - { - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - synchronized(internalLock_) - { - checkOpen (); - - if(useReturnValueParameter_) // @G8a - { - // @G8a - if(param == 1) // @G8a - return returnValueParameter_.getTypeName(); // @G8a - else // @G8a - param--; // @G8a - } // @G8a - - return parameterRow_.getSQLData(param).getTypeName(); - } - } - - - - // @G4A - // Return the precision of a parameter for ParameterMetaData support. - int getPrecision (int param) - throws SQLException - { - if(param > getParameterCount() || param < 1) - { - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - synchronized(internalLock_) - { - checkOpen (); - - if(useReturnValueParameter_) // @G8a - { - // @G8a - if(param == 1) // @G8a - return returnValueParameter_.getPrecision(); // @G8a - else // @G8a - param--; // @G8a - } // @G8a - - return parameterRow_.getSQLData(param).getPrecision(); - } - } - - - - // @G4A - // Return the scale of a parameter for ParameterMetaData support. - int getScale (int param) - throws SQLException - { - if(param > getParameterCount() || param < 1) - { - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - synchronized(internalLock_) - { - checkOpen (); - - if(useReturnValueParameter_) // @G8a - { - // @G8a - if(param == 1) // @G8a - return returnValueParameter_.getScale(); // @G8a - else // @G8a - param--; // @G8a - } // @G8a - - return parameterRow_.getSQLData(param).getScale(); - } - } - - - - // @G4A - // Return whether a parameter is nullable for ParameterMetaData support. - int isNullable (int param) - throws SQLException - { - if(param > getParameterCount() || param < 1) - { - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - synchronized(internalLock_) - { - checkOpen (); - - if(useReturnValueParameter_) // @G8a - { - // @G8a - if(param == 1) // @G8a - return ResultSetMetaData.columnNoNulls; // @G8a - else // @G8a - param--; // @G8a - } // @G8a - - return parameterRow_.isNullable(param); - } - } - - - - // @G4A - // Return whether a parameter is signed for ParameterMetaData support. - boolean isSigned (int param) - throws SQLException - { - if(param > getParameterCount() || param < 1) - { - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - synchronized(internalLock_) - { - checkOpen (); - - if(useReturnValueParameter_) // @G8a - { - // @G8a - if(param == 1) // @G8a - return returnValueParameter_.isSigned(); // @G8a - else // @G8a - param--; // @G8a - } // @G8a - - return parameterRow_.getSQLData(param).isSigned(); - } - } - - - - // JDBC 2.0 - /** - Sets an input parameter to an Array value. DB2 for IBM i - only supports arrays in stored procedures. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - **/ - public void setArray (int parameterIndex, Array parameterValue) - throws SQLException - { - //@array new support - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setArray()"); - if(parameterValue == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: Array type " + parameterValue.getBaseTypeName()); - } - - if(!sqlStatement_.isProcedureCall()) //@array - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); //@array - - setValue (parameterIndex, parameterValue, null, -1); - } - - - - /** - Sets an input parameter to an ASCII stream value. The driver - reads the data from the stream as needed until no more bytes - are available. The driver converts this to an SQL VARCHAR - value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param length The number of bytes in the stream. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - the length is not valid, - the input stream does not contain all - ASCII characters, or an error occurs - while reading the input stream. - **/ - public void setAsciiStream (int parameterIndex, - InputStream parameterValue, - int length) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setAsciiStream()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + length); // @H1A - } // @H1A - - // Validate the length parameter - if(length < 0) - JDError.throwSQLException (this, JDError.EXC_BUFFER_LENGTH_INVALID); - - // @J0A added the code from setValue in this method because streams and readers are handled specially - synchronized(internalLock_) - { - checkOpen (); - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check if the parameter index refers to the return value parameter. - // This is an OUT parameter, so sets are not allowed. If its not - // parameter index 1, then decrement the parameter index, since we - // are "faking" the return value parameter. - if(useReturnValueParameter_) - { - if(parameterIndex == 1) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - else - --parameterIndex; - } - - // Check that the parameter is an input parameter. - if(! parameterRow_.isInput (parameterIndex)) - JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Set the parameter data. If there is a type mismatch, - // set() with throw an exception. - SQLData sqlData = parameterRow_.getSQLType(parameterIndex); - if(parameterValue != null) - { - - try - { - // If the data is a locator, then set its handle. - int sqlType = sqlData.getSQLType(); //@xml3 - if(sqlType == SQLData.CLOB_LOCATOR || - sqlType == SQLData.BLOB_LOCATOR || - sqlType == SQLData.DBCLOB_LOCATOR || //@pdc jdbc40 -/* ifdef JDBC40 */ - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 -/* endif */ - sqlType == SQLData.XML_LOCATOR) //@xml3 - { - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; - sqlDataAsLocator.setHandle(parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - if(JDTrace.isTraceOn()) JDTrace.logInformation(this, "locator handle: " + parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - sqlData.set(new ConvTableReader(parameterValue, 819, 0, LOB_BLOCK_SIZE), null, length); // @J0M hacked this to use the scale parm for the length - } - else - { - sqlData.set (JDUtilities.readerToString(new ConvTableReader(parameterValue, 819, 0, LOB_BLOCK_SIZE), length), null, -1); - } - } - catch(UnsupportedEncodingException uee) - { - /* do nothing */ - } - - testDataTruncation (parameterIndex, sqlData); - } - // Parameters can be null; you can call one of the set methods to null out a - // field of the database. - parameterNulls_[parameterIndex-1] = (parameterValue == null); - parameterDefaults_[parameterIndex-1] = false; //@EIA - parameterUnassigned_[parameterIndex-1] = false; //@EIA - parameterSet_[parameterIndex-1] = true; - - } - - //@J0M setValue (parameterIndex, - //@J0M (parameterValue == null) ? null : JDUtilities.streamToString (parameterValue, length, "ISO8859_1"), // @B2C - //@J0M null, -1); //@P0C - } - - - - /** - Sets an input parameter to a BigDecimal value. The driver converts - this to an SQL NUMERIC value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, or the parameter - is not an input parameter. - **/ - public void setBigDecimal (int parameterIndex, BigDecimal parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setBigDecimal()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.toString()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); - } - - - - /** - Sets an input parameter to a binary stream value. The driver - reads the data from the stream as needed until no more bytes - are available. The driver converts this to an SQL VARBINARY - value. - -
If a parameter is set using setBinaryStream, then the parameter - must be reset prior to the second execute of the PreparedStatement object. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param length The number of bytes in the stream. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - the length is not valid, or - an error occurs while reading the - input stream. - **/ - public void setBinaryStream(int parameterIndex, InputStream parameterValue, int length) throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setBinaryStream()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + length); // @H1A - } // @H1A - - // Validate the length parameter - if(length < 0) - JDError.throwSQLException (this, JDError.EXC_BUFFER_LENGTH_INVALID); - - // @J0A added the code from setValue in this method because streams and readers are handled specially - synchronized(internalLock_) //@KKC Removed comment brace - { - checkOpen (); - - // Validate the parameter index. - if ((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check if the parameter index refers to the return value parameter. - // This is an OUT parameter, so sets are not allowed. If it's not - // parameter index 1, then decrement the parameter index, since we - // are "faking" the return value parameter. - if (useReturnValueParameter_) - { - if (parameterIndex == 1) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - else - --parameterIndex; - } - - // Check that the parameter is an input parameter. - if (! parameterRow_.isInput (parameterIndex)) - JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Set the parameter data. If there is a type mismatch, - // set() will throw an exception. - SQLData sqlData = parameterRow_.getSQLType(parameterIndex); - if (parameterValue != null) - { - // If the data is a locator, then set its handle. - if (sqlData instanceof SQLLocator) - { - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; - sqlDataAsLocator.setHandle (parameterRow_.getFieldLOBLocatorHandle (parameterIndex)); - // Don't convert immediately to Bytes. This causes memory problems with Large lobs @B3A - // sqlData.set (JDUtilities.streamToBytes(parameterValue, length), null, length);//@set1 allow setX one time and reuse execute() without having to reset stream - sqlData.set (parameterValue, null, length); // @J0M hacked this to use the scale parm for the length - - } - else - { - sqlData.set (JDUtilities.streamToBytes(parameterValue, length), null, length); - } - - testDataTruncation (parameterIndex, sqlData); - } - // Parameters can be null; you can call one of the set methods to null out a - // field of the database. - parameterNulls_[parameterIndex-1] = (parameterValue == null); - parameterDefaults_[parameterIndex-1] = false; //@EIA - parameterUnassigned_[parameterIndex-1] = false; //@EIA - parameterSet_[parameterIndex-1] = true; - - } - //@KKC */ - //@KKC setValue(parameterIndex, parameterValue, null, length); - //@J0D setValue (parameterIndex, - //@J0D (parameterValue == null) ? null : JDUtilities.streamToBytes (parameterValue, length), // @B2C - //@J0D null, -1); - } - - - - // JDBC 2.0 - /** - Sets an input parameter to a Blob value. The driver - converts this to an SQL BLOB value. -
If proxy support is in use, the Blob must be serializable. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - or the parameter is not serializable - (when proxy support is in use). - **/ - public void setBlob (int parameterIndex, Blob parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setBlob()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + parameterValue.length()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); - } - - - - /** - Sets an input parameter to a Java boolean value. The driver - converts this to an SQL SMALLINT value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the index is not valid, or - the parameter is not an input parameter. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIT, but DB2 for IBM i - // does not support that. - // - public void setBoolean (int parameterIndex, boolean parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setBoolean()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue); // @H1A - } // @H1A - - setValue (parameterIndex, - new Short ((short) (parameterValue ? 1 : 0)), null, -1); - } - - - - /** - Sets an input parameter to a Java byte value. The driver - converts this to an SQL SMALLINT value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the index is not valid, or - the parameter is not an input parameter. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL TINYINT, but DB2 for IBM i - // does not support that. - // - public void setByte (int parameterIndex, byte parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setByte()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue); // @H1A - } // @H1A - - setValue (parameterIndex, new Short (parameterValue), null, -1); - } - - - - /** - Sets an input parameter to a Java byte array value. The driver - converts this to an SQL VARBINARY value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, or the parameter - is not an input parameter. - **/ - public void setBytes (int parameterIndex, byte[] parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setBytes()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else if(parameterValue.length > maxToLog_) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + parameterValue.length); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + parameterValue.length + " value: " + new String(parameterValue) ); // @H1A //@PDC - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); - } - - - - // JDBC 2.0 - /** - Sets an input parameter to a character stream value. The driver - reads the data from the character stream as needed until no more - characters are available. The driver converts this to an SQL - VARCHAR value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param length The number of characters to read from the reader. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - the length is not valid, - or an error occurs while reading the - character stream - **/ - public void setCharacterStream (int parameterIndex, - Reader parameterValue, - int length) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setCharacterStream()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + length); // @H1A - } // @H1A - - // Validate length parameter - if(length < 0) - JDError.throwSQLException (this, JDError.EXC_BUFFER_LENGTH_INVALID); - - // @J0A added the code from setValue in this method because streams and readers are handled specially - synchronized(internalLock_) - { - checkOpen (); - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check if the parameter index refers to the return value parameter. - // This is an OUT parameter, so sets are not allowed. If its not - // parameter index 1, then decrement the parameter index, since we - // are "faking" the return value parameter. - if(useReturnValueParameter_) - { - if(parameterIndex == 1) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - else - --parameterIndex; - } - - // Check that the parameter is an input parameter. - if(! parameterRow_.isInput (parameterIndex)) - JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Set the parameter data. If there is a type mismatch, - // set() with throw an exception. - SQLData sqlData = parameterRow_.getSQLType(parameterIndex); - if(parameterValue != null) - { - - // If the data is a locator, then set its handle. - int sqlType = sqlData.getSQLType(); //@xml3 - if(sqlType == SQLData.CLOB_LOCATOR || - sqlType == SQLData.BLOB_LOCATOR || - sqlType == SQLData.DBCLOB_LOCATOR || //@pdc jdbc40 - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 - sqlType == SQLData.XML_LOCATOR) //@xml3 - { - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; - sqlDataAsLocator.setHandle(parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - if(JDTrace.isTraceOn()) JDTrace.logInformation(this, "locator handle: " + parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - // Go back to reading the stream at execute time. - sqlData.set(parameterValue, null, length); // @J0M hacked this to use the scale parameter for the length - // sqlData.set(JDUtilities.readerToString(parameterValue, length), null, -1); //@pdc length is incorrect for double-byte chars. Use a slower, but correct method, until we can create a real ConvTableReader - } - else - { - sqlData.set(JDUtilities.readerToString(parameterValue, length), null, -1); - } - - testDataTruncation (parameterIndex, sqlData); - } - // Parameters can be null; you can call one of the set methods to null out a - // field of the database. - parameterNulls_[parameterIndex-1] = (parameterValue == null); - parameterDefaults_[parameterIndex-1] = false; //@EIA - parameterUnassigned_[parameterIndex-1] = false; //@EIA - parameterSet_[parameterIndex-1] = true; - - } - - // @J0D setValue (parameterIndex, - // @J0D (parameterValue == null) ? null : JDUtilities.readerToString (parameterValue, length), // @B2C - // @J0D null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Sets an input parameter to a Clob value. The driver - converts this to an SQL CLOB value. -
If proxy support is in use, the Clob must be serializable. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - or the parameter is not serializable - (when proxy support is in use). - **/ - public void setClob (int parameterIndex, Clob parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setClob()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else if(parameterValue.length() > maxToLog_) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.getSubString(1, (int)parameterValue.length())); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + parameterValue.length()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); - } - - - - /** - Sets an input parameter to a java.sql.Date value using the - default calendar. The driver converts this to an SQL DATE - value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, or the parameter - is not an input parameter. - **/ - public void setDate (int parameterIndex, Date parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setDate()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.toString()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Sets an input parameter to a java.sql.Date value using a - calendar other than the default. The driver converts this - to an SQL DATE value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param calendar The calendar. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - or the calendar is null. - **/ - public void setDate (int parameterIndex, - Date parameterValue, - Calendar calendar) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setDate()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.toString()); // @H1A - } // @H1A - - if(calendar == null) - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - setValue (parameterIndex, parameterValue, calendar, -1); - } - - //@EIA 550 extended indicator defaults - /** - Sets an input parameter to the default value - @param parameterIndex The parameter index (1-based). - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void setDB2Default(int parameterIndex) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setDB2Default()"); - JDTrace.logInformation (this, "parameter index: " + parameterIndex); - } - - setValueExtendedIndicator(parameterIndex, 1); //1 is default - - } - - //@EIA 550 extended indicator defaults - /** - Sets an input parameter to the default value. This is a the same as setDB2Default. - @param parameterIndex The parameter index (1-based). - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void setDBDefault(int parameterIndex) throws SQLException - { - setDB2Default(parameterIndex); - } - - //@EIA 550 extended indicator defaults - /** - Sets an input parameter to unassigned - @param parameterIndex The parameter index (1-based). - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void setDB2Unassigned(int parameterIndex) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setDB2Unassigned()"); - JDTrace.logInformation (this, "parameter index: " + parameterIndex); - } - - setValueExtendedIndicator(parameterIndex, 2); //2 is unassigned - - } - - - //@EIA 550 extended indicator defaults - /** - Sets an input parameter to unassigned. This is a the same as setDB2Unassigned. - @param parameterIndex The parameter index (1-based). - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void setDBUnassigned(int parameterIndex) throws SQLException - { - setDB2Unassigned(parameterIndex); //2 is unassigned - } - - - /** - Sets an input parameter to a Java double value. The driver - converts this to an SQL DOUBLE value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the index is not valid or - the parameter is not an input parameter. - **/ - public void setDouble (int parameterIndex, double parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setDouble()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue); // @H1A - } // @H1A - - setValue (parameterIndex, new Double (parameterValue), null, -1); - } - - - - /** - Sets an input parameter to a Java float value. The driver - converts this to an SQL REAL value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the index is not valid, or - the parameter is not an input parameter. - **/ - // - // Note: The JDBC 1.22 specification states that this - // method should set an SQL FLOAT value. However, - // all tables map float to REAL. Otherwise, - // nothing is symmetrical and certain INOUT - // parameters do not work. - // - public void setFloat (int parameterIndex, float parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setFloat()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue); // @H1A - } // @H1A - - setValue (parameterIndex, new Float (parameterValue), null, -1); - } - - - - /** - Sets an input parameter to a Java int value. The driver - converts this to an SQL INTEGER value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the index is not valid or - the parameter is not an input parameter. - **/ - public void setInt (int parameterIndex, int parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setInt()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue); // @H1A - } // @H1A - - setValue (parameterIndex, new Integer (parameterValue), null, -1); - } - - - - // @D0C - /** - Sets an input parameter to a Java long value. - If the connected system supports SQL BIGINT data, the driver - converts this to an SQL BIGINT value. Otherwise, the driver - converts this to an SQL INTEGER value. SQL BIGINT data is - supported on V4R5 and later. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the index is not valid, or - the parameter is not an input parameter. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIGINT, but DB2 for IBM i - // does not support that until V4R5. - // - public void setLong (int parameterIndex, long parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setLong()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue); // @H1A - } // @H1A - - setValue (parameterIndex, new Long(parameterValue), null, -1); // @D0C - } - - - - /** - Sets an input parameter to SQL NULL. - - @param parameterIndex The parameter index (1-based). - @param sqlType The SQL type code defined in java.sql.Types. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - or the SQL type is not valid. - **/ - public void setNull (int parameterIndex, int sqlType) - throws SQLException - { - // @BBD if (sqlType != parameterRow_.getSQLData (parameterIndex).getType ()) - // @BBD JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // @D8 ignore the type supplied by the user. We are checking it - // only to rigidly follow the JDBC spec. Ignoring the type - // will make us a friendlier driver. - // - // @D8d testSQLType(sqlType, parameterIndex); // @BBA - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setNull()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - } // @H1A - - setValue (parameterIndex, null, null, -1); - } - - - // @B4 - Added for JDK 2.0RC1 - typeName can be ignored, since it is not relevant to IBM i. - /** - Sets an input parameter to SQL NULL. - - @param parameterIndex The parameter index (1-based). - @param sqlType The SQL type code defined in java.sql.Types. - @param typeName The fully-qualified name of an SQL structured type. This value will be ignored. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - or the SQL type is not valid. - **/ - public void setNull (int parameterIndex, int sqlType, String typeName) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setNull()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - } // @H1A - - setNull (parameterIndex, sqlType); - } - - /** - Sets an input parameter to an Object value. The driver converts - this to a value of an SQL type, depending on the type of the - specified value. The JDBC specification defines a standard - mapping from Java types to SQL types. In the cases where a - SQL type is not supported by DB2 for IBM i, the - next closest matching type - is used. -
If proxy support is in use, the Object must be serializable. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - the type of value is not supported, - or the parameter is not serializable - (when proxy support is in use). - **/ - public void setObject (int parameterIndex, Object parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setObject()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " type: " + parameterValue.getClass().getName()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); //@P0C - } - - - - /** - Sets an input parameter to an Object value. The driver converts - this to a value with the specified SQL type. -
If proxy support is in use, the Object must be serializable. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param sqlType The SQL type code defined in java.sql.Types. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - the SQL type is not valid, - or the parameter is not serializable - (when proxy support is in use). - **/ - public void setObject (int parameterIndex, - Object parameterValue, - int sqlType) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // @BBD if (sqlType != parameterRow_.getSQLData (parameterIndex).getType ()) - // @BBD JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // @D8 ignore the type supplied by the user. We are checking it - // only to rigidly follow the JDBC spec. Ignoring the type - // will make us a friendlier driver. - // - // @D8d testSQLType(sqlType, parameterIndex); // @BBA - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setObject()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " type: " + parameterValue.getClass().getName()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); //@P0C - } - - - - /** - Sets an input parameter to an Object value. The driver converts - this to a value with the specified SQL type. -
If proxy support is in use, the Object must be serializable. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param sqlType The SQL type code defined in java.sql.Types. - @param scale The number of digits after the decimal - if sqlType is DECIMAL or NUMERIC. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - the SQL type is not valid, - the scale is not valid, - or the parameter is not serializable - (when proxy support is in use). - **/ - public void setObject (int parameterIndex, - Object parameterValue, - int sqlType, - int scale) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // @BBD if (sqlType != parameterRow_.getSQLData (parameterIndex).getType ()) - // @BBD JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // @D8 ignore the type supplied by the user. We are checking it - // only to rigidly follow the JDBC spec. Ignoring the type - // will make us a friendlier driver. - // - // @D8d testSQLType(sqlType, parameterIndex); // @BBA - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setObject()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " type: " + parameterValue.getClass().getName()); // @H1A - } // @H1A - - if(scale < 0) - JDError.throwSQLException (this, JDError.EXC_SCALE_INVALID); -/* ifdef JDBC40 */ - if (parameterValue instanceof SQLXML) //@xmlspec - setSQLXML(parameterIndex, (SQLXML)parameterValue); //@xmlspec - else -/* endif */ - - setValue (parameterIndex, parameterValue, null, scale); //@P0C - } - - - - // JDBC 2.0 - /** - Sets an input parameter to a Ref value. DB2 for IBM i - does not support structured types. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException Always thrown because DB2 for IBM i does not support structured types. - **/ - public void setRef (int parameterIndex, Ref parameterValue) - throws SQLException - { - JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - } - - - - /** - Sets an input parameter to a Java short value. The driver - converts this to an SQL SMALLINT value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the index is not valid or - the parameter is not an input parameter. - **/ - public void setShort (int parameterIndex, short parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setShort()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue); // @H1A - } // @H1A - - setValue (parameterIndex, new Short (parameterValue), null, -1); - } - - - - /** - Sets an input parameter to a String value. The driver - converts this to an SQL VARCHAR value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, or the parameter - is not an input parameter. - **/ - public void setString (int parameterIndex, String parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setString()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else if(parameterValue.length() > maxToLog_) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + parameterValue.length()); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue); // @H1A - } // @H1A - //if(parameterIndex <= parameterCount_ && parameterIndex > 0) //@pdc - //parameterValue = AS400BidiTransform.convertDataToHostCCSID(parameterValue, connection_, //Bidi-HCG - // parameterRow_.getCCSID (parameterIndex)); //Bidi-HCG - - setValue (parameterIndex, parameterValue, null, -1); // @B7C @P0C - } - - - - /** - Sets an input parameter to a java.sql.Time value using the - default calendar. The driver converts this to an SQL TIME value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, or the parameter - is not an input parameter. - **/ - public void setTime (int parameterIndex, Time parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setTime()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.toString()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Sets an input parameter to a java.sql.Time value using a calendar - other than the default. The driver converts this to an SQL TIME - value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param calendar The calendar. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - or the calendar is null. - **/ - public void setTime (int parameterIndex, - Time parameterValue, - Calendar calendar) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setTime()"); // @H1 - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.toString()); // @H1A - } // @H1A - - if(calendar == null) - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - setValue (parameterIndex, parameterValue, calendar, -1); - } - - - - /** - Sets an input parameter to a java.sql.Timestamp value using the - default calendar. The driver converts this to an SQL TIMESTAMP - value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, or the parameter - is not an input parameter. - **/ - public void setTimestamp (int parameterIndex, Timestamp parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setTimeStamp()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.toString()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Sets an input parameter to a java.sql.Timestamp value using a - calendar other than the default. The driver converts this to - an SQL TIMESTAMP value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param calendar The calendar. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - or the calendar is null. - **/ - public void setTimestamp (int parameterIndex, - Timestamp parameterValue, - Calendar calendar) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setTimeStamp()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.toString()); // @H1A - } // @H1A - - if(calendar == null) - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - setValue (parameterIndex, parameterValue, calendar, -1); - } - - - - /** - Sets an input parameter to a Unicode stream value. The driver - reads the data from the stream as needed until no more bytes - are available. The driver converts this to an SQL VARCHAR - value. -

Note that the number of bytes in a Unicode stream can be - computed as 2 multiplied by the number of characters plus 2 bytes for the - byte-order mark. If an uneven number of bytes is specified, - then Java will convert this to an empty String. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param length The number of bytes in the stream. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, the length - is not valid, - the input stream does not contain all - Unicode characters, or an error occurs - while reading the input stream - - @deprecated Use setCharacterStream(int, Reader, int) instead. - @see #setCharacterStream - **/ - public void setUnicodeStream (int parameterIndex, - InputStream parameterValue, - int length) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setUnicodeStream()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + length); // @H1A - } // @H1A - - // Validate the length parameter - if(length < 0) - JDError.throwSQLException (this, JDError.EXC_BUFFER_LENGTH_INVALID); - - // @J0A added the code from setValue in this method because streams and readers are handled specially - synchronized(internalLock_) - { - checkOpen (); - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check if the parameter index refers to the return value parameter. - // This is an OUT parameter, so sets are not allowed. If its not - // parameter index 1, then decrement the parameter index, since we - // are "faking" the return value parameter. - if(useReturnValueParameter_) - { - if(parameterIndex == 1) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - else - --parameterIndex; - } - - // Check that the parameter is an input parameter. - if(! parameterRow_.isInput (parameterIndex)) - JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Set the parameter data. If there is a type mismatch, - // set() with throw an exception. - SQLData sqlData = parameterRow_.getSQLType(parameterIndex); - if(parameterValue != null) - { - - try - { - // If the data is a locator, then set its handle. - int sqlType = sqlData.getSQLType(); //@xml3 - if(sqlType == SQLData.CLOB_LOCATOR || - sqlType == SQLData.BLOB_LOCATOR || - sqlType == SQLData.DBCLOB_LOCATOR || //@pdc jdbc40 -/* ifdef JDBC40 */ - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 -/* endif */ - sqlType == SQLData.XML_LOCATOR) //@xml3 - { - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; - sqlDataAsLocator.setHandle(parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - if(JDTrace.isTraceOn()) JDTrace.logInformation(this, "locator handle: " + parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - sqlData.set(new ConvTableReader(parameterValue, 13488, 0, LOB_BLOCK_SIZE), null, length/2); // @J0M hacked this to use the scale parm for the length - } - else - { - sqlData.set (JDUtilities.readerToString(new ConvTableReader(parameterValue, 13488, 0, LOB_BLOCK_SIZE), length/2), null, -1); - } - } - catch(UnsupportedEncodingException uee) - { - /* do nothing */ - } - - testDataTruncation (parameterIndex, sqlData); - } - // Parameters can be null; you can call one of the set methods to null out a - // field of the database. - parameterNulls_[parameterIndex-1] = (parameterValue == null); - parameterDefaults_[parameterIndex-1] = false; //@EIA - parameterUnassigned_[parameterIndex-1] = false; //@EIA - parameterSet_[parameterIndex-1] = true; - - } - - //@J0D setValue (parameterIndex, - //@J0D (parameterValue == null) ? null : JDUtilities.streamToString (parameterValue, length, "UnicodeBig"), // @B2C @B3C @H2C @H3C - //@J0D null, -1); //@P0C - } - - - - // @G4A JDBC 3.0 - /** - Sets an input parameter to a URL value. The driver converts this to an - SQL DATALINK value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, or the parameter - is not an input parameter. - @since Modification 5 - **/ - public void setURL (int parameterIndex, URL parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setURL()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.toString()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); - } - - - - /** - Sets an input parameter value for the specified index, - and performs all appropriate validation. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null if - the value is SQL NULL. - @param calendar The calendar, or null if not - applicable. - @param scale The scale, or -1 if not applicable. - - @exception SQLException If the statement is not open, - the index is not valid or - the parameter is not an input - parameter. - **/ - void setValue(int parameterIndex, Object parameterValue, Calendar calendar, int scale) throws SQLException - { - - synchronized(internalLock_) - { // @F1A - checkOpen(); - - // Check if the parameter index refers to the return value parameter. @F2A - // This is an OUT parameter, so sets are not allowed. If its not @F2A - // parameter index 1, then decrement the parameter index, since we @F2A - // are "faking" the return value parameter. @F2A - if(useReturnValueParameter_) - { // @F2A - if(parameterIndex == 1) // @F2A - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID);// @F2A - else // @F2A - --parameterIndex; // @F2A - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - { - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - - // Check that the parameter is an input parameter. - if(!parameterRow_.isInput(parameterIndex)) JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Set the parameter data. If there is a type mismatch, - // set() with throw an exception. - SQLData sqlData = parameterRow_.getSQLType(parameterIndex); //@P0C - if(parameterValue != null) - { // @B6C - // If the data is a locator, then set its handle. @B6A - int sqlType = sqlData.getSQLType(); - if((sqlType == SQLData.CLOB_LOCATOR || - sqlType == SQLData.BLOB_LOCATOR || - sqlType == SQLData.DBCLOB_LOCATOR || //@pdc jdbc40 -/* ifdef JDBC40 */ - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 -/* endif */ - sqlType == SQLData.XML_LOCATOR)) //@xml3 - { // @B6A - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; // @B6A - sqlDataAsLocator.setHandle(parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); // @B6A - if(JDTrace.isTraceOn()) JDTrace.logInformation(this, "locator handle: " + parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - } // @B6A - - sqlData.set(parameterValue, calendar, scale); - if (dataTruncation_ || !sqlData.isText()) - { - testDataTruncation(parameterIndex, sqlData); // @B5C @G5move - } - } - // Parameters can be null; you can call one of the set methods to null out a - // field of the database. // @B6A - parameterNulls_[parameterIndex-1] = (parameterValue == null); - parameterDefaults_[parameterIndex-1] = false; //@EIA - parameterUnassigned_[parameterIndex-1] = false; //@EIA - parameterSet_[parameterIndex-1] = true; - } - } - - //@EIA new method - /** - Sets an input parameter value for the specified index, - and performs all appropriate validation when the value is one of the - valid Extended Indicator values: default or unassigned. - - Note: this is the same type of method as setValue() above, but we - have no way to pass in the special values without hacking some sort - of flag string for the value, and that seemed to be a messy and slow - way to do this. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter 1="default" or 2="unassigned". - - @exception SQLException If the statement is not open, - the index is not valid or - the parameter is not an input - parameter. - **/ - void setValueExtendedIndicator(int parameterIndex, int parameterValue) throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - // Check if the parameter index refers to the return value parameter. - // This is an OUT parameter, so sets are not allowed. If its not - // parameter index 1, then decrement the parameter index, since we - // are "faking" the return value parameter. - if(useReturnValueParameter_) - { - if(parameterIndex == 1) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - else - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - { - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - - // Check that the parameter is an input parameter. - if(!parameterRow_.isInput(parameterIndex)) JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - parameterNulls_[parameterIndex-1] = false; - parameterDefaults_[parameterIndex-1] = parameterValue == 1 ? true: false; - parameterUnassigned_[parameterIndex-1] = parameterValue == 2 ? true: false; - parameterSet_[parameterIndex-1] = true; - } - } - - - /** - Tests if a DataTruncation occurred on the write of a piece of - data and throws a DataTruncation exception if so. The data truncation - flag is also taken into consideration for string data. The rules are: - 1) If updating database with numeric data and data truncated, throw exception - 2) If numeric data is part of a query and data truncated, post warning - 3) If string data and suppress truncation, return - 4) If updating database with string data and check truncation and data truncated, throw exception - 5) If string data is part of a query and check truncation and data truncated, post warning - - @param index The index (1-based). - @param data The data that was written or null for SQL NULL. - **/ - private void testDataTruncation(int parameterIndex, SQLData data) throws SQLException //@trunc - { - if(data != null && (dataTruncation_ || !data.isText())) - { - // The SQLData object determined if data was truncated as part of the setValue() processing. - int truncated = data.getTruncated (); - if(truncated > 0) - { - int actualSize = data.getActualSize (); - //boolean isRead = sqlStatement_.isSelect(); //@pda jdbc40 //@pdc same as native (only select is read) //@trunc //@pdc match native - DataTruncation dt = new DataTruncation(parameterIndex, true, false, actualSize + truncated, actualSize); //@pdc jdbc40 //@trunc //@pdc match native - - //if 610 and number data type, then throw DataTruncation - //if text, then use old code path and post/throw DataTruncation - if((connection_.getVRM() >= JDUtilities.vrm610) && (data.isText() == false)) //@trunc2 - { //@trunc2 - throw dt; //@trunc2 - } //@trunc2 - else if((sqlStatement_ != null) && (sqlStatement_.isSelect()) && (!sqlStatement_.isSelectFromInsert())) //@trunc2 //@selins1 - { - postWarning(dt); - } - else - { - throw dt; - } - } - } - } - - - // @BBA - /** - Checks that an input SQL type is compatible with the actual parameter type. - - @param sqlType The SQL type. - @param parameterIndex The index (1-based). - - @exception SQLException If the SQL type is not compatible. - **/ - void testSQLType(int sqlType, int parameterIndex) - throws SQLException - { - int parameterType = parameterRow_.getSQLType(parameterIndex).getType(); //@P0C - - if(sqlType != parameterType) - { - - // If the only reason the types don't match is because one - // is a CHAR and the other is a VARCHAR, then let this - // slide. - if(((sqlType == Types.CHAR) || (sqlType == Types.VARCHAR)) - && ((parameterType == Types.CHAR) || (parameterType == Types.VARCHAR))) - ; // Do nothing! - else - JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - } - } - - //@GKA - // Returns the JDServerRow object associated with this statement. - JDServerRow getResultRow() - { - return resultRow_; - } - - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.RowId object. The - * driver converts this to a SQL ROWID value when it sends it - * to the database - * - * @param parameterIndex - * @param x the parameter value - * @throws SQLException if a database access error occurs - * - */ -/* ifdef JDBC40 */ - public void setRowId(int parameterIndex, RowId x) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setRowId()"); - if(x == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + x.toString()); - } - - setValue (parameterIndex, x, null, -1); - } -/* endif */ - //@PDA jdbc40 - /** - * Sets the designated paramter to the given String object. - * The driver converts this to a SQL NCHAR or - * NVARCHAR or LONGNVARCHAR value - * (depending on the argument's - * size relative to the driver's limits on NVARCHAR values) - * when it sends it to the database. - * - * @param parameterIndex - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur ; or if a database access error occurs - */ - public void setNString(int parameterIndex, String value) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setNString()"); - if(value == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else if(value.length() > maxToLog_) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + value.length()); - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + value); - } - setString(parameterIndex, value); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * @param parameterIndex - * @param value the parameter value - * @param length the number of characters in the parameter data. - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur ; or if a database access error occurs - */ - public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setNCharacterStream()"); - if(value == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + length); - } - setCharacterStream(parameterIndex, value, (int) length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a java.sql.NClob object. The driver converts this to a - * SQL NCLOB value when it sends it to the database. - * @param parameterIndex - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur ; or if a database access error occurs - */ -/* ifdef JDBC40 */ - public void setNClob(int parameterIndex, NClob value) throws SQLException - { - - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setNClob()"); - if(value == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else if(value.length() > maxToLog_) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + value.getSubString(1, (int)value.length())); - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + value.length()); - } - setClob(parameterIndex, value); - } -/* endif */ - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the PreparedStatement is executed. - * @param parameterIndex - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement, or if the length specified is less than zero. - * - */ - public void setClob(int parameterIndex, Reader reader, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setClob()"); - if(reader == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + length); - } - - setCharacterStream(parameterIndex, reader, (int)length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to an InputStream object. The inputStream must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the PreparedStatement is executed. - * @param parameterIndex - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @throws SQLException if parameterIndex does not correspond - * to a parameter marker in the SQL statement, if the length specified - * is less than zero or if the number of bytes in the inputstream does not match - * the specfied length. - * - */ - public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setBlob()"); - if(inputStream == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + length); - } - setBinaryStream(parameterIndex, inputStream, (int)length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the PreparedStatement is executed. - * @param parameterIndex - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if the length specified is less than zero; - * if the driver does not support national character sets; - * if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - * - */ - public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setNClob()"); - if(reader == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + length); - } - - setCharacterStream(parameterIndex, reader, (int)length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.SQLXML object. - * @param parameterIndex - * @param xmlObject a SQLXML object that maps an SQL XML value - * @throws SQLException if a database access error occurs - */ -/* ifdef JDBC40 */ - public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException - { - if(JDTrace.isTraceOn()) - { - int len; - - if(xmlObject == null) - len = 0; - else - len = xmlObject.getString().length(); //no length() method yet in jdbc. - - JDTrace.logInformation (this, "setSQLXML()"); - if(xmlObject == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else if(len < maxToLog_) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + xmlObject.getString()); - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + len); - } - - //@xmlspec special handling of blob/clob column types - if(xmlObject == null) //@xmlspec3 - { //@xmlspec3 - setValue (parameterIndex, xmlObject, null, -1); //@xmlspec3 - return; //@xmlspec3 - } //@xmlspec3 - SQLData sqlData = parameterRow_.getSQLType(parameterIndex); //@xmlspec - int sqlDataType = sqlData.getType(); //@xmlspec - switch(sqlDataType) { //@xmlspec - case Types.CLOB: //@xmlspec - setCharacterStream(parameterIndex, xmlObject.getCharacterStream());//@xmlspec - break; //@xmlspec - case Types.BLOB: //@xmlspec - setBinaryStream(parameterIndex, xmlObject.getBinaryStream()); //@xmlspec - break; //@xmlspec - default: //@xmlspec - setValue (parameterIndex, xmlObject, null, -1); - } - } -/* endif */ - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCPreparedStatement", "java.sql.PreparedStatement" }; - } - - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterIndex - * @param x the Java input stream that contains the ASCII parameter value - * @param length the number of bytes in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException - { - setAsciiStream( parameterIndex, x, (int)length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the - * stream as needed until end-of-file is reached. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterIndex - * @param x the java input stream which contains the binary parameter value - * @param length the number of bytes in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException - { - setBinaryStream(parameterIndex, x, (int)length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterIndex - * @param reader the java.io.Reader object that contains the - * Unicode data - * @param length the number of characters in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException - { - setCharacterStream(parameterIndex, reader, (int)length); - } - - //@pda jdbc40 needed for rowset.setX methods. Moved from callableStatement. - /* - Find the column index that matches this parameter name. - @param parameterName The parameter name to change into a column index (1-based). - */ - int findParameterIndex(String parameterName) - throws SQLException - { - // Throw an exception if null was passed in - if(parameterName == null) - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - // Throw an exception if the Statement is closed (FUNCTION SEQUENCE) - if(isClosed()) - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - - boolean caseSensitive = false; - int count = 0; - int returnParm = 0; - - // determine if our search should be case insensitive or not - if(parameterName.startsWith("\"") && parameterName.endsWith("\"")) // assume no leading or trailing blanks - - { - parameterName = JDUtilities.stripOuterDoubleQuotes(parameterName); - - caseSensitive = true; - } - - // If we have a cache created, try to find the column name in it. - if(parameterNames_ != null) - { - // Look up the mapping in our cache. - while(count < parameterNames_.length) - { - if (parameterNames_[count] != null) - { - if((caseSensitive && parameterNames_[count].equals(parameterName)) - || (!caseSensitive && parameterNames_[count].equalsIgnoreCase(parameterName))) - { - returnParm = count+1; - break; - } - } - - ++count; - } - } - else - { - // Else, create a new hash table to hold all the column name/number mappings. - parameterNames_ = new String[parameterCount_]; - - // Cache all the parm names and numbers. - Statement s = null; //@scan1 - ResultSet rs = null; //@scan1 - try{ - s = connection_.createStatement(); - String catalogSeparator = ""; //@74A Added a check for the naming used. Need to use separator appropriate to naming. - if (connection_.getProperties().equals (JDProperties.NAMING, JDProperties.NAMING_SQL)) //@74A - catalogSeparator = "."; //@74A - else //@74A - catalogSeparator = "/"; //@74A - - String schema = sqlStatement_.getSchema(); - if(schema == null || schema.equals("")) // no schema in statement - { // Derive the schema. - schema = connection_.getDefaultSchema(true); // get raw value - - if(schema == null) // No default schema was set on the connection url, or by the libraries connection property. - { - if(catalogSeparator.equals(".")) // using sql naming - { - schema = connection_.getUserName(); // set to user profile - } - else // using system naming - { - // Retrieve the library list from the IBM i - Use ROI Retrieve Library List. - ResultSet rs1 = JDUtilities.getLibraries(this, connection_, null, true); - Vector libListV = new Vector(); - while(rs1.next()) { - libListV.addElement(rs1.getString(1)); - } - rs1.close(); //@SS - String[] libList = new String[libListV.size()]; - libListV.toArray(libList); - - // Get a result set that we can scroll forward/backward through. - Statement s1 = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - rs = s1.executeQuery("SELECT ROUTINE_SCHEMA FROM QSYS2" - + catalogSeparator - + "SYSPROCS WHERE ROUTINE_NAME='" - + unquote(sqlStatement_.getProcedure()) - + "' AND IN_PARMS + OUT_PARMS + INOUT_PARMS = " - + parameterCount_); - if(!rs.next()) - JDError.throwSQLException(this, JDError.EXC_INTERNAL); // didn't find the procedure in any schema - - // If we get this far, at least one schema contains a procedure similar to ours. - boolean found = false; - for(int i=0; i parameterCount_)) - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check if the parameter index refers to the return value parameter. - // This is an OUT parameter, so sets are not allowed. If its not - // parameter index 1, then decrement the parameter index, since we - // are "faking" the return value parameter. - if(useReturnValueParameter_) - { - if(parameterIndex == 1) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - else - --parameterIndex; - } - - // Check that the parameter is an input parameter. - if(! parameterRow_.isInput (parameterIndex)) - JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Set the parameter data. If there is a type mismatch, - // set() with throw an exception. - SQLData sqlData = parameterRow_.getSQLType(parameterIndex); - if(x != null) - { - // If the data is a locator, then set its handle. - int sqlType = sqlData.getSQLType(); //@xml3 - if(sqlType == SQLData.CLOB_LOCATOR || - sqlType == SQLData.BLOB_LOCATOR || - sqlType == SQLData.DBCLOB_LOCATOR || //@pdc jdbc40 - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 - sqlType == SQLData.XML_LOCATOR) //@xml3 - { - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; - sqlDataAsLocator.setHandle(parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - if(JDTrace.isTraceOn()) JDTrace.logInformation(this, "locator handle: " + parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - sqlData.set(x, null, -2);//new ConvTableReader(x, 819, 0, LOB_BLOCK_SIZE), null, -2); //@readerlen -2 flag to read all of reader bytes - } - else - { - sqlData.set(x, null, -2);//sqlData.set (JDUtilities.readerToString(new ConvTableReader(x, 819, 0, LOB_BLOCK_SIZE)), null, -1); //@readerlen -2 flag to read all of reader bytes - } - - testDataTruncation (parameterIndex, sqlData); - } - // Parameters can be null; you can call one of the set methods to null out a - // field of the database. - parameterNulls_[parameterIndex-1] = (x == null); - parameterSet_[parameterIndex-1] = true; - - } - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterIndex - * @param x the Java input stream that contains the ASCII parameter value - * @exception SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setAsciiStream(int, InputStream)"); - if(x == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - } - setInputStream(parameterIndex, x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the - * stream as needed until end-of-file is reached. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterIndex - * @param x the java input stream which contains the binary parameter value - * @exception SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setBinaryStream(int, InputStream)"); - if(x == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - } - setInputStream(parameterIndex, x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a InputStream object. - * This method differs from the setBinaryStream (int, InputStream) - * method because it informs the driver that the parameter value should be - * sent to the server as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARBINARY or a BLOB - * - * @param parameterIndex - * @param inputStream An object that contains the data to set the parameter - * value to. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if a database access error occurs; - * this method is called on a closed PreparedStatement or - * if parameterIndex does not correspond - * to a parameter marker in the SQL statement, - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - */ - public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setBlob(int, InputStream)"); - if(inputStream == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - } - setInputStream(parameterIndex, inputStream); - } - - //@PDA jdbc40 helper - private void setReader(int parameterIndex, Reader reader) throws SQLException - { - // @J0A added the code from setValue in this method because streams and readers are handled specially - synchronized(internalLock_) - { - checkOpen (); - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check if the parameter index refers to the return value parameter. - // This is an OUT parameter, so sets are not allowed. If its not - // parameter index 1, then decrement the parameter index, since we - // are "faking" the return value parameter. - if(useReturnValueParameter_) - { - if(parameterIndex == 1) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - else - --parameterIndex; - } - - // Check that the parameter is an input parameter. - if(! parameterRow_.isInput (parameterIndex)) - JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Set the parameter data. If there is a type mismatch, - // set() with throw an exception. - SQLData sqlData = parameterRow_.getSQLType(parameterIndex); - if(reader != null) - { - - // If the data is a locator, then set its handle. - int sqlType = sqlData.getSQLType(); //@xml3 - if(sqlType == SQLData.CLOB_LOCATOR || - sqlType == SQLData.BLOB_LOCATOR || - sqlType == SQLData.DBCLOB_LOCATOR || //@pdc jdbc40 - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 - sqlType == SQLData.XML_LOCATOR) //@xml3 - { - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; - sqlDataAsLocator.setHandle(parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - if(JDTrace.isTraceOn()) JDTrace.logInformation(this, "locator handle: " + parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - sqlData.set(reader, null, -2); //@readerlen -2 flag to read all of reader chars - } - else - { - sqlData.set(JDUtilities.readerToString(reader), null, -1); - } - - testDataTruncation (parameterIndex, sqlData); - } - // Parameters can be null; you can call one of the set methods to null out a - // field of the database. - parameterNulls_[parameterIndex-1] = (reader == null); - parameterSet_[parameterIndex-1] = true; - - } - - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Reader - * object. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setCharacterStream which takes a length parameter. - * - * @param parameterIndex - * @param reader the java.io.Reader object that contains the - * Unicode data - * @exception SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setCharacterStream(int, Reader)"); - if(reader == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - } - - setReader(parameterIndex, reader); - } - - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the server as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARCHAR or a CLOB - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setClob which takes a length parameter. - * - * @param parameterIndex - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if a database access error occurs; this method is called on - * a closed PreparedStatementor if parameterIndex does not correspond to a parameter - * marker in the SQL statement - * - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setClob(int parameterIndex, Reader reader) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setClob(int, Reader)"); - if(reader == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - } - - setReader(parameterIndex, reader); - } - - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNCharacterStream which takes a length parameter. - * - * @param parameterIndex - * @param value the parameter value - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs; or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setNCharacterStream(int, Reader)"); - if(value == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - } - - setReader(parameterIndex, value); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the server as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGNVARCHAR or a NCLOB - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNClob which takes a length parameter. - * - * @param parameterIndex - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; - * if the driver does not support national character sets; - * if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setNClob(int parameterIndex, Reader reader) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setNClob(int, Reader)"); - if(reader == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - } - - setReader(parameterIndex, reader); - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCResultSet.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCResultSet.java deleted file mode 100644 index 8e671e0a9..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCResultSet.java +++ /dev/null @@ -1,7239 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCResultSet.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.math.BigDecimal; -import java.net.MalformedURLException; -import java.net.URL; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Connection; -import java.sql.DataTruncation; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -/* endif */ -import java.sql.PreparedStatement; -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -/* ifdef JDBC40 */ -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -import java.sql.SQLWarning; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Statement; -import java.sql.Time; -import java.sql.Timestamp; -/* ifdef JDBC40 */ -import java.sql.Types; -/* endif */ -import java.util.Calendar; -import java.util.Map; - - - -/** -

The AS400JDBCResultSet class provides access to a table -of data generated by a database query. - -

A result set maintains a cursor pointing to its current -row of data. Initially, the cursor is positioned before the -first row. If the result set is scrollable, use any of the -cursor positioning methods to move the cursor within the result -set. If the result set is not scrollable, then only use next() -to move the cursor. - -

The get methods retrieve column values for the current row. -Values can be retrieved using either the column index or the -column name. In general, using the column index is more efficient. -Column indexes are numbered starting with 1. Column names are -not case sensitive. If several columns have the same name, -then the first matching column is used. - -

Columns can have two names: a column name ("long name") -and a system column name ("short name"). The get methods and -findColumn() only support using the column name. - -

In each get method, the driver attempts to convert the -underlying data to the specified Java type and returns a -suitable Java value. If such a conversion is not appropriate, -an SQLException is thrown. - -

If the result set is updatable, the update methods modify -column values for the current row, but not in the underlying -database. updateRow() causes all updates to the current row -to be written to the database. Use deleteRow() to delete the -current row in the database. - -

For updatable result sets, there is also an insert row, -which is used as a staging area for the contents of a new row. -Use moveToInsertRow() to position the cursor to the insert row. -Once all updates to the insert row have been made, use insertRow() -to insert the row into the database. - -

In the following cases, result sets are always read only -regardless of the concurrency set in the statement: -

    -
  • Stored procedure calls -
  • DatabaseMetaData catalog methods -
- -

In the following case, result sets are always read only -regardless of the concurrency set in the statement if connecting -to a system running OS/400 V4R5 or a previous release: -

    -
  • SELECT statements which do not specify FOR UPDATE -
- -

In the following case, result sets are always forward only -regardless of the type set in the statement: -

    -
  • Stored procedure calls -
- -

A result set is automatically closed by the statement that -generated it when the statement is closed, run again, or used -to retrieve the next result set from a sequence of multiple -result sets. - -

The new JDBC 3.0 methods add the ability to -retrieve information by column name in addition to column index. -Be aware you will see better performance accessing columns by their -index rather than accessing them by their name. -**/ -// -// Implementation notes: -// -// 1. There are a few different types of result sets. For example: -// -// * Result sets from caller-issued selects. -// * Result sets created and returned from DatabaseMetaData. -// * Result sets generated on the IBM i system and mapped to -// a different format by DatabaseMetaData. -// -// One solution would be to provide a different implementation -// of java.sql.ResultSet for each of these. However, there is -// a lot of overhead that is common to all of these. As a result, -// I have decided to use one implementation of java.sql.ResultSet -// and write in terms of the following interfaces, which pinpoint -// what is truly different about the different formats: -// -// * JDRowCache - manages the set of rows and fetches as needed. -// * JDRow - accesses various information about the format -// of a row and manages the getting and setting -// of data within a row. -// -// There are implementations of each of these to handle the -// different types of result sets. -// -// 2. We need to know the total number of rows in the result set -// in order to make getRow() work in all cases (e.g. after -// a last() or absolute(-). In mod 5 the code was changed to -// loop through the rows if we need a count. This will be -// slow but seemed to be the best way to do it. -// The mod 4 comment is: -// The only way we could think of -// to do this is to issue a SELECT COUNT(*) using the same -// where clause as the original. However there are 2 problems: -// -// * There is a window of time between the original query -// and the SELECT COUNT(*), so the value may not be -// accurate. -// * There is overhead in issuing another SELECT and getRow() -// seems like it probably won't be used that often. -// -// Given these problems, I have decided to make getRow() not -// work in some documented cases. -// -// 3. In JDBC 2.0, there are some date/time/timestamp related -// methods that take calendar parameters and some that don't. -// The methods that do not take calendar parameters are supposed -// to use the default calendar (retrieved using -// Calendar.getInstance()). -// -// At first thought, I tried to create one static calendar -// object to share for the entire JDBC driver, thinking that -// this would minimize object creation and therefore improve -// performance. However, it turns out that this shared instance -// does not reflect TimeZone changes made after it is created, -// so the very example given in the spec does not work. As a -// result, we must create a new default Calendar each time. -// -public class AS400JDBCResultSet -/* ifdef JDBC40 */ -extends ToolboxWrapper -/* endif */ - -implements ResultSet -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - - //New constants for JDBC 3.0. - static final int HOLDABILITY_NOT_SPECIFIED = -9999; //@G4A - static final int HOLD_CURSORS_OVER_COMMIT = 1; //@G4A - static final int CLOSE_CURSORS_AT_COMMIT = 2; //@G4A - - // Private data. - private String catalog_; - private boolean closed_; - private int columnCount_; - private int concurrency_; - private Connection connection_; - private String correlationName_; - private String cursorName_; - private boolean dataTruncation_; // @B2A - private PreparedStatement deleteStatement_; - private int fetchDirection_; - private int fetchSize_; - private AS400JDBCStatementLock internalLock_; // @D1A @C7C - private int maxRows_; - private InputStream openInputStream_; - private Reader openReader_; - private JDRow row_; - private JDRowCache rowCache_; - private String selectTable_; - private SQLWarning sqlWarning_; - private AS400JDBCStatement statement_; - private int type_; - private boolean[] updateNulls_; - private boolean[] updateDefaults_; //@EIA - private boolean[] updateUnassigned_; //@EIA - private JDRow updateRow_; - private boolean[] updateSet_; - private boolean wasNull_; - private boolean wasDataMappingError_; - boolean isMetadataResultSet = false; //@mdrs - private DBReplyRequestedDS reply_ = null; - - /*---------------------------------------------------------*/ - /* */ - /* MISCELLANEOUS METHODS. */ - /* */ - /*---------------------------------------------------------*/ - - - - /** - Constructs an AS400JDBCResultSet object. - - @param statement The owning statement. - @param sqlStatement The SQL statement. - @param rowCache The row cache. - @param catalog The catalog. - @param cursorName The cursor name. - @param maxRows The maximum rows limit, or - 0 for no limit. - @param type The type. - @param concurrency The concurrency. - @param fetchDirection The fetch direction. - @param fetchSize The fetch size. - @param tableName The table name, if any. - - @exception SQLException If an error occurs. - **/ - AS400JDBCResultSet (AS400JDBCStatement statement, - JDSQLStatement sqlStatement, - JDRowCache rowCache, - String catalog, - String cursorName, - int maxRows, - int type, - int concurrency, - int fetchDirection, - int fetchSize) - throws SQLException - { - // Initialization. - catalog_ = catalog; - closed_ = false; - concurrency_ = concurrency; - connection_ = (statement != null) ? statement.getConnection () : null; - cursorName_ = cursorName; - deleteStatement_ = null; - fetchDirection_ = fetchDirection; - fetchSize_ = fetchSize; - internalLock_ = (statement != null) ? statement.internalLock_ : new AS400JDBCStatementLock(); // @D1A - maxRows_ = maxRows; - openInputStream_ = null; - openReader_ = null; - row_ = rowCache.getRow (); - rowCache_ = rowCache; - sqlWarning_ = null; - statement_ = statement; - type_ = type; - wasNull_ = false; - wasDataMappingError_ = false; - - columnCount_ = row_.getFieldCount (); - - rowCache_.open (); - - // If no connection or SQL statement was provided, - // or a SELECT with multiple tables or views was - // specified, or the SELECT does not specify FOR UPDATE, - // then we cannot do updates. (@J3 In case you have - // paraenthesis overload, the added check in mod 5 - // is if we are connected to a v5r1 (without PTF) or earlier - // system and "for update" is not specified) - if((connection_ == null) || - (sqlStatement == null) || - (((((AS400JDBCConnection) connection_).getMustSpecifyForUpdate()) && // @J3a @J31c - (! sqlStatement.isForUpdate())))) - { - selectTable_ = null; - correlationName_ = null; - concurrency_ = CONCUR_READ_ONLY; - } - else - { - selectTable_ = sqlStatement.getSelectTable (); - correlationName_ = sqlStatement.getCorrelationName (); - } - - // Initialize the update row. - if(concurrency_ == CONCUR_UPDATABLE) - { - updateRow_ = new JDSimpleRow (row_, true); - updateSet_ = new boolean[columnCount_]; - updateNulls_ = new boolean[columnCount_]; - updateDefaults_ = new boolean[columnCount_]; //@EIA - updateUnassigned_ = new boolean[columnCount_]; //@EIA - for(int i = 0; i < columnCount_; ++i) - { - updateSet_[i] = false; - updateNulls_[i] = true; //@EIC not needed since updateSet[] is checked first //@EIC2 initialize all to null for insert row logic - } - } - - // Initialize the data truncation. @B2A - if(connection_ != null) // @B2A - dataTruncation_ = ((AS400JDBCConnection) connection_).getProperties ().getBoolean (JDProperties.DATA_TRUNCATION); // @B2A - else // @B2A - dataTruncation_ = false; - - // Trace messages. - if(JDTrace.isTraceOn()) - { - JDTrace.logOpen (this, statement_); // @J33a - JDTrace.logProperty (this, "Conncurrency", concurrency_); - JDTrace.logProperty (this, "Fetch direction", fetchDirection_); - JDTrace.logProperty (this, "Fetch size", fetchSize_); - JDTrace.logProperty (this, "Max rows", maxRows_); - JDTrace.logProperty (this, "Type", type_); - } - } - - - - /** - Constructs an AS400JDBCResultSet object. - - @param rowCache The row cache. - @param catalog The catalog. - @param cursorName The cursor name. - @param reply Reply object that must be returned to pool when result set closed - - @exception SQLException If an error occurs. - **/ - // - // This constructor is specifically for DatabaseMetaData - // result sets. - // - AS400JDBCResultSet (JDRowCache rowCache, - String catalog, - String cursorName, - AS400JDBCConnection con, - DBReplyRequestedDS reply) //@in2 - throws SQLException - { - this (null, null, rowCache, catalog, cursorName, 0, - TYPE_SCROLL_INSENSITIVE, CONCUR_READ_ONLY, - FETCH_FORWARD, 0); - - this.reply_ = reply; - - //connection is needed in AS400JDBCResultsetMetadata. connection is passed in from AS400JDBCDatabaseMetaData - if(con != null) //@in2 - connection_ = con; //@in2 - } - - - - /** - Checks that the result set is open. Public methods - that require an open result set should call this first. - - @exception SQLException If the result set is not open. - **/ - void checkOpen () - throws SQLException - { - if(closed_) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - - - /** - Clears any information associated with the current row. - In addition, all warnings are cleared. - **/ - private void clearCurrentRow () - throws SQLException - { - clearCurrentValue (); - clearWarnings (); - - if(concurrency_ == CONCUR_UPDATABLE) - { - for(int i = 0; i < columnCount_; ++i) - { - updateNulls_[i] = true; //@IEC //@EIC2 - updateDefaults_[i] = false; //@EIA - updateUnassigned_[i] = false; //@EIA - updateSet_[i] = false; - } - } - } - - - - /** - Clears any information associated with the current value. - **/ - private void clearCurrentValue () - { - // Implicitly close the InputStream if left open. - if(openInputStream_ != null) - { - try - { - openInputStream_.close (); - } - catch(IOException e) - { - // Ignore the exception. - } - openInputStream_ = null; - } - - // Implicitly close the InputStream if left open. - if(openReader_ != null) - { - try - { - openReader_.close (); - } - catch(IOException e) - { - // Ignore the exception. - } - openReader_ = null; - } - } - - - - - /** - Clears all warnings that have been reported for the result set. - After this call, getWarnings() returns null until a new warning - is reported for the result set. - - @exception SQLException If an error occurs. - **/ - public void clearWarnings () - throws SQLException - { - sqlWarning_ = null; - } - - - - /** - Releases the result set's resources immediately instead of - waiting for them to be automatically released. - - @exception SQLException If an error occurs. - **/ - public void close () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // If this is already closed, then just do nothing. - // - // The spec does not define what happens when a connection - // is closed multiple times. The official word from the Sun - // JDBC team is that "the driver's behavior in this case - // is implementation defined. Applications that do this are - // non-portable." - if(isClosed ()) - return; - - rowCache_.close (); - if (reply_ != null) { reply_.returnToPool(); reply_ = null; } - closed_ = true; - if(statement_ != null) - statement_.notifyClose (); - - // Close the delete statement if opened. - if(deleteStatement_ != null) - deleteStatement_.close (); - - if(isMetadataResultSet == true) //@mdclose - statement_.close(); //@mdclose - - if(JDTrace.isTraceOn()) - JDTrace.logClose (this); - } - } - - - - /** - Closes the result set if not explicitly closed by the caller. - - @exception Throwable If an error occurs. - **/ - protected void finalize () - throws Throwable - { - try{ - if(! closed_) { - JDTrace.logInformation (this, "WARNING: Finalizer thread closing result set object."); - close (); - } - } - catch(Exception e){ - //catch any exceptions and don't throw them - } - super.finalize (); - } - - - - /** - Returns the column index for the specified column name. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.findColumn("\"MixedCase\""). - - @param columnName The column name. - @return The column index (1-based). - - @exception SQLException If the result set is not open - or the column name is not found. - **/ - public int findColumn (String columnName) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - return row_.findField ((columnName != null) ? columnName : ""); - } - } - - - - // JDBC 2.0 - /** - Returns the result set concurrency. - - @return The result set concurrency. Valid values are: -

    -
  • CONCUR_READ_ONLY -
  • CONCUR_UPDATABLE -
- - - @exception SQLException If the result set is not open. - **/ - public int getConcurrency () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - - //@cur return value from cursor attribues if exists else return value as done in pre 550 - if ( statement_ != null ) //@cur - { //@cur - if( statement_.cursor_.getCursorAttributeUpdatable() == 0) //@cur - return ResultSet.CONCUR_READ_ONLY; //@cur - else if( statement_.cursor_.getCursorAttributeUpdatable() == 1) //@cur - return ResultSet.CONCUR_UPDATABLE; //@cur - else //@cur - return concurrency_; //@cur - } //@cur - else //@cur - return concurrency_; - } - } - - - - // @D3C - /** - Returns the name of the SQL cursor in use by the result set. - In SQL, results are retrieved through a named cursor. The - current row of a result can be updated or deleted using a - positioned UPDATE or DELETE statement that references a - cursor name. - -

Cursor names are case sensitive. However, when using a cursor - name within other SQL positioned UPDATE or DELETE statements, - the cursor name will be uppercased. If you use a cursor name - with lowercase characters, you need to enclose it in double - quotes when referring to it in other SQL statements. - - @return The cursor name. - - @exception SQLException If the result is not open. - **/ - public String getCursorName () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - return cursorName_; - } - } - - - - // JDBC 2.0 - /** - Returns the fetch direction. - - @return The fetch direction. - Valid values are: -

    -
  • FETCH_FORWARD -
  • FETCH_REVERSE -
  • FETCH_UNKNOWN -
- - - - @exception SQLException If the result is not open. - **/ - public int getFetchDirection () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - return fetchDirection_; - } - } - - - - // JDBC 2.0 - /** - Returns the fetch size. - - @return The fetch size. - - @exception SQLException If the result is not open. - **/ - public int getFetchSize () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - return fetchSize_; - } - } - - - - /** - Returns the row cache. - - @return The row cache. - **/ - JDRowCache getRowCache () - { - return rowCache_; - } - - - - // JDBC 2.0 - /** - Returns the statement for this result set. - - @return The statement for this result set, or null if the - result set was returned by a DatabaseMetaData - catalog method. - - @exception SQLException If an error occurs. - **/ - // Implementation note: - // - // * I made a conscious decision not to return the - // DatabaseMetaData's statement, if any, since I do - // not want users to be able to execute their own - // statements using this. - // - public Statement getStatement () - throws SQLException - { - if(isMetadataResultSet)//@mdrs - return null; //@mdrs - else //@mdrs - return statement_; - } - - - - // JDBC 2.0 - /** - Returns the result set type. If the statement requested a result set type - ResultSet.TYPE_FORWARD_ONLY, then the result set type will be - ResultSet.TYPE_FORWARD_ONLY. Otherwise, the result set type may be a type - other than the requested type if the SQL statement that generated the - result set specified a different cursor type when opening the cursor. - - @return The result set type. Valid values are: -
    -
  • TYPE_FORWARD_ONLY -
  • TYPE_SCROLL_INSENSITIVE -
  • TYPE_SCROLL_SENSITIVE -
- - - - @exception SQLException If the result set is not open. - @since Modification 5 - **/ - public int getType () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - - // Always return FORWARD_ONLY if the application requested forward only - // If this logic changes, also change the similar logic in AS400JDBCStatement. @C4A - if (type_ == ResultSet.TYPE_FORWARD_ONLY) return ResultSet.TYPE_FORWARD_ONLY; - - //@cur return value from cursor attributes if exists else return value as done in pre 550 - if( statement_ != null ) //@cur - { //@cur - if(statement_.cursor_.getCursorAttributeScrollable() == 0) //@cur - return ResultSet.TYPE_FORWARD_ONLY; //@cur - else if(statement_.cursor_.getCursorAttributeSensitive() == 0) //@cur - return ResultSet.TYPE_SCROLL_INSENSITIVE; //@cur - else if(statement_.cursor_.getCursorAttributeSensitive() == 1) //@cur - return ResultSet.TYPE_SCROLL_SENSITIVE; //@cur - else //@cur - return type_; //@cur - } //@cur - else //@cur - return type_; - } - } - - - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL DATALINK output parameter as a - java.net.URL object. - - @param columnIndex The column index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed or - the requested conversion is not valid. - @since Modification 5 - **/ - public URL getURL (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen (); - try - { String string = getString(columnIndex); - if(string == null) - return null; - return new java.net.URL(string); - } - catch(MalformedURLException e) - { - JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID, e); - return null; - } - } - } - - - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL DATALINK output parameter as a - java.net.URL object. - - @param columnName The column name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed or - the requested conversion is not valid. - **/ - public URL getURL (String columnName) - throws SQLException - { - return getURL(findColumn(columnName)); - } - - - - /** - Returns the first warning reported for the result set. - Subsequent warnings may be chained to this warning. - - @return The first warning or null if no warnings - have been reported. - - @exception SQLException If an error occurs. - **/ - public SQLWarning getWarnings () - throws SQLException - { - return sqlWarning_; - } - - - - /** - Indicates if the result set is closed. - - @return true if this result set is closed; - false otherwise. - **/ - //@PDA jdbc40 make public and allow SQLException - public boolean isClosed () throws SQLException - { - return closed_; - } - - - - /** - Posts a warning for this result set. - - @param sqlWarning The warning. - **/ - void postWarning (SQLWarning sqlWarning) - { - if(sqlWarning_ == null) - sqlWarning_ = sqlWarning; - else - sqlWarning_.setNextWarning (sqlWarning); - } - - - - // JDBC 2.0 - /** - Sets the direction in which the rows in a result set are - processed. - - @param fetchDirection The fetch direction for processing rows. - Valid values are: -
    -
  • FETCH_FORWARD -
  • FETCH_REVERSE -
  • FETCH_UNKNOWN -
- The default is the statement's fetch - direction. - - @exception SQLException If the result set is not open, - the result set is scrollable - and the input value is not - ResultSet.FETCH_FORWARD, - or the input value is not valid. - **/ - // - // Implementation note: - // - // The fetch direction is intended to be a hint for the driver - // to do some optimization (like fetch size helps with record - // blocking). However, we currently don't do anything with it. - // I attempted to document this fact in the javadoc, but could - // not come up with a wording that is not confusing. I think it - // is okay NOT to document the fact that we ignore this setting, - // since it would not affect the behavior of the driver anyway. - // - public void setFetchDirection (int fetchDirection) - throws SQLException - { - synchronized(internalLock_) - { // @D1A //@cur - if(((fetchDirection != FETCH_FORWARD) - && (fetchDirection != FETCH_REVERSE) - && (fetchDirection != FETCH_UNKNOWN)) - || ((getType() == ResultSet.TYPE_FORWARD_ONLY) - && (fetchDirection != ResultSet.FETCH_FORWARD))) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - checkOpen (); - fetchDirection_ = fetchDirection; - - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Fetch direction", fetchDirection_); - } - } - - - - // JDBC 2.0 - /** - Sets the number of rows to be fetched from the database when more - rows are needed. This may be changed at any time. If the value - specified is zero, then the driver will choose an appropriate - fetch size. - -

This setting only affects statements that meet the criteria - specified in the "block criteria" property. The fetch size - is only used if the "block size" property is set to "0". - - @param fetchSize The number of rows. This must be greater than - or equal to 0 and less than or equal to the - maximum rows limit. The default is the - statement's fetch size. - - @exception SQLException If the result set is not open - or the input value is not valid. - **/ - public void setFetchSize (int fetchSize) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - if((fetchSize < 0) - || ((fetchSize > maxRows_) && (maxRows_ > 0))) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - checkOpen (); - fetchSize_ = fetchSize; - - // This is a kludgy way of keeping the fetch size - // out of the JDRowCache interface. It only applies - // to JDServerRowCache anyway. - if(rowCache_ instanceof JDServerRowCache) - ((JDServerRowCache) rowCache_).setFetchSize (fetchSize_); - - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Fetch size", fetchSize_); - } - } - - - - /** - Returns the name of the SQL cursor in use by the result set. - - @return The cursor name. - **/ - public String toString () - { - return cursorName_; - } - - - - /*---------------------------------------------------------*/ - /* */ - /* CURSOR POSITIONING. */ - /* */ - /*---------------------------------------------------------*/ - - - - // Private data. - // - // Either position from first or last or both is set - // at any given moment, depending on what we can - // determine. Whether we can determine one or both of - // these depends on how the caller has positioned the - // cursor. - // - // For both of these values, 0 means after the last or - // before the first. -1 means not able to determine. - // @E1: a new constant is added which also means we - // don't know the value. -1 is not used because it - // is easy to incorrectly add 1 to -1 and make it look - // like a valid value (and a very hard bug to find). - // Adding 1 to -9999 results in a strange value which - // should be easier to debug. - // - // The position insert flag is set when the cursor - // is moved to the insert row. - // - // @E1: Fully supporting getRow() means at times - // looping through the rows to count them. Two - // values are added to reduce the amount rows we - // loop through. We update highestKnownRow and - // totalRows whenever possible to reduce the number - // of rows we loop through. Once set, these - // values do not change. That means if rows are added - // or deleted during the life of the rs, these - // constants will not reflect the change. I talked - // to the developer of the native driver and - // he feels it is safe (and much faster) to harden - // the values once they are set. The alternative - // is to create a property where the app can tell us - // to re-get the total at appropriate times. The - // performance of that would probably be unacceptably - // slow. - // - - private static final int NOT_KNOWN = -9999; // @E1a - - private int positionFromFirst_ = 0; - private int positionFromLast_ = -1; - private boolean positionInsert_ = false; - private boolean positionValid_ = false; - - // totalRows_ is the number of rows in the RS. Highest - // known row is the biggest row we have reached so far. Eventually - // they will be the same but until there is a need to figure - // out how many rows are in the RS, total will be not-known and - // highest will increase. - private int totalRows_ = NOT_KNOWN; // @E1a - private int highestKnownRow_ = NOT_KNOWN; // @E1a - - - - // JDBC 2.0 - /** - Positions the cursor to an absolute row number. - -

Attempting to move any number of positions before - the first row positions the cursor to before the first row. - Attempting to move beyond the last - row positions the cursor after the last row. - -

If an InputStream from the current row is open, it is - implicitly closed. In addition, all warnings and pending updates - are cleared. - - @param rowNumber The absolute row number. If the absolute row - number is positive, this positions the cursor - with respect to the beginning of the result set. - If the absolute row number is negative, this - positions the cursor with respect to the end - of result set. - @return true if the requested cursor position is - valid; false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - the row number is 0, - or an error occurs. - */ - public boolean absolute (int rowNumber) - throws SQLException - { - synchronized(internalLock_) // @D1A - { - // @E2a absolute(0) moves you to before the first row - if(rowNumber == 0) // @E2a - { - // @E2a - beforeFirst(); // @E2a - return false; // @E2a - } // @E2a - - - // Initialization. - beforePositioning (true); - // @E2d if (rowNumber == 0) - // @E2d JDError.throwSQLException (JDError.EXC_CURSOR_POSITION_INVALID); - - // Handle max rows. - // @E3, fixes to correctly handle maxRows, (1) Make sure - // we don't go before first when absolute < 0, and (2) make sure - // we get the row number right because the system and row cache - // do not deal with maxRows. They always deal with the entire - // result set. - // - // old code: - // - // if ((rowNumber > maxRows_) && (maxRows_ > 0)) - // { - // afterLast (); - // return false; - // } - // - // new code: - if(maxRows_ > 0) // @E3a - { - // @E3a - if(rowNumber > 0) // @E3a - { - // @E3a - if(rowNumber > maxRows_) // @E3a - { - // @E3a - afterLast(); // @E3a - return false; // @E3a - } // @E3a - // Don't need an else. Drop through and call the rowCache as if maxRows not set. - } // @E3a - else - { // @E3a // @E3a - if(totalRows_ == NOT_KNOWN) // @E3a - { - // @E3a - findLastRow(); // @E3a - } // @E3a - int distanceFromFirst = totalRows_ + rowNumber; // @E3a - if(distanceFromFirst < 0) // @E3a - { - // @E3a - beforeFirst(); // @E3a - return false; // @E3a - } // @E3a - else // @E3a - rowNumber = distanceFromFirst + 1; // @E3a - // don't return. Drop through and call the rowCache as if maxRows not set. - } // @E3a - } // @E3a - - - // Position the cursor. - rowCache_.absolute (rowNumber); - positionValid_ = (rowCache_.isValid ()); - if(rowNumber > 0) - { - positionFromFirst_ = positionValid_ ? rowNumber : -1; - positionFromLast_ = positionValid_ ? -1 : 0; - - if(positionValid_) // @E1a - { - // @E1a - if(highestKnownRow_ < rowNumber) // @E1a - highestKnownRow_ = rowNumber; // @E1a - - if(totalRows_ != NOT_KNOWN) // @E2a - positionFromLast_ = totalRows_ - rowNumber + 1; // @E2a - } // @E1a - } - else - { - positionFromFirst_ = positionValid_ ? -1 : 0; - positionFromLast_ = positionValid_ ? -rowNumber : -1; - - if(positionValid_) // @E1a - { - // @E1a - if(totalRows_ != NOT_KNOWN) // @E2a - { - // @E2a - int currentRow = totalRows_ + rowNumber; // @E1a - - if(highestKnownRow_ < currentRow) // @E1a - highestKnownRow_ = currentRow; // @E1a - - positionFromFirst_ = currentRow + 1; // @E2a - } // @E1a - } // @E1a - } - - return positionValid_; - } - } - - - - // JDBC 2.0 - /** - Positions the cursor after the last row. - If an InputStream from the current row is open, it is - implicitly closed. In addition, all warnings and pending updates - are cleared. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public void afterLast () - throws SQLException - { - // @E1: Implementation simplified. Now do work in other methods - // that have to do the work anyway. - // - // Old code (v5r1 and older); - // - // synchronized(internalLock_) // @D1a - // { - // beforePositioning (true); - // rowCache_.afterLast (); - // positionFromFirst_ = -1; - // positionFromLast_ = 0; - // positionValid_ = false; - // } - // - // New code (note we don't do beforePositioning(true) because that is - // done in last()) - // - synchronized(internalLock_) - { - last(); - next(); - } - } - - - - // JDBC 2.0 - /** - Positions the cursor before the first row. - If an InputStream from the current row is open, it is implicitly - closed. In addition, all warnings and pending updates are cleared. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public void beforeFirst () - throws SQLException - { - // @E1: Implementation simplified. Now do work in other methods - // that have to do the work anyway. - // - // Old code (v5r1 and older); - // - // synchronized(internalLock_) // @D1A - // { - // beforePositioning (true); - // rowCache_.beforeFirst (); - // positionFromFirst_ = 0; - // positionFromLast_ = -1; - // positionValid_ = false; - // } - // - // New code (note we don't do beforePositioning(true) because that is - // done in last()) - // - synchronized(internalLock_) - { - first(); - previous(); - positionFromLast_ = -1;//@GRA for returning correct value from getRow() after a select and insertRow() - } - } - - - - /** - Checks necessary conditions before positioning a row. All - positioning methods should call this before changing the - position. - - @param scrollable Indicates if the result set must be - scrollable. - - @exception SQLException If the position cannot be done. - **/ - private void beforePositioning (boolean scrollable) - throws SQLException - { - checkOpen (); - - if((scrollable) && (getType() == TYPE_FORWARD_ONLY)) //@cur - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - - clearCurrentRow (); - - // Get off of the insert row, if on it. - positionInsert_ = false; - } - - - // @E3 new method! - /** - Counts the number of rows in the result set. That number - is the number of rows that meet criteria or maxRows, - whichever is smaller. The result of this method is - internal variable "totalRows_" is set. - - **** Callers of this method must reposition the rowCache - **** after calling this method! This method moves the only the - **** rowCache cursor. Since it no longer matches the result set cursor, - **** the caller must re-sync the two cursors. - - @exception SQLException If it doesn't work. - **/ - private void findLastRow () - throws SQLException - { - checkOpen (); - - // if we already know how many rows are in the result set simply return. - if(totalRows_ != NOT_KNOWN) - return; - - - if(highestKnownRow_ > 0) - { - // If we are already past the maximum number of rows (probably - // an error condition) simply re-set highestKnownRow (total - // Rows is reset at the end of this routine). - if(highestKnownRow_ >= maxRows_) - { - highestKnownRow_ = maxRows_; - } - else - { - // As a last resort set the cursor to the highest known - // row then loop through the rows until we hit the end. - rowCache_.absolute(highestKnownRow_); - rowCache_.next(); - - while(rowCache_.isValid()) - { - highestKnownRow_ ++; - - if((maxRows_ > 0) && (highestKnownRow_ == maxRows_)) - break; - - rowCache_.next(); - } - } - } - // worst case, we don't have any idea how many rows are in the rs. - // Start at the beginning and loop through the rows until we hit the - // end or maxRows. - else - { - rowCache_.first(); - - if(! rowCache_.isValid()) - { - return; - } - else - { - highestKnownRow_ = 0; - while(rowCache_.isValid()) - { - highestKnownRow_ ++; - - if((maxRows_ > 0) && (highestKnownRow_ == maxRows_)) - break; - - rowCache_.next(); - } - } - } - totalRows_ = highestKnownRow_; - } - - - - // JDBC 2.0 - /** - Positions the cursor to the first row. - If an InputStream from the current row is open, it is - implicitly closed. In addition, all warnings and pending updates - are cleared. - - @return true if the requested cursor position is - valid; false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public boolean first () - throws SQLException - { - synchronized(internalLock_) // @D1A - { - beforePositioning (true); - rowCache_.first (); - - // If the result set is not empty, then mark the - // position as being on the first row. - if(rowCache_.isValid ()) - { - positionFromFirst_ = 1; - - if(totalRows_ == NOT_KNOWN) // @E1a - positionFromLast_ = -1; - else // @E1a - positionFromLast_ = totalRows_; // @E1a - - positionValid_ = true; - - if(highestKnownRow_ < 1) // @E1a - highestKnownRow_ = 1; // @E1a - } - - // Otherwise, there is no first row (only true if ResultSet is empty) - else - { - positionFromFirst_ = -1; - positionFromLast_ = -1; - positionValid_ = false; - totalRows_ = 0; // @E1a - highestKnownRow_ = NOT_KNOWN; // @E1a - } - - return positionValid_; - } - } - - - - // JDBC 2.0 @D2C - // @E1 entire method re-worked - /** - Returns the current row number, or 0. -

- 0 is returned if the cursor is not on a valid row (such as - before the first row, after the last row, or on the insert row), - or if the result set is empty. -

- This method may be slow if cursor movement based on the end - of the result set is used. Methods such as last(), afterLast() - and absolute() with a negative value will move the cursor based - on the end of the result set. This method will be slow in these - cases because internally the method must get every row to determine - how many rows are in the result set before calculating the current - row. The system does not know how many rows are in the result - set until every row is touched. That is why this method may - start at the highest row retrieved so far, then do next() until - the last row is retrieved. -

- Once the maximum number of rows in the result set is determined, - it does not change until the result set is closed. - - @return The current row number (1-based), or 0 if the current row - is not valid. - - @exception SQLException If the result set is not open. - **/ - public int getRow () - throws SQLException - { - synchronized(internalLock_) // @D1A - { - checkOpen (); - - // @E1 - // Old Code: - // return ((positionFromFirst_ > 0) && (positionInsert_ == false)) - // ? positionFromFirst_ : 0; - // - // Old code in more readable format: - // if ((positionFromFirst_ > 0) && (positionInsert_ == false)) - // return positionFromFirst_; - // else - // return 0; - // - // case 1: return 0 if not on a valid row. - if((positionInsert_ == true) || - (positionValid_ == false) || - (isBeforeFirst()) || - (isAfterLast())) - return 0; - - // case 2: we know what the current row is because scrolling has been - // from the beginning of the result set, or because previous - // method calls calculated the value. - if(positionFromFirst_ > 0) - return positionFromFirst_; - - // case 3a: don't know the current row because negative scrolling or - // scrolling from end has been used, *** and we are currently - // at the end of the rs ***. If we don't know the number of - // rows in the rs we will move the cursor to the highest - // known row then do next() until we get to the end. - if(isLast()) - { - if(totalRows_ != NOT_KNOWN) - { - positionFromFirst_ = totalRows_; - return positionFromFirst_; - } - else - { - if(highestKnownRow_ == NOT_KNOWN) - first(); - else - absolute(highestKnownRow_); - - while(next()) - { - } - previous(); - - return positionFromFirst_; - } - } - - // case 3b: don't know the current row because negative scrolling or - // scrolling from end has been used, *** but we are not currently - // at the end of the rs ***. If we don't know how many rows are - // in the result set we will move the cursor to the highest known - // row then do next() until we get back to where we were. - if(positionFromLast_ > 0) - { - if(totalRows_ != NOT_KNOWN) - { - positionFromFirst_ = totalRows_ - positionFromLast_ + 1; - return positionFromFirst_; - } - else - { - int currentPositionFromLast = positionFromLast_; - - if(highestKnownRow_ == NOT_KNOWN) - first(); - else - absolute(highestKnownRow_); - - while(next()) - { - } - absolute(totalRows_ - currentPositionFromLast + 1); - - return positionFromFirst_; - } - } - - // case 4: We don't have a clue how to figure out what the current row is. Return 0; - if(JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "Could not determine row number in getRow()."); - - return 0; - } - } - - - - // JDBC 2.0 - /** - Indicates if the cursor is positioned after the last row. - - @return true if the cursor is positioned after the last row; - false if the cursor is not positioned after the last - row or if the result set contains no rows. - - @exception SQLException If the result set is not open. - **/ - public boolean isAfterLast () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - return((positionFromLast_ == 0) - && (positionFromFirst_ != 0) - && (positionInsert_ == false) - && (! rowCache_.isEmpty ())); - } - } - - - - // JDBC 2.0 - /** - Indicates if the cursor is positioned before the first row. - - @return true if the cursor is positioned before the first row; - false if the cursor is not positioned before the first - row or if the result set contains no rows. - - @exception SQLException If the result set is not open. - **/ - public boolean isBeforeFirst () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - return((positionFromFirst_ == 0) - && (positionFromLast_ != 0) - && (positionInsert_ == false) - && (! rowCache_.isEmpty ())); - } - } - - - - // JDBC 2.0 - /** - Indicates if the cursor is positioned on the first row. - - @return true if the cursor is positioned on the first row; - false if the cursor is not positioned on the first - row or the row number can not be determined. - - @exception SQLException If the result set is not open. - **/ - public boolean isFirst () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - return((positionFromFirst_ == 1) && (positionInsert_ == false)); - } - } - - - - // JDBC 2.0 - /** - Indicates if the cursor is positioned on the last row. - - @return true if the cursor is positioned on the last row; - false if the cursor is not positioned on the last - row or the row number can not be determined. - - @exception SQLException If the result set is not open. - **/ - public boolean isLast () - throws SQLException - { - synchronized(internalLock_) // @D1A - { - checkOpen (); - // @E2c -- Problem: if scrolling forward we don't know - // if we are on the last row until next() is called. - // In this case isLast() never returns true because - // by the time we figure out we are out of rows we - // are afterLast. The fix is to internally call - // next then previous if we don't figure out we - // are on the last row some othe way. This will be - // slower but accurate. - // - // Old code: - // - // return (((positionFromLast_ == 1) || - // ((positionFromFirst_ == maxRows_) && (maxRows_ > 0))) - // && (positionInsert_ == false)); - // - // New code: - if((positionInsert_ == true) || (positionFromLast_ > 1) || (positionValid_ == false)) - return false; - - if(( positionFromLast_ == 1) || - ((positionFromFirst_ == maxRows_) && (maxRows_ > 0))) - return true; - - boolean returnValue = ! next(); - previous(); - - return returnValue; - } - } - - - - // JDBC 2.0 - /** - Positions the cursor to the last row. - If an InputStream from the current row is open, it is - implicitly closed. In addition, all warnings and pending updates - are cleared. - - @return true if the requested cursor position is - valid; false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public boolean last () - throws SQLException - { - synchronized(internalLock_) // @D1A - { - beforePositioning (true); - - if(maxRows_ > 0) // @E3a - { - // @E3a - findLastRow(); // @E3a - // @E3a - if(totalRows_ >= maxRows_) // @E3a - { - rowCache_.absolute(maxRows_); // @E3a - } - else - { // @E3a - rowCache_.last (); // @E3a - } - } // @E3a - else - rowCache_.last(); - - // If the result set is not empty, then mark the - // position as being on the last row. - if(rowCache_.isValid ()) - { - positionFromFirst_ = -1; - positionFromLast_ = 1; - positionValid_ = true; - - if(totalRows_ != NOT_KNOWN) // @E1a - { - // @E1a - positionFromFirst_ = totalRows_; // @E1a - } // @E1a - } - - // Otherwise, there is no last row (only when result set is empty?) - else - { - positionFromFirst_ = -1; - positionFromLast_ = -1; - positionValid_ = false; - totalRows_ = 0; // @E1a - highestKnownRow_ = NOT_KNOWN; // @E1a - } - - return positionValid_; - } - } - - - - // JDBC 2.0 - /** - Positions the cursor to the current row. This is the row - where the cursor was positioned before moving it to the insert - row. If the cursor is not on the insert row, then this - has no effect. - -

If an InputStream from the current row is open, it is - implicitly closed. In addition, all warnings and pending updates - are cleared. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public void moveToCurrentRow () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - beforePositioning (true); - } - } - - - - // JDBC 2.0 - /** - Positions the cursor to the insert row. - If an InputStream from the current row is open, it is - implicitly closed. In addition, all warnings and pending updates - are cleared. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - the result set is not updatable, - or an error occurs. - **/ - public void moveToInsertRow () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - beforePositioning (true); - beforeUpdate (); - positionInsert_ = true; - } - } - - - - /** - Positions the cursor to the next row. - If an InputStream from the current row is open, it is - implicitly closed. In addition, all warnings and pending updates - are cleared. - - @return true if the requested cursor position is valid; false - if there are no more rows. - - @exception SQLException If the result set is not open, - or an error occurs. - **/ - public boolean next () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Initialization. - beforePositioning (false); - - // Handle max rows. - if((maxRows_ > 0) && (positionFromFirst_ >= maxRows_)) - { - // @B3D afterLast (); - // @E3D rowCache_.afterLast (); // @B3a - rowCache_.absolute(maxRows_ + 1); // @E3a - positionFromFirst_ = -1; // @B3A - positionFromLast_ = 0; // @B3A - positionValid_ = false; // @B3A - - totalRows_ = maxRows_; // @E1a - highestKnownRow_ = maxRows_; // @E1a - - return false; - } - - // Normal case. If the row is null after a next, then - // the cursor is positioned after the last row. - rowCache_.next(); - - if(rowCache_.isValid ()) - { - if(positionFromFirst_ >= 0) - ++positionFromFirst_; - - if(positionFromLast_ > 0) - --positionFromLast_; - - if(positionFromFirst_ >= 0) // @E1a - if(highestKnownRow_ < positionFromFirst_) // @E1a - highestKnownRow_ = positionFromFirst_; // @E1a - - positionValid_ = true; - - } - else - { - // If this is the first time row has been null, - // then increment one more time. - // @E2a only if there are rows in the rs! - if(! rowCache_.isEmpty ()) // @E2a - { - if(positionFromLast_ != 0) - { - if(positionFromFirst_ >= 0) - { - totalRows_ = positionFromFirst_; // @E2a - ++positionFromFirst_; - } - } - positionFromLast_ = 0; - } // @E2a - else - { // @E1a // @E1a - if(highestKnownRow_ > 0) // @E1a - { - // @E1a - totalRows_ = highestKnownRow_; // @E1a - positionFromFirst_ = totalRows_; // @E1a - positionFromLast_ = 0; // @E1a - } // @E1a - } // @E1a - positionValid_ = false; - } - - return positionValid_; - } - } - - - - // JDBC 2.0 - /** - Positions the cursor to the previous row. - If an InputStream from the current row is open, it is implicitly - closed. In addition, all warnings and pending updates - are cleared. - - @return true if the requested cursor position is - valid; false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public boolean previous () - throws SQLException - { - synchronized(internalLock_) // @D1A - { - // Initialization. - beforePositioning (true); - - // Normal case. If the row is null after a previous, then - // the cursor is positioned before the first row. - rowCache_.previous(); - - if(rowCache_.isValid ()) - { - if(positionFromFirst_ > 0) - --positionFromFirst_; - - if(positionFromLast_ >= 0) - ++positionFromLast_; - - positionValid_ = true; - } - else - { - // If this is the first time row has been null, - // then increment one more time. - if(positionFromFirst_ != 0) - if(positionFromLast_ >= 0) - ++positionFromLast_; - - positionFromFirst_ = 0; - positionValid_ = false; - } - - return positionValid_; - } - } - - - // JDBC 2.0 - /** - Refreshes the current row from the database and cancels all - pending updates that have been made since the last call to - updateRow(). This method provides a way for an application - to explicitly refetch a row from the database. If an InputStream - from the current row is open, it is implicitly closed. In - addition, all warnings and pending updates are cleared. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - the cursor is not positioned on a row, - the cursor is positioned on the - insert row or an error occurs. - **/ - public void refreshRow () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - if(positionInsert_ == true) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - beforePositioning (true); - if(positionValid_ == false) - JDError.throwSQLException (JDError.EXC_CURSOR_POSITION_INVALID); - - if(concurrency_ == CONCUR_UPDATABLE) - for(int i = 0; i < columnCount_; ++i) - updateSet_[i] = false; - - rowCache_.refreshRow (); - } - } - - - - // JDBC 2.0 - /** - Positions the cursor to a relative row number. - -

Attempting to move beyond the first row positions the - cursor before the first row. Attempting to move beyond the last - row positions the cursor after the last row. - -

If an InputStream from the current row is open, it is - implicitly closed. In addition, all warnings and pending updates - are cleared. - - @param rowNumber The relative row number. If the relative row - number is positive, this positions the cursor - after the current position. If the relative - row number is negative, this positions the - cursor before the current position. If the - relative row number is 0, then the cursor - position does not change. - @return true if the requested cursor position is - valid, false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - the cursor is not positioned on a valid row, - or an error occurs. - */ - public boolean relative (int rowNumber) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Initialization. - beforePositioning (true); - //if((positionFromFirst_ == 0) || (positionFromLast_ == 0)) //@rel1 per javadoc, relative(1) <==> next() - //return false; - - // Handle max rows. - if((maxRows_ > 0) && (positionFromFirst_ == -1)) // @E3a - getRow(); // @E3a - - if((positionFromFirst_ >= 0) - && (positionFromFirst_ + rowNumber > maxRows_) - && (maxRows_ > 0)) - { // @E3a - afterLast(); // should this be absolute(max+1) // @E3a - return false; - } // @E3a - - - // Normal case. If the row is null after relative, - // then we are off the edge of the result set. - rowCache_.relative (rowNumber); - - if(rowCache_.isValid ()) - { - if(positionFromFirst_ >= 0) - positionFromFirst_ += rowNumber; - - if(positionFromLast_ >= 0) - positionFromLast_ -= rowNumber; - - positionValid_ = true; - - if(positionFromFirst_ >= 0) // @E1a - if(highestKnownRow_ < positionFromFirst_) // @E1a - highestKnownRow_ = positionFromFirst_; // @E1a - - } - else - { - if(rowNumber >= 0) - { - positionFromFirst_ = -1; - positionFromLast_ = 0; - } - else - { - positionFromFirst_ = 0; - positionFromLast_ = -1; - } - positionValid_ = false; - } - - return positionValid_; - } - } - - - - /*---------------------------------------------------------*/ - /* */ - /* GET DATA METHODS. */ - /* */ - /*---------------------------------------------------------*/ - - - - // JDBC 2.0 - /** - Returns the value of a column as an Array object. - DB2 for IBM i does not support arrays. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - **/ - public Array getArray (int columnIndex) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - - - // JDBC 2.0 - /** - Returns the value of a column as an Array object. - DB2 for IBM i does not support arrays. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getArray("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - **/ - public Array getArray (String columnName) - throws SQLException - { - return getArray (findColumn (columnName)); - } - - - - /** - Returns the value of a column as a stream of ASCII - characters. This can be used to get values from columns - with SQL types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and - BLOB. All of the data in the returned stream must be read - prior to getting the value of any other column. The next - call to a get method implicitly closes the stream. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public InputStream getAsciiStream (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - InputStream value = (data == null) ? null : data.getAsciiStream (); - openInputStream_ = value; - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - /** - Returns the value of a column as a stream of ASCII - characters. This can be used to get values from columns - with SQL types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and - BLOB. All of the data in the returned stream must be read - prior to getting the value of any other column. The next - call to a get method implicitly closes the stream. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getAsciiStream("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public InputStream getAsciiStream (String columnName) - throws SQLException - { - return getAsciiStream (findColumn (columnName)); - } - - - - // JDBC 2.0 - // @D0C - /** - Returns the value of a column as a BigDecimal object. This - can be used to get values from columns with SQL types - SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public BigDecimal getBigDecimal (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - BigDecimal value = (data == null) ? null : data.getBigDecimal (-1); - testDataTruncation (columnIndex, data, false); //@trunc getBigDecimal(int) can set truncation_!=0, but we should not throw an SQLEception - return value; - } - } - - - - // JDBC 2.0 - // @D0C - /** - Returns the value of a column as a BigDecimal object. This - can be used to get values from columns with SQL types - SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getBigDecimal("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, - or the requested conversion is not valid. - **/ - public BigDecimal getBigDecimal (String columnName) - throws SQLException - { - return getBigDecimal (findColumn (columnName)); - } - - - - // @D0C - /** - Returns the value of a column as a BigDecimal object. This - can be used to get values from columns with SQL types - SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @param scale The number of digits after the decimal. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the scale is not valid, or the - requested conversion is not valid. - - @deprecated Use getBigDecimal(int) instead. - @see #getBigDecimal(int) - **/ - public BigDecimal getBigDecimal (int columnIndex, int scale) - throws SQLException - { - // Check for negative scale. - if(scale < 0) - JDError.throwSQLException (JDError.EXC_SCALE_INVALID); - - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - BigDecimal value = (data == null) ? null : data.getBigDecimal (scale); - testDataTruncation (columnIndex, data, false); //@trunc getBigDecimal(int) can set truncation_!=0, but we should not throw an SQLEception - return value; - } - } - - - - // @D0C - /** - Returns the value of a column as a BigDecimal object. This - can be used to get values from columns with SQL types - SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getBigDecimal("\"MixedCase\"", 0). - - @param columnName The column name. - @param scale The number of digits after the decimal. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, - the scale is not valid, or the - requested conversion is not valid. - - @deprecated Use getBigDecimal(String) instead. - @see #getBigDecimal(String) - **/ - public BigDecimal getBigDecimal (String columnName, int scale) - throws SQLException - { - return getBigDecimal (findColumn (columnName), scale); - } - - - - /** - Returns the value of a column as a stream of uninterpreted - bytes. This can be used to get values from columns - with SQL types BINARY, VARBINARY, and BLOB. All of the data in - the returned stream must be read prior to getting the - value of any other column. The next call to a get method - implicitly closes the stream. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public InputStream getBinaryStream (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - InputStream value = (data == null) ? null : data.getBinaryStream (); - openInputStream_ = value; - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - /** - Returns the value of a column as a stream of uninterpreted - bytes. This can be used to get values from columns - with SQL types BINARY, VARBINARY, and BLOB. All of the data in - the returned stream must be read prior to getting the - value of any other column. The next call to a get method - implicitly closes the stream. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getBinaryStream("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public InputStream getBinaryStream (String columnName) - throws SQLException - { - return getBinaryStream (findColumn (columnName)); - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a Blob object. - This can be used to get values from columns with SQL - types BINARY, VARBINARY, and BLOB. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public Blob getBlob (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Blob value = (data == null) ? null : data.getBlob (); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a Blob object. - This can be used to get values from columns with SQL - types BINARY, VARBINARY, and BLOB. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getBlob("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public Blob getBlob (String columnName) - throws SQLException - { - return getBlob (findColumn (columnName)); - } - - - - // @D0C - /** - Returns the value of a column as a Java boolean value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @return The column value or false if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public boolean getBoolean (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - boolean value = (data == null) ? false : data.getBoolean (); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - // @D0C - /** - Returns the value of a column as a Java boolean value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getBoolean("\"MixedCase\""). - - @param columnName The column name. - @return The column value or false if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public boolean getBoolean (String columnName) - throws SQLException - { - return getBoolean (findColumn (columnName)); - } - - - - // @D0C - /** - Returns the value of a column as a Java byte value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public byte getByte (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - byte value = (data == null) ? 0 : data.getByte (); - testDataTruncation (columnIndex, data, true); //@trunc - return value; - } - } - - - - // @D0C - /** - Returns the value of a column as a Java byte value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getByte("\"MixedCase\""). - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public byte getByte (String columnName) - throws SQLException - { - return getByte (findColumn (columnName)); - } - - - - /** - Returns the value of a column as a Java byte array. - This can be used to get values from columns with SQL - types BINARY and VARBINARY. - -

This can also be used to get values from columns - with other types. The values are returned in their - native IBM i format. This is not supported for - result sets returned by a DatabaseMetaData object. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public byte[] getBytes (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - byte[] value; // @C1C - - // Treat this differently from the other get's. If the data is not a // @C1A - // BINARY, VARBINARY, or BLOB, and we have access to the bytes, then return // @C1A @D4C - // the bytes directly. // @C1A - if((data != null) - && (!(data.getSQLType() == SQLData.BINARY)) - && (!(data.getSQLType() == SQLData.VARBINARY)) - && (!(data.getSQLType() == SQLData.BLOB)) // @D4A - && (!(data.getSQLType() == SQLData.BLOB_LOCATOR)) // @D4A - && (!(data.getSQLType() == SQLData.CHAR_FOR_BIT_DATA)) // @M0A - && (!(data.getSQLType() == SQLData.LONG_VARCHAR_FOR_BIT_DATA)) // @M0A - && (!(data.getSQLType() == SQLData.VARCHAR_FOR_BIT_DATA)) // @M0A - && (!(data.getSQLType() == SQLData.ROWID)) // @M0A - && (!(data.getSQLType() == SQLData.XML_LOCATOR)) //@xml3 - && (row_ instanceof JDServerRow)) // @C1A - value = ((JDServerRow)row_).getRawBytes(columnIndex); // @C1A - // @C1A - else - { // @C1A - value = (data == null) ? null : data.getBytes (); // @C1C - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - } // @C1A - return value; - } - } - - - - /** - Returns the value of a column as a Java byte array. - This can be used to get values from columns with SQL - types BINARY and VARBINARY. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getBytes("\"MixedCase\""). - -

This can also be used to get values from columns - with other types. The values are returned in their - native IBM i format. This is not supported for - result sets returned by a DatabaseMetaData object. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public byte[] getBytes (String columnName) - throws SQLException - { - return getBytes (findColumn (columnName)); - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a character stream. - This can be used to to get values from columns with SQL - types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and BLOB. - All of the data in the returned stream must be read prior to - getting the value of any other column. The next call to a get - method implicitly closes the stream. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - */ - public Reader getCharacterStream (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Reader value = (data == null) ? null : data.getCharacterStream (); - openReader_ = value; - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a character stream. - This can be used to to get values from columns with SQL - types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and BLOB. - All of the data in the returned stream must be read prior - to getting the value of any other column. The next call - to a get method implicitly closes the stream. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getCharacterStream("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not valid, or the - requested conversion is not valid. - */ - public Reader getCharacterStream (String columnName) - throws SQLException - { - return getCharacterStream (findColumn (columnName)); - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a Clob object. - This can be used to get values from columns with SQL - types CHAR, VARCHAR, BINARY, VARBINARY, BLOB, and CLOB. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public Clob getClob (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Clob value = (data == null) ? null : data.getClob (); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a Clob object. - This can be used to get values from columns with SQL - types CHAR, VARCHAR, BINARY, VARBINARY, BLOB, and CLOB. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getClob("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public Clob getClob (String columnName) - throws SQLException - { - return getClob (findColumn (columnName)); - } - - - - /** - Returns the value of a column as a java.sql.Date object using - the default calendar. This can be used to get values from columns - with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public Date getDate (int columnIndex) - throws SQLException - { - //@P0D return getDate (columnIndex, Calendar.getInstance ()); - return internalGetDate(columnIndex, null); //@P0A - } - - - - /** - Returns the value of a column as a java.sql.Date object using - the default calendar. This can be used to get values from columns - with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getDate("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public Date getDate (String columnName) - throws SQLException - { - //@P0D return getDate (findColumn (columnName), Calendar.getInstance ()); - return internalGetDate(findColumn(columnName), null); //@P0A - } - - - //@P0A - Moved out of getDate() - private Date internalGetDate(int columnIndex, Calendar calendar) - throws SQLException - { - synchronized(internalLock_) - { - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Date value = (data == null) ? null : data.getDate (calendar); - testDataTruncation (columnIndex, data, false); //@trunc getDate() can set truncation_!=0, but we should not throw an SQLEception - return value; - } - } - - // JDBC 2.0 - /** - Returns the value of a column as a java.sql.Date object using - a calendar other than the default. This can be used to get values - from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - - @param columnIndex The column index (1-based). - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the calendar is null, or the - requested conversion is not valid. - **/ - public Date getDate (int columnIndex, Calendar calendar) - throws SQLException - { - // Check for null calendar. - if(calendar == null) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - return internalGetDate(columnIndex, calendar); //@P0C - /*@P0M - synchronized(internalLock_) { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Date value = (data == null) ? null : data.toDate (calendar); - testDataTruncation (columnIndex, data); - return value; - } - */ //@P0M - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a java.sql.Date object using - a calendar other than the default. This can be used to get values - from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getDate("\"MixedCase\"", calendar). - - @param columnName The column name. - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, - the calendar is null, or the - requested conversion is not valid. - **/ - public Date getDate (String columnName, Calendar calendar) - throws SQLException - { - return getDate (findColumn (columnName), calendar); - } - - - - // @D0C - /** - Returns the value of a column as a Java double value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public double getDouble (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - double value = (data == null) ? 0 : data.getDouble (); - testDataTruncation (columnIndex, data, true); //@trunc - return value; - } - } - - - - // @D0C - /** - Returns the value of a column as a Java double value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getDouble("\"MixedCase\""). - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public double getDouble (String columnName) - throws SQLException - { - return getDouble (findColumn (columnName)); - } - - - - // @D0C - /** - Returns the value of a column as a Java float value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public float getFloat (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - float value = (data == null) ? 0 : data.getFloat (); - testDataTruncation (columnIndex, data, true); //@trunc - return value; - } - } - - - - // @D0C - /** - Returns the value of a column as a Java float value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getFloat("\"MixedCase\""). - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public float getFloat (String columnName) - throws SQLException - { - return getFloat (findColumn (columnName)); - } - - - - // @D0C - /** - Returns the value of a column as a Java int value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public int getInt (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - int value = (data == null) ? 0 : data.getInt (); - testDataTruncation (columnIndex, data, true); //@trunc - return value; - } - } - - - - // @D0C - /** - Returns the value of a column as a Java int value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getInt("\"MixedCase\""). - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public int getInt (String columnName) - throws SQLException - { - return getInt (findColumn (columnName)); - } - - - - // @D0C - /** - Returns the value of a column as a Java long value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public long getLong (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - long value = (data == null) ? 0 : data.getLong (); - testDataTruncation (columnIndex, data, true); //@trunc - return value; - } - } - - - - // @D0C - /** - Returns the value of a column as a Java long value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getLong("\"MixedCase\""). - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public long getLong (String columnName) - throws SQLException - { - return getLong (findColumn (columnName)); - } - - - - /** - Returns the ResultSetMetaData object that describes the - result set's columns. - - @return The metadata object. - - @exception SQLException If an error occurs. - **/ - public ResultSetMetaData getMetaData () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - ConvTable convTable = null; // @G5A - DBExtendedColumnDescriptors extendedDescriptors = null; // @G5A - // If a DMD method (internal call), statement_ will be null because we don't really have // @G5A - // a statement object // @G5A - if(statement_ != null) // @G5A - { - // @G5A - extendedDescriptors = statement_.getExtendedColumnDescriptors(); // @G5A - // If we have extendedDescriptors, send a ConvTable to convert them, else pass null // @G5A - if(extendedDescriptors != null) // @G5A - { - // @G5A - convTable = ((AS400JDBCConnection)connection_).converter_; // @G5A - } // @G5A - } // @G5A - return new AS400JDBCResultSetMetaData (catalog_, concurrency_, - cursorName_, row_, - extendedDescriptors, convTable, connection_); // @G5A //@in1 - } - } - - - - /** - Returns the value of a column as a Java Object. - This can be used to get values from columns with all - SQL types. If the column is a user-defined type, then the - connection's type map is used to created the object. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public Object getObject (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Object value = (data == null) ? null : data.getObject (); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - /** - Returns the value of a column as a Java Object. - This can be used to get values from columns with all - SQL types. If the column is a user-defined type, then the - connection's type map is used to created the object. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getObject("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public Object getObject (String columnName) - throws SQLException - { - return getObject (findColumn (columnName)); - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a Java Object. - - @param columnIndex The column index (1-based). - @param typeMap The type map. This is not used. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the type map is null, or the - requested conversion is not valid. - **/ - public Object getObject (int columnIndex, Map typeMap) - throws SQLException - { - // Check for null type map, even though we don't use it. - if(typeMap == null) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - return getObject (columnIndex); - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a Java Object. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getObject("\"MixedCase\"", typeMap). - - @param columnName The column name. - @param typeMap The type map. This is not used. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, - the type map is null, or the - requested conversion is not valid. - **/ - public Object getObject (String columnName, Map typeMap) - throws SQLException - { - // Check for null type map, even though we don't use it. - if(typeMap == null) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - return getObject (findColumn (columnName)); - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a Ref object. - DB2 for IBM i does not support structured types. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support structured types. - **/ - public Ref getRef (int columnIndex) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a Ref object. - DB2 for IBM i does not support structured types. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getRef("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support structured types. - **/ - public Ref getRef (String columnName) - throws SQLException - { - return getRef (findColumn (columnName)); - } - - - - // @D0C - /** - Returns the value of a column as a Java short value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public short getShort (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - short value = (data == null) ? 0 : data.getShort (); - testDataTruncation (columnIndex, data, true); //@trunc - return value; - } - } - - - - // @D0C - /** - Returns the value of a column as a Java short value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getShort("\"MixedCase\""). - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public short getShort (String columnName) - throws SQLException - { - return getShort (findColumn (columnName)); - } - - - - /** - Returns the value of a column as a String object. - This can be used to get values from columns with any SQL - type. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public String getString (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - String value = (data == null) ? null : data.getString (); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - /** - Returns the value of a column as a String object. - This can be used to get values from columns with any SQL - type. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getString("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public String getString (String columnName) - throws SQLException - { - return getString (findColumn (columnName)); - } - - - - /** - Returns the value of a column as a java.sql.Time object using the - default calendar. This can be used to get values from columns - with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public Time getTime (int columnIndex) - throws SQLException - { - //@P0D return getTime (columnIndex, Calendar.getInstance ()); - return internalGetTime(columnIndex, null); //@P0A - } - - - - /** - Returns the value of a column as a java.sql.Time object using the - default calendar. This can be used to get values from columns - with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getTime("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public Time getTime (String columnName) - throws SQLException - { - //@P0D return getTime (findColumn (columnName), Calendar.getInstance ()); - return internalGetTime(findColumn(columnName), null); //@P0A - } - - //@P0M - Moved out of getTime() - private Time internalGetTime(int columnIndex, Calendar calendar) - throws SQLException - { - synchronized(internalLock_) - { - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Time value = (data == null) ? null : data.getTime (calendar); - testDataTruncation (columnIndex, data, false); //@trunc getTime() can set truncation_!=0, but we should not throw an SQLEception - return value; - } - } - - // JDBC 2.0 - /** - Returns the value of a column as a java.sql.Time object using a - calendar other than the default. This can be used to get values - from columns with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP. - - @param columnIndex The column index (1-based). - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the calendar is null, or the - requested conversion is not valid. - **/ - public Time getTime (int columnIndex, Calendar calendar) - throws SQLException - { - //@P0D synchronized(internalLock_) { // @D1A - // Check for null calendar. - if(calendar == null) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - return internalGetTime(columnIndex, calendar); //@P0C - /*@P0M - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Time value = (data == null) ? null : data.toTime (calendar); - testDataTruncation (columnIndex, data); - return value; - } - */ //@P0M - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a java.sql.Time object using a - calendar other than the default. This can be used to get values - from columns with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getTime("\"MixedCase\"", calendar). - - @param columnName The column name. - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, - the calendar is null, or the - requested conversion is not valid. - **/ - public Time getTime (String columnName, Calendar calendar) - throws SQLException - { - return getTime (findColumn (columnName), calendar); - } - - - - /** - Returns the value of a column as a java.sql.Timestamp object - using the default calendar. This can be used to get values - from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public Timestamp getTimestamp (int columnIndex) - throws SQLException - { - //@P0D return getTimestamp (columnIndex, Calendar.getInstance ()); - return internalGetTimestamp(columnIndex, null); //@P0A - } - - - - /** - Returns the value of a column as a java.sql.Timestamp object - using the default calendar. This can be used to get values - from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getTimestamp("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public Timestamp getTimestamp (String columnName) - throws SQLException - { - //@P0D return getTimestamp (findColumn (columnName), Calendar.getInstance ()); - return internalGetTimestamp(findColumn(columnName), null); //@P0A - } - - //@P0M - Moved out of getTimestamp() - private Timestamp internalGetTimestamp(int columnIndex, Calendar calendar) - throws SQLException - { - synchronized(internalLock_) - { - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Timestamp value = (data == null) ? null : data.getTimestamp (calendar); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - // JDBC 2.0 - /** - Returns the value of a column as a java.sql.Timestamp object - using a calendar other than the default. This can be used to - get values from columns with SQL types CHAR, VARCHAR, DATE, - and TIMESTAMP. - - @param columnIndex The column index (1-based). - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the calendar is null, or the - requested conversion is not valid. - **/ - public Timestamp getTimestamp (int columnIndex, Calendar calendar) - throws SQLException - { - // Check for null calendar. - if(calendar == null) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - return internalGetTimestamp(columnIndex, calendar); - /*@P0M - synchronized(internalLock_) { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Timestamp value = (data == null) ? null : data.toTimestamp (calendar); - testDataTruncation (columnIndex, data); - return value; - } - */ //@P0M - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a java.sql.Timestamp object - using a calendar other than the default. This can be used to - get values from columns with SQL types CHAR, VARCHAR, DATE, - and TIMESTAMP. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getTimestamp("\"MixedCase\"", calendar). - - @param columnName The column name. - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, - the calendar is null, or the - requested conversion is not valid. - **/ - public Timestamp getTimestamp (String columnName, Calendar calendar) - throws SQLException - { - return getTimestamp (findColumn (columnName), calendar); - } - - - - /** - Returns the value of a column as a stream of Unicode - characters. This can be used to get values from columns - with SQL types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and - BLOB. All of the data in the returned stream must be read - prior to getting the value of any other column. The next - call to a get method implicitly closes the stream. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - - @deprecated Use getCharacterStream(int) instead. - @see #getCharacterStream(int) - **/ - public InputStream getUnicodeStream (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - InputStream value = (data == null) ? null : data.getUnicodeStream (); - openInputStream_ = value; - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - /** - Returns the value of a column as a stream of Unicode - characters. This can be used to get values from columns - with SQL types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, - and BLOB. All of the data in the returned stream must be - read prior to getting the value of any other column. The - next call to a get method implicitly closes the stream. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getUnicodeStream("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - - @deprecated Use getCharacterStream(String) instead. - @see #getCharacterStream(String) - **/ - public InputStream getUnicodeStream (String columnName) - throws SQLException - { - return getUnicodeStream (findColumn (columnName)); - } - - - - /** - Returns a piece of row data for the specified index, - and perform all appropriate validation. Also check - for SQL NULL. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - private SQLData getValue (int columnIndex) - throws SQLException - { - checkOpen (); - clearCurrentValue (); - - // Check that there is a current row. - if((positionValid_ == false) && (positionInsert_ == false)) - JDError.throwSQLException (JDError.EXC_CURSOR_POSITION_INVALID); - - // Validate The column index. - if((columnIndex < 1) || (columnIndex > columnCount_)) - JDError.throwSQLException (JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check if an update was made or we are on the insert - // row. - if(concurrency_ == CONCUR_UPDATABLE) - { - if((updateSet_[columnIndex-1] == true) //@EIC2 changed back to original logic. For case of after insertrow is inserted, the updateSet[] is reset, but can still have non-null data. - || (positionInsert_ == true)) - { - wasNull_ = updateNulls_[columnIndex-1]; - wasDataMappingError_ = false; - if(wasNull_) - return null; - else - return updateRow_.getSQLData (columnIndex); - } - } - - // Get the data and check for SQL NULL. @A1C - wasNull_ = row_.isNull (columnIndex); - wasDataMappingError_ = row_.isDataMappingError(columnIndex); - - //@KBL if a locator is used, tell the statement associated with it - SQLData sqlData = row_.getSQLType(columnIndex); //@KBL - int sqlType = sqlData.getSQLType(); //@xml3 - if((sqlType == SQLData.CLOB_LOCATOR || //@KBL - sqlType == SQLData.BLOB_LOCATOR || //@KBL - sqlType == SQLData.DBCLOB_LOCATOR || //@KBL //@pdc jdbc40 - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 - sqlType == SQLData.XML_LOCATOR) - && statement_ != null) //@mdrs2 //@xml3 - statement_.setAssociatedWithLocators(true); //@KBL - - if(wasNull_ || wasDataMappingError_) - return null; - else - return row_.getSQLData (columnIndex); - } - - - - /** - Tests if a DataTruncation occurred on the read of a piece of - data and posts a DataTruncation warning if so. - - @param columnIndex The column index (1-based). - @param data The data that was read, or null for SQL NULL. - @param exceptionOnTrunc Flag to notify method whether or not to throw an SQLException when there is truncation. - **/ - private void testDataTruncation (int columnIndex, SQLData data, boolean exceptionOnTrunc) throws SQLException //@trunc - { - if(wasDataMappingError_) - { - postWarning(new DataTruncation(columnIndex, false, true, -1, -1)); - } - - if(data != null) - { - int truncated = data.getTruncated (); - if(truncated > 0) - { - //if 610 and number data type and called on certain getX() methods, then throw SQLException - //if 610, follow Native driver to thow exc if data is text and getX() is a number type getter method. - if((((AS400JDBCConnection)connection_).getVRM() >= JDUtilities.vrm610) && (exceptionOnTrunc == true)) //@trunc //@trunc2 only use exceptionOnTrunc as flag - { //@trunc - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); //@trunc - } //@trunc - int actualSize = data.getActualSize (); - postWarning (new DataTruncation (columnIndex, false, true, - actualSize, actualSize - truncated)); - } - } - } - - - - /** - Indicates if the last column read has the value of SQL NULL. - - @return true if the value is SQL NULL; - false otherwise. - - @exception SQLException If the result set is not open. - **/ - public boolean wasNull () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - return wasNull_; - } - } - - - - /*---------------------------------------------------------*/ - /* */ - /* UPDATE DATA METHODS. */ - /* */ - /*---------------------------------------------------------*/ - - - - /** - Checks necessary conditions before updating a row. All - update methods should call this before updating. - - @exception SQLException If the result set is not open - or the result set is not updatable. - **/ - private void beforeUpdate () - throws SQLException - { - checkOpen (); - - if(concurrency_ != CONCUR_UPDATABLE) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - - - // JDBC 2.0 - /** - Cancels all pending updates that have been made since the last - call to updateRow(). If no updates have been made or updateRow() - has already been called, then this method has no effect. - - @exception SQLException If the result set is not open - or the result set is not updatable. - **/ - public void cancelRowUpdates () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - beforeUpdate (); - - for(int i = 0; i < columnCount_; ++i) - updateSet_[i] = false; - } - } - - - - // JDBC 2.0 - /** - Deletes the current row from the result set and the database. - After deleting a row, the cursor position is no longer valid, - so it must be explicitly repositioned. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the cursor is positioned on the insert row, - or an error occurs. - **/ - public void deleteRow () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - beforeUpdate (); - - if(positionValid_ == false) // @D9a - JDError.throwSQLException (JDError.EXC_CURSOR_POSITION_INVALID); // @D9a - - if(positionInsert_ == true) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - - if(JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "Deleting a row."); - - // Prepare the delete statement the first time - // we need it. - if(deleteStatement_ == null) - { // @D3C - StringBuffer buffer = new StringBuffer(); // @D3A - buffer.append("DELETE FROM "); // @D3A - buffer.append(selectTable_); // @D3A - buffer.append(" WHERE CURRENT OF \""); // @D3A - buffer.append(cursorName_); // @D3A - buffer.append("\""); // @D3A - deleteStatement_ = connection_.prepareStatement(buffer.toString()); // @D3C - } // @D3A - - deleteStatement_.execute (); - - // Mark the cursor position not valid. - positionValid_ = false; - rowCache_.flush (); - } - } - - - - // JDBC 2.0 - /** - Inserts the contents of the insert row into the result set - and the database. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on the insert row, - a column that is not nullable was not specified, - or an error occurs. - **/ - // - // Implementation note: - // - // * It seems inefficient to prepare and execute a - // new statement each time, but we really have no choice, - // since (1.) The combination of columns that we want - // to insert could change every time and (2.) We need - // to use parameter markers to be able to set columns - // not representable using SQL literals. - // - public void insertRow () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - beforeUpdate (); - - if(positionInsert_ == false) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - - // Build up the SQL statement. Make sure a correlation name - // is not used. - StringBuffer buffer = new StringBuffer (); - buffer.append ("INSERT INTO "); - buffer.append (selectTable_); - buffer.append (" ("); - StringBuffer values = new StringBuffer (); - int columnsSet = 0; - for(int i = 0; i < columnCount_; ++i) - { - if(updateSet_[i] == true) - { - if(columnsSet++ > 0) - { - buffer.append (","); - values.append (","); - } - buffer.append ("\""); // @D6a - buffer.append (prepareQuotes(row_.getFieldName (i+1))); //@DELIMc - buffer.append ("\""); // @D6a - values.append ("?"); - } - } - if(columnsSet == 0) - buffer.append (prepareQuotes(row_.getFieldName (1))); //@DELIMc - buffer.append (") VALUES ("); - if(columnsSet == 0) - buffer.append ("NULL"); - else - buffer.append (values.toString()); // added toString() because 1.4 has a method that appends a string buffer - buffer.append (")"); - - if(JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "Inserting a row: " + buffer); - - // Prepare the statement and set the parameters. - PreparedStatement insertStatement = connection_.prepareStatement (buffer.toString ()); - for(int i = 0, columnsSet2 = 0; i < columnCount_; ++i) - { - if(updateSet_[i] == true) - { - Object columnValue = updateRow_.getSQLData (i+1).getObject (); - if(updateNulls_[i]) - insertStatement.setNull (++columnsSet2, row_.getSQLType (i+1).getType ()); - else if(updateDefaults_[i]) //@EIA - ((AS400JDBCPreparedStatement)insertStatement).setDB2Default(++columnsSet2); //@EIA - else if(updateUnassigned_[i]) //@EIA - ((AS400JDBCPreparedStatement)insertStatement).setDB2Unassigned(++columnsSet2); //@EIA - else - insertStatement.setObject (++columnsSet2, columnValue); - updateSet_[i] = false; - } - } - - // Execute and close the statement. Dispatch the warnings, - // if any. - insertStatement.executeUpdate (); - SQLWarning warnings = insertStatement.getWarnings (); - if(warnings != null) - postWarning (warnings); // The whole link gets added. - insertStatement.close (); - - rowCache_.flush (); - } - } - - - //@DELIMa - // Prepares a name to be double-quoted. - private final static String prepareQuotes(String name) - { - return JDUtilities.prepareForDoubleQuotes(name); - } - - - // JDBC 2.0 - /** - Indicates if the current row has been deleted. A result set - of type TYPE_SCROLL_INSENSITIVE may contain rows that have - been deleted. - - @return true if current row has been deleted; false otherwise. - - @exception SQLException If an error occurs. - **/ - public boolean rowDeleted () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // We almost always return false because we don't allow - // updates to scroll insensitive or forward only result - // sets, so we never have holes. - // - // The only case where this may be true is if they call - // it immediately after deleting a row and then don't - // reposition the cursor. - return((positionValid_ == false) && (positionInsert_ == false) - && ((positionFromFirst_ > 0) || (positionFromLast_ > 0))); - } - } - - - - // JDBC 2.0 - /** - Indicates if the current row has been inserted. This driver does - not support this method. - - @return Always false. - - @exception SQLException If an error occurs. - **/ - public boolean rowInserted () - throws SQLException - { - // For forward only and scroll insensitive result sets, we don't - // have the ability to detect this. For scroll sensitive result - // sets, the inserts are visible, but we don't have access to which - // were inserted. So we always return false. - return false; - } - - - - // JDBC 2.0 - /** - Indicates if the current row has been updated. This driver does - not support this method. - - @return Always false. - - @exception SQLException If an error occurs. - **/ - public boolean rowUpdated () - throws SQLException - { - // For forward only and scroll insensitive result sets, we don't - // have the ability to detect this. For scroll sensitive result - // sets, the inserts are visible, but we don't have access to which - // were inserted. So we always return false. - return false; - } - - - - /** - Tests if a DataTruncation occurred on the write of a piece of - data and posts a DataTruncation warning if so. - - @param columnIndex The column index (1-based). - @param data The data that was written, or null for SQL NULL. - @since Modification 5 - **/ - private void testDataTruncation2 (int columnIndex, SQLData data) - throws SQLException // @D5A //@trunc - { - if(data != null) - { - int truncated = data.getTruncated (); - if(truncated > 0) - { - int actualSize = data.getActualSize (); - throw new DataTruncation (columnIndex, false, false, // @D5C - actualSize + truncated, actualSize); // @D5C - } - } - } - - - - //@G4A JDBC 3.0 - /** - Updates the value of a column as an Array object. - DB2 for IBM i does not support arrays. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - @since Modification 5 - **/ - public void updateArray (int columnIndex, Array columnValue) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - } - - - - //@G4A JDBC 3.0 - /** - Updates the value of a column as an Array object. - DB2 for IBM i does not support arrays. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateArray("\"MixedCase\"", columnValue). - - @param columnName The column name. - @param columnValue The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - **/ - public void updateArray (String columnName, Array columnValue) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using an ASCII stream value. - The driver reads the data from the stream as needed until no more - bytes are available. The driver converts this to an SQL VARCHAR - value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - @param length The length. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, the - requested conversion is not valid, - the length is not - valid, the input stream does not contain - ASCII characters, or an error happens - while reading the input stream. - **/ - public void updateAsciiStream (int columnIndex, - InputStream columnValue, - int length) - throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - - updateValue (columnIndex, - (columnValue == null) ? null : JDUtilities.streamToString (columnValue, length, "ISO8859_1"), // @B1C - null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using an ASCII stream value. - The driver reads the data from the stream as needed until no more - bytes are available. The driver converts this to an SQL VARCHAR - value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateAsciiStream("\"MixedCase\"", columnValue, length). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - @param length The length. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, the - requested conversion is not valid, - the length is not valid, - the input stream does not contain - ASCII characters, or an error happens - while reading the input stream. - **/ - public void updateAsciiStream (String columnName, - InputStream columnValue, - int length) - throws SQLException - { - updateAsciiStream (findColumn (columnName), columnValue, length); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a BigDecimal value. The - driver converts this to an SQL NUMERIC value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBigDecimal (int columnIndex, BigDecimal columnValue) - throws SQLException - { - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - - updateValue (columnIndex, columnValue, null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a BigDecimal value. The - driver converts this to an SQL NUMERIC value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateBigDecimal("\"MixedCase\"", columnValue). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateBigDecimal (String columnName, BigDecimal columnValue) - throws SQLException - { - updateBigDecimal (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a binary stream value. - The driver reads the data from the stream as needed until no more - bytes are available. The driver converts this to an SQL - VARBINARY value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - @param length The length. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid, - the length is not valid, or an error - happens while reading the input stream. - **/ - public void updateBinaryStream (int columnIndex, - InputStream columnValue, - int length) - throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - - updateValue (columnIndex, - (columnValue == null) ? null : JDUtilities.streamToBytes (columnValue, length), // @B1C - null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a binary stream value. - The driver reads the data from the stream as needed until no more - bytes are available. The driver converts this to an SQL - VARBINARY value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateBinaryStream("\"MixedCase\"", columnValue, length). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - @param length The length. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid, - the length is not valid, or an error - happens while reading the input stream. - **/ - public void updateBinaryStream (String columnName, - InputStream columnValue, - int length) - throws SQLException - { - updateBinaryStream (findColumn (columnName), columnValue, length); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java boolean value. - The driver converts this to an SQL SMALLINT value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIT, but DB2 for IBM i - // does not support that. - // - public void updateBoolean (int columnIndex, boolean columnValue) - throws SQLException - { - updateValue (columnIndex, new Short ((short) (columnValue ? 1 : 0)), null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java boolean value. - The driver converts this to an SQL SMALLINT value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateBoolean("\"MixedCase\"", columnValue). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - @since Modification 5 - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIT, but DB2 for IBM i - // does not support that. - // - public void updateBoolean (String columnName, boolean columnValue) - throws SQLException - { - updateBoolean (findColumn (columnName), columnValue); - } - - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using a Java Blob value. - The driver converts this to an SQL BLOB value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - @since Modification 5 - **/ - public void updateBlob (int columnIndex, Blob columnValue) - throws SQLException - { - updateValue (columnIndex, columnValue, null, -1); - } - - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using a Java Blob value. - The driver converts this to an SQL BLOB value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateBlob("\"MixedCase\"", columnValue). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBlob (String columnName, Blob columnValue) - throws SQLException - { - updateValue (findColumn (columnName), columnValue, null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java byte value. - The driver converts this to an SQL SMALLINT value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL TINYINT, but DB2 for IBM i - // does not support that. - // - public void updateByte (int columnIndex, byte columnValue) - throws SQLException - { - updateValue (columnIndex, new Short (columnValue), null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java byte value. - The driver converts this to an SQL SMALLINT value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateByte("\"MixedCase\"", columnValue). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL TINYINT, but DB2 for IBM i - // does not support that. - // - public void updateByte (String columnName, byte columnValue) - throws SQLException - { - updateByte (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java byte array value. - The driver converts this to an SQL VARBINARY value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBytes (int columnIndex, byte[] columnValue) - throws SQLException - { - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - - updateValue (columnIndex, columnValue, null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java byte array value. - The driver converts this to an SQL VARBINARY value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateBytes("\"MixedCase\"", columnValue). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateBytes (String columnName, byte[] columnValue) - throws SQLException - { - updateBytes (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Reader value. - The driver reads the data from the Reader as needed until no more - characters are available. The driver converts this to an SQL VARCHAR - value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - @param length The length. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid, - the length is not valid, or an error - happens while reading the input stream. - **/ - public void updateCharacterStream (int columnIndex, - Reader columnValue, - int length) - throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - - updateValue (columnIndex, - (columnValue == null) ? null : JDUtilities.readerToString (columnValue, length), // @B1C - null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Reader value. - The driver reads the data from the Reader as needed until no more - characters are available. The driver converts this to an SQL VARCHAR - value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateCharacterStream("\"MixedCase\"", columnValue, length). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - @param length The length. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid, - the length is not valid, or an error - happens while reading the input stream. - @since Modification 5 - **/ - public void updateCharacterStream (String columnName, - Reader columnValue, - int length) - throws SQLException - { - updateCharacterStream (findColumn (columnName), columnValue, length); - } - - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using a Java Clob value. - The driver converts this to an SQL CLOB value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - @since Modification 5 - **/ - public void updateClob (int columnIndex, Clob columnValue) - throws SQLException - { - updateValue (columnIndex, columnValue, null, -1); - } - - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using a Java Clob value. - The driver converts this to an SQL CLOB value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateClob("\"MixedCase\"", columnValue). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateClob (String columnName, Clob columnValue) - throws SQLException - { - updateValue (findColumn (columnName), columnValue, null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a java.sql.Date value. - The driver converts this to an SQL DATE value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateDate (int columnIndex, Date columnValue) - throws SQLException - { - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - - updateValue (columnIndex, columnValue, null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a java.sql.Date value. - The driver converts this to an SQL DATE value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateDate("\"MixedCase\"", columnValue). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateDate (String columnName, Date columnValue) - throws SQLException - { - updateDate (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java double value. - The driver converts this to an SQL DOUBLE value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateDouble (int columnIndex, double columnValue) - throws SQLException - { - updateValue (columnIndex, new Double (columnValue), null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java double value. - The driver converts this to an SQL DOUBLE value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateDouble("\"MixedCase\"", columnValue). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateDouble (String columnName, double columnValue) - throws SQLException - { - updateDouble (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java float value. - The driver converts this to an SQL REAL value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateFloat (int columnIndex, float columnValue) - throws SQLException - { - updateValue (columnIndex, new Float (columnValue), null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java float value. - The driver converts this to an SQL REAL value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateFloat("\"MixedCase\"", columnValue). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateFloat (String columnName, float columnValue) - throws SQLException - { - updateFloat (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java int value. - The driver converts this to an SQL INTEGER value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateInt (int columnIndex, int columnValue) - throws SQLException - { - updateValue (columnIndex, new Integer (columnValue), null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java int value. - The driver converts this to an SQL INTEGER value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateInt("\"MixedCase\"", columnValue). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateInt (String columnName, int columnValue) - throws SQLException - { - updateInt (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - // @D0C - /** - Updates a column in the current row using a Java long value. - If the connected system supports SQL BIGINT data, the driver - converts this to an SQL BIGINT value. Otherwise, the driver - converts this to an SQL INTEGER value. SQL BIGINT data is - supported on V4R5 and later. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIGINT, but DB2 for IBM i - // does not support that until V4R5. - // - public void updateLong (int columnIndex, long columnValue) - throws SQLException - { - updateValue (columnIndex, new Long(columnValue), null, -1); // @D0C - } - - - - // JDBC 2.0 - // @D0C - /** - Updates a column in the current row using a Java long value. - If the connected system supports SQL BIGINT data, the driver - converts this to an SQL BIGINT value. Otherwise, the driver - converts this to an SQL INTEGER value. SQL BIGINT data is - supported on V4R5 and later. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateLong("\"MixedCase\"", columnValue). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIGINT, but DB2 for IBM i - // does not support that until V4R5. - // - public void updateLong (String columnName, long columnValue) - throws SQLException - { - updateLong (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using SQL NULL. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateNull (int columnIndex) - throws SQLException - { - updateValue (columnIndex, null, null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using SQL NULL. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateNull("\"MixedCase\""). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateNull (String columnName) - throws SQLException - { - updateNull (findColumn (columnName)); - } - - - - //@EIA 550 extended indicator defaults - /** - Updates a column in the current row to the SQL Default. - @param columnIndex The column index (1-based). - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void updateDB2Default(int columnIndex) throws SQLException - { - updateValueExtendedIndicator (columnIndex, 1); //1 is default - } - - //@EIA 550 extended indicator defaults - /** - Updates a column in the current row to the SQL Default. Same as updateDB2Default. - @param columnIndex The column index (1-based). - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void updateDBDefault(int columnIndex) throws SQLException - { - updateDB2Default(columnIndex); - } - - //@EIA 550 extended indicator defaults - /** - Updates a column in the current row to the SQL Default. - @param columnName The column name. - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void updateDB2Default(String columnName) throws SQLException - { - updateDB2Default (findColumn (columnName)); - } - - //@EIA 550 extended indicator defaults - /** - Updates a column in the current row to the SQL Default. Same as updateDB2Default. - @param columnName The column name. - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void updateDBDefault(String columnName) throws SQLException - { - updateDB2Default (findColumn (columnName)); - } - - - //@EIA 550 extended indicator defaults - /** - Updates a column in the current row to the SQL Unassigned. - @param columnIndex The column index (1-based). - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void updateDB2Unassigned(int columnIndex) throws SQLException - { - updateValueExtendedIndicator (columnIndex, 2); //2 is unassigned - } - - //@EIA 550 extended indicator defaults - /** - Updates a column in the current row to the SQL Unassigned. Same as updtaeDB2Unassigned. - @param columnIndex The column index (1-based). - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void updateDBUnassigned(int columnIndex) throws SQLException - { - updateDB2Unassigned(columnIndex); - } - - - //@EIA 550 extended indicator defaults - /** - Updates a column in the current row to the SQL Unassigned. - @param columnName The column name. - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void updateDB2Unassigned(String columnName) throws SQLException - { - updateDB2Unassigned (findColumn (columnName)); - } - - - //@EIA 550 extended indicator defaults - /** - Updates a column in the current row to the SQL Unassigned. Same as updateDB2Unassigned. - @param columnName The column name. - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void updateDBUnassigned(String columnName) throws SQLException - { - updateDB2Unassigned (findColumn (columnName)); - } - - - // JDBC 2.0 - /** - Updates a column in the current row using an Object value. - The driver converts this to a value of an SQL type, depending on - the type of the specified value. The JDBC specification defines - a standard mapping from Java types to SQL types. In the cases - where an SQL type is not supported by DB2 for IBM i, the - next closest matching type - is used. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public void updateObject (int columnIndex, Object columnValue) - throws SQLException - { - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - - updateValue (columnIndex, columnValue, null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using an Object value. - The driver converts this to a value of an SQL type, depending on - the type of the specified value. The JDBC specification defines - a standard mapping from Java types to SQL types. In the cases - where an SQL type is not supported by DB2 for IBM i, the - next closest matching type - is used. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateObject("\"MixedCase\"", columnValue). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, - or the requested conversion is not valid. - **/ - public void updateObject (String columnName, Object columnValue) - throws SQLException - { - updateObject (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using an Object value. - The driver converts this to a value of an SQL type, depending on - the type of the specified value. The JDBC specification defines - a standard mapping from Java types to SQL types. In the cases - where an SQL type is not supported by DB2 for IBM i, the - next closest matching type - is used. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - @param scale The number of digits after the decimal - if SQL type is DECIMAL or NUMERIC. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - the scale is not valid, or the - requested conversion is not valid. - **/ - public void updateObject (int columnIndex, - Object columnValue, - int scale) - throws SQLException - { - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - - if(scale < 0) - JDError.throwSQLException (JDError.EXC_SCALE_INVALID); - -/* ifdef JDBC40 */ - if (columnValue instanceof SQLXML) //@xmlspec - updateSQLXML(columnIndex, (SQLXML)columnValue); //@xmlspec - else -/* endif */ - updateValue (columnIndex, columnValue, null, scale); //@P0C - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using an Object value. - The driver converts this to a value of an SQL type, depending on - the type of the specified value. The JDBC specification defines - a standard mapping from Java types to SQL types. In the cases - where an SQL type is not supported by DB2 for IBM i, the - next closest matching type - is used. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateObject("\"MixedCase\"", columnValue, scale). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - @param scale The number of digits after the decimal - if SQL type is DECIMAL or NUMERIC. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, - the scale is not valid, or the - requested conversion is not valid. - @since Modification 5 - **/ - public void updateObject (String columnName, - Object columnValue, - int scale) - throws SQLException - { - updateObject (findColumn (columnName), columnValue, scale); - } - - - - //@G4A JDBC 3.0 - /** - Updates the value of an SQL REF output parameter as a Ref value. - DB2 for IBM i does not support structured types. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support REFs. - @since Modification 5 - **/ - public void updateRef (int columnIndex, Ref columnValue) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - } - - - - //@G4A JDBC 3.0 - /** - Updates the value of an SQL REF output parameter as a Ref value. - DB2 for IBM i does not support structured types. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateRef("\"MixedCase\"", columnValue). - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support REFs. - **/ - public void updateRef (String columnName, Ref columnValue) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - } - - - - // JDBC 2.0 - /** - Updates the database with the new contents of the current - row. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the cursor is positioned on the insert row, - or an error occurs. - **/ - // - // Implementation note: - // - // * It seems inefficient to prepare and execute a - // new statement each time, but we really have no choice, - // since (1.) The combination of columns that we want - // to update could change every time and (2.) We need - // to use parameter markers to be able to set columns - // not representable using SQL literals. - // - public void updateRow () - throws SQLException - { - beforeUpdate (); - DBExtendedColumnDescriptors extendedDescriptors = null; //@K1A - ConvTable convTable = null; //@K1A - - if((positionInsert_ == true) || (positionValid_ == false)) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - - // Build up the SQL statement. - StringBuffer buffer = new StringBuffer (); - buffer.append ("UPDATE "); - buffer.append (selectTable_); - if(correlationName_ != null) - { - buffer.append (" AS "); - buffer.append (correlationName_); - } - buffer.append (" SET "); - int columnsSet = 0; - for(int i = 0; i < columnCount_; ++i) - { - if(updateSet_[i] == true) - { - if(columnsSet++ > 0) - buffer.append (","); - buffer.append ("\""); // @D6a - // @K1A If we have column descriptors, use them to get the column label. //@K1A - if(statement_ != null) //@K1A - { - // @K1A - extendedDescriptors = statement_.getExtendedColumnDescriptors(); // @K1A - // If we have extendedDescriptors, send a ConvTable to convert them, else pass null // @K1A - if(extendedDescriptors != null) // @K1A - { - // @K1A - convTable = ((AS400JDBCConnection)connection_).converter_; // @K1A - String columnName = extendedDescriptors.getColumnDescriptors(i+1, convTable).getBaseColumnName(convTable); //@K1A //@K2A changed from getColumnLabel //@SS1 - if(columnName != null) { - if (((AS400JDBCConnection)connection_).getVRM() < JDUtilities.vrm540) { //@DELIMa - buffer.append(JDUtilities.stripOuterDoubleQuotes(columnName)); // if pre-V5R4, just strip outer quotes (no double-up necessary) - } - else { - buffer.append(prepareQuotes(columnName)); // if V5R4+, also need to double-up any embedded quotes @DELIMc - } - } - else { // Column name is null, so get it from the row. - // We're using extended descriptors, - // so we'll need to double-up embedded quotes. - buffer.append(prepareQuotes(row_.getFieldName(i+1))); //@DELIMa - } - } // @K1A - else // @K1A - buffer.append (prepareQuotes(row_.getFieldName (i+1))); // @K1A @DELIMc - // @K1A - } - else - buffer.append(prepareQuotes(row_.getFieldName(i+1))); - buffer.append ("\"=?"); // @D6c @DELIMc - } - } - buffer.append (" WHERE CURRENT OF \""); // @D3C - buffer.append (cursorName_); - buffer.append ("\""); // @D3C - - // Only go through with this if columns were set. - if(columnsSet > 0) - { - - if(JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "Updating a row: " + buffer); - - // Prepare the statement and set the parameters. - PreparedStatement updateStatement = connection_.prepareStatement (buffer.toString ()); - try{ - for(int i = 0, columnsSet2 = 0; i < columnCount_; ++i) - { - if(updateSet_[i] == true) - { - Object columnValue = updateRow_.getSQLData (i+1).getObject (); - if(updateNulls_[i] == true) - updateStatement.setNull (++columnsSet2, row_.getSQLType (i+1).getType ()); - else if(updateDefaults_[i]) //@EIA - ((AS400JDBCPreparedStatement)updateStatement).setDB2Default(++columnsSet2); //@EIA - else if(updateUnassigned_[i]) //@EIA - ((AS400JDBCPreparedStatement)updateStatement).setDB2Unassigned(++columnsSet2); //@EIA - else - updateStatement.setObject (++columnsSet2, columnValue); - } - } - - // Execute and close the statement. Dispatch the warnings, - // if any. - updateStatement.executeUpdate (); - SQLWarning warnings = updateStatement.getWarnings (); - if(warnings != null) - postWarning (warnings); // The whole link gets added. - } - finally{ - //Always close the statement - Fix for JTOpen Bug 4148 - updateStatement.close (); - } - - rowCache_.flush (); - } - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java short value. - The driver converts this to an SQL SMALLINT value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateShort (int columnIndex, short columnValue) - throws SQLException - { - updateValue (columnIndex, new Short (columnValue), null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java short value. - The driver converts this to an SQL SMALLINT value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateShort("\"MixedCase\"", columnValue). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateShort (String columnName, short columnValue) - throws SQLException - { - updateShort (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a String value. - The driver converts this to an SQL VARCHAR value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public void updateString (int columnIndex, String columnValue) - throws SQLException - { - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - - //if(columnIndex <= columnCount_ && columnIndex > 0) //@pdc - // columnValue = AS400BidiTransform.convertDataToHostCCSID(columnValue, (AS400JDBCConnection) connection_, ((JDServerRow) row_).getCCSID(columnIndex)); //Bidi-HCG - - updateValue (columnIndex, columnValue, null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a String value. - The driver converts this to an SQL VARCHAR value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateString("\"MixedCase\"", columnValue). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateString (String columnName, String columnValue) - throws SQLException - { - updateString (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a java.sql.Time value. - The driver converts this to an SQL TIME value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateTime (int columnIndex, Time columnValue) - throws SQLException - { - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - - updateValue (columnIndex, columnValue, null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a java.sql.Time value. - The driver converts this to an SQL TIME value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateTime("\"MixedCase\"", columnValue). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateTime (String columnName, Time columnValue) - throws SQLException - { - updateTime (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a java.sql.Timestamp value. - The driver converts this to an SQL TIMESTAMP value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateTimestamp (int columnIndex, Timestamp columnValue) - throws SQLException - { - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - - updateValue (columnIndex, columnValue, null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a java.sql.Timestamp value. - The driver converts this to an SQL TIMESTAMP value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateTimestamp("\"MixedCase\"", columnValue). - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateTimestamp (String columnName, Timestamp columnValue) - throws SQLException - { - updateTimestamp (findColumn (columnName), columnValue); - } - - - - /** - Updates a column for the specified index, and performs all - appropriate validation. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null if the value - is SQL NULL. - @param calendar The calendar, or null if not - applicable. - @param scale The scale, or -1 if not applicable. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - private void updateValue (int columnIndex, - Object columnValue, - Calendar calendar, - int scale) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - beforeUpdate (); - - // Check that there is a current row. - if((positionValid_ == false) && (positionInsert_ == false)) - JDError.throwSQLException (JDError.EXC_CURSOR_POSITION_INVALID); - - // Validate The column index. - if((columnIndex < 1) || (columnIndex > columnCount_)) - JDError.throwSQLException (JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Set the update value. If there is a type mismatch, - // set() with throw an exception. - SQLData sqlData = updateRow_.getSQLType(columnIndex); //@P0C - int columnIndex0 = columnIndex - 1; - - //@G7A If the data is a locator, then set its handle. - int sqlType = sqlData.getSQLType(); //@xml3 - if(columnValue != null && (sqlType == SQLData.CLOB_LOCATOR || - sqlType == SQLData.BLOB_LOCATOR || - sqlType == SQLData.DBCLOB_LOCATOR || - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 - sqlType == SQLData.XML_LOCATOR)) //@xml3 - { //@G8C //@G7A - statement_.setAssociatedWithLocators(true); //@KBL - try - { //@G7A - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; //@G7A - sqlDataAsLocator.setHandle (((AS400JDBCBlobLocator)columnValue).getHandle()); //@G7A - } //@G7A - catch(ClassCastException cce) //@G7A - { - /*ignore*/ //@G7A - } //@G7A - - try - { //@G7A - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; //@G7A - sqlDataAsLocator.setHandle (((AS400JDBCClobLocator)columnValue).getHandle()); //@G7A - } //@G7A - catch(ClassCastException cce) //@G7A - { - /*ignore*/ - } //@G7A -/* ifdef JDBC40 */ - try //@PDA jdbc40 - following upon existing design - { //@PDA jdbc40 - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; //@PDA jdbc40 - sqlDataAsLocator.setHandle (((AS400JDBCNClobLocator)columnValue).getHandle()); //@PDA jdbc40 - } //@PDA jdbc40 - catch(ClassCastException cce) //@PDA jdbc40 - { - // ignore - } - try //@olddesc - { //@olddesc - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; //@olddesc - sqlDataAsLocator.setHandle (((AS400JDBCSQLXMLLocator)columnValue).getHandle()); //@olddesc - } //@olddesc - catch(ClassCastException cce) //@olddesc - { - // ignore - } -/* endif */ - } - - if(columnValue != null) - sqlData.set (columnValue, calendar, scale); - updateNulls_[columnIndex0] = (columnValue == null); - updateDefaults_[columnIndex0] = false; //@EIA - updateUnassigned_[columnIndex0] = false; //@EIA - updateSet_[columnIndex0] = true; - - if(dataTruncation_) // @B2A - testDataTruncation2 (columnIndex, sqlData); // @B2C - } - } - - - - - //@PDA jdbc40 - /** - * Retrieves the holdability of this ResultSet object - * @return either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT - * The holdability is derived in this order of precedence: -

    -
  • 1. The holdability, if any, that was specified on statement creation using - the methods createStatement(), prepareCall(), or prepareStatement() on the - Connection object. -
  • 2. The holdability specified using the method setHoldability(int) - if this method was called on the Connection object. -
  • 3. If neither of above methods were called, the value of the - cursor hold - driver property.
- Full functionality of #1 and #2 requires OS/400 v5r2 - or IBM i. If connecting to OS/400 V5R1 or earlier, - the value specified on these two methods will be ignored and the default holdability - will be the value of #3. - * @throws SQLException if a database error occurs - */ - public int getHoldability() throws SQLException - { - synchronized(internalLock_) - { - checkOpen (); - - //@cur return value from cursor attribues if exists else return value as done in pre 550 - if( statement_ != null ) //@cur - { //@cur - int vrm = 0; //@cur3 - if(connection_ != null) //@cur3 - vrm = ((AS400JDBCConnection)connection_).getVRM(); //@cur3 - if(statement_.cursor_.getCursorAttributeHoldable() == 0 - && (vrm <= JDUtilities.vrm610 - || (vrm >= JDUtilities.vrm710 && statement_.cursor_.getCursorIsolationLevel() != 0))) //@cur //@cur3 *none is always hold - return ResultSet.CLOSE_CURSORS_AT_COMMIT; //@cur - else if(statement_.cursor_.getCursorAttributeHoldable() == 1 - || (vrm >= JDUtilities.vrm710 && statement_.cursor_.getCursorIsolationLevel() == 0)) //@cur //@cur3 - return ResultSet.HOLD_CURSORS_OVER_COMMIT; //@cur - else //@cur - { //@cur - //not able to get from cursor attrs from hostserver - if((statement_.resultSetHoldability_ == AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT) || - (statement_.resultSetHoldability_ == AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT)) - { - return statement_.resultSetHoldability_; - } - } - } //@cur - - //if above cannot determine holdability, then do best guess - if(connection_ instanceof AS400JDBCConnection && connection_ != null) //@cur - return ((AS400JDBCConnection) connection_).getHoldability(); //@cur CAST needed for JDK 1.3 - else //@cur - return ResultSet.CLOSE_CURSORS_AT_COMMIT; //@cur (if no statment exists for this, then safest is to return close at commit to prevent cursor reuse errors) - } - } - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @param columnIndex - * @exception SQLException if a database access error occurs - */ - public Reader getNCharacterStream(int columnIndex) throws SQLException - { - synchronized(internalLock_) - { - SQLData data = getValue (columnIndex); - Reader value = (data == null) ? null : data.getNCharacterStream (); - openReader_ = value; - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnName the name of the column - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language - * @exception SQLException if a database access error occurs - */ - public Reader getNCharacterStream(String columnName) throws SQLException - { - return getNCharacterStream (findColumn (columnName)); - } - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a NClob object - * in the Java programming language. - * - * @param columnIndex - * @return a NClob object representing the SQL - * NCLOB value in the specified column - * @exception SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurss - */ -/* ifdef JDBC40 */ - public NClob getNClob(int columnIndex) throws SQLException - { - synchronized(internalLock_) - { - SQLData data = getValue (columnIndex); - NClob value = (data == null) ? null : data.getNClob (); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } -/* endif */ - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a NClob object - * in the Java programming language. - * - * @param columnName the name of the column from which to retrieve the value - * @return a NClob object representing the SQL NCLOB - * value in the specified column - * @exception SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - */ -/* ifdef JDBC40 */ - public NClob getNClob(String columnName) throws SQLException - { - return getNClob (findColumn (columnName)); - } -/* endif */ - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnIndex - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - */ - public String getNString(int columnIndex) throws SQLException - { - synchronized(internalLock_) - { - SQLData data = getValue (columnIndex); - String value = (data == null) ? null : data.getNString (); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnName the SQL name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - */ - public String getNString(String columnName) throws SQLException - { - return getNString (findColumn (columnName)); - } - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row of this - * ResultSet object as a java.sql.RowId object in the Java - * programming language. - * - * @param columnIndex the column number - * @return the column value ; if the value is a SQL NULL the - * value returned is null - * @throws SQLException if a database access error occurs - */ -/* ifdef JDBC40 */ - public RowId getRowId(int columnIndex) throws SQLException - { - synchronized(internalLock_) - { - SQLData data = getValue (columnIndex); - RowId value = (data == null) ? null : data.getRowId(); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } -/* endif */ - - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row of this - * ResultSet object as a java.sql.RowId object in the Java - * programming language. - * - * @param columnName the name of the column - * @return the column value ; if the value is a SQL NULL the - * value returned is null - * @throws SQLException if a database access error occurs - */ -/* ifdef JDBC40 */ - public RowId getRowId(String columnName) throws SQLException - { - return getRowId(findColumn (columnName)); - } -/* endif */ - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row of - * this ResultSet as a - * java.sql.SQLXML object in the Java programming language. - * @param columnIndex - * @return a SQLXML object that maps an SQL XML value - * @throws SQLException if a database access error occurs - */ -/* ifdef JDBC40 */ - public SQLXML getSQLXML(int columnIndex) throws SQLException - { - synchronized(internalLock_) - { - SQLData data = getValue (columnIndex); - SQLXML value = (data == null) ? null : data.getSQLXML(); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } -/* endif */ - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row of - * this ResultSet as a - * java.sql.SQLXML object in the Java programming language. - * @param columnName the name of the column from which to retrieve the value - * @return a SQLXML object that maps an SQL XML value - * @throws SQLException if a database access error occurs - */ -/* ifdef JDBC40 */ - public SQLXML getSQLXML(String columnName) throws SQLException - { - return getSQLXML(findColumn (columnName)); - } -/* endif */ - - - - - //@PDA jdbc40 - /** - * Updates the designated column with a java.sql.NClob value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex - * @param nClob the value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - */ -/* ifdef JDBC40 */ - public void updateNClob(int columnIndex, NClob nClob) throws SQLException - { - updateValue (columnIndex, nClob, null, -1); - } -/* endif */ - - //@PDA jdbc40 - /** - * Updates the designated column with a java.sql.NClob value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnName name of the column - * @param nClob the value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - */ -/* ifdef JDBC40 */ - public void updateNClob(String columnName, NClob nClob) throws SQLException - { - updateNClob (findColumn (columnName), nClob); - - } -/* endif */ - - - //@pda jdbc40 - /** - * Updates the designated column with a String value. - * It is intended for use when updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex - * @param nString the value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - */ - public void updateNString(int columnIndex, String nString) throws SQLException - { - updateValue (columnIndex, nString, null, -1); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a String value. - * It is intended for use when updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnName name of the Column - * @param nString the value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - */ - public void updateNString(String columnName, String nString) throws SQLException - { - updateNString (findColumn (columnName), nString); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a RowId value. The updater - * methods are used to update column values in the current row or the insert - * row. The updater methods do not update the underlying database; instead - * the updateRow or insertRow methods are called - * to update the database. - * - * @param columnIndex - * @param x the column value - * @throws SQLException if a database access occurs - */ -/* ifdef JDBC40 */ - public void updateRowId(int columnIndex, RowId x) throws SQLException - { - updateValue (columnIndex, x, null, -1); - } -/* endif */ - - - //@pda jdbc40 - /** - * Updates the designated column with a RowId value. The updater - * methods are used to update column values in the current row or the insert - * row. The updater methods do not update the underlying database; instead - * the updateRow or insertRow methods are called - * to update the database. - * - * @param columnName the name of the column - * @param x the column value - * @throws SQLException if a database access occurs - */ -/* ifdef JDBC40 */ - public void updateRowId(String columnName, RowId x) throws SQLException - { - updateRowId (findColumn (columnName), x); - } -/* endif */ - - //@pda jdbc40 - /** - * Updates the designated column with a java.sql.SQLXML value. - * The updater - * methods are used to update column values in the current row or the insert - * row. The updater methods do not update the underlying database; instead - * the updateRow or insertRow methods are called - * to update the database. - * @param columnIndex - * @param xmlObject the value for the column to be updated - * @throws SQLException if a database access error occurs - */ -/* ifdef JDBC40 */ - public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException - { - //@xmlspec special handling of blob/clob column types - if(xmlObject == null) //@xmlspec3 - { //@xmlspec3 - updateValue (columnIndex, xmlObject, null, -1); //@xmlspec3 - return; //@xmlspec3 - } //@xmlspec3 - - int sqlDataType; - if(updateRow_ != null) //@nulltype - sqlDataType = updateRow_.getSQLData (columnIndex).getType(); //@xmlspec //@nulltype - else - sqlDataType = Types.SQLXML; //@nulltype dummy type so processing continues - - - switch(sqlDataType) { //@xmlspec - case Types.CLOB: //@xmlspec - updateCharacterStream(columnIndex, xmlObject.getCharacterStream());//@xmlspec - break; //@xmlspec - case Types.BLOB: //@xmlspec - updateBinaryStream(columnIndex, xmlObject.getBinaryStream()); //@xmlspec - break; //@xmlspec - default: //@xmlspec - updateValue (columnIndex, xmlObject, null, -1); - } - } -/* endif */ - - //@pda jdbc40 - /** - * Updates the designated column with a java.sql.SQLXML value. - * The updater - * methods are used to update column values in the current row or the insert - * row. The updater methods do not update the underlying database; instead - * the updateRow or insertRow methods are called - * to update the database. - * - * @param columnName the name of the column - * @param xmlObject the column value - * @throws SQLException if a database access occurs - */ -/* ifdef JDBC40 */ - public void updateSQLXML(String columnName, SQLXML xmlObject) throws SQLException - { - updateSQLXML(findColumn(columnName), xmlObject); - } -/* endif */ - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCResultSet", "java.sql.ResultSet" }; - } - - //@PDA jdbc40 - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - - updateValue (columnIndex, - (x == null) ? null : JDUtilities.streamToString (x, (int)length, "ISO8859_1"), null, -1); - } - - - //@PDA jdbc40 - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the column name - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException - { - updateAsciiStream (findColumn (columnLabel), x, length); - } - - - //@PDA jdbc40 - /** - * Updates the designated column with a binary stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - - updateValue (columnIndex, - (x == null) ? null : JDUtilities.streamToBytes (x, (int)length), null, -1); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a binary stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException - { - updateBinaryStream (findColumn (columnLabel), x, length); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given input stream, which - * will have the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - - updateValue (columnIndex, - (inputStream == null) ? null : JDUtilities.streamToBytes (inputStream, (int)length), null, -1); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given input stream, which - * will have the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException - { - updateBlob (findColumn (columnLabel), inputStream, length); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - - updateValue (columnIndex, - (x == null) ? null : JDUtilities.readerToString (x, (int)length), null, -1); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException - { - updateCharacterStream (findColumn (columnLabel), reader, length); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateClob(int columnIndex, Reader reader, long length) throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - - updateValue (columnIndex, - (reader == null) ? null : JDUtilities.readerToString (reader, (int)length), null, -1); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateClob(String columnLabel, Reader reader, long length) throws SQLException - { - updateClob (findColumn (columnLabel), reader, length); - } - - - //@PDA jdbc40 - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - - updateValue (columnIndex, - (x == null) ? null : JDUtilities.readerToString (x, (int)length), null, -1); - } - - - //@PDA jdbc40 - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException - { - updateNCharacterStream (findColumn (columnLabel), reader, length); - } - - - //@PDA jdbc40 - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - - updateValue (columnIndex, - (reader == null) ? null : JDUtilities.readerToString (reader, (int)length), null, -1); - } - - - //@PDA jdbc40 - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException - { - updateNClob (findColumn (columnLabel), reader, length); - } - - - //@pda jdbc40 - /** - * Updates the designated column with an ascii stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateAsciiStream which takes a length parameter. - * - * @param columnIndex - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException - { - updateValue (columnIndex, - (x == null) ? null : JDUtilities.streamToBytes (x), null, -1); - } - - - //@pda jdbc40 - /** - * Updates the designated column with an ascii stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateAsciiStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if the columnLabel is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException - { - updateAsciiStream (findColumn (columnLabel), x); - } - - - //@pda jdbc40 - /** - * Updates the designated column with a binary stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBinaryStream which takes a length parameter. - * - * @param columnIndex - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException - { - updateValue (columnIndex, - (x == null) ? null : JDUtilities.streamToBytes (x), null, -1); - } - - - //@pda jdbc40 - /** - * Updates the designated column with a binary stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBinaryStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if the columnLabel is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException - { - updateBinaryStream (findColumn (columnLabel), x); - } - - - //@pda jdbc40 - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBlob which takes a length parameter. - * - * @param columnIndex - * @param inputStream An object that contains the data to set the parameter - * value to. - * @exception SQLException if the columnIndex is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException - { - updateValue (columnIndex, - (inputStream == null) ? null : JDUtilities.streamToBytes (inputStream), null, -1); - } - - - //@pda jdbc40 - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBlob which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param inputStream An object that contains the data to set the parameter - * value to. - * @exception SQLException if the columnLabel is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException - { - updateBlob (findColumn (columnLabel), inputStream); - } - - - //@pda jdbc40 - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateCharacterStream which takes a length parameter. - * - * @param columnIndex - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateCharacterStream(int columnIndex, Reader x) throws SQLException - { - updateValue (columnIndex, - (x == null) ? null : JDUtilities.readerToString(x), null, -1); - } - - - //@pda jdbc40 - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateCharacterStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @exception SQLException if the columnLabel is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException - { - updateCharacterStream (findColumn (columnLabel), reader); - } - - - //@pda jdbc40 - /** - * Updates the designated column using the given Reader - * object. - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateClob which takes a length parameter. - * - * @param columnIndex - * @param reader An object that contains the data to set the parameter value to. - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateClob(int columnIndex, Reader reader) throws SQLException - { - updateValue (columnIndex, - (reader == null) ? null : JDUtilities.readerToString(reader), null, -1); - } - - - //@pda jdbc40 - /** - * Updates the designated column using the given Reader - * object. - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateClob which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @exception SQLException if the columnLabel is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateClob(String columnLabel, Reader reader) throws SQLException - { - updateClob (findColumn (columnLabel), reader); - } - - - //@pda jdbc40 - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNCharacterStream which takes a length parameter. - * - * @param columnIndex - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException - { - updateValue (columnIndex, - (x == null) ? null : JDUtilities.readerToString(x), null, -1); - } - - - //@pda jdbc40 - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNCharacterStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @exception SQLException if the columnLabel is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException - { - updateNCharacterStream(findColumn (columnLabel), reader); - } - - - - //@pda jdbc40 - /** - * Updates the designated column using the given Reader - * - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNClob which takes a length parameter. - * - * @param columnIndex - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if the columnIndex is not valid; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob(int columnIndex, Reader reader) throws SQLException - { - updateValue (columnIndex, - (reader == null) ? null : JDUtilities.readerToString(reader), null, -1); - } - - - //@pda jdbc40 - /** - * Updates the designated column using the given Reader - * object. - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNClob which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if the columnLabel is not valid; if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set; - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob(String columnLabel, Reader reader) throws SQLException - { - updateNClob (findColumn (columnLabel), reader); - } - - - - - //@EIA new method - /** - Updates a column for the specified index, and performs all - appropriate validation. - - Note: this is the same type of method as updateValue() above, but we - have no way to pass in the special values without hacking some sort - of flag string for the value, and that seemed to be a messy and slow - way to do this. - - @param columnIndex The column index (1-based). - @param columnValue The parameter 1="default" or 2="unassigned". - - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - private void updateValueExtendedIndicator (int columnIndex, int columnValue) - throws SQLException - { - synchronized(internalLock_) - { - beforeUpdate (); - - // Check that there is a current row. - if((positionValid_ == false) && (positionInsert_ == false)) - JDError.throwSQLException (JDError.EXC_CURSOR_POSITION_INVALID); - - // Validate The column index. - if((columnIndex < 1) || (columnIndex > columnCount_)) - JDError.throwSQLException (JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Set the update value. If there is a type mismatch, - // set() with throw an exception. - - int columnIndex0 = columnIndex - 1; - - updateNulls_[columnIndex0] = false; - updateDefaults_[columnIndex0] = columnValue == 1 ? true: false; - updateUnassigned_[columnIndex0] = columnValue == 2 ? true: false; - updateSet_[columnIndex0] = true; - - - } - } - - - -} - - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCResultSetMetaData.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCResultSetMetaData.java deleted file mode 100644 index d2814fe6f..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCResultSetMetaData.java +++ /dev/null @@ -1,603 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCResultSetMetaData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.Connection; -/* ifdef JDBC40 */ -import java.sql.DatabaseMetaData; -/* endif */ -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.Statement; -/* endif */ - - -/** -

The AS400JDBCResultSetMetaData class describes the -columns in a result set. -**/ -// -// Implementation notes: -// -// * I lifted the restriction that a result set be open when -// using this object, specifically so it could be used after -// preparing but before executing (via PreparedStatement.getMetaData()). -// -// * I also removed the reference to the result set as private -// data. This is again because of the need to create this object -// before executing a query (via PreparedStatement.getMetaData()). -// -public class AS400JDBCResultSetMetaData -/* ifdef JDBC40 */ -extends ToolboxWrapper -/* endif */ -implements ResultSetMetaData -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - // Private static final ints - // Searchable constants - //@G1A @G2C - static final int SQL_UNSEARCHABLE = 0xF0; // isSearchable = false - static final int SQL_LIKE_ONLY = 0xF1; // will not be returned by our IBM i system - static final int SQL_ALL_EXCEPT_LIKE = 0xF2; // isSearchable = true - static final int SQL_SEARCHABLE = 0xF3; // isSearchable = true - - // Updateable constants - //@G1A @G2C - static final int SQL_READ_ONLY = 0xF0; // isReadOnly = true, isWriteable = false - static final int SQL_WRITE_CAPABLE = 0xF1; // isReadOnly = false, isWriteable = true - static final int SQL_READ_WRITE_UNKNOWN = 0xF2; // will not be returned by our IBM i system - - // Private data. - private String catalog_; - private int concurrency_; - private String cursorName_; - private JDRow row_; - private DBExtendedColumnDescriptors extendedColumnDescriptors_; //@G1A - private ConvTable convTable_; //@G1A - private Connection con_; //@in1 - - /** - Constructs an AS400JDBCResultSetMetaData object. - @param catalog The catalog. - @param concurrency The result set concurrency. - @param cursorName The cursor name. - @param row The row. - @param extendedColumnDescriptors The extended column descriptors. - @param convTable The converter table to use to convert column descriptors. - **/ - AS400JDBCResultSetMetaData(String catalog, - int concurrency, - String cursorName, - JDRow row, - DBExtendedColumnDescriptors extendedColumnDescriptors, //@G1A - ConvTable convTable, //@G1A - Connection con) //@in1 - { - catalog_ = catalog; - concurrency_ = concurrency; - cursorName_ = cursorName; - row_ = row; - extendedColumnDescriptors_ = extendedColumnDescriptors; //@G1A - convTable_ = convTable; //@G1A - con_ = con; //@in1 - } - - /** - Throws an exception if the specified column index is not - valid. - @param columnIndex The column index (1-based). - @exception SQLException If the column index is not valid. - **/ - private void checkIndex(int columnIndex) - throws SQLException - { - // Validate the column index. - if((columnIndex < 1) || (columnIndex > row_.getFieldCount())) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - - /** - Returns the catalog name of the table for a column. - @param columnIndex The column index (1-based). - @return The catalog name. - @exception SQLException If the column index is not valid. - **/ - public String getCatalogName(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return catalog_; - } - - // JDBC 2.0 - /** - Returns the name of a Java class whose instances are - created if ResultSet.getObject() is called to retrieve - from the column. The actual class created may be a subclass - of the returned class. - @param columnIndex The column index (1-based). - @return The class name. - @exception SQLException If the column index is not valid. - **/ - // - // Implementation note: - // - // * In the case where the column returns a byte array, this - // returns "[B". See the javadoc for java.lang.Class.getName() - // for the reason why. The JDBC 2.0 specification does not - // really go into detail, so it is unclear if this is okay - // to return. I will assume so in the mean time. - // - public String getColumnClassName(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - SQLData sqlData = row_.getSQLType(columnIndex); - String className = sqlData.getObject().getClass().getName(); - return className; - } - - /** - Returns the number of columns in the result set. - @return The number of columns. - @exception SQLException If an error occurs. - **/ - public int getColumnCount() - throws SQLException - { - return row_.getFieldCount(); - } - - /** - Returns the normal maximum width of a column. - @param columnIndex The column index (1-based). - @return The normal maximum width - (in characters). - @exception SQLException If the column index is not valid. - **/ - public int getColumnDisplaySize(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return row_.getSQLType(columnIndex).getDisplaySize(); - } - - /** - Returns the suggested label for use in printouts - or displays for a column. - @param columnIndex The column index (1-based). - @return The column label if the user set the - driver property "extended metadata" to true and - the system returns us a column label, - otherwise the column name. - @exception SQLException If the column index is not valid. - **/ - // - // Implementation note: - // - // For now, this is the same as the field name. In - // order to get the field label, we would have to make - // an extra request to the ROI server and perform a lot - // of extra processing. This performance hit is not - // worth it. If the caller really needs the label, then - // they can use DatabaseMetaData.getColumns. - // - // As of mod5 of Toolbox, we can use extended column descriptors - // (if the user asked for the by setting the "extended metadata" property - // to true) which will flow back to us without an extra call to the ROI server. - // - public String getColumnLabel(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - // @G1A If we have column descriptors, use them to get the column label. //@G1A - if(extendedColumnDescriptors_ != null) //@G1A - { - //@G1A - DBColumnDescriptorsDataFormat dataFormat = extendedColumnDescriptors_.getColumnDescriptors(columnIndex, convTable_); //@KBA // Fix for JTOpen Bug 4034 The ccsid for the column may be 65535, if that is the case, we want to use the job's ccsid - if(dataFormat != null) //@KBA The data format returned by the host server will be null for columns created by expressions, use old way - { //@D9A - String columnLabel = dataFormat.getColumnLabel(convTable_); //@D9A - if(columnLabel != null) //@D9A - return columnLabel; //@D9A - //@D9D return dataFormat.getColumnLabel(convTable_); //@KBA - //@KBD return extendedColumnDescriptors_.getColumnDescriptors(columnIndex).getColumnLabel(convTable_); //@G1A - } - } //@G1A - - //else use the "old way". - return row_.getFieldName(columnIndex); - } - - /** - Returns the name of a column. - @param columnIndex The column index (1-based). - @return The column name. - @exception SQLException If the column index is not valid. - **/ - public String getColumnName(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return row_.getFieldName(columnIndex); - } - - /** - Returns the type of a column. If the type is a distinct type, - this returns the underlying type. - @param columnIndex The column index (1-based). - @return The SQL type code defined in java.sql.Types. - @exception SQLException If the column index is not valid. - **/ - public int getColumnType(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return row_.getSQLType(columnIndex).getType(); - } - - /** - Returns the type name of a column. If the type is a distinct - type, this returns the underlying type name. - @param columnIndex The column index (1-based). - @return The column type name. - @exception SQLException If the column index is not valid. - **/ - public String getColumnTypeName(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return row_.getSQLType(columnIndex).getTypeName(); - } - - /** - Returns the precision of a column. This is the number - of decimal digits the column may hold. - @param columnIndex The column index (1-based). - @return The precision. - @exception SQLException If the column index is not valid. - **/ - public int getPrecision(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return row_.getSQLType(columnIndex).getPrecision(); - } - - /** - Returns the scale of a column. This is number of digits - to the right of the decimal point. - @param columnIndex The column index (1-based). - @return The scale. - @exception SQLException If the column index is not valid. - **/ - public int getScale(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return row_.getSQLType(columnIndex).getScale(); - } - - /** - Returns the schema name of the table for a column. - This method is supported only if the user has set the - driver property "extended metadata" to true. - @param columnIndex The column index (1-based). - @return The schema name if the user set the - driver property "extended metadata" to true and - the system returns us a schema name, - otherwise "". - @exception SQLException If the column index is not valid. - **/ - public String getSchemaName(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - - // @G1A If we have column descriptors, use them to get the schema name. //@G1A - if(extendedColumnDescriptors_ != null) //@G1A - { - //@G1A - DBColumnDescriptorsDataFormat dataFormat = extendedColumnDescriptors_.getColumnDescriptors(columnIndex, convTable_); //@KBA //@ss1 - if(dataFormat != null) //@KBA Depending on the query, dataFormat returned by the host server may be null. For example, if a union was used or an expression - return dataFormat.getBaseTableSchemaName(convTable_); //@G1A - } //@G1A - - //else return "" - return ""; - } - - /** - Returns the column's table name. - This method is supported only if the user has set the - driver property "extended metadata" to true. - @param columnIndex The column index (1-based). - @return The base table name if the user set the - driver property "extended metadata" to true and - the system returns us a table name, - otherwise "". - @exception SQLException If the column index is not valid. - **/ - public String getTableName(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - - // Changed to get the Base Table Name for a column if the extended metadata property is true - // because we already have the information, we should return it to the user if they want it... - if(extendedColumnDescriptors_ != null) - { - DBColumnDescriptorsDataFormat dataFormat = extendedColumnDescriptors_.getColumnDescriptors(columnIndex, convTable_); //@KBA //@ss1 - if(dataFormat != null) //@KBA Depending on the query, dataFormat returned by the host server may be null. For example, if a union was used or an expression - return dataFormat.getBaseTableName(convTable_); //@KBA - //@KBD return extendedColumnDescriptors_.getColumnDescriptors(columnIndex).getBaseTableName(convTable_); //K1C use to call getBaseTableSchemaName - } - - // we still return "" if we don't have the Base Table Name - return ""; - } - - /** - Indicates if the column is automatically numbered. - @param columnIndex The column index (1-based). - @return True if column is autoincrement, false otherwise. - @exception SQLException If the column index is not valid. - Note: connection property "extended metadata" must be true for this method to be return accurate information. - If the "extended metadata" connection property is not set to true, then this method will always return false. - **/ - public boolean isAutoIncrement(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - - // Only run the query to get the information if the table name can be found. The table name - // can only be found if "extended metadata" == true - // @A9A - - String tableName = this.getTableName(columnIndex); - if ((tableName == null) || (tableName.length() == 0) ) { - return false; - } - - //return false; //@in1 add implementation instead of always returning false - - PreparedStatement ps = null; - ResultSet rs = null; - try - { - ps = con_.prepareStatement("SELECT identity_generation " + - "FROM QSYS2" + getCatalogSeparator() + "SYSCOLUMNS" + - " WHERE identity_generation is not null" + - " AND column_name = ?" + - " AND table_name = ?" + - " AND table_schema = ?"); - ps.setString(1, this.getColumnName(columnIndex)); - ps.setString(2, tableName); - ps.setString(3, this.getSchemaName(columnIndex)); - - rs = ps.executeQuery(); - if ( rs.next()) - return true; - else - return false; - - } - catch (SQLException e) - { - throw e; - } - finally - { - try{ - if(rs != null) - rs.close(); - }catch(Exception e){} //allow next close to execute - if(ps != null) - ps.close(); - } - } - - /** - Indicates if the column is case sensitive. - @param columnIndex The column index (1-based). - @return true if the column is case sensitive; - false otherwise. - @exception SQLException If the column index is not valid. - **/ - public boolean isCaseSensitive(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - - // In DB2 for IBM i, all text types - // are case sensitive. - return row_.getSQLType(columnIndex).isText(); - } - - /** - Indicates if the column is a currency value. - @param columnIndex The column index (1-based). - @return Always false. DB2 for IBM i - does not directly support currency - values. - @exception SQLException If the column index is not valid. - **/ - public boolean isCurrency(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return false; - } - - /** - Indicates if a write on the column will definitely succeed. - @param columnIndex The column index (1-based). - @return Always false. The driver does - not check if the user has the - necessary authority to write to - the column. - @exception SQLException If the column index is not valid. - **/ - public boolean isDefinitelyWritable(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return false; - } - - /** - Indicates if the column can contain an SQL NULL value. - @param columnIndex The column index (1-based). - @return true if the column is can contain - an SQL NULL value; false otherwise. - @exception SQLException If the column index is not valid. - **/ - public int isNullable(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return row_.isNullable(columnIndex); - } - - /** - Indicates if the column is read-only. - @param columnIndex The column index (1-based). - @return true if the column is read-only; - false otherwise. - @exception SQLException If the column index is not valid. - **/ - public boolean isReadOnly(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - - // @G1A If we have column descriptors, use them to get searchable label. //@G1A - if(extendedColumnDescriptors_ != null)// && concurrency_ != ResultSet.CONCUR_READ_ONLY) //@G1A @G3C @36072 - { - //@G1A - if(extendedColumnDescriptors_.getUpdateable(columnIndex) == (byte)SQL_READ_ONLY) //@G1A @G2C - return true; //@G1A - else //@G1A - return false; //@G1A - } //@G1A - - // else use "old" way - return(concurrency_ == ResultSet.CONCUR_READ_ONLY); - } - - /** - Indicates if the column be used in a where clause. - @param columnIndex The column index (1-based). - @return If the user has set the "extended metadata" driver property to true, - returns true if the column can be used in a where clause - with any comparison operator except LIKE, returns - false if the column cannot be used in a where clause. - If the "extended metadata" driver property is set to false, - true will always be returned. - @exception SQLException If the column index is not valid. - **/ - public boolean isSearchable(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - // @G1A If we have column descriptors, use them to get searchable label. //@G1A - if(extendedColumnDescriptors_ != null) //@G1A - { - //@G1A - if(extendedColumnDescriptors_.getSearchable(columnIndex) == (byte)SQL_UNSEARCHABLE) //@G1A @G2C - return false; //@G1A - else //@G1A - return true; //@G1A - } //@G1A - - // Else, return true - return true; - } - - /** - Indicates if the column can contain a signed value. - @param columnIndex The column index (1-based). - @return true if the column is signed; - false otherwise. - @exception SQLException If the column index is not valid. - **/ - public boolean isSigned(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return(row_.getSQLType(columnIndex).isSigned()); - } - - /** - Indicates if it is possible for a write on the column to succeed. - The write may fail even if this method returns true. - The accuracy of this method will be improved if the "extended metadata" - property is set to true. - @param columnIndex The column index (1-based). - @return true if it is possible for a write on - the column to succeed; false otherwise. - @exception SQLException If the column index is not valid. - **/ - public boolean isWritable(int columnIndex) - throws SQLException - { - //@G1D checkIndex (columnIndex); - //@G1D return(concurrency_ != ResultSet.CONCUR_READ_ONLY); - return !isReadOnly(columnIndex); //@G1A - } - - /** - Returns the name of the SQL cursor in use by this result set. - @return The cursor name. - **/ - public String toString() - { - return cursorName_; - } - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCResultSetMetaData", "java.sql.ResultSetMetaData" }; - } - - //@in1 (copied from AS400JDBCDatabaseMetadata) - /** - Returns the naming convention used when referring to tables. - This depends on the naming convention specified in the connection - properties. - - @return If using SQL naming convention, "." is returned. If - using system naming convention, "/" is returned. - - @exception SQLException This exception is never thrown. - **/ - private String getCatalogSeparator () - throws SQLException - { - String catalogSeparator; - if (((AS400JDBCConnection)con_).getProperties().equals (JDProperties.NAMING, JDProperties.NAMING_SQL)) - catalogSeparator = "."; - else - catalogSeparator = "/"; - - return catalogSeparator; - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCRowId.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCRowId.java deleted file mode 100644 index 432f4074f..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCRowId.java +++ /dev/null @@ -1,156 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCRowId.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/* ifdef JDBC40 */ -import java.sql.RowId; -/* endif */ - -//@PDA jdbc40 new class -public class AS400JDBCRowId -/* ifdef JDBC40 */ -implements RowId -/* endif */ -{ - - private byte[] data_; - //put byteToHex conversion here in case BinaryConverter is not in jar. - private static final char[] c_ = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; - - - /** - * Constructs an AS400JDBCRowId object. The data is contained - * in the raw byte array. No further communication with the IBM i system - * is necessary. - * - * @param data The RowId data. - **/ - AS400JDBCRowId(byte[] data) - { - data_ = data; - } - - /** - * Compares this RowId to the specified object. The result is - * true if and only if the argument is not null and is a RowId - * object that represents the same ROWID as this object. - *

- * It is important - * to consider both the origin and the valid lifetime of a RowId - * when comparing it to another RowId. If both are valid, and - * both are from the same table on the same data source, then if they are equal - * they identify - * the same row; if one or more is no longer guaranteed to be valid, or if - * they originate from different data sources, or different tables on the - * same data source, they may be equal but still - * not identify the same row. - * - * @param obj the Object to compare this RowId object - * against. - * @return true if the RowIds are equal; false otherwise - */ -/* ifdef JDBC40 */ - public boolean equals(Object obj) - { - if (!(obj instanceof RowId)) - { - return false; - } - - byte[] otherBytes = ((RowId) obj).getBytes(); - if (data_.length != otherBytes.length) - return false; - - for (int i = 0; i < data_.length; i++) - { - if (data_[i] != otherBytes[i]) - return false; - } - return true; - } -/* endif */ - - /** - * Returns an array of bytes representing the value of the SQL ROWID - * designated by this java.sql.RowId object. - * - * @return an array of bytes, whose length is determined by the driver supplying - * the connection, representing the value of the ROWID designated by this - * java.sql.RowId object. - */ - public byte[] getBytes() - { - return data_; - } - - /** - * Returns a String representing the value of the SQL ROWID designated by this - * java.sql.RowId object. - *

- * Like java.sql.Date.toString() - * returns the contents of its DATE as the String "2004-03-17" - * rather than as DATE literal in SQL (which would have been the String - * DATE "2004-03-17"), toString() - * returns the contents of its ROWID in a form specific to the driver supplying - * the connection, and possibly not as a ROWID literal. - * Toolbox converts RowId bytes to HEX string format. - * - * @return a String whose format is determined by the driver supplying the - * connection, representing the value of the ROWID designated - * by this java.sql.RowId object. - */ - public String toString() - { - return bytesToString(data_); - } - - - static final String bytesToString(final byte[] b) - { - return bytesToString(b, 0, b.length); - } - - static final String bytesToString(final byte[] b, int offset, int length) - { - char[] c = new char[length*2]; - int num = bytesToString(b, offset, length, c, 0); - return new String(c, 0, num); - } - - - static final int bytesToString(final byte[] b, int offset, int length, final char[] c, int coffset) - { - for(int i=0; i>>4) & 0x0F); - final byte lo = (byte)((b[i+offset] & 0x0F)); - c[j+coffset] = c_[hi]; - c[j+coffset+1] = c_[lo]; - } - return length*2; - } - - - /** - * Returns a hash code value of this RowId object. - * - * @return a hash code for the RowId - */ - public int hashCode() - { - //for now, use String's implementation. seems good enough. - return this.toString().hashCode(); - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCRowSet.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCRowSet.java deleted file mode 100644 index 43f53b5a3..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCRowSet.java +++ /dev/null @@ -1,7380 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCRowSet.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import javax.sql.DataSource; -import javax.sql.RowSet; -import javax.sql.RowSetEvent; -import javax.sql.RowSetListener; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.math.BigDecimal; -import java.net.URL; //@G4A JDBC 3.0 -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Connection; -import java.sql.Date; -import java.sql.DriverManager; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.PreparedStatement; -/* endif */ - -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -/* ifdef JDBC40 */ -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -import java.sql.SQLWarning; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Statement; -import java.sql.Time; -import java.sql.Timestamp; -import java.sql.Types; -import java.util.Calendar; -import java.util.Hashtable; //@A2A -import java.util.Map; - -/** -* The AS400JDBCRowSet class represents a connected rowset that encapsulates an JDBC result set. -* The database connection is maintained while in use. -*

-* Either the url or dataSourceName property must be set to specify how the database connection -* is established. The command property must be set to specify how to create the PreparedStatement. -* -*

This example creates an AS400JDBCRowSet object, populates it, and then updates its contents. -*

-* DriverManager.registerDriver(new AS400JDBCDriver()); -* AS400JDBCRowSet rowset = new AS400JDBCRowSet("jdbc:as400://mySystem","myUser", "myPassword"); -* -* // Set the command used to populate the list. -* rowset.setCommand("SELECT * FROM MYLIB.DATABASE"); -* -* // Populate the rowset. -* rowset.execute(); -* -* // Update the customer balances. -* while (rowset.next()) -* { -* double newBalance = rowset.getDouble("BALANCE") + july_statements.getPurchases(rowset.getString("CUSTNUM")); -* rowset.updateDouble("BALANCE", newBalance); -* rowset.updateRow(); -* } -*
-* -*

This example creates an AS400JDBCRowSet object, sets the data source and command parameters and then -* populates it. -* -*

-* // Get the data source that is registered in JNDI (assumes JNDI environment is set). -* Context context = new InitialContext(); -* AS400JDBCDataSource dataSource = (AS400JDBCDataSource) context.lookup("jdbc/customer"); -* -* AS400JDBCRowSet rowset = new AS400JDBCRowSet(); -* rowset.setDataSourceName("jdbc/customer"); -* rowset.setUsername("myuser"); -* rowset.setPassword("myPasswd"); -* -* // Set the prepared statement and initialize the parameters. -* rowset.setCommand("SELECT * FROM MYLIBRARY.MYTABLE WHERE STATE = ? AND BALANCE > ?"); -* rowset.setString(1, "MINNESOTA"); -* rowset.setDouble(2, MAXIMUM_LIMIT); -* -* // Populate the rowset. -* rowset.execute(); -*
-* -*

AS400JDBCRowSet objects generate the following events: -*

    -*
  • RowSetEvent - The events fired are: -*
      -*
    • cursorMoved
    • -*
    • rowChanged
    • -*
    • rowSetChanged
    • -*
    -*
  • -*
-**/ -public class AS400JDBCRowSet -/* ifdef JDBC40 */ -extends ToolboxWrapper -/* endif */ -implements RowSet, Serializable // @A3C -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - - static final String className_ = "AS400JDBCRowSet"; - private String command_; // The command used to create the result set. - private String dataSourceName_; // The name of the data source. - private boolean useDataSource_ = true; // Whether the dataSource specified is used. - private String url_; // The user defined URL used to make the connection. - private String username_; // The user name used to make the connection. - private String password_; // The password used to make the connection. - - // Toolbox classes. - private Connection connection_; // The JDBC connection. - private DataSource dataSource_; // The dataSource used to make the connection. - private AS400JDBCPreparedStatement statement_; // The prepared statement. //@pdc jdbc40 - private transient AS400JDBCResultSet resultSet_; // The result set. @G4C //@scan1 - private transient AS400JDBCRowSetEventSupport eventSupport_; // RowSetListener support. @A3C - private Context context_ = null; //@A1A // The JNDI naming context which specifies how naming - // and directory services are accessed. - private Hashtable environment_ = null; //@A2A // The jndi environment properties. - - // Connection properties. - private boolean isReadOnly_ = false; - private int transactionIsolation_ = Connection.TRANSACTION_READ_UNCOMMITTED; - private Map typeMap_; - - // Statement properties. - private boolean createNewStatement_ = true; - private int concurrency_ = ResultSet.CONCUR_READ_ONLY; - private boolean escapeProcessing_ = true; - private int type_ = ResultSet.TYPE_FORWARD_ONLY; - - private transient PropertyChangeSupport changes_; // @A3C - - /** - * Constructs a default AS400JDBCRowSet object. - **/ - public AS400JDBCRowSet() - { - // @A3D eventSupport_ = new AS400JDBCRowSetEventSupport(); - initializeTransient(); // @A3A - } - - /** - * Constructs an AS400JDBCRowset with the specified dataSourceName. - * @param dataSourceName The name of the data source used to make the connection. - **/ - public AS400JDBCRowSet(String dataSourceName) - { - this(); - setDataSourceName(dataSourceName); - } - - /** - * Constructs an AS400JDBCRowSet with the specified parameters. - * @param url The url used to make the connection. - * @param username The user name. - * @param password The password. - **/ - public AS400JDBCRowSet(String url, String username, String password) - { - this(); - setUrl(url); - setUsername(username); - setPassword(password); - } - - /** - * Positions the cursor to an absolute row number. - * - *

Attempting to move beyond the first row positions the - * cursor before the first row. Attempting to move beyond the last - * row positions the cursor after the last row. - * - *

If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @param rowNumber The absolute row number (1-based). If the absolute row - * number is positive, this positions the cursor - * with respect to the beginning of the result set. - * If the absolute row number is negative, this - * positions the cursor with respect to the end - * of result set. - * @return true if the requested cursor position is - * valid; false otherwise. - * - * @exception SQLException If the result set is not open, - * the result set is not scrollable, - * the row number is 0, - * or an error occurs. - */ - public boolean absolute (int rowNumber) throws SQLException - { - validateResultSet(); - boolean status = resultSet_.absolute(rowNumber); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - return status; - } - - /** - * Adds a PropertyChangeListener. - * @param listener The PropertyChangeListener. - * @see #removePropertyChangeListener - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - changes_.addPropertyChangeListener(listener); - } - - /** - * Adds a RowSetListener to the list. - * @param listener The RowSetListener object. - **/ - public void addRowSetListener(RowSetListener listener) - { - eventSupport_.addRowSetListener(listener); - } - - /** - * Positions the cursor after the last row. - * If an InputStream from the current row is open, it is implicitly closed. - * In addition, all warnings and pending updates are cleared. - * - * @exception SQLException If the result set is not open, the result set is not scrollable, or an error occurs. - **/ - public void afterLast () throws SQLException - { - validateResultSet(); - resultSet_.afterLast(); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - } - - /** - * Positions the cursor before the first row. - * If an InputStream from the current row is open, it is implicitly closed. - * In addition, all warnings and pending updates are cleared. - * - * @exception SQLException If the result set is not open, the result set is not scrollable, or an error occurs. - **/ - public void beforeFirst () throws SQLException - { - validateResultSet(); - resultSet_.beforeFirst(); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - } - - - /** - * Cancels all pending updates that have been made since the last - * call to updateRow(). If no updates have been made or updateRow() - * has already been called, then this method has no effect. - * - * @exception SQLException If the result set is not open - * or the result set is not updatable. - **/ - public void cancelRowUpdates () throws SQLException - { - validateResultSet(); - resultSet_.cancelRowUpdates(); - } - - /** - * Clears the columns for the current row and releases all associated resources. - * @exception SQLException If a database error occurs. - **/ - public void clearParameters() throws SQLException - { - if (statement_ != null) - statement_.clearParameters(); - } - - /** - * Clears all warnings that have been reported for the result set. - * After this call, getWarnings() returns null until a new warning - * is reported for the result set. - * - * @exception SQLException If an error occurs. - **/ - public void clearWarnings () throws SQLException - { - validateResultSet(); - resultSet_.clearWarnings(); - } - - /** - * Releases the rowset resources immediately instead of waiting for them to be automatically released. - * This closes the connection to the database. - * - * @exception SQLException If an error occurs. - **/ - public void close () throws SQLException - { - - // @D4 change -- don't throw exceptions. Instead, catch and log them. The - // user called close so we won't return until we tried to close all - // resources. - try - { // @J4a // @J4a - if (resultSet_ != null) - resultSet_.close(); - } // @J4a - catch (SQLException e) // @J4a - { // @J4a - if (JDTrace.isTraceOn()) // @J4a - JDTrace.logInformation (this, "Closing result set while closing the row set failed: " + e.getMessage()); // @j4a - } // @J4a - - - - try - { // @J4a // @J4a - if (statement_ != null) - statement_.close(); - } // @J4a - catch (SQLException e) // @J4a - { // @J4a - if (JDTrace.isTraceOn()) // @J4a - JDTrace.logInformation (this, "Closing statement set while closing the row set failed: " + e.getMessage()); // @j4a - } // @J4a - - - - if (connection_ != null) - connection_.close(); - } - - - - /** - * Connects to the database. - * @exception SQLException If database errors creating the connection. - **/ - private void connect() throws SQLException - { - if (JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "connect()"); - - if (isUseDataSource()) - { - if (JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "using JDBC DataSource"); - - if (dataSourceName_ == null) - throw new ExtendedIllegalStateException("dataSourceName", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - try - { - if (context_ == null) //@A1A - { - if (environment_ == null) //@A2A - context_ = new InitialContext(); //@A1C - else //@A2A - context_ = new InitialContext(environment_); //@A2A - } - dataSource_ = (AS400JDBCDataSource)context_.lookup(dataSourceName_); - } - catch (NamingException ne) - { - if (JDTrace.isTraceOn ()) - { - JDTrace.logInformation(this, "Cannot find JNDI data source."); - ne.printStackTrace(DriverManager.getLogWriter()); - } - throw new ExtendedIllegalStateException("dataSourceName", ExtendedIllegalStateException.OBJECT_CANNOT_BE_FOUND); //@A2C - } - connection_ = (AS400JDBCConnection)dataSource_.getConnection(username_, password_); - } - else - { // Use the url to make the connection. - if (JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "using JDBC url"); - - if (url_ == null) - throw new ExtendedIllegalStateException("url", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - if (username_ != null && password_ != null) - connection_ = DriverManager.getConnection(url_, username_, password_); - else - connection_ = DriverManager.getConnection(url_); - } - - // Set the connection properties. - connection_.setReadOnly(isReadOnly_); - if (transactionIsolation_ != Connection.TRANSACTION_READ_UNCOMMITTED) - connection_.setTransactionIsolation(transactionIsolation_); - } - - /** - * Creates a statement. - * @exception SQLException If a database error occurs creating the statement. - **/ - private void createStatement() throws SQLException - { - if (JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "createStatement()"); - - if (command_ == null) - throw new ExtendedIllegalStateException("command", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - if (connection_ == null) - connect(); - - // set the parameters. - int fetchDirection=0, fetchSize=0, maxFieldSize=0, maxRows=0, queryTimeout=0; - boolean setParameters = false; - if (statement_ != null) - { - fetchDirection = statement_.getFetchDirection(); - fetchSize = statement_.getFetchSize(); - maxFieldSize = statement_.getMaxFieldSize(); - maxRows = statement_.getMaxRows(); - queryTimeout = statement_.getQueryTimeout(); - setParameters = true; - } - statement_ = (AS400JDBCPreparedStatement)connection_.prepareStatement(command_, type_, concurrency_); //@PDC jdbc40 - - if (setParameters) - { - statement_.setFetchDirection(fetchDirection); - statement_.setFetchSize(fetchSize); - statement_.setMaxFieldSize(maxFieldSize); - statement_.setMaxRows(maxRows); - statement_.setQueryTimeout(queryTimeout); - } - createNewStatement_ = false; - } - - /** - * Deletes the current row from the result set and the database. - * After deleting a row, the cursor position is no longer valid, - * so it must be explicitly repositioned. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the cursor is positioned on the insert row, - * or an error occurs. - **/ - public void deleteRow () throws SQLException - { - validateResultSet(); - resultSet_.deleteRow(); - } - - /** - * Executes the command and fills the rowset with data. Any previous contents are erased. - * - * The following properties may be used to create a connection for reading data: - *

    - *
  • dataSource (Required if isUseDataSource = true) - *
  • url (Required if isUseDataSource = false) - *
  • user name
  • password
  • transaction isolation
  • type map - *
- * The following properties may be used to create a statement to execute a command: - *
    - *
  • command (Required) - *
  • read only
  • maximum field size
  • maximum rows
  • escape processing
  • query timeout - *
- * - * @exception SQLException If a database error occurs. - **/ - public void execute() throws SQLException - { - if (JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "execute()"); - - if (createNewStatement_) - createStatement(); - - if (command_.toUpperCase().indexOf("SELECT") != -1) // Fix for JTOpen Bug 4121 - { - resultSet_ = (AS400JDBCResultSet)statement_.executeQuery(); //@G4C - - // Notify the listeners. - eventSupport_.fireRowSetChanged(new RowSetEvent(this)); - } - else - { - statement_.executeUpdate(); - } - - } - - /** - * Closes the Statement and Connection. - * @exception SQLException If a database error occurs. - **/ - protected void finalize() throws SQLException - { - try - { - close(); - } - catch (SQLException e) - { - JDError.throwSQLException (JDError.EXC_SERVER_ERROR); - } - } - - /** - * Returns the column index for the specified column name. - * - * @param columnName The column name. - * @return The column index (1-based). - * - * @exception SQLException If the result set is not open - * or the column name is not found. - **/ - public int findColumn (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.findColumn(columnName); - } - - /** - * Positions the cursor to the first row. - * If an InputStream from the current row is open, it is implicitly closed. - * In addition, all warnings and pending updates are cleared. - * - * @return true if the requested cursor position is valid; false otherwise. - * @exception SQLException If the result set is not open, the result set is not scrollable, or an error occurs. - **/ - public boolean first () throws SQLException - { - validateResultSet(); - boolean status = resultSet_.first(); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - return status; - } - - - /** - * Returns the value of a column as an Array object. - * DB2 for IBM i does not support arrays. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - **/ - public Array getArray (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getArray(columnIndex); - } - - /** - * Returns the value of a column as an Array object. - * DB2 for IBM i does not support arrays. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - **/ - public Array getArray (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getArray(columnName); - } - - /** - * Returns the value of a column as a stream of ASCII - * characters. This can be used to get values from columns - * with SQL types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and - * BLOB. All of the data in the returned stream must be read - * prior to getting the value of any other column. The next - * call to a get method implicitly closes the stream. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, - * or the requested conversion is not valid. - **/ - public InputStream getAsciiStream (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getAsciiStream(columnIndex); - } - - /** - * Returns the value of a column as a stream of ASCII - * characters. This can be used to get values from columns - * with SQL types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and - * BLOB. All of the data in the returned stream must be read - * prior to getting the value of any other column. The next - * call to a get method implicitly closes the stream. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public InputStream getAsciiStream (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getAsciiStream(columnName); - } - - /** - * Returns the value of a column as a BigDecimal object. This - * can be used to get values from columns with SQL types - * SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, - * or the requested conversion is not valid. - **/ - public BigDecimal getBigDecimal (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getBigDecimal(columnIndex); - } - - /** - * Returns the value of a column as a BigDecimal object. This - * can be used to get values from columns with SQL types - * SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, - * or the requested conversion is not valid. - **/ - public BigDecimal getBigDecimal (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getBigDecimal(columnName); - } - - /** - * Returns the value of a column as a BigDecimal object. This - * can be used to get values from columns with SQL types - * SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @param scale The number of digits after the decimal. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, - * the scale is not valid, or the - * requested conversion is not valid. - * - * @deprecated Use getBigDecimal(int) instead. - * @see #getBigDecimal(int) - **/ - public BigDecimal getBigDecimal (int columnIndex, int scale) throws SQLException - { - validateResultSet(); - return resultSet_.getBigDecimal(columnIndex, scale); - } - - /** - * Returns the value of a column as a BigDecimal object. This - * can be used to get values from columns with SQL types - * SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @param scale The number of digits after the decimal. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, - * the scale is not valid, or the - * requested conversion is not valid. - * - * @deprecated Use getBigDecimal(String) instead. - * @see #getBigDecimal(String) - **/ - public BigDecimal getBigDecimal (String columnName, int scale) throws SQLException - { - validateResultSet(); - return resultSet_.getBigDecimal(columnName, scale); - } - - /** - * Returns the value of a column as a stream of uninterpreted - * bytes. This can be used to get values from columns - * with SQL types BINARY, VARBINARY, and BLOB. All of the data in - * the returned stream must be read prior to getting the - * value of any other column. The next call to a get method - * implicitly closes the stream. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public InputStream getBinaryStream (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getBinaryStream(columnIndex); - } - - /** - * Returns the value of a column as a stream of uninterpreted - * bytes. This can be used to get values from columns - * with SQL types BINARY, VARBINARY, and BLOB. All of the data in - * the returned stream must be read prior to getting the - * value of any other column. The next call to a get method - * implicitly closes the stream. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public InputStream getBinaryStream (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getBinaryStream(columnName); - } - - - /** - * Returns the value of a column as a Blob object. - * This can be used to get values from columns with SQL - * types BINARY, VARBINARY, and BLOB. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public Blob getBlob (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getBlob(columnIndex); - } - - /** - * Returns the value of a column as a Blob object. - * This can be used to get values from columns with SQL - * types BINARY, VARBINARY, and BLOB. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public Blob getBlob (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getBlob(columnName); - } - - - /** - * Returns the value of a column as a Java boolean value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or false if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public boolean getBoolean (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getBoolean(columnIndex); - } - - /** - * Returns the value of a column as a Java boolean value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @return The column value or false if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public boolean getBoolean (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getBoolean(columnName); - } - - /** - * Returns the value of a column as a Java byte value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public byte getByte (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getByte(columnIndex); - } - - - /** - * Returns the value of a column as a Java byte value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public byte getByte (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getByte(columnName); - } - - /** - * Returns the value of a column as a Java byte array. - * This can be used to get values from columns with SQL - * types BINARY and VARBINARY. - * - *

This can also be used to get values from columns - * with other types. The values are returned in their - * native IBM i format. This is not supported for - * result sets returned by a DatabaseMetaData object. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public byte[] getBytes (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getBytes(columnIndex); - } - - - - /** - * Returns the value of a column as a Java byte array. - * This can be used to get values from columns with SQL - * types BINARY and VARBINARY. - * - *

This can also be used to get values from columns - * with other types. The values are returned in their - * native IBM i format. This is not supported for - * result sets returned by a DatabaseMetaData object. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public byte[] getBytes (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getBytes(columnName); - } - - - /** - * Returns the value of a column as a character stream. - * This can be used to to get values from columns with SQL - * types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and BLOB. - * All of the data in the returned stream must be read prior to - * getting the value of any other column. The next call to a get - * method implicitly closes the stream. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - */ - public Reader getCharacterStream (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getCharacterStream(columnIndex); - } - - - /** - * Returns the value of a column as a character stream. - * This can be used to to get values from columns with SQL - * types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and BLOB. - * All of the data in the returned stream must be read prior - * to getting the value of any other column. The next call - * to a get method implicitly closes the stream. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not valid, or the - * requested conversion is not valid. - */ - public Reader getCharacterStream (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getCharacterStream(columnName); - } - - - /** - * Returns the value of a column as a Clob object. - * This can be used to get values from columns with SQL - * types CHAR, VARCHAR, BINARY, VARBINARY, BLOB, and CLOB. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public Clob getClob (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getClob(columnIndex); - } - - /** - * Returns the value of a column as a Clob object. - * This can be used to get values from columns with SQL - * types CHAR, VARCHAR, BINARY, VARBINARY, BLOB, and CLOB. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public Clob getClob (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getClob(columnName); - } - - /** - * Returns the command used by the statement the generate the rowset. - * This should be set before calling the execute method. - * @return The command. The default value is null. - **/ - public String getCommand() - { - return command_; - } - - /** - * Returns the result set concurrency. - * - * @return The result set concurrency. - * Valid values are: - *

    - *
  • ResultSet.CONCUR_READ_ONLY - *
  • ResultSet.CONCUR_UPDATABLE - *
- * @exception SQLException If the result set is not open. - **/ - public int getConcurrency () throws SQLException - { - if (resultSet_ != null) - concurrency_ = resultSet_.getConcurrency(); - return concurrency_; - } - - //@A1A - /** - * Returns the JNDI naming context which provides name-to-object bindings - * and methods for retrieving and updating naming and directory services. - * - * @return The context or null if the value has not been set. - * - **/ - public Context getContext () - { - return context_; - } - - /** - * Returns the name of the SQL cursor in use by the result set. - * In SQL, results are retrieved through a named cursor. The - * current row of a result can be updated or deleted using a - * positioned UPDATE or DELETE statement that references a cursor name. - * - * @return The cursor name. - * @exception SQLException If the result is not open. - **/ - public String getCursorName() throws SQLException - { - validateResultSet(); - return resultSet_.getCursorName(); - } - - /** - * Returns the name of the data source as identified in JNDI. - * @return The data source name. The default value is null. - **/ - public String getDataSourceName() - { - return dataSourceName_; - } - - /** - * Returns the value of a column as a java.sql.Date object using - * the default calendar. This can be used to get values from columns - * with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public Date getDate (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getDate(columnIndex); - } - - - - /** - * Returns the value of a column as a java.sql.Date object using - * the default calendar. This can be used to get values from columns - * with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public Date getDate (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getDate(columnName); - } - - - /** - * Returns the value of a column as a java.sql.Date object using - * a calendar other than the default. This can be used to get values - * from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - * - * @param columnIndex The column index (1-based). - * @param calendar The calendar. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, - * the calendar is null, or the - * requested conversion is not valid. - **/ - public Date getDate (int columnIndex, Calendar calendar) throws SQLException - { - validateResultSet(); - return resultSet_.getDate(columnIndex, calendar); - } - - - /** - * Returns the value of a column as a java.sql.Date object using - * a calendar other than the default. This can be used to get values - * from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - * - * @param columnName The column name. - * @param calendar The calendar. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, - * the calendar is null, or the - * requested conversion is not valid. - **/ - public Date getDate (String columnName, Calendar calendar) throws SQLException - { - validateResultSet(); - return resultSet_.getDate(columnName, calendar); - } - - - /** - * Returns the value of a column as a Java double value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public double getDouble (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getDouble(columnIndex); - } - - - /** - * Returns the value of a column as a Java double value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public double getDouble (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getDouble(columnName); - } - - - //@A2A - /** - * Returns a hashtable of standard JNDI environment properties. - * - * @return The environment properties or null if the value has not been set. - * - **/ - public Hashtable getEnvironment () - { - return environment_; - } - - /** - * Indicates if escape processing is enabled (default). - * If enabled, escape substitution is done before committing the data. - * @return true if enabled; false otherwise. - **/ - public boolean getEscapeProcessing() - { - return escapeProcessing_ ; - } - - /** - * Returns the fetch direction. - * - * @return The fetch direction. - * Valid values are: - *
    - *
  • ResultSet.FETCH_FORWARD (default) - *
  • ResultSet.FETCH_REVERSE - *
  • ResultSet.FETCH_UNKNOWN - *
- * - * @exception SQLException If the result is not open. - **/ - public int getFetchDirection() throws SQLException - { - if (resultSet_ != null) - return resultSet_.getFetchDirection(); - - if (statement_ == null) - return ResultSet.FETCH_FORWARD; - - return statement_.getFetchDirection(); - - } - - /** - * Returns the number of rows to be fetched from the database when more rows are needed. - * The number of rows specified only affects result sets created using this statement. - * If the value specified is zero, then the driver will choose an appropriate fetch size. - * - * This setting only affects statements that meet the criteria specified in the "block criteria" property. - * The fetch size is only used if the "block size" property is set to "0". - * - * @return The fetch size. - * @exception SQLException If the result is not open. - **/ - public int getFetchSize() throws SQLException - { - if (resultSet_ != null) - return resultSet_.getFetchSize(); - - if (statement_ == null) - return 0; - - return statement_.getFetchSize(); - } - - /** - * Returns the value of a column as a Java float value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public float getFloat (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getFloat(columnIndex); - } - - - /** - * Returns the value of a column as a Java float value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public float getFloat (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getFloat(columnName); - } - - /** - * Returns the value of a column as a Java int value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public int getInt (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getInt(columnIndex); - } - - - /** - * Returns the value of a column as a Java int value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public int getInt (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getInt(columnName); - } - - - /** - * Returns the value of a column as a Java long value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public long getLong (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getLong(columnIndex); - } - - - /** - * Returns the value of a column as a Java long value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public long getLong (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getLong(columnName); - } - - /** - * Returns the maximum column size. - * This property is only used with column types: - *
    - *
  • BINARY
  • VARBINARY
  • LONGVARBINARY
  • CHAR
  • VARCHAR
  • LONGVARCHAR - *
- * @return The maximum size. The default zero of zero indicates no maximum. - * @exception SQLException If a database error occurs. - **/ - public int getMaxFieldSize() throws SQLException - { - if (statement_ == null) - return 0; - return statement_.getMaxFieldSize(); - } - - /** - * Returns the maximum number of rows for the rowset. - * @return The maximum. The default value of zero indicates no maximum. - * @exception SQLException If a database error occurs. - **/ - public int getMaxRows() throws SQLException - { - if (statement_ == null) - return 0; - return statement_.getMaxRows(); - } - - /** - * Returns the ResultSetMetaData object that describes the - * result set's columns. - * - * @return The metadata object. - * @exception SQLException If an error occurs. - **/ - public ResultSetMetaData getMetaData () throws SQLException - { - validateResultSet(); - return resultSet_.getMetaData(); - } - - - - /** - * Returns the value of a column as a Java Object. - * This can be used to get values from columns with all - * SQL types. If the column is a user-defined type, then the - * connection's type map is used to created the object. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public Object getObject (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getObject(columnIndex); - } - - - - /** - * Returns the value of a column as a Java Object. - * This can be used to get values from columns with all - * SQL types. If the column is a user-defined type, then the - * connection's type map is used to created the object. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public Object getObject (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getObject(columnName); - } - - - /** - * Returns the value of a column as a Java Object. - * - * @param columnIndex The column index (1-based). - * @param typeMap The type map. This is not used. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, - * the type map is null, or the - * requested conversion is not valid. - **/ - public Object getObject (int columnIndex, Map typeMap) throws SQLException - { - validateResultSet(); - return resultSet_.getObject(columnIndex, typeMap); - } - - - /** - * Returns the value of a column as a Java Object. - * - * @param columnName The column name. - * @param typeMap The type map. This is not used. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, - * the type map is null, or the - * requested conversion is not valid. - **/ - public Object getObject (String columnName, Map typeMap) throws SQLException - { - validateResultSet(); - return resultSet_.getObject(columnName, typeMap); - } - - /** - * Returns the password used to create the connection. - * @return An empty String. For security the password information cannot be accessed. - **/ - public String getPassword() - { - return ""; - } - - /** - * Returns the maximum wait time in seconds for a statement to execute. - * @return The timeout value in seconds. The default value of zero indicates no maximum. - * @exception SQLException If a database error occurs. - **/ - public int getQueryTimeout() throws SQLException - { - validateStatement(); - return statement_.getQueryTimeout(); - } - - /** - * Returns the value of a column as a Ref object. - * DB2 for IBM i does not support structured types. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException Always thrown because DB2 for IBM i does not support structured types. - **/ - public Ref getRef (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getRef(columnIndex); - } - - - /** - * Returns the value of a column as a Ref object. - * DB2 for IBM i does not support structured types. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException Always thrown because DB2 for IBM i does not support structured types. - **/ - public Ref getRef (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getRef(columnName); - } - - /** - * Returns the current row number. - * - * @return The current row number (1-based). If there is no current - * row or if the cursor is positioned on the insert row, - * 0 is returned. - * - * @exception SQLException If the result set is not open. - **/ - public int getRow () throws SQLException - { - validateResultSet(); - return resultSet_.getRow(); - } - - /** - * Returns the value of a column as a Java short value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public short getShort (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getShort(columnIndex); - } - - - /** - * Returns the value of a column as a Java short value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public short getShort (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getShort(columnName); - } - - - /** - * Returns the statement for this result set. - * - * @return The statement for this result set, or null if the - * result set was returned by a DatabaseMetaData - * catalog method. - * - * @exception SQLException If an error occurs. - **/ - public Statement getStatement() throws SQLException - { - validateResultSet(); - return resultSet_.getStatement(); - } - - /** - * Returns the value of a column as a String object. - * This can be used to get values from columns with any SQL - * type. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public String getString (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getString(columnIndex); - } - - - - /** - * Returns the value of a column as a String object. - * This can be used to get values from columns with any SQL - * type. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public String getString (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getString(columnName); - } - - - - /** - * Returns the value of a column as a java.sql.Time object using the - * default calendar. This can be used to get values from columns - * with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public Time getTime (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getTime(columnIndex); - } - - - - /** - * Returns the value of a column as a java.sql.Time object using the - * default calendar. This can be used to get values from columns - * with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public Time getTime (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getTime(columnName); - } - - - /** - * Returns the value of a column as a java.sql.Time object using a - * calendar other than the default. This can be used to get values - * from columns with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP. - * - * @param columnIndex The column index (1-based). - * @param calendar The calendar. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, - * the calendar is null, or the - * requested conversion is not valid. - **/ - public Time getTime (int columnIndex, Calendar calendar) throws SQLException - { - validateResultSet(); - return resultSet_.getTime(columnIndex, calendar); - } - - - /** - * Returns the value of a column as a java.sql.Time object using a - * calendar other than the default. This can be used to get values - * from columns with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP. - * - * @param columnName The column name. - * @param calendar The calendar. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, - * the calendar is null, or the - * requested conversion is not valid. - **/ - public Time getTime (String columnName, Calendar calendar) throws SQLException - { - validateResultSet(); - return resultSet_.getTime(columnName, calendar); - } - - - - /** - * Returns the value of a column as a java.sql.Timestamp object - * using the default calendar. This can be used to get values - * from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public Timestamp getTimestamp (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getTimestamp(columnIndex); - } - - - - /** - * Returns the value of a column as a java.sql.Timestamp object - * using the default calendar. This can be used to get values - * from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public Timestamp getTimestamp (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getTimestamp(columnName); - } - - - /** - * Returns the value of a column as a java.sql.Timestamp object - * using a calendar other than the default. This can be used to - * get values from columns with SQL types CHAR, VARCHAR, DATE, - * and TIMESTAMP. - * - * @param columnIndex The column index (1-based). - * @param calendar The calendar. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, - * the calendar is null, or the - * requested conversion is not valid. - **/ - public Timestamp getTimestamp (int columnIndex, Calendar calendar) throws SQLException - { - validateResultSet(); - return resultSet_.getTimestamp(columnIndex, calendar); - } - - - /** - * Returns the value of a column as a java.sql.Timestamp object - * using a calendar other than the default. This can be used to - * get values from columns with SQL types CHAR, VARCHAR, DATE, - * and TIMESTAMP. - * - * @param columnName The column name. - * @param calendar The calendar. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, - * the calendar is null, or the - * requested conversion is not valid. - **/ - public Timestamp getTimestamp (String columnName, Calendar calendar) throws SQLException - { - validateResultSet(); - return resultSet_.getTimestamp(columnName, calendar); - } - - /** - * Returns the transaction isolation level. - * Possible values are: - *
    - *
  • Connection.TRANSACTION_READ_UNCOMMITTED
  • Connection.TRANSACTION_READ_COMMITTED - *
  • Connection.TRANSACTION_REPEATABLE_READ
  • Connection.TRANSACTION_SERIALIZABLE - *
- * @return The transaction isolation level. - **/ - public int getTransactionIsolation() - { - try - { - if (connection_ != null) - return connection_.getTransactionIsolation(); - else - return transactionIsolation_; - } - catch (SQLException e) - { - JDTrace.logInformation (this, "getTransactionIsolation() database error"); // @G5C - return transactionIsolation_; - } - } - - /** - * Returns the result set type. - * - * @return The result set type. Valid values are: - *
    - *
  • ResultSet.TYPE_FORWARD_ONLY - *
  • ResultSet.TYPE_SCROLL_INSENSITIVE - *
  • ResultSet.TYPE_SCROLL_SENSITIVE - *
- * - * - * @exception SQLException If the result set is not open. - **/ - public int getType() throws SQLException - { - if (resultSet_ != null) - return resultSet_.getType(); - return type_; - } - - /** - * Returns the type map. - * @return The type map. The default value is null. - * @exception SQLException If a database error occurs. - **/ - public Map getTypeMap() throws SQLException - { - if (connection_ != null) - return connection_.getTypeMap(); - return typeMap_; - } - - /** - * Returns the value of a column as a stream of Unicode - * characters. This can be used to get values from columns - * with SQL types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and - * BLOB. All of the data in the returned stream must be read - * prior to getting the value of any other column. The next - * call to a get method implicitly closes the stream. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - * - * @deprecated Use getCharacterStream(int) instead. - * @see #getCharacterStream(int) - **/ - public InputStream getUnicodeStream (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getUnicodeStream(columnIndex); - } - - /** - * Returns the value of a column as a stream of Unicode - * characters. This can be used to get values from columns - * with SQL types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, - * and BLOB. All of the data in the returned stream must be - * read prior to getting the value of any other column. The - * next call to a get method implicitly closes the stream. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - * - * @deprecated Use getCharacterStream(String) instead. - * @see #getCharacterStream(String) - **/ - public InputStream getUnicodeStream (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getUnicodeStream(columnName); - } - - /** - * Returns the url used in getting a connection. - * Either this property or the dataSource property must be set before calling the execute command. - * @return The url. The default value is null. - **/ - public String getUrl() - { - return url_; - } - - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL DATALINK output parameter as a - java.net.URL object. - - @param columnIndex The column index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed or - the requested conversion is not valid. - @since Modification 5 - **/ - public URL getURL (int columnIndex) - throws SQLException - { - validateResultSet(); - return resultSet_.getURL(columnIndex); - } - - - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL DATALINK output parameter as a - java.net.URL object. - - @param columnName The column name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed or - the requested conversion is not valid. - **/ - public URL getURL (String columnName) - throws SQLException - { - validateResultSet(); - return resultSet_.getURL(columnName); - } - - - /** - * Returns the user used to create the connection. - * @return The user. The default is null. - **/ - public String getUsername() - { - return username_; - } - - /** - * Returns the first warning reported for the result set. - * Subsequent warnings may be chained to this warning. - * - * @return The first warning or null if no warnings - * have been reported. - * - * @exception SQLException If an error occurs. - **/ - public SQLWarning getWarnings() throws SQLException - { - validateResultSet(); - return resultSet_.getWarnings(); - } - - // @A3A - /** - Initializes all transient data. - **/ - private void initializeTransient () - { - eventSupport_ = new AS400JDBCRowSetEventSupport(); - changes_ = new PropertyChangeSupport(this); - resultSet_ = null; //@scan1 - } - - /** - * Inserts the contents of the insert row into the result set - * and the database. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on the insert row, - * a column that is not nullable was not specified, - * or an error occurs. - **/ - public void insertRow () throws SQLException - { - validateResultSet(); - resultSet_.insertRow(); - } - - /** - * Indicates if the cursor is positioned after the last row. - * - * @return true if the cursor is positioned after the last row; - * false if the cursor is not positioned after the last - * row or if the result set contains no rows. - * - * @exception SQLException If the result set is not open. - **/ - public boolean isAfterLast () throws SQLException - { - validateResultSet(); - return resultSet_.isAfterLast(); - } - - - /** - * Indicates if the cursor is positioned before the first row. - * - * @return true if the cursor is positioned before the first row; - * false if the cursor is not positioned before the first - * row or if the result set contains no rows. - * - * @exception SQLException If the result set is not open. - **/ - public boolean isBeforeFirst () throws SQLException - { - validateResultSet(); - return resultSet_.isBeforeFirst(); - } - - /** - * Indicates if the cursor is positioned on the first row. - * - * @return true if the cursor is positioned on the first row; - * false if the cursor is not positioned on the first - * row or the row number can not be determined. - * - * @exception SQLException If the result set is not open. - **/ - public boolean isFirst () throws SQLException - { - validateResultSet(); - return resultSet_.isFirst(); - } - - /** - * Indicates if the cursor is positioned on the last row. - * - * @return true if the cursor is positioned on the last row; - * false if the cursor is not positioned on the last - * row or the row number can not be determined. - * - * @exception SQLException If the result set is not open. - **/ - public boolean isLast () throws SQLException - { - validateResultSet(); - return resultSet_.isLast(); - } - - /** - * Indicates if the rowset is read-only. - * @return true if read-only; false otherwise. The default value is false, allowing updates. - **/ - public boolean isReadOnly() - { - if (connection_ != null) - { - try - { - return connection_.isReadOnly(); - } - catch (SQLException e) { /* return local value */ - } - } - return isReadOnly_; - } - - /** - * Indicates if the data source is used to make a connection to the database. - * @return true if the data source is used; false if the url is used. The default value is true. - **/ - public boolean isUseDataSource() - { - return useDataSource_; - } - - /** - * Positions the cursor to the last row. - * If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @return true if the requested cursor position is - * valid; false otherwise. - * - * @exception SQLException If the result set is not open, - * the result set is not scrollable, - * or an error occurs. - **/ - public boolean last () throws SQLException - { - validateResultSet(); - boolean status = resultSet_.last(); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - return status; - } - - /** - * Positions the cursor to the current row. This is the row - * where the cursor was positioned before moving it to the insert - * row. If the cursor is not on the insert row, then this - * has no effect. - * - *

If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @exception SQLException If the result set is not open, - * the result set is not scrollable, - * or an error occurs. - **/ - public void moveToCurrentRow () throws SQLException - { - validateResultSet(); - resultSet_.moveToCurrentRow(); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - } - - /** - * Positions the cursor to the insert row. - * If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @exception SQLException If the result set is not open, - * the result set is not scrollable, - * the result set is not updatable, - * or an error occurs. - **/ - public void moveToInsertRow () throws SQLException - { - validateResultSet(); - resultSet_.moveToInsertRow(); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - } - - /** - * Positions the cursor to the next row. - * If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @return true if the requested cursor position is valid; false - * if there are no more rows. - * - * @exception SQLException If the result set is not open, - * or an error occurs. - **/ - public boolean next () throws SQLException - { - validateResultSet(); - boolean status = resultSet_.next(); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - return status; - } - - /** - * Positions the cursor to the previous row. - * If an InputStream from the current row is open, it is implicitly - * closed. In addition, all warnings and pending updates - * are cleared. - * - * @return true if the requested cursor position is - * valid; false otherwise. - * - * @exception SQLException If the result set is not open, - * the result set is not scrollable, - * or an error occurs. - **/ - public boolean previous () throws SQLException - { - validateResultSet(); - boolean status = resultSet_.previous(); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - return status; - } - - - - // @A3A - /** - *Deserializes and initializes transient data. - */ - private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient(); - } - - - - /** - * Refreshes the current row from the database and cancels all - * pending updates that have been made since the last call to - * updateRow(). This method provides a way for an application - * to explicitly refetch a row from the database. If an InputStream - * from the current row is open, it is implicitly closed. In - * addition, all warnings and pending updates are cleared. - * - * @exception SQLException If the result set is not open, - * the result set is not scrollable, - * the cursor is not positioned on a row, - * the cursor is positioned on the - * insert row or an error occurs. - **/ - public void refreshRow () throws SQLException - { - validateResultSet(); - resultSet_.refreshRow(); - } - - /** - * Positions the cursor to a relative row number. - * - *

Attempting to move beyond the first row positions the - * cursor before the first row. Attempting to move beyond the last - * row positions the cursor after the last row. - * - *

If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @param rowNumber The relative row number. If the relative row - * number is positive, this positions the cursor - * after the current position. If the relative - * row number is negative, this positions the - * cursor before the current position. If the - * relative row number is 0, then the cursor - * position does not change. - * @return true if the requested cursor position is - * valid, false otherwise. - * - * @exception SQLException If the result set is not open, - * the result set is not scrollable, - * the cursor is not positioned on a valid row, - * or an error occurs. - */ - public boolean relative (int rowNumber) throws SQLException - { - validateResultSet(); - boolean status = resultSet_.relative(rowNumber); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - return status; - } - - /** - * Removes a PropertyChangeListener. - * @param listener The PropertyChangeListener. - * @see #addPropertyChangeListener - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - changes_.removePropertyChangeListener(listener); - } - - /** - * Removes the RowSetListener from the list. - * @param listener The RowSetListener object. - **/ - public void removeRowSetListener(RowSetListener listener) - { - eventSupport_.removeRowSetListener(listener); - } - - /** - * Indicates if the current row has been deleted. A result set - * of type TYPE_SCROLL_INSENSITIVE may contain rows that have - * been deleted. - * - * @return true if current row has been deleted; false otherwise. - * - * @exception SQLException If an error occurs. - **/ - public boolean rowDeleted () throws SQLException - { - validateResultSet(); - return resultSet_.rowDeleted(); - } - - - /** - * Indicates if the current row has been inserted. This driver does - * not support this method. - * - * @return Always false. - * - * @exception SQLException If an error occurs. - **/ - public boolean rowInserted () throws SQLException - { - validateResultSet(); - return resultSet_.rowInserted(); - } - - - /** - * Indicates if the current row has been updated. This driver does - * not support this method. - * - * @return Always false. - * - * @exception SQLException If an error occurs. - **/ - public boolean rowUpdated () throws SQLException - { - validateResultSet(); - return resultSet_.rowUpdated(); - } - - /** - * Sets the array value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Array object. - * @exception SQLException If a database error occurs. - **/ - public void setArray(int parameterIndex, Array value) throws SQLException - { - validateStatement(); - statement_.setArray(parameterIndex, value); - } - - - /** - * Sets the inputStream at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * The driver reads the data from the stream as needed until no more bytes are available. - * The converts this to an SQL VARCHAR value. - * - * @param parameterIndex The parameter index (1-based). - * @param inputStream The input stream or null to update the value to SQL NULL. - * @param length The number of bytes in the stream. - * @exception SQLException If the result set is not open, the result set is not updatable, - * the cursor is not positioned on a row, the column index is not valid, or the requested - * conversion is not valid, the length is not valid, or an error happens while reading the - * input stream. - **/ - public void setAsciiStream(int parameterIndex, InputStream inputStream, int length) throws SQLException - { - validateStatement(); - statement_.setAsciiStream(parameterIndex, inputStream, length); - } - - /** - * Sets the BigDecimal value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The BigDecimal object. - * @exception SQLException If a database error occurs. - **/ - public void setBigDecimal(int parameterIndex, BigDecimal value) throws SQLException - { - validateStatement(); - statement_.setBigDecimal(parameterIndex, value); - } - - /** - * Sets the binary stream value using a inputStream at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * The driver reads the data from the stream as needed until no more bytes are available. - * The driver converts this to an SQL VARBINARY value. - * - * @param parameterIndex The parameter index (1-based). - * @param inputStream The input stream or null to update the value to SQL NULL. - * @param length The number of bytes in the stream. - * @exception SQLException If the result set is not open, the result set is not updatable, - * the cursor is not positioned on a row, the column index is not valid, or the requested - * conversion is not valid, the length is not valid, or an error happens while reading the - * input stream. - **/ - public void setBinaryStream(int parameterIndex, InputStream inputStream, int length) throws SQLException - { - validateStatement(); - statement_.setBinaryStream(parameterIndex, inputStream, length); - } - - /** - * Sets the Blob value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Blob object. - * @exception SQLException If a database error occurs. - **/ - public void setBlob(int parameterIndex, Blob value) throws SQLException - { - validateStatement(); - statement_.setBlob(parameterIndex, value); - } - - /** - * Sets the boolean value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The boolean value. - * @exception SQLException If a database error occurs. - **/ - public void setBoolean(int parameterIndex, boolean value) throws SQLException - { - validateStatement(); - statement_.setBoolean(parameterIndex, value); - } - - /** - * Sets the byte value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The byte value. - * @exception SQLException If a database error occurs. - **/ - public void setByte(int parameterIndex, byte value) throws SQLException - { - validateStatement(); - statement_.setByte(parameterIndex, value); - } - - /** - * Sets the byte array value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The byte array. - * @exception SQLException If a database error occurs. - **/ - public void setBytes(int parameterIndex, byte[] value) throws SQLException - { - validateStatement(); - statement_.setBytes(parameterIndex, value); - } - - /** - * Sets a column in the current row using a Reader value. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * The driver reads the data from the Reader as needed until no more characters are available. - * The driver converts this to an SQL VARCHAR value. - * - * @param parameterIndex The parameter index (1-based). - * @param reader The reader or null to update the value to SQL NULL. - * @param length The number of characters in the stream. - * @exception SQLException If the result set is not open, the result set is not updatable, - * the cursor is not positioned on a row, the column index is not valid, - * or the requested conversion is not valid, the length is not valid, or - * an error happens while reading the input stream. - **/ - public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException - { - validateStatement(); - statement_.setCharacterStream(parameterIndex, reader, length); - } - - /** - * Sets the Clob value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Clob object. - * @exception SQLException If a database error occurs. - **/ - public void setClob(int parameterIndex, Clob value) throws SQLException - { - validateStatement(); - statement_.setClob(parameterIndex, value); - } - - /** - * Sets the command used by the execute statement to populate the rowset. - * This property is required to create the PreparedStatement. - * Resetting the command creates a new PreparedStatement and clears all - * existing input parameters. - * @param command The command. - * @exception SQLException If a database error occurs. - **/ - public void setCommand(String command) throws SQLException - { - String property = "command"; - if (command == null) - throw new NullPointerException(property); - - String old = command_; - command_ = command; - changes_.firePropertyChange(property, old, command); - - createNewStatement_ = true; - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, property, command); - } - - /** - * Sets the concurrency type for the result set. - * Valid values include: - *

    - *
  • ResultSet.CONCUR_READ_ONLY
  • ResultSet.CONCUR_UPDATABLE - *
- * @param concurrency The concurrency type. - **/ - public void setConcurrency(int concurrency) - { - String property = "concurrency"; - switch (concurrency) - { - case ResultSet.CONCUR_READ_ONLY: break; - case ResultSet.CONCUR_UPDATABLE: break; - default: throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - Integer oldValue = new Integer(concurrency_); - Integer newValue = new Integer(concurrency); - - concurrency_ = concurrency; - changes_.firePropertyChange(property, oldValue, newValue); - - createNewStatement_ = true; - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, "concurrency", concurrency); - } - - //@A1A - /** - * Sets the JNDI naming context which provides name-to-object bindings - * and methods for retrieving and updating naming and directory services. - * If this is not set, a default InitialContext will be created. - * @param context A JNDI naming context. - **/ - public void setContext(Context context) - { - String property = "context"; - if (context == null) - throw new NullPointerException(property); - - Context oldValue = getContext(); - Context newValue = context; - - context_ = context; - changes_.firePropertyChange(property, oldValue, newValue); - } - - /** - * Sets the name of the data source. - * Note: This property is not supported. The setDataSource method - * should be used for setting the data source. - * @param dataSourceName The data source name. - **/ - public void setDataSourceName(String dataSourceName) - { - String property = "dataSourceName"; - if (dataSourceName == null) - throw new NullPointerException(property); - - String old = getDataSourceName(); - dataSourceName_ = dataSourceName; - changes_.firePropertyChange(property, old, dataSourceName); - } - - /** - * Sets the Date value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Date object. - * @exception SQLException If a database error occurs. - **/ - public void setDate(int parameterIndex, Date value) throws SQLException - { - validateStatement(); - statement_.setDate(parameterIndex, value); - } - - /** - * Sets the Date value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Date object. - * @param calendar The Calendar object. - * @exception SQLException If a database error occurs. - **/ - public void setDate(int parameterIndex, Date value, Calendar calendar) throws SQLException - { - validateStatement(); - statement_.setDate(parameterIndex, value, calendar); - } - - /** - * Sets the double value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The double value. - * @exception SQLException If a database error occurs. - **/ - public void setDouble(int parameterIndex, double value) throws SQLException - { - validateStatement(); - statement_.setDouble(parameterIndex, value); - } - - //@A2A - /** - * Sets the standard JNDI environment properties. - * If this is not set, a default set of properties will be used. - * @param environment A Hashtable of JNDI environment properties. - **/ - public void setEnvironment(Hashtable environment) - { - String property = "enviroment"; - if (environment == null) - throw new NullPointerException(property); - - Hashtable oldValue = getEnvironment(); - Hashtable newValue = environment; - - environment_ = environment; - changes_.firePropertyChange(property, oldValue, newValue); - } - - /** - * Sets whether the escape scanning is enabled for escape substitution processing. - * @param enable true if enabled; false otherwise. The default value is true. - * @exception SQLException If a database error occurs. - **/ - public void setEscapeProcessing(boolean enable) throws SQLException - { - Boolean old = new Boolean(getEscapeProcessing()); - - validateStatement(); - statement_.setEscapeProcessing(enable); - - escapeProcessing_ = enable; // save it, since it can't be retrieved anywhere else. - - changes_.firePropertyChange("escapeProcessing", old, new Boolean(enable)); - } - - /** - * Sets the direction in which the rows in a result set are - * processed. - * - * @param fetchDirection The fetch direction for processing rows. - * Valid values are: - *
    - *
  • ResultSet.FETCH_FORWARD - *
  • ResultSet.FETCH_REVERSE - *
  • ResultSet.FETCH_UNKNOWN - *
- * The default is the statement's fetch direction. - * - * @exception SQLException If the result set is not open, the result set is scrollable - * and the input value is not ResultSet.FETCH_FORWARD, - * or the input value is not valid. - **/ - public void setFetchDirection(int fetchDirection) throws SQLException - { - Integer old = new Integer(getFetchDirection()); - - if (resultSet_ != null) - resultSet_.setFetchDirection(fetchDirection); - - validateStatement(); - statement_.setFetchDirection(fetchDirection); - - changes_.firePropertyChange("fetchDirection", old, new Integer(fetchDirection)); - } - - - /** - * Sets the number of rows to be fetched from the database when more - * rows are needed. This may be changed at any time. If the value - * specified is zero, then the driver will choose an appropriate - * fetch size. - * - *

This setting only affects statements that meet the criteria - * specified in the "block criteria" property. The fetch size - * is only used if the "block size" property is set to "0". - * - * @param fetchSize The number of rows. This must be greater than - * or equal to 0 and less than or equal to the - * maximum rows limit. The default is the - * statement's fetch size. - * - * @exception SQLException If the result set is not open - * or the input value is not valid. - **/ - public void setFetchSize (int fetchSize) throws SQLException - { - Integer old = new Integer(getFetchSize()); - - if (resultSet_ != null) - resultSet_.setFetchSize(fetchSize); - - validateStatement(); - statement_.setFetchSize(fetchSize); - - changes_.firePropertyChange("fetchSize", old, new Integer(fetchSize)); - } - - /** - * Sets the float value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The float value. - * @exception SQLException If a database error occurs. - **/ - public void setFloat(int parameterIndex, float value) throws SQLException - { - validateStatement(); - statement_.setFloat(parameterIndex, value); - } - - /** - * Sets the integer value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The integer value. - * @exception SQLException If a database error occurs. - **/ - public void setInt(int parameterIndex, int value) throws SQLException - { - validateStatement(); - statement_.setInt(parameterIndex, value); - } - - /** - * Sets the long value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The long value. - * @exception SQLException If a database error occurs. - **/ - public void setLong(int parameterIndex, long value) throws SQLException - { - validateStatement(); - statement_.setLong(parameterIndex, value); - } - - /** - * Sets the maximum column size. The default size is zero indicating no maximum value. - * This property is only used with column types: - *

    - *
  • BINARY
  • VARBINARY
  • LONGVARBINARY
  • CHAR
  • VARCHAR
  • LONGVARCHAR - *
- * @param maxFieldSize The maximum column size. - * @exception SQLException If a database error occurs. - **/ - public void setMaxFieldSize(int maxFieldSize) throws SQLException - { - String property = "maxFieldSize"; - validateStatement(); - - Integer oldValue = new Integer(getMaxFieldSize()); - Integer newValue = new Integer(maxFieldSize); - - statement_.setMaxFieldSize(maxFieldSize); - changes_.firePropertyChange(property, oldValue, newValue); - } - - /** - * Sets the maximum row limit for the rowset. The default value is zero indicating no maximum value. - * @param maxRows The maximum number of rows. - * @exception SQLException If a database error occurs. - **/ - public void setMaxRows(int maxRows) throws SQLException - { - String property = "maxRows"; - validateStatement(); - - Integer oldValue = new Integer(getMaxRows()); - Integer newValue = new Integer(maxRows); - - statement_.setMaxRows(maxRows); - changes_.firePropertyChange(property, oldValue, newValue); - } - - /** - * Sets the type at the specified parameterIndex to SQL NULL. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param sqlType The SQL type. - * @exception SQLException If a database error occurs. - **/ - public void setNull(int parameterIndex, int sqlType) throws SQLException - { - validateStatement(); - statement_.setNull(parameterIndex, sqlType); - } - - /** - * Sets the user-named type or REF type at the specified parameterIndex to SQL NULL. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param sqlType The SQL type. - * @param typeName The fully qualified name of an SQL user-named type. This parameter is not used if the type is REF. - * @exception SQLException If a database error occurs. - **/ - public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException - { - validateStatement(); - statement_.setNull(parameterIndex, sqlType, typeName); - } - - /** - * Sets the object value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Object value. - * @exception SQLException If a database error occurs. - **/ - public void setObject(int parameterIndex, Object value) throws SQLException - { - validateStatement(); - statement_.setObject(parameterIndex, value); - } - - /** - * Sets the object value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Object value. - * @param targetSqlType The SQL type. - * @exception SQLException If a database error occurs. - **/ - public void setObject(int parameterIndex, Object value, int targetSqlType) throws SQLException - { - validateStatement(); - statement_.setObject(parameterIndex, value, targetSqlType); - } - - /** - * Sets the object value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Object value. - * @param targetSqlType The SQL type. - * @param scale The number of digits after the decimal point. This parameter is used only for SQL types Decimal or Numeric. - * @exception SQLException If a database error occurs. - **/ - public void setObject(int parameterIndex, Object value, int targetSqlType, int scale) throws SQLException - { - validateStatement(); - statement_.setObject(parameterIndex, value, targetSqlType, scale); - } - - /** - * Sets the password used to make the connection. - * Note: This property has no effect unless the useDataSource property is set to false. - * @param password The password. - **/ - public void setPassword(String password) - { - String property = "password"; - if (password == null) - throw new NullPointerException(property); - validateConnection(); - - password_ = password; - changes_.firePropertyChange(property, "", password); - } - - /** - * Sets the maximum wait time in seconds for a statement to execute. - * @param timeout The timeout value in seconds. The default value is zero indicating no maximum value. - * @exception SQLException If a database error occurs. - **/ - public void setQueryTimeout(int timeout) throws SQLException - { - String property = "timeout"; - validateStatement(); - - Integer oldValue = new Integer(getQueryTimeout()); - Integer newValue = new Integer(timeout); - - statement_.setQueryTimeout(timeout); - changes_.firePropertyChange(property, oldValue, newValue); - } - - /** - * Sets whether the rowset is read-only. The default value is false indicating updates are allowed. - * @param readOnly true if read-only; false otherwise. - * @exception SQLException If a database error occurs. - **/ - public void setReadOnly(boolean readOnly) throws SQLException - { - String property = "readOnly"; - - Boolean oldValue = new Boolean(isReadOnly()); - Boolean newValue = new Boolean(readOnly); - - if (connection_ != null) - connection_.setReadOnly(readOnly); - isReadOnly_ = readOnly; - - changes_.firePropertyChange(property, oldValue, newValue); - } - - /** - * Sets Ref value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Ref object. - * @exception SQLException If a database error occurs. - **/ - public void setRef(int parameterIndex, Ref value) throws SQLException - { - validateStatement(); - statement_.setRef(parameterIndex, value); - } - - /** - * Sets the short value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The short value. - * @exception SQLException If a database error occurs. - **/ - public void setShort(int parameterIndex, short value) throws SQLException - { - validateStatement(); - statement_.setShort(parameterIndex, value); - } - - /** - * Sets the string value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The String object. - * @exception SQLException If a database error occurs. - **/ - public void setString(int parameterIndex, String value) throws SQLException - { - validateStatement(); - statement_.setString(parameterIndex, value); - } - - /** - * Sets the time value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Time object. - * @exception SQLException If a database error occurs. - **/ - public void setTime(int parameterIndex, Time value) throws SQLException - { - validateStatement(); - statement_.setTime(parameterIndex, value); - } - - /** - * Sets the time value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Time object. - * @param calendar The Calendar object. - * @exception SQLException If a database error occurs. - **/ - public void setTime(int parameterIndex, Time value, Calendar calendar) throws SQLException - { - validateStatement(); - statement_.setTime(parameterIndex, value, calendar); - } - - /** - * Sets the timestamp value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Timestamp object. - * @exception SQLException If a database error occurs. - **/ - public void setTimestamp(int parameterIndex, Timestamp value) throws SQLException - { - validateStatement(); - statement_.setTimestamp(parameterIndex, value); - } - - /** - * Sets the timestamp value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Timestamp object. - * @param calendar The Calendar object. - * @exception SQLException If a database error occurs. - **/ - public void setTimestamp(int parameterIndex, Timestamp value, Calendar calendar) throws SQLException - { - validateStatement(); - statement_.setTimestamp(parameterIndex, value, calendar); - } - - /** - * Sets the transaction isolation level. - * @param level The transaction isolation level. - * Possible values are: - *
    - *
  • Connection.TRANSACTION_READ_UNCOMMITTED
  • Connection.TRANSACTION_READ_COMMITTED - *
  • Connection.TRANSACTION_REPEATABLE_READ
  • Connection.TRANSACTION_SERIALIZABLE - *
- * @exception SQLException If a database error occurs. - **/ - public void setTransactionIsolation(int level) throws SQLException - { - String property = "transactionIsolation"; - - Integer oldValue = new Integer(getTransactionIsolation()); - Integer newValue = new Integer(level); - - if (connection_ != null) - connection_.setTransactionIsolation(level); - transactionIsolation_ = level; - - changes_.firePropertyChange(property, oldValue, newValue); - } - - /** - * Sets the result set type. - * Valid values are: - *
    - *
  • ResultSet.TYPE_FORWARD_ONLY
  • ResultSet.TYPE_SCROLL_INSENSITIVE
  • ResultSet.TYPE_SCROLL_SENSITIVE - *
- * @param type The type. - * @exception SQLException If a database error occurs. - **/ - public void setType(int type) throws SQLException - { - String property = "type"; - switch (type) - { - case ResultSet.TYPE_FORWARD_ONLY: break; - case ResultSet.TYPE_SCROLL_INSENSITIVE: break; - case ResultSet.TYPE_SCROLL_SENSITIVE: break; - default: throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - Integer oldValue = new Integer(getType()); - Integer newValue = new Integer(type_); - - type_ = type; - changes_.firePropertyChange(property, oldValue, newValue); - - createNewStatement_ = true; - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, property, type); - } - - /** - * Sets the type map to be used for distinct and structured types. - * - * Note: Distinct types are supported by DB2 for IBM i, but are not externalized by the IBM Toolbox for Java JDBC driver. In other words, distinct types - * behave as if they are the underlying type. Structured types are not supported by DB2 for IBM i. Consequently, this driver does not support the type map. - * - * @param map The type map. - * @exception SQLException If a database error occurs. - **/ - public void setTypeMap(Map map) throws SQLException - { - if (map == null) - throw new NullPointerException("map"); - - if (connection_ != null) - connection_.setTypeMap(map); - typeMap_ = map; - } - - /** - * Sets the URL used for getting a connection. - * Either this property or the dataSource property must be set before a connection can be made. - * This sets setUseDataSource to false. - * @param url The URL. - * @see #setUseDataSource - **/ - public void setUrl(String url) - { - String property = "url"; - if (url == null) - throw new NullPointerException(property); - - validateConnection(); - - String old = getUrl(); - url_ = url; - changes_.firePropertyChange(property, old, url); - - useDataSource_ = false; - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, property, url); - } - - /** - * Sets whether the data source is used to make a connection to the database. - * @param useDataSource true if the data source is used; false if the URL is used. - * The default value is true. - **/ - public void setUseDataSource(boolean useDataSource) - { - String property = "useDataSource"; - validateConnection(); - - Boolean oldValue = new Boolean(isUseDataSource()); - useDataSource_ = useDataSource; - changes_.firePropertyChange(property, oldValue, new Boolean(useDataSource) ); - } - - /** - * Sets the user name used to make the connection. - * Note: This property has no effect unless the useDataSource property is set to false. - * @param username The user name. - **/ - public void setUsername(String username) - { - String property = "username"; - if (username == null) - throw new NullPointerException(property); - validateConnection(); - - String old = getUsername(); - - username_ = username; - changes_.firePropertyChange(property, old, username); - } - - /** - * Returns the name of the SQL cursor in use by the result set. - * - * @return The cursor name. - **/ - public String toString () - { - if (resultSet_ != null) - return resultSet_.toString(); - else - return ""; - } - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using an Array value. - DB2 for IBM i does not support arrays. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - @since Modification 5 - **/ - public void updateArray (int columnIndex, Array columnValue) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - } - - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using an Array value. - DB2 for IBM i does not support arrays. - - @param columnName The column name. - @param columnValue The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - **/ - public void updateArray (String columnName, Array columnValue) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - } - - - /** - * Updates a column in the current row using an ASCII stream value. - * The driver reads the data from the stream as needed until no more - * bytes are available. The driver converts this to an SQL VARCHAR - * value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update the value to SQL NULL. - * @param length The length. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, the - * requested conversion is not valid, - * the length is not - * valid, the input stream does not contain - * ASCII characters, or an error happens - * while reading the input stream. - **/ - public void updateAsciiStream (int columnIndex, InputStream columnValue, int length) throws SQLException - { - validateResultSet(); - resultSet_.updateAsciiStream(columnIndex, columnValue, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using an ASCII stream value. - * The driver reads the data from the stream as needed until no more - * bytes are available. The driver converts this to an SQL VARCHAR value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update the value to SQL NULL. - * @param length The length. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, the - * requested conversion is not valid, - * the length is not valid, - * the input stream does not contain - * ASCII characters, or an error happens - * while reading the input stream. - **/ - public void updateAsciiStream (String columnName, - InputStream columnValue, - int length) - throws SQLException - { - validateResultSet(); - resultSet_.updateAsciiStream(columnName, columnValue, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a BigDecimal value. The - * driver converts this to an SQL NUMERIC value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateBigDecimal (int columnIndex, BigDecimal columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateBigDecimal(columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a BigDecimal value. The - * driver converts this to an SQL NUMERIC value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateBigDecimal (String columnName, BigDecimal columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateBigDecimal (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a binary stream value. - * The driver reads the data from the stream as needed until no more - * bytes are available. The driver converts this to an SQL VARBINARY value. - * - *

This does not update the database directly. Instead, it updates a copy - * of the data in memory. Call updateRow() or insertRow() to update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update the value to SQL NULL. - * @param length The length. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid, - * the length is not valid, or an error - * happens while reading the input stream. - **/ - public void updateBinaryStream (int columnIndex, InputStream columnValue, int length) throws SQLException - { - validateResultSet(); - resultSet_.updateBinaryStream(columnIndex, columnValue, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a binary stream value. - * The driver reads the data from the stream as needed until no more - * bytes are available. The driver converts this to an SQL - * VARBINARY value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update - * the value to SQL NULL. - * @param length The length. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid, - * the length is not valid, or an error - * happens while reading the input stream. - **/ - public void updateBinaryStream (String columnName, - InputStream columnValue, - int length) - throws SQLException - { - validateResultSet(); - resultSet_.updateBinaryStream (columnName, columnValue, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using a Java Blob value. - The driver converts this to an SQL BLOB value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - @since Modification 5 - **/ - public void updateBlob (int columnIndex, Blob columnValue) - throws SQLException - { - validateResultSet(); - resultSet_.updateBlob(columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using a Java Blob value. - The driver converts this to an SQL BLOB value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBlob (String columnName, Blob columnValue) - throws SQLException - { - validateResultSet(); - resultSet_.updateBlob(columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - /** - * Updates a column in the current row using a Java boolean value. - * The driver converts this to an SQL SMALLINT value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateBoolean (int columnIndex, boolean columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateBoolean(columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java boolean value. - * The driver converts this to an SQL SMALLINT value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateBoolean (String columnName, boolean columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateBoolean (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java byte value. - * The driver converts this to an SQL SMALLINT value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateByte (int columnIndex, byte columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateByte (columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java byte value. - * The driver converts this to an SQL SMALLINT value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateByte (String columnName, byte columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateByte (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - /** - * Updates a column in the current row using a Java byte array value. - * The driver converts this to an SQL VARBINARY value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateBytes (int columnIndex, byte[] columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateBytes (columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java byte array value. - * The driver converts this to an SQL VARBINARY value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateBytes (String columnName, byte[] columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateBytes (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Reader value. - * The driver reads the data from the Reader as needed until no more - * characters are available. The driver converts this to an SQL VARCHAR value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update - * the value to SQL NULL. - * @param length The length. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid, - * the length is not valid, or an error - * happens while reading the input stream. - **/ - public void updateCharacterStream (int columnIndex, - Reader columnValue, - int length) - throws SQLException - { - validateResultSet(); - resultSet_.updateCharacterStream (columnIndex, columnValue, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Reader value. - * The driver reads the data from the Reader as needed until no more - * characters are available. The driver converts this to an SQL VARCHAR - * value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update - * the value to SQL NULL. - * @param length The length. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid, - * the length is not valid, or an error - * happens while reading the input stream. - **/ - public void updateCharacterStream (String columnName, - Reader columnValue, - int length) - throws SQLException - { - validateResultSet(); - resultSet_.updateCharacterStream (columnName, columnValue, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using a Java Clob value. - The driver converts this to an SQL CLOB value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - @since Modification 5 - **/ - public void updateClob (int columnIndex, Clob columnValue) - throws SQLException - { - validateResultSet(); - resultSet_.updateClob (columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using a Java Clob value. - The driver converts this to an SQL CLOB value. - -

This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateClob (String columnName, Clob columnValue) - throws SQLException - { - validateResultSet(); - resultSet_.updateClob (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - /** - * Updates a column in the current row using a java.sql.Date value. - * The driver converts this to an SQL DATE value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateDate (int columnIndex, Date columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateDate (columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a java.sql.Date value. - * The driver converts this to an SQL DATE value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateDate (String columnName, Date columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateDate (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java double value. - * The driver converts this to an SQL DOUBLE value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateDouble (int columnIndex, double columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateDouble (columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java double value. - * The driver converts this to an SQL DOUBLE value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateDouble (String columnName, double columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateDouble (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java float value. - * The driver converts this to an SQL REAL value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateFloat (int columnIndex, float columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateFloat (columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java float value. - * The driver converts this to an SQL REAL value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateFloat (String columnName, float columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateFloat (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - /** - * Updates a column in the current row using a Java int value. - * The driver converts this to an SQL INTEGER value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateInt (int columnIndex, int columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateInt (columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java int value. - * The driver converts this to an SQL INTEGER value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateInt (String columnName, int columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateInt (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java long value. - * If the connected system supports SQL BIGINT data, the driver - * converts this to an SQL BIGINT value. Otherwise, the driver - * converts this to an SQL INTEGER value. SQL BIGINT data is - * supported on V4R5 and later. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateLong (int columnIndex, long columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateLong (columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java long value. - * If the connected system supports SQL BIGINT data, the driver - * converts this to an SQL BIGINT value. Otherwise, the driver - * converts this to an SQL INTEGER value. SQL BIGINT data is - * supported on V4R5 and later. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateLong (String columnName, long columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateLong (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - /** - * Updates a column in the current row using SQL NULL. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateNull (int columnIndex) throws SQLException - { - validateResultSet(); - resultSet_.updateNull (columnIndex); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using SQL NULL. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateNull (String columnName) throws SQLException - { - validateResultSet(); - resultSet_.updateNull (columnName); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using an Object value. - * The driver converts this to a value of an SQL type, depending on - * the type of the specified value. The JDBC specification defines - * a standard mapping from Java types to SQL types. In the cases - * where an SQL type is not supported by DB2 for IBM i, the - * next closest matching type - * is used. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, - * or the requested conversion is not valid. - **/ - public void updateObject (int columnIndex, Object columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateObject(columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - /** - * Updates a column in the current row using an Object value. - * The driver converts this to a value of an SQL type, depending on - * the type of the specified value. The JDBC specification defines - * a standard mapping from Java types to SQL types. In the cases - * where an SQL type is not supported by DB2 for IBM i, the - * next closest matching type - * is used. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, - * or the requested conversion is not valid. - **/ - public void updateObject (String columnName, Object columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateObject(columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using an Object value. - * The driver converts this to a value of an SQL type, depending on - * the type of the specified value. The JDBC specification defines - * a standard mapping from Java types to SQL types. In the cases - * where an SQL type is not supported by DB2 for IBM i, the - * next closest matching type - * is used. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update - * the value to SQL NULL. - * @param scale The number of digits after the decimal - * if SQL type is DECIMAL or NUMERIC. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, - * the scale is not valid, or the - * requested conversion is not valid. - **/ - public void updateObject (int columnIndex, Object columnValue, int scale) throws SQLException - { - validateResultSet(); - resultSet_.updateObject(columnIndex, columnValue, scale); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using an Object value. - * The driver converts this to a value of an SQL type, depending on - * the type of the specified value. The JDBC specification defines - * a standard mapping from Java types to SQL types. In the cases - * where an SQL type is not supported by DB2 for IBM i, the - * next closest matching type - * is used. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update - * the value to SQL NULL. - * @param scale The number of digits after the decimal - * if SQL type is DECIMAL or NUMERIC. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, - * the scale is not valid, or the - * requested conversion is not valid. - **/ - public void updateObject (String columnName, Object columnValue, int scale) throws SQLException - { - validateResultSet(); - resultSet_.updateObject(columnName, columnValue, scale); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - /** - * Updates the database with the new contents of the current row. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the cursor is positioned on the insert row, - * or an error occurs. - **/ - public void updateRow () throws SQLException - { - validateResultSet(); - resultSet_.updateRow(); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using an Ref value. - DB2 for IBM i does not support structured types. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support REFs. - @since Modification 5 - **/ - public void updateRef (int columnIndex, Ref columnValue) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - } - - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using an Ref value. - DB2 for IBM i does not support structured types. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support REFs. - **/ - public void updateRef (String columnName, Ref columnValue) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - } - - - - /** - * Updates a column in the current row using a Java short value. - * The driver converts this to an SQL SMALLINT value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateShort (int columnIndex, short columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateShort(columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java short value. - * The driver converts this to an SQL SMALLINT value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateShort (String columnName, short columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateShort(columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a String value. - * The driver converts this to an SQL VARCHAR value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, - * or the requested conversion is not valid. - **/ - public void updateString (int columnIndex, String columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateString(columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a String value. - * The driver converts this to an SQL VARCHAR value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateString (String columnName, String columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateString(columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a java.sql.Time value. - * The driver converts this to an SQL TIME value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateTime (int columnIndex, Time columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateTime(columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a java.sql.Time value. - * The driver converts this to an SQL TIME value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateTime (String columnName, Time columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateTime(columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - /** - * Updates a column in the current row using a java.sql.Timestamp value. - * The driver converts this to an SQL TIMESTAMP value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateTimestamp (int columnIndex, Timestamp columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateTimestamp(columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a java.sql.Timestamp value. - * The driver converts this to an SQL TIMESTAMP value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateTimestamp (String columnName, Timestamp columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateTimestamp(columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Validates if the connection has been made. - **/ - private void validateConnection() - { - if (connection_ != null) - throw new ExtendedIllegalStateException("connection", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - /** - * Validates if the resultSet has been created. - **/ - private void validateResultSet() - { - if (resultSet_ == null) - throw new ExtendedIllegalStateException("resultSet", ExtendedIllegalStateException.OBJECT_MUST_BE_OPEN); - } - - /** - * Validates the statement has been created. - * @exception SQLException If a database error occurs. - **/ - private void validateStatement() throws SQLException - { - if (statement_ == null) - createStatement(); - } - - /** - * Indicates if the last column read has the value of SQL NULL. - * - * @return true if the value is SQL NULL; false otherwise. - * @exception SQLException If the result set is not open. - **/ - public boolean wasNull () throws SQLException - { - validateResultSet(); - return resultSet_.wasNull(); - } - - //@pda jdbc40 - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * @param parameterIndex of the first parameter is 1, the second is 2, ... - * @param value the parameter value - * @param length the number of characters in the parameter data. - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur ; or if a database access error occurs - */ - public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException - { - validateStatement(); - statement_.setNCharacterStream(parameterIndex, value, length); - } - - //@pda jdbc40 - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * @param parameterName the name of the column to be set - * @param value the parameter value - * @param length the number of characters in the parameter data. - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - */ - public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException - { - validateStatement(); - statement_.setNCharacterStream(statement_.findParameterIndex(parameterName), value, length); - } - - //@pda jdbc40 - /** - * Sets the designated parameter to a java.sql.NClob object. The driver converts this to a - * SQL NCLOB value when it sends it to the database. - * @param parameterIndex of the first parameter is 1, the second is 2, ... - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur ; or if a database access error occurs - */ -/* ifdef JDBC40 */ - public void setNClob(int parameterIndex, NClob value) throws SQLException - { - validateStatement(); - statement_.setNClob(parameterIndex, value); - } -/* endif */ - - //@pda jdbc40 - /** - * Sets the designated parameter to a java.sql.NClob object. The object - * implements the java.sql.NClob interface. This NClob - * object maps to a SQL NCLOB. - * @param parameterName the name of the column to be set - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - */ -/* ifdef JDBC40 */ - public void setNClob(String parameterName, NClob value) throws SQLException - { - validateStatement(); - statement_.setNClob(statement_.findParameterIndex(parameterName), value); - } -/* endif */ - - //@pda jdbc40 - /** - * Sets the designated parameter to the given String object. - * The driver converts this to a SQL NCHAR or - * NVARCHAR or LONGNVARCHAR value - * (depending on the argument's - * size relative to the driver's limits on NVARCHAR values) - * when it sends it to the database. - * - * @param parameterIndex of the first parameter is 1, the second is 2, ... - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur ; or if a database access error occurs - */ - public void setNString(int parameterIndex, String value) throws SQLException - { - validateStatement(); - statement_.setNString(parameterIndex, value); - } - - //@pda jdbc40 - /** - * Sets the designated parameter to the given String object. - * The driver converts this to a SQL NCHAR or - * NVARCHAR or LONGNVARCHAR - * @param parameterName the name of the column to be set - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - */ - public void setNString(String parameterName, String value) throws SQLException - { - validateStatement(); - statement_.setNString(statement_.findParameterIndex(parameterName), value); - } - - //@pda jdbc40 - /** - * Sets the designated parameter to the given java.sql.RowId object. The - * driver converts this to a SQL ROWID value when it sends it - * to the database - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @throws SQLException if a database access error occurs - */ -/* ifdef JDBC40 */ - public void setRowId(int parameterIndex, RowId x) throws SQLException - { - validateStatement(); - statement_.setRowId(parameterIndex, x); - } -/* endif */ - - //@pda jdbc40 - /** - * Sets the designated parameter to the given java.sql.RowId object. The - * driver converts this to a SQL ROWID when it sends it to the - * database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @throws SQLException if a database access error occurs - */ -/* ifdef JDBC40 */ - public void setRowId(String parameterName, RowId x) throws SQLException - { - validateStatement(); - statement_.setRowId(statement_.findParameterIndex(parameterName), x); - } -/* endif */ - //@pda jdbc40 - /** - * Sets the designated parameter to the given java.sql.SQLXML object. The driver converts this to an - * SQL XML value when it sends it to the database. - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @param xmlObject a SQLXML object that maps an SQL XML value - * @throws SQLException if a database access error occurs, this method - * is called on a closed result set, - * Writer or OutputStream has not been closed - * for the SQLXML object or - * if there is an error processing the XML value. The getCause method - * of the exception may provide a more detailed exception, for example, if the - * stream does not contain valid XML. - */ -/* ifdef JDBC40 */ - public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException - { - validateStatement(); - statement_.setSQLXML(parameterIndex, xmlObject); - } -/* endif */ - - //@pda jdbc40 - /** - * Sets the designated parameter to the given java.sql.SQLXML object. The driver converts this to an - * SQL XML value when it sends it to the database. - * @param parameterName the name of the parameter - * @param xmlObject a SQLXML object that maps an SQL XML value - * @throws SQLException if a database access error occurs, this method - * is called on a closed result set, - * Writer or OutputStream has not been closed - * for the SQLXML object or - * if there is an error processing the XML value. The getCause method - * of the exception may provide a more detailed exception, for example, if the - * stream does not contain valid XML. - */ -/* ifdef JDBC40 */ - public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException - { - validateStatement(); - statement_.setSQLXML(statement_.findParameterIndex(parameterName), xmlObject); - } -/* endif */ - - //@pda jdbc40 - /** - * Retrieves the holdability of this RowSet object - * @return either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT - * The holdability is derived in this order of precedence: -

    -
  • 1. The holdability, if any, that was specified on statement creation using - the methods createStatement(), prepareCall(), or prepareStatement() on the - Connection object. -
  • 2. The holdability specified using the method setHoldability(int) - if this method was called on the Connection object. -
  • 3. If neither of above methods were called, the value of the - cursor hold - driver property.
- Full functionality of #1 and #2 requires OS/400 v5r2 - or IBM i. If connecting to OS/400 V5R1 or earlier, - the value specified on these two methods will be ignored and the default holdability - will be the value of #3. - * @throws SQLException if a database error occurs - */ -/* ifdef JDBC40 */ - public int getHoldability() throws SQLException - { - return resultSet_.getHoldability(); - } -/* endif */ - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @param columnIndex the first column is 1, the second is 2, ... - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public Reader getNCharacterStream(int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getNCharacterStream(columnIndex); - } - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public Reader getNCharacterStream(String columnLabel) throws SQLException - { - validateResultSet(); - return resultSet_.getNCharacterStream(columnLabel); - } - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a NClob object - * in the Java programming language. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return a NClob object representing the SQL - * NCLOB value in the specified column - * @exception SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set - * or if a database access error occurs - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public NClob getNClob(int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getNClob(columnIndex); - } -/* endif */ - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a NClob object - * in the Java programming language. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return a NClob object representing the SQL NCLOB - * value in the specified column - * @exception SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set - * or if a database access error occurs - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public NClob getNClob(String columnLabel) throws SQLException - { - validateResultSet(); - return resultSet_.getNClob(columnLabel); - } -/* endif */ - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public String getNString(int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getNString(columnIndex); - } - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public String getNString(String columnLabel) throws SQLException - { - validateResultSet(); - return resultSet_.getNString(columnLabel); - } - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row of this - * ResultSet object as a java.sql.RowId object in the Java - * programming language. - * - * @param columnIndex the first column is 1, the second 2, ... - * @return the column value; if the value is a SQL NULL the - * value returned is null - * @throws SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public RowId getRowId(int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getRowId(columnIndex); - } -/* endif */ - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row of this - * ResultSet object as a java.sql.RowId object in the Java - * programming language. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return the column value ; if the value is a SQL NULL the - * value returned is null - * @throws SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public RowId getRowId(String columnLabel) throws SQLException - { - validateResultSet(); - return resultSet_.getRowId(columnLabel); - } -/* endif */ - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row of - * this ResultSet as a - * java.sql.SQLXML object in the Java programming language. - * @param columnIndex the first column is 1, the second is 2, ... - * @return a SQLXML object that maps an SQL XML value - * @throws SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public SQLXML getSQLXML(int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getSQLXML(columnIndex); - } -/* endif */ - - //@pda jdbc40 - - /** - * Retrieves the value of the designated column in the current row of - * this ResultSet as a - * java.sql.SQLXML object in the Java programming language. - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return a SQLXML object that maps an SQL XML value - * @throws SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public SQLXML getSQLXML(String columnLabel) throws SQLException - { - validateResultSet(); - return resultSet_.getSQLXML(columnLabel); - } -/* endif */ - - //@pda jdbc40 - /** - * Retrieves whether this ResultSet object has been closed. A ResultSet is closed if the - * method close has been called on it, or if it is automatically closed. - * - * @return true if this ResultSet object is closed; false if it is still open - * @throws SQLException if a database access error occurs - */ - public boolean isClosed() throws SQLException - { - return resultSet_.isClosed(); - } - - //@pda jdbc40 - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateAsciiStream (columnIndex, x, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes.. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateAsciiStream (columnLabel, x, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a binary stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateBinaryStream(columnIndex, x, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a binary stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateBinaryStream(columnLabel, x, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column using the given input stream, which - * will have the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateBlob (columnIndex, inputStream, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column using the given input stream, which - * will have the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateBlob(columnLabel, inputStream, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateCharacterStream(columnIndex, x, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateCharacterStream(columnLabel, reader, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateClob(int columnIndex, Reader reader, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateClob(columnIndex, reader, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateClob(String columnLabel, Reader reader, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateClob(columnLabel, reader, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateNCharacterStream(columnIndex, x, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateNCharacterStream(columnLabel, reader, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a java.sql.NClob value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second 2, ... - * @param nClob the value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public void updateNClob(int columnIndex, NClob nClob) throws SQLException - { - validateResultSet(); - resultSet_.updateNClob(columnIndex, nClob); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } -/* endif */ - - //@pda jdbc40 - /** - * Updates the designated column with a java.sql.NClob value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param nClob the value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set; - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public void updateNClob(String columnLabel, NClob nClob) throws SQLException - { - validateResultSet(); - resultSet_.updateNClob(columnLabel, nClob); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } -/* endif */ - - - //@pda jdbc40 - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateNClob(columnIndex, reader, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - //@pda jdbc40 - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set; - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateNClob(columnLabel, reader, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a String value. - * It is intended for use when updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second 2, ... - * @param nString the value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * the result set concurrency is CONCUR_READ_ONLY - * or if a database access error occurs - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNString(int columnIndex, String nString) throws SQLException - { - validateResultSet(); - resultSet_.updateNString (columnIndex, nString); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a String value. - * It is intended for use when updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param nString the value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set; - * the result set concurrency is CONCUR_READ_ONLY - * or if a database access error occurs - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNString(String columnLabel, String nString) throws SQLException - { - validateResultSet(); - resultSet_.updateNString (columnLabel, nString); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a RowId value. The updater - * methods are used to update column values in the current row or the insert - * row. The updater methods do not update the underlying database; instead - * the updateRow or insertRow methods are called - * to update the database. - * - * @param columnIndex the first column is 1, the second 2, ... - * @param x the column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public void updateRowId(int columnIndex, RowId x) throws SQLException - { - validateResultSet(); - resultSet_.updateRowId(columnIndex, x); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } -/* endif */ - - - //@pda jdbc40 - /** - * Updates the designated column with a RowId value. The updater - * methods are used to update column values in the current row or the insert - * row. The updater methods do not update the underlying database; instead - * the updateRow or insertRow methods are called - * to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public void updateRowId(String columnLabel, RowId x) throws SQLException - { - validateResultSet(); - resultSet_.updateRowId(columnLabel, x); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } -/* endif */ - - - //@pda jdbc40 - /** - * Updates the designated column with a java.sql.SQLXML value. - * The updater - * methods are used to update column values in the current row or the insert - * row. The updater methods do not update the underlying database; instead - * the updateRow or insertRow methods are called - * to update the database. - *

- * - * @param columnIndex the first column is 1, the second 2, ... - * @param xmlObject the value for the column to be updated - * @throws SQLException if a database access error occurs, this method - * is called on a closed result set, - * the java.xml.transform.Result, - * Writer or OutputStream has not been closed - * for the SQLXML object, - * if there is an error processing the XML value or - * the result set concurrency is CONCUR_READ_ONLY. The getCause method - * of the exception may provide a more detailed exception, for example, if the - * stream does not contain valid XML. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException - { - validateResultSet(); - resultSet_.updateSQLXML(columnIndex, xmlObject); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } -/* endif */ - - - //@pda jdbc40 - /** - * Updates the designated column with a java.sql.SQLXML value. - * The updater - * methods are used to update column values in the current row or the insert - * row. The updater methods do not update the underlying database; instead - * the updateRow or insertRow methods are called - * to update the database. - *

- * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param xmlObject the column value - * @throws SQLException if a database access error occurs, this method - * is called on a closed result set, - * the java.xml.transform.Result, - * Writer or OutputStream has not been closed - * for the SQLXML object, - * if there is an error processing the XML value or - * the result set concurrency is CONCUR_READ_ONLY. The getCause method - * of the exception may provide a more detailed exception, for example, if the - * stream does not contain valid XML. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ -/* ifdef JDBC40 */ - public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException - { - validateResultSet(); - resultSet_.updateSQLXML(columnLabel, xmlObject); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } -/* endif */ - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCRowSet", "javax.sql.RowSet" }; - } - - - //@PDA jdbc40 - /** - * Sets the designated parameter in this RowSet object's command - * to the given input stream. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setAsciiStream which takes a length parameter. - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the Java input stream that contains the ASCII parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException - { - validateStatement(); - statement_.setAsciiStream(parameterIndex, x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterName the name of the parameter - * @param x the Java input stream that contains the ASCII parameter value - * @param length the number of bytes in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException - { - validateStatement(); - statement_.setAsciiStream(statement_.findParameterIndex(parameterName), x, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setAsciiStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param x the Java input stream that contains the ASCII parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setAsciiStream(String parameterName, InputStream x) throws SQLException - { - validateStatement(); - statement_.setAsciiStream(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given - * java.math.BigDecimal value. - * The driver converts this to an SQL NUMERIC value when - * it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getBigDecimal - */ - public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException - { - validateStatement(); - statement_.setBigDecimal(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter in this RowSet object's command - * to the given input stream. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the - * stream as needed until end-of-file is reached. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setBinaryStream which takes a length parameter. - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the java input stream which contains the binary parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException - { - validateStatement(); - statement_.setBinaryStream(parameterIndex, x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the stream - * as needed until end-of-file is reached. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterName the name of the parameter - * @param x the java input stream which contains the binary parameter value - * @param length the number of bytes in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException - { - validateStatement(); - statement_.setBinaryStream(statement_.findParameterIndex(parameterName), x, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the - * stream as needed until end-of-file is reached. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setBinaryStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param x the java input stream which contains the binary parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setBinaryStream(String parameterName, InputStream x) throws SQLException - { - validateStatement(); - statement_.setBinaryStream(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a InputStream object. The inputstream must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the PreparedStatement is executed. - * This method differs from the setBinaryStream (int, InputStream, int) - * method because it informs the driver that the parameter value should be - * sent to the server as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARBINARY or a BLOB - * @param parameterIndex index of the first parameter is 1, - * the second is 2, ... - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @throws SQLException if a database access error occurs, - * this method is called on a closed PreparedStatement, - * if parameterIndex does not correspond - * to a parameter marker in the SQL statement, if the length specified - * is less than zero or if the number of bytes in the inputstream does not match - * the specfied length. - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - */ - public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException - { - validateStatement(); - statement_.setBlob(parameterIndex, inputStream, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a InputStream object. - * This method differs from the setBinaryStream (int, InputStream) - * method because it informs the driver that the parameter value should be - * sent to the server as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARBINARY or a BLOB - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setBlob which takes a length parameter. - * - * @param parameterIndex index of the first parameter is 1, - * the second is 2, ... - * @param inputStream An object that contains the data to set the parameter - * value to. - * @throws SQLException if a database access error occurs, - * this method is called on a closed PreparedStatement or - * if parameterIndex does not correspond - * to a parameter marker in the SQL statement, - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - */ - public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException - { - validateStatement(); - statement_.setBlob(parameterIndex, inputStream); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Blob object. - * The driver converts this to an SQL BLOB value when it - * sends it to the database. - * - * @param parameterName the name of the parameter - * @param x a Blob object that maps an SQL BLOB value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setBlob(String parameterName, Blob x) throws SQLException - { - validateStatement(); - statement_.setBlob(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a InputStream object. The inputstream must contain the number - * of characters specified by length, otherwise a SQLException will be - * generated when the CallableStatement is executed. - * This method differs from the setBinaryStream (int, InputStream, int) - * method because it informs the driver that the parameter value should be - * sent to the server as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARBINARY or a BLOB - * - * @param parameterName the name of the parameter to be set - * the second is 2, ... - * - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @throws SQLException if parameterIndex does not correspond - * to a parameter marker in the SQL statement, or if the length specified - * is less than zero; if the number of bytes in the inputstream does not match - * the specfied length; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * - */ - public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException - { - validateStatement(); - statement_.setBlob(statement_.findParameterIndex(parameterName), inputStream, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a InputStream object. - * This method differs from the setBinaryStream (int, InputStream) - * method because it informs the driver that the parameter value should be - * sent to the server as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be send to the server as a LONGVARBINARY or a BLOB - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setBlob which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param inputStream An object that contains the data to set the parameter - * value to. - * @throws SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - */ - public void setBlob(String parameterName, InputStream inputStream) throws SQLException - { - validateStatement(); - statement_.setBlob(statement_.findParameterIndex(parameterName), inputStream); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java boolean value. - * The driver converts this - * to an SQL BIT or BOOLEAN value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #getBoolean - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setBoolean(String parameterName, boolean x) throws SQLException - { - validateStatement(); - statement_.setBoolean(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java byte value. - * The driver converts this - * to an SQL TINYINT value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getByte - */ - public void setByte(String parameterName, byte x) throws SQLException - { - validateStatement(); - statement_.setByte(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java array of bytes. - * The driver converts this to an SQL VARBINARY or - * LONGVARBINARY (depending on the argument's size relative - * to the driver's limits on VARBINARY values) when it sends - * it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getBytes - */ - public void setBytes(String parameterName, byte[] x) throws SQLException - { - validateStatement(); - statement_.setBytes(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter in this RowSet object's command - * to the given Reader - * object. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setCharacterStream which takes a length parameter. - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param reader the java.io.Reader object that contains the - * Unicode data - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException - { - validateStatement(); - statement_.setCharacterStream(parameterIndex, reader); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterName the name of the parameter - * @param reader the java.io.Reader object that - * contains the UNICODE data used as the designated parameter - * @param length the number of characters in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException - { - validateStatement(); - statement_.setCharacterStream(statement_.findParameterIndex(parameterName), reader, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Reader - * object. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setCharacterStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param reader the java.io.Reader object that contains the - * Unicode data - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setCharacterStream(String parameterName, Reader reader) throws SQLException - { - validateStatement(); - statement_.setCharacterStream(statement_.findParameterIndex(parameterName), reader); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the PreparedStatement is executed. - *This method differs from the setCharacterStream (int, Reader, int) method - * because it informs the driver that the parameter value should be sent to - * the server as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARCHAR or a CLOB - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if a database access error occurs, this method is called on - * a closed PreparedStatement, if parameterIndex does not correspond to a parameter - * marker in the SQL statement, or if the length specified is less than zero. - * - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this metho - */ - public void setClob(int parameterIndex, Reader reader, long length) throws SQLException - { - validateStatement(); - statement_.setClob(parameterIndex, reader, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the server as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARCHAR or a CLOB - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setClob which takes a length parameter. - * - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if a database access error occurs, this method is called on - * a closed PreparedStatementor if parameterIndex does not correspond to a parameter - * marker in the SQL statement - * - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setClob(int parameterIndex, Reader reader) throws SQLException - { - validateStatement(); - statement_.setClob(parameterIndex, reader); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Clob object. - * The driver converts this to an SQL CLOB value when it - * sends it to the database. - * - * @param parameterName the name of the parameter - * @param x a Clob object that maps an SQL CLOB value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setClob(String parameterName, Clob x) throws SQLException - { - validateStatement(); - statement_.setClob(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the CallableStatement is executed. - * This method differs from the setCharacterStream (int, Reader, int) method - * because it informs the driver that the parameter value should be sent to - * the server as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be send to the server as a LONGVARCHAR or a CLOB - * @param parameterName the name of the parameter to be set - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if the length specified is less than zero; - * a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * - */ - public void setClob(String parameterName, Reader reader, long length) throws SQLException - { - validateStatement(); - statement_.setClob(statement_.findParameterIndex(parameterName), reader, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the server as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be send to the server as a LONGVARCHAR or a CLOB - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setClob which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if a database access error occurs or this method is called on - * a closed CallableStatement - * - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setClob(String parameterName, Reader reader) throws SQLException - { - validateStatement(); - statement_.setClob(statement_.findParameterIndex(parameterName), reader); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Date value, - * using the given Calendar object. The driver uses - * the Calendar object to construct an SQL DATE value, - * which the driver then sends to the database. With a - * a Calendar object, the driver can calculate the date - * taking into account a custom timezone. If no - * Calendar object is specified, the driver uses the default - * timezone, which is that of the virtual machine running the application. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @param cal the Calendar object the driver will use - * to construct the date - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getDate - */ - public void setDate(String parameterName, Date x, Calendar cal) throws SQLException - { - validateStatement(); - statement_.setDate(statement_.findParameterIndex(parameterName), x, cal); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Date value - * using the default time zone of the virtual machine that is running - * the application. - * The driver converts this - * to an SQL DATE value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getDate - */ - public void setDate(String parameterName, Date x) throws SQLException - { - validateStatement(); - statement_.setDate(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java double value. - * The driver converts this - * to an SQL DOUBLE value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getDouble - */ - public void setDouble(String parameterName, double x) throws SQLException - { - validateStatement(); - statement_.setDouble(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java float value. - * The driver converts this - * to an SQL FLOAT value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getFloat - */ - public void setFloat(String parameterName, float x) throws SQLException - { - validateStatement(); - statement_.setFloat(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java int value. - * The driver converts this - * to an SQL INTEGER value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getInt - */ - public void setInt(String parameterName, int x) throws SQLException - { - validateStatement(); - statement_.setInt(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java long value. - * The driver converts this - * to an SQL BIGINT value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getLong - */ - public void setLong(String parameterName, long x) throws SQLException - { - validateStatement(); - statement_.setLong(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter in this RowSet object's command - * to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNCharacterStream which takes a length parameter. - * - * @param parameterIndex of the first parameter is 1, the second is 2, ... - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur ; if a database access error occurs; or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException - { - validateStatement(); - statement_.setNCharacterStream(parameterIndex, value); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - - *

Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNCharacterStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur ; if a database access error occurs; or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setNCharacterStream(String parameterName, Reader value) throws SQLException - { - validateStatement(); - statement_.setNCharacterStream(statement_.findParameterIndex(parameterName), value); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the PreparedStatement is executed. - * This method differs from the setCharacterStream (int, Reader, int) method - * because it informs the driver that the parameter value should be sent to - * the server as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGNVARCHAR or a NCLOB - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if the length specified is less than zero; - * if the driver does not support national character sets; - * if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - */ - public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException - { - validateStatement(); - statement_.setNClob(parameterIndex, reader, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the server as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGNVARCHAR or a NCLOB - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNClob which takes a length parameter. - * - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; - * if the driver does not support national character sets; - * if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - */ - public void setNClob(int parameterIndex, Reader reader) throws SQLException - { - validateStatement(); - statement_.setNClob(parameterIndex, reader); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the CallableStatement is executed. - * This method differs from the setCharacterStream (int, Reader, int) method - * because it informs the driver that the parameter value should be sent to - * the server as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be send to the server as a LONGNVARCHAR or a NCLOB - * - * @param parameterName the name of the parameter to be set - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if the length specified is less than zero; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setNClob(String parameterName, Reader reader, long length) throws SQLException - { - validateStatement(); - statement_.setNClob(statement_.findParameterIndex(parameterName), reader, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the server as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be send to the server as a LONGNVARCHAR or a NCLOB - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNClob which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if the driver does not support national character sets; - * if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - */ - public void setNClob(String parameterName, Reader reader) throws SQLException - { - validateStatement(); - statement_.setNClob(statement_.findParameterIndex(parameterName), reader); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to SQL NULL. - * This version of the method setNull should - * be used for user-defined types and REF type parameters. Examples - * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and - * named array types. - * - *

Note: To be portable, applications must give the - * SQL type code and the fully-qualified SQL type name when specifying - * a NULL user-defined or REF parameter. In the case of a user-defined type - * the name is the type name of the parameter itself. For a REF - * parameter, the name is the type name of the referenced type. If - * a JDBC driver does not need the type code or type name information, - * it may ignore it. - * - * Although it is intended for user-defined and Ref parameters, - * this method may be used to set a null parameter of any JDBC type. - * If the parameter does not have a user-defined or REF type, the given - * typeName is ignored. - * - * - * @param parameterName the name of the parameter - * @param sqlType a value from java.sql.Types - * @param typeName the fully-qualified name of an SQL user-defined type; - * ignored if the parameter is not a user-defined type or - * SQL REF value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setNull(String parameterName, int sqlType, String typeName) throws SQLException - { - validateStatement(); - statement_.setNull(statement_.findParameterIndex(parameterName), sqlType, typeName); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to SQL NULL. - * - *

Note: You must specify the parameter's SQL type. - * - * @param parameterName the name of the parameter - * @param sqlType the SQL type code defined in java.sql.Types - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setNull(String parameterName, int sqlType) throws SQLException - { - validateStatement(); - statement_.setNull(statement_.findParameterIndex(parameterName), sqlType); - } - - //@PDA jdbc40 - /** - * Sets the value of the designated parameter with the given object. The second - * argument must be an object type; for integral values, the - * java.lang equivalent objects should be used. - * - *

The given Java object will be converted to the given targetSqlType - * before being sent to the database. - * - * If the object has a custom mapping (is of a class implementing the - * interface SQLData), - * the JDBC driver should call the method SQLData.writeSQL to write it - * to the SQL data stream. - * If, on the other hand, the object is of a class implementing - * Ref, Blob, Clob, NClob, - * Struct, java.net.URL, - * or Array, the driver should pass it to the database as a - * value of the corresponding SQL type. - *

- * Note that this method may be used to pass datatabase- - * specific abstract data types. - * - * @param parameterName the name of the parameter - * @param x the object containing the input parameter value - * @param targetSqlType the SQL type (as defined in java.sql.Types) to be - * sent to the database. The scale argument may further qualify this type. - * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types, - * this is the number of digits after the decimal point. For all other - * types, this value will be ignored. - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if targetSqlType is - * a ARRAY, BLOB, CLOB, - * DATALINK, JAVA_OBJECT, NCHAR, - * NCLOB, NVARCHAR, LONGNVARCHAR, - * REF, ROWID, SQLXML - * or STRUCT data type and the JDBC driver does not support - * this data type - * @see Types - * @see #getObject - */ - public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException - { - validateStatement(); - statement_.setObject(statement_.findParameterIndex(parameterName), x, targetSqlType, scale); - } - - //@PDA jdbc40 - /** - * Sets the value of the designated parameter with the given object. - * This method is like the method setObject - * above, except that it assumes a scale of zero. - * - * @param parameterName the name of the parameter - * @param x the object containing the input parameter value - * @param targetSqlType the SQL type (as defined in java.sql.Types) to be - * sent to the database - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if targetSqlType is - * a ARRAY, BLOB, CLOB, - * DATALINK, JAVA_OBJECT, NCHAR, - * NCLOB, NVARCHAR, LONGNVARCHAR, - * REF, ROWID, SQLXML - * or STRUCT data type and the JDBC driver does not support - * this data type - * @see #getObject - */ - public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException - { - validateStatement(); - statement_.setObject(statement_.findParameterIndex(parameterName), x, targetSqlType); - } - - //@PDA jdbc40 - /** - * Sets the value of the designated parameter with the given object. - * The second parameter must be of type Object; therefore, the - * java.lang equivalent objects should be used for built-in types. - * - *

The JDBC specification specifies a standard mapping from - * Java Object types to SQL types. The given argument - * will be converted to the corresponding SQL type before being - * sent to the database. - * - *

Note that this method may be used to pass datatabase- - * specific abstract data types, by using a driver-specific Java - * type. - * - * If the object is of a class implementing the interface SQLData, - * the JDBC driver should call the method SQLData.writeSQL - * to write it to the SQL data stream. - * If, on the other hand, the object is of a class implementing - * Ref, Blob, Clob, NClob, - * Struct, java.net.URL, - * or Array, the driver should pass it to the database as a - * value of the corresponding SQL type. - *

- * This method throws an exception if there is an ambiguity, for example, if the - * object is of a class implementing more than one of the interfaces named above. - * - * @param parameterName the name of the parameter - * @param x the object containing the input parameter value - * @exception SQLException if a database access error occurs, - * this method is called on a closed CallableStatement or if the given - * Object parameter is ambiguous - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getObject - */ - public void setObject(String parameterName, Object x) throws SQLException - { - validateStatement(); - statement_.setObject(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java short value. - * The driver converts this - * to an SQL SMALLINT value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getShort - */ - public void setShort(String parameterName, short x) throws SQLException - { - validateStatement(); - statement_.setShort(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java String value. - * The driver converts this - * to an SQL VARCHAR or LONGVARCHAR value - * (depending on the argument's - * size relative to the driver's limits on VARCHAR values) - * when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getString - */ - public void setString(String parameterName, String x) throws SQLException - { - validateStatement(); - statement_.setString(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Time value, - * using the given Calendar object. The driver uses - * the Calendar object to construct an SQL TIME value, - * which the driver then sends to the database. With a - * a Calendar object, the driver can calculate the time - * taking into account a custom timezone. If no - * Calendar object is specified, the driver uses the default - * timezone, which is that of the virtual machine running the application. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @param cal the Calendar object the driver will use - * to construct the time - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getTime - */ - public void setTime(String parameterName, Time x, Calendar cal) throws SQLException - { - validateStatement(); - statement_.setTime(statement_.findParameterIndex(parameterName), x, cal); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Time value. - * The driver converts this - * to an SQL TIME value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getTime - */ - public void setTime(String parameterName, Time x) throws SQLException - { - validateStatement(); - statement_.setTime(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Timestamp value, - * using the given Calendar object. The driver uses - * the Calendar object to construct an SQL TIMESTAMP value, - * which the driver then sends to the database. With a - * a Calendar object, the driver can calculate the timestamp - * taking into account a custom timezone. If no - * Calendar object is specified, the driver uses the default - * timezone, which is that of the virtual machine running the application. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @param cal the Calendar object the driver will use - * to construct the timestamp - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getTimestamp - */ - public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException - { - validateStatement(); - statement_.setTimestamp(statement_.findParameterIndex(parameterName), x, cal); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Timestamp value. - * The driver - * converts this to an SQL TIMESTAMP value when it sends it to the - * database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getTimestamp - */ - public void setTimestamp(String parameterName, Timestamp x) throws SQLException - { - validateStatement(); - statement_.setTimestamp(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.net.URL value. - * The driver converts this to an SQL DATALINK value - * when it sends it to the database. - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the java.net.URL object to be set - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setURL(int parameterIndex, URL x) throws SQLException - { - validateStatement(); - statement_.setURL(parameterIndex, x); - } - - //@PDA jdbc40 - /** - * Updates the designated column with an ascii stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateAsciiStream which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException - { - validateResultSet(); - resultSet_.updateAsciiStream (columnIndex, x); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column with an ascii stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateAsciiStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if the columnLabel is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException - { - validateResultSet(); - resultSet_.updateAsciiStream (columnLabel, x); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a binary stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBinaryStream which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException - { - validateResultSet(); - resultSet_.updateBinaryStream(columnIndex, x); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a binary stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBinaryStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if the columnLabel is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException - { - validateResultSet(); - resultSet_.updateBinaryStream(columnLabel, x); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBlob which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param inputStream An object that contains the data to set the parameter - * value to. - * @exception SQLException if the columnIndex is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException - { - validateResultSet(); - resultSet_.updateBlob(columnIndex, inputStream); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBlob which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param inputStream An object that contains the data to set the parameter - * value to. - * @exception SQLException if the columnLabel is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException - { - validateResultSet(); - resultSet_.updateBlob(columnLabel, inputStream); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateCharacterStream which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateCharacterStream(int columnIndex, Reader x) throws SQLException - { - validateResultSet(); - resultSet_.updateCharacterStream(columnIndex, x); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateCharacterStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @exception SQLException if the columnLabel is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException - { - validateResultSet(); - resultSet_.updateCharacterStream (columnLabel, reader); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given Reader - * object. - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateClob which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateClob(int columnIndex, Reader reader) throws SQLException - { - validateResultSet(); - resultSet_.updateClob(columnIndex, reader); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given Reader - * object. - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateClob which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @exception SQLException if the columnLabel is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateClob(String columnLabel, Reader reader) throws SQLException - { - validateResultSet(); - resultSet_.updateClob (columnLabel, reader); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNCharacterStream which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException - { - validateResultSet(); - resultSet_.updateNCharacterStream (columnIndex, x); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNCharacterStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @exception SQLException if the columnLabel is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException - { - validateResultSet(); - resultSet_.updateNCharacterStream (columnLabel, reader); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given Reader - * - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNClob which takes a length parameter. - * - * @param columnIndex the first column is 1, the second 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if the columnIndex is not valid; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob(int columnIndex, Reader reader) throws SQLException - { - validateResultSet(); - resultSet_.updateNClob(columnIndex, reader); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given Reader - * object. - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

- * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNClob which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if the columnLabel is not valid; if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set; - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob(String columnLabel, Reader reader) throws SQLException - { - validateResultSet(); - resultSet_.updateNClob(columnLabel, reader); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCSQLXML.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCSQLXML.java deleted file mode 100644 index b1ea7608f..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCSQLXML.java +++ /dev/null @@ -1,1151 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCSQLXML.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.io.Writer; -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -/* ifdef JDBC40 */ -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLOutputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; -/* endif */ -import javax.xml.transform.Result; -/* ifdef JDBC40 */ -import javax.xml.transform.Source; -/* endif */ -import javax.xml.transform.dom.DOMResult; -/* ifdef JDBC40 */ -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.sax.SAXSource; -import javax.xml.transform.stax.StAXResult; -import javax.xml.transform.stax.StAXSource; -import org.xml.sax.InputSource; -/* endif */ - -import javax.xml.parsers.ParserConfigurationException; -/* ifdef JDBC40 */ -import org.xml.sax.SAXException; - -import org.w3c.dom.DOMImplementation; -import org.w3c.dom.ls.DOMImplementationLS; -import org.w3c.dom.ls.LSSerializer; -/* endif */ -//@PDA jdbc40 new class -//@xml2 whole class is redesigned after that of The Native Driver -/** -This class provides the object interface for using XML data through JDBC. -The mapping in the Java programming language for the SQL XML type. -XML is a built-in type that stores an XML value as a column value in a row of a database table. -The SQLXML interface provides methods for accessing the XML value as a String, a Reader or Writer, or as a Stream. -This class returns the data as an XML type. The actual type on the host may vary. -Instances of this class are created by AS400JDBCConnection. -This class should not be used if JDK 1.6 is not in use. -**/ -public class AS400JDBCSQLXML -/* ifdef JDBC40 */ -implements SQLXML -/* endif */ - -{ - - static final int MAX_XML_SIZE = AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; //@xml3 - // We may internally store the SQLXML object as a DOM document - // if getResult was used to create the object - static final int DOM_DOCUMENT = 22345; - static final int LOB_FREED = 0; - int lobType = LOB_FREED; //corresponding to SQLData numbers - - AS400JDBCClob clobValue_ = null; - AS400JDBCBlob blobValue_ = null; - AS400JDBCClobLocator clobLocatorValue_ = null; - AS400JDBCBlobLocator blobLocatorValue_ = null; - - /* Document available in JDK 1.4, so this cannot be moved back to */ - /* V5R4 which still supports JDK 1.3. In V5R4, this will need to */ - /* be JDBC 4.0 only */ - org.w3c.dom.Document domDocument_ = null; - - //Today, the only case where isXML_ can be true is if this is a AS400JDBCSQLXMLLocator - //(since xml columns are always returned as locators from hostserver) - protected boolean isXML_ = false; //@xml4 true if this data originated from a native XML column type - - /** - * Constructs an AS400JDBCSQLXML object. This is only a dummy constructor used by subclasses. - */ - protected AS400JDBCSQLXML() - { - } - - /** - * Constructs an AS400JDBCSQLXML object. The data is contained - * in the String. No further communication with the IBM i system is necessary. - * - * @param data The SQLXML data. - * @param maxLength Max length. - */ - AS400JDBCSQLXML(String data, int maxLength) - { - isXML_ = true;//@xmltrim (match native jdbc for trimming xml decl if using sqlxml) - - lobType = SQLData.CLOB; - clobValue_ = new AS400JDBCClob(data, maxLength, isXML_); //@xmltrim - - } - - /** - * Constructs an AS400JDBCSQLXML object. The data is contained - * in the String. No further communication with the IBM i system is necessary. - * - * @param data The SQLXML data. - */ - AS400JDBCSQLXML(char[] data) - { - isXML_ = true;//@xmltrim (match native jdbc for trimming xml decl if using sqlxml) - - lobType = SQLData.CLOB; - clobValue_ = new AS400JDBCClob(data, isXML_); //@xmltrim - } - - - /** - * Constructs an AS400JDBCSQLXML object. The data is contained - * in the array. No further communication with the IBM i system is necessary. - * This constructor is used for returning blob data in an XML object. - * - * @param data The SQLXML data. - * @param maxLength Max length. - */ - AS400JDBCSQLXML (byte [] data, long maxLength) - { - isXML_ = true;//@xmltrim (match native jdbc for trimming xml decl if using sqlxml) - - lobType = SQLData.BLOB; - blobValue_ = new AS400JDBCBlob(data, (int)maxLength); - } - - - /** - * Retrieves the XML value designated by this SQLXML instance as a java.io.Reader object. - * The format of this stream is defined by org.xml.sax.InputSource, - * where the characters in the stream represent the Unicode code points for - * XML according to section 2 and appendix B of the XML 1.0 specification. - * Although an encoding declaration other than Unicode may be present, - * the encoding of the stream is Unicode. - * The behavior of this method is the same as ResultSet.getCharacterStream() - * when the designated column of the ResultSet has a type java.sql.Types of SQLXML. - *

- * The SQL XML object becomes not readable when this method is called and - * may also become not writable depending on implementation. - * - * @return a stream containing the XML data. - * @exception SQLException if there is an error processing the XML value. - * The getCause() method of the exception may provide a more detailed exception, for example, - * if the stream does not contain valid characters. - * An exception is thrown if the state is not readable. - */ - public synchronized Reader getCharacterStream() throws SQLException - { - Reader r = null; - if (lobType == LOB_FREED) { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - return null; - } - - switch (lobType) - { - - case SQLData.CLOB: - case SQLData.DBCLOB: - r = clobValue_.getCharacterStream(); - break; - case SQLData.CLOB_LOCATOR: - case SQLData.DBCLOB_LOCATOR: - r = clobLocatorValue_.getCharacterStream(); - break; - case SQLData.BLOB: - case SQLData.BLOB_LOCATOR: - case DOM_DOCUMENT: - // Calling getString will do the appropriate conversion - String stringValue = this.getString(); - r = new StringReader(stringValue); - break; - default: - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, "Invalid value: "+ lobType); - return null; - } - } - - return r; - } - - - /** - * Retrieves a string representation of the XML value designated by this - * SQLXML object. - * @return a String that is the string representation of the XML value - * @throws SQLException if there is an error accessing the XML value - */ - public synchronized String getString() throws SQLException - { - String s = null; - - switch (lobType) - { - case SQLData.DBCLOB: - case SQLData.CLOB: - s = clobValue_.getSubString((long) 1, (int) clobValue_.length()); - break; - case SQLData.DBCLOB_LOCATOR: - case SQLData.CLOB_LOCATOR: - s = clobLocatorValue_.getSubString((long) 1, (int) clobLocatorValue_.length()); - break; - case SQLData.BLOB: - case SQLData.BLOB_LOCATOR: - - // Check for a byte order mark - String encoding; - int byteOrderMarkSize = 0; - byte[] bytes = null; - if (lobType == SQLData.BLOB) - { - if(blobValue_.length() > 4)//@xmlzero - bytes = blobValue_.getBytes(1, 4); - else - bytes = new byte[0]; //@xmlzero - - } else - { - InputStream is = blobLocatorValue_.getBinaryStream(); - bytes = new byte[4]; - try - { - int bytesRead = is.read(bytes); - if (bytesRead == 0) - bytes = new byte[0]; - } catch (Exception e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL); - return null; - }finally - { - try{ - is.close(); - }catch(Exception e){ } - } - } - if (bytes.length < 4) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - if ((bytes[0] == (byte) 0xEF) && (bytes[1] == (byte) 0xBB) - && (bytes[2] == (byte) 0xBF)) - { - encoding = "UTF-8"; - byteOrderMarkSize = 3; - } else if ((bytes[0] == (byte) 0xFE) - && (bytes[1] == (byte) 0xFF)) - { - encoding = "UTF-16BE"; - byteOrderMarkSize = 2; - } else if ((bytes[0] == (byte) 0xFF) - && (bytes[1] == (byte) 0xFE)) - { - encoding = "UTF-16LE"; - byteOrderMarkSize = 2; - } else - { - // We don't support the UCS-4 variants. In the future, we - // may need to. - - // In this case we need to peek at the stream to determine - // which format it is in. - // At a minimum, we expect it to begin with '<' (after - // ignoring possible white space) - // - int position = 1; - byte nonWhiteSpaceByte = 0x20; - int i = 0; - while (nonWhiteSpaceByte == 0x20) - { - // Get the first few bytes of the blob in order to - // determine the encoding to use. - long len = -1; - if (lobType == SQLData.BLOB) - { - len = blobValue_.length(); - if(len > 80) - len = 80; - bytes = blobValue_.getBytes(position, (int)len); - } else - { - InputStream is = blobLocatorValue_.getBinaryStream(); - bytes = new byte[80]; - try - { - int bytesRead = is.read(bytes); - if (bytesRead == 0) - bytes = new byte[0]; - } catch (Exception e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL); - return null; - }finally - { - try{ - is.close(); - }catch(Exception e){ } - } - } - position += len-1; - if (bytes.length == 0) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - while (i < bytes.length - 1 - && ((bytes[i] == 0x20) || (bytes[i] == 0x40) || /* space */ - (bytes[i] == 0x09) || (bytes[i] == 0x05) || /* tab */ - (bytes[i] == 0x0d) || /* CR */ - (bytes[i] == 0x0a) || bytes[i] == 0x15 /* LF */ - || bytes[i] == 0)) - { - if (bytes[i] == 0) - { - i++; - if ((bytes[i] == 0x20) || /* space */ - (bytes[i] == 0x09) || /* table */ - (bytes[i] == 0x0d) || /* CR */ - (bytes[i] == 0x0a)) /* LF */ - { - i++; - } else - { - i--; - nonWhiteSpaceByte = 0; - break; - } - } else - { - // If LE encoding.. - if (bytes[i + 1] == 0) - { - i++; - } - i++; - } - } - if (i < (bytes.length - 1)) - nonWhiteSpaceByte = bytes[i]; - } /* while looking for nonspace byte */ - /* We need to look at the next byte */ - byte nextByte; - i++; - nextByte = bytes[i]; - - // Determine what the encoding is - if (nonWhiteSpaceByte == 0x3c) - { - if (nextByte == 0x00) - { - encoding = "UTF-16LE"; - } else - { - encoding = "UTF-8"; - } - } else if (nonWhiteSpaceByte == 0x00) - { - if (nextByte == 0x3c) - { - encoding = "UTF-16BE"; - } else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - } else if (nonWhiteSpaceByte == 0x4C /* < */) - { - // - // Determine the internal encoding. If it cannot be - // determined then use CCSID 37 - - encoding = getInternalEncodingFromEbcdic(bytes); - if (encoding == null) - { - encoding = "IBM-37"; - } - - } else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } // checking first byte - } // determine encoding - // At this point the encoding is set and we can obtain the - // string - InputStream stream = null; - BufferedReader reader = null; - StringBuffer sb = new StringBuffer(); - try - { - if (lobType == SQLData.BLOB) - { - stream = blobValue_.getBinaryStream(); - } else - { - stream = blobLocatorValue_.getBinaryStream(); - } - while (byteOrderMarkSize > 0) - { - try - { - stream.read(); - } catch ( IOException ioex) - { - // shouldn't ever happen since we've already looked at - // this. - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - byteOrderMarkSize--; - } - - try - { - reader = new BufferedReader(new InputStreamReader(stream, - encoding)); - } catch (UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - - String line; - try - { - line = reader.readLine(); - if (line != null) - { - sb.append(line); - } - line = reader.readLine(); - while (line != null) - { - sb.append("\n"); - sb.append(line); - line = reader.readLine(); - } - } catch (IOException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - } catch (Exception e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL); - return null; - }finally - { - try{ - stream.close(); - }catch(Exception e){ } - try{ - reader.close(); - }catch(Exception e){ } - } - s = sb.toString(); - - break; // end of BLOB case -/* ifdef JDBC40 */ - case DOM_DOCUMENT: - - DOMImplementation implementation = domDocument_.getImplementation(); - - DOMImplementationLS domImplementationLS = (DOMImplementationLS) implementation - .getFeature("LS", "3.0"); - LSSerializer lsSerializer = domImplementationLS.createLSSerializer(); - s = lsSerializer.writeToString(domDocument_); - - break; -/* endif */ - - case 0: - //freed already - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - return null; - default: - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, "Invalid value: "+ lobType); - return null; - } - } - if(isXML_)//@xmltrim - return JDUtilities.stripXMLDeclaration(s); //@xmltrim - else - return s; - } - - - /** - Retrieves the internal encoding specified in the bytes that represent the beginning of an - XML document. If no internal encoding is present, then null is returned. - **/ - private String getInternalEncodingFromEbcdic(byte[] bytes) - { - /* EBCDIC encoding for CCSID 37 and CCSID 290 for "encoding=" */ - final byte[][] encodingPattern = - { - { (byte) 0x85, (byte) 0x95, (byte) 0x83, (byte) 0x96, - (byte) 0x84, (byte) 0x89, (byte) 0x95, (byte) 0x87 }, - { (byte) 0x66, (byte) 0x76, (byte) 0x64, (byte) 0x77, - (byte) 0x65, (byte) 0x71, (byte) 0x76, (byte) 0x68 } }; - String[] encodingName = { "IBM-37", "IBM-930" }; //@ibm-290 not supported - - String encoding = null; - int i = 0; - int length = bytes.length; - while (bytes[i] != 0x4c && i < length) - { - i++; - } - i++; //one more - int currentPattern = -1; - int patternPosition = 0; - while (encoding == null && i < length && bytes[i] != 0x6e ) - { - if (currentPattern < 0) - { - for (int j = 0; j < encodingPattern.length - && currentPattern < 0; j++) - { - if (bytes[i] == encodingPattern[j][0]) - { - currentPattern = j; - patternPosition = 1; - } - } - } else - { - if (patternPosition == encodingPattern[currentPattern].length) - { - // Pick the encoding for the string to obtain the pattern - // from withing the string - encoding = encodingName[currentPattern]; - // skip space - - while (bytes[i] == 0x40 && i < length) - i++; - // make sure = is found. = is invariant at 0x7e - if (bytes[i] == 0x7e && i < length) - { - i++; - // Skip space - while (bytes[i] == 0x40 && i < length) - { - i++; - } - // Make sure " is found. " is invariant at 0x7f except - // for - // code pages 905 and 1026 (turkey) where it is found at - // 0xfc - if ((bytes[i] == 0x7f || ((0xff & bytes[i]) == 0xfc)) - && (i < length)) - { - i++; - // Find the ending quote - int endingQuote = i; - while (bytes[endingQuote] != 0x7f - && (( 0xFF & bytes[endingQuote]) != 0xfc) - && endingQuote < length) - { - endingQuote++; - } - if (endingQuote < length) - { - // Create a string from the bytes and return the - // encoding - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream( - bytes, i, endingQuote - i); - - BufferedReader reader = null; - try - { - reader = new BufferedReader( - new InputStreamReader( - byteArrayInputStream, - encodingName[currentPattern])); - encoding = reader.readLine(); - } catch (UnsupportedEncodingException e) - { - // Should never get here since the encoding should be valid - currentPattern = -1; - } catch (IOException e) - { - // Should never get here since we should get io exception on a byteArrayInputStream - currentPattern = -1; - }finally - { - try{ - byteArrayInputStream.close(); - }catch(Exception e){ } - try{ - reader.close(); - }catch(Exception e){ } - } - - } else - { - currentPattern = -1; - } - } else - { - currentPattern = -1; - } - } else - { - currentPattern = -1; - } - - } else - { - if (bytes[i] == encodingPattern[currentPattern][patternPosition]) - { - patternPosition++; - } else - { - currentPattern = -1; - } - } - } - i++; - } - - return encoding; - } - - /** - * Writes the given Java String to the XML value that this SQLXML object designates. - * @param str the string to be written to the XML value that this SQLXML designates - * @throws SQLException if there is an error accessing the XML value - */ - public synchronized void setString(String str) throws SQLException - { - freeInternals(); - if(lobType == LOB_FREED) - { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - } - - clobValue_ = new AS400JDBCClob(str, str.length()); - - lobType = SQLData.CLOB; - } - - - /** - Package level helper method. Only valid on Clob-like data. - Writes a String to this XML, starting at position position in the XML. - The XML will be truncated after the last character written. The lengthOfWrite - characters written will start from offset in the string that was provided by the - application. - - @param position The position (1-based) in the XML where writes should start. - @param string The string that will be written to the XML. - @param offset The offset into string to start reading characters (0-based). - @param lengthOfWrite The number of characters to write. - @return The number of characters written. - - @exception SQLException If there is an error - **/ - synchronized int setString(long position, String string, int offset, int lengthOfWrite) throws SQLException - { - switch (lobType) - { - case SQLData.DBCLOB: - case SQLData.CLOB: - return clobValue_.setString(position, string, offset, lengthOfWrite); - case SQLData.DBCLOB_LOCATOR: - case SQLData.CLOB_LOCATOR: - return clobLocatorValue_.setString(position, string, offset, lengthOfWrite); - default: - JDError.throwSQLException(this, JDError.EXC_INTERNAL, "Invalid value: "+ lobType); - return 0; - } - - - } - - - /** - * Retrieves the XML value designated by this SQLXML instance as a stream. - * @return a stream containing the XML data. - * @throws SQLException if there is an error processing the XML value. - * An exception is thrown if the state is not readable. - */ - public InputStream getBinaryStream() throws SQLException - { - InputStream is = null; - switch (lobType) - { - case SQLData.DBCLOB: - case SQLData.CLOB: - try - { - // Check for an internal encoding in the string. If there is - // one, we must use it - String clobString = new String(clobValue_.data_); - String internalEncoding = getInternalEncoding(clobString); - if (internalEncoding != null) - { - is = new ByteArrayInputStream(clobString.getBytes(internalEncoding)); - } else - { - is = new ByteArrayInputStream(clobString.getBytes("UTF-8")); - } - } catch (UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } - break; - case SQLData.DBCLOB_LOCATOR: - case SQLData.CLOB_LOCATOR: - //This will also be the case for XML column data - if(isXML_) //@xml6 if xml column and thus also a locator, then get bytes from bloblocator code - is = blobLocatorValue_.getBinaryStream(); //@xml6 (no trim of XML declaration because it is binary) - else - { - - try - { - // Check for an internal encoding in the string. If there is - // one, we must use it - String clobString = clobLocatorValue_.getSubString((long)1, (int)clobLocatorValue_.length()); - String internalEncoding = getInternalEncoding(clobString); - if (internalEncoding != null) - { - is = new ByteArrayInputStream(clobString.getBytes(internalEncoding)); - } else - { - is = new ByteArrayInputStream(clobString.getBytes("UTF-8")); - } - } catch (UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } - } - break; - case SQLData.BLOB: - // - // In this case, we rely on the binary stream to identify its own encoding - // It appears the that binary encoding will be used the most.. However, - // this is not useful from a DB perspective since it cannot be searched. - // - is = blobValue_.getBinaryStream(); - - break; - case SQLData.BLOB_LOCATOR: - // - // In this case, we rely on the binary stream to identify its own encoding - // It appears the that binary encoding will be used the most.. However, - // this is not useful from a DB perspective since it cannot be searched. - // - is = blobLocatorValue_.getBinaryStream(); - - break; - // Obtain a stream from a dom document by first converting it to - // a String and then getting the UTF-8 representation - case DOM_DOCUMENT: - try - { - String string = this.getString(); - is = new ByteArrayInputStream(string.getBytes("UTF-8")); - - } catch (UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } - - break; - default: - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, "Invalid value: "+ lobType); - return null; - } - } - return is; - } - - - - /** - * Returns a Source for reading the XML value designated by this SQLXML instance. - * Sources are used as inputs to XML parsers and XSLT transformers. - * @param sourceClass The class of the source, or null. - * If the class is null, a vendor specific Source implementation will be returned. - * The following classes are supported at a minimum: - *

-      *   javax.xml.transform.dom.DOMSource - returns a DOMSource
-      *   javax.xml.transform.sax.SAXSource - returns a SAXSource
-      *   javax.xml.transform.stax.StAXSource - returns a StAXSource
-      *   javax.xml.transform.stream.StreamSource - returns a StreamSource
-      * 
- * @return a Source for reading the XML value. - * @throws SQLException if there is an error processing the XML value - * or if this feature is not supported. - * The getCause() method of the exception may provide a more detailed exception, for example, - * if an XML parser exception occurs. - * An exception is thrown if the state is not readable. - */ -/* ifdef JDBC40 */ - public synchronized T getSource(Class sourceClass) throws SQLException - { - String classname; - if (sourceClass == null) - { - classname = "javax.xml.transform.stream.StreamSource"; - } else - { - classname = sourceClass.getName(); - } - - if (lobType == LOB_FREED) - { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - return null; - } - - if (classname.equals("javax.xml.transform.dom.DOMSource")) - { - try - { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder parser = factory.newDocumentBuilder(); - //parser.setErrorHandler(errorHandler); - org.w3c.dom.Document doc; - if (lobType == SQLData.CLOB //@clob - || lobType == SQLData.DBCLOB //@clob - || lobType == SQLData.CLOB_LOCATOR - || lobType == SQLData.DBCLOB_LOCATOR) - { - // Do something different for CLOB locators because - // getBinaryStream results in getAsciiStream which - // cannot be parsed if an internal encoding is present - doc = parser.parse(new InputSource(getCharacterStream())); - } else if (lobType == DOM_DOCUMENT) - { - doc = domDocument_; - } else - { - doc = parser.parse(getBinaryStream()); - } - return (T) new DOMSource(doc); - } catch (ParserConfigurationException e) - { - // This exception will probably not occur - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } catch (SAXException e) - { - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } catch (IOException e) - { - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } - } else if (classname.equals("javax.xml.transform.sax.SAXSource")) - { - InputSource inputSource = new InputSource(getCharacterStream()); - return (T) new javax.xml.transform.sax.SAXSource(inputSource); - } else if (classname.equals("javax.xml.transform.stax.StAXSource")) - { - try - { - XMLInputFactory inputFactory = XMLInputFactory.newInstance(); - XMLStreamReader xmlStreamReader; - xmlStreamReader = inputFactory.createXMLStreamReader(getCharacterStream()); - return (T) new StAXSource(xmlStreamReader); - } catch (XMLStreamException e) - { - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } - - } else if (classname.equals("javax.xml.transform.stream.StreamSource")) - { - return (T) new javax.xml.transform.stream.StreamSource( getCharacterStream()); - } else - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - } -/* endif */ - - /** - * Retrieves a stream that can be used to write the XML value that this SQLXML instance represents. - * @return a stream to which data can be written. - * @throws SQLException if there is an error processing the XML value. An exception - * is thrown if the state is not writable. - * @exception If there is an error - */ - public synchronized OutputStream setBinaryStream() throws SQLException - { - - if (lobType == LOB_FREED) - { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - return null; - } - - freeInternals(); - - if (blobValue_ == null) - { - byte[] dummy = new byte[0]; - blobValue_ = new AS400JDBCBlob(dummy, AS400JDBCBlob.MAX_LOB_SIZE); - } - lobType = SQLData.BLOB; - return blobValue_.setBinaryStream(1); - } - - /** - * Retrieves a Writer to be used to write the XML value that this SQLXML instance represents. - * @return a stream to which data can be written. - * @throws SQLException if there is an error processing the XML value. - * The getCause() method of the exception may provide a more detailed exception, for example, - * if the stream does not contain valid characters. - * An exception is thrown if the state is not writable. - * @exception If there is an error - */ - public synchronized Writer setCharacterStream() throws SQLException - { - if (lobType == LOB_FREED) { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - return null; - } - - freeInternals(); - - clobValue_ = new AS400JDBCClob("", AS400JDBCClob.MAX_LOB_SIZE); - lobType = SQLData.CLOB; - - return clobValue_.setCharacterStream(1L); - } - - /** - * Returns a Result for setting the XML value designated by this SQLXML instance. - * @param resultClass The class of the result, or null. - * If resultClass is null, a vendor specific Result implementation will be returned. - * The following classes are supported at a minimum: - *
-      *   javax.xml.transform.dom.DOMResult - returns a DOMResult
-      *   javax.xml.transform.sax.SAXResult - returns a SAXResult
-      *   javax.xml.transform.stax.StAXResult - returns a StAXResult
-      *   javax.xml.transform.stream.StreamResult - returns a StreamResult
-      * 
- * @return Returns a Result for setting the XML value. - * @throws SQLException if there is an error processing the XML value - * or if this feature is not supported. - * The getCause() method of the exception may provide a more detailed exception, for example, - * if an XML parser exception occurs. - * An exception is thrown if the state is not writable. - * @exception If there is an error - */ -/* ifdef JDBC40 */ - public synchronized T setResult(Class resultClass) throws SQLException - { - String classname; - if (resultClass == null) - { - classname = "javax.xml.transform.stream.StreamSource"; - } else - { - classname = resultClass.getName(); - } - - if (lobType == LOB_FREED) - { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - return null; - } - - if (classname.equals("javax.xml.transform.dom.DOMResult")) - { - try - { - - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder documentBuilder = factory.newDocumentBuilder(); - freeInternals(); - lobType = DOM_DOCUMENT; - domDocument_ = documentBuilder.newDocument(); - - return (T) new DOMResult(domDocument_); - - } catch (ParserConfigurationException e) - { - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } - } else if (classname.equals("javax.xml.transform.sax.SAXResult")) - { - - // - // TODO - // - // To get this to work, you would need to implement a SAX - // content handler to dump the handled information to the - // an output character stream - // - JDError.throwSQLException(this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - - } else if (classname.equals("javax.xml.transform.stax.StAXResult")) - { - try - { - XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); - XMLStreamWriter xmlStreamWriter; - xmlStreamWriter = outputFactory.createXMLStreamWriter(setCharacterStream()); - return (T) new StAXResult(xmlStreamWriter); - } catch (Exception e) - { - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } - } else if (classname.equals("javax.xml.transform.stream.StreamResult")) - { - return (T) new javax.xml.transform.stream.StreamResult(setCharacterStream()); - } else - { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - } - -/* endif */ - - /** - * This method frees the object and releases the - * the resources that it holds. The object is invalid once the - * free method is called. If free is called - * multiple times, the subsequent calls to free are treated - * as a no-op. - * - * @throws SQLException - * if an error occurs releasing the Clob's resources - */ - public synchronized void free() throws SQLException - { - freeInternals(); - lobType = LOB_FREED; - } - - - /** - * Free the internal representation used by the SQLXML. - * Call before setting a new type of internal representation - */ - private void freeInternals() throws SQLException - { - if (blobValue_ != null) - { - blobValue_.free(); - blobValue_ = null; - } - if (blobLocatorValue_ != null) - { - //blobLocatorValue_.free(); //@olddesc - blobLocatorValue_ = null; - } - - if (clobValue_ != null) - { -/* ifdef JDBC40 */ - clobValue_.free(); -/* endif */ - clobValue_ = null; - } - - if (clobLocatorValue_ != null) - { - //clobLocatorValue_.free();//@olddesc - clobLocatorValue_ = null; - } - - if (domDocument_ != null) - { - domDocument_ = null; - } - } - /** - * Retrieves the internal encoding specified in the string that represents - * an XML document. If no internal encoding is present, then null is - * returned. - */ - private String getInternalEncoding(String xml) - { - String encoding = null; - // find the first < - int start = xml.indexOf("<"); - if (start >= 0) - { - // find the ending > - int end = xml.indexOf(">", start); - if (end >= 0) - { - String piece = xml.substring(start, end + 1); - int encodingIndex = piece.indexOf("encoding="); - if (encodingIndex > 0) - { - int firstQuote = piece.indexOf("\"", encodingIndex); - if (firstQuote > 0) - { - int lastQuote = piece.indexOf("\"", firstQuote + 1); - if (lastQuote > 0) - { - return piece.substring(firstQuote + 1, lastQuote); - } - } - } - } - } - return encoding; - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCSQLXMLLocator.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCSQLXMLLocator.java deleted file mode 100644 index 659fefc2b..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCSQLXMLLocator.java +++ /dev/null @@ -1,125 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCSQLXMLLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2009 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/* ifdef JDBC40 */ -import java.io.InputStream; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; -import java.io.Writer; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.transform.Result; -import javax.xml.transform.Source; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.sax.SAXSource; -import javax.xml.transform.stax.StAXSource; - -import javax.xml.transform.stream.StreamSource; - -import org.w3c.dom.Document; -import org.xml.sax.InputSource; -/* endif */ - -//import com.sun.xml.internal.fastinfoset.stax.StAXDocumentParser; - - -//@PDA jdbc40 new class -//@xml2 whole class is redesigned after that of The Native Driver -/** -

The AS400JDBCSQLXMLLocator class provides the object interface for using XML data through JDBC. -The mapping in the Java programming language for the SQL XML type. -XML is a built-in type that stores an XML value as a column value in a row of a database table. -The SQLXML interface provides methods for accessing the XML value as a String, a Reader or Writer, or as a Stream. -**/ -public class AS400JDBCSQLXMLLocator extends AS400JDBCSQLXML -{ - - - - /** - Constructs an AS400JDBCSQLXMLLocator object of Clob/DBClob locator data. (This constructor signature is only - available on ClobLocator.) - This could be created as a result of an actual XML column or some other data type column and calling resultSet.getSQLXML() - The data for the - SQLXML will be retrieved as requested, directly from the - IBM i system, using the locator handle. - - @param locator The locator. - @param converter The text converter. - @param savedObject Saved Object. - @param savedScale Saved scale. - @param isXML Flag that stream is from an XML column type (needed to strip xml declaration) - **/ - AS400JDBCSQLXMLLocator(JDLobLocator locator, ConvTable converter, Object savedObject, int savedScale, boolean isXml) - { - super(); - //Since SQLXML has both text and binary getter methods, we need to preserve converter, but need to be able to get - //to the bits as binary without doing any conversion or trimming of XML declaration - - //Native JDBC changed to always trim off xml header if accessing data through SQLXML object even it column is not XML...(TB also will now do this) - isXml = true;//@xmltrim (match native jdbc for trimming xml decl if using sqlxml) - - clobLocatorValue_ = new AS400JDBCClobLocator( locator, converter, savedObject, savedScale, isXml); //@xml4 allow AS400JDBCClobLocator to trim off xml header if needed - if(isXml) - blobLocatorValue_ = new AS400JDBCBlobLocator( locator, savedObject, savedScale); //@xml6 also need ref to bloblocator in case SQLXML.getBinaryStream is called - - lobType = SQLData.CLOB_LOCATOR; - isXML_ = isXml; //@xml4 - } - - - /** - Constructs an AS400JDBCSQLXMLLocator object of BlobLocator data. (This constructor signature is only - available on BlobLocator.) - The data for the - BLOB will be retrieved as requested, directly from the - IBM i system, using the locator handle. - @param locator The locator. - @param savedObject Saved Object. - @param savedScale Saved scale. - **/ - AS400JDBCSQLXMLLocator(JDLobLocator locator, Object savedObject, int savedScale) - { - super(); - blobLocatorValue_ = new AS400JDBCBlobLocator( locator, savedObject, savedScale); - lobType = SQLData.BLOB_LOCATOR; - isXML_ = true;//@xmltrim (match native jdbc for trimming xml decl if using sqlxml) - } - - //@olddesc - /** - Returns the handle to this locator in the database. - - @return The handle to this locator in the databaes. - **/ - int getHandle()throws SQLException - { - - if(clobLocatorValue_ != null) - return clobLocatorValue_.getHandle(); - else if(blobLocatorValue_ != null) - return blobLocatorValue_.getHandle(); - else - return -1; //not set or updated by non-locator value and not needed - - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCStatement.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCStatement.java deleted file mode 100644 index bef86385d..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCStatement.java +++ /dev/null @@ -1,3998 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCStatement.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.math.BigDecimal; -import java.sql.BatchUpdateException; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.Statement; -import java.util.Enumeration; -import java.util.Vector; - - - -// @E6C - Changed javadoc paragraph about thread-safety. -/** -

The AS400JDBCStatement class provides a mechanism for -executing static SQL statements. Use Connection.createStatement() -to create new Statement objects. - -

Only one result set per statement can be open at any point in time. -Therefore, if an application needs to read from multiple result sets, -then each must be generated by a different statement. - -

AS400JDBCStatements are thread-safe. - -

Note that the connection keeps a reference to each statement that -it creates. This means that statements will not get garbage collected -until the connection gets garbage collected. It is best to -explicitly close statements rather than counting on garbage collection. -**/ -// -// Implementation notes: -// -// 1. The RPB is used to provide parameters for requests. -// If we make a request without specifying some of the -// parameters, then the system will look in the RPB. -// -// Specifically, we use an RPB for each statement object to -// store parameters that do not depend on the SQL statement: -// -// * cursor name -// * statement name -// -// 2. There are many package-scope members in this class -// heirarchy which really should be "private protected". -// However, that is no longer allowed in Java, so we -// at least limit access out the the package. They -// are not intended to be used outside of the class -// hierarchy. -// -public class AS400JDBCStatement -/* ifdef JDBC40 */ -extends ToolboxWrapper -/* endif */ -implements Statement -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - - // Constants. - static final int MAX_CURSOR_NAME_LENGTH_PRE_V6R1 = 18; //@550C - static final int MAX_CURSOR_NAME_LENGTH = 128; //@550A - - // Constants for generated key support - static final int RETURN_GENERATED_KEYS = 1; //@G4A - static final int NO_GENERATED_KEYS = 2; //@G4A - static final int GENERATED_KEYS_NOT_SPECIFIED = -9999; //@G4A - - - // Private data. - boolean allowImmediate_; // private protected - private int autoGeneratedKeys_; // @G4A - Vector batch_; // private protected - private String blockCriteria_; - private int blockSize_; - private boolean cancelled_; - private boolean closed_; - AS400JDBCConnection connection_; // private protected - JDCursor cursor_; // private protected - private String cursorDefaultName_; - private boolean escapeProcessing_; - private DBExtendedColumnDescriptors extendedColumnDescriptors_; // @F3A - private int fetchDirection_; - private int fetchSize_; - private AS400JDBCResultSet generatedKeys_; // @G4A - int id_; // private protected - AS400JDBCStatementLock internalLock_; // private protected // @E6A@C7C - private boolean lastPrepareContainsLocator_; // @B2A - private int maxFieldSize_; - private int maxRows_; - int rowsInserted_; // for block insert @G5A - private String name_; - private String nameOverride_; - int numberOfResults_; // private protected - int positionOfSyntaxError_; //@F10A - boolean prefetch_; // private protected - private int queryTimeout_; - private boolean queryTimeoutSet_ = false; /*@B2A*/ - AS400JDBCResultSet resultSet_; // private protected - private int rowCountEstimate_; // @ECA - private boolean rpbCreated_; - private boolean rpbQueryTimeoutChanged_; //@EFA - private boolean rpbSyncNeeded_; - JDPackageManager packageManager_; // private protected - int resultSetConcurrency_; // private protected - int resultSetHoldability_; //@G4A - private int resultSetType_; - SQLConversionSettings settings_; // private protected - private SQLWarning sqlWarning_; - JDTransactionManager transactionManager_; // private protected - int updateCount_; // private protected - private String packageCriteria_; // @A1A - int behaviorOverride_ = 0; // @F9a - private boolean associatedWithLocators_ = false; //@KBL set to true, if this statement was used to access a locator - private boolean holdStatement_ = false; //@KBL set to true, if rpb and ors for this statement should be left open until a transaction boundary - private boolean useVariableFieldCompression_ = false; //@K54 - private boolean isPoolable_ = false; //@PDA jdbc40 - JDServerRow parameterRow_; // private protected //@re-prep moved from preparedStatement so that it has visibility here - private boolean threadInterrupted = false; - private DBReplyRequestedDS commonExecuteReply = null; // reply from commonExecute. Note: This cannot be returned to the pool until it is - // no longer being used. The data_ pointer from this reply is shared with - // all kinds of objects. - // Note: Because of the current structure, this can be returned after it is used. The data_ - // pointer from the reply was created by ClientAccessDataStream.construct. The returnToPool - // method for the reply has been corrected to set the data_ pointer back to DBStorage_.data. - // @B5A - private DBReplyRequestedDS connectReply = null; - private DBReplyRequestedDS execImmediateReply = null; - private DBReplyRequestedDS normalPrepareReply = null; - private DBReplyRequestedDS getMoreResultsReply = null; - - - /** - Constructs an AS400JDBCStatement object. - - @param connection The connection to the system. - @param id The id. - @param transactionManager The transaction manager for the connection. - @param packageManager The package manager for the connection. - @param blockCriteria The block criteria. - @param blockSize The block size (in KB). - @param prefetch Indicates if prefetching data. - @param packageCriteria The package criteria. - @param resultSetType The result set type. - @param resultSetConcurrency The result set concurrency. - @param resultSetHoldability The result set holdability. - @param autoGeneratedKeys Indicates if auto generated keys were requested. - - @exception SQLException If an error occurs. - **/ - AS400JDBCStatement (AS400JDBCConnection connection, - int id, - JDTransactionManager transactionManager, - JDPackageManager packageManager, - String blockCriteria, - int blockSize, - boolean prefetch, - String packageCriteria, // @A1C - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability, // @G4A - int autoGeneratedKeys) // @G4A - throws SQLException - { - // Initialization. - allowImmediate_ = true; - autoGeneratedKeys_ = autoGeneratedKeys; // @G4A - //@P0Dbatch_ = new Vector (); - blockCriteria_ = blockCriteria; - blockSize_ = blockSize; - cancelled_ = false; - closed_ = false; - connection_ = connection; - escapeProcessing_ = true; - fetchDirection_ = ResultSet.FETCH_FORWARD; - fetchSize_ = 0; - id_ = id; - internalLock_ = new AS400JDBCStatementLock(); // @E6A - maxFieldSize_ = 0; - maxRows_ = 0; - numberOfResults_ = 0; - prefetch_ = prefetch; - queryTimeout_ = 0; - resultSet_ = null; - transactionManager_ = transactionManager; - updateCount_ = -1; - packageManager_ = packageManager; - resultSetConcurrency_ = resultSetConcurrency; - resultSetHoldability_ = resultSetHoldability; //@G4A - resultSetType_ = resultSetType; - rpbCreated_ = false; - rpbQueryTimeoutChanged_ = false; //@EFA - rpbSyncNeeded_ = true; - settings_ = new SQLConversionSettings (connection_); - sqlWarning_ = null; - packageCriteria_ = packageCriteria; // @A1A - - // By default, the statement name and cursor name are - // based on the id. - String idString = "0000" + id; - String idString4 = idString.substring (idString.length() - 4); - name_ = "STMT" + idString4; - - if(resultSetType_ == ResultSet.TYPE_FORWARD_ONLY) // @B1A - { - cursorDefaultName_ = "CRSR" + idString4; - if((connection_.getServerFunctionalLevel() >= 14) && (connection_.getProperties().getBoolean(JDProperties.VARIABLE_FIELD_COMPRESSION))) //@K54 - useVariableFieldCompression_ = true; //@K54 - } - else // @B1A - cursorDefaultName_ = "SCRSR" + idString4; // @B1A - - // @E4D // Use lazy close only when the "lazy close" property @E4A - // @E4D // has been set AND the old auto-commit support is @E4A - // @E4D // still in effect. @E4A - // @E4D boolean lazyClose = connection_.getProperties().getBoolean(JDProperties.LAZY_CLOSE) // @E4A - // @E4D && transactionManager_.isNewAutoCommitSupport(); // @E4A - - cursor_ = new JDCursor (connection_, id_, cursorDefaultName_, resultSetConcurrency_); // @E4C @EAC - - //@F4 If the user specified a holdability, then we must check the holdability of - //@F4 statements on a Connection.commit or Connection.rollback. Thought about just - //@F4 setting this flag to true if the holdability was different than the connection - //@F4 holdability, but the connection holdability can change above us. - if(resultSetHoldability != AS400JDBCResultSet.HOLDABILITY_NOT_SPECIFIED) //@F4A - { - //@F4A - connection.setCheckStatementHoldability(true); //@F4A - } //@F4A - - try // @F9a - { - // @F9a - behaviorOverride_ = connection_.getProperties().getInt(JDProperties.BEHAVIOR_OVERRIDE); // @F9a - } // @F9a - catch(Throwable t) - { - } // @F9a - - // Trace messages. - if(JDTrace.isTraceOn()) - { - JDTrace.logOpen (this, connection_); // @J33c - JDTrace.logProperty (this, "Escape processing", escapeProcessing_); - JDTrace.logProperty (this, "Fetch direction", fetchDirection_); - JDTrace.logProperty (this, "Fetch size", fetchSize_); - JDTrace.logProperty (this, "Max field size", maxFieldSize_); - JDTrace.logProperty (this, "Max rows", maxRows_); - JDTrace.logProperty (this, "Query timeout", queryTimeout_); - JDTrace.logProperty (this, "Result set concurrency", resultSetConcurrency_); - JDTrace.logProperty (this, "Result set holdability", resultSetHoldability_); //@F4A - JDTrace.logProperty (this, "Result set type", resultSetType_); - JDTrace.logProperty (this, "Behavior Override", behaviorOverride_); // @F9a - String cursorAsString = JDTrace.objectToString(cursor_); // @J33a - JDTrace.logInformation(this, "Data to correlate statement with cursor " + cursorAsString); // @J33a - } - } - - - - // JDBC 2.0 - /** - Adds an SQL statement to the current batch of SQL statements. - - @param sql The SQL statement to be added to the current batch. - This can be any SQL statement that does not return - a result set. - - @exception SQLException If the statement is not open or - the SQL statement contains a syntax - error. - **/ - public void addBatch (String sql) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - settings_.getDecimalSeparator (), escapeProcessing_, - packageCriteria_, connection_); //@G4C - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - if(sqlStatement.countParameters () > 0) - JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - - if(batch_ == null) batch_ = new Vector(); //@P0A - batch_.addElement (sqlStatement); - } - } - - - - /** - Cancels the statement. This is useful when one thread - needs to cancel a statement that is being executed by another - thread. This will close the current result set. - - @exception SQLException If the statement is not open or - an error occurs. - **/ - public void cancel () - throws SQLException - { - // Don't synchronize this method... it needs to be callable // @E6A - // even when the statement is busy. // @E6A - checkOpen (); - - connection_.cancel(id_); // @E5A - - cancelled_ = true; - closeResultSet (JDCursor.REUSE_YES); - } - - - - /** - Checks that the statement is open. Public methods - that require an open statement should call this first. - - @exception SQLException If the statement is not open. - **/ - void checkOpen () - throws SQLException - { - connection_.checkOpen (); - if(closed_) - JDError.throwSQLException (JDError.EXC_FUNCTION_SEQUENCE); - } - - - - // JDBC 2.0 - /** - Clears the current batch of SQL statements. - - @exception SQLException If the statement is not open. - **/ - public void clearBatch () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - if(batch_ == null) batch_ = new Vector(); //@P0A - batch_.removeAllElements (); - } - } - - - - /** - Clears all warnings that have been reported for the statement. - After this call, getWarnings() returns null until a new warning - is reported for the statement. - - @exception SQLException If an error occurs. - **/ - public void clearWarnings () - throws SQLException - { - sqlWarning_ = null; - } - - - - /** - Releases the statement's resources immediately instead of waiting - for them to be automatically released. This closes the current - result set. - - @exception SQLException If an error occurs. - **/ - // - // Implementation note: - // - // It is a requirement to not get replies during a finalize() - // method. Since finalize() calls this method, this requirement - // applies here, too. - // - public void close () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - // If this is already closed, then just do nothing. - // - // The spec does not define what happens when a connection - // is closed multiple times. The official word from the Sun - // JDBC team is that "the driver's behavior in this case - // is implementation defined. Applications that do this are - // non-portable." - if(isClosed ()) - return; - - // Close the current result set. (Note: This has no - // effect if the user explicitly closed the result set - // before closing the statement. - //@PDA perf2 comment: if we get back 700,2 from fetch, then cursor is already closed, but resultSet_ is still usable - //if(! cursor_.isClosed()) //@perf3 cursor can be closed, but resultset still needs to be closed. closeResultSet checks for closed cursor before closing cursor. - //{ // @B3A //@perf3 - closeResultSet (JDCursor.REUSE_NO); - //} // @B3A //@perf3 - - // If, even after closing the current result set, - // there are more result sets that were returned, we - // need to close them, too. At first I though we - // would have to Open/Describe and Close each one - // in turn, but the database host server allows us to - // close the current cursor with REUSE_NO to close - // all remaining result sets. The catch is that we - // need to have an open cursor before closing it, so - // we open the next cursor, then close it again. - // This closes all remaining result sets. - if(numberOfResults_ > 1) - { - getMoreResults (); - cursor_.close (JDCursor.REUSE_NO); - } - - if(generatedKeys_ != null) //@PDA genkeys - { - generatedKeys_.close(); - generatedKeys_ = null; - } - - //@KBL If the user specified to keep statements open until a transaction boundary and locators are associated - // with the statement, do not close the RPB or ORS until a transaction boundary is reached. - if(isAssociatedWithLocators() && (connection_.getProperties().getBoolean(JDProperties.HOLD_STATEMENTS)) && (connection_.getAutoCommit() == false)) - { - setHoldStatement(true); - closed_ = true; // Want the statement to only be available for use internally, user should not be able to use the statement. - - if (commonExecuteReply != null) { commonExecuteReply.returnToPool(); commonExecuteReply = null; } - if (connectReply != null) { connectReply.returnToPool(); connectReply = null; } - if (execImmediateReply != null) { execImmediateReply.returnToPool(); execImmediateReply = null; } - if (normalPrepareReply != null) { normalPrepareReply.returnToPool(); normalPrepareReply = null; } - if (getMoreResultsReply != null) { getMoreResultsReply.returnToPool(); getMoreResultsReply = null; } - return; // Mark the statement as closed, but don't notify the connection it has been closed or delete the RPB and ORS. - } - - // Delete the RPB. Remember the error information @EDC - // in order to report later... @EDC - SQLException e = null; // @EDA - if(rpbCreated_) - { // @EDA - DBSQLRPBDS request3 = null; //@P0A - DBReplyRequestedDS closeReply = null; //@P0A - try - { //@P0A - request3 = DBDSPool.getDBSQLRPBDS(DBSQLRPBDS.FUNCTIONID_DELETE_RPB, id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); //@P0C - - closeReply = connection_.sendAndReceive(request3, id_); // @EDC @P0C - - int errorClass = closeReply.getErrorClass(); // @EDA - int returnCode = closeReply.getReturnCode(); // @EDA - if(errorClass != 0) - { // @EDA - if(returnCode < 0) - { // @EDA - try - { // @EDA - JDError.throwSQLException(connection_, id_, errorClass, returnCode); // @EDA - } // @EDA - catch(SQLException e2) - { // @EDA - e = e2; // @EDA - } // @EDA - } // @EDA - else - { // @EDA - postWarning (JDError.getSQLWarning(connection_, id_, errorClass, returnCode)); // @EDA - } // @EDA - } // @EDA - } - finally - { //@P0A - if(request3 != null) { - request3.returnToPool(); request3=null; - } - if(closeReply != null) { - closeReply.returnToPool();closeReply=null; - } - } - } // @EDA - - // Delete the ORS. - // - // @EDD // We must use get a reply here even though we do not - // @EDD // need any information from it. Otherwise the next - // @EDD // flow would be based on this ORS, which gets deleted. - // @EDD // In that case, we would always get an "ORS not found" - // @EDD // error. - // @EDD // - // @EDD // In this case, we also need it to force a send of - // @EDD // all of the previous datastreams, since this is the - // @EDD // last one for this statement. - // - // Make sure not to base future requests on this ORS. // @EDA - // - //@P0DDBSQLResultSetDS request2 = new DBSQLResultSetDS ( - //@P0D DBSQLResultSetDS.FUNCTIONID_DELETE_RESULTS_SET, - //@P0D id_, 0, 0); // @EDC - DBSQLResultSetDS request2 = null; //@P0A - try - { //@P0A - request2 = DBDSPool.getDBSQLResultSetDS(DBSQLResultSetDS.FUNCTIONID_DELETE_RESULTS_SET, id_, 0, 0); //@P0C - - connection_.send(request2, id_, false); // @EDC - } - finally - { //@P0A - if(request2 != null) { - request2.returnToPool(); request2=null; - } - } - - // Ignore errors, since we would not be able to get - // the message text anyway (because the ORS is gone.) - - // free the pooled commonExecuteReply - if (commonExecuteReply != null) { commonExecuteReply.returnToPool(); commonExecuteReply = null; } - if (connectReply != null) { connectReply.returnToPool(); connectReply = null; } - if (execImmediateReply != null) { execImmediateReply.returnToPool(); execImmediateReply = null; } - if (normalPrepareReply != null) { normalPrepareReply.returnToPool(); normalPrepareReply = null; } - if (getMoreResultsReply != null) { getMoreResultsReply.returnToPool(); getMoreResultsReply = null; } - closed_ = true; - connection_.notifyClose (this, id_); - - if(JDTrace.isTraceOn()) - JDTrace.logClose (this); - - // Rethrow any exception that surfaced when deleting the RPB. @EDA - if(e != null) // @EDA - throw e; // @EDA - } - } - - //@KBL - /* - Finish releasing a partially-closed statement's resources. A statement may become partially closed if, for example, - the user called close on the statement and it was associated with a locator. - This method will delete any RPB and ORS associated with the statement.". - @exception SQLException if an error occurs - */ - void finishClosing() - throws SQLException - { - synchronized(internalLock_) - { - // Delete the RPB. Remember the error information - // in order to report later... - SQLException e = null; - if(rpbCreated_) - { - DBSQLRPBDS request3 = null; - DBReplyRequestedDS finishClosingReply = null; - try - { - request3 = DBDSPool.getDBSQLRPBDS(DBSQLRPBDS.FUNCTIONID_DELETE_RPB, id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); //@P0C - - finishClosingReply = connection_.sendAndReceive(request3, id_); - - int errorClass = finishClosingReply.getErrorClass(); - int returnCode = finishClosingReply.getReturnCode(); - if(errorClass != 0) - { - if(returnCode < 0) - { - try - { - JDError.throwSQLException(connection_, id_, errorClass, returnCode); - } - catch(SQLException e2) - { - e = e2; - } - } - else - { - postWarning (JDError.getSQLWarning(connection_, id_, errorClass, returnCode)); - } - } - } - finally - { - if(request3 != null) { request3.returnToPool(); request3=null; } - if(finishClosingReply != null) { finishClosingReply.returnToPool(); finishClosingReply = null; } - } - } - - // Delete the ORS. - // - // We must use get a reply here even though we do not - // need any information from it. Otherwise the next - // flow would be based on this ORS, which gets deleted. - // In that case, we would always get an "ORS not found" - // error. - // In this case, we also need it to force a send of - // all of the previous datastreams, since this is the - // last one for this statement. - // - // Make sure not to base future requests on this ORS. - DBSQLResultSetDS request2 = null; - try - { - request2 = DBDSPool.getDBSQLResultSetDS(DBSQLResultSetDS.FUNCTIONID_DELETE_RESULTS_SET, id_, 0, 0); - - connection_.send(request2, id_, false); - } - finally - { - if(request2 != null) { - request2.returnToPool(); request2 = null; - } - } - - // Ignore errors, since we would not be able to get - // the message text anyway (because the ORS is gone.) - - closed_ = true; - setHoldStatement(false); //the statement is no longer left open - connection_.notifyClose (this, id_); - - if(JDTrace.isTraceOn()) - JDTrace.logClose (this); - - // Rethrow any exception that surfaced when deleting the RPB. - if(e != null) - throw e; - } - - } - - /** - Closes the result set and cursor. - - @param reuseFlag Either JDCursor.REUSE_NO, - JDCursor.REUSE_YES, or - JDCursor.REUSE_RESULT_SET. - - @exception SQLException If an error occurs. - **/ - void closeResultSet (int reuseFlag) // private protected - throws SQLException - { - if(resultSet_ != null) - { - if(! resultSet_.isClosed ()) - resultSet_.close (); - resultSet_ = null; - } - - if (threadInterrupted) { - // Force a close to be flowed - try { - cursor_.setState(false); - cursor_.close (reuseFlag); - } catch (Exception e) { - - } - } else { - if(! cursor_.isClosed ()) - cursor_.close (reuseFlag); - } - - updateCount_ = -1; - } - - - - /** - Executes an SQL statement on the IBM i system. - - @param sqlStatement The SQL statement. - @param resultRow The result row or null if none. - - @exception SQLException If the query timeout limit is - exceeded or an error occurs. - **/ - // - // Do not override this method. Instead, override - // commonExecuteBefore() and commonExecuteAfter() as needed. - // - final void commonExecute (JDSQLStatement sqlStatement, - JDServerRow resultRow) // private protected - throws SQLException - { - cancelled_ = false; - - // If the statement is not immediately executable, then - // we still need to do the execute. Otherwise, the execute - // was already done as part of the prepare. - if((! allowImmediate_) || (! sqlStatement.isImmediatelyExecutable ())) - { - - // Sync up the RPB. - syncRPB (); - - boolean usedNameOverride = false; - - // This boolean is true when an Open is needed and - // false when an Execute is needed. - boolean openNeeded = (resultRow != null); - - // If we are prefetching data and a row format - // was returned, then fetch the first block of data. - boolean fetchFirstBlock = ((prefetch_) && (openNeeded)); - - // Send the execute data stream. - try - { - // Determine the appropriate function id, based - // on whether we want to prefetch data, and on whether - // this is an Execute or an Open. - int functionId; - if(openNeeded) - { - if(fetchFirstBlock) - functionId = DBSQLRequestDS.FUNCTIONID_OPEN_DESCRIBE_FETCH; - else - functionId = DBSQLRequestDS.FUNCTIONID_OPEN_DESCRIBE; - } - else - functionId = DBSQLRequestDS.FUNCTIONID_EXECUTE; - - DBSQLRequestDS request = null; //@P0A - // DBReplyRequestedDS replyX = null; //@P0A - int openAttributes = 0; - try - { - //@541 When running to a V5R4 or higher system, we can request to get extended column descriptors - // from a stored procedure result set. In order to do that, we need to set the extended column - // descriptor option on the execute of the statement. - boolean isCall = (sqlStatement.getNativeType () == JDSQLStatement.TYPE_CALL); //@541A moved up from farther below in code - //@F5D Send this on the prepare, not the execute - int requestedORS = DBSQLRequestDS.ORS_BITMAP_RETURN_DATA+DBSQLRequestDS.ORS_BITMAP_SQLCA; //@F3M //@541C undeleted - //@F5D //@F3A If we are on a system that supports extended column descriptors and if the //@F3A - //@F5D //@F3A user asked for them, send the extended column descriptors code point. //@F3A - boolean extendedMetaData = false; //@F3A //@541C undeleted - //@F5D if (connection_.getVRM() >= JDUtilities.vrm520) //@F3A - if(connection_.getVRM() >= JDUtilities.vrm540 && isCall) //@541A - { //@F3A //@541C undeleted - extendedMetaData = connection_.getProperties().getBoolean(JDProperties.EXTENDED_METADATA); //@F3A //@541C undeleted - if (extendedMetaData) //@F3A //@541C undeleted - { //@F3A //@541C undeleted - requestedORS = requestedORS + DBSQLRequestDS.ORS_BITMAP_EXTENDED_COLUMN_DESCRIPTORS; //@F3A //@541C undeleted - } //@F3A //@541C undeleted - } //@F3A //@541C undeleted - if(connection_.getVRM() >= JDUtilities.vrm610 ) //@cur request cursor attributes //@isol - requestedORS = requestedORS + DBSQLRequestDS.ORS_BITMAP_CURSOR_ATTRIBUTES; //@cur - //@P0A - request = DBDSPool.getDBSQLRequestDS(functionId, id_, requestedORS, 0); //@P0C @F3C @F5C //@541C - - openAttributes = cursor_.getOpenAttributes(sqlStatement, blockCriteria_); //@F7M - if(openNeeded) - { - //@F7D openAttributes = cursor_.getOpenAttributes (sqlStatement, blockCriteria_); - if((autoGeneratedKeys_ == RETURN_GENERATED_KEYS) && connection_.getVRM() >= JDUtilities.vrm610) //@GKA Wrapped INSERT WITH SELECT for generated keys. Result set should be read only, insensitive - request.setOpenAttributes(0x80); //@GKA - else //@GKA - request.setOpenAttributes(openAttributes); - } - else if(extendedMetaData){ //@541A Doing an execute. If running to V5R4 and higher, and the extendedMetaData property is true, set the extended column descriptor option - request.setExtendedColumnDescriptorOption((byte)0xF1); - } - - if(nameOverride_.length() != 0) - { - request.setPrepareStatementName(nameOverride_, connection_.converter_); //@P0C - usedNameOverride = true; - } - - if(packageManager_.isEnabled() && sqlStatement.isPackaged()) - { - request.setPackageName (packageManager_.getName (), connection_.converter_); //@P0C - } - - // If we are prefetching data and a row format - // was returned, then set the blocking factor if a specific number of rows have been asked for - // or variable-length field compression is turned off, otherwise set the buffer size. - if(fetchFirstBlock) - { - request.addOperationResultBitmap(DBSQLRequestDS.ORS_BITMAP_RESULT_DATA); - if((functionId == DBSQLRequestDS.FUNCTIONID_OPEN_DESCRIBE_FETCH) && //@K54 - (useVariableFieldCompression_)) //@K54 - { - //Do not need to set the blocking factor if using variable-length field compression - //If both the buffer size and blocking factor were set, the buffer size will override - //the blocking factor and the number of rows that will fit in the buffer size will be returned - //regardless of the blocking factor value - request.setVariableFieldCompression(true); - request.setBufferSize(blockSize_ * 1024); - } - else { //@K54 - if (resultRow != null) { // @B5A -- check for null pointer - request.setBlockingFactor(getBlockingFactor (sqlStatement, resultRow.getRowLength())); //@K54 changed to just use resultRow.getRowLength() instead of fetchFirstBlock ? resultRow.getRowLength() : 0 - } else { - request.setBlockingFactor(getBlockingFactor (sqlStatement, 0)); //@K54 changed to just use resultRow.getRowLength() instead of fetchFirstBlock ? resultRow.getRowLength() : 0 - } - } - } - - //@K1D //@F8 If we are pre-V5R2, the user set the resultSetType to "TYPE_SCROLL_INSENSITIVE", or - //@K1D //@F8 the user did not change from the default of the "cursor sensitivity" property, - //@K1D //@F8 send what we always have. - //@K1D //@F8 Change in a future release to send CURSOR_SCROLLABLE_INSENSITIVE and - //@K1D //@F8 CURSOR_NOT_SCROLLABLE_INSENSITIVE if resultSetType_ == - //@K1D //@F8 ResultSet.TYPE_SCROLL_INSENSITIVE to v5r1 or later hosts. - String cursorSensitivity = connection_.getProperties().getString(JDProperties.CURSOR_SENSITIVITY); //@F8A - //@K1D if((connection_.getVRM() < JDUtilities.vrm520) //@F8A - //@K1D || (resultSetType_ == ResultSet.TYPE_SCROLL_INSENSITIVE) //@F8A - //@K1D || (cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_ASENSITIVE))) //@F8A - //@K1D { - //@K1D if(resultSetType_ == ResultSet.TYPE_FORWARD_ONLY) - //@K1D request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_ASENSITIVE); - //@K1D else - //@K1D request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_ASENSITIVE); - //@K1D } - //@K1D //@F8 If we are V5R2 or later, send new numbers based on what the user - //@K1D //@F8 set in "cursor sensitivity" property //@F8A - //@K1D else if(resultSetType_ == ResultSet.TYPE_FORWARD_ONLY) - //@K1D { - //@K1D if(cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_INSENSITIVE)) //@F8A - //@K1D request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_INSENSITIVE); //@F8A - //@K1D else //else property set to sensitive //@F8A - //@K1D request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_SENSITIVE); //@F8A - //@K1D } - //@K1D //@F8 Else, resultSetType_ is ResultSet.TYPE_CURSOR_SENSITIVE - //@K1D else - //@K1D { - //@K1D if(cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_INSENSITIVE)) //@F8A - //@K1D request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_INSENSITIVE); //@F8A - //@K1D else //else property set to sensitive //@F8A - //@K1D request.setScrollableCursorFlag(DBSQLRequestDS.CURSOR_SCROLLABLE_SENSITIVE); //@F8A - //@K1D } - //If earlier than V5R2, do what we always have //@K1A - if(connection_.getVRM() < JDUtilities.vrm520) //@K1A - { - //@K1A - if(resultSetType_ == ResultSet.TYPE_FORWARD_ONLY) //@K1A - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_ASENSITIVE); //@K1A Option 0 - else //@K1A - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_ASENSITIVE); //@K1A Option 1 - } //@K1A - else if ((autoGeneratedKeys_ == RETURN_GENERATED_KEYS) && connection_.getVRM() >= JDUtilities.vrm610) //@GKA - { //@GKA - // The user requested generated keys so we wrapped the INSERT with a SELECT //@GKA - // The result set returned will be for the generated keys and should be read-only, insensitive //@GKA - // We want to ignore any property or settings specified on the STATEMENT or CONNECTION //@GKA - request.setScrollableCursorFlag(DBSQLRequestDS.CURSOR_SCROLLABLE_INSENSITIVE); //@GKA - } //@GKA - else if(resultSetType_ == ResultSet.TYPE_FORWARD_ONLY) //@K1A - { - //@K1A - //Determine if user set cursor sensitivity property //@K1A - //if ResultSet is updateable, then we cannot have a insensitive cursor //@K1A - if(cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_INSENSITIVE) && (resultSetConcurrency_ == ResultSet.CONCUR_READ_ONLY)) //@K1A - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_INSENSITIVE); //@K1A Option 5 - else if(cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_SENSITIVE)) //@PDA - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_SENSITIVE); //@PDA Option 4 - else //@K1A - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_ASENSITIVE); //@K1A Option 0 - } //@K1A - else if(resultSetType_ == ResultSet.TYPE_SCROLL_SENSITIVE) //@K1A - { - //@K1A - //Determine if user set cursor sensitivity property //@K1A - if(cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_SENSITIVE)) //@K1A - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_SENSITIVE); //@K1A Option 1 - else //@K1A - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_ASENSITIVE); //@K1A Option 3 - } //@K1A - else //ResultSet.TYPE_SCROLL_INSENSITIVE //@K1A - { - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_INSENSITIVE); //@K1A Option 2 - } //@K1A - - // Check system level before sending new code point - if(connection_.getVRM() >= JDUtilities.vrm520) // @G4A - { - // @G4A - if(resultSetHoldability_ == AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT) // @G4A - request.setResultSetHoldabilityOption((byte)0xD5); // @G4A - else if(resultSetHoldability_ == AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT) // @G4A - request.setResultSetHoldabilityOption((byte)0xE8); // @G4A - // else resultSetHoldability_ == AS400JDBCResultSet.HOLDABILITY_NOT_SPECIFIED, // @G4A - // so don't send the code point because the user did not tell us to // @G4A - } - - commonExecuteBefore(sqlStatement, request); - - if (commonExecuteReply != null) { commonExecuteReply.returnToPool(); commonExecuteReply=null; } - - commonExecuteReply = connection_.sendAndReceive(request, id_); //@P0C - - - // Gather information from the reply. - cursor_.processConcurrencyOverride(openAttributes, commonExecuteReply); // @E1A @EAC - - cursor_.processCursorAttributes(commonExecuteReply); //@cur - - transactionManager_.processCommitOnReturn(commonExecuteReply); // @E2A - DBReplySQLCA sqlca = commonExecuteReply.getSQLCA(); - DBData resultData = null; - if(fetchFirstBlock) resultData = commonExecuteReply.getResultData(); - - // Note the number of rows inserted/updated - rowsInserted_ = sqlca.getErrd(3); // @G5A - - // Check for system errors. Take note on prefetch - // if the last block was fetched. - int errorClass = commonExecuteReply.getErrorClass(); - int returnCode = commonExecuteReply.getReturnCode(); - - // Remember that a cursor is open even when most - // errors occur. - // - // Except: - // * When a query timeout occurs, the system - // does not leave a cursor open. - if(openNeeded && (errorClass != 1 || returnCode != -666)) cursor_.setState(false); - - // Take note on prefetch if the last block was fetched. - boolean lastBlock = false; - boolean bypassExceptionWarning = false; //@pda (issue 32120) in special errorClass/returnCode cases below, we use sqlca to see if there is a real error - if((((errorClass == 1) && (returnCode == 100)) - || ((errorClass == 2) && (returnCode == 701))) - && functionId == DBSQLRequestDS.FUNCTIONID_OPEN_DESCRIBE_FETCH) // make sure we attempted to prefetch data, otherwise post a warning - { - lastBlock = true; - returnCode = sqlca.getSQLCode(); //@pda (issue 32120) get rc from SQLCA - String sqlState = sqlca.getSQLState (connection_.converter_); //@issue 34500 - if(sqlState.startsWith("00") || sqlState.startsWith("02")) //@pda (issue 32120) //@issue 34500 //@35199 - bypassExceptionWarning = true; //@pda (issue 32120) - } - else if((errorClass == 2) && (returnCode == 700) - && (functionId == DBSQLRequestDS.FUNCTIONID_OPEN_DESCRIBE_FETCH)) //@pda perf2 - fetch/close - { - lastBlock = true; - cursor_.setState(true); //closed cursor already on system - returnCode = sqlca.getSQLCode(); //@pda (issue 32120) get rc from SQLCA - String sqlState = sqlca.getSQLState (connection_.converter_); //@issue 34500 - if(sqlState.startsWith("00") || sqlState.startsWith("02")) //@pda (issue 32120) //@issue 34500 //@35199 - bypassExceptionWarning = true; //@pda (issue 32120) - } - - - //else //@PDD check for errors even on cases above (issue 32120) - if(errorClass != 0 && bypassExceptionWarning == false) //@pdc (issue 32120) - { - positionOfSyntaxError_ = sqlca.getErrd(5); //@F10A - - if(returnCode < 0) - { - JDError.throwSQLException(connection_, id_, errorClass, returnCode); - } - else - { - String sqlState = sqlca.getSQLState (connection_.converter_); //@igwrn - if( connection_.getProperties().getString(JDProperties.IGNORE_WARNINGS).toUpperCase().indexOf(sqlState) == -1 ) //@igwrn - postWarning(JDError.getSQLWarning(connection_, id_, errorClass, returnCode)); - } - } - - //Make an auto-generated key result set if it was requested //@G4A - if(autoGeneratedKeys_ == RETURN_GENERATED_KEYS && //@G4A - (connection_.getVRM() >= JDUtilities.vrm520) && ((connection_.getVRM() < JDUtilities.vrm610) || !sqlStatement.isSelectFromInsert())) //@F5A @F6C @GKC - //@F6D&& generatedKeys_ == null) //@F5A - makeGeneratedKeyResultSet(returnCode, sqlca); //@G4A - else if(generatedKeys_ != null) //@PDA genkeys - handle previous genkeys - { - generatedKeys_.close(); - generatedKeys_ = null; - } - - - //@F5D This belongs on the prepare, not the execute - //@F5D @F3A If user asked us to parse out extended metadata, then make an object - //@F5D if (extendedMetaData) //@F3A - //@F5D { //@F3A - //@F5D extendedColumnDescriptors_ = reply.getExtendedColumnDescriptors(); //@F3A - //@F5D } //@F3A - - // Compute the update count and result set . - if(openNeeded) - { - // @B5A Check for null pointer. - int rowLength = 0; - if (resultRow != null) { - rowLength = resultRow.getRowLength(); - } - JDServerRowCache rowCache; - if((fetchFirstBlock) && (resultData != null)) - rowCache = new JDServerRowCache (resultRow, - connection_, id_, - getBlockingFactor (sqlStatement, rowLength), resultData, - lastBlock, resultSetType_, cursor_); //@pdc perf2 - fetch/close - else - rowCache = new JDServerRowCache (resultRow, - connection_, id_, - getBlockingFactor (sqlStatement, rowLength), lastBlock, resultSetType_, cursor_); //@PDC perf //@pdc perf2 - fetch/close - - // If the result set concurrency is updatable, check to @E1C - // see if the system overrode the cursor type to read only. @E1C - // Don't worry about the other direction (system overrides @E1C - // from read-only to updatable). @E1C - int actualConcurrency = (resultSetConcurrency_ == ResultSet.CONCUR_UPDATABLE) // @E1C - ? cursor_.getConcurrency() : resultSetConcurrency_; // @E1C @EAC - - if((autoGeneratedKeys_ == RETURN_GENERATED_KEYS) && (connection_.getVRM() >= JDUtilities.vrm610) && sqlStatement.isSelectFromInsert()) //@GKA - { - // this will be the generated keys result set //@GKA - updateCount_ = sqlca.getErrd(3); //@GKA - rowCountEstimate_ = -1; //@GKA - generatedKeys_ = new AS400JDBCResultSet (this, sqlStatement, rowCache, connection_.getCatalog(),//@GKA - cursor_.getName(), maxRows_, //@GKA - ResultSet.TYPE_SCROLL_INSENSITIVE, //@GKA - ResultSet.CONCUR_READ_ONLY, fetchDirection_, fetchSize_); //@GKA - } //@GKA - else //@GKA - { //@GKA - updateCount_ = -1; // @ECM - rowCountEstimate_ = sqlca.getErrd (3); //@F1C // @ECA - resultSet_ = new AS400JDBCResultSet (this, - sqlStatement, rowCache, connection_.getCatalog(), - cursor_.getName(), maxRows_, resultSetType_, - actualConcurrency, fetchDirection_, fetchSize_); // @E1C - if(resultSet_.getConcurrency () != resultSetConcurrency_ && resultSetConcurrency_ == ResultSet.CONCUR_UPDATABLE) //@nowarn only warn if concurrency level is lessened - postWarning (JDError.getSQLWarning (JDError.WARN_OPTION_VALUE_CHANGED)); - } //@GKA - } - else - { - updateCount_ = sqlca.getErrd (3); //@F1C - rowCountEstimate_ = -1; // @ECC - } - - // Compute the number of results. - //@541D boolean isCall = (sqlStatement.getNativeType () == JDSQLStatement.TYPE_CALL); - if(isCall) - numberOfResults_ = sqlca.getErrd (2); //@F1C - else - numberOfResults_ = 0; - - if(extendedMetaData) //@541A - { - extendedColumnDescriptors_ = commonExecuteReply.getExtendedColumnDescriptors (); //@F5A - } - - // If this is a CALL and result sets came back, but - // no format was returned, then open the cursor. The - // result set must be forward only and read only. - // This is a system restriction. @EBA - // As of V5R3 the restriction to be forward only no longer applies @KBA - if(sqlStatement != null) - { - if((isCall) && (numberOfResults_ > 0) && (resultSet_ == null)) - { - boolean preV5R3 = connection_.getVRM() < JDUtilities.vrm530; - - // Change the result set type based on the current attributes - // unless forward only cursors were requested. This must - // be kept in sync with similar code ins AS400JDBCResultSet - // @C4A - int callResultSetType ; - if (resultSetType_ == ResultSet.TYPE_FORWARD_ONLY) { - // The user requested FORWARD_ONLY, so the result set will - // only be usable as forward only. - callResultSetType = ResultSet.TYPE_FORWARD_ONLY; - } else if(cursor_.getCursorAttributeScrollable() == 0) - callResultSetType = ResultSet.TYPE_FORWARD_ONLY; - else if(cursor_.getCursorAttributeSensitive() == 0) - callResultSetType = ResultSet.TYPE_SCROLL_INSENSITIVE; - else if(cursor_.getCursorAttributeSensitive() == 1) - callResultSetType = ResultSet.TYPE_SCROLL_SENSITIVE; - else - callResultSetType = resultSetType_; - - JDServerRow row = new JDServerRow ( - connection_, id_, cursor_.openDescribe (openAttributes, - callResultSetType), settings_); //@KBA - JDServerRowCache rowCache = new JDServerRowCache (row, - connection_, id_, getBlockingFactor (sqlStatement, - row.getRowLength()), false, (preV5R3 ? ResultSet.TYPE_FORWARD_ONLY : resultSetType_), cursor_); //@PDC perf //@pda perf2 - fetch/close - //if pre-v5r3 create a FORWARD_ONLY RESULT SET - if(preV5R3) //@KBA - { - resultSet_ = new AS400JDBCResultSet (this, - sqlStatement, rowCache, connection_.getCatalog(), - cursor_.getName(), maxRows_, ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY, fetchDirection_, - fetchSize_); - } - else //@KBA - { //@KBA - resultSet_ = new AS400JDBCResultSet (this, //@KBA - sqlStatement, rowCache, connection_.getCatalog(), //@KBA - cursor_.getName(), maxRows_, callResultSetType, //@KBA - ResultSet.CONCUR_READ_ONLY, fetchDirection_, //@KBA - fetchSize_); //@KBA - } - - if(resultSet_.getConcurrency () != resultSetConcurrency_) - postWarning (JDError.getSQLWarning (JDError.WARN_OPTION_VALUE_CHANGED)); - } - } - - commonExecuteAfter (sqlStatement, commonExecuteReply); - } catch (SQLException sqlex) { - - // Handle interrupted exception - String messageText = sqlex.getMessage(); - messageText = messageText.toLowerCase(); - if (messageText.indexOf("internal driver error") >= 0) { - if (messageText.indexOf("interrupted") > 0) { - threadInterrupted = true; - } - } - throw sqlex; - } - finally - { //@P0A - if(request != null) { - request.returnToPool(); request = null; - } - // This can be returned. See comment at declaration. @B5A - if (commonExecuteReply != null) { commonExecuteReply.returnToPool(); commonExecuteReply = null; } - - } - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - - // Inform the transaction manager that a statement - // was executed. - transactionManager_.statementExecuted (); - - // Check to see if the statement was cancelled. - if(cancelled_) - JDError.throwSQLException (JDError.EXC_OPERATION_CANCELLED); - - // Output a summary as a trace message. The * signifies that the - // statement name comes from the RPB. - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, - "Executed " + (usedNameOverride ? (nameOverride_) : (name_ + "*")) - + ", SQL Statement --> [" + sqlStatement + "]"); - JDTrace.logInformation (this, - "Update count = " + updateCount_); - JDTrace.logInformation (this, - "Result set = " + (resultSet_ != null)); - JDTrace.logInformation (this, - "Number of result sets = " + numberOfResults_); - JDTrace.logInformation (this, // @ECA - "Row count estimate = " + rowCountEstimate_); // @ECA - } - } - } - - - /** - Performs common operations needed after an execute. - - @param sqlStatement The SQL statement. - @param reply The execute reply. - - @exception SQLException If an error occurs. - **/ - // - // This method is intended to be overriden, if needed. - // - void commonExecuteAfter (JDSQLStatement sqlStatement, - DBReplyRequestedDS reply) // private protected - throws SQLException - { - // Nothing. - } - - - - /** - Performs common operations needed before an execute. - - @param sqlStatement The SQL statement. - @param request The execute request. - - @exception SQLException If an error occurs. - **/ - // - // This method is intended to be overriden, if needed. - // - void commonExecuteBefore (JDSQLStatement sqlStatement, - DBSQLRequestDS request) // private protected - throws SQLException - { - // Clear warnings. - clearWarnings (); - } - - - - /** - Prepares (pre-compiles) the SQL statement on the IBM i system. - - @param sqlStatement The SQL statement. - @return The result row or null if none. - - @exception SQLException If an error occurs. - **/ - // - // Do not override this method. Instead, override - // commonPrepareBefore(), commonPrepareAfter() and - // commonPrepareBypass() as needed. - // - JDServerRow commonPrepare (JDSQLStatement sqlStatement) // private protected - throws SQLException - { - cancelled_ = false; - - connection_.checkAccess (sqlStatement); - JDServerRow resultRow = null; - nameOverride_ = ""; - - // Check for DRDA connect or disconnect. @B1A - if(sqlStatement.isDRDAConnect ()) - { - connection_.setDRDA (true); - - // It is possible at this point, that current statement - // id does not follow the DRDA rules (defined in - // AS400JDBCConnection.getUnusedId()), but we will not - // work around that at this point. This simple workaround - // is to create a new Statement immediately after connecting. - } - else if(sqlStatement.isDRDADisconnect ()) - connection_.setDRDA (false); - - // Create the SQL package if necessary. - if(! packageManager_.isCreated()) - packageManager_.create (); - - // There are three distinct cases. Exactly one of these - // branches will be taken. - - // CASE 1: The statement appears in the cached package. - // - // If the SQL package is cached, check to see if this SQL - // statement is in there. If so, then gather data accordingly - // and skip the prepare. - // - if(packageManager_.isCached()) - { - if(sqlStatement.isPackaged()) - { - int i = packageManager_.getCachedStatementIndex (sqlStatement); - if(i != -1) - { - - // Gather results from package cache. - DBDataFormat dataFormat = packageManager_.getCachedDataFormat (i); - if(dataFormat == null) - resultRow = null; - else - resultRow = new JDServerRow (connection_, id_, - dataFormat, settings_); - //@re-prep check if one of the columns is a lob or locator on resultset columns - if( resultRow != null && resultRow.containsLob_) //@re-prep - { - resultRow = null; //@re-prep output lobs - } //@re-prep - - commonPrepareBypass (sqlStatement, i); - - //@re-prep input lobs on prepared statement - if(parameterRow_ != null && parameterRow_.containsLob_) //@re-prep - { //@re-prep - nameOverride_ = ""; //@re-prep - // Output a summary as a trace message. - if(JDTrace.isTraceOn()) //@re-prep - JDTrace.logInformation (this, - "Statement [" + sqlStatement + "] was found " - + "in the cached package " - + " but must be re-prepared since it contains a lob or locator"); //@re-prep - } //@re-prep - else //@re-prep - { //@re-prep - nameOverride_ = packageManager_.getCachedStatementName (i); - // Output a summary as a trace message. - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, - "Statement [" + sqlStatement + "] was found " - + "in the cached package as " + nameOverride_); - } //@re-prep - } - } - } - - // If the SQL package is not cached, then we must prepare - // the statement on the system. - if(nameOverride_.length() == 0) - { - - // @E7A - start - // - // CASE 2a: Statement is a DRDA CONNECT. - // - if(sqlStatement.getNativeType() == JDSQLStatement.TYPE_CONNECT) - { - - // Sync up the RPB. - syncRPB(); - - DBSQLRequestDS request = null; //@P0A - try - { - - request = DBDSPool.getDBSQLRequestDS(DBSQLRequestDS.FUNCTIONID_CONNECT, id_, DBSQLRequestDS.ORS_BITMAP_RETURN_DATA+DBSQLRequestDS.ORS_BITMAP_SQLCA, 0); //@P0C - - boolean extended = false; //@540 - if(connection_.getVRM() >= JDUtilities.vrm540) extended = true; //@540 - //Bidi-HCG request.setStatementText(sqlStatement.toString(), connection_.unicodeConverter_, extended); //@E3C @P0C @540C - request.setStatementText(sqlStatement.toString(), connection_.packageCCSID_Converter, extended);//Bidi-HCG - request.setStatementType (sqlStatement.getNativeType ()); - - if(packageManager_.isEnabled()) - { - if(sqlStatement.isPackaged()) - { - request.setPrepareOption (1); - request.setPackageName (packageManager_.getName (), connection_.converter_); //@P0C - } - else - { - request.setPrepareOption (0); - request.setPackageName(null, connection_.converter_); //send empty code point per - } - } - else - request.setPrepareOption (0); - - commonPrepareBefore (sqlStatement, request); - commonExecuteBefore (sqlStatement, request); - - if (execImmediateReply != null) { - execImmediateReply.returnToPool(); execImmediateReply = null; - } - if (normalPrepareReply != null) { - normalPrepareReply.returnToPool();normalPrepareReply = null; - } - if (connectReply != null) { connectReply.returnToPool(); connectReply=null; } - connectReply = connection_.sendAndReceive (request, id_); //@P0C - - int errorClass = connectReply.getErrorClass(); - int returnCode = connectReply.getReturnCode(); - - if(errorClass != 0) - { - positionOfSyntaxError_ = connectReply.getSQLCA().getErrd(5); //@F10A - - if(returnCode < 0) - JDError.throwSQLException (connection_, id_, errorClass, returnCode); - else - postWarning (JDError.getSQLWarning (connection_, id_, errorClass, returnCode)); - } - - // Compute the update count and number of results. - updateCount_ = 0; - numberOfResults_ = 0; - - commonPrepareAfter (sqlStatement, connectReply); - commonExecuteAfter (sqlStatement, connectReply); - - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - finally - { //@P0A - if(request != null) { - request.returnToPool(); request=null; - } - if (connectReply != null) { connectReply.returnToPool(); connectReply = null; } /*@B5A*/ - - } - - // Inform the transaction manager that a statement - // was executed. - transactionManager_.statementExecuted (); - - // Output a summary as a trace message. The * signifies that the - // statement name comes from the RPB. - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, - "Executed connect " + name_ + "*, SQL Statement -->[" + sqlStatement + "]"); - } - - } - // @E7A - end - - // CASE 2: Statement can be executed immediately. - // - // This is essentially the prepare and execute combined - // in one datastream. We will then be able to skip the - // execute step later. - // - else if((allowImmediate_) && (sqlStatement.isImmediatelyExecutable ())) - { // @E7C - - // Sync up the RPB. - syncRPB (); - - DBSQLRequestDS request = null; //@P0A - try - { - - int requestedORS = DBSQLRequestDS.ORS_BITMAP_RETURN_DATA+DBSQLRequestDS.ORS_BITMAP_SQLCA; //@F5A - boolean isCall = (sqlStatement.getNativeType () == JDSQLStatement.TYPE_CALL); //@cur - if(connection_.getVRM() >= JDUtilities.vrm610 ) //@cur //@isol - requestedORS += DBSQLRequestDS.ORS_BITMAP_CURSOR_ATTRIBUTES; //@cur - //@F5A If we are on a system that supports extended column descriptors and if the //@F5A - //@F5A user asked for them, send the extended column descriptors code point. //@F5A - boolean extendedMetaData = false; //@F5A - if(connection_.getVRM() >= JDUtilities.vrm520) //@F5A - { - //@F5A - extendedMetaData = connection_.getProperties().getBoolean(JDProperties.EXTENDED_METADATA); //@F5A - if(extendedMetaData) //@F5A - { - //@F5A - requestedORS = requestedORS + DBSQLRequestDS.ORS_BITMAP_EXTENDED_COLUMN_DESCRIPTORS; //@F5A - } //@F5A - } - - request = DBDSPool.getDBSQLRequestDS (DBSQLRequestDS.FUNCTIONID_EXECUTE_IMMEDIATE, id_, requestedORS, 0); //@P0C @F5C - - boolean extended = false; //@540 - if(connection_.getVRM() >= JDUtilities.vrm540) extended = true; //@540 - //Bidi-HCG request.setStatementText(sqlStatement.toString(), connection_.unicodeConverter_, extended); //@E3C @P0C @540C - request.setStatementText(sqlStatement.toString(), connection_.packageCCSID_Converter, extended);//Bidi-HCG - request.setStatementType (sqlStatement.getNativeType ()); - - int openAttributes = cursor_.getOpenAttributes (sqlStatement, blockCriteria_); - request.setOpenAttributes (openAttributes); - - if(packageManager_.isEnabled()) - { - if(sqlStatement.isPackaged()) - { - request.setPrepareOption (1); - request.setPackageName (packageManager_.getName (), connection_.converter_); //@P0C - } - else - { - request.setPrepareOption (0); - request.setPackageName(null, connection_.converter_); //send empty code point - } - } - else - request.setPrepareOption (0); - - //@F5A Don't have to check if a v5r2 system, because extendedMetaData - //@F5A can only be true if we are running to v5r2 - if(extendedMetaData) //@F5A - { - //@F5A - request.setExtendedColumnDescriptorOption((byte)0xF1); //@F5A - } //@F5A - - commonPrepareBefore (sqlStatement, request); - commonExecuteBefore (sqlStatement, request); - - if (connectReply != null) { - connectReply.returnToPool();connectReply = null; - } - if (normalPrepareReply != null) { - normalPrepareReply.returnToPool();normalPrepareReply = null; - } - - if (execImmediateReply != null) { execImmediateReply.returnToPool(); execImmediateReply=null;} - execImmediateReply = connection_.sendAndReceive (request, id_); //@P0C - - int errorClass = execImmediateReply.getErrorClass(); - int returnCode = execImmediateReply.getReturnCode(); - - DBReplySQLCA sqlca = execImmediateReply.getSQLCA (); //@F10M - - if(errorClass != 0) - { - positionOfSyntaxError_ = sqlca.getErrd(5); //@F10A - if(returnCode < 0) - JDError.throwSQLException (connection_, id_, errorClass, returnCode); - else - postWarning (JDError.getSQLWarning (connection_, id_, errorClass, returnCode)); - } - - transactionManager_.processCommitOnReturn(execImmediateReply); // @E2A - - cursor_.processCursorAttributes(execImmediateReply); //@cur - - // Compute the update count. - //@F10M DBReplySQLCA sqlca = reply.getSQLCA (); - updateCount_ = sqlca.getErrd (3); //@F1C - rowCountEstimate_ = -1; // @ECA - - //@F5A Don't have to check if a v5r2 system, because extendedMetaData - //@F5A can only be true if we are running to v5r2 - if(extendedMetaData) //@F5A - { - //@F5A - extendedColumnDescriptors_ = execImmediateReply.getExtendedColumnDescriptors (); //@F5A - } //@F5A - - //Make an auto-generated key result set if it was requested //@F5A - // Note: This should not happen if running to a release after V5R4 as the insert will always be wrapped with a SELECT //@GKA - if(autoGeneratedKeys_ == RETURN_GENERATED_KEYS && //@F5A - (connection_.getVRM() >= JDUtilities.vrm520)) //@F5A - makeGeneratedKeyResultSet(returnCode, sqlca); //@F5A - else if(generatedKeys_ != null) //@PDA genkeys - handle previous genkeys - { - generatedKeys_.close(); - generatedKeys_ = null; - } - - // Compute the number of results. - //boolean isCall = (sqlStatement.getNativeType () == JDSQLStatement.TYPE_CALL); //@cur moved above - if( /*(numberOfResults_ == 0) && */(isCall)) - numberOfResults_ = sqlca.getErrd (2); //@F1C - else - numberOfResults_ = 0; - - // If this is a CALL and result sets came back, but - // no format was returned, then open the cursor. The result - // set must be forward only and read only. - // This is a system restriction. @EBA - // As of V5R3, the restriction to be forward only no longer applies @KBA - if((isCall == true) && (numberOfResults_ > 0)) - { - boolean preV5R3 = connection_.getVRM() < JDUtilities.vrm530; - JDServerRow row = new JDServerRow (connection_, id_, - cursor_.openDescribe (openAttributes, resultSetType_), //@KBA - settings_); - JDServerRowCache rowCache = new JDServerRowCache (row, connection_, id_, getBlockingFactor ( - sqlStatement, row.getRowLength()), false, (preV5R3 ? ResultSet.TYPE_FORWARD_ONLY : resultSetType_), cursor_); //@PDC perf //@pda perf2 - fetch/close - - //if pre-v5r3 create a FORWARD_ONLY RESULT SET - if(preV5R3) //@KBA - { - resultSet_ = new AS400JDBCResultSet (this, - sqlStatement, rowCache, connection_.getCatalog(), - cursor_.getName(), maxRows_, ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY, fetchDirection_, - fetchSize_); - } - else //@KBA - { //@KBA - resultSet_ = new AS400JDBCResultSet (this, //@KBA - sqlStatement, rowCache, connection_.getCatalog(), //@KBA - cursor_.getName(), maxRows_, resultSetType_, //@KBA - ResultSet.CONCUR_READ_ONLY, fetchDirection_, //@KBA - fetchSize_); //@KBA - } - - if(resultSet_.getConcurrency () != resultSetConcurrency_) - postWarning (JDError.getSQLWarning (JDError.WARN_OPTION_VALUE_CHANGED)); - } - - commonPrepareAfter (sqlStatement, execImmediateReply); - commonExecuteAfter (sqlStatement, execImmediateReply); - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - finally - { //@P0A - if(request != null) { - request.returnToPool(); request = null; - } - if (execImmediateReply != null) { execImmediateReply.returnToPool(); execImmediateReply = null; } /*@B5A*/ - } - - // Inform the transaction manager that a statement - // was executed. - transactionManager_.statementExecuted (); - - // Output a summary as a trace message. The * signifies that the - // statement name comes from the RPB. - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, - "Executed immediately " + name_ + "*, SQL Statement -->[" + sqlStatement + "]"); - JDTrace.logInformation (this, - "Update count = " + updateCount_); - JDTrace.logInformation (this, - "Result set = " + (resultSet_ != null)); - JDTrace.logInformation (this, - "Number of result sets = " + numberOfResults_); - } - - } - - // CASE 3: Normal prepare. - // - else - { - - // Sync up the RPB. - syncRPB (); - - DBSQLRequestDS request = null; //@P0A - if (normalPrepareReply != null) { - normalPrepareReply.returnToPool(); normalPrepareReply = null; - } /* B5A */ - try - { - int requestedORS = DBSQLRequestDS.ORS_BITMAP_RETURN_DATA+DBSQLRequestDS.ORS_BITMAP_DATA_FORMAT+DBSQLRequestDS.ORS_BITMAP_SQLCA; //@F5A @F10C - //@F5A If we are on a system that supports extended column descriptors and if the //@F5A - //@F5A user asked for them, send the extended column descriptors code point. //@F5A - boolean extendedMetaData = false; //@F5A - if(connection_.getVRM() >= JDUtilities.vrm520) //@F5A - { - //@F5A - extendedMetaData = connection_.getProperties().getBoolean(JDProperties.EXTENDED_METADATA); //@F5A - if(extendedMetaData) //@F5A - { - //@F5A - requestedORS = requestedORS + DBSQLRequestDS.ORS_BITMAP_EXTENDED_COLUMN_DESCRIPTORS; //@F5A - } //@F5A - } - - request = DBDSPool.getDBSQLRequestDS(DBSQLRequestDS.FUNCTIONID_PREPARE_DESCRIBE, id_, requestedORS, 0); //@P0C @F5C - - boolean extended = false; //@540 - if(connection_.getVRM() >= JDUtilities.vrm540) extended = true; //@540 - //Bidi-HCG request.setStatementText(sqlStatement.toString(), connection_.unicodeConverter_, extended); //@E3C @P0C @540C - request.setStatementText(sqlStatement.toString(), connection_.packageCCSID_Converter, extended);//Bidi-HCG - request.setStatementType (sqlStatement.getNativeType ()); - - if(packageManager_.isEnabled()) - { - if(sqlStatement.isPackaged()) - { - request.setPrepareOption (1); - request.setPackageName (packageManager_.getName (), connection_.converter_); //@P0C - } - else - { - request.setPrepareOption (0); - request.setPackageName(null, connection_.converter_); //send empty code point - } - } - else - request.setPrepareOption (0); - - //@F5A Don't have to check if a v5r2 system, because extendedMetaData - //@F5A can only be true if we are running to v5r2 - if(extendedMetaData) //@F5A - { - //@F5A - request.setExtendedColumnDescriptorOption((byte)0xF1); //@F5A - } //@F5A - - commonPrepareBefore (sqlStatement, request); - if (execImmediateReply != null) { - execImmediateReply.returnToPool();execImmediateReply = null; - } - if (connectReply != null) { - connectReply.returnToPool();connectReply = null; - } - - if (normalPrepareReply != null) { normalPrepareReply.returnToPool(); normalPrepareReply=null; } - normalPrepareReply = connection_.sendAndReceive (request, id_); //@P0C - - int errorClass = normalPrepareReply.getErrorClass(); - int returnCode = normalPrepareReply.getReturnCode(); - - if(errorClass != 0) - { - positionOfSyntaxError_ = normalPrepareReply.getSQLCA().getErrd(5); //@F10A - - if(returnCode < 0) - JDError.throwSQLException (connection_, id_, errorClass, returnCode); - else - postWarning (JDError.getSQLWarning (connection_, id_, errorClass, returnCode)); - } - - // Gather results from the reply. - DBDataFormat dataFormat = normalPrepareReply.getDataFormat (); - if(dataFormat == null) - resultRow = null; - else - resultRow = new JDServerRow (connection_, id_, - dataFormat, settings_); - - //@F5A Don't have to check if a v5r2 system, because extendedMetaData - //@F5A can only be true if we are running to v5r2 - if(extendedMetaData) //@F5A - { - //@F5A - extendedColumnDescriptors_ = normalPrepareReply.getExtendedColumnDescriptors (); //@F5A - } //@F5A - - commonPrepareAfter (sqlStatement, normalPrepareReply); - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - finally - { //@P0A - if(request != null) { - request.returnToPool(); request=null; - } - if (normalPrepareReply != null) { normalPrepareReply.returnToPool(); normalPrepareReply = null; } //@B5A - } - - // Output a summary as a trace message. The * signifies that the - // statement name comes from the RPB. - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, - "Prepared " + name_ + "*, SQL Statement -->[" + sqlStatement + "]"); - } - - } - - // Check to see if the statement was cancelled. - if(cancelled_) - JDError.throwSQLException (JDError.EXC_OPERATION_CANCELLED); - - // If any of the fields is a locator, then we need to turn off @B2A - // record blocking. @B2A - lastPrepareContainsLocator_ = false; // @B2A - if(resultRow != null) - { // @B2A - int fieldCount = resultRow.getFieldCount (); // @B2A - for(int i = 1; i <= fieldCount; ++i) - { // @B2A - SQLData sqlData = resultRow.getSQLData(i); - int sqlType = sqlData.getSQLType(); //@xml3 - if(sqlType == SQLData.CLOB_LOCATOR || - sqlType == SQLData.BLOB_LOCATOR || - sqlType == SQLData.DBCLOB_LOCATOR || - sqlType == SQLData.NCLOB_LOCATOR || - sqlType == SQLData.XML_LOCATOR) //@xml3 - - lastPrepareContainsLocator_ = true; // @B2A - } // @B2A - } // @B2A - - return resultRow; - } - - - - /** - Performs common operations needed after a prepare. - - @param sqlStatement The SQL statement. - @param reply The prepare reply. - - @exception SQLException If an error occurs. - **/ - // - // This method is intended to be overriden, if needed. - // - void commonPrepareAfter (JDSQLStatement sqlStatement, - DBReplyRequestedDS reply) // private protected - throws SQLException - { - // Nothing. - } - - - - /** - Performs common operations needed before a prepare. - - @param sqlStatement The SQL statement. - @param request The prepare request. - - @exception SQLException If an error occurs. - **/ - // - // This method is intended to be overriden, if needed. - // - void commonPrepareBefore (JDSQLStatement sqlStatement, - DBSQLRequestDS request) // private protected - throws SQLException - { - // Close the result set before preparing another. - closeResultSet (JDCursor.REUSE_YES); - } - - - - /** - Performs common operations in leiu of a prepare. - - @param sqlStatement The SQL statement. - @param statementIndex The cached statement index. - - @exception SQLException If an error occurs. - **/ - // - // This method is intended to be overriden, if needed. - // - void commonPrepareBypass (JDSQLStatement sqlStatement, - int statementIndex) // private protected - throws SQLException - { - // Nothing. - } - - - - /** - Runs an SQL statement that may return multiple result sets. - This closes the current result set and clears warnings before - executing the new SQL statement. - -

Under some situations, a single SQL statement may return - multiple result sets, an update count, or both. This might occur - when executing a stored procedure that returns multiple - result sets or when dynamically executing an unknown SQL string. - -

Use getMoreResults(), getResultSet(), and getUpdateCount() - to navigate through multiple result sets, an update count, or - both. - - @param sql The SQL statement. - @return true if a result set was returned, false - if an update count was returned or nothing - was returned. - - @exception SQLException If the statement is not open, - the SQL statement contains a syntax - error, the query timeout limit is - exceeded, or an error occurs. - **/ - public boolean execute (String sql) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - settings_.getDecimalSeparator (), escapeProcessing_, - packageCriteria_, connection_); // @A1A @G4C - - if(JDTrace.isTraceOn()) // @D0A - JDTrace.logInformation (this, "Executing SQL Statement -->[" + sqlStatement + "]"); // @D0A - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removing this code to allow database engine errors to be returned. - // - // if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - // Prepare and execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - commonExecute (sqlStatement, resultRow); - - return(resultSet_ != null); - } - } - - - - //@G4A JDBC 3.0 - /** - Runs an SQL statement that may return multiple result sets and - makes any auto-generated keys available for retrieval using - Statement.getGeneratedKeys(). This closes the current result set - and clears warnings before executing the new SQL statement. - -

Under some situations, a single SQL statement may return - multiple result sets, an update count, or both. This might occur - when executing a stored procedure that returns multiple - result sets or when dynamically executing an unknown SQL string. - -

Use getMoreResults(), getResultSet(), and getUpdateCount() - to navigate through multiple result sets, an update count, or - both. - -

This method requires OS/400 V5R2 - or IBM i. If connecting to OS/400 V5R1 or earlier, an exception - will be thrown. - - @param sql The SQL statement. - @param autoGeneratedKeys Indicates whether auto-generated keys should be made available for - retrieval. Valid values are Statement.RETURN_GENERATED_KEYS and - Statement.NO_GENERATED_KEYS. - @return true if a result set was returned, false - if an update count was returned or nothing - was returned. - - @exception SQLException If the statement is not open, - the SQL statement contains a syntax - error, the query timeout limit is - exceeded, the value for autoGeneratedKeys is - not a valid value, if connecting to OS/400 V5R1 - or earlier, an error occurs. - @since Modification 5 - **/ - - public boolean execute (String sql, int autoGeneratedKeys) - throws SQLException - { - if(connection_.getVRM() < JDUtilities.vrm520) //@F5A - JDError.throwSQLException(JDError.EXC_FUNCTION_NOT_SUPPORTED); //@F5A - - verifyGeneratedKeysParameter(autoGeneratedKeys); - autoGeneratedKeys_ = autoGeneratedKeys; - - if((connection_.getVRM() >= JDUtilities.vrm610) && //@GKA - (autoGeneratedKeys_ == RETURN_GENERATED_KEYS)) //@GKA - { - synchronized(internalLock_) - { - checkOpen (); - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - settings_.getDecimalSeparator (), escapeProcessing_, - packageCriteria_, connection_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Executing SQL Statement -->[" + sqlStatement + "]"); - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removing this code to allow database engine errors to be returned. - // - //if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - if(sqlStatement.isInsert_) - { - String selectStatement = connection_.makeGeneratedKeySelectStatement(sql); - //Construct the new JDSQLStatement object - sqlStatement = new JDSQLStatement(selectStatement, settings_.getDecimalSeparator(), escapeProcessing_, packageCriteria_, connection_); - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Generated keys, SQL Statement -->[" + sqlStatement + "]"); - sqlStatement.setSelectFromInsert(true); - } - - // Prepare and execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - commonExecute (sqlStatement, resultRow); - - return(resultSet_ != null); - } - } - else //@GKA do what we always have - return execute (sql); - } - - - - //@G4A JDBC 3.0 - /** - Runs an SQL statement that may return multiple result sets and - makes any auto-generated keys for the columns indicated in the given array - available for retrieval using Statement.getGeneratedKeys(). - This closes the current result set and clears warnings before - executing the new SQL statement. - -

Under some situations, a single SQL statement may return - multiple result sets, an update count, or both. This might occur - when executing a stored procedure that returns multiple - result sets or when dynamically executing an unknown SQL string. - -

Use getMoreResults(), getResultSet(), and getUpdateCount() - to navigate through multiple result sets, an update count, or - both. - -

This method is not supported when connecting to IBM i V5R4 or earlier systems. - - @param sql The SQL statement. - @param columnIndexes Indicates that auto-generated keys for the indicated - columns should be made available for retrieval. - @return true if a result set was returned, false - if an update count was returned or nothing - was returned. - @exception java.sql.SQLException - If connecting to IBM i V5R4 or earlier systems, - if the statement is not open, - the SQL statement contains a syntax - error, the query timeout limit is - exceeded, the value for columnIndexes is - not a valid value, or an error occurs. - @since Modification 5 - **/ - public boolean execute (String sql, int[] columnIndexes) - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm610) //@GKA - { - synchronized(internalLock_) - { - checkOpen (); - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - settings_.getDecimalSeparator (), escapeProcessing_, - packageCriteria_, connection_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Executing SQL Statement -->[" + sqlStatement + "]"); - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removing this code to allow database engine errors to be returned. - // - // if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - //check if the statement is an insert statement - if(sqlStatement.isInsert_) - { - String selectStatement = connection_.makeGeneratedKeySelectStatement(sql, columnIndexes, null); - sqlStatement = new JDSQLStatement(selectStatement, settings_.getDecimalSeparator (), escapeProcessing_, packageCriteria_, connection_); - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Generated keys, SQL Statement -->[" + sqlStatement + "]"); - - autoGeneratedKeys_ = RETURN_GENERATED_KEYS; // specify we want generated keys - sqlStatement.setSelectFromInsert(true); - } - // Prepare and execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - commonExecute (sqlStatement, resultRow); - - return(resultSet_ != null); - } - } - else //@GKA - { - JDError.throwSQLException (JDError.EXC_FUNCTION_NOT_SUPPORTED); - return false; - } - } - - - - //@G4A JDBC 3.0 - /** - Runs an SQL statement that may return multiple result sets and - makes any auto-generated keys for the columns indicated in the given array - available for retrieval using Statement.getGeneratedKeys(). - This closes the current result set and clears warnings before - executing the new SQL statement. - -

Under some situations, a single SQL statement may return - multiple result sets, an update count, or both. This might occur - when executing a stored procedure that returns multiple - result sets or when dynamically executing an unknown SQL string. - -

Use getMoreResults(), getResultSet(), and getUpdateCount() - to navigate through multiple result sets, an update count, or - both. - -

This method is not supported when connecting to IBM i V5R4 or earlier systems. - - @param sql The SQL statement. - @param columnNames Indicates that auto-generated keys for the indicated - columns should be made available for retrieval. - @return true if a result set was returned, false - if an update count was returned or nothing - was returned. - @exception java.sql.SQLException - If connecting to IBM i V5R4 or earlier systems, - if the statement is not open, - the SQL statement contains a syntax - error, the query timeout limit is - exceeded, the value for columnNames is - not a valid value, or an error occurs. - @since Modification 5 - **/ - public boolean execute (String sql, String[] columnNames) - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm610) //@GKA - { - synchronized(internalLock_) - { - checkOpen (); - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - settings_.getDecimalSeparator (), escapeProcessing_, - packageCriteria_, connection_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Executing SQL Statement -->[" + sqlStatement + "]"); - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removing this code to allow database engine errors to be returned. - // - // if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - //check if the statement is an insert statement - if(sqlStatement.isInsert_) - { - String selectStatement = connection_.makeGeneratedKeySelectStatement(sql, null, columnNames); - sqlStatement = new JDSQLStatement(selectStatement, settings_.getDecimalSeparator (), escapeProcessing_, packageCriteria_, connection_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Generated keys, SQL Statement -->[" + sqlStatement + "]"); - - sqlStatement.setSelectFromInsert(true); - autoGeneratedKeys_ = RETURN_GENERATED_KEYS; // specify we want generated keys - } - // Prepare and execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - commonExecute (sqlStatement, resultRow); - - return(resultSet_ != null); - } - } - else // Do what we always have - { - JDError.throwSQLException (JDError.EXC_FUNCTION_NOT_SUPPORTED); - return false; - } - } - - - - // JDBC 2.0 - /** - Runs the batch of SQL statements. Batch updates can be used - to submit a set of SQL statements together as a single unit. - The SQL statements are run in the order in which they were - added to the batch. The batch is cleared after the SQL statements - are run. In addition, this closes the current result set and - clears warnings before executing the new SQL statement. - -

When batch updates are run, autocommit should usually be turned off. - This allows the caller to decide whether or not to commit the - transaction in the event that an error occurs and some of the - SQL statements in a batch fail to run. - - @return An array of row counts for the SQL statements that are run. - The array contains one element for each statement in the - batch of SQL statements. The array is ordered according to - the order in which the SQL statements were added to the batch. - - @exception SQLException If the statement is not open, - an SQL statement contains a syntax - error, the query timeout limit is - exceeded, an SQL statement returns - a result set, or an error occurs. - **/ - // - // Implementation notes: - // - // 1. We are using a Vector as the main data structure. - // Vector is supposedly synchronized already, so we - // should not have to worry about synchronization. - // - public int[] executeBatch () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - if(batch_ == null) batch_ = new Vector(); //@P0A - int batchSize = batch_.size (); - int[] updateCounts = new int[batchSize]; - - int i = 0; - try - { - Enumeration list = batch_.elements (); - while(list.hasMoreElements ()) - { - - // Prepare and execute. Check for a result set in - // both places. It is best to catch it after the - // prepare (so we don't open a cursor), but with - // some stored procedures, we can't catch it until - // the execute. - JDSQLStatement sqlStatement = (JDSQLStatement) list.nextElement (); - - if(JDTrace.isTraceOn()) // @D0A - JDTrace.logInformation (this, "Executing from batch SQL Statement -->[" + sqlStatement + "]"); // @D0A - - JDServerRow resultRow = commonPrepare (sqlStatement); - if(resultRow != null) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - - commonExecute (sqlStatement, resultRow); - if(resultSet_ != null) - { - closeResultSet (JDCursor.REUSE_YES); - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - updateCounts[i++] = updateCount_; - } - } - catch(SQLException e) - { - - // The specification says that if we get an error, - // then the size of the update counts array should - // reflect the number of statements that were - // executed without error. - int[] updateCounts2 = new int[i]; - System.arraycopy (updateCounts, 0, updateCounts2, 0, i); - - batch_.removeAllElements (); - throw new BatchUpdateException (e.getMessage (), - e.getSQLState (), e.getErrorCode (), updateCounts2); - } - - batch_.removeAllElements (); - return updateCounts; - } - } - - - - /** - Runs an SQL statement that returns a single result set. - This closes the current result set and clears warnings - before executing the new SQL statement. - - @param sql The SQL statement. - @return The result set that contains the data produced - by the query. - - @exception SQLException If the statement is not open, - the SQL statement contains a syntax - error, no result set is returned by the - database, the query timeout limit is - exceeded, or an error occurs. - **/ - public ResultSet executeQuery (String sql) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - settings_.getDecimalSeparator (), escapeProcessing_, - packageCriteria_, connection_); // @A1A @G4C - - if(JDTrace.isTraceOn()) // @D0A - JDTrace.logInformation (this, "Executing query, SQL Statement -->[" + sqlStatement + "]"); // @D0A - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removing this code to allow database engine errors to be returned. - // - // if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - // Prepare and execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - commonExecute (sqlStatement, resultRow); - - if((behaviorOverride_ & 1) == 0) // @F9a - { - // @F9a - if(resultSet_ == null) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - // @F9a - return resultSet_; - } - } - - - - /** - Runs an SQL INSERT, UPDATE, or DELETE statement, or any - SQL statement that does not return a result set. - This closes the current result set and clears warnings - before executing the new SQL statement. - - @param sql The SQL statement. - @return Either the row count for INSERT, UPDATE, or - DELETE, or 0 for SQL statements that - return nothing. - - @exception SQLException If the statement is not open, - the SQL statement contains a syntax - error, the query timeout limit is - exceeded, the statement returns - a result set, or an error occurs. - **/ - public int executeUpdate (String sql) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - settings_.getDecimalSeparator (), escapeProcessing_, - packageCriteria_, connection_); // @A1A @G4A - - - if(JDTrace.isTraceOn()) // @D0A - JDTrace.logInformation (this, "Executing update, SQL Statement -->[" + sqlStatement + "]"); // @D0A - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removing this code to allow database engine errors to be returned. - // - // if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - // Prepare and execute. Check for a result set in both - // places. It is best to catch it after the prepare (so - // we don't open a cursor), but with some stored procedures, - // we can't catch it until the execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - if(resultRow != null) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - - commonExecute (sqlStatement, resultRow); - if(resultSet_ != null) - { - closeResultSet (JDCursor.REUSE_YES); - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - return updateCount_; - } - } - - - - //@G4A JDBC 3.0 - /** - Runs an SQL INSERT, UPDATE, or DELETE statement, or any - SQL statement that does not return a result set and - makes any auto-generated keys available for retrieval using - Statement.getGeneratedKeys(). - This closes the current result set and clears warnings - before executing the new SQL statement. -

This method requires OS/400 V5R2 or - or IBM i. If connecting to OS/400 V5R1 or earlier, an exception - will be thrown. - - - @param sql The SQL statement. - @return Either the row count for INSERT, UPDATE, or - DELETE, or 0 for SQL statements that - return nothing. - - @exception SQLException If the statement is not open, - the SQL statement contains a syntax - error, the query timeout limit is - exceeded, the statement returns - a result set, the value for autoGeneratedKeys is - not a valid value, if connecting to OS/400 V5R1 - or earlier, an error occurs. - @since Modification 5 - **/ - public int executeUpdate (String sql, int autoGeneratedKeys) - throws SQLException - { - if(connection_.getVRM() < JDUtilities.vrm520) //@F5A - JDError.throwSQLException(JDError.EXC_FUNCTION_NOT_SUPPORTED); //@F5A - - verifyGeneratedKeysParameter(autoGeneratedKeys); - autoGeneratedKeys_ = autoGeneratedKeys; - - if((connection_.getVRM() >= JDUtilities.vrm610) && //@GKA - (autoGeneratedKeys_ == RETURN_GENERATED_KEYS)) //@GKA - { - synchronized(internalLock_) - { - checkOpen (); - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - settings_.getDecimalSeparator (), escapeProcessing_, - packageCriteria_, connection_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Executing SQL Statement -->[" + sqlStatement + "]"); - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removed this code let engine return error - // - //if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - if(sqlStatement.isInsert_) - { - String selectStatement = connection_.makeGeneratedKeySelectStatement(sql); - //Create a new JDSQLStatement - sqlStatement = new JDSQLStatement(selectStatement, settings_.getDecimalSeparator(), escapeProcessing_, packageCriteria_, connection_); - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Generated keys, SQL Statement -->[" + sqlStatement + "]"); - - sqlStatement.setSelectFromInsert(true); - // Prepare and execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - commonExecute (sqlStatement, resultRow); - } - else - { - // Prepare and execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - if(resultRow != null) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - commonExecute (sqlStatement, resultRow); - if(resultSet_ != null) - { - closeResultSet (JDCursor.REUSE_YES); - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - } - return updateCount_; - } - } - else //@GKA do what we always have - return executeUpdate (sql); - } - - - - //@G4A JDBC 3.0 - /** - Runs an SQL INSERT, UPDATE, or DELETE statement, or any - SQL statement that does not return a result set and - makes any auto-generated keys for the columns indicated in the given array - available for retrieval using Statement.getGeneratedKeys(). - This closes the current result set and clears warnings - before executing the new SQL statement. - -

This method is not supported when connecting to IBM i V5R4 or earlier systems. - - @param sql The SQL statement. - @param columnIndexes The indexes of columns for which auto-generated keys should be made - available for retrieval. - @return Either the row count for INSERT, UPDATE, or - DELETE, or 0 for SQL statements that - return nothing. - @exception SQLException If connection to IBM i V5R4 or earlier systems, - the statement is not open, - the SQL statement contains a syntax - error, the query timeout limit is - exceeded, the statement returns - a result set, the value for autoGeneratedKeys is - not a valid value or an error occurs. - - @since Modification 5 - **/ - public int executeUpdate (String sql, int[] columnIndexes) - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm610) //@GKA - { - synchronized(internalLock_) - { - //make sure the statement is open - checkOpen (); - - //create the sql statement object. - JDSQLStatement sqlStatement = new JDSQLStatement (sql, settings_.getDecimalSeparator (), escapeProcessing_, packageCriteria_, connection_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Executing update, SQL Statement -->[" + sqlStatement + "]"); - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removing this code to allow database engine errors to be returned. - // - - //if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - //check if the statement is an insert statement - if(sqlStatement.isInsert_) - { - String selectStatement = connection_.makeGeneratedKeySelectStatement(sql, columnIndexes, null); - sqlStatement = new JDSQLStatement(selectStatement, settings_.getDecimalSeparator (), escapeProcessing_, packageCriteria_, connection_); - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Generated keys, SQL Statement -->[" + sqlStatement + "]"); - - sqlStatement.setSelectFromInsert(true); - autoGeneratedKeys_ = RETURN_GENERATED_KEYS; // specify we want generated keys - // prepare and execute - JDServerRow resultRow = commonPrepare(sqlStatement); - commonExecute(sqlStatement, resultRow); - } - else // treat just like executeUpdate(String sql) was called - { - // Prepare and execute. Check for a result set in both - // places. It is best to catch it after the prepare (so - // we don't open a cursor), but with some stored procedures, - // we can't catch it until the execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - if(resultRow != null) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - - commonExecute (sqlStatement, resultRow); - if(resultSet_ != null) - { - closeResultSet (JDCursor.REUSE_YES); - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - } - return updateCount_; - } - } - else - { - JDError.throwSQLException (JDError.EXC_FUNCTION_NOT_SUPPORTED); - return 0; - } - } - - - - //@G4A JDBC 3.0 - /** - Runs an SQL INSERT, UPDATE, or DELETE statement, or any - SQL statement that does not return a result set and - makes any auto-generated keys for the columns indicated in the given array - available for retrieval using Statement.getGeneratedKeys(). - This closes the current result set and clears warnings - before executing the new SQL statement. - -

This method is not supported when connecting to IBM i V5R4 or earlier systems. - - @param sql The SQL statement. - @param columnNames The column names for which auto-generated keys should be made - available for retrieval. - @return Either the row count for INSERT, UPDATE, or - DELETE, or 0 for SQL statements that - return nothing. - @exception SQLException If connection to IBM i V5R4 or earlier systems, - the statement is not open, - the SQL statement contains a syntax - error, the query timeout limit is - exceeded, the statement returns - a result set, the value for autoGeneratedKeys is - not a valid value or an error occurs. - @since Modification 5 - **/ - public int executeUpdate (String sql, String[] columnNames) - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm610) //@GKA - { - synchronized(internalLock_) - { - //make sure the statement is open - checkOpen (); - - //create the sql statement object. - JDSQLStatement sqlStatement = new JDSQLStatement (sql, settings_.getDecimalSeparator (), escapeProcessing_, packageCriteria_, connection_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Executing update, SQL Statement -->[" + sqlStatement + "]"); - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removing this code to allow database engine errors to be returned. - // - - //if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - //check if the statement is an insert statement - if(sqlStatement.isInsert_) - { - String selectStatement = connection_.makeGeneratedKeySelectStatement(sql, null, columnNames); - sqlStatement = new JDSQLStatement(selectStatement, settings_.getDecimalSeparator (), escapeProcessing_, packageCriteria_, connection_); - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Generated keys, SQL Statement -->[" + sqlStatement + "]"); - - sqlStatement.setSelectFromInsert(true); - autoGeneratedKeys_ = RETURN_GENERATED_KEYS; // specify we want generated keys - //prepare and execute - JDServerRow resultRow = commonPrepare(sqlStatement); - commonExecute(sqlStatement, resultRow); - } - else // treat just like executeUpdate(String sql) was called - { - // Prepare and execute. Check for a result set in both - // places. It is best to catch it after the prepare (so - // we don't open a cursor), but with some stored procedures, - // we can't catch it until the execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - if(resultRow != null) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - - commonExecute (sqlStatement, resultRow); - if(resultSet_ != null) - { - closeResultSet (JDCursor.REUSE_YES); - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - } - return updateCount_; - } - } - else - { - JDError.throwSQLException (JDError.EXC_FUNCTION_NOT_SUPPORTED); - return 0; - } - } - - - - /** - Closes the statement if not explicitly closed by the caller. - - @exception Throwable If an error occurs. - **/ - protected void finalize () - throws Throwable - { - try{ - if(! isClosed ()) { - JDTrace.logInformation (this, "WARNING: Finalizer thread closing statement object."); - close (); - } - } - catch(Exception e){ - //catch any exceptions and don't throw them - } - super.finalize (); - } - - - - /** - Returns the appropriate blocking factor for the SQL statement. - - @param sqlStatement The SQL statement. - @param rowLength The row length. - @return The blocking factor (in rows). - **/ - int getBlockingFactor (JDSQLStatement sqlStatement, - int rowLength) // private protected - { - boolean block = false; - boolean useFetchSize = false; - - // Only block if the cursor is not updatable - // and no locators are in the result set. @B2A - if((cursor_.getConcurrency() != ResultSet.CONCUR_UPDATABLE) // @B2C @EAC - && (lastPrepareContainsLocator_ == false) - && (resultSetType_ != ResultSet.TYPE_SCROLL_SENSITIVE)) //@KKB we do not want to block if a sensitive cursor is being used - { // @B2A - - // Determine if we should block based on the block - // criteria and SQL statement characteristics. - if(blockCriteria_.equalsIgnoreCase (JDProperties.BLOCK_CRITERIA_NONE)) - { - block = true; - useFetchSize = true; - } - - if(sqlStatement != null) - { - if((blockCriteria_.equalsIgnoreCase (JDProperties.BLOCK_CRITERIA_IF_FETCH)) - && (sqlStatement.isForFetchOnly())) - block = true; - - else if((blockCriteria_.equalsIgnoreCase (JDProperties.BLOCK_CRITERIA_UNLESS_UPDATE)) - && (! sqlStatement.isForUpdate())) - block = true; - } - else - if(blockCriteria_.equalsIgnoreCase (JDProperties.BLOCK_CRITERIA_UNLESS_UPDATE)) - block = true; - - } - - // Compute the blocking factor. - int blockingFactor; - if(block) - { - if(useFetchSize) - blockingFactor = fetchSize_; - else - { - blockingFactor = (blockSize_ * 1024) / rowLength; - if(blockingFactor > 32767) - blockingFactor = 32767; - else if(blockingFactor <= 0) - blockingFactor = 1; - } - } - else - blockingFactor = 1; - - return blockingFactor; - } - - - - // JDBC 2.0 - /** - Returns the connection for this statement. - - @return The connection for this statement. - - @exception SQLException If an error occurs. - **/ - public Connection getConnection () - throws SQLException - { - return connection_; - } - - - - /** - Returns the name of the SQL cursor that is used by - subsequent statement execute methods. - - @return The cursor name. - **/ - String getCursorName () - { - synchronized(internalLock_) - { // @E6A - return cursor_.getName (); - } - } - - - - //@F3A - /** - Returns extended column descriptors for this statement. - This will be null if the user has the "extended meta data" - property set to false (the default). - - @return The extended column descriptors for this statement. - **/ - DBExtendedColumnDescriptors getExtendedColumnDescriptors () - { - synchronized(internalLock_) - { - return extendedColumnDescriptors_; - } - } - - - - // JDBC 2.0 - /** - Returns the fetch direction. - - @return The fetch direction. - - @exception SQLException If the statement is not open. - **/ - public int getFetchDirection () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return fetchDirection_; - } - } - - - - // JDBC 2.0 - /** - Returns the fetch size. - - @return The fetch size. - - @exception SQLException If the statement is not open. - **/ - public int getFetchSize () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return fetchSize_; - } - } - - - - //@G4A JDBC 3.0 - /** - Retrieves any auto-generated keys created as a result of executing this Statement object. - Currently DB2 for IBM i supports returning only one auto-generated key to the Toolbox JDBC driver - -- the key for the last inserted row. Be aware that the generated key returned is not - guaranteed to be unique unless a unique constraint is created on the table. - -

In order for this method to return auto-generated keys, the statement must be executed on - a table with an identity column. For more information about identity columns, Go to the - IBM i Information Center, and search on the phrase "identity column". - - -

This method requires OS/400 V5R2 or IBM i. If connecting to OS/400 V5R1 or earlier, - an exception will be thrown. - -

This method will return null if the user did not request auto-generated keys - during the execute of a Statement or during the prepare of a PreparedStatement. - This method will also return null if the application has not executed the - statement before calling this method. - -

This method will return an empty result set if the database did not generate - any auto-generated keys when executing the statement. - - @return The ResultSet object containing the auto-generated key(s) - generated by the execution of this Statement object, an empty - result set if the database did not generate any auto-generated keys, - or null if the application did not request auto-generated keys or - did not execute the statement before calling this method. - - @exception SQLException If the statement is not open, - if connecting to OS/400 V5R1 or earlier, - an error occurs. - @since Modification 5 - **/ - public ResultSet getGeneratedKeys () - throws SQLException - { - synchronized(internalLock_) - { - if(connection_.getVRM() < JDUtilities.vrm520) //@F5A - { - //@F5A - JDError.throwSQLException (JDError.EXC_FUNCTION_NOT_SUPPORTED); //@F5A - return null; //@F5A - } //@F5A - //Check if open because generated key result set only makes sense if the - //Statement is currently open. - checkOpen (); - - //@F6 If the user didn't execute the statement yet, throw a function sequence exception. - //@F6 If it's just an issue of the database not returning any keys, - //@F6 return an empty result set. - //@F6 Since we will also have null generated keys if the database did not - //@F6 return us any values, return null instead of throwing a function sequence error. - //@F6 This matches the behavior of Statement.getResultSet() if no result set was - //@F6 created, or getResultSet() is called before executing a statement. - //@F6D If we have not made any generated keys yet, a statement must - //@F6D not have been executed, so throw a function sequence error. - //@F6D if (generatedKeys_ == null) - //@F6D JDError.throwSQLException (JDError.EXC_FUNCTION_SEQUENCE); - - return generatedKeys_; - } - } - - - - /** - Returns the maximum field size limit for the statement. - The maximum field size limit is the maximum amount of data - returned for any column value. It applies only to BINARY, - VARBINARY, CHAR, and VARCHAR fields. If the limit is exceeded, - then the excess data is discarded. - - @return The maximum field size limit (in bytes), or - 0 for no limit. - - @exception SQLException If the statement is not open. - **/ - public int getMaxFieldSize () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return maxFieldSize_; - } - } - - - - /** - Returns the maximum rows limit for the statement. - The maximum rows limit is the maximum number of rows that a - result set can contain. If the limit is exceeded, then the - excess rows are dropped. - - @return The maximum rows limit, or 0 for no limit. - - @exception SQLException If the statement is not open. - **/ - public int getMaxRows () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return maxRows_; - } - } - - - - /** - Returns the next result set. This closes the - current result set. - - @return true if another result set is available, false - if there are no more result sets. - - @exception SQLException If an error occurs. - **/ - public boolean getMoreResults () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - // Initialize. - cancelled_ = false; - checkOpen (); - closeResultSet (JDCursor.REUSE_RESULT_SET); - - // Determine if there more result sets. - if(--numberOfResults_ > 0) - { - - // Send the data stream. - DBSQLRequestDS request = null; //@P0A - try - { - if((connection_.getVRM() >= JDUtilities.vrm610)) //@cur //@isol - request = DBDSPool.getDBSQLRequestDS(DBSQLRequestDS.FUNCTIONID_OPEN_DESCRIBE, id_, DBSQLRequestDS.ORS_BITMAP_RETURN_DATA+DBSQLRequestDS.ORS_BITMAP_SQLCA+DBSQLRequestDS.ORS_BITMAP_DATA_FORMAT+DBSQLRequestDS.ORS_BITMAP_CURSOR_ATTRIBUTES, 0); //@cur - else - request = DBDSPool.getDBSQLRequestDS(DBSQLRequestDS.FUNCTIONID_OPEN_DESCRIBE, id_, DBSQLRequestDS.ORS_BITMAP_RETURN_DATA+DBSQLRequestDS.ORS_BITMAP_SQLCA+DBSQLRequestDS.ORS_BITMAP_DATA_FORMAT, 0); //@P0C - - int openAttributes = cursor_.getOpenAttributes(null, blockCriteria_); // @E1A - request.setOpenAttributes(openAttributes); // @E1C - - //Set the cursor scrollability option if V5R3 or higher, prior to V5R3 we can only be forward only. - if(connection_.getVRM() >= JDUtilities.vrm530) - { - String cursorSensitivity = connection_.getProperties().getString(JDProperties.CURSOR_SENSITIVITY); //@F8A - if(resultSetType_ == ResultSet.TYPE_FORWARD_ONLY) //@KBA - { - //@KBA - //Determine if user set cursor sensitivity property //@KBA - if(cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_INSENSITIVE)) //@KBA - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_INSENSITIVE); //@KBA Option 5 - else //@KBA - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_ASENSITIVE); //@KBA Option 0 - } //@KBA - else if(resultSetType_ == ResultSet.TYPE_SCROLL_SENSITIVE) //@KBA - { - //@KBA - //Determine if user set cursor sensitivity property //@KBA - if(cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_ASENSITIVE)) //@KBA - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_ASENSITIVE); //@KBA Option 1 - else //@KBA - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_SENSITIVE); //@KBA Option 3 - } //@KBA - else //ResultSet.TYPE_SCROLL_INSENSITIVE //@KBA - { - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_INSENSITIVE); //@KBA Option 2 - } //@KBA - } - - if (getMoreResultsReply != null) { getMoreResultsReply.returnToPool(); getMoreResultsReply=null; } - getMoreResultsReply = connection_.sendAndReceive (request, id_); //@P0C - - // Gather information from the reply. - DBReplySQLCA sqlca = getMoreResultsReply.getSQLCA (); - DBDataFormat dataFormat = getMoreResultsReply.getDataFormat (); - if(this instanceof AS400JDBCCallableStatement) // @550A - dataFormat.setCSRSData(true); // @550A - - // Check for system errors. - int errorClass = getMoreResultsReply.getErrorClass(); - int returnCode = getMoreResultsReply.getReturnCode(); - - if(errorClass != 0) - { - if(returnCode < 0) - JDError.throwSQLException (connection_, id_, errorClass, returnCode); - else - postWarning (JDError.getSQLWarning (connection_, id_, errorClass, returnCode)); - } - - // Process a potential cursor conecurrency override. @E1A @EAC - cursor_.processConcurrencyOverride(openAttributes, getMoreResultsReply); // @E1A @EAC - - cursor_.processCursorAttributes(getMoreResultsReply); //@cur - - // Note that the cursor was opened. - cursor_.setState (false); - - // Compute the result set. - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, - settings_); - JDServerRowCache rowCache = new JDServerRowCache ( - row, connection_, id_, getBlockingFactor ( - null, row.getRowLength()), false, resultSetType_, cursor_); //@PDC perf //@pda perf2 - fetch/close - - // If the result set concurrency is updatable, check to @E1C - // see if the system overrode the cursor type to read only. @E1C - // Don't worry about the other direction (system overrides @E1C - // from read-only to updatable). @E1C - int actualConcurrency = (resultSetConcurrency_ == ResultSet.CONCUR_UPDATABLE) // @E1C - ? cursor_.getConcurrency() : resultSetConcurrency_; // @E1C @EAC - - resultSet_ = new AS400JDBCResultSet (this, null, - rowCache, connection_.getCatalog(), - cursor_.getName(), maxRows_, resultSetType_, - actualConcurrency, fetchDirection_, - fetchSize_); // @ECC - if(resultSet_.getConcurrency () != resultSetConcurrency_) - postWarning (JDError.getSQLWarning (JDError.WARN_OPTION_VALUE_CHANGED)); - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - finally - { //@P0A - if(request != null) { - request.returnToPool(); request = null; - } - if (getMoreResultsReply != null) { getMoreResultsReply.returnToPool(); getMoreResultsReply = null; } - } - } - - // Check to see if the statement was cancelled. - if(cancelled_) - JDError.throwSQLException (JDError.EXC_OPERATION_CANCELLED); - - // @A0A - // Added code to set updateCount_ = -1. - updateCount_ = -1; // @A0A - - return(resultSet_ != null); - } - } - - - - //@G4A JDBC 3.0 - /** - Returns the next result set. This closes the current result set. This method - handles any current ResultSet object(s) according to the instructions specified - by the actionOnCurrentResultSet parameter, and returns true if the next result is a - ResultSet object. - - @param current What should happen to current ResultSet objects - obtained using the method getResultSet. Valid values are - CLOSE_CURRENT_RESULT, KEEP_CURRENT_RESULT, and CLOSE_ALL_RESULTS. - - @return Always false because this method is not supported. - - @exception SQLException if DatabaseMetaData.supportsMultipleOpenResults returns false - and either Statement.KEEP_CURRENT_RESULT or Statement.CLOSE_ALL_RESULTS are - supplied as the argument. - @since Modification 5 - **/ - public boolean getMoreResults (int current) - throws SQLException - { - if(current == Statement.CLOSE_CURRENT_RESULT) //@forum1 - return getMoreResults(); //@forum1 - - JDError.throwSQLException (JDError.EXC_FUNCTION_NOT_SUPPORTED); - return false; - } - - - //@F10A - /** - Will return the value of the last syntax error that came back from the IBM i system. - - @return The value of the character of the last syntax error from the system, - or 0 if no errors occurred or the value is not known. - - @exception SQLException If the statement is not open. - **/ - public int getPositionOfSyntaxError () - throws SQLException - { - synchronized(internalLock_) - { - checkOpen (); - return positionOfSyntaxError_; - } - } - - - /** - Returns the query timeout limit for this statement. - The query timeout limit is the number of seconds that the - driver will wait for an SQL statement to execute. - - @return The query timeout limit (in seconds), or - 0 for no limit. - - @exception SQLException If the statement is not open. - **/ - public int getQueryTimeout () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return queryTimeout_; - } - } - - - - /** - Returns the current result set. - - @return The current result set, or null if an update - count was returned or there are no more - result sets. - - @exception SQLException If the statement is not open. - **/ - public ResultSet getResultSet () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return resultSet_; - } - } - - - - // JDBC 2.0 - /** - Returns the result set concurrency to be used for this statement. - - @return The result set concurrency. - - @exception SQLException If the statement is not open. - **/ - public int getResultSetConcurrency () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return resultSetConcurrency_; - } - } - - - - //@G4A JDBC 3.0 - /** - Returns the result set cursor holdability to be used for this statement. - - @return The cursor holdability. Valid values are ResultSet.HOLD_CURSORS_OVER_COMMIT and - ResultSet.CLOSE_CURSORS_AT_COMMIT. The holdability is derived in this order - of precedence: -

    -
  • 1. The holdability, if any, that was specified on statement creation using - the methods createStatement(), prepareCall(), or prepareStatement() on the - Connection object. -
  • 2. The holdability specified using the method setHoldability(int) - if this method was called on the Connection object. -
  • 3. If neither of above methods were called, the value of the - cursor hold - driver property.
- Full functionality of #1 and #2 requires OS/400 v5r2 - or IBM i. If connecting to OS/400 V5R1 or earlier, - the value specified on these two methods will be ignored and the default holdability - will be the value of #3. - - @exception SQLException If the statement is not open. - - @since Modification 5 - **/ - public int getResultSetHoldability () - throws SQLException - { - synchronized(internalLock_) - { - checkOpen (); - - //if we can get info from resultSet (post 540), that will be more accurate, since it can be from stored-proc cursor - if((resultSet_ != null) && (!resultSet_.isClosed())) //@cur //@cur2 - return resultSet_.getHoldability(); //@cur - - //@F4 If resultSetHoldability_ was set by the user, then return it. Otherwise, - //@F4 return the connection's holdability. - if((resultSetHoldability_ == AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT) || //@F4A - (resultSetHoldability_ == AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT)) //@F4A - { - //@F4A - return resultSetHoldability_; //@F4A - } //@F4A - return connection_.getHoldability(); - } - } - - - - - // JDBC 2.0 - /** - Returns the result set type to be used for this statement. - - @return The result set type. - - @exception SQLException If the statement is not open. - **/ - public int getResultSetType () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return resultSetType_; - } - } - - - - /** - Returns the current update count. - - @return The update count, or -1 if a result set was - returned or there are no more result sets. - - @exception SQLException If the statement is not open. - **/ - public int getUpdateCount () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return(resultSet_ != null) ? -1 : updateCount_; - } - } - - - - /** - Returns the first warning reported for the statement. - Subsequent warnings may be chained to this warning. - - @return The first warning, or null if no warnings - have been reported. - - @exception SQLException If an error occurs. - **/ - public SQLWarning getWarnings () - throws SQLException - { - return sqlWarning_; - } - - - //@KBL - /* - Sets whether or not the statement has been partially closed and if the remaining resources - should be freed when a transaction boundary is reached. - A statement may become partially closed if the user specified to keep statements associated with - locators open until a transaction boundary by setting the "hold statements" connection property to true. - */ - void setHoldStatement(boolean hold){ - holdStatement_ = hold; - } - - //@KBL - /* - Returns whether or not the statement has been partially closed. - A statement may become partially closed if the user specified to keep statements associated with - locators open until a transaction boundary by setting the "hold statements" connection property to true. - */ - boolean isHoldStatement() - { - return holdStatement_; - } - - //@KBL - /* - Sets whether or not this statement object has been used to access a locator. - */ - void setAssociatedWithLocators(boolean hasLocator){ - associatedWithLocators_ = hasLocator; - } - - //@KBL - /* - Returns whether or not this statement object has been used to access a locator. - */ - boolean isAssociatedWithLocators(){ - return associatedWithLocators_; - } - - /** - Indicates if the statement is closed. - - @return true if the statement is closed; - false otherwise. - **/ - public boolean isClosed () throws SQLException //@PDC jdbc40 - { - return closed_; - } - - - - //@G4A - /** - Creates a result set to be returned from getGeneratedKeys(). - - Make an empty result set if return code is < 0 because the information - will not be waiting for us in the SQLCA. - **/ - private void makeGeneratedKeyResultSet(int returnCode, DBReplySQLCA sqlca) - throws SQLException - { - //@F6A Make sure we close the generated key result set. We don't have to - //@F6A check to see if the user closed it already because close() does - //@F6A that for us already. - if(generatedKeys_ != null) //@F6A - { - //@F6A - generatedKeys_.close(); //@F6A - } //@F6A - //Code checks we are running to a v5r2 or later system before calling this method - BigDecimal generatedKey = null; //@F6C - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "returnCode is: " + returnCode); - - if(returnCode < 0) - { - // If SQLCode (returnCode) from system is not 0, then don't go look - // for auto-generated key because it will not be there. Instead, - // make empty result set. - //@F6D generatedKey = ""; - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "return code was not 0, generated key is null"); - } - else - { - // As of right now, we will only be returned the last auto-generated key. - // Even though it is wasteful to return a ResultSet with only one element, - // that's what the spec. says we have to do. - - // Consider going to system in the future to fill in the field name. - // Right now, it doesn't seem like a cost-effective trip. - - // If there is no error, the errmc is instead filled with the auto-generated - // key for us. - generatedKey = sqlca.getGeneratedKey(); //@P0C @F6C Deleted converter - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "generated key from system is: " + generatedKey); - // generatedKey will be null if the database did not return to us a - // proper generatedKey - } - String[] fieldNames = {""}; - SQLData[] sqlData = { new SQLDecimal (30, 0, settings_, connection_.getVRM(), connection_.getProperties())}; //@F6C // @M0C - changed SQLDecimal ctor signature - int[] fieldNullables = {AS400JDBCDatabaseMetaData.columnNoNulls}; - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - boolean[][] nulls = {{false}}; - boolean[][] dataMappingErrors = {{false}}; - JDRowCache rowCache = null; - if(generatedKey == null) - { - rowCache = new JDSimpleRowCache(formatRow); - } - else - { - Object[][] data = {{generatedKey}}; - rowCache = new JDSimpleRowCache (formatRow, data, nulls, dataMappingErrors); - } - // Construct with row cache, no catalog, and no cursor name - generatedKeys_ = new AS400JDBCResultSet (rowCache, "", "", connection_, null); //@in2 - } - - - - // @B3A - /** - Marks the cursor as closed. - - @param isRollback True if we called this from rollback(), false if we called this from commit(). - **/ - void markCursorClosed(boolean isRollback) //@F4C - throws SQLException //@F2A - { - // @K94 - See if the user requested to hold cursors after a rollback - boolean rollbackCursorHold = connection_.getProperties().getBoolean(JDProperties.ROLLBACK_CURSOR_HOLD); //@K94 - if(rollbackCursorHold) //@K94 - isRollback = false; //@K94 - - // @F4 Added a check of statement level holdability because the user can specify the - // @F4 holdability of a specific statement (as a different value than the connection - // @F4 holdability) with JDBC 3.0 support. If this was called from Connection.rollback(), - // @F4 close all statements. - if((getResultSetHoldability() == AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT //@F4A - || isRollback) //@F4A - && ((connection_.getVRM() <= JDUtilities.vrm610) - || ((connection_.getVRM() >= JDUtilities.vrm710) && cursor_.getCursorIsolationLevel() != 0))) //@isol only close if cursor's isolationlvl is not *none - { - //@F5D cursor_.setState(true); - //@F4 Instead of calling closeResultSet which does more work than we need to, - //@F4 just move the code here that we need to clean up our internal variables. - //@F4 Otherwise, we'd make an unnecessary flow to the system to tell it to - //@F4 close the cursor which it already has. - if(resultSet_ != null) //@F4A - { - //@F4A - if(! resultSet_.isClosed ()) //@F4A - resultSet_.close (); //@F4A - resultSet_ = null; //@F4A - } //@F4A - updateCount_ = -1; //@F4A - } - } - - - - - /** - Notifies the statement that its result set has been closed. - - @exception SQLException If an error occurs. - **/ - void notifyClose () - throws SQLException - { - // The result set is close, so we can close the cursor. - if(! cursor_.isClosed ()) - { - if(numberOfResults_ > 1) - cursor_.close (JDCursor.REUSE_RESULT_SET); - else - cursor_.close (JDCursor.REUSE_YES); - } - } - - - - /** - Posts a warning for the statement. - - @param sqlWarning The warning. - **/ - void postWarning (SQLWarning sqlWarning) - { - if(sqlWarning_ == null) - sqlWarning_ = sqlWarning; - else - sqlWarning_.setNextWarning (sqlWarning); - } - - - - // @E9C - /** - Sets the SQL cursor name that will be used by the statement. - Cursor names must be unique within the connection. - The cursor name can only be set when no result set is open. - -

The cursor name can be used in SQL positioned UPDATE or DELETE - statements to identify the current row in the result set generated - by this statement. By definition, SQL positioned UPDATEs or - DELETEs must be executed by a different statement than the one - that generated the result set being used for positioning. - -

Cursor names are case sensitive. However, when using a cursor - name within other SQL positioned UPDATE or DELETE statements, - the cursor name will be uppercased. If you use a cursor name - with lowercase characters, you need to enclose it in double - quotes when referring to it in other SQL statements. - - @param cursorName The cursor name. If null, a unique - default name will be used. - - @exception SQLException If the statement is not open, - a result set is open, the cursor - name is not unique within the - connection, or an error occurs. - **/ - // - // Implementation note: - // - // If you set the cursor name to a mixed case string, and then - // later refer to it in an SQL statement, SQL will choke because it - // will have uppercased the string. - // - // At first I thought we should always uppercase, the cursor name - // but that limits callers. The better solution is to have the callers - // surround mixed case cursor names in SQL statements with double - // quotes. - // - public void setCursorName (String cursorName) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - - // Check that no cursor is open for this statement. - // We can not just check the cursor, because if the - // caller closes the result set, we do not close the - // cursor right away. - if(resultSet_ != null) - { - if(! resultSet_.isClosed ()) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - else - closeResultSet (JDCursor.REUSE_YES); - } - - // If name is null, then use the default name. - if(cursorName == null) - cursorName = cursorDefaultName_; - - // Validate the length of the cursor name. - int cursorNameLength = cursorName.length(); // @EEA - int maxLength = (connection_.getVRM() >= JDUtilities.vrm610) ? MAX_CURSOR_NAME_LENGTH : MAX_CURSOR_NAME_LENGTH_PRE_V6R1; //@550 128 byte cursor name support - if((cursorNameLength > maxLength) || (cursorNameLength == 0)) // @EEC @550 changed MAX_CURSOR_NAME_LENGTH to maxLength - JDError.throwSQLException (JDError.EXC_CURSOR_NAME_INVALID); - - // If the name is the same as the current cursor name, - // then nothing needs to be done. (If we go through - // with the change and the cursor name is the same, it - // will get flagged as ambiguous). - if(! cursorName.equals (cursor_.getName ())) - { - - // Check that the cursor name is unique within the - // connection. - if(connection_.isCursorNameUsed (cursorName)) - JDError.throwSQLException (JDError.EXC_CURSOR_NAME_AMBIGUOUS); - - cursor_.setName (cursorName); - - // Since we store the cursor name in the RPB, we need - // to sync it after a change. - rpbSyncNeeded_ = true; - - } - } - } - - - - /** - Sets the escape processing mode. When processing escape - clauses, the JDBC driver substitutes escape clauses - in SQL statements with DB2 for IBM i SQL grammar elements. - If escape processing is not needed, then setting the escape - processing mode to false improves performance. - - @param escapeProcessing true to process escape clauses; - false otherwise. The default - is true. - - @exception SQLException If the statement is not open. - **/ - public void setEscapeProcessing (boolean escapeProcessing) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - escapeProcessing_ = escapeProcessing; - - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Escape processing", escapeProcessing_); - } - } - - - - // JDBC 2.0 - /** - Sets the direction in which the rows in a result set will be - processed. - -

This setting is not used. - - @param fetchDirection The fetch direction for processing rows. - Valid values are: -

    -
  • ResultSet.FETCH_FORWARD -
  • ResultSet.FETCH_REVERSE -
  • ResultSet.FETCH_UNKNOWN -
- The default is ResultSet.FETCH_FORWARD. - - @exception SQLException If the statement is not open, - the result set type is - ResultSet.TYPE_FORWARD_ONLY, - and the input value is not - ResultSet.FETCH_FORWARD, - or the input value is not valid. - **/ - public void setFetchDirection (int fetchDirection) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - if(((fetchDirection != ResultSet.FETCH_FORWARD) - && (fetchDirection != ResultSet.FETCH_REVERSE) - && (fetchDirection != ResultSet.FETCH_UNKNOWN)) - || ((resultSetType_ == ResultSet.TYPE_FORWARD_ONLY) - && (fetchDirection != ResultSet.FETCH_FORWARD))) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - checkOpen (); - fetchDirection_ = fetchDirection; - - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Fetch direction", fetchDirection_); - } - } - - - - // JDBC 2.0 - /** - Sets the number of rows to be fetched from the database when more - rows are needed. The number of rows specified only affects result - sets created using this statement. If the value specified is zero, - then the driver will choose an appropriate fetch size. - -

This setting only affects statements that meet the criteria - specified in the "block criteria" property. The fetch size - is only used if the "block size" property is set to "0". - - @param fetchSize The number of rows. This must be greater than - or equal to 0 and less than or equal to the - maximum rows limit. The default is zero. - - @exception SQLException If the statement is not open - or the input value is not valid. - **/ - public void setFetchSize (int fetchSize) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - if((fetchSize < 0) - || ((fetchSize > maxRows_) && (maxRows_ > 0))) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - checkOpen (); - fetchSize_ = fetchSize; - - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Fetch size", fetchSize_); - } - } - - - - /** - Sets the maximum field size limit. The maximum field size - limit is the maximum amount of data returned for any column - value. It applies only to BINARY, VARBINARY, CHAR, and VARCHAR - fields. If the limit is exceeded, then the excess data is - discarded. - - @param maxFieldSize The maximum field size limit (in bytes) or - 0 for no limit. The default is 0. - - @exception SQLException If the statement is not open - or the input value is not valid. - **/ - public void setMaxFieldSize (int maxFieldSize) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - - // Validate the argument. - if(maxFieldSize < 0) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - maxFieldSize_ = maxFieldSize; - settings_.setMaxFieldSize (maxFieldSize_); - - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Max field size", maxFieldSize_); - } - } - - - - /** - Sets the maximum rows limit. The maximum rows limit is the - maximum number of rows that a result set can contain. - If the limit is exceeded, the excess rows are dropped. - - - @param maxRows The maximum rows limit or 0 for no limit. - The default is 0. - - @exception SQLException If the statement is not open - or the input value is not valid. - **/ - // - // Implementation note: - // - // We had a debate about what this means with respect to scrollable - // result sets. Does it limit the number of rows in the result set, - // or the number of rows fetched. I.e., if you set the max rows to - // 50, can you successfully do absolute(51)? It is only fetching - // 1 row. The answer came back from the JavaSoft people that it - // does indeed limit the number of rows in the result set, not - // necessarily the number of fetches. - // - public void setMaxRows (int maxRows) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - - // Validate the argument. - if(maxRows < 0) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - maxRows_ = maxRows; - - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Max rows", maxRows_); - } - } - - - - /** - Sets the query timeout limit. The query timeout limit - is the number of seconds that the driver will wait for a - SQL statement to execute. - -

This is implemented using the database query time limit, also - known as QQRYTIMLMT. This value specifies the query processing time limit that is - compared to the estimated number of elapsed seconds that a query must run. The - time limit determines if the database query can start. - -

Beginning with Version 6 Release 1 of IBM i, you must have *JOBCTL special authority. - - @param queryTimeout The query timeout limit (in seconds) - or 0 for no limit. The default is the job's query timeout limit - value unless this method is explicitly called. - - @exception SQLException If the statement is not open - or the input value is not valid. - **/ - public void setQueryTimeout (int queryTimeout) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - - // Validate the argument. - if(queryTimeout < 0) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - if((queryTimeout_ != queryTimeout) || !queryTimeoutSet_) /*@B2C*/ - { - queryTimeoutSet_ = true; /*@B2A*/ - queryTimeout_ = queryTimeout; - - // Since we store the query timeout in the RPB, we need - // to sync it after a change. - rpbSyncNeeded_ = true; - rpbQueryTimeoutChanged_ = true; //@EFA - } - - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Query timeout", queryTimeout_); - } - } - - - - /** - Creates or changes the RPB (Request Parameter Block) for the - statement. - - @exception SQLException If an error occurs. - **/ - private void syncRPB () - throws SQLException - { - if(rpbSyncNeeded_) - { - - int functionId = rpbCreated_ ? DBSQLRPBDS.FUNCTIONID_CHANGE_RPB - : DBSQLRPBDS.FUNCTIONID_CREATE_RPB; - - DBSQLRPBDS request = null; //@P0A - try - { - request = DBDSPool.getDBSQLRPBDS(functionId, id_, 0, 0); //@P0C - - request.setPrepareStatementName (name_, connection_.converter_); //@P0C - request.setCursorName (cursor_.getName (), connection_.converter_); //@P0C - - if(packageManager_.isEnabled()) - request.setLibraryName (packageManager_.getLibraryName (), connection_.converter_); //@P0C - - if(rpbQueryTimeoutChanged_) //@EFA - { - if(queryTimeout_ > 0) - request.setQueryTimeout (queryTimeout_); - else - request.setQueryTimeout (-1); - } - - if(! connection_.getMustSpecifyForUpdate()) // @J3a @J31c - { - // @J3a - if(resultSetConcurrency_ == ResultSet.CONCUR_UPDATABLE) // @J3a - request.setOpenAttributes(0x10 + 0x20 + 0x40 + 0x80); // @J3a - } // @J3a - - //@F5D Do not need to specify this on the RPB - //@F5D Check system level before sending new code point - //@F5D if (connection_.getVRM() >= JDUtilities.vrm520) // @F4A - //@F5D { - //@F5D if (resultSetHoldability_ == AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT) // @F4A - //@F5D request.setResultSetHoldabilityOption((byte)0xD5); // @F4A - //@F5D else if (resultSetHoldability_ == AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT) // @F4A - //@F5D request.setResultSetHoldabilityOption((byte)0xE8); // @F4A - //@F5D} - - connection_.send (request, id_); - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - finally - { //@P0A - if(request != null) { - request.returnToPool(); request = null; - } - } - - rpbCreated_ = true; - rpbSyncNeeded_ = false; - } - } - - - - /** - Returns the statement name. - - @return The statement name. - **/ - public String toString () - { - return name_; - } - - - /** - Verifies values for the autoGeneratedKey parameter. - - @param autoGeneratedKeys Valid values are Statement.RETURN_GENERATED_KEYS and - Statement.NO_GENERATED_KEYS. - @exception SQLException If an error occurs. - **/ - static final void verifyGeneratedKeysParameter (int autoGeneratedKeys) - throws SQLException - { - if((autoGeneratedKeys != NO_GENERATED_KEYS) - && (autoGeneratedKeys != RETURN_GENERATED_KEYS)) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - - //@PDA jdbc40 - /** - * Requests that a Statement be pooled or not pooled. The value - * specified is a hint to the statement pool implementation indicating - * whether the applicaiton wants the statement to be pooled. It is up to - * the statement pool manager as to whether the hint is used. - *

- * The poolable value of a statement is applicable to both internal - * statement caches implemented by the driver and external statement caches - * implemented by application servers and other applications. - *

- * By default, a Statement is poolable when it is created. - *

- * @param poolable requests that the statement be pooled if true and - * that the statement not be pooled if false - *

- * @throws SQLException if the Statement has been closed - *

- */ - public void setPoolable(boolean poolable) throws SQLException - { - checkOpen();//@pda do same as native - isPoolable_ = poolable; - } - - //@PDA jdbc40 - /** - * Returns the value of the statements poolable hint, indicating whether - * pooling of the statement is requested. - *

- * @return The value of the statements poolable hint. - *

- * @throws SQLException if the Statement has been closed - *

- * see java.sql.Statement#setPoolable(boolean) setPoolable(boolean) - */ - public boolean isPoolable() throws SQLException - { - checkOpen();//@pda do same as native - return isPoolable_; - } - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCStatement", "java.sql.Statement" }; - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCWriter.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCWriter.java deleted file mode 100644 index 6472c20f1..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCWriter.java +++ /dev/null @@ -1,181 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCWriter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.Writer; -import java.sql.DriverManager; -import java.sql.SQLException; - - -/** -The AS400JDBCWriter class provides a stream -to write into large objects. The data is valid only within the current -transaction. Users get one of these objects by calling Clob.setCharacterStream() -which returns an object of type Writer. -**/ -class AS400JDBCWriter extends Writer -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - - private boolean closed_ = false; // is the stream closed? - private long position_; // position from which the user wanted us to start writing - private AS400JDBCClob clob_; // We have separate vars for clob and locator to remove build dependency on JDBC 3.0. - private AS400JDBCClobLocator locator_; - private AS400JDBCSQLXML xml_; //@pda jdbc40 - - - AS400JDBCWriter(AS400JDBCClob clob, long positionToStartWriting) - { - clob_ = clob; - position_ = positionToStartWriting; - } - - - AS400JDBCWriter(AS400JDBCClobLocator locator, long positionToStartWriting) - { - locator_ = locator; - position_ = positionToStartWriting; - } - - //@pda jdbc40 - AS400JDBCWriter(AS400JDBCSQLXML xml, long positionToStartWriting) - { - xml_ = xml; - position_ = positionToStartWriting; - } - - - - - /* - Close the writer. - */ - public void close() - { - closed_ = true; - } - - - /* - Flush the writer. - */ - public void flush() - { - //no-op - } - - - - /* - Write a character array to the writer. - - @param cbuf The character byte array the user wants written to the writer. - */ - public void write(char[] cbuf) throws IOException - { - if (cbuf == null) throw new NullPointerException("cbuf"); - - if (closed_) throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - - write(cbuf, 0, cbuf.length); - } - - - - /* - Write a character array to the writer from offset off for len characters. - - @param cbuf The character array the user wants written to the writer. - @param off The offset into the character array that the user wants written to the - writer (1-based). - @param len The number of bytes the user wants written to the writer - from the byte array they passed in. - */ - public void write(char[] cbuf, int off, int len) throws IOException - { - if (cbuf == null) throw new NullPointerException("cbuf"); - if ((off < 0) || (off > len)) throw new ExtendedIllegalArgumentException("off", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if (len < 0) throw new ExtendedIllegalArgumentException("len", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - if (closed_) throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - - write(new String(cbuf, off, len)); - } - - - - /* - Write a character to the writer. - - @param cbuf The character the user wants written to the writer. - */ - public void write(int c) throws IOException - { - if (closed_) throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - - write(new String(new char[] { (char)c})); - } - - - - /* - Write a String to the writer from offset off for len characters. - - @param str The string the user wants written to the writer. - */ - public void write(String str) throws IOException - { - if (str == null) throw new NullPointerException("str"); - - if (closed_) throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - - write(str, 0, str.length()); - } - - - - /* - Write a String to the writer from offset off for len characters. - - @param str The String the user wants written to the writer. - @param off The offset into the character array that the user wants written to the - writer. - @param len The number of bytes the user wants written to the writer - from the byte array they passed in. - */ - public synchronized void write(String str, int off, int len) throws IOException - { - if (str == null) throw new NullPointerException("str"); - if ((off < 0) || (off > len)) throw new ExtendedIllegalArgumentException("off", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if (len < 0) throw new ExtendedIllegalArgumentException("len", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - if (closed_) throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - - try - { - if (clob_ != null) clob_.setString(position_, str, off, len); - else if (locator_ != null) locator_.setString(position_, str, off, len); //@PDC jdbc40 - else if (xml_ != null ) xml_.setString(position_, str, off, len); //@PDA jdbc40 - position_ += len; - } - catch (SQLException e) - { - if (JDTrace.isTraceOn()) e.printStackTrace(DriverManager.getLogWriter()); - closed_ = true; - throw new IOException(e.getMessage()); - } - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCXADataSource.java b/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCXADataSource.java deleted file mode 100644 index 7125ecc3f..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AS400JDBCXADataSource.java +++ /dev/null @@ -1,176 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCXADataSource.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; -import javax.naming.NamingException; -import javax.naming.Reference; -import javax.sql.XAConnection; -import javax.sql.XADataSource; - - -/** -The AS400JDBCXADataSource class represents a factory for -AS400JDBCXAConnection objects. - -

-This support is only available when connecting to systems running OS/400 V5R1 or later, or IBM i. - -

The following example creates an AS400JDBCXADataSource -object and creates a connection to the database. - -

-// Create an XA data source for making the connection. -AS400JDBCXADataSource xaDataSource = new AS400JDBCXADataSource("myAS400"); -xaDataSource.setUser("myUser"); -xaDataSource.setPassword("myPasswd"); - -// Get the XAConnection. -XAConnection xaConnection = xaDataSource.getXAConnection(); -
- -@see AS400JDBCXAConnection -@see AS400JDBCXAResource -**/ -public class AS400JDBCXADataSource -extends AS400JDBCDataSource -implements XADataSource -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - -/** -Constructs a default AS400JDBCXADataSource object. -**/ - public AS400JDBCXADataSource() - { - super(); - } - - - -/** -Constructs an AS400JDBCXADataSource with the specified serverName. - -@param serverName The name of the IBM i system. -**/ - public AS400JDBCXADataSource(String serverName) - { - super(serverName); - } - - - -/** -Constructs an AS400JDBCXADataSource with the specified signon information. - -@param serverName The name of the IBM i system. -@param user The user id. -@param password The password. -**/ - public AS400JDBCXADataSource(String serverName, String user, String password) - { - super(serverName, user, password); - } - - -//@A1A -/** -Constructs an AS400JDBCXADataSource with the specified signon information -to use for SSL communications with the IBM i system. - -@param serverName The name of the IBM i system. -@param user The user id. -@param password The password. -@param keyRingName The key ring class name to be used for SSL communications with the system. -@param keyRingPassword The password for the key ring class to be used for SSL communications with the system. -**/ - public AS400JDBCXADataSource(String serverName, String user, String password, - String keyRingName, String keyRingPassword) - { - super(serverName, user, password, keyRingName, keyRingPassword); - } - - -// @F0A - added the following constructor to avoid some object construction -/** -* Constructs an AS400JDBCXADataSource from the specified Reference -* @param reference to retrieve DataSource properties from -**/ - AS400JDBCXADataSource(Reference reference) { - super(reference); - } - - -/** -Returns an XA connection to IBM i. - -@return An XA connection. -@exception SQLException If a database error occurs. -**/ - public XAConnection getXAConnection() - throws SQLException - { - AS400JDBCConnection connection = (AS400JDBCConnection)getConnection(); - return new AS400JDBCXAConnection(connection); - } - - - -/** -Returns an XA connection to IBM i. - -@param user The userid for the connection. -@param password The password for the connection. -@return An XA connection. -@exception SQLException If a database error occurs. -**/ - public XAConnection getXAConnection(String user, String password) - throws SQLException - { - AS400JDBCConnection connection = (AS400JDBCConnection)getConnection(user, password); - return new AS400JDBCXAConnection(connection); - } - - - -/** -Returns the Reference object for the data source object. -This is used by JNDI when bound in a JNDI naming service. -Contains the information necessary to reconstruct the data source -object when it is later retrieved from JNDI via an object factory. - -@return A Reference object for the data source object. -@exception NamingException If a naming error occurs resolving the object. -**/ - public Reference getReference() - throws NamingException - { - Reference ref = new Reference(this.getClass().getName(), - "com.ibm.as400.access.AS400JDBCObjectFactory", - null); - - Reference dsRef = super.getReference(); - for (int i=0; i< dsRef.size(); i++) - ref.add( dsRef.get(i) ); - - return ref; - } - - - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/AbstractProxyImpl.java b/cvsroot/jdbc40/com/ibm/as400/access/AbstractProxyImpl.java deleted file mode 100644 index 8cd1e95fd..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/AbstractProxyImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AbstractProxyImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; - -// The AbstractProxyImpl class provides a default implementation for the ProxyImpl and ProxyFactoryImpl interfaces. -abstract class AbstractProxyImpl -/* ifdef JDBC40 */ -extends ToolboxWrapper -/* endif */ -implements ProxyImpl, ProxyFactoryImpl -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - // Private data. - private String className_; - protected ProxyClientConnection connection_; - protected long pxId_; - - // Called for ProxyFactoryImpl objects: - protected AbstractProxyImpl() - { - } - - // Called for ProxyImpl objects: - protected AbstractProxyImpl(String className) - { - className_ = className; - } - - // From the ProxyImpl interface: - public void construct(ProxyClientConnection connection) - { - connection_ = connection; - try - { - pxId_ = connection_.callConstructor(className_); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - // Cleans up the object. - protected void finalize() throws Throwable - { - connection_.callFinalize(pxId_); - super.finalize(); - } - - // From the ProxyImpl interface: - public long getPxId() - { - return pxId_; - } - - // From the AbstractProxyImpl interface: - public void initialize(long pxId, ProxyClientConnection connection) - { - pxId_ = pxId; - connection_ = connection; - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/JDBlobProxy.java b/cvsroot/jdbc40/com/ibm/as400/access/JDBlobProxy.java deleted file mode 100644 index 90af64c5d..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/JDBlobProxy.java +++ /dev/null @@ -1,206 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDBlobProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.OutputStream; -import java.lang.reflect.InvocationTargetException; -import java.sql.Blob; -import java.sql.SQLException; - - - -// JDBC 2.0 -/** -The JDBlobProxy class provides access to binary large -objects. The data is valid only within the current -transaction. -**/ -class JDBlobProxy -extends AbstractProxyImpl -implements Blob -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - // Copied from JDError: - static final String EXC_FUNCTION_NOT_SUPPORTED = "IM001"; - - - public InputStream getBinaryStream () - throws SQLException - { - try { - JDInputStreamProxy newStream = new JDInputStreamProxy (); - return (JDInputStreamProxy) connection_.callFactoryMethod ( - pxId_, "getBinaryStream", newStream); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public byte[] getBytes (long start, int length) - throws SQLException - { - try { - return (byte[]) connection_.callMethod (pxId_, "getBytes", - new Class[] { Long.TYPE, Integer.TYPE }, - new Object[] { new Long (start), - new Integer (length) }) - .getReturnValue(); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public long length () - throws SQLException - { - try { - return connection_.callMethod (pxId_, "length") - .getReturnValueLong (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public long position (byte[] pattern, long start) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "position", - new Class[] { byte[].class, Long.TYPE }, - new Object[] { pattern, new Long (start) }) - .getReturnValueLong (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public long position (Blob pattern, long start) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "position", - new Class[] { Blob.class, Long.TYPE }, - new Object[] { pattern, new Long (start) }) - .getReturnValueLong (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 3.0 - public OutputStream setBinaryStream (long pos) - throws SQLException - { - // Avoid dragging in JDError - //@K1D throw new SQLException ( - //@K1D AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - //@K1D EXC_FUNCTION_NOT_SUPPORTED, -99999); - try //@K1A - { - JDOutputStreamProxy newStream = new JDOutputStreamProxy (); - return (JDOutputStreamProxy) connection_.callFactoryMethod (pxId_, "setBinaryStream", - new Class[] { Long.TYPE}, - new Object[] { new Long(pos)}, - newStream); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 3.0 - public int setBytes (long pos, byte[] bytes) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "setBytes", - new Class[] { Long.TYPE, byte[].class}, - new Object[] { new Long(pos), bytes}) - .getReturnValueInt (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 3.0 - public int setBytes (long pos, byte[] bytes, int offset, int len) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "setBytes", - new Class[] { Long.TYPE, byte[].class, Integer.TYPE, Integer.TYPE}, - new Object[] { new Long(pos), bytes, new Integer(offset), new Integer(len)}) - .getReturnValueInt (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 3.0 - public void truncate (long len) - throws SQLException - { - try { - connection_.callMethod (pxId_, "truncate", - new Class[] { Long.TYPE}, - new Object[] { new Long(len)}); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - //@PDA jdbc40 - public synchronized void free() throws SQLException - { - try { - connection_.callMethod (pxId_, "free"); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - public synchronized InputStream getBinaryStream(long pos, long length) throws SQLException - { - try { - JDInputStreamProxy newStream = new JDInputStreamProxy (); - return (JDInputStreamProxy) connection_.callFactoryMethod ( - pxId_, "getBinaryStream", - new Class[] { Long.TYPE, Long.TYPE}, - new Object[] { new Long(pos), new Long(length)}, - newStream); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/JDCallableStatementProxy.java b/cvsroot/jdbc40/com/ibm/as400/access/JDCallableStatementProxy.java deleted file mode 100644 index 241067324..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/JDCallableStatementProxy.java +++ /dev/null @@ -1,1737 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDCallableStatementProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.io.Serializable; -import java.lang.reflect.InvocationTargetException; -import java.math.BigDecimal; -import java.net.URL; -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -/* endif */ -import java.sql.Ref; -/* ifdef JDBC40 */ -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.sql.Types; -import java.util.Calendar; -import java.util.Map; -import java.util.Vector; - - - -class JDCallableStatementProxy -extends JDPreparedStatementProxy -implements CallableStatement -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - private Vector registeredTypes_ = new Vector (); - // Note: We will only use elements starting at index 1. - // The Vector element at index 0 will simply be a place-holder. - // This way we can match parameter indexes directory to element indexes. - - // Copied from JDError: - static final String EXC_FUNCTION_NOT_SUPPORTED = "IM001"; - - private final static String NOT_SERIALIZABLE = "Parameter is not serializable."; - - public JDCallableStatementProxy (JDConnectionProxy jdConnection) - { - super (jdConnection); - } - - - // Call a method, and return a 'raw' ProxyReturnValue. - private ProxyReturnValue callMethodRtnRaw (String methodName, int argValue) - throws SQLException - { - try { - return connection_.callMethod (pxId_, methodName, - new Class[] { Integer.TYPE }, - new Object[] { new Integer (argValue) }); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - // Added for JDBC 3.0 support - // Call a method, and return a 'raw' ProxyReturnValue. - private ProxyReturnValue callMethodRtnRaw (String methodName, String argValue) - throws SQLException - { - try { - return connection_.callMethod (pxId_, methodName, - new Class[] { String.class}, - new Object[] { argValue}); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - // Added for JDBC 3.0 support - private int findParameterIndex(String parameterName) - throws SQLException - { - try - { - return((Integer)connection_.callMethod (pxId_, "findParameterIndex", - new Class[] { String.class}, - new Object[] { parameterName}) - .getReturnValue()) - .intValue(); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - -// JDBC 2.0 - public Array getArray (int parameterIndex) - throws SQLException - { - return (Array) callMethodRtnRaw ("getArray", parameterIndex) - .getReturnValue (); - } - - - -// JDBC 3.0 - public Array getArray (String parameterName) - throws SQLException - { - return(Array) callMethodRtnRaw ("getArray", parameterName) - .getReturnValue (); - } - - - -// JDBC 2.0 - public BigDecimal getBigDecimal (int parameterIndex) - throws SQLException - { - return (BigDecimal) callMethodRtnRaw ("getBigDecimal", parameterIndex) - .getReturnValue (); - } - - - -// JDBC 3.0 - public BigDecimal getBigDecimal (String parameterName) - throws SQLException - { - return(BigDecimal) callMethodRtnRaw ("getBigDecimal", parameterName) - .getReturnValue (); - } - - - -/** -@exception SQLException If a SQL error occurs. -@deprecated Use getBigDecimal(int) instead. -@see #getBigDecimal(int) -**/ - public BigDecimal getBigDecimal (int parameterIndex, int scale) - throws SQLException - { - return (BigDecimal) callMethodRtnRaw ("getBigDecimal", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - new Integer (scale) }) - .getReturnValue (); - } - - - -// JDBC 2.0 - public Blob getBlob (int parameterIndex) - throws SQLException - { - try { - JDBlobProxy newBlob = new JDBlobProxy (); - return (JDBlobProxy) connection_.callFactoryMethod ( - pxId_, - "getBlob", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(parameterIndex) }, - newBlob); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - -// JDBC 3.0 - public Blob getBlob (String parameterName) - throws SQLException - { - try { - JDBlobProxy newBlob = new JDBlobProxy (); - return(JDBlobProxy) connection_.callFactoryMethod ( - pxId_, - "getBlob", - new Class[] { String.class}, - new Object[] { parameterName}, - newBlob); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - - public boolean getBoolean (int parameterIndex) - throws SQLException - { - return callMethodRtnRaw ("getBoolean", parameterIndex) - .getReturnValueBoolean (); - } - - - -// JDBC 3.0 - public boolean getBoolean (String parameterName) - throws SQLException - { - return callMethodRtnRaw ("getBoolean", parameterName) - .getReturnValueBoolean (); - } - - - - public byte getByte (int parameterIndex) - throws SQLException - { - return callMethodRtnRaw ("getByte", parameterIndex) - .getReturnValueByte (); - } - - - -//JDBC 3.0 - public byte getByte (String parameterName) - throws SQLException - { - return callMethodRtnRaw ("getByte", parameterName) - .getReturnValueByte (); - } - - - - public byte[] getBytes (int parameterIndex) - throws SQLException - { - return (byte[]) callMethodRtnRaw ("getBytes", parameterIndex) - .getReturnValue (); - } - - - -// JDBC 3.0 - public byte[] getBytes (String parameterName) - throws SQLException - { - return(byte[]) callMethodRtnRaw ("getBytes", parameterName) - .getReturnValue (); - } - - - -// JDBC 2.0 - public Clob getClob (int parameterIndex) - throws SQLException - { - try { - JDClobProxy newClob = new JDClobProxy (); - return (JDClobProxy) connection_.callFactoryMethod ( - pxId_, - "getClob", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(parameterIndex) }, - newClob); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - -// JDBC 3.0 - public Clob getClob (String parameterName) - throws SQLException - { - try { - JDClobProxy newClob = new JDClobProxy (); - return(JDClobProxy) connection_.callFactoryMethod ( - pxId_, - "getClob", - new Class[] { String.class}, - new Object[] { parameterName}, - newClob); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - - public Date getDate (int parameterIndex) - throws SQLException - { - return (Date) callMethodRtnRaw ("getDate", parameterIndex) - .getReturnValue (); - } - - - -// JDBC 3.0 - public Date getDate (String parameterName) - throws SQLException - { - return(Date) callMethodRtnRaw ("getDate", parameterName) - .getReturnValue (); - } - - - -// JDBC 2.0 - public Date getDate (int parameterIndex, Calendar calendar) - throws SQLException - { - return (Date) callMethodRtnRaw ("getDate", - new Class[] { Integer.TYPE, Calendar.class }, - new Object[] { new Integer (parameterIndex), - calendar }) - .getReturnValue (); - } - - - -// JDBC 3.0 - public Date getDate (String parameterName, Calendar calendar) - throws SQLException - { - return(Date) callMethodRtnRaw ("getDate", - new Class[] { String.class, Calendar.class}, - new Object[] { parameterName, - calendar}) - .getReturnValue (); - } - - - - public double getDouble (int parameterIndex) - throws SQLException - { - return callMethodRtnRaw ("getDouble", parameterIndex) - .getReturnValueDouble (); - } - - - -// JDBC 3.0 - public double getDouble (String parameterName) - throws SQLException - { - return callMethodRtnRaw ("getDouble", parameterName) - .getReturnValueDouble (); - } - - - - public float getFloat (int parameterIndex) - throws SQLException - { - return callMethodRtnRaw ("getFloat", parameterIndex) - .getReturnValueFloat (); - } - - - -// JDBC 3.0 - public float getFloat (String parameterName) - throws SQLException - { - return callMethodRtnRaw ("getFloat", parameterName) - .getReturnValueFloat (); - } - - - - public int getInt (int parameterIndex) - throws SQLException - { - return callMethodRtnRaw ("getInt", parameterIndex) - .getReturnValueInt (); - } - - - -// JDBC 3.0 - public int getInt (String parameterName) - throws SQLException - { - return callMethodRtnRaw ("getInt", parameterName) - .getReturnValueInt (); - } - - - - public long getLong (int parameterIndex) - throws SQLException - { - return callMethodRtnRaw ("getLong", parameterIndex) - .getReturnValueLong (); - } - - - -// JDBC 3.0 - public long getLong (String parameterName) - throws SQLException - { - return callMethodRtnRaw ("getLong", parameterName) - .getReturnValueLong (); - } - - - - public Object getObject (int parameterIndex) - throws SQLException - { - try - { - if (parameterIndex > 0 && - parameterIndex < registeredTypes_.size() ) - { - Integer typeInt = (Integer)registeredTypes_.elementAt(parameterIndex); - if (typeInt != null) - { - int type = typeInt.intValue(); - ProxyFactoryImpl proxyObject = null; - if (type == Types.BLOB) { - proxyObject = new JDBlobProxy (); - } - else if (type == Types.CLOB) { - proxyObject = new JDClobProxy (); - } - if (proxyObject != null) { - return connection_.callFactoryMethod (pxId_, "getObject", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (parameterIndex) }, - proxyObject); - } - } - } - return connection_.callMethod (pxId_, "getObject", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (parameterIndex) }) - .getReturnValue(); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 2.0 - public Object getObject (int parameterIndex, Map typeMap) - throws SQLException - { - try - { - if (parameterIndex > 0 && - parameterIndex < registeredTypes_.size() ) - { - Integer typeInt = (Integer)registeredTypes_.elementAt(parameterIndex); - if (typeInt != null) - { - int type = typeInt.intValue(); - ProxyFactoryImpl proxyObject = null; - if (type == Types.BLOB) { - proxyObject = new JDBlobProxy (); - } - else if (type == Types.CLOB) { - proxyObject = new JDClobProxy (); - } - if (proxyObject != null) { - return connection_.callFactoryMethod (pxId_, "getObject", - new Class[] { Integer.TYPE, Map.class }, - new Object[] { new Integer (parameterIndex), - typeMap }, - proxyObject); - } - } - } - return connection_.callMethod (pxId_, "getObject", - new Class[] { Integer.TYPE, Map.class }, - new Object[] { new Integer (parameterIndex), - typeMap }) - .getReturnValue(); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 3.0 - public Object getObject (String parameterName) - throws SQLException - { - return getObject (findParameterIndex(parameterName)); - } - - - -// JDBC 3.0 - public Object getObject (String parameterName, Map typeMap) - throws SQLException - { - return getObject(findParameterIndex(parameterName), typeMap); - } - - - - -// JDBC 2.0 - public Ref getRef (int parameterIndex) - throws SQLException - { - return (Ref) callMethodRtnRaw ("getRef", parameterIndex) - .getReturnValue (); - } - - - -// JDBC 3.0 - public Ref getRef (String parameterName) - throws SQLException - { - return(Ref) callMethodRtnRaw ("getRef", parameterName) - .getReturnValue (); - } - - - - public short getShort (int parameterIndex) - throws SQLException - { - return callMethodRtnRaw ("getShort", parameterIndex) - .getReturnValueShort (); - } - - -// JDBC 3.0 - public short getShort (String parameterName) - throws SQLException - { - return callMethodRtnRaw ("getShort", parameterName) - .getReturnValueShort (); - } - - - - public String getString (int parameterIndex) - throws SQLException - { - return (String) callMethodRtnRaw ("getString", parameterIndex) - .getReturnValue (); - } - - - -// JDBC 3.0 - public String getString (String parameterName) - throws SQLException - { - return(String) callMethodRtnRaw ("getString", parameterName) - .getReturnValue (); - } - - - - public Time getTime (int parameterIndex) - throws SQLException - { - return (Time) callMethodRtnRaw ("getTime", parameterIndex) - .getReturnValue (); - } - - - -// JDBC 3.0 - public Time getTime (String parameterName) - throws SQLException - { - return(Time) callMethodRtnRaw ("getTime", parameterName) - .getReturnValue (); - } - - - -// JDBC 2.0 - public Time getTime (int parameterIndex, Calendar calendar) - throws SQLException - { - return (Time) callMethodRtnRaw ("getTime", - new Class[] { Integer.TYPE, Calendar.class }, - new Object[] { new Integer (parameterIndex), - calendar }) - .getReturnValue (); - } - - - -// JDBC 3.0 - public Time getTime (String parameterName, Calendar calendar) - throws SQLException - { - return(Time) callMethodRtnRaw ("getTime", - new Class[] { String.class, Calendar.class}, - new Object[] { parameterName, - calendar}) - .getReturnValue (); - } - - - - public Timestamp getTimestamp (int parameterIndex) - throws SQLException - { - return (Timestamp) callMethodRtnRaw ("getTimestamp", parameterIndex) - .getReturnValue (); - } - - - -// JDBC 3.0 - public Timestamp getTimestamp (String parameterName) - throws SQLException - { - return(Timestamp) callMethodRtnRaw ("getTimestamp", parameterName) - .getReturnValue (); - } - - - -// JDBC 2.0 - public Timestamp getTimestamp (int parameterIndex, Calendar calendar) - throws SQLException - { - return (Timestamp) callMethodRtnRaw ("getTimestamp", - new Class[] { Integer.TYPE, Calendar.class }, - new Object[] { new Integer (parameterIndex), - calendar }) - .getReturnValue (); - } - - - -// JDBC 3.0 - public Timestamp getTimestamp (String parameterName, Calendar calendar) - throws SQLException - { - return(Timestamp) callMethodRtnRaw ("getTimestamp", - new Class[] { String.class, Calendar.class}, - new Object[] { parameterName, - calendar}) - .getReturnValue (); - } - - - -// JDBC 3.0 - public URL getURL (int parameterIndex) - throws SQLException - { - return(URL) callMethodRtnRaw ("getURL", - new Class[] { Integer.TYPE}, - new Object[] { new Integer (parameterIndex)}) - .getReturnValue (); - } - - - -// JDBC 3.0 - public URL getURL (String parameterName) - throws SQLException - { - return(URL) callMethodRtnRaw ("getURL", - new Class[] { String.class}, - new Object[] { parameterName}) - .getReturnValue (); - } - - - - private void registerLocally (int parameterIndex, int sqlType) - { - for (int i=registeredTypes_.size(); i<=parameterIndex; i++) - registeredTypes_.addElement (null); - registeredTypes_.setElementAt (new Integer(sqlType), parameterIndex); - } - - - - public void registerOutParameter (int parameterIndex, - int sqlType, - int scale) - throws SQLException - { - callMethod ("registerOutParameter", - new Class[] { Integer.TYPE, Integer.TYPE, - Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - new Integer (sqlType), - new Integer (scale) }); - - registerLocally (parameterIndex, sqlType); //@A1C - } - - - public void registerOutParameter (int parameterIndex, int sqlType) - throws SQLException - { - callMethod ("registerOutParameter", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - new Integer (sqlType) }); - - registerLocally (parameterIndex, sqlType); //@A1C - } - - - public void registerOutParameter (int parameterIndex, int sqlType, String typeName) - throws SQLException - { - - callMethod ("registerOutParameter", - new Class[] { Integer.TYPE, Integer.TYPE, - String.class }, - new Object[] { new Integer (parameterIndex), - new Integer (sqlType), - new Integer (typeName) }); - - registerLocally (parameterIndex, sqlType); //@A1C - } - - - -// JDBC 3.0 - public void registerOutParameter (String parameterName, int sqlType) - throws SQLException - { - registerOutParameter(findParameterIndex(parameterName), sqlType); - } - - - -// JDBC 3.0 - public void registerOutParameter (String parameterName, int sqlType, int scale) - throws SQLException - { - registerOutParameter(findParameterIndex(parameterName), sqlType, scale); - } - - - -// JDBC 3.0 - public void registerOutParameter (String parameterName, int sqlType, String typeName) - throws SQLException - { - registerOutParameter(findParameterIndex(parameterName), sqlType, typeName); - } - - - -// JDBC 3.0 - public void setAsciiStream (String parameterName, InputStream parameterValue, int length) - throws SQLException - { - InputStream iStream; - if (parameterValue == null || - parameterValue instanceof Serializable) - iStream = parameterValue; - else { - try { - iStream = new SerializableInputStream (parameterValue); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setAsciiStream", - new Class[] { String.class, InputStream.class, - Integer.TYPE}, - new Object[] { parameterName, - iStream, - new Integer (length)}); - } - - - -// JDBC 3.0 - public void setBigDecimal (String parameterName, BigDecimal parameterValue) - throws SQLException - { - callMethod ("setBigDecimal", - new Class[] { String.class, BigDecimal.class}, - new Object[] { parameterName, - parameterValue}); - } - - - - -// JDBC 3.0 - public void setBinaryStream (String parameterName, - InputStream parameterValue, - int length) - throws SQLException - { - InputStream iStream; - if (parameterValue == null || - parameterValue instanceof Serializable) - iStream = parameterValue; - else { - try { - iStream = new SerializableInputStream (parameterValue); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBinaryStream", - new Class[] { String.class, InputStream.class, - Integer.TYPE}, - new Object[] { parameterName, - iStream, - new Integer (length)}); - } - - - - -// JDBC 3.0 - public void setBoolean (String parameterName, boolean parameterValue) - throws SQLException - { - callMethod ("setBoolean", - new Class[] { String.class, Boolean.TYPE}, - new Object[] { parameterName, - new Boolean(parameterValue)}); - } - - - -// JDBC 3.0 - public void setByte (String parameterName, byte parameterValue) - throws SQLException - { - callMethod ("setByte", - new Class[] { String.class, Byte.TYPE}, - new Object[] { parameterName, - new Byte(parameterValue)}); - } - - - -// JDBC 3.0 - public void setBytes (String parameterName, byte[] parameterValue) - throws SQLException - { - callMethod ("setBytes", - new Class[] { String.class, byte[].class}, //@K1C Changed from Byte.class to byte[].class - new Object[] { parameterName, - parameterValue}); - } - - - -//JDBC 3.0 - public void setCharacterStream (String parameterName, - Reader parameterValue, - int length) - throws SQLException - { - try { - SerializableReader reader; - if (parameterValue == null) - reader = null; - else - reader = new SerializableReader (parameterValue, Math.max(0,length)); - callMethod ("setCharacterStream", - new Class[] { String.class, Reader.class, - Integer.TYPE}, - new Object[] { parameterName, - reader, - new Integer (length)}); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - -// JDBC 3.0 - public void setDate (String parameterName, Date parameterValue) - throws SQLException - { - callMethod ("setDate", - new Class[] { String.class, Date.class}, - new Object[] { parameterName, - parameterValue}); - } - - - -// JDBC 3.0 - public void setDate (String parameterName, Date parameterValue, Calendar cal) - throws SQLException - { - callMethod ("setDate", - new Class[] { String.class, Date.class, Calendar.class}, - new Object[] { parameterName, - parameterValue, cal}); - } - - - -// JDBC 3.0 - public void setDouble (String parameterName, double parameterValue) - throws SQLException - { - callMethod ("setDouble", - new Class[] { String.class, Double.TYPE}, - new Object[] { parameterName, - new Double(parameterValue)}); - } - - - -// JDBC 3.0 - public void setFloat (String parameterName, float parameterValue) - throws SQLException - { - callMethod ("setFloat", - new Class[] { String.class, Float.TYPE}, - new Object[] { parameterName, - new Float(parameterValue)}); - } - - - -// JDBC 3.0 - public void setInt (String parameterName, int parameterValue) - throws SQLException - { - callMethod ("setInt", - new Class[] { String.class, Integer.TYPE}, - new Object[] { parameterName, - new Integer(parameterValue)}); - } - - - -// JDBC 3.0 - public void setLong (String parameterName, long parameterValue) - throws SQLException - { - callMethod ("setLong", - new Class[] { String.class, Long.TYPE}, - new Object[] { parameterName, - new Long(parameterValue)}); - } - - - -// JDBC 3.0 - public void setNull (String parameterName, int sqlType) - throws SQLException - { - callMethod ("setNull", - new Class[] { String.class, Integer.TYPE}, - new Object[] { parameterName, - new Integer(sqlType)}); - } - - - -// JDBC 3.0 - public void setNull (String parameterName, int sqlType, String typeName) - throws SQLException - { - callMethod ("setNull", - new Class[] { String.class, Integer.TYPE, String.class}, - new Object[] { parameterName, - new Integer(sqlType), typeName}); - } - - - -// JDBC 3.0 - public void setObject (String parameterName, Object parameterValue) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setObject", - new Class[] { String.class, Object.class}, - new Object[] { parameterName, - parameterValue}); - } - - - -// JDBC 3.0 - public void setObject (String parameterName, - Object parameterValue, - int sqlType) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setObject", - new Class[] { String.class, Object.class, - Integer.TYPE}, - new Object[] { parameterName, - parameterValue, - new Integer (sqlType)}); - } - - - -// JDBC 3.0 - public void setObject (String parameterName, - Object parameterValue, - int sqlType, - int scale) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setObject", - new Class[] { String.class, Object.class, - Integer.TYPE, Integer.TYPE}, - new Object[] { parameterName, - parameterValue, - new Integer (sqlType), - new Integer (scale)}); - } - - - - -// JDBC 3.0 - public void setShort (String parameterName, short parameterValue) - throws SQLException - { - callMethod ("setShort", - new Class[] { String.class, Short.TYPE}, - new Object[] { parameterName, - new Short(parameterValue)}); - } - - - -// JDBC 3.0 - public void setString (String parameterName, String sqlType) - throws SQLException - { - callMethod ("setString", - new Class[] { String.class, String.class}, - new Object[] { parameterName, - sqlType}); - } - - - -// JDBC 3.0 - public void setTime (String parameterName, Time parameterValue) - throws SQLException - { - callMethod ("setTime", - new Class[] { String.class, Time.class}, - new Object[] { parameterName, - parameterValue}); - } - - - -// JDBC 3.0 - public void setTime (String parameterName, Time parameterValue, Calendar cal) - throws SQLException - { - callMethod ("setTime", - new Class[] { String.class, Time.class, Calendar.class}, - new Object[] { parameterName, - parameterValue, cal}); - } - - - -// JDBC 3.0 - public void setTimestamp (String parameterName, Timestamp parameterValue) - throws SQLException - { - callMethod ("setTimestamp", - new Class[] { String.class, Timestamp.class}, - new Object[] { parameterName, - parameterValue}); - } - - - -// JDBC 3.0 - public void setTimestamp (String parameterName, Timestamp parameterValue, Calendar cal) - throws SQLException - { - callMethod ("setTimestamp", - new Class[] { String.class, Timestamp.class, Calendar.class}, - new Object[] { parameterName, - parameterValue, cal}); - } - - - -// JDBC 3.0 - public void setURL (String parameterName, URL parameterValue) - throws SQLException - { - callMethod ("setURL", - new Class[] { String.class, URL.class}, - new Object[] { parameterName, - parameterValue}); - } - - - - public boolean wasNull () - throws SQLException - { - return callMethodRtnBool ("wasNull"); - } - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.CallableStatement" }; - } - - - - //@PDA jdbc40 - public Reader getCharacterStream(int parameterIndex) throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getCharacterStream", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (parameterIndex) }, - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - public Reader getCharacterStream(String parameterName) throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getCharacterStream", - new Class[] { String.class }, - new Object[] { new Integer (parameterName) }, - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream(int parameterIndex) throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getNCharacterStream", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (parameterIndex) }, - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream(String parameterName) throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getNCharacterStream", - new Class[] { String.class }, - new Object[] { new Integer (parameterName) }, - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob(int parameterIndex) throws SQLException - { - try { - JDNClobProxy newClob = new JDNClobProxy (); - return (JDNClobProxy) connection_.callFactoryMethod (pxId_, - "getNClob", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(parameterIndex) }, - newClob); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - public NClob getNClob(String parameterName) throws SQLException - { - try { - JDNClobProxy newClob = new JDNClobProxy (); - return (JDNClobProxy) connection_.callFactoryMethod (pxId_, - "getNClob", - new Class[] { String.class }, - new Object[] { new Integer(parameterName) }, - newClob); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - -/* endif */ - - //@PDA jdbc40 - public String getNString(int parameterIndex) throws SQLException - { - return (String) callMethodRtnRaw ("getNString", parameterIndex).getReturnValue (); - } - - //@PDA jdbc40 - public String getNString(String parameterName) throws SQLException - { - return (String) callMethodRtnRaw ("getNString", parameterName).getReturnValue (); - } - - //@PDA jdbc40 -/* ifdef JDBC40 */ - public RowId getRowId(int parameterIndex) throws SQLException - { - try { - JDRowIdProxy newRowId = new JDRowIdProxy (); - return (JDRowIdProxy) connection_.callFactoryMethod (pxId_, - "getRowId", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(parameterIndex) }, - newRowId); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - public RowId getRowId(String parameterName) throws SQLException - { - try { - JDRowIdProxy newRowId = new JDRowIdProxy (); - return (JDRowIdProxy) connection_.callFactoryMethod (pxId_, - "getRowId", - new Class[] { String.class }, - new Object[] { new Integer(parameterName) }, - newRowId); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } -/* endif */ - - //@PDA jdbc40 -/* ifdef JDBC40 */ - public SQLXML getSQLXML(int parameterIndex) throws SQLException - { - try { - JDSQLXMLProxy newXML = new JDSQLXMLProxy (); - return (JDSQLXMLProxy) connection_.callFactoryMethod (pxId_, - "getSQLXML", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(parameterIndex) }, - newXML); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - public SQLXML getSQLXML(String parameterName) throws SQLException - { - try { - JDSQLXMLProxy newXML = new JDSQLXMLProxy (); - return (JDSQLXMLProxy) connection_.callFactoryMethod (pxId_, - "getSQLXML", - new Class[] { String.class }, - new Object[] { new Integer(parameterName) }, - newXML); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - -/* endif */ - //@PDA jdbc40 - public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException - { - InputStream iStream; - if (x == null || - x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setAsciiStream", - new Class[] { String.class, InputStream.class, - Long.TYPE }, - new Object[] { parameterName, - iStream, - new Long (length) }); - } - - //@PDA jdbc40 - public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException - { - InputStream iStream; - if (x == null || - x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBinaryStream", - new Class[] { String.class, InputStream.class, - Long.TYPE }, - new Object[] { parameterName, - iStream, - new Long (length) }); - } - - //@PDA jdbc40 - public void setBlob(String parameterName, Blob x) throws SQLException - { - if (x != null && - !(x instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setBlob", - new Class[] { String.class, Blob.class }, - new Object[] { parameterName, - x }); - } - - //@PDA jdbc40 - public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException - { - InputStream iStream; - if (inputStream == null || - inputStream instanceof Serializable) - iStream = inputStream; - else { - try { - iStream = new SerializableInputStream (inputStream); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBlob", - new Class[] { String.class, InputStream.class, - Long.TYPE }, - new Object[] { parameterName, - iStream, - new Long (length) }); - } - - //@PDA jdbc40 - public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException - { - try { - SerializableReader serialReader; - if (reader == null) - serialReader = null; - else - serialReader = new SerializableReader (reader, (int)Math.max(0,length)); - callMethod ("setCharacterStream", - new Class[] { String.class, Reader.class, - Long.TYPE }, - new Object[] { parameterName, - serialReader, - new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - public void setClob(String parameterName, Clob x) throws SQLException - { - if (x != null && - !(x instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setClob", - new Class[] { String.class, Clob.class }, - new Object[] { parameterName, - x }); - } - - //@PDA jdbc40 - public void setClob(String parameterName, Reader reader, long length) throws SQLException - { - try { - SerializableReader serialRreader; - if (reader == null) - serialRreader = null; - else - serialRreader = new SerializableReader (reader, (int) Math.max(0,length)); - callMethod ("setClob", - new Class[] { String.class, Reader.class, - Long.TYPE }, - new Object[] { parameterName, - serialRreader, - new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException - { - try { - SerializableReader reader; - if (value == null) - reader = null; - else - reader = new SerializableReader (value, (int) Math.max(0,length)); - callMethod ("setNCharacterStream", - new Class[] { String.class, Reader.class, - Long.TYPE }, - new Object[] { parameterName, - reader, - new Long(length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 -/* ifdef JDBC40 */ - public void setNClob(String parameterName, NClob value) throws SQLException - { - if (value != null && - !(value instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setNClob", - new Class[] { String.class, NClob.class }, - new Object[] { parameterName, - value }); - } - -/* endif */ - - //@PDA jdbc40 - public void setNClob(String parameterName, Reader reader, long length) throws SQLException - { - try { - SerializableReader serialRreader; - if (reader == null) - serialRreader = null; - else - serialRreader = new SerializableReader (reader, (int) Math.max(0,length)); - callMethod ("setNClob", - new Class[] { String.class, Reader.class, - Long.TYPE }, - new Object[] { parameterName, - serialRreader, - new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - public void setNString(String parameterName, String value) throws SQLException - { - callMethod ("setNString", - new Class[] { String.class, String.class }, - new Object[] { parameterName, value }); - } - - //@PDA jdbc40 -/* ifdef JDBC40 */ - public void setRowId(String parameterName, RowId x) throws SQLException - { - callMethod ("setRowId", - new Class[] { String.class, RowId.class}, - new Object[] { parameterName, x }); - } - - //@PDA jdbc40 - public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException - { - if (xmlObject != null && - !(xmlObject instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setSQLXML", - new Class[] { String.class, SQLXML.class }, - new Object[] { parameterName, - xmlObject }); - } - -/* endif */ - - public void setAsciiStream(String parameterName, InputStream x) throws SQLException - { - InputStream iStream; - if (x == null || - x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setAsciiStream", - new Class[] { String.class, InputStream.class }, - new Object[] { parameterName, - iStream }); - } - - - public void setBinaryStream(String parameterName, InputStream x) throws SQLException - { - InputStream iStream; - if (x == null || - x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBinaryStream", - new Class[] { String.class, InputStream.class }, - new Object[] { parameterName, - iStream }); - } - - - public void setBlob(String parameterName, InputStream inputStream) throws SQLException - { - InputStream iStream; - if (inputStream == null || - inputStream instanceof Serializable) - iStream = inputStream; - else { - try { - iStream = new SerializableInputStream (inputStream); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBlob", - new Class[] { String.class, InputStream.class }, - new Object[] { parameterName, - iStream }); - } - - - public void setCharacterStream(String parameterName, Reader reader) throws SQLException - { - try { - SerializableReader serialRreader; - if (reader == null) - serialRreader = null; - else - serialRreader = new SerializableReader (reader); - callMethod ("setCharacterStream", - new Class[] { String.class, Reader.class }, - new Object[] { parameterName, - serialRreader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - public void setClob(String parameterName, Reader reader) throws SQLException - { - try { - SerializableReader serialRreader; - if (reader == null) - serialRreader = null; - else - serialRreader = new SerializableReader (reader); - callMethod ("setClob", - new Class[] { String.class, Reader.class }, - new Object[] { parameterName, - serialRreader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - public void setNCharacterStream(String parameterName, Reader value) throws SQLException - { - try { - SerializableReader serialRreader; - if (value == null) - serialRreader = null; - else - serialRreader = new SerializableReader (value); - callMethod ("setNCharacterStream", - new Class[] { String.class, Reader.class }, - new Object[] { parameterName, - serialRreader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - public void setNClob(String parameterName, Reader reader) throws SQLException - { - try { - SerializableReader serialRreader; - if (reader == null) - serialRreader = null; - else - serialRreader = new SerializableReader (reader); - callMethod ("setNClob", - new Class[] { String.class, Reader.class }, - new Object[] { parameterName, - serialRreader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/JDClobProxy.java b/cvsroot/jdbc40/com/ibm/as400/access/JDClobProxy.java deleted file mode 100644 index 92b60105e..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/JDClobProxy.java +++ /dev/null @@ -1,247 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDClobProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Writer; -import java.io.Reader; -import java.lang.reflect.InvocationTargetException; -import java.sql.Clob; -import java.sql.SQLException; - - - -// JDBC 2.0 -/** -The JDClobProxy class provides access to character large -objects. The data is valid only within the current -transaction. -**/ -class JDClobProxy -extends AbstractProxyImpl -implements Clob -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Copied from JDError: - static final String EXC_FUNCTION_NOT_SUPPORTED = "IM001"; - - - - public InputStream getAsciiStream () - throws SQLException - { - try { - JDInputStreamProxy newStream = new JDInputStreamProxy (); - return (JDInputStreamProxy) connection_.callFactoryMethod ( - pxId_, "getAsciiStream", newStream); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public Reader getCharacterStream () - throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getCharacterStream", - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public String getSubString (long start, int length) - throws SQLException - { - try { - return (String) connection_.callMethod (pxId_, "getSubString", - new Class[] { Long.TYPE, Integer.TYPE }, - new Object[] { new Long (start), - new Integer (length) }) - .getReturnValue(); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public long length () - throws SQLException - { - try { - return connection_.callMethod (pxId_, "length") - .getReturnValueLong (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public long position (String pattern, long start) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "position", - new Class[] { String.class, Long.TYPE }, - new Object[] { pattern, new Long (start) }) - .getReturnValueLong (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public long position (Clob pattern, long start) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "position", - new Class[] { Clob.class, Long.TYPE }, - new Object[] { pattern, new Long (start) }) - .getReturnValueLong (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 3.0 - public OutputStream setAsciiStream (long pos) - throws SQLException - { - // Avoid dragging in JDError - //@K1D throw new SQLException ( - //@K1D AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - //@K1D EXC_FUNCTION_NOT_SUPPORTED, -99999); - try //@K1A - { - JDOutputStreamProxy newStream = new JDOutputStreamProxy (); - return (JDOutputStreamProxy) connection_.callFactoryMethod (pxId_, "setAsciiStream", - new Class[] { Long.TYPE}, - new Object[] { new Long(pos)}, - newStream); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 3.0 - public Writer setCharacterStream (long pos) - throws SQLException - { - // Avoid dragging in JDError - //@K1D throw new SQLException ( - //@K1D AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - //@K1D EXC_FUNCTION_NOT_SUPPORTED, -99999); - try //@K1A - { - JDWriterProxy newWriter = new JDWriterProxy (); - return (JDWriterProxy) connection_.callFactoryMethod (pxId_, "setCharacterStream", - new Class[] { Long.TYPE}, - new Object[] { new Long(pos)}, - newWriter); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 3.0 - public int setString (long pos, String str) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "setString", - new Class[] { Long.TYPE, String.class}, - new Object[] { new Long(pos), str}) - .getReturnValueInt (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 3.0 - public int setString (long pos, String str, int offset, int len) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "setString", - new Class[] { Long.TYPE, String.class, Integer.TYPE, Integer.TYPE}, - new Object[] { new Long(pos), str, new Integer(offset), new Integer(len)}) - .getReturnValueInt (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 3.0 - public void truncate (long len) - throws SQLException - { - try { - connection_.callMethod (pxId_, "truncate", - new Class[] { Long.TYPE,}, - new Object[] { new Long(len)} ); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - //@PDA jdbc40 - public void free() throws SQLException - { - try { - connection_.callMethod (pxId_, "free"); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - public Reader getCharacterStream(long pos, long length) throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getCharacterStream", - new Class[] { Long.TYPE, Long.TYPE}, - new Object[] { new Long(pos), new Long(length)}, - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/JDConnectionProxy.java b/cvsroot/jdbc40/com/ibm/as400/access/JDConnectionProxy.java deleted file mode 100644 index 725a9c113..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/JDConnectionProxy.java +++ /dev/null @@ -1,1173 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDConnectionProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -/* ifdef JDBC40 */ -import java.sql.ClientInfoStatus; -/* endif */ -import java.sql.Clob; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.DriverManager; -/* ifdef JDBC40 */ -import java.sql.NClob; -/* endif */ -import java.sql.PreparedStatement; -/* ifdef JDBC40 */ -import java.sql.SQLClientInfoException; -import java.sql.SQLXML; -/* endif */ -import java.sql.Savepoint; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.Statement; -import java.sql.Struct; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - - -class JDConnectionProxy -extends AbstractProxyImpl -implements Connection -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - - // Private data. - - private JDDatabaseMetaDataProxy metaData_; - AS400 as400PublicClassObj_; // Prevents garbage collection. - - - // Copied from JDError: - private static final String EXC_FUNCTION_NOT_SUPPORTED = "IM001"; - - - private Object callFactoryMethod (String methodName, - Class[] argClasses, - Object[] argValues, - ProxyFactoryImpl proxyObject) - throws SQLException - { - try { - if (argClasses == null) - return connection_.callFactoryMethod ( - pxId_, - methodName, - proxyObject); - else - return connection_.callFactoryMethod ( - pxId_, - methodName, - argClasses, - argValues, - proxyObject); - } - catch (InvocationTargetException e) { - throw rethrow1 (e); - } - } - - private void callMethod (String methodName) - throws SQLException - { - try { - connection_.callMethod (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw rethrow1 (e); - } - } - - private void callMethod (String methodName, - Class[] argClasses, - Object[] argValues) - throws SQLException - { - try { - connection_.callMethod (pxId_, methodName, argClasses, argValues); - } - catch (InvocationTargetException e) { - throw rethrow1 (e); - } - } - - private boolean callMethodRtnBool (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsBoolean (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw rethrow1 (e); - } - } - - private Object callMethodRtnObj (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsObject (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw rethrow1 (e); - } - } - - - //@PDA 550 - private Object callMethodRtnObj(String methodName, Class[] argClasses, Object[] argValues) throws SQLException - { - try - { - return connection_.callMethod(pxId_, methodName, argClasses, argValues).getReturnValue(); - } catch (InvocationTargetException e) - { - throw rethrow1(e); - } - } - - - public void clearWarnings () - throws SQLException - { - callMethod ("clearWarnings"); - } - - - public void close () - throws SQLException - { - callMethod ("close"); - } - - - public void commit () - throws SQLException - { - callMethod ("commit"); - } - - - // This implements the ProxyImpl interface. - public void construct (ProxyClientConnection connection) - { - connection_ = connection; - // Note: We need to check for a secondary URL (in setProperties) - // before we know what kind of remote object to create, - // therefore we simply capture the 'connection' value here. - } - - - - public Statement createStatement () - throws SQLException - { - JDStatementProxy newStatement = new JDStatementProxy (this); - return (JDStatementProxy) callFactoryMethod ( - "createStatement", null, null, - newStatement); - } - - - - // JDBC 2.0 - public Statement createStatement (int resultSetType, - int resultSetConcurrency) - throws SQLException - { - JDStatementProxy newStatement = new JDStatementProxy (this); - return (JDStatementProxy) callFactoryMethod ( - "createStatement", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer(resultSetType), - new Integer(resultSetConcurrency) }, - newStatement); - } - - - -// JDBC 3.0 - public Statement createStatement (int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - JDStatementProxy newStatement = new JDStatementProxy (this); - return(JDStatementProxy) callFactoryMethod ( - "createStatement", - new Class[] { Integer.TYPE, Integer.TYPE, - Integer.TYPE}, - new Object[] { new Integer(resultSetType), - new Integer(resultSetConcurrency), - new Integer(resultSetHoldability)}, - newStatement); - } - - - - public boolean getAutoCommit () - throws SQLException - { - return callMethodRtnBool ("getAutoCommit"); - } - - - - public String getCatalog () - throws SQLException - { - return (String) callMethodRtnObj ("getCatalog"); - } - - - //@cc1 - /** - * This method returns the concurrent access resolution setting. - * This method has no effect on IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @return The concurrent access resolution setting. Possible return valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public int getConcurrentAccessResolution () throws SQLException - { - return ((Integer)callMethodRtnObj ("getConcurrentAccessResolution")).intValue(); - } - -// JDBC 3.0 - public int getHoldability () - throws SQLException - { - return ((Integer)callMethodRtnObj ("getHoldability")).intValue(); - } - - - - public DatabaseMetaData getMetaData () - throws SQLException - { - if (metaData_ == null) - { - JDDatabaseMetaDataProxy newMetaData = new JDDatabaseMetaDataProxy (this); - metaData_ = (JDDatabaseMetaDataProxy) callFactoryMethod ( - "getMetaData", null, null, - newMetaData); - } - return metaData_; - } - - - - public int getTransactionIsolation () - throws SQLException - { - try { - return connection_.callMethodReturnsInt (pxId_, "getTransactionIsolation"); - } - catch (InvocationTargetException e) { - throw rethrow1 (e); - } - } - - - - // JDBC 2.0 - public Map getTypeMap () - throws SQLException - { - return (Map) callMethodRtnObj ("getTypeMap"); - } - - - - public SQLWarning getWarnings () - throws SQLException - { - return (SQLWarning) callMethodRtnObj ("getWarnings"); - } - - - - public boolean isClosed () - throws SQLException - { - return callMethodRtnBool ("isClosed"); - } - - - - public boolean isReadOnly () - throws SQLException - { - return callMethodRtnBool ("isReadOnly"); - } - - - - public String nativeSQL (String sql) - throws SQLException - { - try { - return (String) connection_.callMethod (pxId_, "nativeSQL", - new Class[] { String.class }, - new Object[] { sql }) - .getReturnValue (); - } - catch (InvocationTargetException e) { - throw rethrow1 (e); - } - } - - - - public CallableStatement prepareCall (String sql) - throws SQLException - { - JDCallableStatementProxy newStatement = new JDCallableStatementProxy (this); - return (JDCallableStatementProxy) callFactoryMethod ( - "prepareCall", - new Class[] { String.class }, - new Object[] { sql }, - newStatement); - } - - - - // JDBC 2.0 - public CallableStatement prepareCall (String sql, - int resultSetType, - int resultSetConcurrency) - throws SQLException - { - JDCallableStatementProxy newStatement = new JDCallableStatementProxy (this); - return (JDCallableStatementProxy) callFactoryMethod ( - "prepareCall", - new Class[] { String.class, Integer.TYPE, - Integer.TYPE }, - new Object[] { sql, - new Integer(resultSetType), - new Integer(resultSetConcurrency) }, - newStatement); - } - - - -// JDBC 3.0 - public CallableStatement prepareCall (String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - JDCallableStatementProxy newStatement = new JDCallableStatementProxy (this); - return(JDCallableStatementProxy) callFactoryMethod ( - "prepareCall", - new Class[] { String.class, Integer.TYPE, - Integer.TYPE, Integer.TYPE}, - new Object[] { sql, - new Integer(resultSetType), - new Integer(resultSetConcurrency), - new Integer(resultSetHoldability)}, - newStatement); - } - - - - - public PreparedStatement prepareStatement (String sql) - throws SQLException - { - JDPreparedStatementProxy newStatement = new JDPreparedStatementProxy (this); - return (JDPreparedStatementProxy) callFactoryMethod ( - "prepareStatement", - new Class[] { String.class }, - new Object[] { sql }, - newStatement); - } - - - -// JDBC 3.0 - public PreparedStatement prepareStatement (String sql, int autoGeneratedKeys) - throws SQLException - { - JDPreparedStatementProxy newStatement = new JDPreparedStatementProxy (this); - return(JDPreparedStatementProxy) callFactoryMethod ( - "prepareStatement", - new Class[] { String.class, Integer.TYPE}, - new Object[] { sql, - new Integer(autoGeneratedKeys)}, - newStatement); - } - - - -// JDBC 3.0 - public PreparedStatement prepareStatement (String sql, int[] columnIndexes) - throws SQLException - { - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - -// JDBC 3.0 - public PreparedStatement prepareStatement (String sql, String[] columnNames) - throws SQLException - { - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - - // JDBC 2.0 - public PreparedStatement prepareStatement (String sql, - int resultSetType, - int resultSetConcurrency) - throws SQLException - { - JDPreparedStatementProxy newStatement = new JDPreparedStatementProxy (this); - return (JDPreparedStatementProxy) callFactoryMethod ( - "prepareStatement", - new Class[] { String.class, Integer.TYPE, - Integer.TYPE }, - new Object[] { sql, - new Integer(resultSetType), - new Integer(resultSetConcurrency) }, - newStatement); - } - - - -// JDBC 3.0 - public PreparedStatement prepareStatement (String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - JDPreparedStatementProxy newStatement = new JDPreparedStatementProxy (this); - return(JDPreparedStatementProxy) callFactoryMethod ( - "prepareStatement", - new Class[] { String.class, Integer.TYPE, - Integer.TYPE, Integer.TYPE}, - new Object[] { sql, - new Integer(resultSetType), - new Integer(resultSetConcurrency), - new Integer(resultSetHoldability)}, - newStatement); - } - - - -// JDBC 3.0 - public void releaseSavepoint (Savepoint savepoint) - throws SQLException - { - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - - static InternalErrorException rethrow1 (InvocationTargetException e) - throws SQLException - { - Throwable e2 = e.getTargetException (); - if (e2 instanceof SQLException) - throw (SQLException) e2; - else - return ProxyClientConnection.rethrow (e); - } - - - - public void rollback () - throws SQLException - { - callMethod ("rollback"); - } - - - -// JDBC 3.0 - public void rollback (Savepoint savepoint) - throws SQLException - { - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - - public void setAutoCommit (boolean autoCommit) - throws SQLException - { - callMethod ("setAutoCommit", - new Class[] { Boolean.TYPE }, - new Object[] { new Boolean(autoCommit) }); - } - - - - public void setCatalog (String catalog) - throws SQLException - { - callMethod ("setCatalog", - new Class[] { String.class }, - new Object[] { catalog }); - } - - - //@cc1 - /** - * This method sets concurrent access resolution. This method overrides the setting of ConcurrentAccessResolution on the datasource or connection - * URL properties. This changes the setting for this connection only. This method has no effect on - * IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @param concurrentAccessResolution The current access resolution setting. Possible valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public void setConcurrentAccessResolution (int concurrentAccessResolution) throws SQLException - { - callMethod ("setConcurrentAccessResolution", - new Class[] { Integer.TYPE}, - new Object[] { new Integer(concurrentAccessResolution)}); - } - -// JDBC 3.0 - public void setHoldability (int holdability) - throws SQLException - { - callMethod ("setHoldability", - new Class[] { Integer.TYPE}, - new Object[] { new Integer(holdability)}); - } - - - - // Copied from JDError: - private static final String EXC_CONNECTION_REJECTED = "08004"; - private static final String EXC_CONNECTION_UNABLE = "08001"; - - // Note: This method is used by AS400JDBCDriver. - void setProperties (JDDataSourceURL dataSourceUrl, JDProperties properties, - AS400 as400) - throws SQLException - { - String remoteClassName; - Class[] argClasses; - Object[] argValues; - String secondaryUrl = dataSourceUrl.getSecondaryURL (); - if (secondaryUrl.length() == 0) { - remoteClassName = "AS400JDBCConnection"; - argClasses = new Class[] { JDDataSourceURL.class, - JDProperties.class, - AS400Impl.class }; - argValues = new Object[] { dataSourceUrl, properties, as400.getImpl() }; - - try { - as400.connectService (AS400.DATABASE); - } - catch (AS400SecurityException e) { //@A0C - // Avoid dragging in JDError: - if (JDTrace.isTraceOn ()) { - synchronized (DriverManager.class) { - e.printStackTrace (DriverManager.getLogWriter ()); - } - } - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_CONNECTION_REJECTED), - EXC_CONNECTION_REJECTED, -99999); - } - catch (java.io.IOException e) { //@A0C - // Avoid dragging in JDError: - if (JDTrace.isTraceOn ()) { - synchronized (DriverManager.class) { - e.printStackTrace (DriverManager.getLogWriter ()); - } - } - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_CONNECTION_UNABLE), - EXC_CONNECTION_UNABLE, -99999); - } - } - else - { // A secondary URL was specified, so get a generic connection. - remoteClassName = "JDGenericConnection"; - argClasses = new Class[] { String.class, Properties.class }; - argValues = new Object[] { secondaryUrl, properties.getOriginalInfo() }; - } - try { - pxId_ = connection_.callConstructor (remoteClassName, false); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - callMethod ("setProperties", argClasses, argValues); - } - - - - public void setReadOnly (boolean readOnly) - throws SQLException - { - callMethod ("setReadOnly", - new Class[] { Boolean.TYPE }, - new Object[] { new Boolean(readOnly) }); - } - - - -// JDBC 3.0 - public Savepoint setSavepoint () - throws SQLException - { - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - -// JDBC 3.0 - public Savepoint setSavepoint (String name) - throws SQLException - { - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - - void setSystem (AS400 as400) - { - as400PublicClassObj_ = as400; - } - - - - public void setTransactionIsolation (int level) - throws SQLException - { - callMethod ("setTransactionIsolation", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(level) }); - } - - - - // JDBC 2.0 - public void setTypeMap (Map typeMap) - throws SQLException - { - callMethod ("setTypeMap", - new Class[] { Map.class }, - new Object[] { typeMap }); - } - - - - // This method is not required by java.sql.Connection, - // but it is used by the JDBC testcases, and is implemented - // in the public class. - public String toString () - { - try { - return (String) connection_.callMethodReturnsObject (pxId_, "toString"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.Connection" }; - } - - - - //@PDA jdbc40 - /** - * Returns true if the connection has not been closed and is still valid. - * The driver shall submit a query on the connection or use some other - * mechanism that positively verifies the connection is still valid when - * this method is called. - *

- * The query submitted by the driver to validate the connection shall be - * executed in the context of the current transaction. - * - * @param timeout - The time in seconds to wait for the database operation - * used to validate the connection to complete. If - * the timeout period expires before the operation - * completes, this method returns false. A value of - * 0 indicates a timeout is not applied to the - * database operation. Note that currently the timeout - * value is not used. - *

- * @return true if the connection is valid, false otherwise - * @exception SQLException if a database access error occurs. - */ - public boolean isValid(int timeout) throws SQLException - { - Object[] oa = new Object[] {new Integer(timeout)}; - return ((Boolean)callMethodRtnObj("isValid", new Class[] {Integer.TYPE}, oa)).booleanValue(); - } - - //@PDA jdbc40 - /** - * Sets the value of the client info property specified by name to the - * value specified by value. - *

- * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver - * and the maximum length that may be specified for each property. - *

- * The driver stores the value specified in a suitable location in the - * database. For example in a special register, session parameter, or - * system table column. For efficiency the driver may defer setting the - * value in the database until the next time a statement is executed or - * prepared. Other than storing the client information in the appropriate - * place in the database, these methods shall not alter the behavior of - * the connection in anyway. The values supplied to these methods are - * used for accounting, diagnostics and debugging purposes only. - *

- * The driver shall generate a warning if the client info name specified - * is not recognized by the driver. - *

- * If the value specified to this method is greater than the maximum - * length for the property the driver may either truncate the value and - * generate a warning or generate a SQLException. If the driver - * generates a SQLException, the value specified was not set on the - * connection. - *

- * The following client info properties are supported in Toobox for Java. - *

- *

    - *
  • ApplicationName - The name of the application currently utilizing - * the connection
  • - *
  • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
  • - *
  • ClientHostname - The hostname of the computer the application - * using the connection is running on.
  • - *
  • ClientAccounting - Client accounting information.
  • - *
  • ClientProgramID - The client program identification.
  • - *
- *

- * @param name The name of the client info property to set - * @param value The value to set the client info property to. If the - * value is null, the current value of the specified - * property is cleared. - *

- * @throws SQLException if the database server returns an error while - * setting the client info value on the database server. - *

- */ - public void setClientInfo(String name, String value) -/* ifdef JDBC40 */ - throws SQLClientInfoException -/* endif */ -/* ifndef JDBC40 - throws SQLException - endif */ - { - try - { - callMethod("setClientInfo", - new Class[] { String.class, String.class }, - new Object[] { name, value }); - } catch (SQLException e) - { -/* ifdef JDBC40 */ - //may be SQLException or SQLClientInfoException - if(e instanceof SQLClientInfoException) - throw (SQLClientInfoException)e; - else - { - //HashMap m = new HashMap(); //@pdd jdbc40 merge - //@PDC jdbc40 merge. code hashmap without generic references for pre-jdk1.6 - HashMap m = new HashMap(); - m.put(name, ClientInfoStatus.REASON_UNKNOWN); - SQLClientInfoException clientIE = new SQLClientInfoException(e.getMessage(), e.getSQLState(), m); - throw clientIE; - } -/* endif */ -/* ifndef JDBC40 - throw e; - endif */ - } - } - - // @PDA 550 client info - /** - * Sets the value of the connection's client info properties. The - * Properties object contains the names and values of the - * client info properties to be set. The set of client info properties - * contained in the properties list replaces the current set of client info - * properties on the connection. If a property that is currently set on the - * connection is not present in the properties list, that property is - * cleared. Specifying an empty properties list will clear all of the - * properties on the connection. See - * setClientInfo (String, String) for more information. - *

- * If an error occurs in setting any of the client info properties, a - * ClientInfoException is thrown. The - * ClientInfoException contains information indicating which - * client info properties were not set. The state of the client information - * is unknown because some databases do not allow multiple client info - * properties to be set atomically. For those databases, one or more - * properties may have been set before the error occurred. - *

- * The following client info properties are supported in Toobox for Java. - *

- *

    - *
  • ApplicationName - The name of the application currently utilizing - * the connection
  • - *
  • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
  • - *
  • ClientHostname - The hostname of the computer the application - * using the connection is running on.
  • - *
  • ClientAccounting - Client accounting information.
  • - *
  • ClientProgramID - The client program identification.
  • - *
- *

- * @param properties - * the list of client info properties to set - *

- * @throws SQLException - * if the database server returns an error while setting the - * clientInfo values on the database server - *

- * @see java.sql.Connection#setClientInfo(String, String) - * setClientInfo(String, String) - */ - public void setClientInfo(Properties properties) -/* ifdef JDBC40 */ - throws SQLClientInfoException -/* endif */ -/* ifndef JDBC40 - throws SQLException - endif */ - { - try - { - callMethod ("setClientInfo", - new Class[] { Properties.class }, - new Object[] { properties }); - }catch(SQLException e) - { -/* ifdef JDBC40 */ - //may be SQLException or SQLClientInfoException - if(e instanceof SQLClientInfoException) - throw (SQLClientInfoException)e; - else - { - //create Map for exception constructor - //HashMap m = new HashMap(); //@pdd jdbc40 merge - //@PDC jdbc40 merge. code hashmap without generic references for pre-jdk1.6 - HashMap m = new HashMap(); - Enumeration clientInfoNames = properties.keys(); - while( clientInfoNames.hasMoreElements()) - { - String clientInfoName = (String)clientInfoNames.nextElement(); - m.put(clientInfoName, ClientInfoStatus.REASON_UNKNOWN); - } - SQLClientInfoException clientIE = new SQLClientInfoException(e.getMessage(), e.getSQLState(), m); - throw clientIE; - } -/* endif */ -/* ifndef JDBC40 - throw e; - endif */ - } - } - - //@PDA 550 client info - /** - * Returns the value of the client info property specified by name. This - * method may return null if the specified client info property has not - * been set and does not have a default value. This method will also - * return null if the specified client info property name is not supported - * by the driver. - *

- * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver. - *

- * The following client info properties are supported in Toobox for Java. - *

- *

    - *
  • ApplicationName - The name of the application currently utilizing - * the connection
  • - *
  • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
  • - *
  • ClientHostname - The hostname of the computer the application - * using the connection is running on.
  • - *
  • ClientAccounting - Client accounting information.
  • - *
  • ClientProgramID - The client program identification.
  • - *
- *

- * @param name The name of the client info property to retrieve - *

- * @return The value of the client info property specified - *

- * @throws SQLException if the database server returns an error when - * fetching the client info value from the database. - *

- * @see java.sql.DatabaseMetaData#getClientInfoProperties - */ - public String getClientInfo(String name) throws SQLException - { - return (String) callMethodRtnObj("getClientInfo", - new Class[] { String.class }, - new Object[] { name }); - } - - //@PDA 550 client info - /** - * Returns a list containing the name and current value of each client info - * property supported by the driver. The value of a client info property - * may be null if the property has not been set and does not have a - * default value. - *

- * The following client info properties are supported in Toobox for Java. - *

- *

    - *
  • ApplicationName - The name of the application currently utilizing - * the connection
  • - *
  • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
  • - *
  • ClientHostname - The hostname of the computer the application - * using the connection is running on.
  • - *
  • ClientAccounting - Client accounting information.
  • - *
  • ClientProgramID - The client program identification.
  • - *
- *

- * @return A Properties object that contains the name and current value of - * each of the client info properties supported by the driver. - *

- * @throws SQLException if the database server returns an error when - * fetching the client info values from the database - */ - public Properties getClientInfo() throws SQLException - { - return (Properties) callMethodRtnObj("getClientInfo"); - } - - //@PDA jdbc40 - /** - * Constructs an object that implements the Clob interface. The object - * returned initially contains no data. The setAsciiStream, - * setCharacterStream and setString methods of - * the Clob interface may be used to add data to the Clob. - * @return An object that implements the Clob interface - * @throws SQLException if an object that implements the - * Clob interface can not be constructed. - * - */ - public Clob createClob() throws SQLException - { - return (Clob) callMethodRtnObj("createClob"); - } - - //@PDA jdbc40 - /** - * Constructs an object that implements the Blob interface. The object - * returned initially contains no data. The setBinaryStream and - * setBytes methods of the Blob interface may be used to add data to - * the Blob. - * @return An object that implements the Blob interface - * @throws SQLException if an object that implements the - * Blob interface can not be constructed - * - */ - public Blob createBlob() throws SQLException - { - return (Blob) callMethodRtnObj("createBlob"); - } - - //@PDA jdbc40 - /** - * Constructs an object that implements the NClob interface. The object - * returned initially contains no data. The setAsciiStream, - * setCharacterStream and setString methods of the NClob interface may - * be used to add data to the NClob. - * @return An object that implements the NClob interface - * @throws SQLException if an object that implements the - * NClob interface can not be constructed. - * - */ -/* ifdef JDBC40 */ - public NClob createNClob() throws SQLException - { - return (NClob) callMethodRtnObj("createNClob"); - } -/* endif */ - //@PDA jdbc40 - /** - * Constructs an object that implements the SQLXML interface. The object - * returned initially contains no data. The createXmlStreamWriter object and - * setString method of the SQLXML interface may be used to add data to the SQLXML - * object. - * @return An object that implements the SQLXML interface - * @throws SQLException if an object that implements the SQLXML interface can not - * be constructed - */ -/* ifdef JDBC40 */ - public SQLXML createSQLXML() throws SQLException - { - return (SQLXML) callMethodRtnObj("createSQLXML"); - } -/* endif */ - //@PDA jdbc40 - /** - * Factory method for creating Array objects. - * - * @param typeName the SQL name of the type the elements of the array map to. The typeName is a - * database-specific name which may be the name of a built-in type, a user-defined type or a standard SQL type supported by this database. This - * is the value returned by Array.getBaseTypeName - * @param elements the elements that populate the returned object - * @return an Array object whose elements map to the specified SQL type - * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - */ - public Array createArrayOf(String typeName, Object[] elements) throws SQLException - { - return (Array) callMethodRtnObj("createArrayOf", - new Class[] { String.class, Object[].class }, - new Object[] { typeName, elements }); - } - - //@PDA jdbc40 - /** - * Factory method for creating Struct objects. - * - * @param typeName the SQL type name of the SQL structured type that this Struct - * object maps to. The typeName is the name of a user-defined type that - * has been defined for this database. It is the value returned by - * Struct.getSQLTypeName. - * @param attributes the attributes that populate the returned object - * @return a Struct object that maps to the given SQL type and is populated with the given attributes - * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - */ - public Struct createStruct(String typeName, Object[] attributes) throws SQLException - { - return (Struct) callMethodRtnObj("createStruct", - new Class[] { String.class, Object[].class }, - new Object[] { typeName, attributes }); - } - - //@pd2 add missing proxy method. This is needed for various testcases that use jobid. - /** - Returns the job identifier of the host server job corresponding to this connection. - Every JDBC connection is associated with a host server job on the IBM i system. The - format is: -

    -
  • 10 character job name -
  • 10 character user name -
  • 6 character job number -
- -

Note: Since this method is not defined in the JDBC Connection interface, - you typically need to cast a Connection object to JDConnectionProxy in order - to call this method: -

-  String serverJobIdentifier = ((JDConnectionProxy)connection).getServerJobIdentifier();
-  
- - @return The server job identifier, or null if not known. - **/ - public String getServerJobIdentifier() throws SQLException // @pd2 - { // @pd2 - return (String) callMethodRtnObj("getServerJobIdentifier"); // @pd2 - } // @pd2 - - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/JDDatabaseMetaDataProxy.java b/cvsroot/jdbc40/com/ibm/as400/access/JDDatabaseMetaDataProxy.java deleted file mode 100644 index 8eaa83c56..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/JDDatabaseMetaDataProxy.java +++ /dev/null @@ -1,1574 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDDatabaseMetaDataProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.sql.ResultSet; -/* ifdef JDBC40 */ -import java.sql.RowIdLifetime; -/* endif */ -import java.sql.SQLException; - - - -class JDDatabaseMetaDataProxy -extends AbstractProxyImpl -implements java.sql.DatabaseMetaData -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Private data. - - private JDConnectionProxy jdConnection_; - // The object that caused this object to be created. - - - /** - Constructs a JDDatabaseMetaDataProxy object. - - @param connectionProxy The Connection object that caused this object to be created. - **/ - public JDDatabaseMetaDataProxy (JDConnectionProxy jdConnection) - { - jdConnection_ = jdConnection; - } - - - public boolean allProceduresAreCallable () - throws SQLException - { - return callMethodRtnBool ("allProceduresAreCallable"); - } - - public boolean allTablesAreSelectable () - throws SQLException - { - return callMethodRtnBool ("allTablesAreSelectable"); - } - - private boolean callMethodRtnBool (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsBoolean (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a boolean. - private boolean callMethodRtnBool (String methodName, int arg) - throws SQLException - { - try { - return connection_.callMethod (pxId_, methodName, - new Class[] { Integer.TYPE }, - new Object[] { new Integer (arg) }) - .getReturnValueBoolean (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - private boolean callMethodRtnBool (String methodName, - Class[] argClasses, - Object[] argValues) - throws SQLException - { - try { - return connection_.callMethod (pxId_, methodName, - argClasses, argValues) - .getReturnValueBoolean (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return an int. - private int callMethodRtnInt (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsInt (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a ResultSet. - private JDResultSetProxy callMethodRtnRSet (String methodName) - throws SQLException - { - try { - JDResultSetProxy newResultSet = new JDResultSetProxy (jdConnection_); - return (JDResultSetProxy) connection_.callFactoryMethod ( - pxId_, methodName, newResultSet); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - private JDResultSetProxy callMethodRtnRSet (String methodName, - Class[] argClasses, - Object[] argValues) - throws SQLException - { - try { - JDResultSetProxy newResultSet = new JDResultSetProxy (jdConnection_); - return (JDResultSetProxy) connection_.callFactoryMethod ( - pxId_, methodName, - argClasses, argValues, - newResultSet); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a String. - private String callMethodRtnStr (String methodName) - throws SQLException - { - try { - return (String) connection_.callMethodReturnsObject (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - private Object callMethodRtnObj (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsObject (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - Object callMethodRtnObj(String methodName, Class[] argClasses, Object[] argValues) throws SQLException - { - try - { - return connection_.callMethod(pxId_, methodName, argClasses, argValues).getReturnValue(); - } catch (InvocationTargetException e) - { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public boolean dataDefinitionCausesTransactionCommit () - throws SQLException - { - return callMethodRtnBool ("dataDefinitionCausesTransactionCommit"); - } - - - public boolean dataDefinitionIgnoredInTransactions () - throws SQLException - { - return callMethodRtnBool ("dataDefinitionIgnoredInTransactions"); - } - - - -// JDBC 2.0 - public boolean deletesAreDetected (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("deletesAreDetected", resultSetType); - } - - - public boolean doesMaxRowSizeIncludeBlobs () - throws SQLException - { - return callMethodRtnBool ("doesMaxRowSizeIncludeBlobs"); - } - - -// JDBC 3.0 - public ResultSet getAttributes (String catalog, - String schemaPattern, - String typeNamePattern, - String attributeNamePattern) - throws SQLException - { - return callMethodRtnRSet ("getAttributes", - new Class[] { String.class, String.class, - String.class, - String.class}, - new Object[] { catalog, schemaPattern, typeNamePattern, - attributeNamePattern}); - } - - - public ResultSet getBestRowIdentifier (String catalog, - String schema, - String table, - int scope, - boolean nullable) - throws SQLException - { - return callMethodRtnRSet ("getBestRowIdentifier", - new Class[] { String.class, String.class, - String.class, - Integer.TYPE, Boolean.TYPE }, - new Object[] { catalog, schema, table, - new Integer (scope), - new Boolean (nullable) }); - } - - - public ResultSet getCatalogs () - throws SQLException - { - return callMethodRtnRSet ("getCatalogs"); - } - - public String getCatalogSeparator () - throws SQLException - { - return callMethodRtnStr ("getCatalogSeparator"); - } - - - public String getCatalogTerm () - throws SQLException - { - return callMethodRtnStr ("getCatalogTerm"); - } - - public ResultSet getColumnPrivileges (String catalog, - String schema, - String table, - String columnPattern) - throws SQLException - { - return callMethodRtnRSet ("getColumnPrivileges", - new Class[] { String.class, String.class, - String.class, String.class }, - new Object[] { catalog, schema, - table, columnPattern }); - } - - public ResultSet getColumns (String catalog, - String schemaPattern, - String tablePattern, - String columnPattern) - throws SQLException - { - return callMethodRtnRSet ("getColumns", - new Class[] { String.class, String.class, - String.class, String.class }, - new Object[] { catalog, schemaPattern, - tablePattern, columnPattern }); - } - - -// JDBC 2.0 - public java.sql.Connection getConnection () - throws SQLException - { - return jdConnection_; - } - - - public ResultSet getCrossReference (String primaryCatalog, - String primarySchema, - String primaryTable, - String foreignCatalog, - String foreignSchema, - String foreignTable) - throws SQLException - { - return callMethodRtnRSet ("getCrossReference", - new Class[] { String.class, String.class, - String.class, String.class, - String.class, String.class }, - new Object[] { primaryCatalog, primarySchema, - primaryTable, foreignCatalog, - foreignSchema, foreignTable }); - } - - -// JDBC 3.0 - public int getDatabaseMajorVersion () - throws SQLException - { - return callMethodRtnInt ("getDatabaseMajorVersion"); - } - - -// JDBC 3.0 - public int getDatabaseMinorVersion () - throws SQLException - { - return callMethodRtnInt ("getDatabaseMinorVersion"); - } - - - public String getDatabaseProductName () - throws SQLException - { - return callMethodRtnStr ("getDatabaseProductName"); - } - - - public String getDatabaseProductVersion () - throws SQLException - { - return callMethodRtnStr ("getDatabaseProductVersion"); - } - - - public int getDefaultTransactionIsolation () - throws SQLException - { - return callMethodRtnInt ("getDefaultTransactionIsolation"); - } - - - public int getDriverMajorVersion () - { - try { - return callMethodRtnInt ("getDriverMajorVersion"); - } - catch (SQLException e) - { - throw new InternalErrorException (e.getMessage (), InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - - public int getDriverMinorVersion () - { - try { - return callMethodRtnInt ("getDriverMinorVersion"); - } - catch (SQLException e) - { - throw new InternalErrorException (e.getMessage (), InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - - public String getDriverName () - throws SQLException - { - return callMethodRtnStr ("getDriverName"); - } - - - public String getDriverVersion () - throws SQLException - { - return callMethodRtnStr ("getDriverVersion"); - } - - - public ResultSet getExportedKeys (String catalog, - String schema, - String table) - throws SQLException - { - return callMethodRtnRSet ("getExportedKeys", - new Class[] { String.class, String.class, - String.class }, - new Object[] { catalog, schema, table }); - } - - - public String getExtraNameCharacters () - throws SQLException - { - return callMethodRtnStr ("getExtraNameCharacters"); - } - - - public String getIdentifierQuoteString () - throws SQLException - { - return callMethodRtnStr ("getIdentifierQuoteString"); - } - - - public ResultSet getImportedKeys (String catalog, - String schema, - String table) - throws SQLException - { - return callMethodRtnRSet ("getImportedKeys", - new Class[] { String.class, String.class, - String.class }, - new Object[] { catalog, schema, table }); - } - - - public ResultSet getIndexInfo (String catalog, - String schema, - String table, - boolean unique, - boolean approximate) - throws SQLException - { - return callMethodRtnRSet ("getIndexInfo", - new Class[] { String.class, String.class, - String.class, Boolean.TYPE, - Boolean.TYPE }, - new Object[] { catalog, schema, - table, new Boolean (unique), - new Boolean (approximate) }); - } - - -// JDBC 3.0 - public int getJDBCMajorVersion () - throws SQLException - { - return callMethodRtnInt ("getJDBCMajorVersion"); - } - - -// JDBC 3.0 - public int getJDBCMinorVersion () - throws SQLException - { - return callMethodRtnInt ("getJDBCMinorVersion"); - } - - - public int getMaxBinaryLiteralLength () - throws SQLException - { - return callMethodRtnInt ("getMaxBinaryLiteralLength"); - } - - - public int getMaxCatalogNameLength () - throws SQLException - { - return callMethodRtnInt ("getMaxCatalogNameLength"); - } - - - public int getMaxCharLiteralLength () - throws SQLException - { - return callMethodRtnInt ("getMaxCharLiteralLength"); - } - - - public int getMaxColumnNameLength () - throws SQLException - { - return callMethodRtnInt ("getMaxColumnNameLength"); - } - - - public int getMaxColumnsInGroupBy () - throws SQLException - { - return callMethodRtnInt ("getMaxColumnsInGroupBy"); - } - - - public int getMaxColumnsInIndex () - throws SQLException - { - return callMethodRtnInt ("getMaxColumnsInIndex"); - } - - - public int getMaxColumnsInOrderBy () - throws SQLException - { - return callMethodRtnInt ("getMaxColumnsInOrderBy"); - } - - - public int getMaxColumnsInSelect () - throws SQLException - { - return callMethodRtnInt ("getMaxColumnsInSelect"); - } - - - public int getMaxColumnsInTable () - throws SQLException - { - return callMethodRtnInt ("getMaxColumnsInTable"); - } - - - public int getMaxConnections () - throws SQLException - { - return callMethodRtnInt ("getMaxConnections"); - } - - - public int getMaxCursorNameLength () - throws SQLException - { - return callMethodRtnInt ("getMaxCursorNameLength"); - } - - - public int getMaxIndexLength () - throws SQLException - { - return callMethodRtnInt ("getMaxIndexLength"); - } - - - public int getMaxProcedureNameLength () - throws SQLException - { - return callMethodRtnInt ("getMaxProcedureNameLength"); - } - - - public int getMaxRowSize () - throws SQLException - { - return callMethodRtnInt ("getMaxRowSize"); - } - - - public int getMaxSchemaNameLength () - throws SQLException - { - return callMethodRtnInt ("getMaxSchemaNameLength"); - } - - - public int getMaxStatementLength () - throws SQLException - { - return callMethodRtnInt ("getMaxStatementLength"); - } - - - public int getMaxStatements () - throws SQLException - { - return callMethodRtnInt ("getMaxStatements"); - } - - - public int getMaxTableNameLength () - throws SQLException - { - return callMethodRtnInt ("getMaxTableNameLength"); - } - - - public int getMaxTablesInSelect () - throws SQLException - { - return callMethodRtnInt ("getMaxTablesInSelect"); - } - - - public int getMaxUserNameLength () - throws SQLException - { - return callMethodRtnInt ("getMaxUserNameLength"); - } - - - public String getNumericFunctions () - throws SQLException - { - return callMethodRtnStr ("getNumericFunctions"); - } - - - public ResultSet getPrimaryKeys (String catalog, - String schema, - String table) - throws SQLException - { - return callMethodRtnRSet ("getPrimaryKeys", - new Class[] { String.class, String.class, - String.class }, - new Object[] { catalog, schema, table }); - } - - - public ResultSet getProcedureColumns (String catalog, - String schemaPattern, - String procedurePattern, - String columnPattern) - throws SQLException - { - return callMethodRtnRSet ("getProcedureColumns", - new Class[] { String.class, String.class, - String.class, String.class }, - new Object[] { catalog, schemaPattern, - procedurePattern, columnPattern }); - } - - - public ResultSet getProcedures (String catalog, - String schemaPattern, - String procedurePattern) - throws SQLException - { - return callMethodRtnRSet ("getProcedures", - new Class[] { String.class, String.class, - String.class }, - new Object[] { catalog, schemaPattern, - procedurePattern }); - } - - - public String getProcedureTerm () - throws SQLException - { - return callMethodRtnStr ("getProcedureTerm"); - } - - -// JDBC 3.0 - public int getResultSetHoldability () - throws SQLException - { - return callMethodRtnInt ("getResultSetHoldability"); - } - - - public ResultSet getSchemas () - throws SQLException - { - return callMethodRtnRSet ("getSchemas"); - } - - - public String getSchemaTerm () - throws SQLException - { - return callMethodRtnStr ("getSchemaTerm"); - } - - - public String getSearchStringEscape () - throws SQLException - { - return callMethodRtnStr ("getSearchStringEscape"); - } - - - public String getSQLKeywords () - throws SQLException - { - return callMethodRtnStr ("getSQLKeywords"); - } - - -// JDBC 3.0 - public int getSQLStateType () - throws SQLException - { - return callMethodRtnInt ("getSQLStateType"); - } - - - public String getStringFunctions () - throws SQLException - { - return callMethodRtnStr ("getStringFunctions"); - } - - -// JDBC 3.0 - public ResultSet getSuperTables (String catalog, - String schemaPattern, - String tableNamePattern) - throws SQLException - { - return callMethodRtnRSet ("getSuperTables", - new Class[] { String.class, String.class, - String.class}, - new Object[] { catalog, schemaPattern, - tableNamePattern}); - } - - -// JDBC 3.0 - public ResultSet getSuperTypes (String catalog, - String schemaPattern, - String typeNamePattern) - throws SQLException - { - return callMethodRtnRSet ("getSuperTypes", - new Class[] { String.class, String.class, - String.class}, - new Object[] { catalog, schemaPattern, - typeNamePattern}); - } - - - - public String getSystemFunctions () - throws SQLException - { - return callMethodRtnStr ("getSystemFunctions"); - } - - - public ResultSet getTablePrivileges (String catalog, - String schemaPattern, - String tablePattern) - throws SQLException - { - return callMethodRtnRSet ("getTablePrivileges", - new Class[] { String.class, String.class, - String.class }, - new Object[] { catalog, schemaPattern, - tablePattern }); - } - - - public ResultSet getTables (String catalog, - String schemaPattern, - String tablePattern, - String tableTypes[]) - throws SQLException - { - return callMethodRtnRSet ("getTables", - new Class[] { String.class, String.class, - String.class, String[].class }, - new Object[] { catalog, schemaPattern, - tablePattern, tableTypes }); - } - - - public ResultSet getTableTypes () - throws SQLException - { - return callMethodRtnRSet ("getTableTypes"); - } - - - public String getTimeDateFunctions () - throws SQLException - { - return callMethodRtnStr ("getTimeDateFunctions"); - } - - - public ResultSet getTypeInfo () - throws SQLException - { - return callMethodRtnRSet ("getTypeInfo"); - } - - -// JDBC 2.0 - public ResultSet getUDTs (String catalog, - String schemaPattern, - String typeNamePattern, - int[] types) - throws SQLException - { - return callMethodRtnRSet ("getUDTs", - new Class[] { String.class, String.class, - String.class, int[].class }, - new Object[] { catalog, schemaPattern, - typeNamePattern, types }); - } - - - public String getURL () - throws SQLException - { - return callMethodRtnStr ("getURL"); - } - - - public String getUserName () - throws SQLException - { - return callMethodRtnStr ("getUserName"); - } - - - public ResultSet getVersionColumns (String catalog, - String schema, - String table) - throws SQLException - { - return callMethodRtnRSet ("getVersionColumns", - new Class[] { String.class, String.class, - String.class }, - new Object[] { catalog, schema, table }); - } - - -// JDBC 2.0 - public boolean insertsAreDetected (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("insertsAreDetected", resultSetType); - } - - - public boolean isCatalogAtStart () - throws SQLException - { - return callMethodRtnBool ("isCatalogAtStart"); - } - - - boolean isCatalogValid (String catalog) - throws SQLException - { - return callMethodRtnBool ("isCatalogValid", - new Class[] { String.class }, - new Object[] { catalog }); - } - - - public boolean isReadOnly () - throws SQLException - { - return callMethodRtnBool ("isReadOnly"); - } - - -// JDBC 3.0 - public boolean locatorsUpdateCopy () - throws SQLException - { - return callMethodRtnBool ("locatorsUpdateCopy"); - } - - - public boolean nullPlusNonNullIsNull () - throws SQLException - { - return callMethodRtnBool ("nullPlusNonNullIsNull"); - } - - - public boolean nullsAreSortedAtEnd () - throws SQLException - { - return callMethodRtnBool ("nullsAreSortedAtEnd"); - } - - - public boolean nullsAreSortedAtStart () - throws SQLException - { - return callMethodRtnBool ("nullsAreSortedAtStart"); - } - - - public boolean nullsAreSortedHigh () - throws SQLException - { - return callMethodRtnBool ("nullsAreSortedHigh"); - } - - - public boolean nullsAreSortedLow () - throws SQLException - { - return callMethodRtnBool ("nullsAreSortedLow"); - } - - -// JDBC 2.0 - public boolean othersDeletesAreVisible (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("othersDeletesAreVisible", resultSetType); - } - - -// JDBC 2.0 - public boolean othersInsertsAreVisible (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("othersInsertsAreVisible", resultSetType); - } - - -// JDBC 2.0 - public boolean othersUpdatesAreVisible (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("othersUpdatesAreVisible", resultSetType); - } - - -// JDBC 2.0 - public boolean ownDeletesAreVisible (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("ownDeletesAreVisible", resultSetType); - } - - -// JDBC 2.0 - public boolean ownInsertsAreVisible (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("ownInsertsAreVisible", resultSetType); - } - - -// JDBC 2.0 - public boolean ownUpdatesAreVisible (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("ownUpdatesAreVisible", resultSetType); - } - - - public boolean storesLowerCaseIdentifiers () - throws SQLException - { - return callMethodRtnBool ("storesLowerCaseIdentifiers"); - } - - - public boolean storesLowerCaseQuotedIdentifiers () - throws SQLException - { - return callMethodRtnBool ("storesLowerCaseQuotedIdentifiers"); - } - - - public boolean storesMixedCaseIdentifiers () - throws SQLException - { - return callMethodRtnBool ("storesMixedCaseIdentifiers"); - } - - - public boolean storesMixedCaseQuotedIdentifiers () - throws SQLException - { - return callMethodRtnBool ("storesMixedCaseQuotedIdentifiers"); - } - - - public boolean storesUpperCaseIdentifiers () - throws SQLException - { - return callMethodRtnBool ("storesUpperCaseIdentifiers"); - } - - - public boolean storesUpperCaseQuotedIdentifiers () - throws SQLException - { - return callMethodRtnBool ("storesUpperCaseQuotedIdentifiers"); - } - - - public boolean supportsAlterTableWithAddColumn () - throws SQLException - { - return callMethodRtnBool ("supportsAlterTableWithAddColumn"); - } - - - public boolean supportsAlterTableWithDropColumn () - throws SQLException - { - return callMethodRtnBool ("supportsAlterTableWithDropColumn"); - } - - - public boolean supportsANSI92EntryLevelSQL () - throws SQLException - { - return callMethodRtnBool ("supportsANSI92EntryLevelSQL"); - } - - - public boolean supportsANSI92FullSQL () - throws SQLException - { - return callMethodRtnBool ("supportsANSI92FullSQL"); - } - - - public boolean supportsANSI92IntermediateSQL () - throws SQLException - { - return callMethodRtnBool ("supportsANSI92IntermediateSQL"); - } - - -// JDBC 2.0 - public boolean supportsBatchUpdates () - throws SQLException - { - return callMethodRtnBool ("supportsBatchUpdates"); - } - - - public boolean supportsCatalogsInDataManipulation () - throws SQLException - { - return callMethodRtnBool ("supportsCatalogsInDataManipulation"); - } - - - public boolean supportsCatalogsInIndexDefinitions () - throws SQLException - { - return callMethodRtnBool ("supportsCatalogsInIndexDefinitions"); - } - - - public boolean supportsCatalogsInPrivilegeDefinitions () - throws SQLException - { - return callMethodRtnBool ("supportsCatalogsInPrivilegeDefinitions"); - } - - - public boolean supportsCatalogsInProcedureCalls () - throws SQLException - { - return callMethodRtnBool ("supportsCatalogsInProcedureCalls"); - } - - - public boolean supportsCatalogsInTableDefinitions () - throws SQLException - { - return callMethodRtnBool ("supportsCatalogsInTableDefinitions"); - } - - - public boolean supportsColumnAliasing () - throws SQLException - { - return callMethodRtnBool ("supportsColumnAliasing"); - } - - - public boolean supportsConvert () - throws SQLException - { - return callMethodRtnBool ("supportsConvert"); - } - - - public boolean supportsConvert (int fromType, int toType) - throws SQLException - { - return callMethodRtnBool ("supportsConvert", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer (fromType), - new Integer (toType) }); - } - - - public boolean supportsCoreSQLGrammar () - throws SQLException - { - return callMethodRtnBool ("supportsCoreSQLGrammar"); - } - - - public boolean supportsCorrelatedSubqueries () - throws SQLException - { - return callMethodRtnBool ("supportsCorrelatedSubqueries"); - } - - - public boolean supportsDataDefinitionAndDataManipulationTransactions () - throws SQLException - { - return callMethodRtnBool ("supportsDataDefinitionAndDataManipulationTransactions"); - } - - - public boolean supportsDataManipulationTransactionsOnly () - throws SQLException - { - return callMethodRtnBool ("supportsDataManipulationTransactionsOnly"); - } - - - public boolean supportsDifferentTableCorrelationNames () - throws SQLException - { - return callMethodRtnBool ("supportsDifferentTableCorrelationNames"); - } - - - public boolean supportsExpressionsInOrderBy () - throws SQLException - { - return callMethodRtnBool ("supportsExpressionsInOrderBy"); - } - - - public boolean supportsExtendedSQLGrammar () - throws SQLException - { - return callMethodRtnBool ("supportsExtendedSQLGrammar"); - } - - - public boolean supportsFullOuterJoins () - throws SQLException - { - return callMethodRtnBool ("supportsFullOuterJoins"); - } - - -// JDBC 3.0 - public boolean supportsGetGeneratedKeys () - throws SQLException - { - return callMethodRtnBool ("supportsGetGeneratedKeys"); - } - - - public boolean supportsGroupBy () - throws SQLException - { - return callMethodRtnBool ("supportsGroupBy"); - } - - - public boolean supportsGroupByBeyondSelect () - throws SQLException - { - return callMethodRtnBool ("supportsGroupByBeyondSelect"); - } - - - public boolean supportsGroupByUnrelated () - throws SQLException - { - return callMethodRtnBool ("supportsGroupByUnrelated"); - } - - - public boolean supportsIntegrityEnhancementFacility () - throws SQLException - { - return callMethodRtnBool ("supportsIntegrityEnhancementFacility"); - } - - - public boolean supportsLikeEscapeClause () - throws SQLException - { - return callMethodRtnBool ("supportsLikeEscapeClause"); - } - - - public boolean supportsLimitedOuterJoins () - throws SQLException - { - return callMethodRtnBool ("supportsLimitedOuterJoins"); - } - - - public boolean supportsMinimumSQLGrammar () - throws SQLException - { - return callMethodRtnBool ("supportsMinimumSQLGrammar"); - } - - - public boolean supportsMixedCaseIdentifiers () - throws SQLException - { - return callMethodRtnBool ("supportsMixedCaseIdentifiers"); - } - - - public boolean supportsMixedCaseQuotedIdentifiers () - throws SQLException - { - return callMethodRtnBool ("supportsMixedCaseQuotedIdentifiers"); - } - - -// JDBC 3.0 - public boolean supportsMultipleOpenResults () - throws SQLException - { - return callMethodRtnBool ("supportsMultipleOpenResults"); - } - - - public boolean supportsMultipleResultSets () - throws SQLException - { - return callMethodRtnBool ("supportsMultipleResultSets"); - } - - - public boolean supportsMultipleTransactions () - throws SQLException - { - return callMethodRtnBool ("supportsMultipleTransactions"); - } - - -// JDBC 3.0 - public boolean supportsNamedParameters () - throws SQLException - { - return callMethodRtnBool ("supportsNamedParameters"); - } - - - public boolean supportsNonNullableColumns () - throws SQLException - { - return callMethodRtnBool ("supportsNonNullableColumns"); - } - - - public boolean supportsOpenCursorsAcrossCommit () - throws SQLException - { - return callMethodRtnBool ("supportsOpenCursorsAcrossCommit"); - } - - - public boolean supportsOpenCursorsAcrossRollback () - throws SQLException - { - return callMethodRtnBool ("supportsOpenCursorsAcrossRollback"); - } - - - public boolean supportsOpenStatementsAcrossCommit () - throws SQLException - { - return callMethodRtnBool ("supportsOpenStatementsAcrossCommit"); - } - - - public boolean supportsOpenStatementsAcrossRollback () - throws SQLException - { - return callMethodRtnBool ("supportsOpenStatementsAcrossRollback"); - } - - - public boolean supportsOrderByUnrelated () - throws SQLException - { - return callMethodRtnBool ("supportsOrderByUnrelated"); - } - - - public boolean supportsOuterJoins () - throws SQLException - { - return callMethodRtnBool ("supportsOuterJoins"); - } - - - public boolean supportsPositionedDelete () - throws SQLException - { - return callMethodRtnBool ("supportsPositionedDelete"); - } - - - public boolean supportsPositionedUpdate () - throws SQLException - { - return callMethodRtnBool ("supportsPositionedUpdate"); - } - - -// JDBC 2.0 - public boolean supportsResultSetConcurrency (int resultSetType, int resultSetConcurrency) - throws SQLException - { - return callMethodRtnBool ("supportsResultSetConcurrency", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer (resultSetType), - new Integer (resultSetConcurrency) }); - } - - -// JDBC 3.0 - public boolean supportsResultSetHoldability (int resultSetHoldability) - throws SQLException - { - return callMethodRtnBool ("supportsResultSetHoldability", - new Class[] { Integer.TYPE}, - new Object[] { new Integer (resultSetHoldability)}); - } - - -// JDBC 2.0 - public boolean supportsResultSetType (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("supportsResultSetType", resultSetType); - } - - -// JDBC 3.0 - public boolean supportsSavepoints () - throws SQLException - { - return callMethodRtnBool ("supportsSavepoints"); - } - - - public boolean supportsSchemasInDataManipulation () - throws SQLException - { - return callMethodRtnBool ("supportsSchemasInDataManipulation"); - } - - - public boolean supportsSchemasInIndexDefinitions () - throws SQLException - { - return callMethodRtnBool ("supportsSchemasInIndexDefinitions"); - } - - - public boolean supportsSchemasInPrivilegeDefinitions () - throws SQLException - { - return callMethodRtnBool ("supportsSchemasInPrivilegeDefinitions"); - } - - - public boolean supportsSchemasInProcedureCalls () - throws SQLException - { - return callMethodRtnBool ("supportsSchemasInProcedureCalls"); - } - - - public boolean supportsSchemasInTableDefinitions () - throws SQLException - { - return callMethodRtnBool ("supportsSchemasInTableDefinitions"); - } - - - public boolean supportsSelectForUpdate () - throws SQLException - { - return callMethodRtnBool ("supportsSelectForUpdate"); - } - - - public boolean supportsStatementPooling() - throws SQLException - { - return callMethodRtnBool ("supportsStatementPooling"); - } - - - public boolean supportsStoredProcedures () - throws SQLException - { - return callMethodRtnBool ("supportsStoredProcedures"); - } - - - public boolean supportsSubqueriesInComparisons () - throws SQLException - { - return callMethodRtnBool ("supportsSubqueriesInComparisons"); - } - - - public boolean supportsSubqueriesInExists () - throws SQLException - { - return callMethodRtnBool ("supportsSubqueriesInExists"); - } - - - public boolean supportsSubqueriesInIns () - throws SQLException - { - return callMethodRtnBool ("supportsSubqueriesInIns"); - } - - - public boolean supportsSubqueriesInQuantifieds () - throws SQLException - { - return callMethodRtnBool ("supportsSubqueriesInQuantifieds"); - } - - - public boolean supportsTableCorrelationNames () - throws SQLException - { - return callMethodRtnBool ("supportsTableCorrelationNames"); - } - - - public boolean supportsTransactionIsolationLevel (int transactionIsolationLevel) - throws SQLException - { - return callMethodRtnBool ("supportsTransactionIsolationLevel", transactionIsolationLevel); - } - - - public boolean supportsTransactions () - throws SQLException - { - return callMethodRtnBool ("supportsTransactions"); - } - - - public boolean supportsUnion () - throws SQLException - { - return callMethodRtnBool ("supportsUnion"); - } - - - public boolean supportsUnionAll () - throws SQLException - { - return callMethodRtnBool ("supportsUnionAll"); - } - - - // This method is not required by java.sql.DatabaseMetaData, - // but it is used by the JDBC testcases, and is implemented - // in the public class. - public String toString () - { - try { - return (String) connection_.callMethodReturnsObject (pxId_, "toString"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - -// JDBC 2.0 - public boolean updatesAreDetected (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("updatesAreDetected", resultSetType); - } - - - public boolean usesLocalFilePerTable () - throws SQLException - { - return callMethodRtnBool ("usesLocalFilePerTable"); - } - - - public boolean usesLocalFiles () - throws SQLException - { - return callMethodRtnBool ("usesLocalFiles"); - } - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.DatabaseMetaData" }; - } - - - //@PDA jdbc40 - public boolean autoCommitFailureClosesAllResultSets() throws SQLException - { - return callMethodRtnBool("autoCommitFailureClosesAllResultSets"); - } - - - //@PDA 550 - public ResultSet getClientInfoProperties() throws SQLException - { - return callMethodRtnRSet("getClientInfoProperties"); - } - -/* ifdef JDBC40 */ - - //@PDA jdbc40 - public RowIdLifetime getRowIdLifetime() throws SQLException - { - return (RowIdLifetime) callMethodRtnObj("getRowIdLifetime"); - } -/* endif */ - - //@PDA jdbc40 - public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException - { - return callMethodRtnRSet("getSchemas", new Class[] {String.class, String.class}, new Object[] {catalog, schemaPattern}); - } - - // @PDA jdbc40 - public boolean providesQueryObjectGenerator() throws SQLException - { - return callMethodRtnBool("providesQueryObjectGenerator"); - } - - //@PDA jdbc40 - public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException - { - return callMethodRtnBool("supportsStoredFunctionsUsingCallSyntax"); - } - - //@pdd removde getFunctionParameters. It was renamed to getFunctionColumns() - - //@PDA jdbc40 - public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException - { - return callMethodRtnRSet ("getFunctions", - new Class[] { String.class, String.class, String.class }, - new Object[] { catalog, schemaPattern, functionNamePattern }); - } - - //@pda 550 - public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException - { - return callMethodRtnRSet ("getFunctionColumns", - new Class[] { String.class, String.class, String.class, String.class }, - new Object[] { catalog, schemaPattern, functionNamePattern, columnNamePattern }); - } - - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/JDError.java b/cvsroot/jdbc40/com/ibm/as400/access/JDError.java deleted file mode 100644 index e879a2cf1..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/JDError.java +++ /dev/null @@ -1,860 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDError.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/* ifdef JDBC40 */ -import java.sql.ClientInfoStatus; -import java.sql.SQLClientInfoException; -import java.sql.SQLDataException; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLFeatureNotSupportedException; -import java.sql.SQLIntegrityConstraintViolationException; -import java.sql.SQLInvalidAuthorizationSpecException; -import java.sql.SQLNonTransientConnectionException; -import java.sql.SQLSyntaxErrorException; -import java.sql.SQLTimeoutException; -import java.sql.SQLTransactionRollbackException; -import java.util.Map; -/* endif */ - -import java.sql.SQLWarning; - - - -/** -The JDError class provides access to all of the error and -warning SQL states and message string resources. -**/ -// -// Implementation note: -// -// When adding or changing an error message or SQL state, there -// are places that you need to add or change: -// -// 1. A String constant defined to be equal to the SQL state. -// 2. A resource in JDMRI.properties, named JD + SQL state. -// -final class JDError -{ - // Constants for SQL states. - static final String EXC_ACCESS_MISMATCH = "42505"; - static final String EXC_ATTRIBUTE_VALUE_INVALID = "HY024"; - static final String EXC_BUFFER_LENGTH_INVALID = "HY090"; - static final String EXC_CHAR_CONVERSION_INVALID = "22524"; - static final String EXC_CCSID_INVALID = "22522"; - static final String EXC_COLUMN_NOT_FOUND = "42703"; - static final String EXC_CONCURRENCY_INVALID = "HY108"; - static final String EXC_CONNECTION_NONE = "08003"; - static final String EXC_CONNECTION_REJECTED = "08004"; - static final String EXC_CONNECTION_UNABLE = "08001"; - static final String EXC_COMMUNICATION_LINK_FAILURE = "08S01"; // @F2A - static final String EXC_CURSOR_NAME_AMBIGUOUS = "3C000"; - static final String EXC_CURSOR_NAME_INVALID = "34000"; - static final String EXC_CURSOR_POSITION_INVALID = "HY109"; - static final String EXC_CURSOR_STATE_INVALID = "24000"; - static final String EXC_DATA_TYPE_INVALID = "HY004"; - static final String EXC_DATA_TYPE_MISMATCH = "07006"; - static final String EXC_DESCRIPTOR_INDEX_INVALID = "07009"; - static final String EXC_FUNCTION_NOT_SUPPORTED = "IM001"; - static final String EXC_FUNCTION_SEQUENCE = "HY010"; - static final String EXC_INTERNAL = "HY000"; - static final String EXC_MAX_STATEMENTS_EXCEEDED = "HY014"; - static final String EXC_OPERATION_CANCELLED = "HY008"; - static final String EXC_PARAMETER_COUNT_MISMATCH = "07001"; - static final String EXC_PARAMETER_TYPE_INVALID = "HY105"; - static final String EXC_SCALE_INVALID = "HY094"; - static final String EXC_SERVER_ERROR = "HY001"; - static final String EXC_SYNTAX_BLANK = "43617"; - static final String EXC_SYNTAX_ERROR = "42601"; - static final String EXC_TXN_STATE_INVALID = "25000"; // @E1C - static final String EXC_SQL_STATEMENT_TOO_LONG = "54001"; // @E9A - static final String EXC_SAVEPOINT_INVALID_IN_CONTEXT = "3B001"; // @E10a - static final String EXC_SAVEPOINT_ALREADY_EXISTS = "3B501"; // @E10a - static final String EXC_SAVEPOINT_DOES_NOT_EXIST = "3B502"; // @E10a - static final String EXC_RDB_DOES_NOT_EXIST = "42705"; // @J2a - static final String EXC_XML_PARSING_ERROR = "2200M"; // @xml2 - - static final String WARN_ATTRIBUTE_VALUE_CHANGED = "01608"; - static final String WARN_EXTENDED_DYNAMIC_DISABLED = "01H11"; - static final String WARN_OPTION_VALUE_CHANGED = "01S02"; - static final String WARN_PACKAGE_CACHE_DISABLED = "01H12"; - static final String WARN_PROPERTY_EXTRA_IGNORED = "01H20"; - static final String WARN_TXN_COMMITTED = "01H30"; - static final String WARN_URL_EXTRA_IGNORED = "01H10"; - static final String WARN_URL_SCHEMA_INVALID = "01H13"; - static final String WARN_1000_OPEN_STATEMENTS = "01G00"; //@K1A - - - - static String lastServerSQLState_ = null; - - static boolean jdk14 = false; - static { - String javaVersion = System.getProperty("java.version"); - javaVersion=javaVersion.substring(0,3); - if ("1.0".equals(javaVersion) || "1.1".equals(javaVersion) || "1.2".equals(javaVersion) || "1.3".equals(javaVersion)) { - jdk14=false; - } else { - jdk14=true; - } - - } - -/** -Private constructor to prevent instantiation. All methods in -this class are static. -**/ - private JDError () - { - } - - - -/** -Returns the reason text based on a SQL state. - -@param sqlState the SQL State. -@return Reason - error description. -**/ - static final String getReason (String sqlState) - { - return AS400JDBCDriver.getResource ("JD" + sqlState); - } - - - -// @E2C -/** -Returns the message text for the last operation on the IBM i system. - -@param connection Connection to the system. -@param id Id for the last operation. -@param returnCode The return code from the last operation. -@return Reason - error description. -**/ - private static String getReason (AS400JDBCConnection connection, - int id, - int returnCode) // @E2A - { - try - { - // Check to see if the caller wants second level text, too. - boolean secondLevelText = connection.getProperties().equals (JDProperties.ERRORS, JDProperties.ERRORS_FULL); - - // Get the message text from the system. We also retrieve - // the SQL state at this time to save a trip to the system. - int orsBitmap = DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_SQLCA - + DBBaseRequestDS.ORS_BITMAP_MESSAGE_ID - + DBBaseRequestDS.ORS_BITMAP_FIRST_LEVEL_TEXT; - if (secondLevelText) - orsBitmap += DBBaseRequestDS.ORS_BITMAP_SECOND_LEVEL_TEXT; - - DBSQLResultSetDS request = null; //@P0A - DBReplyRequestedDS reply = null; //@P0A - try //@P0A - { - request = DBDSPool.getDBSQLResultSetDS ( //@P0C - DBSQLResultSetDS.FUNCTIONID_SEND_RESULTS_SET, - id, orsBitmap, 0); - - reply = connection.sendAndReceive (request, id); //@P0C - DBReplySQLCA sqlca = reply.getSQLCA(); // @E2A - - // Build up the error description. - StringBuffer errorDescription = new StringBuffer (); - errorDescription.append ("["); - errorDescription.append (reply.getMessageId()); - errorDescription.append ("] "); - - // If pre-V5R4: - // If the return code is +-438 (from an SQL stored procedure) or @E4A - // +-443 (from an external stored procedure) AND errd[3] is 0, then @E4A @E6C - // an error was signalled by the stored procedure itself. @E4A - boolean textAppended = false; // @E6A - int absReturnCode = Math.abs(returnCode); // @E4A - - if ((absReturnCode == 438) || (absReturnCode == 443) && // @E2A @E4C @E5C @E6C - (connection.getVRM() < JDUtilities.vrm540)) //@25955a - { - try //@25955a - { - if (sqlca.getErrd (4) == 0) //@F1C // @E6A - { - if (absReturnCode == 438) // @E2A @E4C @E5C - { - errorDescription.append(sqlca.getErrmc(connection.converter_)); // @E2A @P0C - textAppended = true; // @E8A - } - else if (absReturnCode == 443) // @E5A - { - errorDescription.append(sqlca.getErrmc(6, connection.converter_)); // @E5A @P0C - textAppended = true; // @E8A - } - } // @E6A - } - catch(Exception e) { // In some circumstances the getErrmc() can throw a NegativeArraySizeException or ArrayIndexOutOfBoundsException. @25955a - JDTrace.logException(null, e.getMessage(), e); // just trace it - } - } - - // Otherwise, get the text directly from the reply. // @E6A - if (textAppended == false) // @E2A @E6C - { - errorDescription.append (reply.getFirstLevelMessageText()); - if (secondLevelText) - { - errorDescription.append (" "); - errorDescription.append (reply.getSecondLevelMessageText ()); - } - } // @E2A - - // Get the SQL state and remember it for the next - // call to getSQLState(). - lastServerSQLState_ = sqlca.getSQLState (connection.converter_); // @E2C @P0C - if (lastServerSQLState_ == null) - lastServerSQLState_ = EXC_SERVER_ERROR; - - return errorDescription.toString (); - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - if (reply != null) { reply.returnToPool(); reply = null; } - } - } - catch (DBDataStreamException e) - { - return getReason (EXC_INTERNAL); - } - catch (SQLException e) - { - return getReason (EXC_INTERNAL); - } - } - - - -/** -Returns the SQL state for the last operation on the IBM i system. - -@param connection Connection to the system. -@param id Id for the last operation. -@return The SQL state. -**/ - private static String getSQLState (AS400JDBCConnection connection, - int id) - { - // If the SQL state was retrieved by a previous call to - // getReason(), then use that. - if (lastServerSQLState_ != null) - { - String sqlState = lastServerSQLState_; - lastServerSQLState_ = null; - return sqlState; - } - - // Otherwise, go to the system to get it. - try - { - int orsBitmap = DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + DBBaseRequestDS.ORS_BITMAP_SQLCA; - - DBSQLResultSetDS request = null; //@P0A - DBReplyRequestedDS reply = null; //@P0A - try //@P0A - { - request = DBDSPool.getDBSQLResultSetDS (DBSQLResultSetDS.FUNCTIONID_SEND_RESULTS_SET, id, orsBitmap, 0); //@P0C - - reply = connection.sendAndReceive (request, id); //@P0C - - String sqlState = reply.getSQLCA ().getSQLState (connection.converter_); //@P0C - - if (sqlState == null) - sqlState = EXC_SERVER_ERROR; - - return sqlState; - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - if (reply != null) { reply.returnToPool(); reply = null; } - } - } - catch (DBDataStreamException e) - { - return getReason (EXC_INTERNAL); - } - catch (SQLException e) - { - return getReason (EXC_INTERNAL); - } - } - - - -/** -Returns an SQL warning based on an error in the -error table. - -@param sqlState The SQL State. -**/ - public static SQLWarning getSQLWarning (String sqlState) - { - // The DB2 for IBM i SQL CLI manual says that - // we should set the native error code to -99999 - // when the driver generates the warning. - // - String reason = getReason(sqlState); - SQLWarning warning = new SQLWarning (reason, sqlState, -99999); - - if (JDTrace.isTraceOn ()) // @J3a - { - // @J3a - String message = "Posting warning, sqlState: " + sqlState // @J3a - + " reason: " + reason // @J3a - + " vendor code -99999"; // @J3a - JDTrace.logException(null, message, warning); // @J3a - } // @J3a - - return warning; - } - - - -/** -Returns an SQL warning based on information -retrieved from the IBM i system. - -@param connection connection to the system. -@param id id for the last operation. -@param errorClass error class from the system reply. -@param returnCode return code from the system reply. -**/ - public static SQLWarning getSQLWarning (AS400JDBCConnection connection, - int id, - int errorClass, - int returnCode) - { - String reason = getReason (connection, id, returnCode); - String state = getSQLState (connection, id); - - SQLWarning warning = new SQLWarning (reason, state, returnCode); // @E2C - - if (JDTrace.isTraceOn ()) // @J3a - { - // @J3a - String message = "Posting warning, id: " + id // @J3a - + " error class: " + errorClass // @J3a - + " return code: " + returnCode // @J3a - + " reason: " + reason // @J3a - + " state: " + state; // @J3a - JDTrace.logException(connection, message, warning); // @J3a - } // @J3a - - return warning; - } - - - - -/** -Throws an SQL exception based on an error in the -error table. - -@param sqlState The SQL State. - -@exception SQLException Always. -**/ - public static void throwSQLException (String sqlState) - throws SQLException - { - // @J4 - changed this method to call the method that takes an object ID. Don't - // know why the same code was in two places. A null object ID is handled - // by both this class and JDTrace. - JDError.throwSQLException((Object)null, sqlState); - } - - -// @J3 new method -/** -Throws an SQL exception based on an error in the -error table. - -@param Object The object throwing the exception. This can be null. -@param sqlState The SQL State. - - -@exception SQLException Always. -**/ - public static void throwSQLException (Object thrower, String sqlState) - throws SQLException - { - // The DB2 for IBM i SQL CLI manual says that - // we should set the native error code to -99999 - // when the driver generates the error. - // - String reason = getReason(sqlState); -/* ifdef JDBC40 */ - SQLException e = createSQLExceptionSubClass(reason, sqlState, -99999); //@PDA jdbc40 - -/* endif */ -/* ifndef JDBC40 - SQLException e = new SQLException (reason, sqlState, -99999); - endif */ - if (JDTrace.isTraceOn ()) - { - String message = "Throwing exception, sqlState: " + sqlState - + " reason: " + reason - + " vendor code -99999"; - JDTrace.logException(thrower, message, e); - } - - throw e; - } - - - -/** -Throws an SQL exception based on an error in the -error table and dumps an internal exception stack -trace for debugging purposes. - -@param sqlState The SQL State. -@param e The internal exception. - -@exception SQLException Always. -**/ - public static void throwSQLException (String sqlState, Exception e) - throws SQLException - { - // @J4 - changed this method to call the method that takes an object ID. - // This method can be removed once all code that uses is has been updated - // to call the method that takes a reference to the thrower. That is, once - // all jdbc classes have been changed from - // JDError.throwSQLException(state, e); - // to - // JDError.throwSQLException(this, state, e); - - JDError.throwSQLException(null, sqlState, e); - } - - -/** -Throws an SQL exception based on an error in the -error table and dumps an internal exception stack -trace for debugging purposes. - -@param sqlState The SQL State. -@param message The message text. - -@exception SQLException Always. -**/ - public static void throwSQLException (String sqlState, String message) - throws SQLException - { - JDError.throwSQLException(null, sqlState, message); - } - - -/** -Throws an SQL exception based on an error in the -error table and dumps an internal exception stack -trace for debugging purposes. - -@param sqlState The SQL State. -@param message The message text. - -@exception SQLException Always. -**/ - public static void throwSQLException (Object thrower, String sqlState, String message) - throws SQLException - { - String reason = getReason(sqlState); - StringBuffer buffer = new StringBuffer(reason); - if (message != null) - { - buffer.append(" ("); - buffer.append(message); - buffer.append(')'); - } - - // The DB2 for IBM i SQL CLI manual says that - // we should set the native error code to -99999 - // when the driver generates the error. - // - -/* ifdef JDBC40 */ - SQLException e2 = createSQLExceptionSubClass(buffer.toString(), sqlState, -99999); //@PDA jdbc40 - -/* endif */ -/* ifndef JDBC40 - SQLException e2 = new SQLException (buffer.toString(), sqlState, -99999); - endif */ - if (JDTrace.isTraceOn ()) - { - String m2 = "Throwing exception. Message text: "+message; - JDTrace.logInformation(thrower, m2); - - m2 = "Throwing exception. Actual exception: " - + buffer.toString() - + " sqlState: " + sqlState - + " vendor code -99999"; - JDTrace.logException(thrower, m2, e2); - } - - throw e2; - } - - -// @J4 new method. It has all the code from the method that takes a state and an -// exception. What is added is a reference to the thrower so we know -// who is throwing the exception. -/** -Throws an SQL exception based on an error in the -error table and dumps an internal exception stack -trace for debugging purposes. - -@param sqlState The SQL State. -@param e The internal exception. - -@exception SQLException Always. -**/ - public static void throwSQLException (Object thrower, String sqlState, Exception e) - throws SQLException - { - // Dump the internal exception stack trace if - // trace is on. - // @J3d if (JDTrace.isTraceOn ()) { // @D0A - // @J3d synchronized (DriverManager.class) { // @D0A - // @J3d e.printStackTrace (DriverManager.getLogWriter()); - // @J3d } // @D0A - // @J3d } // @D0A - - String reason = getReason(sqlState); - StringBuffer buffer = new StringBuffer(reason); // @E3A - buffer.append(" ("); // @E3A - String message = e.getMessage(); // @E3A - if (message != null) // @E3A - buffer.append(message); // @E3A - else // @E3A - buffer.append(e.getClass()); // @E3A - buffer.append(')'); // @E7A - - // The DB2 for IBM i SQL CLI manual says that - // we should set the native error code to -99999 - // when the driver generates the error. - // -/* ifdef JDBC40 */ - SQLException e2 = createSQLExceptionSubClass(buffer.toString(), sqlState, -99999); //@PDA jdbc40 - -/* endif */ -/* ifndef JDBC40 - SQLException e2 = new SQLException (buffer.toString(), sqlState, -99999); // @E3C - endif */ - if (JDTrace.isTraceOn ()) // @J3a - { // @J3a - String m2 = "Throwing exception. Original exception: "; // @J3a - JDTrace.logException(thrower, m2, e); // @J3a - // @J3a - m2 = "Throwing exception. Actual exception: " // @J3a - + buffer.toString() // @J3a - + " sqlState: " + sqlState // @J3a - + " vendor code -99999"; // @J3a - JDTrace.logException(thrower, m2, e2); // @J3a - } // @J3a - - // - // Set the cause for JDK 1.4 and later - // - if (jdk14) { - e2.initCause(e); - } - throw e2; - } - -/** -Throws an SQL exception based on an error in the -error table and dumps an internal exception stack -trace for debugging purposes. - -@param thrower The object that threw the exception. -@param sqlState The SQL State. -@param e The internal exception. -@param m A message for the exception - -@exception SQLException Always. -**/ - public static void throwSQLException (Object thrower, String sqlState, Exception e, String m) - throws SQLException - { - - String reason = getReason(sqlState); - StringBuffer buffer = new StringBuffer(reason); - buffer.append(" ("); - String message = e.getMessage(); - if (message != null) - buffer.append(message); - else - buffer.append(e.getClass()); - buffer.append(", "); - buffer.append(m); - buffer.append(')'); - - // The DB2 for IBM i SQL CLI manual says that - // we should set the native error code to -99999 - // when the driver generates the error. - // -/* ifdef JDBC40 */ - SQLException e2 = createSQLExceptionSubClass(buffer.toString(), sqlState, -99999); //@PDA jdbc40 - -/* endif */ -/* ifndef JDBC40 - SQLException e2 = new SQLException (buffer.toString(), sqlState, -99999); - endif */ - if (JDTrace.isTraceOn ()) - { - String m2 = "Throwing exception. Original exception: "; - JDTrace.logException(thrower, m2, e); - - m2 = "Throwing exception. Actual exception: " - + buffer.toString() - + " sqlState: " + sqlState - + " vendor code -99999"; - JDTrace.logException(thrower, m2, e2); - } - - throw e2; - } - - -/** -Throws an SQL exception based on information -retrieved from the IBM i system. - -@param connection connection to the system. -@param id id for the last operation. -@param errorClass error class from the system reply. -@param returnCode return code from the system reply. - -@exception SQLException Always. -**/ - public static void throwSQLException (AS400JDBCConnection connection, - int id, - int errorClass, - int returnCode) - throws SQLException - { - // @J4 code moved to the method that takes a reference to the object - // that is throwing the exception. This method can be removed - // once all code that uses is has been updated to call the - // method that takes a reference to the thrower. That is, once - // all jdbc classes have been changed from - // JDError.throwSQLException(connection, id, errorClass, returnCode); - // to - // JDError.throwSQLException(this, connection, id, errorClass, returnCode); - - JDError.throwSQLException(null, connection, id, errorClass, returnCode); - } - - - -// @J4 new method. It has all the code from the method that takes a connection, -// and the error stuff. What is added is a reference to the thrower so we know -// who is throwing the exception. -/** -Throws an SQL exception based on information -retrieved from the system. - -@param connection connection to the system. -@param id id for the last operation. -@param errorClass error class from the system reply. -@param returnCode return code from the system reply. - -@exception SQLException Always. -**/ - public static void throwSQLException (Object thrower, - AS400JDBCConnection connection, - int id, - int errorClass, - int returnCode) - throws SQLException - { - String reason = getReason(connection, id, returnCode); - String state = getSQLState(connection, id); - -/* ifdef JDBC40 */ - SQLException e = createSQLExceptionSubClass(reason, state, returnCode); //@PDA jdbc40 - -/* endif */ -/* ifndef JDBC40 - SQLException e = new SQLException (reason, state, returnCode); // @E2C - endif */ - if (JDTrace.isTraceOn ()) // @J3a - { // @J3a - String message = "Throwing exception, id: " + id // @J3a - + " error class: " + errorClass // @J3a - + " return code: " + returnCode // @J3a - + " reason: " + reason // @J3a - + " state: " + state; // @J3a - JDTrace.logException(thrower, connection, message, e); // @J3a - } // @J3a - - throw e; - } - - - - //@PDA jdbc40 - /** - Throws an SQLClientInfoException exception based on an error in the - error table and dumps an internal exception stack - trace for debugging purposes. - - @param thrower The object that is throwing the exception. - @param sqlState The SQL State. - @param e The internal exception. - - @exception SQLClientInfoException Always. - **/ - // - //@pdc jdbc40 merge public static void throwSQLClientInfoException (Object thrower, String sqlState, Exception e, Map m) -/* ifdef JDBC40 */ - public static void throwSQLClientInfoException (Object thrower, String sqlState, Exception e, Map m) - throws SQLClientInfoException - { - String reason = getReason(sqlState); - StringBuffer buffer = new StringBuffer(reason); - buffer.append(" ("); - String message = e.getMessage(); - if (message != null) - buffer.append(message); - else - buffer.append(e.getClass()); - buffer.append(')'); - - // The DB2 for IBM i SQL CLI manual says that - // we should set the native error code to -99999 - // when the driver generates the error. - - SQLClientInfoException e2 = new SQLClientInfoException (buffer.toString(), sqlState, -99999, m); - - if (JDTrace.isTraceOn ()) - { - String m2 = "Throwing exception. Original exception: "; - JDTrace.logException(thrower, m2, e); - // @J3a - m2 = "Throwing exception. Actual exception: " - + buffer.toString() - + " sqlState: " + sqlState - + " vendor code -99999"; - JDTrace.logException(thrower, m2, e2); - } - - throw e2; - } -/* endif */ - //@PDA jdbc40 - /** - Helper class that creates a new sub-class object of SQLException for new jdbc 4.0 SQLException sub-classes. - Sub-class is determined based upon sqlState. - Modeled after Native driver SQLException factory. - - @param sqlState The SQL State. - **/ - -/* ifdef JDBC40 */ - - public static SQLException createSQLExceptionSubClass ( String message, String sqlState, int vendorCode ) - { - - // - // Check the first two digits of the SQL state and create the appropriate - // exception - // - - char digit0 = sqlState.charAt(0); - char digit1 = sqlState.charAt(1); - - switch (digit0) { - case '0': { - switch (digit1) { - case 'A': - return new SQLFeatureNotSupportedException(message, sqlState, vendorCode); - - case '8': - if (vendorCode == -30082) { - return new SQLInvalidAuthorizationSpecException(message, sqlState, vendorCode); - } else { - // All connection exceptions on IBM i are NonTransient - return new SQLNonTransientConnectionException(message, sqlState, vendorCode); - } - default: - return new SQLException(message, sqlState, vendorCode); - - } - } - case '2': { - switch (digit1) { - case '2': - return new SQLDataException(message, sqlState, vendorCode); - case '3': - return new SQLIntegrityConstraintViolationException(message, sqlState, vendorCode); - case '8': - return new SQLInvalidAuthorizationSpecException(message, sqlState, vendorCode); - - default : - return new SQLException(message, sqlState, vendorCode); - - } - } - case '4': - switch (digit1) { - case '0': - return new SQLTransactionRollbackException(message, sqlState, vendorCode); - case '2': - return new SQLSyntaxErrorException(message, sqlState, vendorCode); - default : - return new SQLException(message, sqlState, vendorCode); - } - case '5': - if ( vendorCode == -952) { - return new SQLTimeoutException(message, sqlState, vendorCode); - } else { - return new SQLException(message, sqlState, vendorCode); - } - case 'I': - if ("IM001".equals(sqlState)) { - return new SQLFeatureNotSupportedException(message, sqlState, vendorCode); - } else { - return new SQLException(message, sqlState, vendorCode); - } - - case 'H' : - if ("HY017".equals(sqlState)) { - return new SQLNonTransientConnectionException(message, sqlState, vendorCode); - } else { - return new SQLException(message, sqlState, vendorCode); - } - - default: - return new SQLException(message, sqlState, vendorCode); - } - - } -/* endif */ -} - - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/JDGenericConnection.java b/cvsroot/jdbc40/com/ibm/as400/access/JDGenericConnection.java deleted file mode 100644 index f0195b8b5..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/JDGenericConnection.java +++ /dev/null @@ -1,908 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDGenericConnection.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.*; //@A2C -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -/* ifdef JDBC40 */ -import java.sql.SQLClientInfoException; -/* endif */ -import java.sql.Clob; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -/* ifdef JDBC40 */ -import java.sql.NClob; -/* endif */ -import java.sql.PreparedStatement; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Savepoint; //@A1A -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.Statement; -import java.sql.Struct; -import java.util.Map; -import java.util.Properties; - - -class JDGenericConnection -/* ifdef JDBC40 */ -extends ToolboxWrapper -/* endif */ -implements Connection -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Private data. - private Connection actualConnection_; - - - - public void clearWarnings () - throws SQLException - { - actualConnection_.clearWarnings (); - } - - - public void close () - throws SQLException - { - actualConnection_.close (); - } - - - public void commit () - throws SQLException - { - actualConnection_.commit (); - } - - - - public Statement createStatement () - throws SQLException - { - return actualConnection_.createStatement (); - } - - - - // JDBC 2.0 - public Statement createStatement (int resultSetType, - int resultSetConcurrency) - throws SQLException - { - return actualConnection_.createStatement (resultSetType, resultSetConcurrency); - } - - - //@A1A - public Statement createStatement (int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { -//@A2D return actualConnection_.createStatement (resultSetType, resultSetConcurrency, resultSetHoldability); - try - { - Method m = actualConnection_.getClass().getDeclaredMethod("createStatement", new Class[] { Integer.TYPE, Integer.TYPE, Integer.TYPE}); //@A2A - return(Statement)m.invoke(actualConnection_, new Object[] { new Integer(resultSetType), new Integer(resultSetConcurrency), new Integer(resultSetHoldability)}); //@A2A - } - catch (NoSuchMethodException nsme) //@A2A - { - } - catch (IllegalAccessException iae) //@A2A - { - } - catch (InvocationTargetException iae) //@A2A - { - } - return null; //@A2A - } - - - protected void finalize () - throws Throwable - { - if (actualConnection_ != null && - ! actualConnection_.isClosed ()) - actualConnection_.close (); - - super.finalize (); - } - - - - public boolean getAutoCommit () - throws SQLException - { - return actualConnection_.getAutoCommit (); - } - - - - public String getCatalog () - throws SQLException - { - return actualConnection_.getCatalog (); - } - - - - //@A1A - public int getHoldability () - throws SQLException - { -//@A2D return actualConnection_.getHoldability (); - try - { - Method m = actualConnection_.getClass().getDeclaredMethod("getHoldability", new Class[] {}); //@A2A - return((Integer)m.invoke(actualConnection_, new Object[] {})).intValue(); //@A2A - } - catch (NoSuchMethodException nsme) //@A2A - { - } - catch (IllegalAccessException iae) //@A2A - { - } - catch (InvocationTargetException iae) //@A2A - { - } - return -1; //@A2A - } - - - - public DatabaseMetaData getMetaData () - throws SQLException - { - return actualConnection_.getMetaData (); - } - - - - public int getTransactionIsolation () - throws SQLException - { - return actualConnection_.getTransactionIsolation (); - } - - - - // JDBC 2.0 - public Map getTypeMap () - throws SQLException - { - return actualConnection_.getTypeMap (); - } - - - - public SQLWarning getWarnings () - throws SQLException - { - return actualConnection_.getWarnings (); - } - - - - public boolean isClosed () - throws SQLException - { - return actualConnection_.isClosed (); - } - - - - public boolean isReadOnly () - throws SQLException - { - return actualConnection_.isReadOnly (); - } - - - - public String nativeSQL (String sql) - throws SQLException - { - return actualConnection_.nativeSQL (sql); - } - - - - public CallableStatement prepareCall (String sql) - throws SQLException - { - return actualConnection_.prepareCall (sql); - } - - - - // JDBC 2.0 - public CallableStatement prepareCall (String sql, - int resultSetType, - int resultSetConcurrency) - throws SQLException - { - return actualConnection_.prepareCall (sql, resultSetType, resultSetConcurrency); - } - - - - //@A1A - public CallableStatement prepareCall (String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { -//@A2D return actualConnection_.prepareCall (sql, resultSetType, resultSetConcurrency, resultSetHoldability); - try - { - Method m = actualConnection_.getClass().getDeclaredMethod("prepareCall", new Class[] { String.class, Integer.TYPE, Integer.TYPE, Integer.TYPE}); //@A2A - return(CallableStatement)m.invoke(actualConnection_, new Object[] { sql, new Integer(resultSetType), new Integer(resultSetConcurrency), new Integer(resultSetHoldability)}); //@A2A - } - catch (NoSuchMethodException nsme) //@A2A - { - } - catch (IllegalAccessException iae) //@A2A - { - } - catch (InvocationTargetException iae) //@A2A - { - } - return null; //@A2A - } - - - - public PreparedStatement prepareStatement (String sql) - throws SQLException - { - return actualConnection_.prepareStatement (sql); - } - - - //@A1A - public PreparedStatement prepareStatement (String sql, int autoGeneratedKeys) - throws SQLException - { -//@A2D return actualConnection_.prepareStatement (sql, autoGeneratedKeys); - try - { - Method m = actualConnection_.getClass().getDeclaredMethod("prepareStatement", new Class[] { String.class, Integer.TYPE}); //@A2A - return(PreparedStatement)m.invoke(actualConnection_, new Object[] { sql, new Integer(autoGeneratedKeys)}); //@A2A - } - catch (NoSuchMethodException nsme) //@A2A - { - } - catch (IllegalAccessException iae) //@A2A - { - } - catch (InvocationTargetException iae) //@A2A - { - } - return null; //@A2A - } - - - //@A1A - public PreparedStatement prepareStatement (String sql, int[] columnIndexes) - throws SQLException - { -//@A2D return actualConnection_.prepareStatement(sql, columnIndexes); - try - { - Method m = actualConnection_.getClass().getDeclaredMethod("prepareStatement", new Class[] { String.class, columnIndexes.getClass()}); //@A2A - return(PreparedStatement)m.invoke(actualConnection_, new Object[] { sql, columnIndexes}); //@A2A - } - catch (NoSuchMethodException nsme) //@A2A - { - } - catch (IllegalAccessException iae) //@A2A - { - } - catch (InvocationTargetException iae) //@A2A - { - } - return null; //@A2A - } - - - // JDBC 2.0 - public PreparedStatement prepareStatement (String sql, - int resultSetType, - int resultSetConcurrency) - throws SQLException - { - return actualConnection_.prepareStatement (sql, resultSetType, resultSetConcurrency); - } - - - //@A1A - public PreparedStatement prepareStatement (String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { -//@A2D return actualConnection_.prepareStatement (sql, resultSetType, resultSetConcurrency, resultSetHoldability); - try - { - Method m = actualConnection_.getClass().getDeclaredMethod("prepareStatement", new Class[] { String.class, Integer.TYPE, Integer.TYPE, Integer.TYPE}); //@A2A - return(PreparedStatement)m.invoke(actualConnection_, new Object[] { sql, new Integer(resultSetType), new Integer(resultSetConcurrency), new Integer(resultSetHoldability)}); //@A2A - } - catch (NoSuchMethodException nsme) //@A2A - { - } - catch (IllegalAccessException iae) //@A2A - { - } - catch (InvocationTargetException iae) //@A2A - { - } - return null; //@A2A - } - - - - //@A1A - public PreparedStatement prepareStatement (String sql, String[] columnNames) - throws SQLException - { -//@A2D return actualConnection_.prepareStatement (sql, columnNames); - try - { - Method m = actualConnection_.getClass().getDeclaredMethod("prepareStatement", new Class[] { String.class, columnNames.getClass()}); //@A2A - return(PreparedStatement)m.invoke(actualConnection_, new Object[] { sql, columnNames}); //@A2A - } - catch (NoSuchMethodException nsme) //@A2A - { - } - catch (IllegalAccessException iae) //@A2A - { - } - catch (InvocationTargetException iae) //@A2A - { - } - return null; //@A2A - } - - - - //@A1A - public void releaseSavepoint(Savepoint savepoint) - throws SQLException - { -//@A2D actualConnection_.releaseSavepoint(savepoint); - try - { - Method m = actualConnection_.getClass().getDeclaredMethod("releaseSavepoint", new Class[] { Savepoint.class}); //@A2A - m.invoke(actualConnection_, new Object[] { savepoint}); //@A2A - } - catch (NoSuchMethodException nsme) //@A2A - { - } - catch (IllegalAccessException iae) //@A2A - { - } - catch (InvocationTargetException iae) //@A2A - { - } - } - - - - public void rollback () - throws SQLException - { - actualConnection_.rollback (); - } - - - - //@A1A - public void rollback(Savepoint savepoint) - throws SQLException - { -//@A2D actualConnection_.rollback(savepoint); - try - { - Method m = actualConnection_.getClass().getDeclaredMethod("rollback", new Class[] { Savepoint.class}); //@A2A - m.invoke(actualConnection_, new Object[] { savepoint}); //@A2A - } - catch (NoSuchMethodException nsme) //@A2A - { - } - catch (IllegalAccessException iae) //@A2A - { - } - catch (InvocationTargetException iae) //@A2A - { - } - } - - - - public void setAutoCommit (boolean autoCommit) - throws SQLException - { - actualConnection_.setAutoCommit (autoCommit); - } - - - - public void setCatalog (String catalog) - throws SQLException - { - actualConnection_.setCatalog (catalog); - } - - - //@A1A - public void setHoldability (int holdability) - throws SQLException - { -//@A2D actualConnection_.setHoldability (holdability); - try - { - Method m = actualConnection_.getClass().getDeclaredMethod("setHoldability", new Class[] { Integer.TYPE}); //@A2A - m.invoke(actualConnection_, new Object[] { new Integer(holdability)}); //@A2A - } - catch (NoSuchMethodException nsme) //@A2A - { - } - catch (IllegalAccessException iae) //@A2A - { - } - catch (InvocationTargetException iae) //@A2A - { - } - } - - - - void setProperties (String url, Properties properties) - throws SQLException - { - // Set actualConnection_ to point to an appropriate Connection object - // for the specified database. - actualConnection_ = java.sql.DriverManager.getConnection (url, - properties); - } - - - - public void setReadOnly (boolean readOnly) - throws SQLException - { - actualConnection_.setReadOnly (readOnly); - } - - - - //@A1A - public Savepoint setSavepoint() - throws SQLException - { -//@A2D return actualConnection_.setSavepoint(); - try - { - Method m = actualConnection_.getClass().getDeclaredMethod("setSavepoint", new Class[] {}); //@A2A - return(Savepoint)m.invoke(actualConnection_, new Object[] {}); //@A2A - } - catch (NoSuchMethodException nsme) //@A2A - { - } - catch (IllegalAccessException iae) //@A2A - { - } - catch (InvocationTargetException iae) //@A2A - { - } - return null; //@A2A - } - - - - //@A1A - public Savepoint setSavepoint(String name) - throws SQLException - { -//@A2D return actualConnection_.setSavepoint(name); - try - { - Method m = actualConnection_.getClass().getDeclaredMethod("setSavepoint", new Class[] { String.class}); //@A2A - return(Savepoint)m.invoke(actualConnection_, new Object[] { name}); //@A2A - } - catch (NoSuchMethodException nsme) //@A2A - { - } - catch (IllegalAccessException iae) //@A2A - { - } - catch (InvocationTargetException iae) //@A2A - { - } - return null; //@A2A - } - - - - public void setTransactionIsolation (int level) - throws SQLException - { - actualConnection_.setTransactionIsolation (level); - } - - - - // JDBC 2.0 - public void setTypeMap (Map typeMap) - throws SQLException - { - actualConnection_.setTypeMap (typeMap); - } - - - - // Note - This method is not required by java.sql.Connection, - // but it is used by the JDBC testcases. - public String toString () - { - return actualConnection_.toString (); - } - - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.Connection" }; - } - - - //@PDA jdbc40 - /** - * Returns true if the connection has not been closed and is still valid. - * The driver shall submit a query on the connection or use some other - * mechanism that positively verifies the connection is still valid when - * this method is called. - *

- * The query submitted by the driver to validate the connection shall be - * executed in the context of the current transaction. - * - * @param timeout - The time in seconds to wait for the database operation - * used to validate the connection to complete. If - * the timeout period expires before the operation - * completes, this method returns false. A value of - * 0 indicates a timeout is not applied to the - * database operation. Note that currently the timeout - * value is not used. - *

- * @return true if the connection is valid, false otherwise - * @exception SQLException if a database access error occurs. - */ -/* ifdef JDBC40 */ - public boolean isValid(int timeout) throws SQLException - { - return actualConnection_.isValid(timeout); - } -/* endif */ - - //@PDA jdbc40 - /** - * Sets the value of the client info property specified by name to the - * value specified by value. - *

- * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver - * and the maximum length that may be specified for each property. - *

- * The driver stores the value specified in a suitable location in the - * database. For example in a special register, session parameter, or - * system table column. For efficiency the driver may defer setting the - * value in the database until the next time a statement is executed or - * prepared. Other than storing the client information in the appropriate - * place in the database, these methods shall not alter the behavior of - * the connection in anyway. The values supplied to these methods are - * used for accounting, diagnostics and debugging purposes only. - *

- * The driver shall generate a warning if the client info name specified - * is not recognized by the driver. - *

- * If the value specified to this method is greater than the maximum - * length for the property the driver may either truncate the value and - * generate a warning or generate a SQLException. If the driver - * generates a SQLException, the value specified was not set on the - * connection. - *

- * - * The following client info properties are supported in Toobox for Java. - *

- *

    - *
  • ApplicationName - The name of the application currently utilizing - * the connection
  • - *
  • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
  • - *
  • ClientHostname - The hostname of the computer the application - * using the connection is running on.
  • - *
  • ClientAccounting - Client accounting information.
  • - *
  • ClientProgramID - The client program identification.
  • - *
- *

- * @param name The name of the client info property to set - * @param value The value to set the client info property to. If the - * value is null, the current value of the specified - * property is cleared. - *

- * @throws SQLException if the database server returns an error while - * setting the client info value on the database server. - *

- */ - public void setClientInfo(String name, String value) -/* ifdef JDBC40 */ - throws SQLClientInfoException -/* endif */ -/* ifndef JDBC40 - throws SQLException - endif */ - { - ((AS400JDBCConnection)actualConnection_).setClientInfo(name, value); - } - - // @PDA jdbc40 - /** - * Sets the value of the connection's client info properties. The - * Properties object contains the names and values of the - * client info properties to be set. The set of client info properties - * contained in the properties list replaces the current set of client info - * properties on the connection. If a property that is currently set on the - * connection is not present in the properties list, that property is - * cleared. Specifying an empty properties list will clear all of the - * properties on the connection. See - * setClientInfo (String, String) for more information. - *

- * If an error occurs in setting any of the client info properties, a - * ClientInfoException is thrown. The - * ClientInfoException contains information indicating which - * client info properties were not set. The state of the client information - * is unknown because some databases do not allow multiple client info - * properties to be set atomically. For those databases, one or more - * properties may have been set before the error occurred. - *

- * - * The following client info properties are supported in Toobox for Java. - *

- *

    - *
  • ApplicationName - The name of the application currently utilizing - * the connection
  • - *
  • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
  • - *
  • ClientHostname - The hostname of the computer the application - * using the connection is running on.
  • - *
  • ClientAccounting - Client accounting information.
  • - *
  • ClientProgramID - The client program identification.
  • - *
- *

- * - * @param properties - * the list of client info properties to set - *

- * @throws ClientInfoException - * if the database server returns an error while setting the - * clientInfo values on the database server - *

- * @see java.sql.Connection#setClientInfo(String, String) - * setClientInfo(String, String) - */ - public void setClientInfo(Properties properties) -/* ifdef JDBC40 */ - throws SQLClientInfoException -/* endif */ -/* ifndef JDBC40 - throws SQLException - endif */ - { - ((AS400JDBCConnection)actualConnection_).setClientInfo(properties); - } - - //@PDA jdbc40 - /** - * Returns the value of the client info property specified by name. This - * method may return null if the specified client info property has not - * been set and does not have a default value. This method will also - * return null if the specified client info property name is not supported - * by the driver. - *

- * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver. - *

- * - * The following client info properties are supported in Toobox for Java. - *

- *

    - *
  • ApplicationName - The name of the application currently utilizing - * the connection
  • - *
  • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
  • - *
  • ClientHostname - The hostname of the computer the application - * using the connection is running on.
  • - *
  • ClientAccounting - Client accounting information.
  • - *
  • ClientProgramID - The client program identification.
  • - *
- *

- * @param name The name of the client info property to retrieve - *

- * @return The value of the client info property specified - *

- * @throws SQLException if the database server returns an error when - * fetching the client info value from the database. - *

- * @see java.sql.DatabaseMetaData#getClientInfoProperties - */ - public String getClientInfo(String name) throws SQLException - { - return ((AS400JDBCConnection)actualConnection_).getClientInfo(name); - } - - //@PDA jdbc40 - /** - * Returns a list containing the name and current value of each client info - * property supported by the driver. The value of a client info property - * may be null if the property has not been set and does not have a - * default value. - *

- * - * The following client info properties are supported in Toobox for Java. - *

- *

    - *
  • ApplicationName - The name of the application currently utilizing - * the connection
  • - *
  • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
  • - *
  • ClientHostname - The hostname of the computer the application - * using the connection is running on.
  • - *
  • ClientAccounting - Client accounting information.
  • - *
  • ClientProgramID - The client program identification.
  • - *
- *

- * @return A Properties object that contains the name and current value of - * each of the client info properties supported by the driver. - *

- * @throws SQLException if the database server returns an error when - * fetching the client info values from the database - */ - public Properties getClientInfo() throws SQLException - { - return ((AS400JDBCConnection)actualConnection_).getClientInfo(); - } - - //@PDA jdbc40 - /** - * Constructs an object that implements the Clob interface. The object - * returned initially contains no data. The setAsciiStream, - * setCharacterStream and setString methods of - * the Clob interface may be used to add data to the Clob. - * @return An object that implements the Clob interface - * @throws SQLException if an object that implements the - * Clob interface can not be constructed. - * - */ - public Clob createClob() throws SQLException - { - return ((AS400JDBCConnection)actualConnection_).createClob(); - } - - //@PDA jdbc40 - /** - * Constructs an object that implements the Blob interface. The object - * returned initially contains no data. The setBinaryStream and - * setBytes methods of the Blob interface may be used to add data to - * the Blob. - * @return An object that implements the Blob interface - * @throws SQLException if an object that implements the - * Blob interface can not be constructed - * - */ - public Blob createBlob() throws SQLException - { - return ((AS400JDBCConnection)actualConnection_).createBlob(); - } - - //@PDA jdbc40 - /** - * Constructs an object that implements the NClob interface. The object - * returned initially contains no data. The setAsciiStream, - * setCharacterStream and setString methods of the NClob interface may - * be used to add data to the NClob. - * @return An object that implements the NClob interface - * @throws SQLException if an object that implements the - * NClob interface can not be constructed. - * - */ -/* ifdef JDBC40 */ - public NClob createNClob() throws SQLException - { - return actualConnection_.createNClob(); - } -/* endif */ - //@PDA jdbc40 - /** - * Constructs an object that implements the SQLXML interface. The object - * returned initially contains no data. The createXmlStreamWriter object and - * setString method of the SQLXML interface may be used to add data to the SQLXML - * object. - * @return An object that implements the SQLXML interface - * @throws SQLException if an object that implements the SQLXML interface can not - * be constructed - */ -/* ifdef JDBC40 */ - public SQLXML createSQLXML() throws SQLException - { - return actualConnection_.createSQLXML(); - } -/* endif */ - - - //@PDA jdbc40 - /** - * Factory method for creating Array objects. - * - * @param typeName the SQL name of the type the elements of the array map to. The typeName is a - * database-specific name which may be the name of a built-in type, a user-defined type or a standard SQL type supported by this database. This - * is the value returned by Array.getBaseTypeName - * @param elements the elements that populate the returned object - * @return an Array object whose elements map to the specified SQL type - * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - */ - public Array createArrayOf(String typeName, Object[] elements) throws SQLException - { - return ((AS400JDBCConnection)actualConnection_).createArrayOf(typeName, elements); - } - - //@PDA jdbc40 - /** - * Factory method for creating Struct objects. - * - * @param typeName the SQL type name of the SQL structured type that this Struct - * object maps to. The typeName is the name of a user-defined type that - * has been defined for this database. It is the value returned by - * Struct.getSQLTypeName. - * @param attributes the attributes that populate the returned object - * @return a Struct object that maps to the given SQL type and is populated with the given attributes - * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - */ - public Struct createStruct(String typeName, Object[] attributes) throws SQLException - { - return ((AS400JDBCConnection)actualConnection_).createStruct(typeName, attributes); - } - - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/JDNClobProxy.java b/cvsroot/jdbc40/com/ibm/as400/access/JDNClobProxy.java deleted file mode 100644 index f7cc87664..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/JDNClobProxy.java +++ /dev/null @@ -1,244 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDNClobProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Writer; -import java.io.Reader; -import java.lang.reflect.InvocationTargetException; -import java.sql.Clob; -/* ifdef JDBC40 */ -import java.sql.NClob; -/* endif */ -import java.sql.SQLException; - - -//@PDA jdbc40 new class - -/** -The JDNClobProxy class provides access to character large -objects. The data is valid only within the current -transaction. -**/ -class JDNClobProxy -extends AbstractProxyImpl -/* ifdef JDBC40 */ -implements NClob -/* endif */ -{ - - - // Copied from JDError: - private static final String EXC_FUNCTION_NOT_SUPPORTED = "IM001"; - - - - public InputStream getAsciiStream () - throws SQLException - { - try { - JDInputStreamProxy newStream = new JDInputStreamProxy (); - return (JDInputStreamProxy) connection_.callFactoryMethod ( - pxId_, "getAsciiStream", newStream); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public Reader getCharacterStream () - throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getCharacterStream", - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public String getSubString (long start, int length) - throws SQLException - { - try { - return (String) connection_.callMethod (pxId_, "getSubString", - new Class[] { Long.TYPE, Integer.TYPE }, - new Object[] { new Long (start), - new Integer (length) }) - .getReturnValue(); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public long length () - throws SQLException - { - try { - return connection_.callMethod (pxId_, "length") - .getReturnValueLong (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public long position (String pattern, long start) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "position", - new Class[] { String.class, Long.TYPE }, - new Object[] { pattern, new Long (start) }) - .getReturnValueLong (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public long position (Clob pattern, long start) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "position", - new Class[] { Clob.class, Long.TYPE }, - new Object[] { pattern, new Long (start) }) - .getReturnValueLong (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public OutputStream setAsciiStream (long pos) - throws SQLException - { - try - { - JDOutputStreamProxy newStream = new JDOutputStreamProxy (); - return (JDOutputStreamProxy) connection_.callFactoryMethod (pxId_, "setAsciiStream", - new Class[] { Long.TYPE}, - new Object[] { new Long(pos)}, - newStream); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public Writer setCharacterStream (long pos) - throws SQLException - { - - try - { - JDWriterProxy newWriter = new JDWriterProxy (); - return (JDWriterProxy) connection_.callFactoryMethod (pxId_, "setCharacterStream", - new Class[] { Long.TYPE}, - new Object[] { new Long(pos)}, - newWriter); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public int setString (long pos, String str) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "setString", - new Class[] { Long.TYPE, String.class}, - new Object[] { new Long(pos), str}) - .getReturnValueInt (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public int setString (long pos, String str, int offset, int len) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "setString", - new Class[] { Long.TYPE, String.class, Integer.TYPE, Integer.TYPE}, - new Object[] { new Long(pos), str, new Integer(offset), new Integer(len)}) - .getReturnValueInt (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public void truncate (long len) - throws SQLException - { - try { - connection_.callMethod (pxId_, "truncate", - new Class[] { Long.TYPE,}, - new Object[] { new Long(len)} ); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public void free() throws SQLException - { - try { - connection_.callMethod (pxId_, "free"); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public Reader getCharacterStream(long pos, long length) throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getCharacterStream", - new Class[] { Long.TYPE, Long.TYPE}, - new Object[] { new Long(pos), new Long(length)}, - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/JDParameterMetaDataProxy.java b/cvsroot/jdbc40/com/ibm/as400/access/JDParameterMetaDataProxy.java deleted file mode 100644 index fbfde7cae..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/JDParameterMetaDataProxy.java +++ /dev/null @@ -1,147 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDParameterMetaDataProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.sql.ParameterMetaData; -import java.sql.SQLException; - - - -/** -

The JDParameterMetaDataProxy class gets information about the types and properties of the parameters -in a PreparedStatement object. -**/ -class JDParameterMetaDataProxy -extends AbstractProxyImpl -implements ParameterMetaData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - - // Private data. - - JDConnectionProxy jdConnection_; - // The associated JDBC Connection object. - - - - public JDParameterMetaDataProxy (JDConnectionProxy jdConnection) - { - jdConnection_ = jdConnection; - } - - // Call a method, and return a 'raw' ProxyReturnValue. - private ProxyReturnValue callMethodRtnRaw (String methodName, - int argValue) - throws SQLException - { - try { - return connection_.callMethod (pxId_, methodName, - new Class[] { Integer.TYPE }, - new Object[] { new Integer (argValue) }); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a String. - private String callMethodRtnStr (String methodName, int argValue) - throws SQLException - { - try { - return (String) connection_.callMethod (pxId_, methodName, - new Class[] { Integer.TYPE }, - new Object[] { new Integer (argValue) }) - .getReturnValue (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return an int. - private int callMethodRtnInt (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsInt (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public int getParameterCount() - throws SQLException - { - return callMethodRtnInt("getParameterCount"); - } - - public int isNullable(int param) - throws SQLException - { - return callMethodRtnRaw ("isNullable", param).getReturnValueInt(); - } - - public boolean isSigned(int param) - throws SQLException - { - return callMethodRtnRaw ("isSigned", param).getReturnValueBoolean(); - } - - public int getPrecision(int param) - throws SQLException - { - return callMethodRtnRaw ("getPrecision", param).getReturnValueInt(); - } - - public int getScale(int param) - throws SQLException - { - return callMethodRtnRaw ("getScale", param).getReturnValueInt(); - } - - public int getParameterType(int param) - throws SQLException - { - return callMethodRtnRaw ("getParameterType", param).getReturnValueInt(); - } - - public String getParameterTypeName(int param) - throws SQLException - { - return callMethodRtnStr ("getParameterTypeName", param); - } - - public String getParameterClassName(int param) - throws SQLException - { - return callMethodRtnStr ("getParameterClassName", param); - } - - public int getParameterMode(int param) - throws SQLException - { - return callMethodRtnRaw ("getParameterMode", param).getReturnValueInt(); - } - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.ParameterMetaData" }; - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/JDPreparedStatementProxy.java b/cvsroot/jdbc40/com/ibm/as400/access/JDPreparedStatementProxy.java deleted file mode 100644 index ebcb1c3b0..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/JDPreparedStatementProxy.java +++ /dev/null @@ -1,983 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDPreparedStatementProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.io.InputStream; -import java.io.Reader; -import java.io.Serializable; -import java.math.BigDecimal; -import java.net.URL; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -/* endif */ -import java.sql.ParameterMetaData; -import java.sql.PreparedStatement; -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -/* ifdef JDBC40 */ -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - - - -class JDPreparedStatementProxy -extends JDStatementProxy -implements PreparedStatement -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Copied from JDError: - - - private final static String NOT_SERIALIZABLE = "Parameter is not serializable."; - - - public JDPreparedStatementProxy (JDConnectionProxy jdConnection) - { - super (jdConnection); - } - - -// JDBC 2.0 - public void addBatch () - throws SQLException - { - callMethod ("addBatch"); - } - - - - public void clearParameters () - throws SQLException - { - callMethod ("clearParameters"); - } - - - public boolean execute () - throws SQLException - { - cachedResultSet_ = null; - return callMethodRtnBool ("execute"); - } - - - public ResultSet executeQuery () - throws SQLException - { - cachedResultSet_ = null; - try { - JDResultSetProxy newResultSet = new JDResultSetProxy (jdConnection_, this); - cachedResultSet_ = (JDResultSetProxy) connection_.callFactoryMethod ( - pxId_, "executeQuery", newResultSet); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - return cachedResultSet_; - } - - - - public int executeUpdate () - throws SQLException - { - cachedResultSet_ = null; - return callMethodRtnInt ("executeUpdate"); - } - - - -// JDBC 2.0 - public ResultSetMetaData getMetaData () - throws SQLException - { - try { - JDResultSetMetaDataProxy newMetaData = new JDResultSetMetaDataProxy (jdConnection_); - return (JDResultSetMetaDataProxy) connection_.callFactoryMethod ( - pxId_, "getMetaData", newMetaData); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - -// JDBC 3.0 - public ParameterMetaData getParameterMetaData () - throws SQLException - { - // Avoid dragging in JDError - //@K1D throw new SQLException ( - //@K1D AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - //@K1D EXC_FUNCTION_NOT_SUPPORTED, -99999); - try { //@K1A - JDParameterMetaDataProxy newMetaData = new JDParameterMetaDataProxy (jdConnection_); - return (JDParameterMetaDataProxy) connection_.callFactoryMethod (pxId_, "getParameterMetaData", newMetaData); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - -// JDBC 2.0 - public void setArray (int parameterIndex, Array parameterValue) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setArray", - new Class[] { Integer.TYPE, Array.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - - public void setAsciiStream (int parameterIndex, - InputStream parameterValue, - int length) - throws SQLException - { - InputStream iStream; - if (parameterValue == null || - parameterValue instanceof Serializable) - iStream = parameterValue; - else { - try { - iStream = new SerializableInputStream (parameterValue); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setAsciiStream", - new Class[] { Integer.TYPE, InputStream.class, - Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - iStream, - new Integer (length) }); - } - - - - public void setBigDecimal (int parameterIndex, BigDecimal parameterValue) - throws SQLException - { - callMethod ("setBigDecimal", - new Class[] { Integer.TYPE, BigDecimal.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - - public void setBinaryStream (int parameterIndex, - InputStream parameterValue, - int length) - throws SQLException - { - InputStream iStream; - if (parameterValue == null || - parameterValue instanceof Serializable) - iStream = parameterValue; - else { - try { - iStream = new SerializableInputStream (parameterValue); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBinaryStream", - new Class[] { Integer.TYPE, InputStream.class, - Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - iStream, - new Integer (length) }); - } - - - -// JDBC 2.0 - public void setBlob (int parameterIndex, Blob parameterValue) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setBlob", - new Class[] { Integer.TYPE, Blob.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - - public void setBoolean (int parameterIndex, boolean parameterValue) - throws SQLException - { - callMethod ("setBoolean", - new Class[] { Integer.TYPE, Boolean.TYPE }, - new Object[] { new Integer (parameterIndex), - new Boolean (parameterValue) }); - } - - - - public void setByte (int parameterIndex, byte parameterValue) - throws SQLException - { - callMethod ("setByte", - new Class[] { Integer.TYPE, Byte.TYPE }, - new Object[] { new Integer (parameterIndex), - new Byte (parameterValue) }); - } - - - - public void setBytes (int parameterIndex, byte[] parameterValue) - throws SQLException - { - callMethod ("setBytes", - new Class[] { Integer.TYPE, byte[].class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - -// JDBC 2.0 - public void setCharacterStream (int parameterIndex, - Reader parameterValue, - int length) - throws SQLException - { - try { - SerializableReader reader; - if (parameterValue == null) - reader = null; - else - reader = new SerializableReader (parameterValue, Math.max(0,length)); - callMethod ("setCharacterStream", - new Class[] { Integer.TYPE, Reader.class, - Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - reader, - new Integer (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - -// JDBC 2.0 - public void setClob (int parameterIndex, Clob parameterValue) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setClob", - new Class[] { Integer.TYPE, Clob.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - - public void setDate (int parameterIndex, Date parameterValue) - throws SQLException - { - callMethod ("setDate", - new Class[] { Integer.TYPE, Date.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - -// JDBC 2.0 - public void setDate (int parameterIndex, - Date parameterValue, - Calendar calendar) - throws SQLException - { - callMethod ("setDate", - new Class[] { Integer.TYPE, Date.class, - Calendar.class }, - new Object[] { new Integer (parameterIndex), - parameterValue, - calendar }); - } - - - - public void setDouble (int parameterIndex, double parameterValue) - throws SQLException - { - callMethod ("setDouble", - new Class[] { Integer.TYPE, Double.TYPE }, - new Object[] { new Integer (parameterIndex), - new Double (parameterValue) }); - } - - - - public void setFloat (int parameterIndex, float parameterValue) - throws SQLException - { - callMethod ("setFloat", - new Class[] { Integer.TYPE, Float.TYPE }, - new Object[] { new Integer (parameterIndex), - new Float (parameterValue) }); - } - - - - public void setInt (int parameterIndex, int parameterValue) - throws SQLException - { - callMethod ("setInt", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - new Integer (parameterValue) }); - } - - - - public void setLong (int parameterIndex, long parameterValue) - throws SQLException - { - callMethod ("setLong", - new Class[] { Integer.TYPE, Long.TYPE }, - new Object[] { new Integer (parameterIndex), - new Long (parameterValue) }); - } - - - - public void setNull (int parameterIndex, int sqlType) - throws SQLException - { - callMethod ("setNull", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - new Integer (sqlType) }); - } - - - public void setNull (int parameterIndex, int sqlType, String typeName) - throws SQLException - { - callMethod ("setNull", - new Class[] { Integer.TYPE, Integer.TYPE, - String.class }, - new Object[] { new Integer (parameterIndex), - new Integer (sqlType), - typeName}); - } - - public void setObject (int parameterIndex, Object parameterValue) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setObject", - new Class[] { Integer.TYPE, Object.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - - public void setObject (int parameterIndex, - Object parameterValue, - int sqlType) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setObject", - new Class[] { Integer.TYPE, Object.class, - Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - parameterValue, - new Integer (sqlType) }); - } - - - - public void setObject (int parameterIndex, - Object parameterValue, - int sqlType, - int scale) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setObject", - new Class[] { Integer.TYPE, Object.class, - Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - parameterValue, - new Integer (sqlType), - new Integer (scale) }); - } - - - -// JDBC 2.0 - public void setRef (int parameterIndex, Ref parameterValue) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setRef", - new Class[] { Integer.TYPE, Ref.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - - public void setShort (int parameterIndex, short parameterValue) - throws SQLException - { - callMethod ("setShort", - new Class[] { Integer.TYPE, Short.TYPE }, - new Object[] { new Integer (parameterIndex), - new Short (parameterValue) }); - } - - - - public void setString (int parameterIndex, String parameterValue) - throws SQLException - { - callMethod ("setString", - new Class[] { Integer.TYPE, String.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - - public void setTime (int parameterIndex, Time parameterValue) - throws SQLException - { - callMethod ("setTime", - new Class[] { Integer.TYPE, Time.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - -// JDBC 2.0 - public void setTime (int parameterIndex, - Time parameterValue, - Calendar calendar) - throws SQLException - { - callMethod ("setTime", - new Class[] { Integer.TYPE, Time.class, - Calendar.class }, - new Object[] { new Integer (parameterIndex), - parameterValue, calendar }); - } - - - - public void setTimestamp (int parameterIndex, Timestamp parameterValue) - throws SQLException - { - callMethod ("setTimestamp", - new Class[] { Integer.TYPE, Timestamp.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - -// JDBC 2.0 - public void setTimestamp (int parameterIndex, - Timestamp parameterValue, - Calendar calendar) - throws SQLException - { - callMethod ("setTimestamp", - new Class[] { Integer.TYPE, Timestamp.class, - Calendar.class }, - new Object[] { new Integer (parameterIndex), - parameterValue, calendar }); - } - - - -/** -@exception SQLException If a SQL error occurs. -@deprecated Use setCharacterStream(int, Reader, int) instead. -@see #setCharacterStream -**/ - public void setUnicodeStream (int parameterIndex, - InputStream parameterValue, - int length) - throws SQLException - { - InputStream iStream; - if (parameterValue == null || - parameterValue instanceof Serializable) - iStream = parameterValue; - else { - try { - iStream = new SerializableInputStream (parameterValue); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setUnicodeStream", - new Class[] { Integer.TYPE, InputStream.class, - Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - iStream, - new Integer (length) }); - } - - -// JDBC 3.0 - public void setURL (int parameterIndex, - URL parameterValue) - throws SQLException - { - callMethod ("setURL", - new Class[] { Integer.TYPE, URL.class}, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - -/* ifdef JDBC40 */ - //@PDA jdbc40 - public void setRowId(int parameterIndex, RowId x) throws SQLException - { - callMethod ("setRowId", - new Class[] { Integer.TYPE, RowId.class}, - new Object[] { new Integer (parameterIndex), x }); - } -/* endif */ - - //@PDA jdbc40 - public void setNString(int parameterIndex, String value) throws SQLException - { - callMethod ("setNString", - new Class[] { Integer.TYPE, String.class }, - new Object[] { new Integer (parameterIndex), value }); - } - - //@PDA jdbc40 - public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException - { - try { - SerializableReader reader; - if (value == null) - reader = null; - else - reader = new SerializableReader (value, (int) Math.max(0,length)); - callMethod ("setNCharacterStream", - new Class[] { Integer.TYPE, Reader.class, - Long.TYPE }, - new Object[] { new Integer (parameterIndex), - reader, - new Long(length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 -/* ifdef JDBC40 */ - public void setNClob(int parameterIndex, NClob value) throws SQLException - { - if (value != null && - !(value instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setNClob", - new Class[] { Integer.TYPE, NClob.class }, - new Object[] { new Integer (parameterIndex), - value }); - } -/* endif */ - - //@PDA jdbc40 - public void setClob(int parameterIndex, Reader reader, long length) throws SQLException - { - try { - SerializableReader serialRreader; - if (reader == null) - serialRreader = null; - else - serialRreader = new SerializableReader (reader, (int) Math.max(0,length)); - callMethod ("setClob", - new Class[] { Integer.TYPE, Reader.class, - Long.TYPE }, - new Object[] { new Integer (parameterIndex), - serialRreader, - new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException - { - InputStream iStream; - if (inputStream == null || - inputStream instanceof Serializable) - iStream = inputStream; - else { - try { - iStream = new SerializableInputStream (inputStream); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBlob", - new Class[] { Integer.TYPE, InputStream.class, - Long.TYPE }, - new Object[] { new Integer (parameterIndex), - iStream, - new Long (length) }); - } - - //@PDA jdbc40 - public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException - { - try { - SerializableReader serialRreader; - if (reader == null) - serialRreader = null; - else - serialRreader = new SerializableReader (reader, (int) Math.max(0,length)); - callMethod ("setNClob", - new Class[] { Integer.TYPE, Reader.class, - Long.TYPE }, - new Object[] { new Integer (parameterIndex), - serialRreader, - new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 -/* ifdef JDBC40 */ - public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException - { - if (xmlObject != null && - !(xmlObject instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setSQLXML", - new Class[] { Integer.TYPE, SQLXML.class }, - new Object[] { new Integer (parameterIndex), - xmlObject }); - } -/* endif */ - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.PreparedStatement" }; - } - - - //@PDA jdbc40 - public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException - { - InputStream iStream; - if (x == null || - x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setAsciiStream", - new Class[] { Integer.TYPE, InputStream.class, - Long.TYPE }, - new Object[] { new Integer (parameterIndex), - iStream, - new Long (length) }); - } - - //@PDA jdbc40 - public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException - { - InputStream iStream; - if (x == null || - x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBinaryStream", - new Class[] { Integer.TYPE, InputStream.class, - Long.TYPE }, - new Object[] { new Integer (parameterIndex), - iStream, - new Long (length) }); - } - - //@PDA jdbc40 - public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException - { - try { - SerializableReader serialReader; - if (reader == null) - serialReader = null; - else - serialReader = new SerializableReader (reader, (int)Math.max(0,length)); - callMethod ("setCharacterStream", - new Class[] { Integer.TYPE, Reader.class, - Long.TYPE }, - new Object[] { new Integer (parameterIndex), - serialReader, - new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException - { - InputStream iStream; - if (x == null || - x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setAsciiStream", - new Class[] { Integer.TYPE, InputStream.class }, - new Object[] { new Integer (parameterIndex), - iStream }); - } - - - //@PDA jdbc40 - public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException - { - InputStream iStream; - if (x == null || - x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBinaryStream", - new Class[] { Integer.TYPE, InputStream.class }, - new Object[] { new Integer (parameterIndex), - iStream }); - } - - - //@PDA jdbc40 - public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException - { - InputStream iStream; - if (inputStream == null || - inputStream instanceof Serializable) - iStream = inputStream; - else { - try { - iStream = new SerializableInputStream (inputStream); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBlob", - new Class[] { Integer.TYPE, InputStream.class }, - new Object[] { new Integer (parameterIndex), - iStream }); - } - - - //@PDA jdbc40 - public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException - { - try { - SerializableReader serialReader; - if (reader == null) - serialReader = null; - else - serialReader = new SerializableReader (reader); - callMethod ("setCharacterStream", - new Class[] { Integer.TYPE, Reader.class }, - new Object[] { new Integer (parameterIndex), - serialReader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - //@PDA jdbc40 - public void setClob(int parameterIndex, Reader reader) throws SQLException - { - try { - SerializableReader serialReader; - if (reader == null) - serialReader = null; - else - serialReader = new SerializableReader (reader); - callMethod ("setClob", - new Class[] { Integer.TYPE, Reader.class }, - new Object[] { new Integer (parameterIndex), - serialReader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - //@PDA jdbc40 - public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException - { - try { - SerializableReader serialReader; - if (value == null) - serialReader = null; - else - serialReader = new SerializableReader (value); - callMethod ("setNCharacterStream", - new Class[] { Integer.TYPE, Reader.class }, - new Object[] { new Integer (parameterIndex), - serialReader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - //@PDA jdbc40 - public void setNClob(int parameterIndex, Reader reader) throws SQLException - { - try { - SerializableReader serialReader; - if (reader == null) - serialReader = null; - else - serialReader = new SerializableReader (reader); - callMethod ("setNClob", - new Class[] { Integer.TYPE, Reader.class }, - new Object[] { new Integer (parameterIndex), - serialReader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/JDResultSetMetaDataProxy.java b/cvsroot/jdbc40/com/ibm/as400/access/JDResultSetMetaDataProxy.java deleted file mode 100644 index 574cf3c6f..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/JDResultSetMetaDataProxy.java +++ /dev/null @@ -1,261 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDResultSetMetaDataProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; - - - -/** -

The JDResultSetMetaDataProxy class describes the -columns in a result set. -**/ -class JDResultSetMetaDataProxy -extends AbstractProxyImpl -implements ResultSetMetaData -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Private data. - - JDConnectionProxy jdConnection_; - // The associated JDBC Connection object. - - - - public JDResultSetMetaDataProxy (JDConnectionProxy jdConnection) - { - jdConnection_ = jdConnection; - } - - // Call a method, and return a 'raw' ProxyReturnValue. - private ProxyReturnValue callMethodRtnRaw (String methodName, - int argValue) - throws SQLException - { - try { - return connection_.callMethod (pxId_, methodName, - new Class[] { Integer.TYPE }, - new Object[] { new Integer (argValue) }); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a String. - private String callMethodRtnStr (String methodName, int argValue) - throws SQLException - { - try { - return (String) connection_.callMethod (pxId_, methodName, - new Class[] { Integer.TYPE }, - new Object[] { new Integer (argValue) }) - .getReturnValue (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public String getCatalogName (int columnIndex) - throws SQLException - { - return callMethodRtnStr ("getCatalogName", columnIndex); - } - - -// JDBC 2.0 - public String getColumnClassName (int columnIndex) - throws SQLException - { - return callMethodRtnStr ("getColumnClassName", columnIndex); - } - - - public int getColumnCount () - throws SQLException - { - try { - return connection_.callMethodReturnsInt (pxId_, "getColumnCount"); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public int getColumnDisplaySize (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getColumnDisplaySize", columnIndex) - .getReturnValueInt (); - } - - public String getColumnLabel (int columnIndex) - throws SQLException - { - return callMethodRtnStr ("getColumnLabel", columnIndex); - } - - - public String getColumnName (int columnIndex) - throws SQLException - { - return callMethodRtnStr ("getColumnName", columnIndex); - } - - - public int getColumnType (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getColumnType", columnIndex) - .getReturnValueInt (); - } - - - public String getColumnTypeName (int columnIndex) - throws SQLException - { - return callMethodRtnStr ("getColumnTypeName", columnIndex); - } - - - public int getPrecision (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getPrecision", columnIndex) - .getReturnValueInt (); - } - - - public int getScale (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getScale", columnIndex) - .getReturnValueInt (); - } - - - public String getSchemaName (int columnIndex) - throws SQLException - { - return callMethodRtnStr ("getSchemaName", columnIndex); - } - - - public String getTableName (int columnIndex) - throws SQLException - { - return callMethodRtnStr ("getTableName", columnIndex); - } - - - public boolean isAutoIncrement (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isAutoIncrement", columnIndex) - .getReturnValueBoolean (); - } - - - public boolean isCaseSensitive (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isCaseSensitive", columnIndex) - .getReturnValueBoolean (); - } - - - public boolean isCurrency (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isCurrency", columnIndex) - .getReturnValueBoolean (); - } - - - public boolean isDefinitelyWritable (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isDefinitelyWritable", columnIndex) - .getReturnValueBoolean (); - } - - - public int isNullable (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isNullable", columnIndex) - .getReturnValueInt (); - } - - - public boolean isReadOnly (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isReadOnly", columnIndex) - .getReturnValueBoolean (); - } - - - public boolean isSearchable (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isSearchable", columnIndex) - .getReturnValueBoolean (); - } - - - public boolean isSigned (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isSigned", columnIndex) - .getReturnValueBoolean (); - } - - - public boolean isWritable (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isWritable", columnIndex) - .getReturnValueBoolean (); - } - - - // This method is not required by java.sql.ResultSetMetaData, - // but it is used by the JDBC testcases, and is implemented - // in the public class. - public String toString () - { - try { - return (String) connection_.callMethodReturnsObject (pxId_, - "toString"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.ResultSetMetaData" }; //@pdc user cannot cast to AS400JDBCResultSetMetaData - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/JDResultSetProxy.java b/cvsroot/jdbc40/com/ibm/as400/access/JDResultSetProxy.java deleted file mode 100644 index e5bb00fce..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/JDResultSetProxy.java +++ /dev/null @@ -1,2441 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDResultSetProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.io.Serializable; -import java.lang.reflect.InvocationTargetException; -import java.math.BigDecimal; -import java.net.URL; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -/* endif */ -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -/* ifdef JDBC40 */ -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -import java.sql.SQLWarning; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Statement; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.util.Map; - - -class JDResultSetProxy -extends AbstractProxyImpl -implements ResultSet -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Private data. - - private JDConnectionProxy jdConnection_; - // The object that caused this object to be created. - - private JDStatementProxy cachedStatement_; - - private final static String NOT_SERIALIZABLE = "Parameter is not serializable."; - - -/*---------------------------------------------------------*/ -/* */ -/* MISCELLANEOUS METHODS. */ -/* */ -/*---------------------------------------------------------*/ - - - public JDResultSetProxy (JDConnectionProxy jdConnection) - { - jdConnection_ = jdConnection; - } - - - public JDResultSetProxy (JDConnectionProxy jdConnection, - JDStatementProxy statement) - { - jdConnection_ = jdConnection; - cachedStatement_ = statement; - } - - - // Call a method. No return value is expected. - private void callMethod (String methodName) - throws SQLException - { - try { - connection_.callMethod (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - private void callMethod (String methodName, - Class[] argClasses, - Object[] argValues) - throws SQLException - { - try { - connection_.callMethod (pxId_, methodName, argClasses, argValues); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a boolean. - private boolean callMethodRtnBool (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsBoolean (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - private JDInputStreamProxy callMethodRtnInpStrm (String methodName, - int argValue) - throws SQLException - { - try { - JDInputStreamProxy newStream = new JDInputStreamProxy (); - return (JDInputStreamProxy) connection_.callFactoryMethod ( - pxId_, methodName, - new Class[] { Integer.TYPE }, - new Object[] { new Integer (argValue) }, - newStream); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return an int. - private int callMethodRtnInt (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsInt (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return an Object. - private Object callMethodRtnObj (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsObject (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - private Object callMethodRtnObj (String methodName, - Class[] argClasses, - Object[] argValues) - throws SQLException - { - try { - return connection_.callMethod (pxId_, methodName, - argClasses, argValues) - .getReturnValue(); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a 'raw' ProxyReturnValue. - private ProxyReturnValue callMethodRtnRaw (String methodName, - Class[] argClasses, - Object[] argValues) - throws SQLException - { - try { - return connection_.callMethod (pxId_, methodName, - argClasses, argValues); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public void clearWarnings () - throws SQLException - { - callMethod ("clearWarnings"); - } - - - - public void close () - throws SQLException - { - callMethod ("close"); - } - - - - public int findColumn (String columnName) - throws SQLException - { - return callMethodRtnRaw ("findColumn", - new Class[] { String.class }, - new Object[] { columnName }) - .getReturnValueInt(); - } - - - -// JDBC 2.0 - public int getConcurrency () - throws SQLException - { - return callMethodRtnInt ("getConcurrency"); - } - - - public String getCursorName () - throws SQLException - { - return (String) callMethodRtnObj ("getCursorName"); - } - - - -// JDBC 2.0 - public int getFetchDirection () - throws SQLException - { - return callMethodRtnInt ("getFetchDirection"); - } - - - -// JDBC 2.0 - public int getFetchSize () - throws SQLException - { - return callMethodRtnInt ("getFetchSize"); - } - - - -// JDBC 2.0 - public Statement getStatement () - throws SQLException - { - if (cachedStatement_ == null) - { - try { - JDStatementProxy newStatement = new JDStatementProxy (jdConnection_); - cachedStatement_ = (JDStatementProxy) connection_.callFactoryMethod ( - pxId_, "getStatement", newStatement); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - return cachedStatement_; - } - - - -// JDBC 2.0 - public int getType () - throws SQLException - { - return callMethodRtnInt ("getType"); - } - - - - public SQLWarning getWarnings () - throws SQLException - { - return (SQLWarning) callMethodRtnObj ("getWarnings"); - } - - - -// JDBC 2.0 - public void setFetchDirection (int fetchDirection) - throws SQLException - { - callMethod ("setFetchDirection", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (fetchDirection) }); - } - - - -// JDBC 2.0 - public void setFetchSize (int fetchSize) - throws SQLException - { - callMethod ("setFetchSize", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (fetchSize) }); - } - - - // This method is not required by java.sql.ResultSet, - // but it is used by the JDBC testcases, and is implemented - // in the public class. - public String toString () - { - try { - return (String) connection_.callMethodReturnsObject (pxId_, "toString"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - - -/*---------------------------------------------------------*/ -/* */ -/* CURSOR POSITIONING. */ -/* */ -/*---------------------------------------------------------*/ - - - -// JDBC 2.0 - public boolean absolute (int rowNumber) - throws SQLException - { - return callMethodRtnRaw ("absolute", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (rowNumber) }) - .getReturnValueBoolean(); - } - - - -// JDBC 2.0 - public void afterLast () - throws SQLException - { - callMethod ("afterLast"); - } - - - -// JDBC 2.0 - public void beforeFirst () - throws SQLException - { - callMethod ("beforeFirst"); - } - - - -// JDBC 2.0 - public boolean first () - throws SQLException - { - return callMethodRtnBool ("first"); - } - - - -// JDBC 2.0 - public int getRow () - throws SQLException - { - return callMethodRtnInt ("getRow"); - } - - - -// JDBC 2.0 - public boolean isAfterLast () - throws SQLException - { - return callMethodRtnBool ("isAfterLast"); - } - - - -// JDBC 2.0 - public boolean isBeforeFirst () - throws SQLException - { - return callMethodRtnBool ("isBeforeFirst"); - } - - - -// JDBC 2.0 - public boolean isFirst () - throws SQLException - { - return callMethodRtnBool ("isFirst"); - } - - - -// JDBC 2.0 - public boolean isLast () - throws SQLException - { - return callMethodRtnBool ("isLast"); - } - - - -// JDBC 2.0 - public boolean last () - throws SQLException - { - return callMethodRtnBool ("last"); - } - - - -// JDBC 2.0 - public void moveToCurrentRow () - throws SQLException - { - callMethod ("moveToCurrentRow"); - } - - - -// JDBC 2.0 - public void moveToInsertRow () - throws SQLException - { - callMethod ("moveToInsertRow"); - } - - - - public boolean next () - throws SQLException - { - return callMethodRtnBool ("next"); - } - - - -// JDBC 2.0 - public boolean previous () - throws SQLException - { - return callMethodRtnBool ("previous"); - } - - -// JDBC 2.0 - public void refreshRow () - throws SQLException - { - callMethod ("refreshRow"); - } - - - -// JDBC 2.0 - public boolean relative (int rowNumber) - throws SQLException - { - return callMethodRtnRaw ("relative", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (rowNumber) }) - .getReturnValueBoolean(); - } - - - -/*---------------------------------------------------------*/ -/* */ -/* GET DATA METHODS. */ -/* */ -/*---------------------------------------------------------*/ - - - -// JDBC 2.0 - public Array getArray (int columnIndex) - throws SQLException - { - return (Array) callMethodRtnObj ("getArray", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }); - } - - - -// JDBC 2.0 - public Array getArray (String columnName) - throws SQLException - { - return getArray (findColumn (columnName)); - } - - - - public InputStream getAsciiStream (int columnIndex) - throws SQLException - { - return callMethodRtnInpStrm ("getAsciiStream", columnIndex); - } - - - - public InputStream getAsciiStream (String columnName) - throws SQLException - { - return getAsciiStream (findColumn (columnName)); - } - - - -// JDBC 2.0 - public BigDecimal getBigDecimal (int columnIndex) - throws SQLException - { - return (BigDecimal) callMethodRtnObj ("getBigDecimal", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }); - } - - - -// JDBC 2.0 - public BigDecimal getBigDecimal (String columnName) - throws SQLException - { - return getBigDecimal (findColumn (columnName)); - } - - - -/** -@exception SQLException If a SQL error occurs. -@deprecated Use getBigDecimal(int) instead. -@see #getBigDecimal(int) -**/ - public BigDecimal getBigDecimal (int columnIndex, int scale) - throws SQLException - { - return (BigDecimal) callMethodRtnObj ("getBigDecimal", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer (columnIndex), - new Integer (scale) }); - } - - - -/** -@exception SQLException If a SQL error occurs. -@deprecated Use getBigDecimal(String) instead. -@see #getBigDecimal(String) -**/ - public BigDecimal getBigDecimal (String columnName, int scale) - throws SQLException - { - return getBigDecimal (findColumn (columnName), scale); - } - - - - public InputStream getBinaryStream (int columnIndex) - throws SQLException - { - return callMethodRtnInpStrm ("getBinaryStream", columnIndex); - } - - - - public InputStream getBinaryStream (String columnName) - throws SQLException - { - return getBinaryStream (findColumn (columnName)); - } - - - -// JDBC 2.0 - public Blob getBlob (int columnIndex) - throws SQLException - { - try { - JDBlobProxy newBlob = new JDBlobProxy (); - return (JDBlobProxy) connection_.callFactoryMethod (pxId_, - "getBlob", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(columnIndex) }, - newBlob); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - -// JDBC 2.0 - public Blob getBlob (String columnName) - throws SQLException - { - return getBlob (findColumn (columnName)); - } - - - - public boolean getBoolean (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getBoolean", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }) - .getReturnValueBoolean(); - } - - - - public boolean getBoolean (String columnName) - throws SQLException - { - return getBoolean (findColumn (columnName)); - } - - - - public byte getByte (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getByte", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }) - .getReturnValueByte(); - } - - - - public byte getByte (String columnName) - throws SQLException - { - return getByte (findColumn (columnName)); - } - - - - public byte[] getBytes (int columnIndex) - throws SQLException - { - return (byte[]) callMethodRtnObj ("getBytes", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }); - } - - - - public byte[] getBytes (String columnName) - throws SQLException - { - return getBytes (findColumn (columnName)); - } - - - -// JDBC 2.0 - public Reader getCharacterStream (int columnIndex) - throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getCharacterStream", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }, - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - -// JDBC 2.0 - public Reader getCharacterStream (String columnName) - throws SQLException - { - return getCharacterStream (findColumn (columnName)); - } - - - -// JDBC 2.0 - public Clob getClob (int columnIndex) - throws SQLException - { - try { - JDClobProxy newClob = new JDClobProxy (); - return (JDClobProxy) connection_.callFactoryMethod (pxId_, - "getClob", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(columnIndex) }, - newClob); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - -// JDBC 2.0 - public Clob getClob (String columnName) - throws SQLException - { - return getClob (findColumn (columnName)); - } - - - - public Date getDate (int columnIndex) - throws SQLException - { - return (Date) callMethodRtnObj ("getDate", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }); - } - - - - public Date getDate (String columnName) - throws SQLException - { - return (Date) callMethodRtnObj ("getDate", - new Class[] { String.class }, - new Object[] { columnName }); - } - - - -// JDBC 2.0 - public Date getDate (int columnIndex, Calendar calendar) - throws SQLException - { - return (Date) callMethodRtnObj ("getDate", - new Class[] { Integer.TYPE, Calendar.class }, - new Object[] { new Integer (columnIndex), - calendar }); - } - - - -// JDBC 2.0 - public Date getDate (String columnName, Calendar calendar) - throws SQLException - { - return getDate (findColumn (columnName), calendar); - } - - - - public double getDouble (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getDouble", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }) - .getReturnValueDouble(); - } - - - - public double getDouble (String columnName) - throws SQLException - { - return getDouble (findColumn (columnName)); - } - - - - public float getFloat (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getFloat", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }) - .getReturnValueFloat(); - } - - - - public float getFloat (String columnName) - throws SQLException - { - return getFloat (findColumn (columnName)); - } - - - - public int getInt (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getInt", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }) - .getReturnValueInt(); - } - - - - public int getInt (String columnName) - throws SQLException - { - return getInt (findColumn (columnName)); - } - - - - public long getLong (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getLong", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }) - .getReturnValueLong(); - } - - - - public long getLong (String columnName) - throws SQLException - { - return getLong (findColumn (columnName)); - } - - - - public ResultSetMetaData getMetaData () - throws SQLException - { - try { - JDResultSetMetaDataProxy newMetaData = new JDResultSetMetaDataProxy (jdConnection_); - return (JDResultSetMetaDataProxy) connection_.callFactoryMethod ( - pxId_, "getMetaData", newMetaData); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public Object getObject (int columnIndex) - throws SQLException - { - String typeName = getMetaData().getColumnTypeName(columnIndex); - ProxyFactoryImpl proxyObject = null; - try - { - if (typeName.equalsIgnoreCase("BLOB")) { - proxyObject = new JDBlobProxy (); - } - else if (typeName.equalsIgnoreCase("CLOB")) { - proxyObject = new JDClobProxy (); - } - else - return callMethodRtnObj ("getObject", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }); - - return connection_.callFactoryMethod (pxId_, "getObject", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }, - proxyObject); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public Object getObject (String columnName) - throws SQLException - { - return getObject (findColumn (columnName)); - } - - - -// JDBC 2.0 - public Object getObject (int columnIndex, Map typeMap) - throws SQLException - { - String typeName = getMetaData().getColumnTypeName(columnIndex); - ProxyFactoryImpl proxyObject = null; - try - { - if (typeName.equalsIgnoreCase("BLOB")) { - proxyObject = new JDBlobProxy (); - } - else if (typeName.equalsIgnoreCase("CLOB")) { - proxyObject = new JDClobProxy (); - } - else - return callMethodRtnObj ("getObject", - new Class[] { Integer.TYPE, Map.class }, - new Object[] { new Integer (columnIndex), - typeMap }); - - return connection_.callFactoryMethod (pxId_, "getObject", - new Class[] { Integer.TYPE, Map.class }, - new Object[] { new Integer (columnIndex), - typeMap }, - proxyObject); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - -// JDBC 2.0 - public Object getObject (String columnName, Map typeMap) - throws SQLException - { - return getObject (findColumn (columnName), typeMap); - } - - - -// JDBC 2.0 - public Ref getRef (int columnIndex) - throws SQLException - { - return (Ref) callMethodRtnObj ("getRef", - new Class[] { Integer.TYPE}, - new Object[] { new Integer (columnIndex) }); - } - - - -// JDBC 2.0 - public Ref getRef (String columnName) - throws SQLException - { - return getRef (findColumn (columnName)); - } - - - - public short getShort (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getShort", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }) - .getReturnValueShort(); - } - - - - public short getShort (String columnName) - throws SQLException - { - return getShort (findColumn (columnName)); - } - - - - public String getString (int columnIndex) - throws SQLException - { - return (String) callMethodRtnObj ("getString", - new Class[] { Integer.TYPE}, - new Object[] { new Integer (columnIndex) }); - } - - - - public String getString (String columnName) - throws SQLException - { - return getString (findColumn (columnName)); - } - - - - public Time getTime (int columnIndex) - throws SQLException - { - return (Time) callMethodRtnObj ("getTime", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }); - } - - - - public Time getTime (String columnName) - throws SQLException - { - return getTime (findColumn (columnName)); - } - - - -// JDBC 2.0 - public Time getTime (int columnIndex, Calendar calendar) - throws SQLException - { - return (Time) callMethodRtnObj ("getTime", - new Class[] { Integer.TYPE, Calendar.class }, - new Object[] { new Integer (columnIndex), - calendar }); - } - - - -// JDBC 2.0 - public Time getTime (String columnName, Calendar calendar) - throws SQLException - { - return getTime (findColumn (columnName), calendar); - } - - - - public Timestamp getTimestamp (int columnIndex) - throws SQLException - { - return (Timestamp) callMethodRtnObj ("getTimestamp", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }); - } - - - - public Timestamp getTimestamp (String columnName) - throws SQLException - { - return getTimestamp (findColumn (columnName)); - } - - - -// JDBC 2.0 - public Timestamp getTimestamp (int columnIndex, Calendar calendar) - throws SQLException - { - return (Timestamp) callMethodRtnObj ("getTimestamp", - new Class[] { Integer.TYPE, Calendar.class }, - new Object[] { new Integer (columnIndex), - calendar }); - } - - - -// JDBC 2.0 - public Timestamp getTimestamp (String columnName, Calendar calendar) - throws SQLException - { - return getTimestamp (findColumn (columnName), calendar); - } - - - -/** -@exception SQLException If a SQL error occurs. -@deprecated Use getCharacterStream(int) instead. -@see #getCharacterStream(int) -**/ - public InputStream getUnicodeStream (int columnIndex) - throws SQLException - { - return callMethodRtnInpStrm ("getUnicodeStream", columnIndex); - } - - - -/** -@exception SQLException If a SQL error occurs. -@deprecated Use getCharacterStream(String) instead. -@see #getCharacterStream(String) -**/ - public InputStream getUnicodeStream (String columnName) - throws SQLException - { - return getUnicodeStream (findColumn (columnName)); - } - - - -// JDBC 3.0 - public URL getURL (int columnIndex) - throws SQLException - { - return(URL) callMethodRtnObj ("getURL", - new Class[] { Integer.TYPE}, - new Object[] { new Integer(columnIndex)}); - } - - - -// JDBC 3.0 - public URL getURL (String columnName) - throws SQLException - { - return(URL) callMethodRtnObj ("getURL", - new Class[] { String.class}, - new Object[] { columnName}); - } - - - - public boolean wasNull () - throws SQLException - { - return callMethodRtnBool ("wasNull"); - } - - - -/*---------------------------------------------------------*/ -/* */ -/* UPDATE DATA METHODS. */ -/* */ -/*---------------------------------------------------------*/ - - - -// JDBC 2.0 - public void cancelRowUpdates () - throws SQLException - { - callMethod ("cancelRowUpdates"); - } - - - -// JDBC 2.0 - public void deleteRow () - throws SQLException - { - callMethod ("deleteRow"); - } - - - -// JDBC 2.0 - public void insertRow () - throws SQLException - { - callMethod ("insertRow"); - } - - - -// JDBC 2.0 - public boolean rowDeleted () - throws SQLException - { - return callMethodRtnBool ("rowDeleted"); - } - - - -// JDBC 2.0 - public boolean rowInserted () - throws SQLException - { - return callMethodRtnBool ("rowInserted"); - } - - - -// JDBC 2.0 - public boolean rowUpdated () - throws SQLException - { - return callMethodRtnBool ("rowUpdated"); - } - - - -// JDBC 3.0 - public void updateArray (int columnIndex, Array columnValue) - throws SQLException - { - if (columnValue != null && - !(columnValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("updateArray", - new Class[] { Integer.TYPE, Array.class }, - new Object[] { new Integer(columnIndex), - columnValue }); - } - - - -// JDBC 3.0 - public void updateArray (String columnName, Array columnValue) - throws SQLException - { - if (columnValue != null && - !(columnValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("updateArray", - new Class[] { String.class, Array.class }, - new Object[] { columnName, - columnValue }); - } - - - - - -// JDBC 2.0 - public void updateAsciiStream (int columnIndex, - InputStream columnValue, - int length) - throws SQLException - { - InputStream iStream; - if (columnValue == null || - columnValue instanceof Serializable) - iStream = columnValue; - else { - try { - iStream = new SerializableInputStream (columnValue); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("updateAsciiStream", - new Class[] { Integer.TYPE, InputStream.class, - Integer.TYPE }, - new Object[] { new Integer (columnIndex), - iStream, - new Integer (length) }); - } - - - -// JDBC 2.0 - public void updateAsciiStream (String columnName, - InputStream columnValue, - int length) - throws SQLException - { - updateAsciiStream (findColumn (columnName), columnValue, length); - } - - - -// JDBC 2.0 - public void updateBigDecimal (int columnIndex, BigDecimal columnValue) - throws SQLException - { - callMethod ("updateBigDecimal", - new Class[] { Integer.TYPE, BigDecimal.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 2.0 - public void updateBigDecimal (String columnName, BigDecimal columnValue) - throws SQLException - { - updateBigDecimal (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateBinaryStream (int columnIndex, - InputStream columnValue, - int length) - throws SQLException - { - InputStream iStream; - if (columnValue == null || - columnValue instanceof Serializable) - iStream = columnValue; - else { - try { - iStream = new SerializableInputStream (columnValue); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("updateBinaryStream", - new Class[] { Integer.TYPE, InputStream.class, - Integer.TYPE }, - new Object[] { new Integer (columnIndex), - iStream, - new Integer (length) }); - } - - - -// JDBC 2.0 - public void updateBinaryStream (String columnName, - InputStream columnValue, - int length) - throws SQLException - { - updateBinaryStream (findColumn (columnName), columnValue, length); - } - - - -// JDBC 3.0 - public void updateBlob (int columnIndex, Blob columnValue) - throws SQLException - { - callMethod ("updateBlob", - new Class[] { Integer.TYPE, Blob.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 3.0 - public void updateBlob (String columnName, Blob columnValue) - throws SQLException - { - callMethod ("updateBlob", - new Class[] { String.class, Blob.class }, - new Object[] { columnName, - columnValue }); - } - - - -// JDBC 2.0 - public void updateBoolean (int columnIndex, boolean columnValue) - throws SQLException - { - callMethod ("updateBoolean", - new Class[] { Integer.TYPE, Boolean.TYPE }, - new Object[] { new Integer (columnIndex), - new Boolean (columnValue) }); - } - - - -// JDBC 2.0 - public void updateBoolean (String columnName, boolean columnValue) - throws SQLException - { - updateBoolean (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateByte (int columnIndex, byte columnValue) - throws SQLException - { - callMethod ("updateByte", - new Class[] { Integer.TYPE, Byte.TYPE }, - new Object[] { new Integer (columnIndex), - new Byte (columnValue) }); - } - - - -// JDBC 2.0 - public void updateByte (String columnName, byte columnValue) - throws SQLException - { - updateByte (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateBytes (int columnIndex, byte[] columnValue) - throws SQLException - { - callMethod ("updateBytes", - new Class[] { Integer.TYPE, byte[].class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 2.0 - public void updateBytes (String columnName, byte[] columnValue) - throws SQLException - { - updateBytes (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateCharacterStream (int columnIndex, - Reader columnValue, - int length) - throws SQLException - { - try { - SerializableReader reader; - if (columnValue == null) - reader = null; - else - reader = new SerializableReader (columnValue, Math.max(0,length)); - callMethod ("updateCharacterStream", - new Class[] { Integer.TYPE, Reader.class, Integer.TYPE }, - new Object[] { new Integer (columnIndex), - reader, new Integer (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - -// JDBC 2.0 - public void updateCharacterStream (String columnName, - Reader columnValue, - int length) - throws SQLException - { - updateCharacterStream (findColumn (columnName), columnValue, length); - } - - - -// JDBC 3.0 - public void updateClob (int columnIndex, Clob columnValue) - throws SQLException - { - callMethod ("updateClob", - new Class[] { String.class, Clob.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 3.0 - public void updateClob (String columnName, Clob columnValue) - throws SQLException - { - callMethod ("updateClob", - new Class[] { String.class, Clob.class }, - new Object[] { columnName, - columnValue }); - } - - - -// JDBC 2.0 - public void updateDate (int columnIndex, Date columnValue) - throws SQLException - { - callMethod ("updateDate", - new Class[] { Integer.TYPE, Date.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 2.0 - public void updateDate (String columnName, Date columnValue) - throws SQLException - { - updateDate (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateDouble (int columnIndex, double columnValue) - throws SQLException - { - callMethod ("updateDouble", - new Class[] { Integer.TYPE, Double.TYPE }, - new Object[] { new Integer (columnIndex), - new Double (columnValue) }); - } - - - -// JDBC 2.0 - public void updateDouble (String columnName, double columnValue) - throws SQLException - { - updateDouble (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateFloat (int columnIndex, float columnValue) - throws SQLException - { - callMethod ("updateFloat", - new Class[] { Integer.TYPE, Float.TYPE }, - new Object[] { new Integer (columnIndex), - new Float (columnValue) }); - } - - - -// JDBC 2.0 - public void updateFloat (String columnName, float columnValue) - throws SQLException - { - updateFloat (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateInt (int columnIndex, int columnValue) - throws SQLException - { - callMethod ("updateInt", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer (columnIndex), - new Integer (columnValue) }); - } - - - -// JDBC 2.0 - public void updateInt (String columnName, int columnValue) - throws SQLException - { - updateInt (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateLong (int columnIndex, long columnValue) - throws SQLException - { - callMethod ("updateLong", - new Class[] { Integer.TYPE, Long.TYPE }, - new Object[] { new Integer (columnIndex), - new Long (columnValue) }); - } - - - -// JDBC 2.0 - public void updateLong (String columnName, long columnValue) - throws SQLException - { - updateLong (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateNull (int columnIndex) - throws SQLException - { - callMethod ("updateNull", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }); - } - - - -// JDBC 2.0 - public void updateNull (String columnName) - throws SQLException - { - updateNull (findColumn (columnName)); - } - - - -// JDBC 2.0 - public void updateObject (int columnIndex, Object columnValue) - throws SQLException - { - if (columnValue != null && - !(columnValue instanceof Serializable)) { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("updateObject", - new Class[] { Integer.TYPE, Object.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 2.0 - public void updateObject (String columnName, Object columnValue) - throws SQLException - { - updateObject (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateObject (int columnIndex, - Object columnValue, - int scale) - throws SQLException - { - if (columnValue != null && - !(columnValue instanceof Serializable)) { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("updateObject", - new Class[] { Integer.TYPE, Object.class, Integer.TYPE }, - new Object[] { new Integer (columnIndex), - columnValue, - new Integer (scale) }); - } - - - -// JDBC 2.0 - public void updateObject (String columnName, - Object columnValue, - int scale) - throws SQLException - { - updateObject (findColumn (columnName), columnValue, scale); - } - - - -// JDBC 3.0 - public void updateRef (int columnIndex, Ref columnValue) - throws SQLException - { - if (columnValue != null && - !(columnValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("updateRef", - new Class[] { Integer.TYPE, Ref.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 3.0 - public void updateRef (String columnName, Ref columnValue) - throws SQLException - { - if (columnValue != null && - !(columnValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("updateRef", - new Class[] { String.class, Ref.class }, - new Object[] { columnName, - columnValue }); - } - - - -// JDBC 2.0 - public void updateRow () - throws SQLException - { - callMethod ("updateRow"); - } - - - -// JDBC 2.0 - public void updateShort (int columnIndex, short columnValue) - throws SQLException - { - callMethod ("updateShort", - new Class[] { Integer.TYPE, Short.TYPE }, - new Object[] { new Integer (columnIndex), - new Short (columnValue) }); - } - - - -// JDBC 2.0 - public void updateShort (String columnName, short columnValue) - throws SQLException - { - updateShort (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateString (int columnIndex, String columnValue) - throws SQLException - { - callMethod ("updateString", - new Class[] { Integer.TYPE, String.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 2.0 - public void updateString (String columnName, String columnValue) - throws SQLException - { - updateString (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateTime (int columnIndex, Time columnValue) - throws SQLException - { - callMethod ("updateTime", - new Class[] { Integer.TYPE, Time.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 2.0 - public void updateTime (String columnName, Time columnValue) - throws SQLException - { - updateTime (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateTimestamp (int columnIndex, Timestamp columnValue) - throws SQLException - { - callMethod ("updateTimestamp", - new Class[] { Integer.TYPE, Timestamp.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 2.0 - public void updateTimestamp (String columnName, Timestamp columnValue) - throws SQLException - { - updateTimestamp (findColumn (columnName), columnValue); - } - - - //@PDA jdbc40 - public int getHoldability() throws SQLException - { - return callMethodRtnInt ("getHoldability"); - } - - - //@pda jdbc40 - public Reader getNCharacterStream(int columnIndex) throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getNCharacterStream", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }, - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnName the name of the column - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language - * @exception SQLException if a database access error occurs - */ - public Reader getNCharacterStream(String columnName) throws SQLException - { - return getNCharacterStream (findColumn (columnName)); - } - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a NClob object - * in the Java programming language. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return a NClob object representing the SQL - * NCLOB value in the specified column - * @exception SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurss - */ -/* ifdef JDBC40 */ - public NClob getNClob(int columnIndex) throws SQLException - { - try { - JDNClobProxy newClob = new JDNClobProxy (); - return (JDNClobProxy) connection_.callFactoryMethod (pxId_, - "getNClob", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(columnIndex) }, - newClob); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } -/* endif */ - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a NClob object - * in the Java programming language. - * - * @param columnName the name of the column from which to retrieve the value - * @return a NClob object representing the SQL NCLOB - * value in the specified column - * @exception SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - */ -/* ifdef JDBC40 */ - public NClob getNClob(String columnName) throws SQLException - { - return getNClob (findColumn (columnName)); - } -/* endif */ - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - */ - public String getNString(int columnIndex) throws SQLException - { - return (String) callMethodRtnObj ("getNString", - new Class[] { Integer.TYPE}, - new Object[] { new Integer (columnIndex) }); - } - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnName the SQL name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - */ - public String getNString(String columnName) throws SQLException - { - return getNString (findColumn (columnName)); - } - - - //@pda jdbc40 -/* ifdef JDBC40 */ - public RowId getRowId(int columnIndex) throws SQLException - { - try { - JDRowIdProxy newClob = new JDRowIdProxy (); - return (JDRowIdProxy) connection_.callFactoryMethod (pxId_, - "getRowId", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(columnIndex) }, - newClob); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - //@pda jdbc40 - public RowId getRowId(String columnName) throws SQLException - { - return getRowId(findColumn (columnName)); - } - - //@pda jdbc40 - public SQLXML getSQLXML(int columnIndex) throws SQLException - { - try { - JDSQLXMLProxy newXML = new JDSQLXMLProxy (); - return (JDSQLXMLProxy) connection_.callFactoryMethod (pxId_, - "getSQLXML", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(columnIndex) }, - newXML); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@pda jdbc40 - public SQLXML getSQLXML(String columnName) throws SQLException - { - return getSQLXML(findColumn (columnName)); - } -/* endif */ - - //@pda jdbc40 - public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException - { - try { - SerializableReader reader; - if (x == null) - reader = null; - else - reader = new SerializableReader (x, Math.max(0,(int)length)); - callMethod ("updateNCharacterStream", - new Class[] { Integer.TYPE, Reader.class, Long.TYPE }, - new Object[] { new Integer (columnIndex), - reader, new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - - } - - //@PDA jdbc40 - public void updateNCharacterStream(String columnName, Reader x, long length) throws SQLException - { - updateNCharacterStream (findColumn (columnName), x, length); - } - - //@PDA jdbc40 -/* ifdef JDBC40 */ - public void updateNClob(int columnIndex, NClob nClob) throws SQLException - { - callMethod ("updateNClob", - new Class[] { String.class, NClob.class }, - new Object[] { new Integer (columnIndex), - nClob }); - } - - //@PDA jdbc40 - public void updateNClob(String columnName, NClob nClob) throws SQLException - { - updateNClob (findColumn (columnName), nClob); - - } -/* endif */ - - //@pda jdbc40 - public void updateNString(int columnIndex, String nString) throws SQLException - { - callMethod ("updateNString", - new Class[] { Integer.TYPE, String.class }, - new Object[] { new Integer (columnIndex), - nString }); - } - - //@PDA jdbc40 - public void updateNString(String columnName, String nString) throws SQLException - { - updateNString (findColumn (columnName), nString); - } - -/* ifdef JDBC40 */ - //@PDA jdbc40 - public void updateRowId(int columnIndex, RowId x) throws SQLException - { - callMethod ("updateRowId", - new Class[] { String.class, RowId.class }, - new Object[] { new Integer (columnIndex), - x }); - } - - //@pda jdbc40 - public void updateRowId(String columnName, RowId x) throws SQLException - { - updateRowId (findColumn (columnName), x); - } - - - //@pda jdbc40 - public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException - { - callMethod ("updateSQLXML", - new Class[] { String.class, SQLXML.class }, - new Object[] { new Integer (columnIndex), - xmlObject }); - } - - //@pda jdbc40 - public void updateSQLXML(String columnName, SQLXML xmlObject) throws SQLException - { - updateSQLXML(findColumn(columnName), xmlObject); - } - -/* endif */ - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.ResultSet" }; //@pdc user cannot cast to AS400JDBCResultSet - } - - //@PDA jdbc40 - public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException - { - InputStream iStream; - if (x == null || x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("updateAsciiStream", - new Class[] { Integer.TYPE, InputStream.class, - Long.TYPE }, - new Object[] { new Integer (columnIndex), - iStream, - new Long (length) }); - } - - - //@PDA jdbc40 - public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException - { - updateAsciiStream (findColumn (columnLabel), x, length); - } - - - //@PDA jdbc40 - public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException - { - InputStream iStream; - if (x == null || x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("updateBinaryStream", - new Class[] { Integer.TYPE, InputStream.class, - Long.TYPE }, - new Object[] { new Integer (columnIndex), - iStream, - new Long (length) }); - } - - //@PDA jdbc40 - public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException - { - updateBinaryStream (findColumn (columnLabel), x, length); - } - - //@PDA jdbc40 - public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException - { - InputStream iStream; - if (inputStream == null || inputStream instanceof Serializable) - iStream = inputStream; - else { - try { - iStream = new SerializableInputStream (inputStream); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("updateBlob", - new Class[] { Integer.TYPE, InputStream.class, - Long.TYPE }, - new Object[] { new Integer (columnIndex), - iStream, - new Long (length) }); - } - - //@PDA jdbc40 - public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException - { - updateBlob (findColumn (columnLabel), inputStream, length); - } - - //@PDA jdbc40 - public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException - { - try { - SerializableReader reader; - if (x == null) - reader = null; - else - reader = new SerializableReader (x, Math.max(0,(int)length)); - callMethod ("updateCharacterStream", - new Class[] { Integer.TYPE, Reader.class, Long.TYPE }, - new Object[] { new Integer (columnIndex), - reader, new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException - { - updateCharacterStream (findColumn (columnLabel), reader, length); - } - - //@PDA jdbc40 - public void updateClob(int columnIndex, Reader reader, long length) throws SQLException - { - try { - SerializableReader sReader; - if (reader == null) - sReader = null; - else - sReader = new SerializableReader (reader, Math.max(0,(int)length)); - callMethod ("updateClob", - new Class[] { Integer.TYPE, Reader.class, Long.TYPE }, - new Object[] { new Integer (columnIndex), - sReader, new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - public void updateClob(String columnLabel, Reader reader, long length) throws SQLException - { - updateClob (findColumn (columnLabel), reader, length); - } - - - - //@PDA jdbc40 - public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException - { - try { - SerializableReader sReader; - if (reader == null) - sReader = null; - else - sReader = new SerializableReader (reader, Math.max(0,(int)length)); - callMethod ("updateNClob", - new Class[] { Integer.TYPE, Reader.class, Long.TYPE }, - new Object[] { new Integer (columnIndex), - sReader, new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - //@PDA jdbc40 - public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException - { - updateNClob (findColumn (columnLabel), reader, length); - } - - //@PDA jdbc40 - public boolean isClosed () throws SQLException - { - return callMethodRtnBool ("isClosed"); - } - - - //@pda jdbc40 - public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException - { - InputStream iStream; - if (x == null || x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("updateAsciiStream", - new Class[] { Integer.TYPE, InputStream.class }, - new Object[] { new Integer (columnIndex), - iStream }); - } - - - //@PDA jdbc40 - public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException - { - updateAsciiStream (findColumn (columnLabel), x); - } - - - //@PDA jdbc40 - public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException - { - InputStream iStream; - if (x == null || x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("updateBinaryStream", - new Class[] { Integer.TYPE, InputStream.class }, - new Object[] { new Integer (columnIndex), - iStream }); - } - - - //@PDA jdbc40 - public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException - { - updateBinaryStream (findColumn (columnLabel), x); - - } - - - //@PDA jdbc40 - public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException - { - InputStream iStream; - if ( inputStream== null || inputStream instanceof Serializable) - iStream = inputStream; - else { - try { - iStream = new SerializableInputStream (inputStream); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("updateBlob", - new Class[] { Integer.TYPE, InputStream.class }, - new Object[] { new Integer (columnIndex), - iStream }); - } - - - //@PDA jdbc40 - public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException - { - updateBlob (findColumn (columnLabel), inputStream); - } - - - //@PDA jdbc40 - public void updateCharacterStream(int columnIndex, Reader x) throws SQLException - { - try { - SerializableReader sReader; - if (x == null) - sReader = null; - else - sReader = new SerializableReader (x); - callMethod ("updateCharacterStream", - new Class[] { Integer.TYPE, Reader.class }, - new Object[] { new Integer (columnIndex), sReader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - //@PDA jdbc40 - public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException - { - updateCharacterStream(findColumn (columnLabel), reader); - } - - - //@PDA jdbc40 - public void updateClob(int columnIndex, Reader reader) throws SQLException - { - try { - SerializableReader sReader; - if (reader == null) - sReader = null; - else - sReader = new SerializableReader (reader); - callMethod ("updateClob", - new Class[] { Integer.TYPE, Reader.class }, - new Object[] { new Integer (columnIndex), sReader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - //@PDA jdbc40 - public void updateClob(String columnLabel, Reader reader) throws SQLException - { - updateClob(findColumn (columnLabel), reader); - } - - //@PDA jdbc40 - public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException - { - try { - SerializableReader sReader; - if (x == null) - sReader = null; - else - sReader = new SerializableReader (x); - callMethod ("updateNCharacterStream", - new Class[] { Integer.TYPE, Reader.class }, - new Object[] { new Integer (columnIndex), sReader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - - } - - //@PDA jdbc40 - public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException - { - updateNCharacterStream(findColumn (columnLabel), reader); - } - - //@PDA jdbc40 - public void updateNClob(int columnIndex, Reader reader) throws SQLException - { - try { - SerializableReader sReader; - if (reader == null) - sReader = null; - else - sReader = new SerializableReader (reader); - callMethod ("updateNClob", - new Class[] { Integer.TYPE, Reader.class }, - new Object[] { new Integer (columnIndex), sReader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - public void updateNClob(String columnLabel, Reader reader) throws SQLException - { - updateNClob(findColumn (columnLabel), reader); - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/JDRowIdProxy.java b/cvsroot/jdbc40/com/ibm/as400/access/JDRowIdProxy.java deleted file mode 100644 index f57408560..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/JDRowIdProxy.java +++ /dev/null @@ -1,86 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDRowIdProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -/* ifdef JDBC40 */ -import java.sql.RowId; -/* endif */ - -//@PDA jdbc40 new class - -/** -The JDRowIdProxy class provides access to binary large -objects. The data is valid only within the current -transaction. -**/ -class JDRowIdProxy -extends AbstractProxyImpl -/* ifdef JDBC40 */ -implements RowId -/* endif */ - -{ - - // Copied from JDError: - private static final String EXC_FUNCTION_NOT_SUPPORTED = "IM001"; - - - public byte[] getBytes ( ) - { - try { - return (byte[]) connection_.callMethod (pxId_, "getBytes").getReturnValue(); - } - catch (InvocationTargetException e) { - - return null; //interface does not throw SQLException as of current version - } - } - - - public String toString() - { - try { - return (String) connection_.callMethod (pxId_, "toString").getReturnValue(); - } - catch (InvocationTargetException e) { - - return null; //interface does not throw SQLException as of current version - } - } - - public boolean equals(Object obj) - { - try { - return connection_.callMethod(pxId_, "equals", - new Class[] { Object.class }, - new Object[] { obj }, false).getReturnValueBoolean(); - } - catch (InvocationTargetException e) { - - return false; //interface does not throw SQLException as of current version - } - } - - public int hashCode() - { - try { - return connection_.callMethod(pxId_, "hashCode").getReturnValueInt(); - } - catch (InvocationTargetException e) { - - return 0; //interface does not throw SQLException as of current version - } - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/JDSQLXMLProxy.java b/cvsroot/jdbc40/com/ibm/as400/access/JDSQLXMLProxy.java deleted file mode 100644 index 4e3a4b269..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/JDSQLXMLProxy.java +++ /dev/null @@ -1,179 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -//JTOpen (IBM Toolbox for Java - OSS version) -// -//Filename: JDSQLXMLProxy.java -// -//The source code contained herein is licensed under the IBM Public License -//Version 1.0, which has been approved by the Open Source Initiative. -//Copyright (C) 2006-2006 International Business Machines Corporation and -//others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Writer; -import java.io.Reader; -import java.lang.reflect.InvocationTargetException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -import javax.xml.transform.Result; -import javax.xml.transform.Source; -/* endif */ -import java.sql.SQLException; - - - - -//@PDA jdbc40 new class - -/** - The JDSQLXMLProxy class provides access to character XML - objects. - **/ -class JDSQLXMLProxy -extends AbstractProxyImpl -/* ifdef JDBC40 */ -implements SQLXML -/* endif */ -{ - - - // Copied from JDError: - static final String EXC_FUNCTION_NOT_SUPPORTED = "IM001"; - - public Reader getCharacterStream () - throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getCharacterStream", - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public Writer setCharacterStream () - throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDWriterProxy) connection_.callFactoryMethod ( - pxId_, "setCharacterStream", - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public void setString (String str) - throws SQLException - { - try { - connection_.callMethod (pxId_, "setString", - new Class[] { String.class}, - new Object[] { str}); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public void free() throws SQLException - { - try { - connection_.callMethod (pxId_, "free"); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - - public InputStream getBinaryStream() throws SQLException - { - try { - JDInputStreamProxy newStream = new JDInputStreamProxy (); - return (JDInputStreamProxy) connection_.callFactoryMethod ( - pxId_, "getBinaryStream", - newStream); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - -/* ifdef JDBC40 */ - public T getSource(Class sourceClass) throws SQLException - { - try - { - //not currently supported. get exception from proxy server - JDWriterProxy newWriter = new JDWriterProxy (); - return (T) connection_.callFactoryMethod (pxId_, "getSource", - new Class[] { Class.class}, - new Object[] { sourceClass }, - newWriter); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } -/* endif */ - - public String getString() throws SQLException - { - try { - return (String) connection_.callMethod (pxId_, "getString").getReturnValue(); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public OutputStream setBinaryStream() throws SQLException - { - try { - JDOutputStreamProxy newStream = new JDOutputStreamProxy (); - return (JDOutputStreamProxy) connection_.callFactoryMethod ( - pxId_, "setBinaryStream", - newStream); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -/* ifdef JDBC40 */ - public T setResult(Class resultClass) throws SQLException - { - try - { - //not currently supported. get exception from proxy server - JDWriterProxy newWriter = new JDWriterProxy (); - return (T) connection_.callFactoryMethod (pxId_, "setResult", - new Class[] { Class.class}, - new Object[] { resultClass }, - newWriter); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - -/* endif */ - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/JDStatementProxy.java b/cvsroot/jdbc40/com/ibm/as400/access/JDStatementProxy.java deleted file mode 100644 index f4d2adf95..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/JDStatementProxy.java +++ /dev/null @@ -1,566 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDStatementProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.SQLWarning; - - -class JDStatementProxy -extends AbstractProxyImpl -implements java.sql.Statement -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Protected data. - protected JDConnectionProxy jdConnection_; - // The object that caused this object to be created. - - protected JDResultSetProxy cachedResultSet_; - - // Copied from JDError: - private static final String EXC_FUNCTION_NOT_SUPPORTED = "IM001"; - - - - - public JDStatementProxy (JDConnectionProxy jdConnection) - { - jdConnection_ = jdConnection; - } - - -// JDBC 2.0 - public void addBatch (String sql) - throws SQLException - { - callMethod ("addBatch", - new Class[] { String.class }, - new Object[] { sql }); - } - - - // Call a method. No return value is expected. - protected void callMethod (String methodName) - throws SQLException - { - try { - connection_.callMethod (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - protected void callMethod (String methodName, - Class[] argClasses, - Object[] argValues) - throws SQLException - { - try { - connection_.callMethod (pxId_, methodName, argClasses, argValues); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a boolean. - protected boolean callMethodRtnBool (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsBoolean (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return an int. - protected int callMethodRtnInt (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsInt (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return an Object. - protected Object callMethodRtnObj (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsObject (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a 'raw' ProxyReturnValue. - protected ProxyReturnValue callMethodRtnRaw (String methodName, - Class[] argClasses, - Object[] argValues) - throws SQLException - { - try { - return connection_.callMethod (pxId_, methodName, - argClasses, argValues); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public void cancel () - throws SQLException - { - cachedResultSet_ = null; - callMethod ("cancel"); - } - - - -// JDBC 2.0 - public void clearBatch () - throws SQLException - { - callMethod ("clearBatch"); - } - - - - public void clearWarnings () - throws SQLException - { - callMethod ("clearWarnings"); - } - - - - public void close () - throws SQLException - { - cachedResultSet_ = null; - callMethod ("close"); - } - - - public boolean execute (String sql) - throws SQLException - { - cachedResultSet_ = null; - return callMethodRtnRaw ("execute", - new Class[] { String.class }, - new Object[] { sql }) - .getReturnValueBoolean (); - } - - - - // JDBC 3.0 - public boolean execute (String sql, int autoGeneratedKeys) - throws SQLException - { - cachedResultSet_ = null; - return callMethodRtnRaw ("execute", - new Class[] { String.class, Integer.TYPE}, - new Object[] { sql, new Integer(autoGeneratedKeys)}) - .getReturnValueBoolean (); - } - - - - // JDBC 3.0 - public boolean execute (String sql, int[] columnIndexes) - throws SQLException - { - cachedResultSet_ = null; - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - - // JDBC 3.0 - public boolean execute (String sql, String[] columnNames) - throws SQLException - { - cachedResultSet_ = null; - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - -// JDBC 2.0 - public int[] executeBatch () - throws SQLException - { - cachedResultSet_ = null; - return (int[]) callMethodRtnObj ("executeBatch"); - } - - - - public ResultSet executeQuery (String sql) - throws SQLException - { - cachedResultSet_ = null; - try { - JDResultSetProxy newResultSet = new JDResultSetProxy (jdConnection_, this); - cachedResultSet_ = (JDResultSetProxy) connection_.callFactoryMethod ( - pxId_, - "executeQuery", - new Class[] { String.class }, - new Object[] { sql }, - newResultSet); - return cachedResultSet_; - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public int executeUpdate (String sql) - throws SQLException - { - cachedResultSet_ = null; - return callMethodRtnRaw ("executeUpdate", - new Class[] { String.class }, - new Object[] { sql }) - .getReturnValueInt (); - } - - - - // JDBC 3.0 - public int executeUpdate (String sql, int autoGeneratedKeys) - throws SQLException - { - cachedResultSet_ = null; - return callMethodRtnRaw ("executeUpdate", - new Class[] { String.class, Integer.TYPE}, - new Object[] { sql, new Integer(autoGeneratedKeys)}) - .getReturnValueInt (); - } - - - - // JDBC 3.0 - public int executeUpdate (String sql, int[] columnIndexes) - throws SQLException - { - cachedResultSet_ = null; - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - - // JDBC 3.0 - public int executeUpdate (String sql, String[] columnNames) - throws SQLException - { - cachedResultSet_ = null; - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - -// JDBC 2.0 - public Connection getConnection () - { - return jdConnection_; - } - - -// JDBC 2.0 - public int getFetchDirection () - throws SQLException - { - return callMethodRtnInt ("getFetchDirection"); - } - - - -// JDBC 2.0 - public int getFetchSize () - throws SQLException - { - return callMethodRtnInt ("getFetchSize"); - } - - - - // JDBC 3.0 - public ResultSet getGeneratedKeys () - throws SQLException - { - cachedResultSet_ = null; - try { - JDResultSetProxy newResultSet = new JDResultSetProxy (jdConnection_, this); - cachedResultSet_ = (JDResultSetProxy) connection_.callFactoryMethod ( - pxId_, - "getGeneratedKeys", - newResultSet); - return cachedResultSet_; - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public int getMaxFieldSize () - throws SQLException - { - return callMethodRtnInt ("getMaxFieldSize"); - } - - - - public int getMaxRows () - throws SQLException - { - return callMethodRtnInt ("getMaxRows"); - } - - - - public boolean getMoreResults () - throws SQLException - { - cachedResultSet_ = null; - return callMethodRtnBool ("getMoreResults"); - } - - - - // JDBC 3.0 - public boolean getMoreResults (int current) - throws SQLException - { - cachedResultSet_ = null; - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - - public int getQueryTimeout () - throws SQLException - { - return callMethodRtnInt ("getQueryTimeout"); - } - - - - public ResultSet getResultSet () - throws SQLException - { - if (cachedResultSet_ == null) - { - try { - JDResultSetProxy newResultSet = new JDResultSetProxy (jdConnection_, this); - cachedResultSet_ = (JDResultSetProxy) connection_.callFactoryMethod ( - pxId_, "getResultSet", newResultSet); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - return cachedResultSet_; - } - - - -// JDBC 2.0 - public int getResultSetConcurrency () - throws SQLException - { - return callMethodRtnInt ("getResultSetConcurrency"); - } - - - - // JDBC 3.0 - public int getResultSetHoldability () - throws SQLException - { - return callMethodRtnInt ("getResultSetHoldability"); - } - - - - -// JDBC 2.0 - public int getResultSetType () - throws SQLException - { - return callMethodRtnInt ("getResultSetType"); - } - - - - public int getUpdateCount () - throws SQLException - { - return callMethodRtnInt ("getUpdateCount"); - } - - - - public SQLWarning getWarnings () - throws SQLException - { - return (SQLWarning) callMethodRtnObj ("getWarnings"); - } - - - public void setCursorName (String cursorName) - throws SQLException - { - cachedResultSet_ = null; - callMethod ("setCursorName", - new Class[] { String.class }, - new Object[] { cursorName }); - } - - - - public void setEscapeProcessing (boolean escapeProcessing) - throws SQLException - { - callMethod ("setEscapeProcessing", - new Class[] { Boolean.TYPE }, - new Object[] { new Boolean (escapeProcessing) }); - } - - - -// JDBC 2.0 - public void setFetchDirection (int fetchDirection) - throws SQLException - { - callMethod ("setFetchDirection", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (fetchDirection) }); - } - - - -// JDBC 2.0 - public void setFetchSize (int fetchSize) - throws SQLException - { - callMethod ("setFetchSize", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (fetchSize) }); - } - - - - public void setMaxFieldSize (int maxFieldSize) - throws SQLException - { - callMethod ("setMaxFieldSize", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (maxFieldSize) }); - } - - - public void setMaxRows (int maxRows) - throws SQLException - { - callMethod ("setMaxRows", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (maxRows) }); - } - - - - public void setQueryTimeout (int queryTimeout) - throws SQLException - { - callMethod ("setQueryTimeout", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (queryTimeout) }); - } - - - // This method is not required by java.sql.Statement, - // but it is used by the JDBC testcases, and is implemented - // in the public class. - public String toString () - { - try { - return (String) connection_.callMethodReturnsObject (pxId_, "toString"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.Statement" }; - } - - //@PDA jdbc40 - public boolean isClosed () throws SQLException - { - return callMethodRtnBool ("isClosed"); - } - - //@PDA jdbc40 - public void setPoolable(boolean poolable) throws SQLException - { - callMethod ("setPoolable", - new Class[] { Boolean.TYPE }, - new Object[] { new Boolean (poolable) }); - } - - //@PDA jdbc40 - public boolean isPoolable() throws SQLException - { - return callMethodRtnBool ("isPoolable"); - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLArray.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLArray.java deleted file mode 100644 index 95380a97c..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLArray.java +++ /dev/null @@ -1,476 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// - -//JTOpen (IBM Toolbox for Java - OSS version) - -//Filename: SQLArray.java - -//The source code contained herein is licensed under the IBM Public License -//Version 1.0, which has been approved by the Open Source Initiative. -//Copyright (C) 2009-2009 International Business Machines Corporation and -//others. All rights reserved. - -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -//@array new class -class SQLArray implements SQLData -{ - static final String copyright = "Copyright (C) 2009-2010 International Business Machines Corporation and others."; - - private SQLData[] values_; // Since lobs do conversion during execute (not - // setLob()), let SQLData objects manage - // conversion and truncation etc for each - // element - private int arrayCount_ = 0; - private SQLData contentTemplate_; // This is just a reference to the SQLData type that this array contains which is cloned at set() time - //It will reflect the prepare/describe metadata both for DB input and output - private int elemDataTypeLen_ = 0; //needed for to/fromRawBytes - private int vrm_; - - SQLArray() - { - // restrict type-less array construction - } - - /** - * - * @param elemDataTypeLen The length of the datatype that are in the array - * @param contentTemplate A dummy SQLDataX object used for cloning - * @param vrm Version - */ - public SQLArray(int elemDataTypeLen, SQLData contentTemplate, int vrm) - { - - values_ = null; // length not known at prepare/describe time. - contentTemplate_ = contentTemplate; // contains type, length, etc - vrm_ = vrm; - elemDataTypeLen_ = elemDataTypeLen; - } - - public Object clone() - { - - //Just clone with attrs with no data - SQLArray cpy = new SQLArray(elemDataTypeLen_, contentTemplate_, vrm_); - - return cpy; - } - - /* populate values_[] with data from host. */ - public void convertFromRawBytes(byte[] rawBytes, int offset, - ConvTable converter) throws SQLException - { - values_ = new SQLData[arrayCount_]; - for (int x = 0; x < arrayCount_; x++) - { - values_[x] = (SQLData)contentTemplate_.clone(); //create empty SQLX objects - //No need to deal with locators in arrays here. They are not supported in locators due to QQ constraint - try{ //@dec - values_[x].convertFromRawBytes(rawBytes, offset, converter); - }catch(NumberFormatException e) //@dec - { //@dec - //ignore since null array elements will have invalid decimal/numeric value bits - } //@dec - offset += elemDataTypeLen_; //values_[x].getActualSize(); - } - } - - /* copy data from values_[] to stream for sending to host. */ - public void convertToRawBytes(byte[] rawBytes, int offset, - ConvTable ccsidConverter) throws SQLException - { - for (int x = 0; x < arrayCount_; x++) - { - if(values_ != null && values_[x] != null) //@array null element - values_[x].convertToRawBytes(rawBytes, offset, ccsidConverter); - else - { - //for arrays, we set the element null indicator here since we don't really have the offset before now - contentTemplate_.convertToRawBytes(rawBytes, offset, ccsidConverter); - } - offset += elemDataTypeLen_; //values_[x].getActualSize(); - } - } - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - //note that we could be getting a user-defined Array as input - Object[] data = (Object[]) ((Array) object).getArray(); // These elements must be wrapped in a type wrapper before calling (ie Integer, not int) - if(data == null) - data = new Object[0]; //if null array just make 0 length array - - arrayCount_ = data.length; - values_ = new SQLData[arrayCount_]; - - boolean isSQLData = false; - //since values can be null, don't check if data_[0] is instance of SQLData - if((arrayCount_ > 0) && (data[0] != null) && (data instanceof SQLData[])) - isSQLData = true; //data was output from previous and is still in SQLData object - - for (int x = 0; x < arrayCount_; x++) - { - //prepare/describe is the type that we ARE. - //create sqlX objects and let them do conversion from input type to actual type - values_[x] = (SQLData)contentTemplate_.clone(); //create empty SQLX objects - //@array no locators supported in qq of arrays...none to set here - - Object inObj; - if(isSQLData) - inObj = ((SQLData)data[x]).getObject(); - else - inObj = data[x];//can be null array element - - if(inObj == null) - setElementNull(x); - else - values_[x].set(inObj, calendar, scale); //let the SQLX objects do the conversions - } - } - - public int getActualSize() - { - - int totalSize = 0; - for (int x = 0; x < arrayCount_; x++) - { - totalSize += values_[x].getActualSize(); - } - return totalSize; - } - - public InputStream getAsciiStream() throws SQLException - { - - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) throws SQLException - { - - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public byte[] getBytes() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - public String getNString() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* ifdef JDBC40 */ - - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - -/* ifdef JDBC40 */ - - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - public Date getDate(Calendar calendar) throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public float getFloat() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public int getInt() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public long getLong() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public short getShort() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public String getString() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Time getTime(Calendar calendar) throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - // @array - public Array getArray() throws SQLException - { - /*Object[] content = new Object[values_.length]; - for(int x = 0; x < values_.length; x++) - { - content[x] = values_[x].getObject(); //get in default object type - }*/ - - //return new AS400JDBCArray with array of SQLData[] as elements - return new AS400JDBCArray(contentTemplate_.getTypeName(), values_, vrm_, null); - } - - public String getCreateParameters() - { - - return null; - } - - public int getDisplaySize() - { - - return 0; - } - - public String getJavaClassName() - { - return "java.sql.Array"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "ARRAY"; - } - - public int getMaximumPrecision() - { - return 0; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - - return 0; - } - - public int getNativeType() - { - return SQLData.NATIVE_ARRAY; - //For arrays, we don't have a native type number, just a bit flag in the stream header - } - - //array only method - public int getElementNativeType() - { - return contentTemplate_.getNativeType(); //works if elems are null - //if(values_ != null && values_.length > 0) - // return values_[0].getNativeType(); - //else - // return getNativeType(); //should not ever return this with current design, but better than null pointers - - } - - /* //array only method - public int getElementSize() - { - return getActualSize(); - - } -*/ - public Object getObject() throws SQLException - { - return getArray(); - } - - public int getPrecision() - { - - return 0; - } - - public int getRadix() - { - - return 0; - } - - public int getSQLType() - { - - return SQLData.ARRAY; - } - - public int getScale() - { - - return 0; - } - - public int getTruncated() - { - return 0; - } - - public int getType() { - - return java.sql.Types.ARRAY; - } - - public String getTypeName() - { - - return "ARRAY"; - } - - public boolean isSigned() - { - return values_[0].isSigned(); - } - - public boolean isText() - { - return values_[0].isText(); - - } - - public void setArrayCount(int count) - { - arrayCount_ = count; - } - - public int getArrayCount() - { - return arrayCount_; - } - - public void setElementNull(int element) - { - values_[element] = null; - } - - public boolean isElementNull(int element) - { - if( values_[element] == null) - return true; - else - return false; - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLBigint.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLBigint.java deleted file mode 100644 index 4f0c6b277..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLBigint.java +++ /dev/null @@ -1,527 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLBigint.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLBigint -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private static final BigInteger LONG_MAX_VALUE = BigInteger.valueOf(Long.MAX_VALUE); - private static final BigInteger LONG_MIN_VALUE = BigInteger.valueOf(Long.MIN_VALUE); - - // Private data. - private int truncated_ = 0; - private long value_ = 0; - private int vrm_; //@trunc3 - - SQLBigint(int vrm) //@trunc3 - { //@trunc3 - vrm_ = vrm; //@trunc3 - } //@trunc3 - - public Object clone() - { - return new SQLBigint(vrm_); //@trunc3 - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = BinaryConverter.byteArrayToLong(rawBytes, offset); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - BinaryConverter.longToByteArray(value_, rawBytes, offset); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - truncated_ = 0; - - if(object instanceof String) - { - // @BWS - changed how we parse this because people want to pass in 111222.333 for an int - // and using a double is causing rounding errors. We use a BigDecimal for the - // case that we have to "try again" because if people were interested in performance - // they would not set a floating point value on an integer field and expect it to work - // so we would never hit the BigDecimal code path... - - try - { - value_ = Long.parseLong((String)object); - } - catch(NumberFormatException nfe) - { - try - { - BigInteger bigInteger = new BigDecimal((String)object).toBigInteger(); - if((bigInteger.compareTo(LONG_MAX_VALUE) > 0) || (bigInteger.compareTo(LONG_MIN_VALUE) < 0)) - { - truncated_ = bigInteger.toByteArray().length - 8; - //@trunc3 match native for ps.setString() to throw mismatch instead of truncation - if(vrm_ >= JDUtilities.vrm610) //@trunc3 - { //@trunc3 - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); //@trunc3 - } //@trunc3 - } - value_ = bigInteger.longValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - } - } - } - - else if(object instanceof Number) - { - // Compute truncation by getting the value as a double - // and comparing it against MAX_VALUE/MIN_VALUE. - double doubleValue = ((Number)object).doubleValue(); - - if((doubleValue > Long.MAX_VALUE) || (doubleValue < Long.MIN_VALUE)) // @D9a - { - // Note: Truncated here is set to 1 byte because the - // value has to be something positive in order - // for the code that checks it to do the right - // thing. - truncated_ = 1; // @D9a - } - - value_ = ((Number)object).longValue(); - - // @D9d - // Compute truncation. @Wz put the following three lines back in - // double doubleValue = ((Number) object).doubleValue(); - // if(doubleValue != value_) - // truncated_ = Double.toString(doubleValue - value_).length() / 2; - } - - else if(object instanceof Boolean) - value_ = (((Boolean)object).booleanValue() == true) ? 1 : 0; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.BIGINT; - } - - //@E1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.Long"; - } - - public String getCreateParameters() - { - return null; - } - - public int getDisplaySize() - { - return 20; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "BIGINT"; - } - - public int getMaximumPrecision() - { - return 19; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 492; // @A1C - } - - public int getPrecision() - { - return 19; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.BIGINT; - } - - public String getTypeName() - { - return "BIGINT"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return 8; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(Long.toString(value_))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - if(scale <= 0) - return BigDecimal.valueOf(value_); - else - return BigDecimal.valueOf(value_).setScale(scale); - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new ByteArrayInputStream(BinaryConverter.longToByteArray(value_)); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - byte[] bytes = BinaryConverter.longToByteArray(value_); - return new AS400JDBCBlob(bytes, bytes.length); - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_ != 0); - } - - public byte getByte() - throws SQLException - { - if(value_ > Byte.MAX_VALUE || value_ < Byte.MIN_VALUE) - { - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 7; - - } - else - { - truncated_ = 3; - } - } - else - { - truncated_ = 1; - } - } - - return(byte) value_; - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - return BinaryConverter.longToByteArray(value_); - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - return new StringReader(Long.toString(value_)); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - String string = Long.toString(value_); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - return(double) value_; - } - - public float getFloat() - throws SQLException - { - if(value_ > Float.MAX_VALUE || value_ < -Float.MAX_VALUE) //@trunc min_val is a positive number. //Float.MIN_VALUE) - { - truncated_ = 4; - } - else - { - truncated_ = 0; - } - - return(float) value_; - } - - public int getInt() - throws SQLException - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 4; - } - else - { - truncated_ = 0; - } - - return(int) value_; - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return new Long(value_); - } - - public short getShort() - throws SQLException - { - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 6; - - } - else - { - truncated_ = 2; - } - } - - return(short) value_; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - return Long.toString(value_); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(Long.toString(value_))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; //@pdc - return new StringReader(Long.toString(value_)); //@pdc - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - truncated_ = 0; - String string = Long.toString(value_); - return new AS400JDBCNClob(string, string.length()); - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - return Long.toString(value_); - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - //@pda jdbc40 -/* ifdef JDBC40 */ - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLBinary.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLBinary.java deleted file mode 100644 index 1ee235a39..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLBinary.java +++ /dev/null @@ -1,641 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLBinary.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLBinary -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private SQLConversionSettings settings_; - private int maxLength_; - private int truncated_; - private AS400ByteArray typeConverter_; - private byte[] value_; - - SQLBinary(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - maxLength_ = maxLength; - truncated_ = 0; - typeConverter_ = new AS400ByteArray(maxLength); - value_ = new byte[maxLength]; - } - - public Object clone() - { - return new SQLBinary(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - value_ = (byte[])typeConverter_.toObject(rawBytes, offset); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - typeConverter_.toBytes(value_, rawBytes, offset); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(object instanceof String) - { - try - { - value_ = BinaryConverter.stringToBytes((String)object); - } - catch(NumberFormatException nfe) - { - // we throw a data type mismatch exception here because the - // value of the Clob contained characters that were not valid hex - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else if(object instanceof byte[]) - value_ = (byte[])object; - - else if(object instanceof InputStream) - { - //value_ = JDUtilities.streamToBytes((InputStream)object, scale); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(object instanceof Reader) - { - // value_ = SQLBinary.stringToBytes(JDUtilities.readerToString((Reader)object, scale)); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - stream.close(); //@scan1 - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - - stream.close(); //@scan1 - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Blob) - value_ = ((Blob)object).getBytes(1, (int)((Blob)object).length()); - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - try - { - value_ = BinaryConverter.stringToBytes(((Clob)object).getSubString(1, (int)((Clob)object).length())); - } - catch(NumberFormatException nfe) - { - // we throw a data type mismatch exception here because the - // value of the Clob contained characters that were not valid hex - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Set to the exact length. - int valueLength = value_.length; - if(valueLength < maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, valueLength); - value_ = newValue; - truncated_ = 0; - } - else if(valueLength > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - truncated_ = valueLength - maxLength_; - } - else - truncated_ = 0; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.BINARY; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - public String getLiteralPrefix() - { - return "BINARY(X\'"; //@5WXVJX changed from x' - } - - public String getLiteralSuffix() - { - return "\')"; //@5WXVJX changed from ' - } - - public String getLocalName() - { - return "BINARY"; - } - - public int getMaximumPrecision() - { - return 32765; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 912; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.BINARY; - } - - public String getTypeName() - { - return "BINARY"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length; - } - - public String getJavaClassName() - { - return "[B"; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return new ByteArrayInputStream(getBytes()); - } - - public Blob getBlob() - throws SQLException - { - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCBlob(getBytes(), maxLength_); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length > maxFieldSize) && (maxFieldSize > 0)) - { - byte[] truncatedValue = new byte[maxFieldSize]; - System.arraycopy(value_, 0, truncatedValue, 0, maxFieldSize); - return truncatedValue; - } - else - { - return value_; - } - } - - public Reader getCharacterStream() - throws SQLException - { - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - - public Clob getClob() - throws SQLException - { - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCClob(BinaryConverter.bytesToHexString(getBytes()), maxLength_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return getBytes(); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - - //@PDA jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCNClob(BinaryConverter.bytesToHexString(getBytes()), maxLength_); - } -/* endif */ - - //@PDA jdbc40 - public String getNString() throws SQLException - { - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } - - //@PDA jdbc40 -/* ifdef JDBC40 */ - - public RowId getRowId() throws SQLException - { - //Decided this is of no use because rowid is so specific to the dbms internals. - //And there are issues in length and difficulties in converting a binary to a - //valid rowid that is useful. - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - //@PDA jdbc40 -/* ifdef JDBC40 */ - - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLBlob.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLBlob.java deleted file mode 100644 index c1e2aaa02..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLBlob.java +++ /dev/null @@ -1,670 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLBlob.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLBlob implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - private static final byte[] default_ = new byte[0]; - - private int maxLength_; - private int truncated_; - private byte[] value_ = default_; - private Object savedObject_; // This is our byte[] or InputStream or whatever that we save to convert to bytes until we really need to. - private int scale_ = -1; // This is our length. - - SQLBlob(int maxLength, SQLConversionSettings settings) - { - maxLength_ = maxLength; - } - - public Object clone() - { - return new SQLBlob(maxLength_, null); - } - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int length = BinaryConverter.byteArrayToInt(rawBytes, offset); - value_ = new byte[length]; - System.arraycopy(rawBytes, offset+4, value_, 0, value_.length); - savedObject_ = null; - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - if(savedObject_ != null) doConversion(); - - BinaryConverter.intToByteArray(value_.length, rawBytes, offset); - System.arraycopy(value_, 0, rawBytes, offset+4, value_.length); - } - - public void set(Object object, Calendar calendar, int scale) throws SQLException - { - // If it's a byte[] we check for data truncation. - if(object instanceof byte[]) - { - byte[] bytes = (byte[])object; - truncated_ = (bytes.length > maxLength_ ? bytes.length-maxLength_ : 0); - } - else if(object instanceof String) - { - byte[] bytes = null; - try - { - bytes = BinaryConverter.stringToBytes((String)object); - } - catch(NumberFormatException nfe) - { - // the String contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - object = bytes; - truncated_ = 0; - } - else if(object instanceof Reader) - { - int length = scale; // hack to get the length into the set method - byte[] bytes = null; - if(length >= 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - bytes = baos.toByteArray(); - - if(bytes.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - int objectLength = bytes.length; - if(bytes.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(bytes, 0, newValue, 0, maxLength_); - bytes = newValue; - } - stream.close(); //@scan1 - object = bytes; - truncated_ = objectLength - bytes.length; - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - bytes = baos.toByteArray(); - - int objectLength = bytes.length; - if(bytes.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(bytes, 0, newValue, 0, maxLength_); - bytes = newValue; - } - stream.close(); //@scan1 - object = bytes; - truncated_ = objectLength - bytes.length; - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if((JDUtilities.JDBCLevel_ >= 20 && !(object instanceof Blob)) && - !(object instanceof InputStream)) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - savedObject_ = object; - if(scale != -1) scale_ = scale; - } - - private void doConversion() - throws SQLException - { - try - { - Object object = savedObject_; - if(object instanceof byte[]) - { - value_ = (byte[]) object; - int objectLength = value_.length; - if(value_.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - } - truncated_ = objectLength - value_.length; - } - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Blob) - { - Blob blob = (Blob) object; - int blobLength = (int)blob.length(); - int lengthToUse = blobLength < 0 ? 0x7FFFFFFF : blobLength; - if(lengthToUse > maxLength_) lengthToUse = maxLength_; - value_ = blob.getBytes(1, lengthToUse); - truncated_ = blobLength - lengthToUse; - } - else if(object instanceof InputStream) - { - int length = scale_; // hack to get the length into the set method - if(length >= 0) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - - value_ = baos.toByteArray(); - - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - int objectLength = value_.length; - if(value_.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - } - truncated_ = objectLength - value_.length; - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - - value_ = baos.toByteArray(); - - int objectLength = value_.length; - if(value_.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - } - truncated_ = objectLength - value_.length; - } - else - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - } - finally - { - savedObject_ = null; - } - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.BLOB; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCBlob"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "BLOB"; - } - - public int getMaximumPrecision() - { - return AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; //@xml3 // the DB2 SQL reference says this should be 2147483647 but we return 1 less to allow for NOT NULL columns - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 404; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.BLOB; - } - - public String getTypeName() - { - return "BLOB"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; //@CRS - Why is this true? - } - - public int getActualSize() - { - return value_.length; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(BinaryConverter.bytesToHexString(value_))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) //@CRS - Could use a Converter here to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new ByteArrayInputStream(value_); - } - - public Blob getBlob() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCBlob(value_, maxLength_); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return value_; - } - - public Reader getCharacterStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new StringReader(BinaryConverter.bytesToHexString(value_)); - } - - public Clob getClob() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - String string = BinaryConverter.bytesToHexString(value_); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) //@CRS - Could use toLong() to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() //@CRS - Could use a Converter here to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() //@CRS - Could use a Converter here to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() //@CRS - Could use a Converter here to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() //@CRS - Could use a Converter here to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCBlob(value_, maxLength_); - } - - public short getShort() //@CRS - Could use a Converter here to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return BinaryConverter.bytesToHexString(value_); - } - - public Time getTime(Calendar calendar) //@CRS - Could use toLong() to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) //@CRS - Could use toLong() to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(BinaryConverter.bytesToHexString(value_))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - if(savedObject_ != null) doConversion(); //@pdc - truncated_ = 0; //@pdc - return new StringReader(BinaryConverter.bytesToHexString(value_)); //@pdc - } - - //@PDA jdbc40 -/* ifdef JDBC40 */ - - public NClob getNClob() throws SQLException - { - if(savedObject_ != null) doConversion(); //@pdc - truncated_ = 0;//@pdc - String string = BinaryConverter.bytesToHexString(value_); //@pdc - return new AS400JDBCNClob(string, string.length()); //@pdc - } -/* endif */ - //@PDA jdbc40 - public String getNString() throws SQLException - { - if(savedObject_ != null) doConversion(); //@pdc - truncated_ = 0; //@pdc - return BinaryConverter.bytesToHexString(value_); //@pdc - } -/* ifdef JDBC40 */ - - //@PDA jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@PDA jdbc40 - public SQLXML getSQLXML() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - //String string = BinaryConverter.bytesToHexString(value_); //@xml2 - return new AS400JDBCSQLXML(value_, maxLength_); //@xml2 - //return new AS400JDBCSQLXML(string, string.length()); //@xml2 - } -/* endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLBlobLocator.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLBlobLocator.java deleted file mode 100644 index 2c67da6ff..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLBlobLocator.java +++ /dev/null @@ -1,877 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLBlobLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - - -final class SQLBlobLocator implements SQLLocator -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private AS400JDBCConnection connection_; - private ConvTable converter_; - private int id_; - private JDLobLocator locator_; - private int maxLength_; - private SQLConversionSettings settings_; - private int truncated_; - private int columnIndex_; - private byte[] value_; //@loch //Note that value_ is not used as the output for a ResultSet.getX() call. We Get the value from a call to the JDLocator (not from value_) and not from the savedObject_, unless resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - - private Object savedObject_; // This is the AS400JDBCBlobLocator or InputStream or whatever got set into us. - private int scale_; // This is actually the length that got set into us. - - SQLBlobLocator(AS400JDBCConnection connection, - int id, - int maxLength, - SQLConversionSettings settings, - ConvTable converter, - int columnIndex) - { - connection_ = connection; - id_ = id; - locator_ = new JDLobLocator(connection, id, maxLength, false); //@CRS - We know it's not graphic, because we are not a DBClob. - maxLength_ = maxLength; - settings_ = settings; - truncated_ = 0; - converter_ = converter; - columnIndex_ = columnIndex; - } - - public Object clone() - { - return new SQLBlobLocator(connection_, id_, maxLength_, settings_, converter_, columnIndex_); - } - - public void setHandle(int handle) - { - locator_.setHandle(handle); - } - - //@loch - public int getHandle() - { - return locator_.getHandle(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int locatorHandle = BinaryConverter.byteArrayToInt(rawBytes, offset); - locator_.setHandle(locatorHandle); - locator_.setColumnIndex(columnIndex_); - } - - //@CRS - This is only called from AS400JDBCPreparedStatement in one place. - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - BinaryConverter.intToByteArray(locator_.getHandle(), rawBytes, offset); - - // Now we write our saved data to the system, because the prepared statement is being executed. - // We used to write the data to the system on the call to set(), but this messed up - // batch executes, since the host server only reserves temporary space for locator handles one row at a time. - // See the toObject() method in this class for more details. - if(savedObject_ != null) writeToServer(); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - // This method actually writes the data to the system. - private void writeToServer() - throws SQLException - { - if(savedObject_ instanceof byte[]) - { - byte[] bytes = (byte[])savedObject_; - locator_.writeData(0, bytes, true); //@K1A - } - else if(savedObject_ instanceof InputStream) - { - int length = scale_; // hack to get the length into the set method - - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); //@K1A - } - else if(length > 0) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - locator_.writeData(totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. @K1A - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - if(totalBytesRead < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2 ) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - locator_.writeData(totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. @K1A - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(JDUtilities.JDBCLevel_ >= 20 && savedObject_ instanceof Blob) //@H0A check for jdbc level to know if lobs exist - { - // @A1C - //@G5A Start new code for updateable locator case to go through the Vectors - //@G5A and update the blob copy when ResultSet.updateBlob() is called. - boolean set = false; - if(savedObject_ instanceof AS400JDBCBlobLocator) - { - AS400JDBCBlobLocator blob = (AS400JDBCBlobLocator)savedObject_; - - //Synchronize on a lock so that the user can't keep making updates - //to the blob while we are taking updates off the vectors. - synchronized(blob) - { - // See if we saved off our real object from earlier. - if(blob.savedObject_ != null) - { - savedObject_ = blob.savedObject_; - scale_ = blob.savedScale_; - blob.savedObject_ = null; - writeToServer(); - return; - } - } - } - - //@G5A If the code for updateable lob locators did not run, then run old code. - if(!set) - { - Blob blob = (Blob)savedObject_; // @A1C - int length = (int)blob.length(); - byte[] data = blob.getBytes(1, length); - locator_.writeData(0, data, 0, length, true); //@K1A - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - // If it's a byte[] we can check for data truncation. - if(object instanceof byte[]) - { - byte[] bytes = (byte[])object; - truncated_ = (bytes.length > maxLength_ ? bytes.length-maxLength_ : 0); - } - else if(object instanceof String) - { - byte[] bytes = null; - try - { - bytes = BinaryConverter.stringToBytes((String)object); - } - catch(NumberFormatException nfe) - { - // the String contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - object = bytes; - truncated_ = 0; - } - else if(object instanceof Reader) - { - int length = scale; // hack to get the length into the set method - byte[] bytes = null; - if(length >= 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - bytes = baos.toByteArray(); - - if(bytes.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - int objectLength = bytes.length; - if(bytes.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(bytes, 0, newValue, 0, maxLength_); - bytes = newValue; - } - stream.close(); //@scan1 - object = bytes; - truncated_ = objectLength - bytes.length; - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - bytes = baos.toByteArray(); - - int objectLength = bytes.length; - if(bytes.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(bytes, 0, newValue, 0, maxLength_); - bytes = newValue; - } - stream.close(); //@scan1 - object = bytes; - truncated_ = objectLength - bytes.length; - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(!(object instanceof String) && - (JDUtilities.JDBCLevel_ >= 20 && !(object instanceof Blob)) && - !(object instanceof Reader) && - !(object instanceof InputStream)) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - savedObject_ = object; - if(scale != -1) scale_ = scale; // Skip resetting it if we don't know the real length - } - - //@loch method to temporary convert from object input to output before even going to host (writeToServer() does the conversion needed before writting to host) - //This will only be used when resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - //Purpose is to do a local type conversion from obj1 to obj2 like other non-locator lob types - private void doConversion() - throws SQLException - { - try - { - Object object = savedObject_; - if(object instanceof byte[]) - { - value_ = (byte[]) object; - int objectLength = value_.length; - if(value_.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - } - truncated_ = objectLength - value_.length; - } - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Blob) - { - Blob blob = (Blob) object; - int blobLength = (int)blob.length(); - int lengthToUse = blobLength < 0 ? 0x7FFFFFFF : blobLength; - if(lengthToUse > maxLength_) lengthToUse = maxLength_; - value_ = blob.getBytes(1, lengthToUse); - truncated_ = blobLength - lengthToUse; - } - else if(object instanceof InputStream) - { - int length = scale_; // hack to get the length into the set method - if(length >= 0) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - - value_ = baos.toByteArray(); - - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - int objectLength = value_.length; - if(value_.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - } - truncated_ = objectLength - value_.length; - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - - value_ = baos.toByteArray(); - - int objectLength = value_.length; - if(value_.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - } - truncated_ = objectLength - value_.length; - } - else - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - } - finally - { - //nothing - } - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.BLOB_LOCATOR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - //@D1A JDBC 3.0 - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCBlobLocator"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "BLOB"; - } - - public int getMaximumPrecision() - { - return AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; //@xml3 // the DB2 SQL reference says this should be 2147483647 but we return 1 less to allow for NOT NULL columns - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 960; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.BLOB; - } - - public String getTypeName() - { - return "BLOB"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return maxLength_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - //return new AS400JDBCInputStream(new JDLobLocator(locator_)); - - // fix this to use a Stream - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new AS400JDBCInputStream(new JDLobLocator(locator_)); - } - - public Blob getBlob() - throws SQLException - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCBlob(value_, maxLength_); //@loch - } //@loch - - // We don't want to give out our internal locator to the public, - // otherwise when we go to change its handle on the next row, they'll - // get confused. So we have to clone it. - truncated_ = 0; - return new AS400JDBCBlobLocator(new JDLobLocator(locator_), savedObject_, scale_); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - throws SQLException - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return value_;//@loch - } //@loch - - int locatorLength = (int)locator_.getLength(); - if(locatorLength == 0) return new byte[0]; - DBLobData data = locator_.retrieveData(0, locatorLength); - int actualLength = data.getLength(); - byte[] bytes = new byte[actualLength]; - System.arraycopy(data.getRawBytes(), data.getOffset(), bytes, 0, actualLength); - truncated_ = 0; - return bytes; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - //return new InputStreamReader(new AS400JDBCInputStream(new JDLobLocator(locator_))); - - // fix this to use a Stream - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - String string = BinaryConverter.bytesToHexString(getBytes()); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - // toObject is used by AS400JDBCPreparedStatement for batching, so we save off our InputStream - // inside the AS400JDBCBlobLocator. Then, when convertToRawBytes() is called, the writeToServer() - // code checks the AS400JDBCBlobLocator's saved InputStream... if it exists, then it writes the - // data out of the InputStream to the system by calling writeToServer() again. - - // Since toObject could also be called from an external user's standpoint, we have - // to clone our internal locator (because we reuse it internally). - // This doesn't make much sense, since we technically can't reuse it because - // the prepared statement is calling toObject() to store off the parameters, - // but it's all we can do for now. - truncated_ = 0; - return new AS400JDBCBlobLocator(new JDLobLocator(locator_), savedObject_, scale_); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - return BinaryConverter.bytesToHexString(getBytes()); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - //return new AS400JDBCInputStream(new JDLobLocator(locator_)); - - // fix this to use a Stream - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; //@PDC - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); //@PDC - } - - //@PDA jdbc40 -/* ifdef JDBC40 */ - - public NClob getNClob() throws SQLException - { - truncated_ = 0; - String string = BinaryConverter.bytesToHexString(getBytes());//@pdc - return new AS400JDBCNClob(string, string.length()); //@pdc - } -/* endif */ - //@PDA jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; //@pdc - return BinaryConverter.bytesToHexString(getBytes()); //@pdc - } - -/* ifdef JDBC40 */ - - //@PDA jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - -/* ifdef JDBC40 */ - - //@PDA jdbc40 - public SQLXML getSQLXML() throws SQLException - { - truncated_ = 0; - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCSQLXML(value_, value_.length);//@loch - } //@loch - - String string = BinaryConverter.bytesToHexString(getBytes()); - //return new AS400JDBCSQLXML(string, string.length()); - return new AS400JDBCSQLXMLLocator(new JDLobLocator(locator_), savedObject_, scale_); //@xml3 - } - -/* endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLChar.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLChar.java deleted file mode 100644 index 9ba5df754..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLChar.java +++ /dev/null @@ -1,716 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLChar.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.CharConversionException; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.net.URL; - -final class SQLChar -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int maxLength_; - private int truncated_; - private String value_; - - SQLChar(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; // @C4C - } - - public Object clone() - { - return new SQLChar(maxLength_,settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - try{ - value_ = ccsidConverter.byteArrayToString(rawBytes, offset, maxLength_, bidiConversionProperties); //@KBC bidiStringType); - }catch(Exception e){ - JDError.throwSQLException(JDError.EXC_CHAR_CONVERSION_INVALID, e); - } - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - try - { - //in cases of variable length chars, check for truncation after conversion - truncated_ = ccsidConverter.stringToByteArray(value_, rawBytes, offset, maxLength_, bidiConversionProperties); //@KBC bidiStringType); //@trnc - } - catch(CharConversionException e) - { - maxLength_ = ccsidConverter.stringToByteArray(value_, bidiConversionProperties).length; //@KBC changed to use bidiConversionProperties_ instead of bidiStringType - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e, "Change Descriptor"); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - String value = null; // @C2A - - if(object instanceof String) - value = (String)object; // @C2C - - else if(object instanceof Character) - value = object.toString(); - - else if(object instanceof Number) - value = object.toString(); // @C2C - - else if(object instanceof Boolean) - { - // @PDC - // if "translate boolean" == false, then use "0" and "1" values to match native driver - if(settings_.getTranslateBoolean() == true) - value = object.toString(); //"true" or "false" - else - value = ((Boolean)object).booleanValue() == true ? "1" : "0"; - } - else if(object instanceof Time) - value = SQLTime.timeToString((Time)object, settings_, calendar); // @C2C - - else if(object instanceof Timestamp) - value = SQLTimestamp.timestampToString((Timestamp)object, calendar); // @C2C - - else if(object instanceof java.util.Date) // @F5M @F5C - value = SQLDate.dateToString((java.util.Date)object, settings_, calendar); // @C2C @F5C - - else if(object instanceof URL) - value = object.toString(); - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value = clob.getSubString(1, (int)clob.length()); - } - // @C2C -/* ifdef JDBC40 */ - - else if(object instanceof SQLXML) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value = xml.getString(); - } -/* endif */ - if(value == null) // @C2C - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - value_ = value; // @C2A - - // Set to the exact length. - int valueLength = value_.length(); - int exactLength = getDisplaySize(); // @C1A - if(valueLength < exactLength) // @C1C - { - StringBuffer buffer = new StringBuffer(value_); - char c = '\u0020'; // @F66c - Pad with single byte space for now - for(int i = valueLength; i < exactLength; ++i) // @C1C - buffer.append(c); //@F6C - value_ = buffer.toString(); - truncated_ = 0; - } - else if(valueLength > exactLength) - { // @C1C @F6C - value_ = value_.substring(0, exactLength); // @C1C - truncated_ = valueLength - exactLength; // @C1C - } - else - truncated_ = 0; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.CHAR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "CHAR"; - } - - public int getMaximumPrecision() - { - return 32765; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 452; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.CHAR; - } - - public String getTypeName() - { - return "CHAR"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(getString().trim())); // @F3C - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(getString())); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(getString()), maxLength_); - } - catch(NumberFormatException nfe) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true", "false", "1", or "0", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = getString().trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).byteValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - if(d > Byte.MAX_VALUE || d < Byte.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.byteValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(getString(), settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).intValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Integer.MAX_VALUE || d < Integer.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.intValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).longValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Long.MAX_VALUE || d < Long.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.longValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).shortValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Short.MAX_VALUE || d < Short.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.shortValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length() - maxFieldSize; - return value_.substring(0, maxFieldSize); - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(getString(), settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(getString(), calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - - try - { - return new ReaderInputStream(new StringReader(getString()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - // @A1A - // Added method trim() to trim the string. - public void trim() // @A1A - { // @A1A - value_ = value_.trim(); // @A1A - } // @A1A - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - - public RowId getRowId() throws SQLException - { - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this string contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - //@pda jdbc40 -/* ifdef JDBC40 */ - - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } -/* endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLCharForBitData.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLCharForBitData.java deleted file mode 100644 index d2377248b..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLCharForBitData.java +++ /dev/null @@ -1,671 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLCharForBitData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLCharForBitData -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private SQLConversionSettings settings_; - private int maxLength_; - private int truncated_; - private AS400ByteArray typeConverter_; - private byte[] value_; - - SQLCharForBitData(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - maxLength_ = maxLength; - truncated_ = 0; - typeConverter_ = new AS400ByteArray(maxLength); - value_ = new byte[maxLength]; - } - - public Object clone() - { - return new SQLCharForBitData(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = (byte[])typeConverter_.toObject(rawBytes, offset); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - typeConverter_.toBytes(value_, rawBytes, offset); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(object instanceof String) - { - try - { - value_ = BinaryConverter.stringToBytes((String)object); // @F1A - } - catch(NumberFormatException nfe) - { - // the String contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else if(object instanceof byte[]) - value_ = (byte[])object; // @C1C - - else if(object instanceof InputStream) - { - //value_ = JDUtilities.streamToBytes((InputStream)object, scale); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(length == -2 ) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(object instanceof Reader) - { - // value_ = BinaryConverter.stringToBytes(JDUtilities.readerToString((Reader)object, scale)); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - stream.close(); //@scan1 - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - stream.close(); //@scan1 - - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Blob) - value_ = ((Blob)object).getBytes(1, (int)((Blob)object).length()); // @C1C @E2C Blobs are 1 based. - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - try - { - value_ = BinaryConverter.stringToBytes(((Clob)object).getSubString(1, (int)((Clob)object).length())); //@F1A - } - catch(NumberFormatException nfe) - { - // the Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - - // Set to the exact length. - int valueLength = value_.length; - if(valueLength < maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, valueLength); - value_ = newValue; - truncated_ = 0; - } - else if(valueLength > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - truncated_ = valueLength - maxLength_; - } - else - truncated_ = 0; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.CHAR_FOR_BIT_DATA; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - public String getLiteralPrefix() - { - return "X\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - // Use "CHAR" not "BINARY". See ODBC SQLGetTypeInfo(). - return "CHAR() FOR BIT DATA"; //@KKB changed from CHAR - } - - public int getMaximumPrecision() - { - return 32765; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 452; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.BINARY; - } - - public String getTypeName() - { - return "CHAR() FOR BIT DATA"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length; - } - - //@F2A JDBC 3.0 - public String getJavaClassName() - { - return "[B"; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - - // changed to return stream containing hex string - // return new ByteArrayInputStream(toBytes()); - - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - - return new ByteArrayInputStream(getBytes()); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - - return new AS400JDBCBlob(getBytes(), maxLength_); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length - maxFieldSize; - byte[] truncatedValue = new byte[maxFieldSize]; - System.arraycopy(value_, 0, truncatedValue, 0, maxFieldSize); - return truncatedValue; - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - //@F1D return new StringReader (new String(toBytes())); - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); //@F1A - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - //@F1D return new AS400JDBCClob(new String(toBytes())); - return new AS400JDBCClob(BinaryConverter.bytesToHexString(getBytes()), maxLength_); //@F1A - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return getBytes(); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - //@F1D return new String (toBytes()); - return BinaryConverter.bytesToHexString(getBytes()); //@F1A - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - - // changed to return stream containing hex string - // return new ByteArrayInputStream(toBytes()); - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - - //@PDA jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCNClob(BinaryConverter.bytesToHexString(getBytes()), maxLength_); - } -/* endif */ - - //@PDA jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } - - //@PDA jdbc40 -/* ifdef JDBC40 */ - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - //@PDA jdbc40 -/* ifdef JDBC40 */ - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLClob.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLClob.java deleted file mode 100644 index 4af11706d..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLClob.java +++ /dev/null @@ -1,629 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLClob.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -/* ifdef JDBC40 */ -import java.sql.SQLXML; //@PDA jdbc40 -/* endif */ -final class SQLClob implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private int length_; // Length of string, in characters. - private int maxLength_; // Max length of field, in bytes. - private SQLConversionSettings settings_; - private int truncated_; - private String value_; - private Object savedObject_; // This is our byte[] or InputStream or whatever that we save to convert to bytes until we really need to. - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLClob(int maxLength, SQLConversionSettings settings) - { - length_ = 0; - maxLength_ = maxLength; - settings_ = settings; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLClob(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToInt(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - value_ = ccsidConverter.byteArrayToString(rawBytes, offset + 4, length_, bidiConversionProperties); //@KBC changed to used bidiConversionProperties instead of bidiStringType - savedObject_ = null; - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - if(savedObject_ != null) doConversion(); - - //@PDC change to do same as SQLVarchar to get true length of byte array instead of number of chars - //BinaryConverter.intToByteArray(length_, rawBytes, offset); - try - { - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - //@PDC ccsidConverter.stringToByteArray(value_, rawBytes, offset + 4, maxLength_, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - byte[] temp = ccsidConverter.stringToByteArray(value_, bidiConversionProperties); - // The length in the first 4 bytes is actually the length in characters. - BinaryConverter.intToByteArray(temp.length, rawBytes, offset); - if(temp.length > maxLength_) - { - maxLength_ = temp.length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL, "Change Descriptor"); - } - System.arraycopy(temp, 0, rawBytes, offset+4, temp.length); - } - catch(Exception e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - //@selins1 make same as SQLCloblocator - // If it's a String we check for data truncation. - if(object instanceof String) - { - String s = (String)object; - int byteLength = s.length(); //@selins1 - truncated_ = (byteLength > maxLength_ ? byteLength-maxLength_ : 0); - } - //@PDD jdbc40 (JDUtilities.JDBCLevel_ >= 20 incorrect logic, but n/a now - else if(!(object instanceof Clob) && //@PDC NClob extends Clob - !(object instanceof Reader) && //@PDC jdbc40 - !(object instanceof InputStream) -/* ifdef JDBC40 */ - && !(object instanceof SQLXML) -/* endif */ - ) //@PDC jdbc40 - - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - savedObject_ = object; - if(scale != -1) length_ = scale; - } - - private void doConversion() - throws SQLException - { - try - { - Object object = savedObject_; - if(savedObject_ instanceof String) - { - value_ = (String)object; - } - else if(object instanceof Reader) - { - if(length_ >= 0) - { - try - { - int blockSize = length_ < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length_ : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 && totalCharsRead < length_) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - int charsRemaining = length_ - totalCharsRead; - if(charsRemaining < blockSize) - { - blockSize = charsRemaining; - } - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - - if(value_.length() < length_) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length_ == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - // int charsRemaining = length_ - totalCharsRead; - - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value_ = clob.getSubString(1, (int)clob.length()); - } -/* ifdef JDBC40 */ - else if( object instanceof SQLXML ) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value_ = xml.getString(); - } -/* endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - // Truncate if necessary. - int valueLength = value_.length(); - if(valueLength > maxLength_) - { - value_ = value_.substring(0, maxLength_); - truncated_ = valueLength - maxLength_; - } - else - { - truncated_ = 0; - } - - length_ = value_.length(); - } - finally - { - savedObject_ = null; - } - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.CLOB; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCClob"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "CLOB"; - } - - public int getMaximumPrecision() - { - return AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; //@xml3 // the DB2 SQL reference says this should be 2147483647 but we return 1 less to allow for NOT NULL columns - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 408; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.CLOB; - } - - public String getTypeName() - { - return "CLOB"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_)); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new HexReaderInputStream(new StringReader(value_)); - } - - public Blob getBlob() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(value_), maxLength_); - } - catch(NumberFormatException nfe) - { - // this Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public byte[] getBytes() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(value_); - } - catch(NumberFormatException nfe) - { - // this Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new StringReader(value_); - } - - public Clob getClob() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCClob(value_, maxLength_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public Object getObject() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCClob(value_, maxLength_); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public String getString() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return value_; - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(value_), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new StringReader(value_); - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCNClob(value_, maxLength_); - } -/* endif */ - //@pda jdbc40 - public String getNString() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return value_; - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public RowId getRowId() throws SQLException - { - // - //if(savedObject_ != null) doConversion(); - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this Clob contains non-hex characters - //JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - //return null; - //} - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - //@pda jdbc40 -/* ifdef JDBC40 */ - public SQLXML getSQLXML() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCSQLXML(value_.toCharArray()); - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLClobLocator.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLClobLocator.java deleted file mode 100644 index 31003ba4e..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLClobLocator.java +++ /dev/null @@ -1,974 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLClobLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - - -final class SQLClobLocator implements SQLLocator -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private AS400JDBCConnection connection_; - private SQLConversionSettings settings_; - private ConvTable converter_; - private int id_; - private JDLobLocator locator_; - private int maxLength_; - private int truncated_; - private int columnIndex_; - private String value_; //@loch //Note that value_ is not used as the output for a ResultSet.getX() call. We Get the value from a call to the JDLocator (not from value_) and not from the savedObject_, unless resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - - private Object savedObject_; // This is the AS400JDBCBlobLocator or InputStream or whatever got set into us. - private int scale_; // This is actually the length that got set into us. - - SQLClobLocator(AS400JDBCConnection connection, - int id, - int maxLength, - SQLConversionSettings settings, - ConvTable converter, - int columnIndex) - { - connection_ = connection; - id_ = id; - locator_ = new JDLobLocator(connection, id, maxLength, false); - maxLength_ = maxLength; - truncated_ = 0; - settings_ = settings; - converter_ = converter; - columnIndex_ = columnIndex; - } - - public Object clone() - { - return new SQLClobLocator(connection_, id_, maxLength_, settings_, converter_, columnIndex_); - } - - public void setHandle(int handle) - { - locator_.setHandle(handle); - } - - //@loch - public int getHandle() - { - return locator_.getHandle(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int locatorHandle = BinaryConverter.byteArrayToInt(rawBytes, offset); - locator_.setHandle(locatorHandle); - locator_.setColumnIndex(columnIndex_); - } - - //@CRS - This is only called from AS400JDBCPreparedStatement in one place. - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - BinaryConverter.intToByteArray(locator_.getHandle(), rawBytes, offset); - - // Now we write our saved data to the system, because the prepared statement is being executed. - // We used to write the data to the system on the call to set(), but this messed up - // batch executes, since the host server only reserves temporary space for locator handles one row at a time. - // See the toObject() method in this class for more details. - if(savedObject_ != null) writeToServer(); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - //@selins1 make same as SQLClob - // If it's a String we check for data truncation. - if(object instanceof String) - { - String s = (String)object; - int length = s.length(); - truncated_ = (length > maxLength_ ? length-maxLength_ : 0); - } - else if( !(object instanceof Reader) && - !(object instanceof InputStream) && - (JDUtilities.JDBCLevel_ >= 20 && !(object instanceof Clob)) -/* ifdef JDBC40 */ - && !(object instanceof SQLXML) -/* endif */ - ) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - savedObject_ = object; - if(scale != -1) scale_ = scale; // Skip resetting it if we don't know the real length - } - - //@loch method to temporary convert from object input to output before even going to host (writeToServer() does the conversion needed before writing to host) - //This will only be used when resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - //Purpose is to do a local type conversion from obj1 to obj2 like other non-locator lob types - private void doConversion() - throws SQLException - { - int length_ = scale_; - - if( length_ == -1) - { - try{ - //try to get length from locator - length_ = (int)locator_.getLength(); - }catch(Exception e){ } - } - - try - { - Object object = savedObject_; - if(savedObject_ instanceof String) - { - value_ = (String)object; - } - else if(object instanceof Reader) - { - if(length_ >= 0) - { - try - { - int blockSize = length_ < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length_ : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 && totalCharsRead < length_) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - int charsRemaining = length_ - totalCharsRead; - if(charsRemaining < blockSize) - { - blockSize = charsRemaining; - } - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - - if(value_.length() < length_) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length_ == -2)//@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if( object instanceof Clob) - { - Clob clob = (Clob)object; - value_ = clob.getSubString(1, (int)clob.length()); - } -/* ifdef JDBC40 */ - else if( object instanceof SQLXML ) - { - SQLXML xml = (SQLXML)object; - value_ = xml.getString(); - } -/* endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - // Truncate if necessary. - int valueLength = value_.length(); - if(valueLength > maxLength_) - { - value_ = value_.substring(0, maxLength_); - } - } - finally - { - //nothing - } - } - - private void writeToServer() - throws SQLException - { - try - { - Object object = savedObject_; - if(object instanceof String) - { - String string = (String)object; - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = converter_.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - byte[] bytes = converter_.stringToByteArray(string, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - locator_.writeData(0L, bytes, true); //@K1C - } - else if(object instanceof Reader) - { - int length = scale_; // hack to get the length into the set method - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); //@K1C - } - else if(length > 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = converter_.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - ReaderInputStream stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); //@KBC changed to use bidiConversionProperties instead of bidiStringType - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - locator_.writeData((long)totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. @K1C - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - if(stream.available() == 0 && blockSize != 0) - { - stream.close(); //@scan1 - stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); // do this so we don't read more chars out of the Reader than we have to. //@KBC changed to use bidiConversionProperties instead of bidiStringType - } - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - stream.close(); //@scan1 - - if(totalBytesRead < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2)//@readerlen new else-if block (read all data) - { - try - { - //String readerStr = JDUtilities.readerToString((Reader)savedObject_); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = converter_.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - ReaderInputStream stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); //@KBC changed to use bidiConversionProperties instead of bidiStringType - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - locator_.writeData((long)totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. @K1C - totalBytesRead += bytesRead; - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - stream.close(); //@scan1 - - - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(object instanceof InputStream) - { - int length = scale_; // hack to get the length into the set method - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); //@K1C - } - else if(length > 0) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - locator_.writeData((long)totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. @K1C - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - if(totalBytesRead < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2)//@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - locator_.writeData((long)totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. @K1C - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) //@H0A check for jdbc level to know if lobs exist - { - //@G5A Start new code for updateable locator case - boolean set = false; - if(object instanceof AS400JDBCClobLocator) - { - AS400JDBCClobLocator clob = (AS400JDBCClobLocator)object; - - //Synchronize on a lock so that the user can't keep making updates - //to the clob while we are taking updates off the vectors. - synchronized(clob) - { - // See if we saved off our real object from earlier. - if(clob.savedObject_ != null) - { - savedObject_ = clob.savedObject_; - scale_ = clob.savedScale_; - clob.savedObject_ = null; - writeToServer(); - return; - } - } - } - - //@G5A If the code for updateable lob locators did not run, then run old code. - if(!set) - { - Clob clob = (Clob)object; - int length = (int)clob.length(); - String substring = clob.getSubString(1, length); - locator_.writeData(0L, converter_.stringToByteArray(substring), 0, length, true); //@K1C - set = true; - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } -/* ifdef JDBC40 */ - else if( object instanceof SQLXML ) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - - String stringVal = xml.getString(); - locator_.writeData(0L, converter_.stringToByteArray(stringVal), 0, stringVal.length(), true); - } -/* endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - finally - { - savedObject_ = null; - } - scale_ = (int)locator_.getLength(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.CLOB_LOCATOR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCClobLocator"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "CLOB"; - } - - public int getMaximumPrecision() - { - return AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; //@xml3 // the DB2 SQL reference says this should be 2147483647 but we return 1 less to allow for NOT NULL columns - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 964; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.CLOB; - } - - public String getTypeName() - { - return "CLOB"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return maxLength_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_));//@loch - } //@loch - - return new ReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()), 819); // ISO-8859-1. - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new HexReaderInputStream(new StringReader(value_)); //@loch - } //@loch - - return new HexReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - byte[] bytes = BinaryConverter.stringToBytes(getString()); - return new AS400JDBCBlob(bytes, bytes.length); - } - catch(NumberFormatException nfe) - { - // this Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - // this Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new StringReader(value_); //@loch - } //@loch - - return new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCClob(value_, maxLength_); //@loch - } //@loch - - return new AS400JDBCClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // getObject is used by AS400JDBCPreparedStatement for batching, so we save off our InputStream - // inside the AS400JDBCClobLocator. Then, when convertToRawBytes() is called, the writeToServer() - // code checks the AS400JDBCClobLocator's saved InputStream... if it exists, then it writes the - // data out of the InputStream to the system by calling writeToServer() again. - return new AS400JDBCClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public String getString() - throws SQLException - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return value_; //@loch - } //@loch - - DBLobData data = locator_.retrieveData(0, locator_.getMaxLength()); - String value = converter_.byteArrayToString(data.getRawBytes(), - data.getOffset(), - data.getLength()); - truncated_ = 0; //@pda make consistent with other SQLData Clob classes - return value; - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new ReaderInputStream(new StringReader(value_), 13488); //@loch - } //@loch - - - return new ReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); - return null; - } - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new StringReader(value_); //@loch - } //@loch - - try - { - return new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCNClob(value_, maxLength_); //@loch - } //@loch - - return new AS400JDBCNClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - - } -/* endif */ - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return value_; //@loch - } //@loch - - DBLobData data = locator_.retrieveData(0, locator_.getMaxLength()); - String value = converter_.byteArrayToString(data.getRawBytes(), - data.getOffset(), - data.getLength()); - return value; - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public RowId getRowId() throws SQLException - { - - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(getString())); - //} - //catch(NumberFormatException nfe) - //{ - // this Clob contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - //@pda jdbc40 -/* ifdef JDBC40 */ - public SQLXML getSQLXML() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCSQLXML(value_, maxLength_); //@loch - } //@loch - - //return new AS400JDBCSQLXML( getString().toCharArray() ); - return new AS400JDBCSQLXMLLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_, false); //@xml3 //@xml4 - } -/* endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLDBClob.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLDBClob.java deleted file mode 100644 index fb2798538..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLDBClob.java +++ /dev/null @@ -1,617 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLDBClob.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLDBClob implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - private int length_; // Length of string, in characters. @E3C - private int maxLength_; // Max length of field, in bytes. @E3C - private SQLConversionSettings settings_; - private int truncated_; - private String value_; - private Object savedObject_; // This is our byte[] or InputStream or whatever that we save to convert to bytes until we really need to. - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLDBClob(int maxLength, SQLConversionSettings settings) - { - length_ = 0; - maxLength_ = maxLength; - settings_ = settings; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLDBClob(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToInt(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - // If the field is DBCLOB, length_ contains the number - // of characters in the string, while the converter is expecting - // the number of bytes. Thus, we need to multiply length_ by 2. - value_ = ccsidConverter.byteArrayToString(rawBytes, offset + 4, length_*2, bidiConversionProperties); //@KBA changed to use bidiConversionProperties instead of bidiStringType - savedObject_ = null; - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - if(savedObject_ != null) doConversion(); - - BinaryConverter.intToByteArray(length_, rawBytes, offset); - try - { - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - ccsidConverter.stringToByteArray(value_, rawBytes, offset + 4, maxLength_, bidiConversionProperties); //@KBC changed to bidiConversionProperties instead of bidiStringType - } - catch(Exception e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - //@selins1 make similar to SQLDBClobLocator - // If it's a String we check for data truncation. - if(object instanceof String) - { - String s = (String)object; - int byteLength = s.length() * 2; //@selins1 - truncated_ = (byteLength > maxLength_ ? byteLength-maxLength_ : 0); //@selins1 - } else if( !(object instanceof Reader) && - !(object instanceof InputStream) && - (JDUtilities.JDBCLevel_ >= 20 && !(object instanceof Clob)) -/* ifdef JDBC40 */ - && !(object instanceof SQLXML) -/* endif */ - - - ) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - savedObject_ = object; - if(scale != -1) length_ = scale; - } - - private void doConversion() throws SQLException - { - try - { - Object object = savedObject_; - if(savedObject_ instanceof String) - { - value_ = (String)object; - } - else if(object instanceof Reader) - { - if(length_ >= 0) - { - try - { - int blockSize = length_ < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length_ : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 && totalCharsRead < length_) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - int charsRemaining = length_ - totalCharsRead; - if(charsRemaining < blockSize) - { - blockSize = charsRemaining; - } - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length_ == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 ) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value_ = clob.getSubString(1, (int)clob.length()); - } -/* ifdef JDBC40 */ - - else if(object instanceof SQLXML) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value_ = xml.getString(); - } -/* endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - // Truncate if necessary. - int valueLength = value_.length(); - if(valueLength > maxLength_) - { - value_ = value_.substring(0, maxLength_); - truncated_ = valueLength - maxLength_; - } - else - { - truncated_ = 0; - } - - length_ = value_.length(); - } - finally - { - savedObject_ = null; - } - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.DBCLOB; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return(maxLength_ / 2); - } - - - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCClob"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "DBCLOB"; - } - - public int getMaximumPrecision() - { - return 1073741822; // the DB2 SQL reference says this should be 1073741823 but we return 1 less to allow for NOT NULL columns - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 412; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.CLOB; - } - - public String getTypeName() - { - return "DBCLOB"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_)); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new HexReaderInputStream(new StringReader(value_)); - } - - public Blob getBlob() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(value_), maxLength_); - } - catch(NumberFormatException nfe) - { - // this DBClob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public byte[] getBytes() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(value_); - } - catch(NumberFormatException nfe) - { - // this DBClob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new StringReader(value_); - } - - public Clob getClob() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCClob(value_, maxLength_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public Object getObject() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCClob(value_, maxLength_); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public String getString() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return value_; - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(value_), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new StringReader(value_); - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - - public NClob getNClob() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCNClob(value_, maxLength_); - } -/* endif */ - //@pda jdbc40 - public String getNString() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return value_; - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - - public RowId getRowId() throws SQLException - { - - //if(savedObject_ != null) doConversion(); - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this Clob contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - //@pda jdbc40 -/* ifdef JDBC40 */ - public SQLXML getSQLXML() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCSQLXML(value_.toCharArray()); - } -/* endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLDBClobLocator.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLDBClobLocator.java deleted file mode 100644 index c52d90aa0..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLDBClobLocator.java +++ /dev/null @@ -1,958 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLDBClobLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLDBClobLocator implements SQLLocator -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private AS400JDBCConnection connection_; - private ConvTable converter_; - private int id_; - private JDLobLocator locator_; - private int maxLength_; //note length in chars - private SQLConversionSettings settings_; - private int truncated_; - private int columnIndex_; - private String value_; //@loch //Note that value_ is not used as the output for a ResultSet.getX() call. We Get the value from a call to the JDLocator (not from value_) and not from the savedObject_, unless resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - - private Object savedObject_; // This is the AS400JDBCBlobLocator or InputStream or whatever got set into us. - private int scale_; // This is actually the length that got set into us. - - SQLDBClobLocator(AS400JDBCConnection connection, - int id, - int maxLength, - SQLConversionSettings settings, - ConvTable converter, - int columnIndex) - { - connection_ = connection; - id_ = id; - locator_ = new JDLobLocator(connection, id, maxLength, true); - maxLength_ = maxLength; - settings_ = settings; - truncated_ = 0; - converter_ = converter; - columnIndex_ = columnIndex; - } - - public Object clone() - { - return new SQLDBClobLocator(connection_, id_, maxLength_, settings_, converter_, columnIndex_); - } - - public void setHandle(int handle) - { - locator_.setHandle(handle); - } - - //@loch - public int getHandle() - { - return locator_.getHandle(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int locatorHandle = BinaryConverter.byteArrayToInt(rawBytes, offset); - locator_.setHandle(locatorHandle); - locator_.setColumnIndex(columnIndex_); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - BinaryConverter.intToByteArray(locator_.getHandle(), rawBytes, offset); - - // Now we write our saved data to the system, because the prepared statement is being executed. - // We used to write the data to the system on the call to set(), but this messed up - // batch executes, since the host server only reserves temporary space for locator handles one row at a time. - // See the toObject() method in this class for more details. - if(savedObject_ != null) writeToServer(); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) throws SQLException - { - //@selins1 make similar to SQLDBClob - // If it's a String we check for data truncation. - if(object instanceof String) - { - String s = (String)object; - int length = s.length(); - truncated_ = (length > maxLength_ ? length-maxLength_ : 0); - } - else if( !(object instanceof Reader) && - !(object instanceof InputStream) && - (JDUtilities.JDBCLevel_ >= 20 && !(object instanceof Clob)) -/* ifdef JDBC40 */ - && !(object instanceof SQLXML) -/* endif */ - ) - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - - - - savedObject_ = object; - if(scale != -1) scale_ = scale; // Skip resetting it if we don't know the real length - } - - - //@loch method to temporary convert from object input to output before even going to host (writeToServer() does the conversion needed before writting to host) - //This will only be used when resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - //Purpose is to do a local type conversion from obj1 to obj2 like other non-locator lob types - private void doConversion() - throws SQLException - { - int length_ = scale_; - - if( length_ == -1) - { - try{ - //try to get length from locator - length_ = (int)locator_.getLength(); - }catch(Exception e){ } - } - - try - { - Object object = savedObject_; - if(savedObject_ instanceof String) - { - value_ = (String)object; - } - else if(object instanceof Reader) - { - if(length_ >= 0) - { - try - { - int blockSize = length_ < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length_ : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 && totalCharsRead < length_) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - int charsRemaining = length_ - totalCharsRead; - if(charsRemaining < blockSize) - { - blockSize = charsRemaining; - } - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length_ == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 ) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if( object instanceof Clob) - { - Clob clob = (Clob)object; - value_ = clob.getSubString(1, (int)clob.length()); - } -/* ifdef JDBC40 */ - else if( object instanceof SQLXML ) - { - SQLXML xml = (SQLXML)object; - value_ = xml.getString(); - } -/* endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - // Truncate if necessary. - int valueLength = value_.length(); - if(valueLength > maxLength_) - { - value_ = value_.substring(0, maxLength_); - } - - - } - finally - { - - } - } - - private void writeToServer() throws SQLException - { - Object object = savedObject_; - if(object instanceof String) - { - String string = (String)object; - byte[] bytes = converter_.stringToByteArray(string); - locator_.writeData(0L, bytes, true); //@k1C - } - else if(object instanceof Reader) - { - int length = scale_*2; // We are always graphic. - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); //@K1C - } - else if(length > 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = converter_.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - ReaderInputStream stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); //@KBC changed to use bidiConversionProperties instead of bidiStringType - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - locator_.writeData((long)(totalBytesRead/2), byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. //@K1C //@K2C totalBytesRead is our offset (offset should be in number of characters, not bytes) - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - if(stream.available() == 0 && blockSize != 0) - { - stream.close(); //@scan1 - stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); // do this so we don't read more chars out of the Reader than we have to. //@KBC changed to use bidiConversionProperties instead of bidiStringType - } - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - stream.close(); //@scan1 - - if(totalBytesRead < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -4) //@readerlen new else-if block (read all data) (-2 * 2) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = converter_.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - ReaderInputStream stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); //@KBC changed to use bidiConversionProperties instead of bidiStringType - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - locator_.writeData((long)(totalBytesRead/2), byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. //@K1C //@K2C totalBytesRead is our offset (offset should be in number of characters, not bytes) - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - stream.close(); //@scan1 - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(object instanceof InputStream) - { - int length = scale_*2; // We are always graphic. - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); //@K1C - } - else if(length > 0) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - locator_.writeData((long)(totalBytesRead/2), byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. //@K1C //@K2C offset should be in number of characters not bytes - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - if(totalBytesRead < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -4) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - locator_.writeData((long)(totalBytesRead/2), byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. //@K1C //@K2C offset should be in number of characters not bytes - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - boolean set = false; - if(object instanceof AS400JDBCClobLocator) - { - AS400JDBCClobLocator clob = (AS400JDBCClobLocator)object; - - //Synchronize on a lock so that the user can't keep making updates - //to the clob while we are taking updates off the vectors. - synchronized (clob) - { - // See if we saved off our real object from earlier. - if(clob.savedObject_ != null) - { - savedObject_ = clob.savedObject_; - scale_ = clob.savedScale_; - clob.savedObject_ = null; - writeToServer(); - return; - } - } - } - if(!set) - { - Clob clob = (Clob)object; - int length = (int)clob.length(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - if(length < blockSize) blockSize = length; - int position = 1; - AS400JDBCClobLocator thisClob = new AS400JDBCClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); //@hloc1 getClob() returns local value since it was just set. Here we want the locator on the host so we can write to it. - while(position <= length) - { - String substring = clob.getSubString(position, blockSize); - thisClob.setString(position, substring); - position += blockSize; - if((length - position) < blockSize) - { - blockSize = length - position + 1; - } - } - set = true; - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } -/* ifdef JDBC40 */ - else if( object instanceof SQLXML ) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - - String stringVal = xml.getString(); - - locator_.writeData(0L, converter_.stringToByteArray(stringVal), 0, stringVal.length()*2, true); //@xml4 - } -/* endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.DBCLOB_LOCATOR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_ / 2; - } - - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCClobLocator"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "DBCLOB"; - } - - public int getMaximumPrecision() - { - return 1073741822; // the DB2 SQL reference says this should be 1073741823 but we return 1 less to allow for NOT NULL columns - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 968; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.CLOB; - } - - public String getTypeName() - { - return "DBCLOB"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return maxLength_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_));//@loch - } //@loch - - return new ReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()), 819); // ISO-8859-1. - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new HexReaderInputStream(new StringReader(value_)); //@loch - } //@loch - - return new HexReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCBlob(BinaryConverter.stringToBytes(value_), maxLength_); - } //@loch - - return new AS400JDBCBlob(BinaryConverter.stringToBytes(getString()), maxLength_); - } - catch(NumberFormatException nfe) - { - // this DBClob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - // this DBClob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new StringReader(value_); //@loch - } //@loch - - return new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCClob(value_, maxLength_); //@loch - } //@loch - - return new AS400JDBCClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public Object getObject() - throws SQLException - { - // getObject is used by AS400JDBCPreparedStatement for batching, so we save off our InputStream - // inside the AS400JDBCClobLocator. Then, when convertToRawBytes() is called, the writeToServer() - // code checks the AS400JDBCClobLocator's saved InputStream... if it exists, then it writes the - // data out of the InputStream to the system by calling writeToServer() again. - truncated_ = 0; - return new AS400JDBCClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public String getString() - throws SQLException - { - - - truncated_ = 0; - Clob c = getClob(); - return c.getSubString(1L, (int)c.length()); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new ReaderInputStream(new StringReader(value_), 13488); //@loch - } //@loch - - return new ReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(locator_), converter_.getCcsid()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new StringReader(value_); //@loch - } //@loch - - try - { - return new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCNClob(value_, maxLength_); //@loch - } //@loch - - return new AS400JDBCNClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - - } -/* endif */ - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return value_; //@loch - } //@loch - - DBLobData data = locator_.retrieveData(0, locator_.getMaxLength()); - String value = converter_.byteArrayToString(data.getRawBytes(), - data.getOffset(), - data.getLength()); - return value; - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public RowId getRowId() throws SQLException - { - // - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(getString())); - //} - //catch(NumberFormatException nfe) - //{ - // this Clob contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - //@pda jdbc40 -/* ifdef JDBC40 */ - public SQLXML getSQLXML() throws SQLException - { - truncated_ = 0; - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCSQLXML(value_, maxLength_); //@loch - } //@loch - - //return new AS400JDBCSQLXML( getString().toCharArray() ); - return new AS400JDBCSQLXMLLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_, false); //@xml3 //@xml4 - } -/* endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLData.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLData.java deleted file mode 100644 index 5187982ae..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLData.java +++ /dev/null @@ -1,570 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.Ref; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -/** -The SQLData interface represents native SQL data. A specific -implementation of this interface will implement a specific -type of SQL data. - -

The implementation's constructor should not necessarily -initialize the data. That is done via the set() methods. -**/ -interface SQLData -extends Cloneable -{ - //NATIVE_ARRAY is defined here for the array type received from zda. But zda does not have a visible array type. - //zda uses a bit that flags if the stream is an array. - //So we just define it here as 10000. This number is not important; it just needs to be different from other native type numbers. - //This is used in SQLDataFactory and other array related classes. - public static final short NATIVE_ARRAY = 10000; //@array - - public static final int UNDEFINED = 0; - public static final int BIGINT = 1; - public static final int BINARY = 2; - public static final int BLOB = 3; - public static final int BLOB_LOCATOR = 4; - public static final int CHAR = 5; - public static final int CHAR_FOR_BIT_DATA = 6; - public static final int CLOB = 7; - public static final int CLOB_LOCATOR = 8; - public static final int DATALINK = 9; - public static final int DATE = 10; - public static final int DBCLOB = 11; - public static final int DBCLOB_LOCATOR = 12; - public static final int DECIMAL = 13; - public static final int DECIMAL_USING_DOUBLE = 14; - public static final int DOUBLE = 15; - public static final int FLOAT = 16; - public static final int GRAPHIC = 17; - public static final int INTEGER = 18; - public static final int LONG_VARCHAR = 19; - public static final int LONG_VARCHAR_FOR_BIT_DATA = 20; - public static final int LONG_VARGRAPHIC = 21; - public static final int NUMERIC = 22; - public static final int NUMERIC_USING_DOUBLE = 23; - public static final int REAL = 24; - public static final int ROWID = 25; - public static final int SMALLINT = 26; - public static final int TIME = 27; - public static final int TIMESTAMP = 28; - public static final int VARBINARY = 29; - public static final int VARCHAR = 30; - public static final int VARCHAR_FOR_BIT_DATA = 31; - public static final int VARGRAPHIC = 32; - public static final int NCLOB = 33; //@PDA jdbc40 (jdbc40 just added here for info) - public static final int NCLOB_LOCATOR = 34; //@PDA jdbc40 - public static final int NCHAR = 35; //@PDA jdbc40 - public static final int NVARCHAR = 36; //@PDA jdbc40 - public static final int LONG_NVARCHAR = 37; //@pda jdbc40 - public static final int DECFLOAT = 38; //@DFA - public static final int ARRAY = 39; //@array - public static final int XML_LOCATOR = 40; //@xml3 - - /** - Returns a clone of the SQLData object. Use this sparingly - so that we minimize the number of copies. - @return The clone. - **/ - public abstract Object clone(); - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - /** - Loads the contents of the data from raw bytes, as returned - in a reply from the system. - @param rawBytes raw bytes from the system. - @param offset offset. - @param converter the converter. - @exception SQLException If the raw bytes are not in - the expected format. - **/ - public abstract void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable converter) - throws SQLException; - - /** - Converts the contents of the data in raw bytes, as needed - in a request to the system. - @param rawBytes the raw bytes for the system. - @param offset the offset into the byte array. - @param ccsidConverter the converter. - **/ - public abstract void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException; - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - // The set methods initialize the data in a uniform way // - // across all types. If a specific initialization is // - // needed based on a Java type, then add other flavors // - // of set() methods. // - // // - //---------------------------------------------------------// - - /** - Sets the contents of the data based on a Java object. - This performs all conversions described in Table 6 - of the JDBC specification. - @param object a Java object. - @param calendar The calendar. - @param scale The scale. - @exception SQLException If the Java object is not an - appropriate type. - **/ - public abstract void set(Object object, Calendar calendar, int scale) - throws SQLException; - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - // These methods describe information about the actual // - // type of data. // - // // - /*---------------------------------------------------------*/ - - /** - Returns the SQL type constant for the implementing class. - @return the SQL type constant. - **/ - public abstract int getSQLType(); - - /** - Returns the parameters used in creating the - type. - @return the parameters, separated by commas, - or null if none. - **/ - public abstract String getCreateParameters(); - - /** - Returns the display size. This is defined in Appendix - D of the ODBC 2.0 Programmer's Reference. - @return the display size (in characters). - @exception SQLException If the index is invalid - or an error occurs. - **/ - public abstract int getDisplaySize(); - - //@F1A JDBC 3.0 - /** - Returns the Java class name for ParameterMetaData.getParameterClassName(). - @return the Java class name. - **/ - public abstract String getJavaClassName(); - - /** - Returns the prefix used to quote a literal. - @return the prefix, or null if none. - **/ - public abstract String getLiteralPrefix(); - - /** - Returns the suffix used to quote a literal. - @return the suffix, or null if none. - **/ - public abstract String getLiteralSuffix(); - - /** - Returns the localized version of the name of the - data type. - @return the name, or null. - **/ - public abstract String getLocalName(); - - /** - Returns the maximum precision of the type. This is - defined in Appendix D of the ODBC 2.0 Programmer's - Reference. - @return the maximum precision. - **/ - public abstract int getMaximumPrecision(); - - /** - Returns the maximum scale of the type. This is - defined in Appendix D of the ODBC 2.0 Programmer's - Reference. - @return the maximum scale. - **/ - public abstract int getMaximumScale(); - - /** - Returns the minimum scale of the type. This is - defined in Appendix D of the ODBC 2.0 Programmer's - Reference. - @return the minimum scale. - **/ - public abstract int getMinimumScale(); - - /** - Returns the native IBM i identifier for the type. - @return the native type. - **/ - public abstract int getNativeType(); - - /** - Returns the precision of the type. This is - defined in Appendix D of the ODBC 2.0 Programmer's - Reference. - @return the precision. - **/ - public abstract int getPrecision(); - - /** - Returns the radix for the type. - @return the radix. - **/ - public abstract int getRadix(); - - /** - Returns the scale of the type. This is - defined in Appendix D of the ODBC 2.0 Programmer's - Reference. - @return the scale. - **/ - public abstract int getScale(); - - /** - Returns the type constant associated with the type. - @return SQL type code defined in java.sql.Types. - **/ - public abstract int getType(); - - /** - Returns the name of the data type. - @return the name. - **/ - public abstract String getTypeName(); - - /** - Indicates whether the type is signed. - @return true or false - **/ - public abstract boolean isSigned(); - - /** - Indicates whether the type is text. This also - indicates that the associated data needs to be - converted. - @return true or false - **/ - public abstract boolean isText(); - - /** - Returns the actual size of this piece of data in bytes. - @return the actual size of this piece of data in bytes. - **/ - public abstract int getActualSize(); - - /** - Returns the number of bytes truncated by the last conversion - of this piece of data. - @return the number of bytes truncated by the last conversion - **/ - public abstract int getTruncated(); - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - // These methods convert the data to a specific Java // - // type. These conversions should be provided per // - // section 7, table 1 ("Use of ResultSet.getXxx methods // - // to retrieve common SQL data types") of the JDBC 1.10 // - // specification. If a conversion is not required or is // - // not possible given the data, then the method should // - // throw an exception. // - // // - /*---------------------------------------------------------*/ - - /** - Converts the data to a stream of ASCII characters. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract InputStream getAsciiStream() - throws SQLException; - - /** - Converts the data to a Java BigDecimal object. - @param scale scale, or -1 to use full scale. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract BigDecimal getBigDecimal(int scale) - throws SQLException; - - /** - Converts the data to a stream of uninterpreted bytes. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract InputStream getBinaryStream() - throws SQLException; - - /** - Converts the data to a java.sql.Blob object. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Blob getBlob() - throws SQLException; - - /** - Converts the data to a Java boolean. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract boolean getBoolean() - throws SQLException; - - /** - Converts the data to a Java byte. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract byte getByte() - throws SQLException; - - /** - Converts the data to a Java byte array containing - uninterpreted bytes. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract byte[] getBytes() - throws SQLException; - - /** - Converts the data to a java.io.Reader object. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Reader getCharacterStream() - throws SQLException; - - /** - Converts the data to a java.sql.Clob object. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Clob getClob() - throws SQLException; - - /** - Converts the data to a java.sql.Date object. - @param calendar The calendar. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Date getDate(Calendar calendar) - throws SQLException; - - /** - Converts the data to a Java double. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract double getDouble() - throws SQLException; - - /** - Converts the data to a Java float. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract float getFloat() - throws SQLException; - - /** - Converts the data to a Java int. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract int getInt() - throws SQLException; - - /** - Converts the data to a Java long. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract long getLong() - throws SQLException; - - /** - Converts the data to a Java object. The actual type - of the Java object is dictated per section 8, - table 2 ("Standard mapping from SQL types to Java types") - of the JDBC 1.10 specification - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Object getObject() - throws SQLException; - - /** - Converts the data to a Java short. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract short getShort() - throws SQLException; - - /** - Converts the data to a Java String object. This - conversion must be provided by the implementation. - @return the result of the conversion. - **/ - public abstract String getString() - throws SQLException; - - /** - Converts the data to a java.sql.Time object. - @param calendar The calendar. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Time getTime(Calendar calendar) - throws SQLException; - - /** - Converts the data to a java.sql.Timestamp object. - @param calendar The calendar. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Timestamp getTimestamp(Calendar calendar) - throws SQLException; - - /** - Converts the data to a stream of Unicdoe characters. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract InputStream getUnicodeStream() - throws SQLException; - - //@PDA jdbc40 - /** - Converts the data to a java.io.Reader object. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Reader getNCharacterStream() - throws SQLException; - - //@PDA jdbc40 - /** - Converts the data to a java.sql.NClob object - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ -/* ifdef JDBC40 */ - public abstract NClob getNClob() - throws SQLException; -/* endif */ - //@PDA jdbc40 - /** - Converts the data to String object. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract String getNString() - throws SQLException; - - //@PDA jdbc40 - /** - Converts the data to a java.sql.SQLXML object. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ -/* ifdef JDBC40 */ - public abstract SQLXML getSQLXML() - throws SQLException; -/* endif */ - - //@PDA jdbc40 - /** - Converts the data to a java.sql.RowId object. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ -/* ifdef JDBC40 */ - - public abstract RowId getRowId() - throws SQLException; -/* endif */ - - //@array - /** - Converts (returns) the data to a java.sql.Array object. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Array getArray() - throws SQLException; - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLDatalink.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLDatalink.java deleted file mode 100644 index a6db87a7f..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLDatalink.java +++ /dev/null @@ -1,455 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLDatalink.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.net.URL; // @d2a -import java.net.MalformedURLException; - -final class SQLDatalink -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - // Private data. - private int length_; - private int maxLength_; - private SQLConversionSettings settings_; - private int truncated_; - private String value_; - - SQLDatalink(int maxLength, SQLConversionSettings settings) - { - length_ = 0; - maxLength_ = maxLength; - settings_ = settings; - truncated_ = 0; - value_ = ""; // @A1C - } - - public Object clone() - { - return new SQLDatalink(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - value_ = ccsidConverter.byteArrayToString(rawBytes, offset+2, length_); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - BinaryConverter.unsignedShortToByteArray(length_, rawBytes, offset); - try - { - ccsidConverter.stringToByteArray(value_, rawBytes, offset + 2, length_); - } - catch(Exception e) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); // @C2A - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(object instanceof String) - value_ = (String)object; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - length_ = value_.length(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.DATALINK; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - //@D1A JDBC 3.0 - //@d2a - method rewritten for URLs - //@j4c - rewritten now that JDUtilites knows the JDBC level - public String getJavaClassName() - { - if(JDUtilities.JDBCLevel_ >= 30) - return "java.net.URL"; - else - return "java.lang.Datalink"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "DATALINK"; - } - - public int getMaximumPrecision() - { - return 32717; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 396; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - if(JDUtilities.JDBCLevel_ >= 30) //@J5A - return 70; //java.sql.Types.DATALINK without requiring 1.4 //@J5A - else //@J5A - return java.sql.Types.VARCHAR; - } - - public String getTypeName() - { - return "DATALINK"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_)); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - return new StringReader(value_); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - return new AS400JDBCClob(value_, value_.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - // @d2a entire method reworked. Used to simply return value_. - // @j4c - rewritten now that JDUtilites knows the JDBC level - public Object getObject() - throws SQLException - { - truncated_ = 0; - // if JDBC 3.0 or later return a URL instead of a string. - // If we are not able to turn the string into a URL then return - // the string (that is why there is no "else". That shouldn't - // happen because the database makes sure the cell contains - // a valid URL for this data type. - if(JDUtilities.JDBCLevel_ >= 30) - { - try - { - return new java.net.URL(value_); - } - catch(MalformedURLException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - else - { - return value_; - } - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public String getString() - throws SQLException - { - return value_; - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(value_)); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - return new StringReader(value_); - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - truncated_ = 0; - return new AS400JDBCNClob(value_, value_.length()); - } -/* endif */ - //@pda jdbc40 - public String getNString() throws SQLException - { - return value_; - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - //@pda jdbc40 -/* ifdef JDBC40 */ - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLDate.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLDate.java deleted file mode 100644 index 2e042d30c..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLDate.java +++ /dev/null @@ -1,775 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLDate.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; -import java.io.InputStream; -import java.io.Reader; -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLDate -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2002 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int dateFormat_; // @550A - private int truncated_; - private int year_; - private int month_; - private int day_; - - SQLDate(SQLConversionSettings settings, int dateFormat) - { - settings_ = settings; - truncated_ = 0; - year_ = 0; - month_ = 0; - day_ = 0; - dateFormat_ = dateFormat; // @550A - } - - public Object clone() - { - return new SQLDate(settings_, dateFormat_); // @550C - } - - public static Date stringToDate(String s, - SQLConversionSettings settings, - Calendar calendar) - throws SQLException - { - // If the string is empty or set to zeros, - // then it is likely a NULL, so just set this - // to a default date. - String sTrim = s.trim(); - int sTrimLength = sTrim.length(); // @F2A - try - { - if((sTrimLength == 0) || (Integer.parseInt(sTrim) == 0)) // @F2C - return new Date(0); - } - catch(NumberFormatException e) - { - // Ignore. This just means the value is not NULL. - } - - if(calendar == null) - { - calendar = Calendar.getInstance(); //@P0A - calendar.setLenient(false); //@dat1 - } - - try - { - // Parse the string according to the format and separator. - switch(settings.getDateFormat()) - { - case SQLConversionSettings.DATE_FORMAT_USA: - calendar.set(Calendar.YEAR, Integer.parseInt(s.substring(6, 10))); - calendar.set(Calendar.MONTH, Integer.parseInt(s.substring(0, 2)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s.substring(3, 5))); - break; - - case SQLConversionSettings.DATE_FORMAT_EUR: - calendar.set(Calendar.YEAR, Integer.parseInt(s.substring(6, 10))); - calendar.set(Calendar.MONTH, Integer.parseInt(s.substring(3, 5)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s.substring(0, 2))); - break; - - case SQLConversionSettings.DATE_FORMAT_JULIAN: - if(sTrimLength <= 6) - { // YY/DDD // @F2C - calendar.set(Calendar.DAY_OF_YEAR, Integer.parseInt(s.substring(3, 6))); - calendar.set(Calendar.YEAR, twoDigitYearToFour(Integer.parseInt(s.substring(0, 2)))); - } - else - { // Assume they've specified a 4-digit year: YYYY/DDD // @F2A - calendar.set(Calendar.DAY_OF_YEAR, Integer.parseInt(s.substring(5, 8))); - calendar.set(Calendar.YEAR, Integer.parseInt(s.substring(0, 4))); - } - break; - - case SQLConversionSettings.DATE_FORMAT_MDY: - if(sTrimLength <= 8) - { // MM/DD/YY // @F2C - calendar.set(Calendar.YEAR, twoDigitYearToFour(Integer.parseInt(s.substring(6, 8)))); - } - else - { // Assume they've specified a 4-digit year: MM/DD/YYYY // @F2A - calendar.set(Calendar.YEAR, Integer.parseInt(s.substring(6, 10))); - } - calendar.set(Calendar.MONTH, Integer.parseInt(s.substring(0, 2)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s.substring(3, 5))); - break; - - case SQLConversionSettings.DATE_FORMAT_DMY: - if(sTrimLength <= 8) - { // DD/MM/YY // @F2C - calendar.set(Calendar.YEAR, twoDigitYearToFour(Integer.parseInt(s.substring(6, 8)))); - } - else - { // Assume they've specified a 4-digit year: DD/MM/YYYY // @F2A - calendar.set(Calendar.YEAR, Integer.parseInt(s.substring(6, 10))); - } - calendar.set(Calendar.MONTH, Integer.parseInt(s.substring(3, 5)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s.substring(0, 2))); - break; - - case SQLConversionSettings.DATE_FORMAT_YMD: - if(sTrimLength <= 8) - { // YY/MM/DD // @F2C - calendar.set(Calendar.YEAR, twoDigitYearToFour(Integer.parseInt(s.substring(0, 2)))); - calendar.set(Calendar.MONTH, Integer.parseInt(s.substring(3, 5)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s.substring(6, 8))); - } - else - { // Assume they've specified a 4-digit year: YYYY/MM/DD // @F2A - calendar.set(Calendar.YEAR, Integer.parseInt(s.substring(0, 4))); - calendar.set(Calendar.MONTH, Integer.parseInt(s.substring(5, 7)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s.substring(8, 10))); - } - break; - - case SQLConversionSettings.DATE_FORMAT_JIS: - case SQLConversionSettings.DATE_FORMAT_ISO: - calendar.set(Calendar.YEAR, Integer.parseInt(s.substring(0, 4))); - calendar.set(Calendar.MONTH, Integer.parseInt(s.substring(5, 7)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s.substring(8, 10))); - break; - } - - calendar.set(Calendar.HOUR_OF_DAY, 0); - calendar.set(Calendar.MINUTE, 0); - calendar.set(Calendar.SECOND, 0); - calendar.set(Calendar.MILLISECOND, 0); - } - catch(NumberFormatException e) - { - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing date "+s, e); - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); - } - catch(StringIndexOutOfBoundsException e) - { - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing date "+s, e); - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); - } - - try //@dat1 - { - return new Date(calendar.getTime().getTime()); - }catch(Exception e){ - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing date "+s, e); //@dat1 - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); //@dat1 - return null; //@dat1 - } - } - - public static String dateToString(java.util.Date d, // @F5C - SQLConversionSettings dataFormat, - Calendar calendar) - { - StringBuffer buffer = new StringBuffer(); - String separator = dataFormat.getDateSeparator(); - if(calendar == null) calendar = Calendar.getInstance(); //@P0A - calendar.setTime(d); - - // @F3D Note: No matter what format is being used, ensure that exactly 10 characters are in the buffer. - - switch(dataFormat.getDateFormat()) - { - - case SQLConversionSettings.DATE_FORMAT_USA: // mm/dd/yyyy - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.MONTH) + 1, 2)); - buffer.append('/'); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.DAY_OF_MONTH), 2)); - buffer.append('/'); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.YEAR), 4)); - break; - - case SQLConversionSettings.DATE_FORMAT_EUR: // dd.mm.yyyy - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.DAY_OF_MONTH), 2)); - buffer.append('.'); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.MONTH) + 1, 2)); - buffer.append('.'); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.YEAR), 4)); - break; - - case SQLConversionSettings.DATE_FORMAT_JULIAN: // yy/ddd - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.YEAR), 2)); - buffer.append(separator); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.DAY_OF_YEAR), 3)); - // @F3D buffer.append(" "); - break; - - case SQLConversionSettings.DATE_FORMAT_MDY: // mm/dd/yy - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.MONTH) + 1, 2)); - buffer.append(separator); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.DAY_OF_MONTH), 2)); - buffer.append(separator); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.YEAR), 2)); - // @F3D buffer.append(" "); - break; - - case SQLConversionSettings.DATE_FORMAT_DMY: // dd/mm/yy - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.DAY_OF_MONTH), 2)); - buffer.append(separator); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.MONTH) + 1, 2)); - buffer.append(separator); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.YEAR), 2)); - // @F3D buffer.append(" "); - break; - - case SQLConversionSettings.DATE_FORMAT_YMD: // yy/mm/dd - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.YEAR), 2)); - buffer.append(separator); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.MONTH) + 1, 2)); - buffer.append(separator); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.DAY_OF_MONTH), 2)); - // @F3D buffer.append(" "); - break; - - case SQLConversionSettings.DATE_FORMAT_JIS: // yyyy-mm-dd - case SQLConversionSettings.DATE_FORMAT_ISO: // yyyy-mm-dd - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.YEAR), 4)); - buffer.append('-'); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.MONTH) + 1, 2)); - buffer.append('-'); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.DAY_OF_MONTH), 2)); - break; - } - - return buffer.toString(); - } - - private static int twoDigitYearToFour(int twoDigitYear) - { - return(twoDigitYear <= 39) - ? (twoDigitYear + 2000) - : (twoDigitYear + 1900); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - int connectionDateFormat = settings_.getDateFormat(); // @550A - // @550 If the date is in a stored procedure result set, it could have a different date format than the format of the connection - switch(((dateFormat_ != -1) && (dateFormat_ != connectionDateFormat)) ? dateFormat_ : connectionDateFormat) // @550C - { - - case SQLConversionSettings.DATE_FORMAT_JULIAN: // yy/ddd - year_ = twoDigitYearToFour((rawBytes[offset+0] & 0x0f) * 10 - + (rawBytes[offset+1] & 0x0f)); - Calendar calendar = Calendar.getInstance(); - calendar.clear(); - calendar.set(Calendar.YEAR, year_); - calendar.set(Calendar.DAY_OF_YEAR, - (rawBytes[offset+3] & 0x0f) * 100 - + (rawBytes[offset+4] & 0x0f) * 10 - + (rawBytes[offset+5] & 0x0f)); - calendar.setTime(calendar.getTime()); - month_ = calendar.get(Calendar.MONTH); - day_ = calendar.get(Calendar.DAY_OF_MONTH); - break; - - case SQLConversionSettings.DATE_FORMAT_MDY: // mm/dd/yy - month_ = (rawBytes[offset+0] & 0x0f) * 10 - + (rawBytes[offset+1] & 0x0f) - 1; - day_ = (rawBytes[offset+3] & 0x0f) * 10 - + (rawBytes[offset+4] & 0x0f); - year_ = twoDigitYearToFour((rawBytes[offset+6] & 0x0f) * 10 - + (rawBytes[offset+7] & 0x0f)); - break; - - case SQLConversionSettings.DATE_FORMAT_DMY: // dd/mm/yy - day_ = (rawBytes[offset+0] & 0x0f) * 10 - + (rawBytes[offset+1] & 0x0f); - month_ = (rawBytes[offset+3] & 0x0f) * 10 - + (rawBytes[offset+4] & 0x0f) - 1; - year_ = twoDigitYearToFour((rawBytes[offset+6] & 0x0f) * 10 - + (rawBytes[offset+7] & 0x0f)); - break; - - case SQLConversionSettings.DATE_FORMAT_YMD: // yy/mm/dd - year_ = twoDigitYearToFour((rawBytes[offset+0] & 0x0f) * 10 - + (rawBytes[offset+1] & 0x0f)); - month_ = (rawBytes[offset+3] & 0x0f) * 10 - + (rawBytes[offset+4] & 0x0f) - 1; - day_ = (rawBytes[offset+6] & 0x0f) * 10 - + (rawBytes[offset+7] & 0x0f); - break; - - case SQLConversionSettings.DATE_FORMAT_USA: // mm/dd/yyyy - month_ = (rawBytes[offset+0] & 0x0f) * 10 - + (rawBytes[offset+1] & 0x0f) - 1; - day_ = (rawBytes[offset+3] & 0x0f) * 10 - + (rawBytes[offset+4] & 0x0f); - year_ = (rawBytes[offset+6] & 0x0f) * 1000 - + (rawBytes[offset+7] & 0x0f) * 100 - + (rawBytes[offset+8] & 0x0f) * 10 - + (rawBytes[offset+9] & 0x0f); - break; - - case SQLConversionSettings.DATE_FORMAT_ISO: // yyyy-mm-dd - case SQLConversionSettings.DATE_FORMAT_JIS: // yyyy-mm-dd - year_ = (rawBytes[offset+0] & 0x0f) * 1000 - + (rawBytes[offset+1] & 0x0f) * 100 - + (rawBytes[offset+2] & 0x0f) * 10 - + (rawBytes[offset+3] & 0x0f); - month_ = (rawBytes[offset+5] & 0x0f) * 10 - + (rawBytes[offset+6] & 0x0f) - 1; - day_ = (rawBytes[offset+8] & 0x0f) * 10 - + (rawBytes[offset+9] & 0x0f); - break; - - case SQLConversionSettings.DATE_FORMAT_EUR: // dd.mm.yyyy - day_ = (rawBytes[offset+0] & 0x0f) * 10 - + (rawBytes[offset+1] & 0x0f); - month_ = (rawBytes[offset+3] & 0x0f) * 10 - + (rawBytes[offset+4] & 0x0f) - 1; - year_ = (rawBytes[offset+6] & 0x0f) * 1000 - + (rawBytes[offset+7] & 0x0f) * 100 - + (rawBytes[offset+8] & 0x0f) * 10 - + (rawBytes[offset+9] & 0x0f); - break; - } - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - // Always use ISO format here. - StringBuffer buffer = new StringBuffer(10); - buffer.append(JDUtilities.padZeros(year_, 4)); - buffer.append('-'); - buffer.append(JDUtilities.padZeros(month_ + 1, 2)); - buffer.append('-'); - buffer.append(JDUtilities.padZeros(day_, 2)); - - try - { - ccsidConverter.stringToByteArray(buffer.toString(), rawBytes, offset); - } - catch(CharConversionException e) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); // @E2C - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(calendar == null) - { - calendar = Calendar.getInstance(); //@P0A - calendar.setLenient(false); //@dat1 - } - if(object instanceof String) - { - stringToDate((String) object, settings_, calendar); - year_ = calendar.get(Calendar.YEAR); - month_ = calendar.get(Calendar.MONTH); - day_ = calendar.get(Calendar.DAY_OF_MONTH); - } - - else if(object instanceof Timestamp) - { // @F5M - calendar.setTime((Timestamp) object); - year_ = calendar.get(Calendar.YEAR); - month_ = calendar.get(Calendar.MONTH); - day_ = calendar.get(Calendar.DAY_OF_MONTH); - } - - else if(object instanceof java.util.Date) - { // @F5C - calendar.setTime((java.util.Date) object); // @F5C - year_ = calendar.get(Calendar.YEAR); - month_ = calendar.get(Calendar.MONTH); - day_ = calendar.get(Calendar.DAY_OF_MONTH); - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.DATE; - } - - public String getCreateParameters() - { - return null; - } - - - public int getDisplaySize() - { - return 10; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.sql.Date"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "DATE"; - } - - public int getMaximumPrecision() - { - return 10; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 384; - } - - public int getPrecision() - { - return 10; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.DATE; - } - - public String getTypeName() - { - return "DATE"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return 10; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) calendar = Calendar.getInstance(); - calendar.set(year_, month_, day_, 0, 0, 0); - calendar.set(Calendar.MILLISECOND, 0); - return new Date(calendar.getTime().getTime()); - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return getDate(null); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - Calendar calendar = Calendar.getInstance(); - calendar.set(year_, month_, day_, 0, 0, 0); - calendar.set(Calendar.MILLISECOND, 0); - Date d = new Date(calendar.getTime().getTime()); - return dateToString(d, settings_, calendar); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) calendar = Calendar.getInstance(); //@P0A - calendar.set(year_, month_, day_, 0, 0, 0); - calendar.set(Calendar.MILLISECOND, 0); - Timestamp ts = new Timestamp(calendar.getTime().getTime()); - ts.setNanos(0); - return ts; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - return new StringReader(getNString()); - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - - public NClob getNClob() throws SQLException - { - truncated_ = 0; //@pda - String string = getString(); //@pda - return new AS400JDBCNClob(string, string.length()); //@pda - } -/* endif */ - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - Calendar calendar = Calendar.getInstance(); - calendar.set(year_, month_, day_, 0, 0, 0); - calendar.set(Calendar.MILLISECOND, 0); - Date d = new Date(calendar.getTime().getTime()); - return dateToString(d, settings_, calendar); - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - //@pda jdbc40 -/* ifdef JDBC40 */ - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLDecFloat16.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLDecFloat16.java deleted file mode 100644 index b1ffec54e..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLDecFloat16.java +++ /dev/null @@ -1,686 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -//JTOpen (IBM Toolbox for Java - OSS version) -// -//Filename: SQLDecFloat16.java -// -//The source code contained herein is licensed under the IBM Public License -//Version 1.0, which has been approved by the Open Source Initiative. -//Copyright (C) 2006 International Business Machines Corporation and -//others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -//@DFA new class -final class SQLDecFloat16 implements SQLData { - - private static final BigDecimal default_ = BigDecimal.valueOf(0); - - //various min/max values used for comparisons in calculating truncation etc - private static final BigDecimal BYTE_MAX_VALUE = BigDecimal.valueOf(Byte.MAX_VALUE); - - private static final BigDecimal BYTE_MIN_VALUE = BigDecimal.valueOf(Byte.MIN_VALUE); - - private static final BigDecimal SHORT_MAX_VALUE = BigDecimal.valueOf(Short.MAX_VALUE); - - private static final BigDecimal SHORT_MIN_VALUE = BigDecimal.valueOf(Short.MIN_VALUE); - - private static final BigDecimal INTEGER_MAX_VALUE = BigDecimal.valueOf(Integer.MAX_VALUE); - - private static final BigDecimal INTEGER_MIN_VALUE = BigDecimal.valueOf(Integer.MIN_VALUE); - - private static final BigDecimal LONG_MAX_VALUE = BigDecimal.valueOf(Long.MAX_VALUE); - - private static final BigDecimal LONG_MIN_VALUE = BigDecimal.valueOf(Long.MIN_VALUE); - - private static final BigDecimal FLOAT_MAX_VALUE = new BigDecimal(Float.MAX_VALUE); - - private static final BigDecimal FLOAT_MIN_VALUE = new BigDecimal(-Float.MAX_VALUE); //@PDC MIN_VALUE is positive - - private static final BigDecimal DOUBLE_MAX_VALUE = new BigDecimal(Double.MAX_VALUE); - - private static final BigDecimal DOUBLE_MIN_VALUE = new BigDecimal(-Double.MAX_VALUE); //@PDC MIN_VALUE is positive - - static final int DECFLOAT16_MIN_EXP = -383; - - private SQLConversionSettings settings_; - - private int precision_; //16 - - private int truncated_; - - String specialValue_ = null; //since BigDecimal cannot hold "Infinity", "-Infinity" or "NaN", store them here as string - - private AS400DecFloat typeConverter_; - - private BigDecimal value_; - - private JDProperties properties_; - - private int roundingMode; - - private String roundingModeStr; - - private int vrm_; - - SQLDecFloat16( SQLConversionSettings settings, int vrm, JDProperties properties) { - settings_ = settings; - precision_ = 16; - truncated_ = 0; - roundingModeStr = properties.getString(JDProperties.DECFLOAT_ROUNDING_MODE); - typeConverter_ = new AS400DecFloat(precision_ ); - value_ = default_; - vrm_ = vrm; - properties_ = properties; - - //parse property rounding mode and save its value as int (needed for BigDecimal, MathContext etc) - // valid rounding modes are: - //"half even" - //"half up" - //"down" - //"ceiling" - //"floor" - //"half down" - //"up" - - if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_UP)) - roundingMode = BigDecimal.ROUND_UP; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_DOWN)) - roundingMode = BigDecimal.ROUND_DOWN; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_CEILING)) - roundingMode = BigDecimal.ROUND_CEILING; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_FLOOR)) - roundingMode = BigDecimal.ROUND_FLOOR; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_UP)) - roundingMode = BigDecimal.ROUND_HALF_UP; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_DOWN)) - roundingMode = BigDecimal.ROUND_HALF_DOWN; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_EVEN)) - roundingMode = BigDecimal.ROUND_HALF_EVEN; - - - //for MathContext, methods take strings which are same as JDProperties rounding modes with "round" added. - roundingModeStr = "ROUND_" + roundingModeStr.toUpperCase().replace(' ', '_'); - - } - - public Object clone() { - return new SQLDecFloat16( settings_, vrm_, properties_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccisdConverter) - throws SQLException { - try{ - value_ = ((BigDecimal) typeConverter_.toObject(rawBytes, offset)); - specialValue_ = null; - } catch (ExtendedIllegalArgumentException e) { - //check for NAN and INF flag exception - if ( (specialValue_ = getSpecialValue( e.toString())) == null ) - throw e; - } - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException { - try { - if ( specialValue_ == null) - typeConverter_.toBytes(value_, rawBytes, offset); - else - typeConverter_.toBytes(specialValue_, rawBytes, offset); //Nan, Infinity, -Infinity - - } catch (ExtendedIllegalArgumentException e) { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) throws SQLException { - BigDecimal bigDecimal = null; - specialValue_ = null; - - if (object instanceof String) { - try { - if ( (specialValue_ = getSpecialValue( (String)object)) == null ) { - //not one of the special values, just store as BigDecimal - - // Because the string may be using a comma for the decimal separator and we are going to - // store the object as a Java Bigdec, we much check and change to the default '.' notation. - if (((String)object).indexOf(',')!=-1) { - bigDecimal = new BigDecimal (((String)object).replace(',', '.')); - } else { - bigDecimal = new BigDecimal((String)object); - } - } - } catch (NumberFormatException e) { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - } catch (StringIndexOutOfBoundsException e) // jdk 1.3.x throws this - // instead of a NFE - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if (object instanceof Number) { - if ( (specialValue_ = getSpecialValue( object.toString())) == null ) { - //not one of the special values, just store as BigDecimal - bigDecimal = new BigDecimal(object.toString()); //convert to string so all Number types can be passed in - } - } - - else if (object instanceof Boolean) - bigDecimal = (((Boolean) object).booleanValue() == true) ? BigDecimal.valueOf(1) : BigDecimal.valueOf(0); - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Round by mode if necessary. - truncated_ = 0; - - //if one of the special values, then no need to check truncation - if(specialValue_ != null) - { - //Nan, Infinity, -Infinity - value_ = null; - return; - } - - //follow native and allow rounding mode to handle - //@pdd int otherScale = bigDecimal.scale(); - //@pdd if(otherScale > ((-1) * DECFLOAT16_MIN_EXP)) //absolute of min_exp is max scale - //@pdd truncated_ += otherScale + DECFLOAT16_MIN_EXP; //diff in scales - - //get precision from bigDecimal without 0's on right side - //@pdd int otherPrecision = SQLDataFactory.getPrecisionForTruncation(bigDecimal, 16); - - - //follow native and allow rounding mode to handle - //@pddif(otherPrecision > precision_) - //@pdd{ - //@pdd int digits = otherPrecision - precision_; - //@pdd truncated_ += digits; - //@pdd} - //@pddelse - //@pdd truncated_ = 0; // No left side truncation, report nothing - //@pdd // (even if there was right side truncation). - - value_ = AS400DecFloat.roundByMode(bigDecimal, 16, roundingModeStr); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() { - return SQLData.DECFLOAT; - } - - public String getCreateParameters() { - return null; - } - - public int getDisplaySize() { - return 23; //@pdc same as native - } - - - public String getJavaClassName() { - return "java.math.BigDecimal"; - } - - public String getLiteralPrefix() { - return null; - } - - public String getLiteralSuffix() { - return null; - } - - public String getLocalName() { - return "DECFLOAT"; - } - - public int getMaximumPrecision() { - return precision_; - } - - public int getMaximumScale() { - return 0; - } - - public int getMinimumScale() { - return 0; - } - - public int getNativeType() { - return 996; //same as in SQLDataFactory.java - } - - public int getPrecision() { - return precision_; - } - - public int getRadix() { - return 10; //decimal base (4 bits per digit) - } - - public int getScale() { - return 0; - } - - public int getType() { - return java.sql.Types.OTHER; - } - - public String getTypeName() { - return "DECFLOAT"; - } - - public boolean isSigned() { - return true; - } - - public boolean isText() { - return false; - } - - public int getActualSize() { - if(specialValue_ == null) - return SQLDataFactory.getPrecision( value_ ); - else - return specialValue_.length(); - } - - public int getTruncated() { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - //remove this when BigDecimal supports Nan, Inf, -Inf - if(specialValue_ != null){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - if(scale >= 0) - { - if(scale >= value_.scale()) - { - return value_.setScale(scale); - } - else - { - truncated_ = value_.scale() - scale; - return value_.setScale(scale, roundingMode); - } - } - else - return value_; - } - - public InputStream getBinaryStream() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - return false; //false seems logical here - } - - return (value_.compareTo(BigDecimal.valueOf(0)) != 0); - } - - public byte getByte() throws SQLException { - //this code is similar to SQLDouble, and then in inner iff, it is like - // SQLDecimal - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - //@snan snan is not yet supported, return as regular nan - if(specialValue_.indexOf("-SNaN") != -1) //@snan - return (new Double("-NaN")).byteValue(); - else if(specialValue_.indexOf("SNaN") != -1) //@snan - return (new Double("NaN")).byteValue(); - else - return (new Double(specialValue_)).byteValue(); - } - - if (value_.compareTo(BYTE_MAX_VALUE) > 0 || value_.compareTo(BYTE_MIN_VALUE) < 0) { - if (value_.compareTo(SHORT_MAX_VALUE) > 0 || value_.compareTo(SHORT_MIN_VALUE) < 0) { - if (value_.compareTo(INTEGER_MAX_VALUE) > 0 || value_.compareTo(INTEGER_MIN_VALUE) < 0) { - if (value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) { - truncated_ = 15; //16 bytes - 1; - } else { - truncated_ = 7; - } - } else { - truncated_ = 3; - } - } else { - truncated_ = 1; - } - } - return value_.byteValue(); - } - - public byte[] getBytes() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - //@snan snan is not yet supported, return as regular nan - if(specialValue_.indexOf("-SNaN") != -1) //@snan - return (new Double("-NaN")).doubleValue(); - else if(specialValue_.indexOf("SNaN") != -1) //@snan - return (new Double("NaN")).doubleValue(); - else - return (new Double(specialValue_)).doubleValue(); - } - - if (value_.compareTo(DOUBLE_MAX_VALUE) > 0 || value_.compareTo(DOUBLE_MIN_VALUE) < 0) { - truncated_ = 8; //16 bytes - 8; - } - - return value_.doubleValue(); - } - - public float getFloat() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - //@snan snan is not yet supported, return as regular nan - if(specialValue_.indexOf("-SNaN") != -1) //@snan - return (new Float("-NaN")).floatValue(); - else if(specialValue_.indexOf("SNaN") != -1) //@snan - return (new Float("NaN")).floatValue(); - else - return (new Float(specialValue_)).floatValue(); - } - - if (value_.compareTo(FLOAT_MAX_VALUE) > 0 || value_.compareTo(FLOAT_MIN_VALUE) < 0) { - if (value_.compareTo(DOUBLE_MAX_VALUE) > 0 || value_.compareTo(DOUBLE_MIN_VALUE) < 0) { - truncated_ = 12; //16 bytes - 4; - } else { - truncated_ = 4; - } - } - return value_.floatValue(); - } - - public int getInt() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - //remove this when Integer supports Nan, Inf, -Inf - if(specialValue_ != null){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - if (value_.compareTo(INTEGER_MAX_VALUE) > 0 || value_.compareTo(INTEGER_MIN_VALUE) < 0) { - if (value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) { - truncated_ = 12; //16 bytes - 4; - } else { - truncated_ = 4; - } - } - - return value_.intValue(); - } - - public long getLong() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - //remove this when Long supports Nan, Inf, -Inf - if(specialValue_ != null){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - if( value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) - { - truncated_ = 8; //16 bytes - 8; - } - return value_.longValue(); - } - - public Object getObject() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - //in this case, return String object instead of throwing exception - //remove this when BigDecimal supports Nan, Inf, -Inf - if(specialValue_ != null){ - return specialValue_; - } - - return value_; - } - - public short getShort() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - if (value_.compareTo(SHORT_MAX_VALUE) > 0 || value_.compareTo(SHORT_MIN_VALUE) < 0) { - if (value_.compareTo(INTEGER_MAX_VALUE) > 0 || value_.compareTo(INTEGER_MIN_VALUE) < 0) { - if (value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) { - truncated_ = 14; //16 bytes - 2; - } else { - truncated_ = 6; - } - } else { - truncated_ = 2; - } - } - - return value_.shortValue(); - } - - public String getString() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - return specialValue_; - } - - String stringRep = value_.toString(); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - /** Helper method to return string value of special values that - * cannot be held in current BigDecimal objects. - * Valid inputs = "NaN", "NAN", "+NaN", "-NaN", "QNaN", "+QNaN", "-QNaN", "SNaN", "+SNaN", "-SNaN", "INF", "+INF", - * "-INF", "Infinity", "+Infinity", "-Infinity" - */ - private String getSpecialValue(String number){ - //use indexOf() so that we can use this method for exception text from AS400DecFloat also - int startOfValue = -1; - //@snan - if ( (startOfValue = number.toUpperCase().indexOf("SNAN")) != -1 ){ - //check for sign - if ( ((startOfValue > 0 ) && (number.charAt(startOfValue - 1) == '-') ) ) - return "-SNaN"; //no representaion in Double - else - return "SNaN"; //no representaion in Double - } - else if ( (startOfValue = number.toUpperCase().indexOf("NAN")) != -1 ){ - //check for sign - if ( ((startOfValue > 0 ) && (number.charAt(startOfValue - 1) == '-') ) - || ((startOfValue > 1 ) && (number.charAt(startOfValue - 2) == '-')) ) - return "-NaN"; //no representaion in Double - return String.valueOf(Double.NaN); - } - else if ( (startOfValue = number.toUpperCase().indexOf("INF")) != -1){ - //check for sign - if ( (startOfValue != 0 ) && (number.charAt(startOfValue - 1) == '-')) - return String.valueOf(Double.NEGATIVE_INFINITY); - else - return String.valueOf(Double.POSITIVE_INFINITY); - } - else - return null; //not a special value - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - return specialValue_; - } - - String stringRep = value_.toString(); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - //@pda jdbc40 -/* ifdef JDBC40 */ - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLDecFloat34.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLDecFloat34.java deleted file mode 100644 index da952d32b..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLDecFloat34.java +++ /dev/null @@ -1,684 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -//JTOpen (IBM Toolbox for Java - OSS version) -// -//Filename: SQLDecFloat34.java -// -//The source code contained herein is licensed under the IBM Public License -//Version 1.0, which has been approved by the Open Source Initiative. -//Copyright (C) 2006 International Business Machines Corporation and -//others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -//@DFA new class -final class SQLDecFloat34 implements SQLData { - static final String copyright = "Copyright (C) 2006 International Business Machines Corporation and others."; - - private static final BigDecimal default_ = BigDecimal.valueOf(0); - - //various min/max values used for comparisons in calculating truncation etc - private static final BigDecimal BYTE_MAX_VALUE = BigDecimal.valueOf(Byte.MAX_VALUE); - - private static final BigDecimal BYTE_MIN_VALUE = BigDecimal.valueOf(Byte.MIN_VALUE); - - private static final BigDecimal SHORT_MAX_VALUE = BigDecimal.valueOf(Short.MAX_VALUE); - - private static final BigDecimal SHORT_MIN_VALUE = BigDecimal.valueOf(Short.MIN_VALUE); - - private static final BigDecimal INTEGER_MAX_VALUE = BigDecimal.valueOf(Integer.MAX_VALUE); - - private static final BigDecimal INTEGER_MIN_VALUE = BigDecimal.valueOf(Integer.MIN_VALUE); - - private static final BigDecimal LONG_MAX_VALUE = BigDecimal.valueOf(Long.MAX_VALUE); - - private static final BigDecimal LONG_MIN_VALUE = BigDecimal.valueOf(Long.MIN_VALUE); - - private static final BigDecimal FLOAT_MAX_VALUE = new BigDecimal(Float.MAX_VALUE); - - private static final BigDecimal FLOAT_MIN_VALUE = new BigDecimal(-Float.MAX_VALUE); //@PDC MIN_VALUE is positive - - private static final BigDecimal DOUBLE_MAX_VALUE = new BigDecimal(Double.MAX_VALUE); - - private static final BigDecimal DOUBLE_MIN_VALUE = new BigDecimal(-Double.MAX_VALUE); //@PDC MIN_VALUE is positive - - static final int DECFLOAT34_MIN_EXP = -6143; - - private SQLConversionSettings settings_; - - private int precision_; //34 - - private int truncated_; - - String specialValue_ = null; //since BigDecimal cannot hold "Infinity", "-Infinity" or "NaN", store them here as string - - private AS400DecFloat typeConverter_; - - private BigDecimal value_; - - private JDProperties properties_; - - private int roundingMode; - - private String roundingModeStr; - - private int vrm_; - - SQLDecFloat34( SQLConversionSettings settings, int vrm, JDProperties properties) { - settings_ = settings; - precision_ = 34; - truncated_ = 0; - roundingModeStr = properties.getString(JDProperties.DECFLOAT_ROUNDING_MODE); - typeConverter_ = new AS400DecFloat(precision_); - value_ = default_; - vrm_ = vrm; - properties_ = properties; - - //parse property rounding mode and save its value as int (needed for BigDecimal, MathContext etc) - // valid rounding modes are: - //"half even" - //"half up" - //"down" - //"ceiling" - //"floor" - //"half down" - //"up" - - if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_UP)) - roundingMode = BigDecimal.ROUND_UP; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_DOWN)) - roundingMode = BigDecimal.ROUND_DOWN; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_CEILING)) - roundingMode = BigDecimal.ROUND_CEILING; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_FLOOR)) - roundingMode = BigDecimal.ROUND_FLOOR; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_UP)) - roundingMode = BigDecimal.ROUND_HALF_UP; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_DOWN)) - roundingMode = BigDecimal.ROUND_HALF_DOWN; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_EVEN)) - roundingMode = BigDecimal.ROUND_HALF_EVEN; - - - //for MathContext, methods take strings which are same as JDProperties rounding modes with "round" added. - roundingModeStr = "ROUND_" + roundingModeStr.toUpperCase().replace(' ', '_'); - } - - public Object clone() { - return new SQLDecFloat34( settings_, vrm_, properties_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccisdConverter) - throws SQLException { - try{ - value_ = ((BigDecimal) typeConverter_.toObject(rawBytes, offset)); - specialValue_ = null; - } catch (ExtendedIllegalArgumentException e) { - //check for NAN and INF flag exception - if ( (specialValue_ = getSpecialValue( e.toString())) == null ) - throw e; - } - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException { - try{ - if ( specialValue_ == null) - typeConverter_.toBytes(value_, rawBytes, offset); - else - typeConverter_.toBytes(specialValue_, rawBytes, offset); //Nan, Infinity, -Infinity - } catch (ExtendedIllegalArgumentException e) { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) throws SQLException { - BigDecimal bigDecimal = null; - specialValue_ = null; - - if (object instanceof String) { - try { - if ( (specialValue_ = getSpecialValue( (String)object)) == null ) { - //not one of the special values, just store as BigDecimal - // Because the string may be using a comma for the decimal separator and we are going to - // store the object as a Java Bigdec, we much check and change to the default '.' notation. - if (((String)object).indexOf(',')!=-1) { - bigDecimal = new BigDecimal (((String)object).replace(',', '.')); - } else { - bigDecimal = new BigDecimal((String)object); - } - } - } catch (NumberFormatException e) { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - } catch (StringIndexOutOfBoundsException e) // jdk 1.3.x throws this - // instead of a NFE - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if (object instanceof Number) { - if ( (specialValue_ = getSpecialValue( object.toString())) == null ) { - //not one of the special values, just store as BigDecimal - bigDecimal = new BigDecimal(object.toString()); //convert to string so all Number types can be passed in - } - } - - else if (object instanceof Boolean) - bigDecimal = (((Boolean) object).booleanValue() == true) ? BigDecimal.valueOf(1) : BigDecimal.valueOf(0); - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - //Round by mode if necessary. - truncated_ = 0; - - //if one of the special values, then no need to check truncation - if(specialValue_ != null) - { - //Nan, Infinity, -Infinity - value_ = null; - return; - } - - //follow native and allow rounding mode to handle - //@pdd int otherScale = bigDecimal.scale(); - //@pdd if(otherScale > ((-1) * DECFLOAT34_MIN_EXP)) //absolute of min_exp is max scale - //@pdd truncated_ += otherScale + DECFLOAT34_MIN_EXP; //diff in scales - - //get precision from bigDecimal without 0's on right side - //@pdd int otherPrecision = SQLDataFactory.getPrecisionForTruncation(bigDecimal, 34); - - //follow native and allow rounding mode to handle - //@pdd if(otherPrecision > precision_) - //@pdd { - //@pdd int digits = otherPrecision - precision_; - //@pdd truncated_ += digits; - //@pdd } - //@pdd else - //@pdd truncated_ = 0; // No left side truncation, report nothing - //@pdd // (even if there was right side truncation). - - value_ = AS400DecFloat.roundByMode(bigDecimal, 34, roundingModeStr); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() { - return SQLData.DECFLOAT; - } - - public String getCreateParameters() { - return null; - } - - public int getDisplaySize() { - return 42; //@pdc same as native - } - - - public String getJavaClassName() { - return "java.math.BigDecimal"; - } - - public String getLiteralPrefix() { - return null; - } - - public String getLiteralSuffix() { - return null; - } - - public String getLocalName() { - return "DECFLOAT"; - } - - public int getMaximumPrecision() { - return precision_; - } - - public int getMaximumScale() { - return 0; - } - - public int getMinimumScale() { - return 0; - } - - public int getNativeType() { - return 996; - } - - public int getPrecision() { - return precision_; - } - - public int getRadix() { - return 10; //decimal base (4 bits per digit) - } - - public int getScale() { - return 0; - } - - public int getType() { - return java.sql.Types.OTHER; //decfloat is not sql type right now. - } - - public String getTypeName() { - return "DECFLOAT"; - } - - public boolean isSigned() { - return true; - } - - public boolean isText() { - return false; - } - - public int getActualSize() { - if(specialValue_ == null) - return SQLDataFactory.getPrecision( value_ ); - else - return specialValue_.length(); - } - - public int getTruncated() { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - //remove this when BigDecimal supports Nan, Inf, -Inf - if(specialValue_ != null){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - if(scale >= 0) - { - if(scale >= value_.scale()) - { - return value_.setScale(scale); - } - else - { - truncated_ = value_.scale() - scale; - return value_.setScale(scale, roundingMode); - } - } - else - return value_; - } - - public InputStream getBinaryStream() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - return false; //false seems logical here - } - - return (value_.compareTo(BigDecimal.valueOf(0)) != 0); - } - - public byte getByte() throws SQLException { - //this code is similar to SQLDouble, and then in inner iff, it is like - // SQLDecimal - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - //@snan snan is not yet supported, return as regular nan - if(specialValue_.indexOf("-SNaN") != -1) //@snan - return (new Double("-NaN")).byteValue(); - else if(specialValue_.indexOf("SNaN") != -1) //@snan - return (new Double("NaN")).byteValue(); - else - return (new Double(specialValue_)).byteValue(); - } - - if (value_.compareTo(BYTE_MAX_VALUE) > 0 || value_.compareTo(BYTE_MIN_VALUE) < 0) { - if (value_.compareTo(SHORT_MAX_VALUE) > 0 || value_.compareTo(SHORT_MIN_VALUE) < 0) { - if (value_.compareTo(INTEGER_MAX_VALUE) > 0 || value_.compareTo(INTEGER_MIN_VALUE) < 0) { - if (value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) { - truncated_ = 15; //16 bytes - 1; - } else { - truncated_ = 7; - } - } else { - truncated_ = 3; - } - } else { - truncated_ = 1; - } - } - return value_.byteValue(); - } - - public byte[] getBytes() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - //@snan snan is not yet supported, return as regular nan - if(specialValue_.indexOf("-SNaN") != -1) //@snan - return (new Double("-NaN")).doubleValue(); - else if(specialValue_.indexOf("SNaN") != -1) //@snan - return (new Double("NaN")).doubleValue(); - else - return (new Double(specialValue_)).doubleValue(); - } - - if (value_.compareTo(DOUBLE_MAX_VALUE) > 0 || value_.compareTo(DOUBLE_MIN_VALUE) < 0) { - truncated_ = 8; //16 bytes - 8; - } - - return value_.doubleValue(); - } - - public float getFloat() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - //@snan snan is not yet supported, return as regular nan - if(specialValue_.indexOf("-SNaN") != -1) //@snan - return (new Float("-NaN")).floatValue(); - else if(specialValue_.indexOf("SNaN") != -1) //@snan - return (new Float("NaN")).floatValue(); - else - return (new Float(specialValue_)).floatValue(); - } - - if (value_.compareTo(FLOAT_MAX_VALUE) > 0 || value_.compareTo(FLOAT_MIN_VALUE) < 0) { - if (value_.compareTo(DOUBLE_MAX_VALUE) > 0 || value_.compareTo(DOUBLE_MIN_VALUE) < 0) { - truncated_ = 12; //16 bytes - 4; - } else { - truncated_ = 4; - } - } - return value_.floatValue(); - } - - public int getInt() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - //remove this when Integer supports Nan, Inf, -Inf - if(specialValue_ != null){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - if (value_.compareTo(INTEGER_MAX_VALUE) > 0 || value_.compareTo(INTEGER_MIN_VALUE) < 0) { - if (value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) { - truncated_ = 12; //16 bytes - 4; - } else { - truncated_ = 4; - } - } - - return value_.intValue(); - } - - public long getLong() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - //remove this when Long supports Nan, Inf, -Inf - if(specialValue_ != null){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - if( value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) - { - truncated_ = 8; //16 bytes - 8; - } - return value_.longValue(); - } - - public Object getObject() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - //in this case, return String object instead of throwing exception - //remove this when BigDecimal supports Nan, Inf, -Inf - if(specialValue_ != null){ - return specialValue_; - } - - return value_; - } - - public short getShort() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - if (value_.compareTo(SHORT_MAX_VALUE) > 0 || value_.compareTo(SHORT_MIN_VALUE) < 0) { - if (value_.compareTo(INTEGER_MAX_VALUE) > 0 || value_.compareTo(INTEGER_MIN_VALUE) < 0) { - if (value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) { - truncated_ = 14; //16 bytes - 2; - } else { - truncated_ = 6; - } - } else { - truncated_ = 2; - } - } - - return value_.shortValue(); - } - - public String getString() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - return specialValue_; - } - - String stringRep = value_.toString(); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - /** Helper method to return string value of special values that - * cannot be held in current BigDecimal objects. - * Valid inputs = "NaN", "NAN", "+NaN", "-NaN", "QNaN", "+QNaN", "-QNaN", "SNaN", "+SNaN", "-SNaN", "INF", "+INF", - * "-INF", "Infinity", "+Infinity", "-Infinity" - */ - private String getSpecialValue(String number){ - //use indexOf() so that we can use this method for exception text from AS400DecFloat also - int startOfValue = -1; - //@snan - if ( (startOfValue = number.toUpperCase().indexOf("SNAN")) != -1 ){ - //check for sign - if ( ((startOfValue > 0 ) && (number.charAt(startOfValue - 1) == '-') ) ) - return "-SNaN"; //no representaion in Double - else - return "SNaN"; //no representaion in Double - } - else if ( (startOfValue = number.toUpperCase().indexOf("NAN")) != -1 ){ - //check for sign - if ( ((startOfValue > 0 ) && (number.charAt(startOfValue - 1) == '-') ) - || ((startOfValue > 1 ) && (number.charAt(startOfValue - 2) == '-')) ) - return "-NaN"; //no representaion in Double - return String.valueOf(Double.NaN); - } - else if ( (startOfValue = number.toUpperCase().indexOf("INF")) != -1){ - //check for sign - if ( (startOfValue != 0 ) && (number.charAt(startOfValue - 1) == '-')) - return String.valueOf(Double.NEGATIVE_INFINITY); - else - return String.valueOf(Double.POSITIVE_INFINITY); - } - else - return null; //not a special value - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - return specialValue_; - } - - String stringRep = value_.toString(); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - //@pda jdbc40 -/* ifdef JDBC40 */ - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLDecimal.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLDecimal.java deleted file mode 100644 index 9109cc977..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLDecimal.java +++ /dev/null @@ -1,572 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLDecimal.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLDecimal -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private. - private static final BigDecimal default_ = BigDecimal.valueOf(0); // @C2A - private static final BigDecimal BYTE_MAX_VALUE = BigDecimal.valueOf(Byte.MAX_VALUE); - private static final BigDecimal BYTE_MIN_VALUE = BigDecimal.valueOf(Byte.MIN_VALUE); - private static final BigDecimal SHORT_MAX_VALUE = BigDecimal.valueOf(Short.MAX_VALUE); - private static final BigDecimal SHORT_MIN_VALUE = BigDecimal.valueOf(Short.MIN_VALUE); - private static final BigDecimal INTEGER_MAX_VALUE = BigDecimal.valueOf(Integer.MAX_VALUE); - private static final BigDecimal INTEGER_MIN_VALUE = BigDecimal.valueOf(Integer.MIN_VALUE); - private static final BigDecimal LONG_MAX_VALUE = BigDecimal.valueOf(Long.MAX_VALUE); - private static final BigDecimal LONG_MIN_VALUE = BigDecimal.valueOf(Long.MIN_VALUE); - static final BigDecimal FLOAT_MAX_VALUE = new BigDecimal(Float.MAX_VALUE); - static final BigDecimal FLOAT_MIN_VALUE = new BigDecimal(Float.MIN_VALUE); - static final BigDecimal DOUBLE_MAX_VALUE = new BigDecimal(Double.MAX_VALUE); - static final BigDecimal DOUBLE_MIN_VALUE = new BigDecimal(Double.MIN_VALUE); - - private SQLConversionSettings settings_; - private int precision_; - private int scale_; - private int truncated_; - private AS400PackedDecimal typeConverter_; - private BigDecimal value_; - private JDProperties properties_; // @M0A - added JDProperties so we can get the scale & precision - private int vrm_; // @M0A - - SQLDecimal(int precision, - int scale, - SQLConversionSettings settings, - int vrm, // @M0C - JDProperties properties) // @M0C - { - settings_ = settings; - precision_ = precision; - scale_ = scale; - truncated_ = 0; - typeConverter_ = new AS400PackedDecimal(precision_, scale_); - value_ = default_; // @C2C - vrm_ = vrm; // @M0A - properties_ = properties; // @M0A - } - - public Object clone() - { - return new SQLDecimal(precision_, scale_, settings_, vrm_, properties_); // @M0C - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccisdConverter) //@P0C - throws SQLException - { - value_ = ((BigDecimal)typeConverter_.toObject(rawBytes, offset)); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - try{ - typeConverter_.toBytes(value_, rawBytes, offset); - } - catch(ExtendedIllegalArgumentException e){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - BigDecimal bigDecimal = null; - - if(object instanceof String) - { - try - { - String value = SQLDataFactory.convertScientificNotation((String)object); // @F3C - if(scale >= 0) - value = SQLDataFactory.truncateScale(value, scale); - bigDecimal = new BigDecimal(value); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - } - catch(StringIndexOutOfBoundsException e) // jdk 1.3.x throws this instead of a NFE - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(object instanceof Number) - { - String value = SQLDataFactory.convertScientificNotation(object.toString()); // @C1C - if(scale >= 0) - value = SQLDataFactory.truncateScale(value, scale); - bigDecimal = new BigDecimal(value); - } - - else if(object instanceof Boolean) - bigDecimal = (((Boolean)object).booleanValue() == true) ? BigDecimal.valueOf(1) : BigDecimal.valueOf(0); - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Truncate if necessary. If we ONLY truncate on the right side, we don't @E2C - // need to report it. If we truncate on the left side, then we report the @E2A - // number of truncated digits on both ends...this will make the dataSize @E2A - // and transferSize make sense on the resulting DataTruncation. @E2A - truncated_ = 0; - int otherScale = bigDecimal.scale(); - if(otherScale > scale_) - truncated_ += otherScale - scale_; - value_ = bigDecimal.setScale(scale_, BigDecimal.ROUND_DOWN); // @E2C - - int otherPrecision = SQLDataFactory.getPrecision(value_); - if(otherPrecision > precision_) - { - int digits = otherPrecision - precision_; - truncated_ += digits; - value_ = SQLDataFactory.truncatePrecision(value_, digits); - } - else // @E2A - truncated_ = 0; // No left side truncation, report nothing @E2A - // (even if there was right side truncation). @E2A - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.DECIMAL; - } - - public String getCreateParameters() - { - StringBuffer buffer = new StringBuffer(); - buffer.append(AS400JDBCDriver.getResource("PRECISION")); - buffer.append(","); - buffer.append(AS400JDBCDriver.getResource("SCALE")); - return buffer.toString(); - } - - public int getDisplaySize() - { - return precision_ + 2; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.math.BigDecimal"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "DECIMAL"; - } - - public int getMaximumPrecision() - { - // @M0C - change to check vrm and JDProperties - if(vrm_ >= JDUtilities.vrm530) - return properties_.getInt(JDProperties.MAXIMUM_PRECISION); - else - return 31; - } - - public int getMaximumScale() - { - // @M0C - change to check vrm and JDProperties - if(vrm_ >= JDUtilities.vrm530) - return properties_.getInt(JDProperties.MAXIMUM_SCALE); - else - return 31; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 484; - } - - public int getPrecision() - { - return precision_; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return scale_; - } - - public int getType() - { - return java.sql.Types.DECIMAL; - } - - public String getTypeName() - { - return "DECIMAL"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return precision_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - if(scale >= 0) - { - if(scale >= value_.scale()) - { - return value_.setScale(scale); - } - else - { - truncated_ = value_.scale() - scale; - return value_.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return value_; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_.compareTo(BigDecimal.valueOf(0)) != 0); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - if(value_.compareTo(BYTE_MAX_VALUE) > 0 || value_.compareTo(BYTE_MIN_VALUE) < 0) - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 1; - } - return(byte) value_.byteValue(); - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - double d = value_.doubleValue(); //@KBA - //@KBD will never occur with current precision of 63 - //@KBD if(value_.compareTo(DOUBLE_MAX_VALUE) > 0 || value_.compareTo(DOUBLE_MIN_VALUE) < 0) - if(d == Double.POSITIVE_INFINITY || d == Double.NEGATIVE_INFINITY) //@KBA - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 8; - } - return d; //@KBC value_.doubleValue(); - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - float f = value_.floatValue(); //@KBA - //@KBD changed in order to avoid optimization problem in JRE 1.3 - //@KBD if(value_.compareTo(FLOAT_MAX_VALUE) > 0 || value_.compareTo(FLOAT_MIN_VALUE) < 0) - if( f == Float.POSITIVE_INFINITY || f == Float.NEGATIVE_INFINITY) //@KBA - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 4; - } - return f; //@KBC value_.floatValue(); - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - if(value_.compareTo(INTEGER_MAX_VALUE) > 0 || value_.compareTo(INTEGER_MIN_VALUE) < 0) - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 4; - } - return value_.intValue(); - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - if(value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 8; - } - return value_.longValue(); - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - if(value_.compareTo(SHORT_MAX_VALUE) > 0 || value_.compareTo(SHORT_MIN_VALUE) < 0) - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 2; - } - return(short) value_.shortValue(); - } - - public String getString() - throws SQLException - { - truncated_ = 0; - String stringRep = JDUtilities.bigDecimalToPlainString(value_); //@big java 1.5 support - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - return new StringReader(getNString()); - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - truncated_ = 0; - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - String stringRep = value_.toString(); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } -/* ifdef JDBC40 */ - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLDecimal2.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLDecimal2.java deleted file mode 100644 index b5993c634..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLDecimal2.java +++ /dev/null @@ -1,508 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLDecimal2.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLDecimal2 -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int precision_; - private int scale_; - private AS400PackedDecimal typeConverter_; - private double value_; - private int truncated_; - private JDProperties properties_; // @M0A - added JDProperties so we can get the scale & precision - private int vrm_; // @M0A - - SQLDecimal2(int precision, - int scale, - SQLConversionSettings settings, - int vrm, // @M0C - JDProperties properties) // @M0C - { - settings_ = settings; - precision_ = precision; - scale_ = scale; - typeConverter_ = new AS400PackedDecimal(precision_, scale_); - value_ = 0; - truncated_ = 0; - vrm_ = vrm; // @M0A - properties_ = properties; // @M0A - } - - public Object clone() - { - return new SQLDecimal2(precision_, scale_, settings_, vrm_, properties_); // @M0C - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccisdConverter) //@P0C - throws SQLException - { - value_ = typeConverter_.toDouble(rawBytes, offset); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - typeConverter_.toBytes(value_, rawBytes, offset); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(object instanceof String) - { - try - { - value_ = Double.valueOf((String)object).doubleValue(); - } - catch(NumberFormatException nfe) - { // @E4A - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); // @E4A - } - } - - else if(object instanceof Number) - value_ = ((Number)object).doubleValue(); - - else if(object instanceof Boolean) - value_ = ((Boolean)object).booleanValue() ? 1 : 0; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.DECIMAL_USING_DOUBLE; - } - - public String getCreateParameters() - { - StringBuffer buffer = new StringBuffer(); - buffer.append(AS400JDBCDriver.getResource("PRECISION")); - buffer.append(","); - buffer.append(AS400JDBCDriver.getResource("SCALE")); - return buffer.toString(); - } - - public int getDisplaySize() - { - return precision_ + 2; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.math.BigDecimal"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "DECIMAL"; - } - - public int getMaximumPrecision() - { - // @M0C - change to check vrm and JDProperties - if(vrm_ >= JDUtilities.vrm530) - return properties_.getInt(JDProperties.MAXIMUM_PRECISION); - else - return 31; - } - - public int getMaximumScale() - { - // @M0C - change to check vrm and JDProperties - if(vrm_ >= JDUtilities.vrm530) - return properties_.getInt(JDProperties.MAXIMUM_SCALE); - else - return 31; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 484; - } - - public int getPrecision() - { - return precision_; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return scale_; - } - - public int getType() - { - return java.sql.Types.DECIMAL; - } - - public String getTypeName() - { - return "DECIMAL"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return precision_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - return new BigDecimal(value_); - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_ != 0); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - if(value_ > Byte.MAX_VALUE || value_ < Byte.MIN_VALUE) - { - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 7; - } - else - { - truncated_ = 3; - } - } - else - { - truncated_ = 1; - } - } - return(byte)value_; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - if(value_ > Float.MAX_VALUE || value_ < -Float.MAX_VALUE) //@trunc min_val is a posative number. //Float.MIN_VALUE) - { - truncated_ = 4; - } - return(float)value_; - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 4; - } - return(int)value_; - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - if(value_ > Long.MAX_VALUE || value_ < Long.MIN_VALUE) - { - truncated_ = 1; // this is not necessarily correct, but we know there is truncation - } - return(long)value_; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return new Double(value_); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 6; - } - else - { - truncated_ = 2; - } - } - return(short)value_; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - String stringRep = Double.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - return new StringReader(getNString()); - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - truncated_ = 0; - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - String stringRep = Double.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - -/* ifdef JDBC40 */ - - //@pda jdbc40 - - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLDouble.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLDouble.java deleted file mode 100644 index a63b0d20f..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLDouble.java +++ /dev/null @@ -1,534 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLDouble.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLDouble -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int truncated_; - private double value_; - - SQLDouble(SQLConversionSettings settings) - { - settings_ = settings; - truncated_ = 0; - value_ = 0.0d; - } - - public Object clone() - { - return new SQLDouble(settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = BinaryConverter.byteArrayToDouble(rawBytes, offset); // @D0C - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - BinaryConverter.doubleToByteArray(value_, rawBytes, offset); // @D0C - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - truncated_ = 0; - - if(object instanceof String) - { - try - { - value_ = Double.valueOf((String) object).doubleValue(); - // You can't test for data truncation of a number by testing - // the lengths of two string versions of it. - // Example string that should work but will fail: - // "4.749000000000E+00" - //@E2D int objectLength = ((String) object).length(); - //@E2D int valueLength = Double.toString(value_).length(); - //@E2D if(valueLength < objectLength) - //@E2D truncated_ = objectLength - valueLength; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - // @ D9d - // else if(object instanceof BigDecimal) { - // value_ = ((BigDecimal) object).doubleValue(); - // int objectLength = SQLDataFactory.getPrecision((BigDecimal) object); - // int valueLength = SQLDataFactory.getPrecision(new BigDecimal(value_)); - // if(valueLength < objectLength) - // truncated_ = objectLength - valueLength; - // } - - else if(object instanceof Number) - { - // Set the value to the right type. - //@bigdectrunc change to follow native driver - value_ = ((Number) object).doubleValue(); - } - - else if(object instanceof Boolean) - value_ = (((Boolean) object).booleanValue() == true) ? 1d : 0d; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.DOUBLE; - } - - public String getCreateParameters() - { - return null; - } - - public int getDisplaySize() - { - return 22; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.Double"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - // Use "FLOAT" not "DOUBLE". See ODBC SQLGetTypeInfo(). - return "FLOAT"; - } - - public int getMaximumPrecision() - { - return 53; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 480; - } - - public int getPrecision() - { - return 53; - } - - public int getRadix() - { - return 2; //@K1C Changed from 10 - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.DOUBLE; - } - - public String getTypeName() - { - return "DOUBLE"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return SQLDataFactory.getPrecision(Double.toString(value_)); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - // Convert the value to a String before creating the - // BigDecimal. This will create the exact BigDecimal - // that we want. If you pass the value directly to - // BigDecimal, then the value is not exact, and the - // scale becomes bigger than expected. - - // @A0A - // Modified the code to deal with numbers in scientific - // notations. The numbers that are in scientific notation - // are parsed to a base (the part before 'E') and an - // exponent (the part after 'E'). The base is then used - // to construct the BigDecimal object and then the exponent - // is used to shift the decimal point to its rightful place. - - // BigDecimal bigDecimal = new BigDecimal(Double.toString(value_)) // @A0D - - truncated_ = 0; - - BigDecimal bigDecimal = null; // @A0A - - String numString = Double.toString(value_); // @A0A - int eIndex = numString.indexOf("E"); // @A0A - if(eIndex == -1) - { // @A0A - bigDecimal = new BigDecimal(numString); // @A0A - } // @A0A - else - { // @A0A - String base = numString.substring(0, eIndex); // @A0A - int exponent = Integer.parseInt(numString.substring(eIndex+1)); // @A0A - bigDecimal = new BigDecimal(base); // @A0A - bigDecimal = bigDecimal.movePointRight(exponent); // @A0A - } // @A0A - - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_ != 0.0d); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - if(value_ > Byte.MAX_VALUE || value_ < Byte.MIN_VALUE) - { - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 7; - } - else - { - truncated_ = 3; - } - } - else - { - truncated_ = 1; - } - } - return(byte) value_; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - return(double) value_; - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - if(Double.isInfinite(value_)) //@tr3a - truncated_ = 0; //@tr3a - else if(value_ > Float.MAX_VALUE || value_ < -Float.MAX_VALUE) //@trunc min_val is a posative number. //Float.MIN_VALUE) //@tr3c - { - truncated_ = 4; - } - return(float) value_; - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 4; - } - return(int) value_; - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - if(value_ > Long.MAX_VALUE || value_ < Long.MIN_VALUE) - { - truncated_ = 1; // this is not necessarily correct, but we know there is truncation - } - return(long) value_; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return new Double(value_); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 6; - } - else - { - truncated_ = 2; - } - } - return(short) value_; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - String stringRep = Double.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - String stringRep = Double.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - -/* ifdef JDBC40 */ - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLFloat.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLFloat.java deleted file mode 100644 index 55359d683..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLFloat.java +++ /dev/null @@ -1,529 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLFloat.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLFloat -implements SQLData -{ - - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int truncated_; - private double value_; - - SQLFloat(SQLConversionSettings settings) - { - settings_ = settings; - truncated_ = 0; - value_ = 0.0d; - } - - public Object clone() - { - return new SQLFloat(settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = BinaryConverter.byteArrayToDouble(rawBytes, offset); // @D0C - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - BinaryConverter.doubleToByteArray(value_, rawBytes, offset); // @D0C - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - truncated_ = 0; - - if(object instanceof String) - { - try - { - value_ = Double.valueOf((String) object).doubleValue(); - // You can't test for data truncation of a number by testing - // the lengths of two string versions of it. - // Example string that should work but will fail: - // "4.749000000000E+00" - //@E2D int objectLength = ((String) object).length(); - //@E2D int valueLength = Double.toString(value_).length(); - //@E2D if(valueLength < objectLength) - //@E2D truncated_ = objectLength - valueLength; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - //else if(object instanceof BigDecimal) { - // value_ = ((BigDecimal) object).doubleValue(); - // int objectLength = SQLDataFactory.getPrecision((BigDecimal) object); - // int valueLength = SQLDataFactory.getPrecision(new BigDecimal(value_)); - // if(valueLength < objectLength) - // truncated_ = objectLength - valueLength; - //} - - else if(object instanceof Number) - { - // Set the value to the right type. - value_ = ((Number) object).doubleValue(); // @D9c - - // Get the whole number portion of that value. - //long value = (long) value_; // @D9a //@bigdectrunc change to follow native driver - - // Get the original value as a long. This is the - // largest precision we can test for for a truncation. - // long truncTest = ((Number) object).longValue(); // @D9a //@bigdectrunc - - // If they are not equal, then we truncated significant - // data from the original value the user wanted us to insert. - //if(truncTest != value) // @D9a //@bigdectrunc - //truncated_ = 1; //@bigdectrunc - } - - else if(object instanceof Boolean) - value_ = (((Boolean) object).booleanValue() == true) ? 1d : 0d; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.FLOAT; - } - - public String getCreateParameters() - { - return null; - } - - public int getDisplaySize() - { - return 22; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.Float"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "FLOAT"; - } - - public int getMaximumPrecision() - { - return 53; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 480; - } - - public int getPrecision() - { - return 53; - } - - public int getRadix() - { - return 2; //@K1C changed from 10 - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.FLOAT; - } - - public String getTypeName() - { - return "FLOAT"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return SQLDataFactory.getPrecision(Double.toString(value_)); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - // Convert the value to a String before creating the - // BigDecimal. This will create the exact BigDecimal - // that we want. If you pass the value directly to - // BigDecimal, then the value is not exact, and the - // scale becomes bigger than expected. - - // @A0A - // Modified the code to deal with numbers in scientific - // notations. The numbers that are in scientific notation - // are parsed to a base (the part before 'E') and an - // exponent (the part after 'E'). The base is then used - // to construct the BigDecimal object and then the exponent - // is used to shift the decimal point to its rightful place. - - // BigDecimal bigDecimal = new BigDecimal(Double.toString(value_)) // @A0D - - truncated_ = 0; - - BigDecimal bigDecimal = null; // @A0A - - String numString = Double.toString(value_); // @A0A - int eIndex = numString.indexOf("E"); // @A0A - if(eIndex == -1) - { // @A0A - bigDecimal = new BigDecimal(numString); // @A0A - } // @A0A - else - { // @A0A - String base = numString.substring(0, eIndex); // @A0A - int exponent = Integer.parseInt(numString.substring(eIndex+1)); // @A0A - bigDecimal = new BigDecimal(base); // @A0A - bigDecimal = bigDecimal.movePointRight(exponent); // @A0A - } // @A0A - - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_ != 0.0d); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - if(value_ > Byte.MAX_VALUE || value_ < Byte.MIN_VALUE) - { - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - truncated_ = 3; - } - else - { - truncated_ = 1; - } - } - return(byte) value_; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - return(double) value_; - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - return(float) value_; - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 1; // this may not be accurate but we know truncation will occur - } - return(int) value_; - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - if(value_ > Long.MAX_VALUE || value_ < Long.MIN_VALUE) - { - truncated_ = 1; // this is not necessarily correct, but we know there is truncation - } - return(long) value_; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return new Double(value_); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 3; - } - else - { - truncated_ = 2; - } - } - return(short) value_; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - String stringRep = Double.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - String stringRep = Double.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - -/* ifdef JDBC40 */ - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLGraphic.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLGraphic.java deleted file mode 100644 index 47acd17a3..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLGraphic.java +++ /dev/null @@ -1,701 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLGraphic.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.CharConversionException; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.net.URL; - -final class SQLGraphic -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int maxLength_; - private int truncated_; - private String value_; - private String originalValue_; - private int ccsid_; //@cca1 - - SQLGraphic(int maxLength, SQLConversionSettings settings, int ccsid) //@cca1 - { - settings_ = settings; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; - originalValue_ = ""; - ccsid_ = ccsid; //@cca1 - } - - public Object clone() - { - return new SQLGraphic(maxLength_, settings_, ccsid_); //@cca1 - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - value_ = ccsidConverter.byteArrayToString(rawBytes, offset, maxLength_, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - // We originally padded with a single byte space. We now have the - // ccsid so we can figure out if that was right or not. If we should - // have use the double byte space, re-pad. - int ccsid = ccsidConverter.getCcsid(); - if(ccsid != 13488 && ccsid != 1200) - { - int valueLength = originalValue_.length(); - int exactLength = getDisplaySize(); - if(valueLength < exactLength) - { - StringBuffer buffer = new StringBuffer(originalValue_); - char c = '\u3000'; - for(int i = valueLength; i < exactLength; ++i) - buffer.append(c); - value_ = buffer.toString(); - } - } - - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - try - { - ccsidConverter.stringToByteArray(value_, rawBytes, offset, maxLength_, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - } - catch(CharConversionException e) - { - maxLength_ = ccsidConverter.stringToByteArray(value_, bidiConversionProperties).length; //@KBC changed to use bidiConversionProperties instead of bidiStringType - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - String value = null; - - if(object instanceof String) - value = (String) object; - - else if(object instanceof Number) - value = object.toString(); - - else if(object instanceof Boolean) - { - // @PDC - // if "translate boolean" == false, then use "0" and "1" values to match native driver - if(settings_.getTranslateBoolean() == true) - value = object.toString(); //"true" or "false" - else - value = ((Boolean)object).booleanValue() == true ? "1" : "0"; - } - - else if(object instanceof Time) - value = SQLTime.timeToString((Time) object, settings_, calendar); - - else if(object instanceof Timestamp) - value = SQLTimestamp.timestampToString((Timestamp) object, calendar); - - else if(object instanceof java.util.Date) - value = SQLDate.dateToString((java.util.Date) object, settings_, calendar); - - else if(object instanceof URL) - value = object.toString(); - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value = clob.getSubString(1, (int)clob.length()); - } -/* ifdef JDBC40 */ - else if(object instanceof SQLXML) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value = xml.getString(); - } -/* endif */ - - if(value == null) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - value_ = value; - originalValue_ = value; - - - // Set to the exact length. - int valueLength = value_.length(); - int exactLength = getDisplaySize(); - if(valueLength < exactLength) - { - StringBuffer buffer = new StringBuffer(value_); - char c = '\u0020'; - for(int i = valueLength; i < exactLength; ++i) - buffer.append(c); - value_ = buffer.toString(); - truncated_ = 0; - } - else if(valueLength > exactLength) - { - value_ = value_.substring(0, exactLength); - truncated_ = valueLength - exactLength; - } - else - truncated_ = 0; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.GRAPHIC; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - if(ccsid_ == 65535) //@bingra - return maxLength_; //@bingra - else - return maxLength_ / 2; - } - - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "GRAPHIC"; - } - - public int getMaximumPrecision() - { - return 16382; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 468; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.CHAR; - } - - public String getTypeName() - { - if( ccsid_ == 13488 || ccsid_ == 1200) //@cca1 - return "NCHAR"; //@cca1 same as native - return "GRAPHIC"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(getString().trim())); - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(getString())); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(getString()), maxLength_); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true", "false", "1", or "0", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = getString().trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).byteValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCClob(getString(), maxLength_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(getString(), settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).intValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).longValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).shortValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(getString(), settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(getString(), calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(getString()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - // Added method trim() to trim the string. - public void trim() - { - value_ = value_.trim(); - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } - -/* ifdef JDBC40 */ - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - // - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this string contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLInteger.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLInteger.java deleted file mode 100644 index bcdfb539a..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLInteger.java +++ /dev/null @@ -1,558 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLInteger.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLInteger -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private int truncated_; - private int value_; - private int scale_; // @A0A - private BigDecimal bigDecimalValue_ = null; // @A0A - private int vrm_; //trunc3 - - SQLInteger(int vrm) //@trunc3 - { - this(0, vrm); //@trunc3 - } - - SQLInteger(int scale, int vrm) // @A0A //@trunc3 - { - truncated_ = 0; - value_ = 0; - scale_ = scale; // @A0A - if(scale_ > 0) // @C0A - bigDecimalValue_ = new BigDecimal(Integer.toString(value_)); // @A0A - vrm_ = vrm; //@trunc3 - } - - public Object clone() - { - return new SQLInteger(scale_, vrm_); //@trunc3 - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = BinaryConverter.byteArrayToInt(rawBytes, offset); // @D0C - - if(scale_ > 0) - { // @C0A - bigDecimalValue_ = (new BigDecimal(Integer.toString(value_))).movePointLeft(scale_); // @A0A - value_ = bigDecimalValue_.intValue(); // @A0A - } // @C0A - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - BinaryConverter.intToByteArray(value_, rawBytes, offset); // @D0C - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - truncated_ = 0; // @D9c - - if(object instanceof String) - { - // @D10c new implementation - // old ... - // - // try - // { - // value_ = Integer.parseInt((String) object); - // } - // catch(NumberFormatException e) - // { - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - // } - // - // new ... - - // @P1 First try to convert the string to an int (no extra object creation). If - // that fails try turning it into a Double, which will involve an extra object - // create but Double will accept bigger numbers and floating point numbers so it - // will catch more truncation cases. The bottom line is don't create an extra - // object in the normal case. If the user does ps.setString(1, "111222333.444.555") - // on an integer field, they can't expect the best performance. - boolean tryAgain = false; // @P1a - - try - { - // @P1d long longValue = (long) Double.parseDouble((String) object); - long longValue = (long) Long.parseLong((String) object); // @P1a - - if(( longValue > Integer.MAX_VALUE ) || ( longValue < Integer.MIN_VALUE )) - { - truncated_ = 4; // @D9c - //@trunc3 match native for ps.setString() to throw mismatch instead of truncation - if(vrm_ >= JDUtilities.vrm610) //@trunc3 - { //@trunc3 - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); //@trunc3 - } //@trunc3 - } - value_ = (int) longValue; - } - catch(NumberFormatException e) - { - tryAgain = true; // @P1a - // @P1d JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - if(tryAgain) // @P1a - { - // @P1a - try // @P1a - { - // @P1a - double doubleValue = Double.valueOf((String) object).doubleValue(); // @P1a - // @P1a - if(( doubleValue > Integer.MAX_VALUE ) || ( doubleValue < Integer.MIN_VALUE )) // @P1a - { - // @P1a - truncated_ = 4; // @P1a - //@trunc3 match native for ps.setString() to throw mismatch instead of truncation - if(vrm_ >= JDUtilities.vrm610) //@trunc3 - { //@trunc3 - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); //@trunc3 - } //@trunc3 - } // @P1a - value_ = (int) doubleValue; // @P1a - } // @P1a - catch(NumberFormatException e) // @P1a - { - // @P1a - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); // @P1a - } // @P1a - } // @P1a - } - - else if(object instanceof Number) - { - // Compute truncation by getting the value as a long - // and comparing it against MAX_VALUE/MIN_VALUE. You - // do this because truncation of the decimal portion of - // the value is insignificant. We only care if the - // whole number portion of the value is too large/small - // for the column. - long longValue = ((Number) object).longValue(); // @D9c - if(( longValue > Integer.MAX_VALUE ) || ( longValue < Integer.MIN_VALUE )) // @D9c - { - // Note: Truncated here is set to 4 bytes. This is based on - // the idea that a long was used and an int was the - // column type. We could check for different types - // and provide a more accurate number, but I don't - // really know that this field is of any use to people - // in this case anyway (for example, you could have a - // float (4 bytes) that didn't fit into a bigint (8 - // bytes) without some data truncation. - truncated_ = 4; // @D9c - } - - // Store the value. - value_ = (int) longValue; // @D9c - } - - else if(object instanceof Boolean) - value_ = (((Boolean) object).booleanValue() == true) ? 1 : 0; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - if(scale_ > 0) - { // @C0A - bigDecimalValue_ = (new BigDecimal(Integer.toString(value_))).movePointLeft(scale_); // @A0A - value_ = bigDecimalValue_.intValue(); // @A0A - } // @C0A - } - - public void set(int value) // @E2A - { // @E2A - value_ = value; // @E2A - } // @E2A - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.INTEGER; - } - - public String getCreateParameters() - { - return null; - } - - public int getDisplaySize() - { - return 11; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.Integer"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "INTEGER"; - } - - public int getMaximumPrecision() - { - return 10; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 496; - } - - public int getPrecision() - { - return 10; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return scale_; - } - - public int getType() - { - return java.sql.Types.INTEGER; - } - - public String getTypeName() - { - return "INTEGER"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return 4; // @D0C - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - if(scale_ > 0) - { // @C0A - if(scale >= 0) - return bigDecimalValue_.setScale(scale); // @A0A - else - return bigDecimalValue_; - } // @C0A - else - { // @C0A - if(scale <= 0) // @C0A - return BigDecimal.valueOf((long) value_); // @C0A - else // @C0A - return BigDecimal.valueOf((long) value_).setScale(scale); // @C0A - } // @C0A - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_ != 0); - } - - public byte getByte() - throws SQLException - { - if(value_ > Byte.MAX_VALUE || value_ < Byte.MIN_VALUE) - { - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - truncated_ = 3; - } - else - { - truncated_ = 1; - } - } - return(byte) value_; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - if(scale_ > 0) // @C0A - return bigDecimalValue_.doubleValue(); // @A0A - else // @C0A - return(double) value_; // @A0D @C0A - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - if(scale_ > 0) // @C0A - return bigDecimalValue_.floatValue(); // @A0A - else // @C0A - return(float) value_; // @A0D @C0A - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return new Integer((int) value_); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - truncated_ = 2; - } - return(short) value_; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - if(scale_ > 0) // @C0A - return bigDecimalValue_.toString(); // @A0A - else // @C0A - return Integer.toString(value_); // @A0D @C0A - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - if(scale_ > 0) - return bigDecimalValue_.toString(); - else - return Integer.toString(value_); - } -/* ifdef JDBC40 */ - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLLongNVarchar.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLLongNVarchar.java deleted file mode 100644 index 3b7e574a7..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLLongNVarchar.java +++ /dev/null @@ -1,733 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLLongNVarchar.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ - -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -//@PDA jdbc40 new class - -final class SQLLongNVarchar -implements SQLData -{ - - // Private data. - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private String value_; - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLLongNVarchar(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLLongNVarchar(maxLength_, settings_); //@pdc - } - - public void trim() - { - value_ = value_.trim(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - value_ = ccsidConverter.byteArrayToString(rawBytes, offset+2, length_, bidiConversionProperties); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - try - { - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - // The length in the first 2 bytes is actually the length in characters. - byte[] temp = ccsidConverter.stringToByteArray(value_, bidiConversionProperties); - BinaryConverter.unsignedShortToByteArray(temp.length, rawBytes, offset); - if(temp.length > maxLength_) - { - maxLength_ = temp.length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL); - } - System.arraycopy(temp, 0, rawBytes, offset+2, temp.length); - - // The buffer we are filling with data is big enough to hold the entire field. - // For varchar fields the actual data is often smaller than the field width. - // That means whatever is in the buffer from the previous send is sent to the - // system. The data stream includes actual data length so the old bytes are not - // written to the database, but the junk left over may decrease the affectiveness - // of compression. The following code will write hex 0s to the buffer when - // actual length is less that field length. Note the 0s are written only if - // the field length is pretty big. The data stream code (DBBaseRequestDS) - // does not compress anything smaller than 1K. - if((maxLength_ > 256) && (maxLength_ - temp.length > 16)) - { - int stopHere = offset + 2 + maxLength_; - for(int i=offset + 2 + temp.length; i= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value = clob.getSubString(1, (int)clob.length()); - } -/* ifdef JDBC40 */ - else if(object instanceof SQLXML) - { - SQLXML xml = (SQLXML)object; - value = xml.getString(); - } -/* endif */ - - if(value == null) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - value_ = value; - - // Truncate if necessary. - int valueLength = value_.length(); - - int truncLimit = maxLength_; - - if(valueLength > truncLimit) - { - value_ = value_.substring(0, truncLimit); - truncated_ = valueLength - truncLimit; - } - else - truncated_ = 0; - - length_ = value_.length(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.LONG_NVARCHAR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - // JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "LONGNVARCHAR"; - } - - public int getMaximumPrecision() - { - return 32739; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 456; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { -/* ifdef JDBC40 */ - return java.sql.Types.LONGNVARCHAR; -/* endif */ -/* ifndef JDBC40 - return java.sql.Types.LONGVARCHAR; - endif */ - - - } - - public String getTypeName() - { -/* ifdef JDBC40 */ - return "LONGNVARCHAR"; -/* endif */ -/* ifndef JDBC40 - return "LONGVARCHAR"; - endif */ - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_)); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(value_)); - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(value_)); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(value_), maxLength_); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true" or "false", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = value_.trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(value_.trim())).byteValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - if(d > Byte.MAX_VALUE || d < Byte.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.byteValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(value_); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCClob(getString(), maxLength_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(value_, settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(value_.trim())).intValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Integer.MAX_VALUE || d < Integer.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.intValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(value_.trim())).longValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Long.MAX_VALUE || d < Long.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.longValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(value_.trim())).shortValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Short.MAX_VALUE || d < Short.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.shortValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length() - maxFieldSize; - return value_.substring(0, maxFieldSize); - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(value_, settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(value_, calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(value_), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } - - -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, maxLength_); - } -/* endif */ - - public String getNString() throws SQLException - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - - } - -/* ifdef JDBC40 */ - public RowId getRowId() throws SQLException - { - - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this string contains non-hex characters - //JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - //return null; - //} - - //Decided this is of no use because rowid is so specific to the dbms internals. - //And there are issues in length and difficulties in converting to a - //valid rowid that is useful. - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } - -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLLongVarchar.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLLongVarchar.java deleted file mode 100644 index 7a11ccdcb..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLLongVarchar.java +++ /dev/null @@ -1,724 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLLongVarchar.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLLongVarchar -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private String value_; - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLLongVarchar(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLLongVarchar(maxLength_, settings_); //@pdc - } - - // @A2A - // Added method trim() to trim the string. - public void trim() // @A2A - { // @A2A - value_ = value_.trim(); // @A2A - } // @A2A - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - try{ - value_ = ccsidConverter.byteArrayToString(rawBytes, offset+2, length_, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidStringType - }catch(Exception e){ - JDError.throwSQLException(JDError.EXC_CHAR_CONVERSION_INVALID, e); - } - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - try - { - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - // The length in the first 2 bytes is actually the length in characters. - byte[] temp = ccsidConverter.stringToByteArray(value_, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - BinaryConverter.unsignedShortToByteArray(temp.length, rawBytes, offset); - if(temp.length > maxLength_) - { - maxLength_ = temp.length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL); - } - System.arraycopy(temp, 0, rawBytes, offset+2, temp.length); - - // The buffer we are filling with data is big enough to hold the entire field. - // For varchar fields the actual data is often smaller than the field width. - // That means whatever is in the buffer from the previous send is sent to the - // system. The data stream includes actual data length so the old bytes are not - // written to the database, but the junk left over may decrease the affectiveness - // of compression. The following code will write hex 0s to the buffer when - // actual length is less that field length. Note the 0s are written only if - // the field length is pretty big. The data stream code (DBBaseRequestDS) - // does not compress anything smaller than 1K. - if( (maxLength_ - temp.length > 16)) //@rle - { - int stopHere = offset + 2 + maxLength_; - for(int i=offset + 2 + temp.length; i= 20 && object instanceof Clob) - { // @C1C - Clob clob = (Clob)object; // @C1C - value = clob.getSubString(1, (int)clob.length()); // @C1C @D1 - } // @C1C - -/* ifdef JDBC40 */ - else if(object instanceof SQLXML) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value = xml.getString(); - } -/* endif */ - - if(value == null) // @C1C - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - value_ = value; // @C1A - - // Truncate if necessary. - int valueLength = value_.length(); - - int truncLimit = maxLength_; // @F2a - - if(valueLength > truncLimit) // @F2c - { - value_ = value_.substring(0, truncLimit); // @F2c - truncated_ = valueLength - truncLimit; // @F2c - } - else - truncated_ = 0; - - length_ = value_.length(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.LONG_VARCHAR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "VARCHAR"; //@E1C changed to return VARCHAR to match other clients - } - - public int getMaximumPrecision() - { - return 32739; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 456; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.VARCHAR; //@E1C changed to return VARCHAR to match other clients - } - - public String getTypeName() - { - return "VARCHAR"; //@E1C changed to return VARCHAR to match other clients - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_)); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(value_)); // @F3C - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(value_)); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(value_), maxLength_); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true" or "false", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = value_.trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(value_.trim())).byteValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - if(d > Byte.MAX_VALUE || d < Byte.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.byteValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(value_); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCClob(getString(), maxLength_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(value_, settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(value_.trim())).intValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Integer.MAX_VALUE || d < Integer.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.intValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(value_.trim())).longValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Long.MAX_VALUE || d < Long.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.longValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(value_.trim())).shortValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Short.MAX_VALUE || d < Short.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.shortValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length() - maxFieldSize; - return value_.substring(0, maxFieldSize); - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(value_, settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(value_, calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(value_), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, maxLength_); - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - - } - -/* ifdef JDBC40 */ - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this string contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } -/* endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLLongVarcharForBitData.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLLongVarcharForBitData.java deleted file mode 100644 index 4451570f8..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLLongVarcharForBitData.java +++ /dev/null @@ -1,661 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLLongVarcharForBitData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLLongVarcharForBitData -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private static final byte[] default_ = new byte[0]; // @C2A - - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private byte[] value_; - - SQLLongVarcharForBitData(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = default_; // @C2C - } - - public Object clone() - { - return new SQLLongVarcharForBitData(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - AS400ByteArray typeConverter = new AS400ByteArray(length_); - value_ = (byte[])typeConverter.toObject(rawBytes, offset+2); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - AS400ByteArray typeConverter = new AS400ByteArray(length_); - BinaryConverter.unsignedShortToByteArray(length_, rawBytes, offset); - typeConverter.toBytes(value_, rawBytes, offset + 2); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(object instanceof String) - { - try - { - value_ = BinaryConverter.stringToBytes((String)object); //@F1A - } - catch(NumberFormatException nfe) - { - // the String contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else if(object instanceof byte[]) - value_ = (byte[])object; // @C1C - - else if(object instanceof InputStream) - { - //value_ = JDUtilities.streamToBytes((InputStream)object, scale); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(object instanceof Reader) - { - // value_ = BinaryConverter.stringToBytes(JDUtilities.readerToString((Reader)object, scale)); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - stream.close(); //@scan1 - - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - stream.close(); //@scan1 - - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Blob) - value_ = ((Blob)object).getBytes(1, (int)((Blob)object).length()); // @C1C @E2C Blobs are 1 based. - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - try - { - value_ = BinaryConverter.stringToBytes(((Clob)object).getSubString(1, (int)((Clob)object).length())); //@F1A - } - catch(NumberFormatException nfe) - { - // the Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Truncate if necessary. - int valueLength = value_.length; - if(valueLength > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - truncated_ = valueLength - maxLength_; - } - else - truncated_ = 0; - - length_ = value_.length; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.LONG_VARCHAR_FOR_BIT_DATA; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_ ; - } - - //@F2A JDBC 3.0 - public String getJavaClassName() - { - return "[B"; - } - - public String getLiteralPrefix() - { - return "X\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "LONG VARCHAR"; - } - - public int getMaximumPrecision() - { - return 32739; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 456; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.LONGVARBINARY; - } - - public String getTypeName() - { - return "LONG VARCHAR FOR BIT DATA"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - - // changed to return stream containing hex string - // return new ByteArrayInputStream(getBytes()); - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new ByteArrayInputStream(getBytes()); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCBlob(getBytes(), maxLength_); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length - maxFieldSize; - byte[] truncatedValue = new byte[maxFieldSize]; - System.arraycopy(value_, 0, truncatedValue, 0, maxFieldSize); - return truncatedValue; - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - //@F1D return new StringReader(new String(getBytes())); - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); //@F1A - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - //@F1D return new AS400JDBCClob(new String(getBytes())); - return new AS400JDBCClob(BinaryConverter.bytesToHexString(getBytes()), maxLength_); //@F1A - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return getBytes(); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - //@F1D return new String(getBytes()); - return BinaryConverter.bytesToHexString(getBytes()); //@F1A - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - - // changed to return stream containing hex string - // return new ByteArrayInputStream(getBytes()); - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - - //@PDA jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCNClob(BinaryConverter.bytesToHexString(getBytes()), maxLength_); - } -/* endif */ - - //@PDA jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } -/* ifdef JDBC40 */ - //@PDA jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@PDA jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLLongVargraphic.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLLongVargraphic.java deleted file mode 100644 index 7ebc2131f..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLLongVargraphic.java +++ /dev/null @@ -1,696 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLLongVargraphic.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLLongVargraphic -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private String value_; - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLLongVargraphic(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLLongVargraphic(maxLength_, settings_); - } - - // Added method trim() to trim the string. - public void trim() - { - value_ = value_.trim(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - // If the field is VARGRAPHIC, length_ contains the number - // of characters in the string, while the converter is expecting - // the number of bytes. Thus, we need to multiply length_ by 2. - value_ = ccsidConverter.byteArrayToString(rawBytes, offset+2, length_*2, bidiConversionProperties); //@KBC changed to use bidiConvesionProperties instead of bidiStringType - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - try - { - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - // The length in the first 2 bytes is actually the length in characters. - byte[] temp = ccsidConverter.stringToByteArray(value_, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - BinaryConverter.unsignedShortToByteArray(temp.length/2, rawBytes, offset); - - if(temp.length > maxLength_) - { - maxLength_ = temp.length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL); - } - System.arraycopy(temp, 0, rawBytes, offset+2, temp.length); - - // The buffer we are filling with data is big enough to hold the entire field. - // For varchar fields the actual data is often smaller than the field width. - // That means whatever is in the buffer from the previous send is sent to the - // system. The data stream includes actual data length so the old bytes are not - // written to the database, but the junk left over may decrease the effectiveness - // of compression. The following code will write hex 0s to the buffer when - // actual length is less that field length. Note the 0s are written only if - // the field length is pretty big. The data stream code (DBBaseRequestDS) - // does not compress anything smaller than 1K. - if((maxLength_ > 256) && (maxLength_ - temp.length > 16)) - { - int stopHere = offset + 2 + maxLength_; - for(int i=offset + 2 + temp.length; i= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value = clob.getSubString(1, (int)clob.length()); - } -/* ifdef JDBC40 */ - else if(object instanceof SQLXML) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value = xml.getString(); - } -/* endif */ - - if(value == null) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - value_ = value; - - // Truncate if necessary. - int valueLength = value_.length(); - - int truncLimit = maxLength_ / 2; - - if(valueLength > truncLimit) - { - value_ = value_.substring(0, truncLimit); - truncated_ = valueLength - truncLimit; - } - else - truncated_ = 0; - - length_ = value_.length(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.LONG_VARGRAPHIC; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_ / 2; - } - - // JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "LONG VARGRAPHIC"; - } - - public int getMaximumPrecision() - { - return 16369; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 472; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.LONGVARCHAR; - } - - public String getTypeName() - { - return "LONG VARGRAPHIC"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_)); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(value_)); // @F3C - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(value_)); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(value_), maxLength_); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true" or "false", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = value_.trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).byteValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(value_); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCClob(getString(), maxLength_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(value_, settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).intValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).longValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).shortValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length() - maxFieldSize; - return value_.substring(0, maxFieldSize); - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(value_, settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(value_, calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(value_), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, maxLength_); - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } -/* ifdef JDBC40 */ - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - // - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this string contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLNChar.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLNChar.java deleted file mode 100644 index 5c8889d4b..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLNChar.java +++ /dev/null @@ -1,707 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLNChar.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.CharConversionException; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.net.URL; - -//@PDA jdbc40 new class -final class SQLNChar -implements SQLData -{ - - // Private data. - private SQLConversionSettings settings_; - private int maxLength_; - private int truncated_; - private String value_; - - SQLNChar(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLNChar(maxLength_,settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - value_ = ccsidConverter.byteArrayToString(rawBytes, offset, maxLength_, bidiConversionProperties); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - try - { - ccsidConverter.stringToByteArray(value_, rawBytes, offset, maxLength_, bidiConversionProperties); - } - catch(CharConversionException e) - { - maxLength_ = ccsidConverter.stringToByteArray(value_, bidiConversionProperties).length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e, "Change Descriptor"); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - String value = null; - - if(object instanceof String) - value = (String)object; - - else if(object instanceof Character) - value = object.toString(); - - else if(object instanceof Number) - value = object.toString(); - - else if(object instanceof Boolean) - { - // if "translate boolean" == false, then use "0" and "1" values to match native driver - if(settings_.getTranslateBoolean() == true) - value = object.toString(); //"true" or "false" - else - value = ((Boolean)object).booleanValue() == true ? "1" : "0"; - } - else if(object instanceof Time) - value = SQLTime.timeToString((Time)object, settings_, calendar); - - else if(object instanceof Timestamp) - value = SQLTimestamp.timestampToString((Timestamp)object, calendar); - - else if(object instanceof java.util.Date) - value = SQLDate.dateToString((java.util.Date)object, settings_, calendar); - - else if(object instanceof URL) - value = object.toString(); - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value = clob.getSubString(1, (int)clob.length()); - } - - if(value == null) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - value_ = value; - - // Set to the exact length. - int valueLength = value_.length(); - int exactLength = getDisplaySize(); - if(valueLength < exactLength) - { - StringBuffer buffer = new StringBuffer(value_); - char c = '\u0020'; - for(int i = valueLength; i < exactLength; ++i) - buffer.append(c); - value_ = buffer.toString(); - truncated_ = 0; - } - else if(valueLength > exactLength) - { - value_ = value_.substring(0, exactLength); - truncated_ = valueLength - exactLength; - } - else - truncated_ = 0; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.NCHAR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - // JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "NCHAR"; - } - - public int getMaximumPrecision() - { - return 32765; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 452; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { -/* ifdef JDBC40 */ - return java.sql.Types.NCHAR; -/* endif */ -/* ifndef JDBC40 - return java.sql.Types.CHAR; - endif */ - } - - public String getTypeName() - { -/* ifdef JDBC40 */ - return "NCHAR"; -/* endif */ -/* ifndef JDBC40 - return "CHAR"; - endif */ - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(getString().trim())); - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(getString())); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(getString()), maxLength_); - } - catch(NumberFormatException nfe) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true", "false", "1", or "0", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = getString().trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).byteValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - if(d > Byte.MAX_VALUE || d < Byte.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.byteValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(getString(), settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).intValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Integer.MAX_VALUE || d < Integer.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.intValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).longValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Long.MAX_VALUE || d < Long.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.longValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).shortValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Short.MAX_VALUE || d < Short.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.shortValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(getString(), settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(getString(), calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - - try - { - return new ReaderInputStream(new StringReader(getString()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - // Added method trim() to trim the string. - public void trim() - { - value_ = value_.trim(); - } - - - - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } - -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } -/* endif */ - - public String getNString() throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } - -/* ifdef JDBC40 */ - public RowId getRowId() throws SQLException - { - - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this string contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - - //Decided this is of no use because rowid is so specific to the dbms internals. - //And there are issues in length and difficulties in converting to a - //valid rowid that is useful. - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLNClob.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLNClob.java deleted file mode 100644 index c8335ce05..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLNClob.java +++ /dev/null @@ -1,638 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLNClob.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ - -//@PDA jdbc40 brand new class -//This is almost the same as SQLClob, and I would have liked to extend it, but it is final, and so decided -//to not extend. It may come in handy for future NClob deviations also. - -final class SQLNClob implements SQLData -{ - - private int length_; // Length of string, in characters. - private int maxLength_; // Max length of field, in bytes. - private SQLConversionSettings settings_; - private int truncated_; - private String value_; - private Object savedObject_; // This is our byte[] or InputStream or whatever that we save to convert to bytes until we really need to. - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLNClob(int maxLength, SQLConversionSettings settings) - { - length_ = 0; - maxLength_ = maxLength; - settings_ = settings; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLNClob(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToInt(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - value_ = ccsidConverter.byteArrayToString(rawBytes, offset + 4, length_, bidiConversionProperties); - savedObject_ = null; - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - if(savedObject_ != null) doConversion(); - - try - { - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - byte[] temp = ccsidConverter.stringToByteArray(value_, bidiConversionProperties); - // The length in the first 4 bytes is actually the length in characters. - BinaryConverter.intToByteArray(temp.length, rawBytes, offset); - if(temp.length > maxLength_) - { - maxLength_ = temp.length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL, "Change Descriptor"); - } - System.arraycopy(temp, 0, rawBytes, offset+4, temp.length); - } - catch(Exception e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - // If it's a String we check for data truncation. - if(object instanceof String) - { - String s = (String)object; - truncated_ = (s.length() > maxLength_ ? s.length()-maxLength_ : 0); - } - //@PDD jdbc40 (JDUtilities.JDBCLevel_ >= 20 incorrect logic, but n/a now - else if(!(object instanceof Clob) && //@PDC NClob extends Clob - !(object instanceof InputStream) && - !(object instanceof Reader) //@PDC jdbc40 -/* ifdef JDBC40 */ - && !(object instanceof SQLXML) -/* endif */ - ) //@PDC jdbc40 - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - savedObject_ = object; - if(scale != -1) length_ = scale; - } - - private void doConversion() - throws SQLException - { - try - { - Object object = savedObject_; - if(savedObject_ instanceof String) - { - value_ = (String)object; - } - else if(object instanceof Reader) - { - if(length_ >= 0) - { - try - { - int blockSize = length_ < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length_ : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 && totalCharsRead < length_) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - int charsRemaining = length_ - totalCharsRead; - if(charsRemaining < blockSize) - { - blockSize = charsRemaining; - } - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - - if(value_.length() < length_) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length_ == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 ) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if( object instanceof Clob) //@PDC jdbc40 - NClob isa Clob - { - Clob clob = (Clob)object; - value_ = clob.getSubString(1, (int)clob.length()); - } -/* ifdef JDBC40 */ - else if( object instanceof SQLXML ) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value_ = xml.getString(); - } -/* endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - // Truncate if necessary. - int valueLength = value_.length(); - if(valueLength > maxLength_) - { - value_ = value_.substring(0, maxLength_); - truncated_ = valueLength - maxLength_; - } - else - { - truncated_ = 0; - } - - length_ = value_.length(); - } - finally - { - savedObject_ = null; - } - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.NCLOB; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCNClob"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "NCLOB"; - } - - public int getMaximumPrecision() - { - return AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; //@xml3 // the DB2 SQL reference says this should be 2147483647 but we return 1 less to allow for NOT NULL columns - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 408; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { -/* ifdef JDBC40 */ - return java.sql.Types.NCLOB; -/* endif */ -/* ifndef JDBC40 - return java.sql.Types.CLOB; - endif */ - - - } - - public String getTypeName() - { - return "NCLOB"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_)); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new HexReaderInputStream(new StringReader(value_)); - } - - public Blob getBlob() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(value_), maxLength_); - } - catch(NumberFormatException nfe) - { - // this NClob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public byte[] getBytes() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(value_); - } - catch(NumberFormatException nfe) - { - // this NClob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new StringReader(value_); - } - - public Clob getClob() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCClob(value_, maxLength_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public Object getObject() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; -/* ifdef JDBC40 */ - return new AS400JDBCNClob(value_, maxLength_); -/* endif */ -/* ifndef JDBC40 - return new AS400JDBCClob(value_, maxLength_); - endif */ - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public String getString() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return value_; - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(value_), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - public Reader getNCharacterStream() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new StringReader(value_); - } - -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCNClob(value_, maxLength_); - } -/* endif */ - - public String getNString() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return value_; - } - -/* ifdef JDBC40 */ - public RowId getRowId() throws SQLException - { - // - //if(savedObject_ != null) doConversion(); - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this NClob contains non-hex characters - //JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - //return null; - //} - - //Decided this is of no use because rowid is so specific to the dbms internals. - //And there are issues in length and difficulties in converting to a - //valid rowid that is useful. - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public SQLXML getSQLXML() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCSQLXML(value_.toCharArray()); - } - -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLNClobLocator.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLNClobLocator.java deleted file mode 100644 index ccf84eccb..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLNClobLocator.java +++ /dev/null @@ -1,1001 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLNclobLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -//@PDA jdbc40 new class - -final class SQLNClobLocator implements SQLLocator -{ - - private AS400JDBCConnection connection_; - private SQLConversionSettings settings_; - private ConvTable converter_; - private int id_; - private JDLobLocator locator_; - private int maxLength_; - private int truncated_; - private int columnIndex_; - private String value_; //@loch //Note that value_ is not used as the output for a ResultSet.getX() call. We Get the value from a call to the JDLocator (not from value_) and not from the savedObject_, unless resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - - private Object savedObject_; // This is the AS400JDBCBlobLocator or InputStream or whatever got set into us. - private int scale_; // This is actually the length that got set into us. - - SQLNClobLocator(AS400JDBCConnection connection, - int id, - int maxLength, - SQLConversionSettings settings, - ConvTable converter, - int columnIndex) - { - connection_ = connection; - id_ = id; - locator_ = new JDLobLocator(connection, id, maxLength, false); - maxLength_ = maxLength; - truncated_ = 0; - settings_ = settings; - converter_ = converter; - columnIndex_ = columnIndex; - } - - public Object clone() - { - return new SQLNClobLocator(connection_, id_, maxLength_, settings_, converter_, columnIndex_); - } - - public void setHandle(int handle) - { - locator_.setHandle(handle); - } - - //@loch - public int getHandle() - { - return locator_.getHandle(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int locatorHandle = BinaryConverter.byteArrayToInt(rawBytes, offset); - locator_.setHandle(locatorHandle); - locator_.setColumnIndex(columnIndex_); - } - - // This is only called from AS400JDBCPreparedStatement in one place. - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - BinaryConverter.intToByteArray(locator_.getHandle(), rawBytes, offset); - - // Now we write our saved data to the system, because the prepared statement is being executed. - // We used to write the data to the system on the call to set(), but this messed up - // batch executes, since the host server only reserves temporary space for locator handles one row at a time. - // See the toObject() method in this class for more details. - if(savedObject_ != null) writeToServer(); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - //@selins1 - // If it's a String we check for data truncation. - if(object instanceof String) - { - String s = (String)object; - truncated_ = (s.length() > maxLength_ ? s.length()-maxLength_ : 0); - } - //@PDD jdbc40 (JDUtilities.JDBCLevel_ >= 20 incorrect logic, but n/a now - else if( !(object instanceof Reader) && - !(object instanceof InputStream) && - !(object instanceof Clob) -/* ifdef JDBC40 */ - && !(object instanceof SQLXML) -/* endif */ - - ) //@PDC jdbc40 - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - savedObject_ = object; - if(scale != -1) scale_ = scale; // Skip resetting it if we don't know the real length - } - - //@loch method to temporary convert from object input to output before even going to host (writeToServer() does the conversion needed before writting to host) - //This will only be used when resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - //Purpose is to do a local type conversion from obj1 to obj2 like other non-locator lob types - private void doConversion() - throws SQLException - { - int length_ = scale_; - - if( length_ == -1) - { - try{ - //try to get length from locator - length_ = (int)locator_.getLength(); - }catch(Exception e){ } - } - - try - { - Object object = savedObject_; - if(savedObject_ instanceof String) - { - value_ = (String)object; - } - else if(object instanceof Reader) - { - if(length_ >= 0) - { - try - { - int blockSize = length_ < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length_ : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 && totalCharsRead < length_) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - int charsRemaining = length_ - totalCharsRead; - if(charsRemaining < blockSize) - { - blockSize = charsRemaining; - } - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - - if(value_.length() < length_) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length_ == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if( object instanceof Clob) - { - Clob clob = (Clob)object; - value_ = clob.getSubString(1, (int)clob.length()); - } -/* ifdef JDBC40 */ - else if( object instanceof SQLXML ) - { - SQLXML xml = (SQLXML)object; - value_ = xml.getString(); - } -/* endif */ - - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - // Truncate if necessary. - int valueLength = value_.length(); - if(valueLength > maxLength_) - { - value_ = value_.substring(0, maxLength_); - } - } - finally - { - //nothing - } - } - - private void writeToServer() - throws SQLException - { - try - { - Object object = savedObject_; - if(object instanceof String) - { - String string = (String)object; - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = converter_.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - byte[] bytes = converter_.stringToByteArray(string, bidiConversionProperties); - locator_.writeData(0L, bytes, true); - } - else if(object instanceof Reader) - { - int length = scale_; // hack to get the length into the set method - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); - } - else if(length > 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = converter_.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - ReaderInputStream stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); - try{ - byte[] byteBuffer = new byte[blockSize]; - - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - locator_.writeData((long)totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - if(stream.available() == 0 && blockSize != 0) - { - stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); // do this so we don't read more chars out of the Reader than we have to. //@KBC changed to use bidiConversionProperties instead of bidiStringType - } - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - - if(totalBytesRead < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - }finally{ - try{ - stream.close(); - }catch(Exception e){} - } - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = converter_.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - ReaderInputStream stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); - try{ - byte[] byteBuffer = new byte[blockSize]; - - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - locator_.writeData((long)totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - }finally{ - try{ - stream.close(); - }catch(Exception e){} - } - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(object instanceof InputStream) - { - int length = scale_; // hack to get the length into the set method - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); - } - else if(length > 0) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - locator_.writeData((long)totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - if(totalBytesRead < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - locator_.writeData((long)totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if( object instanceof Clob) //check for jdbc level to know if lobs exist //@PDD jdbc40 NClob isa Clob - { - // Start new code for updateable locator case - boolean set = false; - if(object instanceof AS400JDBCClobLocator) //@PDA jdbc40 comment: AS400JDBCNClobLocator isa AS400JDBCClobLocator - { - AS400JDBCClobLocator clob = (AS400JDBCClobLocator)object; - - //Synchronize on a lock so that the user can't keep making updates - //to the clob while we are taking updates off the vectors. - synchronized(clob) - { - // See if we saved off our real object from earlier. - if(clob.savedObject_ != null) - { - savedObject_ = clob.savedObject_; - scale_ = clob.savedScale_; - clob.savedObject_ = null; - writeToServer(); - return; - } - } - } - - //If the code for updateable lob locators did not run, then run old code. - if(!set) - { - Clob clob = (Clob)object; - int length = (int)clob.length(); - String substring = clob.getSubString(1, length); - locator_.writeData(0L, converter_.stringToByteArray(substring), 0, length, true); - set = true; - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } -/* ifdef JDBC40 */ - else if( object instanceof SQLXML ) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - - String stringVal = xml.getString(); - locator_.writeData(0L, converter_.stringToByteArray(stringVal), 0, stringVal.length(), true); - } -/* endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - finally - { - savedObject_ = null; - } - scale_ = (int)locator_.getLength(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.NCLOB_LOCATOR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCNClobLocator"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "NCLOB"; - } - - public int getMaximumPrecision() - { - return AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; //@xml3 // the DB2 SQL reference says this should be 2147483647 but we return 1 less to allow for NOT NULL columns - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 964; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { -/* ifdef JDBC40 */ - return java.sql.Types.NCLOB; -/* endif */ -/* ifndef JDBC40 - return java.sql.Types.CLOB; - endif */ - } - - public String getTypeName() - { -/* ifdef JDBC40 */ - return "NCLOB"; -/* endif */ -/* ifndef JDBC40 - return "CLOB"; - endif */ - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return maxLength_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_));//@loch - } //@loch - - return new ReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()), 819); // ISO-8859-1. - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new HexReaderInputStream(new StringReader(value_)); //@loch - } //@loch - - return new HexReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - byte[] bytes = BinaryConverter.stringToBytes(getString()); - return new AS400JDBCBlob(bytes, bytes.length); - } - catch(NumberFormatException nfe) - { - // this Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - // this Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new StringReader(value_); //@loch - } //@loch - - return new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCClob(value_, maxLength_); //@loch - } //@loch - - return new AS400JDBCClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // getObject is used by AS400JDBCPreparedStatement for batching, so we save off our InputStream - // inside the AS400JDBCNClobLocator. Then, when convertToRawBytes() is called, the writeToServer() - // code checks the AS400JDBCNClobLocator's saved InputStream... if it exists, then it writes the - // data out of the InputStream to the system by calling writeToServer() again. -/* ifdef JDBC40 */ - return new AS400JDBCNClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); -/* endif */ -/* ifndef JDBC40 - return new AS400JDBCClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - - endif */ - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public String getString() - throws SQLException - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return value_; //@loch - } //@loch - - DBLobData data = locator_.retrieveData(0, locator_.getMaxLength()); - String value = converter_.byteArrayToString(data.getRawBytes(), - data.getOffset(), - data.getLength()); - truncated_ = 0; //@pda jdbc40 make consistent with other SQLData Clob classes - return value; - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new ReaderInputStream(new StringReader(value_), 13488); //@loch - } //@loch - - - return new ReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); - return null; - } - } - - - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new StringReader(value_); //@loch - } //@loch - - try - { - return new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCNClob(value_, maxLength_); //@loch - } //@loch - - return new AS400JDBCNClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - - } -/* endif */ - - public String getNString() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return value_; //@loch - } //@loch - - DBLobData data = locator_.retrieveData(0, locator_.getMaxLength()); - String value = converter_.byteArrayToString(data.getRawBytes(), - data.getOffset(), - data.getLength()); - return value; - } - -/* ifdef JDBC40 */ - public RowId getRowId() throws SQLException - { - - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(getString())); - //} - //catch(NumberFormatException nfe) - //{ - // this Clob contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - - //Decided this is of no use because rowid is so specific to the dbms internals. - //And there are issues in length and difficulties in converting to a - //valid rowid that is useful. - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public SQLXML getSQLXML() throws SQLException - { - truncated_ = 0; - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCSQLXML(value_, maxLength_); //@loch - } //@loch - return new AS400JDBCSQLXML( getString().toCharArray() ); - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - - - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLNVarchar.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLNVarchar.java deleted file mode 100644 index 7e624f970..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLNVarchar.java +++ /dev/null @@ -1,736 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLNVarchar.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ - -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.net.URL; - -//@PDA jdbc40 new class - -final class SQLNVarchar -implements SQLData -{ - - // Private data. - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private String value_; - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLNVarchar(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLNVarchar(maxLength_, settings_); - } - - // Added method trim() to trim the string. - public void trim() // @A2A - { // @A2A - value_ = value_.trim(); // @A2A - } // @A2A - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - value_ = ccsidConverter.byteArrayToString(rawBytes, offset+2, length_, bidiConversionProperties); //changed to use bidiConversionProperties instead of bidiStringType - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - try - { - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - // The length in the first 2 bytes is actually the length in characters. - byte[] temp = ccsidConverter.stringToByteArray(value_, bidiConversionProperties); //changed to used bidiConversionProperties instead of bidiStringType - BinaryConverter.unsignedShortToByteArray(temp.length, rawBytes, offset); - if(temp.length > maxLength_) - { - maxLength_ = temp.length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL, "Change Descriptor"); - } - System.arraycopy(temp, 0, rawBytes, offset+2, temp.length); - - // The buffer we are filling with data is big enough to hold the entire field. - // For NVarchar fields the actual data is often smaller than the field width. - // That means whatever is in the buffer from the previous send is sent to the - // system. The data stream includes actual data length so the old bytes are not - // written to the database, but the junk left over may decrease the affectiveness - // of compression. The following code will write hex 0s to the buffer when - // actual length is less that field length. Note the 0s are written only if - // the field length is pretty big. The data stream code (DBBaseRequestDS) - // does not compress anything smaller than 1K. - if((maxLength_ > 256) && (maxLength_ - temp.length > 16)) - { - int stopHere = offset + 2 + maxLength_; - for(int i=offset + 2 + temp.length; i= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value = clob.getSubString(1, (int)clob.length()); - } -/* ifdef JDBC40 */ - else if(object instanceof SQLXML) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value = xml.getString(); - } -/* endif */ - - if(value == null) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - value_ = value; - - // Truncate if necessary. - int valueLength = value_.length(); - - int truncLimit = maxLength_; - - if(valueLength > truncLimit) - { - value_ = value_.substring(0, truncLimit); - truncated_ = valueLength - truncLimit; - } - else - truncated_ = 0; - - length_ = value_.length(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.NVARCHAR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "NVARCHAR"; - } - - public int getMaximumPrecision() - { - return 32739; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 448; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { -/* ifdef JDBC40 */ - return java.sql.Types.NVARCHAR; -/* endif */ -/* ifndef JDBC40 - return java.sql.Types.VARCHAR; - endif */ - } - - public String getTypeName() - { -/* ifdef JDBC40 */ - return "NVARCHAR"; -/* endif */ - -/* ifndef JDBC40 - return "VARCHAR"; - endif */ - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(getString())); - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(getString())); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - byte[] bytes = BinaryConverter.stringToBytes(getString()); - return new AS400JDBCBlob(bytes, bytes.length); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true" or "false", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = getString().trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).byteValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - if(d > Byte.MAX_VALUE || d < Byte.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.byteValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(getString(), settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).intValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Integer.MAX_VALUE || d < Integer.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.intValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).longValue();//@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Long.MAX_VALUE || d < Long.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.longValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).shortValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Short.MAX_VALUE || d < Short.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.shortValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length() - maxFieldSize; - return value_.substring(0, maxFieldSize); - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(getString(), settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(getString(), calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(getString()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } - -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } -/* endif */ - - public String getNString() throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } - -/* ifdef JDBC40 */ - - public RowId getRowId() throws SQLException - { - - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this string contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - - //Decided this is of no use because rowid is so specific to the dbms internals. - //And there are issues in length and difficulties in converting to a - //valid rowid that is useful. - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } - -/* endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLNumeric.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLNumeric.java deleted file mode 100644 index 7cde21b5f..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLNumeric.java +++ /dev/null @@ -1,589 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLNumeric.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLNumeric -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private static final BigDecimal default_ = BigDecimal.valueOf(0); // @C2A - private static final BigDecimal BYTE_MAX_VALUE = BigDecimal.valueOf(Byte.MAX_VALUE); - private static final BigDecimal BYTE_MIN_VALUE = BigDecimal.valueOf(Byte.MIN_VALUE); - private static final BigDecimal SHORT_MAX_VALUE = BigDecimal.valueOf(Short.MAX_VALUE); - private static final BigDecimal SHORT_MIN_VALUE = BigDecimal.valueOf(Short.MIN_VALUE); - private static final BigDecimal INTEGER_MAX_VALUE = BigDecimal.valueOf(Integer.MAX_VALUE); - private static final BigDecimal INTEGER_MIN_VALUE = BigDecimal.valueOf(Integer.MIN_VALUE); - private static final BigDecimal LONG_MAX_VALUE = BigDecimal.valueOf(Long.MAX_VALUE); - private static final BigDecimal LONG_MIN_VALUE = BigDecimal.valueOf(Long.MIN_VALUE); - static final BigDecimal FLOAT_MAX_VALUE = new BigDecimal(Float.MAX_VALUE); - static final BigDecimal FLOAT_MIN_VALUE = new BigDecimal(Float.MIN_VALUE); - static final BigDecimal DOUBLE_MAX_VALUE = new BigDecimal(Double.MAX_VALUE); - static final BigDecimal DOUBLE_MIN_VALUE = new BigDecimal(Double.MIN_VALUE); - - private SQLConversionSettings settings_; - private int precision_; - private int scale_; - private int truncated_; - private AS400ZonedDecimal typeConverter_; - private BigDecimal value_; - private JDProperties properties_; // @M0A - added JDProperties so we can get the scale & precision - private int vrm_; // @M0A - - SQLNumeric(int precision, - int scale, - SQLConversionSettings settings, - int vrm, // @M0C - JDProperties properties) // @M0C - { - settings_ = settings; - precision_ = precision; - scale_ = scale; - truncated_ = 0; - typeConverter_ = new AS400ZonedDecimal(precision_, scale_); - value_ = default_; // @C2C - vrm_ = vrm; // @M0A - properties_ = properties; // @M0A - } - - public Object clone() - { - return new SQLNumeric(precision_, scale_, settings_, vrm_, properties_); // @M0C - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = ((BigDecimal)typeConverter_.toObject(rawBytes, offset)); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - try{ - typeConverter_.toBytes(value_, rawBytes, offset); - } - catch(ExtendedIllegalArgumentException e){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - BigDecimal bigDecimal = null; - - if(object instanceof String) - { - try - { - String value = SQLDataFactory.convertScientificNotation((String)object); // @F3C - if(scale >= 0) - value = SQLDataFactory.truncateScale(value, scale); - bigDecimal = new BigDecimal(value); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - catch(StringIndexOutOfBoundsException e) // jdk 1.3.x throws this instead of a NFE - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(object instanceof Number) - { - String value = SQLDataFactory.convertScientificNotation(object.toString()); // @C1C - if(scale >= 0) - value = SQLDataFactory.truncateScale(value, scale); - bigDecimal = new BigDecimal(value); - } - - else if(object instanceof Boolean) - bigDecimal = (((Boolean)object).booleanValue() == true) ? BigDecimal.valueOf(1) : BigDecimal.valueOf(0); - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Truncate if necessary. If we ONLY truncate on the right side, we don't @E3C - // need to report it. If we truncate on the left side, then we report the @E3A - // number of truncated digits on both ends...this will make the dataSize @E3A - // and transferSize make sense on the resulting DataTruncation. @E3A - truncated_ = 0; - int otherScale = bigDecimal.scale(); - if(otherScale > scale_) - truncated_ += otherScale - scale_; - value_ = bigDecimal.setScale(scale_, BigDecimal.ROUND_DOWN); // @E3C - - int otherPrecision = SQLDataFactory.getPrecision(value_); - if(otherPrecision > precision_) - { // @E2D @E3C - int digits = otherPrecision - precision_; // @E2D @E3C - truncated_ += digits; // @E2D @E3C - value_ = SQLDataFactory.truncatePrecision(value_, digits); // @E2D @E3C - } // @E2D @E3C - else // @E3A - truncated_ = 0; // No left side truncation, report nothing @E3A - // (even if there was right side truncation). @E3A - - /* @E3D - int otherLeftSide = otherPrecision - otherScale; // @E2A - int leftSide = precision_ - scale_; // @E2A - if(otherLeftSide > leftSide) { // @E2A - int digits = otherLeftSide - leftSide; // @E2A - truncated_ += digits; // @E2A - value_ = SQLDataFactory.truncatePrecision(value_, digits + scale_); // @E2A - } // @E2A - */ - - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.NUMERIC; - } - - public String getCreateParameters() - { - StringBuffer buffer = new StringBuffer(); - buffer.append(AS400JDBCDriver.getResource("PRECISION")); - buffer.append(","); - buffer.append(AS400JDBCDriver.getResource("SCALE")); - return buffer.toString(); - } - - public int getDisplaySize() - { - return precision_ + 2; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.math.BigDecimal"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "NUMERIC"; - } - - public int getMaximumPrecision() - { - // @M0C - change to check vrm and JDProperties - if(vrm_ >= JDUtilities.vrm530) - return properties_.getInt(JDProperties.MAXIMUM_PRECISION); - else - return 31; - } - - public int getMaximumScale() - { - // @M0C - change to check vrm and JDProperties - if(vrm_ >= JDUtilities.vrm530) - return properties_.getInt(JDProperties.MAXIMUM_SCALE); - else - return 31; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 488; - } - - public int getPrecision() - { - return precision_; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return scale_; - } - - public int getType() - { - return java.sql.Types.NUMERIC; - } - - public String getTypeName() - { - return "NUMERIC"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return precision_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - if(scale >= 0) - { - if(scale >= value_.scale()) - { - truncated_ = 0; - return value_.setScale(scale); - } - else - { - truncated_ = value_.scale() - scale; - return value_.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return value_; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_.compareTo(BigDecimal.valueOf(0)) != 0); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - if(value_.compareTo(BYTE_MAX_VALUE) > 0 || value_.compareTo(BYTE_MIN_VALUE) < 0) - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 1; - } - return(byte) value_.byteValue(); - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - double d = value_.doubleValue(); //@KBA - //@KBD This will never be the case with the current precision - //@KBD if(value_.compareTo(DOUBLE_MAX_VALUE) > 0 || value_.compareTo(DOUBLE_MIN_VALUE) < 0) - if( d == Double.POSITIVE_INFINITY || d == Double.NEGATIVE_INFINITY) //@KBA - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 8; - } - return d; //@KBC value_.doubleValue(); - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - float f = value_.floatValue(); //@KBA - //@KBD Changed to avoid optimization problem with JRE 1.3 - //@KBD if(value_.compareTo(FLOAT_MAX_VALUE) > 0 || value_.compareTo(FLOAT_MIN_VALUE) < 0) - if(f == Float.POSITIVE_INFINITY || f == Float.NEGATIVE_INFINITY) //@KBA - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 4; - } - return f; //@KBC value_.floatValue(); - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - if(value_.compareTo(INTEGER_MAX_VALUE) > 0 || value_.compareTo(INTEGER_MIN_VALUE) < 0) - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 4; - } - return value_.intValue(); - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - if(value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 8; - } - return value_.longValue(); - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - if(value_.compareTo(SHORT_MAX_VALUE) > 0 || value_.compareTo(SHORT_MIN_VALUE) < 0) - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 2; - } - return(short) value_.shortValue(); - } - - public String getString() - throws SQLException - { - truncated_ = 0; - String stringRep = JDUtilities.bigDecimalToPlainString(value_); //@big java 1.5 support - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - return new StringReader(getNString()); - - } - -/* ifdef JDBC40 */ - //@pda jdbc40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - String stringRep = value_.toString(); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - -/* ifdef JDBC40 */ - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLNumeric2.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLNumeric2.java deleted file mode 100644 index 8f2a228a3..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLNumeric2.java +++ /dev/null @@ -1,512 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLNumeric2.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -// This uses a double instead of a BigDecimal (like SQLNumeric does). -// It will be faster but won't really preserve a lot of normal -// JDBC semantics. This will be documented in the "big decimal" -// property. -// -final class SQLNumeric2 -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int precision_; - private int scale_; - private int truncated_; - private AS400ZonedDecimal typeConverter_; - private double value_; - private JDProperties properties_; // @M0A - added JDProperties so we can get the scale & precision - private int vrm_; // @M0A - - SQLNumeric2(int precision, - int scale, - SQLConversionSettings settings, - int vrm, // @M0C - JDProperties properties) // @M0C - { - settings_ = settings; - precision_ = precision; - scale_ = scale; - truncated_ = 0; - typeConverter_ = new AS400ZonedDecimal(precision_, scale_); - value_ = 0; - vrm_ = vrm; // @M0A - properties_ = properties; // @M0A - } - - public Object clone() - { - return new SQLNumeric2(precision_, scale_, settings_, vrm_, properties_); // @M0C - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = typeConverter_.toDouble(rawBytes, offset); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - typeConverter_.toBytes(value_, rawBytes, offset); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(object instanceof String) - { - try - { - value_ = Double.valueOf((String)object).doubleValue(); - } - catch(NumberFormatException nfe) - { // @E4A - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); // @E4A - } - } - - else if(object instanceof Number) - value_ = ((Number)object).doubleValue(); - - else if(object instanceof Boolean) - value_ = ((Boolean)object).booleanValue() ? 1 : 0; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.NUMERIC_USING_DOUBLE; - } - - public String getCreateParameters() - { - StringBuffer buffer = new StringBuffer(); - buffer.append(AS400JDBCDriver.getResource("PRECISION")); - buffer.append(","); - buffer.append(AS400JDBCDriver.getResource("SCALE")); - return buffer.toString(); - } - - public int getDisplaySize() - { - return precision_ + 2; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.math.BigDecimal"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "NUMERIC"; - } - - public int getMaximumPrecision() - { - // @M0C - change to check vrm and JDProperties - if(vrm_ >= JDUtilities.vrm530) - return properties_.getInt(JDProperties.MAXIMUM_PRECISION); - else - return 31; - } - - public int getMaximumScale() - { - // @M0C - change to check vrm and JDProperties - if(vrm_ >= JDUtilities.vrm530) - return properties_.getInt(JDProperties.MAXIMUM_SCALE); - else - return 31; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 488; - } - - public int getPrecision() - { - return precision_; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return scale_; - } - - public int getType() - { - return java.sql.Types.NUMERIC; - } - - public String getTypeName() - { - return "NUMERIC"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return precision_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - return new BigDecimal(value_); - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_ != 0); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - if(value_ > Byte.MAX_VALUE || value_ < Byte.MIN_VALUE) - { - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 7; - } - else - { - truncated_ = 3; - } - } - else - { - truncated_ = 1; - } - } - return(byte) value_; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - if(value_ > Float.MAX_VALUE || value_ < -Float.MAX_VALUE) //@trunc min_val is a posative number. //Float.MIN_VALUE) - { - truncated_ = 4; - } - return(float)value_; - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 4; - } - return(int)value_; - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - if(value_ > Long.MAX_VALUE || value_ < Long.MIN_VALUE) - { - truncated_ = 1; // this is not necessarily correct, but we know there is truncation - } - return(long)value_; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return new Double(value_); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 6; - } - else - { - truncated_ = 2; - } - } - return(short) value_; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - String stringRep = Double.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - return new StringReader(getNString()); - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - truncated_ = 0; - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } -/* endif */ - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - String stringRep = Double.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - -/* ifdef JDBC40 */ - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLReal.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLReal.java deleted file mode 100644 index 78171af51..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLReal.java +++ /dev/null @@ -1,534 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLReal.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLReal -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int truncated_; - private float value_; - - SQLReal(SQLConversionSettings settings) - { - settings_ = settings; - truncated_ = 0; - value_ = 0.0f; - } - - public Object clone() - { - return new SQLReal(settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = BinaryConverter.byteArrayToFloat(rawBytes, offset); // @D0C - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - BinaryConverter.floatToByteArray(value_, rawBytes, offset); // @D0C - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - truncated_ = 0; - - if(object instanceof String) - { - try - { - value_ = Float.valueOf((String) object).floatValue(); - // @E2d int objectLength = ((String) object).length(); - // @E2d int valueLength = Float.toString(value_).length(); - // @E2d if(valueLength < objectLength) - // @E2d truncated_ = objectLength - valueLength; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - // @D9d - // We do not start messing with floating point values trying - // to figure out if they truncate. The performance of this - // in the BigDecimal case below is probably slower then creating - // a table on the system. - // - //else if(object instanceof Double) { - // value_ = ((Double) object).floatValue(); - // if(((Double) object).doubleValue() > value_) - // truncated_ = 8; - //} - // - // @D9d - //else if(object instanceof BigDecimal) { - // value_ = ((BigDecimal) object).floatValue(); - // int objectLength = SQLDataFactory.getPrecision((BigDecimal) object); - // int valueLength = SQLDataFactory.getPrecision(new BigDecimal(value_)); - // if(valueLength < objectLength) - // truncated_ = objectLength - valueLength; - //} - - else if(object instanceof Number) - { - // Set the value to the right type. - value_ = ((Number) object).floatValue(); // @D9c - - // Get the whole number portion of that value. - //long value = (long) value_; // @D9c //@bigdectrunc change to follow native driver - - // Get the original value as a long. This is the - // largest precision we can test for for a truncation. - //long truncTest = ((Number) object).longValue(); // @D9c //@bigdectrunc - - // If they are not equal, then we truncated significant - // data from the original value the user wanted us to insert. - //if(truncTest != value) // @D9c //@bigdectrunc - //truncated_ = 1; //@bigdectrunc - } - - - else if(object instanceof Boolean) - value_ = (((Boolean) object).booleanValue() == true) ? 1f : 0f; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.REAL; - } - - public String getCreateParameters() - { - return null; - } - - - public int getDisplaySize() - { - return 13; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.Float"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "REAL"; - } - - public int getMaximumPrecision() - { - return 24; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 480; - } - - public int getPrecision() - { - return 24; - } - - public int getRadix() - { - return 2; //@K1C Changed from 10 - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.REAL; - } - - public String getTypeName() - { - return "REAL"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return SQLDataFactory.getPrecision(Float.toString(value_)); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - // Convert the value to a String before creating the - // BigDecimal. This will create the exact BigDecimal - // that we want. If you pass the value directly to - // BigDecimal, then the value is not exact, and the - // scale becomes bigger than expected. - - // @A0A - // Modified the code to deal with numbers in scientific - // notations. The numbers that are in scientific notation - // are parsed to a base (the part before 'E') and an - // exponent (the part after 'E'). The base is then used - // to construct the BigDecimal object and then the exponent - // is used to shift the decimal point to its rightful place. - - // BigDecimal bigDecimal = new BigDecimal(Float.toString(value_)) // @A0D - - BigDecimal bigDecimal = null; // @A0A - - String numString = Float.toString(value_); // @A0A - int eIndex = numString.indexOf("E"); // @A0A - if(eIndex == -1) - { // @A0A - bigDecimal = new BigDecimal(numString); // @A0A - } // @A0A - else - { // @A0A - String base = numString.substring(0, eIndex); // @A0A - int exponent = Integer.parseInt(numString.substring(eIndex+1)); // @A0A - bigDecimal = new BigDecimal(base); // @A0A - bigDecimal = bigDecimal.movePointRight(exponent); // @A0A - } // @A0A - - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_ != 0.0f); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - if(value_ > Byte.MAX_VALUE || value_ < Byte.MIN_VALUE) //@trunc - { //@trunc - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE)//@trunc - { //@trunc - truncated_ = 3; //@trunc - } //@trunc - else //@trunc - { //@trunc - truncated_ = 1; //@trunc - } //@trunc - } //@trunc - return(byte) value_; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - return(double) value_; - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - return(float) value_; - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) //@trunc - { //@trunc - truncated_ = 4; //@trunc - } //@trunc - - return(int) value_; - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - if(value_ > Long.MAX_VALUE || value_ < Long.MIN_VALUE) //@trunc - { //@trunc - truncated_ = 8; //@trunc - } //@trunc - return(long) value_; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return new Float(value_); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) //@trunc - { //@trunc - truncated_ = 2; //@trunc - } //@trunc - return(short) value_; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - String stringRep = Float.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 -/* ifdef JDBC40 */ - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - String stringRep = Float.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - -/* ifdef JDBC40 */ - - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLRowID.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLRowID.java deleted file mode 100644 index 74a968932..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLRowID.java +++ /dev/null @@ -1,615 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLRowID.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLRowID implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private static final byte[] default_ = new byte[0]; - - private SQLConversionSettings settings_; - private int length_; - private int truncated_; - private byte[] value_; - - SQLRowID(SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - truncated_ = 0; - value_ = default_; - } - - public Object clone() - { - return new SQLRowID(settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException { - - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - value_ = new byte[length_]; - System.arraycopy(rawBytes, offset+2, value_, 0, length_); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException { - - BinaryConverter.unsignedShortToByteArray(length_, rawBytes, offset); - int len = (value_.length < rawBytes.length) ? value_.length : rawBytes.length; - System.arraycopy(value_, 0, rawBytes, offset + 2, len); - // pad rawBytes with zeros if it has room - for(int i=(offset + 2 + len); i= 0) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - int objectLength = value_.length; - if(value_.length > 40) - { - byte[] newValue = new byte[40]; - System.arraycopy(value_, 0, newValue, 0, 40); - value_ = newValue; - } - truncated_ = objectLength - value_.length; - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(object instanceof Reader) - { - // value_ = BinaryConverter.stringToBytes(JDUtilities.readerToString((Reader)object, scale)); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - int objectLength = value_.length; - if(value_.length > 40) - { - byte[] newValue = new byte[40]; - System.arraycopy(value_, 0, newValue, 0, 40); - value_ = newValue; - } - stream.close(); //@scan1 - - truncated_ = objectLength - value_.length; - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Blob) - value_ = ((Blob)object).getBytes(1, (int)((Blob)object).length()); - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - try - { - value_ = BinaryConverter.stringToBytes(((Clob)object).getSubString(1, (int)((Clob)object).length())); - } - catch(NumberFormatException nfe) - { - // the Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Truncate if necessary. - int valueLength = value_.length; - if(valueLength > 40) - { - byte[] newValue = new byte[40]; - System.arraycopy(value_, 0, newValue, 0, 40); - value_ = newValue; - truncated_ = valueLength - 40; - } - else - truncated_ = 0; - - length_ = value_.length; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.ROWID; - } - - public String getCreateParameters() - { - return null; - } - - public int getDisplaySize() - { - return 40; - } - - public String getJavaClassName() - { - return "[B"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "ROWID"; - } - - public int getMaximumPrecision() - { - return 40; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 904; - } - - public int getPrecision() - { - return 40; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { -/* ifdef JDBC40 */ - return java.sql.Types.ROWID; -/* endif */ -/* ifndef JDBC40 - return java.sql.Types.BINARY; - endif */ - } - - public String getTypeName() - { - return "ROWID"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new ByteArrayInputStream(getBytes()); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - byte[] bytes = getBytes(); - return new AS400JDBCBlob(bytes, bytes.length); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length > maxFieldSize) && (maxFieldSize > 0)) - { - byte[] truncatedValue = new byte[maxFieldSize]; - System.arraycopy(value_, 0, truncatedValue, 0, maxFieldSize); - return truncatedValue; - } - else - return value_; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - String string = BinaryConverter.bytesToHexString(getBytes()); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. -/* ifdef JDBC40 */ - return new AS400JDBCRowId(getBytes()); //@PDC -/* endif */ -/* ifndef JDBC40 - return getBytes(); - endif */ - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - - //@PDA jdbc40 -/* ifdef JDBC40 */ - - public NClob getNClob() throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - String string = BinaryConverter.bytesToHexString(getBytes()); - return new AS400JDBCNClob(string, string.length()); - } -/* endif */ - //@PDA jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } - -/* ifdef JDBC40 */ - - //@PDA jdbc40 - public RowId getRowId() throws SQLException - { - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCRowId(getBytes()); - } - - //@PDA jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLSmallint.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLSmallint.java deleted file mode 100644 index e34c01eb4..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLSmallint.java +++ /dev/null @@ -1,548 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLSmallint.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLSmallint -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private int truncated_; - private short value_; - private int scale_; // @A0A - private BigDecimal bigDecimalValue_ = null; // @A0A - private int vrm_; //@trunc3 - - - SQLSmallint(int vrm) //@trunc3 - { - this(0, vrm); //@trunc3 - } - - SQLSmallint(int scale, int vrm) // @A0A //@trunc3 - { - truncated_ = 0; - value_ = 0; - scale_ = scale; // @A0A - if(scale_ > 0) // @C0A - bigDecimalValue_ = new BigDecimal(Short.toString(value_)); // @A0A - vrm_ = vrm; //@trunc3 - } - - public Object clone() - { - return new SQLSmallint(scale_, vrm_); //@trunc - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = BinaryConverter.byteArrayToShort(rawBytes, offset); // @D0C - - if(scale_ > 0) - { // @C0A - bigDecimalValue_ = (new BigDecimal(Short.toString(value_))).movePointLeft(scale_); // @A0A - value_ = (short) bigDecimalValue_.intValue(); // @A0A - } // @C0A - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - BinaryConverter.shortToByteArray(value_, rawBytes, offset); // @D0C - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - truncated_ = 0; // @D9c - - if(object instanceof String) - { - // @D10c new implementation - // old ... - // - // try - // { - // value_ = Short.parseShort((String) object); - // } - // catch(NumberFormatException e) - // { - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - // } - - // @P1 First try to convert the string to an int(no extra object creation). If - // that fails try turning it into a double, which will involve an extra object - // create but Double will accept bigger numbers and floating point numbers so it - // will catch more truncation cases. The bottom line is don't create an extra - // object in the normal case. If the user does ps.setString(1, "111222333.444.555") - // on an integer field, they can't expect the best performance. - // create. - boolean tryAgain = false; // @P1a - - try - { - // @P1d long longValue = (long) Double.parseDouble((String) object); - int intValue = (int) Integer.parseInt((String) object); // @P1a - - if(( intValue > Short.MAX_VALUE ) || ( intValue < Short.MIN_VALUE )) - { - truncated_ = 6; - //@trunc3 match native for ps.setString() to throw mismatch instead of truncation - if(vrm_ >= JDUtilities.vrm610) //@trunc3 - { //@trunc3 - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); //@trunc3 - } //@trunc3 - } - value_ = (short) intValue; // @D9c - } - catch(NumberFormatException e) - { - tryAgain = true; // @P1a - // @P1d JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - if(tryAgain) // @P1a - { - // @P1a - try // @P1a - { - // @P1a - double doubleValue = Double.valueOf((String) object).doubleValue(); // @P1a - // @P1a - if(( doubleValue > Short.MAX_VALUE ) || ( doubleValue < Short.MIN_VALUE )) // @P1a - { - // @P1a - truncated_ = 6; // @P1a - //@trunc3 match native for ps.setString() to throw mismatch instead of truncation - if(vrm_ >= JDUtilities.vrm610) //@trunc3 - { //@trunc3 - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); //@trunc3 - } //@trunc3 - } // @P1a - value_ = (short) doubleValue; // @P1a - } // @P1a - catch(NumberFormatException e) // @P1a - { - // @P1a - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); // @P1a - } // @P1a - } // @P1a - } // @P1a - - else if(object instanceof Number) - { - // Compute truncation by getting the value as a long - // and comparing it against MAX_VALUE/MIN_VALUE. You - // do this because truncation of the decimal portion of - // the value is insignificant. We only care if the - // whole number portion of the value is too large/small - // for the column. - long longValue = ((Number) object).longValue(); // @D9c - if(( longValue > Short.MAX_VALUE ) || ( longValue < Short.MIN_VALUE )) // @D9a - { - // Note: Truncated here is set to 6 bytes. This is based on - // the idea that a long was used and a short was the - // column type. We could check for different types - // and provide a more accurate number, but I don't - // really know that this field is of any use to people - // in this case anyway (for example, you could have a - // float (4 bytes) that didn't fit into a bigint (8 - // bytes) without some data truncation. - truncated_ = 6; // @D9c - } - - - // Store the value. - value_ = (short) longValue; // @D9c - } - - else if(object instanceof Boolean) - value_ = (((Boolean) object).booleanValue() == true) ? (short) 1 : (short) 0; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - if(scale_ > 0) - { // @C0A - bigDecimalValue_ = (new BigDecimal(Short.toString(value_))).movePointLeft(scale_); // @A0A - value_ = (short) bigDecimalValue_.intValue(); // @A0A - } // @C0A - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.SMALLINT; - } - - public String getCreateParameters() - { - return null; - } - - public int getDisplaySize() - { - return 6; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - /* smallints are Integers from jdbc 4.0 spec: - Note � The JDBC 1.0 specification defined the Java object mapping for the - SMALLINT and TINYINT JDBC types to be Integer. The Java language did not - include the Byte and Short data types when the JDBC 1.0 specification was - finalized. The mapping of SMALLINT and TINYINT to Integer is maintained to - preserve backwards compatibility.*/ - //this corresponds to getObject() also - return "java.lang.Integer"; //@int - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "SMALLINT"; - } - - public int getMaximumPrecision() - { - return 5; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 500; - } - - public int getPrecision() - { - return 5; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return scale_; - } - - public int getType() - { - return java.sql.Types.SMALLINT; - } - - public String getTypeName() - { - return "SMALLINT"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return 2; // @D0C - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - if(scale_ > 0) - { // @C0A - if(scale >= 0) - return bigDecimalValue_.setScale(scale); // @A0A - else - return bigDecimalValue_; - } // @C0A - else - { // @C0A - if(scale <= 0) // @C0A - return BigDecimal.valueOf((long) value_); // @C0A - else // @C0A - return BigDecimal.valueOf((long) value_).setScale(scale); // @C0A - } // @C0A - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_ != 0); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - if(value_ > Byte.MAX_VALUE || value_ < Byte.MIN_VALUE) - { - truncated_ = 1; - } - return(byte) value_; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - if(scale_ > 0) // @C0A - return bigDecimalValue_.doubleValue(); // @A0A - else // @C0A - return(double) value_; // @A0D @C0A - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - if(scale_ > 0) // @C0A - return bigDecimalValue_.floatValue(); // @A0A - else // @C0A - return(float) value_; // @A0D @C0A - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return new Integer(value_); // @D2c -- used to be new Short(value_) - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - if(scale_ > 0) // @C0A - return bigDecimalValue_.toString(); // @A0A - else // @C0A - return Short.toString(value_); // @A0D @C0A - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - -/* ifdef JDBC40 */ - //@pda jdbc40 - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - if(scale_ > 0) - return bigDecimalValue_.toString(); - else - return Short.toString(value_); - } -/* ifdef JDBC40 */ - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLTime.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLTime.java deleted file mode 100644 index ac670dfd3..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLTime.java +++ /dev/null @@ -1,698 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLTime.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLTime -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int timeFormat_; - private int hour_; - private int minute_; - private int second_; - private int truncated_; - - SQLTime(SQLConversionSettings settings, int timeFormat) // @550C - { - settings_ = settings; - hour_ = 0; - minute_ = 0; - second_ = 0; - truncated_ = 0; - timeFormat_ = timeFormat; // @550A - } - - public Object clone() - { - return new SQLTime(settings_, timeFormat_); // @550C - } - - public static Time stringToTime(String s, - SQLConversionSettings settings, - Calendar calendar) - throws SQLException - { - try - { - - // If the string is empty, then it is likely a NULL, so - // just set this to a default date. - if(s.trim().length() == 0) - return new Time(0); - - // Parse the string according to the format and separator. - // else if(format.equalsIgnoreCase(JDProperties.TIME_FORMAT_USA)) { - if(calendar == null) - { - calendar = Calendar.getInstance(); //@P0A - calendar.setLenient(false); //@dat1 - } - switch(settings.getTimeFormat()) - { // @A0A - case SQLConversionSettings.TIME_FORMAT_USA: // @A0A - int hour = Integer.parseInt(s.substring(0, 2)); - char amPm = s.charAt(6); - if(hour == 12) - { - if(amPm == 'A') - hour = 0; - } - else - { // Hour between 1 and 11. - if(amPm == 'P') - hour += 12; - } - calendar.set(Calendar.HOUR_OF_DAY, hour); - calendar.set(Calendar.MINUTE, Integer.parseInt(s.substring(3, 5))); - calendar.set(Calendar.SECOND, 0); - break; // @A0A - - case SQLConversionSettings.TIME_FORMAT_EUR: - case SQLConversionSettings.TIME_FORMAT_JIS: - case SQLConversionSettings.TIME_FORMAT_HMS: - case SQLConversionSettings.TIME_FORMAT_ISO: - calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(s.substring(0, 2))); - calendar.set(Calendar.MINUTE, Integer.parseInt(s.substring(3, 5))); - calendar.set(Calendar.SECOND, Integer.parseInt(s.substring(6, 8))); - break; - } - - //@dat1 non-lenient does not allow 0s - //@dat1 calendar.set(Calendar.YEAR, 0); - //@dat1 calendar.set(Calendar.MONTH, 0); - //@dat1 calendar.set(Calendar.DAY_OF_MONTH, 0); - //@dat1 calendar.set(Calendar.MILLISECOND, 0);*/ - } - catch(NumberFormatException e) - { - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing time "+s, e); - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); - } - catch(StringIndexOutOfBoundsException e) - { - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing time "+s, e); - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); - } - - try //@dat1 - { - return new Time(calendar.getTime().getTime()); - }catch(Exception e){ - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing time "+s, e); //@dat1 - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); //@dat1 - return null; //@dat1 - } - } - - public static String timeToString(Time t, - SQLConversionSettings dataFormat, - Calendar calendar) - { - return timeToString(t, dataFormat, calendar, -1); // @E3C - } - - // @E3A - This contains the logic from the original timeToString(), with new arg "hourIn". - private static String timeToString(Time t, - SQLConversionSettings dataFormat, - Calendar calendar, - int hourIn) - { - StringBuffer buffer = new StringBuffer(); - String separator = dataFormat.getTimeSeparator(); - if(calendar == null) calendar = Calendar.getInstance(); //@P0A - calendar.setTime(t); - - int hour = calendar.get(Calendar.HOUR_OF_DAY); // @E3A - int minute = calendar.get(Calendar.MINUTE); // @E3A - int second = 0; // @E3A - - // Note: No matter what format is being used, - // ensure that exactly 8 characters are in the - // buffer. - - switch(dataFormat.getTimeFormat()) - { // @A0A - case SQLConversionSettings.TIME_FORMAT_USA: // @A0A - // @E3D int hour = calendar.get(Calendar.HOUR_OF_DAY); - char amPm; - //@PDc - translate to ampm based on hour,min,sec - - //13-23 -> (x-12)pm - //12 -> 12pm - //1-11 -> xam - //0 -> 12am - //0:0:0 -> 00:00:00am (special case) - //24:0:0 -> 12:00:00am (special case) //hour=0, hourIn=24 since 0 and 24 both map to 0 in Calendar - - if(hour > 12) - { - hour -= 12; - amPm = 'P'; - } - else if(hour == 12) - amPm = 'P'; - else if((hour > 0) && (hour < 12)) - amPm = 'A'; - else if((minute == 0) && (second == 0)) - { - //special cases: 0:0:0 and 24:0:0 - if(hourIn == 24) - hour = 12; - amPm = 'A'; - } - else - { - //0 hour case - hour = 12; - amPm = 'A'; - } - - buffer.append(JDUtilities.padZeros(hour, 2)); - buffer.append(':'); - buffer.append(JDUtilities.padZeros(minute, 2)); // @E3C - buffer.append(' '); - buffer.append(amPm); - buffer.append('M'); - break; // @A0A - - case SQLConversionSettings.TIME_FORMAT_EUR: // @A0A - case SQLConversionSettings.TIME_FORMAT_ISO: // @A0A - second = calendar.get(Calendar.SECOND); // @E3A - buffer.append(JDUtilities.padZeros(hour, 2)); // @E3C - buffer.append('.'); - buffer.append(JDUtilities.padZeros(minute, 2)); // @E3C - buffer.append('.'); - buffer.append(JDUtilities.padZeros(second, 2)); // @E3C - break; // @A0A - - case SQLConversionSettings.TIME_FORMAT_JIS: // @A0A - second = calendar.get(Calendar.SECOND); // @F3A - buffer.append(JDUtilities.padZeros(hour, 2)); // @E3C - buffer.append(':'); - buffer.append(JDUtilities.padZeros(minute, 2)); // @E3C - buffer.append(':'); - buffer.append(JDUtilities.padZeros(second, 2)); // @E3C - break; // @A0A - - case SQLConversionSettings.TIME_FORMAT_HMS: // @A0A - second = calendar.get(Calendar.SECOND); // @E3A - buffer.append(JDUtilities.padZeros(hour, 2)); // @E3C - buffer.append(separator); - buffer.append(JDUtilities.padZeros(minute, 2)); // @E3C - buffer.append(separator); - buffer.append(JDUtilities.padZeros(second, 2)); // @E3C - break; // @A0A - } - - // The Calendar class represents 24:00:00 as 00:00:00. // @E3A - if(hourIn == 24 && hour==0 && minute==0 && second==0 ) // @E3A //@tim3 - { - buffer.setCharAt(0,'2'); // @E3A - buffer.setCharAt(1,'4'); // @E3A - // Note: StringBuffer.replace() is available in Java2. - } - - return buffer.toString(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - int connectionTimeFormat = settings_.getTimeFormat(); // @550A - // @550 If the time is from a stored procedure result set, it could be in a different time format than the connection's format - switch(((timeFormat_ != -1) && (timeFormat_ != connectionTimeFormat)) ? timeFormat_ : connectionTimeFormat) // @550C - { - - case SQLConversionSettings.TIME_FORMAT_USA: // hh:mm AM or PM - hour_ = (rawBytes[offset] & 0x0f) * 10 + (rawBytes[offset+1] & 0x0f); - minute_ = (rawBytes[offset+3] & 0x0f) * 10 + (rawBytes[offset+4] & 0x0f); - second_ = 0; - - //translate from ampm to 24hour - //since we can get back duplicate values of 00:00 (00:00am) and 24:00 (12:00am) (which map to - //the same time of day in Calendar), we need a way to differentiate the two. - if(((rawBytes[offset+6] == (byte)0xd7) && (hour_ < 12)) || // xd7='P' - ((rawBytes[offset+6] == (byte)0xC1) && (hour_ == 12))) // xC1='A' - hour_ += 12; - break; - - case SQLConversionSettings.TIME_FORMAT_HMS: // hh:mm:ss - case SQLConversionSettings.TIME_FORMAT_ISO: // hh.mm.ss - case SQLConversionSettings.TIME_FORMAT_EUR: // hh.mm.ss - case SQLConversionSettings.TIME_FORMAT_JIS: // hh:mm:ss - hour_ = (rawBytes[offset] & 0x0f) * 10 + (rawBytes[offset+1] & 0x0f); - minute_ = (rawBytes[offset+3] & 0x0f) * 10 + (rawBytes[offset+4] & 0x0f); - second_ = (rawBytes[offset+6] & 0x0f) * 10 + (rawBytes[offset+7] & 0x0f); - break; - - default: - break; - } - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - StringBuffer buffer = new StringBuffer(8); - - // Always use ISO format here. - buffer.append(JDUtilities.padZeros(hour_, 2)); - buffer.append('.'); - buffer.append(JDUtilities.padZeros(minute_, 2)); - buffer.append('.'); - buffer.append(JDUtilities.padZeros(second_, 2)); - - try - { - ccsidConverter.stringToByteArray(buffer.toString(), rawBytes, offset); - } - catch(CharConversionException e) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); // @E2C - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(calendar == null) - { - calendar = Calendar.getInstance(); //@P0A - calendar.setLenient(false); //@dat1 - } - if(object instanceof String) - { - stringToTime((String) object, settings_, calendar); - hour_ = calendar.get(Calendar.HOUR_OF_DAY); - minute_ = calendar.get(Calendar.MINUTE); - second_ = calendar.get(Calendar.SECOND); - } - - else if(object instanceof Time) - { - calendar.setTime((Time) object); - hour_ = calendar.get(Calendar.HOUR_OF_DAY); - minute_ = calendar.get(Calendar.MINUTE); - second_ = calendar.get(Calendar.SECOND); - } - - else if(object instanceof Timestamp) - { - calendar.setTime((Timestamp) object); - hour_ = calendar.get(Calendar.HOUR_OF_DAY); - minute_ = calendar.get(Calendar.MINUTE); - second_ = calendar.get(Calendar.SECOND); - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.TIME; - } - - public String getCreateParameters() - { - return null; - } - - public int getDisplaySize() - { - return 8; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.sql.Time"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "TIME"; - } - - public int getMaximumPrecision() - { - return 8; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 388; - } - - public int getPrecision() - { - return 8; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.TIME; - } - - public String getTypeName() - { - return "TIME"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return 8; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - Calendar calendar = Calendar.getInstance(); - calendar.set(1970, Calendar.JANUARY, 1, hour_, minute_, second_); - calendar.set(Calendar.MILLISECOND, 0); - return new Time(calendar.getTime().getTime()); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - Calendar calendar = Calendar.getInstance(); - calendar.set(1970, Calendar.JANUARY, 1, hour_, minute_, second_); - calendar.set(Calendar.MILLISECOND, 0); - Time t = new Time(calendar.getTime().getTime()); - return timeToString(t, settings_, calendar, hour_); // @E3C - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) calendar = Calendar.getInstance(); //@P0A - // @F2A - // You are supposed to normalize the time to the epoch, - // not set its extra fields to 0. This produces totally different - // results. See JDBC API Reference and Tutorial, pg 860 for complete - // details. - calendar.set(1970, Calendar.JANUARY, 1, hour_, minute_, second_); // @F2C - // @F2D calendar.set(0, 0, 0, hour_, minute_, second_); - - // Make sure to set the millisecond value from the time too as - // SQL Time objects do not track this field. - calendar.set(Calendar.MILLISECOND, 0); // @F2A - - return new Time(calendar.getTime().getTime()); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - // - // The JDBC 1.22 specification says that this conversion - // does not need to be supported, but the Graham Hamilton - // book says it does. I am going to go with the spec for - // now, since I don't think that any such conversion - // really makes sense. - // - //@54A JDBC 3.0 specification says this converstion is valid - //@54D JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - //@54D return null; - - //@54A - truncated_ = 0; //@54A - if(calendar == null) calendar = Calendar.getInstance(); //@54A - calendar.set(1970, Calendar.JANUARY, 1, hour_, minute_, second_); //@54A - calendar.set(Calendar.MILLISECOND, 0); //@54A - Timestamp ts = new Timestamp(calendar.getTime().getTime()); //@54A - ts.setNanos(0); //@54A - return ts; //@54A - - - } - - public InputStream getUnicodeStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); //@pdc - return null; //@pdc - } - -/* ifdef JDBC40 */ - //@pda jdbc40 - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - Calendar calendar = Calendar.getInstance(); - calendar.set(1970, Calendar.JANUARY, 1, hour_, minute_, second_); - calendar.set(Calendar.MILLISECOND, 0); - Time t = new Time(calendar.getTime().getTime()); - return timeToString(t, settings_, calendar, hour_); // @E3C - } - -/* ifdef JDBC40 */ - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLTimestamp.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLTimestamp.java deleted file mode 100644 index 3ff7d7c8f..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLTimestamp.java +++ /dev/null @@ -1,630 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLTimestamp.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLTimestamp -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int truncated_; - private int year_; - private int month_; - private int day_; - private int hour_; - private int minute_; - private int second_; - private int nanos_; - - SQLTimestamp(SQLConversionSettings settings) - { - settings_ = settings; - truncated_ = 0; - year_ = 0; - month_ = 0; - day_ = 0; - hour_ = 0; - minute_ = 0; - second_ = 0; - nanos_ = 0; - } - - public Object clone() - { - return new SQLTimestamp(settings_); - } - - public static Timestamp stringToTimestamp(String s, Calendar calendar) - throws SQLException - { - try - { - // @E3D // If the string has a year 1, then it is likely a NULL, so - // @E3D // just set this to a default date. - int year = Integer.parseInt(s.substring(0, 4)); - // @E3D if(year == 1) { - // @E3D return new Timestamp(0); - // @E3D } - - // Parse the string . - // @E3D else { - - if(calendar == null) - { - calendar = Calendar.getInstance(); // @F5A - calendar.setLenient(false); //@dat1 - } - calendar.set(Calendar.YEAR, year); - calendar.set(Calendar.MONTH, Integer.parseInt(s.substring(5, 7)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s.substring(8, 10))); - calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(s.substring(11, 13))); - calendar.set(Calendar.MINUTE, Integer.parseInt(s.substring(14, 16))); - calendar.set(Calendar.SECOND, Integer.parseInt(s.substring(17, 19))); - - Timestamp ts = null;//@dat1 - try //@dat1 - { - ts = new Timestamp(calendar.getTime().getTime()); //@dat1 - }catch(Exception e){ - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing timestamp "+s, e); //@dat1 - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); //@dat1 - return null; //@dat1 - } - - // @F2A - // Remember that the value for nanoseconds is optional. If we don't check the - // length of the string before trying to handle nanoseconds for the timestamp, - // we will blow up if there is no value available. An example of a String value - // as a timestamp that would have this problem is: "1999-12-31 12:59:59" - if(s.length() > 20) - { // @F2A - String nanos = s.substring(20).trim() + "000000000"; // @F2M - ts.setNanos(Integer.parseInt(nanos.substring(0, 6)) * 1000); - } - else - { - ts.setNanos(0); // @F2A - } - - return ts; - // @E3D } - } - catch(NumberFormatException e) - { - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing timestamp "+s, e); - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); - } - catch(StringIndexOutOfBoundsException e) - { - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing timestamp "+s, e); - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); - } - - return new Timestamp(0); - } - - public static String timestampToString(Timestamp ts, - Calendar calendar) - { - return timestampToString(ts, calendar, -1); // @F4C - } - - // @F4A - New method - Contains the logic from the old method, with the addition of the hourIn parameter. - public static String timestampToString(Timestamp ts, - Calendar calendar, int hourIn) - { - // @F3A - // The native driver outputs timestamps like 2100-01-02-03.45.56.000000, while we output timestamps like 2100-01-02 03:45:56.000000. The first is apparently the ISO standard while ours follows Java's Timestamp.toString() method. This was pointed out by a user who noticed that although he gets a timestamp from our database in one format, he can't put it back in the database in that same format. - // @F6A Change back to old format because of service issue. - StringBuffer buffer = new StringBuffer(); - if(calendar == null) calendar = Calendar.getInstance(); //@P0A - calendar.setTime(ts); - - int hour = calendar.get(Calendar.HOUR_OF_DAY); //@tim2 - if(hourIn == 24 && hour==0) //@tim2 - {//@tim2 - //db2 represents midnight as 24:00 and midnight + 1 min as 00:01, but in java, 24 is midnight of - //the next day (ie calendar.set(2007, 9, 10, 24, 0, 0) toString() -> 2007-10-11 00:00) - //java changes 1/1/2007 24:00 -> 1/2/2007 00:00 - //for Native jdbc driver compliance, code block at bottom replaces "00" with "24", but need to - //go back one day to counteract java's conversion. - calendar.add(Calendar.DATE, -1); - }//@tim2 - - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.YEAR), 4)); - buffer.append('-'); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.MONTH) + 1, 2)); - buffer.append('-'); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.DAY_OF_MONTH), 2)); - buffer.append(' '); //@F6C - //@F6D buffer.append('-'); // @F3C - hour = calendar.get(Calendar.HOUR_OF_DAY); // @F4A //@tim2 - // @F4D buffer.append(JDUtilities.padZeros(calendar.get(Calendar.HOUR_OF_DAY), 2)); - buffer.append(JDUtilities.padZeros(hour, 2)); // @F4C - buffer.append(':'); //@F6C - //@F6D buffer.append('.'); // @F3C - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.MINUTE), 2)); - buffer.append(':'); //@F6C - //@F6D buffer.append('.'); // @F3C - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.SECOND), 2)); - buffer.append('.'); - buffer.append(JDUtilities.padZeros(ts.getNanos(), 9)); // @B1C - - // The Calendar class represents 24:00:00 as 00:00:00. // @F4A - // Format of timestamp is YYYY-MM-DD-hh.mm.ss.uuuuuu, so hh is at offset 11. - if(hourIn == 24 && hour==0) // @F4A - { - buffer.setCharAt(11,'2'); // @F4A - buffer.setCharAt(12,'4'); // @F4A - // Note: StringBuffer.replace() is available in Java2. - } - - // Ensure that exactly 26 characters are returned. - String tempString = buffer.toString() + "000000"; - return tempString.substring(0, 26); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - year_ = (rawBytes[offset] & 0x0f) * 1000 - + (rawBytes[offset+1] & 0x0f) * 100 - + (rawBytes[offset+2] & 0x0f) * 10 - + (rawBytes[offset+3] & 0x0f); - - // @E3D // If the string has a year 1, then it is likely a NULL, so - // @E3D // just set this to a default date. - // @E3D if(year_ != 1) { - month_ = (rawBytes[offset+5] & 0x0f) * 10 - + (rawBytes[offset+6] & 0x0f) - 1; - day_ = (rawBytes[offset+8] & 0x0f) * 10 - + (rawBytes[offset+9] & 0x0f); - hour_ = (rawBytes[offset+11] & 0x0f) * 10 - + (rawBytes[offset+12] & 0x0f); - minute_ = (rawBytes[offset+14] & 0x0f) * 10 - + (rawBytes[offset+15] & 0x0f); - second_ = (rawBytes[offset+17] & 0x0f) * 10 - + (rawBytes[offset+18] & 0x0f); - nanos_ = - ((rawBytes[offset+20] & 0x0f) * 100000 - + (rawBytes[offset+21] & 0x0f) * 10000 - + (rawBytes[offset+22] & 0x0f) * 1000 - + (rawBytes[offset+23] & 0x0f) * 100 - + (rawBytes[offset+24] & 0x0f) * 10 - + (rawBytes[offset+25] & 0x0f) ) * 1000; - // @E3D } - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - StringBuffer buffer = new StringBuffer(getString().replace(':', '.')); - buffer.setCharAt(10, '-'); - - try - { - ccsidConverter.stringToByteArray(buffer.toString(), rawBytes, offset); - } - catch(CharConversionException e) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); // @E2C - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.TIMESTAMP; - } - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(calendar == null) - { - calendar = Calendar.getInstance(); // @F5A - calendar.setLenient(false); //@dat1 - } - if(object instanceof String) - { - Timestamp ts = stringToTimestamp((String) object, calendar); - year_ = calendar.get(Calendar.YEAR); - month_ = calendar.get(Calendar.MONTH); - day_ = calendar.get(Calendar.DAY_OF_MONTH); - hour_ = calendar.get(Calendar.HOUR_OF_DAY); - minute_ = calendar.get(Calendar.MINUTE); - second_ = calendar.get(Calendar.SECOND); - nanos_ = ts.getNanos(); - } - - else if(object instanceof Timestamp) - { // @F5M - calendar.setTime((Timestamp) object); - year_ = calendar.get(Calendar.YEAR); - month_ = calendar.get(Calendar.MONTH); - day_ = calendar.get(Calendar.DAY_OF_MONTH); - hour_ = calendar.get(Calendar.HOUR_OF_DAY); - minute_ = calendar.get(Calendar.MINUTE); - second_ = calendar.get(Calendar.SECOND); - nanos_ = ((Timestamp) object).getNanos(); - } - - else if(object instanceof java.util.Date) - { // @F5C - calendar.setTime((java.util.Date) object); // @F5C - year_ = calendar.get(Calendar.YEAR); - month_ = calendar.get(Calendar.MONTH); - day_ = calendar.get(Calendar.DAY_OF_MONTH); - hour_ = calendar.get(Calendar.HOUR_OF_DAY); - minute_ = calendar.get(Calendar.MINUTE); - second_ = calendar.get(Calendar.SECOND); - nanos_ = calendar.get(Calendar.MILLISECOND) * 1000000; - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public String getCreateParameters() - { - return null; - } - - public int getDisplaySize() - { - return 26; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.sql.Timestamp"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "TIMESTAMP"; - } - - public int getMaximumPrecision() - { - return 26; - } - - public int getMaximumScale() - { - return 6; - } - - public int getMinimumScale() - { - return 6; - } - - public int getNativeType() - { - return 392; - } - - public int getPrecision() - { - return 26; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return 6; - } - - public int getType() - { - return java.sql.Types.TIMESTAMP; - } - - public String getTypeName() - { - return "TIMESTAMP"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return 26; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 16; - if(calendar == null) calendar = Calendar.getInstance(); //@P0A - calendar.set(year_, month_, day_, 0, 0, 0); - calendar.set(Calendar.MILLISECOND, 0); //@KBA added per JTOpen Bug 3818. According to java.sql.Date, the milliseconds also need to be 'normalized' to zero. - return new Date(calendar.getTime().getTime()); - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - Calendar calendar = Calendar.getInstance(); - calendar.set(year_, month_, day_, hour_, minute_, second_); - Timestamp ts = new Timestamp (calendar.getTime().getTime()); - ts.setNanos(nanos_); - return ts; - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - Calendar calendar = Calendar.getInstance(); - calendar.set(year_, month_, day_, hour_, minute_, second_); - Timestamp ts = new Timestamp (calendar.getTime().getTime()); - ts.setNanos(nanos_); - return timestampToString(ts, calendar, hour_); // @F4C - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 18; - if(calendar == null) calendar = Calendar.getInstance(); //@P0A - calendar.set(0, 0, 0, hour_, minute_, second_); - return new Time(calendar.getTime().getTime()); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) calendar = Calendar.getInstance(); //@P0A - calendar.set(year_, month_, day_, hour_, minute_, second_); - Timestamp ts = new Timestamp(calendar.getTime().getTime()); - ts.setNanos(nanos_); - return ts; - } - - public InputStream getUnicodeStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); //@pdc - return null; //@pdc - } - -/* ifdef JDBC40 */ - //@pda jdbc40 - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - Calendar calendar = Calendar.getInstance(); - calendar.set(year_, month_, day_, hour_, minute_, second_); - Timestamp ts = new Timestamp (calendar.getTime().getTime()); - ts.setNanos(nanos_); - return timestampToString(ts, calendar, hour_); - } - -/* ifdef JDBC40 */ - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLVarbinary.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLVarbinary.java deleted file mode 100644 index 91375550a..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLVarbinary.java +++ /dev/null @@ -1,649 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLVarbinary.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLVarbinary -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private static final byte[] default_ = new byte[0]; - - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private byte[] value_; - - SQLVarbinary(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = default_; - } - - public Object clone() - { - return new SQLVarbinary(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset);; - AS400ByteArray typeConverter = new AS400ByteArray(length_); - value_ = (byte[])typeConverter.toObject(rawBytes, offset+2); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - AS400ByteArray typeConverter = new AS400ByteArray(length_); - BinaryConverter.unsignedShortToByteArray(length_, rawBytes, offset); - typeConverter.toBytes(value_, rawBytes, offset + 2); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(object instanceof String) - { - try - { - value_ = BinaryConverter.stringToBytes((String)object); - } - catch(NumberFormatException nfe) - { - // the String contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else if(object instanceof byte[]) - value_ = (byte[])object; - - else if(object instanceof InputStream) - { - //value_ = JDUtilities.streamToBytes((InputStream)object, scale); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(object instanceof Reader) - { - // value_ = BinaryConverter.stringToBytes(JDUtilities.readerToString((Reader)object, scale)); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - stream.close(); //@scan1 - - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - stream.close(); //@scan1 - - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Blob) - value_ = ((Blob)object).getBytes(1, (int)((Blob)object).length()); - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - try - { - value_ = BinaryConverter.stringToBytes(((Clob)object).getSubString(1, (int)((Clob)object).length())); - } - catch(NumberFormatException nfe) - { - // the Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Truncate if necessary. - int valueLength = value_.length; - if(valueLength > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - truncated_ = valueLength - maxLength_; - } - else - truncated_ = 0; - - length_ = value_.length; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.VARBINARY; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_ ; - } - - public String getJavaClassName() - { - return "[B"; - } - - public String getLiteralPrefix() - { - return "VARBINARY(X\'"; //@5WXVJX changed from x' - } - - public String getLiteralSuffix() - { - return "\')"; //@5WXVJX changed from ' - } - - public String getLocalName() - { - return "VARBINARY"; - } - - public int getMaximumPrecision() - { - return 32739; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 908; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.VARBINARY; - } - - public String getTypeName() - { - return "VARBINARY"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new ByteArrayInputStream(getBytes()); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - byte[] bytes = getBytes(); - return new AS400JDBCBlob(bytes, bytes.length); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length > maxFieldSize) && (maxFieldSize > 0)) - { - byte[] truncatedValue = new byte[maxFieldSize]; - System.arraycopy(value_, 0, truncatedValue, 0, maxFieldSize); - return truncatedValue; - } - else - { - return value_; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - String string = BinaryConverter.bytesToHexString(getBytes()); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return getBytes(); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - -/* ifdef JDBC40 */ - //@PDA jdbc40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - String string = BinaryConverter.bytesToHexString(getBytes()); - return new AS400JDBCNClob(string, maxLength_); - } -/* endif */ - - //@PDA jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } - -/* ifdef JDBC40 */ - //@PDA jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@PDA jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLVarchar.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLVarchar.java deleted file mode 100644 index 295274de1..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLVarchar.java +++ /dev/null @@ -1,727 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLVarchar.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.net.URL; - -final class SQLVarchar -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private String value_; - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLVarchar(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLVarchar(maxLength_, settings_); - } - - // @A2A - // Added method trim() to trim the string. - public void trim() // @A2A - { // @A2A - value_ = value_.trim(); // @A2A - } // @A2A - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - try{ - value_ = ccsidConverter.byteArrayToString(rawBytes, offset+2, length_, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - }catch(Exception e){ - JDError.throwSQLException(JDError.EXC_CHAR_CONVERSION_INVALID, e); - } - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - try - { - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - // The length in the first 2 bytes is actually the length in characters. - byte[] temp = ccsidConverter.stringToByteArray(value_, bidiConversionProperties); //@KBC changed to used bidiConversionProperties instead of bidiStringType - BinaryConverter.unsignedShortToByteArray(temp.length, rawBytes, offset); - if(temp.length > maxLength_) - { - maxLength_ = temp.length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL, "Change Descriptor"); - } - System.arraycopy(temp, 0, rawBytes, offset+2, temp.length); - - // The buffer we are filling with data is big enough to hold the entire field. - // For varchar fields the actual data is often smaller than the field width. - // That means whatever is in the buffer from the previous send is sent to the - // system. The data stream includes actual data length so the old bytes are not - // written to the database, but the junk left over may decrease the affectiveness - // of compression. The following code will write hex 0s to the buffer when - // actual length is less that field length. Note the 0s are written only if - // the field length is pretty big. The data stream code (DBBaseRequestDS) - // does not compress anything smaller than 1K. - if( (maxLength_ - temp.length > 16)) //@rle - { - int stopHere = offset + 2 + maxLength_; - for(int i=offset + 2 + temp.length; i= 20 && object instanceof Clob) - { // @C1C - Clob clob = (Clob)object; // @C1C - value = clob.getSubString(1, (int)clob.length()); // @C1C @D1 - } // @C1C - -/* ifdef JDBC40 */ - else if(object instanceof SQLXML) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value = xml.getString(); - } -/* endif */ - - if(value == null) // @C1C - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - value_ = value; // @C1A - - // Truncate if necessary. - int valueLength = value_.length(); - - int truncLimit = maxLength_; // @F2a - - if(valueLength > truncLimit) // @F2c - { - value_ = value_.substring(0, truncLimit); // @F2c - truncated_ = valueLength - truncLimit; // @F2c - } - else - truncated_ = 0; - - length_ = value_.length(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.VARCHAR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "VARCHAR"; - } - - public int getMaximumPrecision() - { - return 32739; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 448; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.VARCHAR; - } - - public String getTypeName() - { - return "VARCHAR"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(getString())); // @F3C - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(getString())); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - byte[] bytes = BinaryConverter.stringToBytes(getString()); - return new AS400JDBCBlob(bytes, bytes.length); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true" or "false", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = getString().trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).byteValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - if(d > Byte.MAX_VALUE || d < Byte.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.byteValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(getString(), settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).intValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Integer.MAX_VALUE || d < Integer.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.intValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).longValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Long.MAX_VALUE || d < Long.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.longValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).shortValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Short.MAX_VALUE || d < Short.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.shortValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length() - maxFieldSize; - return value_.substring(0, maxFieldSize); - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(getString(), settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(getString(), calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(getString()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } -/* ifdef JDBC40 */ - //@pda jdbc40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } - -/* ifdef JDBC40 */ - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - // - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this string contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} / - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLVarcharForBitData.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLVarcharForBitData.java deleted file mode 100644 index ca8cd5b20..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLVarcharForBitData.java +++ /dev/null @@ -1,665 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLVarcharForBitData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLVarcharForBitData -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private static final byte[] default_ = new byte[0]; // @C2A - - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private byte[] value_; - - SQLVarcharForBitData(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = default_; // @C2C - } - - public Object clone() - { - return new SQLVarcharForBitData(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - AS400ByteArray typeConverter = new AS400ByteArray(length_); - value_ = (byte[])typeConverter.toObject(rawBytes, offset+2); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - AS400ByteArray typeConverter = new AS400ByteArray(length_); - BinaryConverter.unsignedShortToByteArray(length_, rawBytes, offset); - typeConverter.toBytes(value_, rawBytes, offset + 2); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(object instanceof String) - { - try - { - value_ = BinaryConverter.stringToBytes((String)object); //@F1A - } - catch(NumberFormatException nfe) - { - // the String contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else if(object instanceof byte[]) - value_ = (byte[])object; // @C1C - - else if(object instanceof InputStream) - { - //value_ = JDUtilities.streamToBytes((InputStream)object, scale); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(object instanceof Reader) - { - // value_ = BinaryConverter.stringToBytes(JDUtilities.readerToString((Reader)object, scale)); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - stream.close(); //@scan1 - - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - stream.close(); //@scan1 - - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Blob) - value_ = ((Blob)object).getBytes(1, (int)((Blob)object).length()); // @C1C @E2C Blobs are 1 based. - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - try - { - value_ = BinaryConverter.stringToBytes(((Clob)object).getSubString(1, (int)((Clob)object).length())); //@F1A - } - catch(NumberFormatException nfe) - { - // the Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Truncate if necessary. - int valueLength = value_.length; - if(valueLength > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - truncated_ = valueLength - maxLength_; - } - else - truncated_ = 0; - - length_ = value_.length; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.VARCHAR_FOR_BIT_DATA; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_ ; - } - - //@F2A JDBC 3.0 - public String getJavaClassName() - { - return "[B"; - } - - public String getLiteralPrefix() - { - return "X\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "VARCHAR() FOR BIT DATA"; //@KKB changed from VARCHAR - } - - public int getMaximumPrecision() - { - return 32739; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 448; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.VARBINARY; - } - - public String getTypeName() - { - return "VARCHAR() FOR BIT DATA"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - - // changed to return stream containing hex string - // return new ByteArrayInputStream(toBytes()); - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new ByteArrayInputStream(getBytes()); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - byte[] bytes = getBytes(); - return new AS400JDBCBlob(bytes, bytes.length); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length - maxFieldSize; - byte[] truncatedValue = new byte[maxFieldSize]; - System.arraycopy(value_, 0, truncatedValue, 0, maxFieldSize); - return truncatedValue; - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - //@F1D return new StringReader(new String(getBytes())); - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); //@F1A - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - //@F1D return new AS400JDBCClob(new String(getBytes())); - String string = BinaryConverter.bytesToHexString(getBytes()); - return new AS400JDBCClob(string, string.length()); //@F1A - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return getBytes(); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - //@F1D return new String(getBytes()); - return BinaryConverter.bytesToHexString(getBytes()); //@F1A - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - - // changed to return stream containing hex string - // return new ByteArrayInputStream(getBytes()); - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - -/* ifdef JDBC40 */ - //@PDA jdbc40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCNClob(BinaryConverter.bytesToHexString(getBytes()), maxLength_); - } -/* endif */ - - //@PDA jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } - -/* ifdef JDBC40 */ - //@PDA jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@PDA jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -/* endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLVargraphic.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLVargraphic.java deleted file mode 100644 index ce0c442cf..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLVargraphic.java +++ /dev/null @@ -1,710 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLVargraphic.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.net.URL; - -final class SQLVargraphic -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private String value_; - private int ccsid_; //@cca1 - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLVargraphic(int maxLength, SQLConversionSettings settings, int ccsid) //@cca1 - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; - ccsid_ = ccsid; //@cca1 - } - - public Object clone() - { - return new SQLVargraphic(maxLength_, settings_, ccsid_); //@cca1 - } - - // Added method trim() to trim the string. - public void trim() - { - value_ = value_.trim(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - // If the field is VARGRAPHIC, length_ contains the number - // of characters in the string, while the converter is expecting - // the number of bytes. Thus, we need to multiply length_ by 2. - value_ = ccsidConverter.byteArrayToString(rawBytes, offset+2, length_*2, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - try - { - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - // The length in the first 2 bytes is actually the length in characters. - byte[] temp = ccsidConverter.stringToByteArray(value_, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - BinaryConverter.unsignedShortToByteArray(temp.length/2, rawBytes, offset); - - if(temp.length > maxLength_) - { - maxLength_ = temp.length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL); - } - System.arraycopy(temp, 0, rawBytes, offset+2, temp.length); - - // The buffer we are filling with data is big enough to hold the entire field. - // For varchar fields the actual data is often smaller than the field width. - // That means whatever is in the buffer from the previous send is sent to the - // system. The data stream includes actual data length so the old bytes are not - // written to the database, but the junk left over may decrease the effectiveness - // of compression. The following code will write hex 0s to the buffer when - // actual length is less that field length. Note the 0s are written only if - // the field length is pretty big. The data stream code (DBBaseRequestDS) - // does not compress anything smaller than 1K. - if((maxLength_ > 256) && (maxLength_ - temp.length > 16)) - { - int stopHere = offset + 2 + maxLength_; - for(int i=offset + 2 + temp.length; i= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value = clob.getSubString(1, (int)clob.length()); - } -/* ifdef JDBC40 */ - else if(object instanceof SQLXML) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value = xml.getString(); - } -/* endif */ - if(value == null) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - value_ = value; - - // Truncate if necessary. - int valueLength = value_.length(); - - int truncLimit = maxLength_ / 2; - - if(valueLength > truncLimit) - { - value_ = value_.substring(0, truncLimit); - truncated_ = valueLength - truncLimit; - } - else - truncated_ = 0; - - length_ = value_.length(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.VARGRAPHIC; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - if(ccsid_ == 65535) //@bingra - return maxLength_; //@bingra - else - return maxLength_ / 2; - } - - // JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "VARGRAPHIC"; - } - - public int getMaximumPrecision() - { - return 16369; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 464; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.VARCHAR; - } - - public String getTypeName() - { - if( ccsid_ == 13488 || ccsid_ == 1200) //@cca1 - return "NVARCHAR"; //@cca1 same as native - - return "VARGRAPHIC"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(getString())); // @F3C - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(getString())); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - byte[] bytes = BinaryConverter.stringToBytes(getString()); - return new AS400JDBCBlob(bytes, bytes.length); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true" or "false", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = getString().trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).byteValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(getString(), settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).intValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).longValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).shortValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length() - maxFieldSize; - return value_.substring(0, maxFieldSize); - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(getString(), settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(getString(), calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(getString()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } - -/* ifdef JDBC40 */ - //@pda jdbc40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } - -/* ifdef JDBC40 */ - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - // - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // // this string contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } -/* endif */ - - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SQLXMLLocator.java b/cvsroot/jdbc40/com/ibm/as400/access/SQLXMLLocator.java deleted file mode 100644 index 8d6720060..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SQLXMLLocator.java +++ /dev/null @@ -1,1200 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLXMLLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2009-2009 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -import java.sql.Types; -/* ifdef JDBC40 */ -import java.sql.NClob; -import java.sql.RowId; -/* endif */ -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.SQLXML; -/* endif */ - -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -//@xml3 new class -//sending xml to host, this class acts like BlobLocator -//reading xml from host, this class acts like ClobLocator -final class SQLXMLLocator implements SQLLocator -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private AS400JDBCConnection connection_; - //writing to host, we let host do all the conversion - //reading from host, we do all the conversion - private ConvTable converter_; //used when reading from host - private ConvTable unicodeConverter_; //1200 unicode to simulate no conversion //used when writing to host - private ConvTable unicodeUtf8Converter_; //1208 when no XML declaration //@xmlutf8 - private int id_; - private JDLobLocator locator_; - private int maxLength_; - private SQLConversionSettings settings_; - private int truncated_; - private int columnIndex_; - private byte[] valueBlob_; //@loch //Note that value_ is not used as the output for a ResultSet.getX() call. We Get the value from a call to the JDLocator (not from value_) and not from the savedObject_, unless resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - private String valueClob_; - - private Object savedObject_; // This is the AS400JDBCXMLLocator or InputStream or whatever got set into us. - private int scale_; // This is actually the length that got set into us. - private int xmlType_; //@xml3 0=SB 1=DB 2=binary XML - - SQLXMLLocator(AS400JDBCConnection connection, - int id, - int maxLength, - SQLConversionSettings settings, - ConvTable converter, - int columnIndex, - int xmlType) //@xml3 - { - connection_ = connection; - maxLength = AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; //@xml3 //for xml, length is unknown. use max for single byte lobs since xml is returned via bloblocator - id_ = id; - if(xmlType == 1) - locator_ = new JDLobLocator(connection, id, maxLength, false); //DB //@xmlgraphic (xml is always sent with bytecount) - else - locator_ = new JDLobLocator(connection, id, maxLength, false); //SB - maxLength_ = maxLength; - settings_ = settings; - truncated_ = 0; - converter_ = converter; - columnIndex_ = columnIndex; - xmlType_ = xmlType; //@xml3 0=SB 1=DB 2=binary XML - try{ - //Since we want to pass string's bytes as 1200 (java default for String) - //But if XML does not have a declaration then hostserver expects 1208 - unicodeConverter_ = connection.getConverter(1200); - unicodeUtf8Converter_ = connection.getConverter(1208); //@xmlutf8 - }catch(SQLException e){ - unicodeConverter_ = connection.converter_;//should never happen - } - } - - public Object clone() - { - return new SQLXMLLocator(connection_, id_, maxLength_, settings_, converter_, columnIndex_, xmlType_); //@xml3 - } - - public void setHandle(int handle) - { - locator_.setHandle(handle); - } - - public int getHandle() - { - return locator_.getHandle(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int locatorHandle = BinaryConverter.byteArrayToInt(rawBytes, offset); - locator_.setHandle(locatorHandle); - locator_.setColumnIndex(columnIndex_); - } - - //This is only called from AS400JDBCPreparedStatement in one place. - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - BinaryConverter.intToByteArray(locator_.getHandle(), rawBytes, offset); - - // Now we write our saved data to the system, because the prepared statement is being executed. - // We used to write the data to the system on the call to set(), but this messed up - // batch executes, since the host server only reserves temporary space for locator handles one row at a time. - // See the toObject() method in this class for more details. - if(savedObject_ != null) writeToServer(); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - // This method actually writes the data to the system. - private void writeToServer() - throws SQLException - { - if(savedObject_ instanceof byte[]) - { - byte[] bytes = (byte[])savedObject_; - locator_.writeData(0, bytes, true); - } - else if(savedObject_ instanceof InputStream) - { - int length = scale_; // hack to get the length into the set method - //if(xmlType_ == 1) - // length *=2; //double-byte - - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); - } - else if(length > 0) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - if(xmlType_ == 1) - locator_.writeData(totalBytesRead/2, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. - else - locator_.writeData(totalBytesRead, byteBuffer, 0, bytesRead, true); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - if(totalBytesRead < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - if(xmlType_ == 1) - locator_.writeData(totalBytesRead/2, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. - else - locator_.writeData(totalBytesRead, byteBuffer, 0, bytesRead, true); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if (savedObject_ instanceof Blob) - { - //Start new code for updateable locator case to go through the Vectors - //and update the blob copy when ResultSet.updateBlob() is called. - boolean set = false; - if(savedObject_ instanceof AS400JDBCBlobLocator) - { - AS400JDBCBlobLocator blob = (AS400JDBCBlobLocator)savedObject_; - - //Synchronize on a lock so that the user can't keep making updates - //to the blob while we are taking updates off the vectors. - synchronized(blob) - { - // See if we saved off our real object from earlier. - if(blob.savedObject_ != null) - { - savedObject_ = blob.savedObject_; - scale_ = blob.savedScale_; - blob.savedObject_ = null; - writeToServer(); - return; - } - } - } - - //If the code for updateable lob locators did not run, then run old code. - if(!set) - { - Blob blob = (Blob)savedObject_; - int length = (int)blob.length(); - byte[] data = blob.getBytes(1, length); - locator_.writeData(0, data, 0, length, true); - } - } - else if(savedObject_ instanceof String) - { - String string = (String)savedObject_; - byte[] bytes; - if(JDUtilities.hasXMLDeclaration(string)) //@xmlutf8 - { - string = JDUtilities.handleXMLDeclarationEncoding(string); //if encoding is non utf-16 then remove to match Java Strings //@xmlutf16 - bytes = unicodeConverter_.stringToByteArray(string); //just get bytes - } - else //@xmlutf8 - bytes = unicodeUtf8Converter_.stringToByteArray(string); //@xmlutf8 - locator_.writeData(0L, bytes, true); - } - else if(savedObject_ instanceof Reader) - { - int length = scale_; // hack to get the length into the set method - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); - } - else if(length > 0) - { - //@xmlutf8 (for reader and stream, don't do any conversion) - //@xmlutf8 added code here similar to SQLBlob.set() for Reader input. - byte[] bytes = null; - - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - //assume reader is utf-8 since setAsciiStream() - ReaderInputStream stream = new ReaderInputStream((Reader)savedObject_, unicodeUtf8Converter_.getCcsid(), null, blockSize); //@xmlreader - - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - bytes = baos.toByteArray(); - - if(bytes.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - int objectLength = bytes.length; - if(bytes.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(bytes, 0, newValue, 0, maxLength_); - bytes = newValue; - } - stream.close(); //@scan1 - locator_.writeData(0, bytes, true); - } - catch(ExtendedIOException eie) - { - // the Reader contains bad chars that can't convert - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - byte[] bytes = null; - - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - //assume reader is utf-8 since setAsciiStream() - ReaderInputStream stream = new ReaderInputStream((Reader)savedObject_, unicodeUtf8Converter_.getCcsid(), null, blockSize); //@xmlreader - - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - bytes = baos.toByteArray(); - - int objectLength = bytes.length; - if(bytes.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(bytes, 0, newValue, 0, maxLength_); - bytes = newValue; - } - stream.close(); //@scan1 - locator_.writeData(0, bytes, true); - } - catch(ExtendedIOException eie) - { - // the Reader contains bad chars that can't convert - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if( savedObject_ instanceof Clob) //jdbc40 NClob isa Clob - { - //@G5A Start new code for updateable locator case - boolean set = false; - if(savedObject_ instanceof AS400JDBCClobLocator) //@PDA jdbc40 comment: AS400JDBCNClobLocator isa AS400JDBCClobLocator - { - AS400JDBCClobLocator clob = (AS400JDBCClobLocator)savedObject_; - - //Synchronize on a lock so that the user can't keep making updates - //to the clob while we are taking updates off the vectors. - synchronized(clob) - { - // See if we saved off our real object from earlier. - if(clob.savedObject_ != null) - { - savedObject_ = clob.savedObject_; - scale_ = clob.savedScale_; - clob.savedObject_ = null; - writeToServer(); - return; - } - } - } - - //If the code for updateable lob locators did not run, then run old code. - if(!set) - { - Clob clob = (Clob)savedObject_; - int length = (int)clob.length(); - String substring = clob.getSubString(1, length); - byte[] inputBytes; //@len2utf8 - if(JDUtilities.hasXMLDeclaration(substring)) //@xmlutf8 - inputBytes = unicodeConverter_.stringToByteArray(JDUtilities.handleXMLDeclarationEncoding(substring)); //@len2utf8 //here, we have a string, so it has to be in utf-16, so just take out encoding and sq and detect encoding - else - inputBytes = unicodeUtf8Converter_.stringToByteArray(substring); //@len2utf8 - - - locator_.writeData(0L, inputBytes, 0, inputBytes.length, true); //@xmlutf8 - set = true; - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } -/* ifdef JDBC40 */ - else if( savedObject_ instanceof SQLXML ) //@olddesc - { - SQLXML xml = (SQLXML)savedObject_; - - boolean set = false; - if(savedObject_ instanceof AS400JDBCSQLXMLLocator) - { - AS400JDBCSQLXMLLocator xmlLocator = (AS400JDBCSQLXMLLocator)savedObject_; - - //Synchronize on a lock so that the user can't keep making updates - //to the xml while we are taking updates off the vectors. - synchronized(xmlLocator) - { - // See if we saved off our real object from earlier. - if(xmlLocator.clobLocatorValue_ != null && xmlLocator.clobLocatorValue_.savedObject_ != null) - { - savedObject_ = xmlLocator.clobLocatorValue_.savedObject_; - scale_ = xmlLocator.clobLocatorValue_.savedScale_; - xmlLocator.clobLocatorValue_.savedObject_ = null; - writeToServer(); - return; - } - else if(xmlLocator.blobLocatorValue_ != null && xmlLocator.blobLocatorValue_.savedObject_ != null) - { - savedObject_ = xmlLocator.blobLocatorValue_.savedObject_; - scale_ = xmlLocator.blobLocatorValue_.savedScale_; - xmlLocator.blobLocatorValue_.savedObject_ = null; - writeToServer(); - return; - } - } - } - - if(!set) - { - - //getString() handles internal representation of clob/dbclob/blob... - String stringVal = xml.getString(); - byte[] inputBytes; //@len2utf8 - if(JDUtilities.hasXMLDeclaration(stringVal)) //@xmlutf8 - inputBytes = unicodeConverter_.stringToByteArray(JDUtilities.handleXMLDeclarationEncoding(stringVal)); //@len2utf8 //here, we have a string, so it has to be in utf-16, so just take out encoding and sq and detect encoding - else - inputBytes = unicodeUtf8Converter_.stringToByteArray(stringVal); //@len2utf8 - - - locator_.writeData(0L, inputBytes, 0, inputBytes.length, true); //@xmlutf8 - } - } -/* endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - //no need to check truncation since xml does not have size - savedObject_ = object; - if(object instanceof ConvTableReader) //@ascii - { - //set xml flag so ConvTableReader will trim off xml declaration since we will be transmitting in utf-8 - ((ConvTableReader)savedObject_).isXML_ = true; //@ascii - scale_ = -2;//@ascii flag -2 to read to end of stream (xml transmits in utf8 which may have 2-byte chars, which does not match length) - } - else if(scale != -1) - scale_ = scale; // Skip resetting it if we don't know the real length - } - - //Method to temporary convert from object input to output before even going to host (writeToServer() does the conversion needed before writing to host) - //This will only be used when resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - //Purpose is to do a local type conversion from obj1 to obj2 like other non-locator lob types - private void doConversion() - throws SQLException - { - valueClob_ = null; - valueBlob_ = null; - int length_ = scale_; - - if( length_ == -1) - { - try{ - //try to get length from locator - length_ = (int)locator_.getLength(); - }catch(Exception e){ } - } - - try - { - - if(savedObject_ instanceof String) - { - valueClob_ = (String)savedObject_; - - } - else if(savedObject_ instanceof Reader) - { - if(length_ >= 0) - { - try - { - int blockSize = length_ < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length_ : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)savedObject_; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 && totalCharsRead < length_) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - int charsRemaining = length_ - totalCharsRead; - if(charsRemaining < blockSize) - { - blockSize = charsRemaining; - } - charsRead = stream.read(charBuffer, 0, blockSize); - } - valueClob_ = buf.toString(); - - if(valueClob_.length() < length_) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length_ == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)savedObject_; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - - charsRead = stream.read(charBuffer, 0, blockSize); - } - valueClob_ = buf.toString(); - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if( savedObject_ instanceof Clob) - { - Clob clob = (Clob)savedObject_; - valueClob_ = clob.getSubString(1, (int)clob.length()); - } - else if(savedObject_ instanceof byte[]) - { - valueBlob_ = (byte[]) savedObject_; - int objectLength = valueBlob_.length; - if(objectLength > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(valueBlob_, 0, newValue, 0, maxLength_); - valueBlob_ = newValue; - } - //xml has no max size truncated_ = objectLength - valueBlob_.length; - } - else if(savedObject_ instanceof Blob) - { - Blob blob = (Blob) savedObject_; - int blobLength = (int)blob.length(); - int lengthToUse = blobLength < 0 ? 0x7FFFFFFF : blobLength; - if(lengthToUse > maxLength_) lengthToUse = maxLength_; - valueBlob_ = blob.getBytes(1, lengthToUse); - //xml has no max sizetruncated_ = blobLength - lengthToUse; - } - else if(savedObject_ instanceof InputStream) - { - int length = scale_; - if(length >= 0) - { - InputStream stream = (InputStream)savedObject_; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - - valueBlob_ = baos.toByteArray(); - - if(valueBlob_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - int objectLength = valueBlob_.length; - if(objectLength > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(valueBlob_, 0, newValue, 0, maxLength_); - valueBlob_ = newValue; - } - //xml has no max sizetruncated_ = objectLength - valueBlob_.length; - } - else if(length == -2 )//@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)savedObject_; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - - valueBlob_ = baos.toByteArray(); - - int objectLength = valueBlob_.length; - if(objectLength > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(valueBlob_, 0, newValue, 0, maxLength_); - valueBlob_ = newValue; - } - //xml has no max sizetruncated_ = objectLength - valueBlob_.length; - } -/* ifdef JDBC40 */ - else if( savedObject_ instanceof SQLXML ) - { - SQLXML xml = (SQLXML)savedObject_; - valueClob_ = xml.getString(); - } -/* endif */ - else - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - } - finally - { - //nothing - } - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.XML_LOCATOR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCSQLXML"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "XML"; - } - - public int getMaximumPrecision() - { -/* ifdef JDBC40 */ - return AS400JDBCSQLXML.MAX_XML_SIZE; -/* endif */ -/* ifndef JDBC40 - return AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; - endif */ - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 2452; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { -/* ifdef JDBC40 */ - return Types.SQLXML; -/* endif */ -/* ifndef JDBC40 - return Types.CLOB; - endif */ - } - - public String getTypeName() - { - return "XML"; - - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return maxLength_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(valueClob_));//@loch - } //@loch - //remove xml declaration via ConvTableReader - Reader tmpUnicodeReader = new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid(), true); - // tmpUnicodeReader. - return new ReaderInputStream(tmpUnicodeReader, 819); // ISO-8859-1. //is xml type - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new AS400JDBCInputStream(new JDLobLocator(locator_)); - } - - public Blob getBlob() - throws SQLException - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCBlob(valueBlob_, maxLength_); //@loch - } //@loch - - // We don't want to give out our internal locator to the public, - // otherwise when we go to change its handle on the next row, they'll - // get confused. So we have to clone it. - truncated_ = 0; - return new AS400JDBCBlobLocator(new JDLobLocator(locator_), savedObject_, scale_); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - throws SQLException - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return valueBlob_;//@loch - } //@loch - - int locatorLength = (int)locator_.getLength(); - if(locatorLength == 0) return new byte[0]; - DBLobData data = locator_.retrieveData(0, locatorLength); - int actualLength = data.getLength(); - byte[] bytes = new byte[actualLength]; - System.arraycopy(data.getRawBytes(), data.getOffset(), bytes, 0, actualLength); - truncated_ = 0; - return bytes; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new StringReader(valueClob_); //@loch - } //@loch - //remove xml declaration via ConvTableReader - return new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid(), true); //@xml4 - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCClob(valueClob_, maxLength_); //@loch - } //@loch - - return new AS400JDBCClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_, true);//@xml4 - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - // toObject is used by AS400JDBCPreparedStatement for batching, so we save off our InputStream - // inside the AS400JDBCBlobLocator. Then, when convertToRawBytes() is called, the writeToServer() - // code checks the AS400JDBCBlobLocator's saved InputStream... if it exists, then it writes the - // data out of the InputStream to the system by calling writeToServer() again. - - // Since toObject could also be called from an external user's standpoint, we have - // to clone our internal locator (because we reuse it internally). - // This doesn't make much sense, since we technically can't reuse it because - // the prepared statement is calling toObject() to store off the parameters, - // but it's all we can do for now. - truncated_ = 0; -/* ifdef JDBC40 */ - if(savedObject_ != null)//@xmlupdate //either return savedObject_ here, or add two iterations of getting savedObject_ in writeToServer if type is AS400JDBCSQLXML since it contains clob which contains savedObject_ - return savedObject_; //@xmlupdate - return new AS400JDBCSQLXMLLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_, true); //@xml4 - -/* endif */ -/* ifndef JDBC40 - return getClob(); //@xml4 - endif */ - } - - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return valueClob_; //@loch - } //@loch - - DBLobData data = locator_.retrieveData(0, locator_.getMaxLength()); - String value = converter_.byteArrayToString(data.getRawBytes(), - data.getOffset(), - data.getLength()); - value = JDUtilities.stripXMLDeclaration(value); //remove xml declaration - truncated_ = 0; - return value; - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new ReaderInputStream(new StringReader(valueClob_), 13488); //@loch - } //@loch - - //remove xml declaration via ConvTableReader - return new ReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid(), true), 13488); //@xml4 - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); - return null; - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new StringReader(valueClob_); //@loch - } //@loch - - try - { - //remove xml declaration via ConvTableReader - return new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid(), true); //@xml4 - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - -/* ifdef JDBC40 */ - //@pda jdbc40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCNClob(valueClob_, maxLength_); //@loch - } //@loch - - return new AS400JDBCNClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_, true); //@xml4 - - } -/* endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return valueClob_; //@loch - } //@loch - - DBLobData data = locator_.retrieveData(0, locator_.getMaxLength()); - String value = converter_.byteArrayToString(data.getRawBytes(), - data.getOffset(), - data.getLength()); - value = JDUtilities.stripXMLDeclaration(value); //remove xml declaration - return value; - } - -/* ifdef JDBC40 */ - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@PDA jdbc40 - public SQLXML getSQLXML() throws SQLException - { - truncated_ = 0; - //xml data is always retrieved from host in binary 65535 format - //may or maynot need converter depending on how user gets data from SQLXML - //return xmllocator which will treat data as cloblocator and do conversion - //@xml3 if xml column, remove xml declaration from within internal cloblocator inside of sqlxmllocator. - return new AS400JDBCSQLXMLLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_, true); //@xml4 - } -/* endif */ - - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/SerializableReader.java b/cvsroot/jdbc40/com/ibm/as400/access/SerializableReader.java deleted file mode 100644 index 7b0d1c5e3..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/SerializableReader.java +++ /dev/null @@ -1,146 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: SerializableReader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharArrayReader; -import java.io.IOException; -import java.io.Reader; -import java.sql.SQLException; - - -/** -The SerializableReader class can be used to encapsulate a Reader object -such that it is serializable. -**/ -class SerializableReader -extends java.io.Reader -implements java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private char[] charArray_; - private transient CharArrayReader reader_; - - - - - public SerializableReader (java.io.Reader reader, int length) - throws IOException, SQLException - { - // Assume that the arguments have been validated. - charArray_ = new char[length]; - int numChars = reader.read (charArray_); - if (numChars != length || - reader.read() != -1) - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Length parameter does not match actual length of buffer."); - throw new SQLException (); - } - reader_ = new CharArrayReader (charArray_); - } - - //@pda jdbc40 - public SerializableReader (java.io.Reader reader) - throws IOException, SQLException - { - // Assume that the arguments have been validated. - charArray_ = readerToChars( reader ); - reader_ = new CharArrayReader (charArray_); - } - - //@pda jdbc40 new method for unknown length. - /** - Reads a reader and returns its data as a Char[]. - Reads until reader returns -1 for eof. - - @param input The reader. - @return Char array of chars in reader. - - **/ - static final char[] readerToChars (Reader input) - throws SQLException - { - StringBuffer buffer = new StringBuffer (); - int actualLength = 0; - try { - - char[] rawChars = new char[32000]; - - while (input.ready ()) { - int length2 = input.read (rawChars); - if (length2 < 0) - break; - //buffer.append (new String (rawChars, 0, length2)); - buffer.append (rawChars, 0, length2); - actualLength += length2; - } - - } - catch (IOException e) { - JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - } - - char[] allChars = new char[actualLength]; - buffer.getChars(0, actualLength, allChars, 0); - return allChars; - } - - public void close() - { reader_.close (); } - - public void mark(int readAheadLimit) throws IOException - { reader_.mark (readAheadLimit); } - - public boolean markSupported() - { return reader_.markSupported (); } - - public int read() throws IOException - { return reader_.read (); } - - public int read(char b[], - int off, - int len) throws IOException - { return reader_.read (b, off, len); } - - // This is called when the object is deserialized. - // Note that charArray_ gets serialized/deserialized. - private void readObject (java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - // Restore the non-static and non-transient fields. - in.defaultReadObject (); - - reader_ = new CharArrayReader (charArray_); - } - - public boolean ready() throws IOException - { return reader_.ready (); } - - public void reset() throws IOException - { reader_.reset (); } - - public long skip(long n) throws IOException - { return reader_.skip (n); } - - - -} diff --git a/cvsroot/jdbc40/com/ibm/as400/access/ToolboxWrapper.java b/cvsroot/jdbc40/com/ibm/as400/access/ToolboxWrapper.java deleted file mode 100644 index a106ebc7d..000000000 --- a/cvsroot/jdbc40/com/ibm/as400/access/ToolboxWrapper.java +++ /dev/null @@ -1,122 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ToolboxWrapper.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; -/* ifdef JDBC40 */ -import java.sql.Wrapper; -/* endif */ - - -/* - * This class provides a single point where we implement java.sql.Wrapper. - * Any of the other classes (ie Connection, Statement, ResultSet, etc) that - * implement java.sql.Wrapper are done so by extending this class. - * The original purpose of this class was so that we could have a single code base - * for both pre jdk 1.6 and post jdk 1.6. Then this class (containing Generics), could - * be in a jdk 1.6 only release, and a stub could be in the pre jdk 1.6 release. But - * because of so many issues with security and class loading, we did not pursue the - * "stub" infrastructure. But since this class design was a nice way to keep the - * wrapper code in one class, we decided to keep it. - */ -class ToolboxWrapper -/* ifdef JDBC40 */ -implements Wrapper -/* endif */ -{ - - - //@PDA jdbc40 - //Copied from JDError. Needed for proxy classes that extend this class. - private static final String EXC_PARAMETER_TYPE_INVALID = "HY105"; - - - //this method needs to be overridden by classes that extend ToolboxWrapper to return a list of classes - //that the class may be a wrapper of. - protected String[] getValidWrappedList() - { - return new String[] { }; //return empty array - } - - /** - * Returns true if this either implements the interface argument or is - * directly or indirectly a wrapper for an object that does. Returns false - * otherwise. If this implements the interface then return true, else if - * this is a wrapper then return the result of recursively calling - * isWrapperFor on the wrapped object. If this does not - * implement the interface and is not a wrapper, return false. This method - * should be implemented as a low-cost operation compared to - * unwrap so that callers can use this method to avoid - * expensive unwrap calls that may fail. If this method - * returns true then calling unwrap with the same argument - * should succeed. - * - * @param iface - * a Class defining an interface. - * @return true if this implements the interface or directly or indirectly - * wraps an object that does. - * @throws java.sql.SQLException - * if an error occurs while determining whether this is a - * wrapper for an object with the given interface. - */ -/* ifdef JDBC40 */ - public boolean isWrapperFor(Class iface) throws SQLException - { - if (iface == null) - return false; - - String[] validWrappedList = getValidWrappedList(); - for (int i = 0; i < validWrappedList.length; i++) - { - if (iface.getName().equals(validWrappedList[i])) - return true; - } - - return false; - } -/* endif */ - /** - * Returns an object that implements the given interface to allow access to - * non-standard methods, or standard methods not exposed by the proxy. - * - * If the receiver implements the interface then the result is the receiver - * or a proxy for the receiver. If the receiver is a wrapper and the wrapped - * object implements the interface then the result is the wrapped object or - * a proxy for the wrapped object. Otherwise return the the result of - * calling unwrap recursively on the wrapped object or a - * proxy for that result. If the receiver is not a wrapper and does not - * implement the interface, then an SQLException is thrown. - * - * @param iface - * A Class defining an interface that the result must implement. - * @return an object that implements the interface. May be a proxy for the - * actual implementing object. - * @throws java.sql.SQLException - * If no object found that implements the interface - */ -/* ifdef JDBC40 */ - public T unwrap(Class iface) throws SQLException { - if (isWrapperFor(iface)) - return (T)this; - else - { - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_PARAMETER_TYPE_INVALID), - EXC_PARAMETER_TYPE_INVALID, -99999); - //JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - } - - } -/* endif */ -} diff --git a/cvsroot/license.html b/cvsroot/license.html deleted file mode 100644 index 556880d70..000000000 --- a/cvsroot/license.html +++ /dev/null @@ -1,139 +0,0 @@ - - - -IBM Public License Version 1.0 - - - - - - - - - - -
-
- -IBM Public License Version 1.0 - -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS IBM PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. -

-

1. DEFINITIONS -

"Contribution" means: - -

    a) in the case of International Business Machines Corporation ("IBM"), the Original Program, and
- - -
    b) in the case of each Contributor,
- - -
    i) changes to the Program, and
- - -
    ii) additions to the Program;
- - -
    where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
- -

-

"Contributor" means IBM and any other entity that distributes the Program. -

-

"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. -

-

"Original Program" means the original version of the software accompanying this Agreement as released by IBM, including source code, object code and documentation, if any. -

-

"Program" means the Original Program and Contributions. -

-

"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. -

-

2. GRANT OF RIGHTS - -

    a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
- - -
- - -
    b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
- - -
- - -
    c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
- - -
- - -
    d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
- - -
- -

3. REQUIREMENTS -

A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: - -

    a) it complies with the terms and conditions of this Agreement; and
- - -
    b) its license agreement:
- - -
    i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
- - -
    ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
- - -
    iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
- - -
    iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
- - -
- -

When the Program is made available in source code form: - -

    a) it must be made available under this Agreement; and
- - -
    b) a copy of this Agreement must be included with each copy of the Program.
- -

-

Each Contributor must include the following in a conspicuous location in the Program: -

- -

    Copyright © {date here}, International Business Machines Corporation and others. All Rights Reserved.
- -

-

In addition, each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. -

-

4. COMMERCIAL DISTRIBUTION -

Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. -

-

For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. -

-

5. NO WARRANTY -

EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. -

-

6. DISCLAIMER OF LIABILITY -

EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -

-

7. GENERAL -

If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. -

-

If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. -

-

All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. -

-

IBM may publish new versions (including revisions) of this Agreement from time to time. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. No one other than IBM has the right to modify this Agreement. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. -

-

This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. - -

-

- - \ No newline at end of file diff --git a/cvsroot/micro/.project b/cvsroot/micro/.project deleted file mode 100644 index b16306b6e..000000000 --- a/cvsroot/micro/.project +++ /dev/null @@ -1,11 +0,0 @@ - - - micro - - - - - - - - diff --git a/cvsroot/micro/com/ibm/as400/micro/AS400.java b/cvsroot/micro/com/ibm/as400/micro/AS400.java deleted file mode 100644 index e4e64854e..000000000 --- a/cvsroot/micro/com/ibm/as400/micro/AS400.java +++ /dev/null @@ -1,316 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.io.*; -import java.util.Random; -import javax.microedition.io.*; - -/** - * The AS400 class represents a sign-on to the IBM i host servers from a wireless device. - * This class provides a modified subset of the functions available in - * com.ibm.as400.access.AS400. - * - *

The following example demonstrates the use of AS400: - *
- *

- *  AS400 system = new AS400("mySystem", "myUserid", "myPwd", "myMEServer");
- *  try
- *  {
- *      system.connect();
- *  }   
- *  catch (Exception e)
- *  {
- *      // Handle the exception
- *  }
- *  // Done with the system object.
- *  system.disconnect();
- *  
- * - * @see com.ibm.as400.access.AS400 - **/ -public final class AS400 -{ - private String systemName_; // System name. - private String userId_; // User ID. - - // Password bytes twiddled. - private byte[] bytes_; - - private String MEServer_; // ME server system name. - - private boolean signedOn_ = false; // Sign-on status. - - // increment datastream level whenever a client/server datastream change is made. - private static final int DATASTREAM_LEVEL = 0; - - private static final Random rng_ = new Random(); - - // Client side ME connection information. - DataInputStream fromServer_ = null; - DataOutputStream toServer_ = null; - private Connection client_ = null; - - - /** - * Constructs an AS400 object. - * @param systemName The name of the system. - * @param userId The user ID to use to connect to the system. - * @param password The password to use to connect to the system. - * @param MEServer The system name and port of the ME server in the format serverName[:port]. - * If no port is specified, the default will be used. - **/ - public AS400(String systemName, String userId, String password, String MEServer) - { - if (systemName == null) - throw new NullPointerException("systemName"); - - if (userId == null) - throw new NullPointerException("userId"); - - if (password == null) - throw new NullPointerException("password"); - - if (MEServer == null) - throw new NullPointerException("MEServer"); - - systemName_ = systemName; - userId_ = userId; - bytes_ = store(password); - - // determine if a port was specified. - int colon = MEServer.indexOf(':'); - if (colon >= 0) - { - // if a colon and a port were correctly specified, otherwise get the MEServer name and use the default port. - if (colon < MEServer.length() - 1) - MEServer_ = MEServer; - else - MEServer_ = MEServer.substring(0, colon) + MEConstants.ME_SERVER_PORT; - } - else - MEServer_ = MEServer + ":" + MEConstants.ME_SERVER_PORT; - } - - - // Copied from com.ibm.as400.access.BinaryConverter - static byte[] charArrayToByteArray(char[] charValue) - { - if (charValue == null) - return null; - - byte[] byteValue = new byte[charValue.length * 2]; - int inPos = 0; - int outPos = 0; - - while (inPos < charValue.length) - { - byteValue[outPos++] = (byte)(charValue[inPos] >> 8); - byteValue[outPos++] = (byte)charValue[inPos++]; - } - - return byteValue; - } - - - /** - * Disconnects the client from the MEServer. All socket connections associated with this object will be closed. - **/ - public void disconnect() - { - synchronized(this) - { - if (toServer_ == null) - return; - - try - { - toServer_.writeInt(MEConstants.DISCONNECT); - toServer_.flush(); - } - catch (Exception ioe) - { /* Ignore */ - } - - try - { - toServer_.close(); - } - catch (Exception ioe) - { /* Ignore */ - } - - try - { - fromServer_.close(); - } - catch (Exception ioe) - { /* Ignore */ - } - - try - { - client_.close(); - } - catch (Exception ioe) - { /* Ignore */ - } - - signedOn_ = false; - } - } - - - // Scramble some bytes. - private static byte[] encode(byte[] adder, byte[] mask, byte[] bytes) - { - int length = bytes.length; - byte[] buf = new byte[length]; - - for (int i = 0; i < length; ++i) - { - buf[i] = (byte)(bytes[i] + adder[i % adder.length]); - } - - for (int i = 0; i < length; ++i) - { - buf[i] = (byte)(buf[i] ^ mask[i % mask.length]); - } - - return buf; - } - - - // This method is removed because the J2MEWTK by default when it preverifies - // the classes uses the -nofinalize option. So it is now up to the - // application to properly disconnect. - // - ///** - // * When the garbage collector calls finalize(), this - // * method will call disconnect() on the AS400 object. - // **/ - //protected void finalize() - //{ - // disconnect(); - //} - - - /** - * Connect to an IBM i system.

- * - * A connection is typically made implicitly; therefore, this method does not have to be - * called to connect to the system. This method can be used to control when the connection - * is established. - * - * @exception IOException If an error occurs while communicating with the system. - * @exception MEException If an error occurs while processing the ToolboxME request. - **/ - public boolean connect() throws IOException, MEException - { - synchronized(this) - { - // If we haven't already signed on. - if (!signedOn_) - { - client_ = Connector.open("socket://" + MEServer_ , Connector.READ_WRITE); - - toServer_ = new DataOutputStream(((OutputConnection)client_).openOutputStream()); - fromServer_ = new DataInputStream(((InputConnection)client_).openInputStream()); - - toServer_.writeInt(MEConstants.SIGNON); - - // Tell the server what our datastream level is. - toServer_.writeInt(DATASTREAM_LEVEL); - - // Exchange random seeds. - byte[] proxySeed = nextBytes(rng_, MEConstants.ADDER_LENGTH/*PROXY_SEED_LENGTH_*/); - toServer_.write(proxySeed); - toServer_.flush(); - - int serverDatastreamLevel = fromServer_.readInt(); - byte[] remoteSeed = new byte[MEConstants.MASK_LENGTH/*REMOTE_SEED_LENGTH_*/]; - fromServer_.readFully(remoteSeed); - - // Design note: On Palm devices, the only encoding that is guaranteed to be supported is ISO8859_1. - // On MIDP, the default encoding is in the system property "microedition.encoding". - - toServer_.writeUTF(systemName_); - toServer_.writeUTF(userId_); - - byte[] encodedBytes = encode(proxySeed, remoteSeed, bytes_); - toServer_.writeInt(encodedBytes.length); - toServer_.write(encodedBytes); //twiddled and encoded password - toServer_.flush(); - - int retVal = fromServer_.readInt(); - - if (retVal == MEConstants.SIGNON_FAILED || retVal == MEConstants.EXCEPTION_OCCURRED) - { - signedOn_ = false; - int rc = fromServer_.readInt(); - String msg = fromServer_.readUTF(); - - disconnect(); - - throw new MEException(msg,rc); - } - - signedOn_ = true; - } - - return signedOn_; - } - } - - - // Twiddle password bytes. - private static byte[] store(String info) - { - byte[] adder = nextBytes(rng_, MEConstants.ADDER_LENGTH); - byte[] mask = nextBytes(rng_, MEConstants.MASK_LENGTH); - - byte[] infoBytes = encode(adder, mask, charArrayToByteArray(info.toCharArray())); - byte[] returnBytes = new byte[MEConstants.ADDER_PLUS_MASK_LENGTH + infoBytes.length]; - - System.arraycopy(adder, 0, returnBytes, 0, MEConstants.ADDER_LENGTH); - System.arraycopy(mask, 0, returnBytes, MEConstants.ADDER_LENGTH, MEConstants.MASK_LENGTH); - System.arraycopy(infoBytes, 0, returnBytes, MEConstants.ADDER_PLUS_MASK_LENGTH, infoBytes.length); - - return returnBytes; - } - - - // Randomly generate bytes and put them into a new byte array. - static byte[] nextBytes(Random r, int numBytes) - { - byte[] buf = new byte[numBytes]; - - long feeder = r.nextLong(); - - int feederIndex = 0; // We will step through the bytes of the long, 1 byte at a time. - - for (int i=0; i 7) // time to grab another long - { - feeder = r.nextLong(); - feederIndex = 0; - } - - buf[i] = (byte)(0xFF & (feeder >> 8*feederIndex++)); - } - - return buf; - } -} diff --git a/cvsroot/micro/com/ibm/as400/micro/CommandCall.java b/cvsroot/micro/com/ibm/as400/micro/CommandCall.java deleted file mode 100644 index 73e63b2f9..000000000 --- a/cvsroot/micro/com/ibm/as400/micro/CommandCall.java +++ /dev/null @@ -1,116 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.io.IOException; - -/** - * The CommandCall class represents a command object. This class allows the user to call a CL command - * from a wireless device. This class provides a modified subset of the functions available in - * com.ibm.as400.access.CommandCall. - * - *

The following example demonstrates the use of CommandCall: - *
- *

- *   // Work with commands.
- *   AS400 system = new AS400("mySystem", "myUserid", "myPwd", "myMEServer");
- *   try
- *   {
- *       // Run the command "CRTLIB FRED."
- *       String[] messages = CommandCall.run(system, "CRTLIB FRED");
- *       if (messages != null)
- *       {
- *           // Note that there was an error.
- *           System.out.println("Command failed:");
- *           for (int i = 0; i < messages.length; ++i)
- *           {
- *               System.out.println(messages[i]);
- *           }
- *       }
- *       else
- *       {
- *           System.out.println("Command succeeded!");
- *       }
- *   }
- *   catch (Exception e)
- *   {
- *       // Handle the exception
- *   }
- *   // Done with the system object.
- *   system.disconnect();
- *  
- * - * @see com.ibm.as400.access.CommandCall - **/ -public final class CommandCall -{ - /** - * Private CommandCall constructor - **/ - private CommandCall() - { } - - - /** - * Runs the command on the system. - * @param command The command to run on the system. If the command is not library qualified, the library list from the - * job description specified in the user profile will be used to find the command. - * - * @return the message text returned from running the command. An empty array will be return if there were no messages - * or if the command completed successfully. - * - * @exception IOException If an error occurs while communicating with the system. - * @exception MEException If an error occurs while processing the ToolboxME request. - **/ - public static String[] run(AS400 system, String command) throws IOException, MEException - { - if (system == null) - throw new NullPointerException("system"); - - if (command == null) - throw new NullPointerException("command"); - - synchronized(system) - { - system.connect(); - system.toServer_.writeInt(MEConstants.COMMAND_CALL); - system.toServer_.writeUTF(command); - system.toServer_.flush(); - - // The returnValue indicates either an exception occurred or - // the number of AS400Messages that will be returned. The - // maximum number of messages that will be returned is 10. - int returnValue = system.fromServer_.readInt(); - - if (returnValue == MEConstants.EXCEPTION_OCCURRED) - { - int rc = system.fromServer_.readInt(); - String msg = system.fromServer_.readUTF(); - throw new MEException(msg,rc); - } - else - { - String[] replies = new String[returnValue]; - - // Retrieve the messages. - for (int i=0; iThe following example demonstrates the use of DataQueue: - *
- *
- *   AS400 system = new AS400("mySystem", "myUserid", "myPwd", "myMEServer");
- *   try
- *   {
- *       // Write to the Data Queue.
- *       DataQueue.write(system, "/QSYS.LIB/FRED.LIB/MYDTAQ.DTAQ", "some text");
- *       
- *       // Read from the Data Queue.
- *       String txt = DataQueue.read(system, "/QSYS.LIB/FRED.LIB/MYDTAQ.DTAQ");
- *   }
- *   catch (Exception e)
- *   {
- *       // Handle the exception
- *   }
- *   // Done with the system object.
- *   system.disconnect();
- *  
- * - * @see com.ibm.as400.access.DataQueue - **/ -public final class DataQueue -{ - /** - * Private DataQueue constructor. The methods on DataQueue are static and - * therefore an object does not need to be created, hence the private constructor. - **/ - private DataQueue() - { } - - - /** - * Reads an entry from the data queue. - * - * @param system The system on which the data queue exists. - * @param path The fully qualified integrated file system path name of the data queue. - * - * @return The bytes that were read. If no entries were available, null is returned. - * - * @exception IOException If an error occurs while communicating with the system. - * @exception MEException If an error occurs while processing the ToolboxME request. - **/ - public static byte[] readBytes(AS400 system, String path) throws IOException, MEException - { - - if (system == null) - throw new NullPointerException("system"); - - if (path == null) - throw new NullPointerException("path"); - - synchronized(system) - { - system.connect(); - - system.toServer_.writeInt(MEConstants.DATA_QUEUE_READ); - system.toServer_.writeUTF(path); - system.toServer_.writeInt(MEConstants.DATA_QUEUE_BYTES); - system.toServer_.flush(); - - int status = system.fromServer_.readInt(); - byte[] buffer = null; - - if (status == MEConstants.DATA_QUEUE_ACTION_SUCCESSFUL) - { - buffer = new byte[system.fromServer_.readInt()]; - system.fromServer_.readFully(buffer); - - if (buffer.length == 0) - return null; - } - else if (status == MEConstants.EXCEPTION_OCCURRED) - { - int rc = system.fromServer_.readInt(); - String msg = system.fromServer_.readUTF(); - throw new MEException(msg, rc); - } - - return buffer; - } - } - - - /** - * Reads an entry from the data queue. - * - * @param system The system on which the data queue exists. - * @param path The fully qualified integrated file system path name of the data queue. - * - * @return The entry read from the queue. If no entries were available, null is returned. - * - * @exception IOException If an error occurs while communicating with the system. - * @exception MEException If an error occurs while processing the ToolboxME request. - **/ - public static String readString(AS400 system, String path) throws IOException, MEException - { - if (system == null) - throw new NullPointerException("system"); - - if (path == null) - throw new NullPointerException("path"); - - synchronized(system) - { - system.connect(); - - system.toServer_.writeInt(MEConstants.DATA_QUEUE_READ); - system.toServer_.writeUTF(path); - system.toServer_.writeInt(MEConstants.DATA_QUEUE_STRING); - system.toServer_.flush(); - - int status = system.fromServer_.readInt(); - - String data = null; - - if (status == MEConstants.DATA_QUEUE_ACTION_SUCCESSFUL) - { - data = system.fromServer_.readUTF(); - } - else if (status == MEConstants.EXCEPTION_OCCURRED) - { - int rc = system.fromServer_.readInt(); - String msg = system.fromServer_.readUTF(); - throw new MEException(msg, rc); - } - - if (data.equals("")) - return null; - else - return data; - } - } - - - /** - * Writes an entry to the data queue. - * - * @param system The system on which the data queue exists. - * @param path The fully qualified integrated file system path name of the data queue. - * @param data The string to write to the queue. - * - * @exception IOException If an error occurs while communicating with the system. - * @exception MEException If an error occurs while processing the ToolboxME request. - **/ - public static void write(AS400 system, String path, String data) throws IOException, MEException - { - if (system == null) - throw new NullPointerException("system"); - - if (path == null) - throw new NullPointerException("path"); - - if (data == null) - throw new NullPointerException("data"); - - synchronized(system) - { - system.connect(); - - system.toServer_.writeInt(MEConstants.DATA_QUEUE_WRITE); - system.toServer_.writeUTF(path); - system.toServer_.writeInt(MEConstants.DATA_QUEUE_STRING); - system.toServer_.writeUTF(data); - system.toServer_.flush(); - - int status = system.fromServer_.readInt(); - - if (status == MEConstants.EXCEPTION_OCCURRED) - { - int rc = system.fromServer_.readInt(); - String msg = system.fromServer_.readUTF(); - throw new MEException(msg, rc); - } - } - } - - - /** - * Writes an entry to the data queue. - * - * @param system The system on which the data queue exists. - * @param path The fully qualified integrated file system path name of the data queue. - * @param data The array of bytes to write to the queue. - * - * @exception IOException If an error occurs while communicating with the system. - * @exception MEException If an error occurs while processing the ToolboxME request. - **/ - public static void write(AS400 system, String path, byte[] data) throws IOException, MEException - { - if (system == null) - throw new NullPointerException("system"); - - if (path == null) - throw new NullPointerException("path"); - - if (data == null) - throw new NullPointerException("data"); - - synchronized(system) - { - system.connect(); - - system.toServer_.writeInt(MEConstants.DATA_QUEUE_WRITE); - system.toServer_.writeUTF(path); - system.toServer_.writeInt(MEConstants.DATA_QUEUE_BYTES); - system.toServer_.writeInt(data.length); - system.toServer_.write(data, 0, data.length); - system.toServer_.flush(); - - int status = system.fromServer_.readInt(); - - if (status == MEConstants.EXCEPTION_OCCURRED) - { - int rc = system.fromServer_.readInt(); - String msg = system.fromServer_.readUTF(); - throw new MEException(msg, rc); - } - } - } -} diff --git a/cvsroot/micro/com/ibm/as400/micro/JdbcMeConnection.java b/cvsroot/micro/com/ibm/as400/micro/JdbcMeConnection.java deleted file mode 100644 index 9c0e2085f..000000000 --- a/cvsroot/micro/com/ibm/as400/micro/JdbcMeConnection.java +++ /dev/null @@ -1,625 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JdbcMeConnection.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.sql.*; -import java.util.Map; -import java.io.*; - - -/** - * The JdbcMeConnection class provides a JDBC connection - * to a specific DB2 for IBM i database. Use - * DriverManager.getConnection() to create new JdbcMeConnection objects. - * - *

There are many optional properties that can be specified - * when the connection is created. Properties can be specified either - * as part of the URL or in a java.util.Properties object. See - * JDBC properties - * for a complete list of properties supported by the JdbcMeDriver. - * - *

Note: Since Java 2 Micro-Edition does not include java.sql, - * JdbcMeConnection implements the java.sql package that is also part - * of this driver. - **/ -public class JdbcMeConnection implements java.sql.Connection -{ - // The system object used to athenticate and communicate using this JdbcMeConnection. - AS400 system_; - - int connectionId_ = -1; // The connection - boolean closed_ = true; - boolean autoCommit_ = true; - int isolation_ = TRANSACTION_READ_UNCOMMITTED; - - - /** - * Default JdbcMeConnection constructor. - **/ - private JdbcMeConnection() - { - } - - - /** - * Construct a new JdbcMeConnection using the URL, and system specified. - * This causes an implicit network connection to the database - * if one does not already exist. - * - * @param url The URL for the database. - * @param system The system to connect. - * - * @exception JdbcMeException If the driver is unable to make the connection. - **/ - JdbcMeConnection(String url, AS400 system) throws JdbcMeException - { - /** - * Line flows out: - * Function ID - * JDBC URL (of the form 'url;user=;password=' - * Line flows in: - * Connection Handle ID or -1 and exception data - **/ - system_ = system; - - try - { - system_.toServer_.writeInt(MEConstants.CONN_NEW); - // No object ID written in this case. - system_.toServer_.writeUTF(url); - system_.toServer_.flush(); - - connectionId_ = system_.fromServer_.readInt(); - - if (connectionId_ == -1) - JdbcMeDriver.processException(this); - - closed_ = false; - } - catch (IOException e) - { - // If an IOException occurs, our connection to the database - // has been toasted. Lets reset it. - disconnected(); - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Releases the connection's resources immediately instead of waiting - * for them to be automatically released. This rolls back any active - * transactions, closes all statements that are running in the context - * of the connection, and disconnects from the system. - * - * @exception JdbcMeException If an error occurs. - **/ - public void close() throws JdbcMeException - { - /** - * Line flows out: - * Function ID - * Connection Handle ID - * Line flows in: - * None - **/ - if (!closed_) - { - try - { - system_.toServer_.writeInt(MEConstants.CONN_CLOSE); - system_.toServer_.writeInt(connectionId_); - system_.toServer_.flush(); - } - catch (IOException e) - { - throw new JdbcMeException(e.toString(), null); - } - finally - { - disconnected(); - } - } - return; - } - - /** - * This JdbcMeConnection has been disconnected - * due to a communication failure or close() - * request. - */ - void disconnected() - { - closed_ = true; - connectionId_ = -1; - // TODO: We want to manage multiple JdbcMeConnections - // TODO: over a single network connection. - // TODO: In order to do that, we'll have to synchronize - // TODO: on the network connection when we're - // TODO: doing line flows on behalf of a particular - // TODO: connection, and then NOT close these network - // TODO: objects here. - // TODO: See JdbcMeDriver for details. - try - { - system_.disconnect(); - } - catch (Exception e) - { - } - } - - /** - * Creates a Statement object for executing SQL statements without - * parameters. If the same SQL statement is executed many times, it - * is more efficient to use prepareStatement(). - * - * @return The statement object. - * - * @exception JdbcMeException If the connection is not open, - * the maximum number of statements - * for this connection has been reached, or an - * error occurs. - **/ - public Statement createStatement() throws JdbcMeException - { - /** - * Line flows out: - * Function ID - * Connection Handle ID - * Line flows in: - * Statement handle or -1 and exception info - **/ - try - { - system_.toServer_.writeInt(MEConstants.CONN_CREATE_STATEMENT); - system_.toServer_.writeInt(connectionId_); - system_.toServer_.flush(); - - int statementId = system_.fromServer_.readInt(); - - if (statementId == -1) - JdbcMeDriver.processException(this); - - return new JdbcMeStatement(this, statementId); - } - catch (IOException e) - { - // If an IOException occurs, our connection to the database - // has been toasted. Lets reset it. - disconnected(); - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Create a Statement object that can be used to directly execute SQL. - * - * @param resultSetType The result set type. Valid values are: - *

    - *
  • ResultSet.TYPE_FORWARD_ONLY - *
  • ResultSet.TYPE_SCROLL_INSENSITIVE - *
  • ResultSet.TYPE_SCROLL_SENSITIVE - *
- * @param resultSetConcurrency The result set concurrency. Valid values are: - *
    - *
  • ResultSet.CONCUR_READ_ONLY - *
  • ResultSet.CONCUR_UPDATABLE - *
- * - * @return The statement object. - * - * @exception JdbcMeException If the connection is not open, the maximum number of statements for - * this connection has been reached, the result type or currency is not supported, or an error occurs. - **/ - public Statement createStatement(int resultSetType, int resultSetConcurrency) throws JdbcMeException - { - /** - * NOTE: - * Line flows out: - * Function ID - * Connection Handle ID - * Line flows in: - * Statement handle or -1 and exception info - **/ - try - { - system_.toServer_.writeInt(MEConstants.CONN_CREATE_STATEMENT2); - system_.toServer_.writeInt(connectionId_); - system_.toServer_.writeInt(resultSetType); - system_.toServer_.writeInt(resultSetConcurrency); - system_.toServer_.flush(); - - int statementId = system_.fromServer_.readInt(); - - if (statementId == -1) - JdbcMeDriver.processException(this); - - JdbcMeStatement stmt = new JdbcMeStatement(this, statementId); - stmt.concurrency_ = resultSetConcurrency; - stmt.type_ = resultSetType; - - return stmt; - } - catch (IOException e) - { - // If an IOException occurs, our connection to the database - // has been toasted. Lets reset it. - disconnected(); - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Indicates if the connection is closed. - * - * @exception JdbcMeException If an error occurs. - **/ - public boolean isClosed() throws JdbcMeException - { - return closed_; - } - - /** - * Sets the auto-commit mode. If the connection is in auto-commit mode, then all of its SQL statements are - * executed and committed as individual transactions. Otherwise, its SQL statements are grouped into - * transactions that are terminated by either a commit or rollback. - *

- * By default, the connection is in auto-commit mode. The commit occurs when the statement execution - * completes or the next statement execute occurs, whichever comes first. In the case of statements returning - * a result set, the statement execution completes when the last row of the result set has been retrieved or the - * result set has been closed. In advanced cases, a single statement may return multiple results as well as - * output parameter values. Here the commit occurs when all results and output parameter values have been - * retrieved. - * - * @param autoCommit true to turn on auto-commit mode, false to turn it off. - * - * @exception JdbcMeException If the connection is not open or an error occurs. - **/ - public void setAutoCommit(boolean autoCommit) throws JdbcMeException - { - /** - * Line flows out: - * Function ID - * Connection Handle ID - * Boolean value - * Line flows in: - * 1 - Success - * -1 - failure - * Exception information - **/ - try - { - system_.toServer_.writeInt(MEConstants.CONN_SET_AUTOCOMMIT); - system_.toServer_.writeInt(connectionId_); - system_.toServer_.writeBoolean(autoCommit); - system_.toServer_.flush(); - - int rc = system_.fromServer_.readInt(); - - if (rc == -1) - JdbcMeDriver.processException(this); - - autoCommit_ = autoCommit; - } - catch (IOException e) - { - // If an IOException occurs, our connection to the database - // has been toasted. Lets reset it. - disconnected(); - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Returns the auto-commit state. - * - * @return true if the connection is in auto-commit mode; false otherwise. - * - * @exception JdbcMeException If an error occurs. - **/ - public boolean getAutoCommit() throws JdbcMeException - { - return autoCommit_; - } - - /** - * Commits all changes made since the previous commit or rollback and releases any database locks - * currently held by the connection. This has no effect when the connection is in auto-commit mode. - * - * exception JdbcMeException If the connection is not open or an error occurs. - **/ - public void commit() throws JdbcMeException - { - /** - * Line flows out: - * Function ID - * Connection Handle ID - * Line flows in: - * 1 - Success - * -1 - Failure - * Exception information - **/ - try - { - system_.toServer_.writeInt(MEConstants.CONN_COMMIT); - system_.toServer_.writeInt(connectionId_); - system_.toServer_.flush(); - - int rc = system_.fromServer_.readInt(); - - if (rc == -1) - JdbcMeDriver.processException(this); - } - catch (IOException e) - { - // If an IOException occurs, our connection to the database - // has been toasted. Lets reset it. - disconnected(); - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Drops all changes made since the previous commit or rollback and releases any database locks currently - * held by the connection. This has no effect when the connection is in auto-commit mode. - * - * @exception JdbcMeException If the connection is not open or an error occurs. - **/ - public void rollback() throws JdbcMeException - { - /** - * Line flows out: - * Function ID - * Connection Handle ID - * Line flows in: - * 1 - Success - * -1 - Failure - * Exception information - **/ - try - { - system_.toServer_.writeInt(MEConstants.CONN_ROLLBACK); - system_.toServer_.writeInt(connectionId_); - system_.toServer_.flush(); - - int rc = system_.fromServer_.readInt(); - - if (rc == -1) - JdbcMeDriver.processException(this); - } - catch (IOException e) - { - // If an IOException occurs, our connection to the database - // has been toasted. Lets reset it. - disconnected(); - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Returns the transaction isolation level. - * - * @return The transaction isolation level. Possible values are: - *

    - *
  • TRANSACTION_NONE - *
  • TRANSACTION_READ_UNCOMMITTED - *
  • TRANSACTION_READ_COMMITTED - *
  • TRANSACTION_REPEATABLE_READ - *
- * @exception JdbcMeException If an error occurs. - **/ - public int getTransactionIsolation() throws JdbcMeException - { - return isolation_; - } - - /** - * Sets the transaction isolation level. The transaction isolation level cannot be changed while in the middle of a transaction. - * - *

JDBC and DB2/400 use different terminology for transaction - * isolation levels. The following table provides a terminology mapping: - * - *

- * - * - * - * - * - *
AS/400 isolation levelJDBC transaction isolation level
*CHG TRANSACTION_READ_UNCOMMITTED
*CS TRANSACTION_READ_COMMITTED
*ALL TRANSACTION_READ_REPEATABLE_READ
*RR TRANSACTION_SERIALIZABLE
- * - * @param isolation The transaction isolation level. Possible values are: - *

    - *
  • TRANSACTION_READ_UNCOMMITTED - *
  • TRANSACTION_READ_COMMITTED - *
  • TRANSACTION_REPEATABLE_READ - *
  • TRANSACTION_SERIALIZABLE - *
- * - * @exception JdbcMeException If the connection is not open, the input level is not valid or - * unsupported, or a transaction is active. - **/ - public void setTransactionIsolation(int isolation) throws JdbcMeException - { - /** - * Line flows out: - * Function ID - * Connection Handle ID - * Line flows in: - * 1 - Success - * -1 - Failure - * Exception information - **/ - try - { - system_.toServer_.writeInt(MEConstants.CONN_SET_TRANSACTION_ISOLATION); - system_.toServer_.writeInt(connectionId_); - system_.toServer_.writeInt(isolation_); - system_.toServer_.flush(); - - int rc = system_.fromServer_.readInt(); - - if (rc == -1) - JdbcMeDriver.processException(this); - - isolation_ = isolation; - } - catch (IOException e) - { - // If an IOException occurs, our connection to the database - // has been toasted. Lets reset it. - disconnected(); - throw new JdbcMeException(e.toString(), null); - } - } - - - public void clearWarnings() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public Statement createStatement(int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public String getCatalog() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public int getHoldability() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public DatabaseMetaData getMetaData() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public SQLWarning getWarnings() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public boolean isReadOnly() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public String nativeSQL(String sql) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public CallableStatement prepareCall(String sql) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public PreparedStatement prepareStatement(String sql) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public PreparedStatement prepareStatement(String sql, int[] columnIndexes) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public PreparedStatement prepareStatement(String sql, String[] columnNames) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public void releaseSavepoint(Savepoint savepoint) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public void rollback(Savepoint savepoint) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public void setCatalog(String catalog) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public void setHoldability(int holdability) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public void setReadOnly(boolean readOnly) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public Savepoint setSavepoint() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public Savepoint setSavepoint(String name) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public Map getTypeMap() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public void setTypeMap(Map map) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } -} diff --git a/cvsroot/micro/com/ibm/as400/micro/JdbcMeDriver.java b/cvsroot/micro/com/ibm/as400/micro/JdbcMeDriver.java deleted file mode 100644 index d789ea36b..000000000 --- a/cvsroot/micro/com/ibm/as400/micro/JdbcMeDriver.java +++ /dev/null @@ -1,283 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JdbcMeDriver.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.sql.*; -import java.io.*; - - -/** - * The JdbcMeDriver class is a driver that accesses DB2 for IBM i databases. - * - *

This class registers itself automatically when it is loaded. To use the - * IBM Developer Kit for Java Native JDBC driver, specify the "driver=native" on the url. - * - *

Applications make connection requests to the DriverManager, which dispatches - * them to the appropriate driver. This driver accepts connection requests - * for databases specified by the URLs that match the following syntax: - *

- *  jdbc:as400://system-name/default-schema;meserver=<server>[:port];[other properties];
- *  
- * Additionally, for the JdbcMe driver, if the port is unspecified, the port number 3470 is used. - * - *

The driver uses the specified system name to connect - * to a corresponding system. If a system name is not - * specified, an exception will occur. If a userid or password - * is not specified via the url or by using the getConnection(url, userid, password) - * method, an exception will occur. - * - *

The default schema is optional and the driver uses it to resolve - * unqualified names in SQL statements. If no default schema is set, then - * the driver resolves unqualified names based on the naming convention - * for the connection. If SQL naming is being used, and no default schema - * is set, then the driver resolves unqualified names using the schema with - * the same name as the user. If system naming is being used, and no - * default schema is set, then the driver resolves unqualified names using - * the server job's library list. See JDBC properties - * for more details on how to set the naming convention and library list. - * - *

Several properties can optionally be set within the URL. They are - * separated by semicolons and are in the form: - *

- *  name1=value1;name2=value2;...
- *  
- * See JDBC properties for a complete list of properties supported by this driver. - * - *

The following example URL specifies a connection to the - * database on mysystem.helloworld.com with - * mylibrary as the default schema. The connection will - * use the system naming convention, return full error messages, and - * connect to the system through the specified MEServer myMeServer: - * - *

- *  jdbc:as400://mysystem.helloworld.com/mylibrary;naming=system;errors=full;meserver=myMeServer;
- *  
- * - *

Note: Since Java 2 Micro-Edition does not include java.sql, - * JdbcMeDriver implements the java.sql package that is also part - * of this driver. - * - * @see com.ibm.as400.micro.MEServer - **/ -public class JdbcMeDriver -{ - private static AS400 system_; - - - /** - * Default private constructor. - **/ - private JdbcMeDriver() - { - } - - - /** - * Process an exception line flow from the system - * and throw the resulting SQL exception. - * - * The exception line flow consists of the - * SQL state followed by the SQL message text. - * Throw the resulting SQL exception.* - **/ - static void processException(JdbcMeConnection conn) throws JdbcMeException - { - /** - * Line flows out: - * None - * Line flows in: - * ID indicating an exception (read by caller) - * UTF String for SQL state - * UTF String for SQL message - **/ - try - { - String sqlState = system_.fromServer_.readUTF(); - String message = system_.fromServer_.readUTF(); - - throw new JdbcMeException(message, sqlState); - } - catch (IOException e) - { - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Connects to the database named by the specified URL. - * See - * JDBC properties for a complete list of properties - * supported by this driver. - *

- * Note: The java.sql.DriverManager - * doesn't support drivers other than JdbcMe - * - * @return The connection to the database or null if the driver does not understand how to connect to the database. - * - * @see com.ibm.as400.micro.JdbcMeDriver#getConnection(String, String, String) - * - * @exception JdbcMeException If the driver is unable to make the connection. - **/ - public static java.sql.Connection getConnection(String url) throws JdbcMeException - { - /** - * Using this method as static prevents us from having - * to create more objects. - **/ - return getConnection(url, null, null); - } - - /** - * The JdbcMe driver supports URLs of the following - * form: "jdbc:<subprotocol>:<target-db-specification>;meserver=<server>[:port]" - * The subprotocol and target-db-specification is specified - * as required by the target JDBC driver being used on the - * JdbcMe host server. - *

- * Additionally, for the JdbcMe driver, if the port is - * unspecified, the port number 3470 is used. - *

- * The meserver property is used to find the MEServer. - * All other values/properties are - * passed through to the Jdbc driver used by the target MEServer. - *

- * Note: The java.sql.DriverManager doesn't support drivers other than JdbcMe. - * - * @param url The URL for the database. - * @param user The user on whose behalf the connection is being made. - * @param password The user's password. - * - * @exception JdbcMeException If the driver is unable to make the connection. - **/ - public static java.sql.Connection getConnection(String url, String user, String password) throws JdbcMeException - { - /** - * Using this method as static prevents us from having - * to create more objects. - **/ - if (url == null) - throw new NullPointerException("url"); - - String meServer = null; - int i, k; - - i = url.indexOf(";meserver="); - if (i == -1) - throw new JdbcMeException("Invalid URL, no meserver property: " + url, null); - - String remoteUrl = url.substring(0, i); - - // Start after the first semi-colon and search for the next semi-colon - for (k=i+10; k= url.length()) - { - meServer = url.substring(i+10); - } - else - { - // There are more properties after the host:port - meServer = url.substring(i+10, k); - // Add the rest (including the semi-colon) to the original string. - remoteUrl += url.substring(k); - } - - // This data gets sent to the system in the JDBC URL - // for each DB connection attempt unless it is - // already specified in the URL. - int index = url.indexOf("user="); - String b; - String uid = null; - String pwd = null; - - if (index == -1) - { - if (user != null) - { - remoteUrl += ";user=" + user; - uid = user; - } - else - throw new NullPointerException("user parameter or url property"); - } - else - { - b = url.substring(index); - index = b.indexOf(";"); - if (index == -1) - uid = b.substring(5); - else - uid = b.substring(5, index); - - } - - index = url.indexOf("password="); - - if (index == -1) - { - if (password != null) - { - remoteUrl += ";password=" + password; - pwd = password; - } - else - throw new NullPointerException("password parameter or url property"); - } - else - { - b = url.substring(index); - index = b.indexOf(";"); - if (index == -1) - pwd = b.substring(9); - else - pwd = b.substring(9, index); - } - - try - { - String systemName; - String begin = url.substring(0, url.indexOf(";")); - String system = begin.substring(begin.indexOf("//")+2); - - int n = system.indexOf("/"); - if (n != -1) - systemName = system.substring(0, n); - else - systemName = system; - - system_ = new AS400(systemName, uid, pwd, meServer); - system_.connect(); - } - catch (Exception e) - { - try - { - system_.disconnect(); - } - catch (Exception ex) - { - } - throw new JdbcMeException(e.toString(), null); - } - - return new JdbcMeConnection(remoteUrl, system_); - } -} diff --git a/cvsroot/micro/com/ibm/as400/micro/JdbcMeException.java b/cvsroot/micro/com/ibm/as400/micro/JdbcMeException.java deleted file mode 100644 index 4a470077f..000000000 --- a/cvsroot/micro/com/ibm/as400/micro/JdbcMeException.java +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JdbcMeException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.sql.*; - -/** - * JdbcMeException extends the java.sql.SQLException - * class as provided for a Java 2 Micro-Edition device. - * - *

Note: Since Java 2 Micro-Edition does not include java.sql, - * the java.sql package is also part of this driver. - **/ -public class JdbcMeException extends SQLException -{ - - /** - * Constructs a fully-specified JdbcMeException object. - **/ - private JdbcMeException() - { - super(); - } - - /** - * Constructs an JdbcMeException object with a reason and SQLState. - * - * @param reason a description of the exception. - * @param sqlState an XOPEN code identifying the exception. - **/ - public JdbcMeException(String reason, String sqlState) - { - super(reason, sqlState); - } - - - /** - * Returns the string representation of this exception. - * - * @return the exception string. - **/ - public String toString() - { - return "JdbcMeException: " + super.toString(); - } -} diff --git a/cvsroot/micro/com/ibm/as400/micro/JdbcMeLiveResultSet.java b/cvsroot/micro/com/ibm/as400/micro/JdbcMeLiveResultSet.java deleted file mode 100644 index 7f71dba14..000000000 --- a/cvsroot/micro/com/ibm/as400/micro/JdbcMeLiveResultSet.java +++ /dev/null @@ -1,1561 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JdbcMeLiveResultSet.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.sql.*; -import java.util.Calendar; -import java.util.Map; -import java.io.*; -import java.math.BigDecimal; -import java.net.URL; - -/** - * The JdbcMeLiveResultSet class provides access to a table - * of data generated by a database query. - * - *

A result set maintains a cursor pointing to its current - * row of data. Initially, the cursor is positioned before the - * first row. If the result set is scrollable, use any of the - * cursor positioning methods to move the cursor within the result - * set. If the result set is not scrollable, then only use next() - * to move the cursor. - * - *

The get methods retrieve column values for the current row. - * Values can be retrieved using either the column index or the - * column name. In general, using the column index is more efficient. - * Column indexes are numbered starting with 1. Column names are - * not case sensitive. If several columns have the same name, - * then the first matching column is used. - * - *

Columns can have two names: a column name ("long name") - * and a system column name ("short name"). The get methods and - * findColumn() only support using the column name. - * - *

In each get method, the driver attempts to convert the - * underlying data to the specified Java type and returns a - * suitable Java value. If such a conversion is not appropriate, - * a JdbcMeException is thrown. - * - *

If the result set is updatable, the update methods modify - * column values for the current row in the result set, but not in the underlying - * database. updateRow() causes all updates to the current row - * to be written to the database. Use deleteRow() to delete the - * current row in the database. - * - *

For updatable result sets, there is also an insert row, - * which is used as a staging area for the contents of a new row. - * Use moveToInsertRow() to position the cursor to the insert row. - * Once all updates to the insert row have been made, use insertRow() - * to insert the row into the database. - * - *

In the following cases, result sets are always read only - * regardless of the concurrency set in the statement: - *

    - *
  • Stored procedure calls - *
  • DatabaseMetaData catalog methods - *
  • SELECT statements which do not specify FOR UPDATE. This - * is only applicable when running to V4R5 or earlier. - *
- * - *

In the following cases, result sets are always forward only - * regardless of the type set in the statement: - *

    - *
  • Stored procedure calls - *
- * - *

A result set is automatically closed by the statement that - * generated it when the statement is closed, run again, or used - * to retrieve the next result set from a sequence of multiple - * result sets. To close the result set explicitly, call the - * close() method. - * - *

Note: Since Java 2 Micro-Edition does not include java.sql, - * JdbcMeLiveResultSet implements the java.sql package that is also part - * of this driver. - **/ -public class JdbcMeLiveResultSet implements ResultSet -{ - private JdbcMeConnection connection_ = null; - private JdbcMeStatement stmt_ = null; - private int rsId_ = -1; - private byte onWhichRow_ = ROW_CURRENT; - private Object currentRow_[] = null; - private Object modifiedRowBuffer_[] = null; - - public final static byte ROW_CURRENT = 0; - public final static byte ROW_INSERT = 1; - public final static byte ROW_UPDATE = 2; - - /** - * Construct the default JdbcMeLiveResultSet. - **/ - private JdbcMeLiveResultSet() - { - } - - - /** - * Construct a JdbcMeLiveResultSet for a statement. - * - * @param stmt The SQL statement. - * @param rsId The result set ID handle. - * - * @exception JdbcMeResultSet If an error occurs - **/ - JdbcMeLiveResultSet(JdbcMeStatement stmt, int rsId) throws JdbcMeException - { - /** - * Line flows out: - * None - * Line flows in: - * None - **/ - rsId_ = rsId; - stmt_ = stmt; - connection_ = stmt.connection_; - } - - /** - * Releases the result set's resources. - * - * @exception JdbcMeException If an error occurs. - **/ - public void close() throws JdbcMeException - { - /** - * Line flows out: - * Function ID - * Result set handle ID - * Line flows in: - * None - **/ - try - { - connection_.system_.toServer_.writeInt(MEConstants.RS_CLOSE); - connection_.system_.toServer_.writeInt(rsId_); - connection_.system_.toServer_.flush(); - - // Don't wait for ack from system. - closeHard(); - return; - } - catch (IOException e) - { - // If an IOException occurs, our connection to the database - // has been toasted. Lets reset it. - connection_.disconnected(); - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Force the result set closed. - **/ - void closeHard() - { - /** - * Line flows out: - * None - * Line flows in: - * None - **/ - rsId_ = -1; - stmt_ = null; - currentRow_ = null; - modifiedRowBuffer_ = null; - return; - } - - /** - * Deletes the current row from the result set and the database. - * After deleting a row, the cursor position is no longer valid, - * so it must be explicitly repositioned. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the cursor is positioned on the insert row, - * or an error occurs. - **/ - public void deleteRow() throws JdbcMeException - { - /** - * Line flows out: - * Function ID - * Result set handle ID - * Line flows in: - * 0 success - * -1 and exception information - **/ - try - { - connection_.system_.toServer_.writeInt(MEConstants.RS_DELETE_ROW); - connection_.system_.toServer_.writeInt(rsId_); - connection_.system_.toServer_.flush(); - - int results = connection_.system_.fromServer_.readInt(); - - if (results == -1) - JdbcMeDriver.processException(connection_); - } - catch (IOException e) - { - // If an IOException occurs, our connection to the database - // has been toasted. Lets reset it. - connection_.disconnected(); - throw new JdbcMeException(e.toString(), null); - } - return; - } - - - /** - * Returns the value of a column as a String object. - * This can be used to get values from columns with any SQL type. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception JdbcMeException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public String getString(int columnIndex) throws JdbcMeException - { - if (currentRow_ == null) - throw new JdbcMeException("RS Position", null); - - if (columnIndex < 1 || columnIndex > currentRow_.length) - throw new JdbcMeException("RS Column " + columnIndex, null); - - if(onWhichRow_ == ROW_INSERT) return modifiedRowBuffer_[columnIndex-1].toString(); //@A1A We want to get the values for the row we are inserting, not the value for the row the system cursor is on - else return currentRow_[columnIndex-1].toString(); - } - - /** - * Returns the value of a column as a Java int value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or 0 if the value is SQL NULL. - * - * @exception JdbcMeException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public int getInt(int columnIndex) throws JdbcMeException - { - if (currentRow_ == null) - throw new JdbcMeException("RS Position", null); - - if (columnIndex < 1 || columnIndex > currentRow_.length) - throw new JdbcMeException("RS Column " + columnIndex, null); - - if(onWhichRow_ == ROW_INSERT) //@A1A We want to get the values for the row we are inserting, not the value for the row the system cursor is on - { - if(stmt_.columnTypes_[columnIndex-1] == Types.INTEGER){ //@A1A - return ((Integer)modifiedRowBuffer_[columnIndex-1]).intValue(); //@A1A - } - else return Integer.parseInt(modifiedRowBuffer_[columnIndex-1].toString()); //@A1A - } - - // Optimize the getInt() of an Integer column - if (stmt_.columnTypes_[columnIndex-1] == Types.INTEGER) - return((Integer)currentRow_[columnIndex-1]).intValue(); - - // Else, attempt to convert existing string or object - // to an integer polymorphically. - return Integer.parseInt(currentRow_[columnIndex-1].toString()); - } - - /** - * Inserts the contents of the insert row into the result set - * and the database. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on the insert row, - * a column that is not nullable was not specified, - * or an error occurs. - **/ - public void insertRow() throws JdbcMeException - { - insertOrUpdateRow(MEConstants.RS_INSERT_ROW); - } - - /** - * Positions the cursor to the insert row. - * If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not scrollable, - * the result set is not updatable, - * or an error occurs. - **/ - public void moveToInsertRow() throws JdbcMeException - { - if (modifiedRowBuffer_ == null || modifiedRowBuffer_.length != stmt_.numColumns_) - { - modifiedRowBuffer_ = new Object[stmt_.numColumns_]; - } - else - { - if (onWhichRow_ != ROW_INSERT) - { - for (int i=0; iIf an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not scrollable, - * or an error occurs. - **/ - public void moveToCurrentRow() throws JdbcMeException - { - if (currentRow_ == null || currentRow_.length != stmt_.numColumns_) - currentRow_ = new Object[stmt_.numColumns_]; - - onWhichRow_ = ROW_CURRENT; - return; - } - - /** - * Read a single row of data resulting from a positioning method. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not scrollable, - * or an error occurs. - **/ - private void readRow() throws IOException - { - /** - * Line flow in: - * For a row, the data follows - * A value for each column - * Integer for INT columns - * String for all others - **/ - if (currentRow_ == null || currentRow_.length != stmt_.numColumns_) - currentRow_ = new Object[stmt_.numColumns_]; - - for (int i=0; iAttempting to move beyond the first row positions the - * cursor before the first row. Attempting to move beyond the last - * row positions the cursor after the last row. - * - *

If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @param rowNumber The relative row number. If the relative row - * number is positive, this positions the cursor - * after the current position. If the relative - * row number is negative, this positions the - * cursor before the current position. If the - * relative row number is 0, then the cursor - * position does not change. - * - * @return true if the requested cursor position is valid, false otherwise. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not scrollable, - * the cursor is not positioned on a valid row, - * or an error occurs. - **/ - public boolean relative(int rowNumber) throws JdbcMeException - { - return positioningMethod(MEConstants.RS_RELATIVE, rowNumber); - } - - - /** - * Positions the cursor to the first row. - * If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @return true if the requested cursor position is - * valid; false otherwise. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not scrollable, - * or an error occurs. - **/ - public boolean first() throws JdbcMeException - { - return positioningMethod(MEConstants.RS_FIRST, -1); - } - - /** - * Positions the cursor to the last row. - * If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @return true if the requested cursor position is - * valid; false otherwise. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not scrollable, - * or an error occurs. - **/ - public boolean last() throws JdbcMeException - { - return positioningMethod(MEConstants.RS_LAST, -1); - } - - /** - * Positions the cursor to an absolute row number. - * - *

Attempting to move any number of positions before - * the first row positions the cursor to before the first row. - * Attempting to move beyond the last - * row positions the cursor after the last row. - * - *

If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @param rowNumber The absolute row number. If the absolute row - * number is positive, this positions the cursor - * with respect to the beginning of the result set. - * If the absolute row number is negative, this - * positions the cursor with respect to the end - * of result set. - * - * @return true if the requested cursor position is - * valid; false otherwise. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not scrollable, - * the row number is 0, - * or an error occurs. - **/ - public boolean absolute(int rowNumber) throws JdbcMeException - { - return positioningMethod(MEConstants.RS_ABSOLUTE, rowNumber); - } - - /** - * The previous() and next() methods both have the - * same line flows. - * This function implements them. - * - **/ - private boolean positioningMethod(int what, int parameter) throws JdbcMeException - { - /** - * Line flows out - * Function ID - * Result set handle ID - * Optional positioning parameter - * Line flows in: - * -1 and exception data - * OR - * 0 indicating no row to be positioned at - * OR - * 1 indicating positioned on a row, data follows - * Value for each column - * Integer for INT columns - * String for all others - **/ - try - { - onWhichRow_ = ROW_CURRENT; - connection_.system_.toServer_.writeInt(what); - connection_.system_.toServer_.writeInt(rsId_); - - if (parameter != -1) - connection_.system_.toServer_.writeInt(parameter); - - connection_.system_.toServer_.flush(); - int moreData = connection_.system_.fromServer_.readInt(); - - if (moreData == -1) - JdbcMeDriver.processException(connection_); - - if (moreData == 0) - return false; - - readRow(); - return true; - } - catch (IOException e) - { - // If an IOException occurs, our connection to the database - // has been toasted. Lets reset it. - connection_.disconnected(); - throw new JdbcMeException(e.toString(), null); - } - } - - - /** - * Updates a column in the current row using a String value. - * The driver converts this to an SQL VARCHAR value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param value The column value or null to update - * the value to SQL NULL. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, - * or the requested conversion is not valid. - **/ - public void updateString(int columnIndex, String value) throws JdbcMeException - { - if (stmt_.getResultSetConcurrency() != ResultSet.CONCUR_UPDATABLE) //A1C changed to call getResultSetConcurrency(); - throw new JdbcMeException("Cursor state invalid", null); - - if (currentRow_ == null || currentRow_.length != stmt_.numColumns_) - currentRow_ = new Object[stmt_.numColumns_]; - - if (modifiedRowBuffer_ == null || modifiedRowBuffer_.length != currentRow_.length) - modifiedRowBuffer_ = new Object[currentRow_.length]; - - //@A1C changed to ROW_INSERT from ROW_UPDATE. If we are inserting a new row, we do not want to copy the data - //from the current row on the system to it. - if(onWhichRow_ != ROW_INSERT) { //@A1A - System.arraycopy(currentRow_, 0, modifiedRowBuffer_, 0, currentRow_.length); //@A1A - onWhichRow_ = ROW_UPDATE; //@A1A we are updating a current row in the result set, not inserting a new row - currentRow_[columnIndex-1] = value; //@A1A set to new value so when a getXxx is called we can retrieve the new value - } - - if (columnIndex < 1 || columnIndex > modifiedRowBuffer_.length) - throw new JdbcMeException("RS Column " + columnIndex, null); - - switch (stmt_.columnTypes_[columnIndex-1]) - { - case Types.CHAR: // same as varchar - case Types.VARCHAR: - modifiedRowBuffer_[columnIndex-1] = value; - break; - case Types.INTEGER: - modifiedRowBuffer_[columnIndex-1] = new Integer(Integer.parseInt(value)); - break; - default : - // The database sends a string for every value - // other than the ones handled explicitly above. - modifiedRowBuffer_[columnIndex-1] = value; - } - return; - } - - /** - * Updates a column in the current row using a Java int value. - * The driver converts this to an SQL INTEGER value. - * - *

This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param value The column value. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateInt(int columnIndex, int value) throws JdbcMeException - { - if (stmt_.getResultSetConcurrency() != ResultSet.CONCUR_UPDATABLE) //@A1C Changed to getResultSetConcurrency - throw new JdbcMeException("Cursor state invalid", null); - - if (currentRow_ == null || currentRow_.length != stmt_.numColumns_) //@A1A Be consistent with updateString() - currentRow_ = new Object[stmt_.numColumns_]; //@A1A - - if (modifiedRowBuffer_ == null || modifiedRowBuffer_.length != currentRow_.length) - modifiedRowBuffer_ = new Object[currentRow_.length]; - - //@A1C changed to ROW_INSERT from ROW_UPDATE. If we are inserting a new row, we do not want to copy the data - //from the current row on the system to it. - if (onWhichRow_ != ROW_INSERT) //@A1C - { - System.arraycopy(currentRow_, 0, modifiedRowBuffer_, 0, currentRow_.length); - onWhichRow_ = ROW_UPDATE; //We are updating a current row in the result set, not inserting a new row - currentRow_[columnIndex-1] = new Integer(value); //@A1A Want to set the current rows value to the new value - } - - if (columnIndex < 1 || columnIndex > modifiedRowBuffer_.length) - throw new JdbcMeException("RS Column " + columnIndex, null); - - switch (stmt_.columnTypes_[columnIndex-1]) - { - case Types.CHAR: // same as varchar - case Types.VARCHAR: - modifiedRowBuffer_[columnIndex-1] = Integer.toString(value); - break; - case Types.INTEGER: - modifiedRowBuffer_[columnIndex-1] = new Integer(value); - break; - default : - // The database sends a string for every value - // other than the ones handled explicitly above. - modifiedRowBuffer_[columnIndex-1] = Integer.toString(value); - } - return; - } - - /** - * Updates the database with the new contents of the current row. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the cursor is positioned on the insert row, - * or an error occurs. - **/ - public void updateRow() throws JdbcMeException - { - insertOrUpdateRow(MEConstants.RS_UPDATE_ROW); - } - - /** - * Returns the ResultSetMetaData object that describes the result set's columns. - * - * @return The metadata object. - * - * @exception JdbcMeException If an error occurs. - **/ - public ResultSetMetaData getMetaData() throws JdbcMeException - { - // The statement object records meta data about - // this result set. - return new JdbcMeResultSetMetaData(stmt_.numColumns_, stmt_.columnTypes_); - } - - /** - * Returns the statement for this result set. - * - * @return The statement for this result set, or null if the - * result set was returned by a DatabaseMetaData - * catalog method. - * - * @exception JdbcMeException If an error occurs. - **/ - public Statement getStatement() throws JdbcMeException - { - return stmt_; - } - - /** - * Perform an insert or update row. - * - * @exception JdbcMeException if an error occurs. - **/ - private void insertOrUpdateRow(int which) throws JdbcMeException - { - /** - * Line flows out - * Function ID - * Result set handle ID - * Line flows in - * -1 and exception data - * OR - * 0 indicating the row was inserted/updated - **/ - try - { - int mustBeOnRow = ROW_INSERT; - - if (which == MEConstants.RS_UPDATE_ROW) - mustBeOnRow = ROW_UPDATE; - - if (modifiedRowBuffer_ == null || !(onWhichRow_ == mustBeOnRow)) - throw new IllegalArgumentException("RS no in/upd row"); - - for (int i=0; i - *

  • TYPE_FORWARD_ONLY - *
  • TYPE_SCROLL_INSENSITIVE - *
  • TYPE_SCROLL_SENSITIVE - * - * - * @exception JdbcMeException If the result set is not open. - **/ - public int getType() throws JdbcMeException - { - return stmt_.type_; - } - - /** - * Returns the result set concurrency. - * - * @return The result set concurrency. Valid values are: - *
      - *
    • CONCUR_READ_ONLY - *
    • CONCUR_UPDATABLE - *
    - * - * @exception JdbcMeException If the result set is not open. - **/ - public int getConcurrency() throws JdbcMeException - { - return stmt_.concurrency_; - } - - - public void afterLast() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public void beforeFirst() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void cancelRowUpdates() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void clearWarnings() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public int findColumn(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public Array getArray(int i) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public Array getArray(String colName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public InputStream getAsciiStream(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public InputStream getAsciiStream(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public BigDecimal getBigDecimal(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public BigDecimal getBigDecimal(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public BigDecimal getBigDecimal(int columnIndex, int scale) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public BigDecimal getBigDecimal(String columnName, int scale) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public InputStream getBinaryStream(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public InputStream getBinaryStream(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Blob getBlob(int i) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Blob getBlob(String colName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public boolean getBoolean(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public boolean getBoolean(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public byte getByte(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public byte getByte(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public byte[] getBytes(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public byte[] getBytes(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Reader getCharacterStream(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Reader getCharacterStream(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Clob getClob(int i) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Clob getClob(String colName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public String getCursorName() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Date getDate(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Date getDate(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Date getDate(int columnIndex, Calendar cal) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Date getDate(String columnName, Calendar cal) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public double getDouble(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public double getDouble(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public int getFetchDirection() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public int getFetchSize() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public float getFloat(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public float getFloat(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public int getInt(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public long getLong(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public long getLong(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Object getObject(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Object getObject(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Object getObject(int i, Map map) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Object getObject(String colName, Map map) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Ref getRef(int i) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Ref getRef(String colName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public int getRow() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public short getShort(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public short getShort(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public String getString(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Time getTime(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Time getTime(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Time getTime(int columnIndex, Calendar cal) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Time getTime(String columnName, Calendar cal) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Timestamp getTimestamp(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Timestamp getTimestamp(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Timestamp getTimestamp(int columnIndex, Calendar cal) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public Timestamp getTimestamp(String columnName, Calendar cal) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public URL getURL(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public URL getURL(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public InputStream getUnicodeStream(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public InputStream getUnicodeStream(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public SQLWarning getWarnings() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public boolean isAfterLast() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public boolean isBeforeFirst() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public boolean isFirst() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public boolean isLast() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void refreshRow() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public boolean rowDeleted() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public boolean rowInserted() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public boolean rowUpdated() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void setFetchDirection(int direction) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void setFetchSize(int rows) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateArray(int columnIndex, Array x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateArray(String columnName, Array x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateAsciiStream(int columnIndex, InputStream x, int length) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateAsciiStream(String columnName, InputStream x, int length) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateBigDecimal(int columnIndex, BigDecimal x) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateBigDecimal(String columnName, BigDecimal x) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateBinaryStream(int columnIndex, InputStream x, int length) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateBinaryStream(String columnName, InputStream x, int length) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateBlob(int columnIndex, Blob x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateBlob(String columnName, Blob x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateBoolean(int columnIndex, boolean x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateBoolean(String columnName, boolean x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateByte(int columnIndex, byte x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateByte(String columnName, byte x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateBytes(int columnIndex, byte[] x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateBytes(String columnName, byte[] x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateCharacterStream(int columnIndex, Reader x, int length) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateCharacterStream(String columnName, Reader reader, - int length) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateClob(int columnIndex, Clob x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateClob(String columnName, Clob x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateDate(int columnIndex, Date x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateDate(String columnName, Date x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateDouble(int columnIndex, double x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateDouble(String columnName, double x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateFloat(int columnIndex, float x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateFloat(String columnName, float x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateInt(String columnName, int x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateLong(int columnIndex, long x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateLong(String columnName, long x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateNull(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateNull(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateObject(int columnIndex, Object x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateObject(String columnName, Object x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateObject(int columnIndex, Object x, int scale) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateObject(String columnName, Object x, int scale) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateRef(int columnIndex, Ref x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateRef(String columnName, Ref x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateShort(int columnIndex, short x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateShort(String columnName, short x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateString(String columnName, String x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateTime(int columnIndex, Time x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateTime(String columnName, Time x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateTimestamp(int columnIndex, Timestamp x) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public void updateTimestamp(String columnName, Timestamp x) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - - public boolean wasNull() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } -} diff --git a/cvsroot/micro/com/ibm/as400/micro/JdbcMeOfflineData.java b/cvsroot/micro/com/ibm/as400/micro/JdbcMeOfflineData.java deleted file mode 100644 index 587459f15..000000000 --- a/cvsroot/micro/com/ibm/as400/micro/JdbcMeOfflineData.java +++ /dev/null @@ -1,207 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JdbcMeOfflineData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import javax.microedition.rms.*; -import com.sun.kjava.Database; -import java.sql.*; - -/** - * An offline data repository that represents a - * a data store that is generic, regardless of - * J2ME profile and JVM details. - *

    - * Note that the index of the first record in a - * JdbcMeOfflineData object is 0, not 1 as in the MIDP - * implementation of RecordStore. - *

    - * For example.

    - *  MIDP - The 'name' is a unique string of up to 32
    - *         unique characters identifying a
    - *         javax.microedition.rms.RecordStore object
    - *         the offline data object returned, then
    - *         encapsulates the RecordStore object.
    - * 
    - *  PALM - The 'name' is effectively just a visual
    - *         key, while the offline data is uniquely
    - *         identified by the 'dbCreator' and the
    - *         'dbType' parameters.
    - *  
    - **/ -abstract public class JdbcMeOfflineData -{ - private final static int J2ME_UNKNOWN = 0; - private final static int J2ME_PALM = 1; - private final static int J2ME_MIDP = 2; - - private static int whichProfile_ = J2ME_UNKNOWN; - - static - { - try - { - Class.forName("javax.microedition.rms.RecordStore"); - whichProfile_ = J2ME_MIDP; - } - catch (ClassNotFoundException e) - { - // Not MIDP - - // If both profiles are loaded on the device, the whichProfile_ variable - // would always point to the PALM, which might cause problems when - // performing database actions. So only try to load the kjava.Database - // if the rms.RecordStore failed. - try - { - Class.forName("com.sun.kjava.Database"); - whichProfile_ = J2ME_PALM; - } - catch (ClassNotFoundException e2) - { - // Not Palm - } - } - } - - - /** - * Create an offline data repository, destroying the current one if it exists. - * - * @param name The name of the offline database. - * @param dbCreator The unique offline database creator identifier. - * @param dbType The unique offline database type identifier. - * - * @return The specific JdbcMeOffline implementation. - * - * @exception JdbcMeException If an error occurs. - **/ - public static JdbcMeOfflineData create(String name, int dbCreator, int dbType) throws JdbcMeException - { - try - { - switch (whichProfile_) - { - case J2ME_PALM: - return JdbcMeOfflinePalmData.create(name, dbCreator, dbType); - case J2ME_MIDP: - return JdbcMeOfflineMidpData.create(name, dbCreator, dbType); - } - } - catch (JdbcMeException e) - { - throw e; - } - - throw new JdbcMeException("Unsupported J2ME profile(" + whichProfile_ + ")", null); - } - - - /** - * Open or create an offline data repository - * Various parameters in this method are used or - * ignored depending on which J2ME profile - * is currently being used by this implementation. - * - * @param name The name of the offline database. - * @param dbCreator The unique offline database creator identifier. - * @param dbType The unique offline database type identifier. - * @param createIfNecessary Create the database if one has not already been created. - * - * @return The specific JdbcMeOfflineData implementation. - * - * @exception JdbcMeException If an error occurs. - **/ - public static JdbcMeOfflineData open(String name, int dbCreator, int dbType, boolean createIfNecessary) throws JdbcMeException - { - try - { - switch (whichProfile_) - { - case J2ME_PALM: - return new JdbcMeOfflinePalmData(name, dbCreator, dbType, createIfNecessary); - case J2ME_MIDP: - return new JdbcMeOfflineMidpData(name, dbCreator, dbType, createIfNecessary); - } - } - catch (JdbcMeException e) - { - throw e; - } - - throw new JdbcMeException("Unsupported J2ME profile (" + whichProfile_ + ")", null); - } - - - /** - * Get a record from the offline data store. - * - * @param index The record to return. The first record is record 0. - * The last record is this.size()-1; - * - * @return The record. - * - * @exception JdbcMeException If an error occurs. - **/ - abstract public byte[] getRecord(int index) throws JdbcMeException; - - /** - * Get the current number of records in the offline - * data store. - * - * @return The number of records. - * - * @exception JdbcMeException If an error occurs. - **/ - abstract public int size() throws JdbcMeException; - - /** - * Add a record to the offline data store from the - * specified bytes of the byte array. The record - * is added at the end of the data store. - * - * @param rec The byte data. - * @param offset The offset into the data. - * @param length The length of the data. - * - * @exception JdbcMeException If an error occurs. - **/ - abstract public void addRecord(byte rec[], int offset, int length) throws JdbcMeException; - - /** - * Set the record content to the specified bytes from the byte array. - * - * @param index The record to set. The first record is record 0. The last record is this.size()-1; - * @param rec The byte data. - * @param offset The offset into the data. - * @param length The length of the data. - * - * @exception JdbcMeException If an error occurs. - **/ - abstract public void setRecord(int index, byte rec[], int offset, int length) throws JdbcMeException; - - /** - * Delete the record specified from the offline data store. - * - * @param index The record to delete. The first record is record 0. The last record is this.size()-1; - * - * @exception JdbcMeException If an error occurs. - **/ - abstract public void deleteRecord(int index) throws JdbcMeException; - - /** - * Close the offline data store, releasing resources - * required by the platform specific data store. - **/ - abstract public void close(); -} diff --git a/cvsroot/micro/com/ibm/as400/micro/JdbcMeOfflineMidpData.java b/cvsroot/micro/com/ibm/as400/micro/JdbcMeOfflineMidpData.java deleted file mode 100644 index e705942c3..000000000 --- a/cvsroot/micro/com/ibm/as400/micro/JdbcMeOfflineMidpData.java +++ /dev/null @@ -1,194 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JdbcMeOfflineMidpData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import javax.microedition.rms.*; -import com.sun.kjava.Database; -import java.sql.*; - -/** - * The offline data representation on a MIDP profile. - **/ -class JdbcMeOfflineMidpData extends JdbcMeOfflineData -{ - private RecordStore DB_; - - JdbcMeOfflineMidpData(String name, int dbCreator, int dbType, boolean createIfNecessary) throws JdbcMeException - { - try - { - DB_ = RecordStore.openRecordStore(name, createIfNecessary); - // Must throw an exception on filed to open. - if (DB_ == null) - throw new JdbcMeException("Not open " + name + "createIfNecessary=" + createIfNecessary, null); - } - catch (Exception e) - { - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Create an offline data repository, destroying the current one if it exists. - * - * @param dbName The name of the offline database. - * @param dbCreator The unique offline database creator identifier. - * @param dbType The unique offline database type identifier. - * - * @exception JdbcMeException If an error occurs. - **/ - public static JdbcMeOfflineData create(String name, int dbCreator, int dbType) throws JdbcMeException - { - try - { - try - { - RecordStore.deleteRecordStore(name); - } - catch (RecordStoreNotFoundException ex) - { } - - return new JdbcMeOfflineMidpData(name, dbCreator, dbType, true); - } - catch (Exception e) - { - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Get a record from the offline data store. - * - * @param index The record to return. The first record is record 0. - * The last record is this.size()-1; - * - * @return The record. - * - * @exception JdbcMeException If an error occurs. - **/ - public byte[] getRecord(int index) throws JdbcMeException - { - try - { - // javax.microedition.rms.RecordStore first index is 1, not 0. - return DB_.getRecord(index+1); - } - catch (Exception e) - { - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Get the current number of records in the offline - * data store. - * - * @return The number of records. - * - * @exception JdbcMeException If an error occurs. - **/ - public int size() throws JdbcMeException - { - try - { - return DB_.getNumRecords(); - } - catch (Exception e) - { - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Add a record to the offline data store from the - * specified bytes of the byte array. The record - * is added at the end of the data store. - * - * @param rec The byte data. - * @param offset The offset into the data. - * @param length The length of the data. - * - * @exception JdbcMeException If an error occurs. - **/ - public void addRecord(byte rec[], int offset, int length) throws JdbcMeException - { - try - { - DB_.addRecord(rec, offset, length); - } - catch (Exception e) - { - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Set the record content to the specified bytes from the byte array. - * - * @param index The record to set. The first record is record 0. The last record is this.size()-1; - * @param rec The byte data. - * @param offset The offset into the data. - * @param length The length of the data. - * - * @exception JdbcMeException If an error occurs. - **/ - public void setRecord(int index, byte rec[], int offset, int length) throws JdbcMeException - { - try - { - // javax.microedition.rms.RecordStore first index is 1, not 0. - DB_.setRecord(index+1, rec, offset, length); - } - catch (Exception e) - { - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Delete the record specified from the offline data store. - * - * @param index The record to delete. The first record is record 0. The last record is this.size()-1; - * - * @exception JdbcMeException If an error occurs. - **/ - public void deleteRecord(int index) throws JdbcMeException - { - try - { - // javax.microedition.rms.RecordStore first index is 1, not 0. - DB_.deleteRecord(index+1); - } - catch (Exception e) - { - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Close the offline data store, releasing resources - * required by the platform specific data store. - **/ - public void close() - { - try - { - DB_.closeRecordStore(); - } - catch (Exception e) - { - // ignore. - } - } -} diff --git a/cvsroot/micro/com/ibm/as400/micro/JdbcMeOfflinePalmData.java b/cvsroot/micro/com/ibm/as400/micro/JdbcMeOfflinePalmData.java deleted file mode 100644 index ff205a0dd..000000000 --- a/cvsroot/micro/com/ibm/as400/micro/JdbcMeOfflinePalmData.java +++ /dev/null @@ -1,214 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JdbcMeOfflinePalmData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import javax.microedition.rms.*; -import com.sun.kjava.Database; -import java.sql.*; - -/** - * The offline data representation on a Palm. - **/ -class JdbcMeOfflinePalmData extends JdbcMeOfflineData -{ - private Database DB_ = null; - - JdbcMeOfflinePalmData(String name, int dbCreator, int dbType, boolean createIfNecessary) throws JdbcMeException - { - DB_ = new com.sun.kjava.Database(dbType, dbCreator, com.sun.kjava.Database.READWRITE); - - if (!DB_.isOpen()) - { - if (createIfNecessary) - { - boolean created = com.sun.kjava.Database.create(0, name, dbCreator, dbType, false); - - DB_ = new com.sun.kjava.Database (dbType, dbCreator, com.sun.kjava.Database.READWRITE); - - if (!DB_.isOpen()) - throw new JdbcMeException("Couldn't create Offline Palm DB " + name, null); - else - return; - } - throw new JdbcMeException("Can't open Offline Palm DB " + name, null); - } - } - - - /** - * Create an offline data repository, destroying the current one if it exists. - * - * @param dbName The name of the offline database. - * @param dbCreator The unique offline database creator identifier. - * @param dbType The unique offline database type identifier. - * - * @exception JdbcMeException If an error occurs. - **/ - public static JdbcMeOfflineData create(String name, int dbCreator, int dbType) throws JdbcMeException - { - Database DB = new com.sun.kjava.Database(dbType, dbCreator, com.sun.kjava.Database.READWRITE); - - if (DB.isOpen()) - { - for (int i = DB.getNumberOfRecords(); i >= 0; --i) - { - DB.deleteRecord(i); - } - - if (DB.getNumberOfRecords() != 0) - throw new JdbcMeException("Couldn't delete existing Offline Palm DB " + name, null); - - DB.close(); - } - - return new JdbcMeOfflinePalmData(name, dbCreator, dbType, true); - } - - /** - * Get a record from the offline data store. - * - * @param index The record to return. The first record is record 0. - * The last record is this.size()-1; - * - * @return The record. - * - * @exception JdbcMeException If an error occurs. - **/ - public byte[] getRecord(int index) throws JdbcMeException - { - // com.sun.kjava.Database first index is 0 as required. - try - { - return DB_.getRecord(index); - } - catch (Exception e) - { - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Get the current number of records in the offline - * data store. - * - * @return The number of records. - * - * @exception JdbcMeException If an error occurs. - **/ - public int size() throws JdbcMeException - { - try - { - return DB_.getNumberOfRecords(); - } - catch (Exception e) - { - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Add a record to the offline data store from the - * specified bytes of the byte array. The record - * is added at the end of the data store. - * - * @param rec The byte data. - * @param offset The offset into the data. - * @param length The length of the data. - * - * @exception JdbcMeException If an error occurs. - **/ - public void addRecord(byte rec[], int offset, int length) throws JdbcMeException - { - try - { - if (offset != 0 && length != rec.length) - { - byte data[] = new byte[length]; - System.arraycopy(rec,offset,data,0,length); - rec = data; - } - DB_.addRecord(rec); - } - catch (Exception e) - { - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Set the record content to the specified bytes from the byte array. - * - * @param index The record to set. The first record is record 0. The last record is this.size()-1; - * @param rec The byte data. - * @param offset The offset into the data. - * @param length The length of the data. - * - * @exception JdbcMeException If an error occurs. - **/ - public void setRecord(int index, byte rec[], int offset, int length) throws JdbcMeException - { - try - { - if (offset != 0 && length != rec.length) - { - byte data[] = new byte[length]; - System.arraycopy(rec,offset,data,0,length); - rec = data; - } - // com.sun.kjava.Database first index is 0 as required. - DB_.setRecord(index, rec); - } - catch (Exception e) - { - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Delete the record specified from the offline data store. - * - * @param index The record to delete. The first record is record 0. The last record is this.size()-1; - * - * @exception JdbcMeException If an error occurs. - **/ - public void deleteRecord(int index) throws JdbcMeException - { - try - { - // com.sun.kjava.Database first index is 0 as required. - DB_.deleteRecord(index); - } - catch (Exception e) - { - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Close the offline data store, releasing resources - * required by the platform specific data store. - **/ - public void close() - { - try - { - DB_.close(); - } - catch (Exception e) - { - // ignore. - } - } -} diff --git a/cvsroot/micro/com/ibm/as400/micro/JdbcMeOfflineResultSet.java b/cvsroot/micro/com/ibm/as400/micro/JdbcMeOfflineResultSet.java deleted file mode 100644 index 89a40ac98..000000000 --- a/cvsroot/micro/com/ibm/as400/micro/JdbcMeOfflineResultSet.java +++ /dev/null @@ -1,1447 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JdbcMeOfflineResultSet.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.sql.*; -import java.util.Calendar; -import java.util.Map; -import java.io.*; -import java.math.BigDecimal; -import java.net.URL; - -/** - * JdbcMeOfflineResultSet implements the java.sql.ResultSet - * interface as provided for a Java 2 Micro-Edition device - * over the top of an existing MIDP Record Store or a Palm - * OS database. - * - *

    Note: Since Java 2 Micro-Edition does not include java.sql, - * JdbcMeOfflineResultSet implements the java.sql package that is also part - * of this driver. - **/ -public class JdbcMeOfflineResultSet implements ResultSet -{ - static final int dbEyeCatcher_ = 0x4a444243; // JDBC - private final static String hexDigits = "0123456789ABCDEF"; - - private boolean imported_ = false; - private int numColumns_ = 0; - private int columnTypes_[] = null; - - /** - * Row position is before the first row of the result set. - */ - public final static int BEFORE_FIRST_ROW = -1; - /** - * Row position is after the last row of the result set. - */ - public final static int AFTER_LAST_ROW = -2; - - private int currentRSRow_ = BEFORE_FIRST_ROW; - private int firstRowMIDPDBIndex_ = -1; - private int lastRowMIDPDBIndex_ = -1; - private JdbcMeOfflineData DB_; - - // Keep track of these - private String dbName_ = null; - private int dbCreator_ = 0; - private int dbType_ = 0; - - - /** - * Construct a result set based on the offline data indicated. - *

    - * The offline data must have been created by JdbcMe (for - * example via JdbcMeStatement.executeToMIDPDB() or - * JdbcMeStatement.executeToPalmDB()). - *

    - * No Connection or Statement is required when - * accessing a JdbcMeOfflineResultSet. - *

    - * If the RecordStore was not created with - * JdbcMeStatement.executeToMIDPDB(), the - * constructor JdbcMeOfflineResultSet(String, int, int, int, int[]) - * should be used to allow you to define meta-data - * about the imported database. - * - * @param dbName The name of the offline database. - * @param dbCreator The unique offline database creator identifier. - * @param dbType The unique offline database type identifier. - * - * @exception JdbcMeException If an error occurs. - **/ - public JdbcMeOfflineResultSet(String dbName, int dbCreator, int dbType) throws JdbcMeException - { - completeInitialization(dbName, dbCreator, dbType); - } - - /** - * Construct a result set based on the imported offline - * data records indicated. - *

    - * No Connection or Statement is required when - * accesing a JdbcMeOfflineResultSet. - *

    - * An imported offline data store (Palm DB or - * MIDP record store) is created by - * some other application. The caller indicates the number - * of columns and the format of the data using the - * numColumns and columnTypes parameters. - *

    - * The offline data must be a proper result set (i.e. number - * of records in the offline data must evenly divisible by - * the number of columns). - * The length of the 'columnTypes' array must equal - * the 'numColumns' parameter. - * - * @param dbName The name of the offline database. - * @param dbCreator The unique offline database creator identifier. - * @param dbType The unique offline database type identifier. - * @param numColumns The number of columns. - * @param columnTypes The column types. - * - * @exception JdbcMeException If an error occurs. - **/ - public JdbcMeOfflineResultSet(String dbName, int dbCreator, int dbType, int numColumns, int columnTypes[]) throws JdbcMeException - { - imported_ = true; - numColumns_ = numColumns; - columnTypes_ = new int[numColumns]; - System.arraycopy(columnTypes_, 0, columnTypes_, 0, numColumns_); - completeInitialization(dbName, dbCreator, dbType); - } - - /** - * Open the offline data, and do whatever processing is required - * - * @param dbName The name of the offline database. - * @param dbCreator The unique offline database creator identifier. - * @param dbType The unique offline database type identifier. - * - * @exception JdbcMeException If an error occurs. - **/ - private void completeInitialization(String dbName, int dbCreator, int dbType) throws JdbcMeException - { - dbName_ = dbName; - dbCreator_ = dbCreator; - dbType_ = dbType; - - DB_ = JdbcMeOfflineData.open(dbName, dbCreator, dbType, false); - int numberOfRows = DB_.size(); - - if (imported_) - { - if (numberOfRows % numColumns_ != 0) - throw new JdbcMeException("Offline DB NumRecords % numColumns != 0", null); - - firstRowMIDPDBIndex_ = 0; - lastRowMIDPDBIndex_ = numberOfRows-1; - return; - } - - byte data[] = null; - int val; - - if (numberOfRows < 4) - throw new JdbcMeException("Invalid Offline DB, number of rows=" + numberOfRows, null); - - data = DB_.getRecord(0); // First record eye catcher - val = 0; - val |= (data[0] << 24) & 0xFF000000; - val |= (data[1] << 16) & 0x00FF0000; - val |= (data[2] << 8) & 0x0000FF00; - val |= (data[3] << 0) & 0x000000FF; - - if (val != dbEyeCatcher_) - throw new JdbcMeException("Offline DB eyecatcher invalid:" + val, null); - - data = DB_.getRecord(1); // Second record is JdbcMe version - val = 0; - val |= (data[0] << 24) & 0xFF000000; - val |= (data[1] << 16) & 0x00FF0000; - val |= (data[2] << 8) & 0x0000FF00; - val |= (data[3] << 0) & 0x000000FF; - int version = val; // Currently, only v1 supported. - - if (version != 1) - throw new JdbcMeException("Offline DB version " + version + "not supported", null); - - data = DB_.getRecord(2); // Third record is number of columns - val = 0; - val |= (data[0] << 24) & 0xFF000000; - val |= (data[1] << 16) & 0x00FF0000; - val |= (data[2] << 8) & 0x0000FF00; - val |= (data[3] << 0) & 0x000000FF; - numColumns_ = val; - - columnTypes_ = new int[numColumns_]; - data = DB_.getRecord(3); // Fourth record is column types - - for (int i=0; i numColumns_) - throw new JdbcMeException("RS bad column " + columnIndex, null); - - int targetRow = firstRowMIDPDBIndex_ + (numColumns_ * currentRSRow_); - - byte data[] = DB_.getRecord(targetRow+(columnIndex-1)); - String s = new String(data); - return s; - } - - /** - * Returns the value of a column as a Java int value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or 0 if the value is SQL NULL. - * - * @exception JdbcMeException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public int getInt(int columnIndex) throws JdbcMeException - { - // Since each column is actually stored as a string - // anyway, we'll reuse this method even though - // the number of objects created is a little more than - // what is desired. - String s = getString(columnIndex); - // Attempt to convert existing string or object - // to an integer. - try - { - int i = Integer.parseInt(s); - return i; - } - catch (NumberFormatException e) - { - throw new JdbcMeException("Incorrect conversion to int: " + s, null); - } - } - - - /** - * Inserts the contents of the insert row into the result set - * and the database. - *

    - * Note: This method is currently not implemented and - * will throw a JdbcMeException. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on the insert row, - * a column that is not nullable was not specified, - * or an error occurs. - **/ - public void insertRow() throws JdbcMeException - { - throw new JdbcMeException("unimplemented", null); - } - - /** - * Positions the cursor to the insert row. - * If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - *

    - * Note: This method is currently not implemented and - * will throw a JdbcMeException. - * - * @exception JdbcMeException Always thrown. This method is - * not implemented in an offline result set. - **/ - public void moveToInsertRow() throws JdbcMeException - { - throw new JdbcMeException("unimplemented", null); - } - - - /** - * Positions the cursor to the current row. This is the row - * where the cursor was positioned before moving it to the insert - * row. If the cursor is not on the insert row, then this - * has no effect. - * - *

    If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - *

    - * Note: This method is currently not implemented and - * will throw a JdbcMeException. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not scrollable, - * or an error occurs. - **/ - public void moveToCurrentRow() throws JdbcMeException - { - throw new JdbcMeException("unimplemented", null); - } - - - /** - * Positions the cursor to the next row. - * If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @return true if the requested cursor position is valid; false - * if there are no more rows. - * - * @exception JdbcMeException If the result set is not open, - * or an error occurs. - **/ - public boolean next() throws JdbcMeException - { - return relative(1); - } - - /** - * Positions the cursor to the previous row. - * If an InputStream from the current row is open, it is implicitly - * closed. In addition, all warnings and pending updates - * are cleared. - * - * @return true if the requested cursor position is - * valid; false otherwise. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not scrollable, - * or an error occurs. - **/ - public boolean previous() throws JdbcMeException - { - return relative(-1); - } - - /** - * Positions the cursor to a relative row number. - * - *

    Attempting to move beyond the first row positions the - * cursor before the first row. Attempting to move beyond the last - * row positions the cursor after the last row. - * - *

    If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @param rows The relative row number. If the relative row - * number is positive, this positions the cursor - * after the current position. If the relative - * row number is negative, this positions the - * cursor before the current position. If the - * relative row number is 0, then the cursor - * position does not change. - * - * @return true if the requested cursor position is valid, false otherwise. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not scrollable, - * the cursor is not positioned on a valid row, - * or an error occurs. - **/ - public boolean relative(int rows) throws JdbcMeException - { - int newRow = 0; - - if (lastRowMIDPDBIndex_ < firstRowMIDPDBIndex_) - return false; // No data - - // Special case if we are before the first row. - if (currentRSRow_ == BEFORE_FIRST_ROW) - { - // Can't go any earlier - if (rows <= 0) - return false; - - // rows is posetive so set newRow = row-1, (if rows == 1, - // we want to stay on the first row. (internally stored as 0 - // store the first row as 0); - --rows; - newRow = rows; - // See if we went too many rows (past the last row). - if ((firstRowMIDPDBIndex_ + (newRow * numColumns_)) > lastRowMIDPDBIndex_) - { - currentRSRow_ = AFTER_LAST_ROW; - return false; - } - currentRSRow_ = newRow; - return true; - } - if (currentRSRow_ == AFTER_LAST_ROW) - { - if (rows >= 0) - return false; - - // rows is negative so we want to add rows+1 to the - // last row (i.e. if rows == -1, then we want to stay - // on the last row. - ++rows; - newRow = ((lastRowMIDPDBIndex_ - firstRowMIDPDBIndex_) / numColumns_)+rows; - if (newRow < 0) - { - currentRSRow_ = BEFORE_FIRST_ROW; - return false; - } - currentRSRow_ = newRow; - return true; - } - - newRow = currentRSRow_ + rows; - if (newRow < 0) - { - currentRSRow_ = BEFORE_FIRST_ROW; - return false; - } - if ((firstRowMIDPDBIndex_ + (newRow * numColumns_)) > lastRowMIDPDBIndex_) - { - currentRSRow_ = AFTER_LAST_ROW; - return false; - } - currentRSRow_ = newRow; - return true; - } - - /** - * Positions the cursor to the first row. - * If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @return true if the requested cursor position is - * valid; false otherwise. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not scrollable, - * or an error occurs. - **/ - public boolean first() throws JdbcMeException - { - return absolute(1); - } - - /** - * Positions the cursor to the last row. - * If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @return true if the requested cursor position is - * valid; false otherwise. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not scrollable, - * or an error occurs. - **/ - public boolean last() throws JdbcMeException - { - return absolute(-1); - } - - /** - * Positions the cursor to an absolute row number. - * - *

    Attempting to move any number of positions before - * the first row positions the cursor to before the first row. - * Attempting to move beyond the last - * row positions the cursor after the last row. - * - *

    If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @param row The absolute row number. If the absolute row - * number is positive, this positions the cursor - * with respect to the beginning of the result set. - * If the absolute row number is negative, this - * positions the cursor with respect to the end - * of result set. - * - * @return true if the requested cursor position is - * valid; false otherwise. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not scrollable, - * the row number is 0, - * or an error occurs. - **/ - public boolean absolute(int row) throws JdbcMeException - { - int newRow = 0; - if (row > 0) - { - // rows is posetive so set newRow = row - // row of 1 takes us to first row. We store rows internally - // starting at 0. - --row; - newRow = row; - // See if we went too many rows (past the last row). - if ((firstRowMIDPDBIndex_ + (newRow * numColumns_)) > lastRowMIDPDBIndex_) - { - currentRSRow_ = AFTER_LAST_ROW; - return false; - } - currentRSRow_ = newRow; - return true; - } - if (row < 0) - { - // rows is negative so we want to add rows+1 to the - // last row (i.e. if rows == -1, then we want to stay - // on the last row. - ++row; - newRow = ((lastRowMIDPDBIndex_ - firstRowMIDPDBIndex_) / numColumns_)+row; - if (newRow < 0) - { - currentRSRow_ = BEFORE_FIRST_ROW; - return false; - } - currentRSRow_ = newRow; - return true; - } - throw new JdbcMeException("ResultSet position absolute 0", null); - } - - /** - * Updates a column in the current row using a String value. - *

    - * The updateString for the JdbcMeOfflineResultSet works - * rather differently than a standard result set, - * it updates the column specified by the 'columnIndex' parameter - * IMMEDIATELY, and IN PLACE. It does not require - * movement out of the current row, nor does it cause - * any cursor movement. It simply updates the value. - * - * @param columnIndex The column index (1-based). - * @param value The column value or null to update - * the value to SQL NULL. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, - * or the requested conversion is not valid. - **/ - public void updateString(int columnIndex, String value) throws JdbcMeException - { - if (currentRSRow_ < 0) - throw new JdbcMeException("Not positioned on a row", null); - - if (columnIndex < 1 || columnIndex > numColumns_) - throw new JdbcMeException("RS bad column " + columnIndex, null); - - int targetRow = firstRowMIDPDBIndex_ + (numColumns_ * currentRSRow_); - - byte data[] = value.getBytes(); - DB_.setRecord(targetRow+(columnIndex-1), data, 0, data.length); - // This doesn't appear to work for Palm OS. - // Some hints have suggested - // that DB records don't always get flushed correctly - // unless the database was closed and opened. We'll try it. - DB_.close(); - DB_ = null; - DB_ = JdbcMeOfflineData.open(dbName_, dbCreator_, dbType_, false); - return; - } - - /** - * Updates a column in the current row using a Java int value. - *

    - * The updateInt for the JdbcMeOfflineResultSet works - * rather differently than a standard result set, - * it updates the column specified by the 'columnIndex' parameter - * IMMEDIATELY, and IN PLACE. It does not require - * movement out of the current row, nor does it cause - * any cursor movement. It simply updates the value. - * - * @param columnIndex The column index (1-based). - * @param value The column value. - * - * @exception JdbcMeException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateInt(int columnIndex, int value) throws JdbcMeException - { - // Since each column is actually stored as a string - // anyway, we'll reuse this method. - updateString(columnIndex, Integer.toString(value)); - } - - /** - * Updates the database with the new contents of the current row. - *

    - * Note: This method is currently not implemented. - * - * @exception JdbcMeException This exception is never thrown. - **/ - public void updateRow() throws JdbcMeException - { - return; - } - - /** - * Returns the ResultSetMetaData object that describes the result set's columns. - * - * @return The metadata object. - * - * @exception JdbcMeException If an error occurs. - **/ - public ResultSetMetaData getMetaData() throws JdbcMeException - { - return new JdbcMeResultSetMetaData(numColumns_, columnTypes_); - } - - - /** - * Returns the statement for this result set. - *

    - * Note: This method returns null, no JdbcMeOfflineResultSet - * is ever owned by a statement. - * - * @return The statement for this result set, or null if the - * result set was returned by a DatabaseMetaData - * catalog method. - * - * @exception JdbcMeException This exception is never thrown. - **/ - public Statement getStatement() throws JdbcMeException - { - return null; - } - - /** - * Dump out the current database (Using System.out.println). - * Optionally, convert the hex values to Strings so they - * are easier to view. - * - * @param dumpAsStrings true to convert the database hex values to strings; false otherwise. - * - * @exception JdbcMeException If an error occurs. - **/ - public void dumpDB(boolean dumpAsStrings) throws JdbcMeException - { - dumpDB(null, dumpAsStrings); - } - - /** - * Dump out the specified database. - * Optionally, convert the values of each record - * to Strings so they are easier to view. - * - * @param db The database. - * @param dumpAsStrings true to convert the database hex values to strings; false otherwise. - * - * @exception JdbcMeException If an error occurs. - **/ - public void dumpDB(JdbcMeOfflineData db, boolean dumpAsStrings) throws JdbcMeException - { - if (db == null) - db = DB_; - - int numberOfRows_ = db.size(); - byte data[] = null; - - for (int i=0; i= 4) - { - // Attempt to dump as a string. - System.out.println(" " + new String(data)); - } - } - } - } - - /** - * Return the number of ResultSet rows in the - * offline result set. This number is not the same as the number - * of records in the offline data DB. - * - * @return The number of rows. - **/ - public int numberOfRows() - { - return(lastRowMIDPDBIndex_ - firstRowMIDPDBIndex_) / numColumns_; - } - - /** - * Return the number of the current row in the offline DB. - * The first row is 1, BEFORE_FIRST_ROW - * or AFTER_LAST_ROW may also be returned. - * - * @return The current row index. - **/ - public int getCurrentRow() - { - return currentRSRow_ + 1; - } - - /** - * Dump out a byte array with a row label so that - * it may be used for debug purposes. This is most - * useful in the emulator. - * - * @param row The row label. - * @param data The byte data. - **/ - private void dumpBytes(int row, byte data[]) - { - System.out.print("#" + row + " : 0x "); - int val; - for (int i=0; i> 4; - System.out.print(hexDigits.charAt(val)); - val = (((int)data[i]) & 0x0F) >> 0; - System.out.print(hexDigits.charAt(val)); - - if ((i+1)%4==0) - System.out.print(" "); - } - System.out.println(); - } - - /** - * Return the type of result set. - *

    - * All offline database result sets are TYPE_SCROLL_SENSITIVE. - * - * @return The result set type, which is always TYPE_SCROLL_SENSITIVE. - * - * @exception JdbcMeException If the result set is not open. - **/ - public int getType() throws JdbcMeException - { - return TYPE_SCROLL_SENSITIVE; - } - - /** - * Return the concurrency of the result set. - *

    - * All offline database result sets are CONCUR_UPDATABLE. - * - * @return The result set concurrency, which is always CONCUR_UPDATABLE. - * - * @exception JdbcMeException If the result set is not open. - **/ - public int getConcurrency() throws JdbcMeException - { - return CONCUR_UPDATABLE; - } - - public void afterLast() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void beforeFirst() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void cancelRowUpdates() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void clearWarnings() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public int findColumn(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public Array getArray(int i) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Array getArray(String colName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public InputStream getAsciiStream(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public InputStream getAsciiStream(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public BigDecimal getBigDecimal(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public BigDecimal getBigDecimal(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public BigDecimal getBigDecimal(int columnIndex, int scale) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public BigDecimal getBigDecimal(String columnName, int scale) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public InputStream getBinaryStream(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public InputStream getBinaryStream(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Blob getBlob(int i) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Blob getBlob(String colName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public boolean getBoolean(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public boolean getBoolean(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public byte getByte(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public byte getByte(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public byte[] getBytes(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public byte[] getBytes(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Reader getCharacterStream(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Reader getCharacterStream(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Clob getClob(int i) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Clob getClob(String colName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public String getCursorName() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Date getDate(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Date getDate(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Date getDate(int columnIndex, Calendar cal) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Date getDate(String columnName, Calendar cal) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public double getDouble(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public double getDouble(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public int getFetchDirection() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public int getFetchSize() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public float getFloat(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public float getFloat(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public int getInt(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public long getLong(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public long getLong(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Object getObject(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Object getObject(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Object getObject(int i, Map map) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Object getObject(String colName, Map map) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Ref getRef(int i) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Ref getRef(String colName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public int getRow() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public short getShort(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public short getShort(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public String getString(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Time getTime(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Time getTime(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Time getTime(int columnIndex, Calendar cal) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Time getTime(String columnName, Calendar cal) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Timestamp getTimestamp(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Timestamp getTimestamp(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Timestamp getTimestamp(int columnIndex, Calendar cal) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public Timestamp getTimestamp(String columnName, Calendar cal) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public URL getURL(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public URL getURL(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public InputStream getUnicodeStream(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public InputStream getUnicodeStream(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public SQLWarning getWarnings() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public boolean isAfterLast() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public boolean isBeforeFirst() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public boolean isFirst() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public boolean isLast() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void refreshRow() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public boolean rowDeleted() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public boolean rowInserted() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public boolean rowUpdated() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void setFetchDirection(int direction) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void setFetchSize(int rows) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateArray(int columnIndex, Array x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateArray(String columnName, Array x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateAsciiStream(int columnIndex, InputStream x, int length) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateAsciiStream(String columnName, InputStream x, int length) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateBigDecimal(int columnIndex, BigDecimal x) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateBigDecimal(String columnName, BigDecimal x) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateBinaryStream(int columnIndex, InputStream x, int length) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateBinaryStream(String columnName, InputStream x, int length) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateBlob(int columnIndex, Blob x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateBlob(String columnName, Blob x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateBoolean(int columnIndex, boolean x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateBoolean(String columnName, boolean x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateByte(int columnIndex, byte x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateByte(String columnName, byte x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateBytes(int columnIndex, byte[] x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateBytes(String columnName, byte[] x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateCharacterStream(int columnIndex, Reader x, int length) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateCharacterStream(String columnName, Reader reader, - int length) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateClob(int columnIndex, Clob x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateClob(String columnName, Clob x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateDate(int columnIndex, Date x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateDate(String columnName, Date x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateDouble(int columnIndex, double x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateDouble(String columnName, double x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateFloat(int columnIndex, float x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateFloat(String columnName, float x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateInt(String columnName, int x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateLong(int columnIndex, long x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateLong(String columnName, long x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateNull(int columnIndex) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateNull(String columnName) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateObject(int columnIndex, Object x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateObject(String columnName, Object x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateObject(int columnIndex, Object x, int scale) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateObject(String columnName, Object x, int scale) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateRef(int columnIndex, Ref x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateRef(String columnName, Ref x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateShort(int columnIndex, short x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateShort(String columnName, short x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateString(String columnName, String x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateTime(int columnIndex, Time x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateTime(String columnName, Time x) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateTimestamp(int columnIndex, Timestamp x) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public void updateTimestamp(String columnName, Timestamp x) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } - - public boolean wasNull() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - - } -} diff --git a/cvsroot/micro/com/ibm/as400/micro/JdbcMeResultSetMetaData.java b/cvsroot/micro/com/ibm/as400/micro/JdbcMeResultSetMetaData.java deleted file mode 100644 index 3b6a9487b..000000000 --- a/cvsroot/micro/com/ibm/as400/micro/JdbcMeResultSetMetaData.java +++ /dev/null @@ -1,178 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JdbcMeResultSetMetaData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.sql.*; - -/** - * JdbcMeResultSetMetaData implements the java.sql.ResultSetMetaData - * interface as provided for a Java 2 Micro-Edition device. - * - *

    Note: Since Java 2 Micro-Edition does not include java.sql, - * JdbcMeResultSetMetaData implements the java.sql package that is also part - * of this driver. - **/ -public class JdbcMeResultSetMetaData implements ResultSetMetaData -{ - private int numColumns_; - private int columnTypes_[]; - - /** - * Default constructor. - **/ - private JdbcMeResultSetMetaData() - { } - - - /** - * Constructs an JdbcMeResultSetMetaData object. - * - * @param numColumns The number of columns - * @param columnTypes The columnTypes for a result set. - * - * @exception JdbcMeException If an error occurs. - **/ - JdbcMeResultSetMetaData(int numColumns, int columnTypes[]) throws JdbcMeException - { - numColumns_ = numColumns; - columnTypes_ = columnTypes; - } - - - /** - * Returns the number of columns in the result set. - * - * @return The number of columns. - * - * @exception JdbcMeException If an error occurs. - **/ - public int getColumnCount() throws JdbcMeException - { - return numColumns_; - } - - - /** - * Returns the type of a column. If the type is a distinct type, - * this returns the underlying type. - * - * @param column The column index (1-based). - * - * @return The SQL type code defined in java.sql.Types. - * - * @exception JdbcMeException If the column index is not valid. - **/ - public int getColumnType(int column) throws JdbcMeException - { - if (column < 1 || column > numColumns_) - throw new JdbcMeException("Bad column index", null); - - return columnTypes_[column-1]; - } - - - public String getCatalogName(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public String getColumnClassName(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public int getColumnDisplaySize(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public String getColumnLabel(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public String getColumnName(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public String getColumnTypeName(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public int getPrecision(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public int getScale(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public String getSchemaName(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public String getTableName(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public boolean isAutoIncrement(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public boolean isCaseSensitive(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public boolean isCurrency(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public boolean isDefinitelyWritable(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public int isNullable(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public boolean isReadOnly(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public boolean isSearchable(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public boolean isSigned(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - - public boolean isWritable(int column) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } -} diff --git a/cvsroot/micro/com/ibm/as400/micro/JdbcMeStatement.java b/cvsroot/micro/com/ibm/as400/micro/JdbcMeStatement.java deleted file mode 100644 index 99ae19e73..000000000 --- a/cvsroot/micro/com/ibm/as400/micro/JdbcMeStatement.java +++ /dev/null @@ -1,575 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JdbcMeStatement.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.sql.*; -import java.io.*; - -/** - * The AS400JDBCStatement class provides a mechanism for - * executing static SQL statements. Use Connection.createStatement() - * to create new Statement objects. - * - *

    Only one result set per statement can be open at any point in time. - * Therefore, if an application needs to read from multiple result sets, - * then each must be generated by a different statement. - * - *

    Note: Since Java 2 Micro-Edition does not include java.sql, - * JdbcMeStatement implements the java.sql package that is also part - * of this driver. - **/ -public class JdbcMeStatement implements Statement -{ - JdbcMeConnection connection_ = null; - private int statementId_ = -1; - - // The update count is only valid after an execute() - // returns false, or executeUpdate() is used. - private int updateCount_ = -1; - - // The following are only valid when execute() returns - // true, or executeQuery() is used. - private JdbcMeLiveResultSet rs_ = null; - int numColumns_ = 0; - int columnTypes_[] = null; - int type_ = ResultSet.TYPE_FORWARD_ONLY; - int concurrency_ = ResultSet.CONCUR_READ_ONLY; - - /** - * Constructs an JdbcMeStatement object. - * - * @param connection The connection to the system. - * @param statementId The statement ID handle. - * - * @exception JdbcMeException If an error occurs. - **/ - JdbcMeStatement(JdbcMeConnection connection, int statementId) throws JdbcMeException - { - connection_ = connection; - statementId_ = statementId; - } - - /** - * Releases the statement's resources. This closes the current - * result set. - * - * @exception JdbcMeException If an error occurs. - **/ - public void close() throws JdbcMeException - { - /** - * Line flow out: - * Function ID - * Statement Handle ID - * Line flow in: - * None - **/ - try - { - connection_.system_.toServer_.writeInt(MEConstants.STMT_CLOSE); - connection_.system_.toServer_.writeInt(statementId_); - connection_.system_.toServer_.flush(); - - if (rs_ != null) - rs_.closeHard(); - - // Don't wait for ack. - return; - } - catch (IOException e) - { - // If an IOException occurs, our connection to the database - // has been toasted. Lets reset it. - connection_.disconnected(); - - throw new JdbcMeException(e.toString(), null); - } - } - - /** - * Runs an SQL statement that returns a single result set. - * This closes the current result set and clears warnings - * before executing the new SQL statement. - * - * @param sql The SQL statement. - * - * @return The result set that contains the data produced by the query. - * - * @exception JdbcMeException If the statement is not open, - * the SQL statement contains a syntax - * error, no result set is returned by the - * database, the query timeout limit is - * exceeded, or an error occurs. - **/ - public ResultSet executeQuery(String sql) throws JdbcMeException - { - boolean results = execute(sql); - - if (results) - return getResultSet(); - else - return null; - } - - /** - * Runs an SQL INSERT, UPDATE, or DELETE statement, or any - * SQL statement that does not return a result set. - * This closes the current result set and clears warnings - * before executing the new SQL statement. - * - * @param sql The SQL statement. - * - * @return Either the row count for INSERT, UPDATE, or - * DELETE, or 0 for SQL statements that - * return nothing. - * - * @exception JdbcMeException If the statement is not open, - * the SQL statement contains a syntax - * error, the query timeout limit is - * exceeded, the statement returns - * a result set, or an error occurs. - **/ - public int executeUpdate(String sql) throws JdbcMeException - { - boolean results = execute(sql); - - if (results) - return -1; - else - return updateCount_; - } - - - /** - * Runs an SQL statement that may return multiple result sets. - * This closes the current result set and clears warnings before - * executing the new SQL statement. - * - *

    Under some situations, a single SQL statement may return - * multiple result sets, an update count, or both. This might occur - * when executing a stored procedure that returns multiple - * result sets or when dynamically executing an unknown SQL string. - * - *

    Use getResultSet() and getUpdateCount() - * to navigate through multiple result sets, an update count, or both. - * - * @param sql The SQL statement. - * - * @return true if a result set was returned, false if an update count was returned or nothing was returned. - * - * @exception JdbcMeException If the statement is not open, - * the SQL statement contains a syntax - * error, the query timeout limit is - * exceeded, or an error occurs. - **/ - public boolean execute(String sql) throws JdbcMeException - { - /** - * Line flows out: - * Function ID - * Statement Handle ID - * UTF String for SQL statement - * Line flows in: - * -1 and exception data follows - * OR - * 0 and update count follows as integer - * OR - * 1 and result set data follows as: - * Result set handle ID - * Integer number of columns - * Integer column type for each column - **/ - try - { - updateCount_ = -1; - - if (rs_ != null) - { - rs_.closeHard(); - rs_ = null; - } - - connection_.system_.toServer_.writeInt(MEConstants.STMT_EXECUTE); - connection_.system_.toServer_.writeInt(statementId_); - connection_.system_.toServer_.writeUTF(sql); - connection_.system_.toServer_.flush(); - - int isRs = connection_.system_.fromServer_.readInt(); - - if (isRs == -1) - JdbcMeDriver.processException(connection_); - - if (isRs == 0) - { - updateCount_ = connection_.system_.fromServer_.readInt(); - - return false; - } - else - { - int rsId = connection_.system_.fromServer_.readInt(); - - rs_ = new JdbcMeLiveResultSet(this, rsId); - - numColumns_ = connection_.system_.fromServer_.readInt(); - columnTypes_ = new int[numColumns_]; - - for (int i=0; i - * If the SQL statement does not generate query results, - * then the target offline database is not changed. - *

    - * If the target offline database exists, it is destroyed - * and its contents are filled with the results of the query. - *

    - * Use JdbcMeOfflineResultSet to access the data from the - * offline data at a later time (for example after disconnecting - * from the DB server. - *

    - *

    -     * For example.
    -     *  MIDP - The 'name' is a unique string of up to 32
    -     *         unique characters identifying a
    -     *         javax.microedition.rms.RecordStore object
    -     *         the offline data object returned, then
    -     *         encapsulates the RecordStore object.
    -     *
    -     *  PALM - The 'name' is effectively just a visual
    -     *         key, while the offline data is uniquely
    -     *         identified by the 'dbCreator' and the
    -     *         'dbType' parameters.
    -     *  
    - * @param sql The SQL statement. - * @param dbName The name of the offline database. - * @param dbCreator The unique offline database creator identifier. - * @param dbType The unique offline database type identifier. - * - * @return true if a result set was returned to the offline database, false if an update count was returned or nothing was returned. - * - * @exception JdbcMeException If the statement is not open, - * the SQL statement contains a syntax - * error, the query timeout limit is - * exceeded, or an error occurs. - **/ - public boolean executeToOfflineData(String sql, String dbName, int dbCreator, int dbType) throws JdbcMeException - { - boolean results = execute(sql); - - // No result set. Return immediately after executing the statement. - if (!results) - return false; - - JdbcMeOfflineData DB = null; - - try - { - int i; - - DB = JdbcMeOfflineData.create(dbName, dbCreator, dbType); - - if (DB == null) - throw new JdbcMeException("Couldn't open/create DB " + dbName, null); - - byte data[] = new byte[4]; - ResultSet rs = getResultSet(); - - // EyeCatcher. - data[0] = (byte)((0xFF000000 & JdbcMeOfflineResultSet.dbEyeCatcher_) >>> 24); - data[1] = (byte)((0x00FF0000 & JdbcMeOfflineResultSet.dbEyeCatcher_) >>> 16); - data[2] = (byte)((0x0000FF00 & JdbcMeOfflineResultSet.dbEyeCatcher_) >>> 8); - data[3] = (byte)((0x000000FF & JdbcMeOfflineResultSet.dbEyeCatcher_) >>> 0); - DB.addRecord(data, 0, data.length); - - // Add a number indicating the version to the offline DB - int version = 1; - data[0] = (byte)((0xFF000000 & version) >>> 24); - data[1] = (byte)((0x00FF0000 & version) >>> 16); - data[2] = (byte)((0x0000FF00 & version) >>> 8); - data[3] = (byte)((0x000000FF & version) >>> 0); - DB.addRecord(data, 0, data.length); - - // Write a number representing the number of columns - // to the palm database. - data[0] = (byte)((0xFF000000 & numColumns_) >>> 24); - data[1] = (byte)((0x00FF0000 & numColumns_) >>> 16); - data[2] = (byte)((0x0000FF00 & numColumns_) >>> 8); - data[3] = (byte)((0x000000FF & numColumns_) >>> 0); - DB.addRecord(data, 0, data.length); - - // Write the SQL type of each column to the palm database - // All of these are in a single record. - data = new byte[4*numColumns_]; - for (i=0; i>> 24); - data[i*4+1] = (byte)((0x00FF0000 & columnTypes_[i]) >>> 16); - data[i*4+2] = (byte)((0x0000FF00 & columnTypes_[i]) >>> 8); - data[i*4+3] = (byte)((0x000000FF & columnTypes_[i]) >>> 0); - } - - DB.addRecord(data, 0, data.length); - data = null; - - // Read all of the fields in from the result set, and - // write them to the DB. - // At this time, all fields are written as strings - // regardless of SQL type. - String col = null; - while (rs.next()) - { - for (i=1; i<=numColumns_; ++i) - { - col = rs.getString(i); - data = col.getBytes(); - DB.addRecord(data, 0, data.length); - } - } - } - catch (SQLException e) - { - throw new JdbcMeException(e.getMessage(), e.getSQLState()); - } - finally - { - if (DB != null) - { - DB.close(); - DB = null; - } - System.gc(); - } - - return true; - } - - - /** - * Returns the current result set. - * - * @return The current result set, or null if an update count was returned or there are no more result sets. - * - * @exception JdbcMeException If the statement is not open. - **/ - public ResultSet getResultSet() throws JdbcMeException - { - return rs_; - } - - - /** - * Returns the result set concurrency to be used for this statement. - * - * @return The result set concurrency. - * - * @exception JdbcMeException If the statement is not open. - **/ - public int getResultSetConcurrency() throws JdbcMeException - { - return concurrency_; - } - - - /** - * Returns the result set type to be used for this statement. - * - * @return The result set type. - * - * @exception JdbcMeException If the statement is not open. - **/ - public int getResultSetType() throws JdbcMeException - { - return type_; - } - - - /** - * Returns the current update count. - * - * @return The update count, or -1 if a result set was returned or there are no more result sets. - * - * @exception JdbcMeException If the statement is not open. - **/ - public int getUpdateCount() throws JdbcMeException - { - return updateCount_; - } - - - /** - * Returns the connection for this statement. - * - * @return The connection for this statement. - * - * @exception JdbcMeException If an error occurs. - **/ - public java.sql.Connection getConnection() throws JdbcMeException - { - return connection_; - } - - public void addBatch(String sql) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public void cancel() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public void clearBatch() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public void clearWarnings() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public boolean execute(String sql, int autoGeneratedKeys) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public boolean execute(String sql, int[] columnIndexes) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public boolean execute(String sql, String[] columnNames) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public int[] executeBatch() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public int executeUpdate(String sql, int autoGeneratedKeys) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public int executeUpdate(String sql, int[] columnIndexes) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public int executeUpdate(String sql, String[] columnNames) - throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public int getFetchDirection() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public int getFetchSize() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public ResultSet getGeneratedKeys() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public int getMaxFieldSize() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public int getMaxRows() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public boolean getMoreResults() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public boolean getMoreResults(int current) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public int getQueryTimeout() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public int getResultSetHoldability() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public SQLWarning getWarnings() throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public void setCursorName(String name) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public void setEscapeProcessing(boolean enable) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public void setFetchDirection(int direction) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public void setFetchSize(int rows) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public void setMaxFieldSize(int max) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public void setMaxRows(int max) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } - - public void setQueryTimeout(int seconds) throws SQLException { - throw new java.sql.SQLException("NOT AVAILABLE IN MICROEDITION"); - } -} - diff --git a/cvsroot/micro/com/ibm/as400/micro/ProgramCall.java b/cvsroot/micro/com/ibm/as400/micro/ProgramCall.java deleted file mode 100644 index 09e36c78f..000000000 --- a/cvsroot/micro/com/ibm/as400/micro/ProgramCall.java +++ /dev/null @@ -1,190 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.io.IOException; -import java.util.Hashtable; -import java.util.Enumeration; - -/** - * The ProgramCall class allows a user to call a program and access data returned after the program runs - * from a wireless device. This class provides a modified subset of the functions available in - * com.ibm.as400.access.ProgramCall.

    - * - * Each PCML document must be registered with the MEserver. The document can be - * registered during runtime when the PCML document name parameter is provided or as an argument when the - * MEServer is started or reconfigured.

    The registration is simply telling the system which PCML-defined program(s) - * to run.

    - * - * A hashtable is used to specify the names and values of the parameters to set. The key in the hashtable - * is the name of the parameter to set and the key value is the value of the corresponding parameter to set. - * There is also a string array which specifies the name of the PCML output parameter(s) to return. - * - *

    The following example demonstrates the use of Program Call: - *
    - *

    - *   // Call programs.
    - *   AS400 system = new AS400("mySystem", "myUserid", "myPwd", "myMEServer");
    - *   
    - *   // See the PCML example in the Toolbox programmer's guide.
    - *   String pcmlName = "qsyrusri.pcml"; // The PCML document describing the program we want to use.
    - *   String apiName = "qsyrusri";
    - *
    - *   Hashtable parametersToSet = new Hashtable();
    - *   parametersToSet.put("qsyrusri.receiverLength", "2048");
    - *   parametersToSet.put("qsyrusri.profileName", "JOHNDOE" };
    - *
    - *   String[] parametersToGet = { "qsyrusri.receiver.userProfile",  
    - *               "qsyrusri.receiver.previousSignonDate", 
    - *               "qsyrusri.receiver.previousSignonTime",
    - *               "qsyrusri.receiver.displaySignonInfo" };
    - *               
    - *   String[] valuesToGet = null;
    - *
    - *   try
    - *   {
    - *       valuesToGet = ProgramCall.run(system, pcmlName, apiName, parametersToSet, parametersToGet);
    - *       
    - *       // Get and display the user profile.
    - *       System.out.println("User profile: " + valuesToGet[0]);
    - *
    - *       // Get and display the date in a readable format.
    - *       char[] c = valuesToGet[1].toCharArray();
    - *       System.out.println("Last Signon Date: " + c[3]+c[4]+"/"+c[5]+c[6]+"/"+c[1]+c[2] );
    - *
    - *       // Get and display the time in a readable format.
    - *       char[] d = valuesToGet[2].toCharArray();
    - *       System.out.println("Last Signon Time: " + d[0]+d[1]+":"+d[2]+d[3]);
    - *
    - *       // Get and display the signon info.
    - *       System.out.println("Signon Info: " + valuesToGet[3] );
    - *   }
    - *   catch (MEException te)
    - *   {
    - *       // Handle the exception.
    - *   }
    - *   catch (IOException ioe)
    - *   {
    - *       // Handle the exception
    - *   }
    - *   
    - *   // Done with the system object.
    - *   system.disconnect();
    - *  
    - * - * @see com.ibm.as400.access.ProgramCall - **/ -public final class ProgramCall -{ - /** - * Private ProgramCall constructor. - **/ - private ProgramCall() - { } - - - /** - * Constructs a ProgramCall object using the specified system, pgmName, parametersToSet, parameterValues, and parametersToGet. - * - * @param system The system on which to run the program. - * @param pcmlName The name of the PCML document. - * @param program The name of the program. - * @param parametersToSet The hashtable containg the key, which is the name of the program parameter, and the key value, - * which is the corresponding program parameter value.. - * @param parametersToGet The data returned from the program call. - * - * @return the data requested returned from the program. An empty array is returned if no data is returned. - * - * @exception IOException If an error occurs while communicating with the system. - * @exception MEException If an error occurs while processing the ToolboxME request. - **/ - public static String[] run(AS400 system, String pcmlName, String program, Hashtable parametersToSet, String[] parametersToGet) throws IOException, MEException - { - if (system == null) - throw new NullPointerException("system"); - - if (pcmlName == null) - throw new NullPointerException("pcmlName"); - - if (program == null) - throw new NullPointerException("program"); - - synchronized(system) - { - system.connect(); - - system.toServer_.writeInt(MEConstants.PROGRAM_CALL); - - system.toServer_.writeUTF(pcmlName); - system.toServer_.writeUTF(program); - - // Write the number parameter name/value pairs specified in the hashtable. - system.toServer_.writeInt(parametersToSet.size()); - system.toServer_.flush(); - - // Loop through the hashtable and write out the key (parameter name) - // and the key value (parameter value) - for (Enumeration e = parametersToSet.keys() ; e.hasMoreElements() ;) - { - String key = (String)e.nextElement(); - system.toServer_.writeUTF(key); - system.toServer_.writeUTF(parametersToSet.get(key).toString()); - } - - system.toServer_.flush(); - - // Write the number of parameters to get or return to the caller. - int numparametersToGet = (parametersToGet == null ? 0 : parametersToGet.length); - system.toServer_.writeInt(numparametersToGet); - system.toServer_.flush(); - - // Write the parameter names to get. - for (int i=0; i - - - - - - -Provides classes that allow access to various IBM i data and resources from a wireless -or handheld device. - -

    Related Documentation

    - -For overviews, tutorials, examples, guides, and tool documentation, please see: - - - - diff --git a/cvsroot/micro/java/math/BigDecimal.java b/cvsroot/micro/java/math/BigDecimal.java deleted file mode 100644 index f0ce9b03a..000000000 --- a/cvsroot/micro/java/math/BigDecimal.java +++ /dev/null @@ -1,8 +0,0 @@ -package java.math; - -/* - * Dummy placeholder for micro package - */ -public class BigDecimal { - -} diff --git a/cvsroot/micro/java/net/URL.java b/cvsroot/micro/java/net/URL.java deleted file mode 100644 index 787b239ec..000000000 --- a/cvsroot/micro/java/net/URL.java +++ /dev/null @@ -1,5 +0,0 @@ -package java.net; - -public class URL { - -} diff --git a/cvsroot/micro/java/sql/Array.java b/cvsroot/micro/java/sql/Array.java deleted file mode 100644 index 27a2da066..000000000 --- a/cvsroot/micro/java/sql/Array.java +++ /dev/null @@ -1,5 +0,0 @@ -package java.sql; - -public interface Array { - -} diff --git a/cvsroot/micro/java/sql/Blob.java b/cvsroot/micro/java/sql/Blob.java deleted file mode 100644 index dd7ef4ac9..000000000 --- a/cvsroot/micro/java/sql/Blob.java +++ /dev/null @@ -1,5 +0,0 @@ -package java.sql; - -public interface Blob { - -} diff --git a/cvsroot/micro/java/sql/CallableStatement.java b/cvsroot/micro/java/sql/CallableStatement.java deleted file mode 100644 index 57ca9581e..000000000 --- a/cvsroot/micro/java/sql/CallableStatement.java +++ /dev/null @@ -1,8 +0,0 @@ -package java.sql; - -/* - * Dummy interface for micro package - */ -public interface CallableStatement { - -} diff --git a/cvsroot/micro/java/sql/Clob.java b/cvsroot/micro/java/sql/Clob.java deleted file mode 100644 index 6d1cba43a..000000000 --- a/cvsroot/micro/java/sql/Clob.java +++ /dev/null @@ -1,5 +0,0 @@ -package java.sql; - -public interface Clob { - -} diff --git a/cvsroot/micro/java/sql/Connection.java b/cvsroot/micro/java/sql/Connection.java deleted file mode 100644 index de0a12ef7..000000000 --- a/cvsroot/micro/java/sql/Connection.java +++ /dev/null @@ -1,185 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Connection.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package java.sql; - -/** - * A connection (session) with a specific database. Within the context of a Connection, SQL statements are - * executed and results are returned. - *

    - * A Connection's database is able to provide information describing its tables, its supported SQL grammar, its - * stored procedures, the capabilities of this connection, and so on. This information is obtained with the - * getMetaData method. - *

    - * Note: By default the Connection automatically commits changes after executing each statement. If auto commit - * has been disabled, the method commit must be called explicitly; otherwise, database changes will not be saved. - *

    - * This class contains the smallest useful set of methods and data from java.sql.Connection for a wireless device. - **/ -public interface Connection -{ - /** - * Indicates that transactions are not supported. - **/ - int TRANSACTION_NONE = 0; - - /** - * Dirty reads, non-repeatable reads and phantom reads can occur. This level allows a row changed by one - * transaction to be read by another transaction before any changes in that row have been committed (a "dirty - * read"). If any of the changes are rolled back, the second transaction will have retrieved an invalid row. - **/ - int TRANSACTION_READ_UNCOMMITTED = 1; - - /** - * Dirty reads are prevented; non-repeatable reads and phantom reads can occur. This level only prohibits a - * transaction from reading a row with uncommitted changes in it. - **/ - int TRANSACTION_READ_COMMITTED = 2; - - /** - * Dirty reads and non-repeatable reads are prevented; phantom reads can occur. This level prohibits a - * transaction from reading a row with uncommitted changes in it, and it also prohibits the situation where one - * transaction reads a row, a second transaction alters the row, and the first transaction rereads the row, - * getting different values the second time (a "non-repeatable read"). - **/ - int TRANSACTION_REPEATABLE_READ = 4; - - /** - * Dirty reads, non-repeatable reads and phantom reads are prevented. This level includes the prohibitions in - * TRANSACTION_REPEATABLE_READ and further prohibits the situation where one transaction reads - * all rows that satisfy a WHERE condition, a second transaction inserts a row that satisfies that WHERE - * condition, and the first transaction rereads for the same condition, retrieving the additional "phantom" row - * in the second read. - **/ - int TRANSACTION_SERIALIZABLE = 8; - - /** - * Creates a Statement object for sending SQL statements to the database. SQL statements without - * parameters are normally executed using Statement objects. If the same SQL statement is executed many - * times, it is more efficient to use a PreparedStatement object. - * - * Result sets created using the returned Statement object will by default have forward-only type and - * read-only concurrency. - * - * @return a new Statement object. - * - * @exception SQLException if a database access error occurs. - **/ - Statement createStatement() throws SQLException; - - /** - * Creates a Statement object that will generate ResultSet objects with the given type and concurrency. This - * method is the same as the createStatement method above, but it allows the default result set type and result - * set concurrency type to be overridden. - * - * @param resultSetType a result set type; see ResultSet.TYPE_XXX. - * @param resultSetConcurrency a concurrency type; see ResultSet.CONCUR_XXX. - * - * @return a new Statement object. - * - * @exception SQLException if a database access error occurs. - **/ - Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException; - - /** - * Sets this connection's auto-commit mode. If a connection is in auto-commit mode, then all its SQL - * statements will be executed and committed as individual transactions. Otherwise, its SQL statements are - * grouped into transactions that are terminated by a call to either the method commit or the method - * rollback. By default, new connections are in auto-commit mode. The commit occurs when the statement - * completes or the next execute occurs, whichever comes first. In the case of statements returning a - * ResultSet, the statement completes when the last row of the ResultSet has been retrieved or the ResultSet - * has been closed. In advanced cases, a single statement may return multiple results as well as output - * parameter values. In these cases the commit occurs when all results and output parameter values have - * been retrieved. - * - * @param autoCommit true enables auto-commit; false disables auto-commit.. - * - * @exception SQLException if a database access error occurs. - **/ - void setAutoCommit(boolean autoCommit) throws SQLException; - - /** - * Gets the current auto-commit state. - * - * @return the current state of auto-commit mode. - * - * @exception SQLException if a database access error occurs. - **/ - boolean getAutoCommit() throws SQLException; - - /** - * Makes all changes made since the previous commit/rollback permanent and releases any database locks - * currently held by the Connection. This method should be used only when auto-commit mode has been - * disabled. - * - * @exception SQLException if a database access error occurs. - **/ - void commit() throws SQLException; - - /** - * Drops all changes made since the previous commit/rollback and releases any database locks currently held - * by this Connection. This method should be used only when auto- commit has been disabled. - * - * @exception SQLException if a database access error occurs. - **/ - void rollback() throws SQLException; - - /** - * Releases a Connection's database and JDBC resources immediately instead of waiting for them to be - * automatically released. - * - * Note: A Connection is automatically closed when it is garbage collected. Certain fatal errors also result in - * a closed Connection. - * - * @exception SQLException if a database access error occurs. - **/ - void close() throws SQLException; - - /** - * Tests to see if a Connection is closed. - * - * @return true if the connection is closed; false if it's still open. - * - * @exception SQLException if a database access error occurs. - **/ - boolean isClosed() throws SQLException; - - /** - * Attempts to change the transaction isolation level to the one given. The constants defined in the interface - * Connection are the possible transaction isolation levels. - * - * Note: This method cannot be called while in the middle of a transaction. - * - * @param level one of the TRANSACTION_* isolation values with the exception of - * TRANSACTION_NONE; some databases may not support other values - * - * @exception SQLException if a database access error occurs. - **/ - void setTransactionIsolation(int level) throws SQLException; - - /** - * Gets this Connection's current transaction isolation level. - * - * @return the current TRANSACTION_* mode value. - * - * @exception SQLException if a database access error occurs. - **/ - int getTransactionIsolation() throws SQLException; -} - - - - - - - diff --git a/cvsroot/micro/java/sql/DatabaseMetaData.java b/cvsroot/micro/java/sql/DatabaseMetaData.java deleted file mode 100644 index adf66969d..000000000 --- a/cvsroot/micro/java/sql/DatabaseMetaData.java +++ /dev/null @@ -1,8 +0,0 @@ -package java.sql; - -/* - * Dummy stub for micro edition - */ -public interface DatabaseMetaData { - -} diff --git a/cvsroot/micro/java/sql/Date.java b/cvsroot/micro/java/sql/Date.java deleted file mode 100644 index 68146bd19..000000000 --- a/cvsroot/micro/java/sql/Date.java +++ /dev/null @@ -1,8 +0,0 @@ -package java.sql; - -public class Date extends java.util.Date{ - public Date(long milliseconds) { - super(milliseconds); - } - -} diff --git a/cvsroot/micro/java/sql/DriverManager.java b/cvsroot/micro/java/sql/DriverManager.java deleted file mode 100644 index 3ad621fcc..000000000 --- a/cvsroot/micro/java/sql/DriverManager.java +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DriverManager.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package java.sql; - - -/** - * The basic service for managing a set of JDBC drivers. - * - * When the method getConnection is called, the DriverManager will construct a JdbcMeConnection. - **/ -public class DriverManager -{ - /** - * NOTE - Currently, we know of no other Jdbc drivers for - * the Palm KVM device until we do, we'll simply construct - * JdbcMe connections directly using internal interfaces - * and ignore any other possible drivers. - **/ - - /** - * Create an SQL Connection given the URL identifying the connection properties. - * - * @param url a database url of the form jdbc:subprotocol:subname - * - * @exception SQLException if a database access error occurs. - **/ - public static synchronized Connection getConnection(String url) throws SQLException - { - return com.ibm.as400.micro.JdbcMeDriver.getConnection(url); - } - - /** - * Create an SQL Connection given the URL identifying the connection properties. - * - * @param url A database url of the form jdbc:subprotocol:subname. - * @param user The database user on whose behalf the connection is being made. - * @param password The user's password. - * - * @exception SQLException if a database access error occurs. - **/ - public static synchronized Connection getConnection(String url, String user, String password) throws SQLException - { - return com.ibm.as400.micro.JdbcMeDriver.getConnection(url, user, password); - } -} - diff --git a/cvsroot/micro/java/sql/PreparedStatement.java b/cvsroot/micro/java/sql/PreparedStatement.java deleted file mode 100644 index 89a3bd144..000000000 --- a/cvsroot/micro/java/sql/PreparedStatement.java +++ /dev/null @@ -1,44 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PreparedStatement.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package java.sql; - -/** - * An object that represents a precompiled SQL statement. - *

    - * A SQL statement is precompiled and stored in a PreparedStatement object. This object can then be used to - * efficiently execute this statement multiple times. - *

    - * Note: PreparedStatements are currently not supported. - **/ -public interface PreparedStatement extends Statement -{ -// ResultSet executeQuery() throws SQLException; -// -// int executeUpdate() throws SQLException; -// -// void setString(int parameterIndex, String x) -// throws SQLException; -// -// boolean execute() throws SQLException; -} - - - - - - - - - - diff --git a/cvsroot/micro/java/sql/Ref.java b/cvsroot/micro/java/sql/Ref.java deleted file mode 100644 index e535e66ad..000000000 --- a/cvsroot/micro/java/sql/Ref.java +++ /dev/null @@ -1,5 +0,0 @@ -package java.sql; - -public interface Ref { - -} diff --git a/cvsroot/micro/java/sql/ResultSet.java b/cvsroot/micro/java/sql/ResultSet.java deleted file mode 100644 index 2a8084683..000000000 --- a/cvsroot/micro/java/sql/ResultSet.java +++ /dev/null @@ -1,277 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResultSet.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package java.sql; - -/** - * A table of data representing a database result set, which is usually generated by executing a statement that queries - * the database. - *

    - * A ResultSet object maintains a cursor pointing to its current row of data. Initially the cursor is positioned - * before the first row. The next method moves the cursor to the next row, and because it returns false when - * there are no more rows in the ResultSet object, it can be used in a while loop to iterate through the result set. - *

    - * A default ResultSet object is not updatable and has a cursor that moves forward only. Thus, it is possible to - * iterate through it only once and only from the first row to the last row. New methods in the JDBC 2.0 API make - * it possible to produce ResultSet objects that are scrollable and/or updatable. - *

    - * A ResultSet object is automatically closed when the Statement object that generated it is closed, - * re-executed, or used to retrieve the next result from a sequence of multiple results. - *

    - * The number, types and properties of a ResultSet object's columns are provided by the ResultSetMetaData - * object returned by the ResultSet.getMetaData method. - *

    - * Note:This class contains the smallest useful set of methods and data from java.sql.ResultSet - */ -public interface ResultSet -{ - /** - * The constant indicating the type for a ResultSet object whose cursor may move only forward. - **/ - public final int TYPE_FORWARD_ONLY = 1003; - - /** - * The constant indicating the type for a ResultSet object that is scrollable but generally not sensitive to changes made by others. - **/ - public final int TYPE_SCROLL_INSENSITIVE = 1004; - - /** - * The constant indicating the type for a ResultSet object that is scrollable and generally sensitive to changes made by others. - **/ - public final int TYPE_SCROLL_SENSITIVE = 1005; - - /** - * The constant indicating the concurrency mode for a ResultSet object that may NOT be updated. - **/ - public final int CONCUR_READ_ONLY = 1007; - - /** - * The constant indicating the concurrency mode for a ResultSet object that may be updated. - **/ - public final int CONCUR_UPDATABLE = 1008; - - - /** - * Releases this ResultSet object's database and JDBC resources immediately instead of waiting for this to - * happen when it is automatically closed. - * - * Note: A ResultSet object is automatically closed by the Statement object that generated it when that - * Statement object is closed, re-executed, or is used to retrieve the next result from a sequence of multiple - * results. A ResultSet object is also automatically closed when it is garbage collected. - * - * @exception SQLException if a database access error occurs. - **/ - void close() throws SQLException; - - /** - * Deletes the current row from this ResultSet object and from the underlying database. This method - * cannot be called when the cursor is on the insert row. - * - * @exception SQLException if a database access error occurs or if this method is called when the cursor is on the insert row. - **/ - void deleteRow() throws SQLException; - - /** - * Gets the value of the designated column in the current row of this ResultSet object as a String in the - * Java programming language. - * - * @param column the first column is 1, the second is 2, ... - * - * @return the column value; if the value is SQL NULL, the value returned is null. - * - * @exception SQLException if a database access error occurs. - **/ - String getString(int column) throws SQLException; - - /** - * Gets the value of the designated column in the current row of this ResultSet object as an int in the Java programming language. - * - * @param column the first column is 1, the second is 2, ... - * - * @return the column value; if the value is SQL NULL, the value returned is 0. - * - * @exception SQLException if a database access error occurs. - **/ - int getInt(int column) throws SQLException; - - /** - * Inserts the contents of the insert row into this ResultSet object and into the database. The cursor must - * be on the insert row when this method is called. - * - * @exception SQLException if a database access error occurs, if this method is called when the cursor is not - * on the insert row, or if not all of non-nullable columns in the insert row have been given a value - **/ - void insertRow() throws SQLException; - - /** - * Moves the cursor to the insert row. The current cursor position is remembered while the cursor is - * positioned on the insert row. - * - * @exception SQLException if a database access error occurs or the result set is not updatable. - **/ - void moveToInsertRow() throws SQLException; - - /** - * Moves the cursor to the remembered cursor position, usually the current row. This method has no effect if - * the cursor is not on the insert row. - * - * @exception SQLException if a database access error occurs or the result set is not updatable. - **/ - void moveToCurrentRow() throws SQLException; - - /** - * Moves the cursor down one row from its current position. A ResultSet cursor is initially positioned - * before the first row; the first call to the method next makes the first row the current row; the second call - * makes the second row the current row, and so on. - * - * If an input stream is open for the current row, a call to the method next will implicitly close it. A - * ResultSet object's warning chain is cleared when a new row is read. - * - * @return true if the new current row is valid; false if there are no more rows. - * - * @exception SQLException if a database access error occurs. - **/ - boolean next() throws SQLException; - - /** - * Moves the cursor to the previous row in this ResultSet object. - * - * Note: Calling the method previous() is not the same as calling the method relative(-1) because it - * makes sense to call previous() when there is no current row. - * - * @return true if the cursor is on a valid row; false if it is off the result set. - * - * @exception SQLException if a database access error occurs or the result set type is TYPE_FORWARD_ONLY. - **/ - boolean previous() throws SQLException; - - /** - * Moves the cursor a relative number of rows, either positive or negative. Attempting to move beyond the - * first/last row in the result set positions the cursor before/after the the first/last row. Calling relative(0) is - * valid, but does not change the cursor position. - * - * Note: Calling the method relative(1) is different from calling the method next() because is makes - * sense to call next() when there is no current row, for example, when the cursor is positioned before the - * first row or after the last row of the result set. - * - * @return true if the cursor is on a row; false otherwise. - * - * @exception SQLException if a database access error occurs, there is no current row, or the result set type is TYPE_FORWARD_ONLY. - **/ - boolean relative(int rows) throws SQLException; - - /** - * Moves the cursor to the first row in this ResultSet object. - * - * @return true if the cursor is on a valid row; false if there are no rows in the result set. - * - * @exception SQLException if a database access error occurs or the result set type is TYPE_FORWARD_ONLY. - **/ - boolean first() throws SQLException; - - /** - * Moves the cursor to the last row in this ResultSet object. - * - * @return true if the cursor is on a valid row; false if there are no rows in the result set - * - * @exception SQLException if a database access error occurs or the result set type is TYPE_FORWARD_ONLY. - **/ - boolean last() throws SQLException; - - /** - * Moves the cursor to the given row number in this ResultSet object. - * - * If the row number is positive, the cursor moves to the given row number with respect to the beginning of - * the result set. The first row is row 1, the second is row 2, and so on. - * - * If the given row number is negative, the cursor moves to an absolute row position with respect to the end - * of the result set. For example, calling the method absolute(-1) positions the cursor on the last row; - * calling the method absolute(-2) moves the cursor to the next-to-last row, and so on. - * - * An attempt to position the cursor beyond the first/last row in the result set leaves the cursor before the first - * row or after the last row. - * - * Note: Calling absolute(1) is the same as calling first(). Calling absolute(-1) is the same as calling - * last(). - * - * @return true if the cursor is on the result set; false otherwise. - * - * @exception SQLException if a database access error occurs, the row is 0, or the result set type is TYPE_FORWARD_ONLY. - **/ - boolean absolute(int row) throws SQLException; - - /** - * Updates the designated column with a String value. - * - * @param index the first column is 1, the second is 2, .. - * @param value the new column value. - * - * @exception SQLException if a database access error occurs. - **/ - void updateString(int index, String value) throws SQLException; - - /** - * Updates the designated column with an int value. - * - * @param index the first column is 1, the second is 2, .. - * @param value the new colum value - * - * @exception SQLException if a database access error occurs. - **/ - void updateInt(int index, int value) throws SQLException; - - /** - * Updates the underlying database with the new contents of the current row of this ResultSet object. This - * method cannot be called when the cursor is on the insert row. - * - * @exception SQLException if a database access error occurs or if this method is called when the cursor is on the insert row - **/ - void updateRow() throws SQLException; - - /** - * Returns the type of this ResultSet object. The type is determined by the Statement object that created the result set. - * - * @return TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, or TYPE_SCROLL_SENSITIVE - * - * @exception SQLException if a database access error occurs. - **/ - int getType() throws SQLException; - - /** - * Returns the concurrency mode of this ResultSet object. The concurrency used is determined by the Statement object that created the result set. - * - * @return the concurrency type, either CONCUR_READ_ONLY or CONCUR_UPDATABLE. - * - * @exception SQLException if a database access error occurs. - **/ - int getConcurrency() throws SQLException; - - /** - * Returns the Statement object that produced this ResultSet object. If the result set was generated some - * other way, such as by a DatabaseMetaData method, this method returns null. - * - * @return the Statment object that produced this ResultSet object or null if the result set was produced some other way. - * - * @exception SQLException if a database access error occurs. - **/ - Statement getStatement() throws SQLException; - - /** - * Retrieves the number, types and properties of this ResultSet object's columns. - * - * @return the description of this ResultSet object's columns. - * - * @exception SQLException if a database access error occurs. - **/ - ResultSetMetaData getMetaData() throws SQLException; -} diff --git a/cvsroot/micro/java/sql/ResultSetMetaData.java b/cvsroot/micro/java/sql/ResultSetMetaData.java deleted file mode 100644 index 1dffcc966..000000000 --- a/cvsroot/micro/java/sql/ResultSetMetaData.java +++ /dev/null @@ -1,51 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResultSetMetaData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package java.sql; - - -/** - * An object that can be used to get information about the types and properties of the columns in a ResultSet - * object. The following code fragment creates the ResultSet object rs, creates the ResultSetMetaData object - * rsmd, and uses rsmd to find out how many columns rs has. - * - *

    - *      ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
    - *      ResultSetMetaData rsmd = rs.getMetaData();
    - *      int numberOfColumns = rsmd.getColumnCount();
    - *   
    - * - * Note:This class contains the smallest useful set of methods and data from java.sql.ResultSetMetaData - */ -public interface ResultSetMetaData -{ - /** - * Returns the number of columns in this ResultSet object. - * - * @return the number of columns. - * - * @exception SQLException if a database access error occurs. - **/ - int getColumnCount() throws SQLException; - - /** - * Retrieves the designated column's SQL type. - * - * @param column the first column is 1, the second is 2, ... - * - * @return SQL type from java.sql.Types. - * - * @exception SQLException if a database access error occurs. - **/ - int getColumnType(int column) throws SQLException; -} diff --git a/cvsroot/micro/java/sql/SQLException.java b/cvsroot/micro/java/sql/SQLException.java deleted file mode 100644 index b33d29a07..000000000 --- a/cvsroot/micro/java/sql/SQLException.java +++ /dev/null @@ -1,86 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package java.sql; - -/** - * An exception that provides information on a database access error or other errors. - *

    - * Each SQLException provides several kinds of information: - *

      - *
    • a string describing the error. This is used as the Java Exception message, available via the method getMessage. - *
    • a "SQLstate" string, which follows the XOPEN SQLstate conventions. The values of the SQLState string - * are described in the XOPEN SQL spec, available via the method getSQLState. - *
    - **/ -public class SQLException extends Exception -{ - private String sqlState_; - - - /** - * Constructs a fully-specified SQLException object. - **/ - public SQLException() - { - super(); - sqlState_ = null; - } - - /** - * Constructs an SQLException object with a reason; SQLState defaults to null, and vendorCode defaults to 0. - * - * @param reason a description of the exception. - **/ - public SQLException(String reason) - { - super(reason); - sqlState_ = null; - } - - /** - * Constructs an SQLException object with a reason and SQLState; vendorCode defaults to 0. - * - * @param reason a description of the exception. - * @param sqlState an XOPEN code identifying the exception. - **/ - public SQLException(String reason, String sqlState) - { - super(reason); - sqlState_ = sqlState; - } - - /** - * Retrieves the SQLState for this SQLException object. - * - * @return the SQLState value - **/ - public String getSQLState() - { - return(sqlState_); - } - - /** - * Returns the string representation of this exception. - * - * @return the exception string. - **/ - public String toString() - { - if (sqlState_ != null) - return "[" + sqlState_ + "]:" + getMessage(); - - return getMessage(); - } - -} diff --git a/cvsroot/micro/java/sql/SQLWarning.java b/cvsroot/micro/java/sql/SQLWarning.java deleted file mode 100644 index 5e4c8ca88..000000000 --- a/cvsroot/micro/java/sql/SQLWarning.java +++ /dev/null @@ -1,8 +0,0 @@ -package java.sql; - -/* - * Dummy SQLWarning for micro interface - */ -public interface SQLWarning { - -} diff --git a/cvsroot/micro/java/sql/Savepoint.java b/cvsroot/micro/java/sql/Savepoint.java deleted file mode 100644 index 0dbea6d95..000000000 --- a/cvsroot/micro/java/sql/Savepoint.java +++ /dev/null @@ -1,8 +0,0 @@ -package java.sql; - -/** - * Dummy interface for micro package - */ -public interface Savepoint { - -} diff --git a/cvsroot/micro/java/sql/Statement.java b/cvsroot/micro/java/sql/Statement.java deleted file mode 100644 index be639056f..000000000 --- a/cvsroot/micro/java/sql/Statement.java +++ /dev/null @@ -1,126 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Statement.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package java.sql; - -/** - * The object used for executing a static SQL statement and obtaining the results produced by it. - *

    - * Only one ResultSet object per Statement object can be open at any point in time. Therefore, if the reading of - * one ResultSet object is interleaved with the reading of another, each must have been generated by different - * Statement objects. All statement execute methods implicitly close a statment's current ResultSet object if an - * open one exists. - *

    - * This class contains the smallest useful set of methods and data from java.sql.Statement. - **/ -public interface Statement -{ - /** - * Releases this Statement object's database and JDBC resources immediately instead of waiting for this to - * happen when it is automatically closed. It is generally good practice to release resources as soon as you - * are finished with them to avoid tying up database resources. - * - * Note: A Statement object is automatically closed when it is garbage collected. When a Statement - * object is closed, its current ResultSet object, if one exists, is also closed. - * - * @exception SQLException if a database access error occurs. - **/ - void close() throws SQLException; - - /** - * Executes an SQL statement that may return multiple results. Under some (uncommon) situations a single - * SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless - * you are (1) executing a stored procedure that you know may return multiple results or (2) you are - * dynamically executing an unknown SQL string. The methods execute, getMoreResults, - * getResultSet, and getUpdateCount let you navigate through multiple results. The execute method - * executes an SQL statement and indicates the form of the first result. You can then use the methods - * getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any - * subsequent result(s). - * - * @param sql any SQL statement. - * - * @return true if the next result is a ResultSet object; false if it is an update count or there are no more results. - * - * @exception SQLException if a database access error occurs. - **/ - boolean execute(String sql) throws SQLException; - - /** - * Executes an SQL statement that returns a single ResultSet object. - * - * @param sql typically this is a static SQL SELECT statement. - * - * @return a ResultSet object that contains the data produced by the given query; never null. - * - * @exception SQLException if a database access error occurs. - **/ - ResultSet executeQuery(String sql) throws SQLException; - - /** - * Executes an SQL INSERT, UPDATE or DELETE statement. In addition, SQL statements that return nothing, - * such as SQL DDL statements, can be executed. - * - * @param sql an SQL INSERT, UPDATE or DELETE statement or an SQL statement that returns nothing. - * - * @return either the row count for INSERT, UPDATE or DELETE statements, or 0 for SQL statements that return nothing. - * - * @exception SQLException if a database access error occurs. - **/ - int executeUpdate(String sql) throws SQLException; - - /** - * Returns the Connection object that produced this Statement object. - * - * @return the connection that produced this statement. - * - * @exception SQLException if a database access error occurs. - **/ - Connection getConnection() throws SQLException; - - /** - * Returns the current result as a ResultSet object. This method should be called only once per result. - * - * @return the current result as a ResultSet object; null if the result is an update count or there are no more results. - * - * @exception SQLException if a database access error occurs. - **/ - ResultSet getResultSet() throws SQLException; - - /** - * Retrieves the result set concurrency for ResultSet objects generated by this Statement object. - * - * @return either ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE. - * - * @exception SQLException if a database access error occurs. - **/ - int getResultSetConcurrency() throws SQLException; - - /** - * Retrieves the result set type for ResultSet objects generated by this Statement object. - * - * @return one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE. - * - * @exception SQLException if a database access error occurs. - **/ - int getResultSetType() throws SQLException; - - /** - * Returns the current result as an update count; if the result is a ResultSet object or there are no more - * results, -1 is returned. This method should be called only once per result. - * - * @return the current result as an update count; -1 if the current result is a ResultSet object or there are no more results. - * - * @exception SQLException if a database access error occurs. - **/ - int getUpdateCount() throws SQLException; -} diff --git a/cvsroot/micro/java/sql/Time.java b/cvsroot/micro/java/sql/Time.java deleted file mode 100644 index 68a65572f..000000000 --- a/cvsroot/micro/java/sql/Time.java +++ /dev/null @@ -1,7 +0,0 @@ -package java.sql; - -public class Time extends java.util.Date { - public Time(long milliseconds) { - super(milliseconds); - } -} diff --git a/cvsroot/micro/java/sql/Timestamp.java b/cvsroot/micro/java/sql/Timestamp.java deleted file mode 100644 index 9059b480b..000000000 --- a/cvsroot/micro/java/sql/Timestamp.java +++ /dev/null @@ -1,5 +0,0 @@ -package java.sql; - -public class Timestamp extends java.util.Date{ - -} diff --git a/cvsroot/micro/java/sql/Types.java b/cvsroot/micro/java/sql/Types.java deleted file mode 100644 index 3f7243113..000000000 --- a/cvsroot/micro/java/sql/Types.java +++ /dev/null @@ -1,156 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Types.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package java.sql; - -/** - * The class that defines the constants that are used to identify generic SQL types, called JDBC types. The actual - * type constant values are equivalent to those in XOPEN. - **/ -public class Types -{ - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type BIT. - **/ - public final static int BIT = -7; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type TINYINT. - **/ - public final static int TINYINT = -6; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type SMALLINT. - **/ - public final static int SMALLINT = 5; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type INTEGER. - **/ - public final static int INTEGER = 4; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type BIGINT. - **/ - public final static int BIGINT = -5; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type FLOAT. - **/ - public final static int FLOAT = 6; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type REAL. - **/ - public final static int REAL = 7; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type DOUBLE. - **/ - public final static int DOUBLE = 8; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type NUMERIC. - **/ - public final static int NUMERIC = 2; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type DECIMAL. - **/ - public final static int DECIMAL = 3; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type CHAR. - **/ - public final static int CHAR = 1; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type VARCHAR. - **/ - public final static int VARCHAR = 12; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type LONGVARCHAR. - **/ - public final static int LONGVARCHAR = -1; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type DATE. - **/ - public final static int DATE = 91; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type TIME. - **/ - public final static int TIME = 92; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type TIMESTAMP. - **/ - public final static int TIMESTAMP = 93; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type BINARY. - **/ - public final static int BINARY = -2; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type VARBINARY. - **/ - public final static int VARBINARY = -3; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type LONGVARBINARY. - **/ - public final static int LONGVARBINARY = -4; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type NULL. - **/ - public final static int NULL = 0; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type JAVA_OBJECT. - **/ - public final static int JAVA_OBJECT = 2000; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type DISTINCT. - **/ - public final static int DISTINCT = 2001; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type STRUCT. - **/ - public final static int STRUCT = 2002; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type ARRAY. - **/ - public final static int ARRAY = 2003; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type BLOB. - **/ - public final static int BLOB = 2004; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type CLOB. - **/ - public final static int CLOB = 2005; - - /** - * The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type REF. - **/ - public final static int REF = 2006; -} diff --git a/cvsroot/micro/java/sql/package.html b/cvsroot/micro/java/sql/package.html deleted file mode 100644 index 6259e0757..000000000 --- a/cvsroot/micro/java/sql/package.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - -Provides stubs for SQL classes that are required by the com.ibm.as400.micro package. -These server as a replacement for a "real" java.sql package, until such time as one -exists on the various micro-JVM platforms. - -

    Related Documentation

    - -For overviews, tutorials, examples, guides, and tool documentation, please see: - - - - diff --git a/cvsroot/micro/java/util/Map.java b/cvsroot/micro/java/util/Map.java deleted file mode 100644 index e2d3525eb..000000000 --- a/cvsroot/micro/java/util/Map.java +++ /dev/null @@ -1,7 +0,0 @@ -package java.util; -/** - * Dummy interface for micro package - */ -public interface Map { - -} diff --git a/cvsroot/pcml/.project b/cvsroot/pcml/.project deleted file mode 100644 index ea533bdcb..000000000 --- a/cvsroot/pcml/.project +++ /dev/null @@ -1,11 +0,0 @@ - - - pcml - - - - - - - - diff --git a/cvsroot/pcml/NetServer.pcml b/cvsroot/pcml/NetServer.pcml deleted file mode 100644 index 0294814e9..000000000 --- a/cvsroot/pcml/NetServer.pcml +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/pcml/RJavaProgram.pcml b/cvsroot/pcml/RJavaProgram.pcml deleted file mode 100644 index 9e2463bed..000000000 --- a/cvsroot/pcml/RJavaProgram.pcml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/pcml/RJob.pcml b/cvsroot/pcml/RJob.pcml deleted file mode 100644 index 5139f37c8..000000000 --- a/cvsroot/pcml/RJob.pcml +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/pcml/RJobList.pcml b/cvsroot/pcml/RJobList.pcml deleted file mode 100644 index 0ac558c15..000000000 --- a/cvsroot/pcml/RJobList.pcml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/pcml/RJobLog.pcml b/cvsroot/pcml/RJobLog.pcml deleted file mode 100644 index 553e7aba6..000000000 --- a/cvsroot/pcml/RJobLog.pcml +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/pcml/RMessageQueue.pcml b/cvsroot/pcml/RMessageQueue.pcml deleted file mode 100644 index 6355c1ee4..000000000 --- a/cvsroot/pcml/RMessageQueue.pcml +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/pcml/RPrinter.pcml b/cvsroot/pcml/RPrinter.pcml deleted file mode 100644 index ea4b0759b..000000000 --- a/cvsroot/pcml/RPrinter.pcml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/pcml/RPrinterList.pcml b/cvsroot/pcml/RPrinterList.pcml deleted file mode 100644 index d7c317f44..000000000 --- a/cvsroot/pcml/RPrinterList.pcml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/pcml/RSoftwareResource.pcml b/cvsroot/pcml/RSoftwareResource.pcml deleted file mode 100644 index 757c9fca7..000000000 --- a/cvsroot/pcml/RSoftwareResource.pcml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/pcml/RUser.pcml b/cvsroot/pcml/RUser.pcml deleted file mode 100644 index c99abf3c8..000000000 --- a/cvsroot/pcml/RUser.pcml +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/pcml/RUserList.pcml b/cvsroot/pcml/RUserList.pcml deleted file mode 100644 index 73746e9c8..000000000 --- a/cvsroot/pcml/RUserList.pcml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/pcml/qcdrcmdd.pcml b/cvsroot/pcml/qcdrcmdd.pcml deleted file mode 100644 index 9aa4ad161..000000000 --- a/cvsroot/pcml/qcdrcmdd.pcml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/pcml/qsyrusri.pcml b/cvsroot/pcml/qsyrusri.pcml deleted file mode 100644 index 3b006f3bc..000000000 --- a/cvsroot/pcml/qsyrusri.pcml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/cvsroot/pcml/qszrtvpr.pcml b/cvsroot/pcml/qszrtvpr.pcml deleted file mode 100644 index c11b5ebe3..000000000 --- a/cvsroot/pcml/qszrtvpr.pcml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/pcml/quhrhlpt.pcml b/cvsroot/pcml/quhrhlpt.pcml deleted file mode 100644 index f970e87e5..000000000 --- a/cvsroot/pcml/quhrhlpt.pcml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/pcml/quslfld.pcml b/cvsroot/pcml/quslfld.pcml deleted file mode 100644 index cbf9d14ce..000000000 --- a/cvsroot/pcml/quslfld.pcml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - diff --git a/cvsroot/readme.html b/cvsroot/readme.html deleted file mode 100644 index 63f774574..000000000 --- a/cvsroot/readme.html +++ /dev/null @@ -1,277 +0,0 @@ - - -JTOpen README - - -

    IBM Toolbox for Java - JTOpen Version

    -
    -Copyright (C) 1997-2011 International Business Machines Corporation and
    -others. All rights reserved.
    -
    -File: README
    -Last updated: 2011-01-11
    -
    -The term "JTOpen" refers to the open source software product "IBM Toolbox for Java"
    -plus any additional Enhancements provided by the open source community.
    -JTOpen, which is governed by the IBM Public License, as well as its Java source code,
    -is contained in the open source repository located off of:
    -http://jt400.sourceforge.net/
    -
    -The terms "Toolbox" and "Toolbox LPP" refer to the IBM Licensed Program Product
    -"IBM Toolbox for Java", which is supported by IBM and can be obtained from the
    -IBM Toolbox for Java web site:
    -http://www.ibm.com/systems/i/software/toolbox/
    -
    -

    Contents

    - -What is the Toolbox? - -Why Open Source? - -Differences between JTOpen and the Toolbox LPP - -Download and installation of JTOpen - Requirements - Files - Building and Using JTOpen - Using the Toolbox LPP - -Support information - - -

    What is the Toolbox?

    - -The IBM Toolbox for Java is a set of Java classes that allow you to -access IBM i, i5/OS, or OS/400 data through a Java program. With these classes, -you can write client/server applications, applets, and servlets that work -with data on your IBM i, i5/OS, or OS/400 system. You can also run Java -applications that use the IBM Toolbox for Java on the IBM i, i5/OS, or -OS/400 Java Virtual Machine. - -The Toolbox is available as an installable licensed program for the AS/400 -as of OS/400 V4R2 and the iSeries as of OS/400 V5R1. Here is a breakdown of -Toolbox releases versus operating system versions: - -Toolbox Installs on Connects to -release LPP release OS/400 version OS/400 version -------- -------------- -------------- -------------- -V4R2 5763JC1 V3R2M0 V3R2 and up V3R2 and up -V4R3 5763JC1 V3R2M1 V3R2 and up V3R2 and up -V4R4 5769JC1 V4R2M0 V4R2 and up V4R2 and up -V4R5 5769JC1 V4R5M0 V4R3 and up V4R2 and up -V5R1 5722JC1 V5R1M0 V4R4 and up V4R3 and up -V5R2 5722JC1 V5R2M0 V4R5 and up V4R5 and up -V5R3(*) 5722JC1 V5R3M0 V5R1 and up V5R1 and up -V5R4(**) 5722JC1 V5R4M0 V5R2 and up V5R2 and up -JTOpen 1.x Not applicable Not applicable V4R3 and up -JTOpen 2.x Not applicable Not applicable V4R4 and up -JTOpen 3.x Not applicable Not applicable V4R5 and up -JTOpen 4.0-4.2 Not applicable Not applicable V4R5 and up -JTOpen 4.3-4.7 5722JC1 V5R3M0 V5R1 and up V5R1 and up -JTOpen 4.8+ 5722JC1 V5R4M0 V5R2 and up V5R2 and up -JTOpen 6.1+ 5761JC1 V6R1M0 V5R3 and up V5R3 and up -JTOpen 7.0+ 5770SS1 V7R1M0 V5R4 and up V5R4 and up - -(*) Note: Toolbox release V5R3 is equivalent to JTOpen 4.3. -(**) Note: Toolbox release V5R4 is equivalent to JTOpen 4.8. - - Note: As of IBM i 7.1 (V7R1), the "JC1" product is no longer shipped. - The Toolbox LPP is available under product 5770SS1 Option 3. - -Newer versions of the Toolbox are backwards-compatible with earlier -versions. Upgrading to a newer version is usually recommended, with the one -main exception being that the Toolbox is only supported for connection -to servers running an in-service release of i5/OS or OS/400. - - -

    Why Open Source?

    - -We have chosen to make the Toolbox code open source for the following reasons: - -1. To obtain new functions and features from the Toolbox user community. - -2. To respond with customer and business partners requirements as rapidly - as possible. - -3. To improve the ability for our customers to build and debug their own - applications when using the Toolbox functions. - -4. To continue the drive to keep the IBM i platform a leader with Java technology - for application development. - -

    Differences between JTOpen and the Toolbox LPP

    - -1. The initial release of the source code for JTOpen used the V4R5 - Toolbox codebase. That is, the Java code in the open source repository - is the same code that was used to build the V4R5 Toolbox LPP. JTOpen 2.0x - uses the V5R1 Toolbox as its codebase. The latest release of JTOpen - (JTOpen 7.x) uses the V7R1 Toolbox as its codebase. - -2. When bugs are reported, fixes will be committed to JTOpen as soon as - they are realized. When applicable, these same fixes will be committed - to the Toolbox LPP and made available in a future PTF or service pack. - -3. Any new functionality that is committed to JTOpen will be subsequently - added, when applicable, into the Toolbox LPP and made available in a - future PTF or service pack. - - Note: All changes to JTOpen are made under the control and at the - discretion of the JTOpen Core Team. All changes to the Toolbox LPP - are made under the control and at the discretion of IBM. - -4. In general, the Toolbox LPP is supported directly by IBM. JTOpen - is supported by the JTOpen user community, in which IBM participates - and contributes, specifically through developer email, the JTOpen - mailing list, and the JTOpen Web forum - -5. Pursuant to the IBM Public License, programmers are free to alter the - JTOpen source code and to distribute it with their own applications. - -

    Download and installation of JTOpen

    - -

    Requirements

    -Briefly, the requirements for using the JTOpen code are as follows: - -1. A Java Virtual Machine (JVM) with a 1.4.x or higher JDK/JRE. The JTOpen - team highly recommends moving to the latest supported release of the JDK/JRE, as - maintaining backwards-compatible code with older releases becomes - increasingly difficult to support over time. - -2. Almost all JTOpen functions require a TCP/IP connection to an IBM i server. - - a. The server must be IBM i, i5/OS, or OS/400 V4R3 or higher. - - b. The server must have the Option 12 Host Servers installed and - running. JTOpen uses the host servers as TCP/IP endpoints to - communicate with the server from a client. - - c. If the Java application using JTOpen is being run directly on a server - running IBM i, i5/OS, or OS/400, then certain JTOpen functions might use - native API and/or local socket calls to improve performance. - This will only occur under certain conditions, and only if the file - jt400Native.jar is included in the application's CLASSPATH. - -3. For GUI programming, either Java 2 or Swing 1.1 or higher is required. - -

    Files

    -JTOpen is comprised of the following files: - -Jar file Contents --------- -------- - - -jtopen_x_x_source.zip This is a zip file of all the source files in the repository. - It is not a Java jar file. - -jtopen_x_x_javadoc.zip This is a zip file of the javadoc (in HTML format) for - the JTOpen source files. It is not a Java jar file. - -jt400.jar(*) This is the main JTOpen jar file. It contains almost all open - source code (except for the few Toolbox classes that could - not be open-sourced), including the utilities package, - and the JDBC driver (JDBC 3.0). - -jt400Micro.jar(*) This contains the ToolboxME (Micro Edition) classes for - use on a handheld device. - -jt400Native.jar(*) Previously known as jt400Access.zip, this jar does not - contain the vaccess package. It does contain the native - optimization classes necessary for running performance-enhanced - applications on IBM i, i5/OS, or OS/400 JVM. - -jt400Proxy.jar(*) This jar contains just the classes needed to run a client - application using the Toolbox proxy server. It is - especially useful in environments where a smaller jar - is needed. - -jt400Servlet.jar(*) This jar contains the html and servlet packages. - -jui400.jar(*) Contains the PDML runtime packages as provided by - the Graphical Toolbox. - -uitools.jar(*) Contains the GUI Builder packages as provided by the - Graphical Toolbox. - -util400.jar(*) Contains various utilities. - -composer.jar(*) Contains XSL stylesheet composer classes. - -reportwriter.jar(*) Contains XSL report processor classes. - -outputwriters.jar(*) Contains PDF, PCL, and font classes. - -tes.jar(*) Contains the IBM i Graphical Debugger. - -jtopen_x_x_jdbc40_jdk6.zip This zip file contains versions of jt400.jar and - jt400Native.jar (along with source code) that are - compatible for use with JDBC 4.0. This zip file - requires that you be running on Java 6.0 or higher. - - -(*) Files contained in file jtopen_x_x.zip. - -There are additional jar files shipped in the download for JTOpen off of the Toolbox -downloads page. Those jar files do not (yet) contain JTOpen code. They are -provided as a convenience to the developer and to mirror the objects that ship -with the Toolbox LPP. - - -

    Building and Using JTOpen

    -Instructions for using JTOpen: -1. Download the JTOpen jt400.jar. -2. Add it to your CLASSPATH. -3. Run your application. - -Instructions for building all or part of the JTOpen source code: -Note: Complete build instructions are specified in the commentary in file - /build/build.xml -1. Download the JTOpen jt400.jar. -2. Download any source files you want to change. The src.zip file includes - all of the source in the repository for convenience. -3. Set up your CLASSPATH to include everything in the correct order: - a. Your source files should be in your CLASSPATH first. Note that you - cannot point to src.zip - you must unzip it, since it contains only - source files. - b. Next, add jt400.jar. - c. Your CLASSPATH should look something like this: - CLASSPATH=C:\jt400\MyApp;C:\jt400\jt400.jar;... -4. Compile your source. -5. Run your application. - -

    Support information

    - -Documentation for JTOpen can be found on the Toolbox -web site at http://www.ibm.com/systems/i/software/toolbox/ - -The JTOpen Web forum is available off of -http://www.ibm.com/systems/support/i/ under the "Forums" link. - -To subscribe/unsubscribe or view information about the JTOpen mailing list, -see https://lists.sourceforge.net/lists/listinfo/jt400-news -Please do not send messages to the JTOpen mailing list, as they will be bounced. -Instead, post your comments and questions to the JTOpen Web forum. - -For bug reports, please use the JTOpen bug database located at -http://sourceforge.net/tracker/?group_id=128806&atid=712772 -Other enhancements or fixes can be sent to rchjt400@us.ibm.com (monitored weekly) -or posted to the JTOpen Web forum (monitored daily). - - - -
    - - diff --git a/cvsroot/src/.classpath b/cvsroot/src/.classpath deleted file mode 100644 index 0cf4d69c7..000000000 --- a/cvsroot/src/.classpath +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/cvsroot/src/.project b/cvsroot/src/.project deleted file mode 100644 index 0f6f6a765..000000000 --- a/cvsroot/src/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - src - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/cvsroot/src/.settings/org.eclipse.jdt.core.prefs b/cvsroot/src/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c45f7fac7..000000000 --- a/cvsroot/src/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,77 +0,0 @@ -#Fri Nov 12 10:39:04 CST 2010 -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -<<<<<<<=org.eclipse.jdt.core.prefs -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning ->>>>>>>=1.2 -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.source=1.3 -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.fieldHiding=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning -org.eclipse.jdt.core.compiler.compliance=1.4 -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled -=\=\=\=\=\=\= diff --git a/cvsroot/src/com/ibm/as400/access/AAClientAccessDataStreamStress.java b/cvsroot/src/com/ibm/as400/access/AAClientAccessDataStreamStress.java deleted file mode 100644 index 4432ded9a..000000000 --- a/cvsroot/src/com/ibm/as400/access/AAClientAccessDataStreamStress.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.Hashtable; -import java.util.Random; - -/* Testcase to stress the ClientAccessDataStream */ - -public class AAClientAccessDataStreamStress implements Runnable { - public static void main(String[] args) { - Hashtable replyStreams = new Hashtable(); - ClientAccessDataStream x = DBDSPool.getDBReplyRequestedDS(); - replyStreams.put(x,x); - System.out.println("Usage: AAClientAccessDataStreamStress "); - System.out.println("Starting. replyStreams.size() = "+replyStreams.size()); - try { - int threadCount = Integer.parseInt(args[0]); - int seconds = Integer.parseInt(args[1]); - System.out.println("Running using "+threadCount+" threads for "+seconds+" seconds"); - - AAClientAccessDataStreamStress[] runnable = new AAClientAccessDataStreamStress[threadCount]; - Thread[] threads = new Thread[threadCount]; - long[] operationCount = new long[threadCount]; - for (int i = 0; i < threadCount; i++) { - runnable[i] = new AAClientAccessDataStreamStress(replyStreams, i); - threads[i] = new Thread( runnable[i]); - } - for (int i = 0; i < threadCount; i++) { - threads[i].start(); - } - - long endTime = System.currentTimeMillis() + seconds * 1000; - int elapsedSeconds = 0; - while (System.currentTimeMillis() < endTime) { - Thread.sleep(1000); - elapsedSeconds++; - System.out.print(elapsedSeconds); - for (int i = 0; i < threadCount; i++) { - long count = runnable[i].getOperationCount(); - if (count == operationCount[i]) { - System.out.println("Thread "+i+" has stalled"); - } else { - operationCount[i] = count; - } - System.out.print(" "+count); - } - System.out.println(); - } - - System.out.println("Runtime over attempting to close clients"); - for (int i = 0; i < threadCount; i++) { - runnable[i].shutdown(); - } - - - for (int i = 0; i < threadCount; i++) { - System.out.println("Thread "+i+" did "+runnable[i].getOperationCount()+" operations"); - } - - System.out.println("Ending. replyStreams.size() = "+replyStreams.size()); - System.out.println("DBDSPool.dbreplyretruneddsPool size is "+DBDSPool.dbreplyrequesteddsPool_.length); - System.out.println("DONE"); - - } catch (Exception e) { - e.printStackTrace(); - } - - - } - - - public static byte[][] sampleBytes = { - - /* Corrupted data */ - { - - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0xA2,(byte)0x00,(byte)0x00,(byte)0xE0,(byte)0x04, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01, (byte)0x00,(byte)0x14,(byte)0x28,(byte)0x00,(byte)0x81,(byte)0x04,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x1F,(byte)0x80, - (byte)0x1F,(byte)0x80,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x7A,(byte)0x38,(byte)0x04,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x01,(byte)0xF0,(byte)0x00,(byte)0x25,(byte)0x00,(byte)0x00,(byte)0xC5, (byte)0xD5,(byte)0xE4,(byte)0x5C,(byte)0xC8,(byte)0xC5,(byte)0xE7,(byte)0x40,(byte)0x40, (byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40, (byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0xF2,(byte)0xF9, - (byte)0xF2,(byte)0xF4,(byte)0xE5,(byte)0xF6,(byte)0xD9,(byte)0xF1,(byte)0xD4,(byte)0xF0, (byte)0xF0,(byte)0xF0,(byte)0xF1,(byte)0xF4,(byte)0xD9,(byte)0xC3,(byte)0xC8,(byte)0xC1, (byte)0xE2,(byte)0xE3,(byte)0xD4,(byte)0xC9,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40, (byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40, - (byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40, (byte)0xD8,(byte)0xE9,(byte)0xC4,(byte)0xC1,(byte)0xE2,(byte)0xD6,(byte)0xC9,(byte)0xD5, (byte)0xC9,(byte)0xE3,(byte)0xD8,(byte)0xE4,(byte)0xE2,(byte)0xC5,(byte)0xD9,(byte)0x40, (byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0xF4,(byte)0xF6,(byte)0xF9,(byte)0xF3, - (byte)0xF0, (byte)0xF7}, - - { (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x20,(byte)0x01,(byte)0x02,(byte)0xE0,(byte)0x04, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x0C,(byte)0xF0,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x58,(byte)0x13,(byte)0xD6,(byte)0xC1,(byte)0x7C,(byte)0x8A,(byte)0x91,(byte)0x54,}, - - {(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x28,(byte)0x00,(byte)0x00,(byte)0xE0,(byte)0x04, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x2C,(byte)0xBF, (byte)0x00,(byte)0x14,(byte)0x28,(byte)0x00,(byte)0x80,(byte)0x04,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x03,(byte)0x1D,(byte)0x02, - 0x1D,0x02,0x00,0x00,0x00,0x00,0x00,0x00}, - - { - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0xB6,(byte)0x00,(byte)0x00,(byte)0xE0,(byte)0x04, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x2C,(byte)0xB7, (byte)0x00,(byte)0x14,(byte)0x28,(byte)0x00,(byte)0x82,(byte)0x04,(byte)0x80,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x18,(byte)0x05, - (byte)0x18,(byte)0x05,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x8E,(byte)0x38,(byte)0x07,(byte)0xE2,(byte)0xD8, (byte)0xD3,(byte)0xC3,(byte)0xC1,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x88,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x20, - (byte)0x00,(byte)0x0A,(byte)0xC4,(byte)0xD8,(byte)0x6D,(byte)0xE3,(byte)0xD9,(byte)0xF0, (byte)0xF0,(byte)0xF0,(byte)0xF0,(byte)0xF1,(byte)0x00,(byte)0x0A,(byte)0xD5,(byte)0xE8, (byte)0xC2,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0xD8,(byte)0xE2, (byte)0xD8,(byte)0xE4,(byte)0xD7,(byte)0xC4,(byte)0xC1,(byte)0xE3,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x00,(byte)0xF7,(byte)0xF9,(byte)0xF5,(byte)0xF7,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40 , - (byte)0x40,(byte)0xF0,(byte)0xF0,(byte)0xF0,(byte)0xF0,(byte)0xF0 - }, - - - - - { - (byte)0x00,(byte)0x00,(byte)0x01,(byte)0x89,(byte)0x00,(byte)0x00,(byte)0xE0,(byte)0x04, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x2C,(byte)0xB5, (byte)0x00,(byte)0x14,(byte)0x28,(byte)0x00,(byte)0x8A,(byte)0x84,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x18,(byte)0x03, - (byte)0x18,(byte)0x03,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x8E,(byte)0x38,(byte)0x07,(byte)0xE2,(byte)0xD8, (byte)0xD3,(byte)0xC3,(byte)0xC1,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x88,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x14, - (byte)0x00,(byte)0x12,(byte)0xE2,(byte)0xE3,(byte)0xD4,(byte)0xE3,(byte)0xF0,(byte)0xF0, (byte)0xF0,(byte)0xF1,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40, (byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0xD8,(byte)0xE2, (byte)0xD8,(byte)0xD7,(byte)0xD9,(byte)0xC5,(byte)0xD7,(byte)0x40,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x03,(byte)0xF7,(byte)0xF9,(byte)0xF6,(byte)0xF7,(byte)0x40,(byte)0x40, (byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40, (byte)0x40,(byte)0xF0,(byte)0xF0,(byte)0xF0,(byte)0xF0,(byte)0xF0,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x06,(byte)0x38,(byte)0x12,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0xCD, - (byte)0x38,(byte)0x13,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x03,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x37,(byte)0x00,(byte)0x30,(byte)0x01,(byte)0xF1,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x04,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x09,(byte)0x00,(byte)0x00, - (byte)0xF0,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x90,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x0D,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x30,(byte)0x01,(byte)0x89,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x1A,(byte)0x00,(byte)0x1A,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x25, (byte)0xF0,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x6D,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x0D,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x30,(byte)0x01,(byte)0xC5,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x19,(byte)0x00,(byte)0x19,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x25, - (byte)0xF0,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x4A,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x0D,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x0D,(byte)0x38,(byte)0x40, (byte)0x00,(byte)0x00,(byte)0xF0,(byte)0xF0,(byte)0xF0,(byte)0xF0,(byte)0xF1,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x0D,(byte)0x38,(byte)0x40,(byte)0x00,(byte)0x00,(byte)0xF0, (byte)0xF0,(byte)0xF0,(byte)0xF0,(byte)0xF2,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x0D, - (byte)0x38,(byte)0x40,(byte)0x00,(byte)0x00,(byte)0xF0,(byte)0xF0,(byte)0xF0,(byte)0xF0 ,(byte)0xF3 }, - - - - { - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0xD6,(byte)0x00,(byte)0x00,(byte)0xE0,(byte)0x04, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x2C,(byte)0xAE, (byte)0x00,(byte)0x14,(byte)0x28,(byte)0x00,(byte)0x86,(byte)0x04,(byte)0x80,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x04,(byte)0x18,(byte)0x0E, - (byte)0x18,(byte)0x0E,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x8E,(byte)0x38,(byte)0x07,(byte)0xE2,(byte)0xD8, (byte)0xD3,(byte)0xC3,(byte)0xC1,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x88,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x1C, - (byte)0x00,(byte)0x12,(byte)0xE2,(byte)0xC3,(byte)0xD9,(byte)0xE2,(byte)0xD9,(byte)0xF0, (byte)0xF0,(byte)0xF0,(byte)0xF4,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40, (byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0xD8,(byte)0xE2, (byte)0xD8,(byte)0xC6,(byte)0xC5,(byte)0xE3,(byte)0xC3,(byte)0xC8,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x04,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x00,(byte)0xF7,(byte)0xF9,(byte)0xF6,(byte)0xF3,(byte)0x40,(byte)0x40, (byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40,(byte)0x40, (byte)0x40,(byte)0xF0,(byte)0xF0,(byte)0xF0,(byte)0xF0,(byte)0xF0,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x20,(byte)0x38,(byte)0x0E,(byte)0x00,(byte)0x00,(byte)0x06,(byte)0x61, - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x02 ,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x04 ,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x24,(byte)0x4E - }, - - - - { - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x48,(byte)0x00,(byte)0x00,(byte)0xE0,(byte)0x04, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x2C,(byte)0xA3, (byte)0x00,(byte)0x14,(byte)0x28,(byte)0x00,(byte)0x84,(byte)0x04,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x04,(byte)0x18,(byte)0x0B, - (byte)0x18,(byte)0x0B,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x20,(byte)0x38,(byte)0x0E,(byte)0x00,(byte)0x00, (byte)0x06,(byte)0x5F,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x01, (byte)0x00,(byte)0x02,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x04,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x24,(byte)0x4B - } - - - }; - - - - private Hashtable replyStreams_; - private Hashtable instanceReplyStreams_ = new Hashtable(); - private int threadId_; - private long operationCount = 0; - private boolean running = true; - public AAClientAccessDataStreamStress(Hashtable replyStreams, int threadId) { - threadId_ = threadId; - replyStreams_=replyStreams; - } - - - synchronized public long getOperationCount() { - return operationCount; - } - synchronized public void shutdown() { - running = false; - } - public void run() { - Random r = new Random(); - try { - while (running) { - - int whichOne = r.nextInt(sampleBytes.length); - /* Randomly read in the datastream and verify that it is correct */ - - InputStream is = new ByteArrayInputStream(sampleBytes[whichOne]); - ClientAccessDataStream stream = ClientAccessDataStream - .construct(is, instanceReplyStreams_, replyStreams_, - null, threadId_); - stream.returnToPool(); - operationCount++; - } - - System.out.println("Thread "+threadId_+" is done: instanceReplyStreams.size() = "+instanceReplyStreams_.size()); - System.out.println("Thread "+threadId_+" is done: replyStreams.size() = "+replyStreams_.size()); - - } catch (Exception e) { - System.out.println("Thread "+threadId_+" failed with exception"); - e.printStackTrace(); - - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AFPResource.java b/cvsroot/src/com/ibm/as400/access/AFPResource.java deleted file mode 100644 index c6b674279..000000000 --- a/cvsroot/src/com/ibm/as400/access/AFPResource.java +++ /dev/null @@ -1,231 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AFPResource.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.beans.PropertyVetoException; - -/** - * The AFPResource class represents a system AFP resource. - * An instance of this class can be used to manipulate an individual - * IBM i AFP resource. - * - * See AFP Resource Attributes for - * valid attributes. - * - **/ - -public class AFPResource extends PrintObject -implements java.io.Serializable -{ - static final long serialVersionUID = 4L; - - public static final String STR_FNTRSC = "FNTRSC"; - public static final String STR_FORMDF = "FORMDF"; - public static final String STR_OVL = "OVL"; - public static final String STR_PAGDFN = "PAGDFN"; - public static final String STR_PAGSEG = "PAGSEG"; - private static final String PATH = "path"; - - // constructor used internally (not externalized since it takes - // an ID code point) - AFPResource(AS400 system, NPCPIDAFPResource id, NPCPAttribute attrs) - { - super(system, id, attrs, NPConstants.RESOURCE); - } - - - /** - * Constructs an AFPResource object. The system and the - * integrated file system name of the AFP resource must be set - * later. This constructor is provided for visual application - * builders that support JavaBeans. It is not intended for use - * by application programmers. - * - * @see PrintObject#setSystem - * @see #setPath - **/ - public AFPResource() - { - super(null, null, NPConstants.RESOURCE); - - // Because of this constructor we will need to check the - // run time state of AFPResource objects. - } - - - - /** - * Constructs an AFPResource object. It uses the system and - * resource name that identify it on that system. - * The system referenced by system must be at V3R7 or later to - * support using AFP resources. - * - * @param system The system on which this AFP resource exists. - * @param resourceName The integrated file system name of the AFP resource. The format of - * the resource string must be in the format of "/QSYS.LIB/libname.LIB/resourcename.type". - * Valid values for type include FNTRSC, FORMDF, OVL, PAGSEG, and PAGDFN. - * - **/ - public AFPResource(AS400 system, - String resourceName) - { - super(system, buildIDCodePoint(resourceName), null, NPConstants.RESOURCE); - - // The base class constructor checks for null system. - // QSYSObjectPathName() checks for a null resourceName. - } - - - - private static NPCPIDAFPResource buildIDCodePoint(String IFSResourceName) - { - QSYSObjectPathName ifsPath = new QSYSObjectPathName(IFSResourceName); - - return new NPCPIDAFPResource(ifsPath.getObjectName(), - ifsPath.getLibraryName(), - ifsPath.getObjectType()); - } - - - /** - * Chooses the appropriate implementation. - **/ - void chooseImpl() - throws IOException, AS400SecurityException - { - // We need to get the system to connect to... - AS400 system = getSystem(); - if (system == null) { - Trace.log( Trace.ERROR, "Attempt to use AFPResource before setting system." ); - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - impl_ = (PrintObjectImpl) system.loadImpl2("com.ibm.as400.access.AFPResourceImplRemote", - "com.ibm.as400.access.AFPResourceImplProxy"); - super.setImpl(); - } - - - - /** - * Returns an input stream that can be used to read the contents of the - * AFP resource. - * - * @return The input stream object that can be used to read the contents - * of this AFP resource. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because - * the system operating system is not at the correct level. - **/ - public PrintObjectInputStream getInputStream() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - PrintObjectInputStream is = new PrintObjectInputStream(this, null); - return is; - } - - - - /** - * Returns the name of the AFP resource. - * - * @return The name of the AFP resource. - **/ - public String getName() - { - NPCPID IDCodePoint = getIDCodePoint(); - - if( IDCodePoint == null ) { - return PrintObject.EMPTY_STRING; // "" - } else { - return IDCodePoint.getStringValue(ATTR_RSCNAME); - } - } - - - - /** - * Returns the integrated file system pathname of the AFP resource. - * - * @return The integrated file system pathname of the AFP resource. - **/ - public String getPath() - { - // the type of an AFP resource is stored as an INT so we - // use the special getResourceType() method to get that - - NPCPID IDCodePoint = getIDCodePoint(); - - if( IDCodePoint == null ) { - return PrintObject.EMPTY_STRING; // "" - } else { - return QSYSObjectPathName.toPath( - IDCodePoint.getStringValue(ATTR_RSCLIB), // library name - IDCodePoint.getStringValue(ATTR_RSCNAME), // resource name - ((NPCPIDAFPResource)(IDCodePoint)).getResourceType() ); // type as String - } - } - - - - /** - * Sets the integrated file system pathname of the AFP resource. - * - * @param path The integrated file system name of the AFP resource. The format of - * the resource string must be in the format of "/QSYS.LIB/libname.LIB/resourcename.type". - * Valid values for type include FNTRSC, FORMDF, OVL, PAGSEG, and PAGDFN. - * - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setPath(String path) - throws PropertyVetoException - { - if( path == null ) - { - Trace.log( Trace.ERROR, "Parameter 'path' is null" ); - throw new NullPointerException( PATH ); - } - - // check for connection... - if (impl_ != null) { - Trace.log(Trace.ERROR, "Cannot set property 'path' after connect."); - throw new ExtendedIllegalStateException( PATH , ExtendedIllegalStateException.PROPERTY_NOT_CHANGED ); - } - - String oldPath = getPath(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( PATH, oldPath, path ); - - // no one vetoed, make the change - setIDCodePoint(buildIDCodePoint(path)); - - // Notify any property change listeners - changes.firePropertyChange( PATH, oldPath, path ); - } - -} // end AFPResource class diff --git a/cvsroot/src/com/ibm/as400/access/AFPResource16.gif b/cvsroot/src/com/ibm/as400/access/AFPResource16.gif deleted file mode 100644 index fe551071a..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AFPResource16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AFPResource32.gif b/cvsroot/src/com/ibm/as400/access/AFPResource32.gif deleted file mode 100644 index 68bb3f708..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AFPResource32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AFPResourceBeanInfo.java b/cvsroot/src/com/ibm/as400/access/AFPResourceBeanInfo.java deleted file mode 100644 index 43b7df264..000000000 --- a/cvsroot/src/com/ibm/as400/access/AFPResourceBeanInfo.java +++ /dev/null @@ -1,144 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AFPResourceBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -import java.beans.PropertyDescriptor; - -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; -import java.awt.Image; - -/** -The AFPResourceBeanInfo class provides bean information for the AFPResource class. -**/ -public class AFPResourceBeanInfo extends PrintObjectBeanInfo -{ - static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Additional properties defined for AFPResources - private static PropertyDescriptor[] AFPRProperties_; - - // Class this bean info represents. - private final static Class beanClass = AFPResource.class; - - // Handles loading the appropriate resource bundle - // private static ResourceBundleLoader rbl_; - - static - { - try - { - // "name" is not a property, hide it from introspection. - PropertyDescriptor name = - new PropertyDescriptor( "name", beanClass, "getName", null ); - name.setHidden(true); - - PropertyDescriptor path = - new PropertyDescriptor("path", beanClass); - path.setBound(true); - path.setConstrained(true); - path.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_PATH")); - path.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_PATH")); - - PropertyDescriptor[] properties = {name, path}; - AFPRProperties_ = properties; - } - - catch (IntrospectionException e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - // AFPResource does not define any additional events so we - // let the PrintObject provide: - // public int getDefaultEventIndex() - // public EventSetDescriptor[] getEventSetDescriptors() - - // We want "system" as the default property. PrintObject - // sets this so we don't have to override: - // public int getDefaultPropertyIndex() - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - // Per the JavaBean spec, properties are discrete, named attributes - // of a Java Bean that can affect its appearance or its behavior. - - PropertyDescriptor[] printObjectProperties; - PropertyDescriptor[] combinedProperties; - int combinedSize; - - // Get the properties defined in PrintObjectBeanInfo - printObjectProperties = super.getPropertyDescriptors(); - - combinedSize = printObjectProperties.length + AFPRProperties_.length; - combinedProperties = new PropertyDescriptor[combinedSize]; - - // copy PrintObject properties - System.arraycopy( printObjectProperties, // source - 0, // --offset - combinedProperties, // destination - 0, // --offset - printObjectProperties.length ); // length - - // copy AFPResource properties - System.arraycopy( AFPRProperties_, // source - 0, // --offset - combinedProperties, // destination - printObjectProperties.length, // --offset - AFPRProperties_.length ); // length - - return combinedProperties; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("AFPResource16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("AFPResource32.gif"); - break; - } - - return image; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AFPResourceImplProxy.java b/cvsroot/src/com/ibm/as400/access/AFPResourceImplProxy.java deleted file mode 100644 index 97f5192cb..000000000 --- a/cvsroot/src/com/ibm/as400/access/AFPResourceImplProxy.java +++ /dev/null @@ -1,33 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AFPResourceImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** - * The AFPResourceImplProxy class implements proxy versions of - * the public methods defined in the AFPResourceImpl class. - * The implementations are merely calls to the remote implementation - * class. - **/ - -class AFPResourceImplProxy extends PrintObjectImplProxy -implements ProxyImpl -{ - static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - AFPResourceImplProxy() - { - super("AFPResource"); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AFPResourceImplRemote.java b/cvsroot/src/com/ibm/as400/access/AFPResourceImplRemote.java deleted file mode 100644 index 3846f7960..000000000 --- a/cvsroot/src/com/ibm/as400/access/AFPResourceImplRemote.java +++ /dev/null @@ -1,93 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AFPResourceImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The AFPResource class represents a server AFP resource. - * An instance of this class can be used to manipulate an individual - * IBM i AFP resource. - * - * See AFP Resource Attributes for - * valid attributes. - * - **/ - -class AFPResourceImplRemote extends PrintObjectImplRemote -{ - private static final NPCPAttributeIDList attrsToRetrieve_ = new NPCPAttributeIDList(); - private static boolean fAttrIDsToRtvBuilt_ = false; - - private synchronized void buildAttrIDsToRtv() - { - if (!fAttrIDsToRtvBuilt_) - { - fAttrIDsToRtvBuilt_ = true; - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DATE); // date - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DESCRIPTION);// text description - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OBJEXTATTR); // object extended attribute - attrsToRetrieve_.addAttrID(PrintObject.ATTR_RSCLIB); // resource library name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_RSCNAME); // resource name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_RSCTYPE); // resource object type - attrsToRetrieve_.addAttrID(PrintObject.ATTR_TIME); // time - attrsToRetrieve_.addAttrID(PrintObject.ATTR_NUMBYTES); // number of bytes to read/write - } - } - - - - // Check the run time state - void checkRunTimeState() - { - // check whatever the base class needs to check - super.checkRunTimeState(); - - // AFPResource's need to additionally check the IFS pathname. - if( getIDCodePoint() == null ) { - Trace.log(Trace.ERROR, "Parameter 'path' has not been set."); - throw new ExtendedIllegalStateException( - "path", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - - - - // This method implements an abstract method of the superclass - NPCPAttributeIDList getAttrIDsToRetrieve() - { - if (!fAttrIDsToRtvBuilt_) { - buildAttrIDsToRtv(); - } - return attrsToRetrieve_; - } - - - NPCPAttributeIDList getAttrIDsToRetrieve(int attrToRtv) - { - if (!fAttrIDsToRtvBuilt_) - { - attrsToRetrieve_.addAttrID(attrToRtv); - } - return attrsToRetrieve_; - } - - - static NPCPIDAFPResource buildIDCodePoint(String IFSResourceName) - { - QSYSObjectPathName ifsPath = new QSYSObjectPathName(IFSResourceName); - - return new NPCPIDAFPResource(ifsPath.getObjectName(), - ifsPath.getLibraryName(), - ifsPath.getObjectType()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AFPResourceList.java b/cvsroot/src/com/ibm/as400/access/AFPResourceList.java deleted file mode 100644 index 1a85f690f..000000000 --- a/cvsroot/src/com/ibm/as400/access/AFPResourceList.java +++ /dev/null @@ -1,237 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AFPResourceList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Vector; -import java.beans.PropertyVetoException; - -/** - * The AFPResourceList class is used to build a list of IBM i AFP resource objects of type AFPResource. - * The list can be filtered by library and resource name, - * by resource type and by spooled file (list only resources - * used by a particular spooled file). In addition, - * font resources may be filtered by pel density. - * - * To list and use AFP resources, your system operating system must - * be at V3R7 or later. - * - *@see AFPResource - **/ - - -public class AFPResourceList extends PrintObjectList -implements java.io.Serializable -{ - static final long serialVersionUID = 4L; - - private SpooledFile spooledFileFilter_; - private static final String RESOURCE_FILTER = "resourceFilter"; - private static final String SPOOLED_FILE_FILTER = "spooledFileFilter"; - - /** - * Constructs an AFPResourceList. The system must be set - * later. This constructor is provide for visual application builders - * that support JavaBeans. It is not intended for use by - * application programmers. - * - * @see PrintObjectList#setSystem - **/ - public AFPResourceList() - { - super(NPConstants.RESOURCE, new NPCPSelRes()); - // Because of this constructor we will need to check the - // the run time state of AFPResourceList objects. - } - - - - /** - * Constructs an AFPResourceList. The default filtering - * criteria will list all resources in the system library list. - * Use the various setXxxxFilter methods to override the defaults. - * - * @param system The system on which the AFP resources exist. - **/ - public AFPResourceList(AS400 system) - { - super( NPConstants.RESOURCE, new NPCPSelRes(), system ); - } - - - /** - * Chooses the appropriate implementation. - **/ - void chooseImpl() - { - AS400 system = getSystem(); - if (system == null) { - Trace.log( Trace.ERROR, "Attempt to use AFPResourceList before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - impl_ = (PrintObjectListImpl) system.loadImpl2("com.ibm.as400.access.AFPResourceListImplRemote", - "com.ibm.as400.access.AFPResourceListImplProxy"); - super.setImpl(); - } - - - - /** - * Returns the library, name, and resource type being used as a - * resource list filter. - * @return The library, name, and resource type being used as a - * resource list filter. - **/ - public String getResourceFilter() - { - // The selection code point is always present, it may - // however be empty. If empty, getResource will return - // an empty string. - - NPCPSelRes selectionCP = (NPCPSelRes)getSelectionCP(); - return( selectionCP.getResource() ); - } - - - - /** - * Returns the spooled file object being used as a - * resource list filter. - *@return The spooled file object being used as a - * resource list filter. - **/ - public SpooledFile getSpooledFileFilter() - { - return( spooledFileFilter_ ); - } - - - - PrintObject newNPObject(NPCPID cpid, NPCPAttribute cpattr) - { - return new AFPResource(system_, (NPCPIDAFPResource)cpid, cpattr); - } - - - /** - * Sets resource list filter by library, name, and resource type. - * - * @param resourceFilter The resources to list. - * The format of the resourceFilter string must be in the - * format of "/QSYS.LIB/libname.LIB/resource.type", where - *
    - * libname is the library name that contains the resources to search. - * Resources listed will be restricted to those found in these libraries. - * - * The library name can be a specific name or one of these special values: - *
      - *
    • %ALL% - All libraries are searched. - *
    • %ALLUSR% - All user-defined libraries, plus libraries containing user data - * and having names starting with the letter Q. - *
    • %CURLIB% - The server job's current library. - *
    • %LIBL% - The server job's library list. - *
    • %USRLIBL% - The user portion of the server job's library list. - *
    - *

    - * resource is the name of the resource(s) to list. - * It can be a specific name, a generic name, or the special value %ALL%. - *
    - * type is the type of resource to list. It can be any of these - * special values: - *

      - *
    • %ALL% - All resources are listed. - *
    • FNTRSC - Only font resources are listed. - *
    • FORMDF - Only form definitions are listed. - *
    • OVL - Only overlays are listed. - *
    • PAGEDFN - Only page definitions are listed. - *
    • PAGESEG - Only page segments are listed. - *
    - * The default for the library is %LIBL%; for resource, it is %ALL%; and for - * type, it is %ALL%. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setResourceFilter(String resourceFilter) - throws PropertyVetoException - { - if( resourceFilter == null ) - { - Trace.log( Trace.ERROR, "Parameter 'resourceFilter' is null" ); - throw new NullPointerException( RESOURCE_FILTER ); - } - - String oldResourceFilter = getResourceFilter(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( RESOURCE_FILTER, - oldResourceFilter, resourceFilter ); - - // No one vetoed, make the change. - NPCPSelRes selectionCP = (NPCPSelRes)getSelectionCP(); - selectionCP.setResource( resourceFilter ); - - // Propagate change to ImplRemote if necessary... - if (impl_ != null) - impl_.setFilter("resource", resourceFilter); - - // Notify any property change listeners - changes.firePropertyChange( RESOURCE_FILTER, - oldResourceFilter, resourceFilter ); - } - - - - /** - * Sets resource list filter by spooled file. - * Only resources used by the spooled file are listed. - * @param spooledFileFilter The spooled file for which - * the resources will be listed. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setSpooledFileFilter(SpooledFile spooledFileFilter) - throws PropertyVetoException - { - // Allow spooledFile to be null to remove the filter from the - // selection code point. - - SpooledFile oldSpooledFileFilter = getSpooledFileFilter(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( SPOOLED_FILE_FILTER, - oldSpooledFileFilter, spooledFileFilter ); - - // No one vetoed, make the change. - spooledFileFilter_ = spooledFileFilter; - if( spooledFileFilter_ == null ) - { - // A null value will remove the filter. - setIDCodePointFilter(null); - } else { - setIDCodePointFilter(spooledFileFilter_.getIDCodePoint()); - } - - - // Notify any property change listeners - changes.firePropertyChange( SPOOLED_FILE_FILTER, - oldSpooledFileFilter, spooledFileFilter ); - } - -} // APFResourceList class - diff --git a/cvsroot/src/com/ibm/as400/access/AFPResourceList16.gif b/cvsroot/src/com/ibm/as400/access/AFPResourceList16.gif deleted file mode 100644 index 9553ca314..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AFPResourceList16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AFPResourceList32.gif b/cvsroot/src/com/ibm/as400/access/AFPResourceList32.gif deleted file mode 100644 index 20fbde94c..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AFPResourceList32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AFPResourceListBeanInfo.java b/cvsroot/src/com/ibm/as400/access/AFPResourceListBeanInfo.java deleted file mode 100644 index d152d0861..000000000 --- a/cvsroot/src/com/ibm/as400/access/AFPResourceListBeanInfo.java +++ /dev/null @@ -1,147 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AFPResourceListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; -import java.awt.Image; - -/** -BeanInfo for AFPResourceList class. -**/ -public class AFPResourceListBeanInfo extends PrintObjectListBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Additional properties defined by AFPResourceList - private static PropertyDescriptor[] AFPRListProperties_; - - // Class this bean info represents. - private final static Class beanClass = AFPResourceList.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader rbl_; - - static - { - try - { - PropertyDescriptor splFFilter = - new PropertyDescriptor("spooledFileFilter", beanClass); - splFFilter.setBound(true); - splFFilter.setConstrained(true); - splFFilter.setDisplayName(rbl_.getText("PROP_NAME_AFPR_SPLF_FILTER")); - splFFilter.setShortDescription(rbl_.getText("PROP_DESC_AFPR_SPLF_FILTER")); - - PropertyDescriptor rFilter = - new PropertyDescriptor("resourceFilter", beanClass); - rFilter.setBound(true); - rFilter.setConstrained(true); - rFilter.setDisplayName(rbl_.getText("PROP_NAME_AFPR_NAME_FILTER")); - rFilter.setShortDescription(rbl_.getText("PROP_DESC_AFPR_NAME_FILTER")); - - PropertyDescriptor[] properties = {splFFilter, rFilter}; - AFPRListProperties_ = properties; - } - - catch (IntrospectionException e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - // AFPResourceList does not define any additional events so we - // let the PrintObjectList provide: - // public int getDefaultEventIndex() - // public EventSetDescriptor[] getEventSetDescriptors() - - // We want "system" as the default property. PrintObjectList - // sets this so we don't have to override: - // public int getDefaultPropertyIndex() - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - // Per the JavaBean spec, properties are discrete, named attributes - // of a Java Bean that can affect its appearance or its behavior. - - PropertyDescriptor[] printObjectListProperties; - PropertyDescriptor[] combinedProperties; - int combinedSize; - - // Get the properties defined in PrintObjectListBeanInfo - printObjectListProperties = super.getPropertyDescriptors(); - - combinedSize = printObjectListProperties.length + AFPRListProperties_.length; - combinedProperties = new PropertyDescriptor[combinedSize]; - - // copy PrintObjectList properties - System.arraycopy( printObjectListProperties, // source - 0, // --offset - combinedProperties, // destination - 0, // --offset - printObjectListProperties.length ); // length - - // copy AFPResourceList properties - System.arraycopy( AFPRListProperties_, // source - 0, // --offset - combinedProperties, // destination - printObjectListProperties.length, // --offset - AFPRListProperties_.length ); // length - - return combinedProperties; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("AFPResourceList16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("AFPResourceList32.gif"); - break; - } - - return image; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/AFPResourceListImplProxy.java b/cvsroot/src/com/ibm/as400/access/AFPResourceListImplProxy.java deleted file mode 100644 index 11ebde56d..000000000 --- a/cvsroot/src/com/ibm/as400/access/AFPResourceListImplProxy.java +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AFPResourceListImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; - -class AFPResourceListImplProxy extends PrintObjectListImplProxy -implements ProxyImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - AFPResourceListImplProxy() - { - super("AFPResourceList"); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AFPResourceListImplRemote.java b/cvsroot/src/com/ibm/as400/access/AFPResourceListImplRemote.java deleted file mode 100644 index 3690e947e..000000000 --- a/cvsroot/src/com/ibm/as400/access/AFPResourceListImplRemote.java +++ /dev/null @@ -1,253 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AFPResourceListImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The AFPResourceList class is used to build a list of server AFP resource objects of type AFPResource. - * The list can be filtered by library and resource name, - * by resource type and by spooled file (list only resources - * used by a particular spooled file). In addition, - * font resources may be filtered by pel density. - * - * To list and use AFP resources, your server operating system must - * be at V3R7 or later. - * - *@see AFPResource - **/ - - -class AFPResourceListImplRemote extends PrintObjectListImplRemote -// @A5D implements AFPResourceListImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - /** Font pel density of NONE, removes pel density filter. **/ - // private static final int PELDENSITYNONE = 0; - - /** Font pel density of 240x240 dpi. **/ - // private static final int PELDENSITY240 = 1; - - /** Font pel density of 300x300 dpi. **/ - // private static final int PELDENSITY300 = 2; - - // private static final String FONT_PEL_DENSITY_FILTER = "fontPelDensityFilter"; - - // static private binary data for default attribute to - // retrieve on an AFP Resource when listing AFP Resources - // format is: - // --------------------------------------------------- - // |nn | LEN | ID1 | ID2 | ID3 | ID4 | ....... | IDnn| - // --------------------------------------------------- - // nn - two byte total # of attributes in code point - // LEN - two byte length of each attribute entry, right - // now this will be 2 (0x02). - // IDx - two byte attribute ID - - private static final byte[] attrIDToList_ = - { - 0x00, 0x07, // big endian(BE), number of attrs - 0x00, 0x02, // BE - size in bytes of each ID - 0x00, (byte)0xAE, // ATTR_RSCLIB - 0x00, (byte)0xAF, // ATTR_RSCNAME - 0x00, (byte)0xB0, // ATTR_RSCTYPE - 0x00, (byte)0xB1, // ATTR_OBJEXTATTR - 0x00, 0x6D, // ATTR_DESCRIPTION - 0x00, 0x22, // ATTR_DATE - 0x00, 0x6E // ATTR_TIME - }; - - private static final NPCPAttributeIDList defaultAttrIDsToList_ = new NPCPAttributeIDList(attrIDToList_); - - // register the AFP resource return datastream for listing resources - static - { - NPDataStream ds; - NPCodePoint cp; - - ds = new NPDataStream(NPConstants.RESOURCE); // @B1C - cp = new NPCPIDAFPResource(); - ds.addCodePoint(cp); - cp = new NPCPAttribute(); - ds.addCodePoint(cp); - AS400Server.addReplyStream(ds, "as-netprt"); - } - - - - /** - * Returns the resource list filter for font resources by - * their pel density. - * - **/ - // @A1D - Removed this method -/* private int getFontPelDensityFilter() - { - // The selection code point is always present, the fontPelDensity - // Filter may not have been set. - - NPCPSelRes selectionCP = (NPCPSelRes)getSelectionCP(); - String pelDensity = selectionCP.getPelDensity(); - - if( pelDensity.equals(NPCPSelRes.PEL240) ) - { - return PELDENSITY240; - } - else if( pelDensity.equals(NPCPSelRes.PEL300) ) - { - return PELDENSITY300; - } - else - { - return PELDENSITYNONE; - } - } - */ - - - /** - * Returns the default attributes to list. - **/ - NPCPAttributeIDList getDefaultAttrsToList() - { - return defaultAttrIDsToList_; - } - - - - /** - * Constructs a new AFPResource object. - **/ - /* @A5D - PrintObject newNPObject(AS400 system, NPDataStream reply) - { - AFPResource npObj = null; - NPCPIDAFPResource cpid; - NPCPAttribute cpAttrs; - cpid = (NPCPIDAFPResource)reply.getCodePoint(NPCodePoint.RESOURCE_ID); // never should return null - cpAttrs = (NPCPAttribute)reply.getCodePoint(NPCodePoint.ATTRIBUTE_VALUE); // may return null - npObj = new AFPResource(system, cpid, cpAttrs); - return npObj; - } - */ - - - NPCPID newNPCPID(NPDataStream reply) - { - return (NPCPIDAFPResource)reply.getCodePoint(NPCodePoint.RESOURCE_ID); // never should return null - } - - - /** - * Sets the resource list filter for font resources by their - * pel density. This filter should be used if - * listing font resources and there is a need to get them - * in a particular pel density. - * - * @param fontPelDensityFilter The fonts will be listed - * based on their pel densities. Allowed values are: - *
      - *
    • PELDENSITY240 - only fonts with 240x240 dpi are listed. - *
    • PELDENSITY300 - only fonts with 300x300 dpi are listed. - *
    - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - // @A1D - Removed this method -/* private void setFontPelDensityFilter(int fontPelDensityFilter) - throws PropertyVetoException - { - int oldFontPelDensityFilter = getFontPelDensityFilter(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( FONT_PEL_DENSITY_FILTER, - new Integer(oldFontPelDensityFilter), - new Integer(fontPelDensityFilter) ); - - // No one vetoed, make the change. - NPCPSelRes selectionCP = (NPCPSelRes)getSelectionCP(); - if (fontPelDensityFilter == PELDENSITY240) - { - selectionCP.setPelDensity(NPCPSelRes.PEL240); - } - else if (fontPelDensityFilter == PELDENSITY300) - { - selectionCP.setPelDensity(NPCPSelRes.PEL300); - } - else if (fontPelDensityFilter == PELDENSITYNONE ) - { - selectionCP.setPelDensity(NPCPSelRes.emptyString); - } - else - { - Trace.log(Trace.ERROR, "Parameter 'fontPelDensityFilter' is invalid."); - throw new ExtendedIllegalArgumentException( - "fontPelDensityFilter("+fontPelDensityFilter+")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Notify any property change listeners. - changes.firePropertyChange( FONT_PEL_DENSITY_FILTER, - new Integer(oldFontPelDensityFilter), - new Integer(fontPelDensityFilter) ); - } - */ - - - /** - * Sets resource list filter by library, name, and resource type. - * - * @param resourceFilter The resources to list. - * The format of the resourceFilter string must be in the - * format of "/QSYS.LIB/libname.LIB/resource.type", where - *
    - * libname is the library name that contains the resources to search. - * Resources listed will be restricted to those found in these libraries. - * - * The library name can be a specific name or one of these special values: - *
      - *
    • %ALL% - All libraries are searched. - *
    • %ALLUSR% - All user-defined libraries, plus libraries containing user data - * and having names starting with the letter Q. - *
    • %CURLIB% - The server job's current library. - *
    • %LIBL% - The server job's library list. - *
    • %USRLIBL% - The user portion of the server job's library list. - *
    - *

    - * resource is the name of the resource(s) to list. - * It can be a specific name, a generic name, or the special value %ALL%. - *
    - * type is the type of resource to list. It can be any of these - * special values: - *

      - *
    • %ALL% - All resources are listed. - *
    • FNTRSC - Only font resources are listed. - *
    • FORMDF - Only form definitions are listed. - *
    • OVL - Only overlays are listed. - *
    • PAGEDFN - Only page definitions are listed. - *
    • PAGESEG - Only page segments are listed. - *
    - * The default for the library is %LIBL%; for resource, it is %ALL%; and for - * type, it is %ALL%. - **/ - public void setResourceFilter(String resourceFilter) - { - NPCPSelRes selectionCP = (NPCPSelRes)getSelectionCP(); - selectionCP.setResource( resourceFilter ); - } - -} // APFResourceList class - diff --git a/cvsroot/src/com/ibm/as400/access/AS400.java b/cvsroot/src/com/ibm/as400/access/AS400.java deleted file mode 100644 index f95a090ff..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400.java +++ /dev/null @@ -1,4067 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.net.Socket; -import java.net.URL; -import java.util.GregorianCalendar; -import java.util.Hashtable; -import java.util.Locale; -import java.util.StringTokenizer; -import java.util.TimeZone; -import java.util.Vector; - -import com.ibm.as400.security.auth.ProfileTokenCredential; -import com.ibm.as400.security.auth.ProfileTokenProvider; - -/** - Represents the authentication information and a set of connections to the IBM i host servers. -

    If running on IBM i or an older version of that operating system, the system name, user ID, and password do not need to be supplied. These values default to the local system. For the system name, the keyword localhost can be used to specify the local system. For the user ID and password, *CURRENT can be used. -

    If running on another operating system, the system name, user ID, and password need to be supplied. If not supplied, the first 'open' request associated with this object will trigger a prompt to the workstation user. Subsequent opens associated with the same object will not prompt the workstation user. Keywords localhost and *CURRENT will not work when running on another operating system. -

    For example: -

    - *    AS400 system = new AS400();
    - *    system.connectService(AS400.DATAQUEUE);   // This causes a password prompt.
    - *    ...
    - *    system.connectService(AS400.FILE);        // This does not cause a prompt.
    - 
    - **/ -public class AS400 implements Serializable -{ - private static final String CLASSNAME = "com.ibm.as400.access.AS400"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - static final long serialVersionUID = 4L; - private static final boolean PASSWORD_TRACE = false; - - /** - Constant indicating the File service. - **/ - public static final int FILE = 0; - /** - Constant indicating the Print service. - **/ - public static final int PRINT = 1; - /** - Constant indicating the Command service. - **/ - public static final int COMMAND = 2; - /** - Constant indicating the Dataqueue service. - **/ - public static final int DATAQUEUE = 3; - /** - Constant indicating the Database service. - **/ - public static final int DATABASE = 4; - /** - Constant indicating the Record Access service. - **/ - public static final int RECORDACCESS = 5; - /** - Constant indicating the Central service. - **/ - public static final int CENTRAL = 6; - /** - Constant indicating the Sign-on service. - **/ - public static final int SIGNON = 7; - // Constants 8-15 reserved for SSL versions of the above services. - - /** - Special value indicating the service port should be retrieved from the port mapper server. - **/ - public static final int USE_PORT_MAPPER = -1; - - /** - Constant indicating the authentication scheme is password. - **/ - public static final int AUTHENTICATION_SCHEME_PASSWORD = 0; - /** - Constant indicating the authentication scheme is GSS token. - **/ - public static final int AUTHENTICATION_SCHEME_GSS_TOKEN = 1; - /** - Constant indicating the authentication scheme is profile token. - **/ - public static final int AUTHENTICATION_SCHEME_PROFILE_TOKEN = 2; - /** - Constant indicating the authentication scheme is identity token. - **/ - public static final int AUTHENTICATION_SCHEME_IDENTITY_TOKEN = 3; - - /** - Constant indicating that the JGSS framework must be used when no password or authentication token is set. An object set to this option will not attempt to present a sign-on dialog or use the current user profile information. A failure to retrieve the GSS token will result in an exception returned to the user. - **/ - public static final int GSS_OPTION_MANDATORY = 0; - /** - Constant indicating that the JGSS framework will be attempted when no password or authentication token is set. An object set to this option will attempt to retrieve a GSS token, if that attempt fails, the object will present a sign-on dialog or use the current user profile information. This option is the default. - **/ - public static final int GSS_OPTION_FALLBACK = 1; - /** - Constant indicating that the JGSS framework will not be used when no password or authentication token is set. An object set to this option will only present a sign-on dialog or use the current user profile information. - **/ - public static final int GSS_OPTION_NONE = 2; - - // Determine if we are running on IBM i. - static boolean onAS400 = false; - // VRM from system property, if we are native. - static ServerVersion nativeVRM = null; - // The static default sign-on handler. - static Class defaultSignonHandlerClass_ = ToolboxSignonHandler.class; - static SignonHandler defaultSignonHandler_; - // Default setting for guiAvailable property. - private static boolean defaultGuiAvailable_ = true; - // Default setting for mustAddLanguageLibrary property. - private static boolean defaultMustAddLanguageLibrary_ = false; - // Default setting for mustUseSockets property. - private static boolean defaultMustUseSockets_ = false; - // Default setting for mustUseNetSockets property. - private static boolean defaultMustUseNetSockets_ = false; - // Default setting for mustUseSuppliedProfile property. - private static boolean defaultMustUseSuppliedProfile_ = false; - // Default setting for threadUsed property. - private static boolean defaultThreadUsed_ = true; - static - { - try - { - String s = System.getProperty("os.name"); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Detected os.name:", s); - if (s != null && s.equalsIgnoreCase("OS/400")) - { - String version = System.getProperty("os.version"); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Detected os.version:", version); - if (version != null) - { - char[] versionChars = version.toCharArray(); - if (versionChars.length == 6) - { - int vrm = ((versionChars[1] & 0x000F) << 16) + - ((versionChars[3] & 0x000F) << 8) + - (versionChars[5] & 0x000F); - AS400.nativeVRM = new ServerVersion(vrm); - } - } - AS400.onAS400 = true; - } - } - catch (SecurityException e) - { - Trace.log(Trace.WARNING, "Error retrieving os.name:", e); - } - - // Get the "default sign-on handler" property. - { - String propVal = SystemProperties.getProperty(SystemProperties.AS400_SIGNON_HANDLER); - if (propVal != null) - { - try - { - defaultSignonHandlerClass_ = Class.forName(propVal); - } - catch (Exception e) - { - Trace.log(Trace.WARNING, "Error retrieving default sign-on handler (specified by property):", e); - defaultSignonHandlerClass_ = ToolboxSignonHandler.class; - } - } - } - - // Get the "GUI available" property. - { - String propVal = SystemProperties.getProperty(SystemProperties.AS400_GUI_AVAILABLE); - if (propVal != null) - { - try - { - defaultGuiAvailable_ = Boolean.valueOf(propVal).booleanValue(); - } - catch (Exception e) - { - Trace.log(Trace.WARNING, "Error retrieving guiAvailable property value:", e); - } - } - } - - // Get the "must add language library" property. - { - String propVal = SystemProperties.getProperty(SystemProperties.AS400_MUST_ADD_LANGUAGE_LIBRARY); - if (propVal != null) - { - try - { - defaultMustAddLanguageLibrary_ = Boolean.valueOf(propVal).booleanValue(); - } - catch (Exception e) - { - Trace.log(Trace.WARNING, "Error retrieving mustAddLanguageLibrary property value:", e); - } - } - } - - // Get the "must use sockets" property. - { - String propVal = SystemProperties.getProperty(SystemProperties.AS400_MUST_USE_SOCKETS); - if (propVal != null) - { - try - { - defaultMustUseSockets_ = Boolean.valueOf(propVal).booleanValue(); - } - catch (Exception e) - { - Trace.log(Trace.WARNING, "Error retrieving mustUseSockets property value:", e); - } - } - } - - // Get the "must use net sockets" property. - { - String propVal = SystemProperties.getProperty(SystemProperties.AS400_MUST_USE_NET_SOCKETS); - if (propVal != null) - { - try - { - defaultMustUseNetSockets_ = Boolean.valueOf(propVal).booleanValue(); - } - catch (Exception e) - { - Trace.log(Trace.WARNING, "Error retrieving mustUseNetSockets property value:", e); - } - } - } - - // Get the "must use supplied profile" property. - { - String propVal = SystemProperties.getProperty(SystemProperties.AS400_MUST_USE_SUPPLIED_PROFILE); - if (propVal != null) - { - try - { - defaultMustUseSuppliedProfile_ = Boolean.valueOf(propVal).booleanValue(); - } - catch (Exception e) - { - Trace.log(Trace.WARNING, "Error retrieving mustUseSuppliedProfile property value:", e); - } - } - } - - // Get the "thread used" property. - { - String propVal = SystemProperties.getProperty(SystemProperties.AS400_THREAD_USED); - if (propVal != null) - { - try - { - defaultThreadUsed_ = Boolean.valueOf(propVal).booleanValue(); - } - catch (Exception e) - { - Trace.log(Trace.WARNING, "Error retrieving threadUsed property value:", e); - } - } - } - - } - - // System list: elements are 3 element Object[]: systemName, userId, credential vault - private static Vector systemList = new Vector(); - // Default users is a hash from systemName to userId. - private static Hashtable defaultUsers = new Hashtable(); - // Number of days previous to password expiration to start to warn user. - private static int expirationWarning = 7; - - private static int alreadyCheckedForMultipleVersions_ = 0; - - // System name. - private String systemName_ = ""; - // Flag indicating if system name refers to local system. - private boolean systemNameLocal_ = false; - // User ID. - private String userId_ = ""; - - // Credential vault used to store password, GSS token, identity token, - // or profile token. An AS400 object must always have its own copy of - // a credential vault (i.e. there must be a 1-to-1 correlation between - // AS400 objects and CredentialVault objects). Sharing a credential vault - // amongst two different AS400 objects is NEVER allowed. - // If you need to share the credential in the vault with another AS400 object, - // you must provide a copy of the credential vault. This is achieved using - // the clone() method provided by the CredentialVault class. - private transient CredentialVault credVault_; // never null after construction - - // GSS Credential object, for Kerberos. Type set to Object to prevent dependency on 1.4 JDK. - private transient Object gssCredential_ = null; - // GSS name string, for Kerberos. - private String gssName_ = ""; - // How to use the GSS framework. - int gssOption_ = GSS_OPTION_FALLBACK; - - // Proxy server system name. - private transient String proxyServer_ = ""; - // Client side proxy connection information. - private transient Object proxyClientConnection_ = null; // Tolerate not having class ProxyClientConnection in the jar. - - // This controls the prompting. If set to true, then prompting will occur during sign-on if needed. If set to false, no prompting will occur and all security errors are returned as exceptions. - private boolean guiAvailable_ = defaultGuiAvailable_; - // Use the password cache. - private boolean usePasswordCache_ = true; - // Use the default user. - private boolean useDefaultUser_ = true; - // Show the checkboxes on the password dialog. - private boolean showCheckboxes_ = true; - // Detect/prevent recursion when interacting with sign-on handler. - private boolean signingOn_ = false; - - // SSL options, null value indicates SSL is not to be used. Options set in SecureAS400 subclass. - SSLOptions useSSLConnection_ = null; - // Flag that indicates if we must add the secondary language library to the library list. - private boolean mustAddLanguageLibrary_ = defaultMustAddLanguageLibrary_; - // Flag that indicates if we must use the host servers and no native optimizations. - private boolean mustUseSockets_ = defaultMustUseSockets_; - // Flag that indicates if we must use network sockets and not unix domain sockets. - private boolean mustUseNetSockets_ = defaultMustUseNetSockets_; - // Flag that indicates if we must not use the current profile. - private boolean mustUseSuppliedProfile_ = defaultMustUseSuppliedProfile_; - // Flag that indicates if we use threads in communication with the host servers. - private boolean threadUsed_ = defaultThreadUsed_; - // Locale object to use for determining NLV. - private Locale locale_ = Locale.getDefault(); - // The NLV set or determined from the locale. - private String nlv_ = ExecutionEnvironment.getNlv(Locale.getDefault()); - // The system's default time zone. - private transient TimeZone timezone_; - // Set of socket options to use when creating connections. - private SocketProperties socketProperties_ = new SocketProperties(); - - // No CCSID to start. - private transient int ccsid_ = 0; - - // List of connection event bean listeners. - private transient Vector connectionListeners_ = null; // Set on first add. - // Inner class that connects connection events that occur in the ImplRemote to this class. - private transient ConnectionListener dispatcher_ = null; // Set on first add. - // List of property change event bean listeners. - transient PropertyChangeSupport propertyChangeListeners_ = null; // Set on first add. - // List of vetoable change event bean listeners. - transient VetoableChangeSupport vetoableChangeListeners_ = null; // Set on first add. - - // Flag for when object state is allowed to change. - transient boolean propertiesFrozen_ = false; - - // Implementation object. - private transient AS400Impl impl_ = null; - - // This object is created by the initial sign-on process. It contains the information from the retrieve sign-on information flow with the sign-on server. - private transient SignonInfo signonInfo_ = null; - - // The IASP name used for the RECORDACCESS service. - private String ddmRDB_ = null; - - // The sign-on handler for this object's instance. - private transient SignonHandler signonHandler_ = null; - private transient boolean handlerCanceled_ = false; - - /* forcePrompt_ is a flag that tells AS400 to force prompt by displaying login dialog (actually the sign-on handler) prior to even trying to authenticate. - This is useful in cases where an application sends in incorrect dummy id/password and expects Toolbox to display the logon dialog. - In JDBC, we do some pre-validation of id/password. So JDBC may flag the id/password as invalid and then need - to let AS400 know that it just needs to display the logon dialog. */ - private boolean forcePrompt_ = false; //@prompt - - /** - Constructs an AS400 object. -

    If running on IBM i, the target is the local system. This has the same effect as using localhost for the system name, *CURRENT for the user ID, and *CURRENT for the password. -

    If running on another operating system, a sign-on prompt may be displayed. The user is then able to specify the system name, user ID, and password. - **/ - public AS400() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing AS400 object."); - construct(); - systemNameLocal_ = resolveSystemNameLocal(""); - proxyServer_ = resolveProxyServer(proxyServer_); - - // Default to password authentication - credVault_ = new PasswordVault(); - } - - /** - Constructs an AS400 object. It uses the specified system name. -

    If running on IBM i to another system or to itself, the user ID and password of the current job are used. -

    If running on another operating system, the user may be prompted for the user ID and password if a default user has not been established for this system name. - @param systemName The name of the IBM i system. Use localhost to access data locally. - **/ - public AS400(String systemName) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing AS400 object, system name: '" + systemName + "'"); - if (systemName == null) - { - throw new NullPointerException("systemName"); - } - construct(); - systemName_ = systemName; - systemNameLocal_ = resolveSystemNameLocal(systemName); - proxyServer_ = resolveProxyServer(proxyServer_); - - // Default to password authentication - credVault_ = new PasswordVault(); - } - - /** - Constructs an AS400 object. It uses the specified system name and user ID. If the sign-on prompt is displayed, the user is able to specify the password. Note that the user ID may be overridden. - @param systemName The name of the IBM i system. Use localhost to access data locally. - @param userId The user profile name to use to authenticate to the system. If running on IBM i, *CURRENT may be used to specify the current user ID. - **/ - public AS400(String systemName, String userId) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing AS400 object, system name: '" + systemName + "' user ID: '" + userId + "'"); - if (systemName == null) - { - throw new NullPointerException("systemName"); - } - if (userId == null) - { - throw new NullPointerException("userId"); - } - if (userId.length() > 10) - { - throw new ExtendedIllegalArgumentException("userId (" + userId + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - construct(); - systemName_ = systemName; - systemNameLocal_ = resolveSystemNameLocal(systemName); - userId_ = userId.toUpperCase(); - proxyServer_ = resolveProxyServer(proxyServer_); - - // Default to password authentication - credVault_ = new PasswordVault(); - } - - /** - Constructs an AS400 object. It uses the specified system name and profile token. - @param systemName The name of the IBM i system. Use localhost to access data locally. - @param profileToken The profile token to use to authenticate to the system. - **/ - public AS400(String systemName, ProfileTokenCredential profileToken) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing AS400 object with profile token, system name: '" + systemName + "'"); - if (PASSWORD_TRACE) Trace.log(Trace.DIAGNOSTIC, "profile token: " + profileToken); - - if (profileToken == null) - { - throw new NullPointerException("profileToken"); - } - - constructWithProfileToken(systemName, new ProfileTokenVault(profileToken)); - } - - /** - * Constructs an AS400 object. The specified ProfileTokenProvider is used. - * The token refresh threshold is determined by the ProfileTokenProvider. - * @param tokenProvider The provider to use when a new profile token needs to be generated. - * @see #AS400(String,ProfileTokenProvider,int) - */ - public AS400(String systemName, ProfileTokenProvider tokenProvider) - { - this(systemName, tokenProvider, null); - } - - /** - * Constructs an AS400 object. The specified ProfileTokenProvider is used. - * @param tokenProvider The provider to use when a new profile token needs to be generated. - * @param refreshThreshold The refresh threshold, in seconds, for the profile token. - * Used by the vault to manage the currency of the profile token - * to help ensure it remains current for an indefinite period of time. - * @see #AS400(String,ProfileTokenProvider) - */ - public AS400(String systemName, ProfileTokenProvider tokenProvider, int refreshThreshold) - { - this(systemName, tokenProvider, new Integer(refreshThreshold)); - } - - private AS400(String systemName, ProfileTokenProvider tokenProvider, Integer refreshThreshold) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing AS400 object with a profile token provider, system name: '" + systemName + "'"); - - if (tokenProvider == null) - { - throw new NullPointerException("tokenProvider"); - } - if (PASSWORD_TRACE) Trace.log(Trace.DIAGNOSTIC, "profile token provider:", tokenProvider.getClass().getName()); - - // Was a refresh threshold specified? - if (refreshThreshold != null) { - constructWithProfileToken(systemName, new ManagedProfileTokenVault(tokenProvider, refreshThreshold.intValue())); - } - else { - constructWithProfileToken(systemName, new ManagedProfileTokenVault(tokenProvider)); - } - } - - /** - * Common code for constructing an AS400 object that uses profile token authentication - */ - private void constructWithProfileToken(String systemName, ProfileTokenVault credVault) - { - if (systemName == null) - { - throw new NullPointerException("systemName"); - } - construct(); - systemName_ = systemName; - systemNameLocal_ = resolveSystemNameLocal(systemName); - - // Assumption: The caller of this method has ensured that the credential - // vault has been created and initialized correctly. - credVault_ = credVault; - proxyServer_ = resolveProxyServer(proxyServer_); - } - - /** - Constructs an AS400 object. It uses the specified system name, user ID, and password. No sign-on prompt is displayed unless the sign-on fails. - @param systemName The name of the IBM i system. Use localhost to access data locally. - @param userId The user profile name to use to authenticate to the system. If running on IBM i, *CURRENT may be used to specify the current user ID. - @param password The user profile password to use to authenticate to the system. If running on IBM i, *CURRENT may be used to specify the current user ID. - **/ - public AS400(String systemName, String userId, String password) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing AS400 object, system name: '" + systemName + "' user ID: '" + userId + "'"); - if (PASSWORD_TRACE) Trace.log(Trace.DIAGNOSTIC, "password: '" + password + "'"); - if (systemName == null) - { - throw new NullPointerException("systemName"); - } - if (userId == null) - { - throw new NullPointerException("userId"); - } - if (userId.length() > 10) - { - throw new ExtendedIllegalArgumentException("userId (" + userId + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (password == null) - { - throw new NullPointerException("password"); - } - if (password.length() > 128) - { - throw new ExtendedIllegalArgumentException("password.length {" + password.length() + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - construct(); - systemName_ = systemName; - systemNameLocal_ = resolveSystemNameLocal(systemName); - userId_ = userId.toUpperCase(); - credVault_ = new PasswordVault(password); - proxyServer_ = resolveProxyServer(proxyServer_); - } - - // Private constructor for use when a new object is needed and the password is already twiddled. - // Used by password cache and password verification code. - private AS400(String systemName, String userId, CredentialVault pwVault) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing internal AS400 object, system name: '" + systemName + "' user ID: '" + userId + "'"); - if (PASSWORD_TRACE) Trace.log(Trace.DIAGNOSTIC, pwVault.trace()); - // System name and user ID validation has been deferred to here. - if (systemName == null) - { - throw new NullPointerException("systemName"); - } - if (userId == null) - { - throw new NullPointerException("userId"); - } - if (userId.length() > 10) - { - throw new ExtendedIllegalArgumentException("userId (" + userId + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - construct(); - systemName_ = systemName; - systemNameLocal_ = resolveSystemNameLocal(systemName); - userId_ = userId.toUpperCase(); - - // Create a copy of the supplied credential vault. This allows the AS400 - // object to have its own credential vault object while making the vault - // contain the the same credential as the original vault we have been provided. - // It is VERY important that the copy of the vault contain the same credential - // as the original vault. This is because the Toolbox implementation has - // always allowed two AS400 objects to share a credential (i.e. two AS400 - // objects can both share the same password credential). So we must maintain - // that behavior, but we need to do so using two different credential vaults, - // because each AS400 object must always have its very own credential vault. - credVault_ = (CredentialVault)pwVault.clone(); - proxyServer_ = resolveProxyServer(proxyServer_); - } - - /** - Constructs an AS400 object. It uses the specified system name, user ID, and password. No sign-on prompt is displayed unless the sign-on fails. - @param systemName The name of the IBM i system. Use localhost to access data locally. - @param userId The user profile name to use to authenticate to the system. If running on IBM i, *CURRENT may be used to specify the current user ID. - @param password The user profile password to use to authenticate to the system. If running on IBM i, *CURRENT may be used to specify the current user ID. - @param proxyServer The name and port of the proxy server in the format serverName[:port]. If no port is specified, a default will be used. - **/ - public AS400(String systemName, String userId, String password, String proxyServer) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing AS400 object, system name: '" + systemName + "' user ID: '" + userId + "' proxy server: '" + proxyServer + "'"); - if (PASSWORD_TRACE) Trace.log(Trace.DIAGNOSTIC, "password: '" + password + "'"); - if (systemName == null) - { - throw new NullPointerException("systemName"); - } - if (userId == null) - { - throw new NullPointerException("userId"); - } - if (userId.length() > 10) - { - throw new ExtendedIllegalArgumentException("userId (" + userId + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (password == null) - { - throw new NullPointerException("password"); - } - if (password.length() > 128) - { - throw new ExtendedIllegalArgumentException("password.length {" + password.length() + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (proxyServer == null) - { - throw new NullPointerException("proxyServer"); - } - construct(); - systemName_ = systemName; - systemNameLocal_ = resolveSystemNameLocal(systemName); - userId_ = userId.toUpperCase(); - credVault_ = new PasswordVault(password); - proxyServer_ = resolveProxyServer(proxyServer); - } - - /** - Constructs an AS400 object. It uses the same system name and user ID. This does not create a clone. The new object has the same behavior, but results in a new set of socket connections. - @param system A previously instantiated AS400 object. - **/ - public AS400(AS400 system) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing AS400 object, system: " + system); - if (system == null) - { - throw new NullPointerException("system"); - } - construct(); - systemName_ = system.systemName_; - systemNameLocal_ = system.systemNameLocal_; - userId_ = system.userId_; - - // Create a copy of the supplied credential vault. This allows the AS400 - // object to have its own credential vault object while making the vault - // contain the the same credential as the original vault we have been provided. - // It is VERY important that the copy of the vault contain the same credential - // as the original vault. This is because the Toolbox implementation has - // always allowed two AS400 objects to share a credential (i.e. two AS400 - // objects can both share the same password credential). So we must maintain - // that behavior, but we need to do so using two different credential vaults, - // because each AS400 object must always have its very own credential vault. - credVault_ = (CredentialVault)system.credVault_.clone(); - - gssCredential_ = system.gssCredential_; - gssName_ = system.gssName_; - gssOption_ = system.gssOption_; - - proxyServer_ = system.proxyServer_; - // proxyClientConnection_ is not copied. - - guiAvailable_ = system.guiAvailable_; - usePasswordCache_ = system.usePasswordCache_; - useDefaultUser_ = system.useDefaultUser_; - showCheckboxes_ = system.showCheckboxes_; - - // useSSLConnection_ is handled by SecureAS400 subclass. - mustAddLanguageLibrary_ = system.mustAddLanguageLibrary_; - mustUseSockets_ = system.mustUseSockets_; - mustUseNetSockets_ = system.mustUseNetSockets_; - mustUseSuppliedProfile_ = system.mustUseSuppliedProfile_; - threadUsed_ = system.threadUsed_; - locale_ = system.locale_; - nlv_ = system.nlv_; - socketProperties_ = system.socketProperties_; - - ccsid_ = system.ccsid_; - - // connectionListeners_ is not copied. - // dispatcher_ is not copied. - // propertyChangeListeners_ is not copied. - // vetoableChangeListeners_ is not copied. - - // propertiesFrozen_ is not copied. - // impl_ is not copied. - // signonInfo_ is not copied. - ddmRDB_ = system.ddmRDB_; - } - - /** - Adds a listener to be notified when a connection event occurs. - @param listener The listener object. - **/ - public void addConnectionListener(ConnectionListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding connection listener."); - if (listener == null) - { - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (connectionListeners_ == null) - { - connectionListeners_ = new Vector(); - dispatcher_ = new ConnectionListener() - { - public void connected(ConnectionEvent event) - { - fireConnectEvent(event, true); - } - public void disconnected(ConnectionEvent event) - { - fireConnectEvent(event, false); - } - }; - } - // If this is the first add and we are already connected. - if (impl_ != null && connectionListeners_.isEmpty()) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Enabling connection listener dispatcher."); - impl_.addConnectionListener(dispatcher_); - } - connectionListeners_.addElement(listener); - } - } - - /** - Validates the user ID and password, and if successful, adds the information to the password cache. - @param systemName The name of the IBM i system. - @param userId The user profile name. - @param password The user profile password. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public static void addPasswordCacheEntry(String systemName, String userId, String password) throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding password cache entry, system name: '" + systemName + "' user ID: '" + userId + "'"); - addPasswordCacheEntry(new AS400(systemName, userId, password)); - } - - /** - Validates the user ID and password, and if successful, adds the information to the password cache. - @param systemName The name of the IBM i system. - @param userId The user profile name. - @param password The user profile password. - @param proxyServer The name and port of the proxy server in the format serverName[:port]. If no port is specified, a default will be used. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public static void addPasswordCacheEntry(String systemName, String userId, String password, String proxyServer) throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding password cache entry, system name: '" + systemName + "' user ID: '" + userId + "' proxy server: '" + proxyServer + "'"); - addPasswordCacheEntry(new AS400(systemName, userId, password, proxyServer)); - } - - // For use by AS400 and SecureAS400 objects. - static void addPasswordCacheEntry(AS400 system) throws AS400SecurityException, IOException - { - system.validateSignon(); // Exception thrown if info not valid. - setCacheEntry(system.systemName_, system.userId_, system.credVault_); - } - - /** - Adds a listener to be notified when the value of any property is changed. - @param listener The listener object. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) - { - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Adds a listener to be notified when the value of any constrained property is changed. The vetoableChange method will be called. - @param listener The listener object. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) - { - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - } - - /** - Indicates if properties are frozen. If this is true, property changes should not be made. Properties are not the same thing as attributes. Properties are basic pieces of information which must be set to make the object usable, such as the system name, user ID or other properties that identify the resource. - @return true if properties are frozen, false otherwise. - **/ - public boolean arePropertiesFrozen() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if properties are frozen:", propertiesFrozen_); - return propertiesFrozen_; - } - - /** - Authenticates the user profile name and user profile password. -

    This method is functionally equivalent to the validateSignon() method. It does not alter the user profile assigned to this object, impact the status of existing connections, or otherwise impact the user and authorities on which the application is running. -

    The system name needs to be set prior to calling this method. -

    Note: Providing an incorrect password increments the number of failed sign-on attempts for the user profile, and can result in the profile being disabled. -

    Note: This will return true if the information is successfully validated. An unsuccessful validation will cause an exception to be thrown, false is never returned. - @param userId The user profile name. - @param password The user profile password. - @return true if successful. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public boolean authenticate(String userId, String password) throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Authenticating signon information:", userId); - return validateSignon(userId, password); - } - - // Only load native version once. - private static int nativeVersion = -1; - private static int getNativeVersion() - { - try - { - if (AS400.nativeVersion == -1) - { - AS400.nativeVersion = Class.forName("com.ibm.as400.access.NativeVersion").newInstance().hashCode(); - } - } - catch (ClassNotFoundException e) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Not using native optimizations; class 'NativeVersion' is not found."); - AS400.nativeVersion = 0; - } - catch (Exception e) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Not using native optimizations; unexpected exception while loading native version:", e); - AS400.nativeVersion = 0; - } - return AS400.nativeVersion; - } - - /** - Indicates if this AS400 object is enabled to exploit Toolbox native optimizations. This requires that the native optimization classes are available on the classpath, and this AS400 object represents the local system and is configured to allow the native optimizations to be used. - Note: If the authentication scheme is other than {@link #AUTHENTICATION_SCHEME_PASSWORD AUTHENTICATION_SCHEME_PASSWORD}, native optimizations will not be used. - @return true if the native optimizations can be used; false otherwise. - @see #isLocal - @see #isMustUseSockets - @see #getAuthenticationScheme - **/ - public boolean canUseNativeOptimizations() - { - if (AS400.onAS400 && !mustUseSockets_ && systemNameLocal_ && proxyServer_.length() == 0 && credVault_.getType() == AUTHENTICATION_SCHEME_PASSWORD && getNativeVersion() == 2) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Using native optimizations."); - return true; - } - else - { - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "Not using native optimizations. Reason follows:"); - if (!AS400.onAS400) { - Trace.log(Trace.DIAGNOSTIC, " onAS400:", AS400.onAS400); - } - if (mustUseSockets_) { - Trace.log(Trace.DIAGNOSTIC, " mustUseSockets:", mustUseSockets_); - } - if (!systemNameLocal_) { - Trace.log(Trace.DIAGNOSTIC, " systemNameLocal:", systemNameLocal_); - } - if (proxyServer_.length() != 0) { - Trace.log(Trace.DIAGNOSTIC, " proxyServer:", proxyServer_); - } - int credType = credVault_.getType(); - if (credType != AUTHENTICATION_SCHEME_PASSWORD) { - // Design note: For various reasons (such as lack of requirement, and potential complications - // when swapping during a token-based session), the Toolbox has never supported staying - //on-thread when using profile tokens or other non-password based authentication schemes. - Trace.log(Trace.DIAGNOSTIC, " authenticationScheme:", credType + - " ("+credTypeToString(credType)+")"); - } - if (getNativeVersion() != 2) { - Trace.log(Trace.DIAGNOSTIC, " nativeVersion:", getNativeVersion()); - } - } - return false; - } - } - - private static final String credTypeToString(int credType) - { - String result; - switch (credType) - { - case AUTHENTICATION_SCHEME_PASSWORD : - result = "password"; - break; - case AUTHENTICATION_SCHEME_GSS_TOKEN : - result = "GSS token"; - break; - case AUTHENTICATION_SCHEME_PROFILE_TOKEN : - result = "profile token"; - break; - case AUTHENTICATION_SCHEME_IDENTITY_TOKEN : - result = "identity token"; - break; - default : - result = "unrecognized"; - } - return result; - } - - /** - Changes the user profile password. The system name and user profile name need to be set prior to calling this method. - @param oldPassword The old user profile password. - @param newPassword The new user profile password. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public void changePassword(String oldPassword, String newPassword) throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Changing password."); - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "oldPassword: '" + oldPassword + "'"); - Trace.log(Trace.DIAGNOSTIC, "newPassword: '" + newPassword + "'"); - } - if (oldPassword == null) - { - throw new NullPointerException("oldPassword"); - } - if (oldPassword.length() > 128) - { - throw new ExtendedIllegalArgumentException("oldPassword.length {" + oldPassword.length() + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (newPassword == null) - { - throw new NullPointerException("newPassword"); - } - if (newPassword.length() > 128) - { - throw new ExtendedIllegalArgumentException("newPassword.length {" + newPassword.length() + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - if (systemName_.length() == 0 && !systemNameLocal_) - { - Trace.log(Trace.ERROR, "Cannot change password before system name is set."); - throw new ExtendedIllegalStateException("systemName", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - userId_ = resolveUserId(userId_); - if (userId_.length() == 0) - { - Trace.log(Trace.ERROR, "Cannot change password before user ID is set."); - throw new ExtendedIllegalStateException("userId", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - chooseImpl(); - - // Synchronize to protect sign-on information. - synchronized (this) - { - byte[] proxySeed = new byte[9]; - CredentialVault.rng.nextBytes(proxySeed); - byte[] remoteSeed = impl_.exchangeSeed(proxySeed); - - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "AS400 object proxySeed:", proxySeed); - Trace.log(Trace.DIAGNOSTIC, "AS400 object remoteSeed:", remoteSeed); - } - - // Note that in this particular case it is OK to just pass byte arrays - // instead of credential vaults. That is because we have the clear text - // passwords, so all we need to do is encode them and send them over - // to the impl. After the password has been changed, we will update - // our own credential vault with the new password, and create ourselves - // the appropriate type of credential vault to store the password in. - - signonInfo_ = impl_.changePassword(systemName_, systemNameLocal_, userId_, CredentialVault.encode(proxySeed, remoteSeed, BinaryConverter.charArrayToByteArray(oldPassword.toCharArray())), CredentialVault.encode(proxySeed, remoteSeed, BinaryConverter.charArrayToByteArray(newPassword.toCharArray()))); - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Password changed successfully."); - - // Update credential vault with new password. - credVault_.empty(); - credVault_ = new PasswordVault(newPassword); - } - } - - // Choose between remote and proxy implementation objects, set state information into remote implementation object. Synchronized to protect impl_ and propertiesFrozen_ instance variables. This method can safely be called multiple times because it checks its state before performing the code. - private synchronized void chooseImpl() - { - if (impl_ == null) - { - impl_ = (AS400Impl)loadImpl2("com.ibm.as400.access.AS400ImplRemote", "com.ibm.as400.access.AS400ImplProxy"); - - // If there is a connection listener. Connect the remote implementation connection events to this object. - if (connectionListeners_ != null && !connectionListeners_.isEmpty()) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Enabling connection listener dispatcher."); - impl_.addConnectionListener(dispatcher_); - } - } - if (!propertiesFrozen_) - { - impl_.setState(useSSLConnection_, canUseNativeOptimizations(), threadUsed_, ccsid_, nlv_, socketProperties_, ddmRDB_, mustUseNetSockets_, mustUseSuppliedProfile_, mustAddLanguageLibrary_); - propertiesFrozen_ = true; - } - } - - /** - Clears the password cache for all systems within this Java virtual machine. - **/ - public static void clearPasswordCache() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Clearing password cache."); - synchronized (AS400.systemList) - { - AS400.systemList.removeAllElements(); - } - } - - /** - Clears all the passwords that are cached for the given system name within this Java virtual machine. - @param systemName The name of the IBM i system. - **/ - public static void clearPasswordCache(String systemName) - { - String longName = null; - boolean isLocalHost = false; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Clearing password cache, system name:", systemName); - if (systemName == null) - { - throw new NullPointerException("systemName"); - } - systemName = resolveSystem(systemName); - boolean localHost = systemName.equals("localhost"); - if (localHost) { - isLocalHost = true; - try { - systemName = InetAddress.getLocalHost().getHostName(); - } catch (Exception e) { /* ignore */ } - } - int dotIndex = systemName.indexOf("."); - if (dotIndex > 0) { - longName = systemName; - systemName = systemName.substring(0,dotIndex); - } - synchronized (AS400.systemList) - { - for (int i = AS400.systemList.size() - 1; i >= 0; i--) - { - String elementName = (String)((Object[])AS400.systemList.elementAt(i))[0]; - if (systemName.equalsIgnoreCase(elementName)) - { - AS400.systemList.removeElementAt(i); - } else if (isLocalHost && "localhost".equalsIgnoreCase(elementName)) { - AS400.systemList.removeElementAt(i); - } else if ((longName != null) && longName.equalsIgnoreCase(elementName)) { - AS400.systemList.removeElementAt(i); - } - } - } - } - - /** - Connects to a service. Security is validated and a connection is established. -

    Services typically connect implicitly; therefore, this method does not have to be called to use a service. This method can be used to control when the connection is established. - @param service The name of the service. Valid services are: -

      -
    • {@link #FILE FILE} - IFS file classes. -
    • {@link #PRINT PRINT} - print classes. -
    • {@link #COMMAND COMMAND} - command and program call classes. -
    • {@link #DATAQUEUE DATAQUEUE} - data queue classes. -
    • {@link #DATABASE DATABASE} - JDBC classes. -
    • {@link #RECORDACCESS RECORDACCESS} - record level access classes. -
    • {@link #CENTRAL CENTRAL} - license management classes. -
    • {@link #SIGNON SIGNON} - sign-on classes. -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public void connectService(int service) throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Connecting service:", service); - // Validate parameter. - if (service < 0 || service > 7) - { - throw new ExtendedIllegalArgumentException("service (" + service + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - chooseImpl(); - signon(service == AS400.SIGNON); - impl_.connect(service); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Service connected:", AS400.getServerName(service)); - } - - /** - Connects to a port on the server, via DHCP. Security is validated and a connection is established. - @param port The port number to connect to. - @return A Socket object representing the connection. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public Socket connectToPort(int port) throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Connecting port:", port); - - chooseImpl(); - signon(false); - Socket s = impl_.connectToPort(port); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Port connected:", s.getPort()); - return s; - } - - // Common code for all the constuctors and readObject. - private void construct() - { - // See if we are running on IBM i. - if (AS400.onAS400) - { - // OK, we are running on IBM i. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Running on IBM i."); - // Running on IBM i, don't prompt. - guiAvailable_ = false; - } - } - - /** - Disconnects all services. All socket connections associated with this object will be closed. The signon information is not changed, and connection properties remain frozen. - @see #resetAllServices - **/ - public void disconnectAllServices() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Disconnecting all services..."); - if (impl_ != null) - { - impl_.disconnect(AS400.FILE); - impl_.disconnect(AS400.PRINT); - impl_.disconnect(AS400.COMMAND); - impl_.disconnect(AS400.DATAQUEUE); - impl_.disconnect(AS400.DATABASE); - impl_.disconnect(AS400.RECORDACCESS); - impl_.disconnect(AS400.CENTRAL); - impl_.disconnect(AS400.SIGNON); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "All services disconnected."); - } - - /** - Disconnects the service. All socket connections associated with this service and this object will be closed. - @param service The name of the service. Valid services are: -
      -
    • {@link #FILE FILE} - IFS file classes. -
    • {@link #PRINT PRINT} - print classes. -
    • {@link #COMMAND COMMAND} - command and program call classes. -
    • {@link #DATAQUEUE DATAQUEUE} - data queue classes. -
    • {@link #DATABASE DATABASE} - JDBC classes. -
    • {@link #RECORDACCESS RECORDACCESS} - record level access classes. -
    • {@link #CENTRAL CENTRAL} - license management classes. -
    • {@link #SIGNON SIGNON} - sign-on classes. -
    - **/ - public void disconnectService(int service) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Disconnecting service:", service); - // Validate parameter. - if (service < 0 || service > 7) - { - throw new ExtendedIllegalArgumentException("service (" + service + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (impl_ == null) return; - impl_.disconnect(service); - } - - // Fire connect events here so source is public object. - private void fireConnectEvent(ConnectionEvent event, boolean connect) - { - // If we have made it this far, we know we have listeners. - event.setSource(this); - - Vector targets = (Vector)connectionListeners_.clone(); - for (int i = 0; i < targets.size(); ++i) - { - ConnectionListener target = (ConnectionListener)targets.elementAt(i); - if (connect) - { - target.connected(event); - } - else - { - target.disconnected(event); - } - } - } - - /** - Generates a profile token on behalf of the provided user identity. This user identity must be associated with a user profile via EIM. -

    Invoking this method does not change the user ID and password assigned to the system or otherwise modify the user or authorities under which the application is running. The profile associated with this system object must have enough authority to generate an authentication token for another user. -

    This function is only supported on i5/OS V5R3M0 or greater. - @param userIdentity The LDAP distinguished name. - @param tokenType The type of profile token to create. Possible types are defined as fields on the ProfileTokenCredential class: -

      -
    • {@link com.ibm.as400.security.auth.ProfileTokenCredential#TYPE_SINGLE_USE TYPE_SINGLE_USE} -
    • {@link com.ibm.as400.security.auth.ProfileTokenCredential#TYPE_MULTIPLE_USE_NON_RENEWABLE TYPE_MULTIPLE_USE_NON_RENEWABLE} -
    • {@link com.ibm.as400.security.auth.ProfileTokenCredential#TYPE_MULTIPLE_USE_RENEWABLE TYPE_MULTIPLE_USE_RENEWABLE} -
    - @param timeoutInterval The number of seconds to expiration when the token is created (1-3600). - @return A ProfileTokenCredential representing the provided user identity. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public ProfileTokenCredential generateProfileToken(String userIdentity, int tokenType, int timeoutInterval) throws AS400SecurityException, IOException - { - connectService(AS400.SIGNON); - - if (userIdentity == null) - { - throw new NullPointerException("userIdentity"); - } - - ProfileTokenCredential profileToken = new ProfileTokenCredential(); - try - { - profileToken.setSystem(this); - profileToken.setTokenType(tokenType); - profileToken.setTimeoutInterval(timeoutInterval); - } - catch (PropertyVetoException e) - { - Trace.log(Trace.ERROR, "Unexpected PropertyVetoException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - - chooseImpl(); - synchronized (this) - { - impl_.generateProfileToken(profileToken, userIdentity); - } - return profileToken; - } - - /** - Generates a VRM from a version, release, and modification. This can then be used to compare against the VRM returned by getVRM(). - @param version The version. - @param release The release. - @param modification The modification level. - @return The generated VRM. - **/ - public static int generateVRM(int version, int release, int modification) - { - // Check for valid input. - if (version < 0 || version > 0xFFFF) - { - throw new ExtendedIllegalArgumentException("version (" + version + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (release < 0 || release > 0xFF) - { - throw new ExtendedIllegalArgumentException("release (" + release + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (modification < 0 || modification > 0xFF) - { - throw new ExtendedIllegalArgumentException("modification (" + modification + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - return (version << 16) + (release << 8) + modification; - } - - /** - Returns the authentication scheme for this object. By default this object starts in password mode. This value may not be correct before a connection to the system has been made. Valid authentication schemes are: -
      -
    • {@link #AUTHENTICATION_SCHEME_PASSWORD AUTHENTICATION_SCHEME_PASSWORD} - passwords are used. -
    • {@link #AUTHENTICATION_SCHEME_GSS_TOKEN AUTHENTICATION_SCHEME_GSS_TOKEN} - GSS tokens are used. -
    • {@link #AUTHENTICATION_SCHEME_PROFILE_TOKEN AUTHENTICATION_SCHEME_PROFILE_TOKEN} - profile tokens are used. -
    • {@link #AUTHENTICATION_SCHEME_IDENTITY_TOKEN AUTHENTICATION_SCHEME_IDENTITY_TOKEN} - identity tokens are used. -
    - @return The authentication scheme in use for this object. - **/ - public int getAuthenticationScheme() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting authentication scheme, scheme:", credVault_.getType()); - return credVault_.getType(); - } - - /** - Returns the CCSID for this object. The CCSID returned either is the one retrieved based on the user profile or is set by the setCcsid() method. - @return The CCSID in use for this object. - **/ - public int getCcsid() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting CCSID."); - if (ccsid_ == 0) - { - try - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving CCSID from system..."); - chooseImpl(); - signon(false); - ccsid_ = signonInfo_.serverCCSID; - } - catch (Exception e) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Taking best guess CCSID:", e); - ccsid_ = ExecutionEnvironment.getBestGuessAS400Ccsid(); - } - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "CCSID:", ccsid_); - return ccsid_; - } - - // Calculate number of days until user's password expires. - private int getDaysToExpiration() - { - if (signonInfo_ != null) - { - GregorianCalendar expirationDate = signonInfo_.expirationDate; - GregorianCalendar now = signonInfo_.currentSignonDate; - if (expirationDate != null && now != null) - { - long lExpiration = expirationDate.getTime().getTime(); - long lNow = now.getTime().getTime(); - - // Divide by number of seconds in day, round up. - int days = (int)(((lExpiration - lNow) / 0x5265C00) + 1); - - return days; - } - } - // No expiration date. - return 365; - } - - /** - Returns the default sign-on handler. If none has been specified, returns an instance of the Toolbox's internal sign-on handler. - @return The default sign-on handler. Never returns null. - @see #setDefaultSignonHandler - **/ - public static SignonHandler getDefaultSignonHandler() - { - if (defaultSignonHandler_ != null) return defaultSignonHandler_; - try - { - return (SignonHandler)defaultSignonHandlerClass_.newInstance(); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Unable to cast specified default sign-on handler to a SignonHandler: " + defaultSignonHandlerClass_.getName(), e); - return new ToolboxSignonHandler(); - } - } - - /** - Returns the relational database name (RDB name) used for record-level access (DDM) connections. The RDB name corresponds to the independent auxiliary storage pool (IASP) that is being used. - @return The name of the IASP or RDB that is in use by this object's RECORDACCESS service, or null if the IASP used will be the default system pool (*SYSBAS). - @see #setDDMRDB - **/ - public String getDDMRDB() - { - return ddmRDB_; - } - - /** - Returns the default user ID for this system name. This user ID is used to connect if a user ID was not used to construct the object. - @param systemName The name of the IBM i system. - @return The default user ID for this system. A null is returned if there is not a default user. - **/ - public static String getDefaultUser(String systemName) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting the default user, system name:", systemName); - if (systemName == null) - { - throw new NullPointerException("systemName"); - } - String defaultUser = (String)AS400.defaultUsers.get(resolveSystem(systemName)); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Default user:", defaultUser); - return defaultUser; - } - - /** - Returns the GSS name string. This method will only return the information provided on the setGSSName() method. - @return The GSS name string, or an empty string ("") if not set. - **/ - public synchronized String getGSSName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting GSS name:", gssName_); - return gssName_; - } - - /** - Returns the option for how the JGSS framework will be used. - @return A constant indicating how the JGSS framework will be used. Valid values are: -
      -
    • {@link #GSS_OPTION_MANDATORY GSS_OPTION_MANDATORY} -
    • {@link #GSS_OPTION_FALLBACK GSS_OPTION_FALLBACK} -
    • {@link #GSS_OPTION_NONE GSS_OPTION_NONE} -
    - **/ - public int getGSSOption() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting GSS option:", gssOption_); - return gssOption_; - } - - // Get underlying AS400Impl object. - AS400Impl getImpl() - { - chooseImpl(); - return impl_; - } - - // Returns the job CCSID. - int getJobCcsid() throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting job CCSID."); - chooseImpl(); - signon(false); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Job CCSID:", signonInfo_.serverCCSID); - return signonInfo_.serverCCSID; - } - - /** - Returns the encoding that corresponds to the job CCSID. - @return The encoding. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - **/ - public String getJobCCSIDEncoding() throws AS400SecurityException, IOException, InterruptedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting job CCSID encoding."); - chooseImpl(); - signon(false); - int ccsid = signonInfo_.serverCCSID; - String encoding = impl_.ccsidToEncoding(ccsid); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Job CCSID encoding:", encoding); - return encoding; - } - - /** - Returns an array of Job objects representing the jobs to which this object is connected. This information is only available when connecting to i5/OS V5R2M0 and later systems. The array will be of length zero if no connections are currently active. - @param service The name of the service. Valid services are: -
      -
    • {@link #FILE FILE} - IFS file classes. -
    • {@link #PRINT PRINT} - print classes. -
    • {@link #COMMAND COMMAND} - command and program call classes. -
    • {@link #DATAQUEUE DATAQUEUE} - data queue classes. -
    • {@link #DATABASE DATABASE} - JDBC classes. -
    • {@link #RECORDACCESS RECORDACCESS} - record level access classes. -
    • {@link #CENTRAL CENTRAL} - license management classes. -
    • {@link #SIGNON SIGNON} - sign-on classes. -
    - @return The array of job objects. - **/ - public Job[] getJobs(int service) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting jobs, service:", service); - // Validate parameter. - if (service < 0 || service > 7) - { - Trace.log(Trace.ERROR, "Value of parameter 'service' is not valid:", service); - throw new ExtendedIllegalArgumentException("service (" + service + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (impl_ == null) return new Job[0]; - String[] jobStrings = impl_.getJobs(service); - Job[] jobs = new Job[jobStrings.length]; - for (int i = 0; i < jobStrings.length; ++i) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing Job for job:", jobStrings[i]); - if (jobStrings[i] == null || jobStrings[i].length() == 0) return new Job[0]; - StringTokenizer tokenizer = new StringTokenizer(jobStrings[i], "/"); - String jobNumber = tokenizer.nextToken(); - String jobUser = tokenizer.nextToken(); - String jobName = tokenizer.nextToken(); - - jobs[i] = new Job(this, jobName, jobUser, jobNumber); - } - return jobs; - } - - /** - Returns the Locale associated with this system object. The Locale may have been set with the setLocale() method, or it may be the default Locale for the client environment. Unless specifically overridden, this Locale is used to set the National Language Version (NLV) on the system. Only the COMMAND, PRINT, and DATABASE services accept an NLV. - @return The Locale object. - **/ - public Locale getLocale() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting locale: " + locale_); - return locale_; - } - - /** - Returns the modification level of the IBM i system. -

    A connection is required to the system to retrieve this information. If a connection has not been established, one is created to retrieve the information. - @return The modification level. For example, version 5, release 1, modification level 0 returns 0. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public int getModification() throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting modification level."); - - chooseImpl(); - signon(false); - - int modification = signonInfo_.version.getModificationLevel(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Modification level:", modification); - - return modification; - } - - /** - Returns the National Language Version (NLV) that will be sent to the system. Only the COMMAND, PRINT, and DATABASE services accept an NLV. - @return The NLV. - **/ - public String getNLV() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting NLV:", nlv_); - return nlv_; - } - - /** - Returns the password expiration date for the signed-on user. If the profile's password expiration interval is set to *NOMAX, null is returned. -

    A connection is required to retrieve this information. If a connection has not been established, one is created to retrieve the information. - @return The password expiration date. If the profile has no password expiration data (*NOMAX), null is returned. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public GregorianCalendar getPasswordExpirationDate() throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting password expiration date."); - - chooseImpl(); - signon(false); - - GregorianCalendar expire = signonInfo_.expirationDate; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Password expiration date: " + expire); - - return (expire == null) ? null : (GregorianCalendar)expire.clone(); - } - - /** - Returns the number of days before password expiration to start warning the user. - @return The number of days before expiration to warn the user. - **/ - public static int getPasswordExpirationWarningDays() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting the password expiration warning days:", AS400.expirationWarning); - return AS400.expirationWarning; - } - - /** - Returns the date of the last successful sign-on. -

    A connection is required to retrieve this information. If a connection has not been established, one is created to retrieve the information. - @return The date of the last successful sign-on. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public GregorianCalendar getPreviousSignonDate() throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting previous signon date."); - - chooseImpl(); - signon(false); - - GregorianCalendar last = signonInfo_.lastSignonDate; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Previous signon date: " + last); - - return (last == null) ? null : (GregorianCalendar)last.clone(); - } - - /** - Returns a profile token representing the signed-on user profile. -

    The returned token will be created single-use with a one hour time to expiration. Subsequent method calls will return the same token, regardless of the token status. -

    This function is not supported if the assigned password is *CURRENT. -

    This function is only supported if the system is at i5/OS V4R5M0 or greater. - @return A ProfileTokenCredential representing the currently signed on user. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @deprecated Use {@link #getProfileToken(int,int) getProfileToken(int,int)} instead. - **/ - public ProfileTokenCredential getProfileToken() throws AS400SecurityException, IOException, InterruptedException - { - connectService(AS400.SIGNON); - - if (signonInfo_.profileToken != null) - { - return (ProfileTokenCredential)signonInfo_.profileToken; - } - // If the password is not set and we are not using Kerberos. - if (credVault_.isEmpty() && credVault_.getType() != AUTHENTICATION_SCHEME_GSS_TOKEN) - { - throw new AS400SecurityException(AS400SecurityException.PASSWORD_NOT_SET); - } - - ProfileTokenCredential profileToken = new ProfileTokenCredential(); - try - { - profileToken.setSystem(this); - profileToken.setTokenType(ProfileTokenCredential.TYPE_SINGLE_USE); - profileToken.setTimeoutInterval(3600); - } - catch (PropertyVetoException e) - { - Trace.log(Trace.ERROR, "Unexpected PropertyVetoException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - - byte[] proxySeed = new byte[9]; - CredentialVault.rng.nextBytes(proxySeed); - - synchronized (this) - { - // The 'impl' needs our credential to authenticate with the system - // (i.e. to make sure we have enough authority to generate the profile token). - // Note that we do not send across the bytes in the clear, but encode them - // using random seeds generated and exchanged with the 'impl' object. - - CredentialVault tempVault = (CredentialVault)credVault_.clone(); - tempVault.storeEncodedUsingExternalSeeds(proxySeed, impl_.exchangeSeed(proxySeed)); // Don't re-encode our own vault; we might need to reuse it later. - impl_.generateProfileToken(profileToken, userId_, tempVault, gssName_); // @mds - } - signonInfo_.profileToken = profileToken; - return profileToken; - } - - /** - Authenticates the assigned user profile and password and returns a corresponding ProfileTokenCredential if successful. -

    This function is not supported if the assigned password is *CURRENT and cannot be used to generate a renewable token. This function is only supported if the system is at i5/OS V4R5M0 or greater. - @param tokenType The type of profile token to create. Possible types are defined as fields on the ProfileTokenCredential class: -

      -
    • {@link com.ibm.as400.security.auth.ProfileTokenCredential#TYPE_SINGLE_USE TYPE_SINGLE_USE} -
    • {@link com.ibm.as400.security.auth.ProfileTokenCredential#TYPE_MULTIPLE_USE_NON_RENEWABLE TYPE_MULTIPLE_USE_NON_RENEWABLE} -
    - @param timeoutInterval The number of seconds to expiration when the token is created (1-3600). - @return A ProfileTokenCredential representing the signed-on user. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - **/ - public ProfileTokenCredential getProfileToken(int tokenType, int timeoutInterval) throws AS400SecurityException, IOException, InterruptedException - { - connectService(AS400.SIGNON); - - // If the password is not set and we are not using Kerberos. - if (credVault_.isEmpty() && credVault_.getType() != AUTHENTICATION_SCHEME_GSS_TOKEN) - { - throw new AS400SecurityException(AS400SecurityException.PASSWORD_NOT_SET); - } - if (tokenType == ProfileTokenCredential.TYPE_MULTIPLE_USE_RENEWABLE) - { - Trace.log(Trace.ERROR, "Request not supported for renewable token type."); - throw new AS400SecurityException(AS400SecurityException.REQUEST_NOT_SUPPORTED); - } - - ProfileTokenCredential profileToken = new ProfileTokenCredential(); - try - { - profileToken.setSystem(this); - profileToken.setTokenType(tokenType); - profileToken.setTimeoutInterval(timeoutInterval); - } - catch (PropertyVetoException e) - { - Trace.log(Trace.ERROR, "Unexpected PropertyVetoException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - - byte[] proxySeed = new byte[9]; - CredentialVault.rng.nextBytes(proxySeed); - synchronized (this) - { - // The 'impl' needs our credential to authenticate with the system - // (i.e. to make sure we have enough authority to generate the profile token). - // Note that we do not send across the bytes in the clear, but encode them - // using random seeds generated and exchanged with the 'impl' object. - CredentialVault tempVault = (CredentialVault)credVault_.clone(); - tempVault.storeEncodedUsingExternalSeeds(proxySeed, impl_.exchangeSeed(proxySeed)); - impl_.generateProfileToken(profileToken, userId_, tempVault, gssName_); // @mds - } - return profileToken; - } - - /** - Authenticates the given user profile and password and returns a corresponding ProfileTokenCredential if successful. -

    Invoking this method does not change the user ID and password assigned to the system or otherwise modify the user or authorities under which the application is running. -

    This method generates a single use token with a timeout of one hour. -

    This function is only supported if the system is at i5/OS V4R5M0 or greater. -

    Note: Providing an incorrect password increments the number of failed sign-on attempts for the user profile, and can result in the profile being disabled. Refer to documentation on the ProfileTokenCredential class for additional restrictions. - @param userId The user profile name. - @param password The user profile password. - @return A ProfileTokenCredential representing the authenticated profile and password. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - **/ - public ProfileTokenCredential getProfileToken(String userId, String password) throws AS400SecurityException, IOException, InterruptedException - { - return getProfileToken(userId, password, ProfileTokenCredential.TYPE_SINGLE_USE, 3600); - } - - /** - Authenticates the given user profile and password and returns a corresponding ProfileTokenCredential if successful. -

    Invoking this method does not change the user ID and password assigned to the system or otherwise modify the user or authorities under which the application is running. -

    This function is only supported if the system is at i5/OS V4R5M0 or greater. -

    Note: Providing an incorrect password increments the number of failed sign-on attempts for the user profile, and can result in the profile being disabled. Refer to documentation on the ProfileTokenCredential class for additional restrictions. - @param userId The user profile name. - @param password The user profile password. - @param tokenType The type of profile token to create. Possible types are defined as fields on the ProfileTokenCredential class: -

      -
    • {@link com.ibm.as400.security.auth.ProfileTokenCredential#TYPE_SINGLE_USE TYPE_SINGLE_USE} -
    • {@link com.ibm.as400.security.auth.ProfileTokenCredential#TYPE_MULTIPLE_USE_NON_RENEWABLE TYPE_MULTIPLE_USE_NON_RENEWABLE} -
    • {@link com.ibm.as400.security.auth.ProfileTokenCredential#TYPE_MULTIPLE_USE_RENEWABLE TYPE_MULTIPLE_USE_RENEWABLE} -
    - @param timeoutInterval The number of seconds to expiration when the token is created (1-3600). - @return A ProfileTokenCredential representing the authenticated profile and password. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - **/ - public ProfileTokenCredential getProfileToken(String userId, String password, int tokenType, int timeoutInterval) throws AS400SecurityException, IOException, InterruptedException - { - connectService(AS400.SIGNON); - - // Validate parms. - if (userId == null) - { - throw new NullPointerException("userId"); - } - if (userId.length() > 10) - { - throw new ExtendedIllegalArgumentException("userId", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (password == null) - { - throw new NullPointerException("password"); - } - if (password.length() > 128) - { - throw new ExtendedIllegalArgumentException("password.length (" + password.length() + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - userId = resolveUserId(userId.toUpperCase()); - - ProfileTokenCredential profileToken = new ProfileTokenCredential(); - try - { - profileToken.setSystem(this); - profileToken.setTokenType(tokenType); - profileToken.setTimeoutInterval(timeoutInterval); - } - catch (PropertyVetoException e) - { - Trace.log(Trace.ERROR, "Unexpected PropertyVetoException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - - byte[] proxySeed = new byte[9]; - CredentialVault.rng.nextBytes(proxySeed); - synchronized (this) - { - PasswordVault tempVault = new PasswordVault(password); - tempVault.storeEncodedUsingExternalSeeds(proxySeed, impl_.exchangeSeed(proxySeed)); - impl_.generateProfileToken(profileToken, userId, tempVault, gssName_); - } - return profileToken; - } - - /** - Returns the name of the middle-tier machine where the proxy server is running. - @return The name of the middle-tier machine where the proxy server is running, or an empty string ("") if not set. - **/ - public String getProxyServer() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting proxy server:", proxyServer_); - return proxyServer_; - } - - /** - Returns the release of the IBM i system. -

    A connection is required to the system in order to retrieve this information. If a connection has not been established, one is created to retrieve the system information. - @return The release of the IBM i system. For example, version 5, release 1, modification level 0, returns 1. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public int getRelease() throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting release level."); - chooseImpl(); - signon(false); - - int release = signonInfo_.version.getRelease(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Release level:", release); - - return release; - } - - // Converts a service constant to a service name. - static String getServerName(int service) - { - switch (service) - { - case AS400.FILE: - return "as-file"; - case AS400.PRINT: - return "as-netprt"; - case AS400.COMMAND: - return "as-rmtcmd"; - case AS400.DATAQUEUE: - return"as-dtaq"; - case AS400.DATABASE: - return "as-database"; - case AS400.RECORDACCESS: - return "as-ddm"; - case AS400.CENTRAL: - return "as-central"; - case AS400.SIGNON: - return "as-signon"; - default: - throw new ExtendedIllegalArgumentException("service (" + service + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - /** - Returns the service port stored in the service port table for the specified service. - @param service The name of the service. Valid services are: -

      -
    • {@link #FILE FILE} - IFS file classes. -
    • {@link #PRINT PRINT} - print classes. -
    • {@link #COMMAND COMMAND} - command and program call classes. -
    • {@link #DATAQUEUE DATAQUEUE} - data queue classes. -
    • {@link #DATABASE DATABASE} - JDBC classes. -
    • {@link #RECORDACCESS RECORDACCESS} - record level access classes. -
    • {@link #CENTRAL CENTRAL} - license management classes. -
    • {@link #SIGNON SIGNON} - sign-on classes. -
    - @return The port specified in the service port table. The value {@link #USE_PORT_MAPPER USE_PORT_MAPPER} will be returned if the service has not been set, and the service has not been connected. - **/ - public int getServicePort(int service) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting service port, service:", service); - // Validate parameter. - if (service < 0 || service > 7) - { - throw new ExtendedIllegalArgumentException("service (" + service + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Validate state. - if (systemName_.length() == 0 && !systemNameLocal_) - { - Trace.log(Trace.ERROR, "Cannot get service port before system name is set."); - throw new ExtendedIllegalStateException("systemName", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - chooseImpl(); - int port = impl_.getServicePort((systemNameLocal_) ? "localhost" : systemName_, service); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Service port:", port); - return port; - } - - /** - Returns the date for the current sign-on. -

    A connection is required to the system to retrieve this information. If a connection has not been established, one is created to retrieve the system information. - @return The date for the current sign-on. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public GregorianCalendar getSignonDate() throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting signon date."); - - chooseImpl(); - signon(false); - - GregorianCalendar current = signonInfo_.currentSignonDate; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Signon date: " + current); - - return (current == null) ? null : (GregorianCalendar)current.clone(); - } - - /** - Returns the sign-on handler that is used by this object. Never returns null. - @return The sign-on handler. - @see #setSignonHandler - @see #setDefaultSignonHandler - **/ - public SignonHandler getSignonHandler() - { - if (signonHandler_ != null) return signonHandler_; - else return getDefaultSignonHandler(); - } - - /** - Returns a copy of the socket options object. - @return The socket options object. - **/ - public SocketProperties getSocketProperties() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting socket properties."); - SocketProperties socketProperties = new SocketProperties(); - socketProperties.copyValues(socketProperties_); - return socketProperties; - } - - /** - Returns the name of the IBM i system. The system name is provided on the constructor or may have been provided by the user at the sign-on prompt. - @return The name of the IBM i system, or an empty string ("") if not set. - **/ - public String getSystemName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system name: " + systemName_ + ", is local:", systemNameLocal_); - return (systemNameLocal_) ? "localhost" : systemName_; - } - - /** - Returns the time zone of the IBM i system. - The TimeZone object will have the correct UTC offset for the system. - @return A TimeZone object representing the time zone for the system. - @exception AS400SecurityException If a security or authority error - occurs. - @exception ErrorCompletingRequestException If an error occurs before - the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with - the system. - @exception ObjectDoesNotExistException If the API used to retrieve the information does not exist on the system. - @see DateTimeConverter#timeZoneForSystem - @deprecated Use {@link #getTimeZone() getTimeZone()} instead. - **/ - public TimeZone getSystemTimeZone() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - return getTimeZone(); - } - - /** - Returns the time zone of the IBM i system. - The TimeZone object will have the correct UTC offset for the system. - @return A TimeZone object representing the time zone for the system. - @exception AS400SecurityException If a security or authority error - occurs. - @exception ErrorCompletingRequestException If an error occurs before - the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with - the system. - @exception ObjectDoesNotExistException If the API used to retrieve the information does not exist on the system. - @see DateTimeConverter#timeZoneForSystem - **/ - public TimeZone getTimeZone() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting time zone"); - if (timezone_ == null) { - timezone_ = DateTimeConverter.timeZoneForSystem(this); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Time zone:", timezone_.getDisplayName()); - return timezone_; - } - - /** - Returns the user ID. The user ID returned may be set as a result of the constructor, or it may be what the user typed in at the sign-on prompt. - @return The user ID, or an empty string ("") if not set. - **/ - public String getUserId() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting user ID:", userId_); - userId_ = resolveUserId(userId_, credVault_.getType(), mustUseSuppliedProfile_); - return userId_; - } - - /** - Returns the user ID. The user ID returned may be set as a result of the constructor, or it may be what the user typed in at the sign-on prompt. - @param forceRefresh If true, force the current userID information to be reloaded. When running natively with system name specified as localhost, this will obtain the user profile under which the thread is currently running. This may have changed since object construction, if a profile swap has been performed on the thread. If false, or if running remotely, then this method behaves identically to {@link #getUserId getUserId()}. - @return The user ID, or an empty string ("") if not set. - **/ - public String getUserId(boolean forceRefresh) - { - if (!forceRefresh) return getUserId(); - else - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting current user ID:", userId_); - String currentUserID = userId_; - if (systemNameLocal_ && AS400.onAS400) - { - try - { - currentUserID = CurrentUser.getUserID(AS400.nativeVRM.getVersionReleaseModification()); - if (currentUserID == null || currentUserID.length() == 0) { - currentUserID = userId_; - } - } - catch (Throwable t) { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, t); - currentUserID = userId_; - } - } - - return currentUserID; - } - } - - /** - Returns the version of the IBM i system. -

    A connection is required to the system to retrieve this information. If a connection has not been established, one is created to retrieve the system information. - @return The version of the IBM i system. For example, version 5, release 1, modification level 0, returns 5. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public int getVersion() throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting version level."); - chooseImpl(); - signon(false); - - int version = signonInfo_.version.getVersion(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Version level:", version); - - return version; - } - - /** - Returns the version, release, and modification level for the system. -

    A connection is required to the system to retrieve this information. If a connection has not been established, one is created to retrieve the system information. - @return The high 16-bit is the version, the next 8 bits is the release, and the low 8 bits is the modification level. Thus version 5, release 1, modification level 0, returns 0x00050100. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public int getVRM() throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting VRM."); - chooseImpl(); - signon(false); - - int vrm = signonInfo_.version.getVersionReleaseModification(); - if (Trace.traceOn_) - { - byte[] vrmBytes = new byte[4]; - BinaryConverter.intToByteArray(vrm, vrmBytes, 0); - Trace.log(Trace.DIAGNOSTIC, "VRM:", vrmBytes); - } - - return vrm; - } - - /** - Initialize conversion table for the given CCSID. The default EBCDIC to unicode converters are not shipped with some browsers. This method can be used to check and download converters if they are not available locally. - @param ccsid the CCSID for the conversion table to initialize. - **/ - public void initializeConverter(int ccsid) throws UnsupportedEncodingException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Initializing converter for CCSID:", ccsid); - chooseImpl(); - try - { - signon(false); - impl_.newConverter(ccsid); - } - catch (Exception e) - { - Trace.log(Trace.WARNING, "Error initializing converter:", e); - throw new UnsupportedEncodingException(); - } - } - - /** - Indicates if any service is currently connected through this object. -

    A service is considered "connected" if connectService() has been called, or an implicit connect has been done by the service, and disconnectService() or disconnectAllServices() has not been called. If the most recent attempt to contact the service failed with an exception, the service is considered disconnected. - @return true if any service is connected; false otherwise. - @see #isConnectionAlive - **/ - public boolean isConnected() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking for any service connection..."); - if (isConnected(AS400.FILE) || - isConnected(AS400.PRINT) || - isConnected(AS400.COMMAND) || - isConnected(AS400.DATAQUEUE) || - isConnected(AS400.DATABASE) || - isConnected(AS400.RECORDACCESS) || - isConnected(AS400.CENTRAL)|| - isConnected(AS400.SIGNON)) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "A service is connected."); - return true; - } - else - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "No service is connected."); - return false; - } - } - - /** - Indicates if a service is currently connected through this object. -

    A service is considered "connected" if connectService() has been called, or an implicit connect has been done by the service, and disconnectService() or disconnectAllServices() has not been called. If the most recent attempt to contact the service failed with an exception, the service is considered disconnected. - @param service The name of the service. Valid services are: -

      -
    • {@link #FILE FILE} - IFS file classes. -
    • {@link #PRINT PRINT} - print classes. -
    • {@link #COMMAND COMMAND} - command and program call classes. -
    • {@link #DATAQUEUE DATAQUEUE} - data queue classes. -
    • {@link #DATABASE DATABASE} - JDBC classes. -
    • {@link #RECORDACCESS RECORDACCESS} - record level access classes. -
    • {@link #CENTRAL CENTRAL} - license management classes. -
    • {@link #SIGNON SIGNON} - sign-on classes. -
    - @return true if service is connected; false otherwise. - @see #isConnectionAlive - **/ - public boolean isConnected(int service) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking for service connection:", service); - // Validate parameter. - if (service < 0 || service > 7) - { - throw new ExtendedIllegalArgumentException("service (" + service + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (impl_ == null) return false; - boolean connected = impl_.isConnected(service); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Service connection:", connected); - return connected; - } - - - /** - Tests the connection to the system, to verify that it is still working. - This is similar in concept to "pinging" the system over the connection. - If no services have been connected, this method returns false; it doesn't implicitly connect services. -

    Note: This method is not fully supported until IBM i 7.1. If running to IBM i 6.1 or lower, then the behavior of this method matches that of {@link #isConnected() isConnected()}, and therefore may incorrectly return true if the connection has failed recently. -

    Note: If the only service connected is {@link #RECORDACCESS RECORDACCESS}, then this method defaults to the behavior of {@link #isConnected() isConnected()}. - - @return true if the connection is still working; false otherwise. - @see #isConnected - @see AS400JPing - **/ - public boolean isConnectionAlive() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Testing connection..."); - - boolean alive; - if (impl_ == null) alive = false; - else alive = impl_.isConnectionAlive(); - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Connection status:", alive); - return alive; - } - - - /** - Tests the connection to a service on the system, to verify that it is still working. - This is similar in concept to "pinging" the system over the connection. - If no services have been connected, this method returns false; it doesn't implicitly connect services. -

    Note: This method is not fully supported until IBM i 7.1. If running to IBM i 6.1 or lower, then the behavior of this method matches that of {@link #isConnected() isConnected()}, and therefore may incorrectly return true if the connection has failed recently. -

    Note: If the specified service is {@link #RECORDACCESS RECORDACCESS}, then this method defaults to the behavior of {@link #isConnected() isConnected()}. - @param service The name of the service. Valid services are: -

      -
    • {@link #FILE FILE} - IFS file classes. -
    • {@link #PRINT PRINT} - print classes. -
    • {@link #COMMAND COMMAND} - command and program call classes. -
    • {@link #DATAQUEUE DATAQUEUE} - data queue classes. -
    • {@link #DATABASE DATABASE} - JDBC classes. -
    • {@link #RECORDACCESS RECORDACCESS} - record level access classes. -
    • {@link #CENTRAL CENTRAL} - license management classes. -
    • {@link #SIGNON SIGNON} - sign-on classes. -
    - @return true if the connection to the service is still working; false otherwise. - @see #isConnected - @see AS400JPing - **/ - public boolean isConnectionAlive(int service) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Testing connection..."); - - boolean alive; - if (impl_ == null) alive = false; - else alive = impl_.isConnectionAlive(service); - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Connection status:", alive); - return alive; - } - - /** - Returns the sign-on prompting mode for this object. If true, then messages are displayed. If warnings or errors occur, the sign-on and change password dialogs are displayed if needed. If false, warnings and errors result in exceptions, and password dialogs are not displayed. The caller has to provide the user ID and password. - @return true if using GUI; false otherwise. - **/ - public boolean isGuiAvailable() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if GUI is available:", guiAvailable_); - return guiAvailable_; - } - - /** - Indicates if this object is representing the system you are currently running on. - @return true if you are running on the local system; false otherwise. - **/ - public boolean isLocal() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if local:", systemNameLocal_); - return systemNameLocal_; - } - - /** - When your Java program runs on the system, some Toolbox classes access data via a call to an API instead of making a socket call to the system. There are minor differences in the behavior of the classes when they use API calls instead of socket calls. If your program is affected by these differences you can check whether the Toolbox classes will use socket calls instead of API calls by using this method. - @return true if you have indicated that the services must use sockets; false otherwise. - **/ - public boolean isMustUseSockets() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if must use sockets:", mustUseSockets_); - return mustUseSockets_; - } - - /** - Indicates if checkboxes should be shown on the sign-on dialog. - @return true if checkboxes should be shown; false otherwise. - **/ - public boolean isShowCheckboxes() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if checkboxes are shown:", showCheckboxes_); - return showCheckboxes_; - } - - // Check if systemName refers to the system we are running on. - private static boolean isSystemNameLocal(String systemName) - { - if (systemName.equalsIgnoreCase("localhost")) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "System name is 'localhost'."); - return true; - } - else - { - try - { - InetAddress localInet = InetAddress.getLocalHost(); - InetAddress[] remoteInet = InetAddress.getAllByName(systemName); - - for (int i = 0; i < remoteInet.length; ++i) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Comparing local address " + localInet + " to " + remoteInet[i]); - if (localInet.equals(remoteInet[i])) - { - return true; - } - } - } - catch (UnknownHostException e) - { - Trace.log(Trace.ERROR, "Error retrieving host address information:", e); - } - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "System name is not local."); - return false; - } - - /** - Indicates whether threads are used in communication with the host servers. - @return true if threads are used; false otherwise. - **/ - public boolean isThreadUsed() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if thread is used:", threadUsed_); - return threadUsed_; - } - - /** - Indicates if the default user should be used by this object. If the default user is not used and a user ID was not specified on the constructor, then the user will be prompted for a user ID. - @return true if default user should be used; false otherwise. - **/ - public boolean isUseDefaultUser() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if default user is used:", useDefaultUser_); - return useDefaultUser_; - } - - /** - Indicates if the password cache is being used by this object. If the password cache is not used, the user will always be prompted for password if one was not provided. - @return true if password cache is being used; false otherwise. - **/ - public boolean isUsePasswordCache() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if password cache is used:", usePasswordCache_); - return usePasswordCache_; - } - - // Load the specified implementation object. Exceptions are swallowed, null is returned if the object cannot be loaded. - static Object loadImpl(String impl) - { - if (impl.indexOf ('.') == -1) - { - impl = "com.ibm.as400.access." + impl; - } - - if (Trace.traceOn_ && alreadyCheckedForMultipleVersions_++ < 10) - { - Trace.log(Trace.DIAGNOSTIC, "Checking for multiple Toolbox versions."); - try - { - String thisFileName = "com/ibm/as400/access/AS400.class"; - String loadFileName = impl.replace('.', '/') + ".class"; - ClassLoader thisLoader = Class.forName(CLASSNAME).getClassLoader(); - ClassLoader loadLoader = Class.forName(impl).getClassLoader(); - if (thisLoader != null && loadLoader != null) - { - URL thisUrl = thisLoader.getResource(thisFileName); - URL loadUrl = loadLoader.getResource(loadFileName); - if (thisUrl != null && loadUrl != null) - { - String thisPath = thisUrl.getPath(); - String loadPath = loadUrl.getPath(); - Trace.log(Trace.DIAGNOSTIC, "Path of AS400 class:", thisPath); - Trace.log(Trace.DIAGNOSTIC, "Path of loaded impl class:", loadPath); - String thisDirPath = thisPath.length() <= thisFileName.length() ? "" : thisPath.substring(0, thisPath.length() - thisFileName.length() - 1); - String loadDirPath = loadPath.length() <= loadFileName.length() ? "" : loadPath.substring(0, loadPath.length() - loadFileName.length() - 1); - if (!thisDirPath.equals(loadDirPath)) - { - Trace.log(Trace.WARNING, "Toolbox classes found in two different locations: " + thisDirPath + " and " + loadDirPath); - } - } - } - } - catch (ClassNotFoundException e) - { - Trace.log(Trace.DIAGNOSTIC, "Class not found:", e.getMessage()); - } - catch (Throwable e) - { - Trace.log(Trace.DIAGNOSTIC, e); - } - } - - try - { - return Class.forName(impl).newInstance(); - } - catch (ClassNotFoundException e1) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Class not found:", e1.getMessage()); - } - catch (IllegalAccessException e2) - { - Trace.log(Trace.ERROR, "Unexpected IllegalAccessException:", e2); - } - catch (InstantiationException e3) - { - Trace.log(Trace.ERROR, "Unexpected InstantiationException:", e3); - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Load of implementation failed:", impl); - - return null; - } - - // Load the appropriate implementation object. - // param impl1 fully package named class name for native implementation. - // param impl2 fully package named class name for remote implementation. - Object loadImpl(String impl1, String impl2) - { - if (canUseNativeOptimizations()) - { - Object impl = loadImpl(impl1); - if (impl != null) return impl; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Load of native implementation '" + impl1 + "' failed, attempting to load remote implementation."); - } - Object impl = loadImpl(impl2); - if (impl != null) return impl; - - Trace.log(Trace.DIAGNOSTIC, "Load of remote implementation '" + impl2 + "' failed."); - throw new ExtendedIllegalStateException(impl2, ExtendedIllegalStateException.IMPLEMENTATION_NOT_FOUND); - } - - // Load the appropriate implementation object when only remote or proxy implementations are involved. - // param impl1 fully package named class name for remote implementation. - // param impl2 fully package named class name for proxy implementation. - Object loadImpl2(String impl1, String impl2) - { - if (proxyServer_.length() > 0) - { - synchronized (this) - { - if (proxyClientConnection_ == null) - { - proxyClientConnection_ = new ProxyClientConnection(proxyServer_, useSSLConnection_); - } - } - ProxyImpl proxyImpl = (ProxyImpl)loadImpl(impl2); - if (proxyImpl != null) - { - proxyImpl.construct((ProxyClientConnection)proxyClientConnection_); - return proxyImpl; - } - } - - Object impl = loadImpl(impl1); - if (impl != null) return impl; - - Trace.log(Trace.DIAGNOSTIC, "Load of remote implementation '" + impl1 + "' failed."); - throw new ExtendedIllegalStateException(impl1, ExtendedIllegalStateException.IMPLEMENTATION_NOT_FOUND); - } - - // Load the appropriate implementation object when a remote, proxy, or native implementations are involved. - // param impl1 fully package named class name for native implementation. - // param impl2 fully package named class name for remote implementation. - // param impl3 fully package named class name for proxy implementation. - Object loadImpl3(String impl1, String impl2, String impl3) - { - if (proxyServer_.length() > 0) - { - synchronized (this) - { - if (proxyClientConnection_ == null) - { - proxyClientConnection_ = new ProxyClientConnection(proxyServer_, useSSLConnection_); - } - } - ProxyImpl proxyImpl = (ProxyImpl)loadImpl(impl3); - if (proxyImpl != null) - { - proxyImpl.construct((ProxyClientConnection)proxyClientConnection_); - return proxyImpl; - } - } - - if (canUseNativeOptimizations()) - { - Object impl = loadImpl(impl1); - if (impl != null) return impl; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Load of native implementation '" + impl1 + "' failed, attempting to load remote implementation."); - } - - Object impl = loadImpl(impl2); - if (impl != null) return impl; - - Trace.log(Trace.DIAGNOSTIC, "Load of remote implementation '" + impl2 + "' failed."); - throw new ExtendedIllegalStateException(impl2, ExtendedIllegalStateException.IMPLEMENTATION_NOT_FOUND); - } - - // State machine constants for running through sign-on prompts. - private static final int FINISHED = 0; - private static final int VALIDATE = 1; - private static final int PROMPT = 2; - // Maximum number of iterations of the state machine before we suspect infinite loop. - private static final int MAX_ITERATIONS = 20; // Future enhancement: Make this configurable - // Run through the various prompts for signon. - private void promptSignon() throws AS400SecurityException, IOException - { - if (signingOn_) - { - Trace.log(Trace.ERROR, "AS400.promptSignon() called while already signing on. SignonHandler may have called a prohibited method."); - throw new ExtendedIllegalStateException(ExtendedIllegalStateException.SIGNON_ALREADY_IN_PROGRESS); - } - - try - { - signingOn_ = true; // Detect/prevent recursion. - boolean reconnecting = (signonInfo_ != null); // Is this a reconnection. - - // Start in validate state. - int pwState = VALIDATE; - SignonHandler soHandler = getSignonHandler(); - - // If something isn't set, go to prompt state. - if (credVault_.getType() == AUTHENTICATION_SCHEME_PASSWORD && (systemName_.length() == 0 || userId_.length() == 0 || credVault_.isEmpty() || !(soHandler instanceof ToolboxSignonHandler) || forcePrompt_)) //@prompt @mds - { - pwState = PROMPT; - } - - int counter = 0; // Loop counter to detect infinite looping. - boolean proceed = true; - - do - { - counter++; - try - { - switch (pwState) - { - case VALIDATE: - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Validate security..."); - sendSignonRequest(); - break; - case PROMPT: - if(!isGuiAvailable() && forcePrompt_) //@prompt - { //@prompt - //JDBC flagged id/pass as invalid and set forcePrompt, but GUI not available //@prompt - //So don't even try to authenticate because it could be a non-safe password. //@prompt - Trace.log(Trace.ERROR, "No GUI available for signon dialog."); //@prompt - handlerCanceled_ = true; // Don't submit exception to handler. //@prompt - throw new AS400SecurityException(AS400SecurityException.SIGNON_CHAR_NOT_VALID); //@prompt - } //@prompt - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Calling SignonHandler..."); - // If bytes_ has not been set, tell the handler something is missing. - SignonEvent soEvent = new SignonEvent(this, reconnecting); - proceed = soHandler.connectionInitiated(soEvent, credVault_.isEmpty()); - if (!proceed) - { - // User canceled. - Trace.log(Trace.DIAGNOSTIC, "User canceled."); - handlerCanceled_ = true; // Don't submit exception to handler. - throw new AS400SecurityException(AS400SecurityException.SIGNON_CANCELED); - } - - sendSignonRequest(); - - // See if we should cache the password. - if (isUsePasswordCache() && credVault_.getType() == AUTHENTICATION_SCHEME_PASSWORD) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting password cache entry from SignonHandler..."); - setCacheEntry(systemName_, userId_, credVault_); - } - break; - default: // This should never happen. - Trace.log(Trace.ERROR, "Invalid password prompt state:", pwState); - throw new InternalErrorException(InternalErrorException.SECURITY_INVALID_STATE, pwState); - } - - // Check for number of days to expiration, and warn if within threshold. - if (getDaysToExpiration() < AS400.expirationWarning) - { - SignonEvent soEvent = new SignonEvent(this, reconnecting); - proceed = soHandler.passwordAboutToExpire(soEvent, getDaysToExpiration()); - if (!proceed) - { - handlerCanceled_ = true; // Don't submit exception to handler. - throw new AS400SecurityException(AS400SecurityException.SIGNON_CANCELED); - } - } - pwState = FINISHED; // If we got this far, we're done. - } - catch (AS400SecurityException e) - { - if (handlerCanceled_) throw e; // Handler already gave up on this event. - Trace.log(Trace.ERROR, "Security exception in sign-on:", e); - SignonEvent soEvent = new SignonEvent(this, reconnecting, e); - switch (e.getReturnCode()) - { - case AS400SecurityException.PASSWORD_EXPIRED: - proceed = soHandler.passwordExpired(soEvent); - break; - case AS400SecurityException.PASSWORD_NOT_SET: - proceed = soHandler.passwordMissing(soEvent); - break; - case AS400SecurityException.PASSWORD_INCORRECT: - case AS400SecurityException.PASSWORD_OLD_NOT_VALID: - proceed = soHandler.passwordIncorrect(soEvent); - break; - case AS400SecurityException.PASSWORD_LENGTH_NOT_VALID: - case AS400SecurityException.PASSWORD_NEW_TOO_LONG: - case AS400SecurityException.PASSWORD_NEW_TOO_SHORT: - proceed = soHandler.passwordLengthIncorrect(soEvent); - break; - case AS400SecurityException.PASSWORD_INCORRECT_USERID_DISABLE: - proceed = soHandler.userIdAboutToBeDisabled(soEvent); - break; - case AS400SecurityException.USERID_UNKNOWN: - proceed = soHandler.userIdUnknown(soEvent); - break; - case AS400SecurityException.USERID_DISABLE: - proceed = soHandler.userIdDisabled(soEvent); - break; - default: - soHandler.exceptionOccurred(soEvent); // Handler rethrows if can't handle. - } - if (!proceed) { throw e; } - - // Assume handler has corrected any incorrect values. Prepare to try again. - pwState = VALIDATE; - } - catch (UnknownHostException e) - { - SignonEvent soEvent = new SignonEvent(this, reconnecting); - proceed = soHandler.systemNameUnknown(soEvent, e); - if (!proceed) { throw e; } - pwState = VALIDATE; - } - } - while (pwState != FINISHED && counter < MAX_ITERATIONS); - - if (pwState != FINISHED) - { - Trace.log(Trace.ERROR, "Possible infinite loop while interacting with SignonHandler."); - throw new AS400SecurityException(AS400SecurityException.SIGNON_REQUEST_NOT_VALID); - } - } - finally - { - signingOn_ = false; - forcePrompt_ = false; //@prompt - } - } - - // Help de-serialize the object. - private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "De-serializing AS400 object."); - in.defaultReadObject(); - - construct(); - - systemNameLocal_ = resolveSystemNameLocal(systemName_); - - proxyServer_ = resolveProxyServer(""); - // proxyClientConnection_ can stay null. - ccsid_ = 0; - // connectionListeners_ can stay null. - // dispatcher_ can stay null. - // propertyChangeListeners_ can stay null. - // vetoableChangeListeners_ can stay null. - - propertiesFrozen_ = false; - // impl_ can stay null. - // signonInfo_ can stay null. - - // Default to password authentication, just like we would if - // an AS400 object was constructed with no parameters. - credVault_ = new PasswordVault(); - } - - /** - Removes a listener from the connection event list. - @param listener The listener object. - **/ - public void removeConnectionListener(ConnectionListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing connection listener."); - if (listener == null) - { - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If we have listeners. - if (connectionListeners_ != null) - { - connectionListeners_.removeElement(listener); - // If we have a connection, and we're now out of listeners. - if (impl_ != null && connectionListeners_.isEmpty()) - { - // Remove the dispatcher. - impl_.removeConnectionListener(dispatcher_); - } - } - } - } - - /** - Removes the default user for the given system name. - @param systemName The name of the IBM i system. - **/ - public static void removeDefaultUser(String systemName) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing the default user, system name:", systemName); - if (systemName == null) - { - throw new NullPointerException("systemName"); - } - AS400.defaultUsers.remove(resolveSystem(systemName)); - } - - /** - Removes the password cache entry associated with this system name and user ID. Only applies within this Java virtual machine. - @param systemName The name of the IBM i system. - @param userId The user profile name. - **/ - public static void removePasswordCacheEntry(String systemName, String userId) - { - boolean isLocalHost = false; - String longName = null; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing password cache entry, system name: " + systemName + " user ID: " + userId); - if (systemName == null) - { - throw new NullPointerException("systemName"); - } - if (userId == null) - { - throw new NullPointerException("userId"); - } - if (userId.length() > 10) - { - throw new ExtendedIllegalArgumentException("userId (" + userId + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - systemName = resolveSystem(systemName); - - boolean localHost = systemName.equals("localhost"); - if (localHost) { - isLocalHost = true; - try { - systemName = InetAddress.getLocalHost().getHostName(); - } catch (Exception e) { /* ignore */ } - } else { - // Note. The check to see if the current system was also local host was - // done in resolveSystem. - } - int dotIndex = systemName.indexOf("."); - if (dotIndex > 0) { - longName = systemName; - systemName = systemName.substring(0,dotIndex); - } - - userId = resolveUserId(userId.toUpperCase()); - - synchronized (AS400.systemList) - { - for (int i = AS400.systemList.size() - 1; i >= 0; i--) - { - Object[] secobj = (Object[])AS400.systemList.elementAt(i); - if (systemName.equalsIgnoreCase((String)secobj[0]) && userId.equals(secobj[1])) - { - AS400.systemList.removeElementAt(i); - } else if (isLocalHost && "localhost".equalsIgnoreCase((String)secobj[0]) && userId.equals(secobj[1])) { - AS400.systemList.removeElementAt(i); - } else if (longName != null && longName.equalsIgnoreCase((String)secobj[0]) && userId.equals(secobj[1])) { - AS400.systemList.removeElementAt(i); - } - } - } - } - - /** - Removes a property changed listener from the listener list. - @param listener The listener object. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) - { - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes a listener from the veto list. - @param listener The listener object. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - if (listener == null) - { - throw new NullPointerException("listener"); - } - // If we have listeners. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - /** - Disconnects all services, and clears the sign-on information. - This intent of this method is to "wipe the slate clean" for this AS400 object, enabling connection properties to be subsequently reset. - @see #disconnectAllServices - **/ - public synchronized void resetAllServices() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Resetting all services."); - disconnectAllServices(); - signonInfo_ = null; - propertiesFrozen_ = false; - ccsid_ = 0; - } - - // Resolves the proxy server name. If it is not specified, then look it up in the system properties. Returns empty string if not set. - private static String resolveProxyServer(String proxyServer) - { - if (proxyServer.length() == 0) - { - proxyServer = SystemProperties.getProperty(SystemProperties.AS400_PROXY_SERVER); - if (proxyServer == null) return ""; - } - return proxyServer; - } - - // If connecting to local system, make systemName "localhost". - static String resolveSystem(String systemName) - { - // First, see if we are running on IBM i. - if (AS400.onAS400) - { - // If system name is null, then make it a localhost. - if (systemName.length() == 0) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Resolving initial system name to 'localhost'."); - return "localhost"; - } - else if (isSystemNameLocal(systemName)) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Resolving system name to 'localhost'."); - return "localhost"; - } - } - return systemName; - } - - // Convenience method to determine if systemName is local system. - static boolean resolveSystemNameLocal(String systemName) - { - if (AS400.onAS400) - { - if (systemName.length() == 0 || isSystemNameLocal(systemName)) return true; - } - return false; - } - - // If on the system, resolve user ID to current user ID. - static String resolveUserId(String userId) - { - // Resolve user ID, for someone using user ID/password. - return resolveUserId(userId, 0, false); - } - - private static boolean currentUserAvailable = true; - private static boolean currentUserTried = false; - static boolean currentUserAvailable() - { - if (!currentUserTried) - { - try - { - Class.forName("com.ibm.as400.access.CurrentUser"); - } - catch (Throwable t) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "CurrentUser class is not available:", t); - currentUserAvailable = false; - } - currentUserTried = true; - } - return currentUserAvailable; - } - - // If on the system, resolve user ID to current user ID. - static String resolveUserId(String userId, int byteType, boolean mustUseSuppliedProfile) - { - // First, see if we are running on the system. - if (AS400.onAS400 && !mustUseSuppliedProfile && currentUserAvailable()) - { - boolean tryToGetCurrentUserID = false; - // If user ID is not set and we're using user ID/password, then we get it and set it up. - if (userId.length() == 0 && byteType == 0) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Resolving initial user ID."); - tryToGetCurrentUserID = true; - } - // If we are running on the system, then *CURRENT for user ID means we want to connect using current user ID. - if (userId.equals("*CURRENT")) - { - // Get current user ID and use it. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Replacing *CURRENT as user ID."); - tryToGetCurrentUserID = true; - } - if (tryToGetCurrentUserID) - { - String currentUserID = CurrentUser.getUserID(AS400.nativeVRM.getVersionReleaseModification()); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Current user ID:", currentUserID); - if (currentUserID != null) return currentUserID; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Current user ID information not available, user ID: '" + userId + "'"); - } - } - - // Prepend Q to numeric user ID. - if (userId.length() > 0 && Character.isDigit(userId.charAt(0))) - { -// char[] userIdChars = userId.toCharArray(); -// for (int i = 0; i < userIdChars.length; ++i) -// { -// if (userIdChars[i] < '\u0030' || userIdChars[i] > '\u0039') -// { -// if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "User ID: '" + userId + "'"); -// return userId; -// } -// } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Prepending 'Q' to numeric user ID."); - userId = "Q" + userId; - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "User ID: '" + userId + "'"); - return userId; - } - - // Send sign-on request to sign-on server. - private void sendSignonRequest() throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Signing-on without prompting..."); - // No prompting. - if (credVault_.isEmpty() && !userIdMatchesLocal(userId_, mustUseSuppliedProfile_)) - { - throw new AS400SecurityException(AS400SecurityException.PASSWORD_NOT_SET); - } - - // If using GSS tokens, don't bother encoding the authentication info. - if (credVault_.getType() == AUTHENTICATION_SCHEME_GSS_TOKEN) - { - signonInfo_ = impl_.signon(systemName_, systemNameLocal_, userId_, credVault_, gssName_); // @mds - - if (gssCredential_ != null) impl_.setGSSCredential(gssCredential_); - credVault_.empty(); // GSSToken is single use only. @mds - } - else // Encode the authentication info before sending vault to impl. - { - byte[] proxySeed = new byte[9]; - CredentialVault.rng.nextBytes(proxySeed); - CredentialVault tempVault = (CredentialVault)credVault_.clone(); - tempVault.storeEncodedUsingExternalSeeds(proxySeed, impl_.exchangeSeed(proxySeed)); // @mds - - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "AS400 object proxySeed:", proxySeed); - } - signonInfo_ = impl_.signon(systemName_, systemNameLocal_, userId_, tempVault, gssName_); // @mds - } - if (userId_.length() == 0) userId_ = signonInfo_.userId; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sign-on completed."); - } - - /** - Sets or resets the identity token for this object. Using this method will clear any previously set authentication information. -

    Note: Authentication via IdentityToken is supported in operating system release V5R3M0 and by PTF in operating system releases V5R2M0 and V5R1M0. - @param identityToken The identity token. - **/ - public void setIdentityToken(byte[] identityToken) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting identity token."); - - if (identityToken == null) - { - throw new NullPointerException("identityToken"); - } - - synchronized (this) - { - credVault_.empty(); - credVault_ = new IdentityTokenVault(identityToken); - signonInfo_ = null; - } - } - - // Store information in password cache. - private static void setCacheEntry(String systemName, String userId, CredentialVault pwVault) // @mds - { - synchronized (AS400.systemList) - { - // Remove any duplicates in the list and add to the list. - for (int i = AS400.systemList.size() - 1; i >= 0; i--) - { - Object[] curPtr = (Object[])AS400.systemList.elementAt(i); - - if (systemName.equalsIgnoreCase((String)curPtr[0]) && userId.equals(curPtr[1])) - { - // Found duplicate, remove it. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding password cache entry, removing previous entry."); - AS400.systemList.removeElementAt(i); - } - } - - // Now add the new one. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding password cache entry for "+systemName+":"+userId+"."); - AS400.systemList.addElement(new Object[] {systemName, userId, pwVault.clone()} ); // @mds - } - } - - /** - Sets the CCSID to be used for this object. The CCSID property cannot be changed once a connection to the system has been established. - @param ccsid The CCSID to use for this object. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setCcsid(int ccsid) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting CCSID:", ccsid); - if (propertiesFrozen_) - { - Trace.log(Trace.ERROR, "Cannot set CCSID after connection has been made."); - throw new ExtendedIllegalStateException("ccsid", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - ccsid_ = ccsid; - } - else - { - Integer oldValue = new Integer(ccsid_); - Integer newValue = new Integer(ccsid); - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("ccsid", oldValue, newValue); - } - ccsid_ = ccsid; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("ccsid", oldValue, newValue); - } - } - } - - /** - Sets the relational database name (RDB name) used for record-level access (DDM) connections. The RDB name corresponds to the independent auxiliary storage pool (IASP) that it is using on the system. The RDB name cannot be changed while this object is actively connected to the {@link #RECORDACCESS RECORDACCESS} service; you must call {@link #disconnectService(int) AS400.disconnectService(AS400.RECORDACCESS)} first. - @param ddmRDB The name of the IASP or RDB to use, or null to indicate the default system ASP should be used. - @see #isConnected(int) - @see #getDDMRDB - **/ - public void setDDMRDB(String ddmRDB) - { - if (propertiesFrozen_) - { - Trace.log(Trace.ERROR, "Cannot set RDB name after connection has been made."); - throw new ExtendedIllegalStateException("ddmRDB", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - if (ddmRDB != null && ddmRDB.length() > 18) - { - throw new ExtendedIllegalArgumentException("ddmRDB", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (isConnected(RECORDACCESS)) - { - throw new ExtendedIllegalStateException("ddmRDB", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - ddmRDB_ = (ddmRDB == null ? null : ddmRDB.toUpperCase()); - } - - /** - Sets the default sign-on handler, globally across the JVM. - The specified handler object will be called at runtime if any AS400 object needs to obtain additional signon information, and a sign-on handler has not been set on the AS400 object via {@link #setSignonHandler setSignonHandler()}. -
    Users are advised to implement the default sign-on handler in a thread-safe manner, since it may occasionally be in simultaneous use by multiple threads. -
    If a default sign-on handler is not set, then the name of the default sign-on handler class is retrieved from the com.ibm.as400.access.AS400.signonHandler system property. -
    If not specified, an internal AWT-based sign-on handler is used. -

    Note: This property may also be set by specifying a fully-qualified class name in Java system property com.ibm.as400.access.AS400.signonHandler - @param handler The sign-on handler. Specifying null will reset the default sign-on handler to the internal AWT-based handler. - @see #getDefaultSignonHandler - **/ - public static void setDefaultSignonHandler(SignonHandler handler) - { - if (Trace.traceOn_) - { - if (handler == null) Trace.log(Trace.DIAGNOSTIC, "Setting the default sign-on handler to null."); - else if (defaultSignonHandler_ != null) Trace.log(Trace.DIAGNOSTIC, "Replacing default sign-on handler, formerly an instance of " + defaultSignonHandler_.getClass().getName()); - } - defaultSignonHandler_ = handler; - } - - /** - Sets the default user for a given system name. The default user is the user ID that is used to connect if a user ID is not provided for that system name. There can be only one default user per system name. Once the default user is set, it cannot be overridden. To change the default user, the caller should remove the default user and then set it. - @param systemName The name of the IBM i system. - @param userId The user profile name. - @return true if default user has been set; false otherwise. - **/ - public static boolean setDefaultUser(String systemName, String userId) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting the default user, system name: '" + systemName + "' user ID: '" + userId + "'"); - if (systemName == null) - { - throw new NullPointerException("systemName"); - } - if (userId == null) - { - throw new NullPointerException("userId"); - } - if (userId.length() > 10) - { - throw new ExtendedIllegalArgumentException("userId (" + userId + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - systemName = resolveSystem(systemName); - userId = resolveUserId(userId.toUpperCase()); - - synchronized (AS400.defaultUsers) - { - if (AS400.defaultUsers.get(systemName) == null) - { - AS400.defaultUsers.put(systemName, userId); - return true; - } - } - // Already have a default user, fail the op. - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Default user already set, set default user failed."); - return false; - } - - /** - Sets the GSS credential for this object. Using this method will set the authentication scheme to {@link #AUTHENTICATION_SCHEME_GSS_TOKEN AUTHENTICATION_SCHEME_GSS_TOKEN}. Only one authentication means (Kerberos ticket, profile token, identity token, or password) can be used at a single time. Using this method will clear any previously set authentication information. - @param gssCredential The GSS credential object. The object's type must be org.ietf.jgss.GSSCredential, the object is set to type Object only to avoid a JDK release dependency. - **/ - public void setGSSCredential(Object gssCredential) - { - if (gssCredential == null) - { - throw new NullPointerException("gssCredential"); - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting GSS credential: '" + gssCredential + "'"); - - synchronized (this) - { - gssCredential_ = gssCredential; - gssName_ = ""; - credVault_.empty(); - credVault_ = new GSSTokenVault(); - signonInfo_ = null; - - if (impl_ != null) impl_.setGSSCredential(gssCredential_); - - } - } - - /** - Sets the option for how the JGSS framework will be used to retrieve a GSS token for authenticating to the system. By default, if no password or profile token is set on this object, it will attempt to retrieve a GSS token. If that retrieval fails, a sign-on dialog can be presented, or on the system, the current user profile information can be used. This option can also be set to only do the GSS token retrieval or to skip the GSS token retrieval. - @param gssOption A constant indicating how GSS will be used. Valid values are: -

      -
    • {@link #GSS_OPTION_MANDATORY GSS_OPTION_MANDATORY} -
    • {@link #GSS_OPTION_FALLBACK GSS_OPTION_FALLBACK} -
    • {@link #GSS_OPTION_NONE GSS_OPTION_NONE} -
    - **/ - public void setGSSOption(int gssOption) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting GSS option:", gssOption); - if (gssOption < 0 || gssOption > 2) - { - throw new ExtendedIllegalArgumentException("gssOption (" + gssOption + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - gssOption_ = gssOption; - } - - /** - Sets the GSS name for this object. Using this method will set the authentication scheme to {@link #AUTHENTICATION_SCHEME_GSS_TOKEN AUTHENTICATION_SCHEME_GSS_TOKEN}. Only one authentication means (Kerberos ticket, profile token, identity token, or password) can be used at a single time. Using this method will clear any previously set authentication information. - @param gssName The GSS name string. - **/ - public void setGSSName(String gssName) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting GSS name: '" + gssName + "'"); - - if (gssName == null) - { - throw new NullPointerException("gssName"); - } - - synchronized (this) - { - gssName_ = gssName; - gssCredential_ = null; - credVault_.empty(); - credVault_ = new GSSTokenVault(); - signonInfo_ = null; - } - } - - /** - Sets the environment in which you are running. If guiAvailable is set to true, then prompting may occur during sign-on to display error conditions, to prompt for additional information, or to prompt for change password. If guiAvailable is set to false, then error conditions or missing information will result in exceptions. Applications that are running as IBM i applications or want to control the sign-on user interface may want to run with prompting mode set to false. Prompting mode is set to true by default. -

    Note: This property may also be set by specifying 'true' or 'false' in Java system property com.ibm.as400.access.AS400.guiAvailable - @param guiAvailable true to prompt; false otherwise. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - @see SignonHandler - **/ - public void setGuiAvailable(boolean guiAvailable) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting GUI available:", guiAvailable); - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - guiAvailable_ = guiAvailable; - } - else - { - Boolean oldValue = new Boolean(guiAvailable_); - Boolean newValue = new Boolean(guiAvailable); - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("guiAvailable", oldValue, newValue); - } - guiAvailable_ = guiAvailable; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("guiAvailable", oldValue, newValue); - } - } - } - - /** - Sets the Locale used to set the National Language Version (NLV) on the system. Only the COMMAND, PRINT, and DATABASE services accept an NLV. This method will set the NLV based on a mapping from the Locale object to the NLV. - @param locale The Locale object. - **/ - public void setLocale(Locale locale) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting locale: " + locale); - if (locale == null) - { - throw new NullPointerException("locale"); - } - if (propertiesFrozen_) - { - Trace.log(Trace.ERROR, "Cannot set locale after connection has been made."); - throw new ExtendedIllegalStateException("locale", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null) - { - locale_ = locale; - nlv_ = ExecutionEnvironment.getNlv(locale_); - } - else - { - Locale oldValue = locale_; - Locale newValue = locale; - - locale_ = locale; - nlv_ = ExecutionEnvironment.getNlv(locale_); - propertyChangeListeners_.firePropertyChange("locale", oldValue, newValue); - } - } - - /** - Sets the Locale and a specific National Language Version (NLV) to send to the system. Only the COMMAND, PRINT, and DATABASE services accept an NLV. - @param locale The Locale object. - @param nlv The NLV. - **/ - public void setLocale(Locale locale, String nlv) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting locale: " + locale + ", nlv: " + nlv_); - if (locale == null) - { - throw new NullPointerException("locale"); - } - if (nlv == null) - { - throw new NullPointerException("nlv"); - } - if (propertiesFrozen_) - { - Trace.log(Trace.ERROR, "Cannot set locale after connection has been made."); - throw new ExtendedIllegalStateException("locale", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - locale_ = locale; - nlv_ = nlv; - } - - /** - Sets this object to attempt to add the appropriate secondary language library to the library list, when running on the system. The default is false. Setting the language library will ensure that any system error messages that are returned, will be returned in the appropriate national language for the client locale. If the user profile has insufficient authority to call CHGSYSLIBL, an error entry will appear in the job log, and the Toolbox will disregard the error and proceed normally. -

    Note: This property may also be set by specifying 'true' or 'false' in Java system property com.ibm.as400.access.AS400.mustAddLanguageLibrary - @param mustAddLanguageLibrary true to add language library; false otherwise. - **/ - public void setMustAddLanguageLibrary(boolean mustAddLanguageLibrary) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting must add language library:", mustAddLanguageLibrary_); - if (propertiesFrozen_) - { - Trace.log(Trace.ERROR, "Cannot set must add language library after connection has been made."); - throw new ExtendedIllegalStateException("mustAddLanguageLibrary", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - mustAddLanguageLibrary_ = mustAddLanguageLibrary; - } - - /** - Indicates whether this object will attempt to add the appropriate secondary language library to the library list, when running on the system. - @return true if you have indicated that the secondary language library must be added; false otherwise. - **/ - public boolean isMustAddLanguageLibrary() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if must add language library:", mustAddLanguageLibrary_); - return mustAddLanguageLibrary_; - } - - /** - Sets this object to using sockets. When your Java program runs on the system, some Toolbox classes access data via a call to an API instead of making a socket call to the system. There are minor differences in the behavior of the classes when they use API calls instead of socket calls. If your program is affected by these differences you can force the Toolbox classes to use socket calls instead of API calls by using this method. The default is false. The must use sockets property cannot be changed once a connection to the system has been established. -

    Note: This property may also be set by specifying 'true' or 'false' in Java system property com.ibm.as400.access.AS400.mustUseSockets - @param mustUseSockets true to use sockets; false otherwise. - **/ - public void setMustUseSockets(boolean mustUseSockets) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting 'must use sockets':", mustUseSockets); - if (propertiesFrozen_) - { - Trace.log(Trace.ERROR, "Cannot set 'must use sockets' after connection has been made."); - throw new ExtendedIllegalStateException("mustUseSockets", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - mustUseSockets_ = mustUseSockets; - } - - /** - Indicates if Internet domain sockets only will be used. - @return true if must use Internet domain sockets only; false otherwise. - **/ - public boolean isMustUseNetSockets() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if must use net sockets:", mustUseNetSockets_); - return mustUseNetSockets_; - } - - /** - Sets this object to using Internet domain sockets only. When your Java program runs on the system, some Toolbox classes create UNIX domain socket connections. Using this method forces the Toolbox to only use Internet domain sockets. The default is false. The must use net sockets property cannot be changed once a connection to the system has been established. -

    Note: This property may also be set by specifying 'true' or 'false' in Java system property com.ibm.as400.access.AS400.mustUseNetSockets - @param mustUseNetSockets true to use Internet domain sockets only; false otherwise. - **/ - public void setMustUseNetSockets(boolean mustUseNetSockets) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting 'must use net sockets':", mustUseNetSockets); - if (propertiesFrozen_) - { - Trace.log(Trace.ERROR, "Cannot set 'must use net sockets' after connection has been made."); - throw new ExtendedIllegalStateException("mustUseNetSockets", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - mustUseNetSockets_ = mustUseNetSockets; - } - - /** - Indicates if only a supplied profile will be used. - @return true if must use a supplied profile only; false otherwise. - **/ - public boolean isMustUseSuppliedProfile() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if must use supplied profile:", mustUseSuppliedProfile_); - return mustUseSuppliedProfile_; - } - - /** - Sets this object to using a supplied profile only. When your Java program runs on the system, the information from the currently signed-on user profile can be used. Using this method prevents the Toolbox from retrieving the current user profile information. The default is false. The must use supplied profile property cannot be changed once a connection to the system has been established. -

    Note: This property may also be set by specifying 'true' or 'false' in Java system property com.ibm.as400.access.AS400.mustUseSuppliedProfile - @param mustUseSuppliedProfile true to use a supplied profile only; false otherwise. - **/ - public void setMustUseSuppliedProfile(boolean mustUseSuppliedProfile) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting 'must use supplied profile':", mustUseSuppliedProfile); - if (propertiesFrozen_) - { - Trace.log(Trace.ERROR, "Cannot set 'must use supplied profile' after connection has been made."); - throw new ExtendedIllegalStateException("mustUseSuppliedProfile", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - mustUseSuppliedProfile_ = mustUseSuppliedProfile; - } - - /** - Sets the password for this object. Only one authentication means (Kerberos ticket, profile token, identity token, or password) can be used at a single time. Using this method will clear any previously set authentication information. - @param password The user profile password. - **/ - public void setPassword(String password) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting password."); - - if (password == null) - { - throw new NullPointerException("password"); - } - if (password.length() > 128) - { - throw new ExtendedIllegalArgumentException("password.length {" + password.length() + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - synchronized (this) - { - credVault_.empty(); - credVault_ = new PasswordVault(password); - signonInfo_ = null; - } - } - - /** - Sets the number of days before password expiration to warn the user. - @param days The number of days before expiration to start the warning. Set to -1 to turn off warning. - **/ - public static void setPasswordExpirationWarningDays(int days) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting the password expiration warning days:", days); - AS400.expirationWarning = days; - } - - /** - Sets or resets the profile token for this object. Using this method will clear any previously set authentication information. - @param profileToken The profile token. - **/ - public void setProfileToken(ProfileTokenCredential profileToken) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting profile token."); - - if (profileToken == null) - { - throw new NullPointerException("profileToken"); - } - - synchronized (this) - { - credVault_.empty(); - credVault_ = new ProfileTokenVault(profileToken); - signonInfo_ = null; - } - } - - /** - Sets the name and port of the middle-tier machine where the proxy server is running. If this is not set, then the name is retrieved from the com.ibm.as400.access.AS400.proxyServer system property. The ProxyServer must be running on the middle-tier machine. -

    The name of the middle-tier machine is ignored in a two-tier environment. If no middle-tier machine is specified, then it is assumed that no middle-tier will be accessed. The name of the middle-tier machine cannot be changed once a connection to this machine has been established. - @param proxyServer The name and port of the proxy server in the format serverName[:port]. If no port is specified, a default will be used. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setProxyServer(String proxyServer) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting proxy server:", proxyServer); - - if (impl_ != null) - { - Trace.log(Trace.ERROR, "Cannot set proxy server after connection has been made."); - throw new ExtendedIllegalStateException("proxyServer", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - proxyServer_ = resolveProxyServer(proxyServer); - } - else - { - String oldValue = proxyServer_; - String newValue = resolveProxyServer(proxyServer); - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("proxyServer", oldValue, newValue); - } - proxyServer_ = newValue; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("proxyServer", oldValue, newValue); - } - } - } - - /** - Sets the service port in the service port table for the specified service for this system name. - @param service The name of the service. Valid services are: -

      -
    • {@link #FILE FILE} - IFS file classes. -
    • {@link #PRINT PRINT} - print classes. -
    • {@link #COMMAND COMMAND} - command and program call classes. -
    • {@link #DATAQUEUE DATAQUEUE} - data queue classes. -
    • {@link #DATABASE DATABASE} - JDBC classes. -
    • {@link #RECORDACCESS RECORDACCESS} - record level access classes. -
    • {@link #CENTRAL CENTRAL} - license management classes. -
    • {@link #SIGNON SIGNON} - sign-on classes. -
    - @param port The port to use for this service. The value {@link #USE_PORT_MAPPER USE_PORT_MAPPER} can be used to specify that the next connection to this service should ask the port mapper server for the port number. - **/ - public void setServicePort(int service, int port) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting service port, service " + service + ", port " + port); - - // Validate parameters. - if (service < 0 || service > 7) - { - throw new ExtendedIllegalArgumentException("service (" + service + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (port < -1) - { - throw new ExtendedIllegalArgumentException("port (" + port + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Validate state. - if (systemName_.length() == 0 && !systemNameLocal_) - { - Trace.log(Trace.ERROR, "Cannot set service port before system name is set."); - throw new ExtendedIllegalStateException("systemName", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - chooseImpl(); - impl_.setServicePort((systemNameLocal_) ? "localhost" : systemName_, service, port); - } - - /** - Sets the ports in the service port table for all the services for this system name to their default values. This causes the connections to this system name to use the default ports for those services rather than querying the port number through a port mapper connection. The use of this method can reduce the number of connections made to the system. - **/ - public void setServicePortsToDefault() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting service ports to default."); - - // Validate state. - if (systemName_.length() == 0 && !systemNameLocal_) - { - Trace.log(Trace.ERROR, "Cannot set service port to default before system name is set."); - throw new ExtendedIllegalStateException("systemName", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - chooseImpl(); - impl_.setServicePortsToDefault((systemNameLocal_) ? "localhost" : systemName_); - } - - /** - Indicates if checkboxes should be shown on the sign-on dialog. - @param showCheckboxes true to show checkboxes; false otherwise. - **/ - public void setShowCheckboxes(boolean showCheckboxes) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting show checkboxes:", showCheckboxes); - showCheckboxes_ = showCheckboxes; - } - - /** - Sets the sign-on handler for this AS400 object. The specified handler will be called at runtime if the AS400 object needs to obtain additional signon information. -
    By default, an internal AWT-based implementation is used, if no sign-on handler has been statically set via setDefaultSignonHandler(). - @param handler The sign-on handler. Specifying null will reset the default sign-on handler to the internal AWT-based handler. - @see #getSignonHandler - @see #setDefaultSignonHandler - **/ - public void setSignonHandler(SignonHandler handler) - { - if (Trace.traceOn_) - { - if (handler == null) Trace.log(Trace.DIAGNOSTIC, "Setting the sign-on handler to null."); - if (signonHandler_ != null) Trace.log(Trace.DIAGNOSTIC, "Sign-on handler was formerly an instance of " + signonHandler_.getClass().getName()); - } - signonHandler_ = handler; - } - - /** - Sets the socket options the IBM Toolbox for Java will set on its client side sockets. The socket properties cannot be changed once a connection to the system has been established. - @param socketProperties The set of socket options to set. The options are copied from this object, not shared. - **/ - public void setSocketProperties(SocketProperties socketProperties) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting socket properties: " + socketProperties); - if (socketProperties == null) - { - throw new NullPointerException("socketProperties"); - } - if (propertiesFrozen_) - { - Trace.log(Trace.ERROR, "Cannot set socket properties after connection has been made."); - throw new ExtendedIllegalStateException("socketProperties", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - socketProperties_.copyValues(socketProperties); - } - - /** - Sets the system name for this object. The system name cannot be changed once a connection to the system has been established. - @param systemName The name of the IBM i system. Use localhost to access data locally. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setSystemName(String systemName) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system name:", systemName); - if (systemName == null) - { - throw new NullPointerException("systemName"); - } - if (systemName.equals(systemName_)) return; - if (propertiesFrozen_ && (systemNameLocal_ || systemName_.length() != 0)) - { - Trace.log(Trace.ERROR, "Cannot set system name after connection has been made."); - throw new ExtendedIllegalStateException("systemName", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - systemName_ = systemName; - systemNameLocal_ = resolveSystemNameLocal(systemName); - } - else - { - String oldValue = systemName_; - String newValue = systemName; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("systemName", oldValue, newValue); - } - systemName_ = systemName; - systemNameLocal_ = resolveSystemNameLocal(systemName); - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("systemName", oldValue, newValue); - } - } - } - - /** - Sets whether the IBM Toolbox for Java uses threads in communication with the host servers. The default is true. Letting the IBM Toolbox for Java use threads may be beneficial to performance, turning threads off may be necessary if your application needs to be compliant with the Enterprise Java Beans specification. The thread used property cannot be changed once a connection to the system has been established. -

    Note: This property may also be set by specifying 'true' or 'false' in Java system property com.ibm.as400.access.AS400.threadUsed - @param useThreads true to use threads; false otherwise. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setThreadUsed(boolean useThreads) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting thread used:", useThreads); - - if (propertiesFrozen_) - { - Trace.log(Trace.ERROR, "Cannot set thread used after connection has been made."); - throw new ExtendedIllegalStateException("threadUsed", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - threadUsed_ = useThreads; - } - else - { - Boolean oldValue = new Boolean(threadUsed_); - Boolean newValue = new Boolean(useThreads); - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("threadUsed", oldValue, newValue); - } - threadUsed_ = useThreads; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("threadUsed", oldValue, newValue); - } - } - } - - /** - Sets the indicator for whether the default user is used. The default user is used if a system name is provided, but a user ID is not. If a default user is set for that system, then the default user is used. - @param useDefaultUser The value indicating if the default user should be used. Set to true if default user should be used; false otherwise. The default is true, indicating that the default user is used. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setUseDefaultUser(boolean useDefaultUser) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting use default user:", useDefaultUser); - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - useDefaultUser_ = useDefaultUser; - } - else - { - Boolean oldValue = new Boolean(useDefaultUser_); - Boolean newValue = new Boolean(useDefaultUser); - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("useDefaultUser", oldValue, newValue); - } - useDefaultUser_ = useDefaultUser; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("useDefaultUser", oldValue, newValue); - } - } - } - - /** - Sets the indicator for whether the password cache is used. If password cache is used, then the user would only have to enter password once within a Java virtual machine. The default is to use the cache. -
    Unless the application is running in its own private JVM, users are advised to turn off password caching, in order to ensure that another application within the same JVM cannot create a connection using the cached password. - @param usePasswordCache The value indicating whether the password cache should be used. Set to true to use the password cache; false otherwise. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setUsePasswordCache(boolean usePasswordCache) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting use password cache:", usePasswordCache); - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - usePasswordCache_ = usePasswordCache; - } - else - { - Boolean oldValue = new Boolean(usePasswordCache_); - Boolean newValue = new Boolean(usePasswordCache); - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("usePasswordCache", oldValue, newValue); - } - usePasswordCache_ = usePasswordCache; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("usePasswordCache", oldValue, newValue); - } - } - } - - /** - Sets the user ID for this object. The user ID cannot be changed once a connection to the system has been established. If this method is used in conjunction with a Kerberos ticket, profile token, or identity token, the user profile associated with the authentication token must match this user ID. - @param userId The user profile name. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setUserId(String userId) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting user ID: '" + userId + "'"); - if (userId == null) - { - throw new NullPointerException("userId"); - } - if (userId.equals(userId_)) return; - if (userId.length() > 10) - { - throw new ExtendedIllegalArgumentException("userId (" + userId + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - if (signonInfo_ != null) - { - Trace.log(Trace.ERROR, "Cannot set user ID after connection has been made."); - throw new ExtendedIllegalStateException("userId", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - userId_ = userId.toUpperCase(); - } - else - { - String oldValue = userId_; - String newValue = userId.toUpperCase(); - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("userId", oldValue, newValue); - } - userId_ = newValue; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("userId", oldValue, newValue); - } - } - } - - // Initiate sign-on to the system. This method is synchronized to prevent more than one thread from needlessly signing-on. This method can safely be called multiple times because it checks for a previous sign-on before performing the sign-on code. - synchronized void signon(boolean keepConnection) throws AS400SecurityException, IOException - { - // If we haven't already signed on. - if (signonInfo_ == null) - { - chooseImpl(); - userId_ = resolveUserId(userId_, credVault_.getType(), mustUseSuppliedProfile_); - // If system name is set. - if (systemName_.length() != 0) - { - // If user ID is not set and we can use the default user. - if (userId_.length() == 0 && useDefaultUser_) - { - // Get the default user ID. - String defaultUserId = getDefaultUser(systemName_); - // If we have a default user ID for this system, set the user ID to it. - if (defaultUserId != null) userId_ = defaultUserId; - } - // If the user ID is set and the password is not set and we can use the password cache. - if (userId_.length() != 0 && credVault_.isEmpty() && usePasswordCache_) - { - // Get password from password cache. - synchronized (AS400.systemList) - { - for (int i = AS400.systemList.size() - 1; i >= 0; i--) - { - Object[] secobj = (Object[])AS400.systemList.elementAt(i); - if (systemName_.equalsIgnoreCase((String)secobj[0]) && userId_.equals(secobj[1])) - { - // We are taking an entry from the password cache - // and using it for our own AS400 object. - // Thus we must take a copy of it, to maintain - // the protocol of never using a credential vault - // that someone else has a reference to. - // Note that we do not need to bother emptying - // our existing vault; the if-check above has - // assured us that our vault is currently empty. - credVault_ = (CredentialVault)((CredentialVault)secobj[2]).clone(); - } - } - } - } - } - - try - { - // If the system name is set, we're not using proxy, and the password is not set, and the user has not told us not to. - if (systemName_.length() != 0 && proxyServer_.length() == 0 && credVault_.isEmpty() && (credVault_.getType() == AUTHENTICATION_SCHEME_GSS_TOKEN || gssOption_ != AS400.GSS_OPTION_NONE)) - { - // Try for Kerberos. - byte[] newBytes = (gssCredential_ == null) ? TokenManager.getGSSToken(systemName_, gssName_) : - TokenManager2.getGSSToken(systemName_, gssCredential_); - - // We do not have to empty the existing vault because the - // previous if-check assures us it is already empty. - credVault_ = new GSSTokenVault(newBytes); - } - } - catch (Throwable e) - { - if (credVault_.getType() == AUTHENTICATION_SCHEME_GSS_TOKEN || gssOption_ == AS400.GSS_OPTION_MANDATORY) - { - Trace.log(Trace.ERROR, "Error retrieving GSSToken:", e); - throw new AS400SecurityException(AS400SecurityException.KERBEROS_TICKET_NOT_VALID_RETRIEVE); - } - else - { // Tolerate the exception - we don't require GSS. - Trace.log(Trace.DIAGNOSTIC, "GSSToken is not available:", e.getMessage()); - } - } - - // Note: A user-supplied sign-on handler isn't necessarily GUI-based. - promptSignon(); - if (!keepConnection) { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Disconnecting temporary connection for validating signon info."); - impl_.disconnect(AS400.SIGNON); - } - } - } - - /** - Returns the text representation of this AS400 object. - @return The string representing this AS400 object. - **/ - public String toString() - { - return "AS400 (system name: '" + systemName_ + "' user ID: '" + userId_ + "'):" + super.toString(); - } - - // Determine if user ID matches current user ID. - private static boolean userIdMatchesLocal(String userId, boolean mustUseSuppliedProfile) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Determining if specified userID ("+userId+") matches current userID."); - - boolean result; - - // First, see if we are running on IBM i. - if (AS400.onAS400 && !mustUseSuppliedProfile && currentUserAvailable()) - { - String currentUserID = CurrentUser.getUserID(AS400.nativeVRM.getVersionReleaseModification()); - if (currentUserID == null) { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Current userID information not available."); - result = false; - } - - else { - result = userId.equals(currentUserID); - if (Trace.traceOn_ && !result) { - Trace.log(Trace.DIAGNOSTIC, "Specified userID ("+userId+") does not match current userID ("+currentUserID+")."); - } - } - } - else - { - result = false; - if (Trace.traceOn_) - { - if (!AS400.onAS400) Trace.log(Trace.DIAGNOSTIC, "Not running on IBM i."); - if (mustUseSuppliedProfile) Trace.log(Trace.DIAGNOSTIC, "Caller specified must use supplied profile."); - if (!currentUserAvailable()) Trace.log(Trace.DIAGNOSTIC, "Class CurrentUser is not available."); - } - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Determined that specified userID ("+userId+") " + (result ? "matches" : "does not match") + " current userID."); - - return result; - } - - /** - Validates the user ID and password on the system but does not add to the signed-on list. The system name, user ID, and password need to be set prior to calling this method. -

    Note: This will return true if the information is successfully validated. An unsuccessful validation will cause an exception to be thrown, false is never returned. - @return true if successful. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public boolean validateSignon() throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Validating Signon."); - - if (systemName_.length() == 0 && !systemNameLocal_) - { - Trace.log(Trace.ERROR, "Cannot validate signon before system name is set."); - throw new ExtendedIllegalStateException("systemName", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - userId_ = resolveUserId(userId_); - if (userId_.length() == 0) - { - Trace.log(Trace.ERROR, "Cannot validate signon before user ID is set."); - throw new ExtendedIllegalStateException("userId", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - return validateSignon(userId_, credVault_); - } - - /** - Validates the user ID and password on the system but does not add to the signed-on list. The user ID and system name need to be set before calling this method. -

    Note: This will return true if the information is successfully validated. An unsuccessful validation will cause an exception to be thrown, false is never returned. - @param password The user profile password to validate. - @return true if successful. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public boolean validateSignon(String password) throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Validating Signon, with password."); - - if (password == null) - { - throw new NullPointerException("password"); - } - if (password.length() > 128) - { - throw new ExtendedIllegalArgumentException("password.length {" + password.length() + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - if (systemName_.length() == 0 && !systemNameLocal_) - { - Trace.log(Trace.ERROR, "Cannot validate signon before system name is set."); - throw new ExtendedIllegalStateException("systemName", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - userId_ = resolveUserId(userId_); - if (userId_.length() == 0) - { - Trace.log(Trace.ERROR, "Cannot validate signon before user ID is set."); - throw new ExtendedIllegalStateException("userId", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - PasswordVault tempVault = new PasswordVault(password); - return validateSignon(userId_, tempVault); - } - - /** - Validates the user ID and password on the system but does not add to the signed-on list. The system name needs to be set prior to calling this method. -

    Note: This will return true if the information is successfully validated. An unsuccessful validation will cause an exception to be thrown, false is never returned. - @param userId The user profile name to validate. - @param password The user profile password to validate. - @return true if successful. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public boolean validateSignon(String userId, String password) throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Validating signon, user ID: '" + userId + "'"); - - if (userId == null) - { - throw new NullPointerException("userId"); - } - if (userId.length() > 10) - { - throw new ExtendedIllegalArgumentException("userId (" + userId + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (password == null) - { - throw new NullPointerException("password"); - } - if (password.length() > 128) - { - throw new ExtendedIllegalArgumentException("password.length {" + password.length() + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - if (systemName_.length() == 0 && !systemNameLocal_) - { - Trace.log(Trace.ERROR, "Cannot validate signon before system name is set."); - throw new ExtendedIllegalStateException("systemName", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - PasswordVault tempVault = new PasswordVault(password); - return validateSignon(userId.toUpperCase(), tempVault); - } - - // Internal version of validate sign-on; takes checked user ID and twiddled password bytes. - // If the signon info is not valid, an exception is thrown. - private boolean validateSignon(String userId, CredentialVault pwVault) throws AS400SecurityException, IOException - { - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, "Creating temporary connection for validating signon info."); - } - AS400 validationSystem = new AS400(systemName_, userId, pwVault); - validationSystem.proxyServer_ = proxyServer_; - // proxyClientConnection_ is not needed. - validationSystem.guiAvailable_ = false; - validationSystem.usePasswordCache_ = false; - validationSystem.useDefaultUser_ = false; - // showCheckboxes_ is not needed. - validationSystem.useSSLConnection_ = useSSLConnection_; - validationSystem.mustUseSockets_ = true; // force the use of the Signon Server - validationSystem.mustUseNetSockets_ = mustUseNetSockets_; - validationSystem.mustUseSuppliedProfile_ = mustUseSuppliedProfile_; - // threadUsed_ is not needed. - // locale_ in not needed. - // nlv_ in not needed. - validationSystem.socketProperties_ = socketProperties_; - // ccsid_ is not needed. - // connectionListeners_ is not needed. - // dispatcher_ is not needed. - // propertyChangeListeners_ is not needed. - // vetoableChangeListeners_ is not needed. - // propertiesFrozen_ is not needed. - // impl_ is not copied. - // signonInfo_ is not copied. - - validationSystem.signon(false); // signon(false) calls disconnect() when done - return true; - } - - //@prompt new method - /** - This tells AS400 to force prompt by displaying login dialog (actually the sign-on handler) prior to even trying to authenticate. - This is useful in cases where an application sends in incorrect dummy id/password and expects Toolbox to display the logon dialog. - In JDBC, we do some pre-validation of id/password. So JDBC may flag the id/password as invalid and then need - to let AS400 know that it just needs to display the logon dialog. - **/ - void forcePrompt() - { - forcePrompt_ = true; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS40016.gif b/cvsroot/src/com/ibm/as400/access/AS40016.gif deleted file mode 100644 index 50783da92..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS40016.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS40032.gif b/cvsroot/src/com/ibm/as400/access/AS40032.gif deleted file mode 100644 index b781923d5..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS40032.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400AbstractTime.java b/cvsroot/src/com/ibm/as400/access/AS400AbstractTime.java deleted file mode 100644 index ed59bdc5a..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400AbstractTime.java +++ /dev/null @@ -1,441 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400AbstractTime.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2010-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; -import java.io.UnsupportedEncodingException; -import java.text.SimpleDateFormat; -import java.util.GregorianCalendar; -import java.util.Locale; -import java.util.TimeZone; - -/** - An abstract base class for converters between IBM i date/time values and corresponding Java objects. - **/ -public abstract class AS400AbstractTime implements AS400DataType -{ - static final long serialVersionUID = 4L; - static final boolean DEBUG = false; - - static final Locale LOCALE_DEFAULT = Locale.US; // keep things simple - static final TimeZone TIMEZONE_GMT = TimeZone.getTimeZone("GMT-0"); - - // Separator characters. Used by AS400Date and AS400Time. - static final Character AMPERSAND = new Character('&'); - static final Character BLANK = new Character(' '); - static final Character COLON = new Character(':'); - static final Character COMMA = new Character(','); - static final Character HYPHEN = new Character('-'); - static final Character PERIOD = new Character('.'); - static final Character SLASH = new Character('/'); - - // Standard XML-Schema format patterns for parsing dates and times. - // For specifications, see http://www.w3.org/TR/xmlschema-2/ - static final String DATE_PATTERN_XSD = "yyyy-MM-dd"; - static final String TIME_PATTERN_XSD = "HH:mm:ss"; - static final String TIMESTAMP_PATTERN_XSD = "yyyy-MM-dd'T'HH:mm:ss"; - - private int length_; // number of bytes occupied by the IBM i value - private transient GregorianCalendar calendar_; - private transient SimpleDateFormat dateFormatter_; - private transient CharConverter charConverter_; - - private static SimpleDateFormat dateFormatterXSD_; // used by AS400Date - private static SimpleDateFormat timeFormatterXSD_; // used by AS400Time - private static SimpleDateFormat timestampFormatterXSD_; // used by AS400Timestamp - - // Map of 'century' digit values to Date objects that specify that start of each century. - private transient java.util.Date[] centuryMap_; - // Note: In our code for this class and its subclasses, we will fully qualify references to class java.util.Date and java.sql.Date, in order to eliminate any possible confusion between the two classes. - - private int format_; - private Character separator_; - private boolean separatorHasBeenSet_ = false; // indicates whether separator was explicitly set by the application - - /** - Constructs an AS400AbstractTime object. Hide this constructor from applications. - **/ - AS400AbstractTime() - { - } - - - // Implements method of interface AS400DataType. - /** - Creates a new AS400AbstractTime object that is identical to the current instance. - @return The new object. - **/ - public Object clone() - { - try - { - return super.clone(); // Object.clone does not throw exception - } - catch (CloneNotSupportedException e) - { - Trace.log(Trace.ERROR, "Unexpected cloning error", e); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - // Implements method of interface AS400DataType. - /** - Returns the byte length of the data type. - @return The number of bytes in the IBM i representation of the data type. - **/ - public int getByteLength() - { - return length_; - } - - // Implements method of interface AS400DataType. - /** - Returns a Java object representing the default value of the data type. - @return The default value of the data type. - **/ - public abstract Object getDefaultValue(); - - // Implements method of interface AS400DataType. - /** - Returns an integer constant representing the type of class that implements - this interface. This is typically faster than using the instanceof operator, and may prove useful - where code needs a primitive type for ease of calculation. - Possible values for standard com.ibm.as400.access classes that implement this - interface are provided as constants in this class. Note that any implementing class provided - by a third party is not guaranteed to correctly return one of the pre-defined constants. - @return The type of object implementing this interface. - **/ - public abstract int getInstanceType(); - - - // Implements method of interface AS400DataType. - /** - Returns the Java class that corresponds with this data type. - @return The Java class that corresponds with this data type. - **/ - public abstract Class getJavaType(); - - - // Utility method used by AS400Timestamp. - synchronized GregorianCalendar getCalendar() - { - if (calendar_ == null) - { - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, "AS400AbstractTime.getCalendar(): Setting internal timezone to " + TIMEZONE_GMT); - } - - calendar_ = new GregorianCalendar(TIMEZONE_GMT, LOCALE_DEFAULT); - } - return calendar_; - } - - - // Utility method used by AS400Date and AS400Timestamp. - synchronized GregorianCalendar getCalendar(java.util.Date date) - { - getCalendar().setTime(date); // set the specified date into the Calendar object - return calendar_; - } - - // Utility method. - private synchronized GregorianCalendar getCalendar( - int year, - int month, // 0-based - int dayOfMonth, // 1-based - int hoursIntoDay, // 0-based - int minutesIntoHour, // 0-based - int secondsIntoMinute) // 0-based - { - getCalendar().set(year, // year - month, // month (0-based) - dayOfMonth, // day of month (1-based) - hoursIntoDay, // hour of day (0-based) - minutesIntoHour, // minute (0-based) - secondsIntoMinute); // second (0-based) - return calendar_; - } - - // Utility method used by subclasses. - int getLength() - { - return length_; - } - - /** - Returns the format of this AS400AbstractTime object. - Note: We don't make this method public here, since not all subclasses surface it to - @return The format for this object. - **/ - int getFormat() - { - return format_; - } - - - // Utility method used by subclasses. - Character getSeparator() - { - return separator_; - } - - - // Method needed by DateFieldDescription and TimeFieldDescription. - synchronized void setSeparator(Character separator) - { - separator_ = separator; - separatorHasBeenSet_ = true; - } - - - // Method needed by DateFieldDescription and TimeFieldDescription. - /** - Sets the format of this AS400AbstractTime object. - Note: We don't make this method public here, since not all subclasses surface it to the user. - - @param format The format for this object. - **/ - synchronized void setFormat(int format) - { - Character sep = ( separatorHasBeenSet_ ? separator_ : defaultSeparatorFor(format) ); - setFormat(format, sep); - } - - - /** - Sets the format of this AS400AbstractTime object. - Note: We don't make this method public here, since not all subclasses surface it to the user. - - @param format The format for this object. - @param separator The separator. - Refer to the IBM i programming reference to determine which separators are valid with each format. - **/ - synchronized void setFormat(int format, Character separator) - { - if (!isValidFormat(format)) { - throw new ExtendedIllegalArgumentException("format (" + format + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - format_ = format; - separator_ = separator; - length_ = lengthFor(format_); - - // Discard any previously specified formatter. - dateFormatter_ = null; - // Don't create formatter until we actually need it. - } - - - // Implements method of interface AS400DataType. - /** - Converts the specified Java object to IBM i format. - This method performs the same conversion as {@link #toBytes(Object,byte[],int) tobytes(javaValue,as400Value,0)}, except that as400Value is created dynamically and returned by this method. - @param javaValue The object corresponding to the data type. - @return The IBM i representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - byte[] byteVal = new byte[length_]; - toBytes(javaValue, byteVal, 0); - return byteVal; - } - - - // Implements method of interface AS400DataType. - /** - Converts the specified Java object into IBM i format in the specified byte array. - This method performs the same conversion as {@link #toBytes(Object,byte[],int) tobytes(javaValue,as400Value,0)}. - - @param javaValue The object corresponding to the data type. - @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - @return Eight (8), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value) - { - return toBytes(javaValue, as400Value, 0); - } - - /** - Converts the specified Java object into IBM i format in the specified byte array. - @param javaValue The object corresponding to the data type. - @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @return Eight (8), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - String dateString = toString(javaValue); // call the subclass-specific formatter - - try { - getCharConverter().stringToByteArray(dateString, as400Value, offset); - } - catch (CharConversionException e) { // should never happen - Trace.log(Trace.ERROR, e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - return length_; - } - - - // Implements method of interface AS400DataType. - /** - Converts the specified IBM i data type to a Java object. - This method performs the same conversion as {@link #toObject(byte[],int) toObject(as400Value,0)}. - @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - @return A Java object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value) - { - return toObject(as400Value, 0); - } - - // Implements method of interface AS400DataType. - /** - Converts the specified IBM i data type to a Java object. - @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @return A Java object corresponding to the data type. - **/ - public abstract Object toObject(byte[] as400Value, int offset); - - - /** - Converts the specified Java object into a String representation that is consistent with the format of this data type. - @param javaValue The object corresponding to the data type. - @return A String representation of the specified value, formatted appropriately for this data type. - **/ - public abstract String toString(Object javaValue); - - - // Utility method used by subclasses. - CharConverter getCharConverter() - { - try - { - if (charConverter_ == null) { - charConverter_ = new CharConverter(37); // Standard IBM i EBCDIC. - // Design note: Technically, IBM i date/time fields are, by default, in the job CCSID; but since their characters are invariant, 37 should work. So we'll keep it simple. - } - return charConverter_; - } - catch (UnsupportedEncodingException e) { // should never happen - Trace.log(Trace.ERROR, e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - } - - - // Utility method used by subclasses. - synchronized SimpleDateFormat getDateFormatter() - { - if (dateFormatter_ == null) { - dateFormatter_ = new SimpleDateFormat(patternFor(format_, separator_)); - dateFormatter_.setTimeZone(TIMEZONE_GMT); - } - return dateFormatter_; - } - - - // Utility method used by AS400Date. - synchronized SimpleDateFormat getDateFormatter(Integer centuryDigit) - { - if (centuryDigit == null) return getDateFormatter(); - else - { - getDateFormatter().set2DigitYearStart(getStartDateForCentury(centuryDigit.intValue())); - return dateFormatter_; - } - - } - - - // Utility method used by AS400Date. - static SimpleDateFormat getDateFormatterXSD() - { - if (dateFormatterXSD_ == null) { - synchronized (AS400Date.class) - { - if (dateFormatterXSD_ == null) { - dateFormatterXSD_ = new SimpleDateFormat(DATE_PATTERN_XSD); - dateFormatterXSD_.setTimeZone(TIMEZONE_GMT); - } - } - } - return dateFormatterXSD_; - } - - - // Utility method used by AS400Time. - static SimpleDateFormat getTimeFormatterXSD() - { - if (timeFormatterXSD_ == null) { - synchronized (AS400Time.class) - { - if (timeFormatterXSD_ == null) { - timeFormatterXSD_ = new SimpleDateFormat(TIME_PATTERN_XSD); - timeFormatterXSD_.setTimeZone(TIMEZONE_GMT); - } - } - } - return timeFormatterXSD_; - } - - - // Utility method used by AS400Timestamp. - static SimpleDateFormat getTimestampFormatterXSD() - { - if (timestampFormatterXSD_ == null) { - synchronized (AS400Timestamp.class) - { - if (timestampFormatterXSD_ == null) { - timestampFormatterXSD_ = new SimpleDateFormat(TIMESTAMP_PATTERN_XSD); - // Note: We deal with "nanoseconds" elsewhere, in the AS400Timestamp class. - timestampFormatterXSD_.setTimeZone(TIMEZONE_GMT); - } - } - } - return timestampFormatterXSD_; - } - - - // Returns a Date object representing, in the contextual time zone, 00:00:00 on January 1 of the first year in the specified century. - // Note: The century-numbering convention of IBM i "date" formats is as follows: - // Century '0' indicates years 1900-1999. - // Century '1' indicates years 2000-2099. - // ... and so on. - private synchronized java.util.Date getStartDateForCentury(int century) - { - if (centuryMap_ == null) { - centuryMap_ = new java.util.Date[10]; - } - - if (centuryMap_[century] == null) - { - centuryMap_[century] = getCalendar(100*(19+century), // year (e.g. 1900) - 0, // month == January (0-based) - 1, // day of month (1-based) - 0, // hour of day (0-based) - 0, // minute (0-based) - 0 // second (0-based) - - ).getTime(); - } - return centuryMap_[century]; - } - - abstract String patternFor(int format, Character separator); - abstract Character defaultSeparatorFor(int format); - abstract boolean isValidFormat(int format); - abstract int lengthFor(int format); - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Array.java b/cvsroot/src/com/ibm/as400/access/AS400Array.java deleted file mode 100644 index ebb98b670..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400Array.java +++ /dev/null @@ -1,283 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Array.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The AS400Array class provides a composite data type representing an array of AS400DataType objects. - **/ -public class AS400Array implements AS400DataType -{ - static final long serialVersionUID = 4L; - - private AS400DataType arrayType = null; - private int arraySize = -1; - private boolean allowChanges = true; // For beans: allow changes after null constructor until conversion method called - - /** - * Constructs an AS400Array object. The setNumberOfElements() and setType() methods must be called before a call to any conversion methods or the getByteLength() on this object. - **/ - public AS400Array() - { - } - - /** - * Constructs an AS400Array object. - * @param type The type of the array. - * @param size The number of elements in the array. It must be greater than or equal to zero. - **/ - public AS400Array(AS400DataType type, int size) - { - if (size < 0) - { - throw new ExtendedIllegalArgumentException("size (" + String.valueOf(size) + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - this.allowChanges = false; - // only store clones - this.arrayType = (AS400DataType)type.clone(); // let this line throw NullPointerException - this.arraySize = size; - } - - /** - * Creates a new AS400Array object that is identical to the current instance. - * @return The new object. - **/ - public Object clone() - { - try - { - AS400Array nObj = (AS400Array)super.clone(); // Object.clone does not throw exception - nObj.arrayType = (this.arrayType == null) ? - null : - (AS400DataType)this.arrayType.clone(); // Data Types do not throw exception - return nObj; - } - catch (CloneNotSupportedException e) - { - Trace.log(Trace.ERROR, "Unexpected cloning error", e); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - /** - * Returns the byte length of the data type. The type and number of elements in this array must be set before calling this method. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int getByteLength() - { - AS400DataType element = this.arrayType; - int size = this.arraySize; - - // Check for valid state - if (element == null) - { - throw new ExtendedIllegalStateException("Type", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (size == -1) - { - throw new ExtendedIllegalStateException("NumberOfElements", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - this.allowChanges = false; // Check before setting so don't have unfixable object - - // Length is number of elements * size of the element - return this.arraySize*this.arrayType.getByteLength(); - } - - /** - * Returns a Java object that represents the default value of the data type. - * @return The zero-length Object array. - **/ - public Object getDefaultValue() - { - int size = ( this.arraySize == -1 ? 0 : this.arraySize ); - Object[] returnArray = new Object[size]; - Object elementDefaultValue = ( this.arrayType == null ? null : this.arrayType.getDefaultValue() ); - - for (int i = 0; i < size; ++i) - { - returnArray[i] = elementDefaultValue; - } - return returnArray; - } - - /** - * Returns {@link com.ibm.as400.access.AS400DataType#TYPE_ARRAY TYPE_ARRAY}. - * @return AS400DataType.TYPE_ARRAY. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_ARRAY; - } - - /** - * Returns the Java class that corresponds with this data type. - * @return Object[].class. - **/ - public Class getJavaType() - { - return Object[].class; - } - - /** - * Returns the number of elements in the data type. - * @return The number of elements in the array data type. If the number of elements has not been set, negative one (-1) is returned. - **/ - public int getNumberOfElements() - { - return this.arraySize; - } - - /** - * Returns the type of the array. - * @return The type of this array data type. If the array type has not been set, null is returned. - **/ - public AS400DataType getType() - { - return (this.arrayType == null) ? - null : - (AS400DataType)this.arrayType.clone(); // only give out clones - } - - /** - * Sets the number of elements in the data type. This method must be called after a call to the null constructor and before a call to any of the conversion methods or getByteLength(). - * @param size The number of elements in the array. It must be greater than or equal to zero. - **/ - public void setNumberOfElements(int size) - { - if (!this.allowChanges) - { - throw new ExtendedIllegalStateException("NumberOfElements", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - if (size < 0) - { - throw new ExtendedIllegalArgumentException("size (" + String.valueOf(size) + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - this.arraySize = size; - } - - /** - * Sets the type of the array. This method must be called after a call to the null constructor and before a call to any of the conversion methods or getByteLength(). - * @param type The type of the array. - **/ - public void setType(AS400DataType type) - { - if (!this.allowChanges) - { - throw new ExtendedIllegalStateException("Type", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - // only store clones - this.arrayType = (AS400DataType)type.clone(); // Let this line throw NullPointerException - } - - /** - * Converts the specified Java object to IBM i format. The type and number of elements in this array must be set before calling this method. - * @param javaValue The object corresponding to the data type. It must be an Object array; the array must contain the correct number of elements, and each element must be of the correct type. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - byte[] as400Value = new byte[this.getByteLength()]; // let getByteLength check state - this.toBytes(javaValue, as400Value, 0); - return as400Value; - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. The type and number of elements in this array must be set before calling this method. - * @param javaValue The object corresponding to the data type. It must be an Object array; the array must contain the correct number of elements, and each element must be of the correct type. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the value. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value) - { - return this.toBytes(javaValue, as400Value, 0); - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. The type and number of elements in this array must be set before calling this method. - * @param javaValue The object corresponding to the data type. It must be an Object array; the array must contain the correct number of elements, and each element must be of the correct type. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - AS400DataType element = this.arrayType; - int size = this.arraySize; - - // Check for valid state - if (element == null) - { - throw new ExtendedIllegalStateException("Type", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (size == -1) - { - throw new ExtendedIllegalStateException("NumberOfElements", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - this.allowChanges = false; // Check before setting so don't have unfixable object - - Object[] javaArray = (Object[])javaValue; // let this line to throw ClassCastException - if (javaArray.length != size) // Check for correct number of elements - { - throw new ExtendedIllegalArgumentException("javaValue (" + javaValue.toString() + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - // Convert array by iterating over elements, allow elements to do own validity checking - for (int i = 0; i < size; ++i) - { - offset += element.toBytes(javaArray[i], as400Value, offset); - } - return element.getByteLength()*size; - } - - /** - * Converts the specified IBM i data type to a Java object. The type and number of elements in this array must be set before calling this method. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The array of Object. Each element of this array is an Object corresponding to the type of this AS400Array object. - **/ - public Object toObject(byte[] as400Value) - { - return this.toObject(as400Value, 0); - } - - /** - * Converts the specified IBM i data type to a Java object. The type and number of elements in this array must be set before calling this method. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The array of Object. Each element of this array is an Object corresponding to the type of this AS400Array object. - **/ - public Object toObject(byte[] as400Value, int offset) - { - AS400DataType element = this.arrayType; - int size = this.arraySize; - - // Check for valid state - if (element == null) - { - throw new ExtendedIllegalStateException("Type", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (size == -1) - { - throw new ExtendedIllegalStateException("NumberOfElements", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - this.allowChanges = false; // Check before setting so don't have unfixable object - - int elementSize = element.getByteLength(); - Object[] returnArray = new Object[size]; - // Convert array by iterating over elements, allow elements to do own validity checking - for (int i = 0; i < size; ++i) - { - returnArray[i] = element.toObject(as400Value, offset); - offset += elementSize; - } - return returnArray; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Array16.gif b/cvsroot/src/com/ibm/as400/access/AS400Array16.gif deleted file mode 100644 index dd0c502b1..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400Array16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400Array32.gif b/cvsroot/src/com/ibm/as400/access/AS400Array32.gif deleted file mode 100644 index 0efc889a2..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400Array32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400ArrayBeanInfo.java b/cvsroot/src/com/ibm/as400/access/AS400ArrayBeanInfo.java deleted file mode 100644 index e506c8cb7..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400ArrayBeanInfo.java +++ /dev/null @@ -1,100 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400ArrayBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.BeanInfo; -import java.awt.Image; - -/** - * The AS400ArrayBeanInfo class provides bean information for the AS400Array class. - **/ -public class AS400ArrayBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class beanClass = AS400Array.class; - - private static PropertyDescriptor[] properties_; - - static - { - try - { - PropertyDescriptor numberOfElements = new PropertyDescriptor("numberOfElements", beanClass); - numberOfElements.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_AS400ARRAY_SIZE")); - numberOfElements.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_AS400ARRAY_SIZE")); - - PropertyDescriptor type = new PropertyDescriptor("type", beanClass); - type.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_AS400ARRAY_TYPE")); - type.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_AS400ARRAY_TYPE")); - - PropertyDescriptor properties[] = {numberOfElements, type}; - - properties_ = properties; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the bean descriptor. - * @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("AS400Array16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("AS400Array32.gif"); - break; - } - - return image; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/AS400BeanInfo.java b/cvsroot/src/com/ibm/as400/access/AS400BeanInfo.java deleted file mode 100644 index f5d4a5e30..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400BeanInfo.java +++ /dev/null @@ -1,199 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400BeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - The AS400BeanInfo class provides bean information for the AS400 class. - **/ -public class AS400BeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Class this bean info represents. - private static final Class BEAN_CLASS = AS400.class; - - private static EventSetDescriptor[] eventSetDescriptors; - static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - EventSetDescriptor connection = new EventSetDescriptor(BEAN_CLASS, "connection", ConnectionListener.class, new String[] { "connected", "disconnected" }, "addConnectionListener", "removeConnectionListener"); - connection.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_CONNECTION_EVENT")); - connection.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_CONNECTION_EVENT")); - - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - - eventSetDescriptors = new EventSetDescriptor[] { connection, propertyChange, vetoableChange }; - - PropertyDescriptor systemName = new PropertyDescriptor("systemName", BEAN_CLASS); - systemName.setBound(true); - systemName.setConstrained(true); - systemName.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_AS400_SYSTEM")); - systemName.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_AS400_SYSTEM")); - - PropertyDescriptor userId = new PropertyDescriptor("userId", BEAN_CLASS); - userId.setBound(true); - userId.setConstrained(true); - userId.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_AS400_USERID")); - userId.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_AS400_USERID")); - - PropertyDescriptor password = new PropertyDescriptor("password", BEAN_CLASS, null, "setPassword"); - password.setBound(false); - password.setConstrained(false); - password.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_AS400_PASSWORD")); - password.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_AS400_PASSWORD")); - - PropertyDescriptor profileToken = new PropertyDescriptor("profileToken", BEAN_CLASS, null, "setProfileToken"); - profileToken.setBound(false); - profileToken.setConstrained(false); - profileToken.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_AS400_PROFILETOKEN")); - profileToken.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_AS400_PROFILETOKEN")); - - PropertyDescriptor proxyServer = new PropertyDescriptor("proxyServer", BEAN_CLASS); - proxyServer.setBound(true); - proxyServer.setConstrained(true); - proxyServer.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_AS400_PROXYSERVER")); - proxyServer.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_AS400_PROXYSERVER")); - - PropertyDescriptor guiAvailable = new PropertyDescriptor("guiAvailable", BEAN_CLASS); - guiAvailable.setBound(true); - guiAvailable.setConstrained(true); - guiAvailable.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_AS400_GUI")); - guiAvailable.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_AS400_GUI")); - - PropertyDescriptor mustUseSockets = new PropertyDescriptor("mustUseSockets", BEAN_CLASS); - mustUseSockets.setBound(false); - mustUseSockets.setConstrained(false); - mustUseSockets.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_AS400_MUSTUSESOCKETS")); - mustUseSockets.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_AS400_MUSTUSESOCKETS")); - - PropertyDescriptor showCheckboxes = new PropertyDescriptor("showCheckboxes", BEAN_CLASS); - showCheckboxes.setBound(false); - showCheckboxes.setConstrained(false); - showCheckboxes.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_AS400_SHOWCHECKBOXES")); - showCheckboxes.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_AS400_SHOWCHECKBOXES")); - - PropertyDescriptor threadUsed = new PropertyDescriptor("threadUsed", BEAN_CLASS); - threadUsed.setBound(true); - threadUsed.setConstrained(true); - threadUsed.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_AS400_THREADUSED")); - threadUsed.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_AS400_THREADUSED")); - - PropertyDescriptor useDefaultUser = new PropertyDescriptor("useDefaultUser", BEAN_CLASS); - useDefaultUser.setBound(true); - useDefaultUser.setConstrained(true); - useDefaultUser.setExpert(true); - useDefaultUser.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_AS400_DEFUSER")); - useDefaultUser.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_AS400_DEFUSER")); - - PropertyDescriptor usePasswordCache = new PropertyDescriptor("usePasswordCache", BEAN_CLASS); - usePasswordCache.setBound(true); - usePasswordCache.setConstrained(true); - usePasswordCache.setExpert(true); - usePasswordCache.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_AS400_PWCACHE")); - usePasswordCache.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_AS400_PWCACHE")); - - propertyDescriptors = new PropertyDescriptor[] { systemName, userId, password, profileToken, proxyServer, guiAvailable, mustUseSockets, showCheckboxes, threadUsed, useDefaultUser, usePasswordCache }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return Zero (0), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "connection" event. - return 0; - } - - /** - Returns the index of the default property. - @return Zero (0), the index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // The index for the "systemName" property. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("AS40016.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("AS40032.gif"); - } - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400BidiTransform.java b/cvsroot/src/com/ibm/as400/access/AS400BidiTransform.java deleted file mode 100644 index ae0c68373..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400BidiTransform.java +++ /dev/null @@ -1,706 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400BidiTransform.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - -/** - Provides layout transformations that allow the conversion of Bidi text in IBM i format (after its conversion to Unicode), to Bidi text in Java format; or vice-versa. -

    Bidi text is a combination of a sequence of characters and a set of Bidi flags. That text (Arabic or Hebrew) has characters which are read from right to left. That text might also be mixed with numbers which are read from left to right, and possibly also mixed with Latin characters. Conversion support is needed to display text properly with the correct order and shape. -

    Bidi text from an IBM i system may be represented by a combination of a String (the characters) and a CCSID (which implies a set of Bidi flags specific to that CCSID). -

    Multi-threading considerations: Different threads may use the same AS400BidiTransform object if they have the same transformation needs, as follows: -

      -
    • Same CCSID for the IBM i data. -
    • Same string type for the IBM i data (if the default string type of the CCSID is used, this will result from using the same CCSID). -
    • Same orientation for Java data (if the Java data orientation is derived from the IBM i string type, this will result from using the same string type for IBM i data). -
    -

    Otherwise, each thread must use its own instances of this class. -

    The following examples illustrate how to transform bidi text: -

    - * // Java data to IBM i layout:
    - * AS400BidiTransform abt;
    - * abt = new AS400BidiTransform(424);
    - * String dst = abt.toAS400Layout("some bidi string");
    - *
    - * // Specifying a new CCSID for an existing AS400BidiTransform object:
    - * abt.setAS400Ccsid(62234);                    // 420 RTL //
    - * String dst = abt.toAS400Layout("some bidi string");
    - *
    - * // Specifying a non-default string type for a given CCSID:
    - * abt.setAS400StringType(BidiStringType.ST4);  // Vis LTR //
    - * String dst = abt.toAS400Layout("some bidi string");
    - *
    - * // Specifying a non-default string type for Java data:
    - * abt.setJavaStringType(BidiStringType.ST11);  // Imp Context LTR //
    - * String dst = abt.toAS400Layout("some bidi string");
    - *
    - * // How to transform IBM i data to Java layout:
    - * abt.setJavaStringType(BidiStringType.ST6);   // Imp RTL //
    - * String dst = abt.toJavaLayout("some bidi string");
    - 
    - A more simplified method is to use {@link #bidiTransform(String,int,int) bidiTransform()}. The following example illustrates how to use it: -
    - String src = "some bidi string";
    - String result = AS400BidiTransform.bidiTransform(src, BidiStringType.ST4,  BidiStringType.ST6); // from visual LTR to Implicit RTL //
    - 
    - **/ -public class AS400BidiTransform -{ - private static final int ST1 = 1; - private static final int ST2 = 2; - private static final int ST3 = 3; - private static final int ST4 = 4; - private static final int ST5 = 5; - private static final int ST6 = 6; - private static final int ST7 = 7; - private static final int ST8 = 8; - private static final int ST9 = 9; - private static final int ST10 = 10; - private static final int ST11 = 11; - private static final int ST12 = 12; - private static final int ST13 = 13; - private static final int ST14 = 14; - - private static final int[][] CCSID_TABLE = - { - // CCSID, String-Type - { 420, ST4 }, // Arabic.420 - { 424, ST4 }, // Hebrew.424 - { 425, ST5 }, // Arabic/Latin EBCDIC defined for OS/390 open edition. - { 856, ST5 }, // Hebrew.856 - { 862, ST4 }, // Hebrew.862 - { 864, ST5 }, // Arabic.864 - { 867, ST4 }, // Hebrew.867 - { 916, ST5 }, // Hebrew.916 - { 1046, ST5 }, // Arabic.1046 - { 1089, ST5 }, // Arabic.1089 - { 1255, ST5 }, // Hebrew.1255 - { 1256, ST5 }, // Arabic.1256 - { 5012, ST5 }, // Hebrew.916 - { 5351, ST5 }, // Hebrew.1255 - { 5352, ST5 }, // Arabic.1256 - { 8612, ST5 }, // Arabic.420 - { 8616, ST10 }, // Hebrew.424 - { 9238, ST5 }, // Arabic.1046 - { 12708, ST7 }, // Arabic.420 - { 12712, ST10 }, // Hebrew.424 - { 13488, ST10 }, // Unicode.10646 - { 16804, ST4 }, // Arabic.420 - { 17248, ST5 }, // Arabic.864 - { 61952, ST10 }, // Unicode.10646 - { 62208, ST4 }, // Hebrew.856 - { 62209, ST10 }, // Hebrew.862 - { 62210, ST4 }, // Hebrew.916 - { 62211, ST5 }, // Hebrew.424 - { 62212, ST10 }, // Hebrew.867 - { 62213, ST5 }, // Hebrew.862 - { 62214, ST5 }, // Hebrew.867 - { 62215, ST4 }, // Hebrew.1255 - { 62216, ST6 }, // Hebrew.867 - { 62217, ST8 }, // Hebrew.867 - { 62218, ST4 }, // Arabic.864 - { 62219, ST11 }, // Hebrew.867 - { 62220, ST6 }, // Hebrew.856 - { 62221, ST6 }, // Hebrew.862 - { 62222, ST6 }, // Hebrew.916 - { 62223, ST6 }, // Hebrew.1255 - { 62224, ST6 }, // Arabic.420 - { 62225, ST6 }, // Arabic.864 - { 62226, ST6 }, // Arabic.1046 - { 62227, ST6 }, // Arabic.1089 - { 62228, ST6 }, // Arabic.1256 - { 62229, ST8 }, // Hebrew.424 - { 62230, ST8 }, // Hebrew.856 - { 62231, ST8 }, // Hebrew.862 - { 62232, ST8 }, // Hebrew.916 - { 62233, ST8 }, // Arabic.420 - { 62234, ST9 }, // Arabic.420 - { 62235, ST6 }, // Hebrew.424 - { 62236, ST10 }, // Hebrew.856 - { 62237, ST8 }, // Hebrew.1255 - { 62238, ST10 }, // Hebrew.916 - { 62239, ST10 }, // Hebrew.1255 - { 62240, ST11 }, // Hebrew.424 - { 62241, ST11 }, // Hebrew.856 - { 62242, ST11 }, // Hebrew.862 - { 62243, ST11 }, // Hebrew.916 - { 62244, ST11 }, // Hebrew.1255 - { 62245, ST10 }, // Hebrew.424 - { 62251, ST6 } // Arabic.425 - Used for OS/390. - }; - - private static final int CCSID_MAX = CCSID_TABLE.length - 1; - - private static final BidiFlagSet[] FLAG_SET = new BidiFlagSet[12]; - private static final BidiFlagSet NORMAL_FLAG_SET = initFlagSet(0); - - private int as400Ccsid_; // Server CCSID. - private int as400Type_; // String type of server data. - private int javaType_; // String type of Java data. - private BidiTransform bdxJ2A_ = new BidiTransform(); // From Java to server. - private BidiTransform bdxA2J_ = new BidiTransform(); // From server to Java. - private BidiTransform lastTransform_ = bdxA2J_; // Keeps track of which transform was used last. - - /** - Constructs an AS400BidiTransform object assuming that the IBM i Bidi text conforms to a given CCSID. Typically this will be the CCSID of the system. -

    The given CCSID has a default string type which defines a set of Bidi flags. The orientation implied by this string type is applied to both the IBM i data layout and the Java data layout. - @param as400Ccsid The CCSID of the IBM i data. - **/ - public AS400BidiTransform(int as400Ccsid) - { - bdxA2J_.flags = new BidiFlagSet(NORMAL_FLAG_SET); - setAS400Ccsid(as400Ccsid); - setJavaStringType(BidiStringType.DEFAULT);//Bidi-HCG - //setJavaStringType(BidiStringType.ST5);//Bidi-HCG - } - - /** - Indicates if a given CCSID may apply to Bidi data. This is the case for Arabic and Hebrew CCSIDs, and for Unicode (which can encode anything). -

    If a CCSID is not Bidi, there is no need to perform layout transformations when converting IBM i data to Java data and vice-versa. - @param ccsid The CCSID to check. - @return true if the given CCSID may apply to Bidi data, false otherwise. - **/ - public static boolean isBidiCcsid(int ccsid) - { - switch (ccsid) - { - case 420: - case 424: - case 425: - case 856: - case 862: - case 864: - case 867: - case 916: - case 1046: - case 1089: - case 1255: - case 1256: - case 5012: - case 5351: - case 5352: - case 8612: - case 8616: - case 9238: - case 12708: - case 12712: - case 13488: - case 16804: - case 17248: - case 61952: - case 62208: - case 62209: - case 62210: - case 62211: - case 62212: - case 62213: - case 62214: - case 62215: - case 62216: - case 62217: - case 62218: - case 62219: - case 62220: - case 62221: - case 62222: - case 62223: - case 62224: - case 62225: - case 62226: - case 62227: - case 62228: - case 62229: - case 62230: - case 62231: - case 62232: - case 62233: - case 62234: - case 62235: - case 62236: - case 62237: - case 62238: - case 62239: - case 62240: - case 62241: - case 62242: - case 62243: - case 62244: - case 62245: - case 62251: - return true; - default: - return false; - } - } - - /** - Indicates if a given CCSID has a visual string type. - @param ccsid The CCSID to check. - @return true if the given CCSID has a visual string type, false otherwse. - **/ - public static boolean isVisual(int ccsid) - { - int st = getStringType(ccsid); - if (st == ST4 || st == ST7 || st == ST8 || st == ST9) return true; - return false; - } - - /** - Sets the CCSID. -

    The given CCSID has a default string type which defines a set of Bidi flags. The orientation implied by this string type is applied to both the IBM i data layout and the Java data layout. - @param as400Ccsid The CCSID of the IBM i data. - **/ - public void setAS400Ccsid(int as400Ccsid) - { - as400Ccsid_ = as400Ccsid; - setAS400StringType(getStringType(as400Ccsid)); - } - - /** - Returns the current CCSID of IBM i data. - @return The CCSID for the IBM i data. - **/ - public int getAS400Ccsid() - { - return as400Ccsid_; - } - - /** - Set the explicit string type for the IBM i data. Each CCSID has a default CDRA string type, which defines a set of Bidi flags. This method may be used to specify Bidi flags different from those implied by the CCSID. - @param as400Type The string type to apply to the IBM i data. The parameter string type should always be one of the constants defined in BidiStringType. - @see com.ibm.as400.access.BidiStringType - **/ - public void setAS400StringType(int as400Type) - { - //Bidi-HCG - delete this section - //if (as400Type != BidiStringType.DEFAULT && (as400Type < BidiStringType.ST4 || as400Type > BidiStringType.ST11)) - //{ - // Trace.log(Trace.ERROR, "Attempting to set the as400 string type to an invalid Bidi sting type."); - // throw new ExtendedIllegalArgumentException("as400Type", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - //} - - as400Type_ = as400Type; - if (FLAG_SET[as400Type] == null) - FLAG_SET[as400Type] = initFlagSet(as400Type); - bdxJ2A_.flags = FLAG_SET[as400Type]; - - //Bidi-HCG setJavaStringType(as400Type); - } - - /** - Returns the current string type of the IBM i data. - @return The string type of the IBM i data. - **/ - public int getAS400StringType() - { - return as400Type_; - } - - /** - Set the explicit string type for Java data. - @see com.ibm.as400.access.BidiStringType - @param javaType The string type to apply to Java data. - **/ - public void setJavaStringType(int javaType) - { - - //if (javaType != BidiStringType.DEFAULT && (javaType < BidiStringType.ST4 || javaType > BidiStringType.ST11)) - //{ - // Trace.log(Trace.ERROR, "Attempting to set the java string type to an invalid Bidi sting type."); - // throw new ExtendedIllegalArgumentException("javaType", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - //} - //if (FLAG_SET[javaType] == null) FLAG_SET[javaType] = initFlagSet(javaType); - //BidiFlag orient = FLAG_SET[javaType].getOrientation(); - // Copy orientation from javaType to bdxA2J_.flags. - //bdxA2J_.flags.setOneFlag(orient); - //if (orient == BidiFlag.ORIENTATION_LTR) javaType_ = 5; - //else if (orient == BidiFlag.ORIENTATION_RTL) javaType_ = 6; - //else if (orient == BidiFlag.ORIENTATION_CONTEXT_LTR) javaType_ = 10; - //else if (orient == BidiFlag.ORIENTATION_CONTEXT_RTL) javaType_ = 11; - //else javaType_ = 5; // Must never happen. - - javaType_ = javaType;//Bidi-HCG - bdxA2J_.flags = initFlagSet(javaType);//Bidi-HCG - } - - /** - Returns the current string type of Java data. - @return The string type of the Java data. - **/ - public int getJavaStringType() - { - return javaType_; - } - - /** - Sets the bidi conversion properties. - @param properties The bidi conversion properties. - **/ - public void setBidiConversionProperties(BidiConversionProperties properties) - { - setJavaStringType(properties.getBidiStringType());//Bidi-HCG - - properties.copyOptionsTo(bdxJ2A_); - properties.copyOptionsTo(bdxA2J_); - if (properties.isBidiRemoveMarksOnImplicitToVisual()) - { - bdxJ2A_.removeMarkers=true; - bdxA2J_.removeMarkers=false; - } - //Bidi-HCG setJavaStringType(properties.getBidiStringType()); - } - - /** - Returns the bidi conversion properties. - @return The bidi conversion properties. - **/ - public BidiConversionProperties getBidiConversionProperties() - { - boolean removeMarksOnJ2A = (bdxJ2A_.removeMarkers==true && bdxA2J_.removeMarkers==false); - return new BidiConversionProperties(getJavaStringType(),lastTransform_, removeMarksOnJ2A); - } - - /** - Convert data from the IBM i layout to the Java layout. - @param as400Text The IBM i string to convert. - @return The same text in standard Java Bidi layout. - **/ - public String toJavaLayout(String as400Text) - { lastTransform_ = bdxA2J_; - if(as400Type_ == BidiStringType.NONE || javaType_ == BidiStringType.NONE || javaType_ == as400Type_) //Bidi-HCG2 - return as400Text; //Bidi-HCG - BidiText src = new BidiText(bdxJ2A_.flags, as400Text); - return src.transform(bdxA2J_).toString(); - } - - /** - Convert data from the Java layout to the IBM i layout. - @param javaText The Java string to convert. - @return The same text in IBM i Bidi layout. - **/ - public String toAS400Layout(String javaText) - { lastTransform_ = bdxJ2A_; - if(as400Type_ == BidiStringType.NONE || javaType_ == BidiStringType.NONE || javaType_ == as400Type_) //Bidi-HCG2 - return javaText; //Bidi-HCG - BidiText src = new BidiText(bdxA2J_.flags, javaText); - return src.transform(bdxJ2A_).toString(); - } - - /** - * Returns Bidi string type defined for CCSID - * @param ccsid - * @return Bidi string type - */ - public static int getStringType(int ccsid) - { - // Return default string type for parm ccsid based on CCSID_TABLE. - int low = 0; - int high = CCSID_MAX; - - while (low < high) - { - int mid = (low + high) >>> 1; // same as division by 2, but eliminates possibility of overflow - if (ccsid < CCSID_TABLE[mid][0]) high = mid - 1; - else if (ccsid > CCSID_TABLE[mid][0]) low = mid + 1; - else return CCSID_TABLE[mid][1]; - } - if ((low == high) && (ccsid == CCSID_TABLE[low][0])) return CCSID_TABLE[low][1]; - return 0; - } - - //Bidi-HCG1 - private static int getStringTypeM(int ccsid){ - if(ccsid == 13488 || ccsid == 1200) - return ST5; - else - return getStringType(ccsid); - } - - //Bidi-HCG3 - static int getStringTypeX(int ccsid, AS400 as400){ - if(as400 == null) - return getStringType(ccsid); - - if(ccsid == 13488 || ccsid == 1200){ - boolean v5r1 = false; - try { - v5r1 = (as400.getVersion()==5) && (as400.getRelease()==1); - } catch (AS400SecurityException e) { - //do nothing - } catch (java.io.IOException e) { - //do nothing - } - - if(isBidiCcsid(as400.getCcsid()) && (!v5r1)) - return ST10; - else - return ST5; - } - else - return getStringType(ccsid); - } - - // Return BidiFlagSet according to string type. - private static BidiFlagSet initFlagSet(int stringType) - { - switch (stringType) - { - case ST4: - return new BidiFlagSet(BidiFlag.TYPE_VISUAL, - BidiFlag.NUMERALS_NOMINAL, - BidiFlag.ORIENTATION_LTR, - BidiFlag.TEXT_SHAPED, - BidiFlag.SWAP_NO); - case ST5: - return new BidiFlagSet(BidiFlag.TYPE_IMPLICIT, - BidiFlag.NUMERALS_NOMINAL, - BidiFlag.ORIENTATION_LTR, - BidiFlag.TEXT_NOMINAL, - BidiFlag.SWAP_YES); - case ST6: - return new BidiFlagSet(BidiFlag.TYPE_IMPLICIT, - BidiFlag.NUMERALS_NOMINAL, - BidiFlag.ORIENTATION_RTL, - BidiFlag.TEXT_NOMINAL, - BidiFlag.SWAP_YES); - case ST7: - return new BidiFlagSet(BidiFlag.TYPE_VISUAL, - BidiFlag.NUMERALS_NOMINAL, - BidiFlag.ORIENTATION_CONTEXT_LTR, - BidiFlag.TEXT_NOMINAL, - BidiFlag.SWAP_NO); - case ST8: - return new BidiFlagSet(BidiFlag.TYPE_VISUAL, - BidiFlag.NUMERALS_NOMINAL, - BidiFlag.ORIENTATION_RTL, - BidiFlag.TEXT_SHAPED, - BidiFlag.SWAP_NO); - case ST9: - return new BidiFlagSet(BidiFlag.TYPE_VISUAL, - BidiFlag.NUMERALS_NOMINAL, - BidiFlag.ORIENTATION_RTL, - BidiFlag.TEXT_SHAPED, - BidiFlag.SWAP_YES); - case ST10: - return new BidiFlagSet(BidiFlag.TYPE_IMPLICIT, - BidiFlag.NUMERALS_NOMINAL, - BidiFlag.ORIENTATION_CONTEXT_LTR, - BidiFlag.TEXT_NOMINAL, - BidiFlag.SWAP_YES); - case ST11: - return new BidiFlagSet(BidiFlag.TYPE_IMPLICIT, - BidiFlag.NUMERALS_NOMINAL, - BidiFlag.ORIENTATION_CONTEXT_RTL, - BidiFlag.TEXT_NOMINAL, - BidiFlag.SWAP_YES); - default: - return new BidiFlagSet(BidiFlag.TYPE_IMPLICIT, - BidiFlag.NUMERALS_NOMINAL, - //BidiFlag.ORIENTATION_CONTEXT_LTR, - BidiFlag.ORIENTATION_LTR,//Bidi-HCG1 - BidiFlag.TEXT_NOMINAL, - BidiFlag.SWAP_YES); - } - } - - //Bidi-HCG start - /** - Bidi-HCG - Perform Bidi layout transformation by given Bidi string types. - @param str The Java string to convert. - @param inFormat Input format. - @param outFormat Output format. - @return The same text after Bidi layout transformation. - **/ - public static String bidiTransform(String str, int inFormat, int outFormat){ - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Bidi layout transformation from " + inFormat + " to " + outFormat + ", string: " + str); - - if(inFormat == outFormat) - return str; - if(inFormat == BidiStringType.NONE || outFormat == BidiStringType.NONE) - return str; - - BidiTransform bdx = new BidiTransform(); - BidiFlagSet flagsIn = initFlagSet(inFormat); - BidiFlagSet flagsOut = initFlagSet(outFormat); - - bdx.flags = flagsOut; - - bdx.removeMarkers = true;//Bidi-HCG1 - - BidiText textIn = new BidiText(flagsIn,str); - BidiText textOut = textIn.transform(bdx); - String strOut = textOut.toString(); - - return strOut; - } - - /** - * Bidi-HCG - * Perform Bidi layout transformation of a data into SQL statement. Meta-data (names of columns etc.) is kept untouched. - * @param value_ Given SQL statement. - * @param inFormat Input format. - * @param outFormat Output format. - * @return The SQL statement after the Bidi layout transformation. - */ - public static String SQL_statement_reordering(String value_, int inFormat, int outFormat){ - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Bidi layout transformation from " + inFormat + " to " + outFormat + " of SQL statement: " + value_); - - if(inFormat == outFormat) - return value_; - if(inFormat == BidiStringType.NONE || outFormat == BidiStringType.NONE) - return value_; - - boolean into = false; - int i = 0, start = 0, end = 0; - String str; - - while(i< value_.length()){ - - if(into && (value_.charAt(i) == '\n' || value_.charAt(i) == '\r')){ - end = i; - - str = value_.substring(start, end); - str = bidiTransform(str, inFormat, outFormat); - value_ = value_.substring(0, start) + str + value_.substring(end); - start = i + 1; - } - - if(value_.charAt(i) == '\''){ - - if(into) { - if(i + 1 < value_.length()) - if(value_.charAt(i+1) == '\''){ - i = i + 2; - continue; - } - end = i; - - str = value_.substring(start, end); - str = bidiTransform(str, inFormat, outFormat); - value_ = value_.substring(0, start) + str + value_.substring(end); - - start = end = 0; - into = false; - } else { - into = true; - start = i+1; - } - } - - i++; - - } - return value_; - } - - public static String meta_data_reordering(String value_, int inFormat, int outFormat) { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Bidi layout transformation of SQL meta-data: " + value_); - - if(inFormat == outFormat) - return value_; - if(inFormat == BidiStringType.NONE || outFormat == BidiStringType.NONE) - return value_; - - boolean into = false; - int i = 0, start = 0, end = 0; - String str; - - while(i< value_.length()){ - if(value_.charAt(i) == '"'){ - if(into){ - end = i; - str = value_.substring(start, end); - str = bidiTransform(str, inFormat, outFormat); - value_ = value_.substring(0, start) + str + value_.substring(end); - - start = end = 0; - into = false; - } else { - into = true; - start = i+1; - } - } - - i++; - } - return value_; - } - - static String convertSQLToHostCCSID(String value_, AS400JDBCConnection connection) throws SQLException{ - if(connection == null || value_ == null) //@pdc - return value_; - JDProperties prop = connection.getProperties(); - int host_bidi_format, host_ccsid, package_bidi_format, package_ccsid; - int bidi_format = prop.getInt(JDProperties.BIDI_STRING_TYPE); - - if(connection.getSystem() != null){ //@pdc - host_ccsid = connection.getSystem().getCcsid(); - host_bidi_format = getStringType(host_ccsid); - } - else - host_bidi_format = 4; - - package_ccsid = connection.getProperties().getInt(JDProperties.PACKAGE_CCSID); - package_bidi_format = getStringTypeX(package_ccsid, connection.getSystem()); //Bidi-HCG3 - - if(bidi_format != BidiStringType.NONE && host_bidi_format != BidiStringType.NONE){//Bidi-HCG3 - if(prop.getString(JDProperties.BIDI_IMPLICIT_REORDERING).equalsIgnoreCase("true")) - value_ = meta_data_reordering(value_, bidi_format, host_bidi_format); - - value_ = SQL_statement_reordering(value_, bidi_format, package_bidi_format); - } - return value_; - } - -//Bidi-HCG2: Remove this method, and re-implement ConvTableBidiMap.stringToByteArray() instead. -// static String convertDataToHostCCSID(String value_, AS400JDBCConnection connection, int host_ccsid) throws SQLException{ -// if(connection == null || value_ == null) //@pdc -// return value_; -// JDProperties prop = connection.getProperties(); -// int bidi_format = prop.getInt(JDProperties.BIDI_STRING_TYPE); -// int host_bidi_format = getStringTypeX(host_ccsid, connection.getSystem()); -// if(bidi_format != 0 && host_bidi_format != 0){ -// value_ = bidiTransform(value_, bidi_format, host_bidi_format); -// } -// return value_; -// } - - static String convertDataFromHostCCSID(String value_, AS400JDBCConnection connection, int host_ccsid) throws SQLException{ - - if(connection == null || value_ == null) //@pdc - return value_; - JDProperties prop = connection.getProperties(); - int host_bidi_format; - int bidi_format = prop.getInt(JDProperties.BIDI_STRING_TYPE); - - host_bidi_format = getStringTypeX(host_ccsid, connection.getSystem()); - if(host_bidi_format == 0){ - if(connection.getSystem() != null){ - host_ccsid = connection.getSystem().getCcsid(); - host_bidi_format = getStringType(host_ccsid); - } - else host_bidi_format = 4; - } - - if(bidi_format != 0 && host_bidi_format != 0){ - value_ = bidiTransform(value_, host_bidi_format, bidi_format); - - } - - return value_; - } - - //Bidi-HCG end -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Bin1.java b/cvsroot/src/com/ibm/as400/access/AS400Bin1.java deleted file mode 100644 index 3a5d1d717..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400Bin1.java +++ /dev/null @@ -1,221 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Bin1.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2010-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - Provides a converter between a {@link java.lang.Byte Byte} object and a signed one-byte binary number. - The range of values representable by this data type is -128 through 127 (Byte.MIN_VALUE through Byte.MAX_VALUE). -

    Note: According to the DDS specification, BINARY() fields occupy a minimum of 2 bytes of storage in IBM i records. Therefore the behavior of this class is not consistent with the semantics of the IBM i BINARY(1) data type. For that reason, this converter is not yet exploited in PCML, RFML, or XPCML. - @see AS400UnsignedBin1 - **/ -public class AS400Bin1 implements AS400DataType -{ - static final long serialVersionUID = 4L; - - private static final int SIZE = 1; - private static final byte MIN_VALUE = (byte)-128; // 0x80 (two's complement) - private static final byte MAX_VALUE = (byte)127; // 0x7F - private static final byte DEFAULT_VALUE = (byte)0; - - /** - * Constructs an AS400Bin1 object. - **/ - public AS400Bin1() - { - } - - // Implements method of interface AS400DataType. - /** - * Creates a new AS400Bin1 object that is identical to the current instance. - * @return The new object. - **/ - public Object clone() - { - try - { - return super.clone(); // Object.clone does not throw exception - } - catch (CloneNotSupportedException e) - { - Trace.log(Trace.ERROR, "Unexpected cloning error", e); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - // Implements method of interface AS400DataType. - /** - * Returns the byte length of the data type. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int getByteLength() - { - return SIZE; - } - - // Implements method of interface AS400DataType. - /** - * Returns a Java object representing the default value of the data type. - * @return The Byte object with a value of zero. - **/ - public Object getDefaultValue() - { - return new Byte(DEFAULT_VALUE); - } - - // Implements method of interface AS400DataType. - /** - * Returns {@link com.ibm.as400.access.AS400DataType#TYPE_BIN1 TYPE_BIN1}. - * @return AS400DataType.TYPE_BIN1. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_BIN1; - } - - // Implements method of interface AS400DataType. - /** - * Returns the Java class that corresponds with this data type. - * @return Byte.class. - **/ - public Class getJavaType() - { - return Byte.class; - } - - // Implements method of interface AS400DataType. - /** - * Converts the specified Java object to IBM i format. - * @param javaValue The object corresponding to the data type. It must be an instance of Byte. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - // Allow this line to throw ClassCastException and NullPointerException. - byte[] as400Value = new byte[SIZE]; - as400Value[0] = ((Byte)javaValue).byteValue(); - - return as400Value; - } - - /** - * Converts the specified byte to IBM i format. - * @param byteValue The value to be converted to IBM i format. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(byte byteValue) - { - byte[] as400Value = new byte[SIZE]; - as400Value[0] = byteValue; - return as400Value; - } - - // Implements method of interface AS400DataType. - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of Byte. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value) - { - // Allow this line to throw ClassCastException and NullPointerException. - as400Value[0] = ((Byte)javaValue).byteValue(); - return SIZE; - } - - /** - * Converts the specified byte into IBM i format in the specified byte array. - * @param byteValue The value to be converted to IBM i format. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(byte byteValue, byte[] as400Value) - { - as400Value[0] = byteValue; - return SIZE; - } - - // Implements method of interface AS400DataType. - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of Byte. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - // Allow this line to throw ClassCastException and NullPointerException. - as400Value[offset] = ((Byte)javaValue).byteValue(); - return SIZE; - } - - /** - * Converts the specified byte into IBM i format in the specified byte array. - * @param byteValue The value to be converted to IBM i format. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(byte byteValue, byte[] as400Value, int offset) - { - as400Value[offset] = byteValue; - return SIZE; - } - - // Implements method of interface AS400DataType. - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return A Byte object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value) - { - return new Byte(as400Value[0]); - } - - // Implements method of interface AS400DataType. - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return A Byte object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value, int offset) - { - return new Byte(as400Value[offset]); - } - - /** - * Converts the specified IBM i data type to a byte. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The byte corresponding to the data type. - **/ - public byte toByte(byte[] as400Value) - { - return as400Value[0]; - } - - /** - * Converts the specified IBM i data type to a byte. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The byte corresponding to the data type. - **/ - public byte toByte(byte[] as400Value, int offset) - { - return as400Value[offset]; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Bin2.java b/cvsroot/src/com/ibm/as400/access/AS400Bin2.java deleted file mode 100644 index a51ea955e..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400Bin2.java +++ /dev/null @@ -1,209 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Bin2.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The AS400Bin2 class provides a converter between a Short object and a signed two-byte binary number. - **/ -public class AS400Bin2 implements AS400DataType -{ - static final long serialVersionUID = 4L; - - private static final int SIZE = 2; - private static final short defaultValue = 0; - - /** - * Constructs an AS400Bin2 object. - **/ - public AS400Bin2() - { - } - - /** - * Creates a new AS400Bin2 that is identical to the current instance. - * @return The new object. - **/ - public Object clone() - { - try - { - return super.clone(); // Object.clone does not throw exception - } - catch (CloneNotSupportedException e) - { - Trace.log(Trace.ERROR, "Unexpected cloning error", e); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - /** - * Returns the byte length of the data type. - * @return Two (2), the number of bytes in the IBM i representation of the data type. - **/ - public int getByteLength() - { - return SIZE; - } - - /** - * Returns a Java object representing the default value of the data type. - * @return The Short object with a value of zero. - **/ - public Object getDefaultValue() - { - return new Short(defaultValue); - } - - /** - * Returns {@link com.ibm.as400.access.AS400DataType#TYPE_BIN2 TYPE_BIN2}. - * @return AS400DataType.TYPE_BIN2. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_BIN2; - } - - /** - * Returns the Java class that corresponds with this data type. - * @return Short.class. - **/ - public Class getJavaType() - { - return Short.class; - } - - /** - * Converts the specified Java object to IBM i format. - * @param javaValue The object corresponding to the data type. It must be an instance of Short. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - byte[] as400Value = new byte[SIZE]; - BinaryConverter.shortToByteArray(((Short)javaValue).shortValue(), as400Value, 0); // Allow this line to throw ClassCastException and NullPointerException - return as400Value; - } - - /** - * Converts the specified short to IBM i format. - * @param shortValue The value to be converted to IBM i format. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(short shortValue) - { - byte[] as400Value = new byte[SIZE]; - BinaryConverter.shortToByteArray(shortValue, as400Value, 0); - return as400Value; - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of Short. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return Two (2), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.shortToByteArray(((Short)javaValue).shortValue(), as400Value, 0); // Allow this line to throw ClassCastException and NullPointerException - return SIZE; - } - - /** - * Converts the specified short into IBM i format in the specified byte array. - * @param shortValue The value to be converted to IBM i format. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return Two (2), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(short shortValue, byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.shortToByteArray(shortValue, as400Value, 0); - return SIZE; - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of Short. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return Two (2), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.shortToByteArray(((Short)javaValue).shortValue(), as400Value, offset); // Allow this line to throw ClassCastException and NullPointerException - return SIZE; - } - - /** - * Converts the specified short into IBM i format in the specified byte array. - * @param shortValue The value to be converted to IBM i format. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return Two (2), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(short shortValue, byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.shortToByteArray(shortValue, as400Value, offset); - return SIZE; - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The Short object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - return new Short(BinaryConverter.byteArrayToShort(as400Value, 0)); - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The Short object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - return new Short(BinaryConverter.byteArrayToShort(as400Value, offset)); - } - - /** - * Converts the specified IBM i data type to a short. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The short corresponding to the data type. - **/ - public short toShort(byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - return BinaryConverter.byteArrayToShort(as400Value, 0); - } - - /** - * Converts the specified IBM i data type to a short. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The short corresponding to the data type. - **/ - public short toShort(byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - return BinaryConverter.byteArrayToShort(as400Value, offset); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Bin4.java b/cvsroot/src/com/ibm/as400/access/AS400Bin4.java deleted file mode 100644 index dbb968ceb..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400Bin4.java +++ /dev/null @@ -1,211 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Bin4.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The AS400Bin4 class provides a converter between an Integer object and a signed four-byte binary number. - **/ -public class AS400Bin4 implements AS400DataType -{ - static final long serialVersionUID = 4L; - - - - private static final int SIZE = 4; - private static final int defaultValue = 0; - - /** - * Constructs an AS400Bin4 object. - **/ - public AS400Bin4() - { - } - - /** - * Creates a new AS400Bin4 object that is identical to the current instance. - * @return The new object. - **/ - public Object clone() - { - try - { - return super.clone(); // Object.clone does not throw exception - } - catch (CloneNotSupportedException e) - { - Trace.log(Trace.ERROR, "Unexpected cloning error", e); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - /** - * Returns the byte length of the data type. - * @return Four (4), the number of bytes in the IBM i representation of the data type. - **/ - public int getByteLength() - { - return SIZE; - } - - /** - * Returns a Java object representing the default value of the data type. - * @return The Integer object with a value of zero. - **/ - public Object getDefaultValue() - { - return new Integer(defaultValue); - } - - /** - * Returns {@link com.ibm.as400.access.AS400DataType#TYPE_BIN4 TYPE_BIN4}. - * @return AS400DataType.TYPE_BIN4. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_BIN4; - } - - /** - * Returns the Java class that corresponds with this data type. - * @return Integer.class. - **/ - public Class getJavaType() - { - return Integer.class; - } - - /** - * Converts the specified Java object to IBM i format. - * @param javaValue The object corresponding to the data type. It must be an instance of Integer. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - byte[] as400Value = new byte[SIZE]; - BinaryConverter.intToByteArray(((Integer)javaValue).intValue(), as400Value, 0); // Allow this line to throw ClassCastException and NullPointerException - return as400Value; - } - - /** - * Converts the specified int to IBM i format. - * @param intValue The value to be converted to IBM i format. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(int intValue) - { - byte[] as400Value = new byte[SIZE]; - BinaryConverter.intToByteArray(intValue, as400Value, 0); - return as400Value; - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of Integer. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return Four (4), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.intToByteArray(((Integer)javaValue).intValue(), as400Value, 0); // Allow this line to throw ClassCastException and NullPointerException - return SIZE; - } - - /** - * Converts the specified int into IBM i format in the specified byte array. - * @param intValue The value to be converted to IBM i format. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return Four (4), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(int intValue, byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.intToByteArray(intValue, as400Value, 0); - return SIZE; - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of Integer. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return Four (4), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.intToByteArray(((Integer)javaValue).intValue(), as400Value, offset); // Allow this line to throw ClassCastException and NullPointerException - return SIZE; - } - - /** - * Converts the specified int into IBM i format in the specified byte array. - * @param intValue The value to be converted to IBM i format. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return Four (4), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(int intValue, byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.intToByteArray(intValue, as400Value, offset); - return SIZE; - } - - /** - * Converts the specified IBM i data type to an int. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The int corresponding to the data type. - **/ - public int toInt(byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - return BinaryConverter.byteArrayToInt(as400Value, 0); - } - - /** - * Converts the specified IBM i data type to an int. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The int corresponding to the data type. - **/ - public int toInt(byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - return BinaryConverter.byteArrayToInt(as400Value, offset); - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The Integer object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - return new Integer(BinaryConverter.byteArrayToInt(as400Value, 0)); - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The Integer object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - return new Integer(BinaryConverter.byteArrayToInt(as400Value, offset)); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Bin8.java b/cvsroot/src/com/ibm/as400/access/AS400Bin8.java deleted file mode 100644 index b6d759f41..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400Bin8.java +++ /dev/null @@ -1,211 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Bin8.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - The AS400Bin8 class provides a converter between a Long object and a signed eight-byte binary number. - **/ -public class AS400Bin8 implements AS400DataType -{ - static final long serialVersionUID = 4L; - - - - private static final int SIZE = 8; - private static final long defaultValue = 0L; - - /** - Constructs an AS400Bin8 object. - **/ - public AS400Bin8() - { - } - - /** - Creates a new AS400Bin8 object that is identical to the current instance. - @return The new object. - **/ - public Object clone() - { - try - { - return super.clone(); // Object.clone does not throw exception - } - catch (CloneNotSupportedException e) - { - Trace.log(Trace.ERROR, "Unexpected cloning error", e); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - /** - Returns the byte length of the data type. - @return Eight (8), the number of bytes in the IBM i representation of the data type. - **/ - public int getByteLength() - { - return SIZE; - } - - /** - Returns a Java object representing the default value of the data type. - @return The Long object with a value of zero. - **/ - public Object getDefaultValue() - { - return new Long(defaultValue); - } - - /** - * Returns {@link com.ibm.as400.access.AS400DataType#TYPE_BIN8 TYPE_BIN8}. - * @return AS400DataType.TYPE_BIN8. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_BIN8; - } - - /** - * Returns the Java class that corresponds with this data type. - * @return Long.class. - **/ - public Class getJavaType() - { - return Long.class; - } - - /** - Converts the specified Java object to IBM i format. - @param javaValue The object corresponding to the data type. It must be an instance of Long. - @return The IBM i representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - byte[] as400Value = new byte[SIZE]; - BinaryConverter.longToByteArray(((Long)javaValue).longValue(), as400Value, 0); // Allow this line to throw ClassCastException and NullPointerException - return as400Value; - } - - /** - Converts the specified long to IBM i format. - @param longValue The value to be converted to IBM i format. - @return The IBM i representation of the data type. - **/ - public byte[] toBytes(long longValue) - { - byte[] as400Value = new byte[SIZE]; - BinaryConverter.longToByteArray(longValue, as400Value, 0); - return as400Value; - } - - /** - Converts the specified Java object into IBM i format in the specified byte array. - @param javaValue The object corresponding to the data type. It must be an instance of Long. - @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - @return Eight (8), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.longToByteArray(((Long)javaValue).longValue(), as400Value, 0); // Allow this line to throw ClassCastException and NullPointerException - return SIZE; - } - - /** - Converts the specified long into IBM i format in the specified byte array. - @param longValue The value to be converted to IBM i format. - @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - @return Eight (8), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(long longValue, byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.longToByteArray(longValue, as400Value, 0); - return SIZE; - } - - /** - Converts the specified Java object into IBM i format in the specified byte array. - @param javaValue The object corresponding to the data type. It must be an instance of Long. - @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @return Eight (8), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.longToByteArray(((Long)javaValue).longValue(), as400Value, offset); // Allow this line to throw ClassCastException and NullPointerException - return SIZE; - } - - /** - Converts the specified long into IBM i format in the specified byte array. - @param longValue The value to be converted to IBM i format. - @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @return Eight (8), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(long longValue, byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.longToByteArray(longValue, as400Value, offset); - return SIZE; - } - - /** - Converts the specified IBM i data type to a long. - @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - @return The long corresponding to the data type. - **/ - public long toLong(byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - return BinaryConverter.byteArrayToLong(as400Value, 0); - } - - /** - Converts the specified IBM i data type to a long. - @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @return The long corresponding to the data type. - **/ - public long toLong(byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - return BinaryConverter.byteArrayToLong(as400Value, offset); - } - - /** - Converts the specified IBM i data type to a Java object. - @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - @return The Long object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - return new Long(BinaryConverter.byteArrayToLong(as400Value, 0)); - } - - /** - Converts the specified IBM i data type to a Java object. - @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @return The Long object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - return new Long(BinaryConverter.byteArrayToLong(as400Value, offset)); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400ByteArray.java b/cvsroot/src/com/ibm/as400/access/AS400ByteArray.java deleted file mode 100644 index 0a381c232..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400ByteArray.java +++ /dev/null @@ -1,162 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400ByteArray.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The AS400ByteArray class provides a converter between a byte array and fixed-length byte array representing IBM i data that is not convertible. - **/ -public class AS400ByteArray implements AS400DataType -{ - static final long serialVersionUID = 4L; - - private int length; - private static final int defaultValue = 0; - - /** - * Constructs an AS400ByteArray object. - * @param length The byte length of the IBM i byte array. It must be greater than or equal to zero. - */ - public AS400ByteArray(int length) - { - if (length < 0) - { - throw new ExtendedIllegalArgumentException("length (" + String.valueOf(length) + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - this.length = length; - } - - /** - * Creates a new AS400ByteArray object that is identical to the current instance. - * @return The new object. - **/ - public Object clone() - { - try - { - return super.clone(); // Object.clone does not throw exception - } - catch (CloneNotSupportedException e) - { - Trace.log(Trace.ERROR, "Unexpected cloning error", e); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - /** - * Returns the byte length of the data type. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int getByteLength() - { - return this.length; - } - - /** - * Returns a Java object representing the default value of the data type. - * @return The zero length byte array. - **/ - public Object getDefaultValue() - { - return new byte[defaultValue]; - } - - /** - * Returns {@link com.ibm.as400.access.AS400DataType#TYPE_BYTE_ARRAY TYPE_BYTE_ARRAY}. - * @return AS400DataType.TYPE_BYTE_ARRAY. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_BYTE_ARRAY; - } - - /** - * Returns the Java class that corresponds with this data type. - * @return byte[].class. - **/ - public Class getJavaType() - { - return byte[].class; - } - - /** - * Converts the specified Java object to IBM i format. - * @param javaValue The object corresponding to the data type. It must be a byte array. If the provided byte array is not long enough to fill the return array, the remaining bytes will be zero filled. Any extra bytes in the provided array will not be used. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - byte[] as400Value = new byte[this.length]; - this.toBytes(javaValue, as400Value, 0); - return as400Value; - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be a byte array. If the provided byte array is not long enough to fill the return array, the remaining bytes will be zero filled. Any extra bytes in the provided array will not be used. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the value. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value) - { - return this.toBytes(javaValue, as400Value, 0); - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be a byte array. If the provided byte array is not long enough to fill the return array, the remaining bytes will be zero filled. Any extra bytes in the provided array will not be used. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - int size = this.length; - byte[] byteValue = (byte[])javaValue; // allow this line to throw ClassCastException - - // transfer data from array to array - int dataSize = (size < byteValue.length) ? size : byteValue.length; - System.arraycopy(byteValue, 0, as400Value, offset, dataSize); - - // zero fill if necessary - for (int i = byteValue.length; i < size; ++i) - { - as400Value[offset+i] = 0; // allow this line to throw ArrayIndexException - } - return size; - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The byte array corresponding to the data type. - **/ - public Object toObject(byte[] as400Value) - { - return this.toObject(as400Value, 0); - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The byte array corresponding to the data type. - **/ - public Object toObject(byte[] as400Value, int offset) - { - int size = this.length; - byte[] javaValue = new byte[size]; - System.arraycopy(as400Value, offset, javaValue, 0, size); - return javaValue; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Certificate.java b/cvsroot/src/com/ibm/as400/access/AS400Certificate.java deleted file mode 100644 index ad10811f7..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400Certificate.java +++ /dev/null @@ -1,182 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Certificate.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -

    The AS400Certificate class represents an X.509 ASN.1 encoded certificate. - - **/ -public class AS400Certificate extends Object - implements java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // The ASN.1 encoded certificate. - private byte[] certificate_; - - // Free form additional information about this certificate. - private String info_; - - // Free form additional byte data about this certificate. - private byte[] byteData_; - - - /** - *Constructs an AS400Certificate object. - **/ - public AS400Certificate() - { - } - - /** - *Constructs an AS400Certificate object. - * - *@param certificate The ASN.1 encoded X.509 certificate. - **/ - public AS400Certificate(byte[] certificate) - { - certificate_ = certificate; - } - - - - - - /** - * Returns the free form byte data. - * @return A byte array with free form information. - */ - public byte[] getByteInfo() - { - return byteData_; - } - - - - /** - * Returns the ASN.1 encoded certificate value. - * - * @return The ASN.1 encoded X.509 certificate. - **/ - public byte[] getEncoded() - { - int len; - byte[] tempBytes; - - len = getLength(certificate_); - - if (len != certificate_.length) - { - tempBytes = certificate_; - certificate_ = new byte[len]; - - System.arraycopy(tempBytes, 0, - certificate_, 0, - len); - } - - return certificate_; - } - - /** - * Returns the free form information. - * @return The free form string information. - */ - public String getInfo() - { - return info_; - } - - - - - - - - - /** - * Sets the free form byte data. - * @param byteData The free form byte array information. - */ - public void setByteInfo(byte[] byteData) - { - byteData_ = byteData; - } - - - /** - * Sets the ASN.1 encoded certificate value. - * - * @param certificate The ASN.1 encoded certificate. - **/ - public void setEncoded(byte[] certificate) - { - certificate_ = certificate; - } - - /** - * Sets the free form string information. - * @param information The free form information. - */ - public void setInfo(String information) - { - info_ = information; - } - - - /** - * Converts DER length field to int and returns total length of certificate. Assumes first input byte is sequence tag and certificate length is less than 3.2 Gigabyte. - */ - private int getLength (byte[] derSeq) - { - - int length, i; - int lengthByteCount = derSeq[1]; - int addlen = 2; - - - if (0x00 == (derSeq[1] & 0x80)) - { - length = derSeq[1]; - } - - else - { - lengthByteCount &= 0x07f; - - for (length = 0, i = 2; - lengthByteCount > 0; - lengthByteCount--, ++i ) - { - length <<= 8; - length += derSeq[i] & 0x0ff; - addlen += 1; - } - } - - return length + addlen; - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateAttribute.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateAttribute.java deleted file mode 100644 index 63b53923e..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateAttribute.java +++ /dev/null @@ -1,239 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateAttribute.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** -

    The AS400CertificateAttribute class represents a certificate - attribute. This attribute is used to identify certificates - during a list operation. This class contains a single attribute - which can be either a String or byte array value. -**/ - -public class AS400CertificateAttribute extends Object - implements java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - - private int attrType_; // Certificate attribute type, byte[] or String. - private byte[] byteAttr_; // Byte certificate attribute value. - private String stringAttr_; // String certificate attribute value. - private boolean isString_; // Certificate attribute is type String. - - static final int LAST_BYTE_ATTR = 1; // Last defined byte attribute. - static final int LAST_STRING_ATTR = 7; // Last defined String attr. - - - - /** - The byte array attribute type representing the subjectPublicKeyInfo - field from the certificate. - **/ - - public final static int PUBLIC_KEY_BYTES = 1; - /** - Constant indicating the attribute represents the subject's - common name in the certificate. - **/ - public final static int SUBJECT_COMMON_NAME = 2; - /** - Constant indicating the attribute represents the subject's - country in the certificate. - **/ - public final static int SUBJECT_COUNTRY = 3; - /** - Constant indicating the attribute represents the subject's - locality in the certificate. - **/ - public final static int SUBJECT_LOCALITY = 4; - /** - Contant indicating the attribute represents the subject's - state or province in the certificate. - **/ - public final static int SUBJECT_STATE = 5; - /** - Constant indicating the attribute represents the subject's - organization in the certificate. - **/ - public final static int SUBJECT_ORGANIZATION = 6; - /** - Constant indicating the attribute represents the subject's - organizational unit in the certificate. - **/ - public final static int SUBJECT_ORGANIZATION_UNIT = 7; - - - /** - * Constructs an AS400CertificateAttribute object. - **/ - public AS400CertificateAttribute() - { - } - - /** - * Constructs an AS400CertificateAttribute object. - * - * @param attributeType The attribute type. - * Valid values are: - *

      - *
    • PUBLIC_KEY_BYTES - *
    - * @param attributeValue The attribute value. - * - * @exception ExtendedIllegalArgumentException If the attribute Type is invalid. - */ - public AS400CertificateAttribute(int attributeType, byte[] attributeValue) - throws ExtendedIllegalArgumentException - { - if (attributeType < 1 || attributeType > LAST_BYTE_ATTR) - throw new ExtendedIllegalArgumentException("attributeType (" + - Integer.toString(attributeType) + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - attrType_ = attributeType; - byteAttr_ = attributeValue; - isString_ = false; - } - - /** - * Constructs an AS400CertificateAttribute object. - * - * @param attributeType The attribute type. - * Valid values are: - *
      - *
    • SUBJECT_COMMON_NAME - *
    • SUBJECT_COUNTRY - *
    • SUBJECT_LOCALITY - *
    • SUBJECT_ORGANIZATION - *
    • SUBJECT_ORGANIZATION_UNIT - *
    • SUBJECT_STATE - *
    - * @param attributeValue The attribute value. - * - * @exception ExtendedIllegalArgumentException If the attribute Type is invalid. - */ - public AS400CertificateAttribute(int attributeType, String attributeValue) - throws ExtendedIllegalArgumentException - { - if (attributeType <= LAST_BYTE_ATTR || attributeType > LAST_STRING_ATTR) - throw new ExtendedIllegalArgumentException("attributeType (" + - Integer.toString(attributeType) + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - attrType_ = attributeType; - stringAttr_ = attributeValue; - isString_ = true; - } - - - - /** - * Returns the attribute type. - * @return The attribute type. - */ - public int getAttributeType() - { - return attrType_; - } - - /** - * Returns the attribute value. - * @return The attribute value. - */ - public Object getAttributeValue() - { - if (true == isString_) - return (Object) stringAttr_; - else - return (Object) byteAttr_; - } - - - - /** - * Indicates if the attribute is a String. - * @return Returns true if the attribute is a String; false otherwise. - */ - public boolean isString() - { - return isString_; - } - - - - - /** - * Sets the byte attribute value. - * @param attributeType The attribute type. - * Valid values are: - *
      - *
    • PUBLIC_KEY_BYTES - *
    - * @param attributeValue The attribute value. - * - * @exception ExtendedIllegalArgumentException If the attribute Type is invalid. - */ - public void setAttribute(int attributeType, byte[] attributeValue) - throws ExtendedIllegalArgumentException - { - if (attributeType < 1 || attributeType > LAST_BYTE_ATTR) - throw new ExtendedIllegalArgumentException("attributeType (" + - Integer.toString(attributeType) + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - attrType_ = attributeType; - byteAttr_ = attributeValue; - isString_ = false; - } - - /** - * Sets the String attribute value. - * @param attributeType The attribute type. - * Valid values are: - *
      - *
    • SUBJECT_COMMON_NAME - *
    • SUBJECT_COUNTRY - *
    • SUBJECT_LOCALITY - *
    • SUBJECT_ORGANIZATION - *
    • SUBJECT_ORGANIZATION_UNIT - *
    • SUBJECT_STATE - *
    - * @param attributeValue The attribute value. - * - * @exception ExtendedIllegalArgumentException If the attribute Type is invalid. - */ - public void setAttribute(int attributeType, String attributeValue) - throws ExtendedIllegalArgumentException - { - if (attributeType <= LAST_BYTE_ATTR || attributeType > LAST_STRING_ATTR) - throw new ExtendedIllegalArgumentException("attributeType (" + - Integer.toString(attributeType) + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - - attrType_ = attributeType; - stringAttr_ = attributeValue; - isString_ = true; - } - - -} // End of AS400CertificateAttribute class - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateEvent.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateEvent.java deleted file mode 100644 index 080ee43d5..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateEvent.java +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - The AS400CertificateEvent class represents an AS400Certificate event. -**/ - -public class AS400CertificateEvent extends java.util.EventObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - /** - The AS400Certificate added event ID. This event is delivered when a certificate has been added. - **/ - public static final int CERTIFICATE_ADDED = 0; - - /** - The AS400Certificate deleted event ID. This event is delivered when a certificate has been deleted. - **/ - public static final int CERTIFICATE_DELETED = 1; - - - private int id_; // event identifier - - - /** - Constructs an AS400CertificateEvent object. - @param source The object where the event originated. - @param id The event identifier. - **/ - public AS400CertificateEvent(Object source, - int id) - { - super(source); - - if (id < CERTIFICATE_ADDED || id > CERTIFICATE_DELETED) - { - throw new ExtendedIllegalArgumentException("id", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - id_ = id; - } - - /** - Returns the identifier for this event. - @return The identifier for this event. - **/ - public int getID() - { - return id_; - } -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateListener.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateListener.java deleted file mode 100644 index 21818cb0f..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateListener.java +++ /dev/null @@ -1,38 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Bin8.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; -/** - The AS400CertificateListener interface provides - an interface for receiving certificate events. -**/ - -public interface AS400CertificateListener extends java.util.EventListener -{ - /** - Invoked when a certificate has been added. - @param event The AS400CertificateEvent. - **/ - public void added( AS400CertificateEvent event ); - - /** - Invoked when a certificate has been deleted. - @param event The AS400CertificateEvent. - **/ - public void deleted( AS400CertificateEvent event ); - -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateUserProfileUtil.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateUserProfileUtil.java deleted file mode 100644 index 15b6d101d..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateUserProfileUtil.java +++ /dev/null @@ -1,518 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateUserProfileUtil.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.Beans; -import java.beans.PropertyVetoException; -import java.util.EventListener; -import java.io.InterruptedIOException; -import java.io.IOException; -import java.net.UnknownHostException; -import java.util.Vector; - - -/** -

    The AS400CertificateUserProfileUtil class accesses certificates in an IBM i user profile object. -**/ -public class AS400CertificateUserProfileUtil extends AS400CertificateUtil implements java.io.Serializable -{ - private static final String CLASSNAME = "com.ibm.as400.access.AS400CertificateUserProfileUtil"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - static final long serialVersionUID = 4L; - - - /** - * The user profile class implementation, either native or remote. - **/ - transient AS400CertificateUsrPrfUtilImpl usrprfImpl_ = null; - - - /** - * Constructs an AS400CertificateUserProfileUtil object. - **/ - public AS400CertificateUserProfileUtil() - { - } - - /** - * Constructs an AS400CertificateUserProfileUtil object. If the user profile specified is not the user profile that is currently running, adding and deleting certificates require *SECADM special authority for the currently running user profile and *USE and *OBJMGT authorities to the target user profile. - * - * @param system The system on which the user profile exists. - * - * @param path The fully qualified integrated file system path name of the user profile, for example, "/QSYS.LIB/MYLIB.LIB/MYUSRPRF.USRPRF". - */ - public AS400CertificateUserProfileUtil(AS400 system, String path) - { - super(system, path); - - if (!(objectType_.equalsIgnoreCase("USRPRF")) || - objectName_.length() > 10) - { - throw new ExtendedIllegalArgumentException("path (" + path + ")", ExtendedIllegalArgumentException.PATH_NOT_VALID); - } - - //make a 10 char user profile name - objectName_ = objectName_ + " "; - objectName_ = objectName_.substring(0, 10); - objectName_ = objectName_.toUpperCase(); - } - - - - /** - Connect() - - Determines the type of implementation that will be used. - System and Path parameters are committed at this time. - **/ - void connect() throws IOException - { - - // Ensure that the system has been set. - if (system_ == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null at connect."); - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Ensure that the path has been set. - if (ifsPathName_ == null) - { - Trace.log(Trace.ERROR, "Parameter 'path' is null."); - throw new ExtendedIllegalStateException("ifsPathName", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Determine if we are running on the server or some remote system. - usrprfImpl_ = (com.ibm.as400.access.AS400CertificateUsrPrfUtilImpl) - system_.loadImpl( - "com.ibm.as400.access.AS400CertificateUsrPrfUtilImplNative", - "com.ibm.as400.access.AS400CertificateUsrPrfUtilImplRemote"); - - impl_ = (com.ibm.as400.access.AS400CertificateUtilImpl) - system_.loadImpl( - "com.ibm.as400.access.AS400CertificateUtilImplNative", - "com.ibm.as400.access.AS400CertificateUtilImplRemote"); - - //update user profile and base class impl references - usrprfImpl_.system_ = system_; - impl_.system_ = system_; - - Converter conv = new Converter(system_.getCcsid(), system_); // @C1A - usrprfImpl_.setConverter(conv); // @C0C @C1C - impl_.setConverter(conv); - - // Set the connection flag, commits system and path parameters. - connected_ = true; - - } - - - /** - * Adds the certificate to the user profile. Throws an ExtendedIOException if the certificate is already a member of the user profile. - * - * @param certificate The complete ASN.1 X.509 certificate to be added to the user profile. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If invalid certificate. - * @exception ExtendedIOException If certificate already added and other IBM i certificate access errors. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - public void addCertificate(byte[] certificate) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException - - { - int rc; - - if (null == certificate) - { - Trace.log(Trace.ERROR, "Parameter 'certificate' is null."); - throw new NullPointerException("certificate"); - } - - if (isConnected() == false) - connect(); - - //makes either remote or local call - rc = usrprfImpl_.calladdCertificate( - certificate, certificate.length, - objectName_); - - if (rc != SUCCESS) - { - throwException(usrprfImpl_.cpfError_, ifsPathName_, rc); - } - - fireAdd(); - } - - - /** - * Deletes the certificate from the user profile. Throws an ExtendedIOException if the certificate is not present in the user profile. - * - * @param certificate The complete ASN.1 X.509 certificate to be deleted from the user profile. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If invalid certificate. - * @exception ExtendedIOException If certificate not found and other IBM i certificate access errors. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - public void deleteCertificate(byte[] certificate) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException - - { - int rc; - - if (null == certificate) - { - Trace.log(Trace.ERROR, "Parameter 'certificate' is null."); - throw new NullPointerException("certificate"); - } - - if (isConnected() == false) - connect(); - - //makes either remote or local call - rc = usrprfImpl_.calldeleteCertificate( - certificate, certificate.length, - objectName_, 1); - - if (rc != SUCCESS) - { - throwException(usrprfImpl_.cpfError_, ifsPathName_, rc); - } - - fireDelete(); - } - - - - /** - * Deletes the certificate matching the certificate handle from the user profile. Throws ExtendedIOException if the certificate is not present in the user profile. - * - * @param certificateHandle The AS400Certificate handle of the certificate to be deleted from the user profile. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If invalid certificate handle. - * @exception ExtendedIOException If certificate not found and other IBM i certificate access errors. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - public void deleteCertificateByHandle(byte[] certificateHandle) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException - - { - int rc; - - if (null == certificateHandle) - { - Trace.log(Trace.ERROR, "Parameter 'certificateHandle' is null."); - throw new NullPointerException("certificateHandle"); - } - - if (isConnected() == false) - connect(); - - //makes either remote or local call - rc = usrprfImpl_.calldeleteCertificate( - certificateHandle, certificateHandle.length, - objectName_, - 2); - - if (rc != SUCCESS) - { - throwException(usrprfImpl_.cpfError_, ifsPathName_, rc); - } - - fireDelete(); - } - - - /** - * Returns the user profile name which contains the certificate. Throws ExtendedIOException if the certificate is not registered to any user profile on the system. - * - * @param certificate The ASN.1 X.509 encoded certificate to search for in the user profile. - * - * @return The user profile name containing the certificate. - * - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If invalid certificate. - * @exception ExtendedIOException If certificate not found and other IBM i certificate access errors. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - public String findCertificateUser(byte[] certificate) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException - - { - - int rc; - - if (null == certificate) - { - Trace.log(Trace.ERROR, "Parameter 'certificate' is null."); - throw new NullPointerException("certificate"); - } - - if (isConnected() == false) - connect(); - - //makes either remote or local call - rc = usrprfImpl_.callfindCertificateUser( - certificate, - certificate.length, - 1); - - if (rc != SUCCESS) - { - throwException(usrprfImpl_.cpfError_, ifsPathName_, rc); - } - - return ((null == usrprfImpl_.userName_) ? null : usrprfImpl_.userName_.trim()); - - } - - - - - /** - * Returns the user profile which contains the certificate with the specified handle. Throws ExtendedIOException if the certificate is not registered to any user profile on the system. - * - * @param certificateHandle The AS400Certificate handle the certificate should match. - * - * @return The user profile name containing the certificate. - * - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If invalid certificate handle. - * @exception ExtendedIOException If certificate not found and other IBM i certificate access errors. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - public String findCertificateUserByHandle(byte[] certificateHandle) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException - - { - int rc; - - if (null == certificateHandle) - { - Trace.log(Trace.ERROR, "Parameter 'certificateHandle' is null."); - throw new NullPointerException("certificateHandle"); - } - - if (isConnected() == false) - connect(); - - //makes either remote or local call - rc = usrprfImpl_.callfindCertificateUser( - certificateHandle, - certificateHandle.length, - 2); - - if (rc != SUCCESS) - { - throwException(usrprfImpl_.cpfError_, ifsPathName_, rc); - } - - return ((null == usrprfImpl_.userName_) ? null : usrprfImpl_.userName_.trim()); - } - - - - /** - * List certificates which match the specified attributes. The certificates are copied from the user profile to the specified user space. - * The user profile is not locked during the listCertificates operation. Certificates are stored into the user space with CERT0100 format. See the IBM i QsyListVldlCertificates (QSYLSTVC) and QsyListUserCertificates (QSYLSTUC) API's for further information. - * - * @param certificateAttributes The list of attributes the certificate should match. - * A value of null places all certificates from user profile into the user space. - * An empty String or empty byte array search attribute will search for certificates that do not have this attribute. - * For example, SUBJECT_ORGANIZATION = new String("") will search for certificates without the subject organization field. - * Null search attributes are ignored. - * @param userSpaceName The fully qualified integrated file system path name of the user space to put the list results, for example, /QSYS.LIB/MYLIB.LIB/MYUSRSPC.USRSPC. The 10 character IBM i library of the user space may also be specified as %CURLIB% or %LIBL%. - * See {@link com.ibm.as400.access.QSYSObjectPathName QSYSObjectPathName} - * - * @return The number of certificates found matching the search attributes. - * - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If invalid search attributes or input parameter. - * @exception ExtendedIOException If IBM i certificate access error. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - - public int listCertificates( - AS400CertificateAttribute[] certificateAttributes, - String userSpaceName) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException - -{ - int rc; - - String as400usrSpaceName; - - if (isConnected() == false) - connect(); - - //orders and saves the user's search attrs - boolean[] parmsEntered = setSearchAttributes(certificateAttributes); - - // get usrSpaceName in IBM i format. check for nonnull values. - as400usrSpaceName = getAS400UserSpaceName(userSpaceName); - - //makes either remote or local call - rc = usrprfImpl_.calllistCertificates( - objectName_, - as400usrSpaceName, - parmsEntered, - as400AttrS_, - as400AttrB_); - - if (rc != SUCCESS) - { - throwException(usrprfImpl_.cpfError_, ifsPathName_, rc); - } - - return usrprfImpl_.numberCertificatesFound_; -} - - /** - Sets the path for the user profile. - - @param path The fully qualified integrated file system path name of the user profile. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setPath(String path) - throws PropertyVetoException - { - - String libName; - String objectName; - String objectType; - - // check parm - if (path == null) - { - Trace.log(Trace.ERROR, "Parameter 'path' is null."); - throw new NullPointerException("path"); - } - - QSYSObjectPathName ifs = new QSYSObjectPathName(path); - libName = ifs.getLibraryName(); - objectName = ifs.getObjectName(); - objectType = ifs.getObjectType(); - - if (null == libName || null == objectName || - objectName.length() > 10 || - !(objectType.equalsIgnoreCase("USRPRF")) ) - { - throw new ExtendedIllegalArgumentException("path", ExtendedIllegalArgumentException.PATH_NOT_VALID); - } - - //make a 10 char user profile name - objectName = objectName + " "; - objectName = objectName.substring(0, 10); - objectName = objectName.toUpperCase(); - - // Set path the first time. - if (ifsPathName_ == null) - { - ifsPathName_ = path; - libName_ = libName; - objectName_ = objectName; - objectType_ = objectType; - } - else - { - // If system property is set, make sure we have not already connected. - if (system_ != null) - { - if (isConnected() ) - { - Trace.log(Trace.ERROR, "Parameter 'path' is not changed (Connected=true)."); - throw new ExtendedIllegalStateException("path", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - } - - // Remember the current path value. - String oldPath = ifsPathName_; - - // Fire a vetoable change event for the path. - vetos_.fireVetoableChange("path", oldPath, path); - - // Update the path value. - ifsPathName_ = path; - libName_ = libName; - objectName_ = objectName; - objectType_ = objectType; - - // Fire the property change event. - changes_.firePropertyChange("path", oldPath, path); - } - - } - - -} // End of AS400CertificateUserProfileUtil class - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateUserProfileUtilBeanInfo.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateUserProfileUtilBeanInfo.java deleted file mode 100644 index 3dc15b69c..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateUserProfileUtilBeanInfo.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateUserProfileUtilBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; - - -/** -The AS400CertificateUserProfileUtilBeanInfo class provides -bean information for the AS400CertificateUserProfileUtil class. -**/ -public class AS400CertificateUserProfileUtilBeanInfo extends AS400CertificateUtilBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class usrprfBeanClass = AS400CertificateUserProfileUtil.class; - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(usrprfBeanClass); - } - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateUsrPrfUtilImpl.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateUsrPrfUtilImpl.java deleted file mode 100644 index 10ff3c9d3..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateUsrPrfUtilImpl.java +++ /dev/null @@ -1,95 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateUsrPrfUtilImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.beans.PropertyVetoException; - - -/** -

    The AS400CertificateUsrPrfUtilImpl provides the base class for the implementation of the methods for accessing certificates in an IBM i user profile object. -**/ -abstract class AS400CertificateUsrPrfUtilImpl implements AS400CertificateUtilImplConstants -{ - Converter converter_; // The string to IBM i data converter. @C0C @C1C - AS400 system_ = null; - - // Output parms for native methods - String cpfError_ = null; - int numberCertificatesFound_; - String userName_ = null; - - - //********************************************************************/ - //* methods for either direct ot remote invocation */ - //* */ - //* @return Return code mapped to CPFxxxx error message. */ - //********************************************************************/ - - abstract int calladdCertificate(byte[] cert, int certlen, - String user) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException; - - - - abstract int calldeleteCertificate(byte[] cert, int certlen, - String user, - int certType) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException; - - - - abstract int calllistCertificates(String user, - String usrSpaceName, - boolean[] parmEntered, - String[] attrS, - byte[] [] attrB) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException; - - - - abstract int callfindCertificateUser(byte[] cert, - int certlen, - int certType) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException; - - - void setConverter(Converter converter) - { - this.converter_ = converter; // @C1A - } - - -} // End of AS400CertificateUsrPrfUtilImpl class - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateUsrPrfUtilImplNative.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateUsrPrfUtilImplNative.java deleted file mode 100644 index 387daa9bd..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateUsrPrfUtilImplNative.java +++ /dev/null @@ -1,69 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateUsrPrfUtilImplNative.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -

    The AS400CertificateUsrPrfUtilImplNative provides the implementation of the native methods for accessing certificates in an IBM i user profile object. -**/ -class AS400CertificateUsrPrfUtilImplNative extends AS400CertificateUsrPrfUtilImpl -{ - private static final String CLASSNAME = "com.ibm.as400.access.AS400CertificateUsrPrfUtilImplNative"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - // load the service program. - static - { - NativeMethods.loadNativeLibraryQyjspart(); - } - - - - //********************************************************************/ - //* native methods for direct local invocation */ - //* */ - //* @return Return code mapped to CPFxxxx error message. */ - //********************************************************************/ - - native int calladdCertificate(byte[] cert, int certlen, - String user); - - - native int calldeleteCertificate(byte[] cert, int certlen, - String user, - int certType); - - - native int calllistCertificates(String user, - String usrSpaceName, - boolean[] parmEntered, - String[] attrS, - byte[] [] attrB); - - - native int callfindCertificateUser(byte[] cert, - int certlen, - int certType); - - -} // End of AS400CertificateUsrPrfUtilImplNative class - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateUsrPrfUtilImplRemote.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateUsrPrfUtilImplRemote.java deleted file mode 100644 index 7e0853046..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateUsrPrfUtilImplRemote.java +++ /dev/null @@ -1,470 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateUsrPrfUtilImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InterruptedIOException; -import java.io.IOException; -import java.beans.PropertyVetoException; -import java.net.UnknownHostException; -import java.io.UnsupportedEncodingException; - - -/** - Provides the implementation of the remote methods for accessing certificates in an IBM i user profile object. - **/ -class AS400CertificateUsrPrfUtilImplRemote extends AS400CertificateUsrPrfUtilImpl -{ - - //********************************************************************/ - //* methods for remote invocation */ - //* */ - //* @return Return code mapped to CPFxxxx error message. */ - //********************************************************************/ - - int calladdCertificate(byte[] cert, int certlen, - String userName) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - - int rc; - - // **** Setup the parameter list **** - ProgramParameter[] parmlist = new ProgramParameter[6]; - - // First parameter: input, is the pgm entry - byte[] pgmEntry = new byte[4]; - BinaryConverter.intToByteArray(CALL_USRPRF_ADD, pgmEntry, 0); - parmlist[0] = new ProgramParameter(pgmEntry); - - // 2 parameter: input, is the certificate array - parmlist[1] = new ProgramParameter(cert); - - // 3 parameter: input, is the length of the cert array - byte[] certlenB = new byte[4]; - BinaryConverter.intToByteArray(certlen, certlenB, 0); - parmlist[2] = new ProgramParameter(certlenB); - - // 4 parameter: input, is user name - byte[] usrprfPathB = new byte[10]; - converter_.stringToByteArray(userName, usrprfPathB); - parmlist[3] = new ProgramParameter(usrprfPathB); - - // 5 parameter: output, is the cpf error id array - parmlist[4] = new ProgramParameter( 7 ); - - // 6 parameter: input/output, is the return code - byte[] retcodeB = new byte[4]; - BinaryConverter.intToByteArray(-1, retcodeB, 0); - parmlist[5] = new ProgramParameter(retcodeB, 4 ); - - ProgramCall pgmCall = new ProgramCall(system_); - try { - pgmCall.setProgram("/QSYS.LIB/QYJSPCTU.PGM", parmlist ); - } - // PropertyVetoException should never happen - catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - pgmCall.suggestThreadsafe(); //@A1A - - // Run the program. Failure returns message list - if(pgmCall.run() != true) - { - AS400Message[] messagelist = pgmCall.getMessageList(); - cpfError_ = messagelist[0].toString(); - return -1; - } - - else - { - // get the retcode returned from the program - retcodeB = parmlist[5].getOutputData(); - rc = BinaryConverter.byteArrayToInt(retcodeB, 0); - - if (0 != rc) - { - //unexpected error - if (-1 == rc) return rc; - //get cpf error id - byte[] errorInfoB = parmlist[4].getOutputData(); - cpfError_ = converter_.byteArrayToString(errorInfoB, 0).trim(); - return rc; - } - } - - return SUCCESS; - } - - - - - int calldeleteCertificate(byte[] cert, int certlen, - String userName, - int certType) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - - - int rc; - - // **** Setup the parameter list **** - ProgramParameter[] parmlist = new ProgramParameter[7]; - - // First parameter: input, is the pgm entry - byte[] pgmEntry = new byte[4]; - BinaryConverter.intToByteArray(CALL_USRPRF_DELETE, pgmEntry, 0); - parmlist[0] = new ProgramParameter(pgmEntry); - - // 2 parameter: input, is the certificate array - parmlist[1] = new ProgramParameter(cert); - - // 3 parameter: input, is the length of the cert array - byte[] certlenB = new byte[4]; - BinaryConverter.intToByteArray(certlen, certlenB, 0); - parmlist[2] = new ProgramParameter(certlenB); - - // 4 parameter: input, is user profile - byte[] usrprfPathB = new byte[10]; - converter_.stringToByteArray(userName, usrprfPathB); - parmlist[3] = new ProgramParameter(usrprfPathB); - - // 5 parameter: input, is certificate type - byte[] certTypeB = new byte[4]; - BinaryConverter.intToByteArray(certType, certTypeB, 0); - parmlist[4] = new ProgramParameter(certTypeB); - - // 6 parameter: output, is the cpf error id array - parmlist[5] = new ProgramParameter( 7 ); - - // 7 parameter: input/output, is the return code - byte[] retcodeB = new byte[4]; - BinaryConverter.intToByteArray(-1, retcodeB, 0); - parmlist[6] = new ProgramParameter(retcodeB, 4 ); - - ProgramCall pgmCall = new ProgramCall(system_); - try { - pgmCall.setProgram("/QSYS.LIB/QYJSPCTU.PGM", parmlist ); - } - // PropertyVetoException should never happen - catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - pgmCall.suggestThreadsafe(); //@A1A - - // Run the program. Failure returns message list - if(pgmCall.run() != true) - { - AS400Message[] messagelist = pgmCall.getMessageList(); - cpfError_ = messagelist[0].toString(); - return -1; - } - - else - { - // get the retcode returned from the program - retcodeB = parmlist[6].getOutputData(); - rc = BinaryConverter.byteArrayToInt(retcodeB, 0); - - if (0 != rc) - { - //unexpected error - if (-1 == rc) return rc; - //get cpf error id - byte[] errorInfoB = parmlist[5].getOutputData(); - cpfError_ = converter_.byteArrayToString(errorInfoB, 0).trim(); - return rc; - } - } - - return SUCCESS; - } - - - - int calllistCertificates(String userName, - String usrSpaceName, - boolean[] parmEntered, - String[] attrS, - byte[] [] attrB) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - - int rc; - int i, j; - int length; - - // **** Setup the parameter list **** - ProgramParameter[] parmlist = new ProgramParameter[9]; - - // First parameter: input, is the pgm entry number - byte[] pgmEntry = new byte[4]; - BinaryConverter.intToByteArray(CALL_USRPRF_LISTCERT, pgmEntry, 0); - parmlist[0] = new ProgramParameter(pgmEntry); - - // 2 parameter: input, is user profile - byte[] usrprfPathB = new byte[10]; - converter_.stringToByteArray(userName, usrprfPathB); - parmlist[1] = new ProgramParameter(usrprfPathB); - - // 3 parameter: input, is user space native name - byte[] usrSpaceNameB = new byte[20]; - converter_.stringToByteArray(usrSpaceName, usrSpaceNameB); - parmlist[2] = new ProgramParameter(usrSpaceNameB); - - // 4 parameter: input, is parm entered array - byte[] parmPresent = new byte[SEARCH_PARMS * 4]; - for (i = 0; i < SEARCH_PARMS; ++i) - { - if (parmEntered[i]) - BinaryConverter.intToByteArray(1, parmPresent, i * 4); - else - BinaryConverter.intToByteArray(0, parmPresent, i * 4); - } - parmlist[3] = new ProgramParameter(parmPresent); - - - // 5, 6 parameter: input, parm sizes and search attrs array - length = 0; - int [] parmsize = new int[SEARCH_PARMS]; - //get length estimate and byte[] parm sizes - for (i = 0; i < attrS.length; ++i) - { - if (attrS[i] != null) - length = length + attrS[i].length(); - } - - for (j = 0; j < attrB.length; ++j) - { - if (attrB[j] != null) - { - length = length + attrB[j].length; - parmsize[i] = attrB[j].length; - } - ++i; - } - - //allow extra room for mixed ccsids and convert the strings, - //cannot assume target ccsid is 1 byte per char - byte[] attrbytes = new byte[length * 2]; - byte[][] attrSbytes = new byte[attrS.length] []; - for (i = 0; i < attrS.length; ++i) - { - if (attrS[i] != null) - { - if (0 != attrS[i].length()) - { - attrSbytes[i] = converter_.stringToByteArray(attrS[i]); - parmsize[i] = attrSbytes[i].length; - } - } - } - - //put/pack the converted string and byte arrays together - length = 0; - byte[] parmsizeBytes = new byte[SEARCH_PARMS * 4]; - //pack string search data first - for (i = 0; i < attrS.length; ++i) - { - if (null != attrSbytes[i]) - { - System.arraycopy(attrSbytes[i], 0, - attrbytes, length, - attrSbytes[i].length); - - length = length + attrSbytes[i].length; - } - BinaryConverter.intToByteArray(parmsize[i], - parmsizeBytes, - i * 4); - } - //pack byte[] search data last - for (i = 0; i < attrB.length; ++i) - { - if (null != attrB[i]) - { - System.arraycopy(attrB[i], 0, - attrbytes, length, - attrB[i].length); - - length = length + attrB[i].length; - } - BinaryConverter.intToByteArray(parmsize[SEARCH_PARMS - 1 + i], - parmsizeBytes, - (SEARCH_PARMS - 1 + i) * 4); - } - - parmlist[4] = new ProgramParameter(parmsizeBytes); - parmlist[5] = new ProgramParameter(attrbytes); - - // 7 parameter: output, is the number certs found - parmlist[6] = new ProgramParameter(4); - - - // 8 parameter: output, is the cpf error id array - parmlist[7] = new ProgramParameter( ERR_STRING_LEN ); - - // 9 parameter: input/output, is the return code - byte[] retcodeB = new byte[4]; - BinaryConverter.intToByteArray(-1, retcodeB, 0); - parmlist[8] = new ProgramParameter(retcodeB, 4 ); - - ProgramCall pgmCall = new ProgramCall(system_); - try { - pgmCall.setProgram("/QSYS.LIB/QYJSPCTU.PGM", parmlist ); - } - // PropertyVetoException should never happen - catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - pgmCall.suggestThreadsafe(); //@A1A - - // Run the program. Failure returns message list - if(pgmCall.run() != true) - { - numberCertificatesFound_ = 0; - AS400Message[] messagelist = pgmCall.getMessageList(); - cpfError_ = messagelist[0].toString(); - return -1; - - } - - else - { - // get the retcode returned from the program - retcodeB = parmlist[8].getOutputData(); - rc = BinaryConverter.byteArrayToInt(retcodeB, 0); - - if (0 != rc) - { - numberCertificatesFound_ = 0; - //unexpected error - if (-1 == rc) return rc; - //get cpf error id - byte[] errorInfoB = parmlist[7].getOutputData(); - cpfError_ = converter_.byteArrayToString(errorInfoB, 0).trim(); - return rc; - } - - //return output parms, 1st get number of certs found - byte[] numberCertificatesFoundB = parmlist[6].getOutputData(); - numberCertificatesFound_ = - BinaryConverter.byteArrayToInt(numberCertificatesFoundB, 0); - - }//end else (pgmCall ran) - - return rc; - } - - - - - int callfindCertificateUser(byte[] cert, - int certlen, - int certType) - - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - - int rc; - - // **** Setup the parameter list **** - ProgramParameter[] parmlist = new ProgramParameter[7]; - - // First parameter: input, is the pgm entry - byte[] pgmEntry = new byte[4]; - BinaryConverter.intToByteArray(CALL_USRPRF_FINDCERT, pgmEntry, 0); - parmlist[0] = new ProgramParameter(pgmEntry); - - // 2 parameter: input, is the certificate array - parmlist[1] = new ProgramParameter(cert); - - // 3 parameter: input, is the length of the cert array - byte[] certlenB = new byte[4]; - BinaryConverter.intToByteArray(certlen, certlenB, 0); - parmlist[2] = new ProgramParameter(certlenB); - - // 4 parameter: output, is user profile - parmlist[3] = new ProgramParameter(10); - - // 5 parameter: input, is certificate type - byte[] certTypeB = new byte[4]; - BinaryConverter.intToByteArray(certType, certTypeB, 0); - parmlist[4] = new ProgramParameter(certTypeB); - - // 6 parameter: output, is the cpf error id array - parmlist[5] = new ProgramParameter( 7 ); - - // 7 parameter: input/output, is the return code - byte[] retcodeB = new byte[4]; - BinaryConverter.intToByteArray(-1, retcodeB, 0); - parmlist[6] = new ProgramParameter(retcodeB, 4 ); - - ProgramCall pgmCall = new ProgramCall(system_); - try { - pgmCall.setProgram("/QSYS.LIB/QYJSPCTU.PGM", parmlist ); - } - // PropertyVetoException should never happen - catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - pgmCall.suggestThreadsafe(); //@A1A - - // Run the program. Failure returns message list - if(pgmCall.run() != true) - { - AS400Message[] messagelist = pgmCall.getMessageList(); - cpfError_ = messagelist[0].toString(); - return -1; - } - - else - { - // get the retcode returned from the program - retcodeB = parmlist[6].getOutputData(); - rc = BinaryConverter.byteArrayToInt(retcodeB, 0); - - if (0 != rc) - { - //unexpected error - if (-1 == rc) return rc; - //get cpf error id - byte[] errorInfoB = parmlist[5].getOutputData(); - cpfError_ = converter_.byteArrayToString(errorInfoB, 0).trim(); - return rc; - } - - //return output parm, 10 char user name - byte[] usrprfPathB = parmlist[3].getOutputData(); - userName_ = converter_.byteArrayToString(usrprfPathB, 0); - - } - - return SUCCESS; - - } - -} // End of AS400CertificateVldlUtilImplRemote class - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateUtil.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateUtil.java deleted file mode 100644 index 2565f10e7..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateUtil.java +++ /dev/null @@ -1,1269 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateUtil.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.Beans; -import java.util.EventListener; -import java.io.InterruptedIOException; -import java.io.IOException; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.net.UnknownHostException; -import java.util.Vector; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; - - -/** - * Provides the methods common to AS400CertificateVldlUtil and AS400CertificateUserProfileUtil. - * The following example demonstrates the use of AS400CertificateUtil, AS400CertificateVldlUtil, and AS400CertificateUserProfileUtil. It copies an arbitrary number of X.509 certificates from an IBM i user profile to an IBM i validation list (vldl) object. The user profile certificates are first placed into a user space and then added to the validation list:
    - *

    -      // Get certificates from the local system
    -    AS400 as400 = new AS400();
    -
    - // Local variables - AS400Certificate as400certificate; - AS400Certificate[] certs; -
    - Vector certVector = new Vector(); - byte[] handle; - int numberCerts; - String userName; -
    -
    - try - { -
    - AS400CertificateUserProfileUtil usrprf = - new AS400CertificateUserProfileUtil(as400, "/QSYS.LIB/MYNAME.USRPRF"); -
    - AS400CertificateVldlUtil vldl = - new AS400CertificateVldlUtil(as400, "/QSYS.LIB/MYLIB.LIB/TEST.VLDL"); -
    - AS400CertificateAttribute[] certAttribute = new AS400CertificateAttribute[2]; -
    -
    - // Copy certificates that belong to both "US" and "myname". - certAttribute[0] = - new AS400CertificateAttribute(AS400CertificateAttribute.SUBJECT_COUNTRY, "US"); -
    - certAttribute[1] = - new AS400CertificateAttribute(AS400CertificateAttribute.SUBJECT_COMMON_NAME, "myname"); -
    -
    - // Copy matching certificates from the user profile to user space, MYSPACE. - numberCerts = usrprf.listCertificates(certAttribute, "/QSYS.LIB/MYLIB.LIB/MYSPACE.USRSPC"); -
    - System.out.println("Number of certificates found => " + numberCerts); -
    -
    - // Start reading certificates from the user space into AS400Certificate[]. - // All complete certificates in the 8 Kbyte buffer will be returned. - certs = usrprf.getCertificates("/QSYS.LIB/MYLIB.LIB/MYSPACE.USRSPC", 0, 8); -
    - // Continue to read the entire user space using 8 Kbyte buffer - while (null != certs) - { - // Gather certificates in a vector - for (int i = 0; i < certs.length; ++i) - { - certVector.addElement(certs[i]); - } -
    - certs = usrprf.getNextCertificates(8); - } -
    -
    - // Add all the certificates to validation list object - for (int i = 0; i < certVector.size(); ++i) - { - as400certificate = (AS400Certificate)certVector.elementAt(i); - vldl.addCertificate(as400certificate.getEncoded()); - } -
    - // Delete first certificate added to vldl using its handle - as400certificate = (AS400Certificate)certVector.elementAt(0); - handle = usrprf.getCertificateHandle(as400certificate.getEncoded()); - vldl.deleteCertificateByHandle(handle); -
    - // Delete 2nd certificate added to vldl using entire ASN.1 certificate - as400certificate = (AS400Certificate)certVector.elementAt(1); - vldl.deleteCertificate(as400certificate.getEncoded()); -
    - // Display user profile name associated with the 1st certificate - userName = usrprf.findCertificateUserByHandle(handle); -
    - System.out.println("User profile name => " + userName); - } -
    - catch (Exception e) - { - System.out.println(e.toString()); - } - *
    - * - *@see AS400CertificateVldlUtil - *@see AS400CertificateUserProfileUtil - **/ - -abstract public class AS400CertificateUtil implements java.io.Serializable -{ - private static final String CLASSNAME = "com.ibm.as400.access.AS400CertificateUtil"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - static final long serialVersionUID = 4L; - - - - /** - * Recommended buffer size in kilobytes. Used when returning certificates found during a get certificate operation. - */ - public static final int DEFAULT_BUFFER_SIZE = 128; - - /** - * Maximum buffer size in kilobytes. Used when returning certificates found during a get certificate operation. - */ - public static final int MAX_BUFFER_SIZE = 16384; - - /** - * Minimum buffer size in kilobytes. Used when returning certificates found during a get certificate operation. - */ - public static final int MIN_BUFFER_SIZE = 8; - - - // Object's fully qualified IFS name - String ifsPathName_; - - // 10 char IBM i lib name - String libName_; - - // 10 char IBM i object name - String objectName_; - - // IFS object type. - String objectType_; - - // User space 20 char "object || lib" name - String usrSpaceName_; - - // The IBM i connection information - AS400 system_ = null; - - transient boolean connected_ = false; - - // Java beans support - transient PropertyChangeSupport changes_ = new PropertyChangeSupport(this); - transient Vector certListeners_ = new Vector(); - transient VetoableChangeSupport vetos_ = new VetoableChangeSupport(this); - - // String certificate attributes to search on - String[] as400AttrS_; - - // Byte[] certificate attributes to search on, eg, public key - byte[] [] as400AttrB_; - - // Next cert to return for getCertificates() - int nextCertificateToReturn_ = 0; - - // User space offset of next cert to return for getNextCertificates() - int nextCertificateOffset_ = -1; - - //total number of certificates in user space - int numberCertificatesFound_ = 0; - - //the base class implementation, either native or remote - transient AS400CertificateUtilImpl impl_ = null; - - //exceptions thrown by base and derived classes - final static int EXTENDED_IO_EXCP = 1; - final static int ILLEGAL_ARG_EXCP = 2; - final static int ACCESS_EXCP = 3; - final static int DOES_NOT_EXIST_EXCP = 4; - final static int INTERNAL_ERR_EXCP = 5; - final static int SUCCESS = 0; - - // Free form additional information about this IBM i Object. - private String info_; - - - - /** - * Constructs an AS400CertificateUtil object. - **/ - public AS400CertificateUtil() - { - } - - /** - * Constructs an AS400CertificateUtil object. - * - * @param system The system on which the certificate repository exists. - * @param path The fully qualified integrated file system path name of the validation list or user profile. For example, /QSYS.LIB/MYLIB.LIB/MYVLDL.VLDL or /QSYS.LIB/MYPROFILE.USRPRF. - */ - public AS400CertificateUtil(AS400 system, String path) - { - system_ = system; - if (null == system_) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - - ifsPathName_ = path; - QSYSObjectPathName ifs = new QSYSObjectPathName(path); - libName_ = ifs.getLibraryName(); - objectName_ = ifs.getObjectName(); - objectType_ = ifs.getObjectType(); - - if (null == libName_ || null == objectName_) - { - throw new ExtendedIllegalArgumentException("path", ExtendedIllegalArgumentException.PATH_NOT_VALID); - } - - } - - - - /** - * Adds the certificate to the repository. Throws an ExtendedIOException if the certificate is already a member of the repository. - * - * @param certificate The ASN.1 Certificate to be added to the repository. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If invalid certificate. - * @exception ExtendedIOException If certificate already added and other IBM i certificate access errors. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - abstract public void addCertificate(byte[] certificate) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIllegalArgumentException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException; - - - - /** - * Adds an AS400Certificate listener to receive AS400Certificate events. - * - * @see #removeAS400CertificateListener - * @param listener The object listener. - */ - public synchronized void addAS400CertificateListener(AS400CertificateListener listener) { - certListeners_.addElement(listener); - } - - - - /** - * Adds a property change listener. - * The specified property change listeners propertyChange method will - * be called each time the value of any bound property is changed. - * The property listener object is added to a list of property change listeners. - * It can be removed with the removePropertyChangeListener() method. - * - * @param l The property change listener. - * @see #removePropertyChangeListener - */ - public void addPropertyChangeListener(PropertyChangeListener l) { - changes_.addPropertyChangeListener(l); - } - - /** - * Adds the VetoableChangeListener. - * The specified VetoableChangeListeners vetoableChange method will - * be called each time the value of any constrained property is changed. - * - * @see #removeVetoableChangeListener - * @param l The VetoableChangeListener. - */ - public void addVetoableChangeListener(VetoableChangeListener l) { - vetos_.addVetoableChangeListener(l); - } - - - - - /** - * Deletes the certificate from the repository. Throws ExtendedIOException - * if the certificate is not present in the repository. - * - * @param certificate The ASN.1 Certificate to be deleted from the repository. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If invalid certificate. - * @exception ExtendedIOException If certificate not found and other IBM i certificate access errors. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - abstract public void deleteCertificate(byte[] certificate) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIllegalArgumentException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException; - - - - /** - * Deletes the certificate from the repository. Throws ExtendedIOException - * if the certificate is not present in the repository. - * - * @param certificatehandle The IBM i certificate handle of the certificate to be deleted from the repository. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If invalid certificate handle. - * @exception ExtendedIOException If certificate not found and other IBM i certificate access errors. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - abstract public void deleteCertificateByHandle(byte[] certificatehandle) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIllegalArgumentException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException; - - - /** - * Retrieves the certificate placed in a user space by listCertificates. The certificates are not deleted from the user space. - * Returns certificates starting from firstCertificateToReturn(), inclusive. - * The first certificate in the user space is at location 0. - * - * @param userSpaceName The fully qualified integrated file system path name of the user space to get the certificates, for example, /QSYS.LIB/MYLIB.LIB/MYUSRSPC.USRSPC. The ten character AS4/00 library of the user space may also be specified as %CURLIB% or %LIBL%. - * See {@link com.ibm.as400.access.QSYSObjectPathName QSYSObjectPathName} - * @param firstCertificateToReturn The first certificate in the user space to return. The first certificate in the user space is at location 0. - * @param buffSize The number of kilobytes allocated for the returned certificates. Increasing this value for remote invocations will require more client memory and longer transmission times. The recommended default buffer size is 128 kilobytes. The minimum buffer size allowed is 8 kilobytes. - * - * @return An array of AS400Certificates which fit in a buffer of size bufferSize. - * - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If buffer size out of range or too small for one certificate, firstCertificateToReturn set to more than the total number of certificates in user space, and other invalid input parameters. - * @exception ExtendedIOException If no certificate returned, user space certificates not stored in format "CERT0100", and other IBM i certificate access errors. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - public AS400Certificate [] getCertificates( - String userSpaceName, - int firstCertificateToReturn, - int buffSize) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIllegalArgumentException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException - - { - - int rc; - - - if (isConnected() == false) - connect(); - - // set usrSpaceName_ instance var. check for nonnull values. - setAS400UserSpaceName(userSpaceName); - - if (firstCertificateToReturn < 0) - throw new ExtendedIllegalArgumentException("firstCertificateToReturn (" + firstCertificateToReturn + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - - if (buffSize < MIN_BUFFER_SIZE || buffSize > MAX_BUFFER_SIZE) - throw new ExtendedIllegalArgumentException("buffSize (" + buffSize + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - buffSize = buffSize * 1024; - - //makes either remote or local call - rc = impl_.callgetCertificates(usrSpaceName_, - buffSize, - firstCertificateToReturn, - -1); - - if (rc != SUCCESS) - { - throwException(impl_.cpfError_, ifsPathName_, rc); - } - - //nothing returned - if (impl_.certificates_ == null) - throw new ExtendedIOException("userSpaceName (" + userSpaceName + ")", ExtendedIOException.CERTIFICATE_NOT_FOUND); - - //update counters - nextCertificateToReturn_ = impl_.certificates_.length + firstCertificateToReturn; - numberCertificatesFound_ = impl_.numberCertificatesFound_; - nextCertificateOffset_ = impl_.nextCertificateOffsetOut_; - - - if (nextCertificateToReturn_ >= numberCertificatesFound_) - { - //finished - nextCertificateToReturn_ = -1; - } - - return impl_.certificates_; - -} - - - - /** - * Returns the IBM i certificate handle which uniquely identifies this certificate. - * - * @return The IBM i certificate handle. - * - * @param certificate The ASN.1 Certificate used to generate the handle. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIOException If invalid certificate and other IBM i certificate access errors. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - public byte[] getCertificateHandle(byte[] certificate) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException - - { - int rc; - int exception; - int msgNumber; - - if (null == certificate) - { - Trace.log(Trace.ERROR, "Parameter 'certificate' is null."); - throw new NullPointerException("certificate"); - } - - if (isConnected() == false) - connect(); - - //makes either remote or local call - rc = impl_.callgetHandle(certificate, - certificate.length); - - if (rc != SUCCESS) - { - //determine which exception to throw. - //allows 1000 msgs for each exception type. - exception = rc / 1000; - msgNumber = rc % 1000; - - if (null == impl_.cpfError_ || 0 == impl_.cpfError_.length()) - { - impl_.cpfError_ = ifsPathName_; - } - else - impl_.cpfError_ = impl_.cpfError_.trim()+ ": " + ifsPathName_; - - switch(exception) - { - case EXTENDED_IO_EXCP: - throw new ExtendedIOException(impl_.cpfError_, msgNumber); - - case ILLEGAL_ARG_EXCP: - - default: - throw new ExtendedIOException(impl_.cpfError_, ExtendedIOException.INVALID_CERTIFICATE); - - } // End of switch - } - - return impl_.handle_; - } - - - - - /** - * Retrieves certificates placed in the user space by listCertificates starting at the first certificate in the user space. - * - * @param userSpaceName The fully qualified integrated file system path name of the user space to get the certificates, for example, /QSYS.LIB/MYLIB.LIB/MYUSRSPC.USRSPC. The ten character library of the user space may also be specified as %CURLIB% or %LIBL%. - * See {@link com.ibm.as400.access.QSYSObjectPathName QSYSObjectPathName} - * @param buffSize The number of kilobytes allocated for the returned certificates. - * Increasing this value for remote invocations will require more client memory and longer transmission times. The recommended default buffer size is 128 kilobytes. The minimum buffer size allowed is 8 kilobytes. - * - * @return An array of AS400Certificates which fit in a buffer of size bufferSize. - * - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If buffer size out of range or too small for one certificate and other invalid input parameters. - * @exception ExtendedIOException If no certificate returned, user space certificates not stored in format "CERT0100", and other IBM i certificate access errors. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - public AS400Certificate [] getFirstCertificates(String userSpaceName, - int buffSize) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIllegalArgumentException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException - - { - - int rc; - - - if (isConnected() == false) - connect(); - - // set usrSpaceName_ instance var. check for nonnull values. - setAS400UserSpaceName(userSpaceName); - - if (buffSize < MIN_BUFFER_SIZE || buffSize > MAX_BUFFER_SIZE) - throw new ExtendedIllegalArgumentException("buffSize (" + buffSize + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - buffSize = buffSize * 1024; - - //makes either remote or local call - rc = impl_.callgetCertificates(usrSpaceName_, - buffSize, - 0, - -1); - if (rc != SUCCESS) - { - throwException(impl_.cpfError_, ifsPathName_, rc); - } - - //nothing returned - if (impl_.certificates_ == null) - throw new ExtendedIOException("userSpaceName (" + userSpaceName + ")", ExtendedIOException.CERTIFICATE_NOT_FOUND); - - //update counters from impl object - nextCertificateToReturn_ = impl_.certificates_.length; - numberCertificatesFound_ = impl_.numberCertificatesFound_; - nextCertificateOffset_ = impl_.nextCertificateOffsetOut_; - - //check for done - if (nextCertificateToReturn_ >= numberCertificatesFound_) - { - //finished - nextCertificateToReturn_ = -1; - } - - return impl_.certificates_; - -} - - - - - - - /** - *Returns the name of the IBM i certificate repository. - * - *@return The IBM i object name. If the name has not been set, an empty string is returned. - **/ - public String getName() - { - if (ifsPathName_==null) - return ""; - return objectName_; - } - - - - /** - * Retrieves the next certificates placed in a user space by listCertificates. - * getCertificates or getFirstCertificates must be invoked first to set the user space name - * and initial certificate to return or unpredicatable results will occur. - * Returns certificates starting from the last call to getNextCertificates. - * @see AS400CertificateUtil#listCertificates - * - * @param buffSize The number of kiloBytes allocated for the returned certificates. Increasing this value for remote invocations will require more client memory and longer transmission times. The minimum buffer size allowed is 8 kilobytes. - * - * @return An array of AS400Certificates which fit in a buffer of size bufferSize. - * Null is returned if all certificates have been successfully retrieved. - * - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If buffer size out of range or too small for one certificate. - * @exception ExtendedIOException If certificates are not in "CERT0100" format in the user space, user space and initial certificate to return are not set by calling getCertificates or getFirstCertificates, and other IBM i certificate access errors. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - public AS400Certificate [] getNextCertificates(int buffSize) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIllegalArgumentException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException - -{ - - int rc; - - if (isConnected() == false) - connect(); - - //get/getFirstCertificates() not done first - if (null == usrSpaceName_ || -1 == nextCertificateOffset_) - throw new ExtendedIOException(ExtendedIOException.INVALID_REQUEST); - - //already done - if (0 > nextCertificateToReturn_) - return null; - - if (buffSize < MIN_BUFFER_SIZE || buffSize > MAX_BUFFER_SIZE) - throw new ExtendedIllegalArgumentException("buffSize (" + buffSize + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - - buffSize = buffSize * 1024; - - //makes either remote or local call - rc = impl_.callgetCertificates(usrSpaceName_, - buffSize, - nextCertificateToReturn_, - nextCertificateOffset_); - - if (rc != SUCCESS) - { - throwException(impl_.cpfError_, ifsPathName_, rc); - } - - //nothing returned but more left - if (nextCertificateToReturn_ < numberCertificatesFound_) - { - if (impl_.certificates_ == null) - { - throw new ExtendedIOException("userSpaceName_ (" + usrSpaceName_ + ")", ExtendedIOException.CERTIFICATE_NOT_FOUND); - } - - //update next certificate to return - nextCertificateToReturn_ = nextCertificateToReturn_ + impl_.certificates_.length; - - //update next certificate offset to return - nextCertificateOffset_ = impl_.nextCertificateOffsetOut_; - } - - if (nextCertificateToReturn_ >= numberCertificatesFound_) - { - //finished - nextCertificateToReturn_ = -1; - } - - return impl_.certificates_; -} - - - - /** - * Returns free form object info. - * @return The free form string info. - */ - public String getObjectInfo() - { - return info_; - } - - - /** - *Returns the integrated file system path name of the IBM i certificate repository. - * - *@return The fully qualified IBM i object name. If the name as not been set, an empty string is returned. - **/ - public String getPath() - { - if (ifsPathName_==null) - return ""; - return ifsPathName_; - } - - - - /** - *Returns the system object. - * - *@return The system object. If the system has not been set, null is returned. - **/ - public AS400 getSystem() - { - return system_; - } - - - - /** - * Returns certificates which match the specified attributes in the specified existing user space. - * The underlying certificate repositories are not locked during the listCertificates operation. - * Certificates are stored into the user space with CERT0100 format. - * See the IBM i QsyListVldlCertificates (QSYLSTVC) and QsyListUserCertificates (QSYLSTUC) API's for further information. - * - * @param certificateAttributes The list of attributes the certificate must match. - * A value of null places all certificates from the repository into the user space. - * An empty String or empty byte array search attribute will search for certificates - * that do not have this attribute. For example, SUBJECT_ORGANIZATION = new String("") will - * search for certificates without the subject organization field. - * Null search attributes are ignored. - * - * @param userSpaceName The fully qualified integrated file system path name of the user space to put the list results, for example, /QSYS.LIB/MYLIB.LIB/MYUSRSPC.USRSPC. The ten character library of the user space may also be specified as %CURLIB% or %LIBL%. - * See {@link com.ibm.as400.access.QSYSObjectPathName QSYSObjectPathName} - * - * @return The number of certificates found. - * - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If invalid search attributes or input parameter. - * @exception ExtendedIOException If IBM i certificate access error. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - abstract public int listCertificates( - AS400CertificateAttribute[] certificateAttributes, - String userSpaceName) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIllegalArgumentException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException; - - - - /** - * Removes this listener. - * - * @param l The AS400CertificateListener. - * @see #addAS400CertificateListener - */ - public synchronized void removeAS400CertificateListener(AS400CertificateListener l) { - certListeners_.removeElement(l); - } - - - /** - * Removes this property change listener. - * - * @param l The property change listener. - * @see #addPropertyChangeListener - */ - public void removePropertyChangeListener(PropertyChangeListener l) { - changes_.removePropertyChangeListener(l); - } - - /** - * Removes this vetoable change listener. - * - * @see #addVetoableChangeListener - * @param l The VetoableChangeListener. - */ - public void removeVetoableChangeListener(VetoableChangeListener l) { - vetos_.removeVetoableChangeListener(l); - } - - - /** - * Set free form object information - * @param information The free form info. - */ - public void setObjectInfo(String information) - { - info_ = information; - } - - - - /** - Sets the path for the user space. - - @param path The fully qualified integrated file system path name. - @exception PropertyVetoException If the change is vetoed. - **/ - abstract public void setPath(String path) - throws PropertyVetoException; - - - /** - *Sets the system on which the certificate repository exists. - * - *@param system The system on which the repository exists. - *@exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem(AS400 system) - throws PropertyVetoException - { - // check parm - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - - // set system parameter for first time. - if (system_ == null) - system_ = system; - else - { - // Verify that connection has not been made. - if (isConnected()) - { - Trace.log(Trace.ERROR, "Parameter 'system' is not changed (Connected=true)."); - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - AS400 old = system_; - vetos_.fireVetoableChange("system", old, system ); - - // set instance var - system_ = system; - changes_.firePropertyChange("system", old, system ); - } - - } - - - /** - * Throws exception with error text based on input return code. - * - * @param cpfError The 7 char CPF error id. - * @param objectName More info about the object incurring the error. - * @param rc The non-zero return code. - * - * @exception Various exceptions are thrown based on the input return code. - */ - void throwException(String cpfError, String objectName, int rc) - throws AS400SecurityException, - ExtendedIllegalArgumentException, - ExtendedIOException, - ObjectDoesNotExistException, - InternalErrorException - { - //exception type - int exception; - //msg number - int msgNumber; - - //determine which exception to throw. - //allows 1000 msgs for each exception type. - exception = rc / 1000; - msgNumber = rc % 1000; - - - //msg format - - //"CPF227D:/MYLIB.LIB/MYVLDL.VLDL:Certificate was not found." - if ((null == cpfError) || (0 == cpfError.length())) - { - cpfError = objectName; - } - else - { - cpfError = cpfError.trim() + ": " + objectName; - } - - - switch(exception) - { - - case EXTENDED_IO_EXCP: - throw new ExtendedIOException(cpfError, msgNumber); - - case ILLEGAL_ARG_EXCP: - throw new ExtendedIllegalArgumentException(cpfError, msgNumber); - - case ACCESS_EXCP: - throw new AS400SecurityException(cpfError, msgNumber); - - case DOES_NOT_EXIST_EXCP: - throw new ObjectDoesNotExistException(cpfError, - msgNumber); - - case INTERNAL_ERR_EXCP: - throw new InternalErrorException(cpfError, msgNumber); - - default: - //Other unexpected errors - throw new ExtendedIOException(cpfError, ExtendedIOException.UNKNOWN_ERROR); - - } // End of switch - } - - - /** - * Sets instance variable, usrSpacename_, in IBM i format, "10 char user space name || 10 char user space lib name". Checks for non-null values. - * - * @param userSpaceName The ifs path name of the user space. - * - * @exception Various exceptions are thrown based on the input. - */ - void setAS400UserSpaceName(String userSpaceName) - { - - String uSpaceName; - String uSpaceLib; - - // check name - if (userSpaceName == null) - { - Trace.log(Trace.ERROR, "Parameter 'userSpaceName' is null."); - throw new NullPointerException("userSpaceName"); - } - - - QSYSObjectPathName ifs = new QSYSObjectPathName(userSpaceName, "USRSPC"); - - // set instance vars - uSpaceLib = ifs.getLibraryName(); - uSpaceName = ifs.getObjectName(); - - // get 20 char "object || lib" IBM i name - usrSpaceName_ = uSpaceName + " "; - usrSpaceName_ = usrSpaceName_.substring(0, 10) + uSpaceLib + - " "; - - // trim back to 20 chars - usrSpaceName_ = usrSpaceName_.substring(0, 20); - usrSpaceName_ = usrSpaceName_.toUpperCase(); - - } - - - - /** - * Returns user space name in IBM i format, "10 char user space name || 10 char user space lib name". Checks for non-null values. - * - * @param userSpaceName The ifs path name of the user space. - * @return The user space name in IBM i format. - * - * @exception Various exceptions are thrown based on the input. - */ - String getAS400UserSpaceName(String userSpaceName) - { - - String as400usrSpaceName; - String uSpaceName; - String uSpaceLib; - - // check name - if (userSpaceName == null) - { - Trace.log(Trace.ERROR, "Parameter 'userSpaceName' is null."); - throw new NullPointerException("userSpaceName"); - } - - QSYSObjectPathName ifs = new QSYSObjectPathName(userSpaceName, "USRSPC"); - - // set instance vars - uSpaceLib = ifs.getLibraryName(); - uSpaceName = ifs.getObjectName(); - - // get 20 char "object || lib" IBM i name - as400usrSpaceName = uSpaceName + " "; - as400usrSpaceName = as400usrSpaceName.substring(0, 10) + uSpaceLib + - " "; - - // trim back to 20 chars - as400usrSpaceName = as400usrSpaceName.substring(0, 20); - as400usrSpaceName = as400usrSpaceName.toUpperCase(); - - return as400usrSpaceName; - - } - - - /** - * Load the String and byte search attrs into separate, ordered arrays. - * Verify each attribute type is listed once. - * Empty search attr's can be passed in as new String() or new byte[0]. - * Null attributes are ignored. - */ - boolean[] setSearchAttributes(AS400CertificateAttribute[] attributes) - throws ExtendedIllegalArgumentException - { - boolean badAttr = false; - boolean dupAttr = false; - int i; - - boolean [] alreadyFound = new boolean[AS400CertificateAttribute.LAST_STRING_ATTR]; - - //string form search items, order dependent - as400AttrS_ = new String[6]; - //byte form search items, order dependent - as400AttrB_ = new byte[1] [0]; - - //null returns all certs from repository - if (null == attributes) - return alreadyFound; - - //************************************************************* - //Total up the attrs. If more then 7, the system does not - //support the search. Only allow supported attrs. - //************************************************************* - forloop: - for (i = 0; i < attributes.length; ++i) - { - //non-null search attr slot - if (null != attributes[i]) - { - - if (AS400CertificateAttribute.SUBJECT_COMMON_NAME == attributes[i].getAttributeType()) - { - if (false == alreadyFound[0]) - { - alreadyFound[0] = true; - } - else - { - dupAttr = true; - break forloop; - } - - //save the IBM i attr. as400Attrs array is order dependent. - as400AttrS_[0] = (String) attributes[i].getAttributeValue(); - } - - else - if (AS400CertificateAttribute.SUBJECT_ORGANIZATION_UNIT == attributes[i].getAttributeType()) - { - if (false == alreadyFound[1]) - { - alreadyFound[1] = true; - } - else - { - dupAttr = true; - break forloop; - } - - as400AttrS_[1] = (String) attributes[i].getAttributeValue(); - } - - else - if (AS400CertificateAttribute.SUBJECT_ORGANIZATION == attributes[i].getAttributeType()) - { - if (false == alreadyFound[2]) - { - alreadyFound[2] = true; - } - else - { - dupAttr = true; - break forloop; - } - - as400AttrS_[2] = (String) attributes[i].getAttributeValue(); - - } - - else - if (AS400CertificateAttribute.SUBJECT_LOCALITY == attributes[i].getAttributeType()) - { - if (false == alreadyFound[3]) - { - alreadyFound[3] = true; - } - else - { - dupAttr = true; - break forloop; - } - - as400AttrS_[3] = (String) attributes[i].getAttributeValue(); - - } - - else - if (AS400CertificateAttribute.SUBJECT_STATE == attributes[i].getAttributeType()) - { - if (false == alreadyFound[4]) - { - alreadyFound[4] = true; - } - else - { - dupAttr = true; - break forloop; - } - - as400AttrS_[4] = (String) attributes[i].getAttributeValue(); - } - - else - if (AS400CertificateAttribute.SUBJECT_COUNTRY == attributes[i].getAttributeType()) - { - if (false == alreadyFound[5]) - { - alreadyFound[5] = true; - } - else - { - dupAttr = true; - break forloop; - } - - as400AttrS_[5] = (String) attributes[i].getAttributeValue(); - - } - - else - if (AS400CertificateAttribute.PUBLIC_KEY_BYTES == attributes[i].getAttributeType()) - { - if (false == alreadyFound[6]) - { - alreadyFound[6] = true; - } - else - { - dupAttr = true; - break forloop; - } - - //save the IBM i attr. as400AttrB array is order dependent. - as400AttrB_[0] = (byte[]) attributes[i].getAttributeValue(); - } - - else - { - //unsupported attr found - badAttr = true; - break forloop; - } - }//end non-null search attr slot - - }//end for loop - - - if (dupAttr == true || badAttr == true) - { - throw new ExtendedIllegalArgumentException("AS400CertificateAttribute (" + Integer.toString(i) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - return alreadyFound; - } - - - /** - Connect() - - Determines the type of implementation that will be used. - System and Path parameters are committed at this time. - **/ - abstract void connect() throws IOException; - - - - /** - Indicates if a connection has been established. - **/ - boolean isConnected() - { - return connected_; - } - - - - /** - *Fire add certificate event - **/ - void fireAdd() { - Vector targets; - targets = (Vector) certListeners_.clone(); - AS400CertificateEvent event = new AS400CertificateEvent( this, AS400CertificateEvent.CERTIFICATE_ADDED); - for (int i = 0; i < targets.size(); i++) - { - AS400CertificateListener target = (AS400CertificateListener)targets.elementAt(i); - target.added(event); - } - } - - - /** - *Fires delete certificate event - **/ - void fireDelete() { - Vector targets; - targets = (Vector) certListeners_.clone(); - AS400CertificateEvent event = new AS400CertificateEvent( this, AS400CertificateEvent.CERTIFICATE_DELETED); - for (int i = 0; i < targets.size(); i++) - { - AS400CertificateListener target = (AS400CertificateListener)targets.elementAt(i); - target.deleted(event); - } - } - - - /** - *Overrides the ObjectInputStream.readObject() method in order to return any - *transient parts of the object to there properly initialized state. We also - *generate a declared file name for the object. I.e we in effect - *call the null constructor. By calling ObjectInputStream.defaultReadObject() - *we restore the state of any non-static and non-transient variables. We - *then continue on to restore the state (as necessary) of the remaining varaibles. - *@param in The input stream from which to deserialize the object. - *@exception ClassNotFoundException If the class being deserialized is not found. - *@exception IOException If an error occurs while communicating with the system. - **/ - private void readObject(java.io.ObjectInputStream in) - throws ClassNotFoundException, - IOException - { - in.defaultReadObject(); - - // Reset the connected flag. - connected_ = false; - - // Reset the listeners. - changes_ = new PropertyChangeSupport(this); - vetos_ = new VetoableChangeSupport(this); - certListeners_ = new Vector(); - - // Reset some flags. - nextCertificateToReturn_ = 0; - - // User space offset of next cert to return for getNextCertificates() - nextCertificateOffset_ = -1; - - //total number of certificates in user space - numberCertificatesFound_ = 0; - } - - - -} // End of AS400CertificateUtil class - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateUtil16.gif b/cvsroot/src/com/ibm/as400/access/AS400CertificateUtil16.gif deleted file mode 100644 index b81f6a4ec..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400CertificateUtil16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateUtil32.gif b/cvsroot/src/com/ibm/as400/access/AS400CertificateUtil32.gif deleted file mode 100644 index 65d6fe664..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400CertificateUtil32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateUtilBeanInfo.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateUtilBeanInfo.java deleted file mode 100644 index a85ece1f4..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateUtilBeanInfo.java +++ /dev/null @@ -1,185 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateUtilBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; - - -/** -The AS400CertificateUtilBeanInfo class provides -bean information for the AS400CertificateUtil class. -**/ -public class AS400CertificateUtilBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = AS400CertificateUtil.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - - private static EventSetDescriptor[] events_; - - static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - String[] certListeners = {"added", - "deleted"}; - EventSetDescriptor cert = new EventSetDescriptor(beanClass, - "as400Certificate", - com.ibm.as400.access.AS400CertificateListener.class, - certListeners, - "addAS400CertificateListener", - "removeAS400CertificateListener"); - cert.setDisplayName(loader_.getText("EVT_NAME_AS400CERTIFICATE_EVENT")); - cert.setShortDescription(loader_.getText("EVT_DESC_AS400CERTIFICATE_EVENT")); - - EventSetDescriptor[] events = {cert, changed, veto}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor path = new PropertyDescriptor("path", beanClass); - path.setBound(true); - path.setConstrained(true); - path.setDisplayName(loader_.getText("PROP_NAME_PATH")); - path.setShortDescription(loader_.getText("PROP_DESC_PATH")); - - PropertyDescriptor name = new PropertyDescriptor("name", beanClass, - "getName", null); - name.setBound(false); - name.setConstrained(false); - name.setDisplayName(loader_.getText("PROP_NAME_NAME")); - name.setShortDescription(loader_.getText("PROP_DESC_NAME")); - - PropertyDescriptor system = new PropertyDescriptor("system", beanClass); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(loader_.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(loader_.getText("PROP_DESC_SYSTEM")); - - properties_ = new PropertyDescriptor[]{path, name, system}; - - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the actionCompleted event - return 0; - } - - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the "path" property - return 0; - } - - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("AS400CertificateUtil16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("AS400CertificateUtil32.gif"); - break; - } - - return image; - } - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateUtilImpl.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateUtilImpl.java deleted file mode 100644 index 662969801..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateUtilImpl.java +++ /dev/null @@ -1,72 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateUtilImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - - -/** -

    The AS400CertificateUtilImpl provides the base class for the implementation of the methods for accessing certificates in an AS400CertificateUtil object. -**/ -abstract class AS400CertificateUtilImpl implements AS400CertificateUtilImplConstants -{ - Converter converter_; // The string to IBM i data converter. @C0C @C1C - AS400 system_ = null; - - // Output parms for native methods - int nextCertificateOffsetOut_; - int numberCertificatesFound_; - AS400Certificate[] certificates_; - String cpfError_; - byte[] handle_; - - - //********************************************************************/ - //* methods for either direct ot remote invocation */ - //* */ - //* @return Return code mapped to CPFxxxx error message. */ - //********************************************************************/ - - abstract int callgetCertificates(String usrSpaceName, - int buffSize, - int nextCertificateToReturn, - int nextCertificateOffsetIn) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException; - - - abstract int callgetHandle(byte[] certificate, - int len) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException; - - - void setConverter(Converter converter) - { - this.converter_ = converter; // @C1A - } - - -} // End of AS400CertificateUtilImpl class - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateUtilImplConstants.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateUtilImplConstants.java deleted file mode 100644 index 4d6d5e145..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateUtilImplConstants.java +++ /dev/null @@ -1,53 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateUtilImplConstants.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -

    The AS400CertificateUtilImplConstants provides a common location for implementation constants. -**/ -interface AS400CertificateUtilImplConstants -{ - - //number of digid search attrs - static final int SEARCH_PARMS = 7; - static final int HANDLE_LEN = 40; - - //cpfError string for additional msg text - static final int ERR_STRING_LEN = 100; - static final int SUCCESS = 0; - - - //AS400CertificateUtil remote methods - static final int CALL_GETCERT = 1; - static final int CALL_GETHANDLE = 2; - - //AS400CertificateVldlUtil remote methods - static final int CALL_VLDL_ADD = 101; - static final int CALL_VLDL_DELETE = 102; - static final int CALL_VLDL_LISTCERT = 103; - static final int CALL_VLDL_CHECKCERT = 104; - - //AS400CertificateUserProfileUtil remote methods - static final int CALL_USRPRF_ADD = 201; - static final int CALL_USRPRF_DELETE = 202; - static final int CALL_USRPRF_LISTCERT = 203; - static final int CALL_USRPRF_FINDCERT = 204; - -} // End of AS400CertificateUtilImplConstants - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateUtilImplNative.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateUtilImplNative.java deleted file mode 100644 index 43db99ee4..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateUtilImplNative.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateUtilImplNative.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -

    The AS400CertificateUtilImplNative provides the implementation of the native methods for accessing certificates from the AS400CertificateUtil object. -**/ -class AS400CertificateUtilImplNative extends AS400CertificateUtilImpl -{ - private static final String CLASSNAME = "com.ibm.as400.access.AS400CertificateUtilImplNative"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - // load the service program. - static - { - NativeMethods.loadNativeLibraryQyjspart(); - } - - - - - //********************************************************************/ - //* native methods for direct local invocation */ - //* */ - //* @return Return code mapped to CPFxxxx error message. */ - //********************************************************************/ - - native int callgetCertificates(String usrSpaceName, - int buffSize, - int nextCertificateToReturn, - int nextCertificateOffsetIn); - - - native int callgetHandle(byte[] certificate, - int len); - - -} // End of AS400CertificateUtilImplNative class - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateUtilImplRemote.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateUtilImplRemote.java deleted file mode 100644 index 5d355ba9a..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateUtilImplRemote.java +++ /dev/null @@ -1,285 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateUtilImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InterruptedIOException; -import java.io.IOException; -import java.beans.PropertyVetoException; -import java.net.UnknownHostException; -import java.io.UnsupportedEncodingException; - - - -/** - Provides the implementation of the remote methods for accessing certificates from an AS400CertificateUtil object. -**/ -class AS400CertificateUtilImplRemote extends AS400CertificateUtilImpl -{ - - //********************************************************************/ - //* methods for remote invocation */ - //* */ - //* @return Return code mapped to CPFxxxx error message. */ - //********************************************************************/ - - - int callgetCertificates(String usrSpaceName, - int buffSize, - int nextCertificateToReturn, - int nextCertificateOffsetIn) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - - int rc; - int i, j; - int length, certoffset; - - // **** Setup the parameter list **** - ProgramParameter[] parmlist = new ProgramParameter[11]; - - // First parameter: input, is the pgm entry number - byte[] pgmEntry = new byte[4]; - BinaryConverter.intToByteArray(CALL_GETCERT, pgmEntry, 0); - parmlist[0] = new ProgramParameter(pgmEntry); - - // 2 parameter: input, is user space native name - byte[] usrSpaceNameB = new byte[20]; - converter_.stringToByteArray(usrSpaceName, usrSpaceNameB); - parmlist[1] = new ProgramParameter(usrSpaceNameB); - - // 3 parameter: input, is the user's buff size - byte[] buffSizeB = new byte[4]; - BinaryConverter.intToByteArray(buffSize, buffSizeB, 0); - parmlist[2] = new ProgramParameter(buffSizeB); - - // 4 parameter: input, is the next certificate to return - byte[] nextCertificateToReturnB = new byte[4]; - BinaryConverter.intToByteArray(nextCertificateToReturn, - nextCertificateToReturnB, 0); - parmlist[3] = new ProgramParameter(nextCertificateToReturnB); - - // 5 parameter: input, is the cert offset - byte[] nextCertificateOffsetInB = new byte[4]; - BinaryConverter.intToByteArray(nextCertificateOffsetIn, - nextCertificateOffsetInB, 0); - parmlist[4] = new ProgramParameter(nextCertificateOffsetInB); - - // 6 parameter: output, is the next cert offset to return - parmlist[5] = new ProgramParameter(4); - - - // 7 parameter: output, is the number certs found - byte[] numberCertificatesFoundB = new byte[4]; - parmlist[6] = new ProgramParameter(4); - - // 8 parameter: output, is the number complete certs - byte[] numberCompleteCertsB = new byte[4]; - parmlist[7] = new ProgramParameter(4); - - // 9 parameter: output, is the certificate buffer - parmlist[8] = new ProgramParameter(buffSize); - - // 10 parameter: output, is the cpf error id array - byte[] errorInfoB = new byte[ ERR_STRING_LEN ]; - parmlist[9] = new ProgramParameter( ERR_STRING_LEN ); - - // 11 parameter: input/output, is the return code - byte[] retcodeB = new byte[4]; - BinaryConverter.intToByteArray(-1, retcodeB, 0); - parmlist[10] = new ProgramParameter(retcodeB, 4 ); - - - //program lib and name - ProgramCall pgmCall = new ProgramCall(system_); - try { - pgmCall.setProgram("/QSYS.LIB/QYJSPCTU.PGM", parmlist ); - } - // PropertyVetoException should never happen - catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - pgmCall.suggestThreadsafe(); //@A1A - - // Run the program. Failure returns message list - if(pgmCall.run() != true) - { - numberCertificatesFound_ = 0; - - AS400Message[] messagelist = pgmCall.getMessageList(); - cpfError_ = messagelist[0].toString(); - return -1; - } - - else - { - // get the retcode returned from the program - retcodeB = parmlist[10].getOutputData(); - rc = BinaryConverter.byteArrayToInt(retcodeB, 0); - - if (0 != rc) - { - numberCertificatesFound_ = 0; - //unexpected error - if (-1 == rc) return rc; - //get cpf error id - errorInfoB = parmlist[9].getOutputData(); - cpfError_ = converter_.byteArrayToString(errorInfoB, 0).trim(); - return rc; - } - - //return output parms, 1st get next certificate's offset - byte[] nextCertificateOffsetOutB = parmlist[5].getOutputData(); - nextCertificateOffsetOut_ = - BinaryConverter.byteArrayToInt(nextCertificateOffsetOutB, 0); - - //return output parms, get number of certs found - numberCertificatesFoundB = parmlist[6].getOutputData(); - numberCertificatesFound_ = - BinaryConverter.byteArrayToInt(numberCertificatesFoundB, 0); - - //get number of complete certs in user buffer - numberCompleteCertsB = parmlist[7].getOutputData(); - int numberCompleteCerts = - BinaryConverter.byteArrayToInt(numberCompleteCertsB, 0); - - //load returned certs into AS400Certificate array - if (0 < numberCompleteCerts) - { - certificates_ = new AS400Certificate[numberCompleteCerts]; - } - int returnedLen; - int certLen; - length = 0; - byte[] returnedBytes = parmlist[8].getOutputData(); - - //hdr format => cert returned length, cert offset, cert len - for (i = 0; i < numberCompleteCerts; ++i) - { - returnedLen = BinaryConverter.byteArrayToInt(returnedBytes, - length); - certoffset = BinaryConverter.byteArrayToInt(returnedBytes, - length + 4); - certLen = BinaryConverter.byteArrayToInt(returnedBytes, - length + 8); - byte[] certdata = new byte[certLen]; - - System.arraycopy(returnedBytes, certoffset, - certdata, 0, - certLen); - - certificates_[i] = new AS400Certificate(certdata); - - //calc offset to next cert header - length = length + returnedLen; - } - - }//end else (pgmCall ran OK) - - return SUCCESS; - } - - - - int callgetHandle(byte[] certificate, - int len) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - int rc; - int i, j; - int length; - - // **** Setup the parameter list **** - ProgramParameter[] parmlist = new ProgramParameter[6]; - - // First parameter: input, is the pgm entry number - byte[] pgmEntry = new byte[4]; - BinaryConverter.intToByteArray(CALL_GETHANDLE, pgmEntry, 0); - parmlist[0] = new ProgramParameter(pgmEntry); - - // 2 parameter: input, is the certificate array - parmlist[1] = new ProgramParameter(certificate); - - // 3 parameter: input, is the length of the cert array - byte[] lenB = new byte[4]; - BinaryConverter.intToByteArray(certificate.length, lenB, 0); - parmlist[2] = new ProgramParameter(lenB); - - // 4 parameter: out, is the certificate handle - parmlist[3] = new ProgramParameter(HANDLE_LEN); - - // 5 parameter: output, is the cpf error id array - parmlist[4] = new ProgramParameter( 7 ); - - // 6 parameter: input/output, is the return code - byte[] retcodeB = new byte[4]; - BinaryConverter.intToByteArray(-1, retcodeB, 0); - parmlist[5] = new ProgramParameter(retcodeB, 4 ); - - - //program lib and name - ProgramCall pgmCall = new ProgramCall(system_); - try { - pgmCall.setProgram("/QSYS.LIB/QYJSPCTU.PGM", parmlist ); - } - // PropertyVetoException should never happen - catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - pgmCall.suggestThreadsafe(); //@A1A - - // Run the program. Failure returns message list - if(pgmCall.run() != true) - { - AS400Message[] messagelist = pgmCall.getMessageList(); - cpfError_ = messagelist[0].toString(); - return -1; - } - - else - { - // get the retcode returned from the program - retcodeB = parmlist[5].getOutputData(); - rc = BinaryConverter.byteArrayToInt(retcodeB, 0); - - if (0 != rc) - { - //unexpected error - if (-1 == rc) return rc; - //get cpf error id - byte[] errorInfoB = parmlist[4].getOutputData(); - cpfError_ = converter_.byteArrayToString(errorInfoB, 0).trim(); - return rc; - } - - //return output parms, get cert handle - handle_ = parmlist[3].getOutputData(); - - }//end else (pgmCall ran) - - return SUCCESS; - - } - - - -} // End of AS400CertificateUtilImplRemote class - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateVldlUtil.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateVldlUtil.java deleted file mode 100644 index 77a5f671b..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateVldlUtil.java +++ /dev/null @@ -1,509 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateVldlUtil.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.Beans; -import java.beans.PropertyVetoException; -import java.util.EventListener; -import java.io.InterruptedIOException; -import java.io.IOException; -import java.net.UnknownHostException; -import java.util.Vector; - - -/** -

    The AS400CertificateVldlUtil class provides the implementation of the methods for accessing certificates in an IBM i validation list object. -**/ -public class AS400CertificateVldlUtil extends AS400CertificateUtil implements java.io.Serializable -{ - private static final String CLASSNAME = "com.ibm.as400.access.AS400CertificateVldlUtil"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - static final long serialVersionUID = 4L; - - - - /** - * The validation list class implementation, either native or remote. - **/ - transient AS400CertificateVldlUtilImpl vldlImpl_ = null; - - - /** - * Constructs an AS400CertificateVldlUtil object. - **/ - public AS400CertificateVldlUtil() - { - } - - /** - * Constructs an AS400CertificateVldlUtil object. - * - * @param system The system on which the validation list exists. - * @param path The fully qualified integrated file system path name of the validation list. For example, /QSYS.LIB/MYLIB.LIB/MYVLDL.VLDL. - */ - public AS400CertificateVldlUtil(AS400 system, String path) - { - super(system, path); - - if (!(objectType_.equalsIgnoreCase("VLDL")) || - objectName_.length() > 10) - { - throw new ExtendedIllegalArgumentException("path (" + path + ")", ExtendedIllegalArgumentException.PATH_NOT_VALID); - } - } - - - /** - Connect() - - Determines the type of implementation that will be used. - System and Path parameters are committed at this time. - **/ - void connect() throws IOException - { - - // Ensure that the system has been set. - if (system_ == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null at connect."); - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Ensure that the path has been set. - if (ifsPathName_ == null) - { - Trace.log(Trace.ERROR, "Parameter 'path' is null."); - throw new ExtendedIllegalStateException("ifsPathName", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Determine if we are running on the server or some remote system. - vldlImpl_ = (com.ibm.as400.access.AS400CertificateVldlUtilImpl) - system_.loadImpl( - "com.ibm.as400.access.AS400CertificateVldlUtilImplNative", - "com.ibm.as400.access.AS400CertificateVldlUtilImplRemote"); - - impl_ = (com.ibm.as400.access.AS400CertificateUtilImpl) - system_.loadImpl( - "com.ibm.as400.access.AS400CertificateUtilImplNative", - "com.ibm.as400.access.AS400CertificateUtilImplRemote"); - - //update vldl and base class impl references - vldlImpl_.system_ = system_; - impl_.system_ = system_; - - Converter conv = new Converter(system_.getCcsid(), system_); // @C1A - vldlImpl_.setConverter(conv); // @C0C @C1C - impl_.setConverter(conv); - - // Set the connection flag, commits system and path parameters. - connected_ = true; - - } - - - /** - * Add the certificate to the repository. Throws an ExtendedIOException if the certificate is already a member of the repository. - * - * @param certificate The complete ASN.1 X.509 certificate to be added to the validation list. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If invalid certificate. - * @exception ExtendedIOException If certificate already added and other IBM i certificate access errors. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - public void addCertificate(byte[] certificate) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException - - { - int rc; - - - if (null == certificate) - { - Trace.log(Trace.ERROR, "Parameter 'certificate' is null."); - throw new NullPointerException("certificate"); - } - - if (isConnected() == false) - connect(); - - //makes either remote or local call - rc = vldlImpl_.calladdCertificate(certificate, certificate.length, - ifsPathName_, ifsPathName_.length()); - - if (rc != SUCCESS) - { - throwException(vldlImpl_.cpfError_, ifsPathName_, rc); - } - - fireAdd(); - } - - - - /** - * Determines if the certificate is in the validation list. - * - * @param certificate The ASN.1 encoded X.509 certificate to search for in the validation list. - * - * @return true if the certificate is found in the validation list; false otherwise. - * - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If invalid certificate. - * @exception ExtendedIOException If other IBM i certificate access errors. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - public boolean checkCertificate(byte[] certificate) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException - - { - int rc; - - - if (null == certificate) - { - Trace.log(Trace.ERROR, "Parameter 'certificate' is null."); - throw new NullPointerException("certificate"); - } - - if (isConnected() == false) - connect(); - - //makes either remote or local call - rc = vldlImpl_.callcheckCertificate( - certificate, - certificate.length, - ifsPathName_, ifsPathName_.length(), - 1); - - if (rc != SUCCESS) - { - throwException(vldlImpl_.cpfError_, ifsPathName_, rc); - } - - return ((vldlImpl_.present_ == 1) ? true : false); - } - - /** - * Determines if a certificate matching the handle exists in the validation list. - * - * @param certificateHandle The IBM i certificate handle matching the certificate. - * - * @return true if a certificate matching the handle is found in the validation list; false otherwise. - * - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If invalid certificate handle. - * @exception ExtendedIOException If other IBM i certificate access errors. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - public boolean checkCertificateByHandle(byte[] certificateHandle) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException - - { - int rc; - - if (null == certificateHandle) - { - Trace.log(Trace.ERROR, "Parameter 'certificateHandle' is null."); - throw new NullPointerException("certificateHandle"); - } - - if (isConnected() == false) - connect(); - - //makes either remote or local call - rc = vldlImpl_.callcheckCertificate( - certificateHandle, certificateHandle.length, - ifsPathName_, ifsPathName_.length(), - 2); - - if (rc != SUCCESS) - { - throwException(vldlImpl_.cpfError_, ifsPathName_, rc); - } - - return ((vldlImpl_.present_ == 1) ? true : false); - } - - - - /** - * Deletes the certificate from the validation list. Throws an ExtendedIOException if the certificate is not present in the validation list. - * - * @param certificate The complete ASN.1 X.509 Certificate to be deleted from the repository. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If invalid certificate. - * @exception ExtendedIOException If certificate not found and other IBM i certificate access errors. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - public void deleteCertificate(byte[] certificate) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException - - { - int rc; - - if (null == certificate) - { - Trace.log(Trace.ERROR, "Parameter 'certificate' is null."); - throw new NullPointerException("certificate"); - } - - if (isConnected() == false) - connect(); - - //makes either remote or local call - rc = vldlImpl_.calldeleteCertificate( - certificate, certificate.length, - ifsPathName_, ifsPathName_.length(), - 1); - - if (rc != SUCCESS) - { - throwException(vldlImpl_.cpfError_, ifsPathName_, rc); - } - - fireDelete(); - } - - - - /** - * Deletes the certificate matching the certificate handle from the validation list. Throws ExtendedIOException if the certificate is not present in the repository. - * - * @param certificateHandle The IBM i certificate handle matching the certificate to be deleted from the repository. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If invalid certificate handle. - * @exception ExtendedIOException If certificate not found and other IBM i certificate access errors. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - public void deleteCertificateByHandle(byte[] certificateHandle) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException - - { - int rc; - - - if (null == certificateHandle) - { - Trace.log(Trace.ERROR, "Parameter 'certificateHandle' is null."); - throw new NullPointerException("certificateHandle"); - } - - if (isConnected() == false) - connect(); - - //makes either remote or local call - rc = vldlImpl_.calldeleteCertificate( - certificateHandle, certificateHandle.length, - ifsPathName_, ifsPathName_.length(), - 2); - - if (rc != SUCCESS) - { - throwException(vldlImpl_.cpfError_, ifsPathName_, rc); - } - - fireDelete(); - } - - - /** - * Lists certificates which match the specified attributes are copied from the validation list into the specified user space. - * The validation list is not locked during the listCertificates operation. - * Certificates are stored into the user space with CERT0100 format. See the IBM i QsyListVldlCertificates (QSYLSTVC) and QsyListUserCertificates (QSYLSTUC) API's for further information. - * - * @param certificateAttributes The list of attributes the certificate should match. - * A value of null places all certificates from the validation list into the user space. - * An empty String or empty byte array search attribute will search for certificates that do not have this attribute. - * For example, SUBJECT_ORGANIZATION = new String("") will search for certificates without the subject organization field. - * Null search attributes are ignored. - * @param userSpaceName The fully qualified integrated file system path name of the user space to put the list results, for example, /QSYS.LIB/MYLIB.LIB/MYUSRSPC.USRSPC. The 10 char IBM i library of the user space may also be specified as %CURLIB% or %LIBL%. - * See {@link com.ibm.as400.access.QSYSObjectPathName QSYSObjectPathName} - * - * @return The number of certificates found. - * - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception ExtendedIllegalArgumentException If invalid search attributes or input parameter. - * @exception ExtendedIOException If IBM i certificate access error. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the IBM i object does not exist. - */ - - public int listCertificates( - AS400CertificateAttribute[] certificateAttributes, - String userSpaceName) - throws AS400SecurityException, - ErrorCompletingRequestException, - ExtendedIOException, - InterruptedException, - IOException, - ObjectDoesNotExistException - -{ - int rc; - - String as400usrSpaceName; - - if (isConnected() == false) - connect(); - - //orders and saves the user's search attrs - boolean[] parmsEntered = setSearchAttributes(certificateAttributes); - - //get usrSpaceName in IBM i format. check for nonnull values. - as400usrSpaceName = getAS400UserSpaceName(userSpaceName); - - //makes either remote or local call - rc = vldlImpl_.calllistCertificates( - ifsPathName_, ifsPathName_.length(), - as400usrSpaceName, - parmsEntered, - as400AttrS_, - as400AttrB_); - - if (rc != SUCCESS) - { - throwException(vldlImpl_.cpfError_, ifsPathName_, rc); - } - - return vldlImpl_.numberCertificatesFound_; -} - - - /** - Sets the path for the validation list. - - @param path The fully qualified integrated file system path name of the validation list. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setPath(String path) - throws PropertyVetoException - { - - String libName; - String objectName; - String objectType; - - // check parm - if (path == null) - { - Trace.log(Trace.ERROR, "Parameter 'path' is null."); - throw new NullPointerException("path"); - } - - QSYSObjectPathName ifs = new QSYSObjectPathName(path); - libName = ifs.getLibraryName(); - objectName = ifs.getObjectName(); - objectType = ifs.getObjectType(); - - if (null == libName || null == objectName || - objectName.length() > 10 || - !(objectType.equalsIgnoreCase("VLDL")) ) - { - throw new ExtendedIllegalArgumentException("path", ExtendedIllegalArgumentException.PATH_NOT_VALID); - } - - // Set path the first time. - if (ifsPathName_ == null) - { - ifsPathName_ = path; - libName_ = libName; - objectName_ = objectName; - objectType_ = objectType; - } - else - { - // If system property is set, make sure we have not already connected. - if (system_ != null) - { - if (isConnected() ) - { - Trace.log(Trace.ERROR, "Parameter 'path' is not changed (Connected=true)."); - throw new ExtendedIllegalStateException("path", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - } - - // Remember the current path value. - String oldPath = ifsPathName_; - - // Fire a vetoable change event for the path. - vetos_.fireVetoableChange("path", oldPath, path); - - // Update the path value. - ifsPathName_ = path; - libName_ = libName; - objectName_ = objectName; - objectType_ = objectType; - - // Fire the property change event. - changes_.firePropertyChange("path", oldPath, path); - } - - } - - -} // End of AS400CertificateVldlUtil class - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateVldlUtilBeanInfo.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateVldlUtilBeanInfo.java deleted file mode 100644 index 52cce9b8f..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateVldlUtilBeanInfo.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateVldlUtilBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; - - - -/** -The AS400CertificateVldlUtilBeanInfo class provides -bean information for the AS400CertificateVldlUtil class. -**/ -public class AS400CertificateVldlUtilBeanInfo extends AS400CertificateUtilBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class vldlBeanClass = AS400CertificateVldlUtil.class; - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(vldlBeanClass); - } - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateVldlUtilImpl.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateVldlUtilImpl.java deleted file mode 100644 index a7118ee2e..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateVldlUtilImpl.java +++ /dev/null @@ -1,95 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateVldlUtilImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - - -/** -

    The AS400CertificateVldlUtilImpl provides the base class for the implementation of the methods for accessing certificates in an IBM i validation list object. -**/ -abstract class AS400CertificateVldlUtilImpl implements AS400CertificateUtilImplConstants -{ - Converter converter_; // The string to IBM i data converter. @C0C @C1C - AS400 system_ = null; - - // Output parms for native methods - String cpfError_ = null; - int numberCertificatesFound_; - int present_; - - - //********************************************************************/ - //* methods for either direct ot remote invocation */ - //* */ - //* @return Return code mapped to CPFxxxx error message. */ - //********************************************************************/ - - abstract int calladdCertificate(byte[] cert, int certlen, - String ifsPathName, int pathlen) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException; - - - - abstract int calldeleteCertificate(byte[] cert, int certlen, - String ifsPathName, int pathlen, - int certType) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException; - - - - - abstract int calllistCertificates(String ifsPathName, int pathlen, - String usrSpaceName, - boolean[] parmEntered, - String[] attrS, - byte[] [] attrB) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException; - - - - abstract int callcheckCertificate(byte[] cert, int certlen, - String ifsPathName, int pathlen, - int certType) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException; - - - void setConverter(Converter converter) - { - this.converter_ = converter; // @C1A - } - - -} // End of AS400CertificateVldlUtilImpl class - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateVldlUtilImplNative.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateVldlUtilImplNative.java deleted file mode 100644 index 47e427e5f..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateVldlUtilImplNative.java +++ /dev/null @@ -1,71 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateVldlUtilImplNative.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -

    The AS400CertificateVldlUtilImplNative provides the implementation of the native methods for accessing certificates in an IBM i validation list object. -**/ -class AS400CertificateVldlUtilImplNative extends AS400CertificateVldlUtilImpl -{ - private static final String CLASSNAME = "com.ibm.as400.access.AS400CertificateVldlUtilImplNative"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - // load the service program. - static - { - NativeMethods.loadNativeLibraryQyjspart(); - } - - - - - - //********************************************************************/ - //* native methods for direct local invocation */ - //* */ - //* @return Return code mapped to CPFxxxx error message. */ - //********************************************************************/ - - native int calladdCertificate(byte[] cert, int certlen, - String ifsPathName, int pathlen); - - - native int calldeleteCertificate(byte[] cert, int certlen, - String ifsPathName, int pathlen, - int certType); - - - native int calllistCertificates(String ifsPathName, int pathlen, - String usrSpaceName, - boolean[] parmEntered, - String[] attrS, - byte[] [] attrB); - - - native int callcheckCertificate(byte[] cert, int certlen, - String ifsPathName, int pathlen, - int certType); - - -} // End of AS400CertificateVldlUtilImplNative class - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400CertificateVldlUtilImplRemote.java b/cvsroot/src/com/ibm/as400/access/AS400CertificateVldlUtilImplRemote.java deleted file mode 100644 index 78539b992..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400CertificateVldlUtilImplRemote.java +++ /dev/null @@ -1,496 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CertificateVldlUtilImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InterruptedIOException; -import java.io.IOException; -import java.beans.PropertyVetoException; -import java.net.UnknownHostException; -import java.io.UnsupportedEncodingException; - - -/** - Provides the implementation of the remote methods for accessing certificates in an IBM i validation list object. -**/ -class AS400CertificateVldlUtilImplRemote extends AS400CertificateVldlUtilImpl -{ - - //********************************************************************/ - //* methods for remote invocation */ - //* */ - //* @return Return code mapped to CPFxxxx error message. */ - //********************************************************************/ - - int calladdCertificate(byte[] cert, int certlen, - String ifsPathName, int pathlen) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - - int rc; - - // **** Setup the parameter list **** - ProgramParameter[] parmlist = new ProgramParameter[7]; - - // First parameter: input, is the pgm entry - byte[] pgmEntry = new byte[4]; - BinaryConverter.intToByteArray(CALL_VLDL_ADD, pgmEntry, 0); - parmlist[0] = new ProgramParameter(pgmEntry); - - // 2 parameter: input, is the certificate array - parmlist[1] = new ProgramParameter(cert); - - // 3 parameter: input, is the length of the cert array - byte[] certlenB = new byte[4]; - BinaryConverter.intToByteArray(certlen, certlenB, 0); - parmlist[2] = new ProgramParameter(certlenB); - - // 4 parameter: input, is vldl path name - byte[] vldlPathB = new byte[pathlen]; - converter_.stringToByteArray(ifsPathName, vldlPathB); - parmlist[3] = new ProgramParameter(vldlPathB); - - // 5 parameter: input, is vldl path name len - byte[] pathlenB = new byte[4]; - BinaryConverter.intToByteArray(pathlen, pathlenB, 0); - parmlist[4] = new ProgramParameter(pathlenB); - - // 6 parameter: output, is the cpf error id array - parmlist[5] = new ProgramParameter( 7 ); - - // 7 parameter: input/output, is the return code - byte[] retcodeB = new byte[4]; - BinaryConverter.intToByteArray(-1, retcodeB, 0); - parmlist[6] = new ProgramParameter(retcodeB, 4 ); - - ProgramCall pgmCall = new ProgramCall(system_); - try { - pgmCall.setProgram("/QSYS.LIB/QYJSPCTU.PGM", parmlist ); - } - // PropertyVetoException should never happen - catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - pgmCall.suggestThreadsafe(); //@A1A - - // Run the program. Failure returns message list - if(pgmCall.run() != true) - { - AS400Message[] messagelist = pgmCall.getMessageList(); - cpfError_ = messagelist[0].toString(); - return -1; - } - - else - { - // get the retcode returned from the program - retcodeB = parmlist[6].getOutputData(); - rc = BinaryConverter.byteArrayToInt(retcodeB, 0); - - if (0 != rc) - { - //unexpected error - if (-1 == rc) return rc; - //get cpf error id - byte[] errorInfoB = parmlist[5].getOutputData(); - cpfError_ = converter_.byteArrayToString(errorInfoB, 0).trim(); - return rc; - } - } - - return SUCCESS; - } - - - - - int calldeleteCertificate(byte[] cert, int certlen, - String ifsPathName, int pathlen, - int certType) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - - - int rc; - - // **** Setup the parameter list **** - ProgramParameter[] parmlist = new ProgramParameter[8]; - - // First parameter: input, is the pgm entry - byte[] pgmEntry = new byte[4]; - BinaryConverter.intToByteArray(CALL_VLDL_DELETE, pgmEntry, 0); - parmlist[0] = new ProgramParameter(pgmEntry); - - // 2 parameter: input, is the certificate array - parmlist[1] = new ProgramParameter(cert); - - // 3 parameter: input, is the length of the cert array - byte[] certlenB = new byte[4]; - BinaryConverter.intToByteArray(certlen, certlenB, 0); - parmlist[2] = new ProgramParameter(certlenB); - - // 4 parameter: input, is vldl path name - byte[] vldlPathB = new byte[pathlen]; - converter_.stringToByteArray(ifsPathName, vldlPathB); - parmlist[3] = new ProgramParameter(vldlPathB); - - // 5 parameter: input, is vldl path name len - byte[] pathlenB = new byte[4]; - BinaryConverter.intToByteArray(pathlen, pathlenB, 0); - parmlist[4] = new ProgramParameter(pathlenB); - - // 6 parameter: input, is certificate type - byte[] certTypeB = new byte[4]; - BinaryConverter.intToByteArray(certType, certTypeB, 0); - parmlist[5] = new ProgramParameter(certTypeB); - - // 7 parameter: output, is the cpf error id array - parmlist[6] = new ProgramParameter( 7 ); - - // 8 parameter: input/output, is the return code - byte[] retcodeB = new byte[4]; - BinaryConverter.intToByteArray(-1, retcodeB, 0); - parmlist[7] = new ProgramParameter(retcodeB, 4 ); - - ProgramCall pgmCall = new ProgramCall(system_); - try { - pgmCall.setProgram("/QSYS.LIB/QYJSPCTU.PGM", parmlist ); - } - // PropertyVetoException should never happen - catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - pgmCall.suggestThreadsafe(); //@A1A - - // Run the program. Failure returns message list - if(pgmCall.run() != true) - { - AS400Message[] messagelist = pgmCall.getMessageList(); - cpfError_ = messagelist[0].toString(); - return -1; - } - - else - { - // get the retcode returned from the program - retcodeB = parmlist[7].getOutputData(); - rc = BinaryConverter.byteArrayToInt(retcodeB, 0); - - if (0 != rc) - { - //unexpected error - if (-1 == rc) return rc; - //get cpf error id - byte[] errorInfoB = parmlist[6].getOutputData(); - cpfError_ = converter_.byteArrayToString(errorInfoB, 0).trim(); - return rc; - } - } - - return SUCCESS; - } - - - - int calllistCertificates(String ifsPathName, int pathlen, - String usrSpaceName, - boolean[] parmEntered, - String[] attrS, - byte[] [] attrB) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - - int rc; - int i, j; - int length; - - // **** Setup the parameter list **** - ProgramParameter[] parmlist = new ProgramParameter[10]; - - // First parameter: input, is the pgm entry number - byte[] pgmEntry = new byte[4]; - BinaryConverter.intToByteArray(CALL_VLDL_LISTCERT, pgmEntry, 0); - parmlist[0] = new ProgramParameter(pgmEntry); - - // 2 parameter: input, is vldl path name - byte[] vldlPathB = new byte[pathlen]; - converter_.stringToByteArray(ifsPathName, vldlPathB); - parmlist[1] = new ProgramParameter(vldlPathB); - - // 3 parameter: input, is vldl path name len - byte[] vldlLengthB = new byte[4]; - BinaryConverter.intToByteArray(pathlen, vldlLengthB, 0); - parmlist[2] = new ProgramParameter(vldlLengthB); - - // 4 parameter: input, is user space native name - byte[] usrSpaceNameB = new byte[20]; - converter_.stringToByteArray(usrSpaceName, usrSpaceNameB); - parmlist[3] = new ProgramParameter(usrSpaceNameB); - - // 5 parameter: input, is parm entered array - byte[] parmPresent = new byte[SEARCH_PARMS * 4]; - for (i = 0; i < SEARCH_PARMS; ++i) - { - if (parmEntered[i]) - BinaryConverter.intToByteArray(1, parmPresent, i * 4); - else - BinaryConverter.intToByteArray(0, parmPresent, i * 4); - } - parmlist[4] = new ProgramParameter(parmPresent); - - - // 6, 7 parameter: input, parm sizes and search attrs array - length = 0; - int [] parmsize = new int[SEARCH_PARMS]; - //get length estimate and byte[] parm sizes - for (i = 0; i < attrS.length; ++i) - { - if (attrS[i] != null) - length = length + attrS[i].length(); - } - - for (j = 0; j < attrB.length; ++j) - { - if (attrB[j] != null) - { - length = length + attrB[j].length; - parmsize[i] = attrB[j].length; - } - ++i; - } - - //allow extra room for mixed ccsids and convert the strings, - //cannot assume target ccsid is 1 byte per char - byte[] attrbytes = new byte[length * 2]; - byte[][] attrSbytes = new byte[attrS.length] []; - for (i = 0; i < attrS.length; ++i) - { - if (attrS[i] != null) - { - if (0 != attrS[i].length()) - { - attrSbytes[i] = converter_.stringToByteArray(attrS[i]); - parmsize[i] = attrSbytes[i].length; - } - } - } - - //put/pack the converted string and byte arrays together - length = 0; - byte[] parmsizeBytes = new byte[SEARCH_PARMS * 4]; - //pack string search data first - for (i = 0; i < attrS.length; ++i) - { - if (null != attrSbytes[i]) - { - System.arraycopy(attrSbytes[i], 0, - attrbytes, length, - attrSbytes[i].length); - - length = length + attrSbytes[i].length; - } - BinaryConverter.intToByteArray(parmsize[i], - parmsizeBytes, - i * 4); - } - //pack byte[] search data last - for (i = 0; i < attrB.length; ++i) - { - if (null != attrB[i]) - { - System.arraycopy(attrB[i], 0, - attrbytes, length, - attrB[i].length); - - length = length + attrB[i].length; - } - BinaryConverter.intToByteArray(parmsize[SEARCH_PARMS - 1 + i], - parmsizeBytes, - (SEARCH_PARMS - 1 + i) * 4); - } - - parmlist[5] = new ProgramParameter(parmsizeBytes); - parmlist[6] = new ProgramParameter(attrbytes); - - // 8 parameter: output, is the number certs found - parmlist[7] = new ProgramParameter(4); - - - // 9 parameter: output, is the cpf error id array - parmlist[8] = new ProgramParameter( ERR_STRING_LEN ); - - // 10 parameter: input/output, is the return code - byte[] retcodeB = new byte[4]; - BinaryConverter.intToByteArray(-1, retcodeB, 0); - parmlist[9] = new ProgramParameter(retcodeB, 4 ); - - ProgramCall pgmCall = new ProgramCall(system_); - try { - pgmCall.setProgram("/QSYS.LIB/QYJSPCTU.PGM", parmlist ); - } - // PropertyVetoException should never happen - catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - pgmCall.suggestThreadsafe(); //@A1A - - // Run the program. Failure returns message list - if(pgmCall.run() != true) - { - - numberCertificatesFound_ = 0; - - AS400Message[] messagelist = pgmCall.getMessageList(); - cpfError_ = messagelist[0].toString(); - return -1; - - } - - else - { - // get the retcode returned from the program - retcodeB = parmlist[9].getOutputData(); - rc = BinaryConverter.byteArrayToInt(retcodeB, 0); - - if (0 != rc) - { - numberCertificatesFound_ = 0; - //unexpected error - if (-1 == rc) return rc; - //get cpf error id - byte[] errorInfoB = parmlist[8].getOutputData(); - cpfError_ = converter_.byteArrayToString(errorInfoB, 0).trim(); - return rc; - } - - //return output parms, 1st get number of certs found - byte[] numberCertificatesFoundB = parmlist[7].getOutputData(); - numberCertificatesFound_ = - BinaryConverter.byteArrayToInt(numberCertificatesFoundB, 0); - - }//end else (pgmCall ran) - - return rc; - } - - - - - int callcheckCertificate(byte[] cert, int certlen, - String ifsPathName, int pathlen, - int certType) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - - int rc; - - // **** Setup the parameter list **** - ProgramParameter[] parmlist = new ProgramParameter[9]; - - // First parameter: input, is the pgm entry - byte[] pgmEntry = new byte[4]; - BinaryConverter.intToByteArray(CALL_VLDL_CHECKCERT, pgmEntry, 0); - parmlist[0] = new ProgramParameter(pgmEntry); - - // 2 parameter: input, is the certificate array - parmlist[1] = new ProgramParameter(cert); - - // 3 parameter: input, is the length of the cert array - byte[] certlenB = new byte[4]; - BinaryConverter.intToByteArray(certlen, certlenB, 0); - parmlist[2] = new ProgramParameter(certlenB); - - // 4 parameter: input, is vldl path name - byte[] vldlPathB = new byte[pathlen]; - converter_.stringToByteArray(ifsPathName, vldlPathB); - parmlist[3] = new ProgramParameter(vldlPathB); - - // 5 parameter: input, is vldl path name len - byte[] pathlenB = new byte[4]; - BinaryConverter.intToByteArray(pathlen, pathlenB, 0); - parmlist[4] = new ProgramParameter(pathlenB); - - // 6 parameter: input, is certificate type - byte[] certTypeB = new byte[4]; - BinaryConverter.intToByteArray(certType, certTypeB, 0); - parmlist[5] = new ProgramParameter(certTypeB); - - // 7 parameter: output, is cert present indicator - parmlist[6] = new ProgramParameter( 4 ); - - // 8 parameter: output, is the cpf error id array - parmlist[7] = new ProgramParameter( 7 ); - - // 9 parameter: input/output, is the return code - byte[] retcodeB = new byte[4]; - BinaryConverter.intToByteArray(-1, retcodeB, 0); - parmlist[8] = new ProgramParameter(retcodeB, 4 ); - - ProgramCall pgmCall = new ProgramCall(system_); - try { - pgmCall.setProgram("/QSYS.LIB/QYJSPCTU.PGM", parmlist ); - } - // PropertyVetoException should never happen - catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } - pgmCall.suggestThreadsafe(); //@A1A - - // Run the program. Failure returns message list - if(pgmCall.run() != true) - { - AS400Message[] messagelist = pgmCall.getMessageList(); - cpfError_ = messagelist[0].toString(); - return -1; - } - - else - { - // get the retcode returned from the program - retcodeB = parmlist[8].getOutputData(); - rc = BinaryConverter.byteArrayToInt(retcodeB, 0); - - if (0 != rc) - { - //unexpected error - if (-1 == rc) return rc; - //get cpf error id - byte[] errorInfoB = parmlist[7].getOutputData(); - cpfError_ = converter_.byteArrayToString(errorInfoB, 0).trim(); - return rc; - } - - //return output parm, cert present indicator - byte[] presentB = parmlist[6].getOutputData(); - present_ = - BinaryConverter.byteArrayToInt(presentB, 0); - } - - return SUCCESS; - - } - -} // End of AS400CertificateVldlUtilImplRemote class - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400ConnectionPool.java b/cvsroot/src/com/ibm/as400/access/AS400ConnectionPool.java deleted file mode 100644 index 1ecd8ef24..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400ConnectionPool.java +++ /dev/null @@ -1,1814 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400ConnectionPool.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @C1 - 2008-06-06 - Added support for ProfileTokenCredential authentication. -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import com.ibm.as400.security.auth.ProfileTokenCredential; -import java.util.Hashtable; -import java.util.Locale; -import java.util.Vector; -import java.util.Enumeration; -import java.io.Serializable; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeEvent; - - -/** - * Manages a pool of AS400 objects. A connection pool is used to - * share connections and manage the number of connections a user can have to the system. - *

    - * A connection is defined by a systemName, userID, and an optional password and/or service. - * Services should be referred to using constants from the AS400 class - * (FILE, PRINT, COMMAND, DATAQUEUE, etc.) - *

    - * When a connection - * is requested, a fully functional AS400 object is returned to the calling application. - * It is then - * up to the application to return the AS400 object to the pool. It is not recommended - * that an application use this object to create additional connections - * as the pool would not keep track of these connections. - *

    - * The AS400ConnectionPool class keeps track of the number of connections it creates. - * The user can set the maximum number of connections that can be given out by a - * pool. If the maximum number of connections has already been given out when an - * additional connection is requested, an exception is thrown. - *

    - * Note: AS400ConnectionPool objects are threadsafe. - *

    - * This example creates an AS400ConnectionPool with a limit of 128 connections: - * - *

    - *  // Create an AS400ConnectionPool.
    - *  AS400ConnectionPool testPool = new AS400ConnectionPool();
    - *  // Set a maximum of 128 connections to this pool.
    - *  testPool.setMaxConnections(128);
    - *  // Preconnect 5 connections to the AS400.COMMAND service.
    - *  testPool.fill("myAS400", "myUserID", "myPassword", AS400.COMMAND, 5);
    - *  // Create a connection to the AS400.COMMAND service. (Use the service number constants 
    - *  // defined in the AS400 class (FILE, PRINT, COMMAND, DATAQUEUE, etc.))
    - *  AS400 newConn = testPool.getConnection("myAS400", "myUserID", "myPassword", AS400.COMMAND);
    - *  // Create a new command call object and run a command.
    - *  CommandCall cmd = new CommandCall(newConn); 
    - *  cmd.run("CRTLIB FRED");
    - *  // Return the connection to the pool.
    - *  testPool.returnConnectionToPool(newConn);  
    - *  // Close the test pool.
    - *  testPool.close();
    - *  
    - * - *

    AS400ConnectionPool objects generate the following events: - *

      - *
    • ConnectionPoolEvent - The events fired are: - *
        - *
      • CONNECTION_CREATED
      • - *
      • CONNECTION_EXPIRED
      • - *
      • CONNECTION_POOL_CLOSED
      • - *
      • CONNECTION_RELEASED
      • - *
      • CONNECTION_RETURNED
      • - *
      • MAINTENANCE_THREAD_RUN
      • - *
      - *
    • - *
    • PropertyChangeEvent
    • - *
    - **/ -public class AS400ConnectionPool extends ConnectionPool implements Serializable -{ - static final long serialVersionUID = 4L; - - /** - Indicates that the CCSID used for new connections is the same as the system default CCSID. - **/ - public static final int CCSID_DEFAULT = ConnectionPool.CCSID_DEFAULT; - - private transient Hashtable as400ConnectionPool_; - // Hashtable of lists of connections that have been marked invalid by the user - // by calling removeFromPool(). - private transient Hashtable removedAS400ConnectionPool_; //@A6A - private transient Log log_; - private SocketProperties socketProperties_; - private transient long lastRun_=0; //@D1A Last time cleanupConnections() was called. Added for fix to JTOpen Bug #3863 - private transient boolean connectionHasBeenCreated_ = false; - - // Handles loading the appropriate resource bundle -//@CRS private static ResourceBundleLoader loader_; - - /** - * Constructs an AS400ConnectionPool with default ConnectionPoolProperties. - **/ - public AS400ConnectionPool() - { - super(); - initializeTransient(); - } - - - /** - * Remove any connections that have exceeded maximum inactivity time, replace any - * that have aged past maximum usage or maximum lifetime, and remove any that have - * been in use too long. - * - * @see ConnectionPoolProperties - **/ - void cleanupConnections() - { - synchronized (as400ConnectionPool_) - { - Enumeration keys = as400ConnectionPool_.keys(); - while (keys.hasMoreElements()) - { - String key = (String)keys.nextElement(); - try - { - ConnectionList connList = (ConnectionList)as400ConnectionPool_.get(key); - connList.removeExpiredConnections(poolListeners_); - } - catch (Exception e) - { - log(e, key); - } - } - } - if (poolListeners_ != null) - { - ConnectionPoolEvent poolEvent = new ConnectionPoolEvent(this, ConnectionPoolEvent.MAINTENANCE_THREAD_RUN); - poolListeners_.fireMaintenanceThreadRun(poolEvent); - } - lastRun_ = System.currentTimeMillis(); //@D1A - } - - - /** - * Close and cleanup the connection pool. - **/ - public void close() - { - log(ResourceBundleLoader.getText("AS400CP_SHUTDOWN")); - synchronized (as400ConnectionPool_) - { - Enumeration keys = as400ConnectionPool_.keys(); - while (keys.hasMoreElements()) - { - String key = (String)keys.nextElement(); - ConnectionList connList = (ConnectionList)as400ConnectionPool_.get(key); - connList.close(); - } - as400ConnectionPool_.clear(); - } - - // Terminate the maintenance thread, if it's still alive. - if (maintenance_ != null && maintenance_.isAlive()) { - maintenance_.shutdown(); // tell the thread to terminate - } - - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(this, ConnectionPoolEvent.CONNECTION_POOL_CLOSED); - poolListeners_.fireClosedEvent(event); - } - log(ResourceBundleLoader.getText("AS400CP_SHUTDOWNCOMP")); - } - - - /** - * Create a key to use to access the connections hashtable. - * - * @param systemName The name of the system being queried. - * @param userID The name of the user. - * @return The key to use for the hashtable. - **/ - private String createKey(String systemName, String userID) - { - systemName = systemName.trim(); - userID = userID.trim(); - return systemName.toUpperCase() + "/" + userID.toUpperCase(); - } - - - /** - * Preconnects a specified number of connections to a specific system, userID, - * profileToken, and service. - * - * @param systemName The name of the system where the connections should exist. - * @param userID The name of the user. - * @param profileToken The profile token to use to authenticate to the system. - * @param service The service to be connected. See the service number constants defined by AS400 class. - * @param numberOfConnections The number of connections to be made. - * - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - public void fill(String systemName, String userID, ProfileTokenCredential profileToken, int service, int numberOfConnections) //@C1A - throws ConnectionPoolException - { - fill(systemName, userID, profileToken, service, numberOfConnections, null); - } - - /** - * Preconnects a specified number of connections to a specific system, userID, - * profileToken, service, and Locale. - * - * @param systemName The name of the system where the connections should exist. - * @param userID The name of the user. - * @param profileToken The profile token to use to authenticate to the system. - * @param service The service to be connected. See the service number constants defined by AS400 class. - * @param numberOfConnections The number of connections to be made. - * @param locale The Locale used to set the National Language Version (NLV) on the system for the AS400 objects - * created. Only the COMMAND, PRINT, and DATABASE services accept an NLV. - * - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - public void fill(String systemName, String userID, ProfileTokenCredential profileToken, int service, int numberOfConnections, Locale locale) //@C1A - throws ConnectionPoolException - { - if (numberOfConnections < 1) - throw new ExtendedIllegalArgumentException("numberOfConnections", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - Vector newAS400Connections = new Vector(); - if (Trace.traceOn_) - log(Trace.INFORMATION, "fill() key before resolving= " + systemName + "/" + userID); - systemName = AS400.resolveSystem(systemName); - userID = AS400.resolveUserId(userID.toUpperCase()); //@KBA - String key = createKey(systemName, userID); - if (Trace.traceOn_) - log(Trace.INFORMATION, "fill() key after resolving= " + key); - try - { - ConnectionList connections = (ConnectionList)as400ConnectionPool_.get(key); - if (log_ != null || Trace.traceOn_) - log(ResourceBundleLoader.substitute(ResourceBundleLoader.getText("AS400CP_FILLING"), new String[] { (new Integer(numberOfConnections)).toString(), - systemName, userID} )); - // create the specified number of connections - for (int i = 0; i < numberOfConnections; i++) - { - newAS400Connections.addElement(getConnection(systemName, userID, service, true, false, locale, profileToken)); - // Note: When filling an empty pool, getConnection() creates a new element and adds it to pool. - } - connections = (ConnectionList)as400ConnectionPool_.get(key); - for (int j = 0; j < numberOfConnections; j++) - { - connections.findElement((AS400)newAS400Connections.elementAt(j)).setInUse(false); - } - if (Trace.traceOn_ && locale != null) - log(Trace.INFORMATION, "Created " + numberOfConnections + "with a locale."); - } - catch (AS400SecurityException e) - { - // If exception occurs, stop creating connections, run maintenance thread, and - // throw whatever exception was received on creation to user. - ConnectionList connections = (ConnectionList)as400ConnectionPool_.get(key); - for (int k = 0; k < newAS400Connections.size(); k++) - { - connections.findElement((AS400)newAS400Connections.elementAt(k)).setInUse(false); - } - if (maintenance_ != null && maintenance_.isRunning()) - cleanupConnections(); - log(ResourceBundleLoader.getText("AS400CP_FILLEXC")); - throw new ConnectionPoolException(e); - } - catch (IOException ie) - { - // If exception occurs, stop creating connections, run maintenance thread, and - // throw whatever exception was received on creation to user. - ConnectionList connections = (ConnectionList)as400ConnectionPool_.get(key); - for (int k = 0; k < newAS400Connections.size(); k++) - { - connections.findElement((AS400)newAS400Connections.elementAt(k)).setInUse(false); - } - if (maintenance_ != null && maintenance_.isRunning()) - cleanupConnections(); - log(ResourceBundleLoader.getText("AS400CP_FILLEXC")); - throw new ConnectionPoolException(ie); - } - } - - /** - * Preconnects a specified number of connections to a specific system, userID, - * password, and service. - * - * @param systemName The name of the system where the connections should exist. - * @param userID The name of the user. - * @param password The password of the user. - * @param service The service to be connected. See the service number constants defined by AS400 class. - * @param numberOfConnections The number of connections to be made. - * - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - public void fill(String systemName, String userID, String password, int service, int numberOfConnections) - throws ConnectionPoolException - { - fill(systemName, userID, password, service, numberOfConnections, null); - } - - - //@B3A - /** - * Preconnects a specified number of connections to a specific system, userID, - * password, service, and Locale. - * - * @param systemName The name of the system where the connections should exist. - * @param userID The name of the user. - * @param password The password of the user. - * @param service The service to be connected. See the service number constants defined by AS400 class. - * @param numberOfConnections The number of connections to be made. - * @param locale The Locale used to set the National Language Version (NLV) on the system for the AS400 objects - * created. Only the COMMAND, PRINT, and DATABASE services accept an NLV. - * - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - public void fill(String systemName, String userID, String password, int service, int numberOfConnections, Locale locale) - throws ConnectionPoolException - { - if (numberOfConnections < 1) - throw new ExtendedIllegalArgumentException("numberOfConnections", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - Vector newAS400Connections = new Vector(); - if (Trace.traceOn_) - log(Trace.INFORMATION, "fill() key before resolving= " + systemName + "/" + userID); - systemName = AS400.resolveSystem(systemName); - userID = AS400.resolveUserId(userID.toUpperCase()); //@KBA - String key = createKey(systemName, userID); - if (Trace.traceOn_) - log(Trace.INFORMATION, "fill() key after resolving= " + key); - try - { - ConnectionList connections = (ConnectionList)as400ConnectionPool_.get(key); - if (log_ != null || Trace.traceOn_) - log(ResourceBundleLoader.substitute(ResourceBundleLoader.getText("AS400CP_FILLING"), new String[] { (new Integer(numberOfConnections)).toString(), - systemName, userID} )); - // create the specified number of connections - //@B4D AS400.addPasswordCacheEntry(systemName, userID, password); - for (int i = 0; i < numberOfConnections; i++) - { - newAS400Connections.addElement(getConnection(systemName, userID, service, true, false, locale, password)); //@B4C - // Note: When filling an empty pool, getConnection() creates a new element and adds it to pool. - } - connections = (ConnectionList)as400ConnectionPool_.get(key); - for (int j = 0; j < numberOfConnections; j++) - { - connections.findElement((AS400)newAS400Connections.elementAt(j)).setInUse(false); - } - if (Trace.traceOn_ && locale != null) - log(Trace.INFORMATION, "Created " + numberOfConnections + "with a locale."); - } - catch (AS400SecurityException e) - { - // If exception occurs, stop creating connections, run maintenance thread, and - // throw whatever exception was received on creation to user. - ConnectionList connections = (ConnectionList)as400ConnectionPool_.get(key); - for (int k = 0; k < newAS400Connections.size(); k++) - { - connections.findElement((AS400)newAS400Connections.elementAt(k)).setInUse(false); - } - if (maintenance_ != null && maintenance_.isRunning()) - cleanupConnections(); - log(ResourceBundleLoader.getText("AS400CP_FILLEXC")); - throw new ConnectionPoolException(e); - } - catch (IOException ie) //@A2A - { - //@A2A - // If exception occurs, stop creating connections, run maintenance thread, and - // throw whatever exception was received on creation to user. - ConnectionList connections = (ConnectionList)as400ConnectionPool_.get(key); - for (int k = 0; k < newAS400Connections.size(); k++) - { //@A2A - connections.findElement((AS400)newAS400Connections.elementAt(k)).setInUse(false); - } //@A2A - if (maintenance_ != null && maintenance_.isRunning()) - cleanupConnections(); //@A2A - log(ResourceBundleLoader.getText("AS400CP_FILLEXC")); //@A2A - throw new ConnectionPoolException(ie); //@A2A - } //@A2A - } - - /** - * Closes the connection if not explicitly closed by the caller. - * - * @exception Throwable If an error occurs. - **/ - protected void finalize () - throws Throwable - { - close(); - - super.finalize (); - } - - - /** - * Get the number of active (in-use) connections to a system. - * Note: The value returned is based only on systemName and userID, and does not - * reflect the authentication scheme (e.g. password, profile token). - * - * @param systemName The name of the system where the connections exist. - * @param userID The name of the user. - * @return The number of connections that are currently in use. - **/ - public int getActiveConnectionCount(String systemName, String userID) - { - if (systemName == null) - throw new NullPointerException("systemName"); - if (userID == null) - throw new NullPointerException("userID"); - systemName = AS400.resolveSystem(systemName); //@A5A - userID = AS400.resolveUserId(userID.toUpperCase()); //@A5A //@KBA - String key = createKey(systemName, userID); - if (Trace.traceOn_) //@A5A - log(Trace.INFORMATION, "getActiveConnectionCount key= " + key); //@A5A - ConnectionList connections = (ConnectionList)as400ConnectionPool_.get(key); - if (connections == null) - { - if (Trace.traceOn_) //@A5A - log(Trace.WARNING, "getActiveConnectionCount found no " + key + " list in the pool"); //@A5A - return 0; - } - return(connections.getActiveConnectionCount()); - } - - - /** - * Get the number of available connections to a system. - * Note: The value returned is based only on systemName and userID, and does not - * reflect the authentication scheme (e.g. password, profile token). - * - * @param systemName The name of the system where the connections exist. - * @param userID The name of the user. - * @return The number of connections that are not currently in use. - **/ - public int getAvailableConnectionCount(String systemName, String userID) - { - if (systemName == null) - throw new NullPointerException("systemName"); - if (userID == null) - throw new NullPointerException("userID"); - systemName = AS400.resolveSystem(systemName); //@A5A - userID = AS400.resolveUserId(userID.toUpperCase()); //@A5A //@KBA - String key = createKey(systemName, userID); - if (Trace.traceOn_) //@A5A - log(Trace.INFORMATION, "getAvailableConnectionCount key= " + key); //@A5A - ConnectionList connections = (ConnectionList)as400ConnectionPool_.get(key); - if (connections == null) - { - if (Trace.traceOn_) //@A5A - log(Trace.WARNING, "getAvailableConnectionCount found no " + key + " list in the pool"); //@A5A - return 0; - } - return connections.getAvailableConnectionCount(); - } - - - /** - * Returns the CCSID that is used when creating new connections. - * The default value is the system default CCSID as determined by the AS400 class. - * @return The CCSID, or {@link #CCSID_DEFAULT CCSID_DEFAULT} if the system default CCSID is used. - **/ - public int getCCSID() - { - return super.getCCSID(); - } - - - /** - * Get a connected AS400 object from the connection pool. If an appropriate one is - * not found, one is created. If the maximum connection limit has been reached, an exception - * will be thrown. - * Note that the password is validated only when creating a new connection, - * of the match criteria to pull a connection out of the pool. This means that - * if an existing connection in the pool matches the systemName and userID - * passed in, a connection will be returned without the password being validated. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @param password The password of the user. - * @param service The service to connect. See the service number constants defined by AS400 class. - * @return A connected AS400 object. - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - public AS400 getConnection(String systemName, String userID, String password, int service) - throws ConnectionPoolException - { - try - { - //@B4D AS400.addPasswordCacheEntry(systemName, userID, password); - AS400 releaseConnection = getConnection(systemName, userID, service, true, false, null, password); //@B3C add null locale //@B4C - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(releaseConnection, ConnectionPoolEvent.CONNECTION_RELEASED); //@A7C - poolListeners_.fireConnectionReleasedEvent(event); - } - return releaseConnection; - } - catch (AS400SecurityException e) - { - throw new ConnectionPoolException(e); - } - catch (IOException ie) - { - throw new ConnectionPoolException(ie); - } - } - - - //@B3A - /** - * Get a connected AS400 object from the connection pool with the specified Locale. If an appropriate one is - * not found, one is created. If the maximum connection limit has been reached, an exception - * will be thrown. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @param password The password of the user. - * @param service The service to connect. See the service number constants defined by AS400 class. - * @param locale The Locale used to set the National Language Version (NLV) on the system for the AS400 object returned. - * Only the COMMAND, PRINT, and DATABASE services accept an NLV. - * @return A connected AS400 object. - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - public AS400 getConnection(String systemName, String userID, String password, int service, Locale locale) - throws ConnectionPoolException - { - try - { - //@B4D AS400.addPasswordCacheEntry(systemName, userID, password); - AS400 releaseConnection = getConnection(systemName, userID, service, true, false, locale, password); //@B4C - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(releaseConnection, ConnectionPoolEvent.CONNECTION_RELEASED); - poolListeners_.fireConnectionReleasedEvent(event); - } - return releaseConnection; - } - catch (AS400SecurityException e) - { - throw new ConnectionPoolException(e); - } - catch (IOException ie) - { - throw new ConnectionPoolException(ie); - } - } - - - /** - * Get a connected AS400 object from the connection pool. If an appropriate one is - * not found, one is created. If the maximum connection limit has been reached, an exception - * will be thrown. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @param service The service to connect. See the service number constants defined by AS400 class. - * @return A connected AS400 object. - * @exception ConnectionPoolException Always thrown because this method has been deprecated. - * @deprecated Use getConnection(String systemName, String userID, String password, int service) instead. - **/ - public AS400 getConnection(String systemName, String userID, int service) - throws ConnectionPoolException - { - //@B4D try - //@B4D { - //@B4D AS400 releaseConnection = getConnection(systemName, userID, service, true, false, null); //@B3C add null locale - //@B4D ConnectionPoolEvent event = new ConnectionPoolEvent(releaseConnection, ConnectionPoolEvent.CONNECTION_RELEASED); //@A7C - //@B4D poolListeners_.fireConnectionReleasedEvent(event); - //@B4D return releaseConnection; - //@B4D } - //@B4D catch (AS400SecurityException e) - //@B4D { - //@B4D throw new ConnectionPoolException(e); - //@B4D } - //@B4D catch (IOException ie) - //@B4D { - //@B4D throw new ConnectionPoolException(ie); - //@B4D } - throw new ConnectionPoolException(new ExtendedIOException(ExtendedIOException.REQUEST_NOT_SUPPORTED)); //@B4A - } - - - /** - * Get an AS400 object from the connection pool. If an appropriate one is not found, - * one is created. If the maximum connection limit has been reached, an exception - * will be thrown. The AS400 object may not be connected to any services. - * Note that the password is validated only when creating a new connection, - * of the match criteria to pull a connection out of the pool. This means that - * if an existing connection in the pool matches the systemName and userID - * passed in, a connection will be returned without the password being validated. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @param password The password of the user. - * @return An AS400 object. - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - public AS400 getConnection(String systemName, String userID, String password) - throws ConnectionPoolException - { - try - { - //@B4D AS400.addPasswordCacheEntry(systemName, userID, password); - AS400 releaseConnection = getConnection(systemName, userID, 0, false, false, null, password); //@B3C add null locale //@B4C - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(releaseConnection, ConnectionPoolEvent.CONNECTION_RELEASED); //@A7C - poolListeners_.fireConnectionReleasedEvent(event); - } - return releaseConnection; - } - catch (AS400SecurityException e) - { - throw new ConnectionPoolException(e); - } - catch (IOException ie) - { - throw new ConnectionPoolException(ie); - } - } - - //@B3A - /** - * Get an AS400 object from the connection pool with the specified Locale. If an appropriate one is not found, - * one is created. If the maximum connection limit has been reached, an exception - * will be thrown. The AS400 object may not be connected to any services. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @param password The password of the user. - * @param locale The Locale used to set the National Language Version (NLV) on the system for the AS400 object returned. - * Only the COMMAND, PRINT, and DATABASE services accept an NLV. - * @return An AS400 object. - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - public AS400 getConnection(String systemName, String userID, String password, Locale locale) - throws ConnectionPoolException - { - try - { - //@B4D AS400.addPasswordCacheEntry(systemName, userID, password); - AS400 releaseConnection = getConnection(systemName, userID, 0, false, false, locale, password); //@B4C - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(releaseConnection, ConnectionPoolEvent.CONNECTION_RELEASED); - poolListeners_.fireConnectionReleasedEvent(event); - } - return releaseConnection; - } - catch (AS400SecurityException e) - { - throw new ConnectionPoolException(e); - } - catch (IOException ie) - { - throw new ConnectionPoolException(ie); - } - } - - - - /** - * Get an AS400 object from the connection pool. If an appropriate one is not found, - * one is created. If the maximum connection limit has been reached, an exception - * will be thrown. The AS400 object may not be connected to any services. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @return An AS400 object. -* @exception ConnectionPoolException Always thrown because this method has been deprecated. - * @deprecated Use getConnection(String systemName, String userID, String password) instead. - **/ - public AS400 getConnection(String systemName, String userID) - throws ConnectionPoolException - { - //@B4D try - //@B4D { - //@B4D AS400 releaseConnection = getConnection(systemName, userID, 0, false, false, null); //@B3C add null locale - //@B4D releaseConnection.getVRM(); - //@B4D ConnectionPoolEvent event = new ConnectionPoolEvent(releaseConnection, ConnectionPoolEvent.CONNECTION_RELEASED); //@A7C - //@B4D poolListeners_.fireConnectionReleasedEvent(event); - //@B4D return releaseConnection; - //@B4D } - //@B4D catch (AS400SecurityException ae) - //@B4D { - //@B4D throw new ConnectionPoolException(ae); - //@B4D } - //@B4D catch (IOException ie) - //@B4D { - //@B4D throw new ConnectionPoolException(ie); - //@B4D } - throw new ConnectionPoolException(new ExtendedIOException(ExtendedIOException.REQUEST_NOT_SUPPORTED)); //@B4A - } - - /** - * Get a connected AS400 object from the connection pool. If an appropriate one is - * not found, one is created. If the maximum connection limit has been reached, an exception - * will be thrown. - * Note that the profileTokenCredential is validated only when creating a new - * connection, of the match criteria to pull a connection out of the pool. This means - * that if an existing connection in the pool matches the systemName and - * userID passed in, a connection will be returned without the profileTokenCredential - * being validated. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @param profileToken The profile token to use to authenticate to the system. - * @param service The service to connect. See the service number constants defined by AS400 class. - * @return A connected AS400 object. - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - public AS400 getConnection(String systemName, String userID, ProfileTokenCredential profileToken, int service) //@C1A - throws ConnectionPoolException - { - try - { - AS400 releaseConnection = getConnection(systemName, userID, service, true, false, null, profileToken); - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(releaseConnection, ConnectionPoolEvent.CONNECTION_RELEASED); - poolListeners_.fireConnectionReleasedEvent(event); - } - return releaseConnection; - } - catch (AS400SecurityException e) - { - throw new ConnectionPoolException(e); - } - catch (IOException ie) - { - throw new ConnectionPoolException(ie); - } - } - - /** - * Get a connected AS400 object from the connection pool with the specified Locale. If an appropriate one is - * not found, one is created. If the maximum connection limit has been reached, an exception - * will be thrown. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @param profileToken The profile token to use to authenticate to the system. - * @param service The service to connect. See the service number constants defined by AS400 class. - * @param locale The Locale used to set the National Language Version (NLV) on the system for the AS400 object returned. - * Only the COMMAND, PRINT, and DATABASE services accept an NLV. - * @return A connected AS400 object. - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - public AS400 getConnection(String systemName, String userID, ProfileTokenCredential profileToken, int service, Locale locale) //@C1A - throws ConnectionPoolException - { - try - { - AS400 releaseConnection = getConnection(systemName, userID, service, true, false, locale, profileToken); - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(releaseConnection, ConnectionPoolEvent.CONNECTION_RELEASED); - poolListeners_.fireConnectionReleasedEvent(event); - } - return releaseConnection; - } - catch (AS400SecurityException e) - { - throw new ConnectionPoolException(e); - } - catch (IOException ie) - { - throw new ConnectionPoolException(ie); - } - } - - - /** - * Get an AS400 object from the connection pool. If an appropriate one is not found, - * one is created. If the maximum connection limit has been reached, an exception - * will be thrown. The AS400 object may not be connected to any services. - * Note that the password is validated only when creating a new connection, not as part - * of the match criteria to pull a connection out of the pool. This means that - * if a connection in the pool matches the systemName and userID passed in, a - * connection will be returned without the password being validated. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @param profileToken The profile token to use to authenticate to the system. - * @return An AS400 object. - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - public AS400 getConnection(String systemName, String userID, ProfileTokenCredential profileToken) //@C1A - throws ConnectionPoolException - { - try - { - AS400 releaseConnection = getConnection(systemName, userID, 0, false, false, null, profileToken); - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(releaseConnection, ConnectionPoolEvent.CONNECTION_RELEASED); - poolListeners_.fireConnectionReleasedEvent(event); - } - return releaseConnection; - } - catch (AS400SecurityException e) - { - throw new ConnectionPoolException(e); - } - catch (IOException ie) - { - throw new ConnectionPoolException(ie); - } - } - - /** - * Get an AS400 object from the connection pool with the specified Locale. If an appropriate one is not found, - * one is created. If the maximum connection limit has been reached, an exception - * will be thrown. The AS400 object may not be connected to any services. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @param profileToken The profile token to use to authenticate to the system. - * @param locale The Locale used to set the National Language Version (NLV) on the system for the AS400 object returned. - * Only the COMMAND, PRINT, and DATABASE services accept an NLV. - * @return An AS400 object. - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - public AS400 getConnection(String systemName, String userID, ProfileTokenCredential profileToken, Locale locale) //@C1A - throws ConnectionPoolException - { - try - { - AS400 releaseConnection = getConnection(systemName, userID, 0, false, false, locale, profileToken); - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(releaseConnection, ConnectionPoolEvent.CONNECTION_RELEASED); - poolListeners_.fireConnectionReleasedEvent(event); - } - return releaseConnection; - } - catch (AS400SecurityException e) - { - throw new ConnectionPoolException(e); - } - catch (IOException ie) - { - throw new ConnectionPoolException(ie); - } - } - - - - private AS400 getConnection(String systemName, String userID, int service, boolean connect, boolean secure, Locale locale, AS400ConnectionPoolAuthentication poolAuth) //@B3C //@B4C //@C1C - throws AS400SecurityException, IOException, ConnectionPoolException - { - if (systemName == null) - throw new NullPointerException("systemName"); - if (systemName.length() == 0) - throw new ExtendedIllegalArgumentException("systemName", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - if (userID == null) - throw new NullPointerException("userID"); - if (userID.length() == 0) - throw new ExtendedIllegalArgumentException("userID", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - if (Trace.traceOn_) //@A5A - { - log(Trace.INFORMATION, "getConnection() key before resolving= " + systemName + "/" + userID); //@A5A - } - systemName = AS400.resolveSystem(systemName); //@A5A - userID = AS400.resolveUserId(userID.toUpperCase()); //@A5A //@KBA - - String key = createKey(systemName, userID); - if (Trace.traceOn_) //@A5A - { - log(Trace.INFORMATION, "getConnection() key after resolving= " + key); //@A5A - } - - if (!isInUse()) //@A3A - { - //@A3A - setInUse(true); // threadUsed property can now not be changed. //@A3A - } //@A3A - - //Work with maintenance thread - if (isThreadUsed() && isRunMaintenance()) - { - // Start thread if it has not been initialized. - if (maintenance_ == null) - { - synchronized(this) //@CRS - { - if (maintenance_ == null) //@CRS - { - maintenance_ = new PoolMaintenance(this); - maintenance_.start(); - } - } - } - // Restart the thread. - if (!maintenance_.isRunning()) maintenance_.setRunning(true); - } - else if (!isThreadUsed() && isRunMaintenance() && - ((System.currentTimeMillis() - lastRun_) > getCleanupInterval())) // If running single-threaded and cleanup interval has elapsed, run cleanup - { - cleanupConnections(); - } - - //@CRS - Let's do a double-check here for performance, per JTOpen bug #3727. - ConnectionList connections = (ConnectionList)as400ConnectionPool_.get(key); - - if (connections == null) - { - synchronized (as400ConnectionPool_) //@B1M - { - connections = (ConnectionList)as400ConnectionPool_.get(key); //@B1C - - if (connections == null) //@CRS - Double-check idiom. - { - // no connection list exists, start a new list - if (log_ != null || Trace.traceOn_) - { - log(ResourceBundleLoader.substitute(ResourceBundleLoader.getText("AS400CP_CONNLIST"), new String[] {systemName, userID} )); - } - connections = new ConnectionList(systemName, userID, properties_); - // log_ can be null, meaning events should not be logged - connections.setLog(log_); - - // create a new connection - as400ConnectionPool_.put(key, connections); - } - } - } - - //@CRS - Moved the block below out of the synch block above per JTOpen bug #3727... - // We don't want to hold the lock on the entire pool if we are trying to get a connection - // for a system that is down or non-existent. ConnectionList.getConnection() is synchronized - // inside itself, anyway. - - //Get a connection from the list - AS400 connection = null; - if (connect) - { - connection = connections.getConnection(service, secure, poolListeners_, locale, poolAuth, socketProperties_, getCCSID()).getAS400Object(); //@B3C add null locale //@B4C //@C1C - } - else - { - connection = connections.getConnection(secure, poolListeners_, locale, poolAuth, socketProperties_, getCCSID()).getAS400Object(); //@B3C add null locale //@B4C //@C1C - } - connectionHasBeenCreated_ = true; // remember that we've created at least 1 connection - return connection; - } - - /** - * Get an AS400 object from the connection pool. If an appropriate one is not found, - * one is created. The AS400 object may not be connected to any services. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @param service The service to connect. See the service number constants defined by AS400 class. - * @param connect If true connect to specified service. - * @param secure If true secure AS400 object was requested. - * @param locale The Locale used to set the National Language Version (NLV) on the system for the AS400 object returned. - * Only the COMMAND, PRINT, and DATABASE services accept an NLV. - * @return An AS400 object. - * - * @exception AS400SecurityException If a security error occurred. - * @exception IOException If a communications error occurred. - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - private AS400 getConnection(String systemName, String userID, int service, boolean connect, boolean secure, Locale locale, String password) //@B3C //@B4C - throws AS400SecurityException, IOException, ConnectionPoolException - { - AS400ConnectionPoolAuthentication poolAuth = new AS400ConnectionPoolAuthentication(password); //@C1A - return (getConnection(systemName, userID, service, connect, secure, locale, poolAuth)); //@C1C -} - - /** - * Get an AS400 object from the connection pool. If an appropriate one is not found, - * one is created. The AS400 object may not be connected to any services. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @param service The service to connect. See the service number constants defined by AS400 class. - * @param connect If true connect to specified service. - * @param secure If true secure AS400 object was requested. - * @param locale The Locale used to set the National Language Version (NLV) on the system for the AS400 object returned. - * Only the COMMAND, PRINT, and DATABASE services accept an NLV. - * @return An AS400 object. - * - * @exception AS400SecurityException If a security error occurred. - * @exception IOException If a communications error occurred. - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - private AS400 getConnection(String systemName, String userID, int service, boolean connect, boolean secure, Locale locale, ProfileTokenCredential profileToken) - throws AS400SecurityException, IOException, ConnectionPoolException - { - AS400ConnectionPoolAuthentication poolAuth = new AS400ConnectionPoolAuthentication(profileToken); //@C1A - return (getConnection(systemName, userID, service, connect, secure, locale, poolAuth)); //@C1C - } - - - /** - * Get an secure connected AS400 object from the connection pool. If an appropriate one is not found, - * one is created. If the maximum connection limit has been reached, an exception - * will be thrown. The AS400 object may not be connected to any services. - * Note that the password is validated only when creating a new connection, - * of the match criteria to pull a connection out of the pool. This means that - * if an existing connection in the pool matches the systemName and userID - * passed in, a connection will be returned without the password being validated. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @param password The password of the user. - * @return A secure connected AS400 object. - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - public AS400 getSecureConnection(String systemName, String userID, String password) - throws ConnectionPoolException - { - try - { - //@B4D AS400.addPasswordCacheEntry(systemName, userID, password); - AS400 releaseConnection = getConnection(systemName, userID, 0, false, true, null, password); //@B3C add null locale //@B4C - releaseConnection.getVRM(); - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(releaseConnection, ConnectionPoolEvent.CONNECTION_RELEASED); - poolListeners_.fireConnectionReleasedEvent(event); - } - return releaseConnection; - } - catch (AS400SecurityException e) - { - throw new ConnectionPoolException(e); - } - catch (IOException ie) - { - throw new ConnectionPoolException(ie); - } - } - - - /** - * Get an secure connected AS400 object from the connection pool. If an appropriate one is not found, - * one is created. If the maximum connection limit has been reached, an exception - * will be thrown. The AS400 object may not be connected to any services. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @return A secure connected AS400 object. - * @exception ConnectionPoolException Always thrown because this method has been deprecated. - * @deprecated Use getSecureConnection(String systemName, String userID, String password) instead. - **/ - public AS400 getSecureConnection(String systemName, String userID) - throws ConnectionPoolException - { - //@B4D try - //@B4D { - //@B4D AS400 releaseConnection = getConnection(systemName, userID, 0, false, true, null); //@B3C add null locale - //@B4D releaseConnection.getVRM(); - //@B4D ConnectionPoolEvent event = new ConnectionPoolEvent(releaseConnection, ConnectionPoolEvent.CONNECTION_RELEASED); //@A7C - //@B4D poolListeners_.fireConnectionReleasedEvent(event); - //@B4D return releaseConnection; - //@B4D } - //@B4D catch (AS400SecurityException ae) - //@B4D { - //@B4D throw new ConnectionPoolException(ae); - //@B4D } - //@B4D catch (IOException ie) - //@B4D { - //@B4D throw new ConnectionPoolException(ie); - //@B4D } - throw new ConnectionPoolException(new ExtendedIOException(ExtendedIOException.REQUEST_NOT_SUPPORTED)); //@B4A - } - - - /** - * Get a secure connected AS400 object from the connection pool. If an appropriate one is - * not found, one is created. If the maximum connection limit has been reached, an exception - * will be thrown. - * Note that the password is validated only when creating a new connection, - * of the match criteria to pull a connection out of the pool. This means that - * if an existing connection in the pool matches the systemName and userID - * passed in, a connection will be returned without the password being validated. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @param password The password of the user. - * @param service The service to connect. See the service number constants defined by AS400 class. - * @return A connected AS400 object. - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - public AS400 getSecureConnection(String systemName, String userID, String password, int service) - throws ConnectionPoolException - { - try - { - //@B4D AS400.addPasswordCacheEntry(systemName, userID, password); - AS400 releaseConnection = getConnection(systemName, userID, service, true, true, null, password); //@B3C add null locale //@B4C - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(releaseConnection, ConnectionPoolEvent.CONNECTION_RELEASED); //@A7C - poolListeners_.fireConnectionReleasedEvent(event); - } - return releaseConnection; - } - catch (AS400SecurityException e) - { - throw new ConnectionPoolException(e); - } - catch (IOException ie) - { - throw new ConnectionPoolException(ie); - } - } - - - /** - * Get a secure connected AS400 object from the connection pool. If an appropriate one is - * not found, one is created. If the maximum connection limit has been reached, an exception - * will be thrown. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @param service The service to connect. See the service number constants defined by AS400 class. - * @return A connected AS400 object. - * @exception ConnectionPoolException Always thrown because this method has been deprecated. - * @deprecated Use getConnection(String systemName, String userID, String password, int service) instead. - **/ - public AS400 getSecureConnection(String systemName, String userID, int service) - throws ConnectionPoolException - { - //@B4D try - //@B4D { - //@B4D AS400 releaseConnection = getConnection(systemName, userID, service, true, true, null); //@B3C add null locale - //@B4D ConnectionPoolEvent event = new ConnectionPoolEvent(releaseConnection, ConnectionPoolEvent.CONNECTION_RELEASED); //@A7C - //@B4D poolListeners_.fireConnectionReleasedEvent(event); - //@B4D return releaseConnection; - //@B4D } - //@B4D catch (AS400SecurityException e) - //@B4D { - //@B4D throw new ConnectionPoolException(e); - //@B4D } - //@B4D catch (IOException ie) - //@B4D { - //@B4D throw new ConnectionPoolException(ie); - //@B4D } - throw new ConnectionPoolException(new ExtendedIOException(ExtendedIOException.REQUEST_NOT_SUPPORTED)); //@B4A - } - - /** - * Get an secure connected AS400 object from the connection pool. If an appropriate one is not found, - * one is created. If the maximum connection limit has been reached, an exception - * will be thrown. The AS400 object may not be connected to any services. - * Note that the profileTokenCredential is validated only when creating a new - * connection, of the match criteria to pull a connection out of the pool. This means - * that if an existing connection in the pool matches the systemName and - * userID passed in, a connection will be returned without the profileTokenCredential - * being validated. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @param profileToken The profile token to use to authenticate to the system. - * @return A secure connected AS400 object. - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - public AS400 getSecureConnection(String systemName, String userID, ProfileTokenCredential profileToken) //@C1A - throws ConnectionPoolException - { - try - { - AS400 releaseConnection = getConnection(systemName, userID, 0, false, true, null, profileToken); - releaseConnection.getVRM(); - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(releaseConnection, ConnectionPoolEvent.CONNECTION_RELEASED); - poolListeners_.fireConnectionReleasedEvent(event); - } - return releaseConnection; - } - catch (AS400SecurityException e) - { - throw new ConnectionPoolException(e); - } - catch (IOException ie) - { - throw new ConnectionPoolException(ie); - } - } - - - /** - * Get a secure connected AS400 object from the connection pool. If an appropriate one is - * not found, one is created. If the maximum connection limit has been reached, an exception - * will be thrown. - * Note that the profileTokenCredential is validated only when creating a new - * connection, of the match criteria to pull a connection out of the pool. This means - * that if an existing connection in the pool matches the systemName and - * userID passed in, a connection will be returned without the profileTokenCredential - * being validated. - * - * @param systemName The name of the system where the object should exist. - * @param userID The name of the user. - * @param profileToken The profile token to use to authenticate to the system. - * @param service The service to connect. See the service number constants defined by AS400 class. - * @return A connected AS400 object. - * @exception ConnectionPoolException If a connection pool error occurred. - **/ - public AS400 getSecureConnection(String systemName, String userID, ProfileTokenCredential profileToken, int service) //@C1A - throws ConnectionPoolException - { - try - { - AS400 releaseConnection = getConnection(systemName, userID, service, true, true, null, profileToken); - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(releaseConnection, ConnectionPoolEvent.CONNECTION_RELEASED); - poolListeners_.fireConnectionReleasedEvent(event); - } - return releaseConnection; - } - catch (AS400SecurityException e) - { - throw new ConnectionPoolException(e); - } - catch (IOException ie) - { - throw new ConnectionPoolException(ie); - } - } - - - - /** - Returns a copy of the socket properties that this AS400ConnectionPool specifies when it creates new AS400 objects, for example in fill(), getConnection(), or getSecureConnection(). - @return The socket properties. A null value indicates that this AS400ConnectionPool specifies no socket properties. - **/ - public SocketProperties getSocketProperties() - { - if (Trace.traceOn_) log(Trace.DIAGNOSTIC, "Getting socket properties."); - if (socketProperties_ == null) return null; - else { - SocketProperties socketProperties = new SocketProperties(); - socketProperties.copyValues(socketProperties_); - return socketProperties; - } - } - - - /** - * Get a list of the system names in the pool. - * - * @return A list of the system names in the pool. - * If the the pool is empty, returns a zero-length list. - **/ - public String[] getSystemNames() - { - Enumeration keys = as400ConnectionPool_.keys(); - Vector hosts = new Vector(); - while (keys.hasMoreElements()) - { - String key = (String)keys.nextElement(); - String host = key.substring(0, key.indexOf("/")); - if (!hosts.contains(host)) hosts.addElement(host); - } - String[] hostsArr = new String[hosts.size()]; - hosts.copyInto(hostsArr); - return hostsArr; - } - - - //@B2A - /** - * Get an enumeration of the systemName/userId pairs in the pool. - * Note: The returned information is regardless of the authentication - * scheme used when filling the pool (e.g. password, profile token). - * - * @return An enumeration of the systemName/userIds in the pool - **/ - public Enumeration getUsers() - { - return as400ConnectionPool_.keys(); - } - - - /** - * Get a list of the userIds in the pool with connections to a specific system. - * UserIds are listed regardless of whether their connections are - * currently active or disconnected. - * Note: The returned information is regardless of the authentication - * scheme used when filling the pool (e.g. password, profile token). - * - * @param systemName The name of the system of interest. - * @return A list of the userIds in the pool for system systemName. - * If there are no userIDs for that system, empty list is returned. - **/ - public String[] getUsers(String systemName) - { - if (systemName == null) throw new NullPointerException("systemName"); - return getUsers(systemName, false); - } - - - /** - * Get a list of the userIds in the pool with connections to a specific system. - * Only userIds with currently active (non-disconnected) connections are listed. - * Note: The returned information is regardless of the authentication - * scheme used when filling the pool (e.g. password, profile token). - * - * @param systemName The name of the system of interest. - * @return A list of the connected userIds in the pool for system systemName. - * If there are no connected userIDs for that system, empty list is returned. - **/ - public String[] getConnectedUsers(String systemName) - { - if (systemName == null) throw new NullPointerException("systemName"); - return getUsers(systemName, true); - } - - - private String[] getUsers(String systemName, boolean listConnectedOnly) - { - Enumeration keys = as400ConnectionPool_.keys(); - Vector users = new Vector(); - systemName = systemName.toUpperCase().trim(); - String compareKey = systemName+"/"; - while (keys.hasMoreElements()) - { - String key = (String)keys.nextElement(); - if (key.startsWith(compareKey)) - { - ConnectionList connections = (ConnectionList)as400ConnectionPool_.get(key); - if (!listConnectedOnly || connections.hasConnectedConnection()) - { - String user = key.substring(key.indexOf("/")+1); - if (!users.contains(user)) users.addElement(user); - } - } - } - String[] usersArr = new String[users.size()]; - users.copyInto(usersArr); - return usersArr; - } - - - /** - * Initializes the transient data. - **/ - private void initializeTransient() - { - // log_ was originally not transient, however the EventLog class (one of the possible - // implementations of the Log interface) uses a java.io.PrintWriter object which is - // not serializable. Therefore, log_ was changed to be transient and the user - // will need to reset log_ after a serialization of the pool. - as400ConnectionPool_ = new Hashtable(); - removedAS400ConnectionPool_ = new Hashtable(); //@A5A - lastRun_ = System.currentTimeMillis(); - connectionHasBeenCreated_ = false; - } - - - /** - * Log the message to the log. - * - * @param msg The message to log. - **/ - private final void log(String msg) - { - if (Trace.traceOn_) - Trace.log(Trace.INFORMATION, msg); - if (log_ != null) - { - log_.log(msg); - } - } - - - /** - * Log the message to the log. - * - * @param category The trace category. - * @param msg The message to log. - **/ - private final void log(int category, String msg) - { - if (Trace.traceOn_ && Trace.isTraceOn(category)) - { - Trace.log(category, msg); - if (log_ != null) - { - log_.log(msg); - } - } - } - - /** - * Log the exception and message to the log. - * - * @param exception The exception to log. - * @param msg The message to log. - **/ - private final void log(Exception exception, String msg) - { - if (Trace.traceOn_) - Trace.log(Trace.ERROR, msg, exception); - if (log_ != null) - { - log_.log(msg, exception); - } - } - - /** - * Deserializes and initializes transient data. - * @exception IOException If a file I/O error occurs. - * @exception ClassNotFoundException If a file error occurs. - **/ - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient(); - } - - //@A6A - /** - * Remove the connections for a systemName/userID. Call this function if connections for a - * particular system/userID would no longer be valid. For example, if you change the password for a - * userId, you will want to call this method to remove the connections for the old userID - * combination. This will not invalidate connections in use; rather it will mean that the next time - * a connection is requested for that userID, a new connection - * will be established to the system. After you call this method, you may want - * to fill the pool with connections with your new password to avoid connection time. - * Note: This method will remove connections regardless of the authentication scheme - * used when filling the pool (e.g. password, profile token). - * - * @param systemName The system name of connections you want to remove. - * @param userID The user ID of connections you want to remove. - **/ - public void removeFromPool(String systemName, String userID) - { - if (systemName == null) - throw new NullPointerException("systemName"); - if (userID == null) - throw new NullPointerException("userID"); - if (Trace.traceOn_) - { - log(Trace.INFORMATION, "removeFromPool("+systemName+","+userID); - } - systemName = AS400.resolveSystem(systemName); - userID = AS400.resolveUserId(userID.toUpperCase()); //@KBA - String key = createKey(systemName, userID); - ConnectionList listToBeRemoved = (ConnectionList)as400ConnectionPool_.get(key); - if (listToBeRemoved != null) - { - listToBeRemoved.removeUnusedElements(); // this disconnects the connections - removedAS400ConnectionPool_.put(key, listToBeRemoved); - as400ConnectionPool_.remove(key); - } - else if (Trace.traceOn_) - { - log(Trace.WARNING, "A list of connections for: " + key + " does not exist."); - } - } - - private static final boolean DISCARD_CONNECTION = true; - - /** - * Remove the specified connection from the pool, and disconnect it. - * Call this function if a specific connection has been discovered to - * no longer be valid. - *

    - * This method should only be called by the process or thread to which - * the connection is currently allocated; that is, - * the process or thread that most recently obtained the connection - * via getConnection() or getSecureConnection(). - * To remove the connection from the pool, the process or thread - * holding the connection should call this method rather than - * {@link #returnConnectionToPool returnConnectionToPool()}. - *

    - * Caution: The pool does not verify that the process or thread removing - * the connection, is the same as the process or thread to which - * the connection is currently allocated. - * This may cause unpredictable results if the connection is in use - * by another process or thread. - * - * @param system The system to remove from the pool. - **/ - public void removeFromPool(AS400 system) - { - if (system == null) throw new NullPointerException("system"); - if (Trace.traceOn_) - { - log(Trace.INFORMATION, "removeFromPool() key= " + system.getSystemName() + "/" + system.getUserId() + "; hashcode= " + system.hashCode()); - } - - // Remove the connection from the pool, and disconnect it. - acceptReturnedConnection(system, DISCARD_CONNECTION); - } - - /** - * Return the AS400 object to the connection pool. - *

    - * This method should only be called by the process or thread to which - * the connection is currently allocated; that is, - * the process or thread that most recently obtained the connection - * via getConnection() or getSecureConnection(). - *

    - * Caution: The pool does not verify that the process or thread returning - * the connection, is the same as the process or thread to which - * the connection is currently allocated. - * This may cause unpredictable results if the connection is in use - * by another process or thread. - * - * @param system The system to return to the pool. - * @see #removeFromPool(AS400) - **/ - public void returnConnectionToPool(AS400 system) - //@A4D throws AS400SecurityException, IOException, ConnectionPoolException - { - // This method searches the lists of connections for a reference to the AS400 - // object that was returned. There will be one list per systemName/userId key. - if (system == null) throw new NullPointerException("system"); - if (Trace.traceOn_) - { - log(Trace.INFORMATION, "returnConnectionToPool() key= " + system.getSystemName() + "/" + system.getUserId()); //@A5A - } - - // Return the connection to the pool, making it available for re-use. - acceptReturnedConnection(system, !DISCARD_CONNECTION); - - //If running single-threaded and cleanup interval has elapsed, run cleanup. - if (!isThreadUsed() && isRunMaintenance() && - ((System.currentTimeMillis() - lastRun_) > getCleanupInterval())) //@D1C replace maintenance_.getLastTime() with lastRun_ - { - cleanupConnections(); - } - } - - - /** - Process a connection that is being returned to the pool. - @param discardConnection Whether the connection should be discarded, or retained in the pool (and made available for subsequent re-use). - **/ - private void acceptReturnedConnection(AS400 system, boolean discardConnection) - { - String key = createKey(system.getSystemName(), system.getUserId()); - ConnectionList connections = (ConnectionList)as400ConnectionPool_.get(key); - PoolItem poolItem = null; - - // First look for the list for the systemName/userId key for the AS400 object. - // If such a list exists, search that list for a reference to the AS400 object returned. - if (connections != null) - { - poolItem = connections.findElement(system); - } - - // If such an item is found, set it "not in use" and send an event that the connection was returned to the pool. - if (poolItem != null) - { - if (discardConnection) // caller wants the connection deleted from the pool - { - if (Trace.traceOn_) { - log(Trace.DIAGNOSTIC, "Disconnecting pooled connection because removeFromPool() was invoked for that connection."); - } - connections.removeElement(system); - poolItem.getAS400Object().disconnectAllServices(); - } - else // caller is simply returning the connection to the pool - { - // Before making the connection available for re-use, see if it's expired. - boolean removed = connections.removeIfExpired(poolItem, poolListeners_); - if (!removed) { - poolItem.setInUse(false); // indicate that this connection is available - } - if (log_ != null || Trace.traceOn_) - { - log(ResourceBundleLoader.substitute(ResourceBundleLoader.getText("AS400CP_RETCONN"), new String[] {system.getSystemName(), system.getUserId()} )); - } - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(poolItem.getAS400Object(), ConnectionPoolEvent.CONNECTION_RETURNED); //@A7C - poolListeners_.fireConnectionReturnedEvent(event); - } - } - } - - // If the item was not found, search all the lists, looking for a reference to that - // item. If it is found, disconnect it and remove it from the pool since its - // systemName/userId has been changed from what was expected. - if (poolItem == null) - { - Enumeration keys = as400ConnectionPool_.keys(); - while (keys.hasMoreElements()) - { - String tryKey = (String)keys.nextElement(); - ConnectionList connList = (ConnectionList)as400ConnectionPool_.get(tryKey); - poolItem = connList.findElement(system); - if (poolItem != null) - { - if (Trace.traceOn_) - { - log(Trace.WARNING, "Disconnecting pooled connection because it was returned, and belongs to a different list than expected."); - } - connList.removeElement(system); - poolItem.getAS400Object().disconnectAllServices(); - break; - } - } - } - - // A list of connections will - // be moved into the removed pool if removeFromPool() with the systemName/userId of the - // list is called. This allows us to keep references to an AS400 object until - // the user calls returnConnectionToPool() on it, but not give it out again - // to the user. - // Code was added here to handle checking in removed pool for the connection - // and removing it from that pool if it is found. - - // If the pooled connection was not found in the regular lists, start looking - // in the lists in the removed pool. - if (poolItem == null) - { - ConnectionList removedConnections = (ConnectionList)removedAS400ConnectionPool_.get(key); - - // Start looking in the list with the systemName/userId combination. - if (removedConnections != null) - { - poolItem = removedConnections.findElement(system); - } - - // If the object is found, disconnect it and remove the element from removed pool. - if (poolItem != null) - { - if (Trace.traceOn_) - { - log(Trace.DIAGNOSTIC, "Disconnecting pooled connection because it was returned, and removeFromPool() has been called for its systemName/userID."); - } - removedConnections.removeElement(system); - poolItem.getAS400Object().disconnectAllServices(); - if (log_ != null || Trace.traceOn_) - { - log(ResourceBundleLoader.substitute(ResourceBundleLoader.getText("AS400CP_RETCONN"), new String[] {system.getSystemName(), system.getUserId()} )); - } - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(poolItem.getAS400Object(), ConnectionPoolEvent.CONNECTION_RETURNED); //@A7C - poolListeners_.fireConnectionReturnedEvent(event); - } - } - - // If the object was not found, search through every list in the removed pool, - // looking for a reference to the object. - if (poolItem == null) - { - Enumeration keys = removedAS400ConnectionPool_.keys(); - while (keys.hasMoreElements()) - { - String tryKey = (String)keys.nextElement(); - ConnectionList connList = (ConnectionList)removedAS400ConnectionPool_.get(tryKey); - poolItem = connList.findElement(system); - if (poolItem != null) - { - if (Trace.traceOn_) - { - log(Trace.DIAGNOSTIC, "Disconnecting pooled connection because it was returned, and removeFromPool() has been called for its systemName/userID."); - } - connList.removeElement(system); - poolItem.getAS400Object().disconnectAllServices(); - break; - } - } - } - - // If the object was not found in any of our lists, it does not belong to this pool. - // In that case, just disconnect the connection. - if (poolItem == null) - { - if (discardConnection) // the caller wants the connection disconnected - { - if (Trace.traceOn_) { - log(Trace.WARNING, "Disconnecting pooled connection because removeFromPool(AS400) was called. The connection is not currently a member of this pool."); - } - } - else { - log(Trace.ERROR, "Disconnecting pooled connection because it was returned, and the connection is not currently a member of this pool."); - } - system.disconnectAllServices(); - } - } - } - - /** - * Notify the maintenance thread to run cleanupConnections(). - * @param reduced true if need to check current num connections; false otherwise. - **/ - void runMaintenance(boolean reduced) - { - if (maintenance_ != null) - { - synchronized(maintenance_) - { - if (maintenance_.isRunning()) - { - if (reduced) - { - synchronized (as400ConnectionPool_) - { - Enumeration keys = as400ConnectionPool_.keys(); - while (keys.hasMoreElements()) - { - String key = (String)keys.nextElement(); - try - { - ConnectionList connList = (ConnectionList)as400ConnectionPool_.get(key); - connList.shutDownOldest(); - } - catch (Exception e) - { - if (log_ != null || Trace.traceOn_) - log(e, key); - } - } - } - } - //@A6A Start new code - synchronized (removedAS400ConnectionPool_) - { - Enumeration removedKeys = removedAS400ConnectionPool_.keys(); - while (removedKeys != null && removedKeys.hasMoreElements()) - { - //go through each list of systemName/userID - String key = (String)removedKeys.nextElement(); - ConnectionList connList = (ConnectionList)removedAS400ConnectionPool_.get(key); - //disconnect and remove any unused connections from the list - if (!connList.removeUnusedElements()) // this disconnects the connections - { - //if there are no more connections remaining, remove the - //list from the pool - removedAS400ConnectionPool_.remove(key); - } - - } - } - //@A6A End new code - - maintenance_.notify(); // PoolMaintenance.run() calls ConnectionPool.cleanupConnections() - } - } - } - } - - - /** - * Sets the CCSID to use when creating new connections. - * The default value is the system default CCSID as determined by the AS400 class. - * Note: This method only affects the CCSID of newly-created connections. - * Existing connections are not affected. - * @param ccsid The CCSID to use for connections in the pool, or {@link #CCSID_DEFAULT CCSID_DEFAULT} to indicate that the system default CCSID should be used. - **/ - public void setCCSID(int ccsid) - { - if (Trace.traceOn_) { - Trace.log(Trace.INFORMATION, "setCCSID("+ccsid+")"); - if (connectionHasBeenCreated_) { - log(Trace.WARNING, "setCCSID() was called after the pool already contains connections."); - } - } - super.setCCSID(ccsid); - } - - - - /** - * Set the Log object to log events. The default is to not log events. - * - * @param log The log object to use, or null if events should not be logged. - * - * @see com.ibm.as400.access.Log - **/ - public void setLog(Log log) - { - if (Trace.traceOn_) { - String val = ( log == null ? "null" : log.toString() ); - Trace.log(Trace.INFORMATION, "setLog("+val+")"); - } - this.log_ = log; - } - - - - /** - Sets the socket properties that this AS400ConnectionPool specifies when it creates new AS400 objects, for example in fill(), getConnection(), or getSecureConnection(). -
    Note that properties will apply only to AS400 objects created after this method is called. Any AS400 objects already in the pool are not affected. - - @param properties The socket properties. If null, then this AS400ConnectionPool will specify no socket properties when it creates new AS400 objects. That is, setSocketProperties(null) cancels the effects of any previous setSocketProperties(). - **/ - public void setSocketProperties(SocketProperties properties) - { - if (Trace.traceOn_) { - Trace.log(Trace.INFORMATION, "setSocketProperties()"); - } - socketProperties_ = properties; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400ConnectionPool16.gif b/cvsroot/src/com/ibm/as400/access/AS400ConnectionPool16.gif deleted file mode 100644 index 3952a93a2..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400ConnectionPool16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400ConnectionPool32.gif b/cvsroot/src/com/ibm/as400/access/AS400ConnectionPool32.gif deleted file mode 100644 index 5ddd70fdd..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400ConnectionPool32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400ConnectionPoolAuthentication.java b/cvsroot/src/com/ibm/as400/access/AS400ConnectionPoolAuthentication.java deleted file mode 100644 index 5a1fc9880..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400ConnectionPoolAuthentication.java +++ /dev/null @@ -1,116 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400ConnectionPool.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2008 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; -import com.ibm.as400.security.auth.ProfileTokenCredential; - - -/** - * The AS400ConnectionPoolAuthentication class is used to contain information regarding - * the type of authentication being used. - * This class is constructed by the AS400ConnectionPool class and passed to a number of underlying classes. - * By containing the authentication information in this class, only the public methods of AS400ConnectionPool - * need to expose the authentication method (e.g. user/password, ProfileTokenCredential) to the user. - * The methods of the underlying classes may begin to utilize the AS400ConnectionPoolAuthentication as a - * method parameter. - **/ -class AS400ConnectionPoolAuthentication // Package scoped class -{ - // This variable will be set to one of the AS400.AUTHENTICATION_SCHEME_xxx values - // to indicate the authentication scheme used for this object. - private int authenticationScheme_ = -1; - - // For AS400.AUTHENTICATION_SCHEME_PASSWORD retain the password. - private String password_ = null; - - // For AS400.AUTHENTICATION_SCHEME_PROFILE_TOKEN retain the token. - private ProfileTokenCredential profileToken_; - - /** - * Constructs an AS400ConnectionPool for AS400.AUTHENTICATION_SCHEME_PASSWORD - **/ - AS400ConnectionPoolAuthentication(String password) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing AS400ConnectionPoolAuthentication object (password)"); - if (password == null) - { - Trace.log(Trace.DIAGNOSTIC, "Parameter 'password' is null (password prompt may be used)."); - //throw new NullPointerException("password"); - } - - password_ = password; - authenticationScheme_ = AS400.AUTHENTICATION_SCHEME_PASSWORD; - } - - /** - * Constructs an AS400ConnectionPool for AS400.AUTHENTICATION_SCHEME_PROFILE_TOKEN - **/ - AS400ConnectionPoolAuthentication(ProfileTokenCredential profileToken) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing AS400ConnectionPoolAuthentication object (ProfileTokenCredential)"); - if (profileToken == null) - { - Trace.log(Trace.ERROR, "Parameter 'profileToken' is null."); - throw new NullPointerException("profileToken"); - } - profileToken_ = profileToken; - authenticationScheme_ = AS400.AUTHENTICATION_SCHEME_PROFILE_TOKEN; - } - - /** - * Retrieve the authentication scheme - * Current supported values: - * AS400.AUTHENTICATION_SCHEME_PASSWORD - * AS400.AUTHENTICATION_SCHEME_PROFILE_TOKEN - **/ - int getAuthenticationScheme() - { - return (authenticationScheme_); - } - - /** - * Retrieve the password if using AS400.AUTHENTICATION_SCHEME_PASSWORD - * else null will be returned. - * @return The password - **/ - String getPassword() - { - if (authenticationScheme_ == AS400.AUTHENTICATION_SCHEME_PASSWORD) - { - return (password_); - } - else - { - return (null); - } - } - - /** - * Retrieve the ProfileTokenCredential if using AS400.AUTHENTICATION_SCHEME_PROFILE_TOKEN - * else null will be returned. - * @return The profile token. - **/ - ProfileTokenCredential getProfileToken() - { - if (authenticationScheme_ == AS400.AUTHENTICATION_SCHEME_PROFILE_TOKEN) - { - return (profileToken_); - } - else - { - return (null); - } - } - - -} //End of AS400ConnectionPoolAuthentication class diff --git a/cvsroot/src/com/ibm/as400/access/AS400ConnectionPoolBeanInfo.java b/cvsroot/src/com/ibm/as400/access/AS400ConnectionPoolBeanInfo.java deleted file mode 100644 index 670a72c52..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400ConnectionPoolBeanInfo.java +++ /dev/null @@ -1,147 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400ConnectionPoolBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - -/** -* The AS400ConnectionPoolBeanInfo class provides the bean information -* for the AS400ConnectionPool class. -**/ -public class AS400ConnectionPoolBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = AS400ConnectionPool.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - - private static EventSetDescriptor[] events_; - // private static PropertyDescriptor[] properties_; @D1d - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = {changed}; - - events_ = events; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - /** - * Returns additional bean information from the ConnectionPool superclass. - * @return The bean information. - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new ConnectionPoolBeanInfo() }; - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - // @D1d - // public int getDefaultPropertyIndex() - // { - // return 0; - // } - - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("AS400ConnectionPool16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("AS400ConnectionPool32.gif"); - break; - } - - return image; - } - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - // @D1d - // public PropertyDescriptor[] getPropertyDescriptors() - // { - // return properties_; - // } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/AS400DataType.java b/cvsroot/src/com/ibm/as400/access/AS400DataType.java deleted file mode 100644 index 53e006d8d..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400DataType.java +++ /dev/null @@ -1,216 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400DataType.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; - -/** - Provides an interface for conversions between Java objects and byte arrays representing IBM i data types. - **/ -public interface AS400DataType extends Cloneable, Serializable -{ - static final long serialVersionUID = 4L; - - - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400Array AS400Array} object. - * @see #getInstanceType - **/ - public static final int TYPE_ARRAY = 0; - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400Bin2 AS400Bin2} object. - * @see #getInstanceType - **/ - public static final int TYPE_BIN2 = 1; - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400Bin4 AS400Bin4} object. - * @see #getInstanceType - **/ - public static final int TYPE_BIN4 = 2; - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400Bin8 AS400Bin8} object. - * @see #getInstanceType - **/ - public static final int TYPE_BIN8 = 3; - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400ByteArray AS400ByteArray} object. - * @see #getInstanceType - **/ - public static final int TYPE_BYTE_ARRAY = 4; - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400Float4 AS400Float4} object. - * @see #getInstanceType - **/ - public static final int TYPE_FLOAT4 = 5; - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400Float8 AS400Float8} object. - * @see #getInstanceType - **/ - public static final int TYPE_FLOAT8 = 6; - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400PackedDecimal AS400PackedDecimal} object. - * @see #getInstanceType - **/ - public static final int TYPE_PACKED = 7; - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400Structure AS400Structure} object. - * @see #getInstanceType - **/ - public static final int TYPE_STRUCTURE = 8; - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400Text AS400Text} object. - * @see #getInstanceType - **/ - public static final int TYPE_TEXT = 9; - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400UnsignedBin2 AS400UnsignedBin2} object. - * @see #getInstanceType - **/ - public static final int TYPE_UBIN2 = 10; - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400UnsignedBin4 AS400UnsignedBin4} object. - * @see #getInstanceType - **/ - public static final int TYPE_UBIN4 = 11; - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400ZonedDecimal AS400ZonedDecimal} object. - * @see #getInstanceType - **/ - public static final int TYPE_ZONED = 12; - //@DFA - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400DecFloat AS400DecFloat} object. - * @see #getInstanceType - **/ - public static final int TYPE_DECFLOAT = 13; - - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400Bin1 AS400Bin1} object. - * @see #getInstanceType - **/ - public static final int TYPE_BIN1 = 14; - - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400UnsignedBin1 AS400UnsignedBin1} object. - * @see #getInstanceType - **/ - public static final int TYPE_UBIN1 = 15; - - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400UnsignedBin8 AS400UnsignedBin8} object. - * @see #getInstanceType - **/ - public static final int TYPE_UBIN8 = 16; - - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400Date AS400Date} object. - * @see #getInstanceType - **/ - public static final int TYPE_DATE = 17; - - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400Time AS400Time} object. - * @see #getInstanceType - **/ - public static final int TYPE_TIME = 18; - - /** - * @deprecated Use {@link #TYPE_TIME TYPE_TIME} instead. - **/ - public static final int TYPE_TIME_OF_DAY = TYPE_TIME; - - /** - * Constant representing the instance of this class is an {@link com.ibm.as400.access.AS400Timestamp AS400Timestamp} object. - * @see #getInstanceType - **/ - public static final int TYPE_TIMESTAMP = 19; - - - - /** - * Creates a new AS400DataType object that is identical to the current instance. - * @return The new object. - **/ - public abstract Object clone(); // Implementers must provide a clone() method that is public and does not throw CloneNotSupported Exception - - /** - * Returns the byte length of the data type. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public abstract int getByteLength(); - - /** - * Returns a Java object representing the default value of the data type. - * @return The Object of the corresponding data type. - **/ - public abstract Object getDefaultValue(); - - - /** - * Returns an integer constant representing the type of class that implements - * this interface. This is typically faster than using the instanceof operator, and may prove useful - * where code needs a primitive type for ease of calculation. - * Possible values for standard com.ibm.as400.access classes that implement this - * interface are provided as constants in this class. Note that any implementing class provided - * by a third party is not guaranteed to correctly return one of the pre-defined constants. - * @return The type of object implementing this interface. - **/ - public abstract int getInstanceType(); - - /** - * Returns the Java class that corresponds with this data type. - * @return The corresponding Java class for this data type. - **/ - public abstract Class getJavaType(); - - - /** - * Converts the specified Java object to IBM i format. - * @param javaValue The object corresponding to the data type. It must be an instance of the correct type. - * @return The IBM i representation of the data type. - **/ - public abstract byte[] toBytes(Object javaValue); - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of the correct type. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public abstract int toBytes(Object javaValue, byte[] as400Value); - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of the correct type. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public abstract int toBytes(Object javaValue, byte[] as400Value, int offset); - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The object corresponding to the data type. - **/ - public abstract Object toObject(byte[] as400Value); - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The object corresponding to the data type. - **/ - public abstract Object toObject(byte[] as400Value, int offset); -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Date.java b/cvsroot/src/com/ibm/as400/access/AS400Date.java deleted file mode 100644 index 3e477603e..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400Date.java +++ /dev/null @@ -1,878 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Date.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2010-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Calendar; -import java.util.Hashtable; -import java.text.ParseException; - -/** - Provides a converter between a {@link java.sql.Date java.sql.Date} object and an IBM i date value such as "12/31/97". - In the IBM i programming reference, this type is referred to as the "Date Data Type", or DDS data type L. Note: Only date fields that are stored on the IBM i system as EBCDIC characters are currently supported by this class. (Some IBM i "logical files" have date fields stored as zoned or packed decimal values.) -

    - An IBM i date value simply indicates a year/month/day, and does not indicate a contextual time zone. Internally, this class interprets all date- and time-related strings as relative to the GMT time zone. -

    - Suggestion: To avoid confusion and unexpected results when crossing time zones: -
    Whenever creating or interpreting instances of {@link java.sql.Date java.sql.Date}, {@link java.sql.Time java.sql.Time}, or {@link java.sql.Timestamp java.sql.Timestamp}, always assume that the reference time zone for the object is GMT, and avoid using any deprecated methods. If it is necessary to convert date/time values between GMT and other time zones, use methods of Calendar. Rather than using toString() to display the value of a date/time object, use DateFormat.format() after specifying a GMT TimeZone. - For example: - - import java.text.SimpleDateFormat; - java.sql.Date date1; // value to be generated by AS400Date - SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); - // Set the formatter's time zone to GMT. - formatter.setTimeZone(java.util.TimeZone.getTimeZone("GMT-0")); - ... - System.out.println("Date value: " + formatter.format(date1)); - - -

    - Suggestion: To avoid ambiguity and confusion between different kinds of "Date" objects, fully qualify all references to classes java.util.Date and java.sql.Date (especially if you import both java.util.* and java.sql.*). -

    - Note: In the descriptions of the "format" constants, all example dates represent the date April 25, 1997. - - @see AS400Time - @see AS400Timestamp - **/ -public class AS400Date extends AS400AbstractTime -{ - private java.sql.Date defaultValue_; - private static Hashtable formatsMap_; - - /** Date format MDY (mm/dd/yy). -
    Example: 04/25/97 -
    Range of years: 1940-2039 -
    Default separator: '/' **/ - public static final int FORMAT_MDY = 0; - - /** Date format DMY (dd/mm/yy). -
    Example: 25/04/97 -
    Range of years: 1940-2039 -
    Default separator: '/' **/ - public static final int FORMAT_DMY = 1; - - /** Date format YMD (yy/mm/dd). -
    Example: 97/04/25 -
    Range of years: 1940-2039 -
    Default separator: '/' **/ - public static final int FORMAT_YMD = 2; - - /** Date format JUL (yy/ddd). -
    Example: 97/115 -
    Range of years: 1940-2039 -
    Default separator: '/' **/ - public static final int FORMAT_JUL = 3; - - /** Date format ISO (yyyy-mm-dd). -
    Example: 1997-04-25 -
    Range of years: 0001-9999 -
    Default separator: '-' **/ - public static final int FORMAT_ISO = 4; - - /** Date format USA (mm/dd/yyyy). -
    Example: 04/25/1997 -
    Range of years: 0001-9999 -
    Default separator: '/' **/ - public static final int FORMAT_USA = 5; - - /** Date format EUR (dd.mm.yyyy). -
    Example: 25.04.1997 -
    Range of years: 0001-9999 -
    Default separator: '.' **/ - public static final int FORMAT_EUR = 6; - - /** Date format JIS (yyyy-mm-dd). -
    Example: 1997-04-25 -
    Range of years: 0001-9999 -
    Default separator: '-' **/ - public static final int FORMAT_JIS = 7; - - // Externally defined date formats: - - /** Date format CYMD (cyy/mm/dd). -
    Example: 097/04/25 -
    Range of years: 1900-2899 -
    Default separator: '/' **/ - public static final int FORMAT_CYMD = 8; - - /** Date format CMDY (cmm/dd/yy). -
    Example: 004/25/97 -
    Range of years: 1900-2899 -
    Default separator: '/' **/ - public static final int FORMAT_CMDY = 9; - - /** Date format CDMY (cdd/mm/yy). -
    Example: 025/04/97 -
    Range of years: 1900-2899 -
    Default separator: '/' **/ - public static final int FORMAT_CDMY = 10; - - /** Date format LONGJUL (yyyy/ddd). -
    Example: 1997/115 -
    Range of years: 0001-9999 -
    Default separator: '/' **/ - public static final int FORMAT_LONGJUL = 11; - - /** Date format MY (mm/yy). -
    Example: 04/97 -
    Range of years: 1940-2039 -
    Default separator: '/' **/ - public static final int FORMAT_MY = 12; - - /** Date format YM (yy/mm). -
    Example: 97/04 -
    Range of years: 1940-2039 -
    Default separator: '/' **/ - public static final int FORMAT_YM = 13; - - /** Date format MYY (mm/yyyy). -
    Example: 04/1997 -
    Range of years: 0001-9999 -
    Default separator: '/' **/ - public static final int FORMAT_MYY = 14; - - /** Date format YYM (yyyy/mm). -
    Example: 1997/04 -
    Range of years: 0001-9999 -
    Default separator: '/' **/ - public static final int FORMAT_YYM = 15; - - - // Note to maintenance programmer: Update these values when adding new formats. - private static final int FORMAT_RANGE_MINIMUM = FORMAT_MDY; - private static final int FORMAT_RANGE_MAXIMUM = FORMAT_YYM; - - - /** - Constructs an AS400Date object. - Format {@link #FORMAT_ISO FORMAT_ISO} and separator '-' are used. - **/ - public AS400Date() - { - this(FORMAT_ISO); - } - - /** - Constructs an AS400Date object. - The specified format's default separator is used. - @param format The date format. - For a list of valid values, refer to {@link #AS400Date(int,Character) AS400Date(int,Character)}. - **/ - public AS400Date(int format) - { - setFormat(format, defaultSeparatorFor(format)); - } - - /** - Constructs an AS400Date object. - The specified format's default separator is used. - @param format The date format. -
    Valid values are: -

      -
    • {@link #FORMAT_MDY FORMAT_MDY} -
    • {@link #FORMAT_DMY FORMAT_DMY} -
    • {@link #FORMAT_YMD FORMAT_YMD} -
    • {@link #FORMAT_JUL FORMAT_JUL} -
    • {@link #FORMAT_ISO FORMAT_ISO} -
    • {@link #FORMAT_USA FORMAT_USA} -
    • {@link #FORMAT_EUR FORMAT_EUR} -
    • {@link #FORMAT_JIS FORMAT_JIS} -
    • {@link #FORMAT_CYMD FORMAT_CYMD} -
    • {@link #FORMAT_CMDY FORMAT_CMDY} -
    • {@link #FORMAT_CDMY FORMAT_CDMY} -
    • {@link #FORMAT_LONGJUL FORMAT_LONGJUL} -
    • {@link #FORMAT_MY FORMAT_MY} -
    • {@link #FORMAT_YM FORMAT_YM} -
    • {@link #FORMAT_MYY FORMAT_MYY} -
    • {@link #FORMAT_YYM FORMAT_YYM} -
    - @param separator The separator character. - Valid values are: - -
      -
    • '&' (ampersand) -
    • ' ' (blank) -
    • ',' (comma) -
    • '-' (hyphen) -
    • '.' (period) -
    • '/' (slash) -
    • (null) -
    -
    - A null value indicates "no separator". - Refer to the IBM i programming reference to determine which separator characters are valid with each format. - **/ - public AS400Date(int format, Character separator) - { - setFormat(format, separator); - } - - - // Overrides method of superclass. - /** - Returns a Java object representing the default value of the data type. - @return A java.sql.Date object with a value of January 1, 1970, 00:00:00 GMT. - **/ - public Object getDefaultValue() - { - if (defaultValue_ == null) { - defaultValue_ = new java.sql.Date(0L); // January 1, 1970 GMT - } - - return defaultValue_; - } - - - // Overrides non-public method of superclass, making it public. - /** - Gets the format of this AS400Date object. - @return format The format for this object. - For a list of possible values, refer to {@link #AS400Date(int,Character) AS400Date(int,Character)}. - **/ - public int getFormat() - { - return super.getFormat(); - } - - /** - Gets the separator character of this AS400Date object. - @return separator The separator character. - For a list of possible values, refer to {@link #AS400Date(int,Character) AS400Date(int,Character)}. - If the format contains no separators, null is returned. - @see #setFormat(int,Character) - **/ - public Character getSeparator() - { - return super.getSeparator(); - } - - // Implements abstract method of superclass. - /** - Returns {@link AS400DataType#TYPE_DATE TYPE_DATE}. - @return AS400DataType.TYPE_DATE. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_DATE; - } - - // Implements abstract method of superclass. - /** - Returns the Java class that corresponds with this data type. - @return java.sql.Date.class. - **/ - public Class getJavaType() - { - return java.sql.Date.class; - } - - - /** - Sets the format of this AS400Date object. - The specified format's default separator character is used. - @param format The format for this object. - For a list of valid values, refer to {@link #AS400Date(int,Character) AS400Date(int,Character)}. - **/ - public void setFormat(int format) - { - super.setFormat(format, defaultSeparatorFor(format)); - } - - - // Method used by DateFieldDescription. - /** - Sets the format of this AS400Date object. - @param format The format for this object, expressed as a string. - For a list of valid values, refer to {@link #toFormat(String) toFormat(String)}. - **/ - void setFormat(String format) - { - super.setFormat(toFormat(format)); - } - - - // Method used by DateFieldDescription. - /** - Sets the separator character of this AS400Date object. - @param separator The separator character. - A null value indicates "no separator". - **/ - void setSeparator(Character separator) - { - super.setSeparator(separator); - } - - - // Overrides non-public method of superclass, making it public. - /** - Sets the format of this AS400Date object. - @param format The format for this object. - For a list of valid values, refer to {@link #AS400Date(int,Character) AS400Date(int,Character)}. - @param separator The separator character. - For a list of valid values, refer to {@link #AS400Date(int,Character) AS400Date(int,Character)}. - A null value indicates "no separator". - Refer to the IBM i programming reference to determine which separator characters are valid with each format. - **/ - public void setFormat(int format, Character separator) - { - super.setFormat(format, separator); - } - - - /** - Sets the format of this AS400Date object. - @param format The format for this object. - For a list of valid values, refer to {@link #AS400Date(int,Character) AS400Date(int,Character)}. - @param separator The separator character. - @deprecated Use {@link #setFormat(int,Character) setFormat(int,Character)} instead. - **/ - public void setFormat(int format, char separator) - { - super.setFormat(format, new Character(separator)); - } - - private static Hashtable getFormatsMap() - { - if (formatsMap_ == null) { - synchronized (AS400Date.class) { - if (formatsMap_ == null) - { - formatsMap_ = new Hashtable(12); - formatsMap_.put("MDY", new Integer(FORMAT_MDY)); - formatsMap_.put("DMY", new Integer(FORMAT_DMY)); - formatsMap_.put("YMD", new Integer(FORMAT_YMD)); - formatsMap_.put("JUL", new Integer(FORMAT_JUL)); - formatsMap_.put("ISO", new Integer(FORMAT_ISO)); - formatsMap_.put("USA", new Integer(FORMAT_USA)); - formatsMap_.put("EUR", new Integer(FORMAT_EUR)); - formatsMap_.put("JIS", new Integer(FORMAT_JIS)); - formatsMap_.put("CYMD", new Integer(FORMAT_CYMD)); - formatsMap_.put("CMDY", new Integer(FORMAT_CMDY)); - formatsMap_.put("CDMY", new Integer(FORMAT_CDMY)); - formatsMap_.put("LONGJUL", new Integer(FORMAT_LONGJUL)); - formatsMap_.put("MY", new Integer(FORMAT_MY)); - formatsMap_.put("YM", new Integer(FORMAT_YM)); - formatsMap_.put("MYY", new Integer(FORMAT_MYY)); - formatsMap_.put("YYM", new Integer(FORMAT_YYM)); - } - } - } - return formatsMap_; - } - - - /** - Returns the integer format value that corresponds to specified format name. - If null is specified, the default format (FORMAT_ISO) is returned. - This method is provided for use by the PCML infrastructure. - @param formatName The date format name. -
    Valid values are: - -
      -
    • MDY -
    • DMY -
    • YMD -
    • JUL -
    • ISO -
    • USA -
    • EUR -
    • JIS -
    • CYMD -
    • CMDY -
    • CDMY -
    • LONGJUL -
    • MY -
    • YM -
    • MYY -
    • YYM -
    -
    - @return the format value. For example, if formatName is "ISO", then {@link #FORMAT_ISO FORMAT_ISO} is returned. - **/ - public static int toFormat(String formatName) - { - if (formatName == null || formatName.length() == 0) { - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, "AS400Date.toFormat("+formatName+"): Returning default date format."); - } - return FORMAT_ISO; - } - - Integer formatInt = (Integer)getFormatsMap().get(formatName.trim().toUpperCase()); - - if (formatInt == null) { - throw new ExtendedIllegalArgumentException("format ("+formatName+")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - return formatInt.intValue(); - } - - static boolean isYearWithinRange(int year, int format) - { - // Valid ranges for 'year' values: - // 2-digit years (YMD,DMY,MDY,JUL,MY,YM): 1940 to 2039 - // 3-digit years (CYMD,CDMY,CMDY): 1900 to 2899 - // 4-digit years (ISO,USA,EUR,JIS,LONGJUL,MYY,YYM): 0001 to 9999 - switch (format) - { - case FORMAT_MDY: - case FORMAT_DMY: - case FORMAT_YMD: - case FORMAT_JUL: - case FORMAT_MY: - case FORMAT_YM: - if (year < 1940 || year > 2039) return false; - else return true; - - case FORMAT_CYMD: - case FORMAT_CMDY: - case FORMAT_CDMY: - if (year < 1900 || year > 2899) return false; - else return true; - - case FORMAT_ISO: - case FORMAT_USA: - case FORMAT_EUR: - case FORMAT_JIS: - case FORMAT_LONGJUL: - case FORMAT_MYY: - case FORMAT_YYM: - if (year < 1 || year > 9999) return false; - else return true; - - default: // should never happen - throw new InternalErrorException(InternalErrorException.UNKNOWN, "Unrecognized format: " + format); - } - } - - // Overrides method of superclass. This allows us to be more specific in the javadoc. - /** - Converts the specified Java object into IBM i format in the specified byte array. - @param javaValue The object corresponding to the data type. It must be an instance of {@link java.sql.Date java.sql.Date}. Hours, minutes, seconds, and milliseconds are disregarded. - @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - return super.toBytes(javaValue, as400Value, offset); - } - - // Implements abstract method of superclass. - /** - Converts the specified IBM i data type to a Java object. - @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @return A {@link java.sql.Date java.sql.Date} object corresponding to the data type. - The reference time zone for the object is GMT. - **/ - public Object toObject(byte[] as400Value, int offset) - { - if (as400Value == null) throw new NullPointerException("as400Value"); - String dateString = getCharConverter().byteArrayToString(as400Value, offset, getLength()); - // Parse the string, and create a java.sql.Date object. - return parse(dateString); - } - - - // Implements abstract method of superclass. - /** - Converts the specified Java object into a String representation that is consistent with the format of this data type. - @param javaValue The object corresponding to the data type. This must be an instance of {@link java.sql.Date java.sql.Date}, and must be within the range specifiable by this data type. - @return A String representation of the specified value, formatted appropriately for this data type. - **/ - public String toString(Object javaValue) - { - if (javaValue == null) throw new NullPointerException("javaValue"); - java.sql.Date dateObj; - try { dateObj = (java.sql.Date)javaValue; } - catch (ClassCastException e) { - Trace.log(Trace.ERROR, "javaValue is of type " + javaValue.getClass().getName()); - throw e; - } - - // Verify that the 'year' value from the date is within the range of our format. - int year, era; - synchronized (this) { - Calendar cal = getCalendar(dateObj); - year = cal.get(Calendar.YEAR); - era = cal.get(Calendar.ERA); - } - if (era == 0) { // we can't represent years BCE - throw new ExtendedIllegalArgumentException("javaValue (era=0)", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (!isYearWithinRange(year, getFormat())) { - Trace.log(Trace.ERROR, "Year " + year + " is outside the range of values for AS400Date format " + getFormat()); - throw new ExtendedIllegalArgumentException("javaValue (year=" + year + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - String dateString = getDateFormatter().format(dateObj); - - // Depending on the format, prepend a "century" digit if needed. - dateString = addCenturyDigit(dateString, dateObj); - return dateString; - } - - /** - Converts a string representation of a date, to a Java object. - @param source A date value expressed as a string in the format specified for this AS400Date object. - @return A {@link java.sql.Date java.sql.Date} object representing the specified date. - The reference time zone for the object is GMT. - **/ - public java.sql.Date parse(String source) - { - if (source == null) throw new NullPointerException("source"); - try - { - // Some formats contain a century digit. - // Deal with the 'century' digit, if the pattern for this format includes one. - Integer centuryDigit = parseCenturyDigit(source, getFormat()); - if (centuryDigit != null) { - // To avoid confusing SimpleDateFormat, remove the century digit. - source = source.substring(1); - } - else { - // The formats MDY, DMY, YMD, and JUL represent the year as 2 digits. - // For those formats, we need to deduce the century based on the 'yy' value. - centuryDigit = disambiguateCentury(source); - } - - java.util.Date dateObj = getDateFormatter(centuryDigit).parse(source); - return new java.sql.Date(dateObj.getTime()); - } - catch (Exception e) { - // Assume that the exception is because we got bad input. - Trace.log(Trace.ERROR, e.getMessage(), source); - Trace.log(Trace.ERROR, "Date string is expected to be in format: " + prependCentury(patternFor(getFormat(), getSeparator()))); // Prepend 'century' indicator if needed. - throw new ExtendedIllegalArgumentException("source ("+source+")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - /** - Converts the specified ISO representation of a date, to a Java object. - This method is provided for use by the PCML infrastructure; - in particular, when parsing 'init=' values for 'date' data elements. - @param source A date value expressed as a string in format yyyy-MM-dd. - @return A {@link java.sql.Date java.sql.Date} object representing the specified date. - The reference time zone for the object is GMT. - **/ - public static java.sql.Date parseXsdString(String source) - { - if (source == null) throw new NullPointerException("source"); - try - { - java.util.Date simpleDateObj = getDateFormatterXSD().parse(source); - return new java.sql.Date(simpleDateObj.getTime()); - } - catch (ParseException e) { - // Assume that the exception is because we got bad input. - Trace.log(Trace.ERROR, e.getMessage(), source); - Trace.log(Trace.ERROR, "Value is expected to be in standard XML Schema 'date' format: " + DATE_PATTERN_XSD); - throw new ExtendedIllegalArgumentException("source ("+source+")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - - /** - Converts the specified Java object into an XML Schema string representation. - This method is provided for use by the PCML infrastructure. - @param javaValue The object corresponding to the data type. This must be an instance of {@link java.sql.Date java.sql.Date}, and must be within the range specifiable by this data type. - @return The date expressed as a string in format yyyy-MM-dd. - **/ - public static String toXsdString(Object javaValue) - { - if (javaValue == null) throw new NullPointerException("javaValue"); - java.sql.Date dateObj; - try { dateObj = (java.sql.Date)javaValue; } - catch (ClassCastException e) { - Trace.log(Trace.ERROR, "javaValue is of type " + javaValue.getClass().getName()); - throw e; - } - - return getDateFormatterXSD().format(dateObj); - } - - - // If the format includes a "century" digit, prepend a 'C' to the pattern string. - private String prependCentury(String pattern) - { - switch (getFormat()) - { - case FORMAT_CYMD: - case FORMAT_CMDY: - case FORMAT_CDMY: - return "C"+pattern; - - default: - return pattern; - } - } - - - // If the format includes a "century" digit, prepend the appropriate century value. - private String addCenturyDigit(String dateString, java.sql.Date dateObj) - { - switch (getFormat()) - { - case FORMAT_CYMD: - case FORMAT_CMDY: - case FORMAT_CDMY: - int year = getCalendar(dateObj).get(Calendar.YEAR); - int century = (year/100) - 19; // IBM i convention: Years '19xx' are in century '0' - // Assume that the caller has verified that date is within our year range, and that the era is not BCE. - return Integer.toString(century) + dateString; - - default: - return dateString; // nothing to prepend, so return string unaltered - } - } - - - // Determines the century, if the specified format has only a 2-digit year and no century digit. - // Returns null if the century is unambiguous in the specified format. - private Integer disambiguateCentury(String dateString) - { - int offsetToYear; // offset within dateString, to the 'yy' - switch (getFormat()) - { - case FORMAT_YMD: // yy/mm/dd - case FORMAT_JUL: // yy/ddd - case FORMAT_YM: // yy/mm - offsetToYear = 0; - break; - - case FORMAT_MY: // mm/yy - if (getSeparator() == null) offsetToYear = 2; - else offsetToYear = 3; - break; - - case FORMAT_MDY: // mm/dd/yy - case FORMAT_DMY: // dd/mm/yy - if (getSeparator() == null) offsetToYear = 4; - else offsetToYear = 6; - break; - - default: - return null; // other formats don't have a 'century' digit - } - - // Range of years representable in the above 2-digit year formats: 1940-2039 - int year, century; - year = Integer.parseInt(dateString.substring(offsetToYear, offsetToYear+2)); - if (year < 40) century = 1; // century 1 is years 2000-2099 - else century = 0; // century 0 is years 1900-1999 - - return new Integer(century); - } - - - // Parses the leading 'century' digit, if the specified format contains one. - // Returns null if the format has no century digit. - static Integer parseCenturyDigit(String dateString, int format) - { - switch (format) - { - case FORMAT_CYMD: - case FORMAT_CMDY: - case FORMAT_CDMY: - return Integer.valueOf(Character.toString(dateString.charAt(0))); - - default: - return null; // other formats don't have a 'century' digit - } - } - - - // Implements abstract method of superclass. - String patternFor(int format, Character separator) - { - String sep = ( separator == null ? "" : separator.toString()); - switch (format) - { - case FORMAT_MY: return "MM"+sep+"yy"; - case FORMAT_YM: return "yy"+sep+"MM"; - case FORMAT_MYY: return "MM"+sep+"yyyy"; - case FORMAT_YYM: return "yyyy"+sep+"MM"; - - case FORMAT_MDY: return "MM"+sep+"dd"+sep+"yy"; - case FORMAT_DMY: return "dd"+sep+"MM"+sep+"yy"; - case FORMAT_YMD: return "yy"+sep+"MM"+sep+"dd"; - case FORMAT_JUL: return "yy"+sep+"DDD"; - - case FORMAT_ISO: - case FORMAT_JIS: return "yyyy"+sep+"MM"+sep+"dd"; - case FORMAT_USA: return "MM"+sep+"dd"+sep+"yyyy"; - case FORMAT_EUR: return "dd"+sep+"MM"+sep+"yyyy"; - - // For the following "FORMAT_C..." formats, we deal with the century digit separately. - // SimpleDateFormat doesn't have a "century digit" pattern. - case FORMAT_CYMD: return "yy"+sep+"MM"+sep+"dd"; - case FORMAT_CMDY: return "MM"+sep+"dd"+sep+"yy"; - case FORMAT_CDMY: return "dd"+sep+"MM"+sep+"yy"; - - case FORMAT_LONGJUL: return "yyyy"+sep+"DDD"; - - default: // should never happen - throw new InternalErrorException(InternalErrorException.UNKNOWN, "Unrecognized format: " + format); - } - } - - - // Implements abstract method of superclass. - Character defaultSeparatorFor(int format) - { - if (!isValidFormat(format)) { - throw new ExtendedIllegalArgumentException("format ("+format+")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - switch (format) - { - case FORMAT_MDY: - case FORMAT_DMY: - case FORMAT_YMD: - case FORMAT_JUL: - case FORMAT_USA: - case FORMAT_CYMD: - case FORMAT_CMDY: - case FORMAT_CDMY: - case FORMAT_LONGJUL: - case FORMAT_MY: - case FORMAT_YM: - case FORMAT_MYY: - case FORMAT_YYM: - return SLASH; // '/' - - case FORMAT_ISO: - case FORMAT_JIS: - return HYPHEN; // '-' - - case FORMAT_EUR: - return PERIOD; // '.' - - default: // should never happen - throw new InternalErrorException(InternalErrorException.UNKNOWN, "Unrecognized format: " + format); - } - } - - // Implements abstract method of superclass. - boolean isValidFormat(int format) - { - return validateFormat(format); - } - - /** - Validates the specified format value. - This method is provided for use by the PCML infrastructure. - @param format The format. - For a list of valid values, refer to {@link #AS400Date(int,Character) AS400Date(int,Character)}. - @return true if the format is valid; false otherwise. - **/ - public static boolean validateFormat(int format) - { - if (format < FORMAT_RANGE_MINIMUM || format > FORMAT_RANGE_MAXIMUM) return false; - else return true; - } - - - /** - Returns the number of bytes occupied on the IBM i system by a field of this type. - This method is provided for use by the PCML infrastructure. - @param format The format. - For a list of valid values, refer to {@link #AS400Date(int,Character) AS400Date(int,Character)}. - @param separator The separator character. - For a list of valid values, refer to {@link #AS400Date(int,Character) AS400Date(int,Character)}. - @return the number of bytes occupied. - **/ - public static int getByteLength(int format, Character separator) - { - if (separator == null) // the pattern contains no separators - { - switch (format) - { - case FORMAT_MY: - case FORMAT_YM: - return 4; - - case FORMAT_MDY: - case FORMAT_DMY: - case FORMAT_YMD: - case FORMAT_MYY: - case FORMAT_YYM: - return 6; - - case FORMAT_LONGJUL: - return 7; - - case FORMAT_JUL: - return 5; - - case FORMAT_ISO: - case FORMAT_USA: - case FORMAT_EUR: - case FORMAT_JIS: - return 8; - - case FORMAT_CYMD: - case FORMAT_CMDY: - case FORMAT_CDMY: - return 7; - - default: // should never happen - throw new InternalErrorException(InternalErrorException.UNKNOWN, "Unrecognized format: " + format); - } - } - else // the pattern contains separator(s) - { - switch (format) - { - case FORMAT_MY: - case FORMAT_YM: - return 5; - - case FORMAT_JUL: - return 6; - - case FORMAT_MYY: - case FORMAT_YYM: - return 7; - - case FORMAT_MDY: - case FORMAT_DMY: - case FORMAT_YMD: - case FORMAT_LONGJUL: - return 8; - - case FORMAT_ISO: - case FORMAT_USA: - case FORMAT_EUR: - case FORMAT_JIS: - return 10; - - case FORMAT_CYMD: - case FORMAT_CMDY: - case FORMAT_CDMY: - return 9; - - default: // should never happen - throw new InternalErrorException(InternalErrorException.UNKNOWN, "Unrecognized format: " + format); - } - } - } - - - // Implements abstract method of superclass. - int lengthFor(int format) - { - return getByteLength(format, getSeparator()); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400DateTimeConverter.java b/cvsroot/src/com/ibm/as400/access/AS400DateTimeConverter.java deleted file mode 100644 index d86b9daae..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400DateTimeConverter.java +++ /dev/null @@ -1,259 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: AS400DateTimeConverter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.util.Calendar; -import java.util.Date; -import java.io.UnsupportedEncodingException; - -/** - * The AS400DateTimeConverter class represents a converted date and time. - The AS/400 System API QWCCVTDT is used to convert a date and time value - from one format to another format. - @deprecated This class has been replaced by the DateTimeConverter class. - @see com.ibm.as400.access.DateTimeConverter - **/ - -public class AS400DateTimeConverter -{ - /** - The system. - **/ - protected static AS400 as400_; - - /** - * Constructs a AS400DateTimeConverter object. - * - * @param system The AS/400 system. - **/ - public AS400DateTimeConverter(AS400 system) - { -//@A2D Trace.log(Trace.INFORMATION,"constructor"); - if (system == null) //@A2A - throw new NullPointerException("system"); //@A2A - this.as400_=system; - } - - /** - * Converts date and time values from the input format to the requested output format. - * - * @param system The AS/400 system. - * @param in The date and time value to be converted. - * @param inFormat The input date and time format. Possible values are: -
      -
    • *DTS -
    • *JOB -
    • *SYSVAL -
    • *YMD -
    • *YYMD -
    • *MDY -
    • *MDYY -
    • *DMY -
    • *DMYY -
    • *JUL -
    • *LONGJUL -
    - * @param outFormat The output date and time format. Possible values are: -
      -
    • *DTS -
    • *JOB -
    • *SYSVAL -
    • *YMD -
    • *YYMD -
    • *MDY -
    • *MDYY -
    • *DMY -
    • *DMYY -
    • *JUL -
    • *LONGJUL -
    - * @return The converted date and time value. - **/ - - public static byte[] convert(AS400 system, byte[] in, String inFormat, String outFormat) - { - byte[] out = null; - Trace.log(Trace.INFORMATION,"convert"); - Trace.log(Trace.INFORMATION,"parameters : "+in+" | "+out+" | " - +inFormat+" | "+outFormat); - if(system == null) - { - throw new NullPointerException("system"); - } - - - ProgramCall pgm = new ProgramCall( system ); - try - { - // Initialize the name of the program to run - String progName = "/QSYS.LIB/QWCCVTDT.PGM"; - AS400Text text10 = new AS400Text(10); - - // Setup the 5 parameters - ProgramParameter[] parmlist = new ProgramParameter[5]; - - // First parameter is the input format. - parmlist[0] = new ProgramParameter( text10.toBytes(inFormat) ); - - - // Second parameter is the input variable. - parmlist[1] = new ProgramParameter( in ); - - // Third parameter is the output format. - parmlist[2] = new ProgramParameter( text10.toBytes(outFormat) ); - - - // Fourth parameter is the output variable. - parmlist[3] = new ProgramParameter(17); - - - // Fifth parameter is the error format. - byte[] errorCode = new byte[70]; - parmlist[4] = new ProgramParameter( errorCode ); - - // Set the program name and parameter list - pgm.setProgram( progName, parmlist ); - pgm.suggestThreadsafe(); // QWCCVTDT is thread-safe. @B1A - - // Run the program - if (pgm.run()!=true) - { - // Note that there was an error - Trace.log(Trace.ERROR, "program failed!" ); - - // Show the messages - AS400Message[] messagelist = pgm.getMessageList(); - for (int i=0; i < messagelist.length; i++) - { - // Trace.log(Trace.INFORMATION, messagelist[i] ); - } - throw new AS400Exception(messagelist); - } - else - { - out=parmlist[3].getOutputData(); - } - } - catch (Exception e) - { - Trace.log(Trace.ERROR,"convert failed : "+e); - } - - return out; - - } - - - - - /** - * Returns the Date object in the YYMD format. - * @param in The date and time value to be converted. - * @param format The format of the date and time value being provided. - * @return The Date object in the YYMD format. - * - **/ - public static Date getDate(byte[] in, String format) - - { - Trace.log(Trace.INFORMATION,"getDate"); - String outFormat = "*YYMD"; - byte[] out = convert(as400_, in, format, outFormat); - - RecordFormat recordFormat=new RecordFormat(); - - CharacterFieldDescription[] cfd=new CharacterFieldDescription[7];; - cfd[0] = new CharacterFieldDescription(new AS400Text(4),"year"); - cfd[1] = new CharacterFieldDescription(new AS400Text(2),"month"); - cfd[2] = new CharacterFieldDescription(new AS400Text(2),"day"); - cfd[3] = new CharacterFieldDescription(new AS400Text(2),"hour"); - cfd[4] = new CharacterFieldDescription(new AS400Text(2),"minute"); - cfd[5] = new CharacterFieldDescription(new AS400Text(2),"second"); - cfd[6] = new CharacterFieldDescription(new AS400Text(3),"millisecond"); - for(int i=0;i<7;i++) - recordFormat.addFieldDescription(cfd[i]); - try - { - Record record = recordFormat.getNewRecord(out); - Calendar dateTime = Calendar.getInstance(); - dateTime.clear(); - dateTime.set ( - Integer.parseInt(((String)record.getField("year")).trim()),// year - Integer.parseInt(((String)record.getField("month")).trim())-1, // month - Integer.parseInt(((String)record.getField("day")).trim()), // day - Integer.parseInt(((String)record.getField("hour")).trim()), //hour - Integer.parseInt(((String)record.getField("minute")).trim()), //minute - Integer.parseInt(((String)record.getField("second")).trim()));//second - return dateTime.getTime(); - - } catch (UnsupportedEncodingException e) - { - Trace.log(Trace.INFORMATION,"convert Date/Time : "+e); - } - - return null; - } - - /** - * Returns the converted date and time in a byte array. - * @param date The Date object to be converted. It must be in the format YYMD. - * @param format The output date and time format. - * @return The converted date and time in a byte array. - * - **/ - public static byte[] getByteArray(Date date,String format) - { - Trace.log(Trace.INFORMATION,"getByteArray"); - Calendar dateTime=Calendar.getInstance(); - dateTime.setTime(date); - - RecordFormat recordFormat=new RecordFormat(); - - CharacterFieldDescription[] cfd=new CharacterFieldDescription[7];; - cfd[0] = new CharacterFieldDescription(new AS400Text(4),"year"); - cfd[1] = new CharacterFieldDescription(new AS400Text(2),"month"); - cfd[2] = new CharacterFieldDescription(new AS400Text(2),"day"); - cfd[3] = new CharacterFieldDescription(new AS400Text(2),"hour"); - cfd[4] = new CharacterFieldDescription(new AS400Text(2),"minute"); - cfd[5] = new CharacterFieldDescription(new AS400Text(2),"second"); - cfd[6] = new CharacterFieldDescription(new AS400Text(3),"millisecond"); - for(int i=0;i<7;i++) - recordFormat.addFieldDescription(cfd[i]); - - Record record = recordFormat.getNewRecord(); - record.setField("year",Integer.toString(dateTime.get(Calendar.YEAR))); - record.setField("month",Integer.toString(dateTime.get(Calendar.MONTH)+1)); - record.setField("day",Integer.toString(dateTime.get(Calendar.DAY_OF_MONTH))); - record.setField("hour",Integer.toString(dateTime.get(Calendar.HOUR_OF_DAY))); - record.setField("minute",Integer.toString(dateTime.get(Calendar.MINUTE))); - record.setField("second",Integer.toString(dateTime.get(Calendar.SECOND))); - record.setField("millisecond",Integer.toString(dateTime.get(Calendar.MILLISECOND))); - - byte[] in = null; - try - { - in = record.getContents(); - AS400Text text17 = new AS400Text(17); - } - catch(Exception e) - { - Trace.log(Trace.ERROR,"Error constructing program parameters"); - } - String inFormat = "*YYMD"; - return convert(as400_, in,inFormat, format); - - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/AS400DecFloat.java b/cvsroot/src/com/ibm/as400/access/AS400DecFloat.java deleted file mode 100644 index d28f5b2d7..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400DecFloat.java +++ /dev/null @@ -1,1013 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400DecFloat.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.math.BigDecimal; -import java.math.BigInteger; -//@DFA new class -/** - * The AS400DecFloat class provides a converter between a BigDecimal object and a DecimalFloat type. - **/ -public class AS400DecFloat implements AS400DataType -{ - static final long serialVersionUID = 4L; - - private int digits; //Precision 16 or 34 - - - private static final long defaultValue = 0; - static final boolean HIGH_NIBBLE = true; - static final boolean LOW_NIBBLE = false; - - private final static int DEC_FLOAT_16_BIAS = 398; - private final static long DEC_FLOAT_16_SIGNAL_MASK = 0x0200000000000000L; // 1 bit (7th bit from left) //@snan - private final static long DEC_FLOAT_16_SIGN_MASK = 0x8000000000000000L; // 1 bits - private final static long DEC_FLOAT_16_COMBINATION_MASK = 0x7c00000000000000L; // 5 bits - private final static long DEC_FLOAT_16_EXPONENT_CONTINUATION_MASK = 0x03fc000000000000L; // 8 bits - private final static long DEC_FLOAT_16_COEFFICIENT_CONTINUATION_MASK = 0x0003ffffffffffffL; // 50 bits - - private final static int DEC_FLOAT_34_BIAS = 6176; - private final static long DEC_FLOAT_34_SIGNAL_MASK = 0x0200000000000000L; // 1 bit (7th bit from left) //@snan - private final static long DEC_FLOAT_34_SIGN_MASK = 0x8000000000000000L; // 1 bits - private final static long DEC_FLOAT_34_COMBINATION_MASK = 0x7c00000000000000L; // 5 bits - private final static long DEC_FLOAT_34_EXPONENT_CONTINUATION_MASK = 0x03ffc00000000000L; // 12 bits - private final static long DEC_FLOAT_34_COEFFICIENT_CONTINUATION_MASK = 0x00003fffffffffffL; // 46 bits + 64 bits = 110 bits - - private static final int[][] tenRadixMagnitude = { { 0x3b9aca00 }, // 10^9 - { 0x0de0b6b3, 0xa7640000 }, // 10^18 - { 0x033b2e3c, 0x9fd0803c, 0xe8000000 }, // 10^27 - }; - - /** - * Constructs an AS400DecFloat object. - * @param numDigits The number of digits (16 or 34). - **/ - public AS400DecFloat(int numDigits) - { - // check for valid input - if (numDigits != 16 && numDigits != 34) //34 is max for DecFloat(34) - { - throw new ExtendedIllegalArgumentException("numDigits (" + String.valueOf(numDigits) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - // set instance variables - this.digits = numDigits; - - } - - /** - * Creates a new AS400DecFloat object that is identical to the current instance. - * @return The new object. - **/ - public Object clone() - { - try - { - return super.clone(); // Object.clone does not throw exception - } - catch (CloneNotSupportedException e) - { - Trace.log(Trace.ERROR, "Unexpected cloning error", e); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - /** - * Returns the byte length of the data type. - * @return The number of bytes in the server representation of the data type. - **/ - public int getByteLength() - { - return digits == 16 ? 8 : 16; //either 8 or 16 bytes on server - } - - /** - * Returns a Java object representing the default value of the data type. - * @return The BigDecimal object with a value of zero. - **/ - public Object getDefaultValue() - { - return BigDecimal.valueOf(defaultValue); - } - - /** - * Returns instance type - * @return AS400DataType.TYPE_DECFLOAT. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_DECFLOAT; - } - - /** - * Returns the Java class that corresponds with this data type. - * @return BigDecimal.class. - **/ - public Class getJavaType() - { - return BigDecimal.class; - } - - /** - * Returns the total number of digits in the decfloat number. - * @return The number of digits. - **/ - public int getNumberOfDigits() - { - return this.digits; - } - - /** - * Converts the specified Java object to server format. - * @param javaValue The object corresponding to the data type. It must be an instance of BigDecimal and the BigDecimal must have a less than or equal to number of digits. - * @return The server representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - byte[] as400Value = new byte[this.getByteLength()]; - this.toBytes(javaValue, as400Value, 0); - return as400Value; - } - - /** - * Converts the specified Java object into server format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of BigDecimal and the BigDecimal must have a less than or equal to number of digits. - * @param as400Value The array to receive the data type in server format. There must be enough space to hold the server value. - * @return The number of bytes in the server representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value) - { - return this.toBytes(javaValue, as400Value, 0); - } - - /** - * Converts the specified Java object into server format in the specified byte array. - * @param javaValue An object corresponding to the data type. It must be an instance of BigDecimal or String (if value is "NaN", "Infinity", or "-Infinity"). - * @param as400Value The array to receive the data type in server format. There must be enough space to hold the server value. - * @param offset The offset into the byte array for the start of the server value. It must be greater than or equal to zero. - * @return The number of bytes in the server representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - //verify input - long specialCombination = 0L; //ieee algorithm says: Combination G (11111-> NaN, 11110-> (-1)^sign Infinity) - int signalingNaN = -1; //@sig1 for now, only support non-signaling until decfloat/double etc support it - if(javaValue instanceof String) - { - //special value "NaN", "Infinity", or "-Infinity" - //use dummy BigDecimal("1" or "-1"), and overlay ieee (Combination G) at end of method - if ( javaValue.equals("NaN") ) - { - javaValue = new BigDecimal("1"); - specialCombination = 0x1fL; - signalingNaN = 0; //@sig1 non signaling - } - else if ( javaValue.equals("-NaN") ) - { - javaValue = new BigDecimal("-1"); - specialCombination = 0x1fL; - signalingNaN = 0; //@sig1 non signaling - } - else if ( javaValue.equals("SNaN") ) //@snan - { - javaValue = new BigDecimal("1"); - specialCombination = 0x1fL; - signalingNaN = 1; //@sig1 signaling - } - else if ( javaValue.equals("-SNaN") ) //@snan - { - javaValue = new BigDecimal("-1"); - specialCombination = 0x1fL; - signalingNaN = 1; //@sig1 signaling - } - else if ( javaValue.equals("Infinity") ) - { - javaValue = new BigDecimal("1"); - specialCombination = 0x1eL; - } - else if ( javaValue.equals("-Infinity") ) - { - javaValue = new BigDecimal("-1"); //negative dummy so that sign gets set to negative Infinity - specialCombination = 0x1eL; - } - - } - BigDecimal inValue = (BigDecimal) javaValue; // Let this line throw ClassCastException - - //get the sign of the BigDecimal. - int sign = inValue.signum (); - - //get the exponent. - long exponent = inValue.scale () * (-1); - - //get the unscaled value as string. - String bdUnscaledStr = inValue.abs().unscaledValue().toString (); - - if (this.digits == 16) //DECFLOAT16 - { - //get precision of the BigDecimal. - int bdPrecision = SQLDataFactory.getPrecisionForTruncation(inValue, 16)[0]; //bdUnscaledStr.length (); //@rnd1 - - //bug in jdk1.5 (need to pad with 0z if exp is greater than (maxexp - (maxprecision - precision)) (ie. 9.99E380 since 380>384-(16-3)) //@max - //so if among the top 16 exponent values, then need to have the precision digits padded with zeros - int zeros = 0; //@max - if((exponent > 368 ) && bdUnscaledStr.length() < 16){ //maxexp-16 //@max - //pad 0s //@max - zeros = 16 - bdUnscaledStr.length(); //@max - bdUnscaledStr += "0000000000000000"; //@max - bdUnscaledStr = bdUnscaledStr.substring(0, 16); //@max - bdPrecision += zeros; //@max - exponent -= zeros; //@max - } //@max - - if(bdUnscaledStr.length() > bdPrecision) - exponent = bdUnscaledStr.length() - bdPrecision; //get exponent in terms of precisionForTruncation - - // check for error condition. - if ((exponent + (bdPrecision - 1)) > 384) - throw new ExtendedIllegalArgumentException("numDecimalPositions (" + String.valueOf((exponent + (bdPrecision - 1))) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - else if ((exponent + (bdPrecision - 1)) < -383) - throw new ExtendedIllegalArgumentException("numDecimalPositions (" + String.valueOf((exponent + (bdPrecision - 1))) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - - // compute coefficient digits. - int[] coefficientDigits = new int[16]; - int zeroBase = '0'; - for (int indx = 0; indx < bdPrecision; indx++) - { - coefficientDigits[(16 - bdPrecision) + indx] = bdUnscaledStr.charAt(indx) - zeroBase; - } - - // the result decFloat16 in bits. - long decFloat16Bits = 0L; - - // mask the coefficient continuation. - for (int indx = 1; indx < 16; indx += 3) - { - decFloat16Bits <<= 10; // declet. (3 digits are accommondated in 10 bits). - int decDigits = packDenselyPackedDecimal(coefficientDigits, indx); - decFloat16Bits |= decDigits; - } - - // mask the exponent continuation. - exponent += DEC_FLOAT_16_BIAS; - decFloat16Bits |= ((exponent & 0xff) << 50); - - // mask the combination. - long combination; - if (specialCombination != 0L) - { - combination = specialCombination; //set for Combination G (11111-> NaN, 11110-> (-1)^sign Infinity) - } - else if (coefficientDigits[0] >= 8) - { - combination = 0x18; - combination |= ((exponent & 0x300) >> 7); - combination |= (coefficientDigits[0] & 0x1); - } else - { - combination = 0x0; - combination |= ((exponent & 0x300) >> 5); - combination |= coefficientDigits[0]; - } - - decFloat16Bits |= (combination << 58); - - // mask the sign bit. - if (sign == -1) - { - decFloat16Bits |= DEC_FLOAT_16_SIGN_MASK; - } - - as400Value[offset] = (byte) ((decFloat16Bits >> 56) & 0xFF); - as400Value[offset + 1] = (byte) ((decFloat16Bits >> 48) & 0xFF); - as400Value[offset + 2] = (byte) ((decFloat16Bits >> 40) & 0xFF); - as400Value[offset + 3] = (byte) ((decFloat16Bits >> 32) & 0xFF); - as400Value[offset + 4] = (byte) ((decFloat16Bits >> 24) & 0xFF); - as400Value[offset + 5] = (byte) ((decFloat16Bits >> 16) & 0xFF); - as400Value[offset + 6] = (byte) ((decFloat16Bits >> 8) & 0xFF); - as400Value[offset + 7] = (byte) (decFloat16Bits & 0xFF); - - if(signalingNaN == 0) //@sig1 - as400Value[offset] &= 0xFD; //non signaling (switch off 7th bit) //@sig1 - else if (signalingNaN == 1) //@sig1 - as400Value[offset] |= 0x02; //signaling (switch on 7th bit) //@sig1 - - return 8; //always 8 bytes for DECFLOAT16 - } - else //DECFLOAT34 - { - - //get precision of the BigDecimal. - int bdPrecision = SQLDataFactory.getPrecisionForTruncation(inValue, 34)[0]; //bdUnscaledStr.length (); //@rnd1 - - //bug in jdk1.5 //@max - int zeros = 0; //@max - if((exponent > 6110 ) && bdUnscaledStr.length() < 34){ //maxexp-34 //@max - //pad 0s //@max - zeros = 34 - bdUnscaledStr.length(); //@max - bdUnscaledStr += "00000000000000000000000000000000"; //@max - bdUnscaledStr = bdUnscaledStr.substring(0, 34); //@max - bdPrecision += zeros; //@max - exponent -= zeros; //@max - } //@max - - if(bdUnscaledStr.length() > bdPrecision) - exponent = bdUnscaledStr.length() - bdPrecision; //get exponent in terms of precisionForTruncation - - // check for error condition. - if ((exponent + (bdPrecision - 1)) > 6144) - throw new ExtendedIllegalArgumentException("numDecimalPositions (" + String.valueOf((exponent + (bdPrecision - 1))) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - else if ((exponent + (bdPrecision - 1)) < -6143) - throw new ExtendedIllegalArgumentException("numDecimalPositions (" + String.valueOf((exponent + (bdPrecision - 1))) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - - // compute coefficient digits. - int[] coefficientDigits = new int[34]; - int zeroBase = '0'; - for (int indx = 0; indx < bdPrecision; indx++) - { - coefficientDigits[(34 - bdPrecision) + indx] = bdUnscaledStr.charAt(indx) - zeroBase; - } - - // the result decFloat34 in bits. - long decFloat34BitsHi = 0L; // for high 8 bytes. - long decFloat34BitsLo = 0L; // for low 8 bytes. - - // mask the coefficient continuation. - int indx = 1; - int decDigits; - // handle the first 12 digits in high 8 bytes. - for (; indx < 13; indx += 3) { - decFloat34BitsHi <<= 10; // 3 digits are accommondated in 10 bits. - decDigits = packDenselyPackedDecimal (coefficientDigits, indx); - decFloat34BitsHi |= decDigits; - } - // handle the 3 digits on the boundary of high and low 8 bytes. - decDigits = packDenselyPackedDecimal (coefficientDigits, indx); - decFloat34BitsHi <<= 6; - decFloat34BitsHi |= ((decDigits & 0x3f0) >> 4); // get high 6 bits of decDigits. - decFloat34BitsLo |= (decDigits & 0xf); // get low 4 bits of decDigits. - indx += 3; - // handle the rest 18 digits in high 8 bytes. - for (; indx < 34; indx += 3) - { - decFloat34BitsLo <<= 10; // 3 digits are accommondated in 10 bits. - decDigits = packDenselyPackedDecimal (coefficientDigits, indx); - decFloat34BitsLo |= decDigits; - } - - // mask the exponent continuation. - exponent += DEC_FLOAT_34_BIAS; - decFloat34BitsHi |= ((exponent & 0xfff) << 46); - - // mask the combination. - long combination; - if (specialCombination != 0L) - { - combination = specialCombination; //set for Combination G (11111-> NaN, 11110-> (-1)^sign Infinity) - } - else if (coefficientDigits[0] >= 8) - { - combination = 0x18; - combination |= ((exponent & 0x3000) >> 11); - combination |= (coefficientDigits[0] & 0x1); - } - else - { - combination = 0x0; - combination |= ((exponent & 0x3000) >> 9); - combination |= coefficientDigits[0]; - } - decFloat34BitsHi |= (combination << 58); - - // mask the sign bit. - if (sign == -1) - { - decFloat34BitsHi |= DEC_FLOAT_34_SIGN_MASK; - } - - as400Value[offset] = (byte) ((decFloat34BitsHi >> 56) & 0xFF); - as400Value[offset + 1] = (byte) ((decFloat34BitsHi >> 48) & 0xFF); - as400Value[offset + 2] = (byte) ((decFloat34BitsHi >> 40) & 0xFF); - as400Value[offset + 3] = (byte) ((decFloat34BitsHi >> 32) & 0xFF); - as400Value[offset + 4] = (byte) ((decFloat34BitsHi >> 24) & 0xFF); - as400Value[offset + 5] = (byte) ((decFloat34BitsHi >> 16) & 0xFF); - as400Value[offset + 6] = (byte) ((decFloat34BitsHi >> 8) & 0xFF); - as400Value[offset + 7] = (byte) (decFloat34BitsHi & 0xFF); - as400Value[offset + 8] = (byte) ((decFloat34BitsLo >> 56) & 0xFF); - as400Value[offset + 9] = (byte) ((decFloat34BitsLo >> 48) & 0xFF); - as400Value[offset + 10] = (byte) ((decFloat34BitsLo >> 40) & 0xFF); - as400Value[offset + 11] = (byte) ((decFloat34BitsLo >> 32) & 0xFF); - as400Value[offset + 12] = (byte) ((decFloat34BitsLo >> 24) & 0xFF); - as400Value[offset + 13] = (byte) ((decFloat34BitsLo >> 16) & 0xFF); - as400Value[offset + 14] = (byte) ((decFloat34BitsLo >> 8) & 0xFF); - as400Value[offset + 15] = (byte) (decFloat34BitsLo & 0xFF); - - if(signalingNaN == 0) //@sig1 - as400Value[offset] &= 0xFD; //non signaling (switch off 7th bit) //@sig1 - else if (signalingNaN == 1) //@sig1 - as400Value[offset] |= 0x02; //signaling (switch on 7th bit) //@sig1 - - return 16; //always 16 bytes for DECFLOAT34 - - } - } - - - /** - * Converts the specified Java object to server format. - * - * @param doubleValue - * The value to be converted to server format. If the decimal part - * of this value needs to be truncated, it will be rounded based on - * decfloat rounding mode property. - * @return The server representation of the data type. - */ - public byte[] toBytes(double doubleValue) - { - byte[] as400Value = new byte[digits == 16 ? 64 : 128]; - toBytes(doubleValue, as400Value, 0); - return as400Value; - } - - - /** - * Converts the specified Java object into server format in - * the specified byte array. - * - * @param doubleValue The value to be converted to server format. If the decimal part - * of this value needs to be truncated, it will be rounded based on - * decfloat rounding mode property. - * @param as400Value The array to receive the data type in server format. There must - * be enough space to hold the server value. - * @return The number of bytes in the server representation of the data type. - **/ - public int toBytes(double doubleValue, byte[] as400Value) - { - return toBytes(doubleValue, as400Value, 0); - } - - - /** - * Converts the specified Java object into server format in the specified byte array. - * - * @param doubleValue The value to be converted to server format. If the decimal part - * of this value needs to be truncated, it will be rounded based on - * decfloat rounding mode property. - * @param as400Value The array to receive the data type in server format. - * There must be enough space to hold the server value. - * @param offset The offset into the byte array for the start of the server value. - * It must be greater than or equal to zero. - * @return The number of bytes in the server representation of the data type. - **/ - public int toBytes(double doubleValue, byte[] as400Value, int offset) - { - BigDecimal bd = new BigDecimal(doubleValue); - return toBytes(bd, as400Value, offset); - } - - - /** - * Converts the specified server data type to a Java double value. - * @param as400Value The array containing the data type in server format. - * The entire data type must be represented. - * @return The Java double value corresponding to the data type. - **/ - public double toDouble(byte[] as400Value) - { - return toDouble(as400Value, 0); - } - - - /** - * Converts the specified server data type to a Java double value. - * - * @param as400Value The array containing the data type in server format. - * The entire data type must be represented. - * @param offset The offset into the byte array for the start of the server value. - * It must be greater than or equal to zero. - * @return The Java double value corresponding to the data type. - **/ - public double toDouble(byte[] as400Value, int offset) - { - // Check the offset to prevent bogus NumberFormatException message. - if (offset < 0) - throw new ArrayIndexOutOfBoundsException(String.valueOf(offset)); - - // Compute the value. - BigDecimal bd = (BigDecimal) this.toObject(as400Value, offset); - return bd.doubleValue(); - } - - /** - * Converts the specified server data type to a Java object. - * @param as400Value The array containing the data type in server format. The entire data type must be represented. - * @return The BigDecimal object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value) - { - return this.toObject(as400Value, 0); - } - - /** - * Converts the specified server data type to a Java object (BigDecimal). - * @param as400Value The array containing the data type in server format. The entire data type must be represented and the data type must have valid packed decimal format. - * @param offset The offset into the byte array for the start of the server value. It must be greater than or equal to zero. - * @return The BigDecimal object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value, int offset) - { - - // Check offset to prevent bogus NumberFormatException message - if (offset < 0) - { - throw new ArrayIndexOutOfBoundsException(String.valueOf(offset)); - } - - if(this.digits == 16) - { - long decFloat16Bits = BinaryConverter.byteArrayToLong(as400Value, offset); - long combination = (decFloat16Bits & DEC_FLOAT_16_COMBINATION_MASK) >> 58; - - //compute sign here so we can get -+Infinity values - int sign = ((decFloat16Bits & DEC_FLOAT_16_SIGN_MASK) == DEC_FLOAT_16_SIGN_MASK) ? -1 : 1; - - // deal with special numbers. (not a number and infinity) - if ((combination == 0x1fL) && ( sign == 1)) - { - long nanSignal = (decFloat16Bits & DEC_FLOAT_16_SIGNAL_MASK) >> 57; //shift first 7 bits to get signal bit out //@snan - if (nanSignal == 1) - throw new ExtendedIllegalArgumentException("SNaN", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - else - throw new ExtendedIllegalArgumentException("NaN", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - } - else if ((combination == 0x1fL) && ( sign == -1)) - { - long nanSignal = (decFloat16Bits & DEC_FLOAT_16_SIGNAL_MASK) >> 57; //shift first 7 bits to get signal bit out //@snan - if (nanSignal == 1) - throw new ExtendedIllegalArgumentException("-SNaN", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - else - throw new ExtendedIllegalArgumentException("-NaN", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - else if ((combination == 0x1eL) && ( sign == 1)) - { - throw new ExtendedIllegalArgumentException("Infinity", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - else if ((combination == 0x1eL) && ( sign == -1)) - { - throw new ExtendedIllegalArgumentException("-Infinity", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // compute the exponent MSD and the coefficient MSD. - int exponentMSD; - long coefficientMSD; - if ((combination & 0x18L) == 0x18L) { - // format of 11xxx: - exponentMSD = (int) ((combination & 0x06L) >> 1); - coefficientMSD = 8 + (combination & 0x01L); - } - else { - // format of xxxxx: - exponentMSD = (int) ((combination & 0x18L) >> 3); - coefficientMSD = (combination & 0x07L); - } - - // compute the exponent. - int exponent = (int) ((decFloat16Bits & DEC_FLOAT_16_EXPONENT_CONTINUATION_MASK) >> 50); - exponent |= (exponentMSD << 8); - exponent -= DEC_FLOAT_16_BIAS; - - // compute the coefficient. - long coefficientContinuation = decFloat16Bits & DEC_FLOAT_16_COEFFICIENT_CONTINUATION_MASK; - int coefficientLo = decFloatBitsToDigits ((int) (coefficientContinuation & 0x3fffffff)); // low 30 bits (9 digits) - int coefficientHi = decFloatBitsToDigits ((int) ((coefficientContinuation >> 30) & 0xfffff)); // high 20 bits (6 - // digits) - coefficientHi += coefficientMSD * 1000000L; - - // compute the int array of coefficient. - int[] value = computeMagnitude (new int[] { coefficientHi, coefficientLo }); - - // convert value to a byte array of coefficient. - byte[] magnitude = new byte[8]; - magnitude[0] = (byte) (value[0] >>> 24); - magnitude[1] = (byte) (value[0] >>> 16); - magnitude[2] = (byte) (value[0] >>> 8); - magnitude[3] = (byte) (value[0]); - magnitude[4] = (byte) (value[1] >>> 24); - magnitude[5] = (byte) (value[1] >>> 16); - magnitude[6] = (byte) (value[1] >>> 8); - magnitude[7] = (byte) (value[1]); - - - BigInteger bigInt = new java.math.BigInteger (sign, magnitude); - return getNewBigDecimal(bigInt, -exponent); - - }else - { - //decfloat34 - long decFloat34BitsHi = BinaryConverter.byteArrayToLong (as400Value, offset); - long decFloat34BitsLo = BinaryConverter.byteArrayToLong (as400Value, offset + 8); - long combination = (decFloat34BitsHi & DEC_FLOAT_34_COMBINATION_MASK) >> 58; - - //compute sign. - int sign = ((decFloat34BitsHi & DEC_FLOAT_34_SIGN_MASK) == DEC_FLOAT_34_SIGN_MASK) ? -1 : 1; - - // deal with special numbers. - if ((combination == 0x1fL) && ( sign == 1)) - { - long nanSignal = (decFloat34BitsHi & DEC_FLOAT_34_SIGNAL_MASK) >> 57; //shift first 7 bits to get signal bit out //@snan - if (nanSignal == 1) - throw new ExtendedIllegalArgumentException("SNaN", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - else - throw new ExtendedIllegalArgumentException("NaN", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - else if ((combination == 0x1fL) && ( sign == -1)) - { - long nanSignal = (decFloat34BitsHi & DEC_FLOAT_34_SIGNAL_MASK) >> 57; //shift first 7 bits to get signal bit out //@snan - if (nanSignal == 1) - throw new ExtendedIllegalArgumentException("-SNaN", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - else - throw new ExtendedIllegalArgumentException("-NaN", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - else if ((combination == 0x1eL) && ( sign == 1)) - { - throw new ExtendedIllegalArgumentException("Infinity", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - else if ((combination == 0x1eL) && ( sign == -1)) - { - throw new ExtendedIllegalArgumentException("-Infinity", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // compute the exponent MSD and the coefficient MSD. - int exponentMSD; - long coefficientMSD; - if ((combination & 0x18L) == 0x18L) { - // format of 11xxx: - exponentMSD = (int) ((combination & 0x06L) >> 1); - coefficientMSD = 8 + (combination & 0x01L); - } - else { - // format of xxxxx: - exponentMSD = (int) ((combination & 0x18L) >> 3); - coefficientMSD = (combination & 0x07L); - } - - // compute the exponent. - int exponent = (int) ((decFloat34BitsHi & DEC_FLOAT_34_EXPONENT_CONTINUATION_MASK) >> 46); - exponent |= (exponentMSD << 12); - exponent -= DEC_FLOAT_34_BIAS; - - // compute the coefficient. - int coefficientLo = decFloatBitsToDigits ((int) (decFloat34BitsLo & 0x3fffffff)); // last 30 bits (9 digits) - // another 30 bits (9 digits) - int coefficientMeLo = decFloatBitsToDigits ((int) ((decFloat34BitsLo >> 30) & 0x3fffffff)); - // another 30 bits (9 digits). 26 bits from hi and 4 bits from lo. - int coefficientMeHi = decFloatBitsToDigits ((int) (((decFloat34BitsHi & 0x3ffffff) << 4) | ((decFloat34BitsLo >> 60) & 0xf))); - int coefficientHi = decFloatBitsToDigits ((int) ((decFloat34BitsHi >> 26) & 0xfffff)); // high 20 bits (6 digits) - coefficientHi += coefficientMSD * 1000000L; - - // compute the int array of coefficient. - int[] value = computeMagnitude (new int[] { coefficientHi, coefficientMeHi, coefficientMeLo, coefficientLo }); - - // convert value to a byte array of coefficient. - byte[] magnitude = new byte[16]; - magnitude[0] = (byte) (value[0] >>> 24); - magnitude[1] = (byte) (value[0] >>> 16); - magnitude[2] = (byte) (value[0] >>> 8); - magnitude[3] = (byte) (value[0]); - magnitude[4] = (byte) (value[1] >>> 24); - magnitude[5] = (byte) (value[1] >>> 16); - magnitude[6] = (byte) (value[1] >>> 8); - magnitude[7] = (byte) (value[1]); - magnitude[8] = (byte) (value[2] >>> 24); - magnitude[9] = (byte) (value[2] >>> 16); - magnitude[10] = (byte) (value[2] >>> 8); - magnitude[11] = (byte) (value[2]); - magnitude[12] = (byte) (value[3] >>> 24); - magnitude[13] = (byte) (value[3] >>> 16); - magnitude[14] = (byte) (value[3] >>> 8); - magnitude[15] = (byte) (value[3]); - - - java.math.BigInteger bigInt = new java.math.BigInteger (sign, magnitude); - return getNewBigDecimal(bigInt, -exponent); - } - } - -// /** -// * helper method to throw exception during conversion -// */ -// static final void throwNumberFormatException(boolean highNibble, int byteOffset, int byteValue, byte[] fieldBytes) throws NumberFormatException -// { -// AS400PackedDecimal.throwNumberFormatException(highNibble, byteOffset, byteValue, fieldBytes); -// } - - /** - * Converts byte to string */ - private static final String byteToString(int byteVal) - { - int leftDigitValue = (byteVal >>> 4) & 0x0F; - int rightDigitValue = byteVal & 0x0F; - char[] digitChars = new char[2]; - // 0x30 = '0', 0x41 = 'A' - digitChars[0] = leftDigitValue < 0x0A ? (char)(0x30 + leftDigitValue) : (char)(leftDigitValue - 0x0A + 0x41); - digitChars[1] = rightDigitValue < 0x0A ? (char)(0x30 + rightDigitValue) : (char)(rightDigitValue - 0x0A + 0x41); - return new String(digitChars); - } - - - /** - * Internal declet encoding helper method. - * - **/ - private static int packDenselyPackedDecimal (int[] digits, int indx) - { - //Declet is the three bit encoding of one decimal digit. The Decfloat is made up of declets to represent - //the decfloat 16 or 34 digits - int result = 0; - int combination = ((digits[indx+0] & 8) >> 1) | ((digits[indx+1] & 8) >> 2) | ((digits[indx+2] & 8) >> 3); - switch (combination) { - case 0: // no, no, no - result = (digits[indx+0] << 7) | (digits[indx+1] << 4) | digits[indx+2]; - break; - case 1: // no, no, yes - result = (digits[indx+0] << 7) | (digits[indx+1] << 4) | (digits[indx+2] & 1) | 8; - break; - case 2: // no, yes, no - result = (digits[indx+0] << 7) | ((digits[indx+2] & 6) << 4) | ((digits[indx+1] & 1) << 4) | (digits[indx+2] & 1) | 10; - break; - case 3: // no, yes, yes - result = (digits[indx+0] << 7) | ((digits[indx+1] & 1) << 4) | (digits[indx+2] & 1) | 78; - break; - case 4: // yes, no, no - result = ((digits[indx+2] & 6) << 7) | ((digits[indx+0] & 1) << 7) | (digits[indx+1] << 4) | (digits[indx+2] & 1) | 12; - break; - case 5: // yes, no, yes - result = ((digits[indx+1] & 6) << 7) | ((digits[indx+0] & 1) << 7) | ((digits[indx+1] & 1) << 4) | (digits[indx+2] & 1) | 46; - break; - case 6: // yes, yes, no - result = ((digits[indx+2] & 6) << 7) | ((digits[indx+0] & 1) << 7) | ((digits[indx+1] & 1) << 4) | (digits[indx+2] & 1) | 14; - break; - case 7: // yes, yes, yes - result = ((digits[indx+0] & 1) << 7) | ((digits[indx+1] & 1) << 4) | (digits[indx+2] & 1) | 110; - break; - } - return result; - } - - - /** - * Internal declet decoding helper method. - **/ - private static int unpackDenselyPackedDecimal (int bits) - { - //Declet is the three bit encoding of one decimal digit. The Decfloat is made up of declets to represent - //the decfloat 16 or 34 digits - int combination; - if ((bits & 14) == 14) combination = ((bits & 96) >> 5) | 4; - else combination = ((bits & 8) == 8) ? (((~bits) & 6) >> 1) : 0; - int decoded = 0; - switch (combination) - { - case 0: // bit 6 is 0 - decoded = ((bits & 896) << 1) | (bits & 119); - break; - case 1: // bits 6,7,8 are 1-1-0 - decoded = ((bits & 128) << 1) | (bits & 113) | ((bits & 768) >> 7) | 2048; - break; - case 2: // bits 6,7,8 are 1-0-1 - decoded = ((bits & 896) << 1) | (bits & 17) | ((bits & 96) >> 4) | 128; - break; - case 3: // bits 6,7,8 are 1-0-0 - decoded = ((bits & 896) << 1) | (bits & 113) | 8; - break; - case 4: // bits 6,7,8 are 1-1-1, bits 3,4 are 0-0 - decoded = ((bits & 128) << 1) | (bits & 17) | ((bits & 768) >> 7) | 2176; - break; - case 5: // bits 6,7,8 are 1-1-1, bits 3,4 are 0-1 - decoded = ((bits & 128) << 1) | (bits & 17) | ((bits & 768) >> 3) | 2056; - break; - case 6: // bits 6,7,8 are 1-1-1, bits 3,4 are 1-0 - decoded = ((bits & 896) << 1) | (bits & 17) | 136; - break; - case 7: // bits 6,7,8 are 1-1-1, bits 3,4 are 1-1 - // NB: we ignore values of bits 0,1 in this case - decoded = ((bits & 128) << 1) | (bits & 17) | 2184; - break; - } - return ((decoded & 3840) >> 8) * 100 + ((decoded & 240) >> 4) *10 + (decoded & 15); - } - - /** - * Compute the int array of magnitude from input value segments. - */ - private static final int[] computeMagnitude (int[] input) - { - int length = input.length; - int[] mag = new int[length]; - - mag[length - 1] = input[length - 1]; - for (int i = 0; i < length - 1; i++) { - int carry = 0; - int j = tenRadixMagnitude[i].length - 1; - int k = length - 1; - for (; j >= 0; j--, k--) { - long product = (input[length - 2 - i] & 0xFFFFFFFFL) * (tenRadixMagnitude[i][j] & 0xFFFFFFFFL) - + (mag[k] & 0xFFFFFFFFL) // add previous value - + (carry & 0xFFFFFFFFL); // add carry - carry = (int) (product >>> 32); - mag[k] = (int) (product & 0xFFFFFFFFL); - } - mag[k] = (int) carry; - } - return mag; - } - - /** - * Convert 30 binary bits coefficient to 9 decimal digits. Note that for performance purpose, - * it does not do array-out-of-bound checking. - */ - private static final int decFloatBitsToDigits (int bits) - { - - int decimal = 0; - for (int i = 2; i >= 0; i--) { - decimal *= 1000; - decimal += unpackDenselyPackedDecimal ((int)((bits >> (i * 10)) & 0x03ffL)); - } - return decimal; - } - - /** - * This method rounds the number (unscaled integer value and exponent). - * mcPrecision and mcRoundingMode are what is in jdk 5.0 MathContext. - * What is returned from this method should be the same as what jre 5.0 would - * have rounded to using MathContext and BigDecimal. - */ - private static BigDecimal roundByModePreJDK5(BigInteger intVal, int scale, int mcPrecision, String mcRoundingMode) - { - - BigInteger roundingMax = null; - if (mcPrecision == 16) - roundingMax = new BigInteger("10000000000000000"); // 16 0s - else - roundingMax = new BigInteger("10000000000000000000000000000000000"); // 34 0s - - BigInteger roundingMin = roundingMax.negate(); - - if (roundingMax != null && intVal.compareTo(roundingMax) < 0 - && intVal.compareTo(roundingMin) > 0) - return getNewBigDecimal(intVal, scale); //rounding not needed - //get precision from intVal without 0's on right side - int[] values = SQLDataFactory.getPrecisionForTruncation(getNewBigDecimal(intVal, scale), mcPrecision); //=precisionStr.length() - trimCount; //@rnd1 - int precisionNormalized = values[0]; //@rnd1 - int droppedZeros = values[1]; //@rnd1 decrease scale by number of zeros removed from precision //@rnd1 - if(droppedZeros != 0) //@rnd1 - { //@rnd1 - //adjust intVal number of zeros removed off end //@rnd1 - intVal = intVal.divide( new BigInteger("10").pow(droppedZeros)); //@rnd1 - } //@rnd1 - - //get number of digits to round off - int drop = precisionNormalized - mcPrecision; - //@rnd1 if (drop <= 0) - //@rnd1 return getNewBigDecimal(intVal, scale); - BigDecimal rounded = roundOffDigits(intVal, scale, mcRoundingMode, drop); - - if(droppedZeros != 0) //@rnd1 - { //@rnd1 - //adjust rounded bigdecimal by dropped zero count //@rnd1 - rounded = rounded.movePointRight(droppedZeros); //@rnd1 - } //@rnd1 - - return rounded; //@rnd1 - } - - /** - * Helper method to round off digits - */ - private static BigDecimal roundOffDigits(BigInteger intVal, int scale, - String mcRoundingMode, int dropCount) - { - - BigDecimal divisor = new BigDecimal((new BigInteger("10")).pow(dropCount), 0); - BigDecimal preRoundedBD = getNewBigDecimal(intVal, scale); - int roundingMode = 0; - try - { - //get int value for RoundingMode from BigDecimal - roundingMode = ((Integer) Class.forName("java.math.BigDecimal").getDeclaredField(mcRoundingMode).get(null)).intValue(); - } catch (Exception e) - { - throw new InternalErrorException(InternalErrorException.UNKNOWN); //should never happen - } - BigDecimal rounded = preRoundedBD.divide(divisor, scale, roundingMode); // do actual rounding here - - BigInteger bigIntPart = rounded.unscaledValue(); - - rounded = getNewBigDecimal(bigIntPart, scale - dropCount); - - return rounded; - } - - /** - Creates and returns a new BigDecimal based on parameters. - This is a temporary hack due to pre-jre 1.5 not being able to handle negative scales (positive exp) - After we no longer support pre-java 1.5, this method can be replaced with new BigDecimal(bigInt, scale). - @param bigInt BigInteger part. - @param scale scale part. - **/ - private static BigDecimal getNewBigDecimal(BigInteger bigInt, int scale) - { - BigDecimal bigDecimal = null; - try{ - bigDecimal = new BigDecimal(bigInt, scale); - }catch(NumberFormatException e) - { - //note that creating BigDecimal with negative scale is ok in 5, but not in 1.4 - //deal with negative scale in pre jdk 5.0 here - if (scale > 0) - throw e; - bigDecimal = new BigDecimal(bigInt); - bigDecimal = bigDecimal.movePointRight(-scale); - } - - return bigDecimal; - } - - //Decimal float. //@DFA - /** - Rounds the precision of a BigDecimal by removing least significant digits from - the right side of the precision. (least significant digits could be left or right of implicit decimal point) - @param bd BigDecimal to truncate. - @param precision to truncate bd to. (16 or 34) - @param roundingMode to use when truncating - **/ - public static BigDecimal roundByMode(BigDecimal bd, int precision, String roundingMode) - { - BigDecimal roundedBD = null; - - //MathContext is in jdk1.5. So use reflection so code will build under pre-1.5 - //later, use this when we move to jdk1.5 - //All we are doing below is: bdAbs = inValue.abs(new MathContext(16, roundingMode)); - boolean isGEJVM50 = true; - try - { - //in this try block, we do rounding via BigDecimal and MathContext - Class cls = Class.forName("java.math.MathContext"); //thorw ClassNotFoundException if pre 1.5 jvm - Constructor ct = cls.getConstructor(new Class[] { Integer.TYPE, Class.forName("java.math.RoundingMode") }); - Object arglist[] = new Object[2]; - arglist[0] = new Integer(precision); //MathContext.DECIMAL64 (16 or 34 char decfloat precision) - arglist[1] = Class.forName("java.math.RoundingMode").getDeclaredField(roundingMode.substring(6)).get(null); //@pdc remove "ROUND_" - - Object mathContextRounded = ct.newInstance(arglist); //ie. new MathContext(16or34, RoundingMode.x); - Object[] arglist2 = new Object[]{mathContextRounded}; - Class[] c = new Class[] { Class.forName("java.math.MathContext") }; - java.lang.reflect.Method method = java.math.BigDecimal.class.getDeclaredMethod("round", c); - - roundedBD = (java.math.BigDecimal) method.invoke(bd, arglist2); - } - //Unfortunately, we cannot just catch Exception since we do not want to miss any real exceptions - //from rounding etc. And can't re-throw Exception it since method is not declared with "throws" - catch (ClassNotFoundException e) - { - //got exception due to pre-java 5.0. - isGEJVM50 = false; - } - catch (NoSuchMethodException e) - { isGEJVM50 = false; } - catch (NoSuchFieldException e) - { isGEJVM50 = false; } - catch (IllegalAccessException e) - { isGEJVM50 = false; } - catch (InvocationTargetException e) - { isGEJVM50 = false; } - catch (InstantiationException e) - { isGEJVM50 = false; } - - if(isGEJVM50 == false) - { - //use our rounding code to round in pre java 5.0 - roundedBD = roundByModePreJDK5(bd.unscaledValue(), bd.scale(), precision, roundingMode); - } - - return roundedBD; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400EndJobDS.java b/cvsroot/src/com/ibm/as400/access/AS400EndJobDS.java deleted file mode 100644 index 1bbaa44fd..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400EndJobDS.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400EndJobDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -// A class representing an "end server job" request data stream. -class AS400EndJobDS extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - AS400EndJobDS(int serverId) - { - super(new byte[(serverId == 0xE004) ? 40 : 20]); - - setLength(data_.length); - // setHeaderID(0x0000); - setServerID(serverId); - // setCSInstance(0x00000000); - // setCorrelation(0x00000000); - // setTemplateLen(0x0000); - - switch (serverId) - { - case 0xE000: // Central Server. - setReqRepID(0x1400); - break; - case 0xE004: // Database Server. - setReqRepID(0x1FFF); - setTemplateLen(20); - break; - case 0xE008: // Remote Command Server. - setReqRepID(0x1004); - break; - case 0xE009: // Signon Server. - setReqRepID(0x7006); - break; - } - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending end job request..."); //@P0C - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Exception.java b/cvsroot/src/com/ibm/as400/access/AS400Exception.java deleted file mode 100644 index 53661fa37..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400Exception.java +++ /dev/null @@ -1,83 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Exception.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - The AS400Exception class represents an exception - that indicates that an error has occurred on the system. One or more AS400Message objects are - included in this exception. -**/ -public class AS400Exception extends ErrorCompletingRequestException -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - AS400Message[] msgList_; - - /** - Constructs an AS400Exception object. - - @param msgList The list of AS400Messages - causing this exception. - **/ - public AS400Exception(AS400Message[] msgList) // @D0C - { - super(ErrorCompletingRequestException.AS400_ERROR, - msgList[0].getID() + " " + msgList[0].getText() ); - msgList_ = msgList; - } - - /** - Constructs an AS400Exception object. It includes - a single message. - - @param message The AS400Message - causing this exception. - **/ - AS400Exception(AS400Message message) - { - super(ErrorCompletingRequestException.AS400_ERROR, - message.getID() + " " + message.getText() ); - msgList_ = new AS400Message[1]; - msgList_[0] = message; - } - - /** - Returns the AS400Message causing this exception. - - @return The AS400Message causing this exception. - **/ - public AS400Message getAS400Message() - { - return msgList_[0]; - } - - /** - Returns the list of AS400Messages causing this exception. - - @return The list of AS400Messages causing this exception. - */ - public AS400Message[] getAS400MessageList() - { - return msgList_; - } - - - } diff --git a/cvsroot/src/com/ibm/as400/access/AS400FTP.java b/cvsroot/src/com/ibm/as400/access/AS400FTP.java deleted file mode 100644 index fc1948bac..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400FTP.java +++ /dev/null @@ -1,1185 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400FTP.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.net.*; -import java.util.*; -import java.beans.*; - - - -/** - * Represents a client for the IBM i FTP server. - * It is written to take advantage of IBM i features. - * Use the parent class, FTP, if you need a generic - * client. - * - *

    AS400FTP does the following extra processing: - *

      - *
    1. Using the AS400 object to determine system name, - * userid and password so these properties can be shared with other - * Toolbox classes. If you use the FTP class, your application must set - * the system name, userid, and password in both the FTP class and other - * Toolbox classes. - *

      - * One restriction when the client is an IBM i system -- - * the userid and password must be - * set on the AS400 object in this environment. That is, *CURRENT - * will not work when connecting from one IBM i system to another IBM i system. - *

    2. - * Automatically setting the current directory to the - * root directory on the system when a connection is made. If the - * FTP class is used, the root may be QSYS.LIB when - * a connection is made. The integrated file system name - * of objects in libraries must be used to access them. - * For example, /QSYS.LIB/MYLIB.LIB/MYFILE.FILE. See - * - * QSYSObjectPathName documentation for more information. - *

    3. - * Handling extra work necessary to put a save file - * to the system. If you use the FTP class, you have to - * do the extra steps. The extra processing is done only - * if the extension of the file is .savf and the file will be - * put into an IBM i library. - *

      - * The extra processing includes internally using Toolbox CommandCall - * to create the save file on the system. The default *Public authority - * is *EXCLUDE. Use - * the setSaveFilePublicAuthority() method to change the *Public - * authority value specified on the create save file command. - *

    - *

    - * No encryption is provided by this class. The userid and password - * flow un-encrypted to the system. This class is not SSL enabled. - *

    - * The forward slash is the separator character for paths sent - * to the FTP server. - *

    - * The following example puts a save file to the system. - * Note the application does not set data transfer type to - * binary or use Toolbox CommandCall to create the save file. - * Since the extension is .savf, - * AS400FTP class detects the file to put is a save file - * so it does these step automatically. - * - *

    - * AS400 system = new AS400();
    - * AS400FTP   ftp    = new AS400FTP(system);
    - * ftp.put("myData.savf", "/QSYS.LIB/MYLIB.LIB/MYDATA.SAVF");
    - * 
    - * -**/ - -public class AS400FTP - extends FTP - implements java.io.Serializable -{ - static final long serialVersionUID = 4L; - - - // ********************************************************** - // * * - // * This class has two main tasks: * - // * 1) Use the Toolbox AS400 object to identify * - // * the system, userid and password, the use the * - // * AS400 object to connect to the FTP server. * - // * 2) Special save file process above. Detour the * - // * put routine to see if we first need to create the * - // * save file. * - // * * - // * Other than these two tasks it just punts to the super * - // * class to do all the work. * - // * * - // ********************************************************** - - - - - - - // ********************************************************** - // * * - // * Don't forget to update readObject() if transient * - // * variables are added! * - // * * - // ********************************************************** - - private AS400 system_; - transient private boolean connected_ = false; - transient private boolean inConnect_ = false; - transient private boolean inSaveFileProcessing_ = false; - - private String saveFilePublicAuthority_ = "*EXCLUDE"; - private String CDToRoot = "/"; - - private static ResourceBundleLoader loader_; - -// ----------------------------------------------------------------------- - /** - * Constructs an AS400FTP object. - * The AS400 object must be set before - * requests are sent to the system. - * @see #setSystem - **/ - - public AS400FTP() - { - } - - - - - -// ----------------------------------------------------------------------- - /** - * Constructs an AS400FTP object. - * @param system The system to which to connect. - **/ - - public AS400FTP(AS400 system) - { - if (system == null) - throw new NullPointerException("system"); - - system_ = system; - } - - - -// @D5 new method -// --------------------------------------------------------------------------- - /** - * Starts the process of appending to a file on the system. AS400FTP - * opens the data connection to the system, then opens the file on - * the system and returns an output stream to the caller. The caller - * then writes the file's data to the output stream. - * @param fileName The file to put. - * @return An output stream to the file. The caller uses the output - * stream to write data to the file. - * Null is returned if the connection to the system fails. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized OutputStream append(String fileName) - throws IOException - { - OutputStream result = null; - - if (connect()) - { - saveFileProcessing(fileName); - try { result = super.append(fileName); } - finally { inSaveFileProcessing_ = false; } - } - - return result; - } - - - - -// @D5 new method -// --------------------------------------------------------------------------- - /** - * Appends to a file on the system. - * @param sourceFileName The file to put. - * @param targetFileName The file on the system. - * @return true if the append was successful; false otherwise. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized boolean append(String sourceFileName, String targetFileName) - throws IOException - { - boolean result = false; - - if (connect()) - { - saveFileProcessing(targetFileName); - try { result = super.append(sourceFileName, targetFileName); } - finally { inSaveFileProcessing_ = false; } - } - - return result; - } - - - - - -// @D5 new method -// --------------------------------------------------------------------------- - /** - * Appends to a file on the system. - * @param sourceFileName The file to put. - * @param targetFileName The file on the system. - * @return true if the append was successful; false otherwise. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized boolean append(java.io.File sourceFileName, String targetFileName) - throws IOException - { - boolean result = false; - - if (connect()) - { - saveFileProcessing(targetFileName); - try { result = super.append(sourceFileName, targetFileName); } - finally { inSaveFileProcessing_ = false; } - } - - return result; - } - - - -// --------------------------------------------------------------------------- - /** - * Sets the current directory on the system to directory. - * The method is the same as setCurrentDirectory(). - * The message returned from the system is saved. Use getLastMessage() - * to retrieve it. - * @param directory The current directory to set on the system. - * @return true if directory changed; false otherwise. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public boolean cd(String directory) - throws IOException - { - if (connect()) - return super.cd(directory); - else - return false; - } - - - - -// --------------------------------------------------------------------------- - /** - * Connects to the system. - * The AS400 object must be set - * before calling this method. - * Calling connect is optional. Methods that communicate - * with the system such as get, put, cd, and ls call connect() - * if necessary. - * The message returned from the system is saved. Use getLastMessage() - * to retrieve it. - * @return true if connection is successful; false otherwise. - * @exception UnknownHostException If a path to the system cannot be found. - * @exception IOException If an error occurs while connecting to the system. - * @exception IllegalStateException If called before user and password are set. - * @see #setSystem - **/ - - public synchronized boolean connect() - throws UnknownHostException, - IOException, - IllegalStateException - { - if (! connected_) - { - - if (system_ == null) - { - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Force a sign-on. Since the super class does not throw - // AS400 exceptions I have to catch it and throw an - // IOException. The @D5 change is to call signon(false) - // instead of getVRM(); - try - { - system_.signon(false); // @D5a - } - catch (AS400SecurityException e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"Security exception in getVRM()", e); - - throw new IOException(e.getMessage()); - } - - AS400ImplRemote systemImpl = (AS400ImplRemote)system_.getImpl(); // @D2a - Socket socket = systemImpl.getConnection(super.getPort()); // @D2a - BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); // @D2a - PrintWriter writer = new PrintWriter(socket.getOutputStream(), true); // @D2a - // @D2a - super.externallyConnected(system_.getSystemName(), // @D2a - socket, // @D2a - reader, // @D2a - writer); // @D2a - connected_ = true; // @D2a - - inConnect_ = true; - - try - { - if (! cd(CDToRoot)) - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"CD to root failed " + getLastMessage()); - } - } - finally { inConnect_ = false; } - - if (connected_) // @D2a - super.fireEvent(FTPEvent.FTP_CONNECTED); // @D2a - } - - return connected_; - } - - - - - - -// --------------------------------------------------------------------------- - /** - * Lists the contents of the current working directory. File name and - * attributes are returned for each entry in the directory. - * An array of length zero is returned if the directory is empty. - * @return The contents of the directory as an array of Strings. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public String[] dir() - throws IOException - { - - if (connect()) - return super.dir(); - else - return new String[0]; - } - - - - - - - -// --------------------------------------------------------------------------- -// @d4 new method - /** - * Lists the contents of the current directory. File name and - * attributes are returned for each entry in the directory. - * A zero length array is returned if the directory is empty - * or if no files match the search criteria. - * @return The contents of the directory as an array of Strings. - * @param criteria The search criteria. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public String[] dir(String criteria) - throws IOException - { - - if (connect()) - return super.dir(criteria); - else - return new String[0]; - } - - - - - - - - - - - -// --------------------------------------------------------------------------- - /** - * Starts the process of getting a file from the system. AS400FTP - * opens the data connection to the system, then opens the file on - * the system and returns an input stream to the caller. The caller - * reads the file's data from the input stream. - * The source file is on the system, accessed via FTP so the path - * separator character (if any) must be a forward slash. - * - * @param fileName The file to get. - * @return An input stream to the file. The caller uses the input - * stream to read the data from the file. Null is returned - * if the connection to the system fails. - * @exception IOException If an error occurs while communicating with the system. - * @exception FileNotFoundException If the name is a directory or the name is not found. - **/ - - public InputStream get(String fileName) - throws IOException, FileNotFoundException - { - if (connect()) - return super.get(fileName); - else - return null; - } - - - - -// --------------------------------------------------------------------------- - /** - * Gets a file from the system. - * The source file is on the system, accessed via FTP so the path - * separator character (if any) must be a forward slash. - * The target file is on the client, accessed via java.io - * so the path separator character (if any) must be client specific. - * @param sourceFileName The file to get on the system. - * @param targetFileName The file on the target file system. - * @return true if the copy was successful; false otherwise. - * @exception IOException If an error occurs while communicating with the system. - * @exception FileNotFoundException If the source file or the targe file - * cannot be accessed. - **/ - - public boolean get(String sourceFileName, String targetFileName) - throws IOException, FileNotFoundException - { - if (connect()) - return super.get(sourceFileName, targetFileName); - else - return false; - } - - - - - -// --------------------------------------------------------------------------- - /** - * Gets a file from the system. - * The source file is on the system, accessed via FTP so the path - * separator character (if any) must be a forward slash. - * The target file is an instance of Java.io.file. - * @param sourceFileName The file to get on the system. - * @param targetFile The file on the target file system. - * @return true if the copy was successful; false otherwise. - * @exception IOException If an error occurs while communicating with the system. - * @exception FileNotFoundException If the source file or the targe file - * cannot be accessed. - **/ - - public boolean get(String sourceFileName, java.io.File targetFile) - throws IOException, FileNotFoundException - { - if (connect()) - return super.get(sourceFileName, targetFile); - else - return false; - } - - - - - - - -// --------------------------------------------------------------------------- - /** - * Returns the current directory on the system. - * @return The current directory on the system. - * Null is returned if the connection to the system fails. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public String getCurrentDirectory() - throws IOException - { - if (connect()) - return super.getCurrentDirectory(); - else - return null; - } - - - - - -// --------------------------------------------------------------------------- - /** - * Returns the public authority of save files created by - * this object. If this object detects putting a save file - * to the library file system of the system, it will first - * create the save file by sending a CRTSAVF command to - * the system. The method lets you set the *PUBLIC authority - * value on the CRTSAVF command. The default is *EXCLUDE. - * @return The authority granted to *PUBLIC. - **/ - - public String getSaveFilePublicAuthority() - { - return saveFilePublicAuthority_; - } - - - - - - -// --------------------------------------------------------------------------- - /** - * Returns the name of the system. Null is returned if no system has - * been set. - * @return The name of the system to which this object connects. - **/ - - public AS400 getSystem() - { - return system_; - } - - - - - - - - -// --------------------------------------------------------------------------- - /** - * Sends a command to the system, returning the reply from the system. - *

    - * The command is not altered before sending it to the system, so it - * must be recognized by the system. Many FTP applications change - * commands so they are recognized by the system. For example, the - * command to get a list of files from the system is NLST, not ls. Many - * FTP applications convert ls to NLST before sending the command to - * the system. This method will not do the conversion. - * @param cmd The command to send to the system. - * @return The reply to the command. - * Null is returned if the connection to the system fails. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized String issueCommand(String cmd) - throws IOException - { - boolean result = true; - - if (! inConnect_) - result = connect(); - - if (result) - return super.issueCommand(cmd); - else - return null; - } - - - - - - - - - - -// --------------------------------------------------------------------------- - /** - * Lists the contents of the current working directory. If the directory - * is empty, an empty list is returned. - * @return The contents of the directory as an array of Strings. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public String[] ls() - throws IOException - { - if (connect()) - return super.ls(); - else - return new String[0]; - } - - - - - - - - - - -// --------------------------------------------------------------------------- -// @d4 new method - /** - * Lists the contents of the current directory. If the directory - * is empty or no files match the search criteria, an empty list is returned. - * @return The contents of the directory as an array of Strings. - * @param criteria The search criteria. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public String[] ls(String criteria) - throws IOException - { - if (connect()) - return super.ls(criteria); - else - return new String[0]; - } - - - - - - -// --------------------------------------------------------------------------- - /** - * Sends the NOOP (no operation) command to the system. This - * request is most useful to see if the connection to the system - * is still active - * @return true if the request was successful, false otherwise. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public boolean noop() - throws IOException - { - boolean result = true; - - if (! inConnect_) - result = connect(); - - if (result) - return super.noop(); - else - return false; - } - - - - - -// --------------------------------------------------------------------------- - /** - * Starts the process of putting a file to the system. AS400FTP - * opens the data connection to the system, then opens the file on - * the system and returns an output stream to the caller. The caller - * then writes the file's data to the output stream. - * @param fileName The file to put. - * @return An output stream to the file. The caller uses the output - * stream to write data to the file. - * Null is returned if the connection to the system fails. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized OutputStream put(String fileName) - throws IOException - { - OutputStream result = null; - - if (connect()) - { - saveFileProcessing(fileName); - try { result = super.put(fileName); } - finally { inSaveFileProcessing_ = false; } - } - - return result; - } - - - - - -// --------------------------------------------------------------------------- - /** - * Puts a file to the system. - * @param sourceFileName The file to put. - * @param targetFileName The file on the system. - * @return true if the copy was successful; false otherwise. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized boolean put(String sourceFileName, String targetFileName) - throws IOException - { - boolean result = false; - - if (connect()) - { - saveFileProcessing(targetFileName); - try { result = super.put(sourceFileName, targetFileName); } - finally { inSaveFileProcessing_ = false; } - } - - return result; - } - - - - - - -// --------------------------------------------------------------------------- - /** - * Puts a file to the system. - * @param sourceFileName The file to put. - * @param targetFileName The file on the system. - * @return true if the copy was successful; false otherwise. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized boolean put(java.io.File sourceFileName, String targetFileName) - throws IOException - { - boolean result = false; - - if (connect()) - { - saveFileProcessing(targetFileName); - try { result = super.put(sourceFileName, targetFileName); } - finally { inSaveFileProcessing_ = false; } - } - - return result; - } - - - - -// --------------------------------------------------------------------------- - /** - * Returns the current directory on the system. PWD is the ftp - * command Print Working Directory. - * @return The current directory on the system. - * Null is returned if the connection to the system fails. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized String pwd() - throws IOException - { - - if (connect()) - return super.pwd(); - else - return null; - } - - - -// --------------------------------------------------------------------------- - /** - * During object deserialization, this method is called. When it is call - * we need to initialize transient data. - **/ - - private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - - connected_ = false; - inConnect_ = false; - inSaveFileProcessing_ = false; - } - - - - - - - -// --------------------------------------------------------------------------- - // does processing before putting a save file - - private void saveFileProcessing(String target) - throws IOException - { - // My wonderful design causes this method to be called - // multiple times. put(xx,xx) calls put(yy,yy) which - // calls put(zz). Each of the put routines calls this - // method so, if the first put method is called this method - // will be called three times. To prevent doing this function - // three times I will set a flag here and clear it when I - // exit the put routine. - if (! inSaveFileProcessing_) - { - inSaveFileProcessing_ = true; - - target = target.toUpperCase(); - target = target.trim(); - - // First look for the .savf extension. If the extension - // is not .savf then skip all this special processing - // and do a normal put. - if (target.endsWith(".SAVF")) - { - // The extension is .savf so we may need to do - // special processing. Next determine if the name - // is fully qualified or relative to the current - // directory. If relative then do a pwd() to get - // the current directory. - if (! target.startsWith("/")) - { - String currentPath = pwd(); - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"pwd: " + currentPath); - - // If I am not able to get the current path - // then just return and attempt to do a normal - // put. - if (currentPath == null) - return; - - // We received something from the server. On - // the server, pwd() returns - // 257 "/a/b/c" is current directory - // so I need to pull the real directory out - // of the message. If the message does not - // start with 257 then I received some other - // unexpected message so I will return and - // do normal processing. - if (currentPath.startsWith("257")) - { - int start = currentPath.indexOf("\""); - - if (start < 0) - return; - else - start++; - - int end = currentPath.indexOf("\"", start); - - if (end < start) - return; - - currentPath = currentPath.substring(start,end); - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, start + " " + end + " " + currentPath); - } - else - return; - - // Now finish building the fully qualified path + name - if (currentPath.endsWith("/")) - target = currentPath + target; - else - target = currentPath + "/" + target; - - } - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"target: " + target); - - try - { - // "target" if the fully qualified name. Now see if the - // name is in the library file system. Load target - // into QSYSObjectPathName. If illegalPathName exception - // is thrown then we are in ifs not the library file - // system so don't do special processing. - QSYSObjectPathName target2 = new QSYSObjectPathName(target); - - // We didn't get an exception so we are in the library file - // system. The next step is to create the save file. - // Create a command call string to do a create save file. - CommandCall c = new CommandCall(system_); - - String command = "CRTSAVF " + - " FILE(" + target2.getLibraryName() + "/" + target2.getObjectName() + ")" + - " AUT(" + saveFilePublicAuthority_ + ")"; - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"command string " + command); - - try { c.setCommand(command); } catch (PropertyVetoException pve) {} - c.suggestThreadsafe(false); // CRTSAVF is not threadsafe. @A1A - - try - { - boolean result = c.run(); - - AS400Message[] messageList = c.getMessageList(); - String crtSaveFileMessage = messageList[0].getText(); - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"message[0]: " + crtSaveFileMessage); - - // ignore 'save file already exists' message - if (! result) - { - if (messageList[0].getID().startsWith("CPF5813")) - result = true; - } - - if (! result) - { - String MRIMessage = " "; - MRIMessage = loader_.getText("CREATE_SAVE_FILE_FAILED"); - throw new IOException(MRIMessage + crtSaveFileMessage); - } - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"IO Exception running command call ", e); - - throw new IOException(e.getMessage()); - } - - // The last step is to set transfer mode to binary. After - // setting the mode to binary we are ready to put - // the data. - setDataTransferType(FTP.BINARY); - - } - catch (IllegalPathNameException e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"the put ends up in ifs"); - } - } - else - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"the put is not for a save file "); - } - } - } - - - - - - - - - - - - -// --------------------------------------------------------------------------- - /** - * Sets the current directory on the system to directory. - * The method is the same as cd(). - * The message returned from the system is saved. Use getLastMessage() - * to retrieve it. - * @param directory The current directory to set on the system. - * @return true if directory changed; false otherwise. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized boolean setCurrentDirectory(String directory) - throws IOException - { - if (connect()) - return super.setCurrentDirectory(directory); - else - return false; - } - - - - - - -// --------------------------------------------------------------------------- - /** - * Sets the data transfer type. Valid values are: - *

      - *
    • {@link FTP#ASCII ASCII} - *
    • {@link FTP#BINARY BINARY} - *
    - *

    - * If a connection does not - * already exist, a connection is made to the system. - * The message returned from the system is saved. Use getLastMessage() - * to retrieve it. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public void setDataTransferType(int transferType) - throws IOException - { - if (connect()) - super.setDataTransferType(transferType); - } - - - -// --------------------------------------------------------------------------- - /** - * Calling setPassword() is valid only for FTP objects. An - * IllegalStateException is thrown if setPassword() is called - * on an AS400FTP object. SetPassword() is not needed - * because AS400FTP gets the - * password from the AS400 object. - **/ - - public void setPassword(String password) - { - if (inConnect_) - super.setPassword(password); - else - throw new IllegalStateException("password"); - } - - - - - - - -// --------------------------------------------------------------------------- - /** - * Sets the public authority of save files created by - * this object. If this object detects putting a save file - * to the library file system of the system, it will first - * create the save file by sending a CRTSAVF command to - * the system. Through this method you can set the *PUBLIC - * authority used when sending the CRTSAVF command. The - * value is set only if the save file is created. The public - * authority of an existing save file is not changed. - *

    Valid values are: - *

      - *
    • *ALL - *
    • *CHANGE - *
    • *EXCLUDE - *
    • *LIBCRTAUT - *
    • *USE - *
    • authorization-list name. - *
    - *

    The default value is *EXCLUDE - * @param publicAuthority *PUBLIC authority. - * @exception PropertyVetoException If the change is vetoed. - **/ - - public void setSaveFilePublicAuthority(String publicAuthority) - throws PropertyVetoException - { - if (publicAuthority == null) - throw new NullPointerException("saveFilePublicAuthority"); - - if (publicAuthority.length() == 0) - throw new IllegalArgumentException("saveFilePublicAuthority"); - - // Remember the old system. - String oldValue = saveFilePublicAuthority_; - - // Fire a vetoable change event for system. - if (vetos_ != null) { - vetos_.fireVetoableChange("saveFilePublicAuthority", oldValue, publicAuthority); - } - - saveFilePublicAuthority_ = publicAuthority; - - // Fire the property change event. - if (changes_ != null) { - changes_.firePropertyChange("saveFilePublicAuthority", oldValue, publicAuthority); - } - } - - - - -// --------------------------------------------------------------------------- - /** - * Calling setServer() is valid only for FTP objects. An - * IllegalStateException is thrown if setServer() is called - * on an AS400FTP object. SetServer() is not needed - * because AS400FTP gets the - * system name from the AS400 object. - * @exception PropertyVetoException If the change is vetoed. - **/ - - public void setServer(String server) - throws PropertyVetoException - { - if (inConnect_) - super.setServer(server); - else - throw new IllegalStateException("server"); - } - - - - - - - - -// --------------------------------------------------------------------------- - /** - * Sets the name of the system. The system name cannot be changed once - * a connection is made to the system. - * @param system The name of the system to which this object connects. - * @exception PropertyVetoException If the change is vetoed. - **/ - - public synchronized void setSystem(AS400 system) - throws PropertyVetoException - { - if (system == null) - throw new NullPointerException("system"); - - if (connected_) - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - // Remember the old system. - AS400 oldSystem = system_; - - // Fire a vetoable change event for system. - if (vetos_ != null) { - vetos_.fireVetoableChange("system", oldSystem, system); - } - - system_ = system; - - // Fire the property change event. - if (changes_ != null) { - changes_.firePropertyChange("system", oldSystem, system); - } - } - - - - -// --------------------------------------------------------------------------- - /** - * Calling setUser() is valid only for FTP objects. An - * IllegalStateException is thrown if setUser() is called - * on an AS400FTP object. SetUser() is not needed - * because AS400FTP gets the - * userid from the AS400 object. - * @exception PropertyVetoException If the change is vetoed. - **/ - - public void setUser(String user) - throws PropertyVetoException - { - if (inConnect_) - super.setUser(user); - else - throw new IllegalStateException("user"); - } - -} - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400FTP16.gif b/cvsroot/src/com/ibm/as400/access/AS400FTP16.gif deleted file mode 100644 index 4fe64aa12..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400FTP16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400FTP32.gif b/cvsroot/src/com/ibm/as400/access/AS400FTP32.gif deleted file mode 100644 index 2fbd934c1..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400FTP32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400FTPBeanInfo.java b/cvsroot/src/com/ibm/as400/access/AS400FTPBeanInfo.java deleted file mode 100644 index d48c171a0..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400FTPBeanInfo.java +++ /dev/null @@ -1,143 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400FTPBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.VetoableChangeListener; - - -/** - The AS400FTPBeanInfo class provides bean information for - the FTP class. -**/ - -public class AS400FTPBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private final static Class beanClass = AS400FTP.class; - private static PropertyDescriptor[] properties_; - private static ResourceBundleLoader loader_; - - static - { - try - { - // Define the property descriptors. - - PropertyDescriptor system = new PropertyDescriptor("system", beanClass); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(loader_.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(loader_.getText("PROP_DESC_SYSTEM")); - - PropertyDescriptor publicAut = new PropertyDescriptor("saveFilePublicAuthority", beanClass); - publicAut.setBound(true); - publicAut.setConstrained(true); - publicAut.setDisplayName(loader_.getText("PROP_NAME_SAVE_FILE_PUBLIC_AUTHORITY")); - publicAut.setShortDescription(loader_.getText("PROP_DESC_SAVE_FILE_PUBLIC_AUTHORITY")); - - PropertyDescriptor[] properties = - { - system, publicAut - }; - - properties_ = properties; - - } - catch(Exception e) - { - throw new Error(e.toString()); - } - } - - - - /** - Returns additional bean information. - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new FTPBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - - - - - - - - /** - Returns the default property index. - @return The default property index. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("AS400FTP16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("AS400FTP32.gif"); - break; - } - - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/AS400File.java b/cvsroot/src/com/ibm/as400/access/AS400File.java deleted file mode 100644 index c616df7b3..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400File.java +++ /dev/null @@ -1,2610 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400File.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.net.UnknownHostException; -import java.util.Enumeration; -import java.util.Vector; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; //@B0A -import java.beans.PropertyChangeEvent; -import java.beans.PropertyVetoException; - -/** - *Represents a physical or logical file on the system. - *This class allows the user to do the following: - *

      - *
    • Create a physical file on the system by: - *
        - *
      • Specifying a record length. - *
      • Specifying an existing DDS source file. - *
      • Specifying a RecordFormat object that contains a description of the - *record format for the file. - *
      - *
    • Access the records in a system file sequentially, by record number, or by - *key. - * Note: To read a keyed physical or logical file sequentially and have the records - * returned in key order, use the read...() methods of {@link KeyedFile KeyedFile}. - *
    • Write records to a system file sequentially or by key. - *
    • Update records in a system file sequentially, by record number or by key. - *
    • Lock a system file for different types of access. - *
    • Use commitment control when accessing a system file. The user can: - *
        - *
      • Start commitment control for the connection. - *
      • Specify different commitment control lock levels for the individual - * files being accessed. - *
      • Commit and rollback transactions for the connection. - *
      - *
    • Delete a physical or logical file or member on the system. - *
    - *AS400File objects generate the following events: - *
      - *
    • FileEvent - *
      The events fired are: - *
        - *
      • FILE_CLOSED - *
      • FILE_CREATED - *
      • FILE_DELETED - *
      • FILE_MODIFIED - *
      • FILE_OPENED - *
      - *
    • PropertyChangeEvent - *
    • VetoableChangeEvent - *
    - *@see AS400FileRecordDescription - *@see MemberList - **/ -abstract public class AS400File implements Serializable -{ - private static final String CLASSNAME = "com.ibm.as400.access.AS400File"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - static final long serialVersionUID = 4L; - - ////////////////////////////////////////////////////////////////////////// - // CONSTANTS - ////////////////////////////////////////////////////////////////////////// - //@C2A - /** - * Constant indicating a text description of *BLANK. - *@see AS400File#create - **/ - static public final String BLANK = AS400FileConstants.BLANK; - - /** - *Constant indicating a commit lock level of *ALL. - *Every record accessed in the file is locked until the - *transaction is committed or rolled back. - *@see AS400File#startCommitmentControl - **/ - static public final int COMMIT_LOCK_LEVEL_ALL = AS400FileConstants.COMMIT_LOCK_LEVEL_ALL; //@B1C - - /** - *Constant indicating a commit lock level of *CHANGE. - *Every record read for update is locked. If a record - *is updated, added, or deleted, that record remains locked - *until the transaction is committed or rolled back. Records - *that are accessed for update but are released without being - *updated are unlocked. - *@see AS400File#startCommitmentControl - **/ - static public final int COMMIT_LOCK_LEVEL_CHANGE = AS400FileConstants.COMMIT_LOCK_LEVEL_CHANGE; //@B1C - /** - *Constant indicating a commit lock level of *CS. - *Every record accessed is locked. Records that are not - *updated or deleted are locked only until a different record - *is accessed. Records that are updated, added, or deleted are locked - *until the transaction is committed or rolled back. - *@see AS400File#startCommitmentControl - **/ - static public final int COMMIT_LOCK_LEVEL_CURSOR_STABILITY = AS400FileConstants.COMMIT_LOCK_LEVEL_CURSOR_STABILITY; //@B1C - /** - *Constant indicating that the commit lock level specified on the - *startCommitmentControl() method should be used. - *The record locking specified by the commitLockLevel parameter on the - *startCommitmentControl() method will apply to transactions using this file. - **/ - static public final int COMMIT_LOCK_LEVEL_DEFAULT = AS400FileConstants.COMMIT_LOCK_LEVEL_DEFAULT; //@B1C - /** - *Constant indicating that no commitment control should be used for the file. - *No commitment control will apply to this file. - *@see AS400File#startCommitmentControl - **/ - static public final int COMMIT_LOCK_LEVEL_NONE = AS400FileConstants.COMMIT_LOCK_LEVEL_NONE; //@B1C - - /** - *Constant indicating lock type of read willing to share with - *other readers. This is the equivalent of specifying *SHRNUP - *on the Allocate Object (ALCOBJ) command. - *@see AS400File#lock - **/ - static public final int READ_ALLOW_SHARED_READ_LOCK = AS400FileConstants.READ_ALLOW_SHARED_READ_LOCK; //@B1C - /** - *Constant indicating lock type of read willing to share with - *updaters. This is the equivalent of specifying *SHRRD - *on the Allocate Object (ALCOBJ) command. - *@see AS400File#lock - **/ - static public final int READ_ALLOW_SHARED_WRITE_LOCK = AS400FileConstants.READ_ALLOW_SHARED_WRITE_LOCK; //@B1C - /** - *Constant indicating lock type of read willing to share with no one. - *This is the equivalent of specifying *EXCL on the Allocate Object (ALCOBJ) - *command. - *@see AS400File#lock - **/ - static public final int READ_EXCLUSIVE_LOCK = AS400FileConstants.READ_EXCLUSIVE_LOCK; //@B1C - /** - *Constant indicating open type of read only. - *@see AS400File#open - **/ - static public final int READ_ONLY = AS400FileConstants.READ_ONLY; //@B1C - /** - *Constant indicating open type of read/write. - *@see AS400File#open - **/ - static public final int READ_WRITE = AS400FileConstants.READ_WRITE; //@B1C - - //@C2A - /** - * Constant indicating a text description of *SRCMBRTXT. - *@see AS400File#create - **/ - static public final String SOURCE_MEMBER_TEXT = AS400FileConstants.SOURCE_MEMBER_TEXT; - - //@C2A - /** - * Constant indicating a file type of *DATA. - *@see AS400File#create - **/ - static public final String TYPE_DATA = AS400FileConstants.TYPE_DATA; - - //@C2A - /** - * Constant indicating a file type of *SRC. - *@see AS400File#create - **/ - static public final String TYPE_SOURCE = AS400FileConstants.TYPE_SOURCE; - - - /** - *Constant indicating lock type of update willing to share with - *readers. This is the equivalent of specifying *EXCLRD - *on the Allocate Object (ALCOBJ) command. - *@see AS400File#lock - **/ - static public final int WRITE_ALLOW_SHARED_READ_LOCK = AS400FileConstants.WRITE_ALLOW_SHARED_READ_LOCK; //@B1C - /** - *Constant indicating lock type of update willing to share with - *updaters. This is the equivalent of specifying *SHRUPD - *on the Allocate Object (ALCOBJ) command. - *@see AS400File#lock - **/ - static public final int WRITE_ALLOW_SHARED_WRITE_LOCK = AS400FileConstants.WRITE_ALLOW_SHARED_WRITE_LOCK; //@B1C - /** - *Constant indicating lock type of update willing to share with - *no one. This is the equivalent of specifying *EXCL - *on the Allocate Object (ALCOBJ) command. - *@see AS400File#lock - **/ - static public final int WRITE_EXCLUSIVE_LOCK = AS400FileConstants.WRITE_EXCLUSIVE_LOCK; //@B1C - /** - *Constant indicating open type of write only. - *@see AS400File#open - **/ - static public final int WRITE_ONLY = AS400FileConstants.WRITE_ONLY; //@B1C - - ////////////////////////////////////////////////////////////////////////// - // VARIABLES - ////////////////////////////////////////////////////////////////////////// - - // EVENT SUPPORT - // Use default property change support - transient PropertyChangeSupport changes_; - // Use default vetoable change support - transient VetoableChangeSupport vetos_ ; //@B0A - // The list of FileEvent listeners - transient Vector fileListeners_; - - // Is the file open - transient boolean isOpen_; - // The readNoUpdate flag is treated like a bean property, - // even though it's not. - boolean readNoUpdate_ = false; //@B5A - - boolean ssp_ = false; // Treat the file as an SSP file or a regular DDM file. - - // The library name of the file - String library_ = ""; - - // BEAN PROPERTIES - // The file name - String file_ = ""; - // The member name of the file - String member_ = ""; - // The IFS pathname of the file. - String name_ = ""; - // Record format for the file. - RecordFormat recordFormat_; - // The system connection information - AS400 system_; - - // The implementation object. - transient AS400FileImpl impl_; //@B0C - - - /** - *Constructs an AS400File object. - **/ - public AS400File() - { - initializeTransient(); - } - - /** - *Constructs an AS400File object. It uses the system and file name specified. - *If the name for the file does not include a member, the - *first member of the file will be used. - *@param system The system to which to connect. The system cannot - *be null. - *@param name The integrated file system pathname of the file. The name - *cannot be null. - **/ - public AS400File(AS400 system, String name) - { - // Verify parameters - if (system == null) - { - throw new NullPointerException("system"); - } - if (name == null) - { - throw new NullPointerException("name"); - } - - initializeTransient(); - - // Set the instance data - setName(name); //@B0A - system_ = system; - } - - /** - *Adds a listener to be notified when a FileEvent is fired. - *@see #removeFileListener - *@param listener The FileListener. - **/ - public void addFileListener(FileListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - fileListeners_.addElement(listener); - } - - - /** - *Adds a physical file member to the file represented by this object. - *@param name The name of the member to create. The name cannot - *exceed 10 characters in length. The name cannot be null. - *@param textDescription The text description with which to create the file. - *This value must be 50 characters or less. If this value is null, the - *text description will be blank.
    - *The name of the file and the system to which to connect must be set - *prior to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped - * unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the - * system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public void addPhysicalFileMember(String name, String textDescription) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify parameters - if (name == null) - { - throw new NullPointerException("name"); - } - if (name.length() > 10) - { - throw new ExtendedIllegalArgumentException("name (" + name + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (textDescription != null) - { - if (textDescription.length() > 50) - { - throw new ExtendedIllegalArgumentException("textDescription (" + textDescription + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - } - chooseImpl(); - impl_.doIt("addPhysicalFileMember", - new Class[] { String.class, String.class}, - new Object[] { name, textDescription }); - } - - - /** - *Adds a listener to be notified when the value of any bound - *property is changed. The propertyChange method will be - *be called. - *@see #removePropertyChangeListener - *@param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - changes_.addPropertyChangeListener(listener); - } - - - /** - *Adds a listener to be notified when the value of any constrained - *property is changed. - *The vetoableChange method will be called. - *@see #removeVetoableChangeListener - *@param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - vetos_.addVetoableChangeListener(listener); //@B0C - } - - - //@B0A - /** - * Internal method to verify file is open. - * Tastes great, less bytes. - **/ - void checkOpen() - { - if (!isOpen_) - { - throw new ExtendedIllegalStateException(ExtendedIllegalStateException.OBJECT_MUST_BE_OPEN); - } - } - - - /** - Creates the proper implementation. - **/ - synchronized void chooseImpl() throws AS400SecurityException, IOException - { - if (impl_ == null) - { - // Verify object state - if (system_ == null) - { - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (name_ == null || name_.length() == 0) - { - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - //@B0C - impl_ = (AS400FileImpl)system_.loadImpl3("com.ibm.as400.access.AS400FileImplNative", - "com.ibm.as400.access.AS400FileImplRemote", - "com.ibm.as400.access.AS400FileImplProxy"); - - - // system_.connectService(AS400.RECORDACCESS); //@B5A - - system_.signon(false); - - // This line replaces the following 4 lines. - impl_.doItNoExceptions("setAll", - new Class[] { AS400Impl.class, //@B5C - String.class, - RecordFormat.class, - Boolean.TYPE, //@B5A - Boolean.TYPE, - Boolean.TYPE }, - new Object[] { system_.getImpl(), //@B5C - name_, - recordFormat_, - new Boolean(readNoUpdate_), //@B5A - new Boolean(this instanceof KeyedFile), - new Boolean(ssp_) }); - - // impl_.doItNoExceptions("setSystem", new Class[] { AS400.class }, new Object[] { system_ }); //@B0A - // impl_.doItNoExceptions("setPath", new Class[] { String.class }, new Object[] { name_ }); //@B0A - // impl_.doItNoExceptions("setRecordFormat", new Class[] { RecordFormat.class }, new Object[] { recordFormat_ }); //@B0A - - // The following line is provided so the remote class knows - // if it is a keyed file or a sequential file. - // impl_.doItNoExceptions("setIsKeyed", new Class[] { Boolean.TYPE }, new Object[] { new Boolean(this instanceof KeyedFile) }); //@B0A - } - } - - - /** - *Closes the file on the system. All file locks held by this connection - *are released. All uncommitted transactions against the file are - *rolled back if commitment control has been started. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the - *system. - **/ - public synchronized void close() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (isOpen_) //@B0C - { - //@C1 - In mod3, there is no convenient way for the proxy server - // to inform the client that the connection has been dropped - // and that we should set our AS400File object to be closed. - // So, we leave it up to the user to call close() and we will - // just swallow any ConnectionDroppedExceptions we encounter. - try //@C1A - { //@C1A - // Release any explicit locks - try - { - releaseExplicitLocks(); - } - catch(AS400SecurityException e) - { - // This will only occur during connect(). We are already connected so - // this exception will never occur. Therefore we do a try...catch here - // to shut the compiler up. - } - - // Close the file. - doIt("close"); - } //@C1A - catch(ConnectionDroppedException x) //@C1A - { //@C1A - } //@C1A - - // Reset the open flag - isOpen_ = false; - - //@B0C - // Fire the FILE_CLOSED FileEvent - fireEvent(FileEvent.FILE_CLOSED); - } - } - - private void doIt(String x) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - impl_.doIt(x, new Class[0], new Object[0]); - } - - /** - *Commits all transactions since the last commit boundary. Invoking this - *method will cause all transactions under commitment control for this - *connection to be committed. This means that any AS400File object opened - *under this connection, for which a commit lock level was specified, will - *have outstanding transactions committed. If commitment control has not been - *started for the connection, no action is taken.
    - *The system to which to connect must be set prior to invoking this - *method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setSystem - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped - *unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the - *system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public void commit() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (isCommitmentControlStarted()) // if returns true, then impl has been chosen. - { - // Commit. - doIt("commit"); - } - } - - - //@E2A - /** - *Commits all transactions since the last commit boundary for the specified system. - *Invoking this method will cause all transactions under commitment control for the - *specified connection to be committed. This means that any AS400File object opened - *under this connection, for which a commit lock level was specified, will - *have outstanding transactions committed. If commitment control has not been - *started for the connection, no action is taken.
    - *@param system The system for which transactions will be committed. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setSystem - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped - *unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the - *system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public static void commit(AS400 system) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (system == null) throw new NullPointerException("system"); - system.signon(false); - // system.connectService(AS400.RECORDACCESS); - AS400FileImpl impl = (AS400FileImpl)system.loadImpl3("com.ibm.as400.access.AS400FileImplNative", - "com.ibm.as400.access.AS400FileImplRemote", - "com.ibm.as400.access.AS400FileImplProxy"); - - impl.doIt("commit", new Class[] { AS400Impl.class }, new Object[] { system.getImpl() }); - } - - - /** - *Creates a physical file with the specified record length and file type. - *The record format for this object will be set by this method. The - *record format for the file is determined as follows: - *
      - *
    • If fileType is AS400File.TYPE_DATA, - *
        - *
      • The format name of the file is the name of the file as specified on the - *constructor - *
      • The record format contains one field whose name is the name of the file, - *whose type is CHARACTER, and whose length is recordLength - *
      - *
    • If fileType is AS400File.TYPE_SOURCE, - *
        - *
      • The format name of the file is the name of the file as specified on the - *constructor - *
      • The record format contains three fields: - *
          - *
        • SRCSEQ whose type is ZONED(6, 2) - *
        • SRCDAT whose type is ZONED(6, 0) - *
        • SRCDTA whose type is CHARACTER and whose length is - *recordLength - 12 - *
        - *
      - *
    - *Note: The file is created using the default values for the - * Create Physical File (CRTPF) command. - * To change the file after it has been created, use the - * CommandCall class to issue a CHGPF - * command.
    - *The name of the file and the system to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@param recordLength The record length with which to create the file. Valid values - * are 1 through 32766 inclusive. - *@param fileType The file type with which to create the file. Valid values are - * AS400File.TYPE_DATA or AS400File.TYPE_SOURCE. - * If AS400File.TYPE_DATA is specified, the record - * format for the file contains one field. If AS400File.TYPE_SOURCE is - * specified, the record format for the file contains three - * fields: source sequence number, date, and source statement. - *@param textDescription The text description with which to create the file. - *This value must be 50 characters or less. - *If this value is null, the empty string, or AS400File.BLANK, - *the text description is blank. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public void create(int recordLength, String fileType, String textDescription) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify parameters - if (recordLength < 1 || recordLength > 32766) - { - throw new ExtendedIllegalArgumentException("recordLength (" + String.valueOf(recordLength) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (fileType == null) - { - throw new NullPointerException("fileType"); - } - if (!(fileType.equalsIgnoreCase(TYPE_DATA) || //@C2C - fileType.equalsIgnoreCase(TYPE_SOURCE))) //@C2C - { - throw new ExtendedIllegalArgumentException("fileType", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (textDescription != null) - { - if (textDescription.length() > 50) - { - throw new ExtendedIllegalArgumentException("textDescription", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - } - - chooseImpl(); - impl_.doIt("create", new Class[] { Integer.TYPE, String.class, String.class }, - new Object[] { new Integer(recordLength), fileType, textDescription }); //@B0A - - // Create was successful. Set the record format for the file. - RecordFormat old = recordFormat_; // Save the old format for when we fire the - // property change event - recordFormat_ = new RecordFormat(file_); // The format name is the name of the file - if (fileType.equalsIgnoreCase(TYPE_DATA)) //@C2C - { // There is one field whose ddsName is the name of the file and whose type is - // CHAR(recordLength) - recordFormat_.addFieldDescription(new CharacterFieldDescription(new AS400Text(recordLength, system_.getCcsid(), system_), file_)); //@B6C - } - else - { // There are three fields, - // SRCSEQ ZONED(6, 2) - // SRCDAT ZONED(6, 0) - // SRCDTA CHAR(recordLength - 12) - recordFormat_.addFieldDescription(new ZonedDecimalFieldDescription(new AS400ZonedDecimal(6, 2), "SRCSEQ")); - recordFormat_.addFieldDescription(new ZonedDecimalFieldDescription(new AS400ZonedDecimal(6, 0), "SRCDAT")); - recordFormat_.addFieldDescription(new CharacterFieldDescription(new AS400Text(recordLength - 12, system_.getCcsid(), system_), "SRCDTA")); //@B6C - } - - impl_.doIt("setRecordFormat", new Class[] { RecordFormat.class }, - new Object[] { recordFormat_ }); //@B0A - - //@B0C - // Fire the FILE_CREATED FileEvent - fireEvent(FileEvent.FILE_CREATED); - - // Indicate that the record format has been set. - changes_.firePropertyChange("recordFormat", old, recordFormat_); - } - - /** - *Creates a physical file using the specified DDS source file. - *Note: The file is created using the default values for the - * Create Physical File (CRTPF) command. - * To change the file after it has been created, use the - * CommandCall class to issue a CHGPF - * command.
    - *The name of the file and the system to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@param ddsSourceFile The integrated file system pathname of the file containing the - *DDS source for the file being created. - *@param textDescription The text description with which to create the file. - *This value must be between 1 and 50 characters inclusive. - *If this value is null, the empty string, or AS400File.BLANK, - *the text description will be blank. - *Specify AS400File.SOURCE_MEMBER_TEXT for the text description if the text - *description from ddsSourceFile is to be used. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public void create(String ddsSourceFile, String textDescription) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify parameters - if (ddsSourceFile == null) - { - throw new NullPointerException("ddsSourceFile"); - } - if (textDescription != null && textDescription.length() > 50) - { - throw new ExtendedIllegalArgumentException("textDescription", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - chooseImpl(); - impl_.doIt("create", new Class[] { String.class, String.class }, - new Object[] { ddsSourceFile, textDescription }); //@B0A - - // Fire the FILE_CREATED FileEvent - fireEvent(FileEvent.FILE_CREATED); - } - - /** - *Creates a physical file using the specified record format. The record format - *for this object will be set by this method. - *Note: The file is created using the default values for the - * Create Physical File (CRTPF) command. - * To change the file after it has been created, use the - * CommandCall class to issue a CHGPF - * command.
    - *The name of the file and the system to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@param recordFormat The record format for the file. - *@param textDescription The text description with which to create the file. - *This value must be between 1 and 50 characters inclusive. - *If this value is null, the empty string, or AS400File.BLANK, - *the text description will be blank. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public void create(RecordFormat recordFormat, String textDescription) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - create(recordFormat, textDescription, null, null, null, null, false, null, null); - } - - /** - *Creates a physical file using the specified record format and any specified - *keywords. The record format for this object will be set by this method. - *Note: The file is created using the default values for the - * Create Physical File (CRTPF) command. - * To change the file after it has been created, use the - * CommandCall class to issue a CHGPF - * command.
    - *The name of the file and the system to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@param recordFormat The record format of the file. - *@param textDescription The text description with which to create the file. - *This value must be between 1 and 50 characters inclusive. - *If this value is null, the empty string, or AS400File.BLANK, - *the text description will be blank. - *@param altSeq The value to be specified for the file-level keyword ALTSEQ. If no - *value is to be specified, null may be specified. - *@param ccsid The value to be specified for the file-level keyword CCSID. If no - *value is to be specified, null may be specified. - *@param order The value to be specified to indicate in which order records will be - *retrieved from the file. Valid values are one of the following file-level keywords: - *
      - *
    • FIFO - *
    • LIFO - *
    • FCFO - *
    - *If no ordering value is to be specified, null may be specified. - *@param ref The value to be specified for the file-level keyword REF. If no - *value is to be specified, null may be specified. - *@param unique The value that indicates if the file-level keyword UNIQUE is to be specified. true if - *UNIQUE should be specified; false otherwise. - *@param format The value to be specified for the record-level keyword FORMAT. If no - *value is to be specified, null may be specified. - *@param text The value to be specified for the record-level keyword TEXT. If no - *value is to be specified, null may be specified. The single quotes required to - *surround the TEXT keyword value are added by this class. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public void create(RecordFormat recordFormat, - String textDescription, - String altSeq, - String ccsid, - String order, - String ref, - boolean unique, - String format, - String text) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify parameters - if (recordFormat == null) - { - throw new NullPointerException("recordFormat"); - } - if (textDescription != null && textDescription.length() > 50) - { - throw new ExtendedIllegalArgumentException("textDescription (" + textDescription + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - chooseImpl(); //@B0A - // Create a DDS source file to hold the DDS for the file to be created - impl_.doIt("createDDSSourceFile", - new Class[] { - RecordFormat.class, String.class, String.class, - String.class, String.class, Boolean.TYPE, - String.class, String.class }, - new Object[] { recordFormat, altSeq, ccsid, order, ref, new Boolean(unique), //@B0C - format, text }); - - // Create the file based on the newly create DDS source file - create("/QSYS.LIB/QTEMP.LIB/JT400DSSRC.FILE/JT400DSSRC.MBR", textDescription); - - // Set the record format for this object - RecordFormat old = recordFormat_; // Set the record format for when we fire - // the property change event - recordFormat_ = recordFormat; - - impl_.doIt("setRecordFormat", new Class[] { RecordFormat.class }, - new Object[] { recordFormat_ }); //@B0A - - // Fire the FILE_CREATED FileEvent - fireEvent(FileEvent.FILE_CREATED); - - changes_.firePropertyChange("recordFormat", old, recordFormat_); - } - - - /** - *Deletes the file. The object cannot be open when calling this method. The file - *and all its members will be deleted. - *Use deleteMember() to delete only the member associated with this object.
    - *The name of the file and the system to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@see AS400File#deleteMember - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public void delete() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify object state - if (isOpen_) - { - throw new ExtendedIllegalStateException(ExtendedIllegalStateException.OBJECT_CAN_NOT_BE_OPEN); - } - - chooseImpl(); - // Delete this file. - doIt("delete"); //@B0A - - // Fire the FILE_DELETED FileEvent - fireEvent(FileEvent.FILE_DELETED); - } - - /** - *Deletes the record at the current cursor position. The file must be open and - *the cursor must be positioned on an active record. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void deleteCurrentRecord() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify object state - checkOpen(); - - //@B0 - Don't need to do chooseImpl() since the file must - // be open, which means our impl has already been chosen. - - // Delete the current record. - doIt("deleteCurrentRecord"); - - // Fire the FILE_MODIFIED FileEvent - fireEvent(FileEvent.FILE_MODIFIED); - } - - - /** - *Deletes the member associated with this object from the file. The object cannot - *be open when invoking this method.
    - *The name of the file and the system to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public void deleteMember() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify object state - if (isOpen_) - { - throw new ExtendedIllegalStateException(ExtendedIllegalStateException.OBJECT_CAN_NOT_BE_OPEN); - } - - chooseImpl(); - // Delete this member. - doIt("deleteMember"); //@B0A - } - - - /** - *Ends commitment control for this connection. - *If commitment control has not been started for the connection, no action - *is taken. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void endCommitmentControl() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - chooseImpl(); //@B0A - doIt("endCommitmentControl"); //@B0A - } - - - //@E2A - /** - *Ends commitment control for the specified connection. - *If commitment control has not been started for the connection, no action - *is taken. - *@param system The system for which commitment control should be ended. - * - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public static void endCommitmentControl(AS400 system) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (system == null) throw new NullPointerException("system"); - system.signon(false); - // system.connectService(AS400.RECORDACCESS); - AS400FileImpl impl = (AS400FileImpl)system.loadImpl3("com.ibm.as400.access.AS400FileImplNative", - "com.ibm.as400.access.AS400FileImplRemote", - "com.ibm.as400.access.AS400FileImplProxy"); - impl.doIt("endCommitmentControl", new Class[] { AS400Impl.class }, new Object[] { system.getImpl() }); - } - - - //@D0A - /** - * Make sure the text objects are filled in for a Record object. - **/ - Record fillInRecord(Record r) - { - if (r != null) r.initializeTextObjects(system_); - return r; - } - - /** - *Closes the file when this object is garbage collected. - *@exception Throwable If an exception is thrown while cleaning up. - **/ - protected void finalize() - throws Throwable - { - if (isOpen_) - { - doIt("discardReplies"); //@D1A - make sure we discard replies if we are in the finalizer thread! - close(); - } - super.finalize(); - } - - - /** - * Fire the appropriate event. - **/ - private void fireEvent(int eIndex) - { - Vector targets = (Vector)fileListeners_.clone(); - FileEvent event = new FileEvent(this, eIndex); - for (int i=0; i - *
  • COMMIT_LOCK_LEVEL_ALL - *
  • COMMIT_LOCK_LEVEL_CHANGE - *
  • COMMIT_LOCK_LEVEL_CURSOR_STABILITY - *
  • COMMIT_LOCK_LEVEL_DEFAULT - *
  • COMMIT_LOCK_LEVEL_NONE - *
  • -1 - * - **/ - public int getCommitLockLevel() - { - if (impl_ == null) //@B0A - the file is not opened if the impl_ is null - return -1; //@B0A - - return impl_.doItInt("getCommitLockLevel"); - } - - - /** - *Returns the explicit locks that have been obtained for the file using this AS400File object. - *Any locks that have been obtained through the lock(int) method on this AS400File - *object are returned. Note that this method does not return any locks that have - *been obtained by using the ALCOBJ CL command or by using a different AS400File - *object created to reference the same physical file. - *@see AS400File#lock - *@return The explicit file locks held for the file by this AS400File object. - * Possible lock values are: - *
      - *
    • READ_EXCLUSIVE_LOCK - *
    • READ_ALLOW_SHARED_READ_LOCK - *
    • READ_ALLOW_SHARED_WRITE_LOCK - *
    • WRITE_EXCLUSIVE_LOCK - *
    • WRITE_ALLOW_SHARED_READ_LOCK - *
    • WRITE_ALLOW_SHARED_WRITE_LOCK - *
    - *If no explicit locks have been obtained for the file using this AS400File object, an array of size zero - *is returned. Note that this does not necessarily indicate that the actual physical file has not itself been locked by some other means. - **/ - public int[] getExplicitLocks() - { - if (impl_ == null) //@B0A - the file is not opened if the impl_ is null - return new int[0]; //@B0A - - return impl_.getExplicitLocks(); - } - - - /** - *Returns the file name. - *@return The file name. If the integrated file system pathname has not been set - *for the object, an empty string is returned. - **/ - public String getFileName() - { - return file_; - } - - - /** - *Returns the library name. - *@return The library name. If the integrated file system pathname has not - *been set for the object, an empty string is returned. - **/ - public String getLibraryName() - { - return library_; - } - - - /** - *Returns the member name. - *@return The member name. If the special value %FIRST% or %LAST% was specified - *for the member portion of the file name and the file is not open, the special - *value is returned. If the special value %FIRST% or %LAST% was specified - *for the member portion of the file name and the file is open, the member - *name is returned. If the integrated file system pathname has not been set - *for the object, an empty string is returned. - **/ - public String getMemberName() - { - return member_; - } - - - /** - *Returns the integrated file system pathname for the file as specified on the - *constructor or the setPath() method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@return The integrated file system pathname associated with this object. - *If the integrated file system pathname has not been set for the object, - *an empty string is returned. - **/ - public String getPath() - { - return name_; - } - - - /** - *Returns the record format of this file. - *@see AS400File#create(com.ibm.as400.access.RecordFormat, java.lang.String) - *@see AS400File#setRecordFormat - *@return The record format of the file. If the record format has - *not been set, null is returned. - **/ - public RecordFormat getRecordFormat() - { - return recordFormat_; - } - - - /** - *Returns the system object for this object. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setSystem - *@return The system for this object. If the system has not been set, - *null is returned. - **/ - public AS400 getSystem() - { - return system_; - } - - - /** - *Resets the state instance variables of this object to the appropriate - *values for the file being closed. This method is used to reset the - *the state of the object when the connection has been ended abruptly. - **/ - void initializeTransient() //@B0C - { - // Reset the open flag - isOpen_ = false; - - // Take good care of our listeners - fileListeners_ = new Vector(); - vetos_ = new VetoableChangeSupport(this); //@B0C - changes_ = new PropertyChangeSupport(this); - - impl_ = null; - } - - - /** - *Indicates if commitment control is started for - *the connection. - *@return true if commitment control has been started; false otherwise. - **/ - public boolean isCommitmentControlStarted() - { - //@B0A - Need to go to the proxy server to see if - // commitment control is started. But it is possible - // that our system_ hasn't been set yet, so we need - // to catch that exception and just return false. - try - { - chooseImpl(); - } - catch(ExtendedIllegalStateException e) - { - if (Trace.isTraceOn()) //@E2A - { //@E2A - Trace.log(Trace.ERROR, "Ignoring illegal state on isCommitmentControlStarted().", e); //@E2A - } //@E2A - return false; - } - catch(AS400SecurityException e) //@B5A - { - if (Trace.isTraceOn()) //@E2A - { //@E2A - Trace.log(Trace.ERROR, "Ignoring security exception on isCommitmentControlStarted().", e); //@E2A - } //@E2A - return false; //@B5A - } - catch(IOException e) //@B5A - { - if (Trace.isTraceOn()) //@E2A - { //@E2A - Trace.log(Trace.ERROR, "Ignoring I/O exception on isCommitmentControlStarted().", e); //@E2A - } //@E2A - return false; //@B5A - } - return impl_.doItBoolean("isCommitmentControlStarted"); - } - - - //@E2A - /** - *Indicates if commitment control is started for the specified system. - *@param system The system that is checked to determine if commitment control is started. - *@return true if commitment control has been started for the connection; false otherwise. - **/ - public static boolean isCommitmentControlStarted(AS400 system) - { - if (system == null) throw new NullPointerException("system"); - try - { - system.signon(false); - // system.connectService(AS400.RECORDACCESS); - AS400FileImpl impl = (AS400FileImpl)system.loadImpl3("com.ibm.as400.access.AS400FileImplNative", - "com.ibm.as400.access.AS400FileImplRemote", - "com.ibm.as400.access.AS400FileImplProxy"); - return impl.doItBoolean("isCommitmentControlStarted", new Class[] { AS400Impl.class }, new Object[] { system.getImpl() }); - } - catch(IOException e) - { - if (Trace.isTraceOn()) //@E2A - { //@E2A - Trace.log(Trace.ERROR, "Ignoring I/O exception on isCommitmentControlStarted(AS400).", e); //@E2A - } //@E2A - return false; - } - catch(AS400SecurityException e) - { - if (Trace.isTraceOn()) //@E2A - { //@E2A - Trace.log(Trace.ERROR, "Ignoring security exception on isCommitmentControlStarted(AS400).", e); //@E2A - } //@E2A - return false; - } - } - - - /** - *Indicates if the file is open. - *@return true if the file is open; false otherwise. - **/ - public boolean isOpen() - { - return isOpen_; - } - - - // @A5A - /** - *Indicates if the records should be locked for update when doing reads in a READ_WRITE open mode. By - *default, the records will be locked for update when doing reads in a READ_WRITE open mode. - *@return true if the records should not be locked for update when doing reads in a - *READ_WRITE open mode; false otherwise. - *@see AS400File#setReadNoUpdate - **/ - public boolean isReadNoUpdate() - { - if (impl_ != null) //@B0A @B5C - readNoUpdate_ = impl_.doItBoolean("isReadNoUpdate"); //@B0C @B5C - return readNoUpdate_; //@B5A - } - - - /** - *Indicates if this object is open for read only. - *@return true if the file is open for read only; false otherwise. - **/ - public boolean isReadOnly() - { - if (impl_ == null) //@B0A - return false; //@B0A - - return impl_.doItInt("getOpenType") == READ_ONLY; //@B0C - } - - - /** - *Indicates if this object is open for read/write. - *@return true if the file is open for read/write; false otherwise. - **/ - public boolean isReadWrite() - { - if (impl_ == null) //@B0A - return false; //@B0A - - return impl_.doItInt("getOpenType") == READ_WRITE; //@B0C - } - - - /** - * Indicates if this object is being treated as an SSP file. - * This method just returns the value set using {@link #setSSPFile setSSPFile()}. - * @return true if the file is being treated as an SSP file; false - * if it is being treated as a normal DDM file. The default is false. - * @see #setSSPFile - **/ - public boolean isSSPFile() - { - return ssp_; - } - - - /** - *Indicates if this object is open for write only. - *@return true if the file is open for write only; false otherwise. - **/ - public boolean isWriteOnly() - { - if (impl_ == null) //@B0A - return false; //@B0A - - return impl_.doItInt("getOpenType") == WRITE_ONLY; //@B0C - } - - - /** - *Obtains a lock on the file. - *The name of the file and the system to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@param lockToObtain The type of lock to acquire on the file. - * Valid lock values are: - *
      - *
    • READ_EXCLUSIVE_LOCK - *
    • READ_ALLOW_SHARED_READ_LOCK - *
    • READ_ALLOW_SHARED_WRITE_LOCK - *
    • WRITE_EXCLUSIVE_LOCK - *
    • WRITE_ALLOW_SHARED_READ_LOCK - *
    • WRITE_ALLOW_SHARED_WRITE_LOCK - *
    - *If lockToObtain has already been obtained, no action is taken. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public void lock(int lockToObtain) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (lockToObtain < READ_ALLOW_SHARED_WRITE_LOCK || - lockToObtain > WRITE_EXCLUSIVE_LOCK) - { - throw new ExtendedIllegalArgumentException("lockToObtain", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - chooseImpl(); - impl_.doIt("lock", new Class[] { Integer.TYPE }, new Object[] { new Integer(lockToObtain) }); - } - - - //@B2A - /** - *Opens the file. The file must not be open when invoking this method. - *The file cursor is positioned prior to the first record.
    - *The record format for the file must be set prior to calling this method.
    - *The name of the file and the system to which to connect must be set prior - *to invoking this method.
    - *A value of READ_WRITE is used for the open type.
    - *A value of 1 is used for the blocking factor.
    - *A value of COMMIT_LOCK_LEVEL_DEFAULT is used for the commit lock level. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@see AS400File#setRecordFormat - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public void open() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_DEFAULT); - } - - - /** - *Opens the file. The file must not be open when invoking this method. - *If commitment control is not started for the connection, - *commitLockLevel is ignored. The file cursor is positioned prior - *to the first record. If blockingFactor is greater than one (or - *if zero is specified and a blocking factor greater than one is determined - *by the object) and the file is opened for READ_ONLY, the record cache will - *be filled with an initial set of records.
    - *The record format for the file must be set prior to calling this method.
    - *The name of the file and the system to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@see AS400File#refreshRecordCache - *@see AS400File#setRecordFormat - *@param openType The manner in which to open the file. Valid values are: - *
      - *
    • READ_ONLY - *
    • READ_WRITE - *
    • WRITE_ONLY - *
    - *If the openType is WRITE_ONLY, the various positionCursor() methods - *will fail since write() operations are appended to the end of the file.
    - *@param blockingFactor The number of records to retrieve or to write during a - *read or write operation.
    - *The AS400File object will attempt to anticipate the need for data by accessing - *blocks of records if the openType is READ_ONLY.
    - *If the openType - *is WRITE_ONLY, blockingFactor number of records will be written at one - *time when writing an array of records.
    - *If the open type is READ_WRITE, blockingFactor is ignored and a - *blocking factor of 1 will be used for data integrity reasons. - *Specify an appropriate blockingFactor for your performance needs.
    - *If 0 is specified for blockingFactor, a default value will be calculated - *by taking the integer result of dividing 2048 by the byte length of the record - *plus 16.
    - *If the user specifies a blocking factor greater than 1 or specifies 0, - *which will cause a blocking factor to be calculated, there is the risk of - *obtaining stale data when doing multiple read operations. - *Invoke the refreshRecordCache() method prior to reading a record to cause the object - *to read from the system if this is a problem.
    - *@param commitLockLevel Used to control record locking during a transaction if - *commitment control has been started for the connection. - *Valid values are: - *
      - *
    • COMMIT_LOCK_LEVEL_ALL - *
    • COMMIT_LOCK_LEVEL_CHANGE - *
    • COMMIT_LOCK_LEVEL_CURSOR_STABILITY - *
    • COMMIT_LOCK_LEVEL_DEFAULT - *
    • COMMIT_LOCK_LEVEL_NONE - *
    - *The commitLockLevel is ignored if commitment control is not started for - *the connection. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public /* @B0C abstract */ void open(int openType, - int blockingFactor, - int commitLockLevel) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - //@B0A - moved code out of subclasses - { - // Verify the object state - if (recordFormat_ == null) - { - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - // Verify the parameters - if (openType != READ_ONLY && - openType != READ_WRITE && - openType != WRITE_ONLY) - { - throw new ExtendedIllegalArgumentException("openType", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (blockingFactor < 0) - { - throw new ExtendedIllegalArgumentException("blockingFactor", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (commitLockLevel < 0 || commitLockLevel > 4) - { - throw new ExtendedIllegalArgumentException("commitLockLevel", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - openFile(openType, blockingFactor, commitLockLevel, this instanceof KeyedFile); //@B0C - } - - /** - *Opens the file. Helper function to open file for keyed or - *sequential files. - *@param openType The manner in which to open the file. - *@param blockingFactor The number of records to retrieve or to write during a - * read or write operation. - *@param commitLockLevel Used to control record locking during a transaction if - *commitment control has been started for the connection. - *@param access The type of file access for which to open the file. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started.. - *@exception UnknownHostException If the system cannot be located. - **/ - synchronized void openFile(int openType, - int blockingFactor, - int commitLockLevel, - boolean access) //@B0C - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify object state. Note: we don't just close the file and re-open for the - // specified open type because the user may have uncommitted changes. To be - // consistent, always throw exception if user tries to open when already open. - if (isOpen_) - { - throw new ExtendedIllegalStateException(ExtendedIllegalStateException.OBJECT_CAN_NOT_BE_OPEN); - } - - // Set commit lock level to -1 if commitment control is not started - chooseImpl(); - // Set the blocking factor for the file - int bf; //@D0A - - // Before we calculate, make sure the record format has had - // its text objects initialized. - recordFormat_.initializeTextObjects(system_); //@D0A - - //@D0M - moved out of AS400FileImplBase - if (openType != AS400File.READ_WRITE) - { - // Calculate the blocking factor if 0 was specified - if (blockingFactor == 0) - { - //@E0M - int block = 2048/(recordFormat_.getNewRecord().getRecordLength() + 16); - bf = block > 0 ? block : 1; - } - else - { - bf = blockingFactor; - } - - // Estimate the record increment. - int recordIncrement = recordFormat_.getNewRecord().getRecordLength() + - recordFormat_.getNumberOfFields() + - recordFormat_.getNumberOfKeyFields() + 16; - - // We can only retrieve 16Mb of record data per GET so limit the - // blocking factor appropriately. - bf = (bf * recordIncrement >= 16777216 ? 16777216 / recordIncrement : bf); - } - else - { // For open type of READ_WRITE or if the file is a KeyedFile, blocking - // factor is set to 1 for data integrity - // reasons (read_write implies we are reading and updating and therefore - // want up-to-date data. - bf = 1; - } - - String[] toSet = impl_.openFile2(openType, bf, commitLockLevel, access); //@C0A @D0C - - //@C0A - // index 0 is the new library name, null if it wasn't changed - // index 1 is the new member name, null if it wasn't changed - if (toSet[0] != null) - library_ = toSet[0]; - if (toSet[1] != null) - { - String old = member_; - member_ = toSet[1]; - changes_.firePropertyChange("member", old, member_); - } - - isOpen_ = true; - - // Fire the FILE_OPENED FileEvent - fireEvent(FileEvent.FILE_OPENED); - } - - - /** - *Positions the file cursor to after the last record. The file must be open when - *invoking this method. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void positionCursorAfterLast() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify the object state - checkOpen(); - doIt("positionCursorAfterLast"); - } - - - /** - *Positions the file cursor to before the first record. The file must be open - *when invoking this method. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void positionCursorBeforeFirst() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify the object state - checkOpen(); - doIt("positionCursorBeforeFirst"); - } - - - /** - *Positions the file cursor to the first record. The file must be open when - *invoking this method. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void positionCursorToFirst() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify the object state - checkOpen(); - doIt("positionCursorToFirst"); - } - - - /** - *Positions the file cursor to the last record. The file must be open when - *invoking this method. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void positionCursorToLast() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify the object state - checkOpen(); - doIt("positionCursorToLast"); - } - - - /** - *Positions the file cursor to the next record. The file must be open when - *invoking this method. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void positionCursorToNext() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify the object state - checkOpen(); - doIt("positionCursorToNext"); - } - - - /** - *Positions the file cursor to the previous record. The file must be open when - *invoking this method. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void positionCursorToPrevious() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify the object state - checkOpen(); - doIt("positionCursorToPrevious"); - } - - - /** - *Reads the record at the current cursor position. The file must be open when - *invoking this method. The cursor position does not change when this method is - *invoked. - *@return The record read. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record read() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify the object state - checkOpen(); - return fillInRecord(impl_.doItRecord("read", new Class[0], new Object[0])); //@D0C - } - - - /** - *Reads all the records in the file. The file must be closed when invoking this method. - *The record format for the file must have been set prior to invoking this method. - *@return The records read. If no records are read, an array of - *size zero is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - abstract public Record[] readAll() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException; - - - /** - *Reads the first record in the file. The file must be open when invoking this - *method. The cursor is positioned to the first record of the file - *as a result of invoking this method. - *@return The record read. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record readFirst() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify the object state - checkOpen(); - return fillInRecord(impl_.doItRecord("readFirst", new Class[0], new Object[0])); //@D0C - } - - - /** - *Reads the last record in the file. The file must be open when invoking this - *method. The cursor is positioned to the last record of the file - *as a result of invoking this method. - *@return The record read. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record readLast() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify the object state - checkOpen(); - return fillInRecord(impl_.doItRecord("readLast", new Class[0], new Object[0])); //@D0C - } - - - /** - *Reads the next record in the file from the current cursor position. The file must - *be open when invoking this method. The cursor is positioned to the first active - *record after the current cursor position as a result of invoking this method. - *If this method is invoked when the cursor is positioned at the last record of the - *file, null will be returned and the cursor is positioned after the last record - *of the file. - *@return The record read. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record readNext() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify the object state - checkOpen(); - return fillInRecord(impl_.doItRecord("readNext", new Class[0], new Object[0])); //@D0C - } - - - /** - *Overrides the ObjectInputStream.readObject() method in order to return any - *transient parts of the object to there properly initialized state. We also - *generate a declared file name for the object. I.e we in effect - *call the null constructor. By calling ObjectInputStream.defaultReadObject() - *we restore the state of any non-static and non-transient variables. We - *then continue on to restore the state (as necessary) of the remaining varaibles. - *@param in The input stream from which to deserialize the object. - *@exception ClassNotFoundException If the class being deserialized is not found. - *@exception IOException If an error occurs while communicating with the system. - **/ - private void readObject(java.io.ObjectInputStream in) - throws ClassNotFoundException, - IOException - { - in.defaultReadObject(); - initializeTransient(); //@B0C - } - - - /** - *Reads the previous record in the file from the current cursor position. The file - *must be open when invoking this method. The cursor is positioned to the first active - *record prior to the current cursor position as a result of invoking this method. - *If this method is invoked when the cursor is positioned at the first record of the - *file, null is returned and the cursor is positioned before the first record - *of the file. - *@return The record read. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record readPrevious() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify the object state - checkOpen(); - return fillInRecord(impl_.doItRecord("readPrevious", new Class[0], new Object[0])); //@D0C - } - - - /** - *Refreshes the record cache for this file. Invoking this method will cause the - *retrieval of records from the system. The cursor position is set to the - *first record of the file. This method only needs to - *be invoked if a blocking factor greater than 1 is being used, and the user - *wants to refresh the records in the cache. The file must be open when invoking - *this method. No action is taken if records are not being cached (for example, the - *blocking factor is set to one). - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void refreshRecordCache() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify object state - checkOpen(); - doIt("refreshRecordCache"); - } - - - /** - *Releases all locks acquired via the lock() method. If no locks have been - *explicitly obtained, no action is taken. - *@see AS400File#lock - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public void releaseExplicitLocks() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - chooseImpl(); - doIt("releaseExplicitLocks"); - } - - - /** - *Removes a listener from the file listeners list. - *If the listener is not on the list, does nothing. - *@see #addFileListener - *@param listener The FileListener. - **/ - public void removeFileListener(FileListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - fileListeners_.removeElement(listener); - } - - - /** - *Removes a listener from the change list. - *If the listener is not on the list, does nothing. - *@see #addPropertyChangeListener - *@param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - changes_.removePropertyChangeListener(listener); - } - - - /** - *Removes a listener from the veto change listeners list. - *If the listener is not on the list, does nothing. - *@see #addVetoableChangeListener - *@param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - vetos_.removeVetoableChangeListener(listener); //@B0C - } - - - /** - *Rolls back any transactions since the last commit/rollback boundary. Invoking this - *method will cause all transactions under commitment control for this connection - *to be rolled back. This means that any AS400File object for which a commit - *lock level was specified and that was opened under this connection will have - *outstanding transactions rolled back. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public void rollback() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (isCommitmentControlStarted()) // if returns true, then impl has been chosen. - { - doIt("rollback"); - } - } - - - //@E2A - /** - *Rolls back any transactions since the last commit/rollback boundary for the specified system. - *Invoking this method will cause all transactions under commitment control for this connection - *to be rolled back. This means that any AS400File object for which a commit - *lock level was specified and that was opened under this connection will have - *outstanding transactions rolled back. - *@param system The system for which transactions will be rolled back. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public static void rollback(AS400 system) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (system == null) throw new NullPointerException("system"); - system.signon(false); - // system.connectService(AS400.RECORDACCESS); - AS400FileImpl impl = (AS400FileImpl)system.loadImpl3("com.ibm.as400.access.AS400FileImplNative", - "com.ibm.as400.access.AS400FileImplRemote", - "com.ibm.as400.access.AS400FileImplProxy"); - impl.doIt("rollback", new Class[] { AS400Impl.class }, new Object[] { system.getImpl() }); - } - - /** - * Runs a CL command in the DDM host server job. This is useful for changing the IASP - * used by the DDM server for the currently connected AS400 object, changing library lists, - * etc. - *

    - * Note: If using Toolbox native optimizations, the CL command will run in - * the current job, since there will not be an associated DDM host server job. - * @param command The CL command to run. - * @return The list of AS400Message objects output by the CL command (if any). - * @see com.ibm.as400.access.CommandCall - **/ - public AS400Message[] runCommand(String command) throws AS400SecurityException, InterruptedException, IOException - { - if (command == null) throw new NullPointerException("command"); - chooseImpl(); - return impl_.execute(command); - } - - //@B0A - /** - * Used internally to parse the pathname and set the individual - * library, filename, and member strings. - **/ - private void setName(String name) - { - // Construct a QSYSObjectPathName object and parse out the library, - // file and member names - QSYSObjectPathName ifs = new QSYSObjectPathName(name); - if (!(ifs.getObjectType().equals("FILE") || ifs.getObjectType().equals("MBR"))) - { // Invalid object type - throw new IllegalPathNameException(name, IllegalPathNameException.OBJECT_TYPE_NOT_VALID); - } - // Set the instance data as appropriate - library_ = ifs.getLibraryName(); - file_ = ifs.getObjectName(); - if (ifs.getObjectType().equals("FILE")) - { // No member specified; default member to *FIRST - member_ = "*FIRST"; - } - else - { // Member specified; if special value %FILE% was specified, member name - // is the file name - member_ = (ifs.getMemberName().equalsIgnoreCase("*FILE") ? file_ : - ifs.getMemberName()); - } - name_ = name; - } - - - /** - *Sets the integrated file system pathname for the file. - *@param name The integrated file system pathname of the file. - *@exception PropertyVetoException If a change is vetoed. - **/ - public void setPath(String name) - throws PropertyVetoException - { - // Verify parameters - if (name == null) - { - throw new NullPointerException("name"); - } - // Verify object state - if (isOpen_) - { // Cannot set after we have connected - throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - //@B0M - String oldName = name_; - vetos_.fireVetoableChange("path", oldName, name); //@B0A - - //@B0C - // Notify veto listeners of the change - // Construct a QSYSObjectPathName object and parse out the library, file and member names - setName(name); //@B0A - - if (impl_ != null) impl_.doItNoExceptions("setPath", new Class[] { String.class }, new Object[] { name }); //@B0A - changes_.firePropertyChange("path", oldName, name); //@B0C - } - - - // @A5A - /** - *Sets the readNoUpdate flag, which determines whether the records should be locked for update - *when doing reads or positionCursor operations in a READ_WRITE open mode. - *@param readNoUpdate true if the records should not be locked for update when doing - *reads in a READ_WRITE open mode; false otherwise. - *@see AS400File#isReadNoUpdate - **/ - public void setReadNoUpdate(boolean readNoUpdate) - { - //@B5 - chooseImpl() throws exceptions now, so what we will do - // is save a copy of readNoUpdate and set it to the proxy server - // when an impl gets chosen. (Like bean properties get set). - readNoUpdate_ = readNoUpdate; //@B5A - if (impl_ != null) //@B5A - { - impl_.doItNoExceptions("setReadNoUpdate", new Class[] { Boolean.TYPE }, - new Object[] { new Boolean(readNoUpdate) }); //@B0C - } - } - - - //@B2A - /** - *Sets the record format to be used for this file. Retrieves the record - *format(s) from the file on the system and sets the record format to - *be the first format retrieved from the file. Calling this method is - *the same as calling setRecordFormat(0). - *The record format must be set prior to invoking open() or readAll(). - *@see AS400FileRecordDescription#retrieveRecordFormat - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception PropertyVetoException If a change is vetoed. - **/ - public void setRecordFormat() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException, - PropertyVetoException - { - setRecordFormat(0); - } - - - //@B2A - /** - *Sets the record format to be used for this file. Retrieves the record - *format(s) from the file on the system and sets the record format to - *the recordFormat one. - *The record format must be set prior to invoking open() or readAll(). - *@see AS400FileRecordDescription#retrieveRecordFormat - *@param recordFormat The index of the record format to be used. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception PropertyVetoException If a change is vetoed. - **/ - public void setRecordFormat(int recordFormat) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException, - PropertyVetoException - { - if (recordFormat < 0) - { - throw new ExtendedIllegalArgumentException("recordFormat (" + String.valueOf(recordFormat) + ") too small", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - chooseImpl(); - setRecordFormat(impl_.doItRecordFormat("setRecordFormat", new Class[] { Integer.TYPE }, new Object[] { new Integer(recordFormat) })); - } - - - //@B2A - /** - *Sets the record format to be used for this file. Retrieves the record - *format(s) from the file on the system and sets the record format to - *be recordFormat. - *The record format must be set prior to invoking open() or readAll(). - *@see AS400FileRecordDescription#retrieveRecordFormat - *@param recordFormat The name of the record format to be used. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception PropertyVetoException If a change is vetoed. - **/ - public void setRecordFormat(String recordFormat) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException, - PropertyVetoException - { - if (recordFormat == null) - { - throw new NullPointerException("recordFormat"); - } - chooseImpl(); - setRecordFormat(impl_.doItRecordFormat("setRecordFormat", new Class[] { String.class }, new Object[] { recordFormat })); - } - - - /** - *Sets the record format to be used for this file. - *The record format must be set prior to invoking open() or readAll(). - *

    Note: This method is not supported for multi-format logical files. - *Multi-format logical files must use one of the other setRecordFormat() methods. - *@see #setRecordFormat(int) - *@see #setRecordFormat(java.lang.String) - *@param recordFormat The record format for this file. - *@exception PropertyVetoException If a change is vetoed. - **/ - public void setRecordFormat(RecordFormat recordFormat) - throws PropertyVetoException - { - // Verify parameters - if (recordFormat == null) - { - throw new NullPointerException("recordFormat"); - } - //@B0C - // Notify veto listeners of the change - RecordFormat old = recordFormat_; - vetos_.fireVetoableChange("recordFormat", old, recordFormat); //@B0A - recordFormat_ = recordFormat; - if (impl_ != null) impl_.doItNoExceptions("setRecordFormat", new Class[] { RecordFormat.class }, new Object[] { recordFormat_ }); //@B0A - changes_.firePropertyChange("recordFormat", old, recordFormat_); - } - - - - /** - * Sets the SSP flag for this file. This flag indicates - * whether or not to treat the file on the system - * as a System/36 SSP file. When set to true, the record - * format name is ignored. When set to false, the file - * is treated as a normal physical or logical DDM file. - * The default is false. - * @param treatAsSSP The flag indicating how to treat the file. - * @see #isSSPFile - **/ - public void setSSPFile(boolean treatAsSSP) - { - if (isOpen_) - { // Cannot set after we have connected - throw new ExtendedIllegalStateException("treatAsSSP", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - ssp_ = treatAsSSP; - - if (impl_ != null) - { - impl_.doItNoExceptions("setSSPFile", new Class[] { Boolean.TYPE }, - new Object[] { new Boolean(treatAsSSP) }); - } - } - - - /** - *Sets the system to which to connect. - *@param system The system to which to connect. - *@exception PropertyVetoException If a change is vetoed. - **/ - public void setSystem(AS400 system) - throws PropertyVetoException - { - // Verify parameters - if (system == null) - { - throw new NullPointerException("system"); - } - // Verify state - if (isOpen_ || impl_ != null) // THIS USED TO CHECK IF WE WERE CONNECTED - { // Cannot set after we have connected - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - //@B0C - // Notify veto listeners of the change - AS400 old = system_; - vetos_.fireVetoableChange("system", old, system); //@B0A - system_ = system; - changes_.firePropertyChange("system", old, system_); - } - - - /** - *Starts commitment control on this file (for this connection). If commitment control - *has already been started for the connection, an exception is thrown. - *@param commitLockLevel The type of commitment control - * to exercise. Valid values are: - *

      - *
    • COMMIT_LOCK_LEVEL_ALL - *
    • COMMIT_LOCK_LEVEL_CHANGE - *
    • COMMIT_LOCK_LEVEL_CURSOR_STABILITY - *
    - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public void startCommitmentControl(int commitLockLevel) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify parameters - if (commitLockLevel < COMMIT_LOCK_LEVEL_ALL || commitLockLevel > COMMIT_LOCK_LEVEL_CURSOR_STABILITY) - { - throw new ExtendedIllegalArgumentException("commitLockLevel", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Verify that commitment control isn't already started. - if (isCommitmentControlStarted()) - { - throw new ExtendedIllegalStateException(ExtendedIllegalStateException.COMMITMENT_CONTROL_ALREADY_STARTED); - } - - // Start commitment control. - chooseImpl(); - impl_.doIt("startCommitmentControl", new Class[] { Integer.TYPE }, new Object[] { new Integer(commitLockLevel) }); - } - - - //@E2A - /** - *Starts commitment control for the specified system. If commitment control - *has already been started for the connection, an exception is thrown. - *@param system The system for which commitment control should be started. - *@param commitLockLevel The type of commitment control - * to exercise. Valid values are: - *
      - *
    • COMMIT_LOCK_LEVEL_ALL - *
    • COMMIT_LOCK_LEVEL_CHANGE - *
    • COMMIT_LOCK_LEVEL_CURSOR_STABILITY - *
    - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public static void startCommitmentControl(AS400 system, int commitLockLevel) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (system == null) - { - throw new NullPointerException("system"); - } - - if (commitLockLevel < COMMIT_LOCK_LEVEL_ALL || commitLockLevel > COMMIT_LOCK_LEVEL_CURSOR_STABILITY) - { - throw new ExtendedIllegalArgumentException("commitLockLevel", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Verify that commitment control isn't already started. - //@E2 - This now happens in AS400FileImplBase for performance. - - // Start commitment control. - system.signon(false); - // system.connectService(AS400.RECORDACCESS); - AS400FileImpl impl = (AS400FileImpl)system.loadImpl3("com.ibm.as400.access.AS400FileImplNative", - "com.ibm.as400.access.AS400FileImplRemote", - "com.ibm.as400.access.AS400FileImplProxy"); - - impl.doIt("startCommitmentControl", new Class[] { AS400Impl.class, Integer.TYPE }, - new Object[] { system.getImpl(), new Integer(commitLockLevel) }); - } - - - /** - *Updates the record at the current cursor position. The file must be open when - *invoking this method. The cursor must be positioned to an active record. The - *last operation on the file must have been a cursor positioning operation or a - *read operation. If an attempt is made to update a record more than once without - *reading the record or positioning the cursor to the record in between updates, an - *AS400Exception is thrown. The cursor position is not changed when this method - *is invoked. - *@param record The record with which to update. The record must be a record whose - *format matches the record format of this object. To ensure that this - *requirement is met, use the - *RecordFormat.getNewRecord() - *method to obtain a default record whose fields can be set appropriately by - *the Java program and then written to the file. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void update(Record record) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify the object state - checkOpen(); - // Verify parameters - if (record == null) - { - throw new NullPointerException("record"); - } - impl_.doIt("update", new Class[] { Record.class }, new Object[] { record }); - - // Fire the FILE_MODIFIED FileEvent - fireEvent(FileEvent.FILE_MODIFIED); - } - - - /** - *Writes a record to the file. The file must be open when invoking this - *method. The record is written to the end of the file. - *The cursor is positioned to after the last record of the file as a result - *of invoking this method. - *@param record The record to write. The record must be a record whose - *format matches the record format of this object. To ensure that this - *requirement is met, use the - *RecordFormat.getNewRecord() - *method to obtain a default record whose fields can be set appropriately by - *the Java program and then written to the file. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void write(Record record) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify the object state - checkOpen(); - // Verify parameters - if (record == null) - { - throw new NullPointerException("record"); - } - - // Call write(Record[]) to do the work - write(new Record[] { record }); //@B0C - } - - - /** - *Writes an array of records to the file. The file must be open when invoking - *this method. The records are written to the end of the file. - *The cursor is positioned to after the last record of the file as a result - *of invoking this method. - *@param records The records to write. The records must have a format - *which matches the record format of this object. To ensure that this - *requirement is met, use the - *RecordFormat.getNewRecord() - *method to obtain default records whose fields can be set appropriately by - *the Java program and then written to the file. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void write(Record[] records) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify the object state - checkOpen(); - // Verify parameters - if (records == null) - { - throw new NullPointerException("records"); - } - if (records.length == 0) - { - throw new ExtendedIllegalArgumentException("records", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - impl_.doIt("write", new Class[] { Record[].class }, new Object[] { records }); - - // Fire the FILE_MODIFIED FileEvent - fireEvent(FileEvent.FILE_MODIFIED); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400File16.gif b/cvsroot/src/com/ibm/as400/access/AS400File16.gif deleted file mode 100644 index 07d127b1e..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400File16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400File32.gif b/cvsroot/src/com/ibm/as400/access/AS400File32.gif deleted file mode 100644 index 0e99f68ec..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400File32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400FileBeanInfo.java b/cvsroot/src/com/ibm/as400/access/AS400FileBeanInfo.java deleted file mode 100644 index 058788a0d..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400FileBeanInfo.java +++ /dev/null @@ -1,205 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400FileBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2008 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @A1 12/12/2007 Correct EventSet for VetoablePropertyChange -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.lang.reflect.Method; //@B0A - -/** - * The AS400FileBeanInfo class provides bean - * information for the AS400File class. -**/ -public class AS400FileBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - // Bean class - private final static Class beanClass_ = AS400File.class; - - - // BeanDescriptor for this class - private static BeanDescriptor beanDescriptor_ = new BeanDescriptor(AS400File.class); - - - // Set of event descriptors for this class: - // PropertyChange, VetoableChange, RecordDescriptionEvent.FIELD_MODIFIED - private static EventSetDescriptor[] eventSet_ = new EventSetDescriptor[3]; - - - // Set of property descriptors for this class - // memberName, fileName, recordFormat, path, system - private static PropertyDescriptor[] propertySet_ = new PropertyDescriptor[5]; - - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - - public AS400FileBeanInfo() - { - try - { - // Populate the event descriptor set - // FileEvent - String[] listenerMethods = {"fileClosed", "fileCreated", "fileDeleted", - "fileModified", "fileOpened"}; - eventSet_[0] = new EventSetDescriptor(beanClass_, "file", - FileListener.class, - listenerMethods, "addFileListener", - "removeFileListener"); - eventSet_[0].setDisplayName(loader_.getText("EVT_NAME_FILE_EVENT")); - eventSet_[0].setShortDescription(loader_.getText("EVT_DESC_FILE_EVENT")); - - - // PropertyChangeEvent - eventSet_[1] = new EventSetDescriptor(beanClass_, "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - eventSet_[1].setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - eventSet_[1].setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - - // VetoablePropertyChange - eventSet_[2] = new EventSetDescriptor(beanClass_, "propertyChange", //@A1C - java.beans.VetoableChangeListener.class, - "vetoableChange"); - eventSet_[2].setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - eventSet_[2].setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - } - catch(IntrospectionException e) - { - throw new Error(e.toString()); - } - - try - { - // Populate the property descriptor set - // getFileName - propertySet_[0] = new PropertyDescriptor("fileName", beanClass_, - "getFileName", null); - propertySet_[0].setBound(true); - propertySet_[0].setConstrained(false); - propertySet_[0].setDisplayName(loader_.getText("PROP_NAME_FILE_NAME")); - propertySet_[0].setShortDescription(loader_.getText("PROP_DESC_FILE_NAME")); - - - // getKeyFields - propertySet_[1] = new PropertyDescriptor("memberName", beanClass_, - "getMemberName", null); - propertySet_[1].setBound(true); - propertySet_[1].setConstrained(false); - propertySet_[1].setDisplayName(loader_.getText("PROP_NAME_MEMBER")); - propertySet_[1].setShortDescription(loader_.getText("PROP_DESC_MEMBER")); - - - // get/setPath - propertySet_[2] = new PropertyDescriptor("path", beanClass_, - "getPath", - "setPath"); - propertySet_[2].setBound(true); - propertySet_[2].setConstrained(true); - propertySet_[2].setDisplayName(loader_.getText("PROP_NAME_PATH")); - propertySet_[2].setShortDescription(loader_.getText("PROP_DESC_PATH")); - - - // get/setRecordFormat -//@B0D propertySet_[3] = new PropertyDescriptor("recordFormat", beanClass_, -//@B0D "getRecordFormat", -//@B0D "setRecordFormat"); - Method getter = beanClass_.getMethod("getRecordFormat", (java.lang.Class []) null); //@B0A //@pdc cast for jdk1.5 - Method setter = beanClass_.getMethod("setRecordFormat", new Class[] { RecordFormat.class }); //@B0A - propertySet_[3] = new PropertyDescriptor("recordFormat", getter, setter); //@B0A - propertySet_[3].setBound(true); - propertySet_[3].setConstrained(true); - propertySet_[3].setDisplayName(loader_.getText("PROP_NAME_RECORD_FORMAT")); - propertySet_[3].setShortDescription(loader_.getText("PROP_DESC_RECORD_FORMAT")); - - - // get/setSystem - propertySet_[4] = new PropertyDescriptor("system", beanClass_, - "getSystem", - "setSystem"); - propertySet_[4].setBound(true); - propertySet_[4].setConstrained(true); - propertySet_[4].setDisplayName(loader_.getText("PROP_NAME_SYSTEM")); - propertySet_[4].setShortDescription(loader_.getText("PROP_DESC_SYSTEM")); - } - catch(Exception e) //@B0C - { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) //@B0A - { //@B0A - Trace.log(Trace.ERROR, "Failed to initialize AS400FileBeanInfo.", e); //@B0A - } //@B0A - throw new Error(e.toString()); - } - } - - /** - *Returns the bean descriptor. - *@return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - /** - *Returns the index of the default event. - *@return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the property change event - return 0; - } - - - /** - *Returns the index of the default property. - *@return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the default property - return 0; - } - - - /** - *Returns the set of event descriptors. - *@return The event descriptor set. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSet_; - } - - /** - *Returns the property descriptors. - *@return The property descriptors. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertySet_; - } - -} - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400FileConstants.java b/cvsroot/src/com/ibm/as400/access/AS400FileConstants.java deleted file mode 100644 index 087cd402d..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400FileConstants.java +++ /dev/null @@ -1,154 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400FileConstants.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** - *Contains constants formerly residing in AS400File. - *Created so that dependencies on AS400File in the DDM datastream classes - *can be removed, thereby reducing the size of the jar file generated - *by JarMaker. -**/ -interface AS400FileConstants -{ - //@A1A - /** - * Constant indicating a text description of *BLANK. - *@see AS400File#create - **/ - static public final String BLANK = "*BLANK"; - - /** - *Constant indicating a commit lock level of *ALL. - *Every record accessed in the file is locked until the - *transaction is committed or rolled back. - *@see AS400File#startCommitmentControl - **/ - static public final int COMMIT_LOCK_LEVEL_ALL = 0; - - /** - *Constant indicating a commit lock level of *CHANGE. - *Every record read for update is locked. If a record - *is updated, added, or deleted, that record remains locked - *until the transaction is committed or rolled back. Records - *that are accessed for update but are released without being - *updated are unlocked. - *@see AS400File#startCommitmentControl - **/ - static public final int COMMIT_LOCK_LEVEL_CHANGE = 1; - /** - *Constant indicating a commit lock level of *CS. - *Every record accessed is locked. Records that are not - *updated or deleted are locked only until a different record - *is accessed. Records that are updated, added, or deleted are locked - *until the transaction is committed or rolled back. - *@see AS400File#startCommitmentControl - **/ - static public final int COMMIT_LOCK_LEVEL_CURSOR_STABILITY = 2; - /** - *Constant indicating that the commit lock level specified on the - *startCommitmentControl() method should be used. - *The record locking specified by the commitLockLevel parameter on the - *startCommitmentControl() method will apply to transactions using this file. - **/ - static public final int COMMIT_LOCK_LEVEL_DEFAULT = 4; - /** - *Constant indicating that no commitment control should be used for the file. - *No commitment control will apply to this file. - *@see AS400File#startCommitmentControl - **/ - static public final int COMMIT_LOCK_LEVEL_NONE = 3; - - /** - *Constant indicating lock type of read willing to share with - *other readers. This is the equivalent of specifying *SHRNUP - *on the Allocate Object (ALCOBJ) command. - *@see AS400File#lock - **/ - static public final int READ_ALLOW_SHARED_READ_LOCK = 1; - /** - *Constant indicating lock type of read willing to share with - *updaters. This is the equivalent of specifying *SHRRD - *on the Allocate Object (ALCOBJ) command. - *@see AS400File#lock - **/ - static public final int READ_ALLOW_SHARED_WRITE_LOCK = 0; - /** - *Constant indicating lock type of read willing to share with no one. - *This is the equivalent of specifying *EXCL on the Allocate Object (ALCOBJ) - *command. - *@see AS400File#lock - **/ - static public final int READ_EXCLUSIVE_LOCK = 4; - /** - *Constant indicating open type of read only. - *@see AS400File#open - **/ - static public final int READ_ONLY = 0; - /** - *Constant indicating open type of read/write. - *@see AS400File#open - **/ - static public final int READ_WRITE = 1; - - //@A1A - /** - * Constant indicating a text description of *SRCMBRTXT. - *@see AS400File#create - **/ - static public final String SOURCE_MEMBER_TEXT = "*SRCMBRTXT"; - - //@A1A - /** - * Constant indicating a file type of *DATA. - *@see AS400File#create - **/ - static public final String TYPE_DATA = "*DATA"; - - //@A1A - /** - * Constant indicating a file type of *SRC. - *@see AS400File#create - **/ - static public final String TYPE_SOURCE = "*SRC"; - - /** - *Constant indicating lock type of update willing to share with - *readers. This is the equivalent of specifying *EXCLRD - *on the Allocate Object (ALCOBJ) command. - *@see AS400File#lock - **/ - static public final int WRITE_ALLOW_SHARED_READ_LOCK = 3; - /** - *Constant indicating lock type of update willing to share with - *updaters. This is the equivalent of specifying *SHRUPD - *on the Allocate Object (ALCOBJ) command. - *@see AS400File#lock - **/ - static public final int WRITE_ALLOW_SHARED_WRITE_LOCK = 2; - /** - *Constant indicating lock type of update willing to share with - *no one. This is the equivalent of specifying *EXCL - *on the Allocate Object (ALCOBJ) command. - *@see AS400File#lock - **/ - static public final int WRITE_EXCLUSIVE_LOCK = 5; - /** - *Constant indicating open type of write only. - *@see AS400File#open - **/ - static public final int WRITE_ONLY = 2; -} - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400FileImpl.java b/cvsroot/src/com/ibm/as400/access/AS400FileImpl.java deleted file mode 100644 index 5518d2825..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400FileImpl.java +++ /dev/null @@ -1,90 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: AS400FileImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** -This interface is provided so that the original AS400FileImpl, which has -been renamed to AS400FileImplBase, can exist completely on the proxy server, -so as not to inflate the proxy client JAR file. -**/ -interface AS400FileImpl -{ - - /** - *Returns any explicit locks that have been obtained for this file. - *Any locks that have been obtained through the lock(int) method are returned. - *@see AS400File#lock - *@return The explicit file locks held for this file. - * Possible lock values are: - *
      - *
    • READ_EXCLUSIVE_LOCK - *
    • READ_ALLOW_SHARED_READ_LOCK - *
    • READ_ALLOW_SHARED_WRITE_LOCK - *
    • WRITE_EXCLUSIVE_LOCK - *
    • WRITE_ALLOW_SHARED_READ_LOCK - *
    • WRITE_ALLOW_SHARED_WRITE_LOCK - *
    - *If no explicit locks have been obtained for the file, an array of size zero - *is returned. - **/ - int[] getExplicitLocks(); - - String[] openFile2(int openType, int bf, int level, boolean access) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - /* @A0: Proxy support - the "doIt" methods - Since there are so many methods in the AS400File, KeyedFile, - and SequentialFile classes that needed to be proxified, I found - it to be more efficient to consolidate those methods that - 1) threw the same exceptions and - 2) were of the same return type. - This had the effect of reducing the number of proxified methods - by a large amount, thereby reducing the size of the .class files. - The doIt() methods take a methodName as a parameter and use - core reflection in AS400FileImplBase to invoke that method, in - the same way that the actual Proxy classes do. - - While it is true that the logic required to do the core reflection - increases class file size, that code does not exist in the proxy - jar file, yielding the benefit of reduced class file size due to - the reduction in methods for the proxy jar file. - */ - void doIt(String methodName, Class[] classes, Object[] objects) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - void doItNoExceptions(String methodName, Class[] classes, Object[] objects); - - Record doItRecord(String methodName, Class[] classes, Object[] objects) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - Record[] doItRecordArray(String methodName, Class[] classes, Object[] objects) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - RecordFormat doItRecordFormat(String methodName, Class[] classes, Object[] objects) //@B2A - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; //@B2A - - int doItInt(String methodName); - - boolean doItBoolean(String methodName); - - boolean doItBoolean(String methodName, Class[] classes, Object[] objects); //@E0A - - AS400Message[] execute(String command) throws AS400SecurityException, InterruptedException, IOException; -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400FileImplBase.java b/cvsroot/src/com/ibm/as400/access/AS400FileImplBase.java deleted file mode 100644 index e83b2b509..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400FileImplBase.java +++ /dev/null @@ -1,3642 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400FileImplBase.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.util.Enumeration; -import java.util.Vector; -import java.beans.PropertyVetoException; -import java.math.BigDecimal; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; //@F0A - -abstract class AS400FileImplBase implements AS400FileImpl, Cloneable //@B5C -{ - // Is this class an ImplRemote or an ImplNative - boolean isNative_ = false; //@E2A - - boolean discardReplys_ = false; //@D1A (moved out of AS400FileImplRemote) - - // Converter that converts to the server job CCSID. - ConverterImplRemote converter_; //@B5C - - // retrieve the requested record, do not consider deleted records as - // part of the file - static final byte DATA_DTA_DTARCD = 0; - // position the file to the requested record, do not - // retrieve the data, do not consider deleted records - static final byte DATA_NODTA_DTARCD = 1; - // GET - static final byte OPER_GET = 1; - // GETD - static final byte OPER_GETD = 2; - // GETK - static final byte OPER_GETK = 3; - // PUTDR - static final byte OPER_PUTDR = 4; - // PUT - static final byte OPER_PUT = 5; - // UPDATE - static final byte OPER_UPDATE = 7; - // DELETE - static final byte OPER_DELETE = 8; - // FEOD - static final byte OPER_FEOD = 9; - // retrieve for read only - static final byte SHR_READ_NORM = 0; - // retrieve for read only and give up lock on previously locked record - static final byte SHR_READ_NORM_RLS = 2; - // retrieve for update - static final byte SHR_UPD_NORM = 3; - // retrieve the record for read leaving the previous - // file position as the current file position - static final byte SHR_READ_NOPOS = 0x10; - // retrieve for read only leaving the previous file position as the - // current file position and give up lock on previously locked record - static final byte SHR_READ_NOPOS_RLS = 0x12; - // retrieve the record for update leaving the previous - // file position as the current file position after the get request - static final byte SHR_UPD_NOPOS = 0x13; - // retrieve for update but do not wait on record locks - // held by the same process - static final byte SHR_UPD_NORM_NW = 0x23; - // retrieve the record for update leaving the previous file position as - // the current file position after the get request but do not wait on - // record locks held by the same process - static final byte SHR_UPD_NOPOS_NW = 0x33; - // retrieve first record - static final byte TYPE_GET_FIRST = 1; - // retrieve last record - static final byte TYPE_GET_LAST = 2; - // retrieve next record - static final byte TYPE_GET_NEXT = 3; - // retrieve previous record - static final byte TYPE_GET_PREV = 4; - // retrieve current record - static final byte TYPE_GET_SAME = 0x21; - // Retrieve record at the specified position (relative to file start). - static final byte TYPE_GETD_ABSRRN = 8; - // WDMHLIB - private static final int WDMHLIB = 72; - // WDMHMBR - private static final int WDMHMBR = 73; - - // Open feedback information from open(). - DDMS38OpenFeedback openFeedback_; - - // The following String constants are used to format the DDS source when - // creating a file from a user supplied RecordFormat object - static final String STR16 = " "; - static final String STR18 = " "; - static final String STR44 = " "; - - // Indicates which explicit locks, if any, have been obtained. There are six - // possible types of locks. Initially each array element is false. - Vector explicitLocksObtained_ = new Vector(6); - - // Servers currently under commitment control. - static Vector commitmentControlSystems_ = new Vector(); - - // Used for commitment control when we're running natively. See AS400FileImplBase. - static boolean nativeCommitmentControlStarted_ = false; //@E2A - - //@B0A: These are duplicated from the public class since they are either - // beans or parts of beans. - AS400ImplRemote system_ = null; //@B5C - String name_ = null; - RecordFormat recordFormat_ = null; - String library_ = null; - String file_ = null; - String member_ = null; - - // Holds any cached records - DDMRecordCache cache_ = new DDMRecordCache(); - // Indicates if records are to be cached; if blockingFactor_ > 1 and file - // is not opened for READ_WRITE, records will be cached. - boolean cacheRecords_ = false; - - // Caches the record formats retrieved from the server for the file - RecordFormat[] rfCache_ = null; //@B2A - - // The lock level for commitment control for this file. This value is - // specified upon construction of the object if commitment control has been - // started for the connection. - int commitLockLevel_ = -1; - - // The number of records to retrieve during a read operation or the maximum - // number of records to write at one time during a writeCollection() - int blockingFactor_; - - // A boolean indicating if it's a 'read no update' in an open type of read/write. - // If 'read no update' is true, it allows a file to be opened as read/write, yet - // reading won't exclusively lock the records being read. The default is false. - boolean readNoUpdate_ = false; - - // Indicates if this file should be treated as an SSP file or DDM file - // when createUFCB() is called. - boolean ssp_ = false; - - // Manner in which file has been opened. This value will be set upon open(). - // -1 indicates that the file is not open. - int openType_ = -1; - - // These two variables are used to do the CTLL name conversion once after the - // file is opened so that the converion result can be directly used in later - // DDM request streams. - byte[] recordFormatCTLLName_ = null; - private String recordFormatName_ = ""; - - //@B0A - // This flag tells us if we are an impl for a KeyedFile or a SequentialFile. - // Created primarily for use in refreshCache(). - //private boolean isKeyed_ = false; // not used - - - //@B4A - constants for comparing keys - private static final int EQUAL = 1; // keys are equal - private static final int LESS_THAN = 2; // search key < current key - private static final int GREATER_THAN = 3; // search key > current key - private static final int UNKNOWN = 4; // Not equal, but keep searching. - - private static final boolean CHECK_LENGTHS = true; // mnemonic for flag-setting - - public void doIt(String methodName, Class[] classes, Object[] objects) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - try - { - invoke(this, methodName, classes, objects); //@F0C - } - catch (InvocationTargetException e) - { - throw rethrow(e); - } - catch (Exception e2) - { - Trace.log(Trace.ERROR, e2.toString(), e2); - throw new InternalErrorException(InternalErrorException.PROTOCOL_ERROR, e2.getMessage()); - } - } - - // Rethrows exceptions returned as InvocationTargetExceptions. This provides some common exception handling. - // @param e The InvocationTargetException. - // @return An InternalErrorException if the exception is not known. - // @throws The exception. - public static InternalErrorException rethrow(InvocationTargetException e) throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - Throwable e2 = e.getTargetException(); - if (e2 instanceof AS400Exception) { - throw (AS400Exception)e2; - } - else if (e2 instanceof InterruptedException) { - throw (InterruptedException)e2; - } - else if (e2 instanceof AS400SecurityException) { - throw (AS400SecurityException)e2; - } - else if (e2 instanceof IOException) { - throw (IOException)e2; - } - else if (e2 instanceof RuntimeException) { - throw (RuntimeException)e2; - } - else if (e2 instanceof Error) { - throw (Error)e2; - } - else return new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e2.getMessage()); - } - - public void doItNoExceptions(String methodName, Class[] classes, Object[] objects) - { - try - { - invoke(this, methodName, classes, objects); //@F0C - } - catch (Exception e2) - { - Trace.log(Trace.ERROR, e2.toString(), e2); - throw new InternalErrorException(InternalErrorException.PROTOCOL_ERROR, e2.getMessage()); - } - } - - public Record doItRecord(String methodName, Class[] classes, Object[] objects) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - try - { - return(Record)invoke(this, methodName, classes, objects); //@F0C - } - catch (InvocationTargetException e) - { - throw rethrow(e); - } - catch (Exception e2) - { - Trace.log(Trace.ERROR, e2.toString(), e2); - throw new InternalErrorException(InternalErrorException.PROTOCOL_ERROR, e2.getMessage()); - } - } - - public Record[] doItRecordArray(String methodName, Class[] classes, Object[] objects) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - try - { - return(Record[])invoke(this, methodName, classes, objects); //@F0C - } - catch (InvocationTargetException e) - { - throw rethrow(e); - } - catch (Exception e2) - { - Trace.log(Trace.ERROR, e2); - throw new InternalErrorException(InternalErrorException.PROTOCOL_ERROR, e2.getMessage()); - } - } - - //@B2A - public RecordFormat doItRecordFormat(String methodName, Class[] classes, Object[] objects) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - try - { - return(RecordFormat)invoke(this, methodName, classes, objects); //@F0C - } - catch (InvocationTargetException e) - { - throw rethrow(e); - } - catch (Exception e2) - { - Trace.log(Trace.ERROR, e2); - throw new InternalErrorException(InternalErrorException.PROTOCOL_ERROR, e2.getMessage()); - } - } - - public int doItInt(String methodName) - { - try - { - return((Integer)invoke(this, methodName, new Class[0], new Object[0])).intValue(); //@F0C - } - catch (Exception e) - { - Trace.log(Trace.ERROR, e); - throw new InternalErrorException(InternalErrorException.PROTOCOL_ERROR, e.getMessage()); - } - } - - public boolean doItBoolean(String methodName) - { - try - { - return((Boolean)invoke(this, methodName, new Class[0], new Object[0])).booleanValue(); //@F0C - } - catch (Exception e) - { - Trace.log(Trace.ERROR, e); - throw new InternalErrorException(InternalErrorException.PROTOCOL_ERROR, e.getMessage()); - } - } - - //@E2A - public boolean doItBoolean(String methodName, Class[] classes, Object[] objects) - { - try - { - return((Boolean)invoke(this, methodName, classes, objects)).booleanValue(); //@F0C - } - catch (Exception e) - { - Trace.log(Trace.ERROR, e); - throw new InternalErrorException(InternalErrorException.PROTOCOL_ERROR, e.getMessage()); - } - } - - - //@F0A - This method is copied from PxMethodReqSV. We don't - // want to have dependencies on the proxy classes directly, so - // that's why I included it here. - static Object invoke(Object object, - String methodName, - Class[] argumentClasses, - Object[] arguments) - throws ClassNotFoundException, - IllegalAccessException, - InvocationTargetException, - NoSuchMethodException - { - // Resolve the Method object. First, try Class.getMethod() which - // only looks for public methods. If that does not work, try - // Class.getDeclaredMethod(), which only looks for declared - // methods (not inherited methods). Do this up the superclass tree. - Method method = null; - Class clazz = object.getClass(); - NoSuchMethodException e = null; - while ((clazz != null) && (method == null)) - { - try - { - method = clazz.getMethod(methodName, argumentClasses); - } - catch (NoSuchMethodException e1) - { - try - { - method = clazz.getDeclaredMethod(methodName, argumentClasses); - } - catch (NoSuchMethodException e2) - { - e = e2; - clazz = clazz.getSuperclass(); - } - } - } - if (method == null) - throw e; - - // Call the method. - return method.invoke (object, arguments); - } - - - //public void setIsKeyed(boolean keyed) // not used - //{ - // isKeyed_ = keyed; - //} - - public boolean isReadNoUpdate() - { - return readNoUpdate_; - } - - - //@B0A - /** - *Adds a physical file member to the file represented by this object. - *@param name The name of the member to create. The name cannot - *exceed 10 characters in length. The name cannot be null. - *@param textDescription The text description with which to create the file. - *This value must be 50 characters or less. If this value is null, the - *text description will be blank.
    - *The name of the file and the server to which to connect must be set - *prior to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped - * unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the - * server. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - **/ - public void addPhysicalFileMember(String name, String textDescription) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Create the ADDPFM command string - StringBuffer cmd = new StringBuffer("QSYS/ADDPFM FILE("); - cmd.append(library_); - cmd.append("/"); - cmd.append(file_); - cmd.append(") MBR("); - cmd.append(name); - cmd.append(") TEXT("); - // Determine correct text description and add it to the command string - if (textDescription == null) - { // No text description supplied. - cmd.append(AS400File.BLANK); //@B3C - cmd.append(")"); //@B3A - } - else if (textDescription.length() == 0 || textDescription.equalsIgnoreCase(AS400File.BLANK)) //@A3C - { - // Empty string passed for text or special value *BLANK specified - cmd.append(AS400File.BLANK); //@B3C - cmd.append(")"); //@B3A - } - else - { - // Enclose the text description in single quotes for the command - cmd.append("'"); - cmd.append(textDescription); - cmd.append("')"); - } - - // Add the member. - AS400Message[] msgs = execute(cmd.toString()); //@B0C - - if (!(msgs.length > 0 && msgs[0].getID().equals("CPC7305"))) - { - throw new AS400Exception(msgs); - } - } - - // Compare 2 arrays, returning the relationship of first array to second array. - private final static int compareArrays(byte[] array1, byte[] array2, boolean checkLengths) - { - if (checkLengths) - { - if (array1.length < array2.length) return LESS_THAN; - if (array1.length > array2.length) return GREATER_THAN; - } - - // Compare the arrays, byte by byte. - for (int k = 0; k < array1.length; ++k) - { - if (array1[k] < array2[k]) return LESS_THAN; - if (array1[k] > array2[k]) return GREATER_THAN; - } - return EQUAL; - } - - - //@B4C - /** - *Determines if the keys are the same. - *@param key key to compare - *@param recKey key of record being compared to - *@return The result of the key comparison (EQUAL, GREATER_THAN, LESS_THAN, or UNKNOWN). - * For example, GREATER_THAN indicates that 'key' is greater than 'recKey'. - **/ - private int compareKeys(Object[] key, Object[] recKey) - { - if (key.length > recKey.length) - { // Key is greater in length than recKey; not valid - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) - { - Trace.log(Trace.WARNING, "compareKeys: Search key has too many fields."); - } - return UNKNOWN; - } - // Key has possibilities - may be a partial key, or may be a full key - // so we only check matches up to the length of the "key" passed in. - int match = EQUAL; - for (int j = 0; j < key.length && match == EQUAL; ++j) - { - if (key[j] instanceof byte[] && recKey[j] instanceof byte[]) - { - byte[] searchKey = (byte[])key[j]; - byte[] recordKey = (byte[])recKey[j]; - - match = compareArrays(searchKey, recordKey, CHECK_LENGTHS); - } - else if (recordFormat_.getKeyFieldDescription(j) instanceof VariableLengthFieldDescription) // superclass of all textual field types - { - //@B4C -- begin - // Note: A String in a DDM field is always padded with blanks - // to be the length of the field. - // Therefore, we should ignore any trailing blanks in the keys, - // but we must regard any leading ones. - String searchKey = (String)key[j]; - String recordKey = (String)recKey[j]; - int searchKeyLength = searchKey.length(); - int recordKeyLength = recordKey.length(); - if (searchKeyLength < recordKeyLength) - { - // pad the search key with trailing blanks - StringBuffer buf = new StringBuffer(searchKey); - for (int i=searchKeyLength; i recordKeyLength) - { - // It is OK for the user to pass in a blank-padded search - // key that is longer than the length of the field. - // We just chop it to be the correct length. - searchKey = searchKey.substring(0, recordKeyLength); - } - - - // Note: We must account for the system CCSID when comparing text fields, since the records on the system will be sorted according to the system CCSID, which may result in a different collation than in Unicode. For example, in some CCSIDs, '1' precedes 'A', whereas in other CCSIDs, 'A' precedes '1'. - - // To honor the CCSID-specific collation, first convert the keys to system bytes before comparing them. - FieldDescription fd = recordFormat_.getKeyFieldDescription(j); - byte[] searchKeyAsBytes = fd.getDataType().toBytes(searchKey); - byte[] recordKeyAsBytes = fd.getDataType().toBytes(recordKey); - - match = compareArrays(searchKeyAsBytes, recordKeyAsBytes, CHECK_LENGTHS); - - //@B4C -- end - } - else if (key[j] instanceof BigDecimal && recKey[j] instanceof BigDecimal) - { // decimal field - BigDecimal searchKey = (BigDecimal)key[j]; - BigDecimal recordKey = (BigDecimal)recKey[j]; - int res = searchKey.compareTo(recordKey); - if (res > 0) match = GREATER_THAN; - else if (res < 0) match = LESS_THAN; - } - else if (!key[j].equals(recKey[j])) - { // some other type - // Since we don't know the type, we have to keep searching - // the whole file. - match = UNKNOWN; - } - } - return match; - } - - - //@B4C - // @A2A - /** - *Determines if the keys are the same. - *@param key key in bytes to compare - *@param recKey key of record in bytes being compared to - *@param numberOfKeyFields The number of key fields contained in the byte array key - *being compared to recKey. The number of key fields must be greater than 0 and less - *than the total number of key fields in the record format for this file. - *@return The result of the key comparison (EQUAL, GREATER_THAN, LESS_THAN, or UNKNOWN). - * For example, GREATER_THAN indicates that 'key' is greater than 'recKey'. - **/ - private int compareKeys(byte[] key, byte[] recKey, int numberOfKeyFields) - { - if (key.length > recKey.length) - { // Key is greater in length than recKey; not valid - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) - { - Trace.log(Trace.WARNING, "compareKeys: Search key is too long."); - } - return UNKNOWN; - } - if ((numberOfKeyFields < 1) || (numberOfKeyFields > recordFormat_.getNumberOfKeyFields())) - { - throw new ExtendedIllegalArgumentException("numberOfKeyFields", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Check to see if the byte length of 'key' is valid on a per key field basis. - int keyByteLength = 0; - FieldDescription[] fd = recordFormat_.getKeyFieldDescriptions(); - for (int i=0; i - *
  • READ_EXCLUSIVE_LOCK - *
  • READ_ALLOW_SHARED_READ_LOCK - *
  • READ_ALLOW_SHARED_WRITE_LOCK - *
  • WRITE_EXCLUSIVE_LOCK - *
  • WRITE_ALLOW_SHARED_READ_LOCK - *
  • WRITE_ALLOW_SHARED_WRITE_LOCK - * - *If no explicit locks have been obtained for the file, an array of size zero - *is returned. - **/ - public int[] getExplicitLocks() - { - // Create an array of the explicit locks that are currently set. - int[] locks = new int[explicitLocksObtained_.size()]; - for (int i = 0; i < locks.length; i++) - { - locks[i] = ((Integer) explicitLocksObtained_.elementAt(i)).intValue(); - } - return locks; - } - - - public int getOpenType() - { - return openType_; - } - - - /** - *Closes the file on the server. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the - *server. - **/ - public void close() //@B0C -- this method is overridden by the subclasses - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // Shut down any caching - cacheRecords_ = false; - cache_.setIsEmpty(); - - // Reset the blocking factor - blockingFactor_ = 0; - - // Reset the open type. -1 indicates that the file is not open - openType_ = -1; - - // Reset the commit lock level. - commitLockLevel_ = (isCommitmentControlStarted() ? - AS400File.COMMIT_LOCK_LEVEL_NONE : -1 ); - } - - - /** - * This is a convenience method for setting all 4 properties at once, so as to - * avoid 4 separate proxy calls. - **/ - public void setAll(AS400Impl system, String pathName, RecordFormat rf, boolean readNoUpdate, boolean isKeyed, boolean ssp) //@B5C - throws IOException //@B5A - 06/08/1999 - { - setSystem(system); - setPath(pathName); - setRecordFormat(rf); - setReadNoUpdate(readNoUpdate); //@B5A - //setIsKeyed(isKeyed); - setSSPFile(ssp); - setConverter(); //@B5A - 06/08/1999 - } - - - /** - *Commits all transactions since the last commit boundary. Invoking this - *method will cause all transactions under commitment control for this - *connection to be committed. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the - *server. - **/ - public abstract void commit() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - - //@E2A - // This method should be static, but we can't make a static call to - // a native method (the call to execute()) so we just set all of the - // necessary state variables and act like we're a normal object. - public void commit(AS400Impl system) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - if (isCommitmentControlStarted(system)) - { - // Setup state variables - setSystem(system); - setConverter(); - - commit(); - } - } - - - //@B0A - public void setConverter() throws IOException - { - converter_ = ConverterImplRemote.getConverter(system_.getCcsid(), system_); //@B5C -//@E0D if (recordFormat_ != null) recordFormat_.setConverter(converter_); //@D0A - } - - - public void setPath(String name) - { - // Construct a QSYSObjectPathName object and parse out the library, - // file and member names - QSYSObjectPathName ifs = new QSYSObjectPathName(name); - if (!(ifs.getObjectType().equals("FILE") || ifs.getObjectType().equals("MBR"))) - { // Invalid object type - throw new IllegalPathNameException(name, IllegalPathNameException.OBJECT_TYPE_NOT_VALID); - } - // Set the instance data as appropriate - library_ = ifs.getLibraryName(); - file_ = ifs.getObjectName(); - if (ifs.getObjectType().equals("FILE")) - { // No member specified; default member to *FIRST - member_ = "*FIRST"; - } - else - { // Member specified; if special value %FILE% was specified, member name - // is the file name - member_ = (ifs.getMemberName().equalsIgnoreCase("*FILE") ? file_ : - ifs.getMemberName()); - } - name_ = name; - rfCache_ = null; //@B2A - } - - public void setReadNoUpdate(boolean readNoUpdate) - { - readNoUpdate_ = readNoUpdate; - } - - //@B2A - /** - * Retrieves rfCache_[rf]. If the cache is empty, retrieves the record - * formats from the server. - **/ - public RecordFormat setRecordFormat(int rf) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (rfCache_ == null) - { - AS400FileRecordDescriptionImplRemote desc = new AS400FileRecordDescriptionImplRemote(); //@B5C - desc.setPath(name_); //@B5A - desc.setSystem(system_); //@B5A - rfCache_ = desc.retrieveRecordFormat(); - } - if (rfCache_.length <= rf) // the index is too big - { - throw new ExtendedIllegalArgumentException("recordFormat (" + String.valueOf(rf) + ") too large", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - return rfCache_[rf]; - } - - //@B2A - /** - * Retrieves "rf" from rfCache_. If the cache is empty, retrieves the record - * formats from the server. - **/ - public RecordFormat setRecordFormat(String rf) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (rfCache_ == null) - { - AS400FileRecordDescriptionImplRemote desc = new AS400FileRecordDescriptionImplRemote(); //@B5C - desc.setPath(name_); //@B5A - desc.setSystem(system_); //@B5A - rfCache_ = desc.retrieveRecordFormat(); - } - RecordFormat toSet = null; - for (int i=0; i 10) rfName = rfName.substring(0, 10); - converter_.stringToByteArray(rfName, ufcb, offset + 6); - for (int i = rfName.length(); i < 10 && i+offset+6 < ufcb.length; i++) - { - ufcb[i + offset + 6] = 0x40; - } - offset += 16; - } - - // Indicate the end of the variable portion of the UFCB; this is required - BinaryConverter.unsignedShortToByteArray(32767, ufcb, offset); - - return ufcb; - } - - /** - *Deletes the record at the current cursor position. The file must be open and - *the cursor must be positioned on an active record. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public abstract void deleteCurrentRecord() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - /** - *Deletes the member associated with this object from the file. The object cannot - *be open when invoking this method.
    - *The name of the file and the server to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - **/ - public void deleteMember() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - AS400Message[] msgs = execute("QSYS/RMVM FILE(" + library_ + "/" + //@B0C - file_ + ") MBR(" + member_ + ")"); - if (msgs.length > 0 && msgs[0].getID() != null) - { - if (!msgs[0].getID().equals("CPC7309")) - { - throw new AS400Exception(msgs); - } - } - else - { - Trace.log(Trace.ERROR, "No messages from server"); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - - //@D1A - /** - * Turns on reply discarding for the data streams. - * This is only used when our public object is being finalized. - **/ - public void discardReplies() - { - discardReplys_ = true; - } - - - /** - *Ends commitment control for this connection. - *If commitment control has not been started for the connection, no action - *is taken. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void endCommitmentControl() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - endCommitmentControl(system_); //@E2A -/*@E2D if (isCommitmentControlStarted()) - { - AS400Message[] msgs = execute("QSYS/ENDCMTCTL"); //@B0C - if (msgs.length > 0 && msgs[0].getID() != null && - !msgs[0].getID().equals("CPI8351")) - { - throw new AS400Exception(msgs); - } - - // Remove the current system from the list of commitment control - // systems. - commitmentControlSystems_.removeElement(system_); -// server_.commitmentControlStarted_ = false; //@B0A - } -*/ //@E2D - } - - - //@E2A - // This method should be static, but we can't make a static call to - // a native method (the call to execute()) so we just set all of the - // necessary state variables and act like we're a normal object. - public void endCommitmentControl(AS400Impl system) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - synchronized(commitmentControlSystems_) - { - if ((isNative_ && nativeCommitmentControlStarted_) || // native case - commitmentControlSystems_.contains(system)) // remote case - { - // Setup state variables - setSystem(system); - setConverter(); - - // End commitment control - AS400Message[] msgs = execute("QSYS/ENDCMTCTL"); - if (msgs.length > 0 && msgs[0].getID() != null && - !msgs[0].getID().equals("CPI8351")) - { - throw new AS400Exception(msgs); - } - if (isNative_) - { - nativeCommitmentControlStarted_ = false; - } - else - { - commitmentControlSystems_.removeElement(system_); - } - } - } - } - - - /** - *Starts commitment control on this file (for this connection). If commitment control - *has already been started for the connection, an exception is thrown. - *@param commitLockLevel The type of commitment control - * to exercise. Valid values are: - *
      - *
    • COMMIT_LOCK_LEVEL_ALL - *
    • COMMIT_LOCK_LEVEL_CHANGE - *
    • COMMIT_LOCK_LEVEL_CURSOR_STABILITY - *
    - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - **/ - public void startCommitmentControl(int commitLockLevel) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - startCommitmentControl(system_, commitLockLevel); //@E2A -/*@E2D - // Build the command to start commitment control. - StringBuffer cmd = new StringBuffer("QSYS/STRCMTCTL LCKLVL(*"); - switch(commitLockLevel) - { - case AS400File.COMMIT_LOCK_LEVEL_CHANGE: - cmd.append("CHG)"); - break; - case AS400File.COMMIT_LOCK_LEVEL_CURSOR_STABILITY: - cmd.append("CS)"); - break; - case AS400File.COMMIT_LOCK_LEVEL_ALL: - cmd.append("ALL)"); - break; - default: - throw new ExtendedIllegalArgumentException("commitLockLevel", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Start commitment control. - AS400Message[] msgs = execute(cmd.toString()); //@B0C - if (msgs.length > 0 && msgs[0].getID() != null) - { - if (!msgs[0].getID().equals("CPI8351")) - { - throw new AS400Exception(msgs); - } - } - - // Indicate that commitment control is started for the current system. -// server_.commitmentControlStarted_ = true; - if (!commitmentControlSystems_.contains(system_)) - { - commitmentControlSystems_.addElement(system_); - } -*/ //@E2D - } - - - //@E2A - // This method should be static, but we can't make a static call to - // a native method (the call to execute()) so we just set all of the - // necessary state variables and act like we're a normal object. - public void startCommitmentControl(AS400Impl system, int commitLockLevel) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - synchronized(commitmentControlSystems_) - { - if ((isNative_ && nativeCommitmentControlStarted_) || // native case - commitmentControlSystems_.contains(system)) // remote case - { - // AS400Impl that was passed in must be natively connected - // or we would never have been instantiated as an AS400FileImplNative. - // The AS400.loadImpl() method makes sure of that. - // We just check a boolean flag in the ImplNative... no need to add - // it to the Vector, since there should only ever be one "connection" - // for an ImplNative. - // If we're an ImplRemote, we just check the Vector like usual. - throw new ExtendedIllegalStateException(ExtendedIllegalStateException.COMMITMENT_CONTROL_ALREADY_STARTED); - } - - // Setup state variables - setSystem(system); - setConverter(); - - // Build the command to start commitment control. - StringBuffer cmd = new StringBuffer("QSYS/STRCMTCTL LCKLVL(*"); - switch (commitLockLevel) - { - case AS400File.COMMIT_LOCK_LEVEL_CHANGE: - cmd.append("CHG)"); - break; - case AS400File.COMMIT_LOCK_LEVEL_CURSOR_STABILITY: - cmd.append("CS)"); - break; - case AS400File.COMMIT_LOCK_LEVEL_ALL: - cmd.append("ALL)"); - break; - default: - throw new ExtendedIllegalArgumentException("commitLockLevel", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Start commitment control. - AS400Message[] msgs = execute(cmd.toString()); - if (msgs.length > 0 && msgs[0].getID() != null) - { - if (!msgs[0].getID().equals("CPI8351")) - { - throw new AS400Exception(msgs); - } - } - - // Indicate that commitment control is started for the current system. - if (isNative_) - { - nativeCommitmentControlStarted_ = true; - } - else if (!commitmentControlSystems_.contains(system_)) - { - commitmentControlSystems_.addElement(system_); - } - } - } - - /** - *Resets the state instance variables of this object to the appropriate - *values for the file being closed. This method is used to reset the - *the state of the object when the connection has been ended abruptly. - **/ - public synchronized void resetState() - { - // Shut down any caching - cacheRecords_ = false; - cache_.setIsEmpty(); - // Reset the blocking factor - blockingFactor_ = 0; - // Reset the open type. -1 indicates that the file is not open - openType_ = -1; - // Reset the commit lock level; as this method is only called if the - // connection was ended abruptly, there is no server, so there is no - // need to check if commitment control has been started. - commitLockLevel_ = -1; - } - - - /** - *Releases all locks acquired via the lock() method. If no locks have been - *explicitly obtained, no action is taken. - *@see AS400File#lock - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - **/ - public void releaseExplicitLocks() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (explicitLocksObtained_.size() > 0) - { - // Build the command to release the explicit locks. - StringBuffer cmd = new StringBuffer("QSYS/DLCOBJ OBJ("); - for (Enumeration e = explicitLocksObtained_.elements(); - e.hasMoreElements();) - { - cmd.append("("); - cmd.append(library_); - cmd.append("/"); - cmd.append(file_); - cmd.append(" *FILE "); - int lockType = ((Integer)e.nextElement()).intValue(); - switch (lockType) - { - case AS400File.READ_ALLOW_SHARED_READ_LOCK: - cmd.append("*SHRNUP "); - break; - case AS400File.READ_ALLOW_SHARED_WRITE_LOCK: - cmd.append("*SHRRD "); - break; - case AS400File.READ_EXCLUSIVE_LOCK: - case AS400File.WRITE_EXCLUSIVE_LOCK: - cmd.append("*EXCL "); - break; - case AS400File.WRITE_ALLOW_SHARED_READ_LOCK: - cmd.append("*EXCLRD "); - break; - case AS400File.WRITE_ALLOW_SHARED_WRITE_LOCK: - cmd.append("*SHRUPD "); - break; - default: - Trace.log(Trace.ERROR, "Unrecognized lock type: " + lockType); - throw new InternalErrorException(InternalErrorException.UNKNOWN, lockType); - } - cmd.append(member_); - cmd.append(") "); - } - cmd.append(")"); - - // Execute the command. - AS400Message[] msgs = execute(cmd.toString()); //@B0C - if (msgs.length > 0 && msgs[0].getID() != null) - { - throw new AS400Exception(msgs); - } - - // Clear the list of explicit locks. - explicitLocksObtained_.removeAllElements(); - } - } - - - /** - *Executes a command on the server. - *@param cmd the command - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public abstract AS400Message[] execute(String cmd) - throws AS400SecurityException, InterruptedException, IOException; - - - /** - *Returns the commit lock level for this file as specified on open. - *@return The commit lock level for this file. - *If commitment control has not been started for the connection or if - *file has not been opened, -1 is returned. - *Possible return values are: - *
      - *
    • COMMIT_LOCK_LEVEL_ALL - *
    • COMMIT_LOCK_LEVEL_CHANGE - *
    • COMMIT_LOCK_LEVEL_CURSOR_STABILITY - *
    • COMMIT_LOCK_LEVEL_DEFAULT - *
    • COMMIT_LOCK_LEVEL_NONE - *
    • -1 - *
    - **/ - public int getCommitLockLevel() - { - return(isCommitmentControlStarted() ? commitLockLevel_ : -1); - } - - - /** - *Indicates if commitment control is started for - *the connection. - *@return true if commitment control has been started; false otherwise. - **/ - public boolean isCommitmentControlStarted() - { - if (isNative_) //@E2A - return nativeCommitmentControlStarted_; //@E2A - else //@E2A - return commitmentControlSystems_.contains(system_); -// return (server_ != null ? server_.commitmentControlStarted_ : false); //@B0A - } - - - - //@E2A - // This method should be static, but we can't make a static call to - // a native method (the call to execute()) so we just set all of the - // necessary state variables and act like we're a normal object. - public boolean isCommitmentControlStarted(AS400Impl system) - { - if (isNative_) - return nativeCommitmentControlStarted_; - else - return commitmentControlSystems_.contains(system); - } - - - /** - *Creates a physical file with the specified record length and file type. - *The record format for this object will be set by this method. The - *record format for the file is determined as follows: - *
      - *
    • If fileType is AS400File.TYPE_DATA, - *
        - *
      • The format name of the file is the name of the file as specified on the - *constructor - *
      • The record format contains one field whose name is the name of the file, - *whose type is CHARACTER, and whose length is recordLength - *
      - *
    • If fileType is AS400File.TYPE_SOURCE, - *
        - *
      • The format name of the file is the name of the file as specified on the - *constructor - *
      • The record format contains three fields: - *
          - *
        • SRCSEQ whose type is ZONED(6, 2) - *
        • SRCDAT whose type is ZONED(6, 0) - *
        • SRCDTA whose type is CHARACTER and whose length is - *recordLength - 12 - *
        - *
      - *
    - *Note: The file is created using the default values for the - * Create Physical File command (CRTPF). - * Use the CommandCall class to issue a CHGPF - * command to change the file after it - *has been created.
    - *The name of the file and the server to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@param recordLength The record length with which to create the file. Valid values - * are 1 through 32766 inclusive. - *@param fileType The file type with which to create the file. Valid values are - * AS400File.TYPE_DATA or AS400File.TYPE_SOURCE. If AS400File.TYPE_DATA is specified, the record - * format for the file contains one field. If AS400File.TYPE_SOURCE is - * specified, the record format for the file contains three - * fields: source sequence number, date, and source statement. - *@param textDescription The text description with which to create the file. - *This value must be between 1 and 50 characters inclusive. - *If this value is null, the empty string, or AS400File.BLANK, - *the text description is blank. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - **/ - public void create(int recordLength, String fileType, String textDescription) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Create the CRTPF command string - StringBuffer cmd = new StringBuffer("QSYS/CRTPF FILE("); - cmd.append(library_); - cmd.append("/"); - cmd.append(file_); - cmd.append(") RCDLEN("); - cmd.append(recordLength); - cmd.append(") MBR("); - cmd.append(member_); - cmd.append(") TEXT("); - // Determine correct text description - if (textDescription == null) - { - // Specify *BLANK for text on the command - cmd.append(AS400File.BLANK); //@B3C - } - else if (textDescription.length() == 0 || textDescription.equalsIgnoreCase(AS400File.BLANK)) //@B3C - { - // Specify *BLANK for text on the command - cmd.append(AS400File.BLANK); //@B3C - } - else - { - // Enclose the text description in single quotes for the command - cmd.append("'"); - cmd.append(textDescription); - cmd.append("'"); - } - cmd.append(") FILETYPE("); - cmd.append(fileType); - cmd.append(")"); - - // Create the file. - AS400Message[] msgs = execute(cmd.toString()); //@B0C - if (!(msgs.length > 0 && msgs[0].getID().equals("CPC7301"))) - { - throw new AS400Exception(msgs); - } - } - - /** - *Creates a physical file using the specified DDS source file. - *Note: The file is created using the default values for the - * Create Physical File (CRTPF) command. - *Use the CommandCall class to issue a CHGPF to change the file after it - *has been created.
    - *The name of the file and the server to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@param ddsSourceFile The integrated file system pathname of the file containing the - *DDS source for the file being created. - *@param textDescription The text description with which to create the file. - *This value must be between 1 and 50 characters inclusive. - *If this value is null, the empty string, or AS400File.BLANK, - *the text description will be blank. - *Specify AS400File.SOURCE_MEMBER_TEXT for the text description if the text - *description from ddsSourceFile is to be used. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - **/ - public void create(String ddsSourceFile, - String textDescription) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Parse the ddsDourceFile into library, file and member - QSYSObjectPathName ifs = new QSYSObjectPathName(ddsSourceFile); - if (!(ifs.getObjectType().equals("FILE") || ifs.getObjectType().equals("MBR"))) - { // Invalid QSYSObjectPathName - throw new IllegalPathNameException(ddsSourceFile, IllegalPathNameException.OBJECT_TYPE_NOT_VALID); - } - - // Create the CRTPF command string - StringBuffer cmd = new StringBuffer("QSYS/CRTPF FILE("); - cmd.append(library_); - cmd.append("/"); - cmd.append(file_); - cmd.append(") SRCFILE("); - cmd.append(ifs.getLibraryName()); - cmd.append("/"); - cmd.append(ifs.getObjectName()); - cmd.append(") SRCMBR("); - cmd.append(ifs.getMemberName()); - cmd.append(") MBR("); - if (member_.equals("*FIRST")) { - // *FIRST is not a valid value for CRTPF MBR(). - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting MBR to *FILE."); - cmd.append("*FILE"); - } - else cmd.append(member_); - cmd.append(") TEXT("); - // Determine correct text description - if (textDescription == null) - { - // Specify *BLANK for text on the command - cmd.append(AS400File.BLANK); //@B3C - cmd.append(")"); //@B3A - } - else if (textDescription.length() == 0 || textDescription.equalsIgnoreCase(AS400File.BLANK)) //@A3C - { - // Specify *BLANK for text on the command - cmd.append(AS400File.BLANK); //@B3C - cmd.append(")"); //@B3A - } - else if (textDescription.equalsIgnoreCase(AS400File.SOURCE_MEMBER_TEXT)) //@B3C - { - cmd.append(textDescription); - cmd.append(")"); - } - else - { - // Enclose the text description in single quotes for the command - cmd.append("'"); - cmd.append(textDescription); - cmd.append("')"); - } - // Create the file. - AS400Message[] msgs = execute(cmd.toString()); //@B0C - if (!(msgs.length > 0 && msgs[0].getID().equals("CPC7301"))) - { - throw new AS400Exception(msgs); - } - } - - - /** - *Creates the DDS source file to be used to create a physical file based on a user - *supplied RecordFormat.
    - *The name of the file and the server to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@param recordFormat The record format to describe in the DDS source file. - *@param altSeq The value to be specified for the file-level keyword ALTSEQ. If no - *value is to be specified, null may be specified. - *@param ccsid The value to be specified for the file-level keyword CCSID. If no - *value is to be specified, null may be specified. - *@param order The value to be specified to indicate in which order records are to be - *retrieved from the file. Valid values are one of the following file-level keywords: - *
      - *
    • FIFO - First in, first out - *
    • LIFO - Last in, first out - *
    • FCFO - First changed, first out - *
    - *If no ordering value is to be specified, null may be specified. - *@param ref The value to be specified for the file-level keyword REF. If no - *value is to be specified, null may be specified. - *@param unique Indicates if the file-level keyword UNIQUE is to be specified. True - *indicates that the UNIQUE keyword should be specified; false indicates that it - *should not be specified. - *@param format The value to be specified for the record-level keyword FORMAT. If no - *value is to be specified, null may be specified. - *@param text The value to be specified for the record-level keyword TEXT. If no - *value is to be specified, null may be specified. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - **/ - public abstract void createDDSSourceFile(RecordFormat recordFormat, //@D0C 7/15/99 @E1C - String altSeq, - String ccsid, - String order, - String ref, - boolean unique, - String format, - String text) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - //@D0 7/15/99 - made abstract and moved code into ImplRemote - - - /** - *Deletes the file. The object cannot be open when calling this method. The file - *and all its members will be deleted. - *Use deleteMember() to delete only the member associated with this object.
    - *The name of the file and the server to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@see AS400File#deleteMember - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - **/ - public void delete() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - AS400Message[] msgs = execute("QSYS/DLTF FILE(" + library_ + "/" + //@B0C - file_ + ")"); - if (msgs.length > 0) - { - if (msgs[0].getID() != null && !msgs[0].getID().equals("CPC2191")) - { - throw new AS400Exception(msgs); - } - } - else - { - Trace.log(Trace.ERROR, "No messages from server"); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - - - /** - *Obtains a lock on the file. - *The name of the file and the server to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@param lockToObtain The type of lock to acquire on the file. - * Valid lock values are: - *
      - *
    • READ_EXCLUSIVE_LOCK - *
    • READ_ALLOW_SHARED_READ_LOCK - *
    • READ_ALLOW_SHARED_WRITE_LOCK - *
    • WRITE_EXCLUSIVE_LOCK - *
    • WRITE_ALLOW_SHARED_READ_LOCK - *
    • WRITE_ALLOW_SHARED_WRITE_LOCK - *
    - *If lockToObtain has already been obtained, no action is taken. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - **/ - public void lock(int lockToObtain) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - Integer l = new Integer(lockToObtain); - if (!explicitLocksObtained_.contains(l)) - { - // Lock the file using the ALCOBJ command. - StringBuffer cmd = new StringBuffer("QSYS/ALCOBJ OBJ(("); - cmd.append(library_); - cmd.append("/"); - cmd.append(file_); - cmd.append(" *FILE "); - switch (lockToObtain) - { - case AS400File.READ_ALLOW_SHARED_READ_LOCK: - cmd.append("*SHRNUP "); - break; - case AS400File.READ_ALLOW_SHARED_WRITE_LOCK: - cmd.append("*SHRRD "); - break; - case AS400File.READ_EXCLUSIVE_LOCK: - case AS400File.WRITE_EXCLUSIVE_LOCK: - cmd.append("*EXCL "); - break; - case AS400File.WRITE_ALLOW_SHARED_READ_LOCK: - cmd.append("*EXCLRD "); - break; - case AS400File.WRITE_ALLOW_SHARED_WRITE_LOCK: - cmd.append("*SHRUPD "); - break; - default: - throw new InternalErrorException(InternalErrorException.UNKNOWN, lockToObtain); - } - cmd.append(member_); - cmd.append("))"); - AS400Message[] msgs = execute(cmd.toString()); //@B0C - if (msgs.length > 0 && msgs[0].getID() != null) - { - throw new AS400Exception(msgs); - } - - // Indicate which lock has been obtained - explicitLocksObtained_.addElement(l); - } - } - - - /** - *Opens the file. Helper function to open file for keyed or - *sequential files. - *@param openType - *@param bf blocking factor - *@param access The type of file access for which to open the file. - *@return the open feedback data - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public abstract DDMS38OpenFeedback openFile(int openType, int bf, String access) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - - //@B0A - need this for compatibility with the remote and native impls - public String[] openFile2(int openType, int blockingFactor, int commitLockLevel, String access) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - return openFile2(openType, blockingFactor, commitLockLevel, access.equals("key")); - } - - public String[] openFile2(int openType, int blockingFactor, int commitLockLevel, boolean access) //@B0C - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - commitLockLevel_ = (isCommitmentControlStarted() ? commitLockLevel : -1); - -/*@D0M // Set the blocking factor for the file - if (openType != AS400File.READ_WRITE) - { - // Calculate the blocking factor if 0 was specified - if (blockingFactor == 0) - { - blockingFactor_ = calculateBlockingFactor(); - } - else - { - blockingFactor_ = blockingFactor; - } - - // Estimate the record increment. - int recordIncrement = recordFormat_.getNewRecord().getRecordLength() + - recordFormat_.getNumberOfFields() + - recordFormat_.getNumberOfKeyFields() + 16; - - // We can only retrieve 16Mb of record data per GET so limit the - // blocking factor appropriately. - blockingFactor_ = (blockingFactor_ * recordIncrement >= 16777216 ? - 16777216 / recordIncrement : blockingFactor_); - } - else - { // For open type of READ_WRITE or if the file is a KeyedFile, blocking - // factor is set to 1 for data integrity - // reasons (read_write implies we are reading and updating and therefore - // want up-to-date data. - blockingFactor_ = 1; - } -*/ //@D0M - blockingFactor_ = blockingFactor; //@D0A - - // Determine if we are to cache records. - cacheRecords_ = (blockingFactor_ > 1); - - - // @A5A - // Set the record format CTLL name - if (!recordFormatName_.equals(recordFormat_.getName())) - { - recordFormatName_ = recordFormat_.getName(); - StringBuffer recordName = new StringBuffer(recordFormat_.getName()); - while (recordName.length() < 10) recordName.append(' '); - ConverterImplRemote c = ConverterImplRemote.getConverter(system_.getCcsid(), system_); //@B5C - recordFormatCTLLName_ = c.stringToByteArray(recordName.toString()); - } - - - // Open the file. - DDMS38OpenFeedback openFeedback = openFile(openType, blockingFactor_, access ? "key" : "seq"); //@B0C - access is true for KeyedFiles - - // Set the open type - openType_ = openType; - - String[] toReturn = new String[2]; //@B0A - - // If a special value was specified for library or member, set the actual name - // now. Note that the server returns the names blank padded to ten characters - // so we trim off any blanks. - if (library_.charAt(0) == '*') - { - library_ = openFeedback.getLibraryName().trim(); - toReturn[0] = library_; //@B0A - } - if (member_.equalsIgnoreCase("*FIRST") || member_.equalsIgnoreCase("*LAST")) - { - member_ = openFeedback.getMemberName().trim(); - toReturn[1] = member_; //@B0A - } - return toReturn; - } - - - /** - *Positions the file cursor to the first record whose record number - *matches the specified record number. The file must be open when invoking - *this method. - *@param recordNumber The record number of the record at which to position the - *cursor. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void positionCursor(int recordNumber) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // If caching, check if position is in the cache. If it is not, refresh the - // the cache and position appropriately. - if (cacheRecords_) - { - if (!cache_.setPosition(recordNumber)) - { - positionCursorToIndex(recordNumber); - } - } - else - { // Not caching - positionCursorToIndex(recordNumber); - } - } - - - /** - *Positions the file cursor to the first record meeting the specified search criteria - *based on key. The searchType indicates that the cursor should be - *positioned to the record whose key first meets the search criteria when compared - *to key. The file must be open when invoking this method. - *@param key The values that make up the key with which to find the record. - *The key must contain at least one element. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param searchType Constant indicating the type of match required. Valid values are: - *
      - *
    • KEY_EQ
      - *First record whose key is equal to key. - *
    • KEY_LT
      - *First record whose key is less than key. - *
    • KEY_LE
      - *First record whose key is less than or equal to key. - *
    • KEY_GT
      - *First record whose key is greater than key. - *
    • KEY_GE
      - *First record whose key is greater than or equal to key. - *
    - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void positionCursor(Object[] key, int searchType) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - positionCursorToKey(key, searchType); - // Invalidate the cache - if (cacheRecords_) - { - cache_.setIsEmpty(); - } - } - - - /** - *Positions the file cursor to the first record meeting the specified search criteria - *based on key. The searchType indicates that the cursor should be - *positioned to the record whose key first meets the search criteria when compared - *to key. The file must be open when invoking this method. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param searchType Constant indicating the type of match required. Valid values are: - *
      - *
    • KEY_EQ
      - *First record whose key is equal to key. - *
    • KEY_LT
      - *First record whose key is less than key. - *
    • KEY_LE
      - *First record whose key is less than or equal to key. - *
    • KEY_GT
      - *First record whose key is greater than key. - *
    • KEY_GE
      - *First record whose key is greater than or equal to key. - *
    - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void positionCursor(byte[] key, int searchType, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - positionCursorToKey(key, searchType, numberOfKeyFields); - // Invalidate the cache - if (cacheRecords_) - { - cache_.setIsEmpty(); - } - } - - - /** - *Positions the file cursor to the first record after the record specified - *by key. The file must be open when invoking this method. - *@param key The values which make up the key with which to find the record. - *The key must contain at least one element. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void positionCursorAfter(Object[] key) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Position the cursor to the record matching key - positionCursorToKey(key, KeyedFile.TYPE_TABLE[KeyedFile.KEY_EQ]); - if (cacheRecords_) - { // Invalidate the cache. This will cause it to be refreshed - // if we are caching and allow for cache access for any - // subsequent (to this method's invocation) sequential - // positioning or reading. - cache_.setIsEmpty(); - } - positionCursorToNext(); - } - - - /** - *Positions the file cursor to the first record after the record specified - *by key. The file must be open when invoking this method. - *@param key The byte array that contains the byte values which make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void positionCursorAfter(byte[] key, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Position the cursor to the record matching key - positionCursorToKey(key, KeyedFile.TYPE_TABLE[KeyedFile.KEY_EQ], numberOfKeyFields); - if (cacheRecords_) - { // Invalidate the cache. This will cause it to be refreshed - // if we are caching and allow for cache access for any - // subsequent (to this method's invocation) sequential - // positioning or reading. - cache_.setIsEmpty(); - } - positionCursorToNext(); - } - - - /** - *Positions the file cursor to after the last record. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public abstract void positionCursorAfterLast() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - - /** - *Positions the file cursor to the specified position (first, last, next, - *previous). - *@param type the type of position operation - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public abstract Record[] positionCursorAt(int type) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - - /** - *Positions the file cursor to the first record before the record specified - *by the record number. The file must be open when invoking - *this method. - *@param recordNumber The record number of the record before which to position - * the cursor. The recordNumber must be greater than zero. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void positionCursorBefore(int recordNumber) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (cacheRecords_) - { - if (cache_.setPosition(recordNumber)) - { - if (!cache_.isBeginningOfCache()) - { - cache_.setPositionPrevious(); - } - else - { // Record not in cache; position and refresh the cache - positionCursorToIndex(recordNumber); - positionCursorToPrevious(); - } - } - else - { // Not in cache; position and refresh the cache - positionCursorToIndex(recordNumber); - positionCursorToPrevious(); - } - } - else - { // Not caching - positionCursorToIndex(recordNumber); - positionCursorToPrevious(); - } - } - - - /** - *Positions the file cursor to the first record before the record specified - *by key. The file must be open when invoking this method. - *@param key The values which make up the key with which to find the record. - *The key must contain at least one element. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void positionCursorBefore(Object[] key) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Position the cursor to the record matching key - positionCursorToKey(key, KeyedFile.TYPE_TABLE[KeyedFile.KEY_EQ]); - if (cacheRecords_) - { // Invalidate the cache. This will cause it to be refreshed - // if we are caching and allow for cache access for any - // subsequent (to this method's invocation) sequential - // positioning or reading. - cache_.setIsEmpty(); - } - try //@CRS - { //@CRS - // Call super's positionCursorToPrevious to get to the record - // immediately following the matching record - positionCursorToPrevious(); - } //@CRS - catch(AS400Exception e) //@CRS - { //@CRS - if (Trace.traceOn_) Trace.log(Trace.WARNING, "KeyedFile - Possible attempt to position by key before first record. Manually positioning cursor.", e); //@CRS - if (e.getAS400Message().getID().equalsIgnoreCase("CPF5001")) //@CRS - { - //@CRS - Probably tried to position before first record. - positionCursorBeforeFirst(); //@CRS - } //@CRS - else //@CRS - { //@CRS - throw e; //@CRS - } //@CRS - } //@CRS - } - - - /** - *Positions the file cursor to the first record before the record specified - *by key. The file must be open when invoking this method. - *@param key The byte array that contains the byte values which make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void positionCursorBefore(byte[] key, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Position the cursor to the record matching key - positionCursorToKey(key, KeyedFile.TYPE_TABLE[KeyedFile.KEY_EQ], numberOfKeyFields); - if (cacheRecords_) - { // Invalidate the cache. This will cause it to be refreshed - // if we are caching and allow for cache access for any - // subsequent (to this method's invocation) sequential - // positioning or reading. - cache_.setIsEmpty(); - } - try //@CRS - { //@CRS - // Call super's positionCursorToPrevious to get to the record - // immediately following the matching record - positionCursorToPrevious(); - } //@CRS - catch(AS400Exception e) //@CRS - { //@CRS - if (Trace.traceOn_) Trace.log(Trace.WARNING, "KeyedFile - Possible attempt to position by key before first record. Manually positioning cursor.", e); //@CRS - if (e.getAS400Message().getID().equalsIgnoreCase("CPF5001")) //@CRS - { - //@CRS - Probably tried to position before first record. - positionCursorBeforeFirst(); //@CRS - } //@CRS - else //@CRS - { //@CRS - throw e; //@CRS - } //@CRS - } //@CRS - } - - - /** - *Positions the file cursor to before the first record. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public abstract void positionCursorBeforeFirst() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - - /** - *Positions the cursor to the first record. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void positionCursorToFirst() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // If we are caching records and the cache contains the first record, - // position the cache. Otherwise, position the file and refresh the - // cache if we are caching records. - if (cacheRecords_ && cache_.containsFirstRecord()) - { - cache_.setPositionFirst(); - } - else - { - if (cacheRecords_) - { - cache_.setIsEmpty(); - } - positionCursorAt(TYPE_GET_FIRST); - } - } - - - /** - *Positions the cursor to the record at the specified file position. - *@parm index the file position - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public abstract Record positionCursorToIndex(int index) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - /** - *Positions the cursor to the first record in the file that matches the - *specified key. - *@param key the key - *@param searchType the way to compare keys - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public abstract Record positionCursorToKey(Object[] key, - int searchType) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - - // @A2A - /** - *Positions the cursor to the first record in the file that matches the - *specified key. - *@param key the byte array that contains the byte values of the key - *@param searchType the way to compare keys - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public abstract Record positionCursorToKey(byte[] key, - int searchType, int numberOfKeyFields) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - - - /** - *Positions the cursor to the last record in the file. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void positionCursorToLast() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // If we are caching records and the cache contains the first record, - // position the cache. Otherwise, position the file and refresh the - // cache if we are caching records. - if (cacheRecords_ && cache_.containsLastRecord()) - { - cache_.setPositionLast(); - } - else - { - if (cacheRecords_) - { - cache_.setIsEmpty(); - } - positionCursorAt(TYPE_GET_LAST); - } - } - - /** - *Positions the cursor to the next record in the file. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void positionCursorToNext() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // Check if we are caching. If we are and we are not at the end of the cache, - // just position ourselves within the cache, otherwise position ourselves in the file - // and refresh the cache. - if (cacheRecords_) - { - if (cache_.isEmpty() || (cache_.isEndOfCache() && cache_.currentDirection_ == DDMRecordCache.FORWARD)) - { - cache_.refresh(positionCursorAt(TYPE_GET_NEXT), DDMRecordCache.FORWARD, false, false); - } - else if (cache_.isEndOfCache() && cache_.currentDirection_ != DDMRecordCache.FORWARD) - { - refreshCache(null, DDMRecordCache.FORWARD, false, false); - } - else - { - if (Trace.isTraceOn()) - { - Trace.log(Trace.INFORMATION, "positionCursorToNext: positioning in cache."); - } - cache_.setPositionNext(); - } - } - else - { // Not caching; just position ourselves in the file - positionCursorAt(TYPE_GET_NEXT); - } - } - - /** - *Positions the cursor to the previous record in the file. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void positionCursorToPrevious() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // Check if we are caching. If we are and we are not at the end of the cache, - // just position ourselves within the cache, otherwise position ourselves in the file - // and refresh the cache. - if (cacheRecords_) - { - if (cache_.isEmpty() || (cache_.isBeginningOfCache() && cache_.currentDirection_ == DDMRecordCache.BACKWARD)) - { - cache_.refresh(positionCursorAt(TYPE_GET_PREV), DDMRecordCache.BACKWARD, false, false); - } - else if (cache_.isBeginningOfCache() && cache_.currentDirection_ != DDMRecordCache.BACKWARD) - { - refreshCache(null, DDMRecordCache.BACKWARD, false, false); - } - else - { - if (Trace.isTraceOn()) - { - Trace.log(Trace.INFORMATION, "positionCursorToPrev: positioning in cache."); - } - cache_.setPositionPrevious(); - } - } - else - { // Not caching; just position ourselves in the file - positionCursorAt(TYPE_GET_PREV); - } - } - - /** - Reads the record at the current file position. - @return the record read. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record read() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // If we are caching, get the current record at which we are pointing. If we are - // not positioned on record in the cache we are not positioned on a record in the - // file either. In order to get the correct error information thrown, we call - // readRecord() to read from the file and throw the exception. - Record r = null; - if (cacheRecords_) - { - r = cache_.getCurrent(); - } - if (r == null) - { - r = readRecord(TYPE_GET_SAME); - } - - return r; - } - - /** - Reads the record at the specified file position. - @param recordNumber the file position - @return the record read. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record read(int recordNumber) //@B0C -- this is overridden in the subclasses - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { -//@B0D if (cacheRecords_) -//@B0D { - Record r = cache_.getRecord(recordNumber); - if (r == null) - { // Record is not in cache; read it from the file and refresh - try - { - // Position to the record and refresh the cache - r = positionCursorToIndex(recordNumber); - refreshCache(null, DDMRecordCache.FORWARD, false, false); - // Add the current record to the cache at the beginning - cache_.add(r, false); - cache_.setPositionFirst(); - } - catch (AS400Exception e) - { // If we get CPF5001 or CPF5006 (end of file or record not found) - // from the position operation we want to return null in order - // to mimic what we do when we are not caching. - String id = e.getAS400Message().getID(); - if (id.equals("CPF5001") || id.equals("CPF5006")) - { - return null; - } - else - { - throw e; - } - } - } - return r; -//@B0D } -//@B0D else -//@B0D { -//@B0D return read(recordNumber); -//@B0D } - } - - /** - *Reads the first record with the specified key based on the specified search type. - *@param key The values that make up the key with which to find the record. - *@param type The type of read. This value is one of the TYPE_GETKEY_* constants. - *@return The record read. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public abstract Record read(Object[] key, - int searchType) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - - // @A2A - /** - *Reads the first record with the specified key based on the specified search type. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *@param type The type of read. This value is one of the TYPE_GETKEY_* constants. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@return The record read. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public abstract Record read(byte[] key, - int searchType, int numberOfKeyFields) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - -/* Record read2(byte[] key, - int searchType, int numberOfKeyFields) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // Determine the type of get - Record r = read(key, KeyedFile.TYPE_TABLE[searchType], numberOfKeyFields); - if (cacheRecords_) - { - cache_.setIsEmpty(); - } - return r; - } -*/ - - /** - *Reads the first record after the record with the specified record number. - *The file must be open when invoking this method. - *@param recordNumber record number of the record prior to the record to be read. - *The recordNumber must be greater than zero. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readAfter(int recordNumber) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (cacheRecords_) - { - // Check for record in the cache - if (cache_.setPosition(recordNumber)) - { // Record recordNumber is here; are we at the end of the cache? - if (!cache_.isEndOfCache()) - { // Next record in cache is the one we want - return cache_.getNext(); - } - else - { // We need to go to the file to get the record - // Don't need to bother to invalidate the cache as we are at - // the end of the cache and readNext will check that - // and refresh. - positionCursorToIndex(recordNumber); - return readNext(); - } - } - else - { // We need to go to the file to get the record - // Invalidate the cache. - cache_.setIsEmpty(); - positionCursorToIndex(recordNumber); - return readNext(); - } - } - else - { // Position the cursor and call super's readNext() - positionCursorToIndex(recordNumber); - return readNext(); - } - } - - - /** - *Reads the first record after the record with the specified key. The file must - *be open when invoking this method. - *@param key The values that make up the key with which to find the record. - *The key must contain at least one element. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readAfter(Object[] key) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - positionCursorToKey(key, KeyedFile.TYPE_TABLE[KeyedFile.KEY_EQ]); - if (cacheRecords_) - { - cache_.setIsEmpty(); - } - return readNext(); - } - - - /** - *Reads the first record after the record with the specified key. The file must - *be open when invoking this method. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readAfter(byte[] key, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - positionCursorToKey(key, KeyedFile.TYPE_TABLE[KeyedFile.KEY_EQ], numberOfKeyFields); - if (cacheRecords_) - { - cache_.setIsEmpty(); - } - return readNext(); - } - - - /** - *Reads all the records in the file. - *@param fileType The type of file. Valid values are: key or seq - *@return The records read. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public abstract Record[] readAll(String fileType, int bf) //@D0C - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - /** - *Reads the first record before the record with the specified record number. - *The file must be open when invoking this method. - *@param recordNumber The record number of the record after the record to be read. - *The recordNumber must be greater than zero. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readBefore(int recordNumber) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (cacheRecords_) - { - // Check for record in the cache - if (cache_.setPosition(recordNumber)) - { // Record recordNumber is here; are we at the beginning of the cache? - if (!cache_.isBeginningOfCache()) - { // Next record in cache is the one we want - return cache_.getPrevious(); - } - else - { // We need to go to the file to get the record - // Don't need to bother to invalidate the cache as we are at - // the beginning of the cache and readPrevious will check that - // and refresh. - positionCursorToIndex(recordNumber); - return readPrevious(); - } - } - else - { // We need to go to the file to get the record - // Invalidate the cache. - cache_.setIsEmpty(); - positionCursorToIndex(recordNumber); - return readPrevious(); - } - } - else - { // Position the cursor and call super's readPrevious() - positionCursorToIndex(recordNumber); - return readPrevious(); - } - } - - - /** - *Reads the first record before the record with the specified key. The file must - *be open when invoking this method. - *@param key The values that make up the key with which to find the record. - *The key must contain at least one element. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readBefore(Object[] key) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - positionCursorToKey(key, KeyedFile.TYPE_TABLE[KeyedFile.KEY_EQ]); - if (cacheRecords_) - { - cache_.setIsEmpty(); - } - return readPrevious(); - } - - - /** - *Reads the first record before the record with the specified key. The file must - *be open when invoking this method. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readBefore(byte[] key, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - positionCursorToKey(key, KeyedFile.TYPE_TABLE[KeyedFile.KEY_EQ], numberOfKeyFields); - if (cacheRecords_) - { - cache_.setIsEmpty(); - } - return readPrevious(); - } - - - /** - *Reads the first record from the file. - *@return the first record. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readFirst() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // If we are caching, check the cache for the record. IF not found refresh the - // cache. - if (cacheRecords_) - { - if (cache_.containsFirstRecord()) - { - return cache_.getFirst(); - } - else //@A4A: Invalidate the cache since we will be going to the system - { - // Invalidate the cache - cache_.setIsEmpty(); - } - } - - // Not caching, read from the file. - return readRecord(TYPE_GET_FIRST); - } - - /** - *Reads the last record from the file. - *@return the first record. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readLast() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // If we are caching, check the cache for the record. IF not found refresh the - // cache. - if (cacheRecords_) - { - if (cache_.containsLastRecord()) - { - return cache_.getLast(); - } - else //@A4A: Invalidate the cache since we will be going to the system - { - // Invalidate the cache - cache_.setIsEmpty(); - } - } - - // Not caching, read from the file. - return readRecord(TYPE_GET_LAST); - } - - /** - *Reads the next record from the file. - *@return the first record. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readNext() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - Record r = null; - // If we are caching, check the cache for the record. IF not found refresh the - // cache. - if (cacheRecords_) - { - r = cache_.getNext(); - if (r == null) - { - if (Trace.isTraceOn()) - { - Trace.log(Trace.INFORMATION, "AS400FileImplBase.readNext(): cache_.getNext() returned null."); - } - refreshCache(null, DDMRecordCache.FORWARD, false, false); - return cache_.getCurrent(); - } - else - { - return r; - } - } - - // Not caching, read from the file. - return readRecord(TYPE_GET_NEXT); - } - - /** - *Reads the next record whose key matches the full key of the current record. - *The file must be open when invoking this method. The file must be - *positioned on an active record when invoking this method. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readNextEqual() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - Object[] key; - if (cacheRecords_) - { - if (!cache_.isEmpty()) - { - Record r = null; - Record current = cache_.getCurrent(); - if (current != null) - { - key = current.getKeyFields(); - try - { - //@B4C - when reading, get out early by checking comparison - r = readNext(); - int match = UNKNOWN; - if (r != null) match = compareKeys(key, r.getKeyFields()); - while (r != null && (match == GREATER_THAN || match == UNKNOWN)) - { - r = readNext(); - if (r != null) match = compareKeys(key, r.getKeyFields()); - } - if (match != EQUAL) r = null; - //@B4C - end change - } - catch (AS400Exception e) - { - if (e.getAS400Message().getID().equals("CPF5025")) - { - return null; - } - else - { - throw e; - } - } - return r; - } - } - } - key = recordFormat_.getNewRecord().getKeyFields(); - return read(key, 0x0E); - } - - - /** - *Reads the next record whose key matches the specified key. The search does - *not include the current record. The key may be a partial key. - *The file must be open when invoking this method. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readNextEqual(Object[] key) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - Record r = null; - try - { - //@B4C - when reading, get out early by checking comparison - r = readNext(); - int match = UNKNOWN; - if (r != null) match = compareKeys(key, r.getKeyFields()); - while (r != null && (match == GREATER_THAN || match == UNKNOWN)) - { - r = readNext(); - if (r != null) match = compareKeys(key, r.getKeyFields()); - } - if (match != EQUAL) r = null; - //@B4C - end change - } - catch (AS400Exception e) - { - if (e.getAS400Message().getID().equals("CPF5025")) - { - return null; - } - else - { - throw e; - } - } - return r; - } - - - /** - *Reads the next record whose key matches the specified key. The search does - *not include the current record. The key may be a partial key. - *The file must be open when invoking this method. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readNextEqual(byte[] key, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - Record r = null; - try - { - //@B4C - when reading, get out early by checking comparison - r = readNext(); - int match = UNKNOWN; - if (r != null) match = compareKeys(key, r.getKeyFieldsAsBytes(), numberOfKeyFields); - while (r != null && (match == GREATER_THAN || match == UNKNOWN)) - { - r = readNext(); - if (r != null) match = compareKeys(key, r.getKeyFieldsAsBytes(), numberOfKeyFields); - } - if (match != EQUAL) r = null; - //@B4C - end change - } - catch (AS400Exception e) - { - if (e.getAS400Message().getID().equals("CPF5025")) - { - return null; - } - else - { - throw e; - } - } - return r; - } - - - /** - *Reads the previous record from the file. - *@return the first record. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readPrevious() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // If we are caching, check the cache for the record. IF not found refresh the - // cache. - Record r = null; - if (cacheRecords_) - { - r = cache_.getPrevious(); - if (r == null) - { - if (Trace.isTraceOn()) - { - Trace.log(Trace.INFORMATION, "AS400FileImplBase.readPrevious(): cache returned null."); - } - refreshCache(null, DDMRecordCache.BACKWARD, false, false); - return cache_.getCurrent(); - } - else - { - return r; - } - } - - // Not caching, read from the file. - return readRecord(TYPE_GET_PREV); - } - - /** - *Reads the previous record whose key matches the key of the current record. - * The file must be open when invoking this method. The file must be - *positioned on an active record when invoking this method. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readPreviousEqual() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - Object[] key; - Record r; - if (cacheRecords_) - { - if (!cache_.isEmpty()) - { - Record current = cache_.getCurrent(); - if (current != null) - { - key = current.getKeyFields(); - try - { - //@B4C - when reading, get out early by checking comparison - r = readPrevious(); - int match = UNKNOWN; - if (r != null) match = compareKeys(key, r.getKeyFields()); - while (r != null && (match == LESS_THAN || match == UNKNOWN)) - { - r = readPrevious(); - if (r != null) match = compareKeys(key, r.getKeyFields()); - } - if (match != EQUAL) r = null; - //@B4C - end change - } - catch (AS400Exception e) - { - if (e.getAS400Message().getID().equals("CPF5025")) - { - return null; - } - else - { - throw e; - } - } - return r; - } - } - } - key = recordFormat_.getNewRecord().getKeyFields(); - return read(key, 0x0F); - } - - - /** - *Reads the previous record whose key matches the specified key. The search does - *not include the current record. The key may be a partial key. - *The file must be open when invoking this method. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readPreviousEqual(Object[] key) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - Record r = null; - try - { - //@B4C - when reading, get out early by checking comparison - r = readPrevious(); - int match = UNKNOWN; - if (r != null) match = compareKeys(key, r.getKeyFields()); - while (r != null && (match == LESS_THAN || match == UNKNOWN)) - { - r = readPrevious(); - if (r != null) match = compareKeys(key, r.getKeyFields()); - } - if (match != EQUAL) r = null; - //@B4C - end change - } - catch (AS400Exception e) - { - if (e.getAS400Message().getID().equals("CPF5025")) - { - return null; - } - else - { - throw e; - } - } - return r; - } - - - /** - *Reads the previous record whose key matches the specified key. The search does - *not include the current record. The key may be a partial key. - *The file must be open when invoking this method. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readPreviousEqual(byte[] key, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - Record r = null; - try - { - //@B4C - when reading, get out early by checking comparison - r = readPrevious(); - int match = UNKNOWN; - if (r != null) match = compareKeys(key, r.getKeyFieldsAsBytes(), numberOfKeyFields); - while (r != null && (match == LESS_THAN || match == UNKNOWN)) - { - r = readPrevious(); - if (r != null) match = compareKeys(key, r.getKeyFieldsAsBytes(), numberOfKeyFields); - } - if (match != EQUAL) r = null; - //@B4C - end change - } - catch (AS400Exception e) - { - if (e.getAS400Message().getID().equals("CPF5025")) - { - return null; - } - else - { - throw e; - } - } - return r; - } - - - /** - Reads the record at the current file position. - *@param type type of read (first, last, next, previous) - @return the record read. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public abstract Record readRecord(int type) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - - /** - *Reads records from the file. The next or previous 'blockingFactor_' - *records are retrieved depending on the direction specified. - *@param direction (DDMRecordCache.FORWARD or DDMRecordCache.BACKWARD) - *@return the records read - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public abstract Record[] readRecords(int direction) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - - /** - *Refreshes the record cache for this file object. Depending on the direction - *specified, a readNext() (direction = FORWARD) or readPrevious() - *(direction = BACKWARD) will be specified on the S38GETM (get multiple records). - *@param records The records with which to refresh the cache. If records - *is null, the records will be retrieved via impl.readRecords(). - *@param direction The direction in which to search the cache for records. - *@param containsFirstRecord Indicates if the first record will be contained in the - *cache after the getm. - *@param containsLastRecord Indicates if the last record will be contained in the - *cache after the getm. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void refreshCache(Record[] records, int direction, boolean containsFirstRecord, boolean containsLastRecord) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Fill the cache. If null was returned, the cache will set itself to empty. - if (Trace.isTraceOn()) - { - Trace.log(Trace.INFORMATION, "AS400FileImplBase.refreshCache: refreshing cache," + String.valueOf(direction)); - } - Record r = null; - if ((cache_.currentDirection_ == direction || cache_.isEmpty())) - { - // Invalidate the cache in case an exception occurs - cache_.setIsEmpty(); - // We refresh if we are going in the same direction - if (records == null) - { - // Read records. We don't need to create the implementation because - // this method is only called by code that ensures that this object is - // already open. - records = readRecords(direction); - } - if (Trace.isTraceOn()) - { - Trace.log(Trace.INFORMATION, "AS400FileImplBase.refreshCache(): cursors in synch."); - } - cache_.refresh(records, direction, containsFirstRecord, - containsLastRecord); - } - else - { - // The host cursor and cache cursor are out of synch - need to re-synch - // If we are a SequentialFile, we will simply position by record number of - // the record we are currently at in the cache to correctly position - // ourselves. If we are a KeyedFile, we need to position by key to - // the record whose key matched the key of the record we are currently - // at in the cache. Then we compare the record number. This is in case - // the file has duplicate keys. If the record number does not match, - // we do a readNext() and compare, etc. - - //@G0: Always position by record number. - // The code path for positioning by key was causing a performance hit - // and seems to be superfluous. - int recordNumber = (cache_.getCurrent() == null)? cache_.getNext().getRecordNumber() : cache_.getCurrent().getRecordNumber(); - if (Trace.isTraceOn()) - { - Trace.log(Trace.INFORMATION, "AS400FileImplBase.refreshCache(): cursors not in synch."); - } - //@G0D if (!isKeyed_) //@B0C: Must be instance of SequentialFile - //@G0D { - // Invalidate the cache in case an exception occurs - cache_.setIsEmpty(); - positionCursor(recordNumber); - /*@G0D } - else - { - Object[] key = (cache_.getCurrent() == null)? cache_.getNext().getKeyFields() : cache_.getCurrent().getKeyFields(); - r = read(key, KeyedFile.TYPE_TABLE[KeyedFile.KEY_EQ]); //@B0C - // Turn of caching so that we can position in the file - cacheRecords_ = false; - // Invalidte the cache in the event of an exception - cache_.setIsEmpty(); - while (r != null && r.getRecordNumber() != recordNumber) - { - try - { - r = readNextEqual(); - } - catch(AS400Exception e) - { - cacheRecords_ = true; - throw e; - } - catch(AS400SecurityException e) - { - cacheRecords_ = true; - throw e; - } - catch(IOException e) - { - cacheRecords_ = true; - throw e; - } - catch(InterruptedException e) - { - cacheRecords_ = true; - throw e; - } - } - cacheRecords_ = true; - } - */ //@G0D - - if (records == null) - { - // Read records. We don't need to create the implementation because - // this method is only called by code that ensures that this object is - // already open. - records = readRecords(direction); - } - // Now we can refresh the cache - cache_.refresh(records, direction, containsFirstRecord, - containsLastRecord); - } - } - - - /** - *Refreshes the record cache for this file. Invoking this method will cause the - *retrieval of records from the server. The cursor position is set to the - *first record of the file. This method only needs to - *be invoked if a blocking factor greater than 1 is being used, and the user - *wants to refresh the records in the cache. The file must be open when invoking - *this method. No action is taken if records are not being cached (for example, the - *blocking factor is set to one). - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void refreshRecordCache() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // If we are caching, refresh the cache with records starting from the beginning - // of the file. - if (cacheRecords_) - { - positionCursorBeforeFirst(); - // Set cache direction to FORWARD - cache_.currentDirection_ = DDMRecordCache.FORWARD; - refreshCache(null, DDMRecordCache.FORWARD, true, false); - } - } - - - /** - *Rolls back any transactions since the last commit/rollback boundary. Invoking this - *method will cause all transactions under commitment control for this connection - *to be rolled back. This means that any AS400File object for which a commit - *lock level was specified and that was opened under this connection will have - *outstanding transactions rolled back. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public abstract void rollback() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - - //@E2A - // This method should be static, but we can't make a static call to - // a native method (the call to execute()) so we just set all of the - // necessary state variables and act like we're a normal object. - public void rollback(AS400Impl system) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - if (isCommitmentControlStarted(system)) - { - // Setup state variables - setSystem(system); - setConverter(); - - rollback(); - } - } - - - /** - *Updates the record at the current cursor position. The cursor must be positioned to an active record. The - *last operation on the file must have been a cursor positioning operation or a - *read operation. If an attempt is made to update a record more than once without - *reading the record or positioning the cursor to the record in between updates, an - *AS400Exception is thrown. The cursor position is not changed when this method - *is invoked. - *@param record The record with which to update. The record must be a record whose - *format matches the record format of this object. To ensure that this - *requirement is met, use the - *RecordFormat.getNewRecord() - *method to obtain a default record whose fields can be set appropriately by - *the Java program and then written to the file. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public abstract void update(Record record) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - - /** - *Writes an array of records to the end of the file. - *The cursor is positioned to after the last record of the file as a - *result of invoking this method. - *@param records The records to write. The records must have a format - *which matches the record format of this object. To ensure that this - *requirement is met, use the - *RecordFormat.getNewRecord() - *method to obtain default records whose fields can be set appropriately - *by the Java program and then written to the file. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the - *server. - **/ - public abstract void write(Record[] records) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException; - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400FileImplNative.java b/cvsroot/src/com/ibm/as400/access/AS400FileImplNative.java deleted file mode 100644 index 8e99579aa..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400FileImplNative.java +++ /dev/null @@ -1,2434 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400FileImplNative.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// -// @A3 - 10/30/2007 - The NULL Field Byte Map array must be set based on the -// maximum number of fields for any format in a given file. Refer to -// more detailed explanation for related changes in -// DDMObjectDataStream.java (@A1) -// There is also a related change in AS400FileImplRemote.java -// -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; //@C1A -import java.util.Vector; //@C1A - -//@C0C: We now extend AS400FileImplBase. -class AS400FileImplNative extends AS400FileImplBase -{ - private static final String CLASSNAME = "com.ibm.as400.access.AS400FileImplNative"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - // File handle. - transient int handle_; - // Static synchronization variable for command execution - static String synch_execute_ = ""; - // Static synchronization variable for open/close of files. - // The qyjsprl.C smalltalk C module keeps track of the handles allocated - // and freed for files globally. Therefore we synchronize opens and closes - // at the class level for processes using RLA - static String synch_open_close_ = ""; - - static - { - NativeMethods.loadNativeLibraryQyjspart(); - - try - { - resetStaticStorage(); //@E3A - } - catch(Throwable t) //@E3A In case they don't have the new service program change to match. - { - if (Trace.isTraceOn() && Trace.isTraceWarningOn()) //@E3A - { - Trace.log(Trace.WARNING, "Exception occurred while resetting static storage for DDM: ", t); //@E3A - } - } - } - - //@C1A - Need this for the new createDDSSourceFile() method. - public AS400FileImplNative() - { - isNative_ = true; //@E2A - } - - /** - *Closes the file on the server. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the - *server. - **/ - public void close() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - super.close(); //@C0A - - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - synchronized(synch_open_close_) - { - // Close the file. - closeNtv(handle_); - } - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - } - - /** - *Closes the file on the server. - *@param handle the file handle. - *@return the message feedback data - **/ - native void closeNtv(int handle) - throws NativeException; - - /** - *Commits all transactions since the last commit boundary. Invoking this - *method will cause all transactions under commitment control for this - *connection to be committed. This means that any AS400File object opened - *under this connection, for which a commit lock level was specified, will - *have outstanding transactions committed. If commitment control has not been - *started for the connection, no action is taken.
    - *The server to which to connect must be set prior to invoking this - *method. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the - *server. - **/ - public void commit() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - // Commit transactions under commitment control. - commitNtv(); - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - } - - /** - *Commits all transactions since the last commit boundary. Invoking this - *method will cause all transactions under commitment control for this - *connection to be committed. This means that any AS400File object opened - *under this connection, for which a commit lock level was specified, will - *have outstanding transactions committed. If commitment control has not been - *started for the connection, no action is taken.
    - *The server to which to connect must be set prior to invoking this - *method. - **/ - native void commitNtv() - throws NativeException; - - - //@C1M 7/16/99 - Moved this code out of ImplBase to here - /** - *Creates the DDS source file to be used to create a physical file based on a user - *supplied RecordFormat.
    - *The name of the file and the server to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@param recordFormat The record format to describe in the DDS source file. - *@param altSeq The value to be specified for the file-level keyword ALTSEQ. If no - *value is to be specified, null may be specified. - *@param ccsid The value to be specified for the file-level keyword CCSID. If no - *value is to be specified, null may be specified. - *@param order The value to be specified to indicate in which order records are to be - *retrieved from the file. Valid values are one of the following file-level keywords: - *
      - *
    • FIFO - First in, first out - *
    • LIFO - Last in, first out - *
    • FCFO - First changed, first out - *
    - *If no ordering value is to be specified, null may be specified. - *@param ref The value to be specified for the file-level keyword REF. If no - *value is to be specified, null may be specified. - *@param unique Indicates if the file-level keyword UNIQUE is to be specified. True - *indicates that the UNIQUE keyword should be specified; false indicates that it - *should not be specified. - *@param format The value to be specified for the record-level keyword FORMAT. If no - *value is to be specified, null may be specified. - *@param text The value to be specified for the record-level keyword TEXT. If no - *value is to be specified, null may be specified. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - **/ - public synchronized void createDDSSourceFile(RecordFormat recordFormat, - String altSeq, - String ccsid, - String order, - String ref, - boolean unique, - String format, - String text) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // Create the source physical file to hold the DDS source. Note that we create the - // file in library QTEMP. Each server job has its own QTEMP library which is created - // when the job starts and is deleted when the job ends. Using QTEMP allows - // the file to be created regardless of the user's authority and also eliminates - // name collision problems when different jobs are creating files from a record - // format. - AS400Message[] msgs = execute("QSYS/CRTSRCPF FILE(QTEMP/JT400DSSRC) MBR(*FILE) TEXT('JT400 TEMPORARY DDS SOURCE FILE')"); //@B0C - if (msgs.length > 0) - { - if (msgs[0].getID().equals("CPF5813")) - { - // File already exists from a previous create; clear it. - msgs = execute("QSYS/CLRPFM QTEMP/JT400DSSRC"); //@B0C - if (msgs.length > 0) - { - if (!msgs[0].getID().equals("CPC3101")) // "member cleared" - { - // Clear failed. Throw exception. - Trace.log(Trace.ERROR, "QSYS/CLRPFM QTEMP/JT400DSSRC"); - throw new AS400Exception(msgs); - } - } - else - { - Trace.log(Trace.ERROR, "No messages were returned from QSYS/CLRPFM QTEMP/JT400DSSRC"); - throw new InternalErrorException("QTEMP/JT400DSSRC", InternalErrorException.UNKNOWN); - } - } - else if (!msgs[0].getID().equals("CPC7301")) - { - // File does not exist and we were unable to create; throw exception - // (CPC7301 = Successful create) - Trace.log(Trace.ERROR, "QSYS/CRTSRCPF FILE(QTEMP/JT400DSSRC) MBR(*FILE) TEXT('JT400 TEMPORARY DDS SOURCE FILE')"); - throw new AS400Exception(msgs); - } - } - else - { - // No messages. This shouldn't happen. - Trace.log(Trace.ERROR, "No messages from server."); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - - ///////////////////////////////////////////////////////////////////////////////// - // Create the records to be written to the file. These records will contain the - // DDS based on the supplied RecordFormat object. - ///////////////////////////////////////////////////////////////////////////////// - // Create a RecordFormat object which describes the record format of a source - // physical file. - RecordFormat srcRF = new RecordFormat("JT400DSSRC"); - srcRF.addFieldDescription(new ZonedDecimalFieldDescription(new AS400ZonedDecimal(6, 2), "SRCSEQ")); - srcRF.addFieldDescription(new ZonedDecimalFieldDescription(new AS400ZonedDecimal(6, 0), "SRCDAT")); - //@C2 - This is how it should be done, but it will work the deprecated way because - // we are running on the 400. - //@C2 AS400Text text80 = new AS400Text(80, system_.getCcsid(), system_); //@C2A - //@C2 if (converter_ == null) setConverter(); //@C2A - //@C2 text80.setConverter(converter_); //@C2A - srcRF.addFieldDescription(new CharacterFieldDescription(new AS400Text(80, system_.getCcsid()), "SRCDTA")); - Vector lines = new Vector(); // Contains DDS lines to write to source file - String line; // A single line of DDS source - // Create line(s) for any file level keywords - file level keywords must precede - // the line specifying the record format name. - if (altSeq != null) - { - line = STR44 + "ALTSEQ(" + altSeq + ")"; - lines.addElement(line); - } - if (ccsid != null) - { - line = STR44 + "CCSID(" + ccsid + ")"; - lines.addElement(line); - } - if (order != null) - { - line = STR44 + order; - lines.addElement(line); - } - if (ref != null) - { - line = STR44 + "REF(" + ref + ")"; - lines.addElement(line); - } - if (unique) - { - line = STR44 + "UNIQUE"; - lines.addElement(line); - } - - // Create line for the record format name - line = STR16 + "R "; - // The record format name cannot exceed 10 characters and must be in upper case - if (recordFormat.getName().length() > 10) - { - if (Trace.isTraceOn() && Trace.isTraceWarningOn()) - { - Trace.log(Trace.WARNING, "Record format name '"+recordFormat.getName()+"' too long. Using '"+recordFormat.getName().substring(0,10)+"' instead."); - } - line += recordFormat.getName().substring(0, 10); - } - else - { - line += recordFormat.getName(); - } - lines.addElement(line); - - // Create line(s) for any record level keywords. The record level keywords - // must be on the same line or on the lines immediately following the record - // format line. - if (format != null) - { - line = STR44 + "FORMAT(" + format + ")"; - lines.addElement(line); - } - if (text != null) - { - if (text.length() > 32) - { // Text exceeds length left on line - need to continue on next line - line = STR44 + "TEXT('" + text.substring(0, 33) + "-"; - lines.addElement(line); - // Add the remainder of the TEXT keyword - line = STR44 + text.substring(34) + "')"; - lines.addElement(line); - } - else - { // Text fits on one line - line = STR44 + "TEXT('" + text + "')"; - lines.addElement(line); - } - } - - // Create lines for each field description and any keywords for the field - int numberOfFields = recordFormat.getNumberOfFields(); - FieldDescription f = null; - String ddsDesc; - String[] dds = null; - int length; - int beginningOffset; - for (int i = 0; i < numberOfFields; ++i) - { - f = recordFormat.getFieldDescription(i); - // Specify the DDS description of the field. The DDS description returned - // from FieldDescription contains the field level keywords as well as the - // description of the field. It is formatted properly for DDS except for - // the preceding blanks. Therefore, we add 18 blanks so that the field - // description starts in column 19 of the line. - dds = f.getDDSDescription(); - // Add the fixed portion of the DDS description for the field to the vector - ddsDesc = STR18 + dds[0]; - lines.addElement(ddsDesc); - // Add lines containing field level keywords - for (int j = 1; j < dds.length; ++j) - { - ddsDesc = STR44 + dds[j]; - length = ddsDesc.length(); - beginningOffset = 0; - if (length > 80) - { // Need to continue the line on the next line - line = ddsDesc.substring(beginningOffset, 79) + "-"; - lines.addElement(line); - length -= 79; - beginningOffset = 79; - line = STR44 + ddsDesc.substring(beginningOffset); - lines.addElement(line); - } - else - { // It all fits on one line - lines.addElement(ddsDesc); - } - } - } - // Create lines for key fields and key field level keywords - numberOfFields = recordFormat.getNumberOfKeyFields(); - for (int i = 0; i < numberOfFields; ++i) - { - f = recordFormat.getKeyFieldDescription(i); - // Specify the name of the field - line = STR16 + "K "; - line += f.getDDSName(); - lines.addElement(line); - // Specify any key field level keywords - String[] keyFuncs = f.getKeyFieldFunctions(); - if (keyFuncs != null) - { - for (short j = 0; j < keyFuncs.length; ++j) - { - line = STR44 + keyFuncs[j]; - lines.addElement(line); - } - } - } - - // Create an array of records representing each line to be written - // to the file. - Record[] records = new Record[lines.size()]; - for (int i = 0; i < records.length; ++i) - { - records[i] = srcRF.getNewRecord(); - records[i].setField("SRCSEQ", new BigDecimal(i)); - - records[i].setField("SRCDAT", new BigDecimal(i)); - records[i].setField("SRCDTA", lines.elementAt(i)); - } - - // Open the DDS source file and write the records. We will write all the records - // at one time, so we specify a blocking factor of records.length on the open(). - - //@C1 - This is why we had to move this code out of the ImplBase, so we can instantiate. - AS400FileImplNative src = null; - try - { - src = new AS400FileImplNative(); - src.setAll(system_, "/QSYS.LIB/QTEMP.LIB/JT400DSSRC.FILE", srcRF, false, false, false); - - src.openFile2(AS400File.WRITE_ONLY, records.length, AS400File.COMMIT_LOCK_LEVEL_NONE, false); - src.write(records); - // Close the file - src.close(); - } - catch(Exception e) - { // log error and rethrow exception - Trace.log(Trace.ERROR, "Unable to write records to DDS source file:"+e); - try - { - if (src != null) - { - src.close(); - } - } - catch(Exception e1) - { // Ignore it; we will throw the original exception - } - if (e instanceof AS400Exception) - { - throw (AS400Exception) e; - } - else - { - Trace.log(Trace.ERROR, e); - throw new InternalErrorException(InternalErrorException.UNKNOWN, e.getMessage()); - } - } - } - - - /** - *Deletes the record at the current cursor position. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void deleteCurrentRecord() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - byte[] optl = {0x00, SHR_READ_NORM_RLS, DATA_DTA_DTARCD, 0x08}; - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - // Delete the current record. - deleteCurrentRecordNtv(handle_, optl); - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - } - - /** - *Deletes the record at the current cursor position. The file must be open and - *the cursor must be positioned on an active record. - *@param handle the file handle - *@return the message feedback data and the I/O feedback data - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - native void deleteCurrentRecordNtv(int handle, byte[] optl) - throws NativeException; - - /** - *Executes a command on the server. - *@param cmd the command - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public AS400Message[] execute(String cmd) - throws AS400SecurityException, InterruptedException, IOException - { - if (converter_ == null) setConverter(); //@C2A - - // Execute the command. - // Note the execution of the command is synchronized on the static - // variable synch_execute_ - BytesWithOffset data = null; - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - synchronized(synch_execute_) - { - data = new BytesWithOffset(executeNtv(converter_.stringToByteArray(cmd))); - } - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - - // Parse the message feedback data. - AS400Message[] msgs = parseMsgFeedback(data.data_); - return msgs; - } - - /** - *Executes a command on the server. - *Submits the command string via the "Process Commands" (QCAPCMD) API. - *Note: Although QCAPCMD is threadsafe, it "should not be used to run a command that is not threadsafe in a job that has multiple threads". - *@param cmd the command - *@return the message feedback data - **/ - native byte[] executeNtv(byte[] cmd); - - //@C0A - /** - *Prepare this object for garbage collection. - *@exception Throwable If an exception is thrown while cleaning up. - **/ - public void finalization() - throws Throwable - { - // This method does nothing. It is here because finalization() is - // declared abstract in AS400FileImplBase. - } - - - /** - *Changes the position of the file cursor to either before the first - *record or after the last record. - *@param handle the file handle - *@param optl the options list - *@return the message feedback data and the I/O feedback data - **/ - native void forceEndOfData(int handle, - byte[] optl) - throws NativeException; - - /** - *Read record(s) from the file. Does not screen out CPF5001, CPF5006. - *@param handle the file handle - *@param optl option list - *@param ctll control list - *@param length length of all record data - *@return message feedback data, I/O feedback data, record data. - **/ - native byte[] getForPosition(int handle, - byte[] optl, - byte[] ctll, - int length) - throws NativeException; - - /** - *Read record(s) from the file. Screens out CPF5001, CPF5006 - *@param handle the file handle - *@param optl option list - *@param ctll control list - *@param length length of all record data - *@return message feedback data, I/O feedback data, record data. - **/ - native byte[] getForRead(int handle, - byte[] optl, - byte[] ctll, - int length) - throws NativeException; - - /** - *Read record(s) from the file by record number. Does not screen out - *CPF5001, CPF5006. - *@param handle the file handle - *@param optl option list - *@param ctll control list - *@param length length of all record data - *@return message feedback data, I/O feedback data, record data. - **/ - native byte[] getdForPosition(int handle, - byte[] optl, - byte[] ctll, - int length) - throws NativeException; - - /** - *Read record(s) from the file by record number. Screens out CPF5001, - *CPF5006. - *@param handle the file handle - *@param optl option list - *@param ctll control list - *@param length length of all record data - *@return message feedback data, I/O feedback data, record data. - **/ - native byte[] getdForRead(int handle, - byte[] optl, - byte[] ctll, - int length) - throws NativeException; - - /** - *Read record(s) from the file by key. Does not screen out CPF5001, - *CPF5006. - *@param handle the file handle - *@param optl option list - *@param ctll control list - *@param length length of all record data - *@return message feedback data, I/O feedback data, record data. - **/ - native byte[] getkForPosition(int handle, - byte[] optl, - byte[] ctll, - int length) - throws NativeException; - - /** - *Read record(s) from the file by key. Screens out CPF5001, CPF5006. - *@param handle the file handle - *@param optl option list - *@param ctll control list - *@param length length of all record data - *@return message feedback data, I/O feedback data, record data. - **/ - native byte[] getkForRead(int handle, - byte[] optl, - byte[] ctll, - int length) - throws NativeException; - - /** - *Opens the file. - *@param openType - *@param bf blocking factor - *@param access The type of file access for which to open the file. - *@return the open feedback data - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - *@exception ServerStartupException If the host server cannot be started.. - *@exception UnknownHostException If the server cannot be located. - **/ - public DDMS38OpenFeedback openFile(int openType, int bf, String access) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // Create the user file control block. - byte[] ufcb = createUFCB(openType, bf, access, true); - - BytesWithOffset data = null; - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - synchronized(synch_open_close_) - { - // Open the file. - data = new BytesWithOffset(openFileNtv(ufcb)); - } - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - // Parse the message feedback data. - AS400Message[] msgs = parseMsgFeedback(data); - - // Parse the file handle. - handle_ = BinaryConverter.byteArrayToInt(data.data_, data.offset_); - data.offset_ += 4; - - // Throw an exception if the open failed and there are no AS400Messages - if (handle_ <= 0) - { - Trace.log(Trace.ERROR, "Invalid handle returned from QYSTRART"); - throw new InternalErrorException(InternalErrorException.UNKNOWN, handle_); - } - // Log warning messages if the open was successful (handle_ > 0) - // and there are AS400Messages - if (msgs.length > 0) - { - if (Trace.isTraceOn() && Trace.isTraceWarningOn()) - { - Trace.log(Trace.WARNING, "AS400FileImplNative.openFile:"); - for (int i = 0; i < msgs.length; ++i) - { - Trace.log(Trace.WARNING, msgs[i].toString()); - } - } - } - - // Parse the open feedback data. - openFeedback_ = new LocalOpenFeedback(system_, //@C0C - data.data_, - data.offset_); - - return openFeedback_; - } - - /** - *Opens the file. - *@param ufcb user file control block. - *@return message feedback data, file handle, and open feedback data - *(in that order) - **/ - native byte[] openFileNtv(byte[] ufcb) - throws NativeException; - - /** - *Parse the record data into records. - *@param iofb I/O feedback data - *@param data record data and offset. - *@return the records contained in the record data - **/ - private Record[] parseRecordData(LocalIOFB iofb, - BytesWithOffset data) - throws UnsupportedEncodingException - { - int numberOfRecords = iofb.getNumberOfRecordsReturned(); - Record[] records = new Record[numberOfRecords]; - // Determine the null byte field map offset. When we opened the file, the - // the S38OPNFB reply contained the offset of the null byte field map in a record. - int nullFieldMapOffset = openFeedback_.getNullFieldByteMapOffset(); - // Determine the number of fields in a record from the RecordFormat for this file. - int numFields = recordFormat_.getNumberOfFields(); //@C0C - // If the file has null capable fields, we will need to check the null byte field - // map and set the fields within the Record object as appropriate. - boolean isNullCapable = openFeedback_.isNullCapable(); - - for (int i = 0; i < numberOfRecords; ++i, - data.offset_ += openFeedback_.getRecordIncrement()) - { - // Create the next record. - records[i] = recordFormat_.getNewRecord(data.data_, //@C0C - data.offset_); - - // Set any null fields to null - if (isNullCapable) - { - for (int j = 0; j < numFields; ++j) - { // 0xF1 = field is null, 0xF0 = field is not null - if (data.data_[nullFieldMapOffset + j + data.offset_] == (byte)0xF1) - { - records[i].setField(j, null); - } - } - } - - // Set the record number. The record number is two bytes after the end - // of the record data and is four bytes long. - try - { - records[i].setRecordNumber(BinaryConverter.byteArrayToInt(data.data_, data.offset_ + iofb.getRecordLength() + 2)); - } - catch(PropertyVetoException e) - { // We created the Record objects. There is no one to veto anything - } // so this is here to quite the compiler - } - return records; - } - - - /** - *Parse the message feedback data into an array of AS400Message objects. - *@param data the message feedback data and offset. - *@return array of AS400Message objects (zero length array if no messages are available - **/ - private AS400Message[] parseMsgFeedback(byte[] data) - throws IOException - { - AS400Message[] msgs = new AS400Message[0]; - - // Determine if any messages are available. - Record msgFB = - (new MessageFBFormat()).getNewRecord(data); - Short messagesOccurred = (Short) msgFB.getField("messagesOccurred"); - if (messagesOccurred.intValue() == 1) - { - // Determine the number of messages. - int numMsgs = ((Short) msgFB.getField("numberOfMessages")).intValue(); - if (numMsgs == 0) - { - return msgs; - } - - // Loop through the array of message feedback data structures, - // building an AS400Message object for each one. - msgs = new AS400Message[numMsgs]; - MessageFBDataFormat msgFBDataFormat = - new MessageFBDataFormat(system_.getCcsid()); //@C0C - Object[] feedbackData = (Object[]) msgFB.getField("feedbackData"); - for (int i = 0; i < numMsgs; i++) - { - // Extract the severity, type, ID, and text from the message - // feedback. - Record msg = msgFBDataFormat.getNewRecord((byte[]) feedbackData[i]); - int severity = ((Integer) msg.getField("severityCode")).intValue(); - String typeString = (String)msg.getField("messageType"); - char[] typeChars = typeString.toCharArray(); - int type = (typeChars[0] & 0x0F) * 10 + (typeChars[1] & 0x0F); - String id = (String) msg.getField("messageID"); - int textLength = ((Integer) msg.getField("messageTextLength")).intValue(); - int substitutionDataLength = ((Integer) msg.getField("replacementTextLength")).intValue(); - - //@B0A: We don't use the messageText field of the record format because - // it hardcodes a length of 256 bytes. If the messageText is shorter - // than 256 bytes, then we are translating junk bytes, which can - // cause problems when running under a double-byte ccsid where - // weird characters would not translate correctly. - // Instead, we use the messageTextLength field to determine how - // long the messageText is and translate it ourselves using a - // CharConverter object. - byte[] arr = (byte[])feedbackData[i]; //@B0A - String text = (new CharConverter(system_.getCcsid())).byteArrayToString(arr, 112 + substitutionDataLength, textLength); //@B0A //@C0C - //@B0D String text = - //@B0D ((String) msg.getField("messageText")).substring(0, textLength); - - // Construct an AS400Message. - msgs[i] = new AS400Message(id, text); - msgs[i].setSeverity(severity); - msgs[i].setType(type); - } - } - - return msgs; - } - - /** - *Parse the message feedback data into an array of AS400Message objects. - *@param data the message feedback data and offset. - *@return array of AS400Message objects (zero length array if no messages are available - **/ - private AS400Message[] parseMsgFeedback(BytesWithOffset data) - throws IOException - { - AS400Message[] msgs = new AS400Message[0]; - - // Determine if any messages are available. - Record msgFB = - (new MessageFBFormat()).getNewRecord(data.data_, data.offset_); - data.offset_ += msgFB.getRecordLength(); - Short messagesOccurred = (Short) msgFB.getField("messagesOccurred"); - if (messagesOccurred.intValue() == 1) - { - // Determine the number of messages. - int numMsgs = ((Short) msgFB.getField("numberOfMessages")).intValue(); - if (numMsgs == 0) - { - return msgs; - } - - // Loop through the array of message feedback data structures, - // building an AS400Message object for each one. - msgs = new AS400Message[numMsgs]; - MessageFBDataFormat msgFBDataFormat = - new MessageFBDataFormat(system_.getCcsid()); //@C0C - Object[] feedbackData = (Object[]) msgFB.getField("feedbackData"); - for (int i = 0; i < numMsgs; i++) - { - // Extract the severity, type, ID, and text from the message - // feedback. - Record msg = msgFBDataFormat.getNewRecord((byte[]) feedbackData[i]); - int severity = ((Integer) msg.getField("severityCode")).intValue(); - String typeString = (String)msg.getField("messageType"); - char[] typeChars = typeString.toCharArray(); - int type = (typeChars[0] & 0x0F) * 10 + (typeChars[1] & 0x0F); - String id = (String) msg.getField("messageID"); - int textLength = ((Integer) msg.getField("messageTextLength")).intValue(); - int substitutionDataLength = ((Integer) msg.getField("replacementTextLength")).intValue(); - - //@B0A: We don't use the messageText field of the record format because - // it hardcodes a length of 256 bytes. If the messageText is shorter - // than 256 bytes, then we are translating junk bytes, which can - // cause problems when running under a double-byte ccsid where - // weird characters would not translate correctly. - // Instead, we use the messageTextLength field to determine how - // long the messageText is and translate it ourselves using a - // CharConverter object. - byte[] arr = (byte[])feedbackData[i]; //@B0A - String text = (new CharConverter(system_.getCcsid())).byteArrayToString(arr, 112 + substitutionDataLength, textLength); //@B0A //@C0C - //@B0D String text = - //@B0D ((String) msg.getField("messageText")).substring(0, textLength); - - // Construct an AS400Message. - msgs[i] = new AS400Message(id, text); - msgs[i].setSeverity(severity); - msgs[i].setType(type); - } - } - - return msgs; - } - /** - *Positions the file cursor to after the last record. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void positionCursorAfterLast() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // If we are caching records and the cache contains the last record, - // position the cache. Otherwise, position the file and refresh the - // cache if we are caching records. - if (cacheRecords_ && cache_.containsLastRecord()) - { - cache_.setPositionAfterLast(); - return; - } - - if (cacheRecords_) - { - // Invalidate the cache - cache_.setIsEmpty(); - } - - // Use force end of data. - byte[] optl = { TYPE_GET_LAST, SHR_READ_NORM_RLS, DATA_NODTA_DTARCD, OPER_GET }; - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - forceEndOfData(handle_, optl); - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - } - - /** - *Positions the file cursor to the specified position (first, last, next, - *previous). - *@param type the type of position operation - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record[] positionCursorAt(int type) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // Use GET to position the cursor. - // byte shr = (as400File_.openType_ == AS400File.READ_ONLY ? // @A2D - // SHR_READ_NORM : SHR_UPD_NORM); // @A2D - - // Start of @A2A - byte shr; - if ((openType_ == AS400File.READ_ONLY) || //@C0C - ((openType_ == AS400File.READ_WRITE) && readNoUpdate_)) //@C0C - { // Read only - shr = SHR_READ_NORM; - } - else - { // READ_WRITE; get for update - shr = SHR_UPD_NORM; - } - // End of @A2A - - byte[] optl = { (byte) type, shr, DATA_DTA_DTARCD, OPER_GET }; - byte[] ctll = new byte[6]; - ctll[0] = 0x10; // ID for number of records - // Length of value field - BinaryConverter.shortToByteArray((short) 2, ctll, 1); - // Number of records to get - BinaryConverter.shortToByteArray((short) blockingFactor_, ctll, 3); //@C0C - ctll[5] = (byte)0xFF; // End of control list - BytesWithOffset data = null; - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - data = - new BytesWithOffset(getForPosition(handle_, optl, ctll, - blockingFactor_ * //@C0C - openFeedback_.getRecordIncrement())); - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - - // Parse the I/O feedback data. - LocalIOFB iofb = new LocalIOFB(data.data_, data.offset_); - data.offset_ += 14; - - // Parse the record data. - Record[] records = parseRecordData(iofb, data); - - return records; - } - - /** - *Positions the file cursor to before the first record. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void positionCursorBeforeFirst() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // If we are caching records and the cache contains the first record, - // position the cache. Otherwise, position the file and refresh the - // cache if we are caching records. - if (cacheRecords_ && cache_.containsFirstRecord()) - { - cache_.setPositionBeforeFirst(); - return; - } - - if (cacheRecords_) - { // Invalidate the cache - cache_.setIsEmpty(); - } - - // Use Force end of data to set the cursor. - byte[] optl = { TYPE_GET_FIRST, SHR_READ_NORM_RLS, DATA_NODTA_DTARCD, OPER_GET }; - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - forceEndOfData(handle_, optl); - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - } - - /** - *Positions the cursor to the record at the specified file position. - *@parm index the file position - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record positionCursorToIndex(int index) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - if (cacheRecords_ && !cache_.setPosition(index)) //@G0A - { - // Invalidate the cache - cache_.setIsEmpty(); //@G0A - } - - // OPTL - // byte share = (as400File_.openType_ == AS400File.READ_ONLY ? // @A2D - // SHR_READ_NORM : SHR_UPD_NORM); // @A2D - - // Start of @A2A - byte share; - if ((openType_ == AS400File.READ_ONLY) || //@C0C - ((openType_ == AS400File.READ_WRITE) && readNoUpdate_)) //@C0C - { // Read only - share = SHR_READ_NORM; - } - else - { // READ_WRITE; get for update - share = SHR_UPD_NORM; - } - // End of @A2A - - byte[] optl = { TYPE_GETD_ABSRRN, share, DATA_DTA_DTARCD, OPER_GETD }; - - // CTLL - // ---------------------------------- - // Offset Description - // ---------------------------------- - // 0 record format ID - // 1 record format length - // 3 record format name - // 13 member number ID - // 14 member number length - // 16 member number value - // 18 relative record number ID - // 19 relative record number length - // 21 relative record number - // 25 control list end - byte[] ctll = new byte[26]; - ctll[0] = 1; - BinaryConverter.shortToByteArray((short) 35, ctll, 1); - - // Start of @A2D - /* - StringBuffer recordName = - new StringBuffer(as400File_.recordFormat_.getName()); - while (recordName.length() < 10) recordName.append(' '); - converter_.stringToByteArray(recordName.toString(), ctll, 3); - */ - // End of @A2D - - System.arraycopy(recordFormatCTLLName_, 0, ctll, 3, recordFormatCTLLName_.length); // @A2A //@C0C - - ctll[13] = 0xf; - BinaryConverter.shortToByteArray((short) 2, ctll, 14); - BinaryConverter.shortToByteArray((short) 0, ctll, 16); - ctll[18] = 2; - BinaryConverter.shortToByteArray((short) 4, ctll, 19); - BinaryConverter.intToByteArray(index, ctll, 21); - ctll[25] = (byte) 0xff; - - BytesWithOffset data = null; - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - // GETD. - data = - new BytesWithOffset(getdForPosition(handle_, optl, ctll, - openFeedback_.getRecordIncrement() * - blockingFactor_)); //@C0C - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - - // Parse the I/O feedback data. - LocalIOFB iofb = new LocalIOFB(data.data_, data.offset_); - data.offset_ += 14; - - // Parse the record data. - Record[] records = parseRecordData(iofb, data); - - return (records.length == 0)? null : records[0]; - } - - /** - *Positions the cursor to the first record in the file that matches the - *specified key. - *@param key the key - *@param searchType the way to compare keys - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record positionCursorToKey(Object[] keys, - int searchType) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // OPTL - // byte share = (as400File_.openType_ == AS400File.READ_ONLY ? // @A2D - // SHR_READ_NORM : SHR_UPD_NORM); // @A2D - - if (cacheRecords_) //@G0A - { - // Invalidate the cache - cache_.setIsEmpty(); //@G0A - } - - // Start of @A2A - byte share; - if ((openType_ == AS400File.READ_ONLY) || //@C0C - ((openType_ == AS400File.READ_WRITE) && readNoUpdate_)) //@C0C - { // Read only - share = SHR_READ_NORM; - } - else - { // READ_WRITE; get for update - share = SHR_UPD_NORM; - } - // End of @A2A - - byte[] optl = { (byte)searchType, share, DATA_DTA_DTARCD, OPER_GETK }; - - // Determine the total length of all data in keyFields. - FieldDescription description; - ByteArrayOutputStream keyAsBytes = new ByteArrayOutputStream(); - // Converter conv; // @A1D - byte[] fieldAsBytes; // Will contain each key field's data as bytes - byte[] lengthBytes = new byte[2]; // Used for variable length fields - for (int i = 0; i < keys.length; i++) - { - try - { - // Convert each key field to server data writing it to keyAsBytes - description = recordFormat_.getKeyFieldDescription(i); //@C0C - - // Check if field is a variable length field. This means that the field - // is either a hex field or a character (DNCS* included) field. - // The field has the potential of being variable length, but may be - // fixed length. We account for both cases in this if. - if (description instanceof VariableLengthFieldDescription) - { - boolean varLength = ((VariableLengthFieldDescription)description).isVariableLength(); - if (description instanceof HexFieldDescription) - { // Hex field - if (varLength) - { - // Need to write two bytes of length info prior to writing the data - BinaryConverter.shortToByteArray((short)((byte[])keys[i]).length, lengthBytes, 0); - keyAsBytes.write(lengthBytes, 0, lengthBytes.length); - } - keyAsBytes.write((byte[])keys[i], 0, ((byte[])keys[i]).length); - if (varLength) - { - // We need to send the maximum field length number of bytes for the - // field, even though only keyFields[i].length bytes of the data will - // be looked at by DDM - int fieldLength = description.getDataType().getByteLength(); - for (int j = ((byte[])keys[i]).length; j < fieldLength; ++j) - { - keyAsBytes.write(0); - } - } - } - else - { // Character field - // Use Converter object to translate the key field passed in. If - // we use the data type associated with the field description, the data - // for the key field will be padded with blanks to the byteLength of - // the field description. This can cause a match of the key to occur in the - // case that the user specifies a value that does not exactly match the key - // field in the record. - if (varLength) - { - // Need to write two bytes of length info prior to writing the - // data - BinaryConverter.shortToByteArray((short)((String)keys[i]).length(), lengthBytes, 0); - keyAsBytes.write(lengthBytes, 0, lengthBytes.length); - } - - // @A1D - // Modified code to use the AS400Text object to do the conversion. - // conv = Converter.getConverter(((AS400Text)description.getDataType()).getCcsid()); // @A1D - // fieldAsBytes = conv.stringToByteArray((String)keys[i]); // @A1D - - fieldAsBytes = description.getDataType().toBytes(keys[i]); // @A1A - - keyAsBytes.write(fieldAsBytes, 0, fieldAsBytes.length); - - // We need to get rid of this now since AS400Text does the padding for us. - // @A1D - /* - if (varLength) - { - // We need to send the maximum field length number of bytes for the - // field, even though only keyFields[i].length bytes of the data will - // be looked at by DDM - int fieldLength = description.getDataType().getByteLength(); - for (int j = ((String)keys[i]).length(); j < fieldLength; ++j) - { - keyAsBytes.write(0x40); - } - } - */ - } - } - else - { - // Numeric field - fieldAsBytes = description.getDataType().toBytes(keys[i]); - keyAsBytes.write(fieldAsBytes, 0, fieldAsBytes.length); - } - } - catch(NullPointerException e) - { - // One of the key fields was null - throw new ExtendedIllegalArgumentException("key", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - int keyLength = keyAsBytes.size(); - - // CTLL - // ---------------------------------- - // Offset Description - // ---------------------------------- - // 0 record format ID - // 1 record format length - // 3 record format name - // 13 member number ID - // 14 member number length - // 16 member number value - // 18 number of fields ID - // 19 number of fields length - // 21 number of fields value - // 25 key fields ID - // 26 key fields length, - // 28 key field values - // ?? control list end - byte[] ctll = new byte[29 + keyLength]; - ctll[0] = 1; - BinaryConverter.shortToByteArray((short) 35, ctll, 1); - - // Start of @A2D - /* - StringBuffer recordName = - new StringBuffer(as400File_.recordFormat_.getName()); - while (recordName.length() < 10) recordName.append(' '); - converter_.stringToByteArray(recordName.toString(), ctll, 3); - */ - // End of @A2D - - System.arraycopy(recordFormatCTLLName_, 0, ctll, 3, recordFormatCTLLName_.length); // @A2A //@C0C - - ctll[13] = 0xf; - BinaryConverter.shortToByteArray((short) 2, ctll, 14); - BinaryConverter.shortToByteArray((short) 0, ctll, 16); - ctll[18] = 8; - BinaryConverter.shortToByteArray((short) 4, ctll, 19); - BinaryConverter.intToByteArray(keys.length, ctll, 21); - ctll[25] = 7; - BinaryConverter.shortToByteArray((short) keyLength, ctll, 26); - System.arraycopy(keyAsBytes.toByteArray(), 0, ctll, 28, keyLength); - ctll[28 + keyLength] = (byte) 0xff; - - BytesWithOffset data = null; - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - // GETK - data = - new BytesWithOffset(getkForPosition(handle_, optl, ctll, - openFeedback_.getRecordIncrement() * - blockingFactor_)); //@C0C - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - - // Parse the I/O feedback data. - // LocalIOFB iofb = new LocalIOFB(data.data_, data.offset_); // @A2D - // data.offset_ += 14; // @A2D - - // Parse the record data. - // Record[] records = parseRecordData(iofb, data); // @A2D - - // return (records.length == 0)? null : records[0]; // @A2D - return null; - } - - - // @A2A - /** - *Positions the cursor to the first record in the file that matches the - *specified key. - *@param key the key - *@param searchType the way to compare keys - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record positionCursorToKey(byte[] keys, - int searchType, int numberOfKeyFields) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // OPTL - // byte share = (as400File_.openType_ == AS400File.READ_ONLY ? - // SHR_READ_NORM : SHR_UPD_NORM); - - if (cacheRecords_) //@G0A - { - // Invalidate the cache - cache_.setIsEmpty(); //@G0A - } - - // Start of @A2A - byte share; - if ((openType_ == AS400File.READ_ONLY) || //@C0C - ((openType_ == AS400File.READ_WRITE) && readNoUpdate_)) //@C0C - { // Read only - share = SHR_READ_NORM; - } - else - { // READ_WRITE; get for update - share = SHR_UPD_NORM; - } - // End of @A2A - - byte[] optl = { (byte)searchType, share, DATA_DTA_DTARCD, OPER_GETK }; - - // Determine the total length of all data in keyFields. - FieldDescription description; - int keyLength = keys.length; - - // CTLL - // ---------------------------------- - // Offset Description - // ---------------------------------- - // 0 record format ID - // 1 record format length - // 3 record format name - // 13 member number ID - // 14 member number length - // 16 member number value - // 18 number of fields ID - // 19 number of fields length - // 21 number of fields value - // 25 key fields ID - // 26 key fields length, - // 28 key field values - // ?? control list end - byte[] ctll = new byte[29 + keyLength]; - ctll[0] = 1; - BinaryConverter.shortToByteArray((short) 35, ctll, 1); - - // Start of @A2D - /* - StringBuffer recordName = - new StringBuffer(as400File_.recordFormat_.getName()); - while (recordName.length() < 10) recordName.append(' '); - converter_.stringToByteArray(recordName.toString(), ctll, 3); - */ - // End of @A2D - - System.arraycopy(recordFormatCTLLName_, 0, ctll, 3, recordFormatCTLLName_.length); // @A2A //@C0C - - ctll[13] = 0xf; - BinaryConverter.shortToByteArray((short) 2, ctll, 14); - BinaryConverter.shortToByteArray((short) 0, ctll, 16); - ctll[18] = 8; - BinaryConverter.shortToByteArray((short) 4, ctll, 19); - BinaryConverter.intToByteArray(numberOfKeyFields, ctll, 21); - ctll[25] = 7; - BinaryConverter.shortToByteArray((short) keyLength, ctll, 26); - System.arraycopy(keys, 0, ctll, 28, keyLength); - ctll[28 + keyLength] = (byte) 0xff; - - BytesWithOffset data = null; - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - // GETK - data = - new BytesWithOffset(getkForPosition(handle_, optl, ctll, - openFeedback_.getRecordIncrement() * - blockingFactor_)); //@C0C - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - - // Parse the I/O feedback data. - // LocalIOFB iofb = new LocalIOFB(data.data_, data.offset_); // @A2D - // data.offset_ += 14; // @A2D - - // Parse the record data. - // Record[] records = parseRecordData(iofb, data); // @A2D - - // return (records.length == 0)? null : records[0]; // @A2D - return null; - } - - - - /** - *Write records to the file. - *@param handle the file handle. - *@param optl option list - *@param ctll control list - *@param data record data - *@return message feedback data, I/O feedback data - **/ - native void put(int handle, - byte[] optl, - byte[] ctll, - byte[] data) - throws NativeException; - - /** - Reads the record at the specified file position. - @param index the file position - @return the record read. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record read(int index) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - if (cacheRecords_) //@C0A - return super.read(index); //@C0A - - // OPTL - // byte share = (as400File_.openType_ == AS400File.READ_ONLY ? // @A2D - // SHR_READ_NORM : SHR_UPD_NORM); // @A2D - - // Start of @A2A - byte share; - if ((openType_ == AS400File.READ_ONLY) || //@C0C - ((openType_ == AS400File.READ_WRITE) && readNoUpdate_)) //@C0C - { // Read only - share = SHR_READ_NORM; - } - else - { // READ_WRITE; get for update - share = SHR_UPD_NORM; - } - // End of @A2A - - byte[] optl = { TYPE_GETD_ABSRRN, share, DATA_DTA_DTARCD, OPER_GETD }; - - // CTLL - // ---------------------------------- - // Offset Description - // ---------------------------------- - // 0 record format ID - // 1 record format length - // 3 record format name - // 13 member number ID - // 14 member number length - // 16 member number value - // 18 relative record number ID - // 19 relative record number length - // 21 relative record number - // 25 control list end - byte[] ctll = new byte[26]; - ctll[0] = 1; - BinaryConverter.shortToByteArray((short) 35, ctll, 1); - - // Start of @A2D - /* - StringBuffer recordName = - new StringBuffer(as400File_.recordFormat_.getName()); - while (recordName.length() < 10) recordName.append(' '); - converter_.stringToByteArray(recordName.toString(), ctll, 3); - */ - // End of @A2D - - System.arraycopy(recordFormatCTLLName_, 0, ctll, 3, recordFormatCTLLName_.length); // @A2A //@C0C - - ctll[13] = 0xf; - BinaryConverter.shortToByteArray((short) 2, ctll, 14); - BinaryConverter.shortToByteArray((short) 0, ctll, 16); - ctll[18] = 2; - BinaryConverter.shortToByteArray((short) 4, ctll, 19); - BinaryConverter.intToByteArray(index, ctll, 21); - ctll[25] = (byte) 0xff; - - BytesWithOffset data = null; - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - // GETD - data = - new BytesWithOffset(getdForRead(handle_, optl, ctll, - openFeedback_.getRecordIncrement() * - blockingFactor_)); //@C0C - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - - // Parse the I/O feedback data. - LocalIOFB iofb = new LocalIOFB(data.data_, data.offset_); - data.offset_ += 14; - - // Parse the record data. - Record[] records = parseRecordData(iofb, data); - - return (records.length == 0)? null : records[0]; - } - - /** - *Reads the first record with the specified key based on the specified search type. - *@param key The values that make up the key with which to find the record. - *@param type The type of read. This value is one of the TYPE_GETKEY_* constants. - *@return The record read. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record read(Object[] key, - int searchType) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // OPTL - // byte share = (as400File_.openType_ == AS400File.READ_ONLY ? // @A2D - // SHR_READ_NORM : SHR_UPD_NORM); // @A2D - - // Start of @A2A - byte share; - if ((openType_ == AS400File.READ_ONLY) || //@C0C - ((openType_ == AS400File.READ_WRITE) && readNoUpdate_)) //@C0C - { // Read only - share = SHR_READ_NORM; - } - else - { // READ_WRITE; get for update - share = SHR_UPD_NORM; - } - // End of @A2A - - byte[] optl = { (byte)searchType, share, DATA_DTA_DTARCD, OPER_GETK }; - - // Determine the total length of all data in keyFields. - FieldDescription description; - ByteArrayOutputStream keyAsBytes = new ByteArrayOutputStream(); - // Converter conv; // @A1D - byte[] fieldAsBytes; // Will contain each key field's data as bytes - byte[] lengthBytes = new byte[2]; // Used for variable length fields - for (int i = 0; i < key.length; i++) - { - try - { - // Convert each key field to server data writing it to keyAsBytes - description = recordFormat_.getKeyFieldDescription(i); //@C0C - - // Check if field is a variable length field. This means that the field - // is either a hex field or a character (DNCS* included) field. - // The field has the potential of being variable length, but may be - // fixed length. We account for both cases in this if. - if (description instanceof VariableLengthFieldDescription) - { - boolean varLength = ((VariableLengthFieldDescription)description).isVariableLength(); - if (description instanceof HexFieldDescription) - { // Hex field - if (varLength) - { - // Need to write two bytes of length info prior to writing the data - BinaryConverter.shortToByteArray((short)((byte[])key[i]).length, lengthBytes, 0); - keyAsBytes.write(lengthBytes, 0, lengthBytes.length); - } - keyAsBytes.write((byte[])key[i], 0, ((byte[])key[i]).length); - if (varLength) - { - // We need to send the maximum field length number of bytes for the - // field, even though only keyFields[i].length bytes of the data will - // be looked at by DDM - int fieldLength = description.getDataType().getByteLength(); - for (int j = ((byte[])key[i]).length; j < fieldLength; ++j) - { - keyAsBytes.write(0); - } - } - } - else - { // Character field - // Use Converter object to translate the key field passed in. If - // we use the data type associated with the field description, the data - // for the key field will be padded with blanks to the byteLength of - // the field description. This can cause a match of the key to occur in the - // case that the user specifies a value that does not exactly match the key - // field in the record. - if (varLength) - { - // Need to write two bytes of length info prior to writing the - // data - BinaryConverter.shortToByteArray((short)((String)key[i]).length(), lengthBytes, 0); - keyAsBytes.write(lengthBytes, 0, lengthBytes.length); - } - // conv = Converter.getConverter(((AS400Text)description.getDataType()).getCcsid()); // @A1D - // fieldAsBytes = conv.stringToByteArray((String)key[i]); // @A1D - - fieldAsBytes = description.getDataType().toBytes(key[i]); // @A1A - - keyAsBytes.write(fieldAsBytes, 0, fieldAsBytes.length); - - // @A1D - /* - if (varLength) - { - // We need to send the maximum field length number of bytes for the - // field, even though only keyFields[i].length bytes of the data will - // be looked at by DDM - int fieldLength = description.getDataType().getByteLength(); - for (int j = ((String)key[i]).length(); j < fieldLength; ++j) - { - keyAsBytes.write(0x40); - } - } - */ - } - } - else - { - // Numeric field - fieldAsBytes = description.getDataType().toBytes(key[i]); - keyAsBytes.write(fieldAsBytes, 0, fieldAsBytes.length); - } - } - catch(NullPointerException e) - { - // One of the key fields was null - throw new ExtendedIllegalArgumentException("key", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - int keyLength = keyAsBytes.size(); - - // CTLL - // ---------------------------------- - // Offset Description - // ---------------------------------- - // 0 record format ID - // 1 record format length - // 3 record format name - // 13 member number ID - // 14 member number length - // 16 member number value - // 18 number of fields ID - // 19 number of fields length - // 21 number of fields value - // 25 key fields ID - // 26 key fields length, - // 28 key field values - // ?? control list end - byte[] ctll = new byte[29 + keyLength]; - ctll[0] = 1; - BinaryConverter.shortToByteArray((short) 35, ctll, 1); - - // Start of @A2D - /* - StringBuffer recordName = - new StringBuffer(as400File_.recordFormat_.getName()); - while (recordName.length() < 10) recordName.append(' '); - converter_.stringToByteArray(recordName.toString(), ctll, 3); - */ - // End of @A2D - - System.arraycopy(recordFormatCTLLName_, 0, ctll, 3, recordFormatCTLLName_.length); // @A2A //@C0C - - ctll[13] = 0xf; - BinaryConverter.shortToByteArray((short) 2, ctll, 14); - BinaryConverter.shortToByteArray((short) 0, ctll, 16); - ctll[18] = 8; - BinaryConverter.shortToByteArray((short) 4, ctll, 19); - BinaryConverter.intToByteArray(key.length, ctll, 21); - ctll[25] = 7; - BinaryConverter.shortToByteArray((short) keyLength, ctll, 26); - System.arraycopy(keyAsBytes.toByteArray(), 0, ctll, 28, keyLength); - ctll[28 + keyLength] = (byte) 0xff; - - BytesWithOffset data = null; - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - // GETK. - data = - new BytesWithOffset(getkForRead(handle_, optl, ctll, - openFeedback_.getRecordIncrement() * - blockingFactor_)); //@C0C - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - - // Parse the I/O feedback data. - LocalIOFB iofb = new LocalIOFB(data.data_, data.offset_); - data.offset_ += 14; - - // Parse the record data. - Record[] records = parseRecordData(iofb, data); - - if (cacheRecords_) //@C0A - { //@C0A - cache_.setIsEmpty(); //@C0A - } //@C0A - - return (records.length == 0)? null : records[0]; - } - - - // @A2A - /** - *Reads the first record with the specified key based on the specified search type. - *@param key The values that make up the key with which to find the record. - *@param type The type of read. This value is one of the TYPE_GETKEY_* constants. - *@return The record read. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record read(byte[] key, - int searchType, int numberOfKeyFields) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // OPTL - // byte share = (as400File_.openType_ == AS400File.READ_ONLY ? - // SHR_READ_NORM : SHR_UPD_NORM); - - // Start of @A2A - byte share; - if ((openType_ == AS400File.READ_ONLY) || //@C0C - ((openType_ == AS400File.READ_WRITE) && readNoUpdate_)) //@C0C - { // Read only - share = SHR_READ_NORM; - } - else - { // READ_WRITE; get for update - share = SHR_UPD_NORM; - } - // End of @A2A - - byte[] optl = { (byte)searchType, share, DATA_DTA_DTARCD, OPER_GETK }; - - // Determine the total length of all data in keyFields. - FieldDescription description; - int keyLength = key.length; - - // CTLL - // ---------------------------------- - // Offset Description - // ---------------------------------- - // 0 record format ID - // 1 record format length - // 3 record format name - // 13 member number ID - // 14 member number length - // 16 member number value - // 18 number of fields ID - // 19 number of fields length - // 21 number of fields value - // 25 key fields ID - // 26 key fields length, - // 28 key field values - // ?? control list end - byte[] ctll = new byte[29 + keyLength]; - ctll[0] = 1; - BinaryConverter.shortToByteArray((short) 35, ctll, 1); - - // Start of @A2D - /* - StringBuffer recordName = - new StringBuffer(as400File_.recordFormat_.getName()); - while (recordName.length() < 10) recordName.append(' '); - converter_.stringToByteArray(recordName.toString(), ctll, 3); - */ - // Start of @A2D - - System.arraycopy(recordFormatCTLLName_, 0, ctll, 3, recordFormatCTLLName_.length); // @A2A //@C0C - - ctll[13] = 0xf; - BinaryConverter.shortToByteArray((short) 2, ctll, 14); - BinaryConverter.shortToByteArray((short) 0, ctll, 16); - ctll[18] = 8; - BinaryConverter.shortToByteArray((short) 4, ctll, 19); - BinaryConverter.intToByteArray(numberOfKeyFields, ctll, 21); - ctll[25] = 7; - BinaryConverter.shortToByteArray((short) keyLength, ctll, 26); - System.arraycopy(key, 0, ctll, 28, keyLength); - ctll[28 + keyLength] = (byte) 0xff; - - BytesWithOffset data = null; - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - // GETK. - data = - new BytesWithOffset(getkForRead(handle_, optl, ctll, - openFeedback_.getRecordIncrement() * - blockingFactor_)); //@C0C - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - - // Parse the I/O feedback data. - LocalIOFB iofb = new LocalIOFB(data.data_, data.offset_); - data.offset_ += 14; - - // Parse the record data. - Record[] records = parseRecordData(iofb, data); - - if (cacheRecords_) //@C0A - { //@C0A - cache_.setIsEmpty(); //@C0A - } //@C0A - - return (records.length == 0)? null : records[0]; - } - - - /** - *Reads all the records in the file. - *@param fileType The type of file. Valid values are: key or seq - *@return The records read. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record[] readAll(String fileType, int bf) //@C1C - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // Open the file with a blocking factor of 100. - openFile2(AS400File.READ_ONLY, bf, AS400File.COMMIT_LOCK_LEVEL_NONE, fileType); //@C0C @C1C - - Record[] records = null; - try - { - // Determine how many records are in the file. - records = new Record[openFeedback_.getNumberOfRecords()]; - - // Read the entire file contents one record at a time. - for (int i = 0; i < records.length; i++) - { - records[i] = readNext(); //@C0C - } - } - finally - { - // Close the file we opened. - try - { - close(); //@C0C - } - catch(AS400Exception e) - { - resetState(); //@C0C - throw e; - } - catch(AS400SecurityException e) - { - resetState(); //@C0C - throw e; - } - catch(InterruptedException e) - { - resetState(); //@C0C - throw e; - } - catch(IOException e) - { - resetState(); //@C0C - throw e; - } - } - - return records; - } - - /** - *Reads the record at the current file position. - *@param type type of read (first, last, next, previous) - *@return the record read. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readRecord(int type) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // OPTL - // byte share = (as400File_.openType_ == AS400File.READ_ONLY ? // @A2D - // SHR_READ_NORM : SHR_UPD_NORM); // @A2D - - // Start of @A2A - byte share; - if ((openType_ == AS400File.READ_ONLY) || //@C0C - ((openType_ == AS400File.READ_WRITE) && readNoUpdate_)) //@C0C - { // Read only - share = SHR_READ_NORM; - } - else - { // READ_WRITE; get for update - share = SHR_UPD_NORM; - } - // End of @A2A - - byte[] optl = { (byte) type, share, DATA_DTA_DTARCD, OPER_GET }; - byte[] ctll = new byte[6]; - ctll[0] = 0x10; // ID for number of records - // Length of value field - BinaryConverter.shortToByteArray((short) 2, ctll, 1); - // Number of records to get - BinaryConverter.shortToByteArray((short) blockingFactor_, ctll, 3); //@C0C - ctll[5] = (byte)0xFF; // End of control list - - BytesWithOffset data = null; - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - // GET - data = - new BytesWithOffset(getForRead(handle_, optl, ctll, - openFeedback_.getRecordIncrement() * - blockingFactor_)); //@C0C - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - - // Parse the I/O feedback data. - LocalIOFB iofb = new LocalIOFB(data.data_, data.offset_); - data.offset_ += 14; - - // Parse the record data. - Record[] records = parseRecordData(iofb, data); - - return (records.length == 0)? null : records[0]; - } - - /** - *Reads records from the file. The next or previous 'blockingFactor_' - *records are retrieved depending on the direction specified. - *@param direction (DDMRecordCache.FORWARD or DDMRecordCache.BACKWARD) - *@return the records read - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record[] readRecords(int direction) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // OPTL - byte type = (direction == DDMRecordCache.FORWARD ? TYPE_GET_NEXT : - TYPE_GET_PREV); - byte[] optl = { type, SHR_READ_NORM, DATA_DTA_DTARCD, OPER_GET }; - byte[] ctll = new byte[6]; - ctll[0] = 0x10; // ID for number of records - // Length of value field - BinaryConverter.shortToByteArray((short) 2, ctll, 1); - // Number of records to get - BinaryConverter.shortToByteArray((short) blockingFactor_, ctll, 3); //@C0C - ctll[5] = (byte)0xFF; // End of control list - - // GET. - int length = openFeedback_.getRecordIncrement() * - blockingFactor_; //@C0C - BytesWithOffset data = null; - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - data = - new BytesWithOffset(getForRead(handle_, optl, ctll, length)); - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - - // Parse the I/O feedback data. - LocalIOFB iofb = new LocalIOFB(data.data_, data.offset_); - data.offset_ += 14; - - // Parse the record data. - Record[] records = parseRecordData(iofb, data); - - return records; - } - - //@E3A - /** - * Used to reset the static hashtable of file handles that is - * stored in the native code. We do this now because the - * service program does not get reactivated when - * another JVM is instantiated (as of the release after v4r5). - **/ - private static native void resetStaticStorage(); - - /** - *Rolls back any transactions since the last commit/rollback boundary. Invoking this - *method will cause all transactions under commitment control for this connection - *to be rolled back. This means that any AS400File object for which a commit - *lock level was specified and that was opened under this connection will have - *outstanding transactions rolled back. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void rollback() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - // Rollback. - rollbackNtv(); - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - } - - /** - *Rollback changes to files under commitment control. - *@return message feedback data. - **/ - native void rollbackNtv() - throws NativeException; - - /** - *Updates the specified record. - *@param handle the file handle - *@param optl option list - *@param ctll control list - *@param recordData record data - *@return message feedback data, I/O feedback - **/ - native void updat(int handle, - byte[] optl, - byte[] ctll, - byte[] recordData) - throws NativeException; - - /** - *Updates the record at the current cursor position. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void update(Record record) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - if (record.getRecordLength() != openFeedback_.getRecordLength()) - { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) - { - Trace.log(Trace.ERROR, "Incorrect record length for file :"); - Trace.log(Trace.ERROR, "record.getRecordLength() :" + String.valueOf(record.getRecordLength())); - } - throw new ExtendedIllegalArgumentException("record", ExtendedIllegalArgumentException. PARAMETER_VALUE_NOT_VALID); - } - - // OPTL - byte[] optl = { TYPE_GET_SAME, SHR_UPD_NORM, DATA_DTA_DTARCD, OPER_UPDATE }; - - // Create the record data to be sent - int recordIncrement = openFeedback_.getRecordIncrement(); - byte[] recordData = new byte[recordIncrement]; - System.arraycopy(record.getContents(), 0, recordData, 0, record.getRecordLength()); - - // Start of changes for ----------------------------------------- @A3A - // Determine the maxNumberOfFieldsPerFormatInFile for the file - // remembering that multi-format logical files may have a different - // number of getNumberOfFields() per record format. - // DDMObjectDataStream.getObjectS38BUF() needs maxNumberOfFieldsPerFormatInFile - int numFields = record.getNumberOfFields(); - int maxNumberOfFieldsPerFormatInFile = numFields; - if (rfCache_ == null) - { - // Use default maxNumberOfFieldsPerFormatInFile == numFields - } - else // Determine if a different record format has more fields (i.e. find the max) - { - int numberOfRecordFormats = rfCache_.length; - for(int i = 0; i < numberOfRecordFormats; ++i) - { - maxNumberOfFieldsPerFormatInFile = - Math.max(maxNumberOfFieldsPerFormatInFile, rfCache_[i].getNumberOfFields()); - } - } - // End of changes for ------------------------------------------- @A3A - - int fieldOffset = recordIncrement - maxNumberOfFieldsPerFormatInFile; //@A3C - for (int i = 0; i < numFields; ++i, ++fieldOffset) - { - recordData[fieldOffset] = (record.isNullField(i))? (byte)0xF1 : (byte)0xF0; - } - - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - // UPDAT - updat(handle_, optl, null, recordData); - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - } - - /** - *Writes an array of records to the end of the file. - *The cursor is positioned to after the last record of the file as a result - *of invoking this method. - *@param records The records to write. The records must have a format - *which matches the record format of this object. To ensure that this - *requirement is met, use the - *RecordFormat.getNewRecord() - *method to obtain default records whose fields can be set appropriately by - *the Java program and then written to the file. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void write(Record[] records) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - if (records[0].getRecordLength() != openFeedback_.getRecordLength()) - { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) - { - Trace.log(Trace.ERROR, "Incorrect record length for file :"); - Trace.log(Trace.ERROR, "record.getRecordLength() :" + String.valueOf(records[0].getRecordLength())); - } - throw new ExtendedIllegalArgumentException("records", ExtendedIllegalArgumentException. PARAMETER_VALUE_NOT_VALID); - } - - // PUT the record data to the file, blocking factor records at a time. - int recordIncrement = openFeedback_.getRecordIncrement(); - byte[] recordData = - new byte[(records.length < blockingFactor_ ? //@C0C - records.length : blockingFactor_) * //@C0C - recordIncrement]; - - // Start of changes for ----------------------------------------- @A3A - // Determine the maxNumberOfFieldsPerFormatInFile for the file - // remembering that multi-format logical files may have a different - // number of getNumberOfFields() per record format. - // DDMObjectDataStream.getObjectS38BUF() needs maxNumberOfFieldsPerFormatInFile - int maxNumberOfFieldsPerFormatInFile = -1; - if (rfCache_ == null) - { - // Use default maxNumberOfFieldsPerFormatInFile == -1 - } - else // Determine if a different record format has more fields (i.e. find the max) - { - int numberOfRecordFormats = rfCache_.length; - for(int i = 0; i < numberOfRecordFormats; ++i) - { - maxNumberOfFieldsPerFormatInFile = - Math.max(maxNumberOfFieldsPerFormatInFile, rfCache_[i].getNumberOfFields()); - } - } - // End of changes for ------------------------------------------- @A3A - - - for (int offset = 0, r = 1; r <= records.length; r++) - { - // Copy the record data to the record data buffer. - byte[] record = records[r-1].getContents(); - System.arraycopy(record, 0, recordData, offset, record.length); - - // Write the null field byte map array after the record data. It - // immediately preceeds the next record. 0xf1 = null, 0xf0 != null - // There may be a gap between the end of the record data and the - // start of the null field byte map. - int numFields = records[r-1].getNumberOfFields(); - - if (maxNumberOfFieldsPerFormatInFile == -1) //@A3A - { //@A3A - maxNumberOfFieldsPerFormatInFile = numFields; //@A3A - } //@A3A - - - for (int f = 0, fieldOffset = offset + //@A3C - (recordIncrement - maxNumberOfFieldsPerFormatInFile); f < numFields; fieldOffset++, f++) - { - recordData[fieldOffset] = - (records[r-1].isNullField(f) ? (byte) 0xf1 : (byte) 0xf0); - } - - // If we've accumulated the data from blocking factor records or - // have added data from the last record, PUT the record data. - if (r == records.length && r > blockingFactor_ && r % blockingFactor_ != 0) //@C0C - { - byte[] dataToWrite = new byte[offset + recordIncrement]; - System.arraycopy(recordData, 0, dataToWrite, 0, dataToWrite.length); - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - // PUT - put(handle_, null, null, dataToWrite); - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - } - else if (r == records.length || (r % blockingFactor_ == 0)) //@C0C - { - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - // PUT - put(handle_, null, null, recordData); - } - catch(NativeException e) - { - // Parse the message feedback data and throw AS400Exception - throw new AS400Exception(parseMsgFeedback(e.data)); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - - // Reset the offset. - offset = 0; - } - else - { - // Increment the offset. - offset += recordIncrement; - } - } - } -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400FileImplProxy.java b/cvsroot/src/com/ibm/as400/access/AS400FileImplProxy.java deleted file mode 100644 index e2e8fb46a..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400FileImplProxy.java +++ /dev/null @@ -1,189 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400FileImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.io.IOException; - -class AS400FileImplProxy extends AbstractProxyImpl implements AS400FileImpl -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - - public AS400FileImplProxy() - { - super("AS400File"); - } - - - public void doIt(String methodName, Class[] classes, Object[] objects) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - try - { - connection_.callMethod(pxId_, methodName, classes, objects); - } - catch(InvocationTargetException e) - { - throw ProxyClientConnection.rethrow4a(e); - } - } - - - public boolean doItBoolean(String methodName) - { - try - { - return connection_.callMethod(pxId_, methodName).getReturnValueBoolean(); - } - catch(InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - - //@E0A - public boolean doItBoolean(String methodName, Class[] classes, Object[] objects) - { - try - { - return connection_.callMethod(pxId_, methodName, classes, objects).getReturnValueBoolean(); - } - catch(InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - - public int doItInt(String methodName) - { - try - { - return connection_.callMethod(pxId_, methodName).getReturnValueInt(); - } - catch(InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - - public void doItNoExceptions(String methodName, Class[] classes, Object[] objects) - { - try - { - connection_.callMethod(pxId_, methodName, classes, objects); - } - catch(InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - - public Record doItRecord(String methodName, Class[] classes, Object[] objects) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - try - { - return (Record)connection_.callMethod(pxId_, methodName, classes, objects).getReturnValue(); - } - catch(InvocationTargetException e) - { - throw ProxyClientConnection.rethrow4a(e); - } - } - - - public Record[] doItRecordArray(String methodName, Class[] classes, Object[] objects) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - try - { - return (Record[])connection_.callMethod(pxId_, methodName, classes, objects).getReturnValue(); - } - catch(InvocationTargetException e) - { - throw ProxyClientConnection.rethrow4a(e); - } - } - - //@B2A - public RecordFormat doItRecordFormat(String methodName, Class[] classes, Object[] objects) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - try - { - return (RecordFormat)connection_.callMethod(pxId_, methodName, classes, objects).getReturnValue(); - } - catch(InvocationTargetException e) - { - throw ProxyClientConnection.rethrow4a(e); - } - } - - public AS400Message[] execute(String command) throws AS400SecurityException, InterruptedException, IOException - { - try - { - return (AS400Message[])connection_.callMethod(pxId_, "execute", new Class[] { String.class }, new Object[] { command }).getReturnValue(); - } - catch(InvocationTargetException e) - { - throw ProxyClientConnection.rethrow3(e); - } - } - - public int[] getExplicitLocks() - { - try - { - return (int[])connection_.callMethod(pxId_, "getExplicitLocks").getReturnValue(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - - public String[] openFile2(int openType, int bf, int level, boolean access) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - try - { - return (String[])connection_.callMethod(pxId_, "openFile2", - new Class[] { Integer.TYPE, Integer.TYPE, Integer.TYPE, Boolean.TYPE }, - new Object[] { new Integer(openType), new Integer(bf), new Integer(level), new Boolean(access) }).getReturnValue(); - } - catch(InvocationTargetException e) - { - throw ProxyClientConnection.rethrow4a(e); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400FileImplRemote.java b/cvsroot/src/com/ibm/as400/access/AS400FileImplRemote.java deleted file mode 100644 index 62e4f95ed..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400FileImplRemote.java +++ /dev/null @@ -1,2207 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400FileImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// -// @A2 - 09/19/2007 - The NULL Field Byte Map array must be set based on the -// maximum number of fields for any format in a given file. Refer to -// more detailed explanation for the corresponding changes in -// DDMObjectDataStream.java (@A1) -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.net.UnknownHostException; -import java.util.Vector; -import java.math.BigDecimal; //@D0A 7/15/99 -import java.lang.Math; //@A2A - -class AS400FileImplRemote extends AS400FileImplBase implements Serializable //@C0C -{ - static final long serialVersionUID = 4L; - - - //------------------------------------------------------- - // VARIABLES - //------------------------------------------------------- - // Flag indicating to ignore replys (used by close and execute). - //@D1D (moved to AS400FileImplBase) private boolean discardReplys_ = false; - // The declared file name. This is an alias for the file which allows - // DDM to process some file requests more quickly. The declared file name is - // determined upon construction and set when the file is opened. - byte[] dclName_ = new byte[8]; - - // Static variable used to ensure that each AS400File object has a unique - // declared file name. - static long nextDCLName_ = 1; - static final Object nextDCLNameLock_ = new Object(); - - // S38BUF data for force end of data calls. Contain S38BUF LL, CP and value. - // @F1 - also use this for locking - static private byte[] s38Buffer = {0x00, 0x05, (byte)0xD4, 0x05, 0x00}; - - // Server - transient AS400Server server_ = null; - - // @B1A - private static int lastCorrelationId_ = 0; //@B6C - private static Object correlationIdLock_ = new Object(); //@B6A - - // Identify the DDM reply data streams to the AS400Server class. - static - { - AS400Server.addReplyStream(new DDMObjectDataStream(), AS400.RECORDACCESS); //@B5C - AS400Server.addReplyStream(new DDMReplyDataStream(), AS400.RECORDACCESS); //@B5C - } - - // Instantiate a default AS400File remote implementation object. - public AS400FileImplRemote() - { - setDCLName(); - } - - - /** - *Closes the file on the server. All file locks held by this connection - *are released. All - *uncommitted transactions against the file are rolled back if commitment - *control has been started. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the - *server. - **/ - public void close() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - super.close(); //@C0A - - // Send the close file data stream request - if (discardReplys_ && (server_ != null)) - { - synchronized(server_) //@F1A - { //@F1A - server_.sendAndDiscardReply(DDMRequestDataStream.getRequestS38CLOSE(dclName_)); - } //@F1A - } - else - { - Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38CLOSE(dclName_), /*server_.*/newCorrelationId()); // @B1M - // Reply expected: S38MSGRM, severity code 0 - if (!(replys.size() == 1 && verifyS38MSGRM((DDMDataStream)replys.elementAt(0), null, 0))) - { - handleErrorReply(replys, 0); - } - } - } - - /** - *Commits all transactions since the last commit boundary. Invoking this - *method will cause all transactions under commitment control for this - *connection to be committed. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped - *unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the - *server. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - **/ - public void commit() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Connect to the server. Note: If we have already connected, that connection - // will be used. - connect(); - - // Send the commit data stream request - Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestCMMUOW(), newCorrelationId()); //@B6C - // Reply expected: ENDUOWRM, with UOWDSP parameter = 1 - if (replys.size() == 1 && ((DDMDataStream)replys.elementAt(0)).getCodePoint() == DDMTerm.ENDUOWRM) - { - // Check the UOWDSP term value - DDMEndUnitOfWorkReply uowReply = new DDMEndUnitOfWorkReply(((DDMDataStream)replys.elementAt(0)).data_); - if (uowReply.getStatus() != 0x01) - { - // Status of logical unit of work committed not returned; should not happen unless - // we are constructing the request wrong. - Trace.log(Trace.ERROR, "Wrong status returned from commit ds", uowReply.data_); - throw new InternalErrorException(InternalErrorException.UNKNOWN, uowReply.getStatus()); - } - } - else - { - handleErrorReply(replys, 0); - } - } - - /** - *Connects to the server. The name and system must have been - *set at this point via the constructor or the setters. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped - *unexpectedly. - *@exception IOException If an error occurs while communicating with the - *server. - *@exception InterruptedException If this thread is interrupted. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - **/ - public void connect() - throws AS400SecurityException, ConnectionDroppedException, IOException, - InterruptedException, ServerStartupException, UnknownHostException - { - if (server_ == null) - { - server_ = system_.getConnection(AS400.RECORDACCESS, false); //@C0C @B5C - } - } - - - - //@D0M 7/15/99 - Moved this code out of ImplBase to here - /** - *Creates the DDS source file to be used to create a physical file based on a user - *supplied RecordFormat.
    - *The name of the file and the server to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@param recordFormat The record format to describe in the DDS source file. - *@param altSeq The value to be specified for the file-level keyword ALTSEQ. If no - *value is to be specified, null may be specified. - *@param ccsid The value to be specified for the file-level keyword CCSID. If no - *value is to be specified, null may be specified. - *@param order The value to be specified to indicate in which order records are to be - *retrieved from the file. Valid values are one of the following file-level keywords: - *
      - *
    • FIFO - First in, first out - *
    • LIFO - Last in, first out - *
    • FCFO - First changed, first out - *
    - *If no ordering value is to be specified, null may be specified. - *@param ref The value to be specified for the file-level keyword REF. If no - *value is to be specified, null may be specified. - *@param unique Indicates if the file-level keyword UNIQUE is to be specified. True - *indicates that the UNIQUE keyword should be specified; false indicates that it - *should not be specified. - *@param format The value to be specified for the record-level keyword FORMAT. If no - *value is to be specified, null may be specified. - *@param text The value to be specified for the record-level keyword TEXT. If no - *value is to be specified, null may be specified. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - **/ - public synchronized void createDDSSourceFile(RecordFormat recordFormat, - String altSeq, - String ccsid, - String order, - String ref, - boolean unique, - String format, - String text) - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // Create the source physical file to hold the DDS source. Note that we create the - // file in library QTEMP. Each server job has its own QTEMP library which is created - // when the job starts and is deleted when the job ends. Using QTEMP allows - // the file to be created regardless of the user's authority and also eliminates - // name collision problems when different jobs are creating files from a record - // format. - AS400Message[] msgs = execute("QSYS/CRTSRCPF FILE(QTEMP/JT400DSSRC) RCDLEN(92) MBR(*FILE) TEXT('JT400 TEMPORARY DDS SOURCE FILE')"); //@B0C @F0C - if (msgs.length > 0) - { - if (msgs[0].getID().equals("CPF5813")) - { - // File already exists from a previous create; clear it. - msgs = execute("QSYS/CLRPFM QTEMP/JT400DSSRC"); //@B0C - if (msgs.length > 0) - { - if (!msgs[0].getID().equals("CPC3101")) // "member cleared" - { - // Clear failed. Throw exception. - Trace.log(Trace.ERROR, "QSYS/CLRPFM QTEMP/JT400DSSRC"); - throw new AS400Exception(msgs); - } - } - else - { - Trace.log(Trace.ERROR, "No messages were returned from QSYS/CLRPFM QTEMP/JT400DSSRC"); - throw new InternalErrorException("QTEMP/JT400DSSRC", InternalErrorException.UNKNOWN); - } - } - else if (!msgs[0].getID().equals("CPC7301")) - { - // File does not exist and we were unable to create; throw exception - // (CPC7301 = Successful create) - Trace.log(Trace.ERROR, "QSYS/CRTSRCPF FILE(QTEMP/JT400DSSRC) RCDLEN(92) MBR(*FILE) TEXT('JT400 TEMPORARY DDS SOURCE FILE')"); //@F0C - throw new AS400Exception(msgs); - } - } - else - { - // No messages. This shouldn't happen. - Trace.log(Trace.ERROR, "No messages from server."); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - - //------------------------------------------------------- - // Create the records to be written to the file. These records will contain the - // DDS based on the supplied RecordFormat object. - //------------------------------------------------------- - // Create a RecordFormat object which describes the record format of a source - // physical file. - RecordFormat srcRF = new RecordFormat("JT400DSSRC"); - srcRF.addFieldDescription(new ZonedDecimalFieldDescription(new AS400ZonedDecimal(6, 2), "SRCSEQ")); - srcRF.addFieldDescription(new ZonedDecimalFieldDescription(new AS400ZonedDecimal(6, 0), "SRCDAT")); - // - Can't use the system object here because we have no way of filling in the converter - srcRF.addFieldDescription(new CharacterFieldDescription(new AS400Text(80, system_.getCcsid()), "SRCDTA")); //@D0C - Vector lines = new Vector(); // Contains DDS lines to write to source file - String line; // A single line of DDS source - // Create line(s) for any file level keywords - file level keywords must precede - // the line specifying the record format name. - if (altSeq != null) - { - line = STR44 + "ALTSEQ(" + altSeq + ")"; - lines.addElement(line); - } - if (ccsid != null) - { - line = STR44 + "CCSID(" + ccsid + ")"; - lines.addElement(line); - } - if (order != null) - { - line = STR44 + order; - lines.addElement(line); - } - if (ref != null) - { - line = STR44 + "REF(" + ref + ")"; - lines.addElement(line); - } - if (unique) - { - line = STR44 + "UNIQUE"; - lines.addElement(line); - } - - // Create line for the record format name - line = STR16 + "R "; - // The record format name cannot exceed 10 characters and must be in upper case - if (recordFormat.getName().length() > 10) - { - if (Trace.traceOn_) - { - Trace.log(Trace.WARNING, "Record format name '"+recordFormat.getName()+"' too long. Using '"+recordFormat.getName().substring(0,10)+"' instead."); - } - line += recordFormat.getName().substring(0, 10); - } - else - { - line += recordFormat.getName(); - } - lines.addElement(line); - - // Create line(s) for any record level keywords. The record level keywords - // must be on the same line or on the lines immediately following the record - // format line. - if (format != null) - { - line = STR44 + "FORMAT(" + format + ")"; - lines.addElement(line); - } - if (text != null) - { - if (text.length() > 32) - { // Text exceeds length left on line - need to continue on next line - line = STR44 + "TEXT('" + text.substring(0, 33) + "-"; - lines.addElement(line); - // Add the remainder of the TEXT keyword - line = STR44 + text.substring(34) + "')"; - lines.addElement(line); - } - else - { // Text fits on one line - line = STR44 + "TEXT('" + text + "')"; - lines.addElement(line); - } - } - - // Create lines for each field description and any keywords for the field - int numberOfFields = recordFormat.getNumberOfFields(); - FieldDescription f = null; - String ddsDesc; - String[] dds = null; - int length; - int beginningOffset; - for (int i = 0; i < numberOfFields; ++i) - { - f = recordFormat.getFieldDescription(i); - // Specify the DDS description of the field. The DDS description returned - // from FieldDescription contains the field level keywords as well as the - // description of the field. It is formatted properly for DDS except for - // the preceding blanks. Therefore, we add 18 blanks so that the field - // description starts in column 19 of the line. - dds = f.getDDSDescription(); - // Add the fixed portion of the DDS description for the field to the vector - ddsDesc = STR18 + dds[0]; - lines.addElement(ddsDesc); - // Add lines containing field level keywords - for (int j = 1; j < dds.length; ++j) - { - ddsDesc = STR44 + dds[j]; - length = ddsDesc.length(); - beginningOffset = 0; - if (length > 80) - { // Need to continue the line on the next line - line = ddsDesc.substring(beginningOffset, 79) + "-"; - lines.addElement(line); - length -= 79; - beginningOffset = 79; - line = STR44 + ddsDesc.substring(beginningOffset); - lines.addElement(line); - } - else - { // It all fits on one line - lines.addElement(ddsDesc); - } - } - } - // Create lines for key fields and key field level keywords - numberOfFields = recordFormat.getNumberOfKeyFields(); - for (int i = 0; i < numberOfFields; ++i) - { - f = recordFormat.getKeyFieldDescription(i); - // Specify the name of the field - line = STR16 + "K "; - line += f.getDDSName(); - lines.addElement(line); - // Specify any key field level keywords - String[] keyFuncs = f.getKeyFieldFunctions(); - if (keyFuncs != null) - { - for (short j = 0; j < keyFuncs.length; ++j) - { - line = STR44 + keyFuncs[j]; - lines.addElement(line); - } - } - } - - // Create an array of records representing each line to be written - // to the file. - Record[] records = new Record[lines.size()]; - for (int i = 0; i < records.length; ++i) - { - records[i] = srcRF.getNewRecord(); - records[i].setField("SRCSEQ", new BigDecimal(i)); - - records[i].setField("SRCDAT", new BigDecimal(i)); - records[i].setField("SRCDTA", lines.elementAt(i)); - } - - // Open the DDS source file and write the records. We will write all the records - // at one time, so we specify a blocking factor of records.length on the open(). - AS400FileImplRemote src = null; //@B5C @D0C 7/15/99 - try - { - //@B5D src = new SequentialFile(system_, "/QSYS.LIB/QTEMP.LIB/JT400DSSRC.FILE"); - //@B5 - Can't create a new AS400FileImplBase because it's abstract. - //@B5 - Other alternative is to create a new ImplRemote or - // ImplNative based on the type of this. But can't create - // a new AS400FileImplNative since it doesn't exist at - // compile time. -//@D0D 7/15/99 src = (AS400FileImplBase)this.clone(); //@B5A - //@B5D try - //@B5D { - //@B5D src.setRecordFormat(srcRF); - //@B5D } - //@B5D catch(PropertyVetoException e) - //@B5D { // This is to quiet the compiler - //@B5D } - src = new AS400FileImplRemote(); //@D0A 7/15/99 - src.setAll(system_, "/QSYS.LIB/QTEMP.LIB/JT400DSSRC.FILE", srcRF, false, false, false); //@B5A - - //@B5D src.open(AS400File.WRITE_ONLY, records.length, AS400File.COMMIT_LOCK_LEVEL_NONE); - src.openFile2(AS400File.WRITE_ONLY, records.length, AS400File.COMMIT_LOCK_LEVEL_NONE, false); //@B5A - src.write(records); - // Close the file - src.close(); - } - catch (Exception e) - { // log error and rethrow exception - Trace.log(Trace.ERROR, "Unable to write records to DDS source file:", e); - try - { - if (src != null) - { - src.close(); - } - } - catch (Exception e1) - { // Ignore it; we will throw the original exception - } - if (e instanceof AS400Exception) - { - throw (AS400Exception) e; - } - else - { - Trace.log(Trace.ERROR, e); - throw new InternalErrorException(InternalErrorException.UNKNOWN, e.getMessage()); - } - } - } - - - /** - *Deletes the record at the current cursor position. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void deleteCurrentRecord() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - connect(); - - // Send the delete record data stream request - Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38DEL(dclName_), newCorrelationId()); //@B6C - // Reply expected: S38IOFB - if (!(replys.size() == 1 && ((DDMDataStream)replys.elementAt(0)).getCodePoint() == DDMTerm.S38IOFB)) - { - handleErrorReply(replys, 1); - } - } - - - /** - Executes a command on the server. - @param cmd the command - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public AS400Message[] execute(String cmd) - throws AS400SecurityException, InterruptedException, IOException - { - connect(); - - // Send the submit command data stream request - Vector replys = null; - if (discardReplys_) - { - synchronized(server_) //@F1A - { //@F1A - server_.sendAndDiscardReply(DDMRequestDataStream.getRequestS38CMD(cmd, system_)); //@C0C - } //@F1A - } - else - { - replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38CMD(cmd, system_), newCorrelationId()); //@C0C @B6C - } - - return processReplys(replys); - } - - - /** - *Throws an appropriate exception based on the type of reply - *data stream specified. - *@param replys The replys to be checked to determine the error. - *@param index The index within replys at which to start. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void handleErrorReply(Vector replys, int index) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - int size = replys.size(); - DDMDataStream reply; - int codePoint; - Vector as400MsgList = new Vector(); - - for (int i = index; i < size; ++i) - { - reply = (DDMDataStream)replys.elementAt(i); - codePoint = reply.getCodePoint(); - switch (codePoint) - { - case DDMTerm.S38MSGRM: - // Because we will normally get more than one AS400Message for an - // error condition, we build a vector of AS400Message arrays and - // throw an AS400Exception with all messages once we have finished - // parsing the replies. Note that the DDMAS400MessageReply class - // extracts all the server messages contained in reply.data_. I.e. - // a single reply may contain more than one message. - DDMAS400MessageReply msgReply = new DDMAS400MessageReply(system_, reply.data_); //@C0C - as400MsgList.addElement(msgReply.getAS400MessageList()); - break; - // If any of the following cases occur, we throw the exception and are done. - case DDMTerm.AGNPRMRM: - case DDMTerm.CMDCHKRM: - case DDMTerm.CMDNSPRM: - case DDMTerm.DCLNAMRM: - case DDMTerm.PRCCNVRM: - case DDMTerm.PRMNSPRM: - case DDMTerm.RSCLMTRM: - case DDMTerm.SYNTAXRM: - case DDMTerm.VALNSPRM: - Trace.log(Trace.ERROR, "handleErrorReply()", reply.data_); - throw new InternalErrorException(InternalErrorException.UNKNOWN, codePoint); - default: - // We don't know what the reply is. Throw exception and be done. - Trace.log(Trace.ERROR, "handleErrorReply()", reply.data_); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN, codePoint); - } - } - // If we get to here, we should have a list of messages to throw - if (as400MsgList.size() > 0) - { - // We need to expand out the Vector of AS400Message[]'s to individual - // AS400Message's in a single array in order to construct our AS400Exception. - int numberOfMessages = 0; - int msgListSize = as400MsgList.size(); - int msgNumber = 0; - // Determine number of AS400Message objects we have - for (int i = 0; i < msgListSize; ++i) - { - numberOfMessages += ((AS400Message[])as400MsgList.elementAt(i)).length; - } - // Now populate the single AS400Message[] with the AS400Message objects - AS400Message[] msgs = new AS400Message[numberOfMessages]; - AS400Message[] m; - for (int i = 0; i < msgListSize; ++i) - { - m = (AS400Message[])as400MsgList.elementAt(i); - for (int j = 0; j < m.length; ++j) - { - msgs[msgNumber++] = m[j]; - } - } - throw new AS400Exception(msgs); - } - Trace.log(Trace.ERROR, "No messages from server."); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - - /** - *Logs warning messages if tracing is on. This method should be used to log - *warning messages (trace.WARNING) when an operation is successful yet additional - *AS400 messages are sent with the reply. - *@param v The vector of replies containing messages to log. - *@param index The index into v at which to stop pulling out messages. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void logWarningMessages(Vector v, int index) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (Trace.traceOn_) - { - DDMAS400MessageReply msg; - for (int i = 0; i < index; ++i) - { - msg = new DDMAS400MessageReply(system_, ((DDMDataStream)v.elementAt(i)).data_); //@C0C - AS400Message[] msgs = msg.getAS400MessageList(); - Trace.log(Trace.WARNING, "AS400FileImplRemote.logWarningMessages():"); - for (int j = 0; j < msgs.length; ++j) - { - Trace.log(Trace.WARNING, msgs[j].toString()); - } - } - } - } - - /** - *Looks for a particular code point in a vector of data streams. - *@param cp The code point for which to look. - *@param v The data streams in which to look. - *@return The index of the datastream in v in which the code point was found. - *If the code point is not found, -1 is returned. - **/ - private int lookForCodePoint(int cp, Vector v) - { - int index = -1; - int size = v.size(); - DDMDataStream ds; - int offset; - // Search each datastream in v for the code point. - for (int i = 0; i < size && index == -1; ++i) - { - ds = (DDMDataStream)v.elementAt(i); - offset = 8; - // Search through all the code points in an element of v for cp. - while (index == -1 && offset < ds.data_.length) - { - if (ds.get16bit(offset) == cp) - { // Found the code point - index = i; - } - else - { // Move on to the next code point - offset += ds.get16bit(offset - 2); - } - } - } - return index; - } - - - /** - *Opens the file. Helper function to open file for keyed or - *sequential files. - *@param openType - *@param bf blocking factor - *@param access The type of file access for which to open the file. - *@return the open feedback data - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - *@exception ServerStartupException If the host server cannot be started.. - *@exception UnknownHostException If the server cannot be located. - **/ - public DDMS38OpenFeedback openFile(int openType, int bf, String access) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Ensure that we are connected to the server. - connect(); - - // Create the user file control block. - byte[] ufcb = createUFCB(openType, bf, access, false); - - // Send the open file data stream request - Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38OPEN(ufcb, dclName_), newCorrelationId()); //@B6C - // Reply expected: S38OPNFB - int index = lookForCodePoint(DDMTerm.S38OPNFB, replys); - DDMDataStream reply; - if (index != -1) - { - reply = (DDMDataStream)replys.elementAt(index); - openFeedback_ = new DDMS38OpenFeedback(system_, reply.data_); //@C0C - if (Trace.traceOn_) - { - Trace.log(Trace.INFORMATION, "AS400FileImplRemote.openFile()\n" + openFeedback_.toString()); - } - if (index != 0) - { // Informational and/or diagnostic messages were issued. Log them. - logWarningMessages(replys, index); - } - } - else - { - handleErrorReply(replys, 0); - } - - return openFeedback_; - } - - /** - *Pads data with padByte numBytes starting at start. - *@param data The data to pad. - *@param start The offset in data at which we begin padding. - *@param numBytes The number of bytes to pad. - *@param padChar The character with which to pad. - **/ - public void padBytes(byte[] data, int start, int numBytes, byte padChar) - { - for (int i = 0; i < numBytes; ++i) - { - data[start + i] = padChar; - } - } - - /** - *Positions the cursor for the file. Which record to position the cursor to is - *determined by the type - *argument. - *@param searchType The type of get to execute. Valid values are: - *
      - *
    • TYPE_GET_FIRST - *
    • TYPE_GET_NEXT - *
    • TYPE_GET_LAST - *
    • TYPE_GET_PREV - *
    • TYPE_GET_SAME - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record[] positionCursorAt(int searchType) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - int shr; // Type of locking for the record - - // @A1C - if ((openType_ == AS400File.READ_ONLY) || //@C0C - ((openType_ == AS400File.READ_WRITE) && readNoUpdate_)) // @A1A //@C0C - { - // Read only - shr = SHR_READ_NORM; - } - else - { // READ_WRITE, lock the record for update - shr = SHR_UPD_NORM; - } - // Send the request to read. Ignore the data; don't specify - // DATA_NODTA_DTARCD because it is one of the most inefficient - // paths per the DDM server guys. More efficient to get the data and ignore - // it they say. - Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38GET(dclName_, searchType, shr, DATA_DTA_DTARCD), newCorrelationId()); //@B6C - int codePoint = ((DDMDataStream)replys.elementAt(0)).getCodePoint(); - if (codePoint == DDMTerm.S38IOFB && replys.size() > 1) - { - handleErrorReply(replys, 1); - } - else if (codePoint != DDMTerm.S38BUF) - { - handleErrorReply(replys, 0); - } - Record[] returned = processReadReply(replys, false); // @A1C - - return returned; - } - - /** - *Positions the file cursor to after the last record. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void positionCursorAfterLast() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // If we are caching records and the cache contains the last record, - // position the cache. Otherwise, position the file and refresh the - // cache if we are caching records. - if (cacheRecords_ && cache_.containsLastRecord()) - { - cache_.setPositionAfterLast(); - return; - } - - if (cacheRecords_) - { - // Invalidate the cache - cache_.setIsEmpty(); - } - - connect(); - - // Send the request to force end of data specifying end of the file for - // positioning. - // Need correlation id as we will be chaining an S38BUF object to this request - // and the ids must match. - int id = newCorrelationId(); //@B6C - DDMRequestDataStream req = DDMRequestDataStream.getRequestS38FEOD(dclName_, TYPE_GET_LAST, SHR_READ_NORM_RLS, DATA_NODTA_DTARCD); - req.setIsChained(true); // We will be chaining an S38BUF to this request - req.setHasSameRequestCorrelation(true); // When chaining, must indicate - // that the correlation ids are - // the same. - Vector replys = null; - try - { - synchronized(server_) //@F1A - both datastreams must be written atomically - { //@F1A - server_.send(req, id); // Send the S38FEOD request - // Although the S38FEOD term description states that - // the S38BUF object is optional, it is not for our purposes. - // Create an empty S38BUF object to send after the S38FEOD - DDMObjectDataStream s38buf = new DDMObjectDataStream(11); - // The class contains static variable s38Buffer which is the S38BUF term with - // a value of 1 byte set to 0x00. - System.arraycopy(s38Buffer, 0, s38buf.data_, 6, 5); - // Send the S38BUF - replys = sendRequestAndReceiveReplies(s38buf, id); - } //@F1A - } - catch (ConnectionDroppedException e) - { - // Connection dropped. Disconnect server and rethrow. - Trace.log(Trace.ERROR, "ConnectionDroppedException:", e); - system_.disconnectServer(server_); //@C0C -//@C1 - Setting the server_ object to null means that -// any operations on this AS400File object after the connection has been -// dropped will result in a NullPointerException. By leaving the server_ object -// around, any subsequent operations should also throw a ConnectionDroppedException. -//@C1D server_ = null; - resetState(); - throw e; - } - - // Reply expected: S38IOFB, which may be followed by an S38MSGRM - // with id CPF5001 which indicates that the end of file was reached. - // Any other S38MSGRM replies indicate that an error has occurred. - if (((DDMDataStream)replys.elementAt(0)).getCodePoint() == DDMTerm.S38IOFB) - { - if (replys.size() != 1) - { - if (!verifyS38MSGRM((DDMDataStream)replys.elementAt(1), "CPF5001", 0)) - { - handleErrorReply(replys, 1); - } - } - } - else - { - handleErrorReply(replys, 0); - } - } - - /** - *Positions the file cursor to before the first record. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void positionCursorBeforeFirst() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // If we are caching records and the cache contains the first record, - // position the cache. Otherwise, position the file and refresh the - // cache if we are caching records. - if (cacheRecords_ && cache_.containsFirstRecord()) - { - cache_.setPositionBeforeFirst(); - return; - } - - if (cacheRecords_) - { // Invalidate the cache - cache_.setIsEmpty(); - } - - - connect(); - - // Send the request to force end of data specifying beginning of the - // file for positioning; this is how we position the cursor to - // before the first record. - // Need correlation id as we will be chaining an S38BUF object to this request - // and the ids must match. - int id = newCorrelationId(); //@B6C - DDMRequestDataStream req = DDMRequestDataStream.getRequestS38FEOD(dclName_, TYPE_GET_FIRST, SHR_READ_NORM_RLS, DATA_NODTA_DTARCD); - req.setIsChained(true); // We will be chaining an S38BUF to this request - req.setHasSameRequestCorrelation(true); // When chaining, must indicate - // that the correlation ids are - // the same. - Vector replys = null; - try - { - synchronized(server_) //@F1A - both datastreams must be written atomically - { //@F1A - server_.send(req, id); // Send the S38FEOD request - // Although the S38FEOD term description states that - // the S38BUF object is optional, it is not for our purposes. - // Create an empty S38BUF object to send after the S38FEOD - DDMObjectDataStream s38buf = new DDMObjectDataStream(11); - // The class contains static variable s38Buffer which is the S38BUF term with - // a value of 1 byte set to 0x00. - System.arraycopy(s38Buffer, 0, s38buf.data_, 6, 5); - // Send the S38BUF - replys = sendRequestAndReceiveReplies(s38buf, id); - } //@F1A - } - catch (ConnectionDroppedException e) - { - // Connection dropped. Disconnect server and rethrow. - Trace.log(Trace.ERROR, "ConnectionDroppedException:", e); - system_.disconnectServer(server_); //@C0C -//@C1 - Setting the server_ object to null means that -// any operations on this AS400File object after the connection has been -// dropped will result in a NullPointerException. By leaving the server_ object -// around, any subsequent operations should also throw a ConnectionDroppedException. -//@C1D server_ = null; - resetState(); - throw e; - } - // Reply expected: S38IOFB, which may be followed by an S38MSGRM - // with id CPF5001 which indicates that the end of file was reached. - // Any other S38MSGRM replies indicate that an error has occurred. - if (((DDMDataStream)replys.elementAt(0)).getCodePoint() == DDMTerm.S38IOFB) - { - if (replys.size() != 1) - { - if (!verifyS38MSGRM((DDMDataStream)replys.elementAt(1), "CPF5001", 0)) - { - handleErrorReply(replys, 1); - } - } - } - else - { - handleErrorReply(replys, 0); - } - } - - - /** - *Positions the file cursor to the specified record number in the file on the server. - *@param recordNumber The record number to which to position the file cursor. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record positionCursorToIndex(int recordNumber) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - int shr; // Type of locking for the record - - if (cacheRecords_ && !cache_.setPosition(recordNumber)) //@G0A - { - // Invalidate the cache - cache_.setIsEmpty(); //@G0A - } - - // @A1C - if ((openType_ == AS400File.READ_ONLY) || //@C0C - ((openType_ == AS400File.READ_WRITE) && readNoUpdate_)) // @A1A //@C0C - { - // Read only - shr = SHR_READ_NORM; - } - else - { // READ_WRITE; get for update - shr = SHR_UPD_NORM; - } - // Send the request to read. Specify 0x08 for type - // to indicate that the record number is determined from the start of the file. - // Note that even though we are only positioning the cursor, we must specify - // DATA_DTA_DTARCD which causes the record to be retrieved. This is because - // the cursor will not be positioned properly if we do not actually get the - // record. This situation occurs when accessing by record number or by key but - // not when accessing sequentially. -// Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38GETD(dclName_, recordFormat_, 0x08, shr, DATA_DTA_DTARCD, recordNumber, system_), server_.newCorrelationId()); // @A1D //@C0C - Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38GETD(dclName_, recordFormatCTLLName_, 0x08, shr, DATA_DTA_DTARCD, recordNumber, system_), newCorrelationId()); // @A1A //@C0C @B6C - - // Reply expected: S38BUF - int codePoint = ((DDMDataStream)replys.elementAt(0)).getCodePoint(); - if (codePoint == DDMTerm.S38IOFB && replys.size() > 1) - { - handleErrorReply(replys, 1); - } - else if (codePoint != DDMTerm.S38BUF) - { - handleErrorReply(replys, 0); - } - Record[] returned = processReadReply(replys, false); // @A1C - return returned[0]; // @A1A -// return null; // @A1D - } - - /** - *Positions the cursor to the first record with the specified key based on the specified - *type of read. - *@param key The values that make up the key with which to find the record. - *@param searchType The type of read. This value is one of the TYPE_GETKEY_* constants. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record positionCursorToKey(Object[] key, int searchType) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - int shr; // Type of locking for the record - - if (cacheRecords_) //@G0A - { - // Invalidate the cache - cache_.setIsEmpty(); //@G0A - } - - // @A1C - if ((openType_ == AS400File.READ_ONLY) || //@C0C - ((openType_ == AS400File.READ_WRITE) && readNoUpdate_)) // @A1A //@C0C - { - // Read only - shr = SHR_READ_NORM; - } - else - { // READ_WRITE - shr = SHR_UPD_NORM; - } - // In order to have the file cursor remain properly positioned, we specify that the record - // is to be returned on the GETK request as opposed to specifying DATA_NODTA_DTARCD. This - // is necessary for the caching support. -// Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38GETK(dclName_, recordFormat_, type, shr, DATA_DTA_DTARCD, key, system_), server_.newCorrelationId()); // @A1D - Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38GETK(dclName_, recordFormat_, recordFormatCTLLName_, searchType, shr, DATA_DTA_DTARCD, key, system_), newCorrelationId()); // @A1A @B6C - - int codePoint = ((DDMDataStream)replys.elementAt(0)).getCodePoint(); - if (codePoint == DDMTerm.S38IOFB && replys.size() > 1) - { - handleErrorReply(replys, 1); - } - else if (codePoint != DDMTerm.S38BUF) - { - handleErrorReply(replys, 0); - } -// Record[] returned = processReadReply(replys, true); // @A1C -// return returned[0]; // @A1D - processReadReply(replys, true); // @A1C - return null; // @A1A - } - - - // @A1A - /** - *Positions the cursor to the first record with the specified key based on the specified - *type of read. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *@param searchType The type of read. This value is one of the TYPE_GETKEY_* constants. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record positionCursorToKey(byte[] key, int searchType, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - int shr; // Type of locking for the record - - if (cacheRecords_) //@G0A - { - // Invalidate the cache - cache_.setIsEmpty(); //@G0A - } - - if ((openType_ == AS400File.READ_ONLY) || - ((openType_ == AS400File.READ_WRITE) && readNoUpdate_)) // @A1A - { - // Read only - shr = SHR_READ_NORM; - } - else - { // READ_WRITE - shr = SHR_UPD_NORM; - } - // In order to have the file cursor remain properly positioned, we specify that the record - // is to be returned on the GETK request as opposed to specifying DATA_NODTA_DTARCD. This - // is necessary for the caching support. -// Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38GETK(dclName_, recordFormat_, type, shr, DATA_DTA_DTARCD, key, system_, numberOfKeyFields), server_.newCorrelationId()); // @A1D - Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38GETK(dclName_, recordFormatCTLLName_, searchType, shr, DATA_DTA_DTARCD, key, system_, numberOfKeyFields), newCorrelationId()); // @A1A @B6C - int codePoint = ((DDMDataStream)replys.elementAt(0)).getCodePoint(); - if (codePoint == DDMTerm.S38IOFB && replys.size() > 1) - { - handleErrorReply(replys, 1); - } - else if (codePoint != DDMTerm.S38BUF) - { - handleErrorReply(replys, 0); - } -// Record[] returned = processReadReply(replys, true); // @A1C -// return returned[0]; // @A1D - processReadReply(replys, true); // @A1C - return null; // @A1A - } - - - - - /** - *Processes the replys vector for records read. Throws exceptions - *in error cases. - *@param replys The reply datastream(s) containing the record(s) read. - *@return The records read from the system. Returns null if no records were - *read. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ -// Record[] processReadReply(Vector replys) // @A1D - public Record[] processReadReply(Vector replys, boolean discardRecords) // @A1A - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - Record[] returned = null; // Will contain the records read. - int recordIncrement = openFeedback_.getRecordIncrement(); - - // The format of the reply(s) should be one or more S38BUF objects - // followed by an S38IOFB. However if the end of file was reached or - // if the record to be read was not found in the file, an S38IOFB followed - // be an S38MSGRM indicating CPF5006 or CPF5001 will be returned. If this is - // the case, we return null instead of throwing an exception. - // If an error occurs we may get an S38IOFB followed by S38MSGRM objects indicating - // the server errors that occurred. In that case we throw an exception via - // handleErrorReply. If we only get an S38IOFB back, we also throw an - // exception as an error must have occurred. This case should not happen. - int codePoint = ((DDMDataStream)replys.elementAt(0)).getCodePoint(); - if (codePoint == DDMTerm.S38IOFB) - { // The end of file was reached, the record to be read was not found or an - // error occurred. - if (replys.size() > 1) - { - codePoint = ((DDMDataStream)replys.elementAt(1)).getCodePoint(); - if (codePoint == DDMTerm.S38MSGRM) - { // Check for end of file or record not found messages - DDMAS400MessageReply err = new DDMAS400MessageReply(system_, ((DDMDataStream)replys.elementAt(1)).data_); - String msgId = err.getAS400Message().getID(); - if (msgId.equals("CPF5006") || msgId.equals("CPF5001")) - { // End of file reached or record not found; return null record - return returned; - } - else - { // Error occurred - handleErrorReply(replys, 1); - } - } - else - { // Some other error (other than an error) occurred - handleErrorReply(replys, 1); - } - } - else - { // Only an S38IOFB object was returned. Error situation. Should not occur. - handleErrorReply(replys, 0); - } - } - else if (codePoint == DDMTerm.S38BUF) - { - if (discardRecords) - { // @A1A - return returned; // @A1A - } // @A1A - - // Records were read. Extract format them - // Extract the returned records and the io feedback info - // The S38IOFB will be the last object in the reply(s) - DDMDataStream reply = (DDMDataStream)replys.elementAt(0); - DDMS38IOFB ioFeedback; - boolean largeBuffer; - // If the length of the S38BUF term is greater than 0x7FFF, there - // will be an extra 4 bytes after the S38BUF code point which indicate the length of - // the S38BUF data. We need to special handle these instances, so we use largeBuffer - // to indicate when such a case has occurred. - largeBuffer = (reply.get16bit(6) <= 0x7FFF)? false : true; - if (reply.isChained()) - { // The IO feedback is in the next reply. The S38IOFB data starts at offset - // 10 in the next reply. - ioFeedback = new DDMS38IOFB(((DDMDataStream)replys.elementAt(1)).data_, 10); - } - else - { // The io feedback info is in this reply. - // if (largeBuffer) - // The length of the record data is in the 4 bytes following the S38BUF - // code point. The S38IOFB data will start at that length + 6 for the header, - // + 8 for the S38BUF LL-CP-extra LL, + 4 for the S38IOFB LL-CP. - // else - // The length of the record data is contained in the LL preceding - // the S38BUF codepoint. The S38IOFB data will start at that length + 6 - // for the header, + 4 for the LL-CP of the S38BUF, + 4 for the S38IOFB LL-CP. - int offset = (largeBuffer)? reply.get32bit(10) + 18 : reply.get16bit(6) + 10; - ioFeedback = new DDMS38IOFB(reply.data_, offset); - } - - // Extract the record(s) returned; because we are in the if (S38BUF code point found) - // code, we know that there was at least one record returned. - // The S38IOFB contains the number of records read. - int numberOfRecords = ioFeedback.getNumberOfRecordsReturned(); - returned = new Record[numberOfRecords]; - - // if (largeBuffer), the S38BUF CP is followed by 4 bytes of record length info, - // then the record data; otherwise the record data follows the code point - int recordOffset = (largeBuffer)? 14 : 10; - // Determine the offset of the record number within the S38BUF for each record. - // The S38IOFB contains the record length for the record(s). The record length - // consists of the length of the data plus a variable size gap plus the null byte - // field map. The record number offset is 2 bytes more than the record length. - int recordNumberOffset = recordOffset + ioFeedback.getRecordLength() + 2; - // Determine the null byte field map offset. When we opened the file, the - // the S38OPNFB reply contained the offset of the null byte field map in a record. - int nullFieldMapOffset = recordOffset + openFeedback_.getNullFieldByteMapOffset(); - // Determine the number of fields in a record from the RecordFormat for this file. - int numFields = recordFormat_.getNumberOfFields(); - // If the file has null capable fields, we will need to check the null byte field - // map and set the fields within the Record object as appropriate. - boolean isNullCapable = openFeedback_.isNullCapable(); - - for (int i = 0; i < numberOfRecords; ++i) - { // Extract the records from the datastream reply. - returned[i] = recordFormat_.getNewRecord(reply.data_, recordOffset + i * recordIncrement); - // Set any null fields to null - if (isNullCapable) - { // File has null capable fields - for (int j = 0; j < numFields; ++j) - { // 0xF1 = field is null, 0xF0 = field is not null - if (reply.data_[nullFieldMapOffset + j + i * recordIncrement] == (byte)0xF1) - { - returned[i].setField(j, null); - } - } - } - // Set the record number. The record number is two bytes after the end of the - // record data and is four bytes long. - try - { - returned[i].setRecordNumber(BinaryConverter.byteArrayToInt(reply.data_, recordNumberOffset + i * recordIncrement)); - } - catch (PropertyVetoException e) - { // We created the Record objects. There is no one to veto anything - - } // so this is here to quit the compiler - } - } - else - { // Error occurred - handleErrorReply(replys, 0); - } - return returned; - } - - /** - Process replys. - @param replys the replys from a request. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public AS400Message[] processReplys(Vector replys) - throws AS400SecurityException, InterruptedException, IOException - { - AS400Message[] msgs = null; - Vector as400MsgList = new Vector(); - - if (replys != null) - { - for (int i = 0; i < replys.size(); ++i) - { - DDMDataStream reply = (DDMDataStream)replys.elementAt(i); - int codePoint = reply.getCodePoint(); - switch (codePoint) - { - case DDMTerm.S38MSGRM: - // Because we will normally get more than one AS400Message for an - // error condition, we build a vector of AS400Message arrays and - // throw an AS400Exception with all messages once we have finished - // parsing the replies. Note that the DDMAS400MessageReply class - // extracts all the server messages contained in reply.data_. I.e. - // a single reply may contain more than one message. - DDMAS400MessageReply msgReply = new DDMAS400MessageReply(system_, reply.data_); - as400MsgList.addElement(msgReply.getAS400MessageList()); - break; - // If any of the following cases occur, we throw the exception and are done. - case DDMTerm.AGNPRMRM: - case DDMTerm.CMDCHKRM: - case DDMTerm.CMDNSPRM: - case DDMTerm.DCLNAMRM: - case DDMTerm.PRCCNVRM: - case DDMTerm.PRMNSPRM: - case DDMTerm.RSCLMTRM: - case DDMTerm.SYNTAXRM: - case DDMTerm.VALNSPRM: - Trace.log(Trace.ERROR, "handleErrorReply()", reply.data_); - throw new InternalErrorException(InternalErrorException.UNKNOWN, codePoint); - default: - // We don't know what the reply is. Throw exception and be done. - Trace.log(Trace.ERROR, "handleErrorReply()", reply.data_); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN, codePoint); - } - } - } - // If we get to here, we should have a list of messages to throw - if (as400MsgList.size() > 0) - { - // We need to expand out the Vector of AS400Message[]'s to individual - // AS400Message's in a single array in order to construct our AS400Exception. - int numberOfMessages = 0; - int msgListSize = as400MsgList.size(); - int msgNumber = 0; - // Determine number of AS400Message objects we have - for (int i = 0; i < msgListSize; ++i) - { - numberOfMessages += ((AS400Message[])as400MsgList.elementAt(i)).length; - } - // Now populate the single AS400Message[] with the AS400Message objects - msgs = new AS400Message[numberOfMessages]; - AS400Message[] m; - for (int i = 0; i < msgListSize; ++i) - { - m = (AS400Message[])as400MsgList.elementAt(i); - for (int j = 0; j < m.length; ++j) - { - msgs[msgNumber++] = m[j]; - } - } - } - - return (msgs == null ? new AS400Message[0] : msgs); - } - - - /** - *Reads the record with the specified record number. - *@param recordNumber The record number of the record to be read. The - *recordNumber must be greater than zero. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record read(int recordNumber) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (cacheRecords_) //@C0A - return super.read(recordNumber); //@C0A - - int shr; // Type of locking for the record - - // @A1C - if ((openType_ == AS400File.READ_ONLY) || - ((openType_ == AS400File.READ_WRITE) && readNoUpdate_)) // @A1A - { - // Read only - shr = SHR_READ_NORM; - } - else - { // READ_WRITE - shr = SHR_UPD_NORM; - } -// Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38GETD(dclName_, recordFormat_, 0x08, shr, DATA_DTA_DTARCD,recordNumber, // @A1D - Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38GETD(dclName_, recordFormatCTLLName_, 0x08, shr, DATA_DTA_DTARCD,recordNumber, system_), newCorrelationId()); // @A1A @B6C - Record[] returned = processReadReply(replys, false); // @A1C - - return(returned == null)? null : returned[0]; - } - - /** - *Reads all the records in the file. Helper function. - *@param fileType The type of file. Valid values are: key or seq - *@return The records read. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - **/ - public Record[] readAll(String fileType, int bf) //@D0C - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { -//@B0A: Changed readAll() to not use the ULDRECF codepoint in the DDM data stream. -// This is because ULDRECF (Unload all records from file) does not handle -// null field values in records. (It throws us a data mapping error on -// the data stream, which would then cause an OutOfMemory exception -// or other strange errors in our code, because the data stream format -// was no longer correct.) -// readAll() now just uses the S38 extensions. It gets the first record -// and then gets the next record in a loop until null is returned. -// Using the S38 extensions gives better performance anyway (supposedly). -// See SequentialFile.readAll() and KeyedFile.readAll() for other changes. -// Other changes were also made in DDMRequestDataStream and DDMTerm. - -//@B0A: start block - - // readAll is supposed to return at least a Record[] of size 0, never null - Record[] recArray = new Record[0]; - - synchronized(this) // We synchronize because this file object - { // isn't supposed to be open (as far as the user knows). - // Use a calculated blocking factor, else use a large blocking factor -//@D0M int bf = 2048/(recordFormat_.getNewRecord().getRecordLength() + 16); //@D0C -//@D0M if (bf <= 0) bf = 1; //@D0C - //@E0 - We don't want to use COMMIT_LOCK_LEVEL_ALL in case commitment control is on because - // inside readAll(), the file isn't supposed to be open, so we should treat it as such. - openFile2(AS400File.READ_ONLY, bf, AS400File.COMMIT_LOCK_LEVEL_NONE, fileType); //@D0C @E0C - - // The vector to hold the records as we retrieve them. - Vector allRecords = new Vector(); - - // The following block was copied from readRecord() - int shr; // Type of locking for the record - if ((openType_ == AS400File.READ_ONLY) || - ((openType_ == AS400File.READ_WRITE) && readNoUpdate_)) - { // Read only - shr = SHR_READ_NORM; - } - else - { // READ_WRITE; get the record for update - shr = SHR_UPD_NORM; - } - - // Get the records - // Initialize returned to be of TYPE_GET_FIRST - // As the loop continues, returned is of TYPE_GET_NEXT - for (Record[] returned = processReadReply(sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38GET(dclName_, TYPE_GET_FIRST, shr, DATA_DTA_DTARCD), newCorrelationId()), false); //@B6C - returned != null; - returned = processReadReply(sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38GET(dclName_, TYPE_GET_NEXT, shr, DATA_DTA_DTARCD), newCorrelationId()), false)) //@B6C - { - // The reply is an array of records, so add each of them to the vector - for (int i=0; i 0) - { - recArray = new Record[numRecs]; - allRecords.copyInto(recArray); - } - close(); // Need to close the file since we opened it earlier. - } // The file is not supposed to be open to the user. - - return recArray; -//@B0A: end block - -//@B0D: start block -/* - // Connect to the server. Note: If we have already connected, that connection - // will be used. - connect(); - // Send the request to read all records. Because the reply object may contain many records - // we need to deal with the possibility of chained replies. - Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestULDRECF(fileType, library_, file_, member_, - system_), server_.newCorrelationId()); - Record[] records = null; - int index = lookForCodePoint(DDMTerm.RECORD, replys); - if (index == -1) - { // Check for any RECAL terms. These contain the active record if we encounter an inactive record. This covers the - // case where records 1, 3, 5, 7, ... have been deleted. In this event we would have only RECAL's returned - // which would contain records 2, 4, 6, 8, ... - index = lookForCodePoint(DDMTerm.RECAL, replys); - } - - if (index != -1) - { - // Records returned. Process the reply object(s) - // The last DDMTERM of the last reply received is a RECCNT and contains the number of records read. - int numReplies = replys.size(); - DDMDataStream reply = (DDMDataStream)replys.elementAt(numReplies - 1); - int numRead = reply.get32bit(reply.data_.length - 4); - records = new Record[numRead]; - if (numRead > 0) - { - int recordNumber = 1; - int recOffset; - int offset; - boolean done; - for (int i = index, j = 0; i < numReplies; ++i) - { - reply = (DDMDataStream)replys.elementAt(i); - done = false; - offset = 10; - while (!done) - { - // Find the next occurrence of a RECORD or RECAL term. We get a RECAL which will contain a - // RECORD when we encounter an inactive (deleted) record position. Otherwise we should just - // get a RECORD term - while (offset < reply.data_.length && ((reply.get16bit(offset - 2) != DDMTerm.RECORD) && (reply.get16bit(offset - 2) != DDMTerm.RECAL))) - { - offset += reply.get16bit(offset - 4); - } - if (offset >= reply.data_.length) - { - break; - } - // Determine offset of the record data and determine the record number - if (reply.get16bit(offset - 2) == DDMTerm.RECAL) - { // We have encountered a spot for an inactive record. The RECAL term consists - // of the record number of the next active record along with the record data of the - // next active record. - recOffset = offset + 12; // Skip ahead to the record data - recordNumber = reply.get32bit(offset + 4); // Set record number to the record number of the - // active record - } - else - { // This is an active record; we are already pointing to the record data and the record number - // was set appropriately last time through the loop. - recOffset = offset; - } - - if (reply.get16bit(offset - 4) <= 0x7FFF) - { // The record data immediately follows the code point if the - // record length + 4 is <= 32767 - records[j] = recordFormat_.getNewRecord(reply.data_, recOffset); - } - else - { // The record data starts 4 bytes after the code point if the - // record length + 4 is > 32767. The four bytes immediately - // after the code point contain the actual length of the record - // record data that follows. - records[j] = recordFormat_.getNewRecord(reply.data_, recOffset + 4); - } - // Set the record number of the record - try - { - records[j++].setRecordNumber(recordNumber++); - } - catch(PropertyVetoException e) - { // We created the Record objects. There is no one to veto anything - } // so this is here to quit the compiler - - if (j == numRead) - { - done = true; - } - // Get offset of next record - offset += reply.get16bit(offset - 4); - } - } - } - } - else if (replys.size() == 1 && ((DDMDataStream)replys.elementAt(0)).getCodePoint() == DDMTerm.RECCNT) - { - // If the file contains all deleted records, the only thing returned - // is a RECCNT. If this is the case, return an empty Record[] - return new Record[0]; - } - else - { // Error occurred - handleErrorReply(replys, 0); - } - - return (records == null ? new Record[0] : records); -*/ -//@B0D: end block - } - - /** - *Reads the first record with the specified key based on the specified type of read. - *@param key The values that make up the key with which to find the record. - *@param searchType The type of read. This value is one of the TYPE_GETKEY_* constants. - *@return The record read. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record read(Object[] key, int searchType) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - int shr; // Type of locking for the record - if ((openType_ == AS400File.READ_ONLY) || - ((openType_ == AS400File.READ_WRITE) && readNoUpdate_)) // @A1A - { - // Read only - shr = SHR_READ_NORM; - } - else - { // READ_WRITE - shr = SHR_UPD_NORM; - } - -// Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38GETK(dclName_, recordFormat_, type, shr, DATA_DTA_DTARCD, key, system_), server_.newCorrelationId()); // @A1D - Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38GETK(dclName_, recordFormat_, recordFormatCTLLName_, searchType, shr, DATA_DTA_DTARCD, key, system_), newCorrelationId()); // @A1A @B6C - // Call processReadReply to extract the records read (or throw an - // exception if appropriate) - Record[] returned = processReadReply(replys, false); // @A1C - - if (cacheRecords_) //@C0A - { - //@C0A - cache_.setIsEmpty(); //@C0A - } //@C0A - - return(returned == null)? null : returned[0]; - } - - - - // @A1A - /** - *Reads the first record with the specified key based on the specified type of read. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *@param searchType The type of read. This value is one of the TYPE_GETKEY_* constants. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@return The record read. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record read(byte[] key, int searchType, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - int shr; // Type of locking for the record - if ((openType_ == AS400File.READ_ONLY) || - ((openType_ == AS400File.READ_WRITE) && readNoUpdate_)) // @A1A - { - // Read only - shr = SHR_READ_NORM; - } - else - { // READ_WRITE - shr = SHR_UPD_NORM; - } - -// Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38GETK(dclName_, recordFormat_, type, shr, DATA_DTA_DTARCD, key, system_, numberOfKeyFields), server_.newCorrelationId()); // @A1D - Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38GETK(dclName_, recordFormatCTLLName_, searchType, shr, DATA_DTA_DTARCD, key, system_, numberOfKeyFields), newCorrelationId()); // @A1A @B6C - // Call processReadReply to extract the records read (or throw an - // exception if appropriate) - Record[] returned = processReadReply(replys, false); // @A1C - - if (cacheRecords_) //@C0A - { - //@C0A - cache_.setIsEmpty(); //@C0A - } //@C0A - - return(returned == null)? null : returned[0]; - } - - /** - *Reads a record from the file. Which record to read is determined by the type - *argument. - *@param searchType The type of get to execute. Valid values are: - *
        - *
      • TYPE_GET_FIRST - *
      • TYPE_GET_NEXT - *
      • TYPE_GET_LAST - *
      • TYPE_GET_PREV - *@return the record read - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record readRecord(int searchType) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - int shr; // Type of locking for the record - - // @A1C - if ((openType_ == AS400File.READ_ONLY) || - ((openType_ == AS400File.READ_WRITE) && readNoUpdate_)) // @A1A - { - // Read only - shr = SHR_READ_NORM; - } - else - { // READ_WRITE; get the record for update - shr = SHR_UPD_NORM; - } - - // Send the get S38GET request - Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38GET(dclName_, searchType, shr, DATA_DTA_DTARCD), newCorrelationId()); //@B6C - // Call processReadReply to extract the records read (or throw an - // exception if appropriate) - Record[] returned = processReadReply(replys, false); // @A1C - return(returned == null)? null : returned[0]; - } - - /** - *Reads records from the file. The next or previous 'blockingFactor_' - *records are retrieved depending on the direction specified. - *@param direction - *@return the records read - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public Record[] readRecords(int direction) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - int searchType = (direction == DDMRecordCache.FORWARD ? TYPE_GET_NEXT : - TYPE_GET_PREV); - - // Send the S38GETM request - Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestS38GETM(dclName_, blockingFactor_, searchType, SHR_READ_NORM, DATA_DTA_DTARCD, 0x01), newCorrelationId()); //@B6C - - // Call processReadReply to extract the records read (or throw an - // exception if appropriate) - return processReadReply(replys, false); // @A1C - } - - - /** - *Rolls back any transactions since the last commit/rollback boundary. Invoking this - *method will cause all transactions under commitment control for this connection - *to be rolled back. This means that any AS400File object for which a commit - *lock level was specified and that was opened under this connection will have - *outstanding transactions rolled back. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - **/ - public void rollback() throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - // Connect to the server. Note: If we have already connected, that connection - // will be used. - connect(); - - // Send the rollback data stream request - Vector replys = sendRequestAndReceiveReplies(DDMRequestDataStream.getRequestRLLBCKUOW(), newCorrelationId()); //@B6C - // Reply expected: ENDUOWRM, with UOWDSP parameter = 1 - if (replys.size() == 1 && ((DDMDataStream)replys.elementAt(0)).getCodePoint() == DDMTerm.ENDUOWRM) - { - DDMEndUnitOfWorkReply uowReply = new DDMEndUnitOfWorkReply(((DDMDataStream)replys.elementAt(0)).data_); - if (uowReply.getStatus() != 0x02) - { - // Status of logical unit of work committed not returned; should not happen unless - // we are constructing the request wrong. - Trace.log(Trace.ERROR, "AS400FileImplRemote.rollback()", - uowReply.data_); - throw new InternalErrorException(InternalErrorException.UNKNOWN, uowReply.getStatus()); - } - } - else - { - handleErrorReply(replys, 0); - } - } - - /** - *Sends a request and receives all the replies. This method is used when the potential - *for chained replies exists. - *@param req The request to be sent. - *@param correlationId The correlation id for the request. - *@exception AS400Exception If the server returns an error message. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - private Vector sendRequestAndReceiveReplies(DDMDataStream req, int correlationId) - throws InterruptedException, IOException, AS400SecurityException - { - connect(); - - DDMDataStream reply = null; - try - { - synchronized(server_) //@F1A - make sure all of our operations are atomic - { //@F1A - we are synchronized so we don't interrupt any other sends - // that are sensitive. - server_.send(req, correlationId); - reply = (DDMDataStream)server_.receive(correlationId); - } //@F1A - } - catch (ConnectionDroppedException e) - { - // Connection dropped. Disconnect server and rethrow. - Trace.log(Trace.ERROR, "ConnectionDroppedException:", e); - system_.disconnectServer(server_); -//@C1 - Setting the server_ object to null means that -// any operations on this AS400File object after the connection has been -// dropped will result in a NullPointerException. By leaving the server_ object -// around, any subsequent operations should also throw a ConnectionDroppedException. -//@C1D server_ = null; - resetState(); - throw e; - } - - // Receive all replies from the read into a vector. - Vector replys = new Vector(); - while (reply.isChained()) - { - replys.addElement(reply); - try - { - reply = (DDMDataStream)server_.receive(correlationId); - } - catch (ConnectionDroppedException e) - { - // Connection dropped. Disconnect server and rethrow. - Trace.log(Trace.ERROR, "ConnectionDroppedException:", e); - system_.disconnectServer(server_); -//@C1 - Setting the server_ object to null means that -// any operations on this AS400File object after the connection has been -// dropped will result in a NullPointerException. By leaving the server_ object -// around, any subsequent operations should also throw a ConnectionDroppedException. -//@C1D server_ = null; - resetState(); - throw e; - } - } - // Add the unchained reply to the vector of replys - replys.addElement(reply); - return replys; - } - - - /** - *Sets the declared file name (DCLNAM). The declared file name for each - *file object must be unique. This method will generate a unique declared file - *name. - **/ - public void setDCLName() - { - // Convert nextDCLName_ to a Long and then to a string - long nextDCLName; - synchronized (nextDCLNameLock_) { - nextDCLName = nextDCLName_++; // need to synchronize the incrementation - } - String nextDCLNameAsString = Long.toString(nextDCLName); - - // Copy EBCDIC version of nextDCLName to dclNAme_ and blank pad dclName_ - // to 8 bytes - for (int i = 0; i < nextDCLNameAsString.length(); i++) - { - char c = nextDCLNameAsString.charAt(i); - dclName_[i] = (byte) (c & 0x000f | 0x00f0); - } - padBytes(dclName_, nextDCLNameAsString.length(), - 8 - nextDCLNameAsString.length(), (byte)0x40); - } - - - /** - *Updates the record at the current cursor position. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void update(Record record) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (record.getRecordLength() != openFeedback_.getRecordLength()) - { - Trace.log(Trace.ERROR, "Incorrect record length for file :"); - Trace.log(Trace.ERROR, "record.getRecordLength() :" + String.valueOf(record.getRecordLength())); - throw new ExtendedIllegalArgumentException("record", ExtendedIllegalArgumentException. PARAMETER_VALUE_NOT_VALID); - } - - connect(); - - // getObjectS38BUF requires an array of records - Record[] records = new Record[1]; - records[0] = record; - // We will be chaining an S38BUF to the S38UPDAT request. This requires that - // the correlation ids be the same. - int correlationId = newCorrelationId(); //@B6C - // Send the S38UPDAT request followed by the S38BUF object containing the - // record with which to update. - DDMRequestDataStream req = DDMRequestDataStream.getRequestS38UPDAT( TYPE_GET_SAME, SHR_UPD_NORM, DATA_DTA_DTARCD, dclName_); - req.setIsChained(true); // Indicate we are chaining an object to the request - req.setHasSameRequestCorrelation(true); // Indicate that they have the same - // correlation ids - // Start of changes for ----------------------------------------- @A2A - // Determine the maxNumberOfFieldsPerFormatInFile for the file - // remembering that multi-format logical files may have a different - // number of getNumberOfFields() per record format. - // DDMObjectDataStream.getObjectS38BUF() needs maxNumberOfFieldsPerFormatInFile - int maxNumberOfFieldsPerFormatInFile = -1; - if (rfCache_ == null) - { - // Use default maxNumberOfFieldsPerFormatInFile == -1 - } - else - { - int numberOfRecordFormats = rfCache_.length; - for(int i = 0; i < numberOfRecordFormats; ++i) - { - maxNumberOfFieldsPerFormatInFile = - Math.max(maxNumberOfFieldsPerFormatInFile, rfCache_[i].getNumberOfFields()); - } - } - // End of changes for ------------------------------------------- @A2A - - // Get the S38BUF object(s) to send after the request - // Because we are updating, there will only be one item in dataToSend - DDMObjectDataStream[] dataToSend = - DDMObjectDataStream.getObjectS38BUF(records, openFeedback_, ssp_, // #SSPDDM1 - add ssp_ parm - maxNumberOfFieldsPerFormatInFile); //@A2C - - Vector replys = null; //@F1A - - synchronized(server_) //@F1A - both datastreams must be written atomically - { //@F1A - try - { - server_.send(req, correlationId); - replys = sendRequestAndReceiveReplies(dataToSend[0], correlationId); //@F1M - } - catch (ConnectionDroppedException e) - { - // Connection dropped. Disconnect server and rethrow. - Trace.log(Trace.ERROR, "ConnectionDroppedException:", e); - system_.disconnectServer(server_); -//@C1 - Setting the server_ object to null means that -// any operations on this AS400File object after the connection has been -// dropped will result in a NullPointerException. By leaving the server_ object -// around, any subsequent operations should also throw a ConnectionDroppedException. -//@C1D server_ = null; - resetState(); - throw e; - } - } //@F1A - // Reply expected: S38IOFB - if (((DDMDataStream)replys.elementAt(0)).getCodePoint() == DDMTerm.S38IOFB) - { - if (replys.size() != 1) - { - handleErrorReply(replys, 1); - } - } - else - { // Error occurred - handleErrorReply(replys, 0); - } - } - - /** - *Verifies the reply datastream as an S38MSGRM with the specified - *information. If msgID is not null, svrCode is not checked. - *If msgId is null, svrCode is verified. - @param reply The DDM reply data stream. - @param msgId The message id that this reply should contain. - @param svrCode The severity code that this reply should contain. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public boolean verifyS38MSGRM(DDMDataStream replyParm, String msgId, int svrCode) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (replyParm instanceof DDMReplyDataStream) - { - DDMReplyDataStream reply = (DDMReplyDataStream) replyParm; - - DDMAS400MessageReply msgReply = new DDMAS400MessageReply(system_, reply.data_); - AS400Message[] msgs = msgReply.getAS400MessageList(); - for (int i = 0; i < msgs.length; ++i) - { - if (msgId != null) - { // Verify based on msgid only - if (msgs[i].getID().equalsIgnoreCase(msgId)) - { - return true; - } - } - else - { // Verify based on severity code only - if (msgs[i].getSeverity() == svrCode) - { - return true; - } - } - } - } - return false; - } - - - - /** - *Writes an array of records to the file. - *@param records The records to write. The records must have a format - *which matches the record format of this object. To ensure that this - *requirement is met, use the - *RecordFormat.getNewRecord() - *method to obtain default records whose fields can be set appropriately by - *the Java program and then written to the file. - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the server. - **/ - public void write(Record[] records) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (records[0].getRecordLength() != openFeedback_.getRecordLength()) - { - // Note: The typical cause of this error is that the application neglected to call AS400File.setRecordFormat() prior to calling open() or readAll(). - if (Trace.traceOn_) - { - Trace.log(Trace.ERROR, "Incorrect record length for file: " + - "Expected " + String.valueOf(openFeedback_.getRecordLength()) + - ", got " + String.valueOf(records[0].getRecordLength())); - } - throw new ExtendedIllegalArgumentException("records", ExtendedIllegalArgumentException. PARAMETER_VALUE_NOT_VALID); - } - - connect(); - - // We will be chaining the S38BUF to the request, so the correlation ids must match - int correlationId = newCorrelationId(); //@B6C - DDMRequestDataStream req = DDMRequestDataStream.getRequestS38PUTM(dclName_); - req.setIsChained(true); // Indicate that the request is chained - req.setHasSameRequestCorrelation(true); // Indicate hat the ids will match - - // Start of changes for ----------------------------------------- @A2A - // Determine the maxNumberOfFieldsPerFormatInFile for the file - // remembering that multi-format logical files may have a different - // number of getNumberOfFields() per record format. - // DDMObjectDataStream.getObjectS38BUF() needs maxNumberOfFieldsPerFormatInFile - int maxNumberOfFieldsPerFormatInFile = -1; - if (rfCache_ == null) - { - // Use default maxNumberOfFieldsPerFormatInFile == -1 - } - else - { - int numberOfRecordFormats = rfCache_.length; - for(int i = 0; i < numberOfRecordFormats; ++i) - { - maxNumberOfFieldsPerFormatInFile = - Math.max(maxNumberOfFieldsPerFormatInFile, rfCache_[i].getNumberOfFields()); - } - } - // End of changes for ------------------------------------------- @A2A - - // Get the S38BUF object(s) containing the records to write. - DDMObjectDataStream[] dataToSend = - DDMObjectDataStream.getObjectS38BUF(records, openFeedback_, ssp_, // #SSPDDM1 - add ssp_ parm - maxNumberOfFieldsPerFormatInFile); //@A2A - - // It is possible that we will have more than one S38BUF to send. This case - // occurs when the blocking factor is less than the number records to be written. - // In that case we do multiple of S38PUTMs of blocking factor number of records. - Vector replys; - synchronized(server_) //@F1A - both datastreams must be written atomically - { //@F1A - for (int i = 0; i < dataToSend.length; ++i) - { // For each S38BUF object, send the S38PUTM followed by the S38BUF - server_.send(req, correlationId); - replys = sendRequestAndReceiveReplies(dataToSend[i], correlationId); - // Reply expected: S38IOFB - if (((DDMDataStream)replys.elementAt(0)).getCodePoint() == DDMTerm.S38IOFB) - { - if (replys.size() != 1) - { - handleErrorReply(replys, 1); - } - } - else - { // Error occurred - handleErrorReply(replys, 0); - } - } - } //@F1A - } - - // @B1A - // @B6C - private int newCorrelationId() - { - synchronized(correlationIdLock_) - { - if (lastCorrelationId_ == 0x7fff) lastCorrelationId_ = 0; - return ++lastCorrelationId_; - } - } -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescription.java b/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescription.java deleted file mode 100644 index 69ca33dce..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescription.java +++ /dev/null @@ -1,564 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400FileRecordDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.FileOutputStream; -import java.io.PrintWriter; -import java.io.IOException; -import java.io.Serializable; -import java.net.UnknownHostException; -import java.util.Vector; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; //@C0A -import java.beans.PropertyChangeEvent; -import java.beans.PropertyVetoException; - -/** - *The AS400FileRecordDescription class represents the record descriptions of a physical - *or logical file on the system. This class is used to retrieve the file field description - *of a physical or logical file, and to create Java source code - *for a class extending from - *{@link com.ibm.as400.access.RecordFormat RecordFormat} that - *can then be compiled and used as input to the - *{@link com.ibm.as400.access.AS400File#setRecordFormat(com.ibm.as400.access.RecordFormat) AS400File.setRecordFormat()} - *method. - *This allows the record format to be created statically during - *development time and then reused when needed. - *The class also provides a method for returning RecordFormat objects - *that can be used as input to the AS400File.setRecordFormat() method. - *This method can be used to create the record format dynamically. - *

        The output from the {@link com.ibm.as400.access.AS400FileRecordDescription#createRecordFormatSource(java.lang.String, java.lang.String) createRecordFormatSource()} - *and - *{@link com.ibm.as400.access.AS400FileRecordDescription#retrieveRecordFormat retrieveRecordFormat()} methods - *contains enough information to use to describe the record format of the - *existing file from which it was generated. The record formats - *generated are not meant for creating files with the same format as the - *file from which they are retrieved. Use the Copy File (CPYF) command to create - *a file with the same format as an existing file. - *
        - *AS400FileRecordDescription objects generate the following events: - *

          - *
        • {@link com.ibm.as400.access.AS400FileRecordDescriptionEvent AS400FileRecordDescriptionEvent} - *
          The events fired are: - *
            - *
          • recordFormatRetrieved - *
          • recordFormatSourceCreated - *
          - *
        • PropertyChangeEvent - *
        • VetoableChangeEvent - *
        - **/ -public class AS400FileRecordDescription implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - - // File name - private String file_ = ""; - // Library name - //@C0D private String library_ = ""; - // member name - private String member_ = ""; - // The IFS path name of the file - private String name_ = ""; - // The system the file is on - private AS400 system_ = null; - - // The list of AS400FileRecordDescriptionEvent listeners - transient Vector rdeListeners_; - // Use default property change support - transient PropertyChangeSupport changes_; - // Use default veto change support - transient VetoableChangeSupport vetos_; //@C0C - - // The impl. - transient private AS400FileRecordDescriptionImpl impl_; //@C0A - - /** - *Constructs an AS400FileRecordDescription object. - *The system on which the file resides and the name of the - *file must be set prior to invoking any other method in the class. - *@see AS400FileRecordDescription#setSystem - *@see AS400FileRecordDescription#setPath - **/ - public AS400FileRecordDescription() - { - initializeTransient(); - } - - /** - *Constructs an AS400FileRecordDescription object. It uses the specified system on - *which the file resides and the - *integrated file system path name of - *the file. - *@param system The system on which the file resides. - *@param name The integrated file system path name - *of the file. If a member is not specified in name, the first - *member of the file is used. - **/ - public AS400FileRecordDescription(AS400 system, String name) - { - if (system == null) - { - throw new NullPointerException("system"); - } - if (name == null) - { - throw new NullPointerException("name"); - } - initializeTransient(); - name_ = name; - parseName(); //@C0A - system_ = system; - } - - - /** - *Adds a listener to be notified when an AS400FileRecordDescriptionEvent is fired. - *@see #removeAS400FileRecordDescriptionListener - *@param listener The As400FileRecordDescriptionListener. - **/ - public void addAS400FileRecordDescriptionListener(AS400FileRecordDescriptionListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - rdeListeners_.addElement(listener); - } - - /** - *Adds a listener to be notified when the value of any bound - *property is changed. The propertyChange method will be - *be called. - *@see #removePropertyChangeListener - *@param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - changes_.addPropertyChangeListener(listener); - } - - /** - *Adds a listener to be notified when the value of any constrained - *property is changed. - *The vetoableChange method will be called. - *@see #removeVetoableChangeListener - *@param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - vetos_.addVetoableChangeListener(listener); //@C0C - } - - - /** - Chooses the appropriate implementation. - **/ - private synchronized void chooseImpl() throws AS400SecurityException, IOException - { - if (impl_ == null) - { - impl_ = (AS400FileRecordDescriptionImpl) system_.loadImpl2("com.ibm.as400.access.AS400FileRecordDescriptionImplRemote", - "com.ibm.as400.access.AS400FileRecordDescriptionImplProxy"); - //@E0: We want the connectService() to throw the exception, otherwise - // later on down the line, we'll try to use the impl_ we loaded but - // its state will not be valid. (This usually exhibits itself as - // a NullPointerException when the ImplRemote tries to reconnect.) - // We can get away with this because the only methods that - // call chooseImpl() already throw AS400SecurityException and IOException. - - //@E0D try //@B5A - //@E0D { - // system_.connectService(AS400.RECORDACCESS); //@B5A - //@E0D } - //@E0D catch(IOException x) //@B5A - //@E0D { - //@E0D if (Trace.isTraceOn() && Trace.isTraceErrorOn()) //@B5A - //@E0D Trace.log(Trace.ERROR, "Exception when connecting during chooseImpl().", x); - //@E0D } - //@E0D catch(AS400SecurityException x) //@B5A - //@E0D { - //@E0D if (Trace.isTraceOn() && Trace.isTraceErrorOn()) //@B5A - //@E0D Trace.log(Trace.ERROR, "Exception when connecting during chooseImpl().", x); - //@E0D } - impl_.setPath(name_); //@C0A - impl_.setSystem(system_.getImpl()); //@C0A @B5C - } - system_.signon(false); - } - - - /** - *Retrieves the file description for the file, and creates a file containing the Java source for - *a class extending from RecordFormat that represents the record format for the file. If the - *file contains more than one record format (for example, is a multiple format logical file), a Java - *source file for each record format in the file is created; each file will contain the class - *definition for a single record format.
        - *The name of the class is the name of the record format retrieved with the string "Format" - *appended to it. The name of the file is the name of the class with the extension .java.
        - *The source files generated can be compiled and used as input to the - *{@link com.ibm.as400.access.AS400File#setRecordFormat(com.ibm.as400.access.RecordFormat) AS400File.setRecordFormat()} method.
        - *The system to which to connect and the integrated file system - *pathname for the file must be set prior to invoking this method. - *@see AS400FileRecordDescription#AS400FileRecordDescription(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400FileRecordDescription#setPath - *@see AS400FileRecordDescription#setSystem - *@param filePath The path of the directory in which to create the file. If filePath is null, - *the file is created in the current working directory. - *@param packageName The name of the package in which the class belongs. The packageName - *is used to specify the package statement in the source code for the class. - * If this value is null, no package statement is specified in the source code for the class. - - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception IOException If an error occurs while communicating with the - *system. - *@exception InterruptedException If this thread is interrupted. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public synchronized void createRecordFormatSource(String filePath, String packageName) - throws AS400Exception, - AS400SecurityException, - IOException, - InterruptedException - { - chooseImpl(); - String[] filesToWrite = impl_.createRecordFormatSource(packageName); //@C0A - - // Get the file separator for the system on which we are running - String fileSeparator = System.getProperty("file.separator"); - // Append file separator if necessary to filePath - if (filePath != null) - { - if (filePath.lastIndexOf(fileSeparator) != filePath.length() - fileSeparator.length()) - { - filePath += fileSeparator; - } - } - else - { - filePath = ""; - } - FileOutputStream os; - PrintWriter sourceFile; - String fileName; - //@C0A - for (int i=0; i<(filesToWrite.length/2); ++i) - { - fileName = filePath + filesToWrite[i*2]; //@C0C - os = new FileOutputStream(fileName); - sourceFile = new PrintWriter(os, true); - sourceFile.print(filesToWrite[(i*2)+1]); //@C0A - if (sourceFile.checkError()) - { - sourceFile.close(); - throw new InternalErrorException("Error writing to sourceFile.", InternalErrorException.UNKNOWN); - } - sourceFile.close(); - } - - //@C0C - // Fire RECORD_FORMAT_SOURCE_CREATED event - Vector targets = (Vector) rdeListeners_.clone(); - AS400FileRecordDescriptionEvent event = new AS400FileRecordDescriptionEvent(this, AS400FileRecordDescriptionEvent.RECORD_FORMAT_SOURCE_CREATED); - for (int i=0; iname, the first - *member of the file is used. - *@exception PropertyVetoException If a change is vetoed. - **/ - public void setPath(String name) - throws PropertyVetoException - { - // Verify parameters - if (name == null) - { - throw new NullPointerException("name"); - } - - String oldName = name_; - - //@C0C - // Notify veto listeners of the change - vetos_.fireVetoableChange("path", oldName, name); - - name_ = name; - parseName(); //@C0A - - if (impl_ != null) impl_.setPath(name_); //@C0A - changes_.firePropertyChange("path", oldName, name); //@C0C - } - - /** - *Sets the system to which to connect. - *@param system The system to which to conenct. - *@exception PropertyVetoException If a change is vetoed. - **/ - public void setSystem(AS400 system) - throws PropertyVetoException - { - // Verify parameters - if (system == null) - { - throw new NullPointerException("system"); - } - - //@C0C - // Notify veto listeners of the change - AS400 old = system_; - vetos_.fireVetoableChange("system", old, system); - - system_ = system; - if (impl_ != null) impl_.setSystem(system_.getImpl()); //@C0A @B5C - changes_.firePropertyChange("system", old, system_); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescription16.gif b/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescription16.gif deleted file mode 100644 index 33ed6746a..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescription16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescription32.gif b/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescription32.gif deleted file mode 100644 index 0e49b1247..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescription32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionBeanInfo.java b/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionBeanInfo.java deleted file mode 100644 index 047e2c778..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionBeanInfo.java +++ /dev/null @@ -1,207 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400FileRecordDescriptionBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2008 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @A1 12/12/2007 Correct EventSet for VetoablePropertyChange -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; - -/** - * The AS400FileRecordDescriptionBeanInfo class provides - * bean information for the AS400FileRecordDescription class. -**/ -public class AS400FileRecordDescriptionBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - // Bean class - private final static Class beanClass_ = AS400FileRecordDescription.class; - - - // BeanDescriptor for this class - private static BeanDescriptor beanDescriptor_ = new BeanDescriptor(AS400FileRecordDescription.class); - - - // Set of event descriptors for this class: - // PropertyChange, VetoableChange, RecordDescriptionEvent.FIELD_MODIFIED - private static EventSetDescriptor[] eventSet_ = new EventSetDescriptor[3]; - - - // Set of property descriptors for this class - // memberName, fileName, recordFormat, path, system - private static PropertyDescriptor[] propertySet_ = new PropertyDescriptor[4]; - - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - - static - { - try - { - // Populate the event descriptor set - // FileEvent - String[] listenerMethods = {"recordFormatRetrieved", "recordFormatSourceCreated"}; - eventSet_[0] = new EventSetDescriptor(beanClass_, "AS400FileRecordDescription", - AS400FileRecordDescriptionListener.class, - listenerMethods, "addAS400FileRecordDescriptionListener", - "removeAS400FileRecordDescriptionListener"); - eventSet_[0].setDisplayName(loader_.getText("EVT_NAME_AS400FILE_RECORD_DESCRIPTION")); - eventSet_[0].setShortDescription(loader_.getText("EVT_DESC_AS400FILE_RECORD_DESCRIPTION")); - - - // PropertyChangeEvent - eventSet_[1] = new EventSetDescriptor(beanClass_, "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - eventSet_[1].setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - eventSet_[1].setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - - // VetoablePropertyChange - eventSet_[2] = new EventSetDescriptor(beanClass_, "propertyChange", //@A1C - java.beans.VetoableChangeListener.class, - "vetoableChange"); - eventSet_[2].setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - eventSet_[2].setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - } - catch(IntrospectionException e) - { - throw new Error(e.toString()); - } - - try - { - // Populate the property descriptor set - // getFileName - propertySet_[0] = new PropertyDescriptor("fileName", beanClass_, - "getFileName", null); - propertySet_[0].setBound(true); - propertySet_[0].setConstrained(false); - propertySet_[0].setDisplayName(loader_.getText("PROP_NAME_FILE_NAME")); - propertySet_[0].setShortDescription(loader_.getText("PROP_DESC_FILE_NAME")); - - - // getKeyFields - propertySet_[1] = new PropertyDescriptor("memberName", beanClass_, - "getMemberName", null); - propertySet_[1].setBound(true); - propertySet_[1].setConstrained(false); - propertySet_[1].setDisplayName(loader_.getText("PROP_NAME_MEMBER")); - propertySet_[1].setShortDescription(loader_.getText("PROP_DESC_MEMBER")); - - - // get/setPath - propertySet_[2] = new PropertyDescriptor("path", beanClass_, - "getPath", - "setPath"); - propertySet_[2].setBound(true); - propertySet_[2].setConstrained(true); - propertySet_[2].setDisplayName(loader_.getText("PROP_NAME_PATH")); - propertySet_[2].setShortDescription(loader_.getText("PROP_DESC_PATH")); - - - // get/setSystem - propertySet_[3] = new PropertyDescriptor("system", beanClass_, - "getSystem", - "setSystem"); - propertySet_[3].setBound(true); - propertySet_[3].setConstrained(true); - propertySet_[3].setDisplayName(loader_.getText("PROP_NAME_SYSTEM")); - propertySet_[3].setShortDescription(loader_.getText("PROP_DESC_SYSTEM")); - } - catch(IntrospectionException e) - { - throw new Error(e.toString()); - } - } - - /** - *Returns the bean descriptor. - *@return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - /** - *Returns the index of the default event. - *@return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the property change event - return 0; - } - - - /** - *Returns the index of the default property. - *@return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the default property - return 0; - } - - - /** - *Returns the set of event descriptors. - *@return The event descriptor set. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSet_; - } - - /** - *Returns the property descriptors. - *@return The property descriptors. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertySet_; - } - - /** - *Returns the icon image for a AS400FileRecordDescription bean. - *@return The icon image. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("AS400FileRecordDescription16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("AS400FileRecordDescription32.gif"); - break; - } - return image; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionEvent.java b/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionEvent.java deleted file mode 100644 index acccbc7b1..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionEvent.java +++ /dev/null @@ -1,75 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: AS400FileRecordDescriptionEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - *The AS400FileRecordDescriptionEvent class represents a RecordDescriptionEvent. This class is used to - *fire events from the record description classes, - *RecordFormat and - *Record. -**/ -public class AS400FileRecordDescriptionEvent extends java.util.EventObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - - /** - *Event ID indicating that the record formats for a file - *have been retrieved. - *@see com.ibm.as400.access.AS400FileRecordDescription#retrieveRecordFormat - **/ - public static final int RECORD_FORMAT_RETRIEVED = 1; - /** - *Event ID indicating that source files containing the RecordFormat - *classes for a file have been created. - *@see com.ibm.as400.access.AS400FileRecordDescription#createRecordFormatSource - **/ - public static final int RECORD_FORMAT_SOURCE_CREATED = 2; - - // Event identifier - private int id_; - - /** - *Constructs a AS400FileRecordDescriptionEvent object. It uses the specified - *source and ID. - *@param source The object where the event originated. - *@param id The event identifier. The id must - *be a valid event id for this class. - **/ - public AS400FileRecordDescriptionEvent(Object source, int id) - { - super(source); - if (id < RECORD_FORMAT_RETRIEVED || id > RECORD_FORMAT_SOURCE_CREATED) - { - throw new ExtendedIllegalArgumentException("id", - ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - id_ = id; - } - - - /** - *Returns the identifier for this event. - *@return The identifier for this event. - **/ - public int getID() - { - return id_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionImpl.java b/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionImpl.java deleted file mode 100644 index 36902b024..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionImpl.java +++ /dev/null @@ -1,112 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400FileRecordDescriptionImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** -The AS400FileRecordDescriptionImpl interface defines the methods -needed for a full implementation of the AS400FileRecordDescription class. -**/ -interface AS400FileRecordDescriptionImpl -{ - /** - *Retrieves the file description for the file, and creates a file containing the Java source for - *a class extending from RecordFormat that represents the record format for the file. If the - *file contains more than one record format (for example, is a multiple format logical file), a Java - *source file for each record format in the file is created; each file will contain the class - *definition for a single record format.
        - *The name of the class is the name of the record format retrieved with the string "Format" - *appended to it. The name of the file is the name of the class with the extension .java.
        - *The source files generated can be compiled and used as input to the - *AS400File.setRecordFormat() method.
        - *The server to which to connect and the integrated file system - *pathname for the file must be set prior to invoking this method. - *@see AS400FileRecordDescription#AS400FileRecordDescription(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400FileRecordDescription#setPath - *@see AS400FileRecordDescription#setSystem - *@param filePath The path in which to create the file. If filePath is null, - *the file is created in the current working directory. - *@param packageName The name of the package in which the class belongs. The packageName - *is used to specify the package statement in the source code for the class. - * If this value is null, no package statement is specified in the source code for the class. - - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception IOException If an error occurs while communicating with the - *server. - *@exception InterruptedException If this thread is interrupted. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - - **/ - public abstract String[] createRecordFormatSource(String packageName) - throws AS400Exception, - AS400SecurityException, - IOException, - InterruptedException; - - - /** - *Retrieves the file description for the file, and creates a RecordFormat - *object for each record format, which can be used as input to the - *AS400File.setRecordFormat() - *method. If the file is a physical file, the RecordFormat array returned - *contains one - *RecordFormat object. If the file is a multiple format logical file, the - *RecordFormat array may contain - *more than one RecordFormat object. - *The server to which to connect and the integrated file system - *pathname for the file must be set prior to invoking this method. - *@see AS400FileRecordDescription#AS400FileRecordDescription(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400FileRecordDescription#setPath - *@see AS400FileRecordDescription#setSystem - - *@return The record format(s) for the file. - - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception IOException If an error occurs while communicating with the - *server. - *@exception InterruptedException If this thread is interrupted. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - - **/ - public abstract RecordFormat[] retrieveRecordFormat() - throws AS400Exception, - AS400SecurityException, - IOException, - InterruptedException; - - - /** - *Sets the integrated file system path name for - *the file. - *@param name The integrated file system path name - *of the file. If a member is not specified in name, the first - *member of the file is used. - **/ - public abstract void setPath(String name); - - - /** - *Sets the system to which to connect. - *@param system The system to which to conenct. - **/ - public abstract void setSystem(AS400Impl system); //@B5C - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionImplProxy.java b/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionImplProxy.java deleted file mode 100644 index ad3442d45..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionImplProxy.java +++ /dev/null @@ -1,97 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400FileRecordDescriptionImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.io.Serializable; -import java.io.IOException; - -class AS400FileRecordDescriptionImplProxy extends AbstractProxyImpl - implements AS400FileRecordDescriptionImpl -{ - static final long serialVersionUID = 4L; - - - public AS400FileRecordDescriptionImplProxy() - { - super("AS400FileRecordDescription"); - } - - - public String[] createRecordFormatSource(String packageName) - throws AS400Exception, - AS400SecurityException, - IOException, - InterruptedException - { - try - { - return (String[])connection_.callMethod(pxId_, - "createRecordFormatSource", - new Class[] { String.class }, - new Object[] { packageName }).getReturnValue(); - } - catch(InvocationTargetException e) - { - throw ProxyClientConnection.rethrow4a(e); - } - } - - - public RecordFormat[] retrieveRecordFormat() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - try - { - return (RecordFormat[])connection_.callMethod(pxId_, "retrieveRecordFormat").getReturnValue(); - } - catch(InvocationTargetException e) - { - throw ProxyClientConnection.rethrow4a(e); - } - } - - - public void setPath(String name) - { - try - { - connection_.callMethod(pxId_, "setPath", - new Class[] { String.class }, - new Object[] { name }); - } - catch(InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - - public void setSystem(AS400Impl system) //@B5C - { - try - { - connection_.callMethod(pxId_, "setSystem", - new Class[] { AS400Impl.class }, //@B5C - new Object[] { system }); - } - catch(InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionImplRemote.java b/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionImplRemote.java deleted file mode 100644 index c2313d68f..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionImplRemote.java +++ /dev/null @@ -1,2453 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400FileRecordDescriptionImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.math.BigDecimal; -import java.io.IOException; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.Date; - -/** - * Represents the record descriptions of a physical - * or logical file on the server. This class is used to retrieve the file field description - * of a physical or logical file, and to create Java source code - * for a class extending from - * RecordFormat that - * can then be compiled and used as input to the - * AS400File.setRecordFormat() - * method. - * This allows the record format to be created statically during - * development time and then reused when needed. - * The class also provides a method for returning RecordFormat objects - * that can be used as input to the AS400File.setRecordFormat() method. - * This method can be used to create the record format dynamically. - *

        The output from the createRecordFormatSource() - * and - * retrieveRecordFormat() methods - * contains enough information to use to describe the record format of the - * existing file from which it was generated. The record formats - * generated are not meant for creating files with the same format as the - * file from which they are retrieved. Use the IBM i "Copy File" (CPYF) command to create - * a file with the same format as an existing file. - *
        - * AS400FileRecordDescription objects generate the following events: - *

          - *
        • AS400FileRecordDescriptionEvent - *
          The events fired are: - *
            - *
          • recordFormatRetrieved - *
          • recordFormatSourceCreated - *
          - *
        • PropertyChangeEvent - *
        • VetoableChangeEvent - *
        -**/ -class AS400FileRecordDescriptionImplRemote implements AS400FileRecordDescriptionImpl -{ - static final long serialVersionUID = 4L; - - // File name - private String file_ = ""; - // Library name - private String library_ = ""; - // The IFS path name of the file - private String name_ = ""; - // SequentialFile object representing the file whose record description - // is being retrieved - private AS400FileImplBase theFile_ = null; //@C0C @B5C - // The path name for the SequentialFile - - // The server where the file is located - private AS400ImplRemote system_ = null; //@B5C - - // Used for synchronizing the QTEMP/JT4FFD and QTEMP/JT4FD files across threads - private static Object lockJT4FFD_ = new Object(); //@E0A - private static Object lockJT4FD_ = new Object(); //@E0A - - /** - *Adds a field description to the specified RecordFormat object. The field description - *is created with information extracted from the Record object provided. - *@param rf The record format to which to add the field description. - *@param record The record from which to obtain the field information. - *@exception UnsupportedEncodingException If an error occurs during conversion. - **/ - void addFieldDescription(RecordFormat rf, Record record) - throws UnsupportedEncodingException - { - char fieldType = ((String)record.getField("WHFLDT")).charAt(0); - FieldDescription fd = null; - int digits; - int decimalPositions; - int byteLength; //@A1A: For float field descriptions - String fieldName = ((String)record.getField("WHFLDE")).trim(); - int ccsid; - switch(fieldType) - { - case 'A': // Character field - // Need to get the length in bytes of the field and the ccsid of the field - // when creating the AS400Text object. The name of the field is set to be - // the DDS name of the field (which causes the DDS name of the field description - // to be the DDS name as well). - ccsid = ((BigDecimal)record.getField("WHCCSID")).intValue(); - if(ccsid == 65535) - { - // 65535 is not a valid ccsid, retrieve the default system ccsid - ccsid = system_.getCcsid(); - } - fd = new CharacterFieldDescription( - new AS400Text((((String)record.getField("WHVARL")).equals("Y"))? - ((BigDecimal)record.getField("WHFLDB")).intValue() - 2: - ((BigDecimal)record.getField("WHFLDB")).intValue(), - ccsid, system_), //@D0C - fieldName); - if(((String)record.getField("WHVARL")).equals("Y")) - { - if(((BigDecimal)record.getField("WHALLC")).intValue() > 0) - { // A length was specified on the VARLEN keyword - ((CharacterFieldDescription)fd).setVARLEN(((BigDecimal)record.getField("WHALLC")).intValue()); - } - else - { // No length was specified on the VARLEN keyword - ((CharacterFieldDescription)fd).setVariableLength(true); - } - } - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - ((CharacterFieldDescription)fd).setDFTNull(); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - ((CharacterFieldDescription)fd).setDFT(adjDft); - } - // Do nothing if a special value was present and we didn't know what - // it was. - } - break; - case 'B': // Binary field - digits = ((BigDecimal)record.getField("WHFLDO")).intValue(); -// if (digits < 6) - if(digits < 5) // @A2C - { - fd = new BinaryFieldDescription(new AS400Bin2(), - fieldName, - fieldName, - digits); - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - String dft = ((String)record.getField("WHDFT")).trim(); - if(dft.charAt(0) == '+') - { - dft = dft.substring(1); - } - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - ((BinaryFieldDescription)fd).setDFTNull(); - } - // Handle value - else - { - ((BinaryFieldDescription)fd).setDFT(new Short(dft)); - } - } - } - else if (digits < 10) //@F0C - { - fd = new BinaryFieldDescription(new AS400Bin4(), - fieldName, - fieldName, - digits); - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - String dft = ((String)record.getField("WHDFT")).trim(); - if(dft.charAt(0) == '+') - { - dft = dft.substring(1); - } - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - ((BinaryFieldDescription)fd).setDFTNull(); - } - // Handle value - else - { - ((BinaryFieldDescription)fd).setDFT(new Integer(dft)); - } - } - } - else //@F0A - { - fd = new BinaryFieldDescription(new AS400Bin8(), - fieldName, - fieldName, - digits); - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - String dft = ((String)record.getField("WHDFT")).trim(); - if(dft.charAt(0) == '+') - { - dft = dft.substring(1); - } - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - ((BinaryFieldDescription)fd).setDFTNull(); - } - // Handle value - else - { - ((BinaryFieldDescription)fd).setDFT(new Long(dft)); - } - } - } - break; - case 'E': // DBCS-Either field - // Need to get the length in bytes of the field and the ccsid of the field - // when creating the AS400Text object. The name of the field is set to be - // the DDS name of the field (which causes the DDS name of the field description - // to be the DDS name as well). - ccsid = ((BigDecimal)record.getField("WHCCSID")).intValue(); - if(ccsid == 65535) - { - // 65535 is not a valid ccsid, retrieve the default system ccsid - ccsid = system_.getCcsid(); - } - fd = new DBCSEitherFieldDescription( - new AS400Text((((String)record.getField("WHVARL")).equals("Y"))? - ((BigDecimal)record.getField("WHFLDB")).intValue() - 2: - ((BigDecimal)record.getField("WHFLDB")).intValue(), - ccsid, system_), //@D0C - fieldName); - if(((String)record.getField("WHVARL")).equals("Y")) - { - if(((BigDecimal)record.getField("WHALLC")).intValue() > 0) - { // A length was specified on the VARLEN keyword - ((DBCSEitherFieldDescription)fd).setVARLEN(((BigDecimal)record.getField("WHALLC")).intValue()); - } - else - { // No length was specified on the VARLEN keyword - ((DBCSEitherFieldDescription)fd).setVariableLength(true); - } - } - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - ((DBCSEitherFieldDescription)fd).setDFTNull(); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - ((DBCSEitherFieldDescription)fd).setDFT(adjDft); - } - // Do nothing if a special value was present and we didn't know what - // it was. - } - break; - case 'F': // Float field - digits = ((BigDecimal)record.getField("WHFLDO")).intValue(); - decimalPositions = ((BigDecimal)record.getField("WHFLDP")).intValue(); - //@A1A: Retrieve byte length to determine if field is single or double - // precision - byteLength = ((BigDecimal)record.getField("WHFLDB")).intValue(); //@A1A - if(byteLength == 4) //@A1A - { - fd = new FloatFieldDescription(new AS400Float4(), - fieldName, - fieldName, - digits, - decimalPositions); - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - String dft = ((String)record.getField("WHDFT")).trim(); - if(dft.charAt(0) == '+') - { - dft = dft.substring(1); - } - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - ((FloatFieldDescription)fd).setDFTNull(); - } - // Handle value - else - { - ((FloatFieldDescription)fd).setDFT(new Float(dft)); - } - } - } - else if(byteLength == 8) //@A1A - { - fd = new FloatFieldDescription(new AS400Float8(), - fieldName, - fieldName, - digits, - decimalPositions); - // Set the FLTPCN keyword to *DOUBLE - ((FloatFieldDescription)fd).setFLTPCN("*DOUBLE"); - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - String dft = ((String)record.getField("WHDFT")).trim(); - if(dft.charAt(0) == '+') - { - dft = dft.substring(1); - } - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - ((FloatFieldDescription)fd).setDFTNull(); - } - // Handle value - else - { - ((FloatFieldDescription)fd).setDFT(new Double(dft)); - } - } - } - else //@A1A: This should never occur, but for completeness.... - { - //@A1A - Trace.log(Trace.ERROR, "FloatFieldDescription error in byte length"); //@A1A - throw new InternalErrorException(InternalErrorException.UNKNOWN); //@A1A - } //@A1A - break; - case 'G': // DBCS-Graphic field - // Need to get the length in bytes of the field and the ccsid of the field - // when creating the AS400Text object. The name of the field is set to be - // the DDS name of the field (which causes the DDS name of the field description - // to be the DDS name as well). - ccsid = ((BigDecimal)record.getField("WHCCSID")).intValue(); - if(ccsid == 65535) - { - // 65535 is not a valid ccsid, retrieve the default system ccsid - ccsid = system_.getCcsid(); - } - fd = new DBCSGraphicFieldDescription( - new AS400Text((((String)record.getField("WHVARL")).equals("Y"))? - ((BigDecimal)record.getField("WHFLDB")).intValue() - 2: - ((BigDecimal)record.getField("WHFLDB")).intValue(), - ccsid, system_), //@D0C - fieldName); - if(((String)record.getField("WHVARL")).equals("Y")) - { - if(((BigDecimal)record.getField("WHALLC")).intValue() > 0) - { // A length was specified on the VARLEN keyword - ((DBCSGraphicFieldDescription)fd).setVARLEN(((BigDecimal)record.getField("WHALLC")).intValue()); - } - else - { // No length was specified on the VARLEN keyword - ((DBCSGraphicFieldDescription)fd).setVariableLength(true); - } - } - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - ((DBCSGraphicFieldDescription)fd).setDFTNull(); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - ((DBCSGraphicFieldDescription)fd).setDFT(adjDft); - } - // Do nothing if a special value was present and we didn't know what - // it was. - } - break; - case 'H': // Hex field - // Need to get the length in bytes of the field - // when creating the AS400ByteArray object. The name of the field is set to be - // the DDS name of the field (which causes the DDS name of the field description - // to be the DDS name as well). - fd = new HexFieldDescription( - new AS400ByteArray((((String)record.getField("WHVARL")).equals("Y"))? - ((BigDecimal)record.getField("WHFLDB")).intValue() - 2 : - ((BigDecimal)record.getField("WHFLDB")).intValue()), fieldName); - if(((String)record.getField("WHVARL")).equals("Y")) - { - if(((BigDecimal)record.getField("WHALLC")).intValue() > 0) - { // A length was specified on the VARLEN keyword - ((HexFieldDescription)fd).setVARLEN(((BigDecimal)record.getField("WHALLC")).intValue()); - } - else - { // No length was specified on the VARLEN keyword - ((HexFieldDescription)fd).setVariableLength(true); - } - } - // @B0A: Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - ((HexFieldDescription)fd).setDFTNull(); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - byte[] dftBytes = adjDft.getBytes(); - ((HexFieldDescription)fd).setDFT(dftBytes); - } - // Do nothing if a special value was present and we didn't know what - // it was. - } - break; - case 'J': // DBCS-Only field - // Need to get the length in bytes of the field and the ccsid of the field - // when creating the AS400Text object. The name of the field is set to be - // the DDS name of the field (which causes the DDS name of the field description - // to be the DDS name as well). - ccsid = ((BigDecimal)record.getField("WHCCSID")).intValue(); - if(ccsid == 65535) - { - // 65535 is not a valid ccsid, retrieve the default system ccsid - ccsid = system_.getCcsid(); - } - fd = new DBCSOnlyFieldDescription( - new AS400Text((((String)record.getField("WHVARL")).equals("Y"))? - ((BigDecimal)record.getField("WHFLDB")).intValue() - 2: - ((BigDecimal)record.getField("WHFLDB")).intValue(), - ccsid, system_), //@D0C - fieldName); - if(((String)record.getField("WHVARL")).equals("Y")) - { - if(((BigDecimal)record.getField("WHALLC")).intValue() > 0) - { // A length was specified on the VARLEN keyword - ((DBCSOnlyFieldDescription)fd).setVARLEN(((BigDecimal)record.getField("WHALLC")).intValue()); - } - else - { // No length was specified on the VARLEN keyword - ((DBCSOnlyFieldDescription)fd).setVariableLength(true); - } - } - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - ((DBCSOnlyFieldDescription)fd).setDFTNull(); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - ((DBCSOnlyFieldDescription)fd).setDFT(adjDft); - } - // Do nothing if a special value was present and we didn't know what - // it was. - } - break; - case 'L': // Date field - ccsid = ((BigDecimal)record.getField("WHCCSID")).intValue(); - if(ccsid == 65535) - { - // 65535 is not a valid ccsid, retrieve the default system ccsid - ccsid = system_.getCcsid(); - } - fd = new DateFieldDescription( - new AS400Text(((BigDecimal)record.getField("WHFLDB")).intValue(), - ccsid, system_), //@D0C - fieldName); - // Set date format and date separator values - ((DateFieldDescription)fd).setDATFMT((String)record.getField("WHFMT")); - if(!((String)record.getField("WHFMT")).equals(" ")) - { - ((DateFieldDescription)fd).setDATSEP((String)record.getField("WHSEP")); - } - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - ((DateFieldDescription)fd).setDFTNull(); - } - // Handle CURRENT_DATE (an SQL special value) - else if(dft.indexOf("CURRENT_DATE") != -1) - { - ((DateFieldDescription)fd).setDFTCurrent(); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - ((DateFieldDescription)fd).setDFT(adjDft); - } - // Do nothing if a special value was present and we didn't know what - // it was. - } - break; - case 'O': // DBCS-Open field - // Need to get the length in bytes of the field and the ccsid of the field - // when creating the AS400Text object. The name of the field is set to be - // the DDS name of the field (which causes the DDS name of the field description - // to be the DDS name as well). - ccsid = ((BigDecimal)record.getField("WHCCSID")).intValue(); - if(ccsid == 65535) - { - // 65535 is not a valid ccsid, retrieve the default system ccsid - ccsid = system_.getCcsid(); - } - fd = new DBCSOpenFieldDescription( - new AS400Text((((String)record.getField("WHVARL")).equals("Y"))? - ((BigDecimal)record.getField("WHFLDB")).intValue() - 2: - ((BigDecimal)record.getField("WHFLDB")).intValue(), - ccsid, system_), //@D0C - fieldName); - if(((String)record.getField("WHVARL")).equals("Y")) - { - if(((BigDecimal)record.getField("WHALLC")).intValue() > 0) - { // A length was specified on the VARLEN keyword - ((DBCSOpenFieldDescription)fd).setVARLEN(((BigDecimal)record.getField("WHALLC")).intValue()); - } - else - { // No length was specified on the VARLEN keyword - ((DBCSOpenFieldDescription)fd).setVariableLength(true); - } - } - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - ((DBCSOpenFieldDescription)fd).setDFTNull(); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - ((DBCSOpenFieldDescription)fd).setDFT(adjDft); - } - // Do nothing if a special value was present and we didn't know what - // it was. - } - break; - case 'P': // Packed decimal field - digits = ((BigDecimal)record.getField("WHFLDO")).intValue(); - decimalPositions = ((BigDecimal)record.getField("WHFLDP")).intValue(); - fd = new PackedDecimalFieldDescription(new AS400PackedDecimal(digits, decimalPositions), - fieldName); - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - String dft = ((String)record.getField("WHDFT")).trim(); - if(dft.charAt(0) == '+') - { - dft = dft.substring(1); - } - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - ((PackedDecimalFieldDescription)fd).setDFTNull(); - } - // Handle value - else - { - ((PackedDecimalFieldDescription)fd).setDFT(new BigDecimal(dft)); - } - } - break; - case 'S': // Zoned decimal field - digits = ((BigDecimal)record.getField("WHFLDO")).intValue(); - decimalPositions = ((BigDecimal)record.getField("WHFLDP")).intValue(); - fd = new ZonedDecimalFieldDescription(new AS400ZonedDecimal(digits, decimalPositions), - fieldName); - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - String dft = ((String)record.getField("WHDFT")).trim(); - if(dft.charAt(0) == '+') - { - dft = dft.substring(1); - } - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - ((ZonedDecimalFieldDescription)fd).setDFTNull(); - } - // Handle value - else - { - ((ZonedDecimalFieldDescription)fd).setDFT(new BigDecimal(dft)); - } - } - break; - case 'T': // Time field - ccsid = ((BigDecimal)record.getField("WHCCSID")).intValue(); - if(ccsid == 65535) - { - // 65535 is not a valid ccsid, retrieve the default system ccsid - ccsid = system_.getCcsid(); - } - fd = new TimeFieldDescription( - new AS400Text(((BigDecimal)record.getField("WHFLDB")).intValue(), - ccsid, system_), //@D0C - fieldName); - // Set date format and date separator values - ((TimeFieldDescription)fd).setTIMFMT((String)record.getField("WHFMT")); - if(!((String)record.getField("WHSEP")).equals(" ")) - { - ((TimeFieldDescription)fd).setTIMSEP((String)record.getField("WHSEP")); - } - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - ((TimeFieldDescription)fd).setDFTNull(); - } - // Handle CURRENT_TIME (an SQL special value) - else if(dft.indexOf("CURRENT_TIME") != -1) - { - ((TimeFieldDescription)fd).setDFTCurrent(); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - ((TimeFieldDescription)fd).setDFT(adjDft); - } - // Do nothing if a special value was present and we didn't know what - // it was. - } - break; - case 'Z': // Timestamp field - ccsid = ((BigDecimal)record.getField("WHCCSID")).intValue(); - if(ccsid == 65535) - { - // 65535 is not a valid ccsid, retrieve the default system ccsid - ccsid = system_.getCcsid(); - } - fd = new TimestampFieldDescription( - new AS400Text(((BigDecimal)record.getField("WHFLDB")).intValue(), - ccsid, system_), //@D0C - fieldName); - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - ((TimestampFieldDescription)fd).setDFTNull(); - } - // Handle CURRENT_TIMESTAMP (an SQL special value) - else if(dft.indexOf("CURRENT_TIMESTAMP") != -1) - { - ((TimestampFieldDescription)fd).setDFTCurrent(); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - ((TimestampFieldDescription)fd).setDFT(adjDft); - } - // Do nothing if a special value was present and we didn't know what - // it was. - } - break; - default: - Trace.log(Trace.ERROR, "Unrecognized field type: " + fieldType); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - - // Set if null values are allowed - if(((String)record.getField("WHNULL")).equals("Y")) - { - fd.setALWNULL(true); - } - - // Set the field text - fd.setTEXT(((String)record.getField("WHFTXT")).trim()); - - String value; - - // Set the ALIAS - value = ((String)record.getField("WHALIS")).trim(); - if(value.length() != 0) fd.setALIAS(value); - - // Set the REFFIL (reference file) - value = ((String)record.getField("WHRFIL")).trim(); - if(value.length() != 0) fd.setREFFIL(value); - - // Set the REFFLD (reference field) - value = ((String)record.getField("WHRFLD")).trim(); - if(value.length() != 0) fd.setREFFLD(value); - - // Set the REFFMT (reference record format) - value = ((String)record.getField("WHRFMT")).trim(); - if(value.length() != 0) fd.setREFFMT(value); - - // Set the REFLIB (reference library) - value = ((String)record.getField("WHRLIB")).trim(); - if(value.length() != 0) fd.setREFLIB(value); - - // Set the COLHDG (column heading) - String colHdg1 = ((String)record.getField("WHCHD1")).trim(); - String colHdg2 = ((String)record.getField("WHCHD2")).trim(); - String colHdg3 = ((String)record.getField("WHCHD3")).trim(); - if (colHdg1.length() == 0 && - colHdg2.length() == 0 && - colHdg3.length() == 0) - {} // nothing to set - else - { - // Concatenate the 3 "column heading" fields into a single string. - // Delimit each part by single-quotes. - // For example: "'FIRST PART' 'SECOND PART' 'THIRD PART'" - StringBuffer sb = new StringBuffer(); - - if (colHdg1.length() == 0) sb.append("''"); - else sb.append("'" + colHdg1 + "'"); - - if (colHdg2.length() == 0) { - if (colHdg3.length() == 0) {} - else sb.append(" ''"); - } - else sb.append(" '" + colHdg2 + "'"); - - if (colHdg3.length() == 0) {} - else sb.append(" '" + colHdg3 + "'"); - - fd.setCOLHDG(sb.toString()); - } - - // Add the field description - rf.addFieldDescription(fd); - } - - /** - *Retrieves the file description for the file, and creates a file containing the Java source for - *a class extending from RecordFormat that represents the record format for the file. If the - *file contains more than one record format (for example, is a multiple format logical file), a Java - *source file for each record format in the file is created; each file will contain the class - *definition for a single record format.
        - *The name of the class is the name of the record format retrieved with the string "Format" - *appended to it. The name of the file is the name of the class with the extension .java.
        - *The source files generated can be compiled and used as input to the - *AS400File.setRecordFormat() method.
        - *The server to which to connect, and the integrated file system - *pathname for the file, must be set prior to invoking this method. - *@see AS400FileRecordDescription#AS400FileRecordDescription(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400FileRecordDescription#setPath - *@see AS400FileRecordDescription#setSystem - *@param filePath The path in which to create the file. If filePath is null, - *the file is created in the current working directory. - *@param packageName The name of the package in which the class belongs. The packageName - *is used to specify the package statement in the source code for the class. - * If this value is null, no package statement is specified in the source code for the class. - - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception IOException If an error occurs while communicating with the - *server. - *@exception InterruptedException If this thread is interrupted. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - *@return An array of Strings: { rfName0, contents0, rfName1, contents1, etc... }. - **/ - public /*@E0D synchronized */ String[] createRecordFormatSource(String packageName) //@C0C - throws AS400Exception, - AS400SecurityException, - IOException, - InterruptedException - { - // ------------------------------------------------------------ - // Retrieve the field information for the file - // ------------------------------------------------------------ - // Generate file on the server containing the file field description - // ------------------------------------------------------------ - String cmd = "DSPFFD FILE(" + library_ + "/" + file_ + ") OUTPUT(*OUTFILE) OUTFILE(QTEMP/JT4FFD)"; - //@B5D theFile_.chooseImpl(); - Record[] records = null; //@E0A - synchronized(lockJT4FFD_) //@E0A - { //@E0A - AS400Message[] msgs = theFile_.execute(cmd); //@B5C - - if(msgs.length > 0) - { - if(!(msgs[0].getID().equals("CPF9861") || msgs[0].getID().equals("CPF3030"))) - { - throw new AS400Exception(msgs); - } - } - else - { // Unexpected reply - Trace.log(Trace.ERROR, "DSPFFD failed to return success message", cmd); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - - // Read all the records from the file so we can extract the field information locally - //@B5D SequentialFile dspffd = new SequentialFile(system_, "/QSYS.LIB/QTEMP.LIB/JT4FFD.FILE"); - AS400FileImplBase tempFile = (AS400FileImplBase)system_.loadImpl("com.ibm.as400.access.AS400FileImplNative", //@B5A - "com.ibm.as400.access.AS400FileImplRemote"); //@B5A - tempFile.setAll(system_, "/QSYS.LIB/QTEMP.LIB/JT4FFD.FILE", //@B5A - new QWHDRFFDFormat(system_.getCcsid()), false, false, false); //@B5A - //@B5D try - //@B5D { - //@B5D dspffd.setRecordFormat(new QWHDRFFDFormat(system_.getCcsid())); - //@B5D } - //@B5D catch(PropertyVetoException e) - //@B5D { // Quiet the compiler - //@B5D } - records = tempFile.readAll("seq", 100); //@B5C @D1C @E0C - tempFile.delete(); //@E0A - } //@E0A - - // ------------------------------------------------------------ - // Retrieve the key field information for the file - // ------------------------------------------------------------ - // Generate file on the server containing the key field description - cmd = "DSPFD FILE(" + library_ + "/" + file_ + ") TYPE(*ACCPTH) OUTPUT(*OUTFILE) OUTFILE(QTEMP/JT4FD)"; - Record[] keyRecords = null; //@E0A - synchronized(lockJT4FD_) //@E0A - { //@E0A - AS400Message[] msgs = theFile_.execute(cmd); //@B5C @E0C - if(msgs.length > 0) - { - if(!(msgs[0].getID().equals("CPF9861") || msgs[0].getID().equals("CPF3030"))) - { - throw new AS400Exception(msgs); - } - } - else - { // Unexpected reply - Trace.log(Trace.ERROR, "DSPFD failed to return success message", cmd); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - - // Read all the records from the file so we can extract the key field information locally - //@B5D dspffd = new SequentialFile(system_, "/QSYS.LIB/QTEMP.LIB/JT4FD.FILE"); - AS400FileImplBase tempFile = (AS400FileImplBase)system_.loadImpl("com.ibm.as400.access.AS400FileImplNative", //@B5A @E0C - "com.ibm.as400.access.AS400FileImplRemote"); //@B5A - tempFile.setAll(system_, "/QSYS.LIB/QTEMP.LIB/JT4FD.FILE", //@B5A - new QWHFDACPFormat(system_.getCcsid()), false, false, false); //@B5A - //@B5D try - //@B5D { - //@B5D dspffd.setRecordFormat(new QWHFDACPFormat(system_.getCcsid())); - //@B5D } - //@B5D catch(PropertyVetoException e) - //@B5D { // Quiet the compiler - //@B5D } - keyRecords = tempFile.readAll("key", 100); //@B5C @D1C @E0C - tempFile.delete(); //@E0A - } //@E0A - - // Determine the number of record formats contained in the file - int numberOfRecordFormats = ((BigDecimal)records[0].getField("WHCNT")).intValue(); - int numberOfFields = 0; - int numberOfKeyFields = 0; - int recordNumber = 0; - int keyRecordNumber = 0; - PrintWriter sourceFile; - StringWriter sourceString; //@C0A - String rfNameUntrimmed; - String rfName; - String[] filesToWrite = new String[numberOfRecordFormats*2]; //@C0A - for(int i = 0; i < numberOfRecordFormats; ++i) - { // Create source file for a particular record format - // Determine the name of the record format and hence the name of the file and class - rfNameUntrimmed = (String)records[recordNumber].getField("WHNAME"); - // If the record format is a quoted name, replace the quotes with blanks - rfName = rfNameUntrimmed.replace('"', ' ').trim(); - filesToWrite[i] = rfName + "Format.java"; //@C0A - sourceString = new StringWriter(/* 3000 */); //@C0A - sourceFile = new PrintWriter(sourceString); //@C0C - // Write the initial information to the file: - // Nonexclusive license, diclaimer and copyright - // Prolog - // package statement - // import statements - // beginning of class definition - sourceFile.println("/*******************************************************************************"); - sourceFile.println(" This source is an example of the Java source necessary "); - sourceFile.println(" to generate a RecordFormat subclass for file " + name_ + "."); - sourceFile.println(" IBM grants you a nonexclusive license to use this source."); - sourceFile.println(" You may change and use this souce as necessary."); - sourceFile.println(); - sourceFile.println(); - sourceFile.println(" DISCLAIMER"); - sourceFile.println(" ----------"); - sourceFile.println(); - sourceFile.println(" This source code is provided by IBM for illustrative purposes only."); - sourceFile.println(" The source has not been thoroughly tested under all conditions."); - sourceFile.println(" IBM, therefore, cannot guarantee or imply reliability, serviceability,"); - sourceFile.println(" or function of the source. All source contained herein are provided to you \"AS IS\""); - sourceFile.println(" without any warranties of any kind."); - sourceFile.println(" ALL WARRANTIES, INCLUDING BUT NOT LIMITED TO THE IMPLIED"); - sourceFile.println(" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR"); - sourceFile.println(" PURPOSE, ARE EXPRESSLY DISCLAIMED."); - sourceFile.println(); - sourceFile.println(); - sourceFile.println(" Your license to this source code provides you no right or licenses to"); - sourceFile.println(" any IBM patents. IBM has no obligation to defend or indemnify against"); - sourceFile.println(" any claim of infringement, including but not limited to: patents,"); - sourceFile.println(" copyright, trade secret, or intellectual property rights of any kind."); - sourceFile.println(); - sourceFile.println(); - sourceFile.println(" COPYRIGHT"); - sourceFile.println(" ---------"); - sourceFile.println("Copyright (C) 1997-1999 International Business Machines Corporation and others."); - sourceFile.println("All rights reserved."); - sourceFile.println("US Government Users Restricted Rights -"); - sourceFile.println("Use, duplication or disclosure restricted"); - sourceFile.println("by GSA ADP Schedule Contract with IBM Corp."); - sourceFile.println("Licensed Material - Property of IBM"); - sourceFile.println("********************************************************************************/"); - sourceFile.println(); - sourceFile.println("// Created by AS400FileRecordDescription on " + new Date()); - sourceFile.println(); - if(packageName != null) - { - sourceFile.println("package " + packageName + ";"); - } - sourceFile.println(); - sourceFile.println("import java.math.BigDecimal;"); - sourceFile.println("import com.ibm.as400.access.RecordFormat;"); - sourceFile.println("import com.ibm.as400.access.AS400Bin2;"); - sourceFile.println("import com.ibm.as400.access.AS400Bin4;"); - sourceFile.println("import com.ibm.as400.access.AS400Bin8;"); //@F0A - sourceFile.println("import com.ibm.as400.access.AS400ByteArray;"); - sourceFile.println("import com.ibm.as400.access.AS400Float4;"); - sourceFile.println("import com.ibm.as400.access.AS400Float8;"); - sourceFile.println("import com.ibm.as400.access.AS400PackedDecimal;"); - sourceFile.println("import com.ibm.as400.access.AS400Text;"); - sourceFile.println("import com.ibm.as400.access.AS400ZonedDecimal;"); - sourceFile.println("import com.ibm.as400.access.BinaryFieldDescription;"); - sourceFile.println("import com.ibm.as400.access.CharacterFieldDescription;"); - sourceFile.println("import com.ibm.as400.access.DateFieldDescription;"); - sourceFile.println("import com.ibm.as400.access.DBCSEitherFieldDescription;"); - sourceFile.println("import com.ibm.as400.access.DBCSGraphicFieldDescription;"); - sourceFile.println("import com.ibm.as400.access.DBCSOnlyFieldDescription;"); - sourceFile.println("import com.ibm.as400.access.DBCSOpenFieldDescription;"); - sourceFile.println("import com.ibm.as400.access.FieldDescription;"); - sourceFile.println("import com.ibm.as400.access.FloatFieldDescription;"); - sourceFile.println("import com.ibm.as400.access.HexFieldDescription;"); - sourceFile.println("import com.ibm.as400.access.PackedDecimalFieldDescription;"); - sourceFile.println("import com.ibm.as400.access.TimeFieldDescription;"); - sourceFile.println("import com.ibm.as400.access.TimestampFieldDescription;"); - sourceFile.println("import com.ibm.as400.access.ZonedDecimalFieldDescription;"); - sourceFile.println(); - // Determine the name of the class from the file name - sourceFile.println("public class " + rfName + "Format extends RecordFormat"); - sourceFile.println("{"); - sourceFile.println(); - sourceFile.println(" public " + rfName + "Format()"); - sourceFile.println(" {"); - - - // Write out the call to super with the record format name - sourceFile.println(" super(\"" + rfName + "\");"); - // Get the field descriptions. - numberOfFields = ((BigDecimal)records[recordNumber].getField("WHNFLD")).intValue(); - if(numberOfFields > 0) - { // Number of fields is greater than 0 - sourceFile.println(" // Add field descriptions to this record format"); - for(int j = 0; j < numberOfFields; ++j, ++recordNumber) - { // Add a field description to the record format - writeFieldDescription(sourceFile, records[recordNumber]); - } - } - - // Get the key field descriptions for this record format if there are any - numberOfKeyFields = ((BigDecimal)keyRecords[keyRecordNumber].getField("APNKYF")).intValue(); - if(numberOfKeyFields > 0) - { // Number of key fields is greater than 0 - sourceFile.println(" // Add key field descriptions to this record format"); - for(int j = 0; j < numberOfKeyFields; ++j, ++keyRecordNumber) - { // Add a key field description to the record format - sourceFile.println(" addKeyFieldDescription(\"" + ((String)keyRecords[keyRecordNumber].getField("APKEYF")).trim() + "\");"); - } - } - // End the class - sourceFile.println(" }"); - sourceFile.println("}"); - if(sourceFile.checkError()) - { - sourceFile.close(); - Trace.log(Trace.ERROR, "Error writing to sourceFile."); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - sourceFile.close(); - filesToWrite[i+1] = sourceString.toString(); //@C0A - } - return filesToWrite; //@C0A - } - - - /** - *Returns the attributes of a save file, as a record with format SaveFileAttrFormat. - *This method is provided for exclusive use by the SaveFile class. - - *@return The save file's attributes. - - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception IOException If an error occurs while communicating with the - *server. - *@exception InterruptedException If this thread is interrupted. - **/ - Record getSavefileAttributes() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Generate a file on the server, containing the basic attrs description. - String cmd = "DSPFD FILE(" + library_ + "/" + file_ + ") TYPE(*ATR) FILEATR(*SAVF) OUTPUT(*OUTFILE) OUTFILE(QTEMP/JT4FD)"; - Record[] attrRecords = null; - synchronized(lockJT4FD_) - { - AS400Message[] msgs = theFile_.execute(cmd); - - if(msgs.length > 0) - { - if(!(msgs[0].getID().equals("CPF9861") || msgs[0].getID().equals("CPF3030"))) - { - throw new AS400Exception(msgs); - } - } - else - { // Unexpected reply - Trace.log(Trace.ERROR, "DSPFD failed to return success message", cmd); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - - // Read all the records from the file so we can extract the key field information locally - AS400FileImplBase tempFile = (AS400FileImplBase)system_.loadImpl("com.ibm.as400.access.AS400FileImplNative", - "com.ibm.as400.access.AS400FileImplRemote"); - tempFile.setAll(system_, "/QSYS.LIB/QTEMP.LIB/JT4FD.FILE", - new SaveFileAttrFormat(system_.getCcsid()), false, false, false); - attrRecords = tempFile.readAll("seq", 100); - if (attrRecords.length == 0) { - Trace.log(Trace.ERROR, "No records were returned from command " + cmd); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - // Implementation note: I tried using read() and read(0) instead of readAll(), but some needed logic is missing along those paths; so we'll just use what works. - - tempFile.delete(); - } - - return attrRecords[0]; - } - - - //@B5A - /** - * Used internally to parse the pathname and set the individual - * library, filename, and member strings. - **/ - private void parseName(String name) - { - // Construct a QSYSObjectPathName object and parse out the library, - // file and member names - QSYSObjectPathName ifs = new QSYSObjectPathName(name); - if(!(ifs.getObjectType().equals("FILE") || ifs.getObjectType().equals("MBR"))) - { // Invalid object type - throw new IllegalPathNameException(name, IllegalPathNameException.OBJECT_TYPE_NOT_VALID); - } - // Set the instance data as appropriate - library_ = ifs.getLibraryName(); - file_ = ifs.getObjectName(); - name_ = name; - } - - - /** - *Retrieves the file description for the file, and creates a RecordFormat - *object for each record format, which can be used as input to the - *AS400File.setRecordFormat() - *method. If the file is a physical file, the RecordFormat array returned - *contains one - *RecordFormat object. If the file is a multiple format logical file, the - *RecordFormat array may contain - *more than one RecordFormat object. - *The server to which to connect and the integrated file system - *pathname for the file must be set prior to invoking this method. - *@see AS400FileRecordDescription#AS400FileRecordDescription(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400FileRecordDescription#setPath - *@see AS400FileRecordDescription#setSystem - - *@return The record format(s) for the file. - - *@exception AS400Exception If the server returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception IOException If an error occurs while communicating with the - *server. - *@exception InterruptedException If this thread is interrupted. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the server cannot be located. - - **/ - public /*@E0D synchronized */ RecordFormat[] retrieveRecordFormat() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // ------------------------------------------------------------ - // Retrieve the field information for the file - // ------------------------------------------------------------ - // Generate file on the server containing the file field description - // ------------------------------------------------------------ - String cmd = "DSPFFD FILE(" + library_ + "/" + file_ + ") OUTPUT(*OUTFILE) OUTFILE(QTEMP/JT4FFD)"; - //@B5D theFile_.chooseImpl(); - Record[] records = null; //@E0A - boolean neededToResetCcsid = false; - - synchronized(lockJT4FFD_) //@E0A - { //@E0A - AS400FileImplBase tempFile = null; - boolean done = false; - - for (int i=0; !done && i<2; i++) // no more than two tries - { - AS400Message[] msgs = theFile_.execute(cmd); //@B5C - - if(msgs.length > 0) - { - if(!(msgs[0].getID().equals("CPF9861") || // "Output file ... created in library ..." - msgs[0].getID().equals("CPF3030"))) // "... records added to member ... in file ..." - { - throw new AS400Exception(msgs); - } - } - else - { // Unexpected reply - Trace.log(Trace.ERROR, "DSPFFD failed to return success message", cmd); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - - // Read all the records from the file so we can extract the field information locally - //@B5D SequentialFile dspffd = new SequentialFile(system_, "/QSYS.LIB/QTEMP.LIB/JT4FFD.FILE"); - - if (tempFile == null) - { - tempFile = (AS400FileImplBase)system_.loadImpl("com.ibm.as400.access.AS400FileImplNative", //@B5A - "com.ibm.as400.access.AS400FileImplRemote"); //@B5A - tempFile.setAll(system_, "/QSYS.LIB/QTEMP.LIB/JT4FFD.FILE", //@B5A - new QWHDRFFDFormat(system_.getCcsid()), false, false, false); //@B5A - } - - //@B5D try - //@B5D { - //@B5D dspffd.setRecordFormat(new QWHDRFFDFormat(system_.getCcsid())); - //@B5D } - //@B5D catch(PropertyVetoException e) - //@B5D { // Quiet the compiler - //@B5D } - records = tempFile.readAll("seq", 100); //@B5C @D1C @E0C - - if (records.length == 0) - { - // We got no records back. Assume that it's because the default CCSID for the outfile was incompatible with the CCSID for the file's format. - // Reset the outfile's CCSID and try again. - done = false; - neededToResetCcsid = true; - int ccsid = system_.getCcsid(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "No records were returned from command " + cmd + "; system CCSID is: " + ccsid + ". Resetting CCSID of DSPFFD OUTFILE to " + ccsid); - resetOutfileCCSID("QTEMP", "JT4FFD", ccsid); - } - else done = true; - - } // 'for' loop - - tempFile.delete(); //@E0A - } // 'synchronized' block - - if (records.length == 0) - { - Trace.log(Trace.ERROR, "No records were returned from command " + cmd); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - - // ------------------------------------------------------------ - // Retrieve the key field information for the file - // ------------------------------------------------------------ - // Generate file on the server containing the key field description - cmd = "DSPFD FILE(" + library_ + "/" + file_ + ") TYPE(*ACCPTH) OUTPUT(*OUTFILE) OUTFILE(QTEMP/JT4FD)"; - Record[] keyRecords = null; //@E0A - - synchronized(lockJT4FD_) //@E0A - { //@E0A - AS400FileImplBase tempFile = null; - boolean done = false; - - for (int i=0; !done && i<2; i++) // no more than two tries - { - AS400Message[] msgs = theFile_.execute(cmd); //@B5C @E0C - - if(msgs.length > 0) - { - if(!(msgs[0].getID().equals("CPF9861") || msgs[0].getID().equals("CPF3030"))) - { - throw new AS400Exception(msgs); - } - } - else - { // Unexpected reply - Trace.log(Trace.ERROR, "DSPFD failed to return success message", cmd); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - - // Read all the records from the file so we can extract the key field information locally - //@B5D dspffd = new SequentialFile(system_, "/QSYS.LIB/QTEMP.LIB/JT4FD.FILE"); - if (tempFile == null) - { - tempFile = (AS400FileImplBase)system_.loadImpl("com.ibm.as400.access.AS400FileImplNative", //@B5A @E0C - "com.ibm.as400.access.AS400FileImplRemote"); //@B5A - tempFile.setAll(system_, "/QSYS.LIB/QTEMP.LIB/JT4FD.FILE", //@B5A - new QWHFDACPFormat(system_.getCcsid()), false, false, false); //@B5A - } - //@B5D try - //@B5D { - //@B5D dspffd.setRecordFormat(new QWHFDACPFormat(system_.getCcsid())); - //@B5D } - //@B5D catch(PropertyVetoException e) - //@B5D { // Quiet the compiler - //@B5D } - keyRecords = tempFile.readAll("key", 100); //@B5C @D1C @E0C - - // If we needed to reset the CCSID of the DSPFD temp file, we probably also need to reset the CCSID of the DSPFD temp file. - if (keyRecords.length == 0 && neededToResetCcsid) - { - // We got no records back. Assume that it's because the default CCSID for the outfile was incompatible with the CCSID for the file's format. - // Reset the outfile's CCSID and try again. - done = false; - int ccsid = system_.getCcsid(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "No key records were returned from command " + cmd + "; system CCSID is: " + ccsid + ". Resetting CCSID of DSPFD OUTFILE to " + ccsid); - resetOutfileCCSID("QTEMP", "JT4FD", ccsid); - } - else done = true; - } // 'for' loop - - tempFile.delete(); //@E0A - } //@E0A - - // Determine the number of record formats contained in the file - int numberOfRecordFormats = ((BigDecimal)records[0].getField("WHCNT")).intValue(); - int numberOfFields = 0; - int numberOfKeyFields = 0; - int recordNumber = 0; - int keyRecordNumber = 0; - String rfNameUntrimmed; - String rfName; - RecordFormat[] rfs = new RecordFormat[numberOfRecordFormats]; - for(int i = 0; i < numberOfRecordFormats; ++i) - { // Create source file for a particular record format - // Determine the name of the record format and hence the name of the file and class - rfNameUntrimmed = (String)records[recordNumber].getField("WHNAME"); - rfName = rfNameUntrimmed.trim(); - rfs[i] = new RecordFormat(rfName); - // Get the field descriptions. - numberOfFields = ((BigDecimal)records[recordNumber].getField("WHNFLD")).intValue(); - if(numberOfFields > 0) - { // Number of fields is greater than 0 - for(int j = 0; j < numberOfFields; ++j, ++recordNumber) - { // Add a field description to the record format - addFieldDescription(rfs[i], records[recordNumber]); - } - } - - // Get the key field descriptions for this record format if there are any - numberOfKeyFields = ((BigDecimal)keyRecords[keyRecordNumber].getField("APNKYF")).intValue(); - if(numberOfKeyFields > 0) - { // Number of key fields is greater than 0 - for(int j = 0; j < numberOfKeyFields; ++j, ++keyRecordNumber) - { // Add a key field description to the record format - rfs[i].addKeyFieldDescription(((String)keyRecords[keyRecordNumber].getField("APKEYF")).trim()); - } - } - } - return rfs; - } - - private final void resetOutfileCCSID(String library, String file, int ccsid) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - String cmd = "CHGPF FILE(" + library + "/" + file + ") SRCFILE(*NONE) CCSID("+ccsid+")"; - AS400Message[] msgs = theFile_.execute(cmd); - - if(msgs.length > 0) - { - if(!(msgs[0].getID().equals("CPD3238") || // "A new format was created for file ..." - msgs[0].getID().equals("CPC7303"))) // "File JT4FFD in library QTEMP changed" - { - throw new AS400Exception(msgs); - } - } - else - { // Unexpected reply - Trace.log(Trace.ERROR, "CHGPF failed to return success message", cmd); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - /** - *Sets the integrated file system path name for - *the file. - *@param name The integrated file system path name - *of the file. If a member is not specified in name, the first - *member of the file is used. - **/ - public void setPath(String name) - { - if(theFile_ != null) //@B5A - { - theFile_.setPath(name); - } - parseName(name); //@B5A - name_ = name; - } - - /** - *Sets the system to which to connect. - *@param system The system to which to conenct. - **/ - public void setSystem(AS400Impl system) //@B5C - { - if(theFile_ == null) //@B5A - { - theFile_ = (AS400FileImplBase)((AS400ImplRemote)system).loadImpl("com.ibm.as400.access.AS400FileImplNative", //@B5A - "com.ibm.as400.access.AS400FileImplRemote"); //@B5A - if(!name_.equals("")) //@B5A - { - theFile_.setPath(name_); //@B5A - } - } - theFile_.setSystem(system); - - system_ = (AS400ImplRemote)system; //@B5C - } - - /** - *Writes a field description to the specified file. The field description - *is created with information extracted from the Record object provided. - *@param sourceFile The file to which to write the field description. - *@param record The record from which to obtain the field information. - *@exception If an error occurs during conversion. - **/ - public void writeFieldDescription(PrintWriter sourceFile, Record record) - throws UnsupportedEncodingException - { - char fieldType = ((String)record.getField("WHFLDT")).charAt(0); - FieldDescription fd = null; - int digits; - int decimalPositions; - int byteLength; //@A1A: For float field descriptions - String fieldName = ((String)record.getField("WHFLDE")).trim(); - int ccsid; - switch(fieldType) - { - case 'A': // Character field - // Need to get the length in bytes of the field and the ccsid of the field - // when creating the AS400Text object. The name of the field is set to be - // the DDS name of the field (which causes the DDS name of the field description - // to be the DDS name as well). - ccsid = ((BigDecimal)record.getField("WHCCSID")).intValue(); - if(ccsid == 65535) - { - // 65535 is not a valid ccsid, retrieve the default system ccsid - ccsid = system_.getCcsid(); - } - sourceFile.println(" addFieldDescription(new CharacterFieldDescription(new AS400Text(" + String.valueOf((((String)record.getField("WHVARL")).equals("Y"))? - ((BigDecimal)record.getField("WHFLDB")).intValue() - 2 : - ((BigDecimal)record.getField("WHFLDB")).intValue()) + ", " + - ccsid + "), \"" + - fieldName + "\"));"); - if(((String)record.getField("WHVARL")).equals("Y")) - { - if(((BigDecimal)record.getField("WHALLC")).intValue() > 0) - { // A length was specified on the VARLEN keyword - sourceFile.println(" ((CharacterFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setVARLEN(" + ((BigDecimal)record.getField("WHALLC")).intValue() + ");"); - } - else - { // No length was specified on the VARLEN keyword - sourceFile.println(" ((CharacterFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setVariableLength(true);"); - } - } - // Set if null values are allowed - if(((String)record.getField("WHNULL")).equals("Y")) - { - sourceFile.println(" getFieldDescription(\"" + - fieldName + "\").setALWNULL(true);"); - } - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - sourceFile.println(" ((CharacterFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTNull();"); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - sourceFile.println(" ((CharacterFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFT(\"" + adjDft + "\");"); - } - // Do nothing if a special value was present and we didn't know what - // it was. - } - break; - case 'B': // Binary field - digits = ((BigDecimal)record.getField("WHFLDO")).intValue(); -// if (digits < 6) - if(digits < 5) // @A2C - { - sourceFile.println(" addFieldDescription(new BinaryFieldDescription(new AS400Bin2(), \"" + - fieldName + "\", \"" + - fieldName + "\", " + String.valueOf(digits) + "));"); - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - String dft = ((String)record.getField("WHDFT")).trim(); - if(dft.charAt(0) == '+') - { - dft = dft.substring(1); - } - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - sourceFile.println(" ((BinaryFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTNull();"); - } - // Handle value - else - { - sourceFile.println(" ((BinaryFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFT(new Short(\"" + dft + "\"));"); - } - } - } - else if (digits < 10) //@F0C - { - sourceFile.println(" addFieldDescription(new BinaryFieldDescription(new AS400Bin4(), \"" + - fieldName + "\", \"" + - fieldName + "\", " + String.valueOf(digits) + "));"); - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - String dft = ((String)record.getField("WHDFT")).trim(); - if(dft.charAt(0) == '+') - { - dft = dft.substring(1); - } - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - sourceFile.println(" ((BinaryFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTNull();"); - } - // Handle value - else - { - sourceFile.println(" ((BinaryFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFT(new Integer(\"" + dft + "\"));"); - } - } - } - else //@F0A - { - sourceFile.println(" addFieldDescription(new BinaryFieldDescription(new AS400Bin8(), \"" + - fieldName + "\", \"" + - fieldName + "\", " + String.valueOf(digits) + "));"); - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - String dft = ((String)record.getField("WHDFT")).trim(); - if(dft.charAt(0) == '+') - { - dft = dft.substring(1); - } - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - sourceFile.println(" ((BinaryFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTNull();"); - } - // Handle value - else - { - sourceFile.println(" ((BinaryFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFT(new Long(\"" + dft + "\"));"); - } - } - } - // Set if null values are allowed - if(((String)record.getField("WHNULL")).equals("Y")) - { - sourceFile.println(" getFieldDescription(\"" + - fieldName + "\").setALWNULL(true);"); - } - break; - case 'E': // DBCS-Either field - // Need to get the length in bytes of the field and the ccsid of the field - // when creating the AS400Text object. The name of the field is set to be - // the DDS name of the field (which causes the DDS name of the field description - // to be the DDS name as well). - ccsid = ((BigDecimal)record.getField("WHCCSID")).intValue(); - if(ccsid == 65535) - { - // 65535 is not a valid ccsid, retrieve the default system ccsid - ccsid = system_.getCcsid(); - } - sourceFile.println(" addFieldDescription(new DBCSEitherFieldDescription(new AS400Text(" - + String.valueOf((((String)record.getField("WHVARL")).equals("Y"))? - ((BigDecimal)record.getField("WHFLDB")).intValue() - 2 : - ((BigDecimal)record.getField("WHFLDB")).intValue()) + ", " + - ccsid + "), \"" + - fieldName + "\"));"); - // Set if variable length - if(((String)record.getField("WHVARL")).equals("Y")) - { - if(((BigDecimal)record.getField("WHALLC")).intValue() > 0) - { // A length was specified on the VARLEN keyword - sourceFile.println(" ((DBCSEitherFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setVARLEN(" + ((BigDecimal)record.getField("WHALLC")).intValue() + ");"); - } - else - { // No length was specified on the VARLEN keyword - sourceFile.println(" ((DBCSEitherFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setVariableLength(true);"); - } - } - // Set if null values are allowed - if(((String)record.getField("WHNULL")).equals("Y")) - { - sourceFile.println(" getFieldDescription(\"" + - fieldName + "\").setALWNULL(true);"); - } - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - sourceFile.println(" ((DBCSEitherFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTNull();"); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - sourceFile.println(" ((DBCSEitherFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFT(\"" + adjDft + "\");"); - } - // Do nothing if a special value was present and we didn't know what - // it was. - } - break; - case 'F': // Float field - digits = ((BigDecimal)record.getField("WHFLDO")).intValue(); - decimalPositions = ((BigDecimal)record.getField("WHFLDP")).intValue(); - //@A1A: Retrieve byte length to determine if field is single or double - // precision - byteLength = ((BigDecimal)record.getField("WHFLDB")).intValue(); //@A1A - if(byteLength == 4) //@A1A - { - sourceFile.println(" addFieldDescription(new FloatFieldDescription(new AS400Float4(), \"" + - fieldName + "\", \"" + - fieldName + "\", " + String.valueOf(digits) + - ", " + String.valueOf(decimalPositions) + "));"); - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - String dft = ((String)record.getField("WHDFT")).trim(); - if(dft.charAt(0) == '+') - { - dft = dft.substring(1); - } - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - sourceFile.println(" ((FloatFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTNull();"); - } - // Handle value - else - { - sourceFile.println(" ((FloatFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFT(new Float(\"" + dft + "\"));"); - } - } - } - else if(byteLength == 8) //@A1A - { - sourceFile.println(" addFieldDescription(new FloatFieldDescription(new AS400Float8(), \"" + - fieldName + "\", \"" + - fieldName + "\", " + String.valueOf(digits) + - ", " + String.valueOf(decimalPositions) + "));"); - // Set the FLTPCN keyword to *DOUBLE - sourceFile.println(" ((FloatFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setFLTPCN(\"*DOUBLE\");"); - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - String dft = ((String)record.getField("WHDFT")).trim(); - if(dft.charAt(0) == '+') - { - dft = dft.substring(1); - } - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - sourceFile.println(" ((FloatFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTNull();"); - } - // Handle value - else - { - sourceFile.println(" ((FloatFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFT(new Double(\"" + dft + "\"));"); - } - } - } - else //@A1A: This should never occur, but for completeness.... - { - //@A1A - Trace.log(Trace.ERROR, "FloatFieldDescription error in byte length"); - throw new InternalErrorException(InternalErrorException.UNKNOWN); //@A1A - } //@A1A - // Set if null values are allowed - if(((String)record.getField("WHNULL")).equals("Y")) - { - sourceFile.println(" getFieldDescription(\"" + - fieldName + "\").setALWNULL(true);"); - } - break; - case 'G': // DBCS-Graphic field - // Need to get the length in bytes of the field and the ccsid of the field - // when creating the AS400Text object. The name of the field is set to be - // the DDS name of the field (which causes the DDS name of the field description - // to be the DDS name as well). - ccsid = ((BigDecimal)record.getField("WHCCSID")).intValue(); - if(ccsid == 65535) - { - // 65535 is not a valid ccsid, retrieve the default system ccsid - ccsid = system_.getCcsid(); - } - sourceFile.println(" addFieldDescription(new DBCSGraphicFieldDescription(new AS400Text(" - + String.valueOf((((String)record.getField("WHVARL")).equals("Y"))? - ((BigDecimal)record.getField("WHFLDB")).intValue() - 2 : - ((BigDecimal)record.getField("WHFLDB")).intValue()) + ", " + - ccsid + "), \"" + - fieldName + "\"));"); - // Set if variable length - if(((String)record.getField("WHVARL")).equals("Y")) - { - if(((BigDecimal)record.getField("WHALLC")).intValue() > 0) - { // A length was specified on the VARLEN keyword - sourceFile.println(" ((DBCSGraphicFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setVARLEN(" + ((BigDecimal)record.getField("WHALLC")).intValue() + ");"); - } - else - { // No length was specified on the VARLEN keyword - sourceFile.println(" ((DBCSGraphicFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setVariableLength(true);"); - } - } - // Set if null values are allowed - if(((String)record.getField("WHNULL")).equals("Y")) - { - sourceFile.println(" getFieldDescription(\"" + - fieldName + "\").setALWNULL(true);"); - } - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - sourceFile.println(" ((DBCSGraphicFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTNull();"); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - sourceFile.println(" ((DBCSGraphicFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFT(\"" + adjDft + "\");"); - } - // Do nothing if a special value was present and we didn't know what - // it was. - } - break; - case 'H': // Hex field - // Need to get the length in bytes of the field - // when creating the AS400ByteArray object. The name of the field is set to be - // the DDS name of the field (which causes the DDS name of the field description - // to be the DDS name as well). - sourceFile.println(" addFieldDescription(new HexFieldDescription(new AS400ByteArray(" - + String.valueOf((((String)record.getField("WHVARL")).equals("Y"))? - ((BigDecimal)record.getField("WHFLDB")).intValue() - 2 : - ((BigDecimal)record.getField("WHFLDB")).intValue()) + "), \"" + - fieldName + "\"));"); - // Set if variable length - if(((String)record.getField("WHVARL")).equals("Y")) - { - if(((BigDecimal)record.getField("WHALLC")).intValue() > 0) - { // A length was specified on the VARLEN keyword - sourceFile.println(" ((HexFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setVARLEN(" + ((BigDecimal)record.getField("WHALLC")).intValue() + ");"); - } - else - { // No length was specified on the VARLEN keyword - sourceFile.println(" ((HexFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setVariableLength(true);"); - } - } - // Set if null values are allowed - if(((String)record.getField("WHNULL")).equals("Y")) - { - sourceFile.println(" getFieldDescription(\"" + - fieldName + "\").setALWNULL(true);"); - } - // @B0A: Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - sourceFile.println(" ((HexFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTNull();"); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - byte[] byteDft = adjDft.getBytes(); - sourceFile.print(" ((HexFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFT(new byte[] { "); - sourceFile.print(byteDft[0]); - for(int i=1; i 0) - { // A length was specified on the VARLEN keyword - sourceFile.println(" ((DBCSOnlyFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setVARLEN(" + ((BigDecimal)record.getField("WHALLC")).intValue() + ");"); - } - else - { // No length was specified on the VARLEN keyword - sourceFile.println(" ((DBCSOnlyFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setVariableLength(true);"); - } - } - // Set if null values are allowed - if(((String)record.getField("WHNULL")).equals("Y")) - { - sourceFile.println(" getFieldDescription(\"" + - fieldName + "\").setALWNULL(true);"); - } - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - sourceFile.println(" ((DBCSOnlyFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTNull();"); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - sourceFile.println(" ((DBCSOnlyFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFT(\"" + adjDft + "\");"); - } - // Do nothing if a special value was present and we didn't know what - // it was. - } - break; - case 'L': // Date field - ccsid = ((BigDecimal)record.getField("WHCCSID")).intValue(); - if(ccsid == 65535) - { - // 65535 is not a valid ccsid, retrieve the default system ccsid - ccsid = system_.getCcsid(); - } - sourceFile.println(" addFieldDescription(new DateFieldDescription(new AS400Text(" - + String.valueOf(((BigDecimal)record.getField("WHFLDB")).intValue()) + ", " + - ccsid + "), \"" + - fieldName + "\"));"); - // Set date format and date separator values - sourceFile.println(" ((DateFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDATFMT(\"" + (String)record.getField("WHFMT") + "\");"); - if(!((String)record.getField("WHSEP")).equals(" ")) - { - sourceFile.println(" ((DateFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDATSEP(\"" + (String)record.getField("WHSEP") + "\");"); - } - // Set if null values are allowed - if(((String)record.getField("WHNULL")).equals("Y")) - { - sourceFile.println(" getFieldDescription(\"" + - fieldName + "\").setALWNULL(true);"); - } - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - sourceFile.println(" ((DateFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTNull();"); - } - // Handle CURRENT_DATE (an SQL special value) - else if(dft.indexOf("CURRENT_DATE") != -1) - { - sourceFile.println(" ((DateFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTCurrent();"); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - sourceFile.println(" ((DateFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFT(\"" + adjDft + "\");"); - } - } - break; - case 'O': // DBCS-Open field - // Need to get the length in bytes of the field and the ccsid of the field - // when creating the AS400Text object. The name of the field is set to be - // the DDS name of the field (which causes the DDS name of the field description - // to be the DDS name as well). - ccsid = ((BigDecimal)record.getField("WHCCSID")).intValue(); - if(ccsid == 65535) - { - // 65535 is not a valid ccsid, retrieve the default system ccsid - ccsid = system_.getCcsid(); - } - sourceFile.println(" addFieldDescription(new DBCSOpenFieldDescription(new AS400Text(" - + String.valueOf((((String)record.getField("WHVARL")).equals("Y"))? - ((BigDecimal)record.getField("WHFLDB")).intValue() - 2 : - ((BigDecimal)record.getField("WHFLDB")).intValue()) + ", " + - ccsid + "), \"" + - fieldName + "\"));"); - // Set if variable length - if(((String)record.getField("WHVARL")).equals("Y")) - { - if(((BigDecimal)record.getField("WHALLC")).intValue() > 0) - { // A length was specified on the VARLEN keyword - sourceFile.println(" ((DBCSOpenFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setVARLEN(" + ((BigDecimal)record.getField("WHALLC")).intValue() + ");"); - } - else - { // No length was specified on the VARLEN keyword - sourceFile.println(" ((DBCSOpenFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setVariableLength(true);"); - } - } - // Set if null values are allowed - if(((String)record.getField("WHNULL")).equals("Y")) - { - sourceFile.println(" getFieldDescription(\"" + - fieldName + "\").setALWNULL(true);"); - } - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - sourceFile.println(" ((DBCSOpenFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTNull();"); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - sourceFile.println(" ((DBCSOpenFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFT(\"" + adjDft + "\");"); - } - // Do nothing if a special value was present and we didn't know what - // it was. - } - break; - case 'P': // Packed decimal field - digits = ((BigDecimal)record.getField("WHFLDO")).intValue(); - decimalPositions = ((BigDecimal)record.getField("WHFLDP")).intValue(); - sourceFile.println(" addFieldDescription(new PackedDecimalFieldDescription(new AS400PackedDecimal(" + - String.valueOf(digits) + ", " + String.valueOf(decimalPositions) + "), \"" + - fieldName + "\"));"); - // Set if null values are allowed - if(((String)record.getField("WHNULL")).equals("Y")) - { - sourceFile.println(" getFieldDescription(\"" + - fieldName + "\").setALWNULL(true);"); - } - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - String dft = ((String)record.getField("WHDFT")).trim(); - if(dft.charAt(0) == '+') - { - dft = dft.substring(1); - } - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - sourceFile.println(" ((PackedDecimalFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTNull();"); - } - // Handle value - else - { - sourceFile.println(" ((PackedDecimalFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFT(new BigDecimal(\"" + dft + "\"));"); - } - } - break; - case 'S': // Zoned decimal field - digits = ((BigDecimal)record.getField("WHFLDO")).intValue(); - decimalPositions = ((BigDecimal)record.getField("WHFLDP")).intValue(); - sourceFile.println(" addFieldDescription(new ZonedDecimalFieldDescription(new AS400ZonedDecimal(" + - String.valueOf(digits) + ", " + String.valueOf(decimalPositions) + "), \"" + - fieldName + "\"));"); - // Set if null values are allowed - if(((String)record.getField("WHNULL")).equals("Y")) - { - sourceFile.println(" getFieldDescription(\"" + - fieldName + "\").setALWNULL(true);"); - } - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - String dft = ((String)record.getField("WHDFT")).trim(); - if(dft.charAt(0) == '+') - { - dft = dft.substring(1); - } - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - sourceFile.println(" ((ZonedDecimalFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTNull();"); - } - // Handle value - else - { - sourceFile.println(" ((ZonedDecimalFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFT(new BigDecimal(\"" + dft + "\"));"); - } - } - break; - case 'T': // Time field - ccsid = ((BigDecimal)record.getField("WHCCSID")).intValue(); - if(ccsid == 65535) - { - // 65535 is not a valid ccsid, retrieve the default system ccsid - ccsid = system_.getCcsid(); - } - sourceFile.println(" addFieldDescription(new TimeFieldDescription(new AS400Text(" - + String.valueOf(((BigDecimal)record.getField("WHFLDB")).intValue()) + ", " + - ccsid + "), \"" + - fieldName + "\"));"); - // Set date format and date separator values - sourceFile.println(" ((TimeFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setTIMFMT(\"" + (String)record.getField("WHFMT") + "\");"); - if(!((String)record.getField("WHSEP")).equals(" ")) - { - sourceFile.println(" ((TimeFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setTIMSEP(\"" + (String)record.getField("WHSEP") + "\");"); - } - // Set if null values are allowed - if(((String)record.getField("WHNULL")).equals("Y")) - { - sourceFile.println(" getFieldDescription(\"" + - fieldName + "\").setALWNULL(true);"); - } - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - sourceFile.println(" ((TimeFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTNull();"); - } - // Handle CURRENT_TIME (an SQL special value) - else if(dft.indexOf("CURRENT_TIME") != -1) - { - sourceFile.println(" ((TimeFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTCurrent();"); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - sourceFile.println(" ((TimeFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFT(\"" + adjDft + "\");"); - } - } - break; - case 'Z': // Timestamp field - ccsid = ((BigDecimal)record.getField("WHCCSID")).intValue(); - if(ccsid == 65535) - { - // 65535 is not a valid ccsid, retrieve the default system ccsid - ccsid = system_.getCcsid(); - } - sourceFile.println(" addFieldDescription(new TimestampFieldDescription(new AS400Text(" - + String.valueOf(((BigDecimal)record.getField("WHFLDB")).intValue()) + ", " + - ccsid + "), \"" + - fieldName + "\"));"); - // Set if null values are allowed - if(((String)record.getField("WHNULL")).equals("Y")) - { - sourceFile.println(" getFieldDescription(\"" + - fieldName + "\").setALWNULL(true);"); - } - // Set the DFT keyword value if specified - if(((BigDecimal)record.getField("WHDFTL")).intValue() > 0) - { - // Need to strip off the beginning and ending apostrophes - String dft = (String)record.getField("WHDFT"); - // @B0C - // Check for any special values that could be specified as the default. - // Handle *NULL - if(dft.indexOf("*NULL") != -1) - { - sourceFile.println(" ((TimestampFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTNull();"); - } - // Handle CURRENT_TIMESTAMP (an SQL special value) - else if(dft.indexOf("CURRENT_TIMESTAMP") != -1) - { - sourceFile.println(" ((TimestampFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFTCurrent();"); - } - // Handle 'value' - else if(dft.indexOf("'") != -1) - { - String adjDft = dft.substring(dft.indexOf("'") + 1, dft.lastIndexOf("'")); - sourceFile.println(" ((TimestampFieldDescription)getFieldDescription(\"" + - fieldName + "\")).setDFT(\"" + adjDft + "\");"); - } - } - break; - } - } -} - -/** - *Class representing the record format of the data returned from the - *DSPFD command (Display File Description) when the type of data requested - *is *ACCPTH. *ACCPTH returns data describing the key fields of the file - *if any exist. -**/ -class QWHFDACPFormat extends RecordFormat -{ - static final long serialVersionUID = 4L; // @B6A - - QWHFDACPFormat(int ccsid) - { - super("QWHFDACP"); - - AS400Text txt1 = new AS400Text(1, ccsid); - AS400Text txt3 = new AS400Text(3, ccsid); - AS400Text txt4 = new AS400Text(4, ccsid); - AS400Text txt6 = new AS400Text(6, ccsid); - AS400Text txt8 = new AS400Text(8, ccsid); - AS400Text txt10 = new AS400Text(10, ccsid); - AS400PackedDecimal p30 = new AS400PackedDecimal(3, 0); - - addFieldDescription(new CharacterFieldDescription(txt1, "APRCEN")); - addFieldDescription(new CharacterFieldDescription(txt6, "APRDAT")); - addFieldDescription(new CharacterFieldDescription(txt6, "APRTIM")); - addFieldDescription(new CharacterFieldDescription(txt10, "APFILE")); - addFieldDescription(new CharacterFieldDescription(txt10, "APLIB")); - addFieldDescription(new CharacterFieldDescription(txt1, "APFTYP")); - addFieldDescription(new CharacterFieldDescription(txt4, "APFILA")); - addFieldDescription(new CharacterFieldDescription(txt3, "APMXD")); - addFieldDescription(new CharacterFieldDescription(txt6, "APFATR")); - addFieldDescription(new CharacterFieldDescription(txt8, "APSYSN")); - addFieldDescription(new PackedDecimalFieldDescription(p30, "APASP")); - addFieldDescription(new CharacterFieldDescription(txt4, "APRES")); - addFieldDescription(new CharacterFieldDescription(txt1, "APMANT")); - addFieldDescription(new CharacterFieldDescription(txt1, "APUNIQ")); - addFieldDescription(new CharacterFieldDescription(txt1, "APKEYO")); - addFieldDescription(new CharacterFieldDescription(txt1, "APSELO")); - addFieldDescription(new CharacterFieldDescription(txt1, "APACCP")); - addFieldDescription(new PackedDecimalFieldDescription(p30, "APNSCO")); - addFieldDescription(new CharacterFieldDescription(txt10, "APBDF")); - addFieldDescription(new CharacterFieldDescription(txt10, "APBOL")); - addFieldDescription(new CharacterFieldDescription(txt10, "APBOLF")); - addFieldDescription(new PackedDecimalFieldDescription(p30, "APNKYF")); - addFieldDescription(new CharacterFieldDescription(txt10, "APKEYF")); - addFieldDescription(new CharacterFieldDescription(txt1, "APKSEQ")); - addFieldDescription(new CharacterFieldDescription(txt1, "APKSIN")); - addFieldDescription(new CharacterFieldDescription(txt1, "APKZD")); - addFieldDescription(new CharacterFieldDescription(txt1, "APKASQ")); - addFieldDescription(new PackedDecimalFieldDescription(p30, "APKEYN")); - addFieldDescription(new CharacterFieldDescription(txt1, "APJOIN")); - addFieldDescription(new CharacterFieldDescription(txt1, "APACPJ")); - addFieldDescription(new CharacterFieldDescription(txt1, "APRIKY")); - } -} - -/** - *Class representing the record format of the data returned from the - *DSPFD command (Display File Description) when the type of data requested - *is *RCDFMT. *RCDFMT returns data describing the record format of the file. -**/ -class QWHFDFMTFormat extends RecordFormat -{ - static final long serialVersionUID = 4L; // @B6A - - QWHFDFMTFormat(int ccsid) - { - super("QWHFDFMT"); - - AS400Text txt1 = new AS400Text(1, ccsid); - AS400Text txt4 = new AS400Text(4, ccsid); - AS400Text txt6 = new AS400Text(6, ccsid); - AS400Text txt8 = new AS400Text(8, ccsid); - AS400Text txt10 = new AS400Text(10, ccsid); - AS400Text txt13 = new AS400Text(13, ccsid); - AS400Text txt50 = new AS400Text(50, ccsid); - AS400PackedDecimal p30 = new AS400PackedDecimal(3, 0); - AS400PackedDecimal p31 = new AS400PackedDecimal(3, 1); - AS400PackedDecimal p41 = new AS400PackedDecimal(4, 1); - AS400PackedDecimal p40 = new AS400PackedDecimal(4, 0); - AS400PackedDecimal p50 = new AS400PackedDecimal(5, 0); - - addFieldDescription(new CharacterFieldDescription(txt1, "RFRCEN")); - addFieldDescription(new CharacterFieldDescription(txt6, "RFRDAT")); - addFieldDescription(new CharacterFieldDescription(txt6, "RFRTIM")); - addFieldDescription(new CharacterFieldDescription(txt10, "RFFILE")); - addFieldDescription(new CharacterFieldDescription(txt10, "RFLIB")); - addFieldDescription(new CharacterFieldDescription(txt1, "RFFTYP")); - addFieldDescription(new CharacterFieldDescription(txt4, "RFFILA")); - addFieldDescription(new CharacterFieldDescription(txt1, "RFMXDD")); - addFieldDescription(new CharacterFieldDescription(txt1, "RFMXDC")); - addFieldDescription(new CharacterFieldDescription(txt1, "RFMXDB")); - addFieldDescription(new CharacterFieldDescription(txt6, "RFFATR")); - addFieldDescription(new CharacterFieldDescription(txt8, "RFSYSN")); - addFieldDescription(new PackedDecimalFieldDescription(p30, "RFASP")); - addFieldDescription(new CharacterFieldDescription(txt4, "RFRES")); - addFieldDescription(new PackedDecimalFieldDescription(p40, "RFTOTF")); - addFieldDescription(new CharacterFieldDescription(txt10, "RFNAME")); - addFieldDescription(new PackedDecimalFieldDescription(p50, "RFFLDN")); - addFieldDescription(new PackedDecimalFieldDescription(p50, "RFLEN")); - addFieldDescription(new CharacterFieldDescription(txt13, "RFID")); - addFieldDescription(new CharacterFieldDescription(txt1, "RFTYPE")); - addFieldDescription(new CharacterFieldDescription(txt10, "RFASFN")); - addFieldDescription(new CharacterFieldDescription(txt50, "RFFTXT")); - addFieldDescription(new PackedDecimalFieldDescription(p40, "RFHIGH")); - addFieldDescription(new PackedDecimalFieldDescription(p50, "RFWIDE")); - addFieldDescription(new CharacterFieldDescription(txt10, "RFFONT")); - addFieldDescription(new PackedDecimalFieldDescription(p30, "RFPGRT")); - addFieldDescription(new PackedDecimalFieldDescription(p31, "RFLPI")); - addFieldDescription(new PackedDecimalFieldDescription(p31, "RFCHWD")); - addFieldDescription(new PackedDecimalFieldDescription(p31, "RFCHHI")); - addFieldDescription(new PackedDecimalFieldDescription(p41, "RFPNTS")); - addFieldDescription(new CharacterFieldDescription(txt1, "RFWIN")); - addFieldDescription(new CharacterFieldDescription(txt10, "RFFCSN")); - addFieldDescription(new CharacterFieldDescription(txt10, "RFFCSL")); - addFieldDescription(new CharacterFieldDescription(txt10, "RFFCPN")); - addFieldDescription(new CharacterFieldDescription(txt10, "RFFCPL")); - addFieldDescription(new CharacterFieldDescription(txt10, "RFCDFN")); - addFieldDescription(new CharacterFieldDescription(txt10, "RFCDFL")); - addFieldDescription(new CharacterFieldDescription(txt10, "RFDCDF")); - addFieldDescription(new CharacterFieldDescription(txt10, "RFDCDL")); - addFieldDescription(new CharacterFieldDescription(txt1, "RFMNB")); - addFieldDescription(new CharacterFieldDescription(txt1, "RFPLD")); - } -} - -/** - *Class representing the record format of the data returned from the - *DSPFFD command (Display File Field Description). -**/ -class QWHDRFFDFormat extends RecordFormat -{ - static final long serialVersionUID = 4L; // @B6A - - QWHDRFFDFormat(int ccsid) - { - super("QWHDRFFD"); - - AS400Text txt1 = new AS400Text(1, ccsid); - AS400Text txt2 = new AS400Text(2, ccsid); - AS400Text txt4 = new AS400Text(4, ccsid); - AS400Text txt7 = new AS400Text(7, ccsid); - AS400Text txt8 = new AS400Text(8, ccsid); - AS400Text txt10 = new AS400Text(10, ccsid); - AS400Text txt13 = new AS400Text(13, ccsid); - AS400Text txt20 = new AS400Text(20, ccsid); - AS400Text txt30 = new AS400Text(30, ccsid); - AS400Text txt32 = new AS400Text(32, ccsid); - AS400Text txt50 = new AS400Text(50, ccsid); - AS400PackedDecimal p30 = new AS400PackedDecimal(3, 0); - AS400PackedDecimal p50 = new AS400PackedDecimal(5, 0); - AS400PackedDecimal p41 = new AS400PackedDecimal(4, 1); - AS400ZonedDecimal z20 = new AS400ZonedDecimal(2, 0); - AS400ZonedDecimal z30 = new AS400ZonedDecimal(3, 0); - AS400ZonedDecimal z40 = new AS400ZonedDecimal(4, 0); - AS400ZonedDecimal z50 = new AS400ZonedDecimal(5, 0); - AS400ZonedDecimal z31 = new AS400ZonedDecimal(3, 1); - - addFieldDescription(new CharacterFieldDescription(txt10, "WHFILE")); - addFieldDescription(new CharacterFieldDescription(txt10, "WHLIB")); - addFieldDescription(new CharacterFieldDescription(txt7, "WHCRTD")); - addFieldDescription(new CharacterFieldDescription(txt1, "WHFTYP")); - addFieldDescription(new ZonedDecimalFieldDescription(z50, "WHCNT")); - addFieldDescription(new CharacterFieldDescription(txt13, "WHDTTM")); - // Record format name - addFieldDescription(new CharacterFieldDescription(txt10, "WHNAME")); - addFieldDescription(new CharacterFieldDescription(txt13, "WHSEQ")); - addFieldDescription(new CharacterFieldDescription(txt50, "WHTEXT")); - addFieldDescription(new ZonedDecimalFieldDescription(z50, "WHFLDN")); - addFieldDescription(new ZonedDecimalFieldDescription(z50, "WHRLEN")); - addFieldDescription(new CharacterFieldDescription(txt10, "WHFLDI")); - // External field name - addFieldDescription(new CharacterFieldDescription(txt10, "WHFLDE")); - addFieldDescription(new ZonedDecimalFieldDescription(z50, "WHFOBO")); - addFieldDescription(new ZonedDecimalFieldDescription(z50, "WHFIBO")); - // Field length in bytes - addFieldDescription(new ZonedDecimalFieldDescription(z50, "WHFLDB")); - // Number of digits - addFieldDescription(new ZonedDecimalFieldDescription(z20, "WHFLDO")); - // Number of decimal positions - addFieldDescription(new ZonedDecimalFieldDescription(z20, "WHFLDP")); - // Field text description - addFieldDescription(new CharacterFieldDescription(txt50, "WHFTXT")); - addFieldDescription(new ZonedDecimalFieldDescription(z30, "WHRCDE")); - // Reference file - addFieldDescription(new CharacterFieldDescription(txt10, "WHRFIL")); - // Reference library - addFieldDescription(new CharacterFieldDescription(txt10, "WHRLIB")); - // Reference record format - addFieldDescription(new CharacterFieldDescription(txt10, "WHRFMT")); - // Reference field - addFieldDescription(new CharacterFieldDescription(txt10, "WHRFLD")); - // Column heading 1 - addFieldDescription(new CharacterFieldDescription(txt20, "WHCHD1")); - // Column heading 2 - addFieldDescription(new CharacterFieldDescription(txt20, "WHCHD2")); - // Column heading 3 - addFieldDescription(new CharacterFieldDescription(txt20, "WHCHD3")); - // Field type - addFieldDescription(new CharacterFieldDescription(txt1, "WHFLDT")); - addFieldDescription(new CharacterFieldDescription(txt1, "WHFIOB")); - addFieldDescription(new CharacterFieldDescription(txt2, "WHECDE")); - addFieldDescription(new CharacterFieldDescription(txt32, "WHEWRD")); - addFieldDescription(new ZonedDecimalFieldDescription(z40, "WHVCNE")); - // Number of fields - addFieldDescription(new ZonedDecimalFieldDescription(z50, "WHNFLD")); - addFieldDescription(new ZonedDecimalFieldDescription(z20, "WHNIND")); - addFieldDescription(new CharacterFieldDescription(txt1, "WHSHFT")); - addFieldDescription(new CharacterFieldDescription(txt1, "WHALTY")); - // ALIAS - addFieldDescription(new CharacterFieldDescription(txt30, "WHALIS")); - addFieldDescription(new ZonedDecimalFieldDescription(z20, "WHJREF")); - addFieldDescription(new ZonedDecimalFieldDescription(z20, "WHDFTL")); - // Default value - addFieldDescription(new CharacterFieldDescription(txt30, "WHDFT")); - addFieldDescription(new CharacterFieldDescription(txt1, "WHCHRI")); - addFieldDescription(new CharacterFieldDescription(txt1, "WHCTNT")); - addFieldDescription(new CharacterFieldDescription(txt10, "WHFONT")); - addFieldDescription(new ZonedDecimalFieldDescription(z31, "WHCSWD")); - addFieldDescription(new ZonedDecimalFieldDescription(z31, "WHCSHI")); - addFieldDescription(new CharacterFieldDescription(txt10, "WHBCNM")); - addFieldDescription(new ZonedDecimalFieldDescription(z31, "WHBCHI")); - addFieldDescription(new CharacterFieldDescription(txt1, "WHMAP")); - addFieldDescription(new ZonedDecimalFieldDescription(z50, "WHMAPS")); - addFieldDescription(new ZonedDecimalFieldDescription(z50, "WHMAPL")); - addFieldDescription(new CharacterFieldDescription(txt8, "WHSYSN")); - addFieldDescription(new CharacterFieldDescription(txt2, "WHRES1")); - addFieldDescription(new CharacterFieldDescription(txt1, "WHSQLT")); - addFieldDescription(new CharacterFieldDescription(txt1, "WHHEX")); - addFieldDescription(new PackedDecimalFieldDescription(p41, "WHPNTS")); - // CCSID - addFieldDescription(new PackedDecimalFieldDescription(p50, "WHCCSID")); - // Date/time format - addFieldDescription(new CharacterFieldDescription(txt4, "WHFMT")); - // Date/time separator - addFieldDescription(new CharacterFieldDescription(txt1, "WHSEP")); - // Variable length field - addFieldDescription(new CharacterFieldDescription(txt1, "WHVARL")); - addFieldDescription(new PackedDecimalFieldDescription(p50, "WHALLC")); - // Allow null value - addFieldDescription(new CharacterFieldDescription(txt1, "WHNULL")); - addFieldDescription(new CharacterFieldDescription(txt10, "WHFCSN")); - addFieldDescription(new CharacterFieldDescription(txt10, "WHFCSL")); - addFieldDescription(new CharacterFieldDescription(txt10, "WHFCPN")); - addFieldDescription(new CharacterFieldDescription(txt10, "WHFCPL")); - addFieldDescription(new CharacterFieldDescription(txt10, "WHCDFN")); - addFieldDescription(new CharacterFieldDescription(txt10, "WHCDFL")); - addFieldDescription(new CharacterFieldDescription(txt10, "WHDCDF")); - addFieldDescription(new CharacterFieldDescription(txt10, "WHDCDL")); - addFieldDescription(new PackedDecimalFieldDescription(p30, "WHTXRT")); - addFieldDescription(new ZonedDecimalFieldDescription(z50, "WHFLDG")); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionListener.java b/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionListener.java deleted file mode 100644 index c85d8674a..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400FileRecordDescriptionListener.java +++ /dev/null @@ -1,36 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: AS400FileRecordDescriptionListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - *The AS400FileRecordDescriptionListener interface provides the interface that - *must be implemented to handle AS400FileRecordDescriptionEvent objects that are - *fired by the {@link com.ibm.as400.access.AS400FileRecordDescription AS400FileRecordDescription} - *class. -**/ -public interface AS400FileRecordDescriptionListener extends java.util.EventListener -{ - /** - *Invoked when the record formats for a file have been retrieved. - *@param event The event fired. - *@see com.ibm.as400.access.AS400FileRecordDescription#retrieveRecordFormat - **/ - public void recordFormatRetrieved(AS400FileRecordDescriptionEvent event); - - /** - *Invoked when the record format source code files for a file have been created. - *@see com.ibm.as400.access.AS400FileRecordDescription#createRecordFormatSource - **/ - public void recordFormatSourceCreated(AS400FileRecordDescriptionEvent event); -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Float4.java b/cvsroot/src/com/ibm/as400/access/AS400Float4.java deleted file mode 100644 index a65fb66d0..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400Float4.java +++ /dev/null @@ -1,211 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Float4.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The AS400Float4 class provides a converter between a Float object and a four-byte floating point number. - **/ -public class AS400Float4 implements AS400DataType -{ - static final long serialVersionUID = 4L; - - - - private static final int SIZE = 4; - private static final float defaultValue = 0.0f; - - /** - * Constructs an AS400Float4 object. - */ - public AS400Float4() - { - } - - /** - * Creates a new AS400Float4 object that is identical to the current instance. - * @return The new object. - **/ - public Object clone() - { - try - { - return super.clone(); // Object.clone does not throw exception - } - catch (CloneNotSupportedException e) - { - Trace.log(Trace.ERROR, "Unexpected cloning error", e); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - /** - * Returns the byte length of the data type. - * @return Four (4), the number of bytes in the IBM i representation of the data type. - **/ - public int getByteLength() - { - return SIZE; - } - - /** - * Returns a Java object representing the default value of the data type. - * @return The Float object with a value of zero. - **/ - public Object getDefaultValue() - { - return new Float(defaultValue); - } - - /** - * Returns {@link com.ibm.as400.access.AS400DataType#TYPE_FLOAT4 TYPE_FLOAT4}. - * @return AS400DataType.TYPE_FLOAT4. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_FLOAT4; - } - - /** - * Returns the Java class that corresponds with this data type. - * @return Float.class. - **/ - public Class getJavaType() - { - return Float.class; - } - - /** - * Converts the specified Java object to IBM i format. - * @param javaValue The object corresponding to the data type. It must be an instance of Float. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - byte[] as400Value = new byte[SIZE]; - BinaryConverter.floatToByteArray(((Float)javaValue).floatValue(), as400Value, 0); // Allow this line to throw ClassCastException and NullPointerException - return as400Value; - } - - /** - * Converts the specified float to IBM i format. - * @param floatValue The value to be converted to IBM i format. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(float floatValue) - { - byte[] as400Value = new byte[SIZE]; - BinaryConverter.floatToByteArray(floatValue, as400Value, 0); - return as400Value; - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of Float. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return Four (4), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.floatToByteArray(((Float)javaValue).floatValue(), as400Value, 0); // Allow this line to throw ClassCastException and NullPointerException - return SIZE; - } - - /** - * Converts the specified float into IBM i format in the specified byte array. - * @param floatValue The value to be converted to IBM i format. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return Four (4), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(float floatValue, byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.floatToByteArray(floatValue, as400Value, 0); - return SIZE; - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of Float. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return Four (4), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.floatToByteArray(((Float)javaValue).floatValue(), as400Value, offset); // Allow this line to throw ClassCastException and NullPointerException - return SIZE; - } - - /** - * Converts the specified float into IBM i format in the specified byte array. - * @param floatValue The value to be converted to IBM i format. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return Four (4), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(float floatValue, byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.floatToByteArray(floatValue, as400Value, offset); - return SIZE; - } - - /** - * Converts the specified IBM i data type to a float. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The float corresponding to the data type. - **/ - public float toFloat(byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - return BinaryConverter.byteArrayToFloat(as400Value, 0); - } - - /** - * Converts the specified IBM i data type to a float. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The float corresponding to the data type. - **/ - public float toFloat(byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - return BinaryConverter.byteArrayToFloat(as400Value, offset); - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The Float object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - return new Float(BinaryConverter.byteArrayToFloat(as400Value, 0)); - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The Float object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - return new Float(BinaryConverter.byteArrayToFloat(as400Value, offset)); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Float8.java b/cvsroot/src/com/ibm/as400/access/AS400Float8.java deleted file mode 100644 index d1e8b2b10..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400Float8.java +++ /dev/null @@ -1,210 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Float8.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The AS400Float8 class provides a converter between a Double object and a eight-byte floating point number. - **/ -public class AS400Float8 implements AS400DataType -{ - static final long serialVersionUID = 4L; - - - private static final int SIZE = 8; - private static final double defaultValue = 0.0; - - /** - * Constructs an AS400Float8 object. - */ - public AS400Float8() - { - } - - /** - * Creates a new AS400Float8 object that is identical to the current instance. - * @return The new object. - **/ - public Object clone() - { - try - { - return super.clone(); // Object.clone does not throw exception - } - catch (CloneNotSupportedException e) - { - Trace.log(Trace.ERROR, "Unexpected cloning error", e); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - /** - * Returns the byte length of the data type. - * @return Eight (8), the number of bytes in the IBM i representation of the data type. - **/ - public int getByteLength() - { - return SIZE; - } - - /** - * Returns a Java object representing the default value of the data type. - * @return The Double object with a value of zero. - **/ - public Object getDefaultValue() - { - return new Double(defaultValue); - } - - /** - * Returns {@link com.ibm.as400.access.AS400DataType#TYPE_FLOAT8 TYPE_FLOAT8}. - * @return AS400DataType.TYPE_FLOAT8. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_FLOAT8; - } - - /** - * Returns the Java class that corresponds with this data type. - * @return Double.class. - **/ - public Class getJavaType() - { - return Double.class; - } - - /** - * Converts the specified Java object to IBM i format. - * @param javaValue The object corresponding to the data type. It must be an instance of Double. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - byte[] as400Value = new byte[SIZE]; - BinaryConverter.doubleToByteArray(((Double)javaValue).doubleValue(), as400Value, 0); // Allow this line to throw ClassCastException and NullPointerException - return as400Value; - } - - /** - * Converts the specified double to IBM i format. - * @param doubleValue The value to be converted to IBM i format. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(double doubleValue) - { - byte[] as400Value = new byte[SIZE]; - BinaryConverter.doubleToByteArray(doubleValue, as400Value, 0); - return as400Value; - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of Double. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return Eight (8), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.doubleToByteArray(((Double)javaValue).doubleValue(), as400Value, 0); // Allow this line to throw ClassCastException and NullPointerException - return SIZE; - } - - /** - * Converts the specified double into IBM i format in the specified byte array. - * @param doubleValue The value to be converted to IBM i format. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return Eight (8), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(double doubleValue, byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.doubleToByteArray(doubleValue, as400Value, 0); - return SIZE; - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of Double. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return Eight(8), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.doubleToByteArray(((Double)javaValue).doubleValue(), as400Value, offset); // Allow this line to throw ClassCastException and NullPointerException - return SIZE; - } - - /** - * Converts the specified double into IBM i format in the specified byte array. - * @param doubleValue The value to be converted to IBM i format. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return Eight (8), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(double doubleValue, byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.doubleToByteArray(doubleValue, as400Value, offset); - return SIZE; - } - - /** - * Converts the specified IBM i data type to a double. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The double corresponding to the data type. - **/ - public double toDouble(byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - return BinaryConverter.byteArrayToDouble(as400Value, 0); - } - - /** - * Converts the specified IBM i data type to a double. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The double corresponding to the data type. - **/ - public double toDouble(byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - return BinaryConverter.byteArrayToDouble(as400Value, offset); - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The Double object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - return new Double(BinaryConverter.byteArrayToDouble(as400Value, 0)); - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value the array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The Double object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - return new Double(BinaryConverter.byteArrayToDouble(as400Value, offset)); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400GenAuthTknDS.java b/cvsroot/src/com/ibm/as400/access/AS400GenAuthTknDS.java deleted file mode 100644 index 4c7063628..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400GenAuthTknDS.java +++ /dev/null @@ -1,92 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400GenAuthTknDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -// The AS400GenAuthTknDS class represents the data stream for the 'Generate authentication token' request. -class AS400GenAuthTknDS extends ClientAccessDataStream -{ - AS400GenAuthTknDS(byte[] userIDbytes, byte[] authenticationBytes, int byteType, int profileTokenType, int profileTokenTimeout, int serverLevel) - { - super(new byte[45 + authenticationBytes.length + (userIDbytes == null ? 0 : 16) + (serverLevel < 5 ? 0 : 7)]); - - setLength(data_.length); - // setHeaderID(0x0000); - setServerID(0xE009); - // setCSInstance(0x00000000); - // setCorrelation(0x00000000); - setTemplateLen(0x0002); - setReqRepID(0x7007); - - // Type of authentication bytes. - data_[20] = (byteType == AS400.AUTHENTICATION_SCHEME_PASSWORD) ? (authenticationBytes.length == 8) ? (byte)0x01 : (byte)0x03 : (byteType == AS400.AUTHENTICATION_SCHEME_GSS_TOKEN) ? (byte)0x05 : (byteType == AS400.AUTHENTICATION_SCHEME_IDENTITY_TOKEN) ? (byte)0x06 : (byte)0x02; - // Return type, 0x01 = profile token. - data_[21] = 0x01; - - // Profile token type. - set32bit(7, 22); - set16bit(0x1116, 26); - data_[28] = (byte)(0xF0 | profileTokenType); - - // Experation interval. - set32bit(10, 29); - set16bit(0x1117, 33); - set32bit(profileTokenTimeout, 35); - - // Set password or authentication token. - // LL - set32bit(6 + authenticationBytes.length, 39); - // CP - if (byteType == 0) - { - set16bit(0x1105, 43); - } - else - { - set16bit(0x1115, 43); - } - // Data. - System.arraycopy(authenticationBytes, 0, data_, 45, authenticationBytes.length); - - if (userIDbytes != null) - { - // Set user ID info. - // LL - set32bit(16, 45 + authenticationBytes.length); - // CP - set16bit(0x1104, 49 + authenticationBytes.length); - // EBCDIC user ID. - System.arraycopy(userIDbytes, 0, data_, 51 + authenticationBytes.length, 10); - } - if (serverLevel >= 5) - { - int offset = 45 + authenticationBytes.length + (userIDbytes == null ? 0 : 16); - // Set return error messages. - // LL - set32bit(7, offset); - // CP - set16bit(0x1128, offset + 4); - // Data. - data_[offset + 6] = 0x01; - } - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending generate authentication token request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400GenAuthTknReplyDS.java b/cvsroot/src/com/ibm/as400/access/AS400GenAuthTknReplyDS.java deleted file mode 100644 index 07707838f..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400GenAuthTknReplyDS.java +++ /dev/null @@ -1,76 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400GenAuthTknReplyDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -// The AS400GenAuthTknReplyDS class represents the data stream for the 'Generate authentication token' reply. -class AS400GenAuthTknReplyDS extends ClientAccessDataStream -{ - /** - Generate a new instance of this type. - @return a reference to the new instance - **/ - public Object getNewDataStream() - { - return new AS400GenAuthTknReplyDS(); - } - - int getRC() - { - return get32bit(20); - } - - byte[] getProfileTokenBytes() - { - byte[] token = new byte[32]; - System.arraycopy(data_, 30, token, 0, 32); - return token; - } - - AS400Message[] getErrorMessages(ConverterImplRemote converter) throws IOException - { - return AS400ImplRemote.parseMessages(data_, 24, converter); - } - - void read(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving generate authentication token reply..."); - - // Receive the header. - byte[] header = new byte[20]; - if (readFromStream(in, header, 0, 20) < 20) - { - Trace.log(Trace.ERROR, "Failed to read all of the generate authentication token reply header."); - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - - // Allocate bytes for datastream. - data_ = new byte[BinaryConverter.byteArrayToInt(header, 0)]; - System.arraycopy(header, 0, data_, 0, 20); - - // Read in the rest of the data. - readAfterHeader(in); - } - - /** - Generates a hash code for this data stream. - @return the hash code - **/ - public int hashCode() - { - return 0xF007; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Impl.java b/cvsroot/src/com/ibm/as400/access/AS400Impl.java deleted file mode 100644 index 98f071e3c..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400Impl.java +++ /dev/null @@ -1,68 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Impl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.Socket; - -import com.ibm.as400.security.auth.ProfileTokenCredential; - -// AS400Impl defines the implementation interface for the AS400 object. -interface AS400Impl -{ - // Hook AS400 object up with connection events generated in ImplRemote. - void addConnectionListener(ConnectionListener listener); - // Map from CCSID to encoding string. - String ccsidToEncoding(int ccsid); - // Change password. - SignonInfo changePassword(String systemName, boolean systemNameLocal, String userId, byte[] oldBytes, byte[] newBytes) throws AS400SecurityException, IOException; - // Connect to service. - void connect(int service) throws AS400SecurityException, IOException; - // Establish a DHCP connection to the specified port. - Socket connectToPort(int port) throws AS400SecurityException, IOException; - // Disconnect from service. - void disconnect(int service); - // Exchange seeds with remote implementation. - byte[] exchangeSeed(byte[] proxySeed); - - // Get the jobs with which we are connected. - String[] getJobs(int service); - // Sets the raw bytes for the provided profile token. - void generateProfileToken(ProfileTokenCredential profileToken, String userIdentity) throws AS400SecurityException, IOException; - // Sets the raw bytes for the provided profile token. - void generateProfileToken(ProfileTokenCredential profileToken, String userId, CredentialVault vault, String gssName) throws AS400SecurityException, IOException, InterruptedException; - // Get the port for a service. - int getServicePort(String systemName, int service); - // Check service connection. - boolean isConnected(int service); - // Check connection's current status. - boolean isConnectionAlive(); - // Check connection's current status. - boolean isConnectionAlive(int service); - // Load converter into converter pool. - void newConverter(int ccsid) throws UnsupportedEncodingException; - // Remove the connection event dispatcher. - void removeConnectionListener(ConnectionListener listener); - // Set the GSS credential. - void setGSSCredential(Object gssCredential); - // Set the port for a service. - void setServicePort(String systemName, int service, int port); - // Set the service ports to their default values. - void setServicePortsToDefault(String systemName); - // Set significant instance variables into implementation object. - void setState(SSLOptions useSSLConnection, boolean canUseNativeOptimization, boolean threadUsed, int ccsid, String nlv, SocketProperties socketProperties, String ddmRDB, boolean mustUseNetSockets, boolean mustUseSuppliedProfile, boolean mustAddLanguageLibrary); - // Sign-on to system. - SignonInfo signon(String systemName, boolean systemNameLocal, String userId, CredentialVault vault, String gssName) throws AS400SecurityException, IOException; -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400ImplNative.java b/cvsroot/src/com/ibm/as400/access/AS400ImplNative.java deleted file mode 100644 index 558955f60..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400ImplNative.java +++ /dev/null @@ -1,34 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: AS400ImplNative.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -class AS400ImplNative -{ - private static final String CLASSNAME = "com.ibm.as400.access.AS400ImplNative"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - static - { - NativeMethods.loadNativeLibraryQyjspart(); - } - - static native byte[] signonNative(byte[] userId) throws NativeException; - static native void swapToNative(byte[] userId, byte[] bytes, byte[] swapToPH, byte[] swapFromPH) throws NativeException; - static native void swapBackNative(byte[] swapToPH, byte[] swapFromPH) throws NativeException; -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400ImplProxy.java b/cvsroot/src/com/ibm/as400/access/AS400ImplProxy.java deleted file mode 100644 index ab15c868e..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400ImplProxy.java +++ /dev/null @@ -1,320 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400ImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.InvocationTargetException; -import java.net.Socket; -import com.ibm.as400.security.auth.ProfileTokenCredential; -import java.beans.PropertyVetoException; - -// AS400ImplProxy forwards implementation methods from proxy client to proxy server. -class AS400ImplProxy extends AbstractProxyImpl implements AS400Impl -{ - private static final String CLASSNAME = "com.ibm.as400.access.AS400ImplProxy"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - // Tell super what type of impl we are. - AS400ImplProxy() - { - super("AS400"); - } - - // Tell proxy server to listen for connection events. - public void addConnectionListener(ConnectionListener listener) - { - connection_.addListener(pxId_, listener, "Connection"); - } - - // Map from CCSID to encoding string. - public String ccsidToEncoding(int ccsid) - { - try - { - return (String)connection_.callMethod(pxId_, "ccsidToEncoding", new Class[] { Integer.TYPE }, new Object[] { new Integer(ccsid) }).getReturnValue(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - // Change password. - public SignonInfo changePassword(String systemName, boolean systemNameLocal, String userId, byte[] oldBytes, byte[] newBytes) throws AS400SecurityException, IOException - { - try - { - return (SignonInfo)connection_.callMethod(pxId_, "changePassword", new Class[] { String.class, Boolean.TYPE, String.class, byte[].class, byte[].class }, new Object[] { systemName, new Boolean(systemNameLocal), userId, oldBytes, newBytes }).getReturnValue(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow2(e); - } - } - - // Connect to service. - public void connect(int service) throws AS400SecurityException, IOException - { - try - { - connection_.callMethod(pxId_, "connect", new Class[] { Integer.TYPE }, new Object[] { new Integer(service) }); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow2(e); - } - } - - // Connect to port. - public Socket connectToPort(int port) throws AS400SecurityException, IOException - { - try - { - return (Socket)connection_.callMethod(pxId_, "connectToPort", new Class[] { Integer.TYPE }, new Object[] { new Integer(port) }).getReturnValue(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow2(e); - } - } - - // Disconnect from service. - public void disconnect(int service) - { - try - { - connection_.callMethod(pxId_, "disconnect", new Class[] { Integer.TYPE }, new Object[] { new Integer(service) }); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - // Exchange seeds with proxy server. - public byte[] exchangeSeed(byte[] proxySeed) - { - try - { - return (byte[])connection_.callMethod(pxId_, "exchangeSeed", new Class[] { byte[].class }, new Object[] { proxySeed }).getReturnValue(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - // Sets the raw bytes for the provided profile token. - public void generateProfileToken(ProfileTokenCredential profileToken, String userIdentity) throws AS400SecurityException, IOException - { - try { - ProxyReturnValue rv = connection_.callMethod (pxId_, "generateProfileToken", - new Class[] { ProfileTokenCredential.class, String.class }, - new Object[] { profileToken, userIdentity }, - new boolean[] { true, false }, // indicate that 1st arg gets modified - true); - ProfileTokenCredential returnArg = (ProfileTokenCredential)rv.getArgument(0); - profileToken.setToken(returnArg.getToken()); - return; - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow2(e); - } - catch (PropertyVetoException e) { // will never happen - Trace.log(Trace.ERROR, e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - } - - // Sets the raw bytes for the provided profile token. - public void generateProfileToken(ProfileTokenCredential profileToken, String userId, CredentialVault vault, String gssName) throws AS400SecurityException, IOException, InterruptedException - { - try { - ProxyReturnValue rv = connection_.callMethod (pxId_, "generateProfileToken", - new Class[] { ProfileTokenCredential.class, String.class, CredentialVault.class, String.class }, - new Object[] { profileToken, userId, vault, gssName }, - new boolean[] { true, false, false, false }, // indicate that 1st arg gets modified - true); - ProfileTokenCredential returnArg = (ProfileTokenCredential)rv.getArgument(0); - profileToken.setToken(returnArg.getToken()); - return; - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow3(e); - } - catch (PropertyVetoException e) { // will never happen - Trace.log(Trace.ERROR, e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - } - - // Get the jobs with which we are connected. - public String[] getJobs(int service) - { - try - { - return (String[])connection_.callMethod(pxId_, "getJobs", new Class[] { Integer.TYPE }, new Object[] { new Integer(service) }).getReturnValue(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - // Get the port number for a service. - public int getServicePort(String systemName, int service) - { - try - { - return connection_.callMethod(pxId_, "getServicePort", new Class[] { String.class, Integer.TYPE }, new Object[] { systemName, new Integer(service) }).getReturnValueInt(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - // Check service connection. - public boolean isConnected(int service) - { - try - { - return connection_.callMethod(pxId_, "isConnected", new Class[] { Integer.TYPE }, new Object[] { new Integer(service) }).getReturnValueBoolean(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - // Check connection's current status. - public boolean isConnectionAlive() - { - try { - return connection_.callMethodReturnsBoolean (pxId_, "isConnectionAlive"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - // Check connection's current status. - public boolean isConnectionAlive(int service) - { - try - { - return connection_.callMethod(pxId_, "isConnectionAlive", new Class[] { Integer.TYPE }, new Object[] { new Integer(service) }).getReturnValueBoolean(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - // Load converter into converter pool. - public void newConverter(int ccsid) throws UnsupportedEncodingException - { - try - { - connection_.callMethod(pxId_, "newConverter", new Class[] { Integer.TYPE }, new Object[] { new Integer(ccsid) }); - } - catch (InvocationTargetException e) - { - Throwable target = e.getTargetException(); - if (target instanceof UnsupportedEncodingException) - { - throw (UnsupportedEncodingException) target; - } - throw ProxyClientConnection.rethrow(e); - } - } - - // Remove connection listener dispatcher. - public void removeConnectionListener(ConnectionListener listener) - { - connection_.removeListener(pxId_, listener, "Connection"); - } - - // Set the GSS credential. - public void setGSSCredential(Object gssCredential) - { - try - { - connection_.callMethod(pxId_, "setGSSCredential", new Class[] { Object.class }, new Object[] { gssCredential }); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - // Set the port for a service. - public void setServicePort(String systemName, int service, int port) - { - try - { - connection_.callMethod(pxId_, "setServicePort", new Class[] { String.class, Integer.TYPE, Integer.TYPE }, new Object[] { systemName, new Integer(service), new Integer(port) }); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - // Set the ports to default. - public void setServicePortsToDefault(String systemName) - { - try - { - connection_.callMethod(pxId_, "setServicePortsToDefault", new Class[] { String.class }, new Object[] { systemName }); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - // Set the significant instance variables for the AS400ImplRemote object. - public void setState(SSLOptions useSSLConnection, boolean canUseNativeOptimization, boolean threadUsed, int ccsid, String nlv, SocketProperties socketProperties, String ddmRDB, boolean mustUseNetSockets, boolean mustUseSuppliedProfile, boolean mustAddLanguageLibrary) - { - try - { - connection_.callMethod(pxId_, "setState", new Class[] { SSLOptions.class, Boolean.TYPE, Boolean.TYPE, Integer.TYPE, String.class, SocketProperties.class, String.class, Boolean.TYPE, Boolean.TYPE, Boolean.TYPE }, new Object[] { useSSLConnection, new Boolean(canUseNativeOptimization), new Boolean(threadUsed), new Integer(ccsid), nlv, socketProperties, ddmRDB, new Boolean(mustUseNetSockets), new Boolean(mustUseSuppliedProfile), new Boolean(mustAddLanguageLibrary) } ); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - // Sign-on. - public SignonInfo signon(String systemName, boolean systemNameLocal, String userId, CredentialVault vault, String gssName) throws AS400SecurityException, IOException - { - try - { - return (SignonInfo)connection_.callMethod(pxId_, "signon", new Class[] { String.class, Boolean.TYPE, String.class, CredentialVault.class, String.class }, new Object[] { systemName, new Boolean(systemNameLocal), userId, vault, gssName }).getReturnValue(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow2(e); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400ImplRemote.java b/cvsroot/src/com/ibm/as400/access/AS400ImplRemote.java deleted file mode 100644 index 240d09732..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400ImplRemote.java +++ /dev/null @@ -1,3407 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400ImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1999-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; -import java.net.Socket; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.GregorianCalendar; -import java.util.Vector; - -import com.ibm.as400.security.auth.ProfileTokenCredential; - -// This is the functional implementation of the AS400Impl interface. -class AS400ImplRemote implements AS400Impl -{ - private static final boolean PASSWORD_TRACE = false; - private static final boolean DEBUG = false; - - // The pool of systems. The systems are in service constant order: FILE, PRINT, COMMAND, DATAQUEUE, DATABASE, RECORDACCESS, CENTRAL. - private Vector[] serverPool_ = { new Vector(), new Vector(), new Vector(), new Vector(), new Vector(), new Vector(), new Vector() }; - - // System name. - private String systemName_ = ""; - // User ID. - private String userId_ = ""; - // Flag indicating if system name refers to local system. - private boolean systemNameLocal_ = false; - - // Credential to the IBM i system - private CredentialVault credVault_ = new PasswordVault(); // @mds - - // GSS Credential object, for Kerberos. Type set to Object to prevent dependency on 1.4 JDK. - private Object gssCredential_ = null; - // GSS name string, for Kerberos. - private String gssName_ = ""; - // How to use the GSS framework. - //int gssOption_; // not used - - // Flag that indicates if we connect to SSL ports. - private SSLOptions useSSLConnection_ = null; - // Flag that indicates if we should try to use native optimization. - private boolean canUseNativeOptimization_ = true; - // Flag that indicates if we use threads in communication with the host servers. - private boolean threadUsed_ = true; - - // CCSID to use in conversations with the system. - private int ccsid_ = 0; - // If the user has told us to override common sense and use the CCSID they want. - private boolean userOverrideCcsid_ = false; - // The client NLV. - private String clientNlv_; - // Set of socket options to use when creating our connections to the system. - private SocketProperties socketProperties_ = null; - - // The name of the secondary language library (if any). Used by RemoteCommandImplNative. - private String languageLibrary_ = null; - // Flag that gets set by RemoteCommandImplNative to indicate that we should refrain from further attempts to set the secondary language library for this AS400Impl. - private boolean skipFurtherSettingOfLanguageLibrary_ = false; - // Flag that gets set by RemoteCommandImplNative to indicate that the V5R4 system is missing PTF SI29629 (product 5722SS1). - private boolean detectedMissingPTF_ = false; - - // IASP name used for DDM, if specified. - private String ddmRDB_; - - // VRM information from the sign-on server. Retrieved from sign-on connect and stored until placed in sign-on information. - private ServerVersion version_; - // System level of the sign-on server. Retrieved from sign-on connect and stored until placed in sign-on information. - private int serverLevel_; - // Type of password encryption. - private boolean passwordType_ = false; // false == DES, true == SHA-1. - // Flag indicating if we have determined the password type yet. - private boolean isPasswordTypeSet_ = false; - // Sign-on information retrieved on sign-on information request. - private SignonInfo signonInfo_; - // EBCDIC bytes of sign-on server job name, held until Job CCSID is returned. - private byte[] signonJobBytes_; - // String form of sign-on server job name. - private String signonJobString_; - - // Dispatcher of connection events from this implementation to public object. - private ConnectionListener dispatcher_; - - // Single use seed received from public object in exchange seed method, held until next sign-on, change password, or generate profile token. - private byte[] proxySeed_ = null; - // Single use seed sent to public object in exchange seed method, held until next sign-on, change password, or generate profile token. - private byte[] remoteSeed_ = null; - - // Connection to the sign-on server. - AS400NoThreadServer signonServer_; - // Sign-on server server seed, held from sign-on connection until sign-on disconnect. - byte[] serverSeed_; - // Sign-on server client seed, held from sign-on connection until sign-on disconnect. - byte[] clientSeed_; - - private static final String CLASSNAME = "com.ibm.as400.access.AS400ImplRemote"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - static - { - // Identify all remote command server reply data streams. - AS400Server.addReplyStream(new ChangePasswordRep(), AS400.SIGNON); - AS400Server.addReplyStream(new AS400StrSvrReplyDS(), AS400.SIGNON); - AS400Server.addReplyStream(new SignonGenAuthTokenReplyDS(), AS400.SIGNON); - AS400Server.addReplyStream(new AS400GenAuthTknReplyDS(), AS400.SIGNON); - AS400Server.addReplyStream(new AS400XChgRandSeedReplyDS(), AS400.SIGNON); - AS400Server.addReplyStream(new SignonInfoRep(), AS400.SIGNON); - AS400Server.addReplyStream(new SignonExchangeAttributeRep(), AS400.SIGNON); - if (DEBUG) { - AS400Server.addReplyStream(new IFSReturnCodeRep(), AS400.FILE); - } - } - - // Set the connection event dispatcher. - public void addConnectionListener(ConnectionListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding implementation connection listener."); - dispatcher_ = listener; - } - - // Indicates if the native optimizations code can be used. - // Provided for internal use by other ImplRemote classes. - boolean canUseNativeOptimizations() - { - return canUseNativeOptimization_; - } - - // Map from CCSID to encoding string. - public String ccsidToEncoding(int ccsid) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Mapping to encoding implementation, CCSID:", ccsid); - return ConversionMaps.ccsidToEncoding(ccsid); - } - - // Convenience method for removing trailing space from SHA-1 passwords. - private static char[] trimUnicodeSpace(char[] inputArray) - { - char lastChar = inputArray[inputArray.length - 1]; - if (lastChar != '\u0000' && lastChar != '\u0020' && lastChar != '\u3000') return inputArray; - - int trimPosition = inputArray.length - 1; - while (inputArray[trimPosition] == '\u0000' || inputArray[trimPosition] == '\u0020' || inputArray[trimPosition] == '\u3000') --trimPosition; - char[] trimedArray = new char[trimPosition + 1]; - System.arraycopy(inputArray, 0, trimedArray, 0, trimedArray.length); - return trimedArray; - } - - // Convenience method for generating SHA-1 password token. - private static byte[] generateShaToken(byte[] userIdBytes, byte[] bytes) - { - try - { - MessageDigest md = MessageDigest.getInstance("SHA"); - md.update(userIdBytes); - md.update(bytes); - byte[] token = md.digest(); - - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "SHA-1 token:", token); - } - return token; - } - catch (NoSuchAlgorithmException e) - { - Trace.log(Trace.ERROR, "Error getting instance of SHA-1 algorithm:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - } - - // Convenience method for generating SHA-1 substitute password. - private static byte[] generateShaSubstitute(byte[] token, byte[] serverSeed, byte[] clientSeed, byte[] userIdBytes, byte[] sequence) - { - try - { - MessageDigest md = MessageDigest.getInstance("SHA"); - md.update(token); - md.update(serverSeed); - md.update(clientSeed); - md.update(userIdBytes); - md.update(sequence); - byte[] substitutePassword = md.digest(); - - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "SHA-1 substitute:", substitutePassword); - } - return substitutePassword; - } - catch (NoSuchAlgorithmException e) - { - Trace.log(Trace.ERROR, "Error getting instance of SHA-1 algorithm:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - } - - // Convenience method for generating SHA-1 substitute password. - private static byte[] generateShaProtected(byte[] bytes, byte[] token, byte[] serverSeed, byte[] clientSeed, byte[] userIdBytes, byte[] sequence) - { - // Protected length will be rounded up to next 20. - int protectedLength = (((bytes.length - 1) / 20) + 1) * 20; - byte[] protectedPassword = new byte[protectedLength]; - for (int i = 0; i < protectedLength; i += 20) - { - incrementString(sequence); - byte[] encryptedSection = generateShaSubstitute(token, serverSeed, clientSeed, userIdBytes, sequence); - for (int ii = 0; ii < 20; ++ii) - { - if (i + ii < bytes.length) - { - protectedPassword[i + ii] = (byte)(encryptedSection[ii] ^ bytes[i + ii]); - } - else - { - protectedPassword[i + ii] = encryptedSection[ii]; - } - } - } - return protectedPassword; - } - - // Change password. - public SignonInfo changePassword(String systemName, boolean systemNameLocal, String userId, byte[] oldBytes, byte[] newBytes) throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Change password implementation, system name: '" + systemName + "' user ID: '" + userId + "'"); - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "Old password bytes:", oldBytes); - Trace.log(Trace.DIAGNOSTIC, "New password bytes:", newBytes); - } - - systemName_ = systemName; - systemNameLocal_ = systemNameLocal; - userId_ = userId; - - // Decode passwords and discard seeds. - char[] oldPassword = BinaryConverter.byteArrayToCharArray(CredentialVault.decode(proxySeed_, remoteSeed_, oldBytes)); // @mds - char[] newPassword = BinaryConverter.byteArrayToCharArray(CredentialVault.decode(proxySeed_, remoteSeed_, newBytes)); // @mds - proxySeed_ = null; - remoteSeed_ = null; - - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "Old password unscrambled: '" + new String(oldPassword) + "'"); - Trace.log(Trace.DIAGNOSTIC, "New password unscrambled: '" + new String(newPassword) + "'"); - } - - // Get a socket connection. - boolean needToDisconnect = (signonServer_ == null); - signonConnect(); - try - { - // Convert user ID to EBCDIC. - byte[] userIdEbcdic = SignonConverter.stringToByteArray(userId); - byte[] encryptedPassword; - byte[] oldProtected; - byte[] newProtected; - - if (passwordType_ == false) - { - // Do DES encryption. - if (oldPassword.length > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'oldPassword' is not valid:", oldPassword.length); - throw new AS400SecurityException(AS400SecurityException.PASSWORD_LENGTH_NOT_VALID); - } - byte[] oldPasswordEbcdic = SignonConverter.stringToByteArray(new String(oldPassword).toUpperCase()); - if (newPassword.length > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'newPassword' is not valid:", newPassword.length); - throw new AS400SecurityException(AS400SecurityException.PASSWORD_NEW_NOT_VALID); - } - byte[] newPasswordEbcdic = SignonConverter.stringToByteArray(new String(newPassword).toUpperCase()); - - // Setup output variables for encrypt new password. - oldProtected = (oldPasswordEbcdic[8] == 0x40 && oldPasswordEbcdic[9] == 0x40) ? new byte[8] : new byte[16]; - newProtected = (newPasswordEbcdic[8] == 0x40 && newPasswordEbcdic[9] == 0x40) ? new byte[8] : new byte[16]; - - encryptedPassword = encryptNewPassword(userIdEbcdic, oldPasswordEbcdic, newPasswordEbcdic, oldProtected, newProtected, clientSeed_, serverSeed_); - } - else - { - // Do SHA-1 encryption. - byte[] userIdBytes = BinaryConverter.charArrayToByteArray(SignonConverter.byteArrayToCharArray(userIdEbcdic)); - - // Screen out passwords that start with a star. - if (oldPassword[0] == '*') - { - Trace.log(Trace.ERROR, "Parameter 'oldPassword' begins with a '*' character."); - throw new AS400SecurityException(AS400SecurityException.SIGNON_CHAR_NOT_VALID); - } - if (newPassword[0] == '*') - { - Trace.log(Trace.ERROR, "Parameter 'newPassword' begins with a '*' character."); - throw new AS400SecurityException(AS400SecurityException.SIGNON_CHAR_NOT_VALID); - } - - // Trim space and put in byte array. - byte[] oldPasswordBytes = BinaryConverter.charArrayToByteArray(trimUnicodeSpace(oldPassword)); - byte[] newPasswordBytes = BinaryConverter.charArrayToByteArray(trimUnicodeSpace(newPassword)); - byte[] sequence = {0, 0, 0, 0, 0, 0, 0, 1}; - - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "Pre SHA-1 userIdBytes:", userIdBytes); - Trace.log(Trace.DIAGNOSTIC, "Pre SHA-1 oldPasswordBytes:", oldPasswordBytes); - Trace.log(Trace.DIAGNOSTIC, "Pre SHA-1 newPasswordBytes:", newPasswordBytes); - Trace.log(Trace.DIAGNOSTIC, "Pre SHA-1 sequence:", sequence); - } - - byte[] token = generateShaToken(userIdBytes, oldPasswordBytes); - encryptedPassword = generateShaSubstitute(token, serverSeed_, clientSeed_, userIdBytes, sequence); - - newProtected = generateShaProtected(newPasswordBytes, token, serverSeed_, clientSeed_, userIdBytes, sequence); - - byte[] newToken = generateShaToken(userIdBytes, newPasswordBytes); - - oldProtected = generateShaProtected(oldPasswordBytes, newToken, serverSeed_, clientSeed_, userIdBytes, sequence); - } - - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "Sending Change Password Request..."); - Trace.log(Trace.DIAGNOSTIC, " User ID:", userId); - Trace.log(Trace.DIAGNOSTIC, " User ID bytes:", userIdEbcdic); - Trace.log(Trace.DIAGNOSTIC, " Encrypted password:", encryptedPassword); - Trace.log(Trace.DIAGNOSTIC, " Protected old password:", oldProtected); - Trace.log(Trace.DIAGNOSTIC, " Protected new password:", newProtected); - } - - ChangePasswordReq chgReq = new ChangePasswordReq(userIdEbcdic, encryptedPassword, oldProtected, oldPassword.length * 2, newProtected, newPassword.length * 2, serverLevel_); - ChangePasswordRep chgRep = (ChangePasswordRep)signonServer_.sendAndReceive(chgReq); - int rc = chgRep.getRC(); - if (rc == 0) - { - // Change password worked, so retrieve signon information using new password. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Password change implementation successful."); - - byte[] tempSeed = new byte[9]; - CredentialVault.rng.nextBytes(tempSeed); - - SignonInfo returnInfo = signon2(systemName, systemNameLocal, userId, CredentialVault.encode(tempSeed, exchangeSeed(tempSeed), BinaryConverter.charArrayToByteArray(newPassword)), AS400.AUTHENTICATION_SCHEME_PASSWORD); // @mds - if (needToDisconnect) signonDisconnect(); - return returnInfo; - } - else - { - byte[] rcBytes = new byte[4]; - BinaryConverter.intToByteArray(rc, rcBytes, 0); - Trace.log(Trace.ERROR, "Change password implementation failed with return code:", rcBytes); - - throw AS400ImplRemote.returnSecurityException(rc, chgRep.getErrorMessages(ConverterImplRemote.getConverter(ExecutionEnvironment.getBestGuessAS400Ccsid(), this))); - } - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Change password failed:", e); - signonServer_.forceDisconnect(); - signonServer_ = null; - throw e; - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, "Change password failed:", e); - signonServer_.forceDisconnect(); - signonServer_ = null; - throw e; - } - } - - // Implementation for connect. - public void connect(int service) throws AS400SecurityException, IOException - { - if (service == AS400.SIGNON) - { - signonConnect(); - } - else - { - getConnection(service, false); - } - } - - public Socket connectToPort(int port) throws AS400SecurityException, IOException - { - return getConnection(0, port); - } - - // Implementation for disconnect. - public void disconnect(int service) - { - if (service == AS400.SIGNON) - { - signonDisconnect(); - } - else - { - Vector serverList = serverPool_[service]; - synchronized (serverList) - { - while (!serverList.isEmpty()) - { - disconnectServer((AS400Server)serverList.elementAt(0)); - } - } - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Service disconnected implementation:", AS400.getServerName(service)); - } - - // Disconnect all services. - void disconnectAllServices() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Disconnecting all services implementation..."); - - disconnect(AS400.FILE); - disconnect(AS400.PRINT); - disconnect(AS400.DATAQUEUE); - disconnect(AS400.COMMAND); - disconnect(AS400.DATABASE); - disconnect(AS400.RECORDACCESS); - disconnect(AS400.CENTRAL); - disconnect(AS400.SIGNON); - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "All services disconnected implementation."); - } - - // Disconnects the system and removes it from the system list. - // param server The AS400Server to disconnect and remove. - void disconnectServer(AS400Server server) - { - server.forceDisconnect(); - int service = server.getService(); - if (service != AS400.SIGNON) - { - Vector serverList = serverPool_[service]; - synchronized (serverList) - { - if (!serverList.isEmpty()) - { - serverList.removeElement(server); - - // Only fire the event if all systems have been disconnected. - if (serverList.isEmpty()) - { - fireConnectEvent(false, service); - } - } - } - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Server disconnected"); - } - - // Exchange of seeds between public 'AS400' object and this class. - // If the public class and the implRemote class are running on different machines, the authentication information must be transmitted securely between the public class and the implRemote class. The transmitted authentication information can be encoded/decoded using the exchanged seeds. - public byte[] exchangeSeed(byte[] proxySeed) - { - // Hold the seed they send us. - proxySeed_ = proxySeed; - - // Generate, hold, and send them our seed. - remoteSeed_ = new byte[7]; - CredentialVault.rng.nextBytes(remoteSeed_); // @mds - - return remoteSeed_; - } - - // Cleans up all connections. - protected void finalize() throws Throwable - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Finalize method for AS400 implementation invoked."); - try { - disconnectAllServices(); - } - finally { - super.finalize(); - } - } - - // Fire connnect event. - private void fireConnectEvent(boolean connect, int service) - { - if (dispatcher_ != null) - { - ConnectionEvent connectEvent = new ConnectionEvent(this, service); - if (connect) - { - dispatcher_.connected(connectEvent); - } - else - { - dispatcher_.disconnected(connectEvent); - } - } - } - - // Flow the generate profile token datastream. - public void generateProfileToken(ProfileTokenCredential profileToken, String userIdentity) throws AS400SecurityException, IOException - { - signonConnect(); - try - { - byte[] userIDbytes = SignonConverter.stringToByteArray(userId_); - byte[] encryptedPassword = getPassword(clientSeed_, serverSeed_); - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "Sending Start Server Request..."); - Trace.log(Trace.DIAGNOSTIC, " User ID:", userId_); - Trace.log(Trace.DIAGNOSTIC, " User ID bytes:", userIDbytes); - Trace.log(Trace.DIAGNOSTIC, " Client seed:", clientSeed_); - Trace.log(Trace.DIAGNOSTIC, " Server seed:", serverSeed_); - Trace.log(Trace.DIAGNOSTIC, " Encrypted password:", encryptedPassword); - } - - int serverId = AS400Server.getServerId(AS400.SIGNON); - AS400StrSvrDS req = new AS400StrSvrDS(serverId, userIDbytes, encryptedPassword, credVault_.getType()); - AS400StrSvrReplyDS reply = (AS400StrSvrReplyDS)signonServer_.sendAndReceive(req); - - if (reply.getRC() != 0) - { - byte[] rcBytes = new byte[4]; - BinaryConverter.intToByteArray(reply.getRC(), rcBytes, 0); - Trace.log(Trace.ERROR, "Start server failed with return code:", rcBytes); - throw AS400ImplRemote.returnSecurityException(reply.getRC()); - } - - SignonGenAuthTokenRequestDS req2 = new SignonGenAuthTokenRequestDS(BinaryConverter.charArrayToByteArray(userIdentity.toCharArray()), profileToken.getTokenType(), profileToken.getTimeoutInterval(), serverLevel_); - SignonGenAuthTokenReplyDS rep = (SignonGenAuthTokenReplyDS)signonServer_.sendAndReceive(req2); - - int rc = rep.getRC(); - if (rc != 0) - { - byte[] rcBytes = new byte[4]; - BinaryConverter.intToByteArray(rc, rcBytes, 0); - Trace.log(Trace.ERROR, "Generate profile token failed with return code:", rcBytes); - throw AS400ImplRemote.returnSecurityException(rc, rep.getErrorMessages(ConverterImplRemote.getConverter(ExecutionEnvironment.getBestGuessAS400Ccsid(), this))); - } - try - { - profileToken.setToken(rep.getProfileTokenBytes()); - } - catch (PropertyVetoException e) - { - Trace.log(Trace.ERROR, e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Generate profile token failed:", e); - signonServer_.forceDisconnect(); - signonServer_ = null; - throw e; - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, "Generate profile token failed:", e); - signonServer_.forceDisconnect(); - signonServer_ = null; - throw e; - } - } - - // Flow the generate profile token datastream. - public void generateProfileToken(ProfileTokenCredential profileToken, String userId, CredentialVault vault, String gssName) throws AS400SecurityException, IOException, InterruptedException - { - signonConnect(); - try - { - byte[] userIdEbcdic = SignonConverter.stringToByteArray(userId); - byte[] authenticationBytes = null; - int byteType = vault.getType(); - - switch (byteType) - { - case AS400.AUTHENTICATION_SCHEME_GSS_TOKEN: - try - { - authenticationBytes = (gssCredential_ == null) ? TokenManager.getGSSToken(systemName_, gssName) : TokenManager2.getGSSToken(systemName_, gssCredential_); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Error retrieving GSSToken:", e); - throw new AS400SecurityException(AS400SecurityException.KERBEROS_TICKET_NOT_VALID_RETRIEVE); - } - break; - case AS400.AUTHENTICATION_SCHEME_PROFILE_TOKEN: - case AS400.AUTHENTICATION_SCHEME_IDENTITY_TOKEN: - authenticationBytes = vault.decode(proxySeed_, remoteSeed_); - // @mds should we null out the seeds here - break; - default: // Password. - char[] password = BinaryConverter.byteArrayToCharArray(vault.decode(proxySeed_, remoteSeed_)); // @mds - proxySeed_ = null; - remoteSeed_ = null; - - // Generate the correct password based on the password encryption level of the system. - if (passwordType_ == false) - { - // Prepend Q to numeric password. A "numeric password" is - // a password that starts with a numeric digit. - if (password.length > 0 && Character.isDigit(password[0])) - { -// boolean isAllNumeric = true; -// for (int i = 0; i < password.length; ++i) -// { -// if (password[i] < '\u0030' || password[i] > '\u0039') -// { -// isAllNumeric = false; -// } -// } -// if (isAllNumeric) -// { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Prepending Q to numeric password."); - char[] passwordWithQ = new char[password.length + 1]; - passwordWithQ[0] = 'Q'; - System.arraycopy(password, 0, passwordWithQ, 1, password.length); - password = passwordWithQ; -// } - } - - if (password.length > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'password' is not valid:", password.length); - throw new AS400SecurityException(AS400SecurityException.PASSWORD_LENGTH_NOT_VALID); - } - authenticationBytes = encryptPassword(userIdEbcdic, SignonConverter.stringToByteArray(new String(password).toUpperCase()), clientSeed_, serverSeed_); - } - else - { - // Do SHA-1 encryption. - byte[] userIdBytes = BinaryConverter.charArrayToByteArray(SignonConverter.byteArrayToCharArray(userIdEbcdic)); - - // Screen out passwords that start with a star. - if (password[0] == '*') - { - Trace.log(Trace.ERROR, "Parameter 'password' begins with a '*' character."); - throw new AS400SecurityException(AS400SecurityException.SIGNON_CHAR_NOT_VALID); - } - - byte[] passwordBytes = BinaryConverter.charArrayToByteArray(trimUnicodeSpace(password)); - byte[] sequence = {0, 0, 0, 0, 0, 0, 0, 1}; - - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "Pre SHA-1 userIdBytes:", userIdBytes); - Trace.log(Trace.DIAGNOSTIC, "Pre SHA-1 passwordBytes:", passwordBytes); - Trace.log(Trace.DIAGNOSTIC, "Pre SHA-1 sequence:", sequence); - } - - byte[] token = generateShaToken(userIdBytes, passwordBytes); - authenticationBytes = generateShaSubstitute(token, serverSeed_, clientSeed_, userIdBytes, sequence); - } - } - - AS400GenAuthTknDS req = new AS400GenAuthTknDS(userIdEbcdic, authenticationBytes, byteType, profileToken.getTokenType(), profileToken.getTimeoutInterval(), serverLevel_); - AS400GenAuthTknReplyDS rep = (AS400GenAuthTknReplyDS)signonServer_.sendAndReceive(req); - - int rc = rep.getRC(); - if (rc != 0) - { - byte[] rcBytes = new byte[4]; - BinaryConverter.intToByteArray(rc, rcBytes, 0); - Trace.log(Trace.ERROR, "Generate profile token failed with return code:", rcBytes); - throw AS400ImplRemote.returnSecurityException(rc, rep.getErrorMessages(ConverterImplRemote.getConverter(ExecutionEnvironment.getBestGuessAS400Ccsid(), this))); - } - try - { - profileToken.setToken(rep.getProfileTokenBytes()); - } - catch (PropertyVetoException e) - { - Trace.log(Trace.ERROR, e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Generate profile token failed:", e); - signonServer_.forceDisconnect(); - signonServer_ = null; - throw e; - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, "Generate profile token failed:", e); - signonServer_.forceDisconnect(); - signonServer_ = null; - throw e; - } - } - - // Get either the user's CCSID, the signon server CCSID, or our best guess. - public int getCcsid() - { - int howObtained = 0; // how we got the CCSID value - - // CCSID values obtained from different sources (indexed by 'howObtained') - int[] ccsidValues = { ccsid_, 0, 0, 0 }; - - // First pass: - // Try to arrive at a CCSID other than 0 or 65535. - if (ccsid_ == 0 || ccsid_ == 65535) - { - if (signonInfo_ != null) { - howObtained = 1; - ccsidValues[howObtained] = signonInfo_.serverCCSID; - ccsid_ = ccsidValues[howObtained]; - } - - if (ccsid_ == 0 || ccsid_ == 65535) { - howObtained = 2; - ccsidValues[howObtained] = getCcsidFromServer(); - ccsid_ = ccsidValues[howObtained]; - } - - if (ccsid_ == 0 || ccsid_ == 65535) { - howObtained = 3; - ccsidValues[howObtained] = ExecutionEnvironment.getBestGuessAS400Ccsid(); - ccsid_ = ccsidValues[howObtained]; - } - } - - // Second pass: - // If first pass ended up with CCSID == 0, settle for any non-zero CCSID. - if (ccsid_ == 0) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "AS400ImplRemote.getCcsid() [after first pass]: CCSID="+ccsid_+", howObtained="+howObtained); - for (int i=0; i 3 && line.substring(0, 3).equals(code) && line.charAt(3) == ' ')) - { - line = reader.readLine(); - fullMessage.append("\n" + line); - } - return fullMessage.toString(); - } - - // Note: The 'dhcp' argument is a dummy argument, whose sole purpose is to differentiate this method from getConnection(int port). The value of 'dhcp' is ignored. - synchronized Socket getConnection(int dhcp, int port) throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Establishing connection to system at port:", port); - Socket socket = new Socket((systemNameLocal_) ? "localhost" : systemName_, port); - int connectionID = socket.hashCode(); - try - { - PortMapper.setSocketProperties(socket, socketProperties_); - InputStream inStream = socket.getInputStream(); - OutputStream outStream = socket.getOutputStream(); - - // The first request we send is "exchange random seeds"... - int serverId = AS400Server.getServerId(AS400.COMMAND); - AS400XChgRandSeedDS xChgReq = new AS400XChgRandSeedDS(serverId); - if (Trace.traceOn_) xChgReq.setConnectionID(connectionID); - xChgReq.write(outStream); - - AS400XChgRandSeedReplyDS xChgReply = new AS400XChgRandSeedReplyDS(); - if (Trace.traceOn_) xChgReply.setConnectionID(connectionID); - xChgReply.read(inStream); - - if (xChgReply.getRC() != 0) - { - byte[] rcBytes = new byte[4]; - BinaryConverter.intToByteArray(xChgReply.getRC(), rcBytes, 0); - Trace.log(Trace.ERROR, "Exchange of random seeds failed with return code:", rcBytes); - throw AS400ImplRemote.returnSecurityException(xChgReply.getRC()); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Exchange of random seeds successful."); - - // Next we send the "start server job" request... - byte[] clientSeed = xChgReq.getClientSeed(); - byte[] serverSeed = xChgReply.getServerSeed(); - byte[] userIDbytes = SignonConverter.stringToByteArray(userId_); - byte[] encryptedPassword = getPassword(clientSeed, serverSeed); - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "Sending Start Server Request..."); - Trace.log(Trace.DIAGNOSTIC, " User ID:", userId_); - Trace.log(Trace.DIAGNOSTIC, " User ID bytes:", userIDbytes); - Trace.log(Trace.DIAGNOSTIC, " Client seed:", clientSeed); - Trace.log(Trace.DIAGNOSTIC, " Server seed:", serverSeed); - Trace.log(Trace.DIAGNOSTIC, " Encrypted password:", encryptedPassword); - } - - AS400StrSvrDS req = new AS400StrSvrDS(serverId, userIDbytes, encryptedPassword, credVault_.getType()); - if (Trace.traceOn_) req.setConnectionID(connectionID); - req.write(outStream); - - AS400StrSvrReplyDS reply = new AS400StrSvrReplyDS(); - if (Trace.traceOn_) reply.setConnectionID(connectionID); - reply.read(inStream); - - if (reply.getRC() != 0) - { - byte[] rcBytes = new byte[4]; - BinaryConverter.intToByteArray(reply.getRC(), rcBytes, 0); - Trace.log(Trace.ERROR, "Start server failed with return code:", rcBytes); - throw AS400ImplRemote.returnSecurityException(reply.getRC()); - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Server started successfully."); - return socket; - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Establishing DHCP connection failed:", e); - try - { - socket.close(); - } - catch (IOException ee) - { - Trace.log(Trace.ERROR, "Error closing socket:", ee); - } - throw e; - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, "Establishing DHCP connection failed:", e); - try - { - socket.close(); - } - catch (IOException ee) - { - Trace.log(Trace.ERROR, "Error closing socket:", ee); - } - throw e; - } - } - - // Gets the jobs with which we are connected. - public String[] getJobs(int service) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting job names implementation, service:", service); - if (service == AS400.SIGNON) - { - return (signonServer_ != null) ? new String[] { signonJobString_ } : new String[0]; - } - else - { - Vector serverList = serverPool_[service]; - String[] jobStrings = new String[serverList.size()]; - synchronized (serverList) - { - for (int i = 0; i < serverList.size(); ++i) - { - jobStrings[i] = (((AS400Server)serverList.elementAt(i)).getJobString()); - } - } - return jobStrings; - } - } - - // Get AS400Server object connected to indicated service. You can get either an existing connection or ask for a new connection. - synchronized AS400Server getConnection(int service, boolean forceNewConnection) throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Establishing connection to system: " + AS400.getServerName(service)); - - // Necessary for case where we are connecting after native sign-on. - if (!isPasswordTypeSet_) - { - signonConnect(); - signonDisconnect(); - } - - AS400Server server = null; - // Get the list of systems associated with this service. - Vector serverList = serverPool_[service]; - synchronized (serverList) - { - if (!forceNewConnection && !serverList.isEmpty()) - { - // System exists, get the first available system to reuse. - server = (AS400Server)serverList.firstElement(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Reusing previous server object..."); - - // Return the connected system. - return server; - } - } - - SocketContainer sc = PortMapper.getServerSocket((systemNameLocal_) ? "localhost" : systemName_, service, useSSLConnection_, socketProperties_, mustUseNetSockets_); - int connectionID = sc.hashCode(); - String jobString = ""; - - try - { - InputStream inStream = sc.getInputStream(); - OutputStream outStream = sc.getOutputStream(); - byte[] jobBytes = null; - - if (service == AS400.RECORDACCESS) - { - Object[] returnVals = ClassDecoupler.connectDDMPhase1(outStream, inStream, passwordType_, credVault_.getType(), connectionID); - byte[] clientSeed = (byte[])returnVals[0]; - byte[] serverSeed = (byte[])returnVals[1]; - jobBytes = (byte[])returnVals[2]; - - byte[] userIDbytes = SignonConverter.stringToByteArray(userId_); - - // Get the substitute password. - byte[] ddmSubstitutePassword = getPassword(clientSeed, serverSeed); - - if (PASSWORD_TRACE) - { - Trace.log(Trace.DATASTREAM, "Sending DDM SECCHK request..."); - Trace.log(Trace.DIAGNOSTIC, " User ID:", userId_); - Trace.log(Trace.DIAGNOSTIC, " User ID bytes:", userIDbytes); - Trace.log(Trace.DIAGNOSTIC, " Client seed:", clientSeed); - Trace.log(Trace.DIAGNOSTIC, " Server seed:", serverSeed); - Trace.log(Trace.DIAGNOSTIC, " Encrypted password:", ddmSubstitutePassword); - } - byte[] iaspBytes = null; - if (ddmRDB_ != null) - { - AS400Text text18 = new AS400Text(18, signonInfo_.serverCCSID); - iaspBytes = text18.toBytes(ddmRDB_); - } - ClassDecoupler.connectDDMPhase2(outStream, inStream, userIDbytes, ddmSubstitutePassword, iaspBytes, credVault_.getType(), ddmRDB_, systemName_, connectionID); - } - else // service != RECORDACCESS - { - // The first request we send is "exchange random seeds"... - int serverId = AS400Server.getServerId(service); - AS400XChgRandSeedDS xChgReq = new AS400XChgRandSeedDS(serverId); - if (Trace.traceOn_) xChgReq.setConnectionID(connectionID); - xChgReq.write(outStream); - - AS400XChgRandSeedReplyDS xChgReply = new AS400XChgRandSeedReplyDS(); - if (Trace.traceOn_) xChgReply.setConnectionID(connectionID); - xChgReply.read(inStream); - - if (xChgReply.getRC() != 0) - { - byte[] rcBytes = new byte[4]; - BinaryConverter.intToByteArray(xChgReply.getRC(), rcBytes, 0); - Trace.log(Trace.ERROR, "Exchange of random seeds failed with return code:", rcBytes); - throw AS400ImplRemote.returnSecurityException(xChgReply.getRC()); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Exchange of random seeds successful."); - - // Next we send the "start server job" request... - byte[] clientSeed = xChgReq.getClientSeed(); - byte[] serverSeed = xChgReply.getServerSeed(); - byte[] userIDbytes = SignonConverter.stringToByteArray(userId_); - byte[] encryptedPassword = getPassword(clientSeed, serverSeed); - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "Sending Start Server Request..."); - Trace.log(Trace.DIAGNOSTIC, " User ID:", userId_); - Trace.log(Trace.DIAGNOSTIC, " User ID bytes:", userIDbytes); - Trace.log(Trace.DIAGNOSTIC, " Client seed:", clientSeed); - Trace.log(Trace.DIAGNOSTIC, " Server seed:", serverSeed); - Trace.log(Trace.DIAGNOSTIC, " Encrypted password:", encryptedPassword); - } - - AS400StrSvrDS req = new AS400StrSvrDS(serverId, userIDbytes, encryptedPassword, credVault_.getType()); - if (Trace.traceOn_) req.setConnectionID(connectionID); - req.write(outStream); - - AS400StrSvrReplyDS reply = new AS400StrSvrReplyDS(); - if (Trace.traceOn_) reply.setConnectionID(connectionID); - reply.read(inStream); - - if (reply.getRC() != 0) - { - byte[] rcBytes = new byte[4]; - BinaryConverter.intToByteArray(reply.getRC(), rcBytes, 0); - Trace.log(Trace.ERROR, "Start server failed with return code:", rcBytes); - throw AS400ImplRemote.returnSecurityException(reply.getRC()); - } - - jobBytes = reply.getJobNameBytes(); - } - - // Obtain the job identifier for the connection. - ConverterImplRemote converter = ConverterImplRemote.getConverter(signonInfo_.serverCCSID, this); - jobString = converter.byteArrayToString(jobBytes); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "System job:", jobString); - } - catch (IOException e) - { - forceDisconnect(e, server, sc); - throw e; - } - catch (AS400SecurityException e) - { - forceDisconnect(e, server, sc); - throw e; - } - catch (RuntimeException e) - { - forceDisconnect(e, server, sc); - throw e; - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Server started successfully."); - - // At this point the Socket connection is established. Now we need to set up the AS400Server object before passing it back to the caller. - - // Construct a new server... - if (threadUsed_) - { - server = new AS400ThreadedServer(this, service, sc, jobString); - } - else - { - server = new AS400NoThreadServer(this, service, sc, jobString); - } - - // Add the system to our list so we can return it on a subsequent connect()... - serverList.addElement(server); - - fireConnectEvent(true, service); - - return server; - } - - private static void forceDisconnect(Exception e, AS400Server server, SocketContainer sc ) - { - Trace.log(Trace.ERROR, "Establishing connection failed:", e); - if (server != null) - { - try { server.forceDisconnect(); } - catch (Throwable ee) { - Trace.log(Trace.ERROR, "Error closing socket:", ee); - } - } - else if (sc != null) { - try { sc.close(); } - catch (Throwable ee) { - Trace.log(Trace.ERROR, "Error closing socket:", ee); - } - } - } - - // The NLV to send to the system. - String getNLV() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting NLV implementation:", clientNlv_); - return clientNlv_; - } - - // Get the encrypted password with the seeds folded in. - private byte[] getPassword(byte[] clientSeed, byte[] serverSeed) throws AS400SecurityException, IOException - { - int credType = credVault_.getType(); - - if (credType == AS400.AUTHENTICATION_SCHEME_GSS_TOKEN) - { - try { - return (gssCredential_ == null) ? TokenManager.getGSSToken(systemName_, gssName_) : TokenManager2.getGSSToken(systemName_, gssCredential_); - } - catch (Throwable e) { - Trace.log(Trace.ERROR, "Error retrieving GSSToken:", e); - throw new AS400SecurityException(AS400SecurityException.KERBEROS_TICKET_NOT_VALID_RETRIEVE); - } - } - else if (credType == AS400.AUTHENTICATION_SCHEME_PROFILE_TOKEN || - credType == AS400.AUTHENTICATION_SCHEME_IDENTITY_TOKEN) - { - return credVault_.getClearCredential(); - } - - // If we got this far: - // credType is AS400.AUTHENTICATION_SCHEME_PASSWORD - - byte[] encryptedPassword = null; - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving encrypted password."); - - if (credVault_.isEmpty()) - { - if (!mustUseSuppliedProfile_ && - AS400.onAS400 && AS400.currentUserAvailable() && userId_.equals(CurrentUser.getUserID(AS400.nativeVRM.getVersionReleaseModification()))) - { - encryptedPassword = CurrentUser.getUserInfo(AS400.nativeVRM.getVersionReleaseModification(), clientSeed, serverSeed); - Trace.log(Trace.DIAGNOSTIC, " encrypted password retrieved"); - } - else - { - Trace.log(Trace.ERROR, "Password is null."); - throw new AS400SecurityException(AS400SecurityException.PASSWORD_NOT_SET); - } - } - else - { - byte[] userIdEbcdic = SignonConverter.stringToByteArray(userId_); - char[] password = BinaryConverter.byteArrayToCharArray(credVault_.getClearCredential()); - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, " user ID:", userId_); - Trace.log(Trace.DIAGNOSTIC, " user ID EBCDIC:", userIdEbcdic); - Trace.log(Trace.DIAGNOSTIC, " password untwiddled: '" + new String(password) + "'"); - Trace.log(Trace.DIAGNOSTIC, " client seed: ", clientSeed); - Trace.log(Trace.DIAGNOSTIC, " server seed: ", serverSeed); - } - - if (passwordType_ == false) - { - // Do DES encryption. - - // Prepend Q to numeric password. A "numeric password" is - // a password that starts with a numeric digit. - if (password.length > 0 && Character.isDigit(password[0])) - { -// boolean isAllNumeric = true; -// for (int i = 0; i < password.length; ++i) -// { -// if (password[i] < '\u0030' || password[i] > '\u0039') -// { -// isAllNumeric = false; -// } -// } -// if (isAllNumeric) -// { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Prepending Q to numeric password."); - char[] passwordWithQ = new char[password.length + 1]; - passwordWithQ[0] = 'Q'; - System.arraycopy(password, 0, passwordWithQ, 1, password.length); - password = passwordWithQ; -// } - } - - if (password.length > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'password' is not valid:", password.length); - throw new AS400SecurityException(AS400SecurityException.PASSWORD_LENGTH_NOT_VALID); - } - byte[] passwordEbcdic = SignonConverter.stringToByteArray(new String(password).toUpperCase()); - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, " password in ebcdic: ", passwordEbcdic); - } - encryptedPassword = encryptPassword(userIdEbcdic, passwordEbcdic, clientSeed, serverSeed); - } - else - { - // Do SHA-1 encryption. - byte[] userIdBytes = BinaryConverter.charArrayToByteArray(SignonConverter.byteArrayToCharArray(userIdEbcdic)); - - // Screen out passwords that start with a star. - if (password[0] == '*') - { - Trace.log(Trace.ERROR, "Parameter 'password' begins with a '*' character."); - throw new AS400SecurityException(AS400SecurityException.SIGNON_CHAR_NOT_VALID); - } - - byte[] passwordBytes = BinaryConverter.charArrayToByteArray(trimUnicodeSpace(password)); - byte[] sequence = {0, 0, 0, 0, 0, 0, 0, 1}; - - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "Pre SHA-1 userIdBytes:", userIdBytes); - Trace.log(Trace.DIAGNOSTIC, "Pre SHA-1 passwordBytes:", passwordBytes); - Trace.log(Trace.DIAGNOSTIC, "Pre SHA-1 sequence:", sequence); - } - - byte[] token = generateShaToken(userIdBytes, passwordBytes); - encryptedPassword = generateShaSubstitute(token, serverSeed, clientSeed, userIdBytes, sequence); - } - } - - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "Encrypted password: ", encryptedPassword); - } - - return encryptedPassword; - } - - // Get port number for service. - public int getServicePort(String systemName, int service) - { - return PortMapper.getServicePort(systemName, service, useSSLConnection_); - } - - // Get secondary language library name. - String getLanguageLibrary() - { - return languageLibrary_; - } - - // Get system name. - String getSystemName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting implementation system name: " + systemName_ + " is local:", systemNameLocal_); - return (systemNameLocal_) ? "localhost" : systemName_; - } - - // Get user ID. - String getUserId() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting implementation user ID:", userId_); - return userId_; - } - - // Get VRM. - int getVRM() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting implementation VRM."); - int vrm = signonInfo_.version.getVersionReleaseModification(); - if (Trace.traceOn_) - { - byte[] vrmBytes = new byte[4]; - BinaryConverter.intToByteArray(vrm, vrmBytes, 0); - Trace.log(Trace.DIAGNOSTIC, "Implementation VRM:", vrmBytes); - } - - return vrm; - } - - // Check if service is connected. - public boolean isConnected(int service) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking for service connection implementation:", service); - if (service == AS400.SIGNON) - { - return signonServer_ != null; - } - else - { - Vector serverList = serverPool_[service]; - synchronized (serverList) - { - for (int i = serverList.size() - 1; i >= 0; i--) - { - if (((AS400Server)serverList.elementAt(i)).isConnected()) return true; - } - return false; - } - } - } - - - private SignonPingReq signonPingRequest_; - private IFSPingReq ifsPingRequest_; - private static final int NO_PRIOR_SERVICE = -1; - private int priorService_ = NO_PRIOR_SERVICE; - - // Check connection's current status. - public boolean isConnectionAlive() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking connection's current alive status"); - - // The host server 'ping' request is supported starting in V7R1. - if (getVRM() < 0x00070100) - { - Trace.log(Trace.DIAGNOSTIC, "The IBM i version is V6R1 or lower, therefore isConnectionAlive() defaults to the behavior of isConnected()."); - if (isConnected(AS400.FILE) || - isConnected(AS400.PRINT) || - isConnected(AS400.COMMAND) || - isConnected(AS400.DATAQUEUE) || - isConnected(AS400.DATABASE) || - isConnected(AS400.RECORDACCESS) || - isConnected(AS400.CENTRAL)|| - isConnected(AS400.SIGNON)) - { - return true; - } - else - { - return false; - } - } - - boolean isAlive = false; - - try - { - AS400Server connectedServer = null; - - // Note: The Signon Server is the "common gateway" (contains common code) for the following servers: Network Print, Remote Command, Data Queue, Database, Central, Signon. - // The File Server and DDM Server (Record Level Access) are independent from the Signon Server, and do not yet support a "ping" request. - // To test connection, we will ping a connected connection to any of the above services. - - // First, try the previously-connected common service (if any). - if (priorService_ != NO_PRIOR_SERVICE && - (priorService_ == AS400.PRINT || - priorService_ == AS400.COMMAND || - priorService_ == AS400.DATAQUEUE || - priorService_ == AS400.DATABASE || - priorService_ == AS400.CENTRAL || - priorService_ == AS400.SIGNON)) - { - connectedServer = getConnectedServer(new int[] {priorService_}); - } - - if (connectedServer == null) - { - // Go through the list of common servers until we find a connected connection. - connectedServer = getConnectedServer(new int[] {AS400.SIGNON, AS400.COMMAND, AS400.DATABASE, AS400.PRINT, AS400.DATAQUEUE, AS400.CENTRAL}); - } - - // If we have a connection to a "common" server, send the ping request. - // If no exception gets thrown, report that the connection is alive. - if (connectedServer != null) - { - if (signonPingRequest_ == null) { - signonPingRequest_ = new SignonPingReq(); // the above services all support "ping" - } - connectedServer.sendAndDiscardReply(signonPingRequest_); - // If no exception was thrown, then the ping succeeded. - - isAlive = true; - priorService_ = connectedServer.getService(); - } - - // If we have a connection to the File Server, send the ping request. - // Then if a reply comes back, swallow the "invalid request" error and report that the connection is alive. - if (connectedServer == null) - { - connectedServer = getConnectedServer(new int[] {AS400.FILE}); - if (connectedServer != null) - { - if (ifsPingRequest_ == null) { - ifsPingRequest_ = new IFSPingReq(); // a dummy request, just to get a reply - } - // We expect to get back a reply indicating "request not supported". - DataStream reply = connectedServer.sendAndReceive(ifsPingRequest_); - // If no exception was thrown, then the ping succeeded. - - isAlive = true; - priorService_ = connectedServer.getService(); - - if (DEBUG) - { - // Sanity-check the reply. - if (reply instanceof IFSReturnCodeRep) - { - int returnCode = ((IFSReturnCodeRep)reply).getReturnCode(); - // We expect the return code to indicate REQUEST_NOT_SUPPORTED. - // That sort of error doesn't clutter the job log with error entries. - if (returnCode != IFSReturnCodeRep.REQUEST_NOT_SUPPORTED) - { - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, "Ping of File Server failed with unexpected return code " + returnCode); - } - } - } - else { - Trace.log(Trace.WARNING, "Unexpected IFS reply datastream received.", reply.data_); - } - } - - } - } - - // If all we have is a connection to the DDM Server, simply return true. - // We don't have a way to ping the DDM server without creating an error entry in the job log. - if (connectedServer == null) - { - if (isConnected(AS400.RECORDACCESS)) - { - Trace.log(Trace.DIAGNOSTIC, "For the RECORDACCESS service, isConnectionAlive() defaults to the behavior of isConnected()."); - isAlive = true; - } - } - - if (connectedServer == null) { priorService_ = NO_PRIOR_SERVICE; } - - } - catch (Exception e) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, e); - isAlive = false; - } - - if (!isAlive) { priorService_ = NO_PRIOR_SERVICE; } - - return isAlive; - } - - - // Check connection's current status, for a specific service. - public boolean isConnectionAlive(int service) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking service connection's current alive status:", service); - - if (!isConnected(service)) return false; - - // The host server 'ping' request is supported starting in V7R1. - if (getVRM() < 0x00070100) - { - Trace.log(Trace.DIAGNOSTIC, "The IBM i version is V6R1 or lower, therefore isConnectionAlive() defaults to the behavior of isConnected()."); - if (isConnected(service)) - { - return true; - } - else - { - return false; - } - } - - boolean isAlive = false; - try - { - AS400Server connectedServer = getConnectedServer(new int[] {service}); - - // If we have a connection to the specified service, send the ping request. - // If no exception gets thrown, report that the connection is alive. - - if (connectedServer != null) - { - - // Special handling for the DDM Server. - if (service == AS400.RECORDACCESS) - { - // For the DDM Server, simply return true. - // We don't have a way to ping the DDM server without creating an error entry in the host server's job log. - Trace.log(Trace.DIAGNOSTIC, "For the RECORDACCESS service, isConnectionAlive() defaults to the behavior of isConnected()."); - isAlive = true; - } - - // Special handling for the File Server. - else if (service == AS400.FILE) - { - if (ifsPingRequest_ == null) { - ifsPingRequest_ = new IFSPingReq(); // a dummy request, just to get a reply - } - // We expect to get back a reply indicating "request not supported". - DataStream reply = connectedServer.sendAndReceive(ifsPingRequest_); - // If no exception was thrown, then the ping succeeded. - - isAlive = true; - - if (DEBUG) - { - // Sanity-check the reply. - if (reply instanceof IFSReturnCodeRep) - { - int returnCode = ((IFSReturnCodeRep)reply).getReturnCode(); - // We expect the return code to indicate REQUEST_NOT_SUPPORTED. - // That sort of error doesn't clutter the job log with error entries. - if (returnCode != IFSReturnCodeRep.REQUEST_NOT_SUPPORTED) - { - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, "Ping of File Server failed with unexpected return code " + returnCode); - } - } - } - else { - Trace.log(Trace.WARNING, "Unexpected IFS reply datastream received.", reply.data_); - } - } - } - - else // It's a "common service", which will accept a Signon Ping Request. - { - if (signonPingRequest_ == null) { - signonPingRequest_ = new SignonPingReq(); // the above services all support "ping" - } - connectedServer.sendAndDiscardReply(signonPingRequest_); - // If no exception was thrown, then the ping succeeded. - - isAlive = true; - } - } - - } - catch (Exception e) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, e); - isAlive = false; - } - - return isAlive; - } - - private final AS400Server getConnectedServer(int[] services) - { - AS400Server server = null; - for (int i=0; i= 0 && server == null; ii--) - { - if (((AS400Server)serverList.elementAt(ii)).isConnected()) { - server = (AS400Server)serverList.elementAt(ii); - } - } - } - } - } - return server; - } - - // Indicates whether we've discovered that PTF SI29629 is missing on a V5R4 system. - // This method is used by RemoteCommandImplRemote when deciding how to call an API. - // In particular: If the system is at V5R4, and is missing the PTF, we need to call QCDRCMDI with only 5 parameters instead of 6. - boolean isMissingPTF() - { - return detectedMissingPTF_; - } - - // Indicates whether we are required to add the secondary language library. - boolean isMustAddLanguageLibrary() - { - return mustAddLanguageLibrary_; - } - - // Indicates whether we've discovered that we should skip further attempts to add the secondary language library for this AS400Impl. - boolean isSkipFurtherSettingOfLanguageLibrary() - { - return skipFurtherSettingOfLanguageLibrary_; - } - - // Check if thread can be used. - boolean isThreadUsed() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking implementation if thread is used:", threadUsed_); - return threadUsed_; - } - - // Load the appropriate implementation object. - // param impl1 fully package named class name for native implementation. - // param impl2 fully package named class name for remote implementation. - Object loadImpl(String impl1, String impl2) - { - if (canUseNativeOptimization_) - { - Object impl = AS400.loadImpl(impl1); - if (impl != null) return impl; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Load of native implementation '" + impl1 + "' failed, attempting to load remote implementation."); - } - Object impl = AS400.loadImpl(impl2); - if (impl != null) return impl; - - Trace.log(Trace.DIAGNOSTIC, "Load of remote implementation '" + impl2 + "' failed."); - throw new ExtendedIllegalStateException(impl2, ExtendedIllegalStateException.IMPLEMENTATION_NOT_FOUND); - } - - // Load a converter object into converter cache. - public void newConverter(int ccsid) throws UnsupportedEncodingException - { - ConverterImplRemote.getConverter(ccsid, this); - } - - // Remove the connection event dispatcher. - public void removeConnectionListener(ConnectionListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing implementation connection listener."); - dispatcher_ = null; - } - - // Create AS400SecurityException from sign-on server return code. - // Throw or return proper exception if exchange of random seeds or start server request fail. - static AS400SecurityException returnSecurityException(int rc) throws ServerStartupException - { - return returnSecurityException(rc, null); - } - static AS400SecurityException returnSecurityException(int rc, AS400Message[] messageList) throws ServerStartupException - { - switch (rc) - { - case 0x00010001: - // Error on request data: invalid exchange attributes request. - // Error on request data: invalid exchange random seeds request. - throw new ServerStartupException(ServerStartupException.RANDOM_SEED_EXCHANGE_INVALID); - case 0x00010002: - // Error on request data: invalid server ID. - throw new ServerStartupException(ServerStartupException.SERVER_ID_NOT_VALID); - case 0x00010003: - // Error on request data: invalid request ID. - throw new ServerStartupException(ServerStartupException.REQUEST_ID_NOT_VALID); - case 0x00010004: - // Error on request data: invalid random seed: - // - Zero is invalid. - // - Greater than x'DFFFFFFFFFFFFFFF' is invalid. - throw new ServerStartupException(ServerStartupException.RANDOM_SEED_INVALID); - case 0x00010005: - // Error on request data: random seed required when doing password substitution. - throw new ServerStartupException(ServerStartupException.RANDOM_SEED_REQUIRED); - case 0x00010006: - // Error on request data: invalid password encrypt indicator. - throw new ServerStartupException(ServerStartupException.PASSWORD_ENCRYPT_INVALID); - case 0x00010007: - // Error on request data: invalid user ID (length). - return new AS400SecurityException(AS400SecurityException.USERID_LENGTH_NOT_VALID, messageList); - case 0x00010008: - // Error on request data: invalid password or passphrase (length). - return new AS400SecurityException(AS400SecurityException.PASSWORD_LENGTH_NOT_VALID, messageList); - case 0x00010009: - // Error on request data: invalid client version. - // Error on request data: invalid send reply indicator. - throw new ServerStartupException(ServerStartupException.REQUEST_DATA_ERROR); - case 0x0001000A: - // Error on request data: invalid data stream level. - // Error on request data: invalid start server request: - // - missing user ID. - // - missing password or passphrase. - // - missing authentication token. - // - missing user ID, password or passphrase, and authentication token were specified. - // - both password and passphrase were specified on the request. - throw new ServerStartupException(ServerStartupException.REQUEST_DATA_ERROR); - case 0x0001000B: - // Error on request data: invalid retrieve sign-on data request: - // - missing user ID. - // - missing password or passphrase. - // - missing authentication token. - // - user ID / password (or user ID / passphrase) and authentication token both specified. - // - problems with length fields in the request. - return new AS400SecurityException(AS400SecurityException.SIGNON_REQUEST_NOT_VALID, messageList); - case 0x0001000C: - // Error on request data: invalid change password request: - // - missing user ID. - // - missing old password or passphrase. - // - missing new password or passphrase. - // - authentication token specified. - // - problems with length fields in the request. - // - missing old protected password / passphrase length. - // - missing new protected password / passphrase length. - // - missing protected password / passphrase CCSID value. - return new AS400SecurityException(AS400SecurityException.PASSWORD_CHANGE_REQUEST_NOT_VALID, messageList); - case 0x0001000D: - // Error on request data: invalid protected old password or passphrase. - return new AS400SecurityException(AS400SecurityException.PASSWORD_OLD_NOT_VALID, messageList); - case 0x0001000E: - // Error on request data: invalid protected new or clear text password or passphrase. - return new AS400SecurityException(AS400SecurityException.PASSWORD_NEW_NOT_VALID, messageList); - case 0x0001000F: - // Error on request data: invalid token type on generate authentication token request. - return new AS400SecurityException(AS400SecurityException.TOKEN_TYPE_NOT_VALID, messageList); - case 0x00010010: - // Error on request data: invalid generate authentication token request: - // - missing authentication token. - // - missing user ID. - // - missing password or passphrase. - // - user ID / password (or user ID / passphrase) and authentication token both specified. - // - problems with length fields in the request. - return new AS400SecurityException(AS400SecurityException.GENERATE_TOKEN_REQUEST_NOT_VALID, messageList); - case 0x00010011: - // Error on request data: invalid authentication token (length). - return new AS400SecurityException(AS400SecurityException.TOKEN_LENGTH_NOT_VALID, messageList); - case 0x00010012: - // Invalid generate authentication token for another user. - return new AS400SecurityException(AS400SecurityException.GENERATE_TOKEN_REQUEST_NOT_VALID, messageList); - case 0x00020001: - // User ID errors: user ID unknown: - // - user ID not found on system. - // - EIM doesn't map Kerberos principal to a user profile. - // - EIM maps the Kerberos principal to a user profile, but the profile doesn't exist on this system. - return new AS400SecurityException(AS400SecurityException.USERID_UNKNOWN, messageList); - case 0x00020002: - // User ID errors: user ID valid, but revoked. - return new AS400SecurityException(AS400SecurityException.USERID_DISABLE, messageList); - case 0x00020003: - // User profile mismatch. - return new AS400SecurityException(AS400SecurityException.USERID_MISMATCH, messageList); - case 0x00030001: - // Password errors: new password or passphase longer than maximum accepted length. - return new AS400SecurityException(AS400SecurityException.PASSWORD_NEW_TOO_LONG, messageList); - case 0x00030002: - // Password errors: new password or passphase shorter than minimum accepted length. - return new AS400SecurityException(AS400SecurityException.PASSWORD_NEW_TOO_SHORT, messageList); - case 0x00030003: - // Password errors: new password or passphase contains character used more than once. - return new AS400SecurityException(AS400SecurityException.PASSWORD_NEW_REPEAT_CHARACTER, messageList); - case 0x00030004: - // Password errors: new password or passphase has adjacent digits. - return new AS400SecurityException(AS400SecurityException.PASSWORD_NEW_ADJACENT_DIGITS, messageList); - case 0x00030005: - // Password errors: new password or passphase contains a character repeated consecutively. - return new AS400SecurityException(AS400SecurityException.PASSWORD_NEW_CONSECUTIVE_REPEAT_CHARACTER, messageList); - case 0x00030006: - // Password errors: new password or passphase was previously used. - return new AS400SecurityException(AS400SecurityException.PASSWORD_NEW_PREVIOUSLY_USED, messageList); - case 0x00030007: - // Password errors: new password or passphase must contain at least one numeric. - return new AS400SecurityException(AS400SecurityException.PASSWORD_NEW_NO_NUMERIC, messageList); - case 0x00030008: - // Password errors: new password or passphase contains an invalid character. - return new AS400SecurityException(AS400SecurityException.PASSWORD_NEW_CHARACTER_NOT_VALID, messageList); - case 0x00030009: - // Password errors: new password or passphase exists in a dictionary of disallowed passwords or passphrases. - return new AS400SecurityException(AS400SecurityException.PASSWORD_NEW_DISALLOWED, messageList); - case 0x0003000A: - // Password errors: new password or passphase contains user ID as part of the password or passphrase. - return new AS400SecurityException(AS400SecurityException.PASSWORD_NEW_USERID, messageList); - case 0x0003000B: - // Password errors: password or passphrase incorrect. - return new AS400SecurityException(AS400SecurityException.PASSWORD_INCORRECT, messageList); - case 0x0003000C: - // Password errors: profile will be disabled on the next invalid password or passphrase. - return new AS400SecurityException(AS400SecurityException.PASSWORD_INCORRECT_USERID_DISABLE, messageList); - case 0x0003000D: - // Password errors: password or passphrase correct, but expired. - return new AS400SecurityException(AS400SecurityException.PASSWORD_EXPIRED, messageList); - case 0x0003000E: - // Password errors: pre-V2R2 encrypted password. - return new AS400SecurityException(AS400SecurityException.PASSWORD_PRE_V2R2, messageList); - case 0x0003000F: - // Password errors: new password or passphrase contains a character in the same position as the last password or passphrase. - return new AS400SecurityException(AS400SecurityException.PASSWORD_NEW_SAME_POSITION, messageList); - case 0x00030010: - // Password errors: Password is *NONE. - return new AS400SecurityException(AS400SecurityException.PASSWORD_NONE, messageList); - case 0x00030011: - // Password errors: Password validation program failed the request. - return new AS400SecurityException(AS400SecurityException.PASSWORD_NEW_VALIDATION_PROGRAM, messageList); - case 0x00030012: - // Password errors: Password change not allowed at this time. - return new AS400SecurityException(AS400SecurityException.PASSWORD_CHANGE_NOT_ALLOWED, messageList); - case 0x00030013: - // Password errors: Password value is not valid. - return new AS400SecurityException(AS400SecurityException.PASSWORD_VALUE_NOT_VALID, messageList); - case 0x00040000: - // General security errors, function not performed: No meaning. Reasons for getting this return code include: - // - QUSER's password expired. - // - incorrect client CCSID passed on exchange client/server attributes request. - // - failures in program QTQRCSC. - // - error generating server's random seed. - // - errors while swapping profiles with the QSYGETPH and QWTSETP API's. - // - user profile errors. - // - errors while retrieving the user's password or passphrase. - // - errors while changing passwords or passphrases. - // - failures reported by APIs that are used by the signon server. These API's include QWTCHGJB, QSYRUSRI, QSYCHGPR, QWCCVTDT, and QSYCHGPW. - // - input to Kerberos validation routine is not properly formatted or is not valid. - // Check the QZSOSIGN jobs for possible messages. - // Check the daemon jobs for possible messages. - return new AS400SecurityException(AS400SecurityException.SECURITY_GENERAL, messageList); - case 0x00040001: - // General security errors, function not performed: QYSMPUT error due to incorrect program data length. - throw new ServerStartupException(ServerStartupException.CONNECTION_NOT_PASSED_LENGTH); - case 0x00040002: - // General security errors, function not performed: QYSMPUT error because no responce was received (timeout) from the server job. - throw new ServerStartupException(ServerStartupException.CONNECTION_NOT_PASSED_TIMEOUT); - case 0x00040003: - // General security errors, function not performed: QYSMPUT error because the server job could not be started. - throw new ServerStartupException(ServerStartupException.CONNECTION_NOT_PASSED_SERVER_NOT_STARTED); - case 0x00040004: - // General security errors, function not performed: QYSMPUT error because the prestart job could not be started. - throw new ServerStartupException(ServerStartupException.CONNECTION_NOT_PASSED_PRESTART_NOT_STARTED); - case 0x00040005: - // General security errors, function not performed: QYSMPUT error due to subsystem problems. - throw new ServerStartupException(ServerStartupException.CONNECTION_NOT_PASSED_SUBSYSTEM); - case 0x00040006: - // General security errors, function not performed: QYSMPUT error because the server job is ending. - throw new ServerStartupException(ServerStartupException.CONNECTION_NOT_PASSED_SERVER_ENDING); - case 0x00040007: - // General security errors, function not performed: QYSMPUT error because the receiver area is too small. - throw new ServerStartupException(ServerStartupException.CONNECTION_NOT_PASSED_RECEIVER_AREA); - case 0x00040008: - // General security errors, function not performed: QYSMPUT error because the unknown or unrecoverable errors. - throw new ServerStartupException(ServerStartupException.CONNECTION_NOT_PASSED_UNKNOWN); - case 0x00040009: - // General security errors, function not performed: QYSMPUT error because the user profile for the server job soes not exist. - throw new ServerStartupException(ServerStartupException.CONNECTION_NOT_PASSED_PROFILE); - case 0x0004000A: - // General security errors, function not performed: QYSMPUT error due to authority problems releated to the profile for the server job. - throw new ServerStartupException(ServerStartupException.CONNECTION_NOT_PASSED_AUTHORITY); - case 0x0004000B: - // General security errors, function not performed: QYSMPUT error because the server job program was not found. - throw new ServerStartupException(ServerStartupException.CONNECTION_NOT_PASSED_PROGRAM_NOT_FOUND); - case 0x0004000C: - // General security errors, function not performed: QYSMPUT error because the daemon job is not authorized to use the library that contains the server job. - throw new ServerStartupException(ServerStartupException.CONNECTION_NOT_PASSED_LIBRARY_AUTHORITY); - case 0x0004000D: - // General security errors, function not performed: QYSMPUT error because the daemon job is not authorized to the server job program. - throw new ServerStartupException(ServerStartupException.CONNECTION_NOT_PASSED_PROGRAM_AUTHORITY); - case 0x0004000E: - // General security errors, function not performed: user not authorized to generate token for another user. - return new AS400SecurityException(AS400SecurityException.GENERATE_TOKEN_AUTHORITY_INSUFFICIENT, messageList); - case 0x0004000F: - // General security errors, function not performed: no memory is available to allocate space needed for authorization. - return new AS400SecurityException(AS400SecurityException.SERVER_NO_MEMORY, messageList); - case 0x00040010: - // General security errors, function not performed: error occurred when converting data between code pages. - return new AS400SecurityException(AS400SecurityException.SERVER_CONVERSION_ERROR, messageList); - case 0x00040011: - // General security errors, function not performed: error occurred using EIM interfaces. - return new AS400SecurityException(AS400SecurityException.SERVER_EIM_ERROR, messageList); - case 0x00040012: - // General security errors, function not performed: error occurred using cryptographic interfaces. - return new AS400SecurityException(AS400SecurityException.SERVER_CRYPTO_ERROR, messageList); - case 0x00040013: - // General security errors, function not performed: this version of token is not supported by this version of code. - return new AS400SecurityException(AS400SecurityException.SERVER_TOKEN_VERSION, messageList); - case 0x00040014: - // General security errors, function not performed: public key not found. - return new AS400SecurityException(AS400SecurityException.SERVER_KEY_NOT_FOUND, messageList); - case 0x00050001: - // Exit program errors: error processing exit point. - return new AS400SecurityException(AS400SecurityException.EXIT_POINT_PROCESSING_ERROR, messageList); - case 0x00050002: - // Exit program errors: resolving to exit program. - return new AS400SecurityException(AS400SecurityException.EXIT_PROGRAM_RESOLVE_ERROR, messageList); - case 0x00050003: - // Exit program errors: user exit program call error. - return new AS400SecurityException(AS400SecurityException.EXIT_PROGRAM_CALL_ERROR, messageList); - case 0x00050004: - // Exit program errors: user exit program denied request. - return new AS400SecurityException(AS400SecurityException.EXIT_PROGRAM_DENIED_REQUEST, messageList); - case 0x00060001: - // Authentication token errors: profile token or identity token not valid. - return new AS400SecurityException(AS400SecurityException.PROFILE_TOKEN_NOT_VALID, messageList); - case 0x00060002: - // Authentication token errors: maximum number of profile tokens for the system already generated. - return new AS400SecurityException(AS400SecurityException.PROFILE_TOKEN_NOT_VALID_MAXIMUM, messageList); - case 0x00060003: - // Authentication token errors: invalid value sent for timeout interval. - return new AS400SecurityException(AS400SecurityException.PROFILE_TOKEN_NOT_VALID_TIMEOUT_NOT_VALID, messageList); - case 0x00060004: - // Authentication token errors: invalid type of profile token request. - return new AS400SecurityException(AS400SecurityException.PROFILE_TOKEN_NOT_VALID_TYPE_NOT_VALID, messageList); - case 0x00060005: - // Authentication token errors: existing profile token isn't regenerable, can't be used to generate a new profile token. - return new AS400SecurityException(AS400SecurityException.PROFILE_TOKEN_NOT_VALID_NOT_REGENERABLE, messageList); - case 0x00060006: - // Authentication token errors: Kerberos ticket not valid - consistency checks failed. - return new AS400SecurityException(AS400SecurityException.KERBEROS_TICKET_NOT_VALID_CONSISTENCY, messageList); - case 0x00060007: - // Authentication token errors: requested mechanisms not supported by local system. - return new AS400SecurityException(AS400SecurityException.KERBEROS_TICKET_NOT_VALID_MECHANISM, messageList); - case 0x00060008: - // Authentication token errors: credentials not available or not valid for this context. - return new AS400SecurityException(AS400SecurityException.KERBEROS_TICKET_NOT_VALID_CREDENTIAL_NOT_VALID, messageList); - case 0x00060009: - // Authentication token errors: Kerberos token or identity token contains incorrect signature. - return new AS400SecurityException(AS400SecurityException.KERBEROS_TICKET_NOT_VALID_SIGNATURE, messageList); - case 0x0006000A: - // Authentication token errors: credentials no longer valid. - return new AS400SecurityException(AS400SecurityException.KERBEROS_TICKET_NOT_VALID_CREDENTIAL_NO_LONGER_VALID, messageList); - case 0x0006000B: - // Authentication token errors: consistency checks on the credantial structure failed, or a mismatch exists between an authentication token and information provided to the identity token functions. - return new AS400SecurityException(AS400SecurityException.KERBEROS_TICKET_NOT_VALID_CONSISTENCY, messageList); - case 0x0006000C: - // Authentication token errors: failure of verification routine. - return new AS400SecurityException(AS400SecurityException.KERBEROS_TICKET_NOT_VALID_VERIFICATION, messageList); - case 0x0006000D: - // Authentication token errors: EIM configuration error, or an EIM identifier was not found, or an application identifier was not found. - return new AS400SecurityException(AS400SecurityException.KERBEROS_TICKET_NOT_VALID_EIM, messageList); - case 0x0006000E: - // Authentication token errors: Kerberos principal maps to a system profile which can not be used to sign on. - return new AS400SecurityException(AS400SecurityException.KERBEROS_TICKET_NOT_VALID_SYSTEM_PROFILE, messageList); - case 0x0006000F: - // Authentication token errors: Kerberos principal maps to multiple user profile names, or more than one EIM entry was found for an identity token. - return new AS400SecurityException(AS400SecurityException.KERBEROS_TICKET_NOT_VALID_MULTIPLE_PROFILES, messageList); - case 0x00070001: - // Generate token errors: can not connect to the system EIM domain. - return new AS400SecurityException(AS400SecurityException.GENERATE_TOKEN_CAN_NOT_CONNECT, messageList); - case 0x00070002: - // Generate token errors: can not change the CCSID to use for EIM requests to 13488. - return new AS400SecurityException(AS400SecurityException.GENERATE_TOKEN_CAN_NOT_CHANGE_CCSID, messageList); - case 0x00070003: - // Generate token errors: can not obtain the EIM registry name. - return new AS400SecurityException(AS400SecurityException.GENERATE_TOKEN_CAN_NOT_OBTAIN_NAME, messageList); - case 0x00070004: - // Generate token errors: no mapping exists between the WebSphere Portal user identity and an IBM i user profile. - return new AS400SecurityException(AS400SecurityException.GENERATE_TOKEN_NO_MAPPING, messageList); - default: - // Internal errors or unexpected return codes. - return new AS400SecurityException(AS400SecurityException.UNKNOWN, messageList); - } - } - - static AS400Message[] parseMessages(byte[] data, int offset, ConverterImplRemote converter) throws IOException - { - int originalOffset = offset; - int messageNumber = 0; - while (offset < data.length - 1) - { - if (BinaryConverter.byteArrayToShort(data, offset + 4) != 0x112A) - { - offset += BinaryConverter.byteArrayToInt(data, offset); - } - else - { - messageNumber = BinaryConverter.byteArrayToShort(data, offset + 6); - break; - } - } - if (messageNumber == 0) return null; - AS400Message[] messageList = new AS400Message[messageNumber]; - - offset = originalOffset; - for (int i = 0; i < messageNumber; ++i) - { - while (offset < data.length - 1) - { - if (BinaryConverter.byteArrayToShort(data, offset + 4) != 0x112B) - { - offset += BinaryConverter.byteArrayToInt(data, offset); - } - else - { - messageList[i] = parseMessage(data, offset + 6, converter); - break; - } - } - offset += BinaryConverter.byteArrayToInt(data, offset); - } - - return messageList; - } - - static AS400Message parseMessage(byte[] data, int offset, ConverterImplRemote converter) throws IOException - { - AS400Message message = new AS400Message(); - int textCcsid = BinaryConverter.byteArrayToInt(data, offset); - message.setTextCcsid(textCcsid); - offset += 4; - int substitutionCcsid = BinaryConverter.byteArrayToInt(data, offset); - message.setSubstitutionDataCcsid(substitutionCcsid); - offset += 4; - message.setSeverity(BinaryConverter.byteArrayToUnsignedShort(data, offset)); - offset += 2; - int messageTypeLength = BinaryConverter.byteArrayToInt(data, offset); - offset += 4; - message.setType((data[offset] & 0x0F) * 10 + (data[offset +1] & 0x0F)); - offset += messageTypeLength; - int messageIdLength = BinaryConverter.byteArrayToInt(data, offset); - offset += 4; - message.setID(converter.byteArrayToString(data, offset, messageIdLength)); - offset += messageIdLength; - int messageFileNameLength = BinaryConverter.byteArrayToInt(data, offset); - offset += 4; - message.setFileName(converter.byteArrayToString(data, offset, messageFileNameLength).trim()); - offset += messageFileNameLength; - int messageFileLibraryNameLength = BinaryConverter.byteArrayToInt(data, offset); - offset += 4; - message.setLibraryName(converter.byteArrayToString(data, offset, messageFileLibraryNameLength).trim()); - offset += messageFileLibraryNameLength; - int messageTextLength = BinaryConverter.byteArrayToInt(data, offset); - offset += 4; - message.setText(converter.byteArrayToString(data, offset, messageTextLength)); - offset += messageTextLength; - int messageSubstitutionTextLength = BinaryConverter.byteArrayToInt(data, offset); - offset += 4; - byte[] substitutionData = new byte[messageSubstitutionTextLength]; - System.arraycopy(data, offset, substitutionData, 0, messageSubstitutionTextLength); - message.setSubstitutionData(substitutionData); - offset += messageSubstitutionTextLength; - int messageHelpLength = BinaryConverter.byteArrayToInt(data, offset); - offset += 4; - message.setHelp(converter.byteArrayToString(data, offset, messageHelpLength)); - return message; - } - - public void setGSSCredential(Object gssCredential) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting GSS credential into impl: '" + gssCredential + "'"); - gssCredential_ = gssCredential; - } - - // Indicates that we've discovered that PTF SI29629 is missing on a V5R4 system. - // This method is used by RemoteCommandImplRemote. - void setMissingPTF() - { - detectedMissingPTF_ = true; - } - - // Set secondary language library name. - void setLanguageLibrary(String libName) - { - languageLibrary_ = libName; - } - - // Indicates that we've discovered that we should skip further attempts to set the secondary language library for this AS400Impl. - void setSkipFurtherSettingOfLanguageLibrary() - { - skipFurtherSettingOfLanguageLibrary_ = true; - } - - // Set port for service. - public void setServicePort(String systemName, int service, int port) - { - PortMapper.setServicePort(systemName, service, port, useSSLConnection_); - } - - // Set all the ports for a system name to the defaults. - public void setServicePortsToDefault(String systemName) - { - PortMapper.setServicePortsToDefault(systemName); - } - - // Flag that indicates if we must add the secondary language library. - private boolean mustAddLanguageLibrary_ = false; - // Flag that indicates if we must use network sockets and not unix domain sockets. - private boolean mustUseNetSockets_ = false; - // Flag that indicates if we must not use the current profile. - private boolean mustUseSuppliedProfile_ = false; - // Set the state variables for this implementation object. - public void setState(SSLOptions useSSLConnection, boolean canUseNativeOptimization, boolean threadUsed, int ccsid, String nlv, SocketProperties socketProperties, String ddmRDB, boolean mustUseNetSockets, boolean mustUseSuppliedProfile, boolean mustAddLanguageLibrary) - { - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "Setting up AS400 implementation object:"); - Trace.log(Trace.DIAGNOSTIC, " Enable SSL connections: " + useSSLConnection); - Trace.log(Trace.DIAGNOSTIC, " Native optimizations allowed:", canUseNativeOptimization); - Trace.log(Trace.DIAGNOSTIC, " Use threaded communications:", threadUsed); - Trace.log(Trace.DIAGNOSTIC, " User specified CCSID:", ccsid); - Trace.log(Trace.DIAGNOSTIC, " NLV:", nlv); - Trace.log(Trace.DIAGNOSTIC, " Socket properties: " + socketProperties); - Trace.log(Trace.DIAGNOSTIC, " DDM RDB:", ddmRDB); - Trace.log(Trace.DIAGNOSTIC, " Must use net sockets:", mustUseNetSockets); - Trace.log(Trace.DIAGNOSTIC, " Must use supplied profile:", mustUseSuppliedProfile); - Trace.log(Trace.DIAGNOSTIC, " Must add language library:", mustAddLanguageLibrary); - } - useSSLConnection_ = useSSLConnection; - canUseNativeOptimization_ = canUseNativeOptimization; - threadUsed_ = threadUsed; - if (ccsid != 0) - { - userOverrideCcsid_ = true; - ccsid_ = ccsid; - } - clientNlv_ = nlv; - socketProperties_ = socketProperties; - ddmRDB_ = ddmRDB; - mustAddLanguageLibrary_ = mustAddLanguageLibrary; - mustUseNetSockets_ = mustUseNetSockets; - mustUseSuppliedProfile_ = mustUseSuppliedProfile; - } - - - private SignonInfo signon2(String systemName, boolean systemNameLocal, String userId, byte[] bytes, int byteType) throws AS400SecurityException, IOException - { - CredentialVault tempVault; - - if (bytes == null) { - tempVault = new PasswordVault(); - } - else if (byteType == AS400.AUTHENTICATION_SCHEME_GSS_TOKEN) { - tempVault = new GSSTokenVault(bytes); - } - else - { - // - // Create a credential vault based on the type of bytes, - // and populate it with the raw decoded credential bytes. - // - byte[] newBytes = CredentialVault.decode(proxySeed_, remoteSeed_, bytes); - - switch (byteType) - { - case AS400.AUTHENTICATION_SCHEME_PASSWORD: - tempVault = new PasswordVault(newBytes); - break; - case AS400.AUTHENTICATION_SCHEME_PROFILE_TOKEN: - tempVault = new ProfileTokenVault(newBytes); - break; - case AS400.AUTHENTICATION_SCHEME_IDENTITY_TOKEN: - tempVault = new IdentityTokenVault(newBytes); - break; - default: - Trace.log(Trace.ERROR, "Unsupported byte type: " + byteType); - throw new InternalErrorException(InternalErrorException.UNKNOWN, byteType); - } - // This code is a bit strange, but necessary. - // We decoded the raw bytes above and created a new credential vault using the decoded bytes. - // This is because a credential vault always requires clear bytes when constructed. - // Once constructed, we must encode the credential in the vault using the same seeds we just decoded it with. - // Why? Because the signon() method we are going to invoke expects that the credential in the vault will always be encoded, - // so we satisfy this expectation by re-encoding here. - tempVault.storeEncodedUsingExternalSeeds(proxySeed_, remoteSeed_); - } - return signon(systemName, systemNameLocal, userId, tempVault, gssName_); - } - - - // Exchange sign-on flows with sign-on server. - public SignonInfo signon(String systemName, boolean systemNameLocal, String userId, CredentialVault vault, String gssName) throws AS400SecurityException, IOException // @mds - { - systemName_ = systemName; - systemNameLocal_ = systemNameLocal; - userId_ = userId; - gssName_ = gssName; - - // We are accepting a credential vault from the caller. - // This vault will replace our existing one. - // So if our existing one is not the same as the one being given to us, - // then empty our existing one since we are discarding it. - if (!vault.equals(credVault_)) { - credVault_.empty(); - } - credVault_ = vault; // @mds - - //gssOption_ = gssOption; // not used - - if (credVault_.getType() == AS400.AUTHENTICATION_SCHEME_GSS_TOKEN) - { - // No decoding to do. - } - else - { - // Must first decode the credential using the seeds that were previously exchanged between the public AS400 class and this class. - credVault_.storeEncodedUsingInternalSeeds(proxySeed_, remoteSeed_); - // Note: The called method ends up storing a "twiddled" representation of the credential info. - } - - proxySeed_ = null; - remoteSeed_ = null; - - if (canUseNativeOptimization_) - { - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = swapTo(swapToPH, swapFromPH); - try - { - byte[] data = AS400ImplNative.signonNative(SignonConverter.stringToByteArray(userId)); - GregorianCalendar date = new GregorianCalendar(BinaryConverter.byteArrayToUnsignedShort(data, 0)/*year*/, (int)(data[2] - 1)/*month convert to zero based*/, (int)(data[3])/*day*/, (int)(data[4])/*hour*/, (int)(data[5])/*minute*/, (int)(data[6])/*second*/); - signonInfo_ = new SignonInfo(); - signonInfo_.currentSignonDate = date; - signonInfo_.lastSignonDate = date; - signonInfo_.expirationDate = (BinaryConverter.byteArrayToInt(data, 8) == 0) ? null : new GregorianCalendar(BinaryConverter.byteArrayToUnsignedShort(data, 8)/*year*/, (int)(data[10] - 1)/*month convert to zero based*/, (int)(data[11])/*day*/, (int)(data[12])/*hour*/, (int)(data[13])/*minute*/, (int)(data[14])/*second*/); - - signonInfo_.version = AS400.nativeVRM; - signonInfo_.serverCCSID = getCcsidFromServer(); - } - catch (NativeException e) - { - // Map native exception to AS400SecurityException. - throw mapNativeSecurityException(e); - } - finally - { - if (didSwap) swapBack(swapToPH, swapFromPH); - } - } - else - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Opening a socket to verify security..."); - // Validate user id and password. - signonConnect(); - try - { - byte[] userIDbytes = credVault_.getType() == AS400.AUTHENTICATION_SCHEME_PASSWORD ? SignonConverter.stringToByteArray(userId) : null; - byte[] encryptedPassword = credVault_.getType() == AS400.AUTHENTICATION_SCHEME_GSS_TOKEN ? credVault_.getClearCredential() : getPassword(clientSeed_, serverSeed_); // @mds - - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "Sending Retrieve Signon Information Request..."); - Trace.log(Trace.DIAGNOSTIC, " User ID:", userId); - Trace.log(Trace.DIAGNOSTIC, " User ID bytes:", userIDbytes); - Trace.log(Trace.DIAGNOSTIC, " Client seed:", clientSeed_); - Trace.log(Trace.DIAGNOSTIC, " Server seed:", serverSeed_); - Trace.log(Trace.DIAGNOSTIC, " Encrypted password:", encryptedPassword); - } - - SignonInfoReq signonReq = new SignonInfoReq(userIDbytes, encryptedPassword, credVault_.getType(), serverLevel_); - SignonInfoRep signonRep = (SignonInfoRep)signonServer_.sendAndReceive(signonReq); - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Read security validation reply..."); - - int rc = signonRep.getRC(); - if (rc != 0) - { - byte[] rcBytes = new byte[4]; - BinaryConverter.intToByteArray(rc, rcBytes, 0); - Trace.log(Trace.ERROR, "Security validation failed with return code:", rcBytes); - throw AS400ImplRemote.returnSecurityException(rc, signonRep.getErrorMessages(ConverterImplRemote.getConverter(ExecutionEnvironment.getBestGuessAS400Ccsid(), this))); - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Security validated successfully."); - - signonInfo_ = new SignonInfo(); - signonInfo_.currentSignonDate = signonRep.getCurrentSignonDate(); - signonInfo_.lastSignonDate = signonRep.getLastSignonDate(); - signonInfo_.expirationDate = signonRep.getExpirationDate(); - signonInfo_.version = version_; - signonInfo_.serverCCSID = signonRep.getServerCCSID(); - if (userId_.length() == 0) - { - byte[] b = signonRep.getUserIdBytes(); - if (b != null) - { - userId_ = SignonConverter.byteArrayToString(b); - signonInfo_.userId = userId_; - } - } - - if (DataStream.getDefaultConverter() == null) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Signon server reports CCSID:", signonInfo_.serverCCSID); - DataStream.setDefaultConverter(ConverterImplRemote.getConverter(signonInfo_.serverCCSID, this)); - } - ConverterImplRemote converter = ConverterImplRemote.getConverter(signonInfo_.serverCCSID, this); - signonJobString_ = converter.byteArrayToString(signonJobBytes_); - signonServer_.setJobString(signonJobString_); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Signon server job:", signonJobString_); - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Signon failed:", e); - signonServer_.forceDisconnect(); - signonServer_ = null; - throw e; - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, "Signon failed:", e); - signonServer_.forceDisconnect(); - signonServer_ = null; - throw e; - } - } - return signonInfo_; - } - - // Connect to sign-on server. - private synchronized void signonConnect() throws AS400SecurityException, IOException - { - if (signonServer_ == null) - { - boolean connectedSuccessfully = false; - SocketContainer signonConnection = PortMapper.getServerSocket((systemNameLocal_) ? "localhost" : systemName_, AS400.SIGNON, useSSLConnection_, socketProperties_, mustUseNetSockets_); - signonServer_ = new AS400NoThreadServer(this, AS400.SIGNON, signonConnection, ""); - int connectionID = signonConnection.hashCode(); - try - { - InputStream inStream = signonConnection.getInputStream(); - OutputStream outStream = signonConnection.getOutputStream(); - - clientSeed_ = credVault_.getType() == AS400.AUTHENTICATION_SCHEME_PASSWORD ? BinaryConverter.longToByteArray(System.currentTimeMillis()) : null; - - SignonExchangeAttributeReq attrReq = new SignonExchangeAttributeReq(clientSeed_); - if (Trace.traceOn_) attrReq.setConnectionID(connectionID); - attrReq.write(outStream); - - SignonExchangeAttributeRep attrRep = new SignonExchangeAttributeRep(); - if (Trace.traceOn_) attrRep.setConnectionID(connectionID); - attrRep.read(inStream); - - if (attrRep.getRC() != 0) - { - // Connect failed, throw exception. - byte[] rcBytes = new byte[4]; - BinaryConverter.intToByteArray(attrRep.getRC(), rcBytes, 0); - Trace.log(Trace.ERROR, "Signon server exchange client/server attributes failed, return code:", rcBytes); - throw AS400ImplRemote.returnSecurityException(attrRep.getRC()); - } - - version_ = new ServerVersion(attrRep.getServerVersion()); - serverLevel_ = attrRep.getServerLevel(); - passwordType_ = attrRep.getPasswordLevel(); - isPasswordTypeSet_ = true; - serverSeed_ = attrRep.getServerSeed(); - signonJobBytes_ = attrRep.getJobNameBytes(); - connectedSuccessfully = true; - - if (Trace.traceOn_) - { - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, " Client seed:", clientSeed_); - Trace.log(Trace.DIAGNOSTIC, " Server seed:", serverSeed_); - } - byte[] versionBytes = new byte[4]; - BinaryConverter.intToByteArray(version_.getVersionReleaseModification(), versionBytes, 0); - Trace.log(Trace.DIAGNOSTIC, " Server vrm:", versionBytes); - Trace.log(Trace.DIAGNOSTIC, " Server level: ", serverLevel_); - } - - fireConnectEvent(true, AS400.SIGNON); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Socket opened successfully."); - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Signon server exchange client/server attributes failed:", e); - throw e; - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, "Signon server exchange client/server attributes failed:", e); - throw e; - } - finally - { - if (!connectedSuccessfully) - { - // Ensure that the connection is not left in an inconsistent state, even if an Error or RuntimeException was thrown. - signonServer_.forceDisconnect(); - signonServer_ = null; - } - } - } - } - - // Disconnect from sign-on server. - private synchronized void signonDisconnect() - { - if (signonServer_ != null) - { - try - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending end job data stream to signon server..."); - SignonEndServerReq signonEnd = new SignonEndServerReq(); - signonServer_.send(signonEnd); - signonServer_.forceDisconnect(); - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Error sending end job data stream to signon server:", e); - } - signonServer_ = null; - fireConnectEvent(false, AS400.SIGNON); - } - } - - boolean swapTo(byte[] swapToPH, byte[] swapFromPH) throws AS400SecurityException, IOException - { - if (AS400.onAS400 && AS400.currentUserAvailable() && userId_.equals(CurrentUser.getUserID(AS400.nativeVRM.getVersionReleaseModification()))) return false; - - if (credVault_.isEmpty()) - { - Trace.log(Trace.ERROR, "Password is null."); - throw new AS400SecurityException(AS400SecurityException.PASSWORD_NOT_SET); - } - try - { - byte[] temp = credVault_.getClearCredential(); - // Screen out passwords that start with a star. - if (temp[0] == 0x00 && temp[1] == 0x2A) - { - Trace.log(Trace.ERROR, "Parameter 'password' begins with a '*' character."); - throw new AS400SecurityException(AS400SecurityException.SIGNON_CHAR_NOT_VALID); - } - AS400ImplNative.swapToNative(SignonConverter.stringToByteArray(userId_), temp, swapToPH, swapFromPH); - } - catch (NativeException e) - { - // Map native exception to AS400SecurityException. - throw mapNativeSecurityException(e); - } - return true; - } - - void swapBack(byte[] swapToPH, byte[] swapFromPH) throws AS400SecurityException, IOException - { - try - { - AS400ImplNative.swapBackNative(swapToPH, swapFromPH); - } - catch (NativeException e) - { - // Map native exception to AS400SecurityException. - throw mapNativeSecurityException(e); - } - } - - // Return a security exception based on the data received from the native method. - private AS400SecurityException mapNativeSecurityException(NativeException e) throws IOException - { - // Parse information from byte array. - String id = ConverterImplRemote.getConverter(37, this).byteArrayToString(e.data, 12, 7); - - if (id.equals("CPF2203") || id.equals("CPF2204")) - { - return new AS400SecurityException(AS400SecurityException.USERID_UNKNOWN); - } - if (id.equals("CPF22E3")) - { - return new AS400SecurityException(AS400SecurityException.USERID_DISABLE); - } - if (id.equals("CPF22E2") || id.equals("CPF22E5")) - { - return new AS400SecurityException(AS400SecurityException.PASSWORD_INCORRECT); - } - if (id.equals("CPF22E4")) - { - return new AS400SecurityException(AS400SecurityException.PASSWORD_EXPIRED); - } - return new AS400SecurityException(AS400SecurityException.SECURITY_GENERAL); - } - - // This method is to generate the password, the protected old password and the protected new password. This is used for change password. - // - // Note: All input strings are EBCDIC and maximum length of 10 bytes. They must be terminated with EBCDIC space character (0x40) if length is less than 10. - // - // input: - // userID: EBCDIC userID - // oldPassword: EBCDIC old password - // newPassword: EBCDIC new password - // sequence number: Host format 8-byte sequence number - // For example: sequence number "1" is { 0, 0, 0, 0, 0, 0, 0, 1 } - // clientSeed: Host format 8-byte random client seed number. - // hostSeed: Host format 8-byte random host seed number. - private static byte[] encryptNewPassword(byte[] userID, byte[] oldPwd, byte[] newPwd, byte[] protectedOldPwd, byte[] protectedNewPwd, byte[] clientSeed, byte[] serverSeed) - { - byte[] verifyToken = new byte[8]; - byte[] sequence = {0, 0, 0, 0, 0, 0, 0, 1}; - - // generate a token based on the old password - byte[] token = generateToken(userID, oldPwd); - - // generate the first password substitute - byte[] encryptedPassword = generatePasswordSubstitute(userID, token, verifyToken, sequence, clientSeed, serverSeed); - - // generate the proctected new password - - // generate the second password substitute - incrementString(sequence); - byte[] tempEncryptedPassword = generatePasswordSubstitute(userID, token, verifyToken, sequence, clientSeed, serverSeed); - - // exclusive or the first copy of the protected new password - // This is the first 8 bytes of the protected new password - xORArray(tempEncryptedPassword, newPwd, protectedNewPwd); - - // if the newPassword is more than 8 bytes generate the second 8 bytes of the protected new password - if (protectedNewPwd.length == 16) - { - byte[] secondNewPassword = new byte[8]; - // increment the sequence number for the next copy of the substitute - incrementString(sequence); - tempEncryptedPassword = generatePasswordSubstitute(userID, token, verifyToken, sequence, clientSeed, serverSeed); - - // left justify the 9 and 10 bytes of the new password - for (int i = 0; i < 8; i++) - { - secondNewPassword[i] = (byte)0x40; - } - secondNewPassword[0] = newPwd[8]; - secondNewPassword[1] = newPwd[9]; - - // second half of protected new password - byte[] temp = new byte[8]; - xORArray(tempEncryptedPassword, secondNewPassword, temp); - System.arraycopy(temp, 0, protectedNewPwd, 8, 8); - } - - // generate the protected old password - - // generate a token based on the old password - token = generateToken(userID, newPwd); - - // increment the sequence number for the first copy of the protected old password - incrementString(sequence); - - // generate the first copy of the protected new password - tempEncryptedPassword = generatePasswordSubstitute(userID, token, verifyToken, sequence, clientSeed, serverSeed); - // exclusive or the first copy of the protected old password - // This is the first 8 bytes of the protected old password - xORArray(tempEncryptedPassword, oldPwd, protectedOldPwd); - - // if the oldPassword is more than 8 bytes - // generate the second 8 bytes of the protected old password - if (protectedOldPwd.length == 16) - { - byte[] secondOldPassword = new byte[8]; - // increment the sequence number for the next copy of the substitute - incrementString(sequence); - - tempEncryptedPassword = generatePasswordSubstitute(userID, token, verifyToken, sequence, clientSeed, serverSeed); - - // left justify the 9 and 10 bytes of the old password - for (int i = 0; i < 8; i++) - { - secondOldPassword[i] = (byte)0x40; - } - secondOldPassword[0] = oldPwd[8]; - secondOldPassword[1] = oldPwd[9]; - - // second half of protected old password - byte[] temp = new byte[8]; - xORArray(tempEncryptedPassword, secondOldPassword, temp); - System.arraycopy(temp, 0, protectedOldPwd, 8, 8); - } - return encryptedPassword; - } - - private static byte[] encryptPassword(byte[] userID, byte[] pwd, byte[] clientSeed, byte[] serverSeed) - { - byte[] sequenceNumber = {0, 0, 0, 0, 0, 0, 0, 1}; - byte[] verifyToken = new byte[8]; - - byte[] token = generateToken(userID, pwd); - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "In encryptPassword, token: ", token); - } - - byte[] encryptedPassword = generatePasswordSubstitute(userID, token, verifyToken, sequenceNumber, clientSeed, serverSeed); - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "In encryptPassword, encryptedPassword: ", encryptedPassword); - } - return encryptedPassword; - } - - // void gen_pwd_sbs( byte[] user_id, - // byte[] password_token, - // byte[] password_substitute, - // byte[] pwdseq, - // byte[] rds, - // byte[] rdr) - // - // Note: rdr, rds and pwdseq are all members of the PWDSBS_SEEDS structure. - // - // Function: Generate password substitute. - // Perform steps 5 to 7 of the password substitute formula. - // Steps 1 to 4 were already performed by the generate password token routine. - // It also generate the password verifier. - // - // Passwor Substitute formula: - // (5) Increment PWSEQs and store it. - // - // (6) Add PWSEQs to RDr to get RDrSEQ. - // - // (7) PW_SUB = MAC:sub.DES:esub.( PW_TOKEN,(RDrSEQ,RDs,ID xor RDrSEQ)): - // - // LEGEND: - // PW User password - // XOR EXCLUSIVE OR - // ID User identifier - // ENC:sub.DES:esub Encipher using the Data Encryption Standard algorithm - // MAC:sub.DES:esub Generate a Message authentication code using DES - // RDs Random data sent to the partner LU on BIND - // RDr Random data received from the partner LU on BIND - // PWSEQs Sequence number for password substitution on the send side - // RDrSEQ The arithmetic sum of RDr and the current value of PWSEQs. - // DES Data Encryption Standard algorithm - // - // Note: The MAC(DES) function was implemented according to the description given in the MI functional reference for the CIPHER function. Under the section "Cipher Block Chaining". Basically what it says is that the MAC des use the DES algorithm to encrypt the first data block (8 bytes) the result is then exclusive ORed with the next data block and it become the data input for the DES algorithm. For subsequents blocks of data the same operation is repeated. - private static byte[] generatePasswordSubstitute(byte[] userID, byte[] token, byte[] password_verifier, byte[] sequenceNumber, byte[] clientSeed, byte[] serverSeed) - { - byte[] RDrSEQ = new byte[8]; - byte[] nextData = new byte[8]; - byte[] nextEncryptedData = new byte[8]; - - //first data or RDrSEQ = password sequence + host seed - addArray(sequenceNumber, serverSeed, RDrSEQ, 8); - - // first encrypted data = DES(token, first data) - nextEncryptedData = enc_des(token, RDrSEQ); - - // second data = first encrypted data ^ client seed - xORArray(nextEncryptedData, clientSeed, nextData); - - // second encrypted data (password verifier) = DES(token, second data) - nextEncryptedData = enc_des(token, nextData); - - // let's copy second encrypted password to password verifier. - // Don't know what it is yet but will ask Leonel. - System.arraycopy(nextEncryptedData, 0, password_verifier, 0, 8); - - // third data = RDrSEQ ^ first 8 bytes of userID - xORArray(userID, RDrSEQ, nextData); - - // third data ^= third data ^ second encrypted data - xORArray(nextData, nextEncryptedData, nextData); - - // third encrypted data = DES(token, third data) - nextEncryptedData = enc_des(token, nextData); - - // leftJustify the second 8 bytes of user ID - for (int i = 0; i < 8; i++) - { - nextData[i] = (byte)0x40; - } - - nextData[0] = userID[8]; - nextData[1] = userID[9]; - - // fourth data = second half of userID ^ RDrSEQ; - xORArray(RDrSEQ, nextData, nextData); - - // fourth data = third encrypted data ^ fourth data - xORArray(nextData, nextEncryptedData, nextData); - - // fourth encrypted data = DES(token, fourth data) - nextEncryptedData = enc_des(token, nextData); - - // fifth data = fourth encrypted data ^ sequence number - xORArray(sequenceNumber, nextEncryptedData, nextData); - - // fifth encrypted data = DES(token, fifth data) this is the encrypted password - return enc_des(token, nextData); - } - - // userID and password are in EBCDIC - // userID and password are terminated with 0x40 (EBCDIC blank) - private static byte[] generateToken(byte[] userID, byte[] password) - { - byte[] token = new byte[8]; - byte[] workBuffer1 = new byte[10]; - byte[] workBuffer2 = { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - byte[] workBuffer3 = { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - - // Copy user ID into the work buffer. - System.arraycopy(userID, 0, workBuffer1, 0, 10); - - // Find userID length. - int length = ebcdicStrLen(userID, 10); - - if (length > 8) - { - // Fold user ID. - workBuffer1[0] ^= (workBuffer1[8] & 0xC0); - workBuffer1[1] ^= (workBuffer1[8] & 0x30) << 2; - workBuffer1[2] ^= (workBuffer1[8] & 0x0C) << 4; - workBuffer1[3] ^= (workBuffer1[8] & 0x03) << 6; - workBuffer1[4] ^= (workBuffer1[9] & 0xC0); - workBuffer1[5] ^= (workBuffer1[9] & 0x30) << 2; - workBuffer1[6] ^= (workBuffer1[9] & 0x0C) << 4; - workBuffer1[7] ^= (workBuffer1[9] & 0x03) << 6; - } - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "In generateToken, folded user ID:", workBuffer1); - } - - // work with password - length = ebcdicStrLen(password, 10); - - // if password is more than 8 characters long - if (length > 8) - { - // copy the first 8 bytes of password to workBuffer2 - System.arraycopy(password, 0, workBuffer2, 0, 8); - - // copy the remaining password to workBuffer3 - System.arraycopy(password, 8, workBuffer3, 0, length-8); - - // generate the token for the first 8 bytes of password - xorWith0x55andLshift(workBuffer2); - - workBuffer2 = // first token - enc_des(workBuffer2, // shifted result - workBuffer1); // userID - - // generate the token for the second 8 bytes of password - xorWith0x55andLshift(workBuffer3); - - workBuffer3 = // second token - enc_des(workBuffer3, // shifted result - workBuffer1); // userID - - // exclusive-or the first and second token to get the real token - xORArray(workBuffer2, workBuffer3, token); - } - else - { - // copy password to work buffer - System.arraycopy(password, 0, workBuffer2, 0, length); - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "In generateToken, workBuffer2: ", workBuffer2); - } - - // generate the token for 8 byte userID - xorWith0x55andLshift(workBuffer2); - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "In generateToken, workBuffer2: ", workBuffer2); - } - - token = // token - enc_des(workBuffer2, // shifted result - workBuffer1); // userID - } - return token; - } - - // Add two byte arrays. - private static void addArray(byte[] array1, byte[] array2, byte[] result, int length) - { - int carryBit = 0; - for (int i = length - 1; i >= 0; i--) - { - int temp = (array1[i] & 0xff) + (array2[i] & 0xff) + carryBit; - carryBit = temp >>> 8; - result[i] = (byte)temp; - } - } - - private static int ebcdicStrLen(byte[] string, int maxLength) - { - int i = 0; - while ((i < maxLength) && (string[i] != 0x40) && (string[i] != 0)) ++i; - return i; - } - - // increment host format 8-byte number - private static void incrementString(byte[] string) - { - byte[] one = { 0, 0, 0, 0, 0, 0, 0, 1 }; - - addArray(string, one, string, 8); - } - - private static void xORArray(byte[] string1, byte[] string2, byte[] string3) - { - for (int i = 0; i < 8; i++) - { - string3[i] = (byte)(string1[i] ^ string2[i]); - } - } - - private static void xorWith0x55andLshift(byte[] bytes) - { - bytes[0] ^= 0x55; - bytes[1] ^= 0x55; - bytes[2] ^= 0x55; - bytes[3] ^= 0x55; - bytes[4] ^= 0x55; - bytes[5] ^= 0x55; - bytes[6] ^= 0x55; - bytes[7] ^= 0x55; - - bytes[0] = (byte)(bytes[0] << 1 | (bytes[1] & 0x80) >>> 7); - bytes[1] = (byte)(bytes[1] << 1 | (bytes[2] & 0x80) >>> 7); - bytes[2] = (byte)(bytes[2] << 1 | (bytes[3] & 0x80) >>> 7); - bytes[3] = (byte)(bytes[3] << 1 | (bytes[4] & 0x80) >>> 7); - bytes[4] = (byte)(bytes[4] << 1 | (bytes[5] & 0x80) >>> 7); - bytes[5] = (byte)(bytes[5] << 1 | (bytes[6] & 0x80) >>> 7); - bytes[6] = (byte)(bytes[6] << 1 | (bytes[7] & 0x80) >>> 7); - bytes[7] <<= 1; - } - - // the E function used in the cipher function - private static final int[] EPERM = - { - 32, 1, 2, 3, 4, 5, - 4, 5, 6, 7, 8, 9, - 8, 9, 10, 11, 12, 13, - 12, 13, 14, 15, 16, 17, - 16, 17, 18, 19, 20, 21, - 20, 21, 22, 23, 24, 25, - 24, 25, 26, 27, 28, 29, - 28, 29, 30, 31, 32, 1 - }; - - // the initial scrambling of the input data - private static final int[] INITPERM = - { - 58, 50, 42, 34, 26, 18, 10, 2, - 60, 52, 44, 36, 28, 20, 12, 4, - 62, 54, 46, 38, 30, 22, 14, 6, - 64, 56, 48, 40, 32, 24, 16, 8, - 57, 49, 41, 33, 25, 17, 9, 1, - 59, 51, 43, 35, 27, 19, 11, 3, - 61, 53, 45, 37, 29, 21, 13, 5, - 63, 55, 47, 39, 31, 23, 15, 7 - }; - - // the inverse permutation of initperm - used on the proutput block - private static final int[] OUTPERM = - { - 40, 8, 48, 16, 56, 24, 64, 32, - 39, 7, 47, 15, 55, 23, 63, 31, - 38, 6, 46, 14, 54, 22, 62, 30, - 37, 5, 45, 13, 53, 21, 61, 29, - 36, 4, 44, 12, 52, 20, 60, 28, - 35, 3, 43, 11, 51, 19, 59, 27, - 34, 2, 42, 10, 50, 18, 58, 26, - 33, 1, 41, 9, 49, 17, 57, 25 - }; - - // the P function used in cipher function - private static final int[] PPERM = - { - 16, 7, 20, 21, - 29, 12, 28, 17, - 1, 15, 23, 26, - 5, 18, 31, 10, - 2, 8, 24, 14, - 32, 27, 3, 9, - 19, 13, 30, 6, - 22, 11, 4, 25 - }; - - private static final int[] PC1 = // Permuted Choice 1 - { // get the 56 bits which make up C0 and D0 (combined into Cn) from the original key - 57, 49, 41, 33, 25, 17, 9, - 1, 58, 50, 42, 34, 26, 18, - 10, 2, 59, 51, 43, 35, 27, - 19, 11, 3, 60, 52, 44, 36, - 63, 55, 47, 39, 31, 23, 15, - 7, 62, 54, 46, 38, 30, 22, - 14, 6, 61, 53, 45, 37, 29, - 21, 13, 5, 28, 20, 12, 4 - }; - - private static final int[] PC2 = // Permuted Choice 2 - { // used in generation of the 16 subkeys - 14, 17, 11, 24, 1, 5, - 3, 28, 15, 6, 21, 10, - 23, 19, 12, 4, 26, 8, - 16, 7, 27, 20, 13, 2, - 41, 52, 31, 37, 47, 55, - 30, 40, 51, 45, 33, 48, - 44, 49, 39, 56, 34, 53, - 46, 42, 50, 36, 29, 32 - }; - - private static final int[] S1 = - { - 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7, - 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8, - 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0, - 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13 - }; - - private static final int[] S2 = - { - 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10, - 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5, - 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15, - 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9 - }; - - private static final int[] S3 = - { - 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8, - 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1, - 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7, - 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12 - }; - - private static final int[] S4 = - { - 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15, - 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9, - 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4, - 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14 - }; - - private static final int[] S5 = - { - 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9, - 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6, - 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14, - 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3 - }; - - private static final int[] S6 = - { - 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11, - 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8, - 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6, - 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13 - }; - - private static final int[] S7 = - { - 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1, - 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6, - 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2, - 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12 - }; - - private static final int[] S8 = - { - 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7, - 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2, - 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8, - 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11 - }; - - // Name: enc_des - Encrypt function front interface - // - // Function: This function is the interface to the DES encryption routine - // It converts the parameters to a format expected by the actual DES encryption routine. - // - // Input: 8 byte data to encrypt - // 8 byte key to encrypt - // - // Output: 8 byte encrypted data passed parameter - // - //*************************************************************************** - // - // enc_des(byte[] data, byte[] key, byte[] enc_data) - // { - // Copy the passed parameters to local variables so we can have 9 bytes variables. - // Expand the key and data variables so we will have one byte representing one bit of the input data. - // Perform the actual encryption of the input data using the 64 bytes variable according with the DES algorithm. - // Compress back the result of the encryption to return the 8 bytes data encryption result. - // } - - private static byte[] enc_des(byte[] key, byte[] data) - { - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "In enc_des, key: ", key); - Trace.log(Trace.DIAGNOSTIC, "In enc_des, data: ", data); - } - // expend strings, 1 bit per byte, 1 char in 8 bytes - byte[] e1 = new byte[65]; - byte[] e2 = new byte[65]; - - // input strings, 1 character per byte password user id to be used as key encrypted data - - - // expand the input string to 1 bit per byte again for the key - for (int i = 0; i < 8; ++i) - { - e1[8 * i + 1] = (byte)(((data[i] & 0x80) == 0) ? 0x30 : 0x31); - e1[8 * i + 2] = (byte)(((data[i] & 0x40) == 0) ? 0x30 : 0x31); - e1[8 * i + 3] = (byte)(((data[i] & 0x20) == 0) ? 0x30 : 0x31); - e1[8 * i + 4] = (byte)(((data[i] & 0x10) == 0) ? 0x30 : 0x31); - e1[8 * i + 5] = (byte)(((data[i] & 0x08) == 0) ? 0x30 : 0x31); - e1[8 * i + 6] = (byte)(((data[i] & 0x04) == 0) ? 0x30 : 0x31); - e1[8 * i + 7] = (byte)(((data[i] & 0x02) == 0) ? 0x30 : 0x31); - e1[8 * i + 8] = (byte)(((data[i] & 0x01) == 0) ? 0x30 : 0x31); - } - - for (int i = 0; i < 8; ++i) - { - e2[8 * i + 1] = (byte)(((key[i] & 0x80) == 0) ? 0x30 : 0x31); - e2[8 * i + 2] = (byte)(((key[i] & 0x40) == 0) ? 0x30 : 0x31); - e2[8 * i + 3] = (byte)(((key[i] & 0x20) == 0) ? 0x30 : 0x31); - e2[8 * i + 4] = (byte)(((key[i] & 0x10) == 0) ? 0x30 : 0x31); - e2[8 * i + 5] = (byte)(((key[i] & 0x08) == 0) ? 0x30 : 0x31); - e2[8 * i + 6] = (byte)(((key[i] & 0x04) == 0) ? 0x30 : 0x31); - e2[8 * i + 7] = (byte)(((key[i] & 0x02) == 0) ? 0x30 : 0x31); - e2[8 * i + 8] = (byte)(((key[i] & 0x01) == 0) ? 0x30 : 0x31); - } - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "In enc_des, e1: ", e1); - Trace.log(Trace.DIAGNOSTIC, "In enc_des, e2: ", e2); - } - - // encryption method - byte[] preout = new byte[65]; // preoutput block - - // generate keys 1 - 16 - - // temp key gen workspace - byte[] Cn = new byte[58]; - // create Cn from the original key - for (int n = 1; n <= 56; n++) - { - Cn[n] = e2[PC1[n-1]]; - } - - // rotate Cn to form C1 (still called Cn...) - lshift1(Cn); - - byte[] key1 = new byte[49]; // 48 bit key 1 to key 16 - // now Cn[] contains 56 bits for input to PC2 to generate key1 - for (int n = 1; n <= 48; n++) - { - key1[n] = Cn[PC2[n-1]]; - } - - byte[] key2 = new byte[49]; - // now derive C2 from C1 (which is called Cn) - lshift1(Cn); - for (int n = 1; n <= 48; n++) - { - key2[n] = Cn[PC2[n-1]]; - } - - byte[] key3 = new byte[49]; - // now derive C3 from C2 by left shifting twice - lshift2(Cn); - for (int n = 1; n <= 48; n++) - { - key3[n] = Cn[PC2[n-1]]; - } - - byte[] key4 = new byte[49]; - // now derive C4 from C3 by again left shifting twice - lshift2(Cn); - for (int n = 1; n <= 48; n++) - { - key4[n] = Cn[PC2[n-1]]; - } - - byte[] key5 = new byte[49]; - // now derive C5 from C4 by again left shifting twice - lshift2(Cn); - for (int n = 1; n <= 48; n++) - { - key5[n] = Cn[PC2[n-1]]; - } - - byte[] key6 = new byte[49]; - // now derive C6 from C5 by again left shifting twice - lshift2(Cn); - for (int n = 1; n <= 48; n++) - { - key6[n] = Cn[PC2[n-1]]; - } - - byte[] key7 = new byte[49]; - // now derive C7 from C6 by again left shifting twice - lshift2(Cn); - for (int n = 1; n <= 48; n++) - { - key7[n] = Cn[PC2[n-1]]; - } - - byte[] key8 = new byte[49]; - // now derive C8 from C7 by again left shifting twice - lshift2(Cn); - for (int n = 1; n <= 48; n++) - { - key8[n] = Cn[PC2[n-1]]; - } - - byte[] key9 = new byte[49]; - // now derive C9 from C8 by shifting left once - lshift1(Cn); - for (int n = 1; n <= 48; n++) - { - key9[n] = Cn[PC2[n-1]]; - } - - byte[] key10 = new byte[49]; - // now derive C10 from C9 by again left shifting twice - lshift2(Cn); - for (int n = 1; n <= 48; n++) - { - key10[n] = Cn[PC2[n-1]]; - } - - byte[] key11 = new byte[49]; - // now derive C11 from C10 by again left shifting twice - lshift2(Cn); - for (int n = 1; n <= 48; n++) - { - key11[n] = Cn[PC2[n-1]]; - } - - byte[] key12 = new byte[49]; - // now derive C12 from C11 by again left shifting twice - lshift2(Cn); - for (int n = 1; n <= 48; n++) - { - key12[n] = Cn[PC2[n-1]]; - } - - byte[] key13 = new byte[49]; - // now derive C13 from C12 by again left shifting twice - lshift2(Cn); - for (int n = 1; n <= 48; n++) - { - key13[n] = Cn[PC2[n-1]]; - } - - byte[] key14 = new byte[49]; - // now derive C14 from C13 by again left shifting twice - lshift2(Cn); - for (int n = 1; n <= 48; n++) - { - key14[n] = Cn[PC2[n-1]]; - } - - byte[] key15 = new byte[49]; - // now derive C15 from C14 by again left shifting twice - lshift2(Cn); - for (int n = 1; n <= 48; n++) - { - key15[n] = Cn[PC2[n-1]]; - } - - byte[] key16 = new byte[49]; - // now derive C16 from C15 by again left shifting once - lshift1(Cn); - for (int n = 1; n <= 48; n++) - { - key16[n] = Cn[PC2[n-1]]; - } - - // temp encryption workspace - byte[] Ln = new byte[33]; - // ditto - byte[] Rn = new byte[33]; - - // perform the initial permutation and store the result in Ln and Rn - for (int n = 1; n <= 32; n++) - { - Ln[n] = e1[INITPERM[n-1]]; - Rn[n] = e1[INITPERM[n+31]]; - } - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "In enc_des, Ln: ", Ln); - Trace.log(Trace.DIAGNOSTIC, "In enc_des, Rn: ", Rn); - } - - // run cipher to get new Ln and Rn - cipher(key1, Ln, Rn); - cipher(key2, Ln, Rn); - cipher(key3, Ln, Rn); - cipher(key4, Ln, Rn); - cipher(key5, Ln, Rn); - cipher(key6, Ln, Rn); - cipher(key7, Ln, Rn); - cipher(key8, Ln, Rn); - cipher(key9, Ln, Rn); - cipher(key10, Ln, Rn); - cipher(key11, Ln, Rn); - cipher(key12, Ln, Rn); - cipher(key13, Ln, Rn); - cipher(key14, Ln, Rn); - cipher(key15, Ln, Rn); - cipher(key16, Ln, Rn); - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "In enc_des, Ln: ", Ln); - Trace.log(Trace.DIAGNOSTIC, "In enc_des, Rn: ", Rn); - } - - // Ln and Rn are now at L16 and R16 - create preout[] by interposing them - System.arraycopy(Rn, 1, preout, 1, 32); - System.arraycopy(Ln, 1, preout, 33, 32); - - byte[] e3 = new byte[65]; - // run preout[] through outperm to get ciphertext - for (int n = 1; n <= 64; n++) - { - e3[n] = preout[OUTPERM[n-1]]; - } - - byte[] enc_data = new byte[8]; - // compress back to 8 bits per byte - for (int i = 0; i < 8; ++i) - { - if (e3[8 * i + 1] == 0x31) enc_data[i] |= 0x80; - if (e3[8 * i + 2] == 0x31) enc_data[i] |= 0x40; - if (e3[8 * i + 3] == 0x31) enc_data[i] |= 0x20; - if (e3[8 * i + 4] == 0x31) enc_data[i] |= 0x10; - if (e3[8 * i + 5] == 0x31) enc_data[i] |= 0x08; - if (e3[8 * i + 6] == 0x31) enc_data[i] |= 0x04; - if (e3[8 * i + 7] == 0x31) enc_data[i] |= 0x02; - if (e3[8 * i + 8] == 0x31) enc_data[i] |= 0x01; - } - return enc_data; - } - - private static void cipher(byte[] key, byte[] Ln, byte[] Rn) - { - byte[] temp1 = new byte[49]; // Rn run through E - byte[] temp2 = new byte[49]; // temp1 XORed with key - byte[] temp3 = new byte[33]; // temp2 run through S boxes - byte[] fkn = new byte[33]; // f(k,n) - int[] si = new int[9]; // decimal input to S boxes - int[] so = new int[9]; // decimal output from S boxes - - // generate temp1[] from Rn[] - for (int n = 1; n <= 48; n++) - { - temp1[n] = Rn[EPERM[n-1]]; - } - - // XOR temp1 with key to get temp2 - for (int n = 1; n <= 48; n++) - { - temp2[n] = (temp1[n] != key[n]) ? (byte)0x31 : (byte)0x30; - } - - // we need to get the explicit representation into a form for - // processing the s boxes... - si[1] = ((temp2[1] == 0x31) ? 0x0020 : 0x0000) | - ((temp2[6] == 0x31) ? 0x0010 : 0x0000) | - ((temp2[2] == 0x31) ? 0x0008 : 0x0000) | - ((temp2[3] == 0x31) ? 0x0004 : 0x0000) | - ((temp2[4] == 0x31) ? 0x0002 : 0x0000) | - ((temp2[5] == 0x31) ? 0x0001 : 0x0000); - - si[2] = ((temp2[7] == 0x31) ? 0x0020 : 0x0000) | - ((temp2[12] == 0x31) ? 0x0010 : 0x0000) | - ((temp2[8] == 0x31) ? 0x0008 : 0x0000) | - ((temp2[9] == 0x31) ? 0x0004 : 0x0000) | - ((temp2[10] == 0x31) ? 0x0002 : 0x0000) | - ((temp2[11] == 0x31) ? 0x0001 : 0x0000); - - si[3] = ((temp2[13] == 0x31) ? 0x0020 : 0x0000) | - ((temp2[18] == 0x31) ? 0x0010 : 0x0000) | - ((temp2[14] == 0x31) ? 0x0008 : 0x0000) | - ((temp2[15] == 0x31) ? 0x0004 : 0x0000) | - ((temp2[16] == 0x31) ? 0x0002 : 0x0000) | - ((temp2[17] == 0x31) ? 0x0001 : 0x0000); - - si[4] = ((temp2[19] == 0x31) ? 0x0020 : 0x0000) | - ((temp2[24] == 0x31) ? 0x0010 : 0x0000) | - ((temp2[20] == 0x31) ? 0x0008 : 0x0000) | - ((temp2[21] == 0x31) ? 0x0004 : 0x0000) | - ((temp2[22] == 0x31) ? 0x0002 : 0x0000) | - ((temp2[23] == 0x31) ? 0x0001 : 0x0000); - - si[5] = ((temp2[25] == 0x31) ? 0x0020 : 0x0000) | - ((temp2[30] == 0x31) ? 0x0010 : 0x0000) | - ((temp2[26] == 0x31) ? 0x0008 : 0x0000) | - ((temp2[27] == 0x31) ? 0x0004 : 0x0000) | - ((temp2[28] == 0x31) ? 0x0002 : 0x0000) | - ((temp2[29] == 0x31) ? 0x0001 : 0x0000); - - si[6] = ((temp2[31] == 0x31) ? 0x0020 : 0x0000) | - ((temp2[36] == 0x31) ? 0x0010 : 0x0000) | - ((temp2[32] == 0x31) ? 0x0008 : 0x0000) | - ((temp2[33] == 0x31) ? 0x0004 : 0x0000) | - ((temp2[34] == 0x31) ? 0x0002 : 0x0000) | - ((temp2[35] == 0x31) ? 0x0001 : 0x0000); - - si[7] = ((temp2[37] == 0x31) ? 0x0020 : 0x0000) | - ((temp2[42] == 0x31) ? 0x0010 : 0x0000) | - ((temp2[38] == 0x31) ? 0x0008 : 0x0000) | - ((temp2[39] == 0x31) ? 0x0004 : 0x0000) | - ((temp2[40] == 0x31) ? 0x0002 : 0x0000) | - ((temp2[41] == 0x31) ? 0x0001 : 0x0000); - - si[8] = ((temp2[43] == 0x31) ? 0x0020 : 0x0000) | - ((temp2[48] == 0x31) ? 0x0010 : 0x0000) | - ((temp2[44] == 0x31) ? 0x0008 : 0x0000) | - ((temp2[45] == 0x31) ? 0x0004 : 0x0000) | - ((temp2[46] == 0x31) ? 0x0002 : 0x0000) | - ((temp2[47] == 0x31) ? 0x0001 : 0x0000); - - // Now for the S boxes - so[1] = S1[si[1]]; - so[2] = S2[si[2]]; - so[3] = S3[si[3]]; - so[4] = S4[si[4]]; - so[5] = S5[si[5]]; - so[6] = S6[si[6]]; - so[7] = S7[si[7]]; - so[8] = S8[si[8]]; - - // That wasn't too bad. Now to convert decimal to char hex again so[1-8] must be translated to 32 bits and stored in temp3[1-32] - dectobin(so[1], temp3, 1); - dectobin(so[2], temp3, 5); - dectobin(so[3], temp3, 9); - dectobin(so[4], temp3, 13); - dectobin(so[5], temp3, 17); - dectobin(so[6], temp3, 21); - dectobin(so[7], temp3, 25); - dectobin(so[8], temp3, 29); - - // Okay. Now temp3[] contains the data to run through P - for (int n = 1; n <= 32; n++) - { - fkn[n] = temp3[PPERM[n-1]]; - } - - // now complete the cipher function to update Ln and Rn - byte[] temp = new byte[33]; // storage for Ln during cipher function - System.arraycopy(Rn, 1, temp, 1, 32); - for (int n = 1; n <= 32; n++) - { - Rn[n] = (Ln[n] == fkn[n]) ? (byte)0x30:(byte)0x31; - } - System.arraycopy(temp, 1, Ln, 1, 32); - } - - // Start of decimal to binary routine - //**************************************************************************** - // convert decimal number to four ones and zeros in store - // them in the input string - private static void dectobin(int value, byte[] string, int offset) - { - string[offset] = (byte)(((value & 0x0008) != 0) ? 0x31 : 0x30); - string[offset+1] = (byte)(((value & 0x0004) != 0) ? 0x31 : 0x30); - string[offset+2] = (byte)(((value & 0x0002) != 0) ? 0x31 : 0x30); - string[offset+3] = (byte)(((value & 0x0001) != 0) ? 0x31 : 0x30); - } - - private static void lshift1(byte[] Cn) - { - byte[] hold = new byte[2]; - - // get the two rotated bits - hold[0] = Cn[1]; - hold[1] = Cn[29]; - - // shift each position left in two 28 bit group correspondimg to Cn and Dn - System.arraycopy(Cn, 2, Cn, 1, 27); - System.arraycopy(Cn, 30, Cn, 29, 27); - - // restore the first bit of each subgroup - Cn[28] = hold[0]; - Cn[56] = hold[1]; - } - - private static void lshift2(byte[] Cn) - { - byte[] hold = new byte[4]; - - hold[0] = Cn[1]; // get the four rotated bits - hold[1] = Cn[2]; - hold[2] = Cn[29]; - hold[3] = Cn[30]; - - // shift each position left in two 28 bit groups corresponding to Cn and Dn - System.arraycopy(Cn, 3, Cn, 1, 27); - System.arraycopy(Cn, 31, Cn, 29, 27); - - // restore the first bit of each subgroup - Cn[27] = hold[0]; - Cn[28] = hold[1]; - Cn[55] = hold[2]; - Cn[56] = hold[3]; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCArray.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCArray.java deleted file mode 100644 index 7fce7bb4f..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCArray.java +++ /dev/null @@ -1,479 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -//JTOpen (IBM Toolbox for Java - OSS version) -// -//Filename: AS400JDBCArray.java -// -//The source code contained herein is licensed under the IBM Public License -//Version 1.0, which has been approved by the Open Source Initiative. -//Copyright (C) 2009-2009 International Business Machines Corporation and -//others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.access; - -import java.sql.Array; -import java.sql.ResultSet; -import java.sql.SQLException; - - -// @array new class -/** AS400JDBCArray is an implementation of java.sql.Array and contains an array of JDBC data. - * It provides mapping in the Java programming language for the SQL type ARRAY. - * Currently AS400JDBCArray is only supported by using stored procedure input/output parameters. - */ - -public class AS400JDBCArray implements Array -{ - - - private Object[] data_; //!!!Note this array may hold generic data such as Integers, or may hold special "output" - //data in form of SQLData objects. This is needed for managing efficient ArrayResultSet - //data conversion. But we don't want a user generated AS400JDBCArray (via Connection create method) - //to contain SQLData[] since at that point in time, we don't really know the prepare/describe data - //attributes. And then we would have to convert data twice, once in AS400JDBCArray and once in SQLArray. - - private String typeName_; //typename is supplied by user at creation or from hostserver prepare/describe - //protected int type_; - private int vrm_; - private AS400JDBCConnection con_; - - // This is just a reference to the SQLData type that this array contains. It is not a reflection from a prepare/describe, but is - //just used for any potential temporary conversion needed before final conversion before setting in actual PreparedStatement going to hostserver (ie Array.getResultSet() -> ars.getString(1)) - private SQLData contentTemplate_; - - - //if data_[0] contains an SQLData, then contentTemplate_ will point to it! - private boolean isSQLData_ = false; //true if data[0]_ == SQLData - - - AS400JDBCArray(){} //restrict - - - /** - Constructs an AS400JDBCArray object. - @param typeName The typeName. - @param data The data. - @param vrm The version. - @param con Connection. - **/ - AS400JDBCArray(String typeName, Object[] data, int vrm, AS400JDBCConnection con) throws SQLException - { - /* - * typeName is used to create a dummy SQLData object used for potential data conversion when data[] is not of type SQLData[]. - * Pass in a connection if the Object[] data is not SQLData. This will use connection's default conversion data. - * Throws exception if typeName is not valid per SQLDataFactory. - */ - - typeName_ = typeName; - vrm_ = vrm; - - //here, we allow null array, or array[0] or array[x] of null elements - //we will not interpret array[0] as a null array.(at least for now) - //if null, then create a 0 length array and set flag. This avoids messy code. - if(data == null) - { - data_ = new Object[0]; - - } - else - data_ = data; //Note that data_ is array of Objects. When array is output then data_ will actually be an array of SQLData[] (needed for conversion) - - //check if array of SQLData - //since values can be null, don't check if data_[0] is instance of SQLData - if(data_ instanceof SQLData[]) - isSQLData_ = true; - else - { - //in this case, we will create our own temporary SQLData object used for potential conversion in AS400JDBCArrayResultSet - isSQLData_ = false; - } - - con_ = con; //@arrayrs - - if(data_.length > 0 && isSQLData_ && data_[0] != null) //@nullelem - contentTemplate_ = (SQLData)data_[0]; - else - contentTemplate_ = SQLDataFactory.newData(typeName, 1, 1, 1, 37, null, vrm_, (con == null ? null: con.getProperties())); //@array - //allow max for local conversion only since it is not associated with a column on hostserver yet - } - - - - /** - This method will free the internal memory that this object holds. - **/ - synchronized public void free () throws SQLException - { - //na no locators can be in arrays. - } - - - /** - * Retrieves the SQL type name of the elements in the array designated by - * this Array object. If the elements are a built-in type, it - * returns the database-specific type name of the elements. If the elements - * are a user-defined type (UDT), this method returns the fully-qualified - * SQL type name. - * - * @return database-specific name for a - * built-in base type; or the fully-qualified SQL type name for a - * base type that is a UDT - * @exception SQLException - * if an error occurs while attempting to access the type - * name - * - */ - public String getBaseTypeName() throws SQLException - { - return typeName_; - } - - /** - * Retrieves the JDBC type of the elements in the array designated by this - * Array object. - * - * @return a constant from the class {@link java.sql.Types} that is the type - * code for the elements in the array designated by this - * Array object - * @exception SQLException - * if an error occurs while attempting to access the base - * type - * - */ - public int getBaseType() throws SQLException - { - - return contentTemplate_.getType(); - - } - - /** - * Retrieves the contents of the SQL ARRAY value designated - * by this Array object in the form of an array in the Java - * programming language. This version of the method getArray - * uses the type map associated with the connection for customizations of - * the type mappings. - * - * @return an array in the Java programming language that contains the - * ordered elements of the SQL ARRAY value designated - * by this Array object - * @exception SQLException - * if an error occurs while attempting to access the array - * - */ - synchronized public Object getArray() throws SQLException - { - //data could be sqlData if output from query or input Ojbects such as Integer or Clob - - return getArrayX(1, data_.length); - } - - /** - * Retrieves a slice of the SQL ARRAY value designated by - * this Array object, beginning with the specified - * index and containing up to count successive - * elements of the SQL array. This method uses the type map associated with - * the connection for customizations of the type mappings. - * - * @param index - * the array index of the first element to retrieve; the first - * element is at index 1 - * @param count - * the number of successive SQL array elements to retrieve - * @return an array containing up to count consecutive - * elements of the SQL array, beginning with element - * index - * @exception SQLException - * if an error occurs while attempting to access the array - */ - synchronized public Object getArray(long index, int count) - throws SQLException - { - - if ((index <= 0) || (count < 0) || (index > data_.length) - || ((index + count) > (data_.length + 1))) - JDError.throwSQLException(JDError.EXC_BUFFER_LENGTH_INVALID); - - return getArrayX(index, count); - } - - /** - * Retrieves Array ResultSet that contains the elements of the SQL - * ARRAY value designated by this Array - * object. - * The result set contains one row for each array element, with two columns - * in each row. The second column stores the element value; the first column - * stores the index into the array for that element (with the first array - * element being at index 1). The rows are in ascending order corresponding - * to the order of the indices. - * - * @return an Array ResultSet object containing one row for each of the - * elements in the array designated by this Array - * object, with the rows in ascending order based on the indices. - * @exception SQLException - * if an error occurs while attempting to access the array - */ - synchronized public ResultSet getResultSet() - throws SQLException - { - - - AS400JDBCArrayResultSet rs = new AS400JDBCArrayResultSet(data_, contentTemplate_, isSQLData_, getBaseType(), vrm_, con_); - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "getResultSet"); - return rs; - } - - /** - * Retrieves a result set holding the elements of the subarray that starts - * at index index and contains up to count - * successive elements. This method uses the connection's type map to map - * the elements of the array if the map contains an entry for the base type. - * Otherwise, the standard mapping is used. - *

        - * The result set has one row for each element of the SQL array designated - * by this object, with the first row containing the element at index - * index. The result set has up to count rows - * in ascending order based on the indices. Each row has two columns: The - * second column stores the element value; the first column stores the index - * into the array for that element. - * - * @param index - * the array index of the first element to retrieve; the first - * element is at index 1 - * @param count - * the number of successive SQL array elements to retrieve - * @return a ResultSet object containing up to - * count consecutive elements of the SQL array - * designated by this Array object, starting at index - * index. - * @exception SQLException - * if an error occurs while attempting to access the array - * - */ - synchronized public ResultSet getResultSet(long index, int count) - throws SQLException - { - - - int intIndex = (int)index - 1; //make 0 based - Object[] retArry = new Object[count]; //!!!!here also - - if( data_.length > 0 ) - { - - for(int x = 0 ; x < count; x++) - { - retArry[x] = data_[x + intIndex]; //just return values that were set by user with no conversion - } - } - else - { - retArry = data_; //length 0 or null value - } - - - AS400JDBCArrayResultSet rs = new AS400JDBCArrayResultSet(retArry, contentTemplate_, isSQLData_, getBaseType(), vrm_, con_); - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "getResultSet"); - return rs; - } - - /** - * Retrieves a result set that contains the elements of the SQL - * ARRAY value designated by this Array - * object. This method uses the specified map for type map - * customizations unless the base type of the array does not match a - * user-defined type in map, in which case it uses the - * standard mapping. This version of the method getResultSet - * uses either the given type map or the standard mapping; it never uses the - * type map associated with the connection. - *

        - * The result set contains one row for each array element, with two columns - * in each row. The second column stores the element value; the first column - * stores the index into the array for that element (with the first array - * element being at index 1). The rows are in ascending order corresponding - * to the order of the indices. - * - * @param map - * contains the mapping of SQL user-defined types to classes in - * the Java programming language - * @return a ResultSet object containing one row for each of - * the elements in the array designated by this Array - * object, with the rows in ascending order based on the indices. - * @exception SQLException - * if an error occurs while attempting to access the array - * - */ - synchronized public Object getArray(java.util.Map map) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - /** - * Retreives a slice of the SQL ARRAY value designated by - * this Array object, beginning with the specified - * index and containing up to count successive - * elements of the SQL array. - *

        - * This method uses the specified map for type map - * customizations unless the base type of the array does not match a - * user-defined type in map, in which case it uses the - * standard mapping. This version of the method getArray uses - * either the given type map or the standard mapping; it never uses the type - * map associated with the connection. - * - * @param index - * the array index of the first element to retrieve; the first - * element is at index 1 - * @param count - * the number of successive SQL array elements to retrieve - * @param map - * a java.util.Map object that contains SQL type - * names and the classes in the Java programming language to - * which they are mapped - * @return an array containing up to count consecutive - * elements of the SQL ARRAY value designated by this - * Array object, beginning with element - * index - * @exception SQLException - * if an error occurs while attempting to access the array - * - */ - synchronized public Object getArray(long index, int count, java.util.Map map) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - /** - * Retrieves a result set that contains the elements of the SQL - * ARRAY value designated by this Array - * object. This method uses the specified map for type map - * customizations unless the base type of the array does not match a - * user-defined type in map, in which case it uses the - * standard mapping. This version of the method getResultSet - * uses either the given type map or the standard mapping; it never uses the - * type map associated with the connection. - *

        - * The result set contains one row for each array element, with two columns - * in each row. The second column stores the element value; the first column - * stores the index into the array for that element (with the first array - * element being at index 1). The rows are in ascending order corresponding - * to the order of the indices. - * - * @param map - * contains the mapping of SQL user-defined types to classes in - * the Java programming language - * @return a ResultSet object containing one row for each of - * the elements in the array designated by this Array - * object, with the rows in ascending order based on the indices. - * @exception SQLException - * if an error occurs while attempting to access the array - * - */ - synchronized public ResultSet getResultSet(java.util.Map map) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - /** - * Retrieves a result set holding the elements of the subarray that starts - * at index index and contains up to count - * successive elements. This method uses the specified map - * for type map customizations unless the base type of the array does not - * match a user-defined type in map, in which case it uses - * the standard mapping. This version of the method - * getResultSet uses either the given type map or the - * standard mapping; it never uses the type map associated with the - * connection. - *

        - * The result set has one row for each element of the SQL array designated - * by this object, with the first row containing the element at index - * index. The result set has up to count rows - * in ascending order based on the indices. Each row has two columns: The - * second column stores the element value; the first column stroes the index - * into the array for that element. - * - * @param index - * the array index of the first element to retrieve; the first - * element is at index 1 - * @param count - * the number of successive SQL array elements to retrieve - * @param map - * the Map object that contains the mapping of SQL - * type names to classes in the Java(tm) programming language - * @return a ResultSet object containing up to - * count consecutive elements of the SQL array - * designated by this Array object, starting at index - * index. - * @exception SQLException - * if an error occurs while attempting to access the array - * - */ - synchronized public ResultSet getResultSet(long index, int count, - java.util.Map map) throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - // --------------------jdbc internal methods----------------- - - - - /* Get part or all of array. index is 1-based. - * If array content is output from database, then convert data via getObject(). - */ - private Object getArrayX(long index, int count) throws SQLException - { - - - int intIndex = (int)index - 1; //make 0 based - if((data_.length >= 0) && isSQLData_) //@nullelem - { - - //create array of same type as data_ - Class dummySQLXType = null; //@nullelem - try{ - dummySQLXType = Class.forName( contentTemplate_.getJavaClassName()); //data_[0]).getObject(); //returns column's rs.getX() type (ie Integer, String, etc) //@nullelem - }catch( Exception e) - { - try{ - dummySQLXType = Class.forName("java.lang.Object"); - }catch(Exception ee){ - dummySQLXType = null; - } - } - Object retArry = java.lang.reflect.Array.newInstance (dummySQLXType, count); - for(int x = 0 ; x < count; x++) - { - if(data_[x + intIndex] != null) - ((Object[]) retArry)[x] = ((SQLData) data_[x + intIndex]).getObject(); //convert based on SQLData - else - ((Object[]) retArry)[x] = null; //@nullelem - } - return retArry; //returns array of types such as Ingeter[] etc - } - else if( (data_.length > 0) && !isSQLData_ ) - { - Object retArry = java.lang.reflect.Array.newInstance (data_.getClass().getComponentType(), count); //array of same type as user passed in - for(int x = 0 ; x < count; x++) - { - ((Object[]) retArry)[x] = data_[x + intIndex]; //just return values that were set by user with no conversion - } - return retArry; - } - else - { - return data_; //length 0 or null value - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCArrayResultSet.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCArrayResultSet.java deleted file mode 100644 index 1c6d38d44..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCArrayResultSet.java +++ /dev/null @@ -1,4229 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// - -//JTOpen (IBM Toolbox for Java - OSS version) - -//Filename: AS400JDBCArrayResultSet.java - -//The source code contained herein is licensed under the IBM Public License -//Version 1.0, which has been approved by the Open Source Initiative. -//Copyright (C) 2009-2009 International Business Machines Corporation and -//others. All rights reserved. - -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.access; - - -import java.net.MalformedURLException; -import java.sql.ResultSet; -import java.sql.SQLException; - -//@array new class -/** AS400JDBCArrayResultSet is a JDBC ResultSet that contains Array data. This is a client-side only object. This is used to navigating through - * returned data from IBM i DB2 using Toolbox JDBC. No updates will be functional nor will they be sent back to the host server. - * Note that this ResultSet is limited in its functionality since it is not tied back to a cursor in the database. - * Its primary purpose is for retrieving data back from the database. - **/ -public class AS400JDBCArrayResultSet -/* ifdef JDBC40 -extends ToolboxWrapper - endif */ -implements ResultSet -{ - - private int holdability_; // Used by JDBC 40 - private int concurrency_; - private int fetchDirection_; - private int fetchSize_; - private int type_; - /* same as in AS400JDBCArray, the data_ array contains either Objects or SQLData. If SQLData, then it will - * do any needed conversion between types. If the data is an Ojbect (like Integer), then we will not do any - * conversion. - */ - private Object[][] data_; // column based data. - private int numberOfColumns_; - private int numberOfRows_; - private java.util.HashMap columnNameToIndexCache_; - - - //////Info from AS400JDBCArray - - private SQLData contentTemplate_; - private boolean isSQLData_; - - private int vrm_; - AS400JDBCConnection con_; //future use - /////////////////// - - - private boolean openOnClient_; - private int currentRowInRowset_; - private int wasNull_; - - - private java.util.Calendar calendar_; - static final private int WAS_NULL_UNSET = 0; - static final private int WAS_NULL = 1; - static final private int WAS_NOT_NULL = 2; - - /** - Constructs an AS400JDBCArrayResultSet object. - - @param contents An java array of data. - @param contentTemplate An instance of SQLData child class. - @param isSQLData Specifies if contents array content is an SQLData subclass type. - @param dataType Data type. - @param vrm Version - @param con Connection. - **/ - AS400JDBCArrayResultSet ( Object[] contents , SQLData contentTemplate, boolean isSQLData, int dataType, int vrm, AS400JDBCConnection con) - { - Object[][] data = new Object[2][]; - // initialize "INDEX" column - if(isSQLData) - { - data[0] = new SQLInteger[contents.length]; //@arrayrs //since array data will be sqlX, then make the index sqlInteger also - for (int i = 0; i < contents.length; i++) - { - try{ - SQLInteger si = (SQLInteger)SQLDataFactory.newData("INTEGER", Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, 37, null, vrm_, null); - data[0][i] = si; - ((SQLInteger)data[0][i]).set(i + 1); - }catch(Exception e){ - //should neve happen - - } - } - }else - { - data[0] = new Integer[contents.length]; - for (int i = 0; i < contents.length; i++) - { - try{ - data[0][i] = new Integer(i + 1); - }catch(Exception e){ - //should neve happen - - } - } - } - // initialize "VALUE" column - data[1] = contents; - contentTemplate_ = contentTemplate; - isSQLData_ = isSQLData; - - vrm_ = vrm; - con_ = con; - - String[] columnNames = new String[] { "INDEX", "VALUE" }; - - init ( CONCUR_READ_ONLY, TYPE_SCROLL_INSENSITIVE, java.sql.ResultSet.FETCH_FORWARD, 1, data, columnNames); - } - - /** - This method initializes this object. - - @param concurrency The concurrency of the resultset. - @param type The resultset type. - @param fetchDirection The Direction of the resultset. - @param fetchSize Size of fetch. - @param data Array of data objects - @param columnNames Names of columns. - **/ - void init ( int concurrency, int type, int fetchDirection, int fetchSize, - Object[][] data, String[] columnNames) - { - holdability_ = java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT; - concurrency_ = concurrency; - fetchDirection_ = fetchDirection; - fetchSize_ = fetchSize; - type_ = type; //TYPE_SCROLL_INSENSITIVE - data_ = data; - numberOfColumns_ = data.length; - // if it's an empty result set, there will be zero columns - // and thus zero rows. - if (numberOfColumns_ > 0) numberOfRows_ = data[0].length; - - columnNameToIndexCache_ = new java.util.HashMap (); - for (int i = 0; i < columnNames.length; i++) - columnNameToIndexCache_.put (columnNames[i], new Integer (i + 1)); - - - openOnClient_ = true; - currentRowInRowset_ = -1; - - } - - /** - Closes this ResultSet - - @exception SQLException If an error occurs. - **/ - public void close () throws java.sql.SQLException - { - openOnClient_ = false; - } - - private java.util.Calendar getCalendar (java.util.TimeZone timeZone) - { - calendar_ = (calendar_ != null) ? calendar_ : new java.util.GregorianCalendar (); - calendar_.setTimeZone (timeZone); - return calendar_; - } - - private final void checkThatResultSetTypeIsScrollable () throws java.sql.SQLException - { - if (type_ == java.sql.ResultSet.TYPE_FORWARD_ONLY) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - // ---------------------- cursor position methods ---------------------- - - /** - Indicates if the cursor is positioned before the first row. - - @return true if the cursor is positioned before the first row; - false if the cursor is not positioned before the first - row or if the result set contains no rows. - - @exception SQLException If the result set is not open. - **/ - public boolean isBeforeFirst () throws java.sql.SQLException - { - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - boolean result = (currentRowInRowset_ == -1); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "isBeforeFirst"); - return result; - } - - /** - Indicates if the cursor is positioned after the last row. - - @return true if the cursor is positioned after the last row; - false if the cursor is not positioned after the last - row or if the result set contains no rows. - - @exception SQLException If the result set is not open. - **/ - public boolean isAfterLast () throws java.sql.SQLException - { - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - boolean result = (currentRowInRowset_ == numberOfRows_); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "isAfterLast"); - return result; - } - - /** - Indicates if the cursor is positioned on the first row. - - @return true if the cursor is positioned on the first row; - false if the cursor is not positioned on the first - row or the row number can not be determined. - - @exception SQLException If the result set is not open. - **/ - public boolean isFirst () throws java.sql.SQLException - { - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - boolean result = (currentRowInRowset_ == 0); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "isFirst"); - return result; - } - - /** - Indicates if the cursor is positioned on the last row. - - @return true if the cursor is positioned on the last row; - false if the cursor is not positioned on the last - row or the row number can not be determined. - - @exception SQLException If the result set is not open. - **/ - public boolean isLast () throws java.sql.SQLException - { - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - boolean result = (currentRowInRowset_ == (numberOfRows_ - 1)); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "isLast"); - return result; - } - - /** - Sets cursor position before the first row. - - @exception SQLException If the result set is not open. - **/ - public void beforeFirst () throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "beforeFirst"); - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - wasNull_ = WAS_NULL_UNSET; - currentRowInRowset_ = -1; - } - - /** - Positions the cursor after the last row. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public void afterLast () throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "afterLast"); - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - wasNull_ = WAS_NULL_UNSET; - currentRowInRowset_ = numberOfRows_; - } - - /** - Positions the cursor to the first row. - - @return true if the requested cursor position is - valid; false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public boolean first () throws java.sql.SQLException - { - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - wasNull_ = WAS_NULL_UNSET; - boolean isValidCursorPosition; - if (numberOfRows_ == 0) - isValidCursorPosition = false; - else { - isValidCursorPosition = true; - currentRowInRowset_ = 0; - } - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "first"); - return isValidCursorPosition; - } - - /** - Positions the cursor to the last row. - - @return true if the requested cursor position is - valid; false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public boolean last () throws java.sql.SQLException - { - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - wasNull_ = WAS_NULL_UNSET; - boolean isValidCursorPosition; - if (numberOfRows_ == 0) - isValidCursorPosition = false; - else { - isValidCursorPosition = true; - currentRowInRowset_ = numberOfRows_ - 1; - } - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "last"); - return isValidCursorPosition; - } - - /** - Positions the cursor to the previous row. - - @return true if the requested cursor position is - valid; false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public boolean previous () throws java.sql.SQLException - { - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - wasNull_ = WAS_NULL_UNSET; - boolean isValidCursorPosition; - currentRowInRowset_--; - if (currentRowInRowset_ >= 0) - isValidCursorPosition = true; - else { - isValidCursorPosition = false; - currentRowInRowset_ = -1; - } - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "previous"); - return isValidCursorPosition; - } - - /** - Positions the cursor to the next row. - - @return true if the requested cursor position is valid; false - if there are no more rows. - - @exception SQLException If the result set is not open, - or an error occurs. - **/ - public boolean next () throws java.sql.SQLException - { - checkForClosedResultSet (); - wasNull_ = WAS_NULL_UNSET; - boolean isValidCursorPosition; - currentRowInRowset_++; - if (currentRowInRowset_ <= (numberOfRows_ - 1)) - isValidCursorPosition = true; - else { - isValidCursorPosition = false; - currentRowInRowset_ = numberOfRows_; - } - if (!isValidCursorPosition && type_ == java.sql.ResultSet.TYPE_FORWARD_ONLY) - close (); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "next"); - return isValidCursorPosition; - } - - /** - Positions the cursor to an absolute row number. - - @param row The absolute row number. If the absolute row - number is positive, this positions the cursor - with respect to the beginning of the result set. - If the absolute row number is negative, this - positions the cursor with respect to the end - of result set. - @return true if the requested cursor position is - valid; false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - the row number is 0, - or an error occurs. - */ - public boolean absolute (int row) throws java.sql.SQLException - { - //if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "absolute " + row); - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - wasNull_ = WAS_NULL_UNSET; - boolean isValidCursorPosition; - - if (row >= 0) - currentRowInRowset_ = row - 1; - else - currentRowInRowset_ = row + numberOfRows_; - - if (currentRowInRowset_ >= 0 && currentRowInRowset_ <= (numberOfRows_ - 1)) - isValidCursorPosition = true; - else { - isValidCursorPosition = false; - if (currentRowInRowset_ < 0) - currentRowInRowset_ = -1; - else - currentRowInRowset_ = numberOfRows_; - } - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "absolute"); - return isValidCursorPosition; - } - - /** - Positions the cursor to a relative row number. - -

        Attempting to move beyond the first row positions the - cursor before the first row. Attempting to move beyond the last - row positions the cursor after the last row. - - @param rows The relative row number. If the relative row - number is positive, this positions the cursor - after the current position. If the relative - row number is negative, this positions the - cursor before the current position. If the - relative row number is 0, then the cursor - position does not change. - @return true if the requested cursor position is - valid, false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - the cursor is not positioned on a valid row, - or an error occurs. - */ - public boolean relative (int rows) throws java.sql.SQLException - { - //if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "relative", rows); - checkForClosedResultSet (); - checkThatResultSetTypeIsScrollable (); - wasNull_ = WAS_NULL_UNSET; - boolean isValidCursorPosition; - currentRowInRowset_ += rows; - - if (currentRowInRowset_ >= 0 && currentRowInRowset_ <= (numberOfRows_ - 1)) - isValidCursorPosition = true; - else { - isValidCursorPosition = false; - if (currentRowInRowset_ < 0) - currentRowInRowset_ = -1; - else - currentRowInRowset_ = numberOfRows_; - } - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "relative"); - return isValidCursorPosition; - } - - // ---------------------- state getter and setter methods ---------------------- - - /** - Returns the result set concurrency. - - @return The result set concurrency. Valid values are: -

          -
        • CONCUR_READ_ONLY -
        • CONCUR_UPDATABLE -
        - - - @exception SQLException If the result set is not open. - **/ - public int getConcurrency () throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getConcurrency"); - checkForClosedResultSet (); - return concurrency_; - } - - /** - Returns the result set type. - - @return The result set type. Valid values are: -
          -
        • TYPE_FORWARD_ONLY -
        • TYPE_SCROLL_INSENSITIVE -
        • TYPE_SCROLL_SENSITIVE -
        - - - @exception SQLException If the result set is not open. - **/ - public int getType () throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getType"); - checkForClosedResultSet (); - return type_; - } - - /** - Returns the fetch direction. - - @return The fetch direction. - Valid values are: -
          -
        • FETCH_FORWARD -
        • FETCH_REVERSE -
        • FETCH_UNKNOWN -
        - - @exception SQLException If the result is not open. - **/ - public int getFetchDirection () throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getFetchDirection"); - checkForClosedResultSet (); - return fetchDirection_; - } - - /** - Sets the direction in which the rows in a result set are - processed. - - @param direction The fetch direction for processing rows. - Valid values are: -
          -
        • FETCH_FORWARD -
        • FETCH_REVERSE -
        • FETCH_UNKNOWN -
        - The default is the statement's fetch - direction. - - @exception SQLException If the result set is not open, - the result set is scrollable - and the input value is not - ResultSet.FETCH_FORWARD, - or the input value is not valid. - **/ - public void setFetchDirection (int direction) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "setFetchDirection"); - checkForClosedResultSet (); - switch (direction) { - case java.sql.ResultSet.FETCH_FORWARD: - case java.sql.ResultSet.FETCH_REVERSE: - case java.sql.ResultSet.FETCH_UNKNOWN: - fetchDirection_ = direction; - break; - default: - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - } - - /** - Returns the fetch size. - - @return The fetch size. - - @exception SQLException If the result is not open. - **/ - public int getFetchSize () throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getFetchSize"); - checkForClosedResultSet (); - return fetchSize_; - } - - /** - Sets the number of rows to be fetched from the database when more - rows are needed. This may be changed at any time. If the value - specified is zero, then the driver will choose an appropriate - fetch size. - - - @param rows The number of rows. This must be greater than - or equal to 0 and less than or equal to the - maximum rows limit. The default is the - statement's fetch size. - - @exception SQLException If the result set is not open - or the input value is not valid. - **/ - public void setFetchSize (int rows) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "setFetchSize"); - checkForClosedResultSet (); - if (rows < 0) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - fetchSize_ = rows; - } - - /** - Returns the name of the SQL cursor in use by the result set. - - @return The cursor name. - - @exception SQLException If the result is not open. - **/ - public String getCursorName () throws java.sql.SQLException - { - String cursorName = null; - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getCursorName"); - checkForClosedResultSet (); - return cursorName; - } - - /** - Returns the ResultSetMetaData object that describes the - result set's columns. ResultSetMetadata on Array columns is not supported and the - getMetaData method will return null. - - @return The metadata object. - - @exception SQLException If an error occurs. - **/ - public java.sql.ResultSetMetaData getMetaData () throws java.sql.SQLException - { - java.sql.ResultSetMetaData metaData = null;//new AS400JDBCResultSetMetaData ("", 2, "", new JDSimpleRow(new String[0], new SQLData[0], new int[0]), null, null, null); //@arrmd - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getMetaData"); - checkForClosedResultSet (); - return metaData; - } - - /** - Returns the statement for this result set. - - @return The statement for this result set, or null if the - result set was returned by a DatabaseMetaData - catalog method. - - @exception SQLException If an error occurs. - **/ - public java.sql.Statement getStatement () throws java.sql.SQLException - { - java.sql.Statement statement = null; - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getStatement"); - checkForClosedResultSet (); - return statement; - } - - /** - Returns the first warning reported for the result set. - Subsequent warnings may be chained to this warning. - - @return The first warning or null if no warnings - have been reported. - - @exception SQLException If an error occurs. - **/ - public java.sql.SQLWarning getWarnings () throws java.sql.SQLException - { - java.sql.SQLWarning warnings = null; - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getWarnings"); - checkForClosedResultSet (); - return warnings; - } - - /** - Clears all warnings that have been reported for the result set. - After this call, getWarnings() returns null until a new warning - is reported for the result set. - - @exception SQLException If an error occurs. - **/ - public void clearWarnings () throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "clearWarnings"); - checkForClosedResultSet (); - } - - /** - Returns the column index for the specified column name. - - @param columnName The column name. - @return The column index (1-based). - - @exception SQLException If the result set is not open - or the column name is not found. - **/ - public int findColumn (String columnName) throws java.sql.SQLException - { - //if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "findColumn", columnName); - checkForClosedResultSet (); - int column = findColumnX (columnName); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "findColumn"); - return column; - } - - private final int findColumnX (String columnName) throws java.sql.SQLException - { - Integer index = (Integer) columnNameToIndexCache_.get (columnName.toUpperCase ()); - if (index != null) - return index.intValue (); - else - { - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - return -1;//never happens - } - - } - - /** - Retrieves the current row number. The first row is number 1, the second number 2, and so on. - - @return The current row number (1-based), or 0 if the current row - is not valid. - - @exception SQLException If the result set is not open. - **/ - public int getRow () throws java.sql.SQLException - { - checkForClosedResultSet (); - int row; - if (currentRowInRowset_ >= 0 && currentRowInRowset_ <= (numberOfRows_ - 1)) - row = currentRowInRowset_ + 1; - else - row = 0; - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getRow"); - return row; - } - - /** - Indicates if the last column read has the value of SQL NULL. - - @return true if the value is SQL NULL; - false otherwise. - - @exception SQLException If the result set is not open. - **/ - public boolean wasNull () throws java.sql.SQLException - { - checkForClosedResultSet (); - if (wasNull_ == WAS_NULL_UNSET) - JDError.throwSQLException (JDError.EXC_CURSOR_POSITION_INVALID); - boolean result = (wasNull_ == WAS_NULL); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "wasNull"); - return result; - } - - // ---------------------- get on column methods ---------------------- - /** - Returns the value of a column as a Java boolean value. - - @param column The column name. - @return The column value or false if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public boolean getBoolean (int column) throws java.sql.SQLException - { - checkGetterPreconditions (column); - - Object[] columnData = data_[column - 1]; - boolean result = false; //@nulllocalarrelem - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getBoolean(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getBoolean(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBoolean"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java boolean value. - - @param columnName The column name. - @return The column value or false if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public boolean getBoolean (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBoolean"); - return getBoolean (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Java byte value. - - @param column The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public byte getByte (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - Object[] columnData = data_[column - 1]; - - byte result = 0; - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getByte(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getByte(); - } - } - - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getByte"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java byte value. - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public byte getByte (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getByte"); - return getByte (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Java short value. - - @param column The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public short getShort (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - short result = 0; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getShort(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getShort(); - } - } - - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getShort"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java short value. - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public short getShort (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getShort"); - return getShort (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Java int value. - - @param column The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public int getInt (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - int result = 0; //@nulllocalarrelem - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getInt(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getInt(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getInt"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java int value. - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public int getInt (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getInt"); - return getInt (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Java long value. - - @param column The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public long getLong (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - long result = 0; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getLong(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getLong(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getLong"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java long value. - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public long getLong (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getLong"); - return getLong (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Java float value. - - @param column The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public float getFloat (int column) throws java.sql.SQLException - { - checkGetterPreconditions (column); - float result = 0; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getFloat(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getFloat(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getFloat"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java float value. - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public float getFloat (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getFloat"); - return getFloat (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Java double value. - - @param column The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public double getDouble (int column) throws java.sql.SQLException - { - checkGetterPreconditions (column); - double result = 0; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getDouble(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getDouble(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getDouble"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java double value. - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public double getDouble (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getDouble"); - return getDouble (findColumnX (columnName)); - } - - /** - Returns the value of a column as a BigDecimal object. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public java.math.BigDecimal getBigDecimal (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - java.math.BigDecimal result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getBigDecimal(-1); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getBigDecimal(-1); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBigDecimal"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a BigDecimal object. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public java.math.BigDecimal getBigDecimal (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBigDecimal"); - return getBigDecimal (findColumnX (columnName)); - } - - /** - Returns the value of a column as a BigDecimal object. - - @param column The column index (1-based). - @param scale The number of digits after the decimal. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the scale is not valid, or the - requested conversion is not valid. - - @deprecated Use getBigDecimal(int) instead. - @see #getBigDecimal(int) - **/ - public java.math.BigDecimal getBigDecimal (int column, int scale) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBigDecimal " + column + " " + scale); - return getBigDecimal (column).setScale (scale); - } - - /** - Returns the value of a column as a BigDecimal object. - - @param columnName The column name. - @param scale The number of digits after the decimal. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the scale is not valid, or the - requested conversion is not valid. - - @deprecated Use getBigDecimal(int) instead. - @see #getBigDecimal(int) - **/ - public java.math.BigDecimal getBigDecimal (String columnName, int scale) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBigDecimal " + columnName + " " + scale); - return getBigDecimal (findColumnX (columnName), scale); - } - - /** - Returns the value of a column as a java.sql.Date object using - the default calendar. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - synchronized public java.sql.Date getDate (int column) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getDate"); - return getDateX (column, java.util.TimeZone.getDefault ()); - } - - /** - Returns the value of a column as a java.sql.Date object using - the default calendar. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.sql.Date getDate (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getDate"); - return getDate (findColumnX (columnName)); - } - - /** - Returns the value of a column as a java.sql.Time object using the - default calendar. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - synchronized public java.sql.Time getTime (int column) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getTime"); - return getTimeX (column, java.util.TimeZone.getDefault ()); - } - - /** - Returns the value of a column as a java.sql.Time object using the - default calendar. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.sql.Time getTime (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getTime"); - return getTime (findColumnX (columnName)); - } - - /** - Returns the value of a column as a java.sql.Timestamp object - using the default calendar. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - synchronized public java.sql.Timestamp getTimestamp (int column) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getTimestamp"); - return getTimestampX (column, java.util.TimeZone.getDefault ()); - } - - /** - Returns the value of a column as a java.sql.Timestamp object - using the default calendar. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.sql.Timestamp getTimestamp (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getTimestamp"); - return getTimestamp (findColumnX (columnName)); - } - - /** - Returns the value of a column as a java.sql.Date object using - a calendar other than the default. - - @param column The column index (1-based). - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the calendar is null, or the - requested conversion is not valid. - **/ - synchronized public java.sql.Date getDate (int column, java.util.Calendar calendar) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getDate " + column ); - - java.sql.Date result = getDateX (column, calendar.getTimeZone ()); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getDate"); - return result; - } - - /** - Returns the value of a column as a java.sql.Date object using - a calendar other than the default. - - @param columnName The column name. - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the calendar is null, or the - requested conversion is not valid. - **/ - public java.sql.Date getDate (String columnName, java.util.Calendar calendar) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getDate " + columnName ); - return getDate (findColumnX (columnName), calendar); - } - - private java.sql.Date getDateX (int column, java.util.TimeZone timeZone) throws java.sql.SQLException - { - checkGetterPreconditions (column); - java.sql.Date date = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - date = ((SQLData)columnData[currentRowInRowset_]).getDate(getCalendar(timeZone)); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], getCalendar(timeZone), -1); - date = contentTemplate_.getDate(getCalendar(timeZone)); - } - } - - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return date; - } - - /** - Returns the value of a column as a java.sql.Time object using the - default calendar. - - @param column The column index (1-based). - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - synchronized public java.sql.Time getTime (int column, java.util.Calendar calendar) throws java.sql.SQLException - { - java.sql.Time result = getTimeX (column, calendar.getTimeZone ()); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getTime"); - return result; - } - - /** - Returns the value of a column as a java.sql.Time object using the - default calendar. - - @param columnName The column name. - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.sql.Time getTime (String columnName, java.util.Calendar calendar) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getTime"); - return getTime (findColumnX (columnName), calendar); - } - - private java.sql.Time getTimeX (int column, java.util.TimeZone timeZone) throws java.sql.SQLException - { - checkGetterPreconditions (column); - java.sql.Time time = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - time = ((SQLData)columnData[currentRowInRowset_]).getTime(getCalendar(timeZone)); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], getCalendar(timeZone), -1); - time = contentTemplate_.getTime(getCalendar(timeZone)); - } - } - - - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return time; - } - - /** - Returns the value of a column as a java.sql.Timestamp object - using a calendar other than the default. - - @param column The column index (1-based). - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the calendar is null, or the - requested conversion is not valid. - **/ - synchronized public java.sql.Timestamp getTimestamp (int column, java.util.Calendar calendar) throws java.sql.SQLException - { - java.sql.Timestamp result = getTimestampX (column, calendar.getTimeZone ()); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getTimestamp"); - return result; - } - - /** - Returns the value of a column as a java.sql.Timestamp object - using a calendar other than the default. - - @param columnName The column name. - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the calendar is null, or the - requested conversion is not valid. - **/ - public java.sql.Timestamp getTimestamp (String columnName, java.util.Calendar calendar) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getTimestamp"); - return getTimestamp (findColumnX (columnName), calendar); - } - - private java.sql.Timestamp getTimestampX (int column, java.util.TimeZone timeZone) throws java.sql.SQLException - { - checkGetterPreconditions (column); - java.sql.Timestamp timestamp = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - timestamp = ((SQLData)columnData[currentRowInRowset_]).getTimestamp(getCalendar(timeZone)); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], getCalendar(timeZone), -1); - timestamp = contentTemplate_.getTimestamp(getCalendar(timeZone)); - } - } - - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return timestamp; - } - - /** - Returns the value of a column as a Java byte array. - -

        This can also be used to get values from columns - with other types. The values are returned in their - native IBM i format. This is not supported for - result sets returned by a DatabaseMetaData object. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public byte[] getBytes (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - byte[] result = null; - Object[] columnData = data_[column - 1]; - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getBytes(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getBytes(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBytes"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java byte array. - -

        This can also be used to get values from columns - with other types. The values are returned in their - native IBM i format. This is not supported for - result sets returned by a DatabaseMetaData object. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public byte[] getBytes (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBytes"); - return getBytes (findColumnX (columnName)); - } - - /** - Returns the value of a column as a String object. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - synchronized public String getString (int column) throws java.sql.SQLException - { - checkGetterPreconditions (column); - String result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getString(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getString(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getString"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a String object. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public String getString (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getString"); - return getString (findColumnX (columnName)); - } - - /** - Returns the value of a column as a stream of uninterpreted - bytes. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.io.InputStream getBinaryStream (int column) throws java.sql.SQLException - { - checkGetterPreconditions (column); - java.io.InputStream result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getBinaryStream(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getBinaryStream(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBinaryStream"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a stream of uninterpreted - bytes. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.io.InputStream getBinaryStream (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBinaryStream"); - return getBinaryStream (findColumnX (columnName)); - } - - /** - Returns the value of a column as a stream of ASCII - characters. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public java.io.InputStream getAsciiStream (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - java.io.InputStream result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getAsciiStream(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getAsciiStream(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getAsciiStream"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - - /** - Returns the value of a column as a stream of ASCII - characters. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public java.io.InputStream getAsciiStream (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getAsciiStream"); - return getAsciiStream (findColumnX (columnName)); - } - - - /** - Returns the value of a column as a stream of Unicode - characters. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - - @deprecated Use getCharacterStream(int) instead. - @see #getCharacterStream(int) - **/ - public java.io.InputStream getUnicodeStream (int column) throws java.sql.SQLException - { - checkGetterPreconditions (column); - java.io.InputStream result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getUnicodeStream(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getUnicodeStream(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getUnicodeStream"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a stream of Unicode - characters. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - - @deprecated Use getCharacterStream(String) instead. - @see #getCharacterStream(String) - **/ - public java.io.InputStream getUnicodeStream (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getUnicodeStream"); - return getUnicodeStream (findColumnX (columnName)); - } - - /** - Returns the value of a column as a character stream. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - */ - public java.io.Reader getCharacterStream (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - java.io.Reader result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - result = ((SQLData)columnData[currentRowInRowset_]).getCharacterStream(); - } - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getCharacterStream(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getCharacterStream"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a character stream. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - */ - public java.io.Reader getCharacterStream (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getCharacterStream"); - return getCharacterStream (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Blob object. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.sql.Blob getBlob (int column) throws java.sql.SQLException - { - checkGetterPreconditions (column); - java.sql.Blob result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getBlob(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getBlob(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBlob"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Blob object. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.sql.Blob getBlob (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getBlob"); - return getBlob (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Clob object. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.sql.Clob getClob (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - java.sql.Clob result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getClob(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getClob(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getClob"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Clob object. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public java.sql.Clob getClob (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getClob"); - return getClob (findColumnX (columnName)); - } - - /** - Returns the value of a column as an Array object. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException - **/ - public java.sql.Array getArray (int column) throws java.sql.SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - /** - Returns the value of a column as an Array object. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException - **/ - public java.sql.Array getArray (String columnName) throws java.sql.SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - /** - Returns the value of a column as a Ref object. - DB2 for IBM i does not support structured types. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support structured types. - **/ - public java.sql.Ref getRef (int column) throws java.sql.SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - /** - Returns the value of a column as a Ref object. - DB2 for IBM i does not support structured types. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support structured types. - **/ - public java.sql.Ref getRef (String columnName) throws java.sql.SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - /** - Returns the value of an SQL DATALINK output parameter as a - java.net.URL object. - - @param column The column index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed or - the requested conversion is not valid. - **/ - public java.net.URL getURL (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - java.net.URL result = null; - Object[] columnData = data_[column - 1]; - String stringResult = null; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - stringResult = ((SQLData)columnData[currentRowInRowset_]).getString(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - stringResult = contentTemplate_.getString(); - } - } - - try - { - if(stringResult == null) - result = null; - else - result = new java.net.URL(stringResult); - } - catch(MalformedURLException e) - { - JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID, e); - result = null; - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getURL"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of an SQL DATALINK output parameter as a - java.net.URL object. - - @param columnName The column name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed or - the requested conversion is not valid. - **/ - public java.net.URL getURL (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getURL"); - return getURL (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Java Object. - This can be used to get values from columns with all - SQL types. - - @param column The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public Object getObject (int column) throws java.sql.SQLException - { - checkGetterPreconditions (column); - Object[] columnData = data_[column - 1]; - Object result = null; - - if(isSQLData_) - { - - if(columnData[currentRowInRowset_] != null) //@nullelem - result = ((SQLData)columnData[currentRowInRowset_]).getObject(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getObject(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getObject"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - Returns the value of a column as a Java Object. - This can be used to get values from columns with all - SQL types. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public Object getObject (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getObject"); - return getObject (findColumnX (columnName)); - } - - /** - Returns the value of a column as a Java Object. - - @param column The column index (1-based). - @param map The type map. This is not used. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the type map is null, or the - requested conversion is not valid. - **/ - public Object getObject (int column, java.util.Map map) throws java.sql.SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - /** - Returns the value of a column as a Java Object. - - @param columnName The column name. - @param map The type map. This is not used. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the type map is null, or the - requested conversion is not valid. - **/ - public Object getObject (String columnName, java.util.Map map) throws java.sql.SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - // ---------------------- update on column methods ---------------------- - - /** - Updates a column in the current row using SQL NULL. - - @param column The column index (1-based). - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateNull (int column) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNull"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using SQL NULL. - - @param columnName The column name. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateNull (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNull"); - updateNull (findColumnX (columnName)); - } - - /** - Updates a column in the current row using a Java byte value. - The driver converts this to an SQL SMALLINT value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateByte (int column, byte x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateByte"); - checkUpdatePreconditions (column); - } - - - /** - Updates a column in the current row using a Java byte value. - The driver converts this to an SQL SMALLINT value. - - @param columnName The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateByte (String columnName, byte x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateByte"); - updateByte (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a Java boolean value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBoolean (int column, boolean x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBoolean"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java boolean value. - - @param columnName The column name. - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBoolean (String columnName, boolean x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBoolean"); - updateBoolean (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a Java short value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateShort (int column, short x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateShort"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java short value. - - @param columnName The column name. - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateShort (String columnName, short x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateShort"); - updateShort (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a Java int value. - The driver converts this to an SQL INTEGER value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateInt (int column, int x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateInt"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java int value. - The driver converts this to an SQL INTEGER value. - - @param columnName The column name. - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateInt (String columnName, int x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateInt"); - updateInt (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a Java long value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateLong (int column, long x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateLong"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java long value. - - @param columnName The column name. - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateLong (String columnName, long x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateLong"); - updateLong (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a Java float value. - The driver converts this to an SQL REAL value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateFloat (int column, float x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateFloat"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java float value. - The driver converts this to an SQL REAL value. - - @param columnName The column name. - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateFloat (String columnName, float x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateFloat"); - updateFloat (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a Java double value. - The driver converts this to an SQL DOUBLE value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateDouble (int column, double x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateDouble"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java double value. - The driver converts this to an SQL DOUBLE value. - - @param columnName The column name. - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateDouble (String columnName, double x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateDouble"); - updateDouble (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a BigDecimal value. The - driver converts this to an SQL NUMERIC value. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBigDecimal (int column, java.math.BigDecimal x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBigDecimal"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a BigDecimal value. The - driver converts this to an SQL NUMERIC value. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBigDecimal (String columnName, java.math.BigDecimal x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBigDecimal"); - updateBigDecimal (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a java.sql.Date value. - The driver converts this to an SQL DATE value. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateDate (int column, java.sql.Date x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateDate"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a java.sql.Date value. - The driver converts this to an SQL DATE value. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateDate (String columnName, java.sql.Date x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateDate"); - updateDate (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a java.sql.Time value. - The driver converts this to an SQL TIME value. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateTime (int column, java.sql.Time x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateTime"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a java.sql.Time value. - The driver converts this to an SQL TIME value. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateTime (String columnName, java.sql.Time x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateTime"); - updateTime (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a java.sql.Timestamp value. - The driver converts this to an SQL TIMESTAMP value. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateTimestamp (int column, java.sql.Timestamp x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateTimestamp"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a java.sql.Timestamp value. - The driver converts this to an SQL TIMESTAMP value. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateTimestamp (String columnName, java.sql.Timestamp x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateTimestamp"); - updateTimestamp (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a Java byte array value. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBytes (int column, byte x[]) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBytes"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java byte array value. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBytes (String columnName, byte x[]) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBytes"); - updateBytes (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a String value. - The driver converts this to an SQL VARCHAR value. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public void updateString (int column, String x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateString"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a String value. - The driver converts this to an SQL VARCHAR value. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public void updateString (String columnName, String x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateString"); - updateString (findColumnX (columnName), x); - } - - /** - * Updates the designated column with a binary stream value, which will have - * the specified number of bytes. - * @param column column index - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateBinaryStream (int column, java.io.InputStream x, int length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBinaryStream"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with a binary stream value, which will have - * the specified number of bytes. - * @param columnName column index - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateBinaryStream (String columnName, java.io.InputStream x, int length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBinaryStream"); - updateBinaryStream (findColumnX (columnName), x, length); - } - - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * @param column - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateAsciiStream (int column, java.io.InputStream x, int length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateAsciiStream"); - checkUpdatePreconditions (column); - } - - - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * @param columnName - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateAsciiStream (String columnName, java.io.InputStream x, int length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateAsciiStream"); - updateAsciiStream (findColumnX (columnName), x, length); - } - - /** - Updates a column in the current row using a Reader value. - The driver reads the data from the Reader as needed until no more - characters are available. The driver converts this to an SQL VARCHAR - value. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - @param length The length. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid, - the length is not valid, or an error - happens while reading the input stream. - **/ - public void updateCharacterStream (int column, java.io.Reader x, int length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateCharacterStream"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Reader value. - The driver reads the data from the Reader as needed until no more - characters are available. The driver converts this to an SQL VARCHAR - value. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - @param length The length. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid, - the length is not valid, or an error - happens while reading the input stream. - **/ - public void updateCharacterStream (String columnName, java.io.Reader x, int length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateCharacterStream"); - updateCharacterStream (findColumnX (columnName), x, length); - } - - /** - Updates a column in the current row using a Java Blob value. - The driver converts this to an SQL BLOB value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBlob (int column, java.sql.Blob x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBlob"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java Blob value. - The driver converts this to an SQL BLOB value. - - @param columnName The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBlob (String columnName, java.sql.Blob x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBlob"); - updateBlob (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using a Java Clob value. - The driver converts this to an SQL CLOB value. - - @param column The column index (1-based). - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateClob (int column, java.sql.Clob x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateClob"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using a Java Clob value. - The driver converts this to an SQL CLOB value. - - @param columnName The column name. - @param x The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateClob (String columnName, java.sql.Clob x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateClob"); - updateClob (findColumnX (columnName), x); - } - - /** - Updates the value of a column as an Array object. - - @param column The column index (1-based). - @param x The column value or null if the value is SQL NULL. - - @exception SQLException - **/ - public void updateArray (int column, java.sql.Array x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateArray"); - checkUpdatePreconditions (column); - } - - /** - Updates the value of a column as an Array object. - - @param columnName The column index (1-based). - @param x The column value or null if the value is SQL NULL. - - @exception SQLException - **/ - public void updateArray (String columnName, java.sql.Array x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateArray"); - updateArray (findColumnX (columnName), x); - } - - /** - Updates the value of an SQL REF output parameter as a Ref value. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException - **/ - public void updateRef (int column, java.sql.Ref x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateRef"); - checkUpdatePreconditions (column); - } - - /** - Updates the value of an SQL REF output parameter as a Ref value. - - @param columnName The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException - **/ - public void updateRef (String columnName, java.sql.Ref x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateRef"); - updateRef (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using an Object value. - The driver converts this to a value of an SQL type, depending on - the type of the specified value. The JDBC specification defines - a standard mapping from Java types to SQL types. - - @param column The column index (1-based). - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public void updateObject (int column, Object x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateObject"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using an Object value. - The driver converts this to a value of an SQL type, depending on - the type of the specified value. The JDBC specification defines - a standard mapping from Java types to SQL types. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public void updateObject (String columnName, Object x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateObject"); - updateObject (findColumnX (columnName), x); - } - - /** - Updates a column in the current row using an Object value. - The driver converts this to a value of an SQL type, depending on - the type of the specified value. The JDBC specification defines - a standard mapping from Java types to SQL types. - - @param column The column index. - @param x The column value or null to update - the value to SQL NULL. - @param scale The scale. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public void updateObject (int column, Object x, int scale) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateObject"); - checkUpdatePreconditions (column); - } - - /** - Updates a column in the current row using an Object value. - The driver converts this to a value of an SQL type, depending on - the type of the specified value. The JDBC specification defines - a standard mapping from Java types to SQL types. - - @param columnName The column name. - @param x The column value or null to update - the value to SQL NULL. - @param scale The scale. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public void updateObject (String columnName, Object x, int scale) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateObject"); - updateObject (findColumnX (columnName), x, scale); - } - - /** - Indicates if the current row has been updated. This driver does - not support this method. - - @return Always false. - - @exception SQLException If an error occurs. - **/ - public boolean rowUpdated () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return false; - } - - /** - Indicates if the current row has been inserted. This driver does - not support this method. - - @return Always false. - - @exception SQLException If an error occurs. - **/ - public boolean rowInserted () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return false; - } - - /** - Indicates if the current row has been deleted. A result set - of type TYPE_SCROLL_INSENSITIVE may contain rows that have - been deleted. - - @return true if current row has been deleted; false otherwise. - - @exception SQLException If an error occurs. - **/ - public boolean rowDeleted () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return false; - } - - /** - Inserts the contents of the insert row into the result set - and the database. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on the insert row, - a column that is not nullable was not specified, - or an error occurs. - **/ - public void insertRow () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - - } - - /** - Cancels all pending updates that have been made since the last - call to updateRow(). - - @exception SQLException If the result set is not open - or the result set is not updatable. - **/ - public void updateRow () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - /** - Deletes the current row from the result set and the database. - After deleting a row, the cursor position is no longer valid, - so it must be explicitly repositioned. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the cursor is positioned on the insert row, - or an error occurs. - **/ - public void deleteRow () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - /** - Refreshes the current row from the database. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - the cursor is not positioned on a row, - the cursor is positioned on the - insert row or an error occurs. - **/ - public void refreshRow () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - /** - Cancels all pending updates that have been made since the last - call to updateRow(). - - @exception SQLException If the result set is not open - or the result set is not updatable. - **/ - public void cancelRowUpdates () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - /** - Positions the cursor to the insert row. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - the result set is not updatable, - or an error occurs. - **/ - public void moveToInsertRow () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - /** - Positions the cursor to the current row. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public void moveToCurrentRow () throws java.sql.SQLException - { - checkUpdatePreconditions (); - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - // ---------------------- condition checking helper methods ---------------------- - - private final void checkForClosedResultSet () throws java.sql.SQLException - { - if (!openOnClient_) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - private final void checkForValidColumnIndex (int column) throws java.sql.SQLException - { - if (column < 1 || column > numberOfColumns_) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - private final void checkForValidPosition () throws java.sql.SQLException - { - if (currentRowInRowset_ < 0 || currentRowInRowset_ > (numberOfRows_ - 1)) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - private final void checkForConcurrency () throws java.sql.SQLException - { - if (concurrency_ != java.sql.ResultSet.CONCUR_UPDATABLE) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - private final void checkGetterPreconditions (int column) throws java.sql.SQLException - { - checkForClosedResultSet (); - checkForValidColumnIndex (column); - checkForValidPosition (); - } - - private final void checkUpdatePreconditions (int column) throws java.sql.SQLException - { - checkForClosedResultSet (); - checkForValidColumnIndex (column); - checkForConcurrency (); - } - - private final void checkUpdatePreconditions () throws java.sql.SQLException - { - checkForClosedResultSet (); - checkForConcurrency (); - } - - // ---------- JDBC 4 methods ---------- - - /** - Indicates if the result set is closed. - - @return true if this result set is closed; - false otherwise. - **/ - public boolean isClosed () throws java.sql.SQLException - { - return !openOnClient_; - } - - /** - * Retrieves the holdability. - * @throws SQLException if a database error occurs - */ - public int getHoldability () throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getHoldability"); - checkForClosedResultSet (); - return holdability_; - } - - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @param column - * @exception SQLException if a database access error occurs - */ - public java.io.Reader getNCharacterStream (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - java.io.Reader result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getNCharacterStream(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getNCharacterStream(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getNCharacterStream"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @param columnName - * @exception SQLException if a database access error occurs - */ - public java.io.Reader getNCharacterStream (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getNCharacterStream"); - return getNCharacterStream (findColumnX (columnName)); - } - - - //JDBC40DOC /** - //JDBC40DOC * Retrieves the value of the designated column in the current row - //JDBC40DOC * of this ResultSet object as a NClob object - //JDBC40DOC * in the Java programming language. - //JDBC40DOC * - //JDBC40DOC * @param column - //JDBC40DOC * @return a NClob object representing the SQL - //JDBC40DOC * NCLOB value in the specified column - //JDBC40DOC * @exception SQLException if the driver does not support national - //JDBC40DOC * character sets; if the driver can detect that a data conversion - //JDBC40DOC * error could occur; or if a database access error occurss - //JDBC40DOC */ - /* ifdef JDBC40 - public java.sql.NClob getNClob (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - java.sql.NClob result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getNClob(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getNClob(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getNClob"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } -endif */ - - //JDBC40DOC /** - //JDBC40DOC * Retrieves the value of the designated column in the current row - //JDBC40DOC * of this ResultSet object as a NClob object - //JDBC40DOC * in the Java programming language. - //JDBC40DOC * - //JDBC40DOC * @param columnName - //JDBC40DOC * @return a NClob object representing the SQL - //JDBC40DOC * NCLOB value in the specified column - //JDBC40DOC * @exception SQLException if the driver does not support national - //JDBC40DOC * character sets; if the driver can detect that a data conversion - //JDBC40DOC * error could occur; or if a database access error occurss - //JDBC40DOC */ -/* ifdef JDBC40 - public java.sql.NClob getNClob (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getNClob"); - return getNClob (findColumnX (columnName)); - } - -endif */ - - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param column - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - */ - public String getNString (int column) throws java.sql.SQLException - { - - checkGetterPreconditions (column); - String result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getNString(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getNString(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getNString"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnName - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - */ - public String getNString (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getNString"); - return getNString (findColumnX (columnName)); - } - - //JDBC40DOC /** - //JDBC40DOC * Retrieves the value of the designated column in the current row of this - //JDBC40DOC * ResultSet object as a java.sql.RowId object in the Java - //JDBC40DOC * programming language. - //JDBC40DOC * - //JDBC40DOC * @param column The column number - //JDBC40DOC * @return the column value ; if the value is a SQL NULL the - //JDBC40DOC * value returned is null - //JDBC40DOC * @throws SQLException if a database access error occurs - //JDBC40DOC */ -/* ifdef JDBC40 - public java.sql.RowId getRowId (int column) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getRowId"); - checkGetterPreconditions (column); - java.sql.RowId result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getRowId(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getRowId(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getRowId"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } -endif */ - - //JDBC40DOC /** - //JDBC40DOC * Retrieves the value of the designated column in the current row of this - //JDBC40DOC * ResultSet object as a java.sql.RowId object in the Java - //JDBC40DOC * programming language. - //JDBC40DOC * - //JDBC40DOC * @param columnName The column name - //JDBC40DOC * @return the column value ; if the value is a SQL NULL the - //JDBC40DOC * value returned is null - //JDBC40DOC * @throws SQLException if a database access error occurs - //JDBC40DOC */ -/* ifdef JDBC40 - public java.sql.RowId getRowId (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getRowId"); - return getRowId (findColumnX (columnName)); - } - endif */ - - //JDBC40DOC /** - //JDBC40DOC * Retrieves the value of the designated column in the current row of - //JDBC40DOC * this ResultSet as a - //JDBC40DOC * java.sql.SQLXML object in the Java programming language. - //JDBC40DOC * @param column - //JDBC40DOC * @return a SQLXML object that maps an SQL XML value - //JDBC40DOC * @throws SQLException if a database access error occurs - //JDBC40DOC */ -/* ifdef JDBC40 - public java.sql.SQLXML getSQLXML (int column) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getSQLXML"); - checkGetterPreconditions (column); - java.sql.SQLXML result = null; - Object[] columnData = data_[column - 1]; - - if(isSQLData_) - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - result = ((SQLData)columnData[currentRowInRowset_]).getSQLXML(); - } - else - { - if(columnData[currentRowInRowset_] != null) //@nulllocalarrelem - { - contentTemplate_.set(columnData[currentRowInRowset_], calendar_, -1); - result = contentTemplate_.getSQLXML(); - } - } - - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getSQLXML"); - wasNull_ = (columnData[currentRowInRowset_] == null) ? WAS_NULL : WAS_NOT_NULL; - return result; - } - endif */ - - //JDBC40DOC /** - //JDBC40DOC * Retrieves the value of the designated column in the current row of - //JDBC40DOC * this ResultSet as a - //JDBC40DOC * java.sql.SQLXML object in the Java programming language. - //JDBC40DOC * @param columnName - //JDBC40DOC * @return a SQLXML object that maps an SQL XML value - //JDBC40DOC * @throws SQLException if a database access error occurs - //JDBC40DOC */ -/* ifdef JDBC40 - public java.sql.SQLXML getSQLXML (String columnName) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "getSQLXML"); - return getSQLXML (findColumnX (columnName)); - } -endif */ - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - - * @param column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream (int column, java.io.InputStream x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateAsciiStream"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * @param columnName - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream (String columnName, java.io.InputStream x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateAsciiStream"); - updateAsciiStream (findColumnX (columnName), x); - } - - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * @param column - * @param x the new column value - * @param length - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream (int column, java.io.InputStream x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateAsciiStream"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * @param columnName - * @param x the new column value - * @param length - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream (String columnName, java.io.InputStream x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateAsciiStream"); - updateAsciiStream (findColumnX (columnName), x, length); - } - - /** - * Updates the designated column with a binary stream value. - * - * @param column - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateBinaryStream (int column, java.io.InputStream x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBinaryStream"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with a binary stream value. - * - * @param columnName - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateBinaryStream (String columnName, java.io.InputStream x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBinaryStream"); - updateBinaryStream (findColumnX (columnName), x); - } - - /** - * Updates the designated column with a binary stream value. - * - * @param column - * @param x the new column value - * @param length - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateBinaryStream (int column, java.io.InputStream x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBinaryStream"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with a binary stream value. - * - * @param columnName - * @param x the new column value - * @param length - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateBinaryStream (String columnName, java.io.InputStream x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBinaryStream"); - updateBinaryStream (findColumnX (columnName), x, length); - } - - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - * - * @param column - * @param x An object that contains the data to set the parameter value to. - * @exception SQLException if the columnIndex is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob (int column, java.io.InputStream x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBlob"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - * - * @param columnName - * @param x An object that contains the data to set the parameter value to. - * @exception SQLException if the columnIndex is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob (String columnName, java.io.InputStream x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBlob" ); - updateBlob (findColumnX (columnName), x); - } - - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - * - * @param column - * @param x An object that contains the data to set the parameter value to. - * @param length - * @exception SQLException if the columnIndex is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob (int column, java.io.InputStream x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBlob" ); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - * - * @param columnName - * @param x An object that contains the data to set the parameter value to. - * @param length - * @exception SQLException if the columnIndex is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateBlob (String columnName, java.io.InputStream x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateBlob" ); - updateBlob (findColumnX (columnName), x, length); - } - - /** - * Updates the designated column with a character stream value. - * - * @param column - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateCharacterStream (int column, java.io.Reader x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateCharacterStream" ); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with a character stream value. - * - * @param columnName - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateCharacterStream (String columnName, java.io.Reader x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateCharacterStream" ); - updateCharacterStream (findColumnX (columnName), x); - } - - /** - * Updates the designated column with a character stream value. - * - * @param column - * @param x the new column value - * @param length - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateCharacterStream (int column, java.io.Reader x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateCharacterStream"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with a character stream value. - * - * @param columnName - * @param x the new column value - * @param length - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateCharacterStream (String columnName, java.io.Reader x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateCharacterStream"); - updateCharacterStream (findColumnX (columnName), x, length); - } - - /** - * Updates the designated column using the given Reader - * object. - * - * @param column - * @param x An object that contains the data to set the parameter value to. - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateClob (int column, java.io.Reader x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateClob"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column using the given Reader - * object. - * - * @param columnName - * @param x An object that contains the data to set the parameter value to. - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateClob (String columnName, java.io.Reader x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateClob"); - updateClob (findColumnX (columnName), x); - } - - /** - * Updates the designated column using the given Reader - * object. - * - * @param column - * @param x An object that contains the data to set the parameter value to. - * @param length - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateClob (int column, java.io.Reader x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateClob"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column using the given Reader - * object. - * - * @param columnName - * @param x An object that contains the data to set the parameter value to. - * @param length - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - */ - public void updateClob (String columnName, java.io.Reader x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateClob"); - updateClob (findColumnX (columnName), x, length); - } - - /** - * Updates the designated column with a character stream value. - * - * @param column - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream (int column, java.io.Reader x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNCharacterStream"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with a character stream value. - * - * @param columnName - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream (String columnName, java.io.Reader x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNCharacterStream"); - updateNCharacterStream (findColumnX (columnName), x); - } - - /** - * Updates the designated column with a character stream value. - * - * @param column - * @param x the new column value - * @param length - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream (int column, java.io.Reader x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNCharacterStream"); - checkUpdatePreconditions (column); - } - - - /** - * Updates the designated column with a character stream value. - * - * @param columnName - * @param x the new column value - * @param length - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream (String columnName, java.io.Reader x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNCharacterStream" ); - updateNCharacterStream (findColumnX (columnName), x, length); - } - - //JDBC40DOC /** - //JDBC40DOC * Updates the designated column using the given Reader - //JDBC40DOC * - //JDBC40DOC * @param column - //JDBC40DOC * @param x An object that contains the data to set the parameter value to. - //JDBC40DOC * @throws SQLException if the columnIndex is not valid; - //JDBC40DOC * if the driver does not support national - //JDBC40DOC * character sets; if the driver can detect that a data conversion - //JDBC40DOC * error could occur; this method is called on a closed result set, - //JDBC40DOC * if a database access error occurs or - //JDBC40DOC * the result set concurrency is CONCUR_READ_ONLY - //JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - //JDBC40DOC * this method - //JDBC40DOC */ - /* ifdef JDBC40 - public void updateNClob (int column, java.sql.NClob x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNClob" ); - checkUpdatePreconditions (column); - } - endif */ - - //JDBC40DOC /** - //JDBC40DOC * Updates the designated column using the given Reader - //JDBC40DOC * - //JDBC40DOC * @param columnName - //JDBC40DOC * @param x An object that contains the data to set the parameter value to. - //JDBC40DOC * @throws SQLException if the columnIndex is not valid; - //JDBC40DOC * if the driver does not support national - //JDBC40DOC * character sets; if the driver can detect that a data conversion - //JDBC40DOC * error could occur; this method is called on a closed result set, - //JDBC40DOC * if a database access error occurs or - //JDBC40DOC * the result set concurrency is CONCUR_READ_ONLY - //JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - //JDBC40DOC * this method - //JDBC40DOC */ - /* ifdef JDBC40 - public void updateNClob (String columnName, java.sql.NClob x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNClob" ); - updateNClob (findColumnX (columnName), x); - } - endif */ - /** - * Updates the designated column using the given Reader - * - * @param column - * @param x An object that contains the data to set the parameter value to. - * @throws SQLException if the columnIndex is not valid; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob (int column, java.io.Reader x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNClob" ); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column using the given Reader - * - * @param columnName - * @param x An object that contains the data to set the parameter value to. - * @throws SQLException if the columnIndex is not valid; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob (String columnName, java.io.Reader x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNClob" ); - updateNClob (findColumnX (columnName), x); - } - - /** - * Updates the designated column using the given Reader - * - * @param column - * @param x An object that contains the data to set the parameter value to. - * @param length - * @throws SQLException if the columnIndex is not valid; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob (int column, java.io.Reader x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNClob"); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column using the given Reader - * - * @param columnName - * @param x An object that contains the data to set the parameter value to. - * @param length - * @throws SQLException if the columnIndex is not valid; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob (String columnName, java.io.Reader x, long length) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNClob"); - updateNClob (findColumnX (columnName), x, length); - } - - /** - * Updates the designated column with a String value. - * It is intended for use when updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param column - * @param x The value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - */ - public void updateNString (int column, String x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNString" ); - checkUpdatePreconditions (column); - } - - /** - * Updates the designated column with a String value. - * It is intended for use when updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnName - * @param x The value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - */ - public void updateNString (String columnName, String x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateNString" ); - updateNString (findColumnX (columnName), x); - } - - //JDBC40DOC /** - //JDBC40DOC * Updates the designated column with a RowId value. - //JDBC40DOC * - //JDBC40DOC * @param column - //JDBC40DOC * @param x the column value - //JDBC40DOC * @throws SQLException if a database access occurs - //JDBC40DOC */ -/* ifdef JDBC40 - - public void updateRowId (int column, java.sql.RowId x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateRowId"); - checkUpdatePreconditions (column); - } -endif */ - //JDBC40DOC /** - //JDBC40DOC * Updates the designated column with a RowId value. - //JDBC40DOC * - //JDBC40DOC * @param columnName - //JDBC40DOC * @param x the column value - //JDBC40DOC * @throws SQLException if a database access occurs - //JDBC40DOC */ - /* ifdef JDBC40 - public void updateRowId (String columnName, java.sql.RowId x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateRowId"); - updateRowId (findColumnX (columnName), x); - } -endif */ - //JDBC40DOC /** - //JDBC40DOC * Updates the designated column with a java.sql.SQLXML value. - //JDBC40DOC * - //JDBC40DOC * @param column - //JDBC40DOC * @param x The value for the column to be updated - //JDBC40DOC * @throws SQLException if a database access error occurs - //JDBC40DOC */ - /* ifdef JDBC40 - - public void updateSQLXML (int column, java.sql.SQLXML x) throws java.sql.SQLException - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateSQLXML"); - checkUpdatePreconditions (column); - } -endif */ - //JDBC40DOC /** - //JDBC40DOC * Updates the designated column with a java.sql.SQLXML value. - //JDBC40DOC * - //JDBC40DOC * @param columnName - //JDBC40DOC * @param x The value for the column to be updated - //JDBC40DOC * @throws SQLException if a database access error occurs - //JDBC40DOC */ - /* ifdef JDBC40 - - public void updateSQLXML (String columnName, java.sql.SQLXML x) throws java.sql.SQLException - { - updateSQLXML (findColumnX (columnName), x); - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "updateSQLXML"); - } - endif */ - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCArrayResultSet", "java.sql.ResultSet" }; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCBlob.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCBlob.java deleted file mode 100644 index ff8e56872..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCBlob.java +++ /dev/null @@ -1,427 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCBlob.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.sql.Blob; -import java.sql.SQLException; - -// Note: This code in this class requires understanding of bit manipulation -// and sign extension. Do not attempt to rework this code if you do not -// have a grasp of these concepts. - -// Currently, the database host server only supports 2 GB LOBs. Therefore, -// we validate any long parameters to make sure they are not greater than -// the maximum positive value for a 4-byte int (2 GB). This has the added -// bonus of being able to cast the long down to an int without worrying -// about sign extension. There are some cases where we could allow the -// user to pass in a long greater than 2 GB, but for consistency, we will -// throw an exception. - -// Offset refers to a 0-based index. Position refers to a 1-based index. - - -/** - * The AS400JDBCBlob class provides access to binary large - * objects. The data is valid only within the current - * transaction. -**/ -public class AS400JDBCBlob implements Blob -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private byte[] data_; - private int maxLength_; - static final int MAX_LOB_SIZE = 2147483647; //@PDA jdbc40 - same as native driver - -/** -Constructs an AS400JDBCBlob object. The data is contained -in the raw byte array. No further communication with the IBM i system -is necessary. - -@param data The BLOB data. -**/ - AS400JDBCBlob(byte[] data, int maxLength) - { - data_ = data; - maxLength_ = maxLength; - } - - - -/** -Returns the entire BLOB as a stream of uninterpreted bytes. - -@return The stream. - -@exception SQLException If an error occurs. -**/ - public synchronized InputStream getBinaryStream() throws SQLException - { - //Following Native, throw HY010 after free() has been called - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - return new ByteArrayInputStream(data_); - } - - - -/** -Returns part of the contents of the BLOB. - -@param position The start position within the BLOB (1-based). -@param length The length to return. -@return The contents. - -@exception SQLException If the start position is not valid, - if the length is not valid, - or an error occurs. -**/ - public synchronized byte[] getBytes(long position, int length) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int offset = (int)position-1; - if (offset < 0 || length < 0 || (offset + length) > data_.length) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - int lengthToUse = data_.length - offset; - if (lengthToUse < 0) return new byte[0]; - if (lengthToUse > length) lengthToUse = length; - - byte[] result = new byte[lengthToUse]; - System.arraycopy(data_, offset, result, 0, lengthToUse); - return result; - } - - - -/** -Returns the length of the BLOB. - -@return The length of the BLOB, in bytes. - -@exception SQLException If an error occurs. -**/ - public synchronized long length() throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - return data_.length; - } - - -/** -Returns the position at which a pattern is found in the BLOB. - -@param pattern The pattern. -@param position The position within the BLOB to begin - searching (1-based). -@return The position at which the pattern - is found, or -1 if the pattern is not - found. - -@exception SQLException If the pattern is null, - the position is not valid, - or an error occurs. -**/ - public synchronized long position(byte[] pattern, long position) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - int offset = (int)position-1; - if (pattern == null || offset < 0 || offset >= data_.length) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } else { - - int end = data_.length - pattern.length; - - for (int i=offset; i<=end; ++i) - { - int j = 0; - while (j < pattern.length && data_[i+j] == pattern[j]) ++j; - if (j == pattern.length) return i+1; - } - } - return -1; - } - - -/** -Returns the position at which a pattern is found in the BLOB. - -@param pattern The pattern. -@param position The position within the BLOB to begin - searching (1-based). -@return The position at which the pattern - is found, or -1 if the pattern is not - found. - -@exception SQLException If the pattern is null, - the position is not valid, - or an error occurs. -**/ - public synchronized long position(Blob pattern, long position) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int offset = (int)position-1; - if (pattern == null || offset < 0 || offset >= data_.length) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } else { - - int patternLength = (int)pattern.length(); - if (patternLength > data_.length || patternLength < 0) return -1; - - int end = data_.length - patternLength; - - byte[] bytePattern = pattern.getBytes(1L, patternLength); //@CRS - Get all bytes for now, improve this later. - - for (int i=offset; i<=end; ++i) - { - int j = 0; - while (j < patternLength && data_[i+j] == bytePattern[j]) ++j; - if (j == patternLength) return i+1; - } - } - return -1; - } - - - - /** - Returns a stream that an application can use to write to this BLOB. - The stream begins at position positionToStartWriting. - - @param position The position (1-based) in the BLOB where writes should start. - @return An OutputStream object to which data can be written by an application. - @exception SQLException If there is an error accessing the BLOB or if the position - specified is greater than the length of the BLOB. - **/ - public OutputStream setBinaryStream(long position) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - if (position <= 0 || position > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - return new AS400JDBCBlobOutputStream(this, position); - } - - /** - * This is not part of the JDBC interface. - **/ - synchronized int setByte(long position, byte data) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int offset = (int)position-1; - - if (offset < 0 || offset >= maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - int newSize = offset + 1; - if (newSize < 0) newSize = 0x7FFFFFFF; - if (newSize > data_.length) - { - byte[] temp = data_; - data_ = new byte[newSize]; - System.arraycopy(temp, 0, data_, 0, temp.length); - } - int numBytes = newSize - offset; - if (numBytes > 0) - { - data_[offset] = data; - return 1; - } - return 0; - } - - - - /** - Writes an array of bytes to this BLOB, starting at position positionToStartWriting - in the BLOB. - - @param position The position (1-based) in the BLOB where writes should start. - @param bytesToWrite The array of bytes to be written to this BLOB. - @return The number of bytes written to the BLOB. - - @exception SQLException If there is an error accessing the BLOB or if the position - specified is greater than the length of the BLOB. - **/ - public synchronized int setBytes(long position, byte[] bytesToWrite) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int offset = (int)position-1; - - if (offset < 0 || offset >= maxLength_ || bytesToWrite == null) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - // We will write as many bytes as we can. If our internal byte array - // would overflow past the 2 GB boundary, we don't throw an error, we just - // return the number of bytes that were set. - int newSize = offset + bytesToWrite.length; - if (newSize < 0) newSize = 0x7FFFFFFF; // In case the addition resulted in overflow. - if (newSize > data_.length) - { - byte[] temp = data_; - data_ = new byte[newSize]; - System.arraycopy(temp, 0, data_, 0, temp.length); - } - int numBytes = newSize - offset; - System.arraycopy(bytesToWrite, 0, data_, offset, numBytes); - - return numBytes; - } - - - - /** - Writes all or part of the byte array the application passes in to this BLOB, - starting at position position in the BLOB. - The BLOB will be truncated after the last byte written. The lengthOfWrite - bytes written will start from offset in the bytes that were provided by the - application. - - @param position The position (1-based) in the BLOB where writes should start. - @param bytesToWrite The array of bytes to be written to this BLOB. - @param offset The offset into the array at which to start reading bytes (0-based). - @param lengthOfWrite The number of bytes to be written to the BLOB from the array of bytes. - @return The number of bytes written. - - @exception SQLException If there is an error accessing the BLOB or if the position - specified is greater than the length of the BLOB. - **/ - public synchronized int setBytes(long position, byte[] bytesToWrite, int offset, int lengthOfWrite) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int blobOffset = (int)position-1; - if (blobOffset < 0 || blobOffset >= maxLength_ || - bytesToWrite == null || offset < 0 || lengthOfWrite < 0 || (offset+lengthOfWrite) > bytesToWrite.length || - (blobOffset+lengthOfWrite) > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - // We will write as many bytes as we can. If our internal byte array - // would overflow past the 2 GB boundary, we don't throw an error, we just - // return the number of bytes that were set. - int newSize = blobOffset + lengthOfWrite; - if (newSize < 0) newSize = 0x7FFFFFFF; // In case the addition resulted in overflow. - if (newSize > data_.length) - { - byte[] temp = data_; - data_ = new byte[newSize]; - System.arraycopy(temp, 0, data_, 0, temp.length); - } - int numBytes = newSize - blobOffset; - System.arraycopy(bytesToWrite, offset, data_, blobOffset, numBytes); - - return numBytes; - } - - - - /** - Truncates this BLOB to a length of lengthOfBLOB bytes. - - @param lengthOfBLOB The length, in bytes, that this BLOB should be after - truncation. - - @exception SQLException If there is an error accessing the BLOB. - **/ - public synchronized void truncate(long lengthOfBLOB) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int length = (int)lengthOfBLOB; - if (length < 0 || length > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - byte[] temp = data_; - data_ = new byte[length]; - int numToCopy = length < temp.length ? length : temp.length; - System.arraycopy(temp, 0, data_, 0, numToCopy); - } - - - // @PDA jdbc40 - /** - * This method frees the Blob object and releases the - * resources that it holds. The object is invalid once the free - * method is called. If free is called multiple times, the - * subsequent calls to free are treated as a no-op. - * - * @throws SQLException - * if an error occurs releasing the Blob's resources - */ - public synchronized void free() throws SQLException - { - data_ = null; //@pda make available for GC - } - - // @PDA jdbc40 - /** - * Returns an InputStream object that contains a partial - * Blob value, starting with the byte specified by pos, which - * is length bytes in length. - * - * @param pos - * the offset to the first byte of the partial value to be - * retrieved. The first byte in the Blob is at - * position 1 - * @param length - * the length in bytes of the partial value to be retrieved - * @return InputStream through which the partial - * Blob value can be read. - * @throws SQLException - * if pos is less than 1 or if pos is greater than the number of - * bytes in the Blob or if pos + length is - * greater than the number of bytes in the Blob - */ - public synchronized InputStream getBinaryStream(long pos, long length) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - return new ByteArrayInputStream(data_, (int)pos, (int)length); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCBlobLocator.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCBlobLocator.java deleted file mode 100644 index ccff02555..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCBlobLocator.java +++ /dev/null @@ -1,500 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCBlobLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.OutputStream; -import java.sql.Blob; -import java.sql.SQLException; - -// Note: This code in this class requires understanding of bit manipulation -// and sign extension. Do not attempt to rework this code if you do not -// have a grasp of these concepts. - -// Currently, the database host server only supports 2 GB LOBs. Therefore, -// we validate any long parameters to make sure they are not greater than -// the maximum positive value for a 4-byte int (2 GB). This has the added -// bonus of being able to cast the long down to an int without worrying -// about sign extension. There are some cases where we could allow the -// user to pass in a long greater than 2 GB, but for consistency, we will -// throw an exception. - -// Offset refers to a 0-based index. Position refers to a 1-based index. - - -/** -The AS400JDBCBlobLocator class provides access to binary large -objects. The data is valid only within the current -transaction. -**/ -public class AS400JDBCBlobLocator implements Blob -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - - JDLobLocator locator_; - Object savedObject_; // This is our InputStream or byte[] or whatever that needs to be written if we are batching. - int savedScale_; // This is our length that goes with our savedObject_. - - private byte[] cache_; - private int cacheOffset_; - private static final byte[] INIT_CACHE = new byte[0]; - private int maxLength_; - -/** -Constructs an AS400JDBCBlobLocator object. The data for the -BLOB will be retrieved as requested, directly from the -IBM i system, using the locator handle. - -@param locator The locator. -**/ - AS400JDBCBlobLocator(JDLobLocator locator, Object savedObject, int savedScale) - { - locator_ = locator; - savedObject_ = savedObject; - savedScale_ = savedScale; - maxLength_ = locator_.getMaxLength(); - } - - - -/** -Returns the entire BLOB as a stream of uninterpreted bytes. - -@return The stream. - -@exception SQLException If an error occurs. -**/ - public InputStream getBinaryStream() throws SQLException - { - //Following Native, throw HY010 after free() has been called. Note: NullPointerException if synchronized(null-ref) - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - return new AS400JDBCInputStream(locator_); - } - } - - - -/** -Returns part of the contents of the BLOB. - -@param position The position within the BLOB (1-based). -@param length The length to return. -@return The contents. - -@exception SQLException If the position is not valid, - if the length is not valid, - or an error occurs. -**/ - public byte[] getBytes(long position, int length) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int offset = (int)position-1; - if (offset < 0 || length < 0 || (offset + length) > locator_.getLength()) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - int lengthToUse = (int)locator_.getLength() - offset; - if (lengthToUse <= 0) return new byte[0]; - if (lengthToUse > length) lengthToUse = length; - - DBLobData data = locator_.retrieveData(offset, lengthToUse); - int actualLength = data.getLength(); - byte[] bytes = new byte[actualLength]; - System.arraycopy(data.getRawBytes(), data.getOffset(), bytes, 0, actualLength); - return bytes; - } - } - - - -/** -Returns the handle to this BLOB locator in the database. - -@return The handle to this locator in the database. -**/ - int getHandle() throws SQLException //@free called from rs.updateValue(), which in turn will throw exc back to rs.updateX() caller - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - return locator_.getHandle(); - } - - - -/** -Returns the length of the BLOB. - -@return The length of the BLOB, in bytes. - -@exception SQLException If an error occurs. -**/ - public long length() throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - return locator_.getLength(); - } - } - - // Used for position(). - private void initCache() - { - cacheOffset_ = 0; - cache_ = INIT_CACHE; - } - - // Used for position(). - private int getCachedByte(int index) throws SQLException - { - int realIndex = index - cacheOffset_; - if (realIndex >= cache_.length) - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - int len = (int)locator_.getLength(); - if (len < 0) len = 0x7FFFFFFF; - if ((blockSize+index) > len) blockSize = len-index; - cache_ = getBytes(index+1, blockSize); - cacheOffset_ = index; - realIndex = 0; - } - if (cache_.length == 0) return -1; - return cache_[realIndex]; - } - - -/** -Returns the position at which a pattern is found in the BLOB. - -@param pattern The pattern. -@param position The position within the BLOB to begin - searching (1-based). -@return The offset into the BLOB at which the pattern was found, - or -1 if the pattern was not found or the pattern was a byte - array of length 0. - -@exception SQLException If the position is not valid or an error occurs. -**/ - public long position(byte[] pattern, long position) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int offset = (int)position-1; - if (pattern == null || offset < 0 || offset >= locator_.getLength()) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - int end = (int)locator_.getLength() - pattern.length; - - // We use a cache of bytes so we don't have to read in the entire - // contents of the BLOB. - initCache(); - - for (int i=offset; i<=end; ++i) - { - int j = 0; - int cachedByte = getCachedByte(i+j); - while (j < pattern.length && cachedByte != -1 && pattern[j] == (byte)cachedByte) - { - ++j; - cachedByte = getCachedByte(i+j); - } - if (j == pattern.length) return i+1; - } - return -1; - } - } - - - -/** -Returns the position at which a pattern is found in the BLOB. - -@param pattern The pattern. -@param position The position within the BLOB to begin - searching (1-based). -@return The offset into the BLOB at which the pattern was found, - or -1 if the pattern was not found or the pattern was a byte - array of length 0. - -@exception SQLException If the position is not valid or an error occurs. -**/ - public long position(Blob pattern, long position) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int offset = (int)position-1; - if (pattern == null || offset < 0 || offset >= locator_.getLength()) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - int patternLength = (int)pattern.length(); - int locatorLength = (int)locator_.getLength(); - if (patternLength > locatorLength || patternLength < 0) return -1; - - int end = locatorLength - patternLength; - - byte[] bytePattern = pattern.getBytes(1L, patternLength); //@CRS - Get all bytes for now, improve this later. - - // We use a cache of bytes so we don't have to read in the entire - // contents of the BLOB. - initCache(); - - for (int i=offset; i<=end; ++i) - { - int j = 0; - int cachedByte = getCachedByte(i+j); - while (j < patternLength && cachedByte != -1 && bytePattern[j] == (byte)cachedByte) - { - ++j; - cachedByte = getCachedByte(i+j); - } - if (j == patternLength) return i+1; - } - - return -1; - } - } - - - /** - Returns a stream that an application can use to write to this BLOB. - The stream begins at position position. - - @param position The position (1-based) in the BLOB where writes should start. - @return An OutputStream object to which data can be written by an application. - @exception SQLException If there is an error accessing the BLOB or if the position - specified is greater than the length of the BLOB. - **/ - public OutputStream setBinaryStream(long position) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - if (position <= 0 || position > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - return new AS400JDBCBlobLocatorOutputStream(this, position); - } - - - - /** - Writes an array of bytes to this BLOB, starting at position position - in the BLOB. - - @param position The position (1-based) in the BLOB where writes should start. - @param bytesToWrite The array of bytes to be written to this BLOB. - @return The number of bytes written to the BLOB. - - @exception SQLException If there is an error accessing the BLOB or if the position - specified is greater than the length of the BLOB. - **/ - public int setBytes(long position, byte[] bytesToWrite) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int offset = (int)position-1; - - if (offset < 0 || offset >= maxLength_ || bytesToWrite == null) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - // We will write as many bytes as we can. If the byte array - // would overflow past the 2 GB boundary, we don't throw an error, we just - // return the number of bytes that could be set. - int newSize = offset + bytesToWrite.length; - if (newSize < 0) newSize = 0x7FFFFFFF; // In case the addition resulted in overflow. - int numBytes = newSize - offset; - if (numBytes != bytesToWrite.length) - { - byte[] temp = bytesToWrite; - bytesToWrite = new byte[numBytes]; - System.arraycopy(temp, 0, bytesToWrite, 0, numBytes); - } - - // We don't really know if all of these bytes can be written until we go to - // the system, so we just return the byte[] length as the number written. - locator_.writeData((long)offset, bytesToWrite, false); //@K1A - return bytesToWrite.length; - } - } - - - - /** - Writes all or part of the byte array the application passes in to this BLOB, - starting at position position in the BLOB. - The lengthOfWrite - bytes written will start from offset in the bytes that were provided by the - application. - - @param position The position (1-based) in the BLOB where writes should start. - @param bytesToWrite The array of bytes to be written to this BLOB. - @param offset The offset into the array at which to start reading bytes (0-based). - @param lengthOfWrite The number of bytes to be written to the BLOB from the array of bytes. - @return The number of bytes written. - - @exception SQLException If there is an error accessing the BLOB or if the position - specified is greater than the length of the BLOB. - **/ - public int setBytes(long position, byte[] bytesToWrite, int offset, int lengthOfWrite) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int blobOffset = (int)position-1; - if (blobOffset < 0 || blobOffset >= maxLength_ || - bytesToWrite == null || offset < 0 || lengthOfWrite < 0 || (offset+lengthOfWrite) > bytesToWrite.length || - (blobOffset+lengthOfWrite) > maxLength_) - { - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - // We will write as many bytes as we can. If the byte array - // would overflow past the 2 GB boundary, we don't throw an error, we just - // return the number of bytes that could be set. - int newSize = blobOffset + lengthOfWrite; - if (newSize < 0) newSize = 0x7FFFFFFF; // In case the addition resulted in overflow. - int numBytes = newSize - blobOffset; - int realLength = (numBytes < lengthOfWrite ? numBytes : lengthOfWrite); - byte[] newData = new byte[realLength]; - System.arraycopy(bytesToWrite, offset, newData, 0, lengthOfWrite); - - // We don't really know if all of these bytes can be written until we go to - // the system, so we just return the byte[] length as the number written. - locator_.writeData((long)blobOffset, newData, false); //@K1A - return newData.length; - } - } - - - - /** - Truncates this BLOB to a length of lengthOfBLOB bytes. - - @param lengthOfBLOB The length, in bytes, that this BLOB should be after - truncation. - - @exception SQLException If there is an error accessing the BLOB or if the length - specified is greater than the length of the BLOB. - **/ - public void truncate(long lengthOfBLOB) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int length = (int)lengthOfBLOB; - if (length < 0 || length > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - // The host server does not currently provide a way for us - // to truncate the temp space used to hold the locator data, - // so we just keep track of it ourselves. This should work, - // since the temp space on the system should only be valid - // within the scope of our transaction/connection. That means - // there's no reason to go to the system to update the data, - // since no other process can get at it. - locator_.writeData(length, new byte[0], 0, 0, true); //@K1A - } - } - - //@PDA 550 - /** - * This method frees the Blob object and releases the - * resources that it holds. The object is invalid once the free - * method is called. If free is called multiple times, the - * subsequent calls to free are treated as a no-op. - * - * @throws SQLException - * if an error occurs releasing the Blob's resources - */ - public void free() throws SQLException //@sync - { - if(locator_ == null) - return; //no-op - - synchronized(locator_) //@sync - { - locator_.free(); - - locator_ = null; //@pda make objects available for GC - savedObject_ = null; - cache_ = null; - } - } - - - // @PDA jdbc40 - /** - * Returns an InputStream object that contains a partial - * Blob value, starting with the byte specified by pos, which - * is length bytes in length. - * - * @param pos - * the offset to the first byte of the partial value to be - * retrieved. The first byte in the Blob is at - * position 1 - * @param length - * the length in bytes of the partial value to be retrieved - * @return InputStream through which the partial - * Blob value can be read. - * @throws SQLException - * if pos is less than 1 or if pos is greater than the number of - * bytes in the Blob or if pos + length is - * greater than the number of bytes in the Blob - */ - public InputStream getBinaryStream(long pos, long length) throws SQLException //@sync - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - return new AS400JDBCInputStream(locator_, pos, length); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCBlobLocatorOutputStream.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCBlobLocatorOutputStream.java deleted file mode 100644 index 8035cc753..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCBlobLocatorOutputStream.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCBlobLocatorOutputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.*; - -final class AS400JDBCBlobLocatorOutputStream extends AS400JDBCOutputStream -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - private AS400JDBCBlobLocator blob_; - - AS400JDBCBlobLocatorOutputStream(AS400JDBCBlobLocator blob, long position) - { - super(position); - blob_ = blob; - } - - int doWrite(long position, byte data) throws SQLException - { - synchronized(blob_) - { - JDLobLocator locator = blob_.locator_; - synchronized(locator) - { - return locator.writeData(position-1, data, true); //@K1A - } - } - } - - int doWrite(long position, byte[] data, int offset, int length) throws SQLException - { - synchronized(blob_) - { - JDLobLocator locator = blob_.locator_; - synchronized(locator) - { - return locator.writeData(position-1, data, offset, length, true); //@K1A - } - } - } -} - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCBlobOutputStream.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCBlobOutputStream.java deleted file mode 100644 index 24840d2dd..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCBlobOutputStream.java +++ /dev/null @@ -1,42 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCBlobOutputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.*; - -final class AS400JDBCBlobOutputStream extends AS400JDBCOutputStream -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - private AS400JDBCBlob blob_; - - AS400JDBCBlobOutputStream(AS400JDBCBlob blob, long position) - { - super(position); - blob_ = blob; - } - - int doWrite(long position, byte data) throws SQLException - { - return blob_.setByte(position, data); - } - - int doWrite(long position, byte[] data, int offset, int length) throws SQLException - { - return blob_.setBytes(position, data, offset, length); - } -} - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCCallableStatement.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCCallableStatement.java deleted file mode 100644 index 91f8a7688..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCCallableStatement.java +++ /dev/null @@ -1,4413 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCCallableStatement.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; //@G4A -import java.io.Reader; //@G4A -import java.math.BigDecimal; -import java.net.MalformedURLException; //@G4A -import java.net.URL; //@G4A -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -import java.sql.Clob; -import java.sql.DataTruncation; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -endif */ -import java.sql.Ref; -/* ifdef JDBC40 -import java.sql.ResultSet; //@G4A -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -import java.sql.Statement; //@G4A -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.sql.Types; -import java.util.Calendar; -import java.util.Map; -/* ifdef JDBC40 -import java.util.Hashtable; //@G4A -import java.util.Vector; -endif */ - - -/** -

        The AS400JDBCCallableStatement class runs a stored procedure. -Use Connection.prepareCall() to create new CallableStatement -objects. - -

        Parameters are indexed sequentially, by number, starting -at 1. The caller must register output parameters before executing -the stored procedure. - -

        The new JDK 1.4 methods add the ability to -retrieve information by column name in addition to column index. -Be aware you will see better performance accessing columns by their -index rather than accessing them by their name. -**/ -public class AS400JDBCCallableStatement -extends AS400JDBCPreparedStatement -implements CallableStatement -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - static final int NO_VALIDATION_ = -9999; - - private int[] registeredTypes_; // array of types to track what the user registers the output parm as - private boolean[] registered_; // array of booleans to keep track of which parameters were registered - - private boolean returnValueParameterRegistered_; // @E2A - private boolean wasNull_; - private boolean wasDataMappingError_; - - //private String[] parameterNames_; //@PDD jdbc40 move to preparedStatement - private int maxToLog_ = 10000; // Log value of parameter markers up to this length // @G7A - - /** - Constructs an AS400JDBCCallableStatement object. - - @param connection The connection to the system. - @param id The id. - @param transactionManager The transaction manager for the connection. - @param packageManager The package manager for the connection. - @param blockCriteria The block criteria. - @param blockSize The block size (in KB). - @param sqlStatement The SQL statement. - @parma packageCriteria The package criteria. - @param resultSetType The result set type. - @param resultSetConcurrency The result set concurrency. - @param resultSetHoldability The result set holdability. - @param generatedKeysRequested The generated keys requested. - - @exception SQLException If the SQL statement contains a syntax - error or an error occurs. - **/ - AS400JDBCCallableStatement(AS400JDBCConnection connection, - int id, - JDTransactionManager transactionManager, - JDPackageManager packageManager, - String blockCriteria, - int blockSize, - JDSQLStatement sqlStatement, - String packageCriteria, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability, //@G4A - int generatedKeysRequested) //@G4A - throws SQLException - { - // Turn off pre-fetch, since the output parameter values - // come back as result data. If we prefetched data, - // we would not be able to differentiate between - // pre-fetched data from the output parameter values. - super(connection, id, transactionManager, - packageManager, blockCriteria, blockSize, - false, sqlStatement, true, packageCriteria, - resultSetType, resultSetConcurrency, resultSetHoldability, - generatedKeysRequested); - - registeredTypes_ = new int[parameterCount_]; - registered_ = new boolean[parameterCount_]; - for(int i = 0; i < parameterCount_; ++i) - { - registered_[i] = false; - } - - returnValueParameterRegistered_ = false; // @E2A - - wasNull_ = false; - wasDataMappingError_ = false; - } - - // @C1A - /** - Performs common operations needed before an execute. - - @param sqlStatement The SQL statement. - @param request The execute request. - - @exception SQLException If an error occurs. - **/ - void commonExecuteBefore(JDSQLStatement sqlStatement, DBSQLRequestDS request) - throws SQLException - { - // Validate each parameters. If a parameter is not an - // output parameter, then it is okay for it not to have been - // registered. However, if an output parameter was not - // registered, we throw an exception. - for(int i = 0; i < parameterCount_; ++i) - if((registered_[i] == false) && (parameterRow_.isOutput(i+1))) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_COUNT_MISMATCH); - - super.commonExecuteBefore(sqlStatement, request); - } - - //@G4A - /* - Find the column index that matches this parameter name. - @param parameterName The parameter name to change into a column index (1-based). - */ - //@PDD jdbc40 move method to preparedStatement - /*int findParameterIndex(String parameterName) - throws SQLException - { - // Throw an exception if null was passed in - if(parameterName == null) - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - // Throw an exception if the Statement is closed (FUNCTION SEQUENCE) - if(isClosed()) - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - - boolean caseSensitive = false; - int count = 0; - int returnParm = 0; - - // determine if our search should be case insensitive or not - if(parameterName.startsWith("\"") && parameterName.endsWith("\"")) // assume no leading or trailing blanks - - { - parameterName = JDUtilities.stripOuterDoubleQuotes(parameterName); - - caseSensitive = true; - } - - // If we have a cache created, try to find the column name in it. - if(parameterNames_ != null) - { - // Look up the mapping in our cache. - while(count < parameterNames_.length) - { - if (parameterNames_[count] != null) - { - if((caseSensitive && parameterNames_[count].equals(parameterName)) - || (!caseSensitive && parameterNames_[count].equalsIgnoreCase(parameterName))) - { - returnParm = count+1; - break; - } - } - - ++count; - } - } - else - { - // Else, create a new hash table to hold all the column name/number mappings. - parameterNames_ = new String[parameterCount_]; - - // Cache all the parm names and numbers. - Statement s = null; //@scan1 - ResultSet rs = null; //@scan1 - try{ - s = connection_.createStatement(); - String catalogSeparator = ""; //@74A Added a check for the naming used. Need to use separator appropriate to naming. - if (connection_.getProperties().equals (JDProperties.NAMING, JDProperties.NAMING_SQL)) //@74A - catalogSeparator = "."; //@74A - else //@74A - catalogSeparator = "/"; //@74A - - String schema = sqlStatement_.getSchema(); - if(schema == null || schema.equals("")) // no schema in statement - { // Derive the schema. - schema = connection_.getDefaultSchema(true); // get raw value - - if(schema == null) // No default SQL schema was set on the connection url, or by the libraries connection property. - { - if(catalogSeparator.equals(".")) // using sql naming - { - schema = connection_.getUserName(); // set to user profile - } - else // using system naming - { - // Retrieve the library list from the IBM i - Use ROI Retrieve Library List. - ResultSet rs1 = JDUtilities.getLibraries(this, connection_, null, true); - Vector libListV = new Vector(); - while(rs1.next()) { - libListV.addElement(rs1.getString(1)); - } - rs1.close(); //@SS - String[] libList = new String[libListV.size()]; - libListV.toArray(libList); - - // Get a result set that we can scroll forward/backward through. - Statement s1 = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - rs = s1.executeQuery("SELECT ROUTINE_SCHEMA FROM QSYS2" - + catalogSeparator - + "SYSPROCS WHERE ROUTINE_NAME='" - + unquote(sqlStatement_.getProcedure()) - + "' AND IN_PARMS + OUT_PARMS + INOUT_PARMS = " - + parameterCount_);//@scan1 - if(!rs.next()) - JDError.throwSQLException(this, JDError.EXC_INTERNAL); // didn't find the procedure in any schema - - // If we get this far, at least one schema contains a procedure similar to ours. - boolean found = false; - for(int i=0; i parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.ARRAY) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - Array value = (data == null) ? null : data.getArray(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL ARRAY output parameter as an Array value. - DB2 for IBM i does not support arrays. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - **/ - public Array getArray(String parameterName) - throws SQLException - { - return getArray(findParameterIndex(parameterName)); //@array3 - } - - // JDBC 2.0 - /** - Returns the value of an SQL NUMERIC or DECIMAL output parameter as a - BigDecimal object. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public BigDecimal getBigDecimal(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registeredTypes_[parameterIndex-1] == -1) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.NUMERIC && registeredTypes_[parameterIndex-1] != Types.DECIMAL) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - BigDecimal value = (data == null) ? null : data.getBigDecimal(-1); - testDataTruncation(parameterIndex, data); - return value; - } - } - - /** - Returns the value of an SQL NUMERIC or DECIMAL output parameter as a - BigDecimal object. - - @param parameterIndex The parameter index (1-based). - @param scale The number of digits after the decimal. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the scale is not valid, - the statement was not executed, or - the requested conversion is not valid. - - @deprecated Use getBigDecimal(int) or getBigDecimal(String) instead. - @see #getBigDecimal(int) - **/ - public BigDecimal getBigDecimal(int parameterIndex, int scale) - throws SQLException - { - // Check for negative scale. - if(scale < 0) - JDError.throwSQLException(this, JDError.EXC_SCALE_INVALID); - - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.NUMERIC && registeredTypes_[parameterIndex-1] != Types.DECIMAL) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - BigDecimal value = (data == null) ? null : data.getBigDecimal(scale); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL NUMERIC or DECIMAL output parameter as a - BigDecimal object. - - @param parameterName The parameter name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public BigDecimal getBigDecimal(String parameterName) - throws SQLException - { - return getBigDecimal(findParameterIndex(parameterName)); - } - - // JDBC 2.0 - /** - Returns the value of an SQL BLOB output parameter as a Blob value. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Blob getBlob(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.BLOB) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - Blob value = (data == null) ? null : data.getBlob(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL BLOB output parameter as a Blob value. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Blob getBlob(String parameterName) - throws SQLException - { - return getBlob(findParameterIndex(parameterName)); - } - - /** - Returns the value of an SQL SMALLINT output parameter as a - Java boolean. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or false if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIT, but DB2 for IBM i - // does not support that. - // - public boolean getBoolean(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - // 16 is the value of Types.BOOLEAN added for JDK 1.4 - if(registeredTypes_[parameterIndex-1] != Types.SMALLINT && - registeredTypes_[parameterIndex-1] != Types.TINYINT && - registeredTypes_[parameterIndex-1] != 16) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - boolean value = (data == null) ? false : data.getBoolean(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL SMALLINT output parameter as a - Java boolean. - - @param parameterName The parameter name. - @return The parameter value or false if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIT, but DB2 for IBM i - // does not support that. - // - public boolean getBoolean(String parameterName) - throws SQLException - { - return getBoolean(findParameterIndex(parameterName)); - } - - /** - Returns the value of an SQL SMALLINT output parameter as a - Java byte. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid, - or an error occurs. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL TINYINT, but DB2 for IBM i - // does not support that. - // - public byte getByte(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.SMALLINT && registeredTypes_[parameterIndex-1] != Types.TINYINT) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - byte value = (data == null) ? 0 : data.getByte(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL SMALLINT output parameter as a - Java byte. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid, - or an error occurs. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL TINYINT, but DB2 for IBM i - // does not support that. - // - public byte getByte(String parameterName) - throws SQLException - { - return getByte(findParameterIndex(parameterName)); - } - - /** - Returns the value of an SQL BINARY or VARBINARY output parameter as a - Java byte array. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public byte[] getBytes(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - //if(registeredTypes_[parameterIndex-1] != Types.BINARY && registeredTypes_[parameterIndex-1] != Types.VARBINARY) - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - byte[] value = (data == null) ? null : data.getBytes(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL BINARY or VARBINARY output parameter as a - Java byte array. - - @param parameterName The parameter name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public byte[] getBytes(String parameterName) - throws SQLException - { - return getBytes(findParameterIndex(parameterName)); - } - - // JDBC 2.0 - /** - Returns the value of an SQL CLOB output parameter as a Clob value. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Clob getClob(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.CLOB) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - Clob value = (data == null) ? null : data.getClob(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL CLOB output parameter as a Clob value. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Clob getClob(String parameterName) - throws SQLException - { - return getClob(findParameterIndex(parameterName)); - } - - /** - Returns the value of an SQL DATE output parameter as a - java.sql.Date object using the default calendar. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Date getDate(int parameterIndex) - throws SQLException - { - return getDate(parameterIndex, Calendar.getInstance()); - } - - // JDBC 2.0 - /** - Returns the value of an SQL DATE output parameter as a - java.sql.Date object using a calendar other than the default. - - @param parameterIndex The parameter index (1-based). - @param calendar The calendar. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, - the calendar is null, or - the requested conversion is not valid. - **/ - public Date getDate(int parameterIndex, Calendar calendar) - throws SQLException - { - // Check for null calendar. - if(calendar == null) - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.DATE) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - Date value = (data == null) ? null : data.getDate(calendar); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL DATE output parameter as a - java.sql.Date object using the default calendar. - - @param parameterName The parameter name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - - public Date getDate(String parameterName) - throws SQLException - { - return getDate(findParameterIndex(parameterName)); - } - - // JDBC 2.0 - /** - Returns the value of an SQL DATE output parameter as a - java.sql.Date object using a calendar other than the default. - - @param parameterName The parameter name. - @param calendar The calendar. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, - the calendar is null, or - the requested conversion is not valid. - **/ - public Date getDate(String parameterName, Calendar calendar) - throws SQLException - { - return getDate(findParameterIndex(parameterName), calendar); - } - - /** - Returns the value of an SQL DOUBLE or FLOAT output parameter as a - Java double. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public double getDouble(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.DOUBLE && registeredTypes_[parameterIndex-1] != Types.FLOAT) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - double value = (data == null) ? 0 : data.getDouble(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL DOUBLE or FLOAT output parameter as a - Java double. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public double getDouble(String parameterName) - throws SQLException - { - return getDouble(findParameterIndex(parameterName)); - } - - /** - Returns the value of an SQL REAL or FLOAT output parameter as a - Java float. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public float getFloat(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.REAL && registeredTypes_[parameterIndex-1] != Types.FLOAT) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - float value = (data == null) ? 0 : data.getFloat(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL REAL or FLOAT output parameter as a - Java float. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public float getFloat(String parameterName) - throws SQLException - { - return getFloat(findParameterIndex(parameterName)); - } - - /** - Returns the value of an SQL INTEGER output parameter as a - Java int. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public int getInt(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.INTEGER) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - int value = (data == null) ? 0 : data.getInt(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL INTEGER output parameter as a - Java int. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public int getInt(String parameterName) - throws SQLException - { - return getInt(findParameterIndex(parameterName)); - } - - // @D0C - /** - If the connected system supports SQL BIGINT data, this returns - the value of an SQL BIGINT output parameter as a Java long. - Otherwise, this returns the value of an SQL INTEGER output - parameter as a Java long. SQL BIGINT data is supported on V4R5 - and later. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIGINT, but DB2 for IBM i - // does not support that until V4R5. - // - public long getLong(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(connection_.getVRM() >= JDUtilities.vrm450) - { - if(registeredTypes_[parameterIndex-1] != Types.BIGINT) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - else - { - if(registeredTypes_[parameterIndex-1] != Types.INTEGER) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - long value = (data == null) ? 0 : data.getLong(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - If the connected system supports SQL BIGINT data, this returns - the value of an SQL BIGINT output parameter as a Java long. - Otherwise, this returns the value of an SQL INTEGER output - parameter as a Java long. SQL BIGINT data is supported on V4R5 - and later. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIGINT, but DB2 for IBM i - // does not support that until V4R5. - // - public long getLong(String parameterName) - throws SQLException - { - return getLong(findParameterIndex(parameterName)); - } - - /** - Returns the value of an output parameter as a Java Object. - The type of the object corresponds to the SQL type that was - registered for this parameter using registerOutParameter(). - When the parameter is a user-defined type, then the - connection's type map is used to create the object. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Object getObject(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - if(data == null) - return null; - Object value = (data == null) ? null : data.getObject(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - // JDBC 2.0 - /** - Returns the value of an output parameter as a Java Object. - This driver does not support the type map. - - @param parameterIndex The parameter index (1-based). - @param typeMap The type map. This is not used. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Object getObject(int parameterIndex, Map typeMap) - throws SQLException - { - // Check for null type map, even though we don't use it. - if(typeMap == null) - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - return getObject(parameterIndex); - } - - //@G4A JDBC 3.0 - /** - Returns the value of an output parameter as a Java Object. - The type of the object corresponds to the SQL type that was - registered for this parameter using registerOutParameter(). - When the parameter is a user-defined type, then the - connection's type map is used to create the object. - - @param parameterName The parameter name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Object getObject(String parameterName) - throws SQLException - { - return getObject(findParameterIndex(parameterName)); - } - - //@G4A JDBC 3.0 - /** - Returns the value of an output parameter as a Java Object. - This driver does not support the type map. - - @param parameterName The parameter name. - @param typeMap The type map. This is not used. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Object getObject(String parameterName, Map typeMap) - throws SQLException - { - return getObject(findParameterIndex(parameterName)); - } - - // JDBC 2.0 - /** - Returns the value of an SQL REF output parameter as a Ref value. - DB2 for IBM i does not support structured types. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support REFs. - **/ - public Ref getRef(int parameterIndex) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL REF output parameter as a Ref value. - DB2 for IBM i does not support structured types. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support REFs. - **/ - public Ref getRef(String parameterName) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - /** - Returns the value of an SQL SMALLINT output parameter as a - Java short value. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public short getShort(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.SMALLINT) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - short value = (data == null) ? 0 : data.getShort(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL SMALLINT output parameter as a - Java short value. - - @param parameterName The parameter name. - @return The parameter value or 0 if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public short getShort(String parameterName) - throws SQLException - { - return getShort(findParameterIndex(parameterName)); - } - - /** - Returns the value of an SQL CHAR or VARCHAR output - parameter as a Java String object. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public String getString(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - //if(registeredTypes_[parameterIndex-1] != Types.CHAR && registeredTypes_[parameterIndex-1] != Types.VARCHAR) - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - String value = (data == null) ? null : data.getString(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL CHAR or VARCHAR output - parameter as a Java String object. - - @param parameterName The parameter name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public String getString(String parameterName) - throws SQLException - { - return getString(findParameterIndex(parameterName)); - } - - /** - Returns the value of an SQL TIME output parameter as a - java.sql.Time object using the default calendar. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Time getTime(int parameterIndex) - throws SQLException - { - return getTime(parameterIndex, Calendar.getInstance()); - } - - // JDBC 2.0 - /** - Returns the value of an SQL TIME output parameter as a - java.sql.Time object using a calendar other than the - default. - - @param parameterIndex The parameter index (1-based). - @param calendar The calendar. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, - the calendar is null, or - the requested conversion is not valid. - **/ - public Time getTime(int parameterIndex, Calendar calendar) - throws SQLException - { - // Check for null calendar. - if(calendar == null) - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.TIME) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - Time value = (data == null) ? null : data.getTime(calendar); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL TIME output parameter as a - java.sql.Time object using the default calendar. - - @param parameterName The parameter name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Time getTime(String parameterName) - throws SQLException - { - return getTime(findParameterIndex(parameterName)); - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL TIME output parameter as a - java.sql.Time object using a calendar other than the - default. - - @param parameterName The parameter name. - @param calendar The calendar. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, - the calendar is null, or - the requested conversion is not valid. - **/ - public Time getTime(String parameterName, Calendar calendar) - throws SQLException - { - return getTime(findParameterIndex(parameterName), calendar); - } - - /** - Returns the value of an SQL TIMESTAMP output parameter as a - java.sql.Timestamp object using the default calendar. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Timestamp getTimestamp(int parameterIndex) - throws SQLException - { - return getTimestamp(parameterIndex, Calendar.getInstance()); - } - - // JDBC 2.0 - /** - Returns the value of an SQL TIMESTAMP output parameter as a - java.sql.Timestamp object using a calendar other than the - default. - - @param parameterIndex The parameter index (1-based). - @param calendar The calendar. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, - the calendar is null, or - the requested conversion is not valid. - **/ - public Timestamp getTimestamp(int parameterIndex, Calendar calendar) - throws SQLException - { - // Check for null calendar. - if(calendar == null) - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.TIMESTAMP) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - Timestamp value = (data == null) ? null : data.getTimestamp(calendar); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL TIMESTAMP output parameter as a - java.sql.Timestamp object using the default calendar. - - @param parameterName The parameter name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - public Timestamp getTimestamp(String parameterName) - throws SQLException - { - return getTimestamp(findParameterIndex(parameterName)); - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL TIMESTAMP output parameter as a - java.sql.Timestamp object using a calendar other than the - default. - - @param parameterName The parameter name. - @param calendar The calendar. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed, - the calendar is null, or - the requested conversion is not valid. - **/ - public Timestamp getTimestamp(String parameterName, Calendar calendar) - throws SQLException - { - return getTimestamp(findParameterIndex(parameterName), calendar); - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL DATALINK output parameter as a - java.net.URL object. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed or - the requested conversion is not valid. - **/ - public URL getURL(int parameterIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.CHAR && - registeredTypes_[parameterIndex-1] != Types.VARCHAR && - registeredTypes_[parameterIndex-1] != Types.DATALINK) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - String value = (data == null) ? null : data.getString(); - testDataTruncation(parameterIndex, data); - - try - { - return new java.net.URL(value); - } - catch(MalformedURLException e) - { - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID, e); - return null; - } - } - } - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL DATALINK output parameter as a - java.net.URL object. - - @param parameterName The parameter name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the name is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed or - the requested conversion is not valid. - **/ - public URL getURL(String parameterName) - throws SQLException - { - return getURL(findParameterIndex(parameterName)); - } - - /** - Returns the value for an output parameter for the specified - index, and performs all appropriate validation. Also checks - for SQL NULL. - - @param parameterIndex The parameter index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the index is - not registered as an output parameter, - the statement was not executed, or - the requested conversion is not valid. - **/ - private SQLData getValue(int parameterIndex) - throws SQLException - { - // Verify that the statement has been executed. - if(! executed_) - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - - // Get the data and check for SQL NULL. - SQLData data = parameterRow_.getSQLData(parameterIndex); - wasNull_ = parameterRow_.isNull(parameterIndex); - wasDataMappingError_ = parameterRow_.isDataMappingError(parameterIndex); - - return wasNull_ ? null : data; - } - - /** - Registers the type for an output parameter. Before - executing the stored procedure call, explicitly - register the type of each output parameter. When - reading the value of an output parameter, use a - get method that corresponds to the registered type. A - parameter that is used for both input and output can not - be registered with a different type than was used when - it was set. - - @param parameterIndex The parameter index (1-based). - @param sqlType The SQL type code defined in java.sql.Types. - @param scale The number of digits after the decimal - if sqlType is DECIMAL or NUMERIC. - - @exception SQLException If the index is not valid, - the scale is not valid, - the parameter is not an output parameter, - or the requested conversion is not valid. - **/ - public void registerOutParameter(int parameterIndex, - int sqlType, - int scale) - throws SQLException - { - synchronized(internalLock_) - { // @E1A - checkOpen(); - - // Check if the parameter index refers to the return value parameter. @E2A - // If so, it must be registed as an INTEGER. @E2A - // If it is not parameter index 1, then decrement the parameter index, @E2A - // since we are "faking" the return value parameter. @E2A - if(useReturnValueParameter_) - { // @E2A - if(parameterIndex == 1) - { // @E2A - if(sqlType != Types.INTEGER) // @E2A - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); // @E2A - returnValueParameterRegistered_ = true; // @E2A - return; // @E2A - } // @E2A - else // @E2A - --parameterIndex; // @E2A - } // @E2A - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Validate the scale. - if(scale < 0) - JDError.throwSQLException(this, JDError.EXC_SCALE_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - registeredTypes_[parameterIndex-1] = sqlType; - registered_[parameterIndex-1] = true; - } - } - - /** - Registers the type for an output parameter. Before - executing the stored procedure call, explicitly - register the type of each output parameter. When - reading the value of an output parameter, use a - get method that corresponds to the registered type. A - parameter that is used for both input and output can not - be registered with a different type than was used when - it was set. - - @param parameterIndex The parameter index (1-based). - @param sqlType The SQL type code defined in java.sql.Types. - - @exception SQLException If the index is not valid, - the parameter is not an output parameter, - or the requested conversion is not valid. - **/ - public void registerOutParameter(int parameterIndex, int sqlType) - throws SQLException - { - registerOutParameter(parameterIndex, sqlType, 0); - } - - // @A1 - Added for JDK 2.0RC1 - typeName can be ignored, since it is not relevant to the AS/400. - /** - Registers the type for an output parameter. Before - executing the stored procedure call, explicitly - register the type of each output parameter. When - reading the value of an output parameter, use a - get method that corresponds to the registered type. A - parameter that is used for both input and output can not - be registered with a different type than was used when - it was set. - - @param parameterIndex The parameter index (1-based). - @param sqlType The SQL type code defined in java.sql.Types. - @param typeName The fully-qualified name of an SQL structured type. This value will be ignored. - - @exception SQLException If the index is not valid, - the parameter is not an output parameter, - or the requested conversion is not valid. - **/ - public void registerOutParameter(int parameterIndex, int sqlType, String typeName) - throws SQLException - { - registerOutParameter(parameterIndex, sqlType, 0); - } - - //@G4A JDBC 3.0 - /** - Registers the type for an output parameter. Before - executing the stored procedure call, explicitly - register the type of each output parameter. When - reading the value of an output parameter, use a - get method that corresponds to the registered type. A - parameter that is used for both input and output can not - be registered with a different type than was used when - it was set. - - @param parameterName The parameter name. - @param sqlType The SQL type code defined in java.sql.Types. - - @exception SQLException If the index is not valid, - the parameter is not an output parameter, - or the requested conversion is not valid. - **/ - public void registerOutParameter(String parameterName, int sqlType) - throws SQLException - { - registerOutParameter(findParameterIndex(parameterName), sqlType, 0); - } - - //@G4A JDBC 3.0 - /** - Registers the type for an output parameter. Before - executing the stored procedure call, explicitly - register the type of each output parameter. When - reading the value of an output parameter, use a - get method that corresponds to the registered type. A - parameter that is used for both input and output can not - be registered with a different type than was used when - it was set. - - @param parameterName The parameter name. - @param sqlType The SQL type code defined in java.sql.Types. - @param scale The number of digits after the decimal - if sqlType is DECIMAL or NUMERIC. - - @exception SQLException If the index is not valid, - the scale is not valid, - the parameter is not an output parameter, - or the requested conversion is not valid. - **/ - public void registerOutParameter(String parameterName, int sqlType, int scale) - throws SQLException - { - registerOutParameter(findParameterIndex(parameterName), sqlType, scale); - } - - //@G4A JDBC 3.0 - /** - Registers the type for an output parameter. Before - executing the stored procedure call, explicitly - register the type of each output parameter. When - reading the value of an output parameter, use a - get method that corresponds to the registered type. A - parameter that is used for both input and output can not - be registered with a different type than was used when - it was set. - - @param parameterName The parameter name. - @param sqlType The SQL type code defined in java.sql.Types. - @param typeName The fully-qualified name of an SQL structured type. This value will be ignored. - - @exception SQLException If the index is not valid, - the parameter is not an output parameter, - or the requested conversion is not valid. - **/ - public void registerOutParameter(String parameterName, int sqlType, String typeName) - throws SQLException - { - registerOutParameter(findParameterIndex(parameterName), sqlType, 0); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to an ASCII stream value. The driver - reads the data from the stream as needed until no more bytes - are available. The driver converts this to an SQL VARCHAR - value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param length The number of bytes in the stream. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - the length is not valid, - the input stream does not contain all - ASCII characters, or an error occurs - while reading the input stream. - **/ - public void setAsciiStream(String parameterName, InputStream parameterValue, int length) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setAsciiStream()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); // @G7A - } // @G7A - - setAsciiStream(findParameterIndex(parameterName), parameterValue, length); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a BigDecimal value. The driver converts - this to an SQL NUMERIC value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, or the parameter - is not an input parameter. - **/ - public void setBigDecimal(String parameterName, BigDecimal parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setBigDecimal()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setBigDecimal(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a binary stream value. The driver - reads the data from the stream as needed until no more bytes - are available. The driver converts this to an SQL VARBINARY - value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param length The number of bytes in the stream. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - the length is not valid, or - an error occurs while reading the - input stream. - **/ - public void setBinaryStream(String parameterName, InputStream parameterValue, int length) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setBinaryStream()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); // @G7A - } // @G7A - - setBinaryStream(findParameterIndex(parameterName), parameterValue, length); - } - - /** - Sets an input parameter to a Java boolean value. The driver - converts this to an SQL SMALLINT value. - - @param parameterName The parameter name. - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the parameterName is not valid, or - the parameter is not an input parameter. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIT, but DB2 for IBM i - // does not support that. - // - public void setBoolean(String parameterName, boolean parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setBoolean()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue); // @G7A - } // @G7A - - setBoolean(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a Java byte value. The driver - converts this to an SQL SMALLINT value. - - @param parameterName The parameter name. - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or - the parameter is not an input parameter. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL TINYINT, but DB2 for IBM i - // does not support that. - // - public void setByte(String parameterName, byte parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setByte()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue); // @G7A - } // @G7A - - setByte(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a Java byte array value. The driver - converts this to an SQL VARBINARY value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or the parameter - is not an input parameter. - **/ - public void setBytes(String parameterName, byte[] parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setBytes()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setBytes(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a character stream value. The driver - reads the data from the character stream as needed until no more - characters are available. The driver converts this to an SQL - VARCHAR value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param length The number of bytes in the reader. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - the length is not valid, - or an error occurs while reading the - character stream - **/ - public void setCharacterStream(String parameterName, Reader parameterValue, int length) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setCharacterStream()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); // @G7A - } // @G7A - - setCharacterStream(findParameterIndex(parameterName), parameterValue, length); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a java.sql.Date value using the - default calendar. The driver converts this to an SQL DATE - value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or the parameter - is not an input parameter. - - **/ - public void setDate(String parameterName, Date parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setDate()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setDate(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a java.sql.Date value using a - calendar other than the default. The driver converts this - to an SQL DATE value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param cal The calendar. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - or the calendar is null. - - **/ - public void setDate(String parameterName, Date parameterValue, Calendar cal) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setDate()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setDate(findParameterIndex(parameterName), parameterValue, cal); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a Java double value. The driver - converts this to an SQL DOUBLE value. - - @param parameterName The parameter name. - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the parameter name is not valid or - the parameter is not an input parameter. - **/ - public void setDouble(String parameterName, double parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setDouble()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue); // @G7A - } // @G7A - - setDouble(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a Java float value. The driver - converts this to an SQL REAL value. - - @param parameterName The parameter name. - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or - the parameter is not an input parameter. - **/ - // - // Note: The JDBC 1.22 specification states that this - // method should set an SQL FLOAT value. However, - // all tables map float to REAL. Otherwise, - // nothing is symetrical and certain INOUT - // parameters do not work. - // - public void setFloat(String parameterName, float parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setFloat()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue); // @G7A - } // @G7A - - setFloat(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a Java int value. The driver - converts this to an SQL INTEGER value. - - @param parameterName The parameter name. - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the parameter name is not valid or - the parameter is not an input parameter. - **/ - public void setInt(String parameterName, int parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setInt()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue); // @G7A - } // @G7A - - setInt(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a Java long value. - If the connected system supports SQL BIGINT data, the driver - converts this to an SQL BIGINT value. Otherwise, the driver - converts this to an SQL INTEGER value. SQL BIGINT data is - supported on V4R5 and later. - - @param parameterName The parameter name. - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or - the parameter is not an input parameter. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIGINT, but DB2 for IBM i - // does not support that until V4R5. - // - public void setLong(String parameterName, long parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setLong()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue); // @G7A - } // @G7A - - setLong(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to SQL NULL. - - @param parameterName The parameter name. - @param sqlType The SQL type code defined in java.sql.Types. - - @exception SQLException If the statement is not open, - the parameterName is not valid, - the parameter is not an input parameter, - or the SQL type is not valid. - **/ - public void setNull(String parameterName, int sqlType) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setNull()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - } // @G7A - - setNull(findParameterIndex(parameterName), sqlType); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to SQL NULL. - - @param parameterName The parameter name. - @param sqlType The SQL type code defined in java.sql.Types. - @param typeName The fully-qualified name of an SQL structured type. This value will be ignored. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - or the SQL type is not valid. - **/ - public void setNull(String parameterName, int sqlType, String typeName) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setNull()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - } // @G7A - - setNull(findParameterIndex(parameterName), sqlType, typeName); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to an Object value. The driver converts - this to a value of an SQL type, depending on the type of the - specified value. The JDBC specification defines a standard - mapping from Java types to SQL types. In the cases where a - SQL type is not supported by DB2 for IBM i, the - next closest matching type - is used. -
        If proxy support is in use, the Object must be serializable. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - the type of value is not supported, - or the parameter is not serializable - (when proxy support is in use). - **/ - public void setObject(String parameterName, Object parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setObject()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " type: " + parameterValue.getClass().getName()); // @G7A - } // @G7A - - setObject(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to an Object value. The driver converts - this to a value with the specified SQL type. -
        If proxy support is in use, the Object must be serializable. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param targetSqlType The SQL type code defined in java.sql.Types. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - the SQL type is not valid, - the scale is not valid, - or the parameter is not serializable - (when proxy support is in use). - **/ - public void setObject(String parameterName, Object parameterValue, int targetSqlType) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setObject()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " type: " + parameterValue.getClass().getName()); // @G7A - } // @G7A - - setObject(findParameterIndex(parameterName), parameterValue, targetSqlType); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to an Object value. The driver converts - this to a value with the specified SQL type. -
        If proxy support is in use, the Object must be serializable. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param targetSqlType The SQL type code defined in java.sql.Types. - @param scale The number of digits after the decimal - if sqlType is DECIMAL or NUMERIC. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - the SQL type is not valid, - the scale is not valid, - or the parameter is not serializable - (when proxy support is in use). - **/ - public void setObject(String parameterName, Object parameterValue, int targetSqlType, int scale) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setObject()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " type: " + parameterValue.getClass().getName()); // @G7A - } // @G7A - - setObject(findParameterIndex(parameterName), parameterValue, targetSqlType, scale); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a Java short value. The driver - converts this to an SQL SMALLINT value. - - @param parameterName The parameter name. - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the parameter name is not valid or - the parameter is not an input parameter. - **/ - public void setShort(String parameterName, short parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setShort()"); // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue); // @G7A - } // @G7A - - setShort(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a String value. The driver - converts this to an SQL VARCHAR value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or the parameter - is not an input parameter. - **/ - public void setString(String parameterName, String parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setString()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else if(parameterValue.length() > maxToLog_) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + parameterValue.length()); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue); // @G7A - } // @G7A - - setString(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a java.sql.Time value using the - default calendar. The driver converts this to an SQL TIME value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or the parameter - is not an input parameter. - **/ - public void setTime(String parameterName, Time parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setTime()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setTime(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a java.sql.Time value using a calendar - other than the default. The driver converts this to an SQL TIME - value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param cal The calendar. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - or the calendar is null. - **/ - public void setTime(String parameterName, Time parameterValue, Calendar cal) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setTime()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setTime(findParameterIndex(parameterName), parameterValue, cal); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a java.sql.Timestamp value using the - default calendar. The driver converts this to an SQL TIMESTAMP - value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or the parameter - is not an input parameter. - **/ - public void setTimestamp(String parameterName, Timestamp parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setTimeStamp()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setTimestamp(findParameterIndex(parameterName), parameterValue); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a java.sql.Timestamp value using a - calendar other than the default. The driver converts this to - an SQL TIMESTAMP value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param cal The calendar. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - or the calendar is null. - **/ - public void setTimestamp(String parameterName, Timestamp parameterValue, Calendar cal) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setTimeStamp()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setTimestamp(findParameterIndex(parameterName), parameterValue, cal); - } - - //@G4A JDBC 3.0 - /** - Sets an input parameter to a URL value. The driver converts this to an - SQL DATALINK value. - - @param parameterName The parameter name. - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the parameter name is not valid, or the parameter - is not an input parameter. - **/ - public void setURL(String parameterName, URL parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @G7A - JDTrace.logInformation(this, "setURL()"); // @G7A - if(parameterValue == null) // @G7A - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); // @G7A - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + parameterValue.toString()); // @G7A - } // @G7A - - setURL(findParameterIndex(parameterName), parameterValue); - } - - /** - Tests if a DataTruncation occurred on the read of a piece of - data and posts a DataTruncation warning if so. - - @param parameterIndex The parameter index (1-based). - @param data The data that was read, or null for SQL NULL. - **/ - private void testDataTruncation(int parameterIndex, SQLData data) - { - if(wasDataMappingError_) - { - postWarning(new DataTruncation(parameterIndex, true, true, -1, -1)); - } - - if(data != null) - { - int truncated = data.getTruncated(); - if(truncated > 0) - { - int actualSize = data.getActualSize(); - postWarning(new DataTruncation(parameterIndex, true, true, actualSize, actualSize - truncated)); - } - } - } - - //@pdd jdbc40 move method to preparedStatement - //@pdd private static final String unquote(String name) - //@pdd { - //@pdd return JDUtilities.prepareForSingleQuotes(name, true); - //@pdd } - - //@pdd jdbc40 move methodto preparedStatement - //@pdd private static final String unquoteNoUppercase(String name) - //@pdd { - //@pdd return JDUtilities.prepareForSingleQuotes(name, false); - //@pdd } - - /** - Indicates if the last parameter read has the - value of SQL NULL. - - @return true if the value is SQL NULL; - false otherwise. - - @exception SQLException If the statement is not open. - **/ - public boolean wasNull() - throws SQLException - { - synchronized(internalLock_) - { // @E1A - checkOpen(); - return wasNull_; - } - } - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCCallableStatement", "java.sql.CallableStatement" }; - } - - //@PDA jdbc40 - /** - * Retrieves the value of the designated parameter as a - * java.io.Reader object in the Java programming language. - * - * @return a java.io.Reader object that contains the parameter - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - */ - public Reader getCharacterStream(int parameterIndex) throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - Reader value = (data == null) ? null : data.getCharacterStream(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@PDA jdbc40 - /** - * Retrieves the value of the designated parameter as a - * java.io.Reader object in the Java programming language. - * - * @param parameterName the name of the parameter - * @return a java.io.Reader object that contains the parameter - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public Reader getCharacterStream(String parameterName) throws SQLException - { - return getCharacterStream(findParameterIndex(parameterName)); - } - - //@PDA jdbc40 - /** - * Retrieves the value of the designated parameter as a - * java.io.Reader object in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR parameters. - * - * @return a java.io.Reader object that contains the parameter - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public Reader getNCharacterStream(int parameterIndex) throws SQLException - { - - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - Reader value = (data == null) ? null : data.getNCharacterStream(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@PDA jdbc40 - /** - * Retrieves the value of the designated parameter as a - * java.io.Reader object in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR parameters. - * - * @param parameterName the name of the parameter - * @return a java.io.Reader object that contains the parameter - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public Reader getNCharacterStream(String parameterName) throws SQLException - { - return getNCharacterStream(findParameterIndex(parameterName)); - } - - //@PDA jdbc40 - //JDBC40DOC /** - //JDBC40DOC * Retrieves the value of the designated JDBC NCLOB parameter as a - //JDBC40DOC * java.sql.NClob object in the Java programming language. - //JDBC40DOC * - //JDBC40DOC * @param parameterIndex the first parameter is 1, the second is 2, and - //JDBC40DOC * so on - //JDBC40DOC * @return the parameter value as a NClob object in the - //JDBC40DOC * Java programming language. If the value was SQL NULL, the - //JDBC40DOC * value null is returned. - //JDBC40DOC * @exception SQLException if the driver does not support national - //JDBC40DOC * character sets; if the driver can detect that a data conversion - //JDBC40DOC * error could occur; if a database access error occurs or - //JDBC40DOC * this method is called on a closed CallableStatement - //JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - //JDBC40DOC * this method - //JDBC40DOC */ - /* ifdef JDBC40 - public NClob getNClob(int parameterIndex) throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // make sure the registered type is valid for this get method - if(registeredTypes_[parameterIndex-1] != Types.CLOB) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - NClob value = (data == null) ? null : data.getNClob(); - testDataTruncation(parameterIndex, data); - return value; - } - } - endif */ - - //@PDA jdbc40 - //JDBC40DOC /** - //JDBC40DOC * Retrieves the value of a JDBC NCLOB parameter as a - //JDBC40DOC * java.sql.NClob object in the Java programming language. - //JDBC40DOC * @param parameterName the name of the parameter - //JDBC40DOC * @return the parameter value as a NClob object in the - //JDBC40DOC * Java programming language. If the value was SQL NULL, - //JDBC40DOC * the value null is returned. - //JDBC40DOC * @exception SQLException if the driver does not support national - //JDBC40DOC * character sets; if the driver can detect that a data conversion - //JDBC40DOC * error could occur; if a database access error occurs or - //JDBC40DOC * this method is called on a closed CallableStatement - //JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - //JDBC40DOC * this method - //JDBC40DOC */ - /* ifdef JDBC40 - public NClob getNClob(String parameterName) throws SQLException - { - return getNClob(findParameterIndex(parameterName)); - } - endif */ - - //@PDA jdbc40 - /** - * Retrieves the value of the designated NCHAR, - * NVARCHAR - * or LONGNVARCHAR parameter as - * a String in the Java programming language. - *

        - * For the fixed-length type JDBC NCHAR, - * the String object - * returned has exactly the same value the SQL - * NCHAR value had in the - * database, including any padding added by the database. - * - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @return a String object that maps an - * NCHAR, NVARCHAR or LONGNVARCHAR value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setNString - */ - public String getNString(int parameterIndex) throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - String value = (data == null) ? null : data.getNString(); - testDataTruncation(parameterIndex, data); - return value; - } - } - - //@PDA jdbc40 - /** - * Retrieves the value of the designated NCHAR, - * NVARCHAR - * or LONGNVARCHAR parameter as - * a String in the Java programming language. - *

        - * For the fixed-length type JDBC NCHAR, - * the String object - * returned has exactly the same value the SQL - * NCHAR value had in the - * database, including any padding added by the database. - * - * @param parameterName the name of the parameter - * @return a String object that maps an - * NCHAR, NVARCHAR or LONGNVARCHAR value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setNString - */ - public String getNString(String parameterName) throws SQLException - { - return getNString(findParameterIndex(parameterName)); - } - - //@PDA jdbc40 - //JDBC40DOC /** - //JDBC40DOC * Retrieves the value of the designated JDBC ROWID parameter as a - //JDBC40DOC * java.sql.RowId object. - //JDBC40DOC * - //JDBC40DOC * @param parameterIndex the first parameter is 1, the second is 2,... - //JDBC40DOC * @return a RowId object that represents the JDBC ROWID - //JDBC40DOC * value is used as the designated parameter. If the parameter contains - //JDBC40DOC * a SQL NULL, then a null value is returned. - //JDBC40DOC * @throws SQLException if a database access error occurs or - //JDBC40DOC * this method is called on a closed CallableStatement - //JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - //JDBC40DOC * this method - //JDBC40DOC */ - /* ifdef JDBC40 - public RowId getRowId(int parameterIndex) throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(!parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - RowId value = (data == null) ? null : data.getRowId(); - testDataTruncation(parameterIndex, data); - return value; - } - } - endif */ - - //@PDA jdbc40 - //JDBC40DOC /** - //JDBC40DOC * Retrieves the value of the designated JDBC ROWID parameter as a - //JDBC40DOC * java.sql.RowId object. - //JDBC40DOC * - //JDBC40DOC * @param parameterName the name of the parameter - //JDBC40DOC * @return a RowId object that represents the JDBC ROWID - //JDBC40DOC * value is used as the designated parameter. If the parameter contains - //JDBC40DOC * a SQL NULL, then a null value is returned. - //JDBC40DOC * @throws SQLException if a database access error occurs or - //JDBC40DOC * this method is called on a closed CallableStatement - //JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - //JDBC40DOC * this method - //JDBC40DOC */ - /* ifdef JDBC40 - public RowId getRowId(String parameterName) throws SQLException - { - return getRowId(findParameterIndex(parameterName)); - } - endif */ - - //@PDA jdbc40 - //JDBC40DOC /** - //JDBC40DOC * Retrieves the value of the designated SQL XML parameter as a - //JDBC40DOC * java.sql.SQLXML object in the Java programming language. - //JDBC40DOC * @param parameterIndex index of the first parameter is 1, the second is 2, ... - //JDBC40DOC * @return a SQLXML object that maps an SQL XML value - //JDBC40DOC * @throws SQLException if a database access error occurs or - //JDBC40DOC * this method is called on a closed CallableStatement - //JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - //JDBC40DOC * this method - //JDBC40DOC */ - /* ifdef JDBC40 - public SQLXML getSQLXML(int parameterIndex) throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - SQLData data = null; - - // Check if the parameter index refers to the return value parameter. - // If it is not parameter index 1, then decrement the parameter index, - // since we are "faking" the return value parameter. - if(useReturnValueParameter_ && parameterIndex == 1) - { - if(!returnValueParameterRegistered_) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - data = returnValueParameter_; - } - else - { - if(useReturnValueParameter_) - { - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check that the parameter is an output parameter. - if(! parameterRow_.isOutput(parameterIndex)) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Verify that the output parameter is registered. - if(registered_[parameterIndex-1] == false) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Get the data and check for SQL NULL. - data = getValue(parameterIndex); - } - - SQLXML value = (data == null) ? null : data.getSQLXML(); - testDataTruncation(parameterIndex, data); - return value; - } - } - endif */ - - //@PDA jdbc40 - //JDBC40DOC /** - //JDBC40DOC * Retrieves the value of the designated SQL XML parameter as a - //JDBC40DOC * java.sql.SQLXML object in the Java programming language. - //JDBC40DOC * @param parameterName the name of the parameter - //JDBC40DOC * @return a SQLXML object that maps an SQL XML value - //JDBC40DOC * @throws SQLException if a database access error occurs or - //JDBC40DOC * this method is called on a closed CallableStatement - //JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - //JDBC40DOC * this method - //JDBC40DOC */ - /* ifdef JDBC40 - public SQLXML getSQLXML(String parameterName) throws SQLException - { - return getSQLXML(findParameterIndex(parameterName)); - } - endif */ - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterName the name of the parameter - * @param x the Java input stream that contains the ASCII parameter value - * @param length the number of bytes in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setAsciiStream()"); - if(x == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); - } - - setAsciiStream(findParameterIndex(parameterName), x, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the stream - * as needed until end-of-file is reached. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterName the name of the parameter - * @param x the java input stream which contains the binary parameter value - * @param length the number of bytes in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method. - */ - public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setBinaryStream()"); - if(x == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); - } - - setBinaryStream(findParameterIndex(parameterName), x, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Blob object. - * The driver converts this to an SQL BLOB value when it - * sends it to the database. - * - * @param parameterName the name of the parameter - * @param x a Blob object that maps an SQL BLOB value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setBlob(String parameterName, Blob x) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setBlob()"); - if(x == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + x.length()); - } - - setBlob(findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a InputStream object. The InputStream must contain the number - * of characters specified by length, otherwise a SQLException will be - * generated when the CallableStatement is executed. - * This method differs from the setBinaryStream (int, InputStream, int) - * method because it informs the driver that the parameter value should be - * sent to the system as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be sent to the system as a LONGVARBINARY or a BLOB - * - * @param parameterName the name of the parameter to be set - * - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @throws SQLException if parameterIndex does not correspond - * to a parameter marker in the SQL statement, or if the length specified - * is less than zero; if the number of bytes in the inputStream does not match - * the specfied length; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * - */ - public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setBlob()"); - if(inputStream == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); - } - - setBlob(findParameterIndex(parameterName), inputStream, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterName the name of the parameter - * @param reader the java.io.Reader object that - * contains the UNICODE data used as the designated parameter - * @param length the number of characters in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setCharacterStream()"); - if(reader == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); - } - - setCharacterStream(findParameterIndex(parameterName), reader, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Clob object. - * The driver converts this to an SQL CLOB value when it - * sends it to the database. - * - * @param parameterName the name of the parameter - * @param x a Clob object that maps an SQL CLOB value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setClob(String parameterName, Clob x) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setClob()"); - if(x == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + x.length()); - } - - setClob(findParameterIndex(parameterName), x); - - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the CallableStatement is executed. - * This method differs from the setCharacterStream (int, Reader, int) method - * because it informs the driver that the parameter value should be sent to - * the system as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the system as a LONGVARCHAR or a CLOB - * @param parameterName the name of the parameter to be set - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if the length specified is less than zero; - * a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * - */ - public void setClob(String parameterName, Reader reader, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setClob()"); - if(reader == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); - } - - setClob(findParameterIndex(parameterName), reader, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * @param parameterName the name of the parameter to be set - * @param value the parameter value - * @param length the number of characters in the parameter data. - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setNCharacterStream()"); - if(value == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); - } - - setNCharacterStream(findParameterIndex(parameterName), value, length); - } - - //@PDA jdbc40 - //JDBC40DOC /** - //JDBC40DOC * Sets the designated parameter to a java.sql.NClob object. The object - //JDBC40DOC * implements the java.sql.NClob interface. This NClob - //JDBC40DOC * object maps to a SQL NCLOB. - //JDBC40DOC * @param parameterName the name of the parameter to be set - //JDBC40DOC * @param value the parameter value - //JDBC40DOC * @throws SQLException if the driver does not support national - //JDBC40DOC * character sets; if the driver can detect that a data conversion - //JDBC40DOC * error could occur; if a database access error occurs or - //JDBC40DOC * this method is called on a closed CallableStatement - //JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - //JDBC40DOC * this method - //JDBC40DOC */ - /* ifdef JDBC40 - public void setNClob(String parameterName, NClob value) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setNClob()"); - if(value == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + value.length()); - } - - setNClob(findParameterIndex(parameterName), value); - } - endif */ - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the CallableStatement is executed. - * This method differs from the setCharacterStream (int, Reader, int) method - * because it informs the driver that the parameter value should be sent to - * the system as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the system as a LONGNVARCHAR or a NCLOB - * - * @param parameterName the name of the parameter to be set - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if the length specified is less than zero; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setNClob(String parameterName, Reader reader, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setNClob()"); - if(reader == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + length); - } - - setNClob(findParameterIndex(parameterName), reader, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given String object. - * The driver converts this to a SQL NCHAR or - * NVARCHAR or LONGNVARCHAR - * @param parameterName the name of the parameter to be set - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setNString(String parameterName, String value) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setNString()"); - if(value == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else if(value.length() > maxToLog_) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + value.length()); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + value); - } - - setNString(findParameterIndex(parameterName), value); - } - - //@PDA jdbc40 - //JDBC40DOC /** - //JDBC40DOC * Sets the designated parameter to the given java.sql.RowId object. The - //JDBC40DOC * driver converts this to a SQL ROWID when it sends it to the - //JDBC40DOC * database. - //JDBC40DOC * - //JDBC40DOC * @param parameterName the name of the parameter - //JDBC40DOC * @param x the parameter value - //JDBC40DOC * @throws SQLException if a database access error occurs or - //JDBC40DOC * this method is called on a closed CallableStatement - //JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - //JDBC40DOC * this method - //JDBC40DOC */ - /* ifdef JDBC40 - public void setRowId(String parameterName, RowId x) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setRowId()"); - if(x == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: " + x.toString()); - } - - setRowId(findParameterIndex(parameterName), x); - } - endif */ - - //@PDA jdbc40 - //JDBC40DOC /** - //JDBC40DOC * Sets the designated parameter to the given java.sql.SQLXML object. The driver converts this to an - //JDBC40DOC * SQL XML value when it sends it to the database. - //JDBC40DOC * - //JDBC40DOC * @param parameterName the name of the parameter - //JDBC40DOC * @param xmlObject a SQLXML object that maps an SQL XML value - //JDBC40DOC * @throws SQLException if a database access error occurs, - //JDBC40DOC * this method is called on a closed CallableStatement or - //JDBC40DOC * the java.xml.transform.Result, - //JDBC40DOC * Writer or OutputStream has not been closed for the SQLXML object - //JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - //JDBC40DOC * this method - //JDBC40DOC */ - /* ifdef JDBC40 - public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setClob()"); - if(xmlObject == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - else JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " length: " + xmlObject.toString().length()); - } - - setSQLXML(findParameterIndex(parameterName), xmlObject); - } - endif */ - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setAsciiStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param x the Java input stream that contains the ASCII parameter value - * @exception SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setAsciiStream(String parameterName, InputStream x) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setAsciiStream(String, InputStream)"); - if(x == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - } - - setAsciiStream(findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the - * stream as needed until end-of-file is reached. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setBinaryStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param x the java input stream which contains the binary parameter value - * @exception SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setBinaryStream(String parameterName, InputStream x) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setBinaryStream(String, InputStream)"); - if(x == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - } - - setBinaryStream(findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a InputStream object. - * This method differs from the setBinaryStream (int, InputStream) - * method because it informs the driver that the parameter value should be - * sent to the system as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be sent to the system as a LONGVARBINARY or a BLOB - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setBlob which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param inputStream An object that contains the data to set the parameter - * value to. - * @throws SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setBlob(String parameterName, InputStream inputStream) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setBlob(String, InputStream)"); - if(inputStream == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - } - - setBlob(findParameterIndex(parameterName), inputStream); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Reader - * object. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setCharacterStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param reader the java.io.Reader object that contains the - * Unicode data - * @exception SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setCharacterStream(String parameterName, Reader reader) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setCharacterStream(String, Reader)"); - if(reader == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - } - - setCharacterStream(findParameterIndex(parameterName), reader); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the system as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the system as a LONGVARCHAR or a CLOB - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setClob which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or this method is called on - * a closed CallableStatement - * - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setClob(String parameterName, Reader reader) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setClob(String, Reader)"); - if(reader == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - } - - setClob(findParameterIndex(parameterName), reader); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNCharacterStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param value the parameter value - * @throws SQLException if parameterName does not correspond to a named - * parameter; if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs; or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setNCharacterStream(String parameterName, Reader value) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setNCharacterStream(String, Reader)"); - if(value == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - } - - setNCharacterStream(findParameterIndex(parameterName), value); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the system as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the system as a LONGNVARCHAR or a NCLOB - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNClob which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if parameterName does not correspond to a named - * parameter; if the driver does not support national character sets; - * if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - */ - public void setNClob(String parameterName, Reader reader) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "setNClob(String, Reader)"); - if(reader == null) - JDTrace.logInformation(this, "parameter index: " + findParameterIndex(parameterName) + " value: NULL"); - } - - setNClob(findParameterIndex(parameterName), reader); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCClob.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCClob.java deleted file mode 100644 index 7efd61beb..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCClob.java +++ /dev/null @@ -1,517 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCClob.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Reader; - -import java.io.UnsupportedEncodingException; -import java.io.Writer; -import java.io.CharArrayReader; -import java.sql.Clob; -import java.sql.SQLException; - -// Note: This code in this class requires understanding of bit manipulation -// and sign extension. Do not attempt to rework this code if you do not -// have a grasp of these concepts. - -// Currently, the database host server only supports 2 GB LOBs. Therefore, -// we validate any long parameters to make sure they are not greater than -// the maximum positive value for a 4-byte int (2 GB). This has the added -// bonus of being able to cast the long down to an int without worrying -// about sign extension. There are some cases where we could allow the -// user to pass in a long greater than 2 GB, but for consistency, we will -// throw an exception. - -// Offset refers to a 0-based index. Position refers to a 1-based index. - - -/** -The AS400JDBCClob class provides access to character large -objects. The data is valid only within the current -transaction. -**/ -public class AS400JDBCClob implements Clob -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - protected char[] data_; //@pdc jdbc40 - protected int maxLength_; //@pdc jdbc40 - static final int MAX_LOB_SIZE = 2147483647; //@PDA jdbc40 same as native driver. (if column is a DBCLOB the limit is 1,073,741,823) - private boolean isXML_ = false; //@xmltrim true if this data originated from a native XML column type - -/** -Constructs an AS400JDBCClob object. The data is contained -in the String. No further communication with the IBM i system is necessary. - -@param data The CLOB data. -**/ - AS400JDBCClob(String data, int maxLength) - { - data_ = data.toCharArray(); - maxLength_ = maxLength; - } - - - AS400JDBCClob(char[] data) - { - data_ = data; - } - - //@xmltrim - /** - Constructs an AS400JDBCClob object. The data is contained - in the String. No further communication with the IBM i system is necessary. - If this clob has a source of a columne of type XML, then any getX method that returns xml as string will trim the xml declaration. - - @param data The CLOB data. - @param maxLength - @param isXML flag to signal if source is xml - **/ - AS400JDBCClob(String data, int maxLength, boolean isXML) - { - data_ = data.toCharArray(); - maxLength_ = maxLength; - isXML_ = isXML; - } - - //@xmltrim - AS400JDBCClob(char[] data, boolean isXML) - { - data_ = data; - isXML_ = isXML; - } - - - -/** -Returns the entire CLOB as a stream of ASCII characters. - -@return The stream. - -@exception SQLException If an error occurs. -**/ - public synchronized InputStream getAsciiStream() throws SQLException - { - //Following Native, throw HY010 after free() has been called - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - try - { - if(isXML_)//@xmltrim - return new ByteArrayInputStream((JDUtilities.stripXMLDeclaration(new String(data_))).getBytes("ISO8859_1")); //@xmltrim - else - return new ByteArrayInputStream((new String(data_)).getBytes("ISO8859_1")); - } - catch (UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - -/** -Returns the entire CLOB as a character stream. - -@return The stream. - -@exception SQLException If an error occurs. -**/ - public synchronized Reader getCharacterStream() throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - if(isXML_)//@xmltrim - return new CharArrayReader( JDUtilities.stripXMLDeclaration( new String(data_) ).toCharArray()); //@xmltrim - else - return new CharArrayReader(data_); - } - - - -/** -Returns part of the contents of the CLOB. - -@param position The start position within the CLOB (1-based). -@param length The length to return. -@return The contents. - -@exception SQLException If the start position is not valid, - if the length is not valid, - or an error occurs. -**/ - public synchronized String getSubString(long position, int length) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int offset = (int)position-1; - if (offset < 0 || length < 0 || (offset + length) > data_.length) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - //@xmltrim - if(isXML_) - { - data_ = JDUtilities.stripXMLDeclaration( new String(data_) ).toCharArray(); - } - - int lengthToUse = data_.length - offset; - if (lengthToUse < 0) return ""; - if (lengthToUse > length) lengthToUse = length; - - char[] result = new char[lengthToUse]; - System.arraycopy(data_, offset, result, 0, lengthToUse); - return new String(result); - } - - - -/** -Returns the length of the CLOB. - -@return The length of the CLOB, in characters. - -@exception SQLException If an error occurs. -**/ - public long length() throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - return data_.length; - } - - - -/** -Returns the position at which a pattern is found in the CLOB. - -@param pattern The pattern. -@param position The position within the CLOB to begin - searching (1-based). -@return The position at which the pattern - is found, or -1 if the pattern is not - found. - -@exception SQLException If the pattern is null, - the position is not valid, - or an error occurs. -**/ - public synchronized long position(String pattern, long position) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int offset = (int)position-1; - if (pattern == null || offset < 0 || offset >= data_.length) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - char[] charPattern = pattern.toCharArray(); - int end = data_.length - charPattern.length; - - for (int i=offset; i<=end; ++i) - { - int j = 0; - while (j < charPattern.length && data_[i+j] == charPattern[j]) ++j; - if (j == charPattern.length) return i+1; - } - - return -1; - } - - - -/** -Returns the position at which a pattern is found in the CLOB. - -@param pattern The pattern. -@param position The position within the CLOB to begin - searching (1-based). -@return The position at which the pattern - is found, or -1 if the pattern is not - found. - -@exception SQLException If the pattern is null, - the position is not valid, - or an error occurs. -**/ - public synchronized long position(Clob pattern, long position) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int offset = (int)position-1; - if (pattern == null || offset < 0 || offset >= data_.length) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - int patternLength = (int)pattern.length(); - if (patternLength > data_.length || patternLength < 0) return -1; - - int end = data_.length - patternLength; - - char[] charPattern = pattern.getSubString(1L, patternLength).toCharArray(); //@CRS - Get all the chars for now, improve this later. - - for (int i=offset; i<=end; ++i) - { - int j = 0; - while (j < charPattern.length && data_[i+j] == charPattern[j]) ++j; - if (j == charPattern.length) return i+1; - } - return -1; - } - - - /** - Returns a stream that an application can use to write Ascii characters to this CLOB. - The stream begins at position position, and the CLOB will be truncated - after the last character of the write. - - @param position The position (1-based) in the CLOB where writes should start. - @return An OutputStream object to which data can be written by an application. - @exception SQLException If there is an error accessing the CLOB or if the position - specified is greater than the length of the CLOB. - **/ - public OutputStream setAsciiStream(long position) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - if (position <= 0 || position > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - try - { - return new AS400JDBCClobOutputStream(this, position, ConvTable.getTable(819, null)); - } - catch (UnsupportedEncodingException e) - { - // Should never happen. - JDError.throwSQLException(JDError.EXC_INTERNAL, e); - return null; - } - } - - - - /** - Returns a stream that an application can use to write a stream of Unicode characters to - this CLOB. The stream begins at position position, and the CLOB will - be truncated after the last character of the write. - - @param position The position (1-based) in the CLOB where writes should start. - @return An OutputStream object to which data can be written by an application. - @exception SQLException If there is an error accessing the CLOB or if the position - specified is greater than the length of the CLOB. - **/ - public Writer setCharacterStream(long position) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - if (position <= 0 || position > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - return new AS400JDBCWriter(this, position); - } - - - - /** - Writes a String to this CLOB, starting at position position. The CLOB - will be truncated after the last character written. - - @param position The position (1-based) in the CLOB where writes should start. - @param stringToWrite The string that will be written to the CLOB. - @return The number of characters that were written. - - @exception SQLException If there is an error accessing the CLOB or if the position - specified is greater than the length of the CLOB. - **/ - public synchronized int setString(long position, String stringToWrite) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int offset = (int)position-1; - - if (offset < 0 || offset >= maxLength_ || stringToWrite == null) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - // We will write as many chars as we can. If our internal char array - // would overflow past the 2 GB boundary, we don't throw an error, we just - // return the number of chars that were set. - char[] charsToWrite = stringToWrite.toCharArray(); - int newSize = offset + charsToWrite.length; - if (newSize < 0) newSize = 0x7FFFFFFF; // In case the addition resulted in overflow. - if (newSize > data_.length) - { - char[] temp = data_; - data_ = new char[newSize]; - System.arraycopy(temp, 0, data_, 0, temp.length); - int numPad = offset - temp.length; //Determine if we need to Pad with single byte space before we write the new data_ @K1A - //the number of spaces we need to pad is equal to the offset we want to start writing at minus the length of the current clob(temp) @K1A - for(int i=0; iposition in the CLOB. - The CLOB will be truncated after the last character written. The lengthOfWrite - characters written will start from offset in the string that was provided by the - application. - - @param position The position (1-based) in the CLOB where writes should start. - @param string The string that will be written to the CLOB. - @param offset The offset into string to start reading characters (0-based). - @param lengthOfWrite The number of characters to write. - @return The number of characters written. - - @exception SQLException If there is an error accessing the CLOB value or if the position - specified is greater than the length of the CLOB. - **/ - public synchronized int setString(long position, String string, int offset, int lengthOfWrite) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int clobOffset = (int)position-1; - if (clobOffset < 0 || clobOffset >= maxLength_ || - string == null || offset < 0 || lengthOfWrite < 0 || (offset+lengthOfWrite) > string.length() || - (clobOffset+lengthOfWrite) > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - // We will write as many chars as we can. If our internal char array - // would overflow past the 2 GB boundary, we don't throw an error, we just - // return the number of chars that were set. - char[] charsToWrite = string.toCharArray(); - int newSize = clobOffset + lengthOfWrite; - if (newSize < 0) newSize = 0x7FFFFFFF; // In case the addition resulted in overflow. - if (newSize > data_.length) - { - char[] temp = data_; - data_ = new char[newSize]; - System.arraycopy(temp, 0, data_, 0, temp.length); - int numPad = offset - temp.length; //Determine if we need to Pad with single byte space before we write the new data_ @K1A - //the number of spaces we need to pad is equal to the offset we want to start writing at minus the length of the current clob(temp) @K1A - for(int i=0; ilengthOfCLOB characters. - - @param lengthOfCLOB The length, in characters, that this CLOB should be after - truncation. - - @exception SQLException If there is an error accessing the CLOB or if the length - specified is greater than the length of the CLOB. - **/ - public synchronized void truncate(long lengthOfCLOB) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - int length = (int)lengthOfCLOB; - if (length < 0 || length > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - char[] temp = data_; - data_ = new char[length]; - int numToCopy = length < temp.length ? length : temp.length; - System.arraycopy(temp, 0, data_, 0, numToCopy); - } - - // @PDA jdbc40 - /** - * This method frees the Clob object and releases the - * resources the resources that it holds. The object is invalid once the - * free method is called. If free is called - * multiple times, the subsequent calls to free are treated - * as a no-op. - * - * @throws SQLException - * if an error occurs releasing the Clob's resources - */ - public synchronized void free() throws SQLException - { - data_ = null; //@pda make available for GC - } - - // @PDA jdbc40 - /** - * Returns a Reader object that contains a partial - * Clob value, starting with the character specified by pos, - * which is length characters in length. - * - * @param pos - * the offset to the first character of the partial value to be - * retrieved. The first character in the Clob is at position 1. - * @param length - * the length in characters of the partial value to be retrieved. - * @return Reader through which the partial Clob - * value can be read. - * @throws SQLException - * if pos is less than 1 or if pos is greater than the number of - * characters in the Clob or if pos + length is - * greater than the number of characters in the - * Clob - */ - public synchronized Reader getCharacterStream(long pos, long length) throws SQLException - { - if(data_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - if(isXML_ )//@xmltrim - return new CharArrayReader( JDUtilities.stripXMLDeclaration( new String(data_)).toCharArray(), (int) pos-1, (int)length); //@xmltrim - else - return new CharArrayReader(data_, (int) pos-1, (int)length); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCClobLocator.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCClobLocator.java deleted file mode 100644 index f48e370a4..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCClobLocator.java +++ /dev/null @@ -1,664 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCClobLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -import java.io.OutputStream; -import java.io.Reader; -import java.io.UnsupportedEncodingException; -import java.io.Writer; -import java.sql.Clob; -import java.sql.SQLException; - - -// Note: This code in this class requires understanding of bit manipulation -// and sign extension. Do not attempt to rework this code if you do not -// have a grasp of these concepts. - -// Currently, the database host server only supports 2 GB LOBs. Therefore, -// we validate any long parameters to make sure they are not greater than -// the maximum positive value for a 4-byte int (2 GB). This has the added -// bonus of being able to cast the long down to an int without worrying -// about sign extension. There are some cases where we could allow the -// user to pass in a long greater than 2 GB, but for consistency, we will -// throw an exception. - -// Offset refers to a 0-based index. Position refers to a 1-based index. - -// In the event that the column in the database is a DBCLOB, know that -// JDLobLocator knows that it is graphic and will correctly convert -// the byte offsets and lengths into character offsets and lengths. - -/** -The AS400JDBCClobLocator class provides access to character large -objects. The data is valid only within the current -transaction. -**/ -public class AS400JDBCClobLocator implements Clob -{ - protected ConvTable converter_; //@pdc jdbc40 - JDLobLocator locator_; - - Object savedObject_; // This is our InputStream or byte[] or whatever that needs to be written if we are batching. - int savedScale_; // This is our length that goes with our savedObject_. - - private char[] cache_; - private int cacheOffset_; - private static final char[] INIT_CACHE = new char[0]; - - //private int truncate_ = -1; - protected int maxLength_; // The max length in LOB-characters. See JDLobLocator. //@pdc jdbc40 - private boolean isXML_ = false; //@xml3 true if this data originated from a native XML column type - - /** - Constructs an AS400JDBCClobLocator object. The data for the - CLOB will be retrieved as requested, directly from the - IBM i system, using the locator handle. - - @param locator The locator. - @param converter The text converter. - **/ - AS400JDBCClobLocator(JDLobLocator locator, ConvTable converter, Object savedObject, int savedScale) - { - locator_ = locator; - converter_ = converter; - savedObject_ = savedObject; - savedScale_ = savedScale; - maxLength_ = locator_.getMaxLength(); - } - - //@xml3 new constructor - /** - Constructs an AS400JDBCClobLocator object. The data for the - CLOB will be retrieved as requested, directly from the - IBM i system, using the locator handle. - If this clob has a source of a columne of type XML, then any getX method that returns xml as string will trim the xml declaration. - - @param locator The locator. - @param converter The text converter. - @param savedObject Input data - @param savedScale Inpuat scale of data - @param isXML Flag that stream is from an XML column type (needed to strip xml declaration) - **/ - AS400JDBCClobLocator(JDLobLocator locator, ConvTable converter, Object savedObject, int savedScale, boolean isXML) - { - this(locator, converter, savedObject, savedScale); - isXML_ = isXML; - } - - - /** - Returns the entire CLOB as a stream of ASCII characters. - - @return The stream. - - @exception SQLException If an error occurs. - **/ - public InputStream getAsciiStream() throws SQLException - { - //Following Native, throw HY010 after free() has been called. Note: NullPointerException if synchronized(null-ref) - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - try - { - //@xml3 if xml column, remove xml declaration via ConvTableReader - return new ReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(locator_), converter_.getCcsid(), converter_.bidiStringType_, isXML_), 819); // ISO 8859-1. //@xml3 - } - catch (UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - } - - - - /** - Returns the entire CLOB as a character stream. - - @return The stream. - - @exception SQLException If an error occurs. - **/ - public Reader getCharacterStream() throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - try - { - //@xml3 if xml column, remove xml declaration via ConvTableReader - return new ConvTableReader(new AS400JDBCInputStream(locator_), converter_.getCcsid(), converter_.bidiStringType_, isXML_); //@xml3 - } - catch (UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - } - - - -/** -Returns the handle to this CLOB locator in the database. - -@return The handle to this locator in the databaes. -**/ - int getHandle()throws SQLException //@free called from rs.updateValue(), which in turn will throw exc back to rs.updateX() caller - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - return locator_.getHandle(); - } - - - - /** - Returns part of the contents of the CLOB. - - @param position The position within the CLOB (1-based). - @param length The number of characters to return. - @return The contents. - - @exception SQLException If the position is not valid, - if the length is not valid, - or an error occurs. - **/ - public String getSubString(long position, int length) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int offset = (int)position-1; - if (offset < 0 || length < 0 || (offset + length) > length()) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - int lengthToUse = (int)length() - offset; - if (lengthToUse < 0) return ""; - if (lengthToUse > length) lengthToUse = length; - - - - //@xml4 if xml column, remove xml declaration via ConvTableReader - if(isXML_) - { - ConvTableReader r = null; - try{ - r = new ConvTableReader(new AS400JDBCInputStream( locator_), converter_.getCcsid(), converter_.bidiStringType_, isXML_); //@xml4 - r.skip(offset); //@xml4 ConvTableReader will already have skipped XML header if column is XML type - return r.read(lengthToUse); //@xml4 - } - catch ( Exception e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - finally{ - try{ - if (r != null ) r.close(); - }catch(Exception ee){} - } - } - - DBLobData data = locator_.retrieveData(offset, lengthToUse); - int actualLength = data.getLength(); - return converter_.byteArrayToString(data.getRawBytes(), data.getOffset(), actualLength); - } - } - - - - /** - Returns the length of the current contents of the CLOB in characters. - - @return The length of the CLOB in characters. - - @exception SQLException If an error occurs. - **/ - public long length() throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - return locator_.getLength(); - } - } - - - // Used for position(). - private void initCache() - { - cacheOffset_ = 0; - cache_ = INIT_CACHE; - } - - // Used for position(). - private int getCachedChar(int index) throws SQLException - { - int realIndex = index - cacheOffset_; - if (realIndex >= cache_.length) - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - int len = (int)length(); - if (len < 0) len = 0x7FFFFFFF; - if ((blockSize+index) > len) blockSize = len-index; - cache_ = getSubString(index+1, blockSize).toCharArray(); - cacheOffset_ = index; - realIndex = 0; - } - if (cache_.length == 0) return -1; - return cache_[realIndex]; - } - - - - /** - Returns the position at which a pattern is found in the CLOB. - This method is not supported. - - @param pattern The pattern. - @param position The position within the CLOB to begin - searching (1-based). -@return The position in the CLOB at which the pattern was found, - or -1 if the pattern was not found. - - @exception SQLException If the pattern is null, - the position is not valid, - or an error occurs. - **/ - public long position(String pattern, long position) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int offset = (int)position-1; - if (pattern == null || offset < 0 || offset >= length()) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - char[] charPattern = pattern.toCharArray(); - int end = (int)length() - charPattern.length; - - // We use a cache of chars so we don't have to read in the entire - // contents of the CLOB. - initCache(); - - for (int i=offset; i<=end; ++i) - { - int j = 0; - int cachedChar = getCachedChar(i+j); - while (j < charPattern.length && cachedChar != -1 && charPattern[j] == cachedChar) - { - ++j; - cachedChar = getCachedChar(i+j); - } - if (j == charPattern.length) return i+1; - } - return -1; - } - } - - - - /** - Returns the position at which a pattern is found in the CLOB. - This method is not supported. - - @param pattern The pattern. - @param position The position within the CLOB to begin - searching (1-based). -@return The position in the CLOB at which the pattern was found, - or -1 if the pattern was not found. - - @exception SQLException If the pattern is null, - the position is not valid, - or an error occurs. - **/ - public long position(Clob pattern, long position) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int offset = (int)position-1; - if (pattern == null || offset < 0 || offset >= length()) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - int patternLength = (int)pattern.length(); - int locatorLength = (int)length(); - if (patternLength > locatorLength || patternLength < 0) return -1; - - int end = locatorLength - patternLength; - - char[] charPattern = pattern.getSubString(1L, patternLength).toCharArray(); //@CRS - Get all chars for now, improve this later. - - // We use a cache of chars so we don't have to read in the entire - // contents of the CLOB. - initCache(); - - for (int i=offset; i<=end; ++i) - { - int j = 0; - int cachedChar = getCachedChar(i+j); - while (j < patternLength && cachedChar != -1 && charPattern[j] == cachedChar) - { - ++j; - cachedChar = getCachedChar(i+j); - } - if (j == patternLength) return i+1; - } - - return -1; - } - } - - - /** - Returns a stream that an application can use to write Ascii characters to this CLOB. - The stream begins at position position, and the CLOB will be truncated - after the last character of the write. - - @param position The position (1-based) in the CLOB where writes should start. - @return An OutputStream object to which data can be written by an application. - @exception SQLException If there is an error accessing the CLOB or if the position - specified is greater than the length of the CLOB. - **/ - public OutputStream setAsciiStream(long position) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - if (position <= 0 || position > maxLength_) - { - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - try - { - return new AS400JDBCClobLocatorOutputStream(this, position, ConvTable.getTable(819, null)); - } - catch (UnsupportedEncodingException e) - { - // Should never happen. - JDError.throwSQLException(JDError.EXC_INTERNAL, e); - return null; - } - } - - - - /** - Returns a stream that an application can use to write a stream of Unicode characters to - this CLOB. The stream begins at position position, and the CLOB will - be truncated after the last character of the write. - - @param position The position (1-based) in the CLOB where writes should start. - @return An OutputStream object to which data can be written by an application. - @exception SQLException If there is an error accessing the CLOB or if the position - specified is greater than the length of the CLOB. - - **/ - public Writer setCharacterStream(long position) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - if (position <= 0 || position > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - return new AS400JDBCWriter(this, position); - } - - - - /** - Writes a String to this CLOB, starting at position position. The CLOB - will be truncated after the last character written. - - @param position The position (1-based) in the CLOB where writes should start. - @param stringToWrite The string that will be written to the CLOB. - @return The number of characters that were written. - - @exception SQLException If there is an error accessing the CLOB or if the position - specified is greater than the length of the CLOB. - - **/ - public int setString(long position, String stringToWrite) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int offset = (int)position-1; - - if (offset < 0 || offset >= maxLength_ || stringToWrite == null) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - // We will write as many chars as we can. If our internal char array - // would overflow past the 2 GB boundary, we don't throw an error, we just - // return the number of chars that were set. - char[] charsToWrite = stringToWrite.toCharArray(); - int newSize = offset + charsToWrite.length; - if (newSize < 0) newSize = 0x7FFFFFFF; // In case the addition resulted in overflow. - int numChars = newSize - offset; - if (numChars != charsToWrite.length) - { - char[] temp = charsToWrite; - charsToWrite = new char[newSize]; - System.arraycopy(temp, 0, charsToWrite, 0, numChars); - } - - // We don't really know if all of these chars can be written until we go to - // the system, so we just return the char[] length as the number written. - byte[] bytesToWrite = converter_.stringToByteArray(charsToWrite, 0, charsToWrite.length); - locator_.writeData((long)offset, bytesToWrite, false); //@K1A - return charsToWrite.length; - } - } - - - - /** - Writes a String to this CLOB, starting at position position in the CLOB. - The CLOB will be truncated after the last character written. The lengthOfWrite - characters written will start from offset in the string that was provided by the - application. - - @param position The position (1-based) in the CLOB where writes should start. - @param string The string that will be written to the CLOB. - @param offset The offset into string to start reading characters (0-based). - @param lengthOfWrite The number of characters to write. - @return The number of characters written. - - @exception SQLException If there is an error accessing the CLOB value or if the position - specified is greater than the length of the CLOB. - - **/ - public int setString(long position, String string, int offset, int lengthOfWrite) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int clobOffset = (int)position-1; - if (clobOffset < 0 || clobOffset >= maxLength_ || - string == null || offset < 0 || lengthOfWrite < 0 || (offset+lengthOfWrite) > string.length() || - (clobOffset+lengthOfWrite) > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - // We will write as many chars as we can. If our internal char array - // would overflow past the 2 GB boundary, we don't throw an error, we just - // return the number of chars that were set. - int newSize = clobOffset + lengthOfWrite; - if (newSize < 0) newSize = 0x7FFFFFFF; // In case the addition resulted in overflow. - int numChars = newSize - clobOffset; - int realLength = (numChars < lengthOfWrite ? numChars : lengthOfWrite); - char[] charsToWrite = new char[realLength]; - string.getChars(offset, offset + numChars, charsToWrite, 0); //@K2C - - // We don't really know if all of these chars can be written until we go to - // the system, so we just return the char[] length as the number written. - byte[] bytesToWrite = converter_.stringToByteArray(charsToWrite, 0, charsToWrite.length); - locator_.writeData((long)clobOffset, bytesToWrite, false); //@k1A - return charsToWrite.length; - } - } - - - - /** - Truncates this CLOB to a length of lengthOfCLOB characters. - - @param lengthOfCLOB The length, in characters, that this CLOB should be after - truncation. - - @exception SQLException If there is an error accessing the CLOB or if the length - specified is greater than the length of the CLOB. - - **/ - public void truncate(long lengthOfCLOB) throws SQLException - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) - { - int length = (int)lengthOfCLOB; - if (length < 0 || length > maxLength_) - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - //truncate_ = length; - - // The host server does not currently provide a way for us - // to truncate the temp space used to hold the locator data, - // so we just keep track of it ourselves. This should work, - // since the temp space on the system should only be valid - // within the scope of our transaction/connection. That means - // there's no reason to go to the system to update the data, - // since no other process can get at it. - locator_.writeData(length, new byte[0], 0, 0, true); //@k1A - } - } - - //@PDA 550 - /** - * This method frees the Clob object and releases the - * resources that it holds. The object is invalid once the - * free method is called. If free is called - * multiple times, the subsequent calls to free are treated - * as a no-op. - * - * @throws SQLException - * if an error occurs releasing the Clob's resources - */ - public void free() throws SQLException //@sync - { - if(locator_ == null) - return; //no-op - - synchronized(locator_) //@sync - { - locator_.free(); - - locator_ = null; //@pda make objects available for GC - converter_ = null; - savedObject_ = null; - cache_ = null; - } - } - - // @PDA jdbc40 - /** - * Returns a Reader object that contains a partial - * Clob value, starting with the character specified by pos, - * which is length characters in length. - * - * @param pos - * the offset to the first character of the partial value to be - * retrieved. The first character in the Clob is at position 1. - * @param length - * the length in characters of the partial value to be retrieved. - * @return Reader through which the partial Clob - * value can be read. - * @throws SQLException - * if pos is less than 1 or if pos is greater than the number of - * characters in the Clob or if pos + length is - * greater than the number of characters in the - * Clob - */ - public Reader getCharacterStream(long pos, long length) throws SQLException //@sync - { - if(locator_ == null)//@free - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); //@free - - synchronized(locator_) //@sync - { - if (pos < 1 || (pos - 1 + length) > locator_.getMaxLength() || length < 0 ) //@pdc change parm check like getSubString - { - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - Reader r = null; - - try - { - //@xml3 if xml column, remove xml declaration via ConvTableReader - r = new ConvTableReader(new AS400JDBCInputStream( locator_), converter_.getCcsid(), converter_.bidiStringType_, isXML_); //@xml3 - r.skip(pos); - return r; - } - catch (UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - catch (IOException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCClobLocatorOutputStream.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCClobLocatorOutputStream.java deleted file mode 100644 index 27054ce7d..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCClobLocatorOutputStream.java +++ /dev/null @@ -1,50 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCClobLocatorOutputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -import java.sql.*; - -final class AS400JDBCClobLocatorOutputStream extends AS400JDBCOutputStream -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - private AS400JDBCClobLocator clob_; - - private ConvTable converter_; - - // Currently, the only thing that uses this is AS400JDBCClobLocator.toAsciiStream(), - // so the converter is always 819. - AS400JDBCClobLocatorOutputStream(AS400JDBCClobLocator clob, long position, ConvTable converter) - { - super(position); - clob_ = clob; - converter_ = converter; - } - - int doWrite(long position, byte data) throws SQLException - { - return doWrite(position, new byte[] { data }, 0, 1); - } - - int doWrite(long position, byte[] data, int offset, int length) throws SQLException - { - String s = converter_.byteArrayToString(data, offset, length); - clob_.setString(position, s); - return length; - } -} - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCClobOutputStream.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCClobOutputStream.java deleted file mode 100644 index 6f63222fa..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCClobOutputStream.java +++ /dev/null @@ -1,49 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCClobOutputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -import java.sql.*; - -final class AS400JDBCClobOutputStream extends AS400JDBCOutputStream -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - private AS400JDBCClob clob_; - private ConvTable converter_; - - // Currently, the only thing that uses this is AS400JDBCClob.toAsciiStream(), - // so the converter is always 819. - AS400JDBCClobOutputStream(AS400JDBCClob clob, long position, ConvTable converter) - { - super(position); - clob_ = clob; - converter_ = converter; - } - - int doWrite(long position, byte data) throws SQLException - { - return doWrite(position, new byte[] { data }, 0, 1); - } - - int doWrite(long position, byte[] data, int offset, int length) throws SQLException - { - String s = converter_.byteArrayToString(data, offset, length); - clob_.setString(position, s); - return length; - } -} - - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnection.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCConnection.java deleted file mode 100644 index 56bfdf143..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnection.java +++ /dev/null @@ -1,5163 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCConnection.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -/* ifdef JDBC40 -import java.sql.ClientInfoStatus; -import java.sql.SQLClientInfoException; -endif */ -import java.sql.Clob; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -/* ifdef JDBC40 -import java.sql.NClob; -endif */ -import java.sql.Driver; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.SQLWarning; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Statement; -import java.sql.Savepoint; // @E10a -import java.sql.Struct; -import java.util.Enumeration; // @DAA -/* ifdef JDBC40 -import java.util.HashMap; -endif */ -import java.util.Map; -import java.util.Properties; -import java.util.Vector; -/* ifdef JDBC40 -import java.util.concurrent.locks.ReentrantLock; -endif */ - - -/** -

        The AS400JDBCConnection class provides a JDBC connection -to a specific DB2 for IBM i database. Use -DriverManager.getConnection() to create new AS400JDBCConnection -objects. - -

        There are many optional properties that can be specified -when the connection is created. Properties can be specified either -as part of the URL or in a java.util.Properties object. See -JDBC properties for a complete -list of properties supported by the AS400JDBCDriver. - -

        Note that a connection may contain at most 9999 open -statements. -**/ -// -// Implementation notes: -// -// 1. Each connection and statement has an "id" associated with -// it. All ids are unique within a connection, and this -// uniqueness is maintained by the id table for each -// connection. -// -// The id is used as a convention for assigning each -// connection and statement its own ORS (Operation Result -// Set) on the IBM i as well as assigning each statement -// its own RPB (Request Parameter Block). -// -// Every communication to the database requires a connection -// and an id within that connection. -// -// 2. It is a requirement that no finalize() methods need to -// receive a reply from the IBM i system. Because of the way the -// AS400Server class is implemented, certain scenarios where -// this is the case will result in deadlock. The AS400Server -// class provides sendAndDiscardReply() specifically to avoid -// this problem. -// -// Within the JDBC driver, finalize() usually calls one or more -// close() methods. Therefore, this requirement is also -// imposed on close() methods. -// -// 3. All requests for the connection and the related objects in -// its context should be sent via a variation of one of the -// sendXXX() methods. This makes debugging cleaner. -// -public class AS400JDBCConnection -/*ifdef JDBC40 -extends ToolboxWrapper -endif */ -implements Connection -{ - - private class CancelLock extends Object {} //@C7A - private class HeldRequestsLock extends Object {} //@C7A - - // Turn this flag on to prevent this Connection object from establishing an actual connection to the IBM i system. This is useful when doing multi-threaded stress testing on the Toolbox's built-in JDBC connection pool manager, where we create/delete massive numbers of connections. - // For production, this flag _must_ be set to 'false'. - private static final boolean TESTING_THREAD_SAFETY = false; //@CPMa - - // This is a compile time flag for doing simple - // communications traces. - // - // The choices are: - // 0 = No communication trace (for production code). - // 1 = Only request and reply ids. - // 2 = Request and reply ids and contents. - // - // Note that the LL (length) and parameter count for - // requests will not be accurate, since they have not yet - // been set at the time when the request is dumped. - // - private static final int DEBUG_COMM_TRACE_ = 0; - - - - // This is a compile time flag for temporarily disabling - // request chaining. This can be useful when a request - // is failing, but all we see is an error class == 7, - // return code == -1000. This means a chain request - // failed. - // - // The choices are: - // true = Enable request chaining (for production code). - // false = Disable request chaining. - // - // @E5D private static final boolean DEBUG_REQUEST_CHAINING_ = true; - - - - // This is a compile time flag for forcing the use of - // extended datastream formats. This can be useful when - // testing extended formats, but the IBM i system is not reporting - // the correct VRM. - // - // The choices are: - // true = Force extended datastream formats. - // false = Decide based on system VRM (for production code). - // - // @E9D private static final boolean FORCE_EXTENDED_FORMATS_ = false; - - // @F8 -- the key change is to put a 1 in the 7th position. That 1 is the "ODBC" flag. - // The IBM i passes it along to database to enable correct package caching of - // "where current of" statements. This flag affects only package caching. - private static final String CLIENT_FUNCTIONAL_LEVEL_= "V7R1M01 "; // @EDA F8c H2c pdc 610 - - private static final int DRDA_SCROLLABLE_CUTOFF_ = 129; // @B1A - private static final int DRDA_SCROLLABLE_MAX_ = 255; // @DAA - private static final int INITIAL_STATEMENT_TABLE_SIZE_ = 256; // @DAA - static final int UNICODE_CCSID_ = 13488; // @E3C - - // The max number of open statements per connection. If this @DAA - // changes, then change the relevant sentence in the javadoc, too. @DAA - static final int MAX_STATEMENTS_ = 9999; // @DAC - private final boolean[] assigned_ = new boolean[MAX_STATEMENTS_]; //@P0C - - static final int DATA_COMPRESSION_NONE_ = 0; // @ECA - static final int DATA_COMPRESSION_OLD_ = 1; // @ECA - static final int DATA_COMPRESSION_RLE_ = 0x3832; // @ECA @EIC @EJC - - - // Private data. - private AS400ImplRemote as400_; - private AS400 as400PublicClassObj_; // Prevents garbage collection. - //@P0D private BitSet assigned_; // @DAC - private boolean cancelling_; // @E8A - private CancelLock cancelLock_ = new CancelLock(); // @E8A@C7C - private String catalog_; - boolean checkStatementHoldability_ = false; // @F3A //@XAC - private boolean closing_; // @D4A - ConvTable converter_; //@P0C - private int dataCompression_ = -1; // @ECA - private JDDataSourceURL dataSourceUrl_; - private boolean drda_; // @B1A - private String defaultSchema_; - private boolean extendedFormats_; - // @E2D private ConverterImplRemote graphicConverter_; - // @E2D private boolean graphicConverterLoaded_; - private Vector heldRequests_; // @E5A - private HeldRequestsLock heldRequestsLock_ = new HeldRequestsLock(); // @E5A@C7C - private int holdability_ = AS400JDBCResultSet.HOLDABILITY_NOT_SPECIFIED; // @G4A - private int id_; - private AS400JDBCDatabaseMetaData metaData_; - private JDPackageManager packageManager_; - private JDProperties properties_; - private boolean readOnly_; - //@P0D private BitSet requestPending_; // @DAC - //@P1Dprivate final boolean[] requestPending_ = new boolean[MAX_STATEMENTS_]; //@P0A - private AS400Server server_; - private int serverFunctionalLevel_; // @E7A - private String serverJobIdentifier_ = null; // @E8A - private SQLWarning sqlWarning_; - private Vector statements_; // @DAC - JDTransactionManager transactionManager_; // @E10c - static final ConvTable unicodeConverter_ = new ConvTable13488(); // @E3A @P0C - ConvTable packageCCSID_Converter = null; //Bidi-HCG - int vrm_; // @D0A @E10c - - // declare the user-supplied value for server trace. The constants for - // the definition of each bit in the bit map are defined in Trace.java - private int traceServer_ = 0; // @j1a - - // set to true if database host server tracing is started via the setDBHostServerTrace method - private boolean databaseHostServerTrace_ = false; // @2KR - - private boolean mustSpecifyForUpdate_ = true; // @j31 - - //counter to keep track of number of open statements - private int statementCount_ = 0; //@K1A - private boolean thousandStatements_ = false; //@K1A - - private String qaqqiniLibrary_ = null; //@K2A - - //@KBA Specifies level of autocommit support to use. - // If V5R2 or earlier use old support of running SET TRANSACTION STATEMENTS (0) - // If "true autocommit" connection property is false - run autocommit under *NONE isolation (1) - // If "true autocommit" connection property is true - run with specified isolation (2) - int newAutoCommitSupport_ = 1; //@KBA - - private boolean wrappedInsert_ = false; // @GKA - //@pda 550 client info - //Names for clientInfo identifiers. DatabaseMetadata also will use these names - static final String applicationNamePropertyName_ = "ApplicationName"; - static final String clientUserPropertyName_ = "ClientUser"; - static final String clientHostnamePropertyName_ = "ClientHostname"; - static final String clientAccountingPropertyName_ = "ClientAccounting"; - static final String clientProgramIDPropertyName_ = "ClientProgramID"; //@pda - - //@pda 550 client info values - private String applicationName_ = ""; //@pdc so can be added to Properties object in getClientInfo() - private String clientUser_ = ""; //@pdc - private String clientHostname_ = ""; //@pdc - private String clientAccounting_ = ""; //@pdc - private String clientProgramID_ = ""; //@pdc - - private int concurrentAccessResolution_ = AS400JDBCDataSource.CONCURRENTACCESS_NOT_SET; //@cc1 - - private boolean doUpdateDeleteBlocking_ = false; //@A2A - private int maximumBlockedInputRows_ = 32000; //@A6A - - /** - Static initializer. Initializes the reply data streams - that we expect to receive. - **/ - static - { - // The database server will only return 1 type of reply. - //@P0D AS400Server.addReplyStream (new DBReplyRequestedDS (), - AS400Server.addReplyStream(DBDSPool.getDBReplyRequestedDS(), //@P0A - AS400.DATABASE); - } - - - - // The default constructor reserved for use within the package. - AS400JDBCConnection () //@A3A - { - } - - - - // @A3D Deleted constructor: - // AS400JDBCConnection (JDDataSourceURL dataSourceUrl, JDProperties properties) - // throws SQLException - - - - // @E8A - /** - Cancels a statement within this connection. - - @param id The ID of the statement. - - @exception SQLException If the statement cannot be executed. - **/ - void cancel(int id) - throws SQLException - { - // Lock out all other operations for this connection. - synchronized(cancelLock_) - { - if (TESTING_THREAD_SAFETY) return; // in certain testing modes, don't contact the system - cancelling_ = true; - AS400JDBCConnection cancelConnection = null; - try - { - // If the server job identifier was returned, and the system is at a - // functional level 5 or greater, then use the job identifier to issue - // the cancel from another connection. Otherwise, do nothing. - if ((serverJobIdentifier_ != null) && (serverFunctionalLevel_ >= 5)) - { - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Cancelling statement " + id); - - // Create another connection to issue the cancel. - cancelConnection = new AS400JDBCConnection(); - - //AS400 system = new AS400(as400PublicClassObj_); - //cancelConnection.setSystem(system); - - cancelConnection.setProperties(dataSourceUrl_, properties_, as400_, true); - - // Send the cancel request. - DBSQLRequestDS request = null; - DBReplyRequestedDS cancelReply = null; - try - { - request = DBDSPool.getDBSQLRequestDS(DBSQLRequestDS.FUNCTIONID_CANCEL, id_, - DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); - request.setJobIdentifier(serverJobIdentifier_, converter_); - cancelReply = cancelConnection.sendAndReceive (request); - - int errorClass = cancelReply.getErrorClass(); - int returnCode = cancelReply.getReturnCode(); - if (errorClass != 0) - JDError.throwSQLException(this, id_, errorClass, returnCode); - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - finally - { - if (request != null) { - request.returnToPool(); request = null; - } - if (cancelReply != null) { - cancelReply.returnToPool(); cancelReply = null; - } - } - } - else - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Cancel of statement " + id + " requested, but is not supported by system"); - } - } - finally - { - // always need to close the connection - if (cancelConnection != null) { - try { cancelConnection.close(); } - catch (Throwable e) {} // ignore any exceptions - } - - // Let others back in. - cancelling_ = false; - cancelLock_.notifyAll(); - } - } - } - - - - /** - Checks that the specified SQL statement can be executed. - This decision is based on the access specified by the caller - and the read only mode. - - @param sqlStatement The SQL statement. - - @exception SQLException If the statement cannot be executed. - **/ - void checkAccess (JDSQLStatement sqlStatement) - throws SQLException - { - String access = properties_.getString (JDProperties.ACCESS); - - // If we only have read only access, then anything other - // than a SELECT can not be executed. - if ((access.equalsIgnoreCase (JDProperties.ACCESS_READ_ONLY)) - && (! sqlStatement.isSelect ())) - JDError.throwSQLException (this, JDError.EXC_ACCESS_MISMATCH); - - // If we have read call access, then anything other than - // a SELECT or CALL can not be executed. - if (((readOnly_) - || ((access.equalsIgnoreCase (JDProperties.ACCESS_READ_CALL)))) - && (! sqlStatement.isSelect()) - && (! sqlStatement.isProcedureCall())) - JDError.throwSQLException (this, JDError.EXC_ACCESS_MISMATCH); - } - - - - // @E8A - /** - Checks to see if we are cancelling a statement. If so, wait until the - cancel is done. If not, go ahead. - **/ - private void checkCancel() - { - synchronized(cancelLock_) - { - if (cancelling_) - { - try - { - cancelLock_.wait(); - } - catch (InterruptedException e) - { - // Ignore. - } - } - } - } - - - //@F3A - /** - Checks if what the user passed in for holdability is valid. - **/ - private boolean checkHoldabilityConstants (int holdability) - { - if ((holdability == AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT) || - (holdability == AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT) || - (holdability == AS400JDBCResultSet.HOLDABILITY_NOT_SPECIFIED)) - { - return true; - } - return false; - } - - - /** - Checks that the connection is open. Public methods - that require an open connection should call this first. - - @exception SQLException If the connection is not open. - **/ - void checkOpen () - throws SQLException - { - if (TESTING_THREAD_SAFETY) return; // in certain testing modes, don't contact IBM i system - if (server_ == null) - JDError.throwSQLException (this, JDError.EXC_CONNECTION_NONE); - } - - - - /** - Clears all warnings that have been reported for the connection. - After this call, getWarnings() returns null until a new warning - is reported for the connection. - - @exception SQLException If an error occurs. - **/ - public void clearWarnings () - throws SQLException - { - sqlWarning_ = null; - } - - - - /** - Releases the connection's resources immediately instead of waiting - for them to be automatically released. This rolls back any active - transactions, closes all statements that are running in the context - of the connection, and disconnects from the IBM i system. - - @exception SQLException If an error occurs. - **/ - // - // Implementation notes: - // - // 1. We do not have to worry about thread synchronization here, - // since the AS400Server object handles it. - // - // 2. It is a requirement to not get replies during a finalize() - // method. Since finalize() calls this method, this requirement - // applies here, too. - // - public void close () - throws SQLException - { - // @D4A - // Avoid recursion. When we close associated statements, they try - // to close this connection. - if (closing_) return; - closing_ = true; - - // If this is already closed, then just do nothing. - // - // The spec does not define what happens when a connection - // is closed multiple times. The official word from the Sun - // JDBC team is that "the driver's behavior in this case - // is implementation defined. Applications that do this are - // non-portable." - if (isClosed ()) - return; - - // partial close (moved rollback and closing of all the statements). @E1 - pseudoClose(); - - // Disconnect from the system. - if (server_ != null) - { - - // @B3 It turns out that we were closing the connection, - // @B3 then the AS400Server object was in its disconnectServer() - // @B3 method. Since the AS400Server object needs to do other - // @B3 cleanup, we still need to call it. - - // @B3D try { - // @B3D DBSQLEndCommDS request = new DBSQLEndCommDS ( - // @B3D DBSQLEndCommDS.FUNCTIONID_END_COMMUNICATION, - // @B3D id_, 0, 0); - // @B3D send (request); - // @B3D } - // @B3D catch (Exception e) { - // @B3D JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - // @B3D } - - - - - as400_.disconnectServer (server_); - server_ = null; - } - - if (JDTrace.isTraceOn()) - JDTrace.logClose (this); - } - - - - // @E4C - /** - Commits all changes made since the previous commit or - rollback and releases any database locks currently held by - the connection. This has no effect when the connection - is in auto-commit mode. - -

        This method can not be called when the connection is part - of a distributed transaction. See - AS400JDBCXAResource for more information. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public void commit () - throws SQLException - { - checkOpen (); - - if (!transactionManager_.isLocalTransaction()) // @E4A - JDError.throwSQLException (this, JDError.EXC_TXN_STATE_INVALID); // @E4A - - // Note: CPS 72CSHT support - if (transactionManager_.getAutoCommit () && properties_.getBoolean(JDProperties.AUTOCOMMIT_EXCEPTION)) //@CE1 - JDError.throwSQLException (this, JDError.EXC_FUNCTION_SEQUENCE); //@CE1 - - // Note: Intuitively, it seems like if we are in - // auto-commit mode, that we should not need to - // do anything for an explicit commit. However, - // somewhere along the line, the system gets - // confused, so we go ahead an send the commit - // anyway. - - transactionManager_.commit (); - - // @F3 If cursor hold property is false, then mark the cursors closed. Don't worry here - // @F3 about whether their statement level holdability is different; we will check that - // @F3 within AS400JDBCStatement.markCursorsClosed(). - // @F3 If the user has changed any statement's holdability, then we need to go through - // @F3 the enumeration to see if there are ones where we may need to close our cursors - // @F3 or internal result sets. - // @F3 Passing true to markCursorsClosed means we called this method from rollback(). - if (transactionManager_.getHoldIndicator() == JDTransactionManager.CURSOR_HOLD_FALSE // @B4A - || (checkStatementHoldability_ && getVRM() >= JDUtilities.vrm520)) // @F3A - markCursorsClosed(false); // @B4A - - if(!getAutoCommit() && properties_.getBoolean(JDProperties.HOLD_STATEMENTS )) //@KBL if auto commit is off, check to see if any statements have been partially closed //@PDA additional HOLD_STATEMENTS check - markStatementsClosed(); //@KBL - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Transaction commit"); - } - - - //@F3A - /** - Sets a flag for whether the user has changed the holdability for any of the statements that - came from this connection. As of JDBC 3.0, the user can specify a statement-level holdability - that is different from the statement-level holdability. Rather than always going through all - of the statements to see if any of their holidabilities is different, we will mark this flag if - the user changes any of the statement holdabilities. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - void setCheckStatementHoldability(boolean check) - { - checkStatementHoldability_ = check; - } - - - - /** - Corrects the result set type based on the result set concurrency - and posts a warning. - - @param resultSetType The result set type. - @param resultSetConcurrency The result set concurrency. - @return The correct result set type. - **/ - private int correctResultSetType (int resultSetType, - int resultSetConcurrency) - throws SQLException // @EGA - { - int newResultSetType = (resultSetConcurrency == ResultSet.CONCUR_UPDATABLE) - ? ResultSet.TYPE_SCROLL_SENSITIVE : ResultSet.TYPE_SCROLL_INSENSITIVE; - postWarning (JDError.getSQLWarning (JDError.WARN_OPTION_VALUE_CHANGED)); - return newResultSetType; - } - - - - /** - Creates a Statement object for executing SQL statements without - parameters. If the same SQL statement is executed many times, it - is more efficient to use prepareStatement(). - -

        Result sets created using the statement will be type - ResultSet.TYPE_FORWARD_ONLY and concurrency - ResultSet.CONCUR_READ_ONLY. - - @return The statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, or an - error occurs. - **/ - public Statement createStatement () - throws SQLException - { - return createStatement (ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY, getInternalHoldability()); //@G4C - } - - - - // JDBC 2.0 - /** - Creates a Statement object for executing SQL statements without - parameters. If the same SQL statement is executed many times, it - is more efficient to use prepareStatement(). - - @param resultSetType The result set type. Valid values are: -

          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @param resultSetConcurrency The result set concurrency. Valid values are: -
          -
        • ResultSet.CONCUR_READ_ONLY -
        • ResultSet.CONCUR_UPDATABLE -
        - @return The statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type or currency is not supported, - or an error occurs. - **/ - public Statement createStatement (int resultSetType, - int resultSetConcurrency) - throws SQLException - { - return createStatement (resultSetType, //@G4A - resultSetConcurrency, getInternalHoldability()); //@G4A - //@G4M Moved code to createStatement (int, int, int) - } - - - //@G4A JDBC 3.0 - /** - Creates a Statement object for executing SQL statements without - parameters. If the same SQL statement is executed many times, it - is more efficient to use prepareStatement(). - -

        Full functionality of this method requires support in OS/400 V5R2 - or IBM i. If connecting to OS/400 V5R1 or earlier, the value for - resultSetHoldability will be ignored. - - @param resultSetType The result set type. Valid values are: -

          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @param resultSetConcurrency The result set concurrency. Valid values are: -
          -
        • ResultSet.CONCUR_READ_ONLY -
        • ResultSet.CONCUR_UPDATABLE -
        - @param resultSetHoldability The result set holdability. Valid values are: -
          -
        • ResultSet.HOLD_CURSORS_OVER_COMMIT -
        • ResultSet.CLOSE_CURSORS_AT_COMMIT -
        - @return The statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type, currency, or holdability is not supported, - or an error occurs. - @since Modification 5 - **/ - public Statement createStatement (int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - // Validation. - checkOpen (); - if (! metaData_.supportsResultSetConcurrency (resultSetType, resultSetConcurrency)) - resultSetType = correctResultSetType (resultSetType, resultSetConcurrency); - - if (!checkHoldabilityConstants (resultSetHoldability)) //@F3A - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); //@F3A - - // Create the statement. - int statementId = getUnusedId (resultSetType); // @B1C - AS400JDBCStatement statement = new AS400JDBCStatement (this, - statementId, transactionManager_, packageManager_, - properties_.getString (JDProperties.BLOCK_CRITERIA), - properties_.getInt (JDProperties.BLOCK_SIZE), - properties_.getBoolean (JDProperties.PREFETCH), - properties_.getString (JDProperties.PACKAGE_CRITERIA), // @A2A - resultSetType, resultSetConcurrency, resultSetHoldability, //@G4A - AS400JDBCStatement.GENERATED_KEYS_NOT_SPECIFIED); //@G4A - statements_.addElement(statement); // @DAC - statementCount_++; //@K1A - if(thousandStatements_ == false && statementCount_ == 1000) //@K1A - { //@K1A - thousandStatements_ = true; //@K1A - //post warning //@K1A - postWarning(JDError.getSQLWarning(JDError.WARN_1000_OPEN_STATEMENTS)); //@K1A - } //@K1A - - if (JDTrace.isTraceOn()) //@F4A - { //@F4A - int size = statements_.size(); //@F4A - if (size % 256 == 0) //@F4A - { //@F4A - JDTrace.logInformation (this, "Warning: Open handle count now: " + size); //@F4A - } //@F4A - } //@F4A - - return statement; - } - - - - - /** - Outputs debug information for a request. This should only be used - for debugging the JDBC driver and is not intended for production code. - - @param request The request. - **/ - private void debug (DBBaseRequestDS request) - { - if (DEBUG_COMM_TRACE_ >= 1) - System.out.println ("Server request: " - + Integer.toString (request.getServerID(), 16).toUpperCase() - + ":" + Integer.toString (request.getReqRepID(), 16).toUpperCase() - + "."); - if (DEBUG_COMM_TRACE_ >= 2) - request.dump (System.out); - } - - - - /** - Outputs debug information for a reply. This should only be used - for debugging the JDBC driver and is not intended for production code. - - @param reply The reply. - **/ - private void debug (DBReplyRequestedDS reply) - { - if (DEBUG_COMM_TRACE_ >= 1) - System.out.println ("Server reply: " - + Integer.toString (reply.getServerID(), 16).toUpperCase() - + ":" + Integer.toString (reply.getReturnDataFunctionId(), 16).toUpperCase() - + "."); - if (DEBUG_COMM_TRACE_ >= 2) - reply.dump (System.out); - - int returnCode = ((DBReplyRequestedDS) reply).getReturnCode(); - - if (DEBUG_COMM_TRACE_ >= 1) - { - int errorClass = ((DBReplyRequestedDS) reply).getErrorClass(); - if ((errorClass != 0) || (returnCode != 0)) - System.out.println ("Server error = " + errorClass + ":" - + returnCode + "."); - } - } - - - - /** - Closes the connection if not explicitly closed by the caller. - - @exception Throwable If an error occurs. - **/ - protected void finalize () - throws Throwable - { - if (! isClosed ()) { - JDTrace.logInformation (this, "WARNING: Finalizer thread closing connection object."); - close (); - } - super.finalize (); - } - - - - /** - Returns the AS400 object for this connection. - - @return The AS400 object. - **/ - AS400Impl getAS400 () - throws SQLException // @EGA - { - return as400_; - } - - - - /** - Returns the auto-commit state. - - @return true if the connection is in auto-commit mode; - false otherwise. - - @exception SQLException If the connection is not open. - **/ - public boolean getAutoCommit () - throws SQLException - { - checkOpen (); - return transactionManager_.getAutoCommit (); - } - - - - /** - Returns the catalog name. - - @return The catalog name. - - @exception SQLException If the connection is not open. - **/ - public String getCatalog () - throws SQLException - { - checkOpen (); - return catalog_; - } - - //@cc1 - /** - * This method returns the concurrent access resolution setting. - * This method has no effect on IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @return The concurrent access resolution setting. Possible return valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public int getConcurrentAccessResolution () - { - return concurrentAccessResolution_; - } - - /** - Returns the converter for this connection. - - @return The converter. - **/ - //@P0D ConverterImplRemote getConverter () - //@P0D throws SQLException // @EGA - //@P0D { - //@P0D return converter_; - //@P0D } - - - - /** - Returns the converter for the specified CCSID, unless - it is 0 or 65535 (i.e. probably set for a non-text field), in - which case it returns the converter for this connection. - This is useful for code that handles all types of fields - in a generic manner. - - @param ccsid The CCSID. - @return The converter. - - @exception SQLException If the CCSID is not valid. - **/ - ConvTable getConverter (int ccsid) //@P0C - throws SQLException - { - try - { - if (ccsid == 0 || ccsid == 1 || ccsid == 65535 || ccsid == -1) return converter_; //@P0C - //@P0D switch (ccsid) - //@P0D { // @E3A - //@P0D case 65535: //@ELC // @E3A - //@P0D case 0: // @E3A - //@P0D case 1: // @E3A - //@P0D return converter_; // @E3A - //@P0D case UNICODE_CCSID_: // @E3A - //@P0D if (unicodeConverter_ == null) // @E3A - //@P0D unicodeConverter_ = ConverterImplRemote.getConverter(13488, as400_); // @E3A - //@P0D return unicodeConverter_; // @E3A - //@P0D default: // @E3A - //@P0D return ConverterImplRemote.getConverter (ccsid, as400_); // @E3C - //@P0D } // @E3A - return ConvTable.getTable(ccsid, null); //@P0A - } - catch (UnsupportedEncodingException e) - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - // @ECA - /** - Returns the style of data compression. - - @return The style of data compression. Possible values are DATA_COMPRESSION_NONE_, - DATA_COMPRESSION_OLD_, and DATA_COMPRESSION_RLE_. - **/ - int getDataCompression() // @ECA - { // @ECA - return dataCompression_; // @ECA - } // @ECA - - - - /** - Returns the default SQL schema. - - @return The default SQL schema, or QGPL if none was - specified. - **/ - String getDefaultSchema () - throws SQLException // @EGA - { - return((defaultSchema_ == null) ? "QGPL" : defaultSchema_); - } - - - //@DELIMa - /** - Returns the default SQL schema. - - @param returnRawValue Indicates what to return if default SQL schema has not been set. If true, return raw value; if false, then return QGPL rather than null. - @return The default SQL schema. If returnRawValue==false and no default SQL schema was specified, then return QGPL rather than null. - **/ - String getDefaultSchema (boolean returnRawValue) - throws SQLException - { - return((returnRawValue || defaultSchema_ != null) ? defaultSchema_ : "QGPL"); - } - - - //@G4A JDBC 3.0 - /** - Returns the holdability of ResultSets created from this connection. - - @return The cursor holdability. Valid values are ResultSet.HOLD_CURSORS_OVER_COMMIT and - ResultSet.CLOSE_CURSORS_AT_COMMIT. The holdability is derived in this order - of precedence: -
          -
        • 1. The holdability specified using the method setHoldability(int) - if this method was called. -
        • 2. The value of the cursor hold - driver property.
        - Full functionality of #1 requires support in OS/400 - V5R2 or IBM i. If connecting to OS/400 V5R1 or earlier, - the value specified on this method will be ignored and the default holdability - will be the value of #2. - - @exception SQLException If the connection is not open. - @since Modification 5 - **/ - public int getHoldability () - throws SQLException - { - checkOpen (); - // If holdability has been set, return its value. - if ((holdability_ == AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT) || - (holdability_ == AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT)) - { - return holdability_; - } - // Else, holdability either equals AS400JDBCResultSet.HOLDABILITY_NOT_SPECIFIED - // or has an incorrect value (shouldn't be able to happen). - // Return the holdability determined by seeing what the cursor hold driver property - // was set to. Default is HOLD_CURSORS_AT_COMMIT. - else - { - if (transactionManager_.getHoldIndicator() == JDTransactionManager.CURSOR_HOLD_TRUE) - return AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT; - else if (transactionManager_.getHoldIndicator() == JDTransactionManager.CURSOR_HOLD_FALSE) - return AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT; - // Hold indicator will be set to -1 if the user gave us a bad number in setHoldIndicator(). - // We threw an exception there, so throw another exception here, then return default - // value for driver. - else - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL); - return AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT; - } - } - } - - - //@DELIMa - /** - Returns the ID of the connection. - @return The connection ID. - **/ - int getID() - { - return id_; - } - - - //@G4A JDBC 3.0 - /** - Returns the holdability of ResultSets created from this connection. - Use this method internally to return the value specified if the user has called - setHoldability(int), or HOLDABILITY_NOT_SPECIFIED if that - method hasn't been called, meaning to use the old behavior and not the new code - point for cursor holdability. - - @return The cursor holdability. Valid values are - AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT, - AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT, - and AS400JDBCResultSet.HOLDABILITY_NOT_SPECIFIED. - - @since Modification 5 - **/ - int getInternalHoldability () - { - return holdability_; - } - - - - // @E2D /** - // @E2D Returns the graphic converter for this connection. - // @E2D - // @E2D @return The graphic converter. - // @E2D - // @E2D @exception SQLException If no graphic converter was loaded. - // @E2D **/ - // @E2D // - // @E2D // Implementation note: - // @E2D // - // @E2D // * Graphic data is pure double-byte, so we will need a - // @E2D // different converter for that. If there is no associated - // @E2D // double-byte CCSID, or the converter can not be loaded, - // @E2D // then we should throw an exception. We wait to load this, - // @E2D // since the majority of callers do not need this converter. - // @E2D // - // @E2D ConverterImplRemote getGraphicConverter () - // @E2D throws SQLException - // @E2D { - // @E2D // If the graphic converter has not yet been loaded, - // @E2D // then do so. - // @E2D if (graphicConverterLoaded_ == false) { - // @E2D int serverGraphicCCSID = ExecutionEnvironment.getAssociatedDbcsCcsid (converter_.getCcsid ()); - // @E2D if (serverGraphicCCSID != -1) { - // @E2D try { - // @E2D graphicConverter_ = ConverterImplRemote.getConverter (serverGraphicCCSID, as400_); - // @E2D } - // @E2D catch (UnsupportedEncodingException e) { - // @E2D graphicConverter_ = null; - // @E2D } - // @E2D } - // @E2D - // @E2D if (JDTrace.isTraceOn ()) { - // @E2D if (graphicConverter_ != null) - // @E2D JDTrace.logInformation (this, "Server graphic CCSID = " + serverGraphicCCSID); - // @E2D else - // @E2D JDTrace.logInformation (this, "No graphic CCSID was loaded"); - // @E2D } - // @E2D } - // @E2D - // @E2D // Return the graphic converter, or throw an exception. - // @E2D if (graphicConverter_ == null) - // @E2D JDError.throwSQLException (this, JDError.EXC_CCSID_INVALID); - // @E2D return graphicConverter_; - // @E2D } - - - - /** - Returns the DatabaseMetaData object that describes the - connection's tables, supported SQL grammar, stored procedures, - capabilities and more. - - @return The metadata object. - - @exception SQLException If an error occurs. - **/ - public DatabaseMetaData getMetaData () - throws SQLException - { - // We allow a user to get this object even if the - // connection is closed. - - return metaData_; - } - - - - /** - Returns the connection properties. - - @return The connection properties. - **/ - JDProperties getProperties () - throws SQLException // @EGA - { - return properties_; - } - - - - // @E8A - /** - Returns the job identifier of the host server job corresponding to this connection. - Every JDBC connection is associated with a host server job on the IBM i system. The - format is: -
          -
        • 10 character job name -
        • 10 character user name -
        • 6 character job number -
        - -

        Note: Since this method is not defined in the JDBC Connection interface, - you typically need to cast a Connection object to AS400JDBCConnection in order - to call this method: -

        -    String serverJobIdentifier = ((AS400JDBCConnection)connection).getServerJobIdentifier();
        -    
        - - @return The server job identifier, or null if not known. - **/ - public String getServerJobIdentifier() // @E8A - { // @E8A - return serverJobIdentifier_; // @E8A - } // @E8A - - - - - int getServerFunctionalLevel() // @EEA - { // @EEA - return serverFunctionalLevel_; // @EEA - } // @EEA - - - // @EHA - /** - Returns the system object which is managing the connection to the system. - -

        Note: Since this method is not defined in the JDBC Connection interface, - you typically need to cast a Connection object to AS400JDBCConnection in order - to call this method: -

        -    AS400 system = ((AS400JDBCConnection)connection).getSystem();
        -    
        - - @return The system. - **/ - // Implementation note: Don't use this object internally because we could be running in a proxy environment - // The purpose of this method is to simply hold the full AS400 object so it can be retrieved from the Connection - public AS400 getSystem() // @EHA - { // @EHA - return as400PublicClassObj_; // @EHA - } // @EHA - - - - - - /** - Returns the transaction isolation level. - - @return The transaction isolation level. Possible - values are: -
          -
        • TRANSACTION_NONE -
        • TRANSACTION_READ_UNCOMMITTED -
        • TRANSACTION_READ_COMMITTED -
        • TRANSACTION_REPEATABLE_READ -
        - - @exception SQLException If the connection is not open. - **/ - public int getTransactionIsolation () - throws SQLException - { - checkOpen (); - return transactionManager_.getIsolation (); - } - - - - JDTransactionManager getTransactionManager() // @E4A - { // @E4A - return transactionManager_; // @E4A - } // @E4A - - - - // JDBC 2.0 - /** - Returns the type map. - -

        This driver does not support the type map. - - @return The type map. - - @exception SQLException This exception is always thrown. - **/ - public Map getTypeMap () - throws SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - - - // @B1C - /** - Returns the next unused id. - - @param resultSetType The result set type. This is - relevant only when the connection - is being used for DRDA. - @return The next unused id. - **/ - // - // Implementation note: This method needs to be synchronized - // so that the same id does not get assigned twice. - // - private int getUnusedId (int resultSetType) //@P0C - throws SQLException - { - synchronized(assigned_) //@P1A - { - // Note: We will always assume id 0 is being used, - // since that represents the connection itself. - - // If this connection is being used for DRDA, then we - // must use statement ids of 1-128 for non-scrollable - // cursors and 129-255 for scrollable cursors. - if (drda_) - { - if (resultSetType == ResultSet.TYPE_FORWARD_ONLY) - { - for (int i = 1; i < DRDA_SCROLLABLE_CUTOFF_; ++i) - { - //@P0Dif (assigned_.get(i) == false) - //@P0D{ // @DAC - //@P0D assigned_.set(i); // @DAC - //@P0D return i; - //@P0D} - if (!assigned_[i]) //@P0A - { - assigned_[i] = true; //@P0A - return i; //@P0A - } - } - } - else - { - for (int i = DRDA_SCROLLABLE_CUTOFF_; i < DRDA_SCROLLABLE_MAX_; ++i) - { // @DAC - //@P0Dif (assigned_.get(i) == false) - //@P0D{ // @DAC - //@P0D assigned_.set(i); // @DAC - //@P0D return i; - //@P0D} - if (!assigned_[i]) //@P0A - { - assigned_[i] = true; //@P0A - return i; //@P0A - } - } - } - } - - // If this connection is NOT being used for DRDA, then - // we can use any statement id. - else - { - for (int i = 1; i < MAX_STATEMENTS_; ++i) - { - //@P0Dif (assigned_.get(i) == false) - //@P0D{ // @DAC - //@P0D assigned_.set(i); // @DAC - //@P0D return i; - //@P0D} - if (!assigned_[i]) //@P0A - { - assigned_[i] = true; //@P0A - return i; //@P0A - } - } - } - - // All ids are being used. - JDError.throwSQLException (this, JDError.EXC_MAX_STATEMENTS_EXCEEDED); - return -1; - } - } - - - - // @j31a new method -- Must the user have "for update" on their - // SQL statement to guarantee an updatable cursor? The answer is - // no for v5r2 and v5r1 systems with a PTF. For V5R1 systems - // without the PTF, v4r5, and earlier, the answer is yes. - boolean getMustSpecifyForUpdate () - { - return mustSpecifyForUpdate_; - } - - - - - - /** - Returns the URL for the connection's database. - - @return The URL for the database. - **/ - String getURL () - throws SQLException // @EGA - { - return dataSourceUrl_.toString (); - } - - - - /** - Returns the user name as currently signed on to the system. - - @return The user name. - **/ - String getUserName () - throws SQLException // @EGA - { - if (TESTING_THREAD_SAFETY) // in certain testing modes, don't contact IBM i system - { - String userName = as400_.getUserId (); - if (userName == null || userName.length() == 0) { - userName = as400PublicClassObj_.getUserId(); - } - return userName; - } - - return as400_.getUserId (); - } - - - - int getVRM() // @D0A - throws SQLException // @EGA - { // @D0A - return vrm_; // @D0A - } // @D0A - - - - /** - Returns the first warning reported for the connection. - Subsequent warnings may be chained to this warning. - - @return The first warning or null if no warnings - have been reported. - - @exception SQLException If an error occurs. - **/ - public SQLWarning getWarnings () - throws SQLException - { - return sqlWarning_; - } - - - - /** - Indicates if the specified cursor name is already used - in the connection. - - @return true if the cursor name is already used; - false otherwise. - **/ - boolean isCursorNameUsed (String cursorName) - throws SQLException // @EGA - { - Enumeration list = statements_.elements(); // @DAA - while (list.hasMoreElements()) - { // @DAC - if (((AS400JDBCStatement)list.nextElement()).getCursorName().equalsIgnoreCase(cursorName)) // @DAC - return true; - } - return false; - } - - - - /** - Indicates if the connection is closed. - - @return true if the connection is closed; false - otherwise. - - @exception SQLException If an error occurs. - **/ - public boolean isClosed () - throws SQLException - { - if (TESTING_THREAD_SAFETY) return false; // in certain testing modes, don't contact IBM i system - - if (server_ == null) // @EFC - return true; // @EFA - if (!server_.isConnected()) - { // @EFA - server_ = null; // @EFA - return true; // @EFA - } // @EFA - else // @EFA - return false; // @EFA - } - - - - /** - Indicates if the connection is in read-only mode. - - @return true if the connection is in read-only mode; - false otherwise. - - @exception SQLException If the connection is not open. - **/ - public boolean isReadOnly () - throws SQLException - { - checkOpen (); - return((readOnly_) || isReadOnlyAccordingToProperties()); // @CPMc - } - - // Called by AS400JDBCPooledConnection. - boolean isReadOnlyAccordingToProperties() - throws SQLException - { - checkOpen (); - return((properties_.getString (JDProperties.ACCESS).equalsIgnoreCase (JDProperties.ACCESS_READ_ONLY)) - || (properties_.getString (JDProperties.ACCESS).equalsIgnoreCase (JDProperties.ACCESS_READ_CALL))); - } - - - // @B4A - /** - Marks all of the cursors as closed. - - @param isRollback True if we called this from rollback(), false if we called this from commit(). - **/ - void markCursorsClosed(boolean isRollback) //@F3C //@XAC - throws SQLException //@F2A - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Testing to see if cursors should be held."); //@F3C - - Enumeration list = statements_.elements(); // @DAA - while (list.hasMoreElements()) // @DAC - { //@KBL - AS400JDBCStatement statement = (AS400JDBCStatement)list.nextElement(); //@KBL - //@KBLD ((AS400JDBCStatement)list.nextElement()).markCursorClosed(isRollback); // @DAC @F3C - // If the statement is held open, all of the result sets have already been closed - if(!statement.isHoldStatement()) //@KBL - statement.markCursorClosed(isRollback); //@KBL - } //@KBL - } - - //@KBL - /* - If a statement associated with locators has been partially closed, finish closing the statement object. - A statement may become partially closed if the user closed the statement and set the "hold statements" connection - property to true when making the connection. Additionally, the statement must have been used to access a locator. - */ - private void markStatementsClosed() - { - if(!statements_.isEmpty()) - { - // Make a clone of the vector, since it will be modified as each statement - // closes itself. - // @KBL Close any statements the user called close on that were associated with locators. - Vector statements = (Vector)statements_.clone(); - Enumeration list = statements.elements(); - while (list.hasMoreElements()) - { - AS400JDBCStatement statement = (AS400JDBCStatement)list.nextElement(); - try - { - if(statement.isHoldStatement()) - { - statement.setAssociatedWithLocators(false); - statement.finishClosing(); - } - } - catch (SQLException e) - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Closing statement after rollback failed: " + e.getMessage()); - } - } - } - } - - //@GKA - // Note: This method is used when the user supplies either the column indexes or names - // to the execute/executeUpdate/prepareStatement method. - /* - * Prepares and executes the statement needed to retrieve generated keys. - */ - String makeGeneratedKeySelectStatement(String sql, int[] columnIndexes, String[] columnNames) - throws SQLException - { - if(columnIndexes != null) - { - //verify there is a column index in the specified array - if(columnIndexes.length == 0) - JDError.throwSQLException(JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - //Prepare a statement in order to retrieve the column names associated with the indexes specified in the array - //wrapper the statement with a select * from final table - // @B4C. Use NEW TABLE instead of FINAL TABLE. With FINAL TABLE, the query will fail if - // AFTER INSERT TRIGGERS are present. Since it is unlikely that AFTER INSERT triggers will - // change the autogenerated keys, NEW TABLE is used. - StringBuffer selectAll = new StringBuffer("SELECT * FROM NEW TABLE("); - selectAll.append(sql); - selectAll.append(")"); - PreparedStatement genPrepStat = prepareStatement(selectAll.toString()); - - // retrieve the JDServerRow object associated with this statement. It contains the column name info. - JDServerRow results = ((AS400JDBCPreparedStatement)genPrepStat).getResultRow(); - columnNames = new String[columnIndexes.length]; - try{ - for(int j=0; jResult sets created using the statement will be type - ResultSet.TYPE_FORWARD_ONLY and concurrency - ResultSet.CONCUR_READ_ONLY. - - @param sql The SQL stored procedure call. - @return The callable statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, or an - error occurs. - **/ - public CallableStatement prepareCall (String sql) - throws SQLException - { - return prepareCall (sql, ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY, getInternalHoldability()); //@G4A - } - - - - // JDBC 2.0 - /** - Precompiles an SQL stored procedure call with optional input - and output parameters and stores it in a CallableStatement - object. This object can be used to efficiently call the SQL - stored procedure multiple times. - - @param sql The SQL statement. - @param resultSetType The result set type. Valid values are: -

          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @param resultSetConcurrency The result set concurrency. Valid values are: -
          -
        • ResultSet.CONCUR_READ_ONLY -
        • ResultSet.CONCUR_UPDATABLE -
        - @return The prepared statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type or currency is not valid, - or an error occurs. - **/ - public CallableStatement prepareCall (String sql, - int resultSetType, - int resultSetConcurrency) - throws SQLException - { - return prepareCall(sql, resultSetType, resultSetConcurrency, - getInternalHoldability()); //@G4A - //@G4M Moved code below - } - - - //@G4A JDBC 3.0 - /** - Precompiles an SQL stored procedure call with optional input - and output parameters and stores it in a CallableStatement - object. This object can be used to efficiently call the SQL - stored procedure multiple times. - -

        Full functionality of this method requires support in OS/400 V5R2 - or IBM i. If connecting to OS/400 V5R1 or earlier, the value for - resultSetHoldability will be ignored. - - @param sql The SQL statement. - @param resultSetType The result set type. Valid values are: -

          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @param resultSetConcurrency The result set concurrency. Valid values are: -
          -
        • ResultSet.CONCUR_READ_ONLY -
        • ResultSet.CONCUR_UPDATABLE -
        - @return The prepared statement object. - @param resultSetHoldability The result set holdability. Valid values are: -
          -
        • ResultSet.HOLD_CURSORS_OVER_COMMIT -
        • ResultSet.CLOSE_CURSORS_AT_COMMIT -
        - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type, currency, or holdability is not valid, - or an error occurs. - @since Modification 5 - **/ - public CallableStatement prepareCall (String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - // Validation. - checkOpen (); - if (! metaData_.supportsResultSetConcurrency (resultSetType, resultSetConcurrency)) - resultSetType = correctResultSetType (resultSetType, resultSetConcurrency); - - if (!checkHoldabilityConstants(resultSetHoldability)) //@F3A - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); //@F3A - - // Create the statement. - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - properties_.getString (JDProperties.DECIMAL_SEPARATOR), true, - properties_.getString (JDProperties.PACKAGE_CRITERIA), this); // @A2A @G4A - int statementId = getUnusedId (resultSetType); // @B1C - AS400JDBCCallableStatement statement = new AS400JDBCCallableStatement (this, - statementId, transactionManager_, packageManager_, - properties_.getString (JDProperties.BLOCK_CRITERIA), - properties_.getInt (JDProperties.BLOCK_SIZE), - sqlStatement, - properties_.getString (JDProperties.PACKAGE_CRITERIA), - resultSetType, resultSetConcurrency, resultSetHoldability, //@G4A - AS400JDBCStatement.GENERATED_KEYS_NOT_SPECIFIED); //@G4A - statements_.addElement(statement); // @DAC - statementCount_++; //@K1A - if(thousandStatements_ == false && statementCount_ == 1000) //@K1A - { //@K1A - thousandStatements_ = true; //@K1A - //post warning //@K1A - postWarning(JDError.getSQLWarning(JDError.WARN_1000_OPEN_STATEMENTS)); //@K1A - } //@K1A - - if (JDTrace.isTraceOn()) //@F4A - { //@F4A - int size = statements_.size(); //@F4A - if (size % 256 == 0) //@F4A - { //@F4A - JDTrace.logInformation (this, "Warning: Open handle count now: " + size); //@F4A - } //@F4A - } //@F4A - - return statement; - } - - - - - /** - Precompiles an SQL statement with optional input parameters - and stores it in a PreparedStatement object. This object can - be used to efficiently execute this SQL statement - multiple times. - -

        Result sets created using the statement will be type - ResultSet.TYPE_FORWARD_ONLY and concurrency - ResultSet.CONCUR_READ_ONLY. - - @param sql The SQL statement. - @return The prepared statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, or an - error occurs. - **/ - public PreparedStatement prepareStatement (String sql) - throws SQLException - { - return prepareStatement (sql, ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY, - getInternalHoldability()); //@G4A - } - - - - //@G4A - //JDBC 3.0 - /** - Precompiles an SQL statement with optional input parameters - and stores it in a PreparedStatement object. This object can - be used to efficiently execute this SQL statement - multiple times. - -

        This method requires OS/400 V5R2 or IBM i. If connecting to OS/400 V5R1 or earlier, an exception will be - thrown. - -

        Result sets created using the statement will be type - ResultSet.TYPE_FORWARD_ONLY and concurrency - ResultSet.CONCUR_READ_ONLY. - - @param sql The SQL statement. - @param autoGeneratedKeys Whether to return auto generated keys. Valid values are: -

          -
        • Statement.RETURN_GENERATED_KEYS -
        • Statement.NO_GENERATED_KEYS -
        - @return The prepared statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, - if connecting to OS/400 V5R1 or earlier, - an error occurs. - @since Modification 5 - **/ - public PreparedStatement prepareStatement (String sql, int autoGeneratedKeys) - throws SQLException - { - if (getVRM() < JDUtilities.vrm520) //@F5A - JDError.throwSQLException(this, JDError.EXC_FUNCTION_NOT_SUPPORTED); //@F5A - - // Validation. - checkOpen (); - - // Create the statement. - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - properties_.getString (JDProperties.DECIMAL_SEPARATOR), true, - properties_.getString (JDProperties.PACKAGE_CRITERIA), this); // @A2A @G4A - - if(getVRM() >= JDUtilities.vrm610 && autoGeneratedKeys==Statement.RETURN_GENERATED_KEYS) //@GKA added new generated key support - { - // check if it is an insert statement. - // Note: this should be false if the statement was wrappered with a SELECT - // when prepareStatement(String sql, int[] columnIndex) or - // prepareStatement(String sql, String[] columnNames) was called. - if(sqlStatement.isInsert_) - { - //wrapper the statement - String selectStatement = makeGeneratedKeySelectStatement(sql); - sqlStatement = new JDSQLStatement (selectStatement, properties_.getString(JDProperties.DECIMAL_SEPARATOR), true, - properties_.getString(JDProperties.PACKAGE_CRITERIA), this); - wrappedInsert_ = true; - - } - } - int statementId = getUnusedId (ResultSet.TYPE_FORWARD_ONLY); // @B1C - - if(wrappedInsert_) - { - sqlStatement.setSelectFromInsert(true); - wrappedInsert_ = false; - } - - AS400JDBCPreparedStatement statement = new AS400JDBCPreparedStatement (this, - statementId, transactionManager_, packageManager_, - properties_.getString (JDProperties.BLOCK_CRITERIA), - properties_.getInt (JDProperties.BLOCK_SIZE), - properties_.getBoolean (JDProperties.PREFETCH), - sqlStatement, false, - properties_.getString (JDProperties.PACKAGE_CRITERIA), - ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, - getInternalHoldability(), autoGeneratedKeys); //@G4A - statements_.addElement(statement); // @DAC - statementCount_++; //@K1A - if(thousandStatements_ == false && statementCount_ == 1000) //@K1A - { //@K1A - thousandStatements_ = true; //@K1A - //post warning //@K1A - postWarning(JDError.getSQLWarning(JDError.WARN_1000_OPEN_STATEMENTS)); //@K1A - } //@K1A - - if (JDTrace.isTraceOn()) //@F4A - { //@F4A - int size = statements_.size(); //@F4A - if (size % 256 == 0) //@F4A - { //@F4A - JDTrace.logInformation (this, "Warning: Open handle count now: " + size); //@F4A - } //@F4A - } //@F4A - - return statement; - } - - - - - // JDBC 2.0 - /** - Precompiles an SQL statement with optional input parameters - and stores it in a PreparedStatement object. This object can - be used to efficiently execute this SQL statement - multiple times. - -

        Result sets created using the statement will be holdability - ResultSet.CLOSE_CURSORS_AT_COMMIT. - - @param sql The SQL statement. - @param resultSetType The result set type. Valid values are: -

          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @param resultSetConcurrency The result set concurrency. Valid values are: -
          -
        • ResultSet.CONCUR_READ_ONLY -
        • ResultSet.CONCUR_UPDATABLE -
        - @return The prepared statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type or currency is not valid, - or an error occurs. - **/ - public PreparedStatement prepareStatement (String sql, - int resultSetType, - int resultSetConcurrency) - throws SQLException - { - return prepareStatement (sql, resultSetType, //@G4A - resultSetConcurrency, getInternalHoldability()); //@G4A - //@G4M Moved code to next method. - } - - - //@G4A - // JDBC 3.0 - /** - Precompiles an SQL statement with optional input parameters - and stores it in a PreparedStatement object. This object can - be used to efficiently execute this SQL statement - multiple times. - - @param sql The SQL statement. - @param resultSetType The result set type. Valid values are: -
          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @param resultSetConcurrency The result set concurrency. Valid values are: -
          -
        • ResultSet.CONCUR_READ_ONLY -
        • ResultSet.CONCUR_UPDATABLE -
        - @param resultSetHoldability The result set holdability. Valid values are: -
          -
        • ResultSet.HOLD_CURSORS_OVER_COMMIT -
        • ResultSet.CLOSE_CURSORS_AT_COMMIT -
        - @return The prepared statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type, currency, or holdability is not valid, - or an error occurs. - **/ - public PreparedStatement prepareStatement (String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - // Validation. - checkOpen (); - if (! metaData_.supportsResultSetConcurrency (resultSetType, resultSetConcurrency)) - resultSetType = correctResultSetType (resultSetType, resultSetConcurrency); - - if (!checkHoldabilityConstants(resultSetHoldability)) //@F3A - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); //@F3A - - // Create the statement. - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - properties_.getString (JDProperties.DECIMAL_SEPARATOR), true, - properties_.getString (JDProperties.PACKAGE_CRITERIA), this); // @A2A @G4A - int statementId = getUnusedId (resultSetType); // @B1C - AS400JDBCPreparedStatement statement = new AS400JDBCPreparedStatement (this, - statementId, transactionManager_, packageManager_, - properties_.getString (JDProperties.BLOCK_CRITERIA), - properties_.getInt (JDProperties.BLOCK_SIZE), - properties_.getBoolean (JDProperties.PREFETCH), - sqlStatement, false, - properties_.getString (JDProperties.PACKAGE_CRITERIA), - resultSetType, resultSetConcurrency, resultSetHoldability, //@G4A - AS400JDBCStatement.GENERATED_KEYS_NOT_SPECIFIED); //@G4A - statements_.addElement(statement); // @DAC - statementCount_++; //@K1A - if(thousandStatements_ == false && statementCount_ == 1000) //@K1A - { //@K1A - thousandStatements_ = true; //@K1A - //post warning //@K1A - postWarning(JDError.getSQLWarning(JDError.WARN_1000_OPEN_STATEMENTS)); //@K1A - } //@K1A - - if (JDTrace.isTraceOn()) //@F4A - { //@F4A - int size = statements_.size(); //@F4A - if (size % 256 == 0) //@F4A - { //@F4A - JDTrace.logInformation (this, "Warning: Open handle count now: " + size); //@F4A - } //@F4A - } //@F4A - - return statement; - } - - // @G4 new method - /** - * Precompiles an SQL statement with optional input parameters - * and stores it in a PreparedStatement object. This object can - * be used to efficiently execute this SQL statement - * multiple times. - * - *

        This method is not supported when connecting to IBM i V5R4 or earlier systems. - * - * @param sql The SQL statement. - * @param columnIndexes An array of column indexes indicating the columns that should be returned from the inserted row or rows. - * @return The prepared statement object. - * @exception java.sql.SQLException - If connecting to IBM i V5R4 or earlier systems, - * the connection is not open, - * the maximum number of statements for this connection has been reached, - * or an error occurs. - * @since Modification 5 - **/ - public PreparedStatement prepareStatement (String sql, int[] columnIndexes) - throws SQLException - { - if(getVRM() >= JDUtilities.vrm610) //@GKA added support for generated keys - { - // Validation - checkOpen(); - - //Create a JDSQLStatement - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - properties_.getString (JDProperties.DECIMAL_SEPARATOR), true, - properties_.getString (JDProperties.PACKAGE_CRITERIA), this); - //Check if the statement is an insert - if(sqlStatement.isInsert_){ - wrappedInsert_ = true; - return prepareStatement(makeGeneratedKeySelectStatement(sql, columnIndexes, null), Statement.RETURN_GENERATED_KEYS); - } - else // treat like prepareStatement(sql) was called - return prepareStatement(sql); - } - else //@GKA Throw an exception. V5R4 and earlier does not support retrieving generated keys by column index. - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - } - - - // @G4 new method - /** - * Precompiles an SQL statement with optional input parameters - * and stores it in a PreparedStatement object. This object can - * be used to efficiently execute this SQL statement - * multiple times. - * - *

        This method is not supported when connecting to IBM i V5R4 or earlier systems. - * - * @param sql The SQL statement. - * @param columnNames An array of column names indicating the columns that should be returned from the inserted row or rows. - * @return The prepared statement object. - * @exception java.sql.SQLException - If connecting to IBM i V5R4 or earlier systems, - * the connection is not open, - * the maximum number of statements for this connection has been reached, - * or an error occurs. - * @since Modification 5 - **/ - public PreparedStatement prepareStatement (String sql, String[] columnNames) - throws SQLException - { - if(getVRM() >= JDUtilities.vrm610) //@GKA added generated key support - { - //Validation - checkOpen(); - - //Create a JDSQLStatement - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - properties_.getString (JDProperties.DECIMAL_SEPARATOR), true, - properties_.getString (JDProperties.PACKAGE_CRITERIA), this); - //Check if the statement is an insert - if(sqlStatement.isInsert_){ - wrappedInsert_ = true; - return prepareStatement(makeGeneratedKeySelectStatement(sql, null, columnNames), Statement.RETURN_GENERATED_KEYS); - } - else // treat like prepareStatement(sql) was called - return prepareStatement(sql); - } - else //@GKA Throw an exception. V5R4 and earlier does not support retrieving generated keys by column name. - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - } - - - - //@E10a new method - void processSavepointRequest(String savepointStatement) - throws SQLException - { - // must be OS/400 v5r2 or IBM i - if (vrm_ < JDUtilities.vrm520) - JDError.throwSQLException(this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - - // cannot do savepoints on XA transactions - if (!transactionManager_.isLocalTransaction()) - JDError.throwSQLException (this, JDError.EXC_TXN_STATE_INVALID); - - // cannot do savepoints if autocommit on - if (getAutoCommit()) - JDError.throwSQLException(this, JDError.EXC_TXN_STATE_INVALID); - - Statement statement = null; //@scan1 - try{ - statement = createStatement(); - - statement.executeUpdate(savepointStatement); - - }finally //@scan1 - { - if(statement != null) //@scan1 - statement.close(); - - } - } - - - - - - - - /** - Partial closing of the connection. - @exception SQLException If a database error occurs. - **/ - void pseudoClose() throws SQLException // @E1 - { - // Rollback before closing. - if ((transactionManager_.isLocalTransaction()) && (transactionManager_.isLocalActive())) // @E4A - rollback (); - - // Close all statements that are running in the context of this connection. - // Make a clone of the vector, since it will be modified as each statement @DAA - // closes itself. // @DAA - // @j4 change -- close may throw a SQLException. Log that error and keep going. - // Since the user called close we won't return until we tried to close all - // statements. - Vector statements = (Vector)statements_.clone(); // @DAA - Enumeration list = statements.elements(); // @DAA - while (list.hasMoreElements()) // @DAC - { - // @DAC - AS400JDBCStatement statement = (AS400JDBCStatement)list.nextElement(); // @DAA - try - { // @J4a - if(statement.isHoldStatement()) //@KBL user already called close, now completely close it - { //@KBL - statement.setAssociatedWithLocators(false); //@KBL - statement.finishClosing(); //@KBL - } //@KBL - // @J4a - if (! statement.isClosed()) // @DAC - statement.close(); // @DAC - } // @J4a - catch (SQLException e) // @J4a - { - // @J4a - if (JDTrace.isTraceOn()) // @J4a - JDTrace.logInformation (this, "Closing statement while closing connection failed: " + e.getMessage()); // @j4a - } // @J4a - } - - // @j1a clean up any IBM i debug that is going on. This entire block - // is new for @J1 - if (traceServer_ > 0 || databaseHostServerTrace_) // @2KRC - { - // Get the job identifier because we need the id (it is part of some - // of our trace files). I know I could have saved it from - // the start-trace code but tracing is not performance critical so - // why make the object bigger by storing trace stuff as member data. - String serverJobIdentifier = getServerJobIdentifier(); - - // Same for this flag. Don't want to grow the object by saving - // this as member data. - boolean preV5R1 = true; - boolean SQLNaming = properties_.getString(JDProperties.NAMING).equals(JDProperties.NAMING_SQL); - - try - { - preV5R1 = getVRM() <= JDUtilities.vrm450; - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to end server job tracing failed, could not get server VRM"); - } - - boolean endedTraceJob = false; //@540 Used to determine if ENDTRC has already been done. - // End trace-job - if ((traceServer_ & ServerTrace.JDBC_TRACE_SERVER_JOB) > 0) - { - try - { - if (preV5R1) - JDUtilities.runCommand(this, "QSYS/TRCJOB SET(*OFF) OUTPUT(*PRINT)", SQLNaming); - else - { - JDUtilities.runCommand(this, "QSYS/ENDTRC SSNID(QJT" + - serverJobIdentifier.substring(20) + - ") DTAOPT(*LIB) DTALIB(QUSRSYS) RPLDTA(*YES) PRTTRC(*YES)", SQLNaming ); - - JDUtilities.runCommand(this, "QSYS/DLTTRC DTAMBR(QJT" + - serverJobIdentifier.substring(20) + - ") DTALIB(QUSRSYS)", SQLNaming ); - } - endedTraceJob = true; //@540 - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to end server job tracing failed"); - } - } - - //@540 End database host server trace job - // Database Host Server Trace is supported on V5R3+ - if(getVRM() >= JDUtilities.vrm530 && !endedTraceJob) - { - // Only issue ENDTRC if not already done. - if(((traceServer_ & ServerTrace.JDBC_TRACE_DATABASE_HOST_SERVER) > 0) || databaseHostServerTrace_) // @2KRC - { - // end database host server trace - try{ - JDUtilities.runCommand(this, "QSYS/ENDTRC SSNID(QJT" + - serverJobIdentifier.substring(20) + - ") DTAOPT(*LIB) DTALIB(QUSRSYS) RPLDTA(*YES) PRTTRC(*YES)", SQLNaming ); - - JDUtilities.runCommand(this, "QSYS/DLTTRC DTAMBR(QJT" + - serverJobIdentifier.substring(20) + - ") DTALIB(QUSRSYS)", SQLNaming ); - } - catch(Exception e){ - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to end database host server tracing failed."); - } - } - } - - // End debug-job - if ((traceServer_ & ServerTrace.JDBC_DEBUG_SERVER_JOB) > 0) - { - try - { - JDUtilities.runCommand(this, "QSYS/ENDDBG", SQLNaming); - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to end server job tracing failed, could not end debug on server job "); - } - } - - // End the database monitor - if ((traceServer_ & ServerTrace.JDBC_START_DATABASE_MONITOR) > 0) - { - try - { - JDUtilities.runCommand(this, "QSYS/ENDDBMON", SQLNaming); - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to end server job tracing failed, could not end database monitor"); - } - } - - // Dump out SQL information - if (((traceServer_ & ServerTrace.JDBC_SAVE_SQL_INFORMATION) > 0) && !preV5R1) - { - try - { - JDUtilities.runCommand(this, "QSYS/PRTSQLINF *JOB", SQLNaming); - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to end server job tracing failed, could not print SQL information"); - } - } - - // Dump the joblog - if ((traceServer_ & ServerTrace.JDBC_SAVE_SERVER_JOBLOG) > 0) - { - try - { - JDUtilities.runCommand(this, "QSYS/DSPJOBLOG JOB(*) OUTPUT(*PRINT)", SQLNaming); - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to end server job tracing failed, could not save job log"); - } - } - - // If the user set our flag to turn on client tracing then turn it back off. - // This may turn off tracing even though the user wanted it on for some other - // reason but there is no way for this code to know why tracing was turned on. - // It does know this interface is one reason it is on so we will assume it - // is the only reason and will turn it off here. - if ((traceServer_ & ServerTrace.JDBC_TRACE_CLIENT) > 0) - JDTrace.setTraceOn(false); - } - } - - - // @E10a new method - /** - * Removes the given Savepoint object from the current transaction. - * Any reference to the savepoint after it has been removed will - * cause an SQLException to be thrown. - * - * @param savepoint the savepoint to be removed. - * - * @exception SQLException if a database access error occurs or the given Savepoint - * is not a valid savepoint in the current transaction. - * - * @since Modification 5 - **/ - public void releaseSavepoint(Savepoint savepoint) - throws SQLException - { - if (savepoint == null) - throw new NullPointerException("savepoint"); - - AS400JDBCSavepoint sp = (AS400JDBCSavepoint) savepoint; - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Releasing savepoint " + sp.getName()); - - if (sp.getStatus() != AS400JDBCSavepoint.ACTIVE) - JDError.throwSQLException(this, JDError.EXC_SAVEPOINT_DOES_NOT_EXIST); - - String SQLCommand = "RELEASE SAVEPOINT " + sp.getName(); - - processSavepointRequest(SQLCommand); - - sp.setStatus(AS400JDBCSavepoint.CLOSED); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Savepoint " + sp.getName() + " released."); - } - - - - - - - - // @E4C - /** - Drops all changes made since the previous commit or - rollback and releases any database locks currently held by - the connection. This has no effect when the connection - is in auto-commit mode. - -

        This method can not be called when the connection is part - of a distributed transaction. See - AS400JDBCXAResource for more information. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public void rollback () - throws SQLException - { - checkOpen (); - - if (!transactionManager_.isLocalTransaction()) // @E4A - JDError.throwSQLException (this, JDError.EXC_TXN_STATE_INVALID); // @E4A - - if (transactionManager_.getAutoCommit () && properties_.getBoolean(JDProperties.AUTOCOMMIT_EXCEPTION)) - JDError.throwSQLException (this, JDError.EXC_FUNCTION_SEQUENCE); - - if (! transactionManager_.getAutoCommit ()) - { - transactionManager_.rollback (); - - // @F3 Mark all cursors closed on a rollback. Don't worry here - // @F3 about whether their statement level holdability is different; we will check - // @F3 that within Statement.markCursorsClosed(). - - // @F3D if (transactionManager_.getHoldIndicator() == JDTransactionManager.CURSOR_HOLD_FALSE // @B4A - // @F3 Passing true means we called markCursorClosed from rollback. - markCursorsClosed(true); // @B4A @F3C - - if(properties_.getBoolean(JDProperties.HOLD_STATEMENTS )) //@PDA additional HOLD_STATEMENTS check - markStatementsClosed(); //@KBL - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Transaction rollback"); - } - } - - // @E10 new method - /** - * Undoes all changes made after the specified Savepoint was set. - * - * @param savepoint the savepoint to be rolled back to. - * - * @exception SQLException if a database access error occurs, the Savepoint - * is no longer valid, or this Connection - * is currently in auto-commit mode. - * @since Modification 5 - **/ - public void rollback(Savepoint savepoint) - throws SQLException - { - if (savepoint == null) - throw new NullPointerException("savepoint"); - - - AS400JDBCSavepoint sp = (AS400JDBCSavepoint) savepoint; - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Rollback with savepoint " + sp.getName()); - - if (sp.getStatus() != AS400JDBCSavepoint.ACTIVE) - JDError.throwSQLException(this, JDError.EXC_SAVEPOINT_DOES_NOT_EXIST); - - String SQLCommand = "ROLLBACK TO SAVEPOINT " + sp.getName(); - - processSavepointRequest(SQLCommand); - - sp.setStatus(AS400JDBCSavepoint.CLOSED); - - if(properties_.getBoolean(JDProperties.HOLD_STATEMENTS )) //@PDA additional HOLD_STATEMENTS check - markStatementsClosed(); //@KBL - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Rollback with savepoint " + sp.getName() + " complete."); - } - - - - - - - /** - Sends a request data stream to the system using the - connection's id and does not expect a reply. - - @param request The request. - - @exception SQLException If an error occurs. - **/ - // - // See implementation notes for sendAndReceive(). - // - void send (DBBaseRequestDS request) - throws SQLException - { - send (request, id_, true); - } - - - - /** - Sends a request data stream to the system and does not - expect a reply. - - @param request The request. - @param id The id. - - @exception SQLException If an error occurs. - **/ - // - // See implementation notes for sendAndReceive(). - // - void send (DBBaseRequestDS request, int id) - throws SQLException - { - send (request, id, true); - } - - - - /** - Sends a request data stream to the system and does not - expect a reply. - - @param request The request. - @param id The id. - @param leavePending Indicates if the request should - be left pending. This indicates - whether or not to base the next - request on this one. - - @exception SQLException If an error occurs. - **/ - // - // See implementation notes for sendAndReceive(). - // - void send (DBBaseRequestDS request, int id, boolean leavePending) - throws SQLException - { - checkCancel(); // @E8A - checkOpen(); // @W1a - - try - { - // Since we are just calling send() (instead of sendAndReceive()), // @EAA - // make sure we are not asking the system for a reply. Otherwise, // @EAA - // the reply will come back and it will get held in the AS400 // @EAA - // read daemon indefinitely - - a memory leak. // @EAA - if (JDTrace.isTraceOn()) - { // @EAA - if (request.getOperationResultBitmap() != 0) // @EAA - JDTrace.logInformation (this, "Reply requested but not collected:" + request.getReqRepID()); // @EAA - } // @EAA - - request.setBasedOnORSHandle (0); // @DAC @EKC - DBReplyRequestedDS reply = null; - - if (dataCompression_ == DATA_COMPRESSION_RLE_) - { // @ECA - request.addOperationResultBitmap(DBBaseRequestDS.ORS_BITMAP_REQUEST_RLE_COMPRESSION); // @ECA - request.addOperationResultBitmap(DBBaseRequestDS.ORS_BITMAP_REPLY_RLE_COMPRESSION); // @ECA - request.compress(); // @ECA - } // @ECA - - DataStream actualRequest; // @E5A - synchronized(heldRequestsLock_) - { // @E5A - if (heldRequests_ != null) // @E5A - actualRequest = new DBConcatenatedRequestDS(heldRequests_, request); // @E5A - else // @E5A - actualRequest = request; // @E5A - heldRequests_ = null; // @E5A - - server_.send(actualRequest); // @E5A @F7M -//@P1D requestPending_[id] = leavePending; //@P0A @F7M - } // @E5A - - // @E5D if (DEBUG_REQUEST_CHAINING_ == true) { - //@P0D if (leavePending) // @DAA - //@P0D requestPending_.set(id); // @DAC - //@P0D else // @DAA - //@P0D requestPending_.clear(id); // @DAA - - // @E5D } - // @E5D else { - // @E5D request.addOperationResultBitmap (DBBaseRequestDS.ORS_BITMAP_RETURN_DATA); - // @E5D reply = (DBReplyRequestedDS) server_.sendAndReceive (request); - // @E5D requestPending_[id] = false; - // @E5D } - - if (DEBUG_COMM_TRACE_ > 0) - { - debug (request); - // @E5D if (DEBUG_REQUEST_CHAINING_ == false) - // @E5D debug (reply); - } - } - // @J5D catch (ConnectionDroppedException e) { // @C1A - // @J5D server_ = null; // @D8 - // @J5D request.freeCommunicationsBuffer(); // @EMa - // @J5D JDError.throwSQLException (this, JDError.EXC_CONNECTION_NONE, e); // @C1A - // @J5D } // @C1A - catch (IOException e) - { // @J5A - server_ = null; // @J5A - //@P0D request.freeCommunicationsBuffer(); // @J5A - JDError.throwSQLException (this, JDError.EXC_COMMUNICATION_LINK_FAILURE, e); // @J5A - } // @J5A - catch (Exception e) - { - //@P0D request.freeCommunicationsBuffer(); // @EMa - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - } - - - - // @EBD /** - // @EBD Sends a request data stream to the system and discards - // @EBD the reply. - // @EBD - // @EBD @param request The request. - // @EBD @param id The id. - // @EBD @param leavePending Indicates if the request should - // @EBD be left pending. This indicates - // @EBD whether or not to base the next - // @EBD request on this one. - // @EBD - // @EBD @exception SQLException If an error occurs. - // @EBD **/ - // @EBD // - // @EBD // See implementation notes for sendAndReceive(). - // @EBD // - // @EBD void sendAndDiscardReply (DBBaseRequestDS request, int id) - // @EBD throws SQLException - // @EBD { - // @EBD checkCancel(); // @E8A - // @EBD - // @EBD try { - // @EBD request.setBasedOnORSHandle (0); //@EKC - // @EBD - // @EBD DataStream actualRequest; // @E5A - // @EBD synchronized(heldRequestsLock_) { // @E5A - // @EBD if (heldRequests_ != null) // @E5A - // @EBD actualRequest = new DBConcatenatedRequestDS(heldRequests_, request); // @E5A - // @EBD else // @E5A - // @EBD actualRequest = request; // @E5A - // @EBD heldRequests_ = null; // @E5A - // @EBD } // @E5A - // @EBD - // @EBD server_.sendAndDiscardReply(actualRequest); // @E5C - // @EBD requestPending_[id] = false; - // @EBD - // @EBD if (DEBUG_COMM_TRACE_ > 0) - // @EBD debug (request); - // @EBD } - // @EBD catch (ConnectionDroppedException e) { // @C1A - // @EBD server_ = null; // @D8 - // @EBD JDError.throwSQLException (this, JDError.EXC_CONNECTION_NONE, e); // @C1A - // @EBD } // @C1A - // @EBD catch (Exception e) { - // @EBD JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - // @EBD } - // @EBD } - - - - // @E5A - /** - Holds a request until the next explicit request. It will - be concatenated at the beginning of the next request. - - @param request The request. - @param id The id. - - @exception SQLException If an error occurs. - **/ - // - // See implementation notes for sendAndReceive(). - // - void sendAndHold(DBBaseRequestDS request, int id) - throws SQLException - { - checkCancel(); // @E8A - checkOpen(); // @W1a - - try - { - // Since we are just calling send() (instead of sendAndReceive()), // @EAA - // make sure we are not asking the system for a reply. Otherwise, // @EAA - // the reply will come back and it will get held in the AS400 // @EAA - // read daemon indefinitely - - a memory leak. // @EAA - if (JDTrace.isTraceOn()) - { // @EAA - if (request.getOperationResultBitmap() != 0) // @EAA - JDTrace.logInformation (this, "Reply requested but not collected:" + request.getReqRepID()); // @EAA - } // @EAA - - request.setBasedOnORSHandle(0); // @DAC @EKC - - if (dataCompression_ == DATA_COMPRESSION_RLE_) - { // @ECA - request.addOperationResultBitmap(DBBaseRequestDS.ORS_BITMAP_REQUEST_RLE_COMPRESSION); // @ECA - request.addOperationResultBitmap(DBBaseRequestDS.ORS_BITMAP_REPLY_RLE_COMPRESSION); // @ECA - request.compress(); // @ECA - } // @ECA - - synchronized(heldRequestsLock_) - { - if (heldRequests_ == null) - heldRequests_ = new Vector(); - heldRequests_.addElement(request); - } - - //@P0D requestPending_.set(id); // @DAC -//@P1D requestPending_[id] = true; //@P0A - - if (DEBUG_COMM_TRACE_ > 0) - { - debug (request); - System.out.println("This request was HELD."); - } - } - // Note: No need to check for an IOException in this method, since we don't contact the system. @J5A - catch (Exception e) - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - } - - - - /** - Sends a request data stream to the system using the - connection's id and returns the corresponding reply from - the system. - - @param request The request. - @return The reply. - - @exception SQLException If an error occurs. - **/ - // - // See implementation notes for sendAndReceive(). - // - DBReplyRequestedDS sendAndReceive (DBBaseRequestDS request) - throws SQLException - { - return sendAndReceive (request, id_); - } - - - - /** - Sends a request data stream to the system and returns the - corresponding reply from the system. - - @param request The request. - @param id The id. - @return The reply. - - @exception SQLException If an error occurs. - **/ - // - // Implementation notes: - // - // 1. We do not have to worry about thread synchronization - // here, since the AS400Server object handles it. - // - // 2. The based on id is used to chain requests for the - // same ORS without needing to get a reply for each one. - // If a request fails, then all subsequent requests will - // too, and the results from the original failure will - // ultimately be returned. - // - // Initially, the based on id is set to 0. After a - // request is sent the based on id is set to the statement's - // id, so that subsequent requests will base on this id. - // Finally, when a reply is retrieved, the based on id - // is reset to 0. - // - // The status of the based on id depends on whether a - // request is pending, which is maintained in the id table. - // - DBReplyRequestedDS sendAndReceive (DBBaseRequestDS request, int id) - throws SQLException - { - checkCancel(); // @E8A - checkOpen(); // @W1a - - DBReplyRequestedDS reply = null; - - try - { - request.setBasedOnORSHandle (0); // @DAC @EKC - - if (dataCompression_ == DATA_COMPRESSION_RLE_) - { // @ECA - request.addOperationResultBitmap(DBBaseRequestDS.ORS_BITMAP_REQUEST_RLE_COMPRESSION); // @ECA - request.addOperationResultBitmap(DBBaseRequestDS.ORS_BITMAP_REPLY_RLE_COMPRESSION); // @ECA - request.compress(); // @ECA - } // @ECA - - DataStream actualRequest; // @E5A - synchronized(heldRequestsLock_) - { // @E5A - if (heldRequests_ != null) // @E5A - actualRequest = new DBConcatenatedRequestDS(heldRequests_, request); // @E5A - else // @E5A - actualRequest = request; // @E5A - heldRequests_ = null; // @E5A - - reply = (DBReplyRequestedDS)server_.sendAndReceive(actualRequest); // @E5C @F7M - //@P0D requestPending_.clear(id); -//@P1D requestPending_[id] = false; //@P0A @F7M - } // @E5A - - reply.parse(dataCompression_); // @E5A - // @DAC - - if (DEBUG_COMM_TRACE_ > 0) - { - debug (request); - debug (reply); - } - } - // @J5D catch (ConnectionDroppedException e) { // @C1A - // @J5D server_ = null; // @D8 - // @J5D request.freeCommunicationsBuffer(); // @EMa - // @J5D JDError.throwSQLException (this, JDError.EXC_CONNECTION_NONE, e); // @C1A - // @J5D } // @C1A - catch (IOException e) - { // @J5A - server_ = null; // @J5A - //@P0D request.freeCommunicationsBuffer(); // @J5A - JDError.throwSQLException (this, JDError.EXC_COMMUNICATION_LINK_FAILURE, e); // @J5A - } // @J5A - catch (Exception e) - { - //@P0D request.freeCommunicationsBuffer(); // @EMa - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - // if (DBDSPool.monitor) { - // reply.setAllocatedLocation(); - // } - - return(DBReplyRequestedDS) reply; - } - - - - // @E4C - /** - Sets the auto-commit mode. If the connection is in auto-commit - mode, then all of its SQL statements are executed and committed - as individual transactions. Otherwise, its SQL statements are - grouped into transactions that are terminated by either a commit - or rollback. - -

        By default, the connection is in auto-commit mode. The - commit occurs when the statement execution completes or the - next statement execute occurs, whichever comes first. In the - case of statements returning a result set, the statement - execution completes when the last row of the result set has - been retrieved or the result set has been closed. In advanced - cases, a single statement may return multiple results as well - as output parameter values. Here the commit occurs when all results - and output parameter values have been retrieved. - -

        The auto-commit mode is always false when the connection is part - of a distributed transaction. See - AS400JDBCXAResource for more information. - - @param autoCommit true to turn on auto-commit mode, false to - turn it off. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public void setAutoCommit (boolean autoCommit) - throws SQLException - { - checkOpen (); - if (TESTING_THREAD_SAFETY) return; // in certain testing modes, don't contact IBM i system - - transactionManager_.setAutoCommit (autoCommit); - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Auto commit", transactionManager_.getAutoCommit ()); - } - - - - /** - This method is not supported. - - @exception SQLException If the connection is not open. - **/ - public void setCatalog (String catalog) - throws SQLException - { - checkOpen (); - - // No-op. - } - - //@cc1 - /** - * This method sets concurrent access resolution. This method overrides the setting of ConcurrentAccessResolution on the datasource or connection - * URL properties. This changes the setting for this connection only. This method has no effect on - * IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @param concurrentAccessResolution The current access resolution setting. Possible valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public void setConcurrentAccessResolution (int concurrentAccessResolution) throws SQLException - { - - DBSQLAttributesDS request = null; - DBReplyRequestedDS reply = null; - try - { - if (getVRM() >= JDUtilities.vrm710) - { - request = DBDSPool.getDBSQLAttributesDS(DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); - - //get value of concurrent access resolution. - int car = properties_.getInt(JDProperties.CONCURRENT_ACCESS_RESOLUTION); - //here, we also allow resetting back to default 0 - //pass value of concurrent access resolution into the hostserver request. - request.setConcurrentAccessResolution( car ); - - reply = sendAndReceive(request); - int errorClass = reply.getErrorClass(); - if (errorClass != 0) - JDError.throwSQLException(this, id_, errorClass, reply.getReturnCode()); - } - } catch( Exception e) - { - JDError.throwSQLException( this, JDError.EXC_INTERNAL, e); - } finally - { - if (request != null) { - request.returnToPool(); request=null; - } - if (reply != null) { - reply.returnToPool(); reply = null; // Can return -- only errorClass accessed - } - } - - concurrentAccessResolution_ = concurrentAccessResolution; - } - - - /** - Sets the eWLM Correlator. It is assumed a valid correlator value is used. - If the value is null, all ARM/eWLM implementation will be turned off. - eWLM correlators require IBM i V5R3 or later systems. This request is ignored when running to OS/400 V5R2 or earlier systems. - - @param bytes The eWLM correlator value - **/ - public void setDB2eWLMCorrelator(byte[] bytes) - throws SQLException //@eWLM - { - if(vrm_ >= JDUtilities.vrm530) - { - DBSQLAttributesDS request = null; - DBReplyRequestedDS reply = null; - try - { - if(bytes == null) - { - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Correlator is null"); - } - request = DBDSPool.getDBSQLAttributesDS (DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); - request.seteWLMCorrelator(bytes); - reply = sendAndReceive(request); - int errorClass = reply.getErrorClass(); - if(errorClass != 0) - JDError.throwSQLException(this, id_, errorClass, reply.getReturnCode()); - } - catch(DBDataStreamException e) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - if (reply != null) { reply.returnToPool(); reply = null; } // Return to pool since only errorClass accessed - } - } - } - - - // @B1A - /** - Sets whether the connection is being used for DRDA. - - @param drda true if the connection is being used for DRDA, - false otherwise. - **/ - void setDRDA (boolean drda) - throws SQLException // @EGA - { - drda_ = drda; - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, "DRDA", drda_); - } - - - //@G4A JDBC 3.0 - /** - Sets the holdability of ResultSets created from this connection. - -

        Full functionality of this method requires OS/400 V5R2 - or IBM i. If connecting to OS/400 V5R1 or earlier, all - cursors for the connection will be changed to the value of the variable - holdability. - - @param holdability The cursor holdability. - Valid values are ResultSet.HOLD_CURSORS_OVER_COMMIT or - ResultSet.CLOSE_CURSORS_AT_COMMIT. - - @exception SQLException If the connection is not open - or the value passed in is not valid. - @since Modification 5 - **/ - public void setHoldability (int holdability) - throws SQLException - { - checkOpen (); - if (TESTING_THREAD_SAFETY) return; // in certain testing modes, don't contact IBM i system - - if (!checkHoldabilityConstants(holdability)) //@F3A - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); //@F3A - - holdability_ = holdability; - - if (holdability == AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT) //@F5A - transactionManager_.setHoldIndicator(JDProperties.CURSORHOLD_FALSE); //@F5A - else if (holdability == AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT) //@F5A - transactionManager_.setHoldIndicator(JDProperties.CURSORHOLD_TRUE); //@F5A - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Holdability", holdability_); - } - - - - //@D4A - void setProperties (JDDataSourceURL dataSourceUrl, JDProperties properties, - AS400 as400) - throws SQLException - { - if (TESTING_THREAD_SAFETY) // in certain testing modes, don't contact IBM i system - { - as400PublicClassObj_ = as400; - } - else - { - try - { - as400.connectService (AS400.DATABASE); - } - catch (AS400SecurityException e) - { //@D5C - JDError.throwSQLException (this, JDError.EXC_CONNECTION_REJECTED, e); - } - catch (IOException e) - { //@D5C - JDError.throwSQLException (this, JDError.EXC_CONNECTION_UNABLE, e); - } - finally //@dbldrvr - { //@dbldrvr - //Since driver is registered twice in DriverManager via DriverManager.registerDriver(new AS400JDBCDriver()), - //remove extra driver references now so we don't waste resources by continuing to try, and also so we don't lock out id if pwd is not correct. - Enumeration en = DriverManager.getDrivers(); //@dbldrvr - Driver firstDriver = null; //@dbldrvr - Driver nextDriver = null; //@dbldrvr - while (en.hasMoreElements()) //@dbldrvr - { //@dbldrvr - nextDriver = (Driver) en.nextElement(); //@dbldrvr - if(nextDriver instanceof AS400JDBCDriver) //@dbldrvr - { //@dbldrvr - if(firstDriver == null) //@dbldrvr - firstDriver = nextDriver; //@dbldrvr - else //@dbldrvr - DriverManager.deregisterDriver(nextDriver); //@dbldrvr - } //@dbldrvr - } //@dbldrvr - } //@dbldrvr - } - - setProperties (dataSourceUrl, properties, as400.getImpl()); - } - - - void setProperties(JDDataSourceURL dataSourceUrl, JDProperties properties, AS400Impl as400) - throws SQLException - { - setProperties(dataSourceUrl, properties, as400, false); - } - - //@A3A - This logic formerly resided in the ctor. - void setProperties (JDDataSourceURL dataSourceUrl, JDProperties properties, AS400Impl as400, boolean newServer) - throws SQLException - { - // Initialization. - as400_ = (AS400ImplRemote) as400; //@A3A - //@P0D assigned_ = new BitSet(INITIAL_STATEMENT_TABLE_SIZE_); // @DAC - dataSourceUrl_ = dataSourceUrl; - extendedFormats_ = false; - properties_ = properties; - //Set the real default for METADATA SOURCE property since we now know the hostsrvr version - if(properties_.getString(JDProperties.METADATA_SOURCE).equals(JDProperties.METADATA_SOURCE_HOST_VERSION_DEFAULT)) //@mdsp - { //@mdsp - if(as400_.getVRM() < JDUtilities.vrm710) //@mdsp //@710 take effect after 710 (ie. not 615) - properties_.setString(JDProperties.METADATA_SOURCE, JDProperties.METADATA_SOURCE_ROI); //@mdsp - else //@mdsp - properties_.setString(JDProperties.METADATA_SOURCE, JDProperties.METADATA_SOURCE_STORED_PROCEDURE); //@mdsp - } //@mdsp - - //@P0D requestPending_ = new BitSet(INITIAL_STATEMENT_TABLE_SIZE_); // @DAC - statements_ = new Vector(INITIAL_STATEMENT_TABLE_SIZE_); // @DAC - if(!TESTING_THREAD_SAFETY && as400_.getVRM() <= JDUtilities.vrm520) //@KBA //if V5R2 or less use old support of issuing set transaction statements - newAutoCommitSupport_ = 0; //@KBA - else if(!properties_.getBoolean(JDProperties.TRUE_AUTO_COMMIT)) //@KBA //@true //run autocommit with *NONE isolation level - newAutoCommitSupport_ = 1; //@KBA - else //@KBA - newAutoCommitSupport_ = 2; //@KBA //run autocommit with specified isolation level - - - if (as400_.getVRM() >= JDUtilities.vrm710) { - doUpdateDeleteBlocking_ = properties_.getBoolean(JDProperties.DO_UPDATE_DELETE_BLOCKING); //@A2A - } - - maximumBlockedInputRows_ = properties_.getInt(JDProperties.MAXIMUM_BLOCKED_INPUT_ROWS); // @A6A - if ( maximumBlockedInputRows_ > 32000 ) maximumBlockedInputRows_ = 32000; // @A6A - if ( maximumBlockedInputRows_ < 1 ) maximumBlockedInputRows_ = 1; // @A6A - - // Issue any warnings. - if (dataSourceUrl_.isExtraPathSpecified ()) - postWarning (JDError.getSQLWarning (JDError.WARN_URL_EXTRA_IGNORED)); - if (dataSourceUrl_.isPortSpecified ()) - postWarning (JDError.getSQLWarning (JDError.WARN_URL_EXTRA_IGNORED)); - if (properties.isExtraPropertySpecified ()) - postWarning (JDError.getSQLWarning (JDError.WARN_PROPERTY_EXTRA_IGNORED)); - - // Initialize the library list. - String urlSchema = dataSourceUrl_.getSchema (); - if (urlSchema == null) - JDError.throwSQLException (this, JDError.WARN_URL_SCHEMA_INVALID); - - JDLibraryList libraryList = new JDLibraryList ( - properties_.getString (JDProperties.LIBRARIES), urlSchema, - properties_.getString (JDProperties.NAMING)); // @B2C - defaultSchema_ = libraryList.getDefaultSchema (); - - // The connection gets an id automatically, but never - // creates an RPB on the system. There should never be a need - // to create an RPB on the system for a connection, but an - // id is needed for retrieving Operational Result Sets (ORS) - // for errors, etc. - - // Initialize a transaction manager for this connection. - transactionManager_ = new JDTransactionManager (this, id_, - properties_.getString (JDProperties.TRANSACTION_ISOLATION), - properties_.getBoolean (JDProperties.AUTO_COMMIT)); //@AC1 - - transactionManager_.setHoldIndicator(properties_.getString(JDProperties.CURSOR_HOLD)); // @D9 - - // If the hold properties are specified, make sure they are set locally - if (properties_.getString(JDProperties.CURSOR_HOLD) != null) { - if (transactionManager_.getHoldIndicator() == JDTransactionManager.CURSOR_HOLD_TRUE) - holdability_ = AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT; - else if (transactionManager_.getHoldIndicator() == JDTransactionManager.CURSOR_HOLD_FALSE) - holdability_ = AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT; - } - - // Initialize the read-only mode to true if the access - // property says read only. - readOnly_ = (properties_.equals (JDProperties.ACCESS, - JDProperties.ACCESS_READ_ONLY)); - - - // Determine the amount of system tracing that should be started. Trace - // can be started by either a JDBC property or the ServerTrace class. Our value - // will be the combination of the two (instead of one overriding the other). - traceServer_ = properties_.getInt(JDProperties.TRACE_SERVER) | - ServerTrace.getJDBCServerTraceCategories(); // @j1a //@SSa logical OR - - // Determine if a QAQQINI library name was specified. The library can be set using //@K2A - // a JDBC property. //@k2A - qaqqiniLibrary_ = properties_.getString(JDProperties.QAQQINILIB); //@K2A - - //@A3D - // Initialize the conversation. - //open (); - - //@A3A - // Connect. - if (JDTrace.isTraceOn()) // @F6a - { // @F6a - JDTrace.logInformation("Toolbox for Java - " + Copyright.version); // @F6a - JDTrace.logInformation("JDBC Level: " + JDUtilities.JDBCLevel_); // @F6a - } // @F6a - - if (!TESTING_THREAD_SAFETY) // in certain testing modes, we don't contact IBM i system - { - try - { - server_ = as400_.getConnection (AS400.DATABASE, newServer); - } - catch (AS400SecurityException e) - { - JDError.throwSQLException (this, JDError.EXC_CONNECTION_REJECTED, e); - } - catch (IOException e) - { - JDError.throwSQLException (this, JDError.EXC_CONNECTION_UNABLE, e); - } - } - - // Initialize the catalog name at this point to be the system - // name. After we exchange attributes, we can change it to - // the actual name. - catalog_ = dataSourceUrl.getServerName(); // @D7A - if (catalog_.length() == 0) // @D7A - catalog_ = as400_.getSystemName ().toUpperCase (); // @A3A - - setServerAttributes (); - libraryList.addOnServer (this, id_); - - // @E7D // Initialize a transaction manager for this connection. Turn on @E7A - // @E7D // new auto-commit support when the server functional level is @E7A - // @E7D // greater than or equal to 3. @E7A - // @E7D boolean newAutoCommitSupport = (serverFunctionalLevel_ >= 3); // @E7A - // @E7D transactionManager_.setNewAutoCommitSupport(newAutoCommitSupport); // @E7A - - // We keep a metadata object around for quick access. - // The metadata object should share the id of the - // connection, since it operates on a connection-wide - // scope. - metaData_ = new AS400JDBCDatabaseMetaData (this, id_); - - // The conversation was initialized to a certain - // transaction isolation. It is now time to turn on auto- - // commit by default. - if(newAutoCommitSupport_ == 0) //KBA V5R2 or less so do what we always have - transactionManager_.setAutoCommit (true); - - // Initialize the package manager. - packageManager_ = new JDPackageManager (this, id_, properties_, - transactionManager_.getCommitMode ()); - - // Trace messages. - if (JDTrace.isTraceOn()) - { - JDTrace.logOpen (this, null); // @J33a - JDTrace.logProperty (this, "Auto commit", transactionManager_.getAutoCommit ()); - JDTrace.logProperty (this, "Read only", readOnly_); - JDTrace.logProperty (this, "Transaction isolation", transactionManager_.getIsolation ()); - if (packageManager_.isEnabled ()) - JDTrace.logInformation (this, "SQL package = " - + packageManager_.getLibraryName() + "/" - + packageManager_.getName ()); - } - - - // @j1a Trace the server job if the user asked us to. Tracing - // can be turned on via a URL property, the Trace class, the DataSource - // object, or a system property. - if (traceServer_ > 0) - { - // Get the server job id. We will both dump this to the trace - // and use it to uniquely label some of the files. - String serverJobIdentifier = getServerJobIdentifier(); - String serverJobId = serverJobIdentifier.substring(20).trim() + "/" + - serverJobIdentifier.substring(10, 19).trim() + "/" + - serverJobIdentifier.substring( 0, 10).trim(); - - // Dump the server job id - JDTrace.logDataEvenIfTracingIsOff(this, Copyright.version); - JDTrace.logDataEvenIfTracingIsOff(this, serverJobId); - JDTrace.logDataEvenIfTracingIsOff(this, "Server functional level: " + getServerFunctionalLevel()); // @E7A - - - // Determine system level. Some commands are slightly different - // to v5r1 machines. - boolean preV5R1 = true; - boolean SQLNaming = properties_.getString(JDProperties.NAMING).equals(JDProperties.NAMING_SQL); - try - { - preV5R1 = getVRM() <= JDUtilities.vrm450; - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to start server job tracing failed, could not get server VRM"); - } - - // Start client tracing if the flag is on and trace isn't already running - if (((traceServer_ & ServerTrace.JDBC_TRACE_CLIENT) > 0) && (! JDTrace.isTraceOn())) - JDTrace.setTraceOn(true); - - // No matter what type of tracing is turned on, alter the server - // job so more stuff is saved in the job log. - try - { - JDUtilities.runCommand(this, "QSYS/CHGJOB LOG(4 00 *SECLVL) LOGCLPGM(*YES)", SQLNaming); - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to start server job tracing failed, could not change log level"); - } - - // Optionally start debug on the database server job - if ((traceServer_ & ServerTrace.JDBC_DEBUG_SERVER_JOB) > 0) - { - try - { - JDUtilities.runCommand(this, "QSYS/STRDBG UPDPROD(*YES)", SQLNaming); - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to start server job tracing failed, could not start debug on server job "); - } - } - - // Optionally start the database monitor - if ((traceServer_ & ServerTrace.JDBC_START_DATABASE_MONITOR) > 0) - { - try - { - JDUtilities.runCommand(this, "QSYS/STRDBMON OUTFILE(QUSRSYS/QJT" + - serverJobIdentifier.substring(20) + - ") JOB(*) TYPE(*DETAIL)", SQLNaming ); - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to start server job tracing failed, could not start database monitor"); - } - } - - boolean traceServerJob = ((traceServer_ & ServerTrace.JDBC_TRACE_SERVER_JOB) > 0); //@540 - //@540 Database Host Server Trace is supported on V5R3 and later systems - boolean traceDatabaseHostServer = ((getVRM() >= JDUtilities.vrm530) && ((traceServer_ & ServerTrace.JDBC_TRACE_DATABASE_HOST_SERVER) > 0)); //@540 - // Optionally start trace on the database server job or database host server - //@540D if ((traceServer_ & ServerTrace.JDBC_TRACE_SERVER_JOB) > 0) - if(traceServerJob || traceDatabaseHostServer) //@540 - { - try - { - if (preV5R1 && traceServerJob) //@540 added check for traceServerJob - JDUtilities.runCommand(this, "QSYS/TRCJOB MAXSTG(16000)", SQLNaming); - else{ - if(!traceDatabaseHostServer){ //@540 trace only server job - JDUtilities.runCommand(this, "QSYS/STRTRC SSNID(QJT" + - serverJobIdentifier.substring(20) + - ") JOB(*) MAXSTG(128000)", SQLNaming); - } - else if(!traceServerJob){ //@540 trace only database host server - if(getVRM() == JDUtilities.vrm530){ //@540 run command for V5R3 - JDUtilities.runCommand(this, "QSYS/STRTRC SSNID(QJT" + //@540 - serverJobIdentifier.substring(20) + //@540 - ") JOB(*) MAXSTG(128000) JOBTRCTYPE(*TRCTYPE) " + //@540 - "TRCTYPE((TESTA *INFO))", SQLNaming); //@540 - } - else{ //@540 run command for V5R4 and higher - JDUtilities.runCommand(this, "QSYS/STRTRC SSNID(QJT" + //@540 - serverJobIdentifier.substring(20) + //@540 - ") JOB(*) MAXSTG(128000) JOBTRCTYPE(*TRCTYPE) " + //@540 - "TRCTYPE((*DBHSVR *INFO))", SQLNaming); //@540 - } - } //@540 - else{ //@540 start both server job and database host server trace - if(getVRM() == JDUtilities.vrm530){ //@540 run command for V5R3 - JDUtilities.runCommand(this, "QSYS/STRTRC SSNID(QJT" + //@540 - serverJobIdentifier.substring(20) + //@540 - ") JOB(*) MAXSTG(128000) JOBTRCTYPE(*ALL) " + //@540 - "TRCTYPE((TESTA *INFO))", SQLNaming); //@540 - } - else{ //@540 run V5R4 and higher command - JDUtilities.runCommand(this, "QSYS/STRTRC SSNID(QJT" + //@540 - serverJobIdentifier.substring(20) + //@540 - ") JOB(*) MAXSTG(128000) JOBTRCTYPE(*ALL) " + //@540 - "TRCTYPE((*DBHSVR *INFO))", SQLNaming); //@540 - } - } - } - } - catch (Exception e) - { - if(traceServerJob && !traceDatabaseHostServer) //@540 - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to start server job tracing failed, could not trace server job"); - else if(traceDatabaseHostServer && !traceServerJob) //@540 - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to start database host server tracing failed, could not trace server job"); //@540 - else //@540 - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to start server job and database host server tracing failed, could not trace server job"); //@540 - } - } - } - - //@K2A Issue Change Query Attributes command if user specified QAQQINI library name - if(qaqqiniLibrary_.length() > 0 && !qaqqiniLibrary_.equals("null")) - { - boolean SQLNaming = properties_.getString(JDProperties.NAMING).equals(JDProperties.NAMING_SQL); - try - { - JDUtilities.runCommand(this, "CHGQRYA QRYOPTLIB(" + qaqqiniLibrary_ + ")", SQLNaming ); - } - catch (Exception e) - { - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to issue Change Query Attributes command using QAQQINI Library name failed."); - } - } - } - - - - /** - Sets the read-only mode. This will provide read-only - access to the database. Read-only mode can be useful by - enabling certain database optimizations. If the caller - specified "read only" or "read call" for the "access" property, - then the read-only mode cannot be set to false. The read-only - mode cannot be changed while in the middle of a transaction. - -

        This method can not be called when the connection is part - of a distributed transaction. See - AS400JDBCXAResource for more information. - - @exception SQLException If the connection is not open, - a transaction is active, or the - "access" property is set to "read - only". - **/ - public void setReadOnly (boolean readOnly) - throws SQLException - { - checkOpen (); - - if (transactionManager_.isLocalActive () || transactionManager_.isGlobalActive()) // @E4C - JDError.throwSQLException (this, JDError.EXC_TXN_STATE_INVALID); // @E4C - - if ((readOnly == false) - && ((properties_.getString (JDProperties.ACCESS).equalsIgnoreCase (JDProperties.ACCESS_READ_ONLY)) - || (properties_.getString (JDProperties.ACCESS).equalsIgnoreCase (JDProperties.ACCESS_READ_CALL)))) - JDError.throwSQLException (this, JDError.EXC_ACCESS_MISMATCH); - - readOnly_ = readOnly; - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Read only", readOnly_); - } - - - - - // @E10 new method - /** - * Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it. - *

          - *
        • Named savepoints must be unique. A savepoint name cannot be reused until the savepoint is released, committed, or rolled back. - *
        • Savepoints are valid only if autocommit is off. An exception is thrown if autocommit is enabled. - *
        • Savepoints are not valid across XA connections. An exception is thrown if the connection is an XA connection. - *
        • Savepoints require OS/400 V5R2 or IBM i. An exception is thrown if connecting to OS/400 V5R1 or earlier. - *
        • If the connection option is set to keep cursors open after a traditional rollback, cursors will remain open after a rollback to a savepoint. - *
        - * - * @return The new Savepoint object. - * @exception SQLException if a database access error occurs or this Connection object is currently in auto-commit mode. - * @since Modification 5 - **/ - public Savepoint setSavepoint() - throws SQLException - { - return setSavepoint(null, AS400JDBCSavepoint.getNextId()); - } - - // @E10 new method - /** - * Creates a named savepoint in the current transaction and returns the new Savepoint object that represents it. - *
          - *
        • Named savepoints must be unique. A savepoint name cannot be reused until the savepoint is released, committed, or rolled back. - *
        • Savepoints are valid only if autocommit is off. An exception is thrown if autocommit is enabled. - *
        • Savepoints are not valid across XA connections. An exception is thrown if the connection is an XA connection. - *
        • Savepoints require OS/400 V5R2 or IBM i. An exception is thrown if connecting to OS/400 V5R1 or earlier. - *
        • If the connection option is set to keep cursors open after a traditional rollback, cursors will remain open after a rollback to a savepoint. - *
        - * @param name A String containing the name of the savepoint - * @return The new Savepoint object. - * @exception SQLException if a database access error occurs or this Connection object is currently in auto-commit mode. - * @since Modification 5 - **/ - public Savepoint setSavepoint(String name) - throws SQLException - { - if (name == null) - throw new NullPointerException("name"); - - return setSavepoint(name, 0); - } - - // @E10 new method - private Savepoint setSavepoint(String name, int id) - throws SQLException - { - if (id > 0) - name = "T_JDBCINTERNAL_" + id; - - // When creating the savepoint specify retain cursors. That is the - // only option supported by the IBM i system at this time. We have to specify - // it because the SQL default is close cursors. Since we need to use - // an option other than the default we have to specify it on the statement. - // Plus, the system will return an error if we don't specify it. - processSavepointRequest("SAVEPOINT " + name + " ON ROLLBACK RETAIN CURSORS" ); - - return(Savepoint)(Object) new AS400JDBCSavepoint(name, id); - } - - - - - - - - /** - Sets the server attributes. - - @param libraryList The library list. - - @exception SQLException If an error occurs. - **/ - private void setServerAttributes () - throws SQLException - { - if (TESTING_THREAD_SAFETY) return; // in certain testing modes, don't contact IBM i system - DBReplyRequestedDS reply = null; - try - { - vrm_ = as400_.getVRM(); // @D0A @ECM - - //@P0C - DBSQLAttributesDS request = null; - int decimalSeparator, dateFormat, dateSeparator, timeFormat, timeSeparator; - DBReplyServerAttributes serverAttributes = null; - try - { - request = DBDSPool.getDBSQLAttributesDS (DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); //@P0C - - // We need to set a temporary CCSID just for this - // request, since we use this request to get the - // actual CCSID. - //@P0D ConverterImplRemote tempConverter = - //@P0D ConverterImplRemote.getConverter (as400_.getCcsid(), as400_); - ConvTable tempConverter = ConvTable.getTable(as400_.getCcsid(), null); //@P0A - - - // @E2D // Do not set the client CCSID. We do not want - // @E2D // the system to convert data, since we are going - // @E2D // to do all conersion on the client. By not telling - // @E2D // the system our CCSID, then we achieve this. - // @E2D // - // @E2D // Note that the database host server documentation - // @E2D // states that when we do this, the CCSID values - // @E2D // in data formats may be incorrect and that we - // @E2D // should always use the server job's CCSID. - - // Set the client CCSID to Unicode. // @E2A - - // @M0C - As of v5r3m0 we allow the client CCSID to be 1200 (UTF-16) which - // will cause our statement to flow in 1200 and our package to be 1200 - - //Bidi-HCG allow any ccsid or "system" to use ccsid of AS400 object - //Bidi-HCG start - String sendCCSID = properties_.getString(JDProperties.PACKAGE_CCSID); - - int sendCCSIDInt; - int hostCCSID; - if(this.getSystem() == null) //@pdcbidi - hostCCSID = 37; - else - hostCCSID = this.getSystem().getCcsid(); - int default_ccsid = Integer.parseInt(JDProperties.PACKAGE_CCSID_UCS2); - - if( sendCCSID.equalsIgnoreCase("system")) - sendCCSIDInt = hostCCSID; - else { - try{ - if((sendCCSIDInt = Integer.valueOf(sendCCSID).intValue()) <= 0) - sendCCSIDInt = default_ccsid; - if(vrm_ < JDUtilities.vrm530 && sendCCSIDInt == 1200) - sendCCSIDInt = default_ccsid; - } catch(Exception e) { - sendCCSIDInt = default_ccsid; - } - } - - packageCCSID_Converter = ConvTable.getTable(sendCCSIDInt, null); - properties_.setString(JDProperties.PACKAGE_CCSID, (new Integer(sendCCSIDInt)).toString()); - request.setClientCCSID(sendCCSIDInt); - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Client CCSID = " + sendCCSIDInt); - //Bidi-HCG end - - // This language feature code is used to tell the - // system what language to send error messages in. - // If that language is not installed on the system, - // we get messages back in the default language that - // was installed on the system. - // - String nlv = as400_.getNLV(); // @F1C - request.setLanguageFeatureCode(nlv); // @EDC - - if (JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "Setting server NLV = " + nlv); - - // Client functional level. - request.setClientFunctionalLevel(CLIENT_FUNCTIONAL_LEVEL_); // @EDC - - if (JDTrace.isTraceOn ()) // @EDC - JDTrace.logInformation (this, "Client functional level = " + CLIENT_FUNCTIONAL_LEVEL_); // @EDC - - // Sort sequence. - if (! properties_.equals (JDProperties.SORT, JDProperties.SORT_HEX)) //@pdc only send if not default (hex) - { - JDSortSequence sortSequence = new JDSortSequence ( - properties_.getString (JDProperties.SORT), - properties_.getString (JDProperties.SORT_LANGUAGE), - properties_.getString (JDProperties.SORT_TABLE), - properties_.getString (JDProperties.SORT_WEIGHT)); - request.setNLSSortSequence (sortSequence.getType (), - sortSequence.getTableFile (), - sortSequence.getTableLibrary (), - sortSequence.getLanguageId (), - tempConverter); - } - - request.setTranslateIndicator (0xF0); // @E2C - request.setDRDAPackageSize (1); - //Note: newAutoCommitSupport is trueAutoCommitSupport - if(!(newAutoCommitSupport_ == 0)) //@KBA V5R3 or greater so run with new support - { //@AC1 - if(properties_.getBoolean(JDProperties.AUTO_COMMIT)) //@AC1 - request.setAutoCommit(0xE8); //@KBA Turn on auto commit - else //@AC1 - request.setAutoCommit(0xD5); //@AC1 - } //@AC1 - - if((newAutoCommitSupport_ == 1) && (properties_.getBoolean(JDProperties.AUTO_COMMIT))) //@KBA //@AC1 (only set to *NONE if autocommit is on) - request.setCommitmentControlLevelParserOption(0); //@KBA Run under *NONE when in autocommit - else //@KBA Run under default isolation level - request.setCommitmentControlLevelParserOption (transactionManager_.getCommitMode ()); - - // Server attributes based on property values. - // These all match the index within the property's - // choices. - dateFormat = properties_.getIndex (JDProperties.DATE_FORMAT); - if (dateFormat != -1) - request.setDateFormatParserOption (dateFormat); - - dateSeparator = properties_.getIndex (JDProperties.DATE_SEPARATOR); - if (dateSeparator != -1) - request.setDateSeparatorParserOption (dateSeparator); - - timeFormat = properties_.getIndex (JDProperties.TIME_FORMAT); - if (timeFormat != -1) - request.setTimeFormatParserOption (timeFormat); - - timeSeparator = properties_.getIndex (JDProperties.TIME_SEPARATOR); - if (timeSeparator != -1) - request.setTimeSeparatorParserOption (timeSeparator); - - decimalSeparator = properties_.getIndex (JDProperties.DECIMAL_SEPARATOR); - if (decimalSeparator != -1) - request.setDecimalSeparatorParserOption (decimalSeparator); - - request.setNamingConventionParserOption (properties_.getIndex (JDProperties.NAMING)); - - // Do not set the ignore decimal data error parser option. - - // If the system supports RLE data compression, then use it. @ECA - // Otherwise, use the old-style data compression. @ECA - if (properties_.getBoolean(JDProperties.DATA_COMPRESSION)) - { // @ECA - if (vrm_ >= JDUtilities.vrm510) - { // @ECA - dataCompression_ = DATA_COMPRESSION_RLE_; // @ECA - request.setDataCompressionOption(0); // @ECA - if (JDTrace.isTraceOn ()) // @ECA - JDTrace.logInformation (this, "Data compression = RLE"); // @ECA - } // @ECA - else - { // @ECA - dataCompression_ = DATA_COMPRESSION_OLD_; // @ECA - request.setDataCompressionOption(1); // @D3A @ECC - if (JDTrace.isTraceOn ()) // @ECA - JDTrace.logInformation (this, "Data compression = old"); // @ECA - } // @ECA - } // @ECA - else - { // @ECA - dataCompression_ = DATA_COMPRESSION_NONE_; // @ECA - request.setDataCompressionOption(0); // @ECA - if (JDTrace.isTraceOn ()) // @ECA - JDTrace.logInformation (this, "Data compression = none"); // @ECA - } // @ECA - - // Default SQL schema. - if (defaultSchema_ != null) - request.setDefaultSQLLibraryName (defaultSchema_, tempConverter); - - // There is no need to tell the system what our code - // page is, nor is there any reason to get a translation - // table back from the system at this point. This - // will be handled later by the Converter class. - - // I haven't found a good reason to set the ambiguous select - // option. ODBC sets it only when block criteria is "unless - // FOR UPDATE OF", but it causes some problems for JDBC. - // The difference is that ODBC has the luxury of setting cursor - // concurrency. - - request.setPackageAddStatementAllowed (properties_.getBoolean (JDProperties.PACKAGE_ADD) ? 1 : 0); - - // If the system is at V4R4 or later, then set some more attributes. - if (vrm_ >= JDUtilities.vrm440) - { // @D0C @E9C - // @E9D || (FORCE_EXTENDED_FORMATS_)) { - - if(vrm_ >= JDUtilities.vrm540) //@540 use new Super Extended Formats - request.setUseExtendedFormatsIndicator(0xF2); //@540 - else //@540 - request.setUseExtendedFormatsIndicator (0xF1); - - // Although we publish a max lob threshold of 16777216, @E6A - // the system can only handle 15728640. We do it this @E6A - // way to match ODBC. @E6A - int lobThreshold = properties_.getInt (JDProperties.LOB_THRESHOLD); // @E6A - if (lobThreshold <= 0) // @E6A - request.setLOBFieldThreshold(0); // @E6A - else if (lobThreshold >= 15728640) // @E6A - request.setLOBFieldThreshold(15728640); // @E6A - else // @E6A - request.setLOBFieldThreshold(lobThreshold); // @E6C - - extendedFormats_ = true; - } - - // Set the default select statement type to be read-only (OS/400 v5r1 - // and earlier the default was updatable). If the app requests updatable - // statements we will now specify "updatable" on the RPB. Do this - // only to V5R1 systems with the needed PTF, and V5R2 and later systems - // because they have the fix needed to support - // altering the cursor type in the RPB. (AmbiguousSelectOption(1) - // means read-only) - if (vrm_ >= JDUtilities.vrm520) // @J3a - { // @J3a - request.setAmbiguousSelectOption(1); // @J3a - mustSpecifyForUpdate_ = false; // @J31a - - if(vrm_ >= JDUtilities.vrm710){ //@710 //@128sch - //@710 - Client support information - indicate our support for ROWID data type, true autocommit - // and 128 byte column names and 128 length schemas - request.setClientSupportInformation(0xF0000000); - if(JDTrace.isTraceOn()){ - JDTrace.logInformation(this, "ROWID supported = true"); - JDTrace.logInformation(this, "True auto-commit supported = true"); - JDTrace.logInformation(this, "128 byte column names supported = true"); - JDTrace.logInformation(this, "128 length schema names supported = true"); - } - - } - else if(vrm_ >= JDUtilities.vrm540){ //@540 for IBM i V5R4 and later, 128 byte column names are supported - //@540 - Client support information - indicate our support for ROWID data type, true autocommit - // and 128 byte column names - request.setClientSupportInformation(0xE0000000); - if(JDTrace.isTraceOn()){ - JDTrace.logInformation(this, "ROWID supported = true"); - JDTrace.logInformation(this, "True auto-commit supported = true"); - JDTrace.logInformation(this, "128 byte column names supported = true"); - } - - } - else if (vrm_ >= JDUtilities.vrm530) //@KBA For IBM i V5R3 and later true auto commit support is supported. - { - // @KBA - Client support information - indicate our support for ROWID data type and - // true auto-commit - request.setClientSupportInformation(0xC0000000); //@KBC - if(JDTrace.isTraceOn()) //@KBA - { //@KBA - JDTrace.logInformation(this, "ROWID supported = true"); //@KBA - JDTrace.logInformation(this, "True auto-commit supported = true"); //@KBA - } //@KBA - } //@KBA - else //@KBA - { //@KBA - // @M0A - Client support information - indicate our support for ROWID data type - request.setClientSupportInformation(0x80000000); - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "ROWID supported = true"); - } //@KBA - } - - // @M0A - added support for 63 digit decimal precision - if(vrm_ >= JDUtilities.vrm530) - { - int maximumPrecision = properties_.getInt(JDProperties.MAXIMUM_PRECISION); - int maximumScale = properties_.getInt(JDProperties.MAXIMUM_SCALE); - int minimumDivideScale = properties_.getInt(JDProperties.MINIMUM_DIVIDE_SCALE); - - // make sure that if scale is >31 we set precision to 63 - // this is a requirement of host server to avoid a PWS0009 - if(maximumScale > 31) - maximumPrecision = 63; - - request.setDecimalPrecisionIndicators(maximumPrecision, maximumScale, minimumDivideScale); - - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "Maximum decimal precision = " + maximumPrecision); - JDTrace.logInformation(this, "Maximum decimal scale = " + maximumScale); - JDTrace.logInformation(this, "Minimum divide scale = " + minimumDivideScale); - } - - // @M0A - added support of hex constant parser option - int parserOption = properties_.getIndex(JDProperties.TRANSLATE_HEX); - if(parserOption != -1) - { - request.setHexConstantParserOption(parserOption); - if(JDTrace.isTraceOn()) - { - String msg = (parserOption == 0) ? "Translate hex = character" : "Translate hex = binary"; - JDTrace.logInformation(this, msg); - } - } - - //@KBL - added support for hold/not hold locators - // Specifies whether input locators should be allocated as type hold locators or not hold locators. - // If the locators are of type hold, they will not be released when a commit is done. - boolean holdLocators = properties_.getBoolean(JDProperties.HOLD_LOCATORS); - if(!holdLocators) // Only need to set it if it is false, by default host server sets them to hold. - { - request.setInputLocatorType(0xD5); - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Hold Locators = " + holdLocators); - } - - //@KBL - added support for locator persistance. The JDBC specification says locators should be - // scoped to the transaction (ie. commit, rollback, or connection.close()) if auto commit is off - // host server added two options for the optional Locator Persistence ('3830'x') connection attribute: - // 0 -- Locators without the hold property are freed when cursor closed (locators scoped to the cursor). - // 1 -- Locators without the hold property are freed when the transaction is completed (locators scoped to the transaction). - // - // By default this is set to 0 by the host server, but to comply with the JDBC specification, - // we should always set it to 1. - // Note: this only applies when auto commit is off. The property has no effect if auto commit is on. - // Locators are always scoped to the cursor when auto-commit is on. - request.setLocatorPersistence(1); - } - - //@540 - if(vrm_ >= JDUtilities.vrm540){ - - //Set the query optimization goal - // 0 = Optimize query for first block of data (*ALLIO) when extended dynamic packages are used; Optimize query for entire result set (*FIRSTIO) when packages are not used (default) //@PDC update comment to reflect host server default - // 1 = Optimize query for first block of data (*FIRSTIO) - // 2 = Optimize query for entire result set (*ALLIO) - int queryOptimizeGoal = properties_.getInt (JDProperties.QUERY_OPTIMIZE_GOAL); - if(queryOptimizeGoal != 0){ // Only need to send if we are not using the default - if(queryOptimizeGoal == 1) - request.setQueryOptimizeGoal(0xC6); - else if(queryOptimizeGoal == 2) - request.setQueryOptimizeGoal(0xC1); - } - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "query optimize goal = " + queryOptimizeGoal); - } - - //@550 Query Storage Limit Support - if(vrm_ >= JDUtilities.vrm610){ - //Set the query storage limit - int queryStorageLimit = properties_.getInt(JDProperties.QUERY_STORAGE_LIMIT); - if(queryStorageLimit != -1) // Only need to send if we are not using the default of *NOMAX (-1) - { - if(queryStorageLimit < -1) - request.setQueryStorageLimit(-1); - else if(queryStorageLimit > AS400JDBCDataSource.MAX_STORAGE_LIMIT) // if larger than the max just set to max - request.setQueryStorageLimit(2147352578); - else - request.setQueryStorageLimit(queryStorageLimit); - } - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "query storage limit = " + queryStorageLimit); - } - - if (JDTrace.isTraceOn ()) - { - if (extendedFormats_) - JDTrace.logInformation (this, "Using extended datastreams"); - else - JDTrace.logInformation (this, "Using original datastreams"); - } - - // Send an RDB name to the system only if connecting to - // v5r2 and newer versions of IBM i - if (vrm_ >= JDUtilities.vrm520) // @J2a - { - // @J2a - StringBuffer RDBName = new StringBuffer(properties_.getString (JDProperties.DATABASE_NAME)); // @J2a - if (RDBName.length() > 0) // @J2a - { - // @J2a - RDBName.append(" "); // @J2a - RDBName.setLength(18); // @J2a - request.setRDBName(RDBName.toString().toUpperCase(), tempConverter); // @J2a - if (JDTrace.isTraceOn ()) // @J2a - JDTrace.logInformation (this, "RDB Name = -->" + RDBName + "<--"); // @J2a - } // @J2a - } // @J2a - - //@PDA 550 client interface info settings - //These three settings cannot be updated by user apps. - //This gives driver information to host server for any logging or future diagnostics. - if (vrm_ >= JDUtilities.vrm610) - { - //these strings are not mri translated for future diagnostic tools, searching etc on host server - request.setInterfaceType( "JDBC", tempConverter); - request.setInterfaceName( "IBM Toolbox for Java", tempConverter); - request.setInterfaceLevel( AS400JDBCDriver.DRIVER_LEVEL_, tempConverter); - - //@DFA 550 decfloat rounding mode - short roundingMode = 0; //@DFA - String roundingModeStr = properties_.getString(JDProperties.DECFLOAT_ROUNDING_MODE); //@DFA - if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_EVEN)) //@DFA - roundingMode = 0; //@DFA - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_UP)) //@DFA - roundingMode = 6; //@DFA - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_DOWN)) //@DFA - roundingMode = 2; //@DFA - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_CEILING)) //@DFA - roundingMode = 3; //@DFA - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_FLOOR)) //@DFA - roundingMode = 4; //@DFA - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_UP)) //@DFA - roundingMode = 1; //@DFA - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_DOWN)) //@DFA - roundingMode = 5; //@DFA - - //only need to send request if not default 0 (half even) - if(roundingMode != 0) //@DFA - request.setDecfloatRoundingMode(roundingMode); //@DFA - - //@eof Close on EOF - request.setCloseEOF( 0xE8) ; - - } - - //@710 - if (vrm_ >= JDUtilities.vrm710) - { - int car = properties_.getInt(JDProperties.CONCURRENT_ACCESS_RESOLUTION); //@cc1 - if( !(properties_.getString(JDProperties.CONCURRENT_ACCESS_RESOLUTION)).equals( JDProperties.CONCURRENTACCESS_NOT_SET )) //@cc1 - { //@cc1 - request.setConcurrentAccessResolution( car ); //@cc1 - //Use instance variable to to "current setting". - //This will allow the Connection setting to override DataSource - //setting for future updates to this property from the Connection object. //@cc1 - concurrentAccessResolution_ = car; //@cc1 - } //@cc1 - } - - // Send the request and process the reply. - reply = sendAndReceive (request); - - int errorClass = reply.getErrorClass(); - int returnCode = reply.getReturnCode(); - - // Sort sequence attribute cannot be set. - if ((errorClass == 7) - && ((returnCode == 301) || (returnCode == 303))) - postWarning (JDError.getSQLWarning (this, id_, errorClass, returnCode)); - - // Language feature code id was not changed. This is caused - // when the secondary language can not be added to the library - // list, and shows up as a PWS0003. - else if ((errorClass == 7) && (returnCode == 304)) - postWarning (JDError.getSQLWarning (this, id_, errorClass, returnCode)); - - // -704 is RDB (IASP) does not exist. We do not go back to the system to get - // error info since they are sending an invalid attribute exception when the - // IASP is not found. We can create a better error than that. - else if ((errorClass == 7) && (returnCode == -704)) // @J2a - { // @J2a - try // @J2a - { // @J2a - close(); // @J2a - } // @J2a - catch (Exception e) {} // eat errors on close // @J2a - JDError.throwSQLException(this, JDError.EXC_RDB_DOES_NOT_EXIST); // @J2a - } // @J2a - - // Other system errors. - else if (errorClass != 0) - JDError.throwSQLException (this, this, id_, errorClass, returnCode); - - // Process the returned server attributes. - serverAttributes = reply.getServerAttributes (); - } - finally - { - if (request != null) { - request.returnToPool(); request = null; - } - // We cannot return the reply to the pool while it is still being used in the serverAttributes structure - // if (reply != null) reply.returnToPool(); - } - - // The CCSID that comes back is a mixed CCSID (i.e. mixed - // SBCS and DBCS). This will be the CCSID that all - // non-graphic data will be returned as for this - // connection, so we own the converter here. - int serverCCSID = serverAttributes.getServerCCSID(); - //@P0D converter_ = ConverterImplRemote.getConverter (serverCCSID, as400_); - converter_ = ConvTable.getTable(serverCCSID, null); //@P0A - - // Get the server functional level. It comes back as in the @E7A - // format VxRxMx9999. @E7A - String serverFunctionalLevelAsString = serverAttributes.getServerFunctionalLevel(converter_); // @E7A - try - { // @E7A - serverFunctionalLevel_ = Integer.parseInt(serverFunctionalLevelAsString.substring(6)); // @E7A - } // @E7A - catch (NumberFormatException e) - { // @E7A - serverFunctionalLevel_ = 0; // @E7A - } // @E7A - - // Get the job number, but only if . @E8A - if (serverFunctionalLevel_ >= 5) // @E8A - serverJobIdentifier_ = serverAttributes.getServerJobIdentifier(converter_); // @E8A - - // User no longer needs to specify "for update" on their SQL - // statements if running to v5r1 with a PTF. (V5R2 and later - // is handled in another piece of code) - if ((vrm_ == JDUtilities.vrm510) && //@J31a - ( serverFunctionalLevel_ >= 10)) //@J31a - mustSpecifyForUpdate_ = false; //@J31a - - if (JDTrace.isTraceOn ()) - { // @C2C - int v = (vrm_ & 0xffff0000) >>> 16; // @D1A - int r = (vrm_ & 0x0000ff00) >>> 8; // @D1A - int m = (vrm_ & 0x000000ff); // @D1A - JDTrace.logInformation (this, "JDBC driver major version = " // @C2A - + AS400JDBCDriver.MAJOR_VERSION_); // @C2A - //Check version - V5R2 and earlier run on OS/400, V5R3 and later run on IBM i - if(((v==5) && (r>=3)) || (v>5)) - JDTrace.logInformation(this, "IBM i VRM = V" + v - + "R" + r + "M" + m); - else - JDTrace.logInformation (this, "OS/400 VRM = V" + v // @C2A - + "R" + r + "M" + m); // @C2A - JDTrace.logInformation (this, "Server CCSID = " + serverCCSID); - JDTrace.logInformation(this, "Server functional level = " // @E7A - + serverFunctionalLevelAsString // @E7A - + " (" + serverFunctionalLevel_ + ")"); // @E7A - - StringBuffer buffer = new StringBuffer(); // @E8A - if (serverJobIdentifier_ == null) // @E8A - buffer.append("Not available"); // @E8A - else - { // @E8A - buffer.append(serverJobIdentifier_.substring(20, 26).trim()); // job number // @E8A - buffer.append('/'); // @E8A - buffer.append(serverJobIdentifier_.substring(10, 20).trim()); // user name // @E8A - buffer.append('/'); // @E8A - buffer.append(serverJobIdentifier_.substring(0, 10).trim()); // job name // @E8A - } // @E8A - JDTrace.logInformation(this, "Server job identifier = " + buffer); // @E8A - } // @C2A - - // @E2D // Wait to load graphic converter until it is needed. - // @E2D graphicConverter_ = null; - // @E2D graphicConverterLoaded_ = false; - - // Get the catalog name from the RDB entry. If no RDB entry is - // set on the system, then use the system name from the AS400 object - // (which originally came from the URL). - String rdbEntry = serverAttributes.getRelationalDBName (converter_).trim(); - if ((rdbEntry.length() > 0) && (! rdbEntry.equalsIgnoreCase ("*N"))) - catalog_ = rdbEntry; - - // In the cases where defaults come from the server - // job, get the defaults for properties that were not set. - if (decimalSeparator == -1) - { - switch (serverAttributes.getDecimalSeparatorPO ()) - { - case 0: - properties_.setString (JDProperties.DECIMAL_SEPARATOR, JDProperties.DECIMAL_SEPARATOR_PERIOD); - break; - case 1: - properties_.setString (JDProperties.DECIMAL_SEPARATOR, JDProperties.DECIMAL_SEPARATOR_COMMA); - break; - } - } - - if (dateFormat == -1) - { - switch (serverAttributes.getDateFormatPO ()) - { - case 0: - properties_.setString (JDProperties.DATE_FORMAT, JDProperties.DATE_FORMAT_JULIAN); - break; - case 1: - properties_.setString (JDProperties.DATE_FORMAT, JDProperties.DATE_FORMAT_MDY); - break; - case 2: - properties_.setString (JDProperties.DATE_FORMAT, JDProperties.DATE_FORMAT_DMY); - break; - case 3: - properties_.setString (JDProperties.DATE_FORMAT, JDProperties.DATE_FORMAT_YMD); - break; - case 4: - properties_.setString (JDProperties.DATE_FORMAT, JDProperties.DATE_FORMAT_USA); - break; - case 5: - properties_.setString (JDProperties.DATE_FORMAT, JDProperties.DATE_FORMAT_ISO); - break; - case 6: - properties_.setString (JDProperties.DATE_FORMAT, JDProperties.DATE_FORMAT_EUR); - break; - case 7: - properties_.setString (JDProperties.DATE_FORMAT, JDProperties.DATE_FORMAT_JIS); - break; - } - } - - if (dateSeparator == -1) - { - switch (serverAttributes.getDateSeparatorPO ()) - { - case 0: - properties_.setString (JDProperties.DATE_SEPARATOR, JDProperties.DATE_SEPARATOR_SLASH); - break; - case 1: - properties_.setString (JDProperties.DATE_SEPARATOR, JDProperties.DATE_SEPARATOR_DASH); - break; - case 2: - properties_.setString (JDProperties.DATE_SEPARATOR, JDProperties.DATE_SEPARATOR_PERIOD); - break; - case 3: - properties_.setString (JDProperties.DATE_SEPARATOR, JDProperties.DATE_SEPARATOR_COMMA); - break; - case 4: - properties_.setString (JDProperties.DATE_SEPARATOR, JDProperties.DATE_SEPARATOR_SPACE); - break; - } - } - - if (timeFormat == -1) - { - switch (serverAttributes.getTimeFormatPO ()) - { - case 0: - properties_.setString (JDProperties.TIME_FORMAT, JDProperties.TIME_FORMAT_HMS); - break; - case 1: - properties_.setString (JDProperties.TIME_FORMAT, JDProperties.TIME_FORMAT_USA); - break; - case 2: - properties_.setString (JDProperties.TIME_FORMAT, JDProperties.TIME_FORMAT_ISO); - break; - case 3: - properties_.setString (JDProperties.TIME_FORMAT, JDProperties.TIME_FORMAT_EUR); - break; - case 4: - properties_.setString (JDProperties.TIME_FORMAT, JDProperties.TIME_FORMAT_JIS); - break; - } - } - - if (timeSeparator == -1) - { - switch (serverAttributes.getTimeSeparatorPO ()) - { - case 0: - properties_.setString (JDProperties.TIME_SEPARATOR, JDProperties.TIME_SEPARATOR_COLON); - break; - case 1: - properties_.setString (JDProperties.TIME_SEPARATOR, JDProperties.TIME_SEPARATOR_PERIOD); - break; - case 2: - properties_.setString (JDProperties.TIME_SEPARATOR, JDProperties.TIME_SEPARATOR_COMMA); - break; - case 3: - properties_.setString (JDProperties.TIME_SEPARATOR, JDProperties.TIME_SEPARATOR_SPACE); - break; - } - } - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - // @J5D catch (IOException e) { - catch (UnsupportedEncodingException e) - { // @J5C - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - finally - { - // Don't return the reply to the pool until the very end, - // as it is used by the DBReplyServerAttributes object - if (reply != null) { reply.returnToPool(); reply = null; } - } - } - - - - //@A3A - // Implementation note: Don't use this object internally because we could be running in a proxy environment - // The purpose of this method is to simply hold the full AS400 object so it can be retrieved from the Connection - void setSystem (AS400 as400) - throws SQLException // @EGA - { - as400PublicClassObj_ = as400; - } - - - - // @D2C - /** - Sets the transaction isolation level. The transaction - isolation level cannot be changed while in the middle of - a transaction. - -

        JDBC and DB2 for IBM i use different terminology for transaction - isolation levels. The following table provides a terminology - mapping: - -

        - - - - - -
        IBM i isolation levelJDBC transaction isolation level
        *CHG TRANSACTION_READ_UNCOMMITTED
        *CS TRANSACTION_READ_COMMITTED
        *ALL TRANSACTION_READ_REPEATABLE_READ
        *RR TRANSACTION_SERIALIZABLE
        - - @param level The transaction isolation level. Possible - values are: -

          -
        • TRANSACTION_READ_UNCOMMITTED -
        • TRANSACTION_READ_COMMITTED -
        • TRANSACTION_REPEATABLE_READ -
        • TRANSACTION_SERIALIZABLE -
        - - @exception SQLException If the connection is not open, - the input level is not valid - or unsupported, or a transaction - is active. - **/ - public void setTransactionIsolation (int level) - throws SQLException - { - checkOpen (); - - transactionManager_.setIsolation (level); - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Transaction isolation", transactionManager_.getIsolation ()); - } - - - - // JDBC 2.0 - /** - Sets the type map to be used for distinct and structured - types. - -

        Note: Distinct types are supported by DB2 for IBM i, but - are not externalized by the IBM Toolbox for Java JDBC driver. - In other words, distinct types behave as if they are the underlying - type. Structured types are not supported by DB2 for IBM i. - Consequently, this driver does not support the type map. - - @param typeMap The type map. - - @exception SQLException This exception is always thrown. - **/ - public void setTypeMap (Map typeMap) - throws SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - - - /** - Returns the connection's catalog name. This is the - name of the IBM i system. - - @return The catalog name. - **/ - public String toString () - { - return catalog_; - } - - - - /** - Indicates if the connection is using extended formats. - - @return true if the connection is using extended formats, false - otherwise. - **/ - boolean useExtendedFormats () - throws SQLException // @EGA - { - return extendedFormats_; - } - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCConnection", "java.sql.Connection" }; - } - - - - //@PDA jdbc40 - //JDBC40DOC /** - //JDBC40DOC * Returns true if the connection has not been closed and is still valid. - //JDBC40DOC * The driver shall submit a query on the connection or use some other - //JDBC40DOC * mechanism that positively verifies the connection is still valid when - //JDBC40DOC * this method is called. - //JDBC40DOC *

        - //JDBC40DOC * The query submitted by the driver to validate the connection shall be - //JDBC40DOC * executed in the context of the current transaction. - //JDBC40DOC * - //JDBC40DOC * @param timeout - The time in seconds to wait for the database operation - //JDBC40DOC * used to validate the connection to complete. If - //JDBC40DOC * the timeout period expires before the operation - //JDBC40DOC * completes, this method returns false. A value of - //JDBC40DOC * 0 indicates a timeout is not applied to the - //JDBC40DOC * database operation. Note that currently the timeout - //JDBC40DOC * value is not used. - //JDBC40DOC *

        - //JDBC40DOC * @return true if the connection is valid, false otherwise - //JDBC40DOC * @exception SQLException if a database access error occurs. - //JDBC40DOC */ - /* ifdef JDBC40 - public boolean isValid(int timeout) throws SQLException - { - DBSQLRequestDS request = null; - DBReplyRequestedDS reply = null; - int errorClass = 0; - int returnCode = 0; - ReentrantLock lock = new ReentrantLock(); - - try - { - // inner class to run timer in sep thread - class CommTimer implements Runnable - { - - Thread otherThread; - ReentrantLock lock; - int timeout; - - public void run() - { - try - { - Thread.sleep(timeout * 1000); - lock.lockInterruptibly(); //lock, so only one thread can call interrupt - otherThread.interrupt(); - - }catch(InterruptedException ie) - { - //interrupted from notifyThread because request/reply is done. just return from run() - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Connection.isValid timer interrupted and stopped"); - } - - } - - public CommTimer(Thread otherThread, int timeout, ReentrantLock lock ) - { - this.otherThread = otherThread; - this.timeout = timeout; - this.lock = lock; - } - }; - - CommTimer timer = new CommTimer( Thread.currentThread(), timeout, lock); //pass in ref to main thread so timer can interrupt if blocked on IO - Thread t = new Thread(timer); - t.start(); //sleeps for timeout and then interrupts main thread if it is still blocked on IO - - try - { - request = DBDSPool.getDBSQLRequestDS(DBSQLRequestDS.FUNCTIONID_TEST_CONNECTION, id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); - reply = sendAndReceive(request); - - lock.lockInterruptibly(); //lock, so only one thread can call interrupt - t.interrupt(); //stop timer thread - errorClass = reply.getErrorClass(); - returnCode = reply.getReturnCode(); - - }catch(Exception ex) - { - //interruptedException is wrapped in sqlException - //if exception occurs, just return false since connection is not valid - //this happens if timer ends before sendAndReceive returns - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Connection.isValid timed out or could not verify valid connection"); - return false; - } - - if(errorClass == 7 && returnCode == -201) - return true; - else - return false; - - } - catch(Exception e) - { - //implmentation note: if any exception happens, just return false, since conn is not valid - return false; - } - finally - { - if (request != null) { - request.returnToPool(); request = null; - } - if (reply != null) { - reply.returnToPool(); reply = null; // commented out code - } - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Connection.isValid call complete"); - } - - } - - endif */ - - - - //@PDA 550 client info - /** - * Sets the value of the client info property specified by name to the - * value specified by value. - *

        - * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver - * and the maximum length that may be specified for each property. - *

        - * The driver stores the value specified in a suitable location in the - * database. For example in a special register, session parameter, or - * system table column. For efficiency the driver may defer setting the - * value in the database until the next time a statement is executed or - * prepared. Other than storing the client information in the appropriate - * place in the database, these methods shall not alter the behavior of - * the connection in anyway. The values supplied to these methods are - * used for accounting, diagnostics and debugging purposes only. - *

        - * The driver shall generate a warning if the client info name specified - * is not recognized by the driver. - *

        - * If the value specified to this method is greater than the maximum - * length for the property the driver may either truncate the value and - * generate a warning or generate a SQLException. If the driver - * generates a SQLException, the value specified was not set on the - * connection. - *

        - * The following client info properties are supported in Toobox for Java. - *

        - *

          - *
        • ApplicationName - The name of the application currently utilizing - * the connection
        • - *
        • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
        • - *
        • ClientHostname - The hostname of the computer the application - * using the connection is running on.
        • - *
        • ClientAccounting - Client accounting information.
        • - *
        • ClientProgramID - The client program identification.
        • - *
        - *

        - * @param name The name of the client info property to set - * @param value The value to set the client info property to. If the - * value is null, the current value of the specified - * property is cleared. - *

        - * @throws SQLClientInfoException if the database returns an error while - * setting the client info value on the database server. - *

        - */ - public void setClientInfo(String name, String value) -/* ifdef JDBC40 - throws SQLClientInfoException -endif */ - /* ifndef JDBC40 */ - throws SQLException - /* endif */ - { - - DBSQLAttributesDS request = null; - DBReplyRequestedDS setClientInfoReply = null; - ConvTable tempConverter = null; - - String oldValue = null; //save in case we get error from host db - - // in order to reset if null value is passed in, use empty string - if (value == null) - value = ""; - - try - { - if (getVRM() >= JDUtilities.vrm610) - { - request = DBDSPool.getDBSQLAttributesDS(DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); - tempConverter = ConvTable.getTable(as400_.getCcsid(), null); - } - - if (name.equals(applicationNamePropertyName_)) - { - oldValue = applicationName_; - applicationName_ = value; - if (getVRM() >= JDUtilities.vrm610) - request.setClientInfoApplicationName(value, tempConverter); - - } else if (name.equals(clientUserPropertyName_)) - { - oldValue = clientUser_; - clientUser_ = value; - if (getVRM() >= JDUtilities.vrm610) - request.setClientInfoClientUser(value, tempConverter); - - } else if (name.equals(clientAccountingPropertyName_)) - { - oldValue = clientAccounting_; - clientAccounting_ = value; - if (getVRM() >= JDUtilities.vrm610) - request.setClientInfoClientAccounting(value, tempConverter); - - } else if (name.equals(clientHostnamePropertyName_)) - { - oldValue = clientHostname_; - clientHostname_ = value; - if (getVRM() >= JDUtilities.vrm610) - request.setClientInfoClientHostname(value, tempConverter); - - } else if (name.equals(clientProgramIDPropertyName_)) //@PDA add block for ProgramID - { - oldValue = clientProgramID_; - clientProgramID_ = value; - if (getVRM() >= JDUtilities.vrm610) - request.setClientInfoProgramID(value, tempConverter); - - } else - { - oldValue = null; - // post generic syntax error for invalid clientInfo name - postWarning(JDError.getSQLWarning(JDError.EXC_SYNTAX_ERROR)); - } - - if ((getVRM() >= JDUtilities.vrm610) && (oldValue != null)) - { - setClientInfoReply = sendAndReceive(request); - int errorClass = setClientInfoReply.getErrorClass(); - //throw SQLException - if (errorClass != 0) - JDError.throwSQLException(this, id_, errorClass, setClientInfoReply.getReturnCode()); - - } - } catch (Exception e) - { - //reset old value - if (name.equals(applicationNamePropertyName_)) - applicationName_ = oldValue; - else if (name.equals(clientUserPropertyName_)) - clientUser_ = oldValue; - else if (name.equals(clientAccountingPropertyName_)) - clientAccounting_ = oldValue; - else if (name.equals(clientHostnamePropertyName_)) - clientHostname_ = oldValue; - else if (name.equals(clientProgramIDPropertyName_)) //@pda - clientProgramID_ = oldValue; -/* ifdef JDBC40 - - //@PDD jdbc40 merge HashMap m = new HashMap(); - HashMap m = new HashMap(); - m.put(name, ClientInfoStatus.REASON_UNKNOWN); - JDError.throwSQLClientInfoException( this, JDError.EXC_INTERNAL, e, m ); - -endif */ -/* ifndef JDBC40 */ - JDError.throwSQLException( this, JDError.EXC_INTERNAL, e); -/* endif */ - } finally - { - if (request != null) { - request.returnToPool(); request = null; - } - if (setClientInfoReply != null) { - setClientInfoReply.returnToPool(); setClientInfoReply = null; // only error class used - } - } - } - - //@PDA 550 client info - /** - * Sets the value of the connection's client info properties. The - * Properties object contains the names and values of the - * client info properties to be set. The set of client info properties - * contained in the properties list replaces the current set of client info - * properties on the connection. If a property that is currently set on the - * connection is not present in the properties list, that property is - * cleared. Specifying an empty properties list will clear all of the - * properties on the connection. See - * setClientInfo (String, String) for more information. - *

        - * If an error occurs in setting any of the client info properties, a - * ClientInfoException is thrown. The - * ClientInfoException contains information indicating which - * client info properties were not set. The state of the client information - * is unknown because some databases do not allow multiple client info - * properties to be set atomically. For those databases, one or more - * properties may have been set before the error occurred. - *

        - * - * The following client info properties are supported in Toobox for Java. - *

        - *

          - *
        • ApplicationName - The name of the application currently utilizing - * the connection
        • - *
        • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
        • - *
        • ClientHostname - The hostname of the computer the application - * using the connection is running on.
        • - *
        • ClientAccounting - Client accounting information.
        • - *
        • ClientProgramID - The client program identification.
        • - *
        - *

        - * - * @param properties - * the list of client info properties to set - *

        - * @throws SQLClientInfoException - * if the database returns an error while setting the - * clientInfo values on the database - *

        - */ - public void setClientInfo(Properties properties) - /* ifdef JDBC40 - throws SQLClientInfoException - endif */ - /* ifndef JDBC40 */ - throws SQLException - /* endif */ - { - String newApplicationName = properties.getProperty(applicationNamePropertyName_); - String newClientHostname = properties.getProperty(clientHostnamePropertyName_); - String newClientUser = properties.getProperty(clientUserPropertyName_); - String newClientAccounting = properties.getProperty(clientAccountingPropertyName_); - String newClientProgramID = properties.getProperty(clientProgramIDPropertyName_); //@pda - - //In order to reset if null value is passed in, use empty string - //per javadoc, clear its value if not specified in properties - if (newApplicationName == null) - newApplicationName = ""; - if (newClientHostname == null) - newClientHostname = ""; - if (newClientUser == null) - newClientUser = ""; - if (newClientAccounting == null) - newClientAccounting = ""; - if (newClientProgramID == null) //@PDA - newClientProgramID = ""; - - DBSQLAttributesDS request = null; - DBReplyRequestedDS setClientInfoReply = null; - ConvTable tempConverter = null; - try - { - if (getVRM() >= JDUtilities.vrm610) - { - request = DBDSPool.getDBSQLAttributesDS(DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); - tempConverter = ConvTable.getTable(as400_.getCcsid(), null); - - request.setClientInfoApplicationName(newApplicationName, tempConverter); - - request.setClientInfoClientUser(newClientUser, tempConverter); - - request.setClientInfoClientAccounting(newClientAccounting, tempConverter); - - request.setClientInfoClientHostname(newClientHostname, tempConverter); - - request.setClientInfoProgramID(newClientProgramID, tempConverter); //@pda - - setClientInfoReply = sendAndReceive(request); - int errorClass = setClientInfoReply.getErrorClass(); - if (errorClass != 0) - JDError.throwSQLException(this, id_, errorClass, setClientInfoReply.getReturnCode()); - } - - //update local values after request/reply in case of exception - applicationName_ = newApplicationName; - clientHostname_ = newClientHostname; - clientUser_ = newClientUser; - clientAccounting_ = newClientAccounting; - clientProgramID_ = newClientProgramID; - - } catch( Exception e) - { -/* ifdef JDBC40 - //create Map for exception constructor - //@PDD jdbc40 merge HashMap m = new HashMap(); - HashMap m = new HashMap(); - Enumeration clientInfoNames = properties.keys(); - while( clientInfoNames.hasMoreElements()) - { - String clientInfoName = (String)clientInfoNames.nextElement(); - m.put(clientInfoName, ClientInfoStatus.REASON_UNKNOWN); - } - JDError.throwSQLClientInfoException( this, JDError.EXC_INTERNAL, e, m); - -endif */ -/* ifndef JDBC40 */ - JDError.throwSQLException( this, JDError.EXC_INTERNAL, e); -/* endif */ - } finally - { - if (request != null) { - request.returnToPool(); request = null; - } - if (setClientInfoReply != null) { - setClientInfoReply.returnToPool(); setClientInfoReply=null; // only error class used - } - } - - } - - //@PDA 550 client info - /** - * Returns the value of the client info property specified by name. This - * method may return null if the specified client info property has not - * been set and does not have a default value. This method will also - * return null if the specified client info property name is not supported - * by the driver. - *

        - * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver. - *

        - * - * The following client info properties are supported in Toobox for Java. - *

        - *

          - *
        • ApplicationName - The name of the application currently utilizing - * the connection
        • - *
        • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
        • - *
        • ClientHostname - The hostname of the computer the application - * using the connection is running on.
        • - *
        • ClientAccounting - Client accounting information.
        • - *
        • ClientProgramID - The client program identification.
        • - *
        - *

        - * @param name The name of the client info property to retrieve - *

        - * @return The value of the client info property specified - *

        - * @throws SQLException if the database returns an error when - * fetching the client info value from the database. - *

        - * see java.sql.DatabaseMetaData#getClientInfoProperties - */ - public String getClientInfo(String name) throws SQLException - { - if (name.equals(applicationNamePropertyName_)) - return applicationName_; - else if (name.equals(clientUserPropertyName_)) - return clientUser_; - else if (name.equals(clientAccountingPropertyName_)) - return clientAccounting_; - else if (name.equals(clientHostnamePropertyName_)) - return clientHostname_; - else if (name.equals(clientProgramIDPropertyName_)) //@pda - return clientProgramID_; - else - { - //post generic syntax error for invalid clientInfo name - //since javadoc for setClientInfo(String,String) says to generate warning, we will do same here and return null - postWarning(JDError.getSQLWarning(JDError.EXC_SYNTAX_ERROR)); - return null; - } - } - - //@PDA 550 client info - /** - * Returns a list containing the name and current value of each client info - * property supported by the driver. The value of a client info property - * may be null if the property has not been set and does not have a - * default value. - *

        - * - * The following client info properties are supported in Toobox for Java. - *

        - *

          - *
        • ApplicationName - The name of the application currently utilizing - * the connection
        • - *
        • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
        • - *
        • ClientHostname - The hostname of the computer the application - * using the connection is running on.
        • - *
        • ClientAccounting - Client accounting information.
        • - *
        • ClientProgramID - The client program identification.
        • - *
        - *

        - * @return A Properties object that contains the name and current value of - * each of the client info properties supported by the driver. - *

        - * @throws SQLException if the database returns an error when - * fetching the client info values from the database - */ - public Properties getClientInfo() throws SQLException - { - Properties props = new Properties(); - props.setProperty(applicationNamePropertyName_, applicationName_); - props.setProperty(clientAccountingPropertyName_, clientAccounting_); - props.setProperty(clientHostnamePropertyName_, clientHostname_); - props.setProperty(clientUserPropertyName_, clientUser_); - props.setProperty(clientProgramIDPropertyName_, clientProgramID_); //@pda - return props; - } - - - - - - //@PDA jdbc40 - /** - * Constructs an object that implements the Clob interface. The object - * returned initially contains no data. The setAsciiStream, - * setCharacterStream and setString methods of - * the Clob interface may be used to add data to the Clob. - * @return An object that implements the Clob interface - * @throws SQLException if an object that implements the - * Clob interface can not be constructed. - * - */ - public Clob createClob() throws SQLException - { - return new AS400JDBCClob("", AS400JDBCClob.MAX_LOB_SIZE); - } - - //@PDA jdbc40 - /** - * Constructs an object that implements the Blob interface. The object - * returned initially contains no data. The setBinaryStream and - * setBytes methods of the Blob interface may be used to add data to - * the Blob. - * @return An object that implements the Blob interface - * @throws SQLException if an object that implements the - * Blob interface can not be constructed - * - */ - public Blob createBlob() throws SQLException - { - return new AS400JDBCBlob(new byte[0], AS400JDBCBlob.MAX_LOB_SIZE); //@pdc 0 len array - } - - //@PDA jdbc40 - //JDBC40DOC /** - //JDBC40DOC * Constructs an object that implements the NClob interface. The object - //JDBC40DOC * returned initially contains no data. The setAsciiStream, - //JDBC40DOC * setCharacterStream and setString methods of the NClob interface may - //JDBC40DOC * be used to add data to the NClob. - //JDBC40DOC * @return An object that implements the NClob interface - //JDBC40DOC * @throws SQLException if an object that implements the - //JDBC40DOC * NClob interface can not be constructed. - //JDBC40DOC * - //JDBC40DOC */ - /*ifdef JDBC40 - public NClob createNClob() throws SQLException - { - return new AS400JDBCNClob("", AS400JDBCNClob.MAX_LOB_SIZE); - } -endif */ - - //@PDA jdbc40 - //JDBC40DOC /** - //JDBC40DOC * Constructs an object that implements the SQLXML interface. The object - //JDBC40DOC * returned initially contains no data. The createXMLStreamWriter object and - //JDBC40DOC * setString method of the SQLXML interface may be used to add data to the SQLXML - //JDBC40DOC * object. - //JDBC40DOC * @return An object that implements the SQLXML interface - //JDBC40DOC * @throws SQLException if an object that implements the SQLXML interface can not - //JDBC40DOC * be constructed - //JDBC40DOC */ - /*ifdef JDBC40 - public SQLXML createSQLXML() throws SQLException - { - return new AS400JDBCSQLXML("", AS400JDBCSQLXML.MAX_XML_SIZE); - } - endif */ - - //@PDA //@array - /** - * Factory method for creating Array objects. - * - * @param typeName the SQL name of the type the elements of the array map to. The typeName is a - * database-specific name which may be the name of a built-in type, a user-defined type or a standard SQL type supported by this database. This - * is the value returned by Array.getBaseTypeName - * For Toolbox, the typeName will correspond to a typename in java.sql.Types. - * - * @param elements the elements that populate the returned object - * @return an Array object whose elements map to the specified SQL type - * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - */ - public Array createArrayOf(String typeName, Object[] elements) throws SQLException - { - //@array - return new AS400JDBCArray(typeName, elements, this.vrm_, this); - } - - //@PDA jdbc40 - /** - * Factory method for creating Struct objects. - * - * @param typeName the SQL type name of the SQL structured type that this Struct - * object maps to. The typeName is the name of a user-defined type that - * has been defined for this database. It is the value returned by - * Struct.getSQLTypeName. - * @param attributes the attributes that populate the returned object - * @return a Struct object that maps to the given SQL type and is populated with the given attributes - * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - */ - public Struct createStruct(String typeName, Object[] attributes) throws SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - - //@2KRA - /** - * Starts or stops the Database Host Server trace for this connection. - * Note: This method is only supported when running to IBM i V5R3 or later - * and is ignored if you specified to turn on database host server tracing - * using the 'server trace' connection property. - * @param trace true to start database host server tracing, false to end it. - */ - public void setDBHostServerTrace(boolean trace){ - try{ - if(getVRM() >= JDUtilities.vrm530){ - // See if tracing was specified by server trace property - // Server Job Trace - boolean traceServerJob = ((traceServer_ & ServerTrace.JDBC_TRACE_SERVER_JOB) > 0); - // Database Host Server Trace - boolean traceDatabaseHostServer = (((traceServer_ & ServerTrace.JDBC_TRACE_DATABASE_HOST_SERVER) > 0)); - String serverJobIdentifier = getServerJobIdentifier(); - boolean SQLNaming = properties_.getString(JDProperties.NAMING).equals(JDProperties.NAMING_SQL); - - if(!traceDatabaseHostServer){ // database host server trace was not already started - if(trace) // user requested tracing be turned on - { - try{ - if(getVRM() == JDUtilities.vrm530){ // run command for V5R3 - JDUtilities.runCommand(this, "QSYS/STRTRC SSNID(QJT" + - serverJobIdentifier.substring(20) + - ") JOB(*) MAXSTG(128000) JOBTRCTYPE(*TRCTYPE) " + - "TRCTYPE((TESTA *INFO))", SQLNaming); - } - else{ // run command for V5R4 and higher - JDUtilities.runCommand(this, "QSYS/STRTRC SSNID(QJT" + - serverJobIdentifier.substring(20) + - ") JOB(*) MAXSTG(128000) JOBTRCTYPE(*TRCTYPE) " + - "TRCTYPE((*DBHSVR *INFO))", SQLNaming); - } - databaseHostServerTrace_ = true; - }catch(Exception e){ - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to start database host server tracing failed, could not trace server job"); - } - } - else // user requested tracing be turned off - { - // Only issue ENDTRC if not already done. - if(!traceServerJob) // turn off it we don't have to wait to turn off server job tracing - { - try{ - JDUtilities.runCommand(this, "QSYS/ENDTRC SSNID(QJT" + - serverJobIdentifier.substring(20) + - ") DTAOPT(*LIB) DTALIB(QUSRSYS) RPLDTA(*YES) PRTTRC(*YES)", SQLNaming ); - - JDUtilities.runCommand(this, "QSYS/DLTTRC DTAMBR(QJT" + - serverJobIdentifier.substring(20) + - ") DTALIB(QUSRSYS)", SQLNaming ); - databaseHostServerTrace_ = false; - } - catch(Exception e){ - JDTrace.logDataEvenIfTracingIsOff(this, "Attempt to end database host server tracing failed."); - } - } - } - } - } - }catch(SQLException e){ - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Attempt to start/stop database host server tracing failed."); - } - - } - - - //@A2A - public boolean doUpdateDeleteBlocking() { - return doUpdateDeleteBlocking_; - } - - // @A6A - public int getMaximumBlockedInputRows() { - return maximumBlockedInputRows_; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionEventSupport.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionEventSupport.java deleted file mode 100644 index fac9a5dbe..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionEventSupport.java +++ /dev/null @@ -1,90 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCConnectionEventSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import javax.sql.ConnectionEvent; -import javax.sql.ConnectionEventListener; -import java.util.Vector; - -/** -* The AS400JDBCConnectionEventSupport class represents an event support -* facility for maintaining and notifying listeners of JDBC connection events. -**/ -class AS400JDBCConnectionEventSupport -{ - final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - private Vector connectionListeners_; // The listener list. - - /** - * Constructs a default AS400JDBCConnectionEventSupport object. - **/ - public AS400JDBCConnectionEventSupport() - { - connectionListeners_ = new Vector(); - } - - - /** - * Adds a AS400JDBCConnectionEventListener. - * @param listener The listener. - **/ - public void addConnectionEventListener(ConnectionEventListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - connectionListeners_.addElement(listener); - } - - - /** - * Fires the connection closed event. - * @param event The ConnectionEvent. - **/ - public void fireCloseEvent(ConnectionEvent event) - { - Vector targets = (Vector) connectionListeners_.clone(); - for (int i=0; i< targets.size(); i++) - { - ConnectionEventListener target = (ConnectionEventListener) targets.elementAt(i); - target.connectionClosed(event); - } - } - - /** - * Fires the connection error event. - * @param event The ConnectionEvent. - **/ - public void fireErrorEvent(ConnectionEvent event) - { - Vector targets = (Vector) connectionListeners_.clone(); - for (int i=0; i< targets.size(); i++) - { - ConnectionEventListener target = (ConnectionEventListener) targets.elementAt(i); - target.connectionErrorOccurred(event); - } - } - - /** - * Removes a ConnectionEventListener. - * @param listener The listener to be removed. - **/ - public void removeConnectionEventListener(ConnectionEventListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - connectionListeners_.removeElement(listener); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionHandle.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionHandle.java deleted file mode 100644 index 545d7ca4c..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionHandle.java +++ /dev/null @@ -1,2007 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCConnectionHandle.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import javax.sql.ConnectionEvent; -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -/*ifdef JDBC40 -import java.sql.SQLClientInfoException; -endif */ -import java.sql.Clob; -import java.sql.Connection; //@A5A -import java.sql.DatabaseMetaData; -/*ifdef JDBC40 -import java.sql.NClob; -endif */ -import java.sql.PreparedStatement; -/*ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Savepoint; //@A6A -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.Statement; -import java.sql.Struct; -import java.util.Map; -import java.util.Properties; //@pda client info - -/** -* The AS400JDBCConnectionHandle class represents an AS400JDBCConnection object -* that can be used in a AS400JDBCPooledConnection. -* -*

        Creating a handle to a connection object allows the connection to be reused. -* The connection handle acts like a normal Connection object and should be closed -* after an application is done using it so it can be reused. -* -*

        -* The following example obtains a connection handle to a pooled connection. -*

        -* // Create a data source for making the connection. -* AS400JDBCConnectionPoolDataSource dataSource = new AS400JDBCConnectionPoolDataSource("CheeseDataBase"); -* datasource.setServerName("myAS400"); -* datasource.setUser("Mickey Mouse"); -* datasource.setPassword("IAMNORAT"); -* -* // Get a PooledConnection and get the connection handle to the database. -* AS400JDBCPooledConnection pooledConnection = datasource.getPooledConnection(); -* Connection connection = pooledConnection.getConnection(); -* -* ... work with the handle as if it is a normal connection. -* -* // Close the connection handle to it make available again for reuse. -* connection.close(); -*
        -* -**/ -public class AS400JDBCConnectionHandle -/* ifdef JDBC40 -extends ToolboxWrapper -endif */ -implements Connection //@A5A -//@A5D extends AS400JDBCConnection -{ - - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private AS400JDBCPooledConnection pooledConnection_ = null; - private AS400JDBCConnection connection_ = null; - - /** - * Constructs an AS400JDBCConnectionHandle object. - * @param pooledConnection The pooled connection from which the handle originated. - * @param connection The physical connection that the handle represents. - **/ - AS400JDBCConnectionHandle(AS400JDBCPooledConnection pooledConnection, AS400JDBCConnection connection) - { - if (pooledConnection == null) - throw new NullPointerException("pooledConnection"); - pooledConnection_ = pooledConnection; - - if (connection == null) - throw new NullPointerException("connection"); - connection_ = connection; - } - - //@pda handle - /** - * Invalidates the connection. - * A AS400JDBCPooledConnection can get expired and moved back to available queue. So this - * handle class needs a way for AS400JDBCPooledConnection to notify it of this change in state. - * This way, when finalize() is called by GC we will not try to double-close the connection. - * Without this method, it is possible for two handles to have references to the same pooledConnection. - **/ - void invalidate() - { - connection_ = null; - pooledConnection_ = null; - } - - /** - * Checks that the specified SQL statement can be executed. - * This decision is based on the access specified by the caller - * and the read only mode. - * - * @param sqlStatement The SQL statement. - * @exception SQLException If the statement cannot be executed. - **/ - void checkAccess (JDSQLStatement sqlStatement) throws SQLException - { - validateConnection(); - try { - connection_.checkAccess(sqlStatement); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - - - /** - * Checks that the connection is open. Public methods - * that require an open connection should call this first. - * - * @exception SQLException If the connection is not open. - **/ - void checkOpen() throws SQLException - { - validateConnection(); - try { - connection_.checkOpen(); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - - - /** - * Clears all warnings that have been reported for the connection. - * After this call, getWarnings() returns null until a new warning - * is reported for the connection. - * - * @exception SQLException If an error occurs. - **/ - public void clearWarnings() throws SQLException - { - validateConnection(); - connection_.clearWarnings(); - } - - - - /** - * Closes the handle to the connection. This does not close the - * underlying physical connection to the database. The handle is - * set to an unuseable state. - * - * @exception SQLException If an error occurs. - **/ - public synchronized void close() throws SQLException - { - if (connection_ == null) return; - - try { - // Rollback and close the open statements. - // Note: Leave the physical connection open, so it can get re-used. - connection_.pseudoClose(); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - finally { - // notify the pooled connection. - pooledConnection_.fireConnectionCloseEvent(new ConnectionEvent(pooledConnection_)); - - connection_ = null; - pooledConnection_ = null; - } - } - - /** - * Commits all changes made since the previous commit or - * rollback and releases any database locks currently held by - * the connection. This has no effect when the connection - * is in auto-commit mode. - * - * @exception SQLException If the connection is not open - * or an error occurs. - **/ - public void commit() throws SQLException - { - validateConnection(); - try { - connection_.commit(); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - /** - * Creates a Statement object for executing SQL statements without - * parameters. If the same SQL statement is executed many times, it - * is more efficient to use prepareStatement(). - * - *

        Result sets created using the statement will be type - * ResultSet.TYPE_FORWARD_ONLY and concurrency - * ResultSet.CONCUR_READ_ONLY. - * - * @return The statement object. - * - * @exception SQLException If the connection is not open, the maximum number - * of statements for this connection has been reached, or an error occured. - **/ - public Statement createStatement() throws SQLException - { - validateConnection(); - return connection_.createStatement(); - } - - - /** - * Creates a Statement object for executing SQL statements without - * parameters. If the same SQL statement is executed many times, it - * is more efficient to use prepareStatement(). - * - * @param resultSetType The result set type. Valid values are: - *

          - *
        • ResultSet.TYPE_FORWARD_ONLY - *
        • ResultSet.TYPE_SCROLL_INSENSITIVE - *
        • ResultSet.TYPE_SCROLL_SENSITIVE - *
        - * @param resultSetConcurrency The result set concurrency. Valid values are: - *
          - *
        • ResultSet.CONCUR_READ_ONLY - *
        • ResultSet.CONCUR_UPDATABLE - *
        - * @return The statement object. - * - * @exception SQLException If the connection is not open, the maximum number of statements - * for this connection has been reached, the result type or currency - * is not supported, or an error occured. - **/ - public Statement createStatement (int resultSetType, int resultSetConcurrency) throws SQLException - { - validateConnection(); - return connection_.createStatement(resultSetType, resultSetConcurrency); - } - - - //@A6A - /** - Creates a Statement object for executing SQL statements without - parameters. If the same SQL statement is executed many times, it - is more efficient to use prepareStatement(). - -

        Full functionality of this method requires support in OS/400 V5R2 - or IBM i. If connecting to OS/400 V5R1 or earlier, the value for - resultSetHoldability will be ignored. - - @param resultSetType The result set type. Valid values are: -

          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @param resultSetConcurrency The result set concurrency. Valid values are: -
          -
        • ResultSet.CONCUR_READ_ONLY -
        • ResultSet.CONCUR_UPDATABLE -
        - @param resultSetHoldability The result set holdability. Valid values are: -
          -
        • ResultSet.HOLD_CURSORS_OVER_COMMIT -
        • ResultSet.CLOSE_CURSORS_AT_COMMIT -
        - @return The statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type, currency, or holdability is not supported, - or an error occurs. - @since Modification 5 - **/ - public Statement createStatement (int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - validateConnection(); - return connection_.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability); - } - - - /** - * Closes the connection if not explicitly closed by the caller. - * - * @exception Throwable If an error occurs. - **/ - protected void finalize () - throws Throwable - { - //@A5D Removed validateConnection() because it was throwing SQL08003 exceptions if - //@A5D connection_ was null by the time the garbage collector ran. From a finalizer, - //@A5D we don't want to be throwing exceptions. - //@A5D validateConnection(); - //@A5D connection_.finalize(); - try - { //@A5A //@A5A - close(); //@A5A - } //@A5A - catch (SQLException e) //@A5A - { //@A5A - if (JDTrace.isTraceOn()) //@A5A - JDTrace.logInformation (this, "Finalize on a connection handle threw exception: " + e.getMessage()); //@A5A - } //@A5A - } - - - //@CPMa - /** - * If the exception is a fatal connection error, fires a connectionErrorOccurred event. - * We're looking for any kind of error that would indicate that the connection - * should not be re-used after it's returned to the connection pool. - **/ - private final void fireEventIfErrorFatal(SQLException e) - { - String sqlState = e.getSQLState(); - if (sqlState.equals(JDError.EXC_ACCESS_MISMATCH) || - sqlState.equals(JDError.EXC_CONNECTION_NONE) || - sqlState.equals(JDError.EXC_CONNECTION_REJECTED) || - sqlState.equals(JDError.EXC_CONNECTION_UNABLE) || - sqlState.equals(JDError.EXC_COMMUNICATION_LINK_FAILURE) || - sqlState.equals(JDError.EXC_INTERNAL) || - sqlState.equals(JDError.EXC_SERVER_ERROR) || - sqlState.equals(JDError.EXC_RDB_DOES_NOT_EXIST)) - { - pooledConnection_.fatalConnectionErrorOccurred_ = true; - pooledConnection_.fireConnectionErrorEvent(new ConnectionEvent(pooledConnection_, e)); - } - } - - /** - * Returns the AS400 object for this connection. - * - * @return The AS400 object. - **/ - AS400Impl getAS400 () - throws SQLException // @A3A - { - validateConnection(); - return connection_.getAS400(); - } - - /** - * Returns the auto-commit state. - * - * @return true if the connection is in auto-commit mode; false otherwise. - * @exception SQLException If the connection is not open. - **/ - public boolean getAutoCommit() throws SQLException - { - validateConnection(); - return connection_.getAutoCommit(); - } - - //@cc1 - /** - * This method returns the concurrent access resolution setting. - * This method has no effect on IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @return The concurrent access resolution setting. Possible return valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public int getConcurrentAccessResolution () throws SQLException - { - validateConnection(); - return connection_.getConcurrentAccessResolution(); - } - - /** - * Returns the catalog name. - * - * @return The catalog name. - * @exception SQLException If the connection is not open. - **/ - public String getCatalog () - throws SQLException - { - validateConnection(); - return connection_.getCatalog(); - } - - - - /** - * Returns the converter for this connection. - * - * @return The converter. - **/ - ConvTable getConverter () //@P0C - throws SQLException // @A3A - { - validateConnection(); - return connection_.converter_; //@P0C - } - - /** - * Returns the converter for the specified CCSID, unless - * it is 0 or -1 (i.e. probably set for a non-text field), in - * which case it returns the converter for this connection. - * This is useful for code that handles all types of fields - * in a generic manner. - * - * @param ccsid The CCSID. - * @return The converter. - * @exception SQLException If the CCSID is not valid. - **/ - ConvTable getConverter (int ccsid) //@P0C - throws SQLException - { - validateConnection(); - return connection_.getConverter(ccsid); - } - - - - /** - * Returns the default SQL schema. - * - * @return The default SQL schema, or QGPL if none was specified. - **/ - String getDefaultSchema () - throws SQLException // @A3A - { - validateConnection(); - return connection_.getDefaultSchema(); - } - - // @A1D /** - // @A1D * Returns the graphic converter for this connection. - // @A1D * - // @A1D * @return The graphic converter. - // @A1D * @exception SQLException If no graphic converter was loaded. - // @A1D **/ - // @A1D ConverterImplRemote getGraphicConverter () throws SQLException - // @A1D { - // @A1D validateConnection(); - // @A1D return connection_.getGraphicConverter(); - // @A1D } - - - //@A6A - /** - Returns the holdability of ResultSets created from this connection. - - @return The cursor holdability. Valid values are ResultSet.HOLD_CURSORS_OVER_COMMIT and - ResultSet.CLOSE_CURSORS_AT_COMMIT. The holdability is derived in this order - of precedence: -
          -
        • 1. The holdability specified using the method setHoldability(int) - if this method was called. -
        • 2. The value of the cursor hold - driver property.
        - Full functionality of #1 requires support in OS/400 - V5R2 or IBM i. If connecting to OS/400 V5R1 or earlier, - the value specified on this method will be ignored and the default holdability - will be the value of #2. - - @exception SQLException If the connection is not open. - @since Modification 5 - **/ - public int getHoldability () - throws SQLException - { - validateConnection(); - return connection_.getHoldability(); - } - - - //@A4A - /** - * Returns the DatabaseMetaData object that describes the - * connection's tables, supported SQL grammar, stored procedures, - * capabilities and more. - * - * @return The metadata object. - * - * @exception SQLException If an error occurs. - **/ - public DatabaseMetaData getMetaData () - throws SQLException - { - // We allow a user to get this object even if the - // connection is closed. - //@pdc above comment not true anymore - validateConnection(); //@pda since adding invalidate(), connection_ can be null - return connection_.getMetaData(); - } - - - /** - * Returns the connection properties. - * - * @return The connection properties. - **/ - JDProperties getProperties () - throws SQLException // @A3A - { - validateConnection(); - return connection_.getProperties(); - } - - /** - * Returns the job identifier of the host server job corresponding to this connection. - * Every JDBC connection is associated with a host server job on the system. The - * format is: - *
          - *
        • 10 character job name - *
        • 10 character user name - *
        • 6 character job number - *
        - * - *

        Note: Since this method is not defined in the JDBC Connection interface, - * you typically need to cast a Connection object returned from PooledConnection.getConnection() - * to an AS400JDBCConnectionHandle in order to call this method: - *

        -  *  String serverJobIdentifier = ((AS400JDBCConnectionHandle)connection).getServerJobIdentifier();
        -  *  
        - * - * @return The server job identifier, or null if not known. - * @exception SQLException If the connection is not open. - **/ - public String getServerJobIdentifier() throws SQLException - { - validateConnection(); - return connection_.getServerJobIdentifier(); - } - - //@pda - /** - Returns the system object which is managing the connection to the system. -

        Warning: This method should be used with extreme caution. This bypasses - the normal connection pool's connection reclaiming mechanisms. -

        Note: Since this method is not defined in the JDBC Connection interface, - you typically need to cast a Connection object to AS400JDBCConnectionHandle in order - to call this method: -

        -  AS400 system = ((AS400JDBCConnectionHandle)connection).getSystem();
        -  
        - - @return The system. - **/ - public AS400 getSystem() - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Warning: returning pooled connection's AS400 object directly to user."); - return connection_.getSystem(); - } - - - /** - * Returns the transaction isolation level. - * - * @return The transaction isolation level. Possible - * values are: - *
          - *
        • TRANSACTION_NONE - *
        • TRANSACTION_READ_UNCOMMITTED - *
        • TRANSACTION_READ_COMMITTED - *
        • TRANSACTION_REPEATABLE_READ - *
        - * - * @exception SQLException If the connection is not open. - **/ - public int getTransactionIsolation() throws SQLException - { - validateConnection(); - return connection_.getTransactionIsolation(); - } - - /** - * Returns the type map. - * - *

        This driver does not support the type map. - * - * @return The type map. - * @exception SQLException This exception is always thrown. - **/ - public Map getTypeMap() throws SQLException - { - validateConnection(); - return connection_.getTypeMap(); - } - - - /** - * Returns the URL for the connection's database. - * - * @return The URL for the database. - **/ - String getURL () - throws SQLException // @A3A - { - validateConnection(); - return connection_.getURL(); - } - - /** - * Returns the user name as currently signed on to the system. - * - * @return The user name. - **/ - String getUserName () - throws SQLException // @A3A - { - validateConnection(); - return connection_.getUserName(); - } - - - /** - * Returns the VRM. - **/ - int getVRM() - throws SQLException // @A3A - { - validateConnection(); - return connection_.getVRM(); - } - - /** - * Returns the first warning reported for the connection. - * Subsequent warnings may be chained to this warning. - * - * @return The first warning or null if no warnings - * have been reported. - * - * @exception SQLException If an error occurs. - **/ - public SQLWarning getWarnings() throws SQLException - { - validateConnection(); - return connection_.getWarnings(); - } - - /** - * Indicates if the specified cursor name is already used - * in the connection. - * - * @return true if the cursor name is already used; false otherwise. - **/ - boolean isCursorNameUsed (String cursorName) - throws SQLException // @A3A - { - validateConnection(); - return connection_.isCursorNameUsed(cursorName); - } - - /** - * Indicates if the connection is closed. - * - * @return true if the connection is closed; false otherwise. - * @exception SQLException If an error occurs. - **/ - public boolean isClosed() throws SQLException - { - if (connection_ == null) - return true; - else - return false; - } - - - - /** - * Indicates if the connection is in read-only mode. - * - * @return true if the connection is in read-only mode; false otherwise. - * @exception SQLException If the connection is not open. - **/ - public boolean isReadOnly() throws SQLException - { - validateConnection(); - return connection_.isReadOnly(); - } - - /** - * Returns the native form of an SQL statement without - * executing it. The JDBC driver converts all SQL statements - * from the JDBC SQL grammar into the native DB2 for IBM i - * SQL grammar prior to executing them. - * - * @param sql The SQL statement in terms of the JDBC SQL grammar. - * @return The translated SQL statement in the native - * DB2 for IBM i SQL grammar. - * - * @exception SQLException If the SQL statement has a syntax error. - **/ - public String nativeSQL (String sql) throws SQLException - { - validateConnection(); - return connection_.nativeSQL(sql); - } - - /** - * Notifies the connection that a statement in its context has been closed. - * - * @param statement The statement. - * @param id The statement's id. - **/ - void notifyClose (AS400JDBCStatement statement, int id) - throws SQLException // @A3A - { - validateConnection(); - connection_.notifyClose(statement, id); - } - - /** - * Posts a warning for the connection. - * - * @param sqlWarning The warning. - **/ - void postWarning (SQLWarning sqlWarning) - throws SQLException // @A3A - { - validateConnection(); - connection_.postWarning(sqlWarning); - } - - /** - * Precompiles an SQL stored procedure call with optional input - * and output parameters and stores it in a CallableStatement - * object. This object can be used to efficiently call the SQL - * stored procedure multiple times. - * - *

        Result sets created using the statement will be type - * ResultSet.TYPE_FORWARD_ONLY and concurrency - * ResultSet.CONCUR_READ_ONLY. - * - * @param sql The SQL stored procedure call. - * @return The callable statement object. - * - * @exception SQLException If the connection is not open, - * the maximum number of statements - * for this connection has been reached, or an - * error occurs. - **/ - public CallableStatement prepareCall (String sql) throws SQLException - { - validateConnection(); - return connection_.prepareCall(sql); - } - - /** - * Precompiles an SQL stored procedure call with optional input - * and output parameters and stores it in a CallableStatement - * object. This object can be used to efficiently call the SQL - * stored procedure multiple times. - * - * @param sql The SQL statement. - * @param resultSetType The result set type. Valid values are: - *

          - *
        • ResultSet.TYPE_FORWARD_ONLY - *
        • ResultSet.TYPE_SCROLL_INSENSITIVE - *
        • ResultSet.TYPE_SCROLL_SENSITIVE - *
        - * @param resultSetConcurrency The result set concurrency. Valid values are: - *
          - *
        • ResultSet.CONCUR_READ_ONLY - *
        • ResultSet.CONCUR_UPDATABLE - *
        - * @return The prepared statement object. - * - * @exception SQLException If the connection is not open, the maximum number of statements - * for this connection has been reached, the result type or currency - * is not valid, or an error occurs. - **/ - public CallableStatement prepareCall (String sql, int resultSetType, int resultSetConcurrency) - throws SQLException - { - validateConnection(); - return connection_.prepareCall(sql, resultSetType, resultSetConcurrency); - } - - - //@G4A JDBC 3.0 - /** - Precompiles an SQL stored procedure call with optional input - and output parameters and stores it in a CallableStatement - object. This object can be used to efficiently call the SQL - stored procedure multiple times. - -

        Full functionality of this method requires support in OS/400 V5R2 - or IBM i. If connecting to OS/400 V5R1 or earlier, the value for - resultSetHoldability will be ignored. - - @param sql The SQL statement. - @param resultSetType The result set type. Valid values are: -

          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @param resultSetConcurrency The result set concurrency. Valid values are: -
          -
        • ResultSet.CONCUR_READ_ONLY -
        • ResultSet.CONCUR_UPDATABLE -
        - @return The prepared statement object. - @param resultSetHoldability The result set holdability. Valid values are: -
          -
        • ResultSet.HOLD_CURSORS_OVER_COMMIT -
        • ResultSet.CLOSE_CURSORS_AT_COMMIT -
        - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type, currency, or holdability is not valid, - or an error occurs. - @since Modification 5 - **/ - public CallableStatement prepareCall (String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - validateConnection(); - return connection_.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability); - } - - - /** - * Precompiles an SQL statement with optional input parameters - * and stores it in a PreparedStatement object. This object can - * be used to efficiently execute this SQL statement multiple times. - * - *

        Result sets created using the statement will be type - * ResultSet.TYPE_FORWARD_ONLY and concurrency - * ResultSet.CONCUR_READ_ONLY. - * - * @param sql The SQL statement. - * @return The prepared statement object. - * - * @exception SQLException If the connection is not open, - * the maximum number of statements - * for this connection has been reached, or an - * error occurs. - **/ - public PreparedStatement prepareStatement (String sql) throws SQLException - { - validateConnection(); - return connection_.prepareStatement(sql); - } - - - - //@A6A - /** -Precompiles an SQL statement with optional input parameters -and stores it in a PreparedStatement object. This object can -be used to efficiently execute this SQL statement -multiple times. - -

        This method requires OS/400 V5R2 or IBM i. If connecting to OS/400 V5R1 or earlier, an exception will be -thrown. - -

        Result sets created using the statement will be type -ResultSet.TYPE_FORWARD_ONLY and concurrency -ResultSet.CONCUR_READ_ONLY. - -@param sql The SQL statement. -@param autoGeneratedKeys Whether to return auto generated keys. Valid values are: -

          -
        • Statement.RETURN_GENERATED_KEYS -
        • Statement.NO_GENERATED_KEYS -
        -@return The prepared statement object. - -@exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, - if connecting to OS/400 V5R1 or earlier, - an error occurs. -@since Modification 5 -**/ - public PreparedStatement prepareStatement (String sql, int autoGeneratedKeys) - throws SQLException - { - validateConnection(); - return connection_.prepareStatement(sql, autoGeneratedKeys); - } - - - // @A6A - /** - * Precompiles an SQL statement with optional input parameters - * and stores it in a PreparedStatement object. This object can - * be used to efficiently execute this SQL statement - * multiple times. - * - *

        This method is not supported. An SQLException is always thrown. - * - * @param sql The SQL statement. - * @param columnIndexes An array of column indexes indicating the columns that should be returned from the inserted row or rows. - * @return An SQLException is always thrown. This method is not supported. - * @exception java.sql.SQLException - Always thrown because the Toolbox JDBC driver does does not support this method. - * @since Modification 5 - **/ - public PreparedStatement prepareStatement (String sql, int[] columnIndexes) - throws SQLException - { - validateConnection(); - return connection_.prepareStatement(sql, columnIndexes); - } - - - /** - * Precompiles an SQL statement with optional input parameters - * and stores it in a PreparedStatement object. This object can - * be used to efficiently execute this SQL statement - * multiple times. - * - * @param sql The SQL statement. - * @param resultSetType The result set type. Valid values are: - *

          - *
        • ResultSet.TYPE_FORWARD_ONLY - *
        • ResultSet.TYPE_SCROLL_INSENSITIVE - *
        • ResultSet.TYPE_SCROLL_SENSITIVE - *
        - * @param resultSetConcurrency The result set concurrency. Valid values are: - *
          - *
        • ResultSet.CONCUR_READ_ONLY - *
        • ResultSet.CONCUR_UPDATABLE - *
        - * @return The prepared statement object. - * - * @exception SQLException If the connection is not open, - * the maximum number of statements - * for this connection has been reached, the - * result type or currency is not valid, - * or an error occurs. - **/ - public PreparedStatement prepareStatement (String sql, int resultSetType, int resultSetConcurrency) - throws SQLException - { - validateConnection(); - return connection_.prepareStatement(sql, resultSetType, resultSetConcurrency); - } - - - //@A6A - /** - Precompiles an SQL statement with optional input parameters - and stores it in a PreparedStatement object. This object can - be used to efficiently execute this SQL statement - multiple times. - - @param sql The SQL statement. - @param resultSetType The result set type. Valid values are: -
          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @param resultSetConcurrency The result set concurrency. Valid values are: -
          -
        • ResultSet.CONCUR_READ_ONLY -
        • ResultSet.CONCUR_UPDATABLE -
        - @param resultSetHoldability The result set holdability. Valid values are: -
          -
        • ResultSet.HOLD_CURSORS_OVER_COMMIT -
        • ResultSet.CLOSE_CURSORS_AT_COMMIT -
        - @return The prepared statement object. - - @exception SQLException If the connection is not open, - the maximum number of statements - for this connection has been reached, the - result type, currency, or holdability is not valid, - or an error occurs. - **/ - public PreparedStatement prepareStatement (String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - validateConnection(); - return connection_.prepareStatement (sql, resultSetType, resultSetConcurrency, resultSetHoldability); - } - - - // @A6A - /** - * Precompiles an SQL statement with optional input parameters - * and stores it in a PreparedStatement object. This object can - * be used to efficiently execute this SQL statement - * multiple times. - * - *

        This method is not supported. An SQLException is always thrown. - * - * @param sql The SQL statement. - * @param columnNames An array of column names indicating the columns that should be returned from the inserted row or rows. - * @return An SQLException is always thrown. This method is not supported. - * @exception java.sql.SQLException - Always thrown because the Toolbox JDBC driver does does not support this method. - * @since Modification 5 - **/ - public PreparedStatement prepareStatement (String sql, String[] columnNames) - throws SQLException - { - // Auto generated keys now supported for some releases.. Let the connection - // handle the exception. - - validateConnection(); - return connection_.prepareStatement(sql, columnNames); - } - - - // @A6A - /** - * Removes the given Savepoint object from the current transaction. - * Any reference to the savepoint after it has been removed will - * cause an SQLException to be thrown. - * - * @param savepoint the savepoint to be removed. - * - * @exception SQLException if a database access error occurs or the given Savepoint - * is not a valid savepoint in the current transaction. - * - * @since Modification 5 - **/ - public void releaseSavepoint(Savepoint savepoint) - throws SQLException - { - validateConnection(); - try { - connection_.releaseSavepoint(savepoint); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - - /** - * Drops all changes made since the previous commit or - * rollback and releases any database locks currently held by - * the connection. This has no effect when the connection - * is in auto-commit mode. - * - * @exception SQLException If the connection is not open - * or an error occurs. - **/ - public void rollback () throws SQLException - { - validateConnection(); - try { - connection_.rollback(); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - - // @A6A - /** - * Undoes all changes made after the specified Savepoint was set. - * - * @param savepoint the savepoint to be rolled back to. - * - * @exception SQLException if a database access error occurs, the Savepoint - * is no longer valid, or this Connection - * is currently in auto-commit mode. - * @since Modification 5 - **/ - public void rollback(Savepoint savepoint) - throws SQLException - { - validateConnection(); - try { - connection_.rollback(savepoint); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - - /** - * Sends a request data stream to the system using the - * connection's id and does not expect a reply. - * - * @param request The request. - * - * @exception SQLException If an error occurs. - **/ - void send (DBBaseRequestDS request) throws SQLException - { - validateConnection(); - try { - connection_.send (request); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - /** - * Sends a request data stream to the system and does not - * expect a reply. - * - * @param request The request. - * @param id The id. - * - * @exception SQLException If an error occurs. - **/ - void send (DBBaseRequestDS request, int id) throws SQLException - { - validateConnection(); - try { - connection_.send(request, id); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - /** - * Sends a request data stream to the system and does not - * expect a reply. - * - * @param request The request. - * @param id The id. - * @param leavePending Indicates if the request should - * be left pending. This indicates - * whether or not to base the next - * request on this one. - * - * @exception SQLException If an error occurs. - **/ - void send (DBBaseRequestDS request, int id, boolean leavePending) throws SQLException - { - validateConnection(); - try { - connection_.send(request, id, leavePending); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - // @A2D /** - // @A2D * Sends a request data stream to the system and discards the reply. - // @A2D * - // @A2D * @param request The request. - // @A2D * @param id The id. - // @A2D * @param leavePending Indicates if the request should - // @A2D * be left pending. This indicates - // @A2D * whether or not to base the next - // @A2D * request on this one. - // @A2D * - // @A2D * @exception SQLException If an error occurs. - // @A2D **/ - // @A2D void sendAndDiscardReply (DBBaseRequestDS request, int id) throws SQLException - // @A2D { - // @A2D validateConnection(); - // @A2D connection_.sendAndDiscardReply(request, id); - // @A2D } - - /** - * Sends a request data stream to the system using the - * connection's id and returns the corresponding reply from - * the system. - * - * @param request The request. - * @return The reply. - * - * @exception SQLException If an error occurs. - **/ - DBReplyRequestedDS sendAndReceive (DBBaseRequestDS request) throws SQLException - { - validateConnection(); - try { - return connection_.sendAndReceive(request); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - /** - * Sends a request data stream to the system and returns the - * corresponding reply from the system. - * - * @param request The request. - * @param id The id. - * @return The reply. - * - * @exception SQLException If an error occurs. - **/ - DBReplyRequestedDS sendAndReceive (DBBaseRequestDS request, int id) throws SQLException - { - validateConnection(); - try { - return connection_.sendAndReceive(request, id); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - /** - * Sets the auto-commit mode. If the connection is in auto-commit - * mode, then all of its SQL statements are executed and committed - * as individual transactions. Otherwise, its SQL statements are - * grouped into transactions that are terminated by either a commit - * or rollback. - * - *

        By default, the connection is in auto-commit mode. The - * commit occurs when the statement execution completes or the - * next statement execute occurs, whichever comes first. In the - * case of statements returning a result set, the statement - * execution completes when the last row of the result set has - * been retrieved or the result set has been closed. In advanced - * cases, a single statement may return multiple results as well - * as output parameter values. Here the commit occurs when all results - * and output parameter values have been retrieved. - * - * @param autoCommit true to turn on auto-commit mode, false to - * turn it off. - * - * @exception SQLException If the connection is not open - * or an error occurs. - **/ - public void setAutoCommit (boolean autoCommit) throws SQLException - { - validateConnection(); - try { - connection_.setAutoCommit(autoCommit); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - - //@cc1 - /** - * This method sets concurrent access resolution. This method overrides the setting of ConcurrentAccessResolution on the datasource or connection - * URL properties. This changes the setting for this connection only. This method has no effect on - * IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @param concurrentAccessResolution The current access resolution setting. Possible valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public void setConcurrentAccessResolution (int concurrentAccessResolution) throws SQLException - { - validateConnection(); - connection_.setConcurrentAccessResolution(concurrentAccessResolution); - } - - /** - Sets the eWLM Correlator. It is assumed a valid correlator value is used. - If the value is null, all ARM/eWLM implementation will be turned off. - eWLM correlators require i5/OS V5R3 or later systems. This request is ignored when running to OS/400 V5R2 or earlier systems. - - @param bytes The eWLM correlator value - **/ - public void setDB2eWLMCorrelator(byte[] bytes) - throws SQLException //@eWLM - { - validateConnection(); - connection_.setDB2eWLMCorrelator(bytes); - } - - /** - * This method is not supported. - * @exception SQLException If the connection is not open. - **/ - public void setCatalog (String catalog) throws SQLException - { - validateConnection(); - connection_.setCatalog(catalog); - } - - /** - * Sets whether the connection is being used for DRDA. - * - * @param drda true if the connection is being used for DRDA; false otherwise. - **/ - void setDRDA (boolean drda) - throws SQLException // @A3A - { - validateConnection(); - connection_.setDRDA(drda); - } - - - //@A6A - /** - Sets the holdability of ResultSets created from this connection. - -

        Full functionality of this method requires OS/400 V5R2 - or IBM i. If connecting to OS/400 V5R1 or earlier, all - cursors for the connection will be changed to the value of the variable - holdability. - - @param holdability The cursor holdability. - Valid values are ResultSet.HOLD_CURSORS_OVER_COMMIT or - ResultSet.CLOSE_CURSORS_AT_COMMIT. - - @exception SQLException If the connection is not open - or the value passed in is not valid. - @since Modification 5 - **/ - public void setHoldability (int holdability) - throws SQLException - { - validateConnection(); - connection_.setHoldability(holdability); - } - - - /** - * Sets the connection properties. - **/ - void setProperties (JDDataSourceURL dataSourceUrl, JDProperties properties, AS400 as400) - throws SQLException - { - validateConnection(); - try { - connection_.setProperties(dataSourceUrl, properties, as400); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - - /** - * Sets the properties. - **/ - void setProperties (JDDataSourceURL dataSourceUrl, JDProperties properties, AS400Impl as400) - throws SQLException - { - validateConnection(); - try { - connection_.setProperties(dataSourceUrl, properties, as400); - } - catch (SQLException e) { - fireEventIfErrorFatal(e); - throw e; - } - } - - /** - * Sets the read-only mode. This will provide read-only - * access to the database. Read-only mode can be useful by - * enabling certain database optimizations. If the caller - * specified "read only" or "read call" for the "access" property, - * then the read-only mode cannot be set to false. The read-only - * mode cannot be changed while in the middle of a transaction. - * - * @param readOnly true to set the connection to read-only mode; - * false to set the connection to read-write mode. - * - * @exception SQLException If the connection is not open, - * a transaction is active, or the - * "access" property is set to "read - * only". - **/ - public void setReadOnly (boolean readOnly) - throws SQLException - { - validateConnection(); - connection_.setReadOnly(readOnly); - } - - - // @A6A - /** - * Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it. - *

          - *
        • Named savepoints must be unique. A savepoint name cannot be reused until the savepoint is released, committed, or rolled back. - *
        • Savepoints are valid only if autocommit is off. An exception is thrown if autocommit is enabled. - *
        • Savepoints are not valid across XA connections. An exception is thrown if the connection is an XA connection. - *
        • Savepoints require OS/400 V5R2 or IBM i. An exception is thrown if connecting to OS/400 V5R1 or earlier. - *
        • If the connection option is set to keep cursors open after a traditional rollback, cursors will remain open after a rollback to a savepoint. - *
        - * - * @return The new Savepoint object. - * @exception SQLException if a database access error occurs or this Connection object is currently in auto-commit mode. - * @since Modification 5 - **/ - public Savepoint setSavepoint() - throws SQLException - { - validateConnection(); - return connection_.setSavepoint(); - } - - - // @A6 - /** - * Creates a named savepoint in the current transaction and returns the new Savepoint object that represents it. - *
          - *
        • Named savepoints must be unique. A savepoint name cannot be reused until the savepoint is released, committed, or rolled back. - *
        • Savepoints are valid only if autocommit is off. An exception is thrown if autocommit is enabled. - *
        • Savepoints are not valid across XA connections. An exception is thrown if the connection is an XA connection. - *
        • Savepoints require OS/400 V5R2 or IBM i. An exception is thrown if connecting to OS/400 V5R1 or earlier. - *
        • If the connection option is set to keep cursors open after a traditional rollback, cursors will remain open after a rollback to a savepoint. - *
        - * @param name A String containing the name of the savepoint - * @return The new Savepoint object. - * @exception SQLException if a database access error occurs or this Connection object is currently in auto-commit mode. - * @since Modification 5 - **/ - public Savepoint setSavepoint(String name) - throws SQLException - { - validateConnection(); - return connection_.setSavepoint(name); - } - - /** - * - **/ - void setSystem (AS400 as400) - throws SQLException // @A3A - { - validateConnection(); - connection_.setSystem(as400); - } - - /** - * Sets the transaction isolation level. The transaction - * isolation level cannot be changed while in the middle of - * a transaction. - * - *

        JDBC and DB2 for IBM i use different terminology for transaction - * isolation levels. The following table provides a terminology - * mapping: - * - *

        - * - * - * - * - * - *
        DB2 for IBM i isolation levelJDBC transaction isolation level
        *CHG TRANSACTION_READ_UNCOMMITTED
        *CS TRANSACTION_READ_COMMITTED
        *ALL TRANSACTION_READ_REPEATABLE_READ
        *RR TRANSACTION_SERIALIZABLE
        - * - * @param level The transaction isolation level. Possible values are: - *

          - *
        • TRANSACTION_READ_UNCOMMITTED - *
        • TRANSACTION_READ_COMMITTED - *
        • TRANSACTION_REPEATABLE_READ - *
        • TRANSACTION_SERIALIZABLE - *
        - * - * @exception SQLException If the connection is not open, the input level is not valid - * or unsupported, or a transaction is active. - **/ - public void setTransactionIsolation (int level) - throws SQLException - { - validateConnection(); - connection_.setTransactionIsolation(level); - } - - - - /** - * Sets the type map to be used for distinct and structured types. - * - *

        Note: Distinct types are supported by DB2 for IBM i, but - * are not externalized by the IBM Toolbox for Java JDBC driver. - * In other words, distinct types behave as if they are the underlying - * type. Structured types are not supported by DB2 for IBM i. - * Consequently, this driver does not support the type map. - * - * @param typeMap The type map. - * @exception SQLException This exception is always thrown. - **/ - public void setTypeMap (Map typeMap) throws SQLException - { - validateConnection(); - connection_.setTypeMap(typeMap); - } - - - - /** - * Returns the connection's catalog name. - * This is the name of the IBM i system. - * @return The catalog name. - **/ - public String toString () - { - if (connection_ != null) // @A3C - return connection_.toString(); - else // @A3A - return super.toString(); // @A3A - } - - - - /** - * Indicates if the connection is using extended formats. - * @return true if the connection is using extended formats, false otherwise. - **/ - boolean useExtendedFormats () - throws SQLException // @A3A - { - validateConnection(); - return connection_.useExtendedFormats(); - } - - - /** - * Validates that the connection has not been closed. - **/ - private void validateConnection() - throws SQLException // @A3A - { - if (connection_ == null) - { - // This would indicate that close() has been called on this handle. - // Note: It does _not_ indicate that the actual physical connection has experienced a fatal connection error. Therefore, we don't call fireConnectionErrorEvent() in this case. - JDTrace.logInformation (this, "The connection is closed."); // @A7C - JDError.throwSQLException (JDError.EXC_CONNECTION_NONE); // @A3C - } - } - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.Connection" }; //@pdc can't be a as400jdbcconnection wrapper because an attempt to cast as such would fail - } - - - //@PDA jdbc40 -//JDBC40DOC /** -//JDBC40DOC * Returns true if the connection has not been closed and is still valid. -//JDBC40DOC * The driver shall submit a query on the connection or use some other -//JDBC40DOC * mechanism that positively verifies the connection is still valid when -//JDBC40DOC * this method is called. -//JDBC40DOC *

        -//JDBC40DOC * The query submitted by the driver to validate the connection shall be -//JDBC40DOC * executed in the context of the current transaction. -//JDBC40DOC * -//JDBC40DOC * @param timeout - The time in seconds to wait for the database operation -//JDBC40DOC * used to validate the connection to complete. If -//JDBC40DOC * the timeout period expires before the operation -//JDBC40DOC * completes, this method returns false. A value of -//JDBC40DOC * 0 indicates a timeout is not applied to the -//JDBC40DOC * database operation. Note that currently the timeout -//JDBC40DOC * value is not used. -//JDBC40DOC *

        -//JDBC40DOC * @return true if the connection is valid, false otherwise -//JDBC40DOC * @exception SQLException if a database access error occurs. -//JDBC40DOC */ - /* ifdef JDBC40 - public boolean isValid(int timeout) throws SQLException - { - validateConnection(); - return connection_.isValid(timeout); - } - endif */ - - //@PDA jdbc40 - - // @PDA 550 client info - /** - * Sets the value of the connection's client info properties. The - * Properties object contains the names and values of the - * client info properties to be set. The set of client info properties - * contained in the properties list replaces the current set of client info - * properties on the connection. If a property that is currently set on the - * connection is not present in the properties list, that property is - * cleared. Specifying an empty properties list will clear all of the - * properties on the connection. See - * setClientInfo (String, String) for more information. - *

        - * If an error occurs in setting any of the client info properties, a - * ClientInfoException is thrown. The - * ClientInfoException contains information indicating which - * client info properties were not set. The state of the client information - * is unknown because some databases do not allow multiple client info - * properties to be set atomically. For those databases, one or more - * properties may have been set before the error occurred. - *

        - * The following client info properties are supported in Toobox for Java. - *

        - *

          - *
        • ApplicationName - The name of the application currently utilizing - * the connection
        • - *
        • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
        • - *
        • ClientHostname - The hostname of the computer the application - * using the connection is running on.
        • - *
        • ClientAccounting - Client accounting information.
        • - *
        • ClientProgramID - The client program identification.
        • - *
        - *

        - * - * @param properties - * the list of client info properties to set - *

        - * @throws SQLException - * if the database server returns an error while setting the - * clientInfo values on the database server - *

        - * see java.sql.Connection#setClientInfo(String, String) - * setClientInfo(String, String) - */ - public void setClientInfo(Properties properties) -/*ifdef JDBC40 - throws SQLClientInfoException -endif */ -/* ifndef JDBC40 */ - throws SQLException -/* endif */ - { -/* ifdef JDBC40 - try { - endif */ - validateConnection(); - /* ifdef JDBC40 - }catch(SQLException e) - { - SQLClientInfoException clientIE = new SQLClientInfoException(e.getMessage(), e.getSQLState(), null); - throw clientIE; - } - endif */ - - - connection_.setClientInfo(properties); - } /* setClientInfo */ - - - //@PDA 550 client info - /** - * Returns the value of the client info property specified by name. This - * method may return null if the specified client info property has not - * been set and does not have a default value. This method will also - * return null if the specified client info property name is not supported - * by the driver. - *

        - * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver. - *

        - * The following client info properties are supported in Toobox for Java. - *

        - *

          - *
        • ApplicationName - The name of the application currently utilizing - * the connection
        • - *
        • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
        • - *
        • ClientHostname - The hostname of the computer the application - * using the connection is running on.
        • - *
        • ClientAccounting - Client accounting information.
        • - *
        • ClientProgramID - The client program identification.
        • - *
        - *

        - * @param name The name of the client info property to retrieve - *

        - * @return The value of the client info property specified - *

        - * @throws SQLException if the database server returns an error when - * fetching the client info value from the database. - *

        - * see java.sql.DatabaseMetaData#getClientInfoProperties - */ - public String getClientInfo(String name) throws SQLException - { - validateConnection(); - return connection_.getClientInfo(name); - } - - - - //@PDA 550 client info - /** - * Returns a list containing the name and current value of each client info - * property supported by the driver. The value of a client info property - * may be null if the property has not been set and does not have a - * default value. - *

        - * The following client info properties are supported in Toobox for Java. - *

        - *

          - *
        • ApplicationName - The name of the application currently utilizing - * the connection
        • - *
        • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
        • - *
        • ClientHostname - The hostname of the computer the application - * using the connection is running on.
        • - *
        • ClientAccounting - Client accounting information.
        • - *
        • ClientProgramID - The client program identification.
        • - *
        - *

        - * @return A Properties object that contains the name and current value of - * each of the client info properties supported by the driver. - *

        - * @throws SQLException if the database server returns an error when - * fetching the client info values from the database - */ - public Properties getClientInfo() throws SQLException - { - validateConnection(); - return connection_.getClientInfo(); - } - - //@PDA jdbc40 - /** - * Constructs an object that implements the Clob interface. The object - * returned initially contains no data. The setAsciiStream, - * setCharacterStream and setString methods of - * the Clob interface may be used to add data to the Clob. - * @return An object that implements the Clob interface - * @throws SQLException if an object that implements the - * Clob interface can not be constructed. - * - */ - public Clob createClob() throws SQLException - { - validateConnection(); - return connection_.createClob(); - } - - //@PDA jdbc40 - /** - * Constructs an object that implements the Blob interface. The object - * returned initially contains no data. The setBinaryStream and - * setBytes methods of the Blob interface may be used to add data to - * the Blob. - * @return An object that implements the Blob interface - * @throws SQLException if an object that implements the - * Blob interface can not be constructed - * - */ - public Blob createBlob() throws SQLException - { - validateConnection(); - return connection_.createBlob(); - } - - - - - //@PDA jdbc40 -//JDBC40DOC /** -//JDBC40DOC * Constructs an object that implements the NClob interface. The object -//JDBC40DOC * returned initially contains no data. The setAsciiStream, -//JDBC40DOC * setCharacterStream and setString methods of the NClob interface may -//JDBC40DOC * be used to add data to the NClob. -//JDBC40DOC * @return An object that implements the NClob interface -//JDBC40DOC * @throws SQLException if an object that implements the -//JDBC40DOC * NClob interface can not be constructed. -//JDBC40DOC * -//JDBC40DOC */ - /* ifdef JDBC40 - public NClob createNClob() throws SQLException - { - validateConnection(); - return connection_.createNClob(); - } - endif */ - - //@PDA jdbc40 -//JDBC40DOC /** -//JDBC40DOC * Constructs an object that implements the SQLXML interface. The object -//JDBC40DOC * returned initially contains no data. The createXmlStreamWriter object and -//JDBC40DOC * setString method of the SQLXML interface may be used to add data to the SQLXML -//JDBC40DOC * object. -//JDBC40DOC * @return An object that implements the SQLXML interface -//JDBC40DOC * @throws SQLException if an object that implements the SQLXML interface can not -//JDBC40DOC * be constructed -//JDBC40DOC */ - /* ifdef JDBC40 - public SQLXML createSQLXML() throws SQLException - { - validateConnection(); - return connection_.createSQLXML(); - } - endif */ - - //@PDA jdbc40 - /** - * Factory method for creating Array objects. - * - * @param typeName the SQL name of the type the elements of the array map to. The typeName is a - * database-specific name which may be the name of a built-in type, a user-defined type or a standard SQL type supported by this database. This - * is the value returned by Array.getBaseTypeName - * @param elements the elements that populate the returned object - * @return an Array object whose elements map to the specified SQL type - * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - */ - public Array createArrayOf(String typeName, Object[] elements) throws SQLException - { - validateConnection(); - return connection_.createArrayOf(typeName, elements); - } - - //@PDA jdbc40 - /** - * Factory method for creating Struct objects. - * - * @param typeName the SQL type name of the SQL structured type that this Struct - * object maps to. The typeName is the name of a user-defined type that - * has been defined for this database. It is the value returned by - * Struct.getSQLTypeName. - * @param attributes the attributes that populate the returned object - * @return a Struct object that maps to the given SQL type and is populated with the given attributes - * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - */ - public Struct createStruct(String typeName, Object[] attributes) throws SQLException - { - validateConnection(); - return connection_.createStruct(typeName, attributes); - } - - - //@PDA 550 client info - /** - * Sets the value of the client info property specified by name to the - * value specified by value. - *

        - * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver - * and the maximum length that may be specified for each property. - *

        - * The driver stores the value specified in a suitable location in the - * database. For example in a special register, session parameter, or - * system table column. For efficiency the driver may defer setting the - * value in the database until the next time a statement is executed or - * prepared. Other than storing the client information in the appropriate - * place in the database, these methods shall not alter the behavior of - * the connection in anyway. The values supplied to these methods are - * used for accounting, diagnostics and debugging purposes only. - *

        - * The driver shall generate a warning if the client info name specified - * is not recognized by the driver. - *

        - * If the value specified to this method is greater than the maximum - * length for the property the driver may either truncate the value and - * generate a warning or generate a SQLException. If the driver - * generates a SQLException, the value specified was not set on the - * connection. - *

        - * The following client info properties are supported in Toobox for Java. - *

        - *

          - *
        • ApplicationName - The name of the application currently utilizing - * the connection
        • - *
        • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
        • - *
        • ClientHostname - The hostname of the computer the application - * using the connection is running on.
        • - *
        • ClientAccounting - Client accounting information.
        • - *
        • ClientProgramID - The client program identification.
        • - *
        - *

        - * @param name The name of the client info property to set - * @param value The value to set the client info property to. If the - * value is null, the current value of the specified - * property is cleared. - *

        - * @throws SQLException if the database server returns an error while - * setting the client info value on the database server. - *

        - */ - public void setClientInfo(String name, String value) - /* ifdef JDBC40 - throws SQLClientInfoException - endif */ - /* ifndef JDBC40 */ - throws SQLException - /* endif */ - { - /* ifdef JDBC40 - try { - endif */ - validateConnection(); - /* ifdef JDBC40 - }catch(SQLException e) - { - SQLClientInfoException clientIE = new SQLClientInfoException(e.getMessage(), e.getSQLState(), null); - throw clientIE; - } - endif */ - - connection_.setClientInfo(name, value); - } - - //@2KRA - /** - * Starts or stops the Database Host Server trace for this connection. - * Note: This method is only supported when running to i5/OS V5R3 or later - * and is ignored if you specified to turn on database host server tracingfs - * using the 'server trace' connection property. - * @param trace true to start database host server tracing, false to end it. - */ - public void setDBHostServerTrace(boolean trace) throws SQLException { //@pdc - /* ifdef JDBC40 - try { - endif */ - validateConnection(); - /* ifdef JDBC40 - }catch(SQLException e) - { - SQLClientInfoException clientIE = new SQLClientInfoException(e.getMessage(), e.getSQLState(), null); - throw clientIE; - } - endif */ - connection_.setDBHostServerTrace(trace); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPool.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPool.java deleted file mode 100644 index 153c0eb51..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPool.java +++ /dev/null @@ -1,679 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCConnectionPool.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.sql.Connection; -import java.sql.SQLException; -import java.util.Iterator; // Java2 -import java.util.Vector; // Java2 - -/** -* Represents a pool of JDBC connections -* that are available for use by a Java program. -*

        -* Note: AS400JDBCConnectionPool objects are threadsafe. -* -*

        The following example creates a connection pool with 10 connections. -*

        -* // Obtain an AS400JDBCConnectionPoolDataSource object from JNDI. -* Context context = new InitialContext(environment); -* AS400JDBCConnectionPoolDataSource datasource = (AS400JDBCConnectionPoolDataSource)context.lookup("jdbc/myDatabase"); -* -* // Create an AS400JDBCConnectionPool object. -* AS400JDBCConnectionPool pool = new AS400JDBCConnectionPool(datasource); -* -* // Adds 10 connections to the pool that can be used by the application (creates the physical database connections based on the data source). -* pool.fill(10); -* -* // Get a handle to a database connection from the pool. -* Connection connection = pool.getConnection(); -* -* ... Perform miscellenous queries/updates on the database. -* -* // Close the connection handle to return it to the pool. -* connection.close(); -* -* ... Application works with some more connections from the pool. -* -* // Close the pool to release all resources. -* pool.close(); -*
        -**/ -public class AS400JDBCConnectionPool extends ConnectionPool implements Serializable -{ - static final long serialVersionUID = 4L; - - - - private boolean closed_; // If the pool is closed. - private AS400JDBCConnectionPoolDataSource dataSource_; // The dataSource used for the connection. - transient long lastSingleThreadRun_; // Last time maintenance was run (single-thread mode). - transient Vector activePool_; // Active connections. - transient Vector availablePool_; // Available connections. - transient Vector deadPool_; // Connections staged for removal and disconnection. - transient private PoolConnectionEventListener eventListener_; // Listener for events on pooled connections. - - /** - * Constructs a default AS400JDBCConnectionPool object. - **/ - public AS400JDBCConnectionPool() - { - super(); - initializeTransient(); - } - - /** - * Constructs an AS400JDBCConnectionPool object with the specified dataSource. - * @param dataSource The AS400JDBCConnectionPoolDataSource object. - **/ - public AS400JDBCConnectionPool(AS400JDBCConnectionPoolDataSource dataSource) - { - this(); - - try - { - setDataSource(dataSource); - } - catch (PropertyVetoException p) - { /* will never occur. */ - } - } - - - /** - * Removes any connections that have exceeded maximum inactivity time, replaces any connections that have aged past maximum - * usage or maximum lifetime, and removes any connections that have been in use too long. - * @exception SQLException If a database error occurs closing a connection. - **/ - void cleanupConnections() - { - boolean trace = JDTrace.isTraceOn(); // @B5C - if (trace) - { - JDTrace.logInformation (this, "ConnectionPool cleanup..."); - JDTrace.logInformation (this, " MaxLifeTime: " + getMaxLifetime()); // @B5C - JDTrace.logInformation (this, " MaxUseTime: " + getMaxUseTime()); // @B5C - JDTrace.logInformation (this, " MaxInactivity: " + getMaxInactivity()); // @B5C - JDTrace.logInformation (this, " PretestConnections: " + isPretestConnections()); - - JDTrace.logInformation (this, "Idle Connections: " + availablePool_.size()); // @B5C - JDTrace.logInformation (this, "Active Connections: " + activePool_.size()); // @B5C - JDTrace.logInformation (this, "Dead Connections: " + deadPool_.size()); - } - - synchronized (availablePool_) - { - synchronized (activePool_) - { - Iterator[] connections = { availablePool_.iterator(), activePool_.iterator()}; - for (int i=0; i< connections.length; i++) - { - while (connections[i].hasNext()) - { - AS400JDBCPooledConnection poolConnection = (AS400JDBCPooledConnection)connections[i].next(); - - if (trace) - JDTrace.logInformation (this, poolConnection.toString()); // @B5C - - if ((!poolConnection.isInUse() && getMaxLifetime() !=-1 && poolConnection.getLifeSpan() > getMaxLifetime()) || //@B1C // inactive connections only. - (!poolConnection.isInUse() && getMaxInactivity() !=-1 && poolConnection.getInactivityTime() > getMaxInactivity())) //@B1C //@B3C - { - if (trace) - JDTrace.logInformation (this, "Removing expired connection from the pool."); // @B5C - - connections[i].remove(); - - // Stage the connection for closing. - synchronized (deadPool_) - { - deadPool_.addElement(poolConnection); - } - - // Notify listeners that the connection expired - if (poolListeners_ != null) - { - ConnectionPoolEvent poolEvent = new ConnectionPoolEvent(poolConnection, ConnectionPoolEvent.CONNECTION_EXPIRED); //@A5C - poolListeners_.fireConnectionExpiredEvent(poolEvent); - } - } - else if (getMaxUseTime() > 0 && - poolConnection.getInUseTime() > getMaxUseTime()) // only valid with active connections. - { - if (trace) - JDTrace.logInformation (this, "Returning active connection to the pool."); // @B5C - - poolConnection.returned(); // invalidate the connection handle - availablePool_.add(poolConnection); - connections[i].remove(); - - // Notify listeners that the connection expired - if (poolListeners_ != null) - { - ConnectionPoolEvent poolEvent = new ConnectionPoolEvent(poolConnection, ConnectionPoolEvent.CONNECTION_EXPIRED); //@A5C - poolListeners_.fireConnectionExpiredEvent(poolEvent); - } - } - } // 'while' loop - } // 'for' loop - } // synchronized (activePool_) - } // synchronized (availablePool_) - - // Close the removed connections. - synchronized (deadPool_) - { - Iterator connections = deadPool_.iterator(); - while (connections.hasNext()) - { - AS400JDBCPooledConnection poolConnection = (AS400JDBCPooledConnection)connections.next(); - - if (trace) - JDTrace.logInformation (this, poolConnection.toString()); - - if (trace) - JDTrace.logInformation (this, "Removing dead connection from the pool."); - - closePooledConnection(poolConnection); - connections.remove(); - } - } - - // Notify listeners that the maintenance thread was run. - if (poolListeners_ != null) - { - ConnectionPoolEvent poolEvent = new ConnectionPoolEvent(this, ConnectionPoolEvent.MAINTENANCE_THREAD_RUN); - poolListeners_.fireMaintenanceThreadRun(poolEvent); - } - - // Check if maintenance should keep running. - synchronized (availablePool_) - { - synchronized (activePool_) - { - if (activePool_.isEmpty() && availablePool_.isEmpty()) - { - if (maintenance_ != null) maintenance_.setRunning(false); - setInUse(false); // data source CAN be changed. - } - } - } - - if (!isThreadUsed()) - lastSingleThreadRun_ = System.currentTimeMillis(); - - if (trace) - { - JDTrace.logInformation (this, "ConnectionPool cleanup finished."); // @B5C - JDTrace.logInformation (this, " Idle Connections: " + availablePool_.size()); // @B5C - JDTrace.logInformation (this, " Active Connections: " + activePool_.size()); // @B5C - JDTrace.logInformation (this, " Dead Connections: " + deadPool_.size()); - } - } - - /** - * Closes all the database connections in the pool. - **/ - public void close() - { - if (JDTrace.isTraceOn()) // @B5C - { - JDTrace.logInformation (this, "Closing the JDBC connection pool."); // @B5C - JDTrace.logInformation (this, "Available: " + availablePool_.size()); // @B5C - JDTrace.logInformation (this, "Active: " + activePool_.size()); // @B5C - } - - // Close all connections in the pool. - synchronized (availablePool_) - { - synchronized (activePool_) - { - synchronized (deadPool_) - { - Iterator[] connections = { availablePool_.iterator(), activePool_.iterator(), deadPool_.iterator()}; - - for (int i=0; i< connections.length; i++) - { - while (connections[i].hasNext()) - { - AS400JDBCPooledConnection pooledConnection = (AS400JDBCPooledConnection)connections[i].next(); - closePooledConnection(pooledConnection); - connections[i].remove(); - } - } - } - } - } - - // Terminate the maintenance thread, if it's still alive. - if (maintenance_ != null && maintenance_.isAlive()) { - maintenance_.shutdown(); // tell the thread to terminate - } - - synchronized( this) { // @A7A - if (isInUse()) - setInUse(false); // data source CAN be changed. - } - // Notify the listeners. - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(this, ConnectionPoolEvent.CONNECTION_POOL_CLOSED); - poolListeners_.fireClosedEvent(event); - } - - closed_ = true; - } - - /** - * Closes an AS400JDBCPooledConnection. - * @param pooledConnection The pooled connection. - **/ - void closePooledConnection(AS400JDBCPooledConnection pooledConnection) - { - try - { - pooledConnection.close(); - } - catch (SQLException e) - { - /* ignore connection is being removed anyway. */ - JDTrace.logInformation (this, e.getMessage()); // @B5C - } - } - - /** - * Creates a pooledConnection for the pool. - * @return An AS400JDBCPooledConnection object. - * @exception SQLException If a database error occurs. - **/ - private AS400JDBCPooledConnection createPooledConnection() throws SQLException - { - if (dataSource_ == null) - throw new ExtendedIllegalStateException("dataSource", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - AS400JDBCPooledConnection pooledConnection = new AS400JDBCPooledConnection(dataSource_.getConnection()); //@A3C - pooledConnection.addConnectionEventListener(eventListener_); - dataSource_.log("PooledConnection created"); //@A3A - - return pooledConnection; - } - - /** - * Fills the connection pool with the specified number of database connections. - * @param numberOfConnections The number of connections to add to the pool. - * @exception ConnectionPoolException If a database error occurs creating a connection for the pool, or the maximum number of connections has been reached for the pool. - * @exception ExtendedIllegalArgumentException if the number of connections to fill the pool with is less than one. - **/ - public void fill(int numberOfConnections) throws ConnectionPoolException - { - if (JDTrace.isTraceOn()) // @B5C - JDTrace.logInformation (this, "Filling the pool with " + numberOfConnections + " connections."); //@B5C - - // Validate the numberOfConnections parameter. - if (numberOfConnections < 1) - throw new ExtendedIllegalArgumentException("numberOfConnections", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - int maxConnections = getMaxConnections(); - if (maxConnections != -1) - { - if (numberOfConnections + getActiveConnectionCount() + getAvailableConnectionCount() > maxConnections) - throw new ConnectionPoolException(ConnectionPoolException.MAX_CONNECTIONS_REACHED); //@KBA fix for JTOpen Bug 3655 - //@KBD throw new ExtendedIllegalArgumentException("numberOfConnections", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - // Add connections to the pool. - try - { - synchronized (availablePool_) - { - for (int i=0; i< numberOfConnections; i++) - { //@A5A - AS400JDBCPooledConnection poolConnection = createPooledConnection(); //@A5A - availablePool_.addElement(poolConnection); //@A5C - - // Notify the listeners. - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(poolConnection, ConnectionPoolEvent.CONNECTION_CREATED); //@A5M @A5C - poolListeners_.fireConnectionCreatedEvent(event); //@A5M - } - } //@A5A - } - } - catch (SQLException e) - { - if (isRunMaintenance() && maintenance_ != null) - cleanupConnections(); // re-check old connections. - throw new ConnectionPoolException(e); - } - - synchronized(this) { - if (!isInUse()) - { - setInUse(true); // Data source now can NOT be changed. - - if (isClosed()) - closed_ = false; // Set the state to OPEN if previously closed. - } - } - - if (isRunMaintenance() && isThreadUsed()) - { - if (maintenance_ == null) - { - synchronized(this) //@CRS - { - if (maintenance_ == null) //@CRS - { - maintenance_ = new PoolMaintenance(this); - maintenance_.start(); // Start the first time. - // Give thread a chance to start. -// if (!maintenance_.isRunning()) //@A2C -// { -// try -// { //@A2A -// Thread.sleep(10); //@A2A -// } //@A2A -// catch (InterruptedException e) //@A2A -// { - //Ignore //@A2A -// } //@A2A -// } //@A2A - // If thread has still not started, keep giving it chances for 5 minutes. -// for (int i = 1; !maintenance_.isRunning() && i<6000; i++) //@A2A -// { -// try -// { //@A2A -// Thread.sleep(50); //@A2A -// } //@A2A -// catch (InterruptedException ie) //@A2A -// { - //Ignore //@A2A -// } //@A2A -// } //@A2A -// if (!maintenance_.isRunning()) //@A2A -// JDTrace.logInformation (this, "maintenance thread failed to start"); //@A2A - } //@A2A - } - } -//@CRS else if (!maintenance_.isRunning()) - if (!maintenance_.isRunning()) maintenance_.setRunning(true); // Restart. @CRS - } - else if (isRunMaintenance() && !isThreadUsed()) - lastSingleThreadRun_ = System.currentTimeMillis(); - } - - /** - * Closes the connection pool if not explicitly closed by the caller. - * @exception Throwable If an error occurs. - **/ - protected void finalize() throws Throwable - { - if (!isClosed()) - close(); - super.finalize(); - } - - /** - * Returns the number of active connections the pool has created. - * @return The number of active connections. - **/ - public int getActiveConnectionCount() - { - return activePool_.size(); - } - - /** - * Returns the number of available PooledConnections in the pool. - * @return The number of available PooledConnections. - **/ - public int getAvailableConnectionCount() - { - return availablePool_.size(); - } - - /** - * Returns a connection from the pool. - * Updates the pool cache. - * @return The connection. - * @exception ConnectionPoolException If a database error occurs getting the connection. - **/ - public Connection getConnection() throws ConnectionPoolException - { - AS400JDBCPooledConnection pooledConnection = getPooledConnection(); - - Connection connection = null; - try - { - connection = pooledConnection.getConnection(); - } - catch (SQLException sql) - { - throw new ConnectionPoolException(sql); - } - - return connection; - } - - /** - * Returns the data source used to make connections. - * @return The AS400JDBCConnectionPoolDataSource object. - **/ - public AS400JDBCConnectionPoolDataSource getDataSource() - { - return dataSource_; - } - - - //@A3A - /** - * Returns a connection from the pool. - * Updates the pool cache. - * @return The connection. - * @exception ConnectionPoolException If a database error occurs getting the connection. - **/ - AS400JDBCPooledConnection getPooledConnection() throws ConnectionPoolException - { - AS400JDBCPooledConnection pooledConnection = null; - - final int maxTries = Math.max(getMaxConnections(), 1+availablePool_.size()); - int numTries = 0; - while (pooledConnection == null && - ++numTries <= maxTries) // eliminate any possibility of an infinite loop - { - synchronized (availablePool_) - { - //@B2M Moved following two lines into the synchronization block. - if (availablePool_.isEmpty()) //@B2M - fill(1); // Add a new connection. //@B2M - - //@CRS pooledConnection = (AS400JDBCPooledConnection)availablePool_.firstElement(); - pooledConnection = (AS400JDBCPooledConnection)availablePool_.lastElement(); //@CRS -- Most recently used. - - // Remove the pooled connection from the available list. - availablePool_.removeElement(pooledConnection); - } - - // Pre-test the connection, if the property is set. - try - { - if (isPretestConnections() && !pooledConnection.isConnectionAlive()) - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Connection failed a pretest."); - - synchronized (deadPool_) - { - deadPool_.addElement(pooledConnection); - } - pooledConnection = null; - } - } - catch (SQLException sql) - { - throw new ConnectionPoolException(sql); - } - - if (pooledConnection != null) - { - synchronized (activePool_) - { - activePool_.addElement(pooledConnection); - } - } - } - - if (pooledConnection == null) - { - JDTrace.logInformation (this, "Exceeded maximum attempts to get a valid connection: " + numTries); - throw new ConnectionPoolException(ConnectionPoolException.UNKNOWN_ERROR); - } - - // Notify the listeners that a connection was released. - if (poolListeners_ != null) - { - ConnectionPoolEvent event = new ConnectionPoolEvent(pooledConnection, ConnectionPoolEvent.CONNECTION_RELEASED); //@A5C - poolListeners_.fireConnectionReleasedEvent(event); - } - return pooledConnection; - } - - - /** - * Initializes the transient data. - **/ - private void initializeTransient() - { - eventListener_ = new PoolConnectionEventListener(this); - - activePool_ = new Vector(); - availablePool_ = new Vector(); - deadPool_ = new Vector(); - closed_ = true; - - //@A1D Moved property change listener to parent; moved runMaintenance method below. - } - - /** - * Indicates whether the connection pool is closed. - * @return true if closed; false otherwise. - **/ - public boolean isClosed() - { - return closed_; - } - - /** - * Deserializes and initializes transient data. - * @exception IOException If a file I/O error occurs. - * @exception ClassNotFoundException If a file error occurs. - **/ - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient(); - } - - /** - * Reduces the number of available connections down to the maximum number if necessary and possible. - * Note: A possibility still exists where the number of active connections is greater than the number of max connections. - * We will do this check in the PooledConnectionEventListener. - **/ - private void reduceConnectionCount() - { - synchronized (availablePool_) - { - synchronized (activePool_) - { - int current = availablePool_.size() + activePool_.size(); - int required = getMaxConnections(); - - if (current > required) - { - if (JDTrace.isTraceOn()) // @B5C - JDTrace.logInformation (this, "Reducing number of connections... Current: " + current + "(" + availablePool_.size() + ") " + " Max: " + required); // @B5C - - int removed = 0; - int reduceBy = current - required; - while (removed < reduceBy && availablePool_.size() != 0) - { - AS400JDBCPooledConnection poolConnection = (AS400JDBCPooledConnection)availablePool_.remove(0); - removed++; - synchronized (deadPool_) - { - // Stage the connection for closing. - deadPool_.addElement(poolConnection); - } - } - } - } - } - - // Close the removed connections. - synchronized (deadPool_) - { - Iterator deadConnections = deadPool_.iterator(); - while (deadConnections.hasNext()) - { - AS400JDBCPooledConnection poolConnection = (AS400JDBCPooledConnection)deadConnections.next(); - closePooledConnection(poolConnection); - deadConnections.remove(); - } - } - - } - - //@A1A - /** - * Run cleanupConnections(). - * @param reduced true if need to check current num connections; false otherwise. - **/ - void runMaintenance(boolean reduced) - { - if (maintenance_ != null && maintenance_.isRunning()) - { - synchronized(maintenance_) - { - if (reduced) - reduceConnectionCount(); // Check to see if number of available connections needs adjusting. - maintenance_.notify(); - } - } - } - - /** - * Sets the data source used to make connections. - * @param dataSource The AS400JDBCConnectionPoolDataSource object. - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setDataSource(AS400JDBCConnectionPoolDataSource dataSource) throws PropertyVetoException - { - String property = "dataSource"; - if (dataSource == null) - throw new NullPointerException(property); - - if (isInUse()) - { - JDTrace.logInformation (this, "Connection pool data source is already in use."); // @B5C - throw new ExtendedIllegalStateException(property, ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - AS400JDBCConnectionPoolDataSource old = dataSource_; - - dataSource_ = dataSource; - if(changes_ != null) //@K1A - changes_.firePropertyChange(property, old, dataSource); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPool16.gif b/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPool16.gif deleted file mode 100644 index bc48d4a07..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPool16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPool32.gif b/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPool32.gif deleted file mode 100644 index b929de7cd..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPool32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPoolBeanInfo.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPoolBeanInfo.java deleted file mode 100644 index fdd772670..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPoolBeanInfo.java +++ /dev/null @@ -1,148 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCConnectionPoolBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - - -/** -* The AS400JDBCConnectionPoolBeanInfo class provides bean information -* for the AS400JDBCConnectionPool class. -**/ -public class AS400JDBCConnectionPoolBeanInfo extends SimpleBeanInfo -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = AS400JDBCConnectionPool.class; - - // Handles loading the appropriate resource bundle - // private static ResourceBundleLoader loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = { changed }; - - events_ = events; - - PropertyDescriptor dataSource = new PropertyDescriptor("dataSource", beanClass, - "getDataSource", "setDataSource"); - dataSource.setBound(true); - dataSource.setConstrained(false); - dataSource.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_CP_DATA_SOURCE")); - dataSource.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_CP_DATA_SOURCE")); - - properties_ = new PropertyDescriptor[] { dataSource }; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - /** - * Returns additional bean information from the ConnectionPool superclass. - * @return The bean information. - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new ConnectionPoolBeanInfo() }; - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("AS400JDBCConnectionPool16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("AS400JDBCConnectionPool32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPoolDataSource.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPoolDataSource.java deleted file mode 100644 index 0c727ef6a..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPoolDataSource.java +++ /dev/null @@ -1,444 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCConnectionPoolDataSource.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.sql.SQLException; -import javax.naming.*; -import javax.sql.ConnectionPoolDataSource; -import javax.sql.PooledConnection; - -/** -* The AS400JDBCConnectionPoolDataSource class represents a factory for -* AS400PooledConnection objects. -* -*

        -* The following is an example that creates an AS400JDBCConnectionPoolDataSource object -* that can be used to cache JDBC connections. -* -*

        -* // Create a data source for making the connection. -* AS400JDBCConnectionPoolDataSource dataSource = new AS400JDBCConnectionPoolDataSource("myAS400"); -* datasource.setUser("myUser"); -* datasource.setPassword("MYPWD"); -* -* // Get the PooledConnection. -* PooledConnection pooledConnection = datasource.getPooledConnection(); -*
        -**/ -public class AS400JDBCConnectionPoolDataSource extends AS400JDBCDataSource implements ConnectionPoolDataSource, Referenceable, Serializable -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - //@B2D private transient AS400JDBCConnectionPool connectionPool_; //@A2A - - //@B2D private int initialPoolSize_ = 0; //@B0A - //@B2D private int maxIdleTime_ = 3600; //@B0A - //@B2D private int maxPoolSize_ = 0; //@B0A - //@B2D //private int maxStatements_ = 0; //@B0A - Ignore. Use package caching instead. - //@B2D private int minPoolSize_ = 0; //@B0A - //@B2D private int propertyCycle_ = 300; //@B0A - - /** - * Constructs a default AS400JDBCConnectionPoolDataSource object. - **/ - public AS400JDBCConnectionPoolDataSource() - { - super(); - //@B2D initializeTransient(); //@A2A - } - - /** - * Constructs an AS400JDBCConnectionPoolDataSource with the specified serverName. - * @param serverName The IBM i system name. - **/ - public AS400JDBCConnectionPoolDataSource(String serverName) - { - super(serverName); - //@B2D initializeTransient(); //@A2A - } - - /** - * Constructs an AS400JDBCConnectionPoolDataSource with the specified signon information. - * @param serverName The IBM i system name. - * @param user The user id. - * @param password The password. - **/ - public AS400JDBCConnectionPoolDataSource(String serverName, String user, String password) - { - super(serverName, user, password); - //@B2D initializeTransient(); //@A2A - } - - //@A1A - /** - * Constructs an AS400JDBCConnectionPoolDataSource with the specified signon information - * to use for SSL communications with the system. - * @param serverName The IBM i system name. - * @param user The user id. - * @param password The password. - * @param keyRingName The key ring class name to be used for SSL communications with the system. - * @param keyRingPassword The password for the key ring class to be used for SSL communications with the system. - **/ - public AS400JDBCConnectionPoolDataSource(String serverName, String user, String password, - String keyRingName, String keyRingPassword) - { - super(serverName, user, password, keyRingName, keyRingPassword); - //@B2D initializeTransient(); //@A2A - } - - // @F0A - added the following constructor to avoid some object construction - /** - * Constructs an AS400JDBCConnectionPoolDataSource from the specified Reference - * @param reference to retrieve DataSource properties from - **/ - AS400JDBCConnectionPoolDataSource(Reference reference) { - super(reference); - } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Returns the number of connections this pool contains when it is created. - //@B2D * @return The number of pooled connections. The default value is 0. - //@B2D **/ - //@B2D public int getInitialPoolSize() - //@B2D { - //@B2D return initialPoolSize_; - //@B2D } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Returns the maximum amount of time (in seconds) that a pooled - //@B2D * connection in this pool is allowed to remain idle before it is - //@B2D * automatically closed. A value of 0 indicates pooled connections - //@B2D * are never automatically closed. - //@B2D * @return The maximum idle time for a pooled connection in seconds. - //@B2D * The default value is 1 hour (3600 seconds). - //@B2D **/ - //@B2D public int getMaxIdleTime() - //@B2D { - //@B2D return maxIdleTime_; - //@B2D } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Returns the maximum number of connections this connection pool - //@B2D * contains. A value of 0 indicates there is no maximum. - //@B2D * @return The maximum number of connections in the pool. The default - //@B2D * value is 0 (no maximum). - //@B2D **/ - //@B2D public int getMaxPoolSize() - //@B2D { - //@B2D return maxPoolSize_; - //@B2D } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Returns the maximum number of statements this connection pool - //@B2D * should keep open. A value of 0 indicates that no statements - //@B2D * will be cached. - //@B2D * @return The maximum number of cached open statements. The default - //@B2D * value is 0 (no caching). - //@B2D **/ - //@B2D // Note: We don't support statement caching this way. - //@B2D // That's what package caching is for. - //@B2D // public int getMaxStatements() - //@B2D // { - //@B2D // return maxStatements_; - //@B2D // } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Returns the minimum number of connections this connection pool - //@B2D * contains. A value of 0 indicates there is no minimum and connections - //@B2D * are created as they are needed. - //@B2D * @return The minimum number of available connections in the pool. The - //@B2D * default value is 0. - //@B2D **/ - //@B2D public int getMinPoolSize() - //@B2D { - //@B2D return minPoolSize_; - //@B2D } - - - /** - * Returns a pooled connection that is connected to the IBM i system. - * @return A pooled connection. - * @exception SQLException If a database error occurs. - **/ - public PooledConnection getPooledConnection() throws SQLException - { - PooledConnection pc = new AS400JDBCPooledConnection(getConnection()); - - log("PooledConnection created"); - return pc; - - //@B2D //Get a connection from the connection pool. - //@B2D PooledConnection pc = null; //@A2A - //@B2D try - //@B2D { //@A2A - //@B2D connect(); //@B0A - //@B2D pc = connectionPool_.getPooledConnection(); //@A2C - //@B2D - //@B2D log("PooledConnection created"); - //@B2D return pc; - //@B2D } - //@B2D catch (ConnectionPoolException cpe) //@A2A - //@B2D { - //@B2D //@A2A - //@B2D JDError.throwSQLException (JDError.EXC_INTERNAL, cpe); //@A2A - //@B2D } - //@B2D return pc; //@A2M - } - - /** - * Returns a pooled connection that is connected to the IBM i system. - * @param user The userid for the connection. - * @param password The password for the connection. - * @return A pooled connection. - * @exception SQLException If a database error occurs. - **/ - public PooledConnection getPooledConnection(String user, String password) throws SQLException - { - PooledConnection pc = new AS400JDBCPooledConnection(getConnection(user,password)); - - log("PooledConnection created"); - return pc; - - //@B2D PooledConnection pc = null; //@A2A - //@B2D try - //@B2D { //@A2A - //@B2D connect(); //@B0A - //@B2D // Set user and password if user has not been set in the datasource yet. - //@B2D if (getUser().equals("")) //@A2A - //@B2D { - //@B2D //@A2A - //@B2D setUser(user); //@A2A - //@B2D setPassword(password); //@A2A - //@B2D } //@A2A - //@B2D // If the user specified is not equal to the user of the datasource, - //@B2D // throw an ExtendedIllegalStateException. - //@B2D user = user.toUpperCase(); //@A2A - //@B2D if (!(getUser().equals(user))) //@A2A - //@B2D { - //@B2D //@A2A - //@B2D Trace.log(Trace.ERROR, "User in data source already set."); //@A2A - //@B2D throw new ExtendedIllegalStateException("user", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); //@A2A - //@B2D } //@A2A - //@B2D pc = connectionPool_.getPooledConnection(); //@A2C - //@B2D - //@B2D log("PooledConnection created"); - //@B2D } - //@B2D catch (ConnectionPoolException cpe) //@A2A - //@B2D { - //@B2D //@A2A - //@B2D JDError.throwSQLException (JDError.EXC_INTERNAL, cpe); //@A2A - //@B2D } - //@B2D return pc; //@A2M - } - - - //@B2D //@B0A - Is it OK to have a maintenance thread according to the EJB spec? - //@B2D // Don't we have to run without creating additional threads? - //@B2D /** - //@B2D * Returns the interval (in seconds) between runs of this pool's - //@B2D * maintenance thread. The maintenance thread enforces this pool's - //@B2D * connections and statements so that they conform to the specified - //@B2D * minimum and maximum pool sizes, idle time, and maximum number of - //@B2D * open statements. - //@B2D * @return The number of seconds that this pool should wait before enforcing - //@B2D * its properties. The default value is 5 minutes (300 seconds). - //@B2D **/ - //@B2D public int getPropertyCycle() - //@B2D { - //@B2D return propertyCycle_; - //@B2D } - - - /** - * Returns the Reference object for the data source object. - * This is used by JNDI when bound in a JNDI naming service. - * Contains the information necessary to reconstruct the data source - * object when it is later retrieved from JNDI via an object factory. - * - * @return A Reference object for the data source object. - * @exception NamingException If a naming error occurs resolving the object. - **/ - public Reference getReference() throws NamingException - { - Reference ref = new Reference(this.getClass().getName(), - "com.ibm.as400.access.AS400JDBCObjectFactory", - null); - - Reference dsRef = super.getReference(); - for (int i=0; i< dsRef.size(); i++) - ref.add( dsRef.get(i) ); - - return ref; - } - - - //@B2D //@A2A - //@B2D /** - //@B2D * Initializes the transient data for object de-serialization. - //@B2D **/ - //@B2D private void initializeTransient() - //@B2D { - //@B2D connectionPool_ = new AS400JDBCConnectionPool(this); - //@B2D } - - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - //@B2D initializeTransient(); //@A2A - } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Sets the number of connections this pool contains when it is created. - //@B2D * @param initialPoolSize The number of pooled connections. Valid values - //@B2D * are 0 or greater. - //@B2D **/ - //@B2D public void setInitialPoolSize(int initialPoolSize) - //@B2D { - //@B2D String property = "initialPoolSize"; - //@B2D if (initialPoolSize < 0) - //@B2D { - //@B2D throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - //@B2D } - //@B2D if (!connected_) - //@B2D { - //@B2D Integer old = new Integer(initialPoolSize_); - //@B2D initialPoolSize_ = initialPoolSize; - //@B2D changes_.firePropertyChange(property, old, new Integer(initialPoolSize_)); - //@B2D } - //@B2D else - //@B2D { - //@B2D throw new ExtendedIllegalStateException(property, ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - //@B2D } - //@B2D } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Sets the maximum amount of time (in seconds) that a pooled - //@B2D * connection in this pool is allowed to remain idle before it is - //@B2D * automatically closed. A value of 0 indicates pooled connections - //@B2D * are never automatically closed. - //@B2D * @param maxIdleTime The maximum idle time for a pooled connection in seconds. - //@B2D * Valid values are 0 or greater. - //@B2D **/ - //@B2D public void setMaxIdleTime(int maxIdleTime) - //@B2D { - //@B2D String property = "maxIdleTime"; - //@B2D Integer old = new Integer(maxIdleTime_); - //@B2D maxIdleTime_ = maxIdleTime; - //@B2D changes_.firePropertyChange(property, old, new Integer(maxIdleTime_)); - //@B2D } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Sets the maximum number of connections this connection pool - //@B2D * contains. A value of 0 indicates there is no maximum. - //@B2D * @param maxPoolSize The maximum number of connections in this pool. - //@B2D * Valid values are 0 or greater. - //@B2D **/ - //@B2D public void setMaxPoolSize(int maxPoolSize) - //@B2D { - //@B2D String property = "maxPoolSize"; - //@B2D Integer old = new Integer(maxPoolSize_); - //@B2D maxPoolSize_ = maxPoolSize; - //@B2D changes_.firePropertyChange(property, old, new Integer(maxPoolSize_)); - //@B2D } - - - //@B2D //@B0A - //@B2D /** - //@B2D * Sets the maximum number of statements this connection pool - //@B2D * should keep open. A value of 0 indicates that no statements - //@B2D * will be cached. - //@B2D * @param maxStatements The maximum number of cached open statements. - //@B2D * Valid values are 0 or greater. - //@B2D **/ - //@B2D // Note: Use package caching to get statement caching. - //@B2D /* public void setMaxStatements(int maxStatements) - //@B2D { - //@B2D String property = "maxStatements"; - //@B2D Integer old = new Integer(maxStatements_); - //@B2D maxStatements_ = maxStatements; - //@B2D changes_.firePropertyChange(property, old, new Integer(maxStatements_)); - //@B2D } - //@B2D */ - - - //@B2D //@B0A - //@B2D /** - //@B2D * Sets the minimum number of connections this connection pool - //@B2D * contains. A value of 0 indicates there is no minimum and connections - //@B2D * are created as they are needed. - //@B2D * @param minPoolSize The minimum number of available connections in the pool. - //@B2D * Valid values are 0 or greater. - //@B2D **/ - //@B2D public void setMinPoolSize(int minPoolSize) - //@B2D { - //@B2D String property = "minPoolSize"; - //@B2D Integer old = new Integer(minPoolSize_); - //@B2D minPoolSize_ = minPoolSize; - //@B2D changes_.firePropertyChange(property, old, new Integer(minPoolSize_)); - //@B2D } - - - //@B2D //@B0A - Is it OK to have a maintenance thread according to the EJB spec? - //@B2D // Don't we have to run without creating additional threads? - //@B2D /** - //@B2D * Sets the interval (in seconds) between runs of this pool's - //@B2D * maintenance thread. The maintenance thread enforces this pool's - //@B2D * connections and statements so that they conform to the specified - //@B2D * minimum and maximum pool sizes, idle time, and maximum number of - //@B2D * open statements. A value of 0 indicates that a maintenance thread - //@B2D * should not be created. - //@B2D * @param The number of seconds that this pool should wait before enforcing - //@B2D * its properties. Valid values are 0 or greater. - //@B2D **/ - //@B2D public void setPropertyCycle(int propertyCycle) - //@B2D { - //@B2D String property = "propertyCycle"; - //@B2D Integer old = new Integer(propertyCycle_); - //@B2D propertyCycle_ = propertyCycle; - //@B2D changes_.firePropertyChange(property, old, new Integer(propertyCycle_)); - //@B2D } - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCConnectionPoolDataSource", "java.sql.ConnectionPoolDataSource" }; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPoolDataSource16.gif b/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPoolDataSource16.gif deleted file mode 100644 index 5bdba8ed4..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPoolDataSource16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPoolDataSource32.gif b/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPoolDataSource32.gif deleted file mode 100644 index 44eebf021..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPoolDataSource32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPoolDataSourceBeanInfo.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPoolDataSourceBeanInfo.java deleted file mode 100644 index 5e8870bd4..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCConnectionPoolDataSourceBeanInfo.java +++ /dev/null @@ -1,155 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCConnectionPoolDataSourceBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; - - -/** - * The AS400JDBCConnectionPoolDataSourceBeanInfo class provides bean information - * for the AS400JDBCConnectionPoolDataSource class. -**/ -public class AS400JDBCConnectionPoolDataSourceBeanInfo extends SimpleBeanInfo -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private static final Class beanClass = AS400JDBCConnectionPoolDataSource.class; - - //@B1D private static PropertyDescriptor[] propertyDescriptors_; //@B0A - //@B1D private static final BeanDescriptor beanDescriptor_; //@B0A - //@B1D private static final BeanInfo[] additionalBeanInfo_; //@B0A - - - //@B0A - //@B1D static - //@B1D { - //@B1D try - //@B1D { - //@B1D beanDescriptor_ = new BeanDescriptor(beanClass_); - //@B1D additionalBeanInfo_ = new BeanInfo[] { new AS400JDBCDataSourceBeanInfo()}; - - //@B1D PropertyDescriptor initialPoolSize = new PropertyDescriptor("initialPoolSize", beanClass_); - //@B1D initialPoolSize.setBound(true); - //@B1D initialPoolSize.setConstrained(false); - //@B1D initialPoolSize.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_CPDS_INIT_POOL_SIZE")); - //@B1D initialPoolSize.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_CPDS_INIT_POOL_SIZE")); - - //@B1D PropertyDescriptor maxIdleTime = new PropertyDescriptor("maxIdleTime", beanClass_); - //@B1D maxIdleTime.setBound(true); - //@B1D maxIdleTime.setConstrained(false); - //@B1D maxIdleTime.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_CPDS_MAX_IDLE_TIME")); - //@B1D maxIdleTime.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_CPDS_MAX_IDLE_TIME")); - - //@B1D PropertyDescriptor maxPoolSize = new PropertyDescriptor("maxPoolSize", beanClass_); - //@B1D maxPoolSize.setBound(true); - //@B1D maxPoolSize.setConstrained(false); - //@B1D maxPoolSize.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_CPDS_MAX_POOL_SIZE")); - //@B1D maxPoolSize.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_CPDS_MAX_POOL_SIZE")); - -//@B1D // Note: We are currently not implementing statement pooling this way, -//@B1D // since we already have package caching. -//@B1D // PropertyDescriptor maxStatements = new PropertyDescriptor("maxStatements", beanClass_); -//@B1D // maxStatements.setBound(true); -//@B1D // maxStatements.setConstrained(false); -//@B1D // maxStatements.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_CPDS_MAX_STATEMENTS")); -//@B1D // maxStatements.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_CPDS_MAX_STATEMENTS")); - - //@B1D PropertyDescriptor minPoolSize = new PropertyDescriptor("minPoolSize", beanClass_); - //@B1D minPoolSize.setBound(true); - //@B1D minPoolSize.setConstrained(false); - //@B1D minPoolSize.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_CPDS_MIN_POOL_SIZE")); - //@B1D minPoolSize.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_CPDS_MIN_POOL_SIZE")); - - //@B1D PropertyDescriptor propertyCycle = new PropertyDescriptor("propertyCycle", beanClass_); - //@B1D propertyCycle.setBound(true); - //@B1D propertyCycle.setConstrained(false); - //@B1D propertyCycle.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_CPDS_PROP_CYCLE")); - //@B1D propertyCycle.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_CPDS_PROP_CYCLE")); - - //@B1D propertyDescriptors_ = new PropertyDescriptor[] - //@B1D { - //@B1D initialPoolSize, maxIdleTime, maxPoolSize, // maxStatements, - //@B1D minPoolSize, propertyCycle - //@B1D }; - //@B1D } - //@B1D catch(Exception e) - //@B1D { - //@B1D if(Trace.isTraceOn()) - //@B1D { - //@B1D Trace.log(Trace.ERROR, "Error while loading bean info", e); - //@B1D } - //@B1D throw new Error(e.toString()); - //@B1D } - //@B1D } - - - /** - * Returns additional bean information from the AS400JDBCConnectionPoolDataSource superclass. - * @return The bean information. - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new AS400JDBCDataSourceBeanInfo()}; - //@B1D return additionalBeanInfo_; //@B0A - } - - - /** - * Returns the bean descriptor. - * @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - //@B1D return beanDescriptor_; //@B0A - } - - - /** - * Returns an image for the icon. - * @param icon The icon size and color. - * @return The image. - **/ - public Image getIcon(int icon) - { - Image image = null; - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("AS400JDBCConnectionPoolDataSource16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("AS400JDBCConnectionPoolDataSource32.gif"); - break; - } - return image; - } - - - //@B1D /** - //@B1D * Returns the property descriptors. - //@B1D * @return The property descriptors. - //@B1D **/ - //@B1D public PropertyDescriptor[] getPropertyDescriptors() - //@B1D { - //@B1D return propertyDescriptors_; - //@B1D } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCDataSource.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCDataSource.java deleted file mode 100644 index b0f683b8c..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCDataSource.java +++ /dev/null @@ -1,5200 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCDataSource.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.PrintWriter; -import java.io.Serializable; -import java.sql.Connection; -import java.sql.DriverPropertyInfo; -import java.sql.SQLException; -import java.util.Enumeration; -import java.util.Properties; -import java.util.Random; // @J3a -import javax.sql.DataSource; // JDBC2.0 std-ext -import javax.naming.NamingException; // JNDI -import javax.naming.Reference; // JNDI -import javax.naming.Referenceable; // JNDI -import javax.naming.StringRefAddr; // JNDI - -/** -* The AS400JDBCDataSource class represents a factory for IBM i database connections. -* -*

        The following is an example that creates an AS400JDBCDataSource object and creates a -* connection to the database. -* -*

        -* // Create a data source for making the connection. -* AS400JDBCDataSource datasource = new AS400JDBCDataSource("myAS400"); -* datasource.setUser("myUser"); -* datasource.setPassword("MYPWD"); - -* // Create a database connection to the system. -* Connection connection = datasource.getConnection(); -*
        -* -*

        The following example registers an AS400JDBCDataSource object with JNDI and then -* uses the object returned from JNDI to obtain a database connection. -*

        -* // Create a data source to the IBM i database. -* AS400JDBCDataSource dataSource = new AS400JDBCDataSource(); -* dataSource.setServerName("myAS400"); -* -* // Register the datasource with the Java Naming and Directory Interface (JNDI). -* Hashtable env = new Hashtable(); -* env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); -* Context context = new InitialContext(env); -* context.bind("jdbc/customer", dataSource); -* -* // Return an AS400JDBCDataSource object from JNDI and get a connection. -* AS400JDBCDataSource datasource = (AS400JDBCDataSource) context.lookup("jdbc/customer"); -* Connection connection = datasource.getConnection("myUser", "MYPWD"); -*
        -**/ -public class AS400JDBCDataSource -/*ifdef JDBC40 -extends ToolboxWrapper -endif */ - -implements DataSource, Referenceable, Serializable, Cloneable //@PDC 550 -{ - static final long serialVersionUID = 4L; - - - - /** - * Implementation notes: - * The properties listed in com.ibm.as400.access.JDProperties should also be included here. - **/ - - // Constants - private static final String DATABASE_NAME = "databaseName"; - private static final String DATASOURCE_NAME = "dataSourceName"; - private static final String DESCRIPTION = "description"; - private static final String SERVER_NAME = "serverName"; - private static final String USER = "userName"; - private static final String KEY_RING_NAME = "keyring"; // @F0A - private static final String PASSWORD = "pw"; // @F0A - private static final String KEY_RING_PASSWORD = "keyringpw"; // @F0A - private static final String SECURE = "secure"; // @F0A - private static final String SAVE_PASSWORD = "savepw"; // @F0A - private static final String PLAIN_TEXT_PASSWORD = "pwd"; //@K1A - private static final String TRUE_ = "true"; - private static final String FALSE_ = "false"; - private static final String TOOLBOX_DRIVER = "jdbc:as400:"; - private static final int MAX_THRESHOLD = 16777216; // Maximum threshold (bytes). @A3C, @A4A - static final int MAX_SCALE = 63; // Maximum decimal scale - - // socket options to store away in JNDI - private static final String SOCKET_KEEP_ALIVE = "soKeepAlive"; // @F1A - private static final String SOCKET_RECEIVE_BUFFER_SIZE = "soReceiveBufferSize"; // @F1A - private static final String SOCKET_SEND_BUFFER_SIZE = "soSendBufferSize"; // @F1A - private static final String SOCKET_LINGER = "soLinger"; // @F1A - private static final String SOCKET_TIMEOUT = "soTimeout"; // @F1A - private static final String SOCKET_LOGIN_TIMEOUT = "loginTimeout"; // @st3 - private static final String SOCKET_TCP_NO_DELAY = "soTCPNoDelay"; // @F1A - - // Data source properties. - transient private AS400 as400_; // AS400 object used to store and encrypt the password. - // @J2d private String databaseName_ = ""; // Database name. @A6C - private String dataSourceName_ = ""; // Data source name. @A6C - private String description_ = ""; // Data source description. @A6C - private JDProperties properties_; // IBM i connection properties. - private SocketProperties sockProps_; // IBM i socket properties @F1A - transient private PrintWriter writer_; // The EventLog print writer. @C7c - transient private EventLog log_; //@C7c - - private String serialServerName_; // system name used in serialization. - private String serialUserName_; // User used in serialization. - private String serialKeyRingName_; //@B4A // Key ring name used in serialization. - transient PropertyChangeSupport changes_; //@B0C - private boolean isSecure_ = false; //@B4A - - // Handles loading the appropriate resource bundle - // private static ResourceBundleLoader loader_; //@A9A - - - // In mod 5 support was added to optionally serialize the password with the - // rest of the properties. By default this is off. setSavePasswordWhenSerialized(true) - // must be called to save the password. By calling this the application takes - // responsibility for protecting the serialized bytes. The password is not saved in the - // clear. The password string is confused so that something more than just looking at the - // serialized bytes must be done to see the password. - private char[] serialPWBytes_ = null; //@J3a - private char[] serialKeyRingPWBytes_ = null; //@J3a - private boolean savePasswordWhenSerialized_ = false; //@J3a by default, don't save password!!!! - - /** - * The maximum storage space in megabytes, that can be used to execute a query. - **/ - public static final int MAX_STORAGE_LIMIT = 2147352578; // Maximum query storage limit @550 - - - /** - Start tracing the JDBC client. This is the same as setting - property "trace=true"; Note the constant is not public. - It is defined only to be compatible with ODBC - The numeric value of this constant is 1. - **/ - static final int TRACE_CLIENT = 1; // @j1a - - /** - Start the database monitor on the JDBC server job. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 2. - **/ - public static final int SERVER_TRACE_START_DATABASE_MONITOR = 2; // @j1a - - /** - Start debug on the JDBC server job. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 4. - **/ - public static final int SERVER_TRACE_DEBUG_SERVER_JOB = 4; // @j1a - - /** - Save the joblog when the JDBC server job ends. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 8. - **/ - public static final int SERVER_TRACE_SAVE_SERVER_JOBLOG = 8; // @j1a - - /** - Start job trace on the JDBC server job. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 16. - **/ - public static final int SERVER_TRACE_TRACE_SERVER_JOB = 16; // @j1a - - /** - Save SQL information. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 32. - **/ - public static final int SERVER_TRACE_SAVE_SQL_INFORMATION = 32; // @j1a - - - //@cc1 - /** - * CONCURRENTACCESS_NOT_SET - Indicates that currently committed behavior is not - * requested explicitly by the client. - */ - public final static int CONCURRENTACCESS_NOT_SET = 0; - //@cc1 - /** - * CONCURRENTACCESS_USE_CURRENTLY_COMMITTED - Indicates that the currently committed - * behavior is requested at the server. - */ - public final static int CONCURRENTACCESS_USE_CURRENTLY_COMMITTED = 1; - //@cc1 - /** - * CONCURRENTACCESS_WAIT_FOR_OUTCOME - Indicates that the readers will - * wait on the writers during lock contention. - */ - public final static int CONCURRENTACCESS_WAIT_FOR_OUTCOME = 2; - //@cc1 - /** - * CONCURRENTACCESS_SKIP_LOCKS - Indicates that the readers will - * skip locks. - */ - public final static int CONCURRENTACCESS_SKIP_LOCKS = 3; - - - /** - * Constructs a default AS400JDBCDataSource object. - **/ - public AS400JDBCDataSource() - { - initializeTransient(); - properties_ = new JDProperties(null, null); - sockProps_ = new SocketProperties(); - } - - /** - * Constructs an AS400JDBCDataSource object to the specified serverName. - * @param serverName The name of the IBM i system. - **/ - public AS400JDBCDataSource(String serverName) - { - this(); - - setServerName(serverName); - } - - /** - * Constructs an AS400JDBCDataSource object with the specified signon information. - * @param serverName The name of the IBM i system. - * @param user The user id. - * @param password The user password. - **/ - public AS400JDBCDataSource(String serverName, String user, String password) - { - this(); - - setServerName(serverName); - setUser(user); - setPassword(password); - } - - //@K1A - /** - * Constructs an AS400JDBCDataSource object with the specified AS400 object - * @param as400 The AS400 object - **/ - public AS400JDBCDataSource(AS400 as400) - { - this(); - - as400_ = as400; - if( as400 instanceof SecureAS400 ) - setSecure(true); - - } - - //@B4A - /** - * Constructs an AS400JDBCDataSource object with the specified signon information - * to use for SSL communications with the system. - * @param serverName The name of the IBM i system. - * @param user The user id. - * @param password The user password. - * @param keyRingName The key ring class name to be used for SSL communications with the system. - * @param keyRingPassword The password for the key ring class to be used for SSL communications with the system. - **/ - public AS400JDBCDataSource(String serverName, String user, String password, - String keyRingName, String keyRingPassword) - { - this(); - - setSecure(true); // @F0M - - try - { - as400_ = new SecureAS400(as400_); - ((SecureAS400)as400_).setKeyRingName(keyRingName, keyRingPassword); - } - catch (PropertyVetoException pe) - { /* will never happen */ - } - serialKeyRingName_ = keyRingName; - - // @J3 There is no get/set keyring name / password methods so they really aren't bean - // properties, but in v5r1 the keyring name is saved as if it is a property. Since - // the code saved the name we will also save the password. - serialKeyRingPWBytes_ = xpwConfuse(keyRingPassword); //@J3a // @F0M (changed from keyRingName to keyRingPassword) - - setServerName(serverName); - setUser(user); - setPassword(password); - } - - // @F0A - Added the following constructor to avoid creating some extra objects - /** - * Constructs an AS400JDBCDataSource object from the specified Reference object - * @param reference to retrieve the DataSource properties from - **/ - AS400JDBCDataSource(Reference reference) { - /* - * Implementation note: This method is called from AS400JDBCObjectFactory.getObjectInstance - */ - - // check to make sure our reference is not null - if (reference == null) - throw new NullPointerException("reference"); - - // set up property change support - changes_ = new PropertyChangeSupport(this); - - // set up the as400 object - if (((String)reference.get(SECURE).getContent()).equalsIgnoreCase(TRUE_)) { - isSecure_ = true; - as400_ = new SecureAS400(); - - // since the as400 object is secure, get the key ring info - serialKeyRingName_ = (String)reference.get(KEY_RING_NAME).getContent(); - if (reference.get(KEY_RING_PASSWORD) != null) - serialKeyRingPWBytes_ = ((String)reference.get(KEY_RING_PASSWORD).getContent()).toCharArray(); - else - serialKeyRingPWBytes_ = null; - - try { - if (serialKeyRingPWBytes_ != null && serialKeyRingPWBytes_.length > 0) - ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_, xpwDeconfuse(serialKeyRingPWBytes_)); - else - ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_); - } catch (PropertyVetoException pve) { /* Will never happen */ } - - } else { - isSecure_ = false; - as400_ = new AS400(); - } - - // must initialize the JDProperties so the property change checks dont get a NullPointerException - properties_ = new JDProperties(null, null); - - Properties properties = new Properties(); - sockProps_ = new SocketProperties(); - - Enumeration list = reference.getAll(); - while (list.hasMoreElements()) - { - StringRefAddr refAddr = (StringRefAddr)list.nextElement(); - String property = refAddr.getType(); - String value = (String)reference.get(property).getContent(); - - // constant identifiers were used to store in JNDI - // all of these were handled already so do not put them in the properties - if (property.equals(DATABASE_NAME)) - setDatabaseName(value); - else if (property.equals(DATASOURCE_NAME)) - setDataSourceName(value); - else if (property.equals(DESCRIPTION)) - setDescription(value); - else if (property.equals(SERVER_NAME)) - setServerName(value); - else if (property.equals(USER)) - setUser(value); - else if(property.equals(PLAIN_TEXT_PASSWORD)) { //@K1A - //set the password //@K1A - setPassword(value); //@K1A - } - else if (property.equals(PASSWORD)) { - if(reference.get(PLAIN_TEXT_PASSWORD) != null) //@K1A - { //@K1A - setPassword((String)reference.get(PLAIN_TEXT_PASSWORD).getContent()); //@K1A - } //@K1A - else //@K1A - { //@K1A - // get the password back from the serialized char[] - serialPWBytes_ = value.toCharArray(); - // decode the password and set it on the as400 - as400_.setPassword(xpwDeconfuse(serialPWBytes_)); - } //@K1A - } - else if (property.equals(SAVE_PASSWORD)) { - // set the savePasswordWhenSerialized_ flag - savePasswordWhenSerialized_ = value.equals(TRUE_) ? true : false; - } else if (property.equals(SECURE) || property.equals(KEY_RING_NAME) || property.equals(KEY_RING_PASSWORD)) { - // do nothing for these keys, they have already been handled - } - else if (property.equals(SOCKET_KEEP_ALIVE)) { - sockProps_.setKeepAlive((value.equals(TRUE_)? true : false)); - } - else if (property.equals(SOCKET_RECEIVE_BUFFER_SIZE)) { - sockProps_.setReceiveBufferSize(Integer.parseInt(value)); - } - else if (property.equals(SOCKET_SEND_BUFFER_SIZE)) { - sockProps_.setSendBufferSize(Integer.parseInt(value)); - } - else if (property.equals(SOCKET_LINGER)) { - sockProps_.setSoLinger(Integer.parseInt(value)); - } - else if (property.equals(SOCKET_TIMEOUT)) { - sockProps_.setSoTimeout(Integer.parseInt(value)); - } - else if (property.equals(SOCKET_LOGIN_TIMEOUT)) { //@st3 - sockProps_.setLoginTimeout(Integer.parseInt(value)); //@st3 - } - else if (property.equals(SOCKET_TCP_NO_DELAY)) { - sockProps_.setTcpNoDelay((value.equals(TRUE_)? true : false)); - } - else - { - properties.put(property, value); - } - } - properties_ = new JDProperties(properties, null); - - // get the prompt property and set it back in the as400 object - String prmpt = properties_.getString(JDProperties.PROMPT); - if (prmpt != null && prmpt.equalsIgnoreCase(FALSE_)) - setPrompt(false); - else if (prmpt != null && prmpt.equalsIgnoreCase(TRUE_)) - setPrompt(true); - - } - - /** - * Adds a PropertyChangeListener. The specified PropertyChangeListener's - * propertyChange method is called each time the value of any bound - * property is changed. - * @see #removePropertyChangeListener - * @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - changes_.addPropertyChangeListener(listener); - - as400_.addPropertyChangeListener(listener); - } - - //@PDA 550 - clone - /** - * Method to create a clone of AS400JDBCDataSource. This does a shallow - * copy, with the exception of JDProperties, which also gets cloned. - */ - public Object clone() - { - try - { - Trace.log(Trace.INFORMATION, "AS400JDBCDataSource.close()"); - AS400JDBCDataSource clone = (AS400JDBCDataSource) super.clone(); - clone.properties_ = (JDProperties) this.properties_.clone(); - return clone; - } catch (CloneNotSupportedException e) - { // This should never happen. - Trace.log(Trace.ERROR, e); - throw new UnsupportedOperationException("clone()"); - } - } - - /** - * Returns the level of database access for the connection. - * @return The access level. Valid values include: "all" (all SQL statements allowed), - * "read call" (SELECT and CALL statements allowed), and "read only" (SELECT statements only). - * The default value is "all". - **/ - public String getAccess() - { - return properties_.getString(JDProperties.ACCESS); - } - - // @C9 new method - /** - * Returns what behaviors of the Toolbox JDBC driver have been overridden. - * Multiple behaviors can be overridden in combination by adding - * the constants and passing that sum on the setBehaviorOverride() method. - * @return The behaviors that have been overridden. - *

        The return value is a combination of the following: - *

          - *
        • 1 - Do not throw an exception if Statement.executeQuery() or - * PreparedStatement.executeQuery() do not return a result set. - * Instead, return null for the result set. - *
        - * - **/ - public int getBehaviorOverride() - { - return properties_.getInt(JDProperties.BEHAVIOR_OVERRIDE); - } - - //@B2A - /** - * Returns the output string type of bidi data. See - * BidiStringType for more information and valid values. -1 will be returned - * if the value has not been set. - **/ - public int getBidiStringType() //@B3C - { - String value = properties_.getString(JDProperties.BIDI_STRING_TYPE); //@B3C - try - { //@B3A //@B3A - return Integer.parseInt (value); //@B3A - } //@B3A - catch (NumberFormatException nfe) // if value is "", that is, not set //@B3A - { //@B3A - return -1; //@B3A - } //@B3A - } - - - /** - * Returns the criteria for retrieving data from the system in - * blocks of records. Specifying a non-zero value for this property - * will reduce the frequency of communication to the system, and - * therefore increase performance. - * @return The block criteria. - *

        Valid values include: - *

          - *
        • 0 (no record blocking) - *
        • 1 (block if FOR FETCH ONLY is specified) - *
        • 2 (block if FOR UPDATE is specified) - The default value. - *
        - **/ - public int getBlockCriteria() - { - return properties_.getInt(JDProperties.BLOCK_CRITERIA); - } - - /** - * Returns the block size in kilobytes to retrieve from the system and - * cache on the client. This property has no effect unless the block criteria - * property is non-zero. Larger block sizes reduce the frequency of - * communication to the system, and therefore may increase performance. - * @return The block size in kilobytes. - *

        Valid values include: - *

          - *
        • 0 - *
        • 8 - *
        • 16 - *
        • 32 - The default value. - *
        • 64 - *
        • 128 - *
        • 256 - *
        • 512 - *
        - **/ - public int getBlockSize() - { - return properties_.getInt(JDProperties.BLOCK_SIZE); - } - - - /** - * Returns the database connection. - * @return The connection. - * @exception SQLException If a database error occurs. - **/ - public Connection getConnection() throws SQLException - { - //if the object was created with a keyring, or if the user asks for the object - //to be secure, clone a SecureAS400 object; otherwise, clone an AS400 object - if (isSecure_ || isSecure()) //@B4A //@C2C - return getConnection(new SecureAS400(as400_)); //@B4A - else //@B4A - return getConnection(new AS400(as400_)); - } - - - // @J3 Nothing to change here. The password is serialized only when passed on the c'tor - // or via the settors. That is, "bean properties" are affected only when using the - // c'tor specifying system, uid, and pwd, or the settors are used. The bean properties - // are not affected if this method is used, or if the default c'tor is used such - // that our sign-on dialog is used to get system, uid and pwd from the user. - /** - * Returns the database connection using the specified user and password. - * @param user The database user. - * @param password The database password. - * @return The connection - * @exception SQLException If a database error occurs. - **/ - public Connection getConnection(String user, String password) throws SQLException - { - // Validate the parameters. - //@pw3 Add way to get old behavior allowing "" (!but also need to allow new behavior of allowing null is/passwd so customers can slowly migrate) - String secureCurrentUser = SystemProperties.getProperty (SystemProperties.JDBC_SECURE_CURRENT_USER); //@pw3 - boolean isSecureCurrentUser = true; //@pw3 - //if system property or jdbc property is set to false then secure current user code is not used - //null value for system property means not specified...so true by default - if(((secureCurrentUser != null) && (Boolean.valueOf(secureCurrentUser).booleanValue() == false)) || !isSecureCurrentUser()) //@pw3 - isSecureCurrentUser = false; //@pw3 - - boolean forcePrompt = false; //@prompt - - //check if "". - if ("".equals(user)) //@pw1 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (this, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - if ("".equals(password)) //@pw1 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (this, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - - //Next, hack for nulls to work on IBM i - //New security: replace null with "" to mimic old behavior to allow null logons...disallowing "" above. - if (user == null) //@pw1 - user = ""; //@pw1 - if (password == null) //@pw1 - password = ""; //@pw1 - - //check for *current - if (user.compareToIgnoreCase("*CURRENT") == 0) //@pw1 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (this, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 - forcePrompt = true; //@prompt - } //@pw3 - - } //@pw1 - if (password.compareToIgnoreCase("*CURRENT") == 0) //@pw1 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (this, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - - AS400 as400Object; - - //if the object was created with a keyring, or if the user asks for the object - //to be secure, clone a SecureAS400 object; otherwise, clone an AS400 object - if (isSecure_ || isSecure()) //@C2A - { //@C2A - as400Object = new SecureAS400(getServerName(), user, password); //@C2A - } //@C2A - else - { //@C2A //@C2A - as400Object = new AS400(getServerName(), user, password); //@C2A - } //@C2A - - try //@PDA - { //@PDA - if(!as400_.isThreadUsed()) //@PDA - as400Object.setThreadUsed(false); //true by default //@PDA - } catch (PropertyVetoException pve) //@PDA - { /*ignore*/ //@PDA - } //@PDA - - //set gui available on the new object to false if user turned prompting off - try - { //@C2A - if (!isPrompt()) //@C2A - as400Object.setGuiAvailable(false); //@C2A - } //@C2A - catch (PropertyVetoException pve) //@C2A - { /*ignore*/ //@C2A - } //@C2A - - if(forcePrompt) //@prompt - as400Object.forcePrompt(); //@prompt - - return getConnection(as400Object); //@C2A - - //@C2D return getConnection(new AS400(getServerName(), user, password)); - } - - - /** - * Creates the database connection based on the signon and property information. - * @param as400 The AS400 object used to make the connection. - * @exception SQLException If a database error occurs. - **/ - private Connection getConnection(AS400 as400) throws SQLException - { - // Set the socket properties, if there are any, on the AS400 object before making a connection. - if(sockProps_ != null){ - as400.setSocketProperties(sockProps_); - }else - { - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "sockProps_: null"); - } - - AS400JDBCConnection connection = null; - - connection = new AS400JDBCConnection(); - - connection.setSystem(as400); - connection.setProperties(new JDDataSourceURL(TOOLBOX_DRIVER + "//" + as400.getSystemName()), properties_, as400); //@C1C - - log(ResourceBundleLoader.getText("AS400_JDBC_DS_CONN_CREATED")); //@A9C - return connection; - } - - //@cc1 - /** - * This method returns the concurrent access resolution setting. - * This method has no effect on IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @return The concurrent access resolution setting. Possible return valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public int getConcurrentAccessResolution () - { - return properties_.getInt(JDProperties.CONCURRENT_ACCESS_RESOLUTION); - } - - //@C8A - /** - * Returns the value of the cursor sensitivity property. If the resultSetType is - * ResultSet.TYPE_FORWARD_ONLY or ResultSet.TYPE_SCROLL_SENSITIVE, the value of this property - * will control what cursor sensitivity is requested from the database. If the resultSetType - * is ResultSet.TYPE_SCROLL_INSENSITIVE, this property will be ignored. - * @return The cursor sensitivity. - *

        Valid values include: - *

          - *
        • "asensitive" - *
        • "insensitive" - *
        • "sensitive" - *
        - * The default is "asensitive". - * - * This property is ignored when connecting to systems - * running OS/400 V5R1 and earlier. - **/ - public String getCursorSensitivity() - { - return properties_.getString(JDProperties.CURSOR_SENSITIVITY); - } - - - /** - * Returns the database name property. For more information see - * the documentation for the setDatabaseName() method in this class. - * @return The database name. - **/ - public String getDatabaseName() - { - // @J2d return databaseName_; - return properties_.getString(JDProperties.DATABASE_NAME); // @J2a - } - - /** - * Returns the data source name property. - * This property is used to name an underlying data source when connection pooling is used. - * @return The data source name. - **/ - public String getDataSourceName() - { - return dataSourceName_; - } - - /** - * Returns the IBM i date format used in date literals within SQL statements. - * @return The date format. - *

        Valid values include: - *

          - *
        • "mdy" - *
        • "dmy" - *
        • "ymd" - *
        • "usa" - *
        • "iso" - *
        • "eur" - *
        • "jis" - *
        • "julian" - *
        • "" (server job value) - default. - *
        - * The default is based on the server job. - **/ - public String getDateFormat() - { - return properties_.getString(JDProperties.DATE_FORMAT); - } - - /** - * Returns the IBM i date separator used in date literals within SQL statements. - * This property has no effect unless the "data format" property is set to: - * "julian", "mdy", "dmy", or "ymd". - * @return The date separator. - *

        Valid values include: - *

          - *
        • "/" (slash) - *
        • "-" (dash) - *
        • "." (period) - *
        • "," (comma) - *
        • " " (space) - *
        • "" (server job value) - default. - *
        - * The default value is based on the server job. - **/ - public String getDateSeparator() - { - return properties_.getString(JDProperties.DATE_SEPARATOR); - } - - //@DFA - /** - * Returns the decfloat rounding mode. - * @return The decfloat rounding mode. - *

        Valid values include: - *

          - *
        • "half even" - default - *
        • "half up" - *
        • "down" - *
        • "ceiling" - *
        • "floor" - *
        • "half down" - *
        • "up" - *
        - **/ - public String getDecfloatRoundingMode() - { - return properties_.getString(JDProperties.DECFLOAT_ROUNDING_MODE); - } - - /** - * Returns the IBM i decimal separator used in numeric literals within SQL statements. - * @return The decimal separator. - *

        Valid values include: - *

          - *
        • "." (period) - *
        • "," (comma) - *
        • "" (server job value) - default. - *
        - * The default value is based on the server job. - **/ - public String getDecimalSeparator() - { - return properties_.getString(JDProperties.DECIMAL_SEPARATOR); - } - - //@igwrn - /** - * Returns the ignore warnings property. - * Specifies a list of SQL states for which the driver should not create warning objects. - * @return The ignore warnings. - **/ - public String getIgnoreWarnings() - { - return properties_.getString(JDProperties.IGNORE_WARNINGS); - } - - - /** - * Returns the description of the data source. - * @return The description. - **/ - public String getDescription() - { - return description_; - } - - // @A2A - /** - * Returns the JDBC driver implementation. - * This property has no - * effect if the "secondary URL" property is set. - * This property cannot be set to "native" if the - * environment is not an IBM i Java Virtual Machine. - *

        Valid values include: - *

          - *
        • "toolbox" (use the IBM Toolbox for Java JDBC driver) - *
        • "native" (use the IBM Developer Kit for Java JDBC driver) - *
        - * The default value is "toolbox". - * Note: Not supported in a connection pool. - **/ - public String getDriver() - { - return properties_.getString(JDProperties.DRIVER); - } - - /** - * Returns the amount of detail for error messages originating from - * the IBM i system. - * @return The error message level. - * Valid values include: "basic" and "full". The default value is "basic". - **/ - public String getErrors() - { - return properties_.getString(JDProperties.ERRORS); - } - - /** - * Returns the IBM i system libraries to add to the server job's library list. - * The libraries are delimited by commas or spaces, and - * "*LIBL" may be used as a place holder for the server job's - * current library list. The library list is used for resolving - * unqualified stored procedure calls and finding schemas in - * DatabaseMetaData catalog methods. If "*LIBL" is not specified, - * the specified libraries will replace the server job's current library list. - * @return The library list. - **/ - public String getLibraries() - { - return properties_.getString(JDProperties.LIBRARIES); - } - - /** - * Returns the maximum LOB (large object) size in bytes that - * can be retrieved as part of a result set. LOBs that are larger - * than this threshold will be retrieved in pieces using extra - * communication to the system. Larger LOB thresholds will reduce - * the frequency of communication to the system, but will download - * more LOB data, even if it is not used. Smaller LOB thresholds may - * increase frequency of communication to the system, but will only - * download LOB data as it is needed. - * @return The lob threshold. Valid range is 0-16777216. - * The default value is 32768. - **/ - public int getLobThreshold() - { - return properties_.getInt(JDProperties.LOB_THRESHOLD); - } - - /** - * Returns the timeout value in seconds. - * Note: This value is not used or supported. - * The timeout value is determined by the IBM i system. - * @return the maximum time in seconds that this data source can wait while attempting to connect to a database. - **/ - public int getLoginTimeout() - { - return properties_.getInt(JDProperties.LOGIN_TIMEOUT); - } - - /** - * Returns the log writer for this data source. - * @return The log writer for this data source. - * @exception SQLException If a database error occurs. - **/ - public PrintWriter getLogWriter() throws SQLException - { - return writer_; - } - - //@PDA - /** - * Indicates how to retrieve DatabaseMetaData. - * If set to 0, database metadata will be retrieved through the ROI data flow. - * If set to 1, database metadata will be retrieved by calling system stored procedures. - * The methods that currently are available through stored procedures are: - * getColumnPrivileges - * @return the metadata setting. - * The default value is 1. - **/ - public int getMetaDataSource() - { - return properties_.getInt(JDProperties.METADATA_SOURCE); - } - - //@dup - /** - * Indicates how to retrieve DatabaseMetaData. - * If set to 0, database metadata will be retrieved through the ROI data flow. - * If set to 1, database metadata will be retrieved by calling system stored procedures. - * The methods that currently are available through stored procedures are: - * getColumnPrivileges - * @return the metadata setting. - * The default value is 1. - * Note: this method is the same as getMetaDataSource() so that it corresponds to the connection property name - **/ - public int getMetadataSource() - { - return getMetaDataSource(); - } - - /** - * Returns the naming convention used when referring to tables. - * @return The naming convention. Valid values include: "sql" (e.g. schema.table) - * and "system" (e.g. schema/table). The default value is "sql". - **/ - public String getNaming() - { - return properties_.getString(JDProperties.NAMING); - } - - /** - * Returns the base name of the SQL package. Note that only the - * first six characters are used to generate the name of the SQL package on the system. - * This property has no effect unless - * the extended dynamic property is set to true. In addition, this property - * must be set if the extended dynamic property is set to true. - * @return The base name of the SQL package. - **/ - public String getPackage() - { - return properties_.getString(JDProperties.PACKAGE); - } - - /** - * Returns the type of SQL statement to be stored in the SQL package. This can - * be useful to improve the performance of complex join conditions. This - * property has no effect unless the extended dynamic property is set to true. - * @return The type of SQL statement. - * Valid values include: "default" (only store SQL statements with parameter - * markers in the package) and "select" (store all SQL SELECT statements - * in the package). The default value is "default". - **/ - public String getPackageCriteria() - { - return properties_.getString(JDProperties.PACKAGE_CRITERIA); - } - - /** - * Returns the action to take when SQL package errors occur. When an SQL package - * error occurs, the driver will optionally throw an SQLException or post a - * warning to the Connection, based on the value of this property. This property - * has no effect unless the extended dynamic property is set to true. - * @return The action to take when SQL errors occur. - * Valid values include: "exception", "warning", and "none". The default value is "warning". - **/ - public String getPackageError() - { - return properties_.getString(JDProperties.PACKAGE_ERROR); - } - /** - * Returns the library for the SQL package. This property has no effect unless - * the extended dynamic property is set to true. - * @return The SQL package library. The default package library is "QGPL". - **/ - public String getPackageLibrary() - { - return properties_.getString(JDProperties.PACKAGE_LIBRARY); - } - - /** - * Returns the name of the proxy server. - * @return The proxy server. - **/ - public String getProxyServer() - { - return properties_.getString(JDProperties.PROXY_SERVER); - } - - /** - * Returns the Reference object for the data source object. - * This is used by JNDI when bound in a JNDI naming service. - * Contains the information necessary to reconstruct the data source - * object when it is later retrieved from JNDI via an object factory. - * - * @return A Reference object of the data source object. - * @exception NamingException If a naming error occurs in resolving the object. - **/ - public Reference getReference() throws NamingException - { - - Trace.log(Trace.INFORMATION, "AS400JDBCDataSource.getReference"); - - Reference ref = new Reference(this.getClass().getName(), - "com.ibm.as400.access.AS400JDBCObjectFactory", - null); - - // Add the JDBC properties. - DriverPropertyInfo[] propertyList = properties_.getInfo(); - for (int i=0; i< propertyList.length; i++) - { - if (propertyList[i].value != null) - ref.add(new StringRefAddr(propertyList[i].name, propertyList[i].value)); - } - - // Add the Socket options - if (sockProps_.keepAliveSet_) ref.add(new StringRefAddr(SOCKET_KEEP_ALIVE, (sockProps_.keepAlive_ ? "true" : "false"))); - if (sockProps_.receiveBufferSizeSet_) ref.add(new StringRefAddr(SOCKET_RECEIVE_BUFFER_SIZE, Integer.toString(sockProps_.receiveBufferSize_))); - if (sockProps_.sendBufferSizeSet_) ref.add(new StringRefAddr(SOCKET_SEND_BUFFER_SIZE, Integer.toString(sockProps_.sendBufferSize_))); - if (sockProps_.soLingerSet_) ref.add(new StringRefAddr(SOCKET_LINGER, Integer.toString(sockProps_.soLinger_))); - if (sockProps_.soTimeoutSet_) ref.add(new StringRefAddr(SOCKET_TIMEOUT, Integer.toString(sockProps_.soTimeout_))); - if (sockProps_.loginTimeoutSet_) ref.add(new StringRefAddr(SOCKET_LOGIN_TIMEOUT, Integer.toString(sockProps_.loginTimeout_))); //@st3 - if (sockProps_.tcpNoDelaySet_) ref.add(new StringRefAddr(SOCKET_TCP_NO_DELAY, (sockProps_.tcpNoDelay_ ? "true" : "false"))); - - // Add the data source properties. (unique constant identifiers for storing in JNDI). - if (getDatabaseName() != null) - ref.add(new StringRefAddr(DATABASE_NAME, getDatabaseName())); - if (getDataSourceName() != null) - ref.add(new StringRefAddr(DATASOURCE_NAME, getDataSourceName())); - if (getDescription() != null) - ref.add(new StringRefAddr(DESCRIPTION, getDescription())); - ref.add(new StringRefAddr(SERVER_NAME, getServerName())); - ref.add(new StringRefAddr(USER, getUser())); - ref.add(new StringRefAddr(KEY_RING_NAME, serialKeyRingName_)); // @F0A - if (savePasswordWhenSerialized_) { // @F0A - ref.add(new StringRefAddr(PASSWORD, new String(serialPWBytes_))); // @F0A - if (serialKeyRingPWBytes_ != null) // @F0A - ref.add(new StringRefAddr(KEY_RING_PASSWORD, new String(serialKeyRingPWBytes_))); // @F0A - else // @F0A - ref.add(new StringRefAddr(KEY_RING_PASSWORD, null)); // @F0A - } // @F0A - ref.add(new StringRefAddr(SECURE, (isSecure_ ? TRUE_ : FALSE_))); // @F0A - ref.add(new StringRefAddr(SAVE_PASSWORD, (savePasswordWhenSerialized_ ? TRUE_ : FALSE_))); // @F0A - - return ref; - } - - /** - * Returns the source of the text for REMARKS columns in ResultSets returned - * by DatabaseMetaData methods. - * @return The text source. - * Valid values include: "sql" (SQL object comment) and "system" (IBM i object description). - * The default value is "system". - **/ - public String getRemarks() - { - return properties_.getString(JDProperties.REMARKS); - } - - /** - * Returns the secondary URL. - * @return The secondary URL. - **/ - public String getSecondaryUrl() - { - return properties_.getString(JDProperties.SECONDARY_URL); - } - - //@dup - /** - * Returns the secondary URL. - * @return The secondary URL. - * Note: this method is the same as setSecondaryUrl() so that it corresponds to the connection property name - **/ - public String getSecondaryURL() - { - return getSecondaryUrl(); - } - - - /** - * Returns the name of the IBM i system. - * @return The system name. - **/ - public String getServerName() - { - return as400_.getSystemName(); - } - - - // @j1 new method - /** - * Returns the level of tracing started on the JDBC server job. - * If tracing is enabled, tracing is started when - * the client connects to the system and ends when the connection - * is disconnected. Tracing must be started before connecting to - * the system since the client enables system tracing only at connect time. - * Trace data is collected in spooled files on the system. Multiple - * levels of tracing can be turned on in combination by adding - * the constants and passing that sum on the set method. For example, - *
        -    *  dataSource.setServerTraceCategories(AS400JDBCDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
        -    *  
        - * @return The tracing level. - *

        The value is a combination of the following: - *

          - *
        • SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job. - * The numeric value of this constant is 2. - *
        • SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job. - * The numeric value of this constant is 4. - *
        • SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends. - * The numeric value of this constant is 8. - *
        • SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job. - * The numeric value of this constant is 16. - *
        • SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information. - * The numeric value of this constant is 32. - *
        - * - *

        - * Tracing the JDBC server job will use significant amounts of system resources. - * Additional processor resource is used to collect the data, and additional - * storage is used to save the data. Turn on tracing only to debug - * a problem as directed by IBM service. - * - **/ - public int getServerTraceCategories() - { - return properties_.getInt(JDProperties.TRACE_SERVER); - } - - //@dup - /** - * Returns the level of tracing started on the JDBC server job. - * If tracing is enabled, tracing is started when - * the client connects to the system and ends when the connection - * is disconnected. Tracing must be started before connecting to - * the system since the client enables system tracing only at connect time. - * Trace data is collected in spooled files on the system. Multiple - * levels of tracing can be turned on in combination by adding - * the constants and passing that sum on the set method. For example, - *

        -     *  dataSource.setServerTraceCategories(AS400JDBCDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
        -     *  
        - * @return The tracing level. - *

        The value is a combination of the following: - *

          - *
        • SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job. - * The numeric value of this constant is 2. - *
        • SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job. - * The numeric value of this constant is 4. - *
        • SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends. - * The numeric value of this constant is 8. - *
        • SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job. - * The numeric value of this constant is 16. - *
        • SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information. - * The numeric value of this constant is 32. - *
        - * - *

        - * Tracing the JDBC server job will use significant amounts of system resources. - * Additional processor resource is used to collect the data, and additional - * storage is used to save the data. Turn on tracing only to debug - * a problem as directed by IBM service. - * - * Note: this method is the same as getServerTraceCategories() so that it corresponds to the connection property name - **/ - public int getServerTrace() - { - return getServerTraceCategories(); - } - - //@STIMEOUT - /** - * Gets the socket timeout option in milliseconds. - * @return The value of the socket timeout option. - **/ - public int getSocketTimeout() - { - return getSoTimeout(); - } - - /** - * Returns how the system sorts records before sending them to the - * client. - * @return The sort value. - *

        Valid values include: - *

          - *
        • "hex" (base the sort on hexadecimal values) - *
        • "language" (base the sort on the language set in the sort language property) - *
        • "table" (base the sort on the sort sequence table set in the sort table property) - *
        - * The default value is "hex". - **/ - public String getSort() - { - return properties_.getString(JDProperties.SORT); - } - - /** - * Returns the three-character language id to use for selection of a sort sequence. - * @return The three-character language id. - * The default value is ENU. - **/ - public String getSortLanguage() - { - return properties_.getString(JDProperties.SORT_LANGUAGE); - } - - /** - * Returns the library and file name of a sort sequence table stored on the - * system. - * @return The qualified sort table name. - **/ - public String getSortTable() - { - return properties_.getString(JDProperties.SORT_TABLE); - } - - /** - * Returns how the system treats case while sorting records. - * @return The sort weight. - * Valid values include: "shared" (upper- and lower-case characters are sorted as the - * same character) and "unique" (upper- and lower-case characters are sorted as - * different characters). The default value is "shared". - **/ - public String getSortWeight() - { - return properties_.getString(JDProperties.SORT_WEIGHT); - } - - /** - * Returns the time format used in time literals with SQL statements. - * @return The time format. - *

        Valid values include: - *

          - *
        • "hms" - *
        • "usa" - *
        • "iso" - *
        • "eur" - *
        • "jis" - *
        • "" (server job value) - default. - *
        - * The default value is based on the server job. - **/ - public String getTimeFormat() - { - return properties_.getString(JDProperties.TIME_FORMAT); - } - - /** - * Returns the time separator used in time literals within SQL - * statements. - * @return The time separator. - *

        Valid values include: - *

          - *
        • ":" (colon) - *
        • "." (period) - *
        • "," (comma) - *
        • " " (space) - *
        • "" (server job value) - default. - *
        - * The default value is based on the server job. - **/ - public String getTimeSeparator() - { - return properties_.getString(JDProperties.TIME_SEPARATOR); - } - - - /** - * Returns the system's transaction isolation. - * @return The transaction isolation level. - *

        Valid values include: - *

          - *
        • "none" - *
        • "read uncommitted" - The default value. - *
        • "read committed" - *
        • "repeatable read" - *
        • "serializable" - *
        - **/ - public String getTransactionIsolation() - { - return properties_.getString(JDProperties.TRANSACTION_ISOLATION); - } - - - // @J3 No change needeadd code here. UID already properly serialized - /** - * Returns the database user property. - * @return The user. - **/ - public String getUser() - { - return as400_.getUserId(); - } - - // @K3A - /** - * Returns the QAQQINI library name. - * @return The QAQQINI library name. - **/ - public String getQaqqiniLibrary() - { - return properties_.getString(JDProperties.QAQQINILIB); - } - - //@dup - /** - * Returns the QAQQINI library name. - * @return The QAQQINI library name. - * Note: this method is the same as getQaqqiniLibrary() so that it corresponds to the connection property name - **/ - public String getQaqqinilib() - { - return getQaqqiniLibrary(); - } - - - //@540 - /** - * Returns the goal the IBM i system should use with optimization of queries. - * @return the goal the IBM i system should use with optimization of queries. - *

        Valid values include: - *

          - *
        • 0 = Optimize query for first block of data (*ALLIO) when extended dynamic packages are used; Optimize query for entire result set (*FIRSTIO) when packages are not used
        • - *
        • 1 = Optimize query for first block of data (*FIRSTIO)
        • - *
        • 2 = Optimize query for entire result set (*ALLIO)
        • - *
        - * The default value is 0. - **/ - public int getQueryOptimizeGoal() - { - return properties_.getInt(JDProperties.QUERY_OPTIMIZE_GOAL); - } - - //@550 - /** - * Returns the storage limit in megabytes, that should be used for statements executing a query in a connection. - * Note, this setting is ignored when running to i5/OS V5R4 or earlier - * You must have *JOBCTL special authority to use query storage limit with Version 6 Release 1 of IBM i. - *

        Valid values are -1 to MAX_STORAGE_LIMIT megabytes. - * The default value is -1 meaning there is no limit. - **/ - public int getQueryStorageLimit() - { - return properties_.getInt(JDProperties.QUERY_STORAGE_LIMIT); - } - - //@540 - /** - * Indicates whether lock sharing is allowed for loosely coupled transaction branches. - * @return the lock sharing setting. - *

        Valid values include: - *

          - *
        • 0 = Locks cannot be shared
        • - *
        • 1 = Locks can be shared
        • - *
        - * The default value is 0. - **/ - public int getXALooselyCoupledSupport() - { - return properties_.getInt(JDProperties.XA_LOOSELY_COUPLED_SUPPORT); - } - - /** - * Initializes the transient data for object de-serialization. - **/ - private void initializeTransient() - { - Trace.log(Trace.INFORMATION, "AS400JDBCDataSource.initializeTransient"); - - changes_ = new PropertyChangeSupport(this); - - if (isSecure_) //@B4A - as400_ = new SecureAS400(); //@B4A - else //@B4A - as400_ = new AS400(); - - // Reinitialize the serverName, user, password, keyRingName, etc. - if (serialServerName_ != null) - setServerName(serialServerName_); - - if (serialUserName_ != null) - { // @J3a - setUser(serialUserName_); - - if ((serialPWBytes_ != null) && // @J3a - (serialPWBytes_.length > 0)) // @J3a - { // @J3a - as400_.setPassword(xpwDeconfuse(serialPWBytes_)); // @J3a - } // @J3a - } - - try - { - if (serialKeyRingName_ != null && isSecure_) //@B4A - { //@J3a - if ((serialKeyRingPWBytes_ != null) && //@J3a - (serialKeyRingPWBytes_.length > 0)) //@J3a - { //@J3a - String keyRingPassword = xpwDeconfuse(serialKeyRingPWBytes_); // @J3a - ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_, keyRingPassword); //@J3A - } //@J3a - else - { //@J3a //@J3a - ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_); //@B4A - } //@J3a - } //@J3a - } - catch (PropertyVetoException pve) - { /* Will never happen */ - } - - // @J4 Make sure the prompt flag is correctly de-serialized. The problem was - // the flag would get serialized with the rest of the properties - // (in the properties_ object), but the flag would never be applied - // to the AS400 object when de-serialzed. De-serialization puts the - // flag back in properties_ but that does no good unless the value - // is passed on to the AS400 object. That is what the new code does. - // There is no affect on normal "new" objects since at the time this - // method is called properties_ is null. - try - { //@J4A //@J4A - if (properties_ != null) //@J4A - if (!isPrompt()) //@J4A - as400_.setGuiAvailable(false); //@J4A - } //@J4A - catch (PropertyVetoException pve) //@J4A - { /* Will never happen */ //@J4A - } //@J4A - - } - - //@KBA - /** - * Indicates whether true auto commit support is used. - * @return true if true auto commit support is used; false otherwise. - * The default value is false. - **/ - public boolean isTrueAutoCommit() - { - return properties_.getBoolean(JDProperties.TRUE_AUTO_COMMIT); //@true - } - - //@dup - /** - * Indicates whether true auto commit support is used. - * @return true if true auto commit support is used; false otherwise. - * The default value is false. - * Note: this method is the same as isTrueAutoCommit() so that it corresponds to the connection property name - **/ - public boolean isTrueAutocommit() - { - return isTrueAutoCommit(); - } - - - //@K54 - /** - * Indicates whether variable-length fields are compressed. - * @return true if variable-length fields are compressed; false otherwise. - * The default value is true. - **/ - public boolean isVariableFieldCompression() - { - return properties_.getBoolean(JDProperties.VARIABLE_FIELD_COMPRESSION); - } - - //@AC1 - /** - * Returns whether auto-commit mode is the default connection mode for new connections. - * @return Auto commit. - * The default value is true. - **/ - public boolean isAutoCommit() - { - return properties_.getBoolean(JDProperties.AUTO_COMMIT); - } - - //@CE1 - /** - * Returns whether commit or rollback throws SQLException when autocommit is enabled. - * @return Autocommit Exception. - * The default value is false. - **/ - public boolean isAutocommitException() - { - return properties_.getBoolean(JDProperties.AUTOCOMMIT_EXCEPTION); - } - - //@K24 - /** - * Indicates whether bidi implicit reordering is used. - * @return true if bidi implicit reordering is used; false otherwise. - * The default value is true. - **/ - public boolean isBidiImplicitReordering() - { - return properties_.getBoolean(JDProperties.BIDI_IMPLICIT_REORDERING); - } - - //@K24 - /** - * Indicates whether bidi numeric ordering round trip is used. - * @return true if bidi numeric ordering round trip is used; false otherwise. - * The default value is false. - **/ - public boolean isBidiNumericOrdering() - { - return properties_.getBoolean(JDProperties.BIDI_NUMERIC_ORDERING); - } - - /** - * Indicates whether a big decimal value is returned. - * @return true if a big decimal is returned; false otherwise. - * The default value is true. - **/ - public boolean isBigDecimal() - { - return properties_.getBoolean(JDProperties.BIG_DECIMAL); - } - - /** - * Indicates whether the cursor is held. - * @return true if the cursor is held; false otherwise. - * The default value is true. - **/ - public boolean isCursorHold() - { - return properties_.getBoolean(JDProperties.CURSOR_HOLD); - } - - /** - * Indicates whether data compression is used. - * @return true if data compression is used; false otherwise. - * The default value is true. - **/ - public boolean isDataCompression() - { - return properties_.getBoolean(JDProperties.DATA_COMPRESSION); - } - - /** - * Indicates whether data truncation is used. - * @return true if data truncation is used; false otherwise. - * The default value is true. - **/ - public boolean isDataTruncation() - { - return properties_.getBoolean(JDProperties.DATA_TRUNCATION); - } - - /** - * Indicates whether extended dynamic support is used. Extended dynamic - * support provides a mechanism for caching dynamic SQL statements on - * the system. The first time a particular SQL statement is prepared, it is - * stored in an SQL package on the system. - * If the package does not exist, it will be automatically created. - * On subsequent prepares of the - * same SQL statement, the system can skip a significant part of the - * processing by using information stored in the SQL package. - * @return true if extended dynamic support is used; false otherwise. - * The default value is not to use extended dynamic support. - **/ - public boolean isExtendedDynamic() - { - return properties_.getBoolean(JDProperties.EXTENDED_DYNAMIC); - } - - - // @C3A - /** - * Indicates whether the driver should request extended metadata from the - * IBM i system. If this property is set to true, the accuracy of the information - * that is returned from ResultSetMetaData methods getColumnLabel(int), - * isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased. - * In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this - * property set to true. However, performance will be slower with this - * property on. Leave this property set to its default (false) unless you - * need more specific information from those methods. - * - * For example, without this property turned on, isSearchable(int) will - * always return true even though the correct answer may be false because - * the driver does not have enough information from the system to make a judgment. Setting - * this property to true forces the driver to get the correct data from the IBM i system. - * - * @return true if extended metadata will be requested; false otherwise. - * The default value is false. - **/ - - public boolean isExtendedMetaData() - { - return properties_.getBoolean(JDProperties.EXTENDED_METADATA); - } - - //@dup - /** - * Indicates whether the driver should request extended metadata from the - * IBM i system. If this property is set to true, the accuracy of the information - * that is returned from ResultSetMetaData methods getColumnLabel(int), - * isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased. - * In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this - * property set to true. However, performance will be slower with this - * property on. Leave this property set to its default (false) unless you - * need more specific information from those methods. - * - * For example, without this property turned on, isSearchable(int) will - * always return true even though the correct answer may be false because - * the driver does not have enough information from the system to make a judgment. Setting - * this property to true forces the driver to get the correct data from the IBM i system. - * - * @return true if extended metadata will be requested; false otherwise. - * The default value is false. - * Note: this method is the same as isExtendedMetaData() so that it corresponds to the connection property name - **/ - - public boolean isExtendedMetadata() - { - return isExtendedMetaData(); - } - - - // @W1a - /** - * Indicates whether the IBM i system fully opens a file when performing a query. - * By default the system optimizes opens so they perform better. In - * certain cases an optimized open will fail. In some - * cases a query will fail when a database performance monitor - * is turned on even though the same query works with the monitor - * turned off. In this case set the full open property to true. - * This disables optimization on the system. - * @return true if files are fully opened; false otherwise. - * The default value is false. - **/ - public boolean isFullOpen() - { - return properties_.getBoolean(JDProperties.FULL_OPEN); - } - - //@dmy - /** - * Indicates whether the temporary fix for JVM 1.6 is enabled. - * @return true if enabled; false otherwise. - * The default value is true. - **/ - public boolean isJvm16Synchronize() - { - return properties_.getBoolean(JDProperties.JVM16_SYNCHRONIZE); - } - - // @A1A - /** - * Indicates whether to delay closing cursors until subsequent requests. - * @return true to delay closing cursors until subsequent requests; false otherwise. - * The default value is false. - **/ - public boolean isLazyClose() - { - return properties_.getBoolean(JDProperties.LAZY_CLOSE); - } - - //@KBL - /** - * Indicates whether input locators are of type hold. - * @return true if input locators are of type hold; false otherwise. - * The default value is true. - **/ - public boolean isHoldInputLocators() - { - return properties_.getBoolean(JDProperties.HOLD_LOCATORS); - } - - /** - * Indicates whether to add newly prepared statements to the - * SQL package specified on the "package" property. This property - * has no effect unless the extended dynamic property is set to true; - * @return true If newly prepared statements should be added to the SQL package specified - * on the "package" property; false otherwise. - * The default value is true. - **/ - public boolean isPackageAdd() - { - return properties_.getBoolean(JDProperties.PACKAGE_ADD); - } - - /** - * Indicates whether a subset of the SQL package information is cached in client memory. - * Caching SQL packages locally - * reduces the amount of communication to the IBM i system for prepares and describes. This - * property has no effect unless the extended dynamic property is set to true. - * @return true if caching is used; false otherwise. - * The defalut value is false. - **/ - public boolean isPackageCache() - { - return properties_.getBoolean(JDProperties.PACKAGE_CACHE); - } - - //@C6D Deprecated method. - /** - * Indicates whether SQL packages are cleared when they become full. This method - * has been deprecated. Package clearing and the decision for the - * threshold where package clearing is needed is now handled - * automatically by the database. - * @return Always false. This method is deprecated. - * @deprecated - **/ - public boolean isPackageClear() - { - //@C6D return properties_.getBoolean(JDProperties.PACKAGE_CLEAR); - return false; //@C6A - } - - /** - * Indicates whether data is prefetched upon executing a SELECT statement. - * This will increase performance when accessing the initial rows in the result set. - * @return If prefetch is used; false otherwise. - * The default value is prefetch data. - **/ - public boolean isPrefetch() - { - return properties_.getBoolean(JDProperties.PREFETCH); - } - - /** - * Indicates whether the user is prompted if a user name or password is - * needed to connect to the IBM i system. If a connection can not be made - * without prompting the user, and this property is set to false, then an - * attempt to connect will fail throwing an exception. - * @return true if the user is prompted for signon information; false otherwise. - * The default value is false. - **/ - public boolean isPrompt() - { - return properties_.getBoolean(JDProperties.PROMPT); - } - - //@K94 - /** - * Indicates whether the cursor is held after a rollback. - * @return true if the cursor is held; false otherwise. - * The default value is false. - **/ - public boolean isRollbackCursorHold() - { - return properties_.getBoolean(JDProperties.ROLLBACK_CURSOR_HOLD); - } - - //@KBL - /** - * Indicates whether statements remain open until a transaction boundary when autocommit is off and they - * are associated with Lob locators. - * @return true if statements are only closed at transaction boundaries; false otherwise. - * The default value is false. - **/ - public boolean isHoldStatements() - { - return properties_.getBoolean(JDProperties.HOLD_STATEMENTS); - } - - // @J3 new method - /** - * Indicates whether the password is saved locally with the rest of - * the properties when this data source object is serialized. - *

        - * If the password is saved, it is up to the application to protect - * the serialized form of the object because it contains all necessary - * information to connect to the IBM i system. The default is false. It - * is a security risk to save the password with the rest of the - * properties so by default the password is not saved. If the programmer - * chooses to accept this risk, call setSavePasswordWhenSerialized(true) - * to force the Toolbox to save the password with the other properties - * when the data source object is serialized. - * @return true if the password is saved with the rest of the properties when the - * data source object is serialized; false otherwise. - * The default value is false. - **/ - public boolean isSavePasswordWhenSerialized() - { - return savePasswordWhenSerialized_; - } - - - - - - /** - * Indicates whether a Secure Socket Layer (SSL) connection is used to communicate - * with the IBM i system. SSL connections are only available when connecting to systems - * at V4R4 or later. - * @return true if Secure Socket Layer connection is used; false otherwise. - * The default value is false. - **/ - public boolean isSecure() - { - return properties_.getBoolean(JDProperties.SECURE); - } - - //@pw3 - /** - * Returns the secure current user setting. True indicates to disallow "" and *current for user name and password. - * @return The secure current user setting. - **/ - public boolean isSecureCurrentUser() - { - return properties_.getBoolean(JDProperties.SECURE_CURRENT_USER); - } - - /** - * Indicates whether a thread is used. - * @return true if a thread is used; false otherwise. - * The default value is true. - **/ - public boolean isThreadUsed() - { - return properties_.getBoolean(JDProperties.THREAD_USED); - } - - /** - * Indicates whether trace messages should be logged. - * @return true if trace message are logged; false otherwise. - * The default value is false. - **/ - public boolean isTrace() - { - return properties_.getBoolean(JDProperties.TRACE); - } - - /** - * Indicates whether binary data is translated. If this property is set - * to true, then BINARY and VARBINARY fields are treated as CHAR and - * VARCHAR fields. - * @return true if binary data is translated; false otherwise. - * The default value is false. - **/ - public boolean isTranslateBinary() - { - return properties_.getBoolean(JDProperties.TRANSLATE_BINARY); - } - - //@PDA - /** - * Indicates how Boolean objects are interpreted when setting the value - * for a character field/parameter using the PreparedStatement.setObject(), - * CallableStatement.setObject() or ResultSet.updateObject() methods. Setting the - * property to "true", would store the Boolean object in the character field as either - * "true" or "false". Setting the property to "false", would store the Boolean object - * in the character field as either "1" or "0". - * @return true if boolean data is translated; false otherwise. - * The default value is true. - **/ - public boolean isTranslateBoolean() - { - return properties_.getBoolean(JDProperties.TRANSLATE_BOOLEAN); - } - - - /** - * Indicates whether blocking is used for update and delete operations - * @return true if enabled; false otherwise. - * The default value is false. - **/ - public boolean isUseBlockUpdate() - { - return properties_.getBoolean(JDProperties.DO_UPDATE_DELETE_BLOCKING); - } - - - /** - * Logs a message to the event log. - * @param message The message to log. - **/ - void log(String message) - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, message); - - if (log_ != null) - log_.log(message); - } - - /** - * Logs an exception and message to the event log. - * @param property The property to log. - * @param value The property value to log. - **/ - private void logProperty(String property, String value) - { - if (Trace.isTraceOn()) - JDTrace.logProperty (this, property, value); - - //@A8D if (log_ != null) - //@A8D log_.log(property + ": " + value); - } - - /** - * Deserializes and initializes transient data. - * @exception ClassNotFoundException If the class cannot be found. - * @exception IOException If an I/O exception occurs. - **/ - private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException - { - in.defaultReadObject(); - initializeTransient(); - } - - /** - * Removes the PropertyChangeListener. - * If the PropertyChangeListener is not in the list, nothing is done. - * @param listener The PropertyChangeListener. - * @see #addPropertyChangeListener - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - changes_.removePropertyChangeListener(listener); - - as400_.removePropertyChangeListener(listener); //@K1C changed to removePropertyChangeListener instead of addPropertyChangeListener - } - - /** - * Sets the level of database access for the connection. - * @param access The access level. - *

        Valid values include: - *

          - *
        • "all" (all SQL statements allowed) - *
        • "read call" (SELECT and CALL statements allowed) - *
        • "read only" (SELECT statements only) - *
        - * The default value is "all". - **/ - public void setAccess(String access) - { - String property = "access"; - - if (access == null) - throw new NullPointerException(property); - validateProperty(property, access, JDProperties.ACCESS); - - String old = getAccess(); - properties_.setString(JDProperties.ACCESS, access); - - changes_.firePropertyChange(property, old, access); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + access); //@A8C - } - - //@AC1 - /** - * Sets whether auto-commit mode is the default connection mode for new connections. - * @param value - * The default value is true. - **/ - public void setAutoCommit(boolean value) - { - String property = "autoCommit"; - Boolean oldValue = new Boolean(isAutoCommit()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.AUTO_COMMIT, TRUE_); - else - properties_.setString(JDProperties.AUTO_COMMIT, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - //@CE1 - /** - * Sets whether commit or rollback throws SQLException when autocommit is enabled. - * @param value - * The default value is false. - **/ - public void setAutocommitException(boolean value) - { - String property = "autocommitException"; - Boolean oldValue = new Boolean(isAutocommitException()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.AUTOCOMMIT_EXCEPTION, TRUE_); - else - properties_.setString(JDProperties.AUTOCOMMIT_EXCEPTION, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - //@KBA - /** - * Sets whether true auto commit support is used. - * @param value true if true auto commit support should be used; false otherwise. - * The default value is false. - **/ - public void setTrueAutoCommit(boolean value) - { - String property = "trueAutoCommit"; - Boolean oldValue = new Boolean(isTrueAutoCommit()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.TRUE_AUTO_COMMIT, TRUE_); //@true - else - properties_.setString(JDProperties.TRUE_AUTO_COMMIT, FALSE_); //@true - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - //@dup - /** - * Sets whether true auto commit support is used. - * @param value true if true auto commit support should be used; false otherwise. - * The default value is false. - * Note: this method is the same as setTrueAutoCommit() so that it corresponds to the connection property nameproperty name - **/ - public void setTrueAutocommit(boolean value) - { - setTrueAutoCommit(value); - } - - - // @C9 new method - /** - * Sets the Toolbox JDBC Driver behaviors to override. Multiple - * behaviors can be changed in combination by adding - * the constants and passing that sum on the this method. - * @param behaviors The driver behaviors to override. - *

        Valid values include: - *

          - *
        • 1 - Do not throw an exception if Statement.executeQuery() or - * PreparedStatement.executeQuery() do not return a result set. - * Instead, return null for the result set. - *
        - * - * Carefully consider the result of overriding the default behavior of the - * driver. For example, setting the value of this property to 1 means - * the driver will no longer throw an exception even though the JDBC 3.0 - * specification states throwing an exception is the correct behavior. - * Be sure your application correctly handles the altered behavior. - * - **/ - public void setBehaviorOverride(int behaviors) - { - String property = "behaviorOverride"; - - Integer oldValue = new Integer(getBehaviorOverride()); - Integer newValue = new Integer(behaviors); - - properties_.setString(JDProperties.BEHAVIOR_OVERRIDE, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + behaviors); - } - - - - - //@B2A - /** - * Sets the output string type of bidi data. See - * BidiStringType for more information and valid values. - **/ - public void setBidiStringType(int bidiStringType) //@B3C - { - String property = "bidiStringType"; //@B3C - - //@B3D if (bidiStringType == null) - //@B3D throw new NullPointerException(property); - Integer oldBidiStringType = new Integer(getBidiStringType()); //@B3A - Integer newBidiStringType = new Integer(bidiStringType); //@B3A - - validateProperty(property, newBidiStringType.toString(), JDProperties.BIDI_STRING_TYPE); //@B3C - - properties_.setString(JDProperties.BIDI_STRING_TYPE, newBidiStringType.toString()); //@B3C - - changes_.firePropertyChange(property, oldBidiStringType, newBidiStringType); //@B3C - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + bidiStringType); - } - - //@K24 - /** - * Sets whether bidi implicit reordering is used. - * In this version, the parameter is used to determine whether Bidi layout - * transformation should be applied to meta-data such as columns names. - * @param value true if implicit reordering should be used; false otherwise. - * The default value is true. - **/ - public void setBidiImplicitReordering(boolean value) - { - String property = "bidiImplicitReordering"; - Boolean oldValue = new Boolean(isBidiImplicitReordering()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.BIDI_IMPLICIT_REORDERING, TRUE_); - else - properties_.setString(JDProperties.BIDI_IMPLICIT_REORDERING, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - //@K24 - /** - * Sets whether bidi numeric ordering round trip is used. - * @param value true if numeric ordering round trip should be used; false otherwise. - * The default value is false. - **/ - public void setBidiNumericOrdering(boolean value) - { - String property = "bidiNumericOrdering"; - Boolean oldValue = new Boolean(isBidiNumericOrdering()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.BIDI_NUMERIC_ORDERING, TRUE_); - else - properties_.setString(JDProperties.BIDI_NUMERIC_ORDERING, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - /** - * Sets whether a big decimal value is returned. - * @param value true if a big decimal is returned; false otherwise. - * The default value is true. - **/ - public void setBigDecimal(boolean value) - { - String property = "bigDecimal"; - Boolean oldValue = new Boolean(isBigDecimal()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.BIG_DECIMAL, TRUE_); - else - properties_.setString(JDProperties.BIG_DECIMAL, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + value); //@A8C - } - - /** - * Sets the criteria for retrieving data from the IBM i system in - * blocks of records. Specifying a non-zero value for this property - * will reduce the frequency of communication to the system, and - * therefore increase performance. - * @param blockCriteria The block criteria. - *

        Valid values include: - *

          - *
        • 0 (no record blocking) - *
        • 1 (block if FOR FETCH ONLY is specified) - *
        • 2 (block if FOR UPDATE is specified) - The default value. - *
        - **/ - public void setBlockCriteria(int blockCriteria) - { - String property = "blockCriteria"; - Integer oldCriteria = new Integer(getBlockCriteria()); - Integer newCriteria = new Integer(blockCriteria); - - validateProperty(property, newCriteria.toString(), JDProperties.BLOCK_CRITERIA); - - properties_.setString(JDProperties.BLOCK_CRITERIA, newCriteria.toString()); - changes_.firePropertyChange(property, oldCriteria, newCriteria); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + blockCriteria); //@A8C - } - - /** - * Sets the block size in kilobytes to retrieve from the IBM i system and - * cache on the client. This property has no effect unless the block criteria - * property is non-zero. Larger block sizes reduce the frequency of - * communication to the system, and therefore may increase performance. - * @param blockSize The block size in kilobytes. - *

        Valid values include: - *

          - *
        • 0 - *
        • 8 - *
        • 16 - *
        • 32 - The default value. - *
        • 64 - *
        • 128 - *
        • 256 - *
        • 512 - *
        - **/ - public void setBlockSize(int blockSize) - { - String property = "blockSize"; - - Integer oldBlockSize = new Integer(getBlockSize()); - Integer newBlockSize = new Integer(blockSize); - - validateProperty(property, newBlockSize.toString(), JDProperties.BLOCK_SIZE); - - properties_.setString(JDProperties.BLOCK_SIZE, new Integer(blockSize).toString()); - changes_.firePropertyChange(property, oldBlockSize, newBlockSize); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + blockSize); //@A8C - } - - //@cc1 - /** - * This method sets concurrent access resolution. This method overrides the setting of ConcurrentAccessResolution on the datasource or connection - * URL properties. This method has no effect on - * IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @param concurrentAccessResolution The current access resolution setting. Possible valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public void setConcurrentAccessResolution (int concurrentAccessResolution) - { - String property = "concurrentAccessResolution"; - - Integer oldValue = new Integer(getConcurrentAccessResolution()); - Integer newValue = new Integer(concurrentAccessResolution); - - validateProperty(property, newValue.toString(), JDProperties.CONCURRENT_ACCESS_RESOLUTION); - - properties_.setString(JDProperties.CONCURRENT_ACCESS_RESOLUTION, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + concurrentAccessResolution ); - } - - //@C8A - /** - * Sets the cursor sensitivity to be requested from the database. If the resultSetType is - * ResultSet.TYPE_FORWARD_ONLY or ResultSet.TYPE_SCROLL_SENSITIVE, the value of this property - * will control what cursor sensitivity is requested from the database. If the resultSetType - * is ResultSet.TYPE_SCROLL_INSENSITIVE, this property will be ignored. - * - *

        Valid values include: - *

          - *
        • "asensitive" - *
        • "insensitive" - *
        • "sensitive" - *
        - * The default is "asensitive". - * - * This property is ignored when connecting to systems - * running OS/400 V5R1 and earlier. - **/ - public void setCursorSensitivity(String cursorSensitivity) - { - String property = "cursorSensitivity"; - - String oldCursorSensitivity = getCursorSensitivity(); - String newCursorSensitivity = cursorSensitivity; - - validateProperty(property, newCursorSensitivity, JDProperties.CURSOR_SENSITIVITY); - - properties_.setString(JDProperties.CURSOR_SENSITIVITY, cursorSensitivity); - changes_.firePropertyChange(property, oldCursorSensitivity, newCursorSensitivity); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + cursorSensitivity); - } - - - /** - * Sets whether the cursor is held. - * @param cursorHold true if the cursor is held; false otherwise. The default value is true. - **/ - public void setCursorHold(boolean cursorHold) - { - String property = "cursorHold"; - Boolean oldHold = new Boolean(isCursorHold()); - Boolean newHold = new Boolean(cursorHold); - - if (cursorHold) - properties_.setString(JDProperties.CURSOR_HOLD, TRUE_); - else - properties_.setString(JDProperties.CURSOR_HOLD, FALSE_); - - changes_.firePropertyChange(property, oldHold, newHold); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + cursorHold); //@A8C - } - - /** - * Sets the database name. - * This property is ignored when connecting to systems - * running OS/400 V5R1 and earlier. - * If a database name is specified it must exist in the relational - * database directory on the system. Use CL command WRKRDBDIRE - * to view the directory. - * The following criteria are used to determine - * which database is accessed: - *
          - *
        1. If a database name is specified, that database is used. Attempts - * to connect will fail if the database does not exist. - *
        2. If special value *SYSBAS is specified, the system default database is used. - *
        3. If a database name is not specified, the database specified - * in the job description for the user profile is used. - *
        4. If a database name is not specified and a database is not specified - * in the job description for the user profile, the system default - * database is used. - *
        - * @param databaseName The database name or *SYSBAS. - **/ - public void setDatabaseName(String databaseName) - { - String property = DATABASE_NAME; - - if (databaseName == null) - throw new NullPointerException(property); - - String old = getDatabaseName(); - - // @J2d databaseName_ = databaseName; - // @J2d changes_.firePropertyChange(property, old, databaseName); - // @J2d logProperty("database", databaseName_); - - properties_.setString(JDProperties.DATABASE_NAME, databaseName); // @J2a - changes_.firePropertyChange(property, old, databaseName); // @J2a - // @J2a - if (JDTrace.isTraceOn()) // @J2a - JDTrace.logInformation (this, property + ": " + databaseName); // @J2a - } - - /** - * Sets whether to use data compression. The default value is true. - * @param compression true if data compression is used; false otherwise. - **/ - public void setDataCompression(boolean compression) - { - Boolean oldCompression = new Boolean(isDataCompression()); - Boolean newCompression = new Boolean(compression); - - if (compression) - properties_.setString(JDProperties.DATA_COMPRESSION, TRUE_); - else - properties_.setString(JDProperties.DATA_COMPRESSION, FALSE_); - - changes_.firePropertyChange("dataCompression", oldCompression, newCompression); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "dataCompression: " + compression); //@A8C - } - - /** - * Sets the data source name. - * This property can be used for connection pooling implementations. - * @param dataSourceName The data source name. - **/ - public void setDataSourceName(String dataSourceName) - { - String property = DATASOURCE_NAME; - - if (dataSourceName == null) - throw new NullPointerException(property); - - String old = getDataSourceName(); - - dataSourceName_ = dataSourceName; - - changes_.firePropertyChange(property, old, dataSourceName); - - logProperty("dataSource", dataSourceName_); - } - - /** - * Sets whether to use data truncation. The default value is true. - * @param truncation true if data truncation is used; false otherwise. - **/ - public void setDataTruncation(boolean truncation) - { - Boolean oldTruncation = new Boolean(isDataTruncation()); - Boolean newTruncation = new Boolean(truncation); - - if (truncation) - properties_.setString(JDProperties.DATA_TRUNCATION, TRUE_); - else - properties_.setString(JDProperties.DATA_TRUNCATION, FALSE_); - - changes_.firePropertyChange("dataTruncation", oldTruncation, newTruncation); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "dataTruncation: " + truncation); //@A8C - } - - /** - * Sets the date format used in date literals within SQL statements. - * @param dateFormat The date format. - *

        Valid values include: - *

          - *
        • "mdy" - *
        • "dmy" - *
        • "ymd" - *
        • "usa" - *
        • "iso" - *
        • "eur" - *
        • "jis" - *
        • "julian" - *
        • "" (server job value) - default. - *
        - * The default is based on the server job. - **/ - public void setDateFormat(String dateFormat) - { - String property = "dateFormat"; - - if (dateFormat == null) - throw new NullPointerException(property); - validateProperty(property, dateFormat, JDProperties.DATE_FORMAT); - - String old = getDateFormat(); - - properties_.setString(JDProperties.DATE_FORMAT, dateFormat); - - changes_.firePropertyChange(property, old, dateFormat); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + dateFormat); //@A8C - } - - /** - * Sets the date separator used in date literals within SQL statements. - * This property has no effect unless the "data format" property is set to: - * "julian", "mdy", "dmy", or "ymd". - * @param dateSeparator The date separator. - *

        Valid values include: - *

          - *
        • "/" (slash) - *
        • "-" (dash) - *
        • "." (period) - *
        • "," (comma) - *
        • " " (space) - *
        • "" (server job value) - default. - *
        - * The default value is based on the server job. - **/ - public void setDateSeparator(String dateSeparator) - { - String property = "dateSeparator"; - if (dateSeparator == null) - throw new NullPointerException(property); - validateProperty(property, dateSeparator, JDProperties.DATE_SEPARATOR); - - String old = getDateSeparator(); - - properties_.setString(JDProperties.DATE_SEPARATOR, dateSeparator); - - changes_.firePropertyChange(property, old, dateSeparator); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + dateSeparator); //@A8C - } - - //@DFA - /** - * Sets the decfloat rounding mode. - * @param decfloatRoundingMode The decfloat rounding mode. - *

        Valid values include: - *

          - *
        • "half even" - default - *
        • "half up" - *
        • "down" - *
        • "ceiling" - *
        • "floor" - *
        • "half down" - *
        • "up" - *
        - **/ - public void setDecfloatRoundingMode(String decfloatRoundingMode) - { - String property = "decfloatRoundingMode"; - if (decfloatRoundingMode == null) - throw new NullPointerException(property); - validateProperty(property, decfloatRoundingMode, JDProperties.DECFLOAT_ROUNDING_MODE); - - String old = getDecfloatRoundingMode(); - - properties_.setString(JDProperties.DECFLOAT_ROUNDING_MODE, decfloatRoundingMode); - - changes_.firePropertyChange(property, old, decfloatRoundingMode); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + decfloatRoundingMode); - } - - /** - * Sets the decimal separator used in numeric literals within SQL - * statements. - * @param decimalSeparator The decimal separator. - *

        Valid values include: - *

          - *
        • "." (period) - *
        • "," (comma) - *
        • "" (server job value) - default. - *
        - * The default value is based on the server job. - **/ - public void setDecimalSeparator(String decimalSeparator) - { - String property = "decimalSeparator"; - if (decimalSeparator == null) - throw new NullPointerException(property); - validateProperty(property, decimalSeparator, JDProperties.DECIMAL_SEPARATOR); - - String old = getDecimalSeparator(); - - properties_.setString(JDProperties.DECIMAL_SEPARATOR, decimalSeparator); - - changes_.firePropertyChange(property, old, decimalSeparator); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + decimalSeparator); //@A8C - } - - //@igwrn - /** - * Sets the ignore warnings property. - * @param ignoreWarnings Specifies a list of SQL states for which the driver should not create warning objects. - **/ - public void setIgnoreWarnings(String ignoreWarnings) - { - String property = "ignoreWarnings"; - if (ignoreWarnings == null) - throw new NullPointerException(property); - - String old = getIgnoreWarnings(); - - properties_.setString(JDProperties.IGNORE_WARNINGS, ignoreWarnings); - - changes_.firePropertyChange(property, old, ignoreWarnings); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + ignoreWarnings); - } - - /** - * Sets the data source description. - * @param description The description. - **/ - public void setDescription(String description) - { - String property = DESCRIPTION; - if (description == null) - throw new NullPointerException(property); - - String old = getDescription(); - - description_ = description; - - changes_.firePropertyChange(property, old, description); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + description); //@A8C - } - - /** - * Sets how the IBM i system sorts records before sending them to the client. - * @param sort The sort value. - *

        Valid values include: - *

          - *
        • "hex" (base the sort on hexadecimal values) - *
        • "language" (base the sort on the language set in the sort language property) - *
        • "table" (base the sort on the sort sequence table set in the sort table property). - *
        - * The default value is "hex". - **/ - public void setSort(String sort) - { - String property = "sort"; - if (sort == null) - throw new NullPointerException(property); - - //@JOB fix to allow "sort=job" but use default value - if(sort.equals("job")) //@JOB - { //@JOB - if (JDTrace.isTraceOn()) //@JOB - JDTrace.logInformation (this, property + ": " + getSort() + " (warning: " + getSort() + " will be used since sort=job is not valid)"); //@JOB - return; //return and allow default setting to be used //@JOB - } //@JOB - - - validateProperty(property, sort, JDProperties.SORT); - String old = getSort(); - - properties_.setString(JDProperties.SORT, sort); - - changes_.firePropertyChange(property, old, sort); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + sort); //@A8C - } - - /** - * Sets the amount of detail to be returned in the message for errors - * occurring on the IBM i system. - * @param errors The error message level. - * Valid values include: "basic" and "full". The default value is "basic". - **/ - public void setErrors(String errors) - { - String property = "errors"; - if (errors == null) - throw new NullPointerException(property); - validateProperty(property, errors, JDProperties.ERRORS); - - String old = getErrors(); - properties_.setString(JDProperties.ERRORS, errors); - - changes_.firePropertyChange(property, old, errors); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + errors); //@A8C - } - - /** - * Sets whether to use extended dynamic support. Extended dynamic - * support provides a mechanism for caching dynamic SQL statements on - * the IBM i system. The first time a particular SQL statement is prepared, it is - * stored in an SQL package on the system. - * If the package does not exist, it will be automatically created. - * On subsequent prepares of the - * same SQL statement, the system can skip a significant part of the - * processing by using information stored in the SQL package. If this - * is set to "true", then a package name must be set using the "package" - * property. - * @param extendedDynamic If extended dynamic support is used; false otherwise. - * The default value is not to use extended dynamic support. - **/ - public void setExtendedDynamic(boolean extendedDynamic) - { - Boolean oldValue = new Boolean(isExtendedDynamic()); - Boolean newValue = new Boolean(extendedDynamic); - - if (extendedDynamic) - properties_.setString(JDProperties.EXTENDED_DYNAMIC, TRUE_); - else - properties_.setString(JDProperties.EXTENDED_DYNAMIC, FALSE_); - - changes_.firePropertyChange("extendedDynamic", oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "extendedDynamic: " + extendedDynamic); //@A8C - } - - // @C3A - /** - * Sets whether the driver should request extended metadata from the - * IBM i system. This property is ignored when connecting to systems - * running OS/400 V5R1 and earlier. - * If this property is set to true and connecting to a system running - * OS/400 V5R2 or IBM i, the accuracy of the information - * that is returned from ResultSetMetaData methods getColumnLabel(int), - * isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased. - * In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this - * property set to true. However, performance will be slower with this - * property on. Leave this property set to its default (false) unless you - * need more specific information from those methods. - * - * For example, without this property turned on, isSearchable(int) will - * always return true even though the correct answer may be false because - * the driver does not have enough information from the system to make a judgment. Setting - * this property to true forces the driver to get the correct data from the system. - * - * @param extendedMetaData True to request extended metadata from the system, false otherwise. - * The default value is false. - **/ - public void setExtendedMetaData(boolean extendedMetaData) - { - Boolean oldValue = new Boolean(isExtendedMetaData()); - Boolean newValue = new Boolean(extendedMetaData); - - if (extendedMetaData) - properties_.setString(JDProperties.EXTENDED_METADATA, TRUE_); - else - properties_.setString(JDProperties.EXTENDED_METADATA, FALSE_); - - changes_.firePropertyChange("extendedMetaData", oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "extendedMetaData: " + extendedMetaData); - } - - //@dup - /** - * Sets whether the driver should request extended metadata from the - * IBM i system. This property is ignored when connecting to systems - * running OS/400 V5R1 and earlier. - * If this property is set to true and connecting to a system running - * OS/400 V5R2 or IBM i, the accuracy of the information - * that is returned from ResultSetMetaData methods getColumnLabel(int), - * isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased. - * In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this - * property set to true. However, performance will be slower with this - * property on. Leave this property set to its default (false) unless you - * need more specific information from those methods. - * - * For example, without this property turned on, isSearchable(int) will - * always return true even though the correct answer may be false because - * the driver does not have enough information from the system to make a judgment. Setting - * this property to true forces the driver to get the correct data from the system. - * - * @param extendedMetaData True to request extended metadata from the system, false otherwise. - * The default value is false. - * Note: this method is the same as setExtendedMetaData() so that it corresponds to the connection property name - **/ - public void setExtendedMetadata(boolean extendedMetaData) - { - setExtendedMetaData(extendedMetaData); - } - - - // @W1a new method - /** - * Sets whether to fully open a file when performing a query. - * By default the IBM i system optimizes opens so they perform better. - * In most cases optimization functions correctly and improves - * performance. Running a query repeatedly - * when a database performance monitor is turned on may fail - * because of the optimization, however. - * Leave this property set to its default (false) until - * you experience errors running queries with monitors - * turned on. At that time set the property to true which - * will disable the optimization. - * @param fullOpen True to fully open a file (turn off optimizations), false - * to allow optimizations. The default value is false. - **/ - public void setFullOpen(boolean fullOpen) - { - Boolean oldValue = new Boolean(isFullOpen()); - Boolean newValue = new Boolean(fullOpen); - - if (fullOpen) - properties_.setString(JDProperties.FULL_OPEN, TRUE_); - else - properties_.setString(JDProperties.FULL_OPEN, FALSE_); - - changes_.firePropertyChange("fullOpen", oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "fullOpen: " + fullOpen); - } - - //@KBL - /** - * Sets whether input locators are allocated as hold locators. - * @param value true if locators should be allocated as hold locators; false otherwise. - * The default value is true. - **/ - public void setHoldInputLocators(boolean value) - { - String property = "holdInputLocators"; - Boolean oldValue = new Boolean(isHoldInputLocators()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.HOLD_LOCATORS, TRUE_); - else - properties_.setString(JDProperties.HOLD_LOCATORS, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - //@KBL - /** - * Sets whether statements should remain open until a transaction boundary when autocommit is off - * and they are associated with Lob locators. - * @param value true if statements should remain open; false otherwise. - * The default value is false. - **/ - public void setHoldStatements(boolean value) - { - String property = "holdStatements"; - Boolean oldValue = new Boolean(isHoldStatements()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.HOLD_STATEMENTS, TRUE_); - else - properties_.setString(JDProperties.HOLD_STATEMENTS, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - //@dmy - /** - * Indicates whether the temporary fix for JVM 1.6 is enabled. - * @param value true if JVM 1.6 fix is enabled; false otherwise. - * The default value is true. - **/ - public void setJvm16Synchronize(boolean value) - { - String property = "jvm16 synchronize"; - Boolean oldValue = new Boolean(isJvm16Synchronize()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.JVM16_SYNCHRONIZE, TRUE_); - else - properties_.setString(JDProperties.JVM16_SYNCHRONIZE, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - // @A1A - /** - * Sets whether to delay closing cursors until subsequent requests. - * @param lazyClose true to delay closing cursors until subsequent requests; false otherwise. - The default value is false. - **/ - public void setLazyClose(boolean lazyClose) - { - Boolean oldValue = new Boolean(isLazyClose()); - Boolean newValue = new Boolean(lazyClose); - - if (lazyClose) - properties_.setString(JDProperties.LAZY_CLOSE, TRUE_); - else - properties_.setString(JDProperties.LAZY_CLOSE, FALSE_); - - changes_.firePropertyChange("lazyClose", oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "lazyClose: " + lazyClose); //@A8C - } - - /** - * Sets the libraries to add to the server job's library list. - * The libraries are delimited by commas or spaces, and - * "*LIBL" may be used as a place holder for the server job's - * current library list. The library list is used for resolving - * unqualified stored procedure calls and finding schemas in - * DatabaseMetaData catalog methods. If "*LIBL" is not specified, - * the specified libraries will replace the server job's - * current library list. - * @param libraries The library list. - **/ - public void setLibraries(String libraries) - { - String property = "libraries"; - if (libraries == null) - throw new NullPointerException("libraries"); - - String old = getLibraries(); - properties_.setString(JDProperties.LIBRARIES, libraries); - - changes_.firePropertyChange(property, old, libraries); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + libraries); //@A8C - } - - /** - * Sets the maximum LOB (large object) size in bytes that - * can be retrieved as part of a result set. LOBs that are larger - * than this threshold will be retrieved in pieces using extra - * communication to the IBM i system. Larger LOB thresholds will reduce - * the frequency of communication to the system, but will download - * more LOB data, even if it is not used. Smaller LOB thresholds may - * increase frequency of communication to the system, but will only - * download LOB data as it is needed. - * - * @param threshold The lob threshold. Valid range is 0-16777216. - * The default value is 32768. - **/ - public void setLobThreshold(int threshold) - { - String property = "threshold"; - if (threshold < 0 || threshold > MAX_THRESHOLD) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - Integer oldValue = new Integer(getLobThreshold()); - Integer newValue = new Integer(threshold); - - properties_.setString(JDProperties.LOB_THRESHOLD, new Integer(threshold).toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + threshold); //@A8C - } - - /** - * Sets the maximum time in seconds that this data source can wait while attempting to connect to a database. - * A value of zero specifies that the timeout is the system default if one exists; otherwise it specifies that - * there is no timeout. The default value is initially zero. - * @param timeout The login timeout in seconds. - **/ - public void setLoginTimeout(int timeout) throws SQLException - { - - //@STIMEOUT setSoTimeout(timeout * 1000); //@K5A setSoTimeout takes milliseconds as a parameter //@STIMEOUT separate login and socket timeout into two separtate properties - sockProps_.setLoginTimeout(timeout * 1000); //@st3 - String property = "loginTimeout"; //@K5A - - Integer oldValue = new Integer(getLoginTimeout()); //@K5A - Integer newValue = new Integer(timeout); //@K5A - - properties_.setString(JDProperties.LOGIN_TIMEOUT, newValue.toString()); //@K5A - - changes_.firePropertyChange(property, oldValue, newValue); //@K5A - - if (JDTrace.isTraceOn()) //@K5A - JDTrace.logInformation (this, property + ": " + timeout); //@K5A - - //@K5D JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - /** - * Sets the log writer for this data source. - * @param writer The log writer; to disable, set to null. - * @exception SQLException If a database error occurs. - **/ - public void setLogWriter(PrintWriter writer) throws SQLException - { - String property = "writer"; - - //@C4D if (writer == null) - //@C4D throw new NullPointerException(property); - - PrintWriter old = getLogWriter(); - writer_ = writer; - changes_.firePropertyChange(property, old, writer); - - if (writer == null) //@C4A - { //@C4A - log_ = null; //@C4A - return; //@C4A - } //@C4A - - log_ = new EventLog(writer); - } - - //@PDA - /** - * Sets how to retrieve DatabaseMetaData. - * If set to 0, database metadata will be retrieved through the ROI data flow. - * If set to 1, database metadata will be retrieved by calling system stored procedures. - * The methods that currently are available through stored procedures are: - * getColumnPrivileges - * @param mds The setting for metadata source - * The default value is 1. - **/ - public void setMetaDataSource(int mds) - { - String property = "metaDataSource"; - - Integer oldValue = new Integer(getMetaDataSource()); - Integer newValue = new Integer(mds); - - properties_.setString(JDProperties.METADATA_SOURCE, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + mds); - } - - - //@dup - /** - * Sets how to retrieve DatabaseMetaData. - * If set to 0, database metadata will be retrieved through the ROI data flow. - * If set to 1, database metadata will be retrieved by calling system stored procedures. - * The methods that currently are available through stored procedures are: - * getColumnPrivileges - * @param mds The setting for metadata source - * The default value is 1. - * Note: this method is the same as setMetaDataSource() so that it corresponds to the connection property name - **/ - public void setMetadataSource(int mds) - { - setMetaDataSource(mds); - } - - - /** - * Sets the naming convention used when referring to tables. - * @param naming The naming convention. Valid values include: "sql" (e.g. schema.table) - * and "system" (e.g. schema/table). The default value is "sql". - **/ - public void setNaming(String naming) - { - String property = "naming"; - if (naming == null) - throw new NullPointerException("naming"); - validateProperty(property, naming, JDProperties.NAMING); - - String old = getNaming(); - properties_.setString(JDProperties.NAMING, naming); - - changes_.firePropertyChange(property, old, naming); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + naming); //@A8C - } - - /** - * Sets the base name of the SQL package. Note that only the - * first six characters are used to generate the name of the SQL package on the IBM i system. - * This property has no effect unless - * the extended dynamic property is set to true. In addition, this property - * must be set if the extended dynamic property is set to true. - * @param packageName The base name of the SQL package. - **/ - public void setPackage(String packageName) - { - String property = "packageName"; - if (packageName == null) - throw new NullPointerException(property); - - String old = getPackage(); - properties_.setString(JDProperties.PACKAGE, packageName); - - changes_.firePropertyChange(property, old, packageName); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + packageName); //@A8C - } - - /** - * Sets whether to add newly prepared statements to the SQL package - * specified on the "package" property. This property - * has no effect unless the extended dynamic property is set to true. - * @param add If newly prepared statements should be added to the SQL package specified on - * the "package" property; false otherwise. - * The default value is true. - **/ - public void setPackageAdd(boolean add) - { - Boolean oldValue = new Boolean(isPackageAdd()); - Boolean newValue = new Boolean(add); - - if (add) - properties_.setString(JDProperties.PACKAGE_ADD, TRUE_); - else - properties_.setString(JDProperties.PACKAGE_ADD, FALSE_); - - changes_.firePropertyChange("packageAdd", oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "packageAdd: " + add); //@A8C - } - - /** - * Sets whether to cache a subset of the SQL package information in client memory. - * Caching SQL packages locally - * reduces the amount of communication to the IBM i system for prepares and describes. This - * property has no effect unless the extended dynamic property is set to true. - * @param cache If caching is used; false otherwise. The default value is false. - **/ - public void setPackageCache(boolean cache) - { - Boolean oldValue = new Boolean(isPackageCache()); - Boolean newValue = new Boolean(cache); - - if (cache) - properties_.setString(JDProperties.PACKAGE_CACHE, TRUE_); - else - properties_.setString(JDProperties.PACKAGE_CACHE, FALSE_); - - changes_.firePropertyChange("packageCache", oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "packageCache: " + cache); //@A8C - } - - - //@C6C Changed javadoc since package clearing is now done automatically - //@C6C by the database. - /** - * Sets whether to clear SQL packages when they become full. This method - * has been deprecated. Package clearing and the decision for the - * threshold where package clearing is needed is now handled - * automatically by the database. - * @param clear If the SQL package are cleared when full; false otherwise. - * @deprecated - **/ - public void setPackageClear(boolean clear) - { - //@C6D Package clearing and the decision for the - //@C6D threshold where package clearing is needed is now handled - //@C6D automatically by the database. - - //@C6D Boolean oldValue = new Boolean(isPackageClear()); - //@C6D Boolean newValue = new Boolean(clear); - - //@C6D String value = null; - //@C6D if (clear) - //@C6D properties_.setString(JDProperties.PACKAGE_CLEAR, TRUE_); - //@C6D else - //@C6D properties_.setString(JDProperties.PACKAGE_CLEAR, FALSE_); - - //@C6D changes_.firePropertyChange("packageClear", oldValue, newValue); - - //@C6D if (JDTrace.isTraceOn()) //@A8C - //@C6D JDTrace.logInformation (this, "packageClear: " + clear); //@A8C - } - - - /** - * Sets the type of SQL statement to be stored in the SQL package. This can - * be useful to improve the performance of complex join conditions. This - * property has no effect unless the extended dynamic property is set to true. - * @param packageCriteria The type of SQL statement. - * Valid values include: "default" (only store SQL statements with parameter - * markers in the package), and "select" (store all SQL SELECT statements - * in the package). The default value is "default". - **/ - public void setPackageCriteria(String packageCriteria) - { - String property = "packageCriteria"; - - if (packageCriteria == null) - throw new NullPointerException(property); - validateProperty(property, packageCriteria, JDProperties.PACKAGE_CRITERIA); - - String old = getPackageCriteria(); - properties_.setString(JDProperties.PACKAGE_CRITERIA, packageCriteria); - - changes_.firePropertyChange(property, old, packageCriteria); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + packageCriteria); //@A8C - } - - /** - * Sets the action to take when SQL package errors occur. When an SQL package - * error occurs, the driver will optionally throw an SQLException or post a - * warning to the Connection, based on the value of this property. This property - * has no effect unless the extended dynamic property is set to true. - * @param packageError The action when SQL errors occur. - * Valid values include: "exception", "warning", and "none". The default value is "warning". - **/ - public void setPackageError(String packageError) - { - String property = "packageError"; - if (packageError == null) - throw new NullPointerException(property); - validateProperty(property, packageError, JDProperties.PACKAGE_ERROR); - - String old = getPackageError(); - properties_.setString(JDProperties.PACKAGE_ERROR, packageError); - - changes_.firePropertyChange(property, old, packageError); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + packageError); //@A8C - } - /** - * Sets the library for the SQL package. This property has no effect unless - * the extended dynamic property is set to true. - * @param packageLibrary The SQL package library. The default package library is "QGPL". - **/ - public void setPackageLibrary(String packageLibrary) - { - String property = "packageLibrary"; - if (packageLibrary == null) - throw new NullPointerException(property); - - String old = getPackageLibrary(); - properties_.setString(JDProperties.PACKAGE_LIBRARY, packageLibrary); - - changes_.firePropertyChange(property, old, packageLibrary); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + packageLibrary); //@A8C - } - - /** - * Sets the database password. - * @param password The password. - **/ - public void setPassword(String password) - { - as400_.setPassword(password); - serialPWBytes_ = xpwConfuse(password); //@J3a - log(ResourceBundleLoader.getText("AS400_JDBC_DS_PASSWORD_SET")); //@A9C - } - - /** - * Sets whether to prefetch data upon executing a SELECT statement. - * This will increase performance when accessing the initial rows in the result set. - * @param prefetch If prefetch is used; false otherwise. - * The default value is to prefectch data. - **/ - public void setPrefetch(boolean prefetch) - { - Boolean oldValue = new Boolean(isPrefetch()); - Boolean newValue = new Boolean(prefetch); - - if (prefetch) - properties_.setString(JDProperties.PREFETCH, TRUE_); - else - properties_.setString(JDProperties.PREFETCH, FALSE_); - - changes_.firePropertyChange("prefetch", oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "prefetch: " + prefetch); //@A8C - } - - /** - * Sets whether the user should be prompted if a user name or password is - * needed to connect to the IBM i system. If a connection can not be made - * without prompting the user, and this property is set to false, then an - * attempt to connect will fail. - * @param prompt true if the user is prompted for signon information; false otherwise. - * The default value is false. - **/ - public void setPrompt(boolean prompt) - { - Boolean oldValue = new Boolean(isPrompt()); - Boolean newValue = new Boolean(prompt); - - if (prompt) - properties_.setString(JDProperties.PROMPT, TRUE_); - else - properties_.setString(JDProperties.PROMPT, FALSE_); - - try - { //@C2A - as400_.setGuiAvailable(prompt); //@C2A - } //@C2A - catch (PropertyVetoException vp) //@C2A - { /* ignore */ //@C2A - } //@C2A - - changes_.firePropertyChange("prompt", oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "prompt: " + prompt); //@A8C - } - - // @F0D - Removed unused method - ///** - //* Sets the JDBC properties. - //* @param Properties The JDBC properties list. - //**/ - //void setProperties(Reference reference) - //{ - // /* - // * Implementation note: This method is called from AS400JDBCObjectFactory.getObjectInstance - // */ - // if (reference == null) - // throw new NullPointerException("reference"); - // - // Properties properties = new Properties(); - // - // Enumeration list = reference.getAll(); - // while (list.hasMoreElements()) - // { - // StringRefAddr refAddr = (StringRefAddr)list.nextElement(); - // String property = refAddr.getType(); - // String value = (String)reference.get(property).getContent(); - // - // if (property.equals(DATABASE_NAME)) // constant identifiers were used to store in JNDI. - // setDatabaseName(value); - // else if (property.equals(DATASOURCE_NAME)) - // setDataSourceName(value); - // else if (property.equals(DESCRIPTION)) - // setDescription(value); - // else if (property.equals(SERVER_NAME)) - // setServerName(value); - // else if (property.equals(USER)) - // setUser(value); - // else if (property.equals(PASSWORD)) { - // // get the password back from the serialized char[] - // serialPWBytes_ = value.toCharArray(); - // // decode the password and set it on the as400 - // as400_.setPassword(xpwDeconfuse(serialPWBytes_)); - // } - // else if (property.equals(KEY_RING_NAME)) { - // // set the key ring name - // serialKeyRingName_ = value; - // } - // else if (property.equals(KEY_RING_PASSWORD)) { - // // get the key ring password back from the serialized char[] - // if (value != null) - // serialKeyRingPWBytes_ = value.toCharArray(); - // } - // else if (property.equals(SECURE)) { - // // set the isSecure_ flag - // isSecure_ = value.equals(TRUE_) ? true : false; - // } - // else if (property.equals(SAVE_PASSWORD)) { - // // set the savePasswordWhenSerialized_ flag - // savePasswordWhenSerialized_ = value.equals(TRUE_) ? true : false; - // } - // else - // { - // properties.put(property, value); - // } - // } - // properties_ = new JDProperties(properties, null); - // - // // get the prompt property and set it back in the as400 object - // String prmpt = properties_.getString(JDProperties.PROMPT); - // if (prmpt != null && prmpt.equalsIgnoreCase(FALSE_)) - // setPrompt(false); - // else if (prmpt != null && prmpt.equalsIgnoreCase(TRUE_)) - // setPrompt(true); - // - // // if the system is secure create a SecureAS400 object - // if (isSecure_) { - // try - // { - // as400_ = new SecureAS400(as400_); - // ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_, xpwDeconfuse(serialKeyRingPWBytes_)); - // } - // catch (PropertyVetoException pe) - // { /* will never happen */ - // } - // } - //} - - //@PDA - /** - * Sets the properties based on ";" delimited string of properties, in same - * fashion as URL properties specified with - * DriverManager.getConnection(urlProperties). This method simply parses - * property string and then calls setPropertes(Properties). This method is - * intended as an enhancement so that the user does not have to write new - * code to call the setters for new/deleted properties. - * - * @param propertiesString list of ";" delimited properties - */ - public void setProperties(String propertiesString) - { - //use existing JDDatasourceURL to parse properties string like Connection does - //but first have to add dummy protocol so we can re-use parsing code - propertiesString = "jdbc:as400://dummyhost;" + propertiesString; - JDDataSourceURL dsURL = new JDDataSourceURL(propertiesString); - //returns only properties specified in propertyString.. (none of - // JDProperties defaults) - Properties properties = dsURL.getProperties(); - setProperties(properties); - } - - //@PDA - /** - * Sets the properties for this datasource. This method is intended as an - * enhancement so that the user does not have to write new code to call the - * setters for new/deleted properties. - * - * @param newProperties object containing updated property values - */ - public void setProperties(Properties newProperties) - { - //1. turn on/off tracing per new props - //2. set needed AS400JDBCDataSource instance variables - //3. set socket props - //4. propagate newProperties to existing properties_ object - - // Check first thing to see if the trace property is - // turned on. This way we can trace everything, including - // the important stuff like loading the properties. - - // If trace property was set to true, turn on tracing. If trace property - // was set to false, - // turn off tracing. If trace property was not set, do not change. - if (JDProperties.isTraceSet(newProperties, null) == JDProperties.TRACE_SET_ON) - { - if (!JDTrace.isTraceOn()) - JDTrace.setTraceOn(true); - } else if (JDProperties.isTraceSet(newProperties, null) == JDProperties.TRACE_SET_OFF) - { - if (JDTrace.isTraceOn()) - JDTrace.setTraceOn(false); - } - - // If toolbox trace is set to datastream. Turn on datastream tracing. - if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_DATASTREAM) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDatastreamOn(true); - } - // If toolbox trace is set to diagnostic. Turn on diagnostic tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_DIAGNOSTIC) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDiagnosticOn(true); - } - // If toolbox trace is set to error. Turn on error tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_ERROR) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceErrorOn(true); - } - // If toolbox trace is set to information. Turn on information tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_INFORMATION) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceInformationOn(true); - } - // If toolbox trace is set to warning. Turn on warning tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_WARNING) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceWarningOn(true); - } - // If toolbox trace is set to conversion. Turn on conversion tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_CONVERSION) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceConversionOn(true); - } - // If toolbox trace is set to proxy. Turn on proxy tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_PROXY) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceProxyOn(true); - } - // If toolbox trace is set to pcml. Turn on pcml tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_PCML) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTracePCMLOn(true); - } - // If toolbox trace is set to jdbc. Turn on jdbc tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_JDBC) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceJDBCOn(true); - } - // If toolbox trace is set to all. Turn on tracing for all categories. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_ALL) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceAllOn(true); - } - // If toolbox trace is set to thread. Turn on thread tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_THREAD) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceThreadOn(true); - } - // If toolbox trace is set to none. Turn off tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_NONE) - { - if (Trace.isTraceOn()) - { - Trace.setTraceOn(false); - } - } - - //next we need to set instance vars (via setX() methods) - //or setup socket properties or set in properties_ - //Note: this is similar to AS400JDBCDataSource(Reference reference)logic - - Enumeration e = newProperties.keys(); - while (e.hasMoreElements()) - { - String propertyName = (String) e.nextElement(); - String propertyValue = (String) newProperties.getProperty(propertyName); - - int propIndex = JDProperties.getPropertyIndex(propertyName); - - //some of the setter methods also set the properties_ below - if (propIndex == JDProperties.DATABASE_NAME) - setDatabaseName(propertyValue); - else if (propIndex == JDProperties.USER) - setUser(propertyValue); - else if (propIndex == JDProperties.PASSWORD) - setPassword(properties_.getString(JDProperties.PASSWORD)); - else if (propIndex == JDProperties.SECURE) - setSecure(propertyValue.equals(TRUE_) ? true : false); - else if (propIndex == JDProperties.KEEP_ALIVE) - setKeepAlive(propertyValue.equals(TRUE_) ? true : false); - else if (propIndex == JDProperties.RECEIVE_BUFFER_SIZE) - setReceiveBufferSize(Integer.parseInt(propertyValue)); - else if (propIndex == JDProperties.SEND_BUFFER_SIZE) - setSendBufferSize(Integer.parseInt(propertyValue)); - else if (propIndex == JDProperties.PROMPT) - setPrompt(propertyValue.equals(TRUE_) ? true : false); - else if (propIndex == JDProperties.KEY_RING_NAME){ - //at this time, decided to not allow this due to security and fact that there is no setKeyRingName() method - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Property: " + propertyName + " can only be changed in AS400JDBCDataSource constructor"); - } else if (propIndex == JDProperties.KEY_RING_PASSWORD){ - //at this time, decided to not allow this due to security and fact that there is no setKeyRingPassword() method - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Property: " + propertyName + " can only be changed in AS400JDBCDataSource constructor"); - } else if (propIndex != -1) - { - properties_.setString(propIndex, propertyValue); - } - } - - } - - /** - * Sets the name of the proxy server. - * @param proxyServer The proxy server. - **/ - public void setProxyServer(String proxyServer) - { - String property = "proxyServer"; - if (proxyServer == null) - throw new NullPointerException(property); - - String old = getProxyServer(); - properties_.setString(JDProperties.PROXY_SERVER, proxyServer); - - changes_.firePropertyChange(property, old, proxyServer); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + proxyServer); //@A8C - } - - /** - * Sets the source of the text for REMARKS columns in ResultSets returned - * by DatabaseMetaData methods. - * @param remarks The text source. - * Valid values include: "sql" (SQL object comment) and "system" (IBM i object description). - * The default value is "system". - **/ - public void setRemarks(String remarks) - { - String property = "remarks"; - if (remarks == null) - throw new NullPointerException("remarks"); - validateProperty(property, remarks, JDProperties.REMARKS); - - String old = getRemarks(); - properties_.setString(JDProperties.REMARKS, remarks); - - changes_.firePropertyChange(property, old, remarks); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + remarks); //@A8C - } - - //@K94 - /** - * Sets whether the cursor is held after a rollback. - * @param cursorHold true if the cursor is held; false otherwise. The default value is false. - **/ - public void setRollbackCursorHold(boolean cursorHold) - { - String property = "rollbackCursorHold"; - Boolean oldHold = new Boolean(isRollbackCursorHold()); - Boolean newHold = new Boolean(cursorHold); - - if (cursorHold) - properties_.setString(JDProperties.ROLLBACK_CURSOR_HOLD, TRUE_); - else - properties_.setString(JDProperties.ROLLBACK_CURSOR_HOLD, FALSE_); - - changes_.firePropertyChange(property, oldHold, newHold); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + cursorHold); - } - - /** - * Sets the secondary URL to be used for a connection on the middle-tier's - * DriverManager in a multiple tier environment, if it is different than - * already specified. This property allows you to use this driver to connect - * to databases other than DB2 for IBM i. Use a backslash as an escape character - * before backslashes and semicolons in the URL. - * @param url The secondary URL. - **/ - public void setSecondaryUrl(String url) - { - if (url == null) - throw new NullPointerException("url"); - - String old = getSecondaryUrl(); - properties_.setString(JDProperties.SECONDARY_URL, url); - - changes_.firePropertyChange("secondaryUrl", old, url); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "secondaryUrl: " + url); //@A8C - } - - //@dup - /** - * Sets the secondary URL to be used for a connection on the middle-tier's - * DriverManager in a multiple tier environment, if it is different than - * already specified. This property allows you to use this driver to connect - * to databases other than DB2 for IBM i. Use a backslash as an escape character - * before backslashes and semicolons in the URL. - * @param url The secondary URL. - * Note: this method is the same as setSecondaryUrl() so that it corresponds to the connection property name - **/ - public void setSecondaryURL(String url) - { - setSecondaryUrl(url); - } - - /** - * Sets whether a Secure Socket Layer (SSL) connection is used to communicate - * with the IBM i system. SSL connections are only available when connecting to systems - * at V4R4 or later. - * @param secure true if Secure Socket Layer connection is used; false otherwise. - * The default value is false. - **/ - public void setSecure(boolean secure) - { - Boolean oldValue = new Boolean(isSecure()); - Boolean newValue = new Boolean(secure); - - //Do not allow user to change to not secure if they constructed the data source with - //a keyring. - if (!secure && isSecure_) //@C2A - { //@C2A - throw new ExtendedIllegalStateException("secure", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); //@C2A - } //@C2A - - // keep away the secure flag // @F0A - isSecure_ = secure; // @F0A - - if (secure) - properties_.setString(JDProperties.SECURE, TRUE_); - else - properties_.setString(JDProperties.SECURE, FALSE_); - - changes_.firePropertyChange("secure", oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "secure: " + secure); //@A8C - } - - //@pw3 - /** - * Sets whether to disallow "" and *current as user name and password. - * True indicates to disallow "" and *current for user name and password. - * @param secureCurrentUser The secure current user setting. - **/ - public void setSecureCurrentUser(boolean secureCurrentUser) - { - String property = "secureCurrentUser"; - Boolean oldVal = new Boolean(isSecureCurrentUser()); - Boolean newVal = new Boolean(secureCurrentUser); - - if (secureCurrentUser) - properties_.setString(JDProperties.SECURE_CURRENT_USER, TRUE_); - else - properties_.setString(JDProperties.SECURE_CURRENT_USER, FALSE_); - - changes_.firePropertyChange(property, oldVal, newVal); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + secureCurrentUser); - } - - - /** - * Sets the IBM i system name. - * @param serverName The system name. - **/ - public void setServerName(String serverName) - { - String property = SERVER_NAME; - if (serverName == null) - throw new NullPointerException(property); - - String old = getServerName(); - - // keep away the name to serialize // @F0A - serialServerName_ = serverName; // @F0A - - try - { - as400_.setSystemName(serverName); - } - catch (PropertyVetoException pv) - { /* ignore */ - } - - changes_.firePropertyChange(property, old, serverName); - - logProperty ("server name", as400_.getSystemName()); - } - - - // @j1 new method - /** - * Enables tracing of the JDBC server job. - * If tracing is enabled, tracing is started when - * the client connects to the IBM i system, and ends when the connection - * is disconnected. Tracing must be started before connecting to - * the system since the client enables tracing only at connect time. - * - *

        - * Trace data is collected in spooled files on the system. Multiple - * levels of tracing can be turned on in combination by adding - * the constants and passing that sum on the set method. For example, - *

        -    *  dataSource.setServerTraceCategories(AS400JDBCDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
        -    *  
        - * @param traceCategories level of tracing to start. - *

        Valid values include: - *

          - *
        • SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job. - * The numeric value of this constant is 2. - *
        • SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job. - * The numeric value of this constant is 4. - *
        • SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends. - * The numeric value of this constant is 8. - *
        • SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job. - * The numeric value of this constant is 16. - *
        • SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information. - * The numeric value of this constant is 32. - *
        - *

        - * Tracing the JDBC server job will use significant amounts of system resources. - * Additional processor resource is used to collect the data, and additional - * storage is used to save the data. Turn on tracing only to debug - * a problem as directed by IBM service. - * - * - **/ - public void setServerTraceCategories(int traceCategories) - { - String property = "serverTrace"; - - Integer oldValue = new Integer(getServerTraceCategories()); - Integer newValue = new Integer(traceCategories); - - properties_.setString(JDProperties.TRACE_SERVER, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + traceCategories); - } - - //@dup - /** - * Enables tracing of the JDBC server job. - * If tracing is enabled, tracing is started when - * the client connects to the IBM i system, and ends when the connection - * is disconnected. Tracing must be started before connecting to - * the system since the client enables tracing only at connect time. - * - *

        - * Trace data is collected in spooled files on the system. Multiple - * levels of tracing can be turned on in combination by adding - * the constants and passing that sum on the set method. For example, - *

        -     *  dataSource.setServerTraceCategories(AS400JDBCDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
        -     *  
        - * @param traceCategories level of tracing to start. - *

        Valid values include: - *

          - *
        • SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job. - * The numeric value of this constant is 2. - *
        • SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job. - * The numeric value of this constant is 4. - *
        • SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends. - * The numeric value of this constant is 8. - *
        • SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job. - * The numeric value of this constant is 16. - *
        • SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information. - * The numeric value of this constant is 32. - *
        - *

        - * Tracing the JDBC server job will use significant amounts of system resources. - * Additional processor resource is used to collect the data, and additional - * storage is used to save the data. Turn on tracing only to debug - * a problem as directed by IBM service. - * - * Note: this method is the same as setServerTraceCategories() so that it corresponds to the connection property name - **/ - public void setServerTrace(int traceCategories) - { - setServerTraceCategories(traceCategories); - } - - - // @A2A - /** - * Sets the JDBC driver implementation. - * This property has no - * effect if the "secondary URL" property is set. - * This property cannot be set to "native" if the - * environment is not an IBM i Java Virtual Machine. - * param driver The driver value. - *

        Valid values include: - *

          - *
        • "toolbox" (use the IBM Toolbox for Java JDBC driver) - *
        • "native" (use the IBM Developer Kit for Java JDBC driver) - *
        - * The default value is "toolbox". - * Note: Not supported in a connection pool. - **/ - public void setDriver(String driver) - { - String property = "driver"; - if (driver == null) - throw new NullPointerException(property); - - validateProperty(property, driver, JDProperties.DRIVER); - String old = getDriver(); - - properties_.setString(JDProperties.DRIVER, driver); - - changes_.firePropertyChange(property, old, driver); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + driver); //@A8C - } - - // @J3 new method - /** - * Sets whether to save the password locally with the rest of the properties when - * this data source object is serialized. - *

        - * If the password is saved, it is up to the application to protect - * the serialized form of the object because it contains all necessary - * information to connect to the IBM i system. The default is false. It - * is a security risk to save the password with the rest of the - * properties so by default the password is not saved. If the application - * programmer chooses to accept this risk, set this property to true - * to force the Toolbox to save the password with the other properties - * when the data source object is serialized. - * - * @param savePassword true if the password is saved; false otherwise. - * The default value is false - **/ - public void setSavePasswordWhenSerialized(boolean savePassword) - { - String property = "savePasswordWhenSerialized"; //@C5A - - boolean oldValue = isSavePasswordWhenSerialized(); //@C5A - boolean newValue = savePassword; //@C5A - - savePasswordWhenSerialized_ = savePassword; - - changes_.firePropertyChange(property, oldValue, newValue); //@C5A - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "save password: " + savePassword); - } - - - /** - * Sets the three-character language id to use for selection of a sort sequence. - * This property has no effect unless the sort property is set to "language". - * @param language The three-character language id. - * The default value is ENU. - **/ - public void setSortLanguage(String language) - { - if (language == null) - throw new NullPointerException("language"); - - String old = getSortLanguage(); - properties_.setString(JDProperties.SORT_LANGUAGE, language); - - changes_.firePropertyChange("sortLanguage", old, language); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "sortLanguage: " + language); //@A8C - } - - /** - * Sets the library and file name of a sort sequence table stored on the - * IBM i system. - * This property has no effect unless the sort property is set to "table". - * The default is an empty String (""). - * @param table The qualified sort table name. - **/ - public void setSortTable(String table) - { - if (table == null) - throw new NullPointerException("table"); - - String old = getSortTable(); - properties_.setString(JDProperties.SORT_TABLE, table); - - changes_.firePropertyChange("sortTable", old, table); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "sortTable: " + table); //@A8C - } - - /** - * Sets how the IBM i system treats case while sorting records. This property - * has no effect unless the sort property is set to "language". - * @param sortWeight The sort weight. - * Valid values include: "shared" (upper- and lower-case characters are sorted as the - * same character) and "unique" (upper- and lower-case characters are sorted as - * different characters). The default value is "shared". - **/ - public void setSortWeight(String sortWeight) - { - String property = "sortWeight"; - if (sortWeight == null) - throw new NullPointerException(property); - - validateProperty(property, sortWeight, JDProperties.SORT_WEIGHT); - - String old = getSortWeight(); - properties_.setString(JDProperties.SORT_WEIGHT, sortWeight); - - changes_.firePropertyChange(property, old, sortWeight); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + sortWeight); //@A8C - } - - /** - * Sets whether a thread is used. - * @param threadUsed true if a thread is used; false otherwise. - * The default value is true. - **/ - public void setThreadUsed(boolean threadUsed) - { - Boolean oldValue = new Boolean(isThreadUsed()); - Boolean newValue = new Boolean(threadUsed); - - if (threadUsed) - properties_.setString(JDProperties.THREAD_USED, TRUE_); - else - properties_.setString(JDProperties.THREAD_USED, FALSE_); - - try - { - as400_.setThreadUsed(threadUsed); - } - catch (PropertyVetoException pve) - { /* Will never happen */ - } - - changes_.firePropertyChange("threadUsed", oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "threadUsed: " + threadUsed); //@A8C - } - - /** - * Sets the time format used in time literals with SQL statements. - * @param timeFormat The time format. - *

        Valid values include: - *

          - *
        • "hms" - *
        • "usa" - *
        • "iso" - *
        • "eur" - *
        • "jis" - *
        • "" (server job value) - default. - *
        - * The default value is based on the server job. - **/ - public void setTimeFormat(String timeFormat) - { - String property = "timeFormat"; - if (timeFormat == null) - throw new NullPointerException(property); - validateProperty(property, timeFormat, JDProperties.TIME_FORMAT); - - String old = getTimeFormat(); - properties_.setString(JDProperties.TIME_FORMAT, timeFormat); - - changes_.firePropertyChange(property, old, timeFormat); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + timeFormat); //@A8C - } - - /** - * Sets the time separator used in time literals within SQL statements. - * This property has no effect unless the time format property is set to "hms". - * @param timeSeparator The time separator. - *

        Valid values include: - *

          - *
        • ":" (colon) - *
        • "." (period) - *
        • "," (comma) - *
        • " " (space) - *
        • "" (server job value) - default. - *
        - * The default value is based on the server job. - **/ - public void setTimeSeparator(String timeSeparator) - { - String property = "timeSeparator"; - if (timeSeparator == null) - throw new NullPointerException(property); - validateProperty(property, timeSeparator, JDProperties.TIME_SEPARATOR); - - String old = getTimeSeparator(); - properties_.setString(JDProperties.TIME_SEPARATOR, timeSeparator); - - changes_.firePropertyChange(property, old, timeSeparator); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + timeSeparator); //@A8C - } - - /** - * Sets whether trace messages should be logged. Trace messages are - * useful for debugging programs that call JDBC. However, there is a - * performance penalty associated with logging trace messages, so this - * property should only be set to true for debugging. Trace messages - * are logged to System.out. - * @param trace true if trace message are logged; false otherwise. - * The default value is false. - **/ - public void setTrace(boolean trace) - { - Boolean oldValue = new Boolean(isTrace()); - Boolean newValue = new Boolean(trace); - - if (trace) - properties_.setString(JDProperties.TRACE, TRUE_); - else - properties_.setString(JDProperties.TRACE, FALSE_); - - changes_.firePropertyChange("trace", oldValue, newValue); - - if (trace) - { - if (!JDTrace.isTraceOn ()) - JDTrace.setTraceOn (true); - } - else - JDTrace.setTraceOn (false); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, "trace: " + trace); //@A8C - } - - - /** - * Sets the IBM i system's transaction isolation. - * @param transactionIsolation The transaction isolation level. - *

        Valid values include: - *

          - *
        • "none" - *
        • "read uncommitted" - The default value. - *
        • "read committed" - *
        • "repeatable read" - *
        • "serializable" - *
        - **/ - public void setTransactionIsolation(String transactionIsolation) - { - String property = "transactionIsolation"; - - if (transactionIsolation == null) - throw new NullPointerException(property); - validateProperty(property, transactionIsolation, JDProperties.TRANSACTION_ISOLATION); - - String old = getTransactionIsolation(); - - properties_.setString(JDProperties.TRANSACTION_ISOLATION, transactionIsolation); - - changes_.firePropertyChange(property, old, transactionIsolation); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + transactionIsolation); //@A8C - } - - /** - * Sets whether binary data is translated. If this property is set - * to true, then BINARY and VARBINARY fields are treated as CHAR and - * VARCHAR fields. - * @param translate true if binary data is translated; false otherwise. - * The default value is false. - **/ - public void setTranslateBinary(boolean translate) - { - String property = "translateBinary"; - - Boolean oldValue = new Boolean(isTranslateBinary()); - Boolean newValue = new Boolean(translate); - - if (translate) - properties_.setString(JDProperties.TRANSLATE_BINARY, TRUE_); - else - properties_.setString(JDProperties.TRANSLATE_BINARY, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) //@A8C - JDTrace.logInformation (this, property + ": " + translate); //@A8C - } - - //@PDA - /** - * Sets how Boolean objects are interpreted when setting the value - * for a character field/parameter using the PreparedStatement.setObject(), - * CallableStatement.setObject() or ResultSet.updateObject() methods. Setting the - * property to "true", would store the Boolean object in the character field as either - * "true" or "false". Setting the property to "false", would store the Boolean object - * in the character field as either "1" or "0". - * @param translate true if boolean data is translated; false otherwise. - * The default value is true. - **/ - public void setTranslateBoolean(boolean translate) - { - String property = "translateBoolean"; - - Boolean oldValue = new Boolean(isTranslateBoolean()); - Boolean newValue = new Boolean(translate); - - if (translate) - properties_.setString(JDProperties.TRANSLATE_BOOLEAN, TRUE_); - else - properties_.setString(JDProperties.TRANSLATE_BOOLEAN, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + translate); - } - - - /** - * Indicates whether blocking should be used for updates and delete. - * @param value true if blocking is used for updates and deletes. - * The default value is false. - **/ - public void setUseBlockUpdate(boolean value) - { - String property = JDProperties.DO_UPDATE_DELETE_BLOCKING_ ; - Boolean oldValue = new Boolean(isUseBlockUpdate()); - Boolean newValue = new Boolean(value); - - if (value) - properties_.setString(JDProperties.DO_UPDATE_DELETE_BLOCKING, TRUE_); - else - properties_.setString(JDProperties.DO_UPDATE_DELETE_BLOCKING, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + value); - } - - - /** - * Sets the database user. - * @param user The user. - **/ - public void setUser(String user) - { - String property = "user"; - - String old = getUser(); - - // save away the user to serialize // @F0A - serialUserName_ = user; // @F0A - - try - { - as400_.setUserId(user); - } - catch (PropertyVetoException vp) - { /* ignore */ - } - - changes_.firePropertyChange(property, old, user); - - logProperty ("user", as400_.getUserId()); - } - - //@K54 - /** - * Specifies whether variable-length fields should be compressed. - * @param compress true if variable-length fields should be compressed; false otherwise. - * The default value is true. - **/ - public void setVariableFieldCompression(boolean compress) - { - String property = "variableFieldCompression"; - - Boolean oldValue = new Boolean(isVariableFieldCompression()); - Boolean newValue = new Boolean(compress); - - if (compress) - properties_.setString(JDProperties.VARIABLE_FIELD_COMPRESSION, TRUE_); - else - properties_.setString(JDProperties.VARIABLE_FIELD_COMPRESSION, FALSE_); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + compress); - } - - // @F1A Added the below methods to set socket options - /** - * Gets the socket keepalive option. - * @return The value of the socket keepalive option. - **/ - public boolean getKeepAlive() - { - return sockProps_.isKeepAlive(); - } - - /** - * Gets the socket receive buffer size option. NOTE: This does not get - * the actual receive buffer size, only the option which is used as a hint - * by the underlying socket code. - * @return The value of the socket receive buffer size option. - **/ - public int getReceiveBufferSize() - { - return sockProps_.getReceiveBufferSize(); - } - - /** - * Gets the socket send buffer size option. NOTE: This does not get - * the actual send buffer size, only the option which is used as a hint - * by the underlying socket code. - * @return The value of the socket send buffer size option. - **/ - public int getSendBufferSize() - { - return sockProps_.getSendBufferSize(); - } - - /** - * Gets the socket linger option in seconds. - * @return The value of the socket linger option. - **/ - public int getSoLinger() - { - return sockProps_.getSoLinger(); - } - - /** - * Gets the socket timeout option in milliseconds. - * @return The value of the socket timeout option. - **/ - public int getSoTimeout() - { - return sockProps_.getSoTimeout(); - } - - /** - * Gets the socket TCP no delay option. - * @return The value of the socket TCP no delay option. - **/ - public boolean getTcpNoDelay() - { - return sockProps_.isTcpNoDelay(); - } - - /** - * This property allows the turning on of socket keep alive. - * @param keepAlive The keepalive option value. - **/ - public void setKeepAlive(boolean keepAlive) - { - sockProps_.setKeepAlive(keepAlive); - } - - /** - * This property sets the receive buffer size socket option to the - * specified value. The receive buffer size option is used as a hint - * for the size to set the underlying network I/O buffers. Increasing - * the receive buffer size can increase the performance of network - * I/O for high-volume connection, while decreasing it can help reduce - * the backlog of incoming data. This value must be greater than 0. - * @param size The socket receive buffer size option value. - **/ - public void setReceiveBufferSize(int size) - { - sockProps_.setReceiveBufferSize(size); - } - - /** - * This property sets the send buffer size socket option to the - * specified value. The send buffer size option is used by the - * platform's networking code as a hint for the size to set the - * underlying network I/O buffers. This value must be greater - * than 0. - * @param size The socket send buffer size option value. - **/ - public void setSendBufferSize(int size) - { - sockProps_.setSendBufferSize(size); - } - - /** - * This property allows the turning on of socket linger with the - * specified linger time in seconds. The maxium value for this - * property is platform specific. - * @param seconds The socket linger option value. - **/ - public void setSoLinger(int seconds) - { - sockProps_.setSoLinger(seconds); - } - - /** - * This property enables/disables socket timeout with the - * specified value in milliseconds. A timeout value must be - * greater than zero, a value of zero for this property indicates - * infinite timeout. - * @param milliseconds The socket timeout option value. - **/ - public void setSoTimeout(int milliseconds) - { - sockProps_.setSoTimeout(milliseconds); - } - - //@STIMEOUT - /** - * This property enables/disables socket timeout with the - * specified value in milliseconds. A timeout value must be - * greater than zero, a value of zero for this property indicates - * infinite timeout. - * @param milliseconds The socket timeout option value. - **/ - public void setSocketTimeout(int milliseconds) - { - setSoTimeout(milliseconds); - } - - /** - * This property allows the turning on of the TCP no delay socket option. - * @param noDelay The socket TCP no delay option value. - **/ - public void setTcpNoDelay(boolean noDelay) - { - sockProps_.setTcpNoDelay(noDelay); - } - // @F1A End of new socket option methods - - // @M0A - added support for sending statements in UTF-16 and storing them in a UTF-16 package - /** - * Gets the package CCSID property, which indicates the - * CCSID in which statements are sent to the IBM i system and - * also the CCSID of the package they are stored in. - * Default value: 13488 - * @return The value of the package CCSID property. - **/ - public int getPackageCCSID() - { - return properties_.getInt(JDProperties.PACKAGE_CCSID); - } - - //@dup - /** - * Gets the package CCSID property, which indicates the - * CCSID in which statements are sent to the IBM i system and - * also the CCSID of the package they are stored in. - * Default value: 13488 - * @return The value of the package CCSID property. - * Note: this method is the same as getPackageCCSID() so that it corresponds to the connection property name - **/ - public int getPackageCcsid() - { - return getPackageCCSID(); - } - - // @M0A - /** - * Sets the package CCSID property, which indicates the - * CCSID in which statements are sent to the IBM i system and - * also the CCSID of the package they are stored in. - * Recommended values: 1200(UTF-16) and 13488 (UCS-2). - * See BidiStringType for Bidi considerations. - * Default value: 13488 - * @param ccsid The package CCSID. - **/ - public void setPackageCCSID(int ccsid) - { - String property = "packageCCSID"; - - Integer oldPackageCCSID = new Integer(getPackageCCSID()); - Integer newPackageCCSID = new Integer(ccsid); - - validateProperty(property, newPackageCCSID.toString(), JDProperties.PACKAGE_CCSID); - - properties_.setString(JDProperties.PACKAGE_CCSID, newPackageCCSID.toString()); - - changes_.firePropertyChange(property, oldPackageCCSID, newPackageCCSID); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + ccsid); - } - - //@dup - /** - * Sets the package CCSID property, which indicates the - * CCSID in which statements are sent to the IBM i system and - * also the CCSID of the package they are stored in. - * Recommended values: 1200(UTF-16) and 13488 (UCS-2). - * See BidiStringType for Bidi considerations. - * Default value: 13488 - * @param ccsid The package CCSID. - * Note: this method is the same as setPackageCCSID() so that it corresponds to the connection property name - **/ - public void setPackageCcsid(int ccsid) - { - setPackageCCSID(ccsid); - } - - // @M0A - added support for 63 digit decimal precision - /** - * Gets the minimum divide scale property. This property ensures the scale - * of the result of decimal division is never less than its specified value. - * Valid values: 0-9. 0 is default. - * @return The minimum divide scale. - **/ - public int getMinimumDivideScale() - { - return properties_.getInt(JDProperties.MINIMUM_DIVIDE_SCALE); - } - - /** - * Gets the maximum block input rows. This property indicates the - * number of rows sent to the database engine for a block insert - * operation. Valid values: 1-32000. 32000 is default. - * @return The maximum block input rows - */ - public int getMaximumBlockedInputRows() { - return properties_.getInt(JDProperties.MAXIMUM_BLOCKED_INPUT_ROWS); - } - - // @M0A - /** - * Gets the maximum precision property. This property indicates the - * maximum decimal precision the IBM i system should use. - * Valid values: 31 or 63. 31 is default. - * @return The maximum precision. - **/ - public int getMaximumPrecision() - { - return properties_.getInt(JDProperties.MAXIMUM_PRECISION); - } - - // @M0A - /** - * Gets the maximum scale property. This property indicates the - * maximum decimal scale the IBM i system should use. - * Valid values: 0-63. 31 is default. - * @return The maximum scale. - **/ - public int getMaximumScale() - { - return properties_.getInt(JDProperties.MAXIMUM_SCALE); - } - - // @M0A - /** - * Sets the minimum divide scale property. This property ensures the scale - * of the result of decimal division is never less than its specified value. - * Valid values: 0-9. 0 is default. - * @param scale The minimum divide scale. - **/ - public void setMinimumDivideScale(int scale) - { - String property = "minimumDivideScale"; - - Integer oldValue = new Integer(getMinimumDivideScale()); - Integer newValue = new Integer(scale); - - validateProperty(property, newValue.toString(), JDProperties.MINIMUM_DIVIDE_SCALE); - - properties_.setString(JDProperties.MINIMUM_DIVIDE_SCALE, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + scale); - } - - // @A6A - /** - * Sets the maximum blocked input rows. This property indicates the - * maximum number of rows sent to the database engine for a blocked - * input operation. Valid values: 1-32000. 32000 is the default - * @param maximumBlockedInputRows The maximum number of input rows - */ - public void setMaximumBlockedInputRows(int maximumBlockedInputRows) - { - String property = "maximumBlockedInputRows"; - - Integer oldValue = new Integer(getMaximumBlockedInputRows()); - Integer newValue = new Integer(maximumBlockedInputRows); - - if (maximumBlockedInputRows < 0 || maximumBlockedInputRows > 32000) { - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (maximumBlockedInputRows == 0) { - maximumBlockedInputRows = 32000; - } - - properties_.setString(JDProperties.MAXIMUM_BLOCKED_INPUT_ROWS, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + maximumBlockedInputRows); - } - - - // @M0A - /** - * Sets the maximum precision property. This property indicates the - * maximum decimal precision the IBM i system should use. - * Valid values: 31 or 63. 31 is default. - * @param precision The maximum precision. - **/ - public void setMaximumPrecision(int precision) - { - String property = "maximumPrecision"; - - Integer oldValue = new Integer(getMaximumPrecision()); - Integer newValue = new Integer(precision); - - validateProperty(property, newValue.toString(), JDProperties.MAXIMUM_PRECISION); - - properties_.setString(JDProperties.MAXIMUM_PRECISION, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + precision); - } - - // @M0A - /** - * Sets the maximum scale property. This property indicates the - * maximum decimal scale the IBM i system should use. - * Valid values: 0-63. 31 is default. - * @param scale The maximum scale. - **/ - public void setMaximumScale(int scale) - { - String property = "maximumScale"; - - Integer oldValue = new Integer(getMaximumScale()); - Integer newValue = new Integer(scale); - - // validate the new value - validateProperty(property, newValue.toString(), JDProperties.MAXIMUM_SCALE); - - properties_.setString(JDProperties.MAXIMUM_SCALE, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + scale); - } - - // @M0A - added support for hex constant parser option - /** - * Gets the translate hex property, which indicates how - * the parser will treat hexadecimal literals. - * @return The value of the translate hex property. - *

        Valid values include: - *

          - *
        • "character" (Interpret hexadecimal constants as character data) - *
        • "binary" (Interpret hexadecimal constants as binary data) - *
        - * The default value is "character". - **/ - public String getTranslateHex() - { - return properties_.getString(JDProperties.TRANSLATE_HEX); - } - - // @M0A - /** - * Sets the translate hex property, which indicates how - * the parser will treat hexadecimal literals. - * @param parseOption The hex constant parser option. - *

        Valid values include: - *

          - *
        • "character" (Interpret hexadecimal constants as character data) - *
        • "binary" (Interpret hexadecimal constants as binary data) - *
        - * The default value is "character". - **/ - public void setTranslateHex(String parseOption) - { - String property = "translateHex"; - - String oldOption = getTranslateHex(); - String newOption = parseOption; - - validateProperty(property, newOption, JDProperties.TRANSLATE_HEX); - - properties_.setString(JDProperties.TRANSLATE_HEX, newOption); - - changes_.firePropertyChange(property, oldOption, newOption); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + parseOption); - } - - //@K3A - /** - * Sets the QAQQINI library name. - * @param libraryName The QAQQINI library name. - **/ - public void setQaqqiniLibrary(String libraryName) - { - String property = "qaqqiniLibrary"; - if (libraryName == null) - throw new NullPointerException(property); - - String old = getQaqqiniLibrary(); - properties_.setString(JDProperties.QAQQINILIB, libraryName); - - changes_.firePropertyChange(property, old, libraryName); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + libraryName); - } - - //@dup - /** - * Sets the QAQQINI library name. - * @param libraryName The QAQQINI library name. - * Note: this method is the same as setQaqqiniLibrary() so that it corresponds to the connection property name - **/ - public void setQaqqinilib(String libraryName) - { - setQaqqiniLibrary(libraryName); - } - - /** - * Sets the goal the IBM i system should use with optimization of queries. - * This setting corresponds with the system's QAQQINI option called OPTIMIZATION_GOAL. - * Note, this setting is ignored when running to V5R3 IBM i or earlier - * @param goal - the optimization goal - *

        Valid values include: - *

          - *
        • 0 = Optimize query for first block of data (*ALLIO) when extended dynamic packages are used; Optimize query for entire result set (*FIRSTIO) when packages are not used
        • - *
        • 1 = Optimize query for first block of data (*FIRSTIO)
        • - *
        • 2 = Optimize query for entire result set (*ALLIO)
        • - *
        - * The default value is 0. - **/ - public void setQueryOptimizeGoal(int goal) - { - String property = "queryOptimizeGoal"; - - Integer oldValue = new Integer(getQueryOptimizeGoal()); - Integer newValue = new Integer(goal); - - properties_.setString(JDProperties.QUERY_OPTIMIZE_GOAL, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + goal); - } - - //@550 - /** - * Sets the storage limit in megabytes, that should be used for statements executing a query in a connection. - * Note, this setting is ignored when running to i5/OS V5R4 or earlier - * You must have *JOBCTL special authority to use query storage limit with Version 6 Release 1 of IBM i. - * @param limit the storage limit (in megabytes) - *

        Valid values are -1 to MAX_STORAGE_LIMIT megabytes. - * The default value is -1 meaning there is no limit. - **/ - public void setQueryStorageLimit(int limit) - { - String property = "queryStorageLimit"; - - if (limit < -1 || limit > MAX_STORAGE_LIMIT) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - Integer oldValue = new Integer(getQueryStorageLimit()); - Integer newValue = new Integer(limit); - - properties_.setString(JDProperties.QUERY_STORAGE_LIMIT, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + limit); - } - - //@540 - /** - * Sets whether lock sharing is allowed for loosely coupled transaction branches. - * Note, this setting is ignored when running to V5R3 IBM i or earlier. - * @param lcs - the "loosely coupled support" setting - *

        Valid values include: - *

          - *
        • 0 = Locks cannot be shared
        • - *
        • 1 = Locks can be shared
        • - *
        - * The default value is 0. - **/ - public void setXALooselyCoupledSupport(int lcs) - { - String property = "xaLooselyCoupledSupport"; - - Integer oldValue = new Integer(getXALooselyCoupledSupport()); - Integer newValue = new Integer(lcs); - - properties_.setString(JDProperties.XA_LOOSELY_COUPLED_SUPPORT, newValue.toString()); - - changes_.firePropertyChange(property, oldValue, newValue); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + lcs); - } - - //K2A - /** - * Returns the toolbox trace category. - * @return The toolbox trace category. - *

        Valid values include: - *

          - *
        • "none" - The default value. - *
        • "datastream" - *
        • "diagnostic" - *
        • "error" - *
        • "information" - *
        • "warning" - *
        • "conversion" - *
        • "proxy" - *
        • "pcml" - *
        • "jdbc" - *
        • "all" - *
        • "thread" - *
        - **/ - public String getToolboxTraceCategory() - { - return properties_.getString(JDProperties.TRACE_TOOLBOX); - } - - //@dup - /** - * Returns the toolbox trace category. - * @return The toolbox trace category. - *

        Valid values include: - *

          - *
        • "none" - The default value. - *
        • "datastream" - *
        • "diagnostic" - *
        • "error" - *
        • "information" - *
        • "warning" - *
        • "conversion" - *
        • "proxy" - *
        • "pcml" - *
        • "jdbc" - *
        • "all" - *
        • "thread" - *
        - * Note: this method is the same as getToolboxTraceCategory() so that it corresponds to the connection property name - **/ - public String getToolboxTrace() - { - return getToolboxTraceCategory(); - } - - // @K2A - /** - * Sets the toolbox trace category, which indicates - * what trace points and diagnostic messages should be logged. - * @param traceCategory The category option. - *

        Valid values include: - *

          - *
        • "none" - *
        • "datastream" - *
        • "diagnostic" - *
        • "error" - *
        • "information" - *
        • "warning" - *
        • "conversion" - *
        • "proxy" - *
        • "pcml" - *
        • "jdbc" - *
        • "all" - *
        • "thread" - *
        - * The default value is "none". - **/ - public void setToolboxTraceCategory(String traceCategory) - { - String property = "toolboxTrace"; - - String oldOption = getToolboxTraceCategory(); - String newOption = traceCategory; - - validateProperty(property, newOption, JDProperties.TRACE_TOOLBOX); - - properties_.setString(JDProperties.TRACE_TOOLBOX, newOption); - - changes_.firePropertyChange(property, oldOption, newOption); - - if(!traceCategory.equals("") && !traceCategory.equals("none")) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - if(traceCategory.equals("datastream")) - Trace.setTraceDatastreamOn(true); - else if(traceCategory.equals("diagnostic")) - Trace.setTraceDiagnosticOn(true); - else if(traceCategory.equals("error")) - Trace.setTraceErrorOn(true); - else if(traceCategory.equals("information")) - Trace.setTraceInformationOn(true); - else if(traceCategory.equals("warning")) - Trace.setTraceWarningOn(true); - else if(traceCategory.equals("conversion")) - Trace.setTraceConversionOn(true); - else if(traceCategory.equals("proxy")) - Trace.setTraceProxyOn(true); - else if(traceCategory.equals("pcml")) - Trace.setTracePCMLOn(true); - else if(traceCategory.equals("jdbc")) - Trace.setTraceJDBCOn(true); - else if(traceCategory.equals("all")) - Trace.setTraceAllOn(true); - else if(traceCategory.equals("thread")) - Trace.setTraceThreadOn(true); - } - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, property + ": " + traceCategory); - } - - //@dup - /** - * Sets the toolbox trace category, which indicates - * what trace points and diagnostic messages should be logged. - * @param traceCategory The category option. - *

        Valid values include: - *

          - *
        • "none" - *
        • "datastream" - *
        • "diagnostic" - *
        • "error" - *
        • "information" - *
        • "warning" - *
        • "conversion" - *
        • "proxy" - *
        • "pcml" - *
        • "jdbc" - *
        • "all" - *
        • "thread" - *
        - * The default value is "none". - * Note: this method is the same as setToolboxTraceCategory() so that it corresponds to the connection property name - **/ - public void setToolboxTrace(String traceCategory) - { - setToolboxTraceCategory(traceCategory); - } - - /** - * Validates the property value. - * @param property The property name. - * @param value The property value. - * @param index The property index. - **/ - private void validateProperty(String property, String value, int index) - { - if (value.length() != 0) - { // @A7A - DriverPropertyInfo[] info = properties_.getInfo(); - String[] choices = info[index].choices; - - //Bidi-HCG start - //exception for "package ccsid" - it can accept any integer - if(index == JDProperties.PACKAGE_CCSID){ - try{ - int ccsid = Integer.valueOf(value).intValue(); - if(ccsid < 1) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - return; - }catch(NumberFormatException e){ - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - //Bidi-HCG end - - boolean notValid = true; - int current = 0; - while (notValid && current < choices.length) - { - if (value.equalsIgnoreCase(choices[current])) - notValid = false; - else - current++; - } - if (notValid) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } // @A7A - } - - /** - * Serializes the IBM i system and user information. - * @param out The output stream. - * @exception IOException If a file I/O error occurs. - **/ - private void writeObject(ObjectOutputStream out) throws IOException - { - Trace.log(Trace.INFORMATION, "AS400JDBCDataSource.writeObject"); - // @F0D String server = getServerName(); - // @F0D if (!server.equals("")) - // @F0D serialServerName_ = server; - - // @F0D String user = getUser(); - // @F0D if (!user.equals("")) - // @F0D serialUserName_ = user; - - if (!savePasswordWhenSerialized_) //@J3a - { //@J3a - serialPWBytes_ = null; //@J3a - serialKeyRingPWBytes_ = null; //@J3a - } //@J3a - - // Serialize the object. - out.defaultWriteObject(); - } - - /** - * Returns the string representation of the object. - * @return The string representation. - **/ - public String toString() - { - /* - * Implementation note: Used only for tracing information. - */ - String name = getDataSourceName(); - if (name == null) - name = ""; - return name; - } - - // @J3 new method. - // Twiddle password bytes. - private static char[] xpwConfuse(String info) - { - Random rng = new Random(); - byte[] adderBytes = new byte[18]; - rng.nextBytes(adderBytes); - char[] adder = BinaryConverter.byteArrayToCharArray(adderBytes); - - byte[] maskBytes = new byte[14]; - rng.nextBytes(maskBytes); - char[] mask = BinaryConverter.byteArrayToCharArray(maskBytes); - - char[] infoBytes = xencode(adder, mask, info.toCharArray()); - char[] returnBytes = new char[info.length() + 16]; - System.arraycopy(adder, 0, returnBytes, 0, 9); - System.arraycopy(mask, 0, returnBytes, 9, 7); - System.arraycopy(infoBytes, 0, returnBytes, 16, info.length()); - - return returnBytes; - } - - // @J3 new method. - // Get clear password bytes back. - private static String xpwDeconfuse(char[] info) - { - char[] adder = new char[9]; - System.arraycopy(info, 0, adder, 0, 9); - char[] mask = new char[7]; - System.arraycopy(info, 9, mask, 0, 7); - char[] infoBytes = new char[info.length - 16]; - System.arraycopy(info, 16, infoBytes, 0, info.length - 16); - - return new String(xdecode(adder, mask, infoBytes)); - } - - // @J3 new method - // Scramble some bytes. - private static char[] xencode(char[] adder, char[] mask, char[] bytes) - { - if (bytes == null) return null; - int length = bytes.length; - char[] buf = new char[length]; - for (int i = 0; i < length; ++i) - { - buf[i] = (char)(bytes[i] + adder[i % 9]); - } - for (int i = 0; i < length; ++i) - { - buf[i] = (char)(buf[i] ^ mask[i % 7]); - } - return buf; - } - - - // @J3 new method. - private static char[] xdecode(char[] adder, char[] mask, char[] bytes) - { - int length = bytes.length; - char[] buf = new char[length]; - for (int i = 0; i < length; ++i) - { - buf[i] = (char)(mask[i % 7] ^ bytes[i]); - } - for (int i = 0; i < length; ++i) - { - buf[i] = (char)(buf[i] - adder[i % 9]); - } - return buf; - } - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCDataSource", "javax.sql.DataSource" }; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCDataSource16.gif b/cvsroot/src/com/ibm/as400/access/AS400JDBCDataSource16.gif deleted file mode 100644 index 6c94d45cd..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400JDBCDataSource16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCDataSource32.gif b/cvsroot/src/com/ibm/as400/access/AS400JDBCDataSource32.gif deleted file mode 100644 index a5ed2163e..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400JDBCDataSource32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCDataSourceBeanInfo.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCDataSourceBeanInfo.java deleted file mode 100644 index c2c9bccea..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCDataSourceBeanInfo.java +++ /dev/null @@ -1,699 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCDataSourceBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - - -/** -* The AS400JDBCDataSourceBeanInfo class provides bean information -* for the AS400JDBCDataSource class. -**/ -public class AS400JDBCDataSourceBeanInfo extends SimpleBeanInfo -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = AS400JDBCDataSource.class; - - // Handles loading the appropriate resource bundle - // private static ResourceBundleLoader loader_; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = { changed}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor access = new PropertyDescriptor("access", beanClass, "getAccess", "setAccess"); - access.setBound(true); - access.setConstrained(false); - access.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_ACCESS")); - access.setShortDescription(AS400JDBCDriver.getResource("ACCESS_DESC")); - - PropertyDescriptor behaviorOverride = new PropertyDescriptor("behaviorOverride", beanClass, "getBehaviorOverride", "setBehaviorOverride"); // @J7A - behaviorOverride.setBound(true); // @J7A - behaviorOverride.setConstrained(false); // @J7A - behaviorOverride.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_BEHAVIOR_OVERRIDE")); // @J7A - behaviorOverride.setShortDescription(AS400JDBCDriver.getResource("BEHAVIOR_OVERRIDE_DESC")); // @J7A - - PropertyDescriptor bidiStringType = new PropertyDescriptor("bidiStringType", beanClass, "getBidiStringType", "setBidiStringType"); // @A3A - bidiStringType.setBound(true); // @A3A - bidiStringType.setConstrained(false); // @A3A - bidiStringType.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_BIDI_STRING_TYPE")); // @A3A - bidiStringType.setShortDescription(AS400JDBCDriver.getResource("BIDI_STRING_TYPE_DESC")); // @A3A - - PropertyDescriptor bidiImplicitReordering = new PropertyDescriptor("bidiImplicitReordering", beanClass, "isBidiImplicitReordering", "setBidiImplicitReordering"); // @K24 - bidiImplicitReordering.setBound(true); //@K24 - bidiImplicitReordering.setConstrained(false); //@K24 - bidiImplicitReordering.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_BIDI_IMPLICIT_REORDERING")); //@K24 - bidiImplicitReordering.setShortDescription(AS400JDBCDriver.getResource("BIDI_IMPLICIT_REORDERING_DESC")); //@K24 - - PropertyDescriptor bidiNumericOrdering = new PropertyDescriptor("bidiNumericOrdering", beanClass, "isBidiNumericOrdering", "setBidiNumericOrdering"); // @K24 - bidiNumericOrdering.setBound(true); //@K24 - bidiNumericOrdering.setConstrained(false); //@K24 - bidiNumericOrdering.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_BIDI_NUMERIC_ORDERING")); //@K24 - bidiNumericOrdering.setShortDescription(AS400JDBCDriver.getResource("BIDI_NUMERIC_ORDERING_DESC")); //@K24 - - PropertyDescriptor bigDecimal = new PropertyDescriptor("bigDecimal", beanClass, "isBigDecimal", "setBigDecimal"); - bigDecimal.setBound(true); - bigDecimal.setConstrained(false); - bigDecimal.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_BIG_DECIMAL")); - bigDecimal.setShortDescription(AS400JDBCDriver.getResource("BIG_DECIMAL_DESC")); - - PropertyDescriptor blockCriteria = new PropertyDescriptor("blockCriteria", beanClass, "getBlockCriteria", "setBlockCriteria"); - blockCriteria.setBound(true); - blockCriteria.setConstrained(false); - blockCriteria.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_BLOCK_CRITERIA")); - blockCriteria.setShortDescription(AS400JDBCDriver.getResource("BLOCK_CRITERIA_DESC")); - - PropertyDescriptor blockSize = new PropertyDescriptor("blockSize", beanClass, "getBlockSize", "setBlockSize"); - blockSize.setBound(true); - blockSize.setConstrained(false); - blockSize.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_BLOCK_SIZE")); - blockSize.setShortDescription(AS400JDBCDriver.getResource("BLOCK_SIZE_DESC")); - - PropertyDescriptor cursorHold = new PropertyDescriptor("cursorHold", beanClass, "isCursorHold", "setCursorHold"); - cursorHold.setBound(true); - cursorHold.setConstrained(false); - cursorHold.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_CURSOR_HOLD")); - cursorHold.setShortDescription(AS400JDBCDriver.getResource("CURSOR_HOLD_DESC")); - - PropertyDescriptor cursorSensitivity = new PropertyDescriptor("cursorSensitivity", beanClass, "getCursorSensitivity", "setCursorSensitivity"); // @J6A - cursorSensitivity.setBound(true); // @J6A - cursorSensitivity.setConstrained(false); // @J6A - cursorSensitivity.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_CURSOR_SENSITIVITY")); // @J6A - cursorSensitivity.setShortDescription(AS400JDBCDriver.getResource("CURSOR_SENSITIVITY_DESC")); // @J6A - - PropertyDescriptor databaseName = new PropertyDescriptor("databaseName", beanClass, "getDatabaseName", "setDatabaseName"); - databaseName.setBound(true); - databaseName.setConstrained(false); - databaseName.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_DATABASE_NAME")); - databaseName.setShortDescription(AS400JDBCDriver.getResource("DATABASE_NAME_DESC")); - - PropertyDescriptor dataCompression = new PropertyDescriptor("dataCompression", beanClass, "isDataCompression", "setDataCompression"); - dataCompression.setBound(true); - dataCompression.setConstrained(false); - dataCompression.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_DATA_COMPRESSION")); - dataCompression.setShortDescription(AS400JDBCDriver.getResource("DATA_COMPRESSION_DESC")); - - PropertyDescriptor dataSourceName = new PropertyDescriptor("dataSourceName", beanClass, "getDataSourceName", "setDataSourceName"); - dataSourceName.setBound(true); - dataSourceName.setConstrained(false); - dataSourceName.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_DATASOURCE_NAME")); - dataSourceName.setShortDescription(AS400JDBCDriver.getResource("DATASOURCE_NAME_DESC")); - - PropertyDescriptor dataTruncation = new PropertyDescriptor("dataTruncation", beanClass, "isDataTruncation", "setDataTruncation"); - dataTruncation.setBound(true); - dataTruncation.setConstrained(false); - dataTruncation.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_DATA_TRUNCATION")); - dataTruncation.setShortDescription(AS400JDBCDriver.getResource("DATA_TRUNCATION_DESC")); - - PropertyDescriptor dateFormat = new PropertyDescriptor("dateFormat", beanClass, "getDateFormat", "setDateFormat"); - dateFormat.setBound(true); - dateFormat.setConstrained(false); - dateFormat.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_DATE_FORMAT")); - dateFormat.setShortDescription(AS400JDBCDriver.getResource("DATE_FORMAT_DESC")); - - PropertyDescriptor dateSeparator = new PropertyDescriptor("dateSeparator", beanClass, "getDateSeparator", "setDateSeparator"); - dateSeparator.setBound(true); - dateSeparator.setConstrained(false); - dateSeparator.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_DATE_SEPARATOR")); - dateSeparator.setShortDescription(AS400JDBCDriver.getResource("DATE_SEPARATOR_DESC")); - - PropertyDescriptor decimalSeparator = new PropertyDescriptor("decimalSeparator", beanClass, "getDecimalSeparator", "setDecimalSeparator"); - decimalSeparator.setBound(true); - decimalSeparator.setConstrained(false); - decimalSeparator.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_DECIMAL_SEPARATOR")); - decimalSeparator.setShortDescription(AS400JDBCDriver.getResource("DECIMAL_SEPARATOR_DESC")); - - PropertyDescriptor description = new PropertyDescriptor("description", beanClass, "getDescription", "setDescription"); - description.setBound(true); - description.setConstrained(false); - description.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_DESCRIPTION")); - description.setShortDescription(AS400JDBCDriver.getResource("DESCRIPTION_DESC")); - - PropertyDescriptor driver = new PropertyDescriptor("driver", beanClass, "getDriver", "setDriver"); // @A2A - driver.setBound(true); // @A2A - driver.setConstrained(false); // @A2A - driver.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_DRIVER")); // @A2A - driver.setShortDescription(AS400JDBCDriver.getResource("DRIVER_DESC")); // @A2A - - PropertyDescriptor errors = new PropertyDescriptor("errors", beanClass, "getErrors", "setErrors"); - errors.setBound(true); - errors.setConstrained(false); - errors.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_ERRORS")); - errors.setShortDescription(AS400JDBCDriver.getResource("ERRORS_DESC")); - - PropertyDescriptor extendedDynamic = new PropertyDescriptor("extendedDynamic", beanClass, "isExtendedDynamic", "setExtendedDynamic"); - extendedDynamic.setBound(true); - extendedDynamic.setConstrained(false); - extendedDynamic.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_EXTENDED_DYNAMIC")); - extendedDynamic.setShortDescription(AS400JDBCDriver.getResource("EXTENDED_DYNAMIC_DESC")); - - PropertyDescriptor extendedMetaData = new PropertyDescriptor("extendedMetaData", beanClass, "isExtendedMetaData", "setExtendedMetaData"); // @J2A - extendedMetaData.setBound(true); // @J2A - extendedMetaData.setConstrained(false); // @J2A - extendedMetaData.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_EXTENDED_METADATA")); // @J2A - extendedMetaData.setShortDescription(AS400JDBCDriver.getResource("EXTENDED_METADATA_DESC")); // @J2A - - PropertyDescriptor fullOpen = new PropertyDescriptor("fullOpen", beanClass, "isFullOpen", "setFullOpen"); // @W1A - fullOpen.setBound(true); // @W1A - fullOpen.setConstrained(false); // @W1A - fullOpen.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_FULL_OPEN")); // @W1A - fullOpen.setShortDescription(AS400JDBCDriver.getResource("FULL_OPEN_DESC")); // @W1A - - //@KBL Added support to specify if input locators should be allocated as type hold or not hold - PropertyDescriptor holdLocators = new PropertyDescriptor("holdInputLocators", beanClass, "isHoldInputLocators", "setHoldInputLocators"); //@KBL - holdLocators.setBound(true); //@KBL - holdLocators.setConstrained(false); //@KBL - holdLocators.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_HOLD_LOCATORS")); //@KBL - holdLocators.setShortDescription(AS400JDBCDriver.getResource("HOLD_LOCATORS_DESC")); //@KBL - - PropertyDescriptor holdStatements = new PropertyDescriptor("holdStatements", beanClass, "isHoldStatements", "setHoldStatements"); // @KBL - holdStatements.setBound(true); // @KBL - holdStatements.setConstrained(false); // @KBL - holdStatements.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_HOLD_STATEMENTS")); // @KBL - holdStatements.setShortDescription(AS400JDBCDriver.getResource("HOLD_STATEMENTS_DESC")); // @KBL - - PropertyDescriptor lazyClose = new PropertyDescriptor("lazyClose", beanClass, "isLazyClose", "setLazyClose"); // @A1A - lazyClose.setBound(true); // @A1A - lazyClose.setConstrained(false); // @A1A - lazyClose.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_LAZY_CLOSE")); // @A1A - lazyClose.setShortDescription(AS400JDBCDriver.getResource("LAZY_CLOSE_DESC")); // @A1A - - PropertyDescriptor libraries = new PropertyDescriptor("libraries", beanClass, "getLibraries", "setLibraries"); - libraries.setBound(true); - libraries.setConstrained(false); - libraries.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_LIBRARIES")); - libraries.setShortDescription(AS400JDBCDriver.getResource("LIBRARIES_DESC")); - - PropertyDescriptor lobThreshold = new PropertyDescriptor("lobThreshold", beanClass, "getLobThreshold", "setLobThreshold"); - lobThreshold.setBound(true); - lobThreshold.setConstrained(false); - lobThreshold.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_LOB_THRESHOLD")); - lobThreshold.setShortDescription(AS400JDBCDriver.getResource("LOB_THRESHOLD_DESC")); - - PropertyDescriptor naming = new PropertyDescriptor("naming", beanClass, "getNaming", "setNaming"); - naming.setBound(true); - naming.setConstrained(false); - naming.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_NAMING")); - naming.setShortDescription(AS400JDBCDriver.getResource("NAMING_DESC")); - - PropertyDescriptor packageName = new PropertyDescriptor("package", beanClass, "getPackage", "setPackage"); - packageName.setBound(true); - packageName.setConstrained(false); - packageName.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_PACKAGE")); - packageName.setShortDescription(AS400JDBCDriver.getResource("PACKAGE_DESC")); - - PropertyDescriptor packageAdd = new PropertyDescriptor("packageAdd", beanClass, "isPackageAdd", "setPackageAdd"); - packageAdd.setBound(true); - packageAdd.setConstrained(false); - packageAdd.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_PACKAGE_ADD")); - packageAdd.setShortDescription(AS400JDBCDriver.getResource("PACKAGE_ADD_DESC")); - - PropertyDescriptor packageCache = new PropertyDescriptor("packageCache", beanClass, "isPackageCache", "setPackageCache"); - packageCache.setBound(true); - packageCache.setConstrained(false); - packageCache.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_PACKAGE_CACHE")); - packageCache.setShortDescription(AS400JDBCDriver.getResource("PACKAGE_CACHE_DESC")); - - PropertyDescriptor packageClear = new PropertyDescriptor("packageClear", beanClass, "isPackageClear", "setPackageClear"); - packageClear.setBound(true); - packageClear.setConstrained(false); - packageClear.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_PACKAGE_CLEAR")); - packageClear.setShortDescription(AS400JDBCDriver.getResource("PACKAGE_CLEAR_DESC")); - - PropertyDescriptor packageCriteria = new PropertyDescriptor("packageCriteria", beanClass, "getPackageCriteria", "setPackageCriteria"); - packageCriteria.setBound(true); - packageCriteria.setConstrained(false); - packageCriteria.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_PACKAGE_CRITERIA")); - packageCriteria.setShortDescription(AS400JDBCDriver.getResource("PACKAGE_CRITERIA_DESC")); - - PropertyDescriptor packageError = new PropertyDescriptor("packageError", beanClass, "getPackageError", "setPackageError"); - packageError.setBound(true); - packageError.setConstrained(false); - packageError.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_PACKAGE_ERROR")); - packageError.setShortDescription(AS400JDBCDriver.getResource("PACKAGE_ERROR_DESC")); - - PropertyDescriptor packageLibrary = new PropertyDescriptor("packageLibrary", beanClass, "getPackageLibrary", "setPackageLibrary"); - packageLibrary.setBound(true); - packageLibrary.setConstrained(false); - packageLibrary.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_PACKAGE_LIBRARY")); - packageLibrary.setShortDescription(AS400JDBCDriver.getResource("PACKAGE_LIBRARY_DESC")); - - PropertyDescriptor password = new PropertyDescriptor("password", beanClass, null, "setPassword"); - password.setBound(true); - password.setConstrained(false); - password.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_PASSWORD")); - password.setShortDescription(AS400JDBCDriver.getResource("PASSWORD_DESC")); - - PropertyDescriptor prefetch = new PropertyDescriptor("prefetch", beanClass, "isPrefetch", "setPrefetch"); - prefetch.setBound(true); - prefetch.setConstrained(false); - prefetch.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_PREFETCH")); - prefetch.setShortDescription(AS400JDBCDriver.getResource("PREFETCH_DESC")); - - PropertyDescriptor prompt = new PropertyDescriptor("prompt", beanClass, "isPrompt", "setPrompt"); - prompt.setBound(true); - prompt.setConstrained(false); - prompt.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_PROMPT")); - prompt.setShortDescription(AS400JDBCDriver.getResource("PROMPT_DESC")); - - PropertyDescriptor proxyServer = new PropertyDescriptor("proxyServer", beanClass, "getProxyServer", "setProxyServer"); - proxyServer.setBound(true); - proxyServer.setConstrained(false); - proxyServer.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_PROXY_SERVER")); - proxyServer.setShortDescription(AS400JDBCDriver.getResource("PROXY_SERVER_DESC")); - - PropertyDescriptor qaqqiniLibrary = new PropertyDescriptor("qaqqiniLibrary", beanClass, "getQaqqiniLibrary", "setQaqqiniLibrary"); //@K3A - qaqqiniLibrary.setBound(true); //@K3A - qaqqiniLibrary.setConstrained(false); //@K3A - qaqqiniLibrary.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_QAQQINILIB")); //@K3A - qaqqiniLibrary.setShortDescription(AS400JDBCDriver.getResource("QAQQINILIB_DESC")); //@K3A - - - PropertyDescriptor remarks = new PropertyDescriptor("remarks", beanClass, "getRemarks", "setRemarks"); - remarks.setBound(true); - remarks.setConstrained(false); - remarks.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_REMARKS")); - remarks.setShortDescription(AS400JDBCDriver.getResource("REMARKS_DESC")); - - // @J3 New property - PropertyDescriptor savePassword = new PropertyDescriptor("savePasswordWhenSerialized", beanClass, "isSavePasswordWhenSerialized", "setSavePasswordWhenSerialized"); - savePassword.setBound(true); //@J4C - savePassword.setConstrained(false); - savePassword.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_SAVE_PASSWORD_WHEN_SERIALIZED")); - savePassword.setShortDescription(AS400JDBCDriver.getResource("SAVE_PASSWORD_WHEN_SERIALIZED")); - - PropertyDescriptor secondaryUrl = new PropertyDescriptor("secondaryUrl", beanClass, "getSecondaryUrl", "setSecondaryUrl"); - secondaryUrl.setBound(true); - secondaryUrl.setConstrained(false); - secondaryUrl.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_SECONDARY_URL")); - secondaryUrl.setShortDescription(AS400JDBCDriver.getResource("SECONDARY_URL_DESC")); - - PropertyDescriptor secure = new PropertyDescriptor("secure", beanClass, "isSecure", "setSecure"); - secure.setBound(true); - secure.setConstrained(false); - secure.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_SECURE")); - secure.setShortDescription(AS400JDBCDriver.getResource("SECURE_DESC")); - - PropertyDescriptor serverName = new PropertyDescriptor("serverName", beanClass, "getServerName", "setServerName"); - serverName.setBound(true); - serverName.setConstrained(false); - serverName.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_SERVER_NAME")); - serverName.setShortDescription(AS400JDBCDriver.getResource("SERVER_NAME_DESC")); - - PropertyDescriptor sort = new PropertyDescriptor("sort", beanClass, "getSort", "setSort"); - sort.setBound(true); - sort.setConstrained(false); - sort.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_SORT")); - sort.setShortDescription(AS400JDBCDriver.getResource("SORT_DESC")); - - PropertyDescriptor sortLanguage = new PropertyDescriptor("sortLanguage", beanClass, "getSortLanguage", "setSortLanguage"); - sortLanguage.setBound(true); - sortLanguage.setConstrained(false); - sortLanguage.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_SORT_LANGUAGE")); - sortLanguage.setShortDescription(AS400JDBCDriver.getResource("SORT_LANGUAGE_DESC")); - - PropertyDescriptor sortTable = new PropertyDescriptor("sortTable", beanClass, "getSortTable", "setSortTable"); - sortTable.setBound(true); - sortTable.setConstrained(false); - sortTable.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_SORT_TABLE")); - sortTable.setShortDescription(AS400JDBCDriver.getResource("SORT_TABLE_DESC")); - - PropertyDescriptor sortWeight = new PropertyDescriptor("sortWeight", beanClass, "getSortWeight", "setSortWeight"); - sortWeight.setBound(true); - sortWeight.setConstrained(false); - sortWeight.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_SORT_WEIGHT")); - sortWeight.setShortDescription(AS400JDBCDriver.getResource("SORT_WEIGHT_DESC")); - - PropertyDescriptor threadUsed = new PropertyDescriptor("threadUsed", beanClass, "isThreadUsed", "setThreadUsed"); - threadUsed.setBound(true); - threadUsed.setConstrained(false); - threadUsed.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_THREAD_USED")); - threadUsed.setShortDescription(AS400JDBCDriver.getResource("THREAD_USED_DESC")); - - PropertyDescriptor timeFormat = new PropertyDescriptor("timeFormat", beanClass, "getTimeFormat", "setTimeFormat"); - timeFormat.setBound(true); - timeFormat.setConstrained(false); - timeFormat.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_TIME_FORMAT")); - timeFormat.setShortDescription(AS400JDBCDriver.getResource("TIME_FORMAT_DESC")); - - PropertyDescriptor timeSeparator = new PropertyDescriptor("timeSeparator", beanClass, "getTimeSeparator", "setTimeSeparator"); - timeSeparator.setBound(true); - timeSeparator.setConstrained(false); - timeSeparator.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_TIME_SEPARATOR")); - timeSeparator.setShortDescription(AS400JDBCDriver.getResource("TIME_SEPARATOR_DESC")); - - PropertyDescriptor trace = new PropertyDescriptor("trace", beanClass, "isTrace", "setTrace"); // @w2c - trace.setBound(true); - trace.setConstrained(false); - trace.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_TRACE")); - trace.setShortDescription(AS400JDBCDriver.getResource("TRACE_DESC")); - - PropertyDescriptor traceServer = new PropertyDescriptor("serverTrace", beanClass, "getServerTraceCategories", "setServerTraceCategories"); //@J1a - traceServer.setBound(true); //@J1a - traceServer.setConstrained(false); //@J1a - traceServer.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_TRACE_SERVER")); //@J1a - traceServer.setShortDescription(AS400JDBCDriver.getResource("TRACE_SERVER_DESC")); //@J1a - - PropertyDescriptor traceServerCategories = new PropertyDescriptor("serverTraceCategories", beanClass, "getServerTraceCategories", "setServerTraceCategories"); //@K4A - traceServerCategories.setBound(true); //@K4A - traceServerCategories.setConstrained(false); //@K4A - traceServerCategories.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_TRACE_SERVER")); //@K4A - traceServerCategories.setShortDescription(AS400JDBCDriver.getResource("TRACE_SERVER_DESC")); //@K4A - - PropertyDescriptor traceToolbox = new PropertyDescriptor("toolboxTrace", beanClass, "getToolboxTraceCategory", "setToolboxTraceCategory"); //@K2A - traceToolbox.setBound(true); //@K2A - traceToolbox.setConstrained(false); //@K2A - traceToolbox.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_TRACE_TOOLBOX")); //@K2A - traceToolbox.setShortDescription(AS400JDBCDriver.getResource("TRACE_TOOLBOX_DESC")); //@K2A - - PropertyDescriptor transactionIsolation = new PropertyDescriptor("transactionIsolation", beanClass, "getTransactionIsolation", "setTransactionIsolation"); - transactionIsolation.setBound(true); - transactionIsolation.setConstrained(false); - transactionIsolation.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_TRANSACTION_ISOLATION")); - transactionIsolation.setShortDescription(AS400JDBCDriver.getResource("TRANSACTION_ISOLATION_DESC")); - - PropertyDescriptor translateBinary = new PropertyDescriptor("translateBinary", beanClass, "isTranslateBinary", "setTranslateBinary"); - translateBinary.setBound(true); - translateBinary.setConstrained(false); - translateBinary.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_TRANSLATE_BINARY")); - translateBinary.setShortDescription(AS400JDBCDriver.getResource("TRANSLATE_BINARY_DESC")); - - PropertyDescriptor user = new PropertyDescriptor("user", beanClass, "getUser", "setUser"); - user.setBound(true); - user.setConstrained(false); - user.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_USER")); - user.setShortDescription(AS400JDBCDriver.getResource("USER_DESC")); - - PropertyDescriptor keepAlive = new PropertyDescriptor("keepAlive", beanClass, "getKeepAlive", "setKeepAlive"); - keepAlive.setBound(true); - keepAlive.setConstrained(false); - keepAlive.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_KEEP_ALIVE")); - keepAlive.setShortDescription(AS400JDBCDriver.getResource("KEEP_ALIVE_DESC")); - - PropertyDescriptor loginTimeout = new PropertyDescriptor("loginTimeout", beanClass, "getLoginTimeout", "setLoginTimeout"); //@K5A - loginTimeout.setBound(true); //@K5A - loginTimeout.setConstrained(false); //@K5A - loginTimeout.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_LOGIN_TIMEOUT")); //@K5A - loginTimeout.setShortDescription(AS400JDBCDriver.getResource("LOGIN_TIMEOUT_DESC")); //@K5A - - PropertyDescriptor receiveBufferSize = new PropertyDescriptor("receiveBufferSize", beanClass, "getReceiveBufferSize", "setReceiveBufferSize"); - receiveBufferSize.setBound(true); - receiveBufferSize.setConstrained(false); - receiveBufferSize.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_RECEIVE_BUFFER_SIZE")); - receiveBufferSize.setShortDescription(AS400JDBCDriver.getResource("RECEIVE_BUFFER_SIZE_DESC")); - - PropertyDescriptor sendBufferSize = new PropertyDescriptor("sendBufferSize", beanClass, "getSendBufferSize", "setSendBufferSize"); - sendBufferSize.setBound(true); - sendBufferSize.setConstrained(false); - sendBufferSize.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_SEND_BUFFER_SIZE")); - sendBufferSize.setShortDescription(AS400JDBCDriver.getResource("SEND_BUFFER_SIZE_DESC")); - - PropertyDescriptor soLinger = new PropertyDescriptor("soLinger", beanClass, "getSoLinger", "setSoLinger"); - soLinger.setBound(true); - soLinger.setConstrained(false); - soLinger.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_SO_LINGER")); - soLinger.setShortDescription(AS400JDBCDriver.getResource("SO_LINGER_DESC")); - - PropertyDescriptor soTimeout = new PropertyDescriptor("soTimeout", beanClass, "getSoTimeout", "setSoTimeout"); - soTimeout.setBound(true); - soTimeout.setConstrained(false); - soTimeout.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_SO_TIMEOUT")); - soTimeout.setShortDescription(AS400JDBCDriver.getResource("SO_TIMEOUT_DESC")); - - PropertyDescriptor tcpNoDelay = new PropertyDescriptor("tcpNoDelay", beanClass, "getTcpNoDelay", "setTcpNoDelay"); - tcpNoDelay.setBound(true); - tcpNoDelay.setConstrained(false); - tcpNoDelay.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_TCP_NO_DELAY")); - tcpNoDelay.setShortDescription(AS400JDBCDriver.getResource("TCP_NO_DELAY_DESC")); - - // @M0A - added for UTF-16 support in the database - PropertyDescriptor packageCCSID = new PropertyDescriptor("packageCCSID", beanClass, "getPackageCCSID", "setPackageCCSID"); - packageCCSID.setBound(true); - packageCCSID.setConstrained(false); - packageCCSID.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_PACKAGE_CCSID")); - packageCCSID.setShortDescription(AS400JDBCDriver.getResource("PACKAGE_CCSID_DESC")); - - // @M0A - added for 63 digit decimal precision support - PropertyDescriptor minimumDivideScale = new PropertyDescriptor("minimumDivideScale", beanClass, "getMinimumDivideScale", "setMinimumDivideScale"); - minimumDivideScale.setBound(true); - minimumDivideScale.setConstrained(false); - minimumDivideScale.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_MINIMUM_DIVIDE_SCALE")); - minimumDivideScale.setShortDescription(AS400JDBCDriver.getResource("MINIMUM_DIVIDE_SCALE_DESC")); - - // @A6A - PropertyDescriptor maximumBlockedInputRows = new PropertyDescriptor("maximumBlockedInputRows", beanClass, "getMaximumBlockedInputRows", "setMaximumBlockedInputRows"); - maximumBlockedInputRows.setBound(true); - maximumBlockedInputRows.setConstrained(false); - maximumBlockedInputRows.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_MAXIMUM_BLOCKED_INPUT_ROWS")); - maximumBlockedInputRows.setShortDescription(AS400JDBCDriver.getResource("MAXIMUM_BLOCKED_INPUT_ROWS_DESC")); - - - - // @M0A - PropertyDescriptor maximumPrecision = new PropertyDescriptor("maximumPrecision", beanClass, "getMaximumPrecision", "setMaximumPrecision"); - maximumPrecision.setBound(true); - maximumPrecision.setConstrained(false); - maximumPrecision.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_MAXIMUM_PRECISION")); - maximumPrecision.setShortDescription(AS400JDBCDriver.getResource("MAXIMUM_PRECISION_DESC")); - - // @M0A - PropertyDescriptor maximumScale = new PropertyDescriptor("maximumScale", beanClass, "getMaximumScale", "setMaximumScale"); - maximumScale.setBound(true); - maximumScale.setConstrained(false); - maximumScale.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_MAXIMUM_SCALE")); - maximumScale.setShortDescription(AS400JDBCDriver.getResource("MAXIMUM_SCALE_DESC")); - - // @M0A - added support for hex constant parser option - PropertyDescriptor translateHex = new PropertyDescriptor("translateHex", beanClass, "getTranslateHex", "setTranslateHex"); - translateHex.setBound(true); //@K5C - translateHex.setConstrained(false); //@K5C - translateHex.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_TRANSLATE_HEX")); //@K5C - translateHex.setShortDescription(AS400JDBCDriver.getResource("TRANSLATE_HEX_DESC")); //@K5C - - // @KBA - added support for true auto commit - PropertyDescriptor trueAutoCommit = new PropertyDescriptor("trueAutoCommit", beanClass, "isTrueAutoCommit", "setTrueAutoCommit"); //@KBA //@true - trueAutoCommit.setBound(true); //@KBA //@true - trueAutoCommit.setConstrained(false); //@KBA //@true - trueAutoCommit.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_TRUE_AUTO_COMMIT")); //@KBA //@true - trueAutoCommit.setShortDescription(AS400JDBCDriver.getResource("TRUE_AUTO_COMMIT_DESC")); //@KBA //@true - - //@K94 - added support for holding a cursor across rollbacks - PropertyDescriptor rollbackCursorHold = new PropertyDescriptor("rollbackCursorHold", beanClass, "isRollbackCursorHold", "setRollbackCursorHold"); //@K94 - rollbackCursorHold.setBound(true); //@K94 - rollbackCursorHold.setConstrained(false); //@K94 - rollbackCursorHold.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_ROLLBACK_CURSOR_HOLD")); //@K94 - rollbackCursorHold.setShortDescription(AS400JDBCDriver.getResource("ROLLBACK_CURSOR_HOLD_DESC")); //@K94 - - // @K54 - added support for variable-length field compression - PropertyDescriptor variableFieldCompression = new PropertyDescriptor("variableFieldCompression", beanClass, "isVariableFieldCompression", "setVariableFieldCompression"); //@K54 - variableFieldCompression.setBound(true); //@K54 - variableFieldCompression.setConstrained(false); //@K54 - variableFieldCompression.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_VARIABLE_FIELD_COMPRESSION")); //@K54 - variableFieldCompression.setShortDescription(AS400JDBCDriver.getResource("VARIABLE_FIELD_COMPRESSION_DESC")); //@K54 - - //@540 - added support for query optimize goal - PropertyDescriptor queryOptimizeGoal = new PropertyDescriptor("queryOptimizeGoal", beanClass, "getQueryOptimizeGoal", "setQueryOptimizeGoal"); // @540 - queryOptimizeGoal.setBound(true); // @540 - queryOptimizeGoal.setConstrained(false); // @540 - queryOptimizeGoal.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_QUERY_OPTIMIZE_GOAL")); // @540 - queryOptimizeGoal.setShortDescription(AS400JDBCDriver.getResource("QUERY_OPTIMIZE_GOAL_DESC")); // @540 - - //@540 - added support for XA loosely coupled support - PropertyDescriptor xaLooselyCoupledSupport = new PropertyDescriptor("xaLooselyCoupledSupport", beanClass, "getXALooselyCoupledSupport", "setXALooselyCoupledSupport"); // @540 - xaLooselyCoupledSupport.setBound(true); // @540 - xaLooselyCoupledSupport.setConstrained(false); // @540 - xaLooselyCoupledSupport.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_XA_LOOSELY_COUPLED_SUPPORT")); // @540 - xaLooselyCoupledSupport.setShortDescription(AS400JDBCDriver.getResource("XA_LOOSELY_COUPLED_SUPPORT_DESC")); // @540 - - //@PDA - added support for Translate Boolean - PropertyDescriptor translateBoolean = new PropertyDescriptor("translateBoolean", beanClass, "isTranslateBoolean", "setTranslateBoolean"); - translateBoolean.setBound(true); - translateBoolean.setConstrained(false); - translateBoolean.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_TRANSLATE_BOOLEAN")); - translateBoolean.setShortDescription(AS400JDBCDriver.getResource("TRANSLATE_BOOLEAN_DESC")); - - //@PDA - added support for metadata source - PropertyDescriptor metaDataSource = new PropertyDescriptor("metaDataSource", beanClass, "getMetaDataSource", "setMetaDataSource"); - metaDataSource.setBound(true); //@PDC fix name - metaDataSource.setConstrained(false); //@PDC fix name - metaDataSource.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_METADATA_SOURCE")); //@PDC fix name - metaDataSource.setShortDescription(AS400JDBCDriver.getResource("METADATA_SOURCE_DESC")); //@PDC fix name - - //@550 - added support for query storage limit - PropertyDescriptor queryStorageLimit = new PropertyDescriptor("queryStorageLimit", beanClass, "getQueryStorageLimit", "setQueryStorageLimit"); //@550 - queryStorageLimit.setBound(true); //@550 - queryStorageLimit.setConstrained(false); //@550 - queryStorageLimit.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_QUERY_STORAGE_LIMIT")); //@550 - queryStorageLimit.setShortDescription(AS400JDBCDriver.getResource("QUERY_STORAGE_LIMIT_DESC")); //@550 - - //@DFA - added support for decfloat rounding mode - PropertyDescriptor decfloatRoundingMode = new PropertyDescriptor("decfloatRoundingMode", beanClass, "getDecfloatRoundingMode", "setDecfloatRoundingMode"); //@DFA - decfloatRoundingMode.setBound(true); //@DFA - decfloatRoundingMode.setConstrained(false); //@DFA - decfloatRoundingMode.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_DECFLOAT_ROUNDING_MODE")); //@DFA - decfloatRoundingMode.setShortDescription(AS400JDBCDriver.getResource("DECFLOAT_ROUNDING_MODE_DESC")); //@DFA - - //@CE1 - added support for throwing sqlException when commit is called if autocommit is on - PropertyDescriptor autocommitException = new PropertyDescriptor("autocommitException", beanClass, "isAutocommitException", "setAutocommitException"); //@CE1 - autocommitException.setBound(true); //@CE1 - autocommitException.setConstrained(false); //@CE1 - autocommitException.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_AUTOCOMMIT_EXCEPTION")); //@CE1 - autocommitException.setShortDescription(AS400JDBCDriver.getResource("AUTOCOMMIT_EXCEPTION_DESC")); //@CE1 - - //@AC1 - added support auto commit default on new connections - PropertyDescriptor autoCommit = new PropertyDescriptor("autoCommit", beanClass, "isAutoCommit", "setAutoCommit"); //@AC1 - autoCommit.setBound(true); //@AC1 - autoCommit.setConstrained(false); //@AC1 - autoCommit.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_AUTO_COMMIT")); //@AC1 - autoCommit.setShortDescription(AS400JDBCDriver.getResource("AUTO_COMMIT_DESC")); //@AC1 - - //@igwrn - added support to ignore warnings - PropertyDescriptor ignoreWarnings = new PropertyDescriptor("ignoreWarnings", beanClass, "getIgnoreWarnings", "setIgnoreWarnings"); - ignoreWarnings.setBound(true); - ignoreWarnings.setConstrained(false); - ignoreWarnings.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_IGNORE_WARNINGS")); - ignoreWarnings.setShortDescription(AS400JDBCDriver.getResource("IGNORE_WARNINGS_DESC")); - - //@pw3 - added support to allow/disallow "" and *current for user name and password - PropertyDescriptor secureCurrentUser = new PropertyDescriptor("secureCurrentUser", beanClass, "isSecureCurrentUser", "setSecureCurrentUser"); - secureCurrentUser.setBound(true); - secureCurrentUser.setConstrained(false); - secureCurrentUser.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_SECURE_CURRENT_USER")); - secureCurrentUser.setShortDescription(AS400JDBCDriver.getResource("SECURE_CURRENT_USER_DESC")); - - //@cc1 - added support for concurrent access resolution - PropertyDescriptor concurrentAccessResolution = new PropertyDescriptor("concurrentAccessResolution", beanClass, "getConcurrentAccessResolution", "setConcurrentAccessResolution"); - concurrentAccessResolution.setBound(true); - concurrentAccessResolution.setConstrained(false); - concurrentAccessResolution.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_CONCURRENT_ACCESS_RESOLUTION")); - concurrentAccessResolution.setShortDescription(AS400JDBCDriver.getResource("CONCURRENT_ACCESS_RESOLUTION_DESC")); - - //@dmy - added support for temp fix for jvm 1.6 memory stomping - PropertyDescriptor jvm16Synchronize = new PropertyDescriptor("jvm16Synchronize", beanClass, "isJvm16Synchronize", "setJvm16Synchronize"); - jvm16Synchronize.setBound(true); - jvm16Synchronize.setConstrained(false); - jvm16Synchronize.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_JVM16_SYNCHRONIZE")); - jvm16Synchronize.setShortDescription(AS400JDBCDriver.getResource("JVM16_SYNCHRONIZE_DESC")); - - //@STIMEOUT - added support for socket timeout - PropertyDescriptor socketTimeout = new PropertyDescriptor("socketTimeout", beanClass, "getSocketTimeout", "setSocketTimeout"); - socketTimeout.setBound(true); - socketTimeout.setConstrained(false); - socketTimeout.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_SOCKET_TIMEOUT")); - socketTimeout.setShortDescription(AS400JDBCDriver.getResource("SOCKET_TIMEOUT_DESC")); - - properties_ = new PropertyDescriptor[] { access, behaviorOverride, bidiStringType, bigDecimal, blockCriteria, blockSize, cursorHold, cursorSensitivity, databaseName, dataCompression, dataSourceName, dataTruncation, dateFormat, dateSeparator, //@A4C @J6C @J7c - decimalSeparator, description, driver, errors, extendedDynamic, extendedMetaData, fullOpen, lazyClose, libraries, lobThreshold, naming, packageName, packageAdd, packageCache, packageClear, //@W1c @J5C - packageCriteria, packageError, packageLibrary, password, prefetch, prompt, proxyServer, remarks, savePassword, secondaryUrl, secure, serverName, sort, - sortLanguage, sortTable, sortWeight, threadUsed, timeFormat, timeSeparator, trace, traceServer, transactionIsolation, translateBinary, user, - keepAlive, receiveBufferSize, sendBufferSize, soLinger, soTimeout, tcpNoDelay, packageCCSID, minimumDivideScale, maximumPrecision, maximumScale, translateHex, traceToolbox, qaqqiniLibrary, traceServerCategories, loginTimeout, trueAutoCommit, holdLocators, bidiImplicitReordering, bidiNumericOrdering, holdStatements, rollbackCursorHold, variableFieldCompression, // @M0C - added package CCSID property and decimal scale & precision properties //@j1c //@K2A //@K3A //@K4A //@K5A //@KBC //@K24 //@KLA //@K94 //@K54 - queryOptimizeGoal, xaLooselyCoupledSupport, translateBoolean, metaDataSource, queryStorageLimit, decfloatRoundingMode, autocommitException, autoCommit, ignoreWarnings, secureCurrentUser, concurrentAccessResolution, jvm16Synchronize, socketTimeout, maximumBlockedInputRows }; //@540 @550 //@DFA //@pdc //@AC1 //@igwrn //@pw3 //@cc1 //@dmy //@STIMEOUT - } - catch(Exception e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("AS400JDBCDataSource16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("AS400JDBCDataSource32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCDatabaseMetaData.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCDatabaseMetaData.java deleted file mode 100644 index 2e71bb82e..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCDatabaseMetaData.java +++ /dev/null @@ -1,7911 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCDatabaseMetaData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.CallableStatement; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -/* ifdef JDBC40 -import java.sql.RowIdLifetime; -endif */ -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Types; -import java.util.Vector; // @D0A - - - -// @E4C -/** -The AS400JDBCDatabaseMetaData class provides information -about the database as a whole. - -

        Some of the methods in this class take arguments that are -pattern strings. Such arguments are suffixed with "Pattern". -Within a pattern string, "%" means match any substring of zero -or more characters, and "_" means match exactly one character. -Only entries matching the pattern string are returned. - -

        For example, if the schemaPattern argument for getTables() -is "H%WO_LD", then the following schemas might match -the pattern, provided they exist on the system: -

        -HELLOWORLD
        -HIWORLD
        -HWORLD
        -HELLOWOULD
        -HIWOULD
        -
        - -

        Many of the methods here return lists of information in -result sets. You can use the normal ResultSet methods to -retrieve data from these result sets. The format of the -result sets are described in the JDBC interface specification. - -

        Schema and table names that are passed as input to methods -in this class are implicitly uppercased unless enclosed in -double-quotes. -**/ - -//----------------------------------------------------------- -// Using nulls and empty strings for catalog functions -// -// When the parameter is NOT search pattern capable and: -// null is specified for: -// catalog (system) - parameter is ignored -// schema (library) - use default SQL schema -// The default SQL schema can be -// set in the URL. If not -// specified in URL, the first -// library specified in the library -// properties is used as the -// default SQL schema. -// If no default SQL schema exists, -// QGPL is used. -// table (file) - empty result set is returned -// column (field) - empty result set is returned -// empty string is specified for: -// catalog (system) - empty result set is returned -// schema (library) - empty result set is returned -// table (file) - empty result set is returned -// column (field) - empty result set is returned -// -// -// When the parameter is search pattern capable and: -// null is specified for: -// schemaPattern (library) - no value sent to system. -// System default of -// *USRLIBL is used. -// tablePattern (file) - no value sent to system -// system default of *ALL used -// empty string is specified for: -// schemaPattern (library) - empty result set is returned -// tablePattern (file) - empty result set is returned -// -// -//---------------------------------------------------------- - -public class AS400JDBCDatabaseMetaData -/* ifdef JDBC40 -extends ToolboxWrapper -endif */ - -implements DatabaseMetaData -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - - //New constants for JDBC 3.0. - public static final int sqlStateXOpen = 1; - public static final int sqlStateSQL99 = 2; - - - // Private data. - private AS400JDBCConnection connection_; - private int id_; - private SQLConversionSettings settings_; - - //@mdsp misc constants for sysibm stored procedures - final static int SQL_NO_NULLS = 0; //@mdsp - final static int SQL_NULLABLE = 1; //@mdsp - final static int SQL_NULLABLE_UNKNOWN = 2; //@mdsp - final static int SQL_BEST_ROWID = 1; //@mdsp - final static int SQL_ROWVER = 2; //@mdsp - static final String EMPTY_STRING = ""; //@mdsp - static final String MATCH_ALL = "%"; //@mdsp - - - private static final String VIEW = "VIEW"; //@mdsp - private static final String TABLE = "TABLE"; //@mdsp - private static final String SYSTEM_TABLE = "SYSTEM TABLE"; //@mdsp - private static final String ALIAS = "ALIAS"; //@mdsp - private static final String MQT = "MATERIALIZED QUERY TABLE"; //@mdsp - private static final String SYNONYM = "SYNONYM"; //@mdsp - private static final String FAKE_VALUE = "QCUJOFAKE"; //@mdsp - private static final int SQL_ALL_TYPES = 0; //@mdsp - - // the DB2 SQL reference says this should be 2147483647 but we return 1 less to allow for NOT NULL columns - static final int MAX_LOB_LENGTH = 2147483646; //@xml3 - - - - /** - Constructs an AS400JDBCDatabaseMetaData object. - - @param connection The connection to the system. - @param id The ID the caller has assigned to this - AS400JDBCDatabaseMetaData. - **/ - AS400JDBCDatabaseMetaData (AS400JDBCConnection connection, int id) - throws SQLException - { - connection_ = connection; - settings_ = new SQLConversionSettings (connection); - id_ = id; - } - - - - /** - Indicates if all of the procedures returned by getProcedures() can be - called by the current user. - - @return Always false. This driver cannot determine if all of the procedures - can be called by the current user. - @exception SQLException This exception is never thrown. - **/ - public boolean allProceduresAreCallable () - throws SQLException - { - return false; - } - - - - /** - Indicates if all of the tables returned by getTables() can be - SELECTed by the current user. - - @return Always false. This driver cannot determine if all of the tables - returned by getTables() can be selected by the current user. - @exception SQLException This exception is never thrown. - **/ - public boolean allTablesAreSelectable () - throws SQLException - { - return false; - } - - - - /** - Indicates if a data definition statement within a transaction - can force the transaction to commit. - - @return Always false. A data definition statement within a transaction - does not force the transaction to commit. - @exception SQLException This exception is never thrown. - **/ - public boolean dataDefinitionCausesTransactionCommit () - throws SQLException - { - return false; - } - - - - /** - Indicates if a data definition statement within a transaction is - ignored. - - @return Always false. A data definition statement within a - transaction is not ignored. - @exception SQLException This exception is never thrown. - **/ - public boolean dataDefinitionIgnoredInTransactions () - throws SQLException - { - return false; - } - - - - // JDBC 2.0 - /** - Indicates if visible deletes to a result set of the specified type - can be detected by calling ResultSet.rowDeleted(). If visible - deletes cannot be detected, then rows are removed from the - result set as they are deleted. - - @param resultSetType The result set type. Value values are: -

          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @return Always false. Deletes can not be detected - by calling ResultSet.rowDeleted(). - - @exception SQLException If the result set type is not valid. - **/ - public boolean deletesAreDetected (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return false; - } - - - - /** - Indicates if getMaxRowSize() includes blobs when computing the - maximum length of a single row. - - @return Always true. getMaxRowSize() does include blobs when - computing the maximum length of a single row. - @exception SQLException This exception is never thrown. - **/ - public boolean doesMaxRowSizeIncludeBlobs () - throws SQLException - { - return true; - } - - - - //@G4A - /** - Returns a ResultSet containing a description of type attributes available in a - specified catalog. - - This method only applies to the attributes of a - structured type. Distinct types are stored in the datatypes - catalog, not the attributes catalog. Since DB2 for IBM i does not support - structured types at this time, an empty ResultSet will always be returned - for calls to this method. - - @param catalog The catalog name. - @param schemaPattern The schema name pattern. - @param typeNamePattern The type name pattern. - @param attributeNamePattern The attribute name pattern. - - @return The empty ResultSet - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public ResultSet getAttributes (String catalog, String schemaPattern, - String typeNamePattern, String attributeNamePattern) - throws SQLException - { - // We return an empty result set because this is not supported by our driver - Statement statement = connection_.createStatement(); - return statement.executeQuery("SELECT VARCHAR('1', 128) AS TYPE_CAT, " + - "VARCHAR('2', 128) AS TYPE_SCHEM, " + - "VARCHAR('3', 128) AS TYPE_NAME, " + - "VARCHAR('4', 128) AS ATTR_NAME, " + - "SMALLINT(5) AS DATA_TYPE, " + - "VARCHAR('6', 128) AS ATTR_TYPE_NAME, " + - "INT(7) AS ATTR_SIZE, " + - "INT(8) AS DECIMAL_DIGITS, " + - "INT(9) AS NUM_PREC_RADIX, " + - "INT(10) AS NULLABLE, " + - "VARCHAR('11', 128) AS REMARKS, " + - "VARCHAR('12', 128) AS ATTR_DEF, " + - "INT(13) AS SQL_DATA_TYPE, " + - "INT(14) AS SQL_DATETIME_SUB, " + - "INT(15) AS CHAR_OCTET_LENGTH, " + - "INT(16) AS ORDINAL_POSITION, " + - "VARCHAR('17', 128) AS IS_NULLABLE, " + - "VARCHAR('18', 128) AS SCOPE_CATALOG, " + - "VARCHAR('19', 128) AS SCOPE_SCHEMA, " + - "VARCHAR('20', 128) AS SCOPE_TABLE, " + - "SMALLINT(21) AS SOURCE_DATA_TYPE " + - "FROM QSYS2" + getCatalogSeparator() + - "SYSTYPES WHERE 1 = 2 FOR FETCH ONLY "); - } - - - - /** - Returns a description of a table's optimal set of columns - that uniquely identifies a row. - - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schema The schema name. If null is specified, the - default SQL schema specified in the URL is used. - If null is specified and a default SQL schema was not - specified in the URL, the first library specified - in the libraries properties file is used. - If null is specified and a default SQL schema was - not specified in the URL and a library was not - specified in the libraries properties file, - QGPL is used. - If empty string is specified, an empty result set will - be returned. - @param table The table name. If null or empty string is specified, - an empty result set is returned. - @param scope The scope of interest. Valid values are: - bestRowTemporary and bestRowTransaction. - bestRowSession is not allowed because - it cannot be guaranteed that - the row will remain valid for the session. - If bestRowSession is specified, an empty result - set is returned. - If bestRowTransaction is specified, - autocommit is false, and transaction is set to repeatable read, - then results is returned; otherwise, an empty result set - is returned. - @param nullable The value indicating if columns that are nullable should be included. - @return The ResultSet containing a table's optimal - set of columns that uniquely identify a row. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getBestRowIdentifier (String catalog, - String schema, - String table, - int scope, - boolean nullable) - throws SQLException - { - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc3 - DBReplyRequestedDS getBestRowIdentifierReply = null; - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cstmt = connection_.prepareCall("call SYSIBM" + getCatalogSeparator () + "SQLSPECIALCOLUMNS(?,?,?,?,?,?,?)"); - - cstmt.setShort(1, (short)SQL_BEST_ROWID); - cstmt.setString(2, normalize(catalog)); - cstmt.setString(3, normalize(schema)); - cstmt.setString(4, normalize(table)); - cstmt.setShort(5, (short) scope); - if (nullable) { - cstmt.setShort(6, (short) SQL_NULLABLE); - } else { - cstmt.setShort(6, (short) SQL_NO_NULLS); - } - cstmt.setString(7, - "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - cstmt.execute(); - - ResultSet rs = cstmt.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cstmt.close(); //@mdrs2 - - return rs; //@mdrs - } - - // Initialize the format of the result set. - String[] fieldNames = { "SCOPE", - "COLUMN_NAME", - "DATA_TYPE", - "TYPE_NAME", - "COLUMN_SIZE", - "BUFFER_LENGTH", - "DECIMAL_DIGITS", - "PSEUDO_COLUMN", - }; - - SQLData[] sqlData = { new SQLSmallint (vrm), // scope //@trunc3 - new SQLVarchar (128, settings_), // column name - new SQLSmallint (vrm), // data type //@trunc3 - new SQLVarchar (128, settings_), // type name - new SQLInteger (vrm), // column size //@trunc3 - new SQLInteger (vrm), // buffer length //@trunc3 - new SQLSmallint (vrm), // decimal digits //@trunc3 - new SQLSmallint (vrm), // pseudo column //@trunc3 - }; - - int[] fieldNullables = { columnNoNulls, // scope - columnNoNulls, // column name - columnNoNulls, // data type - columnNoNulls, // type name - columnNoNulls, // column size - columnNoNulls, // buffer length - columnNoNulls, // decimal digits - columnNoNulls, // pseudo column - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if (!isCatalogValid(catalog) || // catalog is empty string - - // schema is not null and is empty string - ((schema != null) && (schema.length()==0)) || - - // Table is null - (table==null) || - - // Table is empty string - (table.length()==0 ) || - - // Scope. - // If bestRowSession is specified, return empty set - // since it can not be guaranteed that the row will - // remain valid for the session. - // If bestRowTemporary is specified, return results. - // If bestRowTransaction is specified and autocommit - // is true or transaction is not repeatableRead, return - // empty result set - - ((scope == bestRowSession) || - - ( (scope == bestRowTransaction) && - ( (connection_.getAutoCommit()==true) || - (connection_.getTransactionIsolation() != Connection.TRANSACTION_REPEATABLE_READ))))) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - - else - { // parameter values are valid, build request & send - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_SPECIAL_COLUMN_INFO , - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - - - // Set the library name - if (schema == null) - { // use default SQL schema or qgpl - request.setLibraryName(connection_.getDefaultSchema(), connection_.converter_); //@P0C - } - else request.setLibraryName(normalize(schema), connection_.converter_); // @E4C @P0C - - // Set the table name - request.setFileName(normalize(table), connection_.converter_); // @E4C @P0C - - - // Set the Field Information to Return Bitmap - // Return library, table, and column - - request.setSpecialColumnsReturnInfoBitmap(0x1F000000); - - - // Set the short / long file and field name indicator - request.setFileShortOrLongNameIndicator(0xF0); // Long - - // Set if columns are nullable - request.setSpecialColumnsNullableIndicator(nullable ? - 0xF1 : 0xF0); - - //-------------------------------------------------------- - // Send the request and cache all results from the system - //-------------------------------------------------------- - if (getBestRowIdentifierReply != null) { getBestRowIdentifierReply.returnToPool(); getBestRowIdentifierReply=null; } - getBestRowIdentifierReply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = getBestRowIdentifierReply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = getBestRowIdentifierReply.getReturnCode(); - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - // Get the data format and result data - DBDataFormat dataFormat = getBestRowIdentifierReply.getDataFormat(); - DBData resultData = getBestRowIdentifierReply.getResultData(); - if (resultData != null) - { - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache(row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - JDFieldMap[] maps = new JDFieldMap[8]; - maps[0] = new JDHardcodedFieldMap(new Short ((short) scope)); // scope - maps[1] = new JDSimpleFieldMap (1); // column name - maps[2] = new JDDataTypeFieldMap (2, 4, 3, 5, 0, connection_.getVRM(), connection_.getProperties()); // @M0C // data type - converted to short //@KKB pass 0 for ccsid since cannot get ccsid from host server - maps[3] = new JDSimpleFieldMap (2); // type name - maps[4] = new JDSimpleFieldMap (4); // column size (length) - maps[5] = new JDHardcodedFieldMap(new Integer (0)); // buffer length - maps[6] = new JDSimpleFieldMap (5); // decimal digits (scale) - maps[7] = new JDHardcodedFieldMap(new Short ((short) versionColumnNotPseudo)); - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - else - rowCache = new JDSimpleRowCache(formatRow); - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // Cannot return to pool yet because array in use by resultData. Pased to result set to be closed there - // if (getBestRowIdentifierReply != null) getBestRowIdentifierReply.returnToPool(); - } - } - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), "BestRowIdentifier", connection_, getBestRowIdentifierReply); //@in2 - } - - - - - - /** - Returns the catalog name available in this database. This - will return a ResultSet with a single row, whose value is - the IBM i system name. - - @return The ResultSet containing the IBM i system name. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getCatalogs () - throws SQLException - { - connection_.checkOpen (); - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cstmt = connection_.prepareCall("CALL SYSIBM" + getCatalogSeparator() + "SQLTABLES(?,?,?,?,?)"); - - cstmt.setString(1, "%"); - cstmt.setString(2, "%"); - cstmt.setString(3, "%"); - cstmt.setString(4, "%"); - cstmt.setString(5, "DATATYPE='JDBC';GETCATALOGS=1;CURSORHOLD=1"); - cstmt.execute(); - ResultSet rs = cstmt.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cstmt.close(); //@mdrs2 - - return rs; //@mdrs - } - - String[] fieldNames = {"TABLE_CAT"}; - SQLData[] sqlData = { new SQLVarchar (128, settings_)}; - int[] fieldNullables = {columnNoNulls}; // Catalog Name - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - Object[][] data = { { connection_.getCatalog()}}; - boolean[][] nulls = {{false}}; - boolean[][] dataMappingErrors = {{false}}; - - // If running to a system running OS/400 v5r2 or IBM i the list can contain more than just the system - // name (when IASPs are on the system). Try to retrieve that list. Note - // if getting the list fails we will still return a result set containing - // one item -- the name of the system. We just built that result set - // (the previous six lines of code) and that is what we will return. That - // result set will be consistent with the result set returned when connecting - // to OS/400 v5r1 or earlier versions. If getting the list works we will - // build and return a new result set containing data retrieved from the system. - if (connection_.getVRM() >= JDUtilities.vrm520) // @F1a - { // @F1a - try - { // @F1a // @F1a - Vector RDBEntries = new Vector(); // @F1a - - Statement statement = null; //@scan1 - ResultSet rs = null; //@scan1 - try - { - statement = connection_.createStatement(); // @F1a - rs = statement.executeQuery("SELECT LOCATION FROM QSYS2" + getCatalogSeparator() + "SYSCATALOGS WHERE RDBTYPE = 'LOCAL' AND RDBASPSTAT='AVAILABLE' "); // @F1a - while (rs.next()) // @F1a - { // @F1a - RDBEntries.add(rs.getString(1).trim()); // @F1a - } - }finally //@scan1 - { - try{ - if(rs != null) - rs.close(); - }catch(Exception e){} //allow next close to execute - if(statement != null) - statement.close(); - } - int count = RDBEntries.size(); // @F1a - if (count > 0) // @F1a - { // @F1a - data = new Object[count][1]; // @F1a - nulls = new boolean[count][1]; // @F1a - dataMappingErrors = new boolean[count][1]; - for (int i=0; i= 30; //@F2A @j4a - - String[] fieldNames = null; //@F2C - SQLData[] sqlData = null; //@F2C - int[] fieldNullables = null; //@F2C - //@F2A Result sets must be different depending on whether we are running under JDBC 3.0 - //@pda jdbc40 is also contained in same block as jdbc30, since this file is jdbc40 only compiled. - int vrm = connection_.getVRM(); //@trunc3 - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cs = connection_.prepareCall("CALL SYSIBM" + getCatalogSeparator() + "SQLCOLUMNS(?,?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, normalize(schemaPattern)); - cs.setString(3, normalize(tablePattern)); - cs.setString(4, normalize(columnPattern)); -/*ifdef JDBC40 - cs.setString(5, "DATATYPE='JDBC';JDBCVER='4.0';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); //@ver4 -endif */ -/* ifndef JDBC40 */ - cs.setString(5, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); -/* endif */ - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - - // Create an return the result set for the request. - // Note: This will failed until SQLCOLUMNS returns more columns - // return new DB2RSGetColumns40(x, isTransactional); - } - - if (!isJDBC3) //@F2A - { - // Set up the result set in the format required by JDBC - fieldNames = new String[] {"TABLE_CAT", - "TABLE_SCHEM", - "TABLE_NAME", - "COLUMN_NAME", - "DATA_TYPE", - "TYPE_NAME", - "COLUMN_SIZE", - "BUFFER_LENGTH", - "DECIMAL_DIGITS", - "NUM_PREC_RADIX", - "NULLABLE", - "REMARKS", - "COLUMN_DEF", - "SQL_DATA_TYPE", - "SQL_DATETIME_SUB", - "CHAR_OCTET_LENGTH", - "ORDINAL_POSITION", - "IS_NULLABLE", - }; - - sqlData = new SQLData[] { new SQLVarchar (128, settings_), // catalog - new SQLVarchar (128, settings_), // library - new SQLVarchar (128, settings_), // table - new SQLVarchar (128, settings_), // column - new SQLSmallint (vrm), // data type //@trunc3 - new SQLVarchar (128, settings_), // type name - new SQLInteger (vrm), // column size //@trunc3 - new SQLInteger (vrm), // buffer length //@trunc3 - new SQLInteger (vrm), // decimal digits //@trunc3 - new SQLInteger (vrm), // radix //@trunc3 - new SQLInteger (vrm), // nullable //@trunc3 - new SQLVarchar (254, settings_), // remarks - new SQLVarchar ((connection_.getVRM() >= JDUtilities.vrm610) ? 2000 : 254, settings_), // column def //@550 Column default value support - new SQLInteger (vrm), // sql data type //@trunc3 - new SQLInteger (vrm), // datetime sub //@trunc3 - new SQLInteger (vrm), // octet length //@trunc3 - new SQLInteger (vrm), // ordinal //@trunc3 - new SQLVarchar (254, settings_), // is nullable - }; - - fieldNullables = new int[] {columnNullable, // catalog - columnNullable, // library - columnNoNulls, // table - columnNoNulls, // column - columnNoNulls, // data type - columnNoNulls, // type name - columnNoNulls, // column size - columnNoNulls, // buffer length - columnNoNulls, // decimal digits - columnNoNulls, // radix - columnNoNulls, // nullable - columnNullable, // remarks - columnNullable, // column def - columnNoNulls, // sql data type - columnNoNulls, // datetime sub - columnNoNulls, // octet length - columnNoNulls, // ordinal - columnNoNulls, // is nullable - }; - } - else - { //@F2A - // Set up the result set in the format required by JDBC - fieldNames = new String[] {"TABLE_CAT", - "TABLE_SCHEM", - "TABLE_NAME", - "COLUMN_NAME", - "DATA_TYPE", - "TYPE_NAME", - "COLUMN_SIZE", - "BUFFER_LENGTH", - "DECIMAL_DIGITS", - "NUM_PREC_RADIX", - "NULLABLE", - "REMARKS", - "COLUMN_DEF", - "SQL_DATA_TYPE", - "SQL_DATETIME_SUB", - "CHAR_OCTET_LENGTH", - "ORDINAL_POSITION", - "IS_NULLABLE", -/* ifdef JDBC40 - "SCOPE_CATLOG", //@G4A -endif */ -/* ifndef JDBC40 */ - "SCOPE_CATALOG", //@G4A -/* endif */ - "SCOPE_SCHEMA", //@G4A - "SCOPE_TABLE", //@G4A -/* ifndef JDBC40 */ - "SOURCE_DATA_TYPE" //@G4A -/* endif */ -/* ifdef JDBC40 - "SOURCE_DATA_TYPE", //@G4A - "IS_AUTOINCREMENT" //jdbc40 -endif */ - }; - - sqlData = new SQLData[] { new SQLVarchar (128, settings_), // catalog - new SQLVarchar (128, settings_), // library - new SQLVarchar (128, settings_), // table - new SQLVarchar (128, settings_), // column - new SQLSmallint (vrm), // data type //@trunc3 - new SQLVarchar (128, settings_), // type name - new SQLInteger (vrm), // column size //@trunc3 - new SQLInteger (vrm), // buffer length //@trunc3 - new SQLInteger (vrm), // decimal digits //@trunc3 - new SQLInteger (vrm), // radix //@trunc3 - new SQLInteger (vrm), // nullable //@trunc3 - new SQLVarchar (254, settings_), // remarks - new SQLVarchar ((connection_.getVRM() >= JDUtilities.vrm610) ? 2000 : 254, settings_), // column def - new SQLInteger (vrm), // sql data type //@trunc3 - new SQLInteger (vrm), // datetime sub //@trunc3 - new SQLInteger (vrm), // octet length //@trunc3 - new SQLInteger (vrm), // ordinal //@trunc3 - new SQLVarchar (254, settings_), // is nullable - new SQLVarchar (128, settings_), // scope catalog //@G4A - new SQLVarchar (128, settings_), // scope schema //@G4A - new SQLVarchar (128, settings_), // scope table //@G4A - new SQLSmallint (vrm), // source data type //@G4A //@trunc3 -/* ifdef JDBC40 - new SQLVarchar (128, settings_), // is autoincrement //jdbc40 -endif */ - }; - - fieldNullables = new int[] {columnNullable, // catalog - columnNullable, // library - columnNoNulls, // table - columnNoNulls, // column - columnNoNulls, // data type - columnNoNulls, // type name - columnNoNulls, // column size - columnNoNulls, // buffer length - columnNoNulls, // decimal digits - columnNoNulls, // radix - columnNoNulls, // nullable - columnNullable, // remarks - columnNullable, // column def - columnNoNulls, // sql data type - columnNoNulls, // datetime sub - columnNoNulls, // octet length - columnNoNulls, // ordinal - columnNoNulls, // is nullable - columnNullable, // scope catalog //@G4A - columnNullable, // scope schema //@G4A - columnNullable, // scope table //@G4A - columnNullable, // source data type //@G4A -/* ifdef JDBC40 - columnNoNulls, // is autoincrement //jdbc40 -endif */ - }; - } - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows that - // are readable one at a time - try - { - - - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - if (!isCatalogValid(catalog) || // catalog is empty string - - // schema is not null and is empty string - ((schemaPattern != null) && (schemaPattern.length()==0)) || - - // table is not null and is empty string - ((tablePattern != null) && (tablePattern.length()==0)) || - - // columnPattern is not null and is empty string - ((columnPattern != null) && (columnPattern.length()==0))) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - - //-------------------------------------------------- - // Set the parameters for the request - //-------------------------------------------------- - - - else - { // parameter values are valid, continue to build request - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_FIELD_INFO, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - // Set the Library Name and Library Name Search Pattern parameters - // If null, do not set parameter. The system default value of - // *USRLIBL is used - if (schemaPattern != null) - { - JDSearchPattern schema = new JDSearchPattern(schemaPattern); - request.setLibraryName (normalize(schema.getPatternString()), connection_.converter_); // @E4C @P0C - request.setLibraryNameSearchPatternIndicator(schema.getIndicator()); - } - - - - // Set the Table Name and Table Name Search Pattern parameters - // If null, do not set parameter. The system default value of - // *ALL is used. - if (tablePattern!=null) - { - JDSearchPattern table = new JDSearchPattern(tablePattern); - request.setFileName (normalize(table.getPatternString()), connection_.converter_); // @E4C @P0C - request.setFileNameSearchPatternIndicator(table.getIndicator()); - } - - - // Set the Field Name and Field Name Search Pattern parameters - // If null, do not set parameter. The system default value of - // *ALL is used. - if (columnPattern!=null) - { - JDSearchPattern field = new JDSearchPattern(columnPattern); - request.setFieldName (field.getPatternString(), connection_.converter_); //@P0C - request.setFieldNameSearchPatternIndicator(field.getIndicator()); - } - - - // Set the short / long file and field name indicator - request.setFileShortOrLongNameIndicator(0xF0); // Long - - // Set the Field Information to Return Bitmap - // Return everything but the reserved fields - if(connection_.getVRM() >= JDUtilities.vrm610) //@550 column default value support - request.setFieldReturnInfoBitmap(0xEFF70000); //@550 request column default, 16th bit - else //@550 - request.setFieldReturnInfoBitmap(0xEFF60000); // @E3C //@KKB changed from EFF20000 inorder to request CCSID - - - // Set the Field Information Order By Indicator parameter - // Order by: Schema and File and Ordinal Position. - request.setFieldInformationOrderByIndicator (2); // @E5C - - - //------------------------------------------------------- - // Send the request and cache all results from the system - //------------------------------------------------------- - reply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = reply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = reply.getReturnCode(); - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - // Get the data format and result data - DBDataFormat dataFormat = reply.getDataFormat(); - DBData resultData = reply.getResultData(); - - // Put the data format into a row format object - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - - // Put the result data into a row cache - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache(row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - - // Create the mapped row format that is returned in the - // result set. - // This does not actual move the data, it just sets up - // the mapping. - JDFieldMap[] maps = null; //@F2C - if (!isJDBC3) //@F2A - maps = new JDFieldMap[18]; - else -/* ifdef JDBC40 - maps = new JDFieldMap[23]; //@G4A //jdbc40 -endif */ -/* ifndef JDBC40 */ - maps = new JDFieldMap[22]; //@G4A -/* endif */ - - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog ()); - maps[1] = new JDSimpleFieldMap (1); // library - maps[2] = new JDSimpleFieldMap (3); // table - maps[3] = new JDSimpleFieldMap (4); // column - maps[4] = new JDDataTypeFieldMap (6, 7, 10, 11, 12, connection_.getVRM(), connection_.getProperties()); // @M0C // Data type //@KKB include ccsid - maps[5] = new JDLocalNameFieldMap (6, 7, 10, 11, 12, connection_.getVRM(), connection_.getProperties()); // @M0C // Type name //@KKB include ccsid - maps[6] = new JDPrecisionFieldMap (6, 7, 10, 11, 12, connection_.getVRM(), connection_.getProperties()); // @M0C // column size (length) //@KKB include ccsid - maps[7] = new JDHardcodedFieldMap(new Integer(0)); // Buffer - not used - maps[8] = new JDScaleFieldMap (6, 7, 10, 11, 12, connection_.getVRM(), connection_.getProperties()); // @M0C // decimal digits (scale) //@KKB include ccsid - maps[9] = new JDSimpleFieldMap (9); // radix - maps[10] = new JDNullableIntegerFieldMap(8); // is null capable? - - if (connection_.getProperties().equals (JDProperties.REMARKS, JDProperties.REMARKS_SQL)) - maps[11] = new JDSimpleFieldMap (2); // return remarks - else - maps[11] = new JDSimpleFieldMap (5); // return text - - // Always return null if V5R4 or earlier - if(connection_.getVRM() <= JDUtilities.vrm540) //@550 column default value support - maps[12] = new JDHardcodedFieldMap (new SQLVarchar(0, settings_), true, false); // column def - else //@550 return what we are returned - maps[12] = new JDSimpleFieldMap(14); - - // Per JDBC api - not used - hardcode to 0 - maps[13] = new JDHardcodedFieldMap (new Integer (0)); // SQL data type - - // Per JDBC api - not used - hardcode to 0 - maps[14] = new JDHardcodedFieldMap (new Integer (0)); // SQL datetime - - maps[15] = new JDCharOctetLengthFieldMap(6, 7, 10, 11, 12, connection_.getVRM(), connection_.getProperties()); // octet // @M0C //@KKB include ccsid - - // If the server functional level is 7 or greater, then ordinal @E3A - // position is supported. Otherwise, just hardcode to -1. @E3A - if (connection_.getServerFunctionalLevel() >= 7) // @E3A - maps[16] = new JDSimpleFieldMap(13); // @E3A //@KKB changed from 12 since requesting ccsid - else // @E3A - maps[16] = new JDHardcodedFieldMap(new Integer(-1)); - - maps[17] = new JDNullableStringFieldMap(8); // is Nullable - - //@G4A The below fields will all return null. They are not supported - //@G4A by our database. - if (isJDBC3) //@F2A - { - maps[18] = new JDHardcodedFieldMap ("", true, false); // scope catalog //@G4A - maps[19] = new JDHardcodedFieldMap ("", true, false); // scope schema //@G4A - maps[20] = new JDHardcodedFieldMap ("", true, false); // scope table //@G4A - maps[21] = new JDHardcodedFieldMap (new Short((short) 0)); // source data type //@G4A -/* ifdef JDBC40 - maps[22] = new JDHardcodedFieldMap (""); // is autoincrement "" till switch to sysibm //jdbc40 -endif */ - } - - // Create the mapped row cache that is returned in the - // result set - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } // end of else blank - - } // End of try block - - catch (DBDataStreamException e) - { - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - // Return the results - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "Columns", connection_, reply); //@in2 - - } // End of getColumns - - - - // JDBC 2.0 - /** - Returns the connection for this metadata. - - @return The connection for this metadata. - - @exception SQLException This exception is never thrown. - **/ - public Connection getConnection () - throws SQLException - { - return connection_; - } - - - - - /** - Returns a description of the foreign key columns in the - foreign key table that references the primary key columns - of the primary key table. This is a description of how - the primary table imports the foreign table's key. - - @param primaryCatalog The catalog name. If null is specified, - this parameter is ignored. If - empty string is specified, an empty - result set is returned. - @param primarySchema The name of the schema where the primary table - is located. - If null is specified, the - default SQL schema specified in the URL is used. - If null is specified and a default SQL schema was not - specified in the URL, the first library specified - in the libraries properties file is used. - If null is specified,a default SQL schema was - not specified in the URL, and a library was not - specified in the libraries properties file, - QGPL is used. - If empty string is specified, an empty result - set is returned. - @param primaryTable The primary table name. If null or empty string - is specified, an empty result set is returned. - @param foreignCatalog The catalog name. If null is specified, - this parameter is ignored. If - empty string is specified, an empty - result set is returned. - @param foreignSchema The name of the schema where the primary table - is located. If null is specified, the - default SQL schema specified in the URL is used. - If null is specified and a default SQL schema was not - specified in the URL, the first library specified - in the libraries properties file is used. - If null is specified, a default SQL schema was - not specified in the URL, and a library was not - specified in the libraries properties file, - QGPL is used. - If empty string is specified, - an empty result set is returned. - @param foreignTable The foreign table name. If null or empty string - is specified, an empty result set is returned. - @return The ResultSet containing the description of the - foreign key columns in the foreign key table that - references the primary key columns of the primary - key table. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - - //-------------------------------------------------// - // The system returns the following: - // 0 = cascade - // 1 = No action or restrict - // 2 = set null or set default - // - // JDBC has 5 possible values: - // importedKeyNoAction - // importedKeyCascade - // importedKeySetNull - // importedKeySetDefault - // importedKeyRestrict - // - // Since the system groups together - // some of the values, all of the - // possible JDBC values can not be returned. - // - // For Update Rule, the only values - // supported by the system are - // no action and restrict. Since - // the value of 1 is returned for - // both no action and restrict, - // the value of importKeyRestrict - // will always be returned for the - // update rule. - // - // For Delete Rule - // the following is returned. It is - // consistent with the ODBC implementation. - // if 0 from system = importedKeyCascade - // if 1 from system = importedKeyRestrict - // if 2 from system = importedKeySetNull - // - // - // importedKeyNoAction and importedKeySetDefault - // will not be returned. - //-------------------------------------------------// - - public ResultSet getCrossReference (String primaryCatalog, - String primarySchema, - String primaryTable, - String foreignCatalog, - String foreignSchema, - String foreignTable) - throws SQLException - { - DBReplyRequestedDS reply = null; - - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc3 - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cs = connection_.prepareCall( - "CALL SYSIBM"+ getCatalogSeparator() +"SQLFOREIGNKEYS(?,?,?,?,?,?,?)"); - - cs.setString(1, normalize(primaryCatalog)); - cs.setString(2, normalize(primarySchema)); - cs.setString(3, normalize(primaryTable)); - cs.setString(4, normalize(foreignCatalog)); - cs.setString(5, normalize(foreignSchema)); - cs.setString(6, normalize(foreignTable)); - cs.setString(7, "DATATYPE='JDBC';EXPORTEDKEY=0;IMPORTEDKEY=0;DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - //-------------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - String[] fieldNames = {"PKTABLE_CAT", - "PKTABLE_SCHEM", - "PKTABLE_NAME", - "PKCOLUMN_NAME", - "FKTABLE_CAT", - "FKTABLE_SCHEM", - "FKTABLE_NAME", - "FKCOLUMN_NAME", - "KEY_SEQ", - "UPDATE_RULE", - "DELETE_RULE", - "FK_NAME", - "PK_NAME", - "DEFERRABILITY", - }; - - SQLData[] sqlData = { new SQLVarchar (128, settings_), // pk catalog - new SQLVarchar (128, settings_), // pk schema - new SQLVarchar (128, settings_), // pk table - new SQLVarchar (128, settings_), // pk column - new SQLVarchar (128, settings_), // fk catalog - new SQLVarchar (128, settings_), // fk schema - new SQLVarchar (128, settings_), // fk table - new SQLVarchar (128, settings_), // fk column - new SQLSmallint (vrm), // key seq //@trunc3 - new SQLSmallint (vrm), // update rule //@trunc3 - new SQLSmallint (vrm), // delete rule //@trunc3 - new SQLVarchar (128, settings_), // fk name - new SQLVarchar (128, settings_), // pk name - new SQLSmallint (vrm), // deferrability //@trunc3 - }; - - int[] fieldNullables = {columnNullable, // pk catalog - columnNullable, // pk schema - columnNoNulls, // pk table - columnNoNulls, // pk column - columnNullable, // fk catalog - columnNullable, // fk schema - columnNoNulls, // fk table - columnNoNulls, // fk column - columnNoNulls, // key seq - columnNoNulls, // update rule - columnNoNulls, // delete rule - columnNullable, // fk name - columnNullable, // pk name - columnNoNulls, // deferrability - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows - // that are readable one at a time. - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if ((!isCatalogValid(primaryCatalog)) || // primarycatalog is empty string - (!isCatalogValid(foreignCatalog)) || // foreigncatalog is empty string - - // primarySchema is not null and is empty string - ((primarySchema != null) && (primarySchema.length()==0)) || - // foreignSchema is not null and is empty string - ((foreignSchema != null) && (foreignSchema.length()==0)) || - - // primaryTable is null or empty string - (primaryTable==null) || (primaryTable.length()==0 ) || - // foreignTable is null or empty string - (foreignTable==null) || (foreignTable.length()==0 )) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - else - { // parameter values are valid, build request & send - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_FOREIGN_KEY_INFO , - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - // Set the primary key file library name - if (primarySchema == null) - { // use default SQL schema or qgpl - request.setPrimaryKeyFileLibraryName(normalize(connection_.getDefaultSchema()), connection_.converter_); // @E4C @P0C - } - else request.setPrimaryKeyFileLibraryName(normalize(primarySchema), connection_.converter_); // @E4C @P0C - - // Set the foreign key file library name - if (foreignSchema == null) - { // use default SQL schema or qgpl - request.setForeignKeyFileLibraryName(normalize(connection_.getDefaultSchema()), connection_.converter_); // @E4C @P0C - } - else request.setForeignKeyFileLibraryName(normalize(foreignSchema), connection_.converter_); // @E4C @P0C - - - // Set the primary key table name - request.setPrimaryKeyFileName(normalize(primaryTable), connection_.converter_); // @E4C @P0C - - // Set the foreign key table name - request.setForeignKeyFileName(normalize(foreignTable), connection_.converter_); // @E4C @P0C - - // Set the Foreign key Information to Return Bitmap - request.setForeignKeyReturnInfoBitmap(0xBBE00000); - - //Get the long file name - request.setFileShortOrLongNameIndicator (0xF0); // @PDA Long table names. - - //-------------------------------------------------------- - // Send the request and cache all results from the system - //-------------------------------------------------------- - - reply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = reply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = reply.getReturnCode(); - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - // Get the data format and result data - DBDataFormat dataFormat = reply.getDataFormat(); - DBData resultData = reply.getResultData(); - if (resultData != null) - { - - // Put the data format into a row format object - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - - // Put the result data into a row cache - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache(row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - - // Create the mapped row format that is returned in the - // result set. - // This does not actual move the data, it just sets up - // the mapping. - - JDFieldMap[] maps = new JDFieldMap[14]; - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog ()); - - maps[1] = new JDSimpleFieldMap (1); // pk schema - maps[2] = new JDSimpleFieldMap (2); // pk table - maps[3] = new JDSimpleFieldMap (3); // pk column - maps[4] = new JDHardcodedFieldMap (connection_.getCatalog ()); - maps[5] = new JDSimpleFieldMap (4); // fk schema - maps[6] = new JDSimpleFieldMap (5); // fk table - maps[7] = new JDSimpleFieldMap (6); // fk column - maps[8] = new JDSimpleFieldMap (7); // key seq - maps[9] = new JDUpdateDeleteRuleFieldMap (8); // update rule - maps[10] = new JDUpdateDeleteRuleFieldMap (9); // delete rule - maps[11] = new JDHardcodedFieldMap(new SQLVarchar(0, settings_), true, false); - maps[12] = new JDHardcodedFieldMap(new SQLVarchar(0, settings_), true, false); - maps[13] = new JDHardcodedFieldMap(new Short ((short) importedKeyNotDeferrable)); - - // Create the mapped row cache that is returned in the - // result set - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - else - rowCache = new JDSimpleRowCache(formatRow); - - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } // End of else to build and send request - } // End of try block - - catch (DBDataStreamException e) - { - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - - // Return the results - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), "CrossReference", connection_, reply); //@in2 - - } // End of getCrossReference - - - - /** - Returns the major version number of the database. - - @return The major version number. - @since Modification 5 - **/ - public int getDatabaseMajorVersion () - { - //return 5; //@610 - - //@610 get this dynamically since we can now have version 5 or 6 - int defaultVersion = 0; //since we do not want to change signature to throw exception, have default as 0 - try - { - String v = getDatabaseProductVersion(); - int dotIndex = v.indexOf('.'); - if (dotIndex > 0) - { - v = v.substring(0,dotIndex); - defaultVersion = Integer.parseInt(v); - } - }catch(Exception e) - { - //should not happen - } - - return defaultVersion; - } - - - /** - Returns the minor version number of the database. - - @return The minor version number. - @since Modification 5 - **/ - public int getDatabaseMinorVersion () - { - //return 0; //@610 - - //@610 get this dynamically since we can now as Native driver does - int defaultVersion = 0; - try - { - String v = getDatabaseProductVersion(); - int dotIndex = v.indexOf('.'); - if (dotIndex > 0) - { - v = v.substring(dotIndex+1); - dotIndex = v.indexOf('.'); - if (dotIndex > 0) - { - v = v.substring(0,dotIndex); - } - - defaultVersion = Integer.parseInt(v); - - } - }catch(Exception e) - { - //should not happen - } - return defaultVersion; - - } - - - /** - Returns the name of this database product. - - @return The database product name. - - @exception SQLException This exception is never thrown. - **/ - public String getDatabaseProductName () - throws SQLException - { - return AS400JDBCDriver.DATABASE_PRODUCT_NAME_; // @D2C - } - - - - /** - Returns the version of this database product. - - @return The product version. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public String getDatabaseProductVersion () - throws SQLException - { - // The ODBC specification suggests the - // format "vv.rr.mmmm product-specific". - // Although the JDBC specification does not - // mention this format, I will adopt it anyway. - // - // The format of the product-specific part is - // "VxRxmx". I am not sure why the "m" is lowercase, - // but somebody somewhere said this is normal, and - // its a nit anyway. - connection_.checkOpen(); - AS400ImplRemote as400_ = (AS400ImplRemote) connection_.getAS400 (); - int v, r, m; - try - { - int vrm = as400_.getVRM (); - v = (vrm & 0xffff0000) >>> 16; // @D1C - r = (vrm & 0x0000ff00) >>> 8; // @D1C - m = (vrm & 0x000000ff); // @D1C - } - catch (Exception e) - { - JDError.throwSQLException (this, JDError.EXC_CONNECTION_NONE); - return null; - } - - StringBuffer buffer = new StringBuffer (); - buffer.append (JDUtilities.padZeros (v, 2)); - buffer.append ("."); - buffer.append (JDUtilities.padZeros (r, 2)); - buffer.append ("."); - buffer.append (JDUtilities.padZeros (m, 4)); - buffer.append (" V"); - buffer.append (v); - buffer.append ("R"); - buffer.append (r); - buffer.append ("m"); - buffer.append (m); - return buffer.toString (); - } - - - - /** - Returns the default transaction isolation level. - - @return The default transaction isolation level. - - @exception SQLException This exception is never thrown. - **/ - public int getDefaultTransactionIsolation () - throws SQLException - { - String levelAsString = connection_.getProperties ().getString (JDProperties.TRANSACTION_ISOLATION); - return JDTransactionManager.mapStringToLevel (levelAsString); - } - - - - /** - Returns the major version number for this JDBC driver. - - @return The major version number. - **/ - public int getDriverMajorVersion () - { - return AS400JDBCDriver.MAJOR_VERSION_; - } - - - - /** - Returns the minor version number for this JDBC driver. - - @return The minor version number. - **/ - public int getDriverMinorVersion () - { - return AS400JDBCDriver.MINOR_VERSION_; - } - - - - /** - Returns the name of this JDBC driver. - - @return The driver name. - - @exception SQLException This exception is never thrown. - **/ - public String getDriverName () - throws SQLException - { - return AS400JDBCDriver.DRIVER_NAME_; // @D2C - } - - - - /** - Returns the version of this JDBC driver. - - @return The driver version. - - @exception SQLException This exception is never thrown. - **/ - public String getDriverVersion () - throws SQLException - { - return AS400JDBCDriver.MAJOR_VERSION_+ "."+ AS400JDBCDriver.MINOR_VERSION_; - } - - - - /** - Returns a description of the foreign key columns that - reference a table's primary key columns. This is the - foreign keys exported by a table. - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schema The schema name. If null is specified, the - default SQL schema specified in the URL is used. - If null is specified and a default SQL schema was not - specified in the URL, the first library specified - in the libraries properties file is used. - If null is specified, a default SQL schema was - not specified in the URL, and a library was not - specified in the libraries properties file, - QGPL is used. - If empty string is specified, an empty result set will - be returned. - @param table The table name. If null or empty string is specified, - an empty result set is returned. - - @return The ResultSet containing the description of the - foreign key columns that reference a table's - primary key columns. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getExportedKeys (String catalog, - String schema, - String table) - throws SQLException - { - DBReplyRequestedDS reply = null; - - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc3 - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cs = connection_.prepareCall("CALL SYSIBM" + getCatalogSeparator() + "SQLFOREIGNKEYS(?,?,?,?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, normalize(schema)); - cs.setString(3, normalize(table)); - cs.setString(4, normalize(catalog)); - cs.setString(5, EMPTY_STRING); - cs.setString(6, EMPTY_STRING); - cs.setString(7, "DATATYPE='JDBC';EXPORTEDKEY=1; CURSORHOLD=1"); - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - - //-------------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - - String[] fieldNames = {"PKTABLE_CAT", - "PKTABLE_SCHEM", - "PKTABLE_NAME", - "PKCOLUMN_NAME", - "FKTABLE_CAT", - "FKTABLE_SCHEM", - "FKTABLE_NAME", - "FKCOLUMN_NAME", - "KEY_SEQ", - "UPDATE_RULE", - "DELETE_RULE", - "FK_NAME", - "PK_NAME", - "DEFERRABILITY", - }; - - SQLData[] sqlData = { new SQLVarchar (128, settings_), // pk catalog - new SQLVarchar (128, settings_), // pk schema - new SQLVarchar (128, settings_), // pk table - new SQLVarchar (128, settings_), // pk column - new SQLVarchar (128, settings_), // fk catalog - new SQLVarchar (128, settings_), // fk schema - new SQLVarchar (128, settings_), // fk table - new SQLVarchar (128, settings_), // fk column - new SQLSmallint (vrm), // key seq //@trunc3 - new SQLSmallint (vrm), // update rule //@trunc3 - new SQLSmallint (vrm), // delete rule //@trunc3 - new SQLVarchar (128, settings_), // fk name - new SQLVarchar (128, settings_), // pk name - new SQLSmallint (vrm), // deferrability //@trunc3 - }; - int[] fieldNullables = {columnNullable, // pk catalog - columnNullable, // pk schema - columnNoNulls, // pk table - columnNoNulls, // pk column - columnNullable, // fk catalog - columnNullable, // fk schema - columnNoNulls, // fk table - columnNoNulls, // fk column - columnNoNulls, // key seq - columnNoNulls, // update rule - columnNoNulls, // delete rule - columnNullable, // fk name - columnNullable, // pk name - columnNoNulls, // deferrability - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows - // that are readable one at a time. - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if ((!isCatalogValid(catalog)) || // catalog is empty string - - - // schema is not null and is empty string - ((schema != null) && (schema.length()==0)) || - - // table is null or empty string - (table==null) || (table.length()==0 )) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - else - { // parameter values are valid, build request & send - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_FOREIGN_KEY_INFO , - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - - // Set the primary key file library name - if (schema == null) - { // use default SQL schema or qgpl - request.setPrimaryKeyFileLibraryName(normalize(connection_.getDefaultSchema()), connection_.converter_); // @E4C @P0C - } - else request.setPrimaryKeyFileLibraryName(normalize(schema), connection_.converter_); // @E4C @P0C - - - - // Set the primary key table name - request.setPrimaryKeyFileName(normalize(table), connection_.converter_); // @E4C @P0C - - - // Set the Foreign key Information to Return Bitmap - //@F4 As of base v4r4, host server can return primary and foreign key names. - //@F4 Even this has nothing to do with lobs, borrow the constant as - //@F4 it checks for v4r4. - if (connection_.getVRM() >= JDUtilities.vrm440) //@F4A - request.setForeignKeyReturnInfoBitmap(0xBBF80000); //@F4A - else //@F4A - request.setForeignKeyReturnInfoBitmap(0xBBE00000); - - //Get the long file name - request.setFileShortOrLongNameIndicator (0xF0); // @KBA Long table names. - - - //-------------------------------------------------------- - // Send the request and cache all results from the system - //-------------------------------------------------------- - - reply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = reply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = reply.getReturnCode(); - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - // Get the data format and result data - DBDataFormat dataFormat = reply.getDataFormat(); - DBData resultData = reply.getResultData(); - - if (resultData != null) - { - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache (row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - - JDFieldMap[] maps = new JDFieldMap[14]; - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog ()); - maps[1] = new JDSimpleDelimitedFieldMap (1); // pk schema //@PDC code to remove quotes - maps[2] = new JDSimpleFieldMap (2); // pk table - maps[3] = new JDSimpleFieldMap (3); // pk column - maps[4] = new JDHardcodedFieldMap (connection_.getCatalog ()); - maps[5] = new JDSimpleDelimitedFieldMap (4); // fk schema //@PDC code to remove quotes - maps[6] = new JDSimpleFieldMap (5); // fk table - maps[7] = new JDSimpleFieldMap (6); // fk column - maps[8] = new JDSimpleFieldMap (7); // key seq - maps[9] = new JDSimpleFieldMap (8); // update rule - maps[10] = new JDSimpleFieldMap (9); // delete rule - if (connection_.getVRM() >= JDUtilities.vrm440) //@F4A - { - maps[11] = new JDSimpleDelimitedFieldMap (10); //@F4A //@PDC code to remove quotes - maps[12] = new JDSimpleDelimitedFieldMap (11); //@F4A //@PDC code to remove quotes - } - else - { //@F4A - maps[11] = new JDHardcodedFieldMap (new SQLVarchar(0, settings_), true, false); - maps[12] = new JDHardcodedFieldMap (new SQLVarchar(0, settings_), true, false); - } - maps[13] = new JDHardcodedFieldMap (new Short ((short) importedKeyNotDeferrable)); - - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - else - rowCache = new JDSimpleRowCache(formatRow); - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } - } - catch (DBDataStreamException e) - { - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "ExportedKeys", connection_, reply); //@in2 - } - - - - /** - Returns all of the "extra" characters that can be used in - unquoted identifier names (those beyond a-z, A-Z, 0-9, - and _). - - @return The String containing the "extra" characters. - - @exception SQLException This exception is never thrown. - **/ - public String getExtraNameCharacters () - throws SQLException - { - return "$@#"; - } - - - - /** - Returns the string used to quote SQL identifiers. - - @return The quote string. - - @exception SQLException This exception is never thrown. - **/ - public String getIdentifierQuoteString () - throws SQLException - { - return "\""; - } - - - - /** - Returns a description of the primary key columns that are - referenced by a table's foreign key columns. This is the - primary keys imported by a table. - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schema The schema name. If null is specified, the - default SQL schema specified in the URL is used. - If null is specified and a default SQL schema was not - specified in the URL, the first library specified - in the libraries properties file is used. - If null is specified, a default SQL schema was - not specified in the URL, and a library was not - specified in the libraries properties file, - QGPL is used. - If empty string is specified, an empty result set will - be returned. - @param table The table name. If null or empty string is specified, - an empty result set is returned. - - @return The ResultSets containing the description of the primary - key columns that are referenced by a table's foreign - key columns. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getImportedKeys (String catalog, - String schema, - String table) - throws SQLException - { - DBReplyRequestedDS reply = null; - - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc3 - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - - CallableStatement cs = connection_.prepareCall("CALL SYSIBM"+ getCatalogSeparator() +"SQLFOREIGNKEYS(?,?,?,?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, null); - cs.setString(3, null); - cs.setString(4, normalize(catalog)); - cs.setString(5, normalize(schema)); - cs.setString(6, normalize(table)); - cs.setString(7, "DATATYPE='JDBC';IMPORTEDKEY=1; CURSORHOLD=1"); - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - //-------------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - String[] fieldNames = {"PKTABLE_CAT", - "PKTABLE_SCHEM", - "PKTABLE_NAME", - "PKCOLUMN_NAME", - "FKTABLE_CAT", - "FKTABLE_SCHEM", - "FKTABLE_NAME", - "FKCOLUMN_NAME", - "KEY_SEQ", - "UPDATE_RULE", - "DELETE_RULE", - "FK_NAME", - "PK_NAME", - "DEFERRABILITY", - }; - - SQLData[] sqlData = { new SQLVarchar (128, settings_), // pk catalog - new SQLVarchar (128, settings_), // pk schema - new SQLVarchar (128, settings_), // pk table - new SQLVarchar (128, settings_), // pk column - new SQLVarchar (128, settings_), // fk catalog - new SQLVarchar (128, settings_), // fk schema - new SQLVarchar (128, settings_), // fk table - new SQLVarchar (128, settings_), // fk column - new SQLSmallint (vrm), // key seq //@trunc3 - new SQLSmallint (vrm), // update rule //@trunc3 - new SQLSmallint (vrm), // delete rule //@trunc3 - new SQLVarchar (128, settings_), // fk name - new SQLVarchar (128, settings_), // pk name - new SQLSmallint (vrm), // deferrability //@trunc3 - }; - - int[] fieldNullables = {columnNullable, // pk catalog - columnNullable, // pk schema - columnNoNulls, // pk table - columnNoNulls, // pk column - columnNullable, // fk catalog - columnNullable, // fk schema - columnNoNulls, // fk table - columnNoNulls, // fk column - columnNoNulls, // key seq - columnNoNulls, // update rule - columnNoNulls, // delete rule - columnNullable, // fk name - columnNullable, // pk name - columnNoNulls, // deferrability - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows - // that are readable one at a time. - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if ((!isCatalogValid(catalog)) || // catalog is empty string - - // schema is not null and is empty string - ((schema != null) && (schema.length()==0)) || - - // table is null or empty string - (table==null) || (table.length()==0 )) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - else - { // parameter values are valid, build request & send - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_FOREIGN_KEY_INFO , - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - - - - // Set the foreign key file library name - if (schema == null) - { // use default SQL schema or qgpl - request.setForeignKeyFileLibraryName(normalize(connection_.getDefaultSchema()), connection_.converter_); // @E4C - } - else request.setForeignKeyFileLibraryName(normalize(schema), connection_.converter_); // @E4C - - - // Set the foreign key table name - request.setForeignKeyFileName(normalize(table), connection_.converter_); // @E4C - - // Set the Foreign key Information to Return Bitmap - //@F4 As of base v4r4, host server can return primary and foreign key names. - //@F4 Even this has nothing to do with lobs, borrow the constant as - //@F4 it checks for v4r4. - if (connection_.getVRM() >= JDUtilities.vrm440) //@F4A - request.setForeignKeyReturnInfoBitmap(0xBBF80000); //@F4A - else //@F4A - request.setForeignKeyReturnInfoBitmap(0xBBE00000); - - // This is not documented in the LIPI, but it happens to work! @E2A - request.setFileShortOrLongNameIndicator(0xF0); // @E2A - - //-------------------------------------------------------- - // Send the request and cache all results from the system - //-------------------------------------------------------- - - reply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = reply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = reply.getReturnCode(); - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - DBDataFormat dataFormat = reply.getDataFormat(); - DBData resultData = reply.getResultData(); - if (resultData != null) - { - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache(row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - JDFieldMap[] maps = new JDFieldMap[14]; - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog ()); - maps[1] = new JDSimpleDelimitedFieldMap (1); // pk schema //@PDC code to remove quotes - maps[2] = new JDSimpleFieldMap (2); // pk table - maps[3] = new JDSimpleFieldMap (3); // pk column - maps[4] = new JDHardcodedFieldMap (connection_.getCatalog ()); - maps[5] = new JDSimpleDelimitedFieldMap (4); // fk schema //@PDC code to remove quotes - maps[6] = new JDSimpleFieldMap (5); // fk table - maps[7] = new JDSimpleFieldMap (6); // fk column - maps[8] = new JDSimpleFieldMap (7); // key seq - maps[9] = new JDSimpleFieldMap (8); // update rule - maps[10] = new JDSimpleFieldMap (9); // delete rule - if (connection_.getVRM() >= JDUtilities.vrm440) //@F4A - { - maps[11] = new JDSimpleDelimitedFieldMap (10); //@F4A //@PDC code to remove quotes - maps[12] = new JDSimpleDelimitedFieldMap (11); //@F4A //@PDC code to remove quotes - } - else - { //@F4A - maps[11] = new JDHardcodedFieldMap(new SQLVarchar(0, settings_), true, false); - maps[12] = new JDHardcodedFieldMap(new SQLVarchar(0, settings_), true, false); - } - maps[13] = new JDHardcodedFieldMap(new Short ((short) importedKeyNotDeferrable)); - - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - else - rowCache = new JDSimpleRowCache(formatRow); - - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } // End of else to build and send request - } // End of try block - - catch (DBDataStreamException e) - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - // Return the results - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "ImportedKeys", connection_, reply); //@in2 - } - - - - /** - Returns a description of a table's indexes and statistics. - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schema The schema name. If null is specified, the - default SQL schema specified in the URL is used. - If null is specified and a default SQL schema was not - specified in the URL, the first library specified - in the libraries properties file is used. - If null is specified, a default SQL schema was - not specified in the URL, and a library was not - specified in the libraries properties file, - QGPL is used. - If empty string is specified, an empty result set will - be returned. - @param table The table name. If null or empty string is specified, - an empty result set is returned. - @param unique The value indicating if unique indexes should be returned. - If true, only indexes for unique values is returned. - If false, all indexes is returned. - @param approximate The value indicating if the result is allowed to reflect - approximate or out-of-date values. This value is ignored. - @return The ResultSet containing the description of a table's indexes - and statistics. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getIndexInfo (String catalog, - String schema, - String table, - boolean unique, - boolean approximate) - throws SQLException - { - DBReplyRequestedDS reply = null; - - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc3 - - String metadataSourceProperty = connection_.getProperties().getString(JDProperties.METADATA_SOURCE); - //@pda 550 derived keys support. change to call sysibm.SQLSTATISTICS --start - //@mdsp comment //note always call SP in v6r1 and later. ROI was lacking in this area. - if (connection_.getVRM() >= JDUtilities.vrm610 - || (metadataSourceProperty - .equals(JDProperties.METADATA_SOURCE_STORED_PROCEDURE))) { - short iUnique; - short reserved = 0; - - if (unique) - iUnique = 0; - else - iUnique = 1; - - //Set the library name - if(schema != null) - schema = normalize(schema); - - // Set the table name - if(table != null) - table = normalize(table); - - /* - sysibm.SQLStatistics( - CatalogName varchar(128), - SchemaName varchar(128), - TableName varchar(128), - Unique Smallint, - Reserved Smallint, - Options varchar(4000)) - */ - CallableStatement cstmt = connection_.prepareCall("call SYSIBM" + getCatalogSeparator () + "SQLSTATISTICS(?,?,?,?,?,?)"); - - cstmt.setString(1, normalize(catalog)); - cstmt.setString(2, normalize(schema)); - cstmt.setString(3, normalize(table)); - cstmt.setShort(4, iUnique); - cstmt.setShort(5, reserved); - cstmt.setString(6, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - cstmt.execute(); - - ResultSet rs = cstmt.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cstmt.close(); //@mdrs2 - - return rs; //@mdrs - - } - //@pda 550 derived keys support. change to call sysibm.SQLSTATISTICS --end - - //-------------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - String[] fieldNames = {"TABLE_CAT", - "TABLE_SCHEM", - "TABLE_NAME", - "NON_UNIQUE", - "INDEX_QUALIFIER", - "INDEX_NAME", - "TYPE", - "ORDINAL_POSITION", - "COLUMN_NAME", - "ASC_OR_DESC", - "CARDINALITY", - "PAGES", - "FILTER_CONDITION", - }; - - SQLData[] sqlData = { new SQLVarchar (128, settings_), // catalog - new SQLVarchar (128, settings_), // schema - new SQLVarchar (128, settings_), // table - // when instantiating the non-unique small int - // pass in a boolean and it will give it the - // right value - new SQLSmallint (vrm), // non-unique - boolean //@trunc3 - new SQLVarchar (128, settings_), // index qualifier - new SQLVarchar (128, settings_), // index name - new SQLSmallint (vrm), // type //@trunc3 - new SQLSmallint (vrm), // ordinal position //@trunc3 - new SQLVarchar (128, settings_), // column name - new SQLVarchar (1, settings_), // sort sequence - new SQLInteger (vrm), // cardinality - new SQLInteger (vrm), // pages //@trunc3 - new SQLVarchar (128, settings_), // filter condition - }; - - int[] fieldNullables = { columnNullable, // catalog - columnNullable, // schema - columnNoNulls, // table - columnNoNulls, // non-unique - columnNullable, // index qualifier - columnNullable, // index name - columnNoNulls, // type - columnNoNulls, // ordinal position - columnNullable, // column name - columnNullable, // sort sequence - columnNoNulls, // cardinality - columnNoNulls, // pages - columnNullable, // filter condition - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows - // that are readable one at a time. - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if ((!isCatalogValid(catalog)) || // catalog is empty string - - // schema is not null and is empty string - ((schema != null) && (schema.length()==0)) || - - // table is null or empty string - (table==null) || (table.length()==0 )) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - else - { // parameter values are valid, build request & send - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_INDEX_INFO , - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - // Set the library name - if (schema == null) - { // use default SQL schema or qgpl - request.setLibraryName(normalize(connection_.getDefaultSchema()), connection_.converter_); // @E4C - } - else request.setLibraryName(normalize(schema), connection_.converter_); // @E4C - - - // Set the table name - request.setFileName(normalize(table), connection_.converter_); // @E4C - - // Set the long file name indicator - request.setFileShortOrLongNameIndicator (0xF0); // Long table names - - // Set the index unique rule - if (unique) - { // true - return indices for unique values - request.setIndexUniqueRule(0x01); - } - else - { - request.setIndexUniqueRule(0x04); - } - - // Set the Index Information to Return Bitmap - request.setIndexReturnInfoBitmap(0xBDC00000); - - - - //-------------------------------------------------------- - // Send the request and cache all results from the system - //-------------------------------------------------------- - - reply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = reply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = reply.getReturnCode(); - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - // Get the data format and result data - DBDataFormat dataFormat = reply.getDataFormat(); - DBData resultData = reply.getResultData(); - if (resultData != null) - { - - // Put the data format into a row object - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - - // Put the result data into a row cache - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache(row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - - // Create the mapped row format that is returned in the - // result set. - // This does not actual move the data, it just sets up - // the mapping. - JDFieldMap[] maps = new JDFieldMap[13]; - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog ()); - - maps[1] = new JDSimpleFieldMap (1); // schema - maps[2] = new JDSimpleFieldMap (2); // table - maps[3] = new JDNonUniqueFieldMap (3); // non-unique - maps[4] = new JDSimpleFieldMap (4); // index library name - maps[5] = new JDSimpleFieldMap (5); // index name - maps[6] = new JDHardcodedFieldMap(new Short ((short) tableIndexOther)); // type - - maps[7] = new JDSimpleFieldMap (7); // ordinal position - maps[8] = new JDSimpleFieldMap (6); // column name - maps[9] = new JDSimpleFieldMap (8); // sort sequence (collation) - // cardinality unknown - maps[10] = new JDHardcodedFieldMap(new Integer(-1)); - // number of pages unknown - maps[11] = new JDHardcodedFieldMap(new Integer(-1)); - maps[12] = new JDHardcodedFieldMap(new SQLVarchar(0, settings_), true, false); - - // Create the mapped row cache that is returned in the - // result set - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - else - rowCache = new JDSimpleRowCache(formatRow); - - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } // End of else to build and send request - } // End of try block - - catch (DBDataStreamException e) - { - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - // Return the results - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "IndexInfo", connection_, reply); //@in2 - - } // End of getIndexInfo - - - - //@G4A - /** - Returns the JDBC major version number. - - @return The JDBC major version number. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public int getJDBCMajorVersion () - throws SQLException - { - return AS400JDBCDriver.JDBC_MAJOR_VERSION_; //@pdc - } - - - - //@G4A - /** - Returns the JDBC minor version number. - - @return The JDBC minor version number. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public int getJDBCMinorVersion () - throws SQLException - { - return AS400JDBCDriver.JDBC_MINOR_VERSION_; //@pdc - } - - - - - /** - Returns the maximum length for an inline binary literal. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxBinaryLiteralLength () - throws SQLException - { - return 32739; - } - - - - /** - Returns the maximum length for a catalog name. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxCatalogNameLength () - throws SQLException - { - return 10; - } - - - - /** - Returns the maximum length for a character literal. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxCharLiteralLength () - throws SQLException - { - return 32739; - } - - - - /** - Returns the maximum length for a column name. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxColumnNameLength () - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm540) //@540 - return 128; //@540 - else - return 30; - } - - - - /** - Returns the maximum number of columns in a GROUP BY clause. - - @return The maximum number of columns. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxColumnsInGroupBy () - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm610) //@550 max columns in group by support - return 8000; //@550 - else //@550 - return 120; - } - - - - /** - Returns the maximum number of columns allowed in an index. - - @return The maximum number of columns. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxColumnsInIndex () - throws SQLException - { - return 120; - } - - - - /** - Returns the maximum number of columns in an ORDER BY clause. - - @return The maximum number of columns. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxColumnsInOrderBy () - throws SQLException - { - return 10000; - } - - - - /** - Returns the maximum number of columns in a SELECT list. - - @return The maximum number of columns. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxColumnsInSelect () - throws SQLException - { - return 8000; - } - - - - /** - Returns the maximum number of columns in a table. - - @return The maximum number of columns. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxColumnsInTable () - throws SQLException - { - return 8000; - } - - - - /** - Returns the number of active connections you can have at a time - to this database. - - @return The maximum number of connections or 0 - if no limit. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxConnections () - throws SQLException - { - // There is no limit. The specification does - // not come right out and say "0 means no limit", - // but that is how ODBC and many other parts - // of JDBC work. - return 0; - } - - - - /** - Returns the maximum cursor name length. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxCursorNameLength () - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm610) //@550A - return AS400JDBCStatement.MAX_CURSOR_NAME_LENGTH; - else //@550A - return AS400JDBCStatement.MAX_CURSOR_NAME_LENGTH_PRE_V6R1; //@550A - } - - - - /** - Returns the maximum length of an index. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxIndexLength () - throws SQLException - { - return 2000; - } - - - - /** - Returns the maximum length of a procedure name. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxProcedureNameLength () - throws SQLException - { - return 128; - } - - - - /** - Returns the maximum length of a single row. - - @return The maximum length (in bytes). - @exception SQLException This exception is never thrown. - **/ - public int getMaxRowSize () - throws SQLException - { - return 32766; - } - - - - /** - Returns the maximum length allowed for a schema name. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxSchemaNameLength () - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm710) //@128sch - return 128; //@128sch - else //@128sch - return 10; - } - - - - /** - Returns the maximum length of an SQL statement. - - @return The maximum length. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxStatementLength () - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm540) //@540 - return 1048576; //@540 Statement text is always sent in 2 byte Unicode, so the maximum statement length in characters will always be 1 MB - else //@540 - return 32767; - } - - - - /** - Returns the number of active statements you can have open at one - time. - - @return The maximum number of statements or 0 - if no limit. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxStatements () - throws SQLException - { - return AS400JDBCConnection.MAX_STATEMENTS_; // @D3C - } - - - - /** - Returns the maximum length of a table name. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxTableNameLength () - throws SQLException - { - return 128; - } - - - - /** - Returns the maximum number of tables in a SELECT. - - @return The maximum number of tables. - - @exception SQLException This exception is never thrown. - **/ - public int getMaxTablesInSelect () - throws SQLException - { - if (connection_.getVRM() >= JDUtilities.vrm540) // New in V5R4M0 @PDC - return 1000; //@pdc - else - return 32; - } - - - - /** - Returns the maximum length of a user name. - - @return The maximum length (in bytes). - - @exception SQLException This exception is never thrown. - **/ - public int getMaxUserNameLength () - throws SQLException - { - return 10; - } - - - - /** - Returns the list of supported math functions. - - @return The list of supported math functions, separated by commas. - - @exception SQLException This exception is never thrown. - **/ - public String getNumericFunctions () - throws SQLException - { - // @J0A added try/catch because we are now sending the system VRM - return JDEscapeClause.getNumericFunctions(connection_.getVRM()); // @J0M changed to send host version - } - - - - /** - Returns a description of the primary key columns. - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schema The schema name. If null is specified, the - default SQL schema specified in the URL is used. - If null is specified and a default SQL schema was not - specified in the URL, the first library specified - in the libraries properties file is used. - If null is specified, a default SQL schema was - not specified in the URL, and a library was not - specified in the libraries properties file, - QGPL is used. - If empty string is specified, an empty result set will - be returned. - @param table The table name. If null or empty string is specified, - an empty result set is returned. - - @return The ResultSet containing the description of the primary - key columns. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getPrimaryKeys (String catalog, - String schema, - String table) - throws SQLException - { - DBReplyRequestedDS reply = null; - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cs = connection_.prepareCall("CALL SYSIBM"+ getCatalogSeparator () +"SQLPRIMARYKEYS(?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, normalize(schema)); - cs.setString(3, normalize(table)); - cs.setString(4, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - //-------------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - String[] fieldNames = {"TABLE_CAT", - "TABLE_SCHEM", - "TABLE_NAME", - "COLUMN_NAME", - "KEY_SEQ", - "PK_NAME", - }; - - SQLData[] sqlData = { new SQLVarchar (128, settings_), // pk catalog - new SQLVarchar (128, settings_), // pk schema - new SQLVarchar (128, settings_), // pk table - new SQLVarchar (128, settings_), // pk column - new SQLSmallint (vrm), // key seq //@trunc3 - new SQLVarchar (128, settings_), // pk name - }; - - int[] fieldNullables = {columnNullable, // pk catalog - columnNullable, // pk schema - columnNoNulls, // pk table - columnNoNulls, // pk column - columnNoNulls, // key seq - columnNullable, // pk name - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows - // that are readable one at a time. - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if ((!isCatalogValid(catalog)) || // catalog is empty string - - // schema is not null and is empty string - ((schema != null) && (schema.length()==0)) || - - // table is null or empty string - (table==null) || (table.length()==0 )) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - else - { // parameter values are valid, build request & send - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_PRIMARY_KEY_INFO , - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - - // Set the primary key file library name - if (schema == null) - { // use default SQL schema or qgpl - request.setPrimaryKeyFileLibraryName(normalize(connection_.getDefaultSchema()), connection_.converter_); // @E4C - } - else request.setPrimaryKeyFileLibraryName(normalize(schema), connection_.converter_); // @E4C - - - // Set the primary key table name - request.setPrimaryKeyFileName(normalize(table), connection_.converter_); // @E4C - - // Set the primary key Information to Return Bitmap - request.setPrimaryKeyReturnInfoBitmap(0xBC000000); //@pdc - - // This is not documented in the LIPI, but it happens to work! @E2A - request.setFileShortOrLongNameIndicator(0xF0); // @E2A - - //-------------------------------------------------------- - // Send the request and cache all results from the system - //-------------------------------------------------------- - - reply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = reply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = reply.getReturnCode(); - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - // Get the data format and result data - DBDataFormat dataFormat = reply.getDataFormat(); - DBData resultData = reply.getResultData(); - if (resultData != null) - { - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache (row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - // Create the mapped row format that is returned in the - // result set. - // This does not actual move the data, it just sets up - // the mapping. - // boolean nullValue = true; // used when hardcoding null - JDFieldMap[] maps = new JDFieldMap[6]; - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog ()); - maps[1] = new JDSimpleDelimitedFieldMap (1); // pk schema //@PDC code to remove quotes - maps[2] = new JDSimpleFieldMap (2); // pk table - maps[3] = new JDSimpleFieldMap (3); // pk column - maps[4] = new JDCharToShortFieldMap (4); // key seq - //maps[5] = new JDHardcodedFieldMap (new SQLVarchar (0, settings_), true, false); //@pdd - maps[5] = new JDSimpleFieldMap (5); //@pda - - // Create the mapped row cache that is returned in the - // result set - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - else - rowCache = new JDSimpleRowCache(formatRow); - - } - finally - { - if (request != null) { request.returnToPool(); request= null; } - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } // End of else to build and send request - } // End of try block - - catch (DBDataStreamException e) - { - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - // Return the results - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "PrimaryKeys", connection_, reply); //@in2 - } - - - - /** - Returns a description of a catalog's stored procedure - parameters and result columns. - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schemaPattern The schema name pattern. If null is specified, - it will not be included in the selection - criteria. If empty string - is specified, an empty result set is returned. - @param procedurePattern The procedure name pattern. If null is specified, - it will not be included in the selection criteria. - If empty string - is specified, an empty result set is returned. - @param columnPattern The column name pattern. If null is specified, - it will not be included in the selection criteria. - If empty string - is specified, an empty result set is returned. - - @return The ResultSet containing the description of the - catalog's stored procedure parameters and result - columns. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getProcedureColumns (String catalog, - String schemaPattern, - String procedurePattern, - String columnPattern) - throws SQLException - { - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc3 - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cs = connection_.prepareCall("CALL SYSIBM"+ getCatalogSeparator () + "SQLPROCEDURECOLS(?,?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, normalize(schemaPattern)); - cs.setString(3, normalize(procedurePattern)); - cs.setString(4, normalize(columnPattern)); -/* ifdef JDBC40 - cs.setString(5, "DATATYPE='JDBC';JDBCVER='4.0';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); //@ver4 -endif */ -/* ifndef JDBC40 */ - cs.setString(5, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); -/* endif */ - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - - } - - //-------------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - String[] fieldNames = { "PROCEDURE_CAT", - "PROCEDURE_SCHEM", - "PROCEDURE_NAME", - "COLUMN_NAME", - "COLUMN_TYPE", - "DATA_TYPE", - "TYPE_NAME", - "PRECISION", - "LENGTH", - "SCALE", - "RADIX", - "NULLABLE", - "REMARKS" - }; - - SQLData[] sqlData = { new SQLVarchar (128, settings_), // catalog - new SQLVarchar (128, settings_), // schema - new SQLVarchar (128, settings_), // procedure - new SQLVarchar (128, settings_), // column name - new SQLSmallint (vrm), // column type //@trunc3 - new SQLSmallint (vrm), // data type //@trunc3 - new SQLVarchar (128, settings_), // type name - new SQLInteger (vrm), // precision //@trunc3 - new SQLInteger (vrm), // length //@trunc3 - new SQLSmallint (vrm), // scale //@trunc3 - new SQLInteger (vrm), // radix //@trunc3 - new SQLSmallint (vrm), // nullable //@trunc3 - new SQLVarchar (2000, settings_) // remarks - }; - - int[] fieldNullables = { - columnNullable, // catalog - columnNullable, // schema - columnNoNulls, // Procedure name - columnNoNulls, // column name - columnNoNulls, // column type - columnNoNulls, // data type - columnNoNulls, // type name - columnNoNulls, // precision - columnNoNulls, // length - columnNoNulls, // scale - columnNoNulls, // radix - columnNoNulls, // nullable - columnNoNulls // remarks - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if ((!isCatalogValid(catalog)) || // catalog is empty string - - // schema is not null and is empty string - ((schemaPattern != null) && (schemaPattern.length()==0)) || - - // procedure is not null and is empty string - ((procedurePattern != null) && (procedurePattern.length()==0)) || - - // column is not null and is empty string - ((columnPattern != null) && (columnPattern.length()==0))) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - else - - { // Parameters are valid, build request and send - StringBuffer selectStmt = new StringBuffer(); - selectStmt.append ("SELECT SPECIFIC_SCHEMA, SPECIFIC_NAME, PARAMETER_NAME, PARAMETER_MODE, "); - selectStmt.append ("DATA_TYPE, NUMERIC_PRECISION, CHARACTER_MAXIMUM_LENGTH, NUMERIC_SCALE, "); - selectStmt.append ("NUMERIC_PRECISION_RADIX, IS_NULLABLE, LONG_COMMENT "); - selectStmt.append ("FROM QSYS2" + getCatalogSeparator() + "SYSPARMS "); // use . or / - - - - - if (schemaPattern !=null) - { - JDSearchPattern schema = new JDSearchPattern (normalize(schemaPattern)); //@pdc normalize - String schemaWhereClause = schema.getSQLWhereClause("SPECIFIC_SCHEMA"); - selectStmt.append("WHERE " + schemaWhereClause); - } - - - if (procedurePattern !=null) - { - JDSearchPattern procedure = new JDSearchPattern (procedurePattern); - if (schemaPattern!=null) - { // Where clause already exists, add AND - selectStmt.append (" AND "); - } - - else - { // Where clause does not exist, add WHERE - selectStmt.append (" WHERE "); - } - - String procedureWhereClause = procedure.getSQLWhereClause("SPECIFIC_NAME"); - selectStmt.append(procedureWhereClause); - } - - - if (columnPattern!=null) - { // if null, no where clause is sent - JDSearchPattern column = new JDSearchPattern (columnPattern); - if ((schemaPattern!=null) || (procedurePattern!=null)) - { // Where clause already exists, add AND - selectStmt.append (" AND "); - } - else - { // Where clause does not exist, add WHERE - selectStmt.append (" WHERE "); - } - - String columnWhereClause = column.getSQLWhereClause("PARAMETER_NAME"); - selectStmt.append(columnWhereClause); - - } - - - - - // Add order by - selectStmt.append ("ORDER BY SPECIFIC_SCHEMA, SPECIFIC_NAME, ORDINAL_POSITION"); // Added ORDINAL_POSITION to fix JTOpen bug 3646, SYSPARMS table doesn't always have parameters in physical right order - - // Create statement object and do Execute Query - AS400JDBCStatement statement_ = null; //@scan1 - AS400JDBCResultSet serverResultSet = null; //@scan1 - JDRowCache serverRowCache = null; - try - { - statement_ = (AS400JDBCStatement)connection_.createStatement(); // caste needed - serverResultSet = (AS400JDBCResultSet) statement_.executeQuery (selectStmt.toString()); - - serverRowCache = new JDSimpleRowCache(serverResultSet.getRowCache()); - - - JDFieldMap[] maps = new JDFieldMap[13]; - - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog()); - maps[1] = new JDSimpleFieldMap (1); // schema - maps[2] = new JDSimpleFieldMap (2); // procedure - maps[3] = new JDHandleNullFieldMap (3, ""); // parameter name (col name) - maps[4] = new JDParameterModeFieldMap(4); // Parameter mode (col type) - - maps[5] = new JDDataTypeFieldMap(5, 7, 6, 8, 0, connection_.getVRM(), connection_.getProperties()); // @M0C // data type - converts from string to short //@KKB pass 0 for ccsid - maps[6] = new JDSimpleFieldMap (5); // type name - - maps[7] = new JDHandleNullFieldMap (6, new Integer (0)); // precision - maps[8] = new JDHandleNullFieldMap (7, new Integer (0)); // length - - maps[9] = new JDHandleNullFieldMap (8, new Short ((short) 0)); // scale - maps[10] = new JDHandleNullFieldMap (9, new Short ((short) 0)); // radix - - maps[11] = new JDNullableSmallintFieldMap(10); // nullable - is Nullable - maps[12] = new JDHandleNullFieldMap (11, ""); // remarks - long comment - - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - - }finally //@scan1 - { - try{ - if(serverResultSet != null) - serverResultSet.close(); - }catch(Exception e){} //allow next close to execute - if(statement_ != null) - statement_.close (); - } - } // End of else build request and send - - - } // End of try block - - catch (SQLException e) - { - // System.out.println(e); - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "ProcedureColumns", connection_, null); //@in2 - - } // End of getProcedureColumns - - - - /** - Returns the description of the stored procedures available - in a catalog. - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schemaPattern The schema name pattern. If null is specified, - it will not be included in the selection - criteria. If empty string - is specified, an empty result set is returned. - @param procedurePattern The procedure name pattern. If null is specified, - it will not be included in the selection - criteria. If empty string - is specified, an empty result set is returned. - - @return The ResultSet containing the description of the - stored procedures available in the catalog. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getProcedures (String catalog, - String schemaPattern, - String procedurePattern) - throws SQLException - { - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc3 - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cs = connection_.prepareCall("CALL SYSIBM"+ getCatalogSeparator () + "SQLPROCEDURES(?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, normalize(schemaPattern)); - cs.setString(3, normalize(procedurePattern)); - cs.setString(4, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - //-------------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - String[] fieldNames = { "PROCEDURE_CAT", - "PROCEDURE_SCHEM", - "PROCEDURE_NAME", - "RESERVED1", - "RESERVED2", - "RESERVED3", - "REMARKS", -/* ifdef JDBC40 - "PROCEDURE_TYPE", - "SPECIFIC_NAME" //@JDBC40 -endif */ -/* ifndef JDBC40 */ - "PROCEDURE_TYPE" -/* endif */ - }; - - SQLData[] sqlData = { new SQLVarchar (128, settings_), // catalog - new SQLVarchar (128, settings_), // schema - new SQLVarchar (128, settings_), // procedure - new SQLInteger (vrm), // reserved //@trunc3 - new SQLInteger (vrm), // reserved //@trunc3 - new SQLInteger (vrm), // reserved //@trunc3 - new SQLVarchar (2000, settings_), // remarks -/* ifdef JDBC40 - new SQLSmallint (vrm), // procedure type //@trunc3 - new SQLVarchar (128, settings_) // specific name //@JDBC40 - -endif */ -/* ifndef JDBC40 */ - new SQLSmallint (vrm) // procedure type //@trunc3 -/* endif */ - }; - - int[] fieldNullables = { - columnNullable, // Procedure catalog - columnNullable, // Procedure schema - columnNoNulls, // Procedure name - columnNullable, // Reserved 1 - columnNullable, // Reserved 2 - columnNullable, // Reserved 3 - columnNoNulls, // Remarks -/* ifdef JDBC40 - columnNoNulls, // Procedure type - columnNoNulls // Specific name //@JDBC40 -endif */ -/* ifndef JDBC40 */ - columnNoNulls // Procedure type -/* endif */ - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if ((!isCatalogValid(catalog)) || // catalog is empty string - - // schema is not null and is empty string - ((schemaPattern != null) && (schemaPattern.length()==0)) || - - // procedure is not null and is empty string - ((procedurePattern!=null) && (procedurePattern.length()==0))) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - else - { // Parameters are valid, build request and send - StringBuffer selectStmt = new StringBuffer(); -/* ifdef JDBC40 - selectStmt.append ("SELECT ROUTINE_SCHEMA, ROUTINE_NAME, REMARKS, RESULTS, SPECIFIC_NAME ");//@PROC //@JDBC40 -endif */ -/* ifndef JDBC40 */ - selectStmt.append ("SELECT ROUTINE_SCHEMA, ROUTINE_NAME, REMARKS, RESULTS ");//@PROC -/* endif */ - selectStmt.append ("FROM QSYS2" + getCatalogSeparator() + "SYSPROCS "); // use . or / - - - - if (schemaPattern !=null) - { - JDSearchPattern schema = new JDSearchPattern (schemaPattern); - String schemaWhereClause = schema.getSQLWhereClause("ROUTINE_SCHEMA");//@PROC - selectStmt.append("WHERE " + schemaWhereClause); - } - - - if (procedurePattern !=null) - { - JDSearchPattern procedure = new JDSearchPattern (procedurePattern); - if (schemaPattern!=null) - { // Where clause already exists, add AND - selectStmt.append (" AND "); - } - - else - { // Where clause does not exist, add WHERE - selectStmt.append (" WHERE "); - } - - String procedureWhereClause = procedure.getSQLWhereClause("ROUTINE_NAME");//@PROC - selectStmt.append(procedureWhereClause); - } - - - - // Add order by - selectStmt.append (" ORDER BY ROUTINE_SCHEMA, ROUTINE_NAME");//@PROC - - - // Create statement object and do Execute Query - AS400JDBCStatement statement_ = (AS400JDBCStatement)connection_.createStatement(); // caste needed - - AS400JDBCResultSet serverResultSet = (AS400JDBCResultSet) statement_.executeQuery (selectStmt.toString()); - - JDRowCache serverRowCache = new JDSimpleRowCache(serverResultSet.getRowCache()); - statement_.close (); -/* ifdef JDBC40 - JDFieldMap[] maps = new JDFieldMap[9]; -endif */ -/* ifndef JDBC40 */ - JDFieldMap[] maps = new JDFieldMap[8]; -/* endif */ - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog()); - maps[1] = new JDSimpleFieldMap (1); // schema - maps[2] = new JDSimpleFieldMap (2); // procedure - maps[3] = new JDHardcodedFieldMap (new Integer (0)); - maps[4] = new JDHardcodedFieldMap (new Integer (0)); - maps[5] = new JDHardcodedFieldMap (new Integer (0)); - maps[6] = new JDHandleNullFieldMap (3, ""); // remarks - maps[7] = new JDProcTypeFieldMap (4); -/* ifdef JDBC40 - maps[8] = new JDSimpleFieldMap (5); //@jdbc40 -endif */ - - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - - } // End of else build request and send - - - } // End of try block - - catch (SQLException e) - { - // System.out.println(e); - // e.printStackTrace(); // method on throwable object - // @B1D JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - throw e; // @B1A - } - - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "Procedures", connection_, null); //@in2 - - } - - - - /** - Returns the DB2 for IBM i SQL term for "procedure". - - @return The term for "procedure". - - @exception SQLException This exception is never thrown. - **/ - public String getProcedureTerm () - throws SQLException - { - return AS400JDBCDriver.getResource ("PROCEDURE_TERM"); - } - - - - //@G4A - /** - Retrieves the default holdability of this ResultSet object. Holdability is - whether ResultSet objects are kept open when the statement is committed. - - @return Always ResultSet.HOLD_CURSORS_OVER_COMMIT. - - @exception SQLException This exception is never thrown. - - @since Modification 5 - **/ - public int getResultSetHoldability () - throws SQLException - { - return AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT; - } - - - - /** - Returns the schema names available in this database. - This will return a ResultSet with a list of all the - libraries. - - @return The ResultSet containing the list of all the libraries. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getSchemas () - throws SQLException - { - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cs = connection_.prepareCall("CALL SYSIBM"+ getCatalogSeparator () + "SQLTABLES(?,?,?,?,?)"); - - cs.setString(1, "%"); - cs.setString(2, "%"); - cs.setString(3, "%"); - cs.setString(4, "%"); - cs.setString(5, "DATATYPE='JDBC';GETSCHEMAS=1;CURSORHOLD=1"); - cs.execute(); - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - return JDUtilities.getLibraries(this, connection_, settings_, false); //@DELIMa - } - - - - /** - Returns the DB2 for IBM i SQL term for "schema". - - @return The term for schema. - - @exception SQLException This exception is never thrown. - **/ - public String getSchemaTerm () - throws SQLException - { - return AS400JDBCDriver.getResource ("SCHEMA_TERM"); - } - - - - /** - Returns the string used to escape wildcard characters. - This is the string that can be used to escape '_' or '%' - in string patterns. - - @return The escape string. - - @exception SQLException This exception is never thrown. - **/ - public String getSearchStringEscape () - throws SQLException - { - return JDSearchPattern.getEscape (); - } - - - - /** - Returns the list of all of the database's SQL keywords - that are not also SQL92 keywords. - - @return The list of SQL keywords, separated by commas. - - @exception SQLException This exception is never thrown. - **/ - public String getSQLKeywords () - throws SQLException - { - return "AFTER,ALIAS,ALLOW,APPLICATION,ASSOCIATE,ASUTIME,AUDIT," + // @J2M - "AUX,AUXILIARY,BEFORE,BINARY," + // @J2A - "BUFFERPOOL,CACHE,CALL,CALLED,CAPTURE,CARDINALITY,CCSID,CLUSTER," + // @J2A - "COLLECTION,COLLID,COMMENT,CONCAT,CONDITION,CONTAINS,COUNT_BIG," + // @J2A - "CURRENT_LC_CTYPE," + // @J2A - "CURRENT_PATH,CURRENT_SERVER,CURRENT_TIMEZONE,CYCLE,DATA," + // @J2A - "DATABASE,DAYS," + // @J2A - "DB2GENERAL,DB2GENRL,DB2SQL,DBINFO,DEFAULTS,DEFINITION," + // @J2A - "DETERMINISTIC," + // @J2A - "DISALLOW,DO,DSNHATTR,DSSIZE,DYNAMIC,EACH,EDITPROC,ELSEIF," + // @J2A - "ENCODING,END-EXEC1," + // @J2A - "ERASE,EXCLUDING,EXIT,FENCED,FIELDPROC,FILE,FINAL,FREE,FUNCTION," + // @J2A - "GENERAL," + // @J2A - "GENERATED,GRAPHIC,HANDLER,HOLD,HOURS,IF,INCLUDING,INCREMENT," + // @J2A - "INDEX," + // @J2A - "INHERIT,INOUT,INTEGRITY,ISOBID,ITERATE,JAR,JAVA,LABEL,LC_CTYPE," + // @J2A - "LEAVE," + // @J2A - "LINKTYPE,LOCALE,LOCATOR,LOCATORS,LOCK,LOCKMAX,LOCKSIZE,LONG,LOOP," + // @J2A - "MAXVALUE,MICROSECOND,MICROSECONDS,MINUTES,MINVALUE,MODE,MODIFIES," + // @J2A - "MONTHS," + // @J2A - "NEW,NEW_TABLE,NOCACHE,NOCYCLE,NODENAME,NODENUMBER,NOMAXVALUE," + // @J2A - "NOMINVALUE," + // @J2A - "NOORDER,NULLS,NUMPARTS,OBID,OLD,OLD_TABLE,OPTIMIZATION,OPTIMIZE," + // @J2A - "OUT,OVERRIDING,PACKAGE,PARAMETER,PART,PARTITION,PATH,PIECESIZE," + // @J2A - "PLAN," + // @J2A - "PRIQTY,PROGRAM,PSID,QUERYNO,READS,RECOVERY,REFERENCING,RELEASE," + // @J2A - "RENAME,REPEAT,RESET,RESIGNAL,RESTART,RESULT,RESULT_SET_LOCATOR," + // @J2A - "RETURN," + // @J2A - "RETURNS,ROUTINE,ROW,RRN,RUN,SAVEPOINT,SCRATCHPAD,SECONDS,SECQTY," + // @J2A - "SECURITY,SENSITIVE,SIGNAL,SIMPLE,SOURCE,SPECIFIC,SQLID,STANDARD," + // @J2A - "START,STATIC,STAY,STOGROUP,STORES,STYLE,SUBPAGES,SYNONYM,SYSFUN," + // @J2A - "SYSIBM," + // @J2A - "SYSPROC,SYSTEM,TABLESPACE,TRIGGER,TYPE,UNDO,UNTIL,VALIDPROC," + // @J2A - "VARIABLE," + // @J2A - "VARIANT,VCAT,VOLUMES,WHILE,WLM,YEARS"; // @J2A - } - - - - //@G4A - /** - Indicates whether the SQLSTATEs returned by SQLException.getSQLState is X/Open SQL CLI or - SQL99. - - @return Always sqlStateSQL99. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public int getSQLStateType () - throws SQLException - { - return AS400JDBCDatabaseMetaData.sqlStateSQL99; - } - - - - /** - Returns the list of supported string functions. - - @return The list of supported string functions, separated by commas. - - @exception SQLException This exception is never thrown. - **/ - public String getStringFunctions () - throws SQLException - { - // @J0A added try/catch because we are now sending the system VMR - return JDEscapeClause.getStringFunctions(connection_.getVRM()); // @J0M changed to send host version - } - - - - //@G4A - /** - Returns a ResultSet containing descriptions of the table hierarchies - in a schema. - - This method only applies to the attributes of a - structured type. Distinct types are stored in the datatypes - catalog, not the attributes catalog. Since DB2 for IBM i does not support - structured types at this time, an empty ResultSet will always be returned - for calls to this method. - - @param catalog The catalog name. - @param schemaPattern The schema name pattern. - @param typeNamePattern The type name pattern. - - @return The empty ResultSet - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public ResultSet getSuperTables (String catalog, String schemaPattern, String typeNamePattern) - throws SQLException - { - // We return an empty result set because this is not supported by our driver - Statement statement = connection_.createStatement(); - return statement.executeQuery("SELECT VARCHAR('1', 128) AS TYPE_CAT, " + - "VARCHAR('2', 128) AS TYPE_SCHEM, " + - "VARCHAR('3', 128) AS TYPE_NAME, " + - "VARCHAR('4', 128) AS SUPERTYPE_NAME " + - "FROM QSYS2" + getCatalogSeparator() + - "SYSTYPES WHERE 1 = 2 FOR FETCH ONLY "); - } - - - - //@G4A - /** - Returns a ResultSet containing descriptions of user-defined type hierarchies - in a schema. - - This method only applies to the attributes of a - structured type. Distinct types are stored in the datatypes - catalog, not the attributes catalog. Since DB2 for IBM i does not support - structured types at this time, an empty ResultSet will always be returned - for calls to this method. - - @param catalog The catalog name. - @param schemaPattern The schema name pattern. - @param typeNamePattern The type name pattern. - - @return The empty result set - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public ResultSet getSuperTypes (String catalog, String schemaPattern, String typeNamePattern) - throws SQLException - { - // We return an empty result set because this is not supported by our driver - Statement statement = connection_.createStatement(); - return statement.executeQuery("SELECT VARCHAR('1', 128) AS TYPE_CAT, " + - "VARCHAR('2', 128) AS TYPE_SCHEM, " + - "VARCHAR('3', 128) AS TYPE_NAME, " + - "VARCHAR('4', 128) AS SUPERTYPE_CAT, " + - "VARCHAR('5', 128) AS SUPERTYPE_SCHEM, " + - "VARCHAR('6', 128) AS SUPERTYPE_NAME " + - "FROM QSYS2" + getCatalogSeparator() + - "SYSTYPES WHERE 1 = 2 FOR FETCH ONLY "); - } - - - - /** - Returns the list of supported system functions. - - @return The list of supported system functions, separated by commas. - - @exception SQLException This exception is never thrown. - **/ - public String getSystemFunctions () - throws SQLException - { - // @J0A added try/catch because we are now sending the system VMR - return JDEscapeClause.getSystemFunctions(connection_.getVRM()); // @J0M changed to send host version - } - - - - /** - Returns the description of the access rights for each table - available in a catalog. Note that a table privilege applies - to one or more columns in a table. - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schemaPattern The schema name pattern. - If the "metadata source" connection property is set to 0 - and null is specified, no value is sent to the system and - the default of *USRLIBL is used. - If the "metadata source" connection property is set to 1 - and null is specified, then information from all schemas - will be returned. - - If empty string is specified, an empty - result set is returned. - @param tablePattern The table name. If null is specified, - no value is sent to the system and the system - default of *ALL is used. If empty string - is specified, an empty result set is returned. - @return The ResultSet containing the description of the - access rights for each table available in the - catalog. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getTablePrivileges (String catalog, - String schemaPattern, - String tablePattern) - throws SQLException - { - DBReplyRequestedDS reply = null; - connection_.checkOpen (); - // int vrm = connection_.getVRM(); //@trunc3 - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - CallableStatement cs = connection_.prepareCall("CALL SYSIBM"+ getCatalogSeparator () + "SQLTABLEPRIVILEGES(?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, normalize(schemaPattern)); - cs.setString(3, normalize(tablePattern)); - cs.setString(4, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - //----------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - String[] fieldNames = {"TABLE_CAT", - "TABLE_SCHEM", - "TABLE_NAME", - "GRANTOR", - "GRANTEE", - "PRIVILEGE", - "IS_GRANTABLE", - }; - - - SQLData[] sqlData = { new SQLVarchar (128, settings_), // catalog - new SQLVarchar (128, settings_), // library - new SQLVarchar (128, settings_), // table - new SQLVarchar (128, settings_), // grantor - new SQLVarchar (128, settings_), // grantee - new SQLVarchar (128, settings_), // privilege - new SQLVarchar (3, settings_), // is_grantable - }; - - int[] fieldNullables = {columnNullable, // catalog - columnNullable, // library - columnNoNulls, // table - columnNullable, // grantor - columnNoNulls, // grantee - columnNoNulls, // privilege - columnNullable, // is_grantable - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows - // that are readable one at a time. - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - if (!isCatalogValid(catalog) || // catalog is empty string - - // schema is not null and is empty string - ((schemaPattern != null) && (schemaPattern.length()==0)) || - - // table is not null and is empty string - ((tablePattern != null) && (tablePattern.length()==0))) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - - else - { // parameter values are valid, build request & send - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_FILE_INFO, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - // Set the library name and search pattern indicator - // If null, do not set parameter. The system default - // value of *USRLIBL is used. - if (schemaPattern!=null) - { - JDSearchPattern schema = new JDSearchPattern(schemaPattern); - request.setLibraryName(normalize(schema.getPatternString()), connection_.converter_); // @E4C - request.setLibraryNameSearchPatternIndicator(schema.getIndicator()); - } - - - - // Set the table name and search pattern indicator - // If null, do not set parameter. The system default - // value of *ALL is used. - if (tablePattern!=null) - { - JDSearchPattern table = new JDSearchPattern(tablePattern); - request.setFileName(normalize(table.getPatternString()),connection_.converter_); // @E4C - request.setFileNameSearchPatternIndicator(table.getIndicator()); - } - - request.setFileShortOrLongNameIndicator (0xF0); // Long table names - - - request.setFileReturnInfoBitmap (0xA1000000); // Return bitmap - - // Order the results by table type, table schema, table name - request.setFileInfoOrderByIndicator (2); - - - //-------------------------------------------------------- - // Send the request and cache all results from the system - //-------------------------------------------------------- - - reply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = reply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = reply.getReturnCode(); - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - - // Get the data format and result data - DBDataFormat dataFormat = reply.getDataFormat(); - DBData resultData = reply.getResultData(); - - // Put the data format into a row object - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - - // Put the result data into a row cache - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache (row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - - // Create the mapped row format that is returned in the - // result set. - // This does not actual move the data, it just sets up - // the mapping. - JDFieldMap[] maps = new JDFieldMap[7]; - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog ()); - maps[1] = new JDSimpleFieldMap (1); // library - maps[2] = new JDSimpleFieldMap (2); // table - maps[3] = new JDHardcodedFieldMap ("", true, false); // grantor - maps[4] = new JDHardcodedFieldMap (getUserName ()); // grantee - return userid - maps[5] = new JDPrivilegeFieldMap (3); // privilege - maps[6] = new JDHardcodedFieldMap ("", true, false); // is_grantable - - // Create the mapped row cache that is returned in the - // result set - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - - } - finally - { - if (request != null) { request.returnToPool(); request = null;} - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } // End of else to build and send request - } // End of try block - - catch (DBDataStreamException e) - { - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - // Return the results - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "TablePrivileges", connection_, reply); //@in2 //@G4C - } - - - - /** - Returns the description of the tables available in a catalog. - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schemaPattern The schema name pattern. - If the "metadata source" connection property is set to 0 - and null is specified, no value is sent to the system and - the default of *USRLIBL is used. - If the "metadata source" connection property is set to 1 - and null is specified, then information from all schemas - will be returned. If an empty string - is specified, an empty result set is returned. - @param tablePattern The table name pattern. If null is specified, - no value is sent to the system and the system - default of *ALL is used. If empty string - is specified, an empty result set is returned. - @param tableTypes The list of table types to include, or null to - include all table types. Valid types are: - TABLE, VIEW, SYSTEM TABLE, MATERIALIZED QUERY TABLE, and ALIAS. - @return The ResultSet containing the description of the - tables available in the catalog. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getTables (String catalog, - String schemaPattern, - String tablePattern, - String tableTypes[]) - throws SQLException - { - DBReplyRequestedDS reply = null; - - connection_.checkOpen ();// Verify that a connection - // is available for use. Exception - // is thrown if not available - - // int vrm = connection_.getVRM(); //@trunc3 - - - //@mdsp SYSIBM SP Call and Native logic - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - // Handle processing the array of table types. - //bite the bullet and follow Native JDBC logic - boolean rsEmpty = false; - String typeString = EMPTY_STRING; - if (!rsEmpty) { - int i; - int stringsInList = 0; - - if (tableTypes != null) { - for (i = 0; i < tableTypes.length; i++) { - String check = tableTypes[i]; - - if ((check.equalsIgnoreCase(VIEW)) || - (check.equalsIgnoreCase(TABLE)) || - (check.equalsIgnoreCase(SYSTEM_TABLE)) || - (check.equalsIgnoreCase(ALIAS)) || - (check.equalsIgnoreCase(SYNONYM)) || - (check.equalsIgnoreCase(MQT))) - { - - if (check.equalsIgnoreCase(SYNONYM)) { - check = ALIAS; - } - stringsInList++; - if (stringsInList > 1) - typeString = typeString.concat(","); - typeString = typeString.concat(check); - } - } - - // If there were no valid types, ensure an empty result set. - if (stringsInList == 0) - rsEmpty = true; - } - } - - // If an empty result set is to be generated, produce the values to - // do so here. - if (rsEmpty) { - schemaPattern = FAKE_VALUE; - tablePattern = FAKE_VALUE; - typeString = typeString.concat(TABLE); //@scan1 - } - - - CallableStatement cs = connection_.prepareCall("CALL SYSIBM" + getCatalogSeparator () - + "SQLTABLES(?,?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, normalize(schemaPattern)); - cs.setString(3, normalize(tablePattern)); - cs.setString(4, normalize(typeString)); - cs.setString(5, - "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - cs.execute(); - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - - } - - - //----------------------------------------------------- - // Set up the result set in the format required by JDBC - //----------------------------------------------------- - - boolean isJDBC3 = JDUtilities.JDBCLevel_ >= 30; //@F2A @j4a - - String[] fieldNames = null; //@F2C - SQLData[] sqlData = null; //@F2C - int[] fieldNullables = null; //@F2C - if (!isJDBC3) //@F2A - { - fieldNames = new String[] { "TABLE_CAT", - "TABLE_SCHEM", - "TABLE_NAME", - "TABLE_TYPE", - "REMARKS"}; - - sqlData = new SQLData[] { new SQLVarchar (128, settings_), - new SQLVarchar (128, settings_), - new SQLVarchar (128, settings_), - new SQLVarchar (128, settings_), - new SQLVarchar (254, settings_)}; - - - fieldNullables = new int[] {columnNullable, // Table catalog - columnNullable, // Table schema - columnNoNulls, // Table name - columnNoNulls, // Table type - columnNoNulls}; // Remarks - } - else - { - fieldNames = new String[] { "TABLE_CAT", - "TABLE_SCHEM", - "TABLE_NAME", - "TABLE_TYPE", - "REMARKS", - "TYPE_CAT", //@G4A - "TYPE_SCHEM", //@G4A - "TYPE_NAME", //@G4A - "SELF_REFERENCING_COL_NAME", //@G4A - "REF_GENERATION"}; //@G4A - - sqlData = new SQLData[] { new SQLVarchar (128, settings_), - new SQLVarchar (128, settings_), - new SQLVarchar (128, settings_), - new SQLVarchar (128, settings_), - new SQLVarchar (254, settings_), - new SQLVarchar (128, settings_), //@G4A - new SQLVarchar (128, settings_), //@G4A - new SQLVarchar (128, settings_), //@G4A - new SQLVarchar (128, settings_), //@G4A - new SQLVarchar (128, settings_)}; //@G4A - - - fieldNullables = new int[] {columnNullable, // Table catalog - columnNullable, // Table schema - columnNoNulls, // Table name - columnNoNulls, // Table type - columnNoNulls, // Remarks - columnNullable, // Types catalog //@G4A - columnNullable, // Types schema //@G4A - columnNullable, // Type name //@G4A - columnNullable, // Self referencing column name //@G4A - columnNullable}; // Reference generation //@G4A - } - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows that - // are readable one at a time - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - if (!isCatalogValid(catalog) || // catalog is empty string - - // schema is not null and is empty string - ((schemaPattern != null) && (schemaPattern.length()==0)) || - - // table is not null and is empty string - ((tablePattern != null) && (tablePattern.length()==0))) - { // Return empty result set - rowCache = new JDSimpleRowCache(formatRow); - } - - - else - { // schema, table, and catalog are valid, create and send request - - //------------------------------------------------------- - // Set the file attribute parm of the Retrieve File - // Information (ROI) function based on the types array - // provided. ROI uses the following values: - // '0001'x = all files - // '0002'x = physical files and alias files //@K3C changed to match host server LIPI - // '0003'x = logical files and alias files //@K3C - // '0004'x = tables and alias files //@K3C - // '0005'x = views and alias files //@K3C - // '0006'x = system tables - // '0007'x = tables and views and alias files //@K3C - // '0008'x = tables and system tables and alias files //@K3C - // '0009'x = views and system tables and alias files //@K3C - // '000A'x = alias files //@K1A - // '000B'x = tables and materialized query tables //@K1A - // '000C'x = views and materialized query tables //@K1A - // '000D'x = system tables and materialized query tables //@K1A - // '000E'x = tables, views, and materialized query tables //@K1A - // '000F'x = tables, system tables, and materialized query tables //@K1A - // '0010'x = views, system tables, and materizlized query tables //@K1A - // '0011'x = materialized query tables //@K1A - // - // Options '000B'x - '0011'x are for V5R3 or higher systems - // - // If null is specified, file attributes is set to 1. - // - // If none of the above values are specified, file - // attribute is set to -1 and an empty result set will - // be created. No request is sent to the system. - //-------------------------------------------------------- - int fileAttribute; - boolean needToRemoveAliases = true; //@K3A - if (tableTypes != null) - { - boolean typeTable = false; // false = don't include table type - boolean typeView = false; - boolean typeSystemTable = false; - boolean typeMQTable = false; //@K1A - boolean typeAlias = false; //@K3A - - // Walk thru table types to determine which ones we need to include - for (int i = 0; i < tableTypes.length; ++i) - { - if (tableTypes[i].equalsIgnoreCase ("TABLE")) - typeTable = true; // Include tables - else if (tableTypes[i].equalsIgnoreCase ("VIEW")) - typeView = true; // Include views - else if (tableTypes[i].equalsIgnoreCase ("SYSTEM TABLE")) - typeSystemTable = true; // Include system tables - else if (tableTypes[i].equalsIgnoreCase ("MATERIALIZED QUERY TABLE") && connection_.getVRM() >= JDUtilities.vrm530) //@K1A - typeMQTable = true; //@K1A - else if(tableTypes[i].equalsIgnoreCase("ALIAS")) //@K3A - typeAlias = true; //@K3A - } // end of for loop - - if(typeAlias) //@K3A - needToRemoveAliases = false; //@K3A - - if (typeTable) - { - if (typeView) - { - if (typeSystemTable) - fileAttribute = 1; // All - else if(typeMQTable) //@K1A - { - fileAttribute = 14; //tables, views, and MQT's //@K1A - needToRemoveAliases = false; //@K3A no aliases are returned - } - else - fileAttribute = 7; // Tables and views - } - else if(typeSystemTable) //@K1A Not Views - { //@K1A - if(typeMQTable) //@K1A - { - fileAttribute = 15; //@K1A - needToRemoveAliases = false; //@K3A no aliases are returned - } - else //@K1A - fileAttribute = 8; // Tables and system tables - } //@K1A - else if(typeMQTable) //@K1A Not Views and not system tables - { //@K1A - fileAttribute = 11; //@K1A - needToRemoveAliases = false; //@K3A no aliases are returned - } //@K1A - else - fileAttribute = 4; // Tables - } // end of if typeTable - else if(typeMQTable) //@K1A - { //@K1A - if(typeView) //@K1A - { //@K1A - if(typeSystemTable) //@K1A - fileAttribute = 16; //views, system tables, and MQT's //@K1A - else //@K1A - fileAttribute = 12; //views and MQT's //@K1A - } //@K1A - else if(typeSystemTable) //@K1A - fileAttribute = 13; //system tables and MQT's //@K1A - else //@K1A - fileAttribute = 17; //MQT's //@K1A - needToRemoveAliases = false; //@K3A no aliases are returned - } //@K1A - else - { // Not tables - if (typeView) - { - if (typeSystemTable) - fileAttribute = 9; // Views and system tables - else - fileAttribute = 5; // Views - } - else - { - if (typeSystemTable) - { - fileAttribute = 6; // System tables - needToRemoveAliases = false; //@K3A no aliases are returned - } - else if(typeAlias && connection_.getVRM() >= JDUtilities.vrm430) //@K3A Aliases are only supported on V4R3 and higher - fileAttribute = 10; //@K3A - else - fileAttribute = -1; // Unknown type - // Will return empty results - } - } // End of not tables else - } // End of if tables != nulls - else - { - // Table types was set to null which implies all - // types are to be returned - fileAttribute = 1; // All - } - - - //------------------------------------------------ - // Create the request to Retrieve File Information - //------------------------------------------------ - if (fileAttribute != -1) - { // If -1, return empty set - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_FILE_INFO, id_, - DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT - + DBBaseRequestDS.ORS_BITMAP_RESULT_DATA,0); - - - //-------------------------------------------------- - // Set the parameters for the request - //-------------------------------------------------- - - - // Set the Library Name and Library Name Search Pattern parameters - // If null, do not set parameter. The system default value of - // *USRLIBL is used. - if (schemaPattern != null) - { // use default SQL schema or qgpl - JDSearchPattern schema = new JDSearchPattern(schemaPattern); - request.setLibraryName (normalize(schema.getPatternString()), connection_.converter_); // @E4C - request.setLibraryNameSearchPatternIndicator(schema.getIndicator()); - } - - - - // Set the Table Name and Table Name Search Pattern parameters - // If null, do not set parameter. The system default value of - // *ALL is used. - if (tablePattern!=null) - { - JDSearchPattern table = new JDSearchPattern(tablePattern); - request.setFileName (normalize(table.getPatternString()), connection_.converter_); // @E4C - request.setFileNameSearchPatternIndicator(table.getIndicator()); - } - - - - // Set other parameters - request.setFileShortOrLongNameIndicator (0xF0); // Long table names. - request.setFileAttribute (fileAttribute); - - // Set the information to return. Always return the - // library name, file name, and file attribute (ODBC - // type). Also return either the remarks or the file - // text depending on what the "remarks" attribute - // is set to. - - // Get the current value for the "remarks" property - // and check to see if it is sql or system - // connection_.getProperties() returns the JDProperties - // object - - - if (connection_.getProperties().equals - (JDProperties.REMARKS, JDProperties.REMARKS_SQL)) - { - request.setFileReturnInfoBitmap (0xF0000000); // return remarks - } - else - { - request.setFileReturnInfoBitmap (0xB4000000); // return text - } - - // Order the results by table type, table schema, table name - // This is the same as ordering by tables on the system - request.setFileInfoOrderByIndicator (2); - - - //------------------------------------------------------- - // Send the request and cache all results from the system - //------------------------------------------------------- - - reply = connection_.sendAndReceive (request); - - // Check for errors - throw exception if errors - // were returned - int errorClass = reply.getErrorClass(); - if (errorClass != 0) - { - int returnCode = reply.getReturnCode(); - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - - // Get the data format and result data - // The result data is parsed via JDServerRow getData - DBDataFormat dataFormat = reply.getDataFormat (); - DBData resultData = reply.getResultData (); - if (resultData != null) - { - // If the user didn't request aliases - if(needToRemoveAliases) //@K3A - parseResultData(resultData, dataFormat); //@K3A - - // Put the data format into a row format. Handles data types - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - - // Put the result data into a row cache - // ServerRowCache needs rowFormat to get offset and other info - // Only need this with this type of row cache (not with simple) - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache(row, connection_, id_, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - - // This is not actually moving data, it just sets up the mapping - JDFieldMap[] maps = null; //@F2C - if (!isJDBC3) //@F2A - maps = new JDFieldMap[5]; - else - maps = new JDFieldMap[10]; - - if (connection_.getProperties().equals - (JDProperties.REMARKS, JDProperties.REMARKS_SQL)) - { - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog()); - maps[1] = new JDSimpleFieldMap (1); // schema // @A3C @E4C - maps[2] = new JDSimpleFieldMap (3); // table - maps[3] = new JDTableTypeFieldMap (4); // table type - maps[4] = new JDSimpleFieldMap (2); // remarks - //@G4A The below fields will all return null. We have distinct types - //@G4A instead of abstract types here, so a request returns no - //@G4A type information. - if (isJDBC3) - { - maps[5] = new JDHardcodedFieldMap ("", true, false); // types catalog //@G4A - maps[6] = new JDHardcodedFieldMap ("", true, false); // types schema //@G4A - maps[7] = new JDHardcodedFieldMap ("", true, false); // type name //@G4A - maps[8] = new JDHardcodedFieldMap ("", true, false); // self referencing col name //@G4A - maps[9] = new JDHardcodedFieldMap ("", true, false); // ref generation //@G4A - } - } - - else - { // Get file text instead of remarks - maps[0] = new JDHardcodedFieldMap (connection_.getCatalog()); - maps[1] = new JDSimpleFieldMap (1); // schema // @A3C @E4C - maps[2] = new JDSimpleFieldMap (2); // table - maps[3] = new JDTableTypeFieldMap (3); // table type - maps[4] = new JDSimpleFieldMap (4); // File text - //@G4A The below fields will all return null. We have distinct types - //@G4A instead of abstract types here, so a request returns no - //@G4A type information. - if (isJDBC3) - { - maps[5] = new JDHardcodedFieldMap ("", true, false); // types catalog //@G4A - maps[6] = new JDHardcodedFieldMap ("", true, false); // types schema //@G4A - maps[7] = new JDHardcodedFieldMap ("", true, false); // type name //@G4A - maps[8] = new JDHardcodedFieldMap ("", true, false); // self referencing col name //@G4A - maps[9] = new JDHardcodedFieldMap ("", true, false); // ref generation //@G4A - } - } - - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - - } - else - rowCache = new JDSimpleRowCache(formatRow); - - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } // End of if file attribute != -1 - else - { // result set should be empty. - rowCache = new JDSimpleRowCache(formatRow); - } - - } // End of else to create and send request - - } // End of try block - - catch (DBDataStreamException e) - { - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "Tables", connection_, reply); //@in2 - } - -//@K3A -// Parses the result data from the system to determine if any aliases were returned. - void parseResultData(DBData resultData, DBDataFormat dataFormat) { - try{ - byte[] rawBytes = resultData.getRawBytes(); - int rowCount = resultData.getRowCount(); - int columnOffset = dataFormat.getFieldLength(0); // schema - columnOffset += dataFormat.getFieldLength(1); // table - int tableTypeLength = dataFormat.getFieldLength(2); // table type - SQLChar tableType = new SQLChar(tableTypeLength, settings_); // create an sql char ojbect to get the table type - int aliasCount = 0; - ConvTable ccsidConverter = connection_.getConverter(dataFormat.getFieldCCSID(2)); - for(int i=0; i= JDUtilities.vrm530))) //@5WXVJX - typeSamples.addElement(new SQLCharForBitData(32765, settings_)); // @M0A - typeSamples.addElement(new SQLDate(settings_, -1)); // @D0C @550C - typeSamples.addElement(new SQLDecimal(31, 31, settings_, connection_.getVRM(), connection_.getProperties())); // @M0C - typeSamples.addElement(new SQLDouble(settings_)); // @D0C - typeSamples.addElement(new SQLFloat(settings_)); // @D0C - typeSamples.addElement(new SQLGraphic(16382, settings_, -1)); //@cca1 - typeSamples.addElement(new SQLInteger(vrm)); //@trunc3 // @D0C - typeSamples.addElement(new SQLNumeric(31, 31, settings_, connection_.getVRM(), connection_.getProperties())); // @M0C - typeSamples.addElement(new SQLReal(settings_)); // @D0C - typeSamples.addElement(new SQLSmallint(vrm)); //@trunc3 // @D0C - typeSamples.addElement(new SQLTime(settings_, -1)); // @D0C @550C - typeSamples.addElement(new SQLTimestamp(settings_)); // @D0C - //typeSamples.addElement(new SQLLongVarchar(32739, settings_)); //Change to report LONG VARCHAR as VARCHAR to be consistent with other clients. - typeSamples.addElement(new SQLLongVargraphic(16369, settings_)); - typeSamples.addElement(new SQLLongVarcharForBitData(32739, settings_)); - typeSamples.addElement(new SQLVarchar(32739, settings_)); // @D0C - if((connection_.getVRM() < JDUtilities.vrm530) || (translateHexAsChar && (connection_.getVRM() >= JDUtilities.vrm530))) //@5WXVJX - typeSamples.addElement(new SQLVarcharForBitData(32739, settings_)); // @M0A - typeSamples.addElement(new SQLVargraphic(16369, settings_, -1)); //@cca1 - - if (connection_.getVRM() >= JDUtilities.vrm440) - { // @B4D B5A @D0C - typeSamples.addElement(new SQLDatalink(32717, settings_)); - typeSamples.addElement(new SQLBlob(MAX_LOB_LENGTH, settings_)); // @B4D B5A @D0C //@xml3 - typeSamples.addElement(new SQLClob(MAX_LOB_LENGTH, settings_)); // @B4D B5A @D0C @E1C //@xml3 - typeSamples.addElement(new SQLDBClob(1073741822, settings_)); - } // @B4D B5A - - if (connection_.getVRM() >= JDUtilities.vrm450) // @D0A - typeSamples.addElement(new SQLBigint(vrm)); //@trunc3 // @D0A - - // @M0A - added support for binary, varbinary, and rowid data types - if(connection_.getVRM() >= JDUtilities.vrm520) - { - typeSamples.addElement(new SQLRowID(settings_)); - } - - if(connection_.getVRM() >= JDUtilities.vrm530) - { - if(!translateHexAsChar) //@5WXVJX - { - typeSamples.addElement(new SQLBinary(32765, settings_)); - typeSamples.addElement(new SQLVarbinary(32739, settings_)); - } - } - if(connection_.getVRM() >= JDUtilities.vrm610) //@dfa - { //@dfa - //note that on hostserver both 16 and 34 are one type (stored proc returns one type) - typeSamples.addElement(new SQLDecFloat34( settings_, connection_.getVRM(), connection_.getProperties())); //@dfa - } //@dfa - // @M0A - end new support - - int numberOfTypes = typeSamples.size(); // @D0C - int numberOfFields = sqlData.length; - Object[][] data = new Object[numberOfTypes][]; - boolean[][] nulls = new boolean[numberOfTypes][]; - boolean[][] dataMappingErrors = new boolean[numberOfTypes][]; - for (int i = 0; i < numberOfTypes; ++i) - { - data[i] = new Object[numberOfFields]; - nulls[i] = new boolean[numberOfFields]; - dataMappingErrors[i] = new boolean[numberOfFields]; - - SQLData typeSample = (SQLData) typeSamples.elementAt(i); // @D0C - data[i][0] = typeSample.getTypeName (); // @D0C - data[i][1] = new Short ((short) typeSample.getType ()); // @D0C - data[i][2] = new Integer (typeSample.getMaximumPrecision()); // @D0C - - String literalPrefix = typeSample.getLiteralPrefix (); // @D0C - if (literalPrefix == null) - { - data[i][3] = ""; - nulls[i][3] = true; - } - else - data[i][3] = literalPrefix; - - String literalSuffix = typeSample.getLiteralSuffix (); // @D0C - if (literalSuffix == null) - { - data[i][4] = ""; - nulls[i][4] = true; - } - else - data[i][4] = literalSuffix; - - String createParameters = typeSample.getCreateParameters (); // @D0C - if (createParameters == null) - { - data[i][5] = ""; - nulls[i][5] = true; - } - else - data[i][5] = createParameters; - - data[i][6] = new Short ((short) typeNullable); - data[i][7] = new Boolean (typeSample.isText ()); // @D0C - data[i][8] = new Short ((short) typeSearchable); - data[i][9] = new Boolean (! typeSample.isSigned ()); // @D0C - data[i][10] = new Boolean (false); - data[i][11] = new Boolean (false); - - String localName = typeSample.getLocalName (); // @D0C - if (localName == null) - { - data[i][12] = ""; - nulls[i][12] = true; - } - else - data[i][12] = localName; - - data[i][13] = new Short ((short) typeSample.getMinimumScale ()); // @D0C - data[i][14] = new Short ((short) typeSample.getMaximumScale ()); // @D0C - data[i][15] = new Integer (0); - data[i][16] = new Integer (0); - data[i][17] = new Integer (typeSample.getRadix ()); // @D0C - } - - JDSimpleRowCache rowCache = new JDSimpleRowCache(formatRow, data, nulls, dataMappingErrors); - - return new AS400JDBCResultSet (rowCache, - connection_.getCatalog(), "Type Info", connection_, null); //@in2 - - - - - } - - - - // JDBC 2.0 - /** - Returns the description of the user-defined types - available in a catalog. - - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schemaPattern The schema name pattern. - If the "metadata source" connection property is set to 0 - and null is specified, no value is sent to the system and - the default of *USRLIBL is used. - If the "metadata source" connection property is set to 1 - and null is specified, then information from all schemas - will be returned. - If an empty string - is specified, an empty result set is returned. - @param typeNamePattern The type name pattern. If null is specified, - no value is sent to the system and the system - default of *ALL is used. If empty string - is specified, an empty result set is returned. - @param types The list of user-defined types to include, or null to - include all user-defined types. Valid types are: - JAVA_OBJECT, STRUCT, and DISTINCT. - @return The ResultSet containing the description of the - user-defined available in the catalog. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - // - // Implementation note: - // - // 1. I was worried about cases where one distinct type is created - // based on another distinct type. This would cause problems - // because the source type would no longer identify a system - // predefined type and we would have to follow the chain until - // we found a system predefined type. - // - // It turns out that this is not an issue. In the "JDBC Tutorial and - // Reference", section 3.5.5 "Creating a DISTINCT type", it says: - // "A DISTINCT type is always based on another data type, which must - // be a predefined type. ... a DISTINCT type cannot be based - // on a UDT." ("UDT" means user-defined type.) - // So we can make the assumption that the source type - // always identifies a system predefined type. - // - public ResultSet getUDTs (String catalog, - String schemaPattern, - String typeNamePattern, - int[] types) - throws SQLException - { - connection_.checkOpen (); - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - - - - CallableStatement cs = connection_.prepareCall("CALL SYSIBM" + getCatalogSeparator()+ "SQLUDTS(?,?,?,?,?)"); - - cs.setString(1, normalize(catalog)); - cs.setString(2, normalize(schemaPattern)); - cs.setString(3, normalize(typeNamePattern)); - StringBuffer typesStringBuffer = new StringBuffer(); - int stringsInList = 0; - - if (types != null) { - for (int i = 0; i < types.length; i++) { - if (stringsInList > 0) { - typesStringBuffer.append(","); - } - typesStringBuffer.append(types[i]); - stringsInList++; - } - } - - cs.setString(4, typesStringBuffer.toString()); -/* ifdef JDBC40 - cs.setString(5, "DATATYPE='JDBC';JDBCVER='4.0';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); //@ver4 -endif */ -/* ifndef JDBC40 */ - cs.setString(5, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); -/* endif */ - cs.execute(); - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - int vrm = connection_.getVRM(); //@trunc3 - boolean isJDBC3 = JDUtilities.JDBCLevel_ >= 30; //@F2A @j4a - - String[] fieldNames = null; //@F2C - SQLData[] sqlData = null; //@F2C - int[] fieldNullables = null; //@F2C - if (!isJDBC3) //@F2A - { - // Set up the result set in the format required by JDBC - fieldNames = new String[] { "TYPE_CAT", - "TYPE_SCHEM", - "TYPE_NAME", - "CLASS_NAME", - "DATA_TYPE", - "REMARKS", - }; - - sqlData = new SQLData[] { new SQLVarchar (128, settings_), // type catalog - new SQLVarchar (128, settings_), // type schema - new SQLVarchar (128, settings_), // type name - new SQLVarchar (128, settings_), // class name - new SQLSmallint (vrm), // data type //@trunc3 - new SQLVarchar (2000, settings_), // remarks - }; - - fieldNullables = new int[] { columnNullable, // type catalog - columnNullable, // type schema - columnNoNulls, // type name - columnNoNulls, // class name - columnNoNulls, // data type - columnNoNulls, // remarks - }; - } - else - { - // Set up the result set in the format required by JDBC 3.0 - fieldNames = new String[] { "TYPE_CAT", - "TYPE_SCHEM", - "TYPE_NAME", - "CLASS_NAME", - "DATA_TYPE", - "REMARKS", - "BASE_TYPE" //@G4A - }; - - sqlData = new SQLData[] { new SQLVarchar (128, settings_), // type catalog - new SQLVarchar (128, settings_), // type schema - new SQLVarchar (128, settings_), // type name - new SQLVarchar (128, settings_), // class name - new SQLSmallint (vrm), // data type //@trunc3 - new SQLVarchar (2000, settings_), // remarks - new SQLSmallint (vrm), // base type //@G4A //@trunc3 - }; - - fieldNullables = new int[] { columnNullable, // type catalog - columnNullable, // type schema - columnNoNulls, // type name - columnNoNulls, // class name - columnNoNulls, // data type - columnNoNulls, // remarks - columnNullable, // base type //@G4A - }; - - } - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - JDRowCache rowCache = null; - - // We only support DISTINCT in the types array. Determine - // if this was passed as one of the elements. If null is - // passed, that is like looking for everything, so make that - // work like DISTINCT was passed. - boolean distinctPassed = false; - if (types == null) - distinctPassed = true; - else - { - for (int i = 0; i < types.length; ++i) - if (types[i] == Types.DISTINCT) - { - distinctPassed = true; - break; - } - } - - // Check for conditions that would result in an empty - // result set. - if ((! isCatalogValid (catalog)) - || ((schemaPattern != null) && (schemaPattern.length () == 0)) - || ((typeNamePattern != null) && (typeNamePattern.length () == 0)) - || (distinctPassed == false)) - rowCache = new JDSimpleRowCache (formatRow); - - // Otherwise, build a request and send. There is - // no builtin request for UDTs in the ROI server, - // so we implement this using a query on a catalog. - else - { - - // Build up the query, - StringBuffer select = new StringBuffer (); - select.append ("SELECT USER_DEFINED_TYPE_SCHEMA, " // @B2C - + "USER_DEFINED_TYPE_NAME, " // @B2C - + "SOURCE_TYPE, REMARKS"); - if (isJDBC3) //@F2A - { - select.append (", SMALLINT (CASE SOURCE_TYPE " // @G4A - + "WHEN 'BIGINT' THEN -5 WHEN 'CHAR' THEN 1 " // @G4A - + "WHEN 'CHARACTER' THEN 1 WHEN 'GRAPHIC' THEN 1 " // @G4A - + "WHEN 'NUMERIC' THEN 2 WHEN 'DECIMAL' THEN 3 " // @G4A - + "WHEN 'INTEGER' THEN 4 WHEN 'SMALLINT' THEN 5 " // @G4A - + "WHEN 'REAL' THEN 6 WHEN 'FLOAT' THEN 8 " // @G4A - + "WHEN 'DOUBLE' THEN 8 WHEN 'DOUBLE PRECISION' THEN 8 " // @G4A - + "WHEN 'VARCHAR' THEN 12 WHEN 'VARGRAPHIC' THEN 12 " // @G4A - + "WHEN 'DATALINK' THEN 70 WHEN 'DATE' THEN 91 " // @G4A - + "WHEN 'TIME' THEN 92 WHEN 'TIMESTMP' THEN 93 " // @G4A - + "WHEN 'TIMESTAMP' THEN 93 WHEN 'BLOB' THEN 2004 " // @G4A - + "WHEN 'CLOB' THEN 2005 WHEN 'DBCLOB' THEN 2005 " // @G4A - + "ELSE NULL END)"); - } - - select.append (" FROM QSYS2"); //@B2C @F2M - select.append (getCatalogSeparator ()); - select.append ("SYSTYPES " ); - - StringBuffer where = new StringBuffer (); - if (schemaPattern != null) - { - JDSearchPattern searchPattern = new JDSearchPattern (schemaPattern); - where.append (searchPattern.getSQLWhereClause ("USER_DEFINED_TYPE_SCHEMA")); // @B2C - } - if (typeNamePattern != null) - { - JDSearchPattern searchPattern = new JDSearchPattern (typeNamePattern); - if (where.length () > 0) - where.append (" AND "); - where.append (searchPattern.getSQLWhereClause ("USER_DEFINED_TYPE_NAME")); // @B2C - } - - if (where.length () > 0) - { - select.append (" WHERE "); - //@J4c JDK 1.4 added a StringBuffer.append(StringBuffer) method. Do a toString() - // here just in case we compile against 1.4 but run against 1.3. In that - // case we would get 'method not found' - select.append (where.toString()); - } - - select.append (" ORDER BY USER_DEFINED_TYPE_SCHEMA, USER_DEFINED_TYPE_NAME"); // @B2C - - // Run the query. - try - { - Statement statement = connection_.createStatement(); - ResultSet serverResultSet = statement.executeQuery (select.toString()); - JDRowCache serverRowCache = new JDSimpleRowCache (((AS400JDBCResultSet) serverResultSet).getRowCache ()); - statement.close (); - - // Set up the maps. - JDFieldMap[] maps = null; //@F2C - if (!isJDBC3) //@F2A - { - maps = new JDFieldMap[] { - new JDHardcodedFieldMap (connection_.getCatalog ()), // type catalog - new JDSimpleFieldMap (1), // type schema - new JDSimpleFieldMap (2), // type name - new JDClassNameFieldMap (3, settings_, connection_.getVRM(), connection_.getProperties()), // class name // @B3C // @M0C - new JDHardcodedFieldMap (new Integer (Types.DISTINCT)), // data type - new JDHandleNullFieldMap (4, ""), // remarks // @B3C - }; - } - else - { - maps = new JDFieldMap[] { - new JDHardcodedFieldMap (connection_.getCatalog ()), // type catalog - new JDSimpleFieldMap (1), // type schema - new JDSimpleFieldMap (2), // type name - new JDClassNameFieldMap (3, settings_, connection_.getVRM(), connection_.getProperties()), // class name // @B3C // @M0C - new JDHardcodedFieldMap (new Integer (Types.DISTINCT)), // data type - new JDHandleNullFieldMap (4, ""), // remarks // @B3C - new JDSimpleFieldMap (5) // base type // @G4A - }; - - } - - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - catch (SQLException e) - { - - // If the system does not have this table, then - // force an empty result set. This just means - // that UDTs are not supported (which is true - // for pre-V4R4 systems). - if (e.getErrorCode () == -204) - rowCache = new JDSimpleRowCache (formatRow); - else - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - } - - // Return the result set. - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), "UDTs", connection_, null); //@in2 - } - - - - /** - Returns the URL for this database. - - @return The URL for this database. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public String getURL () - throws SQLException - { - connection_.checkOpen (); - return connection_.getURL(); - } - - - - /** - Returns the current user name as known to the database. - - @return The current user name as known to the database. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public String getUserName () - throws SQLException - { - connection_.checkOpen (); - return connection_.getUserName(); - } - - - - /** - Returns a description of a table's columns that are automatically - updated when any value in a row is updated. - @param catalog The catalog name. If null is specified, this parameter - is ignored. If empty string is specified, - an empty result set is returned. - @param schema The schema name. If null is specified, the - default SQL schema specified in the URL is used. - If null is specified and a default SQL schema was not - specified in the URL, the first library specified - in the libraries properties file is used. - If null is specified, a default SQL schema was - not specified in the URL, and a library was not - specified in the libraries properties file, - QGPL is used. - If empty string is specified, an empty result set will - be returned. - @param table The table name. If null or empty string is specified, - an empty result set is returned. - - @return The ResultSet containing the description of the - table's columns that are automatically updated - when any value in a row is updated. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public ResultSet getVersionColumns (String catalog, - String schema, - String table) - throws SQLException - { - DBReplyRequestedDS reply = null; - - connection_.checkOpen (); - int vrm = connection_.getVRM(); //@trunc3 - - - //@mdsp SYSIBM SP Call - if (connection_.getProperties().getString(JDProperties.METADATA_SOURCE).equals( JDProperties.METADATA_SOURCE_STORED_PROCEDURE)) - { - - CallableStatement cs = connection_.prepareCall("CALL SYSIBM" + getCatalogSeparator() + "SQLSPECIALCOLUMNS(?,?,?,?, ?,?,?)"); - - cs.setShort(1, (short) SQL_ROWVER); - cs.setString(2, normalize(catalog)); - cs.setString(3, normalize(schema)); - cs.setString(4, normalize(table)); - cs.setShort(5, (short) 0); - cs.setShort(6, (short) 1); - cs.setString(7, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); - cs.execute(); - - ResultSet rs = cs.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cs.close(); //@mdrs2 - - return rs; //@mdrs - } - - //-------------------------------------------------------- - // Set up the result set in the format required by JDBC - //-------------------------------------------------------- - - String[] fieldNames = {"SCOPE", - "COLUMN_NAME", - "DATA_TYPE", - "TYPE_NAME", - "COLUMN_SIZE", - "BUFFER_LENGTH", - "DECIMAL_DIGITS", - "PSEUDO_COLUMN", - }; - - SQLData[] sqlData = { new SQLSmallint (vrm), // scope //@trunc3 - new SQLVarchar (128, settings_), // column name - new SQLSmallint (vrm), // data type //@trunc3 - new SQLVarchar (128, settings_), // type name - new SQLInteger (vrm), // column size //@trunc3 - new SQLInteger (vrm), // buffer length //@trunc3 - new SQLSmallint (vrm), // decimal digits //@trunc3 - new SQLSmallint (vrm), // pseudo column //@trunc3 - }; - - int[] fieldNullables = {columnNoNulls, // scope - columnNoNulls, // column name - columnNoNulls, // data type - columnNoNulls, // type name - columnNoNulls, // column size - columnNoNulls, // buffer length - columnNoNulls, // decimal digits - columnNoNulls, // pseudo column - }; - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, - sqlData, fieldNullables); - - JDRowCache rowCache = null; // Creates a set of rows - // that are readable one at a time. - - - try - { - // Check for conditions that would result in an empty result set - // Must check for null first to avoid NullPointerException - - if (!isCatalogValid(catalog) || // catalog is empty string - - // schema is not null and is empty string - ((schema != null) && (schema.length()==0)) || - - // Table is null - (table==null) || - - // Table is empty string - (table.length()==0 )) - { // Return empty result set - rowCache = new JDSimpleRowCache (formatRow); - } - - else - { // parameter values are valid, build request & send - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_SPECIAL_COLUMN_INFO , - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - - - // Set the library name - if (schema == null) - { // use default SQL schema or qgpl - request.setLibraryName(normalize(connection_.getDefaultSchema()), connection_.converter_); // @E4C - } - else request.setLibraryName(normalize(schema), connection_.converter_); // @E4C - - // Set the table name - request.setFileName(normalize(table), connection_.converter_); // @E4C - - - // Set the Field Information to Return Bitmap - // Return library, table, and column - request.setSpecialColumnsReturnInfoBitmap(0x1F800000); //@rchg set 8th bit for row change timestamp column information - - - // Set the short / long file and field name indicator - request.setFileShortOrLongNameIndicator(0xF0); // Long - - // Set columns nullable indicator to allows nullable columns - request.setSpecialColumnsNullableIndicator(0xF1); - - - //-------------------------------------------------------- - // Send the request and cache all results from the system - //-------------------------------------------------------- - - reply = connection_.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = reply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = reply.getReturnCode(); - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, connection_, id_, - errorClass, returnCode); - } - - // Get the data format and result data - DBDataFormat dataFormat = reply.getDataFormat(); - DBData resultData = reply.getResultData(); - if (resultData != null) - { - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, settings_); - JDRowCache serverRowCache = new JDSimpleRowCache (new JDServerRowCache (row, connection_, id_, - 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - - // Create the mapped row format that is returned in the - // result set. - // This does not actual move the data, it just sets up - // the mapping. - JDFieldMap[] maps = new JDFieldMap[8]; - maps[0] = new JDHardcodedFieldMap (new Short ((short) 0)); // scope - maps[1] = new JDSimpleFieldMap (1); // column name - maps[2] = new JDDataTypeFieldMap (2, 3, 3, 5, 0, connection_.getVRM(), connection_.getProperties()); // @M0C // data type - converted to short //@KKB added 0 for ccsid since not given to us by host server - maps[3] = new JDSimpleFieldMap (2); // type name - maps[4] = new JDSimpleFieldMap (3); // column size (precision) - maps[5] = new JDSimpleFieldMap(4); // buffer length - maps[6] = new JDSimpleFieldMap (5); // decimal digits (scale) - maps[7] = new JDHardcodedFieldMap (new Short ((short) versionColumnNotPseudo)); - - // Create the mapped row cache that is returned in the - // result set - JDMappedRow mappedRow = new JDMappedRow (formatRow, maps); - rowCache = new JDMappedRowCache (mappedRow, serverRowCache); - } - else - rowCache = new JDSimpleRowCache (formatRow); - - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // if (reply != null) { reply.returnToPool(); reply = null; } - } - } // End of else to build and send request - } // End of try block - - catch (DBDataStreamException e) - { - if (reply != null) { reply.returnToPool(); reply = null; } - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - - // Return the results - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "VersionColumns", connection_, reply); //@in2 - } - - - - // JDBC 2.0 - /** - Indicates if visible inserts to a result set of the specified type - can be detected by calling ResultSet.rowInserted(). - - @param resultSetType The result set type. Value values are: -
          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @return Always false. Inserts can not be detected - by calling ResultSet.rowInserted(). - - @exception SQLException If the result set type is not valid. - **/ - public boolean insertsAreDetected (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return false; - } - - - - /** - Indicates if a catalog appears at the start or the end of - a qualified name. - - @return Always true. A catalog appears at the start of a - qualified name. - - @exception SQLException This exception is never thrown. - **/ - public boolean isCatalogAtStart () - throws SQLException - { - return true; - } - - - - /** - Indicates if the specified catalog is valid for a query. - If false is returned, any query using that catalog will - be empty since the catalog does not refer to the current - connection's catalog. - - @param catalog The catalog name. "" for no catalog - or null to drop catalog from the - selection criteria. - @return true if catalog name is valid; false otherwise - - @exception SQLException This exception is never thrown. - **/ - private boolean isCatalogValid (String catalog) - throws SQLException - { - if (catalog == null) - return true; - - return(catalog.equalsIgnoreCase (connection_.getCatalog()) - || (catalog.equalsIgnoreCase ("localhost"))); - } - - - - /** - Indicates if the database is in read-only mode. - - @return true if in read-only mode; false otherwise. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - public boolean isReadOnly () - throws SQLException - { - connection_.checkOpen (); - return connection_.isReadOnly (); - } - - - //@F3A - /** - Indicates if updateable LOB methods update a copy of the LOB or if updates - are made directly to the LOB. True is returned if updateable lob methods - update a copy of the LOB, false is returned if updates are made directly - to the LOB. - - @return Always true. Updateable lob methods update a copy of the LOB. - ResultSet.updateRow() must be called to update the LOB in the DB2 for IBM i database. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public boolean locatorsUpdateCopy () - throws SQLException - { - return true; - } - - - - // @E4A - // The database is not case-sensitive except when names are quoted with double - // quotes. The host server flows are case-sensitive, so I will uppercase - // everything to save the caller from having to do so. - private String normalize(String mixedCaseName) - { - if(mixedCaseName == null) //@mdsp - return null; //@mdsp - - if (mixedCaseName.length() > 2) - { - if (mixedCaseName.charAt(0) == '"') - return JDUtilities.stripOutDoubleEmbededQuotes(mixedCaseName); //@PDC mixedCaseName.substring(1, mixedCaseName.length() - 1); - } - return mixedCaseName.toUpperCase(); - } - - - - /** - Indicates if concatenations between null and non-null values - are null. - - - @return Always true. Concatenations between null and non-null - values are null. - - @exception SQLException This exception is never thrown. - **/ - public boolean nullPlusNonNullIsNull () - throws SQLException - { - return true; - } - - - - /** - Indicates if null values are sorted at the end regardless of sort - order. - - @return Always false. Null values are not sorted at the end - regardless of sort order. - - @exception SQLException This exception is never thrown. - **/ - public boolean nullsAreSortedAtEnd () - throws SQLException - { - return false; - } - - - - /** - Indicates if null values are sorted at the start regardless of sort - order. - - @return Always false. Null values are not sorted at the start - regardless of sort order. - - @exception SQLException This exception is never thrown. - **/ - public boolean nullsAreSortedAtStart () - throws SQLException - { - return false; - } - - - - /** - Indicates if null values are sorted high. - - @return Always true. Null values are sorted high. - - @exception SQLException This exception is never thrown. - **/ - public boolean nullsAreSortedHigh () - throws SQLException - { - return true; - } - - - - /** - Indicates if null values are sorted low. - - @return Always false. Null values are not sorted low. - - @exception SQLException This exception is never thrown. - **/ - public boolean nullsAreSortedLow () - throws SQLException - { - return false; - } - - - - // JDBC 2.0 - /** - Indicates if deletes made by others are visible. - - @param resultSetType The result set type. Value values are: -
          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @return true if deletes made by others - are visible; false otherwise. - - @exception SQLException If the result set type is not valid. - **/ - public boolean othersDeletesAreVisible (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return(resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE); - } - - - - // JDBC 2.0 - /** - Indicates if inserts made by others are visible. - - @param resultSetType The result set type. Value values are: -
          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @return true if inserts made by others - are visible; false otherwise. - - @exception SQLException If the result set type is not valid. - **/ - public boolean othersInsertsAreVisible (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return(resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE); - } - - - - // JDBC 2.0 - /** - Indicates if updates made by others are visible. - - @param resultSetType The result set type. Value values are: -
          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @return true if updates made by others - are visible; false otherwise. - - @exception SQLException If the result set type is not valid. - **/ - public boolean othersUpdatesAreVisible (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return(resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE); - } - - - - // JDBC 2.0 - /** - Indicates if a result set's own deletes are visible. - - @param resultSetType The result set type. Value values are: -
          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @return true if the result set's own deletes - are visible; false otherwise. - - @exception SQLException If the result set type is not valid. - **/ - public boolean ownDeletesAreVisible (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return(resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE); - } - - - - // JDBC 2.0 - /** - Indicates if a result set's own inserts are visible. - - @param resultSetType The result set type. Value values are: -
          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @return true if the result set's own inserts - are visible; false otherwise. - - @exception SQLException If the result set type is not valid. - **/ - public boolean ownInsertsAreVisible (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return(resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE); - } - - - - // JDBC 2.0 - /** - Indicates if a result set's own updates are visible. - - @param resultSetType The result set type. Value values are: -
          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @return true if the result set's own updates - are visible; false otherwise. - - @exception SQLException If the result set type is not valid. - **/ - public boolean ownUpdatesAreVisible (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return(resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE); - } - - - - /** - Indicates if the database treats mixed case, unquoted SQL identifiers - as case insensitive and stores them in lowercase. - - @return Always false. The database does not treat mixed case, - unquoted SQL identifiers as case insensitive and store - them in lowercase. - - @exception SQLException This exception is never thrown. - **/ - public boolean storesLowerCaseIdentifiers () - throws SQLException - { - return false; - } - - - - /** - Indicates if the database treats mixed case, quoted SQL identifiers - as case insensitive and stores them in lowercase. - - @return Always false. The database does not treat mixed case, quoted - SQL identifiers as case insensitive and store them in - lowercase. - - @exception SQLException This exception is never thrown. - */ - public boolean storesLowerCaseQuotedIdentifiers () - throws SQLException - { - return false; - } - - - - /** - Indicates if the database treats mixed case, unquoted SQL identifiers - as case insensitive and stores them in mixed case. - - @return Always false. The database does not treat mixed case, unquoted - SQL identifiers as case insensitive and store them in - mixed case. - - @exception SQLException This exception is never thrown. - **/ - public boolean storesMixedCaseIdentifiers () - throws SQLException - { - return false; - } - - - - /** - Indicates if the database treats mixed case, quoted SQL identifiers - as case insensitive and stores them in mixed case. - - @return Always false. The database does not treat mixed case, quoted - SQL identifiers as case insensitive and store them in - mixed case. - - @exception SQLException This exception is never thrown. - **/ - public boolean storesMixedCaseQuotedIdentifiers () - throws SQLException - { - // @A2C changed from false to true - return false; //@pdc match other drivers - } - - - - /** - Indicates if the database treats mixed case, unquoted SQL identifiers - as case insensitive and stores them in uppercase. - - @return Always true. The database does treat mixed case, unquoted - SQL identifiers as case insensitive and store them - in uppercase. - - @exception SQLException This exception is never thrown. - **/ - public boolean storesUpperCaseIdentifiers () - throws SQLException - { - return true; - } - - - - /** - Indicates if the database treats mixed case, quoted SQL identifiers - as case insensitive and stores them in uppercase. - - @return Always false. The database does not treat mixed case, quoted - SQL identifiers as case insensitive and store them - in uppercase. - - @exception SQLException This exception is never thrown. - **/ - public boolean storesUpperCaseQuotedIdentifiers () - throws SQLException - { - return false; - } - - - - /** - Indicates if ALTER TABLE with ADD COLUMN is supported. - - @return Always true. ALTER TABLE with ADD COLUMN is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsAlterTableWithAddColumn () - throws SQLException - { - // @A2C Changed from false to true - return true; - } - - - - /** - Indicates if ALTER TABLE with DROP COLUMN is supported. - - @return Always true. ALTER TABLE with DROP COLUMN is not supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsAlterTableWithDropColumn () - throws SQLException - { - // @A2C Changed from false to true - return true; - } - - - - /** - Indicates if the ANSI92 entry-level SQL grammar is supported. - - @return Always true. The ANSI92 entry-level SQL grammar is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsANSI92EntryLevelSQL () - throws SQLException - { - // ANSI92EntryLevelSQL is supported for V4R2 and beyond - // true is always returned since it is checked for compliance. - return true; - - } - - - - /** - Indicates if the ANSI92, full SQL grammar is supported. - - @return Always false. ANSI92, full SQL grammar is not supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsANSI92FullSQL () - throws SQLException - { - return false; - } - - - - /** - Indicates if the ANSI92 intermediate-level SQL grammar is supported. - - @return Always false. ANSI92 intermediate-level SQL grammar is not supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsANSI92IntermediateSQL () - throws SQLException - { - return false; - } - - - - // JDBC 2.0 - /** - Indicates if the batch updates are supported. - - @return Always true. Batch updates are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsBatchUpdates () - throws SQLException - { - return true; - } - - - - /** - Indicates if a catalog name can be used in a data manipulation - statement. - - @return Always false. A catalog name can not be used in a data manipulation - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsCatalogsInDataManipulation () - throws SQLException - { - // @A2 Changed from true to false. - return false; - } - - - - /** - Indicates if a catalog name can be used in an index definition - statement. - - @return Always false. A catalog name can not be used in an index definition - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsCatalogsInIndexDefinitions () - throws SQLException - { - // @A2C Changed from true to false - return false; - } - - - - /** - Indicates if a catalog name can be used in a privilege definition - statement. - - @return Always false. A catalog name can not be used in a privilege definition - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsCatalogsInPrivilegeDefinitions () - throws SQLException - { - // @A2C Changed from true to false - return false; - } - - - - /** - Indicates if a catalog name can be used in a procedure call - statement. - - @return Always false. A catalog name can not be used in a procedure call - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsCatalogsInProcedureCalls () - throws SQLException - { - // @A2C Changed from true to false - return false; - } - - - - /** - Indicates if a catalog name can be used in a table definition - statement. - - @return Always false. A catalog name can not be used in a table definition - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsCatalogsInTableDefinitions () - throws SQLException - { - // @A2C Changed from true to false - return false; - } - - - - /** - Indicates if column aliasing is supported. Column aliasing means - that the SQL AS clause can be used to provide names for - computed columns or to provide alias names for column - as required. - - @return Always true. Column aliasing is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsColumnAliasing () - throws SQLException - { - return true; - } - - - - /** - Indicates if the CONVERT function between SQL types is supported. - - @return true if the CONVERT function between SQL types is supported; - false otherwise. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsConvert () - throws SQLException - { - return JDEscapeClause.supportsConvert (); - } - - - - /** - Indicates if CONVERT between the given SQL types is supported. - - @param fromType The SQL type code defined in java.sql.Types. - @param toType The SQL type code defined in java.sql.Types. - @return true if CONVERT between the given SQL types is supported; - false otherwise. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsConvert (int fromType, int toType) - throws SQLException - { - return JDEscapeClause.supportsConvert (fromType, toType); - } - - - - /** - Indicates if the ODBC Core SQL grammar is supported. - - @return Always true. The ODBC Core SQL grammar is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsCoreSQLGrammar () - throws SQLException - { - return true; - } - - - - /** - Indicates if the correlated subqueries are supported. - - @return Always true. Correlated subqueries are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsCorrelatedSubqueries () - throws SQLException - { - return true; - } - - - - /** - Indicates if both data definition and data manipulation statements - are supported within a transaction. - - @return Always true. Data definition and data manipulation statements - are both supported within a transaction. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsDataDefinitionAndDataManipulationTransactions () - throws SQLException - { - return true; - } - - - - /** - Indicates if data manipulation statements are supported within a transaction. - - @return Always false. Data manipulation statements are not supported within - a transaction. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsDataManipulationTransactionsOnly () - throws SQLException - { - // @A2C Changed from true to false - return false; - } - - - - /** - Indicates if table correlation names are supported, and if so, are they - restricted to be different from the names of the tables. - - @return Always false. Table correlation names are not restricted - to be different from the names of the tables. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsDifferentTableCorrelationNames () - throws SQLException - { - return false; - } - - - - /** - Indicates if expressions in ORDER BY lists are supported. - - @return Always false. Expression in ORDER BY lists are not supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsExpressionsInOrderBy () - throws SQLException - { - return false; - } - - - - /** - Indicates if the ODBC Extended SQL grammar is supported. - - @return Always false. The ODBC Extended SQL grammar is not supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsExtendedSQLGrammar () - throws SQLException - { - return false; - } - - - - /** - Indicates if full nested outer joins are supported. - - @return Always false. Full nested outer joins are not supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsFullOuterJoins () - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm610) //@550 - return true; //@550 - else //@550 - return false; - } - - - - //@G4A - /** - Indicates if, after a statement is executed, auto-generated keys can be retrieved - using the method Statement.getGeneratedKeys(). - - @return True if the user is connecting to a system running OS/400 V5R2 - or IBM i, otherwise false. Auto-generated keys are supported - only if connecting to a system running OS/400 V5R2 or IBM i. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public boolean supportsGetGeneratedKeys () - throws SQLException - { - if (connection_.getVRM() >= JDUtilities.vrm520) - return true; - else - return false; - } - - - - /** - Indicates if some form of the GROUP BY clause is supported. - - @return Always true. Some form of GROUP BY clause is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsGroupBy () - throws SQLException - { - return true; - } - - - - /** - Indicates if a GROUP BY clause can add columns not in the SELECT - provided it specifies all of the columns in the SELECT. - - @return Always true. A GROUP BY clause can add columns not in the SELECT - provided it specifies all of the columns in the SELECT. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsGroupByBeyondSelect () - throws SQLException - { - return true; - } - - - - /** - Indicates if a GROUP BY clause can use columns not in the SELECT. - - @return Always true. A GROUP BY clause can use columns not in the SELECT. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsGroupByUnrelated () - throws SQLException - { - return true; - } - - - - /** - Indicates if the SQL Integrity Enhancement Facility is supported. - - @return Always false. The SQL Integrity Enhancement Facility is not - supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsIntegrityEnhancementFacility () - throws SQLException - { - return false; - } - - - - /** - Indicates if the escape character in LIKE clauses is supported. - - @return Always true. The escape character in LIKE clauses is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsLikeEscapeClause () - throws SQLException - { - return true; - } - - - - /** - Indicates if there is limited support for outer joins. - - @return Always true. There is limited support for outer joins. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsLimitedOuterJoins () - throws SQLException - { - return true; - } - - - - /** - Indicates if the ODBC Minimum SQL grammar is supported. - - @return Always true. The ODBC Minimum SQL grammar is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsMinimumSQLGrammar () - throws SQLException - { - return true; - } - - - - /** - Indicates if the database treats mixed case, unquoted SQL - identifiers as case sensitive and stores - them in mixed case. - - @return Always false. The database does not treat mixed case, - unquoted SQL identifiers as case sensitive and as - a result store them in mixed case. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsMixedCaseIdentifiers () - throws SQLException - { - return false; - } - - - - /** - Indicates if the database treats mixed case, quoted SQL - identifiers as case sensitive and as a result stores - them in mixed case. - - @return Always true. The database does treat mixed case, quoted SQL - identifiers as case sensitive and stores - them in mixed case. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsMixedCaseQuotedIdentifiers () - throws SQLException - { - return true; - } - - - - //@G4A - /** - Indicates if multiple result sets can be returned from a - CallableStatement simultaneously. - - @return Always false. Multiple open result sets from a single execute - are not supported by the Toolbox driver. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public boolean supportsMultipleOpenResults () - throws SQLException - { - return false; - } - - - - /** - Indicates if multiple result sets from a single execute are - supported. - - @return Always true. Multiple result sets from a single execute - are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsMultipleResultSets () - throws SQLException - { - return true; - } - - - - /** - Indicates if multiple transactions can be open at once (on - different connections). - - @return Always true. Multiple transactions can be open at - once on different connections. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsMultipleTransactions () - throws SQLException - { - return true; - } - - - - //@G4A - /** - Indicates if using parameter names to specify parameters on - callable statements are supported. - - @return Always true. An application can use parameter names - to specify parameters on callable statements. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public boolean supportsNamedParameters () - throws SQLException - { - return true; - } - - - - /** - Indicates if columns can be defined as non-nullable. - - @return Always true. Columns can be defined as non-nullable. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsNonNullableColumns () - throws SQLException - { - return true; - } - - - - /** - Indicates if cursors can remain open across commits. - - @return Always true. Cursors can remain open across commits. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsOpenCursorsAcrossCommit () - throws SQLException - { - return true; - } - - - - /** - Indicates if cursors can remain open across rollback. - - @return Always true. Cursors can remain open across rollback. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsOpenCursorsAcrossRollback () - throws SQLException - { - return true; - } - - - - /** - Indicates if statements can remain open across commits. - - @return Always true. Statements can remain open across commits. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsOpenStatementsAcrossCommit () - throws SQLException - { - return true; - } - - - - /** - Indicates if statements can remain open across rollback. - - @return Always true. Statements can remain open across rollback. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsOpenStatementsAcrossRollback () - throws SQLException - { - return true; - } - - - - /** - Indicates if an ORDER BY clause can use columns not in the SELECT. - - @return Always false. ORDER BY cannot use columns not in the SELECT. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsOrderByUnrelated () - throws SQLException - { - return false; - } - - - - /** - Indicates if some form of outer join is supported. - - @return Always true. Some form of outer join is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsOuterJoins () - throws SQLException - { - return true; - } - - - - /** - Indicates if positioned DELETE is supported. - - @return Always true. Positioned DELETE is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsPositionedDelete () - throws SQLException - { - return true; - } - - - - /** - Indicates if positioned UPDATE is supported. - - @return Always true. Positioned UPDATE is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsPositionedUpdate () - throws SQLException - { - return true; - } - - - - // JDBC 2.0 // @C0C - /** - Indicates if the specified result set concurrency is supported - for the specified result set type. - -

        This chart describes the combinations of result set concurrency - and type that this driver supports: -

        - - - - - -

        CONCUR_READ_ONLYCONCUR_UPDATABLE
        TYPE_FORWARD_ONLYYesYes
        TYPE_SCROLL_INSENSITIVEYesNo
        TYPE_SCROLL_SENSITIVEYesYes
        -
        - - @param resultSetType The result set type. Valid values are: -

          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @param resultSetConcurrency The result set concurrency. Valid values are: -
          -
        • ResultSet.CONCUR_READ_ONLY -
        • ResultSet.CONCUR_UPDATABLE -
        - @return true if the specified result set - concurrency is supported for the specified - result set type; false otherwise. - - @exception SQLException If the result set type or result set - concurrency is not valid. - **/ - // - // Implementation note: - // - // The unsupported combinations are dictated by the DB2 - // cursor support. - // - public boolean supportsResultSetConcurrency (int resultSetType, int resultSetConcurrency) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - // Validate the result set concurrency. - if ((resultSetConcurrency != ResultSet.CONCUR_READ_ONLY) - && (resultSetConcurrency != ResultSet.CONCUR_UPDATABLE)) - JDError.throwSQLException (this, JDError.EXC_CONCURRENCY_INVALID); - - // Cases that we don't support. - //@K2D if (((resultSetConcurrency == ResultSet.CONCUR_READ_ONLY) - //@K2D && (resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE)) - //@K2D || ((resultSetConcurrency == ResultSet.CONCUR_UPDATABLE) - //@K2D && (resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE))) - if((resultSetConcurrency == ResultSet.CONCUR_UPDATABLE) //@K2A - && (resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE)) //@K2A - return false; - - // We support all other cases. - return true; - } - - - - //@G4A - /** - Indicates if a type of result set holdability is supported. The two - types are ResultSet.HOLD_CURSORS_OVER_COMMIT and ResultSet.CLOSE_CURSORS_AT_COMMIT. - - @return True if the user is connecting to a system running OS/400 - V5R2 or IBM i, otherwise false. Both types of result set - holidability are supported if connecting to OS/400 V5R2 or IBM i. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public boolean supportsResultSetHoldability (int resultSetHoldability) - throws SQLException - { - if (connection_.getVRM() >= JDUtilities.vrm520) - return true; - else - return false; - } - - - - //@G4A - /** - Indicates if savepoints are supported. - - @return True if the user is connecting to a system running - OS/400 V5R2 or IBM i, otherwise false. Savepoints are supported - only if connecting to OS/400 V5R2 or IBM i. - - @exception SQLException This exception is never thrown. - @since Modification 5 - **/ - public boolean supportsSavepoints () - throws SQLException - { - // Note we check only the system level. We don't need to - // check JDBC/JDK level because if running prior to JDBC 3.0 - // the app cannot call this method (it does not exist - // in the interface). - if (connection_.getVRM() >= JDUtilities.vrm520) - return true; - else - return false; - } - - - - // JDBC 2.0 - /** - Indicates if the specified result set type is supported. - - @param resultSetType The result set type. Valid values are: -
          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @return true for ResultSet.TYPE_FORWARD_ONLY - ResultSet.TYPE_SCROLL_SENSITIVE. and - ResultSet.TYPE_SCROLL_INSENSITIVE. - - @exception SQLException If the result set type is not valid. - **/ - public boolean supportsResultSetType (int resultSetType) - throws SQLException - { - switch(resultSetType) - { - case ResultSet.TYPE_FORWARD_ONLY: - case ResultSet.TYPE_SCROLL_SENSITIVE: - case ResultSet.TYPE_SCROLL_INSENSITIVE: - return true; - default: - JDError.throwSQLException (this, JDError.EXC_CONCURRENCY_INVALID); - return false; - } - } - - - - /** - Indicates if a schema name can be used in a data manipulation - statement. - - @return Always true. A schema name can be used in a data - manipulation statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSchemasInDataManipulation () - throws SQLException - { - return true; - } - - - - /** - Indicates if a schema name can be used in an index definition - statement. - - @return Always true. A schema name can be used in an index definition - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSchemasInIndexDefinitions () - throws SQLException - { - return true; - } - - - - /** - Indicates if a schema name be can used in a privilege definition - statement. - - @return Always true. A schema name can be used in a privilege definition - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSchemasInPrivilegeDefinitions () - throws SQLException - { - return true; - } - - - - /** - Indicates if a schema name be can used in a procedure call - statement. - - @return Always true. A schema name can be used in a procedure call - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSchemasInProcedureCalls () - throws SQLException - { - return true; - } - - - - /** - Indicates if a schema name can be used in a table definition - statement. - - @return Always true. A schema name can be used in a table definition - statement. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSchemasInTableDefinitions () - throws SQLException - { - return true; - } - - - - /** - Indicates if SELECT for UPDATE is supported. - - @return Always true. SELECT for UPDATE is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSelectForUpdate () - throws SQLException - { - return true; - } - - - - //@B0A - We don't support this directly. Use package caching instead. - /** - * Indicates if statement pooling is supported. - * @return Always false. Statement pooling is not supported at this time. - **/ - public boolean supportsStatementPooling() - { - return false; - } - - - /** - Indicates if stored procedure calls using the stored procedure - escape syntax are supported. - - @return Always true. Stored procedure calls using the stored - procedure escape syntax are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsStoredProcedures () - throws SQLException - { - return true; - } - - - - - /** - Indicates if subqueries in comparisons are supported. - - @return Always true. Subqueries in comparisons are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSubqueriesInComparisons () - throws SQLException - { - return true; - } - - - - /** - Indicates if subqueries in EXISTS expressions are supported. - - @return Always true. Subqueries in EXISTS expressions are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSubqueriesInExists () - throws SQLException - { - return true; - } - - - - /** - Indicates if subqueries in IN expressions are supported. - - @return Always true. Subqueries in IN expressions are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSubqueriesInIns () - throws SQLException - { - return true; - } - - - - /** - Indicates if subqueries in quantified expressions are supported. - - @return Always true. Subqueries in quantified expressions are - supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsSubqueriesInQuantifieds () - throws SQLException - { - return true; - } - - - - /** - Indicates if table correlation names are supported. - - @return Always true. Table correlation names are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsTableCorrelationNames () - throws SQLException - { - return true; - } - - - - /** - Indicates if the database supports the given transaction - isolation level. - - @param transactionIsolationLevel One of the Connection.TRANSACTION_* - values. - @return Always true. All transaction isolation - levels are supported. - - @exception SQLException If the transaction isolation level is not valid. - **/ - public boolean supportsTransactionIsolationLevel (int transactionIsolationLevel) - throws SQLException - { - // Validate the transaction isolation level. - if ((transactionIsolationLevel != Connection.TRANSACTION_NONE) - && (transactionIsolationLevel != Connection.TRANSACTION_READ_UNCOMMITTED) - && (transactionIsolationLevel != Connection.TRANSACTION_READ_COMMITTED) - && (transactionIsolationLevel != Connection.TRANSACTION_REPEATABLE_READ) - && (transactionIsolationLevel != Connection.TRANSACTION_SERIALIZABLE)) - JDError.throwSQLException (this, JDError.EXC_CONCURRENCY_INVALID); - - if(transactionIsolationLevel == Connection.TRANSACTION_NONE) - { - return false; // we have determined that we do not support JDBC's idea of TRANSACTION_NONE - } - else - { - return true; - } - } - - - - /** - Indicates if transactions are supported. - - @return Always true. Transactions are supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsTransactions () - throws SQLException - { - return true; - } - - - - /** - Indicates if SQL UNION is supported. - - @return Always true. SQL UNION is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsUnion () - throws SQLException - { - return true; - } - - - - /** - Indicates if SQL UNION ALL is supported. - - @return Always true. SQL UNION ALL is supported. - - @exception SQLException This exception is never thrown. - **/ - public boolean supportsUnionAll () - throws SQLException - { - return true; - } - - - - /** - Returns the name of the catalog. - - @return The name of the catalog. - **/ - public String toString () - { - try - { - return connection_.getCatalog(); - } - catch (SQLException e) - { - return super.toString (); - } - } - - - - // JDBC 2.0 - /** - Indicates if visible updates to a result set of the specified type - can be detected by calling ResultSet.rowUpdated(). - - @param resultSetType The result set type. Value values are: -
          -
        • ResultSet.TYPE_FORWARD_ONLY -
        • ResultSet.TYPE_SCROLL_INSENSITIVE -
        • ResultSet.TYPE_SCROLL_SENSITIVE -
        - @return Always false. Updates can not be detected - by calling ResultSet.rowUpdated(). - - @exception SQLException If the result set type is not valid. - **/ - public boolean updatesAreDetected (int resultSetType) - throws SQLException - { - // Validate the result set type. - supportsResultSetType (resultSetType); - - return false; - } - - - - /** - Indicates if the database uses a file for each table. - - @return Always false. The database does not use a file for each - table. - - @exception SQLException This exception is never thrown. - **/ - public boolean usesLocalFilePerTable () - throws SQLException - { - return false; - } - - - - /** - Indicates if the database stores tables in a local file. - - @return Always false. The database does not store tables in a local - file. - - @exception SQLException This exception is never thrown. - **/ - public boolean usesLocalFiles () - throws SQLException - { - return false; - } - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCDatabaseMetaData", "java.sql.DatabaseMetaData" }; - } - - - //@PDA jdbc40 - /** - * Retrieves whether a SQLException thrown while autoCommit is true indicates - * that all open ResultSets are closed, even ones that are holdable. When a SQLException occurs while - * autocommit is true, it is vendor specific whether the JDBC driver responds with a commit operation, a - * rollback operation, or by doing neither a commit nor a rollback. A potential result of this difference - * is in whether or not holdable ResultSets are closed. - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean autoCommitFailureClosesAllResultSets() throws SQLException - { - return false; //toolbox returns false based on current behavoir - } - - //@PDA jdbc40 - /** - * Retrieves a list of the client info properties - * that the driver supports. The result set contains the following columns - *

        - *

          - *
        1. NAME String=> The name of the client info property
          - *
        2. MAX_LEN int=> The maximum length of the value for the property
          - *
        3. DEFAULT_VALUE String=> The default value of the property
          - *
        4. DESCRIPTION String=> A description of the property. This will typically - * contain information as to where this property is - * stored in the database. - *
        - *

        - * The ResultSet is sorted by the NAME column in ascending order - *

        - * @return A ResultSet object; each row is a supported client info - * property - *

        - * @exception SQLException if a database access error occurs - *

        - */ - public ResultSet getClientInfoProperties() throws SQLException - { - // Set up the result set. - int vrm = connection_.getVRM(); //@trunc3 - String[] fieldNames = { "NAME", "MAX_LEN", "DEFAULT_VALUE", "DESCRIPTION" }; - SQLData[] sqlData = { new SQLVarchar(32, settings_), new SQLInteger(vrm), new SQLVarchar(32, settings_), new SQLVarchar(1024, settings_) }; //trunc3 - int[] fieldNullables = {columnNoNulls, columnNoNulls, columnNoNulls, columnNoNulls}; // table types can not be null - - Object[][] data = { { "ApplicationName", new Integer(255), "", AS400JDBCDriver.getResource ("CLIENT_INFO_DESC_APPLICATIONNAME") }, - { "ClientUser", new Integer(255), "", AS400JDBCDriver.getResource ("CLIENT_INFO_DESC_CLIENTUSER")}, - { "ClientHostname", new Integer(255), "", AS400JDBCDriver.getResource ("CLIENT_INFO_DESC_CLIENTHOSTNAME")}, - { "ClientAccounting", new Integer(255), "", AS400JDBCDriver.getResource ("CLIENT_INFO_DESC_CLIENTACCOUNTING")}, - { "ClientProgramID", new Integer(255), "", AS400JDBCDriver.getResource ("CLIENT_INFO_DESC_CLIENTPROGRAMID")}}; //@pdc programID - - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - JDSimpleRowCache rowCache = new JDSimpleRowCache(formatRow, data); - - return new AS400JDBCResultSet (rowCache, connection_.getCatalog(), - "Client Info", connection_, null); //@in2 - } - - - //@PDA jdbc40 - //JDBC40DOC /** - //JDBC40DOC * Indicates whether or not this data source supports the SQL ROWID type, - //JDBC40DOC * and if so the lifetime for which a RowId object remains valid. - //JDBC40DOC *

        - //JDBC40DOC * The returned int values have the following relationship: - //JDBC40DOC *

        -  //JDBC40DOC      *     ROWID_UNSUPPORTED < ROWID_VALID_OTHER < ROWID_VALID_TRANSACTION
        -  //JDBC40DOC      *         < ROWID_VALID_SESSION < ROWID_VALID_FOREVER
        -  //JDBC40DOC      * 
        - //JDBC40DOC * so conditional logic such as - //JDBC40DOC *
        -  //JDBC40DOC      *     if (metadata.getRowIdLifetime() > DatabaseMetaData.ROWID_VALID_TRANSACTION)
        -  //JDBC40DOC      * 
        - //JDBC40DOC * can be used. Valid Forever means valid across all Sessions, and valid for - //JDBC40DOC * a Session means valid across all its contained Transactions. - //JDBC40DOC * - //JDBC40DOC * @throws SQLException if a database access error occurs - //JDBC40DOC */ - /* ifdef JDBC40 - public RowIdLifetime getRowIdLifetime() throws SQLException - { - return RowIdLifetime.ROWID_VALID_FOREVER; //toolbox rowid is forever - } - endif */ - - //@PDA jdbc40 - /** - * Retrieves the schema names available in this database. The results - * are ordered by schema name. - * - *

        The schema column is: - *

          - *
        1. TABLE_SCHEM String => schema name - *
        2. TABLE_CATALOG String => catalog name (may be null) - *
        - * - * - * @param catalog a catalog name; must match the catalog name as it is stored - * in the database;"" retrieves those without a catalog; null means catalog - * name should not be used to narrow down the search. - * @param schemaPattern a schema name; must match the schema name as it is - * stored in the database; null means - * schema name should not be used to narrow down the search. - * @return a ResultSet object in which each row is a - * schema decription - * @exception SQLException if a database access error occurs - * @see #getSearchStringEscape - */ - public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException - { - connection_.checkOpen(); - - CallableStatement cstmt = connection_.prepareCall("call SYSIBM" + getCatalogSeparator() + "SQLTABLES (?, ?, ?, ?, ?)"); - - cstmt.setString(1, normalize(catalog)); - cstmt.setString(2, normalize(schemaPattern)); - cstmt.setString(3, "%"); //@mdsp - cstmt.setString(4, "%"); //@mdsp - cstmt.setObject(5, "DATATYPE='JDBC';GETSCHEMAS=2;CURSORHOLD=1"); - cstmt.execute(); //@mdrs - ResultSet rs = cstmt.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cstmt.close(); //@mdrs2 - - return rs; //@mdrs - } - - - //@PDA jdbc40 - /** - * Retrieves whether this database supports invoking user-defined or vendor functions - * using the stored procedure escape syntax. - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException - { - // toolbox does not support this - return false; - } - - - //@PDA jdbc40 - /** - * Retrieves a description of the user functions available in the given - * catalog. - *

        - * Only system and user function descriptions matching the schema and - * function name criteria are returned. They are ordered by - * FUNCTION_CAT, FUNCTION_SCHEM, - * FUNCTION_NAME and - * SPECIFIC_ NAME. - * - *

        Each function description has the the following columns: - *

          - *
        1. FUNCTION_CAT String => function catalog (may be null) - *
        2. FUNCTION_SCHEM String => function schema (may be null) - *
        3. FUNCTION_NAME String => function name. This is the name - * used to invoke the function - *
        4. REMARKS String => explanatory comment on the function - *
        5. FUNCTION_TYPE short => kind of function: - *
            - *
          • functionResultUnknown - Cannot determine if a return value - * or table will be returned - *
          • functionNoTable- Does not return a table - *
          • functionReturnsTable - Returns a table - *
          - *
        6. SPECIFIC_NAME String => the name which uniquely identifies - * this function within its schema. This is a user specified, or DBMS - * generated, name that may be different then the FUNCTION_NAME - * for example with overload functions - *
        - *

        - * A user may not have permissions to execute any of the functions that are - * returned by getFunctions - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schemaPattern a schema name pattern; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param functionNamePattern a function name pattern; must match the - * function name as it is stored in the database - * @return ResultSet - each row is a function description - * @exception SQLException if a database access error occurs - * @see #getSearchStringEscape - */ - public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException - { - connection_.checkOpen(); - - // @A3 Not sure why this was not supported, since the stored procedure exists on V5R4 - // if(connection_.getVRM() < JDUtilities.vrm610) //@pda HSTSRVR support not PTFing support to v5r4 - // { - // JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - // return null; - //} - - /* - SYSIBM.SQLFunctions( - CatalogName varchar(128), - SchemaName varchar(128), - FunctionName varchar(128), - Options varchar(4000)) - */ - - CallableStatement cstmt = connection_.prepareCall("call SYSIBM" + getCatalogSeparator() + "SQLFUNCTIONS ( ?, ?, ?, ?)"); - - cstmt.setString(1, normalize(catalog)); - cstmt.setString(2, normalize(schemaPattern)); - cstmt.setString(3, normalize(functionNamePattern)); - cstmt.setObject(4, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); //@mdsp - cstmt.execute(); //@mdrs - ResultSet rs = cstmt.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cstmt.close(); //@mdrs2 - - return rs; //@mdrs - } - - - //@pda jdbc40 - /** - * Retrieves a description of the given catalog's system or user - * function parameters and return type. - * - *

        Only descriptions matching the schema, function and - * parameter name criteria are returned. They are ordered by - * FUNCTION_CAT, FUNCTION_SCHEM, - * FUNCTION_NAME and - * SPECIFIC_ NAME. Within this, the return value, - * if any, is first. Next are the parameter descriptions in call - * order. The column descriptions follow in column number order. - * - *

        Each row in the ResultSet - * is a parameter description, column description or - * return type description with the following fields: - *

          - *
        1. FUNCTION_CAT String => function catalog (may be null) - *
        2. FUNCTION_SCHEM String => function schema (may be null) - *
        3. FUNCTION_NAME String => function name. This is the name - * used to invoke the function - *
        4. COLUMN_NAME String => column/parameter name - *
        5. COLUMN_TYPE Short => kind of column/parameter: - *
            - *
          • functionColumnUnknown - nobody knows - *
          • functionColumnIn - IN parameter - *
          • functionColumnInOut - INOUT parameter - *
          • functionColumnOut - OUT parameter - *
          • functionColumnReturn - function return value - *
          • functionColumnResult - Indicates that the parameter or column - * is a column in the ResultSet - *
          - *
        6. DATA_TYPE int => SQL type from java.sql.Types - *
        7. TYPE_NAME String => SQL type name, for a UDT type the - * type name is fully qualified - *
        8. PRECISION int => precision - *
        9. LENGTH int => length in bytes of data - *
        10. SCALE short => scale - null is returned for data types where - * SCALE is not applicable. - *
        11. RADIX short => radix - *
        12. NULLABLE short => can it contain NULL. - *
            - *
          • functionNoNulls - does not allow NULL values - *
          • functionNullable - allows NULL values - *
          • functionNullableUnknown - nullability unknown - *
          - *
        13. REMARKS String => comment describing column/parameter - *
        14. CHAR_OCTET_LENGTH int => the maximum length of binary - * and character based parameters or columns. For any other datatype the returned value - * is a NULL - *
        15. ORDINAL_POSITION int => the ordinal position, starting - * from 1, for the input and output parameters. A value of 0 - * is returned if this row describes the function's return value. - * For result set columns, it is the - * ordinal position of the column in the result set starting from 1. - *
        16. IS_NULLABLE String => ISO rules are used to determine - * the nullability for a parameter or column. - *
            - *
          • YES --- if the parameter or column can include NULLs - *
          • NO --- if the parameter or column cannot include NULLs - *
          • empty string --- if the nullability for the - * parameter or column is unknown - *
          - *
        17. SPECIFIC_NAME String => the name which uniquely identifies - * this function within its schema. This is a user specified, or DBMS - * generated, name that may be different then the FUNCTION_NAME - * for example with overload functions - *
        - * - *

        The PRECISION column represents the specified column size for the given - * parameter or column. - * For numeric data, this is the maximum precision. For character data, this is the length in characters. - * For datetime datatypes, this is the length in characters of the String representation (assuming the - * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, - * this is the length in bytes. Null is returned for data types where the - * column size is not applicable. - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schemaPattern a schema name pattern; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param functionNamePattern a procedure name pattern; must match the - * function name as it is stored in the database - * @param columnNamePattern a parameter name pattern; must match the - * parameter or column name as it is stored in the database - * @return ResultSet - each row describes a - * user function parameter, column or return type - * - * @exception SQLException if a database access error occurs - * @see #getSearchStringEscape - */ - public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException - { - //@PDA add support to call stored procedure - connection_.checkOpen(); - - //@A3D Allow this to occur to V5R4 - // if(connection_.getVRM() < JDUtilities.vrm610) //@pda HSTSRVR support not PTFing support to v5r4 - // { - // JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - // return null; - // } - /* - SQLFunctionCols( - CatalogName varchar(128), - SchemaName varchar(128), - FuncName varchar(128), - ParamName varchar(128), - Options varchar(4000)) - */ - - CallableStatement cstmt = connection_.prepareCall("call SYSIBM" + getCatalogSeparator() + "SQLFUNCTIONCOLS ( ?, ?, ?, ?, ?)"); - - cstmt.setString(1, normalize(catalog)); - cstmt.setString(2, normalize(schemaPattern)); - cstmt.setString(3, normalize(functionNamePattern)); - cstmt.setString(4, normalize(columnNamePattern)); -/* ifdef JDBC40 - cstmt.setObject(5, "DATATYPE='JDBC';JDBCVER='4.0';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); //@mdsp //@ver -endif */ -/* ifndef JDBC40 */ - cstmt.setObject(5, "DATATYPE='JDBC';DYNAMIC=0;REPORTPUBLICPRIVILEGES=1;CURSORHOLD=1"); //@mdsp -/* endif */ - cstmt.execute();//@mdrs - ResultSet rs = cstmt.getResultSet(); //@mdrs - if(rs != null) //@mdrs - ((AS400JDBCResultSet)rs).isMetadataResultSet = true;//@mdrs - else - cstmt.close(); //@mdrs2 - - return rs; //@mdrs - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCDriver.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCDriver.java deleted file mode 100644 index 6c857f350..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCDriver.java +++ /dev/null @@ -1,1469 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCDriver.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; // @B9A -import java.net.InetAddress; // @C2A -import java.sql.Connection; -import java.sql.Driver; -import java.sql.DriverManager; -import java.sql.DriverPropertyInfo; -import java.sql.SQLException; -import java.util.Properties; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - - - -/** -A JDBC 3.0/4.0 driver that accesses DB2 for IBM i databases. - -

        To use this driver, the application or caller must register -the driver with the JDBC DriverManager. This class also registers -itself automatically when it is loaded. - -

        After registering the driver, applications make connection -requests to the DriverManager, which dispatches them to the -appropriate driver. This driver accepts connection requests -for databases specified by the URLs that match the following syntax: - -

        -jdbc:as400://system-name/default-schema;properties
        -
        - -

        The driver uses the specified system name to connect -to a corresponding IBM i system. If a system name is not -specified, then the user will be prompted. - -

        The default SQL schema is optional and the driver uses it to resolve -unqualified names in SQL statements. If no default SQL schema is set, then -the driver resolves unqualified names based on the naming convention -for the connection. If SQL naming is being used, and no default SQL schema -is set, then the driver resolves unqualified names using the schema with -the same name as the user. If system naming is being used, and no -default SQL schema is set, then the driver resolves unqualified names using -the server job's library list. See -JDBC properties -for more details on how to set the naming convention -and library list. - -

        Several properties can optionally be set within the URL. They are -separated by semicolons and are in the form: -

        -name1=value1;name2=value2;...
        -
        -See -JDBC properties -for a complete list of properties supported by this driver. - -

        The following example URL specifies a connection to the -database on system mysystem.helloworld.com with -mylibrary as the default SQL schema. The connection will -use the system naming convention and return full error messages: -

        -jdbc:as400://mysystem.helloworld.com/mylibrary;naming=system;errors=full
        -
        -**/ -// -// Implementation note: -// -// 1. A goal stated in the JDBC specification is to keep -// the Driver class as small and standalone as possible, -// so that it can be quickly loaded when choosing a -// driver for a particular database. -// -// 2. It was proposed that we also accept URLs with the -// "db2" subprotocol. This would make us consistent with -// other IBM drivers. In addition, it would also allow -// developers to hardcode URLs in programs and they would -// run as-is with both this driver and the "native" driver. -// -// We realized, though, that if running on a client with -// both this driver and another DB2 client for that platform, -// how do the drivers differentiate themselves? Therefore -// we are chosing NOT to recognized the "db2" subprotocol. -// Instead, suggest to developers to externalize the URL -// to users, rather than hardcoding it. -// - -// -// Toolbox driver change log -// -// Flag YYYYMMDD Reason -// ----- -------- --------------- -// @A1 20100406 Correct Syntax Error on Insert -// @A2 20100407 Update/Delete Blocking fix -// @A3 20100407 Allow DMD.getFunctions call on V5R4 -// @A4 20100415 Fix update counts for batched update -// @A5 20100430 Correct JDUtilities.streamToBytes -// @A6 20100503 maximum blocked input rows property / Free storage used by blocked updates. -// @A7 20100506 buffer synchronization / remove Class.forName() contention / gc tracing -// @A8 20100507 minimize buffer usage for blocked insert -// @A9 20100720 Fix AS400JDBCResultSetMetaData.isAutoIncrement() when extended metadata is off -// @AA 20100805 Fix AS400JDBCStatement.execute to return syntax error from database engine. -// @AB 20101108 Make sure locators are scoped to cursor when isolation level = *NONE -// -// @B1 20101203 Call Trace.logLoadPath when loading class, so trace indicated where driver was loaded from. -// Also trace JVM information. -// @B2 20101209 Fix Statement.setQueryTimeout -// @B3 20101209 Delay reading of input stream until execute -// @B4 20101215 Use NEW TABLE instead of FINAL table for autogenerated keys. -// @B5 20110105 Fix leaking DBStorage objects. -// @B6 20110114 Fix SQLResultSetTablePane -// @C1 20110119 Message File enhancement from David Gibbs -// @C2 20110121 CommandHelpRetriever fixes for empty help text. -// @C3 20110122 Make sure returnToPool is associated with nulling object. (Not Marked) -// @C4 20110217 Stored procedure scrollable cursor fixes. -// @C5 20110221 RLA Bidi Conversion -// @C6 20110224 Change JVM16 synchronization to not be default behavior -// @C7 20110303 Identify Generic Objects (replace with subclasses) -//-------------------------------------------------------------------- - - -public class AS400JDBCDriver -implements java.sql.Driver -{ - // Constants. - - static final int MAJOR_VERSION_ = Copyright.MAJOR_VERSION; - static final int MINOR_VERSION_ = Copyright.MINOR_VERSION; - static final String DATABASE_PRODUCT_NAME_ = "DB2 UDB for AS/400"; // @D0A - static final String DRIVER_NAME_ = "AS/400 Toolbox for Java JDBC Driver"; // @D0C @C5C @C6C - static final String DRIVER_LEVEL_ = Copyright.DRIVER_LEVEL; - -/* ifdef JDBC40 - public static final int JDBC_MAJOR_VERSION_ = 4; // JDBC spec version: 4.0 -endif */ -/* ifndef JDBC40 */ - public static final int JDBC_MAJOR_VERSION_ = 3; // JDBC spec version: 3.0 -/* endif */ - public static final int JDBC_MINOR_VERSION_ = 0; - - - // This string "9999:9999" is returned when resource - // bundle errors occur. No significance to this string, - // except that Client Access used to use it. It would - // probably be more helpful to return some other string. - // - private static final String MRI_NOT_FOUND_ = "9999:9999"; - - - - // Private data. - - // Toolbox resources needed in proxy jar file. @A1C - private static ResourceBundle resources_; - // Toolbox resources NOT needed in proxy jar file. @A1A - private static ResourceBundle resources2_; - - private static final String CLASSNAME = "com.ibm.as400.access.AS400JDBCDriver"; - - - /** - Static initializer. Registers the JDBC driver with the JDBC - driver manager and loads the appropriate resource bundle for - the current locale. - **/ - static { - try - { - // Log where the toolbox is loaded from @B1A - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - - DriverManager.registerDriver (new AS400JDBCDriver ()); - resources_ = ResourceBundle.getBundle ("com.ibm.as400.access.JDMRI"); - resources2_ = ResourceBundle.getBundle ("com.ibm.as400.access.JDMRI2"); - // Note: When using the proxy jar file, we do not expect to find JDMRI2. - } - catch (MissingResourceException e) - { - - // Catch the exception. This is because exceptions - // thrown from static initializers are hard to debug. - // Instead, we will handle the error when the - // driver needs to get at particular methods. - // See getResource(). - } - catch (SQLException e) - { - // Ignore. - } - } - - - - /** - Indicates if the driver understands how to connect - to the database named by the URL. - - @param url The URL for the database. - @return true if the driver understands how - to connect to the database; false - otherwise. - - @exception SQLException If an error occurs. - **/ - public boolean acceptsURL (String url) - throws SQLException - { - JDDataSourceURL dataSourceUrl = new JDDataSourceURL (url); - return dataSourceUrl.isValid (); - } - - - - /** - Connects to the database named by the specified URL. - There are many optional properties that can be specified. - Properties can be specified either as part of the URL or in - a java.util.Properties object. See -JDBC properties - for a complete list of properties - supported by this driver. - - @param url The URL for the database. - @param info The connection properties. - @return The connection to the database or null if - the driver does not understand how to connect - to the database. - - @exception SQLException If the driver is unable to make the connection. - **/ - public java.sql.Connection connect (String url, - Properties info) - throws SQLException - { - // Check first thing to see if the trace property is - // turned on. This way we can trace everything, including - // the important stuff like loading the properties. - JDDataSourceURL dataSourceUrl = new JDDataSourceURL (url); - Properties urlProperties = dataSourceUrl.getProperties (); - - // If trace property was set to true, turn on tracing. If trace property was set to false, - // turn off tracing. If trace property was not set, do not change. - if (JDProperties.isTraceSet (urlProperties, info) == JDProperties.TRACE_SET_ON) - { //@B5C - if (! JDTrace.isTraceOn ()) - JDTrace.setTraceOn (true); - } - else if (JDProperties.isTraceSet (urlProperties, info) == JDProperties.TRACE_SET_OFF) //@B5A - { - //@B5A - if (JDTrace.isTraceOn ()) //@B5A - JDTrace.setTraceOn (false); //@B5A - } //@B5A - //@B4D Deleted lines because trace should not be set off just because property - //@B4D not specified. - //@B4D else - //@B4D JDTrace.setTraceOn (false); - - // If toolbox trace is set to datastream. Turn on datastream tracing. - if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_DATASTREAM) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDatastreamOn(true); - } - // If toolbox trace is set to diagnostic. Turn on diagnostic tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_DIAGNOSTIC) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDiagnosticOn(true); - } - // If toolbox trace is set to error. Turn on error tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_ERROR) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceErrorOn(true); - } - // If toolbox trace is set to information. Turn on information tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_INFORMATION) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceInformationOn(true); - } - // If toolbox trace is set to warning. Turn on warning tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_WARNING) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceWarningOn(true); - } - // If toolbox trace is set to conversion. Turn on conversion tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_CONVERSION) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceConversionOn(true); - } - // If toolbox trace is set to proxy. Turn on proxy tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_PROXY) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceProxyOn(true); - } - // If toolbox trace is set to pcml. Turn on pcml tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_PCML) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTracePCMLOn(true); - } - // If toolbox trace is set to jdbc. Turn on jdbc tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_JDBC) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceJDBCOn(true); - } - // If toolbox trace is set to all. Turn on tracing for all categories. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_ALL) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceAllOn(true); - } - // If toolbox trace is set to thread. Turn on thread tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_THREAD) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceThreadOn(true); - } - // If toolbox trace is set to none. Turn off tracing. - else if (JDProperties.isToolboxTraceSet (urlProperties, info) == JDProperties.TRACE_TOOLBOX_NONE) - { - //@K1A - if (Trace.isTraceOn()) - { - Trace.setTraceOn(false); - } - } - - JDProperties jdProperties = new JDProperties (urlProperties, info); - - // Initialize the connection if the URL is valid. - Connection connection = null; //@A0C - if (dataSourceUrl.isValid ()) - connection = initializeConnection (dataSourceUrl, jdProperties, - info); //@A0C - - return connection; - } - - - //@B5A - /** - Connects to the database on the specified system. -

        Note: Since this method is not defined in the JDBC Driver interface, - you typically need to create a Driver object in order - to call this method: -

        -	AS400JDBCDriver d = new AS400JDBCDriver();
        -	AS400 o = new AS400(myAS400, myUserId, myPwd);
        -	Connection c = d.connect (o);
        -	
        - - - @param system The IBM i system to connect. - @return The connection to the database or null if - the driver does not understand how to connect - to the database. - - @exception SQLException If the driver is unable to make the connection. - **/ - public java.sql.Connection connect (AS400 system) - throws SQLException - { - if (system == null) - throw new NullPointerException("system"); - - if (system instanceof SecureAS400) - return initializeConnection(new SecureAS400(system)); - else - return initializeConnection(new AS400(system)); - - // Initialize the connection. - //@B7D Connection connection = null; - //@B7D connection = initializeConnection (o); - //@B7D return connection; - } - - //@KKB - /** - Connects to the database on the specified system. -

        Note: Since this method is not defined in the JDBC Driver interface, - you typically need to create a Driver object in order - to call this method: -

        -	AS400JDBCDriver d = new AS400JDBCDriver();
        -	AS400 o = new AS400(myAS400, myUserId, myPwd);
        -	Connection c = d.connect (o, false);
        -	
        - - - @param system The IBM i system to connect. - @param clone True if the AS400 object should be cloned, false otherwises - @return The connection to the database or null if - the driver does not understand how to connect - to the database. - - @exception SQLException If the driver is unable to make the connection. - **/ - public java.sql.Connection connect (AS400 system, boolean clone) - throws SQLException - { - if (system == null) - throw new NullPointerException("system"); - - if(!clone) //Do not clone the AS400 object, use the one passed in - return initializeConnection(system); - else //clone the AS400 object - return connect(system); - } - - - //@D4A - /** - Connects to the database on the specified system. -

        Note: Since this method is not defined in the JDBC Driver interface, - you typically need to create a Driver object in order - to call this method: -

        -	AS400JDBCDriver d = new AS400JDBCDriver();
        -	AS400 o = new AS400(myAS400, myUserId, myPwd);
        -        String mySchema = "defaultSchema";
        -        Properties prop = new Properties();
        -	Connection c = d.connect (o, prop, mySchema, false);
        -	
        - - - @param system The IBM i system to connect. - @param info The connection properties. - @param schema The default SQL schema or null meaning no default SQL schema specified. - @param clone True if the AS400 object should be cloned, false otherwises - @return The connection to the database or null if - the driver does not understand how to connect - to the database. - - @exception SQLException If the driver is unable to make the connection. - **/ - public java.sql.Connection connect (AS400 system, Properties info, String schema, boolean clone) - throws SQLException - { - if (system == null) - throw new NullPointerException("system"); - - if (info == null) - throw new NullPointerException("properties"); - - //@PDD not needed, just pass in null to isXTraceSet(null, info) below - //Properties urlProperties = new Properties(); - - // Check first thing to see if the trace property is - // turned on. This way we can trace everything, including - // the important stuff like loading the properties. - - // If trace property was set to true, turn on tracing. If trace property was set to false, - // turn off tracing. If trace property was not set, do not change. - if (JDProperties.isTraceSet (null, info) == JDProperties.TRACE_SET_ON) - { - if (! JDTrace.isTraceOn ()) - JDTrace.setTraceOn (true); - } - else if (JDProperties.isTraceSet (null, info) == JDProperties.TRACE_SET_OFF) - { - if (JDTrace.isTraceOn ()) - JDTrace.setTraceOn (false); - } - - // If toolbox trace is set to datastream. Turn on datastream tracing. - if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_DATASTREAM) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDatastreamOn(true); - } - // If toolbox trace is set to diagnostic. Turn on diagnostic tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_DIAGNOSTIC) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDiagnosticOn(true); - } - // If toolbox trace is set to error. Turn on error tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_ERROR) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceErrorOn(true); - } - // If toolbox trace is set to information. Turn on information tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_INFORMATION) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceInformationOn(true); - } - // If toolbox trace is set to warning. Turn on warning tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_WARNING) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceWarningOn(true); - } - // If toolbox trace is set to conversion. Turn on conversion tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_CONVERSION) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceConversionOn(true); - } - // If toolbox trace is set to proxy. Turn on proxy tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_PROXY) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceProxyOn(true); - } - // If toolbox trace is set to pcml. Turn on pcml tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_PCML) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTracePCMLOn(true); - } - // If toolbox trace is set to jdbc. Turn on jdbc tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_JDBC) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceJDBCOn(true); - } - // If toolbox trace is set to all. Turn on tracing for all categories. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_ALL) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceAllOn(true); - } - // If toolbox trace is set to thread. Turn on thread tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_THREAD) - { - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceThreadOn(true); - } - // If toolbox trace is set to none. Turn off tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_NONE) - { - if (Trace.isTraceOn()) - { - Trace.setTraceOn(false); - } - } - - if(!clone) //Do not clone the AS400 object, use the one passed in - return initializeConnection(schema, info, system); - else //clone the AS400 object - { - if(system instanceof SecureAS400) - return initializeConnection(schema, info, new SecureAS400(system)); - else - return initializeConnection(schema, info, new AS400(system)); - } - } - - //@B5A - /** - Connects to the database on the specified system. - There are many optional properties that can be specified. - Properties can be specified in - a java.util.Properties object. See -JDBC properties - for a complete list of properties - supported by this driver. - -

        Note: Since this method is not defined in the JDBC Driver interface, - you typically need to create a Driver object in order - to call this method: -

        -	AS400JDBCDriver d = new AS400JDBCDriver();
        -	String mySchema = "defaultSchema";
        -	Properties p = new Properties();
        -	AS400 o = new AS400(myAS400, myUserId, myPwd);
        -	Connection c = d.connect (o, p, mySchema);
        -	
        - - @param system The IBM i system to connect. - @param info The connection properties. - @param schema The default SQL schema or null meaning no default SQL schema specified. - @return The connection to the database or null if - the driver does not understand how to connect - to the database. - - @exception SQLException If the driver is unable to make the connection. - **/ - public java.sql.Connection connect (AS400 system, Properties info, String schema) - throws SQLException - { - if (system == null) - throw new NullPointerException("system"); - - if (info == null) - throw new NullPointerException("properties"); - - //@B7D AS400 o = new AS400(system); - //@PDD not needed, just pass in null to isXTraceSet(null, info) below - //Properties urlProperties = new Properties(); - - // Check first thing to see if the trace property is - // turned on. This way we can trace everything, including - // the important stuff like loading the properties. - - // If trace property was set to true, turn on tracing. If trace property was set to false, - // turn off tracing. If trace property was not set, do not change. - if (JDProperties.isTraceSet (null, info) == JDProperties.TRACE_SET_ON) - { - if (! JDTrace.isTraceOn ()) - JDTrace.setTraceOn (true); - } - else if (JDProperties.isTraceSet (null, info) == JDProperties.TRACE_SET_OFF) - { - if (JDTrace.isTraceOn ()) - JDTrace.setTraceOn (false); - } - - // If toolbox trace is set to datastream. Turn on datastream tracing. - if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_DATASTREAM) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDatastreamOn(true); - } - // If toolbox trace is set to diagnostic. Turn on diagnostic tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_DIAGNOSTIC) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDiagnosticOn(true); - } - // If toolbox trace is set to error. Turn on error tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_ERROR) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceErrorOn(true); - } - // If toolbox trace is set to information. Turn on information tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_INFORMATION) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceInformationOn(true); - } - // If toolbox trace is set to warning. Turn on warning tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_WARNING) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceWarningOn(true); - } - // If toolbox trace is set to conversion. Turn on conversion tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_CONVERSION) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceConversionOn(true); - } - // If toolbox trace is set to proxy. Turn on proxy tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_PROXY) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceProxyOn(true); - } - // If toolbox trace is set to pcml. Turn on pcml tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_PCML) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTracePCMLOn(true); - } - // If toolbox trace is set to jdbc. Turn on jdbc tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_JDBC) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceJDBCOn(true); - } - // If toolbox trace is set to all. Turn on tracing for all categories. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_ALL) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceAllOn(true); - } - // If toolbox trace is set to thread. Turn on thread tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_THREAD) - { - //@K1A - if (! Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceThreadOn(true); - } - // If toolbox trace is set to none. Turn off tracing. - else if (JDProperties.isToolboxTraceSet (null, info) == JDProperties.TRACE_TOOLBOX_NONE) - { - //@K1A - if (Trace.isTraceOn()) - { - Trace.setTraceOn(false); - } - } - - //@PDD not used JDProperties jdProperties = new JDProperties (null, info); - - if (system instanceof SecureAS400) - return initializeConnection(schema, info, new SecureAS400(system)); - else - return initializeConnection(schema, info, new AS400(system)); - // Initialize the connection if the URL is valid. - //@B7D Connection connection = null; - //@B7D connection = initializeConnection (schema, info, o); - - //@B7D return connection; - } - - - - - /** - Returns the driver's major version number. - - @return The major version number. - **/ - public int getMajorVersion () - { - return MAJOR_VERSION_; - } - - - - /** - Returns the driver's minor version number. - - @return The minor version number. - **/ - public int getMinorVersion () - { - return MINOR_VERSION_; - } - - - - /** - Returns an array of DriverPropertyInfo objects that - describe the properties that are supported by this - driver. - - @param url The URL for the database. - @param info The connection properties. - @return The descriptions of all possible properties or null if - the driver does not understand how to connect to the - database. - - @exception SQLException If an error occurs. - **/ - public DriverPropertyInfo[] getPropertyInfo (String url, - Properties info) - throws SQLException - { - JDDataSourceURL dataSourceUrl = new JDDataSourceURL (url); - - DriverPropertyInfo[] dpi = null; - if (dataSourceUrl.isValid ()) - { - JDProperties properties = new JDProperties (dataSourceUrl.getProperties(), info); - dpi = properties.getInfo (); - } - - return dpi; - } - - - - /** - Returns a resource from the resource bundle. - - @param key The resource key. - @return The resource String. - **/ - static String getResource (String key) - { - // If the resource bundle or resource is not found, - // do not thrown an exception. Instead, return a - // default string. This is because some JVMs will - // not recover quite right from such errors, and - // claim a security exception (e.g. Netscape starts - // looking in the client class path, which is - // not allowed.) - // - String resource; - if (resources_ == null) - resource = MRI_NOT_FOUND_; - else - { - try - { - resource = resources_.getString (key); - } - catch (MissingResourceException e) - { - if (resources2_ == null) //@A1A - resource = MRI_NOT_FOUND_; //@A1A - else - { //@A1A - try - { //@A1A - resource = resources2_.getString (key); //@A1A - } //@A1A - catch (MissingResourceException e1) - { //@A1A - JDTrace.logInformation (AS400JDBCDriver.class, - "Missing resource [" + key + "]"); //@A1A - resource = MRI_NOT_FOUND_; - } - } - } - } - - return resource; - } - - - - //@B3A - This logic was formerly in the initializeConnection() method. - static AS400 initializeAS400(JDDataSourceURL dataSourceUrl, - JDProperties jdProperties, - Properties info) - throws SQLException //@pw1 - { - // We must handle the different combinations of input - // user names and passwords. - String serverName = dataSourceUrl.getServerName(); - String userName = jdProperties.getString (JDProperties.USER); - String password = jdProperties.getString (JDProperties.PASSWORD); - String prompt = jdProperties.getString (JDProperties.PROMPT); // @B8C - boolean secure = jdProperties.getBoolean (JDProperties.SECURE); - String keyRingName = jdProperties.getString (JDProperties.KEY_RING_NAME); //@B9A - String keyRingPassword = jdProperties.getString (JDProperties.KEY_RING_PASSWORD); //@B9A - boolean useThreads = jdProperties.getBoolean(JDProperties.THREAD_USED); - - //@pw1 Decided to leave connections via AS400() as-is and just implement to mimic Native JDBC - //@pw1 info contains args from DriverMangager.getConnection(args) - //@pw1 jdProperties does not represent null values. Both null and "" have a value of "". - //@pw1 if info contains id/pass of "" then they must not be "" in jdProperties (allowing jdProperties to override) - //@pw1 throw exception if info id/pass == "" and change info id/pass to "" if they are null - //@pw3 Add way to get old behavior allowing "" (!but also need to allow new behavior of allowing null is/passwd so customers can slowly migrate) - //check if "". - - String secureCurrentUser = SystemProperties.getProperty (SystemProperties.JDBC_SECURE_CURRENT_USER); //@pw3 - boolean isSecureCurrentUser = true; //@pw3 - //if system property or jdbc property is set to false then secure current user code is not used - //null value for system property means not specified...so true by default - if(((secureCurrentUser != null) && (Boolean.valueOf(secureCurrentUser).booleanValue() == false)) || !jdProperties.getBoolean(JDProperties.SECURE_CURRENT_USER)) //@pw3 - isSecureCurrentUser = false; //@pw3 - - if(info == null) - info = new Properties(); - String userParm = info.getProperty("user"); //@pw1 - String passwordParm = info.getProperty("password"); //@pw1 - boolean forcePrompt = false; //@prompt - if ("".equals(userName) && "".equals(userParm)) //@pw1 //@pw2 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (AS400JDBCDriver.class, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 //@prompt - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - if ("".equals(password) && "".equals(passwordParm)) //@pw1 //@pw2 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (AS400JDBCDriver.class, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 //@prompt - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - - if(userParm != null) //@pw1 - { //@pw1 - //check for *current //@pw1 - if (userParm.compareToIgnoreCase("*CURRENT") == 0) //@pw1 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (AS400JDBCDriver.class, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - } //@pw1 - else //@pw1 - { //@pw1 - //since info is null, jdProperty must not be "" or *current, but it can be the default value (ie not set by user) - if(userName != JDProperties.EMPTY_) //@pw1 - { //@pw1 - //userName was updated by app - if( userName.equals("") || (userName.compareToIgnoreCase("*CURRENT") == 0)) //@pw1 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (AS400JDBCDriver.class, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - } //@pw1 - } //@pw1 - - if(passwordParm != null) //@pw1 - { //@pw1 - if (passwordParm.compareToIgnoreCase("*CURRENT") == 0) //@pw1 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (AS400JDBCDriver.class, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - } //@pw1 - else //@pw1 - { //@pw1 - //since info is null, jdProperty must not be "" or *current, but it can be the default value (ie not set by user) - if(password != JDProperties.EMPTY_) //@pw1 - { //@pw1 - //password was updated by app - if( password.equals("") || (password.compareToIgnoreCase("*CURRENT") == 0)) //@pw1 - { //@pw1 - if(isSecureCurrentUser)//@pw3 - { //@pw3 - if (JDTrace.isTraceOn()) //jdbc category trace //@pw1 - JDTrace.logInformation (AS400JDBCDriver.class, "Userid/password cannot be \"\" or *CURRENT due to security constraints. Use null instead"); //@pw1 - //JDError.throwSQLException(JDError.EXC_CONNECTION_REJECTED); //@pw1 - forcePrompt = true; //@prompt - } //@pw3 - } //@pw1 - } //@pw1 - } //@pw1 - - - // Create the AS400 object, so we can create a Connection via loadImpl2. - AS400 as400 = null; - if (secure) - { - if (serverName.length() == 0) - as400 = new SecureAS400 (); - else if (userName.length() == 0) - as400 = new SecureAS400 (serverName); - else if (password.length() == 0) - as400 = new SecureAS400 (serverName, userName); - else - as400 = new SecureAS400 (serverName, userName, password); - if (keyRingName != null && keyRingPassword != null && !keyRingName.equals("")) //@B9A @C1C - { - try - { //@B9A - ((SecureAS400)as400).setKeyRingName(keyRingName, keyRingPassword); //@B9A - } //@B9A - catch (PropertyVetoException pve) //@B9A - { /*Will never happen*/ - } //@B9A - } //@B9A - } - else - { - if (serverName.length() == 0) - as400 = new AS400 (); - else if (userName.length() == 0) - as400 = new AS400 (serverName); - else if (password.length() == 0) - as400 = new AS400 (serverName, userName); - else - as400 = new AS400 (serverName, userName, password); - } - - // Determine when the signon GUI can be presented.. - try - { - if (!prompt.equals(JDProperties.NOT_SPECIFIED)) // @B8A - as400.setGuiAvailable(jdProperties.getBoolean(JDProperties.PROMPT)); // @B8C - } - catch (java.beans.PropertyVetoException e) - { - // This will never happen, as there are no listeners. - } - - //Determine if threads should be used in communication with the host servers - try{ - if(!useThreads) - as400.setThreadUsed(useThreads); - } - catch(java.beans.PropertyVetoException e){ - } - if(forcePrompt) //@prompt - as400.forcePrompt(); //@prompt - return as400; - } - - - //@A0A - This logic was formerly in the AS400JDBCConnection ctor and open() method. - private Connection initializeConnection (JDDataSourceURL dataSourceUrl, - JDProperties jdProperties, - Properties info) - throws SQLException - { - //@B7D Connection connection = null; - AS400 as400 = null; - boolean proxyServerWasSpecifiedInUrl = false; - boolean proxyServerWasSpecifiedInProperties = false; - boolean proxyServerWasSpecified = false; - - //@C4A Check for native driver only if driver property is not set to Toolbox - String driverImplementation = jdProperties.getString(JDProperties.DRIVER); //@C4M - if (!driverImplementation.equals(JDProperties.DRIVER_TOOLBOX)) //@C4A - { //@C4A - // @B2A - // Determine whether the native driver is available. - Driver nativeDriver; - try - { - nativeDriver = (Driver)Class.forName("com.ibm.db2.jdbc.app.DB2Driver").newInstance(); - if (JDTrace.isTraceOn()) // @C2A - JDTrace.logInformation(this, "Native IBM Developer Kit for Java JDBC driver implementation was loaded"); // @C2A - } - catch (Throwable e) - { - nativeDriver = null; - } - - // @B2A - // Decide which JDBC driver implementation to use. If the - // native driver is available AND there is no secondary URL - // available AND the "driver" property was not set to "toolbox", - // then use the native driver implementation. - //@C4M String driverImplementation = jdProperties.getString(JDProperties.DRIVER); - if ((nativeDriver != null) - && (dataSourceUrl.getSecondaryURL().length() == 0)) - //@C4D Already checked above && (!driverImplementation.equals(JDProperties.DRIVER_TOOLBOX))) - { - //@C3M - boolean isLocal = false; // @C2A - String serverName = dataSourceUrl.getServerName(); // @C2A - if (serverName.length() == 0 || serverName.equalsIgnoreCase("localhost")) // @C2A //@locala - isLocal = true; // @C2A - else { // @C2A - try { // @C2A - InetAddress localInet = InetAddress.getLocalHost(); // @C2A - InetAddress[] remoteInet = InetAddress.getAllByName(serverName); // @C2A - for (int i = 0; i < remoteInet.length; ++i) { // @C2A - if (localInet.equals(remoteInet[i])) { // @C2A - isLocal = true; // @C2A - } // @C2A - } // @C2A - } // @C2A - catch (Throwable e) { // @C2A - // Ignore. We will just assume that we are not local. @C2A - } // @C2A - } - - if (isLocal) { // @C2A - if (JDTrace.isTraceOn()) // @C2A - JDTrace.logInformation(this, "Connection is local"); // @C2A - String nativeURL = dataSourceUrl.getNativeURL(); - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Using native IBM Developer Kit for Java JDBC driver implementation");//@native don't print passwd - return nativeDriver.connect(nativeURL, info); - } // @C2A - } - }//@C4A - // @C2D else - // @C2D { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Using IBM Toolbox for Java JDBC driver implementation"); - // @C2D } - - // @A0A - // See if a proxy server was specified. - //if (jdProperties.getIndex (JDProperties.PROXY_SERVER) != -1) //@A3D - if (jdProperties.getString(JDProperties.PROXY_SERVER).length() != 0) //@A3C - proxyServerWasSpecifiedInUrl = true; - if (SystemProperties.getProperty (SystemProperties.AS400_PROXY_SERVER) != null) - proxyServerWasSpecifiedInProperties = true; - if (proxyServerWasSpecifiedInUrl || proxyServerWasSpecifiedInProperties) - proxyServerWasSpecified = true; - - // If no proxy server was specified, and there is a secondary URL, - // simply pass the secondary URL to the DriverManager and ask it for - // an appropriate Connection object. - if (!proxyServerWasSpecified) - { - String secondaryUrl = dataSourceUrl.getSecondaryURL (); - if (secondaryUrl.length() != 0) - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, - "Secondary URL [" + secondaryUrl + "]"); - return DriverManager.getConnection (secondaryUrl, info); - } - } - - as400 = initializeAS400(dataSourceUrl, jdProperties, info); // @B3C - - if (proxyServerWasSpecifiedInUrl) - { - // A proxy server was specified in URL, - // so we need to inform the AS400 object. - - //boolean proxyServerSecure = jdProperties.getBoolean (JDProperties.PROXY_SERVER_SECURE); // TBD - String proxyServerNameAndPort = jdProperties.getString (JDProperties.PROXY_SERVER); - // Note: The PROXY_SERVER property is of the form: - // hostName[:portNumber] - // where portNumber is optional. - try - { - as400.setProxyServer (proxyServerNameAndPort); - //as400.setProxyServerSecure (proxyServerSecure); // TBD - } - catch (java.beans.PropertyVetoException e) - { - } // Will never happen. - } - - //@B6C Moved common code to prepareConnection. - return prepareConnection(as400, dataSourceUrl, info, jdProperties); - } - - - //@B5A - private Connection initializeConnection (AS400 as400) - throws SQLException - { - JDDataSourceURL dataSourceUrl = new JDDataSourceURL(null); - Properties info = new Properties(); - JDProperties jdProperties = new JDProperties(null, info); - - //@B6C Moved common code to prepareConnection. - return prepareConnection(as400, dataSourceUrl, info, jdProperties); - } - - - //@B5A - private Connection initializeConnection (String schema, Properties info, AS400 as400) - throws SQLException - { - boolean proxyServerWasSpecifiedInUrl = false; - - String url = null; - if (schema != null) //@B6A - url = "jdbc:as400://" + as400.getSystemName() + "/" + schema; - else //@B6A - url = "jdbc:as400://" + as400.getSystemName(); //@B6A - JDDataSourceURL dataSourceUrl = new JDDataSourceURL(url); - - JDProperties jdProperties = new JDProperties(null, info); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Using IBM Toolbox for Java JDBC driver implementation"); - - // See if a proxy server was specified. - if (jdProperties.getString(JDProperties.PROXY_SERVER).length() != 0) - proxyServerWasSpecifiedInUrl = true; - - if (proxyServerWasSpecifiedInUrl) - { - // A proxy server was specified in URL, so we need to inform the AS400 object. - - //boolean proxyServerSecure = jdProperties.getBoolean (JDProperties.PROXY_SERVER_SECURE);// TBD - String proxyServerNameAndPort = jdProperties.getString (JDProperties.PROXY_SERVER); - // Note: The PROXY_SERVER property is of the form: - // hostName[:portNumber] - // where portNumber is optional. - try - { - as400.setProxyServer (proxyServerNameAndPort); - //as400.setProxyServerSecure (proxyServerSecure); // TBD - } - catch (java.beans.PropertyVetoException e) - { - } // Will never happen. - } - - //@B6C Moved common code to prepareConnection. - return prepareConnection(as400, dataSourceUrl, info, jdProperties); - } - - - /** - Indicates if the driver is a genuine JDBC compliant driver. - - @return Always true. - **/ - public boolean jdbcCompliant () - { - return true; - } - - - //@B6A -- This logic was formerly in the initializeConnection() method. - private Connection prepareConnection(AS400 as400, JDDataSourceURL dataSourceUrl, - Properties info, JDProperties jdProperties) - throws SQLException - { - - // set socket properties - SocketProperties sockProps = null; - - //if == "", then take platform defaults...do not set - //only get/set properties is one is updated - if( jdProperties.getString(JDProperties.KEEP_ALIVE).equals("") == false) - { - if(sockProps == null) - sockProps = as400.getSocketProperties(); - sockProps.setKeepAlive(jdProperties.getBoolean(JDProperties.KEEP_ALIVE)); - } - if( jdProperties.getString(JDProperties.RECEIVE_BUFFER_SIZE).equals("") == false) - { - if(sockProps == null) - sockProps = as400.getSocketProperties(); - sockProps.setReceiveBufferSize( jdProperties.getInt(JDProperties.RECEIVE_BUFFER_SIZE)); - } - if( jdProperties.getString(JDProperties.SEND_BUFFER_SIZE).equals("") == false) - { - if(sockProps == null) - sockProps = as400.getSocketProperties(); - sockProps.setSendBufferSize(jdProperties.getInt(JDProperties.SEND_BUFFER_SIZE)); - } - - //@timeout2 - //First get setting from DriverManager, then override with property updates - if(!as400.arePropertiesFrozen()) //@timeout3 AS400JDBCDriver.connect(clone=false) cannot update props. We don't know if DriverManager.setLoginTimeout() has been updated. - { - if(sockProps == null) - sockProps = as400.getSocketProperties(); - sockProps.setLoginTimeout(DriverManager.getLoginTimeout() * 1000); //@STIMEOUT - } - - //@timeout - if( jdProperties.getString(JDProperties.LOGIN_TIMEOUT).equals("") == false) - { - if(sockProps == null) - sockProps = as400.getSocketProperties(); - sockProps.setLoginTimeout(jdProperties.getInt(JDProperties.LOGIN_TIMEOUT) * 1000); //@STIMEOUT - } - - //@STIMEOUT - if( jdProperties.getString(JDProperties.SOCKET_TIMEOUT).equals("") == false) - { - if(sockProps == null) - sockProps = as400.getSocketProperties(); - sockProps.setSoTimeout(jdProperties.getInt(JDProperties.SOCKET_TIMEOUT)); //@STIMEOUT already in milliseconds - } - - - if(sockProps != null) - as400.setSocketProperties(sockProps); - - // Create the appropriate kind of Connection object. - Connection connection = (Connection) as400.loadImpl2 ( - "com.ibm.as400.access.AS400JDBCConnection", - "com.ibm.as400.access.JDConnectionProxy"); - - // Set the properties on the Connection object. - if (connection != null) - { - - // @A2D Class[] argClasses = new Class[] { JDDataSourceURL.class, - // @A2D JDProperties.class, - // @A2D AS400.class }; - // @A2D Object[] argValues = new Object[] { dataSourceUrl, - // @A2D jdProperties, - // @A2D as400 }; - // @A2D try { - // Hand off the public AS400 object to keep it from getting - // garbage-collected. - Class clazz = connection.getClass (); - // @A2D Method method = clazz.getDeclaredMethod ("setSystem", - // @A2D new Class[] { AS400.class }); - // @A2D method.invoke (connection, new Object[] { as400 }); - - // @A2D method = clazz.getDeclaredMethod ("setProperties", argClasses); - // @A2D method.invoke (connection, argValues); - - String className = clazz.getName(); - if (className.equals("com.ibm.as400.access.AS400JDBCConnection")) - { - ((AS400JDBCConnection)connection).setSystem(as400); - ((AS400JDBCConnection)connection).setProperties(dataSourceUrl, jdProperties, as400); - } - else if (className.equals("com.ibm.as400.access.JDConnectionProxy")) - { - ((JDConnectionProxy)connection).setSystem(as400); - ((JDConnectionProxy)connection).setProperties(dataSourceUrl, jdProperties, as400); - } - // @A2D } - // @A2D catch (NoSuchMethodException e) { - // @A2D JDTrace.logInformation (this, - // @A2D "Could not resolve setProperties() method"); - // @A2D throw new InternalErrorException (InternalErrorException.UNEXPECTED_EXCEPTION); - // @A2D } - // @A2D catch (IllegalAccessException e) { - // @A2D JDTrace.logInformation (this, - // @A2D "Could not access setProperties() method"); - // @A2D throw new InternalErrorException (InternalErrorException.UNEXPECTED_EXCEPTION); - // @A2D } - // @A2D catch (InvocationTargetException e) { - // @A2D Throwable e2 = e.getTargetException (); - // @A2D if (e2 instanceof SQLException) - // @A2D throw (SQLException) e2; - // @A2D else if (e2 instanceof RuntimeException) - // @A2D throw (RuntimeException) e2; - // @A2D else if (e2 instanceof Error) - // @A2D throw (Error) e2; - // @A2D else { - // @A2D JDTrace.logInformation (this, - // @A2D "Could not invoke setProperties() method"); - // @A2D throw new InternalErrorException (InternalErrorException.UNEXPECTED_EXCEPTION); - // @A2D } - // @A2D } - } - return connection; - } - - - - - /** - Returns the name of the driver. - - @return The driver name. - **/ - public String toString () - { - return DRIVER_NAME_; // @D0C - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCInputStream.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCInputStream.java deleted file mode 100644 index 17cbc7470..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCInputStream.java +++ /dev/null @@ -1,357 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCInputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.IOException; -/* ifdef JDBC40 -import java.sql.DriverManager; -endif */ -import java.sql.SQLException; - - - -/** -

        The AS400JDBCInputStream class provides access to binary data -using an input stream. The data is valid only within the current -transaction. -**/ -// -// Implementation notes: -// -// 1. This implementation deals specifically with binary data -// that is retrieved upon request with the locator handle. -// The case where the binary data comes in full with the result -// set can be stored directly in a ByteArrayInputStream. -// -// 2. We do not worry about buffering or caching, since the caller -// can just wrap this in a BufferedInputStream if they want that. -// -class AS400JDBCInputStream extends InputStream -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - private boolean closed_; - private JDLobLocator locator_; - private long offset_; - private long length_; //@pda jdbc40 - - private long mark_ = 0; - -/** -Constructs an AS400JDBCInputStream object. The data for the -binary stream will be retrieved as requested, directly from the -system, using the locator handle. - -@param locator The locator. -**/ - AS400JDBCInputStream(JDLobLocator locator) - { - locator_ = locator; - offset_ = 0; - closed_ = false; - try //@pda jdbc40 set length (for sub-streams) - { - length_ = locator.getLength(); - }catch(SQLException e) - { - length_ = 0; - closed_ = true; - } - - } - - //@pda jdbc40 new constructor - /** - Constructs an AS400JDBCInputStream object. The data for the - binary stream will be retrieved as requested, directly from the - system, using the locator handle. - - @param locator The locator. - @param pos The starting position. - @param length The length of the stream. - **/ - AS400JDBCInputStream(JDLobLocator locator, long pos, long length) - { - locator_ = locator; - offset_ = pos; - length_ = length; - closed_ = false; - long actualLen; - try - { - actualLen = locator.getLength(); - - }catch(SQLException e) - { - actualLen = 0; - closed_ = true; - } - if(length_ > actualLen) - length_ = actualLen; - } - -/** -Returns the number of bytes that can be read without blocking. - -@return The number of bytes that can be read without blocking. - -@exception IOException If an input/output error occurs. -**/ - public synchronized int available() throws IOException - { - if (closed_) throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - - long returnValue = 0; - // try //@PDd jdbc40 - // { //@PDd jdbc40 - returnValue = length_ - offset_; //@PDC jdbc40 - - if (returnValue < 0) returnValue = 0; - // } //@PDd jdbc40 - // catch (SQLException e) //@PDd jdbc40 - // { //@PDd jdbc40 - // if (JDTrace.isTraceOn()) //@PDd jdbc40 - // { //@PDd jdbc40 - // JDTrace.logInformation(this, "Error in available"); //@PDd jdbc40 - // e.printStackTrace(DriverManager.getLogStream()); //@PDd jdbc40 - // closed_ = true; //@PDd jdbc40 - // } //@PDd jdbc40 - // throw new IOException(e.getMessage()); //@PDd jdbc40 - // } //@PDd jdbc40 - - if (returnValue > 0x7FFFFFFF) returnValue = 0x7FFFFFFF; - - return(int)returnValue; - } - - - -/** -Closes the stream and releases any associated system resources. - -@exception IOException If an input/output error occurs. -**/ - public synchronized void close() throws IOException - { - closed_ = true; - } - - - -/** -Marks the current position in the stream. - -@param readLimit The read limit. -@see #reset() -**/ - public void mark(int readLimit) - { - mark_ = offset_; - } - - - -/** -Indicates if mark() and reset() are supported. - -@return true -**/ - public boolean markSupported() - { - return true; - } - - - -/** -Reads the next byte of data. This method blocks until data is -available, the end of the stream is detected, or an exception -is thrown. - -@return The next byte of data as an int in the range 0 to 255, - or -1 if no more data is available. - -@exception IOException If an input/output error occurs. -**/ - public synchronized int read() throws IOException - { - int returnValue = -1; - - byte[] data = new byte[1]; // Yes, we allocate each time, but the user shouldn't be calling this method if they want performance to be good. - if (read(data, 0, 1) > 0) returnValue = data[0] & 0x00FF; - - return returnValue; - } - - - -/** -Reads bytes of data. This method blocks until -data is available, the end of the stream is detected, or an -exception is thrown. - -@param data The byte array to fill with data. This method - will read as much data as possible to fill - the array. -@return The number of bytes of data read, - or -1 if no more data is available. - -@exception IOException If an input/output error occurs. -**/ - public synchronized int read(byte[] data) throws IOException - { - return read(data, 0, data.length); - } - - - -/** -Reads bytes of data. This method blocks until -data is available, the end of the stream is detected, or an -exception is thrown. - -@param data The byte array to fill with data. This method - will read as much data as possible to fill - the array. All data may not be available to - read from the stream at once, only when this - method returns -1 can you be sure all of the - data was read. -@param start The start position in the array. -@param length The maximum number of bytes to read. -@return The number of bytes of data read, - or -1 if no more data is available. - -@exception IOException If an input/output error occurs. -**/ - public synchronized int read(byte[] data, int start, int length) throws IOException - { - if (data == null) throw new NullPointerException("data"); - - if (closed_) throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - - if ((start < 0) || (start > data.length)) - { - throw new ExtendedIllegalArgumentException("start", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if ((length < 0) || (start + length > data.length))//@pdc locator_.retrieveData(,len) does not fail if len is greater that available length - { - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Added this to prevent trying to read past the end of the stream. - if (length == 0) - { - return 0; - } - - try - { - if (offset_ >= length_) //@PDC jdbc40 - { - //@CRS - Is this really the end? Or is the end getMaxLength()? - return -1; - } - - //@CRS: Can lengthRead ever be greater than length? - if (locator_.isGraphic()) length = length / 2; - DBLobData lobData = locator_.retrieveData(offset_, length); - int lengthRead = lobData.getLength(); - if (lengthRead == 0) - { - closed_ = true; - return -1; - } - else - { - System.arraycopy(lobData.getRawBytes(), lobData.getOffset(), data, start, lengthRead); - offset_ += locator_.isGraphic() ? lengthRead / 2: lengthRead; - return lengthRead; - } - } - catch (SQLException e) - { - if (JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "Error in read" + e.getMessage()); //@pdc - //@pdd e.printStackTrace(DriverManager.getLogStream()); - closed_ = true; - } - throw new IOException(e.getMessage()); - } - } - - - -/** -Repositions to the marked position. -If mark() has not been called, repositions to the beginning of the stream. - -@exception IOException If an input/output error occurs. -@see #mark(int) -**/ - public void reset() throws IOException - { - offset_ = mark_; - } - - -/** -Skips over and discards data. - -@param length The maximum number of bytes to skip. If negative, - no bytes are skipped. -@return The number of bytes skipped. - -@exception IOException If an input/output error occurs. -**/ - public synchronized long skip(long length) throws IOException - { - if (closed_) - { - throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - } - if (length < 0) - { - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (length == 0) return 0; - //try //@PDD jdbc40 - //{ //@PDD jdbc40 - long newOffset = length + offset_; - long len = length_; //@PDC jdbc40 - - if (newOffset > len) - { - length = len - offset_; - offset_ = len; - } - else - { - offset_ = offset_ + length; - } - return length; - //} //@PDD jdbc40 - //catch (SQLException e) //@PDD jdbc40 - //{ //@PDD jdbc40 - // if (JDTrace.isTraceOn()) //@PDD jdbc40 - // { //@PDD jdbc40 - // JDTrace.logInformation(this, "Error in skip"); //@PDD jdbc40 - // e.printStackTrace(DriverManager.getLogStream()); //@PDD jdbc40 - // } //@PDD jdbc40 - // closed_ = true; //@PDD jdbc40 - // throw new IOException(e.getMessage()); //@PDD jdbc40 - //} //@PDD jdbc40 - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCManagedConnectionPoolDataSource.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCManagedConnectionPoolDataSource.java deleted file mode 100644 index cc22ab707..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCManagedConnectionPoolDataSource.java +++ /dev/null @@ -1,636 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCManagedConnectionPoolDataSource.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2005-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.sql.Connection; -import java.sql.SQLException; -import javax.naming.*; -import javax.sql.ConnectionPoolDataSource; -import javax.sql.PooledConnection; - - -/** - This implementation of javax.sql.ConnectionPoolDataSource can be used in conjunction with {@link AS400JDBCManagedDataSource AS400JDBCManagedDataSource} to produce PooledConnection objects ({@link AS400JDBCPooledConnection AS400JDBCPooledConnection}) that are managed by the Toolbox's built-in connection pooling manager. -

        - A ConnectionPoolDataSource is a factory for PooledConnection objects. - An object that implements the ConnectionPoolDataSource interface will typically be registered with a naming service that is based on the Java Naming and Directory Interface (JNDI). -

        - The operations on a ConnectionPoolDataSource class are completely internal to a driver implementation; the ConnectionPoolDataSource interface is not part of the API typically used by Java application programmers. Driver vendors use it in their implementation of connection pooling. Application programmers specify a DataSource class in their code to get a connection. However, since users/database administrators must register the corresponding ConnectionPoolDataSource with JNDI, the class needs to be public. Users must be able to call the different getters/setters to set up their connection pooling environment when they register the ConnectionPoolDataSource. Drivers then provide DataSource classes that implement javax.sql.DataSource, and the user will use this data source in their code. -

        - Design note: This class extends AS400JDBCManagedDataSource, solely in order to exploit shared implementation. This class should not be used as a "kind of" AS400JDBCManagedDataSource. -

        - Caution: To avoid the pitfalls of "double-managed" pools, do not use this class in conjunction with a separate connection pool manager, such as that available in WebSphere. When a separate pool manager is provided, use {@link AS400JDBCConnectionPoolDataSource AS400JDBCConnectionPoolDataSource} instead. - - @see AS400JDBCDataSource - @see AS400JDBCConnectionPoolDataSource - @see AS400JDBCXADataSource - **/ -public class AS400JDBCManagedConnectionPoolDataSource extends AS400JDBCManagedDataSource implements ConnectionPoolDataSource, Referenceable, Serializable -{ - static final long serialVersionUID = 1L; - - // Note to developer: If you add a new property (that's not also in the superclass), remember to add a clause for the property to both the getReference() method and the constructor that takes a Reference argument. - - // Note: - // There are three kinds of data sources: - // 1. Basic DataSource (javax.sql.DataSource). Provides a getConnection() method that returns an instance of java.sql.Connection. - // 2. Data source class implemented to provide connection pooling (javax.sql.ConnectionPoolDataSource). Provides a getPooledConnection() method that returns an instance of javax.sql.PooledConnection. - // 3. Data Source class implemented to provide distributed transactions (javax.sql.XADataSource). Provides a getXAConnection() method that returns an instance of javax.sql.XAConnection. - - // Note: - // Refer to pages 570 - 574 of the JDBC Tutorial. The book does say that a DataSource implementation that supports distributed transactions is almost always implemented to support connection pooling as well (most likely why there is a UDBXADataSource on the native side.) I'll leave it up to you whether or not you want to do an XA version with connection pooling. We definitely need the ConnectionPoolDataSource version though, as that is what the line item is for. - - // Note: (From comments in UDBConnectionPoolDataSource) - // - // "ConnectionPoolDataSource does not extend DataSource and it is not a superset of the functionality of the DataSource. It exists to provide pooling functionality to the DataSource user interface. Therefore, the ConnectionPoolDataSource requires a DataSource in order to do action connection work." - - - // Standard JDBC connection pool properties. (See JDBC Tutorial p. 442, table 14.1) - // Following are the standard properties that a ConnectionPoolDataSource implementation may set for a PooledConnection object. An application never uses these properties directly. An application server that is managing the pool of PooledConnection objects uses these properties to determine how to manage the pool. - - // For consistency, all time-related properties in this class are stored as milliseconds. - // Note that all xxxPoolSize_ variables refer to the total number of connections ('active', 'available', and 'condemned'), not just available connections. - - private int initialPoolSize_ = 5;// The # of physical connections the pool should contain - // when it is created. - private int minPoolSize_ = 0; // The minimum # of physical connections in the pool. - private int maxPoolSize_ = 0; // The maximum # of physical connections the pool should contain. - // 0 (zero) indicates no maximum size. - private long maxIdleTime_ = 3600*1000; - // The # of msecs that a physical connection should remain - // unused in the pool before it is closed; that is, when the - // connection is considered "stale". - // 0 (zero) indicates no time limit. - // See JDBC Tutorial, p. 643, 2nd paragraph. - // Default is 1 hour. - private long propertyCycle_ = 300*1000; - // The interval, in msecs, that the pool should wait before - // enforcing the policy defined by the values currently assigned - // to these connection pool properties. - // Default is 5 minutes. - // maxStatements_; // The total # of statements the pool should keep open. - // 0 (zero) indicates that the caching of statements is disabled. - // Note: This implementation doesn't cache prepared statements. - - - -// Additional connection pool properties. - - private long maxLifetime_ = 86400*1000; - // The # of msecs that a physical connection should - // remain in the pool before it is closed; that is, when the - // connection is considered "expired". - // 0 (zero) indicates no time limit. - // Default is 24 hours. - - private boolean reuseConnections_ = true; // Re-use connections that have been returned to pool. - - private boolean pretestConnections_ = false; // Pretest connections before allocating them to requesters. - private boolean enforceMaxPoolSize_ = false; // Strictly enforce the pool size limit (maxPoolSize_). - - - - /** - Constructs a default AS400JDBCManagedConnectionPoolDataSource object. - **/ - public AS400JDBCManagedConnectionPoolDataSource() - { - super(); - } - - /** - Constructs an AS400JDBCManagedConnectionPoolDataSource with the specified serverName. - @param serverName The IBM i system name. - **/ - public AS400JDBCManagedConnectionPoolDataSource(String serverName) - { - super(serverName); - } - - /** - Constructs an AS400JDBCManagedConnectionPoolDataSource with the specified signon information. - @param serverName The IBM i system name. - @param user The user id. - @param password The password. - **/ - public AS400JDBCManagedConnectionPoolDataSource(String serverName, String user, String password) - { - super(serverName, user, password); - } - - - // Note: We do not provide a constructor that takes an AS400 object, - // because we need to capture the password so we can use it as part of the pool key. - - - /** - Constructs an AS400JDBCManagedConnectionPoolDataSource with the specified signon information - to use for SSL communications with the IBM i system. - @param serverName The IBM i system name. - @param user The user id. - @param password The password. - @param keyRingName The key ring class name to be used for SSL communications with the system. - @param keyRingPassword The password for the key ring class to be used for SSL communications with the system. - **/ - public AS400JDBCManagedConnectionPoolDataSource(String serverName, String user, String password, - String keyRingName, String keyRingPassword) - { - super(serverName, user, password, keyRingName, keyRingPassword); - } - - /** - Constructs an AS400JDBCManagedConnectionPoolDataSource from the specified Reference - @param reference reference to retrieve DataSource properties from - **/ - AS400JDBCManagedConnectionPoolDataSource(Reference reference) - { - super(reference); - - RefAddr refAddr; - - refAddr = reference.get("enforceMaxPoolSize"); - if (refAddr != null) - setEnforceMaxPoolSize(Boolean.valueOf((String)refAddr.getContent()).booleanValue()); - - refAddr = reference.get("initialPoolSize"); - if (refAddr != null) - setInitialPoolSize(Integer.parseInt((String)refAddr.getContent())); - - refAddr = reference.get("maxLifetime"); - if (refAddr != null) - setMaxLifetime(Integer.parseInt((String)refAddr.getContent())); - - refAddr = reference.get("minPoolSize"); - if (refAddr != null) - setMinPoolSize(Integer.parseInt((String)refAddr.getContent())); - - refAddr = reference.get("maxPoolSize"); - if (refAddr != null) - setMaxPoolSize(Integer.parseInt((String)refAddr.getContent())); - - refAddr = reference.get("maxIdleTime"); - if (refAddr != null) - setMaxIdleTime(Integer.parseInt((String)refAddr.getContent())); - - refAddr = reference.get("pretestConnections"); - if (refAddr != null) - setPretestConnections(Boolean.valueOf((String)refAddr.getContent()).booleanValue()); - - refAddr = reference.get("propertyCycle"); - if (refAddr != null) - setPropertyCycle(Integer.parseInt((String)refAddr.getContent())); - - refAddr = reference.get("reuseConnections"); - if (refAddr != null) - setReuseConnections(Boolean.valueOf((String)refAddr.getContent()).booleanValue()); - - // Note: This class does not support the "maxStatements" property. - } - - - /** - Prints a warning and calls the superclass's method. - Users are discouraged from calling this method. - @param logStatistics If true, additional information is logged. - @return true if connection pool exists and appears healthy; false otherwise. - @deprecated Use {@link AS400JDBCManagedDataSource#checkPoolHealth(boolean) checkPoolHealth()} instead. Refer to the class overview for a discussion of the intended role of this class, and the relationship between this class and its superclass. - **/ - public boolean checkPoolHealth(boolean logStatistics) - { - logWarning("AS400JDBCManagedConnectionPoolDataSource.checkPoolHealth() is deprecated"); - return super.checkPoolHealth(logStatistics); - } - - - /** - Prints a warning and calls the superclass's method. - Users are discouraged from calling this method. - @deprecated Use {@link AS400JDBCManagedDataSource#closePool() closePool()} instead. Refer to the class overview for a discussion of the intended role of this class, and the relationship between this class and its superclass. - **/ - public void closePool() - { - logWarning("AS400JDBCManagedConnectionPoolDataSource.closePool() is deprecated"); - super.closePool(); - } - - - /** - Prints a warning and calls the superclass's method. - Users are discouraged from calling this method. - @return The connection. - @throws SQLException If a database error occurs. - @deprecated Use {@link AS400JDBCManagedDataSource#getConnection() getConnection()} instead. Refer to the class overview for a discussion of the intended role of this class, and the relationship between this class and its superclass. - **/ - public Connection getConnection() throws SQLException - { - logWarning("AS400JDBCManagedConnectionPoolDataSource.getConnection() is deprecated"); - return super.getConnection(); - } - - /** - Prints a warning and calls the superclass's method. - Users are discouraged from calling this method. - @param user The database user. - @param password The database password. - @return The connection - @throws SQLException If a database error occurs. - @deprecated Use {@link AS400JDBCManagedDataSource#getConnection(String,String) getConnection()} instead. Refer to the class overview for a discussion of the intended role of this class, and the relationship between this class and its superclass. - **/ - public Connection getConnection(String user, String password) throws SQLException - { - logWarning("AS400JDBCManagedConnectionPoolDataSource.getConnection() is deprecated"); - return super.getConnection(user, password); - } - - - /** - Returns the number of physical connections the connection pool should contain when it is created. - @return The initial number of pooled connections. The default value is 5. - **/ - public int getInitialPoolSize() - { - return initialPoolSize_; - } - - - /** - Returns the amount of time (in seconds) after which an available pooled - physical connection is considered "stale" and should be closed. - A value of 0 indicates pooled connections are never automatically closed. - @return The maximum idle time for a pooled connection, in seconds. - The default value is 1 hour. - **/ - public int getMaxIdleTime() - { - return (int)(maxIdleTime_/1000); // stored internally as milliseconds - - // Design note: In general we prefer to express "duration" values in milliseconds, - // but the JDBC Tutorial and Reference shows this property in seconds (int). - } - - /** - Returns the maximum amount of time (in seconds) after which a - physical connection is considered to be expired and should be closed. - A value of 0 indicates in-use connections - are never automatically closed. - @return The maximum lifetime for an in-use connection, in seconds. - The default value is 24 hours. - **/ - public int getMaxLifetime() - { - return (int)(maxLifetime_/1000); // stored internally as milliseconds - - // Design note: In general we prefer to express "duration" values in milliseconds, - // but the JDBC Tutorial and Reference shows this property in seconds (int). - } - - /** - Returns the maximum number of physical connections that the connection pool - contains. A value of 0 indicates there is no maximum. - @return The maximum number of connections in the pool. The default - value is 0 (no maximum). - **/ - public int getMaxPoolSize() - { - return maxPoolSize_; - } - - - /** - Returns the minimum number of physical connections that the connection pool - contains. A value of 0 indicates there is no minimum and connections - are created as they are needed. - @return The minimum number of available connections in the pool. The - default value is 0. - **/ - public int getMinPoolSize() - { - return minPoolSize_; - } - - - // method required by javax.sql.ConnectionPoolDataSource - /** - Returns a pooled connection that is connected to the IBM i system. - @return A pooled connection. - @throws SQLException If a database error occurs. - **/ - public PooledConnection getPooledConnection() throws SQLException - { - PooledConnection pc = new AS400JDBCPooledConnection(createPhysicalConnection()); - if (JDTrace.isTraceOn() || log_ != null) logInformation("PooledConnection created"); - - return pc; - } - - // method required by javax.sql.ConnectionPoolDataSource - /** - Returns a pooled connection that is connected to the IBM i system. - @param user The userid for the connection. - @param password The password for the connection. - @return A pooled connection. - @throws SQLException If a database error occurs. - **/ - public PooledConnection getPooledConnection(String user, String password) throws SQLException - { - PooledConnection pc = new AS400JDBCPooledConnection(createPhysicalConnection(user,password)); - if (JDTrace.isTraceOn() || log_ != null) logInformation("PooledConnection created for user " + user); - - return pc; - } - - - /** - Returns the interval (in seconds) between runs of the connection pool's - maintenance thread. The maintenance thread enforces this pool's - connections and statements so that they conform to the specified - minimum and maximum pool sizes, idle time, and maximum number of - open statements. - @return The number of seconds that this pool should wait before enforcing - its properties. The default value is 5 minutes. - **/ - public int getPropertyCycle() - { - return (int)(propertyCycle_/1000); // stored internally as milliseconds - - // Design note: In general we prefer to express "duration" values in milliseconds, - // but the JDBC Tutorial and Reference shows this property in seconds (int). - } - - - // method required by javax.naming.Referenceable - /** - Returns a Reference object for the data source object. - This is used by JNDI when bound in a JNDI naming service. - Contains the information necessary to reconstruct the data source - object when it is later retrieved from JNDI via an object factory. - * - @return A Reference object for the data source object. - @throws NamingException If a naming error occurs resolving the object. - **/ - public Reference getReference() throws NamingException - { - Reference ref = new Reference(this.getClass().getName(), - "com.ibm.as400.access.AS400JDBCObjectFactory", - null); - - ref.add(new StringRefAddr("enforceMaxPoolSize", String.valueOf(isEnforceMaxPoolSize()))); - ref.add(new StringRefAddr("initialPoolSize", String.valueOf(getInitialPoolSize()))); - ref.add(new StringRefAddr("maxLifetime", String.valueOf(getMaxLifetime()))); - ref.add(new StringRefAddr("minPoolSize", String.valueOf(getMinPoolSize()))); - ref.add(new StringRefAddr("maxPoolSize", String.valueOf(getMaxPoolSize()))); - ref.add(new StringRefAddr("maxIdleTime", String.valueOf(getMaxIdleTime()))); - ref.add(new StringRefAddr("pretestConnections", String.valueOf(isPretestConnections()))); - ref.add(new StringRefAddr("propertyCycle", String.valueOf(getPropertyCycle()))); - ref.add(new StringRefAddr("reuseConnections", String.valueOf(isReuseConnections()))); - // Note: This class does not support the 'maxStatements' property. - - // Add the properties from the associated AS400JDBCManagedDataSource. - Reference dsRef = super.getReference(); - for (int i=0; ifalse. - **/ - public boolean isPretestConnections() - { - return pretestConnections_; - } - - /** - Indicates whether connections are re-used after being returned to the connection pool. - @return true if connections may be reused; false if connections are closed after they are returned to the pool. - The default value is true. - **/ - public boolean isReuseConnections() - { - return reuseConnections_; - } - - - /** - Deserializes and initializes transient data. - **/ - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - } - - /** - Sets whether pool size restriction should be strictly enforced. - If set to true, and a connection is requested from a full pool with no available connections, - then an exception will be thrown. - If set to false, then a warning will be traced, and a new (unpooled) physical connection will be returned. - @param enforce If true, then the pool size restriction should be strictly enforced. - The default value is false. - @see #setMaxPoolSize - **/ - public void setEnforceMaxPoolSize(boolean enforce) - { - enforceMaxPoolSize_ = enforce; - logProperty("enforceMaxPoolSize", String.valueOf(enforceMaxPoolSize_)); - } - - - /** - Sets the number of connections that the connection pool contains when it is created. - If the pool has already been created, this method has no effect. - @param initialPoolSize The number of pooled connections. Valid values - are 0 or greater. The default value is 5. - **/ - public void setInitialPoolSize(int initialPoolSize) - { - final String property = "initialPoolSize"; - if (initialPoolSize < 0) - { - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - initialPoolSize_ = initialPoolSize; - logProperty(property, Integer.toString(initialPoolSize_)); - } - - /** - Sets the maximum amount of time (in seconds) that a pooled - connection in this pool is allowed to remain idle before it is - automatically closed. A value of 0 indicates pooled connections - are never automatically closed. - @param maxIdleTime The maximum idle time for a pooled connection, in seconds. - Valid values are 0 or greater. - The default value is 1 hour. - **/ - public void setMaxIdleTime(int maxIdleTime) - { - final String property = "maxIdleTime"; - if (maxIdleTime < 0) - { - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - maxIdleTime_ = maxIdleTime*1000; // store internally as milliseconds - logProperty(property, Integer.toString(maxIdleTime)); - - // Design note: In general we prefer to express "duration" values in milliseconds, - // but the JDBC Tutorial and Reference shows this property in seconds (int). - } - - - /** - Sets the maximum amount of time (in seconds) after which an - in-use physical connection is considered to be expired and should be closed. - A value of 0 indicates in-use connections are never automatically closed. - @param maxLifetime The maximum lifetime for an in-use connection, in seconds. - Valid values are 0 or greater. - The default value is 24 hours. - **/ - public void setMaxLifetime(int maxLifetime) - { - final String property = "maxLifetime"; - if (maxLifetime < 0) - { - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - maxLifetime_ = maxLifetime*1000; // store internally as milliseconds - logProperty(property, Integer.toString(maxLifetime)); - - // Design note: In general we prefer to express "duration" values in milliseconds, - // but the JDBC Tutorial and Reference shows this property in seconds (int). - } - - - /** - Sets the maximum number of connections that the connection pool - contains. A value of 0 indicates there is no maximum. - @param maxPoolSize The maximum number of connections in this pool. - Valid values are 0 or greater. The default value is 0 (no maximum). - @see #setEnforceMaxPoolSize - **/ - public void setMaxPoolSize(int maxPoolSize) - { - final String property = "maxPoolSize"; - if (maxPoolSize < 0) - { - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - maxPoolSize_ = maxPoolSize; - logProperty(property, Integer.toString(maxPoolSize_)); - } - - - /** - Sets the minimum number of connections that the connection pool - contains. A value of 0 indicates there is no minimum and connections - are created as they are needed. - @param minPoolSize The minimum number of available connections in the pool. - Valid values are 0 or greater. The default value is 0. - **/ - public void setMinPoolSize(int minPoolSize) - { - final String property = "minPoolSize"; - if (minPoolSize < 0) - { - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - minPoolSize_ = minPoolSize; - logProperty(property, Integer.toString(minPoolSize_)); - } - - - /** - Sets whether connections are pretested before being allocated to requesters. - @param pretest If true, then connections are pretested; if false, then connections are not pretested. - The default value is false. - **/ - public void setPretestConnections(boolean pretest) - { - pretestConnections_ = pretest; - logProperty("pretestConnections", String.valueOf(pretestConnections_)); - } - - - /** - Sets the interval (in seconds) between runs of the connection pool's - maintenance thread. The maintenance thread enforces this pool's - connections and statements so that they conform to the specified - minimum and maximum pool sizes, idle time, and maximum number of - open statements. A value of 0 indicates that a maintenance thread - should not be created. - @param propertyCycle The number of seconds that this pool should wait before enforcing - its properties. Valid values are 0 or greater. The default value is 5 minutes. - **/ - public void setPropertyCycle(int propertyCycle) - { - final String property = "propertyCycle"; - if (propertyCycle < 0) - { - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - propertyCycle_ = propertyCycle*1000; // store internally as milliseconds - logProperty(property, Integer.toString(propertyCycle)); - - // Design note: In general we prefer to express "duration" values in milliseconds, - // but the JDBC Tutorial and Reference shows this property in seconds (int). - } - - - /** - Sets whether connections may be re-used after being returned to the connection pool. - @param reuse If true, then connections may be reused; if false, then connections are closed after they are returned to the pool. The default value is true. - **/ - public void setReuseConnections(boolean reuse) - { - reuseConnections_ = reuse; - logProperty("reuseConnections", String.valueOf(reuseConnections_)); //@jvm13 Boolean.toString(reuseConnections_)); - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCManagedDataSource.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCManagedDataSource.java deleted file mode 100644 index e15b95c59..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCManagedDataSource.java +++ /dev/null @@ -1,4643 +0,0 @@ -// TBD - Cross-link with corresponding non-managed class. -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCManagedDataSource.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2005-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.PrintWriter; -import java.io.Serializable; -import java.sql.Connection; -import java.sql.DriverPropertyInfo; -import java.sql.SQLException; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.Properties; -import java.util.Random; -import javax.sql.DataSource; -import javax.naming.NamingException; -import javax.naming.Reference; -import javax.naming.Referenceable; -import javax.naming.StringRefAddr; -import javax.naming.InitialContext; -import javax.naming.Context; - -// Note that there is no inheritance/extension relationship between DataSource and ConnectionPoolDataSource. Applications code to DataSource, whereas ConnectionPoolDataSource is used internally by application servers, etc. - -// Note: We currently have no requirement to provide a managed pooling implementation of javax.sql.XADataSource. - -/** - This implementation of javax.sql.DataSource can be used to produce Connection objects that will automatically participate in connection pooling, and are managed by the Toolbox's built-in connection pooling manager. - -

        - A DataSource is a factory for connections to the physical data source that this DataSource object represents. - An alternative to the DriverManager facility, a DataSource object is the preferred means of getting a connection. - An object that implements the DataSource interface will typically be registered with a naming service based on the - Java Naming and Directory (JNDI) API. -

        - A DataSource object has properties that can be modified when necessary. For example, if the data source is moved to a - different system, the property for the system can be changed. The benefit is that because the data source's properties - can be changed, any code accessing that data source does not need to be changed. -

        - A driver that is accessed via a DataSource object does not register itself with the DriverManager. Rather, a DataSource o - bject is retrieved though a lookup operation and then used to create a Connection object. With a basic implementation, - the connection obtained through a DataSource object is identical to a connection obtained through the DriverManager facility. -

        - Caution: To avoid the pitfalls of "double-managed" pools, do not use this class in conjunction with a separate - connection pool manager, such as that available in WebSphere. When a separate pool manager is provided, - use {@link AS400JDBCDataSource AS400JDBCDataSource} instead. - - @see AS400JDBCManagedConnectionPoolDataSource - @see AS400JDBCDataSource - @see AS400JDBCConnectionPoolDataSource - @see AS400JDBCXADataSource - **/ -public class AS400JDBCManagedDataSource -/* ifdef JDBC40 -extends ToolboxWrapper -endif */ - -implements DataSource, Referenceable, Serializable, Cloneable //@PDC 550 -{ - private static final long serialVersionUID = 1L; -static final String copyright = "Copyright (C) 2005-2010 International Business Machines Corporation and others."; - private static final boolean DEBUG = false; - - - /** - Implementation notes: - The properties listed in com.ibm.as400.access.JDProperties should also be included here. - **/ - - // Note: - // There are three kinds of data sources: - // 1. Basic DataSource (javax.sql.DataSource). Provides a getConnection() method that returns an instance of java.sql.Connection. - // 2. Data source class implemented to provide connection pooling (javax.sql.ConnectionPoolDataSource). Provides a getPooledConnection() method that returns an instance of javax.sql.PooledConnection. - // 3. Data Source class implemented to provide distributed transactions (javax.sql.XADataSource). Provides a getXAConnection() method that returns an instance of javax.sql.XAConnection. - - // Constants - private static final String DATASOURCE_NAME = "dataSourceName"; - private static final String DESCRIPTION = "description"; - private static final String SERVER_NAME = "serverName"; - private static final String USER = "user"; // same as JDProperties.USER_ - private static final String KEY_RING_NAME = "key ring name"; // same as JDProperties.KEY_RING_NAME_ - private static final String PASSWORD = "pw"; // same as JDProperties.PASSWORD_ - private static final String KEY_RING_PASSWORD = "key ring password"; // same as JDProperties.KEY_RING_PASSWORD_ - private static final String SECURE = "secure"; // same as JDProperties.SECURE_ - private static final String SAVE_PASSWORD = "savepw"; - private static final String PLAIN_TEXT_PASSWORD = "pwd"; - private static final String TRUE_ = "true"; - private static final String FALSE_ = "false"; - private static final String TOOLBOX_DRIVER = "jdbc:as400:"; - private static final int MAX_THRESHOLD = 16777216; // Maximum threshold (bytes). - - // socket options to store away in JNDI - private static final String SOCKET_KEEP_ALIVE = "soKeepAlive"; - // JDProperties: "keep alive" - private static final String SOCKET_RECEIVE_BUFFER_SIZE = "soReceiveBufferSize"; - // JDProperties: "receive buffer size" - private static final String SOCKET_SEND_BUFFER_SIZE = "soSendBufferSize"; - // JDProperties: "send buffer size" - private static final String SOCKET_LINGER = "soLinger"; - private static final String SOCKET_TIMEOUT = "soTimeout"; - private static final String SOCKET_TCP_NO_DELAY = "soTCPNoDelay"; - - // Standard data source properties. (See JDBC Tutorial p. 567, table 16.1) - - transient private AS400 as400_; // Object used to store and encrypt the password. - private String dataSourceName_; // Data source name. - private String description_; // Data source description. - // Note: A "networkProtocol" property is not provided. The Toolbox JDBC driver uses only 1 protocol, specified in the JDProperties. - // Note: For security, password value is stored in serialPWBytes_, and no getPassword() method is provided. - private char[] serialPWBytes_; - private int pwHashcode_; // hashed password - // Note: A "portNumber" property is not provided. It is specified in the JDProperties. - // Note: A "roleName" property is not provided. - private String serialServerName_; // system name used in serialization. - private String serialUserName_; // User name used in serialization. - - // Additional properties. - - private String serialKeyRingName_; // Key ring name used in serialization. - private boolean isSecure_; - private char[] serialKeyRingPWBytes_; - private boolean savePasswordWhenSerialized_; // By default, don't save password!!!! - private JDProperties properties_ = new JDProperties(); // system connection properties. - private SocketProperties sockProps_ = new SocketProperties(); // socket properties - - // Internal utility fields. - - transient private PrintWriter writer_; // The EventLog print writer. - transient EventLog log_; - - transient private AS400JDBCManagedConnectionPoolDataSource cpds_; - - // Handles loading the appropriate resource bundle - // private static ResourceBundleLoader loader_; - - private boolean dataSourceNameSpecified_; - transient private JDConnectionPoolManager poolManager_; - transient private boolean poolManagerInitialized_; - - transient private JDConnectionPoolKey defaultConnectionPoolKey_; - transient private boolean connectionKeyNeedsUpdate_ = true; - - transient private boolean inUse_; - - /** - * The maximum storage space that can be used to execute a query. - **/ - public static final int MAX_STORAGE_LIMIT = AS400JDBCDataSource.MAX_STORAGE_LIMIT; // Maximum query storage limit @550 - - /** - Start tracing the JDBC client. This is the same as setting - property "trace=true"; Note the constant is not public. - It is defined only to be compatible with ODBC - The numeric value of this constant is 1. - **/ - static final int TRACE_CLIENT = AS400JDBCDataSource.TRACE_CLIENT; - - /** - Start the database monitor on the JDBC server job. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 2. - **/ - public static final int SERVER_TRACE_START_DATABASE_MONITOR = AS400JDBCDataSource.SERVER_TRACE_START_DATABASE_MONITOR; - - /** - Start debug on the JDBC server job. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 4. - **/ - public static final int SERVER_TRACE_DEBUG_SERVER_JOB = AS400JDBCDataSource.SERVER_TRACE_DEBUG_SERVER_JOB; - - /** - Save the joblog when the JDBC server job ends. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 8. - **/ - public static final int SERVER_TRACE_SAVE_SERVER_JOBLOG = AS400JDBCDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG; - - /** - Start job trace on the JDBC server job. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 16. - **/ - public static final int SERVER_TRACE_TRACE_SERVER_JOB = AS400JDBCDataSource.SERVER_TRACE_TRACE_SERVER_JOB; - - /** - Save SQL information. - This constant is used when setting the level of tracing for the JDBC server job. - The numeric value of this constant is 32. - **/ - public static final int SERVER_TRACE_SAVE_SQL_INFORMATION = AS400JDBCDataSource.SERVER_TRACE_SAVE_SQL_INFORMATION; - - - /** - Constructs a default AS400JDBCManagedDataSource object. - **/ - public AS400JDBCManagedDataSource() - { - initializeTransient(); - } - - /** - Constructs an AS400JDBCManagedDataSource object to the specified serverName. - @param serverName The name of the IBM i system. - **/ - public AS400JDBCManagedDataSource(String serverName) - { - this(); - - setServerName(serverName); - } - - /** - Constructs an AS400JDBCManagedDataSource object with the specified signon information. - @param serverName The name of the IBM i system. - @param user The user id. - @param password The user password. - **/ - public AS400JDBCManagedDataSource(String serverName, String user, String password) - { - this(); - - setServerName(serverName); - setUser(user); - setPassword(password); - } - - - // Note: We do not provide a constructor that takes an AS400 object, - // because we need to capture the password so we can use it as part of the pool key. - - - /** - Constructs an AS400JDBCManagedDataSource object with the specified signon information - to use for SSL communications with the IBM i system. - @param serverName The name of the system. - @param user The user id. - @param password The user password. - @param keyRingName The key ring class name to be used for SSL communications with the system. - @param keyRingPassword The password for the key ring class to be used for SSL communications with the system. - **/ - public AS400JDBCManagedDataSource(String serverName, String user, String password, - String keyRingName, String keyRingPassword) - { - this(); - - setSecure(true); - - try - { - as400_ = new SecureAS400(as400_); - ((SecureAS400)as400_).setKeyRingName(keyRingName, keyRingPassword); - } - catch (PropertyVetoException pe) {} // will never happen - - serialKeyRingName_ = keyRingName; - - // There is no get/set keyring name / password methods so they really aren't bean - // properties, but in v5r1 the keyring name is saved as if it is a property. Since - // the code saved the name we will also save the password. - serialKeyRingPWBytes_ = xpwConfuse(keyRingPassword); - - setServerName(serverName); - setUser(user); - setPassword(password); - } - - - /** - Constructs an AS400JDBCManagedDataSource object from the specified Reference object - @param reference The reference to retrieve the DataSource properties from - **/ - AS400JDBCManagedDataSource(Reference reference) - { - // Implementation note: This method is called from AS400JDBCObjectFactory.getObjectInstance - - if (reference == null) - throw new NullPointerException("reference"); - - Properties properties = new Properties(); - - // Set up the as400 object. - if (((String)reference.get(SECURE).getContent()).equalsIgnoreCase(TRUE_)) - { - isSecure_ = true; - as400_ = new SecureAS400(); - - // Since the as400 object is secure, get the key ring info. - serialKeyRingName_ = (String)reference.get(KEY_RING_NAME).getContent(); - // Note: Even though JDProperties has a "key ring" properties, we choose not to add them. - if (reference.get(KEY_RING_PASSWORD) != null) - serialKeyRingPWBytes_ = ((String)reference.get(KEY_RING_PASSWORD).getContent()).toCharArray(); - else - serialKeyRingPWBytes_ = null; - - try { - if (serialKeyRingPWBytes_ != null && serialKeyRingPWBytes_.length > 0) { - ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_, xpwDeconfuse(serialKeyRingPWBytes_)); - } - else { - ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_); - } - } catch (PropertyVetoException pve) {} // Will never happen - - } - else - { - isSecure_ = false; - as400_ = new AS400(); - } - // Note that we allow the SECURE property to also get added to JDProperties in the loop below. - - boolean isConnectionPoolDataSource = (this instanceof AS400JDBCManagedConnectionPoolDataSource); - - Enumeration list = reference.getAll(); - while (list.hasMoreElements()) - { - StringRefAddr refAddr = (StringRefAddr)list.nextElement(); - String property = refAddr.getType(); - String value = (String)reference.get(property).getContent(); - - // Constant identifiers were used to store in JNDI. - // Perform special handling for properties that don't get included in JDProperties. - - if (property.equals(DATASOURCE_NAME)) { - setDataSourceName(value); - } - else if (property.equals(DESCRIPTION)) - setDescription(value); - else if (property.equals(SERVER_NAME)) - setServerName(value); - else if (property.equals(USER)) { - setUser(value); - properties.put(property, value); // This value needs to go into JDProperties also. - } - else if (property.equals(PLAIN_TEXT_PASSWORD)) { - //set the password - setPassword(value); - } - else if (property.equals(PASSWORD)) - { - if (reference.get(PLAIN_TEXT_PASSWORD) != null) - { - setPassword((String)reference.get(PLAIN_TEXT_PASSWORD).getContent()); - } - else - { - // get the password back from the serialized char[] - if (value != null) { - serialPWBytes_ = value.toCharArray(); - pwHashcode_ = xpwDeconfuse(serialPWBytes_).hashCode(); - // decode the password and set it on the as400 - as400_.setPassword(xpwDeconfuse(serialPWBytes_)); - } - } - } - else if (property.equals(SAVE_PASSWORD)) { - // set the savePasswordWhenSerialized_ flag - savePasswordWhenSerialized_ = value.equals(TRUE_) ? true : false; - } - else if (/*property.equals(SECURE) ||*/ property.equals(KEY_RING_NAME) || property.equals(KEY_RING_PASSWORD)) { - // Do nothing for these keys. They've already been handled prior to loop, - // and we don't want them added to JDProperties. - } - else if (property.equals(SOCKET_KEEP_ALIVE)) { - sockProps_.setKeepAlive((value.equals(TRUE_)? true : false)); - } - else if (property.equals(SOCKET_RECEIVE_BUFFER_SIZE)) { - sockProps_.setReceiveBufferSize(Integer.parseInt(value)); - } - else if (property.equals(SOCKET_SEND_BUFFER_SIZE)) { - sockProps_.setSendBufferSize(Integer.parseInt(value)); - } - else if (property.equals(SOCKET_LINGER)) { - sockProps_.setSoLinger(Integer.parseInt(value)); - } - else if (property.equals(SOCKET_TIMEOUT)) { - sockProps_.setSoTimeout(Integer.parseInt(value)); - } - else if (property.equals(SOCKET_TCP_NO_DELAY)) { - sockProps_.setTcpNoDelay((value.equals(TRUE_)? true : false)); - } - else if (isConnectionPoolDataSource && - AS400JDBCManagedConnectionPoolDataSource.isConnectionPoolProperty(property)) { - // Ignore this property, the subclass will consume it. - if (DEBUG) logDiagnostic("AS400JDBCManagedDataSource(Reference) is ignoring connection pool property \"" + property + "\""); - } - else { // It's neither a "socket property" nor a property that needs special handling. - properties.put(property, value); // Assume it goes into JDProperties. - } - } // 'while' loop - - properties_ = new JDProperties(properties, null); - if (sockProps_.isAnyOptionSet()) { // only need to set if not default - as400_.setSocketProperties(sockProps_); - } - - // Get the prompt property and set it back in the as400 object. - String prmpt = properties_.getString(JDProperties.PROMPT); - if (prmpt != null && prmpt.equalsIgnoreCase(FALSE_)) - setPrompt(false); - else if (prmpt != null && prmpt.equalsIgnoreCase(TRUE_)) - setPrompt(true); - } - - - /** - Verifies the health of the connection pool. For example: That the connection counts are consistent with the connection list lengths, and that all the daemons are still running. -

        Note: This method is provided for use as a diagnostic tool only. It temporarily "freezes" the connection pool while it collects statistics and examines the pool state. - @param logStatistics If true, additional information is logged. - @return true if connection pool exists and appears healthy; false otherwise. - **/ - public boolean checkPoolHealth(boolean logStatistics) - { - if (poolManager_ == null) { - logWarning("Connection pool does not exist"); - return false; - } - else return poolManager_.checkHealth(logStatistics); - } - - - // For exclusive use within this class and by AS400JDBCManagedConnectionPoolDataSource. - /** - Returns the database connection. - @return The connection. - @throws SQLException If a database error occurs. - **/ - final AS400JDBCConnection createPhysicalConnection() throws SQLException - { - // If we have an AS400JDBCManagedConnectionPoolDataSource, delegate the connection creation. - if (cpds_ != null) { - return cpds_.createPhysicalConnection(); - } - else - { - AS400 as400Object = null; - - // If the object was created with a keyring, or if the user asks for the object - // to be secure, clone a SecureAS400 object; otherwise, clone an AS400 object. - if (isSecure_ || isSecure()) { - as400Object = new SecureAS400(as400_); - } - else { - as400Object = new AS400(as400_); - } - if (sockProps_.isAnyOptionSet()) { // only need to set if not default - as400Object.setSocketProperties(sockProps_); - } - - return createPhysicalConnection(as400Object); - } - } - - - // For exclusive use within this class and by AS400JDBCManagedConnectionPoolDataSource. - /** - Returns the database connection using the specified user and password. - @param user The database user. - @param password The database password. - @return The connection - @throws SQLException If a database error occurs. - **/ - final AS400JDBCConnection createPhysicalConnection(String user, String password) throws SQLException - { - // Validate the parameters. - if (user == null) - throw new NullPointerException("user"); - if (password == null) - throw new NullPointerException("password"); - - // If we have an AS400JDBCManagedConnectionPoolDataSource, delegate the connection creation. - if (cpds_ != null) { - return cpds_.createPhysicalConnection(user, password); - } - else - { - AS400 as400Object = null; - - // If the object was created with a keyring, or if the user asks for the object - // to be secure, clone a SecureAS400 object; otherwise, clone an AS400 object. - if (isSecure_ || isSecure()) { - as400Object = new SecureAS400(as400_); - } - else { - as400Object = new AS400(as400_); - } - try { - as400Object.setUserId(user); - as400Object.setPassword(password); - } - catch (PropertyVetoException pve) {} // will never happen - - // Set GUI available on the new object to false if user turned prompting off. - try { - if (!isPrompt()) { - as400Object.setGuiAvailable(false); - } - } - catch (PropertyVetoException pve) {} // this will never happen - - if (sockProps_.isAnyOptionSet()) { // only need to set if not default - as400Object.setSocketProperties(sockProps_); - } - - return createPhysicalConnection(as400Object); - } - } - - - /** - Utility method to creates the database connection based on the signon and property information. - @param as400 The AS400 object used to make the connection. - @throws SQLException If a database error occurs. - **/ - private AS400JDBCConnection createPhysicalConnection(AS400 as400) throws SQLException - { - AS400JDBCConnection connection = new AS400JDBCConnection(); - - connection.setProperties(new JDDataSourceURL(TOOLBOX_DRIVER + "//" + as400.getSystemName()), properties_, as400); // Note: This also does an AS400.connectService() to the database host server. - - if (JDTrace.isTraceOn() || log_ != null) logInformation(ResourceBundleLoader.getText("AS400_JDBC_DS_CONN_CREATED")); - return connection; - } - - - //@PDA 550 - clone - /** - * Method to create a clone of AS400JDBCManagedDataSource. This does a shallow - * copy, with the exception of JDProperties, which also gets cloned. - */ - public Object clone() - { - try - { - AS400JDBCManagedDataSource clone = (AS400JDBCManagedDataSource) super.clone(); - clone.properties_ = (JDProperties) this.properties_.clone(); - return clone; - } catch (CloneNotSupportedException e) - { // This should never happen. - Trace.log(Trace.ERROR, e); - throw new UnsupportedOperationException("clone()"); - } - } - - - /** - Shuts down the connection pool in an orderly manner. Closes all connections in the pool. - @throws Throwable If an error occurs. - **/ - public void closePool() - { - if (poolManager_ != null) poolManager_.closePool(); - } - - - /** - Returns the level of database access for the connection. - @return The access level. Valid values include: "all" (all SQL statements allowed), - "read call" (SELECT and CALL statements allowed), and "read only" (SELECT statements only). - The default value is "all". - **/ - public String getAccess() - { - return properties_.getString(JDProperties.ACCESS); - } - - /** - Returns what behaviors of the Toolbox JDBC driver have been overridden. - Multiple behaviors can be overridden in combination by adding - the constants and passing that sum on the setBehaviorOverride() method. - @return The behaviors that have been overridden. -

        The return value is a combination of the following: -

          -
        • 1 - Do not throw an exception if Statement.executeQuery() or - PreparedStatement.executeQuery() do not return a result set. - Instead, return null for the result set. -
        - **/ - public int getBehaviorOverride() - { - return properties_.getInt(JDProperties.BEHAVIOR_OVERRIDE); - } - - /** - Returns the output string type of bidi data. See - BidiStringType for more information and valid values. -1 will be returned - if the value has not been set. - **/ - public int getBidiStringType() - { - String value = properties_.getString(JDProperties.BIDI_STRING_TYPE); - try - { - return Integer.parseInt (value); - } - catch (NumberFormatException nfe) // if value is "", that is, not set - { - return -1; - } - } - - - /** - Returns the criteria for retrieving data from the system in - blocks of records. Specifying a non-zero value for this property - will reduce the frequency of communication to the system, and - therefore increase performance. - @return The block criteria. -

        Valid values include: -

          -
        • 0 (no record blocking) -
        • 1 (block if FOR FETCH ONLY is specified) -
        • 2 (block if FOR UPDATE is specified) - The default value. -
        - **/ - public int getBlockCriteria() - { - return properties_.getInt(JDProperties.BLOCK_CRITERIA); - } - - /** - Returns the block size in kilobytes to retrieve from the IBM i system and - cache on the client. This property has no effect unless the block criteria - property is non-zero. Larger block sizes reduce the frequency of - communication to the system, and therefore may increase performance. - @return The block size in kilobytes. -

        Valid values include: -

          -
        • 0 -
        • 8 -
        • 16 -
        • 32 - The default value. -
        • 64 -
        • 128 -
        • 256 -
        • 512 -
        - **/ - public int getBlockSize() - { - return properties_.getInt(JDProperties.BLOCK_SIZE); - } - - //@cc1 - /** - * This method returns the concurrent access resolution setting. - * This method has no effect on IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @return The concurrent access resolution setting. Possible return valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public int getConcurrentAccessResolution () - { - return properties_.getInt(JDProperties.CONCURRENT_ACCESS_RESOLUTION); - } - - // method required by javax.sql.DataSource - /** - Returns a database connection. -
        Note: If a dataSourceName has been specified (via {@link #setDataSourceName setDataSourceName()}, this method will return a pooled connection. Otherwise it will return a non-pooled connection. -

        If pooling, the very first call to one of the getConnection() methods for this class will create and initialize the connection pool, and may have slow response. Therefore it is advisable for the application to make an initial "dummy" call to getConnection(). -
        If the connection pool is at or near capacity, a non-pooled connection may be returned. -

        It is the responsibility of the caller to ultimately call Connection.close() to release the connection, even if the connection has become unusable. - @return The connection. - @throws SQLException If a database error occurs. - @see #setDataSourceName - **/ - public Connection getConnection() throws SQLException - { - // Note: This method will return either an AS400JDBCConnection or an AS400JDBCConnectionHandle. - Connection connection; - - if (dataSourceNameSpecified_) // A datasource name has been specified, so use pooling. - { - connection = getConnectionFromPool(null, null); // 'null' indicates "use default key". - // Returns a connection handle or null. - - // The pooling implementation can return null if it can't produce a - // connection for the user. It is still our job to return a valid - // connection so drop back to returning a non-pooled connection at - // this point. - if (connection == null) - { - connection = createPhysicalConnection(); - } - } - else // No datasource name has been specified, so return raw (unpooled) connection. - { - if (JDTrace.isTraceOn() || log_ != null) { - logWarning("No datasource name was specified, so connections will not be pooled"); - } - // The connection is not linked to a pooled connection. Return a non-pooled connection. - connection = createPhysicalConnection(); - } - - if (DEBUG) - { - // Verify that the connection is for the correct user. - if (connection instanceof AS400JDBCConnection) - { - AS400JDBCConnection conn = (AS400JDBCConnection)connection; - String userForConn = conn.getUserName(); - if (!userForConn.equalsIgnoreCase(cpds_.getUser())) { - logError("MDS.getConnection() is returning a connection with incorrect user: [" + userForConn +"]"); - } - } - else if (connection instanceof AS400JDBCConnectionHandle) { - AS400JDBCConnectionHandle conn = (AS400JDBCConnectionHandle)connection; - String userForConn = conn.getUserName(); - if (!userForConn.equalsIgnoreCase(cpds_.getUser())) { - logError("MDS.getConnection() is returning a connectionHandle with incorrect user: [" + userForConn +"]"); - } - } - else { - logError("MDS.getConnection() is returning an instance of " + connection.getClass().getName()); - } - } - - return connection; - } - - // method required by javax.sql.DataSource - /** - Returns a database connection using the specified user and password. -
        Note: If a dataSourceName has been specified (via {@link #setDataSourceName setDataSourceName()}, this method will return a pooled connection. Otherwise it will return a non-pooled connection. -

        If pooling, the very first call to one of the getConnection() methods for this class will create and initialize the connection pool, and may have slow response. Therefore it is advisable for the application to make an initial "dummy" call to getConnection(). -
        If the connection pool is at or near capacity, a non-pooled connection may be returned. -

        It is the responsibility of the caller to ultimately call Connection.close() to release the connection, even if the connection has become unusable. - @param user The database user. - @param password The database password. - @return The connection - @throws SQLException If a database error occurs. - @see #setDataSourceName - **/ - public Connection getConnection(String user, String password) throws SQLException - { - // Note: This method will return either an AS400JDBCConnection or an AS400JDBCConnectionHandle. - - // Validate the parameters. - if (user == null) - throw new NullPointerException("user"); - if (password == null) - throw new NullPointerException("password"); - - Connection connection = null; - if (dataSourceNameSpecified_) // A datasource name has been specified, so use pooling. - { - // Note: xpwConfuse() generates different output each time it's called against the same password, so we can't use it bo build the pool key. - JDConnectionPoolKey key = new JDConnectionPoolKey(user, password.hashCode()); - connection = getConnectionFromPool(key, password); // Returns a connection handle or null. - - // The pooling implementation can return null if it can't produce a - // connection for the user. It is still our job to return a valid - // connection so drop back to returning a non-pooled connection at - // this point. - if (connection == null) - { - connection = createPhysicalConnection(user, password); - } - } - else // No datasource name has been specified, so return raw (unpooled) connection. - { - if (JDTrace.isTraceOn() || log_ != null) { - logWarning("No datasource name was specified, so connections will not be pooled"); - } - // The connection is not linked to a pooled connection. Return a non-pooled connection. - connection = createPhysicalConnection(user, password); - } - - if (DEBUG) - { - // Verify that the connection is for the correct user. - if (connection instanceof AS400JDBCConnection) { - AS400JDBCConnection conn = (AS400JDBCConnection)connection; - String userForConn = conn.getUserName(); - if (!userForConn.equalsIgnoreCase(user)) { - logError("MDS.getConnection("+user+") is returning a connection with incorrect user: [" + userForConn +"]"); - } - } - else if (connection instanceof AS400JDBCConnectionHandle) { - AS400JDBCConnectionHandle conn = (AS400JDBCConnectionHandle)connection; - String userForConn = conn.getUserName(); - if (!userForConn.equalsIgnoreCase(user)) { - logError("MDS.getConnection("+user+") is returning a connectionHandle with incorrect user: [" + userForConn +"]"); - } - } - else { - logError("MDS.getConnection() is returning an instance of " + connection.getClass().getName()); - } - } - - return connection; - } - - - /** - Returns a database connection from the pool, or null if the connection pool is at or near capacity. - - @param key The connection pool key. 'null' indicates that the default key is to be used. - @return The connection. May return null if pool is at or near capacity. - @throws SQLException If a database error occurs. - **/ - private final AS400JDBCConnectionHandle getConnectionFromPool(JDConnectionPoolKey key, String password) throws SQLException - { - // Note: This method generally returns an AS400JDBCPooledConnection. If the connection pool is full or nonexistent, it may return an (unpooled) AS400JDBCConnection. - - AS400JDBCConnectionHandle connection = null; - - if (!poolManagerInitialized_) { - initializeConnectionPool(); // this sets inUse_ to true - } - - connection = poolManager_.getConnection(key, password); - if (connection == null) - { - if (JDTrace.isTraceOn() || log_ != null) - logWarning("Connection pool is at or near capacity, so returning a non-pooled connection"); - // Note: If the 'enforceMaxPoolSize' property were set to true, then JDConnectionPoolManager.getConnection() would have thrown an exception if the pool is full and no connection is available. Since no exception was thrown, we can assume that the property is not set. - } - - return connection; - } - - - // For exclusive use within this class and by JDConnectionPoolManager. - final JDConnectionPoolKey getConnectionPoolKey() - { - // See if we need to update our connection pool key. - if (connectionKeyNeedsUpdate_) - { - if (defaultConnectionPoolKey_ == null) - { - defaultConnectionPoolKey_ = new JDConnectionPoolKey(serialUserName_, pwHashcode_); - } - else // key already exists, so just update it - { - defaultConnectionPoolKey_.update(serialUserName_, pwHashcode_); - } - } - - connectionKeyNeedsUpdate_ = false; - return defaultConnectionPoolKey_; - } - - - /** - Returns the value of the cursorSensitivity property. If the resultSetType is - ResultSet.TYPE_FORWARD_ONLY or ResultSet.TYPE_SCROLL_SENSITIVE, the value of this property - will control what cursor sensitivity is requested from the database. If the resultSetType - is ResultSet.TYPE_SCROLL_INSENSITIVE, this property will be ignored. - @return The cursor sensitivity. -

        Valid values include: -

          -
        • "asensitive" -
        • "insensitive" -
        • "sensitive" -
        - The default is "asensitive". - This property is ignored when connecting to systems - running V5R1 and earlier versions of OS/400. - **/ - public String getCursorSensitivity() - { - return properties_.getString(JDProperties.CURSOR_SENSITIVITY); - } - - - /** - Returns the value of the databaseName property. For more information see - the documentation for the setDatabaseName() method in this class. - @return The database name. - **/ - public String getDatabaseName() - { - return properties_.getString(JDProperties.DATABASE_NAME); - } - - /** - Returns the value of the dataSourceName property. - This property is used to name an underlying data source when connection pooling is used. - @return The data source name. - **/ - public String getDataSourceName() - { - return (dataSourceName_ == null ? "" : dataSourceName_); - } - - /** - Returns the date format used in date literals within SQL statements. - @return The date format. -

        Valid values include: -

          -
        • "mdy" -
        • "dmy" -
        • "ymd" -
        • "usa" -
        • "iso" -
        • "eur" -
        • "jis" -
        • "julian" -
        • "" (server job value) - default. -
        - The default is based on the server job. - **/ - public String getDateFormat() - { - return properties_.getString(JDProperties.DATE_FORMAT); - } - - /** - Returns the date separator used in date literals within SQL statements. - This property has no effect unless the "data format" property is set to: - "julian", "mdy", "dmy", or "ymd". - @return The date separator. -

        Valid values include: -

          -
        • "/" (slash) -
        • "-" (dash) -
        • "." (period) -
        • "," (comma) -
        • " " (space) -
        • "" (server job value) - default. -
        - The default value is based on the server job. - **/ - public String getDateSeparator() - { - return properties_.getString(JDProperties.DATE_SEPARATOR); - } - - //@DFA - /** - Returns the decfloat rounding mode. - @return The decfloat rounding mode. -

        Valid values include: -

          -
        • "half even" - default -
        • "half up" -
        • "down" -
        • "ceiling" -
        • "floor" -
        • "half down" -
        • "up" -
        - **/ - public String getDecfloatRoundingMode() - { - return properties_.getString(JDProperties.DECFLOAT_ROUNDING_MODE); - } - - /** - Returns the decimal separator used in numeric literals within SQL statements. - @return The decimal separator. -

        Valid values include: -

          -
        • "." (period) -
        • "," (comma) -
        • "" (server job value) - default. -
        - The default value is based on the server job. - **/ - public String getDecimalSeparator() - { - return properties_.getString(JDProperties.DECIMAL_SEPARATOR); - } - - //@igwrn - /** - * Returns the ignore warnings property. - * Specifies a list of SQL states for which the driver should not create warning objects. - * @return The ignore warnings. - **/ - public String getIgnoreWarnings() - { - return properties_.getString(JDProperties.IGNORE_WARNINGS); - } - - /** - Returns the description of the data source. - @return The description. - **/ - public String getDescription() - { - return (description_ == null ? "" : description_); - } - - /** - Returns the JDBC driver implementation. - This property has no - effect if the "secondary URL" property is set. - This property cannot be set to "native" if the - environment is not an IBM i Java Virtual - Machine. -

        Valid values include: -

          -
        • "toolbox" (use the IBM Toolbox for Java JDBC driver) -
        • "native" (use the IBM Developer Kit for Java JDBC driver) -
        - The default value is "toolbox". - Note: Not supported in a connection pool. - **/ - public String getDriver() - { - return properties_.getString(JDProperties.DRIVER); - } - - /** - Returns the amount of detail for error messages originating from - the IBM i system. - @return The error message level. - Valid values include: "basic" and "full". The default value is "basic". - **/ - public String getErrors() - { - return properties_.getString(JDProperties.ERRORS); - } - - /** - Returns the libraries to add to the server job's library list. - The libraries are delimited by commas or spaces, and - "*LIBL" may be used as a place holder for the server job's - current library list. The library list is used for resolving - unqualified stored procedure calls and finding schemas in - DatabaseMetaData catalog methods. If "*LIBL" is not specified, - the specified libraries will replace the server job's current library list. - @return The library list. - **/ - public String getLibraries() - { - return properties_.getString(JDProperties.LIBRARIES); - } - - /** - Returns the maximum LOB (large object) size in bytes that - can be retrieved as part of a result set. LOBs that are larger - than this threshold will be retrieved in pieces using extra - communication to the IBM i system. Larger LOB thresholds will reduce - the frequency of communication to the system, but will download - more LOB data, even if it is not used. Smaller LOB thresholds may - increase frequency of communication to the system, but will only - download LOB data as it is needed. - @return The lob threshold. Valid range is 0-16777216. - The default value is 32768. - **/ - public int getLobThreshold() - { - return properties_.getInt(JDProperties.LOB_THRESHOLD); - } - - // method required by javax.sql.DataSource - /** - Returns the timeout value in seconds. -
        Note: This value is not used or supported by the Toolbox JDBC driver. - Rather, the timeout value is determined by the IBM i system. - @return the maximum time in seconds that this data source can wait while attempting to connect to a database. - **/ - public int getLoginTimeout() - { - return properties_.getInt(JDProperties.LOGIN_TIMEOUT); - } - - // method required by javax.sql.DataSource - /** - Returns the log writer for this data source. - @return The log writer for this data source. - @throws SQLException If a database error occurs. - **/ - public PrintWriter getLogWriter() throws SQLException - { - return writer_; - } - - //@PDA - /** - * Indicates how to retrieve DatabaseMetaData. - * If set to 0, database metadata will be retrieved through the ROI data flow. - * If set to 1, database metadata will be retrieved by calling system stored procedures. - * The methods that currently are available through stored procedures are: - * getColumnPrivileges - * @return the metadata setting. - * The default value is 1. - **/ - public int getMetaDataSource() - { - return properties_.getInt(JDProperties.METADATA_SOURCE); - } - - //@dup - /** - * Indicates how to retrieve DatabaseMetaData. - * If set to 0, database metadata will be retrieved through the ROI data flow. - * If set to 1, database metadata will be retrieved by calling system stored procedures. - * The methods that currently are available through stored procedures are: - * getColumnPrivileges - * @return the metadata setting. - * The default value is 1. - * Note: this method is the same as getMetaDataSource() so that it corresponds to the connection property name - **/ - public int getMetadataSource() - { - return getMetaDataSource(); - } - - - /** - Returns the naming convention used when referring to tables. - @return The naming convention. Valid values include: "sql" (e.g. schema.table) - and "system" (e.g. schema/table). The default value is "sql". - **/ - public String getNaming() - { - return properties_.getString(JDProperties.NAMING); - } - - /** - Returns the base name of the SQL package. Note that only the - first six characters are used to generate the name of the SQL package on the IBM i system. - This property has no effect unless - the extended dynamic property is set to true. In addition, this property - must be set if the extended dynamic property is set to true. - @return The base name of the SQL package. - **/ - public String getPackage() - { - return properties_.getString(JDProperties.PACKAGE); - } - - /** - Returns the type of SQL statement to be stored in the SQL package. This can - be useful to improve the performance of complex join conditions. This - property has no effect unless the extended dynamic property is set to true. - @return The type of SQL statement. - Valid values include: "default" (only store SQL statements with parameter - markers in the package) and "select" (store all SQL SELECT statements - in the package). The default value is "default". - **/ - public String getPackageCriteria() - { - return properties_.getString(JDProperties.PACKAGE_CRITERIA); - } - - /** - Returns the action to take when SQL package errors occur. When an SQL package - error occurs, the driver will optionally throw an SQLException or post a - warning to the Connection, based on the value of this property. This property - has no effect unless the extended dynamic property is set to true. - @return The action to take when SQL errors occur. - Valid values include: "exception", "warning", and "none". The default value is "warning". - **/ - public String getPackageError() - { - return properties_.getString(JDProperties.PACKAGE_ERROR); - } - - /** - Returns the library for the SQL package. This property has no effect unless - the extended dynamic property is set to true. - @return The SQL package library. The default package library is "QGPL". - **/ - public String getPackageLibrary() - { - return properties_.getString(JDProperties.PACKAGE_LIBRARY); - } - - - // Note: This method must never be public. It is provided for exclusive use by AS400JDBCManagedConnectionPoolDataSource. - /** - Returns the password bytes. - @return The password bytes. - **/ - final char[] getPWBytes() - { - return serialPWBytes_; - } - - /** - Returns the name of the proxy server. - @return The proxy server. - **/ - public String getProxyServer() - { - return properties_.getString(JDProperties.PROXY_SERVER); - } - - /** - Returns the "query optimize goal" property - @return The optimization goal -

        Possible values include: -

          -
        • 0 = Optimize query for first block of data (*ALLIO) when extended dynamic packages are used; Optimize query for entire result set (*FIRSTIO) when packages are not used
        • -
        • 1 = Optimize query for first block of data (*FIRSTIO)
        • -
        • 2 = Optimize query for entire result set (*ALLIO)
        • -
        - **/ - public int getQueryOptimizeGoal() - { - return properties_.getInt(JDProperties.QUERY_OPTIMIZE_GOAL); - } - - //@550 - /** - * Returns the storage limit in megabytes, that should be used for statements executing a query in a connection. - * Note, this setting is ignored when running to i5/OS V5R4 or earlier - *

        Valid values are -1 to MAX_STORAGE_LIMIT megabytes. - * The default value is -1 meaning there is no limit. - **/ - public int getQueryStorageLimit() - { - return properties_.getInt(JDProperties.QUERY_STORAGE_LIMIT); - } - - - // method required by javax.naming.Referenceable - /** - Returns the Reference object for the data source object. - This is used by JNDI when bound in a JNDI naming service. - Contains the information necessary to reconstruct the data source - object when it is later retrieved from JNDI via an object factory. - * - @return A Reference object of the data source object. - @throws NamingException If a naming error occurs in resolving the object. - **/ - public Reference getReference() throws NamingException - { - Reference ref = new Reference(this.getClass().getName(), - "com.ibm.as400.access.AS400JDBCObjectFactory", - null); - - // Add the JDBC properties. - DriverPropertyInfo[] propertyList = properties_.getInfo(); - for (int i=0; i< propertyList.length; i++) - { - if (propertyList[i].value != null) - ref.add(new StringRefAddr(propertyList[i].name, propertyList[i].value)); - } - - // Add the Socket options - if (sockProps_.keepAliveSet_) ref.add(new StringRefAddr(SOCKET_KEEP_ALIVE, (sockProps_.keepAlive_ ? "true" : "false"))); - if (sockProps_.receiveBufferSizeSet_) ref.add(new StringRefAddr(SOCKET_RECEIVE_BUFFER_SIZE, Integer.toString(sockProps_.receiveBufferSize_))); - if (sockProps_.sendBufferSizeSet_) ref.add(new StringRefAddr(SOCKET_SEND_BUFFER_SIZE, Integer.toString(sockProps_.sendBufferSize_))); - if (sockProps_.soLingerSet_) ref.add(new StringRefAddr(SOCKET_LINGER, Integer.toString(sockProps_.soLinger_))); - if (sockProps_.soTimeoutSet_) ref.add(new StringRefAddr(SOCKET_TIMEOUT, Integer.toString(sockProps_.soTimeout_))); - if (sockProps_.tcpNoDelaySet_) ref.add(new StringRefAddr(SOCKET_TCP_NO_DELAY, (sockProps_.tcpNoDelay_ ? "true" : "false"))); - - // Add the data source properties. (unique constant identifiers for storing in JNDI). - if (dataSourceName_ != null) - ref.add(new StringRefAddr(DATASOURCE_NAME, dataSourceName_)); - if (description_ != null) - ref.add(new StringRefAddr(DESCRIPTION, description_)); - ref.add(new StringRefAddr(SERVER_NAME, getServerName())); - ref.add(new StringRefAddr(USER, getUser())); - ref.add(new StringRefAddr(KEY_RING_NAME, serialKeyRingName_)); - if (savePasswordWhenSerialized_) { - if (serialPWBytes_ != null) - ref.add(new StringRefAddr(PASSWORD, new String(serialPWBytes_))); - else - ref.add(new StringRefAddr(PASSWORD, null)); - if (serialKeyRingPWBytes_ != null) - ref.add(new StringRefAddr(KEY_RING_PASSWORD, new String(serialKeyRingPWBytes_))); - else - ref.add(new StringRefAddr(KEY_RING_PASSWORD, null)); - } - ref.add(new StringRefAddr(SAVE_PASSWORD, (savePasswordWhenSerialized_ ? TRUE_ : FALSE_))); - - return ref; - } - - /** - Returns the source of the text for REMARKS columns in ResultSets returned - by DatabaseMetaData methods. - @return The text source. - Valid values include: "sql" (SQL object comment) and "system" (IBM i object description). - The default value is "system". - **/ - public String getRemarks() - { - return properties_.getString(JDProperties.REMARKS); - } - - /** - Returns the secondary URL. - @return The secondary URL. - **/ - public String getSecondaryUrl() - { - return properties_.getString(JDProperties.SECONDARY_URL); - } - - - //@dup - /** - * Returns the secondary URL. - * @return The secondary URL. - * Note: this method is the same as setSecondaryUrl() so that it corresponds to the connection property name - **/ - public String getSecondaryURL() - { - return getSecondaryUrl(); - } - - - /** - Returns the value of the serverName property. - @return The system name. - **/ - public String getServerName() - { - return as400_.getSystemName(); - } - - - /** - Returns the level of tracing started on the JDBC server job. - If tracing is enabled, tracing is started when - the client connects to the IBM i system and ends when the connection - is disconnected. Tracing must be started before connecting to - the system since the client enables tracing only at connect time. - Trace data is collected in spooled files on the system. Multiple - levels of tracing can be turned on in combination by adding - the constants and passing that sum on the set method. For example, -

        -   dataSource.setServerTraceCategories(AS400JDBCManagedDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCManagedDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
        -   
        - @return The tracing level. -

        The value is a combination of the following: -

          -
        • SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job. - The numeric value of this constant is 2. -
        • SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job. - The numeric value of this constant is 4. -
        • SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends. - The numeric value of this constant is 8. -
        • SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job. - The numeric value of this constant is 16. -
        • SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information. - The numeric value of this constant is 32. -
        - * -

        - Tracing the JDBC server job will use significant amounts of system resources. - Additional processor resource is used to collect the data, and additional - storage is used to save the data. Turn on tracing only to debug - a problem as directed by IBM service. - * - **/ - public int getServerTraceCategories() - { - return properties_.getInt(JDProperties.TRACE_SERVER); - } - - //@dup - /** - Returns the level of tracing started on the JDBC server job. - If tracing is enabled, tracing is started when - the client connects to the IBM i system and ends when the connection - is disconnected. Tracing must be started before connecting to - the system since the client enables tracing only at connect time. - Trace data is collected in spooled files on the system. Multiple - levels of tracing can be turned on in combination by adding - the constants and passing that sum on the set method. For example, -

        -   dataSource.setServerTraceCategories(AS400JDBCManagedDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCManagedDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
        -   
        - @return The tracing level. -

        The value is a combination of the following: -

          -
        • SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job. - The numeric value of this constant is 2. -
        • SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job. - The numeric value of this constant is 4. -
        • SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends. - The numeric value of this constant is 8. -
        • SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job. - The numeric value of this constant is 16. -
        • SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information. - The numeric value of this constant is 32. -
        - * -

        - Tracing the JDBC server job will use significant amounts of system resources. - Additional processor resource is used to collect the data, and additional - storage is used to save the data. Turn on tracing only to debug - a problem as directed by IBM service. - * - * Note: this method is the same as getServerTraceCategories() so that it corresponds to the connection property name - **/ - public int getServerTrace() - { - return getServerTraceCategories(); - } - - //@STIMEOUT - /** - * Gets the socket timeout option in milliseconds. - * @return The value of the socket timeout option. - **/ - public long getSocketTimeout() - { - return getSoTimeout(); - } - - - /** - Returns how the IBM i system sorts records before sending them to the - client. - @return The sort value. -

        Valid values include: -

          -
        • "hex" (base the sort on hexadecimal values) -
        • "language" (base the sort on the language set in the sort language property) -
        • "table" (base the sort on the sort sequence table set in the sort table property) -
        - The default value is "hex". - **/ - public String getSort() - { - return properties_.getString(JDProperties.SORT); - } - - /** - Returns the three-character language id to use for selection of a sort sequence. - @return The three-character language id. - The default value is ENU. - **/ - public String getSortLanguage() - { - return properties_.getString(JDProperties.SORT_LANGUAGE); - } - - /** - Returns the library and file name of a sort sequence table stored on the - IBM i system. - @return The qualified sort table name. - **/ - public String getSortTable() - { - return properties_.getString(JDProperties.SORT_TABLE); - } - - /** - Returns how the IBM i system treats case while sorting records. - @return The sort weight. - Valid values include: "shared" (upper- and lower-case characters are sorted as the - same character) and "unique" (upper- and lower-case characters are sorted as - different characters). The default value is "shared". - **/ - public String getSortWeight() - { - return properties_.getString(JDProperties.SORT_WEIGHT); - } - - /** - Returns the time format used in time literals with SQL statements. - @return The time format. -

        Valid values include: -

          -
        • "hms" -
        • "usa" -
        • "iso" -
        • "eur" -
        • "jis" -
        • "" (server job value) - default. -
        - The default value is based on the server job. - **/ - public String getTimeFormat() - { - return properties_.getString(JDProperties.TIME_FORMAT); - } - - /** - Returns the time separator used in time literals within SQL - statements. - @return The time separator. -

        Valid values include: -

          -
        • ":" (colon) -
        • "." (period) -
        • "," (comma) -
        • " " (space) -
        • "" (server job value) - default. -
        - The default value is based on the server job. - **/ - public String getTimeSeparator() - { - return properties_.getString(JDProperties.TIME_SEPARATOR); - } - - - /** - Returns the IBM i system's transaction isolation. - @return The transaction isolation level. -

        Valid values include: -

          -
        • "none" -
        • "read uncommitted" - The default value. -
        • "read committed" -
        • "repeatable read" -
        • "serializable" -
        - **/ - public String getTransactionIsolation() - { - return properties_.getString(JDProperties.TRANSACTION_ISOLATION); - } - - /** - Returns the QAQQINI library name. - @return The QAQQINI library name. - **/ - public String getQaqqiniLibrary() - { - return properties_.getString(JDProperties.QAQQINILIB); - } - - //@dup - /** - * Returns the QAQQINI library name. - * @return The QAQQINI library name. - * Note: this method is the same as getQaqqiniLibrary() so that it corresponds to the connection property name - **/ - public String getQaqqinilib() - { - return getQaqqiniLibrary(); - } - - - /** - Returns the value of the 'user' property. - @return The user. - **/ - public String getUser() - { - //return properties_.getString(JDProperties.USER); //PDD - return as400_.getUserId(); //@PDA if running on host, could be default id - } - - /** - Returns the value of the "XA loosely couple support" property. - This indicates whether lock sharing is allowed for loosely coupled transaction branches. - @return The "XA loosely coupled support" setting. -

        Possible values include: -

          -
        • 0 = Locks cannot be shared
        • -
        • 1 = Locks can be shared
        • -
        - **/ - public int getXALooselyCoupledSupport() - { - return properties_.getInt(JDProperties.XA_LOOSELY_COUPLED_SUPPORT); - } - - - /** - Initializes the connection pool and the built-in pool manager. - If dataSourceName property has not been set (via {@link #setDataSourceName setDataSourceName()}, this method does nothing. -
        This method gets called upon the first invocation of {@link #getConnection() getConnection()} or {@link getConnection(String,String) getConnection(user,password)}. - @throws SQLException If a database error occurs. - **/ - void initializeConnectionPool() throws SQLException - { - if (!dataSourceNameSpecified_) - { - logWarning("No datasource name was specified, so connections will not be pooled"); - return; - } - synchronized(this) { /*@A7A */ - inUse_ = true; - } - if (poolManager_ == null) - { - try - { - // Assume that the Context.INITIAL_CONTEXT_FACTORY system property has been set. - Context ctx = new InitialContext(); - cpds_ = (AS400JDBCManagedConnectionPoolDataSource)ctx.lookup(dataSourceName_); - if (cpds_ == null) { - logError("Data source name is not bound in JNDI: " + dataSourceName_); - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - } - - getConnectionPoolKey(); // initialize the default connection pool key - poolManager_ = new JDConnectionPoolManager(this, cpds_); - // Implementation note: The JNDI lookup() tends to lose the LogWriter value of cpds_, so we need to give the pool manager access to our own LogWriter. - } - catch (NamingException ne) - { - ne.printStackTrace(); - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - } - } - - poolManagerInitialized_ = true; - } - - /** - Initializes the transient data for object de-serialization. - **/ - private final void initializeTransient() - { - poolManager_ = null; - poolManagerInitialized_ = false; - defaultConnectionPoolKey_ = null; - connectionKeyNeedsUpdate_ = true; - if (isSecure_) - as400_ = new SecureAS400(); - else - as400_ = new AS400(); - - if (sockProps_.isAnyOptionSet()) { // only need to set if not default - as400_.setSocketProperties(sockProps_); - } - - // Reinitialize the serverName, user, password, keyRingName, etc. - if (serialServerName_ != null) - setServerName(serialServerName_); - - if (serialUserName_ != null) - { - setUser(serialUserName_); - - if ((serialPWBytes_ != null) && - (serialPWBytes_.length > 0)) - { - as400_.setPassword(xpwDeconfuse(serialPWBytes_)); - } - } - - try - { - if (serialKeyRingName_ != null && isSecure_) - { - if ((serialKeyRingPWBytes_ != null) && - (serialKeyRingPWBytes_.length > 0)) - { - String keyRingPassword = xpwDeconfuse(serialKeyRingPWBytes_); - ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_, keyRingPassword); - } - else - { - ((SecureAS400)as400_).setKeyRingName(serialKeyRingName_); - } - } - } - catch (PropertyVetoException pve) {} // will never happen - - // Make sure the prompt flag is correctly de-serialized. The problem was - // the flag would get serialized with the rest of the properties - // (in the properties_ object), but the flag would never be applied - // to the AS400 object when de-serialzed. De-serialization puts the - // flag back in properties_ but that does no good unless the value - // is passed on to the AS400 object. That is what the new code does. - // There is no affect on normal "new" objects since at the time this - // method is called properties_ is null. - try - { - if (properties_ != null) - { - if (!isPrompt()) { - as400_.setGuiAvailable(false); - } - } - } - catch (PropertyVetoException pve) {} // will never happen - - synchronized(this) { //@A7A - inUse_ = false; - } - - } - - /** - Invalidates all pooled connections for the specified user/password. - All current available (unallocated) connections for this user/password are closed. - As active connections with this user/password are returned to the pool, they are closed. - @param user The database user. - @param password The database password. - **/ - public void invalidate(String user, String password) - { - invalidate(user, (password == null ? null : xpwConfuse(password))); - } - - /** - Invalidates pooled connections for the specified user/password. - All current available (unallocated) connections for this user/password are closed. - As active (in-use) connections with this user/password are returned to the pool, they are closed. - @param user The database user. - @param password The database password. - **/ - private final void invalidate(String user, char[] pwBytes) - { - int hash = (pwBytes == null ? 0 : xpwDeconfuse(pwBytes).hashCode()); - JDConnectionPoolKey key = new JDConnectionPoolKey(user, hash); - if (poolManager_ != null) poolManager_.invalidate(key); - } - - //@AC1 - /** - * Returns whether auto-commit mode is the default connection mode for new connections. - * @return Auto commit. - * The default value is true. - **/ - public boolean isAutoCommit() - { - return properties_.getBoolean(JDProperties.AUTO_COMMIT); - } - - //@CE1 - /** - * Returns whether commit or rollback throws SQLException when autocommit is enabled. - * @return Autocommit Exception. - * The default value is false. - **/ - public boolean isAutocommitException() - { - return properties_.getBoolean(JDProperties.AUTOCOMMIT_EXCEPTION); - } - - /** - Indicates whether bidi implicit reordering is used. - @return true if bidi implicit reordering is used; false otherwise. - The default value is true. - **/ - public boolean isBidiImplicitReordering() - { - return properties_.getBoolean(JDProperties.BIDI_IMPLICIT_REORDERING); - } - - /** - Indicates whether bidi numeric ordering round trip is used. - @return true if bidi numeric ordering round trip is used; false otherwise. - The default value is false. - **/ - public boolean isBidiNumericOrdering() - { - return properties_.getBoolean(JDProperties.BIDI_NUMERIC_ORDERING); - } - - /** - Indicates whether a big decimal value is returned. - @return true if a big decimal is returned; false otherwise. - The default value is true. - **/ - public boolean isBigDecimal() - { - return properties_.getBoolean(JDProperties.BIG_DECIMAL); - } - - /** - Indicates whether the cursor is held. - @return true if the cursor is held; false otherwise. - The default value is true. - **/ - public boolean isCursorHold() - { - return properties_.getBoolean(JDProperties.CURSOR_HOLD); - } - - /** - Indicates whether data compression is used. - @return true if data compression is used; false otherwise. - The default value is true. - **/ - public boolean isDataCompression() - { - return properties_.getBoolean(JDProperties.DATA_COMPRESSION); - } - - /** - Indicates whether data truncation is used. - @return true if data truncation is used; false otherwise. - The default value is true. - **/ - public boolean isDataTruncation() - { - return properties_.getBoolean(JDProperties.DATA_TRUNCATION); - } - - /** - Indicates whether extended dynamic support is used. Extended dynamic - support provides a mechanism for caching dynamic SQL statements on - the IBM i system. The first time a particular SQL statement is prepared, it is - stored in an SQL package on the system. - If the package does not exist, it will be automatically created. - On subsequent prepares of the - same SQL statement, the system can skip a significant part of the - processing by using information stored in the SQL package. - @return true if extended dynamic support is used; false otherwise. - The default value is not to use extended dynamic support. - **/ - public boolean isExtendedDynamic() - { - return properties_.getBoolean(JDProperties.EXTENDED_DYNAMIC); - } - - /** - Indicates whether the driver should request extended metadata from the - IBM i system. If this property is set to true, the accuracy of the information - that is returned from ResultSetMetaData methods getColumnLabel(int), - isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased. - In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this - property set to true. However, performance will be slower with this - property on. Leave this property set to its default (false) unless you - need more specific information from those methods. - * - For example, without this property turned on, isSearchable(int) will - always return true even though the correct answer may be false because - the driver does not have enough information from the system to make a judgment. Setting - this property to true forces the driver to get the correct data from the system. - * - @return true if extended metadata will be requested; false otherwise. - The default value is false. - **/ - - public boolean isExtendedMetaData() - { - return properties_.getBoolean(JDProperties.EXTENDED_METADATA); - } - - - //@dup - /** - * Indicates whether the driver should request extended metadata from the - * IBM i system. If this property is set to true, the accuracy of the information - * that is returned from ResultSetMetaData methods getColumnLabel(int), - * isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased. - * In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this - * property set to true. However, performance will be slower with this - * property on. Leave this property set to its default (false) unless you - * need more specific information from those methods. - * - * For example, without this property turned on, isSearchable(int) will - * always return true even though the correct answer may be false because - * the driver does not have enough information from the system to make a judgment. Setting - * this property to true forces the driver to get the correct data from the IBM i system. - * - * @return true if extended metadata will be requested; false otherwise. - * The default value is false. - * Note: this method is the same as isExtendedMetaData() so that it corresponds to the connection property name - **/ - - public boolean isExtendedMetadata() - { - return isExtendedMetaData(); - } - - - /** - Indicates whether the IBM i system fully opens a file when performing a query. - By default the system optimizes opens so they perform better. In - certain cases an optimized open will fail. In some - cases a query will fail when a database performance monitor - is turned on even though the same query works with the monitor - turned off. In this case set the full open property to true. - This disables optimization on the system. - @return true if files are fully opened; false otherwise. - The default value is false. - **/ - public boolean isFullOpen() - { - return properties_.getBoolean(JDProperties.FULL_OPEN); - } - - /** - Returns the value of the "hold input locators" property - @return true If input locators are held. - **/ - public boolean isHoldInputLocators() - { - return properties_.getBoolean(JDProperties.HOLD_LOCATORS); - } - - - /** - Returns the value of the "hold statements" property - @return true If statements are held. - **/ - public boolean isHoldStatements() - { - return properties_.getBoolean(JDProperties.HOLD_STATEMENTS); - } - - - /** - Indicates whether the pool is in use; that is, whether it contains any connections. - Used for checking state conditions. The default is false. - @return true if the pool is in use; false otherwise. - **/ - private synchronized final boolean isInUse() // @A7C - { - return inUse_; - } - - //@dmy - /** - * Indicates whether the temporary fix for JVM 1.6 is enabled. - * @return true if enabled; false otherwise. - * The default value is true. - **/ - public boolean isJvm16Synchronize() - { - return properties_.getBoolean(JDProperties.JVM16_SYNCHRONIZE); - } - - /** - Indicates whether to delay closing cursors until subsequent requests. - @return true to delay closing cursors until subsequent requests; false otherwise. - The default value is false. - **/ - public boolean isLazyClose() - { - return properties_.getBoolean(JDProperties.LAZY_CLOSE); - } - - /** - Indicates whether to add newly prepared statements to the - SQL package specified on the "package" property. This property - has no effect unless the extended dynamic property is set to true; - @return true If newly prepared statements should be added to the SQL package specified - on the "package" property; false otherwise. - The default value is true. - **/ - public boolean isPackageAdd() - { - return properties_.getBoolean(JDProperties.PACKAGE_ADD); - } - - /** - Indicates whether a subset of the SQL package information is cached in client memory. - Caching SQL packages locally - reduces the amount of communication to the IBM i system for prepares and describes. This - property has no effect unless the extended dynamic property is set to true. - @return true if caching is used; false otherwise. - The defalut value is false. - **/ - public boolean isPackageCache() - { - return properties_.getBoolean(JDProperties.PACKAGE_CACHE); - } - - /** - Indicates whether SQL packages are cleared when they become full. This method - has been deprecated. Package clearing and the decision for the - threshold where package clearing is needed is now handled - automatically by the database. - @return Always false. This method is deprecated. - @deprecated - **/ - public boolean isPackageClear() - { - return false; - } - - /** - Indicates whether data is prefetched upon executing a SELECT statement. - This will increase performance when accessing the initial rows in the result set. - @return If prefetch is used; false otherwise. - The default value is prefetch data. - **/ - public boolean isPrefetch() - { - return properties_.getBoolean(JDProperties.PREFETCH); - } - - /** - Indicates whether the user is prompted if a user name or password is - needed to connect to the IBM i system. If a connection can not be made - without prompting the user, and this property is set to false, then an - attempt to connect will fail throwing an exception. - @return true if the user is prompted for signon information; false otherwise. - The default value is false. - **/ - public boolean isPrompt() - { - return properties_.getBoolean(JDProperties.PROMPT); - } - - /** - Returns the value of the "rollback cursor hold" property. - @return true if cursors are held across rollbacks; false otherwise. - **/ - public boolean isRollbackCursorHold() - { - return properties_.getBoolean(JDProperties.ROLLBACK_CURSOR_HOLD); - } - - /** - Indicates whether the password is saved locally with the rest of - the properties when this data source object is serialized. -

        - If the password is saved, it is up to the application to protect - the serialized form of the object because it contains all necessary - information to connect to the IBM i system. The default is false. It - is a security risk to save the password with the rest of the - properties so by default the password is not saved. If the programmer - chooses to accept this risk, call setSavePasswordWhenSerialized(true) - to force the Toolbox to save the password with the other properties - when the data source object is serialized. - @return true if the password is saved with the rest of the properties when the - data source object is serialized; false otherwise. - The default value is false. - **/ - public boolean isSavePasswordWhenSerialized() - { - return savePasswordWhenSerialized_; - } - - /** - Indicates whether a Secure Socket Layer (SSL) connection is used to communicate - with the IBM i system. SSL connections are only available when connecting to systems - at V4R4 or later. - @return true if Secure Socket Layer connection is used; false otherwise. - The default value is false. - **/ - public boolean isSecure() - { - return properties_.getBoolean(JDProperties.SECURE); - } - - //@pw3 - /** - * Returns the secure current user setting. True indicates to disallow "" and *current for user name and password. - * @return The secure current user setting. - **/ - public boolean isSecureCurrentUser() - { - return properties_.getBoolean(JDProperties.SECURE_CURRENT_USER); - } - - /** - Indicates whether a thread is used. - @return true if a thread is used; false otherwise. - The default value is true. - **/ - public boolean isThreadUsed() - { - return properties_.getBoolean(JDProperties.THREAD_USED); - } - - /** - Indicates whether trace messages should be logged. - @return true if trace message are logged; false otherwise. - The default value is false. - **/ - public boolean isTrace() - { - return properties_.getBoolean(JDProperties.TRACE); - } - - /** - Indicates whether binary data is translated. If this property is set - to true, then BINARY and VARBINARY fields are treated as CHAR and - VARCHAR fields. - @return true if binary data is translated; false otherwise. - The default value is false. - **/ - public boolean isTranslateBinary() - { - return properties_.getBoolean(JDProperties.TRANSLATE_BINARY); - } - - //@PDA - /** - * Indicates how Boolean objects are interpreted when setting the value - * for a character field/parameter using the PreparedStatement.setObject(), - * CallableStatement.setObject() or ResultSet.updateObject() methods. Setting the - * property to "true", would store the Boolean object in the character field as either - * "true" or "false". Setting the property to "false", would store the Boolean object - * in the character field as either "1" or "0". - * @return true if boolean data is translated; false otherwise. - * The default value is true. - **/ - public boolean isTranslateBoolean() - { - return properties_.getBoolean(JDProperties.TRANSLATE_BOOLEAN); - } - - - /** - Indicates whether true auto commit support is used. - @return true if true auto commit support is used; false otherwise. - The default value is false. - **/ - public boolean isTrueAutoCommit() - { - return properties_.getBoolean(JDProperties.TRUE_AUTO_COMMIT); //@true - } - - //@dup - /** - * Indicates whether true auto commit support is used. - * @return true if true auto commit support is used; false otherwise. - * The default value is false. - * Note: this method is the same as isTrueAutoCommit() so that it corresponds to the connection property name - **/ - public boolean isTrueAutocommit() - { - return isTrueAutoCommit(); - } - - - /** - Logs an exception and message to the event log. - @param property The property to log. - @param value The property value to log. - **/ - void logProperty(String property, String value) - { - // NOTE: JDTrace logs nothing unless JDTrace.isTraceOn() is true. - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, property, value); - } - - final void logDiagnostic(String text) - { - // Note: Currently this method is implemented identically to logInformation(). - // At some future point, we may want to add unique behavior to it. - // In the meantime, it is a placeholder. - if (JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, text); - if (log_ != null) log_.log(text); - } - } - - final void logError(String text) - { - String msg = "ERROR: " + text; - JDTrace.logInformation (this, msg); - if (log_ != null) log_.log(msg); - else if (DEBUG) System.out.println(msg); - } - - final void logException(String text, Exception e) - { - JDTrace.logException (this, text, e); - if (log_ != null) log_.log(text, e); - else if (DEBUG) { - System.out.println(text); - e.printStackTrace(); - } - } - - - final void logInformation(String text) - { - // NOTE: JDTrace logs nothing unless JDTrace.isTraceOn() is true. - if (JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, text); - if (log_ != null) log_.log(text); - } - } - - final void logWarning(String text) - { - String msg = "WARNING: " + text; - JDTrace.logInformation (this, msg); - if (log_ != null) log_.log(msg); - else if (DEBUG) System.out.println(msg); - } - - /** - Deserializes and initializes transient data. - @throws ClassNotFoundException If the class cannot be found. - @throws IOException If an I/O exception occurs. - **/ - private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException - { - in.defaultReadObject(); - initializeTransient(); - } - - - /** - Sets the level of database access for the connection. - @param access The access level. -

        Valid values include: -

          -
        • "all" (all SQL statements allowed) -
        • "read call" (SELECT and CALL statements allowed) -
        • "read only" (SELECT statements only) -
        - The default value is "all". - **/ - public void setAccess(String access) - { - final String property = "access"; - - if (access == null) - throw new NullPointerException(property); - validateProperty(property, access, JDProperties.ACCESS); - - properties_.setString(JDProperties.ACCESS, access); - // Note: The JDProperties.setString() logs the property change. - } - - - //@AC1 - /** - * Sets whether auto-commit mode is the default connection mode for new connections. - * @param value - * The default value is true. - **/ - public void setAutoCommit(boolean value) - { - if (value) - properties_.setString(JDProperties.AUTO_COMMIT, TRUE_); - else - properties_.setString(JDProperties.AUTO_COMMIT, FALSE_); - - } - - //@CE1 - /** - * Sets whether commit or rollback throws SQLException when autocommit is enabled. - * @param value - * The default value is false. - **/ - public void setAutocommitException(boolean value) - { - if (value) - properties_.setString(JDProperties.AUTOCOMMIT_EXCEPTION, TRUE_); - else - properties_.setString(JDProperties.AUTOCOMMIT_EXCEPTION, FALSE_); - - } - - /** - Sets whether true auto commit support is used. - @param value true if true auto commit support should be used; false otherwise. - The default value is false. - **/ - public void setTrueAutoCommit(boolean value) - { - if (value) - properties_.setString(JDProperties.TRUE_AUTO_COMMIT, TRUE_); //@true - else - properties_.setString(JDProperties.TRUE_AUTO_COMMIT, FALSE_); //@true - } - - - //@dup - /** - * Sets whether true auto commit support is used. - * @param value true if true auto commit support should be used; false otherwise. - * The default value is false. - * Note: this method is the same as setTrueAutoCommit() so that it corresponds to the connection property nameproperty name - **/ - public void setTrueAutocommit(boolean value) - { - setTrueAutoCommit(value); - } - - - /** - Sets the Toolbox JDBC Driver behaviors to override. Multiple - behaviors can be changed in combination by adding - the constants and passing that sum on the this method. - @param behaviors The driver behaviors to override. -

        Valid values include: -

          -
        • 1 - Do not throw an exception if Statement.executeQuery() or - PreparedStatement.executeQuery() do not return a result set. - Instead, return null for the result set. -
        - * - Carefully consider the result of overriding the default behavior of the - driver. For example, setting the value of this property to 1 means - the driver will no longer thrown an exception even though the JDBC 3.0 - specification states throwing an exception is the correct behavior. - Be sure your application correctly handles the altered behavior. - * - **/ - public void setBehaviorOverride(int behaviors) - { - properties_.setString(JDProperties.BEHAVIOR_OVERRIDE, Integer.toString(behaviors)); - } - - /** - Sets the output string type of bidi data. See - BidiStringType for more information and valid values. - **/ - public void setBidiStringType(int bidiStringType) - { - final String property = "bidiStringType"; - - validateProperty(property, Integer.toString(bidiStringType), JDProperties.BIDI_STRING_TYPE); - - properties_.setString(JDProperties.BIDI_STRING_TYPE, Integer.toString(bidiStringType)); - } - - /** - Sets whether bidi implicit reordering is used. - In this version, the parameter is used to determine whether Bidi layout - transformation should be applied to meta-data such as columns names. - @param value true if implicit reordering should be used; false otherwise. - The default value is true. - **/ - public void setBidiImplicitReordering(boolean value) - { - if (value) - properties_.setString(JDProperties.BIDI_IMPLICIT_REORDERING, TRUE_); - else - properties_.setString(JDProperties.BIDI_IMPLICIT_REORDERING, FALSE_); - } - - /** - Sets whether bidi numeric ordering round trip is used. - @param value true if numeric ordering round trip should be used; false otherwise. - The default value is false. - **/ - public void setBidiNumericOrdering(boolean value) - { - if (value) - properties_.setString(JDProperties.BIDI_NUMERIC_ORDERING, TRUE_); - else - properties_.setString(JDProperties.BIDI_NUMERIC_ORDERING, FALSE_); - } - - /** - Sets whether a big decimal value is returned. - @param value true if a big decimal is returned; false otherwise. - The default value is true. - **/ - public void setBigDecimal(boolean value) - { - if (value) - properties_.setString(JDProperties.BIG_DECIMAL, TRUE_); - else - properties_.setString(JDProperties.BIG_DECIMAL, FALSE_); - } - - /** - Sets the criteria for retrieving data from the IBM i system in - blocks of records. Specifying a non-zero value for this property - will reduce the frequency of communication to the system, and - therefore increase performance. - @param blockCriteria The block criteria. -

        Valid values include: -

          -
        • 0 (no record blocking) -
        • 1 (block if FOR FETCH ONLY is specified) -
        • 2 (block if FOR UPDATE is specified) - The default value. -
        - **/ - public void setBlockCriteria(int blockCriteria) - { - final String property = "blockCriteria"; - - validateProperty(property, Integer.toString(blockCriteria), JDProperties.BLOCK_CRITERIA); - - properties_.setString(JDProperties.BLOCK_CRITERIA, Integer.toString(blockCriteria)); - } - - /** - Sets the block size in kilobytes to retrieve from the IBM i system and - cache on the client. This property has no effect unless the block criteria - property is non-zero. Larger block sizes reduce the frequency of - communication to the system, and therefore may increase performance. - @param blockSize The block size in kilobytes. -

        Valid values include: -

          -
        • 0 -
        • 8 -
        • 16 -
        • 32 - The default value. -
        • 64 -
        • 128 -
        • 256 -
        • 512 -
        - **/ - public void setBlockSize(int blockSize) - { - final String property = "blockSize"; - - validateProperty(property, Integer.toString(blockSize), JDProperties.BLOCK_SIZE); - - properties_.setString(JDProperties.BLOCK_SIZE, new Integer(blockSize).toString()); - } - - //@cc1 - /** - * This method sets concurrent access resolution. This method overrides the setting of ConcurrentAccessResolution on the datasource or connection - * URL properties. This method has no effect on - * IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @param concurrentAccessResolution The current access resolution setting. Possible valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public void setConcurrentAccessResolution (int concurrentAccessResolution) - { - String property = "concurrentAccessResolution"; - - validateProperty(property, Integer.toString(concurrentAccessResolution), JDProperties.CONCURRENT_ACCESS_RESOLUTION); - - properties_.setString(JDProperties.CONCURRENT_ACCESS_RESOLUTION, Integer.toString(concurrentAccessResolution)); - } - - /** - Sets the cursor sensitivity to be requested from the database. If the resultSetType is - ResultSet.TYPE_FORWARD_ONLY or ResultSet.TYPE_SCROLL_SENSITIVE, the value of this property - will control what cursor sensitivity is requested from the database. If the resultSetType - is ResultSet.TYPE_SCROLL_INSENSITIVE, this property will be ignored. -

        Valid values include: -

          -
        • "asensitive" -
        • "insensitive" -
        • "sensitive" -
        - The default is "asensitive". - This property is ignored when connecting to systems - running V5R1 and earlier versions of OS/400. - **/ - public void setCursorSensitivity(String cursorSensitivity) - { - final String property = "cursorSensitivity"; - - validateProperty(property, cursorSensitivity, JDProperties.CURSOR_SENSITIVITY); - - properties_.setString(JDProperties.CURSOR_SENSITIVITY, cursorSensitivity); - } - - - /** - Sets whether the cursor is held. - @param cursorHold true if the cursor is held; false otherwise. The default value is true. - **/ - public void setCursorHold(boolean cursorHold) - { - if (cursorHold) - properties_.setString(JDProperties.CURSOR_HOLD, TRUE_); - else - properties_.setString(JDProperties.CURSOR_HOLD, FALSE_); - } - - /** - Sets the databaseName property. - This property is ignored when connecting to systems - running V5R1 and earlier versions of OS/400. - If a database name is specified it must exist in the relational - database directory on the IBM i system. Use IBM i command WRKRDBDIRE - to view the directory. - The following criteria are used to determine - which database is accessed: -
          -
        1. If a database name is specified, that database is used. Attempts - to connect will fail if the database does not exist. -
        2. If special value *SYSBAS is specified, the system default database is used. -
        3. If a database name is not specified, the database specified - in the job description for the user profile is used. -
        4. If a database name is not specified and a database is not specified - in the job description for the user profile, the system default - database is used. -
        - @param databaseName The database name or *SYSBAS. - @throws ExtendedIllegalStateException If the data source is already in use. - **/ - public void setDatabaseName(String databaseName) - { - final String property = "databaseName"; - - if (isInUse()) { - logError("Data source is already in use"); - throw new ExtendedIllegalStateException(property, ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (databaseName == null) - throw new NullPointerException(property); - - properties_.setString(JDProperties.DATABASE_NAME, databaseName); - - connectionKeyNeedsUpdate_ = true; - } - - /** - Sets whether to use data compression. The default value is true. - @param compression true if data compression is used; false otherwise. - **/ - public void setDataCompression(boolean compression) - { - if (compression) - properties_.setString(JDProperties.DATA_COMPRESSION, TRUE_); - else - properties_.setString(JDProperties.DATA_COMPRESSION, FALSE_); - } - - /** - Sets the dataSourceName property. - This property can be used for connection pooling implementations. - dataSourceName is assumed to be bound (via JNDI) to an instance of {@link AS400JDBCManagedConnectionPoolDataSource AS400JDBCManagedConnectionPoolDataSource}. -

        - Note: The properties of the specified datasource will override all similarly-named properties of this object. For example, if the specified datasource has a "serverName" property, then that value will be used by {@link #getConnection getConnection()}, and any value set via {@link #setServerName setServerName()} will be disregarded. -

        - Note: If a dataSourceName is not specified, the {@link #getConnection getConnection()} methods will simply return non-pooled connections. - @param dataSourceName The data source name. - @throws ExtendedIllegalStateException If the data source is already in use. - **/ - public void setDataSourceName(String dataSourceName) - { - final String property = DATASOURCE_NAME; - - if (isInUse()) { - logError("Data source is already in use"); - throw new ExtendedIllegalStateException(property, ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (dataSourceName == null) - throw new NullPointerException(property); - - dataSourceName_ = dataSourceName; - dataSourceNameSpecified_ = true; - - logProperty(property, dataSourceName_); - } - - /** - Sets whether to use data truncation. The default value is true. - @param truncation true if data truncation is used; false otherwise. - **/ - public void setDataTruncation(boolean truncation) - { - if (truncation) - properties_.setString(JDProperties.DATA_TRUNCATION, TRUE_); - else - properties_.setString(JDProperties.DATA_TRUNCATION, FALSE_); - } - - /** - Sets the date format used in date literals within SQL statements. - @param dateFormat The date format. -

        Valid values include: -

          -
        • "mdy" -
        • "dmy" -
        • "ymd" -
        • "usa" -
        • "iso" -
        • "eur" -
        • "jis" -
        • "julian" -
        • "" (server job value) - default. -
        - The default is based on the server job. - **/ - public void setDateFormat(String dateFormat) - { - final String property = "dateFormat"; - - if (dateFormat == null) - throw new NullPointerException(property); - validateProperty(property, dateFormat, JDProperties.DATE_FORMAT); - - properties_.setString(JDProperties.DATE_FORMAT, dateFormat); - } - - /** - Sets the date separator used in date literals within SQL statements. - This property has no effect unless the "data format" property is set to: - "julian", "mdy", "dmy", or "ymd". - @param dateSeparator The date separator. -

        Valid values include: -

          -
        • "/" (slash) -
        • "-" (dash) -
        • "." (period) -
        • "," (comma) -
        • " " (space) -
        • "" (server job value) - default. -
        - The default value is based on the server job. - **/ - public void setDateSeparator(String dateSeparator) - { - final String property = "dateSeparator"; - if (dateSeparator == null) - throw new NullPointerException(property); - validateProperty(property, dateSeparator, JDProperties.DATE_SEPARATOR); - - properties_.setString(JDProperties.DATE_SEPARATOR, dateSeparator); - } - - //@DFA - /** - Sets the decfloat rounding mode. - @param decfloatRoundingMode The decfloat rounding mode. -

        Valid values include: -

          -
        • "half even" - default -
        • "half up" -
        • "down" -
        • "ceiling" -
        • "floor" -
        • "half down" -
        • "up" -
        - **/ - public void setDecfloatRoundingMode(String decfloatRoundingMode) - { - String property = "decfloatRoundingMode"; - if (decfloatRoundingMode == null) - throw new NullPointerException(property); - validateProperty(property, decfloatRoundingMode, JDProperties.DECFLOAT_ROUNDING_MODE); - - getDecfloatRoundingMode(); - - properties_.setString(JDProperties.DECFLOAT_ROUNDING_MODE, decfloatRoundingMode); - } - - /** - Sets the decimal separator used in numeric literals within SQL - statements. - @param decimalSeparator The decimal separator. -

        Valid values include: -

          -
        • "." (period) -
        • "," (comma) -
        • "" (server job value) - default. -
        - The default value is based on the server job. - **/ - public void setDecimalSeparator(String decimalSeparator) - { - final String property = "decimalSeparator"; - if (decimalSeparator == null) - throw new NullPointerException(property); - validateProperty(property, decimalSeparator, JDProperties.DECIMAL_SEPARATOR); - - properties_.setString(JDProperties.DECIMAL_SEPARATOR, decimalSeparator); - } - - //@igwrn - /** - * Sets the ignore warnings property. - * @param ignoreWarnings Specifies a list of SQL states for which the driver should not create warning objects. - **/ - public void setIgnoreWarnings(String ignoreWarnings) - { - String property = "ignoreWarnings"; - if (ignoreWarnings == null) - throw new NullPointerException(property); - - properties_.setString(JDProperties.IGNORE_WARNINGS, ignoreWarnings); - } - - /** - Sets the data source description. - @param description The description. - **/ - public void setDescription(String description) - { - final String property = DESCRIPTION; - if (description == null) - throw new NullPointerException(property); - - description_ = description; - logProperty(property, description_); - } - - /** - Sets how the IBM i system sorts records before sending them to the client. - @param sort The sort value. -

        Valid values include: -

          -
        • "hex" (base the sort on hexadecimal values) -
        • "language" (base the sort on the language set in the sort language property) -
        • "table" (base the sort on the sort sequence table set in the sort table property). -
        - The default value is "hex". - **/ - public void setSort(String sort) - { - final String property = "sort"; - if (sort == null) - throw new NullPointerException(property); - - //@JOB fix to allow "sort=job" but use default value - if(sort.equals("job")) //@JOB - { //@JOB - if (JDTrace.isTraceOn()) //@JOB - JDTrace.logInformation (this, property + ": " + getSort() + " (warning: " + getSort() + " will be used since sort=job is not valid)"); //@JOB - return; //return and allow default setting to be used //@JOB - } //@JOB - - validateProperty(property, sort, JDProperties.SORT); - - properties_.setString(JDProperties.SORT, sort); - } - - /** - Sets the amount of detail to be returned in the message for errors - occurring on the IBM i system. - @param errors The error message level. - Valid values include: "basic" and "full". The default value is "basic". - **/ - public void setErrors(String errors) - { - final String property = "errors"; - if (errors == null) - throw new NullPointerException(property); - validateProperty(property, errors, JDProperties.ERRORS); - - properties_.setString(JDProperties.ERRORS, errors); - } - - /** - Sets whether to use extended dynamic support. Extended dynamic - support provides a mechanism for caching dynamic SQL statements on - the IBM i system. The first time a particular SQL statement is prepared, it is - stored in an SQL package on the system. - If the package does not exist, it will be automatically created. - On subsequent prepares of the - same SQL statement, the system can skip a significant part of the - processing by using information stored in the SQL package. If this - is set to "true", then a package name must be set using the "package" - property. - @param extendedDynamic If extended dynamic support is used; false otherwise. - The default value is not to use extended dynamic support. - **/ - public void setExtendedDynamic(boolean extendedDynamic) - { - if (extendedDynamic) - properties_.setString(JDProperties.EXTENDED_DYNAMIC, TRUE_); - else - properties_.setString(JDProperties.EXTENDED_DYNAMIC, FALSE_); - } - - /** - Sets whether the driver should request extended metadata from the - IBM i system. This property is ignored when connecting to systems - running V5R1 and earlier versions of OS/400. - If this property is set to true and connecting to a system running - V5R2 or later version of IBM i, the accuracy of the information - that is returned from ResultSetMetaData methods getColumnLabel(int), - isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased. - In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this - property set to true. However, performance will be slower with this - property on. Leave this property set to its default (false) unless you - need more specific information from those methods. - * - For example, without this property turned on, isSearchable(int) will - always return true even though the correct answer may be false because - the driver does not have enough information from the system to make a judgment. Setting - this property to true forces the driver to get the correct data from the system. - * - @param extendedMetaData True to request extended metadata from the system, false otherwise. - The default value is false. - **/ - public void setExtendedMetaData(boolean extendedMetaData) - { - if (extendedMetaData) - properties_.setString(JDProperties.EXTENDED_METADATA, TRUE_); - else - properties_.setString(JDProperties.EXTENDED_METADATA, FALSE_); - } - - - - //@dup - /** - * Sets whether the driver should request extended metadata from the - * IBM i system. This property is ignored when connecting to systems - * running OS/400 V5R1 and earlier. - * If this property is set to true and connecting to a system running - * OS/400 V5R2 or IBM i, the accuracy of the information - * that is returned from ResultSetMetaData methods getColumnLabel(int), - * isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased. - * In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this - * property set to true. However, performance will be slower with this - * property on. Leave this property set to its default (false) unless you - * need more specific information from those methods. - * - * For example, without this property turned on, isSearchable(int) will - * always return true even though the correct answer may be false because - * the driver does not have enough information from the system to make a judgment. Setting - * this property to true forces the driver to get the correct data from the system. - * - * @param extendedMetaData True to request extended metadata from the system, false otherwise. - * The default value is false. - * Note: this method is the same as setExtendedMetaData() so that it corresponds to the connection property name - **/ - public void setExtendedMetadata(boolean extendedMetaData) - { - setExtendedMetaData(extendedMetaData); - } - - - /** - Sets whether to fully open a file when performing a query. - By default the IBM i system optimizes opens so they perform better. - In most cases optimization functions correctly and improves - performance. Running a query repeatedly - when a database performance monitor is turned on may fail - because of the optimization, however. - Leave this property set to its default (false) until - you experience errors running queries with monitors - turned on. At that time set the property to true which - will disable the optimization. - @param fullOpen True to fully open a file (turn off optimizations), false - to allow optimizations. The default value is false. - **/ - public void setFullOpen(boolean fullOpen) - { - if (fullOpen) - properties_.setString(JDProperties.FULL_OPEN, TRUE_); - else - properties_.setString(JDProperties.FULL_OPEN, FALSE_); - } - - - /** - Sets the "hold input locators" property - @param hold True to hold input locators. The default value is true. - **/ - public void setHoldInputLocators(boolean hold) - { - if (hold) - properties_.setString(JDProperties.HOLD_LOCATORS, TRUE_); - else - properties_.setString(JDProperties.HOLD_LOCATORS, FALSE_); - } - - - /** - Sets the "hold statements" property - @param hold True to hold statements. The default value is false. - **/ - public void setHoldStatements(boolean hold) - { - if (hold) - properties_.setString(JDProperties.HOLD_STATEMENTS, TRUE_); - else - properties_.setString(JDProperties.HOLD_STATEMENTS, FALSE_); - } - - //@dmy - /** - * Indicates whether the temporary fix for JVM 1.6 is enabled. - * @param value true if JVM 1.6 fix is enabled; false otherwise. - * The default value is true. - **/ - public void setJvm16Synchronize(boolean value) - { - if (value) - properties_.setString(JDProperties.JVM16_SYNCHRONIZE, TRUE_); - else - properties_.setString(JDProperties.JVM16_SYNCHRONIZE, FALSE_); - } - - /** - Sets whether to delay closing cursors until subsequent requests. - @param lazyClose true to delay closing cursors until subsequent requests; false otherwise. - The default value is false. - **/ - public void setLazyClose(boolean lazyClose) - { - if (lazyClose) - properties_.setString(JDProperties.LAZY_CLOSE, TRUE_); - else - properties_.setString(JDProperties.LAZY_CLOSE, FALSE_); - } - - /** - Sets the libraries to add to the server job's library list. - The libraries are delimited by commas or spaces, and - "*LIBL" may be used as a place holder for the server job's - current library list. The library list is used for resolving - unqualified stored procedure calls and finding schemas in - DatabaseMetaData catalog methods. If "*LIBL" is not specified, - the specified libraries will replace the server job's - current library list. - @param libraries The library list. - **/ - public void setLibraries(String libraries) - { - final String property = "libraries"; - if (libraries == null) - throw new NullPointerException(property); - properties_.setString(JDProperties.LIBRARIES, libraries); - } - - /** - Sets the maximum LOB (large object) size in bytes that - can be retrieved as part of a result set. LOBs that are larger - than this threshold will be retrieved in pieces using extra - communication to the IBM i system. Larger LOB thresholds will reduce - the frequency of communication to the system, but will download - more LOB data, even if it is not used. Smaller LOB thresholds may - increase frequency of communication to the system, but will only - download LOB data as it is needed. - * - @param threshold The lob threshold. Valid range is 0-16777216. - The default value is 32768. - **/ - public void setLobThreshold(int threshold) - { - final String property = "threshold"; - if (threshold < 0 || threshold > MAX_THRESHOLD) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - properties_.setString(JDProperties.LOB_THRESHOLD, new Integer(threshold).toString()); - } - - // method required by javax.sql.DataSource - /** - Sets the maximum time in seconds that this data source can wait while attempting to connect to a database. - A value of zero specifies that the timeout is the system default if one exists; otherwise it specifies that - there is no timeout. The default value is initially zero. -
        Note: This value is not used or supported by the Toolbox JDBC driver. - Rather, the timeout value is determined by the IBM i system. - @param timeout The login timeout in seconds. - **/ - public void setLoginTimeout(int timeout) throws SQLException - { - //This sets the socket timeout - //@STIMEOUT setSoTimeout(timeout * 1000); //@STIMEOUT separate login and socket timeout into two separtate properties - - properties_.setString(JDProperties.LOGIN_TIMEOUT, Integer.toString(timeout)); - } - - // method required by javax.sql.DataSource - /** - Sets the log writer for this data source. -

        Note: The specified PrintWriter might not be retained when an object is obtained via JNDI, that is, by a call to javax.naming.Context.lookup(). Therefore, use this method only on the DataSource object that is used directly by your application (rather than on the "template" DataSource object that was bound in JNDI). - @param writer The log writer; to disable, set to null. - @throws SQLException If a database error occurs. - **/ - public void setLogWriter(PrintWriter writer) throws SQLException - { - writer_ = writer; - logProperty("logWriter", (writer_ == null ? "null" : writer_.toString())); - - if (writer == null) - { - log_ = null; - } - else - { - log_ = new EventLog(writer); - } - } - - //@PDA - /** - * Sets how to retrieve DatabaseMetaData. - * If set to 0, database metadata will be retrieved through the ROI data flow. - * If set to 1, database metadata will be retrieved by calling system stored procedures. - * The methods that currently are available through stored procedures are: - * getColumnPrivileges - * @param mds The setting for metadata source - * The default value is 1. - **/ - public void setMetaDataSource(int mds) - { - Integer newValue = new Integer(mds); - - properties_.setString(JDProperties.METADATA_SOURCE, newValue.toString()); - - } - - //@dup - /** - * Sets how to retrieve DatabaseMetaData. - * If set to 0, database metadata will be retrieved through the ROI data flow. - * If set to 1, database metadata will be retrieved by calling system stored procedures. - * The methods that currently are available through stored procedures are: - * getColumnPrivileges - * @param mds The setting for metadata source - * The default value is 1. - * Note: this method is the same as setMetaDataSource() so that it corresponds to the connection property name - **/ - public void setMetadataSource(int mds) - { - setMetaDataSource(mds); - } - - - /** - Sets the naming convention used when referring to tables. - @param naming The naming convention. Valid values include: "sql" (e.g. schema.table) - and "system" (e.g. schema/table). The default value is "sql". - **/ - public void setNaming(String naming) - { - final String property = "naming"; - if (naming == null) - throw new NullPointerException(property); - validateProperty(property, naming, JDProperties.NAMING); - - properties_.setString(JDProperties.NAMING, naming); - } - - /** - Sets the base name of the SQL package. Note that only the - first six characters are used to generate the name of the SQL package on the IBM i system. - This property has no effect unless - the extended dynamic property is set to true. In addition, this property - must be set if the extended dynamic property is set to true. - @param packageName The base name of the SQL package. - **/ - public void setPackage(String packageName) - { - final String property = "packageName"; - if (packageName == null) - throw new NullPointerException(property); - - properties_.setString(JDProperties.PACKAGE, packageName); - } - - /** - Sets whether to add newly prepared statements to the SQL package - specified on the "package" property. This property - has no effect unless the extended dynamic property is set to true. - @param add True if newly prepared statements should be added to the SQL package specified on - the "package" property; false otherwise. - The default value is true. - **/ - public void setPackageAdd(boolean add) - { - if (add) - properties_.setString(JDProperties.PACKAGE_ADD, TRUE_); - else - properties_.setString(JDProperties.PACKAGE_ADD, FALSE_); - } - - /** - Sets whether to cache a subset of the SQL package information in client memory. - Caching SQL packages locally - reduces the amount of communication to the IBM i system for prepares and describes. This - property has no effect unless the extended dynamic property is set to true. - @param cache True if caching is used; false otherwise. The default value is false. - **/ - public void setPackageCache(boolean cache) - { - if (cache) - properties_.setString(JDProperties.PACKAGE_CACHE, TRUE_); - else - properties_.setString(JDProperties.PACKAGE_CACHE, FALSE_); - } - - /** - Sets whether to clear SQL packages when they become full. This method - has been deprecated. Package clearing and the decision for the - threshold where package clearing is needed is now handled - automatically by the database. - @param clear If the SQL package are cleared when full; false otherwise. - @deprecated - **/ - public void setPackageClear(boolean clear) - { - } - - /** - Sets the type of SQL statement to be stored in the SQL package. This can - be useful to improve the performance of complex join conditions. This - property has no effect unless the extended dynamic property is set to true. - @param packageCriteria The type of SQL statement. - Valid values include: "default" (only store SQL statements with parameter - markers in the package), and "select" (store all SQL SELECT statements - in the package). The default value is "default". - **/ - public void setPackageCriteria(String packageCriteria) - { - final String property = "packageCriteria"; - - if (packageCriteria == null) - throw new NullPointerException(property); - validateProperty(property, packageCriteria, JDProperties.PACKAGE_CRITERIA); - - properties_.setString(JDProperties.PACKAGE_CRITERIA, packageCriteria); - } - - /** - Sets the action to take when SQL package errors occur. When an SQL package - error occurs, the driver will optionally throw an SQLException or post a - warning to the Connection, based on the value of this property. This property - has no effect unless the extended dynamic property is set to true. - @param packageError The action when SQL errors occur. - Valid values include: "exception", "warning", and "none". The default value is "warning". - **/ - public void setPackageError(String packageError) - { - final String property = "packageError"; - if (packageError == null) - throw new NullPointerException(property); - validateProperty(property, packageError, JDProperties.PACKAGE_ERROR); - - properties_.setString(JDProperties.PACKAGE_ERROR, packageError); - } - - /** - Sets the library for the SQL package. This property has no effect unless - the extended dynamic property is set to true. - @param packageLibrary The SQL package library. The default package library is "QGPL". - **/ - public void setPackageLibrary(String packageLibrary) - { - final String property = "packageLibrary"; - if (packageLibrary == null) - throw new NullPointerException(property); - - properties_.setString(JDProperties.PACKAGE_LIBRARY, packageLibrary); - } - - /** - Sets the 'password' property. - @param password The password. - **/ - public void setPassword(String password) - { - final String property = "password"; - if (password == null) - throw new NullPointerException(property); - - char[] newSerialPWBytes = xpwConfuse(password); - if (!Arrays.equals(newSerialPWBytes, serialPWBytes_)) { - as400_.setPassword(password); - invalidate(getUser(), serialPWBytes_); // invalidate any pooled connections with old password - serialPWBytes_ = newSerialPWBytes; - pwHashcode_ = password.hashCode(); - - connectionKeyNeedsUpdate_ = true; - // Note: We deliberately do _not_ store the password into properties_. - } - logInformation(ResourceBundleLoader.getText("AS400_JDBC_DS_PASSWORD_SET")); - logProperty(property, "***"); - } - - /** - Sets whether to prefetch data upon executing a SELECT statement. - This will increase performance when accessing the initial rows in the result set. - @param prefetch If prefetch is used; false otherwise. - The default value is to prefectch data. - **/ - public void setPrefetch(boolean prefetch) - { - if (prefetch) - properties_.setString(JDProperties.PREFETCH, TRUE_); - else - properties_.setString(JDProperties.PREFETCH, FALSE_); - } - - /** - Sets whether the user should be prompted if a user name or password is - needed to connect to the IBM i system. If a connection can not be made - without prompting the user, and this property is set to false, then an - attempt to connect will fail. - @param prompt true if the user is prompted for signon information; false otherwise. - The default value is false. - **/ - public void setPrompt(boolean prompt) - { - if (prompt) - properties_.setString(JDProperties.PROMPT, TRUE_); - else - properties_.setString(JDProperties.PROMPT, FALSE_); - - try - { - as400_.setGuiAvailable(prompt); - } - catch (PropertyVetoException vp) {} // this will never happen - } - - //@PDA - /** - * Sets the properties based on ";" delimited string of properties, in same - * fashion as URL properties specified with - * DriverManager.getConnection(urlProperties). This method simply parses - * property string and then calls setPropertes(Properties). This method is - * intended as an enhancement so that the user does not have to write new - * code to call the setters for new/deleted properties. - * - * @param propertiesString list of ";" delimited properties - */ - public void setProperties(String propertiesString) - { - //use existing JDDatasourceURL to parse properties string like Connection does - //but first have to add dummy protocol so we can re-use parsing code - propertiesString = "jdbc:as400://dummyhost;" + propertiesString; - JDDataSourceURL dsURL = new JDDataSourceURL(propertiesString); - //returns only properties specified in propertyString.. (none of - // JDProperties defaults) - Properties properties = dsURL.getProperties(); - setProperties(properties); - } - - //@PDA - /** - * Sets the properties for this datasource. This method is intended as an - * enhancement so that the user does not have to write new code to call the - * setters for new/deleted properties. - * - * @param newProperties object containing updated property values - */ - public void setProperties(Properties newProperties) - { - //1. turn on/off tracing per new props - //2. set needed AS400JDBCManagedDataSource instance variables - //3. set socket props - //4. propagate newProperties to existing properties_ object - - // Check first thing to see if the trace property is - // turned on. This way we can trace everything, including - // the important stuff like loading the properties. - - // If trace property was set to true, turn on tracing. If trace property - // was set to false, - // turn off tracing. If trace property was not set, do not change. - if (JDProperties.isTraceSet(newProperties, null) == JDProperties.TRACE_SET_ON) - { - if (!JDTrace.isTraceOn()) - JDTrace.setTraceOn(true); - } else if (JDProperties.isTraceSet(newProperties, null) == JDProperties.TRACE_SET_OFF) - { - if (JDTrace.isTraceOn()) - JDTrace.setTraceOn(false); - } - - // If toolbox trace is set to datastream. Turn on datastream tracing. - if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_DATASTREAM) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDatastreamOn(true); - } - // If toolbox trace is set to diagnostic. Turn on diagnostic tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_DIAGNOSTIC) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceDiagnosticOn(true); - } - // If toolbox trace is set to error. Turn on error tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_ERROR) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceErrorOn(true); - } - // If toolbox trace is set to information. Turn on information tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_INFORMATION) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceInformationOn(true); - } - // If toolbox trace is set to warning. Turn on warning tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_WARNING) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceWarningOn(true); - } - // If toolbox trace is set to conversion. Turn on conversion tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_CONVERSION) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceConversionOn(true); - } - // If toolbox trace is set to proxy. Turn on proxy tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_PROXY) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceProxyOn(true); - } - // If toolbox trace is set to pcml. Turn on pcml tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_PCML) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTracePCMLOn(true); - } - // If toolbox trace is set to jdbc. Turn on jdbc tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_JDBC) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceJDBCOn(true); - } - // If toolbox trace is set to all. Turn on tracing for all categories. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_ALL) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceAllOn(true); - } - // If toolbox trace is set to thread. Turn on thread tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_THREAD) - { - if (!Trace.isTraceOn()) - { - Trace.setTraceOn(true); - } - Trace.setTraceThreadOn(true); - } - // If toolbox trace is set to none. Turn off tracing. - else if (JDProperties.isToolboxTraceSet(newProperties, null) == JDProperties.TRACE_TOOLBOX_NONE) - { - if (Trace.isTraceOn()) - { - Trace.setTraceOn(false); - } - } - - //next we need to set instance vars (via setX() methods) - //or setup socket properties or set in properties_ - //Note: this is similar to AS400JDBCManagedDataSource(Reference reference)logic - - Enumeration e = newProperties.keys(); - while (e.hasMoreElements()) - { - String propertyName = (String) e.nextElement(); - String propertyValue = (String) newProperties.getProperty(propertyName); - - int propIndex = JDProperties.getPropertyIndex(propertyName); - - //some of the setter methods also set the properties_ below - if (propIndex == JDProperties.DATABASE_NAME) - setDatabaseName(propertyValue); - else if (propIndex == JDProperties.USER) - setUser(propertyValue); - else if (propIndex == JDProperties.PASSWORD) - setPassword(properties_.getString(JDProperties.PASSWORD)); - else if (propIndex == JDProperties.SECURE) - setSecure(propertyValue.equals(TRUE_) ? true : false); - else if (propIndex == JDProperties.KEEP_ALIVE) - setKeepAlive(propertyValue.equals(TRUE_) ? true : false); - else if (propIndex == JDProperties.RECEIVE_BUFFER_SIZE) - setReceiveBufferSize(Integer.parseInt(propertyValue)); - else if (propIndex == JDProperties.SEND_BUFFER_SIZE) - setSendBufferSize(Integer.parseInt(propertyValue)); - else if (propIndex == JDProperties.PROMPT) - setPrompt(propertyValue.equals(TRUE_) ? true : false); - else if (propIndex == JDProperties.KEY_RING_NAME){ - //at this time, decided to not allow this due to security and fact that there is no setKeyRingName() method - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Property: " + propertyName + " can only be changed in AS400JDBCManagedDataSource constructor"); - } else if (propIndex == JDProperties.KEY_RING_PASSWORD){ - //at this time, decided to not allow this due to security and fact that there is no setKeyRingPassword() method - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Property: " + propertyName + " can only be changed in AS400JDBCManagedDataSource constructor"); - } else if (propIndex != -1) - { - properties_.setString(propIndex, propertyValue); - } - } - } - - - /** - Sets the name of the proxy server. - @param proxyServer The proxy server. - **/ - public void setProxyServer(String proxyServer) - { - final String property = "proxyServer"; - if (proxyServer == null) - throw new NullPointerException(property); - - properties_.setString(JDProperties.PROXY_SERVER, proxyServer); - } - - /** - Sets the "query optimize goal" property - @param goal - the optimization goal -

        Valid values include: -

          -
        • 0 = Optimize query for first block of data (*ALLIO) when extended dynamic packages are used; Optimize query for entire result set (*FIRSTIO) when packages are not used
        • -
        • 1 = Optimize query for first block of data (*FIRSTIO)
        • -
        • 2 = Optimize query for entire result set (*ALLIO)
        • -
        - The default value is 0. - **/ - public void setQueryOptimizeGoal(int goal) - { - String property = "queryOptimizeGoal"; - validateProperty(property, Integer.toString(goal), JDProperties.QUERY_OPTIMIZE_GOAL); - - properties_.setString(JDProperties.QUERY_OPTIMIZE_GOAL, Integer.toString(goal)); - } - - //@550 - /** - * Sets the storage limit in megabytes, that should be used for statements executing a query in a connection. - * Note, this setting is ignored when running to i5/OS V5R4 or earlier - * @param limit - the storage limit (in megabytes) - *

        Valid values are -1 to MAX_STORAGE_LIMIT megabytes. - * The default value is -1 meaning there is no limit. - **/ - public void setQueryStorageLimit(int limit) - { - String property = "queryStorageLimit"; - - if (limit < -1 || limit > MAX_STORAGE_LIMIT) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - properties_.setString(JDProperties.QUERY_STORAGE_LIMIT, Integer.toString(limit)); - } - - /** - Sets the source of the text for REMARKS columns in ResultSets returned - by DatabaseMetaData methods. - @param remarks The text source. - Valid values include: "sql" (SQL object comment) and "system" (IBM i object description). - The default value is "system". - **/ - public void setRemarks(String remarks) - { - final String property = "remarks"; - if (remarks == null) - throw new NullPointerException(property); - validateProperty(property, remarks, JDProperties.REMARKS); - - properties_.setString(JDProperties.REMARKS, remarks); - } - - /** - Sets the "rollback cursor hold" property - @param hold True to hold cursor across rollbacks. The default value is false. - **/ - public void setRollbackCursorHold(boolean hold) - { - if (hold) - properties_.setString(JDProperties.ROLLBACK_CURSOR_HOLD, TRUE_); - else - properties_.setString(JDProperties.ROLLBACK_CURSOR_HOLD, FALSE_); - } - - /** - Sets the secondary URL to be used for a connection on the middle-tier's - DriverManager in a multiple tier environment, if it is different than - already specified. This property allows you to use this driver to connect - to databases other than DB2 for IBM i. Use a backslash as an escape character - before backslashes and semicolons in the URL. - @param url The secondary URL. - **/ - public void setSecondaryUrl(String url) - { - if (url == null) - throw new NullPointerException("url"); - - properties_.setString(JDProperties.SECONDARY_URL, url); - } - - //@dup - /** - * Sets the secondary URL to be used for a connection on the middle-tier's - * DriverManager in a multiple tier environment, if it is different than - * already specified. This property allows you to use this driver to connect - * to databases other than DB2 for IBM i. Use a backslash as an escape character - * before backslashes and semicolons in the URL. - * @param url The secondary URL. - * Note: this method is the same as setSecondaryUrl() so that it corresponds to the connection property name - **/ - public void setSecondaryURL(String url) - { - setSecondaryUrl(url); - } - - - /** - Sets whether a Secure Socket Layer (SSL) connection is used to communicate - with the IBM i system. SSL connections are only available when connecting to systems - at V4R4 or later. - @param secure true if Secure Socket Layer connection is used; false otherwise. - The default value is false. - @throws ExtendedIllegalStateException If the data source was constructed with a keyring and secure is false. - **/ - public void setSecure(boolean secure) - { - // Do not allow user to change to not secure if they constructed the data source with - // a keyring. - if (!secure && isSecure_) - { - throw new ExtendedIllegalStateException("secure", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // Keep local copy for convenience. - isSecure_ = secure; - - if (secure) - properties_.setString(JDProperties.SECURE, TRUE_); - else - properties_.setString(JDProperties.SECURE, FALSE_); - } - - - //@pw3 - /** - * Sets whether to disallow "" and *current as user name and password. - * True indicates to disallow "" and *current for user name and password. - * @param secureCurrentUser The secure current user setting. - **/ - public void setSecureCurrentUser(boolean secureCurrentUser) - { - if (secureCurrentUser) - properties_.setString(JDProperties.SECURE_CURRENT_USER, TRUE_); - else - properties_.setString(JDProperties.SECURE_CURRENT_USER, FALSE_); - } - - - /** - Sets the serverName property. - @param serverName The system name. - @throws ExtendedIllegalStateException If the data source is already in use. - **/ - public void setServerName(String serverName) - { - final String property = SERVER_NAME; - - if (isInUse()) { - logError("Data source is already in use"); - throw new ExtendedIllegalStateException(property, ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (serverName == null) - throw new NullPointerException(property); - - // Save away the name to serialize. - serialServerName_ = serverName; // Note: There is no associated JDProperties entry. - - try - { - as400_.setSystemName(serverName); - } - catch (PropertyVetoException pv) {} // will never happen - - connectionKeyNeedsUpdate_ = true; - - logProperty(property, as400_.getSystemName()); - } - - - /** - Enables tracing of the JDBC server job. - If tracing is enabled, tracing is started when - the client connects to the IBM i system, and ends when the connection - is disconnected. Tracing must be started before connecting to - the system since the client enables tracing only at connect time. - * -

        - Trace data is collected in spooled files on the system. Multiple - levels of tracing can be turned on in combination by adding - the constants and passing that sum on the set method. For example, -

        -   dataSource.setServerTraceCategories(AS400JDBCManagedDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCManagedDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
        -   
        - @param traceCategories level of tracing to start. -

        Valid values include: -

          -
        • SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job. - The numeric value of this constant is 2. -
        • SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job. - The numeric value of this constant is 4. -
        • SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends. - The numeric value of this constant is 8. -
        • SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job. - The numeric value of this constant is 16. -
        • SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information. - The numeric value of this constant is 32. -
        -

        - Tracing the JDBC server job will use significant amounts of system resources. - Additional processor resource is used to collect the data, and additional - storage is used to save the data. Turn on tracing only to debug - a problem as directed by IBM service. - * - * - **/ - public void setServerTraceCategories(int traceCategories) - { - properties_.setString(JDProperties.TRACE_SERVER, Integer.toString(traceCategories)); - } - - /** - Enables tracing of the JDBC server job. - If tracing is enabled, tracing is started when - the client connects to the IBM i system, and ends when the connection - is disconnected. Tracing must be started before connecting to - the system since the client enables tracing only at connect time. - * -

        - Trace data is collected in spooled files on the system. Multiple - levels of tracing can be turned on in combination by adding - the constants and passing that sum on the set method. For example, -

        -   dataSource.setServerTraceCategories(AS400JDBCManagedDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCManagedDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
        -   
        - @param traceCategories level of tracing to start. -

        Valid values include: -

          -
        • SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job. - The numeric value of this constant is 2. -
        • SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job. - The numeric value of this constant is 4. -
        • SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends. - The numeric value of this constant is 8. -
        • SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job. - The numeric value of this constant is 16. -
        • SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information. - The numeric value of this constant is 32. -
        -

        - Tracing the JDBC server job will use significant amounts of system resources. - Additional processor resource is used to collect the data, and additional - storage is used to save the data. Turn on tracing only to debug - a problem as directed by IBM service. - * Note: this method is the same as setServerTraceCategories() so that it corresponds to the connection property name - **/ - public void setServerTrace(int traceCategories) - { - setServerTraceCategories(traceCategories); - } - - /** - Sets the JDBC driver implementation. - This property has no - effect if the "secondary URL" property is set. - This property cannot be set to "native" if the - environment is not an IBM i Java Virtual - Machine. - param driver The driver value. -

        Valid values include: -

          -
        • "toolbox" (use the IBM Toolbox for Java JDBC driver) -
        • "native" (use the IBM Developer Kit for Java JDBC driver) -
        - The default value is "toolbox". - Note: Not supported in a connection pool. - **/ - public void setDriver(String driver) - { - final String property = "driver"; - if (driver == null) - throw new NullPointerException(property); - - validateProperty(property, driver, JDProperties.DRIVER); - - properties_.setString(JDProperties.DRIVER, driver); - } - - /** - Sets whether to save the password locally with the rest of the properties when - this data source object is serialized. -

        - If the password is saved, it is up to the application to protect - the serialized form of the object because it contains all necessary - information to connect to the IBM i system. The default is false. It - is a security risk to save the password with the rest of the - properties so by default the password is not saved. If the application - programmer chooses to accept this risk, set this property to true - to force the Toolbox to save the password with the other properties - when the data source object is serialized. - * - @param savePassword true if the password is saved; false otherwise. - The default value is false - **/ - public void setSavePasswordWhenSerialized(boolean savePassword) - { - final String property = "savePasswordWhenSerialized"; - - savePasswordWhenSerialized_ = savePassword; - - logProperty(property, String.valueOf(savePasswordWhenSerialized_)); //@jvm13 Boolean.toString(savePasswordWhenSerialized_)); - } - - //@STIMEOUT - /** - * This property enables/disables socket timeout with the - * specified value in milliseconds. A timeout value must be - * greater than zero, a value of zero for this property indicates - * infinite timeout. - * @param milliseconds The socket timeout option value. - **/ - public void setSocketTimeout(int milliseconds) - { - setSoTimeout(milliseconds); - } - - /** - Sets the three-character language id to use for selection of a sort sequence. - This property has no effect unless the sort property is set to "language". - @param language The three-character language id. - The default value is ENU. - **/ - public void setSortLanguage(String language) - { - if (language == null) - throw new NullPointerException("language"); - - properties_.setString(JDProperties.SORT_LANGUAGE, language); - } - - /** - Sets the library and file name of a sort sequence table stored on the - IBM i system. - This property has no effect unless the sort property is set to "table". - The default is an empty String (""). - @param table The qualified sort table name. - **/ - public void setSortTable(String table) - { - if (table == null) - throw new NullPointerException("table"); - - properties_.setString(JDProperties.SORT_TABLE, table); - } - - /** - Sets how the IBM i system treats case while sorting records. This property - has no effect unless the sort property is set to "language". - @param sortWeight The sort weight. - Valid values include: "shared" (upper- and lower-case characters are sorted as the - same character) and "unique" (upper- and lower-case characters are sorted as - different characters). The default value is "shared". - **/ - public void setSortWeight(String sortWeight) - { - final String property = "sortWeight"; - if (sortWeight == null) - throw new NullPointerException(property); - - validateProperty(property, sortWeight, JDProperties.SORT_WEIGHT); - - properties_.setString(JDProperties.SORT_WEIGHT, sortWeight); - } - - /** - Sets whether a thread is used. - @param threadUsed true if a thread is used; false otherwise. - The default value is true. - **/ - public void setThreadUsed(boolean threadUsed) - { - if (threadUsed) - properties_.setString(JDProperties.THREAD_USED, TRUE_); - else - properties_.setString(JDProperties.THREAD_USED, FALSE_); - } - - /** - Sets the time format used in time literals with SQL statements. - @param timeFormat The time format. -

        Valid values include: -

          -
        • "hms" -
        • "usa" -
        • "iso" -
        • "eur" -
        • "jis" -
        • "" (server job value) - default. -
        - The default value is based on the server job. - **/ - public void setTimeFormat(String timeFormat) - { - final String property = "timeFormat"; - if (timeFormat == null) - throw new NullPointerException(property); - validateProperty(property, timeFormat, JDProperties.TIME_FORMAT); - - properties_.setString(JDProperties.TIME_FORMAT, timeFormat); - } - - /** - Sets the time separator used in time literals within SQL statements. - This property has no effect unless the time format property is set to "hms". - @param timeSeparator The time separator. -

        Valid values include: -

          -
        • ":" (colon) -
        • "." (period) -
        • "," (comma) -
        • " " (space) -
        • "" (server job value) - default. -
        - The default value is based on the server job. - **/ - public void setTimeSeparator(String timeSeparator) - { - final String property = "timeSeparator"; - if (timeSeparator == null) - throw new NullPointerException(property); - validateProperty(property, timeSeparator, JDProperties.TIME_SEPARATOR); - - properties_.setString(JDProperties.TIME_SEPARATOR, timeSeparator); - } - - /** - Sets whether trace messages should be logged. Trace messages are - useful for debugging programs that call JDBC. However, there is a - performance penalty associated with logging trace messages, so this - property should only be set to true for debugging. Trace messages - are logged to System.out. - @param trace true if trace message are logged; false otherwise. - The default value is false. - **/ - public void setTrace(boolean trace) - { - if (trace) - properties_.setString(JDProperties.TRACE, TRUE_); - else - properties_.setString(JDProperties.TRACE, FALSE_); - - if (trace) - { - if (!JDTrace.isTraceOn ()) - JDTrace.setTraceOn (true); - } - else - JDTrace.setTraceOn (false); - } - - - /** - Sets the IBM i system's transaction isolation. - @param transactionIsolation The transaction isolation level. -

        Valid values include: -

          -
        • "none" -
        • "read uncommitted" - The default value. -
        • "read committed" -
        • "repeatable read" -
        • "serializable" -
        - **/ - public void setTransactionIsolation(String transactionIsolation) - { - final String property = "transactionIsolation"; - - if (transactionIsolation == null) - throw new NullPointerException(property); - validateProperty(property, transactionIsolation, JDProperties.TRANSACTION_ISOLATION); - - properties_.setString(JDProperties.TRANSACTION_ISOLATION, transactionIsolation); - } - - /** - Sets whether binary data is translated. If this property is set - to true, then BINARY and VARBINARY fields are treated as CHAR and - VARCHAR fields. - @param translate true if binary data is translated; false otherwise. - The default value is false. - **/ - public void setTranslateBinary(boolean translate) - { - if (translate) - properties_.setString(JDProperties.TRANSLATE_BINARY, TRUE_); - else - properties_.setString(JDProperties.TRANSLATE_BINARY, FALSE_); - } - - //@PDA - /** - * Sets how Boolean objects are interpreted when setting the value - * for a character field/parameter using the PreparedStatement.setObject(), - * CallableStatement.setObject() or ResultSet.updateObject() methods. Setting the - * property to "true", would store the Boolean object in the character field as either - * "true" or "false". Setting the property to "false", would store the Boolean object - * in the character field as either "1" or "0". - * @param translate if boolean data is translated; false otherwise. - * The default value is true. - **/ - public void setTranslateBoolean(boolean translate) - { - if (translate) - properties_.setString(JDProperties.TRANSLATE_BOOLEAN, TRUE_); - else - properties_.setString(JDProperties.TRANSLATE_BOOLEAN, FALSE_); - } - - - /** - Sets the 'user' property. - @param user The user. - @throws ExtendedIllegalStateException If the data source is already in use. - **/ - public void setUser(String user) - { - final String property = "user"; - - if (isInUse()) { - logError("Data source is already in use"); - throw new ExtendedIllegalStateException(property, ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // save away the user to serialize - serialUserName_ = user; - - properties_.setString(JDProperties.USER, user); - - try { - as400_.setUserId(user); - } - catch (PropertyVetoException vp) {} // this will never happen - - connectionKeyNeedsUpdate_ = true; - } - - /** - Sets whether lock sharing is allowed for loosely coupled transaction branches. - Note, this setting is ignored when running to V5R3 IBM i or earlier. - @param lcs - the "XA loosely coupled support" setting -

        Valid values include: -

          -
        • 0 = Locks cannot be shared
        • -
        • 1 = Locks can be shared
        • -
        - The default value is 0. - **/ - public void setXALooselyCoupledSupport(int lcs) - { - String property = "xaLooselyCoupledSupport"; - validateProperty(property, Integer.toString(lcs), JDProperties.XA_LOOSELY_COUPLED_SUPPORT); - - properties_.setString(JDProperties.XA_LOOSELY_COUPLED_SUPPORT, Integer.toString(lcs)); - } - - - /** - Gets the socket 'keepalive' option. - @return The value of the keepalive option. - **/ - public boolean isKeepAlive() - { - return sockProps_.isKeepAlive(); - } - - /** - Gets the socket 'receive buffer size' option. NOTE: This does not get - the actual receive buffer size, only the option which is used as a hint - by the underlying socket code. - @return The value of the receive buffer size option. - **/ - public int getReceiveBufferSize() - { - return sockProps_.getReceiveBufferSize(); - } - - /** - Gets the socket 'send buffer size' option. NOTE: This does not get - the actual send buffer size, only the option which is used as a hint - by the underlying socket code. - @return The value of the send buffer size option. - **/ - public int getSendBufferSize() - { - return sockProps_.getSendBufferSize(); - } - - /** - Gets the socket 'linger' option, in milliseconds. - @return The value of the linger option. - **/ - public long getSoLinger() - { - return (long)(1000*sockProps_.getSoLinger()); - } - - /** - Gets the socket 'timeout' option in milliseconds. - @return The value of the timeout option. - **/ - public long getSoTimeout() - { - return (long)sockProps_.getSoTimeout(); - } - - /** - Gets the socket 'TCP no delay' option. - @return The value of the TCP no delay option. - **/ - public boolean isTcpNoDelay() - { - return sockProps_.isTcpNoDelay(); - } - - /** - Turns on the socket 'keepAlive' property. - @param keepAlive The keepalive option value. - **/ - public void setKeepAlive(boolean keepAlive) - { - sockProps_.setKeepAlive(keepAlive); - logProperty("keepAlive", String.valueOf(keepAlive)); //@jvm13 Boolean.toString(keepAlive)); - } - - /** - Sets the socket 'receive buffer size' option to the - specified value. The receive buffer size option is used as a hint - for the size to set the underlying network I/O buffers. Increasing - the receive buffer size can increase the performance of network - I/O for high-volume connection, while decreasing it can help reduce - the backlog of incoming data. This value must be greater than 0. - @param size The receive buffer size option value. - **/ - public void setReceiveBufferSize(int size) - { - sockProps_.setReceiveBufferSize(size); - logProperty("receiveBufferSize", Integer.toString(size)); - } - - /** - Sets the socket 'send buffer size' option to the - specified value. The send buffer size option is used by the - platform's networking code as a hint for the size to set the - underlying network I/O buffers. This value must be greater - than 0. - @param size The send buffer size option value. - **/ - public void setSendBufferSize(int size) - { - sockProps_.setSendBufferSize(size); - logProperty("sendBufferSize", Integer.toString(size)); - } - - /** - Sets the socket 'linger' property to the - specified linger time in milliseconds. The maximum value for this - property is platform specific. - @param milliseconds The linger option value. - **/ - public void setSoLinger(long milliseconds) - { - final String property = "soLinger"; - - if (milliseconds > Integer.MAX_VALUE) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - sockProps_.setSoLinger((int)(milliseconds/1000)); // called method expects seconds - logProperty(property, Long.toString(milliseconds)); - } - - /** - Enables/disables socket timeout with the - specified value in milliseconds. A timeout value must be - greater than zero, a value of zero for this property indicates - infinite timeout. - @param milliseconds The timeout option value. - **/ - public void setSoTimeout(long milliseconds) - { - final String property = "soTimeout"; - - if (milliseconds > Integer.MAX_VALUE) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - sockProps_.setSoTimeout((int)milliseconds); - logProperty(property, Long.toString(milliseconds)); - } - - /** - Sets the socket 'TCP no delay' option. - @param noDelay The TCP no delay option value. - **/ - public void setTcpNoDelay(boolean noDelay) - { - sockProps_.setTcpNoDelay(noDelay); - logProperty("tcpNoDelay", String.valueOf(noDelay)); //@jvm13 Boolean.toString(noDelay)); - } - - /** - Gets the package CCSID property, which indicates the - CCSID in which statements are sent to the IBM i system and - also the CCSID of the package they are stored in. - Default value: 13488 - @return The value of the package CCSID property. - **/ - public int getPackageCCSID() - { - return properties_.getInt(JDProperties.PACKAGE_CCSID); - } - - - //@dup - /** - * Gets the package CCSID property, which indicates the - * CCSID in which statements are sent to the IBM i system and - * also the CCSID of the package they are stored in. - * Default value: 13488 - * @return The value of the package CCSID property. - * Note: this method is the same as getPackageCCSID() so that it corresponds to the connection property name - **/ - public int getPackageCcsid() - { - return getPackageCCSID(); - } - - - /** - Sets the package CCSID property, which indicates the - CCSID in which statements are sent to the IBM i system and - also the CCSID of the package they are stored in. - Recommended values: 1200(UTF-16) and 13488 (UCS-2). - See BidiStringType for Bidi considerations. - Default value: 13488 - @param ccsid The package CCSID. - **/ - public void setPackageCCSID(int ccsid) - { - final String property = "packageCCSID"; - - validateProperty(property, Integer.toString(ccsid), JDProperties.PACKAGE_CCSID); - - properties_.setString(JDProperties.PACKAGE_CCSID, Integer.toString(ccsid)); - } - - //@dup - /** - * Sets the package CCSID property, which indicates the - * CCSID in which statements are sent to the IBM i system and - * also the CCSID of the package they are stored in. - * Recommended values: 1200(UTF-16) and 13488 (UCS-2). - * See BidiStringType for Bidi considerations. - * Default value: 13488 - * @param ccsid The package CCSID. - * Note: this method is the same as setPackageCCSID() so that it corresponds to the connection property name - **/ - public void setPackageCcsid(int ccsid) - { - setPackageCCSID(ccsid); - } - - - /** - Gets the minimum divide scale property. This property ensures the scale - of the result of decimal division is never less than its specified value. - Valid values: 0-9. 0 is default. - @return The minimum divide scale. - **/ - public int getMinimumDivideScale() - { - return properties_.getInt(JDProperties.MINIMUM_DIVIDE_SCALE); - } - - /** - * Gets the maximum block input rows. This property indicates the - * number of rows sent to the database engine for a block insert - * operation. Valid values: 1-32000. 32000 is default. - * @return The maximum block input rows - */ - public int getMaximumBlockedInputRows() - { - return properties_.getInt(JDProperties.MAXIMUM_BLOCKED_INPUT_ROWS); - } - - - - /** - Gets the maximum precision property. This property indicates the - maximum decimal precision the IBM i system should use. - Valid values: 31 or 63. 31 is default. - @return The maximum precision. - **/ - public int getMaximumPrecision() - { - return properties_.getInt(JDProperties.MAXIMUM_PRECISION); - } - - /** - Gets the maximum scale property. This property indicates the - maximum decimal scale the IBM i system should use. - Valid values: 0-63. 31 is default. - @return The maximum scale. - **/ - public int getMaximumScale() - { - return properties_.getInt(JDProperties.MAXIMUM_SCALE); - } - - /** - Sets the minimum divide scale property. This property ensures the scale - of the result of decimal division is never less than its specified value. - Valid values: 0-9. 0 is default. - @param scale The minimum divide scale. - **/ - public void setMinimumDivideScale(int scale) - { - final String property = "minimumDivideScale"; - - validateProperty(property, Integer.toString(scale), JDProperties.MINIMUM_DIVIDE_SCALE); - - properties_.setString(JDProperties.MINIMUM_DIVIDE_SCALE, Integer.toString(scale)); - } - - - // @A6A - /** - * Sets the maximum blocked input rows. This property indicates the - * maximum number of rows sent to the database engine for a blocked - * input operation. Valid values: 1-32000. 32000 is the default - * @param maximumBlockedInputRows The maximum number of input rows - */ - - public void setMaximumBlockedInputRows(int maximumBlockedInputRows) - { - final String property = "maximumBlockedInputRows"; - - validateProperty(property, Integer.toString(maximumBlockedInputRows), JDProperties.MAXIMUM_BLOCKED_INPUT_ROWS); - - properties_.setString(JDProperties.MAXIMUM_PRECISION, Integer.toString(maximumBlockedInputRows)); - } - - - /** - Sets the maximum precision property. This property indicates the - maximum decimal precision the IBM i system should use. - Valid values: 31 or 63. 31 is default. - @param precision The maximum precision. - **/ - public void setMaximumPrecision(int precision) - { - final String property = "maximumPrecision"; - - validateProperty(property, Integer.toString(precision), JDProperties.MAXIMUM_PRECISION); - - properties_.setString(JDProperties.MAXIMUM_PRECISION, Integer.toString(precision)); - } - - /** - Sets the maximum scale property. This property indicates the - maximum decimal scale the IBM i system should use. - Valid values: 0-63. 31 is default. - @param scale The maximum scale. - **/ - public void setMaximumScale(int scale) - { - final String property = "maximumScale"; - - // validate the new value - validateProperty(property, Integer.toString(scale), JDProperties.MAXIMUM_SCALE); - - properties_.setString(JDProperties.MAXIMUM_SCALE, Integer.toString(scale)); - } - - /** - Gets the translate hex property, which indicates how - the parser will treat hexadecimal literals. - @return The value of the translate hex property. -

        Valid values include: -

          -
        • "character" (Interpret hexadecimal constants as character data) -
        • "binary" (Interpret hexadecimal constants as binary data) -
        - The default value is "character". - **/ - public String getTranslateHex() - { - return properties_.getString(JDProperties.TRANSLATE_HEX); - } - - /** - Sets the translate hex property, which indicates how - the parser will treat hexadecimal literals. - @param parseOption The hex constant parser option. -

        Valid values include: -

          -
        • "character" (Interpret hexadecimal constants as character data) -
        • "binary" (Interpret hexadecimal constants as binary data) -
        - The default value is "character". - **/ - public void setTranslateHex(String parseOption) - { - final String property = "translateHex"; - - validateProperty(property, parseOption, JDProperties.TRANSLATE_HEX); - - properties_.setString(JDProperties.TRANSLATE_HEX, parseOption); - } - - /** - Sets the QAQQINI library name. - @param libraryName The QAQQINI library name. - **/ - public void setQaqqiniLibrary(String libraryName) - { - final String property = "qaqqiniLibrary"; - if (libraryName == null) - throw new NullPointerException(property); - - properties_.setString(JDProperties.QAQQINILIB, libraryName); - } - - //@dup - /** - * Sets the QAQQINI library name. - * @param libraryName The QAQQINI library name. - * Note: this method is the same as setQaqqiniLibrary() so that it corresponds to the connection property name - **/ - public void setQaqqinilib(String libraryName) - { - setQaqqiniLibrary(libraryName); - } - - /** - Returns the toolbox trace category. - @return The toolbox trace category. -

        Valid values include: -

          -
        • "none" - The default value. -
        • "datastream" -
        • "diagnostic" -
        • "error" -
        • "information" -
        • "warning" -
        • "conversion" -
        • "proxy" -
        • "pcml" -
        • "jdbc" -
        • "all" -
        • "thread" -
        - **/ - public String getToolboxTraceCategory() - { - return properties_.getString(JDProperties.TRACE_TOOLBOX); - } - - - //@dup - /** - * Returns the toolbox trace category. - * @return The toolbox trace category. - *

        Valid values include: - *

          - *
        • "none" - The default value. - *
        • "datastream" - *
        • "diagnostic" - *
        • "error" - *
        • "information" - *
        • "warning" - *
        • "conversion" - *
        • "proxy" - *
        • "pcml" - *
        • "jdbc" - *
        • "all" - *
        • "thread" - *
        - * Note: this method is the same as getToolboxTraceCategory() so that it corresponds to the connection property name - **/ - public String getToolboxTrace() - { - return getToolboxTraceCategory(); - } - - - /** - Sets the toolbox trace category, which indicates - what trace points and diagnostic messages should be logged. - @param traceCategory The category option. -

        Valid values include: -

          -
        • "none" -
        • "datastream" -
        • "diagnostic" -
        • "error" -
        • "information" -
        • "warning" -
        • "conversion" -
        • "proxy" -
        • "pcml" -
        • "jdbc" -
        • "all" -
        • "thread" -
        - The default value is "none". - **/ - public void setToolboxTraceCategory(String traceCategory) - { - final String property = "toolboxTrace"; - - validateProperty(property, traceCategory, JDProperties.TRACE_TOOLBOX); - - properties_.setString(JDProperties.TRACE_TOOLBOX, traceCategory); - } - - - //@dup - /** - * Sets the toolbox trace category, which indicates - * what trace points and diagnostic messages should be logged. - * @param traceCategory The category option. - *

        Valid values include: - *

          - *
        • "none" - *
        • "datastream" - *
        • "diagnostic" - *
        • "error" - *
        • "information" - *
        • "warning" - *
        • "conversion" - *
        • "proxy" - *
        • "pcml" - *
        • "jdbc" - *
        • "all" - *
        • "thread" - *
        - * The default value is "none". - * Note: this method is the same as setToolboxTraceCategory() so that it corresponds to the connection property name - **/ - public void setToolboxTrace(String traceCategory) - { - setToolboxTraceCategory(traceCategory); - } - - /** - Validates the property value. - @param property The property name. - @param value The property value. - @param index The property index. - **/ - private final void validateProperty(String property, String value, int index) - { - if (value.length() != 0) - { - DriverPropertyInfo[] info = properties_.getInfo(); - String[] choices = info[index].choices; - - //Bidi-HCG start - //exception for "package ccsid" - it can accept any integer - if(index == JDProperties.PACKAGE_CCSID){ - try{ - int ccsid = Integer.valueOf(value).intValue(); - if(ccsid < 1) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - return; - }catch(NumberFormatException e){ - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - //Bidi-HCG end - - boolean notValid = true; - int current = 0; - while (notValid && current < choices.length) - { - if (value.equalsIgnoreCase(choices[current])) - notValid = false; - else - current++; - } - if (notValid) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - /** - Serializes the IBM i system and user information. - @param out The output stream. - @throws IOException If a file I/O error occurs. - **/ - private void writeObject(ObjectOutputStream out) throws IOException - { - if (!savePasswordWhenSerialized_) - { - serialPWBytes_ = null; - pwHashcode_ = 0; - - serialKeyRingPWBytes_ = null; - } - - // Serialize the object. - out.defaultWriteObject(); - } - - /** - Returns the string representation of the object. - @return The string representation. - **/ - public String toString() - { - /* - Implementation note: Used only for tracing information. - */ - return getDataSourceName(); - } - - // Twiddle password bytes. - // Note: This method generates different output each time it's called against the same password. - private static final char[] xpwConfuse(String info) - { - Random rng = new Random(); - byte[] adderBytes = new byte[18]; - rng.nextBytes(adderBytes); - char[] adder = BinaryConverter.byteArrayToCharArray(adderBytes); - - byte[] maskBytes = new byte[14]; - rng.nextBytes(maskBytes); - char[] mask = BinaryConverter.byteArrayToCharArray(maskBytes); - - char[] infoBytes = xencode(adder, mask, info.toCharArray()); - char[] returnBytes = new char[info.length() + 16]; - System.arraycopy(adder, 0, returnBytes, 0, 9); - System.arraycopy(mask, 0, returnBytes, 9, 7); - System.arraycopy(infoBytes, 0, returnBytes, 16, info.length()); - - return returnBytes; - } - - // Get clear password bytes back. - private static final String xpwDeconfuse(char[] info) - { - char[] adder = new char[9]; - System.arraycopy(info, 0, adder, 0, 9); - char[] mask = new char[7]; - System.arraycopy(info, 9, mask, 0, 7); - char[] infoBytes = new char[info.length - 16]; - System.arraycopy(info, 16, infoBytes, 0, info.length - 16); - - return new String(xdecode(adder, mask, infoBytes)); - } - - // Scramble some bytes. - private static final char[] xencode(char[] adder, char[] mask, char[] bytes) - { - if (bytes == null) return null; - int length = bytes.length; - char[] buf = new char[length]; - for (int i = 0; i < length; ++i) - { - buf[i] = (char)(bytes[i] + adder[i % 9]); - } - for (int i = 0; i < length; ++i) - { - buf[i] = (char)(buf[i] ^ mask[i % 7]); - } - return buf; - } - - private static final char[] xdecode(char[] adder, char[] mask, char[] bytes) - { - int length = bytes.length; - char[] buf = new char[length]; - for (int i = 0; i < length; ++i) - { - buf[i] = (char)(mask[i % 7] ^ bytes[i]); - } - for (int i = 0; i < length; ++i) - { - buf[i] = (char)(buf[i] - adder[i % 9]); - } - return buf; - } - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCManagedDataSource", "javax.sql.DataSource" }; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCNClob.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCNClob.java deleted file mode 100644 index 77e41c960..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCNClob.java +++ /dev/null @@ -1,60 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCNClob.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/* ifdef JDBC40 -import java.sql.NClob; -endif */ - -/** - * The AS400JDBCNClob class provides access to character large objects. The data - * is valid only within the current transaction. - */ - -//@PDA jdbc40 new class - -public class AS400JDBCNClob extends AS400JDBCClob -/* ifdef JDBC40 - implements NClob - endif */ -{ - - - /** - * Constructs an AS400JDBCNClob object. The data is contained in the String. - * No further communication with the IBM i system is necessary. - * - * @param data - * The NClob data. - * @param maxLength - * The max length - */ - AS400JDBCNClob(String data, int maxLength) - { - super(data, maxLength); - } - - /** - * Constructs an AS400JDBCNClob object. The data is contained in the char array. - * No further communication with the IBM i system is necessary. - * - * @param data - * The NClob data. - */ - AS400JDBCNClob(char[] data) - { - super(data); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCNClobLocator.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCNClobLocator.java deleted file mode 100644 index 63cf590aa..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCNClobLocator.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCNClobLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/* ifdef JDBC40 -import java.sql.NClob; -endif */ - -//@PDA jdbc40 new class - - -public class AS400JDBCNClobLocator extends AS400JDBCClobLocator -/* ifdef JDBC40 -implements NClob -endif */ -{ - - /** - Constructs an AS400JDBCNClobLocator object. The data for the - CLOB will be retrieved as requested, directly from the - IBM i system, using the locator handle. - - @param locator The locator. - @param converter The text converter. - @param savedObject The input savedOjbect. - @param savedScale The saved scale. - **/ - AS400JDBCNClobLocator(JDLobLocator locator, ConvTable converter, Object savedObject, int savedScale) - { - super(locator, converter, savedObject, savedScale); - } - - //@xml4 new constructor - /** - Constructs an AS400JDBCNClobLocator object. The data for the - CLOB will be retrieved as requested, directly from the - IBM i system, using the locator handle. - If this clob has a source of a column of type XML, then any getX method that returns xml as string will trim the xml declaration. - - @param locator The locator. - @param converter The text converter. - @param savedObject The input savedOjbect. - @param savedScale The saved scale. - @param isXML Flag that stream is from an XML column type (needed to strip xml declaration) - **/ - AS400JDBCNClobLocator(JDLobLocator locator, ConvTable converter, Object savedObject, int savedScale, boolean isXML) - { - super(locator, converter, savedObject, savedScale, isXML); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCObjectFactory.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCObjectFactory.java deleted file mode 100644 index 6d97991a3..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCObjectFactory.java +++ /dev/null @@ -1,108 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCObjectFactory.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Hashtable; -import javax.naming.Context; // JNDI -import javax.naming.Name; // JNDI -import javax.naming.Reference; // JNDI -import javax.naming.spi.ObjectFactory; // JNDI - -/** -* The AS400JDBCObjectFactory is used by a JNDI service provider to reconstruct an object -* when it is retrieved from JNDI. -* -*

        When constructing your own Reference object, at a minimum, you should set the serverName, -* userName, pwd, and secure properties. -* -*

        For Example: -*

        -* XADataSource xads = null; -* String objFactoryName = "com.ibm.as400.access.AS400JDBCObjectFactory"; -* String xadsName = "com.ibm.as400.access.AS400JDBCXADataSource"; -* Reference ref = new Reference(xadsName, objFactoryName, ""); -* ref.add(new StringRefAddr("serverName", "someserver")); -* ref.add(new StringRefAddr("userName", "someuser")); -* ref.add(new StringRefAddr("pwd", "somepassword")); -* ref.add(new StringRefAddr("secure", "false")); -* ref.add(new StringRefAddr("trace", "true")); -* try { -* ObjectFactory objectFactory = (ObjectFactory)Class.forName(objFactoryName).newInstance(); -* xads = (XADataSource)objectFactory.getObjectInstance(ref, null, null, null); -* XAConnection xacon = xads.getXAConnection(); -* Connection con = xacon.getConnection(); -* } catch (Exception ex) { -* ex.printStackTrace(); -* System.err.println("Exception caught: " + ex); -* } -*
        -* The following classes implement the javax.naming.Referenceable interface. -* @see com.ibm.as400.access.AS400JDBCDataSource -* @see com.ibm.as400.access.AS400JDBCConnectionPoolDataSource -**/ -public class AS400JDBCObjectFactory implements ObjectFactory -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - /** - * Returns the object requested. - * @param referenceObject The object reference. - * @param name The object name. - * @param nameContext The context of the name. - * @param environment The environment. - * @return The object requested. - * @exception Exception If an error occurs during object creation. - **/ - public Object getObjectInstance(Object referenceObject, - Name name, - Context nameContext, - Hashtable environment) throws Exception - { - Reference reference = (Reference)referenceObject; - - if (reference.getClassName().equals("com.ibm.as400.access.AS400JDBCDataSource")) - { - AS400JDBCDataSource dataSource = new AS400JDBCDataSource(reference); // @F0M - // @F0D dataSource.setProperties(reference); - return dataSource; - } - else if (reference.getClassName().equals("com.ibm.as400.access.AS400JDBCConnectionPoolDataSource")) - { - AS400JDBCConnectionPoolDataSource dataSource = new AS400JDBCConnectionPoolDataSource(reference); // @F0M - // @F0D dataSource.setProperties(reference); - return dataSource; - } - else if (reference.getClassName().equals("com.ibm.as400.access.AS400JDBCXADataSource")) // @F0A - { // @F0A - AS400JDBCXADataSource dataSource = new AS400JDBCXADataSource(reference); // @F0A - return dataSource; // @F0A - } // @F0A - else if (reference.getClassName().equals("com.ibm.as400.access.AS400JDBCManagedConnectionPoolDataSource")) // @CPMa - { - AS400JDBCManagedConnectionPoolDataSource dataSource = new AS400JDBCManagedConnectionPoolDataSource(reference); - return dataSource; - } - else if (reference.getClassName().equals("com.ibm.as400.access.AS400JDBCManagedDataSource")) // @CPMa - { - AS400JDBCManagedDataSource dataSource = new AS400JDBCManagedDataSource(reference); - return dataSource; - } - else - { - if (JDTrace.isTraceOn()) // @B1C - JDTrace.logInformation (this, "Lookup error. Class not found."); // @B1C - return null; - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCOutputStream.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCOutputStream.java deleted file mode 100644 index d4704d597..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCOutputStream.java +++ /dev/null @@ -1,150 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCOutputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; -import java.sql.SQLException; -import java.sql.DriverManager; - - - -/** -The AS400JDBCLobOutputStream class provides a stream -to write into large objects. The data is valid only within the current -transaction. Users get one of these objects by calling Clob.setAsciiStream() or -Blob.setBinaryStream which both return an object of type OutputStream -**/ -abstract class AS400JDBCOutputStream extends OutputStream -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - - private boolean closed_ = false; - private long position_; - - - /** - * Construct an AS400JDBCLobOutputStream object. - **/ - AS400JDBCOutputStream(long positionToStartWriting) - { - position_ = positionToStartWriting; - } - - /** - * Close the output stream. - **/ - public void close() - { - closed_ = true; - } - - - /** - * Flush the output stream. - **/ - public void flush() - { - //no-op - } - - - /** - * Write a byte array to the output stream. - * @param byteArray The byte array the user wants written to the output stream. - **/ - public synchronized void write(byte[] byteArray) throws IOException - { - if (byteArray == null) throw new NullPointerException("byteArray"); - - if (closed_) throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - - write(byteArray, 0, byteArray.length); - } - - - /** - * Write part of a byte array to the output stream from offset off for len bytes. - * @param byteArray The byte array the user wants written to the output stream. - * @param off The offset into the byte array that the user wants written to the - * output stream (1-based). - * @param len The number of bytes the user wants written to the output stream - * from the byte array they passed in. - **/ - public synchronized void write(byte[] byteArray, int off, int len) throws IOException - { - if (byteArray == null) throw new NullPointerException("byteArray"); - if ((off < 0) || (off > len)) throw new ExtendedIllegalArgumentException("off", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if (len < 0) throw new ExtendedIllegalArgumentException("len", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - if (closed_) throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - - try - { - int numWritten = doWrite(position_, byteArray, off, len); - if (numWritten != len) - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "Unable to write requested number of bytes: "+numWritten+" != "+len); - closed_ = true; - throw new IOException(); - } - position_ += len; - } - catch (SQLException e) - { - if (JDTrace.isTraceOn()) e.printStackTrace(DriverManager.getLogWriter()); - closed_ = true; - throw new IOException(e.getMessage()); - } - } - - - /** - * Write a byte to the output stream. - * @param b The byte the user wants written to the output stream. The general contract - * for write is that one byte is written to the output stream. The byte to be written is the eight - * low-order bits of the argument b. The 24 high-order bits of b are ignored. - **/ - public synchronized void write(int b) throws IOException - { - if (closed_) throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - - try - { - int numWritten = doWrite(position_, (byte)b); - if (numWritten != 1) - { - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "Unable to write requested number of bytes: "+numWritten+" != 1"); - closed_ = true; - throw new IOException(); - } - ++position_; - } - catch (SQLException e) - { - if (JDTrace.isTraceOn()) e.printStackTrace(DriverManager.getLogWriter()); - closed_ = true; - throw new IOException(e.getMessage()); - } - } - - - /** - * This method writes based on the actual type of LOB. - **/ - abstract int doWrite(long position, byte[] data, int offset, int length) throws SQLException; - abstract int doWrite(long position, byte data) throws SQLException; - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCParameterMetaData.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCParameterMetaData.java deleted file mode 100644 index 1cc83422b..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCParameterMetaData.java +++ /dev/null @@ -1,207 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCParameterMetaData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.ParameterMetaData; -import java.sql.SQLException; - - -/** -The AS400JDBCParameterMetaData class can be used to retrieve information about the parameters -of a PreparedStatement. - -Use PreparedStatement.getParameterMetaData() to create new ParameterMetaData objects. -**/ -public class AS400JDBCParameterMetaData -/* ifdef JDBC40 -extends ToolboxWrapper -endif */ - implements ParameterMetaData -{ - final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - - // Private data. - private AS400JDBCPreparedStatement prepStmt_; - - - - /** - Constructs an AS400JDBCParameterMetaData object. - **/ - AS400JDBCParameterMetaData (AS400JDBCPreparedStatement prepStmt) - { - prepStmt_ = prepStmt; - } - - - - /** - Returns the fully-qualified name of the Java class of the specified parameter. - - @param parameterIndex The parameter index (1-based). - @return The fully-qualified name of the Java class. - - @exception SQLException If the prepared statement is not open. - **/ - public String getParameterClassName (int parameterIndex) - throws SQLException - { - return prepStmt_.getParameterClassName(parameterIndex); - } - - - - /** - Returns the number of parameters in this ParameterMetaData object. - - @return The number of parameters in the ParameterMetaData object. - - @exception SQLException If the prepared statement is not open. - **/ - public int getParameterCount () - throws SQLException - { - return prepStmt_.getParameterCount(); - } - - - - /** - Returns the mode of the specified parameter or if that information is unknown. - - @param parameterIndex The parameter index (1-based). - @return The mode of the parameter. Valid values are - ParameterMetaData.parameterModeIn, - ParameterMetaData.parameterModeOut, - ParameterMetaData.parameterModeInOut, and - ParameterMetaData.parameterModeUnknown. - - @exception SQLException If the prepared statement is not open. - **/ - public int getParameterMode (int parameterIndex) - throws SQLException - { - return prepStmt_.getParameterMode(parameterIndex); - } - - - - /** - Returns the SQL type of the specified parameter. - - @param parameterIndex The parameter index (1-based). - @return The SQL type of the parameter. - - @exception SQLException If the prepared statement is not open. - **/ - public int getParameterType (int parameterIndex) - throws SQLException - { - return prepStmt_.getParameterType(parameterIndex); - } - - - - /** - Returns the database-specific type name of the specified parameter. - - @param parameterIndex The parameter index (1-based). - @return The type name of the parameter. - - @exception SQLException If the prepared statement is not open. - **/ - public String getParameterTypeName (int parameterIndex) - throws SQLException - { - return prepStmt_.getParameterTypeName(parameterIndex); - } - - - - /** - Returns the number of decimal digits of the specified parameter. - - @param parameterIndex The parameter index (1-based). - @return The precision of the parameter. - - @exception SQLException If the prepared statement is not open. - **/ - public int getPrecision (int parameterIndex) - throws SQLException - { - return prepStmt_.getPrecision(parameterIndex); - } - - - - /** - Returns the number of digits to the right of the decimal point - of the specified parameter. - - @param parameterIndex The parameter index (1-based). - @return The scale of the parameter. - - @exception SQLException If the prepared statement is not open. - **/ - public int getScale (int parameterIndex) - throws SQLException - { - return prepStmt_.getScale(parameterIndex); - } - - - - /** - Returns if the specified parameter can be null or that information is unknown. - - @param parameterIndex The parameter index (1-based). - @return Returns if the parameter can be null. The valid values are - ParameterMetaData.parameterNoNulls, - ParameterMetaData.parameterNullable, and - ParameterMetaData.parameterNullableUnknown. - - @exception SQLException If the prepared statement is not open. - **/ - public int isNullable (int parameterIndex) - throws SQLException - { - return prepStmt_.isNullable(parameterIndex); - } - - - - /** - Returns if values can be signed numbers for the specified parameter. - - @param parameterIndex The parameter index (1-based). - @return Returns true if values for the specified parameter - can be signed numbers, false otherwise. - - @exception SQLException If the prepared statement is not open. - **/ - public boolean isSigned (int parameterIndex) - throws SQLException - { - return prepStmt_.isSigned(parameterIndex); - } - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCParameterMetaData", "java.sql.ParameterMetaData" }; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCPooledConnection.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCPooledConnection.java deleted file mode 100644 index a212e4395..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCPooledConnection.java +++ /dev/null @@ -1,471 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCPooledConnection.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import javax.sql.ConnectionEvent; -import javax.sql.ConnectionEventListener; -import javax.sql.PooledConnection; -/* ifdef JDBC40 -import javax.sql.StatementEventListener; -endif */ - -import java.sql.Connection; -import java.sql.SQLException; -import java.lang.ref.SoftReference; - -/** -* The AS400JDBCPooledConnection class represents a connection object -* that provides hooks for connection pool management. This object is returned -* by the {@link com.ibm.as400.access.AS400JDBCConnectionPoolDataSource#getPooledConnection AS400JDBCConnectionPoolDataSource.getPooledConnection()} method. -* -* The following example creates an AS400JDBCPooledConnection object that can be used to cache JDBC connections. -* -*
        -* // Create a data source for making the connection. -* AS400JDBCConnectionPoolDataSource dataSource = new AS400JDBCConnectionPoolDataSource("myAS400"); -* datasource.setUser("Mickey Mouse"); -* datasource.setPassword("IAMNORAT"); -* -* // Get a PooledConnection and get the connection handle to the database. -* AS400JDBCPooledConnection pooledConnection = datasource.getPooledConnection(); -* Connection connection = pooledConnection.getConnection(); -* -* ... work with the connection handle. -* -* // Close the connection handle to make available for reuse (physical connection not closed). -* connection.close(); -* -* // Reuse the connection somewhere else. -* Connection reusedConnection = pooledConnection.getConnection(); -* ... work with the connection handle. -* reusedConnection.close(); -* -* // Close the physical connection. -* pooledConnection.close(); -*
        -* -*

        -* AS400JDBCPooledConnection objects generate the following events: -*

          -*
        • javax.sql.ConnectionEvent - The events fired are:
        • -*
            -*
          • connectionClosed
          • -*
          • connectionErrorOccurred
          • -*
          -*
        -**/ -public class AS400JDBCPooledConnection implements PooledConnection -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - private AS400JDBCConnection connection_; // The database connection. -//@CRS - If we maintain a [direct] reference to the handle, and the user doesn't call close(), it -// will never get closed because it will never get garbage collected. -// Instead, we are a listener to the handle, so we know when either the user or the -// garbage collector closes it. At that point, this PooledConnection is no longer -// considered "in use" and can hand out a new handle when someone calls getConnection(). - -//@pda (bug reported) A AS400JDBCPooledConnection can get expired and moved back to available queue. So this -// handle class needs a way for AS400JDBCPooledConnection to notify it of this change in state. -// This way, when finalize() is called by GC we will not try to double-close the connection. -// Without this method, it is possible for two handles to have references to the same pooledConnection. -// After we are done with handle_, we must set it to null, so AS400JDBCConnectionHandle can be GCed. -// In order for the handle to be GCed, a leaked connection has to be Expired and have handle_ set to null -// upon returning to available queue. - private SoftReference handle_; // The handle to the connection. //@pdc make use of reference to handle - // This is a soft reference to an AS400JDBCConnectionHandle object. - // DESIGN NOTE: - // We use a soft reference (rather than a direct reference) in order to avoid - // having circular/mutual direct references between the handle and the connection. - // In some scenarios, such circular references can prevent such pairs of objects - // from being garbage-collected; which can result in memory leaks. - // Advantage of a soft reference: If the connection requester gives up their - // reference to the handle but neglects to call close() first, - // then the only remaining reference to the handle is the soft reference - // from the associated AS400JDBCPooledConnection. - // The garbage collector will then notice that the only reference to the handle - // is a soft reference; and the GC will then collect/remove the handle. - - private PoolItemProperties properties_; // The usage properties. - private AS400JDBCConnectionEventSupport eventManager_; - - private int hashCode_; //@CPMa - - // The following fields are reserved for use by JDConnectionPoolManager. //@CPMa - JDConnectionPoolKey poolKey_; // connection-pool key for this connection - long timeWhenCreated_; // time when this connection was created. - long timeWhenPoolStatusLastModified_; // time when this connection's pooling status last changed. - boolean fatalConnectionErrorOccurred_; // this clues the pool manager not to reuse connection - - - /** - * Constructs an AS400JDBCPooledConnection object. - * @param connection The physical connection to be pooled. - * @exception SQLException If a database error occurs. - **/ - AS400JDBCPooledConnection(Connection connection) throws SQLException - { - if (connection == null) throw new NullPointerException("connection"); - connection_ = (AS400JDBCConnection)connection; - - properties_ = new PoolItemProperties(); - eventManager_ = new AS400JDBCConnectionEventSupport(); - hashCode_ = connection_.hashCode(); - timeWhenCreated_ = System.currentTimeMillis(); - - if (JDTrace.isTraceOn()) //@G2A - { - JDTrace.logInformation(this, "A new AS400JDBCPooledConnection was created"); //@G2A - } - } - - - /** - * Adds a ConnectionEventListener. - * @param listener The listener. - **/ - public void addConnectionEventListener(ConnectionEventListener listener) - { - eventManager_.addConnectionEventListener(listener); - } - - - /** - * Closes the physical connection. - * @exception SQLException If an error occurs closing the connection. - **/ - public synchronized void close() throws SQLException - { - if (connection_.isClosed()) return; - // Note: AS400JDBCConnectionHandle.close() calls fireConnectionCloseEvent(). - - connection_.close(); // close the physical connection - - // Reset the usage timers. - properties_.clear(); - - if (JDTrace.isTraceOn()) - { //@G2C - JDTrace.logInformation(this, "close() was called on this AS400JDBCPooledConnection"); //@G2C - } - } - - - //@G4A JDBC 3.0 - /** - * Closes all the Statement objects that have been opened by this PooledConnection - * object. This method is not supported. - * @exception SQLException Always thrown because this method is not supported. - **/ - public void closeAll() throws SQLException - { - JDError.throwSQLException(JDError.EXC_FUNCTION_NOT_SUPPORTED); - } - - - // JDConnectionPoolManager needs this when identifying returned connections. - public boolean equals(Object obj) - { - if (obj == null) return false; - try - { - AS400JDBCPooledConnection pc = (AS400JDBCPooledConnection)obj; - return (connection_.equals(pc.connection_)); - } - catch (Throwable e) { - return false; - } - } - - // Needed for good hashing. - public int hashCode() - { - return hashCode_; - } - - - // Note: The following method is called by AS400JDBCConnectionHandle.close(). - /** - * Fire the connection closed event. - * @param event The ConnectionEvent. - **/ - void fireConnectionCloseEvent(ConnectionEvent event) - { - returned(); // Reset the pooledConnection. - eventManager_.fireCloseEvent(event); // Notify the pool. - } - - - // Note: The following method is called by AS400JDBCConnectionHandle.close(). - /** - * Fire the connection error event. - * @param event The ConnectionEvent. - **/ - void fireConnectionErrorEvent(ConnectionEvent event) - { - // Don't bother cleaning up the connection, it won't get re-used. - eventManager_.fireErrorEvent(event); // Notify the pool. - } - - /** - * Returns the connection handle to the database. Only one connection handle can be open - * at a time for any given AS400JDBCPooledConnection object. - * @return The connection handle. - * @exception SQLException If a database error occurs or if this PooledConnection is already in use. - **/ - public synchronized Connection getConnection() throws SQLException - { - if (JDTrace.isTraceOn()) //@G2C - { - JDTrace.logInformation(this, "AS400JDBCPooledConnection.getConnection() was called"); //@G2C - } - return getConnectionHandle(); - } - - - // Used by JDConnectionPoolManager. //@CPMa - /** - * Returns the connection handle to the database. Only one connection handle can be open - * at a time for any given AS400JDBCPooledConnection object. - * @return The connection handle. - * @exception SQLException If a database error occurs or if this PooledConnection is already in use. - **/ - synchronized final AS400JDBCConnectionHandle getConnectionHandle() throws SQLException - { - if (connection_.isClosed()) - { - if (JDTrace.isTraceOn()) // @G2A - { - JDTrace.logInformation(this, "This AS400JDBCPooledConnection is invalid because connection is closed."); // @G2A - } - JDError.throwSQLException(this, JDError.EXC_CONNECTION_NONE); //@G2A - } - - // Note: The JDBC Tutorial says that if PooledConnection.getConnection() is called while already in use, this should close the existing connection. "The purpose of allowing the server to invoke the method getConnection a 2nd time is to give the application server a way to take a connection away from an application and give it to someone else. This will probably rarely happen, but the capability is there." - // However, we haven't had a request for this behavior, so we just throw an exception instead. - if (isInUse()) - { - if (JDTrace.isTraceOn()) - { - JDTrace.logInformation(this, "This AS400JDBCPooledConnection is already in use."); - } - JDError.throwSQLException(this, JDError.EXC_CONNECTION_UNABLE); // Is this the right thing to throw here? - } - - // Start the connection tracking timers. - setInUse(true); - - AS400JDBCConnectionHandle handle = new AS400JDBCConnectionHandle(this, connection_); //@pdc handle - handle_ = new SoftReference(handle); - return handle; //@pda handle - } - - - // For exclusive use by JDConnectionPoolManager. //@CPMa - final JDConnectionPoolKey getPoolKey() - { - return poolKey_; - } - - - AS400JDBCConnection getInternalConnection() //@G1A - { //@G1A - return connection_; //@G1A - } //@G1A - - - /** - * Returns the elapsed time the connection has been idle waiting in the pool. - * @return The idle time (milliseconds). - **/ - public long getInactivityTime() - { - return properties_.getInactivityTime(); - } - - - /** - * Returns the elapsed time the connection has been in use. - * @return The elapsed time (milliseconds). - **/ - public long getInUseTime() - { - return properties_.getInUseTime(); - } - - - /** - * Returns the elapsed time the pooled connection has been alive. - * @return The elapsed time (milliseconds). - **/ - public long getLifeSpan() - { - return properties_.getLifeSpan(); - } - - - /** - * Returns the number of times the pooled connection has been used. - * @return The number of times used. - **/ - public int getUseCount() - { - return properties_.getUseCount(); - } - - - /** - * Ping the connection to check the status. - * @return true if the connection is active; false otherwise. - **/ - boolean isConnected() throws SQLException // @A3A - { - return connection_.getAS400().isConnected(AS400.DATABASE); - } - - - /** - * Determine whether the connection is still alive. - * @return true if the connection is alive; false otherwise. - **/ - boolean isConnectionAlive() throws SQLException - { - return connection_.getAS400().isConnectionAlive(AS400.DATABASE); - } - - - /** - * Indicates if the pooled connection is in use. - * @return true if the pooled connection is in use; false otherwise. - **/ - public boolean isInUse() - { - return properties_.isInUse(); - } - - - /** - * Removes a ConnectionEventListener. - * @param listener The listener to be removed. - **/ - public void removeConnectionEventListener(ConnectionEventListener listener) - { - eventManager_.removeConnectionEventListener(listener); - } - - - /** - * Returns the connection after usage. - * Update the connection timers and invalidate connection handle. - **/ - synchronized void returned() - { - if (JDTrace.isTraceOn()) //@G2C - { - JDTrace.logInformation(this, "This AS400JDBCPooledConnection is being returned."); //@G2C - } - - // Reset the timers. - setInUse(false); - - try { //@CPMa - connection_.clearWarnings(); // This seems safe and reasonable enough. - connection_.setHoldability(AS400JDBCResultSet.HOLDABILITY_NOT_SPECIFIED); // This is the default for all new instances of AS400JDBCConnection. - boolean readOnly = connection_.isReadOnlyAccordingToProperties(); // Get default from props. - connection_.setReadOnly(readOnly); // In case the user forgot to reset. - connection_.setAutoCommit(true); // Ditto. - if (handle_ != null) //@pda handle - { - AS400JDBCConnectionHandle handle = (AS400JDBCConnectionHandle)handle_.get(); - if (handle != null) - { - handle.invalidate(); //@pda Invalidate the handle. - // So if this pooledConnection gets expired then also need to invalidate handle (remove reference from handle to pooledConnection). - //if the handle gets GCed (due to connection leak), then handle.finalize() will not try to close this pooledConnection, which could have been already assigned to a new handle. - //(ie prevent two handles from pointing to one pooledConnection) - } - handle_ = null; //remove reference also, so handle is free for GC. - } - } - catch (SQLException e) { - JDTrace.logException(this, "Exception while resetting properties of returned connection.", e); - } - - // Note: We can assume that if the connection has been used and then returned to the pool, it has been sufficiently cleaned-up/reset by AS400JDBCConnectionHandle.close(), which calls AS400JDBCConnection.pseudoClose(), which does any needed rollbacks and/or statement closing. //@CPMa - } - - - /** - * Sets the connection timer values based on the active usage state of the connection. - * @param inUse true if the connection is currently active; false otherwise. - **/ - synchronized void setInUse(boolean inUse) - { - properties_.setInUse(inUse); - } - - - // For exclusive use by JDConnectionPoolManager. //@CPMa - final void setPoolKey(JDConnectionPoolKey key) - { - poolKey_ = key; - } - - //@PDA jdbc40 -//JDBC40DOC /** -//JDBC40DOC * Registers a StatementEventListener with this PooledConnection object. Components that -//JDBC40DOC * wish to be notified when PreparedStatements created by the -//JDBC40DOC * connection are closed or are detected to be invalid may use this method -//JDBC40DOC * to register a StatementEventListener with this PooledConnection object. -//JDBC40DOC *

        -//JDBC40DOC * @param listener an component which implements the StatementEventListener -//JDBC40DOC * interface that is to be registered with this PooledConnection object -//JDBC40DOC */ - /* ifdef JDBC40 - public void addStatementEventListener(StatementEventListener listener) - { - //Currently toolbox does not have a pooledStatemnt. - - //Method can not throw SQLException in current driver - //For now just do nothing in this method. - if (JDTrace.isTraceOn()) //@G2C - { - JDTrace.logInformation(this, "AS400JDBCPooledConnection.addStatementEventListener is called, but is N/A."); - } - } - endif */ - - //@PDA jdbc40 -//JDBC40DOC /** -//JDBC40DOC * Removes the specified StatementEventListener from the list of -//JDBC40DOC * components that will be notified when the driver detects that a -//JDBC40DOC * PreparedStatement has been closed or is invalid. -//JDBC40DOC *

        -//JDBC40DOC * @param listener the component which implements the -//JDBC40DOC * StatementEventListener interface that was previously -//JDBC40DOC * registered with this PooledConnection object -//JDBC40DOC */ - /* ifdef JDBC40 - public void removeStatementEventListener(StatementEventListener listener) - { - //Method can not throw SQLException - //For now just do nothing - if (JDTrace.isTraceOn()) //@G2C - { - JDTrace.logInformation(this, "AS400JDBCPooledConnection.removeStatementEventListener is called, but is N/A."); - } - } - endif */ - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCPreparedStatement.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCPreparedStatement.java deleted file mode 100644 index 64cbc7938..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCPreparedStatement.java +++ /dev/null @@ -1,4333 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCPreparedStatement.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.net.URL; -import java.sql.Array; -import java.sql.BatchUpdateException; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.DataTruncation; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -endif */ -import java.sql.ParameterMetaData; -import java.sql.PreparedStatement; -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -/* ifdef JDBC40 -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Statement; -import java.sql.Time; -import java.sql.Timestamp; -import java.sql.Types; -import java.util.Calendar; -import java.util.Enumeration; -import java.util.Vector; - - -/** -

        The AS400JDBCPreparedStatement class precompiles and stores an -SQL statement. This provides the ability to efficiently run -the statement multiple times. In addition, the statement may -contain parameters. Use Connection.prepareStatement() to create -new PreparedStatement objects. - -

        When setting input parameter values, the caller must specify types -that are compatible with the defined SQL type of the input parameter. -For example, if the input parameter has SQL type INTEGER, then the -caller must call setInt() to set the IN parameter value. If -arbitrary type conversions are required, then use setObject() with -a target SQL type. - -

        For method that sets parameters, the application should not modify the parameter - value until after the execute completes. Modifying a value - between the setXXXX method and the execute method may result in unpredictable - behavior. -**/ -// -// Implementation notes: -// -// 1. See implementation note in AS400JDBCStatement.java about -// "private protected" methods. -// -// @F2A -// 2. We need to support ?=CALL statements. This is where the stored -// procedure returns an INTEGER value, and we treat it as the -// first parameter marker. The database and host server support -// the return value, but not as a parameter marker. Consequently, -// we have to fake it as the first parameter marker. If this appears, -// in the SQL statement, we strip it off and maintain this separately. -// Of course in that case we are always mapping the caller's parameter -// indices to the database's indices by decrementing by 1 as needed. -// -// @G8c -// 3. If there is a return value (ie ?=call xxxx) and the parameter -// index is 1 then return data for the return value (always an Integer). -// If not, decrement the parm index by one because internally the return -// value doesn't count. If there is no return value the count is correct -// so don't do anything in that case. Also, the database supports returning -// only integers so the metadata will always be an SQLInteger. -// -public class AS400JDBCPreparedStatement extends AS400JDBCStatement implements PreparedStatement -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - - private boolean dataTruncation_; // @B5A - private int descriptorHandle_; - boolean executed_; // private protected - private boolean outputParametersExpected_; - int parameterCount_; // private protected - int parameterInputCount_; // private protected //@array4 - boolean batchExecute_; // private protected @G9A - private int[] parameterLengths_; - private int[] parameterOffsets_; - private boolean[] parameterNulls_; - private boolean[] parameterDefaults_; //@EIA - private boolean[] parameterUnassigned_; //@EIA - private String[] parameterNames_; //@pda jdbc40 - //@re-prep move to statement JDServerRow JDServerRow parameterRow_; // private protected - Vector batchParameterRows_; // private protected @G9A - private int parameterTotalSize_; - private int indicatorTotalSize_; //@array Used with array containing data only. Is total size of all indicators (including array element indicators) - private int headerTotalSize_; //@array Used to calculate size of stream header - boolean[] parameterSet_; // private protected - private boolean prepared_; - private JDServerRow resultRow_; - SQLInteger returnValueParameter_; // private protected @F2A - JDSQLStatement sqlStatement_; // @G4c (used by callable statement) - boolean useReturnValueParameter_; // private protected @F2A - private int maxToLog_ = 10000; // Log value of parameter markers up to this length // @H1A - - private int containsLocator_ = LOCATOR_UNKNOWN; - private static final int LOCATOR_UNKNOWN = -1; - private static final int LOCATOR_NOT_FOUND = 0; - private static final int LOCATOR_FOUND = 1; - - private static final short INDICATOR_NULL = -1; //@EIA - private static final short INDICATOR_DEFAULT = -5; //@EIA - private static final short INDICATOR_UNASSIGNED = -7; //@EIA - private boolean isjvm16Synchronizer;//@dmy - private static boolean isjvm16SynchronizerStatic;//@dmy - - static { - // Changed 2/21/2011 to not use unless the JDBC.jvm16Synchronize property is true. @C6A - - /* - Here is some information from service about this error. - -Yes, this trace code was added for a very ugly issue that showed up when customers started moving to Java 6. -While trying to debug it, we found that the trace points ended up changing the behavior, so they were -altered to trace to a dummy stream so that it would workaround Sun's bug. -The CPS discussion item was 7LXN87. - -Here's the contents of our KB doc on the issue: - -Abstract -A problem with the Sun HotSpot Server in the 1.6 JDK causes a variety of errors. - -Problem Summary: -A problem was introduced into the version 1.6 JDK (Java Development Kit) and -JRE (Java Runtime Environment) from Sun. The problem was introduced somewhere between - update number 7 and update 12, which can cause a number of problems. Java version 1.6.0_7 works; -however, version 1.6.0_12 produces the errors. The problem is specific to the HotSpot Server which is -something like an optimizing compiler that is designed to provide the best operating speed for long-running -applications similar to a Web server. The problem seems to always manifest itself by 'removing' parameters -that had been bound to a statement. However, it is not possible to know that this has occurred without -tracing the application. The outward symptoms are exceptions which will vary depending on what data is -missing. The common errors that have been reported are as follows: - -SQLException: Descriptor index not valid -CPD4374 - Field HVR000n and value N not compatible. <-- where N might a variety of different numbers -SQL0302 - Conversion error on host variable or parameter *N. <-- where n might a variety of different numbers -SQL0406 - Conversion error on assignment to column N. <-- where N might a variety of different numbers - -Resolution: -The problem has been reported to Sun; however, at this time, no fix is available from them. -We have found three ways to circumvent the problem: - -1. Do not use JDK 1.6. -2. Use JVM property -client (this turns off performance code in Sun Hotspot). -3. Use JVM property -XX:CompileCommand=exclude,com/ibm/as400/access/AS400JDBCPreparedStatement,commonExecuteBefore (more selectively, turn off part of Hotspot). -4. Use the latest version of jt400.jar (currently 6.6). Additional trace points that were added while searching for the source of the problem appear to have changed the Hotspot behavior. - - - -Update 2/24/2011. This was probably a problem with the buffer synchonization. Before JTOpen 7.1, a flag -was set to indicate that a buffer was available. This flag did not utilize any synchronization. In JTOpen 7.1, -the buffer management code was restructure to used synchronzation. - -A recreate for the original problem was found. It failed using the JTOpen 6.4 jar. We then used a jar -with the change the set the default isjvm16SynchronizerStatic to false and set the default -value of the property to false. The problem did not occur with the jar file. -*/ - - - - //Temporary fix for jvm 1.6 memroy stomp issue. (remove //@dmy code when jvm issue is resolved) - //This fix will just trace a few extra traces to a dummy stream - //if system property or jdbc property is set to false then extra trace is not executed - //null value for system property means not specified...so true by default - String jvm16Synchronize = SystemProperties.getProperty (SystemProperties.JDBC_JVM16_SYNCHRONIZE); //@dmy - isjvm16SynchronizerStatic = false; //@dmy //false by default @C6C - if((jvm16Synchronize != null) && (Boolean.valueOf(jvm16Synchronize.trim()).booleanValue() == true)) { - try{ //@dmy - Class.forName("java.sql.SQLXML"); //@dmy - isjvm16SynchronizerStatic = true; //@dmy - }catch(Exception e){ //@dmy - isjvm16SynchronizerStatic = false; //@dmy - } - - } else { - //@dmy - isjvm16SynchronizerStatic = false; //@dmy - } - - } - // @C6C -- Changed to remove the dummy PrimWriter. The dummy PrintWriter uses a - // 16k buffer of storage. This causes storage problems when a lot of statements are - // cached. Instead we'll use the write(byte[]) method instead of the buffered print writer - // - //@dmy private dummy outputstream - OutputStream dummyOutputStream = new OutputStream() { - int b1 = 0; - public synchronized void write(int b) throws IOException { b1 = b; } - - }; - - // Any method that can deal with extremely large data values must be prepared - // to deal with them in blocks instead of as one giant unit. This value is - // used to determine the size of each block. Eventually, we might externalize - // this value so that users can set it as they see fit. - static final int LOB_BLOCK_SIZE = 1000000; //@pdc Match Native JDBC Driver for IBM i - - /** - Constructs an AS400JDBCPreparedStatement object. - - @param connection The connection to the system. - @param id The id. - @param transactionManager The transaction manager for the connection. - @param packageManager The package manager for the connection. - @param blockCriteria The block criteria. - @param blockSize The block size (in KB). - @param prefetch Indicates if prefetching data. - @param sqlStatement The SQL statement. - @param outputParametersExpected Indicates if output parameters are expected. - @param packageCriteria The package criteria. - @param resultSetType The result set type. - @param resultSetConcurrency The result set concurrency. - @param resultSetHoldability The result set holdability. - @param autoGeneratedKeys The auto-generated keys requested - - @exception SQLException If the SQL statement contains a syntax - error or an error occurs. - **/ - AS400JDBCPreparedStatement (AS400JDBCConnection connection, - int id, - JDTransactionManager transactionManager, - JDPackageManager packageManager, - String blockCriteria, - int blockSize, - boolean prefetch, - JDSQLStatement sqlStatement, - boolean outputParametersExpected, - String packageCriteria, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability, //@G4A - int autoGeneratedKeys) //@G4A - throws SQLException - { - super (connection, id, transactionManager, - packageManager, blockCriteria, blockSize, - prefetch, packageCriteria, resultSetType, - resultSetConcurrency, resultSetHoldability, autoGeneratedKeys); - - //@dmy - //Temporary fix for jvm 1.6 memroy stomp issue. (remove //@dmy code when jvm issue is resolved) - //This fix will just trace a few extra traces to a dummy stream - //if system property or jdbc property is set to false then extra trace is not executed - //null value for system property means not specified...so true by default - isjvm16Synchronizer = isjvm16SynchronizerStatic; - if( connection_.getProperties().getBoolean(JDProperties.JVM16_SYNCHRONIZE)) //@dmy - isjvm16Synchronizer = true; //@dmy@C6C - - - batchExecute_ = false; // @G9A - outputParametersExpected_ = outputParametersExpected; - parameterCount_ = sqlStatement.countParameters(); - parameterInputCount_ = 0; //@array4 calculate while we prepare - parameterLengths_ = new int[parameterCount_]; - parameterNulls_ = new boolean[parameterCount_]; - parameterDefaults_ = new boolean[parameterCount_]; //@EIA - parameterUnassigned_ = new boolean[parameterCount_]; //@EIA - parameterOffsets_ = new int[parameterCount_]; - parameterSet_ = new boolean[parameterCount_]; - sqlStatement_ = sqlStatement; - useReturnValueParameter_ = sqlStatement.hasReturnValueParameter(); // @F2A - - if(useReturnValueParameter_) // @F2A - returnValueParameter_ = new SQLInteger(connection_.getVRM()); // @F2A //@trunc3 - - if(JDTrace.isTraceOn()) - { // @D1A @F2C - JDTrace.logInformation (this, "isjvm16Synchronizer="+isjvm16Synchronizer); // @C6A - JDTrace.logInformation (this, "Preparing [" + sqlStatement_ + "]"); // @D1A - if(useReturnValueParameter_) // @F2A - JDTrace.logInformation(this, "Suppressing return value parameter (?=CALL)"); // @F2A - } // @F2A - - // Do not allow statements to be immediately - // executed. If we did not do this, then some - // statements would get executed at prepare time. - allowImmediate_ = false; - - // Prepare. - prepared_ = true; - //@L1A Added try catch block around commonPrepare() for JTOpen Bug #3605 Statement not fully closed on error. - // If an error occurs in the preparing of the statement, we need to close any resources used by the PreparedStatement object. - try{ - resultRow_ = commonPrepare(sqlStatement_); - }catch(SQLException e){ - close(); - throw e; - } - executed_ = false; - - dataTruncation_ = connection.getProperties().getBoolean(JDProperties.DATA_TRUNCATION); - - clearParameters(); - } - - - - // JDBC 2.0 - /** - Adds the set of parameters to the current batch. - - @exception SQLException If the statement is not open or - an input parameter has not been set. - **/ - public void addBatch() throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - Object[] parameters = new Object[parameterCount_]; - for(int i = 0; i < parameterCount_; ++i) - { - // Statements with output or inout parameters are not allowed in the batch. - if(parameterRow_.isOutput(i+1)) JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // If an input parameter is not set, we throw an exception. - if(!parameterSet_[i]) JDError.throwSQLException(this, JDError.EXC_PARAMETER_COUNT_MISMATCH); - - //@KBA Need to check for locators even if the parameter is null - // If we don't check for locators and the first row had locator fields that are all null, the LOCATOR_FOUND - // flag was not being set. This meant that we thought we could batch when executeBatch() was called. We cannot - // batch when locators are being used. - SQLData sqlData = parameterRow_.getSQLData(i+1); //@KBA - // Save the parameter in the array. If it's null, just leave it null. - if(!parameterNulls_[i]) - { - //@KBD SQLData sqlData = parameterRow_.getSQLData(i+1); - //For default and unassigned extended indicator values, we use Byte to contain the indicator flag - if(parameterDefaults_[i]) //@EIA - parameters[i] = new Byte("1"); //default //@EIA - else if(parameterUnassigned_[i]) //@EIA - parameters[i] = new Byte("2"); //unassigned //@EIA - else //@EIA - parameters[i] = sqlData.getObject(); - //@KBD if(containsLocator_ == LOCATOR_UNKNOWN) - //@KBD { - //@KBD int sqlType = sqlData.getSQLType(); - //@KBD if (sqlType == SQLData.CLOB_LOCATOR || - //@KBD sqlType == SQLData.BLOB_LOCATOR || - //@KBD sqlType == SQLData.DBCLOB_LOCATOR) - //@KBD { - //@KBD containsLocator_ = LOCATOR_FOUND; - //@KBD } - //@KBD } - } - - //@KBA check to see if the parameter is a locator field - if(containsLocator_ == LOCATOR_UNKNOWN) //@KBA - { //@KBA - int sqlType = sqlData.getSQLType(); //@KBA - if (sqlType == SQLData.CLOB_LOCATOR || //@KBA - sqlType == SQLData.BLOB_LOCATOR || //@KBA - sqlType == SQLData.DBCLOB_LOCATOR || //@KBA //@pdc jdbc40 -/* ifdef JDBC40 - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 -endif */ - sqlType == SQLData.XML_LOCATOR) //@xml3 - { //@KBA - containsLocator_ = LOCATOR_FOUND; //@KBA - } //@KBA - } //@KBA - } - if(containsLocator_ == LOCATOR_UNKNOWN) containsLocator_ = LOCATOR_NOT_FOUND; - - if(batch_ == null) batch_ = new Vector(); //@P0A - if (JDTrace.isTraceOn()) JDTrace.logInformation(this, "addBatch()"); - batch_.addElement(parameters); - } - } - - - - // JDBC 2.0 - /** - Adds an SQL statement to the current batch of SQL statements. - -

        Do not use this form of addBatch() on a prepared statement. - - @param sql The SQL statement to be added to the current batch. - This can be any SQL statement that does not return - a result set. - - @exception SQLException This exception is always thrown. - **/ - public void addBatch(String sql) throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); // @B1C - } - - - - // @BAA - /** - Creates or changes the descriptor, which describes the parameter - marker format. - - @exception SQLException If an error occurs. - **/ - private void changeDescriptor() - throws SQLException - { - // If a parameter that is not an input parameter has - // not been set, we still include it in the format. - // - // Note that we set the native type, length, scale and - // precision of each parameter in the descriptor. - // That means that if the user sets a new parameter - // value that changes one of these, then the - // descriptor needs to be changed. - // - DBSQLDescriptorDS request2 = null; //@P0C - try - { - descriptorHandle_ = id_; - //@P0CDBSQLDescriptorDS request2 = new DBSQLDescriptorDS (DBSQLDescriptorDS.FUNCTIONID_CHANGE_DESCRIPTOR, - //@P0C id_, 0, descriptorHandle_); - request2 = DBDSPool.getDBSQLDescriptorDS(DBSQLDescriptorDS.FUNCTIONID_CHANGE_DESCRIPTOR, id_, 0, descriptorHandle_); //@P0C - - DBDataFormat parameterMarkerDataFormat; - if(connection_.useExtendedFormats ()) - { - //@540 We are going to continue using DBExtendedDataFormat for this part. We use an empty string for the parameter name so we don't need 128 bytes - parameterMarkerDataFormat = new DBExtendedDataFormat (parameterCount_); - } - else - parameterMarkerDataFormat = new DBOriginalDataFormat (parameterCount_); - request2.setParameterMarkerDataFormat (parameterMarkerDataFormat); - - parameterMarkerDataFormat.setConsistencyToken (1); - parameterMarkerDataFormat.setRecordSize (parameterTotalSize_); - - if(isjvm16Synchronizer) { - try { - dummyOutputStream.write(("!!!changeDescriptor: totalParameterLength_ = " + parameterTotalSize_).getBytes()); //@dmy@C6C - } catch (Exception e) { - - } - } - - for(int i = 0; i < parameterCount_; ++i) - { - SQLData sqlData = parameterRow_.getSQLData (i+1); - - parameterMarkerDataFormat.setFieldDescriptionLength (i); - if(sqlData.getNativeType() == SQLData.NATIVE_ARRAY) //@array - { //@array - int arrayLen = ((SQLArray)sqlData).getArrayCount(); //@array - if(arrayLen > 0) //@array - parameterMarkerDataFormat.setFieldLength (i, parameterLengths_[i]/arrayLen); //@array - else //@array - parameterMarkerDataFormat.setFieldLength (i, parameterLengths_[i]); //@array - } //@array - else //@array - { - parameterMarkerDataFormat.setFieldLength (i, parameterLengths_[i]); - } - parameterMarkerDataFormat.setFieldCCSID (i, parameterRow_.getCCSID (i+1)); - - parameterMarkerDataFormat.setFieldNameLength (i, 0); - parameterMarkerDataFormat.setFieldNameCCSID (i, 0); - parameterMarkerDataFormat.setFieldName (i, "", connection_.converter_); //@P0C - - //@array (arrays sent in as the element type and zda will know they are arrays) - if(sqlData.getNativeType() == SQLData.NATIVE_ARRAY) //@array - { //@array - parameterMarkerDataFormat.setFieldSQLType (i, - (short) (((SQLArray)sqlData).getElementNativeType() | 0x0001)); //@array - } //@array - else - { - parameterMarkerDataFormat.setFieldSQLType (i, - (short) (sqlData.getNativeType() | 0x0001)); - } - - parameterMarkerDataFormat.setFieldScale (i, - (short) sqlData.getScale()); - parameterMarkerDataFormat.setFieldPrecision (i, - (short) sqlData.getPrecision()); - if(isjvm16Synchronizer) { - try { - dummyOutputStream.write(("!!!changeDescriptor: Parameter " + (i+1) + " length = " + parameterLengths_[i]).getBytes()); //@C6C - } catch (Exception e) { - - } - } - } - - connection_.send (request2, descriptorHandle_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Descriptor " + descriptorHandle_ + " created or changed"); - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - finally - { //@P0C - - if(isjvm16Synchronizer){ - if (request2 != null) { - try { - dummyOutputStream.write(("!!!changeDescriptor.inUser_(false): request2-id=" + request2.hashCode()).getBytes()); //@C6C - } catch (Exception e) {}; - } - } - if(request2 != null) { request2.returnToPool(); request2= null; } //@P0C - } - } - - - - /** - Releases the resources used by the current input parameter - values. In general, input parameter values remain in effect - for repeated executions of the prepared statement. Setting an - input parameter value to a new value automatically clears its - previous value. - - @exception SQLException If the statement is not open. - **/ - public void clearParameters () - throws SQLException - { - synchronized(internalLock_) - { // @F1A - checkOpen (); - - for(int i = 0; i < parameterCount_; ++i) - { - // @E1D parameterLengths_[i] = 0; - parameterNulls_[i] = false; - parameterDefaults_[i] = false; //@EIA - parameterUnassigned_[i] = false; //@EIA - // @E1D parameterOffsets_[i] = 0; - parameterSet_[i] = false; - } - - // @E1D parameterTotalSize_ = 0; - - if(useReturnValueParameter_) // @F2A - returnValueParameter_.set(0); // @F2A - } - } - - - - /** - Releases the prepared statement's resources immediately instead of - waiting for them to be automatically released. This closes the - current result set. - - @exception SQLException If an error occurs. - **/ - public void close () - throws SQLException - { - synchronized(internalLock_) - { // @F1A - // If this is already closed, then just do nothing. - // - // The spec does not define what happens when a connection - // is closed multiple times. The official word from the Sun - // JDBC team is that "the driver's behavior in this case - // is implementation defined. Applications that do this are - // non-portable." - if(isClosed ()) - return; - - // If a descriptor was created somewhere along - // the lines, then delete it now. - if(descriptorHandle_ != 0) - { - //@P0CDBSQLDescriptorDS request = new DBSQLDescriptorDS ( - //@P0C DBSQLDescriptorDS.FUNCTIONID_DELETE_DESCRIPTOR, - //@P0C id_, 0, descriptorHandle_); - DBSQLDescriptorDS request = null; //@P0C - try - { //@P0C - request = DBDSPool.getDBSQLDescriptorDS(DBSQLDescriptorDS.FUNCTIONID_DELETE_DESCRIPTOR, id_, 0, descriptorHandle_); //@P0C - - connection_.send (request, descriptorHandle_); - } - finally - { //@P0C - if(isjvm16Synchronizer) { - try { - dummyOutputStream.write(("!!!close.inUser_(false): request-id=" + request.hashCode()).getBytes()); // @C6C - } catch (Exception e) { - - } - } - if(request != null) { request.returnToPool(); request = null; } //@P0C - } - - descriptorHandle_ = 0; - } - - super.close (); - } - } - - - - /** - Performs common operations needed after an execute. - - @param sqlStatement The SQL statement. - @param reply The execute reply. - - @exception SQLException If an error occurs. - **/ - void commonExecuteAfter (JDSQLStatement sqlStatement, - DBReplyRequestedDS reply) // private protected - throws SQLException - { - super.commonExecuteAfter (sqlStatement, reply); - - if(prepared_) - { - - DBData resultData = null; - if(outputParametersExpected_) - resultData = reply.getResultData (); - - // Store the output parameters, if needed. - if((outputParametersExpected_) && (resultData != null)) - { - parameterRow_.setServerData (resultData); - parameterRow_.setRowIndex (0); - } - - // Handle the return value parameter, if needed. @F2A - try - { // @F2A - if(useReturnValueParameter_) // @F2A - returnValueParameter_.set(reply.getSQLCA().getErrd (1)); // @F2A //@G3C - } // @F2A - catch(DBDataStreamException e) - { // @F2A - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); // @F2A - } // @F2A - } - } - - - - /** - Performs common operations needed before an execute. - - @param sqlStatement The SQL statement. - @param request The execute request. - - @exception SQLException If an error occurs. - **/ - void commonExecuteBefore(JDSQLStatement sqlStatement, DBSQLRequestDS request) throws SQLException - { - super.commonExecuteBefore (sqlStatement, request); - - if(prepared_) - { - // Close the result set before executing again. - closeResultSet (JDCursor.REUSE_YES); - - // Validate each parameters. If a parameter is not an - // input parameter, then it is okay for it not to have been - // set. However, if an input parameter was not set, - // we throw an exception. - boolean outputExpected_ = false; // @K2A We do not want to increment our row index in commonExecuteAfter() if there are no output parameters - for(int i = 0; i < parameterCount_; ++i) - { - if(!parameterSet_[i] && parameterRow_.isInput(i+1)) - { - JDError.throwSQLException (this, JDError.EXC_PARAMETER_COUNT_MISMATCH); - } - - if(parameterRow_.isOutput(i+1)) // @K2A - outputExpected_ = true; // @K2A - if(parameterRow_.isInput(i+1)) //@array4 - parameterInputCount_ ++; //@array4 - } - if(!outputExpected_) // @K2A - outputParametersExpected_ = false; // @K2A - - // Create the descriptor if needed. This should only - // be done once (on the first execute for the prepared - // statement). - if((parameterCount_ > 0) && (descriptorHandle_ == 0)) - { - // Get the offset and length for each parameter. - // We just use the information that came in the parameter - // marker format from reply for the prepare. - parameterTotalSize_ = 0; - indicatorTotalSize_ = 0; //@array - headerTotalSize_ = 2; //@array start with 2 since column count is 2 bytes - for(int i = 0; i < parameterCount_; ++i) - { - if(!parameterRow_.containsArray_ || parameterRow_.isInput(i+1)) //@array4 - { - SQLData sqlData = parameterRow_.getSQLData(i+1); //@array - int arrayLen = 1; //@array 1 by default so size can be multiplied for non arrays also - // boolean arrayIndicatorSet = false; //@array - if(sqlData.getType() == java.sql.Types.ARRAY) //@array - { - arrayLen = ((SQLArray)sqlData).getArrayCount(); //@array - if (parameterNulls_[i] || parameterDefaults_[i] || parameterUnassigned_[i]) //@array - headerTotalSize_ += 4; //@array space for x9911ffff - else - headerTotalSize_ += 12; //@array (array column requires 12 bytes in header x9911) //@array2 - } - else - { - //non array value - headerTotalSize_ += 8; //@array (assuming row has array. x9912 is length 8) - } - //@array set input (to host) array lengths of data - //@array if null array or 0 length array, then data length is 0 - parameterLengths_[i] = parameterRow_.getLength (i+1) * arrayLen; //@array 0, 1, or more datatype-length blocks - parameterOffsets_[i] = parameterTotalSize_; - parameterTotalSize_ += parameterLengths_[i]; - - indicatorTotalSize_ += (arrayLen*2);//@array - } - - if(isjvm16Synchronizer) { - try { - dummyOutputStream.write(("!!!commonExecuteBefore: Parameter " + (i+1) + " length = " + parameterLengths_[i] ).getBytes()); //@C6C - - } catch (Exception e) { - } - } - } - if(isjvm16Synchronizer) { - try { - dummyOutputStream.write(("!!!commonExecuteBefore: totalParameterLength_ = " + parameterTotalSize_).getBytes()); //@C6C - } catch (Exception e) { - } - } - changeDescriptor(); - } - - // Add the parameter information to the execute request. - try - { - request.setStatementType(sqlStatement.getNativeType()); - - // Set the descriptor handle. - request.setParameterMarkerDescriptorHandle (descriptorHandle_); - - // If there are any parameters, then send the parameter - // values with the execute data stream. Only the - // input parameters are included here. - if(parameterCount_ > 0) - { - // In building the parameter marker data, we may discover that the // @BAA - // descriptor needs to be changed. If so, we will need to change the // @BAA - // descriptor, then rebuild the parameter marker data based on that // @BAA - // change. This is implemented using a do-while, but it should never // @BAA - // have to loop more than once, since the second time through (in a // @BAA - // particular execute) every thing should be great. // @BAA - boolean descriptorChangeNeeded = false; - - do - { - descriptorChangeNeeded = false; // Reset our flag every time through the loop. - - // Allocate the space for the Extended Parameter Marker Data @G9A - // This is the amount of space for all of the rows' data and indicators @G9A - DBData parameterMarkerData; - int rowCount = batchExecute_ ? batchParameterRows_.size() : 1; - //@array create new x382f here if parms contain array - if(parameterRow_.containsArray_) //@array - { //@array - parameterMarkerData = new DBVariableData(parameterInputCount_, 2, headerTotalSize_, indicatorTotalSize_, parameterTotalSize_); //@array x382f codepoint //@array4 - } //@array - else if(connection_.useExtendedFormats ()) - { - parameterMarkerData = new DBExtendedData(rowCount, parameterCount_, 2, parameterTotalSize_); - } - else - { - parameterMarkerData = new DBOriginalData(rowCount, parameterCount_, 2, parameterTotalSize_); - } - for(int rowLoop = 0; rowLoop < rowCount; ++rowLoop) // @G9a - { - Object[] parameters = null; // @G9A - if(batchExecute_) // @G9A - { - // @G9A - //@CRS - Don't need to synch around this because we have been called - // by executeBatch() which is already inside the synch block. - parameters = (Object[])batchParameterRows_.get(rowLoop); // @G9A - } // @G9A - - // If this is the first of multiple rows. Set the Parameter Marker @G9A - // Data code point and consistency token only once @G9A - if(rowLoop == 0) // @G9A - { - request.setParameterMarkerData (parameterMarkerData); - parameterMarkerData.setConsistencyToken (1); // @G9M - } // @G9A - - int rowDataOffset = parameterMarkerData.getRowDataOffset(rowLoop); // @G9C - for(int i = 0; i < parameterCount_; ++i) - { - // @G1 -- zero out the comm buffer if the parameter marker is null. - // If the buffer is not zero'ed out old data will be sent to - // the system possibily messing up a future request. - if((batchExecute_ && (parameters[i] == null || parameters[i] instanceof Byte)) || // @G9A //@EIC - (!batchExecute_ && (parameterNulls_[i] || parameterDefaults_[i] || parameterUnassigned_[i]))) // @B9C @G9C //@EIC - { - short indicatorValue = INDICATOR_NULL; //@EIA - if( batchExecute_ ) //@EIA - { //@EIA - if( parameters[i] == null ) //@EIA - indicatorValue = INDICATOR_NULL; //@EIA - else if( ((Byte)parameters[i]).byteValue() == 1 ) //@EIA - indicatorValue = INDICATOR_DEFAULT; //@EIA - else if( ((Byte)parameters[i]).byteValue() == 2 ) //@EIA - indicatorValue = INDICATOR_UNASSIGNED; //@EIA - } //@EIA - else //@EIA - { //@EIA - if( parameterNulls_[i] ) //@EIA - indicatorValue = INDICATOR_NULL; //@EIA - else if( parameterDefaults_[i] ) //@EIA - indicatorValue = INDICATOR_DEFAULT; //@EIA - else if ( parameterUnassigned_[i] ) //@EIA - indicatorValue = INDICATOR_UNASSIGNED; //@EIA - } //@EIA - - SQLData sqlData = parameterRow_.getSQLType(i+1); //@array - - //@array Don't set indicator here for null array, since setting header below will set it - if(sqlData.getType() != java.sql.Types.ARRAY) - parameterMarkerData.setIndicator(rowLoop, i, indicatorValue); // @G1a @G9C @EIC - - //@array only zero-out data on non-arrays - //If the whole array is null, then we do not even include blank data in the stream since a null array has space for values (just 0X9911ffff in header of 0X382f) - if(sqlData.getType() != java.sql.Types.ARRAY) //@array - { - byte[] parameterData = parameterMarkerData.getRawBytes(); // @G1a - int parameterDataOffset = rowDataOffset + parameterOffsets_[i]; // @G1a - int parameterDataLength = parameterLengths_[i] + parameterDataOffset; - for(int z=parameterDataOffset; z < parameterDataLength; parameterData[z++] = 0x00); - } - - //@array If the row contains an array, then we must also set the columnInfo in stream header - if(parameterRow_.containsArray_ && parameterRow_.isInput(i+1)) //@array //@array4 - { //@array - int arrayLen = -1; //@array - int elementType = -1; //@array - int size = -1; //@array - if(sqlData.getType() == java.sql.Types.ARRAY) //@array - { //@array - arrayLen = ((SQLArray)sqlData).getArrayCount(); //@array - elementType = ((SQLArray)sqlData).getElementNativeType(); //@array - size = parameterRow_.getLength(i+1); //@array - } //@array - ((DBVariableData)parameterMarkerData).setHeaderColumnInfo(i, (short)sqlData.getNativeType(), (short)indicatorValue, (short)elementType, size, (short)arrayLen); //@array - } //@array - } - else - { - SQLData sqlData = parameterRow_.getSQLType(i+1); //@array - if(!parameterRow_.containsArray_ || parameterRow_.isInput(i+1)) //@array4 - { - //Setting array null value here for elements inside of array) - if(sqlData.getType() == java.sql.Types.ARRAY ) //@array - { //@array - //iterate through elements and set null indicators. Array as a whole null is not set here (see above) - for (int e = 0 ; e < ((SQLArray)sqlData).getArrayCount() ; e++) //@array - { //@array - if(((SQLArray)sqlData).isElementNull(e)) //@array - parameterMarkerData.setIndicator(0, i, -1); //@array - else //@array - parameterMarkerData.setIndicator(0, i, 0); //@array - } //@array - }else - { - parameterMarkerData.setIndicator(rowLoop, i, (short) 0); // @G9C - } - } - ConvTable ccsidConverter = connection_.getConverter (parameterRow_.getCCSID (i+1)); //@P0C - - // Convert the data to bytes into the parameter marker data. // @BAA - // If there is an exception here, it means that there were // @BAA - // not enough bytes in the descriptor for the conversion. // @BAA - // If so, we get the correct length via getPrecision() // @BAA - // (assume the SQLData implementation has updated its own // @BAA - // precision as needed). // @BAA - int correctLength = -1; // @BAA - - // Put each row's values back into the SQL data type for their respective columns. - if(batchExecute_) - { - //@CRS If the type is a locator, we pass -1 here so the locator will know - // not to reset its length, because the length wasn't saved with the - // parameter when addBatch() was called, but since we reuse the SQLData - // objects, it's still saved off inside the SQLLocator. - setValue(i+1, parameters[i], null, -1); - } - - //SQLData sqlData = parameterRow_.getSQLType(i+1); // @BAC @P0C @G9C //@array move above - - try - { - if(!parameterRow_.containsArray_ || parameterRow_.isInput(i+1)) //@array4 (if array then only send input parm data) - { - //@CRS - This is the only place convertToRawBytes is ever called. - sqlData.convertToRawBytes(parameterMarkerData.getRawBytes(), rowDataOffset + parameterOffsets_[i], ccsidConverter); - if(ccsidConverter.getCcsid() == 5035) //@trnc this is not caught at setX() time - testDataTruncation(i+1, sqlData); //@trnc - } - - //@array If the row contains an array, then we must also set the columnInfo in stream header - if(parameterRow_.containsArray_ && parameterRow_.isInput(i+1)) //@array //@array4 - { //@array - //Set the stream header info for each column in addition to data in rawbytes above. - int arrayLen = -1; //@array - int elementType = -1; //@array - int size = parameterRow_.getLength(i+1); //@array - if(sqlData.getType() == java.sql.Types.ARRAY) //@array - { //@array - arrayLen = ((SQLArray)sqlData).getArrayCount(); //@array - elementType = ((SQLArray)sqlData).getElementNativeType(); //@array - } //@array - ((DBVariableData)parameterMarkerData).setHeaderColumnInfo(i, (short)sqlData.getNativeType(), (short)0, (short)elementType, size, (short)arrayLen); //@array - } //@array - - } - catch(SQLException e) - { - if(e.getSQLState().trim().equals("HY000")) //AN INTERNAL DRIVER ERROR - { - //Check error to see if it was thrown from another error - if(parameterRow_.containsArray_) //@array always use prepare/describe lengths - throw e; //@array - if(e.getMessage().indexOf("Change Descriptor") != -1){ - correctLength = sqlData.getPrecision(); // @BAA - } - else - throw e; - } - else throw e; - } // @BAA - - // If the length needed is larger than what was allocated in // @BAA - // the descriptor, then change the descriptor, and start // @BAA - // again. // @BAA - if(correctLength >= 0) - { - descriptorChangeNeeded = true; // @BAA - parameterLengths_[i] = correctLength; // @BAA - parameterTotalSize_ = parameterOffsets_[i] + correctLength; // @BAA - if((i+1) < parameterCount_) - { - for(int j = i+1; j < parameterCount_; ++j) - { - parameterOffsets_[j] = parameterTotalSize_; // @BAA - parameterTotalSize_ += parameterLengths_[j]; // @BAA - } // @BAA - } // @BAA - } // @BAA - } - } - if(descriptorChangeNeeded) changeDescriptor(); - } - } while(descriptorChangeNeeded); - request.setParameterMarkerBlockIndicator (0); - } - - // If we are expecting output parameters - // to be returned, then ask for them as result data. - if(outputParametersExpected_) request.addOperationResultBitmap(DBSQLRequestDS.ORS_BITMAP_RESULT_DATA); - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (this, JDError.EXC_INTERNAL, e); - } - } - } - - - - /** - Performs common operations needed after a prepare. - - @param sqlStatement The SQL statement. - @param reply The prepare reply. - - @exception SQLException If an error occurs. - **/ - void commonPrepareAfter(JDSQLStatement sqlStatement, DBReplyRequestedDS reply) throws SQLException - { - super.commonPrepareAfter(sqlStatement, reply); - - if(prepared_) - { - parameterRow_ = new JDServerRow(connection_, id_, reply.getParameterMarkerFormat(), settings_); - } - } - - - - /** - Performs common operations needed before a prepare. - - @param sqlStatement The SQL statement. - @param request The prepare request. - - @exception SQLException If an error occurs. - **/ - void commonPrepareBefore(JDSQLStatement sqlStatement, DBSQLRequestDS request) throws SQLException - { - super.commonPrepareBefore(sqlStatement, request); - - if(prepared_) - { - request.addOperationResultBitmap(DBSQLRequestDS.ORS_BITMAP_PARAMETER_MARKER_FORMAT); - } - } - - - - /** - Performs common operations in leiu of a prepare. - - @param sqlStatement The SQL statement. - @param statementIndex The cached statement index. - - @exception SQLException If an error occurs. - **/ - void commonPrepareBypass(JDSQLStatement sqlStatement, int statementIndex) throws SQLException - { - super.commonPrepareBypass(sqlStatement, statementIndex); - - if(prepared_) - { - parameterRow_ = new JDServerRow(connection_, id_, packageManager_.getCachedParameterMarkerFormat(statementIndex), settings_); - } - } - - - - /** - Runs an SQL statement that may return multiple result sets. - This closes the current result set and clears warnings - before executing the SQL statement again. - -

        Under some situations, a single SQL statement may return - multiple result sets, an update count, or both. This might occur - either when executing a stored procedure that returns multiple - result sets or when dynamically executing an unknown SQL string. - -

        Use Statement.getMoreResults(), Statement.getResultSet(), - and Statement.getUpdateCount() to navigate through multiple - result sets, an update count, or both. - - @return true if a result set was returned; false - if an update count was returned or nothing - was returned. - - @exception SQLException If the statement is not open, - the query timeout limit is - exceeded, or an error occurs. - **/ - public boolean execute() throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - if(!prepared_) - { - resultRow_ = commonPrepare(sqlStatement_); - prepared_ = true; - } - - commonExecute(sqlStatement_, resultRow_); - executed_ = true; - - return(resultSet_ != null); - } - } - - - - /** - Runs an SQL statement that may return multiple - result sets. This closes the current result set - and clears warnings before executing a new SQL statement. - -

        Do not use this form of execute() on a prepared statement. - - @param sql The SQL statement. - @return true if a result set was returned, false - if an update count was returned or nothing - was returned. - - @exception SQLException This exception is always thrown. - **/ - public boolean execute (String sql) - throws SQLException - { - /* @B1D - // Call the super class execute() method. Note that this - // results in the prepare of a different statement, so the - // we must mark ours and not prepared. - prepared_ = false; - - return super.execute (sql); - */ - JDError.throwSQLException (this, JDError.EXC_FUNCTION_SEQUENCE); // @B1A - return false; // @B1A - } - - - //@GAA - /** - Runs an SQL statement that may return multiple result sets and - makes any auto-generated keys available for retrieval using - Statement.getGeneratedKeys(). This closes the current result set - and clears warnings before executing the new SQL statement. - -

        Do not use this form of execute() on a prepared statement. - - @param sql The SQL statement. - @param autoGeneratedKeys Indicates whether auto-generated keys should be made available for - retrieval. Valid values are Statement.RETURN_GENERATED_KEYS and - Statement.NO_GENERATED_KEYS. - @return true if a result set was returned, false - if an update count was returned or nothing - was returned. - - @exception SQLException This exception is always thrown. - @since Modification 5 - **/ - public boolean execute (String sql, int autoGeneratedKeys) - throws SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_SEQUENCE); - return false; // @B1A - } - - - /** - Runs the batch of SQL statements. Batch updates can be used - to submit a set of SQL statements together as a single unit. - The SQL statements are run in the order in which they were - added to the batch. The batch is cleared after the SQL statements - are run. In addition, this closes the current result set and - clears warnings before executing the new SQL statement. - -

        When batch updates are run, autocommit should usually be turned off. - This allows the caller to decide whether or not to commit the - transaction in the event that an error occurs and some of the - SQL statements in a batch fail to run. - - @return An array of row counts for the SQL statements that are run. - The array contains one element for each statement in the - batch of SQL statements. The array is ordered according to - the order in which the SQL statements were added to the batch. - - @exception SQLException If the statement is not open, - an SQL statement contains a syntax - error, the query timeout limit is - exceeded, an SQL statement returns - a result set, or an error occurs. - **/ - public int[] executeBatch() throws SQLException - { - synchronized(internalLock_) - { // @F1A - checkOpen(); - - if(batch_ == null || batch_.size() == 0) return new int[0]; - - batchParameterRows_ = new Vector(); - - int batchSize = batch_.size(); - int[] updateCounts = new int[batchSize]; - - int numSuccessful = 0; // Number of successfully executed statements in the batch. - - boolean canBatch = true; - //boolean notInsert = false; //@blksql - - try - { - // Only INSERTs can be batched, UPDATE statements must still be done one at a time. - //if(!(sqlStatement_.isInsert_)) //@blksql - //{ - // canBatch = false; - // notInsert = true; - //} - - if(!(sqlStatement_.canBatch())) - { - canBatch = false; - } - - // For sure we have a locator, so we can't batch it, - // because the host server only reserves space for one locator handle. - if(containsLocator_ == LOCATOR_FOUND) - { - canBatch = false; - } - - // Set the batch execute flag so common execute knows to use the list @G9A - // of parameter rows. @G9A - batchExecute_ = true; // @G9A - rowsInserted_ = 0; // @G9A - - // Prepare the statement if it is not already done. - if(!prepared_) - { - //@H7 Native type should ONLY be BLOCK_INSERT if the statement is of type - //@H7 "INSERT INTO MYTABLE ? ROWS VALUES (?,?)" with a ROWS VALUES clause, - //@H7 not just if we are going to send the values as a batch to the system. - //@H7 We determine whether the statement is of that form in - //@H7 JDSQLStatement.java, not here. - //@H7D sqlStatement_.setNativeType(JDSQLStatement.TYPE_BLOCK_INSERT); // @G9A - resultRow_ = commonPrepare(sqlStatement_); - prepared_ = true; - // See if the prepare returned a ResultSet. If so, error out now to avoid - // opening a cursor. Note some stored procedures won't return a ResultSet - // until the execute, so we check in both places. - if(resultSet_ != null) - { - closeResultSet(JDCursor.REUSE_YES); - JDError.throwSQLException(this, JDError.EXC_CURSOR_STATE_INVALID); - } - } - - // Execute. - if(canBatch) - { - int maximumBlockedInputRows = connection_.getMaximumBlockedInputRows(); - Enumeration list = batch_.elements(); - int count = 0; //@K1A Added support for allowing more than 32000 SQL Statements to be batched and run - int totalUpdateCount = 0; /* @A4A*/ - while (list.hasMoreElements()) - { - batchParameterRows_.add(list.nextElement()); - count++; //@K1A - if(count == maximumBlockedInputRows && list.hasMoreElements())//@K1A Checks if 32000 statements have been added to the batch, if so execute the first 32000, then continue processing the batch - { //@K1A - if(JDTrace.isTraceOn()) JDTrace.logInformation(this, "Begin batching via server-side with "+batchParameterRows_.size()+" rows."); //@K1A - commonExecute(sqlStatement_, resultRow_); //@K1A - totalUpdateCount += updateCount_; /* @A4A*/ - batchParameterRows_.clear(); //@K1A - - if (resultSet_ != null) //@K1A - { //@K1A - closeResultSet(JDCursor.REUSE_YES); //@K1A - JDError.throwSQLException(this, JDError.EXC_CURSOR_STATE_INVALID); //@K1A - } //@K1A - count = 0; //@K1A set the count for the number of statements in the batch back to zero - } //@K1A - } - if(JDTrace.isTraceOn()) JDTrace.logInformation(this, "Begin batching via server-side with "+batchParameterRows_.size()+" rows."); - commonExecute(sqlStatement_, resultRow_); - totalUpdateCount += updateCount_; /* @A4A*/ - batchParameterRows_.clear(); - if(resultSet_ != null) - { - closeResultSet(JDCursor.REUSE_YES); - JDError.throwSQLException(this, JDError.EXC_CURSOR_STATE_INVALID); - } - numSuccessful = batchSize; - // The host server does not currently report the update counts for each statement in - // the batch. We use -2 here because that is the constant for Statement.SUCCESS_NO_INFO - // as of JDBC 3.0 and JDK 1.4. When we change to build against JDK 1.4 instead of 1.3, - // we can change this to use the actual constant. - // However, if the total number of updated rows is the same as the batch size then - // we can set each of the update counts to 1. @A4A - - // Only set the count to one if the statement is an insert statement. - // The logic in JDSQLStatement only allows in insert to be batched if it is of the - // form insert ... VALUES(?,?,?) ... Any other form will not be batched - int updateCount = -2; - if ( batchSize == totalUpdateCount && sqlStatement_.isInsert_) { - updateCount = 1; - } - for(int i=0; iDo not use this form of executeQuery() on a prepared statement. - - @param sql The SQL statement. - @return The result set that contains the data produced - by the query. - - @exception SQLException This exception is always thrown. - **/ - public ResultSet executeQuery (String sql) - throws SQLException - { - /* @B1D - // Call the super class execute() method. Note that this - // results in the prepare of a different statement, so the - // we must mark ours and not prepared. - prepared_ = false; - - return super.executeQuery (sql); - */ - JDError.throwSQLException (this, JDError.EXC_FUNCTION_SEQUENCE); // @B1A - return null; // @B1A - } - - - - /** - Runs an SQL INSERT, UPDATE, or DELETE statement, or any - SQL statement that does not return a result set. - This closes the current result set and clears warnings - before executing the SQL statement again. - - @return Either the row count for INSERT, UPDATE, or - DELETE, or 0 for SQL statements that - return nothing. - - @exception SQLException If the statement is not open, - the query timeout limit is - exceeded, the statement returns - a result set, an input parameter - has not been set, or an error occurs. - **/ - public int executeUpdate() throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - // Prepare and execute. Check for a result set in both - // places. It is best to catch it after the prepare (so - // we don't open a cursor), but with some stored procedures, - // we can't catch it until the execute. - - // Prepare the statement if it is not already done. - if(!prepared_) - { - resultRow_ = commonPrepare(sqlStatement_); - prepared_ = true; - if(resultRow_ != null) JDError.throwSQLException(this, JDError.EXC_CURSOR_STATE_INVALID); - } - - // Execute. - commonExecute(sqlStatement_, resultRow_); - executed_ = true; - - if(resultSet_ != null) - { - closeResultSet(JDCursor.REUSE_YES); - JDError.throwSQLException(this, JDError.EXC_CURSOR_STATE_INVALID); - } - - return updateCount_; - } - } - - - - /** - Runs an SQL INSERT, UPDATE, or DELETE statement, or any - SQL statement that does not return a result set. - This closes the current result set and clears warnings - before executing a new SQL statement. - -

        Do not use this form of executeUpdate() on a prepared statement. - - @param sql The SQL statement. - @return Either the row count for INSERT, UPDATE, or - DELETE, or 0 for SQL statements that - return nothing. - - @exception SQLException This exception is always thrown. - **/ - public int executeUpdate (String sql) - throws SQLException - { - /* @B1D - // Call the super class execute() method. Note that this - // results in the prepare of a different statement, so the - // we must mark ours and not prepared. - prepared_ = false; - - return super.executeUpdate (sql); - */ - JDError.throwSQLException (this, JDError.EXC_FUNCTION_SEQUENCE); // @B1A - return 0; // @B1A - } - - - - //@GAA - /** - Runs an SQL INSERT, UPDATE, or DELETE statement, or any - SQL statement that does not return a result set and - makes any auto-generated keys available for retrieval using - Statement.getGeneratedKeys(). - This closes the current result set and clears warnings - before executing the new SQL statement. - -

        Do not use this form of executeUpdate() on a prepared statement. - - @param sql The SQL statement. - @return Either the row count for INSERT, UPDATE, or - DELETE, or 0 for SQL statements that - return nothing. - - @exception SQLException This exception is always thrown. - @since Modification 5 - **/ - public int executeUpdate (String sql, int autoGeneratedKeys) - throws SQLException - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_SEQUENCE); - return 0; - } - - - - // JDBC 2.0 - /** - Returns the ResultSetMetaData object that describes the - result set's columns. Null is returned if the statement - does not return a result set. In the following example - rsmd is null since the statement does not return a result set. -

         
        -    PreparedStatement ps   = connection.prepareStatement("INSERT INTO COLLECTION.TABLE VALUES(?)");
        -    ResultSetMetaData rsmd = ps.getMetaData();
        -    
        - - @return The metadata object, or null if the statement does not return a result set. - - @exception SQLException If the statement is not open. - **/ - public ResultSetMetaData getMetaData () - throws SQLException - { - synchronized(internalLock_) - { // @F1A - checkOpen (); - - if(resultRow_ == null) // @H6a - return null; // @H6a - - ConvTable convTable = null; // @G6A - DBExtendedColumnDescriptors extendedDescriptors = getExtendedColumnDescriptors(); // @G6A - // If we have extendedDescriptors, send a ConvTable to convert them, else pass null // @G6A - if(extendedDescriptors != null) // @G6A - { - // @G6A - convTable = ((AS400JDBCConnection)connection_).converter_; // @G6A - } // @G6A - return new AS400JDBCResultSetMetaData (connection_.getCatalog (), - resultSetConcurrency_, cursor_.getName (), resultRow_, - extendedDescriptors, convTable, connection_); //@in1 // @G6A - } - } - - - - // @G4A - // Return the class name of a parameter for ParameterMetaData support. - String getParameterClassName (int param) - throws SQLException - { - if(param > getParameterCount() || param < 1) - { - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - synchronized(internalLock_) - { - checkOpen (); - - if(useReturnValueParameter_) // @G8a - { - // @G8a - if(param == 1) // @G8a - return returnValueParameter_.getJavaClassName(); // @G8a - else // @G8a - param--; // @G8a - } // @G8a - - return parameterRow_.getSQLData(param).getJavaClassName(); - } - } - - - - // @G4A - // Return the parameter count for ParameterMetaData support. - int getParameterCount () - throws SQLException - { - synchronized(internalLock_) - { - checkOpen (); - if(useReturnValueParameter_) - { - return parameterCount_ + 1; - } - return parameterCount_; - } - } - - - - // @G4A JDBC 3.0 - /** - Returns the number, types, and properties of a PreparedStatement - object's parameters. - - @return The ParameterMetaData object that describes this - prepared statement object. - - @exception SQLException If the statement is not open. - @since Modification 5 - **/ - public ParameterMetaData getParameterMetaData() - throws SQLException - { - synchronized(internalLock_) - { - checkOpen (); - return(ParameterMetaData)(Object) new AS400JDBCParameterMetaData (this); - } - } - - - - // @G4A - // Return the mode of a parameter for ParameterMetaData support. - int getParameterMode (int param) - throws SQLException - { - if(param > getParameterCount() || param < 1) - { - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - synchronized(internalLock_) - { - checkOpen (); - - if(useReturnValueParameter_) // @G8a - { - // @G8a - if(param == 1) // @G8a - return ParameterMetaData.parameterModeOut; // @G8a - else // @G8a - param--; // @G8a - } // @G8a - - boolean input = parameterRow_.isInput(param); - boolean output = parameterRow_.isOutput(param); - - if(input && output) - { - return ParameterMetaData.parameterModeInOut; - } - else if(input) - { - return ParameterMetaData.parameterModeIn; - } - else if(output) - { - return ParameterMetaData.parameterModeOut; - } - else - return ParameterMetaData.parameterModeUnknown; - } - } - - - - // @G4A - // Return the type of a parameter for ParameterMetaData support. - int getParameterType (int param) - throws SQLException - { - if(param > getParameterCount() || param < 1) - { - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - synchronized(internalLock_) - { - checkOpen (); - - if(useReturnValueParameter_) // @G8a - { - // @G8a - if(param == 1) // @G8a - return returnValueParameter_.getType(); // @G8a - else // @G8a - param--; // @G8a - } // @G8a - - return parameterRow_.getSQLData(param).getType(); - } - } - - - - // @G4A - // Return the type name of a parameter for ParameterMetaData support. - String getParameterTypeName (int param) - throws SQLException - { - if(param > getParameterCount() || param < 1) - { - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - synchronized(internalLock_) - { - checkOpen (); - - if(useReturnValueParameter_) // @G8a - { - // @G8a - if(param == 1) // @G8a - return returnValueParameter_.getTypeName(); // @G8a - else // @G8a - param--; // @G8a - } // @G8a - - return parameterRow_.getSQLData(param).getTypeName(); - } - } - - - - // @G4A - // Return the precision of a parameter for ParameterMetaData support. - int getPrecision (int param) - throws SQLException - { - if(param > getParameterCount() || param < 1) - { - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - synchronized(internalLock_) - { - checkOpen (); - - if(useReturnValueParameter_) // @G8a - { - // @G8a - if(param == 1) // @G8a - return returnValueParameter_.getPrecision(); // @G8a - else // @G8a - param--; // @G8a - } // @G8a - - return parameterRow_.getSQLData(param).getPrecision(); - } - } - - - - // @G4A - // Return the scale of a parameter for ParameterMetaData support. - int getScale (int param) - throws SQLException - { - if(param > getParameterCount() || param < 1) - { - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - synchronized(internalLock_) - { - checkOpen (); - - if(useReturnValueParameter_) // @G8a - { - // @G8a - if(param == 1) // @G8a - return returnValueParameter_.getScale(); // @G8a - else // @G8a - param--; // @G8a - } // @G8a - - return parameterRow_.getSQLData(param).getScale(); - } - } - - - - // @G4A - // Return whether a parameter is nullable for ParameterMetaData support. - int isNullable (int param) - throws SQLException - { - if(param > getParameterCount() || param < 1) - { - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - synchronized(internalLock_) - { - checkOpen (); - - if(useReturnValueParameter_) // @G8a - { - // @G8a - if(param == 1) // @G8a - return ResultSetMetaData.columnNoNulls; // @G8a - else // @G8a - param--; // @G8a - } // @G8a - - return parameterRow_.isNullable(param); - } - } - - - - // @G4A - // Return whether a parameter is signed for ParameterMetaData support. - boolean isSigned (int param) - throws SQLException - { - if(param > getParameterCount() || param < 1) - { - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - synchronized(internalLock_) - { - checkOpen (); - - if(useReturnValueParameter_) // @G8a - { - // @G8a - if(param == 1) // @G8a - return returnValueParameter_.isSigned(); // @G8a - else // @G8a - param--; // @G8a - } // @G8a - - return parameterRow_.getSQLData(param).isSigned(); - } - } - - - - // JDBC 2.0 - /** - Sets an input parameter to an Array value. DB2 for IBM i - only supports arrays in stored procedures. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - **/ - public void setArray (int parameterIndex, Array parameterValue) - throws SQLException - { - //@array new support - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setArray()"); - if(parameterValue == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: Array type " + parameterValue.getBaseTypeName()); - } - - if(!sqlStatement_.isProcedureCall()) //@array - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); //@array - - setValue (parameterIndex, parameterValue, null, -1); - } - - - - /** - Sets an input parameter to an ASCII stream value. The driver - reads the data from the stream as needed until no more bytes - are available. The driver converts this to an SQL VARCHAR - value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param length The number of bytes in the stream. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - the length is not valid, - the input stream does not contain all - ASCII characters, or an error occurs - while reading the input stream. - **/ - public void setAsciiStream (int parameterIndex, - InputStream parameterValue, - int length) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setAsciiStream()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + length); // @H1A - } // @H1A - - // Validate the length parameter - if(length < 0) - JDError.throwSQLException (this, JDError.EXC_BUFFER_LENGTH_INVALID); - - // @J0A added the code from setValue in this method because streams and readers are handled specially - synchronized(internalLock_) - { - checkOpen (); - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check if the parameter index refers to the return value parameter. - // This is an OUT parameter, so sets are not allowed. If its not - // parameter index 1, then decrement the parameter index, since we - // are "faking" the return value parameter. - if(useReturnValueParameter_) - { - if(parameterIndex == 1) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - else - --parameterIndex; - } - - // Check that the parameter is an input parameter. - if(! parameterRow_.isInput (parameterIndex)) - JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Set the parameter data. If there is a type mismatch, - // set() with throw an exception. - SQLData sqlData = parameterRow_.getSQLType(parameterIndex); - if(parameterValue != null) - { - - try - { - // If the data is a locator, then set its handle. - int sqlType = sqlData.getSQLType(); //@xml3 - if(sqlType == SQLData.CLOB_LOCATOR || - sqlType == SQLData.BLOB_LOCATOR || - sqlType == SQLData.DBCLOB_LOCATOR || //@pdc jdbc40 -/* ifdef JDBC40 - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 -endif */ - sqlType == SQLData.XML_LOCATOR) //@xml3 - { - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; - sqlDataAsLocator.setHandle(parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - if(JDTrace.isTraceOn()) JDTrace.logInformation(this, "locator handle: " + parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - sqlData.set(new ConvTableReader(parameterValue, 819, 0, LOB_BLOCK_SIZE), null, length); // @J0M hacked this to use the scale parm for the length - } - else - { - sqlData.set (JDUtilities.readerToString(new ConvTableReader(parameterValue, 819, 0, LOB_BLOCK_SIZE), length), null, -1); - } - } - catch(UnsupportedEncodingException uee) - { - /* do nothing */ - } - - testDataTruncation (parameterIndex, sqlData); - } - // Parameters can be null; you can call one of the set methods to null out a - // field of the database. - parameterNulls_[parameterIndex-1] = (parameterValue == null); - parameterDefaults_[parameterIndex-1] = false; //@EIA - parameterUnassigned_[parameterIndex-1] = false; //@EIA - parameterSet_[parameterIndex-1] = true; - - } - - //@J0M setValue (parameterIndex, - //@J0M (parameterValue == null) ? null : JDUtilities.streamToString (parameterValue, length, "ISO8859_1"), // @B2C - //@J0M null, -1); //@P0C - } - - - - /** - Sets an input parameter to a BigDecimal value. The driver converts - this to an SQL NUMERIC value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, or the parameter - is not an input parameter. - **/ - public void setBigDecimal (int parameterIndex, BigDecimal parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setBigDecimal()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.toString()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); - } - - - - /** - Sets an input parameter to a binary stream value. The driver - reads the data from the stream as needed until no more bytes - are available. The driver converts this to an SQL VARBINARY - value. - -
        If a parameter is set using setBinaryStream, then the parameter - must be reset prior to the second execute of the PreparedStatement object. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param length The number of bytes in the stream. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - the length is not valid, or - an error occurs while reading the - input stream. - **/ - public void setBinaryStream(int parameterIndex, InputStream parameterValue, int length) throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setBinaryStream()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + length); // @H1A - } // @H1A - - // Validate the length parameter - if(length < 0) - JDError.throwSQLException (this, JDError.EXC_BUFFER_LENGTH_INVALID); - - // @J0A added the code from setValue in this method because streams and readers are handled specially - synchronized(internalLock_) //@KKC Removed comment brace - { - checkOpen (); - - // Validate the parameter index. - if ((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check if the parameter index refers to the return value parameter. - // This is an OUT parameter, so sets are not allowed. If it's not - // parameter index 1, then decrement the parameter index, since we - // are "faking" the return value parameter. - if (useReturnValueParameter_) - { - if (parameterIndex == 1) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - else - --parameterIndex; - } - - // Check that the parameter is an input parameter. - if (! parameterRow_.isInput (parameterIndex)) - JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Set the parameter data. If there is a type mismatch, - // set() will throw an exception. - SQLData sqlData = parameterRow_.getSQLType(parameterIndex); - if (parameterValue != null) - { - // If the data is a locator, then set its handle. - if (sqlData instanceof SQLLocator) - { - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; - sqlDataAsLocator.setHandle (parameterRow_.getFieldLOBLocatorHandle (parameterIndex)); - // Don't convert immediately to Bytes. This causes memory problems with Large lobs @B3A - // sqlData.set (JDUtilities.streamToBytes(parameterValue, length), null, length);//@set1 allow setX one time and reuse execute() without having to reset stream - sqlData.set (parameterValue, null, length); // @J0M hacked this to use the scale parm for the length - - } - else - { - sqlData.set (JDUtilities.streamToBytes(parameterValue, length), null, length); - } - - testDataTruncation (parameterIndex, sqlData); - } - // Parameters can be null; you can call one of the set methods to null out a - // field of the database. - parameterNulls_[parameterIndex-1] = (parameterValue == null); - parameterDefaults_[parameterIndex-1] = false; //@EIA - parameterUnassigned_[parameterIndex-1] = false; //@EIA - parameterSet_[parameterIndex-1] = true; - - } - //@KKC */ - //@KKC setValue(parameterIndex, parameterValue, null, length); - //@J0D setValue (parameterIndex, - //@J0D (parameterValue == null) ? null : JDUtilities.streamToBytes (parameterValue, length), // @B2C - //@J0D null, -1); - } - - - - // JDBC 2.0 - /** - Sets an input parameter to a Blob value. The driver - converts this to an SQL BLOB value. -
        If proxy support is in use, the Blob must be serializable. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - or the parameter is not serializable - (when proxy support is in use). - **/ - public void setBlob (int parameterIndex, Blob parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setBlob()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + parameterValue.length()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); - } - - - - /** - Sets an input parameter to a Java boolean value. The driver - converts this to an SQL SMALLINT value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the index is not valid, or - the parameter is not an input parameter. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIT, but DB2 for IBM i - // does not support that. - // - public void setBoolean (int parameterIndex, boolean parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setBoolean()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue); // @H1A - } // @H1A - - setValue (parameterIndex, - new Short ((short) (parameterValue ? 1 : 0)), null, -1); - } - - - - /** - Sets an input parameter to a Java byte value. The driver - converts this to an SQL SMALLINT value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the index is not valid, or - the parameter is not an input parameter. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL TINYINT, but DB2 for IBM i - // does not support that. - // - public void setByte (int parameterIndex, byte parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setByte()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue); // @H1A - } // @H1A - - setValue (parameterIndex, new Short (parameterValue), null, -1); - } - - - - /** - Sets an input parameter to a Java byte array value. The driver - converts this to an SQL VARBINARY value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, or the parameter - is not an input parameter. - **/ - public void setBytes (int parameterIndex, byte[] parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setBytes()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else if(parameterValue.length > maxToLog_) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + parameterValue.length); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + parameterValue.length + " value: " + new String(parameterValue) ); // @H1A //@PDC - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); - } - - - - // JDBC 2.0 - /** - Sets an input parameter to a character stream value. The driver - reads the data from the character stream as needed until no more - characters are available. The driver converts this to an SQL - VARCHAR value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param length The number of characters to read from the reader. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - the length is not valid, - or an error occurs while reading the - character stream - **/ - public void setCharacterStream (int parameterIndex, - Reader parameterValue, - int length) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setCharacterStream()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + length); // @H1A - } // @H1A - - // Validate length parameter - if(length < 0) - JDError.throwSQLException (this, JDError.EXC_BUFFER_LENGTH_INVALID); - - // @J0A added the code from setValue in this method because streams and readers are handled specially - synchronized(internalLock_) - { - checkOpen (); - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check if the parameter index refers to the return value parameter. - // This is an OUT parameter, so sets are not allowed. If its not - // parameter index 1, then decrement the parameter index, since we - // are "faking" the return value parameter. - if(useReturnValueParameter_) - { - if(parameterIndex == 1) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - else - --parameterIndex; - } - - // Check that the parameter is an input parameter. - if(! parameterRow_.isInput (parameterIndex)) - JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Set the parameter data. If there is a type mismatch, - // set() with throw an exception. - SQLData sqlData = parameterRow_.getSQLType(parameterIndex); - if(parameterValue != null) - { - - // If the data is a locator, then set its handle. - int sqlType = sqlData.getSQLType(); //@xml3 - if(sqlType == SQLData.CLOB_LOCATOR || - sqlType == SQLData.BLOB_LOCATOR || - sqlType == SQLData.DBCLOB_LOCATOR || //@pdc jdbc40 - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 - sqlType == SQLData.XML_LOCATOR) //@xml3 - { - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; - sqlDataAsLocator.setHandle(parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - if(JDTrace.isTraceOn()) JDTrace.logInformation(this, "locator handle: " + parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - //@pddsqlData.set(parameterValue, null, length); // @J0M hacked this to use the scale parameter for the length - sqlData.set(JDUtilities.readerToString(parameterValue, length), null, -1); //@pdc length is incorrect for double-byte chars. Use a slower, but correct method, until we can create a real ConvTableReader - } - else - { - sqlData.set(JDUtilities.readerToString(parameterValue, length), null, -1); - } - - testDataTruncation (parameterIndex, sqlData); - } - // Parameters can be null; you can call one of the set methods to null out a - // field of the database. - parameterNulls_[parameterIndex-1] = (parameterValue == null); - parameterDefaults_[parameterIndex-1] = false; //@EIA - parameterUnassigned_[parameterIndex-1] = false; //@EIA - parameterSet_[parameterIndex-1] = true; - - } - - // @J0D setValue (parameterIndex, - // @J0D (parameterValue == null) ? null : JDUtilities.readerToString (parameterValue, length), // @B2C - // @J0D null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Sets an input parameter to a Clob value. The driver - converts this to an SQL CLOB value. -
        If proxy support is in use, the Clob must be serializable. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - or the parameter is not serializable - (when proxy support is in use). - **/ - public void setClob (int parameterIndex, Clob parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setClob()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else if(parameterValue.length() > maxToLog_) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.getSubString(1, (int)parameterValue.length())); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + parameterValue.length()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); - } - - - - /** - Sets an input parameter to a java.sql.Date value using the - default calendar. The driver converts this to an SQL DATE - value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, or the parameter - is not an input parameter. - **/ - public void setDate (int parameterIndex, Date parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setDate()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.toString()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Sets an input parameter to a java.sql.Date value using a - calendar other than the default. The driver converts this - to an SQL DATE value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param calendar The calendar. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - or the calendar is null. - **/ - public void setDate (int parameterIndex, - Date parameterValue, - Calendar calendar) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setDate()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.toString()); // @H1A - } // @H1A - - if(calendar == null) - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - setValue (parameterIndex, parameterValue, calendar, -1); - } - - //@EIA 550 extended indicator defaults - /** - Sets an input parameter to the default value - @param parameterIndex The parameter index (1-based). - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void setDB2Default(int parameterIndex) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setDB2Default()"); - JDTrace.logInformation (this, "parameter index: " + parameterIndex); - } - - setValueExtendedIndicator(parameterIndex, 1); //1 is default - - } - - //@EIA 550 extended indicator defaults - /** - Sets an input parameter to the default value. This is a the same as setDB2Default. - @param parameterIndex The parameter index (1-based). - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void setDBDefault(int parameterIndex) throws SQLException - { - setDB2Default(parameterIndex); - } - - //@EIA 550 extended indicator defaults - /** - Sets an input parameter to unassigned - @param parameterIndex The parameter index (1-based). - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void setDB2Unassigned(int parameterIndex) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setDB2Unassigned()"); - JDTrace.logInformation (this, "parameter index: " + parameterIndex); - } - - setValueExtendedIndicator(parameterIndex, 2); //2 is unassigned - - } - - - //@EIA 550 extended indicator defaults - /** - Sets an input parameter to unassigned. This is a the same as setDB2Unassigned. - @param parameterIndex The parameter index (1-based). - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void setDBUnassigned(int parameterIndex) throws SQLException - { - setDB2Unassigned(parameterIndex); //2 is unassigned - } - - - /** - Sets an input parameter to a Java double value. The driver - converts this to an SQL DOUBLE value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the index is not valid or - the parameter is not an input parameter. - **/ - public void setDouble (int parameterIndex, double parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setDouble()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue); // @H1A - } // @H1A - - setValue (parameterIndex, new Double (parameterValue), null, -1); - } - - - - /** - Sets an input parameter to a Java float value. The driver - converts this to an SQL REAL value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the index is not valid, or - the parameter is not an input parameter. - **/ - // - // Note: The JDBC 1.22 specification states that this - // method should set an SQL FLOAT value. However, - // all tables map float to REAL. Otherwise, - // nothing is symmetrical and certain INOUT - // parameters do not work. - // - public void setFloat (int parameterIndex, float parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setFloat()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue); // @H1A - } // @H1A - - setValue (parameterIndex, new Float (parameterValue), null, -1); - } - - - - /** - Sets an input parameter to a Java int value. The driver - converts this to an SQL INTEGER value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the index is not valid or - the parameter is not an input parameter. - **/ - public void setInt (int parameterIndex, int parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setInt()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue); // @H1A - } // @H1A - - setValue (parameterIndex, new Integer (parameterValue), null, -1); - } - - - - // @D0C - /** - Sets an input parameter to a Java long value. - If the connected system supports SQL BIGINT data, the driver - converts this to an SQL BIGINT value. Otherwise, the driver - converts this to an SQL INTEGER value. SQL BIGINT data is - supported on V4R5 and later. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the index is not valid, or - the parameter is not an input parameter. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIGINT, but DB2 for IBM i - // does not support that until V4R5. - // - public void setLong (int parameterIndex, long parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setLong()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue); // @H1A - } // @H1A - - setValue (parameterIndex, new Long(parameterValue), null, -1); // @D0C - } - - - - /** - Sets an input parameter to SQL NULL. - - @param parameterIndex The parameter index (1-based). - @param sqlType The SQL type code defined in java.sql.Types. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - or the SQL type is not valid. - **/ - public void setNull (int parameterIndex, int sqlType) - throws SQLException - { - // @BBD if (sqlType != parameterRow_.getSQLData (parameterIndex).getType ()) - // @BBD JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // @D8 ignore the type supplied by the user. We are checking it - // only to rigidly follow the JDBC spec. Ignoring the type - // will make us a friendlier driver. - // - // @D8d testSQLType(sqlType, parameterIndex); // @BBA - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setNull()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - } // @H1A - - setValue (parameterIndex, null, null, -1); - } - - - // @B4 - Added for JDK 2.0RC1 - typeName can be ignored, since it is not relevant to IBM i. - /** - Sets an input parameter to SQL NULL. - - @param parameterIndex The parameter index (1-based). - @param sqlType The SQL type code defined in java.sql.Types. - @param typeName The fully-qualified name of an SQL structured type. This value will be ignored. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - or the SQL type is not valid. - **/ - public void setNull (int parameterIndex, int sqlType, String typeName) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setNull()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - } // @H1A - - setNull (parameterIndex, sqlType); - } - - /** - Sets an input parameter to an Object value. The driver converts - this to a value of an SQL type, depending on the type of the - specified value. The JDBC specification defines a standard - mapping from Java types to SQL types. In the cases where a - SQL type is not supported by DB2 for IBM i, the - next closest matching type - is used. -
        If proxy support is in use, the Object must be serializable. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - the type of value is not supported, - or the parameter is not serializable - (when proxy support is in use). - **/ - public void setObject (int parameterIndex, Object parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setObject()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " type: " + parameterValue.getClass().getName()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); //@P0C - } - - - - /** - Sets an input parameter to an Object value. The driver converts - this to a value with the specified SQL type. -
        If proxy support is in use, the Object must be serializable. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param sqlType The SQL type code defined in java.sql.Types. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - the SQL type is not valid, - or the parameter is not serializable - (when proxy support is in use). - **/ - public void setObject (int parameterIndex, - Object parameterValue, - int sqlType) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // @BBD if (sqlType != parameterRow_.getSQLData (parameterIndex).getType ()) - // @BBD JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // @D8 ignore the type supplied by the user. We are checking it - // only to rigidly follow the JDBC spec. Ignoring the type - // will make us a friendlier driver. - // - // @D8d testSQLType(sqlType, parameterIndex); // @BBA - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setObject()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " type: " + parameterValue.getClass().getName()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); //@P0C - } - - - - /** - Sets an input parameter to an Object value. The driver converts - this to a value with the specified SQL type. -
        If proxy support is in use, the Object must be serializable. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param sqlType The SQL type code defined in java.sql.Types. - @param scale The number of digits after the decimal - if sqlType is DECIMAL or NUMERIC. - - @exception SQLException If the statement is not open, - the index is not valid, - the parameter is not an input parameter, - the SQL type is not valid, - the scale is not valid, - or the parameter is not serializable - (when proxy support is in use). - **/ - public void setObject (int parameterIndex, - Object parameterValue, - int sqlType, - int scale) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // @BBD if (sqlType != parameterRow_.getSQLData (parameterIndex).getType ()) - // @BBD JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // @D8 ignore the type supplied by the user. We are checking it - // only to rigidly follow the JDBC spec. Ignoring the type - // will make us a friendlier driver. - // - // @D8d testSQLType(sqlType, parameterIndex); // @BBA - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setObject()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " type: " + parameterValue.getClass().getName()); // @H1A - } // @H1A - - if(scale < 0) - JDError.throwSQLException (this, JDError.EXC_SCALE_INVALID); -/* ifdef JDBC40 - if (parameterValue instanceof SQLXML) //@xmlspec - setSQLXML(parameterIndex, (SQLXML)parameterValue); //@xmlspec - else -endif */ - - setValue (parameterIndex, parameterValue, null, scale); //@P0C - } - - - - // JDBC 2.0 - /** - Sets an input parameter to a Ref value. DB2 for IBM i - does not support structured types. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException Always thrown because DB2 for IBM i does not support structured types. - **/ - public void setRef (int parameterIndex, Ref parameterValue) - throws SQLException - { - JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - } - - - - /** - Sets an input parameter to a Java short value. The driver - converts this to an SQL SMALLINT value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value. - - @exception SQLException If the statement is not open, - the index is not valid or - the parameter is not an input parameter. - **/ - public void setShort (int parameterIndex, short parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setShort()"); // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue); // @H1A - } // @H1A - - setValue (parameterIndex, new Short (parameterValue), null, -1); - } - - - - /** - Sets an input parameter to a String value. The driver - converts this to an SQL VARCHAR value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, or the parameter - is not an input parameter. - **/ - public void setString (int parameterIndex, String parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setString()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else if(parameterValue.length() > maxToLog_) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + parameterValue.length()); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue); // @H1A - } // @H1A - //if(parameterIndex <= parameterCount_ && parameterIndex > 0) //@pdc - //parameterValue = AS400BidiTransform.convertDataToHostCCSID(parameterValue, connection_, //Bidi-HCG - // parameterRow_.getCCSID (parameterIndex)); //Bidi-HCG - - setValue (parameterIndex, parameterValue, null, -1); // @B7C @P0C - } - - - - /** - Sets an input parameter to a java.sql.Time value using the - default calendar. The driver converts this to an SQL TIME value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, or the parameter - is not an input parameter. - **/ - public void setTime (int parameterIndex, Time parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setTime()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.toString()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Sets an input parameter to a java.sql.Time value using a calendar - other than the default. The driver converts this to an SQL TIME - value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param calendar The calendar. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - or the calendar is null. - **/ - public void setTime (int parameterIndex, - Time parameterValue, - Calendar calendar) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setTime()"); // @H1 - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.toString()); // @H1A - } // @H1A - - if(calendar == null) - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - setValue (parameterIndex, parameterValue, calendar, -1); - } - - - - /** - Sets an input parameter to a java.sql.Timestamp value using the - default calendar. The driver converts this to an SQL TIMESTAMP - value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, or the parameter - is not an input parameter. - **/ - public void setTimestamp (int parameterIndex, Timestamp parameterValue) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setTimeStamp()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.toString()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Sets an input parameter to a java.sql.Timestamp value using a - calendar other than the default. The driver converts this to - an SQL TIMESTAMP value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param calendar The calendar. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, - or the calendar is null. - **/ - public void setTimestamp (int parameterIndex, - Timestamp parameterValue, - Calendar calendar) - throws SQLException - { - // @B2D if (parameterValue == null) - // @B2D JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setTimeStamp()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.toString()); // @H1A - } // @H1A - - if(calendar == null) - JDError.throwSQLException (this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - setValue (parameterIndex, parameterValue, calendar, -1); - } - - - - /** - Sets an input parameter to a Unicode stream value. The driver - reads the data from the stream as needed until no more bytes - are available. The driver converts this to an SQL VARCHAR - value. -

        Note that the number of bytes in a Unicode stream can be - computed as 2 multiplied by the number of characters plus 2 bytes for the - byte-order mark. If an uneven number of bytes is specified, - then Java will convert this to an empty String. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - @param length The number of bytes in the stream. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter, the length - is not valid, - the input stream does not contain all - Unicode characters, or an error occurs - while reading the input stream - - @deprecated Use setCharacterStream(int, Reader, int) instead. - @see #setCharacterStream - **/ - public void setUnicodeStream (int parameterIndex, - InputStream parameterValue, - int length) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setUnicodeStream()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + length); // @H1A - } // @H1A - - // Validate the length parameter - if(length < 0) - JDError.throwSQLException (this, JDError.EXC_BUFFER_LENGTH_INVALID); - - // @J0A added the code from setValue in this method because streams and readers are handled specially - synchronized(internalLock_) - { - checkOpen (); - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check if the parameter index refers to the return value parameter. - // This is an OUT parameter, so sets are not allowed. If its not - // parameter index 1, then decrement the parameter index, since we - // are "faking" the return value parameter. - if(useReturnValueParameter_) - { - if(parameterIndex == 1) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - else - --parameterIndex; - } - - // Check that the parameter is an input parameter. - if(! parameterRow_.isInput (parameterIndex)) - JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Set the parameter data. If there is a type mismatch, - // set() with throw an exception. - SQLData sqlData = parameterRow_.getSQLType(parameterIndex); - if(parameterValue != null) - { - - try - { - // If the data is a locator, then set its handle. - int sqlType = sqlData.getSQLType(); //@xml3 - if(sqlType == SQLData.CLOB_LOCATOR || - sqlType == SQLData.BLOB_LOCATOR || - sqlType == SQLData.DBCLOB_LOCATOR || //@pdc jdbc40 -/* ifdef JDBC40 - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 -endif */ - sqlType == SQLData.XML_LOCATOR) //@xml3 - { - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; - sqlDataAsLocator.setHandle(parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - if(JDTrace.isTraceOn()) JDTrace.logInformation(this, "locator handle: " + parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - sqlData.set(new ConvTableReader(parameterValue, 13488, 0, LOB_BLOCK_SIZE), null, length/2); // @J0M hacked this to use the scale parm for the length - } - else - { - sqlData.set (JDUtilities.readerToString(new ConvTableReader(parameterValue, 13488, 0, LOB_BLOCK_SIZE), length/2), null, -1); - } - } - catch(UnsupportedEncodingException uee) - { - /* do nothing */ - } - - testDataTruncation (parameterIndex, sqlData); - } - // Parameters can be null; you can call one of the set methods to null out a - // field of the database. - parameterNulls_[parameterIndex-1] = (parameterValue == null); - parameterDefaults_[parameterIndex-1] = false; //@EIA - parameterUnassigned_[parameterIndex-1] = false; //@EIA - parameterSet_[parameterIndex-1] = true; - - } - - //@J0D setValue (parameterIndex, - //@J0D (parameterValue == null) ? null : JDUtilities.streamToString (parameterValue, length, "UnicodeBig"), // @B2C @B3C @H2C @H3C - //@J0D null, -1); //@P0C - } - - - - // @G4A JDBC 3.0 - /** - Sets an input parameter to a URL value. The driver converts this to an - SQL DATALINK value. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null to set - the value to SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, or the parameter - is not an input parameter. - @since Modification 5 - **/ - public void setURL (int parameterIndex, URL parameterValue) - throws SQLException - { - if(JDTrace.isTraceOn()) - { // @H1A - JDTrace.logInformation (this, "setURL()"); // @H1A - if(parameterValue == null) // @H1A - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); // @H1A - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + parameterValue.toString()); // @H1A - } // @H1A - - setValue (parameterIndex, parameterValue, null, -1); - } - - - - /** - Sets an input parameter value for the specified index, - and performs all appropriate validation. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter value or null if - the value is SQL NULL. - @param calendar The calendar, or null if not - applicable. - @param scale The scale, or -1 if not applicable. - - @exception SQLException If the statement is not open, - the index is not valid or - the parameter is not an input - parameter. - **/ - void setValue(int parameterIndex, Object parameterValue, Calendar calendar, int scale) throws SQLException - { - - synchronized(internalLock_) - { // @F1A - checkOpen(); - - // Check if the parameter index refers to the return value parameter. @F2A - // This is an OUT parameter, so sets are not allowed. If its not @F2A - // parameter index 1, then decrement the parameter index, since we @F2A - // are "faking" the return value parameter. @F2A - if(useReturnValueParameter_) - { // @F2A - if(parameterIndex == 1) // @F2A - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID);// @F2A - else // @F2A - --parameterIndex; // @F2A - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - { - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - - // Check that the parameter is an input parameter. - if(!parameterRow_.isInput(parameterIndex)) JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Set the parameter data. If there is a type mismatch, - // set() with throw an exception. - SQLData sqlData = parameterRow_.getSQLType(parameterIndex); //@P0C - if(parameterValue != null) - { // @B6C - // If the data is a locator, then set its handle. @B6A - int sqlType = sqlData.getSQLType(); - if((sqlType == SQLData.CLOB_LOCATOR || - sqlType == SQLData.BLOB_LOCATOR || - sqlType == SQLData.DBCLOB_LOCATOR || //@pdc jdbc40 -/* ifdef JDBC40 - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 -endif */ - sqlType == SQLData.XML_LOCATOR)) //@xml3 - { // @B6A - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; // @B6A - sqlDataAsLocator.setHandle(parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); // @B6A - if(JDTrace.isTraceOn()) JDTrace.logInformation(this, "locator handle: " + parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - } // @B6A - - sqlData.set(parameterValue, calendar, scale); - if (dataTruncation_ || !sqlData.isText()) - { - testDataTruncation(parameterIndex, sqlData); // @B5C @G5move - } - } - // Parameters can be null; you can call one of the set methods to null out a - // field of the database. // @B6A - parameterNulls_[parameterIndex-1] = (parameterValue == null); - parameterDefaults_[parameterIndex-1] = false; //@EIA - parameterUnassigned_[parameterIndex-1] = false; //@EIA - parameterSet_[parameterIndex-1] = true; - } - } - - //@EIA new method - /** - Sets an input parameter value for the specified index, - and performs all appropriate validation when the value is one of the - valid Extended Indicator values: default or unassigned. - - Note: this is the same type of method as setValue() above, but we - have no way to pass in the special values without hacking some sort - of flag string for the value, and that seemed to be a messy and slow - way to do this. - - @param parameterIndex The parameter index (1-based). - @param parameterValue The parameter 1="default" or 2="unassigned". - - @exception SQLException If the statement is not open, - the index is not valid or - the parameter is not an input - parameter. - **/ - void setValueExtendedIndicator(int parameterIndex, int parameterValue) throws SQLException - { - synchronized(internalLock_) - { - checkOpen(); - - // Check if the parameter index refers to the return value parameter. - // This is an OUT parameter, so sets are not allowed. If its not - // parameter index 1, then decrement the parameter index, since we - // are "faking" the return value parameter. - if(useReturnValueParameter_) - { - if(parameterIndex == 1) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - else - --parameterIndex; - } - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - { - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - - // Check that the parameter is an input parameter. - if(!parameterRow_.isInput(parameterIndex)) JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - - parameterNulls_[parameterIndex-1] = false; - parameterDefaults_[parameterIndex-1] = parameterValue == 1 ? true: false; - parameterUnassigned_[parameterIndex-1] = parameterValue == 2 ? true: false; - parameterSet_[parameterIndex-1] = true; - } - } - - - /** - Tests if a DataTruncation occurred on the write of a piece of - data and throws a DataTruncation exception if so. The data truncation - flag is also taken into consideration for string data. The rules are: - 1) If updating database with numeric data and data truncated, throw exception - 2) If numeric data is part of a query and data truncated, post warning - 3) If string data and suppress truncation, return - 4) If updating database with string data and check truncation and data truncated, throw exception - 5) If string data is part of a query and check truncation and data truncated, post warning - - @param index The index (1-based). - @param data The data that was written or null for SQL NULL. - **/ - private void testDataTruncation(int parameterIndex, SQLData data) throws SQLException //@trunc - { - if(data != null && (dataTruncation_ || !data.isText())) - { - // The SQLData object determined if data was truncated as part of the setValue() processing. - int truncated = data.getTruncated (); - if(truncated > 0) - { - int actualSize = data.getActualSize (); - //boolean isRead = sqlStatement_.isSelect(); //@pda jdbc40 //@pdc same as native (only select is read) //@trunc //@pdc match native - DataTruncation dt = new DataTruncation(parameterIndex, true, false, actualSize + truncated, actualSize); //@pdc jdbc40 //@trunc //@pdc match native - - //if 610 and number data type, then throw DataTruncation - //if text, then use old code path and post/throw DataTruncation - if((connection_.getVRM() >= JDUtilities.vrm610) && (data.isText() == false)) //@trunc2 - { //@trunc2 - throw dt; //@trunc2 - } //@trunc2 - else if((sqlStatement_ != null) && (sqlStatement_.isSelect()) && (!sqlStatement_.isSelectFromInsert())) //@trunc2 //@selins1 - { - postWarning(dt); - } - else - { - throw dt; - } - } - } - } - - - // @BBA - /** - Checks that an input SQL type is compatible with the actual parameter type. - - @param sqlType The SQL type. - @param parameterIndex The index (1-based). - - @exception SQLException If the SQL type is not compatible. - **/ - void testSQLType(int sqlType, int parameterIndex) - throws SQLException - { - int parameterType = parameterRow_.getSQLType(parameterIndex).getType(); //@P0C - - if(sqlType != parameterType) - { - - // If the only reason the types don't match is because one - // is a CHAR and the other is a VARCHAR, then let this - // slide. - if(((sqlType == Types.CHAR) || (sqlType == Types.VARCHAR)) - && ((parameterType == Types.CHAR) || (parameterType == Types.VARCHAR))) - ; // Do nothing! - else - JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - } - } - - //@GKA - // Returns the JDServerRow object associated with this statement. - JDServerRow getResultRow() - { - return resultRow_; - } - - - //@PDA jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Sets the designated parameter to the given java.sql.RowId object. The - // JDBC40DOC * driver converts this to a SQL ROWID value when it sends it - // JDBC40DOC * to the database - // JDBC40DOC * - // JDBC40DOC * @param parameterIndex - // JDBC40DOC * @param x the parameter value - // JDBC40DOC * @throws SQLException if a database access error occurs - // JDBC40DOC * - // JDBC40DOC */ -/* ifdef JDBC40 - public void setRowId(int parameterIndex, RowId x) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setRowId()"); - if(x == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + x.toString()); - } - - setValue (parameterIndex, x, null, -1); - } - endif */ - //@PDA jdbc40 - /** - * Sets the designated paramter to the given String object. - * The driver converts this to a SQL NCHAR or - * NVARCHAR or LONGNVARCHAR value - * (depending on the argument's - * size relative to the driver's limits on NVARCHAR values) - * when it sends it to the database. - * - * @param parameterIndex - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur ; or if a database access error occurs - */ - public void setNString(int parameterIndex, String value) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setNString()"); - if(value == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else if(value.length() > maxToLog_) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + value.length()); - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + value); - } - setString(parameterIndex, value); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * @param parameterIndex - * @param value the parameter value - * @param length the number of characters in the parameter data. - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur ; or if a database access error occurs - */ - public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setNCharacterStream()"); - if(value == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + length); - } - setCharacterStream(parameterIndex, value, (int) length); - } - - //@PDA jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Sets the designated parameter to a java.sql.NClob object. The driver converts this to a - // JDBC40DOC * SQL NCLOB value when it sends it to the database. - // JDBC40DOC * @param parameterIndex - // JDBC40DOC * @param value the parameter value - // JDBC40DOC * @throws SQLException if the driver does not support national - // JDBC40DOC * character sets; if the driver can detect that a data conversion - // JDBC40DOC * error could occur ; or if a database access error occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public void setNClob(int parameterIndex, NClob value) throws SQLException - { - - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setNClob()"); - if(value == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else if(value.length() > maxToLog_) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + value.getSubString(1, (int)value.length())); - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + value.length()); - } - setClob(parameterIndex, value); - } - endif */ - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the PreparedStatement is executed. - * @param parameterIndex - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement, or if the length specified is less than zero. - * - */ - public void setClob(int parameterIndex, Reader reader, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setClob()"); - if(reader == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + length); - } - - setCharacterStream(parameterIndex, reader, (int)length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to an InputStream object. The inputStream must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the PreparedStatement is executed. - * @param parameterIndex - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @throws SQLException if parameterIndex does not correspond - * to a parameter marker in the SQL statement, if the length specified - * is less than zero or if the number of bytes in the inputstream does not match - * the specfied length. - * - */ - public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setBlob()"); - if(inputStream == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + length); - } - setBinaryStream(parameterIndex, inputStream, (int)length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the PreparedStatement is executed. - * @param parameterIndex - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if the length specified is less than zero; - * if the driver does not support national character sets; - * if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - * - */ - public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setNClob()"); - if(reader == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + length); - } - - setCharacterStream(parameterIndex, reader, (int)length); - } - - //@PDA jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Sets the designated parameter to the given java.sql.SQLXML object. - // JDBC40DOC * @param parameterIndex - // JDBC40DOC * @param xmlObject a SQLXML object that maps an SQL XML value - // JDBC40DOC * @throws SQLException if a database access error occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException - { - if(JDTrace.isTraceOn()) - { - int len; - - if(xmlObject == null) - len = 0; - else - len = xmlObject.getString().length(); //no length() method yet in jdbc. - - JDTrace.logInformation (this, "setSQLXML()"); - if(xmlObject == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - else if(len < maxToLog_) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: " + xmlObject.getString()); - else JDTrace.logInformation (this, "parameter index: " + parameterIndex + " length: " + len); - } - - //@xmlspec special handling of blob/clob column types - if(xmlObject == null) //@xmlspec3 - { //@xmlspec3 - setValue (parameterIndex, xmlObject, null, -1); //@xmlspec3 - return; //@xmlspec3 - } //@xmlspec3 - SQLData sqlData = parameterRow_.getSQLType(parameterIndex); //@xmlspec - int sqlDataType = sqlData.getType(); //@xmlspec - switch(sqlDataType) { //@xmlspec - case Types.CLOB: //@xmlspec - setCharacterStream(parameterIndex, xmlObject.getCharacterStream());//@xmlspec - break; //@xmlspec - case Types.BLOB: //@xmlspec - setBinaryStream(parameterIndex, xmlObject.getBinaryStream()); //@xmlspec - break; //@xmlspec - default: //@xmlspec - setValue (parameterIndex, xmlObject, null, -1); - } - } - endif */ - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCPreparedStatement", "java.sql.PreparedStatement" }; - } - - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterIndex - * @param x the Java input stream that contains the ASCII parameter value - * @param length the number of bytes in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException - { - setAsciiStream( parameterIndex, x, (int)length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the - * stream as needed until end-of-file is reached. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterIndex - * @param x the java input stream which contains the binary parameter value - * @param length the number of bytes in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException - { - setBinaryStream(parameterIndex, x, (int)length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterIndex - * @param reader the java.io.Reader object that contains the - * Unicode data - * @param length the number of characters in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException - { - setCharacterStream(parameterIndex, reader, (int)length); - } - - //@pda jdbc40 needed for rowset.setX methods. Moved from callableStatement. - /* - Find the column index that matches this parameter name. - @param parameterName The parameter name to change into a column index (1-based). - */ - int findParameterIndex(String parameterName) - throws SQLException - { - // Throw an exception if null was passed in - if(parameterName == null) - JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - // Throw an exception if the Statement is closed (FUNCTION SEQUENCE) - if(isClosed()) - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - - boolean caseSensitive = false; - int count = 0; - int returnParm = 0; - - // determine if our search should be case insensitive or not - if(parameterName.startsWith("\"") && parameterName.endsWith("\"")) // assume no leading or trailing blanks - - { - parameterName = JDUtilities.stripOuterDoubleQuotes(parameterName); - - caseSensitive = true; - } - - // If we have a cache created, try to find the column name in it. - if(parameterNames_ != null) - { - // Look up the mapping in our cache. - while(count < parameterNames_.length) - { - if (parameterNames_[count] != null) - { - if((caseSensitive && parameterNames_[count].equals(parameterName)) - || (!caseSensitive && parameterNames_[count].equalsIgnoreCase(parameterName))) - { - returnParm = count+1; - break; - } - } - - ++count; - } - } - else - { - // Else, create a new hash table to hold all the column name/number mappings. - parameterNames_ = new String[parameterCount_]; - - // Cache all the parm names and numbers. - Statement s = null; //@scan1 - ResultSet rs = null; //@scan1 - try{ - s = connection_.createStatement(); - String catalogSeparator = ""; //@74A Added a check for the naming used. Need to use separator appropriate to naming. - if (connection_.getProperties().equals (JDProperties.NAMING, JDProperties.NAMING_SQL)) //@74A - catalogSeparator = "."; //@74A - else //@74A - catalogSeparator = "/"; //@74A - - String schema = sqlStatement_.getSchema(); - if(schema == null || schema.equals("")) // no schema in statement - { // Derive the schema. - schema = connection_.getDefaultSchema(true); // get raw value - - if(schema == null) // No default schema was set on the connection url, or by the libraries connection property. - { - if(catalogSeparator.equals(".")) // using sql naming - { - schema = connection_.getUserName(); // set to user profile - } - else // using system naming - { - // Retrieve the library list from the IBM i - Use ROI Retrieve Library List. - ResultSet rs1 = JDUtilities.getLibraries(this, connection_, null, true); - Vector libListV = new Vector(); - while(rs1.next()) { - libListV.addElement(rs1.getString(1)); - } - rs1.close(); //@SS - String[] libList = new String[libListV.size()]; - libListV.toArray(libList); - - // Get a result set that we can scroll forward/backward through. - Statement s1 = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - rs = s1.executeQuery("SELECT ROUTINE_SCHEMA FROM QSYS2" - + catalogSeparator - + "SYSPROCS WHERE ROUTINE_NAME='" - + unquote(sqlStatement_.getProcedure()) - + "' AND IN_PARMS + OUT_PARMS + INOUT_PARMS = " - + parameterCount_); - if(!rs.next()) - JDError.throwSQLException(this, JDError.EXC_INTERNAL); // didn't find the procedure in any schema - - // If we get this far, at least one schema contains a procedure similar to ours. - boolean found = false; - for(int i=0; i parameterCount_)) - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check if the parameter index refers to the return value parameter. - // This is an OUT parameter, so sets are not allowed. If its not - // parameter index 1, then decrement the parameter index, since we - // are "faking" the return value parameter. - if(useReturnValueParameter_) - { - if(parameterIndex == 1) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - else - --parameterIndex; - } - - // Check that the parameter is an input parameter. - if(! parameterRow_.isInput (parameterIndex)) - JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Set the parameter data. If there is a type mismatch, - // set() with throw an exception. - SQLData sqlData = parameterRow_.getSQLType(parameterIndex); - if(x != null) - { - // If the data is a locator, then set its handle. - int sqlType = sqlData.getSQLType(); //@xml3 - if(sqlType == SQLData.CLOB_LOCATOR || - sqlType == SQLData.BLOB_LOCATOR || - sqlType == SQLData.DBCLOB_LOCATOR || //@pdc jdbc40 - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 - sqlType == SQLData.XML_LOCATOR) //@xml3 - { - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; - sqlDataAsLocator.setHandle(parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - if(JDTrace.isTraceOn()) JDTrace.logInformation(this, "locator handle: " + parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - sqlData.set(x, null, -2);//new ConvTableReader(x, 819, 0, LOB_BLOCK_SIZE), null, -2); //@readerlen -2 flag to read all of reader bytes - } - else - { - sqlData.set(x, null, -2);//sqlData.set (JDUtilities.readerToString(new ConvTableReader(x, 819, 0, LOB_BLOCK_SIZE)), null, -1); //@readerlen -2 flag to read all of reader bytes - } - - testDataTruncation (parameterIndex, sqlData); - } - // Parameters can be null; you can call one of the set methods to null out a - // field of the database. - parameterNulls_[parameterIndex-1] = (x == null); - parameterSet_[parameterIndex-1] = true; - - } - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterIndex - * @param x the Java input stream that contains the ASCII parameter value - * @exception SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setAsciiStream(int, InputStream)"); - if(x == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - } - setInputStream(parameterIndex, x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the - * stream as needed until end-of-file is reached. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterIndex - * @param x the java input stream which contains the binary parameter value - * @exception SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setBinaryStream(int, InputStream)"); - if(x == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - } - setInputStream(parameterIndex, x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a InputStream object. - * This method differs from the setBinaryStream (int, InputStream) - * method because it informs the driver that the parameter value should be - * sent to the server as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARBINARY or a BLOB - * - * @param parameterIndex - * @param inputStream An object that contains the data to set the parameter - * value to. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if a database access error occurs; - * this method is called on a closed PreparedStatement or - * if parameterIndex does not correspond - * to a parameter marker in the SQL statement, - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - */ - public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setBlob(int, InputStream)"); - if(inputStream == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - } - setInputStream(parameterIndex, inputStream); - } - - //@PDA jdbc40 helper - private void setReader(int parameterIndex, Reader reader) throws SQLException - { - // @J0A added the code from setValue in this method because streams and readers are handled specially - synchronized(internalLock_) - { - checkOpen (); - - // Validate the parameter index. - if((parameterIndex < 1) || (parameterIndex > parameterCount_)) - JDError.throwSQLException (this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check if the parameter index refers to the return value parameter. - // This is an OUT parameter, so sets are not allowed. If its not - // parameter index 1, then decrement the parameter index, since we - // are "faking" the return value parameter. - if(useReturnValueParameter_) - { - if(parameterIndex == 1) - JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - else - --parameterIndex; - } - - // Check that the parameter is an input parameter. - if(! parameterRow_.isInput (parameterIndex)) - JDError.throwSQLException (this, JDError.EXC_PARAMETER_TYPE_INVALID); - - // Set the parameter data. If there is a type mismatch, - // set() with throw an exception. - SQLData sqlData = parameterRow_.getSQLType(parameterIndex); - if(reader != null) - { - - // If the data is a locator, then set its handle. - int sqlType = sqlData.getSQLType(); //@xml3 - if(sqlType == SQLData.CLOB_LOCATOR || - sqlType == SQLData.BLOB_LOCATOR || - sqlType == SQLData.DBCLOB_LOCATOR || //@pdc jdbc40 - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 - sqlType == SQLData.XML_LOCATOR) //@xml3 - { - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; - sqlDataAsLocator.setHandle(parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - if(JDTrace.isTraceOn()) JDTrace.logInformation(this, "locator handle: " + parameterRow_.getFieldLOBLocatorHandle(parameterIndex)); - sqlData.set(reader, null, -2); //@readerlen -2 flag to read all of reader chars - } - else - { - sqlData.set(JDUtilities.readerToString(reader), null, -1); - } - - testDataTruncation (parameterIndex, sqlData); - } - // Parameters can be null; you can call one of the set methods to null out a - // field of the database. - parameterNulls_[parameterIndex-1] = (reader == null); - parameterSet_[parameterIndex-1] = true; - - } - - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Reader - * object. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setCharacterStream which takes a length parameter. - * - * @param parameterIndex - * @param reader the java.io.Reader object that contains the - * Unicode data - * @exception SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setCharacterStream(int, Reader)"); - if(reader == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - } - - setReader(parameterIndex, reader); - } - - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the server as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARCHAR or a CLOB - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setClob which takes a length parameter. - * - * @param parameterIndex - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if a database access error occurs; this method is called on - * a closed PreparedStatementor if parameterIndex does not correspond to a parameter - * marker in the SQL statement - * - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setClob(int parameterIndex, Reader reader) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setClob(int, Reader)"); - if(reader == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - } - - setReader(parameterIndex, reader); - } - - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNCharacterStream which takes a length parameter. - * - * @param parameterIndex - * @param value the parameter value - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs; or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setNCharacterStream(int, Reader)"); - if(value == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - } - - setReader(parameterIndex, value); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the server as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGNVARCHAR or a NCLOB - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNClob which takes a length parameter. - * - * @param parameterIndex - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; - * if the driver does not support national character sets; - * if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setNClob(int parameterIndex, Reader reader) throws SQLException - { - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "setNClob(int, Reader)"); - if(reader == null) - JDTrace.logInformation (this, "parameter index: " + parameterIndex + " value: NULL"); - } - - setReader(parameterIndex, reader); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCResultSet.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCResultSet.java deleted file mode 100644 index 1ca6a1be0..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCResultSet.java +++ /dev/null @@ -1,7239 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCResultSet.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.math.BigDecimal; -import java.net.MalformedURLException; -import java.net.URL; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Connection; -import java.sql.DataTruncation; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -endif */ -import java.sql.PreparedStatement; -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -/* ifdef JDBC40 -import java.sql.RowId; -endif */ -import java.sql.SQLException; -import java.sql.SQLWarning; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Statement; -import java.sql.Time; -import java.sql.Timestamp; -/* ifdef JDBC40 -import java.sql.Types; -endif */ -import java.util.Calendar; -import java.util.Map; - - - -/** -

        The AS400JDBCResultSet class provides access to a table -of data generated by a database query. - -

        A result set maintains a cursor pointing to its current -row of data. Initially, the cursor is positioned before the -first row. If the result set is scrollable, use any of the -cursor positioning methods to move the cursor within the result -set. If the result set is not scrollable, then only use next() -to move the cursor. - -

        The get methods retrieve column values for the current row. -Values can be retrieved using either the column index or the -column name. In general, using the column index is more efficient. -Column indexes are numbered starting with 1. Column names are -not case sensitive. If several columns have the same name, -then the first matching column is used. - -

        Columns can have two names: a column name ("long name") -and a system column name ("short name"). The get methods and -findColumn() only support using the column name. - -

        In each get method, the driver attempts to convert the -underlying data to the specified Java type and returns a -suitable Java value. If such a conversion is not appropriate, -an SQLException is thrown. - -

        If the result set is updatable, the update methods modify -column values for the current row, but not in the underlying -database. updateRow() causes all updates to the current row -to be written to the database. Use deleteRow() to delete the -current row in the database. - -

        For updatable result sets, there is also an insert row, -which is used as a staging area for the contents of a new row. -Use moveToInsertRow() to position the cursor to the insert row. -Once all updates to the insert row have been made, use insertRow() -to insert the row into the database. - -

        In the following cases, result sets are always read only -regardless of the concurrency set in the statement: -

          -
        • Stored procedure calls -
        • DatabaseMetaData catalog methods -
        - -

        In the following case, result sets are always read only -regardless of the concurrency set in the statement if connecting -to a system running OS/400 V4R5 or a previous release: -

          -
        • SELECT statements which do not specify FOR UPDATE -
        - -

        In the following case, result sets are always forward only -regardless of the type set in the statement: -

          -
        • Stored procedure calls -
        - -

        A result set is automatically closed by the statement that -generated it when the statement is closed, run again, or used -to retrieve the next result set from a sequence of multiple -result sets. - -

        The new JDBC 3.0 methods add the ability to -retrieve information by column name in addition to column index. -Be aware you will see better performance accessing columns by their -index rather than accessing them by their name. -**/ -// -// Implementation notes: -// -// 1. There are a few different types of result sets. For example: -// -// * Result sets from caller-issued selects. -// * Result sets created and returned from DatabaseMetaData. -// * Result sets generated on the IBM i system and mapped to -// a different format by DatabaseMetaData. -// -// One solution would be to provide a different implementation -// of java.sql.ResultSet for each of these. However, there is -// a lot of overhead that is common to all of these. As a result, -// I have decided to use one implementation of java.sql.ResultSet -// and write in terms of the following interfaces, which pinpoint -// what is truly different about the different formats: -// -// * JDRowCache - manages the set of rows and fetches as needed. -// * JDRow - accesses various information about the format -// of a row and manages the getting and setting -// of data within a row. -// -// There are implementations of each of these to handle the -// different types of result sets. -// -// 2. We need to know the total number of rows in the result set -// in order to make getRow() work in all cases (e.g. after -// a last() or absolute(-). In mod 5 the code was changed to -// loop through the rows if we need a count. This will be -// slow but seemed to be the best way to do it. -// The mod 4 comment is: -// The only way we could think of -// to do this is to issue a SELECT COUNT(*) using the same -// where clause as the original. However there are 2 problems: -// -// * There is a window of time between the original query -// and the SELECT COUNT(*), so the value may not be -// accurate. -// * There is overhead in issuing another SELECT and getRow() -// seems like it probably won't be used that often. -// -// Given these problems, I have decided to make getRow() not -// work in some documented cases. -// -// 3. In JDBC 2.0, there are some date/time/timestamp related -// methods that take calendar parameters and some that don't. -// The methods that do not take calendar parameters are supposed -// to use the default calendar (retrieved using -// Calendar.getInstance()). -// -// At first thought, I tried to create one static calendar -// object to share for the entire JDBC driver, thinking that -// this would minimize object creation and therefore improve -// performance. However, it turns out that this shared instance -// does not reflect TimeZone changes made after it is created, -// so the very example given in the spec does not work. As a -// result, we must create a new default Calendar each time. -// -public class AS400JDBCResultSet -/* ifdef JDBC40 -extends ToolboxWrapper -endif */ - -implements ResultSet -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - - //New constants for JDBC 3.0. - static final int HOLDABILITY_NOT_SPECIFIED = -9999; //@G4A - static final int HOLD_CURSORS_OVER_COMMIT = 1; //@G4A - static final int CLOSE_CURSORS_AT_COMMIT = 2; //@G4A - - // Private data. - private String catalog_; - private boolean closed_; - private int columnCount_; - private int concurrency_; - private Connection connection_; - private String correlationName_; - private String cursorName_; - private boolean dataTruncation_; // @B2A - private PreparedStatement deleteStatement_; - private int fetchDirection_; - private int fetchSize_; - private AS400JDBCStatementLock internalLock_; // @D1A @C7C - private int maxRows_; - private InputStream openInputStream_; - private Reader openReader_; - private JDRow row_; - private JDRowCache rowCache_; - private String selectTable_; - private SQLWarning sqlWarning_; - private AS400JDBCStatement statement_; - private int type_; - private boolean[] updateNulls_; - private boolean[] updateDefaults_; //@EIA - private boolean[] updateUnassigned_; //@EIA - private JDRow updateRow_; - private boolean[] updateSet_; - private boolean wasNull_; - private boolean wasDataMappingError_; - boolean isMetadataResultSet = false; //@mdrs - private DBReplyRequestedDS reply_ = null; - - /*---------------------------------------------------------*/ - /* */ - /* MISCELLANEOUS METHODS. */ - /* */ - /*---------------------------------------------------------*/ - - - - /** - Constructs an AS400JDBCResultSet object. - - @param statement The owning statement. - @param sqlStatement The SQL statement. - @param rowCache The row cache. - @param catalog The catalog. - @param cursorName The cursor name. - @param maxRows The maximum rows limit, or - 0 for no limit. - @param type The type. - @param concurrency The concurrency. - @param fetchDirection The fetch direction. - @param fetchSize The fetch size. - @param tableName The table name, if any. - - @exception SQLException If an error occurs. - **/ - AS400JDBCResultSet (AS400JDBCStatement statement, - JDSQLStatement sqlStatement, - JDRowCache rowCache, - String catalog, - String cursorName, - int maxRows, - int type, - int concurrency, - int fetchDirection, - int fetchSize) - throws SQLException - { - // Initialization. - catalog_ = catalog; - closed_ = false; - concurrency_ = concurrency; - connection_ = (statement != null) ? statement.getConnection () : null; - cursorName_ = cursorName; - deleteStatement_ = null; - fetchDirection_ = fetchDirection; - fetchSize_ = fetchSize; - internalLock_ = (statement != null) ? statement.internalLock_ : new AS400JDBCStatementLock(); // @D1A - maxRows_ = maxRows; - openInputStream_ = null; - openReader_ = null; - row_ = rowCache.getRow (); - rowCache_ = rowCache; - sqlWarning_ = null; - statement_ = statement; - type_ = type; - wasNull_ = false; - wasDataMappingError_ = false; - - columnCount_ = row_.getFieldCount (); - - rowCache_.open (); - - // If no connection or SQL statement was provided, - // or a SELECT with multiple tables or views was - // specified, or the SELECT does not specify FOR UPDATE, - // then we cannot do updates. (@J3 In case you have - // paraenthesis overload, the added check in mod 5 - // is if we are connected to a v5r1 (without PTF) or earlier - // system and "for update" is not specified) - if((connection_ == null) || - (sqlStatement == null) || - (((((AS400JDBCConnection) connection_).getMustSpecifyForUpdate()) && // @J3a @J31c - (! sqlStatement.isForUpdate())))) - { - selectTable_ = null; - correlationName_ = null; - concurrency_ = CONCUR_READ_ONLY; - } - else - { - selectTable_ = sqlStatement.getSelectTable (); - correlationName_ = sqlStatement.getCorrelationName (); - } - - // Initialize the update row. - if(concurrency_ == CONCUR_UPDATABLE) - { - updateRow_ = new JDSimpleRow (row_, true); - updateSet_ = new boolean[columnCount_]; - updateNulls_ = new boolean[columnCount_]; - updateDefaults_ = new boolean[columnCount_]; //@EIA - updateUnassigned_ = new boolean[columnCount_]; //@EIA - for(int i = 0; i < columnCount_; ++i) - { - updateSet_[i] = false; - updateNulls_[i] = true; //@EIC not needed since updateSet[] is checked first //@EIC2 initialize all to null for insert row logic - } - } - - // Initialize the data truncation. @B2A - if(connection_ != null) // @B2A - dataTruncation_ = ((AS400JDBCConnection) connection_).getProperties ().getBoolean (JDProperties.DATA_TRUNCATION); // @B2A - else // @B2A - dataTruncation_ = false; - - // Trace messages. - if(JDTrace.isTraceOn()) - { - JDTrace.logOpen (this, statement_); // @J33a - JDTrace.logProperty (this, "Conncurrency", concurrency_); - JDTrace.logProperty (this, "Fetch direction", fetchDirection_); - JDTrace.logProperty (this, "Fetch size", fetchSize_); - JDTrace.logProperty (this, "Max rows", maxRows_); - JDTrace.logProperty (this, "Type", type_); - } - } - - - - /** - Constructs an AS400JDBCResultSet object. - - @param rowCache The row cache. - @param catalog The catalog. - @param cursorName The cursor name. - @param reply Reply object that must be returned to pool when result set closed - - @exception SQLException If an error occurs. - **/ - // - // This constructor is specifically for DatabaseMetaData - // result sets. - // - AS400JDBCResultSet (JDRowCache rowCache, - String catalog, - String cursorName, - AS400JDBCConnection con, - DBReplyRequestedDS reply) //@in2 - throws SQLException - { - this (null, null, rowCache, catalog, cursorName, 0, - TYPE_SCROLL_INSENSITIVE, CONCUR_READ_ONLY, - FETCH_FORWARD, 0); - - this.reply_ = reply; - - //connection is needed in AS400JDBCResultsetMetadata. connection is passed in from AS400JDBCDatabaseMetaData - if(con != null) //@in2 - connection_ = con; //@in2 - } - - - - /** - Checks that the result set is open. Public methods - that require an open result set should call this first. - - @exception SQLException If the result set is not open. - **/ - void checkOpen () - throws SQLException - { - if(closed_) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - - - /** - Clears any information associated with the current row. - In addition, all warnings are cleared. - **/ - private void clearCurrentRow () - throws SQLException - { - clearCurrentValue (); - clearWarnings (); - - if(concurrency_ == CONCUR_UPDATABLE) - { - for(int i = 0; i < columnCount_; ++i) - { - updateNulls_[i] = true; //@IEC //@EIC2 - updateDefaults_[i] = false; //@EIA - updateUnassigned_[i] = false; //@EIA - updateSet_[i] = false; - } - } - } - - - - /** - Clears any information associated with the current value. - **/ - private void clearCurrentValue () - { - // Implicitly close the InputStream if left open. - if(openInputStream_ != null) - { - try - { - openInputStream_.close (); - } - catch(IOException e) - { - // Ignore the exception. - } - openInputStream_ = null; - } - - // Implicitly close the InputStream if left open. - if(openReader_ != null) - { - try - { - openReader_.close (); - } - catch(IOException e) - { - // Ignore the exception. - } - openReader_ = null; - } - } - - - - - /** - Clears all warnings that have been reported for the result set. - After this call, getWarnings() returns null until a new warning - is reported for the result set. - - @exception SQLException If an error occurs. - **/ - public void clearWarnings () - throws SQLException - { - sqlWarning_ = null; - } - - - - /** - Releases the result set's resources immediately instead of - waiting for them to be automatically released. - - @exception SQLException If an error occurs. - **/ - public void close () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // If this is already closed, then just do nothing. - // - // The spec does not define what happens when a connection - // is closed multiple times. The official word from the Sun - // JDBC team is that "the driver's behavior in this case - // is implementation defined. Applications that do this are - // non-portable." - if(isClosed ()) - return; - - rowCache_.close (); - if (reply_ != null) { reply_.returnToPool(); reply_ = null; } - closed_ = true; - if(statement_ != null) - statement_.notifyClose (); - - // Close the delete statement if opened. - if(deleteStatement_ != null) - deleteStatement_.close (); - - if(isMetadataResultSet == true) //@mdclose - statement_.close(); //@mdclose - - if(JDTrace.isTraceOn()) - JDTrace.logClose (this); - } - } - - - - /** - Closes the result set if not explicitly closed by the caller. - - @exception Throwable If an error occurs. - **/ - protected void finalize () - throws Throwable - { - try{ - if(! closed_) { - JDTrace.logInformation (this, "WARNING: Finalizer thread closing result set object."); - close (); - } - } - catch(Exception e){ - //catch any exceptions and don't throw them - } - super.finalize (); - } - - - - /** - Returns the column index for the specified column name. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.findColumn("\"MixedCase\""). - - @param columnName The column name. - @return The column index (1-based). - - @exception SQLException If the result set is not open - or the column name is not found. - **/ - public int findColumn (String columnName) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - return row_.findField ((columnName != null) ? columnName : ""); - } - } - - - - // JDBC 2.0 - /** - Returns the result set concurrency. - - @return The result set concurrency. Valid values are: -

          -
        • CONCUR_READ_ONLY -
        • CONCUR_UPDATABLE -
        - - - @exception SQLException If the result set is not open. - **/ - public int getConcurrency () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - - //@cur return value from cursor attribues if exists else return value as done in pre 550 - if ( statement_ != null ) //@cur - { //@cur - if( statement_.cursor_.getCursorAttributeUpdatable() == 0) //@cur - return ResultSet.CONCUR_READ_ONLY; //@cur - else if( statement_.cursor_.getCursorAttributeUpdatable() == 1) //@cur - return ResultSet.CONCUR_UPDATABLE; //@cur - else //@cur - return concurrency_; //@cur - } //@cur - else //@cur - return concurrency_; - } - } - - - - // @D3C - /** - Returns the name of the SQL cursor in use by the result set. - In SQL, results are retrieved through a named cursor. The - current row of a result can be updated or deleted using a - positioned UPDATE or DELETE statement that references a - cursor name. - -

        Cursor names are case sensitive. However, when using a cursor - name within other SQL positioned UPDATE or DELETE statements, - the cursor name will be uppercased. If you use a cursor name - with lowercase characters, you need to enclose it in double - quotes when referring to it in other SQL statements. - - @return The cursor name. - - @exception SQLException If the result is not open. - **/ - public String getCursorName () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - return cursorName_; - } - } - - - - // JDBC 2.0 - /** - Returns the fetch direction. - - @return The fetch direction. - Valid values are: -

          -
        • FETCH_FORWARD -
        • FETCH_REVERSE -
        • FETCH_UNKNOWN -
        - - - - @exception SQLException If the result is not open. - **/ - public int getFetchDirection () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - return fetchDirection_; - } - } - - - - // JDBC 2.0 - /** - Returns the fetch size. - - @return The fetch size. - - @exception SQLException If the result is not open. - **/ - public int getFetchSize () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - return fetchSize_; - } - } - - - - /** - Returns the row cache. - - @return The row cache. - **/ - JDRowCache getRowCache () - { - return rowCache_; - } - - - - // JDBC 2.0 - /** - Returns the statement for this result set. - - @return The statement for this result set, or null if the - result set was returned by a DatabaseMetaData - catalog method. - - @exception SQLException If an error occurs. - **/ - // Implementation note: - // - // * I made a conscious decision not to return the - // DatabaseMetaData's statement, if any, since I do - // not want users to be able to execute their own - // statements using this. - // - public Statement getStatement () - throws SQLException - { - if(isMetadataResultSet)//@mdrs - return null; //@mdrs - else //@mdrs - return statement_; - } - - - - // JDBC 2.0 - /** - Returns the result set type. If the statement requested a result set type - ResultSet.TYPE_FORWARD_ONLY, then the result set type will be - ResultSet.TYPE_FORWARD_ONLY. Otherwise, the result set type may be a type - other than the requested type if the SQL statement that generated the - result set specified a different cursor type when opening the cursor. - - @return The result set type. Valid values are: -
          -
        • TYPE_FORWARD_ONLY -
        • TYPE_SCROLL_INSENSITIVE -
        • TYPE_SCROLL_SENSITIVE -
        - - - - @exception SQLException If the result set is not open. - @since Modification 5 - **/ - public int getType () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - - // Always return FORWARD_ONLY if the application requested forward only - // If this logic changes, also change the similar logic in AS400JDBCStatement. @C4A - if (type_ == ResultSet.TYPE_FORWARD_ONLY) return ResultSet.TYPE_FORWARD_ONLY; - - //@cur return value from cursor attributes if exists else return value as done in pre 550 - if( statement_ != null ) //@cur - { //@cur - if(statement_.cursor_.getCursorAttributeScrollable() == 0) //@cur - return ResultSet.TYPE_FORWARD_ONLY; //@cur - else if(statement_.cursor_.getCursorAttributeSensitive() == 0) //@cur - return ResultSet.TYPE_SCROLL_INSENSITIVE; //@cur - else if(statement_.cursor_.getCursorAttributeSensitive() == 1) //@cur - return ResultSet.TYPE_SCROLL_SENSITIVE; //@cur - else //@cur - return type_; //@cur - } //@cur - else //@cur - return type_; - } - } - - - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL DATALINK output parameter as a - java.net.URL object. - - @param columnIndex The column index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed or - the requested conversion is not valid. - @since Modification 5 - **/ - public URL getURL (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { - checkOpen (); - try - { String string = getString(columnIndex); - if(string == null) - return null; - return new java.net.URL(string); - } - catch(MalformedURLException e) - { - JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID, e); - return null; - } - } - } - - - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL DATALINK output parameter as a - java.net.URL object. - - @param columnName The column name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed or - the requested conversion is not valid. - **/ - public URL getURL (String columnName) - throws SQLException - { - return getURL(findColumn(columnName)); - } - - - - /** - Returns the first warning reported for the result set. - Subsequent warnings may be chained to this warning. - - @return The first warning or null if no warnings - have been reported. - - @exception SQLException If an error occurs. - **/ - public SQLWarning getWarnings () - throws SQLException - { - return sqlWarning_; - } - - - - /** - Indicates if the result set is closed. - - @return true if this result set is closed; - false otherwise. - **/ - //@PDA jdbc40 make public and allow SQLException - public boolean isClosed () throws SQLException - { - return closed_; - } - - - - /** - Posts a warning for this result set. - - @param sqlWarning The warning. - **/ - void postWarning (SQLWarning sqlWarning) - { - if(sqlWarning_ == null) - sqlWarning_ = sqlWarning; - else - sqlWarning_.setNextWarning (sqlWarning); - } - - - - // JDBC 2.0 - /** - Sets the direction in which the rows in a result set are - processed. - - @param fetchDirection The fetch direction for processing rows. - Valid values are: -
          -
        • FETCH_FORWARD -
        • FETCH_REVERSE -
        • FETCH_UNKNOWN -
        - The default is the statement's fetch - direction. - - @exception SQLException If the result set is not open, - the result set is scrollable - and the input value is not - ResultSet.FETCH_FORWARD, - or the input value is not valid. - **/ - // - // Implementation note: - // - // The fetch direction is intended to be a hint for the driver - // to do some optimization (like fetch size helps with record - // blocking). However, we currently don't do anything with it. - // I attempted to document this fact in the javadoc, but could - // not come up with a wording that is not confusing. I think it - // is okay NOT to document the fact that we ignore this setting, - // since it would not affect the behavior of the driver anyway. - // - public void setFetchDirection (int fetchDirection) - throws SQLException - { - synchronized(internalLock_) - { // @D1A //@cur - if(((fetchDirection != FETCH_FORWARD) - && (fetchDirection != FETCH_REVERSE) - && (fetchDirection != FETCH_UNKNOWN)) - || ((getType() == ResultSet.TYPE_FORWARD_ONLY) - && (fetchDirection != ResultSet.FETCH_FORWARD))) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - checkOpen (); - fetchDirection_ = fetchDirection; - - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Fetch direction", fetchDirection_); - } - } - - - - // JDBC 2.0 - /** - Sets the number of rows to be fetched from the database when more - rows are needed. This may be changed at any time. If the value - specified is zero, then the driver will choose an appropriate - fetch size. - -

        This setting only affects statements that meet the criteria - specified in the "block criteria" property. The fetch size - is only used if the "block size" property is set to "0". - - @param fetchSize The number of rows. This must be greater than - or equal to 0 and less than or equal to the - maximum rows limit. The default is the - statement's fetch size. - - @exception SQLException If the result set is not open - or the input value is not valid. - **/ - public void setFetchSize (int fetchSize) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - if((fetchSize < 0) - || ((fetchSize > maxRows_) && (maxRows_ > 0))) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - checkOpen (); - fetchSize_ = fetchSize; - - // This is a kludgy way of keeping the fetch size - // out of the JDRowCache interface. It only applies - // to JDServerRowCache anyway. - if(rowCache_ instanceof JDServerRowCache) - ((JDServerRowCache) rowCache_).setFetchSize (fetchSize_); - - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Fetch size", fetchSize_); - } - } - - - - /** - Returns the name of the SQL cursor in use by the result set. - - @return The cursor name. - **/ - public String toString () - { - return cursorName_; - } - - - - /*---------------------------------------------------------*/ - /* */ - /* CURSOR POSITIONING. */ - /* */ - /*---------------------------------------------------------*/ - - - - // Private data. - // - // Either position from first or last or both is set - // at any given moment, depending on what we can - // determine. Whether we can determine one or both of - // these depends on how the caller has positioned the - // cursor. - // - // For both of these values, 0 means after the last or - // before the first. -1 means not able to determine. - // @E1: a new constant is added which also means we - // don't know the value. -1 is not used because it - // is easy to incorrectly add 1 to -1 and make it look - // like a valid value (and a very hard bug to find). - // Adding 1 to -9999 results in a strange value which - // should be easier to debug. - // - // The position insert flag is set when the cursor - // is moved to the insert row. - // - // @E1: Fully supporting getRow() means at times - // looping through the rows to count them. Two - // values are added to reduce the amount rows we - // loop through. We update highestKnownRow and - // totalRows whenever possible to reduce the number - // of rows we loop through. Once set, these - // values do not change. That means if rows are added - // or deleted during the life of the rs, these - // constants will not reflect the change. I talked - // to the developer of the native driver and - // he feels it is safe (and much faster) to harden - // the values once they are set. The alternative - // is to create a property where the app can tell us - // to re-get the total at appropriate times. The - // performance of that would probably be unacceptably - // slow. - // - - private static final int NOT_KNOWN = -9999; // @E1a - - private int positionFromFirst_ = 0; - private int positionFromLast_ = -1; - private boolean positionInsert_ = false; - private boolean positionValid_ = false; - - // totalRows_ is the number of rows in the RS. Highest - // known row is the biggest row we have reached so far. Eventually - // they will be the same but until there is a need to figure - // out how many rows are in the RS, total will be not-known and - // highest will increase. - private int totalRows_ = NOT_KNOWN; // @E1a - private int highestKnownRow_ = NOT_KNOWN; // @E1a - - - - // JDBC 2.0 - /** - Positions the cursor to an absolute row number. - -

        Attempting to move any number of positions before - the first row positions the cursor to before the first row. - Attempting to move beyond the last - row positions the cursor after the last row. - -

        If an InputStream from the current row is open, it is - implicitly closed. In addition, all warnings and pending updates - are cleared. - - @param rowNumber The absolute row number. If the absolute row - number is positive, this positions the cursor - with respect to the beginning of the result set. - If the absolute row number is negative, this - positions the cursor with respect to the end - of result set. - @return true if the requested cursor position is - valid; false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - the row number is 0, - or an error occurs. - */ - public boolean absolute (int rowNumber) - throws SQLException - { - synchronized(internalLock_) // @D1A - { - // @E2a absolute(0) moves you to before the first row - if(rowNumber == 0) // @E2a - { - // @E2a - beforeFirst(); // @E2a - return false; // @E2a - } // @E2a - - - // Initialization. - beforePositioning (true); - // @E2d if (rowNumber == 0) - // @E2d JDError.throwSQLException (JDError.EXC_CURSOR_POSITION_INVALID); - - // Handle max rows. - // @E3, fixes to correctly handle maxRows, (1) Make sure - // we don't go before first when absolute < 0, and (2) make sure - // we get the row number right because the system and row cache - // do not deal with maxRows. They always deal with the entire - // result set. - // - // old code: - // - // if ((rowNumber > maxRows_) && (maxRows_ > 0)) - // { - // afterLast (); - // return false; - // } - // - // new code: - if(maxRows_ > 0) // @E3a - { - // @E3a - if(rowNumber > 0) // @E3a - { - // @E3a - if(rowNumber > maxRows_) // @E3a - { - // @E3a - afterLast(); // @E3a - return false; // @E3a - } // @E3a - // Don't need an else. Drop through and call the rowCache as if maxRows not set. - } // @E3a - else - { // @E3a // @E3a - if(totalRows_ == NOT_KNOWN) // @E3a - { - // @E3a - findLastRow(); // @E3a - } // @E3a - int distanceFromFirst = totalRows_ + rowNumber; // @E3a - if(distanceFromFirst < 0) // @E3a - { - // @E3a - beforeFirst(); // @E3a - return false; // @E3a - } // @E3a - else // @E3a - rowNumber = distanceFromFirst + 1; // @E3a - // don't return. Drop through and call the rowCache as if maxRows not set. - } // @E3a - } // @E3a - - - // Position the cursor. - rowCache_.absolute (rowNumber); - positionValid_ = (rowCache_.isValid ()); - if(rowNumber > 0) - { - positionFromFirst_ = positionValid_ ? rowNumber : -1; - positionFromLast_ = positionValid_ ? -1 : 0; - - if(positionValid_) // @E1a - { - // @E1a - if(highestKnownRow_ < rowNumber) // @E1a - highestKnownRow_ = rowNumber; // @E1a - - if(totalRows_ != NOT_KNOWN) // @E2a - positionFromLast_ = totalRows_ - rowNumber + 1; // @E2a - } // @E1a - } - else - { - positionFromFirst_ = positionValid_ ? -1 : 0; - positionFromLast_ = positionValid_ ? -rowNumber : -1; - - if(positionValid_) // @E1a - { - // @E1a - if(totalRows_ != NOT_KNOWN) // @E2a - { - // @E2a - int currentRow = totalRows_ + rowNumber; // @E1a - - if(highestKnownRow_ < currentRow) // @E1a - highestKnownRow_ = currentRow; // @E1a - - positionFromFirst_ = currentRow + 1; // @E2a - } // @E1a - } // @E1a - } - - return positionValid_; - } - } - - - - // JDBC 2.0 - /** - Positions the cursor after the last row. - If an InputStream from the current row is open, it is - implicitly closed. In addition, all warnings and pending updates - are cleared. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public void afterLast () - throws SQLException - { - // @E1: Implementation simplified. Now do work in other methods - // that have to do the work anyway. - // - // Old code (v5r1 and older); - // - // synchronized(internalLock_) // @D1a - // { - // beforePositioning (true); - // rowCache_.afterLast (); - // positionFromFirst_ = -1; - // positionFromLast_ = 0; - // positionValid_ = false; - // } - // - // New code (note we don't do beforePositioning(true) because that is - // done in last()) - // - synchronized(internalLock_) - { - last(); - next(); - } - } - - - - // JDBC 2.0 - /** - Positions the cursor before the first row. - If an InputStream from the current row is open, it is implicitly - closed. In addition, all warnings and pending updates are cleared. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public void beforeFirst () - throws SQLException - { - // @E1: Implementation simplified. Now do work in other methods - // that have to do the work anyway. - // - // Old code (v5r1 and older); - // - // synchronized(internalLock_) // @D1A - // { - // beforePositioning (true); - // rowCache_.beforeFirst (); - // positionFromFirst_ = 0; - // positionFromLast_ = -1; - // positionValid_ = false; - // } - // - // New code (note we don't do beforePositioning(true) because that is - // done in last()) - // - synchronized(internalLock_) - { - first(); - previous(); - positionFromLast_ = -1;//@GRA for returning correct value from getRow() after a select and insertRow() - } - } - - - - /** - Checks necessary conditions before positioning a row. All - positioning methods should call this before changing the - position. - - @param scrollable Indicates if the result set must be - scrollable. - - @exception SQLException If the position cannot be done. - **/ - private void beforePositioning (boolean scrollable) - throws SQLException - { - checkOpen (); - - if((scrollable) && (getType() == TYPE_FORWARD_ONLY)) //@cur - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - - clearCurrentRow (); - - // Get off of the insert row, if on it. - positionInsert_ = false; - } - - - // @E3 new method! - /** - Counts the number of rows in the result set. That number - is the number of rows that meet criteria or maxRows, - whichever is smaller. The result of this method is - internal variable "totalRows_" is set. - - **** Callers of this method must reposition the rowCache - **** after calling this method! This method moves the only the - **** rowCache cursor. Since it no longer matches the result set cursor, - **** the caller must re-sync the two cursors. - - @exception SQLException If it doesn't work. - **/ - private void findLastRow () - throws SQLException - { - checkOpen (); - - // if we already know how many rows are in the result set simply return. - if(totalRows_ != NOT_KNOWN) - return; - - - if(highestKnownRow_ > 0) - { - // If we are already past the maximum number of rows (probably - // an error condition) simply re-set highestKnownRow (total - // Rows is reset at the end of this routine). - if(highestKnownRow_ >= maxRows_) - { - highestKnownRow_ = maxRows_; - } - else - { - // As a last resort set the cursor to the highest known - // row then loop through the rows until we hit the end. - rowCache_.absolute(highestKnownRow_); - rowCache_.next(); - - while(rowCache_.isValid()) - { - highestKnownRow_ ++; - - if((maxRows_ > 0) && (highestKnownRow_ == maxRows_)) - break; - - rowCache_.next(); - } - } - } - // worst case, we don't have any idea how many rows are in the rs. - // Start at the beginning and loop through the rows until we hit the - // end or maxRows. - else - { - rowCache_.first(); - - if(! rowCache_.isValid()) - { - return; - } - else - { - highestKnownRow_ = 0; - while(rowCache_.isValid()) - { - highestKnownRow_ ++; - - if((maxRows_ > 0) && (highestKnownRow_ == maxRows_)) - break; - - rowCache_.next(); - } - } - } - totalRows_ = highestKnownRow_; - } - - - - // JDBC 2.0 - /** - Positions the cursor to the first row. - If an InputStream from the current row is open, it is - implicitly closed. In addition, all warnings and pending updates - are cleared. - - @return true if the requested cursor position is - valid; false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public boolean first () - throws SQLException - { - synchronized(internalLock_) // @D1A - { - beforePositioning (true); - rowCache_.first (); - - // If the result set is not empty, then mark the - // position as being on the first row. - if(rowCache_.isValid ()) - { - positionFromFirst_ = 1; - - if(totalRows_ == NOT_KNOWN) // @E1a - positionFromLast_ = -1; - else // @E1a - positionFromLast_ = totalRows_; // @E1a - - positionValid_ = true; - - if(highestKnownRow_ < 1) // @E1a - highestKnownRow_ = 1; // @E1a - } - - // Otherwise, there is no first row (only true if ResultSet is empty) - else - { - positionFromFirst_ = -1; - positionFromLast_ = -1; - positionValid_ = false; - totalRows_ = 0; // @E1a - highestKnownRow_ = NOT_KNOWN; // @E1a - } - - return positionValid_; - } - } - - - - // JDBC 2.0 @D2C - // @E1 entire method re-worked - /** - Returns the current row number, or 0. -

        - 0 is returned if the cursor is not on a valid row (such as - before the first row, after the last row, or on the insert row), - or if the result set is empty. -

        - This method may be slow if cursor movement based on the end - of the result set is used. Methods such as last(), afterLast() - and absolute() with a negative value will move the cursor based - on the end of the result set. This method will be slow in these - cases because internally the method must get every row to determine - how many rows are in the result set before calculating the current - row. The system does not know how many rows are in the result - set until every row is touched. That is why this method may - start at the highest row retrieved so far, then do next() until - the last row is retrieved. -

        - Once the maximum number of rows in the result set is determined, - it does not change until the result set is closed. - - @return The current row number (1-based), or 0 if the current row - is not valid. - - @exception SQLException If the result set is not open. - **/ - public int getRow () - throws SQLException - { - synchronized(internalLock_) // @D1A - { - checkOpen (); - - // @E1 - // Old Code: - // return ((positionFromFirst_ > 0) && (positionInsert_ == false)) - // ? positionFromFirst_ : 0; - // - // Old code in more readable format: - // if ((positionFromFirst_ > 0) && (positionInsert_ == false)) - // return positionFromFirst_; - // else - // return 0; - // - // case 1: return 0 if not on a valid row. - if((positionInsert_ == true) || - (positionValid_ == false) || - (isBeforeFirst()) || - (isAfterLast())) - return 0; - - // case 2: we know what the current row is because scrolling has been - // from the beginning of the result set, or because previous - // method calls calculated the value. - if(positionFromFirst_ > 0) - return positionFromFirst_; - - // case 3a: don't know the current row because negative scrolling or - // scrolling from end has been used, *** and we are currently - // at the end of the rs ***. If we don't know the number of - // rows in the rs we will move the cursor to the highest - // known row then do next() until we get to the end. - if(isLast()) - { - if(totalRows_ != NOT_KNOWN) - { - positionFromFirst_ = totalRows_; - return positionFromFirst_; - } - else - { - if(highestKnownRow_ == NOT_KNOWN) - first(); - else - absolute(highestKnownRow_); - - while(next()) - { - } - previous(); - - return positionFromFirst_; - } - } - - // case 3b: don't know the current row because negative scrolling or - // scrolling from end has been used, *** but we are not currently - // at the end of the rs ***. If we don't know how many rows are - // in the result set we will move the cursor to the highest known - // row then do next() until we get back to where we were. - if(positionFromLast_ > 0) - { - if(totalRows_ != NOT_KNOWN) - { - positionFromFirst_ = totalRows_ - positionFromLast_ + 1; - return positionFromFirst_; - } - else - { - int currentPositionFromLast = positionFromLast_; - - if(highestKnownRow_ == NOT_KNOWN) - first(); - else - absolute(highestKnownRow_); - - while(next()) - { - } - absolute(totalRows_ - currentPositionFromLast + 1); - - return positionFromFirst_; - } - } - - // case 4: We don't have a clue how to figure out what the current row is. Return 0; - if(JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "Could not determine row number in getRow()."); - - return 0; - } - } - - - - // JDBC 2.0 - /** - Indicates if the cursor is positioned after the last row. - - @return true if the cursor is positioned after the last row; - false if the cursor is not positioned after the last - row or if the result set contains no rows. - - @exception SQLException If the result set is not open. - **/ - public boolean isAfterLast () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - return((positionFromLast_ == 0) - && (positionFromFirst_ != 0) - && (positionInsert_ == false) - && (! rowCache_.isEmpty ())); - } - } - - - - // JDBC 2.0 - /** - Indicates if the cursor is positioned before the first row. - - @return true if the cursor is positioned before the first row; - false if the cursor is not positioned before the first - row or if the result set contains no rows. - - @exception SQLException If the result set is not open. - **/ - public boolean isBeforeFirst () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - return((positionFromFirst_ == 0) - && (positionFromLast_ != 0) - && (positionInsert_ == false) - && (! rowCache_.isEmpty ())); - } - } - - - - // JDBC 2.0 - /** - Indicates if the cursor is positioned on the first row. - - @return true if the cursor is positioned on the first row; - false if the cursor is not positioned on the first - row or the row number can not be determined. - - @exception SQLException If the result set is not open. - **/ - public boolean isFirst () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - return((positionFromFirst_ == 1) && (positionInsert_ == false)); - } - } - - - - // JDBC 2.0 - /** - Indicates if the cursor is positioned on the last row. - - @return true if the cursor is positioned on the last row; - false if the cursor is not positioned on the last - row or the row number can not be determined. - - @exception SQLException If the result set is not open. - **/ - public boolean isLast () - throws SQLException - { - synchronized(internalLock_) // @D1A - { - checkOpen (); - // @E2c -- Problem: if scrolling forward we don't know - // if we are on the last row until next() is called. - // In this case isLast() never returns true because - // by the time we figure out we are out of rows we - // are afterLast. The fix is to internally call - // next then previous if we don't figure out we - // are on the last row some othe way. This will be - // slower but accurate. - // - // Old code: - // - // return (((positionFromLast_ == 1) || - // ((positionFromFirst_ == maxRows_) && (maxRows_ > 0))) - // && (positionInsert_ == false)); - // - // New code: - if((positionInsert_ == true) || (positionFromLast_ > 1) || (positionValid_ == false)) - return false; - - if(( positionFromLast_ == 1) || - ((positionFromFirst_ == maxRows_) && (maxRows_ > 0))) - return true; - - boolean returnValue = ! next(); - previous(); - - return returnValue; - } - } - - - - // JDBC 2.0 - /** - Positions the cursor to the last row. - If an InputStream from the current row is open, it is - implicitly closed. In addition, all warnings and pending updates - are cleared. - - @return true if the requested cursor position is - valid; false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public boolean last () - throws SQLException - { - synchronized(internalLock_) // @D1A - { - beforePositioning (true); - - if(maxRows_ > 0) // @E3a - { - // @E3a - findLastRow(); // @E3a - // @E3a - if(totalRows_ >= maxRows_) // @E3a - { - rowCache_.absolute(maxRows_); // @E3a - } - else - { // @E3a - rowCache_.last (); // @E3a - } - } // @E3a - else - rowCache_.last(); - - // If the result set is not empty, then mark the - // position as being on the last row. - if(rowCache_.isValid ()) - { - positionFromFirst_ = -1; - positionFromLast_ = 1; - positionValid_ = true; - - if(totalRows_ != NOT_KNOWN) // @E1a - { - // @E1a - positionFromFirst_ = totalRows_; // @E1a - } // @E1a - } - - // Otherwise, there is no last row (only when result set is empty?) - else - { - positionFromFirst_ = -1; - positionFromLast_ = -1; - positionValid_ = false; - totalRows_ = 0; // @E1a - highestKnownRow_ = NOT_KNOWN; // @E1a - } - - return positionValid_; - } - } - - - - // JDBC 2.0 - /** - Positions the cursor to the current row. This is the row - where the cursor was positioned before moving it to the insert - row. If the cursor is not on the insert row, then this - has no effect. - -

        If an InputStream from the current row is open, it is - implicitly closed. In addition, all warnings and pending updates - are cleared. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public void moveToCurrentRow () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - beforePositioning (true); - } - } - - - - // JDBC 2.0 - /** - Positions the cursor to the insert row. - If an InputStream from the current row is open, it is - implicitly closed. In addition, all warnings and pending updates - are cleared. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - the result set is not updatable, - or an error occurs. - **/ - public void moveToInsertRow () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - beforePositioning (true); - beforeUpdate (); - positionInsert_ = true; - } - } - - - - /** - Positions the cursor to the next row. - If an InputStream from the current row is open, it is - implicitly closed. In addition, all warnings and pending updates - are cleared. - - @return true if the requested cursor position is valid; false - if there are no more rows. - - @exception SQLException If the result set is not open, - or an error occurs. - **/ - public boolean next () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Initialization. - beforePositioning (false); - - // Handle max rows. - if((maxRows_ > 0) && (positionFromFirst_ >= maxRows_)) - { - // @B3D afterLast (); - // @E3D rowCache_.afterLast (); // @B3a - rowCache_.absolute(maxRows_ + 1); // @E3a - positionFromFirst_ = -1; // @B3A - positionFromLast_ = 0; // @B3A - positionValid_ = false; // @B3A - - totalRows_ = maxRows_; // @E1a - highestKnownRow_ = maxRows_; // @E1a - - return false; - } - - // Normal case. If the row is null after a next, then - // the cursor is positioned after the last row. - rowCache_.next(); - - if(rowCache_.isValid ()) - { - if(positionFromFirst_ >= 0) - ++positionFromFirst_; - - if(positionFromLast_ > 0) - --positionFromLast_; - - if(positionFromFirst_ >= 0) // @E1a - if(highestKnownRow_ < positionFromFirst_) // @E1a - highestKnownRow_ = positionFromFirst_; // @E1a - - positionValid_ = true; - - } - else - { - // If this is the first time row has been null, - // then increment one more time. - // @E2a only if there are rows in the rs! - if(! rowCache_.isEmpty ()) // @E2a - { - if(positionFromLast_ != 0) - { - if(positionFromFirst_ >= 0) - { - totalRows_ = positionFromFirst_; // @E2a - ++positionFromFirst_; - } - } - positionFromLast_ = 0; - } // @E2a - else - { // @E1a // @E1a - if(highestKnownRow_ > 0) // @E1a - { - // @E1a - totalRows_ = highestKnownRow_; // @E1a - positionFromFirst_ = totalRows_; // @E1a - positionFromLast_ = 0; // @E1a - } // @E1a - } // @E1a - positionValid_ = false; - } - - return positionValid_; - } - } - - - - // JDBC 2.0 - /** - Positions the cursor to the previous row. - If an InputStream from the current row is open, it is implicitly - closed. In addition, all warnings and pending updates - are cleared. - - @return true if the requested cursor position is - valid; false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - or an error occurs. - **/ - public boolean previous () - throws SQLException - { - synchronized(internalLock_) // @D1A - { - // Initialization. - beforePositioning (true); - - // Normal case. If the row is null after a previous, then - // the cursor is positioned before the first row. - rowCache_.previous(); - - if(rowCache_.isValid ()) - { - if(positionFromFirst_ > 0) - --positionFromFirst_; - - if(positionFromLast_ >= 0) - ++positionFromLast_; - - positionValid_ = true; - } - else - { - // If this is the first time row has been null, - // then increment one more time. - if(positionFromFirst_ != 0) - if(positionFromLast_ >= 0) - ++positionFromLast_; - - positionFromFirst_ = 0; - positionValid_ = false; - } - - return positionValid_; - } - } - - - // JDBC 2.0 - /** - Refreshes the current row from the database and cancels all - pending updates that have been made since the last call to - updateRow(). This method provides a way for an application - to explicitly refetch a row from the database. If an InputStream - from the current row is open, it is implicitly closed. In - addition, all warnings and pending updates are cleared. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - the cursor is not positioned on a row, - the cursor is positioned on the - insert row or an error occurs. - **/ - public void refreshRow () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - if(positionInsert_ == true) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - beforePositioning (true); - if(positionValid_ == false) - JDError.throwSQLException (JDError.EXC_CURSOR_POSITION_INVALID); - - if(concurrency_ == CONCUR_UPDATABLE) - for(int i = 0; i < columnCount_; ++i) - updateSet_[i] = false; - - rowCache_.refreshRow (); - } - } - - - - // JDBC 2.0 - /** - Positions the cursor to a relative row number. - -

        Attempting to move beyond the first row positions the - cursor before the first row. Attempting to move beyond the last - row positions the cursor after the last row. - -

        If an InputStream from the current row is open, it is - implicitly closed. In addition, all warnings and pending updates - are cleared. - - @param rowNumber The relative row number. If the relative row - number is positive, this positions the cursor - after the current position. If the relative - row number is negative, this positions the - cursor before the current position. If the - relative row number is 0, then the cursor - position does not change. - @return true if the requested cursor position is - valid, false otherwise. - - @exception SQLException If the result set is not open, - the result set is not scrollable, - the cursor is not positioned on a valid row, - or an error occurs. - */ - public boolean relative (int rowNumber) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Initialization. - beforePositioning (true); - //if((positionFromFirst_ == 0) || (positionFromLast_ == 0)) //@rel1 per javadoc, relative(1) <==> next() - //return false; - - // Handle max rows. - if((maxRows_ > 0) && (positionFromFirst_ == -1)) // @E3a - getRow(); // @E3a - - if((positionFromFirst_ >= 0) - && (positionFromFirst_ + rowNumber > maxRows_) - && (maxRows_ > 0)) - { // @E3a - afterLast(); // should this be absolute(max+1) // @E3a - return false; - } // @E3a - - - // Normal case. If the row is null after relative, - // then we are off the edge of the result set. - rowCache_.relative (rowNumber); - - if(rowCache_.isValid ()) - { - if(positionFromFirst_ >= 0) - positionFromFirst_ += rowNumber; - - if(positionFromLast_ >= 0) - positionFromLast_ -= rowNumber; - - positionValid_ = true; - - if(positionFromFirst_ >= 0) // @E1a - if(highestKnownRow_ < positionFromFirst_) // @E1a - highestKnownRow_ = positionFromFirst_; // @E1a - - } - else - { - if(rowNumber >= 0) - { - positionFromFirst_ = -1; - positionFromLast_ = 0; - } - else - { - positionFromFirst_ = 0; - positionFromLast_ = -1; - } - positionValid_ = false; - } - - return positionValid_; - } - } - - - - /*---------------------------------------------------------*/ - /* */ - /* GET DATA METHODS. */ - /* */ - /*---------------------------------------------------------*/ - - - - // JDBC 2.0 - /** - Returns the value of a column as an Array object. - DB2 for IBM i does not support arrays. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - **/ - public Array getArray (int columnIndex) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - - - // JDBC 2.0 - /** - Returns the value of a column as an Array object. - DB2 for IBM i does not support arrays. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getArray("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - **/ - public Array getArray (String columnName) - throws SQLException - { - return getArray (findColumn (columnName)); - } - - - - /** - Returns the value of a column as a stream of ASCII - characters. This can be used to get values from columns - with SQL types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and - BLOB. All of the data in the returned stream must be read - prior to getting the value of any other column. The next - call to a get method implicitly closes the stream. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public InputStream getAsciiStream (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - InputStream value = (data == null) ? null : data.getAsciiStream (); - openInputStream_ = value; - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - /** - Returns the value of a column as a stream of ASCII - characters. This can be used to get values from columns - with SQL types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and - BLOB. All of the data in the returned stream must be read - prior to getting the value of any other column. The next - call to a get method implicitly closes the stream. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getAsciiStream("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public InputStream getAsciiStream (String columnName) - throws SQLException - { - return getAsciiStream (findColumn (columnName)); - } - - - - // JDBC 2.0 - // @D0C - /** - Returns the value of a column as a BigDecimal object. This - can be used to get values from columns with SQL types - SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public BigDecimal getBigDecimal (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - BigDecimal value = (data == null) ? null : data.getBigDecimal (-1); - testDataTruncation (columnIndex, data, false); //@trunc getBigDecimal(int) can set truncation_!=0, but we should not throw an SQLEception - return value; - } - } - - - - // JDBC 2.0 - // @D0C - /** - Returns the value of a column as a BigDecimal object. This - can be used to get values from columns with SQL types - SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getBigDecimal("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, - or the requested conversion is not valid. - **/ - public BigDecimal getBigDecimal (String columnName) - throws SQLException - { - return getBigDecimal (findColumn (columnName)); - } - - - - // @D0C - /** - Returns the value of a column as a BigDecimal object. This - can be used to get values from columns with SQL types - SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @param scale The number of digits after the decimal. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the scale is not valid, or the - requested conversion is not valid. - - @deprecated Use getBigDecimal(int) instead. - @see #getBigDecimal(int) - **/ - public BigDecimal getBigDecimal (int columnIndex, int scale) - throws SQLException - { - // Check for negative scale. - if(scale < 0) - JDError.throwSQLException (JDError.EXC_SCALE_INVALID); - - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - BigDecimal value = (data == null) ? null : data.getBigDecimal (scale); - testDataTruncation (columnIndex, data, false); //@trunc getBigDecimal(int) can set truncation_!=0, but we should not throw an SQLEception - return value; - } - } - - - - // @D0C - /** - Returns the value of a column as a BigDecimal object. This - can be used to get values from columns with SQL types - SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getBigDecimal("\"MixedCase\"", 0). - - @param columnName The column name. - @param scale The number of digits after the decimal. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, - the scale is not valid, or the - requested conversion is not valid. - - @deprecated Use getBigDecimal(String) instead. - @see #getBigDecimal(String) - **/ - public BigDecimal getBigDecimal (String columnName, int scale) - throws SQLException - { - return getBigDecimal (findColumn (columnName), scale); - } - - - - /** - Returns the value of a column as a stream of uninterpreted - bytes. This can be used to get values from columns - with SQL types BINARY, VARBINARY, and BLOB. All of the data in - the returned stream must be read prior to getting the - value of any other column. The next call to a get method - implicitly closes the stream. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public InputStream getBinaryStream (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - InputStream value = (data == null) ? null : data.getBinaryStream (); - openInputStream_ = value; - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - /** - Returns the value of a column as a stream of uninterpreted - bytes. This can be used to get values from columns - with SQL types BINARY, VARBINARY, and BLOB. All of the data in - the returned stream must be read prior to getting the - value of any other column. The next call to a get method - implicitly closes the stream. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getBinaryStream("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public InputStream getBinaryStream (String columnName) - throws SQLException - { - return getBinaryStream (findColumn (columnName)); - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a Blob object. - This can be used to get values from columns with SQL - types BINARY, VARBINARY, and BLOB. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public Blob getBlob (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Blob value = (data == null) ? null : data.getBlob (); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a Blob object. - This can be used to get values from columns with SQL - types BINARY, VARBINARY, and BLOB. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getBlob("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public Blob getBlob (String columnName) - throws SQLException - { - return getBlob (findColumn (columnName)); - } - - - - // @D0C - /** - Returns the value of a column as a Java boolean value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @return The column value or false if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public boolean getBoolean (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - boolean value = (data == null) ? false : data.getBoolean (); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - // @D0C - /** - Returns the value of a column as a Java boolean value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getBoolean("\"MixedCase\""). - - @param columnName The column name. - @return The column value or false if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public boolean getBoolean (String columnName) - throws SQLException - { - return getBoolean (findColumn (columnName)); - } - - - - // @D0C - /** - Returns the value of a column as a Java byte value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public byte getByte (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - byte value = (data == null) ? 0 : data.getByte (); - testDataTruncation (columnIndex, data, true); //@trunc - return value; - } - } - - - - // @D0C - /** - Returns the value of a column as a Java byte value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getByte("\"MixedCase\""). - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public byte getByte (String columnName) - throws SQLException - { - return getByte (findColumn (columnName)); - } - - - - /** - Returns the value of a column as a Java byte array. - This can be used to get values from columns with SQL - types BINARY and VARBINARY. - -

        This can also be used to get values from columns - with other types. The values are returned in their - native IBM i format. This is not supported for - result sets returned by a DatabaseMetaData object. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public byte[] getBytes (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - byte[] value; // @C1C - - // Treat this differently from the other get's. If the data is not a // @C1A - // BINARY, VARBINARY, or BLOB, and we have access to the bytes, then return // @C1A @D4C - // the bytes directly. // @C1A - if((data != null) - && (!(data.getSQLType() == SQLData.BINARY)) - && (!(data.getSQLType() == SQLData.VARBINARY)) - && (!(data.getSQLType() == SQLData.BLOB)) // @D4A - && (!(data.getSQLType() == SQLData.BLOB_LOCATOR)) // @D4A - && (!(data.getSQLType() == SQLData.CHAR_FOR_BIT_DATA)) // @M0A - && (!(data.getSQLType() == SQLData.LONG_VARCHAR_FOR_BIT_DATA)) // @M0A - && (!(data.getSQLType() == SQLData.VARCHAR_FOR_BIT_DATA)) // @M0A - && (!(data.getSQLType() == SQLData.ROWID)) // @M0A - && (!(data.getSQLType() == SQLData.XML_LOCATOR)) //@xml3 - && (row_ instanceof JDServerRow)) // @C1A - value = ((JDServerRow)row_).getRawBytes(columnIndex); // @C1A - // @C1A - else - { // @C1A - value = (data == null) ? null : data.getBytes (); // @C1C - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - } // @C1A - return value; - } - } - - - - /** - Returns the value of a column as a Java byte array. - This can be used to get values from columns with SQL - types BINARY and VARBINARY. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getBytes("\"MixedCase\""). - -

        This can also be used to get values from columns - with other types. The values are returned in their - native IBM i format. This is not supported for - result sets returned by a DatabaseMetaData object. - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public byte[] getBytes (String columnName) - throws SQLException - { - return getBytes (findColumn (columnName)); - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a character stream. - This can be used to to get values from columns with SQL - types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and BLOB. - All of the data in the returned stream must be read prior to - getting the value of any other column. The next call to a get - method implicitly closes the stream. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - */ - public Reader getCharacterStream (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Reader value = (data == null) ? null : data.getCharacterStream (); - openReader_ = value; - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a character stream. - This can be used to to get values from columns with SQL - types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and BLOB. - All of the data in the returned stream must be read prior - to getting the value of any other column. The next call - to a get method implicitly closes the stream. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getCharacterStream("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not valid, or the - requested conversion is not valid. - */ - public Reader getCharacterStream (String columnName) - throws SQLException - { - return getCharacterStream (findColumn (columnName)); - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a Clob object. - This can be used to get values from columns with SQL - types CHAR, VARCHAR, BINARY, VARBINARY, BLOB, and CLOB. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public Clob getClob (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Clob value = (data == null) ? null : data.getClob (); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a Clob object. - This can be used to get values from columns with SQL - types CHAR, VARCHAR, BINARY, VARBINARY, BLOB, and CLOB. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getClob("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public Clob getClob (String columnName) - throws SQLException - { - return getClob (findColumn (columnName)); - } - - - - /** - Returns the value of a column as a java.sql.Date object using - the default calendar. This can be used to get values from columns - with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public Date getDate (int columnIndex) - throws SQLException - { - //@P0D return getDate (columnIndex, Calendar.getInstance ()); - return internalGetDate(columnIndex, null); //@P0A - } - - - - /** - Returns the value of a column as a java.sql.Date object using - the default calendar. This can be used to get values from columns - with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getDate("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public Date getDate (String columnName) - throws SQLException - { - //@P0D return getDate (findColumn (columnName), Calendar.getInstance ()); - return internalGetDate(findColumn(columnName), null); //@P0A - } - - - //@P0A - Moved out of getDate() - private Date internalGetDate(int columnIndex, Calendar calendar) - throws SQLException - { - synchronized(internalLock_) - { - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Date value = (data == null) ? null : data.getDate (calendar); - testDataTruncation (columnIndex, data, false); //@trunc getDate() can set truncation_!=0, but we should not throw an SQLEception - return value; - } - } - - // JDBC 2.0 - /** - Returns the value of a column as a java.sql.Date object using - a calendar other than the default. This can be used to get values - from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - - @param columnIndex The column index (1-based). - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the calendar is null, or the - requested conversion is not valid. - **/ - public Date getDate (int columnIndex, Calendar calendar) - throws SQLException - { - // Check for null calendar. - if(calendar == null) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - return internalGetDate(columnIndex, calendar); //@P0C - /*@P0M - synchronized(internalLock_) { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Date value = (data == null) ? null : data.toDate (calendar); - testDataTruncation (columnIndex, data); - return value; - } - */ //@P0M - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a java.sql.Date object using - a calendar other than the default. This can be used to get values - from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getDate("\"MixedCase\"", calendar). - - @param columnName The column name. - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, - the calendar is null, or the - requested conversion is not valid. - **/ - public Date getDate (String columnName, Calendar calendar) - throws SQLException - { - return getDate (findColumn (columnName), calendar); - } - - - - // @D0C - /** - Returns the value of a column as a Java double value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public double getDouble (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - double value = (data == null) ? 0 : data.getDouble (); - testDataTruncation (columnIndex, data, true); //@trunc - return value; - } - } - - - - // @D0C - /** - Returns the value of a column as a Java double value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getDouble("\"MixedCase\""). - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public double getDouble (String columnName) - throws SQLException - { - return getDouble (findColumn (columnName)); - } - - - - // @D0C - /** - Returns the value of a column as a Java float value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public float getFloat (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - float value = (data == null) ? 0 : data.getFloat (); - testDataTruncation (columnIndex, data, true); //@trunc - return value; - } - } - - - - // @D0C - /** - Returns the value of a column as a Java float value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getFloat("\"MixedCase\""). - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public float getFloat (String columnName) - throws SQLException - { - return getFloat (findColumn (columnName)); - } - - - - // @D0C - /** - Returns the value of a column as a Java int value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public int getInt (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - int value = (data == null) ? 0 : data.getInt (); - testDataTruncation (columnIndex, data, true); //@trunc - return value; - } - } - - - - // @D0C - /** - Returns the value of a column as a Java int value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getInt("\"MixedCase\""). - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public int getInt (String columnName) - throws SQLException - { - return getInt (findColumn (columnName)); - } - - - - // @D0C - /** - Returns the value of a column as a Java long value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public long getLong (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - long value = (data == null) ? 0 : data.getLong (); - testDataTruncation (columnIndex, data, true); //@trunc - return value; - } - } - - - - // @D0C - /** - Returns the value of a column as a Java long value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getLong("\"MixedCase\""). - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public long getLong (String columnName) - throws SQLException - { - return getLong (findColumn (columnName)); - } - - - - /** - Returns the ResultSetMetaData object that describes the - result set's columns. - - @return The metadata object. - - @exception SQLException If an error occurs. - **/ - public ResultSetMetaData getMetaData () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - ConvTable convTable = null; // @G5A - DBExtendedColumnDescriptors extendedDescriptors = null; // @G5A - // If a DMD method (internal call), statement_ will be null because we don't really have // @G5A - // a statement object // @G5A - if(statement_ != null) // @G5A - { - // @G5A - extendedDescriptors = statement_.getExtendedColumnDescriptors(); // @G5A - // If we have extendedDescriptors, send a ConvTable to convert them, else pass null // @G5A - if(extendedDescriptors != null) // @G5A - { - // @G5A - convTable = ((AS400JDBCConnection)connection_).converter_; // @G5A - } // @G5A - } // @G5A - return new AS400JDBCResultSetMetaData (catalog_, concurrency_, - cursorName_, row_, - extendedDescriptors, convTable, connection_); // @G5A //@in1 - } - } - - - - /** - Returns the value of a column as a Java Object. - This can be used to get values from columns with all - SQL types. If the column is a user-defined type, then the - connection's type map is used to created the object. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public Object getObject (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Object value = (data == null) ? null : data.getObject (); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - /** - Returns the value of a column as a Java Object. - This can be used to get values from columns with all - SQL types. If the column is a user-defined type, then the - connection's type map is used to created the object. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getObject("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public Object getObject (String columnName) - throws SQLException - { - return getObject (findColumn (columnName)); - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a Java Object. - - @param columnIndex The column index (1-based). - @param typeMap The type map. This is not used. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the type map is null, or the - requested conversion is not valid. - **/ - public Object getObject (int columnIndex, Map typeMap) - throws SQLException - { - // Check for null type map, even though we don't use it. - if(typeMap == null) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - return getObject (columnIndex); - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a Java Object. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getObject("\"MixedCase\"", typeMap). - - @param columnName The column name. - @param typeMap The type map. This is not used. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, - the type map is null, or the - requested conversion is not valid. - **/ - public Object getObject (String columnName, Map typeMap) - throws SQLException - { - // Check for null type map, even though we don't use it. - if(typeMap == null) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - return getObject (findColumn (columnName)); - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a Ref object. - DB2 for IBM i does not support structured types. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support structured types. - **/ - public Ref getRef (int columnIndex) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a Ref object. - DB2 for IBM i does not support structured types. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getRef("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support structured types. - **/ - public Ref getRef (String columnName) - throws SQLException - { - return getRef (findColumn (columnName)); - } - - - - // @D0C - /** - Returns the value of a column as a Java short value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - - @param columnIndex The column index (1-based). - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public short getShort (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - short value = (data == null) ? 0 : data.getShort (); - testDataTruncation (columnIndex, data, true); //@trunc - return value; - } - } - - - - // @D0C - /** - Returns the value of a column as a Java short value. - This can be used to get values from columns with SQL - types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - NUMERIC, CHAR, and VARCHAR. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getShort("\"MixedCase\""). - - @param columnName The column name. - @return The column value or 0 if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public short getShort (String columnName) - throws SQLException - { - return getShort (findColumn (columnName)); - } - - - - /** - Returns the value of a column as a String object. - This can be used to get values from columns with any SQL - type. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public String getString (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - String value = (data == null) ? null : data.getString (); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - /** - Returns the value of a column as a String object. - This can be used to get values from columns with any SQL - type. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getString("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public String getString (String columnName) - throws SQLException - { - return getString (findColumn (columnName)); - } - - - - /** - Returns the value of a column as a java.sql.Time object using the - default calendar. This can be used to get values from columns - with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public Time getTime (int columnIndex) - throws SQLException - { - //@P0D return getTime (columnIndex, Calendar.getInstance ()); - return internalGetTime(columnIndex, null); //@P0A - } - - - - /** - Returns the value of a column as a java.sql.Time object using the - default calendar. This can be used to get values from columns - with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getTime("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public Time getTime (String columnName) - throws SQLException - { - //@P0D return getTime (findColumn (columnName), Calendar.getInstance ()); - return internalGetTime(findColumn(columnName), null); //@P0A - } - - //@P0M - Moved out of getTime() - private Time internalGetTime(int columnIndex, Calendar calendar) - throws SQLException - { - synchronized(internalLock_) - { - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Time value = (data == null) ? null : data.getTime (calendar); - testDataTruncation (columnIndex, data, false); //@trunc getTime() can set truncation_!=0, but we should not throw an SQLEception - return value; - } - } - - // JDBC 2.0 - /** - Returns the value of a column as a java.sql.Time object using a - calendar other than the default. This can be used to get values - from columns with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP. - - @param columnIndex The column index (1-based). - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the calendar is null, or the - requested conversion is not valid. - **/ - public Time getTime (int columnIndex, Calendar calendar) - throws SQLException - { - //@P0D synchronized(internalLock_) { // @D1A - // Check for null calendar. - if(calendar == null) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - return internalGetTime(columnIndex, calendar); //@P0C - /*@P0M - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Time value = (data == null) ? null : data.toTime (calendar); - testDataTruncation (columnIndex, data); - return value; - } - */ //@P0M - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a java.sql.Time object using a - calendar other than the default. This can be used to get values - from columns with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getTime("\"MixedCase\"", calendar). - - @param columnName The column name. - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, - the calendar is null, or the - requested conversion is not valid. - **/ - public Time getTime (String columnName, Calendar calendar) - throws SQLException - { - return getTime (findColumn (columnName), calendar); - } - - - - /** - Returns the value of a column as a java.sql.Timestamp object - using the default calendar. This can be used to get values - from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public Timestamp getTimestamp (int columnIndex) - throws SQLException - { - //@P0D return getTimestamp (columnIndex, Calendar.getInstance ()); - return internalGetTimestamp(columnIndex, null); //@P0A - } - - - - /** - Returns the value of a column as a java.sql.Timestamp object - using the default calendar. This can be used to get values - from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getTimestamp("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public Timestamp getTimestamp (String columnName) - throws SQLException - { - //@P0D return getTimestamp (findColumn (columnName), Calendar.getInstance ()); - return internalGetTimestamp(findColumn(columnName), null); //@P0A - } - - //@P0M - Moved out of getTimestamp() - private Timestamp internalGetTimestamp(int columnIndex, Calendar calendar) - throws SQLException - { - synchronized(internalLock_) - { - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Timestamp value = (data == null) ? null : data.getTimestamp (calendar); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - // JDBC 2.0 - /** - Returns the value of a column as a java.sql.Timestamp object - using a calendar other than the default. This can be used to - get values from columns with SQL types CHAR, VARCHAR, DATE, - and TIMESTAMP. - - @param columnIndex The column index (1-based). - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, - the calendar is null, or the - requested conversion is not valid. - **/ - public Timestamp getTimestamp (int columnIndex, Calendar calendar) - throws SQLException - { - // Check for null calendar. - if(calendar == null) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - return internalGetTimestamp(columnIndex, calendar); - /*@P0M - synchronized(internalLock_) { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - Timestamp value = (data == null) ? null : data.toTimestamp (calendar); - testDataTruncation (columnIndex, data); - return value; - } - */ //@P0M - } - - - - // JDBC 2.0 - /** - Returns the value of a column as a java.sql.Timestamp object - using a calendar other than the default. This can be used to - get values from columns with SQL types CHAR, VARCHAR, DATE, - and TIMESTAMP. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getTimestamp("\"MixedCase\"", calendar). - - @param columnName The column name. - @param calendar The calendar. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, - the calendar is null, or the - requested conversion is not valid. - **/ - public Timestamp getTimestamp (String columnName, Calendar calendar) - throws SQLException - { - return getTimestamp (findColumn (columnName), calendar); - } - - - - /** - Returns the value of a column as a stream of Unicode - characters. This can be used to get values from columns - with SQL types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and - BLOB. All of the data in the returned stream must be read - prior to getting the value of any other column. The next - call to a get method implicitly closes the stream. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - - @deprecated Use getCharacterStream(int) instead. - @see #getCharacterStream(int) - **/ - public InputStream getUnicodeStream (int columnIndex) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // Get the data and check for SQL NULL. - SQLData data = getValue (columnIndex); - InputStream value = (data == null) ? null : data.getUnicodeStream (); - openInputStream_ = value; - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - - /** - Returns the value of a column as a stream of Unicode - characters. This can be used to get values from columns - with SQL types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, - and BLOB. All of the data in the returned stream must be - read prior to getting the value of any other column. The - next call to a get method implicitly closes the stream. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.getUnicodeStream("\"MixedCase\""). - - @param columnName The column name. - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - - @deprecated Use getCharacterStream(String) instead. - @see #getCharacterStream(String) - **/ - public InputStream getUnicodeStream (String columnName) - throws SQLException - { - return getUnicodeStream (findColumn (columnName)); - } - - - - /** - Returns a piece of row data for the specified index, - and perform all appropriate validation. Also check - for SQL NULL. - - @param columnIndex The column index (1-based). - @return The column value or null if the value is SQL NULL. - - @exception SQLException If the result set is not open, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - private SQLData getValue (int columnIndex) - throws SQLException - { - checkOpen (); - clearCurrentValue (); - - // Check that there is a current row. - if((positionValid_ == false) && (positionInsert_ == false)) - JDError.throwSQLException (JDError.EXC_CURSOR_POSITION_INVALID); - - // Validate The column index. - if((columnIndex < 1) || (columnIndex > columnCount_)) - JDError.throwSQLException (JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Check if an update was made or we are on the insert - // row. - if(concurrency_ == CONCUR_UPDATABLE) - { - if((updateSet_[columnIndex-1] == true) //@EIC2 changed back to original logic. For case of after insertrow is inserted, the updateSet[] is reset, but can still have non-null data. - || (positionInsert_ == true)) - { - wasNull_ = updateNulls_[columnIndex-1]; - wasDataMappingError_ = false; - if(wasNull_) - return null; - else - return updateRow_.getSQLData (columnIndex); - } - } - - // Get the data and check for SQL NULL. @A1C - wasNull_ = row_.isNull (columnIndex); - wasDataMappingError_ = row_.isDataMappingError(columnIndex); - - //@KBL if a locator is used, tell the statement associated with it - SQLData sqlData = row_.getSQLType(columnIndex); //@KBL - int sqlType = sqlData.getSQLType(); //@xml3 - if((sqlType == SQLData.CLOB_LOCATOR || //@KBL - sqlType == SQLData.BLOB_LOCATOR || //@KBL - sqlType == SQLData.DBCLOB_LOCATOR || //@KBL //@pdc jdbc40 - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 - sqlType == SQLData.XML_LOCATOR) - && statement_ != null) //@mdrs2 //@xml3 - statement_.setAssociatedWithLocators(true); //@KBL - - if(wasNull_ || wasDataMappingError_) - return null; - else - return row_.getSQLData (columnIndex); - } - - - - /** - Tests if a DataTruncation occurred on the read of a piece of - data and posts a DataTruncation warning if so. - - @param columnIndex The column index (1-based). - @param data The data that was read, or null for SQL NULL. - @param exceptionOnTrunc Flag to notify method whether or not to throw an SQLException when there is truncation. - **/ - private void testDataTruncation (int columnIndex, SQLData data, boolean exceptionOnTrunc) throws SQLException //@trunc - { - if(wasDataMappingError_) - { - postWarning(new DataTruncation(columnIndex, false, true, -1, -1)); - } - - if(data != null) - { - int truncated = data.getTruncated (); - if(truncated > 0) - { - //if 610 and number data type and called on certain getX() methods, then throw SQLException - //if 610, follow Native driver to thow exc if data is text and getX() is a number type getter method. - if((((AS400JDBCConnection)connection_).getVRM() >= JDUtilities.vrm610) && (exceptionOnTrunc == true)) //@trunc //@trunc2 only use exceptionOnTrunc as flag - { //@trunc - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); //@trunc - } //@trunc - int actualSize = data.getActualSize (); - postWarning (new DataTruncation (columnIndex, false, true, - actualSize, actualSize - truncated)); - } - } - } - - - - /** - Indicates if the last column read has the value of SQL NULL. - - @return true if the value is SQL NULL; - false otherwise. - - @exception SQLException If the result set is not open. - **/ - public boolean wasNull () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - checkOpen (); - return wasNull_; - } - } - - - - /*---------------------------------------------------------*/ - /* */ - /* UPDATE DATA METHODS. */ - /* */ - /*---------------------------------------------------------*/ - - - - /** - Checks necessary conditions before updating a row. All - update methods should call this before updating. - - @exception SQLException If the result set is not open - or the result set is not updatable. - **/ - private void beforeUpdate () - throws SQLException - { - checkOpen (); - - if(concurrency_ != CONCUR_UPDATABLE) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - - - // JDBC 2.0 - /** - Cancels all pending updates that have been made since the last - call to updateRow(). If no updates have been made or updateRow() - has already been called, then this method has no effect. - - @exception SQLException If the result set is not open - or the result set is not updatable. - **/ - public void cancelRowUpdates () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - beforeUpdate (); - - for(int i = 0; i < columnCount_; ++i) - updateSet_[i] = false; - } - } - - - - // JDBC 2.0 - /** - Deletes the current row from the result set and the database. - After deleting a row, the cursor position is no longer valid, - so it must be explicitly repositioned. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the cursor is positioned on the insert row, - or an error occurs. - **/ - public void deleteRow () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - beforeUpdate (); - - if(positionValid_ == false) // @D9a - JDError.throwSQLException (JDError.EXC_CURSOR_POSITION_INVALID); // @D9a - - if(positionInsert_ == true) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - - if(JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "Deleting a row."); - - // Prepare the delete statement the first time - // we need it. - if(deleteStatement_ == null) - { // @D3C - StringBuffer buffer = new StringBuffer(); // @D3A - buffer.append("DELETE FROM "); // @D3A - buffer.append(selectTable_); // @D3A - buffer.append(" WHERE CURRENT OF \""); // @D3A - buffer.append(cursorName_); // @D3A - buffer.append("\""); // @D3A - deleteStatement_ = connection_.prepareStatement(buffer.toString()); // @D3C - } // @D3A - - deleteStatement_.execute (); - - // Mark the cursor position not valid. - positionValid_ = false; - rowCache_.flush (); - } - } - - - - // JDBC 2.0 - /** - Inserts the contents of the insert row into the result set - and the database. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on the insert row, - a column that is not nullable was not specified, - or an error occurs. - **/ - // - // Implementation note: - // - // * It seems inefficient to prepare and execute a - // new statement each time, but we really have no choice, - // since (1.) The combination of columns that we want - // to insert could change every time and (2.) We need - // to use parameter markers to be able to set columns - // not representable using SQL literals. - // - public void insertRow () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - beforeUpdate (); - - if(positionInsert_ == false) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - - // Build up the SQL statement. Make sure a correlation name - // is not used. - StringBuffer buffer = new StringBuffer (); - buffer.append ("INSERT INTO "); - buffer.append (selectTable_); - buffer.append (" ("); - StringBuffer values = new StringBuffer (); - int columnsSet = 0; - for(int i = 0; i < columnCount_; ++i) - { - if(updateSet_[i] == true) - { - if(columnsSet++ > 0) - { - buffer.append (","); - values.append (","); - } - buffer.append ("\""); // @D6a - buffer.append (prepareQuotes(row_.getFieldName (i+1))); //@DELIMc - buffer.append ("\""); // @D6a - values.append ("?"); - } - } - if(columnsSet == 0) - buffer.append (prepareQuotes(row_.getFieldName (1))); //@DELIMc - buffer.append (") VALUES ("); - if(columnsSet == 0) - buffer.append ("NULL"); - else - buffer.append (values.toString()); // added toString() because 1.4 has a method that appends a string buffer - buffer.append (")"); - - if(JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "Inserting a row: " + buffer); - - // Prepare the statement and set the parameters. - PreparedStatement insertStatement = connection_.prepareStatement (buffer.toString ()); - for(int i = 0, columnsSet2 = 0; i < columnCount_; ++i) - { - if(updateSet_[i] == true) - { - Object columnValue = updateRow_.getSQLData (i+1).getObject (); - if(updateNulls_[i]) - insertStatement.setNull (++columnsSet2, row_.getSQLType (i+1).getType ()); - else if(updateDefaults_[i]) //@EIA - ((AS400JDBCPreparedStatement)insertStatement).setDB2Default(++columnsSet2); //@EIA - else if(updateUnassigned_[i]) //@EIA - ((AS400JDBCPreparedStatement)insertStatement).setDB2Unassigned(++columnsSet2); //@EIA - else - insertStatement.setObject (++columnsSet2, columnValue); - updateSet_[i] = false; - } - } - - // Execute and close the statement. Dispatch the warnings, - // if any. - insertStatement.executeUpdate (); - SQLWarning warnings = insertStatement.getWarnings (); - if(warnings != null) - postWarning (warnings); // The whole link gets added. - insertStatement.close (); - - rowCache_.flush (); - } - } - - - //@DELIMa - // Prepares a name to be double-quoted. - private final static String prepareQuotes(String name) - { - return JDUtilities.prepareForDoubleQuotes(name); - } - - - // JDBC 2.0 - /** - Indicates if the current row has been deleted. A result set - of type TYPE_SCROLL_INSENSITIVE may contain rows that have - been deleted. - - @return true if current row has been deleted; false otherwise. - - @exception SQLException If an error occurs. - **/ - public boolean rowDeleted () - throws SQLException - { - synchronized(internalLock_) - { // @D1A - // We almost always return false because we don't allow - // updates to scroll insensitive or forward only result - // sets, so we never have holes. - // - // The only case where this may be true is if they call - // it immediately after deleting a row and then don't - // reposition the cursor. - return((positionValid_ == false) && (positionInsert_ == false) - && ((positionFromFirst_ > 0) || (positionFromLast_ > 0))); - } - } - - - - // JDBC 2.0 - /** - Indicates if the current row has been inserted. This driver does - not support this method. - - @return Always false. - - @exception SQLException If an error occurs. - **/ - public boolean rowInserted () - throws SQLException - { - // For forward only and scroll insensitive result sets, we don't - // have the ability to detect this. For scroll sensitive result - // sets, the inserts are visible, but we don't have access to which - // were inserted. So we always return false. - return false; - } - - - - // JDBC 2.0 - /** - Indicates if the current row has been updated. This driver does - not support this method. - - @return Always false. - - @exception SQLException If an error occurs. - **/ - public boolean rowUpdated () - throws SQLException - { - // For forward only and scroll insensitive result sets, we don't - // have the ability to detect this. For scroll sensitive result - // sets, the inserts are visible, but we don't have access to which - // were inserted. So we always return false. - return false; - } - - - - /** - Tests if a DataTruncation occurred on the write of a piece of - data and posts a DataTruncation warning if so. - - @param columnIndex The column index (1-based). - @param data The data that was written, or null for SQL NULL. - @since Modification 5 - **/ - private void testDataTruncation2 (int columnIndex, SQLData data) - throws SQLException // @D5A //@trunc - { - if(data != null) - { - int truncated = data.getTruncated (); - if(truncated > 0) - { - int actualSize = data.getActualSize (); - throw new DataTruncation (columnIndex, false, false, // @D5C - actualSize + truncated, actualSize); // @D5C - } - } - } - - - - //@G4A JDBC 3.0 - /** - Updates the value of a column as an Array object. - DB2 for IBM i does not support arrays. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - @since Modification 5 - **/ - public void updateArray (int columnIndex, Array columnValue) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - } - - - - //@G4A JDBC 3.0 - /** - Updates the value of a column as an Array object. - DB2 for IBM i does not support arrays. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateArray("\"MixedCase\"", columnValue). - - @param columnName The column name. - @param columnValue The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - **/ - public void updateArray (String columnName, Array columnValue) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using an ASCII stream value. - The driver reads the data from the stream as needed until no more - bytes are available. The driver converts this to an SQL VARCHAR - value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - @param length The length. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, the - requested conversion is not valid, - the length is not - valid, the input stream does not contain - ASCII characters, or an error happens - while reading the input stream. - **/ - public void updateAsciiStream (int columnIndex, - InputStream columnValue, - int length) - throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - - updateValue (columnIndex, - (columnValue == null) ? null : JDUtilities.streamToString (columnValue, length, "ISO8859_1"), // @B1C - null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using an ASCII stream value. - The driver reads the data from the stream as needed until no more - bytes are available. The driver converts this to an SQL VARCHAR - value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateAsciiStream("\"MixedCase\"", columnValue, length). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - @param length The length. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, the - requested conversion is not valid, - the length is not valid, - the input stream does not contain - ASCII characters, or an error happens - while reading the input stream. - **/ - public void updateAsciiStream (String columnName, - InputStream columnValue, - int length) - throws SQLException - { - updateAsciiStream (findColumn (columnName), columnValue, length); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a BigDecimal value. The - driver converts this to an SQL NUMERIC value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBigDecimal (int columnIndex, BigDecimal columnValue) - throws SQLException - { - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - - updateValue (columnIndex, columnValue, null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a BigDecimal value. The - driver converts this to an SQL NUMERIC value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateBigDecimal("\"MixedCase\"", columnValue). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateBigDecimal (String columnName, BigDecimal columnValue) - throws SQLException - { - updateBigDecimal (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a binary stream value. - The driver reads the data from the stream as needed until no more - bytes are available. The driver converts this to an SQL - VARBINARY value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - @param length The length. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid, - the length is not valid, or an error - happens while reading the input stream. - **/ - public void updateBinaryStream (int columnIndex, - InputStream columnValue, - int length) - throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - - updateValue (columnIndex, - (columnValue == null) ? null : JDUtilities.streamToBytes (columnValue, length), // @B1C - null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a binary stream value. - The driver reads the data from the stream as needed until no more - bytes are available. The driver converts this to an SQL - VARBINARY value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateBinaryStream("\"MixedCase\"", columnValue, length). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - @param length The length. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid, - the length is not valid, or an error - happens while reading the input stream. - **/ - public void updateBinaryStream (String columnName, - InputStream columnValue, - int length) - throws SQLException - { - updateBinaryStream (findColumn (columnName), columnValue, length); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java boolean value. - The driver converts this to an SQL SMALLINT value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIT, but DB2 for IBM i - // does not support that. - // - public void updateBoolean (int columnIndex, boolean columnValue) - throws SQLException - { - updateValue (columnIndex, new Short ((short) (columnValue ? 1 : 0)), null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java boolean value. - The driver converts this to an SQL SMALLINT value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateBoolean("\"MixedCase\"", columnValue). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - @since Modification 5 - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIT, but DB2 for IBM i - // does not support that. - // - public void updateBoolean (String columnName, boolean columnValue) - throws SQLException - { - updateBoolean (findColumn (columnName), columnValue); - } - - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using a Java Blob value. - The driver converts this to an SQL BLOB value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - @since Modification 5 - **/ - public void updateBlob (int columnIndex, Blob columnValue) - throws SQLException - { - updateValue (columnIndex, columnValue, null, -1); - } - - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using a Java Blob value. - The driver converts this to an SQL BLOB value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateBlob("\"MixedCase\"", columnValue). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBlob (String columnName, Blob columnValue) - throws SQLException - { - updateValue (findColumn (columnName), columnValue, null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java byte value. - The driver converts this to an SQL SMALLINT value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL TINYINT, but DB2 for IBM i - // does not support that. - // - public void updateByte (int columnIndex, byte columnValue) - throws SQLException - { - updateValue (columnIndex, new Short (columnValue), null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java byte value. - The driver converts this to an SQL SMALLINT value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateByte("\"MixedCase\"", columnValue). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL TINYINT, but DB2 for IBM i - // does not support that. - // - public void updateByte (String columnName, byte columnValue) - throws SQLException - { - updateByte (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java byte array value. - The driver converts this to an SQL VARBINARY value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBytes (int columnIndex, byte[] columnValue) - throws SQLException - { - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - - updateValue (columnIndex, columnValue, null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java byte array value. - The driver converts this to an SQL VARBINARY value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateBytes("\"MixedCase\"", columnValue). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateBytes (String columnName, byte[] columnValue) - throws SQLException - { - updateBytes (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Reader value. - The driver reads the data from the Reader as needed until no more - characters are available. The driver converts this to an SQL VARCHAR - value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - @param length The length. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid, - the length is not valid, or an error - happens while reading the input stream. - **/ - public void updateCharacterStream (int columnIndex, - Reader columnValue, - int length) - throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - - updateValue (columnIndex, - (columnValue == null) ? null : JDUtilities.readerToString (columnValue, length), // @B1C - null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Reader value. - The driver reads the data from the Reader as needed until no more - characters are available. The driver converts this to an SQL VARCHAR - value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateCharacterStream("\"MixedCase\"", columnValue, length). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - @param length The length. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid, - the length is not valid, or an error - happens while reading the input stream. - @since Modification 5 - **/ - public void updateCharacterStream (String columnName, - Reader columnValue, - int length) - throws SQLException - { - updateCharacterStream (findColumn (columnName), columnValue, length); - } - - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using a Java Clob value. - The driver converts this to an SQL CLOB value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - @since Modification 5 - **/ - public void updateClob (int columnIndex, Clob columnValue) - throws SQLException - { - updateValue (columnIndex, columnValue, null, -1); - } - - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using a Java Clob value. - The driver converts this to an SQL CLOB value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateClob("\"MixedCase\"", columnValue). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateClob (String columnName, Clob columnValue) - throws SQLException - { - updateValue (findColumn (columnName), columnValue, null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a java.sql.Date value. - The driver converts this to an SQL DATE value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateDate (int columnIndex, Date columnValue) - throws SQLException - { - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - - updateValue (columnIndex, columnValue, null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a java.sql.Date value. - The driver converts this to an SQL DATE value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateDate("\"MixedCase\"", columnValue). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateDate (String columnName, Date columnValue) - throws SQLException - { - updateDate (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java double value. - The driver converts this to an SQL DOUBLE value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateDouble (int columnIndex, double columnValue) - throws SQLException - { - updateValue (columnIndex, new Double (columnValue), null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java double value. - The driver converts this to an SQL DOUBLE value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateDouble("\"MixedCase\"", columnValue). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateDouble (String columnName, double columnValue) - throws SQLException - { - updateDouble (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java float value. - The driver converts this to an SQL REAL value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateFloat (int columnIndex, float columnValue) - throws SQLException - { - updateValue (columnIndex, new Float (columnValue), null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java float value. - The driver converts this to an SQL REAL value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateFloat("\"MixedCase\"", columnValue). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateFloat (String columnName, float columnValue) - throws SQLException - { - updateFloat (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java int value. - The driver converts this to an SQL INTEGER value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateInt (int columnIndex, int columnValue) - throws SQLException - { - updateValue (columnIndex, new Integer (columnValue), null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java int value. - The driver converts this to an SQL INTEGER value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateInt("\"MixedCase\"", columnValue). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateInt (String columnName, int columnValue) - throws SQLException - { - updateInt (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - // @D0C - /** - Updates a column in the current row using a Java long value. - If the connected system supports SQL BIGINT data, the driver - converts this to an SQL BIGINT value. Otherwise, the driver - converts this to an SQL INTEGER value. SQL BIGINT data is - supported on V4R5 and later. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIGINT, but DB2 for IBM i - // does not support that until V4R5. - // - public void updateLong (int columnIndex, long columnValue) - throws SQLException - { - updateValue (columnIndex, new Long(columnValue), null, -1); // @D0C - } - - - - // JDBC 2.0 - // @D0C - /** - Updates a column in the current row using a Java long value. - If the connected system supports SQL BIGINT data, the driver - converts this to an SQL BIGINT value. Otherwise, the driver - converts this to an SQL INTEGER value. SQL BIGINT data is - supported on V4R5 and later. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateLong("\"MixedCase\"", columnValue). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - // - // Implementation note: - // - // The spec defines this in terms of SQL BIGINT, but DB2 for IBM i - // does not support that until V4R5. - // - public void updateLong (String columnName, long columnValue) - throws SQLException - { - updateLong (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using SQL NULL. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateNull (int columnIndex) - throws SQLException - { - updateValue (columnIndex, null, null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using SQL NULL. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateNull("\"MixedCase\""). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateNull (String columnName) - throws SQLException - { - updateNull (findColumn (columnName)); - } - - - - //@EIA 550 extended indicator defaults - /** - Updates a column in the current row to the SQL Default. - @param columnIndex The column index (1-based). - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void updateDB2Default(int columnIndex) throws SQLException - { - updateValueExtendedIndicator (columnIndex, 1); //1 is default - } - - //@EIA 550 extended indicator defaults - /** - Updates a column in the current row to the SQL Default. Same as updateDB2Default. - @param columnIndex The column index (1-based). - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void updateDBDefault(int columnIndex) throws SQLException - { - updateDB2Default(columnIndex); - } - - //@EIA 550 extended indicator defaults - /** - Updates a column in the current row to the SQL Default. - @param columnName The column name. - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void updateDB2Default(String columnName) throws SQLException - { - updateDB2Default (findColumn (columnName)); - } - - //@EIA 550 extended indicator defaults - /** - Updates a column in the current row to the SQL Default. Same as updateDB2Default. - @param columnName The column name. - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void updateDBDefault(String columnName) throws SQLException - { - updateDB2Default (findColumn (columnName)); - } - - - //@EIA 550 extended indicator defaults - /** - Updates a column in the current row to the SQL Unassigned. - @param columnIndex The column index (1-based). - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void updateDB2Unassigned(int columnIndex) throws SQLException - { - updateValueExtendedIndicator (columnIndex, 2); //2 is unassigned - } - - //@EIA 550 extended indicator defaults - /** - Updates a column in the current row to the SQL Unassigned. Same as updtaeDB2Unassigned. - @param columnIndex The column index (1-based). - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void updateDBUnassigned(int columnIndex) throws SQLException - { - updateDB2Unassigned(columnIndex); - } - - - //@EIA 550 extended indicator defaults - /** - Updates a column in the current row to the SQL Unassigned. - @param columnName The column name. - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void updateDB2Unassigned(String columnName) throws SQLException - { - updateDB2Unassigned (findColumn (columnName)); - } - - - //@EIA 550 extended indicator defaults - /** - Updates a column in the current row to the SQL Unassigned. Same as updateDB2Unassigned. - @param columnName The column name. - @exception SQLException If the statement is not open, - the index is not valid, the parameter - is not an input parameter. - **/ - public void updateDBUnassigned(String columnName) throws SQLException - { - updateDB2Unassigned (findColumn (columnName)); - } - - - // JDBC 2.0 - /** - Updates a column in the current row using an Object value. - The driver converts this to a value of an SQL type, depending on - the type of the specified value. The JDBC specification defines - a standard mapping from Java types to SQL types. In the cases - where an SQL type is not supported by DB2 for IBM i, the - next closest matching type - is used. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public void updateObject (int columnIndex, Object columnValue) - throws SQLException - { - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - - updateValue (columnIndex, columnValue, null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using an Object value. - The driver converts this to a value of an SQL type, depending on - the type of the specified value. The JDBC specification defines - a standard mapping from Java types to SQL types. In the cases - where an SQL type is not supported by DB2 for IBM i, the - next closest matching type - is used. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateObject("\"MixedCase\"", columnValue). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, - or the requested conversion is not valid. - **/ - public void updateObject (String columnName, Object columnValue) - throws SQLException - { - updateObject (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using an Object value. - The driver converts this to a value of an SQL type, depending on - the type of the specified value. The JDBC specification defines - a standard mapping from Java types to SQL types. In the cases - where an SQL type is not supported by DB2 for IBM i, the - next closest matching type - is used. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - @param scale The number of digits after the decimal - if SQL type is DECIMAL or NUMERIC. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - the scale is not valid, or the - requested conversion is not valid. - **/ - public void updateObject (int columnIndex, - Object columnValue, - int scale) - throws SQLException - { - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - - if(scale < 0) - JDError.throwSQLException (JDError.EXC_SCALE_INVALID); - -/* ifdef JDBC40 - if (columnValue instanceof SQLXML) //@xmlspec - updateSQLXML(columnIndex, (SQLXML)columnValue); //@xmlspec - else -endif */ - updateValue (columnIndex, columnValue, null, scale); //@P0C - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using an Object value. - The driver converts this to a value of an SQL type, depending on - the type of the specified value. The JDBC specification defines - a standard mapping from Java types to SQL types. In the cases - where an SQL type is not supported by DB2 for IBM i, the - next closest matching type - is used. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateObject("\"MixedCase\"", columnValue, scale). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - @param scale The number of digits after the decimal - if SQL type is DECIMAL or NUMERIC. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, - the scale is not valid, or the - requested conversion is not valid. - @since Modification 5 - **/ - public void updateObject (String columnName, - Object columnValue, - int scale) - throws SQLException - { - updateObject (findColumn (columnName), columnValue, scale); - } - - - - //@G4A JDBC 3.0 - /** - Updates the value of an SQL REF output parameter as a Ref value. - DB2 for IBM i does not support structured types. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support REFs. - @since Modification 5 - **/ - public void updateRef (int columnIndex, Ref columnValue) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - } - - - - //@G4A JDBC 3.0 - /** - Updates the value of an SQL REF output parameter as a Ref value. - DB2 for IBM i does not support structured types. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateRef("\"MixedCase\"", columnValue). - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support REFs. - **/ - public void updateRef (String columnName, Ref columnValue) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - } - - - - // JDBC 2.0 - /** - Updates the database with the new contents of the current - row. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the cursor is positioned on the insert row, - or an error occurs. - **/ - // - // Implementation note: - // - // * It seems inefficient to prepare and execute a - // new statement each time, but we really have no choice, - // since (1.) The combination of columns that we want - // to update could change every time and (2.) We need - // to use parameter markers to be able to set columns - // not representable using SQL literals. - // - public void updateRow () - throws SQLException - { - beforeUpdate (); - DBExtendedColumnDescriptors extendedDescriptors = null; //@K1A - ConvTable convTable = null; //@K1A - - if((positionInsert_ == true) || (positionValid_ == false)) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - - // Build up the SQL statement. - StringBuffer buffer = new StringBuffer (); - buffer.append ("UPDATE "); - buffer.append (selectTable_); - if(correlationName_ != null) - { - buffer.append (" AS "); - buffer.append (correlationName_); - } - buffer.append (" SET "); - int columnsSet = 0; - for(int i = 0; i < columnCount_; ++i) - { - if(updateSet_[i] == true) - { - if(columnsSet++ > 0) - buffer.append (","); - buffer.append ("\""); // @D6a - // @K1A If we have column descriptors, use them to get the column label. //@K1A - if(statement_ != null) //@K1A - { - // @K1A - extendedDescriptors = statement_.getExtendedColumnDescriptors(); // @K1A - // If we have extendedDescriptors, send a ConvTable to convert them, else pass null // @K1A - if(extendedDescriptors != null) // @K1A - { - // @K1A - convTable = ((AS400JDBCConnection)connection_).converter_; // @K1A - String columnName = extendedDescriptors.getColumnDescriptors(i+1, convTable).getBaseColumnName(convTable); //@K1A //@K2A changed from getColumnLabel //@SS1 - if(columnName != null) { - if (((AS400JDBCConnection)connection_).getVRM() < JDUtilities.vrm540) { //@DELIMa - buffer.append(JDUtilities.stripOuterDoubleQuotes(columnName)); // if pre-V5R4, just strip outer quotes (no double-up necessary) - } - else { - buffer.append(prepareQuotes(columnName)); // if V5R4+, also need to double-up any embedded quotes @DELIMc - } - } - else { // Column name is null, so get it from the row. - // We're using extended descriptors, - // so we'll need to double-up embedded quotes. - buffer.append(prepareQuotes(row_.getFieldName(i+1))); //@DELIMa - } - } // @K1A - else // @K1A - buffer.append (prepareQuotes(row_.getFieldName (i+1))); // @K1A @DELIMc - // @K1A - } - else - buffer.append(prepareQuotes(row_.getFieldName(i+1))); - buffer.append ("\"=?"); // @D6c @DELIMc - } - } - buffer.append (" WHERE CURRENT OF \""); // @D3C - buffer.append (cursorName_); - buffer.append ("\""); // @D3C - - // Only go through with this if columns were set. - if(columnsSet > 0) - { - - if(JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "Updating a row: " + buffer); - - // Prepare the statement and set the parameters. - PreparedStatement updateStatement = connection_.prepareStatement (buffer.toString ()); - try{ - for(int i = 0, columnsSet2 = 0; i < columnCount_; ++i) - { - if(updateSet_[i] == true) - { - Object columnValue = updateRow_.getSQLData (i+1).getObject (); - if(updateNulls_[i] == true) - updateStatement.setNull (++columnsSet2, row_.getSQLType (i+1).getType ()); - else if(updateDefaults_[i]) //@EIA - ((AS400JDBCPreparedStatement)updateStatement).setDB2Default(++columnsSet2); //@EIA - else if(updateUnassigned_[i]) //@EIA - ((AS400JDBCPreparedStatement)updateStatement).setDB2Unassigned(++columnsSet2); //@EIA - else - updateStatement.setObject (++columnsSet2, columnValue); - } - } - - // Execute and close the statement. Dispatch the warnings, - // if any. - updateStatement.executeUpdate (); - SQLWarning warnings = updateStatement.getWarnings (); - if(warnings != null) - postWarning (warnings); // The whole link gets added. - } - finally{ - //Always close the statement - Fix for JTOpen Bug 4148 - updateStatement.close (); - } - - rowCache_.flush (); - } - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java short value. - The driver converts this to an SQL SMALLINT value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateShort (int columnIndex, short columnValue) - throws SQLException - { - updateValue (columnIndex, new Short (columnValue), null, -1); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a Java short value. - The driver converts this to an SQL SMALLINT value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateShort("\"MixedCase\"", columnValue). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateShort (String columnName, short columnValue) - throws SQLException - { - updateShort (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a String value. - The driver converts this to an SQL VARCHAR value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, - or the requested conversion is not valid. - **/ - public void updateString (int columnIndex, String columnValue) - throws SQLException - { - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - - //if(columnIndex <= columnCount_ && columnIndex > 0) //@pdc - // columnValue = AS400BidiTransform.convertDataToHostCCSID(columnValue, (AS400JDBCConnection) connection_, ((JDServerRow) row_).getCCSID(columnIndex)); //Bidi-HCG - - updateValue (columnIndex, columnValue, null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a String value. - The driver converts this to an SQL VARCHAR value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateString("\"MixedCase\"", columnValue). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateString (String columnName, String columnValue) - throws SQLException - { - updateString (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a java.sql.Time value. - The driver converts this to an SQL TIME value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateTime (int columnIndex, Time columnValue) - throws SQLException - { - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - - updateValue (columnIndex, columnValue, null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a java.sql.Time value. - The driver converts this to an SQL TIME value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateTime("\"MixedCase\"", columnValue). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateTime (String columnName, Time columnValue) - throws SQLException - { - updateTime (findColumn (columnName), columnValue); - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a java.sql.Timestamp value. - The driver converts this to an SQL TIMESTAMP value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateTimestamp (int columnIndex, Timestamp columnValue) - throws SQLException - { - // @B1D if (columnValue == null) - // @B1D JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - - updateValue (columnIndex, columnValue, null, -1); //@P0C - } - - - - // JDBC 2.0 - /** - Updates a column in the current row using a java.sql.Timestamp value. - The driver converts this to an SQL TIMESTAMP value. - To perform a case-sensitive search use a quoted String - for columnName as in: ResultSet.updateTimestamp("\"MixedCase\"", columnValue). - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column name is not found, or the - requested conversion is not valid. - **/ - public void updateTimestamp (String columnName, Timestamp columnValue) - throws SQLException - { - updateTimestamp (findColumn (columnName), columnValue); - } - - - - /** - Updates a column for the specified index, and performs all - appropriate validation. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null if the value - is SQL NULL. - @param calendar The calendar, or null if not - applicable. - @param scale The scale, or -1 if not applicable. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - private void updateValue (int columnIndex, - Object columnValue, - Calendar calendar, - int scale) - throws SQLException - { - synchronized(internalLock_) - { // @D1A - beforeUpdate (); - - // Check that there is a current row. - if((positionValid_ == false) && (positionInsert_ == false)) - JDError.throwSQLException (JDError.EXC_CURSOR_POSITION_INVALID); - - // Validate The column index. - if((columnIndex < 1) || (columnIndex > columnCount_)) - JDError.throwSQLException (JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Set the update value. If there is a type mismatch, - // set() with throw an exception. - SQLData sqlData = updateRow_.getSQLType(columnIndex); //@P0C - int columnIndex0 = columnIndex - 1; - - //@G7A If the data is a locator, then set its handle. - int sqlType = sqlData.getSQLType(); //@xml3 - if(columnValue != null && (sqlType == SQLData.CLOB_LOCATOR || - sqlType == SQLData.BLOB_LOCATOR || - sqlType == SQLData.DBCLOB_LOCATOR || - sqlType == SQLData.NCLOB_LOCATOR || //@pda jdbc40 - sqlType == SQLData.XML_LOCATOR)) //@xml3 - { //@G8C //@G7A - statement_.setAssociatedWithLocators(true); //@KBL - try - { //@G7A - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; //@G7A - sqlDataAsLocator.setHandle (((AS400JDBCBlobLocator)columnValue).getHandle()); //@G7A - } //@G7A - catch(ClassCastException cce) //@G7A - { - /*ignore*/ //@G7A - } //@G7A - - try - { //@G7A - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; //@G7A - sqlDataAsLocator.setHandle (((AS400JDBCClobLocator)columnValue).getHandle()); //@G7A - } //@G7A - catch(ClassCastException cce) //@G7A - { - /*ignore*/ - } //@G7A -/* ifdef JDBC40 - try //@PDA jdbc40 - following upon existing design - { //@PDA jdbc40 - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; //@PDA jdbc40 - sqlDataAsLocator.setHandle (((AS400JDBCNClobLocator)columnValue).getHandle()); //@PDA jdbc40 - } //@PDA jdbc40 - catch(ClassCastException cce) //@PDA jdbc40 - { - // ignore - } - try //@olddesc - { //@olddesc - SQLLocator sqlDataAsLocator = (SQLLocator) sqlData; //@olddesc - sqlDataAsLocator.setHandle (((AS400JDBCSQLXMLLocator)columnValue).getHandle()); //@olddesc - } //@olddesc - catch(ClassCastException cce) //@olddesc - { - // ignore - } - endif */ - } - - if(columnValue != null) - sqlData.set (columnValue, calendar, scale); - updateNulls_[columnIndex0] = (columnValue == null); - updateDefaults_[columnIndex0] = false; //@EIA - updateUnassigned_[columnIndex0] = false; //@EIA - updateSet_[columnIndex0] = true; - - if(dataTruncation_) // @B2A - testDataTruncation2 (columnIndex, sqlData); // @B2C - } - } - - - - - //@PDA jdbc40 - /** - * Retrieves the holdability of this ResultSet object - * @return either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT - * The holdability is derived in this order of precedence: -

          -
        • 1. The holdability, if any, that was specified on statement creation using - the methods createStatement(), prepareCall(), or prepareStatement() on the - Connection object. -
        • 2. The holdability specified using the method setHoldability(int) - if this method was called on the Connection object. -
        • 3. If neither of above methods were called, the value of the - cursor hold - driver property.
        - Full functionality of #1 and #2 requires OS/400 v5r2 - or IBM i. If connecting to OS/400 V5R1 or earlier, - the value specified on these two methods will be ignored and the default holdability - will be the value of #3. - * @throws SQLException if a database error occurs - */ - public int getHoldability() throws SQLException - { - synchronized(internalLock_) - { - checkOpen (); - - //@cur return value from cursor attribues if exists else return value as done in pre 550 - if( statement_ != null ) //@cur - { //@cur - int vrm = 0; //@cur3 - if(connection_ != null) //@cur3 - vrm = ((AS400JDBCConnection)connection_).getVRM(); //@cur3 - if(statement_.cursor_.getCursorAttributeHoldable() == 0 - && (vrm <= JDUtilities.vrm610 - || (vrm >= JDUtilities.vrm710 && statement_.cursor_.getCursorIsolationLevel() != 0))) //@cur //@cur3 *none is always hold - return ResultSet.CLOSE_CURSORS_AT_COMMIT; //@cur - else if(statement_.cursor_.getCursorAttributeHoldable() == 1 - || (vrm >= JDUtilities.vrm710 && statement_.cursor_.getCursorIsolationLevel() == 0)) //@cur //@cur3 - return ResultSet.HOLD_CURSORS_OVER_COMMIT; //@cur - else //@cur - { //@cur - //not able to get from cursor attrs from hostserver - if((statement_.resultSetHoldability_ == AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT) || - (statement_.resultSetHoldability_ == AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT)) - { - return statement_.resultSetHoldability_; - } - } - } //@cur - - //if above cannot determine holdability, then do best guess - if(connection_ instanceof AS400JDBCConnection && connection_ != null) //@cur - return ((AS400JDBCConnection) connection_).getHoldability(); //@cur CAST needed for JDK 1.3 - else //@cur - return ResultSet.CLOSE_CURSORS_AT_COMMIT; //@cur (if no statment exists for this, then safest is to return close at commit to prevent cursor reuse errors) - } - } - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @param columnIndex - * @exception SQLException if a database access error occurs - */ - public Reader getNCharacterStream(int columnIndex) throws SQLException - { - synchronized(internalLock_) - { - SQLData data = getValue (columnIndex); - Reader value = (data == null) ? null : data.getNCharacterStream (); - openReader_ = value; - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnName the name of the column - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language - * @exception SQLException if a database access error occurs - */ - public Reader getNCharacterStream(String columnName) throws SQLException - { - return getNCharacterStream (findColumn (columnName)); - } - - - //@pda jdbc40 - //JDBC40DOC /** - //JDBC40DOC * Retrieves the value of the designated column in the current row - //JDBC40DOC * of this ResultSet object as a NClob object - //JDBC40DOC * in the Java programming language. - //JDBC40DOC * - //JDBC40DOC * @param columnIndex - //JDBC40DOC * @return a NClob object representing the SQL - //JDBC40DOC * NCLOB value in the specified column - //JDBC40DOC * @exception SQLException if the driver does not support national - //JDBC40DOC * character sets; if the driver can detect that a data conversion - //JDBC40DOC * error could occur; or if a database access error occurss - //JDBC40DOC */ - /* ifdef JDBC40 - public NClob getNClob(int columnIndex) throws SQLException - { - synchronized(internalLock_) - { - SQLData data = getValue (columnIndex); - NClob value = (data == null) ? null : data.getNClob (); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - endif */ - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Retrieves the value of the designated column in the current row - // JDBC40DOC * of this ResultSet object as a NClob object - // JDBC40DOC * in the Java programming language. - // JDBC40DOC * - // JDBC40DOC * @param columnName the name of the column from which to retrieve the value - // JDBC40DOC * @return a NClob object representing the SQL NCLOB - // JDBC40DOC * value in the specified column - // JDBC40DOC * @exception SQLException if the driver does not support national - // JDBC40DOC * character sets; if the driver can detect that a data conversion - // JDBC40DOC * error could occur; or if a database access error occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public NClob getNClob(String columnName) throws SQLException - { - return getNClob (findColumn (columnName)); - } - endif */ - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnIndex - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - */ - public String getNString(int columnIndex) throws SQLException - { - synchronized(internalLock_) - { - SQLData data = getValue (columnIndex); - String value = (data == null) ? null : data.getNString (); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnName the SQL name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - */ - public String getNString(String columnName) throws SQLException - { - return getNString (findColumn (columnName)); - } - - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Retrieves the value of the designated column in the current row of this - // JDBC40DOC * ResultSet object as a java.sql.RowId object in the Java - // JDBC40DOC * programming language. - // JDBC40DOC * - // JDBC40DOC * @param columnIndex the column number - // JDBC40DOC * @return the column value ; if the value is a SQL NULL the - // JDBC40DOC * value returned is null - // JDBC40DOC * @throws SQLException if a database access error occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public RowId getRowId(int columnIndex) throws SQLException - { - synchronized(internalLock_) - { - SQLData data = getValue (columnIndex); - RowId value = (data == null) ? null : data.getRowId(); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - endif */ - - - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Retrieves the value of the designated column in the current row of this - // JDBC40DOC * ResultSet object as a java.sql.RowId object in the Java - // JDBC40DOC * programming language. - // JDBC40DOC * - // JDBC40DOC * @param columnName the name of the column - // JDBC40DOC * @return the column value ; if the value is a SQL NULL the - // JDBC40DOC * value returned is null - // JDBC40DOC * @throws SQLException if a database access error occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public RowId getRowId(String columnName) throws SQLException - { - return getRowId(findColumn (columnName)); - } - endif */ - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Retrieves the value of the designated column in the current row of - // JDBC40DOC * this ResultSet as a - // JDBC40DOC * java.sql.SQLXML object in the Java programming language. - // JDBC40DOC * @param columnIndex - // JDBC40DOC * @return a SQLXML object that maps an SQL XML value - // JDBC40DOC * @throws SQLException if a database access error occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public SQLXML getSQLXML(int columnIndex) throws SQLException - { - synchronized(internalLock_) - { - SQLData data = getValue (columnIndex); - SQLXML value = (data == null) ? null : data.getSQLXML(); - testDataTruncation (columnIndex, data, false); //@trunc //@trunc2 - return value; - } - } - endif */ - - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Retrieves the value of the designated column in the current row of - // JDBC40DOC * this ResultSet as a - // JDBC40DOC * java.sql.SQLXML object in the Java programming language. - // JDBC40DOC * @param columnName the name of the column from which to retrieve the value - // JDBC40DOC * @return a SQLXML object that maps an SQL XML value - // JDBC40DOC * @throws SQLException if a database access error occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public SQLXML getSQLXML(String columnName) throws SQLException - { - return getSQLXML(findColumn (columnName)); - } - endif */ - - - - - //@PDA jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Updates the designated column with a java.sql.NClob value. - // JDBC40DOC * The updater methods are used to update column values in the - // JDBC40DOC * current row or the insert row. The updater methods do not - // JDBC40DOC * update the underlying database; instead the updateRow or - // JDBC40DOC * insertRow methods are called to update the database. - // JDBC40DOC * - // JDBC40DOC * @param columnIndex - // JDBC40DOC * @param nClob the value for the column to be updated - // JDBC40DOC * @throws SQLException if the driver does not support national - // JDBC40DOC * character sets; if the driver can detect that a data conversion - // JDBC40DOC * error could occur; or if a database access error occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public void updateNClob(int columnIndex, NClob nClob) throws SQLException - { - updateValue (columnIndex, nClob, null, -1); - } - endif */ - - //@PDA jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Updates the designated column with a java.sql.NClob value. - // JDBC40DOC * The updater methods are used to update column values in the - // JDBC40DOC * current row or the insert row. The updater methods do not - // JDBC40DOC * update the underlying database; instead the updateRow or - // JDBC40DOC * insertRow methods are called to update the database. - // JDBC40DOC * - // JDBC40DOC * @param columnName name of the column - // JDBC40DOC * @param nClob the value for the column to be updated - // JDBC40DOC * @throws SQLException if the driver does not support national - // JDBC40DOC * character sets; if the driver can detect that a data conversion - // JDBC40DOC * error could occur; or if a database access error occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public void updateNClob(String columnName, NClob nClob) throws SQLException - { - updateNClob (findColumn (columnName), nClob); - - } - endif */ - - - //@pda jdbc40 - /** - * Updates the designated column with a String value. - * It is intended for use when updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex - * @param nString the value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - */ - public void updateNString(int columnIndex, String nString) throws SQLException - { - updateValue (columnIndex, nString, null, -1); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a String value. - * It is intended for use when updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnName name of the Column - * @param nString the value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - */ - public void updateNString(String columnName, String nString) throws SQLException - { - updateNString (findColumn (columnName), nString); - } - - //@PDA jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Updates the designated column with a RowId value. The updater - // JDBC40DOC * methods are used to update column values in the current row or the insert - // JDBC40DOC * row. The updater methods do not update the underlying database; instead - // JDBC40DOC * the updateRow or insertRow methods are called - // JDBC40DOC * to update the database. - // JDBC40DOC * - // JDBC40DOC * @param columnIndex - // JDBC40DOC * @param x the column value - // JDBC40DOC * @throws SQLException if a database access occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public void updateRowId(int columnIndex, RowId x) throws SQLException - { - updateValue (columnIndex, x, null, -1); - } - endif */ - - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Updates the designated column with a RowId value. The updater - // JDBC40DOC * methods are used to update column values in the current row or the insert - // JDBC40DOC * row. The updater methods do not update the underlying database; instead - // JDBC40DOC * the updateRow or insertRow methods are called - // JDBC40DOC * to update the database. - // JDBC40DOC * - // JDBC40DOC * @param columnName the name of the column - // JDBC40DOC * @param x the column value - // JDBC40DOC * @throws SQLException if a database access occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public void updateRowId(String columnName, RowId x) throws SQLException - { - updateRowId (findColumn (columnName), x); - } - endif */ - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Updates the designated column with a java.sql.SQLXML value. - // JDBC40DOC * The updater - // JDBC40DOC * methods are used to update column values in the current row or the insert - // JDBC40DOC * row. The updater methods do not update the underlying database; instead - // JDBC40DOC * the updateRow or insertRow methods are called - // JDBC40DOC * to update the database. - // JDBC40DOC * @param columnIndex - // JDBC40DOC * @param xmlObject the value for the column to be updated - // JDBC40DOC * @throws SQLException if a database access error occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException - { - //@xmlspec special handling of blob/clob column types - if(xmlObject == null) //@xmlspec3 - { //@xmlspec3 - updateValue (columnIndex, xmlObject, null, -1); //@xmlspec3 - return; //@xmlspec3 - } //@xmlspec3 - - int sqlDataType; - if(updateRow_ != null) //@nulltype - sqlDataType = updateRow_.getSQLData (columnIndex).getType(); //@xmlspec //@nulltype - else - sqlDataType = Types.SQLXML; //@nulltype dummy type so processing continues - - - switch(sqlDataType) { //@xmlspec - case Types.CLOB: //@xmlspec - updateCharacterStream(columnIndex, xmlObject.getCharacterStream());//@xmlspec - break; //@xmlspec - case Types.BLOB: //@xmlspec - updateBinaryStream(columnIndex, xmlObject.getBinaryStream()); //@xmlspec - break; //@xmlspec - default: //@xmlspec - updateValue (columnIndex, xmlObject, null, -1); - } - } - endif */ - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Updates the designated column with a java.sql.SQLXML value. - // JDBC40DOC * The updater - // JDBC40DOC * methods are used to update column values in the current row or the insert - // JDBC40DOC * row. The updater methods do not update the underlying database; instead - // JDBC40DOC * the updateRow or insertRow methods are called - // JDBC40DOC * to update the database. - // JDBC40DOC * - // JDBC40DOC * @param columnName the name of the column - // JDBC40DOC * @param xmlObject the column value - // JDBC40DOC * @throws SQLException if a database access occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public void updateSQLXML(String columnName, SQLXML xmlObject) throws SQLException - { - updateSQLXML(findColumn(columnName), xmlObject); - } - endif */ - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCResultSet", "java.sql.ResultSet" }; - } - - //@PDA jdbc40 - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - - updateValue (columnIndex, - (x == null) ? null : JDUtilities.streamToString (x, (int)length, "ISO8859_1"), null, -1); - } - - - //@PDA jdbc40 - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the column name - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException - { - updateAsciiStream (findColumn (columnLabel), x, length); - } - - - //@PDA jdbc40 - /** - * Updates the designated column with a binary stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - - updateValue (columnIndex, - (x == null) ? null : JDUtilities.streamToBytes (x, (int)length), null, -1); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a binary stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException - { - updateBinaryStream (findColumn (columnLabel), x, length); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given input stream, which - * will have the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - - updateValue (columnIndex, - (inputStream == null) ? null : JDUtilities.streamToBytes (inputStream, (int)length), null, -1); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given input stream, which - * will have the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException - { - updateBlob (findColumn (columnLabel), inputStream, length); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - - updateValue (columnIndex, - (x == null) ? null : JDUtilities.readerToString (x, (int)length), null, -1); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException - { - updateCharacterStream (findColumn (columnLabel), reader, length); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateClob(int columnIndex, Reader reader, long length) throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - - updateValue (columnIndex, - (reader == null) ? null : JDUtilities.readerToString (reader, (int)length), null, -1); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateClob(String columnLabel, Reader reader, long length) throws SQLException - { - updateClob (findColumn (columnLabel), reader, length); - } - - - //@PDA jdbc40 - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - - updateValue (columnIndex, - (x == null) ? null : JDUtilities.readerToString (x, (int)length), null, -1); - } - - - //@PDA jdbc40 - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException - { - updateNCharacterStream (findColumn (columnLabel), reader, length); - } - - - //@PDA jdbc40 - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException - { - if(length < 0) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - - updateValue (columnIndex, - (reader == null) ? null : JDUtilities.readerToString (reader, (int)length), null, -1); - } - - - //@PDA jdbc40 - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException - { - updateNClob (findColumn (columnLabel), reader, length); - } - - - //@pda jdbc40 - /** - * Updates the designated column with an ascii stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateAsciiStream which takes a length parameter. - * - * @param columnIndex - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException - { - updateValue (columnIndex, - (x == null) ? null : JDUtilities.streamToBytes (x), null, -1); - } - - - //@pda jdbc40 - /** - * Updates the designated column with an ascii stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateAsciiStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if the columnLabel is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException - { - updateAsciiStream (findColumn (columnLabel), x); - } - - - //@pda jdbc40 - /** - * Updates the designated column with a binary stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBinaryStream which takes a length parameter. - * - * @param columnIndex - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException - { - updateValue (columnIndex, - (x == null) ? null : JDUtilities.streamToBytes (x), null, -1); - } - - - //@pda jdbc40 - /** - * Updates the designated column with a binary stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBinaryStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if the columnLabel is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException - { - updateBinaryStream (findColumn (columnLabel), x); - } - - - //@pda jdbc40 - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBlob which takes a length parameter. - * - * @param columnIndex - * @param inputStream An object that contains the data to set the parameter - * value to. - * @exception SQLException if the columnIndex is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException - { - updateValue (columnIndex, - (inputStream == null) ? null : JDUtilities.streamToBytes (inputStream), null, -1); - } - - - //@pda jdbc40 - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBlob which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param inputStream An object that contains the data to set the parameter - * value to. - * @exception SQLException if the columnLabel is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException - { - updateBlob (findColumn (columnLabel), inputStream); - } - - - //@pda jdbc40 - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateCharacterStream which takes a length parameter. - * - * @param columnIndex - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateCharacterStream(int columnIndex, Reader x) throws SQLException - { - updateValue (columnIndex, - (x == null) ? null : JDUtilities.readerToString(x), null, -1); - } - - - //@pda jdbc40 - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateCharacterStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @exception SQLException if the columnLabel is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException - { - updateCharacterStream (findColumn (columnLabel), reader); - } - - - //@pda jdbc40 - /** - * Updates the designated column using the given Reader - * object. - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateClob which takes a length parameter. - * - * @param columnIndex - * @param reader An object that contains the data to set the parameter value to. - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateClob(int columnIndex, Reader reader) throws SQLException - { - updateValue (columnIndex, - (reader == null) ? null : JDUtilities.readerToString(reader), null, -1); - } - - - //@pda jdbc40 - /** - * Updates the designated column using the given Reader - * object. - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateClob which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @exception SQLException if the columnLabel is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateClob(String columnLabel, Reader reader) throws SQLException - { - updateClob (findColumn (columnLabel), reader); - } - - - //@pda jdbc40 - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNCharacterStream which takes a length parameter. - * - * @param columnIndex - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException - { - updateValue (columnIndex, - (x == null) ? null : JDUtilities.readerToString(x), null, -1); - } - - - //@pda jdbc40 - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNCharacterStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @exception SQLException if the columnLabel is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException - { - updateNCharacterStream(findColumn (columnLabel), reader); - } - - - - //@pda jdbc40 - /** - * Updates the designated column using the given Reader - * - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNClob which takes a length parameter. - * - * @param columnIndex - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if the columnIndex is not valid; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob(int columnIndex, Reader reader) throws SQLException - { - updateValue (columnIndex, - (reader == null) ? null : JDUtilities.readerToString(reader), null, -1); - } - - - //@pda jdbc40 - /** - * Updates the designated column using the given Reader - * object. - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNClob which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if the columnLabel is not valid; if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set; - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob(String columnLabel, Reader reader) throws SQLException - { - updateNClob (findColumn (columnLabel), reader); - } - - - - - //@EIA new method - /** - Updates a column for the specified index, and performs all - appropriate validation. - - Note: this is the same type of method as updateValue() above, but we - have no way to pass in the special values without hacking some sort - of flag string for the value, and that seemed to be a messy and slow - way to do this. - - @param columnIndex The column index (1-based). - @param columnValue The parameter 1="default" or 2="unassigned". - - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - private void updateValueExtendedIndicator (int columnIndex, int columnValue) - throws SQLException - { - synchronized(internalLock_) - { - beforeUpdate (); - - // Check that there is a current row. - if((positionValid_ == false) && (positionInsert_ == false)) - JDError.throwSQLException (JDError.EXC_CURSOR_POSITION_INVALID); - - // Validate The column index. - if((columnIndex < 1) || (columnIndex > columnCount_)) - JDError.throwSQLException (JDError.EXC_DESCRIPTOR_INDEX_INVALID); - - // Set the update value. If there is a type mismatch, - // set() with throw an exception. - - int columnIndex0 = columnIndex - 1; - - updateNulls_[columnIndex0] = false; - updateDefaults_[columnIndex0] = columnValue == 1 ? true: false; - updateUnassigned_[columnIndex0] = columnValue == 2 ? true: false; - updateSet_[columnIndex0] = true; - - - } - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCResultSetMetaData.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCResultSetMetaData.java deleted file mode 100644 index 5c391bec8..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCResultSetMetaData.java +++ /dev/null @@ -1,603 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCResultSetMetaData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.Connection; -/* ifdef JDBC40 -import java.sql.DatabaseMetaData; -endif */ -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.Statement; -endif */ - - -/** -

        The AS400JDBCResultSetMetaData class describes the -columns in a result set. -**/ -// -// Implementation notes: -// -// * I lifted the restriction that a result set be open when -// using this object, specifically so it could be used after -// preparing but before executing (via PreparedStatement.getMetaData()). -// -// * I also removed the reference to the result set as private -// data. This is again because of the need to create this object -// before executing a query (via PreparedStatement.getMetaData()). -// -public class AS400JDBCResultSetMetaData -/* ifdef JDBC40 -extends ToolboxWrapper -endif */ -implements ResultSetMetaData -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - // Private static final ints - // Searchable constants - //@G1A @G2C - static final int SQL_UNSEARCHABLE = 0xF0; // isSearchable = false - static final int SQL_LIKE_ONLY = 0xF1; // will not be returned by our IBM i system - static final int SQL_ALL_EXCEPT_LIKE = 0xF2; // isSearchable = true - static final int SQL_SEARCHABLE = 0xF3; // isSearchable = true - - // Updateable constants - //@G1A @G2C - static final int SQL_READ_ONLY = 0xF0; // isReadOnly = true, isWriteable = false - static final int SQL_WRITE_CAPABLE = 0xF1; // isReadOnly = false, isWriteable = true - static final int SQL_READ_WRITE_UNKNOWN = 0xF2; // will not be returned by our IBM i system - - // Private data. - private String catalog_; - private int concurrency_; - private String cursorName_; - private JDRow row_; - private DBExtendedColumnDescriptors extendedColumnDescriptors_; //@G1A - private ConvTable convTable_; //@G1A - private Connection con_; //@in1 - - /** - Constructs an AS400JDBCResultSetMetaData object. - @param catalog The catalog. - @param concurrency The result set concurrency. - @param cursorName The cursor name. - @param row The row. - @param extendedColumnDescriptors The extended column descriptors. - @param convTable The converter table to use to convert column descriptors. - **/ - AS400JDBCResultSetMetaData(String catalog, - int concurrency, - String cursorName, - JDRow row, - DBExtendedColumnDescriptors extendedColumnDescriptors, //@G1A - ConvTable convTable, //@G1A - Connection con) //@in1 - { - catalog_ = catalog; - concurrency_ = concurrency; - cursorName_ = cursorName; - row_ = row; - extendedColumnDescriptors_ = extendedColumnDescriptors; //@G1A - convTable_ = convTable; //@G1A - con_ = con; //@in1 - } - - /** - Throws an exception if the specified column index is not - valid. - @param columnIndex The column index (1-based). - @exception SQLException If the column index is not valid. - **/ - private void checkIndex(int columnIndex) - throws SQLException - { - // Validate the column index. - if((columnIndex < 1) || (columnIndex > row_.getFieldCount())) - JDError.throwSQLException(this, JDError.EXC_DESCRIPTOR_INDEX_INVALID); - } - - /** - Returns the catalog name of the table for a column. - @param columnIndex The column index (1-based). - @return The catalog name. - @exception SQLException If the column index is not valid. - **/ - public String getCatalogName(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return catalog_; - } - - // JDBC 2.0 - /** - Returns the name of a Java class whose instances are - created if ResultSet.getObject() is called to retrieve - from the column. The actual class created may be a subclass - of the returned class. - @param columnIndex The column index (1-based). - @return The class name. - @exception SQLException If the column index is not valid. - **/ - // - // Implementation note: - // - // * In the case where the column returns a byte array, this - // returns "[B". See the javadoc for java.lang.Class.getName() - // for the reason why. The JDBC 2.0 specification does not - // really go into detail, so it is unclear if this is okay - // to return. I will assume so in the mean time. - // - public String getColumnClassName(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - SQLData sqlData = row_.getSQLType(columnIndex); - String className = sqlData.getObject().getClass().getName(); - return className; - } - - /** - Returns the number of columns in the result set. - @return The number of columns. - @exception SQLException If an error occurs. - **/ - public int getColumnCount() - throws SQLException - { - return row_.getFieldCount(); - } - - /** - Returns the normal maximum width of a column. - @param columnIndex The column index (1-based). - @return The normal maximum width - (in characters). - @exception SQLException If the column index is not valid. - **/ - public int getColumnDisplaySize(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return row_.getSQLType(columnIndex).getDisplaySize(); - } - - /** - Returns the suggested label for use in printouts - or displays for a column. - @param columnIndex The column index (1-based). - @return The column label if the user set the - driver property "extended metadata" to true and - the system returns us a column label, - otherwise the column name. - @exception SQLException If the column index is not valid. - **/ - // - // Implementation note: - // - // For now, this is the same as the field name. In - // order to get the field label, we would have to make - // an extra request to the ROI server and perform a lot - // of extra processing. This performance hit is not - // worth it. If the caller really needs the label, then - // they can use DatabaseMetaData.getColumns. - // - // As of mod5 of Toolbox, we can use extended column descriptors - // (if the user asked for the by setting the "extended metadata" property - // to true) which will flow back to us without an extra call to the ROI server. - // - public String getColumnLabel(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - // @G1A If we have column descriptors, use them to get the column label. //@G1A - if(extendedColumnDescriptors_ != null) //@G1A - { - //@G1A - DBColumnDescriptorsDataFormat dataFormat = extendedColumnDescriptors_.getColumnDescriptors(columnIndex, convTable_); //@KBA // Fix for JTOpen Bug 4034 The ccsid for the column may be 65535, if that is the case, we want to use the job's ccsid - if(dataFormat != null) //@KBA The data format returned by the host server will be null for columns created by expressions, use old way - { //@D9A - String columnLabel = dataFormat.getColumnLabel(convTable_); //@D9A - if(columnLabel != null) //@D9A - return columnLabel; //@D9A - //@D9D return dataFormat.getColumnLabel(convTable_); //@KBA - //@KBD return extendedColumnDescriptors_.getColumnDescriptors(columnIndex).getColumnLabel(convTable_); //@G1A - } - } //@G1A - - //else use the "old way". - return row_.getFieldName(columnIndex); - } - - /** - Returns the name of a column. - @param columnIndex The column index (1-based). - @return The column name. - @exception SQLException If the column index is not valid. - **/ - public String getColumnName(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return row_.getFieldName(columnIndex); - } - - /** - Returns the type of a column. If the type is a distinct type, - this returns the underlying type. - @param columnIndex The column index (1-based). - @return The SQL type code defined in java.sql.Types. - @exception SQLException If the column index is not valid. - **/ - public int getColumnType(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return row_.getSQLType(columnIndex).getType(); - } - - /** - Returns the type name of a column. If the type is a distinct - type, this returns the underlying type name. - @param columnIndex The column index (1-based). - @return The column type name. - @exception SQLException If the column index is not valid. - **/ - public String getColumnTypeName(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return row_.getSQLType(columnIndex).getTypeName(); - } - - /** - Returns the precision of a column. This is the number - of decimal digits the column may hold. - @param columnIndex The column index (1-based). - @return The precision. - @exception SQLException If the column index is not valid. - **/ - public int getPrecision(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return row_.getSQLType(columnIndex).getPrecision(); - } - - /** - Returns the scale of a column. This is number of digits - to the right of the decimal point. - @param columnIndex The column index (1-based). - @return The scale. - @exception SQLException If the column index is not valid. - **/ - public int getScale(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return row_.getSQLType(columnIndex).getScale(); - } - - /** - Returns the schema name of the table for a column. - This method is supported only if the user has set the - driver property "extended metadata" to true. - @param columnIndex The column index (1-based). - @return The schema name if the user set the - driver property "extended metadata" to true and - the system returns us a schema name, - otherwise "". - @exception SQLException If the column index is not valid. - **/ - public String getSchemaName(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - - // @G1A If we have column descriptors, use them to get the schema name. //@G1A - if(extendedColumnDescriptors_ != null) //@G1A - { - //@G1A - DBColumnDescriptorsDataFormat dataFormat = extendedColumnDescriptors_.getColumnDescriptors(columnIndex, convTable_); //@KBA //@ss1 - if(dataFormat != null) //@KBA Depending on the query, dataFormat returned by the host server may be null. For example, if a union was used or an expression - return dataFormat.getBaseTableSchemaName(convTable_); //@G1A - } //@G1A - - //else return "" - return ""; - } - - /** - Returns the column's table name. - This method is supported only if the user has set the - driver property "extended metadata" to true. - @param columnIndex The column index (1-based). - @return The base table name if the user set the - driver property "extended metadata" to true and - the system returns us a table name, - otherwise "". - @exception SQLException If the column index is not valid. - **/ - public String getTableName(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - - // Changed to get the Base Table Name for a column if the extended metadata property is true - // because we already have the information, we should return it to the user if they want it... - if(extendedColumnDescriptors_ != null) - { - DBColumnDescriptorsDataFormat dataFormat = extendedColumnDescriptors_.getColumnDescriptors(columnIndex, convTable_); //@KBA //@ss1 - if(dataFormat != null) //@KBA Depending on the query, dataFormat returned by the host server may be null. For example, if a union was used or an expression - return dataFormat.getBaseTableName(convTable_); //@KBA - //@KBD return extendedColumnDescriptors_.getColumnDescriptors(columnIndex).getBaseTableName(convTable_); //K1C use to call getBaseTableSchemaName - } - - // we still return "" if we don't have the Base Table Name - return ""; - } - - /** - Indicates if the column is automatically numbered. - @param columnIndex The column index (1-based). - @return True if column is autoincrement, false otherwise. - @exception SQLException If the column index is not valid. - Note: connection property "extended metadata" must be true for this method to be return accurate information. - If the "extended metadata" connection property is not set to true, then this method will always return false. - **/ - public boolean isAutoIncrement(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - - // Only run the query to get the information if the table name can be found. The table name - // can only be found if "extended metadata" == true - // @A9A - - String tableName = this.getTableName(columnIndex); - if ((tableName == null) || (tableName.length() == 0) ) { - return false; - } - - //return false; //@in1 add implementation instead of always returning false - - PreparedStatement ps = null; - ResultSet rs = null; - try - { - ps = con_.prepareStatement("SELECT identity_generation " + - "FROM QSYS2" + getCatalogSeparator() + "SYSCOLUMNS" + - " WHERE identity_generation is not null" + - " AND column_name = ?" + - " AND table_name = ?" + - " AND table_schema = ?"); - ps.setString(1, this.getColumnName(columnIndex)); - ps.setString(2, tableName); - ps.setString(3, this.getSchemaName(columnIndex)); - - rs = ps.executeQuery(); - if ( rs.next()) - return true; - else - return false; - - } - catch (SQLException e) - { - throw e; - } - finally - { - try{ - if(rs != null) - rs.close(); - }catch(Exception e){} //allow next close to execute - if(ps != null) - ps.close(); - } - } - - /** - Indicates if the column is case sensitive. - @param columnIndex The column index (1-based). - @return true if the column is case sensitive; - false otherwise. - @exception SQLException If the column index is not valid. - **/ - public boolean isCaseSensitive(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - - // In DB2 for IBM i, all text types - // are case sensitive. - return row_.getSQLType(columnIndex).isText(); - } - - /** - Indicates if the column is a currency value. - @param columnIndex The column index (1-based). - @return Always false. DB2 for IBM i - does not directly support currency - values. - @exception SQLException If the column index is not valid. - **/ - public boolean isCurrency(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return false; - } - - /** - Indicates if a write on the column will definitely succeed. - @param columnIndex The column index (1-based). - @return Always false. The driver does - not check if the user has the - necessary authority to write to - the column. - @exception SQLException If the column index is not valid. - **/ - public boolean isDefinitelyWritable(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return false; - } - - /** - Indicates if the column can contain an SQL NULL value. - @param columnIndex The column index (1-based). - @return true if the column is can contain - an SQL NULL value; false otherwise. - @exception SQLException If the column index is not valid. - **/ - public int isNullable(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return row_.isNullable(columnIndex); - } - - /** - Indicates if the column is read-only. - @param columnIndex The column index (1-based). - @return true if the column is read-only; - false otherwise. - @exception SQLException If the column index is not valid. - **/ - public boolean isReadOnly(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - - // @G1A If we have column descriptors, use them to get searchable label. //@G1A - if(extendedColumnDescriptors_ != null)// && concurrency_ != ResultSet.CONCUR_READ_ONLY) //@G1A @G3C @36072 - { - //@G1A - if(extendedColumnDescriptors_.getUpdateable(columnIndex) == (byte)SQL_READ_ONLY) //@G1A @G2C - return true; //@G1A - else //@G1A - return false; //@G1A - } //@G1A - - // else use "old" way - return(concurrency_ == ResultSet.CONCUR_READ_ONLY); - } - - /** - Indicates if the column be used in a where clause. - @param columnIndex The column index (1-based). - @return If the user has set the "extended metadata" driver property to true, - returns true if the column can be used in a where clause - with any comparison operator except LIKE, returns - false if the column cannot be used in a where clause. - If the "extended metadata" driver property is set to false, - true will always be returned. - @exception SQLException If the column index is not valid. - **/ - public boolean isSearchable(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - // @G1A If we have column descriptors, use them to get searchable label. //@G1A - if(extendedColumnDescriptors_ != null) //@G1A - { - //@G1A - if(extendedColumnDescriptors_.getSearchable(columnIndex) == (byte)SQL_UNSEARCHABLE) //@G1A @G2C - return false; //@G1A - else //@G1A - return true; //@G1A - } //@G1A - - // Else, return true - return true; - } - - /** - Indicates if the column can contain a signed value. - @param columnIndex The column index (1-based). - @return true if the column is signed; - false otherwise. - @exception SQLException If the column index is not valid. - **/ - public boolean isSigned(int columnIndex) - throws SQLException - { - checkIndex(columnIndex); - return(row_.getSQLType(columnIndex).isSigned()); - } - - /** - Indicates if it is possible for a write on the column to succeed. - The write may fail even if this method returns true. - The accuracy of this method will be improved if the "extended metadata" - property is set to true. - @param columnIndex The column index (1-based). - @return true if it is possible for a write on - the column to succeed; false otherwise. - @exception SQLException If the column index is not valid. - **/ - public boolean isWritable(int columnIndex) - throws SQLException - { - //@G1D checkIndex (columnIndex); - //@G1D return(concurrency_ != ResultSet.CONCUR_READ_ONLY); - return !isReadOnly(columnIndex); //@G1A - } - - /** - Returns the name of the SQL cursor in use by this result set. - @return The cursor name. - **/ - public String toString() - { - return cursorName_; - } - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCResultSetMetaData", "java.sql.ResultSetMetaData" }; - } - - //@in1 (copied from AS400JDBCDatabaseMetadata) - /** - Returns the naming convention used when referring to tables. - This depends on the naming convention specified in the connection - properties. - - @return If using SQL naming convention, "." is returned. If - using system naming convention, "/" is returned. - - @exception SQLException This exception is never thrown. - **/ - private String getCatalogSeparator () - throws SQLException - { - String catalogSeparator; - if (((AS400JDBCConnection)con_).getProperties().equals (JDProperties.NAMING, JDProperties.NAMING_SQL)) - catalogSeparator = "."; - else - catalogSeparator = "/"; - - return catalogSeparator; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCRowId.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCRowId.java deleted file mode 100644 index 288159194..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCRowId.java +++ /dev/null @@ -1,156 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCRowId.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/* ifdef JDBC40 -import java.sql.RowId; -endif */ - -//@PDA jdbc40 new class -public class AS400JDBCRowId -/* ifdef JDBC40 -implements RowId -endif */ -{ - - private byte[] data_; - //put byteToHex conversion here in case BinaryConverter is not in jar. - private static final char[] c_ = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; - - - /** - * Constructs an AS400JDBCRowId object. The data is contained - * in the raw byte array. No further communication with the IBM i system - * is necessary. - * - * @param data The RowId data. - **/ - AS400JDBCRowId(byte[] data) - { - data_ = data; - } - - //JDBC40DOC /** - //JDBC40DOC * Compares this RowId to the specified object. The result is - //JDBC40DOC * true if and only if the argument is not null and is a RowId - //JDBC40DOC * object that represents the same ROWID as this object. - //JDBC40DOC *

        - //JDBC40DOC * It is important - //JDBC40DOC * to consider both the origin and the valid lifetime of a RowId - //JDBC40DOC * when comparing it to another RowId. If both are valid, and - //JDBC40DOC * both are from the same table on the same data source, then if they are equal - //JDBC40DOC * they identify - //JDBC40DOC * the same row; if one or more is no longer guaranteed to be valid, or if - //JDBC40DOC * they originate from different data sources, or different tables on the - //JDBC40DOC * same data source, they may be equal but still - //JDBC40DOC * not identify the same row. - //JDBC40DOC * - //JDBC40DOC * @param obj the Object to compare this RowId object - //JDBC40DOC * against. - //JDBC40DOC * @return true if the RowIds are equal; false otherwise - //JDBC40DOC */ - /* ifdef JDBC40 - public boolean equals(Object obj) - { - if (!(obj instanceof RowId)) - { - return false; - } - - byte[] otherBytes = ((RowId) obj).getBytes(); - if (data_.length != otherBytes.length) - return false; - - for (int i = 0; i < data_.length; i++) - { - if (data_[i] != otherBytes[i]) - return false; - } - return true; - } - endif */ - - /** - * Returns an array of bytes representing the value of the SQL ROWID - * designated by this java.sql.RowId object. - * - * @return an array of bytes, whose length is determined by the driver supplying - * the connection, representing the value of the ROWID designated by this - * java.sql.RowId object. - */ - public byte[] getBytes() - { - return data_; - } - - /** - * Returns a String representing the value of the SQL ROWID designated by this - * java.sql.RowId object. - *

        - * Like java.sql.Date.toString() - * returns the contents of its DATE as the String "2004-03-17" - * rather than as DATE literal in SQL (which would have been the String - * DATE "2004-03-17"), toString() - * returns the contents of its ROWID in a form specific to the driver supplying - * the connection, and possibly not as a ROWID literal. - * Toolbox converts RowId bytes to HEX string format. - * - * @return a String whose format is determined by the driver supplying the - * connection, representing the value of the ROWID designated - * by this java.sql.RowId object. - */ - public String toString() - { - return bytesToString(data_); - } - - - static final String bytesToString(final byte[] b) - { - return bytesToString(b, 0, b.length); - } - - static final String bytesToString(final byte[] b, int offset, int length) - { - char[] c = new char[length*2]; - int num = bytesToString(b, offset, length, c, 0); - return new String(c, 0, num); - } - - - static final int bytesToString(final byte[] b, int offset, int length, final char[] c, int coffset) - { - for(int i=0; i>>4) & 0x0F); - final byte lo = (byte)((b[i+offset] & 0x0F)); - c[j+coffset] = c_[hi]; - c[j+coffset+1] = c_[lo]; - } - return length*2; - } - - - /** - * Returns a hash code value of this RowId object. - * - * @return a hash code for the RowId - */ - public int hashCode() - { - //for now, use String's implementation. seems good enough. - return this.toString().hashCode(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCRowSet.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCRowSet.java deleted file mode 100644 index f2aecac5e..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCRowSet.java +++ /dev/null @@ -1,7380 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCRowSet.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import javax.sql.DataSource; -import javax.sql.RowSet; -import javax.sql.RowSetEvent; -import javax.sql.RowSetListener; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.math.BigDecimal; -import java.net.URL; //@G4A JDBC 3.0 -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Connection; -import java.sql.Date; -import java.sql.DriverManager; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.PreparedStatement; -endif */ - -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -/* ifdef JDBC40 -import java.sql.RowId; -endif */ -import java.sql.SQLException; -import java.sql.SQLWarning; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Statement; -import java.sql.Time; -import java.sql.Timestamp; -import java.sql.Types; -import java.util.Calendar; -import java.util.Hashtable; //@A2A -import java.util.Map; - -/** -* The AS400JDBCRowSet class represents a connected rowset that encapsulates an JDBC result set. -* The database connection is maintained while in use. -*

        -* Either the url or dataSourceName property must be set to specify how the database connection -* is established. The command property must be set to specify how to create the PreparedStatement. -* -*

        This example creates an AS400JDBCRowSet object, populates it, and then updates its contents. -*

        -* DriverManager.registerDriver(new AS400JDBCDriver()); -* AS400JDBCRowSet rowset = new AS400JDBCRowSet("jdbc:as400://mySystem","myUser", "myPassword"); -* -* // Set the command used to populate the list. -* rowset.setCommand("SELECT * FROM MYLIB.DATABASE"); -* -* // Populate the rowset. -* rowset.execute(); -* -* // Update the customer balances. -* while (rowset.next()) -* { -* double newBalance = rowset.getDouble("BALANCE") + july_statements.getPurchases(rowset.getString("CUSTNUM")); -* rowset.updateDouble("BALANCE", newBalance); -* rowset.updateRow(); -* } -*
        -* -*

        This example creates an AS400JDBCRowSet object, sets the data source and command parameters and then -* populates it. -* -*

        -* // Get the data source that is registered in JNDI (assumes JNDI environment is set). -* Context context = new InitialContext(); -* AS400JDBCDataSource dataSource = (AS400JDBCDataSource) context.lookup("jdbc/customer"); -* -* AS400JDBCRowSet rowset = new AS400JDBCRowSet(); -* rowset.setDataSourceName("jdbc/customer"); -* rowset.setUsername("myuser"); -* rowset.setPassword("myPasswd"); -* -* // Set the prepared statement and initialize the parameters. -* rowset.setCommand("SELECT * FROM MYLIBRARY.MYTABLE WHERE STATE = ? AND BALANCE > ?"); -* rowset.setString(1, "MINNESOTA"); -* rowset.setDouble(2, MAXIMUM_LIMIT); -* -* // Populate the rowset. -* rowset.execute(); -*
        -* -*

        AS400JDBCRowSet objects generate the following events: -*

          -*
        • RowSetEvent - The events fired are: -*
            -*
          • cursorMoved
          • -*
          • rowChanged
          • -*
          • rowSetChanged
          • -*
          -*
        • -*
        -**/ -public class AS400JDBCRowSet -/* ifdef JDBC40 -extends ToolboxWrapper -endif */ -implements RowSet, Serializable // @A3C -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - - static final String className_ = "AS400JDBCRowSet"; - private String command_; // The command used to create the result set. - private String dataSourceName_; // The name of the data source. - private boolean useDataSource_ = true; // Whether the dataSource specified is used. - private String url_; // The user defined URL used to make the connection. - private String username_; // The user name used to make the connection. - private String password_; // The password used to make the connection. - - // Toolbox classes. - private Connection connection_; // The JDBC connection. - private DataSource dataSource_; // The dataSource used to make the connection. - private AS400JDBCPreparedStatement statement_; // The prepared statement. //@pdc jdbc40 - private transient AS400JDBCResultSet resultSet_; // The result set. @G4C //@scan1 - private transient AS400JDBCRowSetEventSupport eventSupport_; // RowSetListener support. @A3C - private Context context_ = null; //@A1A // The JNDI naming context which specifies how naming - // and directory services are accessed. - private Hashtable environment_ = null; //@A2A // The jndi environment properties. - - // Connection properties. - private boolean isReadOnly_ = false; - private int transactionIsolation_ = Connection.TRANSACTION_READ_UNCOMMITTED; - private Map typeMap_; - - // Statement properties. - private boolean createNewStatement_ = true; - private int concurrency_ = ResultSet.CONCUR_READ_ONLY; - private boolean escapeProcessing_ = true; - private int type_ = ResultSet.TYPE_FORWARD_ONLY; - - private transient PropertyChangeSupport changes_; // @A3C - - /** - * Constructs a default AS400JDBCRowSet object. - **/ - public AS400JDBCRowSet() - { - // @A3D eventSupport_ = new AS400JDBCRowSetEventSupport(); - initializeTransient(); // @A3A - } - - /** - * Constructs an AS400JDBCRowset with the specified dataSourceName. - * @param dataSourceName The name of the data source used to make the connection. - **/ - public AS400JDBCRowSet(String dataSourceName) - { - this(); - setDataSourceName(dataSourceName); - } - - /** - * Constructs an AS400JDBCRowSet with the specified parameters. - * @param url The url used to make the connection. - * @param username The user name. - * @param password The password. - **/ - public AS400JDBCRowSet(String url, String username, String password) - { - this(); - setUrl(url); - setUsername(username); - setPassword(password); - } - - /** - * Positions the cursor to an absolute row number. - * - *

        Attempting to move beyond the first row positions the - * cursor before the first row. Attempting to move beyond the last - * row positions the cursor after the last row. - * - *

        If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @param rowNumber The absolute row number (1-based). If the absolute row - * number is positive, this positions the cursor - * with respect to the beginning of the result set. - * If the absolute row number is negative, this - * positions the cursor with respect to the end - * of result set. - * @return true if the requested cursor position is - * valid; false otherwise. - * - * @exception SQLException If the result set is not open, - * the result set is not scrollable, - * the row number is 0, - * or an error occurs. - */ - public boolean absolute (int rowNumber) throws SQLException - { - validateResultSet(); - boolean status = resultSet_.absolute(rowNumber); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - return status; - } - - /** - * Adds a PropertyChangeListener. - * @param listener The PropertyChangeListener. - * @see #removePropertyChangeListener - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - changes_.addPropertyChangeListener(listener); - } - - /** - * Adds a RowSetListener to the list. - * @param listener The RowSetListener object. - **/ - public void addRowSetListener(RowSetListener listener) - { - eventSupport_.addRowSetListener(listener); - } - - /** - * Positions the cursor after the last row. - * If an InputStream from the current row is open, it is implicitly closed. - * In addition, all warnings and pending updates are cleared. - * - * @exception SQLException If the result set is not open, the result set is not scrollable, or an error occurs. - **/ - public void afterLast () throws SQLException - { - validateResultSet(); - resultSet_.afterLast(); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - } - - /** - * Positions the cursor before the first row. - * If an InputStream from the current row is open, it is implicitly closed. - * In addition, all warnings and pending updates are cleared. - * - * @exception SQLException If the result set is not open, the result set is not scrollable, or an error occurs. - **/ - public void beforeFirst () throws SQLException - { - validateResultSet(); - resultSet_.beforeFirst(); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - } - - - /** - * Cancels all pending updates that have been made since the last - * call to updateRow(). If no updates have been made or updateRow() - * has already been called, then this method has no effect. - * - * @exception SQLException If the result set is not open - * or the result set is not updatable. - **/ - public void cancelRowUpdates () throws SQLException - { - validateResultSet(); - resultSet_.cancelRowUpdates(); - } - - /** - * Clears the columns for the current row and releases all associated resources. - * @exception SQLException If a database error occurs. - **/ - public void clearParameters() throws SQLException - { - if (statement_ != null) - statement_.clearParameters(); - } - - /** - * Clears all warnings that have been reported for the result set. - * After this call, getWarnings() returns null until a new warning - * is reported for the result set. - * - * @exception SQLException If an error occurs. - **/ - public void clearWarnings () throws SQLException - { - validateResultSet(); - resultSet_.clearWarnings(); - } - - /** - * Releases the rowset resources immediately instead of waiting for them to be automatically released. - * This closes the connection to the database. - * - * @exception SQLException If an error occurs. - **/ - public void close () throws SQLException - { - - // @D4 change -- don't throw exceptions. Instead, catch and log them. The - // user called close so we won't return until we tried to close all - // resources. - try - { // @J4a // @J4a - if (resultSet_ != null) - resultSet_.close(); - } // @J4a - catch (SQLException e) // @J4a - { // @J4a - if (JDTrace.isTraceOn()) // @J4a - JDTrace.logInformation (this, "Closing result set while closing the row set failed: " + e.getMessage()); // @j4a - } // @J4a - - - - try - { // @J4a // @J4a - if (statement_ != null) - statement_.close(); - } // @J4a - catch (SQLException e) // @J4a - { // @J4a - if (JDTrace.isTraceOn()) // @J4a - JDTrace.logInformation (this, "Closing statement set while closing the row set failed: " + e.getMessage()); // @j4a - } // @J4a - - - - if (connection_ != null) - connection_.close(); - } - - - - /** - * Connects to the database. - * @exception SQLException If database errors creating the connection. - **/ - private void connect() throws SQLException - { - if (JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "connect()"); - - if (isUseDataSource()) - { - if (JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "using JDBC DataSource"); - - if (dataSourceName_ == null) - throw new ExtendedIllegalStateException("dataSourceName", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - try - { - if (context_ == null) //@A1A - { - if (environment_ == null) //@A2A - context_ = new InitialContext(); //@A1C - else //@A2A - context_ = new InitialContext(environment_); //@A2A - } - dataSource_ = (AS400JDBCDataSource)context_.lookup(dataSourceName_); - } - catch (NamingException ne) - { - if (JDTrace.isTraceOn ()) - { - JDTrace.logInformation(this, "Cannot find JNDI data source."); - ne.printStackTrace(DriverManager.getLogWriter()); - } - throw new ExtendedIllegalStateException("dataSourceName", ExtendedIllegalStateException.OBJECT_CANNOT_BE_FOUND); //@A2C - } - connection_ = (AS400JDBCConnection)dataSource_.getConnection(username_, password_); - } - else - { // Use the url to make the connection. - if (JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "using JDBC url"); - - if (url_ == null) - throw new ExtendedIllegalStateException("url", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - if (username_ != null && password_ != null) - connection_ = DriverManager.getConnection(url_, username_, password_); - else - connection_ = DriverManager.getConnection(url_); - } - - // Set the connection properties. - connection_.setReadOnly(isReadOnly_); - if (transactionIsolation_ != Connection.TRANSACTION_READ_UNCOMMITTED) - connection_.setTransactionIsolation(transactionIsolation_); - } - - /** - * Creates a statement. - * @exception SQLException If a database error occurs creating the statement. - **/ - private void createStatement() throws SQLException - { - if (JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "createStatement()"); - - if (command_ == null) - throw new ExtendedIllegalStateException("command", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - if (connection_ == null) - connect(); - - // set the parameters. - int fetchDirection=0, fetchSize=0, maxFieldSize=0, maxRows=0, queryTimeout=0; - boolean setParameters = false; - if (statement_ != null) - { - fetchDirection = statement_.getFetchDirection(); - fetchSize = statement_.getFetchSize(); - maxFieldSize = statement_.getMaxFieldSize(); - maxRows = statement_.getMaxRows(); - queryTimeout = statement_.getQueryTimeout(); - setParameters = true; - } - statement_ = (AS400JDBCPreparedStatement)connection_.prepareStatement(command_, type_, concurrency_); //@PDC jdbc40 - - if (setParameters) - { - statement_.setFetchDirection(fetchDirection); - statement_.setFetchSize(fetchSize); - statement_.setMaxFieldSize(maxFieldSize); - statement_.setMaxRows(maxRows); - statement_.setQueryTimeout(queryTimeout); - } - createNewStatement_ = false; - } - - /** - * Deletes the current row from the result set and the database. - * After deleting a row, the cursor position is no longer valid, - * so it must be explicitly repositioned. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the cursor is positioned on the insert row, - * or an error occurs. - **/ - public void deleteRow () throws SQLException - { - validateResultSet(); - resultSet_.deleteRow(); - } - - /** - * Executes the command and fills the rowset with data. Any previous contents are erased. - * - * The following properties may be used to create a connection for reading data: - *

          - *
        • dataSource (Required if isUseDataSource = true) - *
        • url (Required if isUseDataSource = false) - *
        • user name
        • password
        • transaction isolation
        • type map - *
        - * The following properties may be used to create a statement to execute a command: - *
          - *
        • command (Required) - *
        • read only
        • maximum field size
        • maximum rows
        • escape processing
        • query timeout - *
        - * - * @exception SQLException If a database error occurs. - **/ - public void execute() throws SQLException - { - if (JDTrace.isTraceOn ()) - JDTrace.logInformation (this, "execute()"); - - if (createNewStatement_) - createStatement(); - - if (command_.toUpperCase().indexOf("SELECT") != -1) // Fix for JTOpen Bug 4121 - { - resultSet_ = (AS400JDBCResultSet)statement_.executeQuery(); //@G4C - - // Notify the listeners. - eventSupport_.fireRowSetChanged(new RowSetEvent(this)); - } - else - { - statement_.executeUpdate(); - } - - } - - /** - * Closes the Statement and Connection. - * @exception SQLException If a database error occurs. - **/ - protected void finalize() throws SQLException - { - try - { - close(); - } - catch (SQLException e) - { - JDError.throwSQLException (JDError.EXC_SERVER_ERROR); - } - } - - /** - * Returns the column index for the specified column name. - * - * @param columnName The column name. - * @return The column index (1-based). - * - * @exception SQLException If the result set is not open - * or the column name is not found. - **/ - public int findColumn (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.findColumn(columnName); - } - - /** - * Positions the cursor to the first row. - * If an InputStream from the current row is open, it is implicitly closed. - * In addition, all warnings and pending updates are cleared. - * - * @return true if the requested cursor position is valid; false otherwise. - * @exception SQLException If the result set is not open, the result set is not scrollable, or an error occurs. - **/ - public boolean first () throws SQLException - { - validateResultSet(); - boolean status = resultSet_.first(); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - return status; - } - - - /** - * Returns the value of a column as an Array object. - * DB2 for IBM i does not support arrays. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - **/ - public Array getArray (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getArray(columnIndex); - } - - /** - * Returns the value of a column as an Array object. - * DB2 for IBM i does not support arrays. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - **/ - public Array getArray (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getArray(columnName); - } - - /** - * Returns the value of a column as a stream of ASCII - * characters. This can be used to get values from columns - * with SQL types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and - * BLOB. All of the data in the returned stream must be read - * prior to getting the value of any other column. The next - * call to a get method implicitly closes the stream. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, - * or the requested conversion is not valid. - **/ - public InputStream getAsciiStream (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getAsciiStream(columnIndex); - } - - /** - * Returns the value of a column as a stream of ASCII - * characters. This can be used to get values from columns - * with SQL types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and - * BLOB. All of the data in the returned stream must be read - * prior to getting the value of any other column. The next - * call to a get method implicitly closes the stream. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public InputStream getAsciiStream (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getAsciiStream(columnName); - } - - /** - * Returns the value of a column as a BigDecimal object. This - * can be used to get values from columns with SQL types - * SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, - * or the requested conversion is not valid. - **/ - public BigDecimal getBigDecimal (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getBigDecimal(columnIndex); - } - - /** - * Returns the value of a column as a BigDecimal object. This - * can be used to get values from columns with SQL types - * SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, - * or the requested conversion is not valid. - **/ - public BigDecimal getBigDecimal (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getBigDecimal(columnName); - } - - /** - * Returns the value of a column as a BigDecimal object. This - * can be used to get values from columns with SQL types - * SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @param scale The number of digits after the decimal. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, - * the scale is not valid, or the - * requested conversion is not valid. - * - * @deprecated Use getBigDecimal(int) instead. - * @see #getBigDecimal(int) - **/ - public BigDecimal getBigDecimal (int columnIndex, int scale) throws SQLException - { - validateResultSet(); - return resultSet_.getBigDecimal(columnIndex, scale); - } - - /** - * Returns the value of a column as a BigDecimal object. This - * can be used to get values from columns with SQL types - * SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @param scale The number of digits after the decimal. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, - * the scale is not valid, or the - * requested conversion is not valid. - * - * @deprecated Use getBigDecimal(String) instead. - * @see #getBigDecimal(String) - **/ - public BigDecimal getBigDecimal (String columnName, int scale) throws SQLException - { - validateResultSet(); - return resultSet_.getBigDecimal(columnName, scale); - } - - /** - * Returns the value of a column as a stream of uninterpreted - * bytes. This can be used to get values from columns - * with SQL types BINARY, VARBINARY, and BLOB. All of the data in - * the returned stream must be read prior to getting the - * value of any other column. The next call to a get method - * implicitly closes the stream. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public InputStream getBinaryStream (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getBinaryStream(columnIndex); - } - - /** - * Returns the value of a column as a stream of uninterpreted - * bytes. This can be used to get values from columns - * with SQL types BINARY, VARBINARY, and BLOB. All of the data in - * the returned stream must be read prior to getting the - * value of any other column. The next call to a get method - * implicitly closes the stream. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public InputStream getBinaryStream (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getBinaryStream(columnName); - } - - - /** - * Returns the value of a column as a Blob object. - * This can be used to get values from columns with SQL - * types BINARY, VARBINARY, and BLOB. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public Blob getBlob (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getBlob(columnIndex); - } - - /** - * Returns the value of a column as a Blob object. - * This can be used to get values from columns with SQL - * types BINARY, VARBINARY, and BLOB. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public Blob getBlob (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getBlob(columnName); - } - - - /** - * Returns the value of a column as a Java boolean value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or false if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public boolean getBoolean (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getBoolean(columnIndex); - } - - /** - * Returns the value of a column as a Java boolean value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @return The column value or false if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public boolean getBoolean (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getBoolean(columnName); - } - - /** - * Returns the value of a column as a Java byte value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public byte getByte (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getByte(columnIndex); - } - - - /** - * Returns the value of a column as a Java byte value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public byte getByte (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getByte(columnName); - } - - /** - * Returns the value of a column as a Java byte array. - * This can be used to get values from columns with SQL - * types BINARY and VARBINARY. - * - *

        This can also be used to get values from columns - * with other types. The values are returned in their - * native IBM i format. This is not supported for - * result sets returned by a DatabaseMetaData object. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public byte[] getBytes (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getBytes(columnIndex); - } - - - - /** - * Returns the value of a column as a Java byte array. - * This can be used to get values from columns with SQL - * types BINARY and VARBINARY. - * - *

        This can also be used to get values from columns - * with other types. The values are returned in their - * native IBM i format. This is not supported for - * result sets returned by a DatabaseMetaData object. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public byte[] getBytes (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getBytes(columnName); - } - - - /** - * Returns the value of a column as a character stream. - * This can be used to to get values from columns with SQL - * types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and BLOB. - * All of the data in the returned stream must be read prior to - * getting the value of any other column. The next call to a get - * method implicitly closes the stream. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - */ - public Reader getCharacterStream (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getCharacterStream(columnIndex); - } - - - /** - * Returns the value of a column as a character stream. - * This can be used to to get values from columns with SQL - * types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and BLOB. - * All of the data in the returned stream must be read prior - * to getting the value of any other column. The next call - * to a get method implicitly closes the stream. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not valid, or the - * requested conversion is not valid. - */ - public Reader getCharacterStream (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getCharacterStream(columnName); - } - - - /** - * Returns the value of a column as a Clob object. - * This can be used to get values from columns with SQL - * types CHAR, VARCHAR, BINARY, VARBINARY, BLOB, and CLOB. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public Clob getClob (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getClob(columnIndex); - } - - /** - * Returns the value of a column as a Clob object. - * This can be used to get values from columns with SQL - * types CHAR, VARCHAR, BINARY, VARBINARY, BLOB, and CLOB. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public Clob getClob (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getClob(columnName); - } - - /** - * Returns the command used by the statement the generate the rowset. - * This should be set before calling the execute method. - * @return The command. The default value is null. - **/ - public String getCommand() - { - return command_; - } - - /** - * Returns the result set concurrency. - * - * @return The result set concurrency. - * Valid values are: - *

          - *
        • ResultSet.CONCUR_READ_ONLY - *
        • ResultSet.CONCUR_UPDATABLE - *
        - * @exception SQLException If the result set is not open. - **/ - public int getConcurrency () throws SQLException - { - if (resultSet_ != null) - concurrency_ = resultSet_.getConcurrency(); - return concurrency_; - } - - //@A1A - /** - * Returns the JNDI naming context which provides name-to-object bindings - * and methods for retrieving and updating naming and directory services. - * - * @return The context or null if the value has not been set. - * - **/ - public Context getContext () - { - return context_; - } - - /** - * Returns the name of the SQL cursor in use by the result set. - * In SQL, results are retrieved through a named cursor. The - * current row of a result can be updated or deleted using a - * positioned UPDATE or DELETE statement that references a cursor name. - * - * @return The cursor name. - * @exception SQLException If the result is not open. - **/ - public String getCursorName() throws SQLException - { - validateResultSet(); - return resultSet_.getCursorName(); - } - - /** - * Returns the name of the data source as identified in JNDI. - * @return The data source name. The default value is null. - **/ - public String getDataSourceName() - { - return dataSourceName_; - } - - /** - * Returns the value of a column as a java.sql.Date object using - * the default calendar. This can be used to get values from columns - * with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public Date getDate (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getDate(columnIndex); - } - - - - /** - * Returns the value of a column as a java.sql.Date object using - * the default calendar. This can be used to get values from columns - * with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public Date getDate (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getDate(columnName); - } - - - /** - * Returns the value of a column as a java.sql.Date object using - * a calendar other than the default. This can be used to get values - * from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - * - * @param columnIndex The column index (1-based). - * @param calendar The calendar. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, - * the calendar is null, or the - * requested conversion is not valid. - **/ - public Date getDate (int columnIndex, Calendar calendar) throws SQLException - { - validateResultSet(); - return resultSet_.getDate(columnIndex, calendar); - } - - - /** - * Returns the value of a column as a java.sql.Date object using - * a calendar other than the default. This can be used to get values - * from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - * - * @param columnName The column name. - * @param calendar The calendar. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, - * the calendar is null, or the - * requested conversion is not valid. - **/ - public Date getDate (String columnName, Calendar calendar) throws SQLException - { - validateResultSet(); - return resultSet_.getDate(columnName, calendar); - } - - - /** - * Returns the value of a column as a Java double value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public double getDouble (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getDouble(columnIndex); - } - - - /** - * Returns the value of a column as a Java double value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public double getDouble (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getDouble(columnName); - } - - - //@A2A - /** - * Returns a hashtable of standard JNDI environment properties. - * - * @return The environment properties or null if the value has not been set. - * - **/ - public Hashtable getEnvironment () - { - return environment_; - } - - /** - * Indicates if escape processing is enabled (default). - * If enabled, escape substitution is done before committing the data. - * @return true if enabled; false otherwise. - **/ - public boolean getEscapeProcessing() - { - return escapeProcessing_ ; - } - - /** - * Returns the fetch direction. - * - * @return The fetch direction. - * Valid values are: - *
          - *
        • ResultSet.FETCH_FORWARD (default) - *
        • ResultSet.FETCH_REVERSE - *
        • ResultSet.FETCH_UNKNOWN - *
        - * - * @exception SQLException If the result is not open. - **/ - public int getFetchDirection() throws SQLException - { - if (resultSet_ != null) - return resultSet_.getFetchDirection(); - - if (statement_ == null) - return ResultSet.FETCH_FORWARD; - - return statement_.getFetchDirection(); - - } - - /** - * Returns the number of rows to be fetched from the database when more rows are needed. - * The number of rows specified only affects result sets created using this statement. - * If the value specified is zero, then the driver will choose an appropriate fetch size. - * - * This setting only affects statements that meet the criteria specified in the "block criteria" property. - * The fetch size is only used if the "block size" property is set to "0". - * - * @return The fetch size. - * @exception SQLException If the result is not open. - **/ - public int getFetchSize() throws SQLException - { - if (resultSet_ != null) - return resultSet_.getFetchSize(); - - if (statement_ == null) - return 0; - - return statement_.getFetchSize(); - } - - /** - * Returns the value of a column as a Java float value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public float getFloat (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getFloat(columnIndex); - } - - - /** - * Returns the value of a column as a Java float value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public float getFloat (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getFloat(columnName); - } - - /** - * Returns the value of a column as a Java int value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public int getInt (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getInt(columnIndex); - } - - - /** - * Returns the value of a column as a Java int value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public int getInt (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getInt(columnName); - } - - - /** - * Returns the value of a column as a Java long value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public long getLong (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getLong(columnIndex); - } - - - /** - * Returns the value of a column as a Java long value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public long getLong (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getLong(columnName); - } - - /** - * Returns the maximum column size. - * This property is only used with column types: - *
          - *
        • BINARY
        • VARBINARY
        • LONGVARBINARY
        • CHAR
        • VARCHAR
        • LONGVARCHAR - *
        - * @return The maximum size. The default zero of zero indicates no maximum. - * @exception SQLException If a database error occurs. - **/ - public int getMaxFieldSize() throws SQLException - { - if (statement_ == null) - return 0; - return statement_.getMaxFieldSize(); - } - - /** - * Returns the maximum number of rows for the rowset. - * @return The maximum. The default value of zero indicates no maximum. - * @exception SQLException If a database error occurs. - **/ - public int getMaxRows() throws SQLException - { - if (statement_ == null) - return 0; - return statement_.getMaxRows(); - } - - /** - * Returns the ResultSetMetaData object that describes the - * result set's columns. - * - * @return The metadata object. - * @exception SQLException If an error occurs. - **/ - public ResultSetMetaData getMetaData () throws SQLException - { - validateResultSet(); - return resultSet_.getMetaData(); - } - - - - /** - * Returns the value of a column as a Java Object. - * This can be used to get values from columns with all - * SQL types. If the column is a user-defined type, then the - * connection's type map is used to created the object. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public Object getObject (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getObject(columnIndex); - } - - - - /** - * Returns the value of a column as a Java Object. - * This can be used to get values from columns with all - * SQL types. If the column is a user-defined type, then the - * connection's type map is used to created the object. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public Object getObject (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getObject(columnName); - } - - - /** - * Returns the value of a column as a Java Object. - * - * @param columnIndex The column index (1-based). - * @param typeMap The type map. This is not used. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, - * the type map is null, or the - * requested conversion is not valid. - **/ - public Object getObject (int columnIndex, Map typeMap) throws SQLException - { - validateResultSet(); - return resultSet_.getObject(columnIndex, typeMap); - } - - - /** - * Returns the value of a column as a Java Object. - * - * @param columnName The column name. - * @param typeMap The type map. This is not used. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, - * the type map is null, or the - * requested conversion is not valid. - **/ - public Object getObject (String columnName, Map typeMap) throws SQLException - { - validateResultSet(); - return resultSet_.getObject(columnName, typeMap); - } - - /** - * Returns the password used to create the connection. - * @return An empty String. For security the password information cannot be accessed. - **/ - public String getPassword() - { - return ""; - } - - /** - * Returns the maximum wait time in seconds for a statement to execute. - * @return The timeout value in seconds. The default value of zero indicates no maximum. - * @exception SQLException If a database error occurs. - **/ - public int getQueryTimeout() throws SQLException - { - validateStatement(); - return statement_.getQueryTimeout(); - } - - /** - * Returns the value of a column as a Ref object. - * DB2 for IBM i does not support structured types. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException Always thrown because DB2 for IBM i does not support structured types. - **/ - public Ref getRef (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getRef(columnIndex); - } - - - /** - * Returns the value of a column as a Ref object. - * DB2 for IBM i does not support structured types. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException Always thrown because DB2 for IBM i does not support structured types. - **/ - public Ref getRef (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getRef(columnName); - } - - /** - * Returns the current row number. - * - * @return The current row number (1-based). If there is no current - * row or if the cursor is positioned on the insert row, - * 0 is returned. - * - * @exception SQLException If the result set is not open. - **/ - public int getRow () throws SQLException - { - validateResultSet(); - return resultSet_.getRow(); - } - - /** - * Returns the value of a column as a Java short value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnIndex The column index (1-based). - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public short getShort (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getShort(columnIndex); - } - - - /** - * Returns the value of a column as a Java short value. - * This can be used to get values from columns with SQL - * types SMALLINT, INTEGER, BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, - * NUMERIC, CHAR, and VARCHAR. - * - * @param columnName The column name. - * @return The column value or 0 if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public short getShort (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getShort(columnName); - } - - - /** - * Returns the statement for this result set. - * - * @return The statement for this result set, or null if the - * result set was returned by a DatabaseMetaData - * catalog method. - * - * @exception SQLException If an error occurs. - **/ - public Statement getStatement() throws SQLException - { - validateResultSet(); - return resultSet_.getStatement(); - } - - /** - * Returns the value of a column as a String object. - * This can be used to get values from columns with any SQL - * type. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public String getString (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getString(columnIndex); - } - - - - /** - * Returns the value of a column as a String object. - * This can be used to get values from columns with any SQL - * type. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public String getString (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getString(columnName); - } - - - - /** - * Returns the value of a column as a java.sql.Time object using the - * default calendar. This can be used to get values from columns - * with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public Time getTime (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getTime(columnIndex); - } - - - - /** - * Returns the value of a column as a java.sql.Time object using the - * default calendar. This can be used to get values from columns - * with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public Time getTime (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getTime(columnName); - } - - - /** - * Returns the value of a column as a java.sql.Time object using a - * calendar other than the default. This can be used to get values - * from columns with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP. - * - * @param columnIndex The column index (1-based). - * @param calendar The calendar. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, - * the calendar is null, or the - * requested conversion is not valid. - **/ - public Time getTime (int columnIndex, Calendar calendar) throws SQLException - { - validateResultSet(); - return resultSet_.getTime(columnIndex, calendar); - } - - - /** - * Returns the value of a column as a java.sql.Time object using a - * calendar other than the default. This can be used to get values - * from columns with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP. - * - * @param columnName The column name. - * @param calendar The calendar. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, - * the calendar is null, or the - * requested conversion is not valid. - **/ - public Time getTime (String columnName, Calendar calendar) throws SQLException - { - validateResultSet(); - return resultSet_.getTime(columnName, calendar); - } - - - - /** - * Returns the value of a column as a java.sql.Timestamp object - * using the default calendar. This can be used to get values - * from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public Timestamp getTimestamp (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getTimestamp(columnIndex); - } - - - - /** - * Returns the value of a column as a java.sql.Timestamp object - * using the default calendar. This can be used to get values - * from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public Timestamp getTimestamp (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getTimestamp(columnName); - } - - - /** - * Returns the value of a column as a java.sql.Timestamp object - * using a calendar other than the default. This can be used to - * get values from columns with SQL types CHAR, VARCHAR, DATE, - * and TIMESTAMP. - * - * @param columnIndex The column index (1-based). - * @param calendar The calendar. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, - * the calendar is null, or the - * requested conversion is not valid. - **/ - public Timestamp getTimestamp (int columnIndex, Calendar calendar) throws SQLException - { - validateResultSet(); - return resultSet_.getTimestamp(columnIndex, calendar); - } - - - /** - * Returns the value of a column as a java.sql.Timestamp object - * using a calendar other than the default. This can be used to - * get values from columns with SQL types CHAR, VARCHAR, DATE, - * and TIMESTAMP. - * - * @param columnName The column name. - * @param calendar The calendar. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, - * the calendar is null, or the - * requested conversion is not valid. - **/ - public Timestamp getTimestamp (String columnName, Calendar calendar) throws SQLException - { - validateResultSet(); - return resultSet_.getTimestamp(columnName, calendar); - } - - /** - * Returns the transaction isolation level. - * Possible values are: - *
          - *
        • Connection.TRANSACTION_READ_UNCOMMITTED
        • Connection.TRANSACTION_READ_COMMITTED - *
        • Connection.TRANSACTION_REPEATABLE_READ
        • Connection.TRANSACTION_SERIALIZABLE - *
        - * @return The transaction isolation level. - **/ - public int getTransactionIsolation() - { - try - { - if (connection_ != null) - return connection_.getTransactionIsolation(); - else - return transactionIsolation_; - } - catch (SQLException e) - { - JDTrace.logInformation (this, "getTransactionIsolation() database error"); // @G5C - return transactionIsolation_; - } - } - - /** - * Returns the result set type. - * - * @return The result set type. Valid values are: - *
          - *
        • ResultSet.TYPE_FORWARD_ONLY - *
        • ResultSet.TYPE_SCROLL_INSENSITIVE - *
        • ResultSet.TYPE_SCROLL_SENSITIVE - *
        - * - * - * @exception SQLException If the result set is not open. - **/ - public int getType() throws SQLException - { - if (resultSet_ != null) - return resultSet_.getType(); - return type_; - } - - /** - * Returns the type map. - * @return The type map. The default value is null. - * @exception SQLException If a database error occurs. - **/ - public Map getTypeMap() throws SQLException - { - if (connection_ != null) - return connection_.getTypeMap(); - return typeMap_; - } - - /** - * Returns the value of a column as a stream of Unicode - * characters. This can be used to get values from columns - * with SQL types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, and - * BLOB. All of the data in the returned stream must be read - * prior to getting the value of any other column. The next - * call to a get method implicitly closes the stream. - * - * @param columnIndex The column index (1-based). - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - * - * @deprecated Use getCharacterStream(int) instead. - * @see #getCharacterStream(int) - **/ - public InputStream getUnicodeStream (int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getUnicodeStream(columnIndex); - } - - /** - * Returns the value of a column as a stream of Unicode - * characters. This can be used to get values from columns - * with SQL types CHAR, VARCHAR, BINARY, VARBINARY, CLOB, - * and BLOB. All of the data in the returned stream must be - * read prior to getting the value of any other column. The - * next call to a get method implicitly closes the stream. - * - * @param columnName The column name. - * @return The column value or null if the value is SQL NULL. - * - * @exception SQLException If the result set is not open, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - * - * @deprecated Use getCharacterStream(String) instead. - * @see #getCharacterStream(String) - **/ - public InputStream getUnicodeStream (String columnName) throws SQLException - { - validateResultSet(); - return resultSet_.getUnicodeStream(columnName); - } - - /** - * Returns the url used in getting a connection. - * Either this property or the dataSource property must be set before calling the execute command. - * @return The url. The default value is null. - **/ - public String getUrl() - { - return url_; - } - - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL DATALINK output parameter as a - java.net.URL object. - - @param columnIndex The column index (1-based). - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed or - the requested conversion is not valid. - @since Modification 5 - **/ - public URL getURL (int columnIndex) - throws SQLException - { - validateResultSet(); - return resultSet_.getURL(columnIndex); - } - - - - //@G4A JDBC 3.0 - /** - Returns the value of an SQL DATALINK output parameter as a - java.net.URL object. - - @param columnName The column name. - @return The parameter value or null if the value is SQL NULL. - - @exception SQLException If the statement is not open, - the index is not valid, the parameter name is - not registered as an output parameter, - the statement was not executed or - the requested conversion is not valid. - **/ - public URL getURL (String columnName) - throws SQLException - { - validateResultSet(); - return resultSet_.getURL(columnName); - } - - - /** - * Returns the user used to create the connection. - * @return The user. The default is null. - **/ - public String getUsername() - { - return username_; - } - - /** - * Returns the first warning reported for the result set. - * Subsequent warnings may be chained to this warning. - * - * @return The first warning or null if no warnings - * have been reported. - * - * @exception SQLException If an error occurs. - **/ - public SQLWarning getWarnings() throws SQLException - { - validateResultSet(); - return resultSet_.getWarnings(); - } - - // @A3A - /** - Initializes all transient data. - **/ - private void initializeTransient () - { - eventSupport_ = new AS400JDBCRowSetEventSupport(); - changes_ = new PropertyChangeSupport(this); - resultSet_ = null; //@scan1 - } - - /** - * Inserts the contents of the insert row into the result set - * and the database. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on the insert row, - * a column that is not nullable was not specified, - * or an error occurs. - **/ - public void insertRow () throws SQLException - { - validateResultSet(); - resultSet_.insertRow(); - } - - /** - * Indicates if the cursor is positioned after the last row. - * - * @return true if the cursor is positioned after the last row; - * false if the cursor is not positioned after the last - * row or if the result set contains no rows. - * - * @exception SQLException If the result set is not open. - **/ - public boolean isAfterLast () throws SQLException - { - validateResultSet(); - return resultSet_.isAfterLast(); - } - - - /** - * Indicates if the cursor is positioned before the first row. - * - * @return true if the cursor is positioned before the first row; - * false if the cursor is not positioned before the first - * row or if the result set contains no rows. - * - * @exception SQLException If the result set is not open. - **/ - public boolean isBeforeFirst () throws SQLException - { - validateResultSet(); - return resultSet_.isBeforeFirst(); - } - - /** - * Indicates if the cursor is positioned on the first row. - * - * @return true if the cursor is positioned on the first row; - * false if the cursor is not positioned on the first - * row or the row number can not be determined. - * - * @exception SQLException If the result set is not open. - **/ - public boolean isFirst () throws SQLException - { - validateResultSet(); - return resultSet_.isFirst(); - } - - /** - * Indicates if the cursor is positioned on the last row. - * - * @return true if the cursor is positioned on the last row; - * false if the cursor is not positioned on the last - * row or the row number can not be determined. - * - * @exception SQLException If the result set is not open. - **/ - public boolean isLast () throws SQLException - { - validateResultSet(); - return resultSet_.isLast(); - } - - /** - * Indicates if the rowset is read-only. - * @return true if read-only; false otherwise. The default value is false, allowing updates. - **/ - public boolean isReadOnly() - { - if (connection_ != null) - { - try - { - return connection_.isReadOnly(); - } - catch (SQLException e) { /* return local value */ - } - } - return isReadOnly_; - } - - /** - * Indicates if the data source is used to make a connection to the database. - * @return true if the data source is used; false if the url is used. The default value is true. - **/ - public boolean isUseDataSource() - { - return useDataSource_; - } - - /** - * Positions the cursor to the last row. - * If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @return true if the requested cursor position is - * valid; false otherwise. - * - * @exception SQLException If the result set is not open, - * the result set is not scrollable, - * or an error occurs. - **/ - public boolean last () throws SQLException - { - validateResultSet(); - boolean status = resultSet_.last(); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - return status; - } - - /** - * Positions the cursor to the current row. This is the row - * where the cursor was positioned before moving it to the insert - * row. If the cursor is not on the insert row, then this - * has no effect. - * - *

        If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @exception SQLException If the result set is not open, - * the result set is not scrollable, - * or an error occurs. - **/ - public void moveToCurrentRow () throws SQLException - { - validateResultSet(); - resultSet_.moveToCurrentRow(); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - } - - /** - * Positions the cursor to the insert row. - * If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @exception SQLException If the result set is not open, - * the result set is not scrollable, - * the result set is not updatable, - * or an error occurs. - **/ - public void moveToInsertRow () throws SQLException - { - validateResultSet(); - resultSet_.moveToInsertRow(); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - } - - /** - * Positions the cursor to the next row. - * If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @return true if the requested cursor position is valid; false - * if there are no more rows. - * - * @exception SQLException If the result set is not open, - * or an error occurs. - **/ - public boolean next () throws SQLException - { - validateResultSet(); - boolean status = resultSet_.next(); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - return status; - } - - /** - * Positions the cursor to the previous row. - * If an InputStream from the current row is open, it is implicitly - * closed. In addition, all warnings and pending updates - * are cleared. - * - * @return true if the requested cursor position is - * valid; false otherwise. - * - * @exception SQLException If the result set is not open, - * the result set is not scrollable, - * or an error occurs. - **/ - public boolean previous () throws SQLException - { - validateResultSet(); - boolean status = resultSet_.previous(); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - return status; - } - - - - // @A3A - /** - *Deserializes and initializes transient data. - */ - private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient(); - } - - - - /** - * Refreshes the current row from the database and cancels all - * pending updates that have been made since the last call to - * updateRow(). This method provides a way for an application - * to explicitly refetch a row from the database. If an InputStream - * from the current row is open, it is implicitly closed. In - * addition, all warnings and pending updates are cleared. - * - * @exception SQLException If the result set is not open, - * the result set is not scrollable, - * the cursor is not positioned on a row, - * the cursor is positioned on the - * insert row or an error occurs. - **/ - public void refreshRow () throws SQLException - { - validateResultSet(); - resultSet_.refreshRow(); - } - - /** - * Positions the cursor to a relative row number. - * - *

        Attempting to move beyond the first row positions the - * cursor before the first row. Attempting to move beyond the last - * row positions the cursor after the last row. - * - *

        If an InputStream from the current row is open, it is - * implicitly closed. In addition, all warnings and pending updates - * are cleared. - * - * @param rowNumber The relative row number. If the relative row - * number is positive, this positions the cursor - * after the current position. If the relative - * row number is negative, this positions the - * cursor before the current position. If the - * relative row number is 0, then the cursor - * position does not change. - * @return true if the requested cursor position is - * valid, false otherwise. - * - * @exception SQLException If the result set is not open, - * the result set is not scrollable, - * the cursor is not positioned on a valid row, - * or an error occurs. - */ - public boolean relative (int rowNumber) throws SQLException - { - validateResultSet(); - boolean status = resultSet_.relative(rowNumber); - - eventSupport_.fireCursorMoved(new RowSetEvent(this)); - return status; - } - - /** - * Removes a PropertyChangeListener. - * @param listener The PropertyChangeListener. - * @see #addPropertyChangeListener - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - changes_.removePropertyChangeListener(listener); - } - - /** - * Removes the RowSetListener from the list. - * @param listener The RowSetListener object. - **/ - public void removeRowSetListener(RowSetListener listener) - { - eventSupport_.removeRowSetListener(listener); - } - - /** - * Indicates if the current row has been deleted. A result set - * of type TYPE_SCROLL_INSENSITIVE may contain rows that have - * been deleted. - * - * @return true if current row has been deleted; false otherwise. - * - * @exception SQLException If an error occurs. - **/ - public boolean rowDeleted () throws SQLException - { - validateResultSet(); - return resultSet_.rowDeleted(); - } - - - /** - * Indicates if the current row has been inserted. This driver does - * not support this method. - * - * @return Always false. - * - * @exception SQLException If an error occurs. - **/ - public boolean rowInserted () throws SQLException - { - validateResultSet(); - return resultSet_.rowInserted(); - } - - - /** - * Indicates if the current row has been updated. This driver does - * not support this method. - * - * @return Always false. - * - * @exception SQLException If an error occurs. - **/ - public boolean rowUpdated () throws SQLException - { - validateResultSet(); - return resultSet_.rowUpdated(); - } - - /** - * Sets the array value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Array object. - * @exception SQLException If a database error occurs. - **/ - public void setArray(int parameterIndex, Array value) throws SQLException - { - validateStatement(); - statement_.setArray(parameterIndex, value); - } - - - /** - * Sets the inputStream at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * The driver reads the data from the stream as needed until no more bytes are available. - * The converts this to an SQL VARCHAR value. - * - * @param parameterIndex The parameter index (1-based). - * @param inputStream The input stream or null to update the value to SQL NULL. - * @param length The number of bytes in the stream. - * @exception SQLException If the result set is not open, the result set is not updatable, - * the cursor is not positioned on a row, the column index is not valid, or the requested - * conversion is not valid, the length is not valid, or an error happens while reading the - * input stream. - **/ - public void setAsciiStream(int parameterIndex, InputStream inputStream, int length) throws SQLException - { - validateStatement(); - statement_.setAsciiStream(parameterIndex, inputStream, length); - } - - /** - * Sets the BigDecimal value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The BigDecimal object. - * @exception SQLException If a database error occurs. - **/ - public void setBigDecimal(int parameterIndex, BigDecimal value) throws SQLException - { - validateStatement(); - statement_.setBigDecimal(parameterIndex, value); - } - - /** - * Sets the binary stream value using a inputStream at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * The driver reads the data from the stream as needed until no more bytes are available. - * The driver converts this to an SQL VARBINARY value. - * - * @param parameterIndex The parameter index (1-based). - * @param inputStream The input stream or null to update the value to SQL NULL. - * @param length The number of bytes in the stream. - * @exception SQLException If the result set is not open, the result set is not updatable, - * the cursor is not positioned on a row, the column index is not valid, or the requested - * conversion is not valid, the length is not valid, or an error happens while reading the - * input stream. - **/ - public void setBinaryStream(int parameterIndex, InputStream inputStream, int length) throws SQLException - { - validateStatement(); - statement_.setBinaryStream(parameterIndex, inputStream, length); - } - - /** - * Sets the Blob value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Blob object. - * @exception SQLException If a database error occurs. - **/ - public void setBlob(int parameterIndex, Blob value) throws SQLException - { - validateStatement(); - statement_.setBlob(parameterIndex, value); - } - - /** - * Sets the boolean value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The boolean value. - * @exception SQLException If a database error occurs. - **/ - public void setBoolean(int parameterIndex, boolean value) throws SQLException - { - validateStatement(); - statement_.setBoolean(parameterIndex, value); - } - - /** - * Sets the byte value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The byte value. - * @exception SQLException If a database error occurs. - **/ - public void setByte(int parameterIndex, byte value) throws SQLException - { - validateStatement(); - statement_.setByte(parameterIndex, value); - } - - /** - * Sets the byte array value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The byte array. - * @exception SQLException If a database error occurs. - **/ - public void setBytes(int parameterIndex, byte[] value) throws SQLException - { - validateStatement(); - statement_.setBytes(parameterIndex, value); - } - - /** - * Sets a column in the current row using a Reader value. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * The driver reads the data from the Reader as needed until no more characters are available. - * The driver converts this to an SQL VARCHAR value. - * - * @param parameterIndex The parameter index (1-based). - * @param reader The reader or null to update the value to SQL NULL. - * @param length The number of characters in the stream. - * @exception SQLException If the result set is not open, the result set is not updatable, - * the cursor is not positioned on a row, the column index is not valid, - * or the requested conversion is not valid, the length is not valid, or - * an error happens while reading the input stream. - **/ - public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException - { - validateStatement(); - statement_.setCharacterStream(parameterIndex, reader, length); - } - - /** - * Sets the Clob value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Clob object. - * @exception SQLException If a database error occurs. - **/ - public void setClob(int parameterIndex, Clob value) throws SQLException - { - validateStatement(); - statement_.setClob(parameterIndex, value); - } - - /** - * Sets the command used by the execute statement to populate the rowset. - * This property is required to create the PreparedStatement. - * Resetting the command creates a new PreparedStatement and clears all - * existing input parameters. - * @param command The command. - * @exception SQLException If a database error occurs. - **/ - public void setCommand(String command) throws SQLException - { - String property = "command"; - if (command == null) - throw new NullPointerException(property); - - String old = command_; - command_ = command; - changes_.firePropertyChange(property, old, command); - - createNewStatement_ = true; - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, property, command); - } - - /** - * Sets the concurrency type for the result set. - * Valid values include: - *

          - *
        • ResultSet.CONCUR_READ_ONLY
        • ResultSet.CONCUR_UPDATABLE - *
        - * @param concurrency The concurrency type. - **/ - public void setConcurrency(int concurrency) - { - String property = "concurrency"; - switch (concurrency) - { - case ResultSet.CONCUR_READ_ONLY: break; - case ResultSet.CONCUR_UPDATABLE: break; - default: throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - Integer oldValue = new Integer(concurrency_); - Integer newValue = new Integer(concurrency); - - concurrency_ = concurrency; - changes_.firePropertyChange(property, oldValue, newValue); - - createNewStatement_ = true; - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, "concurrency", concurrency); - } - - //@A1A - /** - * Sets the JNDI naming context which provides name-to-object bindings - * and methods for retrieving and updating naming and directory services. - * If this is not set, a default InitialContext will be created. - * @param context A JNDI naming context. - **/ - public void setContext(Context context) - { - String property = "context"; - if (context == null) - throw new NullPointerException(property); - - Context oldValue = getContext(); - Context newValue = context; - - context_ = context; - changes_.firePropertyChange(property, oldValue, newValue); - } - - /** - * Sets the name of the data source. - * Note: This property is not supported. The setDataSource method - * should be used for setting the data source. - * @param dataSourceName The data source name. - **/ - public void setDataSourceName(String dataSourceName) - { - String property = "dataSourceName"; - if (dataSourceName == null) - throw new NullPointerException(property); - - String old = getDataSourceName(); - dataSourceName_ = dataSourceName; - changes_.firePropertyChange(property, old, dataSourceName); - } - - /** - * Sets the Date value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Date object. - * @exception SQLException If a database error occurs. - **/ - public void setDate(int parameterIndex, Date value) throws SQLException - { - validateStatement(); - statement_.setDate(parameterIndex, value); - } - - /** - * Sets the Date value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Date object. - * @param calendar The Calendar object. - * @exception SQLException If a database error occurs. - **/ - public void setDate(int parameterIndex, Date value, Calendar calendar) throws SQLException - { - validateStatement(); - statement_.setDate(parameterIndex, value, calendar); - } - - /** - * Sets the double value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The double value. - * @exception SQLException If a database error occurs. - **/ - public void setDouble(int parameterIndex, double value) throws SQLException - { - validateStatement(); - statement_.setDouble(parameterIndex, value); - } - - //@A2A - /** - * Sets the standard JNDI environment properties. - * If this is not set, a default set of properties will be used. - * @param environment A Hashtable of JNDI environment properties. - **/ - public void setEnvironment(Hashtable environment) - { - String property = "enviroment"; - if (environment == null) - throw new NullPointerException(property); - - Hashtable oldValue = getEnvironment(); - Hashtable newValue = environment; - - environment_ = environment; - changes_.firePropertyChange(property, oldValue, newValue); - } - - /** - * Sets whether the escape scanning is enabled for escape substitution processing. - * @param enable true if enabled; false otherwise. The default value is true. - * @exception SQLException If a database error occurs. - **/ - public void setEscapeProcessing(boolean enable) throws SQLException - { - Boolean old = new Boolean(getEscapeProcessing()); - - validateStatement(); - statement_.setEscapeProcessing(enable); - - escapeProcessing_ = enable; // save it, since it can't be retrieved anywhere else. - - changes_.firePropertyChange("escapeProcessing", old, new Boolean(enable)); - } - - /** - * Sets the direction in which the rows in a result set are - * processed. - * - * @param fetchDirection The fetch direction for processing rows. - * Valid values are: - *
          - *
        • ResultSet.FETCH_FORWARD - *
        • ResultSet.FETCH_REVERSE - *
        • ResultSet.FETCH_UNKNOWN - *
        - * The default is the statement's fetch direction. - * - * @exception SQLException If the result set is not open, the result set is scrollable - * and the input value is not ResultSet.FETCH_FORWARD, - * or the input value is not valid. - **/ - public void setFetchDirection(int fetchDirection) throws SQLException - { - Integer old = new Integer(getFetchDirection()); - - if (resultSet_ != null) - resultSet_.setFetchDirection(fetchDirection); - - validateStatement(); - statement_.setFetchDirection(fetchDirection); - - changes_.firePropertyChange("fetchDirection", old, new Integer(fetchDirection)); - } - - - /** - * Sets the number of rows to be fetched from the database when more - * rows are needed. This may be changed at any time. If the value - * specified is zero, then the driver will choose an appropriate - * fetch size. - * - *

        This setting only affects statements that meet the criteria - * specified in the "block criteria" property. The fetch size - * is only used if the "block size" property is set to "0". - * - * @param fetchSize The number of rows. This must be greater than - * or equal to 0 and less than or equal to the - * maximum rows limit. The default is the - * statement's fetch size. - * - * @exception SQLException If the result set is not open - * or the input value is not valid. - **/ - public void setFetchSize (int fetchSize) throws SQLException - { - Integer old = new Integer(getFetchSize()); - - if (resultSet_ != null) - resultSet_.setFetchSize(fetchSize); - - validateStatement(); - statement_.setFetchSize(fetchSize); - - changes_.firePropertyChange("fetchSize", old, new Integer(fetchSize)); - } - - /** - * Sets the float value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The float value. - * @exception SQLException If a database error occurs. - **/ - public void setFloat(int parameterIndex, float value) throws SQLException - { - validateStatement(); - statement_.setFloat(parameterIndex, value); - } - - /** - * Sets the integer value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The integer value. - * @exception SQLException If a database error occurs. - **/ - public void setInt(int parameterIndex, int value) throws SQLException - { - validateStatement(); - statement_.setInt(parameterIndex, value); - } - - /** - * Sets the long value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The long value. - * @exception SQLException If a database error occurs. - **/ - public void setLong(int parameterIndex, long value) throws SQLException - { - validateStatement(); - statement_.setLong(parameterIndex, value); - } - - /** - * Sets the maximum column size. The default size is zero indicating no maximum value. - * This property is only used with column types: - *

          - *
        • BINARY
        • VARBINARY
        • LONGVARBINARY
        • CHAR
        • VARCHAR
        • LONGVARCHAR - *
        - * @param maxFieldSize The maximum column size. - * @exception SQLException If a database error occurs. - **/ - public void setMaxFieldSize(int maxFieldSize) throws SQLException - { - String property = "maxFieldSize"; - validateStatement(); - - Integer oldValue = new Integer(getMaxFieldSize()); - Integer newValue = new Integer(maxFieldSize); - - statement_.setMaxFieldSize(maxFieldSize); - changes_.firePropertyChange(property, oldValue, newValue); - } - - /** - * Sets the maximum row limit for the rowset. The default value is zero indicating no maximum value. - * @param maxRows The maximum number of rows. - * @exception SQLException If a database error occurs. - **/ - public void setMaxRows(int maxRows) throws SQLException - { - String property = "maxRows"; - validateStatement(); - - Integer oldValue = new Integer(getMaxRows()); - Integer newValue = new Integer(maxRows); - - statement_.setMaxRows(maxRows); - changes_.firePropertyChange(property, oldValue, newValue); - } - - /** - * Sets the type at the specified parameterIndex to SQL NULL. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param sqlType The SQL type. - * @exception SQLException If a database error occurs. - **/ - public void setNull(int parameterIndex, int sqlType) throws SQLException - { - validateStatement(); - statement_.setNull(parameterIndex, sqlType); - } - - /** - * Sets the user-named type or REF type at the specified parameterIndex to SQL NULL. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param sqlType The SQL type. - * @param typeName The fully qualified name of an SQL user-named type. This parameter is not used if the type is REF. - * @exception SQLException If a database error occurs. - **/ - public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException - { - validateStatement(); - statement_.setNull(parameterIndex, sqlType, typeName); - } - - /** - * Sets the object value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Object value. - * @exception SQLException If a database error occurs. - **/ - public void setObject(int parameterIndex, Object value) throws SQLException - { - validateStatement(); - statement_.setObject(parameterIndex, value); - } - - /** - * Sets the object value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Object value. - * @param targetSqlType The SQL type. - * @exception SQLException If a database error occurs. - **/ - public void setObject(int parameterIndex, Object value, int targetSqlType) throws SQLException - { - validateStatement(); - statement_.setObject(parameterIndex, value, targetSqlType); - } - - /** - * Sets the object value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Object value. - * @param targetSqlType The SQL type. - * @param scale The number of digits after the decimal point. This parameter is used only for SQL types Decimal or Numeric. - * @exception SQLException If a database error occurs. - **/ - public void setObject(int parameterIndex, Object value, int targetSqlType, int scale) throws SQLException - { - validateStatement(); - statement_.setObject(parameterIndex, value, targetSqlType, scale); - } - - /** - * Sets the password used to make the connection. - * Note: This property has no effect unless the useDataSource property is set to false. - * @param password The password. - **/ - public void setPassword(String password) - { - String property = "password"; - if (password == null) - throw new NullPointerException(property); - validateConnection(); - - password_ = password; - changes_.firePropertyChange(property, "", password); - } - - /** - * Sets the maximum wait time in seconds for a statement to execute. - * @param timeout The timeout value in seconds. The default value is zero indicating no maximum value. - * @exception SQLException If a database error occurs. - **/ - public void setQueryTimeout(int timeout) throws SQLException - { - String property = "timeout"; - validateStatement(); - - Integer oldValue = new Integer(getQueryTimeout()); - Integer newValue = new Integer(timeout); - - statement_.setQueryTimeout(timeout); - changes_.firePropertyChange(property, oldValue, newValue); - } - - /** - * Sets whether the rowset is read-only. The default value is false indicating updates are allowed. - * @param readOnly true if read-only; false otherwise. - * @exception SQLException If a database error occurs. - **/ - public void setReadOnly(boolean readOnly) throws SQLException - { - String property = "readOnly"; - - Boolean oldValue = new Boolean(isReadOnly()); - Boolean newValue = new Boolean(readOnly); - - if (connection_ != null) - connection_.setReadOnly(readOnly); - isReadOnly_ = readOnly; - - changes_.firePropertyChange(property, oldValue, newValue); - } - - /** - * Sets Ref value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Ref object. - * @exception SQLException If a database error occurs. - **/ - public void setRef(int parameterIndex, Ref value) throws SQLException - { - validateStatement(); - statement_.setRef(parameterIndex, value); - } - - /** - * Sets the short value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The short value. - * @exception SQLException If a database error occurs. - **/ - public void setShort(int parameterIndex, short value) throws SQLException - { - validateStatement(); - statement_.setShort(parameterIndex, value); - } - - /** - * Sets the string value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The String object. - * @exception SQLException If a database error occurs. - **/ - public void setString(int parameterIndex, String value) throws SQLException - { - validateStatement(); - statement_.setString(parameterIndex, value); - } - - /** - * Sets the time value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Time object. - * @exception SQLException If a database error occurs. - **/ - public void setTime(int parameterIndex, Time value) throws SQLException - { - validateStatement(); - statement_.setTime(parameterIndex, value); - } - - /** - * Sets the time value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Time object. - * @param calendar The Calendar object. - * @exception SQLException If a database error occurs. - **/ - public void setTime(int parameterIndex, Time value, Calendar calendar) throws SQLException - { - validateStatement(); - statement_.setTime(parameterIndex, value, calendar); - } - - /** - * Sets the timestamp value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Timestamp object. - * @exception SQLException If a database error occurs. - **/ - public void setTimestamp(int parameterIndex, Timestamp value) throws SQLException - { - validateStatement(); - statement_.setTimestamp(parameterIndex, value); - } - - /** - * Sets the timestamp value at the specified parameterIndex. - * This parameter is used by the internal statement to populate the rowset via the execute method. - * @param parameterIndex The parameter index (1-based). - * @param value The Timestamp object. - * @param calendar The Calendar object. - * @exception SQLException If a database error occurs. - **/ - public void setTimestamp(int parameterIndex, Timestamp value, Calendar calendar) throws SQLException - { - validateStatement(); - statement_.setTimestamp(parameterIndex, value, calendar); - } - - /** - * Sets the transaction isolation level. - * @param level The transaction isolation level. - * Possible values are: - *
          - *
        • Connection.TRANSACTION_READ_UNCOMMITTED
        • Connection.TRANSACTION_READ_COMMITTED - *
        • Connection.TRANSACTION_REPEATABLE_READ
        • Connection.TRANSACTION_SERIALIZABLE - *
        - * @exception SQLException If a database error occurs. - **/ - public void setTransactionIsolation(int level) throws SQLException - { - String property = "transactionIsolation"; - - Integer oldValue = new Integer(getTransactionIsolation()); - Integer newValue = new Integer(level); - - if (connection_ != null) - connection_.setTransactionIsolation(level); - transactionIsolation_ = level; - - changes_.firePropertyChange(property, oldValue, newValue); - } - - /** - * Sets the result set type. - * Valid values are: - *
          - *
        • ResultSet.TYPE_FORWARD_ONLY
        • ResultSet.TYPE_SCROLL_INSENSITIVE
        • ResultSet.TYPE_SCROLL_SENSITIVE - *
        - * @param type The type. - * @exception SQLException If a database error occurs. - **/ - public void setType(int type) throws SQLException - { - String property = "type"; - switch (type) - { - case ResultSet.TYPE_FORWARD_ONLY: break; - case ResultSet.TYPE_SCROLL_INSENSITIVE: break; - case ResultSet.TYPE_SCROLL_SENSITIVE: break; - default: throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - Integer oldValue = new Integer(getType()); - Integer newValue = new Integer(type_); - - type_ = type; - changes_.firePropertyChange(property, oldValue, newValue); - - createNewStatement_ = true; - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, property, type); - } - - /** - * Sets the type map to be used for distinct and structured types. - * - * Note: Distinct types are supported by DB2 for IBM i, but are not externalized by the IBM Toolbox for Java JDBC driver. In other words, distinct types - * behave as if they are the underlying type. Structured types are not supported by DB2 for IBM i. Consequently, this driver does not support the type map. - * - * @param map The type map. - * @exception SQLException If a database error occurs. - **/ - public void setTypeMap(Map map) throws SQLException - { - if (map == null) - throw new NullPointerException("map"); - - if (connection_ != null) - connection_.setTypeMap(map); - typeMap_ = map; - } - - /** - * Sets the URL used for getting a connection. - * Either this property or the dataSource property must be set before a connection can be made. - * This sets setUseDataSource to false. - * @param url The URL. - * @see #setUseDataSource - **/ - public void setUrl(String url) - { - String property = "url"; - if (url == null) - throw new NullPointerException(property); - - validateConnection(); - - String old = getUrl(); - url_ = url; - changes_.firePropertyChange(property, old, url); - - useDataSource_ = false; - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, property, url); - } - - /** - * Sets whether the data source is used to make a connection to the database. - * @param useDataSource true if the data source is used; false if the URL is used. - * The default value is true. - **/ - public void setUseDataSource(boolean useDataSource) - { - String property = "useDataSource"; - validateConnection(); - - Boolean oldValue = new Boolean(isUseDataSource()); - useDataSource_ = useDataSource; - changes_.firePropertyChange(property, oldValue, new Boolean(useDataSource) ); - } - - /** - * Sets the user name used to make the connection. - * Note: This property has no effect unless the useDataSource property is set to false. - * @param username The user name. - **/ - public void setUsername(String username) - { - String property = "username"; - if (username == null) - throw new NullPointerException(property); - validateConnection(); - - String old = getUsername(); - - username_ = username; - changes_.firePropertyChange(property, old, username); - } - - /** - * Returns the name of the SQL cursor in use by the result set. - * - * @return The cursor name. - **/ - public String toString () - { - if (resultSet_ != null) - return resultSet_.toString(); - else - return ""; - } - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using an Array value. - DB2 for IBM i does not support arrays. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - @since Modification 5 - **/ - public void updateArray (int columnIndex, Array columnValue) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - } - - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using an Array value. - DB2 for IBM i does not support arrays. - - @param columnName The column name. - @param columnValue The column value or null if the value is SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support arrays. - **/ - public void updateArray (String columnName, Array columnValue) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - } - - - /** - * Updates a column in the current row using an ASCII stream value. - * The driver reads the data from the stream as needed until no more - * bytes are available. The driver converts this to an SQL VARCHAR - * value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update the value to SQL NULL. - * @param length The length. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, the - * requested conversion is not valid, - * the length is not - * valid, the input stream does not contain - * ASCII characters, or an error happens - * while reading the input stream. - **/ - public void updateAsciiStream (int columnIndex, InputStream columnValue, int length) throws SQLException - { - validateResultSet(); - resultSet_.updateAsciiStream(columnIndex, columnValue, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using an ASCII stream value. - * The driver reads the data from the stream as needed until no more - * bytes are available. The driver converts this to an SQL VARCHAR value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update the value to SQL NULL. - * @param length The length. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, the - * requested conversion is not valid, - * the length is not valid, - * the input stream does not contain - * ASCII characters, or an error happens - * while reading the input stream. - **/ - public void updateAsciiStream (String columnName, - InputStream columnValue, - int length) - throws SQLException - { - validateResultSet(); - resultSet_.updateAsciiStream(columnName, columnValue, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a BigDecimal value. The - * driver converts this to an SQL NUMERIC value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateBigDecimal (int columnIndex, BigDecimal columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateBigDecimal(columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a BigDecimal value. The - * driver converts this to an SQL NUMERIC value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateBigDecimal (String columnName, BigDecimal columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateBigDecimal (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a binary stream value. - * The driver reads the data from the stream as needed until no more - * bytes are available. The driver converts this to an SQL VARBINARY value. - * - *

        This does not update the database directly. Instead, it updates a copy - * of the data in memory. Call updateRow() or insertRow() to update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update the value to SQL NULL. - * @param length The length. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid, - * the length is not valid, or an error - * happens while reading the input stream. - **/ - public void updateBinaryStream (int columnIndex, InputStream columnValue, int length) throws SQLException - { - validateResultSet(); - resultSet_.updateBinaryStream(columnIndex, columnValue, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a binary stream value. - * The driver reads the data from the stream as needed until no more - * bytes are available. The driver converts this to an SQL - * VARBINARY value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update - * the value to SQL NULL. - * @param length The length. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid, - * the length is not valid, or an error - * happens while reading the input stream. - **/ - public void updateBinaryStream (String columnName, - InputStream columnValue, - int length) - throws SQLException - { - validateResultSet(); - resultSet_.updateBinaryStream (columnName, columnValue, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using a Java Blob value. - The driver converts this to an SQL BLOB value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - @since Modification 5 - **/ - public void updateBlob (int columnIndex, Blob columnValue) - throws SQLException - { - validateResultSet(); - resultSet_.updateBlob(columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using a Java Blob value. - The driver converts this to an SQL BLOB value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateBlob (String columnName, Blob columnValue) - throws SQLException - { - validateResultSet(); - resultSet_.updateBlob(columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - /** - * Updates a column in the current row using a Java boolean value. - * The driver converts this to an SQL SMALLINT value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateBoolean (int columnIndex, boolean columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateBoolean(columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java boolean value. - * The driver converts this to an SQL SMALLINT value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateBoolean (String columnName, boolean columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateBoolean (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java byte value. - * The driver converts this to an SQL SMALLINT value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateByte (int columnIndex, byte columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateByte (columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java byte value. - * The driver converts this to an SQL SMALLINT value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateByte (String columnName, byte columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateByte (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - /** - * Updates a column in the current row using a Java byte array value. - * The driver converts this to an SQL VARBINARY value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateBytes (int columnIndex, byte[] columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateBytes (columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java byte array value. - * The driver converts this to an SQL VARBINARY value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateBytes (String columnName, byte[] columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateBytes (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Reader value. - * The driver reads the data from the Reader as needed until no more - * characters are available. The driver converts this to an SQL VARCHAR value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update - * the value to SQL NULL. - * @param length The length. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid, - * the length is not valid, or an error - * happens while reading the input stream. - **/ - public void updateCharacterStream (int columnIndex, - Reader columnValue, - int length) - throws SQLException - { - validateResultSet(); - resultSet_.updateCharacterStream (columnIndex, columnValue, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Reader value. - * The driver reads the data from the Reader as needed until no more - * characters are available. The driver converts this to an SQL VARCHAR - * value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update - * the value to SQL NULL. - * @param length The length. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid, - * the length is not valid, or an error - * happens while reading the input stream. - **/ - public void updateCharacterStream (String columnName, - Reader columnValue, - int length) - throws SQLException - { - validateResultSet(); - resultSet_.updateCharacterStream (columnName, columnValue, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using a Java Clob value. - The driver converts this to an SQL CLOB value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnIndex The column index (1-based). - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - @since Modification 5 - **/ - public void updateClob (int columnIndex, Clob columnValue) - throws SQLException - { - validateResultSet(); - resultSet_.updateClob (columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using a Java Clob value. - The driver converts this to an SQL CLOB value. - -

        This does not update the database directly. Instead, it updates - a copy of the data in memory. Call updateRow() or insertRow() to - update the database. - - @param columnName The column name. - @param columnValue The column value. - - @exception SQLException If the result set is not open, - the result set is not updatable, - the cursor is not positioned on a row, - the column index is not valid, or the - requested conversion is not valid. - **/ - public void updateClob (String columnName, Clob columnValue) - throws SQLException - { - validateResultSet(); - resultSet_.updateClob (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - /** - * Updates a column in the current row using a java.sql.Date value. - * The driver converts this to an SQL DATE value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateDate (int columnIndex, Date columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateDate (columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a java.sql.Date value. - * The driver converts this to an SQL DATE value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateDate (String columnName, Date columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateDate (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java double value. - * The driver converts this to an SQL DOUBLE value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateDouble (int columnIndex, double columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateDouble (columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java double value. - * The driver converts this to an SQL DOUBLE value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateDouble (String columnName, double columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateDouble (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java float value. - * The driver converts this to an SQL REAL value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateFloat (int columnIndex, float columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateFloat (columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java float value. - * The driver converts this to an SQL REAL value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateFloat (String columnName, float columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateFloat (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - /** - * Updates a column in the current row using a Java int value. - * The driver converts this to an SQL INTEGER value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateInt (int columnIndex, int columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateInt (columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java int value. - * The driver converts this to an SQL INTEGER value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateInt (String columnName, int columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateInt (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java long value. - * If the connected system supports SQL BIGINT data, the driver - * converts this to an SQL BIGINT value. Otherwise, the driver - * converts this to an SQL INTEGER value. SQL BIGINT data is - * supported on V4R5 and later. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateLong (int columnIndex, long columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateLong (columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java long value. - * If the connected system supports SQL BIGINT data, the driver - * converts this to an SQL BIGINT value. Otherwise, the driver - * converts this to an SQL INTEGER value. SQL BIGINT data is - * supported on V4R5 and later. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateLong (String columnName, long columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateLong (columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - /** - * Updates a column in the current row using SQL NULL. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateNull (int columnIndex) throws SQLException - { - validateResultSet(); - resultSet_.updateNull (columnIndex); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using SQL NULL. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateNull (String columnName) throws SQLException - { - validateResultSet(); - resultSet_.updateNull (columnName); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using an Object value. - * The driver converts this to a value of an SQL type, depending on - * the type of the specified value. The JDBC specification defines - * a standard mapping from Java types to SQL types. In the cases - * where an SQL type is not supported by DB2 for IBM i, the - * next closest matching type - * is used. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, - * or the requested conversion is not valid. - **/ - public void updateObject (int columnIndex, Object columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateObject(columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - /** - * Updates a column in the current row using an Object value. - * The driver converts this to a value of an SQL type, depending on - * the type of the specified value. The JDBC specification defines - * a standard mapping from Java types to SQL types. In the cases - * where an SQL type is not supported by DB2 for IBM i, the - * next closest matching type - * is used. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, - * or the requested conversion is not valid. - **/ - public void updateObject (String columnName, Object columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateObject(columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using an Object value. - * The driver converts this to a value of an SQL type, depending on - * the type of the specified value. The JDBC specification defines - * a standard mapping from Java types to SQL types. In the cases - * where an SQL type is not supported by DB2 for IBM i, the - * next closest matching type - * is used. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update - * the value to SQL NULL. - * @param scale The number of digits after the decimal - * if SQL type is DECIMAL or NUMERIC. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, - * the scale is not valid, or the - * requested conversion is not valid. - **/ - public void updateObject (int columnIndex, Object columnValue, int scale) throws SQLException - { - validateResultSet(); - resultSet_.updateObject(columnIndex, columnValue, scale); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using an Object value. - * The driver converts this to a value of an SQL type, depending on - * the type of the specified value. The JDBC specification defines - * a standard mapping from Java types to SQL types. In the cases - * where an SQL type is not supported by DB2 for IBM i, the - * next closest matching type - * is used. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update - * the value to SQL NULL. - * @param scale The number of digits after the decimal - * if SQL type is DECIMAL or NUMERIC. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, - * the scale is not valid, or the - * requested conversion is not valid. - **/ - public void updateObject (String columnName, Object columnValue, int scale) throws SQLException - { - validateResultSet(); - resultSet_.updateObject(columnName, columnValue, scale); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - /** - * Updates the database with the new contents of the current row. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the cursor is positioned on the insert row, - * or an error occurs. - **/ - public void updateRow () throws SQLException - { - validateResultSet(); - resultSet_.updateRow(); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using an Ref value. - DB2 for IBM i does not support structured types. - - @param columnIndex The column index (1-based). - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support REFs. - @since Modification 5 - **/ - public void updateRef (int columnIndex, Ref columnValue) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - } - - - - //@G4A JDBC 3.0 - /** - Updates a column in the current row using an Ref value. - DB2 for IBM i does not support structured types. - - @param columnName The column name. - @param columnValue The column value or null to update - the value to SQL NULL. - - @exception SQLException Always thrown because DB2 for IBM i does not support REFs. - **/ - public void updateRef (String columnName, Ref columnValue) - throws SQLException - { - JDError.throwSQLException (JDError.EXC_DATA_TYPE_MISMATCH); - } - - - - /** - * Updates a column in the current row using a Java short value. - * The driver converts this to an SQL SMALLINT value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateShort (int columnIndex, short columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateShort(columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a Java short value. - * The driver converts this to an SQL SMALLINT value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateShort (String columnName, short columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateShort(columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a String value. - * The driver converts this to an SQL VARCHAR value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, - * or the requested conversion is not valid. - **/ - public void updateString (int columnIndex, String columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateString(columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a String value. - * The driver converts this to an SQL VARCHAR value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateString (String columnName, String columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateString(columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a java.sql.Time value. - * The driver converts this to an SQL TIME value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateTime (int columnIndex, Time columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateTime(columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a java.sql.Time value. - * The driver converts this to an SQL TIME value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateTime (String columnName, Time columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateTime(columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - /** - * Updates a column in the current row using a java.sql.Timestamp value. - * The driver converts this to an SQL TIMESTAMP value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnIndex The column index (1-based). - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column index is not valid, or the - * requested conversion is not valid. - **/ - public void updateTimestamp (int columnIndex, Timestamp columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateTimestamp(columnIndex, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Updates a column in the current row using a java.sql.Timestamp value. - * The driver converts this to an SQL TIMESTAMP value. - * - *

        This does not update the database directly. Instead, it updates - * a copy of the data in memory. Call updateRow() or insertRow() to - * update the database. - * - * @param columnName The column name. - * @param columnValue The column value or null to update - * the value to SQL NULL. - * - * @exception SQLException If the result set is not open, - * the result set is not updatable, - * the cursor is not positioned on a row, - * the column name is not found, or the - * requested conversion is not valid. - **/ - public void updateTimestamp (String columnName, Timestamp columnValue) throws SQLException - { - validateResultSet(); - resultSet_.updateTimestamp(columnName, columnValue); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - /** - * Validates if the connection has been made. - **/ - private void validateConnection() - { - if (connection_ != null) - throw new ExtendedIllegalStateException("connection", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - /** - * Validates if the resultSet has been created. - **/ - private void validateResultSet() - { - if (resultSet_ == null) - throw new ExtendedIllegalStateException("resultSet", ExtendedIllegalStateException.OBJECT_MUST_BE_OPEN); - } - - /** - * Validates the statement has been created. - * @exception SQLException If a database error occurs. - **/ - private void validateStatement() throws SQLException - { - if (statement_ == null) - createStatement(); - } - - /** - * Indicates if the last column read has the value of SQL NULL. - * - * @return true if the value is SQL NULL; false otherwise. - * @exception SQLException If the result set is not open. - **/ - public boolean wasNull () throws SQLException - { - validateResultSet(); - return resultSet_.wasNull(); - } - - //@pda jdbc40 - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * @param parameterIndex of the first parameter is 1, the second is 2, ... - * @param value the parameter value - * @param length the number of characters in the parameter data. - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur ; or if a database access error occurs - */ - public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException - { - validateStatement(); - statement_.setNCharacterStream(parameterIndex, value, length); - } - - //@pda jdbc40 - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * @param parameterName the name of the column to be set - * @param value the parameter value - * @param length the number of characters in the parameter data. - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - */ - public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException - { - validateStatement(); - statement_.setNCharacterStream(statement_.findParameterIndex(parameterName), value, length); - } - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Sets the designated parameter to a java.sql.NClob object. The driver converts this to a - // JDBC40DOC * SQL NCLOB value when it sends it to the database. - // JDBC40DOC * @param parameterIndex of the first parameter is 1, the second is 2, ... - // JDBC40DOC * @param value the parameter value - // JDBC40DOC * @throws SQLException if the driver does not support national - // JDBC40DOC * character sets; if the driver can detect that a data conversion - // JDBC40DOC * error could occur ; or if a database access error occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public void setNClob(int parameterIndex, NClob value) throws SQLException - { - validateStatement(); - statement_.setNClob(parameterIndex, value); - } - endif */ - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Sets the designated parameter to a java.sql.NClob object. The object - // JDBC40DOC * implements the java.sql.NClob interface. This NClob - // JDBC40DOC * object maps to a SQL NCLOB. - // JDBC40DOC * @param parameterName the name of the column to be set - // JDBC40DOC * @param value the parameter value - // JDBC40DOC * @throws SQLException if the driver does not support national - // JDBC40DOC * character sets; if the driver can detect that a data conversion - // JDBC40DOC * error could occur; or if a database access error occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public void setNClob(String parameterName, NClob value) throws SQLException - { - validateStatement(); - statement_.setNClob(statement_.findParameterIndex(parameterName), value); - } - endif */ - - //@pda jdbc40 - /** - * Sets the designated parameter to the given String object. - * The driver converts this to a SQL NCHAR or - * NVARCHAR or LONGNVARCHAR value - * (depending on the argument's - * size relative to the driver's limits on NVARCHAR values) - * when it sends it to the database. - * - * @param parameterIndex of the first parameter is 1, the second is 2, ... - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur ; or if a database access error occurs - */ - public void setNString(int parameterIndex, String value) throws SQLException - { - validateStatement(); - statement_.setNString(parameterIndex, value); - } - - //@pda jdbc40 - /** - * Sets the designated parameter to the given String object. - * The driver converts this to a SQL NCHAR or - * NVARCHAR or LONGNVARCHAR - * @param parameterName the name of the column to be set - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; or if a database access error occurs - */ - public void setNString(String parameterName, String value) throws SQLException - { - validateStatement(); - statement_.setNString(statement_.findParameterIndex(parameterName), value); - } - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Sets the designated parameter to the given java.sql.RowId object. The - // JDBC40DOC * driver converts this to a SQL ROWID value when it sends it - // JDBC40DOC * to the database - // JDBC40DOC * - // JDBC40DOC * @param parameterIndex the first parameter is 1, the second is 2, ... - // JDBC40DOC * @param x the parameter value - // JDBC40DOC * @throws SQLException if a database access error occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public void setRowId(int parameterIndex, RowId x) throws SQLException - { - validateStatement(); - statement_.setRowId(parameterIndex, x); - } - endif */ - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Sets the designated parameter to the given java.sql.RowId object. The - // JDBC40DOC * driver converts this to a SQL ROWID when it sends it to the - // JDBC40DOC * database. - // JDBC40DOC * - // JDBC40DOC * @param parameterName the name of the parameter - // JDBC40DOC * @param x the parameter value - // JDBC40DOC * @throws SQLException if a database access error occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public void setRowId(String parameterName, RowId x) throws SQLException - { - validateStatement(); - statement_.setRowId(statement_.findParameterIndex(parameterName), x); - } - endif */ - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Sets the designated parameter to the given java.sql.SQLXML object. The driver converts this to an - // JDBC40DOC * SQL XML value when it sends it to the database. - // JDBC40DOC * @param parameterIndex index of the first parameter is 1, the second is 2, ... - // JDBC40DOC * @param xmlObject a SQLXML object that maps an SQL XML value - // JDBC40DOC * @throws SQLException if a database access error occurs, this method - // JDBC40DOC * is called on a closed result set, - // JDBC40DOC * Writer or OutputStream has not been closed - // JDBC40DOC * for the SQLXML object or - // JDBC40DOC * if there is an error processing the XML value. The getCause method - // JDBC40DOC * of the exception may provide a more detailed exception, for example, if the - // JDBC40DOC * stream does not contain valid XML. - // JDBC40DOC */ - /* ifdef JDBC40 - public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException - { - validateStatement(); - statement_.setSQLXML(parameterIndex, xmlObject); - } - endif */ - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Sets the designated parameter to the given java.sql.SQLXML object. The driver converts this to an - // JDBC40DOC * SQL XML value when it sends it to the database. - // JDBC40DOC * @param parameterName the name of the parameter - // JDBC40DOC * @param xmlObject a SQLXML object that maps an SQL XML value - // JDBC40DOC * @throws SQLException if a database access error occurs, this method - // JDBC40DOC * is called on a closed result set, - // JDBC40DOC * Writer or OutputStream has not been closed - // JDBC40DOC * for the SQLXML object or - // JDBC40DOC * if there is an error processing the XML value. The getCause method - // JDBC40DOC * of the exception may provide a more detailed exception, for example, if the - // JDBC40DOC * stream does not contain valid XML. - // JDBC40DOC */ - /* ifdef JDBC40 - public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException - { - validateStatement(); - statement_.setSQLXML(statement_.findParameterIndex(parameterName), xmlObject); - } - endif */ - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Retrieves the holdability of this RowSet object - // JDBC40DOC * @return either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT - // JDBC40DOC * The holdability is derived in this order of precedence: - // JDBC40DOC

          - // JDBC40DOC
        • 1. The holdability, if any, that was specified on statement creation using - // JDBC40DOC the methods createStatement(), prepareCall(), or prepareStatement() on the - // JDBC40DOC Connection object. - // JDBC40DOC
        • 2. The holdability specified using the method setHoldability(int) - // JDBC40DOC if this method was called on the Connection object. - // JDBC40DOC
        • 3. If neither of above methods were called, the value of the - // JDBC40DOC cursor hold - // JDBC40DOC driver property.
        - // JDBC40DOC Full functionality of #1 and #2 requires OS/400 v5r2 - // JDBC40DOC or IBM i. If connecting to OS/400 V5R1 or earlier, - // JDBC40DOC the value specified on these two methods will be ignored and the default holdability - // JDBC40DOC will be the value of #3. - // JDBC40DOC * @throws SQLException if a database error occurs - // JDBC40DOC */ - /* ifdef JDBC40 - public int getHoldability() throws SQLException - { - return resultSet_.getHoldability(); - } - endif */ - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @param columnIndex the first column is 1, the second is 2, ... - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public Reader getNCharacterStream(int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getNCharacterStream(columnIndex); - } - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public Reader getNCharacterStream(String columnLabel) throws SQLException - { - validateResultSet(); - return resultSet_.getNCharacterStream(columnLabel); - } - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Retrieves the value of the designated column in the current row - // JDBC40DOC * of this ResultSet object as a NClob object - // JDBC40DOC * in the Java programming language. - // JDBC40DOC * - // JDBC40DOC * @param columnIndex the first column is 1, the second is 2, ... - // JDBC40DOC * @return a NClob object representing the SQL - // JDBC40DOC * NCLOB value in the specified column - // JDBC40DOC * @exception SQLException if the driver does not support national - // JDBC40DOC * character sets; if the driver can detect that a data conversion - // JDBC40DOC * error could occur; this method is called on a closed result set - // JDBC40DOC * or if a database access error occurs - // JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - // JDBC40DOC * this method - // JDBC40DOC */ - /* ifdef JDBC40 - public NClob getNClob(int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getNClob(columnIndex); - } - endif */ - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Retrieves the value of the designated column in the current row - // JDBC40DOC * of this ResultSet object as a NClob object - // JDBC40DOC * in the Java programming language. - // JDBC40DOC * - // JDBC40DOC * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - // JDBC40DOC * @return a NClob object representing the SQL NCLOB - // JDBC40DOC * value in the specified column - // JDBC40DOC * @exception SQLException if the driver does not support national - // JDBC40DOC * character sets; if the driver can detect that a data conversion - // JDBC40DOC * error could occur; this method is called on a closed result set - // JDBC40DOC * or if a database access error occurs - // JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - // JDBC40DOC * this method - // JDBC40DOC */ - /* ifdef JDBC40 - public NClob getNClob(String columnLabel) throws SQLException - { - validateResultSet(); - return resultSet_.getNClob(columnLabel); - } - endif */ - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public String getNString(int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getNString(columnIndex); - } - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public String getNString(String columnLabel) throws SQLException - { - validateResultSet(); - return resultSet_.getNString(columnLabel); - } - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Retrieves the value of the designated column in the current row of this - // JDBC40DOC * ResultSet object as a java.sql.RowId object in the Java - // JDBC40DOC * programming language. - // JDBC40DOC * - // JDBC40DOC * @param columnIndex the first column is 1, the second 2, ... - // JDBC40DOC * @return the column value; if the value is a SQL NULL the - // JDBC40DOC * value returned is null - // JDBC40DOC * @throws SQLException if a database access error occurs - // JDBC40DOC * or this method is called on a closed result set - // JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - // JDBC40DOC * this method - // JDBC40DOC */ - /* ifdef JDBC40 - public RowId getRowId(int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getRowId(columnIndex); - } - endif */ - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Retrieves the value of the designated column in the current row of this - // JDBC40DOC * ResultSet object as a java.sql.RowId object in the Java - // JDBC40DOC * programming language. - // JDBC40DOC * - // JDBC40DOC * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - // JDBC40DOC * @return the column value ; if the value is a SQL NULL the - // JDBC40DOC * value returned is null - // JDBC40DOC * @throws SQLException if a database access error occurs - // JDBC40DOC * or this method is called on a closed result set - // JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - // JDBC40DOC * this method - // JDBC40DOC */ - /* ifdef JDBC40 - public RowId getRowId(String columnLabel) throws SQLException - { - validateResultSet(); - return resultSet_.getRowId(columnLabel); - } - endif */ - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Retrieves the value of the designated column in the current row of - // JDBC40DOC * this ResultSet as a - // JDBC40DOC * java.sql.SQLXML object in the Java programming language. - // JDBC40DOC * @param columnIndex the first column is 1, the second is 2, ... - // JDBC40DOC * @return a SQLXML object that maps an SQL XML value - // JDBC40DOC * @throws SQLException if a database access error occurs - // JDBC40DOC * or this method is called on a closed result set - // JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - // JDBC40DOC * this method - // JDBC40DOC */ - /* ifdef JDBC40 - public SQLXML getSQLXML(int columnIndex) throws SQLException - { - validateResultSet(); - return resultSet_.getSQLXML(columnIndex); - } - endif */ - - //@pda jdbc40 - - // JDBC40DOC /** - // JDBC40DOC * Retrieves the value of the designated column in the current row of - // JDBC40DOC * this ResultSet as a - // JDBC40DOC * java.sql.SQLXML object in the Java programming language. - // JDBC40DOC * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - // JDBC40DOC * @return a SQLXML object that maps an SQL XML value - // JDBC40DOC * @throws SQLException if a database access error occurs - // JDBC40DOC * or this method is called on a closed result set - // JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - // JDBC40DOC * this method - // JDBC40DOC */ - /* ifdef JDBC40 - public SQLXML getSQLXML(String columnLabel) throws SQLException - { - validateResultSet(); - return resultSet_.getSQLXML(columnLabel); - } - endif */ - - //@pda jdbc40 - /** - * Retrieves whether this ResultSet object has been closed. A ResultSet is closed if the - * method close has been called on it, or if it is automatically closed. - * - * @return true if this ResultSet object is closed; false if it is still open - * @throws SQLException if a database access error occurs - */ - public boolean isClosed() throws SQLException - { - return resultSet_.isClosed(); - } - - //@pda jdbc40 - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateAsciiStream (columnIndex, x, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes.. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateAsciiStream (columnLabel, x, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a binary stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateBinaryStream(columnIndex, x, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a binary stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateBinaryStream(columnLabel, x, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column using the given input stream, which - * will have the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateBlob (columnIndex, inputStream, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column using the given input stream, which - * will have the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateBlob(columnLabel, inputStream, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateCharacterStream(columnIndex, x, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateCharacterStream(columnLabel, reader, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateClob(int columnIndex, Reader reader, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateClob(columnIndex, reader, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateClob(String columnLabel, Reader reader, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateClob(columnLabel, reader, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateNCharacterStream(columnIndex, x, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateNCharacterStream(columnLabel, reader, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Updates the designated column with a java.sql.NClob value. - // JDBC40DOC * The updater methods are used to update column values in the - // JDBC40DOC * current row or the insert row. The updater methods do not - // JDBC40DOC * update the underlying database; instead the updateRow or - // JDBC40DOC * insertRow methods are called to update the database. - // JDBC40DOC * - // JDBC40DOC * @param columnIndex the first column is 1, the second 2, ... - // JDBC40DOC * @param nClob the value for the column to be updated - // JDBC40DOC * @throws SQLException if the driver does not support national - // JDBC40DOC * character sets; if the driver can detect that a data conversion - // JDBC40DOC * error could occur; this method is called on a closed result set, - // JDBC40DOC * if a database access error occurs or - // JDBC40DOC * the result set concurrency is CONCUR_READ_ONLY - // JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - // JDBC40DOC * this method - // JDBC40DOC */ - /* ifdef JDBC40 - public void updateNClob(int columnIndex, NClob nClob) throws SQLException - { - validateResultSet(); - resultSet_.updateNClob(columnIndex, nClob); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - endif */ - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Updates the designated column with a java.sql.NClob value. - // JDBC40DOC * The updater methods are used to update column values in the - // JDBC40DOC * current row or the insert row. The updater methods do not - // JDBC40DOC * update the underlying database; instead the updateRow or - // JDBC40DOC * insertRow methods are called to update the database. - // JDBC40DOC * - // JDBC40DOC * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - // JDBC40DOC * @param nClob the value for the column to be updated - // JDBC40DOC * @throws SQLException if the driver does not support national - // JDBC40DOC * character sets; if the driver can detect that a data conversion - // JDBC40DOC * error could occur; this method is called on a closed result set; - // JDBC40DOC * if a database access error occurs or - // JDBC40DOC * the result set concurrency is CONCUR_READ_ONLY - // JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - // JDBC40DOC * this method - // JDBC40DOC */ - /* ifdef JDBC40 - public void updateNClob(String columnLabel, NClob nClob) throws SQLException - { - validateResultSet(); - resultSet_.updateNClob(columnLabel, nClob); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - endif */ - - - //@pda jdbc40 - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateNClob(columnIndex, reader, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - - //@pda jdbc40 - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set; - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException - { - validateResultSet(); - resultSet_.updateNClob(columnLabel, reader, length); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a String value. - * It is intended for use when updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second 2, ... - * @param nString the value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * the result set concurrency is CONCUR_READ_ONLY - * or if a database access error occurs - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNString(int columnIndex, String nString) throws SQLException - { - validateResultSet(); - resultSet_.updateNString (columnIndex, nString); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - /** - * Updates the designated column with a String value. - * It is intended for use when updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param nString the value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set; - * the result set concurrency is CONCUR_READ_ONLY - * or if a database access error occurs - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNString(String columnLabel, String nString) throws SQLException - { - validateResultSet(); - resultSet_.updateNString (columnLabel, nString); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Updates the designated column with a RowId value. The updater - // JDBC40DOC * methods are used to update column values in the current row or the insert - // JDBC40DOC * row. The updater methods do not update the underlying database; instead - // JDBC40DOC * the updateRow or insertRow methods are called - // JDBC40DOC * to update the database. - // JDBC40DOC * - // JDBC40DOC * @param columnIndex the first column is 1, the second 2, ... - // JDBC40DOC * @param x the column value - // JDBC40DOC * @exception SQLException if a database access error occurs, - // JDBC40DOC * the result set concurrency is CONCUR_READ_ONLY - // JDBC40DOC * or this method is called on a closed result set - // JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - // JDBC40DOC * this method - // JDBC40DOC */ - /* ifdef JDBC40 - public void updateRowId(int columnIndex, RowId x) throws SQLException - { - validateResultSet(); - resultSet_.updateRowId(columnIndex, x); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - endif */ - - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Updates the designated column with a RowId value. The updater - // JDBC40DOC * methods are used to update column values in the current row or the insert - // JDBC40DOC * row. The updater methods do not update the underlying database; instead - // JDBC40DOC * the updateRow or insertRow methods are called - // JDBC40DOC * to update the database. - // JDBC40DOC * - // JDBC40DOC * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - // JDBC40DOC * @param x the column value - // JDBC40DOC * @exception SQLException if a database access error occurs, - // JDBC40DOC * the result set concurrency is CONCUR_READ_ONLY - // JDBC40DOC * or this method is called on a closed result set - // JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - // JDBC40DOC * this method - // JDBC40DOC */ - /* ifdef JDBC40 - public void updateRowId(String columnLabel, RowId x) throws SQLException - { - validateResultSet(); - resultSet_.updateRowId(columnLabel, x); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - endif */ - - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Updates the designated column with a java.sql.SQLXML value. - // JDBC40DOC * The updater - // JDBC40DOC * methods are used to update column values in the current row or the insert - // JDBC40DOC * row. The updater methods do not update the underlying database; instead - // JDBC40DOC * the updateRow or insertRow methods are called - // JDBC40DOC * to update the database. - // JDBC40DOC *

        - // JDBC40DOC * - // JDBC40DOC * @param columnIndex the first column is 1, the second 2, ... - // JDBC40DOC * @param xmlObject the value for the column to be updated - // JDBC40DOC * @throws SQLException if a database access error occurs, this method - // JDBC40DOC * is called on a closed result set, - // JDBC40DOC * the java.xml.transform.Result, - // JDBC40DOC * Writer or OutputStream has not been closed - // JDBC40DOC * for the SQLXML object, - // JDBC40DOC * if there is an error processing the XML value or - // JDBC40DOC * the result set concurrency is CONCUR_READ_ONLY. The getCause method - // JDBC40DOC * of the exception may provide a more detailed exception, for example, if the - // JDBC40DOC * stream does not contain valid XML. - // JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - // JDBC40DOC * this method - // JDBC40DOC */ - /* ifdef JDBC40 - public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException - { - validateResultSet(); - resultSet_.updateSQLXML(columnIndex, xmlObject); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - endif */ - - - //@pda jdbc40 - // JDBC40DOC /** - // JDBC40DOC * Updates the designated column with a java.sql.SQLXML value. - // JDBC40DOC * The updater - // JDBC40DOC * methods are used to update column values in the current row or the insert - // JDBC40DOC * row. The updater methods do not update the underlying database; instead - // JDBC40DOC * the updateRow or insertRow methods are called - // JDBC40DOC * to update the database. - // JDBC40DOC *

        - // JDBC40DOC * - // JDBC40DOC * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - // JDBC40DOC * @param xmlObject the column value - // JDBC40DOC * @throws SQLException if a database access error occurs, this method - // JDBC40DOC * is called on a closed result set, - // JDBC40DOC * the java.xml.transform.Result, - // JDBC40DOC * Writer or OutputStream has not been closed - // JDBC40DOC * for the SQLXML object, - // JDBC40DOC * if there is an error processing the XML value or - // JDBC40DOC * the result set concurrency is CONCUR_READ_ONLY. The getCause method - // JDBC40DOC * of the exception may provide a more detailed exception, for example, if the - // JDBC40DOC * stream does not contain valid XML. - // JDBC40DOC * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - // JDBC40DOC * this method - // JDBC40DOC */ - /* ifdef JDBC40 - public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException - { - validateResultSet(); - resultSet_.updateSQLXML(columnLabel, xmlObject); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - endif */ - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCRowSet", "javax.sql.RowSet" }; - } - - - //@PDA jdbc40 - /** - * Sets the designated parameter in this RowSet object's command - * to the given input stream. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setAsciiStream which takes a length parameter. - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the Java input stream that contains the ASCII parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException - { - validateStatement(); - statement_.setAsciiStream(parameterIndex, x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterName the name of the parameter - * @param x the Java input stream that contains the ASCII parameter value - * @param length the number of bytes in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException - { - validateStatement(); - statement_.setAsciiStream(statement_.findParameterIndex(parameterName), x, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setAsciiStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param x the Java input stream that contains the ASCII parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setAsciiStream(String parameterName, InputStream x) throws SQLException - { - validateStatement(); - statement_.setAsciiStream(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given - * java.math.BigDecimal value. - * The driver converts this to an SQL NUMERIC value when - * it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getBigDecimal - */ - public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException - { - validateStatement(); - statement_.setBigDecimal(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter in this RowSet object's command - * to the given input stream. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the - * stream as needed until end-of-file is reached. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setBinaryStream which takes a length parameter. - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the java input stream which contains the binary parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException - { - validateStatement(); - statement_.setBinaryStream(parameterIndex, x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the stream - * as needed until end-of-file is reached. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterName the name of the parameter - * @param x the java input stream which contains the binary parameter value - * @param length the number of bytes in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException - { - validateStatement(); - statement_.setBinaryStream(statement_.findParameterIndex(parameterName), x, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given input stream. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the - * stream as needed until end-of-file is reached. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setBinaryStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param x the java input stream which contains the binary parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setBinaryStream(String parameterName, InputStream x) throws SQLException - { - validateStatement(); - statement_.setBinaryStream(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a InputStream object. The inputstream must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the PreparedStatement is executed. - * This method differs from the setBinaryStream (int, InputStream, int) - * method because it informs the driver that the parameter value should be - * sent to the server as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARBINARY or a BLOB - * @param parameterIndex index of the first parameter is 1, - * the second is 2, ... - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @throws SQLException if a database access error occurs, - * this method is called on a closed PreparedStatement, - * if parameterIndex does not correspond - * to a parameter marker in the SQL statement, if the length specified - * is less than zero or if the number of bytes in the inputstream does not match - * the specfied length. - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - */ - public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException - { - validateStatement(); - statement_.setBlob(parameterIndex, inputStream, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a InputStream object. - * This method differs from the setBinaryStream (int, InputStream) - * method because it informs the driver that the parameter value should be - * sent to the server as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARBINARY or a BLOB - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setBlob which takes a length parameter. - * - * @param parameterIndex index of the first parameter is 1, - * the second is 2, ... - * @param inputStream An object that contains the data to set the parameter - * value to. - * @throws SQLException if a database access error occurs, - * this method is called on a closed PreparedStatement or - * if parameterIndex does not correspond - * to a parameter marker in the SQL statement, - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - */ - public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException - { - validateStatement(); - statement_.setBlob(parameterIndex, inputStream); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Blob object. - * The driver converts this to an SQL BLOB value when it - * sends it to the database. - * - * @param parameterName the name of the parameter - * @param x a Blob object that maps an SQL BLOB value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setBlob(String parameterName, Blob x) throws SQLException - { - validateStatement(); - statement_.setBlob(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a InputStream object. The inputstream must contain the number - * of characters specified by length, otherwise a SQLException will be - * generated when the CallableStatement is executed. - * This method differs from the setBinaryStream (int, InputStream, int) - * method because it informs the driver that the parameter value should be - * sent to the server as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARBINARY or a BLOB - * - * @param parameterName the name of the parameter to be set - * the second is 2, ... - * - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @throws SQLException if parameterIndex does not correspond - * to a parameter marker in the SQL statement, or if the length specified - * is less than zero; if the number of bytes in the inputstream does not match - * the specfied length; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * - */ - public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException - { - validateStatement(); - statement_.setBlob(statement_.findParameterIndex(parameterName), inputStream, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a InputStream object. - * This method differs from the setBinaryStream (int, InputStream) - * method because it informs the driver that the parameter value should be - * sent to the server as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be send to the server as a LONGVARBINARY or a BLOB - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setBlob which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param inputStream An object that contains the data to set the parameter - * value to. - * @throws SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - */ - public void setBlob(String parameterName, InputStream inputStream) throws SQLException - { - validateStatement(); - statement_.setBlob(statement_.findParameterIndex(parameterName), inputStream); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java boolean value. - * The driver converts this - * to an SQL BIT or BOOLEAN value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #getBoolean - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setBoolean(String parameterName, boolean x) throws SQLException - { - validateStatement(); - statement_.setBoolean(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java byte value. - * The driver converts this - * to an SQL TINYINT value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getByte - */ - public void setByte(String parameterName, byte x) throws SQLException - { - validateStatement(); - statement_.setByte(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java array of bytes. - * The driver converts this to an SQL VARBINARY or - * LONGVARBINARY (depending on the argument's size relative - * to the driver's limits on VARBINARY values) when it sends - * it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getBytes - */ - public void setBytes(String parameterName, byte[] x) throws SQLException - { - validateStatement(); - statement_.setBytes(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter in this RowSet object's command - * to the given Reader - * object. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setCharacterStream which takes a length parameter. - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param reader the java.io.Reader object that contains the - * Unicode data - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException - { - validateStatement(); - statement_.setCharacterStream(parameterIndex, reader); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterName the name of the parameter - * @param reader the java.io.Reader object that - * contains the UNICODE data used as the designated parameter - * @param length the number of characters in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException - { - validateStatement(); - statement_.setCharacterStream(statement_.findParameterIndex(parameterName), reader, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Reader - * object. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setCharacterStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param reader the java.io.Reader object that contains the - * Unicode data - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setCharacterStream(String parameterName, Reader reader) throws SQLException - { - validateStatement(); - statement_.setCharacterStream(statement_.findParameterIndex(parameterName), reader); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the PreparedStatement is executed. - *This method differs from the setCharacterStream (int, Reader, int) method - * because it informs the driver that the parameter value should be sent to - * the server as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARCHAR or a CLOB - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if a database access error occurs, this method is called on - * a closed PreparedStatement, if parameterIndex does not correspond to a parameter - * marker in the SQL statement, or if the length specified is less than zero. - * - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this metho - */ - public void setClob(int parameterIndex, Reader reader, long length) throws SQLException - { - validateStatement(); - statement_.setClob(parameterIndex, reader, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the server as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARCHAR or a CLOB - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setClob which takes a length parameter. - * - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if a database access error occurs, this method is called on - * a closed PreparedStatementor if parameterIndex does not correspond to a parameter - * marker in the SQL statement - * - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setClob(int parameterIndex, Reader reader) throws SQLException - { - validateStatement(); - statement_.setClob(parameterIndex, reader); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Clob object. - * The driver converts this to an SQL CLOB value when it - * sends it to the database. - * - * @param parameterName the name of the parameter - * @param x a Clob object that maps an SQL CLOB value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setClob(String parameterName, Clob x) throws SQLException - { - validateStatement(); - statement_.setClob(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the CallableStatement is executed. - * This method differs from the setCharacterStream (int, Reader, int) method - * because it informs the driver that the parameter value should be sent to - * the server as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be send to the server as a LONGVARCHAR or a CLOB - * @param parameterName the name of the parameter to be set - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if the length specified is less than zero; - * a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * - */ - public void setClob(String parameterName, Reader reader, long length) throws SQLException - { - validateStatement(); - statement_.setClob(statement_.findParameterIndex(parameterName), reader, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the server as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be send to the server as a LONGVARCHAR or a CLOB - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setClob which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if a database access error occurs or this method is called on - * a closed CallableStatement - * - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setClob(String parameterName, Reader reader) throws SQLException - { - validateStatement(); - statement_.setClob(statement_.findParameterIndex(parameterName), reader); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Date value, - * using the given Calendar object. The driver uses - * the Calendar object to construct an SQL DATE value, - * which the driver then sends to the database. With a - * a Calendar object, the driver can calculate the date - * taking into account a custom timezone. If no - * Calendar object is specified, the driver uses the default - * timezone, which is that of the virtual machine running the application. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @param cal the Calendar object the driver will use - * to construct the date - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getDate - */ - public void setDate(String parameterName, Date x, Calendar cal) throws SQLException - { - validateStatement(); - statement_.setDate(statement_.findParameterIndex(parameterName), x, cal); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Date value - * using the default time zone of the virtual machine that is running - * the application. - * The driver converts this - * to an SQL DATE value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getDate - */ - public void setDate(String parameterName, Date x) throws SQLException - { - validateStatement(); - statement_.setDate(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java double value. - * The driver converts this - * to an SQL DOUBLE value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getDouble - */ - public void setDouble(String parameterName, double x) throws SQLException - { - validateStatement(); - statement_.setDouble(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java float value. - * The driver converts this - * to an SQL FLOAT value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getFloat - */ - public void setFloat(String parameterName, float x) throws SQLException - { - validateStatement(); - statement_.setFloat(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java int value. - * The driver converts this - * to an SQL INTEGER value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getInt - */ - public void setInt(String parameterName, int x) throws SQLException - { - validateStatement(); - statement_.setInt(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java long value. - * The driver converts this - * to an SQL BIGINT value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getLong - */ - public void setLong(String parameterName, long x) throws SQLException - { - validateStatement(); - statement_.setLong(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter in this RowSet object's command - * to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNCharacterStream which takes a length parameter. - * - * @param parameterIndex of the first parameter is 1, the second is 2, ... - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur ; if a database access error occurs; or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException - { - validateStatement(); - statement_.setNCharacterStream(parameterIndex, value); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - - *

        Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNCharacterStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur ; if a database access error occurs; or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setNCharacterStream(String parameterName, Reader value) throws SQLException - { - validateStatement(); - statement_.setNCharacterStream(statement_.findParameterIndex(parameterName), value); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the PreparedStatement is executed. - * This method differs from the setCharacterStream (int, Reader, int) method - * because it informs the driver that the parameter value should be sent to - * the server as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGNVARCHAR or a NCLOB - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if the length specified is less than zero; - * if the driver does not support national character sets; - * if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - */ - public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException - { - validateStatement(); - statement_.setNClob(parameterIndex, reader, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the server as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGNVARCHAR or a NCLOB - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNClob which takes a length parameter. - * - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; - * if the driver does not support national character sets; - * if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - */ - public void setNClob(int parameterIndex, Reader reader) throws SQLException - { - validateStatement(); - statement_.setNClob(parameterIndex, reader); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the CallableStatement is executed. - * This method differs from the setCharacterStream (int, Reader, int) method - * because it informs the driver that the parameter value should be sent to - * the server as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be send to the server as a LONGNVARCHAR or a NCLOB - * - * @param parameterName the name of the parameter to be set - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if the length specified is less than zero; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setNClob(String parameterName, Reader reader, long length) throws SQLException - { - validateStatement(); - statement_.setNClob(statement_.findParameterIndex(parameterName), reader, length); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the server as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be send to the server as a LONGNVARCHAR or a NCLOB - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNClob which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if the driver does not support national character sets; - * if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - */ - public void setNClob(String parameterName, Reader reader) throws SQLException - { - validateStatement(); - statement_.setNClob(statement_.findParameterIndex(parameterName), reader); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to SQL NULL. - * This version of the method setNull should - * be used for user-defined types and REF type parameters. Examples - * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and - * named array types. - * - *

        Note: To be portable, applications must give the - * SQL type code and the fully-qualified SQL type name when specifying - * a NULL user-defined or REF parameter. In the case of a user-defined type - * the name is the type name of the parameter itself. For a REF - * parameter, the name is the type name of the referenced type. If - * a JDBC driver does not need the type code or type name information, - * it may ignore it. - * - * Although it is intended for user-defined and Ref parameters, - * this method may be used to set a null parameter of any JDBC type. - * If the parameter does not have a user-defined or REF type, the given - * typeName is ignored. - * - * - * @param parameterName the name of the parameter - * @param sqlType a value from java.sql.Types - * @param typeName the fully-qualified name of an SQL user-defined type; - * ignored if the parameter is not a user-defined type or - * SQL REF value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setNull(String parameterName, int sqlType, String typeName) throws SQLException - { - validateStatement(); - statement_.setNull(statement_.findParameterIndex(parameterName), sqlType, typeName); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to SQL NULL. - * - *

        Note: You must specify the parameter's SQL type. - * - * @param parameterName the name of the parameter - * @param sqlType the SQL type code defined in java.sql.Types - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void setNull(String parameterName, int sqlType) throws SQLException - { - validateStatement(); - statement_.setNull(statement_.findParameterIndex(parameterName), sqlType); - } - - //@PDA jdbc40 - /** - * Sets the value of the designated parameter with the given object. The second - * argument must be an object type; for integral values, the - * java.lang equivalent objects should be used. - * - *

        The given Java object will be converted to the given targetSqlType - * before being sent to the database. - * - * If the object has a custom mapping (is of a class implementing the - * interface SQLData), - * the JDBC driver should call the method SQLData.writeSQL to write it - * to the SQL data stream. - * If, on the other hand, the object is of a class implementing - * Ref, Blob, Clob, NClob, - * Struct, java.net.URL, - * or Array, the driver should pass it to the database as a - * value of the corresponding SQL type. - *

        - * Note that this method may be used to pass datatabase- - * specific abstract data types. - * - * @param parameterName the name of the parameter - * @param x the object containing the input parameter value - * @param targetSqlType the SQL type (as defined in java.sql.Types) to be - * sent to the database. The scale argument may further qualify this type. - * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types, - * this is the number of digits after the decimal point. For all other - * types, this value will be ignored. - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if targetSqlType is - * a ARRAY, BLOB, CLOB, - * DATALINK, JAVA_OBJECT, NCHAR, - * NCLOB, NVARCHAR, LONGNVARCHAR, - * REF, ROWID, SQLXML - * or STRUCT data type and the JDBC driver does not support - * this data type - * @see Types - * @see #getObject - */ - public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException - { - validateStatement(); - statement_.setObject(statement_.findParameterIndex(parameterName), x, targetSqlType, scale); - } - - //@PDA jdbc40 - /** - * Sets the value of the designated parameter with the given object. - * This method is like the method setObject - * above, except that it assumes a scale of zero. - * - * @param parameterName the name of the parameter - * @param x the object containing the input parameter value - * @param targetSqlType the SQL type (as defined in java.sql.Types) to be - * sent to the database - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if targetSqlType is - * a ARRAY, BLOB, CLOB, - * DATALINK, JAVA_OBJECT, NCHAR, - * NCLOB, NVARCHAR, LONGNVARCHAR, - * REF, ROWID, SQLXML - * or STRUCT data type and the JDBC driver does not support - * this data type - * @see #getObject - */ - public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException - { - validateStatement(); - statement_.setObject(statement_.findParameterIndex(parameterName), x, targetSqlType); - } - - //@PDA jdbc40 - /** - * Sets the value of the designated parameter with the given object. - * The second parameter must be of type Object; therefore, the - * java.lang equivalent objects should be used for built-in types. - * - *

        The JDBC specification specifies a standard mapping from - * Java Object types to SQL types. The given argument - * will be converted to the corresponding SQL type before being - * sent to the database. - * - *

        Note that this method may be used to pass datatabase- - * specific abstract data types, by using a driver-specific Java - * type. - * - * If the object is of a class implementing the interface SQLData, - * the JDBC driver should call the method SQLData.writeSQL - * to write it to the SQL data stream. - * If, on the other hand, the object is of a class implementing - * Ref, Blob, Clob, NClob, - * Struct, java.net.URL, - * or Array, the driver should pass it to the database as a - * value of the corresponding SQL type. - *

        - * This method throws an exception if there is an ambiguity, for example, if the - * object is of a class implementing more than one of the interfaces named above. - * - * @param parameterName the name of the parameter - * @param x the object containing the input parameter value - * @exception SQLException if a database access error occurs, - * this method is called on a closed CallableStatement or if the given - * Object parameter is ambiguous - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getObject - */ - public void setObject(String parameterName, Object x) throws SQLException - { - validateStatement(); - statement_.setObject(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java short value. - * The driver converts this - * to an SQL SMALLINT value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getShort - */ - public void setShort(String parameterName, short x) throws SQLException - { - validateStatement(); - statement_.setShort(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given Java String value. - * The driver converts this - * to an SQL VARCHAR or LONGVARCHAR value - * (depending on the argument's - * size relative to the driver's limits on VARCHAR values) - * when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getString - */ - public void setString(String parameterName, String x) throws SQLException - { - validateStatement(); - statement_.setString(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Time value, - * using the given Calendar object. The driver uses - * the Calendar object to construct an SQL TIME value, - * which the driver then sends to the database. With a - * a Calendar object, the driver can calculate the time - * taking into account a custom timezone. If no - * Calendar object is specified, the driver uses the default - * timezone, which is that of the virtual machine running the application. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @param cal the Calendar object the driver will use - * to construct the time - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getTime - */ - public void setTime(String parameterName, Time x, Calendar cal) throws SQLException - { - validateStatement(); - statement_.setTime(statement_.findParameterIndex(parameterName), x, cal); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Time value. - * The driver converts this - * to an SQL TIME value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getTime - */ - public void setTime(String parameterName, Time x) throws SQLException - { - validateStatement(); - statement_.setTime(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Timestamp value, - * using the given Calendar object. The driver uses - * the Calendar object to construct an SQL TIMESTAMP value, - * which the driver then sends to the database. With a - * a Calendar object, the driver can calculate the timestamp - * taking into account a custom timezone. If no - * Calendar object is specified, the driver uses the default - * timezone, which is that of the virtual machine running the application. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @param cal the Calendar object the driver will use - * to construct the timestamp - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getTimestamp - */ - public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException - { - validateStatement(); - statement_.setTimestamp(statement_.findParameterIndex(parameterName), x, cal); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.sql.Timestamp value. - * The driver - * converts this to an SQL TIMESTAMP value when it sends it to the - * database. - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getTimestamp - */ - public void setTimestamp(String parameterName, Timestamp x) throws SQLException - { - validateStatement(); - statement_.setTimestamp(statement_.findParameterIndex(parameterName), x); - } - - //@PDA jdbc40 - /** - * Sets the designated parameter to the given java.net.URL value. - * The driver converts this to an SQL DATALINK value - * when it sends it to the database. - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the java.net.URL object to be set - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setURL(int parameterIndex, URL x) throws SQLException - { - validateStatement(); - statement_.setURL(parameterIndex, x); - } - - //@PDA jdbc40 - /** - * Updates the designated column with an ascii stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateAsciiStream which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException - { - validateResultSet(); - resultSet_.updateAsciiStream (columnIndex, x); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column with an ascii stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateAsciiStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if the columnLabel is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException - { - validateResultSet(); - resultSet_.updateAsciiStream (columnLabel, x); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a binary stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBinaryStream which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException - { - validateResultSet(); - resultSet_.updateBinaryStream(columnIndex, x); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a binary stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBinaryStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if the columnLabel is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException - { - validateResultSet(); - resultSet_.updateBinaryStream(columnLabel, x); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBlob which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param inputStream An object that contains the data to set the parameter - * value to. - * @exception SQLException if the columnIndex is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException - { - validateResultSet(); - resultSet_.updateBlob(columnIndex, inputStream); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBlob which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param inputStream An object that contains the data to set the parameter - * value to. - * @exception SQLException if the columnLabel is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException - { - validateResultSet(); - resultSet_.updateBlob(columnLabel, inputStream); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateCharacterStream which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateCharacterStream(int columnIndex, Reader x) throws SQLException - { - validateResultSet(); - resultSet_.updateCharacterStream(columnIndex, x); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateCharacterStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @exception SQLException if the columnLabel is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException - { - validateResultSet(); - resultSet_.updateCharacterStream (columnLabel, reader); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given Reader - * object. - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateClob which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateClob(int columnIndex, Reader reader) throws SQLException - { - validateResultSet(); - resultSet_.updateClob(columnIndex, reader); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given Reader - * object. - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateClob which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @exception SQLException if the columnLabel is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateClob(String columnLabel, Reader reader) throws SQLException - { - validateResultSet(); - resultSet_.updateClob (columnLabel, reader); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNCharacterStream which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException - { - validateResultSet(); - resultSet_.updateNCharacterStream (columnIndex, x); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNCharacterStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @exception SQLException if the columnLabel is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException - { - validateResultSet(); - resultSet_.updateNCharacterStream (columnLabel, reader); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given Reader - * - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNClob which takes a length parameter. - * - * @param columnIndex the first column is 1, the second 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if the columnIndex is not valid; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob(int columnIndex, Reader reader) throws SQLException - { - validateResultSet(); - resultSet_.updateNClob(columnIndex, reader); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - - //@PDA jdbc40 - /** - * Updates the designated column using the given Reader - * object. - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

        - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

        Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNClob which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if the columnLabel is not valid; if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set; - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void updateNClob(String columnLabel, Reader reader) throws SQLException - { - validateResultSet(); - resultSet_.updateNClob(columnLabel, reader); - - eventSupport_.fireRowChanged(new RowSetEvent(this)); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCRowSet16.gif b/cvsroot/src/com/ibm/as400/access/AS400JDBCRowSet16.gif deleted file mode 100644 index caac66a50..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400JDBCRowSet16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCRowSet32.gif b/cvsroot/src/com/ibm/as400/access/AS400JDBCRowSet32.gif deleted file mode 100644 index 8d33817c9..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400JDBCRowSet32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCRowSetBeanInfo.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCRowSetBeanInfo.java deleted file mode 100644 index 789b34e83..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCRowSetBeanInfo.java +++ /dev/null @@ -1,248 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCRowSetBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - - -/** -* The AS400JDBCRowSetBeanInfo class provides bean information for the AS400JDBCRowSet class. -**/ -public class AS400JDBCRowSetBeanInfo extends SimpleBeanInfo -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = AS400JDBCRowSet.class; - - // Handles loading the appropriate resource bundle - // private static ResourceBundleLoader loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = { changed }; - - events_ = events; - - - // ***** PROPERTIES - PropertyDescriptor command = new PropertyDescriptor("command", beanClass, - "getCommand", "setCommand"); - command.setBound(true); - command.setConstrained(false); - command.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_RS_COMMAND")); - command.setShortDescription(AS400JDBCDriver.getResource("PROP_DESC_RS_COMMAND")); - - PropertyDescriptor concurrency = new PropertyDescriptor("concurrency", beanClass, - "getConcurrency", "setConcurrency"); - concurrency.setBound(true); - concurrency.setConstrained(false); - concurrency.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_RS_CONCURRENCY")); - concurrency.setShortDescription(AS400JDBCDriver.getResource("PROP_DESC_RS_CONCURRENCY")); - - PropertyDescriptor dataSourceName = new PropertyDescriptor("dataSourceName", beanClass, - "getDataSourceName", "setDataSourceName"); - dataSourceName.setBound(true); - dataSourceName.setConstrained(false); - dataSourceName.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_DATASOURCE_NAME")); - dataSourceName.setShortDescription(AS400JDBCDriver.getResource("DATASOURCE_NAME_DESC")); - - PropertyDescriptor escapeProcessing = new PropertyDescriptor("escapeProcessing", beanClass, - "getEscapeProcessing", "setEscapeProcessing"); - escapeProcessing.setBound(true); - escapeProcessing.setConstrained(false); - escapeProcessing.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_RS_ESCAPE_PROCESSING")); - escapeProcessing.setShortDescription(AS400JDBCDriver.getResource("PROP_DESC_RS_ESCAPE_PROCESSING")); - - PropertyDescriptor fetchDirection = new PropertyDescriptor("fetchDirection", beanClass, - "getFetchDirection", "setFetchDirection"); - fetchDirection.setBound(true); - fetchDirection.setConstrained(false); - fetchDirection.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_RS_FETCH_DIRECTION")); - fetchDirection.setShortDescription(AS400JDBCDriver.getResource("PROP_DESC_RS_FETCH_DIRECTION")); - - PropertyDescriptor fetchSize = new PropertyDescriptor("fetchSize", beanClass, - "getFetchSize", "setFetchSize"); - fetchSize.setBound(true); - fetchSize.setConstrained(false); - fetchSize.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_RS_FETCH_SIZE")); - fetchSize.setShortDescription(AS400JDBCDriver.getResource("PROP_DESC_RS_FETCH_SIZE")); - - PropertyDescriptor maxFieldSize = new PropertyDescriptor("maxFieldSize", beanClass, - "getMaxFieldSize", "setMaxFieldSize"); - maxFieldSize.setBound(true); - maxFieldSize.setConstrained(false); - maxFieldSize.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_RS_MAX_FIELD_SIZE")); - maxFieldSize.setShortDescription(AS400JDBCDriver.getResource("PROP_DESC_RS_MAX_FIELD_SIZE")); - - PropertyDescriptor maxRows = new PropertyDescriptor("maxRows", beanClass, - "getMaxRows", "setMaxRows"); - maxRows.setBound(true); - maxRows.setConstrained(false); - maxRows.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_RS_MAX_ROWS")); - maxRows.setShortDescription(AS400JDBCDriver.getResource("PROP_DESC_RS_MAX_ROWS")); - - PropertyDescriptor password = new PropertyDescriptor("password", beanClass, - "getPassword", "setPassword"); - password.setBound(true); - password.setConstrained(false); - password.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_PASSWORD")); - password.setShortDescription(AS400JDBCDriver.getResource("PASSWORD_DESC")); - - PropertyDescriptor queryTimeout = new PropertyDescriptor("queryTimeout", beanClass, - "getQueryTimeout", "setQueryTimeout"); - queryTimeout.setBound(true); - queryTimeout.setConstrained(false); - queryTimeout.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_RS_QUERY_TIMEOUT")); - queryTimeout.setShortDescription(AS400JDBCDriver.getResource("PROP_DESC_RS_QUERY_TIMEOUT")); - - PropertyDescriptor readOnly = new PropertyDescriptor("readOnly", beanClass, - "isReadOnly", "setReadOnly"); - readOnly.setBound(true); - readOnly.setConstrained(false); - readOnly.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_RS_READ_ONLY")); - readOnly.setShortDescription(AS400JDBCDriver.getResource("PROP_DESC_RS_READ_ONLY")); - - PropertyDescriptor transactionIsolation = new PropertyDescriptor("transactionIsolation", beanClass, - "getTransactionIsolation", "setTransactionIsolation"); - transactionIsolation.setBound(true); - transactionIsolation.setConstrained(false); - transactionIsolation.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_TRANSACTION_ISOLATION")); - transactionIsolation.setShortDescription(AS400JDBCDriver.getResource("TRANSACTION_ISOLATION_DESC")); - - PropertyDescriptor type = new PropertyDescriptor("type", beanClass, - "getType", "setType"); - type.setBound(true); - type.setConstrained(false); - type.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_RS_TYPE")); - type.setShortDescription(AS400JDBCDriver.getResource("PROP_DESC_RS_TYPE")); - - PropertyDescriptor url = new PropertyDescriptor("url", beanClass, - "getUrl", "setUrl"); - url.setBound(true); - url.setConstrained(false); - url.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_RS_URL")); - url.setShortDescription(AS400JDBCDriver.getResource("PROP_DESC_RS_URL")); - - PropertyDescriptor useDataSource = new PropertyDescriptor("useDataSource", beanClass, - "isUseDataSource", "setUseDataSource"); - useDataSource.setBound(true); - useDataSource.setConstrained(false); - useDataSource.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_RS_USE_DATA_SOURCE")); - useDataSource.setShortDescription(AS400JDBCDriver.getResource("PROP_DESC_RS_USE_DATA_SOURCE")); - - PropertyDescriptor username = new PropertyDescriptor("username", beanClass, - "getUsername", "setUsername"); - username.setBound(true); - username.setConstrained(false); - username.setDisplayName(AS400JDBCDriver.getResource("PROP_NAME_RS_USERNAME")); - username.setShortDescription(AS400JDBCDriver.getResource("USER_DESC")); - - properties_ = new PropertyDescriptor[] { command, concurrency, dataSourceName, escapeProcessing, fetchDirection, - fetchSize, maxFieldSize, maxRows, password, queryTimeout, readOnly, transactionIsolation, type, - url, useDataSource, username }; - - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("AS400JDBCRowSet16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("AS400JDBCRowSet32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCRowSetEventSupport.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCRowSetEventSupport.java deleted file mode 100644 index 313a77180..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCRowSetEventSupport.java +++ /dev/null @@ -1,101 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCRowSetEventSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import javax.sql.RowSetEvent; -import javax.sql.RowSetListener; -import java.util.Vector; - -/** -* The AS400JDBCRowSetEventSupport class represents an event support -* facility for maintaining and notifying listeners of JDBC rowset events. -**/ -class AS400JDBCRowSetEventSupport -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - private Vector rowsetListeners_; // The listener list. - - /** - * Constructs a default AS400JDBCRowSetEventSupport object. - **/ - public AS400JDBCRowSetEventSupport() - { - rowsetListeners_ = new Vector(); - } - - /** - * Adds a RowSetListener. - * @param listener The listener. - **/ - public void addRowSetListener(RowSetListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - rowsetListeners_.addElement(listener); - } - - /** - * Fires the cursor moved event. - * @param event The RowSetEvent. - **/ - public void fireCursorMoved(RowSetEvent event) - { - Vector targets = (Vector) rowsetListeners_.clone(); - for (int i=0; i< targets.size(); i++) - { - RowSetListener target = (RowSetListener) targets.elementAt(i); - target.cursorMoved(event); - } - } - - /** - * Fires the row changed event. - * @param event The RowSetEvent. - **/ - public void fireRowChanged(RowSetEvent event) - { - Vector targets = (Vector) rowsetListeners_.clone(); - for (int i=0; i< targets.size(); i++) - { - RowSetListener target = (RowSetListener) targets.elementAt(i); - target.rowChanged(event); - } - } - - /** - * Fires the rowSetChanged event. - * @param event The RowSetEvent. - **/ - public void fireRowSetChanged(RowSetEvent event) - { - Vector targets = (Vector) rowsetListeners_.clone(); - for (int i=0; i< targets.size(); i++) - { - RowSetListener target = (RowSetListener) targets.elementAt(i); - target.rowSetChanged(event); - } - } - - /** - * Removes a RowSetListener. - * @param listener The listener to be removed. - **/ - public void removeRowSetListener(RowSetListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - rowsetListeners_.removeElement(listener); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCSQLXML.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCSQLXML.java deleted file mode 100644 index b93845244..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCSQLXML.java +++ /dev/null @@ -1,1151 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCSQLXML.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.io.Writer; -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -/* ifdef JDBC40 -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLOutputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; -endif */ -import javax.xml.transform.Result; -/* ifdef JDBC40 -import javax.xml.transform.Source; -endif */ -import javax.xml.transform.dom.DOMResult; -/* ifdef JDBC40 -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.sax.SAXSource; -import javax.xml.transform.stax.StAXResult; -import javax.xml.transform.stax.StAXSource; -import org.xml.sax.InputSource; -endif */ - -import javax.xml.parsers.ParserConfigurationException; -/* ifdef JDBC40 -import org.xml.sax.SAXException; - -import org.w3c.dom.DOMImplementation; -import org.w3c.dom.ls.DOMImplementationLS; -import org.w3c.dom.ls.LSSerializer; -endif */ -//@PDA jdbc40 new class -//@xml2 whole class is redesigned after that of The Native Driver -/** -This class provides the object interface for using XML data through JDBC. -The mapping in the Java programming language for the SQL XML type. -XML is a built-in type that stores an XML value as a column value in a row of a database table. -The SQLXML interface provides methods for accessing the XML value as a String, a Reader or Writer, or as a Stream. -This class returns the data as an XML type. The actual type on the host may vary. -Instances of this class are created by AS400JDBCConnection. -This class should not be used if JDK 1.6 is not in use. -**/ -public class AS400JDBCSQLXML -/* ifdef JDBC40 -implements SQLXML -endif */ - -{ - - static final int MAX_XML_SIZE = AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; //@xml3 - // We may internally store the SQLXML object as a DOM document - // if getResult was used to create the object - static final int DOM_DOCUMENT = 22345; - static final int LOB_FREED = 0; - int lobType = LOB_FREED; //corresponding to SQLData numbers - - AS400JDBCClob clobValue_ = null; - AS400JDBCBlob blobValue_ = null; - AS400JDBCClobLocator clobLocatorValue_ = null; - AS400JDBCBlobLocator blobLocatorValue_ = null; - - /* Document available in JDK 1.4, so this cannot be moved back to */ - /* V5R4 which still supports JDK 1.3. In V5R4, this will need to */ - /* be JDBC 4.0 only */ - org.w3c.dom.Document domDocument_ = null; - - //Today, the only case where isXML_ can be true is if this is a AS400JDBCSQLXMLLocator - //(since xml columns are always returned as locators from hostserver) - protected boolean isXML_ = false; //@xml4 true if this data originated from a native XML column type - - /** - * Constructs an AS400JDBCSQLXML object. This is only a dummy constructor used by subclasses. - */ - protected AS400JDBCSQLXML() - { - } - - /** - * Constructs an AS400JDBCSQLXML object. The data is contained - * in the String. No further communication with the IBM i system is necessary. - * - * @param data The SQLXML data. - * @param maxLength Max length. - */ - AS400JDBCSQLXML(String data, int maxLength) - { - isXML_ = true;//@xmltrim (match native jdbc for trimming xml decl if using sqlxml) - - lobType = SQLData.CLOB; - clobValue_ = new AS400JDBCClob(data, maxLength, isXML_); //@xmltrim - - } - - /** - * Constructs an AS400JDBCSQLXML object. The data is contained - * in the String. No further communication with the IBM i system is necessary. - * - * @param data The SQLXML data. - */ - AS400JDBCSQLXML(char[] data) - { - isXML_ = true;//@xmltrim (match native jdbc for trimming xml decl if using sqlxml) - - lobType = SQLData.CLOB; - clobValue_ = new AS400JDBCClob(data, isXML_); //@xmltrim - } - - - /** - * Constructs an AS400JDBCSQLXML object. The data is contained - * in the array. No further communication with the IBM i system is necessary. - * This constructor is used for returning blob data in an XML object. - * - * @param data The SQLXML data. - * @param maxLength Max length. - */ - AS400JDBCSQLXML (byte [] data, long maxLength) - { - isXML_ = true;//@xmltrim (match native jdbc for trimming xml decl if using sqlxml) - - lobType = SQLData.BLOB; - blobValue_ = new AS400JDBCBlob(data, (int)maxLength); - } - - - /** - * Retrieves the XML value designated by this SQLXML instance as a java.io.Reader object. - * The format of this stream is defined by org.xml.sax.InputSource, - * where the characters in the stream represent the Unicode code points for - * XML according to section 2 and appendix B of the XML 1.0 specification. - * Although an encoding declaration other than Unicode may be present, - * the encoding of the stream is Unicode. - * The behavior of this method is the same as ResultSet.getCharacterStream() - * when the designated column of the ResultSet has a type java.sql.Types of SQLXML. - *

        - * The SQL XML object becomes not readable when this method is called and - * may also become not writable depending on implementation. - * - * @return a stream containing the XML data. - * @exception SQLException if there is an error processing the XML value. - * The getCause() method of the exception may provide a more detailed exception, for example, - * if the stream does not contain valid characters. - * An exception is thrown if the state is not readable. - */ - public synchronized Reader getCharacterStream() throws SQLException - { - Reader r = null; - if (lobType == LOB_FREED) { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - return null; - } - - switch (lobType) - { - - case SQLData.CLOB: - case SQLData.DBCLOB: - r = clobValue_.getCharacterStream(); - break; - case SQLData.CLOB_LOCATOR: - case SQLData.DBCLOB_LOCATOR: - r = clobLocatorValue_.getCharacterStream(); - break; - case SQLData.BLOB: - case SQLData.BLOB_LOCATOR: - case DOM_DOCUMENT: - // Calling getString will do the appropriate conversion - String stringValue = this.getString(); - r = new StringReader(stringValue); - break; - default: - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, "Invalid value: "+ lobType); - return null; - } - } - - return r; - } - - - /** - * Retrieves a string representation of the XML value designated by this - * SQLXML object. - * @return a String that is the string representation of the XML value - * @throws SQLException if there is an error accessing the XML value - */ - public synchronized String getString() throws SQLException - { - String s = null; - - switch (lobType) - { - case SQLData.DBCLOB: - case SQLData.CLOB: - s = clobValue_.getSubString((long) 1, (int) clobValue_.length()); - break; - case SQLData.DBCLOB_LOCATOR: - case SQLData.CLOB_LOCATOR: - s = clobLocatorValue_.getSubString((long) 1, (int) clobLocatorValue_.length()); - break; - case SQLData.BLOB: - case SQLData.BLOB_LOCATOR: - - // Check for a byte order mark - String encoding; - int byteOrderMarkSize = 0; - byte[] bytes = null; - if (lobType == SQLData.BLOB) - { - if(blobValue_.length() > 4)//@xmlzero - bytes = blobValue_.getBytes(1, 4); - else - bytes = new byte[0]; //@xmlzero - - } else - { - InputStream is = blobLocatorValue_.getBinaryStream(); - bytes = new byte[4]; - try - { - int bytesRead = is.read(bytes); - if (bytesRead == 0) - bytes = new byte[0]; - } catch (Exception e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL); - return null; - }finally - { - try{ - is.close(); - }catch(Exception e){ } - } - } - if (bytes.length < 4) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - if ((bytes[0] == (byte) 0xEF) && (bytes[1] == (byte) 0xBB) - && (bytes[2] == (byte) 0xBF)) - { - encoding = "UTF-8"; - byteOrderMarkSize = 3; - } else if ((bytes[0] == (byte) 0xFE) - && (bytes[1] == (byte) 0xFF)) - { - encoding = "UTF-16BE"; - byteOrderMarkSize = 2; - } else if ((bytes[0] == (byte) 0xFF) - && (bytes[1] == (byte) 0xFE)) - { - encoding = "UTF-16LE"; - byteOrderMarkSize = 2; - } else - { - // We don't support the UCS-4 variants. In the future, we - // may need to. - - // In this case we need to peek at the stream to determine - // which format it is in. - // At a minimum, we expect it to begin with '<' (after - // ignoring possible white space) - // - int position = 1; - byte nonWhiteSpaceByte = 0x20; - int i = 0; - while (nonWhiteSpaceByte == 0x20) - { - // Get the first few bytes of the blob in order to - // determine the encoding to use. - long len = -1; - if (lobType == SQLData.BLOB) - { - len = blobValue_.length(); - if(len > 80) - len = 80; - bytes = blobValue_.getBytes(position, (int)len); - } else - { - InputStream is = blobLocatorValue_.getBinaryStream(); - bytes = new byte[80]; - try - { - int bytesRead = is.read(bytes); - if (bytesRead == 0) - bytes = new byte[0]; - } catch (Exception e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL); - return null; - }finally - { - try{ - is.close(); - }catch(Exception e){ } - } - } - position += len-1; - if (bytes.length == 0) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - while (i < bytes.length - 1 - && ((bytes[i] == 0x20) || (bytes[i] == 0x40) || /* space */ - (bytes[i] == 0x09) || (bytes[i] == 0x05) || /* tab */ - (bytes[i] == 0x0d) || /* CR */ - (bytes[i] == 0x0a) || bytes[i] == 0x15 /* LF */ - || bytes[i] == 0)) - { - if (bytes[i] == 0) - { - i++; - if ((bytes[i] == 0x20) || /* space */ - (bytes[i] == 0x09) || /* table */ - (bytes[i] == 0x0d) || /* CR */ - (bytes[i] == 0x0a)) /* LF */ - { - i++; - } else - { - i--; - nonWhiteSpaceByte = 0; - break; - } - } else - { - // If LE encoding.. - if (bytes[i + 1] == 0) - { - i++; - } - i++; - } - } - if (i < (bytes.length - 1)) - nonWhiteSpaceByte = bytes[i]; - } /* while looking for nonspace byte */ - /* We need to look at the next byte */ - byte nextByte; - i++; - nextByte = bytes[i]; - - // Determine what the encoding is - if (nonWhiteSpaceByte == 0x3c) - { - if (nextByte == 0x00) - { - encoding = "UTF-16LE"; - } else - { - encoding = "UTF-8"; - } - } else if (nonWhiteSpaceByte == 0x00) - { - if (nextByte == 0x3c) - { - encoding = "UTF-16BE"; - } else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - } else if (nonWhiteSpaceByte == 0x4C /* < */) - { - // - // Determine the internal encoding. If it cannot be - // determined then use CCSID 37 - - encoding = getInternalEncodingFromEbcdic(bytes); - if (encoding == null) - { - encoding = "IBM-37"; - } - - } else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } // checking first byte - } // determine encoding - // At this point the encoding is set and we can obtain the - // string - InputStream stream = null; - BufferedReader reader = null; - StringBuffer sb = new StringBuffer(); - try - { - if (lobType == SQLData.BLOB) - { - stream = blobValue_.getBinaryStream(); - } else - { - stream = blobLocatorValue_.getBinaryStream(); - } - while (byteOrderMarkSize > 0) - { - try - { - stream.read(); - } catch ( IOException ioex) - { - // shouldn't ever happen since we've already looked at - // this. - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - byteOrderMarkSize--; - } - - try - { - reader = new BufferedReader(new InputStreamReader(stream, - encoding)); - } catch (UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - - String line; - try - { - line = reader.readLine(); - if (line != null) - { - sb.append(line); - } - line = reader.readLine(); - while (line != null) - { - sb.append("\n"); - sb.append(line); - line = reader.readLine(); - } - } catch (IOException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - } catch (Exception e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL); - return null; - }finally - { - try{ - stream.close(); - }catch(Exception e){ } - try{ - reader.close(); - }catch(Exception e){ } - } - s = sb.toString(); - - break; // end of BLOB case - /* ifdef JDBC40 - case DOM_DOCUMENT: - - DOMImplementation implementation = domDocument_.getImplementation(); - - DOMImplementationLS domImplementationLS = (DOMImplementationLS) implementation - .getFeature("LS", "3.0"); - LSSerializer lsSerializer = domImplementationLS.createLSSerializer(); - s = lsSerializer.writeToString(domDocument_); - - break; - endif */ - - case 0: - //freed already - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - return null; - default: - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, "Invalid value: "+ lobType); - return null; - } - } - if(isXML_)//@xmltrim - return JDUtilities.stripXMLDeclaration(s); //@xmltrim - else - return s; - } - - - /** - Retrieves the internal encoding specified in the bytes that represent the beginning of an - XML document. If no internal encoding is present, then null is returned. - **/ - private String getInternalEncodingFromEbcdic(byte[] bytes) - { - /* EBCDIC encoding for CCSID 37 and CCSID 290 for "encoding=" */ - final byte[][] encodingPattern = - { - { (byte) 0x85, (byte) 0x95, (byte) 0x83, (byte) 0x96, - (byte) 0x84, (byte) 0x89, (byte) 0x95, (byte) 0x87 }, - { (byte) 0x66, (byte) 0x76, (byte) 0x64, (byte) 0x77, - (byte) 0x65, (byte) 0x71, (byte) 0x76, (byte) 0x68 } }; - String[] encodingName = { "IBM-37", "IBM-930" }; //@ibm-290 not supported - - String encoding = null; - int i = 0; - int length = bytes.length; - while (bytes[i] != 0x4c && i < length) - { - i++; - } - i++; //one more - int currentPattern = -1; - int patternPosition = 0; - while (encoding == null && i < length && bytes[i] != 0x6e ) - { - if (currentPattern < 0) - { - for (int j = 0; j < encodingPattern.length - && currentPattern < 0; j++) - { - if (bytes[i] == encodingPattern[j][0]) - { - currentPattern = j; - patternPosition = 1; - } - } - } else - { - if (patternPosition == encodingPattern[currentPattern].length) - { - // Pick the encoding for the string to obtain the pattern - // from withing the string - encoding = encodingName[currentPattern]; - // skip space - - while (bytes[i] == 0x40 && i < length) - i++; - // make sure = is found. = is invariant at 0x7e - if (bytes[i] == 0x7e && i < length) - { - i++; - // Skip space - while (bytes[i] == 0x40 && i < length) - { - i++; - } - // Make sure " is found. " is invariant at 0x7f except - // for - // code pages 905 and 1026 (turkey) where it is found at - // 0xfc - if ((bytes[i] == 0x7f || ((0xff & bytes[i]) == 0xfc)) - && (i < length)) - { - i++; - // Find the ending quote - int endingQuote = i; - while (bytes[endingQuote] != 0x7f - && (( 0xFF & bytes[endingQuote]) != 0xfc) - && endingQuote < length) - { - endingQuote++; - } - if (endingQuote < length) - { - // Create a string from the bytes and return the - // encoding - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream( - bytes, i, endingQuote - i); - - BufferedReader reader = null; - try - { - reader = new BufferedReader( - new InputStreamReader( - byteArrayInputStream, - encodingName[currentPattern])); - encoding = reader.readLine(); - } catch (UnsupportedEncodingException e) - { - // Should never get here since the encoding should be valid - currentPattern = -1; - } catch (IOException e) - { - // Should never get here since we should get io exception on a byteArrayInputStream - currentPattern = -1; - }finally - { - try{ - byteArrayInputStream.close(); - }catch(Exception e){ } - try{ - reader.close(); - }catch(Exception e){ } - } - - } else - { - currentPattern = -1; - } - } else - { - currentPattern = -1; - } - } else - { - currentPattern = -1; - } - - } else - { - if (bytes[i] == encodingPattern[currentPattern][patternPosition]) - { - patternPosition++; - } else - { - currentPattern = -1; - } - } - } - i++; - } - - return encoding; - } - - /** - * Writes the given Java String to the XML value that this SQLXML object designates. - * @param str the string to be written to the XML value that this SQLXML designates - * @throws SQLException if there is an error accessing the XML value - */ - public synchronized void setString(String str) throws SQLException - { - freeInternals(); - if(lobType == LOB_FREED) - { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - } - - clobValue_ = new AS400JDBCClob(str, str.length()); - - lobType = SQLData.CLOB; - } - - - /** - Package level helper method. Only valid on Clob-like data. - Writes a String to this XML, starting at position position in the XML. - The XML will be truncated after the last character written. The lengthOfWrite - characters written will start from offset in the string that was provided by the - application. - - @param position The position (1-based) in the XML where writes should start. - @param string The string that will be written to the XML. - @param offset The offset into string to start reading characters (0-based). - @param lengthOfWrite The number of characters to write. - @return The number of characters written. - - @exception SQLException If there is an error - **/ - synchronized int setString(long position, String string, int offset, int lengthOfWrite) throws SQLException - { - switch (lobType) - { - case SQLData.DBCLOB: - case SQLData.CLOB: - return clobValue_.setString(position, string, offset, lengthOfWrite); - case SQLData.DBCLOB_LOCATOR: - case SQLData.CLOB_LOCATOR: - return clobLocatorValue_.setString(position, string, offset, lengthOfWrite); - default: - JDError.throwSQLException(this, JDError.EXC_INTERNAL, "Invalid value: "+ lobType); - return 0; - } - - - } - - - /** - * Retrieves the XML value designated by this SQLXML instance as a stream. - * @return a stream containing the XML data. - * @throws SQLException if there is an error processing the XML value. - * An exception is thrown if the state is not readable. - */ - public InputStream getBinaryStream() throws SQLException - { - InputStream is = null; - switch (lobType) - { - case SQLData.DBCLOB: - case SQLData.CLOB: - try - { - // Check for an internal encoding in the string. If there is - // one, we must use it - String clobString = new String(clobValue_.data_); - String internalEncoding = getInternalEncoding(clobString); - if (internalEncoding != null) - { - is = new ByteArrayInputStream(clobString.getBytes(internalEncoding)); - } else - { - is = new ByteArrayInputStream(clobString.getBytes("UTF-8")); - } - } catch (UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } - break; - case SQLData.DBCLOB_LOCATOR: - case SQLData.CLOB_LOCATOR: - //This will also be the case for XML column data - if(isXML_) //@xml6 if xml column and thus also a locator, then get bytes from bloblocator code - is = blobLocatorValue_.getBinaryStream(); //@xml6 (no trim of XML declaration because it is binary) - else - { - - try - { - // Check for an internal encoding in the string. If there is - // one, we must use it - String clobString = clobLocatorValue_.getSubString((long)1, (int)clobLocatorValue_.length()); - String internalEncoding = getInternalEncoding(clobString); - if (internalEncoding != null) - { - is = new ByteArrayInputStream(clobString.getBytes(internalEncoding)); - } else - { - is = new ByteArrayInputStream(clobString.getBytes("UTF-8")); - } - } catch (UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } - } - break; - case SQLData.BLOB: - // - // In this case, we rely on the binary stream to identify its own encoding - // It appears the that binary encoding will be used the most.. However, - // this is not useful from a DB perspective since it cannot be searched. - // - is = blobValue_.getBinaryStream(); - - break; - case SQLData.BLOB_LOCATOR: - // - // In this case, we rely on the binary stream to identify its own encoding - // It appears the that binary encoding will be used the most.. However, - // this is not useful from a DB perspective since it cannot be searched. - // - is = blobLocatorValue_.getBinaryStream(); - - break; - // Obtain a stream from a dom document by first converting it to - // a String and then getting the UTF-8 representation - case DOM_DOCUMENT: - try - { - String string = this.getString(); - is = new ByteArrayInputStream(string.getBytes("UTF-8")); - - } catch (UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } - - break; - default: - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, "Invalid value: "+ lobType); - return null; - } - } - return is; - } - - - - //JDBC40DOC /** - //JDBC40DOC * Returns a Source for reading the XML value designated by this SQLXML instance. - //JDBC40DOC * Sources are used as inputs to XML parsers and XSLT transformers. - //JDBC40DOC * @param sourceClass The class of the source, or null. - //JDBC40DOC * If the class is null, a vendor specific Source implementation will be returned. - //JDBC40DOC * The following classes are supported at a minimum: - //JDBC40DOC *

        -  //JDBC40DOC      *   javax.xml.transform.dom.DOMSource - returns a DOMSource
        -  //JDBC40DOC      *   javax.xml.transform.sax.SAXSource - returns a SAXSource
        -  //JDBC40DOC      *   javax.xml.transform.stax.StAXSource - returns a StAXSource
        -  //JDBC40DOC      *   javax.xml.transform.stream.StreamSource - returns a StreamSource
        -  //JDBC40DOC      * 
        - //JDBC40DOC * @return a Source for reading the XML value. - //JDBC40DOC * @throws SQLException if there is an error processing the XML value - //JDBC40DOC * or if this feature is not supported. - //JDBC40DOC * The getCause() method of the exception may provide a more detailed exception, for example, - //JDBC40DOC * if an XML parser exception occurs. - //JDBC40DOC * An exception is thrown if the state is not readable. - //JDBC40DOC */ - /* ifdef JDBC40 - public synchronized T getSource(Class sourceClass) throws SQLException - { - String classname; - if (sourceClass == null) - { - classname = "javax.xml.transform.stream.StreamSource"; - } else - { - classname = sourceClass.getName(); - } - - if (lobType == LOB_FREED) - { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - return null; - } - - if (classname.equals("javax.xml.transform.dom.DOMSource")) - { - try - { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder parser = factory.newDocumentBuilder(); - //parser.setErrorHandler(errorHandler); - org.w3c.dom.Document doc; - if (lobType == SQLData.CLOB //@clob - || lobType == SQLData.DBCLOB //@clob - || lobType == SQLData.CLOB_LOCATOR - || lobType == SQLData.DBCLOB_LOCATOR) - { - // Do something different for CLOB locators because - // getBinaryStream results in getAsciiStream which - // cannot be parsed if an internal encoding is present - doc = parser.parse(new InputSource(getCharacterStream())); - } else if (lobType == DOM_DOCUMENT) - { - doc = domDocument_; - } else - { - doc = parser.parse(getBinaryStream()); - } - return (T) new DOMSource(doc); - } catch (ParserConfigurationException e) - { - // This exception will probably not occur - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } catch (SAXException e) - { - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } catch (IOException e) - { - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } - } else if (classname.equals("javax.xml.transform.sax.SAXSource")) - { - InputSource inputSource = new InputSource(getCharacterStream()); - return (T) new javax.xml.transform.sax.SAXSource(inputSource); - } else if (classname.equals("javax.xml.transform.stax.StAXSource")) - { - try - { - XMLInputFactory inputFactory = XMLInputFactory.newInstance(); - XMLStreamReader xmlStreamReader; - xmlStreamReader = inputFactory.createXMLStreamReader(getCharacterStream()); - return (T) new StAXSource(xmlStreamReader); - } catch (XMLStreamException e) - { - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } - - } else if (classname.equals("javax.xml.transform.stream.StreamSource")) - { - return (T) new javax.xml.transform.stream.StreamSource( getCharacterStream()); - } else - { - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - - } - endif */ - - /** - * Retrieves a stream that can be used to write the XML value that this SQLXML instance represents. - * @return a stream to which data can be written. - * @throws SQLException if there is an error processing the XML value. An exception - * is thrown if the state is not writable. - * @exception If there is an error - */ - public synchronized OutputStream setBinaryStream() throws SQLException - { - - if (lobType == LOB_FREED) - { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - return null; - } - - freeInternals(); - - if (blobValue_ == null) - { - byte[] dummy = new byte[0]; - blobValue_ = new AS400JDBCBlob(dummy, AS400JDBCBlob.MAX_LOB_SIZE); - } - lobType = SQLData.BLOB; - return blobValue_.setBinaryStream(1); - } - - /** - * Retrieves a Writer to be used to write the XML value that this SQLXML instance represents. - * @return a stream to which data can be written. - * @throws SQLException if there is an error processing the XML value. - * The getCause() method of the exception may provide a more detailed exception, for example, - * if the stream does not contain valid characters. - * An exception is thrown if the state is not writable. - * @exception If there is an error - */ - public synchronized Writer setCharacterStream() throws SQLException - { - if (lobType == LOB_FREED) { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - return null; - } - - freeInternals(); - - clobValue_ = new AS400JDBCClob("", AS400JDBCClob.MAX_LOB_SIZE); - lobType = SQLData.CLOB; - - return clobValue_.setCharacterStream(1L); - } - - //JDBC40DOC /** - //JDBC40DOC * Returns a Result for setting the XML value designated by this SQLXML instance. - //JDBC40DOC * @param resultClass The class of the result, or null. - //JDBC40DOC * If resultClass is null, a vendor specific Result implementation will be returned. - //JDBC40DOC * The following classes are supported at a minimum: - //JDBC40DOC *
        -  //JDBC40DOC      *   javax.xml.transform.dom.DOMResult - returns a DOMResult
        -  //JDBC40DOC      *   javax.xml.transform.sax.SAXResult - returns a SAXResult
        -  //JDBC40DOC      *   javax.xml.transform.stax.StAXResult - returns a StAXResult
        -  //JDBC40DOC      *   javax.xml.transform.stream.StreamResult - returns a StreamResult
        -  //JDBC40DOC      * 
        - //JDBC40DOC * @return Returns a Result for setting the XML value. - //JDBC40DOC * @throws SQLException if there is an error processing the XML value - //JDBC40DOC * or if this feature is not supported. - //JDBC40DOC * The getCause() method of the exception may provide a more detailed exception, for example, - //JDBC40DOC * if an XML parser exception occurs. - //JDBC40DOC * An exception is thrown if the state is not writable. - //JDBC40DOC * @exception If there is an error - //JDBC40DOC */ - /* ifdef JDBC40 - public synchronized T setResult(Class resultClass) throws SQLException - { - String classname; - if (resultClass == null) - { - classname = "javax.xml.transform.stream.StreamSource"; - } else - { - classname = resultClass.getName(); - } - - if (lobType == LOB_FREED) - { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_SEQUENCE); - return null; - } - - if (classname.equals("javax.xml.transform.dom.DOMResult")) - { - try - { - - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder documentBuilder = factory.newDocumentBuilder(); - freeInternals(); - lobType = DOM_DOCUMENT; - domDocument_ = documentBuilder.newDocument(); - - return (T) new DOMResult(domDocument_); - - } catch (ParserConfigurationException e) - { - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } - } else if (classname.equals("javax.xml.transform.sax.SAXResult")) - { - - // - // TODO - // - // To get this to work, you would need to implement a SAX - // content handler to dump the handled information to the - // an output character stream - // - JDError.throwSQLException(this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - - } else if (classname.equals("javax.xml.transform.stax.StAXResult")) - { - try - { - XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); - XMLStreamWriter xmlStreamWriter; - xmlStreamWriter = outputFactory.createXMLStreamWriter(setCharacterStream()); - return (T) new StAXResult(xmlStreamWriter); - } catch (Exception e) - { - JDError.throwSQLException(this, JDError.EXC_XML_PARSING_ERROR, e); - return null; - } - } else if (classname.equals("javax.xml.transform.stream.StreamResult")) - { - return (T) new javax.xml.transform.stream.StreamResult(setCharacterStream()); - } else - { - JDError.throwSQLException(this, JDError.EXC_FUNCTION_NOT_SUPPORTED); - return null; - } - } - - endif */ - - /** - * This method frees the object and releases the - * the resources that it holds. The object is invalid once the - * free method is called. If free is called - * multiple times, the subsequent calls to free are treated - * as a no-op. - * - * @throws SQLException - * if an error occurs releasing the Clob's resources - */ - public synchronized void free() throws SQLException - { - freeInternals(); - lobType = LOB_FREED; - } - - - /** - * Free the internal representation used by the SQLXML. - * Call before setting a new type of internal representation - */ - private void freeInternals() throws SQLException - { - if (blobValue_ != null) - { - blobValue_.free(); - blobValue_ = null; - } - if (blobLocatorValue_ != null) - { - //blobLocatorValue_.free(); //@olddesc - blobLocatorValue_ = null; - } - - if (clobValue_ != null) - { -/* ifdef JDBC40 - clobValue_.free(); - endif */ - clobValue_ = null; - } - - if (clobLocatorValue_ != null) - { - //clobLocatorValue_.free();//@olddesc - clobLocatorValue_ = null; - } - - if (domDocument_ != null) - { - domDocument_ = null; - } - } - /** - * Retrieves the internal encoding specified in the string that represents - * an XML document. If no internal encoding is present, then null is - * returned. - */ - private String getInternalEncoding(String xml) - { - String encoding = null; - // find the first < - int start = xml.indexOf("<"); - if (start >= 0) - { - // find the ending > - int end = xml.indexOf(">", start); - if (end >= 0) - { - String piece = xml.substring(start, end + 1); - int encodingIndex = piece.indexOf("encoding="); - if (encodingIndex > 0) - { - int firstQuote = piece.indexOf("\"", encodingIndex); - if (firstQuote > 0) - { - int lastQuote = piece.indexOf("\"", firstQuote + 1); - if (lastQuote > 0) - { - return piece.substring(firstQuote + 1, lastQuote); - } - } - } - } - } - return encoding; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCSQLXMLLocator.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCSQLXMLLocator.java deleted file mode 100644 index 539eb449d..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCSQLXMLLocator.java +++ /dev/null @@ -1,125 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCSQLXMLLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2009 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/* ifdef JDBC40 -import java.io.InputStream; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; -import java.io.Writer; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.transform.Result; -import javax.xml.transform.Source; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.sax.SAXSource; -import javax.xml.transform.stax.StAXSource; - -import javax.xml.transform.stream.StreamSource; - -import org.w3c.dom.Document; -import org.xml.sax.InputSource; -endif */ - -//import com.sun.xml.internal.fastinfoset.stax.StAXDocumentParser; - - -//@PDA jdbc40 new class -//@xml2 whole class is redesigned after that of The Native Driver -/** -

        The AS400JDBCSQLXMLLocator class provides the object interface for using XML data through JDBC. -The mapping in the Java programming language for the SQL XML type. -XML is a built-in type that stores an XML value as a column value in a row of a database table. -The SQLXML interface provides methods for accessing the XML value as a String, a Reader or Writer, or as a Stream. -**/ -public class AS400JDBCSQLXMLLocator extends AS400JDBCSQLXML -{ - - - - /** - Constructs an AS400JDBCSQLXMLLocator object of Clob/DBClob locator data. (This constructor signature is only - available on ClobLocator.) - This could be created as a result of an actual XML column or some other data type column and calling resultSet.getSQLXML() - The data for the - SQLXML will be retrieved as requested, directly from the - IBM i system, using the locator handle. - - @param locator The locator. - @param converter The text converter. - @param savedObject Saved Object. - @param savedScale Saved scale. - @param isXML Flag that stream is from an XML column type (needed to strip xml declaration) - **/ - AS400JDBCSQLXMLLocator(JDLobLocator locator, ConvTable converter, Object savedObject, int savedScale, boolean isXml) - { - super(); - //Since SQLXML has both text and binary getter methods, we need to preserve converter, but need to be able to get - //to the bits as binary without doing any conversion or trimming of XML declaration - - //Native JDBC changed to always trim off xml header if accessing data through SQLXML object even it column is not XML...(TB also will now do this) - isXml = true;//@xmltrim (match native jdbc for trimming xml decl if using sqlxml) - - clobLocatorValue_ = new AS400JDBCClobLocator( locator, converter, savedObject, savedScale, isXml); //@xml4 allow AS400JDBCClobLocator to trim off xml header if needed - if(isXml) - blobLocatorValue_ = new AS400JDBCBlobLocator( locator, savedObject, savedScale); //@xml6 also need ref to bloblocator in case SQLXML.getBinaryStream is called - - lobType = SQLData.CLOB_LOCATOR; - isXML_ = isXml; //@xml4 - } - - - /** - Constructs an AS400JDBCSQLXMLLocator object of BlobLocator data. (This constructor signature is only - available on BlobLocator.) - The data for the - BLOB will be retrieved as requested, directly from the - IBM i system, using the locator handle. - @param locator The locator. - @param savedObject Saved Object. - @param savedScale Saved scale. - **/ - AS400JDBCSQLXMLLocator(JDLobLocator locator, Object savedObject, int savedScale) - { - super(); - blobLocatorValue_ = new AS400JDBCBlobLocator( locator, savedObject, savedScale); - lobType = SQLData.BLOB_LOCATOR; - isXML_ = true;//@xmltrim (match native jdbc for trimming xml decl if using sqlxml) - } - - //@olddesc - /** - Returns the handle to this locator in the database. - - @return The handle to this locator in the databaes. - **/ - int getHandle()throws SQLException - { - - if(clobLocatorValue_ != null) - return clobLocatorValue_.getHandle(); - else if(blobLocatorValue_ != null) - return blobLocatorValue_.getHandle(); - else - return -1; //not set or updated by non-locator value and not needed - - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCSavepoint.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCSavepoint.java deleted file mode 100644 index af96ef1fc..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCSavepoint.java +++ /dev/null @@ -1,160 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCSavepoint.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.Savepoint; -import java.sql.SQLException; - - - -// JDBC 3.0 - -/** -

        -The AS400JDBCSavepoint class is the Toolbox JDBC driver's -representation of a savepoint. A savepoint is a point within the current -transaction that can be referenced from the -{@link com.ibm.as400.access.AS400JDBCConnection#rollback(java.sql.Savepoint) Connection.rollback(savepoint)} -method. -When a transaction is rolled back to a savepoint, all changes made -after the savepoint was created are undone. -

        -Savepoints can be either named or unnamed. -The DB2 for IBM i does not support unnamed savepoints -so internally the Toolbox JDBC driver will create -a name to send to the system. The -format is T_JDBCINTERNAL_n where 'n' is a counter that is -incremented every time an unnamed savepoint is created. -

        -Considerations: -

          -
        • Named savepoints must be unique. A savepoint name cannot be reused until the savepoint is released, committed, or rolled back. -
        • Savepoints are valid only if autocommit is off. An exception is thrown is autocommit is enabled. -
        • Savepoints are not valid across XA connections. An exception is thrown if the connection is an XA connection. -
        • Savepoints require OS/400 V5R2 or IBM i. An exception is thrown if connecting to OS/400 V5R1 or earlier. -
        • If the connection option is set to keep cursors open after a traditional rollback, cursors also remain open after a rollback to a savepoint. -
        - -

        -OS/400 V5R2 or IBM i is required to use savepoints. Savepoint support -is new in modification 5 of the Toolbox JDBC driver. - - -**/ - -public class AS400JDBCSavepoint -implements Savepoint -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Counter for creating unique names. - private static int counter_ = 1; - - // So object can be serialized / de-serialized across releases - static final long serialVersionUID = 4L; - - - // Savepoint ID. Name is used if user named the savepoint, id is used if the user - // did not name the save point. - private String name_ = null; - private int generatedId_ = 0; - - // State of savepoint. - private int status_; - static final int ACTIVE = 1; - static final int CLOSED = 2; - - - - /** - Constructs an AS400JDBCSavepoint object. - **/ - AS400JDBCSavepoint (String name, int id) - { - name_ = name; - generatedId_ = id; - status_ = ACTIVE; - } - - - - // The worker method in AS400JDBCConnection needs a method that gets the name - // no matter how it is generated. It cannot use the public getSavepointName() - // method since that throws an exception if the savepoint is an unnamed savepoint. - String getName() - { - return name_; - } - - - // Counter to help create unique name for unnamed savepoints. Every savepoint - // on the serve has a name. We will create a name for unnamed savepoints to - // send to the system. - static synchronized int getNextId() - { - return counter_++; - } - - - - - /** - * Returns the generated ID for the savepoint that this Savepoint object represents. - * @return the numeric ID of this savepoint. - * @exception SQLException if this is a named savepoint. - **/ - public int getSavepointId() - throws SQLException - { - if (generatedId_ == 0) - JDError.throwSQLException(JDError.EXC_SAVEPOINT_DOES_NOT_EXIST); - - return generatedId_; - } - - - /** - * Returns the name for the savepoint that this Savepoint object represents. - * @return the name of this savepoint. - * @exception SQLException if this is an un-named savepoint. - **/ - public String getSavepointName() - throws SQLException - { - if (generatedId_ != 0) - JDError.throwSQLException(JDError.EXC_SAVEPOINT_DOES_NOT_EXIST); - - return name_; - } - - - // The worker method in AS400JDBCConnection can use this method to determine - // if the savepoint is closed via the release or rollback methods. Savepoints - // that are no longer valid because of a commit will still show a status of - // active. - int getStatus() - { - return status_; - } - - - // Change the status of this savepoint. Most likely use of this method is to - // change the status from active to closed after a release or rollback. - void setStatus(int status) - { - status_ = status; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCStatement.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCStatement.java deleted file mode 100644 index 1b2a673e2..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCStatement.java +++ /dev/null @@ -1,3998 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCStatement.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.math.BigDecimal; -import java.sql.BatchUpdateException; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.Statement; -import java.util.Enumeration; -import java.util.Vector; - - - -// @E6C - Changed javadoc paragraph about thread-safety. -/** -

        The AS400JDBCStatement class provides a mechanism for -executing static SQL statements. Use Connection.createStatement() -to create new Statement objects. - -

        Only one result set per statement can be open at any point in time. -Therefore, if an application needs to read from multiple result sets, -then each must be generated by a different statement. - -

        AS400JDBCStatements are thread-safe. - -

        Note that the connection keeps a reference to each statement that -it creates. This means that statements will not get garbage collected -until the connection gets garbage collected. It is best to -explicitly close statements rather than counting on garbage collection. -**/ -// -// Implementation notes: -// -// 1. The RPB is used to provide parameters for requests. -// If we make a request without specifying some of the -// parameters, then the system will look in the RPB. -// -// Specifically, we use an RPB for each statement object to -// store parameters that do not depend on the SQL statement: -// -// * cursor name -// * statement name -// -// 2. There are many package-scope members in this class -// heirarchy which really should be "private protected". -// However, that is no longer allowed in Java, so we -// at least limit access out the the package. They -// are not intended to be used outside of the class -// hierarchy. -// -public class AS400JDBCStatement -/* ifdef JDBC40 -extends ToolboxWrapper -endif */ -implements Statement -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - - // Constants. - static final int MAX_CURSOR_NAME_LENGTH_PRE_V6R1 = 18; //@550C - static final int MAX_CURSOR_NAME_LENGTH = 128; //@550A - - // Constants for generated key support - static final int RETURN_GENERATED_KEYS = 1; //@G4A - static final int NO_GENERATED_KEYS = 2; //@G4A - static final int GENERATED_KEYS_NOT_SPECIFIED = -9999; //@G4A - - - // Private data. - boolean allowImmediate_; // private protected - private int autoGeneratedKeys_; // @G4A - Vector batch_; // private protected - private String blockCriteria_; - private int blockSize_; - private boolean cancelled_; - private boolean closed_; - AS400JDBCConnection connection_; // private protected - JDCursor cursor_; // private protected - private String cursorDefaultName_; - private boolean escapeProcessing_; - private DBExtendedColumnDescriptors extendedColumnDescriptors_; // @F3A - private int fetchDirection_; - private int fetchSize_; - private AS400JDBCResultSet generatedKeys_; // @G4A - int id_; // private protected - AS400JDBCStatementLock internalLock_; // private protected // @E6A@C7C - private boolean lastPrepareContainsLocator_; // @B2A - private int maxFieldSize_; - private int maxRows_; - int rowsInserted_; // for block insert @G5A - private String name_; - private String nameOverride_; - int numberOfResults_; // private protected - int positionOfSyntaxError_; //@F10A - boolean prefetch_; // private protected - private int queryTimeout_; - private boolean queryTimeoutSet_ = false; /*@B2A*/ - AS400JDBCResultSet resultSet_; // private protected - private int rowCountEstimate_; // @ECA - private boolean rpbCreated_; - private boolean rpbQueryTimeoutChanged_; //@EFA - private boolean rpbSyncNeeded_; - JDPackageManager packageManager_; // private protected - int resultSetConcurrency_; // private protected - int resultSetHoldability_; //@G4A - private int resultSetType_; - SQLConversionSettings settings_; // private protected - private SQLWarning sqlWarning_; - JDTransactionManager transactionManager_; // private protected - int updateCount_; // private protected - private String packageCriteria_; // @A1A - int behaviorOverride_ = 0; // @F9a - private boolean associatedWithLocators_ = false; //@KBL set to true, if this statement was used to access a locator - private boolean holdStatement_ = false; //@KBL set to true, if rpb and ors for this statement should be left open until a transaction boundary - private boolean useVariableFieldCompression_ = false; //@K54 - private boolean isPoolable_ = false; //@PDA jdbc40 - JDServerRow parameterRow_; // private protected //@re-prep moved from preparedStatement so that it has visibility here - private boolean threadInterrupted = false; - private DBReplyRequestedDS commonExecuteReply = null; // reply from commonExecute. Note: This cannot be returned to the pool until it is - // no longer being used. The data_ pointer from this reply is shared with - // all kinds of objects. - // Note: Because of the current structure, this can be returned after it is used. The data_ - // pointer from the reply was created by ClientAccessDataStream.construct. The returnToPool - // method for the reply has been corrected to set the data_ pointer back to DBStorage_.data. - // @B5A - private DBReplyRequestedDS connectReply = null; - private DBReplyRequestedDS execImmediateReply = null; - private DBReplyRequestedDS normalPrepareReply = null; - private DBReplyRequestedDS getMoreResultsReply = null; - - - /** - Constructs an AS400JDBCStatement object. - - @param connection The connection to the system. - @param id The id. - @param transactionManager The transaction manager for the connection. - @param packageManager The package manager for the connection. - @param blockCriteria The block criteria. - @param blockSize The block size (in KB). - @param prefetch Indicates if prefetching data. - @param packageCriteria The package criteria. - @param resultSetType The result set type. - @param resultSetConcurrency The result set concurrency. - @param resultSetHoldability The result set holdability. - @param autoGeneratedKeys Indicates if auto generated keys were requested. - - @exception SQLException If an error occurs. - **/ - AS400JDBCStatement (AS400JDBCConnection connection, - int id, - JDTransactionManager transactionManager, - JDPackageManager packageManager, - String blockCriteria, - int blockSize, - boolean prefetch, - String packageCriteria, // @A1C - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability, // @G4A - int autoGeneratedKeys) // @G4A - throws SQLException - { - // Initialization. - allowImmediate_ = true; - autoGeneratedKeys_ = autoGeneratedKeys; // @G4A - //@P0Dbatch_ = new Vector (); - blockCriteria_ = blockCriteria; - blockSize_ = blockSize; - cancelled_ = false; - closed_ = false; - connection_ = connection; - escapeProcessing_ = true; - fetchDirection_ = ResultSet.FETCH_FORWARD; - fetchSize_ = 0; - id_ = id; - internalLock_ = new AS400JDBCStatementLock(); // @E6A - maxFieldSize_ = 0; - maxRows_ = 0; - numberOfResults_ = 0; - prefetch_ = prefetch; - queryTimeout_ = 0; - resultSet_ = null; - transactionManager_ = transactionManager; - updateCount_ = -1; - packageManager_ = packageManager; - resultSetConcurrency_ = resultSetConcurrency; - resultSetHoldability_ = resultSetHoldability; //@G4A - resultSetType_ = resultSetType; - rpbCreated_ = false; - rpbQueryTimeoutChanged_ = false; //@EFA - rpbSyncNeeded_ = true; - settings_ = new SQLConversionSettings (connection_); - sqlWarning_ = null; - packageCriteria_ = packageCriteria; // @A1A - - // By default, the statement name and cursor name are - // based on the id. - String idString = "0000" + id; - String idString4 = idString.substring (idString.length() - 4); - name_ = "STMT" + idString4; - - if(resultSetType_ == ResultSet.TYPE_FORWARD_ONLY) // @B1A - { - cursorDefaultName_ = "CRSR" + idString4; - if((connection_.getServerFunctionalLevel() >= 14) && (connection_.getProperties().getBoolean(JDProperties.VARIABLE_FIELD_COMPRESSION))) //@K54 - useVariableFieldCompression_ = true; //@K54 - } - else // @B1A - cursorDefaultName_ = "SCRSR" + idString4; // @B1A - - // @E4D // Use lazy close only when the "lazy close" property @E4A - // @E4D // has been set AND the old auto-commit support is @E4A - // @E4D // still in effect. @E4A - // @E4D boolean lazyClose = connection_.getProperties().getBoolean(JDProperties.LAZY_CLOSE) // @E4A - // @E4D && transactionManager_.isNewAutoCommitSupport(); // @E4A - - cursor_ = new JDCursor (connection_, id_, cursorDefaultName_, resultSetConcurrency_); // @E4C @EAC - - //@F4 If the user specified a holdability, then we must check the holdability of - //@F4 statements on a Connection.commit or Connection.rollback. Thought about just - //@F4 setting this flag to true if the holdability was different than the connection - //@F4 holdability, but the connection holdability can change above us. - if(resultSetHoldability != AS400JDBCResultSet.HOLDABILITY_NOT_SPECIFIED) //@F4A - { - //@F4A - connection.setCheckStatementHoldability(true); //@F4A - } //@F4A - - try // @F9a - { - // @F9a - behaviorOverride_ = connection_.getProperties().getInt(JDProperties.BEHAVIOR_OVERRIDE); // @F9a - } // @F9a - catch(Throwable t) - { - } // @F9a - - // Trace messages. - if(JDTrace.isTraceOn()) - { - JDTrace.logOpen (this, connection_); // @J33c - JDTrace.logProperty (this, "Escape processing", escapeProcessing_); - JDTrace.logProperty (this, "Fetch direction", fetchDirection_); - JDTrace.logProperty (this, "Fetch size", fetchSize_); - JDTrace.logProperty (this, "Max field size", maxFieldSize_); - JDTrace.logProperty (this, "Max rows", maxRows_); - JDTrace.logProperty (this, "Query timeout", queryTimeout_); - JDTrace.logProperty (this, "Result set concurrency", resultSetConcurrency_); - JDTrace.logProperty (this, "Result set holdability", resultSetHoldability_); //@F4A - JDTrace.logProperty (this, "Result set type", resultSetType_); - JDTrace.logProperty (this, "Behavior Override", behaviorOverride_); // @F9a - String cursorAsString = JDTrace.objectToString(cursor_); // @J33a - JDTrace.logInformation(this, "Data to correlate statement with cursor " + cursorAsString); // @J33a - } - } - - - - // JDBC 2.0 - /** - Adds an SQL statement to the current batch of SQL statements. - - @param sql The SQL statement to be added to the current batch. - This can be any SQL statement that does not return - a result set. - - @exception SQLException If the statement is not open or - the SQL statement contains a syntax - error. - **/ - public void addBatch (String sql) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - settings_.getDecimalSeparator (), escapeProcessing_, - packageCriteria_, connection_); //@G4C - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - if(sqlStatement.countParameters () > 0) - JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - - if(batch_ == null) batch_ = new Vector(); //@P0A - batch_.addElement (sqlStatement); - } - } - - - - /** - Cancels the statement. This is useful when one thread - needs to cancel a statement that is being executed by another - thread. This will close the current result set. - - @exception SQLException If the statement is not open or - an error occurs. - **/ - public void cancel () - throws SQLException - { - // Don't synchronize this method... it needs to be callable // @E6A - // even when the statement is busy. // @E6A - checkOpen (); - - connection_.cancel(id_); // @E5A - - cancelled_ = true; - closeResultSet (JDCursor.REUSE_YES); - } - - - - /** - Checks that the statement is open. Public methods - that require an open statement should call this first. - - @exception SQLException If the statement is not open. - **/ - void checkOpen () - throws SQLException - { - connection_.checkOpen (); - if(closed_) - JDError.throwSQLException (JDError.EXC_FUNCTION_SEQUENCE); - } - - - - // JDBC 2.0 - /** - Clears the current batch of SQL statements. - - @exception SQLException If the statement is not open. - **/ - public void clearBatch () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - if(batch_ == null) batch_ = new Vector(); //@P0A - batch_.removeAllElements (); - } - } - - - - /** - Clears all warnings that have been reported for the statement. - After this call, getWarnings() returns null until a new warning - is reported for the statement. - - @exception SQLException If an error occurs. - **/ - public void clearWarnings () - throws SQLException - { - sqlWarning_ = null; - } - - - - /** - Releases the statement's resources immediately instead of waiting - for them to be automatically released. This closes the current - result set. - - @exception SQLException If an error occurs. - **/ - // - // Implementation note: - // - // It is a requirement to not get replies during a finalize() - // method. Since finalize() calls this method, this requirement - // applies here, too. - // - public void close () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - // If this is already closed, then just do nothing. - // - // The spec does not define what happens when a connection - // is closed multiple times. The official word from the Sun - // JDBC team is that "the driver's behavior in this case - // is implementation defined. Applications that do this are - // non-portable." - if(isClosed ()) - return; - - // Close the current result set. (Note: This has no - // effect if the user explicitly closed the result set - // before closing the statement. - //@PDA perf2 comment: if we get back 700,2 from fetch, then cursor is already closed, but resultSet_ is still usable - //if(! cursor_.isClosed()) //@perf3 cursor can be closed, but resultset still needs to be closed. closeResultSet checks for closed cursor before closing cursor. - //{ // @B3A //@perf3 - closeResultSet (JDCursor.REUSE_NO); - //} // @B3A //@perf3 - - // If, even after closing the current result set, - // there are more result sets that were returned, we - // need to close them, too. At first I though we - // would have to Open/Describe and Close each one - // in turn, but the database host server allows us to - // close the current cursor with REUSE_NO to close - // all remaining result sets. The catch is that we - // need to have an open cursor before closing it, so - // we open the next cursor, then close it again. - // This closes all remaining result sets. - if(numberOfResults_ > 1) - { - getMoreResults (); - cursor_.close (JDCursor.REUSE_NO); - } - - if(generatedKeys_ != null) //@PDA genkeys - { - generatedKeys_.close(); - generatedKeys_ = null; - } - - //@KBL If the user specified to keep statements open until a transaction boundary and locators are associated - // with the statement, do not close the RPB or ORS until a transaction boundary is reached. - if(isAssociatedWithLocators() && (connection_.getProperties().getBoolean(JDProperties.HOLD_STATEMENTS)) && (connection_.getAutoCommit() == false)) - { - setHoldStatement(true); - closed_ = true; // Want the statement to only be available for use internally, user should not be able to use the statement. - - if (commonExecuteReply != null) { commonExecuteReply.returnToPool(); commonExecuteReply = null; } - if (connectReply != null) { connectReply.returnToPool(); connectReply = null; } - if (execImmediateReply != null) { execImmediateReply.returnToPool(); execImmediateReply = null; } - if (normalPrepareReply != null) { normalPrepareReply.returnToPool(); normalPrepareReply = null; } - if (getMoreResultsReply != null) { getMoreResultsReply.returnToPool(); getMoreResultsReply = null; } - return; // Mark the statement as closed, but don't notify the connection it has been closed or delete the RPB and ORS. - } - - // Delete the RPB. Remember the error information @EDC - // in order to report later... @EDC - SQLException e = null; // @EDA - if(rpbCreated_) - { // @EDA - DBSQLRPBDS request3 = null; //@P0A - DBReplyRequestedDS closeReply = null; //@P0A - try - { //@P0A - request3 = DBDSPool.getDBSQLRPBDS(DBSQLRPBDS.FUNCTIONID_DELETE_RPB, id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); //@P0C - - closeReply = connection_.sendAndReceive(request3, id_); // @EDC @P0C - - int errorClass = closeReply.getErrorClass(); // @EDA - int returnCode = closeReply.getReturnCode(); // @EDA - if(errorClass != 0) - { // @EDA - if(returnCode < 0) - { // @EDA - try - { // @EDA - JDError.throwSQLException(connection_, id_, errorClass, returnCode); // @EDA - } // @EDA - catch(SQLException e2) - { // @EDA - e = e2; // @EDA - } // @EDA - } // @EDA - else - { // @EDA - postWarning (JDError.getSQLWarning(connection_, id_, errorClass, returnCode)); // @EDA - } // @EDA - } // @EDA - } - finally - { //@P0A - if(request3 != null) { - request3.returnToPool(); request3=null; - } - if(closeReply != null) { - closeReply.returnToPool();closeReply=null; - } - } - } // @EDA - - // Delete the ORS. - // - // @EDD // We must use get a reply here even though we do not - // @EDD // need any information from it. Otherwise the next - // @EDD // flow would be based on this ORS, which gets deleted. - // @EDD // In that case, we would always get an "ORS not found" - // @EDD // error. - // @EDD // - // @EDD // In this case, we also need it to force a send of - // @EDD // all of the previous datastreams, since this is the - // @EDD // last one for this statement. - // - // Make sure not to base future requests on this ORS. // @EDA - // - //@P0DDBSQLResultSetDS request2 = new DBSQLResultSetDS ( - //@P0D DBSQLResultSetDS.FUNCTIONID_DELETE_RESULTS_SET, - //@P0D id_, 0, 0); // @EDC - DBSQLResultSetDS request2 = null; //@P0A - try - { //@P0A - request2 = DBDSPool.getDBSQLResultSetDS(DBSQLResultSetDS.FUNCTIONID_DELETE_RESULTS_SET, id_, 0, 0); //@P0C - - connection_.send(request2, id_, false); // @EDC - } - finally - { //@P0A - if(request2 != null) { - request2.returnToPool(); request2=null; - } - } - - // Ignore errors, since we would not be able to get - // the message text anyway (because the ORS is gone.) - - // free the pooled commonExecuteReply - if (commonExecuteReply != null) { commonExecuteReply.returnToPool(); commonExecuteReply = null; } - if (connectReply != null) { connectReply.returnToPool(); connectReply = null; } - if (execImmediateReply != null) { execImmediateReply.returnToPool(); execImmediateReply = null; } - if (normalPrepareReply != null) { normalPrepareReply.returnToPool(); normalPrepareReply = null; } - if (getMoreResultsReply != null) { getMoreResultsReply.returnToPool(); getMoreResultsReply = null; } - closed_ = true; - connection_.notifyClose (this, id_); - - if(JDTrace.isTraceOn()) - JDTrace.logClose (this); - - // Rethrow any exception that surfaced when deleting the RPB. @EDA - if(e != null) // @EDA - throw e; // @EDA - } - } - - //@KBL - /* - Finish releasing a partially-closed statement's resources. A statement may become partially closed if, for example, - the user called close on the statement and it was associated with a locator. - This method will delete any RPB and ORS associated with the statement.". - @exception SQLException if an error occurs - */ - void finishClosing() - throws SQLException - { - synchronized(internalLock_) - { - // Delete the RPB. Remember the error information - // in order to report later... - SQLException e = null; - if(rpbCreated_) - { - DBSQLRPBDS request3 = null; - DBReplyRequestedDS finishClosingReply = null; - try - { - request3 = DBDSPool.getDBSQLRPBDS(DBSQLRPBDS.FUNCTIONID_DELETE_RPB, id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); //@P0C - - finishClosingReply = connection_.sendAndReceive(request3, id_); - - int errorClass = finishClosingReply.getErrorClass(); - int returnCode = finishClosingReply.getReturnCode(); - if(errorClass != 0) - { - if(returnCode < 0) - { - try - { - JDError.throwSQLException(connection_, id_, errorClass, returnCode); - } - catch(SQLException e2) - { - e = e2; - } - } - else - { - postWarning (JDError.getSQLWarning(connection_, id_, errorClass, returnCode)); - } - } - } - finally - { - if(request3 != null) { request3.returnToPool(); request3=null; } - if(finishClosingReply != null) { finishClosingReply.returnToPool(); finishClosingReply = null; } - } - } - - // Delete the ORS. - // - // We must use get a reply here even though we do not - // need any information from it. Otherwise the next - // flow would be based on this ORS, which gets deleted. - // In that case, we would always get an "ORS not found" - // error. - // In this case, we also need it to force a send of - // all of the previous datastreams, since this is the - // last one for this statement. - // - // Make sure not to base future requests on this ORS. - DBSQLResultSetDS request2 = null; - try - { - request2 = DBDSPool.getDBSQLResultSetDS(DBSQLResultSetDS.FUNCTIONID_DELETE_RESULTS_SET, id_, 0, 0); - - connection_.send(request2, id_, false); - } - finally - { - if(request2 != null) { - request2.returnToPool(); request2 = null; - } - } - - // Ignore errors, since we would not be able to get - // the message text anyway (because the ORS is gone.) - - closed_ = true; - setHoldStatement(false); //the statement is no longer left open - connection_.notifyClose (this, id_); - - if(JDTrace.isTraceOn()) - JDTrace.logClose (this); - - // Rethrow any exception that surfaced when deleting the RPB. - if(e != null) - throw e; - } - - } - - /** - Closes the result set and cursor. - - @param reuseFlag Either JDCursor.REUSE_NO, - JDCursor.REUSE_YES, or - JDCursor.REUSE_RESULT_SET. - - @exception SQLException If an error occurs. - **/ - void closeResultSet (int reuseFlag) // private protected - throws SQLException - { - if(resultSet_ != null) - { - if(! resultSet_.isClosed ()) - resultSet_.close (); - resultSet_ = null; - } - - if (threadInterrupted) { - // Force a close to be flowed - try { - cursor_.setState(false); - cursor_.close (reuseFlag); - } catch (Exception e) { - - } - } else { - if(! cursor_.isClosed ()) - cursor_.close (reuseFlag); - } - - updateCount_ = -1; - } - - - - /** - Executes an SQL statement on the IBM i system. - - @param sqlStatement The SQL statement. - @param resultRow The result row or null if none. - - @exception SQLException If the query timeout limit is - exceeded or an error occurs. - **/ - // - // Do not override this method. Instead, override - // commonExecuteBefore() and commonExecuteAfter() as needed. - // - final void commonExecute (JDSQLStatement sqlStatement, - JDServerRow resultRow) // private protected - throws SQLException - { - cancelled_ = false; - - // If the statement is not immediately executable, then - // we still need to do the execute. Otherwise, the execute - // was already done as part of the prepare. - if((! allowImmediate_) || (! sqlStatement.isImmediatelyExecutable ())) - { - - // Sync up the RPB. - syncRPB (); - - boolean usedNameOverride = false; - - // This boolean is true when an Open is needed and - // false when an Execute is needed. - boolean openNeeded = (resultRow != null); - - // If we are prefetching data and a row format - // was returned, then fetch the first block of data. - boolean fetchFirstBlock = ((prefetch_) && (openNeeded)); - - // Send the execute data stream. - try - { - // Determine the appropriate function id, based - // on whether we want to prefetch data, and on whether - // this is an Execute or an Open. - int functionId; - if(openNeeded) - { - if(fetchFirstBlock) - functionId = DBSQLRequestDS.FUNCTIONID_OPEN_DESCRIBE_FETCH; - else - functionId = DBSQLRequestDS.FUNCTIONID_OPEN_DESCRIBE; - } - else - functionId = DBSQLRequestDS.FUNCTIONID_EXECUTE; - - DBSQLRequestDS request = null; //@P0A - // DBReplyRequestedDS replyX = null; //@P0A - int openAttributes = 0; - try - { - //@541 When running to a V5R4 or higher system, we can request to get extended column descriptors - // from a stored procedure result set. In order to do that, we need to set the extended column - // descriptor option on the execute of the statement. - boolean isCall = (sqlStatement.getNativeType () == JDSQLStatement.TYPE_CALL); //@541A moved up from farther below in code - //@F5D Send this on the prepare, not the execute - int requestedORS = DBSQLRequestDS.ORS_BITMAP_RETURN_DATA+DBSQLRequestDS.ORS_BITMAP_SQLCA; //@F3M //@541C undeleted - //@F5D //@F3A If we are on a system that supports extended column descriptors and if the //@F3A - //@F5D //@F3A user asked for them, send the extended column descriptors code point. //@F3A - boolean extendedMetaData = false; //@F3A //@541C undeleted - //@F5D if (connection_.getVRM() >= JDUtilities.vrm520) //@F3A - if(connection_.getVRM() >= JDUtilities.vrm540 && isCall) //@541A - { //@F3A //@541C undeleted - extendedMetaData = connection_.getProperties().getBoolean(JDProperties.EXTENDED_METADATA); //@F3A //@541C undeleted - if (extendedMetaData) //@F3A //@541C undeleted - { //@F3A //@541C undeleted - requestedORS = requestedORS + DBSQLRequestDS.ORS_BITMAP_EXTENDED_COLUMN_DESCRIPTORS; //@F3A //@541C undeleted - } //@F3A //@541C undeleted - } //@F3A //@541C undeleted - if(connection_.getVRM() >= JDUtilities.vrm610 ) //@cur request cursor attributes //@isol - requestedORS = requestedORS + DBSQLRequestDS.ORS_BITMAP_CURSOR_ATTRIBUTES; //@cur - //@P0A - request = DBDSPool.getDBSQLRequestDS(functionId, id_, requestedORS, 0); //@P0C @F3C @F5C //@541C - - openAttributes = cursor_.getOpenAttributes(sqlStatement, blockCriteria_); //@F7M - if(openNeeded) - { - //@F7D openAttributes = cursor_.getOpenAttributes (sqlStatement, blockCriteria_); - if((autoGeneratedKeys_ == RETURN_GENERATED_KEYS) && connection_.getVRM() >= JDUtilities.vrm610) //@GKA Wrapped INSERT WITH SELECT for generated keys. Result set should be read only, insensitive - request.setOpenAttributes(0x80); //@GKA - else //@GKA - request.setOpenAttributes(openAttributes); - } - else if(extendedMetaData){ //@541A Doing an execute. If running to V5R4 and higher, and the extendedMetaData property is true, set the extended column descriptor option - request.setExtendedColumnDescriptorOption((byte)0xF1); - } - - if(nameOverride_.length() != 0) - { - request.setPrepareStatementName(nameOverride_, connection_.converter_); //@P0C - usedNameOverride = true; - } - - if(packageManager_.isEnabled() && sqlStatement.isPackaged()) - { - request.setPackageName (packageManager_.getName (), connection_.converter_); //@P0C - } - - // If we are prefetching data and a row format - // was returned, then set the blocking factor if a specific number of rows have been asked for - // or variable-length field compression is turned off, otherwise set the buffer size. - if(fetchFirstBlock) - { - request.addOperationResultBitmap(DBSQLRequestDS.ORS_BITMAP_RESULT_DATA); - if((functionId == DBSQLRequestDS.FUNCTIONID_OPEN_DESCRIBE_FETCH) && //@K54 - (useVariableFieldCompression_)) //@K54 - { - //Do not need to set the blocking factor if using variable-length field compression - //If both the buffer size and blocking factor were set, the buffer size will override - //the blocking factor and the number of rows that will fit in the buffer size will be returned - //regardless of the blocking factor value - request.setVariableFieldCompression(true); - request.setBufferSize(blockSize_ * 1024); - } - else { //@K54 - if (resultRow != null) { // @B5A -- check for null pointer - request.setBlockingFactor(getBlockingFactor (sqlStatement, resultRow.getRowLength())); //@K54 changed to just use resultRow.getRowLength() instead of fetchFirstBlock ? resultRow.getRowLength() : 0 - } else { - request.setBlockingFactor(getBlockingFactor (sqlStatement, 0)); //@K54 changed to just use resultRow.getRowLength() instead of fetchFirstBlock ? resultRow.getRowLength() : 0 - } - } - } - - //@K1D //@F8 If we are pre-V5R2, the user set the resultSetType to "TYPE_SCROLL_INSENSITIVE", or - //@K1D //@F8 the user did not change from the default of the "cursor sensitivity" property, - //@K1D //@F8 send what we always have. - //@K1D //@F8 Change in a future release to send CURSOR_SCROLLABLE_INSENSITIVE and - //@K1D //@F8 CURSOR_NOT_SCROLLABLE_INSENSITIVE if resultSetType_ == - //@K1D //@F8 ResultSet.TYPE_SCROLL_INSENSITIVE to v5r1 or later hosts. - String cursorSensitivity = connection_.getProperties().getString(JDProperties.CURSOR_SENSITIVITY); //@F8A - //@K1D if((connection_.getVRM() < JDUtilities.vrm520) //@F8A - //@K1D || (resultSetType_ == ResultSet.TYPE_SCROLL_INSENSITIVE) //@F8A - //@K1D || (cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_ASENSITIVE))) //@F8A - //@K1D { - //@K1D if(resultSetType_ == ResultSet.TYPE_FORWARD_ONLY) - //@K1D request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_ASENSITIVE); - //@K1D else - //@K1D request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_ASENSITIVE); - //@K1D } - //@K1D //@F8 If we are V5R2 or later, send new numbers based on what the user - //@K1D //@F8 set in "cursor sensitivity" property //@F8A - //@K1D else if(resultSetType_ == ResultSet.TYPE_FORWARD_ONLY) - //@K1D { - //@K1D if(cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_INSENSITIVE)) //@F8A - //@K1D request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_INSENSITIVE); //@F8A - //@K1D else //else property set to sensitive //@F8A - //@K1D request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_SENSITIVE); //@F8A - //@K1D } - //@K1D //@F8 Else, resultSetType_ is ResultSet.TYPE_CURSOR_SENSITIVE - //@K1D else - //@K1D { - //@K1D if(cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_INSENSITIVE)) //@F8A - //@K1D request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_INSENSITIVE); //@F8A - //@K1D else //else property set to sensitive //@F8A - //@K1D request.setScrollableCursorFlag(DBSQLRequestDS.CURSOR_SCROLLABLE_SENSITIVE); //@F8A - //@K1D } - //If earlier than V5R2, do what we always have //@K1A - if(connection_.getVRM() < JDUtilities.vrm520) //@K1A - { - //@K1A - if(resultSetType_ == ResultSet.TYPE_FORWARD_ONLY) //@K1A - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_ASENSITIVE); //@K1A Option 0 - else //@K1A - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_ASENSITIVE); //@K1A Option 1 - } //@K1A - else if ((autoGeneratedKeys_ == RETURN_GENERATED_KEYS) && connection_.getVRM() >= JDUtilities.vrm610) //@GKA - { //@GKA - // The user requested generated keys so we wrapped the INSERT with a SELECT //@GKA - // The result set returned will be for the generated keys and should be read-only, insensitive //@GKA - // We want to ignore any property or settings specified on the STATEMENT or CONNECTION //@GKA - request.setScrollableCursorFlag(DBSQLRequestDS.CURSOR_SCROLLABLE_INSENSITIVE); //@GKA - } //@GKA - else if(resultSetType_ == ResultSet.TYPE_FORWARD_ONLY) //@K1A - { - //@K1A - //Determine if user set cursor sensitivity property //@K1A - //if ResultSet is updateable, then we cannot have a insensitive cursor //@K1A - if(cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_INSENSITIVE) && (resultSetConcurrency_ == ResultSet.CONCUR_READ_ONLY)) //@K1A - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_INSENSITIVE); //@K1A Option 5 - else if(cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_SENSITIVE)) //@PDA - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_SENSITIVE); //@PDA Option 4 - else //@K1A - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_ASENSITIVE); //@K1A Option 0 - } //@K1A - else if(resultSetType_ == ResultSet.TYPE_SCROLL_SENSITIVE) //@K1A - { - //@K1A - //Determine if user set cursor sensitivity property //@K1A - if(cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_SENSITIVE)) //@K1A - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_SENSITIVE); //@K1A Option 1 - else //@K1A - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_ASENSITIVE); //@K1A Option 3 - } //@K1A - else //ResultSet.TYPE_SCROLL_INSENSITIVE //@K1A - { - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_INSENSITIVE); //@K1A Option 2 - } //@K1A - - // Check system level before sending new code point - if(connection_.getVRM() >= JDUtilities.vrm520) // @G4A - { - // @G4A - if(resultSetHoldability_ == AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT) // @G4A - request.setResultSetHoldabilityOption((byte)0xD5); // @G4A - else if(resultSetHoldability_ == AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT) // @G4A - request.setResultSetHoldabilityOption((byte)0xE8); // @G4A - // else resultSetHoldability_ == AS400JDBCResultSet.HOLDABILITY_NOT_SPECIFIED, // @G4A - // so don't send the code point because the user did not tell us to // @G4A - } - - commonExecuteBefore(sqlStatement, request); - - if (commonExecuteReply != null) { commonExecuteReply.returnToPool(); commonExecuteReply=null; } - - commonExecuteReply = connection_.sendAndReceive(request, id_); //@P0C - - - // Gather information from the reply. - cursor_.processConcurrencyOverride(openAttributes, commonExecuteReply); // @E1A @EAC - - cursor_.processCursorAttributes(commonExecuteReply); //@cur - - transactionManager_.processCommitOnReturn(commonExecuteReply); // @E2A - DBReplySQLCA sqlca = commonExecuteReply.getSQLCA(); - DBData resultData = null; - if(fetchFirstBlock) resultData = commonExecuteReply.getResultData(); - - // Note the number of rows inserted/updated - rowsInserted_ = sqlca.getErrd(3); // @G5A - - // Check for system errors. Take note on prefetch - // if the last block was fetched. - int errorClass = commonExecuteReply.getErrorClass(); - int returnCode = commonExecuteReply.getReturnCode(); - - // Remember that a cursor is open even when most - // errors occur. - // - // Except: - // * When a query timeout occurs, the system - // does not leave a cursor open. - if(openNeeded && (errorClass != 1 || returnCode != -666)) cursor_.setState(false); - - // Take note on prefetch if the last block was fetched. - boolean lastBlock = false; - boolean bypassExceptionWarning = false; //@pda (issue 32120) in special errorClass/returnCode cases below, we use sqlca to see if there is a real error - if((((errorClass == 1) && (returnCode == 100)) - || ((errorClass == 2) && (returnCode == 701))) - && functionId == DBSQLRequestDS.FUNCTIONID_OPEN_DESCRIBE_FETCH) // make sure we attempted to prefetch data, otherwise post a warning - { - lastBlock = true; - returnCode = sqlca.getSQLCode(); //@pda (issue 32120) get rc from SQLCA - String sqlState = sqlca.getSQLState (connection_.converter_); //@issue 34500 - if(sqlState.startsWith("00") || sqlState.startsWith("02")) //@pda (issue 32120) //@issue 34500 //@35199 - bypassExceptionWarning = true; //@pda (issue 32120) - } - else if((errorClass == 2) && (returnCode == 700) - && (functionId == DBSQLRequestDS.FUNCTIONID_OPEN_DESCRIBE_FETCH)) //@pda perf2 - fetch/close - { - lastBlock = true; - cursor_.setState(true); //closed cursor already on system - returnCode = sqlca.getSQLCode(); //@pda (issue 32120) get rc from SQLCA - String sqlState = sqlca.getSQLState (connection_.converter_); //@issue 34500 - if(sqlState.startsWith("00") || sqlState.startsWith("02")) //@pda (issue 32120) //@issue 34500 //@35199 - bypassExceptionWarning = true; //@pda (issue 32120) - } - - - //else //@PDD check for errors even on cases above (issue 32120) - if(errorClass != 0 && bypassExceptionWarning == false) //@pdc (issue 32120) - { - positionOfSyntaxError_ = sqlca.getErrd(5); //@F10A - - if(returnCode < 0) - { - JDError.throwSQLException(connection_, id_, errorClass, returnCode); - } - else - { - String sqlState = sqlca.getSQLState (connection_.converter_); //@igwrn - if( connection_.getProperties().getString(JDProperties.IGNORE_WARNINGS).toUpperCase().indexOf(sqlState) == -1 ) //@igwrn - postWarning(JDError.getSQLWarning(connection_, id_, errorClass, returnCode)); - } - } - - //Make an auto-generated key result set if it was requested //@G4A - if(autoGeneratedKeys_ == RETURN_GENERATED_KEYS && //@G4A - (connection_.getVRM() >= JDUtilities.vrm520) && ((connection_.getVRM() < JDUtilities.vrm610) || !sqlStatement.isSelectFromInsert())) //@F5A @F6C @GKC - //@F6D&& generatedKeys_ == null) //@F5A - makeGeneratedKeyResultSet(returnCode, sqlca); //@G4A - else if(generatedKeys_ != null) //@PDA genkeys - handle previous genkeys - { - generatedKeys_.close(); - generatedKeys_ = null; - } - - - //@F5D This belongs on the prepare, not the execute - //@F5D @F3A If user asked us to parse out extended metadata, then make an object - //@F5D if (extendedMetaData) //@F3A - //@F5D { //@F3A - //@F5D extendedColumnDescriptors_ = reply.getExtendedColumnDescriptors(); //@F3A - //@F5D } //@F3A - - // Compute the update count and result set . - if(openNeeded) - { - // @B5A Check for null pointer. - int rowLength = 0; - if (resultRow != null) { - rowLength = resultRow.getRowLength(); - } - JDServerRowCache rowCache; - if((fetchFirstBlock) && (resultData != null)) - rowCache = new JDServerRowCache (resultRow, - connection_, id_, - getBlockingFactor (sqlStatement, rowLength), resultData, - lastBlock, resultSetType_, cursor_); //@pdc perf2 - fetch/close - else - rowCache = new JDServerRowCache (resultRow, - connection_, id_, - getBlockingFactor (sqlStatement, rowLength), lastBlock, resultSetType_, cursor_); //@PDC perf //@pdc perf2 - fetch/close - - // If the result set concurrency is updatable, check to @E1C - // see if the system overrode the cursor type to read only. @E1C - // Don't worry about the other direction (system overrides @E1C - // from read-only to updatable). @E1C - int actualConcurrency = (resultSetConcurrency_ == ResultSet.CONCUR_UPDATABLE) // @E1C - ? cursor_.getConcurrency() : resultSetConcurrency_; // @E1C @EAC - - if((autoGeneratedKeys_ == RETURN_GENERATED_KEYS) && (connection_.getVRM() >= JDUtilities.vrm610) && sqlStatement.isSelectFromInsert()) //@GKA - { - // this will be the generated keys result set //@GKA - updateCount_ = sqlca.getErrd(3); //@GKA - rowCountEstimate_ = -1; //@GKA - generatedKeys_ = new AS400JDBCResultSet (this, sqlStatement, rowCache, connection_.getCatalog(),//@GKA - cursor_.getName(), maxRows_, //@GKA - ResultSet.TYPE_SCROLL_INSENSITIVE, //@GKA - ResultSet.CONCUR_READ_ONLY, fetchDirection_, fetchSize_); //@GKA - } //@GKA - else //@GKA - { //@GKA - updateCount_ = -1; // @ECM - rowCountEstimate_ = sqlca.getErrd (3); //@F1C // @ECA - resultSet_ = new AS400JDBCResultSet (this, - sqlStatement, rowCache, connection_.getCatalog(), - cursor_.getName(), maxRows_, resultSetType_, - actualConcurrency, fetchDirection_, fetchSize_); // @E1C - if(resultSet_.getConcurrency () != resultSetConcurrency_ && resultSetConcurrency_ == ResultSet.CONCUR_UPDATABLE) //@nowarn only warn if concurrency level is lessened - postWarning (JDError.getSQLWarning (JDError.WARN_OPTION_VALUE_CHANGED)); - } //@GKA - } - else - { - updateCount_ = sqlca.getErrd (3); //@F1C - rowCountEstimate_ = -1; // @ECC - } - - // Compute the number of results. - //@541D boolean isCall = (sqlStatement.getNativeType () == JDSQLStatement.TYPE_CALL); - if(isCall) - numberOfResults_ = sqlca.getErrd (2); //@F1C - else - numberOfResults_ = 0; - - if(extendedMetaData) //@541A - { - extendedColumnDescriptors_ = commonExecuteReply.getExtendedColumnDescriptors (); //@F5A - } - - // If this is a CALL and result sets came back, but - // no format was returned, then open the cursor. The - // result set must be forward only and read only. - // This is a system restriction. @EBA - // As of V5R3 the restriction to be forward only no longer applies @KBA - if(sqlStatement != null) - { - if((isCall) && (numberOfResults_ > 0) && (resultSet_ == null)) - { - boolean preV5R3 = connection_.getVRM() < JDUtilities.vrm530; - - // Change the result set type based on the current attributes - // unless forward only cursors were requested. This must - // be kept in sync with similar code ins AS400JDBCResultSet - // @C4A - int callResultSetType ; - if (resultSetType_ == ResultSet.TYPE_FORWARD_ONLY) { - // The user requested FORWARD_ONLY, so the result set will - // only be usable as forward only. - callResultSetType = ResultSet.TYPE_FORWARD_ONLY; - } else if(cursor_.getCursorAttributeScrollable() == 0) - callResultSetType = ResultSet.TYPE_FORWARD_ONLY; - else if(cursor_.getCursorAttributeSensitive() == 0) - callResultSetType = ResultSet.TYPE_SCROLL_INSENSITIVE; - else if(cursor_.getCursorAttributeSensitive() == 1) - callResultSetType = ResultSet.TYPE_SCROLL_SENSITIVE; - else - callResultSetType = resultSetType_; - - JDServerRow row = new JDServerRow ( - connection_, id_, cursor_.openDescribe (openAttributes, - callResultSetType), settings_); //@KBA - JDServerRowCache rowCache = new JDServerRowCache (row, - connection_, id_, getBlockingFactor (sqlStatement, - row.getRowLength()), false, (preV5R3 ? ResultSet.TYPE_FORWARD_ONLY : resultSetType_), cursor_); //@PDC perf //@pda perf2 - fetch/close - //if pre-v5r3 create a FORWARD_ONLY RESULT SET - if(preV5R3) //@KBA - { - resultSet_ = new AS400JDBCResultSet (this, - sqlStatement, rowCache, connection_.getCatalog(), - cursor_.getName(), maxRows_, ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY, fetchDirection_, - fetchSize_); - } - else //@KBA - { //@KBA - resultSet_ = new AS400JDBCResultSet (this, //@KBA - sqlStatement, rowCache, connection_.getCatalog(), //@KBA - cursor_.getName(), maxRows_, callResultSetType, //@KBA - ResultSet.CONCUR_READ_ONLY, fetchDirection_, //@KBA - fetchSize_); //@KBA - } - - if(resultSet_.getConcurrency () != resultSetConcurrency_) - postWarning (JDError.getSQLWarning (JDError.WARN_OPTION_VALUE_CHANGED)); - } - } - - commonExecuteAfter (sqlStatement, commonExecuteReply); - } catch (SQLException sqlex) { - - // Handle interrupted exception - String messageText = sqlex.getMessage(); - messageText = messageText.toLowerCase(); - if (messageText.indexOf("internal driver error") >= 0) { - if (messageText.indexOf("interrupted") > 0) { - threadInterrupted = true; - } - } - throw sqlex; - } - finally - { //@P0A - if(request != null) { - request.returnToPool(); request = null; - } - // This can be returned. See comment at declaration. @B5A - if (commonExecuteReply != null) { commonExecuteReply.returnToPool(); commonExecuteReply = null; } - - } - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - - // Inform the transaction manager that a statement - // was executed. - transactionManager_.statementExecuted (); - - // Check to see if the statement was cancelled. - if(cancelled_) - JDError.throwSQLException (JDError.EXC_OPERATION_CANCELLED); - - // Output a summary as a trace message. The * signifies that the - // statement name comes from the RPB. - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, - "Executed " + (usedNameOverride ? (nameOverride_) : (name_ + "*")) - + ", SQL Statement --> [" + sqlStatement + "]"); - JDTrace.logInformation (this, - "Update count = " + updateCount_); - JDTrace.logInformation (this, - "Result set = " + (resultSet_ != null)); - JDTrace.logInformation (this, - "Number of result sets = " + numberOfResults_); - JDTrace.logInformation (this, // @ECA - "Row count estimate = " + rowCountEstimate_); // @ECA - } - } - } - - - /** - Performs common operations needed after an execute. - - @param sqlStatement The SQL statement. - @param reply The execute reply. - - @exception SQLException If an error occurs. - **/ - // - // This method is intended to be overriden, if needed. - // - void commonExecuteAfter (JDSQLStatement sqlStatement, - DBReplyRequestedDS reply) // private protected - throws SQLException - { - // Nothing. - } - - - - /** - Performs common operations needed before an execute. - - @param sqlStatement The SQL statement. - @param request The execute request. - - @exception SQLException If an error occurs. - **/ - // - // This method is intended to be overriden, if needed. - // - void commonExecuteBefore (JDSQLStatement sqlStatement, - DBSQLRequestDS request) // private protected - throws SQLException - { - // Clear warnings. - clearWarnings (); - } - - - - /** - Prepares (pre-compiles) the SQL statement on the IBM i system. - - @param sqlStatement The SQL statement. - @return The result row or null if none. - - @exception SQLException If an error occurs. - **/ - // - // Do not override this method. Instead, override - // commonPrepareBefore(), commonPrepareAfter() and - // commonPrepareBypass() as needed. - // - JDServerRow commonPrepare (JDSQLStatement sqlStatement) // private protected - throws SQLException - { - cancelled_ = false; - - connection_.checkAccess (sqlStatement); - JDServerRow resultRow = null; - nameOverride_ = ""; - - // Check for DRDA connect or disconnect. @B1A - if(sqlStatement.isDRDAConnect ()) - { - connection_.setDRDA (true); - - // It is possible at this point, that current statement - // id does not follow the DRDA rules (defined in - // AS400JDBCConnection.getUnusedId()), but we will not - // work around that at this point. This simple workaround - // is to create a new Statement immediately after connecting. - } - else if(sqlStatement.isDRDADisconnect ()) - connection_.setDRDA (false); - - // Create the SQL package if necessary. - if(! packageManager_.isCreated()) - packageManager_.create (); - - // There are three distinct cases. Exactly one of these - // branches will be taken. - - // CASE 1: The statement appears in the cached package. - // - // If the SQL package is cached, check to see if this SQL - // statement is in there. If so, then gather data accordingly - // and skip the prepare. - // - if(packageManager_.isCached()) - { - if(sqlStatement.isPackaged()) - { - int i = packageManager_.getCachedStatementIndex (sqlStatement); - if(i != -1) - { - - // Gather results from package cache. - DBDataFormat dataFormat = packageManager_.getCachedDataFormat (i); - if(dataFormat == null) - resultRow = null; - else - resultRow = new JDServerRow (connection_, id_, - dataFormat, settings_); - //@re-prep check if one of the columns is a lob or locator on resultset columns - if( resultRow != null && resultRow.containsLob_) //@re-prep - { - resultRow = null; //@re-prep output lobs - } //@re-prep - - commonPrepareBypass (sqlStatement, i); - - //@re-prep input lobs on prepared statement - if(parameterRow_ != null && parameterRow_.containsLob_) //@re-prep - { //@re-prep - nameOverride_ = ""; //@re-prep - // Output a summary as a trace message. - if(JDTrace.isTraceOn()) //@re-prep - JDTrace.logInformation (this, - "Statement [" + sqlStatement + "] was found " - + "in the cached package " - + " but must be re-prepared since it contains a lob or locator"); //@re-prep - } //@re-prep - else //@re-prep - { //@re-prep - nameOverride_ = packageManager_.getCachedStatementName (i); - // Output a summary as a trace message. - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, - "Statement [" + sqlStatement + "] was found " - + "in the cached package as " + nameOverride_); - } //@re-prep - } - } - } - - // If the SQL package is not cached, then we must prepare - // the statement on the system. - if(nameOverride_.length() == 0) - { - - // @E7A - start - // - // CASE 2a: Statement is a DRDA CONNECT. - // - if(sqlStatement.getNativeType() == JDSQLStatement.TYPE_CONNECT) - { - - // Sync up the RPB. - syncRPB(); - - DBSQLRequestDS request = null; //@P0A - try - { - - request = DBDSPool.getDBSQLRequestDS(DBSQLRequestDS.FUNCTIONID_CONNECT, id_, DBSQLRequestDS.ORS_BITMAP_RETURN_DATA+DBSQLRequestDS.ORS_BITMAP_SQLCA, 0); //@P0C - - boolean extended = false; //@540 - if(connection_.getVRM() >= JDUtilities.vrm540) extended = true; //@540 - //Bidi-HCG request.setStatementText(sqlStatement.toString(), connection_.unicodeConverter_, extended); //@E3C @P0C @540C - request.setStatementText(sqlStatement.toString(), connection_.packageCCSID_Converter, extended);//Bidi-HCG - request.setStatementType (sqlStatement.getNativeType ()); - - if(packageManager_.isEnabled()) - { - if(sqlStatement.isPackaged()) - { - request.setPrepareOption (1); - request.setPackageName (packageManager_.getName (), connection_.converter_); //@P0C - } - else - { - request.setPrepareOption (0); - request.setPackageName(null, connection_.converter_); //send empty code point per - } - } - else - request.setPrepareOption (0); - - commonPrepareBefore (sqlStatement, request); - commonExecuteBefore (sqlStatement, request); - - if (execImmediateReply != null) { - execImmediateReply.returnToPool(); execImmediateReply = null; - } - if (normalPrepareReply != null) { - normalPrepareReply.returnToPool();normalPrepareReply = null; - } - if (connectReply != null) { connectReply.returnToPool(); connectReply=null; } - connectReply = connection_.sendAndReceive (request, id_); //@P0C - - int errorClass = connectReply.getErrorClass(); - int returnCode = connectReply.getReturnCode(); - - if(errorClass != 0) - { - positionOfSyntaxError_ = connectReply.getSQLCA().getErrd(5); //@F10A - - if(returnCode < 0) - JDError.throwSQLException (connection_, id_, errorClass, returnCode); - else - postWarning (JDError.getSQLWarning (connection_, id_, errorClass, returnCode)); - } - - // Compute the update count and number of results. - updateCount_ = 0; - numberOfResults_ = 0; - - commonPrepareAfter (sqlStatement, connectReply); - commonExecuteAfter (sqlStatement, connectReply); - - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - finally - { //@P0A - if(request != null) { - request.returnToPool(); request=null; - } - if (connectReply != null) { connectReply.returnToPool(); connectReply = null; } /*@B5A*/ - - } - - // Inform the transaction manager that a statement - // was executed. - transactionManager_.statementExecuted (); - - // Output a summary as a trace message. The * signifies that the - // statement name comes from the RPB. - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, - "Executed connect " + name_ + "*, SQL Statement -->[" + sqlStatement + "]"); - } - - } - // @E7A - end - - // CASE 2: Statement can be executed immediately. - // - // This is essentially the prepare and execute combined - // in one datastream. We will then be able to skip the - // execute step later. - // - else if((allowImmediate_) && (sqlStatement.isImmediatelyExecutable ())) - { // @E7C - - // Sync up the RPB. - syncRPB (); - - DBSQLRequestDS request = null; //@P0A - try - { - - int requestedORS = DBSQLRequestDS.ORS_BITMAP_RETURN_DATA+DBSQLRequestDS.ORS_BITMAP_SQLCA; //@F5A - boolean isCall = (sqlStatement.getNativeType () == JDSQLStatement.TYPE_CALL); //@cur - if(connection_.getVRM() >= JDUtilities.vrm610 ) //@cur //@isol - requestedORS += DBSQLRequestDS.ORS_BITMAP_CURSOR_ATTRIBUTES; //@cur - //@F5A If we are on a system that supports extended column descriptors and if the //@F5A - //@F5A user asked for them, send the extended column descriptors code point. //@F5A - boolean extendedMetaData = false; //@F5A - if(connection_.getVRM() >= JDUtilities.vrm520) //@F5A - { - //@F5A - extendedMetaData = connection_.getProperties().getBoolean(JDProperties.EXTENDED_METADATA); //@F5A - if(extendedMetaData) //@F5A - { - //@F5A - requestedORS = requestedORS + DBSQLRequestDS.ORS_BITMAP_EXTENDED_COLUMN_DESCRIPTORS; //@F5A - } //@F5A - } - - request = DBDSPool.getDBSQLRequestDS (DBSQLRequestDS.FUNCTIONID_EXECUTE_IMMEDIATE, id_, requestedORS, 0); //@P0C @F5C - - boolean extended = false; //@540 - if(connection_.getVRM() >= JDUtilities.vrm540) extended = true; //@540 - //Bidi-HCG request.setStatementText(sqlStatement.toString(), connection_.unicodeConverter_, extended); //@E3C @P0C @540C - request.setStatementText(sqlStatement.toString(), connection_.packageCCSID_Converter, extended);//Bidi-HCG - request.setStatementType (sqlStatement.getNativeType ()); - - int openAttributes = cursor_.getOpenAttributes (sqlStatement, blockCriteria_); - request.setOpenAttributes (openAttributes); - - if(packageManager_.isEnabled()) - { - if(sqlStatement.isPackaged()) - { - request.setPrepareOption (1); - request.setPackageName (packageManager_.getName (), connection_.converter_); //@P0C - } - else - { - request.setPrepareOption (0); - request.setPackageName(null, connection_.converter_); //send empty code point - } - } - else - request.setPrepareOption (0); - - //@F5A Don't have to check if a v5r2 system, because extendedMetaData - //@F5A can only be true if we are running to v5r2 - if(extendedMetaData) //@F5A - { - //@F5A - request.setExtendedColumnDescriptorOption((byte)0xF1); //@F5A - } //@F5A - - commonPrepareBefore (sqlStatement, request); - commonExecuteBefore (sqlStatement, request); - - if (connectReply != null) { - connectReply.returnToPool();connectReply = null; - } - if (normalPrepareReply != null) { - normalPrepareReply.returnToPool();normalPrepareReply = null; - } - - if (execImmediateReply != null) { execImmediateReply.returnToPool(); execImmediateReply=null;} - execImmediateReply = connection_.sendAndReceive (request, id_); //@P0C - - int errorClass = execImmediateReply.getErrorClass(); - int returnCode = execImmediateReply.getReturnCode(); - - DBReplySQLCA sqlca = execImmediateReply.getSQLCA (); //@F10M - - if(errorClass != 0) - { - positionOfSyntaxError_ = sqlca.getErrd(5); //@F10A - if(returnCode < 0) - JDError.throwSQLException (connection_, id_, errorClass, returnCode); - else - postWarning (JDError.getSQLWarning (connection_, id_, errorClass, returnCode)); - } - - transactionManager_.processCommitOnReturn(execImmediateReply); // @E2A - - cursor_.processCursorAttributes(execImmediateReply); //@cur - - // Compute the update count. - //@F10M DBReplySQLCA sqlca = reply.getSQLCA (); - updateCount_ = sqlca.getErrd (3); //@F1C - rowCountEstimate_ = -1; // @ECA - - //@F5A Don't have to check if a v5r2 system, because extendedMetaData - //@F5A can only be true if we are running to v5r2 - if(extendedMetaData) //@F5A - { - //@F5A - extendedColumnDescriptors_ = execImmediateReply.getExtendedColumnDescriptors (); //@F5A - } //@F5A - - //Make an auto-generated key result set if it was requested //@F5A - // Note: This should not happen if running to a release after V5R4 as the insert will always be wrapped with a SELECT //@GKA - if(autoGeneratedKeys_ == RETURN_GENERATED_KEYS && //@F5A - (connection_.getVRM() >= JDUtilities.vrm520)) //@F5A - makeGeneratedKeyResultSet(returnCode, sqlca); //@F5A - else if(generatedKeys_ != null) //@PDA genkeys - handle previous genkeys - { - generatedKeys_.close(); - generatedKeys_ = null; - } - - // Compute the number of results. - //boolean isCall = (sqlStatement.getNativeType () == JDSQLStatement.TYPE_CALL); //@cur moved above - if( /*(numberOfResults_ == 0) && */(isCall)) - numberOfResults_ = sqlca.getErrd (2); //@F1C - else - numberOfResults_ = 0; - - // If this is a CALL and result sets came back, but - // no format was returned, then open the cursor. The result - // set must be forward only and read only. - // This is a system restriction. @EBA - // As of V5R3, the restriction to be forward only no longer applies @KBA - if((isCall == true) && (numberOfResults_ > 0)) - { - boolean preV5R3 = connection_.getVRM() < JDUtilities.vrm530; - JDServerRow row = new JDServerRow (connection_, id_, - cursor_.openDescribe (openAttributes, resultSetType_), //@KBA - settings_); - JDServerRowCache rowCache = new JDServerRowCache (row, connection_, id_, getBlockingFactor ( - sqlStatement, row.getRowLength()), false, (preV5R3 ? ResultSet.TYPE_FORWARD_ONLY : resultSetType_), cursor_); //@PDC perf //@pda perf2 - fetch/close - - //if pre-v5r3 create a FORWARD_ONLY RESULT SET - if(preV5R3) //@KBA - { - resultSet_ = new AS400JDBCResultSet (this, - sqlStatement, rowCache, connection_.getCatalog(), - cursor_.getName(), maxRows_, ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY, fetchDirection_, - fetchSize_); - } - else //@KBA - { //@KBA - resultSet_ = new AS400JDBCResultSet (this, //@KBA - sqlStatement, rowCache, connection_.getCatalog(), //@KBA - cursor_.getName(), maxRows_, resultSetType_, //@KBA - ResultSet.CONCUR_READ_ONLY, fetchDirection_, //@KBA - fetchSize_); //@KBA - } - - if(resultSet_.getConcurrency () != resultSetConcurrency_) - postWarning (JDError.getSQLWarning (JDError.WARN_OPTION_VALUE_CHANGED)); - } - - commonPrepareAfter (sqlStatement, execImmediateReply); - commonExecuteAfter (sqlStatement, execImmediateReply); - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - finally - { //@P0A - if(request != null) { - request.returnToPool(); request = null; - } - if (execImmediateReply != null) { execImmediateReply.returnToPool(); execImmediateReply = null; } /*@B5A*/ - } - - // Inform the transaction manager that a statement - // was executed. - transactionManager_.statementExecuted (); - - // Output a summary as a trace message. The * signifies that the - // statement name comes from the RPB. - if(JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, - "Executed immediately " + name_ + "*, SQL Statement -->[" + sqlStatement + "]"); - JDTrace.logInformation (this, - "Update count = " + updateCount_); - JDTrace.logInformation (this, - "Result set = " + (resultSet_ != null)); - JDTrace.logInformation (this, - "Number of result sets = " + numberOfResults_); - } - - } - - // CASE 3: Normal prepare. - // - else - { - - // Sync up the RPB. - syncRPB (); - - DBSQLRequestDS request = null; //@P0A - if (normalPrepareReply != null) { - normalPrepareReply.returnToPool(); normalPrepareReply = null; - } /* B5A */ - try - { - int requestedORS = DBSQLRequestDS.ORS_BITMAP_RETURN_DATA+DBSQLRequestDS.ORS_BITMAP_DATA_FORMAT+DBSQLRequestDS.ORS_BITMAP_SQLCA; //@F5A @F10C - //@F5A If we are on a system that supports extended column descriptors and if the //@F5A - //@F5A user asked for them, send the extended column descriptors code point. //@F5A - boolean extendedMetaData = false; //@F5A - if(connection_.getVRM() >= JDUtilities.vrm520) //@F5A - { - //@F5A - extendedMetaData = connection_.getProperties().getBoolean(JDProperties.EXTENDED_METADATA); //@F5A - if(extendedMetaData) //@F5A - { - //@F5A - requestedORS = requestedORS + DBSQLRequestDS.ORS_BITMAP_EXTENDED_COLUMN_DESCRIPTORS; //@F5A - } //@F5A - } - - request = DBDSPool.getDBSQLRequestDS(DBSQLRequestDS.FUNCTIONID_PREPARE_DESCRIBE, id_, requestedORS, 0); //@P0C @F5C - - boolean extended = false; //@540 - if(connection_.getVRM() >= JDUtilities.vrm540) extended = true; //@540 - //Bidi-HCG request.setStatementText(sqlStatement.toString(), connection_.unicodeConverter_, extended); //@E3C @P0C @540C - request.setStatementText(sqlStatement.toString(), connection_.packageCCSID_Converter, extended);//Bidi-HCG - request.setStatementType (sqlStatement.getNativeType ()); - - if(packageManager_.isEnabled()) - { - if(sqlStatement.isPackaged()) - { - request.setPrepareOption (1); - request.setPackageName (packageManager_.getName (), connection_.converter_); //@P0C - } - else - { - request.setPrepareOption (0); - request.setPackageName(null, connection_.converter_); //send empty code point - } - } - else - request.setPrepareOption (0); - - //@F5A Don't have to check if a v5r2 system, because extendedMetaData - //@F5A can only be true if we are running to v5r2 - if(extendedMetaData) //@F5A - { - //@F5A - request.setExtendedColumnDescriptorOption((byte)0xF1); //@F5A - } //@F5A - - commonPrepareBefore (sqlStatement, request); - if (execImmediateReply != null) { - execImmediateReply.returnToPool();execImmediateReply = null; - } - if (connectReply != null) { - connectReply.returnToPool();connectReply = null; - } - - if (normalPrepareReply != null) { normalPrepareReply.returnToPool(); normalPrepareReply=null; } - normalPrepareReply = connection_.sendAndReceive (request, id_); //@P0C - - int errorClass = normalPrepareReply.getErrorClass(); - int returnCode = normalPrepareReply.getReturnCode(); - - if(errorClass != 0) - { - positionOfSyntaxError_ = normalPrepareReply.getSQLCA().getErrd(5); //@F10A - - if(returnCode < 0) - JDError.throwSQLException (connection_, id_, errorClass, returnCode); - else - postWarning (JDError.getSQLWarning (connection_, id_, errorClass, returnCode)); - } - - // Gather results from the reply. - DBDataFormat dataFormat = normalPrepareReply.getDataFormat (); - if(dataFormat == null) - resultRow = null; - else - resultRow = new JDServerRow (connection_, id_, - dataFormat, settings_); - - //@F5A Don't have to check if a v5r2 system, because extendedMetaData - //@F5A can only be true if we are running to v5r2 - if(extendedMetaData) //@F5A - { - //@F5A - extendedColumnDescriptors_ = normalPrepareReply.getExtendedColumnDescriptors (); //@F5A - } //@F5A - - commonPrepareAfter (sqlStatement, normalPrepareReply); - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - finally - { //@P0A - if(request != null) { - request.returnToPool(); request=null; - } - if (normalPrepareReply != null) { normalPrepareReply.returnToPool(); normalPrepareReply = null; } //@B5A - } - - // Output a summary as a trace message. The * signifies that the - // statement name comes from the RPB. - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, - "Prepared " + name_ + "*, SQL Statement -->[" + sqlStatement + "]"); - } - - } - - // Check to see if the statement was cancelled. - if(cancelled_) - JDError.throwSQLException (JDError.EXC_OPERATION_CANCELLED); - - // If any of the fields is a locator, then we need to turn off @B2A - // record blocking. @B2A - lastPrepareContainsLocator_ = false; // @B2A - if(resultRow != null) - { // @B2A - int fieldCount = resultRow.getFieldCount (); // @B2A - for(int i = 1; i <= fieldCount; ++i) - { // @B2A - SQLData sqlData = resultRow.getSQLData(i); - int sqlType = sqlData.getSQLType(); //@xml3 - if(sqlType == SQLData.CLOB_LOCATOR || - sqlType == SQLData.BLOB_LOCATOR || - sqlType == SQLData.DBCLOB_LOCATOR || - sqlType == SQLData.NCLOB_LOCATOR || - sqlType == SQLData.XML_LOCATOR) //@xml3 - - lastPrepareContainsLocator_ = true; // @B2A - } // @B2A - } // @B2A - - return resultRow; - } - - - - /** - Performs common operations needed after a prepare. - - @param sqlStatement The SQL statement. - @param reply The prepare reply. - - @exception SQLException If an error occurs. - **/ - // - // This method is intended to be overriden, if needed. - // - void commonPrepareAfter (JDSQLStatement sqlStatement, - DBReplyRequestedDS reply) // private protected - throws SQLException - { - // Nothing. - } - - - - /** - Performs common operations needed before a prepare. - - @param sqlStatement The SQL statement. - @param request The prepare request. - - @exception SQLException If an error occurs. - **/ - // - // This method is intended to be overriden, if needed. - // - void commonPrepareBefore (JDSQLStatement sqlStatement, - DBSQLRequestDS request) // private protected - throws SQLException - { - // Close the result set before preparing another. - closeResultSet (JDCursor.REUSE_YES); - } - - - - /** - Performs common operations in leiu of a prepare. - - @param sqlStatement The SQL statement. - @param statementIndex The cached statement index. - - @exception SQLException If an error occurs. - **/ - // - // This method is intended to be overriden, if needed. - // - void commonPrepareBypass (JDSQLStatement sqlStatement, - int statementIndex) // private protected - throws SQLException - { - // Nothing. - } - - - - /** - Runs an SQL statement that may return multiple result sets. - This closes the current result set and clears warnings before - executing the new SQL statement. - -

        Under some situations, a single SQL statement may return - multiple result sets, an update count, or both. This might occur - when executing a stored procedure that returns multiple - result sets or when dynamically executing an unknown SQL string. - -

        Use getMoreResults(), getResultSet(), and getUpdateCount() - to navigate through multiple result sets, an update count, or - both. - - @param sql The SQL statement. - @return true if a result set was returned, false - if an update count was returned or nothing - was returned. - - @exception SQLException If the statement is not open, - the SQL statement contains a syntax - error, the query timeout limit is - exceeded, or an error occurs. - **/ - public boolean execute (String sql) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - settings_.getDecimalSeparator (), escapeProcessing_, - packageCriteria_, connection_); // @A1A @G4C - - if(JDTrace.isTraceOn()) // @D0A - JDTrace.logInformation (this, "Executing SQL Statement -->[" + sqlStatement + "]"); // @D0A - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removing this code to allow database engine errors to be returned. - // - // if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - // Prepare and execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - commonExecute (sqlStatement, resultRow); - - return(resultSet_ != null); - } - } - - - - //@G4A JDBC 3.0 - /** - Runs an SQL statement that may return multiple result sets and - makes any auto-generated keys available for retrieval using - Statement.getGeneratedKeys(). This closes the current result set - and clears warnings before executing the new SQL statement. - -

        Under some situations, a single SQL statement may return - multiple result sets, an update count, or both. This might occur - when executing a stored procedure that returns multiple - result sets or when dynamically executing an unknown SQL string. - -

        Use getMoreResults(), getResultSet(), and getUpdateCount() - to navigate through multiple result sets, an update count, or - both. - -

        This method requires OS/400 V5R2 - or IBM i. If connecting to OS/400 V5R1 or earlier, an exception - will be thrown. - - @param sql The SQL statement. - @param autoGeneratedKeys Indicates whether auto-generated keys should be made available for - retrieval. Valid values are Statement.RETURN_GENERATED_KEYS and - Statement.NO_GENERATED_KEYS. - @return true if a result set was returned, false - if an update count was returned or nothing - was returned. - - @exception SQLException If the statement is not open, - the SQL statement contains a syntax - error, the query timeout limit is - exceeded, the value for autoGeneratedKeys is - not a valid value, if connecting to OS/400 V5R1 - or earlier, an error occurs. - @since Modification 5 - **/ - - public boolean execute (String sql, int autoGeneratedKeys) - throws SQLException - { - if(connection_.getVRM() < JDUtilities.vrm520) //@F5A - JDError.throwSQLException(JDError.EXC_FUNCTION_NOT_SUPPORTED); //@F5A - - verifyGeneratedKeysParameter(autoGeneratedKeys); - autoGeneratedKeys_ = autoGeneratedKeys; - - if((connection_.getVRM() >= JDUtilities.vrm610) && //@GKA - (autoGeneratedKeys_ == RETURN_GENERATED_KEYS)) //@GKA - { - synchronized(internalLock_) - { - checkOpen (); - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - settings_.getDecimalSeparator (), escapeProcessing_, - packageCriteria_, connection_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Executing SQL Statement -->[" + sqlStatement + "]"); - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removing this code to allow database engine errors to be returned. - // - //if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - if(sqlStatement.isInsert_) - { - String selectStatement = connection_.makeGeneratedKeySelectStatement(sql); - //Construct the new JDSQLStatement object - sqlStatement = new JDSQLStatement(selectStatement, settings_.getDecimalSeparator(), escapeProcessing_, packageCriteria_, connection_); - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Generated keys, SQL Statement -->[" + sqlStatement + "]"); - sqlStatement.setSelectFromInsert(true); - } - - // Prepare and execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - commonExecute (sqlStatement, resultRow); - - return(resultSet_ != null); - } - } - else //@GKA do what we always have - return execute (sql); - } - - - - //@G4A JDBC 3.0 - /** - Runs an SQL statement that may return multiple result sets and - makes any auto-generated keys for the columns indicated in the given array - available for retrieval using Statement.getGeneratedKeys(). - This closes the current result set and clears warnings before - executing the new SQL statement. - -

        Under some situations, a single SQL statement may return - multiple result sets, an update count, or both. This might occur - when executing a stored procedure that returns multiple - result sets or when dynamically executing an unknown SQL string. - -

        Use getMoreResults(), getResultSet(), and getUpdateCount() - to navigate through multiple result sets, an update count, or - both. - -

        This method is not supported when connecting to IBM i V5R4 or earlier systems. - - @param sql The SQL statement. - @param columnIndexes Indicates that auto-generated keys for the indicated - columns should be made available for retrieval. - @return true if a result set was returned, false - if an update count was returned or nothing - was returned. - @exception java.sql.SQLException - If connecting to IBM i V5R4 or earlier systems, - if the statement is not open, - the SQL statement contains a syntax - error, the query timeout limit is - exceeded, the value for columnIndexes is - not a valid value, or an error occurs. - @since Modification 5 - **/ - public boolean execute (String sql, int[] columnIndexes) - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm610) //@GKA - { - synchronized(internalLock_) - { - checkOpen (); - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - settings_.getDecimalSeparator (), escapeProcessing_, - packageCriteria_, connection_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Executing SQL Statement -->[" + sqlStatement + "]"); - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removing this code to allow database engine errors to be returned. - // - // if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - //check if the statement is an insert statement - if(sqlStatement.isInsert_) - { - String selectStatement = connection_.makeGeneratedKeySelectStatement(sql, columnIndexes, null); - sqlStatement = new JDSQLStatement(selectStatement, settings_.getDecimalSeparator (), escapeProcessing_, packageCriteria_, connection_); - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Generated keys, SQL Statement -->[" + sqlStatement + "]"); - - autoGeneratedKeys_ = RETURN_GENERATED_KEYS; // specify we want generated keys - sqlStatement.setSelectFromInsert(true); - } - // Prepare and execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - commonExecute (sqlStatement, resultRow); - - return(resultSet_ != null); - } - } - else //@GKA - { - JDError.throwSQLException (JDError.EXC_FUNCTION_NOT_SUPPORTED); - return false; - } - } - - - - //@G4A JDBC 3.0 - /** - Runs an SQL statement that may return multiple result sets and - makes any auto-generated keys for the columns indicated in the given array - available for retrieval using Statement.getGeneratedKeys(). - This closes the current result set and clears warnings before - executing the new SQL statement. - -

        Under some situations, a single SQL statement may return - multiple result sets, an update count, or both. This might occur - when executing a stored procedure that returns multiple - result sets or when dynamically executing an unknown SQL string. - -

        Use getMoreResults(), getResultSet(), and getUpdateCount() - to navigate through multiple result sets, an update count, or - both. - -

        This method is not supported when connecting to IBM i V5R4 or earlier systems. - - @param sql The SQL statement. - @param columnNames Indicates that auto-generated keys for the indicated - columns should be made available for retrieval. - @return true if a result set was returned, false - if an update count was returned or nothing - was returned. - @exception java.sql.SQLException - If connecting to IBM i V5R4 or earlier systems, - if the statement is not open, - the SQL statement contains a syntax - error, the query timeout limit is - exceeded, the value for columnNames is - not a valid value, or an error occurs. - @since Modification 5 - **/ - public boolean execute (String sql, String[] columnNames) - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm610) //@GKA - { - synchronized(internalLock_) - { - checkOpen (); - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - settings_.getDecimalSeparator (), escapeProcessing_, - packageCriteria_, connection_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Executing SQL Statement -->[" + sqlStatement + "]"); - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removing this code to allow database engine errors to be returned. - // - // if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - //check if the statement is an insert statement - if(sqlStatement.isInsert_) - { - String selectStatement = connection_.makeGeneratedKeySelectStatement(sql, null, columnNames); - sqlStatement = new JDSQLStatement(selectStatement, settings_.getDecimalSeparator (), escapeProcessing_, packageCriteria_, connection_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Generated keys, SQL Statement -->[" + sqlStatement + "]"); - - sqlStatement.setSelectFromInsert(true); - autoGeneratedKeys_ = RETURN_GENERATED_KEYS; // specify we want generated keys - } - // Prepare and execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - commonExecute (sqlStatement, resultRow); - - return(resultSet_ != null); - } - } - else // Do what we always have - { - JDError.throwSQLException (JDError.EXC_FUNCTION_NOT_SUPPORTED); - return false; - } - } - - - - // JDBC 2.0 - /** - Runs the batch of SQL statements. Batch updates can be used - to submit a set of SQL statements together as a single unit. - The SQL statements are run in the order in which they were - added to the batch. The batch is cleared after the SQL statements - are run. In addition, this closes the current result set and - clears warnings before executing the new SQL statement. - -

        When batch updates are run, autocommit should usually be turned off. - This allows the caller to decide whether or not to commit the - transaction in the event that an error occurs and some of the - SQL statements in a batch fail to run. - - @return An array of row counts for the SQL statements that are run. - The array contains one element for each statement in the - batch of SQL statements. The array is ordered according to - the order in which the SQL statements were added to the batch. - - @exception SQLException If the statement is not open, - an SQL statement contains a syntax - error, the query timeout limit is - exceeded, an SQL statement returns - a result set, or an error occurs. - **/ - // - // Implementation notes: - // - // 1. We are using a Vector as the main data structure. - // Vector is supposedly synchronized already, so we - // should not have to worry about synchronization. - // - public int[] executeBatch () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - if(batch_ == null) batch_ = new Vector(); //@P0A - int batchSize = batch_.size (); - int[] updateCounts = new int[batchSize]; - - int i = 0; - try - { - Enumeration list = batch_.elements (); - while(list.hasMoreElements ()) - { - - // Prepare and execute. Check for a result set in - // both places. It is best to catch it after the - // prepare (so we don't open a cursor), but with - // some stored procedures, we can't catch it until - // the execute. - JDSQLStatement sqlStatement = (JDSQLStatement) list.nextElement (); - - if(JDTrace.isTraceOn()) // @D0A - JDTrace.logInformation (this, "Executing from batch SQL Statement -->[" + sqlStatement + "]"); // @D0A - - JDServerRow resultRow = commonPrepare (sqlStatement); - if(resultRow != null) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - - commonExecute (sqlStatement, resultRow); - if(resultSet_ != null) - { - closeResultSet (JDCursor.REUSE_YES); - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - updateCounts[i++] = updateCount_; - } - } - catch(SQLException e) - { - - // The specification says that if we get an error, - // then the size of the update counts array should - // reflect the number of statements that were - // executed without error. - int[] updateCounts2 = new int[i]; - System.arraycopy (updateCounts, 0, updateCounts2, 0, i); - - batch_.removeAllElements (); - throw new BatchUpdateException (e.getMessage (), - e.getSQLState (), e.getErrorCode (), updateCounts2); - } - - batch_.removeAllElements (); - return updateCounts; - } - } - - - - /** - Runs an SQL statement that returns a single result set. - This closes the current result set and clears warnings - before executing the new SQL statement. - - @param sql The SQL statement. - @return The result set that contains the data produced - by the query. - - @exception SQLException If the statement is not open, - the SQL statement contains a syntax - error, no result set is returned by the - database, the query timeout limit is - exceeded, or an error occurs. - **/ - public ResultSet executeQuery (String sql) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - settings_.getDecimalSeparator (), escapeProcessing_, - packageCriteria_, connection_); // @A1A @G4C - - if(JDTrace.isTraceOn()) // @D0A - JDTrace.logInformation (this, "Executing query, SQL Statement -->[" + sqlStatement + "]"); // @D0A - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removing this code to allow database engine errors to be returned. - // - // if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - // Prepare and execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - commonExecute (sqlStatement, resultRow); - - if((behaviorOverride_ & 1) == 0) // @F9a - { - // @F9a - if(resultSet_ == null) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - // @F9a - return resultSet_; - } - } - - - - /** - Runs an SQL INSERT, UPDATE, or DELETE statement, or any - SQL statement that does not return a result set. - This closes the current result set and clears warnings - before executing the new SQL statement. - - @param sql The SQL statement. - @return Either the row count for INSERT, UPDATE, or - DELETE, or 0 for SQL statements that - return nothing. - - @exception SQLException If the statement is not open, - the SQL statement contains a syntax - error, the query timeout limit is - exceeded, the statement returns - a result set, or an error occurs. - **/ - public int executeUpdate (String sql) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - settings_.getDecimalSeparator (), escapeProcessing_, - packageCriteria_, connection_); // @A1A @G4A - - - if(JDTrace.isTraceOn()) // @D0A - JDTrace.logInformation (this, "Executing update, SQL Statement -->[" + sqlStatement + "]"); // @D0A - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removing this code to allow database engine errors to be returned. - // - // if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - // Prepare and execute. Check for a result set in both - // places. It is best to catch it after the prepare (so - // we don't open a cursor), but with some stored procedures, - // we can't catch it until the execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - if(resultRow != null) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - - commonExecute (sqlStatement, resultRow); - if(resultSet_ != null) - { - closeResultSet (JDCursor.REUSE_YES); - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - - return updateCount_; - } - } - - - - //@G4A JDBC 3.0 - /** - Runs an SQL INSERT, UPDATE, or DELETE statement, or any - SQL statement that does not return a result set and - makes any auto-generated keys available for retrieval using - Statement.getGeneratedKeys(). - This closes the current result set and clears warnings - before executing the new SQL statement. -

        This method requires OS/400 V5R2 or - or IBM i. If connecting to OS/400 V5R1 or earlier, an exception - will be thrown. - - - @param sql The SQL statement. - @return Either the row count for INSERT, UPDATE, or - DELETE, or 0 for SQL statements that - return nothing. - - @exception SQLException If the statement is not open, - the SQL statement contains a syntax - error, the query timeout limit is - exceeded, the statement returns - a result set, the value for autoGeneratedKeys is - not a valid value, if connecting to OS/400 V5R1 - or earlier, an error occurs. - @since Modification 5 - **/ - public int executeUpdate (String sql, int autoGeneratedKeys) - throws SQLException - { - if(connection_.getVRM() < JDUtilities.vrm520) //@F5A - JDError.throwSQLException(JDError.EXC_FUNCTION_NOT_SUPPORTED); //@F5A - - verifyGeneratedKeysParameter(autoGeneratedKeys); - autoGeneratedKeys_ = autoGeneratedKeys; - - if((connection_.getVRM() >= JDUtilities.vrm610) && //@GKA - (autoGeneratedKeys_ == RETURN_GENERATED_KEYS)) //@GKA - { - synchronized(internalLock_) - { - checkOpen (); - JDSQLStatement sqlStatement = new JDSQLStatement (sql, - settings_.getDecimalSeparator (), escapeProcessing_, - packageCriteria_, connection_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Executing SQL Statement -->[" + sqlStatement + "]"); - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removed this code let engine return error - // - //if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - if(sqlStatement.isInsert_) - { - String selectStatement = connection_.makeGeneratedKeySelectStatement(sql); - //Create a new JDSQLStatement - sqlStatement = new JDSQLStatement(selectStatement, settings_.getDecimalSeparator(), escapeProcessing_, packageCriteria_, connection_); - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Generated keys, SQL Statement -->[" + sqlStatement + "]"); - - sqlStatement.setSelectFromInsert(true); - // Prepare and execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - commonExecute (sqlStatement, resultRow); - } - else - { - // Prepare and execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - if(resultRow != null) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - commonExecute (sqlStatement, resultRow); - if(resultSet_ != null) - { - closeResultSet (JDCursor.REUSE_YES); - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - } - return updateCount_; - } - } - else //@GKA do what we always have - return executeUpdate (sql); - } - - - - //@G4A JDBC 3.0 - /** - Runs an SQL INSERT, UPDATE, or DELETE statement, or any - SQL statement that does not return a result set and - makes any auto-generated keys for the columns indicated in the given array - available for retrieval using Statement.getGeneratedKeys(). - This closes the current result set and clears warnings - before executing the new SQL statement. - -

        This method is not supported when connecting to IBM i V5R4 or earlier systems. - - @param sql The SQL statement. - @param columnIndexes The indexes of columns for which auto-generated keys should be made - available for retrieval. - @return Either the row count for INSERT, UPDATE, or - DELETE, or 0 for SQL statements that - return nothing. - @exception SQLException If connection to IBM i V5R4 or earlier systems, - the statement is not open, - the SQL statement contains a syntax - error, the query timeout limit is - exceeded, the statement returns - a result set, the value for autoGeneratedKeys is - not a valid value or an error occurs. - - @since Modification 5 - **/ - public int executeUpdate (String sql, int[] columnIndexes) - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm610) //@GKA - { - synchronized(internalLock_) - { - //make sure the statement is open - checkOpen (); - - //create the sql statement object. - JDSQLStatement sqlStatement = new JDSQLStatement (sql, settings_.getDecimalSeparator (), escapeProcessing_, packageCriteria_, connection_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Executing update, SQL Statement -->[" + sqlStatement + "]"); - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removing this code to allow database engine errors to be returned. - // - - //if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - //check if the statement is an insert statement - if(sqlStatement.isInsert_) - { - String selectStatement = connection_.makeGeneratedKeySelectStatement(sql, columnIndexes, null); - sqlStatement = new JDSQLStatement(selectStatement, settings_.getDecimalSeparator (), escapeProcessing_, packageCriteria_, connection_); - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Generated keys, SQL Statement -->[" + sqlStatement + "]"); - - sqlStatement.setSelectFromInsert(true); - autoGeneratedKeys_ = RETURN_GENERATED_KEYS; // specify we want generated keys - // prepare and execute - JDServerRow resultRow = commonPrepare(sqlStatement); - commonExecute(sqlStatement, resultRow); - } - else // treat just like executeUpdate(String sql) was called - { - // Prepare and execute. Check for a result set in both - // places. It is best to catch it after the prepare (so - // we don't open a cursor), but with some stored procedures, - // we can't catch it until the execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - if(resultRow != null) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - - commonExecute (sqlStatement, resultRow); - if(resultSet_ != null) - { - closeResultSet (JDCursor.REUSE_YES); - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - } - return updateCount_; - } - } - else - { - JDError.throwSQLException (JDError.EXC_FUNCTION_NOT_SUPPORTED); - return 0; - } - } - - - - //@G4A JDBC 3.0 - /** - Runs an SQL INSERT, UPDATE, or DELETE statement, or any - SQL statement that does not return a result set and - makes any auto-generated keys for the columns indicated in the given array - available for retrieval using Statement.getGeneratedKeys(). - This closes the current result set and clears warnings - before executing the new SQL statement. - -

        This method is not supported when connecting to IBM i V5R4 or earlier systems. - - @param sql The SQL statement. - @param columnNames The column names for which auto-generated keys should be made - available for retrieval. - @return Either the row count for INSERT, UPDATE, or - DELETE, or 0 for SQL statements that - return nothing. - @exception SQLException If connection to IBM i V5R4 or earlier systems, - the statement is not open, - the SQL statement contains a syntax - error, the query timeout limit is - exceeded, the statement returns - a result set, the value for autoGeneratedKeys is - not a valid value or an error occurs. - @since Modification 5 - **/ - public int executeUpdate (String sql, String[] columnNames) - throws SQLException - { - if(connection_.getVRM() >= JDUtilities.vrm610) //@GKA - { - synchronized(internalLock_) - { - //make sure the statement is open - checkOpen (); - - //create the sql statement object. - JDSQLStatement sqlStatement = new JDSQLStatement (sql, settings_.getDecimalSeparator (), escapeProcessing_, packageCriteria_, connection_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Executing update, SQL Statement -->[" + sqlStatement + "]"); - - // Validate that no parameters are set, since parameters - // imply the need for a PreparedStatement. - // Note: This code causes problems with some statements with a syntax error. - // For example - // select * from sysibm.sysdummy1 where 'a = '?' - // - // Removing this code to allow database engine errors to be returned. - // - - //if(sqlStatement.countParameters () > 0) - // JDError.throwSQLException (JDError.EXC_PARAMETER_COUNT_MISMATCH); - // @AAD - - //check if the statement is an insert statement - if(sqlStatement.isInsert_) - { - String selectStatement = connection_.makeGeneratedKeySelectStatement(sql, null, columnNames); - sqlStatement = new JDSQLStatement(selectStatement, settings_.getDecimalSeparator (), escapeProcessing_, packageCriteria_, connection_); - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, "Generated keys, SQL Statement -->[" + sqlStatement + "]"); - - sqlStatement.setSelectFromInsert(true); - autoGeneratedKeys_ = RETURN_GENERATED_KEYS; // specify we want generated keys - //prepare and execute - JDServerRow resultRow = commonPrepare(sqlStatement); - commonExecute(sqlStatement, resultRow); - } - else // treat just like executeUpdate(String sql) was called - { - // Prepare and execute. Check for a result set in both - // places. It is best to catch it after the prepare (so - // we don't open a cursor), but with some stored procedures, - // we can't catch it until the execute. - JDServerRow resultRow = commonPrepare (sqlStatement); - if(resultRow != null) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - - commonExecute (sqlStatement, resultRow); - if(resultSet_ != null) - { - closeResultSet (JDCursor.REUSE_YES); - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - } - } - return updateCount_; - } - } - else - { - JDError.throwSQLException (JDError.EXC_FUNCTION_NOT_SUPPORTED); - return 0; - } - } - - - - /** - Closes the statement if not explicitly closed by the caller. - - @exception Throwable If an error occurs. - **/ - protected void finalize () - throws Throwable - { - try{ - if(! isClosed ()) { - JDTrace.logInformation (this, "WARNING: Finalizer thread closing statement object."); - close (); - } - } - catch(Exception e){ - //catch any exceptions and don't throw them - } - super.finalize (); - } - - - - /** - Returns the appropriate blocking factor for the SQL statement. - - @param sqlStatement The SQL statement. - @param rowLength The row length. - @return The blocking factor (in rows). - **/ - int getBlockingFactor (JDSQLStatement sqlStatement, - int rowLength) // private protected - { - boolean block = false; - boolean useFetchSize = false; - - // Only block if the cursor is not updatable - // and no locators are in the result set. @B2A - if((cursor_.getConcurrency() != ResultSet.CONCUR_UPDATABLE) // @B2C @EAC - && (lastPrepareContainsLocator_ == false) - && (resultSetType_ != ResultSet.TYPE_SCROLL_SENSITIVE)) //@KKB we do not want to block if a sensitive cursor is being used - { // @B2A - - // Determine if we should block based on the block - // criteria and SQL statement characteristics. - if(blockCriteria_.equalsIgnoreCase (JDProperties.BLOCK_CRITERIA_NONE)) - { - block = true; - useFetchSize = true; - } - - if(sqlStatement != null) - { - if((blockCriteria_.equalsIgnoreCase (JDProperties.BLOCK_CRITERIA_IF_FETCH)) - && (sqlStatement.isForFetchOnly())) - block = true; - - else if((blockCriteria_.equalsIgnoreCase (JDProperties.BLOCK_CRITERIA_UNLESS_UPDATE)) - && (! sqlStatement.isForUpdate())) - block = true; - } - else - if(blockCriteria_.equalsIgnoreCase (JDProperties.BLOCK_CRITERIA_UNLESS_UPDATE)) - block = true; - - } - - // Compute the blocking factor. - int blockingFactor; - if(block) - { - if(useFetchSize) - blockingFactor = fetchSize_; - else - { - blockingFactor = (blockSize_ * 1024) / rowLength; - if(blockingFactor > 32767) - blockingFactor = 32767; - else if(blockingFactor <= 0) - blockingFactor = 1; - } - } - else - blockingFactor = 1; - - return blockingFactor; - } - - - - // JDBC 2.0 - /** - Returns the connection for this statement. - - @return The connection for this statement. - - @exception SQLException If an error occurs. - **/ - public Connection getConnection () - throws SQLException - { - return connection_; - } - - - - /** - Returns the name of the SQL cursor that is used by - subsequent statement execute methods. - - @return The cursor name. - **/ - String getCursorName () - { - synchronized(internalLock_) - { // @E6A - return cursor_.getName (); - } - } - - - - //@F3A - /** - Returns extended column descriptors for this statement. - This will be null if the user has the "extended meta data" - property set to false (the default). - - @return The extended column descriptors for this statement. - **/ - DBExtendedColumnDescriptors getExtendedColumnDescriptors () - { - synchronized(internalLock_) - { - return extendedColumnDescriptors_; - } - } - - - - // JDBC 2.0 - /** - Returns the fetch direction. - - @return The fetch direction. - - @exception SQLException If the statement is not open. - **/ - public int getFetchDirection () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return fetchDirection_; - } - } - - - - // JDBC 2.0 - /** - Returns the fetch size. - - @return The fetch size. - - @exception SQLException If the statement is not open. - **/ - public int getFetchSize () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return fetchSize_; - } - } - - - - //@G4A JDBC 3.0 - /** - Retrieves any auto-generated keys created as a result of executing this Statement object. - Currently DB2 for IBM i supports returning only one auto-generated key to the Toolbox JDBC driver - -- the key for the last inserted row. Be aware that the generated key returned is not - guaranteed to be unique unless a unique constraint is created on the table. - -

        In order for this method to return auto-generated keys, the statement must be executed on - a table with an identity column. For more information about identity columns, Go to the - IBM i Information Center, and search on the phrase "identity column". - - -

        This method requires OS/400 V5R2 or IBM i. If connecting to OS/400 V5R1 or earlier, - an exception will be thrown. - -

        This method will return null if the user did not request auto-generated keys - during the execute of a Statement or during the prepare of a PreparedStatement. - This method will also return null if the application has not executed the - statement before calling this method. - -

        This method will return an empty result set if the database did not generate - any auto-generated keys when executing the statement. - - @return The ResultSet object containing the auto-generated key(s) - generated by the execution of this Statement object, an empty - result set if the database did not generate any auto-generated keys, - or null if the application did not request auto-generated keys or - did not execute the statement before calling this method. - - @exception SQLException If the statement is not open, - if connecting to OS/400 V5R1 or earlier, - an error occurs. - @since Modification 5 - **/ - public ResultSet getGeneratedKeys () - throws SQLException - { - synchronized(internalLock_) - { - if(connection_.getVRM() < JDUtilities.vrm520) //@F5A - { - //@F5A - JDError.throwSQLException (JDError.EXC_FUNCTION_NOT_SUPPORTED); //@F5A - return null; //@F5A - } //@F5A - //Check if open because generated key result set only makes sense if the - //Statement is currently open. - checkOpen (); - - //@F6 If the user didn't execute the statement yet, throw a function sequence exception. - //@F6 If it's just an issue of the database not returning any keys, - //@F6 return an empty result set. - //@F6 Since we will also have null generated keys if the database did not - //@F6 return us any values, return null instead of throwing a function sequence error. - //@F6 This matches the behavior of Statement.getResultSet() if no result set was - //@F6 created, or getResultSet() is called before executing a statement. - //@F6D If we have not made any generated keys yet, a statement must - //@F6D not have been executed, so throw a function sequence error. - //@F6D if (generatedKeys_ == null) - //@F6D JDError.throwSQLException (JDError.EXC_FUNCTION_SEQUENCE); - - return generatedKeys_; - } - } - - - - /** - Returns the maximum field size limit for the statement. - The maximum field size limit is the maximum amount of data - returned for any column value. It applies only to BINARY, - VARBINARY, CHAR, and VARCHAR fields. If the limit is exceeded, - then the excess data is discarded. - - @return The maximum field size limit (in bytes), or - 0 for no limit. - - @exception SQLException If the statement is not open. - **/ - public int getMaxFieldSize () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return maxFieldSize_; - } - } - - - - /** - Returns the maximum rows limit for the statement. - The maximum rows limit is the maximum number of rows that a - result set can contain. If the limit is exceeded, then the - excess rows are dropped. - - @return The maximum rows limit, or 0 for no limit. - - @exception SQLException If the statement is not open. - **/ - public int getMaxRows () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return maxRows_; - } - } - - - - /** - Returns the next result set. This closes the - current result set. - - @return true if another result set is available, false - if there are no more result sets. - - @exception SQLException If an error occurs. - **/ - public boolean getMoreResults () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - // Initialize. - cancelled_ = false; - checkOpen (); - closeResultSet (JDCursor.REUSE_RESULT_SET); - - // Determine if there more result sets. - if(--numberOfResults_ > 0) - { - - // Send the data stream. - DBSQLRequestDS request = null; //@P0A - try - { - if((connection_.getVRM() >= JDUtilities.vrm610)) //@cur //@isol - request = DBDSPool.getDBSQLRequestDS(DBSQLRequestDS.FUNCTIONID_OPEN_DESCRIBE, id_, DBSQLRequestDS.ORS_BITMAP_RETURN_DATA+DBSQLRequestDS.ORS_BITMAP_SQLCA+DBSQLRequestDS.ORS_BITMAP_DATA_FORMAT+DBSQLRequestDS.ORS_BITMAP_CURSOR_ATTRIBUTES, 0); //@cur - else - request = DBDSPool.getDBSQLRequestDS(DBSQLRequestDS.FUNCTIONID_OPEN_DESCRIBE, id_, DBSQLRequestDS.ORS_BITMAP_RETURN_DATA+DBSQLRequestDS.ORS_BITMAP_SQLCA+DBSQLRequestDS.ORS_BITMAP_DATA_FORMAT, 0); //@P0C - - int openAttributes = cursor_.getOpenAttributes(null, blockCriteria_); // @E1A - request.setOpenAttributes(openAttributes); // @E1C - - //Set the cursor scrollability option if V5R3 or higher, prior to V5R3 we can only be forward only. - if(connection_.getVRM() >= JDUtilities.vrm530) - { - String cursorSensitivity = connection_.getProperties().getString(JDProperties.CURSOR_SENSITIVITY); //@F8A - if(resultSetType_ == ResultSet.TYPE_FORWARD_ONLY) //@KBA - { - //@KBA - //Determine if user set cursor sensitivity property //@KBA - if(cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_INSENSITIVE)) //@KBA - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_INSENSITIVE); //@KBA Option 5 - else //@KBA - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_ASENSITIVE); //@KBA Option 0 - } //@KBA - else if(resultSetType_ == ResultSet.TYPE_SCROLL_SENSITIVE) //@KBA - { - //@KBA - //Determine if user set cursor sensitivity property //@KBA - if(cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_ASENSITIVE)) //@KBA - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_ASENSITIVE); //@KBA Option 1 - else //@KBA - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_SENSITIVE); //@KBA Option 3 - } //@KBA - else //ResultSet.TYPE_SCROLL_INSENSITIVE //@KBA - { - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_INSENSITIVE); //@KBA Option 2 - } //@KBA - } - - if (getMoreResultsReply != null) { getMoreResultsReply.returnToPool(); getMoreResultsReply=null; } - getMoreResultsReply = connection_.sendAndReceive (request, id_); //@P0C - - // Gather information from the reply. - DBReplySQLCA sqlca = getMoreResultsReply.getSQLCA (); - DBDataFormat dataFormat = getMoreResultsReply.getDataFormat (); - if(this instanceof AS400JDBCCallableStatement) // @550A - dataFormat.setCSRSData(true); // @550A - - // Check for system errors. - int errorClass = getMoreResultsReply.getErrorClass(); - int returnCode = getMoreResultsReply.getReturnCode(); - - if(errorClass != 0) - { - if(returnCode < 0) - JDError.throwSQLException (connection_, id_, errorClass, returnCode); - else - postWarning (JDError.getSQLWarning (connection_, id_, errorClass, returnCode)); - } - - // Process a potential cursor conecurrency override. @E1A @EAC - cursor_.processConcurrencyOverride(openAttributes, getMoreResultsReply); // @E1A @EAC - - cursor_.processCursorAttributes(getMoreResultsReply); //@cur - - // Note that the cursor was opened. - cursor_.setState (false); - - // Compute the result set. - JDServerRow row = new JDServerRow (connection_, id_, dataFormat, - settings_); - JDServerRowCache rowCache = new JDServerRowCache ( - row, connection_, id_, getBlockingFactor ( - null, row.getRowLength()), false, resultSetType_, cursor_); //@PDC perf //@pda perf2 - fetch/close - - // If the result set concurrency is updatable, check to @E1C - // see if the system overrode the cursor type to read only. @E1C - // Don't worry about the other direction (system overrides @E1C - // from read-only to updatable). @E1C - int actualConcurrency = (resultSetConcurrency_ == ResultSet.CONCUR_UPDATABLE) // @E1C - ? cursor_.getConcurrency() : resultSetConcurrency_; // @E1C @EAC - - resultSet_ = new AS400JDBCResultSet (this, null, - rowCache, connection_.getCatalog(), - cursor_.getName(), maxRows_, resultSetType_, - actualConcurrency, fetchDirection_, - fetchSize_); // @ECC - if(resultSet_.getConcurrency () != resultSetConcurrency_) - postWarning (JDError.getSQLWarning (JDError.WARN_OPTION_VALUE_CHANGED)); - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - finally - { //@P0A - if(request != null) { - request.returnToPool(); request = null; - } - if (getMoreResultsReply != null) { getMoreResultsReply.returnToPool(); getMoreResultsReply = null; } - } - } - - // Check to see if the statement was cancelled. - if(cancelled_) - JDError.throwSQLException (JDError.EXC_OPERATION_CANCELLED); - - // @A0A - // Added code to set updateCount_ = -1. - updateCount_ = -1; // @A0A - - return(resultSet_ != null); - } - } - - - - //@G4A JDBC 3.0 - /** - Returns the next result set. This closes the current result set. This method - handles any current ResultSet object(s) according to the instructions specified - by the actionOnCurrentResultSet parameter, and returns true if the next result is a - ResultSet object. - - @param current What should happen to current ResultSet objects - obtained using the method getResultSet. Valid values are - CLOSE_CURRENT_RESULT, KEEP_CURRENT_RESULT, and CLOSE_ALL_RESULTS. - - @return Always false because this method is not supported. - - @exception SQLException if DatabaseMetaData.supportsMultipleOpenResults returns false - and either Statement.KEEP_CURRENT_RESULT or Statement.CLOSE_ALL_RESULTS are - supplied as the argument. - @since Modification 5 - **/ - public boolean getMoreResults (int current) - throws SQLException - { - if(current == Statement.CLOSE_CURRENT_RESULT) //@forum1 - return getMoreResults(); //@forum1 - - JDError.throwSQLException (JDError.EXC_FUNCTION_NOT_SUPPORTED); - return false; - } - - - //@F10A - /** - Will return the value of the last syntax error that came back from the IBM i system. - - @return The value of the character of the last syntax error from the system, - or 0 if no errors occurred or the value is not known. - - @exception SQLException If the statement is not open. - **/ - public int getPositionOfSyntaxError () - throws SQLException - { - synchronized(internalLock_) - { - checkOpen (); - return positionOfSyntaxError_; - } - } - - - /** - Returns the query timeout limit for this statement. - The query timeout limit is the number of seconds that the - driver will wait for an SQL statement to execute. - - @return The query timeout limit (in seconds), or - 0 for no limit. - - @exception SQLException If the statement is not open. - **/ - public int getQueryTimeout () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return queryTimeout_; - } - } - - - - /** - Returns the current result set. - - @return The current result set, or null if an update - count was returned or there are no more - result sets. - - @exception SQLException If the statement is not open. - **/ - public ResultSet getResultSet () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return resultSet_; - } - } - - - - // JDBC 2.0 - /** - Returns the result set concurrency to be used for this statement. - - @return The result set concurrency. - - @exception SQLException If the statement is not open. - **/ - public int getResultSetConcurrency () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return resultSetConcurrency_; - } - } - - - - //@G4A JDBC 3.0 - /** - Returns the result set cursor holdability to be used for this statement. - - @return The cursor holdability. Valid values are ResultSet.HOLD_CURSORS_OVER_COMMIT and - ResultSet.CLOSE_CURSORS_AT_COMMIT. The holdability is derived in this order - of precedence: -

          -
        • 1. The holdability, if any, that was specified on statement creation using - the methods createStatement(), prepareCall(), or prepareStatement() on the - Connection object. -
        • 2. The holdability specified using the method setHoldability(int) - if this method was called on the Connection object. -
        • 3. If neither of above methods were called, the value of the - cursor hold - driver property.
        - Full functionality of #1 and #2 requires OS/400 v5r2 - or IBM i. If connecting to OS/400 V5R1 or earlier, - the value specified on these two methods will be ignored and the default holdability - will be the value of #3. - - @exception SQLException If the statement is not open. - - @since Modification 5 - **/ - public int getResultSetHoldability () - throws SQLException - { - synchronized(internalLock_) - { - checkOpen (); - - //if we can get info from resultSet (post 540), that will be more accurate, since it can be from stored-proc cursor - if((resultSet_ != null) && (!resultSet_.isClosed())) //@cur //@cur2 - return resultSet_.getHoldability(); //@cur - - //@F4 If resultSetHoldability_ was set by the user, then return it. Otherwise, - //@F4 return the connection's holdability. - if((resultSetHoldability_ == AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT) || //@F4A - (resultSetHoldability_ == AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT)) //@F4A - { - //@F4A - return resultSetHoldability_; //@F4A - } //@F4A - return connection_.getHoldability(); - } - } - - - - - // JDBC 2.0 - /** - Returns the result set type to be used for this statement. - - @return The result set type. - - @exception SQLException If the statement is not open. - **/ - public int getResultSetType () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return resultSetType_; - } - } - - - - /** - Returns the current update count. - - @return The update count, or -1 if a result set was - returned or there are no more result sets. - - @exception SQLException If the statement is not open. - **/ - public int getUpdateCount () - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - return(resultSet_ != null) ? -1 : updateCount_; - } - } - - - - /** - Returns the first warning reported for the statement. - Subsequent warnings may be chained to this warning. - - @return The first warning, or null if no warnings - have been reported. - - @exception SQLException If an error occurs. - **/ - public SQLWarning getWarnings () - throws SQLException - { - return sqlWarning_; - } - - - //@KBL - /* - Sets whether or not the statement has been partially closed and if the remaining resources - should be freed when a transaction boundary is reached. - A statement may become partially closed if the user specified to keep statements associated with - locators open until a transaction boundary by setting the "hold statements" connection property to true. - */ - void setHoldStatement(boolean hold){ - holdStatement_ = hold; - } - - //@KBL - /* - Returns whether or not the statement has been partially closed. - A statement may become partially closed if the user specified to keep statements associated with - locators open until a transaction boundary by setting the "hold statements" connection property to true. - */ - boolean isHoldStatement() - { - return holdStatement_; - } - - //@KBL - /* - Sets whether or not this statement object has been used to access a locator. - */ - void setAssociatedWithLocators(boolean hasLocator){ - associatedWithLocators_ = hasLocator; - } - - //@KBL - /* - Returns whether or not this statement object has been used to access a locator. - */ - boolean isAssociatedWithLocators(){ - return associatedWithLocators_; - } - - /** - Indicates if the statement is closed. - - @return true if the statement is closed; - false otherwise. - **/ - public boolean isClosed () throws SQLException //@PDC jdbc40 - { - return closed_; - } - - - - //@G4A - /** - Creates a result set to be returned from getGeneratedKeys(). - - Make an empty result set if return code is < 0 because the information - will not be waiting for us in the SQLCA. - **/ - private void makeGeneratedKeyResultSet(int returnCode, DBReplySQLCA sqlca) - throws SQLException - { - //@F6A Make sure we close the generated key result set. We don't have to - //@F6A check to see if the user closed it already because close() does - //@F6A that for us already. - if(generatedKeys_ != null) //@F6A - { - //@F6A - generatedKeys_.close(); //@F6A - } //@F6A - //Code checks we are running to a v5r2 or later system before calling this method - BigDecimal generatedKey = null; //@F6C - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "returnCode is: " + returnCode); - - if(returnCode < 0) - { - // If SQLCode (returnCode) from system is not 0, then don't go look - // for auto-generated key because it will not be there. Instead, - // make empty result set. - //@F6D generatedKey = ""; - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "return code was not 0, generated key is null"); - } - else - { - // As of right now, we will only be returned the last auto-generated key. - // Even though it is wasteful to return a ResultSet with only one element, - // that's what the spec. says we have to do. - - // Consider going to system in the future to fill in the field name. - // Right now, it doesn't seem like a cost-effective trip. - - // If there is no error, the errmc is instead filled with the auto-generated - // key for us. - generatedKey = sqlca.getGeneratedKey(); //@P0C @F6C Deleted converter - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "generated key from system is: " + generatedKey); - // generatedKey will be null if the database did not return to us a - // proper generatedKey - } - String[] fieldNames = {""}; - SQLData[] sqlData = { new SQLDecimal (30, 0, settings_, connection_.getVRM(), connection_.getProperties())}; //@F6C // @M0C - changed SQLDecimal ctor signature - int[] fieldNullables = {AS400JDBCDatabaseMetaData.columnNoNulls}; - JDSimpleRow formatRow = new JDSimpleRow (fieldNames, sqlData, fieldNullables); - boolean[][] nulls = {{false}}; - boolean[][] dataMappingErrors = {{false}}; - JDRowCache rowCache = null; - if(generatedKey == null) - { - rowCache = new JDSimpleRowCache(formatRow); - } - else - { - Object[][] data = {{generatedKey}}; - rowCache = new JDSimpleRowCache (formatRow, data, nulls, dataMappingErrors); - } - // Construct with row cache, no catalog, and no cursor name - generatedKeys_ = new AS400JDBCResultSet (rowCache, "", "", connection_, null); //@in2 - } - - - - // @B3A - /** - Marks the cursor as closed. - - @param isRollback True if we called this from rollback(), false if we called this from commit(). - **/ - void markCursorClosed(boolean isRollback) //@F4C - throws SQLException //@F2A - { - // @K94 - See if the user requested to hold cursors after a rollback - boolean rollbackCursorHold = connection_.getProperties().getBoolean(JDProperties.ROLLBACK_CURSOR_HOLD); //@K94 - if(rollbackCursorHold) //@K94 - isRollback = false; //@K94 - - // @F4 Added a check of statement level holdability because the user can specify the - // @F4 holdability of a specific statement (as a different value than the connection - // @F4 holdability) with JDBC 3.0 support. If this was called from Connection.rollback(), - // @F4 close all statements. - if((getResultSetHoldability() == AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT //@F4A - || isRollback) //@F4A - && ((connection_.getVRM() <= JDUtilities.vrm610) - || ((connection_.getVRM() >= JDUtilities.vrm710) && cursor_.getCursorIsolationLevel() != 0))) //@isol only close if cursor's isolationlvl is not *none - { - //@F5D cursor_.setState(true); - //@F4 Instead of calling closeResultSet which does more work than we need to, - //@F4 just move the code here that we need to clean up our internal variables. - //@F4 Otherwise, we'd make an unnecessary flow to the system to tell it to - //@F4 close the cursor which it already has. - if(resultSet_ != null) //@F4A - { - //@F4A - if(! resultSet_.isClosed ()) //@F4A - resultSet_.close (); //@F4A - resultSet_ = null; //@F4A - } //@F4A - updateCount_ = -1; //@F4A - } - } - - - - - /** - Notifies the statement that its result set has been closed. - - @exception SQLException If an error occurs. - **/ - void notifyClose () - throws SQLException - { - // The result set is close, so we can close the cursor. - if(! cursor_.isClosed ()) - { - if(numberOfResults_ > 1) - cursor_.close (JDCursor.REUSE_RESULT_SET); - else - cursor_.close (JDCursor.REUSE_YES); - } - } - - - - /** - Posts a warning for the statement. - - @param sqlWarning The warning. - **/ - void postWarning (SQLWarning sqlWarning) - { - if(sqlWarning_ == null) - sqlWarning_ = sqlWarning; - else - sqlWarning_.setNextWarning (sqlWarning); - } - - - - // @E9C - /** - Sets the SQL cursor name that will be used by the statement. - Cursor names must be unique within the connection. - The cursor name can only be set when no result set is open. - -

        The cursor name can be used in SQL positioned UPDATE or DELETE - statements to identify the current row in the result set generated - by this statement. By definition, SQL positioned UPDATEs or - DELETEs must be executed by a different statement than the one - that generated the result set being used for positioning. - -

        Cursor names are case sensitive. However, when using a cursor - name within other SQL positioned UPDATE or DELETE statements, - the cursor name will be uppercased. If you use a cursor name - with lowercase characters, you need to enclose it in double - quotes when referring to it in other SQL statements. - - @param cursorName The cursor name. If null, a unique - default name will be used. - - @exception SQLException If the statement is not open, - a result set is open, the cursor - name is not unique within the - connection, or an error occurs. - **/ - // - // Implementation note: - // - // If you set the cursor name to a mixed case string, and then - // later refer to it in an SQL statement, SQL will choke because it - // will have uppercased the string. - // - // At first I thought we should always uppercase, the cursor name - // but that limits callers. The better solution is to have the callers - // surround mixed case cursor names in SQL statements with double - // quotes. - // - public void setCursorName (String cursorName) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - - // Check that no cursor is open for this statement. - // We can not just check the cursor, because if the - // caller closes the result set, we do not close the - // cursor right away. - if(resultSet_ != null) - { - if(! resultSet_.isClosed ()) - JDError.throwSQLException (JDError.EXC_CURSOR_STATE_INVALID); - else - closeResultSet (JDCursor.REUSE_YES); - } - - // If name is null, then use the default name. - if(cursorName == null) - cursorName = cursorDefaultName_; - - // Validate the length of the cursor name. - int cursorNameLength = cursorName.length(); // @EEA - int maxLength = (connection_.getVRM() >= JDUtilities.vrm610) ? MAX_CURSOR_NAME_LENGTH : MAX_CURSOR_NAME_LENGTH_PRE_V6R1; //@550 128 byte cursor name support - if((cursorNameLength > maxLength) || (cursorNameLength == 0)) // @EEC @550 changed MAX_CURSOR_NAME_LENGTH to maxLength - JDError.throwSQLException (JDError.EXC_CURSOR_NAME_INVALID); - - // If the name is the same as the current cursor name, - // then nothing needs to be done. (If we go through - // with the change and the cursor name is the same, it - // will get flagged as ambiguous). - if(! cursorName.equals (cursor_.getName ())) - { - - // Check that the cursor name is unique within the - // connection. - if(connection_.isCursorNameUsed (cursorName)) - JDError.throwSQLException (JDError.EXC_CURSOR_NAME_AMBIGUOUS); - - cursor_.setName (cursorName); - - // Since we store the cursor name in the RPB, we need - // to sync it after a change. - rpbSyncNeeded_ = true; - - } - } - } - - - - /** - Sets the escape processing mode. When processing escape - clauses, the JDBC driver substitutes escape clauses - in SQL statements with DB2 for IBM i SQL grammar elements. - If escape processing is not needed, then setting the escape - processing mode to false improves performance. - - @param escapeProcessing true to process escape clauses; - false otherwise. The default - is true. - - @exception SQLException If the statement is not open. - **/ - public void setEscapeProcessing (boolean escapeProcessing) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - escapeProcessing_ = escapeProcessing; - - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Escape processing", escapeProcessing_); - } - } - - - - // JDBC 2.0 - /** - Sets the direction in which the rows in a result set will be - processed. - -

        This setting is not used. - - @param fetchDirection The fetch direction for processing rows. - Valid values are: -

          -
        • ResultSet.FETCH_FORWARD -
        • ResultSet.FETCH_REVERSE -
        • ResultSet.FETCH_UNKNOWN -
        - The default is ResultSet.FETCH_FORWARD. - - @exception SQLException If the statement is not open, - the result set type is - ResultSet.TYPE_FORWARD_ONLY, - and the input value is not - ResultSet.FETCH_FORWARD, - or the input value is not valid. - **/ - public void setFetchDirection (int fetchDirection) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - if(((fetchDirection != ResultSet.FETCH_FORWARD) - && (fetchDirection != ResultSet.FETCH_REVERSE) - && (fetchDirection != ResultSet.FETCH_UNKNOWN)) - || ((resultSetType_ == ResultSet.TYPE_FORWARD_ONLY) - && (fetchDirection != ResultSet.FETCH_FORWARD))) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - checkOpen (); - fetchDirection_ = fetchDirection; - - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Fetch direction", fetchDirection_); - } - } - - - - // JDBC 2.0 - /** - Sets the number of rows to be fetched from the database when more - rows are needed. The number of rows specified only affects result - sets created using this statement. If the value specified is zero, - then the driver will choose an appropriate fetch size. - -

        This setting only affects statements that meet the criteria - specified in the "block criteria" property. The fetch size - is only used if the "block size" property is set to "0". - - @param fetchSize The number of rows. This must be greater than - or equal to 0 and less than or equal to the - maximum rows limit. The default is zero. - - @exception SQLException If the statement is not open - or the input value is not valid. - **/ - public void setFetchSize (int fetchSize) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - if((fetchSize < 0) - || ((fetchSize > maxRows_) && (maxRows_ > 0))) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - checkOpen (); - fetchSize_ = fetchSize; - - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Fetch size", fetchSize_); - } - } - - - - /** - Sets the maximum field size limit. The maximum field size - limit is the maximum amount of data returned for any column - value. It applies only to BINARY, VARBINARY, CHAR, and VARCHAR - fields. If the limit is exceeded, then the excess data is - discarded. - - @param maxFieldSize The maximum field size limit (in bytes) or - 0 for no limit. The default is 0. - - @exception SQLException If the statement is not open - or the input value is not valid. - **/ - public void setMaxFieldSize (int maxFieldSize) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - - // Validate the argument. - if(maxFieldSize < 0) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - maxFieldSize_ = maxFieldSize; - settings_.setMaxFieldSize (maxFieldSize_); - - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Max field size", maxFieldSize_); - } - } - - - - /** - Sets the maximum rows limit. The maximum rows limit is the - maximum number of rows that a result set can contain. - If the limit is exceeded, the excess rows are dropped. - - - @param maxRows The maximum rows limit or 0 for no limit. - The default is 0. - - @exception SQLException If the statement is not open - or the input value is not valid. - **/ - // - // Implementation note: - // - // We had a debate about what this means with respect to scrollable - // result sets. Does it limit the number of rows in the result set, - // or the number of rows fetched. I.e., if you set the max rows to - // 50, can you successfully do absolute(51)? It is only fetching - // 1 row. The answer came back from the JavaSoft people that it - // does indeed limit the number of rows in the result set, not - // necessarily the number of fetches. - // - public void setMaxRows (int maxRows) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - - // Validate the argument. - if(maxRows < 0) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - maxRows_ = maxRows; - - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Max rows", maxRows_); - } - } - - - - /** - Sets the query timeout limit. The query timeout limit - is the number of seconds that the driver will wait for a - SQL statement to execute. - -

        This is implemented using the database query time limit, also - known as QQRYTIMLMT. This value specifies the query processing time limit that is - compared to the estimated number of elapsed seconds that a query must run. The - time limit determines if the database query can start. - -

        Beginning with Version 6 Release 1 of IBM i, you must have *JOBCTL special authority. - - @param queryTimeout The query timeout limit (in seconds) - or 0 for no limit. The default is the job's query timeout limit - value unless this method is explicitly called. - - @exception SQLException If the statement is not open - or the input value is not valid. - **/ - public void setQueryTimeout (int queryTimeout) - throws SQLException - { - synchronized(internalLock_) - { // @E6A - checkOpen (); - - // Validate the argument. - if(queryTimeout < 0) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - if((queryTimeout_ != queryTimeout) || !queryTimeoutSet_) /*@B2C*/ - { - queryTimeoutSet_ = true; /*@B2A*/ - queryTimeout_ = queryTimeout; - - // Since we store the query timeout in the RPB, we need - // to sync it after a change. - rpbSyncNeeded_ = true; - rpbQueryTimeoutChanged_ = true; //@EFA - } - - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Query timeout", queryTimeout_); - } - } - - - - /** - Creates or changes the RPB (Request Parameter Block) for the - statement. - - @exception SQLException If an error occurs. - **/ - private void syncRPB () - throws SQLException - { - if(rpbSyncNeeded_) - { - - int functionId = rpbCreated_ ? DBSQLRPBDS.FUNCTIONID_CHANGE_RPB - : DBSQLRPBDS.FUNCTIONID_CREATE_RPB; - - DBSQLRPBDS request = null; //@P0A - try - { - request = DBDSPool.getDBSQLRPBDS(functionId, id_, 0, 0); //@P0C - - request.setPrepareStatementName (name_, connection_.converter_); //@P0C - request.setCursorName (cursor_.getName (), connection_.converter_); //@P0C - - if(packageManager_.isEnabled()) - request.setLibraryName (packageManager_.getLibraryName (), connection_.converter_); //@P0C - - if(rpbQueryTimeoutChanged_) //@EFA - { - if(queryTimeout_ > 0) - request.setQueryTimeout (queryTimeout_); - else - request.setQueryTimeout (-1); - } - - if(! connection_.getMustSpecifyForUpdate()) // @J3a @J31c - { - // @J3a - if(resultSetConcurrency_ == ResultSet.CONCUR_UPDATABLE) // @J3a - request.setOpenAttributes(0x10 + 0x20 + 0x40 + 0x80); // @J3a - } // @J3a - - //@F5D Do not need to specify this on the RPB - //@F5D Check system level before sending new code point - //@F5D if (connection_.getVRM() >= JDUtilities.vrm520) // @F4A - //@F5D { - //@F5D if (resultSetHoldability_ == AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT) // @F4A - //@F5D request.setResultSetHoldabilityOption((byte)0xD5); // @F4A - //@F5D else if (resultSetHoldability_ == AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT) // @F4A - //@F5D request.setResultSetHoldabilityOption((byte)0xE8); // @F4A - //@F5D} - - connection_.send (request, id_); - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - finally - { //@P0A - if(request != null) { - request.returnToPool(); request = null; - } - } - - rpbCreated_ = true; - rpbSyncNeeded_ = false; - } - } - - - - /** - Returns the statement name. - - @return The statement name. - **/ - public String toString () - { - return name_; - } - - - /** - Verifies values for the autoGeneratedKey parameter. - - @param autoGeneratedKeys Valid values are Statement.RETURN_GENERATED_KEYS and - Statement.NO_GENERATED_KEYS. - @exception SQLException If an error occurs. - **/ - static final void verifyGeneratedKeysParameter (int autoGeneratedKeys) - throws SQLException - { - if((autoGeneratedKeys != NO_GENERATED_KEYS) - && (autoGeneratedKeys != RETURN_GENERATED_KEYS)) - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - } - - - //@PDA jdbc40 - /** - * Requests that a Statement be pooled or not pooled. The value - * specified is a hint to the statement pool implementation indicating - * whether the applicaiton wants the statement to be pooled. It is up to - * the statement pool manager as to whether the hint is used. - *

        - * The poolable value of a statement is applicable to both internal - * statement caches implemented by the driver and external statement caches - * implemented by application servers and other applications. - *

        - * By default, a Statement is poolable when it is created. - *

        - * @param poolable requests that the statement be pooled if true and - * that the statement not be pooled if false - *

        - * @throws SQLException if the Statement has been closed - *

        - */ - public void setPoolable(boolean poolable) throws SQLException - { - checkOpen();//@pda do same as native - isPoolable_ = poolable; - } - - //@PDA jdbc40 - /** - * Returns the value of the statements poolable hint, indicating whether - * pooling of the statement is requested. - *

        - * @return The value of the statements poolable hint. - *

        - * @throws SQLException if the Statement has been closed - *

        - * see java.sql.Statement#setPoolable(boolean) setPoolable(boolean) - */ - public boolean isPoolable() throws SQLException - { - checkOpen();//@pda do same as native - return isPoolable_; - } - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "com.ibm.as400.access.AS400JDBCStatement", "java.sql.Statement" }; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCStatementListener.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCStatementListener.java deleted file mode 100644 index 7f19e5726..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCStatementListener.java +++ /dev/null @@ -1,46 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCStatementListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.*; - -/** - * Represents a listener that will get notified when certain events occur during the processing of an SQL statement. - * Note that {@link #modifySQL modifySQL()} is called before {@link #commentsStripped commentsStripped()} is called. - * The methods on this listener are invoked when the Toolbox JDBC driver constructs an SQL statement internally, - * before it is executed on the server. -**/ -public interface AS400JDBCStatementListener -{ - /** - * Gives the listener an opportunity to modify the SQL statement before it is executed. - * @param connection The connection to the server that the statement will execute under. - * @param sql The original SQL string. - * @return The SQL string this listener wants to execute instead of the original. If this - * listener does not want to modify the SQL string, then it should either return the sql parameter - * as it was passed in, or null. Returning null will cause the Toolbox JDBC driver to use the original SQL string. - * @throws SQLException Thrown by the listener if necessary. - **/ - public String modifySQL(Connection connection, String sql) throws SQLException; - - /** - * Notifies the listener that comments have been stripped off of the SQL statement to be executed. - * @param connection The connection to the server that the statement will execute under. - * @param oldSQL The original SQL string. - * @param newSQL The SQL string with comments stripped off of it. - * @throws SQLException Thrown by the listener if necessary. - **/ - public void commentsStripped(Connection connection, String oldSQL, String newSQL) throws SQLException; - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCStatementLock.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCStatementLock.java deleted file mode 100644 index d317cd22e..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCStatementLock.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.ibm.as400.access; - -class AS400JDBCStatementLock extends Object { - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCWriter.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCWriter.java deleted file mode 100644 index 6472c20f1..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCWriter.java +++ /dev/null @@ -1,181 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCWriter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.Writer; -import java.sql.DriverManager; -import java.sql.SQLException; - - -/** -The AS400JDBCWriter class provides a stream -to write into large objects. The data is valid only within the current -transaction. Users get one of these objects by calling Clob.setCharacterStream() -which returns an object of type Writer. -**/ -class AS400JDBCWriter extends Writer -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - - private boolean closed_ = false; // is the stream closed? - private long position_; // position from which the user wanted us to start writing - private AS400JDBCClob clob_; // We have separate vars for clob and locator to remove build dependency on JDBC 3.0. - private AS400JDBCClobLocator locator_; - private AS400JDBCSQLXML xml_; //@pda jdbc40 - - - AS400JDBCWriter(AS400JDBCClob clob, long positionToStartWriting) - { - clob_ = clob; - position_ = positionToStartWriting; - } - - - AS400JDBCWriter(AS400JDBCClobLocator locator, long positionToStartWriting) - { - locator_ = locator; - position_ = positionToStartWriting; - } - - //@pda jdbc40 - AS400JDBCWriter(AS400JDBCSQLXML xml, long positionToStartWriting) - { - xml_ = xml; - position_ = positionToStartWriting; - } - - - - - /* - Close the writer. - */ - public void close() - { - closed_ = true; - } - - - /* - Flush the writer. - */ - public void flush() - { - //no-op - } - - - - /* - Write a character array to the writer. - - @param cbuf The character byte array the user wants written to the writer. - */ - public void write(char[] cbuf) throws IOException - { - if (cbuf == null) throw new NullPointerException("cbuf"); - - if (closed_) throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - - write(cbuf, 0, cbuf.length); - } - - - - /* - Write a character array to the writer from offset off for len characters. - - @param cbuf The character array the user wants written to the writer. - @param off The offset into the character array that the user wants written to the - writer (1-based). - @param len The number of bytes the user wants written to the writer - from the byte array they passed in. - */ - public void write(char[] cbuf, int off, int len) throws IOException - { - if (cbuf == null) throw new NullPointerException("cbuf"); - if ((off < 0) || (off > len)) throw new ExtendedIllegalArgumentException("off", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if (len < 0) throw new ExtendedIllegalArgumentException("len", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - if (closed_) throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - - write(new String(cbuf, off, len)); - } - - - - /* - Write a character to the writer. - - @param cbuf The character the user wants written to the writer. - */ - public void write(int c) throws IOException - { - if (closed_) throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - - write(new String(new char[] { (char)c})); - } - - - - /* - Write a String to the writer from offset off for len characters. - - @param str The string the user wants written to the writer. - */ - public void write(String str) throws IOException - { - if (str == null) throw new NullPointerException("str"); - - if (closed_) throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - - write(str, 0, str.length()); - } - - - - /* - Write a String to the writer from offset off for len characters. - - @param str The String the user wants written to the writer. - @param off The offset into the character array that the user wants written to the - writer. - @param len The number of bytes the user wants written to the writer - from the byte array they passed in. - */ - public synchronized void write(String str, int off, int len) throws IOException - { - if (str == null) throw new NullPointerException("str"); - if ((off < 0) || (off > len)) throw new ExtendedIllegalArgumentException("off", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if (len < 0) throw new ExtendedIllegalArgumentException("len", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - if (closed_) throw new ExtendedIOException(ExtendedIOException.RESOURCE_NOT_AVAILABLE); - - try - { - if (clob_ != null) clob_.setString(position_, str, off, len); - else if (locator_ != null) locator_.setString(position_, str, off, len); //@PDC jdbc40 - else if (xml_ != null ) xml_.setString(position_, str, off, len); //@PDA jdbc40 - position_ += len; - } - catch (SQLException e) - { - if (JDTrace.isTraceOn()) e.printStackTrace(DriverManager.getLogWriter()); - closed_ = true; - throw new IOException(e.getMessage()); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCXAConnection.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCXAConnection.java deleted file mode 100644 index 25e070cda..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCXAConnection.java +++ /dev/null @@ -1,148 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCXAConnection.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.Connection; -import java.sql.SQLException; -import javax.sql.XAConnection; -import javax.transaction.xa.XAException; -import javax.transaction.xa.XAResource; - - - -/** -The AS400JDBCXACConnection class represents a pooled connection -object that provides hooks for connection pool management and -XA resource management. - -

        Because transaction boundaries are controlled by a -transaction manager, the caller cannot explicitly commit -or rollback on connections pooled by this object. In addition, -auto commit is initialized to false and cannot be set to true. - -

        -This support is only available when connecting to systems running OS/400 V5R1 or later, or IBM i. - -

        The following example creates an AS400JDBCXAConnection object -that can be used to manage XA transactions. - -

        -// Create an XA data source for making the XA connection. -AS400JDBCXADataSource xaDataSource = new AS400JDBCXADataSource("myAS400"); -xaDataSource.setUser("muUser"); -xaDataSource.setPassword("myPasswd"); - -// Get an XAConnection and get the associated XAResource. -// This provides access to the resource manager. -XAConnection xaConnection = xaDataSource.getXAConnection(); -XAResource xaResource = xaConnection.getXAResource(); - -// ... work with the XA resource. - -// Close the XA connection when done. This implicitly -// closes the XA resource. -xaConnection.close(); -
        - -@see AS400JDBCXADataSource -@see AS400JDBCXAResource -**/ -public class AS400JDBCXAConnection -extends AS400JDBCPooledConnection -implements XAConnection -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - // Private data. - private AS400JDBCConnection connection_ = null; - private AS400JDBCXAResource xaResource_ = null; - - - -/** -Constructs an AS400JDBCXAConnection object. - -@param connection The connection to use for XA flows. -**/ - AS400JDBCXAConnection(Connection connection) - throws SQLException - { - super(connection); - connection_ = (AS400JDBCConnection)connection; - } - - - -/** -Closes the physical connection. This closes the associated -XA resource, if any. - -@exception SQLException If an error occurs. -**/ -/* @A1D - public void close() - throws SQLException - { - super.close(); - - if (xaResource_ != null) { - try { - xaResource_.close(); - } - catch(XAException e) { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); - } - xaResource_ = null; - } - } - */ - - - -/** -Returns the XA resource associated with this connection. -This implicitly opens the resource the first time it is -called. - -@return The XA resource. - -@exception SQLException If an error occurs. -**/ - public XAResource getXAResource() - throws SQLException - { - if (connection_ == null) - JDError.throwSQLException (JDError.EXC_CONNECTION_NONE); - if (connection_.isClosed()) - JDError.throwSQLException (JDError.EXC_CONNECTION_NONE); - - // The spec says we should create at most one XA resource for - // each connection, and return the same one on subsequent. - if (xaResource_ == null) { - try { - xaResource_ = new AS400JDBCXAResource(connection_); - } - catch(XAException e) { - JDError.throwSQLException(JDError.EXC_CONNECTION_UNABLE, e); - } - } - - return xaResource_; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCXADataSource.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCXADataSource.java deleted file mode 100644 index 7125ecc3f..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCXADataSource.java +++ /dev/null @@ -1,176 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCXADataSource.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; -import javax.naming.NamingException; -import javax.naming.Reference; -import javax.sql.XAConnection; -import javax.sql.XADataSource; - - -/** -The AS400JDBCXADataSource class represents a factory for -AS400JDBCXAConnection objects. - -

        -This support is only available when connecting to systems running OS/400 V5R1 or later, or IBM i. - -

        The following example creates an AS400JDBCXADataSource -object and creates a connection to the database. - -

        -// Create an XA data source for making the connection. -AS400JDBCXADataSource xaDataSource = new AS400JDBCXADataSource("myAS400"); -xaDataSource.setUser("myUser"); -xaDataSource.setPassword("myPasswd"); - -// Get the XAConnection. -XAConnection xaConnection = xaDataSource.getXAConnection(); -
        - -@see AS400JDBCXAConnection -@see AS400JDBCXAResource -**/ -public class AS400JDBCXADataSource -extends AS400JDBCDataSource -implements XADataSource -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - -/** -Constructs a default AS400JDBCXADataSource object. -**/ - public AS400JDBCXADataSource() - { - super(); - } - - - -/** -Constructs an AS400JDBCXADataSource with the specified serverName. - -@param serverName The name of the IBM i system. -**/ - public AS400JDBCXADataSource(String serverName) - { - super(serverName); - } - - - -/** -Constructs an AS400JDBCXADataSource with the specified signon information. - -@param serverName The name of the IBM i system. -@param user The user id. -@param password The password. -**/ - public AS400JDBCXADataSource(String serverName, String user, String password) - { - super(serverName, user, password); - } - - -//@A1A -/** -Constructs an AS400JDBCXADataSource with the specified signon information -to use for SSL communications with the IBM i system. - -@param serverName The name of the IBM i system. -@param user The user id. -@param password The password. -@param keyRingName The key ring class name to be used for SSL communications with the system. -@param keyRingPassword The password for the key ring class to be used for SSL communications with the system. -**/ - public AS400JDBCXADataSource(String serverName, String user, String password, - String keyRingName, String keyRingPassword) - { - super(serverName, user, password, keyRingName, keyRingPassword); - } - - -// @F0A - added the following constructor to avoid some object construction -/** -* Constructs an AS400JDBCXADataSource from the specified Reference -* @param reference to retrieve DataSource properties from -**/ - AS400JDBCXADataSource(Reference reference) { - super(reference); - } - - -/** -Returns an XA connection to IBM i. - -@return An XA connection. -@exception SQLException If a database error occurs. -**/ - public XAConnection getXAConnection() - throws SQLException - { - AS400JDBCConnection connection = (AS400JDBCConnection)getConnection(); - return new AS400JDBCXAConnection(connection); - } - - - -/** -Returns an XA connection to IBM i. - -@param user The userid for the connection. -@param password The password for the connection. -@return An XA connection. -@exception SQLException If a database error occurs. -**/ - public XAConnection getXAConnection(String user, String password) - throws SQLException - { - AS400JDBCConnection connection = (AS400JDBCConnection)getConnection(user, password); - return new AS400JDBCXAConnection(connection); - } - - - -/** -Returns the Reference object for the data source object. -This is used by JNDI when bound in a JNDI naming service. -Contains the information necessary to reconstruct the data source -object when it is later retrieved from JNDI via an object factory. - -@return A Reference object for the data source object. -@exception NamingException If a naming error occurs resolving the object. -**/ - public Reference getReference() - throws NamingException - { - Reference ref = new Reference(this.getClass().getName(), - "com.ibm.as400.access.AS400JDBCObjectFactory", - null); - - Reference dsRef = super.getReference(); - for (int i=0; i< dsRef.size(); i++) - ref.add( dsRef.get(i) ); - - return ref; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCXADataSource16.gif b/cvsroot/src/com/ibm/as400/access/AS400JDBCXADataSource16.gif deleted file mode 100644 index 1d7218527..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400JDBCXADataSource16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCXADataSource32.gif b/cvsroot/src/com/ibm/as400/access/AS400JDBCXADataSource32.gif deleted file mode 100644 index 29c732988..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400JDBCXADataSource32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCXADataSourceBeanInfo.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCXADataSourceBeanInfo.java deleted file mode 100644 index 046248d8c..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCXADataSourceBeanInfo.java +++ /dev/null @@ -1,74 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCXADataSourceBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; - - - -/** -* The AS400JDBCXADataSourceBeanInfo class provides bean information -* for the AS400JDBCXADataSource class. -**/ -public class AS400JDBCXADataSourceBeanInfo extends SimpleBeanInfo -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = AS400JDBCXADataSource.class; // @A1c - - /** - * Returns additional bean information from the AS400JDBCXADataSourceBeanInfo superclass. - * @return The bean information. - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new AS400JDBCDataSourceBeanInfo() }; - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("AS400JDBCXADataSourceBeanInfo16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("AS400JDBCXADataSourceBeanInfo32.gif"); - break; - } - return image; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCXAResource.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCXAResource.java deleted file mode 100644 index 2c96853ab..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCXAResource.java +++ /dev/null @@ -1,984 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCXAResource.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.DriverManager; -import java.util.Vector; -import javax.transaction.xa.XAException; -import javax.transaction.xa.XAResource; -import javax.transaction.xa.Xid; -import java.sql.SQLException; - - - -/** -The AS400JDBCXAResource class represents a resource manager -for use in XA transaction management. - -

        This support is only available when connecting to systems running OS/400 V5R1 or later, or IBM i. - -

        The following example creates an AS400JDBCXAResource object -that can be used to work with the XA resource manager. - -

        -// Create an XA data source for making the XA connection. -AS400JDBCXADataSource xaDataSource = new AS400JDBCXADataSource("myAS400"); -xaDataSource.setUser("myUser"); -xaDataSource.setPassword("myPasswd"); - -// Get an XAConnection and get the associated XAResource. -// This provides access to the resource manager. -XAConnection xaConnection = xaDataSource.getXAConnection(); -XAResource xaResource = xaConnection.getXAResource(); - -// ... work with the XA resource. - -// Close the XA connection when done. This implicitly -// closes the XA resource. -xaConnection.close(); -
        - -@see AS400JDBCXAConnection -@see AS400JDBCXADataSource -**/ -// -// Implementation note: -// -// 1. Information from Fred Kulack: Closing the XAConnection does not -// affect the XAResource directly. Only some of the methods in XAResource -// affect the associated physical XA connection (start, end). The other calls, -// (prepare/commit/rollback/recover, etc) can always be used on any XAResource -// object, regardless of the state of the XAConnection from which it was created. -// i.e. XAResources are NOT associated with transaction branches. Instead, -// connections are. The XAResource is just the interface that you use to -// control the transactions. Conceptually, a couple of the methods have sort of -// an implicit parameter of the XAConnection from which it was created. -// -// 2. Information from Randy Johnson: A single connection cannot be 'multi-plexed' -// between active transaction branches. In other words, the following scenario -// does not work: -// -// xa_start XID 1 over connection A -// xa_end XID 1 over connection A -// xa_start XID 2 over connection A <-- this will fail because the connection -// is still associated with the XID 1 transaction -// branch. -// -// That XID 1 transaction branch must be committed (xa_commit) or rolled back -// (xa_rollback) before the connection can be used to start a new transaction branch. -// -// 3. Information from Randy Johnson: Multiple connections cannot be used to work -// on the same transaction branch. In other words, the following scenario does not -// work: -// -// xa_start XID 1 over connection A -// xa_end XID 1 over connection A -// xa_start XID 1 with TMJOIN over connection B <-- this will fail because you are -// trying to use 2 different connections -// to work on a single transaction branch. -// -// JTA is currently living with these restrictions, but believe they will be unacceptable -// sometime in the future (how far into the future is undetermined). We are hoping to -// solve this as part of Solomon, but there is no near term solution for either of -// these. The MTS support on the client will work around this by making sure all the -// work for a transaction branch, including the XA API invocations, are sent over a -// single Client Access-Host Server connection, regardless of which thread the application -// issues its requests from, and over which logical SQL connection on the client the -// requests are issued. This is part of the function that they are porting from Toronto. -// -// 4. Information from Randy Johnson: I see that we are planning to reject ANY xa_start -// request that specifies the TMRESUME or TMJOIN flags. Likewise, we will reject ANY -// xa_end request that specifies the TMSUSPEND flag. In other words, a transaction -// branch must consist only of: -// -// xa_start -// xa_end -// xa_commit or xa_rollback -// -// This means that the restrictions I outlined in my previous note are actually a -// little more severe than I indicated before. For example, both the following -// scenarios will not work: -// -// xa_start for XID 1 over connection A -// xa_end with TMSUSPEND for XID 1 over connection A <--rejected -// xa_start with TMRESUME for XID 1 over connection A -// xa_end for XID 1 over connection A -// xa_commit or xa_rollback for XID 1 -// -// xa_start for XID 1 over connection A -// xa_end for XID 1 over connection A -// xa_start with TMJOIN for XID 1 over connection A <--rejected -// xa_end for XID 1 over connection A -// xa_commit or xa_rollback for XID 1 -// -// We could probably support these last 2 scenarios if it is deemed critical, -// but we wouldn't be able to support the scenarios I laid out in the previous note. -// -public class AS400JDBCXAResource -implements XAResource -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - // Private data. - private static int COUNT_ = 64; - static byte[] DEFAULT_XA_INFORMATION_ = new byte[256]; - - // Start the resource manager IDs at 0xC0001. The system does not like 0. - // Microsoft starts at 1. CA ODBC will start with something else. This will - // enable us to quickly identify ours. - private static int nextResourceManagerID_ = 0xC001; - private static Object nextResourceManagerIDLock_ = new Object(); - - private AS400JDBCConnection connection_; - // @A1D private boolean closed_ = false; - private int resourceManagerID_ = -1; - private Xid started_ = null; - private Vector allXids = new Vector(); //@PDA keep track of >1 xid. (issue 29395) - private JDTransactionManager transactionManager_; - private int transactionTimeout_ = 0; //@K1A - private int lockWait_ = -1; //@K1A - - -/** -Constructs an AS400JDBCXAResource object. - -@param connection The connection. - -@exception XAException If an error occurs. -**/ - AS400JDBCXAResource(AS400JDBCConnection connection) - throws XAException - { - connection_ = connection; - transactionManager_ = connection_.getTransactionManager(); - - synchronized(nextResourceManagerIDLock_) - { - resourceManagerID_ = nextResourceManagerID_++; - } - - // @A1D open(); - } - - - -/** -Closes the resource manager. - -@exception XAException If an error occurs. -**/ - /* @A1D - The host server team says we should never need to call this. - void close() - throws XAException - { - try { - if (JDTrace.isTraceOn()) { - JDTrace.logInformation(this, "xa_close"); - JDTrace.logClose(this); - } - - DBXARequestDS request = new DBXARequestDS(DBXARequestDS.REQUESTID_XA_CLOSE, 0, - DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); - request.setResourceManagerID(resourceManagerID_); - request.setXAInformation(DEFAULT_XA_INFORMATION_); - request.setFlags(TMNOFLAGS); - - DBReplyRequestedDS reply = connection_.sendAndReceive (request); - processXAReturnCode(reply); - - closed_ = true; - } - catch (Exception e) { - throwXAException(e); - } - } - */ - - - - - - -/** -Commits a global transaction. - -@param xid The global transaction identifier. -@param onePhase true if the resource manager should use a one-phase - commit protocol to commit the work; false otherwise. - -@exception XAException If an error occurs. -**/ - public void commit(Xid xid, boolean onePhase) - throws XAException - { - try - { - // Parameter validation. - if (xid == null) - throw new XAException(XAException.XAER_INVAL); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "xa_commit"); - - // Send the request. - //@P0C - DBXARequestDS request = null; - DBReplyRequestedDS reply = null; - int returnCode = 0; //@pda - try - { - request = DBDSPool.getDBXARequestDS(DBXARequestDS.REQUESTID_XA_COMMIT, 0, - DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); - request.setResourceManagerID(resourceManagerID_); - request.setXid(AS400JDBCXid.xidToBytes(xid)); - request.setFlags(onePhase ? TMONEPHASE : TMNOFLAGS); - - reply = connection_.sendAndReceive (request); - returnCode = processXAReturnCode(reply); //@pdc - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - if (reply != null) { reply.returnToPool(); reply = null; } - } - - // Mark the transaction state. - transactionManager_.markGlobalTransactionBoundary(); - - //@KKB resend the transaction isolation since IBM i gets reset somehow - transactionManager_.resetXAServer(); - - if ((connection_.transactionManager_.getHoldIndicator() == JDTransactionManager.CURSOR_HOLD_FALSE )//@XAC - || (connection_.checkStatementHoldability_ && connection_.getVRM() >= JDUtilities.vrm520)) // @F3A - connection_.markCursorsClosed(false); //@XAC - - //@pda throw XAException for return codes not thrown in processXAReturnCode() - if(returnCode != 0) - throw new XAException(returnCode); - } - catch (XAException e) - { - throw e; - } - catch (Exception e) - { - throwXAException(e); - } - } - - - -/** -Ends the work performed on behalf of a transaction branch. The resource -manager disassociates the XA resource from the transaction branch -specified and lets the transaction be completed. - -@param xid The global transaction identifier. This must correspond - to the global transaction identifier previously passed - to start(). -@param flags The flags. Possible values are: -
          -
        • TMSUCCESS - The portion of work has completed - successfully. -
        • TMFAIL - The portion of work has failed. The resource - manager may mark the transaction as rollback-only. -
        • TMSUSPEND - The transaction branch is temporarily - suspended in incomplete state. The transaction - context is in suspend state and must be resumed - via start() with TMRESUME. - (This is not currently supported for V5R2 and earlier versions.) -
        - -@exception XAException If an error occurs. -**/ - public void end(Xid xid, int flags) - throws XAException - { - try - { - // Parameter validation. - if (xid == null) - throw new XAException(XAException.XAER_INVAL); - // @PDC This allows for a TMSUSPENDed branch to be ended with - // TMSUCCESS (and implicit TMRESUME) per XA spec. - if (allXids.contains(xid) == false) - throw new XAException(XAException.XAER_PROTO); - - if(connection_.getServerFunctionalLevel() < 11) - { - if ((flags != TMSUCCESS) && (flags != TMFAIL)) - throw new XAException(XAException.XAER_INVAL); - } - - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "xa_end"); - - // Send the request. - //@P0C - DBXARequestDS request = null; - DBReplyRequestedDS reply = null; - int returnCode = 0; //@pda - try - { - request = DBDSPool.getDBXARequestDS(DBXARequestDS.REQUESTID_XA_END, 0, - DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); - request.setResourceManagerID(resourceManagerID_); - request.setXid(AS400JDBCXid.xidToBytes(xid)); - request.setFlags(flags); - - reply = connection_.sendAndReceive (request); - returnCode = processXAReturnCode(reply); //@pdc - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - if (reply != null) { reply.returnToPool(); reply = null; } - } - - // Mark the transaction state. - transactionManager_.setLocalTransaction(true); - started_ = null; - insertRemoveXidByFlag(xid, flags); - - //@pda throw XAException for return codes not thrown in processXAReturnCode() - //note behavior change: when doing end(TMFAIL), it will throw XAException(XA_RB*) per spec as Native driver does already - if(returnCode != 0) - throw new XAException(returnCode); - } - catch (XAException e) - { - throw e; - } - catch (Exception e) - { - throwXAException(e); - } - } - - - -/** -Closes the resource manager if not explicitly closed by the caller. - -@exception Throwable If an error occurs. -**/ - /* @A1D - protected void finalize() - throws Throwable - { - if (!closed_) - close(); - super.finalize(); - } - */ - - - -/** -Tells the resource manager to forget about a heuristically completed -transaction branch. - -@param xid The global transaction identifier. - -@exception XAException If an error occurs. -**/ -// -// Implementation note: -// -// When a global transaction has been prepared, it stays around forever. -// Forget is what gets rid of it. -// - public void forget(Xid xid) - throws XAException - { - try - { - // Parameter validation. - if (xid == null) - throw new XAException(XAException.XAER_INVAL); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "xa_forget"); - - // Send the request. - //@P0C - DBXARequestDS request = null; - DBReplyRequestedDS reply = null; - int returnCode = 0; //@pda - try - { - request = DBDSPool.getDBXARequestDS(DBXARequestDS.REQUESTID_XA_FORGET, 0, - DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); - request.setResourceManagerID(resourceManagerID_); - request.setXid(AS400JDBCXid.xidToBytes(xid)); - request.setFlags(TMNOFLAGS); - - reply = connection_.sendAndReceive (request); - returnCode = processXAReturnCode(reply); //@pdc - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - if (reply != null) { reply.returnToPool(); reply = null; } - } - - //@pda throw XAException for return codes not thrown in processXAReturnCode() - //if this gets > 0 return codes, we want to ignore since method only throws XAER_* codes - if(returnCode < 0) - throw new XAException(returnCode); - } - catch (XAException e) - { - throw e; - } - catch (Exception e) - { - throwXAException(e); - } - } - - - -/** -Returns the current transaction timeout value. - -@return The current transaction timeout value. - -@exception XAException If an error occurs. -**/ - public int getTransactionTimeout() - throws XAException - { - //@K1D return 0; - return transactionTimeout_; - } - -/** @PDA -Adds or Removes xid from Vector based on flag. -Called from start() and end(). -Keeps list of all xids that have been start() with TMNOFLAGS OR TMJOIN. -When end() is called with TMSUCCESS or TMFAIL, the xid is removed. -When start() with flag TMSUSPEND or TMRESUME is called, neither added or removed. - -**/ - private void insertRemoveXidByFlag(Xid xid, int flags) - { - if( flags == TMNOFLAGS ) - { - if(allXids.contains(xid) == false) - allXids.add(xid); - } - else if( (flags & TMJOIN) == TMJOIN) - { - if(allXids.contains(xid) == false) - allXids.add(xid); - } - else if( (flags & TMSUCCESS) == TMSUCCESS) - { - allXids.remove(xid); - } - else if( (flags & TMFAIL) == TMFAIL) - { - allXids.remove(xid); - } - } - -/** -Indicates if the resource manager represented by this XA resource -is the same resource manager represented by the specified XA resource. - -@param xaResource The XA resource. -@return true if both XA resources represent the same - resource manager, false otherwise. - -@exception XAException If an error occurs. -**/ - public boolean isSameRM(XAResource xaResource) - throws XAException - { - if (xaResource == null) - return false; - if (! (xaResource instanceof AS400JDBCXAResource)) - return false; - //@PDC per spec at java.sun.com/products/jta isSameRM it connected to same RM - //for now, we will do same as native driver, and compare system names - try{ - return ( connection_.getCatalog().equalsIgnoreCase( ((AS400JDBCXAResource)xaResource).connection_.getCatalog())); - }catch (SQLException e){ - return false; - } - // return(((AS400JDBCXAResource)xaResource).resourceManagerID_ == resourceManagerID_); - } - - - -/** -Opens the resource manager. - -@exception XAException If an error occurs. -**/ - /* @A1D - The host server team says we never need to call this. - private void open() - throws XAException - { - try { - if (JDTrace.isTraceOn()) { - JDTrace.logOpen(this); - JDTrace.logInformation(this, "xa_open"); - } - - DBXARequestDS request = new DBXARequestDS(DBXARequestDS.REQUESTID_XA_OPEN, 0, - DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); - request.setResourceManagerID(resourceManagerID_); - request.setXAInformation(DEFAULT_XA_INFORMATION_); - request.setFlags(TMNOFLAGS); - - DBReplyRequestedDS reply = connection_.sendAndReceive (request); - processXAReturnCode(reply); - } - catch (Exception e) { - throwXAException(e); - } - } - */ - - - -/** -Prepares for a transaction commit. - -@param xid The global transaction identifier. -@return One of the following values: -
          -
        • XA_OK - The transaction work has been prepared - normally. -
        • XA_RDONLY - The transaction branch has been read-only - and has been committed. -
        - -@exception XAException If an error occurs. -**/ -// -// Implementation note: -// -// Once a global transaction has been prepared, it is around until it is committed, -// rolled back, or forgotten. -// - public int prepare(Xid xid) - throws XAException - { - try - { - // Parameter validation. - if (xid == null) - throw new XAException(XAException.XAER_INVAL); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "xa_prepare"); - - // Send the request. - //@P0C - DBXARequestDS request = null; - DBReplyRequestedDS reply = null; - int returnCode = 0; //@pda - try - { - request = DBDSPool.getDBXARequestDS(DBXARequestDS.REQUESTID_XA_PREPARE, 0, - DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); - request.setResourceManagerID(resourceManagerID_); - request.setXid(AS400JDBCXid.xidToBytes(xid)); - request.setFlags(TMNOFLAGS); - - reply = connection_.sendAndReceive (request); - returnCode = processXAReturnCode(reply); //@pdc - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - if (reply != null) { reply.returnToPool(); reply = null; } - } - //@pda throw XAException for return codes not thrown in processXAReturnCode() - //per spec: return if XA_RDONLY or XA_OK, throw XAExecption for anything else - if(returnCode == 0 || returnCode == XAException.XA_RDONLY) - return returnCode; - else - throw new XAException(returnCode); - } - catch (XAException e) - { - throw e; - } - catch (Exception e) - { - throwXAException(e); - return -1; - } - } - - - -/** -Processes the XA return code. - -@param reply The reply data stream. -@return The XA return code if error class is 0. - -@exception XAException If the error class is not 0. -**/ - private int processXAReturnCode(DBReplyRequestedDS reply) - throws XAException - { - int errorClass = reply.getErrorClass(); - int returnValue = reply.getReturnCode(); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "xa error class = " + errorClass + ", return code = " + returnValue); - - if (returnValue < 0) - { - if (errorClass == 9) - throw new XAException(returnValue); - else if (errorClass != 0) - throw new XAException(XAException.XAER_RMFAIL); - else - return returnValue; - } - else - return returnValue; - } - - - -/** -Recovers a list of prepared transaction branches from the -resource manager. - -@param flags The flags. Possible values are: -
          -
        • TMSTARTRSCAN - Start a recovery scan. -
        • TMENDRSCAN - End a recovery scan. -
        • TMNOFLAGS - No flags are set. -
        -@return The global transaction identifiers for the - transaction branches that are currently in - a prepared or heuristically completed state. - -@exception XAException If an error occurs. -**/ -// -// This gives a list of all prepared global transactions. -// - public Xid[] recover(int flags) - throws XAException - { - try - { - // Parameter validation. - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "xa_recover"); - - // Send the request. - - // We will return at most COUNT Xids. It is up to the - // caller to call us again if they want more. Typically, - // the first time they call us, they will pass TMSTARTRSCAN. - // Subsequent calls, they will pass TMNOFLAGS. The last time - // they will pass TMENDRSCAN. - //@P0C - DBXARequestDS request = null; - DBReplyRequestedDS reply = null; - int returnCode = 0; //@pda - try - { - request = DBDSPool.getDBXARequestDS(DBXARequestDS.REQUESTID_XA_RECOVER, 0, - DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); - request.setResourceManagerID(resourceManagerID_); - request.setCount(COUNT_); - request.setFlags(flags); - - reply = connection_.sendAndReceive (request); - returnCode = processXAReturnCode(reply); //@pdc - - DBReplyXids xids = reply.getXids(); - - //@pda throw XAException for return codes not thrown in processXAReturnCode() - //if this gets > 0 return codes, we want to ignore since method only throws XAER_* codes - //note: system returns xid count via return code. - if(returnCode < 0) - throw new XAException(returnCode); - - return xids.getXidArray(); - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - if (reply != null) { reply.returnToPool(); reply = null; } - } - } - catch (XAException e) - { - throw e; - } - catch (Exception e) - { - throwXAException(e); - return null; - } - } - - - -/** -Rolls back a transaction branch. - -@param xid The global transaction identifier. - -@exception XAException If an error occurs. -**/ - public void rollback(Xid xid) - throws XAException - { - try - { - // Parameter validation. - if (xid == null) - throw new XAException(XAException.XAER_INVAL); - - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "xa_rollback"); - - // Send the request. - //@P0C - DBXARequestDS request = null; - DBReplyRequestedDS reply = null; - int returnCode = 0; //@pda - try - { - request = DBDSPool.getDBXARequestDS(DBXARequestDS.REQUESTID_XA_ROLLBACK, 0, - DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); - request.setResourceManagerID(resourceManagerID_); - request.setXid(AS400JDBCXid.xidToBytes(xid)); - request.setFlags(TMNOFLAGS); - - reply = connection_.sendAndReceive (request); - returnCode = processXAReturnCode(reply); //@pdc - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - if (reply != null) { reply.returnToPool(); reply = null; } - } - - // Mark the transaction state. - transactionManager_.markGlobalTransactionBoundary(); - - //@KKB resend the transaction isolation since IBM i gets reset somehow - transactionManager_.resetXAServer(); - - //@pda throw XAException for return codes not thrown in processXAReturnCode() - //Spec does not specify exactly which return codes are valid to throw in XAException, - //other when "an error occurred". So just throw back for < 0 return codes until future spec specifies otherwise. - if(returnCode != 0) //@pxc - throw new XAException(returnCode); - - } - catch (XAException e) - { - throw e; - } - catch (Exception e) - { - throwXAException(e); - } - } - - - -/** -Sets the current transaction timeout value. This is not supported. - -@param transactionTimeout The current transaction timeout value in seconds, - or 0 to reset the timeout value to the default. The transaction timeout - will be set the next time start() is called. -@return true if the timeout value can be set successfully, - false if the resource manager does not support - the transaction timeout value to be set. -@exception XAException If an error occurs. -**/ - public boolean setTransactionTimeout(int transactionTimeout) - throws XAException - { - try - { - if(connection_.getVRM() < JDUtilities.vrm530) //@K1A - return false; - } - catch(Exception e) - { - return false; - } - - try - { - if(transactionTimeout_ < 0) //@K1A - JDError.throwSQLException(JDError.EXC_ATTRIBUTE_VALUE_INVALID); //@K1A - } - catch(Exception e) - { - } - - transactionTimeout_ = transactionTimeout; //@K1A - return true; //@K1A - } - - - -/** -Starts the work on behalf of a transaction branch. -The resource manager associates the XA resource from the transaction branch -specified. - -@param xid The global transaction identifier. -@param flags The flags. Possible values are: -
          -
        • TMJOIN - Joins a transaction previously seen by - the resource manager. -
        • TMRESUME - Resumes a suspended transaction. - (This is not currently supported for V5R3 and earlier versions.) -
        • TMNOFLAGS - No flags are set. -
        - -@exception XAException If an error occurs. -**/ - public void start(Xid xid, int flags) - throws XAException - { - try - { - // Parameter validation. - if (xid == null) - throw new XAException(XAException.XAER_INVAL); - if (started_ != null) - throw new XAException(XAException.XAER_PROTO); - if (flags != TMNOFLAGS && flags != TMJOIN && connection_.getVRM() < JDUtilities.vrm540) //@K1C added TMJOIN check //@540C the TMSuspend restriction can be removed when running to V5R4 and later systems - throw new XAException(XAException.XAER_INVAL); - - - if (JDTrace.isTraceOn()) - JDTrace.logInformation(this, "xa_start"); - - // Send the request. - //@P0C - DBXARequestDS request = null; - DBReplyRequestedDS reply = null; - int returnCode = 0; //@pda - try - { - request = DBDSPool.getDBXARequestDS(DBXARequestDS.REQUESTID_XA_START, 0, - DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); - request.setResourceManagerID(resourceManagerID_); - request.setXid(AS400JDBCXid.xidToBytes(xid)); - request.setFlags(flags); - - if(connection_.getServerFunctionalLevel() >= 11) //@KBA system functional level must be version 11 or higher - { - request.setCtlTimeout(transactionTimeout_); - if(lockWait_ != -1) - request.setLockWait(lockWait_); - } - - if (connection_.getVRM() >= JDUtilities.vrm540) // @540 - { - int lcs = connection_.getProperties().getInt(JDProperties.XA_LOOSELY_COUPLED_SUPPORT); - ///if (lcs != JDProperties.XA_LOOSELY_COUPLED_SUPPORT_NOT_SHARED) - ///{ - request.setXALooselyCoupledSupport(lcs); - ///} - } - - reply = connection_.sendAndReceive (request); - returnCode = processXAReturnCode(reply); //@pdc - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - if (reply != null) { reply.returnToPool(); reply = null; } - } - - // Mark the transaction state. - transactionManager_.setLocalTransaction(false); - started_ = xid; - insertRemoveXidByFlag(xid, flags); - - //@pda throw XAException for return codes not thrown in processXAReturnCode() - if(returnCode != 0) - throw new XAException(returnCode); - - } - catch (XAException e) - { - throw e; - } - catch (Exception e) - { - throwXAException(e); - } - } - - //@K1A - /** - Specifies the number of seconds that the system will wait on any lock request during this transaction. - - @param lockWait The time in seconds to wait. - **/ - public void setLockWait(int lockWait) - throws SQLException - { - if(connection_.getVRM() < JDUtilities.vrm530) - return; - - if(lockWait < 0) - JDError.throwSQLException(JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - lockWait_ = lockWait; - } - - private void throwXAException(Exception e) - throws XAException - { - if (JDTrace.isTraceOn()) - { - synchronized(DriverManager.class) - { - e.printStackTrace(DriverManager.getLogWriter ()); - } - } - throw new XAException(XAException.XAER_RMFAIL); - } - - - -/** -Returns the string representation of the XA resource. - -@return The string representation. -**/ - public String toString() - { - return connection_.toString() + "-XA:RMID#" + resourceManagerID_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JDBCXid.java b/cvsroot/src/com/ibm/as400/access/AS400JDBCXid.java deleted file mode 100644 index 9c5339364..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JDBCXid.java +++ /dev/null @@ -1,146 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCXid.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import javax.transaction.xa.Xid; - - - -/** -The AS400JDBCXid class represents an Xid for use with an -AS400JDBCXAResource. -**/ -// -// Implementation notes: -// -// Here is the format of the Xid in bytes: -// -// +--------+--------+---------------------------------------------+ -// | Offset | Length | Description | -// +--------+--------+---------------------------------------------+ -// | 0 | 4 | Format ID | -// | 4 | 4 | Global transaction ID length | -// | 8 | 4 | Branch qualifier length | -// | 12 | * | Global transaction ID (up to 64 bytes) | -// | * | * | Branch qualifier (up to 64 bytes) | -// +--------+--------+---------------------------------------------+ -// | 140 | | Maximum length | -// +--------+--------+---------------------------------------------+ -// -public class AS400JDBCXid -implements Xid -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - // Private data. - private int formatId_ = -1; - private byte[] globalTransactionId_ = null; - private byte[] branchQualifier_ = null; - - - -/** -Constructs an AS400JDBCXid object. - -@param xidBytes The Xid bytes. -@param offset The offset. -**/ - AS400JDBCXid(byte[] xidBytes, int offset) - { - formatId_ = BinaryConverter.byteArrayToInt(xidBytes, offset); - int globalTransactionIdLength = BinaryConverter.byteArrayToInt(xidBytes, offset + 4); - int branchQualifierIdLength = BinaryConverter.byteArrayToInt(xidBytes, offset + 8); - globalTransactionId_ = new byte[globalTransactionIdLength]; - System.arraycopy(xidBytes, offset + 12, globalTransactionId_, 0, globalTransactionIdLength); - branchQualifier_ = new byte[branchQualifierIdLength]; - System.arraycopy(xidBytes, globalTransactionIdLength + offset + 12, branchQualifier_, 0, branchQualifierIdLength); - } - - - -/** -Returns the branch qualifier. - -@return The branch qualifier. -**/ - public byte[] getBranchQualifier() - { - return branchQualifier_; - } - - - -/** -Returns the format ID. - -@return The format ID. -**/ - public int getFormatId() - { - return formatId_; - } - - - -/** -Returns the global transaction ID. - -@return The global transaction ID. -**/ - public byte[] getGlobalTransactionId() - { - return globalTransactionId_; - } - - - -/** -Returns the Xid bytes. - -@return The Xid bytes. -**/ - byte[] toBytes() - { - return xidToBytes(this); - } - - - -/** -Returns the Xid bytes. - -@param xid The Xid. -@return The Xid bytes. -**/ - static byte[] xidToBytes(Xid xid) - { - int formatId = xid.getFormatId(); - byte[] globalTransactionId = xid.getGlobalTransactionId(); - byte[] branchQualifier = xid.getBranchQualifier(); - - byte[] xidBytes = new byte[140]; - BinaryConverter.intToByteArray(formatId, xidBytes, 0); - BinaryConverter.intToByteArray(globalTransactionId.length, xidBytes, 4); - BinaryConverter.intToByteArray(branchQualifier.length, xidBytes, 8); - System.arraycopy(globalTransactionId, 0, xidBytes, 12, globalTransactionId.length); - System.arraycopy(branchQualifier, 0, xidBytes, globalTransactionId.length + 12, branchQualifier.length); - return xidBytes; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400JPing.java b/cvsroot/src/com/ibm/as400/access/AS400JPing.java deleted file mode 100644 index 728f7e7b7..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400JPing.java +++ /dev/null @@ -1,535 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JPing.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1999-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.io.IOException; -import java.net.Socket; - -/** - Determines if services are running on the IBM i system. -

        Here is an example of calling AS400JPing within a Java program to ping the Remote Command Service: -

        - * AS400JPing pingObj = new AS400JPing("myAS400", AS400.COMMAND, false);
        - * if (pingObj.ping())
        - *     System.out.println("SUCCESS");
        - * else
        - *     System.out.println("FAILED");
        - 
        - * - * @see utilities.JPing - **/ -public class AS400JPing -{ - /** - Constant for pinging all the services. - **/ - public final static int ALL_SERVICES = 99; // The default service is 99, which pings all the services. - - private String systemName_; - private int service_ = ALL_SERVICES; - private int length_ = 10; - - private boolean echo_ = false; - private SSLOptions useSSL_ = null; - private long time_ = 20000; - - private PrintWriter writer_; - // SocketContainer to all Services but the DDM Server. - private SocketContainer socketContainer_; - // Socket to the DDM Server. - private Socket ddmSocket_; - // Thread to handle timeout values. - private Thread jpingDaemon_; - // Inner class that implements runnable. - private JPingThread jpingThread_; - private SocketProperties socketProperties_ = new SocketProperties(); - - // Handles loading the appropriate resource bundle. - private static ResourceBundleLoader loader_; - - /** - Constructs an AS400JPing object with the specified systemName. A JPing object created with this constructor will ping all of the services when ping() is called. - @param systemName The system to ping. The systemName string can be in 3 forms: shortname (eg. "myAS400"), longname (eg. "myAS400.myCompany.com"), or IP address (eg. "9.1.2.3"). - @see AS400#getSystemName() - **/ - public AS400JPing(String systemName) - { - this(systemName, ALL_SERVICES, false); - } - - /** - Constructs an AS400JPing object with the specified systemName and service. - @param systemName The system to ping. The systemName string can be in 3 forms: shortname (eg. "myAS400"), longname (eg. "myAS400.myCompany.com"), or IP address (eg. "9.1.2.3"). - @param service The service to ping. Valid services are: -
          -
        • {@link AS400#FILE AS400.FILE} - the IFS file service -
        • {@link AS400#PRINT AS400.PRINT} - the print service -
        • {@link AS400#COMMAND AS400.COMMAND} - the command and program call service -
        • {@link AS400#DATAQUEUE AS400.DATAQUEUE} - the data queue service -
        • {@link AS400#DATABASE AS400.DATABASE} - the JDBC service -
        • {@link AS400#RECORDACCESS AS400.RECORDACCESS} - the record level access service -
        • {@link AS400#CENTRAL AS400.CENTRAL} - the license management service -
        • {@link AS400#SIGNON AS400.SIGNON} - the sign-on service -
        • {@link #ALL_SERVICES ALL_SERVICES} - all services -
        - @see AS400#getSystemName() - **/ - public AS400JPing(String systemName, int service) - { - this(systemName, service, false); - } - - /** - Constructs an AS400JPing object. - @param systemName The system to ping. The systemName string can be in 3 forms: shortname (eg. "myAS400"), longname (eg. "myAS400.myCompany.com"), or IP address (eg. "9.1.2.3"). - @param service The service to ping. Valid services are: -
          -
        • {@link AS400#FILE AS400.FILE} - the IFS file service -
        • {@link AS400#PRINT AS400.PRINT} - the print service -
        • {@link AS400#COMMAND AS400.COMMAND} - the command and program call service -
        • {@link AS400#DATAQUEUE AS400.DATAQUEUE} - the data queue service -
        • {@link AS400#DATABASE AS400.DATABASE} - the JDBC service -
        • {@link AS400#RECORDACCESS AS400.RECORDACCESS} - the record level access service -
        • {@link AS400#CENTRAL AS400.CENTRAL} - the license management service -
        • {@link AS400#SIGNON AS400.SIGNON} - the sign-on service -
        • {@link #ALL_SERVICES ALL_SERVICES} - all services -
        - @param useSSL true if the pinging the SSL port for the service, false otherwise. The default is false. - @see AS400#getSystemName() - **/ - public AS400JPing(String systemName, int service, boolean useSSL) - { - if (systemName == null) - throw new NullPointerException("systemName"); - - if (service < AS400.FILE || (service > AS400.SIGNON && service != ALL_SERVICES)) - throw new ExtendedIllegalArgumentException("service (" + service + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - systemName_ = systemName; - service_ = service; - useSSL_ = useSSL ? new SSLOptions() : null; - } - - /** - Ping the system. - @return true if all of the services (or, if a service was specified on the constructor, the specified service) can be pinged successfully; false otherwise. - @see #pingAllServices - **/ - public boolean ping() - { - if (service_ == ALL_SERVICES) - { - boolean rtn = true; - for (int i = AS400.FILE; i <= AS400.SIGNON; ++i) - { - rtn = rtn && ping(i); - if (rtn == false) // if we get a failed ping, we want to return right away, - return rtn; // instead of pinging the other services. - } - - return rtn; - } - else - { - return ping(service_); - } - } - - /** - Ping a specific service. - @param service The service to ping. Valid services are: -
          -
        • {@link AS400#FILE AS400.FILE} - the IFS file service -
        • {@link AS400#PRINT AS400.PRINT} - the print service -
        • {@link AS400#COMMAND AS400.COMMAND} - the command and program call service -
        • {@link AS400#DATAQUEUE AS400.DATAQUEUE} - the data queue service -
        • {@link AS400#DATABASE AS400.DATABASE} - the JDBC service -
        • {@link AS400#RECORDACCESS AS400.RECORDACCESS} - the record level access service -
        • {@link AS400#CENTRAL AS400.CENTRAL} - the license management service -
        • {@link AS400#SIGNON AS400.SIGNON} - the sign-on service -
        - @return true if the service can be pinged successfully, and false otherwise. - **/ - public synchronized boolean ping(int service) - { - if (service < AS400.FILE || service > AS400.SIGNON) - throw new ExtendedIllegalArgumentException("service (" + service + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - InputStream inStream = null; - OutputStream outStream = null; - try - { - if (Trace.traceOn_) - { - Trace.log(Trace.INFORMATION, "Ping System: " + systemName_); - Trace.log(Trace.INFORMATION, "Ping Service: " + AS400.getServerName(service)); - Trace.log(Trace.INFORMATION, "Packet Length: " + length_); - Trace.log(Trace.INFORMATION, "Echo Packet: " + ((echo_) ? "on" : "off")); - Trace.log(Trace.INFORMATION, "Ping SSL Port: " + ((useSSL_ != null) ? "yes" : "no")); - } - - service_ = service; - - // DDM does not use the Client Access Datastreams, so we have to use a different - // datastream to determine if the DDM server is connected. - if (service == AS400.RECORDACCESS) - pingDDM(); - else - { - jpingThread_ = new JPingThread(); - jpingDaemon_ = new Thread(jpingThread_, "AS400JPingDaemon"); - jpingDaemon_.setDaemon(true); - jpingDaemon_.start(); - - synchronized (this) - { - try - { - if (Trace.traceOn_) - Trace.log(Trace.INFORMATION, "Ping Timeout: " + time_ + "(ms)" ); - - wait(time_); - } - catch (InterruptedException ie) - { - if (Trace.traceOn_) - Trace.log(Trace.ERROR, "Unexpected exception.", ie); - } - } - - // If the Thread has not returned within the timeout period, - // interrupt the thread and fail the ping attempt. - if (socketContainer_ == null) - { - jpingDaemon_.interrupt(); - throw new Exception("Ping timeout occurred."); - } - else // The Thread has returned within the timeout period. - { - inStream = socketContainer_.getInputStream(); - outStream = socketContainer_.getOutputStream(); - - // buffer is the data that is pinged back and forth to the system. - byte[] buffer = new byte[length_]; - - for (int i = 0; i < length_; ++i) - { - buffer[i] = (byte)0xDD; //some byte data. - } - - if (echo_) - { - JPingEchoDS req = new JPingEchoDS(service, buffer); - req.write(outStream); - outStream.flush(); - - JPingEchoReplyDS reply = new JPingEchoReplyDS(buffer.length); - if (reply.read(inStream) == length_) - { /* bytes echoed back match the number of bytes sent, do nothing. */ } - else - { - Trace.log(Trace.ERROR, "Bytes echoed did not match then number of bytes sent."); - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - } - else - { - JPingDS req = new JPingDS(service, buffer); - req.write(outStream); - outStream.flush(); - } - } - } - - // If we have gotten this far without an exception, then the - // service has successfully been pinged. - if (writer_ != null) - writer_.println(loader_.substitute(loader_.getText("PROP_NAME_AJP_SUCCESS"), - new String[] { AS400.getServerName(service), ((useSSL_ != null) ? "-s" : "") } ) ); - - return true; - } - catch (ServerStartupException sse) - { - if (writer_ != null) - writer_.println(loader_.substitute(loader_.getText("PROP_NAME_AJP_FAILED"), - new String[] { AS400.getServerName(service), ((useSSL_ != null) ? "-s" : "") } ) ); - - if (Trace.traceOn_) - Trace.log(Trace.ERROR, sse); - - return false; - } - catch (Exception e) - { - if (writer_ != null) - writer_.println(loader_.substitute(loader_.getText("PROP_NAME_AJP_FAILED"), new String[] { AS400.getServerName(service), ((useSSL_ != null) ? "-s" : "") } ) ); - - if (Trace.traceOn_) - Trace.log(Trace.ERROR, e); - - return false; - } - finally - { - // Close the input/output streams and the socket. - if (outStream != null) { - try { outStream.close(); } - catch (Throwable e) { Trace.log(Trace.ERROR, e); } - } - if (inStream != null) { - try { inStream.close(); } - catch (Throwable e) { Trace.log(Trace.ERROR, e); } - } - if (socketContainer_ != null) { - try { socketContainer_.close(); } - catch (Throwable e) { Trace.log(Trace.ERROR, e); } - } - } - } - - /** - Ping all services. - This method differs from {@link #ping ping()} in that it doesn't immediately return when a failed ping is encountered, but rather continues until all services have been pinged. - @return true if all of the services can be pinged successfully; false if at least one service cannot be pinged. - **/ - public boolean pingAllServices() - { - boolean rtn = true; - for (int i = AS400.FILE; i <= AS400.SIGNON; ++i) - { - rtn = ping(i) && rtn; - } - - return rtn; - } - - /** - Ping the DDM server. - **/ - private void pingDDM() throws Exception - { - // DDM request datastream. - byte[] excsatReq = new byte[] - { - 0x00, 0x75, (byte)0xD0, 0x01, 0x00, 0x00, 0x00, 0x6F, 0x10, 0x41, 0x00, 0x0B, 0x11, 0x47, 0x00, 0x07, - 0x00, 0x09, (byte)0xD8, (byte)0xC1, (byte)0xE2, 0x00, 0x60, 0x14, 0x04, 0x14, 0x03, 0x00, 0x03, 0x14, 0x23, 0x00, - 0x03, 0x14, 0x05, 0x00, 0x03, 0x14, 0x06, 0x00, 0x03, 0x14, 0x07, 0x00, 0x03, 0x14, 0x74, 0x00, - 0x05, 0x14, 0x58, 0x00, 0x01, 0x14, 0x57, 0x00, 0x03, 0x14, 0x0C, 0x00, 0x03, 0x14, 0x19, 0x00, - 0x03, 0x14, 0x1E, 0x00, 0x03, 0x14, 0x22, 0x00, 0x03, 0x24, 0x0F, 0x00, 0x03, 0x14, 0x32, 0x00, - 0x03, 0x14, 0x33, 0x00, 0x03, 0x14, 0x40, 0x00, 0x01, 0x14, 0x3B, 0x00, 0x03, 0x24, 0x07, 0x00, - 0x03, 0x14, 0x63, 0x00, 0x03, 0x14, 0x65, 0x00, 0x03, 0x14, 0x3C, 0x00, 0x03, 0x14, 0x7F, 0x00, - 0x04, 0x14, (byte)0xA0, 0x00, 0x04 - }; - - // DDM expected reply datastream. - byte[] expectedRep = new byte[] - { - 0x00, 0x71, (byte)0xD0, 0x03, 0x00, 0x00, 0x00, 0x6B, 0x14, 0x43, 0x00, 0x07, 0x11, 0x47, (byte)0xD8, (byte)0xC1, - (byte)0xE2, 0x00, 0x60, 0x14, 0x04, 0x14, 0x03, 0x00, 0x03, 0x14, 0x23, 0x00, 0x03, 0x14, 0x05, 0x00, - 0x03, 0x14, 0x06, 0x00, 0x03, 0x14, 0x07, 0x00, 0x03, 0x14, 0x74, 0x00, 0x05, 0x14, 0x58, 0x00, - 0x01, 0x14, 0x57, 0x00, 0x03, 0x14, 0x0C, 0x00, 0x03, 0x14, 0x19, 0x00, 0x03, 0x14, 0x1E, 0x00, - 0x03, 0x14, 0x22, 0x00, 0x03, 0x24, 0x0F, 0x00, 0x03, 0x14, (byte)0xA0, 0x00, 0x04, 0x14, 0x32, 0x00, - 0x03, 0x14, 0x33, 0x00, 0x03, 0x14, 0x40, 0x00, 0x01, 0x14, 0x3B, 0x00, 0x03, 0x24, 0x07, 0x00, - 0x03, 0x14, 0x63, 0x00, 0x03, 0x14, 0x65, 0x00, 0x03, 0x14, 0x3C, 0x00, 0x03, 0x14, 0x7F, 0x00, - 0x04 - }; - - OutputStream os = null; - InputStream is = null; - try - { - jpingThread_ = new JPingThread(); - jpingDaemon_ = new Thread(jpingThread_, "AS400JPingDaemon"); - jpingDaemon_.setDaemon(true); - jpingDaemon_.start(); - - synchronized (this) - { - try - { - if (Trace.traceOn_) - Trace.log(Trace.INFORMATION, "Ping Timeout: " + time_ + "(ms)"); - - wait(time_); - } - catch (InterruptedException ie) - { - if (Trace.traceOn_) - Trace.log(Trace.ERROR, "Unexpected exception.", ie); - } - } - - // If the Thread has not returned within the timeout period, - // interrupt the thread and fail the ping attempt. - if (ddmSocket_ == null) - { - jpingDaemon_.interrupt(); - throw new Exception("Ping Timeout occurred."); - } - else // The Thread has returned within the timeout period. - { - // Copied from PortMapper.setSocketProperties(): - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "Socket properties:"); - try { Trace.log(Trace.DIAGNOSTIC, " Remote address: " + ddmSocket_.getInetAddress()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " Remote port:", ddmSocket_.getPort()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " Local address: " + ddmSocket_.getLocalAddress()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " Local port:", ddmSocket_.getLocalPort()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " Keep alive:", ddmSocket_.getKeepAlive()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " Receive buffer size:", ddmSocket_.getReceiveBufferSize()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " Send buffer size:", ddmSocket_.getSendBufferSize()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " So linger:", ddmSocket_.getSoLinger()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " So timeout:", ddmSocket_.getSoTimeout()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " TCP no delay:", ddmSocket_.getTcpNoDelay()); } catch (Throwable t) {} - } - - os = ddmSocket_.getOutputStream(); - os.write(excsatReq); - os.flush(); - - is = ddmSocket_.getInputStream(); - byte[] excsatRep = new byte[113]; - int numBytesRead = is.read(excsatRep); - if (numBytesRead < excsatRep.length) - { - Trace.log(Trace.ERROR, "Unexpected DDM server response.", excsatRep); - throw new Exception("Unexpected DDM server response."); - } - - for (int i=0; i<113; ++i) - { - // If the reply matched our expected reply, continue. Otherwise throw an exception, which will bubble up to the ping(int) method and get handled properly. - if (excsatRep[i] != expectedRep[i]) - { - Trace.log(Trace.ERROR, "Unexpected DDM server response.", excsatRep); - throw new Exception("Unexpected DDM server response."); - } - } - } - } - catch (Exception e) - { - if (e.getMessage().equals("Ping Timeout occurred.")) - throw e; - else - throw new Exception("Unexpected exception."); - } - finally - { - // Close the input/output streams and the socket. - if (is != null) { - try { is.close(); } - catch (Throwable e) { Trace.log(Trace.ERROR, e); } - } - if (os != null) { - try { os.close(); } - catch (Throwable e) { Trace.log(Trace.ERROR, e); } - } - if (ddmSocket_ != null) { - try { ddmSocket_.close(); } - catch (Throwable e) { Trace.log(Trace.ERROR, e); } - } - } - } - - /** - Set the PrintWriter to log ping information to. - @param stream The OutputStream. - * - @exception IOException If an error occurs while accessing the stream. - **/ - public void setPrintWriter(OutputStream stream) throws IOException - { - if (stream == null) - throw new NullPointerException("stream"); - - writer_ = new PrintWriter(stream, true); - } - - /** - Set the timeout period in milliseconds. The default timeout period is 20000 (20 seconds). - @param time The timeout period. - **/ - public void setTimeout(long time) - { - time_ = time; - } - - // Not used. - // /** - // Sets the length of the data in the datastream. - // @param length The length of the data (1 - 1000). The default is 10. - // **/ - //void setLength(int length) - //{ - // if (length < 1 || length > 1000) - // throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - // length_ = length; - //} - - // Not used. - // /** - // Sets whether the echo is on. - // @param echo true if the service should echo back the packet received, false otherwise. The default is false. - // **/ - //void setUseEcho(boolean echo) - //{ - // echo_ = echo; - //} - - /** - JPingThread is the inner class that tries to create the Socket connection to the system using a Thread. An inner class is used so that the user does not see that the AS400JPing class implements Runnable and does not see the run() method and they don't try to call that method in their applications. - **/ - private class JPingThread implements Runnable - { - /** - A Thread is started to do the Socket creation. The socket creation will hang if the system is not responding. To alleviate the long hang times, if this Thread does not return within the timeout period, it is assumed the system is unreachable. The hang could also be attributed to network speed. The default timeout period is 20000ms (20 sec). - **/ - public void run() - { - try - { - if (service_ == AS400.RECORDACCESS) - { - // Create a socket to the DDM Server. - ddmSocket_ = new Socket(systemName_, 446); // DRDA is on port 446 - } - else - { - // Create a socket to the service (let PortMapper figure out which port). - socketContainer_ = PortMapper.getServerSocket(systemName_, service_, useSSL_, socketProperties_, false); - } - } - catch (Exception e) - { - if (Trace.traceOn_) - Trace.log(Trace.ERROR, "Unexpected exception.", e); - // Note: Calling interrupt() on this JPingThread object, won't cause the JPingThread object to incur an InterruptedException. - } - finally - { - synchronized (AS400JPing.this) - { - AS400JPing.this.notifyAll(); - } - } - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Message.java b/cvsroot/src/com/ibm/as400/access/AS400Message.java deleted file mode 100644 index e63cf90d7..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400Message.java +++ /dev/null @@ -1,721 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Message.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.Serializable; -import java.util.Calendar; -import java.util.Date; // @C1A - -/** - Represents a message returned from an IBM i system. A Java program does not normally create AS400Message objects directly. Instead, AS400Message objects are created and returned by various other IBM Toolbox for Java components. -
        Usage hint: To fully "prime" an AS400Message object with additional information that otherwise might not be returned from the system, call the load() method. For example, if getHelp() returns null, try preceding the getHelp() with a call to load(). - @see com.ibm.as400.access.AS400Exception - @see com.ibm.as400.access.CommandCall - @see com.ibm.as400.access.ProgramCall - @see com.ibm.as400.access.SpooledFile - **/ -public class AS400Message implements Serializable -{ - static final long serialVersionUID = 4L; - - /** - Message type for completion messages. - **/ - public static final int COMPLETION = 1; - - /** - Message type for diagnostic messages. - **/ - public static final int DIAGNOSTIC = 2; - - /** - Message type for informational messages. - **/ - public static final int INFORMATIONAL = 4; - - /** - Message type for inquiry messages. - **/ - public static final int INQUIRY = 5; - - /** - Message type for sender's copy messages. - **/ - public static final int SENDERS_COPY = 6; - - /** - Message type for request messages. - **/ - public static final int REQUEST = 8; - - /** - Message type for request with prompting messages. - **/ - public static final int REQUEST_WITH_PROMPTING = 10; - - /** - Message type for notify (exception already handled when API is called) messages. - **/ - public static final int NOTIFY = 14; - - /** - Message type for escape (exception already handled when API is called) messages. - **/ - public static final int ESCAPE = 15; - - /** - Message type for notify (exception not handled when API is called) messages. - **/ - public static final int NOTIFY_NOT_HANDLED = 16; - - /** - Message type for escape (exception not handled when API is called) messages. - **/ - public static final int ESCAPE_NOT_HANDLED = 17; - - /** - Message type for reply, not validity checked messages. - **/ - public static final int REPLY_NOT_VALIDITY_CHECKED = 21; - - /** - Message type for reply, validity checked messages. - **/ - public static final int REPLY_VALIDITY_CHECKED = 22; - - /** - Message type for reply, message default used messages. - **/ - public static final int REPLY_MESSAGE_DEFAULT_USED = 23; - - /** - Message type for reply, system default used messages. - **/ - public static final int REPLY_SYSTEM_DEFAULT_USED = 24; - - /** - Message type for reply, from system reply list messages. - **/ - public static final int REPLY_FROM_SYSTEM_REPLY_LIST = 25; - - /** - Constant for the option indicating up to ten messages sent to the caller should be returned. For compatibility, this option is the default. Only messages sent to the caller will be returned, messages sent by the invoked procedure to itself will not be returned. - **/ - public static final int MESSAGE_OPTION_UP_TO_10 = 0; - /** - Constant for the option indicating that no messages should be returned. - **/ - public static final int MESSAGE_OPTION_NONE = 1; - /** - Constant for the option indicating all the messages should be returned. All messages sent from invocation beginning to invocation end will be returned. Systems not supporting this new option will revert to the behavior specified for option MESSAGE_OPTION_UP_TO_10. - **/ - public static final int MESSAGE_OPTION_ALL = 2; - - // Date and time message sent. - private Calendar date_; - private String dateSent_; - private String timeSent_; - - // Filename of message file message is from. - private String fileName_; - // Message ID of message. - private String id_; - // Library of message file message is from. - private String libraryName_; - // Default reply to message. - private String defaultReply_; - // Severity of message. - private int severity_ = -1; - // Raw substitution data from message. - private byte[] substitutionData_; - // First level text of message. - private String text_; - // Type of message. - private int type_ = -1; - // Second level text of message. - private String help_; - - // CCSID of text of message. - private int textCcsid_ = -1; - // CCSID of substitution data. - private int substitutionDataCcsid_ = -1; - - // System message came from. - private transient AS400 system_; - // Flag indicating if load has been done. - private transient boolean messageLoaded_ = false; - - // date message was created @C1A - private Date createDate_ = null; - - // date message was last modified @C1A - private Date modificationDate_ = null; - - // Constructs an AS400Message object. - AS400Message() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing AS400Message object."); - } - - // Constructs an AS400Message object. - // @param id The message ID. - // @param text The message text. - AS400Message(String id, String text) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing AS400Message object, ID: " + id + " text: " + text); - id_ = id; - text_ = text; - } - - // This is used by some native code. - // Constructs an AS400Message object. It uses the specified ID, text, file, library, severity, type, substitution text, and help. - // @param id The ID for the message. - // @param text The message text. - // @param fileName The message file name. - // @param libraryName The message library name. - // @param severity The severity level of the message. It must be between 0 and 99. - // @param type The type of message. - // Valid types are: - // COMPLETION - // DIAGNOSTIC - // INFORMATIONAL - // INQUIRY - // SENDERS_COPY - // REQUEST - // REQUEST_WITH_PROMPTING - // NOTIFY - // ESCAPE - // REPLY_NOT_VALIDITY_CHECKED - // REPLY_VALIDITY_CHECKED - // REPLY_MESSAGE_DEFAULT_USED - // REPLY_SYSTEM_DEFAULT_USED - // REPLY_FROM_SYSTEM_REPLY_LIST - // @param substitutionData The message substitution text. This is the unconverted data used to fill in the replacement characters in the message. - // @param help The message help text. - AS400Message(String id, String text, String fileName, String libraryName, int severity, int type, byte[] substitutionData, String help) - { - id_ = id; - text_ = text; - fileName_ = fileName; - libraryName_ = libraryName; - severity_ = severity; - type_ = type; - substitutionData_ = substitutionData; - help_ = help; - } - - // This is used by some native code. - // Constructs an AS400Message object. It uses the specified ID, text, file, library, severity, type, substitution text, help, date, time, and reply when supplied. All of the parameters are optional. - // @param id Optional. The ID for the message. - // @param text Optional. The message text. - // @param fileName Optional. The message file name. - // @param libraryName Optional. The message library name. - // @param severity Optional. The severity level of the message. It must be between 0 and 99. - // @param type Optional. The type of message. - // Valid types are: - // COMPLETION - // DIAGNOSTIC - // INFORMATIONAL - // INQUIRY - // SENDERS_COPY - // REQUEST - // REQUEST_WITH_PROMPTING - // NOTIFY - // ESCAPE - // REPLY_NOT_VALIDITY_CHECKED - // REPLY_VALIDITY_CHECKED - // REPLY_MESSAGE_DEFAULT_USED - // REPLY_SYSTEM_DEFAULT_USED - // REPLY_FROM_SYSTEM_REPLY_LIST - // @param substitutionData Optional. The message substitution text. This is the unconverted data used to fill in the replacement characters in the message. - // @param help Optional. The message help text. - // @param date Optional. The message date. - // @param time Optional. The message time. - // @param defaultReply Optional. The message reply. - AS400Message(String id, String text, String fileName, String libraryName, int severity, int type, byte[] substitutionData, String help, String date, String time, String defaultReply) - { - id_ = id; - text_ = text; - fileName_ = fileName; - libraryName_ = libraryName; - severity_ = severity; - type_ = type; - substitutionData_ = substitutionData; - help_ = help; - setDate(date, time); - defaultReply_ = defaultReply; - } - - /** - Returns the date and time the message was sent. The returned Calendar object will have the following fields set: -
          -
        • Calendar.YEAR -
        • Calendar.MONTH -
        • Calendar.DAY_OF_MONTH -
        • Calendar.HOUR -
        • Calendar.MINUTE -
        • Calendar.SECOND -
        - @return The date and time the message was sent, or null if not applicable. - **/ - public Calendar getDate() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting date: " + date_); - if (date_ == null && (dateSent_ != null || timeSent_ != null)) - { - setDate(); - } - return date_; - } - - /** - Returns the default reply. - @return The default reply, or null if it is not set. - **/ - public String getDefaultReply() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting default reply: " + defaultReply_); - return defaultReply_; - } - - /** - Returns the message file name. - @return The message file name, or null if it is not set. - **/ - public String getFileName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting message file name: " + fileName_); - return fileName_; - } - - /** - Returns the message help. -

        Message formatting characters may appear in the message help and are defined as follows: -

          -
        • &N - Force the text to a new line indented to column 2. If the text is longer than 1 line, the next lines should be indented to column 4 until the end of the text or another format control character is found. -
        • &P - Force the text to a new line indented to column 6. If the text is longer than 1 line, the next lines should start in column 4 until the end of the text or another format control character is found. -
        • &B - Force the text to a new line starting in column 4. If the text is longer than 1 line, the next lines should start in column 6 until the end of the text or another format control character is found. -
        - Usage hint: If getHelp() returns null, try "priming" the AS400Message object by first calling load(), then getHelp(). - @return The message help, or null if it is not set. - **/ - public String getHelp() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting message help: " + help_); - return help_; - } - - /** - Returns the message ID. - @return The message ID, or null if it is not set. - **/ - public String getID() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting message ID: " + id_); - return id_; - } - - /** - Returns the message file library. - @return The message file library, or null if it is not set. - **/ - public String getLibraryName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting message file library: " + libraryName_); - return libraryName_; - } - - /** - Returns the full integrated file system path name of the message file. - @return The full integrated file system path name of the message file name, or null if it is not set. - **/ - public String getPath() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting message file path, file name: " + fileName_ + " library: " + libraryName_); - if (fileName_ == null || libraryName_ == null || fileName_.length() == 0 || libraryName_.length() == 0) - { - return null; - } - return QSYSObjectPathName.toPath(libraryName_, fileName_, "MSGF"); - } - - /** - Returns the message severity. - @return The message severity. Valid values are between 0 and 99, or -1 if it is not set. - **/ - public int getSeverity() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting message severity:", severity_); - return severity_; - } - - /** - Returns the substitution data. This is unconverted data used to fill in the replacement characters in the message. To convert the data to something useful, see the {@link com.ibm.as400.access.CharConverter CharConverter} class for String conversions (CHAR fields) and the {@link com.ibm.as400.access.BinaryConverter BinaryConverter} class for integer (BIN fields) and other numeric conversions. - @return The subsitution data, or null if not set. - **/ - public byte[] getSubstitutionData() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting message substitution data:", substitutionData_); - return substitutionData_; - } - - /** - Returns the message text with the substitution text inserted. - @return The message text, or null if it is not set. - **/ - public String getText() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting message text: " + text_); - - // See if we need to copy the substitution text to the message text. - // This might be necessary if the message is an impromptu/immediate message, - // generated by SNDPGMMSG MSG(...), where no MSGID or MSGF was specified. - // In such cases, the returned message might have only substitution data. - - if (!messageLoaded_ && - substitutionData_ != null && - substitutionData_.length != 0 && - (text_ == null || text_.trim().length() == 0)) - { - try - { - Trace.log(Trace.DIAGNOSTIC, "The 'text' field of the message is blank. Copying substitution data to message text."); - - // Copy the (converted) substitution data into our 'text' variable. - int ccsid; - if (substitutionDataCcsid_ == -1) { - Trace.log(Trace.DIAGNOSTIC, "Assuming CCSID of substitution data is 37."); - ccsid = 37; - } - else ccsid = substitutionDataCcsid_; - text_ = CharConverter.byteArrayToString(ccsid, substitutionData_); - } - catch (Exception e) { - Trace.log(Trace.ERROR, e); - } - } - return text_; - } - - /** - Returns the message type. - @return The message type, or negative one (-1) if it is not set. Valid values are: -
          -
        • COMPLETION -
        • DIAGNOSTIC -
        • INFORMATIONAL -
        • INQUIRY -
        • SENDERS_COPY -
        • REQUEST -
        • REQUEST_WITH_PROMPTING -
        • NOTIFY -
        • ESCAPE -
        • REPLY_NOT_VALIDITY_CHECKED -
        • REPLY_VALIDITY_CHECKED -
        • REPLY_MESSAGE_DEFAULT_USED -
        • REPLY_SYSTEM_DEFAULT_USED -
        • REPLY_FROM_SYSTEM_REPLY_LIST -
        - **/ - public int getType() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting message type:", type_); - return type_; - } - - /** - Loads additional message information from the system. If this message does not have an associated message file, this method does nothing. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void load() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - load(MessageFile.NO_FORMATTING); - } - - /** - Loads additional message information from the system. If this message does not have an associated message file, this method does nothing. - @param helpTextFormatting Formatting performed on the help text. Valid values for this parameter are {@link MessageFile#NO_FORMATTING NO_FORMATTING}, {@link MessageFile#RETURN_FORMATTING_CHARACTERS RETURN_FORMATTING_CHARACTERS}, and {@link MessageFile#SUBSTITUTE_FORMATTING_CHARACTERS SUBSTITUTE_FORMATTING_CHARACTERS}. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void load(int helpTextFormatting) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loading additional message information."); - if (messageLoaded_) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Repeat message load not necessary."); - return; - } - - if (libraryName_ == null || fileName_ == null || libraryName_.trim().length() == 0 || fileName_.trim().length() == 0) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "No message file associated with this message: " + toString()); - return; - } - - if (system_ == null) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Unable to load message file, because system was not specified when AS400Message was created."); - return; - } - - // Create message file object and get message from it. - MessageFile file = new MessageFile(system_, QSYSObjectPathName.toPath(libraryName_, fileName_, "MSGF")); - - try - { - file.setHelpTextFormatting(helpTextFormatting); - - AS400Message retrievedMessage = file.getMessage(id_, substitutionData_); - - // Set message field that are not already set. - if (defaultReply_ == null) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting default reply: " + retrievedMessage.defaultReply_); - defaultReply_ = retrievedMessage.defaultReply_; - } - if (severity_ == -1) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message severity:", retrievedMessage.severity_); - severity_ = retrievedMessage.severity_; - } - if (text_ == null) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message text: " + retrievedMessage.text_); - text_ = retrievedMessage.text_; - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message help: " + retrievedMessage.help_); - help_ = retrievedMessage.help_; - messageLoaded_ = true; // Set flag to not go to system again. - } - catch (PropertyVetoException e) - { - Trace.log(Trace.ERROR, "Unexpected PropertyVetoException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - private void setDate() - { - if (dateSent_ == null && timeSent_ == null) - { - return; - } - if (dateSent_ != null && dateSent_.trim().length() == 0 && timeSent_ != null && timeSent_.trim().length() == 0) - { - dateSent_ = null; - timeSent_ = null; - return; - } - date_ = Calendar.getInstance(); - date_.clear(); - if (dateSent_ != null && dateSent_.trim().length() > 0) - { - date_.set(Calendar.YEAR, Integer.parseInt(dateSent_.substring(0, 3)) + 1900); - date_.set(Calendar.MONTH, Integer.parseInt(dateSent_.substring(3, 5)) - 1); - date_.set(Calendar.DAY_OF_MONTH, Integer.parseInt(dateSent_.substring(5, 7))); - } - if (timeSent_ != null && timeSent_.trim().length() > 0) - { - date_.set(Calendar.HOUR, Integer.parseInt(timeSent_.substring(0, 2))); - date_.set(Calendar.MINUTE, Integer.parseInt(timeSent_.substring(2, 4))); - date_.set(Calendar.SECOND, Integer.parseInt(timeSent_.substring(4, 6))); - } - dateSent_ = null; - timeSent_ = null; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Date: " + date_); - } - - // Sets the date sent and time sent. - // @param dateSent The date sent. - // @param timeSent The time sent. - void setDate(String dateSent, String timeSent) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting date, date: " + dateSent + " time: " + timeSent); - dateSent_ = dateSent; - timeSent_ = timeSent; - } - - // Sets the default reply. - // @param defaultReply The default reply. - void setDefaultReply(String defaultReply) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting default reply: " + defaultReply); - defaultReply_ = defaultReply; - } - - // Sets the message file name. - // @param fileName The message file name. - void setFileName(String fileName) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message file name: " + fileName); - fileName_ = fileName; - } - - // Sets the message help. - // @param help The message help. - void setHelp(String help) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message help: " + help); - help_ = help; - } - - // Sets the message ID. - // @param messageID The message ID. - void setID(String id) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message ID: " + id); - id_ = id; - } - - // Sets the message file library. - // @param messageFileLibrary The message file library. - void setLibraryName(String libraryName) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message file library: " + libraryName); - libraryName_ = libraryName; - } - - // Sets the message severity. - // @param messageSeverity The message severity. Valid values are between 0 and 99. - void setSeverity(int severity) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message severity:", severity); - severity_ = severity; - } - - // Sets the substitution data. - // @param substitutionData The substitution data. - void setSubstitutionData(byte[] substitutionData) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message substitution data:", substitutionData); - substitutionData_ = substitutionData; - } - - // Sets the system. - // @param system The system. - void setSystem(AS400 system) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message file system: " + system); - system_ = system; - } - - // Sets the message text. - // @param text The message text. - void setText(String text) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message text: " + text); - text_ = text; - } - - // Sets the CCSID of the message text. - // @param ccsid The message text CCSID. - void setTextCcsid(int ccsid) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message text CCSID: " + ccsid); - textCcsid_ = ccsid; - } - - // Sets the CCSID of the substitution data. - // @param ccsid The substitution data CCSID. - void setSubstitutionDataCcsid(int ccsid) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message substitution data CCSID: " + ccsid); - substitutionDataCcsid_ = ccsid; - } - - // Sets the message type. - // @param type The message type. - void setType(int type) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message type:", type); - type_ = type; - } - - /** - Returns the message ID and message text. - @return The message ID and message text. - **/ - public String toString() - { - return "AS400Message (ID: " + id_ + " text: " + text_ + "):" + super.toString(); - } - - // returns the original 'toString' value. In mod 3 toString was changed to return its current value. This method is added for those parts of the Toolbox that still need the value in in the old format. - String toStringM2() - { - StringBuffer buffer = new StringBuffer(); - String id = getID(); - String text = getText(); - if (id != null) - { - buffer.append(id); - buffer.append(" "); - } - if (text != null) - { - buffer.append(text); - } - return buffer.toString().trim(); - } - - /** - * Returns the messages create date - * - * @return the createDate_ - */ - // @C1A - public Date getCreateDate() { - return createDate_; - } - - /** - * Sets the messages create date - * - * @param createDate_ the createDate_ to set - */ - // @C1A - public void setCreateDate(Date createDate_) { - this.createDate_ = createDate_; - } - - /** - * Returns the messages last modification date - * - * @return the modificationDate_ - */ - // @C1A - public Date getModificationDate() { - return modificationDate_; - } - - /** - * Sets the messages last modification date - * - * @param modificationDate_ the modificationDate_ to set - */ - // @C1A - public void setModificationDate(Date modificationDate_) { - this.modificationDate_ = modificationDate_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400NoThreadServer.java b/cvsroot/src/com/ibm/as400/access/AS400NoThreadServer.java deleted file mode 100644 index eb308d711..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400NoThreadServer.java +++ /dev/null @@ -1,243 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400NoThreadServer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Hashtable; -import java.util.Vector; - -class AS400NoThreadServer extends AS400Server -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - private AS400ImplRemote system_; - private int service_; - private String jobString_; - - private SocketContainer socket_; - private InputStream inStream_; - private OutputStream outStream_; - - private Hashtable replyStreams_; - private Hashtable instanceReplyStreams_ = new Hashtable(); - - private DataStream exchangeAttrReply_ = null; - private Vector replyList_ = new Vector(5); - private Vector discardList_ = new Vector(); - private int lastCorrelationId_ = 0; - private class CorrelationIdLock extends Object {} //@C7A - - private CorrelationIdLock correlationIdLock_ = new CorrelationIdLock(); //@C7C - - private boolean closed_ = false; - - AS400NoThreadServer(AS400ImplRemote system, int service, SocketContainer socket, String jobString) throws IOException - { - system_ = system; - service_ = service; - jobString_ = jobString; - - socket_ = socket; - connectionID_ = socket_.hashCode(); - inStream_ = socket.getInputStream(); - outStream_ = socket.getOutputStream(); - - replyStreams_ = AS400Server.replyStreamsHashTables[service]; - } - - int getService() - { - return service_; - } - - String getJobString() - { - return jobString_; - } - - void setJobString(String jobString) - { - jobString_ = jobString; - } - - boolean isConnected() - { - return closed_ == false; - } - - DataStream getExchangeAttrReply() - { - return exchangeAttrReply_; - } - - synchronized DataStream sendExchangeAttrRequest(DataStream req) throws IOException - { - if (exchangeAttrReply_ == null) - { - exchangeAttrReply_ = sendAndReceive(req); - } - return exchangeAttrReply_; - } - - void addInstanceReplyStream(DataStream replyStream) - { - instanceReplyStreams_.put(replyStream, replyStream); - } - - void clearInstanceReplyStreams() - { - instanceReplyStreams_.clear(); - } - - DataStream sendAndReceive(DataStream requestStream) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "send and receive(): ..."); //@pdc - int correlationID = send(requestStream); - return receive(correlationID); - } - - void sendAndDiscardReply(DataStream requestStream) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "send and discard(): ..."); //@pdc - int correlationID = send(requestStream); - discardList_.addElement(new Integer(correlationID)); - } - - int send(DataStream requestStream) throws IOException - { - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, "send(): send request..."); //@pdc - requestStream.setConnectionID(connectionID_); - } - int correlationID = newCorrelationId(); - requestStream.setCorrelation(correlationID); - requestStream.write(outStream_); - return correlationID; - } - - int newCorrelationId() - { - synchronized (correlationIdLock_) - { - if (++lastCorrelationId_ == 0) lastCorrelationId_ = 1; //@P0C - return lastCorrelationId_; //@P0C - } - } - - void send(DataStream requestStream, int correlationId) throws IOException - { - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, "send(): send request..."); //@pdc - requestStream.setConnectionID(connectionID_); - } - requestStream.setCorrelation(correlationId); - requestStream.write(outStream_); - } - - synchronized DataStream receive(int correlationId) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "AS400Server receive"); //@pdc - DataStream reply = null; - do - { - synchronized (replyList_) - { - if (!replyList_.isEmpty()) - { - for (int i = 0; i < replyList_.size(); i++) - { - DataStream nextReply = (DataStream)replyList_.elementAt(i); - if (nextReply.getCorrelation() == correlationId) - { - replyList_.removeElementAt(i); - reply = nextReply; - break; - } - } - } - } - - if (reply == null) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "run(): wait for reply..."); //@pdc - - DataStream ds = null; - if (service_ != AS400.RECORDACCESS) - { - ds = ClientAccessDataStream.construct(inStream_, instanceReplyStreams_, replyStreams_, system_, connectionID_); - } - else - { - ds = DDMDataStream.construct(inStream_, replyStreams_, system_, connectionID_); - } - - if (Trace.isTraceOn()) { - Trace.log(Trace.DIAGNOSTIC, "run(): reply received..." + ds.toString()); - } - - boolean keepDataStream = true; - int correlation = ds.getCorrelation(); - for (int i = 0; i < discardList_.size(); i++) - { - if (((Integer)discardList_.elementAt(i)).intValue() == correlation) - { - discardList_.removeElementAt(i); - keepDataStream = false; - break; - } - } - - if (keepDataStream) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "adding reply...", correlation); - replyList_.addElement(ds); // Save off the reply. - } - } - else - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "received(): valid reply received...", correlationId); //@pdc - } - } - while (reply == null); - return reply; - } - - void forceDisconnect() - { - closed_ = true; - if (service_ == AS400.DATABASE || service_ == AS400.COMMAND || service_ == AS400.CENTRAL) - { - AS400EndJobDS endjob = new AS400EndJobDS(AS400Server.getServerId(service_)); - try - { - endjob.write(outStream_); - } - catch(IOException e) - { - Trace.log(Trace.ERROR, "Send end job data stream failed.", e); - } - } - - try - { - socket_.close(); - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Socket close failed.", e); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400PackedDecimal.java b/cvsroot/src/com/ibm/as400/access/AS400PackedDecimal.java deleted file mode 100644 index b69501008..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400PackedDecimal.java +++ /dev/null @@ -1,598 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400PackedDecimal.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.math.BigDecimal; -import java.math.BigInteger; - -/** - * Provides a converter between a BigDecimal object and a packed decimal format floating point number. - **/ -public class AS400PackedDecimal implements AS400DataType -{ - static final long serialVersionUID = 4L; - - private int digits; - private int scale; - private static final long defaultValue = 0; - static final boolean HIGH_NIBBLE = true; - static final boolean LOW_NIBBLE = false; - - private boolean useDouble_ = false; - - /** - * Constructs an AS400PackedDecimal object. - * @param numDigits The number of digits in the packed decimal number. It must be greater than or equal to one and less than or equal to thirty-one. - * @param numDecimalPositions The number of decimal positions in the packed decimal number. It must be greater than or equal to zero and less than or equal to numDigits. - **/ - public AS400PackedDecimal(int numDigits, int numDecimalPositions) - { - // check for valid input - if (numDigits < 1 || numDigits > 63) // @M0C - changed the upper limit here from 31 for JDBC support - { - throw new ExtendedIllegalArgumentException("numDigits (" + String.valueOf(numDigits) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (numDecimalPositions < 0 || numDecimalPositions > numDigits) - { - throw new ExtendedIllegalArgumentException("numDecimalPositions (" + String.valueOf(numDecimalPositions) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - // set instance variables - this.digits = numDigits; - this.scale = numDecimalPositions; - } - - /** - * Creates a new AS400PackedDecimal object that is identical to the current instance. - * @return The new object. - **/ - public Object clone() - { - try - { - return super.clone(); // Object.clone does not throw exception - } - catch (CloneNotSupportedException e) - { - Trace.log(Trace.ERROR, "Unexpected cloning error", e); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - /** - * Returns the byte length of the data type. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int getByteLength() - { - return this.digits/2+1; - } - - /** - * Returns a Java object representing the default value of the data type. - * @return The BigDecimal object with a value of zero. - **/ - public Object getDefaultValue() - { - return BigDecimal.valueOf(defaultValue); - } - - /** - * Returns {@link com.ibm.as400.access.AS400DataType#TYPE_PACKED TYPE_PACKED}. - * @return AS400DataType.TYPE_PACKED. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_PACKED; - } - - /** - * Returns the Java class that corresponds with this data type. - * @return BigDecimal.class. - **/ - public Class getJavaType() - { - return BigDecimal.class; - } - - /** - * Returns the total number of digits in the packed decimal number. - * @return The number of digits. - **/ - public int getNumberOfDigits() - { - return this.digits; - } - - /** - * Returns the number of decimal positions in the packed decimal number. - * @return The number of decimal positions. - **/ - public int getNumberOfDecimalPositions() - { - return this.scale; - } - - /** - * Indicates if a {@link java.lang.Double Double} object or a - * {@link java.math.BigDecimal BigDecimal} object will be returned - * on a call to {@link #toObject toObject()}. - * @return true if a Double will be returned, false if a BigDecimal - * will be returned. The default is false. - **/ - public boolean isUseDouble() - { - return useDouble_; - } - - /** - * Sets whether to return a {@link java.lang.Double Double} object or a - * {@link java.math.BigDecimal BigDecimal} object on a call to - * {@link #toObject toObject()}. - * @see com.ibm.as400.access.AS400ZonedDecimal#setUseDouble - **/ - public void setUseDouble(boolean b) - { - useDouble_ = b; - } - - /** - * Converts the specified Java object to IBM i format. - * @param javaValue The object corresponding to the data type. It must be an instance of BigDecimal and the BigDecimal must have a less than or equal to number of digits and a less than or equal to number of decimal places. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - byte[] as400Value = new byte[this.digits/2+1]; - this.toBytes(javaValue, as400Value, 0); - return as400Value; - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of BigDecimal and the BigDecimal must have a less than or equal to number of digits and a less than or equal to number of decimal places. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value) - { - return this.toBytes(javaValue, as400Value, 0); - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue An object corresponding to the data type. It must be an instance of BigDecimal and the BigDecimal must have a less than or equal to number of digits and a less than or equal to number of decimal places. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - int outDigits = this.digits; - int outDecimalPlaces = this.scale; - int outLength = outDigits/2+1; - - // verify input - BigDecimal inValue = null; - try { - inValue = (BigDecimal)javaValue; // Let this line throw ClassCastException - } - catch (ClassCastException e) { - Trace.log(Trace.ERROR, "ClassCastException when attempting to cast a " + javaValue.getClass().getName() + " to a BigDecimal", e); - throw e; - } - if (inValue.scale() > outDecimalPlaces) // Let this line throw NullPointerException - { - throw new ExtendedIllegalArgumentException("javaValue (" + javaValue.toString() + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - // read the sign - int sign = inValue.signum(); - - // get just the digits from BigDecimal, "normalize" away sign, decimal place etc. - char[] inChars = inValue.abs().movePointRight(outDecimalPlaces).toBigInteger().toString().toCharArray(); - // Check overall length - int inLength = inChars.length; - if (inLength > outDigits) - { - throw new ExtendedIllegalArgumentException("javaValue (" + javaValue.toString() + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - int inPosition = 0; // position in char[] - - // calculate number of leading zero's - int leadingZeros = (outDigits % 2 == 0) ? (outDigits - inLength + 1) : (outDigits - inLength); - - // write correct number of leading zero's, allow ArrayIndexException to be thrown below - for (int i=0; i 0) - { - if (leadingZeros % 2 != 0) - { - as400Value[offset++] = (byte)(inChars[inPosition++] & 0x000F); - } - } - else if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "The calculated number of leading zeros is negative.", leadingZeros); - } - - int firstNibble; - int secondNibble; - // place all the digits except last one - while (inPosition < inChars.length-1) - { - firstNibble = (inChars[inPosition++] & 0x000F) << 4; - secondNibble = inChars[inPosition++] & 0x000F; - as400Value[offset++] = (byte)(firstNibble + secondNibble); - } - - // place last digit and sign nibble - firstNibble = (inChars[inPosition++] & 0x000F) << 4; - if (sign != -1) - { - as400Value[offset++] = (byte)(firstNibble + 0x000F); - } - else - { - as400Value[offset++] = (byte)(firstNibble + 0x000D); - } - return outLength; - } - - // @E0A - /** - * Converts the specified Java object to IBM i format. - * - * @param doubleValue The value to be converted to IBM i format. If the decimal part - * of this value needs to be truncated, it will be rounded towards - * zero. If the integral part of this value needs to be truncated, - * an exception will be thrown. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(double doubleValue) - { - byte[] as400Value = new byte[digits/2+1]; - toBytes(doubleValue, as400Value, 0); - return as400Value; - } - - // @E0A - /** - * Converts the specified Java object into IBM i format in - * the specified byte array. - * - * @param doubleValue The value to be converted to IBM i format. If the decimal part - * of this value needs to be truncated, it will be rounded towards - * zero. If the integral part of this value needs to be truncated, - * an exception will be thrown. - * @param as400Value The array to receive the data type in IBM i format. There must - * be enough space to hold the IBM i value. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(double doubleValue, byte[] as400Value) - { - return toBytes(doubleValue, as400Value, 0); - } - - // @E0A - /** - * Converts the specified Java object into IBM i format in - * the specified byte array. - * - * @param doubleValue The value to be converted to IBM i format. If the decimal part - * of this value needs to be truncated, it will be rounded towards - * zero. If the integral part of this value needs to be truncated, - * an exception will be thrown. - * @param as400Value The array to receive the data type in IBM i format. - * There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. - * It must be greater than or equal to zero. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(double doubleValue, byte[] as400Value, int offset) - { - // GOAL: For performance reasons, we need to do this conversion - // without creating any Java objects (e.g., BigDecimals, - // Strings). - - // If the number is too big, we can't do anything with it. - double absValue = Math.abs(doubleValue); - if (absValue > Long.MAX_VALUE) - throw new ExtendedIllegalArgumentException("doubleValue", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - // Extract the normalized value. This is the value represented by - // two longs (one for each side of the decimal point). Using longs - // here improves the quality of the algorithm as well as the - // performance of arithmetic operations. We may need to use an - // "effective" scale due to the lack of precision representable - // by a long. - long leftSide = (long)absValue; - int effectiveScale = (scale > 15) ? 15 : scale; - long rightSide = (long)Math.round((absValue - (double)leftSide) * Math.pow(10, effectiveScale)); - - // Ok, now we are done with any double arithmetic! - int length = digits/2; - int b = offset + length; - boolean nibble = true; // true for left nibble, false for right nibble. - - // If the effective scale is different than the actual scale, - // then pad with zeros. - int scaleDifference = scale - effectiveScale; - for (int i = 1; i <= scaleDifference; ++i) { - if (nibble) { - as400Value[b] &= (byte)(0x000F); - --b; - } - else { - as400Value[b] &= (byte)(0x00F0); - } - nibble = !nibble; - } - - // Compute the bytes for the right side of the decimal point. - int nextDigit; - for (int i = 1; i <= effectiveScale; ++i) { - nextDigit = (int)(rightSide % 10); - if (nibble) { - as400Value[b] &= (byte)(0x000F); - as400Value[b] |= ((byte)nextDigit << 4); - --b; - } - else { - as400Value[b] &= (byte)(0x00F0); - as400Value[b] |= (byte)nextDigit; - } - nibble = !nibble; - rightSide /= 10; - } - - // Compute the bytes for the left side of the decimal point. - int leftSideDigits = digits - scale; - for (int i = 1; i <= leftSideDigits; ++i) { - nextDigit = (int)(leftSide % 10); - if (nibble) { - as400Value[b] &= (byte)(0x000F); - as400Value[b] |= ((byte)nextDigit << 4); - --b; - } - else { - as400Value[b] &= (byte)(0x00F0); - as400Value[b] |= (byte)nextDigit; - } - nibble = !nibble; - leftSide /= 10; - } - - // Zero out the left part of the value, if needed. - while (b >= offset) { - if (nibble) { - as400Value[b] &= (byte)(0x000F); - --b; - } - else { - as400Value[b] &= (byte)(0x00F0); - } - nibble = !nibble; - } - - // Fix the sign. - b = offset + length; - as400Value[b] &= (byte)(0x00F0); - as400Value[b] |= (byte)((doubleValue >= 0) ? 0x000F : 0x000D); - - // If left side still has digits, then the value was too big - // to fit. - if (leftSide > 0) - throw new ExtendedIllegalArgumentException("doubleValue", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - return length+1; - } - - - // @E0A - /** - * Converts the specified IBM i data type to a Java double value. If the - * decimal part of the value needs to be truncated to be represented by a - * Java double value, then it is rounded towards zero. If the integral - * part of the value needs to be truncated to be represented by a Java - * double value, then it converted to either Double.POSITIVE_INFINITY - * or Double.NEGATIVE_INFINITY. - * - * @param as400Value The array containing the data type in IBM i format. - * The entire data type must be represented. - * @return The Java double value corresponding to the data type. - **/ - public double toDouble(byte[] as400Value) - { - return toDouble(as400Value, 0); - } - - // @E0A - /** - * Converts the specified IBM i data type to a Java double value. If the - * decimal part of the value needs to be truncated to be represented by a - * Java double value, then it is rounded towards zero. If the integral - * part of the value needs to be truncated to be represented by a Java - * double value, then it converted to either Double.POSITIVE_INFINITY - * or Double.NEGATIVE_INFINITY. - * - * @param as400Value The array containing the data type in IBM i format. - * The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. - * It must be greater than or equal to zero. - * @return The Java double value corresponding to the data type. - **/ - public double toDouble(byte[] as400Value, int offset) - { - // Check the offset to prevent bogus NumberFormatException message. - if (offset < 0) - throw new ArrayIndexOutOfBoundsException(String.valueOf(offset)); - - // Compute the value. - double doubleValue = 0; - double multiplier = Math.pow(10, -scale); - int rightMostOffset = offset + digits/2; - boolean nibble = true; // true for left nibble, false for right nibble. - for(int i = rightMostOffset; i >= offset;) { - if (nibble) { - doubleValue += (byte)((as400Value[i] & 0x00F0) >> 4) * multiplier; - --i; - } - else { - doubleValue += ((byte)(as400Value[i] & 0x000F)) * multiplier; - } - - multiplier *= 10; - nibble = ! nibble; - } - - // Determine the sign. - switch(as400Value[rightMostOffset] & 0x000F) { - case 0x000B: - case 0x000D: - // Negative. - doubleValue *= -1; - break; - case 0x000A: - case 0x000C: - case 0x000E: - case 0x000F: - // Positive. - break; - default: - throwNumberFormatException(LOW_NIBBLE, rightMostOffset, - as400Value[rightMostOffset] & 0x00FF, - as400Value); - } - - return doubleValue; - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The BigDecimal object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value) - { - return this.toObject(as400Value, 0); - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented and the data type must have valid packed decimal format. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The BigDecimal object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value, int offset) - { - if (useDouble_) return new Double(toDouble(as400Value, offset)); - - // Check offset to prevent bogus NumberFormatException message - if (offset < 0) - { - throw new ArrayIndexOutOfBoundsException(String.valueOf(offset)); - } - - int numDigits = this.digits; - int inputSize = numDigits/2+1; - - // even number of digits will have a leading zero - if (numDigits%2 == 0) ++numDigits; - - char[] outputData = null; - int outputPosition = 0; // position in char[] - - // read the sign nibble, allow ArrayIndexException to be thrown - int nibble = (as400Value[offset+inputSize-1] & 0x0F); - switch (nibble) - { - case 0x0B: // valid negative sign bits - case 0x0D: - outputData = new char[numDigits+1]; - outputData[outputPosition++] = '-'; - break; - case 0x0A: // valid positive sign bits - case 0x0C: - case 0x0E: - case 0x0F: - outputData = new char[numDigits]; - break; - default: // others invalid - throwNumberFormatException(LOW_NIBBLE, offset+inputSize-1, - as400Value[offset+inputSize-1] & 0xFF, - as400Value); - } - - // read all the digits except last one - while (outputPosition < outputData.length-1) - { - nibble = (as400Value[offset] & 0xFF) >>> 4; - if (nibble > 0x09) - throwNumberFormatException(HIGH_NIBBLE, offset, - as400Value[offset] & 0xFF, - as400Value); - outputData[outputPosition++] = (char)(nibble | 0x0030); - - nibble = (as400Value[offset++] & 0x0F); - if (nibble > 0x09) - throwNumberFormatException(LOW_NIBBLE, offset-1, - as400Value[offset-1] & 0xFF, - as400Value); - outputData[outputPosition++] = (char)(nibble | 0x0030); - } - - // read last digit - nibble = (as400Value[offset] & 0xFF) >>> 4; - if (nibble > 0x09) - throwNumberFormatException(HIGH_NIBBLE, offset, - as400Value[offset] & 0xFF, - as400Value); - outputData[outputPosition++] = (char)(nibble | 0x0030); - - // construct New BigDecimal object - return new BigDecimal(new BigInteger(new String(outputData)), this.scale); - } - - static final void throwNumberFormatException(boolean highNibble, int byteOffset, int byteValue, byte[] fieldBytes) throws NumberFormatException - { - String text; - if (highNibble) { - text = ResourceBundleLoader.getText("EXC_HIGH_NIBBLE_NOT_VALID", Integer.toString(byteOffset), byteToString(byteValue)); - } - else { - text = ResourceBundleLoader.getText("EXC_LOW_NIBBLE_NOT_VALID", Integer.toString(byteOffset), byteToString(byteValue)); - } - Trace.log(Trace.ERROR, "Byte sequence is not valid for a field of type 'packed decimal':", fieldBytes); - throw new NumberFormatException(text); - } - - private static final String byteToString(int byteVal) - { - int leftDigitValue = (byteVal >>> 4) & 0x0F; - int rightDigitValue = byteVal & 0x0F; - char[] digitChars = new char[2]; - // 0x30 = '0', 0x41 = 'A' - digitChars[0] = leftDigitValue < 0x0A ? (char)(0x30 + leftDigitValue) : (char)(leftDigitValue - 0x0A + 0x41); - digitChars[1] = rightDigitValue < 0x0A ? (char)(0x30 + rightDigitValue) : (char)(rightDigitValue - 0x0A + 0x41); - return new String(digitChars); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400PortMapDS.java b/cvsroot/src/com/ibm/as400/access/AS400PortMapDS.java deleted file mode 100644 index a68de2c53..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400PortMapDS.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400PortMapDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -// A class representing a "port map" request data stream. This is a special request class that does not derive from the DataStream class. The DataStream class defines data streams that originate from or are destined to a server job. -class AS400PortMapDS -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - byte[] data_; - private int connectionID_; - - // Create request, data is name of server in ASCII. - AS400PortMapDS(String server) - { - // Cheat conversion from Unicode to ASCII by casting away the high byte. - // Server names use an acceptable restricted character set. - char[] uniChars = server.toCharArray(); - data_ = new byte[uniChars.length]; - for (int i = 0; i < uniChars.length; ++i) - { - data_[i] = (byte)uniChars[i]; - } - } - - // Set the connection ID associated with this data stream. - // @param connectionID the connection ID. - void setConnectionID(int connectionID) - { - connectionID_ = connectionID; - } - - // Send request to the port mapper. - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending port mapper request..."); //@P0C - synchronized(out) - { - out.write(data_); - out.flush(); - } - if (Trace.traceOn_) Trace.log(Trace.DATASTREAM, "Data stream sent (connID="+connectionID_+") ...", data_); //@P0C - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400PortMapReplyDS.java b/cvsroot/src/com/ibm/as400/access/AS400PortMapReplyDS.java deleted file mode 100644 index 052b102b3..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400PortMapReplyDS.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: AS400PortMapReplyDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -// A class representing a reply to a "port map" request (class AS400PortMapDS) data stream. This class is NOT derived from DataStream. -class AS400PortMapReplyDS -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - byte[] data_; - private int connectionID_; - - // Create space for port mapper reply. - AS400PortMapReplyDS() - { - data_ = new byte[5]; - } - - // Get the port returned from the port mapper. - int getPort() throws ServerStartupException - { - // First check to make sure we got a positive response 0x2B==ASCII '+' - if (data_[0] == 0x2B) return BinaryConverter.byteArrayToInt(data_, 1); - throw new ServerStartupException(ServerStartupException.CONNECTION_PORT_CANNOT_CONNECT_TO); - } - - // Read the reply from the port mapper. - void read(InputStream in) throws IOException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Receiving port mapper reply (connID="+connectionID_+") ..."); - if (DataStream.readFromStream(in, data_, 0, 5, connectionID_) < 5) - { - Trace.log(Trace.ERROR, "Failed to read all of the port mapper reply."); - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - } - - // Set the connection ID associated with this data stream. - // @param connectionID the connection ID. - void setConnectionID(int connectionID) - { - connectionID_ = connectionID; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400SecurityException.java b/cvsroot/src/com/ibm/as400/access/AS400SecurityException.java deleted file mode 100644 index 34ad2655c..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400SecurityException.java +++ /dev/null @@ -1,556 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400SecurityException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - The AS400SecurityException class represents an exception that indicates that a security or authority error has occurred. - **/ -public class AS400SecurityException extends Exception implements ReturnCodeException -{ - static final long serialVersionUID = 4L; - - // Return code associated with this exception. - private int rc_; - // Messages, if any, associated with this exception. - private AS400Message[] messageList_; - - /** - The return code indicating that the user of this program does not have enough authority to access the directory entry. - **/ - public static final int DIRECTORY_ENTRY_ACCESS_DENIED = 1; - /** - The return code indicating that the user is not authorized to the exit program. - **/ - public static final int EXIT_PROGRAM_NOT_AUTHORIZED = 2; - /** - The return code indicating that the user of this program does not have enough authority to the library to perform the requested action. - **/ - public static final int LIBRARY_AUTHORITY_INSUFFICIENT = 3; - /** - The return code indicating that the user of this program does not have enough authority to the resource to perform the requested action. - **/ - public static final int OBJECT_AUTHORITY_INSUFFICIENT = 4; - /** - The return code indicating that the change password request is missing user ID, old password, or new password. - **/ - public static final int PASSWORD_CHANGE_REQUEST_NOT_VALID = 5; - /** - The return code indicating that there is a general password error. - **/ - public static final int PASSWORD_ERROR = 6; - /** - The return code indicating that the password has expired. - **/ - public static final int PASSWORD_EXPIRED = 7; - /** - The return code indicating that the password is not correct. - **/ - public static final int PASSWORD_INCORRECT = 8; - /** - The return code indicating that the password is not correct and that the user ID will be disabled on the next sign-on attempt if the password is incorrect again. - **/ - public static final int PASSWORD_INCORRECT_USERID_DISABLE = 9; - /** - The return code indicating that the password length is not valid. - **/ - public static final int PASSWORD_LENGTH_NOT_VALID = 10; - /** - The return code indicating that the new password has adjacent digits. - **/ - public static final int PASSWORD_NEW_ADJACENT_DIGITS = 11; - /** - The return code indicating that the new password contains a character repeated consecutively. - **/ - public static final int PASSWORD_NEW_CONSECUTIVE_REPEAT_CHARACTER = 12; - /** - The return code indicating that the new password is not allowed. - **/ - public static final int PASSWORD_NEW_DISALLOWED = 13; - /** - The return code indicating that the new password must contain at least one alphabetic. - **/ - public static final int PASSWORD_NEW_NO_ALPHABETIC = 14; - /** - The return code indicating that the new password must contain at least one numeric. - **/ - public static final int PASSWORD_NEW_NO_NUMERIC = 15; - /** - The return code indicating that the new password is not valid. - **/ - public static final int PASSWORD_NEW_NOT_VALID = 16; - /** - The return code indicating that the new password was previously used. - **/ - public static final int PASSWORD_NEW_PREVIOUSLY_USED = 17; - /** - The return code indicating that the new password contains a character used more than once. - **/ - public static final int PASSWORD_NEW_REPEAT_CHARACTER = 18; - /** - The return code indicating that the new password is longer than maximum accepted length. - **/ - public static final int PASSWORD_NEW_TOO_LONG = 19; - /** - The return code indicating that the new password is shorter than minimum accepted length. - **/ - public static final int PASSWORD_NEW_TOO_SHORT = 20; - /** - The return code indicating that the new password contains a user ID as part of the password. - **/ - public static final int PASSWORD_NEW_USERID = 21; - /** - The return code indicating that the password is not set. - **/ - public static final int PASSWORD_NOT_SET = 22; - /** - The return code indicating that the old password is not valid. - **/ - public static final int PASSWORD_OLD_NOT_VALID = 23; - /** - The return code indicating that a general security failure occurred. - **/ - public static final int SECURITY_GENERAL = 24; - /** - The return code indicating that the user canceled out of the sign-on prompt. - **/ - public static final int SIGNON_CANCELED = 25; - /** - The return code indicating that the sign-on request is missing either the user ID or the password. - **/ - public static final int SIGNON_REQUEST_NOT_VALID = 26; - /** - The return code indicating that the exact cause of the failure is not known. The detailed message may contain additional information. - **/ - public static final int UNKNOWN = 27; - /** - The return code indicating that a general user ID error occurred. - **/ - public static final int USERID_ERROR = 28; - /** - The return code indicating that the user ID length is not valid. - **/ - public static final int USERID_LENGTH_NOT_VALID = 29; - /** - The return code indicating that the user ID is not set. - **/ - public static final int USERID_NOT_SET = 30; - /** - The return code indicating that the user ID has been disabled by the system. - **/ - public static final int USERID_DISABLE = 31; - /** - The return code indicating that the user ID is not known by the system. - **/ - public static final int USERID_UNKNOWN = 32; - /** - The return code indicating that an error occurred processing the exit point. - **/ - public static final int EXIT_POINT_PROCESSING_ERROR = 33; - /** - The return code indicating that an error occurred resolving to the exit program. - **/ - public static final int EXIT_PROGRAM_RESOLVE_ERROR = 34; - /** - The return code indicating that the user exit program associated with the server job rejected the request. - **/ - public static final int EXIT_PROGRAM_DENIED_REQUEST = 35; - /** - The return code indicating that an error occurred with the user exit program call. - **/ - public static final int EXIT_PROGRAM_CALL_ERROR = 36; - /** - The return code indicating that the requested action is not supported. - **/ - public static final int REQUEST_NOT_SUPPORTED = 37; - /** - The return code indicating that the requested action cannot be performed due to the system level not being correct. - **/ - public static final int SYSTEM_LEVEL_NOT_CORRECT = 38; - /** - The return code indicating that the new password contains the same character in the same position as the previous password. - **/ - public static final int PASSWORD_NEW_SAME_POSITION = 39; - /** - The return code indicating that the user of this program does not have enough special authority to perform the requested action. - **/ - public static final int SPECIAL_AUTHORITY_INSUFFICIENT = 40; - /** - The return code indicating that the token type is not valid. - **/ - public static final int TOKEN_TYPE_NOT_VALID = 41; - /** - The return code indicating that the generate token request is not valid. - **/ - public static final int GENERATE_TOKEN_REQUEST_NOT_VALID = 42; - /** - The return code indicating that the token length is not valid. - **/ - public static final int TOKEN_LENGTH_NOT_VALID = 43; - /** - The return code indicating that the new password contains a character that is not valid. - **/ - public static final int PASSWORD_NEW_CHARACTER_NOT_VALID = 44; - /** - The return code indicating that the password has pre-V2R2 encryption. - **/ - public static final int PASSWORD_PRE_V2R2 = 45; - /** - The return code indicating that the password is *NONE. - **/ - public static final int PASSWORD_NONE = 46; - /** - The return code indicating that the profile token or identity token is not valid. - **/ - public static final int PROFILE_TOKEN_NOT_VALID = 47; - /** - The return code indicating that the profile token is not valid. Maximum number of profile tokens for the system already generated. - **/ - public static final int PROFILE_TOKEN_NOT_VALID_MAXIMUM = 48; - /** - The return code indicating that the profile token is not valid. Timeout interval is not valid. - **/ - public static final int PROFILE_TOKEN_NOT_VALID_TIMEOUT_NOT_VALID = 49; - /** - The return code indicating that the profile token is not valid. Type of profile token is not valid. - **/ - public static final int PROFILE_TOKEN_NOT_VALID_TYPE_NOT_VALID = 50; - /** - The return code indicating that the profile token is not valid. Profile token is not regenerable. - **/ - public static final int PROFILE_TOKEN_NOT_VALID_NOT_REGENERABLE = 51; - /** - The return code indicating that the authentication token is not valid. Consistency checks failed. - **/ - public static final int KERBEROS_TICKET_NOT_VALID_CONSISTENCY = 52; - /** - The return code indicating that the Kerberos ticket is not valid. Requested mechanisms are not supported by local system. - **/ - public static final int KERBEROS_TICKET_NOT_VALID_MECHANISM = 53; - /** - The return code indicating that the Kerberos ticket is not valid. Credentials are not available or are not valid for this context. - **/ - public static final int KERBEROS_TICKET_NOT_VALID_CREDENTIAL_NOT_VALID = 54; - /** - The return code indicating that the authentication token is not valid. Kerberos token or identity token contains incorrect signature. - **/ - public static final int KERBEROS_TICKET_NOT_VALID_SIGNATURE = 55; - /** - The return code indicating that the Kerberos ticket is not valid. Credentials are no longer valid. - **/ - public static final int KERBEROS_TICKET_NOT_VALID_CREDENTIAL_NO_LONGER_VALID = 56; - /** - The return code indicating that the Kerberos ticket is not valid. Consistency checks on the credantial structure failed. - **/ - public static final int KERBEROS_TICKET_NOT_VALID_CREDANTIAL_STRUCTURE = 57; - /** - The return code indicating that the Kerberos ticket is not valid. Verification routine failed. - **/ - public static final int KERBEROS_TICKET_NOT_VALID_VERIFICATION = 58; - /** - The return code indicating that the authentication token is not valid. EIM configuration error detected. - **/ - public static final int KERBEROS_TICKET_NOT_VALID_EIM = 59; - /** - The return code indicating that the Kerberos ticket is not valid. Kerberos principal maps to a system profile which can not be used to sign on. - **/ - public static final int KERBEROS_TICKET_NOT_VALID_SYSTEM_PROFILE = 60; - /** - The return code indicating that the authentication token is not valid. Token maps to multiple user profile names. - **/ - public static final int KERBEROS_TICKET_NOT_VALID_MULTIPLE_PROFILES = 61; - /** - The return code indicating that the Kerberos ticket is not valid. Kerberos service ticket could not be retrieved. - **/ - public static final int KERBEROS_TICKET_NOT_VALID_RETRIEVE = 62; - /** - The return code indicating that the user ID or password contains a character that is not valid. - **/ - public static final int SIGNON_CHAR_NOT_VALID = 63; - /** - The return code indicating that the user ID does not match the user profile associated with the authentication token. - **/ - public static final int USERID_MISMATCH = 64; - /** - The return code indicating that the password validation program failed the request. - **/ - public static final int PASSWORD_NEW_VALIDATION_PROGRAM = 65; - /** - The return code indicating that the user of this program does not have enough authority to generate a profile token for another user. - **/ - public static final int GENERATE_TOKEN_AUTHORITY_INSUFFICIENT = 66; - /** - The return code indicating that can not connect to the system EIM domain. - **/ - public static final int GENERATE_TOKEN_CAN_NOT_CONNECT = 67; - /** - The return code indicating that can not change the CCSID. - **/ - public static final int GENERATE_TOKEN_CAN_NOT_CHANGE_CCSID = 68; - /** - The return code indicating that can not obtain the EIM registry name. - **/ - public static final int GENERATE_TOKEN_CAN_NOT_OBTAIN_NAME = 69; - /** - The return code indicating that no mapping exists. - **/ - public static final int GENERATE_TOKEN_NO_MAPPING = 70; - /** - The return code indicating that the system was not able to allocate space needed for authorization. - **/ - public static final int SERVER_NO_MEMORY = 71; - /** - The return code indicating that an error occurred on the system while converting data between code pages. - **/ - public static final int SERVER_CONVERSION_ERROR = 72; - /** - The return code indicating that an error occurred on the system while using EIM interfaces. - **/ - public static final int SERVER_EIM_ERROR = 73; - /** - The return code indicating that an error occurred on the system while using cryptographic interfaces. - **/ - public static final int SERVER_CRYPTO_ERROR = 74; - /** - The return code indicating that the system version does support the token version. - **/ - public static final int SERVER_TOKEN_VERSION = 75; - /** - The return code indicating that the system could not find the public key. - **/ - public static final int SERVER_KEY_NOT_FOUND = 76; - /** - The return code indicating that the password change is not allowed at this time. - **/ - public static final int PASSWORD_CHANGE_NOT_ALLOWED = 77; - /** - The return code indicating that the password value is not valid. - **/ - public static final int PASSWORD_VALUE_NOT_VALID = 78; - - - /** - Constructs an AS400SecurityException. -

        An AS400SecurityException indicates that a security error has occurred. - @param returnCode The return code which identifies the message to be returned. Possible values are defined as constants on this class. - **/ - protected AS400SecurityException(int returnCode) - { - super(ResourceBundleLoader.getText(getMRIKey(returnCode))); - rc_ = returnCode; - } - - // Constructs an AS400SecurityException object. It indicates that a security exception occurred. Exception message will look like this: objectName: User is not authorized to object. - // @param objectName The name of the object. - // @param returnCode The return code which identifies the message to be returned. - AS400SecurityException(String objectName, int returnCode) - { - // Create the message. - super(objectName + ": " + ResourceBundleLoader.getText(getMRIKey(returnCode))); - rc_ = returnCode; - } - - AS400SecurityException(int returnCode, AS400Message[] messageList) - { - super(ResourceBundleLoader.getText(getMRIKey(returnCode))); - rc_ = returnCode; - messageList_ = messageList; - } - - // Returns the text associated with the return code. - // @param returnCode The return code associated with this exception. - // @return The text string which describes the error. - // This method is required so the message can be created and sent in super(). - static String getMRIKey(int returnCode) - { - switch(returnCode) - { - case DIRECTORY_ENTRY_ACCESS_DENIED: - return "EXC_DIRECTORY_ENTRY_ACCESS_DENIED"; - case EXIT_PROGRAM_NOT_AUTHORIZED: - return "EXC_EXIT_PROGRAM_NOT_AUTHORIZED"; - case LIBRARY_AUTHORITY_INSUFFICIENT: - return "EXC_LIBRARY_AUTHORITY_INSUFFICIENT"; - case OBJECT_AUTHORITY_INSUFFICIENT: - return "EXC_OBJECT_AUTHORITY_INSUFFICIENT"; - case PASSWORD_CHANGE_REQUEST_NOT_VALID: - return "EXC_PASSWORD_CHANGE_REQUEST_NOT_VALID"; - case PASSWORD_ERROR: - return "EXC_PASSWORD_ERROR"; - case PASSWORD_EXPIRED: - return "EXC_PASSWORD_EXPIRED"; - case PASSWORD_INCORRECT: - return "EXC_PASSWORD_INCORRECT"; - case PASSWORD_INCORRECT_USERID_DISABLE: - return "EXC_PASSWORD_INCORRECT_USERID_DISABLE"; - case PASSWORD_LENGTH_NOT_VALID: - return "EXC_PASSWORD_LENGTH_NOT_VALID"; - case PASSWORD_NEW_ADJACENT_DIGITS: - return "EXC_PASSWORD_NEW_ADJACENT_DIGITS"; - case PASSWORD_NEW_CONSECUTIVE_REPEAT_CHARACTER: - return "EXC_PASSWORD_NEW_CONSECUTIVE_REPEAT_CHARACTER"; - case PASSWORD_NEW_DISALLOWED: - return "EXC_PASSWORD_NEW_DISALLOWED"; - case PASSWORD_NEW_NO_ALPHABETIC: - return "EXC_PASSWORD_NEW_NO_ALPHABETIC"; - case PASSWORD_NEW_NO_NUMERIC: - return "EXC_PASSWORD_NEW_NO_NUMERIC"; - case PASSWORD_NEW_NOT_VALID: - return "EXC_PASSWORD_NEW_NOT_VALID"; - case PASSWORD_NEW_PREVIOUSLY_USED: - return "EXC_PASSWORD_NEW_PREVIOUSLY_USED"; - case PASSWORD_NEW_REPEAT_CHARACTER: - return "EXC_PASSWORD_NEW_REPEAT_CHARACTER"; - case PASSWORD_NEW_TOO_LONG: - return "EXC_PASSWORD_NEW_TOO_LONG"; - case PASSWORD_NEW_TOO_SHORT: - return "EXC_PASSWORD_NEW_TOO_SHORT"; - case PASSWORD_NEW_USERID: - return "EXC_PASSWORD_NEW_USERID"; - case PASSWORD_NOT_SET: - return "EXC_PASSWORD_NOT_SET"; - case PASSWORD_OLD_NOT_VALID: - return "EXC_PASSWORD_OLD_NOT_VALID"; - case SECURITY_GENERAL: - return "EXC_SECURITY_GENERAL"; - case SIGNON_CANCELED: - return "EXC_SIGNON_CANCELED"; - case SIGNON_REQUEST_NOT_VALID: - return "EXC_SIGNON_REQUEST_NOT_VALID"; - case UNKNOWN: - return "EXC_UNKNOWN"; - case USERID_ERROR: - return "EXC_USERID_ERROR"; - case USERID_LENGTH_NOT_VALID: - return "EXC_USERID_LENGTH_NOT_VALID"; - case USERID_NOT_SET: - return "EXC_USERID_NOT_SET"; - case USERID_DISABLE: - return "EXC_USERID_DISABLE"; - case USERID_UNKNOWN: - return "EXC_USERID_UNKNOWN"; - case EXIT_POINT_PROCESSING_ERROR: - return "EXC_EXIT_POINT_PROCESSING_ERROR"; - case EXIT_PROGRAM_DENIED_REQUEST: - return "EXC_EXIT_PROGRAM_DENIED_REQUEST"; - case EXIT_PROGRAM_RESOLVE_ERROR: - return "EXC_EXIT_PROGRAM_RESOLVE_ERROR"; - case EXIT_PROGRAM_CALL_ERROR: - return "EXC_EXIT_PROGRAM_CALL_ERROR"; - case REQUEST_NOT_SUPPORTED: - return "EXC_REQUEST_NOT_SUPPORTED"; - case SYSTEM_LEVEL_NOT_CORRECT: - return "EXC_SYSTEM_LEVEL_NOT_CORRECT"; - case PASSWORD_NEW_SAME_POSITION: - return "EXC_PASSWORD_NEW_SAME_POSITION"; - case SPECIAL_AUTHORITY_INSUFFICIENT: - return "EXC_SPECIAL_AUTHORITY_INSUFFICIENT"; - case TOKEN_TYPE_NOT_VALID: - return "EXC_TOKEN_TYPE_NOT_VALID"; - case GENERATE_TOKEN_REQUEST_NOT_VALID: - return "EXC_GENERATE_TOKEN_REQUEST_NOT_VALID"; - case TOKEN_LENGTH_NOT_VALID: - return "EXC_TOKEN_LENGTH_NOT_VALID"; - case PASSWORD_NEW_CHARACTER_NOT_VALID: - return "EXC_PASSWORD_NEW_CHARACTER_NOT_VALID"; - case PASSWORD_PRE_V2R2: - return "EXC_PASSWORD_PRE_V2R2"; - case PASSWORD_NONE: - return "EXC_PASSWORD_NONE"; - case PROFILE_TOKEN_NOT_VALID: - return "EXC_PROFILE_TOKEN_NOT_VALID"; - case PROFILE_TOKEN_NOT_VALID_MAXIMUM: - return "EXC_PROFILE_TOKEN_NOT_VALID_MAXIMUM"; - case PROFILE_TOKEN_NOT_VALID_TIMEOUT_NOT_VALID: - return "EXC_PROFILE_TOKEN_NOT_VALID_TIMEOUT_NOT_VALID"; - case PROFILE_TOKEN_NOT_VALID_TYPE_NOT_VALID: - return "EXC_PROFILE_TOKEN_NOT_VALID_TYPE_NOT_VALID"; - case PROFILE_TOKEN_NOT_VALID_NOT_REGENERABLE: - return "EXC_PROFILE_TOKEN_NOT_VALID_NOT_REGENERABLE"; - case KERBEROS_TICKET_NOT_VALID_CONSISTENCY: - return "EXC_KERBEROS_TICKET_NOT_VALID_CONSISTENCY"; - case KERBEROS_TICKET_NOT_VALID_MECHANISM: - return "EXC_KERBEROS_TICKET_NOT_VALID_MECHANISM"; - case KERBEROS_TICKET_NOT_VALID_CREDENTIAL_NOT_VALID: - return "EXC_KERBEROS_TICKET_NOT_VALID_CREDENTIAL_NOT_VALID"; - case KERBEROS_TICKET_NOT_VALID_SIGNATURE: - return "EXC_KERBEROS_TICKET_NOT_VALID_SIGNATURE"; - case KERBEROS_TICKET_NOT_VALID_CREDENTIAL_NO_LONGER_VALID: - return "EXC_KERBEROS_TICKET_NOT_VALID_CREDENTIAL_NO_LONGER_VALID"; - case KERBEROS_TICKET_NOT_VALID_CREDANTIAL_STRUCTURE: - return "EXC_KERBEROS_TICKET_NOT_VALID_CREDANTIAL_STRUCTURE"; - case KERBEROS_TICKET_NOT_VALID_VERIFICATION: - return "EXC_KERBEROS_TICKET_NOT_VALID_VERIFICATION"; - case KERBEROS_TICKET_NOT_VALID_EIM: - return "EXC_KERBEROS_TICKET_NOT_VALID_EIM"; - case KERBEROS_TICKET_NOT_VALID_SYSTEM_PROFILE: - return "EXC_KERBEROS_TICKET_NOT_VALID_SYSTEM_PROFILE"; - case KERBEROS_TICKET_NOT_VALID_MULTIPLE_PROFILES: - return "EXC_KERBEROS_TICKET_NOT_VALID_MULTIPLE_PROFILES"; - case KERBEROS_TICKET_NOT_VALID_RETRIEVE: - return "EXC_KERBEROS_TICKET_NOT_VALID_RETRIEVE"; - case SIGNON_CHAR_NOT_VALID: - return "EXC_SIGNON_CHAR_NOT_VALID"; - case USERID_MISMATCH: - return "EXC_USERID_MISMATCH"; - case PASSWORD_NEW_VALIDATION_PROGRAM: - return "EXC_PASSWORD_NEW_VALIDATION_PROGRAM"; - case GENERATE_TOKEN_AUTHORITY_INSUFFICIENT: - return "EXC_GENERATE_TOKEN_AUTHORITY_INSUFFICIENT"; - case GENERATE_TOKEN_CAN_NOT_CONNECT: - return "EXC_GENERATE_TOKEN_CAN_NOT_CONNECT"; - case GENERATE_TOKEN_CAN_NOT_CHANGE_CCSID: - return "EXC_GENERATE_TOKEN_CAN_NOT_CHANGE_CCSID"; - case GENERATE_TOKEN_CAN_NOT_OBTAIN_NAME: - return "EXC_GENERATE_TOKEN_CAN_NOT_OBTAIN_NAME"; - case GENERATE_TOKEN_NO_MAPPING: - return "EXC_GENERATE_TOKEN_NO_MAPPING"; - case SERVER_NO_MEMORY: - return "EXC_SERVER_NO_MEMORY"; - case SERVER_CONVERSION_ERROR: - return "EXC_SERVER_CONVERSION_ERROR"; - case SERVER_EIM_ERROR: - return "EXC_SERVER_EIM_ERROR"; - case SERVER_CRYPTO_ERROR: - return "EXC_SERVER_CRYPTO_ERROR"; - case SERVER_TOKEN_VERSION: - return "EXC_SERVER_TOKEN_VERSION"; - case SERVER_KEY_NOT_FOUND: - return "EXC_SERVER_KEY_NOT_FOUND"; - case PASSWORD_CHANGE_NOT_ALLOWED: - return "EXC_PASSWORD_CHANGE_NOT_ALLOWED"; - case PASSWORD_VALUE_NOT_VALID: - return "EXC_PASSWORD_VALUE_NOT_VALID"; - default: - return "EXC_UNKNOWN"; // Bad return code was provided. - } - } - - /** - Returns the return code associated with this exception. - @return The return code. - **/ - public int getReturnCode() - { - return rc_; - } - - /** - Returns the list of messages associated with this exception. - @return The list of AS400Messages associated with this exception. If no messages are available null will be returned. - */ - public AS400Message[] getMessageList() - { - return messageList_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Server.java b/cvsroot/src/com/ibm/as400/access/AS400Server.java deleted file mode 100644 index 35728d66f..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400Server.java +++ /dev/null @@ -1,121 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Server.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.util.Hashtable; - -// A class representing an IBM i server job. -abstract class AS400Server -{ - protected int connectionID_; - - // Returns the connection ID for this AS400Server object. - // @return The connection ID. - final int getConnectionID() - { - return connectionID_; - } - - // Returns the service ID for a given service name. - // @param serviceName The service name of the associated service job. - // @return The server ID for the given service name. - static final int getServerId(String serviceName) - { - if ("as-central".equals(serviceName)) return 0xE000; - if ("as-file".equals(serviceName)) return 0xE002; - if ("as-netprt".equals(serviceName)) return 0xE003; - // Note: the "as-database" service has 3 server Ids: - // 0xE004 == SQL - // 0xE005 == NDB - // 0xE006 == ROI - if ("as-database".equals(serviceName)) return 0xE004; - if ("as-dtaq".equals(serviceName)) return 0xE007; - if ("as-rmtcmd".equals(serviceName)) return 0xE008; - if ("as-signon".equals(serviceName)) return 0xE009; - - Trace.log(Trace.ERROR, "Invalid service name: " + serviceName); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - - // Returns the service ID for a given service constant. - // param service The service constant of the associated service job. - // return The server ID of for the given service name. - static final int getServerId(int service) - { - switch (service) - { - case AS400.CENTRAL: return 0xE000; - case AS400.FILE: return 0xE002; - case AS400.PRINT: return 0xE003; - // Note: the "as-database" service has 3 server Ids: - // 0xE004 == SQL - // 0xE005 == NDB - // 0xE006 == ROI - case AS400.DATABASE: return 0xE004; - case AS400.DATAQUEUE: return 0xE007; - case AS400.COMMAND: return 0xE008; - case AS400.SIGNON: return 0xE009; - } - Trace.log(Trace.ERROR, "Invalid service:", service); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - - // Converts a service name into service ID. - static int getServiceId(String serviceName) - { - if (serviceName.equals("as-file")) return AS400.FILE; - if (serviceName.equals("as-netprt")) return AS400.PRINT; - if (serviceName.equals("as-rmtcmd")) return AS400.COMMAND; - if (serviceName.equals("as-dtaq")) return AS400.DATAQUEUE; - if (serviceName.equals("as-ddm")) return AS400.RECORDACCESS; - if (serviceName.equals("as-database")) return AS400.DATABASE; - if (serviceName.equals("as-central")) return AS400.CENTRAL; - if (serviceName.equals("as-signon")) return AS400.SIGNON; - - Trace.log(Trace.ERROR, "Invalid service: " + serviceName); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - - // The following static array holds the reply streams hash tables for all server daemons. These Hashtables are populated by the access classes using the addReplyStream(...) method. - static Hashtable[] replyStreamsHashTables = { new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable() }; - - // Add a prototype reply data stream to the collection of reply prototypes. There must be a prototype reply for every type of reply that must be constructed automatically on receipt. This method detects an attempt to add the same prototype reply more than once and ignores redundant attempts. - // @param replyStream The prototype reply data stream to be added. - // @param serviceName The service name of the server job that is the source of the reply streams. - static void addReplyStream(DataStream replyStream, String serviceName) - { - addReplyStream(replyStream, AS400Server.getServiceId(serviceName)); - } - static void addReplyStream(DataStream replyStream, int service) - { - replyStreamsHashTables[service].put(replyStream, replyStream); - } - - - abstract int getService(); - abstract String getJobString(); - abstract boolean isConnected(); - abstract DataStream getExchangeAttrReply(); - abstract DataStream sendExchangeAttrRequest(DataStream req) throws IOException, InterruptedException; - abstract void addInstanceReplyStream(DataStream replyStream); - abstract void clearInstanceReplyStreams(); - abstract DataStream sendAndReceive(DataStream requestStream) throws IOException, InterruptedException; - abstract void sendAndDiscardReply(DataStream requestStream) throws IOException; - abstract int send(DataStream requestStream) throws IOException; - abstract int newCorrelationId(); - abstract void send(DataStream requestStream, int correlationId) throws IOException; - abstract DataStream receive(int correlationId) throws IOException, InterruptedException; - abstract void forceDisconnect(); -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400SignonDialogAdapter.java b/cvsroot/src/com/ibm/as400/access/AS400SignonDialogAdapter.java deleted file mode 100644 index ec7d5ae4a..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400SignonDialogAdapter.java +++ /dev/null @@ -1,142 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: AS400SignonDialogAdapter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Component; -import java.awt.Dialog; -import java.awt.TextComponent; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; - -// Implements all of the listeners that the PasswordDialog, ChangePasswordDialog, and SignonDialog classes need. -class AS400SignonDialogAdapter implements ActionListener, FocusListener, KeyListener, WindowListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private Dialog c_ = null; - - private Component focalPoint_ = null; - - public AS400SignonDialogAdapter(Dialog listenee) - { - c_ = listenee; - } - - // Get the component whose focus we saved. - public Component getFocalPoint() - { - return focalPoint_; - } - - // Save this component's focus for later. - public void setFocalPoint(Component c) - { - focalPoint_ = c; - } - - // We're an action listener. - public void actionPerformed(ActionEvent event) - { - c_.setVisible(false); - } - - // We're a focus listener. - public void focusGained(FocusEvent event) - { - focalPoint_ = event.getComponent(); - } - - // We're a focus listener. - public void focusLost(FocusEvent event) - { - // Cancel selection if field loses focus. - if(event.getSource() instanceof TextComponent) - { - ((TextComponent)event.getSource()).setSelectionEnd(0); - } - } - - // We're a key listener. - public void keyPressed(KeyEvent event) - { - if(event.getKeyCode() == KeyEvent.VK_ENTER) - { - c_.setVisible(false); - } - } - - // We're a key listener. - public void keyReleased(KeyEvent event) - { - } - - // We're a key listener. - public void keyTyped(KeyEvent event) - { - } - - // We're a window listener. - public void windowActivated(WindowEvent event) - { - if(event.getWindow().isVisible()) - { - focalPoint_.requestFocus(); - } - } - - // We're a window listener. - public void windowClosed(WindowEvent event) - { - } - - // We're a window listener. - public void windowClosing(WindowEvent event) - { - c_.dispose(); - } - - // We're a window listener. - public void windowDeactivated(WindowEvent event) - { - } - - // We're a window listener. - public void windowDeiconified(WindowEvent event) - { - if(event.getWindow().isVisible()) - { - focalPoint_.requestFocus(); - } - } - - // We're a window listener. - public void windowIconified(WindowEvent event) - { - } - - // We're a window listener. - public void windowOpened(WindowEvent event) - { - if(event.getWindow().isVisible()) - { - focalPoint_.requestFocus(); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400SignonTextField.java b/cvsroot/src/com/ibm/as400/access/AS400SignonTextField.java deleted file mode 100644 index 095409942..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400SignonTextField.java +++ /dev/null @@ -1,91 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400SignonTextField.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.TextField; -import java.awt.Toolkit; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; - -/** - Implements a text field that only accepts valid characters for an IBM i userid or password, with a maximum of 10 characters total. - This text field will auto-uppercase any lowercase letters that are typed. - It also rejects any characters that are not allowable in an IBM i userid or password. The allowed characters are A-Z, a-z, 0-9, and the @, #, $, and _ characters. - Up to 10 characters may be typed into this text field. - Beeps are issued if the character limit is reached or invalid characters are entered. - Note: This class becomes obsolete when the new password support becomes integrated into the IBM i. - **/ -class AS400SignonTextField extends TextField implements KeyListener -{ - static final long serialVersionUID = 4L; - private static final String allowableChars_ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789$#_@"; - - public AS400SignonTextField() - { - super(); - addKeyListener(this); - } - - public void keyTyped(KeyEvent e) - { - char c = e.getKeyChar(); - - if (c == KeyEvent.VK_BACK_SPACE) - { - return; - } - - switch (e.getKeyCode()) - { - case KeyEvent.VK_ENTER: - case KeyEvent.VK_TAB: - case KeyEvent.VK_ALT: - case KeyEvent.VK_BACK_SPACE: - case KeyEvent.VK_CAPS_LOCK: - case KeyEvent.VK_CONTROL: - case KeyEvent.VK_DELETE: - case KeyEvent.VK_LEFT: - case KeyEvent.VK_RIGHT: - case KeyEvent.VK_END: - case KeyEvent.VK_ESCAPE: - case KeyEvent.VK_HOME: - case KeyEvent.VK_INSERT: - case KeyEvent.VK_SHIFT: - case KeyEvent.VK_CANCEL: - case KeyEvent.VK_CLEAR: - return; - } - - if (getText().length() < 10) // Max length is 10. - { - if (allowableChars_.indexOf(c) > -1) - { - e.setKeyChar(Character.toUpperCase(c)); - return; - } - } - - // Rejected -- either too many chars, or bad char entered. - e.consume(); - Toolkit.getDefaultToolkit().beep(); - } - - public void keyPressed(KeyEvent e) - { - } - - public void keyReleased(KeyEvent e) - { - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400StrSvrDS.java b/cvsroot/src/com/ibm/as400/access/AS400StrSvrDS.java deleted file mode 100644 index d0244d042..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400StrSvrDS.java +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400StrSvrDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -// A class representing a "start server" request data stream. -class AS400StrSvrDS extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - AS400StrSvrDS(int serverId, byte[] userIDbytes, byte[] authenticationBytes, int byteType) - { - super(new byte[(userIDbytes == null) ? 28 + authenticationBytes.length : 44 + authenticationBytes.length]); - - setLength(data_.length); - // Header ID replaced with Attributes. - data_[4] = 0x02; // Client Attributes, 2 means can get job info back. - // data_[5] = 0x00; // Server Attributes. - setServerID(serverId); - // setCSInstance(0x00000000); - // setCorrelation(0x00000000); - setTemplateLen(2); - setReqRepID(0x7002); - - data_[20] = (byteType == AS400.AUTHENTICATION_SCHEME_PASSWORD) ? (authenticationBytes.length == 8) ? (byte)0x01 : (byte)0x03 : (byteType == AS400.AUTHENTICATION_SCHEME_GSS_TOKEN) ? (byte)0x05 : (byteType == AS400.AUTHENTICATION_SCHEME_IDENTITY_TOKEN) ? (byte)0x06 : (byte)0x02; - data_[21] = 0x01; // Send reply true. - - // Set password or authentication token. - // LL - set32bit(6 + authenticationBytes.length, 22); - // CP - if (byteType == AS400.AUTHENTICATION_SCHEME_PASSWORD) - { - set16bit(0x1105, 26); - } - else - { - set16bit(0x1115, 26); - } - // Data. - System.arraycopy(authenticationBytes, 0, data_, 28, authenticationBytes.length); - - if (userIDbytes != null) - { - // Set user ID info. - // LL - set32bit(16, 28 + authenticationBytes.length); - // CP - set16bit(0x1104, 32 + authenticationBytes.length); - // EBCDIC user ID. - System.arraycopy(userIDbytes, 0, data_, 34 + authenticationBytes.length, 10); - } - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending start server request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400StrSvrReplyDS.java b/cvsroot/src/com/ibm/as400/access/AS400StrSvrReplyDS.java deleted file mode 100644 index 6d9faaabc..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400StrSvrReplyDS.java +++ /dev/null @@ -1,97 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400StrSvrReplyDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -// A class representing a reply to a "start server" request (class AS400StrSvrDS) data stream. -class AS400StrSvrReplyDS extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - /** - Generate a new instance of this type. - @return a reference to the new instance - **/ - public Object getNewDataStream() - { - return new AS400StrSvrReplyDS(); - } - - int getRC() - { - return get32bit(20); - } - - byte[] getUserIdBytes() - { - int offset = findCP(0x1104); - if (offset == -1) return null; - - byte[] userIdBytes = {(byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40}; - System.arraycopy(data_, offset + 10, userIdBytes, 0, get32bit(offset) - 10); - return userIdBytes; - } - - byte[] getJobNameBytes() - { - int offset = findCP(0x111F); - if (offset == -1) return new byte[0]; - - byte[] jobNameBytes = new byte[get32bit(offset) - 10]; - System.arraycopy(data_, offset + 10, jobNameBytes, 0, jobNameBytes.length); - return jobNameBytes; - } - - int findCP(int cp) - { - int offset = 24; - while (offset < data_.length - 1) - { - if (get16bit(offset + 4) == cp) return offset; - offset += get32bit(offset); - } - return -1; - } - - void read(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving start server reply..."); //@P0C - - // Receive the header. - byte[] header = new byte[20]; - if (readFromStream(in, header, 0, 20) < 20) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Failed to read all of the start server reply header."); //@P0C - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - - // Allocate bytes for datastream. - data_ = new byte[BinaryConverter.byteArrayToInt(header, 0)]; - System.arraycopy(header, 0, data_, 0, 20); - - // Read in the rest of the data. - readAfterHeader(in); - } - - /** - Generates a hash code for this data stream. - @return the hash code - **/ - public int hashCode() - { - return 0xF002; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Structure.java b/cvsroot/src/com/ibm/as400/access/AS400Structure.java deleted file mode 100644 index 5b2ef2c3e..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400Structure.java +++ /dev/null @@ -1,381 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Structure.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * Provides a composite data type representing a structure of AS400DataType objects. - **/ -public class AS400Structure implements AS400DataType -{ - static final long serialVersionUID = 4L; - - private AS400DataType[] elements_ = null; - private transient Object elementsLock_; - - private transient Object[] defaultValue_; - - private boolean allowChanges_ = true; // For beans: allow changes after null constructor until conversion method called - - /** - * Constructs an AS400Structure object. The setMembers() method must be called before any conversion methods or getByteLength() on this object. - **/ - public AS400Structure() - { - initializeTransient(); - } - - /** - * Constructs an AS400Structure object. - * @param members The data types of the members of the structure. - **/ - public AS400Structure(AS400DataType[] members) - { - if (members == null) throw new NullPointerException("members"); - initializeTransient(); - AS400DataType[] newMembers = new AS400DataType[members.length]; - for (int i=0; iObject[]) containing the default values for the members of the structure. The returned array contains one element for each member, in correct sequence. - **/ - public Object getDefaultValue() - { - synchronized (elementsLock_) - { - if (defaultValue_ == null) - { - int numElements = elements_.length; - defaultValue_ = new Object[numElements]; - for (int i = 0; i < numElements; i++) { - defaultValue_[i] = elements_[i].getDefaultValue(); - } - } - return defaultValue_; - } - } - - - /** - * Returns {@link com.ibm.as400.access.AS400DataType#TYPE_STRUCTURE TYPE_STRUCTURE}. - * @return AS400DataType.TYPE_STRUCTURE. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_STRUCTURE; - } - - /** - * Returns the Java class that corresponds with this data type. - * @return Object[].class. - **/ - public Class getJavaType() - { - return Object[].class; - } - - /** - * Returns the number of members in the data type. - * @return The number of members in the structure data type. If the members have not been set, negative one (-1) is returned. - **/ - public int getNumberOfMembers() - { - return (this.elements_ == null) ? - -1 : - this.elements_.length; - } - - /** - * Returns the data types of the members of the structure. - * @return The data types of the members of the structure. If the members have not been set, null is returned. - **/ - public AS400DataType[] getMembers() - { - if (elements_ == null) return null; // if elements unset, return null - - synchronized (elementsLock_) - { - // Create new array to return - AS400DataType[] newMembers = new AS400DataType[elements_.length]; - for (int i=0; i= elements_.length) - { - throw new ExtendedIllegalArgumentException("index", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - synchronized (elementsLock_) - { - return (AS400DataType)elements_[index].clone(); // only return clones, let this line throw ArrayIndexExceptions - } - } - - - /** - Initialize the transient data. - **/ - void initializeTransient() - { - elementsLock_ = new Object(); - defaultValue_ = null; - } - - - /** - *Deserializes and initializes transient data. - */ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient(); - } - - /** - * Sets the data types of the members of the structure. This method must be called after a call to the null constructor and before a call to any of the conversion methods. - * @param members The data types of the members of the structure. - **/ - public void setMembers(AS400DataType[] members) - { - if (members == null) throw new NullPointerException("members"); - if (!allowChanges_) - { - throw new ExtendedIllegalStateException("Members", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - AS400DataType[] newMembers = new AS400DataType[members.length]; - for (int i=0; i= elements_.length) - { - throw new ExtendedIllegalArgumentException("index", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (!allowChanges_) - { - throw new ExtendedIllegalStateException("Members", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - synchronized (elementsLock_) - { - elements_[index] = (AS400DataType)member.clone(); // only store clones, let this line throw ArrayIndexException - if (defaultValue_ != null) { - defaultValue_[index] = elements_[index].getDefaultValue(); - } - } - } - - /** - * Converts the specified Java object to IBM i format. The members of this structure must be set before calling this method. - * @param javaValue The object corresponding to the data type. It must be an Object array, the array must contain the correct number of elements, and each element must be of the correct type. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - byte[] as400Value = new byte[getByteLength()]; // let getByteLength check state - toBytes(javaValue, as400Value, 0); - return as400Value; - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. The members of this structure must be set before calling this method. - * @param javaValue The object corresponding to the data type. It must be an Object array, the array must contain the correct number of elements, and each element must be of the correct type. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value) - { - return toBytes(javaValue, as400Value, 0); - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. The members of this structure must be set before calling this method. - * @param javaValue The object corresponding to the data type. It must be an Object array, the array must contain the correct number of elements, and each element must be of the correct type. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - // Check for valid state - if (elements_ == null) - { - throw new ExtendedIllegalStateException("Members", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - synchronized (elementsLock_) - { - allowChanges_ = false; // Check before setting so don't have unfixable object - - int numElements = elements_.length; - Object[] arrayValue = (Object[])javaValue; // let this line to throw ClassCastException - if (arrayValue.length != numElements) // Check for correct number of elements - { - throw new ExtendedIllegalArgumentException("javaValue (" + javaValue.toString() + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - // Convert structure by iterating over elements, allow elements to do own validity checking - for (int i = 0; i < numElements; ++i) - { - offset += elements_[i].toBytes(arrayValue[i], as400Value, offset); - } - return getByteLength(); - } - } - - /** - * Converts the specified IBM i data type to a Java object. The members of this structure must be set before calling this method. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The array of Objects. Each element of this array is a Java object of the corresponding type of a member of this AS400Structure object. - **/ - public Object toObject(byte[] as400Value) - { - return toObject(as400Value, 0); - } - - /** - * Converts the specified IBM i data type to a Java object. The members of this structure must be set before calling this method. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The array of Objects. Each element of this array is a Java object of the corresponding type of a member of this AS400Structure object. - **/ - public Object toObject(byte[] as400Value, int offset) - { - // Check for valid state - if (elements_ == null) - { - throw new ExtendedIllegalStateException("Members", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - synchronized (elementsLock_) - { - allowChanges_ = false; // Check before setting so don't have unfixable object - int numElements = elements_.length; - - Object[] returnArray = new Object[numElements]; - - // Convert structure by iterating over elements, allow elements to do own validity checking - for (int i = 0; i < numElements; ++i) - { - returnArray[i] = elements_[i].toObject(as400Value, offset); - offset += elements_[i].getByteLength(); - } - return returnArray; - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Structure16.gif b/cvsroot/src/com/ibm/as400/access/AS400Structure16.gif deleted file mode 100644 index 2f5e24784..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400Structure16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400Structure32.gif b/cvsroot/src/com/ibm/as400/access/AS400Structure32.gif deleted file mode 100644 index cf6b87142..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/AS400Structure32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/AS400StructureBeanInfo.java b/cvsroot/src/com/ibm/as400/access/AS400StructureBeanInfo.java deleted file mode 100644 index 5eecc6492..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400StructureBeanInfo.java +++ /dev/null @@ -1,97 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400StructureBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.BeanDescriptor; -import java.beans.IndexedPropertyDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.BeanInfo; -import java.awt.Image; - -/** - * The AS400Structure class provides bean information for the AS400Structure class. - **/ -public class AS400StructureBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class beanClass = AS400Structure.class; - - private static PropertyDescriptor[] properties_; - - static - { - try - { - IndexedPropertyDescriptor members = new IndexedPropertyDescriptor("members", beanClass); - members.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_AS400STRUCTURE_MEMBERS")); - members.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_AS400STRUCTURE_MEMBERS")); - - PropertyDescriptor properties[] = {members}; - - properties_ = properties; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the bean descriptor. - * @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("AS400Structure16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("AS400Structure32.gif"); - break; - } - - return image; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/AS400Text.java b/cvsroot/src/com/ibm/as400/access/AS400Text.java deleted file mode 100644 index d2e39f163..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400Text.java +++ /dev/null @@ -1,554 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Text.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; - -/** - Provides character set conversion between Java String objects and IBM i code pages. - @see com.ibm.as400.access.CharConverter - **/ -public class AS400Text implements AS400DataType -{ - static final long serialVersionUID = 4L; - - private int length_; - private int ccsid_ = 65535; - transient private String encoding_ = null; - private AS400 system_; - transient ConverterImpl tableImpl_; - private static final String defaultValue_ = ""; - private byte[] padding_ = null; - - /** - Constructs an AS400Text object. - It uses the most likely CCSID based on the default locale. - @param length The byte length of the IBM i text. It must be greater than or equal to zero. - **/ - public AS400Text(int length) - { - if (length < 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'length' is not valid:", length); - throw new ExtendedIllegalArgumentException("length (" + length + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - length_ = length; - } - - /** - Constructs an AS400Text object. - @param length The byte length of the IBM i text. It must be greater than or equal to zero. - @param ccsid The CCSID of the IBM i text. It must refer to a valid and available CCSID. The value 65535 will cause the data type to use the most likely CCSID based on the default locale. - **/ - public AS400Text(int length, int ccsid) - { - if (length < 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'length' is not valid:", length); - throw new ExtendedIllegalArgumentException("length (" + length + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (ccsid < 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'ccsid' is not valid:", ccsid); - throw new ExtendedIllegalArgumentException("ccsid (" + ccsid + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - length_ = length; - ccsid_ = ccsid; - } - - /** - Constructs AS400Text object. - @param length The byte length of the IBM i text. It must be greater than or equal to zero. - @param encoding The name of a character encoding. It must be a valid and available encoding. - **/ - public AS400Text(int length, String encoding) - { - if (length < 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'length' is not valid:", length); - throw new ExtendedIllegalArgumentException("length (" + length + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (encoding == null) - { - Trace.log(Trace.ERROR, "Parameter 'encoding' is null."); - throw new NullPointerException("encoding"); - } - length_ = length; - encoding_ = encoding; - } - - /** - Constructs an AS400Text object. The CCSID used for conversion will be the CCSID of the system object. - @param length The byte length of the IBM i text. It must be greater than or equal to zero. - @param system The system with which to determine the CCSID. - */ - public AS400Text(int length, AS400 system) - { - // Passing a 65535 will cause setTable() to do a system.getCcsid() at conversion time. - this(length, 65535, system); - } - - /** - Constructs an AS400Text object. - @param length The byte length of the IBM i text. It must be greater than or equal to zero. - @param ccsid The CCSID of the IBM i text. It must refer to a valid and available CCSID. The value 65535 will cause the data type to use the most likely CCSID based on the default locale. - @param system The system from which the conversion table may be downloaded. - */ - public AS400Text(int length, int ccsid, AS400 system) - { - if (length < 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'length' is not valid:", length); - throw new ExtendedIllegalArgumentException("length (" + length + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (ccsid < 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'ccsid' is not valid:", ccsid); - throw new ExtendedIllegalArgumentException("ccsid (" + ccsid + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - length_ = length; - ccsid_ = ccsid; - system_ = system; - } - - // Package scope constructor for use on the proxy server. Note that this constructor is only used in AS400FileRecordDescriptionImplRemote. It is expected that the client code (AS400FileRecordDescription) will call fillInConverter() on each AS400Text object returned. - AS400Text(int length, int ccsid, AS400Impl system) - { - if (length < 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'length' is not valid:", length); - throw new ExtendedIllegalArgumentException("length (" + length + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (ccsid < 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'ccsid' is not valid:", ccsid); - throw new ExtendedIllegalArgumentException("ccsid (" + ccsid + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - length_ = length; - ccsid_ = ccsid; - // Notice that we have not filled in the Converter object. We can't do that because we don't know if this object will in the end be used on the public side (Converter) or on the IBM i side (ConverterImpl). - // We also can't do that yet since the Converter ctor will connect to the system. - } - - /** - Creates a new AS400Text object that is identical to the current instance. - @return The new object. - **/ - public Object clone() - { - try - { - return super.clone(); // Object.clone does not throw exception. - } - catch (CloneNotSupportedException e) - { - Trace.log(Trace.ERROR, "Unexpected CloneNotSupportedException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the byte length of the data type. - @return The number of bytes in the IBM i representation of the data type. - **/ - public int getByteLength() - { - return length_; - } - - /** - Returns the CCSID of the data type. - @return The CCSID. - **/ - public int getCcsid() - { - if (ccsid_ == 65535) setTable(); - return ccsid_; - } - - // Returns the ConverterImpl object so other classes don't need to create a new Converter if they already have an AS400Text object. - ConverterImpl getConverter() - { - setTable(); - return tableImpl_; - } - - /** - Returns a Java object representing the default value of the data type. - @return The String object representing an empty string (""). - **/ - public Object getDefaultValue() - { - return defaultValue_; - } - - /** - Returns the encoding of the data type. - @return The encoding of the data type. - **/ - public String getEncoding() - { - if (encoding_ == null) setTable(); - return encoding_; - } - - /** - Returns {@link com.ibm.as400.access.AS400DataType#TYPE_TEXT TYPE_TEXT}. - @return AS400DataType.TYPE_TEXT. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_TEXT; - } - - /** - * Returns the Java class that corresponds with this data type. - * @return String.class. - **/ - public Class getJavaType() - { - return String.class; - } - - // This method is used in conjunction with the constructor that takes an AS400Impl. It is used to fully instantiate the member data of this AS400Text object once it has been serialized and received on the client from the proxy server. We do it this way because we can't create a normal AS400Text object on the proxy server and expect it to be valid on the proxy client because its internal Converter object would not be proxified correctly. - // When an AS400Text object is serialized from the proxy server over to the client, the client code must set the converter using this method. - void setConverter(AS400 system) - { - system_ = system; - setTable(); - } - - // When an AS400Text object is serialized from the client over to the proxy server, the server code must set the converter using this method. Note that we cannot refer directly to the ConverterImplRemote class here, so it is left up to the server code to create that and pass it in to this method. - void setConverter(ConverterImpl converter) - { - tableImpl_ = converter; - // Just in case this object ever goes back to the client. - ccsid_ = tableImpl_.getCcsid(); - } - - // Private method to initialize the Converter table and its impl. - private void setTable() - { - if (tableImpl_ == null) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "AS400Text object initializing, encoding: " + encoding_ + ", CCSID: " + ccsid_ + ", system: " + system_); - if (encoding_ != null) - { - try - { - Converter table = new Converter(encoding_); - ccsid_ = table.getCcsid(); - tableImpl_ = table.impl; - } - catch (UnsupportedEncodingException e) - { - throw new ExtendedIllegalArgumentException("encoding (" + encoding_ + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - else - { - try - { - if (system_ == null) - { - Converter table; - if (ccsid_ == 65535) - { - table = new Converter(); - ccsid_ = table.getCcsid(); - } - else - { - table = new Converter(ccsid_); - } - tableImpl_ = table.impl; - } - else - { - if (ccsid_ == 65535) - { - ccsid_ = system_.getCcsid(); - } - Converter table = new Converter(ccsid_, system_); - tableImpl_ = table.impl; - } - encoding_ = tableImpl_.getEncoding(); - } - catch (UnsupportedEncodingException e) - { - Trace.log(Trace.ERROR, "Value of parameter 'ccsid' is not valid:", ccsid_); - throw new ExtendedIllegalArgumentException("ccsid (" + ccsid_ + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "AS400Text object initialized, encoding: " + encoding_ + ", CCSID: " + ccsid_ + ", system: " + system_ + ", table: " + tableImpl_); - } - } - - /** - Converts the specified Java object to IBM i format. - @param javaValue The object corresponding to the data type. It must be an instance of String, and the converted text length must be less than or equal to the byte length of this data type. If the provided string is not long enough to fill the return array, the remaining bytes will be padded with space bytes (EBCDIC 0x40, ASCII 0x20, or Unicode 0x0020). - @return The IBM i representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - byte[] serverValue = new byte[length_]; - toBytes(javaValue, serverValue, 0); - return serverValue; - } - - /** - Converts the specified Java object into IBM i format in the specified byte array. - @param javaValue The object corresponding to the data type. It must be an instance of String, and the converted text length must be less than or equal to the byte length of this data type. If the provided string is not long enough to fill the return array, the remaining bytes will be padded with space bytes (EBCDIC 0x40, ASCII 0x20, or Unicode 0x0020). - @param serverValue The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] serverValue) - { - return toBytes(javaValue, serverValue, 0); - } - - /** - Converts the specified Java object into IBM i format in the specified byte array. - @param javaValue The object corresponding to the data type. It must be an instance of String, and the converted text length must be less than or equal to the byte length of this data type. If the provided string is not long enough to fill the return array, the remaining bytes will be padded with space bytes (EBCDIC 0x40, ASCII 0x20, or Unicode 0x0020). - @param serverValue The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] serverValue, int offset) - { - if (AS400BidiTransform.isBidiCcsid(getCcsid())) - { - return toBytes(javaValue, serverValue, offset, new BidiConversionProperties(AS400BidiTransform.getStringType(ccsid_))); - } - else - { - return toBytes(javaValue, serverValue, offset, new BidiConversionProperties(BidiStringType.DEFAULT)); - } - } - - /** - Converts the specified Java object into IBM i format in the specified byte array. - @param javaValue The object corresponding to the data type. It must be an instance of String, and the converted text length must be less than or equal to the byte length of this data type. If the provided string is not long enough to fill the return array, the remaining bytes will be padded with space bytes (EBCDIC 0x40, ASCII 0x20, or Unicode 0x0020). - @param serverValue The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @param type The bidi string type, as defined by the CDRA (Character Data Representataion Architecture). See BidiStringType for more information and valid values. - @return The number of bytes in the IBM i representation of the data type. - @see com.ibm.as400.access.BidiStringType - **/ - public int toBytes(Object javaValue, byte[] serverValue, int offset, int type) - { - return toBytes(javaValue, serverValue, offset, new BidiConversionProperties(type)); - } - - /** - Converts the specified Java object into IBM i format in the specified byte array. - @param javaValue The object corresponding to the data type. It must be an instance of String, and the converted text length must be less than or equal to the byte length of this data type. If the provided string is not long enough to fill the return array, the remaining bytes will be padded with space bytes (EBCDIC 0x40, ASCII 0x20, or Unicode 0x0020). - @param serverValue The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @param properties The bidi conversion properties. - @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] serverValue, int offset, BidiConversionProperties properties) - { - // Check here to avoid sending bad data to Converter and ConvTable. - if (javaValue == null) - { - Trace.log(Trace.ERROR, "Parameter 'javaValue' is null."); - throw new NullPointerException("javaValue"); - } - - // Make sure the table is set. - setTable(); - - // We need to pad the String before the conversion in the case of a Bidi CCSID, because the Bidi transform needs to affect the entire String so it knows where the padding spaces need to go. - String toConvert = (String)javaValue; - - // We can't pad the String after the transform if we're bidi. - if (AS400BidiTransform.isBidiCcsid(ccsid_)) // We can use ccsid_ since we already called setTable(). - { - int realLength = toConvert.length(); - // Cases where we are Bidi, but we are DBCS. - if (ccsid_ == 13488 || ccsid_ == 61952) - { - realLength = realLength * 2; - } - int numPadBytes = length_ - realLength; - // Cases where we are Bidi, but we are DBCS. - if (ccsid_ == 13488 || ccsid_ == 61952) - { - numPadBytes = numPadBytes / 2; - } - if (numPadBytes > 0) - { - char[] cbuf = toConvert.toCharArray(); - // Since all of our Bidi maps are SBCS, we can add one char for each extra byte we need. - char[] paddedBuf = new char[cbuf.length + numPadBytes]; - System.arraycopy(cbuf, 0, paddedBuf, 0, cbuf.length); - for (int i = cbuf.length; i < paddedBuf.length; ++i) - { - paddedBuf[i] = (char)0x0020; // SBCS space - } - toConvert = new String(paddedBuf); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Pre-padded Bidi String with " + numPadBytes + " spaces from '" + javaValue + "' to '" + toConvert + "'"); - } - //Bidi-HCG: Bidi transformation is excluded from stringToByteArray() now, so do it here - //Bidi-HCG2 toConvert = AS400BidiTransform.bidiTransform(toConvert,properties.getBidiStringType(), AS400BidiTransform.getStringType(ccsid_)); - } - - byte[] eValue = tableImpl_.stringToByteArray(toConvert, properties); - - // Check that converted data fits within data type. - if (eValue.length > length_) - { - Trace.log(Trace.ERROR, "Length of parameter 'javaValue' is not valid: '" + javaValue + "'"); - throw new ExtendedIllegalArgumentException("javaValue (" + toConvert + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - // Let this line throw ArrayIndexException. - System.arraycopy(eValue, 0, serverValue, offset, eValue.length); - - // Pad with spaces. - // Note that this may sort of kludge the byte array in cases where the allocated size isn't an even number for double-byte CCSID's. e.g. new AS400Text(11, 13488) and wrote "ABCDE" which would take up 5*2=10 bytes, so we would pad the 11th byte with a double-byte space (0x00 0x20), so only the 0x00 would get written. Not much we can do about it though. - - // Build padding string. - int index = offset + eValue.length; - if (index < serverValue.length && index < offset+length_) - { - if (padding_ == null) - { - // Convert padding string using appropriate CCSID. - padding_ = tableImpl_.stringToByteArray("\u0020"); // The single-byte space. - // Either 0020 or 3000 must translate to a valid space character, no matter the codepage. - switch (padding_.length) - { - case 0: // Char wasn't in table. - padding_ = tableImpl_.stringToByteArray("\u3000"); - break; - case 1: // Char may be a single-byte substitution character. - if (padding_[0] == 0x3F || padding_[0] == 0x7F || padding_[0] == 0x1A) - { - padding_ = tableImpl_.stringToByteArray("\u3000"); - } - break; - case 2: // Char may be a double-byte substitution character. - int s = (0xFFFF & BinaryConverter.byteArrayToShort(padding_, 0)); - if (s == 0xFEFE || s == 0xFFFD || s == 0x003F || s == 0x007F || s == 0x001A) - { - padding_ = tableImpl_.stringToByteArray("\u3000"); - } - break; - default: - if (Trace.traceOn_) - { - Trace.log(Trace.WARNING, "AS400Text.toBytes(): Padding character not found for 0x0020 or 0x3000 under CCSID " + tableImpl_.getCcsid(), padding_, 0, padding_.length); - Trace.log(Trace.WARNING, "Using 0x40 as default padding character."); - } - padding_ = new byte[] { 0x40}; - } - } - // Copy padding bytes into destination as many times as necessary. Could've used a StringBuffer and a System.arraycopy, but this is faster... - int max = (offset+length_) < serverValue.length ? (offset+length_) : serverValue.length; - for (int i = 0; i < max - index; ++i) - { - serverValue[i+index] = padding_[i % padding_.length]; - } - } - - // Copy padding bytes into destination as many times as necessary. Could've used a StringBuffer and a System.arraycopy, but this is faster... - int max = (offset+length_) < serverValue.length ? (offset+length_) : serverValue.length; - for (int i = 0; i < max - index; ++i) - { - serverValue[i + index] = padding_[i % padding_.length]; - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "AS400Text.toBytes(): Converted javaValue (" + toConvert + ") to:", serverValue, offset, length_); - - return length_; - } - - /** - Converts the specified IBM i data type to a Java object. - @param serverValue The array containing the data type in IBM i format. The entire data type must be represented. - @return The String object corresponding to the data type. - **/ - public Object toObject(byte[] serverValue) - { - // Check here to avoid sending bad data to Converter and ConvTable. - if (serverValue == null) - { - Trace.log(Trace.ERROR, "Parameter 'serverValue' is null."); - throw new NullPointerException("serverValue"); - } - setTable(); // Make sure the table is set. - return tableImpl_.byteArrayToString(serverValue, 0, length_); - } - - /** - Converts the specified IBM i data type to a Java object. - @param serverValue The array containing the data type in IBM i format. The entire data type must be represented. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @return The String object corresponding to the data type. - **/ - public Object toObject(byte[] serverValue, int offset) - { - // Check here to avoid sending bad data to Converter and ConvTable. - if (serverValue == null) - { - Trace.log(Trace.ERROR, "Parameter 'serverValue' is null."); - throw new NullPointerException("serverValue"); - } - setTable(); // Make sure the table is set. - return tableImpl_.byteArrayToString(serverValue, offset, length_); - } - - /** - Converts the specified IBM i data type to a Java object. - @param serverValue The array containing the data type in IBM i format. The entire data type must be represented. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @param type The bidi string type, as defined by the CDRA (Character Data Representataion Architecture). See BidiStringType for more information and valid values. - @return The String object corresponding to the data type. - @see com.ibm.as400.access.BidiStringType - **/ - public Object toObject(byte[] serverValue, int offset, int type) - { - return toObject(serverValue, offset, new BidiConversionProperties(type)); - } - - /** - Converts the specified IBM i data type to a Java object. - @param serverValue The array containing the data type in IBM i format. The entire data type must be represented. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @param properties The bidi conversion properties. - @return The String object corresponding to the data type. - **/ - public Object toObject(byte[] serverValue, int offset, BidiConversionProperties properties) - { - // Check here to avoid sending bad data to Converter and ConvTable. - if (serverValue == null) - { - Trace.log(Trace.ERROR, "Parameter 'serverValue' is null."); - throw new NullPointerException("serverValue"); - } - setTable(); // Make sure the table is set - return tableImpl_.byteArrayToString(serverValue, offset, length_, properties); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400ThreadedServer.java b/cvsroot/src/com/ibm/as400/access/AS400ThreadedServer.java deleted file mode 100644 index 5ed8c8f60..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400ThreadedServer.java +++ /dev/null @@ -1,495 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400ThreadedServer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.SocketException; -import java.util.Hashtable; - -final class AS400ThreadedServer extends AS400Server implements Runnable -{ - private static int threadCount_ = 0; - - private AS400ImplRemote system_; - private int service_; - private String jobString_; - private boolean disconnecting_ = false; - - private SocketContainer socket_; - private InputStream inStream_; - private OutputStream outStream_; - - private Hashtable replyStreams_; - private Hashtable instanceReplyStreams_ = new Hashtable(); - - private Thread readDaemon_ = null; - private IOException readDaemonException_ = null; - private RuntimeException unlikelyException_ = null; - - private DataStream exchangeAttrReply_ = null; - - // Vectors are slow, but Object arrays are big, so we implement our own hashtables to compromise. - private final ReplyList replyList_ = new ReplyList(); - - private static final class DataStreamCollection - { - DataStream[] chain_; - DataStreamCollection(DataStream ds) - { - chain_ = new DataStream[] { ds }; - } - } - - private static final class ReplyList - { - final DataStreamCollection[] streams_ = new DataStreamCollection[16]; - private DiscardList discardList_; - - - final void add(DataStream ds) - { - int id = ds.getCorrelation(); - if (discardList_.remove(id)) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "ReplyList: Discarded datastream:", id); - ClassDecoupler.freeDBReplyStream(ds); ds = null; - return; - } - int hash = ds.getCorrelation() % 16; - - // Use the collection object for synchronization to prevent bottlenecks. - DataStreamCollection coll = streams_[hash]; - if (coll == null) - { - streams_[hash] = new DataStreamCollection(ds); - return; - } - synchronized (coll) - { - DataStream[] chain = coll.chain_; - int max = chain.length; - for (int i = 0; i < max; ++i) - { - if (chain[i] == null) - { - chain[i] = ds; - return; - } - } - DataStream[] newChain = new DataStream[max * 2]; - System.arraycopy(chain, 0, newChain, 0, max); - newChain[max] = ds; - coll.chain_ = newChain; - } - } - - final DataStream remove(int correlation) - { - int hash = correlation % 16; - DataStreamCollection coll = streams_[hash]; - if (coll == null) return null; - // Use the collection object for synchronization to prevent bottlenecks. - synchronized (coll) - { - DataStream[] chain = coll.chain_; - for (int i = 0; i < chain.length; ++i) - { - if (chain[i] != null && chain[i].getCorrelation() == correlation) - { - DataStream ds = chain[i]; - // Move up the remaining entries because chained replies have the same correlation ID and need to remain in chronological order. - if (i + 1 < chain.length) - { - System.arraycopy(chain, i + 1, chain, i, chain.length - i - 1); - } - // Set last element to null. - chain[chain.length - 1] = null; - return ds; - } - } - return null; - } - } - - void setDiscardList(DiscardList discardList) - { - discardList_ = discardList; - } - } - - private final DiscardList discardList_ = new DiscardList(); - - private static final class DiscardList - { - int[] ids_ = new int[8]; - final Object idsLock_ = new Object(); - private ReplyList replyList_; - - final void add(int correlation) - { - DataStream ds = replyList_.remove(correlation); - if (ds != null) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "DiscardList: Discarded datastream:", correlation); - ClassDecoupler.freeDBReplyStream(ds); ds = null; - return; - } - synchronized (idsLock_) - { - final int max = ids_.length; - for (int i = 0; i < max; ++i) - { - if (ids_[i] == 0) - { - ids_[i] = correlation; // We don't allow 0 as a valid correlation ID. - return; - } - } - int[] newIds = new int[max * 2]; - System.arraycopy(ids_, 0, newIds, 0, max); - newIds[max] = correlation; - ids_ = newIds; - } - } - - final boolean remove(int correlation) - { - final int max = ids_.length; - for (int i = 0; i < max; ++i) - { - if (ids_[i] == correlation) - { - ids_[i] = 0; - return true; - } - } - return false; - } - - void setReplyList(ReplyList replyList) - { - replyList_ = replyList; - } - } - - private int lastCorrelationId_ = 0; - private class CorrelationIdLock extends Object {} //@C7A - private class ReceiveLock extends Object {} //@C7A - - private final CorrelationIdLock correlationIdLock_ = new CorrelationIdLock(); - private final ReceiveLock receiveLock_ = new ReceiveLock(); - - AS400ThreadedServer(AS400ImplRemote system, int service, SocketContainer socket, String jobString) throws IOException - { - system_ = system; - service_ = service; - jobString_ = jobString; - - socket_ = socket; - connectionID_ = socket_.hashCode(); - inStream_ = socket_.getInputStream(); - outStream_ = socket_.getOutputStream(); - - replyStreams_ = AS400Server.replyStreamsHashTables[service]; - - discardList_.setReplyList(replyList_); - replyList_.setDiscardList(discardList_); - - String jobID; - if (jobString != null && jobString.length() != 0) jobID = jobString; - else jobID = AS400.getServerName(service) + "/" + (++threadCount_); - - readDaemon_ = new Thread(this, "AS400 Read Daemon [system:"+system.getSystemName() + ";job:" + jobID + "]"); - readDaemon_.setDaemon(true); - readDaemon_.start(); - } - - // Print is the only service that uses this method. - final void addInstanceReplyStream(DataStream replyStream) - { - instanceReplyStreams_.put(replyStream, replyStream); - } - - // Print is the only service that uses this method. - final void clearInstanceReplyStreams() - { - instanceReplyStreams_.clear(); - } - - final void forceDisconnect() - { - disconnecting_ = true; - if (readDaemonException_ == null) - { - readDaemonException_ = new ConnectionDroppedException(ConnectionDroppedException.DISCONNECT_RECEIVED); - } - - if (service_ == AS400.DATABASE || service_ == AS400.COMMAND || service_ == AS400.CENTRAL) - { - AS400EndJobDS endjob = new AS400EndJobDS(AS400Server.getServerId(service_)); - if (Trace.traceOn_) endjob.setConnectionID(connectionID_); - try - { - endjob.write(outStream_); - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Send end job data stream failed:", e); - } - } - Trace.log(Trace.INFORMATION , "forceDisconnect calling readDaemon_.interrupt"); - readDaemon_.interrupt(); - - try - { - socket_.close(); - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Socket close failed:", e); - } - - // Wait for thread to end. This is necessary to help socket descriptor from being reused. - try - { - readDaemon_.join(); - } - catch (InterruptedException e) - { - Trace.log(Trace.ERROR, "Thread join failed:", e); - } - } - - final DataStream getExchangeAttrReply() - { - return exchangeAttrReply_; - } - - final String getJobString() - { - return jobString_; - } - - final int getService() - { - return service_; - } - - final boolean isConnected() - { - return readDaemonException_ == null && unlikelyException_ == null; - } - - final int newCorrelationId() - { - synchronized (correlationIdLock_) - { - // Don't allow 0 as a valid correlation ID. - if (++lastCorrelationId_ == 0) lastCorrelationId_ = 1; - return lastCorrelationId_; - } - } - - final DataStream receive(int correlationId) throws IOException, InterruptedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "AS400Server.receive"); - synchronized (receiveLock_) - { - while (true) - { - DataStream ds = replyList_.remove(correlationId); - if (ds != null) - { - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, "receive(): Valid reply found:", correlationId); - } - - if (DBDSPool.monitor) { - if (ds instanceof DBReplyRequestedDS) { - ((DBReplyRequestedDS) ds).setAllocatedLocation(); - } - } /* @B5A*/ - - return ds; - } - else if (readDaemonException_ != null) - { - Trace.log(Trace.ERROR, "receive(): Read daemon exception:", readDaemonException_); - throw readDaemonException_; - } - else if (unlikelyException_ != null) - { - Trace.log(Trace.ERROR, "receive(): Read daemon exception:", unlikelyException_); - throw unlikelyException_; - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "receive(): Reply not found. Waiting..."); - receiveLock_.wait(); - } - } - } - - public void run() - { - while (readDaemonException_ == null && unlikelyException_ == null) - { - try - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "run(): Waiting for reply..."); - - DataStream reply = null; - - // If client access server, construct ClientAccessDataStream. - if (service_ != AS400.RECORDACCESS) - { - reply = ClientAccessDataStream.construct(inStream_, instanceReplyStreams_, replyStreams_, system_, connectionID_); - } - else // Construct a DDMDataStream. - { - reply = ClassDecoupler.constructDDMDataStream(inStream_, replyStreams_, system_, connectionID_); - } - // Note: the thread is blocked on the above call if the inputStream has nothing to receive. - - int correlation = reply.getCorrelation(); - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "run(): Adding reply:", correlation); - replyList_.add(reply); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "run(): Notifying threads."); - synchronized (receiveLock_) - { - receiveLock_.notifyAll(); // Notify all waiting threads. - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "run(): Threads notified."); - } - catch (IOException e) - { - if (Trace.traceOn_) - { - if (disconnecting_ && - e instanceof SocketException ) - { - // It's an expected consequence of a client-initiated disconnect. - Trace.log(Trace.DIAGNOSTIC, "run(): Caught SocketException during disconnect:", e); - } - else Trace.log(Trace.ERROR, "run(): Caught IOException:", e); - } - - // At this point, all waiting threads must be notified that the connection has ended... - if (readDaemonException_ == null) - { - readDaemonException_ = e; - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "run(): Notifying threads after IOException."); - synchronized (receiveLock_) - { - receiveLock_.notifyAll(); // Notify all waiting threads. - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "run(): Threads notified after IOException."); - } - catch (RuntimeException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "run(): Caught RuntimeException:", e); - if (unlikelyException_ == null) - { - unlikelyException_ = e; - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "run(): Notifying threads after RuntimeException."); - synchronized (receiveLock_) - { - receiveLock_.notifyAll(); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "run(): Threads notified after RuntimeException."); - } - //@socket2 removed finally close because we were doing double closes. - //@socket2finally - //@socket2{ - // Since we've fallen out of the while loop, we can reasonably assume that the socket is broken (based on the loop condition). - // Ensure the socket doesn't get left open. - //@socket2 if (!isConnected()) // Check it this way, in case we change the meaning of isConnected() in the future. - //{ - //@socket2 try { socket_.close(); } - //@socket2 catch (Throwable t) { - //@socket2 Trace.log(Trace.ERROR, "Socket close failed:", t); - //@socket2 } - //@socket2 } - //@socket2} - } - } - - final int send(DataStream requestStream) throws IOException - { - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, "send(): send request..."); - requestStream.setConnectionID(connectionID_); - } - if (readDaemonException_ != null) - { - Trace.log(Trace.ERROR, "Read daemon generated exception:", readDaemonException_); - throw readDaemonException_; - } - if (unlikelyException_ != null) - { - Trace.log(Trace.ERROR, "Read daemon generated exception:", unlikelyException_); - throw unlikelyException_; - } - int correlationID = newCorrelationId(); - requestStream.setCorrelation(correlationID); - requestStream.write(outStream_); - return correlationID; - } - - final void send(DataStream requestStream, int correlationId) throws IOException - { - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, "send(): send request..."); - requestStream.setConnectionID(connectionID_); - } - if (readDaemonException_ != null) - { - Trace.log(Trace.ERROR, "Read daemon generated exception:", readDaemonException_); - throw readDaemonException_; - } - if (unlikelyException_ != null) - { - Trace.log(Trace.ERROR, "Read daemon generated exception:", unlikelyException_); - throw unlikelyException_; - } - requestStream.setCorrelation(correlationId); - requestStream.write(outStream_); - } - - final void sendAndDiscardReply(DataStream requestStream) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "send and discard(): ..."); - int correlationID = send(requestStream); - discardList_.add(correlationID); - } - - final DataStream sendAndReceive(DataStream requestStream) throws IOException, InterruptedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "send and receive(): ..."); - int correlationID = send(requestStream); - return receive(correlationID); - } - - final synchronized DataStream sendExchangeAttrRequest(DataStream req) throws IOException, InterruptedException - { - if (exchangeAttrReply_ == null) - { - exchangeAttrReply_ = sendAndReceive(req); - } - return exchangeAttrReply_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Time.java b/cvsroot/src/com/ibm/as400/access/AS400Time.java deleted file mode 100644 index 45824be54..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400Time.java +++ /dev/null @@ -1,520 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Time.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2010-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.text.ParseException; -import java.util.Hashtable; - -/** - Provides a converter between a {@link java.sql.Time java.sql.Time} object and an IBM i time value such as "23:59:59" or "11:59 PM". - In the IBM i programming reference, this type is referred to as the "Time Data Type", or DDS data type T. -

        - An IBM i time value simply indicates an hour/minute/second within some (unspecified) 24-hour period, and does not indicate a contextual day, month, year, or time zone. Internally, this class interprets all date- and time-related strings as relative to the GMT time zone. -

        - Suggestion: To avoid confusion and unexpected results when crossing time zones: -
        Whenever creating or interpreting instances of {@link java.sql.Date java.sql.Date}, {@link java.sql.Time java.sql.Time}, or {@link java.sql.Timestamp java.sql.Timestamp}, always assume that the reference time zone for the object is GMT, and avoid using any deprecated methods. If it is necessary to convert date/time values between GMT and other time zones, use methods of Calendar. Rather than using toString() to display the value of a date/time object, use DateFormat.format() after specifying a GMT TimeZone. - For example: - - import java.text.SimpleDateFormat; - java.sql.Time time1; // value to be generated by AS400Time - SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); - // Set the formatter's time zone to GMT. - formatter.setTimeZone(java.util.TimeZone.getTimeZone("GMT-0")); - ... - System.out.println("Time value: " + formatter.format(time1)); - - - @see AS400Timestamp - @see AS400Date - **/ -public class AS400Time extends AS400AbstractTime -{ - static final long serialVersionUID = 4L; - - private java.sql.Time defaultValue_; - private static Hashtable formatsMap_; - - /** The minimum value representable by this date type. - This value represents the time 00:00:00. **/ - public static final java.sql.Time MIN_VALUE = new java.sql.Time(0L); - - private static final long MILLISECONDS_IN_A_DAY = 24*60*60*1000; // milliseconds in 24 hours - - /** The maximum value representable by this date type. - This value represents the time 23:59:59.999. - **/ - public static final java.sql.Time MAX_VALUE = new java.sql.Time(MILLISECONDS_IN_A_DAY - 1); - - /** Format HMS: hh:mm:ss -
        Default separator: ':' **/ - public static final int FORMAT_HMS = 100; // valid separators: { : . , & } - - /** Format ISO: hh.mm.ss -
        Default separator: '.' **/ - public static final int FORMAT_ISO = 101; // valid separators: { . } - - /** Format USA: hh:mm AM or hh:mm PM -
        Default separator: ':' -
        Note: Unlike the other formats, this format has a granularity of minutes rather than seconds. **/ - public static final int FORMAT_USA = 102; // valid separators: { : } - - /** Format EUR: hh.mm.ss -
        Default separator: '.' **/ - public static final int FORMAT_EUR = 103; // valid separators: { . } - - /** Format JIS: hh:mm:ss -
        Default separator: ':' **/ - public static final int FORMAT_JIS = 104; // valid separators: { : } - - - // Note to maintenance programmer: Update these values when adding new formats. - private static final int FORMAT_RANGE_MINIMUM = FORMAT_HMS; - private static final int FORMAT_RANGE_MAXIMUM = FORMAT_JIS; - - - - /** - Constructs an AS400Time object. - Format {@link #FORMAT_ISO FORMAT_ISO} and separator '.' are used. - **/ - public AS400Time() - { - // Note: The default internal format for IBM i time variables is *ISO. - this(FORMAT_ISO); - } - - - /** - Constructs an AS400Time object. - The specified format's default separator is used. - @param format The format for this object. - For a list of valid values, refer to {@link #AS400Time(int,Character) AS400Time(int,Character)}. - **/ - public AS400Time(int format) - { - setFormat(format, defaultSeparatorFor(format)); - } - - - /** - Constructs an AS400Time object. - The specified format's default separator is used. - @param format The format for this object. - Valid values are: -

          -
        • {@link #FORMAT_HMS FORMAT_HMS} -
        • {@link #FORMAT_ISO FORMAT_ISO} -
        • {@link #FORMAT_USA FORMAT_USA} -
        • {@link #FORMAT_EUR FORMAT_EUR} -
        • {@link #FORMAT_JIS FORMAT_JIS} -
        - @param separator The separator character. - Valid values are: - -
          -
        • ' ' (blank) -
        • ':' (colon) -
        • '.' (period) -
        • ',' (comma) -
        • '&' (ampersand) -
        • (null) -
        -
        - A null value indicates "no separator". - Refer to the IBM i programming reference to determine which separator characters are valid with each format. - **/ - public AS400Time(int format, Character separator) - { - setFormat(format, separator); - } - - - // Overrides non-public method of superclass, making it public. - /** - Gets the format of this AS400Time object. - @return format The format for this object. - For a list of possible values, refer to {@link #AS400Time(int,Character) AS400Time(int,Character)}. - **/ - public int getFormat() - { - return super.getFormat(); - } - - - /** - Gets the separator character of this AS400Time object. - @return separator The separator character. - For a list of possible values, refer to {@link #AS400Time(int,Character) AS400Time(int,Character)}. - If the format contains no separators, null is returned. - @see #setFormat(int,Character) - **/ - public Character getSeparator() - { - return super.getSeparator(); - } - - - /** - Sets the format of this AS400Time object. - The specified format's default separator is used. - @param format The format for this object. - For a list of valid values, refer to {@link #AS400Time(int,Character) AS400Time(int,Character)}. - **/ - public void setFormat(int format) - { - super.setFormat(format, defaultSeparatorFor(format)); - } - - - // Method used by TimeFieldDescription. - /** - Sets the format of this AS400Time object. - The specified format's default separator character is used. - @param format The format for this object, expressed as a string. - For a list of valid values, refer to {@link #toFormat(String) toFormat(String)}. - **/ - void setFormat(String format) - { - super.setFormat(toFormat(format)); - } - - - // Method used by TimeFieldDescription. - /** - Sets the separator character of this AS400Time object. - @param separator The separator character. - **/ - void setSeparator(Character separator) - { - super.setSeparator(separator); - } - - - // Overrides non-public method of superclass, making it public. - /** - Sets the format of this AS400Time object. - @param format The format for this object. - For a list of valid values, refer to {@link #AS400Time(int,Character) AS400Time(int,Character)}. - @param separator The separator character. - For a list of valid values, refer to {@link #AS400Time(int,Character) AS400Time(int,Character)}. - A null value indicates "no separator". - Refer to the IBM i programming reference to determine which separator characters are valid with each format. - **/ - public void setFormat(int format, Character separator) - { - super.setFormat(format, separator); - } - - - /** - Sets the format of this AS400Time object. - @param format The format for this object. - For a list of valid values, refer to {@link #AS400Time(int,Character) AS400Time(int,Character)}. - @param separator The separator character. - @deprecated Use {@link #setFormat(int,Character) setFormat(int,Character)} instead. - **/ - public void setFormat(int format, char separator) - { - super.setFormat(format, new Character(separator)); - } - - private static Hashtable getFormatsMap() - { - if (formatsMap_ == null) - { - synchronized (AS400Time.class) - { - if (formatsMap_ == null) - { - formatsMap_ = new Hashtable(12); - formatsMap_.put("HMS", new Integer(FORMAT_HMS)); - formatsMap_.put("ISO", new Integer(FORMAT_ISO)); - formatsMap_.put("USA", new Integer(FORMAT_USA)); - formatsMap_.put("EUR", new Integer(FORMAT_EUR)); - formatsMap_.put("JIS", new Integer(FORMAT_JIS)); - } - } - } - return formatsMap_; - } - - /** - Returns the integer format value that corresponds to specified format name. - If null is specified, the default format (FORMAT_ISO) is returned. - This method is provided for use by the PCML infrastructure. - @param formatName The format name. - Valid values are: - -
          -
        • HMS -
        • ISO -
        • USA -
        • EUR -
        • JIS -
        -
        - @return the format value. For example, if formatName is "ISO", then {@link #FORMAT_ISO FORMAT_ISO} is returned. - **/ - public static int toFormat(String formatName) - { - if (formatName == null || formatName.length() == 0) { - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, "AS400Time.toFormat("+formatName+"): Returning default time format."); - } - return FORMAT_ISO; - } - - Integer formatInt = (Integer)getFormatsMap().get(formatName.trim().toUpperCase()); - - if (formatInt == null) { - throw new ExtendedIllegalArgumentException("format ("+formatName+")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - return formatInt.intValue(); - } - - - // Overrides method of superclass. - /** - Returns a Java object representing the default value of the data type. - @return A {@link java.sql.Time java.sql.Time} object representing time 00:00:00 GMT (on January 1, 1970). - **/ - public Object getDefaultValue() - { - if (defaultValue_ == null) { - defaultValue_ = new java.sql.Time(0L); // 00:00:00 GMT - } - - return defaultValue_; - } - - // Implements abstract method of superclass. - /** - Returns {@link AS400DataType#TYPE_TIME TYPE_TIME}. - @return AS400DataType.TYPE_TIME. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_TIME; - } - - // Implements abstract method of superclass. - /** - Returns the Java class that corresponds with this data type. - @return java.sql.Time.class. - **/ - public Class getJavaType() - { - return java.sql.Time.class; - } - - - // Overrides method of superclass. This allows us to be more specific in the javadoc. - /** - Converts the specified Java object into IBM i format in the specified byte array. - @param javaValue The object corresponding to the data type. It must be an instance of {@link java.sql.Time java.sql.Time}. The range of valid values is {@link #MIN_VALUE MIN_VALUE} through {@link #MAX_VALUE MAX_VALUE}. Year, month, day-of-month, and fractional seconds are disregarded. - @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @return Eight (8), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - return super.toBytes(javaValue, as400Value, offset); - } - - // Implements abstract method of superclass. - /** - Converts the specified IBM i data type to a Java object. - @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @return a {@link java.sql.Time java.sql.Time} object, representing the number of milliseconds into the day. - The reference time zone for the object is GMT. - **/ - public Object toObject(byte[] as400Value, int offset) - { - if (as400Value == null) throw new NullPointerException("as400Value"); - String timeString = getCharConverter().byteArrayToString(as400Value, offset, getLength()); - // Parse the string, and create a java.sql.Time object. - return parse(timeString); - } - - - // Implements abstract method of superclass. - /** - Converts the specified Java object into a String representation that is consistent with the format of this data type. - @param javaValue The object corresponding to the data type. This must be an instance of {@link java.sql.Time java.sql.Time}, and must be within the range representable by this data type. Any timezone context is disregarded. - @return A String representation of the specified value, formatted appropriately for this data type. - **/ - public String toString(Object javaValue) - { - if (javaValue == null) throw new NullPointerException("javaValue"); - java.sql.Time timeObj; - try { timeObj = (java.sql.Time)javaValue; } - catch (ClassCastException e) { - Trace.log(Trace.ERROR, "javaValue is of type " + javaValue.getClass().getName()); - throw e; - } - - return getDateFormatter().format(timeObj); - } - - /** - Converts a string representation of a time, to a Java object. - @param source A time value expressed as a string in the format specified for this AS400Time object. - @return A {@link java.sql.Time java.sql.Time} object representing the specified time. - The reference time zone for the object is GMT. - **/ - public java.sql.Time parse(String source) - { - if (source == null) throw new NullPointerException("source"); - try - { - java.util.Date dateObj = getDateFormatter().parse(source); - return new java.sql.Time(dateObj.getTime()); // argument is "milliseconds into day" - } - catch (Exception e) { - // Assume that the exception is because we got bad input. - Trace.log(Trace.ERROR, e.getMessage(), source); - Trace.log(Trace.ERROR, "Time string is expected to be in format: " + patternFor(getFormat(), getSeparator())); - throw new ExtendedIllegalArgumentException("source ("+source+")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - - /** - Converts the specified HMS representation of a time, to a Java object. - This method is provided for use by the PCML infrastructure; - in particular, when parsing 'init=' values for 'time' data elements. - @param source A time value expressed as a string in format HH:mm:ss. - @return A {@link java.sql.Time java.sql.Time} object representing the specified time. - The reference time zone for the object is GMT. - **/ - public static java.sql.Time parseXsdString(String source) - { - if (source == null) throw new NullPointerException("source"); - try - { - java.util.Date simpleDateObj = getTimeFormatterXSD().parse(source); - return new java.sql.Time(simpleDateObj.getTime()); - } - catch (ParseException e) { - // Assume that the exception is because we got bad input. - Trace.log(Trace.ERROR, e.getMessage(), source); - Trace.log(Trace.ERROR, "Value is expected to be in standard XML Schema 'time' format: " + TIME_PATTERN_XSD); - throw new ExtendedIllegalArgumentException("source ("+source+")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - - /** - Converts the specified Java object into a String representation that is consistent with the format of this data type. - This method is provided for use by the PCML infrastructure. - @param javaValue The object corresponding to the data type. This must be an instance of {@link java.sql.Time java.sql.Time}, and must be within the range specifiable by this data type. - @return The time expressed as a string in format HH:mm:ss. - **/ - public static String toXsdString(Object javaValue) - { - if (javaValue == null) throw new NullPointerException("javaValue"); - java.sql.Time timeObj; - try { timeObj = (java.sql.Time)javaValue; } - catch (ClassCastException e) { - Trace.log(Trace.ERROR, "javaValue is of type " + javaValue.getClass().getName()); - throw e; - } - - return getTimeFormatterXSD().format(timeObj); - } - - // Implements abstract method of superclass. - String patternFor(int format, Character separator) - { - String sep = ( separator == null ? "" : separator.toString()); - switch (format) - { - case FORMAT_USA: - String sep2 = ( sep.equals("") ? "" : " " ); - return "hh" + sep + "mm" + sep2 + "a"; // hh:mm AM hh:mm PM - - default: - return "HH" + sep + "mm" + sep + "ss"; - } - } - - // Implements abstract method of superclass. - Character defaultSeparatorFor(int format) - { - if (!isValidFormat(format)) { - throw new ExtendedIllegalArgumentException("format ("+format+")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - switch (format) - { - case FORMAT_HMS: - case FORMAT_USA: - case FORMAT_JIS: - return COLON; // ':' - - case FORMAT_ISO: - case FORMAT_EUR: - return PERIOD; // '.' - - default: // none of the above formats - // Should never happen. - throw new InternalErrorException(InternalErrorException.UNKNOWN, "Unrecognized format: " + format); - } - } - - // Implements abstract method of superclass. - boolean isValidFormat(int format) - { - return validateFormat(format); - } - - - /** - Validates the specified format value. - This method is provided for use by the PCML infrastructure. - @param format The format. - For a list of valid values, refer to {@link #AS400Time(int,Character) AS400Time(int,Character)}. - @return true if the format is valid; false otherwise. - **/ - public static boolean validateFormat(int format) - { - if (format < FORMAT_RANGE_MINIMUM || format > FORMAT_RANGE_MAXIMUM) return false; - else return true; - } - - /** - Returns the number of bytes occupied on the IBM i system by a field of this type. - This method is provided for use by the PCML infrastructure. - @param format The format. This argument is ignored. - For a list of valid values, refer to {@link #AS400Time(int,Character) AS400Time(int,Character)}. - @param separator The separator character. This argument is ignored. - For a list of valid values, refer to {@link #AS400Time(int,Character) AS400Time(int,Character)}. - @return the number of bytes occupied. - **/ - public static int getByteLength(int format, Character separator) - { - if (separator == null) return 6; // field size (without separators) is 6 bytes - - else return 8; // field size (with separators) is 8 bytes - } - - // Implements abstract method of superclass. - int lengthFor(int format) - { - return getByteLength(format, getSeparator()); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400Timestamp.java b/cvsroot/src/com/ibm/as400/access/AS400Timestamp.java deleted file mode 100644 index 45a605a2b..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400Timestamp.java +++ /dev/null @@ -1,596 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Timestamp.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2010-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.math.BigInteger; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.BitSet; -import java.util.Calendar; -import java.util.Date; -import java.util.TimeZone; - -/** - Provides a converter between a {@link java.sql.Timestamp java.sql.Timestamp} object and an IBM i timestamp value such as "1997-12-31-23.59.59.999999". - In the IBM i programming reference, this type is referred to as the "Timestamp Data Type", or DDS data type Z. -

        - The minimum value for an IBM i timestamp is 0001-01-01-00.00.00.000000, and the maximum value is 9999-12-31-24.00.00.000000. -

        - Note that java.sql.Timestamp values have nanoseconds precision, whereas IBM i timestamp values have only microseconds precision. When converting Timestamp values to IBM i timestamp values, fractional microseconds are rounded to the nearest microsecond. -

        - An IBM i timestamp value simply indicates a year/month/day/hour/minute/second/microsecond, and does not indicate a contextual time zone. Internally, this class interprets all date- and time-related strings as relative to the GMT time zone. -

        - Suggestion: To avoid confusion and unexpected results when crossing time zones: -
        Whenever creating or interpreting instances of {@link java.sql.Date java.sql.Date}, {@link java.sql.Time java.sql.Time}, or {@link java.sql.Timestamp java.sql.Timestamp}, always assume that the reference time zone for the object is GMT, and avoid using any deprecated methods. If it is necessary to convert date/time values between GMT and other time zones, use methods of Calendar. Rather than using toString() to display the value of a date/time object, use DateFormat.format() after specifying a GMT TimeZone. - For example: - - import java.text.SimpleDateFormat; - java.sql.Timestamp timestamp1; // value to be generated by AS400Timestamp - SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); - // Set the formatter's time zone to GMT. - formatter.setTimeZone(java.util.TimeZone.getTimeZone("GMT-0")); - - ... - System.out.println("Timestamp value: " + formatter.format(timestamp1)); - - - @see AS400Date - @see AS400Time - **/ -public class AS400Timestamp extends AS400AbstractTime -{ - // Constants used when processing *DTS timestamp values. - private static final BigInteger ONE_THOUSAND = new BigInteger("1000"); - private static final BigInteger ONE_MILLION = new BigInteger("1000000"); - - // Conversion factor: Microseconds elapsed from [1970-01-01 00:00:00] to [2000-01-01 00:00:00]. We've calculated this value previously. - private static final BigInteger DTS_CONVERSION_FACTOR = new BigInteger("946684800000000"); - private static final String PARSING_PATTERN = "yyyy-MM-dd-HH.mm.ss"; - - private java.sql.Timestamp defaultValue_; - private transient SimpleDateFormat dateFormatterWithMillis_; - - - - /** The standard IBM i timestamp format. -

          -
        • Example: 1997-04-25-23.59.59.999999 -
        • Range of years: 0001-9999 -
        • Default separator: '-' and '.' -
        • Length: 26 bytes -
        • Note: The time zone context is not specified. The time zone for a timestamp field is typically assumed to match that of the IBM i system on which the field resides. -
        - **/ - public static final int FORMAT_DEFAULT = 0; - - - /** Timestamp format *DTS ("Standard Time Format"). -
          -
        • Example: The timestamp value 0x8000000000000000 represents 2000-01-01 00:00:00.000000, in the time zone context of the IBM i system. -
        • Range of years: 1928-2071 -
          (Date range: 1928-07-25 00:00:00.000000 to 2071-05-09 00:00:00.000000) -
        • Default separator: not applicable (no separator) -
        • Length: 8 bytes -
        • Note: The time zone context is the time zone of the IBM i system, rather than GMT. -
          The base date and time for the TOD clock, or the date and time represented by hex value 0x0000000000000000, is August 23, 1928 12:03:06.314752 (in the time zone of the IBM i system). -
        - **/ - static final int FORMAT_DTS = 1; // for internal Toolbox use only - - // From the spec for the QWCCVTDT API: - // "the supported date range [for format *DTS is] from August 25, 1928, 00:00:00.000000 to May 09, 2071, 00:00:00.000000". - - // From the MI instructions spec: - // - // The Standard Time Format [*DTS] is defined as a 64-bit (8-byte) unsigned binary value as follows: - // - // Offset - // Dec Hex Field Name Data Type and Length - // ___ ___ ____________________ ____________________ - // 0 0 Standard Time Format UBin(8) - // 0 0 Time Bits 0-51 (52 bits) - // 0 0 Uniqueness bits Bits 52-63 (12 bits) - // 8 8 --- End --- - // - // - // The time field is a binary number which can be interpreted as a time value in units of 1 microsecond. A binary 1 in bit 51 is equal to 1 microsecond. - // - // The "uniqueness bits" field may contain any combination of binary 1s and 0s. These bits do not provide additional granularity for a time value; they merely allow unique 64-bit values to be returned, such as when the value of the time-of-day (TOD) clock is materialized. When the uniqueness bits all contain binary 0s, then the 64-bit value returned is not unique. Unless explicitly stated otherwise, MI instructions which materialize the TOD clock return a unique 64-bit value. - - - // Design note: According to the IBM i datatype spec: - // "Microseconds (.mmmmmm) are optional for timestamp literals and if not provided will be padded on the right with zeros. Leading zeros are required for all timestamp data." - // For simplicity, we will assume that the "timestamp" fields encountered by the Toolbox, will always occupy exactly 26 bytes on the system, and will always specify microseconds. - - - /** - Constructs an AS400Timestamp object. - **/ - public AS400Timestamp() - { - setFormat(0, HYPHEN); // this data type has only one format - } - - - // Overrides method of superclass. - /** - Returns a Java object representing the default value of the data type. - @return a java.sql.Timestamp object with a value of January 1, 1970, 00:00:00 GMT - **/ - public Object getDefaultValue() - { - // Design note: According to the IBM i datatype spec: - // "The default initialization value for a timestamp is midnight of January 1, 0001 (0001-01-01-00.00.00.000000)." - // However, for simplicity, we will stay consistent with our other "date" classes on the default value, until/unless we get a requirement to do otherwise. - - if (defaultValue_ == null) { - defaultValue_ = new java.sql.Timestamp(0L); // January 1, 1970, 00:00:00.000000 GMT - } - - return defaultValue_; - } - - - // Implements abstract method of superclass. - /** - Returns {@link AS400DataType#TYPE_TIMESTAMP TYPE_TIMESTAMP}. - @return AS400DataType.TYPE_TIMESTAMP. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_TIMESTAMP; - } - - // Implements abstract method of superclass. - /** - Returns the Java class that corresponds with this data type. - @return java.sql.Timestamp.class. - **/ - public Class getJavaType() - { - return java.sql.Timestamp.class; - } - - - // Used by class 'User'. - /** - Sets the format of this AS400Timestamp object. - The specified format's default separator is used. - @param format The format for this object. - Valid values are: -
          -
        • {@link #FORMAT_DEFAULT FORMAT_DEFAULT} -
        • {@link #FORMAT_DTS FORMAT_DTS} -
        - **/ - void setFormat(int format) - { - super.setFormat(format); - } - - - // Overrides method of superclass. This allows us to be more specific in the javadoc. - /** - Converts the specified Java object into IBM i format in the specified byte array. - @param javaValue The object corresponding to the data type. It must be an instance of {@link java.sql.Timestamp java.sql.Timestamp}. - @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - return super.toBytes(javaValue, as400Value, offset); - } - - - // Implements abstract method of superclass. - /** - Converts the specified IBM i data type to a Java object. - @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @return a {@link java.sql.Timestamp java.sql.Timestamp} object corresponding to the data type. - The reference time zone for the object is GMT. - **/ - public Object toObject(byte[] as400Value, int offset) - { - if (as400Value == null) throw new NullPointerException("as400Value"); - java.sql.Timestamp dateObj = null; - - switch (getFormat()) - { - case FORMAT_DEFAULT: - { - String timestampString = getCharConverter().byteArrayToString(as400Value, offset, getLength()); - // Parse the string, and create a java.sql.Timestamp object. - dateObj = parse(timestampString); - break; - } - - - // This format is only used internally by Toolbox classes such as 'User'. - case FORMAT_DTS: - { - // Determine the "elapsed microseconds" value represented by the *DTS value. - // Note that *DTS values, in theory, specify microseconds elapsed since August 23, 1928 12:03:06.314752. - // However, the real reference point is January 1, 2000, 00:00:00.000000, - // which is represented by *DTS value 0x8000000000000000. - - // In the returned *DTS value, only the first 8 bytes are meaningful. - // Of those 8 bytes, only bits 0-51 are used to represent "elapsed microseconds". - - // To prevent sign-extension when we right-shift the bits: - // Copy the first 8 bytes into a 9-byte array, preceded by 0x00. - byte[] bytes9 = new byte[9]; - System.arraycopy(as400Value, offset, bytes9, 1, 8); // right-justify - BigInteger bits0to63 = new BigInteger(bytes9); // bits 0-63 - - // Convert base of date from August 23, 1928 12:03:06.314752 to January 1, 2000, 00:00:00.000000. - byte[] dts2000 = { 0, (byte)0x80, 0,0,0,0,0,0,0 }; // 0x8000000000000000 - BigInteger basedOn2000 = bits0to63.subtract(new BigInteger(dts2000)); - - // Eliminate the "uniqueness bits" (bits 52-63). - // Right-shift 12 bits, without sign-extension, leaving bits 0-51. - BigInteger microsElapsedSince2000 = basedOn2000.shiftRight(12); - - // Convert the above value to "microseconds elapsed since January 1, 1970, 00:00:00". That gets us closer to a value we can use to create a Java timestamp object. - BigInteger microsElapsedSince1970 = microsElapsedSince2000.add(DTS_CONVERSION_FACTOR); - - // Milliseconds elapsed since January 1, 1970, 00:00:00 - long millisSince1970 = microsElapsedSince1970.divide(ONE_THOUSAND).longValue(); // 1 millisec == 1000 microsecs - - dateObj = new java.sql.Timestamp(millisSince1970); // GMT time zone - - // Set the "nanoseconds into the second". - int microsIntoSecond = microsElapsedSince1970.mod(ONE_MILLION).intValue(); - dateObj.setNanos(1000*microsIntoSecond); // 1 microsec == 1000 nanosecs - break; - } - default: // this will never happen - throw new InternalErrorException(InternalErrorException.UNKNOWN, "Unrecognized format: " + getFormat()); - - } - - return dateObj; - } - - - /** - Converts the specified IBM i data type to a Java object. - This method is simply a convenience front-end to the {@link #toObject(byte[]) toObject(byte[])} method. - @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - @return a {@link java.sql.Timestamp java.sql.Timestamp} object corresponding to the data type. - The reference time zone for the object is GMT. - **/ - public java.sql.Timestamp toTimestamp(byte[] as400Value) - { - return (java.sql.Timestamp)toObject(as400Value, 0); - } - - - /** - Converts the specified IBM i data type to a Java object. - This method is simply a convenience front-end to the {@link #toObject(byte[],int) toObject(byte[],int)} method. - @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @return a {@link java.sql.Timestamp java.sql.Timestamp} object corresponding to the data type. - The reference time zone for the object is GMT. - **/ - public java.sql.Timestamp toTimestamp(byte[] as400Value, int offset) - { - return (java.sql.Timestamp)toObject(as400Value, offset); - } - - - /** - Creates a new java.util.Date object representing the Timestamp's nominal value, in the context of the specified time zone. - That is, the timestamp is re-interpreted as if its reference context were the specified time zone. -

        For example, if timestamp represents "2000-01-01-00.00.00.000000 GMT", and timezone specifies CST, then this method will return a java.util.Date object representing "2000-01-01-00.00.00.000000 CST". -

        Note that java.util.Date has milliseconds precision, whereas java.sql.Timestamp has nanoseconds precision. When converting from Timestamp to Date, nanoseconds are rounded to the nearest millisecond. - @param timestamp The timestamp object. - @param timezone The desired reference time zone to assign to the returned Date object. - @return A Date object representing the same nominal timestamp value as represented by timestamp, with time zone context timezone. - **/ - public java.util.Date toDate(java.sql.Timestamp timestamp, TimeZone timezone) - { - if (timestamp == null) throw new NullPointerException("timestamp"); - if (timezone == null) throw new NullPointerException("timezone"); - - // We assume that the default/implied contextual timezone of all Timestamp objects is GMT. - // This is certainly the case for all Timestamp objects created by this class. - if (timezone.equals(TIMEZONE_GMT)) return (Date)timestamp; - - long millisSince1970 = timestamp.getTime(); - int nanosIntoSecond = timestamp.getNanos(); - - // For consistency with the QWCCVTDT API (used by the DateTimeConverter class), round up if fractional milliseconds are 500 microseconds or greater. - int nanosIntoMillisecond = nanosIntoSecond % 1000000; // 1 millisec == 1,000,000 nanosecs - if (nanosIntoMillisecond >= 500000) { // half a millisecond - millisSince1970 += 1; // round up to the next millisecond - } - else {} // truncate the partial milliseconds - - - Date dateObj; - synchronized (this) { - getCalendar().setTimeInMillis(millisSince1970); - dateObj = getCalendar().getTime(); // this object is based in GMT time zone - } - - String dateAsString = getDateFormatterWithMillis(TIMEZONE_GMT).format(dateObj); - - // Create a new Date object in the desired timezone, representing the same timestamp string expression as above. - - // Note: In the US, depending on the year, Daylight Saving Time begins between March 8-14, and ends between November 1-7. Different JVMs may have different understandings of exactly when Daylight Saving Time starts and ends. This may lead to inconsistent setting of the time zone of the returned Date object, on dates that fall in those DST transition periods. - try { - return getDateFormatterWithMillis(timezone).parse(dateAsString); - } - catch (java.text.ParseException e) { // should never happen - Trace.log(Trace.ERROR, e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - } - - - // Implements abstract method of superclass. - /** - Converts the specified Java object into a String representation that is consistent with the format of this data type. - @param javaValue The object corresponding to the data type. This must be an instance of {@link java.sql.Timestamp java.sql.Timestamp}, and must be within the range specifiable by this data type. - @return A String representation of the specified value, formatted appropriately for this data type. - @throws ExtendedIllegalArgumentException if the specified date is outside of the range representable by this data type. - **/ - public String toString(Object javaValue) - { - if (javaValue == null) throw new NullPointerException("javaValue"); - java.sql.Timestamp timestampObj; - try { timestampObj = (java.sql.Timestamp)javaValue; } - catch (ClassCastException e) { - Trace.log(Trace.ERROR, "javaValue is of type " + javaValue.getClass().getName()); - throw e; - } - - // Round up to the next microsecond, if fractional microseconds are 500 nanoseconds or greater. - int nanosIntoSecond = timestampObj.getNanos(); - int microsIntoSecond = nanosIntoSecond/1000; // 1 microsec == 1000 nanosecs - int nanosIntoMicrosecond = nanosIntoSecond % 1000; // remainder - if (nanosIntoMicrosecond >= 500) { // half a microsecond - if (DEBUG) { - System.out.println("AS400Timestamp.toString: Rounding up to next microsecond."); - System.out.println("nanosIntoSecond="+nanosIntoSecond+"; microsIntoSecond="+microsIntoSecond+"; nanosIntoMicrosecond="+nanosIntoMicrosecond); - } - microsIntoSecond += 1; // round up to the next microsecond - // See if the round-up moved us up into the next second. - if (microsIntoSecond > 999999) { - java.sql.Timestamp newObj = new java.sql.Timestamp(timestampObj.getTime() + 1000); // advance to next second up (1 sec == 1000 msecs). - timestampObj = newObj; - microsIntoSecond = 0; - } - } - - // Verify that the 'year' value from the date is within the range of our format. - - int year, era; - synchronized (this) { - Calendar cal = getCalendar(timestampObj); - year = cal.get(Calendar.YEAR); - era = cal.get(Calendar.ERA); - } - if (year < 1 || year > 9999) { - throw new ExtendedIllegalArgumentException("javaValue (year=" + year + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (era == 0) { // we can't represent years BCE - throw new ExtendedIllegalArgumentException("javaValue (era=0)", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - String micros = to6Digits(microsIntoSecond); // prepend zeros as needed - return ( getDateFormatter().format(timestampObj) + "." + micros ); - } - - /** - Converts a string representation of a timestamp, to a Java object. - @param source A timestamp value expressed as a string in standard IBM i {@link #FORMAT_DEFAULT timestamp} format. - @return A {@link java.sql.Timestamp java.sql.Timestamp} object representing the specified timestamp. - The reference time zone for the object is GMT. - **/ - public java.sql.Timestamp parse(String source) - { - if (source == null) throw new NullPointerException("source"); - if (source.length() < 26) { - Trace.log(Trace.ERROR, "Timestamp string is expected to be in format: " + patternFor(getFormat(), getSeparator()) + ".ssssss"); - throw new ExtendedIllegalArgumentException("source ("+source+")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - try - { - // Our SimpleDateFormat formatter doesn't handle microseconds. - // Strip out the fractional seconds before parsing; then re-append them later. - // The default IBM i "timestamp" format is: yyyy-mm-dd-hh.mm.ss.mmmmmm - - // Exclude the fractional seconds for now. - java.util.Date dateObjWithoutMicros = getDateFormatter().parse(source.substring(0,19)); - - // Now add the fractional seconds back in. - int microsIntoSecond = Integer.parseInt(source.substring(20)); // skip the period - java.sql.Timestamp timestampObj = new java.sql.Timestamp(dateObjWithoutMicros.getTime()); - timestampObj.setNanos(1000*microsIntoSecond); // 1 microsec == 1000 nanosecs - return timestampObj; - } - catch (Exception e) { - // Assume that the exception is because we got bad input. - Trace.log(Trace.ERROR, e.getMessage(), source); - Trace.log(Trace.ERROR, "Timestamp string is expected to be in format: " + patternFor(getFormat(), getSeparator()) + ".ssssss"); - throw new ExtendedIllegalArgumentException("source ("+source+")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - /** - Converts the specified ISO representation of a timestamp, to a Java object. - This method is provided for use by the PCML infrastructure. - in particular, when parsing 'init=' values for 'timestamp' data elements. - @param source A timestamp value expressed as a string in format yyyy-MM-ddTHH:mm:ss.SSSSSSSSS. - For example: 2010-01-01T23:59:59.999999999 - @return A {@link java.sql.Timestamp java.sql.Timestamp} object representing the specified timestamp. - The reference time zone for the object is GMT. - **/ - public static java.sql.Timestamp parseXsdString(String source) - { - if (source == null) throw new NullPointerException("source"); - try - { - // First, separate-out the fractional seconds (nanoseconds) at the end of the string, - // leaving something that can be parsed by SimpleDateFormat. - int nanos = 0; - String withoutNanos = source.substring(0,19); // up to the '.' (exclusive) - if (source.length() > 20) - { - StringBuffer fractionalSeconds = new StringBuffer(source.substring(20)); - // Pad with trailing zeros, to 9 digits, so as to specify "number of nanoseconds". - int numZerosToAdd = 9 - fractionalSeconds.length(); - for (int i=0; iyyyy-MM-ddTHH:mm:ss.SSSSSSSSS. - **/ - public static String toXsdString(Object javaValue) - { - if (javaValue == null) throw new NullPointerException("javaValue"); - java.sql.Timestamp timestampObj; - try { timestampObj = (java.sql.Timestamp)javaValue; } - catch (ClassCastException e) { - Trace.log(Trace.ERROR, "javaValue is of type " + javaValue.getClass().getName()); - throw e; - } - - StringBuffer timestampString = new StringBuffer(getTimestampFormatterXSD().format(timestampObj)); - - // Append nanoseconds. - timestampString.append('.'); - timestampString.append(to9Digits(timestampObj.getNanos())); - - return timestampString.toString(); - } - - // Implements abstract method of superclass. - String patternFor(int format, Character separator) - { - // SimpleDateFormat has a "milliseconds" pattern, but no "microseconds" or "nanoseconds" pattern. - // Therefore, to generate a pattern consumable by SimpleDateFormat, we omit the fractional seconds entirely here. We re-append the fractional seconds elsewhere in the code. - return PARSING_PATTERN; - } - - // Implements abstract method of superclass. - Character defaultSeparatorFor(int format) - { - return HYPHEN; - } - - - // Utility method used internally. - private synchronized SimpleDateFormat getDateFormatterWithMillis(TimeZone timezone) - { - if (dateFormatterWithMillis_ == null) { - dateFormatterWithMillis_ = new SimpleDateFormat("yyyy-MM-dd HH.mm.ss.SSS"); - dateFormatterWithMillis_.setTimeZone(timezone); - } - else if (!dateFormatterWithMillis_.getTimeZone().equals(timezone)) { - dateFormatterWithMillis_.setTimeZone(timezone); - } - return dateFormatterWithMillis_; - } - - - // Implements abstract method of superclass. - boolean isValidFormat(int format) - { - return validateFormat(format); - } - - // Validates the specified format value. - static boolean validateFormat(int format) - { - if (format < FORMAT_DEFAULT || format > FORMAT_DTS) return false; - else return true; - } - - - /** Returns the number of bytes occupied on the IBM i system by a field of this type. **/ - static int getByteLength(int format) - { - switch (format) - { - case FORMAT_DTS: - return 8; // field length is 8 bytes - - default: // FORMAT_DEFAULT - return 26; // field length is 26 bytes - } - } - - - // Implements abstract method of superclass. - int lengthFor(int format) - { - return getByteLength(format); - } - - - // Utility method. - // Creates a 6-digit decimal string to represent an integer, prepending 0's as needed. The value must be in the range 0 - 999999. - static final String to6Digits(int value) - { - if (value < 0 || value > 999999) { - throw new InternalErrorException(InternalErrorException.UNKNOWN, "to6Digits("+value+")"); - } - StringBuffer buf = new StringBuffer(Integer.toString(value)); - int zerosToPrepend = 6 - buf.length(); - for (int i=0; i 999999999) { - throw new InternalErrorException(InternalErrorException.UNKNOWN, "to9Digits("+value+")"); - } - StringBuffer buf = new StringBuffer(Integer.toString(value)); - int zerosToPrepend = 9 - buf.length(); - for (int i=0; iNote: According to the DDS specification, BINARY() fields occupy a minimum of 2 bytes of storage in IBM i records. Therefore the behavior of this class is not consistent with the semantics of the IBM i BINARY(1) data type. For that reason, this converter is not yet exploited in PCML, RFML, or XPCML. - @see AS400Bin1 - **/ -public class AS400UnsignedBin1 implements AS400DataType -{ - static final long serialVersionUID = 4L; - - private static final int SIZE = 1; - private static final short MIN_VALUE = 0; - private static final short MAX_VALUE = 255; // 0xFF - private static final short DEFAULT_VALUE = (byte)0; - - /** - * Constructs an AS400UnsignedBin1 object. - **/ - public AS400UnsignedBin1() - { - } - - // Implements method of interface AS400DataType. - /** - * Creates a new AS400UnsignedBin1 object that is identical to the current instance. - * @return The new object. - **/ - public Object clone() - { - try - { - return super.clone(); // Object.clone does not throw exception - } - catch (CloneNotSupportedException e) - { - Trace.log(Trace.ERROR, "Unexpected cloning error", e); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - // Implements method of interface AS400DataType. - /** - * Returns the byte length of the data type. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int getByteLength() - { - return SIZE; - } - - // Implements method of interface AS400DataType. - /** - * Returns a Java object representing the default value of the data type. - * @return The Short object with a value of zero. - **/ - public Object getDefaultValue() - { - return new Short(DEFAULT_VALUE); - } - - // Implements method of interface AS400DataType. - /** - * Returns {@link AS400DataType#TYPE_UBIN1 TYPE_UBIN1}. - * @return AS400DataType.TYPE_UBIN1. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_UBIN1; - } - - // Implements method of interface AS400DataType. - /** - * Returns the Java class that corresponds with this data type. - * @return Short.class. - **/ - public Class getJavaType() - { - return Short.class; - } - - // Implements method of interface AS400DataType. - /** - * Converts the specified Java object to IBM i format. - * @param javaValue The object corresponding to the data type. It must be an instance of Short, and the short must be in the range 0 through 255. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - // Allow this line to throw ClassCastException and NullPointerException. - short shortValue = ((Short)javaValue).shortValue(); - return toBytes(shortValue); - } - - /** - * Converts the specified short to IBM i format. - * @param shortValue The value to be converted to IBM i format. The short must be greater than or equal to zero and representable in one unsigned byte. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(short shortValue) - { - byte[] as400Value = new byte[SIZE]; - toBytes(shortValue, as400Value, 0); - return as400Value; - } - - // Implements method of interface AS400DataType. - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of Short, and the short must be in the range 0 through 255. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value) - { - return toBytes(javaValue, as400Value, 0); - } - - /** - * Converts the specified short shorto IBM i format in the specified byte array. - * @param shortValue The value to be converted to IBM i format. The short must be greater than or equal to zero and representable in one unsigned byte. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(short shortValue, byte[] as400Value) - { - return toBytes(shortValue, as400Value, 0); - } - - // Implements method of interface AS400DataType. - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of Short, and the short must be in the range 0 through 255. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - // Allow this line to throw ClassCastException and NullPointerException. - short shortValue = ((Short)javaValue).shortValue(); - return toBytes(shortValue, as400Value, offset); - } - - /** - * Converts the specified short into IBM i format in the specified byte array. - * @param shortValue The value to be converted to IBM i format. The short must be greater than or equal to zero and representable in one unsigned byte. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(short shortValue, byte[] as400Value, int offset) - { - if (shortValue < MIN_VALUE || shortValue > MAX_VALUE) - { - throw new ExtendedIllegalArgumentException("shortValue (" + String.valueOf(shortValue) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - as400Value[offset] = (byte)(shortValue & 0x00FF); - return SIZE; - } - - // Implements method of interface AS400DataType. - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return A Short object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value) - { - // Allow this line to throw NullPointerException and ArrayIndexOutOfBoundsException. - return new Short(toShort(as400Value, 0)); - } - - // Implements method of interface AS400DataType. - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return A Short object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value, int offset) - { - // Allow this line to throw NullPointerException and ArrayIndexOutOfBoundsException. - return new Short(toShort(as400Value, offset)); - } - - /** - * Converts the specified IBM i data type to a short. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The short corresponding to the data type. - **/ - public short toShort(byte[] as400Value) - { - return toShort(as400Value, 0); - } - - /** - * Converts the specified IBM i data type to a short. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The short corresponding to the data type. - **/ - public short toShort(byte[] as400Value, int offset) - { - // Allow this line to throw NullPointerException and ArrayIndexOutOfBoundsException. - return (short)(0x00FF & as400Value[offset]); // prevent sign-extension - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400UnsignedBin2.java b/cvsroot/src/com/ibm/as400/access/AS400UnsignedBin2.java deleted file mode 100644 index 54b23748c..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400UnsignedBin2.java +++ /dev/null @@ -1,238 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400UnsignedBin2.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The AS400UnsignedBin2 class provides a converter between an Integer object and an unsigned two-byte binary number. - **/ -public class AS400UnsignedBin2 implements AS400DataType -{ - static final long serialVersionUID = 4L; - - private static final int SIZE = 2; - private static final int MIN_VALUE = 0; - private static final int MAX_VALUE = 0xFFFF; - private static final int defaultValue = 0; - - /** - * Constructs an AS400UnsignedBin2 object. - **/ - public AS400UnsignedBin2() - { - } - - /** - * Creates a new AS400UnsignedBin2 object that is identical to the current instance. - * @return The new object. - **/ - public Object clone() - { - try - { - return super.clone(); // Object.clone does not throw exception - } - catch (CloneNotSupportedException e) - { - Trace.log(Trace.ERROR, "Unexpected cloning error", e); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - /** - * Returns the byte length of the data type. - * @return Two (2), the number of bytes in the IBM i representation of the data type. - **/ - public int getByteLength() - { - return SIZE; - } - - /** - * Returns a Java object representing the default value of the data type. - * @return The Integer object with a value of zero. - **/ - public Object getDefaultValue() - { - return new Integer(defaultValue); - } - - /** - * Returns {@link com.ibm.as400.access.AS400DataType#TYPE_UBIN2 TYPE_UBIN2}. - * @return AS400DataType.TYPE_UBIN2. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_UBIN2; - } - - /** - * Returns the Java class that corresponds with this data type. - * @return Integer.class. - **/ - public Class getJavaType() - { - return Integer.class; - } - - /** - * Converts the specified Java object to IBM i format. - * @param javaValue The object corresponding to the data type. It must be an instance of Integer, and the integer must be greater than or equal to zero and representable in two bytes. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - int intValue = ((Integer)javaValue).intValue(); // Allow this line to throw ClassCastException and NullPointerException - if (intValue < MIN_VALUE || intValue > MAX_VALUE) - { - throw new ExtendedIllegalArgumentException("javaValue (" + javaValue.toString() + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - byte[] as400Value = new byte[SIZE]; - BinaryConverter.unsignedShortToByteArray(intValue, as400Value, 0); - return as400Value; - } - - /** - * Converts the specified int to IBM i format. - * @param intValue The value to be converted to IBM i format. The integer must be greater than or equal to zero and representable in two bytes. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(int intValue) - { - if (intValue < MIN_VALUE || intValue > MAX_VALUE) - { - throw new ExtendedIllegalArgumentException("intValue (" + String.valueOf(intValue) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - byte[] as400Value = new byte[SIZE]; - BinaryConverter.unsignedShortToByteArray(intValue, as400Value, 0); - return as400Value; - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of Integer, and the integer must be greater than or equal to zero and representable in two bytes. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return Two (2), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value) - { - int intValue = ((Integer)javaValue).intValue(); // Allow this line to throw ClassCastException and NullPointerException - if (intValue < MIN_VALUE || intValue > MAX_VALUE) - { - throw new ExtendedIllegalArgumentException("javaValue (" + javaValue.toString() + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.unsignedShortToByteArray(intValue, as400Value, 0); - return SIZE; - } - - /** - * Converts the specified int into IBM i format in the specified byte array. - * @param intValue The value to be converted to IBM i format. The integer must be greater than or equal to zero and representable in two bytes. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return Two (2), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(int intValue, byte[] as400Value) - { - if (intValue < MIN_VALUE || intValue > MAX_VALUE) - { - throw new ExtendedIllegalArgumentException("intValue (" + String.valueOf(intValue) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.unsignedShortToByteArray(intValue, as400Value, 0); - return SIZE; - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of Integer, and the integer must be greater than or equal to zero and representable in two bytes. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return Two (2), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - int intValue = ((Integer)javaValue).intValue(); // Allow this line to throw ClassCastException and NullPointerException - if (intValue < MIN_VALUE || intValue > MAX_VALUE) - { - throw new ExtendedIllegalArgumentException("javaValue (" + javaValue.toString() + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.unsignedShortToByteArray(intValue, as400Value, offset); - return SIZE; - } - - /** - * Converts the specified int into IBM i format in the specified byte array. - * @param intValue The value to be converted to IBM i format. The integer must be greater than or equal to zero and representable in two bytes. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return Two (2), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(int intValue, byte[] as400Value, int offset) - { - if (intValue < MIN_VALUE || intValue > MAX_VALUE) - { - throw new ExtendedIllegalArgumentException("intValue (" + String.valueOf(intValue) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.unsignedShortToByteArray(intValue, as400Value, offset); - return SIZE; - } - - /** - * Converts the specified IBM i data type to an int. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The int corresponding to the data type. - **/ - public int toInt(byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - return BinaryConverter.byteArrayToUnsignedShort(as400Value, 0); - } - - /** - * Converts the specified IBM i data type to an int. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The int corresponding to the data type. - **/ - public int toInt(byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - return BinaryConverter.byteArrayToUnsignedShort(as400Value, offset); - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The Integer object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - return new Integer(BinaryConverter.byteArrayToUnsignedShort(as400Value, 0)); - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The Integer object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - return new Integer(BinaryConverter.byteArrayToUnsignedShort(as400Value, offset)); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400UnsignedBin4.java b/cvsroot/src/com/ibm/as400/access/AS400UnsignedBin4.java deleted file mode 100644 index 5b8164970..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400UnsignedBin4.java +++ /dev/null @@ -1,238 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400UnsignedBin4.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The AS400UnsignedBin4 class provides a converter between a Long object and a unsigned four-byte binary number. - **/ -public class AS400UnsignedBin4 implements AS400DataType -{ - static final long serialVersionUID = 4L; - - private static final int SIZE = 4; - private static final long MIN_VALUE = 0; - private static final long MAX_VALUE = 0xFFFFFFFFL; - private static final long defaultValue = 0; - - /** - * Constructs an AS400UnsignedBin4 object. - **/ - public AS400UnsignedBin4() - { - } - - /** - * Creates a new unsigned, binary-four data type that is identical to the current instance. - * @return The new object. - **/ - public Object clone() - { - try - { - return super.clone(); // Object.clone does not throw exception - } - catch (CloneNotSupportedException e) - { - Trace.log(Trace.ERROR, "Unexpected cloning error", e); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - /** - * Returns the byte length of the data type. - * @return Four (4), the number of bytes in the IBM i representation of the data type. - **/ - public int getByteLength() - { - return SIZE; - } - - /** - * Returns a Java object representing the default value of the data type. - * @return The Long object with a value of zero. - **/ - public Object getDefaultValue() - { - return new Long(defaultValue); - } - - /** - * Returns {@link com.ibm.as400.access.AS400DataType#TYPE_UBIN4 TYPE_UBIN4}. - * @return AS400DataType.TYPE_UBIN4. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_UBIN4; - } - - /** - * Returns the Java class that corresponds with this data type. - * @return Long.class. - **/ - public Class getJavaType() - { - return Long.class; - } - - /** - * Converts the specified Java object to IBM i format. - * @param javaValue The object corresponding to the data type. It must be an instance of Long, and the long must be greater than or equal to zero and representable in four bytes. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - long longValue = ((Long)javaValue).longValue(); // Allow this line to throw ClassCastException and NullPointerException - if (longValue < MIN_VALUE || longValue > MAX_VALUE) - { - throw new ExtendedIllegalArgumentException("javaValue (" + javaValue.toString() + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - byte[] as400Value = new byte[SIZE]; - BinaryConverter.unsignedIntToByteArray(longValue, as400Value, 0); - return as400Value; - } - - /** - * Converts the specified long to IBM i format. - * @param longValue The value to be converted to IBM i format. The long must be greater than or equal to zero and representable in four bytes. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(long longValue) - { - if (longValue < MIN_VALUE || longValue > MAX_VALUE) - { - throw new ExtendedIllegalArgumentException("longValue (" + String.valueOf(longValue) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - byte[] as400Value = new byte[SIZE]; - BinaryConverter.unsignedIntToByteArray(longValue, as400Value, 0); - return as400Value; - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of Long, and the long must be greater than or equal to zero and representable in four bytes. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return Four (4), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value) - { - long longValue = ((Long)javaValue).longValue(); // Allow this line to throw ClassCastException and NullPointerException - if (longValue < MIN_VALUE || longValue > MAX_VALUE) - { - throw new ExtendedIllegalArgumentException("javaValue (" + javaValue.toString() + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.unsignedIntToByteArray(longValue, as400Value, 0); - return SIZE; - } - - /** - * Converts the specified long into IBM i format in the specified byte array. - * @param longValue The value to be converted to IBM i format. The long must be greater than or equal to zero and representable in four bytes. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return Four (4), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(long longValue, byte[] as400Value) - { - if (longValue < MIN_VALUE || longValue > MAX_VALUE) - { - throw new ExtendedIllegalArgumentException("longValue (" + String.valueOf(longValue) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.unsignedIntToByteArray(longValue, as400Value, 0); - return SIZE; - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of Long, and the long must be greater than or equal to zero and representable in four bytes. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return Four (4), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - long longValue = ((Long)javaValue).longValue(); // Allow this line to throw ClassCastException and NullPointerException - if (longValue < MIN_VALUE || longValue > MAX_VALUE) - { - throw new ExtendedIllegalArgumentException("javaValue (" + javaValue.toString() + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.unsignedIntToByteArray(longValue, as400Value, offset); - return SIZE; - } - - /** - * Converts the specified long into IBM i format in the specified byte array. - * @param longValue The value to be converted to IBM i format. The long must be greater than or equal to zero and representable in four bytes. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return Four (4), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(long longValue, byte[] as400Value, int offset) - { - if (longValue < MIN_VALUE || longValue > MAX_VALUE) - { - throw new ExtendedIllegalArgumentException("longValue (" + String.valueOf(longValue) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.unsignedIntToByteArray(longValue, as400Value, offset); - return SIZE; - } - - /** - * Converts the specified IBM i data type to a long. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The long corresponding to the data type. - **/ - public long toLong(byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - return BinaryConverter.byteArrayToUnsignedInt(as400Value, 0); - } - - /** - * Converts the specified IBM i data type to a long. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The long corresponding to the data type. - **/ - public long toLong(byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - return BinaryConverter.byteArrayToUnsignedInt(as400Value, offset); - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The Long object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value) - { - // BinaryConverter will throw the ArrayIndexException's - return new Long(BinaryConverter.byteArrayToUnsignedInt(as400Value, 0)); - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The Long object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value, int offset) - { - // BinaryConverter will throw the ArrayIndexException's - return new Long(BinaryConverter.byteArrayToUnsignedInt(as400Value, offset)); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400UnsignedBin8.java b/cvsroot/src/com/ibm/as400/access/AS400UnsignedBin8.java deleted file mode 100644 index 4d766a1ac..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400UnsignedBin8.java +++ /dev/null @@ -1,250 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400UnsignedBin8.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2010-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.math.BigInteger; -import java.util.Arrays; - -/** - Provides a converter between a {@link java.math.BigInteger BigInteger} object and an unsigned eight-byte binary number. - The range of values representable by this data type is 0 through the maximum integer representable as 8 unsigned bytes (0xFFFFFFFFFFFFFFFF). - **/ -public class AS400UnsignedBin8 implements AS400DataType -{ - static final long serialVersionUID = 4L; - - // Design note: A Java 'long' is an 8-byte signed integer, and a 'double' is an 8-byte signed floating-point. But we need an unsigned interpretation of an 8-byte field. Therefore we must use a BigInteger instead of a Double or Long. - - private static final byte[] MAX_VALUE_BYTES = { (byte)0, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF }; - // Specify a leading 0, to prevent interpretation as a (two's-complement) negative number. - - private static final int SIZE = 8; - private static final BigInteger MIN_VALUE = BigInteger.ZERO; - private static final BigInteger MAX_VALUE = new BigInteger(MAX_VALUE_BYTES); - private static final BigInteger DEFAULT_VALUE = BigInteger.ZERO; - - - /** - * Constructs an AS400UnsignedBin8 object. - **/ - public AS400UnsignedBin8() - { - } - - // Implements method of interface AS400DataType. - /** - * Creates a new AS400UnsignedBin8 object that is identical to the current instance. - * @return The new object. - **/ - public Object clone() - { - try - { - return super.clone(); // Object.clone does not throw exception - } - catch (CloneNotSupportedException e) - { - Trace.log(Trace.ERROR, "Unexpected cloning error", e); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - // Implements method of interface AS400DataType. - /** - * Returns the byte length of the data type. - * @return Eight (8), the number of bytes in the IBM i representation of the data type. - **/ - public int getByteLength() - { - return SIZE; - } - - // Implements method of interface AS400DataType. - /** - * Returns a Java object representing the default value of the data type. - * @return {@link java.math.BigInteger#ZERO BigInteger.ZERO} - **/ - public Object getDefaultValue() - { - return DEFAULT_VALUE; - } - - // Implements method of interface AS400DataType. - /** - * Returns {@link AS400DataType#TYPE_UBIN8 TYPE_UBIN8}. - * @return AS400DataType.TYPE_UBIN8. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_UBIN8; - } - - // Implements method of interface AS400DataType. - /** - * Returns the Java class that corresponds with this data type. - * @return BigInteger.class. - **/ - public Class getJavaType() - { - return BigInteger.class; - } - - // Implements method of interface AS400DataType. - /** - * Converts the specified Java object to IBM i format. - * @param javaValue The object corresponding to the data type. It must be an instance of BigInteger, and the BigInteger must be greater than or equal to zero and representable in eight bytes (unsigned). - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - byte[] as400Value = new byte[SIZE]; // initialized to zeros - toBytes(javaValue, as400Value, 0); - return as400Value; - } - - /** - Converts the specified long to IBM i format. - @param longValue The value to be converted to IBM i format. It must be greater than or equal to zero. - @return The IBM i representation of the data type (an 8-byte array). - **/ - public byte[] toBytes(long longValue) - { - byte[] as400Value = new byte[SIZE]; - toBytes(longValue, as400Value, 0); - return as400Value; - } - - // Implements method of interface AS400DataType. - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of BigInteger, and the BigInteger must be greater than or equal to zero and representable in eight bytes (unsigned). - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return Eight (8), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value) - { - return toBytes(javaValue, as400Value, 0); - } - - /** - Converts the specified long into IBM i format in the specified byte array. - @param longValue The value to be converted to IBM i format. It must be greater than or equal to zero. - @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - @return Eight (8), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(long longValue, byte[] as400Value) - { - return toBytes(longValue, as400Value, 0); - } - - // Implements method of interface AS400DataType. - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of BigInteger, and the BigInteger must be greater than or equal to zero and representable in eight bytes (unsigned). - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return Eight (8), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - // Allow this line to throw ClassCastException and NullPointerException. - BigInteger bigIntValue = (BigInteger)javaValue; - if (bigIntValue.compareTo(MIN_VALUE) < 0 || - bigIntValue.compareTo(MAX_VALUE) > 0) - { - throw new ExtendedIllegalArgumentException("javaValue (" + javaValue.toString() + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - // Allow this line to throw ArrayIndexOutOfBoundsException. - Arrays.fill(as400Value, offset, offset+SIZE, (byte)0); // initialize 8 bytes to zeros - byte[] val = bigIntValue.toByteArray(); - - // Handle case where BigInteger.toByteArray() returns an extra leading '0' byte. - if (val.length == SIZE+1 && val[0] == 0) { - byte[] truncated = new byte[SIZE]; - System.arraycopy(val, 1, truncated, 0, SIZE); - val = truncated; - } - - // Right-justify in 8 bytes starting at specified offset. - int startPos = (offset+SIZE) - val.length; - System.arraycopy(val, 0, as400Value, startPos, val.length); - return SIZE; - } - - /** - Converts the specified long into IBM i format in the specified byte array. - @param longValue The value to be converted to IBM i format. It must be greater than or equal to zero. - @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @return Eight (8), the number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(long longValue, byte[] as400Value, int offset) - { - if (longValue < 0) { - throw new ExtendedIllegalArgumentException("longValue (" + longValue + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // BinaryConverter will throw the ArrayIndexException's - BinaryConverter.longToByteArray(longValue, as400Value, offset); - return SIZE; - } - - // Implements method of interface AS400DataType. - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The BigInteger object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value) - { - return toBigInteger(as400Value, 0); - } - - // Implements method of interface AS400DataType. - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The BigInteger object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value, int offset) - { - return toBigInteger(as400Value, offset); - } - - /** - Converts the specified IBM i data type to a BigInteger. - @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - @return The BigInteger corresponding to the data type. - **/ - public BigInteger toBigInteger(byte[] as400Value) - { - return toBigInteger(as400Value, 0); - } - - /** - Converts the specified IBM i data type to a BigInteger. - @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - @return The BigInteger corresponding to the data type. - **/ - public BigInteger toBigInteger(byte[] as400Value, int offset) - { - // Prevent the leading bit being interpreted as a sign bit. - byte nineBytes[] = new byte[SIZE+1]; - nineBytes[0] = 0; - System.arraycopy(as400Value, offset, nineBytes, 1, SIZE); - return new BigInteger(nineBytes); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400XChgRandSeedDS.java b/cvsroot/src/com/ibm/as400/access/AS400XChgRandSeedDS.java deleted file mode 100644 index 7d39577fd..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400XChgRandSeedDS.java +++ /dev/null @@ -1,68 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400XChgRandSeedDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -// A class representing an "exchange random seed" request data stream. -class AS400XChgRandSeedDS extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - AS400XChgRandSeedDS(int serverId) - { - super(new byte[28]); - setLength(28); - // Header ID replaced with Attributes. - data_[4] = 0x01; // Client Attributes, 1 means can use SHA-1. - // data_[5] = 0x00; // Server Attributes. - setServerID(serverId); - // setCSInstance(0x00000000); - // setCorrelation(0x00000000); - setTemplateLen(8); - setReqRepID(0x7001); - - // We generate a "random" seed using the current time in milliseconds. - // This seed will be used to encrypt the password. - long t = System.currentTimeMillis(); - - // Performance: break into 2 ints first and avoid long temporaries. - int high = (int)(t >>> 32); - int low = (int)t; - - data_[20] = (byte)(high >>> 24); - data_[21] = (byte)(high >>> 16); - data_[22] = (byte)(high >>> 8); - data_[23] = (byte)high; - - data_[24] = (byte)(low >>> 24); - data_[25] = (byte)(low >>> 16); - data_[26] = (byte)(low >>> 8); - data_[27] = (byte)low; - } - - byte[] getClientSeed() - { - byte[] seed = new byte[8]; - System.arraycopy(data_, 20, seed, 0, 8); - return seed; - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending exchange random seeds request..."); //@P0C - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400XChgRandSeedReplyDS.java b/cvsroot/src/com/ibm/as400/access/AS400XChgRandSeedReplyDS.java deleted file mode 100644 index 5b0256f47..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400XChgRandSeedReplyDS.java +++ /dev/null @@ -1,74 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400XChgRandSeedReplyDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -// A class representing a reply to an "exchange random seed" request (class AS400XChgRandSeedDS) data stream. -class AS400XChgRandSeedReplyDS extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - /** - Generate a new instance of this type. - @return a reference to the new instance - **/ - public Object getNewDataStream() - { - return new AS400XChgRandSeedReplyDS(); - } - - int getRC() - { - return get32bit(20); - } - - byte[] getServerSeed() - { - byte[] seed = new byte[8]; - System.arraycopy(data_, 24, seed, 0, 8); - return seed; - } - - void read(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving exchange random seeds reply..."); //@P0C - - // Receive the header. - byte[] header = new byte[20]; - if (readFromStream(in, header, 0, 20) < 20) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Failed to read all of the exchange random seeds reply header."); //@P0C - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - - // Allocate bytes for datastream. - data_ = new byte[BinaryConverter.byteArrayToInt(header, 0)]; - System.arraycopy(header, 0, data_, 0, 20); - - // Read in the rest of the data. - readAfterHeader(in); - } - - /** - Generates a hash code for this data stream. - @return the hash code - **/ - public int hashCode() - { - return 0xF001; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AS400ZonedDecimal.java b/cvsroot/src/com/ibm/as400/access/AS400ZonedDecimal.java deleted file mode 100644 index 2d42092f8..000000000 --- a/cvsroot/src/com/ibm/as400/access/AS400ZonedDecimal.java +++ /dev/null @@ -1,501 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400ZonedDecimal.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.math.BigDecimal; -import java.math.BigInteger; - -/** - * The AS400ZonedDecimal class provides a converter between a BigDecimal object and a zoned decimal format floating point number. - **/ -public class AS400ZonedDecimal implements AS400DataType -{ - static final long serialVersionUID = 4L; - - private int digits; - private int scale; - private static final long defaultValue = 0; - private static final boolean HIGH_NIBBLE = AS400PackedDecimal.HIGH_NIBBLE; - private static final boolean LOW_NIBBLE = AS400PackedDecimal.LOW_NIBBLE; - - private boolean useDouble_ = false; - - /** - * Constructs an AS400ZonedDecimal object. - * @param numDigits The number of digits in the zoned decimal number. It must be greater than or equal to one and less than or equal to thirty-one. - * @param numDecimalPositions The number of decimal positions in the zoned decimal number. It must be greater than or equal to zero and less than or equal to numDigits. - */ - public AS400ZonedDecimal(int numDigits, int numDecimalPositions) - { - // check for valid input - if (numDigits < 1 || numDigits > 63) // @M0C - changed the upper limit here from 31 for JDBC support - { - throw new ExtendedIllegalArgumentException("numDigits (" + String.valueOf(numDigits) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (numDecimalPositions < 0 || numDecimalPositions > numDigits) - { - throw new ExtendedIllegalArgumentException("numDecimalPositions (" + String.valueOf(numDecimalPositions) + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - // set instance variables - this.digits = numDigits; - this.scale = numDecimalPositions; - } - - /** - * Creates a new AS400ZonedDecimal object that is identical to the current instance. - * @return The new object. - **/ - public Object clone() - { - try - { - return super.clone(); // Object.clone does not throw exception - } - catch (CloneNotSupportedException e) - { - Trace.log(Trace.ERROR, "Unexpected cloning error", e); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - /** - * Returns the byte length of the data type. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int getByteLength() - { - return this.digits; - } - - /** - * Returns a Java object representing the default value of the data type. - * @return The BigDecimal object with a value of zero. - **/ - public Object getDefaultValue() - { - return BigDecimal.valueOf(defaultValue); - } - - /** - * Returns {@link com.ibm.as400.access.AS400DataType#TYPE_ZONED TYPE_ZONED}. - * @return AS400DataType.TYPE_ZONED. - **/ - public int getInstanceType() - { - return AS400DataType.TYPE_ZONED; - } - - /** - * Returns the Java class that corresponds with this data type. - * @return BigDecimal.class. - **/ - public Class getJavaType() - { - return BigDecimal.class; - } - - /** - * Returns the total number of digits in the zoned decimal number. - * @return The number of digits. - **/ - public int getNumberOfDigits() - { - return this.digits; - } - - /** - * Returns the number of decimal positions in the zoned decimal number. - * @return The number of decimal positions. - **/ - public int getNumberOfDecimalPositions() - { - return this.scale; - } - - /** - * Indicates if a {@link java.lang.Double Double} object or a - * {@link java.math.BigDecimal BigDecimal} object will be returned - * on a call to {@link #toObject toObject()}. - * @return true if a Double will be returned, false if a BigDecimal - * will be returned. The default is false. - **/ - public boolean isUseDouble() - { - return useDouble_; - } - - /** - * Sets whether to return a {@link java.lang.Double Double} object or a - * {@link java.math.BigDecimal BigDecimal} object on a call to - * {@link #toObject toObject()}. - * @see com.ibm.as400.access.AS400PackedDecimal#setUseDouble - **/ - public void setUseDouble(boolean b) - { - useDouble_ = b; - } - - /** - * Converts the specified Java object to IBM i format. - * @param javaValue The object corresponding to the data type. It must be an instance of BigDecimal and the BigDecimal must have a less than or equal to number of digits and a less than or equal to number of decimal places. - * @return The IBM i representation of the data type. - **/ - public byte[] toBytes(Object javaValue) - { - byte[] as400Value = new byte[this.digits]; - this.toBytes(javaValue, as400Value, 0); - return as400Value; - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of BigDecimal and the BigDecimal must have a less than or equal to number of digits and a less than or equal to number of decimal places. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value) - { - return this.toBytes(javaValue, as400Value, 0); - } - - /** - * Converts the specified Java object into IBM i format in the specified byte array. - * @param javaValue The object corresponding to the data type. It must be an instance of BigDecimal and the BigDecimal must have a less than or equal to number of digits and a less than or equal to number of decimal places. - * @param as400Value The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The number of bytes in the IBM i representation of the data type. - **/ - public int toBytes(Object javaValue, byte[] as400Value, int offset) - { - int outDigits = this.digits; - int outDecimalPlaces = this.scale; - - // verify input - BigDecimal inValue = (BigDecimal)javaValue; // Let this line throw ClassCastException - if (inValue.scale() > outDecimalPlaces) // Let this line throw NullPointerException - { - throw new ExtendedIllegalArgumentException("javaValue (" + javaValue.toString() + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - // read the sign - int sign = inValue.signum(); - - // get just the digits from BigDecimal, "normalize" away sign, decimal place etc. - char[] inChars = inValue.abs().movePointRight(outDecimalPlaces).toBigInteger().toString().toCharArray(); - - // Check overall length - int inLength = inChars.length; - if (inLength > outDigits) - { - throw new ExtendedIllegalArgumentException("javaValue (" + javaValue.toString() + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - int inPosition = 0; // position in char[] - - // write correct number of leading zero's - for (int i=0; i Long.MAX_VALUE) - throw new ExtendedIllegalArgumentException("doubleValue", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - // Extract the normalized value. This is the value represented by - // two longs (one for each side of the decimal point). Using longs - // here improves the quality of the algorithm as well as the - // performance of arithmetic operations. We may need to use an - // "effective" scale due to the lack of precision representable - // by a long. - long leftSide = (long)absValue; - int effectiveScale = (scale > 15) ? 15 : scale; - long rightSide = (long)Math.round((absValue - (double)leftSide) * Math.pow(10, effectiveScale)); - - // Ok, now we are done with any double arithmetic! - - // If the effective scale is different than the actual scale, - // then pad with zeros. - int rightmostOffset = offset + digits - 1; - int padOffset = rightmostOffset - (scale - effectiveScale); - for (int i = rightmostOffset; i > padOffset; --i) - as400Value[i] = (byte)0x00F0; - - // Compute the bytes for the right side of the decimal point. - int decimalOffset = rightmostOffset - scale; - int nextDigit; - for (int i = padOffset; i > decimalOffset; --i) { - nextDigit = (int)(rightSide % 10); - as400Value[i] = (byte)(0x00F0 | nextDigit); - rightSide /= 10; - } - - // Compute the bytes for the left side of the decimal point. - for (int i = decimalOffset; i >= offset; --i) { - nextDigit = (int)(leftSide % 10); - as400Value[i] = (byte)(0x00F0 | nextDigit); - leftSide /= 10; - } - - // Fix the sign, if negative. - if (doubleValue < 0) - as400Value[rightmostOffset] = (byte)(as400Value[rightmostOffset] & 0x00DF); - - // If left side still has digits, then the value was too big - // to fit. - if (leftSide > 0) - throw new ExtendedIllegalArgumentException("doubleValue", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - return digits; - } - - // @E0A - /** - * Converts the specified IBM i data type to a Java double value. If the - * decimal part of the value needs to be truncated to be represented by a - * Java double value, then it is rounded towards zero. If the integral - * part of the value needs to be truncated to be represented by a Java - * double value, then it converted to either Double.POSITIVE_INFINITY - * or Double.NEGATIVE_INFINITY. - * - * @param as400Value The array containing the data type in IBM i format. - * The entire data type must be represented. - * @return The Java double value corresponding to the data type. - **/ - public double toDouble(byte[] as400Value) - { - return toDouble(as400Value, 0); - } - - // @E0A - /** - * Converts the specified IBM i data type to a Java double value. If the - * decimal part of the value needs to be truncated to be represented by a - * Java double value, then it is rounded towards zero. If the integral - * part of the value needs to be truncated to be represented by a Java - * double value, then it converted to either Double.POSITIVE_INFINITY - * or Double.NEGATIVE_INFINITY. - * - * @param as400Value The array containing the data type in IBM i format. - * The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. - * It must be greater than or equal to zero. - * @return The Java double value corresponding to the data type. - **/ - public double toDouble(byte[] as400Value, int offset) - { - // Check the offset to prevent bogus NumberFormatException message. - if (offset < 0) - throw new ArrayIndexOutOfBoundsException(String.valueOf(offset)); - - // Compute the value. - double doubleValue = 0; - double multiplier = Math.pow(10, digits - scale - 1); - int rightMostOffset = offset + digits - 1; - for(int i = offset; i <= rightMostOffset; ++i) { - doubleValue += ((byte)(as400Value[i] & 0x000F)) * multiplier; - multiplier /= 10; - } - - // Determine the sign. - switch(as400Value[rightMostOffset] & 0x00F0) { - case 0x00B0: - case 0x00D0: - // Negative. - doubleValue *= -1; - break; - case 0x00A0: - case 0x00C0: - case 0x00E0: - case 0x00F0: - // Positive. - break; - default: - throwNumberFormatException(HIGH_NIBBLE, rightMostOffset, - as400Value[rightMostOffset] & 0x00FF, - as400Value); - } - - return doubleValue; - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @return The BigDecimal object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value) - { - return this.toObject(as400Value, 0); - } - - /** - * Converts the specified IBM i data type to a Java object. - * @param as400Value The array containing the data type in IBM i format. The entire data type must be represented. - * @param offset The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero. - * @return The BigDecimal object corresponding to the data type. - **/ - public Object toObject(byte[] as400Value, int offset) - { - if (useDouble_) return new Double(toDouble(as400Value, offset)); - - // Check offset to prevent bogus NumberFormatException message - if (offset < 0) - { - throw new ArrayIndexOutOfBoundsException(String.valueOf(offset)); - } - - int size = this.digits; - - int outputPosition = 0; // position in char[] - int digitsPlaced = 0; // number of digits moved from input to output - - char[] outputData = null; - // read the sign bit, allow ArrayIndexException to be thrown - int nibble = (as400Value[offset+size-1] & 0xFF) >>> 4; - switch (nibble) - { - case 0x000B: // valid negative sign bits - case 0x000D: - outputData = new char[size+1]; - outputData[outputPosition++] = '-'; - break; - case 0x000A: // valid positive sign bits - case 0x000C: - case 0x000E: - case 0x000F: - outputData = new char[size]; - break; - default: // others invalid - throwNumberFormatException(HIGH_NIBBLE, offset+size-1, - as400Value[offset+size-1] & 0xFF, - as400Value); - } - - // place the digits - while (outputPosition < outputData.length) - { - nibble = as400Value[offset++] & 0x000F; - if (nibble > 0x0009) - throwNumberFormatException(LOW_NIBBLE, offset-1, - as400Value[offset-1] & 0x00FF, - as400Value); - outputData[outputPosition++] = (char)(nibble | 0x0030); - } - - // construct New BigDecimal object - return new BigDecimal(new BigInteger(new String(outputData)), this.scale); - } - - static final void throwNumberFormatException(boolean highNibble, int byteOffset, int byteValue, byte[] fieldBytes) throws NumberFormatException - { - String text; - if (highNibble) { - text = ResourceBundleLoader.getText("EXC_HIGH_NIBBLE_NOT_VALID", Integer.toString(byteOffset), byteToString(byteValue)); - } - else { - text = ResourceBundleLoader.getText("EXC_LOW_NIBBLE_NOT_VALID", Integer.toString(byteOffset), byteToString(byteValue)); - } - Trace.log(Trace.ERROR, "Byte sequence is not valid for a field of type 'zoned decimal':", fieldBytes); - throw new NumberFormatException(text); - } - - private static final String byteToString(int byteVal) - { - int leftDigitValue = (byteVal >>> 4) & 0x0F; - int rightDigitValue = byteVal & 0x0F; - char[] digitChars = new char[2]; - // 0x30 = '0', 0x41 = 'A' - digitChars[0] = leftDigitValue < 0x0A ? (char)(0x30 + leftDigitValue) : (char)(leftDigitValue - 0x0A + 0x41); - digitChars[1] = rightDigitValue < 0x0A ? (char)(0x30 + rightDigitValue) : (char)(rightDigitValue - 0x0A + 0x41); - return new String(digitChars); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/AbstractProxyImpl.java b/cvsroot/src/com/ibm/as400/access/AbstractProxyImpl.java deleted file mode 100644 index 7032a8fa4..000000000 --- a/cvsroot/src/com/ibm/as400/access/AbstractProxyImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AbstractProxyImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; - -// The AbstractProxyImpl class provides a default implementation for the ProxyImpl and ProxyFactoryImpl interfaces. -abstract class AbstractProxyImpl -/*ifdef JDBC40 -extends ToolboxWrapper -endif */ -implements ProxyImpl, ProxyFactoryImpl -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - // Private data. - private String className_; - protected ProxyClientConnection connection_; - protected long pxId_; - - // Called for ProxyFactoryImpl objects: - protected AbstractProxyImpl() - { - } - - // Called for ProxyImpl objects: - protected AbstractProxyImpl(String className) - { - className_ = className; - } - - // From the ProxyImpl interface: - public void construct(ProxyClientConnection connection) - { - connection_ = connection; - try - { - pxId_ = connection_.callConstructor(className_); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - // Cleans up the object. - protected void finalize() throws Throwable - { - connection_.callFinalize(pxId_); - super.finalize(); - } - - // From the ProxyImpl interface: - public long getPxId() - { - return pxId_; - } - - // From the AbstractProxyImpl interface: - public void initialize(long pxId, ProxyClientConnection connection) - { - pxId_ = pxId; - connection_ = connection; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ActionCompletedEvent.java b/cvsroot/src/com/ibm/as400/access/ActionCompletedEvent.java deleted file mode 100644 index 08dc35038..000000000 --- a/cvsroot/src/com/ibm/as400/access/ActionCompletedEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: ActionCompletedEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.EventObject; - -/** - The ActionCompletedEvent class represents an ActionCompleted event. - **/ -public class ActionCompletedEvent extends EventObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - /** - Constructs an ActionCompletedEvent object. It uses the specified source object that completed the action. - @param source The object where the event originated. - **/ - public ActionCompletedEvent(Object source) - { - super(source); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ActionCompletedListener.java b/cvsroot/src/com/ibm/as400/access/ActionCompletedListener.java deleted file mode 100644 index b24048a2a..000000000 --- a/cvsroot/src/com/ibm/as400/access/ActionCompletedListener.java +++ /dev/null @@ -1,28 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: ActionCompletedListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.EventListener; - -/** - The ActionCompletedListener interface provides a listener interface for receiving ActionCompleted events. - **/ -public interface ActionCompletedListener extends EventListener -{ - /** - Invoked when an action has completed. - @param event The action completed event. - **/ - public void actionCompleted(ActionCompletedEvent event); -} diff --git a/cvsroot/src/com/ibm/as400/access/ArabicOption.java b/cvsroot/src/com/ibm/as400/access/ArabicOption.java deleted file mode 100644 index e0b440599..000000000 --- a/cvsroot/src/com/ibm/as400/access/ArabicOption.java +++ /dev/null @@ -1,318 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ArabicOption.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - /** - * This class represents ArabicOption objects and provides initial values - * for each shaping option. - *

        - * Arabic text has some special characters that can be converted to different formats, which are characterized - * by four Arabic options, these options are stored in four Arabic objects. - * These four options constitute an ArabicOptionSet. - *

        - * An ArabicOptionSet object contains a value for each of the four Arabic objects - * which represent the Arabic options. The four options are: - *

          - *
        • Lam-Alef handling (Near, At Begin, At End or Auto) - *
        • Seen handling (Near or Auto) - *
        • Yeh Hamza handling (Near or Auto) - *
        • Tashkeel handling (Keep, Customized At Begin, Customized At End, or Auto) - *
        - * The Arabic options values are pre-defined in this class. Each one represents one - * possible value of one Arabic option. - *

        - * For more information on Arabic Shaping options, see: - * Bidirectional support in IBM SDK: A user guide - * - *

        Multi-threading considerations: There are no multi-threading - * concerns for this class because it only defines static - * final instances. - * - */ - -class ArabicOption -{ -/** -* Lam-Alef option values: -*/ - -/* * - * Value identifying Resize buffer. - *

        - * When converting from visual to implicit code pages, Lam-Alef characters - * are expanded to Lam plus Alef, while when converting from implicit to - * visual code pages, every sequence of Lam followed by Alef is contracted - * to a Lam-ALef character. The buffer is enlarged or reduced as appropriate. - */ - /*public*/ static final ArabicOption LAMALEF_RESIZE_BUFFER - = new ArabicOption(ArabicOptionSet.ILAMALEF_RESIZE_BUFFER, ArabicOptionSet.LAMALEF_MASK); -/** - * Value identifying Near. - *

        - * When converting from visual to implicit code pages, Lam-Alef characters - * are expanded to Lam plus Alef consuming the blank space next to it. - * If no blank space is available, the Lam-Alef character remains as is in - * the Unicode uFExx range. - *

        - * When converting from implicit to visual code pages, Lam plus Alef - * sequences are compressed to a unique Lam-Alef character; the space - * resulting from Lam-Alef compression is positioned next to each - * generated Lam-Alef character. - */ - public static final ArabicOption LAMALEF_NEAR - = new ArabicOption(ArabicOptionSet.ILAMALEF_NEAR, ArabicOptionSet.LAMALEF_MASK); -/** - * Value identifying At Begin. - *

        - * When converting from visual to implicit code pages, Lam-Alef characters - * are expanded to Lam plus Alef consuming a blank space at the absolute - * beginning of the buffer. If no blank space is available, the Lam-Alef - * character remains as is in the Unicode uFExx range. - *

        - * When converting from implicit to visual code pages, Lam plus Alef - * sequences are compressed to a unique Lam-Alef character; the space - * resulting from Lam-Alef compression is positioned at the absolute - * beginning of the buffer. - */ - public static final ArabicOption LAMALEF_ATBEGIN - = new ArabicOption(ArabicOptionSet.ILAMALEF_ATBEGIN, ArabicOptionSet.LAMALEF_MASK); -/** - * Value identifying At End. - *

        - * When converting from visual to implicit code pages, Lam-Alef characters - * are expanded to Lam plus Alef consuming a blank space at the absolute - * end of the buffer. If no blank space is available, the Lam-Alef - * character remains as is in the Unicode uFExx range. - *

        - * When converting from implicit to visual code pages, Lam plus Alef - * sequences are compressed to a unique Lam-Alef character; the space - * resulting from Lam-Alef compression is positioned at the absolute - * end of the buffer. - */ - public static final ArabicOption LAMALEF_ATEND - = new ArabicOption(ArabicOptionSet.ILAMALEF_ATEND, ArabicOptionSet.LAMALEF_MASK); -/** - * Value identifying Auto. - *

        - * When converting from visual to implicit code pages, Lam-Alef characters - * are expanded to Lam plus Alef consuming a blank space at the beginning - * of the buffer with respect to the orientation, i.e. buffer[0] in case - * of left-to-right and buffer[length - 1] in case of right-to-left. - * If no blank space is available, the Lam-Alef - * character remains as is in the Unicode uFExx range. - *

        - * When converting from implicit to visual code pages, Lam plus Alef - * sequences are compressed to a unique Lam-Alef character; the space - * resulting from Lam-Alef compression is positioned at the beginning - * of the buffer with respect to the orientation. - */ - public static final ArabicOption LAMALEF_AUTO - = new ArabicOption(ArabicOptionSet.ILAMALEF_AUTO, ArabicOptionSet.LAMALEF_MASK); - -/** -* Seen option values: -*/ -/** - * Value identifying Near. - *

        - * Conversion from visual to implicit converts final forms of the Seen - * family represented by two characters (the three quarters shape and the - * Tail character) to corresponding final forms represented by one - * character and a space replacing the Tail. This space is positioned next - * to the Seen final form. - *

        - * In conversion from implicit to visual, each final form of characters - * in the Seen family (represented by one character) is converted to the - * the corresponding final form of the Seen family that is represented by - * two characters, consuming the space next to the Seen character. If there - * is no space available, it will be converted to one character only which is - * the three quarters shape Seen. - */ - public static final ArabicOption SEEN_NEAR - = new ArabicOption(ArabicOptionSet.ISEEN_NEAR, ArabicOptionSet.SEEN_MASK); -/* * - * Value identifying At Begin. - *

        - * Conversion from visual to implicit converts final forms of the Seen - * family represented by two characters (the three quarters shape and the - * Tail character) to corresponding final forms represented by one - * character and a space replacing the Tail. The resulting space is moved - * to the absolute beginning of the buffer. - *

        - * In conversion from implicit to visual, each final form of characters - * in the Seen family (represented by one character) is converted to the - * the corresponding final form of the Seen family that is represented by - * two characters, consuming a space at the absolute beginning of the buffer. - */ - /*public*/ static final ArabicOption SEEN_ATBEGIN - = new ArabicOption(ArabicOptionSet.ISEEN_ATBEGIN, ArabicOptionSet.SEEN_MASK); - -/* * - * Value identifying At End. - *

        - * Conversion from visual to implicit converts final forms of the Seen - * family represented by two characters (the three quarters shape and the - * Tail character) to corresponding final forms represented by one - * character and a space replacing the Tail. The resulting space is moved - * to the absolute end of the buffer. - *

        - * In conversion from implicit to visual, each final form of characters - * in the Seen family (represented by one character) is converted to the - * the corresponding final form of the Seen family that is represented by - * two characters, consuming a space at the absolute end of the buffer. - */ - /*public*/ static final ArabicOption SEEN_ATEND - = new ArabicOption(ArabicOptionSet.ISEEN_ATEND, ArabicOptionSet.SEEN_MASK); - -/** - * Value identifying Auto. - *

        - * Same behavior as NEAR for this release - */ - public static final ArabicOption SEEN_AUTO - = new ArabicOption(ArabicOptionSet.ISEEN_AUTO, ArabicOptionSet.SEEN_MASK); - -/** -* Yeh Hamza option values: -*/ -/** - * Value identifying Near. - *

        - * Conversion from visual to implicit converts each Yeh character followed - * by a Hamza character to a Yeh-Hamza character; the space resulting from - * the contraction is positioned next to the Yeh-Hamza character. - *

        - * In conversion from implicit to visual, each Yeh-Hamza character is - * expanded to two characters (Yeh and Hamza), consuming the space located - * next to the original Yeh-Hamza character. If there is no space available, - * it will be converted to one character which is Yeh. - */ - public static final ArabicOption YEHHAMZA_TWO_CELL_NEAR - = new ArabicOption(ArabicOptionSet.IYEHHAMZA_TWO_CELL_NEAR, ArabicOptionSet.YEHHAMZA_MASK); -/* * - * Value identifying At Begin. - *

        - * In conversion from visual to implicit, each Yeh character followed - * by a Hamza character is contracted to a Yeh-Hamza character (one - * character); the resulting space is positioned at the absolute beginning - * of the buffer. - *

        - * In conversion from implicit to visual, each Yeh-Hamza character is - * expanded to two characters (Yeh and Hamza), consuming the space located - * at the absolute beginning of the buffer. - */ - /*public*/ static final ArabicOption YEHHAMZA_TWO_CELL_ATBEGIN - = new ArabicOption(ArabicOptionSet.IYEHHAMZA_TWO_CELL_ATBEGIN, ArabicOptionSet.YEHHAMZA_MASK); - -/* * - * Value identifying At End. - *

        - * In conversion from visual to implicit, each Yeh character followed - * by a Hamza character is contracted to a Yeh-Hamza character (one - * character); the resulting space is positioned at the absolute end - * of the buffer. - *

        - * In conversion from implicit to visual, each Yeh-Hamza character is - * expanded to two characters (Yeh and Hamza), consuming the space located - * at the absolute end of the buffer. - */ - /*public*/ static final ArabicOption YEHHAMZA_TWO_CELL_ATEND - = new ArabicOption(ArabicOptionSet.IYEHHAMZA_TWO_CELL_ATEND, ArabicOptionSet.YEHHAMZA_MASK); -/* * - * Value identifying One cell. - *

        - * In conversion from visual to implicit, each Yeh character followed - * by a Hamza character is contracted to a Yeh-Hamza character (one - * character); the resulting space is positioned next to the generated - * character. - *

        - * In conversion from implicit to visual, each Yeh-Hamza character is - * expanded to two characters (Yeh and Hamza), consuming the space located - * next to the original Yeh-Hamza character. - */ - /*public*/ static final ArabicOption YEHHAMZA_ONE_CELL - = new ArabicOption(ArabicOptionSet.IYEHHAMZA_ONE_CELL, ArabicOptionSet.YEHHAMZA_MASK); - -/** - * Value identifying Auto. - *

        - * Same behavior as NEAR for this release - */ - public static final ArabicOption YEHHAMZA_AUTO - = new ArabicOption(ArabicOptionSet.IYEHHAMZA_AUTO, ArabicOptionSet.YEHHAMZA_MASK); - -/** -* Tashkeel option values: -*/ - -/** - * Value identifying Keep Tashkeel. - *

        - * No special processing is done - */ - public static final ArabicOption TASHKEEL_KEEP - = new ArabicOption(ArabicOptionSet.ITASHKEEL_KEEP, ArabicOptionSet.TASHKEEL_MASK); - -/* * - * Value identifying Customized With Zero Width. - *

        - * All Tashkeel characters are converted to the corresponding non-spacing - * (zero-width) characters. - */ - /*public*/ static final ArabicOption TASHKEEL_CUSTOMIZED_WITHZEROWIDTH - = new ArabicOption(ArabicOptionSet.ITASHKEEL_CUSTOMIZED_WITHZEROWIDTH, ArabicOptionSet.TASHKEEL_MASK); -/* * - * Value identifying Customized With Width. - *

        - * All Tashkeel characters are converted to the corresponding spacing - * characters. This option is not available in case of visual to implicit - * conversion because Tashkeel characters in the Arabic u06xx range all - * represent non-spacing (zero-width) characters. - */ - /*public*/ static final ArabicOption TASHKEEL_CUSTOMIZED_WITHWIDTH - = new ArabicOption(ArabicOptionSet.ITASHKEEL_CUSTOMIZED_WITHWIDTH, ArabicOptionSet.TASHKEEL_MASK); -/** - * Value identifying Customized At Begin. - *

        - * All Tashkeel characters except for Shadda are replaced by spaces. - * The resulting spaces are moved to the absolute beginning of the buffer. - */ - public static final ArabicOption TASHKEEL_CUSTOMIZED_ATBEGIN - = new ArabicOption(ArabicOptionSet.ITASHKEEL_CUSTOMIZED_ATBEGIN, ArabicOptionSet.TASHKEEL_MASK); -/** - * Value identifying Customized At End. - *

        - * All Tashkeel characters except for Shadda are replaced by spaces. - * The resulting spaces are moved to the absolute end of the buffer. - */ - public static final ArabicOption TASHKEEL_CUSTOMIZED_ATEND - = new ArabicOption(ArabicOptionSet.ITASHKEEL_CUSTOMIZED_ATEND, ArabicOptionSet.TASHKEEL_MASK); -/** - * Value identifying Auto. - *

        - * Same behavior as KEEP for this release - */ - public static final ArabicOption TASHKEEL_AUTO - = new ArabicOption(ArabicOptionSet.ITASHKEEL_AUTO, ArabicOptionSet.TASHKEEL_MASK); - - int value; - int mask; - - private ArabicOption(int initValue, int initMask) - { - value = initValue; - mask = initMask; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/ArabicOptionSet.java b/cvsroot/src/com/ibm/as400/access/ArabicOptionSet.java deleted file mode 100644 index 28ac33b49..000000000 --- a/cvsroot/src/com/ibm/as400/access/ArabicOptionSet.java +++ /dev/null @@ -1,484 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ArabicOptionSet.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - /** - * This class represents an ArabicOptionSet object defining the shaping - * attributes to be used during Bidi Layout Transformation process. - * It also defines the available values for each option. - *

        - * Arabic text has some special characters that can be converted to different formats, which are characterized - * by four Bidi options, these options are stored in four Arabic objects. - * These four options constitute an ArabicOptionSet. - *

        - * An ArabicOptionSet object contains a value for each of the four Arabic objects - * which represent the Arabic options. The four options are: - *

          - *
        • Lam-Alef handling (Near, At Begin, At End or Auto) - *
        • Seen handling (Near or Auto) - *
        • Yeh Hamza handling (Near or Auto) - *
        • Tashkeel handling (Keep, Customized At Begin, Customized At End, or Auto) - *
        - * The Arabic options values are pre-defined in this class. Each one represents one - * possible value of one Arabic option. - *

        - * For more information on Arabic Shaping options, see: - * Bidirectional support in IBM SDK: A user guide - * - *

        Multi-threading considerations: There are no multi-threading - * concerns for this class, since it only defines static - * final instances. - * - */ - -class ArabicOptionSet -{ -/** - * Mask to apply on an ArabicOptionSet value to isolate the - * Lam-Alef option - */ - static final int LAMALEF_MASK = 0x0F000000; - -/** - * Value identifying LAMALEF_AUTO - */ - static final int ILAMALEF_AUTO = 0x01000000; -/** - * Value identifying LAMALEF_NEAR - */ - static final int ILAMALEF_NEAR = 0x03000000; -/** - * Value identifying LAMALEF_ATBEGIN - */ - static final int ILAMALEF_ATBEGIN = 0x05000000; -/** - * Value identifying LAMALEF_ATEND - */ - static final int ILAMALEF_ATEND = 0x07000000; -/* * - * Value identifying LAMALEF_RESIZE_BUFEER - */ - static final int ILAMALEF_RESIZE_BUFFER = 0x09000000; - -//------- - -/** - * Mask to apply on an ArabicOptionSet value to isolate the - * Seen option - */ - static final int SEEN_MASK = 0x00700000; - -/** - * Value identifying SEEN_AUTO - */ - static final int ISEEN_AUTO = 0x00100000; -/* * - * Value identifying SEEN_ATBEGIN - */ - static final int ISEEN_ATBEGIN = 0x00300000; -/* * - * Value identifying SEEN_ATEND - */ - static final int ISEEN_ATEND = 0x00500000; -/** - * Value identifying SEEN_NEAR - */ - static final int ISEEN_NEAR = 0x00700000; - -//-------- - -/** - * Mask to apply on an ArabicOptionSet value to isolate the - * Yeh Hamza option - */ - static final int YEHHAMZA_MASK = 0x000F0000; - -/** - * Value identifying YEHHAMZA_AUTO - */ - static final int IYEHHAMZA_AUTO = 0x00010000; -/* * - * Value identifying YEHHAMZA_TWO_CELL_ATBEGIN - */ - static final int IYEHHAMZA_TWO_CELL_ATBEGIN = 0x00030000; -/* * - * Value identifying YEHHAMZA_TWO_CELL_ATEND - */ - static final int IYEHHAMZA_TWO_CELL_ATEND = 0x00050000; -/** - * Value identifying YEHHAMZA_TWO_CELL_NEAR - */ - static final int IYEHHAMZA_TWO_CELL_NEAR = 0x00070000; -/* * - * Value identifying YEHHAMZA_ONE_CELL - */ - static final int IYEHHAMZA_ONE_CELL = 0x00090000; -//-------- - -/** - * Mask to apply on an ArabicOptionSet value to isolate the - * Tashkeel option - */ - static final int TASHKEEL_MASK = 0x00000F00; - -/** - * Value identifying TASHKEEL_AUTO - */ - static final int ITASHKEEL_AUTO = 0x00000100; -/* * - * Value identifying TASHKEEL_CUSTOMIZED_WITHZEROWIDTH - */ - static final int ITASHKEEL_CUSTOMIZED_WITHZEROWIDTH = 0x00000300; -/* * - * Value identifying TASHKEEL_CUSTOMIZED_WITHWIDTH - */ - static final int ITASHKEEL_CUSTOMIZED_WITHWIDTH = 0x00000500; -/** - * Value identifying TASHKEEL_CUSTOMIZED_ATBEGIN - */ - static final int ITASHKEEL_CUSTOMIZED_ATBEGIN = 0x00000700; -/** - * Value identifying TASHKEEL_CUSTOMIZED_ATEND - */ - static final int ITASHKEEL_CUSTOMIZED_ATEND = 0x00000900; -/** - * Value identifying TASHKEEL_KEEP - */ - static final int ITASHKEEL_KEEP = 0x00000B00; - - -// This is the default value for uninitialized ArabicOptionSet. - static final int DEFAULT = ILAMALEF_AUTO | ISEEN_AUTO | - IYEHHAMZA_AUTO | ITASHKEEL_AUTO; - - int value; - -/** - * Constructs an ArabicOptionSet with the default value. - * The default is: - *

        - *  Auto for all options
        - *  
        - */ - public ArabicOptionSet() - { - this.value = DEFAULT; - } - -/** - * Constructs an ArabicOptionSet based on an existing ArabicOptionSet. - * @param set The ArabicOptionSet which is copied. - */ - public ArabicOptionSet(ArabicOptionSet set) - { - this.value = set.value; - } - -/** - * Constructs an ArabicOptionSet from one ArabicOption. The other Arabic - * Options are set to their default. - *

        Example: - *

        - *  ArabicOptionset bdOpts = new ArabicOptionSet(LAMALEF_NEAR);
        - *  
        - * - * @param option The ArabicOption which is explicitly specified. - */ - public ArabicOptionSet(ArabicOption option) - { - this.value = option.value | DEFAULT; - } - -/** - * Constructs an ArabicOptionSet from two ArabicOptions. The other Arabic - * options are set to their default. - *

        Example: - *

        - *  ArabicOptionset bdOpts = new ArabicOptionSet(LAMALEF_NEAR, SEEN_NEAR);
        - *  
        - * - * @param option1 The first ArabicOption which is explicitly specified. - * @param option2 The second ArabicOption which is explicitly specified. - * - * @exception IllegalArgumentException If the arguments conflict or are duplicates. - */ - public ArabicOptionSet(ArabicOption option1, ArabicOption option2) - { - this.value = option1.value; - if ((this.value & option2.value) != 0) throw new IllegalArgumentException(); - this.value |= option2.value | DEFAULT; - } - -/** - * Constructs an ArabicOptionSet from three ArabicOptions. The other Arabic - * option is set to its default. - *

        Example: - *

        - *  ArabicOptionset bdOpts = new ArabicOptionSet(LAMALEF_NEAR, SEEN_NEAR, YEHHAMZA_TWO_CELL_NEAR);
        - *  
        - * - * - * @param option1 The first ArabicOption which is explicitly specified. - * @param option2 The second ArabicOption which is explicitly specified. - * @param option3 The third ArabicOption which is explicitly specified. - * - * @exception IllegalArgumentException If the arguments conflict or are duplicates. - */ - public ArabicOptionSet(ArabicOption option1, ArabicOption option2, ArabicOption option3) - { - this.value = option1.value; - if ((this.value & option2.value) != 0) throw new IllegalArgumentException(); - this.value |= option2.value; - if ((this.value & option3.value) != 0) throw new IllegalArgumentException(); - this.value |= option3.value | DEFAULT; - } - -/** - * Constructs an ArabicOptionSet from four ArabicOptions. - * - * @param option1 The first ArabicOption which is explicitly specified. - * @param option2 The second ArabicOption which is explicitly specified. - * @param option3 The third ArabicOption which is explicitly specified. - * @param option4 The fourth ArabicOption which is explicitly specified. - * - * @exception IllegalArgumentException If the arguments conflict or are duplicates. - */ - public ArabicOptionSet(ArabicOption option1, ArabicOption option2, - ArabicOption option3, ArabicOption option4) - { - this.value = option1.value; - if ((this.value & option2.value) != 0) throw new IllegalArgumentException(); - this.value |= option2.value; - if ((this.value & option3.value) != 0) throw new IllegalArgumentException(); - this.value |= option3.value; - if ((this.value & option4.value) != 0) throw new IllegalArgumentException(); - this.value |= option4.value; - } - -/** - * Constructs an ArabicOptionSet from a char array. - * The content of the array must follow the specification for the "S" and - * "U parts of the BIDI environment variable, as follows: - *
          - *
        • character 1: type of text = I (Implicit) or V (Visual) - *
        • character 2: orientation = L (LTR), R (RTL), C (Contextual LTR) or D (Contextual RTL) - *
        • character 3: swapping = Y (Swapping ON) or N (Swapping OFF) - *
        • character 4: text shaping = N (Nominal), S (Shaped), I (Initial), M (Middle), F (Final) or B (Isolated) - *
        • character 5: numeral shaping = N (Nominal), H (National) or C (Contextual) - *
        • character 6: bidi algorithm = U (Unicode) or R (Roundtrip) - *
        • character 7: Lamalef mode = N (Near), B (At Begin), E (At End) or A (Auto) - *
        • character 8: SeenTail mode = N (Near) or A (Auto) - *
        • character 9: Yeh Hamza mode = N (Near) or A (Auto) - *
        • character 10:Tashkeel mode = K (Keep), B (Customized at Begin), E (Customized at End) or A (Auto) - *
        - *

        Only characters 7 to 10 are used to build the ArabicOptionSet. - *

        - * @param chars character array in Convert parms format. It contains the output options specified in the Bidi - * environment variable - */ - public ArabicOptionSet(char chars[]) - { - - int newValue = DEFAULT; - int len = chars.length; - - while (len > 6) - { - if ('R' == chars[6]) - newValue = (newValue & (~LAMALEF_MASK)) | ILAMALEF_RESIZE_BUFFER; - else if ('N' == chars[6]) - newValue = (newValue & (~LAMALEF_MASK)) | ILAMALEF_NEAR; - else if ('B' == chars[6]) - newValue = (newValue & (~LAMALEF_MASK)) | ILAMALEF_ATBEGIN; - else if ('E' == chars[6]) - newValue = (newValue & (~LAMALEF_MASK)) | ILAMALEF_ATEND; - else if ('A' == chars[6]) - newValue = (newValue & (~LAMALEF_MASK)) | ILAMALEF_AUTO; - - if (len <= 7) break; - - if ('N' == chars[7]) - newValue = (newValue & (~SEEN_MASK)) | ISEEN_NEAR; - else if ('B' == chars[7]) - newValue = (newValue & (~SEEN_MASK)) | ISEEN_ATBEGIN; - else if ('E' == chars[7]) - newValue = (newValue & (~SEEN_MASK)) | ISEEN_ATEND; - else if ('A' == chars[7]) - newValue = (newValue & (~SEEN_MASK)) | ISEEN_AUTO; - - - if (len <= 8) break; - - if ('O' == chars[8]) - newValue = (newValue & (~YEHHAMZA_MASK)) | IYEHHAMZA_ONE_CELL; - else if ('N' == chars[8]) - newValue = (newValue & (~YEHHAMZA_MASK)) | IYEHHAMZA_TWO_CELL_NEAR; - else if ('B' == chars[8]) - newValue = (newValue & (~YEHHAMZA_MASK)) | IYEHHAMZA_TWO_CELL_ATBEGIN; - else if ('E' == chars[8]) - newValue = (newValue & (~YEHHAMZA_MASK)) | IYEHHAMZA_TWO_CELL_ATEND; - else if ('A' == chars[8]) - newValue = (newValue & (~YEHHAMZA_MASK)) | IYEHHAMZA_AUTO; - - if (len <= 9) break; - - if ('K' == chars[9]) - newValue = (newValue & (~TASHKEEL_MASK)) | ITASHKEEL_KEEP; - else if ('Z' == chars[9]) - newValue = (newValue & (~TASHKEEL_MASK)) | ITASHKEEL_CUSTOMIZED_WITHZEROWIDTH; - else if ('W' == chars[9]) - newValue = (newValue & (~TASHKEEL_MASK)) | ITASHKEEL_CUSTOMIZED_WITHWIDTH; - else if ('B' == chars[9]) - newValue = (newValue & (~TASHKEEL_MASK)) | ITASHKEEL_CUSTOMIZED_ATBEGIN; - else if ('E' == chars[9]) - newValue = (newValue & (~TASHKEEL_MASK)) | ITASHKEEL_CUSTOMIZED_ATEND; - else if ('A' == chars[9]) - newValue = (newValue & (~TASHKEEL_MASK)) | ITASHKEEL_AUTO; - - break; - } - - this.value = newValue; - - } - -/** - * Compares two ArabicOptionSets. - * Two ArabicOptionSets are considered equal if they represent the same values - * for the four Arabic options. - * @param other The ArabicOptionSet to compare to this. - * @return true if the ArabicOptionSets are equal, false otherwise. - */ - public boolean equals(Object obj) - { - if (obj == null) return false; - if (obj instanceof ArabicOptionSet) { - ArabicOptionSet other = (ArabicOptionSet) obj; - return ((this.getLamAlefMode() == other.getLamAlefMode()) && - (this.getSeenMode() == other.getSeenMode()) && - (this.getYehHamzaMode() == other.getYehHamzaMode()) && - (this.getTashkeelMode() == other.getTashkeelMode())); - } else { - return false; - } - - } - -/** - * Returns the Lam Alef option from an ArabicOptionSet. - * @return The value of the Lam Alef option. - *

        The expected value is one of LAMALEF_NEAR, LAMALEF_ATBEGIN, LAMALEF_ATEND or LAMALEF_AUTO - */ - public ArabicOption getLamAlefMode() - { - switch(this.value & LAMALEF_MASK) - { - case ILAMALEF_RESIZE_BUFFER: return ArabicOption.LAMALEF_RESIZE_BUFFER; - case ILAMALEF_NEAR: return ArabicOption.LAMALEF_NEAR; - case ILAMALEF_ATBEGIN: return ArabicOption.LAMALEF_ATBEGIN; - case ILAMALEF_ATEND: return ArabicOption.LAMALEF_ATEND; - case ILAMALEF_AUTO: return ArabicOption.LAMALEF_AUTO; - } - return ArabicOption.LAMALEF_ATBEGIN; - } - -/** - * Returns the Seen option from an ArabicOptionSet. - * @return The value of the Seen option. - *

        The expected value is one of SEEN_NEAR or SEEN_AUTO. - */ - public ArabicOption getSeenMode() - { - switch(this.value & SEEN_MASK) - { - case ISEEN_NEAR: return ArabicOption.SEEN_NEAR; - case ISEEN_ATBEGIN: return ArabicOption.SEEN_ATBEGIN; - case ISEEN_ATEND: return ArabicOption.SEEN_ATEND; - case ISEEN_AUTO: return ArabicOption.SEEN_AUTO; - } - return ArabicOption.SEEN_NEAR; - } - -/** - * Returns the Yeh Hamza option from an ArabicOptionSet. - * @return The value of the Yeh Hamza option. - *

        The expected value is one of YEHHAMZA_TWO_CELL_NEAR or YEHHAMZA_AUTO. - */ - public ArabicOption getYehHamzaMode() - { - switch(this.value & YEHHAMZA_MASK) - { - case IYEHHAMZA_TWO_CELL_NEAR: return ArabicOption.YEHHAMZA_TWO_CELL_NEAR; - case IYEHHAMZA_TWO_CELL_ATBEGIN: return ArabicOption.YEHHAMZA_TWO_CELL_ATBEGIN; - case IYEHHAMZA_TWO_CELL_ATEND: return ArabicOption.YEHHAMZA_TWO_CELL_ATEND; - case IYEHHAMZA_ONE_CELL: return ArabicOption.YEHHAMZA_ONE_CELL; - case IYEHHAMZA_AUTO: return ArabicOption.YEHHAMZA_AUTO; - } - return ArabicOption.YEHHAMZA_TWO_CELL_NEAR; - } - -/** - * Returns the Tashkeel option from an ArabicOptionSet. - * @return The value of the Tashkeel option. - *

        The expected value is one of TASHKEEL_KEEP, TASHKEEL_CUSTOMIZED_ATBEGIN, - * TASHKEEL_CUSTOMIZED_ATEND or TASHKEEL_AUTO. - */ - public ArabicOption getTashkeelMode() - { - switch(this.value & TASHKEEL_MASK) - { - case ITASHKEEL_KEEP: return ArabicOption.TASHKEEL_KEEP; - case ITASHKEEL_CUSTOMIZED_WITHZEROWIDTH:return ArabicOption.TASHKEEL_CUSTOMIZED_WITHZEROWIDTH; - case ITASHKEEL_CUSTOMIZED_WITHWIDTH: return ArabicOption.TASHKEEL_CUSTOMIZED_WITHWIDTH; - case ITASHKEEL_CUSTOMIZED_ATBEGIN: return ArabicOption.TASHKEEL_CUSTOMIZED_ATBEGIN; - case ITASHKEEL_CUSTOMIZED_ATEND: return ArabicOption.TASHKEEL_CUSTOMIZED_ATEND; - case ITASHKEEL_AUTO: return ArabicOption.TASHKEEL_AUTO; - } - return ArabicOption.TASHKEEL_KEEP; - } - -/** - * Returns a hashcode for an ArabicOptionSet. - * The hashcode of a ArabicOptionSet is the same as the hashcode of its - * value. - * @return A hashcode value. - */ - public int hashCode() - { - return this.value; - } - -/** - * Sets all Arabic options based on another ArabicOptionSet. - * @param set The ArabicOptionSet which is copied. - */ - public void setAllOptions(ArabicOptionSet set) - { - this.value = set.value; - } - -/** - * Sets a new value for one of the Bidi Options in a set without changing - * the other Arabic Options. - *

        The new value must be one of the pre-defined values for ArabicOption. - * - * @param newoption The new value requested for one of the options. - */ - public void setOneOption(ArabicOption newoption) - { - this.value = (this.value & (~newoption.mask)) | newoption.value; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/ArrayFieldDescription.java b/cvsroot/src/com/ibm/as400/access/ArrayFieldDescription.java deleted file mode 100644 index 8d4516cd7..000000000 --- a/cvsroot/src/com/ibm/as400/access/ArrayFieldDescription.java +++ /dev/null @@ -1,77 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ArrayFieldDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; - -/** - *The ArrayFieldDescription class represents the description of an array of data. - *It allows: - *

          - *
        • The user to describe an array of data. - *
        • The Java program to describe an array of data to the user. - *
        -**/ -public class ArrayFieldDescription extends FieldDescription implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - - /** - *Constructs an ArrayFieldDescription object. - **/ - public ArrayFieldDescription() - { - } - - /** - *Constructs an ArrayFieldDescription object. It uses the specified data type - *and name of the field. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public ArrayFieldDescription(AS400Array dataType, String name) - { - super(dataType, name); - } - - - /** - *Returns the DDS description for the field. - *@return Always null since there is no DDS type corresponding to an array. - **/ - String[] getDDSDescription() - { - return null; - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. - **/ - public void setDataType(AS400Array dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length of the field based on the data type - length_ = dataType.getByteLength(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/BaseDataQueue.java b/cvsroot/src/com/ibm/as400/access/BaseDataQueue.java deleted file mode 100644 index e492eb7ec..000000000 --- a/cvsroot/src/com/ibm/as400/access/BaseDataQueue.java +++ /dev/null @@ -1,785 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BaseDataQueue.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.util.Vector; - -/** - Represents an IBM i data queue object. - **/ -public abstract class BaseDataQueue implements Serializable -{ - private static final String CLASSNAME = "com.ibm.as400.access.BaseDataQueue"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - static final long serialVersionUID = 4L; - - // The system where the data queue is located. - private AS400 system_ = null; - // The full IFS path name of the data queue. - private String path_ = ""; - // The library that contains the data queue. - private String library_ = ""; - // The name of the data queue. - private String name_ = ""; - - // The CCSID to be used for String conversions of entry data. - private int ccsid_ = 0; - // The Converter object for the above CCSID. - private transient Converter dataConverter_ = null; - - // The maximum length of each entry on the data queue. - int maxEntryLength_ = 0; - // Whether information about the origin of each entry is saved. - boolean saveSenderInformation_ = false; - // If entries on the queue are read in LIFO or FIFO order. - boolean FIFO_ = false; // False = LIFO. - // Whether data is forced to auxillary storage. - boolean forceToAuxiliaryStorage_ = false; - // The text description for the data queue. - String description_ = null; - // Whether the attributes of the data queue have been retrieved. - boolean attributesRetrieved_ = false; - - // This variable is used to determine if a connection has been made. - // If so, changes to the queue or system are not allowed. - // If not, changes are allowed. - transient BaseDataQueueImpl impl_ = null; - - // List of data queue event bean listeners. - transient Vector dataQueueListeners_ = null; // Set on first add. - // List of object event bean listeners. - transient Vector objectListeners_ = null; // Set on first add. - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_ = null; // Set on first add. - // List of vetoable change event bean listeners. - private transient VetoableChangeSupport vetoableChangeListeners_ = null; // Set on first add. - - /** - Constructs a BaseDataQueue object. The system and path properties must be set before using any method requiring a connection to the system. - **/ - public BaseDataQueue() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing BaseDataQueue object."); - } - - /** - Constructs a BaseDataQueue object. It uses the specified system and path. - @param system The system object representing the system on which the data queue exists. - @param path The fully qualified integrated file system path name of the data queue. - **/ - public BaseDataQueue(AS400 system, String path) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing BaseDataQueue object, system: " + system + " path: " + path); - - // Check parameters. - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (path == null) - { - Trace.log(Trace.ERROR, "Parameter 'path' is null."); - throw new NullPointerException("path"); - } - QSYSObjectPathName ifs = new QSYSObjectPathName(path, "DTAQ"); - - // Set instance variables. - library_ = ifs.getLibraryName(); - name_ = ifs.getObjectName(); - path_ = path; - system_ = system; - } - - /** - Adds a listener to be notified when a data queue event occurs. -

        Note: Only actions performed via this BaseDataQueue object will fire events to listeners. - Data queue accesses performed by other means (such as by calling system APIs or CL commands) do not fire events to listeners. - @param listener The listener object. - **/ - public void addDataQueueListener(DataQueueListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding data queue listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (dataQueueListeners_ == null) - { - dataQueueListeners_ = new Vector(); - } - dataQueueListeners_.addElement(listener); - } - } - - /** - Adds a listener to be notified when an object event occurs. -

        Note: Only actions performed via this BaseDataQueue object will fire events to listeners. - Data queue accesses performed by other means (such as by calling system APIs or CL commands) do not fire events to listeners. - @param listener The listener object. - **/ - public void addObjectListener(ObjectListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding object listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (objectListeners_ == null) - { - objectListeners_ = new Vector(); - } - objectListeners_.addElement(listener); - } - } - - /** - Adds a listener to be notified when the value of any bound property changes. -

        Note: Only actions performed via this BaseDataQueue object will fire events to listeners. - Data queue accesses performed by other means (such as by calling system APIs or CL commands) do not fire events to listeners. - @param listener The listener object. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Adds a listener to be notified when the value of any constrained property changes. -

        Note: Only actions performed via this BaseDataQueue object will fire events to listeners. - Data queue accesses performed by other means (such as by calling system APIs or CL commands) do not fire events to listeners. - @param listener The listener object. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - } - - // Connects to the system and retrieves queue attributes, if needed. - synchronized void open() throws AS400SecurityException, IOException - { - // Connect to data queue server. - boolean opened = impl_ == null; - chooseImpl(); - if (opened) fireObjectEvent(ObjectEvent.OBJECT_OPENED); - } - - // Connects to the system and retrieves client/server attributes. - synchronized void chooseImpl() throws AS400SecurityException, IOException - { - if (system_ != null) system_.signon(false); - - // Set implementation object if not already set. - if (impl_ == null) - { - // Verify required attributes have been set. - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to data queue server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (path_.length() == 0) - { - Trace.log(Trace.ERROR, "Cannot connect to data queue server before setting path."); - throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - // Have the system object load the appropriate implementation object. - impl_ = (BaseDataQueueImpl)system_.loadImpl3("com.ibm.as400.access.BaseDataQueueImplNative", "com.ibm.as400.access.BaseDataQueueImplRemote", "com.ibm.as400.access.BaseDataQueueImplProxy"); - - // Set the fixed properties in the implementation object. - impl_.setSystemAndPath(system_.getImpl(), path_, name_, library_); - } - } - - /** - Removes all entries from the data queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void clear() throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Clearing data queue."); - open(); - // Send clear request. - impl_.clear(null); - fireDataQueueEvent(DataQueueEvent.DQ_CLEARED); - } - - /** - Deletes the data queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void delete() throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Deleting data queue."); - // Don't go through open, so no open event is signaled. - chooseImpl(); - - // Send delete request. - impl_.delete(); - // Indicate that the existing attribute instance variables are invalid since the data queue no longer exists. If someone re-creates it, it may have different attributes. - attributesRetrieved_ = false; - fireObjectEvent(ObjectEvent.OBJECT_DELETED); - } - - /** - Checks to see if the data queue exists. - @return true if the data queue exists; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - **/ - public boolean exists() throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking data queue existence."); - - // Don't use the cached attributes (in case another app / object deletes the queue). - attributesRetrieved_ = false; - try - { - getMaxEntryLength(); - return true; - } - catch (ObjectDoesNotExistException e) - { - return false; - } - } - - // Fire data queue events. - void fireDataQueueEvent(int id) - { - if (dataQueueListeners_ == null) return; - - Vector targets = (Vector)dataQueueListeners_.clone(); - DataQueueEvent event = new DataQueueEvent(this, id); - for (int i = 0; i < targets.size(); ++i) - { - DataQueueListener target = (DataQueueListener)targets.elementAt(i); - switch (id) - { - case DataQueueEvent.DQ_CLEARED: - target.cleared(event); - break; - case DataQueueEvent.DQ_PEEKED: - target.peeked(event); - break; - case DataQueueEvent.DQ_READ: - target.read(event); - break; - case DataQueueEvent.DQ_WRITTEN: - target.written(event); - break; - } - } - } - - // Fire object events. - void fireObjectEvent(int id) - { - if (objectListeners_ == null) return; - - Vector targets = (Vector)objectListeners_.clone(); - ObjectEvent event = new ObjectEvent(this); - for (int i = 0; i < targets.size(); i++) - { - ObjectListener target = (ObjectListener)targets.elementAt(i); - switch (id) - { - case ObjectEvent.OBJECT_CREATED: - target.objectCreated(event); - break; - case ObjectEvent.OBJECT_DELETED: - target.objectDeleted(event); - break; - case ObjectEvent.OBJECT_OPENED: - target.objectOpened(event); - break; - } - } - } - - /** - Returns the CCSID used for the data in this data queue. - @return The CCSID used for the data in this data queue. If the CCSID has not been set, zero (0) is returned. - **/ - public int getCcsid() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting CCSID:", ccsid_); - return ccsid_; - } - - /** - Returns the text description of the data queue. - @return The text description of the data queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getDescription() throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting description."); - open(); - if (!attributesRetrieved_) - { - retrieveAttributes(); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Description: " + description_); - return description_; - } - - /** - Returns a value that indicates if entries are forced to auxiliary storage. If true, entries are immediately written to permanent storage. If false, written entries may be kept in memory and could be lost in the case of a power outage. - @return true if entries are immediately written to permanent storage; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean getForceToAuxiliaryStorage() throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting force to auxiliary storage."); - open(); - if (!attributesRetrieved_) - { - retrieveAttributes(); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Force to auxiliary storage:", forceToAuxiliaryStorage_); - return forceToAuxiliaryStorage_; - } - - /** - Returns the maximum entry length of the data queue. - @return The maximum entry length of the data queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getMaxEntryLength() throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting max entry length."); - open(); - if (!attributesRetrieved_) - { - retrieveAttributes(); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Max entry length:", maxEntryLength_); - return maxEntryLength_; - } - - /** - Returns the name of the data queue. - @return The data queue name, or an empty string ("") if not set. - **/ - public String getName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting name: " + name_); - return name_; - } - - /** - Returns the full integrated file system path name of the data queue. - @return The fully-qualified data queue name, or an empty string ("") if not set. - **/ - public String getPath() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting path: " + path_); - return path_; - } - - /** - Returns whether sender information is stored with each data queue entry. - @return true if sender information is saved; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean getSaveSenderInformation() throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting save sender information."); - open(); - if (!attributesRetrieved_) - { - retrieveAttributes(); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Save sender information:", saveSenderInformation_); - return saveSenderInformation_; - } - - /** - Returns the system object representing the system on which the data queue exists. - @return The system object representing the system on which the data queue exists. If the system has not been set, null is returned. - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - /** - Returns a value that indicates if entries are read in FIFO order. Returns true if entries are read off the data queue in FIFO order. Returns false if entries are read off the data queue in LIFO order. - @return true if entries are read off the data queue in FIFO order; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isFIFO() throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if data queue is FIFO."); - open(); - if (!attributesRetrieved_) - { - retrieveAttributes(); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "FIFO:", FIFO_); - return FIFO_; - } - - /** - Refreshes the attributes of the data queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void refreshAttributes() throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Refreshing data queue attributes."); - attributesRetrieved_ = false; - open(); - retrieveAttributes(); - } - - /** - Removes a data queue listener. - @param listener The listener object. - **/ - public void removeDataQueueListener(DataQueueListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing data queue listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (dataQueueListeners_ != null) - { - dataQueueListeners_.removeElement(listener); - } - } - - /** - Removes a object listener. - @param listener The listener object. - **/ - public void removeObjectListener(ObjectListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing object listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (objectListeners_ != null) - { - objectListeners_.removeElement(listener); - } - } - - /** - Removes a property change listener. - @param listener The listener object. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes a vetoable change listener. - @param listener The listener object. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - // Refreshes the attributes of the data queue. - abstract void retrieveAttributes() throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException; - - /** - Sets the CCSID to use for the data in this data queue. - @param ccsid The CCSID to use for the data in this data queue. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setCcsid(int ccsid) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting CCSID:", ccsid); - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - ccsid_ = ccsid; - dataConverter_ = null; // Converter no longer points to correct ccsid. - } - else - { - Integer oldValue = new Integer(ccsid_); - Integer newValue = new Integer(ccsid); - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("ccsid", oldValue, newValue); - } - - ccsid_ = ccsid; - dataConverter_ = null; // Converter no longer points to correct ccsid. - - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("ccsid", oldValue, newValue); - } - } - } - - /** - Sets the fully qualified integrated file system path name of the data queue. - @param path The fully qualified integrated file system path name of the data queue. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setPath(String path) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting path: " + path); - - // Check parameter. - if (path == null) - { - Trace.log(Trace.ERROR, "Parameter 'path' is null."); - throw new NullPointerException("path"); - } - - // Make sure we have not already connected. - if (impl_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property 'path' after connect."); - throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // Verify name is valid IFS path name. - QSYSObjectPathName ifs = new QSYSObjectPathName(path, "DTAQ"); - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - // Set instance variables. - library_ = ifs.getLibraryName(); - name_ = ifs.getObjectName(); - path_ = path; - } - else - { - String oldValue = path_; - String newValue = path; - - // Ask for any vetos. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("path", oldValue, newValue); - } - - // Set instance variables. - library_ = ifs.getLibraryName(); - name_ = ifs.getObjectName(); - path_ = path; - - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("path", oldValue, newValue); - } - } - } - - /** - Sets the system object representing the system on which the data queue exists. - @param system The system object representing the system on which the data queue exists. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem(AS400 system) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system: " + system); - - // Check parameter. - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - - // Make sure we have not already connected. - if (impl_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - // Set instance variable. - system_ = system; - } - else - { - AS400 oldValue = system_; - AS400 newValue = system; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("system", oldValue, newValue); - } - - // Set instance variable. - system_ = system; - - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("system", oldValue, newValue); - } - } - } - - /** - Returns the String representation of this data queue object. - @return The String representation of this data queue object. - **/ - public String toString() - { - return "(system: " + system_ + " path: "+ path_ + "):" + super.toString(); - } - - // Get the CCSID to be used for this data queue, get it from the system object if not already set. - private int getCcsidToUse() - { - if (ccsid_ == 0) return system_.getCcsid(); - return ccsid_; - } - - byte[] stringToByteArray(String string) throws IOException - { - if (dataConverter_ == null) dataConverter_ = new Converter(getCcsidToUse(), system_); - return dataConverter_.stringToByteArray(string); - } - - String byteArrayToString(byte[] bytes) throws UnsupportedEncodingException - { - if (dataConverter_ == null) dataConverter_ = new Converter(getCcsidToUse(), system_); - return dataConverter_.byteArrayToString(bytes); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/BaseDataQueueBeanInfo.java b/cvsroot/src/com/ibm/as400/access/BaseDataQueueBeanInfo.java deleted file mode 100644 index ebf4cb7ab..000000000 --- a/cvsroot/src/com/ibm/as400/access/BaseDataQueueBeanInfo.java +++ /dev/null @@ -1,138 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BaseDataQueueBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.BeanDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - The BaseDataQueueBeanInfo class provides bean information for the BaseDataQueue class. - **/ -public class BaseDataQueueBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class BEAN_CLASS = BaseDataQueue.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - EventSetDescriptor dataQueue = new EventSetDescriptor(BEAN_CLASS, "dataQueue", DataQueueListener.class, new String[] { "cleared", "peeked", "read", "written" }, "addDataQueueListener", "removeDataQueueListener"); - dataQueue.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_DQ_DATA_EVENT")); - dataQueue.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_DQ_DATA_EVENT")); - - EventSetDescriptor object = new EventSetDescriptor(BEAN_CLASS, "object", ObjectListener.class, new String[] { "objectCreated", "objectDeleted", "objectOpened" }, "addObjectListener", "removeObjectListener"); - object.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_DQ_OBJECT_EVENT")); - object.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_DQ_OBJECT_EVENT")); - - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - - eventSetDescriptors = new EventSetDescriptor[] { dataQueue, object, propertyChange, vetoableChange }; - - PropertyDescriptor path = new PropertyDescriptor("path", BEAN_CLASS); - path.setBound(true); - path.setConstrained(true); - path.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_PATH")); - path.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_PATH")); - - PropertyDescriptor name = new PropertyDescriptor("name", BEAN_CLASS, "getName", null); - name.setBound(false); - name.setConstrained(false); - name.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_NAME")); - name.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_NAME")); - - PropertyDescriptor system = new PropertyDescriptor("system", BEAN_CLASS); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - - PropertyDescriptor ccsid = new PropertyDescriptor("ccsid", BEAN_CLASS, "getCcsid", null); - ccsid.setBound(true); - ccsid.setConstrained(true); - ccsid.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_AS400_CCSID")); - ccsid.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_AS400_CCSID")); - - propertyDescriptors = new PropertyDescriptor[] { path, name, system, ccsid }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return Zero (0), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "dataQueue" event. - return 0; - } - - /** - Returns the index of the default property. - @return Zero (0), the index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // The index for the "path" property. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/BaseDataQueueImpl.java b/cvsroot/src/com/ibm/as400/access/BaseDataQueueImpl.java deleted file mode 100644 index f8b277ef0..000000000 --- a/cvsroot/src/com/ibm/as400/access/BaseDataQueueImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BaseDataQueueImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -// Interface that supports native, remote, and proxy implementations of data queues. -interface BaseDataQueueImpl -{ - // Set needed implementation properties. - void setSystemAndPath(AS400Impl system, String path, String name, String library) throws IOException; - // Provide an implementation of clear, key is null, if not a keyed clear. - void clear(byte[] key) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException; - // Provide an implementation of create, keyLength == 0 means non-keyed queue. - void create(int maxEntryLength, String authority, boolean saveSenderInformation, boolean FIFO, int keyLength, boolean forceToAuxiliaryStorage, String description) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectAlreadyExistsException, ObjectDoesNotExistException; - // Provide an implementation of delete. - void delete() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException; - // Provide an implementation of read, boolean peek determines peek or read, key is null for non-keyed queues, returns the entry read, or null if no entries on the queue. - DQReceiveRecord read(String search, int wait, boolean peek, byte[] key) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException; - // Provide an implementation of retrieve attributes, keyed is false for non-keyed queues. - DQQueryRecord retrieveAttributes(boolean keyed) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException; - // Provide an implementation of write, key is null for non-keyed queues. - void write(byte[] key, byte[] data) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException; -} diff --git a/cvsroot/src/com/ibm/as400/access/BaseDataQueueImplNative.java b/cvsroot/src/com/ibm/as400/access/BaseDataQueueImplNative.java deleted file mode 100644 index 48ecc68c7..000000000 --- a/cvsroot/src/com/ibm/as400/access/BaseDataQueueImplNative.java +++ /dev/null @@ -1,339 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BaseDataQueueImplNative.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -// Native implementation of data queues. -class BaseDataQueueImplNative extends BaseDataQueueImplRemote -{ - private static final String CLASSNAME = "com.ibm.as400.access.BaseDataQueueImplNative"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - static - { - NativeMethods.loadNativeLibraryQyjspart(); - } - - private String name_; - private String library_; - - // Set needed impl properties. - public void setSystemAndPath(AS400Impl system, String path, String name, String library) throws IOException - { - super.setSystemAndPath(system, path, name, library); - name_ = name; - library_ = library; - } - - // Native implementation of clear. - // If key is null, do non-keyed clear. - public void clear(byte[] key) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - // Call native method. - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - if (key == null) - { - clearNative(libraryBytes_, queueNameBytes_); - } - else - { - clearKeyNative(libraryBytes_, queueNameBytes_, key); - } - } - catch (NativeException e) // Exception found by C code. - { - throw buildException(key != null, e); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - } - - // Native implementation of create. - // KeyLength == 0 means non-keyed queue. - public void create(int maxEntryLength, String authority, boolean saveSenderInformation, boolean FIFO, int keyLength, boolean forceToAuxiliaryStorage, String description) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectAlreadyExistsException, ObjectDoesNotExistException - { - // Build command string. - String command = "QSYS/CRTDTAQ DTAQ(" + library_ + "/" + name_ + ") TYPE(*STD) MAXLEN(" + maxEntryLength + ") FORCE(" + (forceToAuxiliaryStorage ? "*YES" : "*NO") + ") SEQ(" + (keyLength == 0 ? FIFO ? "*FIFO" : "*LIFO" : "*KEYED) KEYLEN(" + keyLength) + ") SENDERID(" + (saveSenderInformation ? "*YES" : "*NO") + ") TEXT('" + description + "') AUT(" + authority + ")"; - - // Convert command to EBCDIC bytes. - byte[] commandBytes = converter_.stringToByteArray(command); - - // Call native method. - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - createNative(commandBytes); - } - catch (NativeException e) // Exception found by C code. - { - String id = converter_.byteArrayToString(e.data, 12, 7); - if (id.equals("CPF9870")) // Object already exists. - { - throw new ObjectAlreadyExistsException(path_, ObjectAlreadyExistsException.OBJECT_ALREADY_EXISTS); - } - throw buildException(e); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - } - - // Native implementation of delete. - public void delete() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - // Build command string. - String command = "QSYS/DLTDTAQ DTAQ("+ library_ + "/"+ name_ + ")"; - - // Convert to ebcdic bytes. - byte[] commandBytes = converter_.stringToByteArray(command); - - // Call native method. - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - deleteNative(commandBytes); - } - catch (NativeException e) // Exception found by C code. - { - throw buildException(e); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - } - - // Native implementation of read for data queues. - // Key == null means non-keyed queue. - // Boolean peek determines peek or read. - // Returns The entry read, or null if no entries on the queue. - public DQReceiveRecord read(String search, int wait, boolean peek, byte[] key) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - // Convert parameters to EBCDIC bytes. - byte[] searchBytes = (key == null) ? new byte[2] : converter_.stringToByteArray(search); - - // Copy to new key in case found key is different that provided key. - byte[] newKey = null; - if (key != null) - { - newKey = new byte[key.length]; - System.arraycopy(key, 0, newKey, 0, key.length); - } - - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - DQQueryRecord qr = retrieveAttributes(key != null); - if (qr.saveSenderInformation_) - { - // Call native methods with sender info. - byte[] senderBytes = new byte[36]; - byte[] data = (key == null) ? peek ? peekSenderNative(libraryBytes_, queueNameBytes_, wait, senderBytes) : readSenderNative(libraryBytes_, queueNameBytes_, wait, senderBytes) : peek ? peekKeyedSenderNative(libraryBytes_, queueNameBytes_, wait, searchBytes, newKey, senderBytes) : readKeyedSenderNative(libraryBytes_, queueNameBytes_, wait, searchBytes, newKey, senderBytes); - if (data.length == 0) return null; - return new DQReceiveRecord(converter_.byteArrayToString(senderBytes), data, newKey); - } - // Call native methods with out sender info. - byte[] data = (key == null) ? peek ? peekNative(libraryBytes_, queueNameBytes_, wait) : readNative(libraryBytes_, queueNameBytes_, wait) : peek ? peekKeyedNative(libraryBytes_, queueNameBytes_, wait, searchBytes, newKey) : readKeyedNative(libraryBytes_, queueNameBytes_, wait, searchBytes, newKey); - if (data.length == 0) return null; - return new DQReceiveRecord(null, data, newKey); - } - catch (NativeException e) // Exception found by C code. - { - throw buildException(key != null, e); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - } - - // Native implementation for retrieve attributes. - // Keyed is false for non-keyed queues. - public DQQueryRecord retrieveAttributes(boolean keyed) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - byte[] attributes = new byte[61]; - - // Call native method. - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - retrieveAttributesNative(libraryBytes_, queueNameBytes_, attributes); - } - catch (NativeException e) // Exception found in C code. - { - throw buildException(e); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - - // Verify data queue type and set attribute. - DQQueryRecord ret = new DQQueryRecord(); - if (keyed) - { - if (attributes[8] != (byte)0xD2) // Actual data queue is not a keyed data queue. - { - Trace.log(Trace.ERROR, "Using KeyedDataQueue for non-keyed data queue."); - throw new IllegalObjectTypeException(IllegalObjectTypeException.DATA_QUEUE_NOT_KEYED); - } - ret.FIFO_ = true; // Keyed queues always FIFO. - } - else - { - if (attributes[8] == (byte)0xC6) // FIFO. - { - ret.FIFO_ = true; - } - else if (attributes[8] == (byte)0xD3) // LIFO. - { - ret.FIFO_ = false; - } - else // Queue is keyed and this is not a KeyedDataQueue object; error. - { - Trace.log(Trace.ERROR, "Using DataQueue for keyed data queue."); - throw new IllegalObjectTypeException(IllegalObjectTypeException.DATA_QUEUE_KEYED); - } - } - - // Set attributes based on returned info. - ret.maxEntryLength_ = BinaryConverter.byteArrayToInt(attributes, 0); - ret.saveSenderInformation_ = attributes[9] == (byte)0xD5 ? false : true; - ret.forceToAuxiliaryStorage_ = attributes[10] == (byte)0xD5 ? false : true; - ret.description_ = converter_.byteArrayToString(attributes, 11, 50); - ret.keyLength_ = BinaryConverter.byteArrayToInt(attributes, 4); - return ret; - } - - // Native implementation for write. - // Key is null for non-keyed queues. - public void write(byte[] key, byte[] data) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - // Call native method. - if (key == null) - { - writeNative(libraryBytes_, queueNameBytes_, data); - } - else - { - writeKeyNative(libraryBytes_, queueNameBytes_, key, data); - } - } - catch (NativeException e) // Exception detected in C code. - { - throw buildException(key != null, e); - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - } - - // Return or throw an exception based on the data received from the native method. - // This function returns an AS400Exception and throw all others. - private AS400Exception buildException(NativeException e) throws AS400SecurityException, ObjectDoesNotExistException - { - // Parse information from byte array. - String id = converter_.byteArrayToString(e.data, 12, 7); - - int substitutionDataLength = BinaryConverter.byteArrayToInt(e.data, 80); - int textLength = BinaryConverter.byteArrayToInt(e.data, 88); - - String text = converter_.byteArrayToString(e.data, 112 + substitutionDataLength, textLength); - - if (id.equals("CPF9801") || // Object &2 in library &3 not found. - id.equals("CPF2105") || // Object &1 in &2 type *&3 not found. - id.equals("CPF9805")) // Object &2 in library &3 destroyed. - { - throw new ObjectDoesNotExistException(path_, ObjectDoesNotExistException.OBJECT_DOES_NOT_EXIST); - } - if (id.equals("CPF9810")) // Library &1 not found. - { - throw new ObjectDoesNotExistException(path_, ObjectDoesNotExistException.LIBRARY_DOES_NOT_EXIST); - } - if (id.equals("CPF9802") || // Not authorized to object &2 in &3. - id.equals("CPF2189")) // Not authorized to object &1 in &2 type *&3. - { - throw new AS400SecurityException(path_, AS400SecurityException.OBJECT_AUTHORITY_INSUFFICIENT); - } - if (id.equals("CPF9820") || // Not authorized to use library &1. - id.equals("CPF2182")) // Not authorized to library &1. - { - throw new AS400SecurityException(path_, AS400SecurityException.LIBRARY_AUTHORITY_INSUFFICIENT); - } - AS400Message msg = new AS400Message(id, text); - msg.setType((e.data[19] & 0x0F) * 10 + (e.data[20] & 0x0F)); - msg.setSeverity(BinaryConverter.byteArrayToInt(e.data, 8)); - return new AS400Exception(msg); - } - - // Build Exception as above, plus detect object type mismatch. - private AS400Exception buildException(boolean expectKeyed, NativeException e) throws AS400SecurityException, IllegalObjectTypeException, ObjectDoesNotExistException - { - // Parse information from byte array. - String id = converter_.byteArrayToString(e.data, 12, 7); - - if (expectKeyed && id.equals("CPF9502")) - { - Trace.log(Trace.ERROR, "Using KeyedDataQueue for non-keyed data queue: " + path_); - throw new IllegalObjectTypeException(path_, IllegalObjectTypeException.DATA_QUEUE_NOT_KEYED); - } - if (!expectKeyed && id.equals("CPF9506")) - { - Trace.log(Trace.ERROR, "Using DataQueue for keyed data queue: " + path_); - throw new IllegalObjectTypeException(path_, IllegalObjectTypeException.DATA_QUEUE_KEYED); - } - return buildException(e); - } - - private native void clearNative(byte[] library, byte[] name) throws NativeException; - private native void clearKeyNative(byte[] library, byte[] name, byte[] key) throws NativeException; - private native void createNative(byte[] command) throws NativeException; - private native void deleteNative(byte[] command) throws NativeException; - private native byte[] peekKeyedSenderNative(byte[] library, byte[] name, int wait, byte[] search, byte[] key, byte[] sender) throws NativeException; - private native byte[] readKeyedSenderNative(byte[] library, byte[] name, int wait, byte[] search, byte[] key, byte[] sender) throws NativeException; - private native byte[] peekKeyedNative(byte[] library, byte[] name, int wait, byte[] search, byte[] key) throws NativeException; - private native byte[] readKeyedNative(byte[] library, byte[] name, int wait, byte[] search, byte[] key) throws NativeException; - private native byte[] peekSenderNative(byte[] library, byte[] name, int wait, byte[] sender) throws NativeException; - private native byte[] readSenderNative(byte[] library, byte[] name, int wait, byte[] sender) throws NativeException; - private native byte[] peekNative(byte[] library, byte[] name, int wait) throws NativeException; - private native byte[] readNative(byte[] library, byte[] name, int wait) throws NativeException; - private native void retrieveAttributesNative(byte[] library, byte[] name, byte[] attributes) throws NativeException; - private native void writeNative(byte[] library, byte[] name, byte[] data) throws NativeException; - private native void writeKeyNative(byte[] library, byte[] name, byte[] key, byte[] data) throws NativeException; -} diff --git a/cvsroot/src/com/ibm/as400/access/BaseDataQueueImplProxy.java b/cvsroot/src/com/ibm/as400/access/BaseDataQueueImplProxy.java deleted file mode 100644 index 98e5a5672..000000000 --- a/cvsroot/src/com/ibm/as400/access/BaseDataQueueImplProxy.java +++ /dev/null @@ -1,144 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BaseDataQueueImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - -// Proxy implementation of data queues. -class BaseDataQueueImplProxy extends AbstractProxyImpl implements BaseDataQueueImpl -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - BaseDataQueueImplProxy() - { - super("BaseDataQueue"); - } - - // Get the implementation properties to the ProxyServer. - public void setSystemAndPath(AS400Impl system, String path, String name, String library) throws IOException - { - try - { - connection_.callMethod(pxId_, "setSystemAndPath", new Class[] { AS400Impl.class, String.class, String.class, String.class }, new Object[] { system, path, name, library }); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow1(e); - } - } - - // Proxy implementation of clear, if key is null, do non-keyed clear. - public void clear(byte[] key) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - try - { - connection_.callMethod(pxId_, "clear", new Class[] { byte[].class }, new Object[] { key }); - } - catch (InvocationTargetException e) - { - // Throw an appropriate exception. - Throwable target = e.getTargetException(); - if (target instanceof IllegalObjectTypeException) - { - throw (IllegalObjectTypeException)target; - } - throw ProxyClientConnection.rethrow5(e); - } - } - - // Proxy implementation of create, keyLength == 0 means non-keyed queue. - public void create(int maxEntryLength, String authority, boolean saveSenderInformation, boolean FIFO, int keyLength, boolean forceToAuxiliaryStorage, String description) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectAlreadyExistsException, ObjectDoesNotExistException - { - try - { - connection_.callMethod(pxId_, "create", new Class[] { Integer.TYPE, String.class, Boolean.TYPE, Boolean.TYPE, Integer.TYPE, Boolean.TYPE, String.class }, new Object[] { new Integer(maxEntryLength), authority, new Boolean(saveSenderInformation), new Boolean(FIFO), new Integer(keyLength), new Boolean(forceToAuxiliaryStorage), description }); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow6(e); - } - } - - // Proxy implementaion of delete. - public void delete() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - try - { - connection_.callMethod(pxId_, "delete"); - } - catch (InvocationTargetException e) - { - // Throw an appropriate exception. - throw ProxyClientConnection.rethrow5(e); - } - } - - // Proxy implementation of read for data queues. - public DQReceiveRecord read(String search, int wait, boolean peek, byte[] key) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - try - { - return (DQReceiveRecord)connection_.callMethod(pxId_, "read", new Class[] { String.class, Integer.TYPE, Boolean.TYPE, byte[].class }, new Object[] { search, new Integer(wait), new Boolean(peek), key }, true).getReturnValue(); - } - catch (InvocationTargetException e) - { - // Throw an appropriate exception. - Throwable target = e.getTargetException(); - if (target instanceof IllegalObjectTypeException) - { - throw (IllegalObjectTypeException)target; - } - throw ProxyClientConnection.rethrow5(e); - } - } - - // Proxy implementation for retrieve attributes, keyed is false for non-keyed queues. - public DQQueryRecord retrieveAttributes(boolean keyed) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - try - { - return (DQQueryRecord)connection_.callMethod(pxId_, "retrieveAttributes", new Class[] { Boolean.TYPE }, new Object[] { new Boolean(keyed) }).getReturnValue(); - } - catch (InvocationTargetException e) - { - // Throw an appropriate exception. - Throwable target = e.getTargetException(); - if (target instanceof IllegalObjectTypeException) - { - throw (IllegalObjectTypeException)target; - } - throw ProxyClientConnection.rethrow5(e); - } - } - - // Proxy implementation for write, key is null for non-keyed queues. - public void write(byte[] key, byte[] data) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - try - { - connection_.callMethod(pxId_, "write", new Class[] { byte[].class, byte[].class }, new Object[] { key, data }); - } - catch (InvocationTargetException e) - { - // Throw an appropriate exception. - Throwable target = e.getTargetException(); - if (target instanceof IllegalObjectTypeException) - { - throw (IllegalObjectTypeException)target; - } - throw ProxyClientConnection.rethrow5(e); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/BaseDataQueueImplRemote.java b/cvsroot/src/com/ibm/as400/access/BaseDataQueueImplRemote.java deleted file mode 100644 index ee464cd8e..000000000 --- a/cvsroot/src/com/ibm/as400/access/BaseDataQueueImplRemote.java +++ /dev/null @@ -1,458 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BaseDataQueueImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -class BaseDataQueueImplRemote implements BaseDataQueueImpl -{ - // Identify all data queue reply data streams. - static - { - AS400Server.addReplyStream(new DQExchangeAttributesNormalReplyDataStream(), AS400.DATAQUEUE); - AS400Server.addReplyStream(new DQRequestAttributesNormalReplyDataStream(), AS400.DATAQUEUE); - AS400Server.addReplyStream(new DQCommonReplyDataStream(), AS400.DATAQUEUE); - AS400Server.addReplyStream(new DQReadNormalReplyDataStream(), AS400.DATAQUEUE); - } - - AS400ImplRemote system_; - private AS400Server server_ = null; // The server job that processes requests. - String path_; - ConverterImplRemote converter_; - byte[] queueNameBytes_ = { (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40 }; - byte[] libraryBytes_ = { (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40 }; - - // Set needed implementation properties. - public void setSystemAndPath(AS400Impl system, String path, String name, String library) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting up implementation object: " + path); - system_ = (AS400ImplRemote)system; - path_ = path; - - converter_ = ConverterImplRemote.getConverter(system_.getCcsid(), system_); - converter_.stringToByteArray(name, queueNameBytes_); - converter_.stringToByteArray(library, libraryBytes_); - } - - // Remote implementation of connect. Exchanges client/server attributes with the data queue server. - private void open() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - // Connect to server. - server_ = system_.getConnection(AS400.DATAQUEUE, false); - - // Exchange attributes with server job. (This must be first exchange with server job to complete initialization.) First check to see if server has already been initialized by another user. - synchronized (server_) // Close the window between getting and checking if exchange has been done. - { - DataStream baseReply = server_.getExchangeAttrReply(); - if (baseReply == null) - { - try - { - baseReply = server_.sendExchangeAttrRequest(new DQExchangeAttributesDataStream()); - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "IOException during exchange attributes:", e); - system_.disconnectServer(server_); - throw e; - } - - switch (baseReply.hashCode()) - { - case 0x8000: // DQExchangeAttributesNormalReplyDataStream. - // Means request completed OK. - return; // Exchange attributes succeeded. - case 0x8002: // DQCommonReplyDataStream. - Trace.log(Trace.ERROR, "Unexpected reply datastream:", baseReply.data_); - system_.disconnectServer(server_); - // Throw an appropriate exception. - DQCommonReplyDataStream reply = (DQCommonReplyDataStream)baseReply; - throw buildException(reply.getRC(), reply.getMessage()); - default: // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown exchange attributes reply datastream:", baseReply.data_); - system_.disconnectServer(server_); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - } - } - - // Remote implementation of clear, if key is null, do non-keyed clear. - public void clear(byte[] key) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - // Connect to the data queue server. - open(); - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Processing clear: " + path_); - DQClearDataStream request = new DQClearDataStream(queueNameBytes_, libraryBytes_, key); - - try - { - DataStream baseReply = server_.sendAndReceive(request); - switch (baseReply.hashCode()) - { - case 0x8002: // DQCommonReplyDataStream. - DQCommonReplyDataStream reply = (DQCommonReplyDataStream)baseReply; - int rc = reply.getRC(); - if (rc != 0xF000) - { - // Throw an appropriate exception. - throw buildException(key != null, rc, reply.getMessage()); - } - break; - default: // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown clear reply datastream:", baseReply.data_); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Lost connection to data queue server:", e); - system_.disconnectServer(server_); - throw e; - } - } - - // Remote implementation of create, keyLength == 0 means non-keyed queue. - public void create(int maxEntryLength, String authority, boolean saveSenderInformation, boolean FIFO, int keyLength, boolean forceToAuxiliaryStorage, String description) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectAlreadyExistsException, ObjectDoesNotExistException - { - // Connect to the data queue server. - open(); - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Processing create: " + path_); - byte[] descriptionBytes = {(byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40}; - converter_.stringToByteArray(description, descriptionBytes); - - DQCreateDataStream request = new DQCreateDataStream(queueNameBytes_, libraryBytes_, maxEntryLength, authority, saveSenderInformation, FIFO, keyLength, forceToAuxiliaryStorage, descriptionBytes); - - try - { - DataStream baseReply = server_.sendAndReceive(request); - switch (baseReply.hashCode()) - { - case 0x8002: // DQCommonReplyDataStream. - DQCommonReplyDataStream reply = (DQCommonReplyDataStream)baseReply; - int rc = reply.getRC(); - if (rc != 0xF000) - { - // Throw an appropriate exception. - if (rc == 0xF001 && converter_.byteArrayToString(reply.getMessage(), 0, 7).equals("CPF9870")) - { - Trace.log(Trace.ERROR, "Data queue already exists: " + path_); - throw new ObjectAlreadyExistsException(path_, ObjectAlreadyExistsException.OBJECT_ALREADY_EXISTS); - } - throw buildException(rc, reply.getMessage()); // General errors. - } - break; - default: // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown create reply datastream:", baseReply.data_); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Lost connection to data queue server:", e); - system_.disconnectServer(server_); - throw e; - } - } - - // Remote implementaion of delete. - public void delete() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - // Connect to the data queue server. - open(); - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Processing delete: " + path_); - DQDeleteDataStream request = new DQDeleteDataStream(queueNameBytes_, libraryBytes_); - - try - { - DataStream baseReply = server_.sendAndReceive(request); - switch (baseReply.hashCode()) - { - case 0x8002: // DQCommonReplyDataStream. - DQCommonReplyDataStream reply = (DQCommonReplyDataStream)baseReply; - int rc = reply.getRC(); - if (rc != 0xF000) - { - // Throw an appropriate exception. - throw buildException(rc, reply.getMessage()); - } - break; - default: // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown delete reply datastream:", baseReply.data_); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Lost connection to data queue server:", e); - system_.disconnectServer(server_); - throw e; - } - } - - // Remote implementation of read for data queues, key == null means non-keyed queue, boolean peek determines peek or read, returns the entry read, or null if no entries on the queue. - public DQReceiveRecord read(String search, int wait, boolean peek, byte[] key) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - // Connect to the data queue server. - open(); - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Processing read: " + path_); - byte[] searchBytes = (key == null) ? new byte[2] : converter_.stringToByteArray(search); - DQReadDataStream request = new DQReadDataStream(queueNameBytes_, libraryBytes_, searchBytes, wait, peek, key); - - try - { - DataStream baseReply = server_.sendAndReceive(request); - switch (baseReply.hashCode()) - { - case 0x8003: // DQReadNormalReplyDataStream. - DQReadNormalReplyDataStream reply = (DQReadNormalReplyDataStream)baseReply; - byte[] senderInformationBytes = reply.getSenderInformation(); - return new DQReceiveRecord(senderInformationBytes[0] == 0x40 ? null : converter_.byteArrayToString(senderInformationBytes), reply.getEntry(), reply.getKey()); - case 0x8002: // DQCommonReplyDataStream. - DQCommonReplyDataStream commonReply = (DQCommonReplyDataStream)baseReply; - int rc = commonReply.getRC(); - if (rc == 0xF006) // No data to return. - { - Trace.log(Trace.INFORMATION, "No entry on data queue."); - return null; - } - // Throw an appropriate exception. - throw buildException(key != null, rc, commonReply.getMessage()); // General errors. - default: // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown read reply datastream ", baseReply.data_); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Lost connection to data queue server:", e); - system_.disconnectServer(server_); - throw e; - } - } - - // Remote implementation for retrieve attributes, keyed is false for non-keyed queues - public DQQueryRecord retrieveAttributes(boolean keyed) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - // Connect to the data queue server. - open(); - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Processing retrieve attributes: " + path_); - DataStream request = new DQRequestAttributesDataStream(queueNameBytes_, libraryBytes_); - - try - { - DataStream baseReply = server_.sendAndReceive(request); - switch (baseReply.hashCode()) - { - case 0x8001: // DQRequestAttributesNormalReplyDataStream. - DQRequestAttributesNormalReplyDataStream reply = (DQRequestAttributesNormalReplyDataStream)baseReply; - int type = reply.getType(); - DQQueryRecord record = new DQQueryRecord(); - if (keyed) - { - if (type != 2) // Actual data queue is not a keyed data queue. - { - Trace.log(Trace.ERROR, "Using KeyedDataQueue for non-keyed data queue: " + path_); - throw new IllegalObjectTypeException(path_, IllegalObjectTypeException.DATA_QUEUE_NOT_KEYED); - } - record.FIFO_ = true; // Keyed queues always FIFO. - } - else - { - if (type == 0) - { - record.FIFO_ = true; - } - else if (type == 1) - { - record.FIFO_ = false; - } - else // Queue is keyed and this is not a KeyedDataQueue object. - { - Trace.log(Trace.ERROR, "Using DataQueue for keyed data queue: " + path_); - throw new IllegalObjectTypeException(path_, IllegalObjectTypeException.DATA_QUEUE_KEYED); - } - } - record.maxEntryLength_ = reply.getMaxEntryLength(); - record.saveSenderInformation_ = reply.getSaveSenderInformation(); - record.forceToAuxiliaryStorage_ = reply.getForceToAuxiliaryStorage(); - record.description_ = converter_.byteArrayToString(reply.getDescription()); - record.keyLength_ = reply.getKeyLength(); - return record; - case 0x8002: // DQCommonReplyDataStream. - DQCommonReplyDataStream commonReply = (DQCommonReplyDataStream)baseReply; - // Throw an appropriate exception. - throw buildException(commonReply.getRC(), commonReply.getMessage()); // General errors. - default: // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown retrieve attributes reply datastream:", baseReply.data_); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Lost connection to data queue server:", e); - system_.disconnectServer(server_); - throw e; - } - } - - // Remote implementation for write, key is null for non-keyed queues. - public void write(byte[] key, byte[] data) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - // Connect to the data queue server. - open(); - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Processing write: " + path_); - DQWriteDataStream request = new DQWriteDataStream(queueNameBytes_, libraryBytes_, key, data); - - try - { - DataStream baseReply = server_.sendAndReceive(request); - switch (baseReply.hashCode()) - { - case 0x8002: // DQCommonReplyDataStream. - DQCommonReplyDataStream reply = (DQCommonReplyDataStream)baseReply; - int rc = reply.getRC(); - if (rc != 0xF000) - { - // Throw an appropriate exception. - throw buildException(key != null, rc, reply.getMessage()); - } - break; - default: // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown write reply datastream:", baseReply.data_); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Lost connection to data queue server:", e); - system_.disconnectServer(server_); - throw e; - } - } - - // Returns or throws the appropriate exception based on the return code and error message arguments. - // rc The return code from reply data stream. - // messageBytes The Message from the reply data stream. - // This function returns an AS400Exception and throws all others. - private AS400Exception buildException(int rc, byte[] messageBytes) throws AS400SecurityException, ErrorCompletingRequestException, ObjectDoesNotExistException - { - switch (rc) - { - case 0xF001: // Command check. - { - if (messageBytes == null) - { - Trace.log(Trace.ERROR, "Error completing data queue request, rc: 0xF001"); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.UNKNOWN, rc + ":"); - } - String messageID = converter_.byteArrayToString(messageBytes, 0, 7); - String message = converter_.byteArrayToString(messageBytes); - Trace.log(Trace.ERROR, "Error completing data queue request: " + message); - if (messageID.equals("CPF9810")) - { - Trace.log(Trace.ERROR, "Library does not exist: '" + converter_.byteArrayToString(libraryBytes_) + "'"); - throw new ObjectDoesNotExistException(path_, ObjectDoesNotExistException.LIBRARY_DOES_NOT_EXIST); - } - if (messageID.equals("CPF9801") || messageID.equals("CPF2105")) - { - throw new ObjectDoesNotExistException(path_, ObjectDoesNotExistException.OBJECT_DOES_NOT_EXIST); - } - if (messageID.equals("CPF9802") || messageID.equals("CPF2189")) - { - throw new AS400SecurityException(path_, AS400SecurityException.OBJECT_AUTHORITY_INSUFFICIENT); - } - if (messageID.equals("CPF9820") || messageID.equals("CPF2182")) - { - throw new AS400SecurityException(path_, AS400SecurityException.LIBRARY_AUTHORITY_INSUFFICIENT); - } - return new AS400Exception(new AS400Message(messageID, message.substring(9))); - } - case 0xF002: // Protocol error. - Trace.log(Trace.ERROR, "Data queue protocol error."); - throw new InternalErrorException(InternalErrorException.PROTOCOL_ERROR); - case 0xF003: // Syntax error. - Trace.log(Trace.ERROR, "Data queue syntax error."); - throw new InternalErrorException(InternalErrorException.SYNTAX_ERROR); - case 0xF004: // Queue destroyed. - Trace.log(Trace.ERROR, "Data queue has been destroyed."); - throw new ObjectDoesNotExistException(path_, ObjectDoesNotExistException.OBJECT_DOES_NOT_EXIST); - case 0xF005: // Unsupported queue length. - Trace.log(Trace.ERROR, "Unsupported length."); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.LENGTH_NOT_VALID); - case 0xF007: // Invalid data stream level. - Trace.log(Trace.ERROR, "Data queue data stream level not valid."); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_LEVEL_NOT_VALID); - case 0xF008: // Invalid version/release/modification. - Trace.log(Trace.ERROR, "Data queue VRM not valid."); - throw new InternalErrorException(InternalErrorException.VRM_NOT_VALID); - case 0xF009: // Request rejected by user exit program. - Trace.log(Trace.ERROR, "Exit program rejected request."); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.EXIT_PROGRAM_DENIED_REQUEST); - case 0xF00A: // Exit program not authorized. - Trace.log(Trace.ERROR, "Exit program not authorized."); - throw new AS400SecurityException(AS400SecurityException.EXIT_PROGRAM_NOT_AUTHORIZED); - case 0xF00B: // Exit program not found. - Trace.log(Trace.ERROR, "Exit program not found."); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.EXIT_PROGRAM_NOT_FOUND); - case 0xF00D: // User exit program failed. - Trace.log(Trace.ERROR, "Exit program error."); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.EXIT_PROGRAM_ERROR); - case 0xF00E: // Invalid number of exit programs. - Trace.log(Trace.ERROR, "Exit program number not valid."); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.EXIT_PROGRAM_NUMBER_NOT_VALID); - default: - { - byte[] rcBytes = new byte[2]; - BinaryConverter.unsignedShortToByteArray(rc, rcBytes, 0); - if (messageBytes == null) - { - Trace.log(Trace.ERROR, "Error completing data queue request, rc:", rcBytes); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.UNKNOWN, rc + ":"); - } - String message = converter_.byteArrayToString(messageBytes); - Trace.log(Trace.ERROR, "Error completing data queue request: " + message + ", rc:", rcBytes); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.UNKNOWN, rc + " : " + message); - } - } - } - - // Build Exception as above, plus detect object type mismatch. - private AS400Exception buildException(boolean expectKeyed, int rc, byte[] messageBytes) throws AS400SecurityException, ErrorCompletingRequestException, IllegalObjectTypeException, ObjectDoesNotExistException - { - if (rc == 0xF001 && messageBytes != null) - { - String messageID = converter_.byteArrayToString(messageBytes, 0, 7); - if (expectKeyed && messageID.equals("CPF9502")) - { - Trace.log(Trace.ERROR, "Error completing data queue request: " + converter_.byteArrayToString(messageBytes)); - Trace.log(Trace.ERROR, "Using KeyedDataQueue for non-keyed data queue: " + path_); - throw new IllegalObjectTypeException(path_, IllegalObjectTypeException.DATA_QUEUE_NOT_KEYED); - } - if (!expectKeyed && messageID.equals("CPF9506")) - { - Trace.log(Trace.ERROR, "Error completing data queue request: " + converter_.byteArrayToString(messageBytes)); - Trace.log(Trace.ERROR, "Using DataQueue for keyed data queue: " + path_); - throw new IllegalObjectTypeException(path_, IllegalObjectTypeException.DATA_QUEUE_KEYED); - } - } - return buildException(rc, messageBytes); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/BidiConversionProperties.java b/cvsroot/src/com/ibm/as400/access/BidiConversionProperties.java deleted file mode 100644 index 100c331ee..000000000 --- a/cvsroot/src/com/ibm/as400/access/BidiConversionProperties.java +++ /dev/null @@ -1,558 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BidiConversionOptions.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2004-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; - -/** - Provides a set of properties that can be used to control the conversion of character set data. - **/ -public class BidiConversionProperties implements Serializable -{ - static final long serialVersionUID = 4L; - - // String type. - private int bidiStringType_ = BidiStringType.DEFAULT; - // Only remove marks on the J2A transform. - private boolean removeMarksOnImplicitToVisual_ = false; - // All of the options to affect BIDI transforms. - private boolean impToImp_ = true; - private boolean roundTrip_; - private boolean winCompatible_; - private boolean insertMarkers_; - private boolean removeMarkers_; - private int options_; - private boolean wordBreak_; - private boolean destinationRequired_ = true; - private boolean srcToDstMapRequired_; - private boolean dstToSrcMapRequired_; - private boolean propertyMapRequired_; - private boolean continuation_; - private int numeralShaping_ = NUMERALS_DEFAULT; - private int inpCount_; - private int outCount_; - private int[] srcToDstMap_; - private int[] dstToSrcMap_; - private byte[] propertyMap_; - private boolean expandLamAlef = false;//@bd1a_ramysaid - - /** - * Value identifying that numeral shapes should be the default - * according to the string type. - */ - public static final int NUMERALS_DEFAULT = 0; - - /** - * Value identifying that numeral shapes are Nominal. - * Use Arabic digit shapes (1,2,3) for all numbers. - */ - public static final int NUMERALS_NOMINAL = 1; - /** - * Value identifying that numeral shapes are National - * Use Indic digit shapes for all numbers. - */ - public static final int NUMERALS_NATIONAL = 2; - /** - * Value identifying that numeral shapes are Contextual (Nominal or National - * depending on context) - * Use nominal or national depending on context. - */ - public static final int NUMERALS_CONTEXTUAL = 3; - /** - * Value identifying that numeral shapes can be Nominal or National - * Pass-through the original digit shapes. - */ - public static final int NUMERALS_ANY = 4; - /** - Constructs a BidiConversionProperties object. - **/ - public BidiConversionProperties() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing BidiConversionProperties."); - } - - BidiConversionProperties(int bidiStringType) - { - setBidiStringType(bidiStringType); - } - - BidiConversionProperties(int bidiStringType, BidiTransform transform, boolean removeMarkersOnImplicitToVisual) - { - // String type. - setBidiStringType(bidiStringType); - - // Copy options. - impToImp_ = transform.impToImp; - roundTrip_ = transform.roundTrip; - winCompatible_ = transform.winCompatible; - insertMarkers_ = transform.insertMarkers; - removeMarkers_ = transform.removeMarkers; - if (transform.options != null) options_ = transform.options.value; - wordBreak_ = transform.wordBreak; - destinationRequired_ = transform.destinationRequired; - srcToDstMapRequired_ = transform.srcToDstMapRequired; - dstToSrcMapRequired_ = transform.dstToSrcMapRequired; - propertyMapRequired_ = transform.propertyMapRequired; - continuation_ = transform.continuation; - - // Set remove markers special case option. - removeMarksOnImplicitToVisual_ = removeMarkersOnImplicitToVisual; - // The remove markers should not be true in general, only in J2A case. - if (removeMarkersOnImplicitToVisual) - { - removeMarkers_ = false; - } - - // Copy output results. - dstToSrcMap_ = transform.dstToSrcMap; - srcToDstMap_ = transform.srcToDstMap; - propertyMap_ = transform.propertyMap; - inpCount_ = transform.inpCount; - outCount_ = transform.outCount; - getNumeralShapingFromTransform(transform); - - //@bd1a_start_ramysaid - if (transform.options != null) { - expandLamAlef = (transform.options.getLamAlefMode() == ArabicOption.LAMALEF_RESIZE_BUFFER); - } else { - expandLamAlef = false; - } - //@bd1a_end_ramysaid - } - - /** - Sets the bidi string type, as defined by the CDRA (Character Data Representataion Architecture). See BidiStringType for more information and valid values. This option is set to BidiStringType.DEFAULT by default. - @param bidiStringType The bidi string type. - **/ - public void setBidiStringType(int bidiStringType) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting bidi string type:", bidiStringType); - if (bidiStringType != BidiStringType.NONE && bidiStringType != BidiStringType.DEFAULT && (bidiStringType < BidiStringType.ST4 || bidiStringType > BidiStringType.ST11)) - { - Trace.log(Trace.ERROR, "Value of parameter 'bidiStringType' is not valid:", bidiStringType); - throw new ExtendedIllegalArgumentException("bidiStringType (" + bidiStringType + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - bidiStringType_ = bidiStringType; - } - - /** - Gets the bidi string type. - @return The bidi string type. - **/ - public int getBidiStringType() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting bidi string type:", bidiStringType_); - return bidiStringType_; - } - - /** - Remove the directional marks only when transforming from logical to visual. - @param removeMarks true to remove the directional marks only when transforming from logical to visual; false otherwise. - **/ - public void setBidiRemoveMarksOnImplicitToVisual(boolean removeMarks) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting bidi remove the directional marks only when transforming from logical to visual property:", removeMarks); - removeMarksOnImplicitToVisual_ = removeMarks; - } - - /** - Indicates the value of the bidi remove the directional marks only when transforming from logical to visual property. - @return true if the remove the directional marks only when transforming from logical to visual property is enabled; false otherwise. - **/ - public boolean isBidiRemoveMarksOnImplicitToVisual() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if remove the directional marks only when transforming from logical to visual property is set:", removeMarksOnImplicitToVisual_); - return removeMarksOnImplicitToVisual_; - } - - // Internal method to copy all the options from one object to another. - void copyOptionsTo(BidiTransform destination) - { - destination.impToImp = impToImp_; - destination.roundTrip = roundTrip_; - destination.winCompatible = winCompatible_; - destination.insertMarkers = insertMarkers_; - destination.removeMarkers = removeMarkers_; - if (options_ == 0) - { - destination.options = null; - } - else - { - destination.options.value = options_; - } - - //@bd1a_start_ramysaid - ArabicOptionSet aos = new ArabicOptionSet(); - aos.value = destination.options == null ? 0 : destination.options.value; - if (expandLamAlef) { - aos.setOneOption(ArabicOption.LAMALEF_RESIZE_BUFFER); - destination.options = new ArabicOptionSet(aos); - } - //@bd1a_end_ramysaid - - destination.wordBreak = wordBreak_; - destination.destinationRequired = destinationRequired_; - destination.srcToDstMapRequired = srcToDstMapRequired_; - destination.dstToSrcMapRequired = dstToSrcMapRequired_; - destination.propertyMapRequired = propertyMapRequired_; - destination.continuation = continuation_; - setNumeralShapingOnTransform(destination); - } - - /** - * Copy the numeral shaping options from this object into - * the destination transform - * @param destination transform - */ - void setNumeralShapingOnTransform(BidiTransform destination) - { - switch(numeralShaping_) - { - case NUMERALS_NOMINAL: - destination.flags.setOneFlag(BidiFlag.NUMERALS_NOMINAL); - break; - case NUMERALS_NATIONAL: - destination.flags.setOneFlag(BidiFlag.NUMERALS_NATIONAL); - break; - case NUMERALS_CONTEXTUAL: - destination.flags.setOneFlag(BidiFlag.NUMERALS_CONTEXTUAL); - break; - case NUMERALS_ANY: - destination.flags.setOneFlag(BidiFlag.NUMERALS_ANY); - break; - case NUMERALS_DEFAULT: - break; - } - } - - /** - * Copy the numeral shaping options from the source transform - * into this object - * @param source transform - */ - void getNumeralShapingFromTransform(BidiTransform source) - { - BidiFlag flag = source.flags.getNumerals(); - if (flag == BidiFlag.NUMERALS_NOMINAL) numeralShaping_ = NUMERALS_NOMINAL; - else if (flag == BidiFlag.NUMERALS_NATIONAL) numeralShaping_ = NUMERALS_NATIONAL; - else if (flag == BidiFlag.NUMERALS_CONTEXTUAL) numeralShaping_ = NUMERALS_CONTEXTUAL; - else if (flag == BidiFlag.NUMERALS_ANY) numeralShaping_ = NUMERALS_ANY; - } - /** - Sets the bidi implicit LTR-RTL reordering property. This property is true by default. - @param bidiImplicitReordering true to use the bidi implicit reordering; false otherwise. - **/ - public void setBidiImplicitReordering(boolean bidiImplicitReordering) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting bidi implicit LTR-RTL reordering:", bidiImplicitReordering); - impToImp_ = bidiImplicitReordering; - } - - /** - Indicates the value of the bidi implicit LTR-RTL reordering property. - @return true if the bidi implicit LTR-RTL reordering property is enabled; false otherwise. - **/ - public boolean isBidiImplicitReordering() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if bidi implicit LTR-RTL reordering:", impToImp_); - return impToImp_; - } - - /** - Sets the bidi numeric ordering round trip property. This property is false by default. - @param bidiNumericOrderingRoundTrip true to use the bidi numeric ordering round trip property; false otherwise. - **/ - public void setBidiNumericOrderingRoundTrip(boolean bidiNumericOrderingRoundTrip) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting bidi numeric ordering round trip:", bidiNumericOrderingRoundTrip); - roundTrip_ = bidiNumericOrderingRoundTrip; - } - - /** - Indicates the value of the bidi numeric ordering round trip property. - @return true if the bidi numeric ordering round trip property is enabled; false otherwise. - **/ - public boolean isBidiNumericOrderingRoundTrip() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if bidi numeric ordering round trip:", roundTrip_); - return roundTrip_; - } - - /** - Sets the bidi window compatibility property. This property is false by default. -

        If this option is true, the reordering algorithm is modified to perform more closely like Windows. In particular, logical string "12ABC" in LTR orientation (where ABC represent Arabic or Hebrew letters) is reordered as "CBA12" instead of "12CBA". Also, logical string "abc 123 45" (where all digits represent Hindi numbers) is reordered as "abc 123 45" instead of "abc 45 123". - @param bidiWindowCompatibility true to use the window compatibility property; false otherwise. - **/ - public void setBidiWindowCompatibility(boolean bidiWindowCompatibility) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting bidi window compatibility:", bidiWindowCompatibility); - winCompatible_ = bidiWindowCompatibility; - } - - /** - Indicates the value of the bidi window compatibility property. - @return true if the bidi window compatibility property is enabled; false otherwise. - **/ - public boolean isBidiWindowCompatibility() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if bidi window compatibility:", winCompatible_); - return winCompatible_; - } - - /** - Sets the bidi insert directional marks property. This property is false by default. Insert directional marks when going from visual to implicit to guarantee correct roundtrip back to visual. - @param bidiInsertDirectionalMarks true to use the insert directional marks property; false otherwise. - **/ - public void setBidiInsertDirectionalMarks(boolean bidiInsertDirectionalMarks) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting bidi insert directional marks:", bidiInsertDirectionalMarks); - insertMarkers_ = bidiInsertDirectionalMarks; - } - - /** - Indicates the value of the bidi insert directional marks property. - @return true if the bidi insert directional marks property is enabled; false otherwise. - **/ - public boolean isBidiInsertDirectionalMarks() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if bidi insert directional marks:", insertMarkers_); - return insertMarkers_; - } - - /** - Sets the bidi remove directional marks property. This property is false by default. Remove directional marks when going from implict to visual. - @param bidiRemoveDirectionalMarks true to use the remove directional marks property; false otherwise. - **/ - public void setBidiRemoveDirectionalMarks(boolean bidiRemoveDirectionalMarks) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting bidi remove directional marks:", bidiRemoveDirectionalMarks); - removeMarkers_ = bidiRemoveDirectionalMarks; - } - - /** - Indicates the value of the bidi remove directional marks property. - @return true if the bidi remove directional marks property is enabled; false otherwise. - **/ - public boolean isBidiRemoveDirectionalMarks() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if bidi remove directional marks:", removeMarkers_); - return removeMarkers_; - } - - /** - Sets the bidi consider white space to always follow base orientation property. This property is false by default. - @param wordBreak true to consider white space to always follow base orientation; false otherwise. - **/ - public void setBidiWordBreak(boolean wordBreak) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting bidi word break:", wordBreak); - wordBreak_ = wordBreak; - } - - /** - Indicates the value of the bidi consider white space to always follow base orientation property. - @return true if the bidi consider white space to always follow base orientation property is enabled; false otherwise. - **/ - public boolean isBidiWordBreak() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if bidi consider white space to always follow base orientation:", wordBreak_); - return wordBreak_; - } - - /** - Sets the numeral shaping property. By default this takes its value from the string type. -

        The possible values are:

          -
        • {@link #NUMERALS_NOMINAL NUMERALS_NOMINAL} -
        • {@link #NUMERALS_NATIONAL NUMERALS_NATIONAL} -
        • {@link #NUMERALS_CONTEXTUAL NUMERALS_CONTEXTUAL} -
        • {@link #NUMERALS_ANY NUMERALS_ANY} -
        • {@link #NUMERALS_DEFAULT NUMERALS_DEFAULT} - - @param numeralShaping what shapes to use for numerals - **/ - public void setBidiNumeralShaping(int numeralShaping) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting numeral shaping:", numeralShaping); - if (numeralShaping < NUMERALS_DEFAULT || numeralShaping > NUMERALS_ANY) - { - throw new ExtendedIllegalArgumentException("numeralShaping (" + numeralShaping + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - numeralShaping_ = numeralShaping; - } - - /** - Gets the numeral shaping property. By default this takes its value from the string type. -

          The possible values are:

            -
          • {@link #NUMERALS_NOMINAL NUMERALS_NOMINAL} -
          • {@link #NUMERALS_NATIONAL NUMERALS_NATIONAL} -
          • {@link #NUMERALS_CONTEXTUAL NUMERALS_CONTEXTUAL} -
          • {@link #NUMERALS_ANY NUMERALS_ANY} -
          • {@link #NUMERALS_DEFAULT NUMERALS_DEFAULT} - - @return what shapes to use for numerals - **/ - public int getBidiNumeralShaping() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking numeral shaping:", numeralShaping_); - return numeralShaping_; - } - - /** - Sets the bidi destination required property. This property is true by default. - @param destinationRequired true if the destination is required; false otherwise. - **/ - public void setBidiDestinationRequired(boolean destinationRequired) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting bidi destination required:", destinationRequired); - destinationRequired_ = destinationRequired; - } - - /** - Indicates the value of the bidi destination required property. - @return true if the bidi destination required property is enabled; false otherwise. - **/ - public boolean isBidiDestinationRequired() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if bidi destination required:", destinationRequired_); - return destinationRequired_; - } - - /** - Sets the create a source to destination mapping property. This property is false by default. - @param srcToDstMapRequired true to use the bidi create a source to destination mapping property; false otherwise. - **/ - public void setBidiCreateSourceToDestinationMapping(boolean srcToDstMapRequired) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting bidi create a source to destination mapping property:", srcToDstMapRequired); - srcToDstMapRequired_ = srcToDstMapRequired; - } - - /** - Indicates the value of the bidi create a source to destination mapping property. - @return true if the bidi create a source to destination mapping property is enabled; false otherwise. - **/ - public boolean isBidiCreateSourceToDestinationMapping() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if create a source to destination mapping property is set:", srcToDstMapRequired_); - return srcToDstMapRequired_; - } - - /** - Sets the create a destination to source mapping property. This property is false by default. - @param dstToSrcMapRequired true to use the create a destination to source mapping property; false otherwise. - **/ - public void setBidiCreateDestinationToSourceMapping(boolean dstToSrcMapRequired) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting bidi create a destination to source mapping property:", dstToSrcMapRequired); - dstToSrcMapRequired_ = dstToSrcMapRequired; - } - - /** - Indicates the value of the bidi create a destination to source mapping property. - @return true if the bidi create a destination to source mapping property is enabled; false otherwise. - **/ - public boolean isBidiCreateDestinationToSourceMapping() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if create a destination to source mapping property is set:", dstToSrcMapRequired_); - return dstToSrcMapRequired_; - } - - /** - Sets the create a property map property. This property is false by default. - @param propertyMapRequired true to use the create a property map property; false otherwise. - **/ - public void setBidiCreatePropertyMap(boolean propertyMapRequired) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting bidi create property map property:", propertyMapRequired); - propertyMapRequired_ = propertyMapRequired; - } - - /** - Indicates the value of the bidi create a property map property. - @return true if the bidi create a property map property is enabled; false otherwise. - **/ - public boolean isBidiCreatePropertyMap() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if bidi create property map property is set:", propertyMapRequired_); - return propertyMapRequired_; - } - - /** - Output value: number of characters processed in the source data by the last transform. - **/ - public int getInputCount() - { - return inpCount_; - } - - /** - Output value: number of characters written in the destination data by the last transform - **/ - public int getOutputCount() - { - return outCount_; - } - - /** - Output value: source-to-destination map from the last transform with srcToDstMapRequired specified; if this option was not specified, the content of srcToDstMap should be ignored. -

            If when starting a transformation this field refers to a large enough array of integers, this array will be re-used to put the new map. Otherwise a new array will be created. -

            This map has a number for each character processed in the source data by the last transform. This number is the index of where this character is moved in the character array of the destination BidiText. If the removeMarkers option was specified and LRM or RLM markers have been removed from the destination text, the corresponding elements of srcToDstMap will contain -1. -

            Note that the allocated array may have more elements than the number of characters processed in the source BidiText. In that case, the extra elements should be ignored. The number of relevant elements can be found from getInputCount().. - **/ - public int[] getSourceToDestinationMap() - { - return srcToDstMap_; - } - - /** - Output value: destination-to-source map from the last transform with dstToSrcMapRequired specified; if this option was not specified, the content of dstToSrcMap should be ignored. -

            If when starting a transformation this field refers to a large enough array of integers, this array will be re-used to put the new map. Otherwise a new array will be created. -

            This map has a number for each character in the "interesting" data of the destination BidiText. This number is the index of the source character from which the destination character originates. This index is relative to the beginning of the "interesting" data. If the offset of the source BidiText is not zero, index 0 does not indicate the first character of the data array, but the character at position "offset". If the insertMarkers option was specified and LRM or RLM markers have been added, the corresponding elements of dstToSrcMap will contain -1. -

            Note that the allocated array may have more elements than the number of characters in the "interesting" part of the destination BidiText. In that case, the extra elements should be ignored. The number of relevant elements can be found from getOutputCount(). - **/ - public int[] getDestinationToSourceMap() - { - return dstToSrcMap_; - } - - /** - Output value: property map from the last transform with propertyMapRequired specified; if this option was not specified, the content of propertyMap should be ignored. -

            If when starting a transformation this field refers to a large enough array of bytes, this array will be re-used to put the new map. Otherwise a new array will be created. -

            This map has a byte for each character processed in the source data by the last transform. The 6 lower bits of each property element is the Bidi level of the corresponding input character. The highest bit is a new-cell indicator for composed character environments: a value of 0 indicates a zero-length composing character element, and a value of 1 indicates an element that begins a new cell. -

            Note: the content of this map has no simple interpretation if the bidi implicit reordering property is true. -

            Note also that the allocated array may have more elements than the number of characters processed in the source BidiText. In that case, the extra elements should be ignored. The number of relevant elements can be found from getInputCount(). - **/ - public byte[] getPropertyMap() - { - return propertyMap_; - } - - //@bd1a_start_ramysaid - /** - Indicates whether lam-alef ligatures should get decomposed into lam and alef characters - when transforming from visual to logical. Not the buffer may expand when this is done. - **/ - public boolean isBidiExpandLamAlef() { - return expandLamAlef; - } - /** - Sets whether lam-alef ligatures should get decomposed into lam and alef characters - when transforming from visual to logical. - **/ - public void setBidiExpandLamAlef(boolean expandLamAlef) { - this.expandLamAlef = expandLamAlef; - } - //@bd1a_end_ramysaid -} diff --git a/cvsroot/src/com/ibm/as400/access/BidiConvert.java b/cvsroot/src/com/ibm/as400/access/BidiConvert.java deleted file mode 100644 index fa05e586d..000000000 --- a/cvsroot/src/com/ibm/as400/access/BidiConvert.java +++ /dev/null @@ -1,553 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BidiConvert.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.StringTokenizer; -import java.nio.CharBuffer; - -/** - * BidiConvert is a convenience class to facilitate invocation of the - * Bidi layout transformations by converter code in the JVM.

            - * It contains 2 public methods: toUnicode() and toSbcs(). - *

            - * Method toUnicode() must be called by the ByteToChar converters - * after converting the SBCS byte data into Unicode. - *

            - * Method toSbcs() must be called by the CharToByte converters before - * converting the Unicode string data into byte data. - * - */ - -class BidiConvert -{ -/** - * Default Bidi parms for Unicode string - */ - final static char[] DEFAULT_U = new char[] {'I', 'L', 'Y', 'N', 'N', 'U', 'A', 'A', 'A', 'A'}; -/** - * Default Bidi parms for SBCS string - */ - final static char[] DEFAULT_S = new char[] {'V', 'L', 'N', 'S', 'N', 'U', 'A', 'A', 'A', 'A'}; -/** - * Character for default option in Bidi parms - */ - final static char DEFCHAR = '-'; - - // The 5 following members are used to cache the parms and result of - // isMatchingEncoding(), because it will typically be called several times - // with the same data, from within isBidiData() and from within toSbcs() - // or toUnicode(). - private String lastEncoding; - private String lastBidiParms; - private boolean lastMatching; - private BidiFlagSet bfs_U; - private BidiFlagSet bfs_S; - - -/** - * This method isolates a part with format "X(YYYY)" within a string, where "X" - * is a one-letter prefix followed by a left parenthesis, and "YYYY" is an - * arbitrary string. - * @param str The string to scan. - * @param prefix The one-letter prefix with the left parenthesis. - * @return the string within parentheses following the prefix. - */ - private String getPart(String str, String prefix) - { - String part; - StringTokenizer stok; - - stok = new StringTokenizer(str, ",)"); - part = ""; - while (stok.hasMoreTokens()) - { - part = stok.nextToken(); - if (part.startsWith(prefix)) - return part.substring(2); - } - return ""; - } - -/** - * This method isolates a part with format "X(YYYY)" within a string, where "X" - * is a one-letter prefix followed by a left parenthesis, and "YYYY" is an - * arbitrary string. It returns it as a char array, completed to the - * maximum number of elements from a default array. - * @param str The string to scan. - * @param prefix The one-letter prefix with the left parenthesis. - * @param defChars The default char array - * @return the string within parentheses following the prefix. - */ - private char[] getChars(String str, String prefix, char[] defChars) - { - String part; - int len, lenDef; - char[] ans; - - part = getPart(str, prefix); - len = part.length(); - lenDef = defChars.length; - if (len > lenDef) len = lenDef; - ans = new char[lenDef]; - part.getChars(0, len, ans, 0); - for (int i = 0; i < lenDef; i++) - if ((i >= len) || (DEFCHAR == ans[i])) ans[i] = defChars[i]; - return ans; - } - -/** - * This method checks if the encoding of the conversion is included in a - * list of encodings within bidiParms. If positive, or if bidiParms - * contains no list of encodings, return true; otherwise return false. - * @param encoding The encoding of the data outside the JVM. - * @param bidiParms The environment variable containing the specifications of the Bidi attributes. - * @return true if encoding appears in bidiParms, or if bidiParms ignores encodings. - */ - private boolean isMatchingEncoding(String encoding, String bidiParms) - { - String part, enc; - StringTokenizer stok; - - if ((encoding == lastEncoding) && (bidiParms == lastBidiParms)) - return lastMatching; - - lastEncoding = encoding; - lastBidiParms = bidiParms; - bfs_U = null; - bfs_S = null; - part = getPart(bidiParms, "C("); - if (part.equals("")) return (lastMatching = true); - - stok = new StringTokenizer(part, ";"); - while (stok.hasMoreTokens()) - { - enc = stok.nextToken(); - if (enc.equals(encoding)) return (lastMatching = true); - } - return (lastMatching = false); - } - -/** - * This method checks the orientation if RTL in either the U or S part of Bidi parms. - * @param bidiParms The environment variable containing the specifications of the Bidi attributes. - * @return true if either orientation is RTL. - */ - private boolean isFlagRtl(String bidiParms) - { - BidiFlag bf; - - if (null == bfs_U) bfs_U = new BidiFlagSet(getChars(bidiParms, "U(", DEFAULT_U)); - bf = bfs_U.getOrientation(); - if (BidiFlag.ORIENTATION_RTL == bf) return true; - if (BidiFlag.ORIENTATION_CONTEXT_RTL == bf) return true; - if (null == bfs_S) bfs_S = new BidiFlagSet(getChars(bidiParms, "S(", DEFAULT_S)); - bf = bfs_S.getOrientation(); - if (BidiFlag.ORIENTATION_RTL == bf) return true; - if (BidiFlag.ORIENTATION_CONTEXT_RTL == bf) return true; - return false; - } - -/** - * This method checks if a char array contains R or AL characters. - * @param input The input char array containing text in Unicode. - * @param inStart Offset in input array. - * @param inEnd Offset of last byte to be converted. - * @return true if the string needs Bidi transformation. - */ - private boolean isBidiData(char[] input, int inStart, int inEnd) - { - char c; - - for (int i = inStart; i < inEnd; i++) - { - c = input[i]; - // Hebrew, Arabic, Syria, Thaana - if ((c >= 0x0590) && (c <= 0x07BF)) return true; - // Hebrew Presentation Forms and Arabic Presentation Forms-A - if ((c >= 0xFB1D) && (c <= 0xFDFF)) return true; - // Arabic Presentation Forms-B - if ((c >= 0xFE70) && (c <= 0xFEFC)) return true; - // RLM - if (c == 0x200F) return true; - // RLE, RLO - if ((c == 0x202B) || (c == 0x202E)) return true; - } - return false; - } - -/** - * This method checks if the environment allows Bidi transformations for the current encoding. - * @param bidiParms The environment variable containing the specifications of the Bidi attributes. - * @param encoding The encoding of the data outside the JVM. - * @return true if the environment allows Bidi transformations for the current encoding. - */ - public boolean isBidiEnv(String bidiParms, String encoding) - { - if (encoding.equals("Cp850")) return false; - Mlog.putLine( "isBidiEnv " + bidiParms + " encoding=" + encoding ); -// if (bidiParms == null) return false; - if (bidiParms == null) return Mlog.logReturn( false ); -// if (bidiParms.equals("NO")) return false; - if (bidiParms.equals("NO")) return Mlog.logReturn( false ); -// if (!isMatchingEncoding(encoding, bidiParms)) return false; - if (!isMatchingEncoding(encoding, bidiParms)) return Mlog.logReturn( false ); -// return true; - return Mlog.logReturn( true ); - } - -/** - * This method checks if a char array needs Bidi transformation. - * @param input The input char array containing text in Unicode. - * @param inStart Offset in input array. - * @param inEnd Offset of last byte to be converted. - * @param bidiParms The environment variable containing the specifications of the Bidi attributes. - * @param encoding The encoding of the data outside the JVM. - * @return true if the string needs Bidi transformation. - */ - public boolean isBidiData(char[] input, int inStart, int inEnd, String bidiParms, String encoding) - { - if (false == isBidiEnv( bidiParms, encoding )) return false; - Mlog.putLine( "isBidiData_char[] inStart=" + inStart + " inEnd=" + inEnd ); - Mlog.putHexLine( input, inStart, inEnd, true ); -// if (inEnd <= inStart) return false - if (inEnd <= inStart) return Mlog.logReturn( false ); -// if (isFlagRtl(bidiParms)) return true; - if (isFlagRtl(bidiParms)) return Mlog.logReturn( true ); -// return isBidiData( input, inStart, inEnd ); - return Mlog.logReturn( isBidiData( input, inStart, inEnd ) ); - } - -/** - * This method checks if a string needs Bidi transformation. - * @param input The input string. - * @param bidiParms The environment variable containing the specifications of the Bidi attributes. - * @param encoding The encoding of the data outside the JVM. - * @return true if the string needs Bidi transformation. - */ - public boolean isBidiData(String input, String bidiParms, String encoding) - { - if (false == isBidiEnv( bidiParms, encoding )) return false; - Mlog.putLine( "isBidiData_String" ); - Mlog.putHexLine( input, true ); -// if (input.length() <= 0) return false - if (input.length() <= 0) return Mlog.logReturn( false ); -// if (isFlagRtl(bidiParms)) return true; - if (isFlagRtl(bidiParms)) return Mlog.logReturn( true ); - char[] text = input.toCharArray(); -// return isBidiData( text, 0, text.length ); - return Mlog.logReturn( isBidiData( text, 0, text.length ) ); - } - -/** - * This method checks if a CharBuffer needs Bidi transformation. - * @param input The input buffer. - * @param UseBuffer flag to prevent use of char array in CharBuffer. - * @param bidiParms The environment variable containing the specifications of the Bidi attributes. - * @param encoding The encoding of the data outside the JVM. - * @return true if the buffer needs Bidi transformation. - */ - public boolean isBidiData(CharBuffer input, boolean UseBuffer, String bidiParms, String encoding) - { - char[] text; - boolean flag; - - if (false == isBidiEnv( bidiParms, encoding )) return false; - Mlog.putLine( "isBidiData_CharBuffer UseBuffer=" + UseBuffer + - " position=" + input.position() + " limit=" + input.limit() ); - Mlog.putHexLine( input.toString(), true ); -// if (!input.hasRemaining()) return false - if (!input.hasRemaining()) return Mlog.logReturn( false ); -// if (isFlagRtl(bidiParms)) return true; - if (isFlagRtl(bidiParms)) return Mlog.logReturn( true ); - - if (input.hasArray() && !UseBuffer) - { - text = input.array(); - int offset = input.arrayOffset(); - flag = isBidiData( text, offset + input.position(), offset + input.limit() ); -// return flag; - return Mlog.logReturn( flag ); - } - // We need to save the buffer state, but don't want to use mark() since - // the caller may have set his own mark. - int oldPos = input.position(); - text = new char[1]; - flag = false; - while (input.hasRemaining()) - { - text[0] = input.get(); - if (isBidiData( text, 0, 1 )) - { - flag = true; - break; - } - } - // Reset the buffer to its original state - input.position( oldPos ); -// return flag; - return Mlog.logReturn( flag ); - } - -/** - * This method creates a char array from a subset of another char array. - * @param input The input char array. - * @param inStart Offset in input array. - * @param inEnd Offset of last byte to be converted. - * @return The char array containing characters from inStart to inEnd. - */ - private char[] subchars(char[] input, int inStart, int inEnd) - { - int len = inEnd - inStart; - char[] result = new char[len]; - System.arraycopy( input, inStart, result, 0, len ); - return result; - } - -/** - * This method converts a char array from the Bidi attributes used outside the - * JVM to those used inside the JVM. - * @param input The input char array. - * @param inStart Offset in input array. - * @param inEnd Offset of last byte to be converted. - * @param bidiParms The environment variable containing the specifications of the Bidi attributes. - * @return The input char array transformed to the layout specified by bidiParms. - */ - private char[] toUnicode(char[] input, int inStart, int inEnd, String bidiParms) - { - char[] charsU, charsS; - BidiTransform bdx; - BidiText src, dst; - - charsU = getChars(bidiParms, "U(", DEFAULT_U); - charsS = getChars(bidiParms, "S(", DEFAULT_S); - bdx = new BidiTransform(); - if (null == bfs_U) bfs_U = new BidiFlagSet(charsU); - bdx.flags = bfs_U; - bdx.roundTrip = ('R' == charsU[5]); - bdx.options = new ArabicOptionSet(charsU); - - if (null == bfs_S) bfs_S = new BidiFlagSet(charsS); - src = new BidiText( bfs_S ); - src.setCharsRef( input, inStart, inEnd - inStart ); - dst = src.transform(bdx); - return dst.data; - } - -/** - * This method converts a char array from the Bidi attributes used outside the - * JVM to those used inside the JVM. - * @param input The input char array. - * @param inStart Offset in input array. - * @param inEnd Offset of last byte to be converted. - * @param bidiParms The environment variable containing the specifications of the Bidi attributes. - * @param encoding The encoding of the data outside the JVM. - * @return The input char array transformed to the layout specified by bidiParms. - */ - public char[] toUnicode(char[] input, int inStart, int inEnd, String bidiParms, String encoding) - { - Mlog.printStackTrace( "toUnicode_char[]") ; - Mlog.putLine( "toUnicode_char[] inStart=" + inStart + " inEnd=" + inEnd ); - Mlog.putHexLine( input, inStart, inEnd, true ); -// if (false == isBidiEnv( bidiParms, encoding )) return subchars( input, inStart, inEnd); - if (false == isBidiEnv( bidiParms, encoding )) - return Mlog.logReturn( subchars( input, inStart, inEnd) ); -// return toUnicode( input, inStart, inEnd, bidiParms ); - return Mlog.logReturn( toUnicode( input, inStart, inEnd, bidiParms ) ); - } - -/** - * This method converts a string from the Bidi attributes used outside the - * JVM to those used inside the JVM. - * @param input The input string. - * @param bidiParms The environment variable containing the specifications of the Bidi attributes. - * @param encoding The encoding of the data outside the JVM. - * @return The input string transformed to the layout specified by bidiParms. - */ - public String toUnicode(String input, String bidiParms, String encoding) - { - Mlog.printStackTrace( "toUnicode_String" ); - Mlog.putLine( "toUnicode_String input:" ); - Mlog.putHexLine( input, true ); -// if (false == isBidiEnv( bidiParms, encoding )) return input; - if (false == isBidiEnv( bidiParms, encoding )) - return Mlog.logReturn( input ); -// return new String( toUnicode(input.toCharArray(), 0, input.length(), bidiParms) ); - return new String( Mlog.logReturn( toUnicode(input.toCharArray(), 0, input.length(), bidiParms ) ) ); - } - -/** - * This method converts a CharBuffer from the Bidi attributes used outside the - * JVM to those used inside the JVM. - * @param input The input buffer. - * @param UseBuffer flag to prevent use of char array in CharBuffer. - * @param bidiParms The environment variable containing the specifications of the Bidi attributes. - * @param encoding The encoding of the data outside the JVM. - * @return another CharBuffer with its data input string transformed to the layout specified by bidiParms. - */ - public CharBuffer toUnicode(CharBuffer input, boolean UseBuffer, String bidiParms, String encoding) - { - char[] text; - - Mlog.printStackTrace( "toUnicode_CharBuffer" ); - Mlog.putLine( "toUnicode_CharBuffer UseBuffer=" + UseBuffer + - " position=" + input.position() + " limit=" + input.limit() ); - Mlog.putHexLine( input.toString(), true ); -// if (false == isBidiEnv( bidiParms, encoding )) return input; - if (false == isBidiEnv( bidiParms, encoding )) - return Mlog.logReturn( input ); - - if (input.hasArray() && !UseBuffer) - { - text = input.array(); - int offset = input.arrayOffset(); - text = toUnicode( text, offset + input.position(), offset + input.limit(), bidiParms ); - Mlog.putLine( "after array: position=" + input.position() + " limit=" + input.limit() ); -// return CharBuffer.wrap( text ); - return Mlog.logReturn( CharBuffer.wrap( text ) ); - } - // We need to save the buffer state, but don't want to use mark() since - // the caller may have set his own mark. - int oldPos = input.position(); - // Since the Bidi layout code is geared towards char arrays, we have no - // option but to extract the data for the buffer into an array - text = new char[input.remaining()]; - input.get( text ); - // Reset the buffer to its original state - input.position( oldPos ); - text = toUnicode( text, 0, text.length, bidiParms ); - Mlog.putLine( "after buffer: position=" + input.position() + " limit=" + input.limit() ); -// return CharBuffer.wrap( text ); - return Mlog.logReturn( CharBuffer.wrap( text ) ); - } - -/** - * This method converts a char array from the Bidi attributes used inside the - * JVM to those used outside the JVM. - * @param input The input char array. - * @param inStart Offset in input array. - * @param inEnd Offset of last byte to be converted. - * @param bidiParms The environment variable containing the specifications of the Bidi attributes. - * @return The input char array transformed to the layout specified by bidiParms. - */ - private char[] toSbcs(char[] input, int inStart, int inEnd, String bidiParms) - { - char[] charsU, charsS; - BidiTransform bdx; - BidiText src, dst; - - charsU = getChars(bidiParms, "U(", DEFAULT_U); - charsS = getChars(bidiParms, "S(", DEFAULT_S); - bdx = new BidiTransform(); - if (null == bfs_S) bfs_S = new BidiFlagSet(charsS); - bdx.flags = bfs_S; - bdx.roundTrip = ('R' == charsS[5]); - bdx.options = new ArabicOptionSet(charsS); - - if (null == bfs_U) bfs_U = new BidiFlagSet(charsU); - src = new BidiText( bfs_U ); - src.setCharsRef( input, inStart, inEnd - inStart ); - dst = src.transform(bdx); - return dst.data; - } - -/** - * This method converts a char array from the Bidi attributes used inside the - * JVM to those used outside the JVM. - * @param input The input char array. - * @param inStart Offset in input array. - * @param inEnd Offset of last byte to be converted. - * @param bidiParms The environment variable containing the specifications of the Bidi attributes. - * @param encoding The encoding of the data outside the JVM. - * @return The input char array transformed to the layout specified by bidiParms. - */ - public char[] toSbcs(char[] input, int inStart, int inEnd, String bidiParms, String encoding) - { - BidiTransform bdx; - BidiText src, dst; - - Mlog.printStackTrace( "toSbcs_char[]" ); - Mlog.putLine( "toSbcs_char[] inStart=" + inStart + " inEnd=" + inEnd ); - Mlog.putHexLine( input, inStart, inEnd, true ); -// if (false == isBidiEnv( bidiParms, encoding )) return subchars( input, inStart, inEnd); - if (false == isBidiEnv( bidiParms, encoding )) - return Mlog.logReturn( subchars( input, inStart, inEnd) ); -// return toSbcs( input, inStart, inEnd, bidiParms ); - return Mlog.logReturn( toSbcs( input, inStart, inEnd, bidiParms ) ); - } - -/** - * This method converts a string from the Bidi attributes used inside the - * JVM to those used outside the JVM. - * @param input The input string. - * @param bidiParms The environment variable containing the specifications of the Bidi attributes. - * @param encoding The encoding of the data outside the JVM. - * @return The input string transformed to the layout specified by bidiParms. - */ - public String toSbcs(String input, String bidiParms, String encoding) - { - Mlog.printStackTrace( "toSbcs_String input:" ); - Mlog.putHexLine( input, true ); -// if (false == isBidiEnv( bidiParms, encoding )) return input; - if (false == isBidiEnv( bidiParms, encoding )) - return Mlog.logReturn( input ); -// return new String( toSbcs( input.toCharArray(), 0, input.length(), bidiParms ) ); - return Mlog.logReturn( new String( toSbcs( input.toCharArray(), 0, input.length(), bidiParms ) ) ); - } - -/** - * This method converts a CharBuffer from the Bidi attributes used inside the - * JVM to those used outside the JVM. - * @param input The input buffer. - * @param UseBuffer flag to prevent use of char array in CharBuffer. - * @param bidiParms The environment variable containing the specifications of the Bidi attributes. - * @param encoding The encoding of the data outside the JVM. - * @return another CharBuffer with its data input string transformed to the layout specified by bidiParms. - */ - public CharBuffer toSbcs(CharBuffer input, boolean UseBuffer, String bidiParms, String encoding) - { - char[] text; - - Mlog.printStackTrace( "toSbcs_CharBuffer" ); - Mlog.putLine( "toSbcs_CharBuffer UseBuffer=" + UseBuffer + - " position=" + input.position() + " limit=" + input.limit() ); - Mlog.putHexLine( input.toString(), true ); -// if (false == isBidiEnv( bidiParms, encoding )) return input; - if (false == isBidiEnv( bidiParms, encoding )) - return Mlog.logReturn( input ); - - if (input.hasArray() && !UseBuffer) - { - text = input.array(); - int offset = input.arrayOffset(); - text = toSbcs( text, offset + input.position(), offset + input.limit(), bidiParms ); - Mlog.putLine( "after array: position=" + input.position() + " limit=" + input.limit() ); -// return CharBuffer.wrap( text ); - return Mlog.logReturn( CharBuffer.wrap( text ) ); - } - // We need to save the buffer state, but don't want to use mark() since - // the caller may have set his own mark. - int oldPos = input.position(); - // Since the Bidi layout code is geared towards char arrays, we have no - // option but to extract the data for the buffer into an array - text = new char[input.remaining()]; - input.get( text ); - // Reset the buffer to its original state - input.position( oldPos ); - text = toSbcs( text, 0, text.length, bidiParms ); - Mlog.putLine( "after buffer: position=" + input.position() + " limit=" + input.limit() ); -// return CharBuffer.wrap( text ); - return Mlog.logReturn( CharBuffer.wrap( text ) ); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/BidiFlag.java b/cvsroot/src/com/ibm/as400/access/BidiFlag.java deleted file mode 100644 index e8927e506..000000000 --- a/cvsroot/src/com/ibm/as400/access/BidiFlag.java +++ /dev/null @@ -1,149 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BidiFlag.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * This class represents BidiFlag objects and provides initial values for - * all flag options. - *

            - * Bidi text can be stored in different formats, which are characterized - * by 5 Bidi attributes, whose values may be stored in 5 Bidi flags. - * These 5 flags constitute a BidiFlagSet. - *

            - * A BidiFlagSet object contains a value for each of the 5 Bidi flags - * which represent the Bidi attributes. The 5 attributes are: - *

              - *
            • type of text (Implicit or Visual) - *
            • orientation (LTR, RTL, Contextual LTR, Contextual RTL) - *
            • symmetric swapping (Yes or No) - *
            • numeral shapes (Nominal, National or Contextual) - *
            • text shapes (Nominal, Shaped, Initial, Middle, Final or Isolated) - *
            - * The BidiFlags are pre-defined in this class. Each one represents one - * possible value of one Bidi attribute. All possible values are defined, - * so there is no need (or possibility) to add new ones. - * - *

            Multi-threading considerations: There are no multi-threading - * concerns for this class, since it only defines static - * final instances. - * - */ - -class BidiFlag - { -/** - * Value identifying Implicit type of text - */ - public static final BidiFlag TYPE_IMPLICIT - = new BidiFlag(BidiFlagSet.ITYPE_IMPLICIT, BidiFlagSet.TYPE_MASK); -/** - * Value identifying Visual type of text - */ - public static final BidiFlag TYPE_VISUAL - = new BidiFlag(BidiFlagSet.ITYPE_VISUAL, BidiFlagSet.TYPE_MASK); - -/** - * Value identifying LTR orientation - */ - public static final BidiFlag ORIENTATION_LTR - = new BidiFlag(BidiFlagSet.IORIENTATION_LTR, BidiFlagSet.ORIENTATION_MASK); -/** - * Value identifying RTL orientation - */ - public static final BidiFlag ORIENTATION_RTL - = new BidiFlag(BidiFlagSet.IORIENTATION_RTL, BidiFlagSet.ORIENTATION_MASK); -/** - * Value identifying Contextual orientation with default to LTR - */ - public static final BidiFlag ORIENTATION_CONTEXT_LTR - = new BidiFlag(BidiFlagSet.IORIENTATION_CONTEXT_LTR, BidiFlagSet.ORIENTATION_MASK); -/** - * Value identifying Contextual orientation with default to RTL - */ - public static final BidiFlag ORIENTATION_CONTEXT_RTL - = new BidiFlag(BidiFlagSet.IORIENTATION_CONTEXT_RTL, BidiFlagSet.ORIENTATION_MASK); - -/** - * Value identifying that symmetric swapping has been applied - */ - public static final BidiFlag SWAP_YES - = new BidiFlag(BidiFlagSet.ISWAP_YES, BidiFlagSet.SWAP_MASK); -/** - * Value identifying that symmetric swapping has not been applied - */ - public static final BidiFlag SWAP_NO - = new BidiFlag(BidiFlagSet.ISWAP_NO, BidiFlagSet.SWAP_MASK); - -/** - * Value identifying that numeral shapes are Nominal - */ - public static final BidiFlag NUMERALS_NOMINAL - = new BidiFlag(BidiFlagSet.INUMERALS_NOMINAL, BidiFlagSet.NUMERALS_MASK); -/** - * Value identifying that numeral shapes are National - */ - public static final BidiFlag NUMERALS_NATIONAL - = new BidiFlag(BidiFlagSet.INUMERALS_NATIONAL, BidiFlagSet.NUMERALS_MASK); -/** - * Value identifying that numeral shapes are Contextual (Nominal or National - * depending on context) - */ - public static final BidiFlag NUMERALS_CONTEXTUAL - = new BidiFlag(BidiFlagSet.INUMERALS_CONTEXTUAL, BidiFlagSet.NUMERALS_MASK); -/** - * Value identifying that numeral shapes may be Nominal or National - */ - public static final BidiFlag NUMERALS_ANY - = new BidiFlag(BidiFlagSet.INUMERALS_ANY, BidiFlagSet.NUMERALS_MASK); -/** - * Value identifying that the text is stored in Nominal characters - */ - public static final BidiFlag TEXT_NOMINAL - = new BidiFlag(BidiFlagSet.ITEXT_NOMINAL, BidiFlagSet.TEXT_MASK); -/** - * Value identifying that the text is stored in Shaped characters - */ - public static final BidiFlag TEXT_SHAPED - = new BidiFlag(BidiFlagSet.ITEXT_SHAPED, BidiFlagSet.TEXT_MASK); -/** - * Value identifying that the text must be displayed in Initial characters - */ - public static final BidiFlag TEXT_INITIAL - = new BidiFlag(BidiFlagSet.ITEXT_INITIAL, BidiFlagSet.TEXT_MASK); -/** - * Value identifying that the text must be displayed in Middle characters - */ - public static final BidiFlag TEXT_MIDDLE - = new BidiFlag(BidiFlagSet.ITEXT_MIDDLE, BidiFlagSet.TEXT_MASK); -/** - * Value identifying that the text must be displayed in Final characters - */ - public static final BidiFlag TEXT_FINAL - = new BidiFlag(BidiFlagSet.ITEXT_FINAL, BidiFlagSet.TEXT_MASK); -/** - * Value identifying that the text must be displayed in Isolated characters - */ - public static final BidiFlag TEXT_ISOLATED - = new BidiFlag(BidiFlagSet.ITEXT_ISOLATED, BidiFlagSet.TEXT_MASK); - - int value; - int mask; // This makes BidiFlagSet.setOneFlag more efficient - - private BidiFlag(int initValue, int initMask) - { - value = initValue; - mask = initMask; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/BidiFlagSet.java b/cvsroot/src/com/ibm/as400/access/BidiFlagSet.java deleted file mode 100644 index 819dd8817..000000000 --- a/cvsroot/src/com/ibm/as400/access/BidiFlagSet.java +++ /dev/null @@ -1,882 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BidiFlagSet.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.StringTokenizer; - -/** - * This class represents a BidiFlagSet object defining the text attributes - * to be used during a Bidi layout transformation process and the - * available values for each flag. - *

            - * Bidi text can be stored in different formats, which are characterized - * by 5 Bidi attributes, whose values may be stored in 5 Bidi flags. - * These 5 flags constitute a BidiFlagSet. - *

            - * A BidiFlagSet object contains a value for each of the 5 Bidi flags - * which represent the Bidi attributes. The 5 attributes are: - *

              - *
            • type of text (Implicit or Visual) - *
            • orientation (LTR, RTL, Contextual LTR, Contextual RTL) - *
            • symmetric swapping (Yes or No) - *
            • numeral shapes (Nominal, National, Contextual or Any) - *
            • text shapes (Nominal, Shaped, Initial, Middle, Final or Isolated) - *
            - *

            Multi-threading considerations: Different threads may use - * the same BidiFlagSet instance if they all mean it to represent - * identical values of the Bidi attributes. For different values of the - * Bidi attributes, distinct instances of this class must be used. - * - */ - -class BidiFlagSet -{ -/** - * Mask to apply on a BidiFlagSet value to isolate the - * type-of-text flag - */ - static final int TYPE_MASK = 0x03000000; -/** - * Value identifying Implicit type of text - */ - static final int ITYPE_IMPLICIT = 0x01000000; -/** - * Value identifying Visual type of text - */ - static final int ITYPE_VISUAL = 0x03000000; - -/** - * Mask to apply on a BidiFlagSet value to isolate the - * orientation flag - */ - static final int ORIENTATION_MASK = 0x00700000; -/** - * Value identifying LTR orientation - */ - static final int IORIENTATION_LTR = 0x00100000; -/** - * Value identifying RTL orientation - */ - static final int IORIENTATION_RTL = 0x00300000; -/** - * Value identifying Contextual orientation with default to LTR - */ - static final int IORIENTATION_CONTEXT_LTR = 0x00500000; -/** - * Value identifying Contextual orientation with default to RTL - */ - static final int IORIENTATION_CONTEXT_RTL = 0x00700000; - -/** - * Mask to apply on a BidiFlagSet value to isolate the - * symmetric swapping flag - */ - static final int SWAP_MASK = 0x00030000; -/** - * Value identifying that symmetric swapping has been applied - */ - static final int ISWAP_YES = 0x00010000; -/** - * Value identifying that symmetric swapping has not been applied - */ - static final int ISWAP_NO = 0x00030000; - -/** - * Mask to apply on a BidiFlagSet value to isolate the - * numeral shapes flag - */ - static final int NUMERALS_MASK = 0x00000700; -/** - * Value identifying that numeral shapes are Nominal - */ - static final int INUMERALS_NOMINAL = 0x00000100; -/** - * Value identifying that numeral shapes are National - */ - static final int INUMERALS_NATIONAL = 0x00000300; -/** - * Value identifying that numeral shapes are Contextual (Nominal or National - * depending on context) - */ - static final int INUMERALS_CONTEXTUAL = 0x00000500; -/** - * Value identifying that numeral shapes can be Nominal or National - */ - static final int INUMERALS_ANY = 0x00000700; -/** - * Mask to apply on a BidiFlagSet value to isolate the - * text shapes flag - */ - static final int TEXT_MASK = 0x0000000F; -/** - * Value identifying that the text is stored in Nominal characters - */ - static final int ITEXT_NOMINAL = 0x00000001; -/** - * Value identifying that the text is stored in Shaped characters - */ - static final int ITEXT_SHAPED = 0x00000003; -/** - * Value identifying that the text must be displayed in Initial characters - */ - static final int ITEXT_INITIAL = 0x00000005; -/** - * Value identifying that the text must be displayed in Middle characters - */ - static final int ITEXT_MIDDLE = 0x00000007; -/** - * Value identifying that the text must be displayed in Final characters - */ - static final int ITEXT_FINAL = 0x00000009; -/** - * Value identifying that the text must be displayed in Isolated characters - */ - static final int ITEXT_ISOLATED = 0x0000000B; - - -// This is the default value for uninitialized BidiFlagSet. - static final int DEFAULT = ITYPE_IMPLICIT | IORIENTATION_LTR | - ISWAP_YES | INUMERALS_NOMINAL | ITEXT_NOMINAL; - -// This is the only field in this class. - int value; - -/** - * Constructs a BidiFlagSet with the default value. - * The default is: - *

            - *      Type: implicit  Orientation: LTR    Swapping: YES
            - *      Numeral Shapes: Nominal     Text Shapes: Nominal
            - *  
            - */ - public BidiFlagSet() - { - this.value = DEFAULT; - } - -/** - * Constructs a BidiFlagSet based on an existing BidiFlagSet. - * @param model The BidiFlagSet which is copied. - */ - public BidiFlagSet(BidiFlagSet model) - { - this.value = model.value; - } - -/** - * Constructs a BidiFlagSet from one BidiFlag. The other Bidi - * flags are set to their default. - *

            Example: - *

            - *  BidiFlagset bdfs = new BidiFlagSet(ORIENTATION_RTL);
            - *  
            - * - * @param flag The BidiFlag which is explicitly specified. - */ - public BidiFlagSet(BidiFlag flag) - { - this.value = flag.value | DEFAULT; - } - -/** - * Constructs a BidiFlagSet from two BidiFlags. The other Bidi - * flags are set to their default. - * If there is a contradiction or a duplication between the arguments, - * then an IllegalArgumentException is thrown. - *

            Example: - *

            - *  BidiFlagset bdfs = new BidiFlagSet(ORIENTATION_RTL, TYPE_VISUAL);
            - *  
            - * - * @param flag1 The first BidiFlag which is explicitly specified. - * @param flag2 The second BidiFlag which is explicitly specified. - * - * @exception IllegalArgumentException If the arguments conflict or are duplicates. - */ - public BidiFlagSet(BidiFlag flag1, BidiFlag flag2) - { - this.value = flag1.value; - if ((this.value & flag2.value) != 0) throw new IllegalArgumentException(); - this.value |= flag2.value | DEFAULT; - } - -/** - * Constructs a BidiFlagSet from three BidiFlags. The other Bidi - * flags are set to their default. - * If there is a contradiction or a duplication between the arguments, - * then an IllegalArgumentException is thrown. - *

            Example: - *

            - *  BidiFlagset bdfs = new BidiFlagSet(ORIENTATION_RTL, TYPE_VISUAL, SWAP_YES);
            - *  
            - * - * - * @param flag1 The first BidiFlag which is explicitly specified. - * @param flag2 The second BidiFlag which is explicitly specified. - * @param flag3 The third BidiFlag which is explicitly specified. - * - * @exception IllegalArgumentException If the arguments conflict or are duplicates. - */ - public BidiFlagSet(BidiFlag flag1, BidiFlag flag2, BidiFlag flag3) - { - this.value = flag1.value; - if ((this.value & flag2.value) != 0) throw new IllegalArgumentException(); - this.value |= flag2.value; - if ((this.value & flag3.value) != 0) throw new IllegalArgumentException(); - this.value |= flag3.value | DEFAULT; - } - -/** - * Constructs a BidiFlagSet from four BidiFlags. The other Bidi - * flag is set to its default. - * If there is a contradiction or a duplication between the arguments, - * then an IllegalArgumentException is thrown. - * - * @param flag1 The first BidiFlag which is explicitly specified. - * @param flag2 The second BidiFlag which is explicitly specified. - * @param flag3 The third BidiFlag which is explicitly specified. - * @param flag4 The fourth BidiFlag which is explicitly specified. - * - * @exception IllegalArgumentException If the arguments conflict or are duplicates. - */ - public BidiFlagSet(BidiFlag flag1, BidiFlag flag2, - BidiFlag flag3, BidiFlag flag4) - { - this.value = flag1.value; - if ((this.value & flag2.value) != 0) throw new IllegalArgumentException(); - this.value |= flag2.value; - if ((this.value & flag3.value) != 0) throw new IllegalArgumentException(); - this.value |= flag3.value; - if ((this.value & flag4.value) != 0) throw new IllegalArgumentException(); - this.value |= flag4.value | DEFAULT; - } - -/** - * Constructs a BidiFlagSet from five BidiFlags. - * If there is a contradiction or a duplication between the arguments, - * then an IllegalArgumentException is thrown. - * - * @param flag1 The first BidiFlag which is explicitly specified. - * @param flag2 The second BidiFlag which is explicitly specified. - * @param flag3 The third BidiFlag which is explicitly specified. - * @param flag4 The fourth BidiFlag which is explicitly specified. - * @param flag5 The fifth BidiFlag which is explicitly specified. - * - * @exception IllegalArgumentException If the arguments conflict or duplicate - */ - public BidiFlagSet(BidiFlag flag1, BidiFlag flag2, BidiFlag flag3, - BidiFlag flag4, BidiFlag flag5) - { - this.value = flag1.value; - if ((this.value & flag2.value) != 0) throw new IllegalArgumentException(); - this.value |= flag2.value; - if ((this.value & flag3.value) != 0) throw new IllegalArgumentException(); - this.value |= flag3.value; - if ((this.value & flag4.value) != 0) throw new IllegalArgumentException(); - this.value |= flag4.value; - if ((this.value & flag5.value) != 0) throw new IllegalArgumentException(); - this.value |= flag5.value; - } - -/** - * Constructs a BidiFlagSet from a char array. - * The content of the array must follow the specification for the "S" and - * "U" parts of the BIDI environment variable, as follows: - *
              - *
            • character 1: type of text = I (Implicit) or V (Visual) - *
            • character 2: orientation = L (LTR), R (RTL), C (Contextual LTR) or D (Contextual RTL) - *
            • character 3: swapping = Y (Swapping ON) or N (Swapping OFF) - *
            • character 4: text shaping = N (Nominal), S (Shaped), I (Initial), M (Middle), F (Final), B (Isolated) - *
            • character 5: numeral shaping = N (Nominal), H (National), C (Contextual), A (Any) - *
            • character 6: bidi algorithm = U (Unicode), R (Roundtrip) - *
            • character 7: Lamalef mode = G (Grow), S(Shrink), N (Near), B (Begin), E (End), W (groW with space), A (Auto) - *
            • character 8: SeenTail mode = O (One cell), N (Near), B (Begin), E (End), A (Auto) - *
            • character 9: Yeh Hamza mode = O (One cell), N (Near), B (Begin), E (End), A (Auto) - *
            • character 10: Tashkeel mode = Z (Zero width), W (with Width), B (Begin), E (End), A (Auto) - *
            - *

            Only characters 1 to 5 are used to build the BidiFlagSet. - *

            - * @param chars A character array. - */ - public BidiFlagSet(char[] chars) - { - int newValue = DEFAULT; - int len = chars.length; - - while (len > 0) - { - if ('V' == chars[0]) - newValue = (newValue & (~TYPE_MASK)) | ITYPE_VISUAL; - else if ('I' == chars[0]) - newValue = (newValue & (~TYPE_MASK)) | ITYPE_IMPLICIT; - - if (len <= 1) break; - if ('L' == chars[1]) - newValue = (newValue & (~ORIENTATION_MASK)) | IORIENTATION_LTR; - else if ('R' == chars[1]) - newValue = (newValue & (~ORIENTATION_MASK)) | IORIENTATION_RTL; - else if ('C' == chars[1]) - newValue = (newValue & (~ORIENTATION_MASK)) | IORIENTATION_CONTEXT_LTR; - else if ('D' == chars[1]) - newValue = (newValue & (~ORIENTATION_MASK)) | IORIENTATION_CONTEXT_RTL; - - if (len <= 2) break; - if ('Y' == chars[2]) - newValue = (newValue & (~SWAP_MASK)) | ISWAP_YES; - else if ('N' == chars[2]) - newValue = (newValue & (~SWAP_MASK)) | ISWAP_NO; - - if (len <= 3) break; - if ('N' == chars[3]) - newValue = (newValue & (~TEXT_MASK)) | ITEXT_NOMINAL; - else if ('S' == chars[3]) - newValue = (newValue & (~TEXT_MASK)) | ITEXT_SHAPED; - else if ('I' == chars[3]) - newValue = (newValue & (~TEXT_MASK)) | ITEXT_INITIAL; - else if ('M' == chars[3]) - newValue = (newValue & (~TEXT_MASK)) | ITEXT_MIDDLE; - else if ('F' == chars[3]) - newValue = (newValue & (~TEXT_MASK)) | ITEXT_FINAL; - else if ('B' == chars[3]) - newValue = (newValue & (~TEXT_MASK)) | ITEXT_ISOLATED; - - if (len <= 4) break; - if ('N' == chars[4]) - newValue = (newValue & (~NUMERALS_MASK)) | INUMERALS_NOMINAL; - else if ('H' == chars[4]) - newValue = (newValue & (~NUMERALS_MASK)) | INUMERALS_NATIONAL; - else if ('C' == chars[4]) - newValue = (newValue & (~NUMERALS_MASK)) | INUMERALS_CONTEXTUAL; - else if ('A' == chars[4]) - newValue = (newValue & (~NUMERALS_MASK)) | INUMERALS_ANY; - break; - } - - this.value = newValue; - } - -/** - * Constructs a BidiFlagSet from a string. - * The content of the string must follow the syntax of the modifiers - * specified in X/Open standard "Portable Layout Services". - *

            The string contains sequences in the form "keyword=value" - * separated by commas. - *

            - * This format is compatible with the result of the toString method. - * This format is useful when readibility is more important than efficiency. - *

            - * The supported keywords are: typeoftext, orientation, context, swapping, - * numerals and shaping. - *

            - * The following keywords are ignored but do not cause a syntax error: @ls, - * implicitalg, checkmode, shapcharset. - *

            Example: - *

            - *  typeoftext=implicit, orientation=rtl, swap=yes, shaping=nominal, numerals=nominal
            - *  
            - *

            - * @param str A string in the format "flag=value [,...]". - * @exception IllegalArgumentException If the syntax of the data is invalid. - * @see #toString - */ - public BidiFlagSet(String str) throws IllegalArgumentException - { - int n = parseBidiFlagSet(str); - if (n < 0) throw new IllegalArgumentException(); - this.value = n; - } - -/** - * Compares two BidiFlagSets. - * Two BidiFlagSets are considered equal if they represent the same values - * for the 5 Bidi flags. - * @param other The BidiFlagSet to compare to this. - * @return true if the BidiFlagSets are equal, false otherwise. - */ - public boolean equals(Object obj) - { - if (obj == null) return false; - if (obj instanceof BidiFlagSet) { - BidiFlagSet other = (BidiFlagSet) obj; - return this.value == other.value; - } else { - return false; - } - - } - -/** - * Returns the numeral shapes flag from a BidiFlagSet. - * @return The value of the numeral shapes flag. - *

            The expected value is one of NUMERALS_NOMINAL, NUMERALS_NATIONAL, - * NUMERALS_CONTEXTUAL, NUMERALS_ANY. - *
            It can be tested as in the following example: - *

            - *  if (getNumerals(myFlags) == NUMERALS_NATIONAL) . . .
            - *  
            - */ - public BidiFlag getNumerals() - { - switch(this.value & NUMERALS_MASK) - { - case INUMERALS_NOMINAL: return BidiFlag.NUMERALS_NOMINAL; - case INUMERALS_NATIONAL: return BidiFlag.NUMERALS_NATIONAL; - case INUMERALS_CONTEXTUAL: return BidiFlag.NUMERALS_CONTEXTUAL; - case INUMERALS_ANY: return BidiFlag.NUMERALS_ANY; - } - return BidiFlag.NUMERALS_NOMINAL; - } - -/** - * Returns the orientation flag from a BidiFlagSet. - * @return The value of the orientation flag. - *

            The expected value is one of ORIENTATION_LTR, ORIENTATION_RTL, - * ORIENTATION_CONTEXT_LTR, ORIENTATION_CONTEXT_RTL. - *
            It can be tested as in the following example: - *

            - *  if (getOrientation(myFlags) == ORIENTATION_RTL) . . .
            - *  
            - */ - public BidiFlag getOrientation() - { - switch(this.value & ORIENTATION_MASK) - { - case IORIENTATION_LTR: return BidiFlag.ORIENTATION_LTR; - case IORIENTATION_RTL: return BidiFlag.ORIENTATION_RTL; - case IORIENTATION_CONTEXT_LTR: return BidiFlag.ORIENTATION_CONTEXT_LTR; - case IORIENTATION_CONTEXT_RTL: return BidiFlag.ORIENTATION_CONTEXT_RTL; - } - return BidiFlag.ORIENTATION_LTR; - } - -/** - * Returns the symmetric swapping flag from a BidiFlagSet. - * @return The value of the symmetric swapping flag. - *

            The expected value is one of SWAP_YES, SWAP_NO. - *
            It can be tested as in the following example: - *

            - *  if (getSwap(myFlags) == SWAP_YES) . . .
            - *  
            - */ - public BidiFlag getSwap() - { - switch(this.value & SWAP_MASK) - { - case ISWAP_YES: return BidiFlag.SWAP_YES; - case ISWAP_NO: return BidiFlag.SWAP_NO; - } - return BidiFlag.SWAP_YES; - } - -/** - * Returns the text shapes flag from a BidiFlagSet. - * @return The value of the text shapes flag. - *

            The expected value is one of TEXT_NOMINAL, TEXT_SHAPED, - * TEXT_INITIAL, TEXT_MIDDLE, TEXT_FINAL, TEXT_ISOLATED. - *
            It can be tested as in the following example: - *

            - *  if (getText(myFlags) == TEXT_MIDDLE) . . .
            - *  
            - */ - public BidiFlag getText() - { - switch(this.value & TEXT_MASK) - { - case ITEXT_NOMINAL: return BidiFlag.TEXT_NOMINAL; - case ITEXT_SHAPED: return BidiFlag.TEXT_SHAPED; - case ITEXT_INITIAL: return BidiFlag.TEXT_INITIAL; - case ITEXT_MIDDLE: return BidiFlag.TEXT_MIDDLE; - case ITEXT_FINAL: return BidiFlag.TEXT_FINAL; - case ITEXT_ISOLATED: return BidiFlag.TEXT_ISOLATED; - } - return BidiFlag.TEXT_NOMINAL; - } - -/** - * Returns the type-of-text flag from a BidiFlagSet. - * @return The value of the type-of-text flag. - *

            The expected value is one of TYPE_IMPLICIT, TYPE_VISUAL. - *
            It can be tested as in the following example: - *

            - *  if (getType(myFlags) == TYPE_VISUAL) . . .
            - *  
            - */ - public BidiFlag getType() - { - switch(this.value & TYPE_MASK) - { - case ITYPE_IMPLICIT: return BidiFlag.TYPE_IMPLICIT; - case ITYPE_VISUAL: return BidiFlag.TYPE_VISUAL; - } - return BidiFlag.TYPE_IMPLICIT; - } - -/** - * Returns a hashcode for a BidiFlagSet. - * The hashcode of a BidiFlagSet is the same as the hashcode of its - * value. - * @return A hashcode value. - */ - public int hashCode() - { - return this.value; - } - -/** - * Computes the value of a BidiFlagSet specified as text. - * The text must follow the syntax of modifiers detailed in X/Open - * "Portable Layout Services". - * This format is compatible with the result of the toString method. - * This format is useful when readibility is more important than efficiency. - *

            - * The supported keywords are: typeoftext, orientation, context, swapping, - * numerals and shaping. - *

            - * The following keywords are ignored but do not cause a syntax error: @ls, - * implicitalg, checkmode, shapcharset. - * @param str a string in the format "flag=value [,...]" - * @return The value of the BidiFlagSet object if str is correct; - * if the syntax is invalid, the return value is a negative number - * whose absolute value is the ordinal (starting from 1) of the first - * invalid word token (disregarding punctuation). - * @see #toString - */ - private static int parseBidiFlagSet(String str) - { - int newValue = 0; - int counter = 0; - String token, keyword = ""; - StringTokenizer stok = new StringTokenizer(str, "\t ,="); - - while (stok.hasMoreElements()) { - token = stok.nextToken(); - counter--; - if (token.equals("@ls")) continue; - if (token.equals("implicitalg") || - token.equals("checkmode") || - token.equals("shapcharset") ) { - keyword = "allowed"; - continue; - } - if (token.equals("typeoftext") || - token.equals("orientation") || - token.equals("context") || - token.equals("swapping") || - token.equals("numerals") || - token.equals("shaping") ) { - keyword = token; - continue; - } - if (token.equals("visual")) { - if (!keyword.equals("typeoftext")) return counter; - newValue = (newValue & (~TYPE_MASK)) | ITYPE_VISUAL; - continue; - } - if (token.equals("implicit")) { - if (!keyword.equals("typeoftext")) return counter; - newValue = (newValue & (~TYPE_MASK)) | ITYPE_IMPLICIT; - continue; - } - if (token.equals("ltr")) { - if (keyword.equals("orientation")) - { - newValue = (newValue & (~ORIENTATION_MASK)) | IORIENTATION_LTR; - continue; - } - if (keyword.equals("context")) - { - if ((newValue & ORIENTATION_MASK) != IORIENTATION_LTR && - (newValue & ORIENTATION_MASK) != IORIENTATION_RTL) - newValue = (newValue & (~ORIENTATION_MASK)) | - IORIENTATION_CONTEXT_LTR; - continue; - } - return counter; - } - if (token.equals("rtl")) { - if (keyword.equals("orientation")) - { - newValue = (newValue & (~ORIENTATION_MASK)) | IORIENTATION_RTL; - continue; - } - if (keyword.equals("context")) - { - if ((newValue & ORIENTATION_MASK) != IORIENTATION_LTR && - (newValue & ORIENTATION_MASK) != IORIENTATION_RTL) - newValue = (newValue & (~ORIENTATION_MASK)) | - IORIENTATION_CONTEXT_RTL; - continue; - } - return counter; - } - if (token.equals("contextual")) { - if (keyword.equals("orientation")) - { - if ((newValue & ORIENTATION_MASK) == IORIENTATION_CONTEXT_RTL) - continue; - newValue = ((newValue & (~ORIENTATION_MASK)) | - IORIENTATION_CONTEXT_LTR); - continue; - } - if (keyword.equals("numerals")) - { - newValue = (newValue & (~NUMERALS_MASK)) | INUMERALS_CONTEXTUAL; - continue; - } - return counter; - } - if (token.equals("yes")) { - if (!keyword.equals("swapping")) return counter; - newValue = (newValue & (~SWAP_MASK)) | ISWAP_YES; - continue; - } - if (token.equals("no")) { - if (!keyword.equals("swapping")) return counter; - newValue = (newValue & (~SWAP_MASK)) | ISWAP_NO; - continue; - } - if (token.equals("nominal")) { - if (keyword.equals("numerals")) - { - newValue = (newValue & (~NUMERALS_MASK)) | INUMERALS_NOMINAL; - continue; - } - if (keyword.equals("shaping")) - { - newValue = (newValue & (~TEXT_MASK)) | ITEXT_NOMINAL; - continue; - } - return counter; - } - if (token.equals("national")) { - if (!keyword.equals("numerals")) return counter; - newValue = (newValue & (~NUMERALS_MASK)) | INUMERALS_NATIONAL; - continue; - } - if (token.equals("any")) { - if (!keyword.equals("numerals")) return counter; - newValue = (newValue & (~NUMERALS_MASK)) | INUMERALS_ANY; - continue; - } - if (token.equals("shaped")) { - if (!keyword.equals("shaping")) return counter; - newValue = (newValue & (~TEXT_MASK)) | ITEXT_SHAPED; - continue; - } - if (token.equals("shform1")) { - if (!keyword.equals("shaping")) return counter; - newValue = (newValue & (~TEXT_MASK)) | ITEXT_INITIAL; - continue; - } - if (token.equals("shform2")) { - if (!keyword.equals("shaping")) return counter; - newValue = (newValue & (~TEXT_MASK)) | ITEXT_MIDDLE; - continue; - } - if (token.equals("shform3")) { - if (!keyword.equals("shaping")) return counter; - newValue = (newValue & (~TEXT_MASK)) | ITEXT_FINAL; - continue; - } - if (token.equals("shform4")) { - if (!keyword.equals("shaping")) return counter; - newValue = (newValue & (~TEXT_MASK)) | ITEXT_ISOLATED; - continue; - } - if (keyword.equals("allowed")) continue; - return counter; - } - return newValue | DEFAULT; - } - -/** - * Sets all bidi flags based on another BidiFlagSet. - * @param model The BidiFlagSet which is copied. - */ - public void setAllFlags(BidiFlagSet model) - { - this.value = model.value; - } - -/** - * Sets all bidi flags from a string. - * The content of the string must follow the syntax of modifiers - * specified in X/Open standard "Portable Layout Services". - *

            The string contains sequences of the form "keyword=value" - * separated by commas. - *

            - * This format is compatible with the result of the toString method. - * This format is useful when readibility is more important than efficiency. - *

            - * The supported keywords are: typeoftext, orientation, context, swapping, - * numerals and shaping. - *

            - * The following keywords are ignored but do not cause a syntax error: @ls, - * implicitalg, checkmode, shapcharset. - *

            Example: - *

            - *  typeoftext=visual, orientation=ltr, swap=no, shaping=shaped, numerals=contextual
            - *  
            - *

            - * @param str A string in the format "flag=value [,...]". - * @exception IllegalArgumentException If the syntax of the data is invalid. - * @see #toString - */ - public void setAllFlags(String str) throws IllegalArgumentException - { - int n = parseBidiFlagSet(str); - if (n < 0) throw new IllegalArgumentException(); - this.value = n; - } - -/** - * Sets all the Bidi flags in 2 BidiFlagSets based on a string. - * The content of the string must follow the syntax of modifiers - * specified in X/Open standard "Portable Layout Services". - * This may be used to specify in one operation the Bidi flags of the source - * and the destination of a transformation. - *

            The string contains sequences of the form "keyword=value" or - * "keyword=value1:value2", with a separating comma. - * Each keyword is followed by one or two values. In the first case, - * this value applies to both source and destination. In the second case, - * the two values are separated by a colon; the first value applies to - * the source and the second value to the destination. - *

            - * The supported keywords are: typeoftext, orientation, context, swapping, - * numerals and shaping. - *

            - * The following keywords are ignored but do not cause a syntax error: @ls, - * implicitalg, checkmode, shapcharset. - *

            Example: the source flags are "implicit, ltr, swapping on"; the - * target flags are "visual, ltr, no swapping". The string will be: - *

            - *  typeoftext=implicit:visual, orientation=ltr, swapping=yes:no
            - *  
            - * @param flags1 The first BidiFlagSet to be set. - * @param flags2 The second BidiFlagSet to be set. - * @param str A string in the format "flag=value [,...]". - * - * @exception IllegalArgumentException If the syntax of the data is invalid. - */ - public static void set2AllFlags(BidiFlagSet flags1, BidiFlagSet flags2, - String str) throws IllegalArgumentException - { - int capacity = str.length(); - StringBuffer sb1 = new StringBuffer(capacity); - StringBuffer sb2 = new StringBuffer(capacity); - StringTokenizer stok = new StringTokenizer(str, "\t ,=:", true); - String token; - int sb2Length = 0; - boolean colon = false; - - while (stok.hasMoreElements()) { - token = stok.nextToken(); - if (token.equals(" ") || token.equals("\t")) - { - sb1.append(token); - sb2.append(token); - continue; - } - if (token.equals(",") || token.equals("=")) - { - colon = false; - sb1.append(token); - sb2.append(token); - continue; - } - if (token.equals(":")) - { - colon = true; - sb2.setLength(sb2Length); - continue; - } - if (!colon) sb1.append(token); - sb2Length = sb2.length(); - sb2.append(token); - colon = false; - } - - flags1.setAllFlags(sb1.toString()); - flags2.setAllFlags(sb2.toString()); - } - -/** - * Sets a new value for one of the Bidi flags in a set without changing - * the other Bidi flags. - *

            The new value must be one of the pre-defined values for BidiFlag. - * - * @param newFlag The new value requested for one of the flags. - */ - public void setOneFlag(BidiFlag newFlag) - { - this.value = (this.value & (~newFlag.mask)) | newFlag.value; - } - -/** - * Creates a string that represents the various Bidi flags grouped in - * a BidiFlagSet. This may be useful for instance for debugging. - *

            - * The format is compatible with the syntax of modifiers in X/Open standard - * "Portable Layout Services". - *

            - * For each flag, an expression of the form "keyword=value" is added - * to the string. Adjacent expressions are separated by a comma and a - * space. - *

            The keywords and their respective sets of values are: - *

            - *  KEYWORD         VALUES
            - *  -----------     ---------------
            - *  typeoftext      implicit visual
            - *  orientation     ltr rtl contextual
            - *  context         ltr rtl
            - *  swapping        yes no
            - *  numerals        nominal national contextual any
            - *  shaping         nominal shaped shform1 shform2 shform3 shform4
            - *  
            - * @return A human readable form of the flag values. - */ - public String toString() - { - return BidiFlagSet.toString(this.value); - } - -/** - * Class method parallel to the instance method with the same name. - * @param value The value of a BidiFlagSet. - * @return A human readable form of the flag values. - */ - static String toString(int value) - { - final String[] typeStrings = {"implicit", "visual"}; - final String[] orientationStrings = {"ltr", "rtl", - "contextual, context=ltr", "contextual, context=rtl"}; - final String[] swapStrings = {"yes", "no"}; - final String[] numeralsStrings = {"nominal", "national", - "contextual", "any"}; - final String[] textStrings = {"nominal", "shaped", "shform1", - "shform2", "shform3", "shform4", "invalid", "invalid"}; - - return "typeoftext=" + typeStrings[(value & TYPE_MASK)>>25] + - ", " + - "orientation=" + - orientationStrings[(value & ORIENTATION_MASK)>>21] + - ", " + - "swapping=" + swapStrings[(value & SWAP_MASK)>>17] + - ", " + - "numerals=" + numeralsStrings[(value & NUMERALS_MASK)>>9] + - ", " + - "shaping=" + textStrings[(value & TEXT_MASK)>>1]; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/BidiOrder.java b/cvsroot/src/com/ibm/as400/access/BidiOrder.java deleted file mode 100644 index 33f0a3b45..000000000 --- a/cvsroot/src/com/ibm/as400/access/BidiOrder.java +++ /dev/null @@ -1,1609 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BidiOrder.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Vector; - -/** - *

            Multi-threading considerations: This class is thread-safe, - * since its only public method is synchronized, and all instance variables - * are initialized within this method. However, to avoid delays, each - * thread should use its own instances of this class. - **/ - -class BidiOrder -{ - -// Private Variables : -// ---------------- - -//private int srcLen; // length of source text to process - -//private String buffer_in ; - - private static final int UBAT_B = 0; /* block separator */ - private static final int UBAT_S = 1; /* segment separator */ - private static final int UBAT_L = 2; /* left to right */ - private static final int UBAT_R = 3; /* right to left */ - private static final int UBAT_EN = 4; /* European digit */ - private static final int UBAT_AN = 5; /* Arabic-Indic digit */ - private static final int UBAT_W = 6; /* white space */ - private static final int UBAT_N = 7; /* neutral */ - private static final int UBAT_BD = 8; /* bidi special codes */ - private static final int UBAT_AL = 9; /* Arabic Letter */ - private static final int UBAT_ET = 10; /* European digit terminator */ - private static final int UBAT_ES = 11; /* European digit separator */ - private static final int UBAT_CS = 12; /* common digit separator */ - private static final int UBAT_NSM =13; /* Non Spacing Mark */ - - private static final int ITIL = 8; - private static final int ITCOND = 9; - - private static final byte UBAT_N_SWAP = -UBAT_N; - private static final byte IMP_LTR = 4; - private static final byte IMP_RTL = 8; - private static final byte ORIG = 0; - private static final byte FINAL = 1; - private static final char LRM = 0x200E; - private static final char RLM = 0x200F; - private static final int BEFORE = 0; - private static final int AFTER = 1<<16; - private static final char NODELIM = 0xFFFF; -/*****************************************************************************/ -/* Not Spacing characters*/ -/*-----------------------*/ - private static final char notSpacing[][] = { /* 60, 2 */ - {0x0300, 0x0385} , - {0x0483, 0x0486} , - {0x05B0, 0x05BD} , - {0x05BF, 0x05BF} , - {0x05C1, 0x05C2} , - {0x05F5, 0x05F5} , - {0x064B, 0x0652} , - {0x0670, 0x0670} , - {0x06D6, 0x06E4} , - {0x06E7, 0x06E8} , - {0x06EA, 0x06ED} , - {0x0901, 0x0902} , - {0x093C, 0x093C} , - {0x0941, 0x0948} , - {0x094D, 0x094D} , - {0x0951, 0x0954} , - {0x0962, 0x0963} , - {0x0981, 0x0981} , - {0x09BC, 0x09BC} , - {0x09C1, 0x09C4} , - {0x09CD, 0x09CD} , - {0x09E2, 0x09E3} , - {0x0A02, 0x0A02} , - {0x0A3C, 0x0A3C} , - {0x0A41, 0x0A4C} , - {0x0A70, 0x0A71} , - {0x0A81, 0x0A82} , - {0x0ABC, 0x0ABC} , - {0x0AC1, 0x0AC8} , - {0x0ACD, 0x0ACD} , - {0x0B01, 0x0B01} , - {0x0B3C, 0x0B3C} , - {0x0B3F, 0x0B3F} , - {0x0B41, 0x0B43} , - {0x0B4D, 0x0B4D} , - {0x0BC0, 0x0BC0} , - {0x0BCD, 0x0BCD} , - {0x0C3E, 0x0C40} , - {0x0C46, 0x0C56} , - {0x0CBF, 0x0CBF} , - {0x0CC6, 0x0CC6} , - {0x0CCC, 0x0CCD} , - {0x0D41, 0x0D43} , - {0x0D4D, 0x0D4D} , - {0x0E31, 0x0E31} , - {0x0E34, 0x0E3A} , - {0x0E47, 0x0E4D} , - {0x0EB1, 0x0EB1} , - {0x0EB4, 0x0EBC} , - {0x0EC8, 0x0ECD} , - {0x1026, 0x102A} , - {0x102E, 0x102E} , - {0x1030, 0x1030} , - {0x1036, 0x1037} , - {0x103B, 0x103B} , - {0x103D, 0x103E} , - {0x104B, 0x104C} , - {0x20D0, 0x20FF} , - {0x302A, 0x302F} , - {0x3099, 0x309A} - - }; - -/***********************************************************************/ -/* Symmetric Pairs */ -/*-----------------*/ - private static final char symPairs[][] = { - {0x0028, 0x0029} , - {0x0029, 0x0028} , - {0x003C, 0x003E} , - {0x003E, 0x003C} , - {0x005B, 0x005D} , - {0x005D, 0x005B} , - {0x007B, 0x007D} , - {0x007D, 0x007B} , - {0x00AB, 0x00BB} , - {0x00BB, 0x00AB} , - {0x207D, 0x207E} , - {0x207E, 0x207D} , - {0x208D, 0x208E} , - {0x208E, 0x208D} , - {0x2329, 0x232A} , - {0x232A, 0x2329} , - {0xFE59, 0xFE5A} , - {0xFE5A, 0xFE59} , - {0xFE5B, 0xFE5C} , - {0xFE5C, 0xFE5B} , - {0xFE5D, 0xFE5E} , - {0xFE5E, 0xFE5D} , - {0xFE64, 0xFE65} , - {0xFE65, 0xFE64} - }; - -/**************************************************************************/ - private static final short impTab_LTR[][] = - { - /* B, S, L, R, EN, AN, W, N, IL, Cond */ - -/* 0 LTR text */ { 0, 0, 0, 3, 0, 1, 0, 0, 0, 0}, -/* 1 LTR+AN */ { 0, 0, 0, 3, 0, 1, 2, 2, 2, 0}, -/* 2 LTR+AN+N */ { 0, 0, 0, 3, 0, 0x11, 2, 2, 0, 1}, -/* 3 RTL text */ { 0, 0, 0, 3, 5, 5, 4, 4, 1, 0}, -/* 4 RTL cont */ { 0, 0, 0, 3, 0x15, 0x15, 4, 4, 0, 1}, -/* 5 RTL+EN/AN */ { 0, 0, 0, 3, 5, 5, 4, 4, 2, 0} - }; - -/**************************************************************************/ - private static final short impTab_RTL[][] = - { - /* B, S, L, R, EN, AN, W, N, IL, Cond */ - -/* 0 RTL text */ { 0, 0, 2, 0, 1, 1, 0, 0, 0, 0}, -/* 1 RTL+EN/AN */ { 0, 0, 2, 0, 1, 1, 0, 0, 1, 0}, -/* 2 LTR text */ { 0, 0, 2, 0, 2, 1, 3, 3, 1, 0}, -/* 3 LTR+cont */ { 0, 0, 2, 0, 2, 0x21, 3, 3, 0, 1} - }; - -/**************************************************************************/ - private static final short impTab_LTR_r[][] = /* round trip */ - { - /* B, S, L, R, EN, AN, W, N, IL, Cond */ - -/* 0 LTR text */ { 0, 0, 0, 2, 0, 1, 0, 0, 0, 0}, -/* 1 LTR+AN */ { 0, 0, 0, 2, 0, 1, 3, 3, 2, 0}, -/* 2 RTL text */ { 0, 0, 0, 2, 4, 1, 3, 3, 1, 0}, -/* 3 RTL cont */ { 0, 0, 0, 0x22, 4, 4, 3, 3, 1, 1}, -/* 4 RTL+EN/AN */ { 0, 0, 0, 0x22, 4, 4, 3, 3, 2, 1} - }; - -/**************************************************************************/ - private static final short impTab_RTL_r[][] = /* round trip */ - { - /* B, S, L, R, EN, AN, W, N, IL, Cond */ - -/* 0 RTL text */ { 0, 0, 3, 0, 1, 2, 0, 0, 0, 0}, -/* 1 RTL+EN */ {0x20, 0x20, 3, 0x20, 1, 0x22, 5, 5, 1, 1}, -/* 2 RTL+AN */ { 0, 0, 3, 0, 1, 2, 0, 0, 1, 0}, -/* 3 LTR text */ { 0, 0, 3, 0, 3, 2, 4, 4, 1, 0}, -/* 4 LTR+cont */ { 0, 0, 3, 0, 3, 0x22, 4, 4, 0, 1}, -/* 5 RTL+EN+cont */ {0x20, 0x20, 3, 0x20, 1, 0x22, 5, 5, 0, 1} - }; - -/**************************************************************************/ - private static final short impTab_LTR_w[][] = /* windows compatible */ - { - /* B, S, L, R, EN, AN, W, N, IL, Cond */ - -/* 0 LTR text */ { 0, 0, 0, 2, 1, 1, 0, 0, 0, 0}, -/* 1 LTR+EN/AN */ { 0, 0, 0, 2, 1, 1, 0, 0, 2, 0}, -/* 2 RTL text */ { 0, 0, 0, 2, 4, 4, 3, 3, 1, 0}, -/* 3 RTL cont */ { 0, 0, 0, 2, 0x14, 0x14, 3, 3, 0, 1}, -/* 4 RTL+EN/AN */ { 0, 0, 0, 2, 4, 4, 3, 3, 2, 0} - }; - -/**************************************************************************/ - private static final short impTab_LTR_m[][] = /* insert markers */ - { - /* B, S, L, R, EN, AN, W, N, IL, Cond */ - -/* 0 LTR */ { 0, 0, 0, 0x63, 0, 1, 0, 0, 0, 0}, -/* 1 LTR+AN */ { 0, 0, 0, 0x63, 0, 1, 2, 2, 2, 0}, -/* 2 LTR+AN+N */ { 0, 0, 0, 0x63, 0, 0x21, 2, 2, 1, 1}, -/* 3 RTL text */ { 0, 0, 0, 0x63, 0x55, 0x56, 4, 4, 1, 0}, -/* 4 RTL cont */ {0x30, 0x30, 0x30, 0x43, 0x55, 0x56, 4, 4, 1, 1}, -/* 5 RTL+EN */ {0x30, 0x30, 0x30, 0x43, 5, 0x56, 4, 4, 2, 0}, -/* 6 RTL+AN */ {0x30, 0x30, 0x30, 0x43, 0x55, 6, 4, 4, 2, 0} - }; -// The case handled in this table is (visually): R EN L - -/**************************************************************************/ - private static final short impTab_RTL_m[][] = /* insert markers */ - { - /* B, S, L, R, EN, AN, W, N, IL, Cond */ - -/* 0 RTL text */ { 0, 0, 3, 0, 1, 1, 0, 0, 0, 0}, -/* 1 RTL+EN/AN */ { 0, 0, 0x73, 0, 1, 1, 2, 2, 1, 0}, -/* 2 RTL+EN/AN+N */ { 0, 0, 0x73, 0, 1, 1, 2, 2, 0, 0}, -/* 3 LTR text */ { 0, 0, 3, 0, 3, 0x86, 4, 4, 1, 0}, -/* 4 LTR+N */ {0x90, 0x90, 0xA3, 0x90, 5, 0x86, 4, 4, 0, 1}, -/* 5 LTR+EN */ {0x90, 0x90, 0xA3, 0x90, 5, 0x86, 4, 4, 1, 1}, -/* 6 LTR+AN */ {0x90, 0x90, 0xA3, 0x90, 6, 6, 4, 4, 1, 1} - }; -// The cases handled in this table are (visually): R EN L -// R L AN L - -/**************************************************************************/ - private static final short impTab_LTR_wm[][] = /* markers & windows */ - { - /* B, S, L, R, EN, AN, W, N, IL, Cond */ - -/* 0 LTR */ { 0, 0, 0, 0x62, 1, 1, 0, 0, 0, 0}, -/* 1 LTR+EN/AN */ { 0, 0, 0, 0x62, 1, 1, 0, 0, 2, 0}, -/* 2 RTL text */ { 0, 0, 0, 0x62, 0x54, 0x54, 3, 3, 1, 0}, -/* 3 RTL cont */ {0x30, 0x30, 0x30, 0x42, 0x54, 0x54, 3, 3, 1, 1}, -/* 4 RTL+EN/AN */ {0x30, 0x30, 0x30, 0x42, 4, 4, 3, 3, 2, 0} - }; -// The case handled in this table is (visually): R EN L - - -/***************************/ -/* */ -/* Fields from ucbStruct */ -/* */ -/***************************/ - - int ucb_ix ; // index of currently processed character in source order - // target area - - byte ucb_outLev; // Output Level = 0 or 1 according to the direction of output - // specified in argument 5 (0 = LTR, 1 = RTL) - - byte ucb_basLev; // Base Level = 0 or 1 (0 = LTR, 1 = RTL) - - byte ucb_curLev; // Current Level = between basLev and 15; initially set equal to basLev; - // modified by LRE/RLE/LRO/RLO/PDF - - int ucb_impSta; // Implicit State = between 0 and 18 /.../ - - int ucb_condPos; // hold the position of a conditional string - - int ucb_xType; // Specifies character type for which - // will be computed Implicit level - - byte ucb_wTarget; // value to put in the output area - -/***************************/ -/* */ -/* Fields from icsStruct */ -/* */ -/***************************/ - - BidiFlag ics_num_flag; - // Numeric Shape selector = set initially according to argument 6 - // (set to 0 if nominal shaping of European numerals is selected; - // set to 1 if Arabic-Indic shaping is selected; - // set to 2 if contextual shaping is selected); - // set to 0 when meeting U+206F; set to 1 when meeting U+206E - - boolean ics_symmetric; // Character Swapping selector = set initially according to Swapping - // (set to 0 if inhibit swapping is selected; - // set to 1 if activate is selected); - // set to 0 when meeting U+206A; set to 1 when meeting U+206B - - BidiFlag ics_orient_in; - BidiFlag ics_orient_out; - BidiFlag ics_type_in; - BidiFlag ics_type_out; - BidiTransform myBdx; /* local reference of bdx */ - int ics_size; /* length of source text to process */ - char[] ics_buffer_in; - char[] ics_buffer_out; - boolean invertInput; - boolean visToVis; - short impTab[][]; - byte typeArray[][]; - - boolean insertMarkers; - int insertCnt; /* number of confirmed inserts */ - int removeCnt; /* number of LRM/RLMs to remove */ - int startL2EN; /* start of level 2 run */ - int lastStrongRTL; /* index of last found R or AL */ - boolean reqImpToImp; /* impToImp request */ - int impToImpOrient; - int impToImpPhase; - char delim1; /* starting delimiter */ - char delim2; /* ending delimiter */ - -/*------------------------------------------------------------------------*/ - - private static boolean odd(int n) - { - return (n & 1) == 1; - } - -/*------------------------------------------------------------------------*/ - - private static boolean even(int n) - { - return (n & 1) == 0; - } - -/*------------------------------------------------------------------------*/ - - private static void invertMap(int[] buffer, int lower_limit, int upper_limit) - /* invert a buffer of ints, between lower_limit and upper_limit */ - { - int temp; - - for (; lower_limit < upper_limit; lower_limit++, upper_limit--) - { - temp = buffer[lower_limit]; - buffer[lower_limit] = buffer[upper_limit]; - buffer[upper_limit] = temp; - } - } - -/*------------------------------------------------------------------------*/ - - private static void invertMap(byte[] buffer, int lower_limit, int upper_limit) - /* invert a buffer of bytes, between lower_limit and upper_limit */ - { - byte temp; - - for (; lower_limit < upper_limit; lower_limit++, upper_limit--) - { - temp = buffer[lower_limit]; - buffer[lower_limit] = buffer[upper_limit]; - buffer[upper_limit] = temp; - } - } - -/*------------------------------------------------------------------------*/ - - private static boolean UCQSPAC(char x) - { - int low, high, mid; - - low = 0; - high = notSpacing.length - 1; - while (low <= high) - { - mid = (low + high) / 2; - if (x < notSpacing[mid][0]) - high = mid - 1; - else if (x > notSpacing[mid][1]) - low = mid + 1; - else - return(false); - } - return(true); - } - -/*------------------------------------------------------------------------*/ - - private static char UCQSYMM(char x) - { - int low, high, mid; - char c; - - low = 0; - high = 23; - - while (low <= high) - { - mid = (low + high) / 2; - c = symPairs[mid][0]; - if (x < c) - high = mid - 1; - else if (x > c) - low = mid + 1; - else - return(symPairs[mid][1]); - } - return x; - } - -/*********************************************************************/ -/* */ -/* This function fills typeArray with 2 ch_types: one original, and */ -/* one simplified after resolving numbers, NSMs and others */ -/* */ -/*********************************************************************/ - private void fillTypeArray() - { - int i, prev; - byte cType, wType; - boolean isArabic = false; - byte[][] ta; - char c; - int delimState; /* 0 = before delim1 - 1 = after delim1 - 2 = got pair of delim2 after delim1 */ - ta = typeArray; - delimState = 0; - for (i = 0; i < ics_size; i++) - { - c = ics_buffer_in[i]; - cType = getChType(c, myBdx.wordBreak); - ta[i][ORIG] = cType; - ta[i][FINAL] = UBAT_N; - if (delim1 != NODELIM) - { - if (delimState == 0) - { - if (c == delim1) - delimState = 1; - cType = UBAT_B; - } - else if (delimState == 1) - { - if (c == delim2) - { - if (((i+1) < ics_size) && (ics_buffer_in[i+1] == delim2)) - delimState = 2; - else - { - delimState = 0; - cType = UBAT_B; - } - } - } - else /* must be delimState == 2 */ - delimState = 1; - } - if (visToVis) - continue; - switch (cType) - { - case UBAT_B: - isArabic = false; - ta[i][FINAL] = UBAT_B; - break; - case UBAT_S: - /* anything to do for segment separator ??? */ - ta[i][FINAL] = UBAT_S; - break; - case UBAT_L: - isArabic = false; - ta[i][FINAL] = UBAT_L; - break; - case UBAT_R: - isArabic = false; - ta[i][FINAL] = UBAT_R; - break; - case UBAT_AL: - isArabic = true; - ta[i][FINAL] = UBAT_R; - break; - case UBAT_EN: - if (isArabic) - { - wType = UBAT_AN; - } - else - { - wType = UBAT_EN; - if ((i >= 2) && (ta[i-1][ORIG] == UBAT_ES) - && (ta[i-2][ORIG] == UBAT_EN)) - ta[i-1][FINAL] = UBAT_EN; - prev = i - 1; - while ((prev >= 0) && (ta[prev][ORIG] == UBAT_ET)) - ta[prev--][FINAL] = UBAT_EN; - } - if ((i >= 2) && (ta[i-1][ORIG] == UBAT_CS) - && (ta[i-2][ORIG] == UBAT_EN)) - ta[i-1][FINAL] = wType; - ta[i][FINAL] = wType; - break; - case UBAT_AN: - if ((i >= 2) && (ta[i-1][ORIG] == UBAT_CS) - && (ta[i-2][FINAL] == UBAT_AN)) - ta[i-1][FINAL] = UBAT_AN; - ta[i][FINAL] = UBAT_AN; - break; - case UBAT_W: - ta[i][FINAL] = UBAT_W; - break; - case UBAT_ET: - if ((i > 0) && (ta[i-1][FINAL] == UBAT_EN)) - ta[i][FINAL] = UBAT_EN; - break; - case UBAT_NSM: - /* This code does not support NSMs within RTL text in Visual type - input data. We have seen no requirements for such combination. */ - if (i <= 0) break; - ta[i][FINAL] = ta[i-1][FINAL]; - break; - } - } - } - -/*------------------------------------------------------------------------*/ - - private void fillTypeArray2() - { - int i, k, prev; - byte cType, wType; - boolean isArabic = false; - byte[][] ta; - - ta = typeArray; - for (i = 0; i < ics_size; i++) - { - k = myBdx.dstToSrcMap[i]; - cType = ta[k][ORIG]; /* ok even for UBAT_N_SWAP */ - if ((delim1 != NODELIM) && (ta[k][FINAL] == UBAT_B)) - cType = UBAT_B; - else ta[k][FINAL] = UBAT_N; - switch (cType) - { - case UBAT_B: - isArabic = false; - ta[k][FINAL] = UBAT_B; - break; - case UBAT_S: - /* anything to do for segment separator ??? */ - ta[k][FINAL] = UBAT_S; - break; - case UBAT_L: - isArabic = false; - ta[k][FINAL] = UBAT_L; - break; - case UBAT_R: - isArabic = false; - ta[k][FINAL] = UBAT_R; - break; - case UBAT_AL: - isArabic = true; - ta[k][FINAL] = UBAT_R; - break; - case UBAT_EN: - if (isArabic) - { - wType = UBAT_AN; - } - else - { - wType = UBAT_EN; - if ((i >= 2) && (ta[myBdx.dstToSrcMap[i-1]][ORIG] == UBAT_ES) - && (ta[myBdx.dstToSrcMap[i-2]][ORIG] == UBAT_EN)) - ta[myBdx.dstToSrcMap[i-1]][FINAL] = UBAT_EN; - prev = i - 1; - while ((prev >= 0) && (ta[myBdx.dstToSrcMap[prev]][ORIG] == UBAT_ET)) - ta[myBdx.dstToSrcMap[prev--]][FINAL] = UBAT_EN; - } - if ((i >= 2) && (ta[myBdx.dstToSrcMap[i-1]][ORIG] == UBAT_CS) - && (ta[myBdx.dstToSrcMap[i-2]][ORIG] == UBAT_EN)) - ta[myBdx.dstToSrcMap[i-1]][FINAL] = wType; - ta[k][FINAL] = wType; - break; - case UBAT_AN: - if ((i >= 2) && (ta[myBdx.dstToSrcMap[i-1]][ORIG] == UBAT_CS) - && (ta[myBdx.dstToSrcMap[i-2]][ORIG] == UBAT_AN)) - ta[myBdx.dstToSrcMap[i-1]][FINAL] = UBAT_AN; - ta[k][FINAL] = UBAT_AN; - break; - case UBAT_W: - ta[k][FINAL] = UBAT_W; - break; - case UBAT_ET: - if ((i > 0) && (ta[myBdx.dstToSrcMap[i-1]][FINAL] == UBAT_EN)) - ta[k][FINAL] = UBAT_EN; - break; - case UBAT_NSM: - /* This method is invoked to transform Visual LTR to Implicit. - NSMs appearing at the boundary between LTR and RTL text may be - associated with either side. Since the NSMs have already - received a type in the first (Implicit to Visual) phase, - we leave it as is. */ - break; - } - } - } - -/*------------------------------------------------------------------------*/ - - private void addPoint(int pos, int after, char insert) - /* param pos: position where to insert - param after: must be BEFORE or AFTER - param insert: char to insert (should be LRM or RLM, but can be any char) - */ - { - if (myBdx.insertPoints == null) - myBdx.insertPoints = new Vector(10, 50); - myBdx.insertPoints.addElement(new Long((pos<<17) + after + insert)); - } - -/*------------------------------------------------------------------------*/ - - private int afterAN(int i) - { - while ((i < ics_size) && (typeArray[i][FINAL] == UBAT_AN)) - i++; - return i; - } - -/*------------------------------------------------------------------------*/ - - private int afterENAN(int i) - { - while ((i < ics_size) && ((typeArray[i][FINAL] == UBAT_EN) || - (typeArray[i][FINAL] == UBAT_AN))) - i++; - return i; - } - -/*------------------------------------------------------------------------*/ - - private int beforeENAN(int i) - { - while ((i >= 0) && ((typeArray[i][FINAL] == UBAT_EN) || - (typeArray[i][FINAL] == UBAT_AN))) - i--; - return i; - } - -/**************************************************************************** - - Method : implicitProcessing() - Objectives : Computes Implicit level for passed character type - Parameters : None. - - Returns : None. -----------------------------------------------------------------------------*/ - private void implicitProcessing() - { - int i, pos; - short sCond, newIL, newIS ,Special; - byte oldLevel, newLevel, pType, nType, level; - - newIS = impTab[ ucb_impSta ][ ucb_xType ]; - - Special = (short)(newIS >> 4); /* get 4 high bits */ - - newIS = (short)(newIS & 0x0F); /* get 4 low bits */ - newIL = impTab[newIS][ITIL]; - newLevel = (byte)(ucb_curLev + newIL); - - if (Special > 0) - switch (Special) - { - case 1: /* set conditional run to level 1 */ - level = (byte)(ucb_curLev + 1); - for (i = ucb_condPos; i < ucb_ix; i++) - { - oldLevel = myBdx.propertyMap[i]; - myBdx.propertyMap[i] = level; - if (ics_symmetric && odd(oldLevel ^ level)) /* change parity? */ - { - if (impToImpPhase == 2) - pos = myBdx.dstToSrcMap[i]; - else pos = i; - /* inverse swap status */ - if (typeArray[pos][ORIG] == UBAT_N) - typeArray[pos][ORIG] = UBAT_N_SWAP; - else if (typeArray[pos][ORIG] == UBAT_N_SWAP) - typeArray[pos][ORIG] = UBAT_N; - } - } - ucb_condPos = -1; - break; - - case 2: /* confirm the conditional run */ - ucb_condPos = -1; - break; - - case 3: /* L after R/AL + possible EN/AN */ - /* check if we had EN after R/AL */ - if (startL2EN >= 0) - addPoint(startL2EN, BEFORE, LRM); - startL2EN = -1; /* not within previous if since could also be -2 */ - /* check if we had any relevant EN/AN after R/AL */ - if ((myBdx.insertPoints == null) || - (myBdx.insertPoints.size() <= insertCnt)) - { - /* nothing, just clean up */ - lastStrongRTL = -1; - break; - } - /* reset previous RTL cont to level for LTR text */ - for (i = lastStrongRTL + 1; i < ucb_ix; i++) - { - myBdx.propertyMap[i] = newLevel; - /* disable possible symmetric swapping for character */ - typeArray[i][ORIG] = (byte)Math.abs(typeArray[i][ORIG]); - } - /* mark insert points as confirmed */ - insertCnt = myBdx.insertPoints.size(); - lastStrongRTL = -1; - break; - - case 4: /* R/AL after possible relevant EN/AN */ - /* just clean up */ - if (myBdx.insertPoints != null) - /* remove all non confirmed insert points */ - myBdx.insertPoints.setSize(insertCnt); - startL2EN = -1; - lastStrongRTL = ucb_ix; - break; - - case 5: /* EN/AN after R/AL + possible cont */ - /* confirm possible conditional run */ - ucb_condPos = -1; - /* check for real AN */ - if ((ucb_xType == UBAT_AN) && (typeArray[ucb_ix][ORIG] == UBAT_AN) && - !myBdx.winCompatible) - { - /* real AN */ - if (startL2EN == -1) /* if no relevant EN already found */ - { - /* just note the righmost digit as a strong RTL */ - lastStrongRTL = afterAN(ucb_ix) - 1; - break; - } - if (startL2EN >= 0) /* after EN, no AN */ - { - addPoint(startL2EN, BEFORE, LRM); - startL2EN = -2; - } - /* note AN */ - addPoint(ucb_ix, BEFORE, LRM); - break; - } - /* if first EN/AN after R/AL */ - if (startL2EN == -1) - startL2EN = ucb_ix; - break; - - case 6: /* note location of latest R/AL */ - lastStrongRTL = ucb_ix; - break; - - case 7: /* R followed by EN/AN followed by L */ - /* include possible adjacent number on the left */ - i = beforeENAN(ucb_ix - 1); - if (i < 0) //Bidi-HCG - break; //Bidi-HCG - /* compute symmetric position in string due to RTL orientation */ -// addPoint(ics_size - i - 1, BEFORE, RLM); /* add RLM before */ - addPoint(i, BEFORE, RLM); /* add RLM before */ //Bidi-HCG - insertCnt = myBdx.insertPoints.size(); - break; - - case 8: /* L possibly followed by N then by AN */ - /* AN numbers between L text on both sides may be trouble. */ - /* First, extend the AN number with possible EN on both sides */ - pos = afterENAN(ucb_ix); - i = beforeENAN(ucb_ix); - /* if immediately followed by a strong char or end-of-string */ - if ( ((pos >= ics_size) || (typeArray[pos][FINAL] == UBAT_L) || - (typeArray[pos][FINAL] == UBAT_R)) - && - /* and immediately preceded by L */ - ((i >= 0) && (typeArray[i][FINAL] == UBAT_L)) ) - /* nothing bad can happen, leave it alone */ - break; - /* tentatively bracket with LRMs; will be confirmed if followed by L */ - addPoint(pos - 1, AFTER, LRM); /* add LRM after */ - addPoint(i + 1, BEFORE, LRM); /* add LRM before */ - break; - - case 9: /* L followed by N followed by R */ - /* false alert, infirm LRMs around previous AN */ - if (myBdx.insertPoints != null) - myBdx.insertPoints.setSize(insertCnt); /* infirm inserts */ - ucb_condPos = -1; /* confirm possible cont run as RTL */ - break; - - case 10: /* L followed by AN followed by L */ - if (myBdx.insertPoints != null) - insertCnt = myBdx.insertPoints.size(); /* confirm inserts */ - break; - - default: - throw new IndexOutOfBoundsException("invalid action number"); - /* break; */ - - } - - sCond = impTab[newIS][ITCOND]; - - if (sCond == 0) - { - if (ucb_condPos > -1) - { - for (i = ucb_condPos; i < ucb_ix; i++) - { - oldLevel = myBdx.propertyMap[i]; - myBdx.propertyMap[i] = newLevel; - if (ics_symmetric && odd(oldLevel ^ newLevel)) /* change parity? */ - /* EN and AN never change parity */ - { - if (impToImpPhase == 2) - pos = myBdx.dstToSrcMap[i]; - else pos = i; - /* inverse swap status */ - if (typeArray[pos][ORIG] == UBAT_N) - typeArray[pos][ORIG] = UBAT_N_SWAP; - else if (typeArray[pos][ORIG] == UBAT_N_SWAP) - typeArray[pos][ORIG] = UBAT_N; - } - } - ucb_condPos = -1; - } - } - else if (ucb_condPos == -1) - ucb_condPos = ucb_ix; - - ucb_impSta = newIS; - - if (ucb_xType == UBAT_B) - ucb_wTarget = 0; - else ucb_wTarget = newLevel; - } - -/*------------------------------------------------------------------------*/ - - private static byte getChType (char x, boolean wordBreak) - { - /* This routine gets the type of a certain character */ - if (wordBreak && (x == 0x0020)) return UBAT_S; - return getChType(x); - } - -/*------------------------------------------------------------------------*/ - - private static byte getChType (char x) - { - /* This routine gets the type of a certain character */ - if ( - (x == 0x000A) || - (x == 0x000D) || - ((x >= 0x001C) && (x <= 0x001E)) || - (x == 0x0085) || - (x == 0x2029) - ) - return UBAT_B; - - if ((x == 0x0009) || (x == 0x000B) || (x == 0x001F)) - return UBAT_S; - - if ( - ((x >= 0x0041) && (x <= 0x005A)) || - ((x >= 0x0061) && (x <= 0x007A)) || - ((x >= 0x00C0) && (x <= 0x00D6)) || - ((x >= 0x00D8) && (x <= 0x00F6)) || - ((x >= 0x00F8) && (x <= 0x058F)) || - ((x >= 0x0900) && (x <= 0x10FF)) || - (x == 0x200E) || - ((x >= 0x20D0) && (x <= 0x20FF)) || - ((x >= 0x2160) && (x <= 0x2182)) || - ((x >= 0x3040) && (x <= 0x9FFF)) || - ((x >= 0xF900) && (x <= 0xFB17)) || - (x == 0xFE60) || - (x == 0xFE6B) || - (x == 0xFF06) || - ((x >= 0xFF20) && (x <= 0xFF3A)) || - ((x >= 0xFF41) && (x <= 0xFF5A)) || - ((x >= 0xFF60) && (x <= 0xFFDF)) - ) - return UBAT_L; - - if ( - ((x >= 0x0591) && (x <= 0x05FF)) || - (x == 0x200F) || - ((x >= 0xFB1D) && (x <= 0xFB4F)) - ) - return UBAT_R; - - if ( - ((x >= 0x0600) && (x <= 0x065F)) || - ((x >= 0x066E) && (x <= 0x06EF)) || - ((x >= 0x06FA) && (x <= 0x08FF)) || - ((x >= 0xFB50) && (x <= 0xFDFF)) || - ((x >= 0xFE70) && (x <= 0xFEFC)) - ) - return UBAT_AL; - - if ( - ((x >= 0x0030) && (x <= 0x0039)) || - ((x >= 0x00B2) && (x <= 0x00B3)) || - (x == 0x00B9) || - ((x >= 0x06F0) && (x <= 0x06F9)) || - (x == 0x2070) || - ((x >= 0x2074) && (x <= 0x2079)) || - ((x >= 0x2080) && (x <= 0x2089)) || - ((x >= 0x2460) && (x <= 0x249B)) || - (x == 0x24EA) || - ((x >= 0xFF10) && (x <= 0xFF19)) - ) - return UBAT_EN; - - if ( - ((x >= 0x0660) && (x <= 0x0669)) || - ((x >= 0x066B) && (x <= 0x066C)) - ) - return UBAT_AN; - - if ( - ((x >= 0x0023) && (x <= 0x0025)) || - /* the next 2 lines were moved to UBAT_ET to comply with Unicode 4.1 */ -// (x == 0x002B) /* Plus */ || -// (x == 0x002D) /* Minus */ || - /* end of updates for Unicode 4.1 */ - ((x >= 0x00A2) && (x <= 0x00A5)) || - ((x >= 0x00B0) && (x <= 0x00B1)) || - (x == 0x066A) || - ((x >= 0x09F2) && (x <= 0x09F3)) || - (x == 0x0AF1) || - (x == 0x0BF9) || - (x == 0x0E3F) || - (x == 0x17DB) || - ((x >= 0x2030) && (x <= 0x2034)) || - ((x >= 0x207A) && (x <= 0x207B)) || - ((x >= 0x208A) && (x <= 0x208B)) || - ((x >= 0x20A0) && (x <= 0x20B1)) || - (x == 0x212E) || - ((x >= 0x2212) && (x <= 0x2213)) || - (x == 0xFB29) || - (x == 0xFE5F) || - ((x >= 0xFE62) && (x <= 0xFE63)) || - ((x >= 0xFE69) && (x <= 0xFE6A)) || - ((x >= 0xFF03) && (x <= 0xFF05)) || - (x == 0xFF0B) || - (x == 0xFF0D) || - ((x >= 0xFFE0) && (x <= 0xFFE1)) || - ((x >= 0xFFE5) && (x <= 0xFFE6)) - ) - return UBAT_ET; - - if ( - /* the next 2 lines were moved here (from UBAT_ET) to comply with Unicode 4.1 */ - (x == 0x002B) /* Plus */ || - (x == 0x002D) /* Minus */ || - /* end of updates for Unicode 4.1 */ - (x == 0x002F) || - (x == 0xFF0F) - ) - return UBAT_ES; - - if ( - (x == 0x002C) || - (x == 0x002E) || - (x == 0x003A) || - (x == 0x00A0) || - (x == 0x060C) || - (x == 0xFE50) || - (x == 0xFE52) || - (x == 0xFE55) || - (x == 0xFF0C) || - (x == 0xFF0E) || - (x == 0xFF1A) - ) - return UBAT_CS; - - if ( - (x == 0x000C) || - (x == 0x0020) || - (x == 0x1680) || - (x == 0x180E) || - ((x >= 0x2000) && (x <= 0x200A)) || - (x == 0x2028) || - (x == 0x202F) || - (x == 0x205F) || - (x == 0x3000) - ) - return UBAT_W; - - if ( - ((x >= 0x202A) && (x <= 0x202E)) || - ((x >= 0x206C) && (x <= 0x206F)) - ) - return UBAT_BD; - - return UBAT_N; - } - -/*------------------------------------------------------------------------*/ - - private static int firstStrong (BidiText src) - { - int type, lim; - - lim = src.offset + src.count; - for (int i = src.offset; i < lim; i++) - { - type = getChType(src.data[i]); -//Bidi-HCG if (type == UBAT_L || type == UBAT_R) return type; - if (type == UBAT_L) return UBAT_L; //Bidi-HCG - if (type == UBAT_R || type == UBAT_AL) return UBAT_R; //Bidi-HCG - - } - return UBAT_N; - } - -/*------------------------------------------------------------------------*/ - private static int lastStrong (BidiText src) - { - int type, lim; - - lim = src.offset + src.count; - - for (int i = lim - 1; i >= src.offset; i--) - { - type = getChType(src.data[i]); -//Bidi-HCG if (type == UBAT_L || type == UBAT_R) return type; - if (type == UBAT_L) return UBAT_L; //Bidi-HCG - if (type == UBAT_R || type == UBAT_AL) return UBAT_R; //Bidi-HCG - - } - return UBAT_N; - } - -/*------------------------------------------------------------------------*/ - - private void BaseLvl () - { - visToVis = false; - - if (ics_orient_in == BidiFlag.ORIENTATION_RTL) - ucb_basLev = 1; /* 0 = LTR, 1 = RTL */ - else ucb_basLev = 0; - if (ics_orient_out == BidiFlag.ORIENTATION_RTL) - ucb_outLev = 1; - else ucb_outLev = 0; - ucb_curLev = ucb_basLev; - if (ucb_basLev == 0 && ucb_outLev == 1) - ucb_curLev=2; - - if ((ics_type_in == BidiFlag.TYPE_VISUAL) && (ics_type_out == BidiFlag.TYPE_VISUAL)) - visToVis = true; - - if (myBdx.roundTrip) - { - if (ucb_basLev == 1) - impTab = impTab_RTL_r; - else impTab = impTab_LTR_r; - } - else if (myBdx.winCompatible) - { - if (insertMarkers) - { - if (ucb_basLev == 1) - impTab = impTab_RTL_m; - else impTab = impTab_LTR_wm; - startL2EN = -1; /* start of level 2 EN run */ - lastStrongRTL = -1; /* index of last found R or AL */ - if (myBdx.insertPoints != null) - myBdx.insertPoints.setSize(0); - } - else - { - if (ucb_basLev == 1) - impTab = impTab_RTL; - else impTab = impTab_LTR_w; - } - } - else if (insertMarkers) - { - if (ucb_basLev == 1) - impTab = impTab_RTL_m; - else impTab = impTab_LTR_m; - startL2EN = -1; /* start of level 2 EN run */ - lastStrongRTL = -1; /* index of last found R or AL */ - if (myBdx.insertPoints != null) - myBdx.insertPoints.setSize(0); - } - else - { - if (ucb_basLev == 1) - impTab = impTab_RTL; - else impTab = impTab_LTR; - } - insertCnt = 0; /* number of confirmed inserts */ - removeCnt = 0; /* number of LRM/RLMs to remove */ - ucb_impSta = 0; - ucb_condPos = -1; - } - -/*************************************************************************** - Method : pass2 - Objectives : Builds Target and Index buffers making reordering - source area based on level area - Parameters : None - Returns : None. ----------------------------------------------------------------------------*/ - private void pass2() - { - byte lowest_level = 100; - byte highest_level = 0; - byte work_level; - byte current_level; - int i; - int flip_from = 0, flip_to = ics_size - 1; - - for (i = 0; i < ics_size; i++) - { - if (impToImpPhase != 2) myBdx.dstToSrcMap[i] = i; - current_level = myBdx.propertyMap[i]; - - if (current_level < lowest_level) - lowest_level = current_level; - if (current_level > highest_level) - highest_level = current_level; - } - - if (reqImpToImp && (impToImpOrient == 0)) return; - - if (ics_orient_out == BidiFlag.ORIENTATION_RTL) - /* if output orientation is RTL, invert until lowest even level */ - lowest_level = (byte)((lowest_level + 1) & ~1); - else - /* if output orientation is LTR, invert until lowest odd level */ - lowest_level |= 1; - - for (work_level = highest_level; work_level >= lowest_level; work_level--) - { - i = 0; - while (i < ics_size) - { - current_level = myBdx.propertyMap[i]; - - if (current_level < work_level) - { - i++; - continue; - } - flip_from = i; - for (i = flip_from+1; - (i < ics_size) && (myBdx.propertyMap[i] >= work_level); - i++); - flip_to = i - 1; - invertMap(myBdx.dstToSrcMap, flip_from, flip_to); - } - } - } - -/*------------------------------------------------------------------------*/ - - private void pass3() - { - int logPos; - byte xtype; - char xchar; - int i; - - for (i = 0; i < ics_size; i++) - { - logPos = myBdx.dstToSrcMap[i]; - xchar = ics_buffer_in[logPos]; - xtype = typeArray[logPos][ORIG]; - if (xtype == UBAT_EN) - { - if ((ics_num_flag == BidiFlag.NUMERALS_NATIONAL) || - ((ics_num_flag == BidiFlag.NUMERALS_CONTEXTUAL) && - (typeArray[logPos][FINAL] == UBAT_AN))) - xchar += (0x0660 - 0x0030); - } - else if (xtype == UBAT_AN) - { - if (ics_num_flag == BidiFlag.NUMERALS_NOMINAL) - xchar -= (0x0660 - 0x0030); - } - else if (xtype == UBAT_N_SWAP) - xchar = UCQSYMM(xchar); - ics_buffer_out[i] = xchar; - } - } - -/*------------------------------------------------------------------------*/ -/** - * This method reorders a Bidi text according to a specified transformation. - * @param src The Bidi text to reorder. - * @param dst The Bidi text after reordering - * @param bdx The transformation to perform. - */ - - synchronized void order(BidiText src, BidiText dst, BidiTransform bdx) - { - BidiFlag orient_save; - int i=0, j=0; - int pos, ipos; - boolean dstToSrcMapRequired; - - if (src.count < 1) - { - if (dst.data == null) - dst.data = new char[0]; - bdx.inpCount = 0; - bdx.outCount = 0; - return; - } - - /*******************/ - /* Initializations */ - /*******************/ - - myBdx = bdx; - ics_orient_in = src.flags.getOrientation(); - ics_orient_out = dst.flags.getOrientation(); - if (ics_orient_in == BidiFlag.ORIENTATION_CONTEXT_LTR || - ics_orient_in == BidiFlag.ORIENTATION_CONTEXT_RTL) - { - int type1 = firstStrong(src); - switch (type1) - { - case UBAT_L: - ics_orient_in = BidiFlag.ORIENTATION_LTR; - break; - case UBAT_R: - ics_orient_in = BidiFlag.ORIENTATION_RTL; - break; - case UBAT_N: - if (ics_orient_in == BidiFlag.ORIENTATION_CONTEXT_RTL) - ics_orient_in = BidiFlag.ORIENTATION_RTL; - else ics_orient_in = BidiFlag.ORIENTATION_LTR; - } - } - - if (ics_orient_out == BidiFlag.ORIENTATION_CONTEXT_LTR || - ics_orient_out == BidiFlag.ORIENTATION_CONTEXT_RTL) - { - int type1 = firstStrong(src); - switch (type1) - { - case UBAT_L: - type1 = lastStrong(src); - if (type1 == UBAT_R) - ics_orient_out = BidiFlag.ORIENTATION_RTL; - else ics_orient_out = BidiFlag.ORIENTATION_LTR; - break; - case UBAT_R: - ics_orient_out = BidiFlag.ORIENTATION_RTL; - break; - case UBAT_N: - if (ics_orient_out == BidiFlag.ORIENTATION_CONTEXT_RTL) - ics_orient_out = BidiFlag.ORIENTATION_RTL; - else ics_orient_out = BidiFlag.ORIENTATION_LTR; - } - } - - ics_type_in = src.flags.getType(); - ics_type_out = dst.flags.getType(); - reqImpToImp = (ics_type_in == BidiFlag.TYPE_IMPLICIT) && - (ics_type_out == BidiFlag.TYPE_IMPLICIT); - - /* check if implicit to implicit case */ - if (myBdx.impToImp && reqImpToImp && - (ics_orient_in != ics_orient_out)) - { - /* LocalData->symmetric is set for each phase in UCB2VIS */ - if (ics_orient_in == BidiFlag.ORIENTATION_LTR) - { - impToImpOrient = IMP_LTR; - } - else - { - impToImpOrient = IMP_RTL; - } - } - else - { - impToImpPhase = 0; //Bidi-HCG - impToImpOrient = 0; - } - - /* check if delimiters were specified */ - delim1 = NODELIM; /* initialize for no delimiters */ - if ((myBdx.delimiters != null) && (myBdx.delimiters.length() > 0)) - { - delim1 = myBdx.delimiters.charAt(0); - if (myBdx.delimiters.length() > 1) - delim2 = myBdx.delimiters.charAt(1); - else delim2 = delim1; - } - - /* check if need to invert the input data */ - insertMarkers = myBdx.insertMarkers; - ics_buffer_in = new char[src.count]; - if ((ics_type_in == BidiFlag.TYPE_VISUAL) && - (ics_type_out == BidiFlag.TYPE_IMPLICIT) && - ((insertMarkers && (ics_orient_in == BidiFlag.ORIENTATION_RTL)) || - (!insertMarkers && (ics_orient_in != ics_orient_out)))) - { - invertInput = true; - int ofs = src.offset + src.count - 1; - for (int k = 0; k < src.count; k++) - ics_buffer_in[k] = src.data[ofs - k]; - ics_orient_in = insertMarkers ? BidiFlag.ORIENTATION_LTR : - ics_orient_out; - } - else - { - invertInput = false; - System.arraycopy(src.data, src.offset, ics_buffer_in, 0, src.count); - } - - /* check that insertMarkers is only used for Visual to Implicit */ - if (insertMarkers) - { - if ((ics_type_in != BidiFlag.TYPE_VISUAL) || - (ics_type_out != BidiFlag.TYPE_IMPLICIT)|| - myBdx.removeMarkers) - { - insertMarkers = false; - } - else if (ics_orient_out == BidiFlag.ORIENTATION_RTL) - { - ics_orient_in = BidiFlag.ORIENTATION_RTL; - ics_orient_out = BidiFlag.ORIENTATION_LTR; - } - } - - ics_size = src.count; - ics_num_flag = dst.flags.getNumerals(); - - if (reqImpToImp) - ics_symmetric = false; - else ics_symmetric = (dst.flags.getSwap() != src.flags.getSwap()); - - ics_buffer_out = new char[src.count]; - typeArray = new byte[src.count][2]; - - if ((myBdx.propertyMap == null) || (myBdx.propertyMap.length < src.count)) - myBdx.propertyMap = new byte[src.count]; - if ((myBdx.dstToSrcMap == null) || (myBdx.dstToSrcMap.length < src.count)) - myBdx.dstToSrcMap = new int[src.count]; - - /*----------------------------------------*/ - /* Determination of the base level basLev */ - /*----------------------------------------*/ - - if (impToImpOrient > 0) - { - impToImpPhase = 1; - orient_save = ics_orient_out; - ics_orient_out = BidiFlag.ORIENTATION_LTR; - ics_symmetric = (src.flags.getSwap() == BidiFlag.SWAP_YES); - BaseLvl(); - fillTypeArray(); - for (ucb_ix = 0; ucb_ix < ics_size; ucb_ix++) - { - ucb_xType = typeArray[ucb_ix][FINAL]; - implicitProcessing(); - myBdx.propertyMap[ucb_ix] = ucb_wTarget; - if ( (typeArray[ucb_ix][ORIG] == UBAT_N) && - ics_symmetric && - odd(ucb_wTarget) ) - typeArray[ucb_ix][ORIG] = UBAT_N_SWAP; - } - /* do Implicit process for UBAT_B to resolve possible conditional string */ - ucb_ix = ics_size; - ucb_xType = UBAT_B; - implicitProcessing(); - /* Reverse the map by levels */ - pass2(); - ics_orient_out = orient_save; - /**************************************************************************/ - /* Re-classify according to the new order */ - /**************************************************************************/ - impToImpPhase = 2; - orient_save = ics_orient_in; - if (impToImpOrient == IMP_LTR) - { - ics_orient_in = BidiFlag.ORIENTATION_RTL; - invertMap(myBdx.dstToSrcMap, 0, ics_size - 1); - } - else ics_orient_in = BidiFlag.ORIENTATION_LTR; - ics_symmetric = (dst.flags.getSwap() == BidiFlag.SWAP_YES); - BaseLvl(); - fillTypeArray2(); - for (ucb_ix = 0; ucb_ix < ics_size; ucb_ix++) - { - ipos = myBdx.dstToSrcMap[ucb_ix]; - ucb_xType = typeArray[ipos][FINAL]; - implicitProcessing(); - myBdx.propertyMap[ucb_ix] = ucb_wTarget; - if ( (Math.abs(typeArray[ipos][ORIG]) == UBAT_N) && - ics_symmetric && - odd(ucb_wTarget) ) - typeArray[ipos][ORIG] *= -1; - } - /* do Implicit process for UBAT_B to resolve possible conditional string */ - ucb_ix = ics_size; - ucb_xType = UBAT_B; - implicitProcessing(); - /* Reverse the map by levels */ - pass2(); - ics_orient_in = orient_save; - ics_symmetric = true; - } - else - { - BaseLvl(); - fillTypeArray(); - for (ucb_ix = 0; ucb_ix < ics_size; ucb_ix++) - { - ucb_xType = typeArray[ucb_ix][FINAL]; - implicitProcessing(); - myBdx.propertyMap[ucb_ix] = ucb_wTarget; - if ( (typeArray[ucb_ix][ORIG] == UBAT_N) && - ics_symmetric && - odd(ucb_wTarget) ) - typeArray[ucb_ix][ORIG] = UBAT_N_SWAP; - } - /* do Implicit process for UBAT_B to resolve possible conditional string */ - ucb_ix = ics_size; - ucb_xType = UBAT_B; - implicitProcessing(); - /* Reverse the map by levels */ - pass2(); - } - - /* Pass 3 :The logical to visual mapping must be converted to a visual- - to-logical mapping. - European digits which need Arabic-Indic shapes are - translated; Arabic presentation forms which need shaping are - replaced by the corresponding nominal letters; symbols which - need swapping are replaced by their symmetric symbol. */ - pass3(); - dstToSrcMapRequired = myBdx.dstToSrcMapRequired || myBdx.srcToDstMapRequired; - if (dstToSrcMapRequired) - { - if (invertInput) - for (i = 0; i < src.count; i++) - myBdx.dstToSrcMap[i] = src.count - myBdx.dstToSrcMap[i] - 1; - } - - if (myBdx.removeMarkers) - { - char c; - - for (pos = 0; pos < src.count; pos++) - { - c = ics_buffer_out[pos]; - if ((c == LRM) || (c == RLM)) - { - removeCnt++; - continue; - } - if (removeCnt > 0) - { - ics_buffer_out[pos-removeCnt] = ics_buffer_out[pos]; - myBdx.dstToSrcMap[pos-removeCnt] = myBdx.dstToSrcMap[pos]; - } - } - } - - dst.count = src.count - removeCnt + insertCnt; - if (dst.data == null) - { - if ((dst.offset == 0) && (insertCnt == 0)) - dst.data = ics_buffer_out; - else dst.data = new char[dst.offset + dst.count]; - } - if ((dst.offset + dst.count) > dst.data.length) - { - char[] temp = new char[dst.offset + dst.count]; - if (dst.offset > 0) - System.arraycopy(dst.data, 0, temp, 0, dst.offset); - dst.data = temp; - temp = null; - } - - if (insertCnt > 0) /* some LRMs to insert */ - { - /* insertPoint value = (position<<17) + (BEFORE or AFTER) + insert */ - long iPoint; - char insert; - int after; - int[] tempMap = null; - for (i = 0; i < insertCnt; i++) - { - iPoint = ((Long)myBdx.insertPoints.get(i)).longValue(); - ipos = (int)(iPoint>>17); - after = (int)(iPoint & 0x0000000000010000); - insert = (char)iPoint; - if (ucb_basLev == 1) //Bidi-HCG -//Bidi-HCG if ( ((ucb_basLev == 1) && (insert == LRM)) -//Bidi-HCG || -//Bidi-HCG ((ucb_basLev != 1) && (insert == RLM)) ) - { - /* look for dst position corresponding to ipos in src */ - for (pos = 0; pos < src.count; pos++) - if (ipos == myBdx.dstToSrcMap[pos]) - { - ipos = pos; - break; - } - myBdx.insertPoints.setElementAt(new Long((ipos<<17)+after+insert), i); - } - } - /* sorting is needed if the insert points are not in ascending order; - this happens for RTL destination and would happen for RLM in LTR - destination but there is no such use */ - if (ucb_basLev == 1) - java.util.Collections.sort(myBdx.insertPoints); - if (dstToSrcMapRequired) - tempMap = new int[dst.count]; - - pos = 0; - for (i = 0; i < insertCnt; i++) - { - iPoint = ((Long)myBdx.insertPoints.get(i)).longValue(); - ipos = (int)(iPoint>>17); - after = (int)(iPoint & 0x0000000000010000); - insert = (char)iPoint; - ipos += after>>16; /* add 1 for after */ - System.arraycopy(ics_buffer_out, pos, dst.data, dst.offset+pos+i, - ipos - pos); - dst.data[dst.offset+ipos+i] = insert; - if (dstToSrcMapRequired) - { - System.arraycopy(myBdx.dstToSrcMap, pos, tempMap, pos+i, - ipos - pos); - tempMap[ipos+i] = -1; - } - pos = ipos; - } - System.arraycopy(ics_buffer_out, pos, dst.data, dst.offset+pos+insertCnt, - dst.count - pos - insertCnt); - if (dstToSrcMapRequired) - { - System.arraycopy(myBdx.dstToSrcMap, pos, tempMap, pos+insertCnt, - dst.count - pos - insertCnt); - myBdx.dstToSrcMap = tempMap; - } - } - else - { - if (dst.data != ics_buffer_out) - System.arraycopy(ics_buffer_out, 0, dst.data, dst.offset, dst.count); - } - - if (myBdx.srcToDstMapRequired) - { - if ((myBdx.srcToDstMap == null) || (myBdx.srcToDstMap.length < src.count)) - myBdx.srcToDstMap = new int[src.count]; - if (removeCnt > 0) - java.util.Arrays.fill(myBdx.srcToDstMap, 0, src.count, -1); - for (i = 0; i < dst.count; i++) - { - pos = myBdx.dstToSrcMap[i]; - if (pos >= 0) - myBdx.srcToDstMap[pos] = i; - } - } - if (myBdx.propertyMapRequired) - { - for (i = 0; i < src.count; i++) - if (typeArray[i][ORIG] != UBAT_NSM) - bdx.propertyMap[i] |= 0x80; - if (invertInput) - invertMap(myBdx.propertyMap, 0, src.count - 1); - - } - myBdx.inpCount = src.count; - myBdx.outCount = dst.count; - - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/BidiShape.java b/cvsroot/src/com/ibm/as400/access/BidiShape.java deleted file mode 100644 index 542e06bdf..000000000 --- a/cvsroot/src/com/ibm/as400/access/BidiShape.java +++ /dev/null @@ -1,1458 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BidiShape.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - *

            Multi-threading considerations: This class is thread-safe, - * since its only public method is synchronized, and there are no instance - * variables. However, to avoid delays, each thread should use its own - * instances of this class. - **/ - -class BidiShape { - - /* replaces Arabic base letters by the appropriate - * presentation forms. - */ - - /* Link attribute are unsigned 16 bit integer with the following format: */ - /* bit 0: links to the right */ - /* bit 1: links to the left */ - /* bit 2: is irrelevant to linking */ - /* bit 4: Lam type UNI Code */ - /* bit 5: Alef type UNI Code */ - /* bit 8-15: offset to presentation shapes starting at U+FE70 */ - - static final char Tail = 0x200B ; - private static final short shapeTable[][][]= - { - /* lastLink = 0 | lastLink = 1 | lastLink = 2 | lastLink = 3 */ - /* nextLink = 0 */ { {0,0,0,0}, {0,0,0,0}, {0,1,0,3}, {0,1,0,1} }, - /* nextLink = 1 */ { {0,0,2,2}, {0,0,1,2}, {0,1,1,2}, {0,1,1,3} }, - /* nextLink = 2 */ { {0,0,0,0}, {0,0,0,0}, {0,1,0,3}, {0,1,0,3} }, - /* nextLink = 3 */ { {0,0,1,2}, {0,0,1,2}, {0,1,1,2}, {0,1,1,3} } }; - - private static final int convertFEto06[] = - { - 0x64B, 0x64B, - 0x64C, 0x64C, - 0x64D, 0x64D, - 0x64E, 0x64E, - 0x64F, 0x64F, - 0x650, 0x650, - 0x651, 0x651, - 0x652, 0x652, - 0x621, - 0x622, 0x622, - 0x623,0x623, - 0x624,0x624, - 0x625,0x625, - 0x626,0x626,0x626,0x626, - 0x627,0x627, - 0x628,0x628,0x628,0x628, - 0x629,0x629, - 0x62A,0x62A,0x62A,0x62A, - 0x62B,0x62B,0x62B,0x62B, - 0x62C,0x62C,0x62C,0x62C, - 0x62D,0x62D,0x62D,0x62D, - 0x62E,0x62E,0x62E,0x62E, - 0x62F,0x62F, - 0x630,0x630, - 0x631,0x631, - 0x632,0x632, - 0x633,0x633, 0x633,0x633, - 0x634, 0x634,0x634,0x634, - 0x635,0x635,0x635,0x635, - 0x636,0x636,0x636,0x636, - 0x637,0x637,0x637,0x637, - 0x638,0x638,0x638,0x638, - 0x639,0x639,0x639,0x639, - 0x63A,0x63A,0x63A,0x63A, - 0x641,0x641,0x641,0x641, - 0x642,0x642,0x642,0x642, - 0x643,0x643,0x643,0x643, - 0x644,0x644,0x644,0x644, - 0x645,0x645,0x645,0x645, - 0x646,0x646,0x646,0x646, - 0x647,0x647,0x647,0x647, - 0x648, 0x648, - 0x649,0x649, - 0x64A,0x64A,0x64A,0x64A, - 0x65C, 0x65C, - 0x65D,0x65D, - 0x65E,0x65E, - 0x65F,0x65F - }; - - private static final int convert06toFE[] = - { - 0x10, - 0x11, - 0x13, - 0x15, - 0x17, - 0x19, - 0x1D, - 0x1F, - 0x23, - 0x25, - 0x29, - 0x2D, - 0x31, - 0x35, - 0x39, - 0x3B, - 0x3D, - 0x3F, - 0x41, - 0x45, - 0x49, - 0x4D, - 0x51, - 0x55, - 0x59, - 0x5D, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x61, - 0x65, - 0x69, - 0x6D, - 0x71, - 0x75, - 0x79, - 0x7D, - 0x7F, - 0x81, - 0x0, - 0x2, - 0x4, - 0x6, - 0x8, - 0xA, - 0xC, - 0xE - }; - - /*****************************************************************************/ - private static final int Link06[]= - { - 1 + 32 + 256 * 0x11, - 1 + 32 + 256 * 0x13, - 1 + 256 * 0x15, - 1 + 32 + 256 * 0x17, - 1 + 2 + 256 * 0x19, - 1 + 32 + 256 * 0x1D, - 1 + 2 + 256 * 0x1F, - 1 + 256 * 0x23, - 1 + 2 + 256 * 0x25, - 1 + 2 + 256 * 0x29, - 1 + 2 + 256 * 0x2D, - 1 + 2 + 256 * 0x31, - 1 + 2 + 256 * 0x35, - 1 + 256 * 0x39, - 1 + 256 * 0x3B, - 1 + 256 * 0x3D, - 1 + 256 * 0x3F, - 1 + 2 + 256 * 0x41, - 1 + 2 + 256 * 0x45, - 1 + 2 + 256 * 0x49, - 1 + 2 + 256 * 0x4D, - 1 + 2 + 256 * 0x51, - 1 + 2 + 256 * 0x55, - 1 + 2 + 256 * 0x59, - 1 + 2 + 256 * 0x5D, - 0, 0, 0, 0, 0, /* 0x63B - 0x63F */ - 1 + 2, - 1 + 2 + 256 * 0x61, - 1 + 2 + 256 * 0x65, - 1 + 2 + 256 * 0x69, - 1 + 2 + 16 + 256 * 0x6D, - 1 + 2 + 256 * 0x71, - 1 + 2 + 256 * 0x75, - 1 + 2 + 256 * 0x79, - 1 + 256 * 0x7D, - 1 + 256 * 0x7F, - 1 + 2 + 256 * 0x81, - 4, 4, 4, 4, - 4, 4, 4, 4, /* 0x64B - 0x652 */ - 0, 0, 0, 0, 0, - 0, 0, 0, 0, /* 0x653 - 0x65B */ - 1 + 256 * 0x85, - 1 + 256 * 0x87, - 1 + 256 * 0x89, - 1 + 256 * 0x8B, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, /* 0x660 - 0x66F */ - 4, - 0, - 1 + 32, - 1 + 32, - 0, - 1 + 32, - 1, 1, - 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, - 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, - 1+2, 1+2, 1+2, 1+2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, - 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, - 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, - 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, - 1, - 1+2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1+2, - 1, - 1+2, 1+2, 1+2, 1+2, - 1, 1 - }; - /*****************************************************************************/ - - private static final short LinkFE[]= - { - 1 + 2, - 1 + 2, - 1 + 2, 0, 1+ 2, 0, 1+ 2, - 1 + 2, - 1+ 2, 1 + 2, 1+2, 1 + 2, - 1+ 2, 1 + 2, 1+2, 1 + 2, - - 0, 0 + 32, 1 + 32, 0 + 32, - 1 + 32, 0, 1, 0 + 32, - 1 + 32, 0, 2, 1 + 2, - 1, 0 + 32, 1 + 32, 0, - 2, 1 + 2, 1, 0, - 1, 0, 2, 1 + 2, - 1, 0, 2, 1 + 2, - 1, 0, 2, 1 + 2, - 1, 0, 2, 1 + 2, - 1, 0, 2, 1 + 2, - 1, 0, 1, 0, - 1, 0, 1, 0, - 1, 0, 2, 1+2, - 1, 0, 2, 1+2, - 1, 0, 2, 1+2, - 1, 0, 2, 1+2, - 1, 0, 2, 1+2, - 1, 0, 2, 1+2, - 1, 0, 2, 1+2, - 1, 0, 2, 1+2, - 1, 0, 2, 1+2, - 1, 0, 2, 1+2, - 1, 0, 2, 1+2, - 1, 0 + 16, 2 + 16, 1 + 2 +16, - 1 + 16, 0, 2, 1+2, - 1, 0, 2, 1+2, - 1, 0, 2, 1+2, - 1, 0, 1, 0, - 1, 0, 2, 1+2, - 1, 0, 1, 0, - 1, 0, 1, 0, - 1 - }; - - /*****************************************************************************/ - private static final short IrreleventPos[]= - { - 0x0, - 0x2, - 0x4, - 0x6, - 0x8, - 0xA, - 0xC, - 0xE, - } ; - -//Used by Lam-Alef methods - static char AlefType[] = { - '\u0622', - '\u0622', - '\u0623', - '\u0623', - '\u0625', - '\u0625', - '\u0627', - '\u0627', - }; -//Used by Tashkeel handeling methods - static char Tashkeel[] = { - '\ufe70', //Tanween Fath - '\ufe72', //Tanween Dam - '\ufe74', //Tanween Kasr - '\ufe76', //Fatha - '\ufe78', //Dama - '\ufe7A', //Kassra - '\ufe7c', //Shadda - '\ufe7e', //Sekooun - }; - -//Used by Tashkeel handeling methods - static char Tashkeel_Tatweel[] = { - '\ufe71', //Tanween Fath with tatweel - '\ufe72', //Tanween Dam -- No Ttween Dam with Tashkeel in the FE Range - '\ufe74', //Tanween Kasr -- No Ttween Dam with Tashkeel in the FE Range - '\ufe77', //Fatha with tatweel - '\ufe79', //Dama with tatweel - '\ufe7b', //Kassra with tatweel - '\ufe7d', //Shadda with tatweel - '\ufe7f', //Sekooun with tatweel - }; - - - private static final int LINKR = 1; - private static final int LINKL = 2; - private static final int IRRELEVANT = 4; - private static final int LAMTYPE = 16; - private static final int ALEFTYPE = 32; - private static final int LINKFIELD = 3; - - -/** - * Method shapingRoutine - * This method represents the shaping routine. - * @param inAttr The input Bidi Attributes (TextType, TextShape, ...etc.) - * @param outAttr The output Bidi Attributes (TextType, TextShape, ...etc.) - * @param str The buffer to be shaped. - * @param rtl The buffer orientation. - */ - synchronized void shapingRoutine(BidiFlagSet inAttr, BidiFlagSet outAttr, char str[], boolean rtl) - { - int currLink; /* link attributes of current character at position Ix */ - int lastLink=0; /* link attributes of the last character which was not irrelevant to linking */ - int nextLink=0; /* link attributes of the next character which is not irrelevant to linking */ - int prevLink=0; /* link attributes of the character before the last which is not irrelevant to linking */ - int lastPos; /* position of the last character which was not irrelevant */ - int Nx; /* position of the next character which is not irrelevant */ - int prevPos; /* position of the character before the last which was not irr*/ - - int iEnd, Nw, step, Shape, Ix; - - char wLamalef; - int flag; - - BidiFlag inTextType, outTextType, /*inTextShape,*/ outTextShape; - - int bufLen = str.length; - if ( bufLen == 0) - return; - - //Initialize variables - inTextType = inAttr.getType(); - outTextType = outAttr.getType(); - //inTextShape = inAttr.getText(); - outTextShape = outAttr.getText(); - - if(inTextType == BidiFlag.TYPE_VISUAL && outTextType == BidiFlag.TYPE_IMPLICIT) //Visual to Implicit - { //We must test if this check is the best check for shapping Shaped -> Nominal - for (int idx = 0; idx < bufLen ; idx++) - { - //Convert the characters from FE to 06 range - if ( (str[idx] >= 0xFE70) && (str[idx] <= 0xFEF4 ) ) - { - //This change fix NULL pointer exception with IBMJDK 1.4 - //IBMJDK1.4 cann't resolve casting correctly - int newCharValue = str[idx] - 0xFE70; - str[idx] = (char)(convertFEto06 [ newCharValue ] ) ; - } - } - }//end if Visual to Implicit - else if(outTextType == BidiFlag.TYPE_VISUAL) - { //We must test if this check is the best check for shapping -> Nominal - /* This pass is done so that Arabic characters are processed in language */ - /* order. If outAttr is RTL , this means start processing from the begining of*/ - /* the str (source) till its end; if outAttr is LTR , this means start */ - /* processing from the end of the str (source) till its beginning */ - if (rtl) - { - Ix = 0; /* Setting the low boundary of the processing */ - iEnd = str.length ; /* Setting the high boundary of the processing */ - step = +1; - } - else { - Ix = str.length - 1; /* Setting the low boundary of the processing */ - iEnd = -1; /* Setting the high boundary of the processing */ - step = -1; - } - - - prevLink = 0; - lastLink = 0; - currLink = uba_getLink ( str[Ix] ); - prevPos = Ix; - lastPos = Ix; - Nx = -2; - while ( Ix != iEnd ) - { - if ((currLink & 0xFF00) > 0 ) /* If there are more than one shape */ - { - Nw = Ix + step; - - while ( Nx < 0 ) { /* we need to know about next char */ - if (Nw == iEnd) { - nextLink = 0; - Nx = 30000; /* will stay so until end of pass*/ - } - else { - nextLink = uba_getLink(str[Nw]); - if ((nextLink & IRRELEVANT) == 0) - Nx = Nw; - else Nw += step; - } - } - if ( ((currLink & ALEFTYPE) > 0) && ((lastLink & LAMTYPE) > 0)) - { - wLamalef = Lamalef( str[Ix] ); //get from 0x065C-0x065f - if ( wLamalef != 0) - { - if (rtl) - { - str[lastPos] = wLamalef ; - for(int h=Ix;h0; h--) - {str[h] =str[h-1];} - str[0] =(char) 0x0020; - Ix=lastPos; - - } //LTR - }//(wLamalef != 0) - - lastLink = prevLink; - currLink = uba_getLink(wLamalef); - Nx = -2; //force recompute of nextLink - } - - /* get the proper shape according to link ability of - neighbors and of character; depends on the order of - the shapes (isolated, initial, middle, final) in the - compatibility area */ - - flag=specialChar (str[Ix]); - if (outTextShape == BidiFlag.TEXT_INITIAL) - { - if(flag==0) - Shape = 2; - else - Shape = 0; - } - else if (outTextShape == BidiFlag.TEXT_MIDDLE) - { - if(flag == 0) - Shape = 3; - else - Shape = 1; - } - else if (outTextShape == BidiFlag.TEXT_FINAL) - { - if(flag == 0) - Shape = 1; - else - Shape = 1; - } - else if (outTextShape == BidiFlag.TEXT_ISOLATED) - { - Shape = 0; - } - else - { - Shape = shapeTable[nextLink & (LINKR + LINKL)] - [lastLink & (LINKR + LINKL)] - [currLink & (LINKR + LINKL)]; - } - str[Ix] = (char)(0xFE70 + ( currLink >> 8 ) + Shape) ; - - } - /* move one notch forward */ - if ((currLink & IRRELEVANT) == 0) { - - prevLink = lastLink; - lastLink = currLink; - prevPos = lastPos; - lastPos = Ix; - } - //Tashkil characters - if ( ((currLink & IRRELEVANT) > 0) && (0 <= (str[Ix] - 0x064B)) && ((str[Ix] - 0x064B) < IrreleventPos.length ) ) { - int charidx = str[Ix] - 0x064B; - int MyShape =0; - int next = (int) (nextLink & (LINKR + LINKL)); - int last =lastLink & (LINKR + LINKL); - if ( ( (last==3)&& (next==1) ) - || ( (last==3) && (next==3) ) ) - MyShape= 1; - if ( ((nextLink & ALEFTYPE) > 0) && ((lastLink & LAMTYPE) > 0) ) - MyShape=0; - if ( (str[Ix]==0x064C) //Wawdoma - || (str[Ix]==0x064D) ) //kasrten - MyShape=0; - str[Ix] = (char)(0xFE70 + IrreleventPos[charidx]+ MyShape) ; - } - Ix += step; - if ( Ix == Nx ) { - currLink = nextLink; - Nx = -2; - } - else - { - if (Ix != iEnd) - currLink = uba_getLink ( str[Ix]) ; - } - } //end while - }// end of else to visual - } -/** - * Method shape. - * In this method, the shaping process (Arabic options handling and shaping routine) is performed. - * - * @param inAttr The input Bidi Attributes (TextType, TextShape, ...etc.) - * @param outAttr The output Bidi Attributes (TextType, TextShape, ...etc.) - * @param str The buffer to be shaped. - * @param optionSet The Arabic options used in shaping process. - */ - synchronized char[] shape(BidiFlagSet inAttr, BidiFlagSet outAttr, char str[], ArabicOptionSet optionSet) - { - boolean rtl = true; - BidiFlag inTextType, outTextType, /*inTextShape,*/ outTextShape; - ArabicOption lamAlefOpt, seenOpt, yehHamzaOpt, tashkeelOpt; - - int bufLen = str.length; - if ( bufLen == 0) - return str; - - if(optionSet == null) //Set Arabic options to the default values in case user did not specify them. - { - optionSet = new ArabicOptionSet(); - } - - //Initialize variables - inTextType = inAttr.getType(); - outTextType = outAttr.getType(); - rtl = outAttr.getOrientation() == BidiFlag.ORIENTATION_RTL; - //inTextShape = inAttr.getText(); - outTextShape = outAttr.getText(); - lamAlefOpt = optionSet.getLamAlefMode(); - seenOpt = optionSet.getSeenMode(); - yehHamzaOpt = optionSet.getYehHamzaMode(); - tashkeelOpt = optionSet.getTashkeelMode(); - - if(inTextType == BidiFlag.TYPE_VISUAL && outTextType == BidiFlag.TYPE_IMPLICIT) //Visual to Implicit - { - //Seen Deshaping - if( (seenOpt == ArabicOption.SEEN_NEAR) || (seenOpt == ArabicOption.SEEN_AUTO) ) - deshapeSeenNear(str,bufLen); - - /*Yeh Hamza DeShapping*/ - - if (( yehHamzaOpt == ArabicOption.YEHHAMZA_TWO_CELL_NEAR ) || ( yehHamzaOpt == ArabicOption.YEHHAMZA_AUTO)) - { - deshapeYehHamzaTwoCellNear(str, bufLen); - } - - /*Tashkeel DeShapping*/ - if((tashkeelOpt == ArabicOption.TASHKEEL_KEEP) || ( tashkeelOpt == ArabicOption.TASHKEEL_AUTO)) - { - //No processing is done - } - else if (tashkeelOpt == ArabicOption.TASHKEEL_CUSTOMIZED_ATBEGIN) - { - customizeTashkeelAtBegin( str, bufLen); - } - else if (tashkeelOpt == ArabicOption.TASHKEEL_CUSTOMIZED_ATEND) - { - customizeTashkeelAtEnd( str, bufLen); - } - - /*LamAlef DeShapping*/ - if( lamAlefOpt == ArabicOption.LAMALEF_RESIZE_BUFFER ){ - str=deshapeLamAlefWithResizeBuffer(str, bufLen); - bufLen= str.length; - } - else if (lamAlefOpt == ArabicOption.LAMALEF_NEAR) - { - deshapeLamAlefNear(str, bufLen); - } - else if (lamAlefOpt == ArabicOption.LAMALEF_ATBEGIN) - { - deshapeLamAlefAtBegin(str, bufLen); - } - else if (lamAlefOpt == ArabicOption.LAMALEF_ATEND) - { - deshapeLamAlefAtEnd(str, bufLen); - } - else if(lamAlefOpt == ArabicOption.LAMALEF_AUTO ){ - deshapeLamAlefAuto(str, bufLen,rtl); - } - - shapingRoutine(inAttr, outAttr, str, rtl); - - }//end if Visual to Implicit - - else if(outTextType == BidiFlag.TYPE_VISUAL) - { - shapingRoutine(inAttr, outAttr, str, rtl); - - /* Seen Shapping*/ - if( (seenOpt == ArabicOption.SEEN_NEAR) || (seenOpt == ArabicOption.SEEN_AUTO) ) - shapeSeenNear(str,bufLen, rtl); - - /* Yeh Hamza Shapping*/ - if( (yehHamzaOpt == ArabicOption.YEHHAMZA_TWO_CELL_NEAR) || ( yehHamzaOpt == ArabicOption.YEHHAMZA_AUTO)){ - shapeYehHamzaTwoCellNear(str, bufLen, rtl); - } - - /*Tashkeel Shapping*/ - if((tashkeelOpt == ArabicOption.TASHKEEL_KEEP) || ( tashkeelOpt == ArabicOption.TASHKEEL_AUTO)) - { - //No processing is done - } - else if (tashkeelOpt == ArabicOption.TASHKEEL_CUSTOMIZED_ATBEGIN) - { - customizeTashkeelAtBegin( str, bufLen); - } - else if (tashkeelOpt == ArabicOption.TASHKEEL_CUSTOMIZED_ATEND) - { - customizeTashkeelAtEnd( str, bufLen); - } - - /* LamAlef Handling*/ - if( lamAlefOpt == ArabicOption.LAMALEF_RESIZE_BUFFER ){ - str=handleLamAlefWithResizeBuffer(str, bufLen, rtl); - bufLen=str.length; - } - else if (lamAlefOpt == ArabicOption.LAMALEF_NEAR){ - handleLamAlefNear(str, bufLen, rtl); - } - else if (lamAlefOpt == ArabicOption.LAMALEF_ATBEGIN) - { - // In case of LTR spaces are already in the absolute begining of buffer - if (rtl) - handleLamAlefAtBegin(str, bufLen); - } - else if (lamAlefOpt == ArabicOption.LAMALEF_ATEND) - { - // In case of RTL spaces are already in the absolute end of buffer - if (!rtl) - handleLamAlefAtEnd(str, bufLen); - } - else if(lamAlefOpt == ArabicOption.LAMALEF_AUTO ) - { - //No processing is done - } - - }// end of else if to shaped - return str; - } - -/** - * Method uba_getLink. - * - * @param x the character to be checked - * @return int - */ - private static int uba_getLink(char x) - { - if(x >= 0x0622 && x <= 0x06D3) //06 Range - return(Link06[x-0x0622]); - else if(x == 0x200D) //(ZWJ) - return(3); - else if(x >= 0x206D && x <= 0x206F) //Alternate Formating - return(4); - else if(x >= 0xFE70 && x <= 0xFEFC) //FE range - return(LinkFE[x-0xFE70]); - else - return(0); - } - -/** - * Method Lamalef. - * - * @param x the character to be checked - * @return char - */ - private static char Lamalef(char x) - { - switch(x) - { - case 0x0622: return (0x065C); - case 0x0623: return (0x065D); - case 0x0625: return (0x065E); - case 0x0627: return (0x065F); - } - return (0); - } - -/** - * Method specialChar. - * - * @param ch the character to be checked - * @return int - */ - private static int specialChar(char ch) - { - // hamza , - if((ch >= 0x0621 && ch < 0x0626)|| (ch == 0x0627 )|| - (ch > 0x062e && ch < 0x0633) || - (ch > 0x0647 && ch < 0x064a) || ch == 0x0629) - return(1); - else - return(0); - } - -/** - * Method SeenChar. - * This method checks if the passed chracter is one of the Seen family characters. - * Seen family characters are Seen, Sheen, Sad and Dad. For each character of them there are - * two shapes. - * - * @param ch The character to be checked. - * @return boolean true, if the character belongs to Seen family. - * false, otherwise - */ - private static boolean SeenChar(char ch) - { - if ( (ch==0xFEB1) || - (ch==0xFEB2) || - (ch==0xFEB5) || - (ch==0xFEB6) || - (ch==0xFEB9) || - (ch==0xFEBA) || - (ch==0xFEBD) || - (ch==0xFEBE) - ) - return(true); - else - return(false); - } - - -//The following methods are responsible for handling Arabic Options - - - /* ******************************** */ - /* */ - /* Methods for Lam Alef handling */ - /* */ - /* ******************************** */ - -/** - * Method handleLamAlefWithResizeBuffer. - * This method shrink the input buffer by the number of Lam-Alef occurences. - * The buffer is supposed to come with LamAlef shaped with a space at end/begin - * of the buffer depending on wherther the output is rtl or ltr. - * And the method role is to remove this space and shrink the buffer - * - * @param buffer The buffer containing the data to be processed. - * @param length The buffer length. - * @param rtl The buffer orientation. - * @return int The new size of the buffer. - * - */ - - private char[] handleLamAlefWithResizeBuffer(char[] buffer, int length, boolean rtl){ - - int counter =0 ; - int lamAlefCount=0; - char compressedBuffer[]; - - for (counter=0;counter= 0xFEF5) && (buffer[counter] <= 0xFEFC )) - lamAlefCount++; - } - - if(lamAlefCount == 0) return buffer; - - compressedBuffer = new char[length-lamAlefCount]; - if(rtl){//Remove the sapces at the end of the buffer - System.arraycopy(buffer,0, compressedBuffer, 0, buffer.length-lamAlefCount); - } - else {//Remove the sapces in the begining of the buffer - System.arraycopy(buffer, lamAlefCount, compressedBuffer, 0, buffer.length-lamAlefCount); - } - - return compressedBuffer; - } - -/** - * Method deshapeLamAlefWithResizeBuffer. - * This method enlarge the input buffer by the number of Lam-Alef occurences. - * All Lam-Alef characters are expanded to Lam + Alef characters . - * - * @param buffer The buffer containing the data to be processed. - * @param length The buffer length. - * @param rtl The buffer orientation. - * @return int The new size of the buffer. - * - */ - - private char[] deshapeLamAlefWithResizeBuffer(char[] buffer, int length){ - - char ChAlefType; - int oldBufferCounter =0 ; - int newBufferCounter =0 ; - int lamAlefCount=0; - char expandedBuffer[]; - - for (oldBufferCounter=0;oldBufferCounter= 0xFEF5) && (buffer[oldBufferCounter] <= 0xFEFC )) - lamAlefCount++; - } - if(lamAlefCount == 0) return buffer; - expandedBuffer = new char[length+lamAlefCount]; - oldBufferCounter =0; - while (oldBufferCounter < length) - { - if ( ( buffer[oldBufferCounter] >= 0xFEF5) && (buffer[oldBufferCounter] <= 0xFEFC )) - { - ChAlefType = (char)AlefType[buffer[oldBufferCounter]-0xFEF5]; - expandedBuffer[newBufferCounter] = '\u0644'; - newBufferCounter++; - expandedBuffer[newBufferCounter] = ChAlefType; - } - else - { - expandedBuffer[newBufferCounter] = buffer[oldBufferCounter]; - } - newBufferCounter++; - oldBufferCounter ++; - } - - return expandedBuffer; - } - -/** - * Method handleLamAlefNear - * This method moves the spaces located in the begining of buffer with respect to - * orientation (buffer[0] in LTR and buffer[length -1] in RTL) to the position near - * to each of Lam-Alef characters. - * - * @param buffer The buffer containing the data to be processed. - * @param length The buffer length. - * @param rtl The buffer orientation. - * - */ - - private void handleLamAlefNear(char[] buffer, int length, boolean rtl) - { - int count = 0; - int tempIdx; - - while (count < length) - { - if ((buffer[count] >= 0xFEF5) && (buffer[count] <= 0xFEFC ) && buffer[length - 1] == 0x0020 && rtl) - { - for (tempIdx = length -1; tempIdx > count + 1; tempIdx--) - buffer [tempIdx] = buffer [tempIdx - 1]; - if(count < length - 1) - buffer[count + 1] = 0x0020; - } - else if ((buffer[count] >= 0xFEF5) && (buffer[count] <= 0xFEFC ) && buffer[0] == 0x0020 && !rtl) - { - for (tempIdx = 0; tempIdx < count - 1; tempIdx++) - buffer [tempIdx] = buffer [tempIdx + 1]; - if (count != 0) - buffer[count - 1] = 0x0020; - } - - count ++; - } - } - - -/** - * Method deshapeLamAlefNear - * This method expands Lam-Alef character to Lam and Alef using the space near to - * Lam-Alef character. In case no spaces occurs near this character no processing - * will be done and the output buffer will contain the Lam-Alef character in its - * FE hexadecimal value. - * - * @param buffer The buffer containing the data to be processed. - * @param length The buffer length. - * - */ - - private void deshapeLamAlefNear(char[] buffer, int length) - { - char ChAlefType; - int count = 1; - - while (count < length) - { - if ( (buffer[count] >= 0xFEF5) && (buffer[count] <= 0xFEFC ) && - ( (count!= length - 1) && ( buffer[count + 1] == 0x0020) ) - ) - - { - ChAlefType = (char)AlefType[buffer[count]-0xFEF5]; - buffer[count + 1] = ChAlefType; - buffer[count] = '\u0644'; - } - - count ++; - } - } - - -/** - * Method handleLamAlefAtBegin - * This method moves the space located in the absolute end of buffer to the absolute begin of buffer so these - * spaces can be used in Lam-Alef deshaping in the other way back. - * character. - * - * @param buffer The buffer containing the data to be processed. - * @param length The buffer length. - * - */ - - private void handleLamAlefAtBegin(char[] buffer, int length) - { - int count = 0; - int tempIdx, lamAlefOccurences = 0; - - while (count < length) - { - if ((buffer[count] >= 0xFEF5) && (buffer[count] <= 0xFEFC ) && buffer[length - 1] == 0x0020) - { - for (tempIdx = length - 1; tempIdx >lamAlefOccurences; tempIdx--) - buffer [tempIdx] = buffer [tempIdx - 1]; - buffer[lamAlefOccurences] = 0x0020; - lamAlefOccurences++; - count++; - } - count ++; - } - } - - -/** - * Method deshapeLamAlefAtBegin - * This method expands Lam-Alef character to Lam and Alef using the spaces in the absolute begin of buffer. - * In case no spaces occurs near this character no processing will be done and the output buffer will contain - * the Lam-Alef character in its FE hexadecimal value. - * - * @param buffer The buffer containing the data to be processed. - * @param length The buffer length. - * - */ - - private void deshapeLamAlefAtBegin(char[] buffer, int length) - { - char ChAlefType; - int count = 0 ; - int tempIdx; - - while (count < length) - { - if ( (buffer[count] >= 0xFEF5) && (buffer[count] <= 0xFEFC ) && buffer[0] == 0x0020) - { - ChAlefType = (char)AlefType[buffer[count]-0xFEF5]; - - for (tempIdx = 0; tempIdx < count - 1; tempIdx++) - buffer [tempIdx] = buffer [tempIdx + 1]; - - buffer[count - 1] = '\u0644'; - buffer[count] = ChAlefType; - } - - count ++; - } - - } - - -/** - * Method handleLamAlefAtEnd - * This method moves the space located in the absolute begin of buffer to the absolute end of buffer so these - * spaces can be used in Lam-Alef deshaping in the other way back. - * character. - * - * @param buffer The buffer containing the data to be processed. - * @param length The buffer length. - * - */ - - private void handleLamAlefAtEnd(char[] buffer, int length) - { - int count = 0; - int tempIdx, lamAlefOccurences = 0; - - while (count < length) - { - if ((buffer[count] >= 0xFEF5) && (buffer[count] <= 0xFEFC ) && buffer[0] == 0x0020) - { - for (tempIdx = 0; tempIdx < length - lamAlefOccurences - 1; tempIdx++) - buffer [tempIdx] = buffer [tempIdx + 1]; - buffer[length - lamAlefOccurences - 1] = 0x0020; - lamAlefOccurences++; - } - count ++; - } - } - -/** - * Method deshapeLamAlefAtEnd - * This method expands Lam-Alef character to Lam and Alef using the spaces in the absolute end of buffer. - * In case no spaces occurs near this character no processing will be done and the output buffer will contain - * the Lam-Alef character in its FE hexadecimal value. - * - * @param buffer The buffer containing the data to be processed. - * @param length The buffer length. - * - */ - - private void deshapeLamAlefAtEnd(char[] buffer, int length) - { - char ChAlefType; - int count = 0 ; - int tempIdx; - - while (count < length) - { - if ( (buffer[count] >= 0xFEF5) && (buffer[count] <= 0xFEFC ) && buffer[length - 1] == 0x0020) - { - ChAlefType = (char)AlefType[buffer[count]-0xFEF5]; - - for (tempIdx = length - 1; tempIdx > count + 1; tempIdx--) - buffer [tempIdx] = buffer [tempIdx - 1]; - - buffer[count] = '\u0644'; - buffer[count + 1] = ChAlefType; - - } - - count ++; - } - - } - -/** - * Method handleLamAlefAuto. - * - * @param buffer The buffer containing the data to be processed. - * @param length The buffer length. - * @param rtl The buffer orientation. - * - */ - - private void handleLamAlefAuto(char[] buffer, int length, boolean rtl) - {} - -/** - * Method deshapeLamAlefAuto. - * - * This method expands LamAlef character to Lam and Alef characters consuming the space - * located in the in the begining of buffer with respect to orientation (buffer[0] in LTR - * and buffer[length -1] in RTL) - * - * @param buffer The buffer containing the data to be processed. - * @param length The buffer length. - * @param rtl The buffer orientation. -*/ - - private void deshapeLamAlefAuto(char[] buffer, int length, boolean rtl){ - - char ChAlefType; - int count =0 ; - - while (count < length) - { - if ( ( buffer[count] >= 0xFEF5) && (buffer[count] <= 0xFEFC )&&buffer[length-1]==0x0020&&rtl) - { - ChAlefType = (char)AlefType[buffer[count]-0xFEF5]; - - for(int h=length-1;h>count;h--) - buffer[h] = buffer[h-1]; - - buffer[count+1] = ChAlefType; - buffer[count] = '\u0644'; - } - else if ( ( buffer[count] >= 0xFEF5) && (buffer[count] <= 0xFEFC )&&buffer[0]==0x0020&&!rtl) - { - - ChAlefType = (char)AlefType[buffer[count]-0xFEF5]; - - for(int h=0;h= 0) && ( buffer[idx-1] == 0x0020) ) ) - - buffer[idx-1] = BidiShape.Tail; - } - } - } - - /** - * This method replaces Seen Tail by a space near to the Seen character. - * - * @param buffer The buffer containing the data to be processed. - * @param length The buffer length. - * - */ - - private void deshapeSeenNear(char[] buffer, int length) - { - for (int idx = 0; idx < length ; idx++) - { - if (buffer[idx] == BidiShape.Tail) - buffer[idx]= (char)0x0020; - } - } - -/** - * Method shapeSeenAtBegin. - * - * @param buffer - * @param length - * @param rtl - */ - - private void shapeSeenAtBegin(char[] buffer, int length, boolean rtl){} -/** - * Method deshapeSeenAtBegin. - * - * @param buffer - * @param length - * @param rtl - */ - - private void deshapeSeenAtBegin(char[] buffer, int length, boolean rtl){} - -/** - * Method shapeSeenAtEnd. - * - * @param buffer - * @param length - * @param rtl - */ - private void shapeSeenAtEnd(char[] buffer, int length, boolean rtl){} - -/** - * Method deshapeSeenAtEnd. - * - * @param buffer - * @param length - * @param rtl - */ - - private void deshapeSeenAtEnd(char[] buffer, int length, boolean rtl){} - -/** - * Method handleSeenAuto. - * - * @param buffer - * @param length - * @param rtl - */ - - private void handleSeenAuto(char[] buffer, int length, boolean rtl){} - -/** - * Method deshapeSeenAuto. - * @param buffer - * @param length - * @param rtl - */ - private void deshapeSeenAuto(char[] buffer, int length, boolean rtl){} - - - /* ******************************** */ - /* */ - /* Methods for Yeh Hamza handling */ - /* */ - /* ******************************** */ - -/** - * Method shapeYehHamzaTwoCellNear. - * This method convert every YehHamza to Yeh + Hamza depending on whether the output - * buffer is rtl or ltr using the space near the YeahHamza - * - * @param buffer The buffer containing the data to be processed. - * @param length The buffer length. - * @param rtl The buffer orientation. - * - */ - private void shapeYehHamzaTwoCellNear(char[] buffer, int length, boolean rtl){ - int counter=0; - for (counter =0; counter < length ; counter++) - { - if(rtl) - { - if ( buffer[counter] == 0xfe8a ) - { - buffer[counter]= 0xfef0;//Yeh - if ( (counter+1 < length) && ( buffer[counter+1] == 0x0020) ) - buffer[counter+1] = 0xfe80; //hamza - } - if ( buffer[counter] == 0xfe89 ) - { - buffer[counter] = 0xfeef ;//Yeh - if ( (counter+1 < length) && ( buffer[counter+1] == 0x0020) ) - buffer[counter+1] = 0xfe80 ;//hamza - } - } - else - { - if ( buffer[counter] == 0xfe8a ) - { - buffer[counter]= 0xfef0;//Yeh - if ( (counter-1 >= 0) && ( buffer[counter-1] == 0x0020) ) - buffer[counter-1] = 0xfe80; //hamza - } - if ( buffer[counter] == 0xfe89 ) - { - buffer[counter] = 0xfeef;//Yeh - if ( (counter-1 >= 0) && ( buffer[counter-1] == 0x0020) ) - buffer[counter-1] = 0xfe80 ;//hamza - } - } - } -} - - -/** - * Method deshapeYehHamzaTwoCellNear. - * This method convert every Yeh follwed by a Hamza to YehHamza character - * and put the spaces near the character - * - * @param buffer The buffer containing the data to be processed. - * @param length The buffer length. - * - */ - private void deshapeYehHamzaTwoCellNear(char[] buffer, int length){ - - int counter=0; - for (counter =0; counter < length ; counter++) - { - if ((counter+1 = 0xFE70) && (buffer[count] <= 0xFE72) ) || - (buffer[count] == 0xFE74) || - ( (buffer[count] >= 0xFE76) && (buffer[count] <= 0xFE7B) ) || - ( (buffer[count] >= 0xFE7E) && (buffer[count] <= 0xFE7F) ) ) - { - for(int idx = count; idx > tashkeelOcuurences; idx--) - buffer[idx] = buffer[idx - 1]; - buffer[tashkeelOcuurences] = 0x0020; - tashkeelOcuurences++; - } - count ++; - } - } - - -/** - * Method customizeTashkeelAtEnd. - * - * @param buffer The buffer containing the data to be processed. - * @param length The buffer length. - * - */ - private void customizeTashkeelAtEnd(char[] buffer, int length) - { - int count =0 ; - int tashkeelOcuurences = 0; - - while (count < length) - { - if ( ( (buffer[count] >= 0xFE70) && (buffer[count] <= 0xFE72) ) || - (buffer[count] == 0xFE74) || - ( (buffer[count] >= 0xFE76) && (buffer[count] <= 0xFE7B) ) || - ( (buffer[count] >= 0xFE7E) && (buffer[count] <= 0xFE7F) ) ) - { - for(int idx = count; idx < length - tashkeelOcuurences - 1; idx++) - buffer[idx] = buffer[idx + 1]; - buffer[length - tashkeelOcuurences - 1] = 0x0020; - tashkeelOcuurences++; - } - count ++; - } - - } - - -/** - * Method handleTashkeelAuto. - * - * @param buffer The buffer containing the data to be processed. - * @param length The buffer length. - * - */ - private void handleTashkeelAuto(char[] buffer, int length){} - - } - diff --git a/cvsroot/src/com/ibm/as400/access/BidiStringType.java b/cvsroot/src/com/ibm/as400/access/BidiStringType.java deleted file mode 100644 index 63bd832ea..000000000 --- a/cvsroot/src/com/ibm/as400/access/BidiStringType.java +++ /dev/null @@ -1,184 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BidiStringType.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * A collection of constants - * generally used for describing the string type of bidi (bi-directional text). - *

            - * The client Bidi format is usually different from the host Bidi format. For - * example, Bidi format of MS-Windows applications is typically Logical LTR, and - * Bidi format of System i screen applications is typically Visual LTR. - * Therefore the data exchange between the host and the client may need Bidi - * layout transformation. The client Bidi format for this transformation is - * defined by "bidi string type" property, while the host Bidi format is taken - * according to the user profile CCSID (aka host CCSID). Each CCSID has a - * default string type, as defined by the CDRA (Character Data Representation - * Architecture), which defines a set of Bidi flags. This string type - * is used as the host Bidi format. - *

            - * By default, the value of the "bidi string type" property is 5 (Logical LTR). - *

            - * The value of the the host CCSID is received from the host, and it can be - * different for data sent from the host to the client (such as results of - * SELECT queries), and for data sent from the client to the host (such as field - * content of data manipulation statements, such as INSERT or UPDATE). For the - * former, the host CCSID is used. For the latter, it is defined using - * property "package ccsid". - *

            - * Note that the default value for the property is 13488 (UCS-2), and Bidi - * format associated with the CCSID is 10 (Logical Contextual). Therefore, by - * default, the data sent from a client to a host is converted into Logical - * Contextual first, and then converted into Bidi format of the host database - * (typically Visual LTR) by a process running on the host side (receiving job). - * As result, Arabic/Hebrew text mixed with numerals might be reordered - * incorrectly (round-trip problem). To prevent this problem, it is recommended - * to set "package ccsid" to the value matching the host CCSID. - *

            - * The special value "system" for the "package ccsid" property forces the JDBC - * driver to use value matching the host CCSID. This CCSID may be different for - * different accounts, but, by default, it matches the host database CCSID; - * therefore, in most of cases, it is recommended for usage with Bidi systems. - * However, it is mandatory to use a Unicode CCSID, for example 1200 (UTF-16) or - * 13488 (UCS-2), for data manipulation statements with multilingual field - * content. - *

            - * For meta-data (names of tables, columns etc.) and method setString() - * of classes CallableStatement and PreparedStatement, "package ccsid" is not used - * as a mediator, and sending data is converted directly to host database CCSID, - * or CCSID specified for the column. - *

            - * Bidi layout transformation of data manipulation statements such as INSERT - * or UPDATE is not supported when either "package ccsid" and host CCSID are Logical, - * or when host CCSID is Logical RTL (62224 for Arabic and 62235 for Hebrew). - * For these cases, consider usage of method setString() of classes CallableStatement - * and PreparedStatement, or method updateString() of class ResultSet. - *

            - * Bidi layout transformation of meta-data (such as tables, columns and stored procedures names) - * depends on property "bidi implicit reordering". - * If it is set to true, it is reordered according to current setting of "bidi string type". - * Otherwise no reordering is occurred. In current release, this feature is supported for - * Visual LTR CCSIDs (420 for Arabic and 424 for Hebrew) only. - *

            - * Note that "LTR" means left-to-right, "RTL" means right-to-left, and - * "Implicit" is an alias for "Logical". - **/ -public interface BidiStringType -{ - /** - The default string type for Bidi data (Logical LTR). This value maps to ST5. - **/ - public final static int DEFAULT = 0; - - /** - String type used when an EBCDIC/Unicode conversion is desired, but without swapping, shaping, or transformation. - **/ - public final static int NONE = -1; - - /** - String Type 4 -

              -
            • Type of text: Visual -
            • Orientation: LTR -
            • Symmetric swapping: No -
            • Numeral shape: Nominal -
            • Text shapes: Shaped -
            - **/ - public final static int ST4 = 4; - - /** - String Type 5 -
              -
            • Type of text: Implicit -
            • Orientation: LTR -
            • Symmetric swapping: Yes -
            • Numeral shape: Nominal -
            • Text shapes: Nominal -
            - **/ - public final static int ST5 = 5; - - /** - String Type 6 -
              -
            • Type of text: Implicit -
            • Orientation: RTL -
            • Symmetric swapping: Yes -
            • Numeral shape: Nominal -
            • Text shapes: Nominal -
            - **/ - public final static int ST6 = 6; - - /** - String Type 7 -
              -
            • Type of text: Visual -
            • Orientation: Contextual LTR -
            • Symmetric swapping: No -
            • Numeral shape: Nominal -
            • Text shapes: Nominal -
            - **/ - public final static int ST7 = 7; - - /** - String Type 8 -
              -
            • Type of text: Visual -
            • Orientation: RTL -
            • Symmetric swapping: No -
            • Numeral shape: Nominal -
            • Text shapes: Shaped -
            - **/ - public final static int ST8 = 8; - - /** - String Type 9 -
              -
            • Type of text: Visual -
            • Orientation: RTL -
            • Symmetric swapping: Yes -
            • Numeral shape: Nominal -
            • Text shapes: Shaped -
            - **/ - public final static int ST9 = 9; - - /** - String Type 10 -
              -
            • Type of text: Implicit -
            • Orientation: Contextual LTR -
            • Symmetric swapping: Yes -
            • Numeral shape: Nominal -
            • Text shapes: Nominal -
            - **/ - public final static int ST10 = 10; - - /** - String Type 11 -
              -
            • Type of text: Implicit -
            • Orientation: Contextual RTL -
            • Symmetric swapping: Yes -
            • Numeral shape: Nominal -
            • Text shapes: Nominal -
            - **/ - public final static int ST11 = 11; -} diff --git a/cvsroot/src/com/ibm/as400/access/BidiText.java b/cvsroot/src/com/ibm/as400/access/BidiText.java deleted file mode 100644 index 084cc6faf..000000000 --- a/cvsroot/src/com/ibm/as400/access/BidiText.java +++ /dev/null @@ -1,296 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BidiText.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * Bidi text is a combination of a sequence of characters and a set of - * Bidi flags which represent Bidi attributes used during Bidi Layout - * transformations. - *

            - * Layout transformations allow to convert a given instance of Bidi text - * into another instance with possibly different Bidi flags while - * conserving the semantics of the text. - *

            - * A BidiText object contains a BidiFlagSet to store the Bidi flags - * characterizing its character data. - * The characters are contained in a character array. This array may - * contain more data than the Bidi text to process. The part of the array - * to process is called the "interesting" data, and is defined by its length - * and its offset from the beginning of the character array. - * - *

            Multi-threading considerations: - * Each thread must use its own instances of this class. - * - */ - -class BidiText -{ - -/** - * BidiFlagSet qualifying the character data - */ - public BidiFlagSet flags; -/** - * character array containing the data - */ - public char[] data; -/** - * offset of the "interesting" data within the character array - */ - public int offset; -/** - * length of the "interesting" data within the character array - */ - public int count; - -/** - * Constructor with no arguments to create a flags member with - * a DEFAULT value. There is no data and no character array, - * but a default BidiFlagSet is created and referred to in "flags". - */ - public BidiText() - { - this.flags = new BidiFlagSet(); - } - -/** - * Constructs a BidiText object based on an existing BidiFlagSet. - * There is no data and no character array. - */ - public BidiText(BidiFlagSet initFlags) - { - this.flags = initFlags; - } - -/** - * Constructs a BidiText object based on an existing - * BidiFlagSet and the data in a character array. - *

            The argument flags and data are duplicated. Changing them will not - * affect the BidiText instance. - * @param initFlags The Bidi flags of the data. - * @param initData The character data. - */ - public BidiText(BidiFlagSet initFlags, char[] initData) - { - this(initFlags, initData, 0, initData.length, initData.length); - } - -/** - * Constructs a BidiText object based on an existing - * BidiFlagSet and the data in part of a character array. - *

            The argument flags and data are duplicated. Changing them will not - * affect the BidiText instance. - * @param initFlags The Bidi flags of the data. - * @param initData The character data. - * @param offset The offset of the "interesting" data in initData. - * @param length The length of the "interesting" data in initData. - * @param capacity The length of the created character array (may be - * larger than "length" to reserve space for - * adding more data). - */ - public BidiText(BidiFlagSet initFlags, - char[] initData, - int offset, - int length, - int capacity) - { - this.flags = new BidiFlagSet(initFlags); - this.data = new char[capacity]; - System.arraycopy(initData, offset, this.data, 0, length); - this.count = length; - } - -/** - * Constructs a BidiText object based on an existing - * BidiFlagSet and the data in a string. - *

            The argument flags and data are duplicated. Changing them will not - * affect the BidiText instance. - * @param initFlags The Bidi flags of the data. - * @param str The character data. - */ - public BidiText(BidiFlagSet initFlags, String str) - { - this.flags = new BidiFlagSet(initFlags); - this.count = str.length(); - // it would be nicer to use str.toCharArray, but it has bugs on - // Arabic NT - this.data = new char[count]; - str.getChars(0, count, this.data, 0); - } - -/** - * Compares two BidiText objects. - * Two BidiText objects are considered equal if they have the same Bidi flags - * and the same "interesting" character data, - * @param other The BidiText to compare to this. - * @return true if the BidiText objects are equal, false otherwise. - */ - public boolean equals(BidiText other) - { - if (other == null) return false; - if (this.count != other.count) return false; - if (this.flags.value != other.flags.value) return false; - for (int i = 0; i < this.count; i++) - { - if (this.data[this.offset + i] != - other.data[other.offset + i]) return false; - } - return true; - } - -/** - * Replaces the character data reference in the BidiText object. - * Note that the data is not duplicated, only its - * reference is written in the BidiText object. - *

            This method avoids the overhead of creating a character array - * and copying the source data to it, when the source data is already - * contained in a character array. - *

            This method can be used after creating a BidiText object with no - * arguments, or to reuse a BidiText object with new data. - *

            This is a convenience method. It is also possible to manipulate - * directly the data, offset and count members of the BidiText instance. - * @param newData A reference to the character data. - * @param newOffset The offset of the "interesting" data in newData. - * @param newLength The length of the "interesting" data in newData. - */ - public void setCharsRef(char[] newData, int newOffset, int newLength) - { - this.data = newData; - this.offset = newOffset; - this.count = newLength; - } - -/** - * Extracts the character data from a BidiText in character array format - * @return A char array containing a copy of the "interesting" data. - */ - public char[] toCharArray() - { - char[] copyChars = new char[this.count]; - System.arraycopy(this.data, this.offset, copyChars, 0, count); - return copyChars; - } - -/** - * Extracts the character data from a BidiText in string format - * @return A string containing a copy of the "interesting" data. - */ - public String toString() - { - return new String(this.data, this.offset, this.count); - } - -/** - * Transforms the data in the "this" BidiText object and return the resulting - * BidiText object. - * The transformation is done according to the Bidi flags of the source - * BidiText and the Bidi flags specified in the argument. - *

            The source BidiText is never modified by the transform. - *

            The destination BidiText has its Bidi flags set to those of the - * argument. - *

            A typical usage of this method could be: - *

            - *  BidiText        src = new BidiText();       // source text
            - *  BidiFlagSet     dstFlags;                   // Bidi flags for destination
            - *  BidiText        dst;                        // destination reference
            - *  src.flags.setAllFlags( {flag values for source} );
            - *  dstFlags.setAllFlags( {flag values for destination} );
            - *  // assign values to src.data, src.offset, src.count
            - *  dst = src.transform(dstFlags);
            - *  
            - * @param dstFlags Bidi flags of the destination BidiText. - * @return A BidiText which is the transformation of the "this" BidiText. - */ - public BidiText transform(BidiFlagSet dstFlags) - { - BidiTransform bdx = new BidiTransform(); - bdx.flags.setAllFlags(dstFlags); - return this.transform(bdx); - } - -/** - * Transforms the data in the "this" BidiText object and return the resulting - * BidiText object. - * The transformation is done according to the Bidi flags of the source - * BidiText and the Bidi flags specified in the BidiTransform argument. - *

            The source BidiText is never modified by the transform. - *

            The destination BidiText has its Bidi flags set to those of the - * argument. - *

            Output fields of the BidiTransform object are set by this method. - * srcToDstMap, DstToSrcMap and propertyMap may be set by this method if the - * corresponding options have been required in BidiTransform when calling it. - *

            By default, transformed output data is written to the destination - * BidiText character array but no maps are created. - *

            A typical usage of this method could be: - *

            - *  BidiTransform   bdx = new BidiTransform();
            - *  BidiText        src = new BidiText();       // source text
            - *  BidiText        dst;                        // destination reference
            - *  src.flags.setAllFlags( {flag values for source} );
            - *  bdx.flags.setAllFlags( {flag values for destination} );
            - *  // assign values to src.data, src.offset, src.count
            - *  dst = src.transform(bdx);
            - *  
            - *

            This method is still in construction. Currently only the default - * options are implemented. No maps are created. - * @param bdx The BidiTransform object defining the transformation. - * @return A BidiText which is the transformation of the "this" BidiText. - * If destination data is not required, a null is returned. - */ - public BidiText transform(BidiTransform bdx) - { - BidiText dst = new BidiText(); - dst.flags.setAllFlags(bdx.flags); - if (bdx.myOrder == null) bdx.myOrder = new BidiOrder(); - bdx.myOrder.order(this, dst, bdx); - - if (this.flags.getText() != dst.flags.getText()) - { - char[] sData; /* char array for shaping */ - - if (bdx.myShape == null) - { - bdx.myShape = new BidiShape(); - bdx.flags1 = new BidiFlagSet(); - bdx.flags2 = new BidiFlagSet(); - } - bdx.flags1.setAllFlags(this.flags); - bdx.flags2.setAllFlags(dst.flags); - if ((dst.offset == 0) && (dst.data.length == dst.count)) - sData = dst.data; - else - { - sData = new char[dst.count]; - System.arraycopy(dst.data, dst.offset, sData, 0, dst.count); - } - sData = bdx.myShape.shape(bdx.flags1, bdx.flags2, sData, bdx.options); - dst.count = sData.length; /* could be changed by shaping */ - if (dst.offset == 0) - dst.data = sData; - else - { - if ((dst.offset + dst.count) <= dst.data.length) - System.arraycopy(sData, 0, dst.data, dst.offset, dst.count); - else - { - char[] tmp = new char[dst.offset + dst.count]; - System.arraycopy(dst.data, 0, tmp, 0, dst.offset); - System.arraycopy(sData, 0, tmp, dst.offset, dst.count); - dst.data = tmp; - } - } - } - return dst; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/BidiTransform.java b/cvsroot/src/com/ibm/as400/access/BidiTransform.java deleted file mode 100644 index a55b71b48..000000000 --- a/cvsroot/src/com/ibm/as400/access/BidiTransform.java +++ /dev/null @@ -1,213 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BidiTransform.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Vector; - -/** - * The BidiTransform class defines Text Layout transformations. - *

            - * Layout transformations allow converting a given instance of BidiText - * (the source) into another instance (the destination) with possibly - * different Bidi flags while conserving the semantics of the text. - *

            - * Bidi text is a combination of a sequence of characters and a set of - * Bidi flags. Bidi text is implemented by the BidiText class. - *

            - * A BidiTransform instance contains fields which define what auxiliary - * outputs are required from the transformation, and fields to refer - * to these outputs. - * The work itself is done by the transform method of the BidiText class. - *

            - * Boolean fields are used to specify options of the transform operation. - * Other fields are used to store auxiliary outputs of the transformation. - *

            - * There are no specific constructors for this class. The default - * constructor creates a default BidiFlagSet and puts its reference in the - * "flags" instance member. Unless modified later, this qualifies a - * transformation to Implicit LTR swapped numerals-nominal unshaped text. - * - *

            Multi-threading considerations: - * each thread must use its own instances of this class. - * - */ - -class BidiTransform { - -/** - * Option: Bidi flags of destination BidiText - */ - public BidiFlagSet flags = new BidiFlagSet(); -/** - * Option: enable Implicit to Implicit transformations - */ - public boolean impToImp = true; -/** - * Option: use "roundtrip" algorithm for reordering - */ - public boolean roundTrip; -/** - * Option: use "Windows compatible" algorithm for reordering. - *

            If this option is true, the reordering algorithm is modified to - * perform more closely like Windows. In particular, logical string - * "12ABC" in LTR orientation (where ABC represent Arabic or Hebrew letters) - * is reordered as "CBA12" instead of "12CBA". - * Also, logical string "abc 123 45" (where all digits represent Hindi numbers) - * is reordered as "abc 123 45" instead of "abc 45 123". - */ - public boolean winCompatible; -/** - * Option: add Markers to destination text when needed for round trip. - *

            If this option is true, LRM and RLM markers may be inserted when - * transforming from visual to logical where needed to insure round trip. - *

            This option is ignored if the removeMarkers option is true. - */ - public boolean insertMarkers; -/** - * Option: remove Markers from destination text after performing a Bidi - * transformation. - *

            If this option is true, LRM and RLM markers in the source text - * participate in the reordering, but they are removed from the destination - * text after performing the Bidi transformation. - */ - public boolean removeMarkers; -/** - * Option: delimiters for performing the Bidi transformation. -

            This option is enabled if the string "delimiters" is not null and has - a length of at least one character. This string specifies starting and - ending delimiters such that the Bidi transformation is only performed - on the data between starting and ending delimiters. -

            If the length of the string is only one character, the ending delimiter - is assumed equal to the starting delimiter. -

            An even number of successive ending delimiters in the data to transform - is considered part of the data and do not function as delimiters. - In an odd number of successive ending delimiters, the last one is - considered as a delimiter. - */ - public String delimiters; -/** - * Option: shaping options for this transformation - */ - public ArabicOptionSet options; -/** - * Option: consider white space to always follow base orientation - */ - public boolean wordBreak; -/** - * Option: create a destination BidiText - *

            If this flag is not true, the transform method will return a null. - */ - public boolean destinationRequired = true; -/** - * Option: create a source to destination mapping - */ - public boolean srcToDstMapRequired; -/** - * Option: create a destination to source mapping - */ - public boolean dstToSrcMapRequired; -/** - * Option: create a property map - *

            Note: the map created is of no practical value if impToImp is true. - */ - public boolean propertyMapRequired; -/** - * Option: this invocation is a continuation from the previous one - * (re-establish same conditions as at the end of last call) - */ - public boolean continuation; - -/** - * Output value: number of characters processed in the source data by - * the last transform - */ - public int inpCount; -/** - * Output value: number of characters written in the destination data by - * the last transform - */ - public int outCount; -/** - * Output value: source-to-destination map from the last transform with - * srcToDstMapRequired specified; if this option was not specified, the - * content of srcToDstMap should be ignored. - *

            - * If when starting a transformation this field refers to a large enough - * array of integers, this array will be re-used to put the new map. - * Otherwise a new array will be created. - *

            This map has a number for each character processed in the source - * data by the last transform. This number is the index of where this - * character is moved in the character array of the destination BidiText. - * If the removeMarkers option was specified and LRM or RLM markers have - * been removed from the destination text, the corresponding elements of - * srcToDstMap will contain -1. - *

            Note that the allocated array may have more elements than the number - * of characters processed in the source BidiText. In that case, the - * extra elements should be ignored. The number of relevant elements - * can be found in inpCount. - */ - public int[] srcToDstMap; -/** - * Output value: destination-to-source map from the last transform with - * dstToSrcMapRequired specified; if this option was not specified, the - * content of dstToSrcMap should be ignored. - *

            - * If when starting a transformation this field refers to a large enough - * array of integers, this array will be re-used to put the new map. - * Otherwise a new array will be created. - *

            This map has a number for each character in the "interesting" data - * of the destination BidiText. This number is the index of the source - * character from which the destination character originates. This index - * is relative to the beginning of the "interesting" data. If the offset - * of the source BidiText is not zero, index 0 does not indicate the first - * character of the data array, but the character at position "offset". - * If the insertMarkers option was specified and LRM or RLM markers have - * been added, the corresponding elements of dstToSrcMap will contain -1. - *

            Note that the allocated array may have more elements than the number - * of characters in the "interesting" part of the destination BidiText. - * In that case, the extra elements should be ignored. The number of - * relevant elements can be found in outCount. - */ - public int[] dstToSrcMap; -/** - * Output value: property map from the last transform with - * propertyMapRequired specified; if this option was not specified, the - * content of propertyMap should be ignored. - *

            - * If when starting a transformation this field refers to a large enough - * array of bytes, this array will be re-used to put the new map. - * Otherwise a new array will be created. - *

            This map has a byte for each character processed in the source - * data by the last transform. The 6 lower bits of each property element - * is the Bidi level of the corresponding input character. - * The highest bit is a new-cell indicator for composed character - * environments: a value of 0 indicates a zero-length composing character - * element, and a value of 1 indicates an element that begins a new cell. - *

            Note: the content of this map has no simple interpretation if impToImp - * is true. - *

            Note also that the allocated array may have more elements than the - * number of characters processed in the source BidiText. In that case, - * the extra elements should be ignored. The number of relevant elements - * can be found in inpCount. - */ - public byte[] propertyMap; - - BidiOrder myOrder; - BidiShape myShape; - BidiFlagSet flags1, flags2; - Vector insertPoints; - - long internalState; /* used by continuation calls */ - -} diff --git a/cvsroot/src/com/ibm/as400/access/BinaryConverter.java b/cvsroot/src/com/ibm/as400/access/BinaryConverter.java deleted file mode 100644 index c333d5379..000000000 --- a/cvsroot/src/com/ibm/as400/access/BinaryConverter.java +++ /dev/null @@ -1,631 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BinaryConverter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - A binary types converter between Java byte arrays and Java simple types. -

            - Note: Some methods of this class accept an array-valued argument in addition to arguments that specify an array offset and possibly also a length. - All such methods will throw an {@link ArrayIndexOutOfBoundsException ArrayIndexOutOfBoundsException} if the offset and/or length are not valid for the array. - **/ -public class BinaryConverter -{ - // Don't allow instances of this class. - private BinaryConverter() - { - } - - /** - Convert the specified short into IBM i format in the specified byte array. - The converted value will occupy 2 bytes. - @param shortValue The value to be converted to IBM i format. - @param serverValue The array to receive the data type in IBM i format. - @param offset The offset into the byte array for the start of the IBM i value. - **/ - public static void shortToByteArray(short shortValue, byte[] serverValue, int offset) - { - if (serverValue == null) throw new NullPointerException("serverValue"); - - serverValue[offset] = (byte)(shortValue >>> 8); - serverValue[offset+1] = (byte) shortValue; - } - - /** - Convert the specified short into IBM i format in a byte array. - @param shortValue The value to be converted to IBM i format. - @return An array (of length 2) with the data type in IBM i format. - **/ - public static byte[] shortToByteArray(short shortValue) - { - byte[] serverValue = new byte[2]; - shortToByteArray(shortValue, serverValue, 0); - return serverValue; - } - - /** - Convert the specified IBM i data type to a short. - @param serverValue The array containing the data type in IBM i format. - @param offset The offset into the byte array for the start of the IBM i value. - @return a short corresponding to the data type. - **/ - public static short byteArrayToShort(byte[] serverValue, int offset) - { - checkArgs(serverValue, offset); - return(short)(((serverValue[offset] & 0xFF) << 8) + - (serverValue[offset+1] & 0xFF)); - } - - /** - Convert the specified int into IBM i format in the specified byte array. - The converted value will occupy 4 bytes. - @param intValue The value to be converted to IBM i format. - @param serverValue The array to receive the data type in IBM i format. - @param offset The offset into the byte array for the start of the IBM i value. - **/ - public static void intToByteArray(int intValue, byte[] serverValue, int offset) - { - checkArgs(serverValue, offset); - serverValue[offset] = (byte)(intValue >>> 24); - serverValue[offset+1] = (byte)(intValue >>> 16); - serverValue[offset+2] = (byte)(intValue >>> 8); - serverValue[offset+3] = (byte) intValue; - } - - /** - Convert the specified int into IBM i format in a byte array. - @param intValue The value to be converted to IBM i format. - @return An array (of length 4) with the data type in IBM i format. - **/ - public static byte[] intToByteArray(int intValue) - { - byte[] serverValue = new byte[4]; - intToByteArray(intValue, serverValue, 0); - return serverValue; - } - - /** - Convert the specified IBM i data type to an int. - @param serverValue The array containing the data type in IBM i format. - @param offset The offset into the byte array for the start of the IBM i value. - @return an int corresponding to the data type. - **/ - public static int byteArrayToInt(byte[] serverValue, int offset) - { - checkArgs(serverValue, offset); - return((serverValue[offset] & 0xFF) << 24) + - ((serverValue[offset+1] & 0xFF) << 16) + - ((serverValue[offset+2] & 0xFF) << 8) + - (serverValue[offset+3] & 0xFF); - } - - /** - Convert the specified float into IBM i format in the specified byte array. - The converted value will occupy 4 bytes. - @param floatValue The value to be converted to IBM i format. - @param serverValue The array to receive the data type in IBM i format. - @param offset The offset into the byte array for the start of the IBM i value. - **/ - public static void floatToByteArray(float floatValue, byte[] serverValue, int offset) - { - checkArgs(serverValue, offset); - int bits = Float.floatToIntBits(floatValue); - serverValue[offset] = (byte)(bits >>> 24); - serverValue[offset+1] = (byte)(bits >>> 16); - serverValue[offset+2] = (byte)(bits >>> 8); - serverValue[offset+3] = (byte) bits; - } - - /** - Convert the specified float into IBM i format in a byte array. - @param floatValue The value to be converted to IBM i format. - @return An array (of length 4) with the data type in IBM i format. - @deprecated Use floatToByteArray(float) instead. - **/ - public static byte[] floatToByteArray(int floatValue) - { - byte[] serverValue = new byte[4]; - floatToByteArray(floatValue, serverValue, 0); - return serverValue; - } - - /** - Convert the specified float into IBM i format in a byte array. - @param floatValue The value to be converted to IBM i format. - @return An array (of length 4) with the data type in IBM i format. - **/ - public static byte[] floatToByteArray(float floatValue) - { - byte[] serverValue = new byte[4]; - floatToByteArray(floatValue, serverValue, 0); - return serverValue; - } - - /** - Convert the specified IBM i data type to a float. - @param serverValue The array containing the data type in IBM i format. - @param offset The offset into the byte array for the start of the IBM i value. - @return a float corresponding to the data type. - **/ - public static float byteArrayToFloat(byte[] serverValue, int offset) - { - checkArgs(serverValue, offset); - int bits = ((serverValue[offset] & 0xFF) << 24) + - ((serverValue[offset+1] & 0xFF) << 16) + - ((serverValue[offset+2] & 0xFF) << 8) + - (serverValue[offset+3] & 0xFF); - return Float.intBitsToFloat(bits); - } - - /** - Convert the specified double into IBM i format in the specified byte array. - The converted value will occupy 8 bytes. - @param doubleValue The value to be converted to IBM i format. - @param serverValue The array to receive the data type in IBM i format. - @param offset The offset into the byte array for the start of the IBM i value. - **/ - public static void doubleToByteArray(double doubleValue, byte[] serverValue, int offset) - { - checkArgs(serverValue, offset); - long bits = Double.doubleToLongBits(doubleValue); - - // Do in two parts to avoid long temps. - int high = (int)(bits >>> 32); - int low = (int)bits; - - serverValue[offset] = (byte)(high >>> 24); - serverValue[offset+1] = (byte)(high >>> 16); - serverValue[offset+2] = (byte)(high >>> 8); - serverValue[offset+3] = (byte) high; - - serverValue[offset+4] = (byte)(low >>> 24); - serverValue[offset+5] = (byte)(low >>> 16); - serverValue[offset+6] = (byte)(low >>> 8); - serverValue[offset+7] = (byte) low; - } - - /** - Convert the specified double into IBM i format in a byte array. - @param doubleValue The value to be converted to IBM i format. - @return An array (of length 8) with the data type in IBM i format. - **/ - public static byte[] doubleToByteArray(double doubleValue) - { - byte[] serverValue = new byte[8]; - doubleToByteArray(doubleValue, serverValue, 0); - return serverValue; - } - - /** - Convert the specified IBM i data type to a double. - @param serverValue The array containing the data type in IBM i format. - @param offset The offset into the byte array for the start of the IBM i value. - @return a double corresponding to the data type. - **/ - public static double byteArrayToDouble(byte[] serverValue, int offset) - { - checkArgs(serverValue, offset); - - // Do in two parts to avoid long temps. - int firstPart = ((serverValue[offset] & 0xFF) << 24) + - ((serverValue[offset+1] & 0xFF) << 16) + - ((serverValue[offset+2] & 0xFF) << 8) + - (serverValue[offset+3] & 0xFF); - int secondPart = ((serverValue[offset+4] & 0xFF) << 24) + - ((serverValue[offset+5] & 0xFF) << 16) + - ((serverValue[offset+6] & 0xFF) << 8) + - (serverValue[offset+7] & 0xFF); - long bits = ((long)firstPart << 32) + (secondPart & 0xFFFFFFFFL); - return Double.longBitsToDouble(bits); - } - - /** - Convert the specified int into IBM i format in the specified byte array. - The converted value will occupy 2 bytes. - @param intValue The value to be converted to IBM i format. The integer should be greater than or equal to zero and representable in two bytes. - @param serverValue The array to receive the data type in IBM i format. - @param offset The offset into the byte array for the start of the IBM i value. - **/ - public static void unsignedShortToByteArray(int intValue, byte[] serverValue, int offset) - { - checkArgs(serverValue, offset); - - serverValue[offset] = (byte)(intValue >>> 8); - serverValue[offset+1] = (byte) intValue; - } - - /** - Convert the specified int into IBM i format in a byte array. - @param intValue The value to be converted to IBM i format. The integer should be greater than or equal to zero and representable in two bytes. - @return An array (of length 2) with the data type in IBM i format. - **/ - public static byte[] unsignedShortToByteArray(int intValue) - { - byte[] serverValue = new byte[2]; - unsignedShortToByteArray(intValue, serverValue, 0); - return serverValue; - } - - /** - Convert the specified IBM i data type to an int. - @param serverValue The array containing the data type in IBM i format. - @param offset The offset into the byte array for the start of the IBM i value. - @return an int corresponding to the data type, derived from the 2 bytes of data starting at the specified offset. - **/ - public static int byteArrayToUnsignedShort(byte[] serverValue, int offset) - { - checkArgs(serverValue, offset); - - return((serverValue[offset] & 0xFF) << 8) + - (serverValue[offset+1] & 0xFF); - } - - /** - Convert the specified long into IBM i format in the specified byte array. - The converted value will occupy 4 bytes. - @param longValue The value to be converted to IBM i format. The long should be greater than or equal to zero and representable in four bytes. - @param serverValue The array to receive the data type in IBM i format. - @param offset The offset into the byte array for the start of the IBM i value. - **/ - public static void unsignedIntToByteArray(long longValue, byte[] serverValue, int offset) - { - checkArgs(serverValue, offset); - - // Grab bits into int to avoid long temps. - int bits = (int)longValue; - serverValue[offset] = (byte)(bits >>> 24); - serverValue[offset+1] = (byte)(bits >>> 16); - serverValue[offset+2] = (byte)(bits >>> 8); - serverValue[offset+3] = (byte) bits; - } - - /** - Convert the specified long into IBM i format in a byte array. - @param longValue The value to be converted to IBM i format. The long should be greater than or equal to zero and representable in four bytes. - @return An array (of length 4) with the data type in IBM i format. - **/ - public static byte[] unsignedIntToByteArray(long longValue) - { - byte[] serverValue = new byte[4]; - unsignedIntToByteArray(longValue, serverValue, 0); - return serverValue; - } - - /** - Convert the specified IBM i data type to a long. - @param serverValue The array containing the data type in IBM i format. - @param offset The offset into the byte array for the start of the IBM i value. - @return a long corresponding to the data type. - **/ - public static long byteArrayToUnsignedInt(byte[] serverValue, int offset) - { - checkArgs(serverValue, offset); - - return(((serverValue[offset] & 0xFF) << 24) + - ((serverValue[offset+1] & 0xFF) << 16) + - ((serverValue[offset+2] & 0xFF) << 8) + - (serverValue[offset+3] & 0xFF)) & 0xFFFFFFFFL; - } - - /** - Convert the specified long into IBM i format in the specified byte array. - The converted value will occupy 8 bytes. - @param longValue The value to be converted to IBM i format. - @param serverValue The array to receive the data type in IBM i format. - @param offset The offset into the byte array for the start of the IBM i value. - **/ - public static void longToByteArray(long longValue, byte[] serverValue, int offset) - { - checkArgs(serverValue, offset); - - // Do in two parts to avoid long temps. - int high = (int)(longValue >>> 32); - int low = (int)longValue; - - serverValue[offset] = (byte)(high >>> 24); - serverValue[offset+1] = (byte)(high >>> 16); - serverValue[offset+2] = (byte)(high >>> 8); - serverValue[offset+3] = (byte) high; - - serverValue[offset+4] = (byte)(low >>> 24); - serverValue[offset+5] = (byte)(low >>> 16); - serverValue[offset+6] = (byte)(low >>> 8); - serverValue[offset+7] = (byte) low; - } - - /** - Convert the specified long into IBM i format in a byte array. - @param longValue The value to be converted to IBM i format. - @return An array (of length 8) with the data type in IBM i format. - **/ - public static byte[] longToByteArray(long longValue) - { - byte[] serverValue = new byte[8]; - longToByteArray(longValue, serverValue, 0); - return serverValue; - } - - /** - Convert the specified IBM i data type to a long. - @param serverValue The array containing the data type in IBM i format. - @param offset The offset into the byte array for the start of the IBM i value. - @return a long corresponding to the data type. - **/ - public static long byteArrayToLong(byte[] serverValue, int offset) - { - checkArgs(serverValue, offset); - - // Do in two parts to avoid long temps. - int firstPart = ((serverValue[offset] & 0xFF) << 24) + - ((serverValue[offset+1] & 0xFF) << 16) + - ((serverValue[offset+2] & 0xFF) << 8) + - (serverValue[offset+3] & 0xFF); - int secondPart = ((serverValue[offset+4] & 0xFF) << 24) + - ((serverValue[offset+5] & 0xFF) << 16) + - ((serverValue[offset+6] & 0xFF) << 8) + - (serverValue[offset+7] & 0xFF); - return((long)firstPart << 32) + (secondPart & 0xFFFFFFFFL); - } - - static byte[] charArrayToByteArray(char[] charValue) - { - if (charValue == null) return null; - byte[] byteValue = new byte[charValue.length * 2]; - int inPos = 0; - int outPos = 0; - while (inPos < charValue.length) - { - byteValue[outPos++] = (byte)(charValue[inPos] >> 8); - byteValue[outPos++] = (byte)charValue[inPos++]; - } - return byteValue; - } - - static char[] byteArrayToCharArray(byte[] byteValue) - { - if (byteValue == null) return null; - char[] charValue = new char[byteValue.length / 2]; - int inPos = 0; - int outPos = 0; - while (inPos < byteValue.length) - { - charValue[outPos++] = (char)(((byteValue[inPos++] & 0xFF) << 8) + (byteValue[inPos++] & 0xFF)); - } - return charValue; - } - -// Constant used in bytesToHexString() - private static final char[] c_ = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; - - static final char hiNibbleToChar(byte b) - { - return c_[(b >>> 4) & 0x0F]; - } - - static final char loNibbleToChar(byte b) - { - return c_[b & 0x0F]; - } - - /** - Convert the specified byte array to its hexadecimal String representation. - Example generated string: "010203047E7F". - @param b The array containing the data. - @return A String containing the hex characters that represent the byte data. - @deprecated Replaced by bytesToHexString(). (Same implementation, better name.) - **/ - public static final String bytesToString(final byte[] b) - { - if (b == null) throw new NullPointerException("b"); - return bytesToHexString(b, 0, b.length); - } - - /** - Convert the specified byte array to its hexadecimal String representation. - Example generated string: "010203047E7F". - @param b The array containing the data. - @param offset The offset into the array at which to begin reading bytes. - @param length The number of bytes to read out of the array. - @return A String containing the hex characters that represent the byte data. - @deprecated Replaced by bytesToHexString(). (Same implementation, better name.) - **/ - public static final String bytesToString(final byte[] b, int offset, int length) - { - return bytesToHexString(b, offset, length); - } - - /** - Convert the specified byte array to its hexadecimal String representation. - Example generated string: "010203047E7F". - @param b The array containing the data. - @return A String containing the hex characters that represent the byte data. - **/ - public static final String bytesToHexString(final byte[] b) - { - if (b == null) throw new NullPointerException("b"); - return bytesToHexString(b, 0, b.length); - } - - /** - Convert the specified byte array to its hexadecimal String representation. - Example generated string: "010203047E7F". - @param b The array containing the data. - @param offset The offset into the array at which to begin reading bytes. - @param length The number of bytes to read out of the array. - @return A String containing the hex characters that represent the byte data. - **/ - public static final String bytesToHexString(final byte[] b, int offset, int length) - { - if (b == null) throw new NullPointerException("b"); - - char[] c = new char[length*2]; - int num = bytesToHexString(b, offset, length, c, 0); - return new String(c, 0, num); - } - - // Helper method to convert a byte array into its hex string representation. - // This is faster than calling Integer.toHexString(...) - static final int bytesToHexString(final byte[] b, int offset, int length, final char[] c, int coffset) - { - for (int i=0; i>>4) & 0x0F); - final byte lo = (byte)((b[i+offset] & 0x0F)); - c[j+coffset] = c_[hi]; - c[j+coffset+1] = c_[lo]; - } - return length*2; - } - - // Constant used in stringToBytes() - // Note that 0x11 is "undefined". - private static final byte[] b_ = - { - 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, - 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, - 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, - 0x11, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, - 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, - 0x11, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, - 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, - 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, - 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, - 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, - 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, - 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, - 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, - 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, - 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 - }; - - static final byte charsToByte(char hi, char lo) - { - int c1 = 0x00FFFF & hi; - int c2 = 0x00FFFF & lo; - if (c1 > 255 || c2 > 255) throw new NumberFormatException(); - byte b1 = b_[c1]; - byte b2 = b_[c2]; - if (b1 == 0x11 || b2 == 0x11) return 0; - return(byte)(((byte)(b1 << 4)) + b2); - } - - static final void checkArgs(byte[] serverValue, int offset) - throws NullPointerException - { - if (serverValue == null) throw new NullPointerException("serverValue"); - - if (offset < 0 || (offset > serverValue.length-1)) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Offset " + offset + " was specified for array of length " + serverValue.length + "."); - throw new ArrayIndexOutOfBoundsException(String.valueOf(offset)); - } - } - - - /** - Convert the specified hexadecimal String into a byte array containing the byte values for the - hexadecimal characters in the String. If the String contains characters other than those allowed - for a hexadecimal String (0-9 and A-F), an exception will be thrown. - @param s The String containing the hexadecimal representation of the data. - @return A byte array containing the byte values of the hex characters. - **/ - public static final byte[] stringToBytes(String s) - { - if (s == null) throw new NullPointerException("s"); - - int stringLength = s.length(); //@KBA check for empty string - if(stringLength > 2) //@KBA //@pdc allow for input single digit input like "X" so NumberFormatException is thrown instead of array bounds error - { //@KBA - if(s.charAt(0) == '0' && (s.charAt(1) == 'x' || s.charAt(1) == 'X')) //@KBA - s = s.substring(2); //@KBA - else if((s.charAt(0) == 'x' || s.charAt(0) == 'X') && s.charAt(1) == '\'') //@KBA - { //@KBA - if(s.charAt(stringLength - 1) == '\'') //@KBA - s = s.substring(2, stringLength-1); //@KBA - else //@KBA - throw new NumberFormatException(); //@KBA - } //@KBA - } //@KBA - - //check if an odd number of characters //@KBA - if(s.length()%2 != 0) //@KBA - s = "0" + s; //@KBA - - char[] c = s.toCharArray(); - return stringToBytes(c, 0, c.length); - } - - static final byte[] stringToBytes(char[] hex, int offset, int length) - { - if (hex.length == 0) return new byte[0]; - byte[] buf = new byte[(length+1)/2]; - int num = stringToBytes(hex, offset, length, buf, 0); - if (num < buf.length) - { - byte[] temp = buf; - buf = new byte[num]; - System.arraycopy(temp, 0, buf, 0, num); - } - return buf; - } - - // Helper method to convert a String in hex into its corresponding byte array. - static final int stringToBytes(char[] hex, int offset, int length, final byte[] b, int boff) - { - if (hex.length == 0) return 0; - - // account for char[] of odd length - //@KBD if (hex.length % 2 == 1) //@KBD put checks in stringToBytes(String s) - //@KBD { - //@KBD char[] temp = hex; - //@KBD hex = new char[temp.length+1]; - //@KBD System.arraycopy(temp, 0, hex, 0, temp.length-1); - //@KBD hex[hex.length-2] = '0'; - //@KBD hex[hex.length-1] = temp[temp.length-1]; - //@KBD } - //@KBD if (hex[offset] == '0' && (hex.length > offset+1 && (hex[offset+1] == 'X' || hex[offset+1] == 'x'))) - //@KBD { - //@KBD offset += 2; - //@KBD length -= 2; - //@KBD } - for (int i=0; i 255 || c2 > 255) // out of range - { - //b[i+boff] = 0x00; - throw new NumberFormatException(); - } - else - { - final byte b1 = b_[c1]; - final byte b2 = b_[c2]; - if (b1 == 0x11 || b2 == 0x11) // out of range - { - //b[i+boff] = 0x00; - throw new NumberFormatException(); - } - else - { - final byte hi = (byte)(b1<<4); - b[i+boff] = (byte)(hi + b2); - } - } - } - return b.length; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/BinaryFieldDescription.java b/cvsroot/src/com/ibm/as400/access/BinaryFieldDescription.java deleted file mode 100644 index c53a69ee5..000000000 --- a/cvsroot/src/com/ibm/as400/access/BinaryFieldDescription.java +++ /dev/null @@ -1,767 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BinaryFieldDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.math.BigInteger; -import java.util.Vector; - -/** - *Represents the description of the data in a binary (integer) field. - *This class allows: - *

              - *
            • The user to describe a binary field to the RecordFormat object. - *
            • The RecordFormat object to describe a binary field to the user. - *
            - *Click hereto see an example. - *

            - *As of OS/400 V4R5, DDS supports up to 8-byte (18-digit) binary field descriptions. - *Using any of the data types that result in a byte length greater than 4 or a number of - *digits greater than 9 on a release prior to V4R5 may give unexpected results. - **/ -public class BinaryFieldDescription extends FieldDescription implements Serializable -{ - static final long serialVersionUID = -2040945751371810257L; - /** - *Constructs a BinaryFieldDescription object. - **/ - public BinaryFieldDescription() - { - } - - /** - *Constructs a BinaryFieldDescription object. It uses the specified data type and name - *of the field. - *The length of this field is represented by the number of digits it can contain. - *This constructor defaults the length (as returned by getLength()) to 9. - *The length is used by the Record Level Access classes when creating a file from - *a RecordFormat object. The maximum number of digits allowed for a binary field by DDS is 18. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public BinaryFieldDescription(AS400Bin4 dataType, String name) - { - // When no length is specified, we pass length of 9 in case field will be - // used for DDS. If this is the case, the length represents the number of - // digits in the field, not the byte length of the field. - super(dataType, name); - length_ = 9; - - } - - /** - *Constructs a BinaryFieldDescription object. It uses the specified data type, name, - *DDS name, and length of the field. This constructor is used when the field description will - *be used with the record level access classes. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - *@param length The number of digits that the field will hold. This is the length of - * the field as it would appear in a DDS description. The length - * must be greater than 0. - **/ - public BinaryFieldDescription(AS400Bin4 dataType, String name, String ddsName, int length) - { - super(dataType, name, ddsName); - if (length < 1) - { - throw new ExtendedIllegalArgumentException("length (" + String.valueOf(length) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - length_ = length; - } - - /** - *Constructs a BinaryFieldDescription object. It uses the specified data type and name - *of the field. - *The length of this field is represented by the number of digits it can contain. - *This constructor defaults the length (as returned by getLength()) to 9. - *The length is used by the Record Level Access classes when creating a file from - *a RecordFormat object. The maximum number of digits allowed for a binary field by DDS is 18. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public BinaryFieldDescription(AS400UnsignedBin4 dataType, String name) - { - // When no length is specified, we pass length of 9 in case field will be - // used for DDS. If this is the case, the length represents the number of - // digits in the field, not the byte length of the field. - super(dataType, name); - length_ = 9; - - } - - /** - *Constructs a BinaryFieldDescription object. It uses the specified data type, name, - *DDS name, and length of the field. This constructor is used when the field description will - *be used with the record level access classes. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - *@param length The number of digits that the field will hold. This is the length of - * the field as it would appear in a DDS description. The length - * must be greater than 0. - **/ - public BinaryFieldDescription(AS400UnsignedBin4 dataType, String name, String ddsName, int length) - { - super(dataType, name, ddsName); - if (length < 1) - { - throw new ExtendedIllegalArgumentException("length (" + String.valueOf(length) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - length_ = length; - } - - /** - *Constructs a BinaryFieldDescription object. It uses the specified data type and name - *of the field. - *The length of this field is represented by the number of digits it can contain. - *This constructor defaults the length (as returned by getLength()) to 18. - *The length is used by the Record Level Access classes when creating a file from - *a RecordFormat object. The maximum number of digits allowed for a binary field by DDS is 18. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public BinaryFieldDescription(AS400Bin8 dataType, String name) - { - // When no length is specified, we pass length of 18 in case field will be - // used for DDS. If this is the case, the length represents the number of - // digits in the field, not the byte length of the field. - super(dataType, name); - length_ = 18; - - } - - /** - *Constructs a BinaryFieldDescription object. It uses the specified data type, name, - *DDS name, and length of the field. This constructor is used when the field description will - *be used with the record level access classes. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - *@param length The number of digits that the field will hold. This is the length of - * the field as it would appear in a DDS description. The length - * must be greater than 0. - **/ - public BinaryFieldDescription(AS400Bin8 dataType, String name, String ddsName, int length) - { - super(dataType, name, ddsName); - if (length < 1) - { - throw new ExtendedIllegalArgumentException("length (" + String.valueOf(length) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - length_ = length; - } - - /** - *Constructs a BinaryFieldDescription object. It uses the specified data type and name - *of the field. - *The length of this field is represented by the number of digits it can contain. - *This constructor defaults the length (as returned by getLength()) to 18. - *The length is used by the Record Level Access classes when creating a file from - *a RecordFormat object. The maximum number of digits allowed for a binary field by DDS is 18. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public BinaryFieldDescription(AS400UnsignedBin8 dataType, String name) - { - // When no length is specified, we pass length of 18 in case field will be - // used for DDS. If this is the case, the length represents the number of - // digits in the field, not the byte length of the field. - super(dataType, name); - length_ = 18; - - } - - /** - *Constructs a BinaryFieldDescription object. It uses the specified data type, name, - *DDS name, and length of the field. This constructor is used when the field description will - *be used with the record level access classes. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - *@param length The number of digits that the field will hold. This is the length of - * the field as it would appear in a DDS description. The length - * must be greater than 0. - **/ - public BinaryFieldDescription(AS400UnsignedBin8 dataType, String name, String ddsName, int length) - { - super(dataType, name, ddsName); - if (length < 1) - { - throw new ExtendedIllegalArgumentException("length (" + String.valueOf(length) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - length_ = length; - } - - /** - *Constructs a BinaryFieldDescription object. It uses the specified data type and name of the field. - *The length of this field is represented by the number of digits it can contain. - *This constructor defaults the length (as returned by getLength()) to 4. - *The length is used by the Record Level Access classes when creating a file from - *a RecordFormat object. Four (4) is the maximum number of digits allowed for a binary field - *(when represented by a bin2) by DDS. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public BinaryFieldDescription(AS400Bin2 dataType, String name) - { - // When no length is specified, we pass length of 4 in case field will be - // used for DDS. If this is the case, the length represents the number of - // digits in the field, not the byte length of the field. - super(dataType, name); - length_ = 4; // @A2A - // length_ = 5; // @A2D - } - - /** - *Constructs a BinaryFieldDescription object. It uses the specified data type, name, - *DDS name, and length of the field. This constructor is used when the field description will - *be used with the record level access classes. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - *@param length The number of digits that the field will hold. This is the length of - * the field as it would appear in a DDS description. The length - * must be greater than 0. - **/ - public BinaryFieldDescription(AS400Bin2 dataType, String name, String ddsName, int length) - { - super(dataType, name, ddsName); - if (length < 1) - { - throw new ExtendedIllegalArgumentException("length (" + String.valueOf(length) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - length_ = length; - } - - - /** - *Constructs a BinaryFieldDescription object. It uses the specified data type and name of the field. - *The length of this field is represented by the number of digits it can contain. - *This constructor defaults the length (as returned by getLength()) to 4. - *The length is used by the Record Level Access classes when creating a file from - *a RecordFormat object. Four (4) is the maximum number of digits allowed for a binary field - *(when represented by a bin2) by DDS. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public BinaryFieldDescription(AS400UnsignedBin2 dataType, String name) - { - // When no length is specified, we pass length of 4 in case field will be - // used for DDS. If this is the case, the length represents the number of - // digits in the field, not the byte length of the field. - super(dataType, name); - length_ = 4; - } - - /** - *Constructs a BinaryFieldDescription object. It uses the specified data type, name, - *DDS name, and length of the field. This constructor is used when the field description will - *be used with the record level access classes. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - *@param length The number of digits that the field will hold. This is the length of - * the field as it would appear in a DDS description. The length - * must be greater than 0. - **/ - public BinaryFieldDescription(AS400UnsignedBin2 dataType, String name, String ddsName, int length) - { - super(dataType, name, ddsName); - if (length < 1) - { - throw new ExtendedIllegalArgumentException("length (" + String.valueOf(length) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - length_ = length; - } - - /** - *Constructs a BinaryFieldDescription object. It uses the specified data type and name of the field. - *The length of this field is represented by the number of digits it can contain. - *This constructor defaults the length (as returned by getLength()) to 3. - *The length is used by the Record Level Access classes when creating a file from - *a RecordFormat object. Three (3) is the maximum number of digits allowed for a binary field - *(when represented by a bin1) by DDS. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public BinaryFieldDescription(AS400Bin1 dataType, String name) - { - // When no length is specified, we pass length of 4 in case field will be - // used for DDS. If this is the case, the length represents the number of - // digits in the field, not the byte length of the field. - super(dataType, name); - length_ = 3; - } - - /** - *Constructs a BinaryFieldDescription object. It uses the specified data type, name, - *DDS name, and length of the field. This constructor is used when the field description will - *be used with the record level access classes. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - *@param length The number of digits that the field will hold. This is the length of - * the field as it would appear in a DDS description. The length - * must be greater than 0. - **/ - public BinaryFieldDescription(AS400Bin1 dataType, String name, String ddsName, int length) - { - super(dataType, name, ddsName); - if (length < 1) - { - throw new ExtendedIllegalArgumentException("length (" + String.valueOf(length) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - length_ = length; - } - - - /** - *Constructs a BinaryFieldDescription object. It uses the specified data type and name of the field. - *The length of this field is represented by the number of digits it can contain. - *This constructor defaults the length (as returned by getLength()) to 3. - *The length is used by the Record Level Access classes when creating a file from - *a RecordFormat object. Three (3) is the maximum number of digits allowed for a binary field - *(when represented by a bin1) by DDS. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public BinaryFieldDescription(AS400UnsignedBin1 dataType, String name) - { - // When no length is specified, we pass length of 4 in case field will be - // used for DDS. If this is the case, the length represents the number of - // digits in the field, not the byte length of the field. - super(dataType, name); - length_ = 3; - } - - /** - *Constructs a BinaryFieldDescription object. It uses the specified data type, name, - *DDS name, and length of the field. This constructor is used when the field description will - *be used with the record level access classes. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - *@param length The number of digits that the field will hold. This is the length of - * the field as it would appear in a DDS description. The length - * must be greater than 0. - **/ - public BinaryFieldDescription(AS400UnsignedBin1 dataType, String name, String ddsName, int length) - { - super(dataType, name, ddsName); - if (length < 1) - { - throw new ExtendedIllegalArgumentException("length (" + String.valueOf(length) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - length_ = length; - } - - - /** - *Returns the DDS description for the field. This is a string containing - *the description of the field as it would be specified in a DDS source file. - *This method is used by AS400File.createDDSSourceFile to specify the field - *in the DDS source file which is used to create the file for the user who - *has passed in a RecordFormat object. - *@return The DDS description of this field properly formatted for entry - *into a DDS source file. - **/ - String[] getDDSDescription() - { - Vector v = new Vector(); - // Name columns (10) - StringBuffer desc = new StringBuffer(ddsName_); - // Blank pad the ddsName to 10 characters. - while(desc.length() < 10) - { - desc.append(" "); - } - // Reference column (1) - if (!refFld_.equals("")) - { - desc.append("R"); - } - else - { - desc.append(" "); - } - // Get length as 5 digit string, right justified -/* StringBuffer len = new StringBuffer(new Integer(length_).toString()); - if (len.length() < 5) - { - int blanksNeeded = 5 - len.length(); - for (short i = 0; i < blanksNeeded; ++i) - { - len.insert(0, " "); - } - } -*/ - String len = String.valueOf(length_); - int numSpaces = 5-len.length(); - for (int i=0; idataType - *cannot be null. - **/ - public void setDataType(AS400Bin1 dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length to the default value if it has not already been set via setLength - if (length_ == 0) - { - length_ = 3; // 3 is the maximum #digits allowed for DDS for a binary field of 1 byte. - } - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400UnsignedBin1 dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length to the default value if it has not already been set via setLength - if (length_ == 0) - { - length_ = 3; // 3 is the maximum #digits allowed for DDS for a binary field of 1 byte. - } - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400Bin2 dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length to the default value if it has not already been set via setLength - if (length_ == 0) - { - length_ = 4; // 4 is the maximum #digits allowed for DDS for a binary field of 2 bytes. @C0C - } - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400UnsignedBin2 dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length to the default value if it has not already been set via setLength - if (length_ == 0) - { - length_ = 4; // 4 is the maximum #digits allowed for DDS for a binary field of 2 bytes. @C0C - } - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400Bin4 dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length to the default value if it has not already been set via setLength - if (length_ == 0) - { - length_ = 9; // 9 is the maximum #digits allowed for DDS for a binary field of 4 bytes. - } - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400UnsignedBin4 dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length to the default value if it has not already been set via setLength - if (length_ == 0) - { - length_ = 9; // 9 is the maximum #digits allowed for DDS for a binary field of 4 bytes. - } - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400Bin8 dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length to the default value if it has not already been set via setLength - if (length_ == 0) - { - length_ = 18; // 18 is the maximum #digits allowed for DDS for a binary field of 8 bytes. - } - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400UnsignedBin8 dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length to the default value if it has not already been set via setLength - if (length_ == 0) - { - length_ = 18; // 18 is the maximum #digits allowed for DDS for a binary field of 8 bytes. - } - } - - /** - *Sets the value for the DFT keyword for this field. Use this - *version of setDFT() when an AS400Bin4 or AS400UnsignedBin2 object was used to - *construct the object. - *@param defaultValue The default value for this - *field. The defaultValuecannot be null. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(Integer defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; //@B0A - isDFTCurrent_ = false; //@B0A - DFTCurrentValue_ = null; //@B0A - } - - /** - *Sets the value for the DFT keyword for this field. Use this - *version of setDFT() when an UnsignedAS400Bin8 object was used to - *construct the object. - *@param defaultValue The default value for this - * field. The defaultValuecannot be null. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(BigInteger defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; - isDFTCurrent_ = false; - DFTCurrentValue_ = null; - } - - /** - *Sets the value for the DFT keyword for this field. Use this - *version of setDFT() when an AS400UnsignedBin4 or AS400Bin8 object was used to - *construct the object. - *@param defaultValue The default value for this - *field. The defaultValuecannot be null. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(Long defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; - isDFTCurrent_ = false; - DFTCurrentValue_ = null; - } - - /** - *Sets the value for the DFT keyword for this field. Use this - *version of setDFT() when an AS400UnsignedBin1 or AS400Bin2 object was used to - *construct the object. - *@param defaultValue The default value for this - * field. The defaultValuecannot be null. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(Short defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; //@B0A - isDFTCurrent_ = false; //@B0A - DFTCurrentValue_ = null; //@B0A - } - - /** - *Sets the value for the DFT keyword for this field. Use this - *version of setDFT() when an AS400Bin1 object was used to - *construct the object. - *@param defaultValue The default value for this - * field. The defaultValuecannot be null. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(Byte defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; - isDFTCurrent_ = false; - DFTCurrentValue_ = null; - } - - /** - *Sets the value for the DFT keyword to be *NULL for this field. - *Calling this method will replace the DFT keyword that was previously - *set on a call to setDFT(). Note: This field - *must also have its ALWNULL keyword set to true to prevent DDS errors. - **/ - public void setDFTNull() - { - isDFTNull_ = true; - defaultValue_ = null; - isDFTCurrent_ = false; - DFTCurrentValue_ = null; - } - - /** - *Sets the length of this field. - *@param length The length of this field. The length must be greater than zero. - **/ - public void setLength(int length) - { - if (length < 1) - { - throw new ExtendedIllegalArgumentException("length (" + String.valueOf(length) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - length_ = length; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/BytesWithOffset.java b/cvsroot/src/com/ibm/as400/access/BytesWithOffset.java deleted file mode 100644 index c90958f83..000000000 --- a/cvsroot/src/com/ibm/as400/access/BytesWithOffset.java +++ /dev/null @@ -1,47 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: BytesWithOffset.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; //@C1A -import java.util.Vector; //@C1A - - -// Class that represents some data and an offset into it. -class BytesWithOffset -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - byte[] data_; - int offset_ = 0; - - BytesWithOffset(byte[] data) - { - this(data, 0); - } - - BytesWithOffset(byte[] data, - int offset) - { - data_ = data; - offset_ = offset; - } -} - - - diff --git a/cvsroot/src/com/ibm/as400/access/CADSPool.java b/cvsroot/src/com/ibm/as400/access/CADSPool.java deleted file mode 100644 index 8a6bb2e8a..000000000 --- a/cvsroot/src/com/ibm/as400/access/CADSPool.java +++ /dev/null @@ -1,53 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CADSPool.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// This class is used to pool ClientAccessDataStream objects. -final class CADSPool -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - private ClientAccessDataStream[] streams_ = new ClientAccessDataStream[4]; - private final Object streamsLock_ = new Object(); //@P1A - - final ClientAccessDataStream getUnusedStream() - { - synchronized(streamsLock_) //@P1C - { - int max = streams_.length; - for (int i=0; i - *

          • "*DFTACTGRP" - The activation group is one of the default activation groups for the system. - *
          • "*NEW" - The activation group was created when the program was called. - *
          - * @see #getActivationGroupNumber - **/ - public String getActivationGroupName() - { - return activationGroupName_; - } - - /** - * Returns the number of the activation group within which the program or procedure is running. This - * is an internal number that uniquely identifies the activation group within the job. - * @return The activation group number. - * @see #getActivationGroupName - **/ - public long getActivationGroupNumber() - { - // In V5R3 and higher, a better number is returned for the activation group. - // We use that if it has been passed into us. - if (activationGroupNumberLong_ != 0) return activationGroupNumberLong_; - return activationGroupNumber_; - } - - /** - * Returns the Job object that generated this call stack entry. - * @return The job. - **/ - public Job getJob() - { - return job_; - } - - /** - * Returns the current machine instruction number in the program. - * @return The MI instruction number, or 0 for integrated language environment (ILE) procedures. - */ - public int getMIInstructionNumber() - { - return miInstructionNumber_; - } - - /** - * Returns the library in which the module is located. - * @return The name of the module library. Special values include: - *
            - *
          • "*N" - The module library name is unavailable because the program has been destroyed - * or the library containing the program is locked. - *
          • "" (empty String) - The program at this call stack entry is not an ILE program. - *
          - * @see #getModuleName - **/ - public String getModuleLibrary() - { - return moduleLibrary_; - } - - /** - * Returns the module containing the integrated language environment (ILE) procedure. - * @return The name of the module. Special values include: - *
            - *
          • "*N" - The module name is unavailable because the program has been destroyed or - * the library containing the program is locked. - *
          • "" (empty String) - The program at this call stack entry is not an ILE program. - *
          - * @see #getModuleLibrary - **/ - public String getModuleName() - { - return moduleName_; - } - - /** - * Returns the name of the procedure at this level of the call stack. - * @return The procedure name, or null if unknown. - **/ - public String getProcedureName() - { - return procedureName_; - } - - /** - * Returns the name of the auxiliary storage pool (ASP) device in which the program is located. - * @return The ASP name. Special values include: - *
            - *
          • "*SYSBAS" - The program is located in the system ASP or a basic user ASP. - *
          • "*N" - The name of the ASP cannot be determined. - *
          - * @see #getProgramASPNumber - * @see #getProgramLibraryASPName - * @see #getProgramLibraryASPNumber - **/ - public String getProgramASPName() - { - return programASP_; - } - - /** - * Returns the numeric identifier of the auxiliary storage pool (ASP) device containing the program. - * @return The ASP number. Valid values are: - *
            - *
          • 1: The library is located in the system ASP. - *
          • 2-32: The library is located in a basic user ASP. - *
          • 33-255: The library is located in an independent ASP. - *
          • -1: The ASP device cannot be determined. - *
          - * @see #getProgramASPName - * @see #getProgramLibraryASPName - * @see #getProgramLibraryASPNumber - **/ - public int getProgramASPNumber() - { - return programASPNumber_; - } - - - /** - * Returns the library in which the program is located. - * @return The name of the program library. Special values include: - *
        • "*N" - The program library name is unavailable because the library has been destroyed - * or is locked. - *
        • "" (empty String) - The program is not located in a library. - *
        - * @see #getProgramName - **/ - public String getProgramLibrary() - { - return programLibrary_; - } - - /** - * Returns the name of the auxiliary storage pool (ASP) device in which the program library is located. - * @return The ASP name. Special values include: - *
          - *
        • "*SYSBAS" - The program library is located in the system ASP or a basic user ASP. - *
        • "*N" - The name of the ASP cannot be determined. - *
        - * @see #getProgramLibraryASPNumber - * @see #getProgramASPName - * @see #getProgramASPNumber - **/ - public String getProgramLibraryASPName() - { - return programLibraryASP_; - } - - /** - * Returns the numeric identifier of the auxiliary storage pool (ASP) device containing the program library. - * @return The ASP number. Valid values are: - *
          - *
        • 1: The library is located in the system ASP. - *
        • 2-32: The library is located in a basic user ASP. - *
        • 33-255: The library is located in an independent ASP. - *
        • -1: The ASP device cannot be determined. - *
        - * @see #getProgramLibraryASPName - * @see #getProgramASPName - * @see #getProgramASPNumber - **/ - public int getProgramLibraryASPNumber() - { - return programLibraryASPNumber_; - } - - /** - * Returns the name of the procedure at this level of the call stack. - * @return The program name. - * @see #getProgramLibrary - **/ - public String getProgramName() - { - return programName_; - } - - /** - * Returns the level of the request-processing program or procedure. - * @return The request level, or 0 if the program or procedure has not received a request message. - **/ - public int getRequestLevel() - { - return requestLevel_; - } - - /** - * Returns the high-level language statement identifier. If this field contains the character - * representation of a number, the number is right-adjusted in the field and padded on the left - * with zeros (for example, '0000000246'). If the call stack entry is for an integrated language - * environment (ILE) procedure, more than one statement identifier may exist because of the - * compilers used for ILE languages. - * @return The statement identifier(s), or an empty array if none exist. - **/ - public String[] getStatementIdentifier() - { - if (statementIdentifiers_.length > 0) - { - String[] copy = new String[statementIdentifiers_.length]; - System.arraycopy(statementIdentifiers_, 0, copy, 0, statementIdentifiers_.length); - return copy; - } - return statementIdentifiers_; - } - - /** - * Returns the identifier of the thread in whose call stack this entry belongs. - * @return The thread identifier. - **/ - public long getThreadID() - { - return threadID_; - } - - /** - * Indicates whether a control boundary is active for a particular program or procedure. - * @return true if a control boundary is active, false otherwise. - **/ - public boolean isControlBoundaryActive() - { - return controlBoundary_ == (byte)0xF1; // '1' means active, '0' means not. - } - - /** - * Returns a String representation of this call stack entry. - * @return The String, which includes the system name, the job name, the job user, the job number, - * the thread identifier, the request level, the procedure or program name and library, and the - * MI instruction number. - **/ - public String toString() - { - return super.toString()+"["+job_.getSystem().getSystemName()+"/"+job_.getName()+"/"+job_.getUser()+"/"+job_.getNumber()+"/0x"+Long.toHexString(threadID_).toUpperCase()+"/"+requestLevel_+"/"+(procedureName_ == null ? programName_+"/"+programLibrary_ : procedureName_)+"/"+Integer.toHexString(miInstructionNumber_).toUpperCase()+"]"; - } - -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/access/ChangePasswordDialog.java b/cvsroot/src/com/ibm/as400/access/ChangePasswordDialog.java deleted file mode 100644 index 2e84303db..000000000 --- a/cvsroot/src/com/ibm/as400/access/ChangePasswordDialog.java +++ /dev/null @@ -1,235 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: ChangePasswordDialog.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Button; -import java.awt.Color; -import java.awt.Component; -import java.awt.Container; -import java.awt.Dialog; -import java.awt.FlowLayout; -import java.awt.Frame; -import java.awt.Graphics; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import java.awt.Insets; -import java.awt.Label; -import java.awt.LayoutManager; -import java.awt.Panel; -import java.awt.Rectangle; -import java.awt.TextField; - -// This class implements a dialog which allows the user to change the specified password. -class ChangePasswordDialog extends Dialog -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - private AS400SignonDialogAdapter listener_; - private TextField systemNameTextField_; - private TextField userIdTextField_; - private TextField oldTextField_; // Text field for current password. - private TextField newTextField_; // Text field for new password. - private TextField confirmTextField_; // Text field for password confirmation. - private Button okButton_; - private Button cancelButton_; - private Label passwordLabel_; - private Panel centeringPanel_; - - // Construct a change password dialog having the specified title. - // @param parent The parent Window. - // @param titleText The window title. - ChangePasswordDialog(Frame parent, String titleText) - { - super(parent, titleText, true); - - listener_ = new AS400SignonDialogAdapter(this); - - // Create a GridBagLayout manager. - GridBagConstraints constraints = new GridBagConstraints(); - constraints.fill = GridBagConstraints.BOTH; - constraints.insets = new Insets(8, 8, 0, 8); - setLayout(new GridBagLayout()); - setResizable(false); - - // Set the background color to light gray. - setBackground(Color.lightGray); - - // Create the 'System:' Label and add to the panel. - Label label = new Label(ResourceBundleLoader.getCoreText("DLG_SYSTEM_LABEL"), Label.LEFT); - add(this, label, constraints, 0, 0, 1, 1); - - // Create the system text field and add to the panel. - systemNameTextField_ = new TextField(10); - systemNameTextField_.setEnabled(false); - add(this, systemNameTextField_, constraints, 1, 0, 1, 1); - - // Create the 'User ID:' Label and add to the panel. - label = new Label(ResourceBundleLoader.getCoreText("DLG_USER_ID_LABEL"), Label.LEFT); - add(this, label, constraints, 0, 1, 1, 1); - - // Create the user id text field and add to the panel. - userIdTextField_ = new TextField(10); - userIdTextField_.setEnabled(false); - add(this, userIdTextField_, constraints, 1, 1, 1, 1); - passwordLabel_ = new Label(ResourceBundleLoader.getText("DLG_PASSWORDS_LABEL"), Label.CENTER); - add(this, passwordLabel_, constraints, 0,2,1,1); - - // Create the old password label. - label = new Label(ResourceBundleLoader.getText("DLG_OLD_LABEL"), Label.LEFT); - add(this, label, constraints, 0, 3, 1, 1); - - // Create the old password text field. - oldTextField_ = new TextField(10); - oldTextField_.setEchoChar('*'); - oldTextField_.addFocusListener(listener_); - oldTextField_.addKeyListener(listener_); - add(this, oldTextField_, constraints, 1, 3, 1, 1); - - // Create the new password label. - label = new Label(ResourceBundleLoader.getText("DLG_NEW_LABEL"), Label.LEFT); - add(this, label, constraints, 0, 4, 1, 1); - - // Create the new password text field. - newTextField_ = new TextField(10); - newTextField_.setEchoChar('*'); - newTextField_.addFocusListener(listener_); - newTextField_.addKeyListener(listener_); - add(this, newTextField_, constraints, 1, 4, 1, 1); - - // Create the confirm password label. - label = new Label(ResourceBundleLoader.getText("DLG_CONFIRM_LABEL"), Label.LEFT); - add(this, label, constraints, 0, 5, 1, 1); - - // Create the confirm password text field. - confirmTextField_ = new TextField(10); - confirmTextField_.setEchoChar('*'); - confirmTextField_.addFocusListener(listener_); - confirmTextField_.addKeyListener(listener_); - add(this, confirmTextField_, constraints, 1, 5, 1, 1); - - // Create panels to hold the 'OK', and 'Cancel' buttons. - centeringPanel_ = new Panel(); - centeringPanel_.setLayout(new FlowLayout(FlowLayout.CENTER)); - constraints.insets = new Insets(8, 8, 8, 8); - add(this, centeringPanel_, constraints, 0, 6, 2, 1); - Panel buttonPanel = new Panel(); - buttonPanel.setLayout(new GridLayout(1, 2, 8, 0)); - centeringPanel_.add(buttonPanel); - - // Create the OK, cancel buttons. - okButton_ = new Button(ResourceBundleLoader.getCoreText("DLG_OK_BUTTON")); - okButton_.addActionListener(listener_); - okButton_.addFocusListener(listener_); - okButton_.addKeyListener(listener_); - buttonPanel.add(okButton_); - cancelButton_ = new Button(ResourceBundleLoader.getCoreText("DLG_CANCEL_BUTTON")); - cancelButton_.addActionListener(listener_); - cancelButton_.addFocusListener(listener_); - cancelButton_.addKeyListener(listener_); - buttonPanel.add(cancelButton_); - - // Arrange the components in the dialog. - pack(); - - // Add a listener for window events. - addWindowListener(listener_); - } - - // Added paint method to draw the border around the password boxes. - public void paint(Graphics gc) - { - Rectangle pos = passwordLabel_.getBounds(); - int left = pos.x/2; - int top = pos.height/2 + pos.y; - int right = (getBounds().width + confirmTextField_.getBounds().x + confirmTextField_.getBounds().width) / 2; - int bottom = (centeringPanel_.getBounds().y + confirmTextField_.getBounds().y + confirmTextField_.getBounds().height) / 2; - - gc.setColor(Color.white); // Use white to make it look bevelled! - gc.drawRect(left+1, top+1, right-left, bottom-top); - - gc.setColor(Color.black); - gc.drawRect(left, top, right-left, bottom-top); - - super.paint(gc); - } - - // Display the dialog and wait for user response. - // @param system The AS/400 system name. - // @param userId The user ID. - // @return true if the the user selects 'OK'; false if the user selects 'Cancel'. - boolean prompt(String systemName, String userId) - { - // Set the system name and user ID text fields. - systemNameTextField_.setText(systemName); - userIdTextField_.setText(userId); - - // Clear the password text fields. - oldTextField_.setText(""); - newTextField_.setText(""); - confirmTextField_.setText(""); - - // Request focus. - listener_.setFocalPoint(oldTextField_); - - // Make the window visible. The call to show() will block the current thread until we hide or dispose of this dialog. - show(); - - return listener_.getFocalPoint() != cancelButton_; - } - - // This method returns the old password entered by the user. Note: since the text field echoes asterisks to the user, the text returned by this method is the characters that were typed; not the visible contents of the text field. - // @return The password. - String getOldPassword() - { - return oldTextField_.getText(); - } - - // This method returns the new password entered by the user. Note: since the text field echoes asterisks to the user, the text returned by this method is the characters that were typed; not the visible contents of the text field. - // @return The password. - String getNewPassword() - { - return newTextField_.getText(); - } - - // This method returns the confirmation password entered by the user. Note: since the text field echoes asterisks to the user, the text returned by this method is the characters that were typed; not the visible contents of the text field. - // @return The password. - String getConfirmPassword() - { - return confirmTextField_.getText(); - } - - // This methods adds a user interface component to the specified container using the specified constraints. - // @param container The container to add the component to. - // @param component The user interface component to add. - // @param constraints The constraints for the component. - // @param x The x coordinate of the leftmost cell of the component. - // @param y The y coordinate of the topmost cell of the component. - // @param width The horizontal measurement of the component in cells. - // @param height The vertical measurement of the component in cells. - protected void add(Container container, Component component, GridBagConstraints constraints, int x, int y, int width, int height) - { - constraints.gridx = x; - constraints.gridy = y; - constraints.gridwidth = width; - constraints.gridheight = height; - LayoutManager layout = container.getLayout(); - if (layout != null && layout instanceof GridBagLayout) - { - ((GridBagLayout)layout).setConstraints(component, constraints); - } - container.add(component); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ChangePasswordRep.java b/cvsroot/src/com/ibm/as400/access/ChangePasswordRep.java deleted file mode 100644 index f6243ec1c..000000000 --- a/cvsroot/src/com/ibm/as400/access/ChangePasswordRep.java +++ /dev/null @@ -1,69 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ChangePasswordRep.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -class ChangePasswordRep extends ClientAccessDataStream -{ - /** - Generate a new instance of this type. - @return a reference to the new instance - **/ - public Object getNewDataStream() - { - return new ChangePasswordRep(); - } - - int getRC() - { - return get32bit(20); - } - - AS400Message[] getErrorMessages(ConverterImplRemote converter) throws IOException - { - return AS400ImplRemote.parseMessages(data_, 24, converter); - } - - void read(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving change password reply..."); - - // Receive the header. - byte[] header = new byte[20]; - if (readFromStream(in, header, 0, 20) < 20) - { - Trace.log(Trace.ERROR, "Failed to read all of the change password reply header."); - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - - // Allocate bytes for datastream. - data_ = new byte[BinaryConverter.byteArrayToInt(header, 0)]; - System.arraycopy(header, 0, data_, 0, 20); - - // Read in the rest of the data. - readAfterHeader(in); - } - - /** - Generates a hash code for this data stream. - @return the hash code - **/ - public int hashCode() - { - return 0xF005; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/ChangePasswordReq.java b/cvsroot/src/com/ibm/as400/access/ChangePasswordReq.java deleted file mode 100644 index 11f6349ca..000000000 --- a/cvsroot/src/com/ibm/as400/access/ChangePasswordReq.java +++ /dev/null @@ -1,113 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ChangePasswordReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -class ChangePasswordReq extends ClientAccessDataStream -{ - ChangePasswordReq(byte[] userID, byte[] encryptedPw, byte[] oldPassword, int oldPasswordLength, byte[] newPassword, int newPasswordLength, int serverLevel) - { - super(new byte[63 + oldPassword.length + newPassword.length + (encryptedPw.length == 8 ? 0 : 42) + (serverLevel < 5 ? 0 : 7)]); - - setLength(data_.length); - // setHeaderID(0x0000); - setServerID(0xE009); - // setCSInstance(0x00000000); - // setCorrelation(0x00000000); - setTemplateLen(1); - setReqRepID(0x7005); - - // Password's always encrypted. - data_[20] = (encryptedPw.length == 8) ? (byte)0x01 : (byte)0x03; - - // Set user ID. - // LL - set32bit(16, 21); - // CP - set16bit(0x1104, 25); - // EBCDIC user ID. - System.arraycopy(userID, 0, data_, 27, 10); - - // Set password. - // LL - set32bit(6 + encryptedPw.length, 37); - // CP - set16bit(0x1105, 41); - // Password data. - System.arraycopy(encryptedPw, 0, data_, 43, encryptedPw.length); - - // Set protected old password. - // LL - set32bit(6 + oldPassword.length, 43 + encryptedPw.length); - // CP - set16bit(0x110C, 47 + encryptedPw.length); - // Old password data. - System.arraycopy(oldPassword, 0, data_, 49 + encryptedPw.length, oldPassword.length); - - // Set protected new password. - // LL - set32bit(6 + newPassword.length, 49 + encryptedPw.length + oldPassword.length); - // CP - set16bit(0x110D, 53 + encryptedPw.length + oldPassword.length); - // New password data. - System.arraycopy(newPassword, 0, data_, 55 + encryptedPw.length + oldPassword.length, newPassword.length); - - if (encryptedPw.length != 8) // If we're using SHA-1 passwords. - { - // Set protected old password length. - // LL - set32bit(10, 55 + encryptedPw.length + oldPassword.length + newPassword.length); - // CP - set16bit(0x111C, 59 + encryptedPw.length + oldPassword.length + newPassword.length); - // Old password length. - set32bit(oldPasswordLength, 61 + encryptedPw.length + oldPassword.length + newPassword.length); - - // Set protected new password length. - // LL - set32bit(10, 65 + encryptedPw.length + oldPassword.length + newPassword.length); - // CP - set16bit(0x111D, 69 + encryptedPw.length + oldPassword.length + newPassword.length); - // New password length. - set32bit(newPasswordLength, 71 + encryptedPw.length + oldPassword.length + newPassword.length); - - // Set protected password CCSID. - // LL - set32bit(10, 75 + encryptedPw.length + oldPassword.length + newPassword.length); - // CP - set16bit(0x111E, 79 + encryptedPw.length + oldPassword.length + newPassword.length); - // CCSID. - set32bit(13488, 81 + encryptedPw.length + oldPassword.length + newPassword.length); - } - - if (serverLevel >= 5) - { - int offset = 63 + oldPassword.length + newPassword.length + (encryptedPw.length == 8 ? 0 : 42); - // Set return error messages. - // LL - set32bit(7, offset); - // CP - set16bit(0x1128, offset + 4); - // Data. - data_[offset + 6] = 0x01; - } - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending change password request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/CharConverter.java b/cvsroot/src/com/ibm/as400/access/CharConverter.java deleted file mode 100644 index 471f812d7..000000000 --- a/cvsroot/src/com/ibm/as400/access/CharConverter.java +++ /dev/null @@ -1,438 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CharConverter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; - -/** - A character set converter between Java String objects and IBM i native code pages. -

        - Note: Some methods of this class accept an array-valued argument in addition to arguments that specify an array offset and possibly also a length. - All such methods will throw an {@link ArrayIndexOutOfBoundsException ArrayIndexOutOfBoundsException} if the offset and/or length are not valid for the array. - @see com.ibm.as400.access.AS400Text - **/ -public class CharConverter implements Serializable -{ - static final long serialVersionUID = 4L; - - private static boolean faultTolerantConversion_ = false; - - private Converter table_; - - /** - Constructs a CharConverter object using a "best guess" based on the default Locale. - */ - public CharConverter() - { - table_ = new Converter(); - } - - /** - Constructs a CharConverter object using the specified character encoding. - @param encoding The name of a character encoding. - @exception UnsupportedEncodingException If the encoding is not supported. - */ - public CharConverter(String encoding) throws UnsupportedEncodingException - { - if (encoding == null) throw new NullPointerException("encoding"); - table_ = new Converter(encoding); - } - - /** - Constructs a CharConverter object using the specified CCSID. - @param ccsid The CCSID of the IBM i text. - @exception UnsupportedEncodingException If the ccsid is not supported. - */ - public CharConverter(int ccsid) throws UnsupportedEncodingException - { - table_ = new Converter(ccsid); - } - - /** - Constructs a CharConverter object using the specified CCSID and system. - @param ccsid The CCSID of the IBM i text. - @param system The system object representing the system with which to connect. - If null, then this constructor behaves identically to CharConverter(ccsid). - @exception UnsupportedEncodingException If the ccsid is not supported. - */ - public CharConverter(int ccsid, AS400 system) throws UnsupportedEncodingException - { - if (system == null) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Null-valued 'system' argument specified."); - table_ = new Converter(ccsid); - } - else table_ = new Converter(ccsid, system); - } - - /** - Converts the specified bytes into a String. - @param source The bytes to convert. - @return The resultant String. - **/ - public String byteArrayToString(byte[] source) - { - if (source == null) throw new NullPointerException("source"); - return table_.byteArrayToString(source); - } - - /** - Converts the specified bytes into a String. - @param source The bytes to convert. - @param offset The offset into the source array for the start of the data. - @return The resultant String. - **/ - public String byteArrayToString(byte[] source, int offset) - { - if (source == null) throw new NullPointerException("source"); - return table_.byteArrayToString(source, offset); - } - - /** - Converts the specified bytes into a String. - @param source The bytes to convert. - @param offset The offset into the source array for the start of the data. - @param length The number of bytes of data to read from the array. - @return The resultant String. - **/ - public String byteArrayToString(byte[] source, int offset, int length) - { - if (source == null) throw new NullPointerException("source"); - return table_.byteArrayToString(source, offset, length); - } - - /** - Converts the specified bytes into a String. - @param source The bytes to convert. - @param offset The offset into the source array for the start of the data. - @param length The number of bytes of data to read from the array. - @param type The bidi string type, as defined by the CDRA (Character Data Representataion Architecture). See BidiStringType for more information and valid values. - @return The resultant String. - @see com.ibm.as400.access.BidiStringType - **/ - public String byteArrayToString(byte[] source, int offset, int length, int type) - { - if (source == null) throw new NullPointerException("source"); - return byteArrayToString(source, offset, length, new BidiConversionProperties(type)); - } - - /** - Converts the specified bytes into a String. - @param source The bytes to convert. - @param offset The offset into the source array for the start of the data. - @param length The number of bytes of data to read from the array. - @param properties The bidi conversion properties. - @return The resultant String. - **/ - public String byteArrayToString(byte[] source, int offset, int length, BidiConversionProperties properties) - { - if (source == null) throw new NullPointerException("source"); - return table_.byteArrayToString(source, offset, length, properties); - } - - /** - Converts the specified bytes into a String. - @param system The system object representing the system with which to connect. - @param source The bytes to convert. - @return The resultant String. - **/ - public static String byteArrayToString(AS400 system, byte[] source) - { - if (system == null) throw new NullPointerException("system"); - if (source == null) throw new NullPointerException("source"); - try - { - return new Converter(system.getCcsid(), system).byteArrayToString(source); - } - catch (UnsupportedEncodingException e) - { - // This exception should never happen, since we are getting the CCSID from the system itself, and it only gets thrown if we pass a bad CCSID. - Trace.log(Trace.ERROR, "Unexpected UnsupportedEncodingException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Converts the specified bytes into a String. - @param ccsid The CCSID of the IBM i text. - @param system The system object representing the system with which to connect. - @param source The bytes to convert. - @return The resultant String. - @exception UnsupportedEncodingException If the ccsid is not supported. - **/ - public static String byteArrayToString(int ccsid, AS400 system, byte[] source) throws UnsupportedEncodingException - { - if (system == null) throw new NullPointerException("system"); - if (source == null) throw new NullPointerException("source"); - return new Converter(ccsid, system).byteArrayToString(source); - } - - /** - Converts the specified bytes into a String. If the Toolbox does not possess a table for the given CCSID, nor does the JVM, an UnsupportedEncodingException is thrown. - @param ccsid The CCSID of the IBM i text. - @param source The bytes to convert. - @return The resultant String. - @exception UnsupportedEncodingException If the ccsid is not supported. - **/ - public static String byteArrayToString(int ccsid, byte[] source) throws UnsupportedEncodingException - { - if (source == null) throw new NullPointerException("source"); - return new Converter(ccsid).byteArrayToString(source); - } - - /** - Converts a QSYS pathname String obtained from the IFS classes into a String suitable for use with other Toolbox services such as CommandCall and DataQueues. -

        This method is meant to handle QSYS pathnames and other string data that was retrieved using the IFS classes. Object names in QSYS are stored in EBCDIC. The file server always returns names to the Toolbox IFS classes in Unicode, so the system must convert the name from EBCDIC to Unicode before returning it to the client. The system does this conversion using CCSID 37, not the file server job CCSID; however, the name may contain variant (but legal) codepoints. Specifically, the three legal variant EBCDIC codepoints for QSYS object names are 0x5B, 0x7B, and 0x7C. If the name retrieved using the Toolbox IFS classes is given to another Toolbox component such as CommandCall, the name will be converted to EBCDIC using the job CCSID for that particular component. If variant characters exist in the name, the resulting name used by the host server job may not be the same as the original name. -

        Here is a typical scenario in which this method will be needed. The user profile name CASH$FLOW exists on the system. In EBCDIC CCSID 37, it is comprised of the codepoints: -

        -     0xC3 0xC1 0xE2 0xC8  0x5B  0xC6 0xD3 0xD6 0xE6
        -     
        - Note that the dollar sign '$' is codepoint 0x5B so it is one of the legal codepoints for a QSYS object pathname. Now, if this pathname is used in a CommandCall, such as "DLTUSRPRF CASH$FLOW", that command string will get converted to the CCSID of the host server job. If the host server job isn't running under CCSID 37, the resulting command string may not contain the dollar sign. For example, in CCSID 285 (United Kingdom) the codepoint 0x5B is actually an English pound sterling ('\u00A3' or Unicode 0x00A3). The dollar sign '$' is found at codepoint 0x4A instead. Hence, the "CASH$FLOW" in the command string will get converted to the following EBCDIC CCSID 285 codepoints: -
        -     0xC3 0xC1 0xE2 0xC8  0x4A  0xC6 0xD3 0xD6 0xE6
        -     
        - That is not how the user profile name is stored in QSYS. The 0x4A codepoint should really be a 0x5B codepoint. So in this case, the command server will return an error message indicating the user profile was not found. -

        The solution is to use this method to replace the variant codepoints with codepoints that will correctly convert given the host server job CCSID. When given the string "CASH$FLOW" and the CCSID 285, this method will return the string "CASH\u00A3FLOW". If the CommandCall is issued with the string "DLTUSRPRF CASH\u00A3FLOW" and the job CCSID of the remote command host server is 285, it will correctly convert the pound sterling '\u00A3' into codepoint 0x5B, which is how the user profile name "CASH$FLOW" is actually stored in QSYS. -

        Note: This method is intended for use only with QSYS object pathnames; that is, pathnames containing "/QSYS.LIB/". -

        For more information, please see IBM i Information Center: CL and APIs: Control Language (CL): Naming within commands. - @see #convertJobPathnameToIFSQSYSPathname - @param qsysData The String in which to substitute variant QSYS characters. - @param jobCCSID The CCSID of the job in which to convert the variant characters. - @return The Unicode String with correctly substituted variant characters for use with host servers that convert based upon job CCSID. - @exception UnsupportedEncodingException If the specified CCSID is not supported. - **/ - public static String convertIFSQSYSPathnameToJobPathname(String qsysData, int jobCCSID) throws UnsupportedEncodingException - { - if (qsysData == null) throw new NullPointerException("qsysData"); - return new Converter(jobCCSID, null).byteArrayToString(new Converter(37, null).stringToByteArray(qsysData)); - } - - /** - Converts a pathname String obtained from a Toolbox host server (such as CommandCall or DataQueue) to a QSYS pathname suitable for use with the IFS classes. -

        See the javadoc for {@link #convertIFSQSYSPathnameToJobPathname convertIFSQSYSPathnameToJobPathname} for more information. This method essentially does the opposite of what convertIFSQSYSPathnameToJobPathname does. The specified jobData string has its variant characters substituted so that it can be used with the IFS classes. If given the String returned by this method, the file server will correctly convert the codepoints into the real QSYS object pathname using CCSID 37. -

        Note: This method is intended for use only with QSYS object pathnames; that is, pathnames containing "/QSYS.LIB/". - @see #convertIFSQSYSPathnameToJobPathname - @param jobData The String in which to substitute variant QSYS characters. - @param jobCCSID The CCSID of the job in which to convert the variant characters. - @return The Unicode String with correctly substituted variant characters for use with the IFS server that converts based upon CCSID 37. - @exception UnsupportedEncodingException If the specified CCSID is not supported. - **/ - public static String convertJobPathnameToIFSQSYSPathname(String jobData, int jobCCSID) throws UnsupportedEncodingException - { - if (jobData == null) throw new NullPointerException("jobData"); - return new Converter(37, null).byteArrayToString(new Converter(jobCCSID, null).stringToByteArray(jobData)); - } - - /** - Returns the CCSID of this conversion object. - @return The CCSID. - **/ - public int getCcsid() - { - return table_.getCcsid(); - } - - /** - Returns the encoding of this conversion object. - @return The encoding. - **/ - public String getEncoding() - { - return table_.getEncoding(); - } - - /** - Indicates if conversion is fault tolerant. - @return true if conversion is fault tolerant, false otherwise. - **/ - public static boolean isFaultTolerantConversion() - { - return faultTolerantConversion_; - } - - /** - Enables fault tolerant conversion. Fault tolerant conversion allows incomplete EBCDIC character data to be converted without throwing an exception. This is a static setting and affects all subsequent character conversion. Fault tolerant conversion may adversly affect performance and memory usage during character conversion. The default is false. - @param faultTolerantConversion true to enable fault tolerant conversion, false otherwise. - **/ - public static void setFaultTolerantConversion(boolean faultTolerantConversion) - { - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "Setting fault tolerant conversion:", faultTolerantConversion); - faultTolerantConversion_ = faultTolerantConversion; - } - - /** - Converts the specified String into bytes. - @param source The String to convert. - @return The resultant byte array. - **/ - public byte[] stringToByteArray(String source) - { - if (source == null) throw new NullPointerException("source"); - return table_.stringToByteArray(source); - } - - /** - Converts the specified String into bytes. - @param source The String to convert. - @param type The bidi string type, as defined by the CDRA (Character Data Representataion Architecture). See BidiStringType for more information and valid values. - @return The resultant byte array. - @see com.ibm.as400.access.BidiStringType - **/ - public byte[] stringToByteArray(String source, int type) - { - if (source == null) throw new NullPointerException("source"); - return stringToByteArray(source, new BidiConversionProperties(type)); - } - - /** - Converts the specified String into bytes. - @param source The String to convert. - @param properties The bidi conversion properties. - @return The resultant byte array. - **/ - public byte[] stringToByteArray(String source, BidiConversionProperties properties) - { - if (source == null) throw new NullPointerException("source"); - // tolerate a null-valued 'properties' arg (for now) - return table_.stringToByteArray(source, properties); - } - - /** - Converts the specified String into bytes. - @param source The String to convert. - @param destination The destination byte array. - @exception CharConversionException If destination is not large enough to hold the converted string. - **/ - public void stringToByteArray(String source, byte[] destination) throws CharConversionException - { - if (source == null) throw new NullPointerException("source"); - if (destination == null) throw new NullPointerException("destination"); - table_.stringToByteArray(source, destination); - } - - /** - Converts the specified String into bytes. - @param source The String to convert. - @param destination The destination byte array. - @param offset The offset into the destination array for the start of the data. - @exception CharConversionException If destination is not large enough to hold the converted string. - **/ - public void stringToByteArray(String source, byte[] destination, int offset) throws CharConversionException - { - if (source == null) throw new NullPointerException("source"); - if (destination == null) throw new NullPointerException("destination"); - table_.stringToByteArray(source, destination, offset); - } - - /** - Converts the specified String into bytes. - @param source The String to convert. - @param destination The destination byte array. - @param offset The offset into the destination array for the start of the data. - @param length The number of bytes of data to write into the array. - @exception CharConversionException If destination is not large enough to hold the converted string. - **/ - public void stringToByteArray(String source, byte[] destination, int offset, int length) throws CharConversionException - { - if (source == null) throw new NullPointerException("source"); - if (destination == null) throw new NullPointerException("destination"); - table_.stringToByteArray(source, destination, offset, length); - } - - /** - Converts the specified String into bytes. - @param source The String to convert. - @param destination The destination byte array. - @param offset The offset into the destination array for the start of the data. - @param length The number of bytes of data to write into the array. - @param type The bidi string type, as defined by the CDRA (Character Data Representataion Architecture). See BidiStringType for more information and valid values. - @exception CharConversionException If destination is not large enough to hold the converted string. - @see com.ibm.as400.access.BidiStringType - **/ - public void stringToByteArray(String source, byte[] destination, int offset, int length, int type) throws CharConversionException - { - if (source == null) throw new NullPointerException("source"); - if (destination == null) throw new NullPointerException("destination"); - table_.stringToByteArray(source, destination, offset, length, new BidiConversionProperties(type)); - } - - /** - Converts the specified String into bytes. - @param source The String to convert. - @param destination The destination byte array. - @param offset The offset into the destination array for the start of the data. - @param length The number of bytes of data to write into the array. - @param properties The bidi conversion properties. - @exception CharConversionException If destination is not large enough to hold the converted string. - @see com.ibm.as400.access.BidiStringType - **/ - public void stringToByteArray(String source, byte[] destination, int offset, int length, BidiConversionProperties properties) throws CharConversionException - { - if (source == null) throw new NullPointerException("source"); - if (destination == null) throw new NullPointerException("destination"); - table_.stringToByteArray(source, destination, offset, length, properties); - } - - /** - Converts the specified String into bytes. - @param system The system object representing the system with which to connect. - @param source The String to convert. - @return The destination byte array. - **/ - public static byte[] stringToByteArray(AS400 system, String source) - { - if (system == null) throw new NullPointerException("system"); - if (source == null) throw new NullPointerException("source"); - try - { - return new Converter(system.getCcsid(), system).stringToByteArray(source); - } - catch (UnsupportedEncodingException e) - { - // This exception should never happen, since we are getting the CCSID from the system itself, and it only gets thrown if we pass a bad CCSID. - Trace.log(Trace.ERROR, "Unexpected UnsupportedEncodingException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Converts the specified String into bytes. - @param ccsid The CCSID of the IBM i text. - @param system The system object representing the system with which to connect. - @param source The String to convert. - @return The destination byte array. - @exception UnsupportedEncodingException If the ccsid is not supported. - **/ - public static byte[] stringToByteArray(int ccsid, AS400 system, String source) throws UnsupportedEncodingException - { - if (system == null) throw new NullPointerException("system"); - if (source == null) throw new NullPointerException("source"); - return new Converter(ccsid, system).stringToByteArray(source); - } - - /** - Converts the specified String into bytes. If the Toolbox does not possess a table for the given CCSID, nor does the JVM, an UnsupportedEncodingException is thrown. - @param ccsid The CCSID of the IBM i text. - @param source The String to convert. - @return The destination byte array. - @exception UnsupportedEncodingException If the ccsid is not supported. - **/ - public static byte[] stringToByteArray(int ccsid, String source) throws UnsupportedEncodingException - { - if (source == null) throw new NullPointerException("source"); - return new Converter(ccsid).stringToByteArray(source); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/CharacterDataArea.java b/cvsroot/src/com/ibm/as400/access/CharacterDataArea.java deleted file mode 100644 index e24c91bdd..000000000 --- a/cvsroot/src/com/ibm/as400/access/CharacterDataArea.java +++ /dev/null @@ -1,687 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CharacterDataArea.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// -// @A1 - 07/25/2007 - Allow users to write data containing single quote -// characters. User needs to specify a pair of single-quote -// characters to be interpretted as a single quote character. -// This would have resulted in potential length errors -// being reported by toolbox code. Therefore, some toolbox -// length verification has been removed. The i5/OS API's -// will report an error if the data length is invalid. -// -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.access; - -import java.io.Serializable; -import java.io.IOException; -import java.beans.PropertyVetoException; -import java.net.UnknownHostException; - -/** -The CharacterDataArea class represents a character data area on the system. -

        -The following example demonstrates the use of CharacterDataArea: -

        -// Prepare to work with the system named "My400".
        -AS400 system = new AS400("My400");
        -
        -// Create a CharacterDataArea object.
        -QSYSObjectPathName path = new QSYSObjectPathName("MYLIB", "MYDATA", "DTAARA");
        -CharacterDataArea dataArea = new CharacterDataArea(system, path.getPath());
        -
        -// Create the character data area on the system using default values.
        -dataArea.create();
        -
        -// Clear the data area.
        -dataArea.clear();
        -
        -// Write to the data area.
        -dataArea.write("Hello world");
        -
        -// Read from the data area.
        -String data = dataArea.read();
        -
        -// Delete the data area from the system.
        -dataArea.delete();
        -
        - -

        -Note: Most of the read() and write() methods of this class automatically -convert characters between Unicode and the CCSID associated with the AS400 object. -See {@link AS400#getCcsid AS400.getCcsid()}. -**/ - -public class CharacterDataArea extends DataArea implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2007 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - /** - Constants - **/ - - static final int DEFAULT_LENGTH = 32; // number of bytes - static final int UNKNOWN_LENGTH = DataArea.UNKNOWN_LENGTH; //@B1A - - /** - Variables - ***/ - - private String initialValue_ = " "; - // The initial value written to the data area upon creation. - - /** - Constructs a CharacterDataArea object. - It creates a default CharacterDataArea object. The system and path - properties must be set before attempting a connection. - **/ - public CharacterDataArea() - { - super(); - length_ = UNKNOWN_LENGTH; //@B1C - dataAreaType_ = CHARACTER_DATA_AREA; - } - - - /** - Constructs a CharacterDataArea object. - It creates a CharacterDataArea instance that represents the data area path - on system. - @param system The system that contains the data area. - @param path The fully qualified integrated file system path name. The - integrated file system file extension for a data area is DTAARA. An example of a - fully qualified integrated file system path to a data area "MYDATA" in library - "MYLIB" is: /QSYS.LIB/MYLIB.LIB/MYDATA.DTAARA - **/ - public CharacterDataArea(AS400 system, String path) - { - super(system, path); - length_ = UNKNOWN_LENGTH; //@B1C - dataAreaType_ = CHARACTER_DATA_AREA; - } - - - /** - Resets the data area to contain all blanks. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void clear() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (impl_ == null) - chooseImpl(); - - impl_.clear(); - - // Fire the CLEARED event. - fireCleared(); - } - - - /** - Creates a character data area on the system. - This method uses the following default property values. -

          -
        • length - 32 bytes. -
        • initialValue - A blank string. -
        • textDescription - A blank string. -
        • authority - A value of *LIBCRTAUT. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectAlreadyExistsException If the system object already exists. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void create() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectAlreadyExistsException, - ObjectDoesNotExistException - { - if (impl_ == null) - chooseImpl(); - - if (length_ == UNKNOWN_LENGTH) length_ = DEFAULT_LENGTH; //@B1A - - impl_.create(length_, initialValue_, textDescription_, authority_); - - // Fire the CREATED event. - fireCreated(); - } - - - /** - Creates a character data area with the specified attributes. - @param length The maximum number of bytes in the data area. - Valid values are 1 through 2000. - @param initialValue The initial value for the data area. - @param textDescription The text description for the data area. - The maximum length is 50 characters. - @param authority The public authority level for the data area. Valid - values are *ALL, *CHANGE, *EXCLUDE, *LIBCRTAUT, *USE, or the name - of an authorization list. The maximum length is 10 characters. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectAlreadyExistsException If the system object already exists. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void create(int length, String initialValue, - String textDescription, String authority) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectAlreadyExistsException, - ObjectDoesNotExistException - { - // Validate the length - if (length < 1 || length > 2000) - throw new ExtendedIllegalArgumentException("length", - ExtendedIllegalArgumentException.RANGE_NOT_VALID); - // Validate the initialValue parameter. - if (initialValue == null) - throw new NullPointerException("initialValue"); - if (initialValue.length() == 0) - throw new ExtendedIllegalArgumentException("initialValue", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - // Validate the text description parameter - if (textDescription == null) - throw new NullPointerException("textDescription"); - if (textDescription.length() > 50) - throw new ExtendedIllegalArgumentException("textDescription", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - // Validate the authority parameter. - if (authority == null) - throw new NullPointerException("authority"); - if (authority.length() == 0 || authority.length() > 10) - throw new ExtendedIllegalArgumentException("authority", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - length_ = length; - initialValue_ = initialValue; - textDescription_ = textDescription; - authority_ = authority; - - create(); - } - - - /** - Removes the data area from the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist. - **/ - public void delete() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - super.delete0(); - } - - - /** - Returns the integrated file system path name of the object represented by the data area. - @return The integrated file system path name of the object represented by the data area. - **/ - public String getPath() - { - return super.getPath(); - } - - - /** - Reads the data from the data area. - It retrieves the entire contents of the data area. Note that if the data - does not completely fill the data area, this method will return data - padded with trailing blanks up to the length of the data area. - @return The data read from the data area. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public String read() - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (impl_ == null) - chooseImpl(); - - if (length_ == UNKNOWN_LENGTH) length_ = getLength(); //@B1A - - // Do the read - String val = impl_.retrieve(-1,length_); - - // Fire the READ event. - fireRead(); - - return val; - } - - - /** - Reads the data from the data area. - It retrieves the entire contents of the data area. Note that if the data - does not completely fill the data area, this method will return data - padded with trailing blanks up to the length of the data area. - @param type The Data Area bidi string type, as defined by the CDRA (Character - Data Representataion Architecture). See - BidiStringType for more information and valid values. - @return The data read from the data area. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public String read(int type) //$A2A - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (impl_ == null) - chooseImpl(); - - if (length_ == UNKNOWN_LENGTH) length_ = getLength(); //@B1A - - // Do the read - String val = impl_.retrieve(-1,length_, type); //$A2C - - // Fire the READ event. - fireRead(); - - return val; - } - - - /** - Reads the data from the data area. - It retrieves dataLength characters (or fewer if multi-byte characters) beginning at - dataAreaOffset in the data area. The first character in - the data area is at offset 0. - @param dataAreaOffset The offset in the data area at which to start reading. - @param dataLength The number of bytes to read. Valid values are from - 1 through (data area size - dataAreaOffset). - @return The data read from the data area. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public String read(int dataAreaOffset, int dataLength) - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (length_ == UNKNOWN_LENGTH) length_ = getLength(); //@B1A - - // Validate the dataAreaOffset parameter. - if (dataAreaOffset < 0 || dataAreaOffset >= length_) - throw new ExtendedIllegalArgumentException("dataAreaOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the dataLength parameter. - if (dataLength < 1 || dataLength > length_) - throw new ExtendedIllegalArgumentException("dataLength", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the (dataAreaOffset, dataLength) combination. - if (dataAreaOffset+dataLength > length_) - throw new ExtendedIllegalArgumentException("dataLength", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - if (impl_ == null) - chooseImpl(); - - // Do the read - String val = impl_.retrieve(dataAreaOffset, dataLength); - - // Fire the READ event. - fireRead(); - - return val; - } - - - /** - Reads the data from the data area. - It retrieves dataLength characters (or fewer if multi-byte characters) beginning at - dataAreaOffset in the data area. The first character in - the data area is at offset 0. - @param dataAreaOffset The offset in the data area at which to start reading. - @param dataLength The number of bytes to read. Valid values are from - 1 through (data area size - dataAreaOffset). - @param type The Data Area bidi string type, as defined by the CDRA (Character - Data Representataion Architecture). See - BidiStringType for more information and valid values. - @return The data read from the data area. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public String read(int dataAreaOffset, int dataLength, int type) //$A2A - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (length_ == UNKNOWN_LENGTH) length_ = getLength(); //@B1A - - // Validate the dataAreaOffset parameter. - if (dataAreaOffset < 0 || dataAreaOffset >= length_) - throw new ExtendedIllegalArgumentException("dataAreaOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the dataLength parameter. - if (dataLength < 1 || dataLength > length_) - throw new ExtendedIllegalArgumentException("dataLength", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the (dataAreaOffset, dataLength) combination. - if (dataAreaOffset+dataLength > length_) - throw new ExtendedIllegalArgumentException("dataLength", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - if (impl_ == null) - chooseImpl(); - - // Do the read - String val = impl_.retrieve(dataAreaOffset, dataLength, type); //$A2C - - // Fire the READ event. - fireRead(); - - return val; - } - - - /** - Reads the data from the data area. - It retrieves up to dataLength bytes, without conversion, - beginning at offset dataAreaOffset in the data area. - Note that the first byte in the data area is at offset 0. - @param dataBuffer The buffer into which to read the data. Must be non-null. - @param dataBufferOffset The starting offset in dataBuffer. - @param dataAreaOffset The offset in the data area at which to start reading. - @param dataLength The number of bytes to read. Valid values are from - 1 through (data area size - dataAreaOffset). - @return The total number of bytes read into the buffer. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - @see #write(byte[],int,int,int) - **/ - public int read(byte[] dataBuffer, int dataBufferOffset, int dataAreaOffset, int dataLength) - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - return super.read(dataBuffer, dataBufferOffset, dataAreaOffset, dataLength); - } - - - /** - Sets the fully qualified data area name. - The following example demonstrates the use of setPath: -
        -   // Create a CharacterDataArea object.
        -   CharacterDataArea dataArea = new CharacterDataArea();
        -
        -   // Set its path to be the data area "MYDATA" in the library "MYLIB".
        -   dataArea.setPath("/QSYS.LIB/MYLIB.LIB/MYDATA.DTAARA");
        -   
        - @param path The fully qualified integrated file system path name of the data area. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setPath(String path) throws PropertyVetoException - { - super.setPath(path); - } - - - /** - Writes the data to the data area. - It writes data to the beginning of the data area. The remaining - characters in the data area are blank padded. - @param data The data to be written. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void write(String data) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - // Validate the data parameter. - if (data == null) - throw new NullPointerException("data"); - //if (data.length() < 1 || data.length() > length_) //@A1D - if (data.length() < 1) //@A1C - throw new ExtendedIllegalArgumentException("data", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - if (impl_ == null) - chooseImpl(); - - // Do the write - impl_.write(data, 0); - - // Fire the WRITTEN event. - fireWritten(); - } - - - /** - Writes the data to the data area. - It writes data.length() characters from data to the - data area beginning at dataAreaOffset. The first character - in the data area is at offset 0. - @param data The data to be written. - @param dataAreaOffset The offset in the data area at which to start writing. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void write(String data, int dataAreaOffset) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - // Validate the data parameter. - if (data == null) - throw new NullPointerException("data"); - // Validate the data length. - //if (data.length() < 1 || data.length() > length_) //@A1D - if (data.length() < 1) //@A1C - throw new ExtendedIllegalArgumentException("data", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - if (length_ == UNKNOWN_LENGTH) { - try //@B1A - { - length_ = getLength(); //@B1A - } - catch(IllegalObjectTypeException iote) //@B1A - { - if (Trace.isTraceOn() && Trace.isTraceWarningOn()) //@B1A - { - Trace.log(Trace.WARNING, "Unexpected exception when retrieving length for character data area.", iote); //@B1A - } - } - } - - // Validate the dataAreaOffset parameter. - if (dataAreaOffset < 0 || dataAreaOffset >= length_) - throw new ExtendedIllegalArgumentException("dataAreaOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the (dataAreaOffset, dataLength) combination. - /* - if (dataAreaOffset+data.length() > length_) //@A1D - throw new ExtendedIllegalArgumentException("data", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - */ - if (impl_ == null) - chooseImpl(); - - // Do the write - impl_.write(data, dataAreaOffset); - - // Fire the WRITTEN event. - fireWritten(); - } - - - /** - Writes the data to the data area. - It writes data.length() characters from data to the - data area beginning at dataAreaOffset. The first character - in the data area is at offset 0. - @param data The data to be written. - @param dataAreaOffset The offset in the data area at which to start writing. - @param type The Data Area bidi string type, as defined by the CDRA (Character - Data Representataion Architecture). See - BidiStringType for more information and valid values. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void write(String data, int dataAreaOffset, int type) //$A2A - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - // Validate the data parameter. - if (data == null) - throw new NullPointerException("data"); - - if (length_ == UNKNOWN_LENGTH) { - try //@B1A - { - length_ = getLength(); //@B1A - } - catch(IllegalObjectTypeException iote) //@B1A - { - if (Trace.isTraceOn() && Trace.isTraceWarningOn()) //@B1A - { - Trace.log(Trace.WARNING, "Unexpected exception when retrieving length for character data area.", iote); //@B1A - } - } - } - - // Validate the data length. - //if (data.length() < 1 || data.length() > length_) //@A1D - if (data.length() < 1) //@A1C - throw new ExtendedIllegalArgumentException("data", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - // Validate the dataAreaOffset parameter. - if (dataAreaOffset < 0 || dataAreaOffset >= length_) - throw new ExtendedIllegalArgumentException("dataAreaOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the (dataAreaOffset, dataLength) combination. - /* - if (dataAreaOffset+data.length() > length_) //@A1D - throw new ExtendedIllegalArgumentException("data", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - */ - if (impl_ == null) - chooseImpl(); - - // Do the write - impl_.write(data, dataAreaOffset, type); //$A2C - - // Fire the WRITTEN event. - fireWritten(); - } - - - /** - Writes the data to the data area. - It writes the specified bytes, without conversion, to the data area, at offset dataAreaOffset. - Note that the first byte in the data area is at offset 0. - @param dataBuffer The data to be written. Must be non-null. - @param dataBufferOffset The starting offset in dataBuffer. - @param dataAreaOffset The offset in the data area at which to start writing. - @param dataLength The number of bytes to write. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void write(byte[] dataBuffer, int dataBufferOffset, int dataAreaOffset, int dataLength) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - super.write(dataBuffer, dataBufferOffset, dataAreaOffset, dataLength); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/CharacterDataArea16.gif b/cvsroot/src/com/ibm/as400/access/CharacterDataArea16.gif deleted file mode 100644 index 05c31652d..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/CharacterDataArea16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/CharacterDataArea32.gif b/cvsroot/src/com/ibm/as400/access/CharacterDataArea32.gif deleted file mode 100644 index 2cd6d3aee..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/CharacterDataArea32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/CharacterDataAreaBeanInfo.java b/cvsroot/src/com/ibm/as400/access/CharacterDataAreaBeanInfo.java deleted file mode 100644 index 09043d19c..000000000 --- a/cvsroot/src/com/ibm/as400/access/CharacterDataAreaBeanInfo.java +++ /dev/null @@ -1,124 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CharacterDataAreaBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; -import java.awt.Image; - - -/** -The CharacterDataAreaBeanInfo class provides -bean information for the CharacterDataArea class. -**/ -public class CharacterDataAreaBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class dbeanClass = CharacterDataArea.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - - private static PropertyDescriptor[] properties_; //@D1A - - static - { - try - { - PropertyDescriptor path = new PropertyDescriptor("path", dbeanClass); - path.setBound(true); - path.setConstrained(true); - path.setDisplayName(loader_.getText("PROP_NAME_PATH")); - path.setShortDescription(loader_.getText("PROP_DESC_PATH")); - properties_ = new PropertyDescriptor[] {path}; //@D1A - } - catch(Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns additional bean information. - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new DataAreaBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(dbeanClass); - } - - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("CharacterDataArea16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("CharacterDataArea32.gif"); - break; - } - - return image; - } - - /** //D1A - Returns the index of the default property. //D1A - @return The index to the default property. //D1A - **/ //D1A - public int getDefaultPropertyIndex() //D1A - { //D1A - // the index for the "path" property //D1A - return 0; //D1A - } //D1A - //D1A - - /** - Returns the descriptors for all properties. //D1A - @return The descriptors for all properties. //D1A - **/ //D1A - public PropertyDescriptor[] getPropertyDescriptors() //D1A - { //D1A - return properties_; //D1A - } //D1A - -} - diff --git a/cvsroot/src/com/ibm/as400/access/CharacterFieldDescription.java b/cvsroot/src/com/ibm/as400/access/CharacterFieldDescription.java deleted file mode 100644 index fb1964f6c..000000000 --- a/cvsroot/src/com/ibm/as400/access/CharacterFieldDescription.java +++ /dev/null @@ -1,290 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: CharacterFieldDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.util.Vector; - -/** - *Represents the description of the data in a character field. - *It allows: - *
          - *
        • The user to describe a character field to the RecordFormat object. - *
        • The RecordFormat object to describe a character field to the user. - *
        - *Click here to see an example. - **/ -public class CharacterFieldDescription extends FieldDescription implements VariableLengthFieldDescription, Serializable -{ - static final long serialVersionUID = 4L; - - - // CCSID keyword - String ccsid_ = ""; - // Value specified for the VARLEN keyword - private int variableLength_; - // Is the field a variable length field - private boolean isVariableLength_; - - /** - *Constructs a CharacterFieldDescription object. - **/ - public CharacterFieldDescription() - { - } - - /** - *Constructs a CharacterFieldDescription object. It uses the specified data type and name of the field. - *The length of the field will be the length specified on the AS400Text object. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public CharacterFieldDescription(AS400Text dataType, String name) - { - super(dataType, name); - } - - /** - *Constructs a CharacterFieldDescription object. It uses the specified data type of the field, name, - *and DDS name. The length of the field will be the length specified on the AS400Text - *object. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - **/ - public CharacterFieldDescription(AS400Text dataType, String name, String ddsName) - { - super(dataType, name, ddsName); - } - - - /** - *Returns the value specified for the CCSID keyword for this field. - *@return The value specified for the CCSID keyword - * for this field. If CCSID was not specified for this field, - * an empty string is returned. - **/ - public String getCCSID() - { - return ccsid_; - } - - /** - *Returns the DDS description for the field. This is a string containing - *the description of the field as it would be specified in a DDS source file. - *This method is used by AS400File.createDDSSourceFile to specify the field - *in the DDS source file which is used to create the file for the user who - *has passed in a RecordFormat object. - *@return The DDS description of this field properly formatted for entry - *into a DDS source file. - **/ - String[] getDDSDescription() - { - Vector v = new Vector(); - // Name columns (10) - StringBuffer desc = new StringBuffer(ddsName_); - // Blank pad the ddsName to 10 characters. - while(desc.length() < 10) - { - desc.append(" "); - } - // Reference column (1) - if (!refFld_.equals("")) - { - desc.append("R"); - } - else - { - desc.append(" "); - } - // Get length as 5 digit string, right justified -/* StringBuffer len = new StringBuffer(new Integer(length_).toString()); - if (len.length() < 5) - { - int blanksNeeded = 5 - len.length(); - for (short i = 0; i < blanksNeeded; ++i) - { - len.insert(0, " "); - } - } -*/ - String len = String.valueOf(length_); - int numSpaces = 5-len.length(); - for (int i=0; i 0) - { - v.addElement("VARLEN(" + new Integer(variableLength_).toString() + ") "); - } - else - { - v.addElement("VARLEN "); - } - } - if (defaultValue_ != null) - { - v.addElement("DFT('" + defaultValue_.toString() + "') "); - } - //@B0A - else if (isDFTNull_) - { - v.addElement("DFT(*NULL) "); - } - - String[] s = new String[v.size()]; - v.copyInto(s); - return s; - } - - /** - *Returns the value specified for the VARLEN keyword for this field. - *@return The value specified for VARLEN for this field. If VARLEN was not - * specified for this field, 0 is returned. - **/ - public int getVARLEN() - { - return variableLength_; - } - - /** - *Indicates if the field is a variable-length field. - *@return true if the field is a variable-length field; false otherwise. - **/ - public boolean isVariableLength() - { - return isVariableLength_; - } - - /** - *Sets the value for the CCSID keyword for this field. - *@param ccsid The value for the CCSID keyword - * for this field. - **/ - public void setCCSID(String ccsid) - { - if (ccsid == null) - { - throw new NullPointerException("ccsid"); - } - ccsid_ = ccsid; - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400Text dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length of the field based on the data type - length_ = dataType.getByteLength(); - } - - //@B0C - javadoc - /** - *Sets the value for the DFT keyword for this field. - *@param defaultValue The default value for this - * field. The defaultValue cannot be null. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(String defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; //@B0A - isDFTCurrent_ = false; //@B0A - DFTCurrentValue_ = null; //@B0A - } - - //@B0A - /** - *Sets the value for the DFT keyword to be *NULL for this field. - *Calling this method will replace the DFT keyword that was previously - *set on a call to setDFT(). Note: This field - *must also have its ALWNULL keyword set to true to prevent DDS errors. - **/ - public void setDFTNull() - { - isDFTNull_ = true; - defaultValue_ = null; - isDFTCurrent_ = false; - DFTCurrentValue_ = null; - } - - /** - *Sets the value that indicates if the field is a variable length field. - *@param value true if the field is a variable length field; false otherwise. - **/ - public void setVariableLength(boolean value) - { - isVariableLength_ = value; - if (!value) - { - variableLength_ = 0; - } - } - - /** - *Sets the value to specify for the VARLEN keyword for this field. - *@param varLen The value to specify for the VARLEN keyword for this field. - *The varLen cannot be less than zero. - **/ - public void setVARLEN(int varLen) - { - if (varLen < 0) - { - throw new ExtendedIllegalArgumentException("varLen (" + String.valueOf(varLen) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - variableLength_ = varLen; - isVariableLength_ = true; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ClassDecoupler.java b/cvsroot/src/com/ibm/as400/access/ClassDecoupler.java deleted file mode 100644 index 3887f0144..000000000 --- a/cvsroot/src/com/ibm/as400/access/ClassDecoupler.java +++ /dev/null @@ -1,131 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ClassDecoupler.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.util.*; - -/** - * This class exists to remove the dependencies AS400ImplRemote had on some of - * the DDM and DB datastream classes. In this way, a JarMaker-ed jt400.jar file - * can effectively operate its AS400 object without needing the DDM or JDBC classes. -**/ -class ClassDecoupler -{ -// For future use. -// static -// { -// // Identify all DDM server reply data streams. -// AS400Server.addReplyStream(new DDMEXCSATReplyDataStream(), AS400.RECORDACCESS); -// AS400Server.addReplyStream(new DDMACCSECReplyDataStream(), AS400.RECORDACCESS); -// AS400Server.addReplyStream(new DDMSECCHKReplyDataStream(), AS400.RECORDACCESS); -// AS400Server.addReplyStream(new DDMASPReplyDataStream(), AS400.RECORDACCESS); -// } - - static void freeDBReplyStream(DataStream ds) - { - if (ds instanceof DBReplyRequestedDS) - { - ((DBReplyRequestedDS)ds).returnToPool(); - } - } - - static Object[] connectDDMPhase1(OutputStream outStream, InputStream inStream, boolean passwordType_, int byteType_, int connectionID) throws ServerStartupException, IOException - { - // Exchange server start up/security information with DDM server. - // Exchange attributes. - DDMEXCSATRequestDataStream EXCSATRequest = new DDMEXCSATRequestDataStream(); - if (Trace.traceOn_) EXCSATRequest.setConnectionID(connectionID); - EXCSATRequest.write(outStream); - - DDMEXCSATReplyDataStream EXCSATReply = new DDMEXCSATReplyDataStream(); - if (Trace.traceOn_) EXCSATReply.setConnectionID(connectionID); - EXCSATReply.read(inStream); - - if (!EXCSATReply.checkReply()) - { - throw new ServerStartupException(ServerStartupException.CONNECTION_NOT_ESTABLISHED); - } - byte[] jobString = EXCSATReply.getEXTNAM(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "DDM EXCSAT successful."); - - DDMACCSECRequestDataStream ACCSECReq = new DDMACCSECRequestDataStream(passwordType_, byteType_, null); // We currently don't need to pass the IASP to the ACCSEC, but may in the future. - if (Trace.traceOn_) ACCSECReq.setConnectionID(connectionID); - ACCSECReq.write(outStream); - - DDMACCSECReplyDataStream ACCSECRep = new DDMACCSECReplyDataStream(); - if (Trace.traceOn_) ACCSECRep.setConnectionID(connectionID); - ACCSECRep.read(inStream); - - if (!ACCSECRep.checkReply(byteType_)) - { - throw new ServerStartupException(ServerStartupException.CONNECTION_NOT_ESTABLISHED); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "DDM ACCSEC successful."); - - // Seeds for substitute password generation. - byte[] clientSeed = null; - byte[] serverSeed = null; - if (byteType_ == AS400.AUTHENTICATION_SCHEME_PASSWORD) - { - clientSeed = ACCSECReq.getClientSeed(); - serverSeed = ACCSECRep.getServerSeed(); - } - return new Object[] { clientSeed, serverSeed, jobString }; - } - - static void connectDDMPhase2(OutputStream outStream, InputStream inStream, byte[] userIDbytes, byte[] ddmSubstitutePassword, byte[] iaspBytes, int byteType_, String ddmRDB_, String systemName_, int connectionID) throws ServerStartupException, IOException - { - // If the ddmSubstitutePassword length is 8, then we are using DES encryption. If its length is 20, then we are using SHA encryption. - // Build the SECCHK request; we build the request here so that we are not passing the password around anymore than we have to. - DDMSECCHKRequestDataStream SECCHKReq = new DDMSECCHKRequestDataStream(userIDbytes, ddmSubstitutePassword, iaspBytes, byteType_); - if (Trace.traceOn_) SECCHKReq.setConnectionID(connectionID); - - // Send the SECCHK request. - SECCHKReq.write(outStream); - - DDMSECCHKReplyDataStream SECCHKRep = new DDMSECCHKReplyDataStream(); - if (Trace.traceOn_) SECCHKRep.setConnectionID(connectionID); - SECCHKRep.read(inStream); - - // Validate the reply. - if (!SECCHKRep.checkReply()) - { - throw new ServerStartupException(ServerStartupException.CONNECTION_NOT_ESTABLISHED); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "DDM SECCHK successful."); - if (iaspBytes != null) - { - // We need to send an RDB datastream to make sure the RDB name we sent on the SECCHK is a valid RDB. - DDMASPRequestDataStream aspReq = new DDMASPRequestDataStream(iaspBytes); - if (Trace.traceOn_) aspReq.setConnectionID(connectionID); - aspReq.write(outStream); - DDMASPReplyDataStream aspRep = new DDMASPReplyDataStream(); - if (Trace.traceOn_) aspRep.setConnectionID(connectionID); - aspRep.read(inStream); - if (!aspRep.checkReply()) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "RDB name '"+ddmRDB_+"' is not a valid IASP name on system '"+systemName_+"'."); - throw new ServerStartupException(ServerStartupException.CONNECTION_NOT_ESTABLISHED); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "DDM RDB name '"+ddmRDB_+"' verified."); - } - } - - static DataStream constructDDMDataStream(InputStream inStream, Hashtable replyStreams, AS400ImplRemote system, int connectionID) throws IOException - { - return DDMDataStream.construct(inStream, replyStreams, system, connectionID); - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/ClientAccessDataStream.java b/cvsroot/src/com/ibm/as400/access/ClientAccessDataStream.java deleted file mode 100644 index c767965f5..000000000 --- a/cvsroot/src/com/ibm/as400/access/ClientAccessDataStream.java +++ /dev/null @@ -1,370 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ClientAccessDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Hashtable; - - -// Base class for client access server data streams. Provides methods to access common client access data stream header. -class ClientAccessDataStream extends DataStream -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - protected static final int HEADER_LENGTH = 20; - - private static final CADSPool basePool_ = new CADSPool(); //@P0A - base datastream pool - private class InUseLock extends Object {} //@C7A - - private InUseLock inUseLock_ = new InUseLock(); - boolean inUse_; //@P0A - - // Note: The following method is called by AS400ThreadedServer and AS400NoThreadServer. - - // Construct an appropriate client access data stream object. Read from the InputStream to obtain the data stream data for the object. - // @param is InputStream from which to read to obtain the data stream contents. - // @param dataStreams Hashtable containing instances of data stream objects to receive into. This table is searched first when a reply comes in. If found the datastream will be removed from here as it is received. - // @param dataStreams Prototypes Hashtable containing data stream objects from which to obtain a model for this object. - // @exception IOException Data read from the input stream is less than 20 bytes or we are unable to read from the input stream for some other reason. - // @return ClientAccessDataStream object. - static final ClientAccessDataStream construct(InputStream is, Hashtable dataStreams, Hashtable dataStreamPrototypes, AS400ImplRemote system, int connectionID) throws IOException - { - // Construct a client access data stream to receive the data stream header. By using the default constructor for ClientAccessDataStream, we get a data stream of size HEADER_LENGTH. - //@P0D ClientAccessDataStream baseDataStream = new ClientAccessDataStream(); - ClientAccessDataStream baseDataStream = basePool_.getUnusedStream(); //@P0A - - try - { - // Receive the header. - byte[] data = baseDataStream.data_; - if (readFromStream(is, data, 0, HEADER_LENGTH, connectionID) < HEADER_LENGTH) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Failed to read all of the data stream header."); //@P0C - baseDataStream.returnToPool(); baseDataStream=null; - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - // int length2 = ((data[0] & 0xFF) << 24) + ((data[1] & 0xFF) << 16) + ((data[2] & 0xFF) << 8) + (data[3] & 0xFF); - int length = baseDataStream.getLength(); - - if (baseDataStream.data_[6] != (byte)0xE0) - { - - - // boolean traceTurnedOn = false; - // if (!Trace.traceOn_) { - // traceTurnedOn = true; - // } - - // Debugging code. - // if (! DataStream.traceOpened) { - // SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmm"); - - // Trace.setFileName("/tmp/toolboxTrace."+sdf.format(new Date())+".txt"); - // DataStream.traceOpened=true; - // } - - // if (!Trace.traceOn_) { - // traceTurnedOn = true; - // Trace.setTraceAllOn(true); - // Trace.setTraceOn(true); - // } - // Trace.log(Trace.ERROR, "Debug0601: Incorrect data stream header detected. baseDataStream.data_("+baseDataStream.data_.toString()+") length=("+length+")", - // baseDataStream.data_, 0, HEADER_LENGTH); - // Trace.log(Trace.ERROR, "Debug0601: Incorrect data stream header detected. data_("+data.toString()+") length=("+length2+")", - // data, 0, HEADER_LENGTH); - - - if (Trace.traceOn_) { - Trace.log(Trace.ERROR, "Incorrect data stream header detected.", - baseDataStream.data_, 0, HEADER_LENGTH); - } - - // Debugging code - //if (traceTurnedOn) { - // Trace.setTraceAllOn(false); - // Trace.setTraceOn(false); - //} - - - baseDataStream.returnToPool(); baseDataStream=null; - - is.skip(is.available()); // disregard the rest of this data stream - - // Debug... - // Just hang the thread - // while (true) { - // try { - // Thread.sleep(100000); - // } catch (Exception e) { - // break; - // } - //} - - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - - // First look for an instance data stream. - // If we found it remove it since instance datastreams are only used once. - // Print is the only thing that uses this. - ClientAccessDataStream newDataStream = (ClientAccessDataStream)dataStreams.remove(baseDataStream); //@P0C - if (newDataStream == null) //@P0C - { - // If we couldn't find an instance datastream to receive into, look for a prototype data stream to generate one with. - ClientAccessDataStream modelDataStream = (ClientAccessDataStream)dataStreamPrototypes.get(baseDataStream); - - if (modelDataStream == null) - { - // No model was found in the hash table, so we will return a generic data stream. - newDataStream = new ClientAccessDataStream(); - } - else - { - // Get a new instance of the data stream. - newDataStream = (ClientAccessDataStream)modelDataStream.getNewDataStream(); - if (newDataStream == null) - { - newDataStream = new ClientAccessDataStream(); - } - } - } - - newDataStream.system_ = system; - if (Trace.traceOn_) newDataStream.setConnectionID(connectionID); - // Initialize the header section of the new data stream. - - int nowLength = baseDataStream.getLength(); - - // Debugging code - // if ((nowLength != length) || (length != length2) || (data != baseDataStream.data_ )) { - // if (! DataStream.traceOpened) { - // SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmm"); - // - // Trace.setFileName("/tmp/toolboxTrace."+sdf.format(new Date())+".txt"); - // DataStream.traceOpened=true; - // } - // - // boolean traceTurnedOn = false; - // if (!Trace.traceOn_) { - // traceTurnedOn = true; - // Trace.setTraceAllOn(true); - // Trace.setTraceOn(true); - // } - // if (nowLength != length) { - // Trace.log(Trace.DATASTREAM, "Debug0601: Buffer corrupted.. Original length="+length+" nowLength="+nowLength); - // } - // if (length != length2) { - // Trace.log(Trace.DATASTREAM, "Debug0601: Buffer corrupted.. Original length="+length+" length2="+length2); - // } - // if (data != baseDataStream.data_) { - // Trace.log(Trace.DATASTREAM, "Debug0601: Buffer corrupted.. data="+data+" baseDataStream.data_="+baseDataStream.data_); - // } - // if (traceTurnedOn) { - // Trace.setTraceAllOn(false); - // Trace.setTraceOn(false); - // } - //} - - // - // TODO: Restructure this code so that a new byte array is not always allocated. - // - newDataStream.data_ = new byte[nowLength]; - System.arraycopy(baseDataStream.data_, 0, newDataStream.data_, 0, HEADER_LENGTH); - - - if (newDataStream.data_.length - HEADER_LENGTH > 0) - { - // Receive any remaining bytes. - // The number of bytes to read is calculated from newDataStream.data_.length - HEADER_LENGTH - newDataStream.readAfterHeader(is); - } - return newDataStream; - } - finally - { - if (baseDataStream != null) { - baseDataStream.returnToPool(); baseDataStream = null; - } - } - } - - // Constructs an empty ClientAccessDataStream object. - ClientAccessDataStream() - { - super(HEADER_LENGTH); - } - - // Constructs a ClientAccessDataStream object. - // @param data Byte array with which to initialize this data stream. - ClientAccessDataStream(byte[] ds) - { - super(HEADER_LENGTH, ds); - } - - // Retrieve the request correlation for this data stream. The return value may be invalid if it has not been set. - // @return The request correlation number. - int getCorrelation() - { - return get32bit(12); - } - - // Retrieve the CS instance for the data stream. The return value may be invalid if it has not been set. - // @return The CS instance of the data stream. - int getCSInstance() - { - return get32bit(8); - } - - // Retrieve the header ID for the data stream. The return value may be invalid if it has not been set. - // @return The ID of the data stream. - int getHeaderID() - { - return get16bit(4); - } - - // Retrieve the total length of the data stream. The return value may be invalid if it has not been set. - // @return The total length of this data stream. - int getLength() - { - return get32bit(0); - } - - // Retrieve the request/reply ID of the data stream. The return value may be invalid if it has not been set. - // @return The request/reply ID of this data stream. - int getReqRepID() - { - //@P0D return get16bit(18); - return((data_[18] & 0xFF) << 8) + (data_[19] & 0xFF); //@P0A - } - - // Retrieve the server ID of the data stream. The return value may be invalid if it has not been set. - // @return The server ID of this data stream. - int getServerID() - { - return get16bit(6); - } - - // Retrieve the template length of the data stream. The return value may be invalid if it has not been set. - // @return The template length of this data stream. - int getTemplateLen() - { - return get16bit(16); - } - - // Retrieve the hash code of the data stream. The return value may be invalid if it has not been set. - // Note: Reply data stream sub-classes should override this method to return the request/reply id directly instead of calling getReqRepId(). - // @return The hash code of this data stream. - public int hashCode() - { - //@P0D return getReqRepID(); - return((data_[18] & 0xFF) << 8) + (data_[19] & 0xFF); //@P0A - } - - // Set the request correlation for this data stream. - // @param id The request correlation number. - void setCorrelation(int id) - { - set32bit(id, 12); - } - - // Set the CS instance for this data stream. - // @param id The CS instance. - void setCSInstance(int id) - { - set32bit(id, 8); - } - - // Set the header ID for the data stream. It should be set to 0 for most of the Client Access servers. - // @param id The header ID to set. - void setHeaderID(int id) - { - set16bit(id, 4); - } - - // Set the length of the data stream. This is the total length of the data stream. - // @param len The length of the data stream. - void setLength(int len) - { - //@P0D set32bit(len, 0); - data_[0] = (byte)(len >>> 24); - data_[1] = (byte)(len >>> 16); - data_[2] = (byte)(len >>> 8); - data_[3] = (byte) len; - } - - // Set the request/reply ID for the data stream. - // @param id The request/reply ID to set. - void setReqRepID(int id) - { - set16bit(id, 18); - } - - // Set the server ID for the data stream. This is the ID of the server to talk to. - // @param id The ID of the server. - void setServerID(int id) - { - set16bit(id, 6); - } - - // Set the template length for the data stream. - // @param len The template length. - void setTemplateLen(int len) - { - set16bit(len, 16); - } - - // - // Indicate that the buffer can be returned to the pool. In the past, the pooling implementation - // just set inUse_=false to return to the pool. This is provided so that the request buffer can be resized - // by inheriting classes - // - void returnToPool() throws InternalErrorException { // @A7C - synchronized(inUseLock_) { - if (inUse_) { - // Use this to find places where the object is used after it is returned to the pool - // Note: For DBBaseRequestDS objects, the data_ pointer has been set to the one for the - // DBStorage object. - // if (data_ != null) { - // Arrays.fill(data_, (byte) 0xeb); - // } - - inUse_ = false; - // if (DBDSPool.monitor && this instanceof DBReplyRequestedDS) { - // System.out.println("Freeing "+((DBReplyRequestedDS) this).poolIndex); - // } - } else { - // This is an error case. You cannot double free a buffer - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - } - - /** - * Can this be used. If not, false is returned. - * If it can be used, then inUse_ is set to return and true is returned - * @return - */ - public boolean canUse() { - synchronized (inUseLock_) { - if (inUse_) { - return false; - } else { - inUse_ = true; - return true; - } - } - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/ClusteredHashTable.java b/cvsroot/src/com/ibm/as400/access/ClusteredHashTable.java deleted file mode 100644 index acca37ccf..000000000 --- a/cvsroot/src/com/ibm/as400/access/ClusteredHashTable.java +++ /dev/null @@ -1,1178 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ClusteredHashTable.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.net.*; -import java.io.*; -import java.util.*; -import java.beans.*; - -/** -Provides access to an IBM i highly available Clustered Hash Table. -A Clustered Hash Table is represented as an IBM i server job. -A Clustered Hash Table is a container for small to medium-sized non-persistent data that is -replicated to the Clustered Hash Table domain. The Clustered Hash Table domain is comprised of -nodes defined in a cluster. The Clustered Hash Table domain is defined using the STRCHTSVR CL command. - -

        For further details on a cluster, see the Cluster Resource Services APIs and the Clustering -topic in the IBM i Information Center. - -

        The purpose of this class is to provide interfaces to the Clustered Hash Table APIs. -An instance of this class can be used to {@link #put put()} and {@link #get get()} -keyed entries from the Clustered Hash Table. The entries stored in the Clustered Hash Table -are replicated to cluster nodes defined in the Clustered Hash Table domain. - -

        A connection to the Clustered Hash Table server is required to access the Clustered Hash Table. -Call {@link #open open()} to obtain the connection. After the open() is complete, entries defined by the -{@link com.ibm.as400.access.ClusteredHashTableEntry ClusteredHashTableEntry} class can be put into the table or retrieved from the table, using the methods put() or get(). -A key is required to put() an entry in the Clustered Hash Table. -Use {@link #generateKey generateKey()} to generate a universally unique key. The {@link #elements elements()} method will return a list of all that keys in the clustered hash table. It is recommended to {@link #close close()} the active connection when done to release system resources -that are no longer needed. - -

        This class uses the {@link com.ibm.as400.access.ClusteredHashTableEntry ClusteredHashTableEntry} -class for the get(), elements() and put() methods. - -

        Example Usage:

        - -import com.ibm.as400.access.*;
        -import java.io.*;
        -import java.net.*;
        -import java.util.*;

        - -public class MyFile extends Object
        -{
        - public static void main(String args[]) {

        - - ClusteredHashTableEntry myEntry = null;
        - String myData = new String("This is my data");

        - - try{
        - AS400 the400 = new AS400();

        - - // CHTSVR01 is the clustered hash table server name
        - ClusteredHashTable cht = new ClusteredHashTable(the400,"CHTSVR01");

        - - cht.open(); // make a connection

        - - byte[] key = null;
        - key = cht.generateKey(); // get a key to access data with

        - - // key is the key generated to access the data with
        - // myData is a byte array of data to be stored
        - // 2400 is the time to live in seconds
        - // ENTRY_AUTHORITY_ANY_USER indicates any user can access the data
        - // DUPLICATE_KEY_FAIL indicates if the key already exists in the hash table to not allow the request to succeed.
        - myEntry = new ClusteredHashTableEntry(key,myData.getBytes(),2400,ClusteredHashTableEntry.ENTRY_AUTHORITY_ANY_USER,ClusteredHashTableEntry.DUPLICATE_KEY_FAIL);

        - - cht.put(myEntry); // store the entry in the hash table

        - - ClusteredHashTableEntry output = cht.get(key); // retrieve the data

        - - cht.close();
        - }
        - catch(Exception e){}

        -}
        -}

        - -Note: This class uses APIs that are available only when connecting to systems running OS/400 V5R2M0 or later.

        - -**/ - -public class ClusteredHashTable -implements java.io.Serializable -{ - /** - Constants - **/ - - static final long serialVersionUID = 5L; - - /** - Entry status value to limit retrieved entries to only those which are consistent between nodes. - **/ - public final static int CONSISTENT_ENTRIES = 0; - - /** - Entry status value to limit retrieved entries to only those which are inconsistent between nodes. - **/ - public final static int INCONSISTENT_ENTRIES = 1; - - /** - Entry status value to retrieve all entries on a node. - **/ - public final static int ALL_ENTRIES = -1; - - // various sizes of C defined structures - static final int SIZE_OF_CHTS0100 = 36; - static final int SIZE_OF_CHTI0100 = 24; - static final int SIZE_OF_QUS_EC_T = 272; - - static final int SIZE_OF_KEY = 16; - - // max amount of data that can be returned - static final int MAX_DATA_SIZE = 62000; - - /** - Variables - ***/ - transient private boolean connected_ = false; - - private String name_; - private transient byte[] connectionHandle_; - private AS400 system_; - - private static final Object userSpaceLock_ = new Object(); - - transient private PropertyChangeSupport changes_ = new PropertyChangeSupport(this); - - /** - Constructs a default ClusteredHashTable object. - The hash table serevr name and system must be set before opening a connection. - **/ - public ClusteredHashTable() - { - } - - - /** - Constructs a ClusteredHashTable object that represents the IBM i clustered hash table server. - @param system The system that contains the clustered hash table server. - @param name The name of an clustered hash table server. - This is a 10-byte string that identifies the Clustered Hash Table server to use. - **/ - public ClusteredHashTable(AS400 system, String name) - { - if (system == null) - { - throw new NullPointerException("system"); - } - if (name == null) - { - throw new NullPointerException("name"); - } - if ((name.length() == 0) || (name.length() > 10)) - { - throw new ExtendedIllegalArgumentException("name", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - system_ = system; - name_ = name; - } - - - /** - Adds a listener to be notified when the value of any bound property is changed. - @see #removePropertyChangeListener - @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) throw new NullPointerException("listener"); - changes_.addPropertyChangeListener(listener); - } - - - /** - Verifies the system and name are set. - **/ - private final void checkPropertiesSet() - { - if (system_ == null) - { - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (name_ == null) - { - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - - - /** - Closes a connection to the Clustered Hash Table server. - After this method is called, the clustered hash table server will not allow any more requests - with the specified connection handle. Use {@link #open open()} to establish a connection - to a new Clustered Hash Table server. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - synchronized public void close() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - if (connected_) - { - try - { - // Construct the parameter list. It contains the single parameter to the service program. - ProgramParameter[] parameterList = new ProgramParameter[2]; - - // input -- cht server handle - parameterList[0] = new ProgramParameter(connectionHandle_); - parameterList[0].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // i/o - byte[] errorCode = new byte[SIZE_OF_QUS_EC_T]; - - parameterList[1] = new ProgramParameter(errorCode, SIZE_OF_QUS_EC_T); - parameterList[1].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // Construct the ServiceProgramCall object. - ServiceProgramCall sPGMCall = new ServiceProgramCall(system_); - - // Set the fully qualified service program and the parameter list. - sPGMCall.setProgram("/QSYS.LIB/QCSTCHT.SRVPGM", parameterList); - - // Set the procedure to call in the service program. - sPGMCall.setProcedureName("QcstDisconnectCHT"); - - // Set the format of returned value. The program we call returns an integer. - sPGMCall.setReturnValueFormat(ServiceProgramCall.NO_RETURN_VALUE); - - // Set the call to be thread safe - sPGMCall.suggestThreadsafe(); - - // Call the service program. If true is returned the program was successfully called. If - // false is returned the program could not be started. A list of messages is returned when - // the program cannot be started. - if (!sPGMCall.run()) - { - // Get the error messages when the call fails. - AS400Message[] messageList = sPGMCall.getMessageList(); - throw new AS400Exception(messageList); - } - else - { - // Indicate success. - connectionHandle_ = null; - connected_ = false; - } - } - catch (PropertyVetoException pve) - { - } // This won't ever happen; just quiet the compiler. - } - } - - - /** - Indicates if the specified key is in the clustered hash table. Expired entries will not be included. - This method implicitly opens the connection to the clustered hash table server. -

        Restrictions: -

          -
        • The clustered hash table server must be active on the system. -
        - @param key The possible key. - @return Returns true if and only if the specified key is in this clustered hash table; false otherwise. - @exception AS400Exception If the system returns an error message. - **/ - public boolean containsKey(byte[] key) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - // Validate arguments. - if (key == null) - { - throw new NullPointerException("key"); - } - - if (!connected_) - { - open(); - } - - // try to get the key, if it fails throw whether it was an unexpected error - // or the key doesnt exist. - try - { - // dont keep data, its enough just to know data was returned successfully - get(key); - } - catch (AS400Exception e) - { - // Get the error messages when the call fails. - AS400Message[] messageList = e.getAS400MessageList(); - for (int i = 0; i < messageList.length; ++i) - { - // check exception message to see if any elements exist - // If CPFBD06 is returned it indicates the key does not exist in the hash - // table. The method should return false rather than fail with an exception - // All other exceptions are unexpected - if (messageList[i].getID().startsWith("CPFBD06")) - return false; - } - - // the error was not expected - throw new AS400Exception(messageList); - } - - // no failing conditions occured - return true; - } - - - /** - Retrieves a list of entries that exist in the clustered hash table for the specified user profile. *ALL can be used for either user profile to retrieve all entries. - This method will create a temporary user space on the system in the QUSRSYS library. If the user space exists, it will be deleted and recreated. - This method implicitly opens the connection to the clustered hash table server. -

        Restrictions: -

          -
        • The Clustered Hash table server must be active on the system. -
        - @return Returns an array of all the ClusteredHashTableEntry objects including keys but not data. - @exception AS400Exception If the system returns an error message. - **/ - public ClusteredHashTableEntry[] elements() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - return elements(null,null,ALL_ENTRIES); - } - - - /** - Retrieves a list of entries that exist in the clustered hash table for the specified user profile. *ALL can be used for either user profile to retrieve all entries. Only entries that match the specified status will be returned. This method will create a temporary user space on the system in the QUSRSYS library. If the user space exists, it will be deleted and recreated. - This method implicitly opens the connection to the clustered hash table server. -

        Restrictions: -

          -
        • The Clustered Hash table server must be active on the system. -
        - @param userProfile The owner of the entries to be returned. - If null is specified, *ALL will be used and the results will depend upon the lastModifiedProfile. - If both the userProfile and the lastModifiedProfile profiles are null, all the entries in the clustered hash table that meet the criteria specified for the other parameters will be returned. - @param lastModifiedProfile The most recent modifier of the entries to be returned. - If null is specified, *ALL will be used and the returned entries will depend on the value passed in for - the userProfile. - @param status The type of entries to return. Possible values are: -
          -
        • CONSISTENT_ENTRIES -
        • INCONSISTENT_ENTRIES -
        • ALL_ENTRIES -
        - @return Returns an array of all the ClusteredHashTableEntry objects including keys but not data. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - **/ - public ClusteredHashTableEntry[] elements(String userProfile, String lastModifiedProfile, int status) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - // verify name lengths, and pad to a length of 10 - // it is ok if either profile is NULL, the NULL case will be handled later - if (userProfile != null && userProfile.length() > 10) - { - throw new ExtendedIllegalArgumentException("userProfile", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (lastModifiedProfile != null && lastModifiedProfile.length() > 10) - { - throw new ExtendedIllegalArgumentException("lastModifiedProfile", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - // check status - if ((status != CONSISTENT_ENTRIES) && (status != INCONSISTENT_ENTRIES) && (status != ALL_ENTRIES)) - { - throw new ExtendedIllegalArgumentException("status", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (lastModifiedProfile != null && lastModifiedProfile.length() < 10) - { - StringBuffer buf = new StringBuffer(lastModifiedProfile); - for (int i = lastModifiedProfile.length(); i < 10; ++i) { - buf.append(" "); - } - lastModifiedProfile = buf.toString(); - } - - if (!connected_) - { - open(); - } - - // Validate arguments. - if (userProfile == null) - { - // set to return all entries - userProfile = "*ALL "; - } - if (lastModifiedProfile == null) - { - // set to return all entries - lastModifiedProfile = "*ALL "; - } - - AS400Bin4 bin4 = new AS400Bin4(); - - // Create the user space - // initial name and path for the userspace - // Construct the ServiceProgramCall object. - ServiceProgramCall sPGMCall = new ServiceProgramCall(system_); - - // Note: The QcstListCHTKeys service program doesn't accept QTEMP for the library. Therefore we'll create the temporary user space in QUSRSYS, and try to come up with a unique name for the user space. - String jobNumber = sPGMCall.getServerJob().getNumber(); - String userSpacePath = "/QSYS.LIB/QUSRSYS.LIB/QCHT"+jobNumber+".USRSPC"; - UserSpace usrSpc = new UserSpace(system_, userSpacePath); - - // Construct the parameter list. It contains the single parameter to the service program. - ProgramParameter[] parameterList = new ProgramParameter[7]; - - try - { - // input -- Qualified userspace name - StringBuffer tempName = new StringBuffer(20); - tempName.append(usrSpc.getName()); - for (int i = usrSpc.getName().length(); i < 10; ++i) // pad to 10 characters - tempName.append(' '); - tempName.append("QUSRSYS"); - AS400Text text20 = new AS400Text(20, system_.getCcsid(), system_); - parameterList[0] = new ProgramParameter(text20.toBytes(tempName.toString())); - parameterList[0].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // input -- format name - AS400Text text8 = new AS400Text(8, system_.getCcsid(), system_); - parameterList[1] = new ProgramParameter(text8.toBytes("CHTL0100")); - parameterList[1].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // input -- cht server connection handle - parameterList[2] = new ProgramParameter(connectionHandle_); - parameterList[2].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // input -- key selection info - AS400Text text10 = new AS400Text(10, system_.getCcsid(), system_); - byte[] keyInfo = new byte[SIZE_OF_CHTI0100]; - bin4.toBytes(status, keyInfo, 0); - text10.toBytes(lastModifiedProfile, keyInfo, 4); - text10.toBytes(userProfile, keyInfo, 14); - - parameterList[3] = new ProgramParameter(keyInfo); - parameterList[3].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // input -- key selection info size - parameterList[4] = new ProgramParameter(bin4.toBytes(SIZE_OF_CHTI0100)); - parameterList[4].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // input -- key selection info format - parameterList[5] = new ProgramParameter(text8.toBytes("CHTI0100")); - parameterList[5].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // i/o -- make an array to hold the i/o for the error code - byte [] errorCode = new byte[SIZE_OF_QUS_EC_T]; - parameterList[6] = new ProgramParameter(errorCode, SIZE_OF_QUS_EC_T); - parameterList[6].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // Set the fully qualified service program and the parameter list. - sPGMCall.setProgram("/QSYS.LIB/QCSTCHT.SRVPGM", parameterList); - - // Set the procedure to call in the service program. - sPGMCall.setProcedureName("QcstListCHTKeys"); - - // Set the format of returned value. The program we call returns an integer. - sPGMCall.setReturnValueFormat(ServiceProgramCall.NO_RETURN_VALUE); - - // Set the call to be thread safe - sPGMCall.suggestThreadsafe(); - } - catch (PropertyVetoException pve) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, pve); - } // Won't ever happen; just quiet the compiler - - // array to return at the end - ClusteredHashTableEntry[] entries = null; - - // create a user space to work with, don't handle exceptions from this call - synchronized(userSpaceLock_) - { - try - { - // create the user space, automatically overwrite any existing one - usrSpc.create(1, true, " ", (byte)0, "CHT Wrapper Space", "*ALL"); - // Note: User Spaces by default are auto-extendible (by QUSCRTUS API) - // So it will always have enough space available. - - // Call the service program. If true is returned the program was successfully called. If - // false is returned the program could not be started. A list of messages is returned when - // the program cannot be started. - if (!sPGMCall.run()) - { - // Get the error messages when the call fails. - AS400Message[] messageList = sPGMCall.getMessageList(); - throw new AS400Exception(messageList); - } - - // attempt to get a list of entries containing only key info - - // declare variabes to get an array of keys - byte[] num = new byte[4]; - - usrSpc.read(num,0x7C); // location of the number of entries in user space - int startOfData = bin4.toInt(num); - - usrSpc.read(num,0x84); // location of the number of entries in user space - int numOfEntries = bin4.toInt(num); - - usrSpc.read(num,0x88); // location of the size of entries - int entrySize = bin4.toInt(num); - - usrSpc.read(num,0x2A0); // offset of key within structure - int keyOffset = bin4.toInt(num); - - ClusteredHashTableEntry tempEntry = null; - entries = new ClusteredHashTableEntry[numOfEntries]; - - for (int i = 0; i < numOfEntries; ++i) - { - byte[] key = new byte[SIZE_OF_KEY]; - usrSpc.read(key,startOfData+keyOffset+entrySize*i); // offset of data + offset to key + number of previous entries @A3 - - byte[] bb = new byte[1]; // dummy data - entries[i] = new ClusteredHashTableEntry(key,bb,60,0,0); - } - } - finally - { - // clean up left over storage - try { if (usrSpc != null) usrSpc.delete(); } - catch (Exception e) { - Trace.log(Trace.ERROR, "Exception while deleting temporary user space", e); - } - } - } - - // return list of generated entries only key info correct - return entries; - } - - - /** - Generates a 16-byte universally unique key. - This key can be used to put() information in the Clustered Hash Table. - This method implicitly opens the connection to the clustered hash table server. -

        Restrictions: -

          -
        • The Clustered Hash table server must be active on the system. -
        - @return The generated key. - @exception AS400Exception If the system returns an error message. - **/ - synchronized public byte[] generateKey() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - if (!connected_) - { - open(); - } - - AS400Bin4 bin4 = new AS400Bin4(); - byte[] generatedKey = new byte[SIZE_OF_KEY]; - - try - { - // Construct the parameter list. It contains the single parameter to the service program. - ProgramParameter[] parameterList = new ProgramParameter[4]; - - // output -- place to put generated key - parameterList[0] = new ProgramParameter(generatedKey, SIZE_OF_KEY); - parameterList[0].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // input -- key data size, must be 16 - parameterList[1] = new ProgramParameter(bin4.toBytes(SIZE_OF_KEY)); - parameterList[1].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // input -- cht server handle - parameterList[2] = new ProgramParameter(connectionHandle_); - parameterList[2].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // i/o - byte [] errorCode = new byte[SIZE_OF_QUS_EC_T]; - parameterList[3] = new ProgramParameter(errorCode, SIZE_OF_QUS_EC_T); - parameterList[3].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // Construct the ServiceProgramCall object. - ServiceProgramCall sPGMCall = new ServiceProgramCall(system_); - - // Set the fully qualified service program and the parameter list. - sPGMCall.setProgram("/QSYS.LIB/QCSTCHT.SRVPGM", parameterList); - - // Set the procedure to call in the service program. - sPGMCall.setProcedureName("QcstGenerateCHTKey"); - - // Set the format of returned value. The program we call returns an integer. - sPGMCall.setReturnValueFormat(ServiceProgramCall.NO_RETURN_VALUE); - - // Set the call to be thread safe - sPGMCall.suggestThreadsafe(); - - // Call the service program. If true is returned the program was successfully called. If - // false is returned the program could not be started. A list of messages is returned when - // the program cannot be started. - if (!sPGMCall.run()) - { - // Get the error messages when the call fails. - AS400Message[] messageList = sPGMCall.getMessageList(); - throw new AS400Exception(messageList); - } - else - { - // Indicate success. - generatedKey = parameterList[0].getOutputData(); - if (Trace.isTraceOn()) Trace.log(Trace.INFORMATION, "Successfully generated key:", generatedKey); - } - } - catch (PropertyVetoException pve) - { - } // Won't ever happen; just quiet the compiler - - return generatedKey; - } - - - /** - Returns information from the clustered hash table for the specified key. - If the entry exists, is not expired, and the requesting user is authorized, the information will be returned. The time to live and update option parameters can not be retrieved from the hash table and so will be given defaulted values. - This method implicitly opens the connection to the clustered hash table server. -

        Restrictions: -

          -
        • The Clustered Hash table server must be active on the IBM i system. -
        -

        For information on the authority considerations, see the Clustered Hash Table APIs. - @param key The key to use to return information. - @return The entry for the specified key - @exception AS400Exception If the system returns an error message. - **/ - synchronized public ClusteredHashTableEntry get(byte[] key) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - // Validate arguments. - if (key == null) - { - throw new NullPointerException("key"); - } - - if (!connected_) - { - open(); - } - - AS400Bin4 bin4 = new AS400Bin4(); - byte[] temp = new byte[MAX_DATA_SIZE]; - - // Construct the parameter list. It contains the single parameter to the service program. - ProgramParameter[] parameterList = new ProgramParameter[7]; - - // forward declared since need in both try block and catcher - AS400Message[] messageList; - - // Construct the ServiceProgramCall object. - ServiceProgramCall sPGMCall = new ServiceProgramCall(getSystem()); - - ClusteredHashTableEntry entry = null; - - try - { - // set the parameter list - // output -- receiver - parameterList[0] = new ProgramParameter(temp,MAX_DATA_SIZE); - parameterList[0].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // input -- receiver length - parameterList[1] = new ProgramParameter(bin4.toBytes(MAX_DATA_SIZE)); - parameterList[1].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // input -- cht server handle - parameterList[2] = new ProgramParameter(connectionHandle_); - parameterList[2].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // input -- cht format name - AS400Text text8 = new AS400Text(8, system_.getCcsid(), system_); - parameterList[3] = new ProgramParameter(text8.toBytes("CHTR0100")); - parameterList[3].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // input -- cht key length - parameterList[4] = new ProgramParameter(bin4.toBytes(key.length)); - parameterList[4].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // input -- cht key - parameterList[5] = new ProgramParameter(key); - parameterList[5].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // i/o -- make an array to hold the i/o for the error code - byte [] errorCode = new byte[SIZE_OF_QUS_EC_T]; - parameterList[6] = new ProgramParameter(errorCode, SIZE_OF_QUS_EC_T); - parameterList[6].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // Set the fully qualified service program and the parameter list. - sPGMCall.setProgram("/QSYS.LIB/QCSTCHT.SRVPGM", parameterList); - - // Set the procedure to call in the service program. - sPGMCall.setProcedureName("QcstRetrieveCHTEntry"); - - // Set the format of returned value. The program we call returns an integer. - sPGMCall.setReturnValueFormat(ServiceProgramCall.NO_RETURN_VALUE); - - // Set the call to be thread safe - sPGMCall.suggestThreadsafe(); - - // Call the service program. If true is returned the program was successfully called. If - // false is returned the program could not be started. A list of messages is returned when - // the program cannot be started. - if (!sPGMCall.run()) - { - // Get the error messages when the call fails. - messageList = sPGMCall.getMessageList(); - throw new AS400Exception(messageList); - } - else - { - // Indicate success. - temp = parameterList[0].getOutputData(); - } - // gather and parse all the data from the returned api call - int length = bin4.toInt(temp, 12); - int entryStatus = bin4.toInt(temp, 16); //@A2C - int authorityAccess = bin4.toInt(temp, 20); - - // the data - byte[] theData = new byte[length]; - for (int i = 0; i < length; ++i) - { - theData[i] = temp[i+44]; //@A1C - } - - // the owning profile - byte[] ownerProfile = new byte[10]; //@A1A - for (int i = 0; i < 10; ++i) - { - ownerProfile[i] = temp[i+24]; - } - - // last modified profile - byte[] modifyProfile = new byte[10]; //@A1A - for (int i = 0; i < 10; ++i) - { - modifyProfile[i] = temp[i+34]; - } - - // time-to-live and update-option are unneeded at this point - entry = new ClusteredHashTableEntry(key,theData,60,authorityAccess,0); - entry.setOwnerProfile(new String(ownerProfile)); //@A1A - entry.setModifiedProfile(new String(modifyProfile)); //@A1A - entry.setEntryStatus(entryStatus); //@A2A - - } - catch (PropertyVetoException pve) - { - } // Won't ever happen; just quiet the compiler - - // no failing conditions occured - return entry; - } - - - /** - Returns the name of the clustered hash table connection handle. - @return Returns the clustered hash table connection handle name as a 16-byte string, or null if it hasn't been set yet. - **/ - public String getHandle() - { - if(connectionHandle_ == null) return null; - return new String(connectionHandle_); - } - - - /** - Returns the name of the clustered hash table server. - @return Returns the clustered hash table server name. - **/ - public String getName() - { - return name_; - } - - - /** - Returns the system object for the clustered hash table. - @return The system object for the clustered hash table. - **/ - public AS400 getSystem() - { - return system_; - } - - - /** - Provided to initialize transient data if this object is de-serialized. - **/ - private void initializeTransient() - { - changes_ = new PropertyChangeSupport(this); - - connected_ = false; - connectionHandle_ = null; - } - - - /** - Indicates if the clustered hash table contains any keys. - Expired entries will not be included for purposes of determining if the hash table is empty. - This method implicitly opens the connection to the clustered hash table server. -

        Restrictions: -

          -
        • The Clustered Hash table server must be active on the system. -
        - @return Returns true if the clustered hash table does not contain any keys; - false if the clustered hash table contains keys. - @exception AS400Exception If the system returns an error message. - **/ - public boolean isEmpty() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - if (!connected_) - { - open(); - } - - return size() == 0; - } - - - /** - Opens a connection to the Clustered Hash Table server. - The name and system must be set before invoking this method. - The name and system are committed at this time. Use {@link #close close()} to close - the connection from the Clustered Hash Table server. -

        Restrictions: -

          -
        • The Clustered Hash table server must be active on the system. -
        - @exception AS400Exception If the system returns an error message. - **/ - synchronized public void open() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - // verify required parameters are set - checkPropertiesSet(); - - // ensure not already connected - if (connected_) - { - return; - } - - try - { - // Construct the parameter list. It contains the single parameter to the service program. - ProgramParameter[] parameterList = new ProgramParameter[3]; - - // set the parameter list - // output -- place to put generated connection handle - parameterList[0] = new ProgramParameter(connectionHandle_, 16); - parameterList[0].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // input -- cht server to connect to - AS400Text text10 = new AS400Text(10, system_.getCcsid(), system_); - parameterList[1] = new ProgramParameter(text10.toBytes(name_)); - parameterList[1].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // i/o -- make an array to hold the i/o for the error code - byte [] errorCode = new byte[SIZE_OF_QUS_EC_T]; - parameterList[2] = new ProgramParameter(errorCode, SIZE_OF_QUS_EC_T); - parameterList[2].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // Construct the ServiceProgramCall object. - ServiceProgramCall sPGMCall = new ServiceProgramCall(system_); - - // Set the fully qualified service program and the parameter list. - sPGMCall.setProgram("/QSYS.LIB/QCSTCHT.SRVPGM", parameterList); - - // Set the procedure to call in the service program. - sPGMCall.setProcedureName("QcstConnectCHT"); - - // Set the format of returned value. The program we call returns an integer. - sPGMCall.setReturnValueFormat(ServiceProgramCall.NO_RETURN_VALUE); - - // Set the call to be thread safe - sPGMCall.suggestThreadsafe(); - - // Call the service program. If true is returned the program was successfully called. If - // false is returned the program could not be started. A list of messages is returned when - // the program cannot be started. - if (!sPGMCall.run()) - { - // Get the error messages when the call fails. - AS400Message[] messageList = sPGMCall.getMessageList(); - throw new AS400Exception(messageList); - } - else - { - // Indicate success. - connectionHandle_ = parameterList[0].getOutputData(); - connected_ = true; - if (Trace.isTraceOn()) Trace.log(Trace.INFORMATION, "Connection handle is:", connectionHandle_); - } - } - catch (PropertyVetoException pve) - { - } // Won't ever happen; just quiet the compiler - } - - - /** - Put an entry in the clustered hash table identified by the connection handle. The storage for the entry is not persistent. Not persistent means the storage for the entry is only known to the clustered hash table server on the local node and only available until the clustered hash table server is ended. - -

        This request to store an entry is replicated to other nodes in the clustered hash table domain. Control will not be returned until the entry is stored in the clustered hash table on all active nodes in the clustered hash table domain. - -

        There is no encrypting of the information that is replicated and stored in the clustered hash table. - -

        When an entry is stored, a time to live value is specified. The entry can become expired, when the time to live value has expired. Expired entries will be removed when processing various functions. - -

        The user that originally stores the entry will be the owner of the entry. The owning user profile will be used in determining authorization to an entry. - -

        Information stored in the clustered hash table is associated with a key. The key can be generated using the generateKey() method or the user can generate their own. - -

        Duplicate keys are not supported. An entry associated with an existing key can be updated if the requesting user is the owner of the entry or is authorized to the entry. - -

        This method implicitly opens the connection to the clustered hash table server. - - @param entry This object describes the information to put in the clustered hash table. - @exception AS400Exception If the system returns an error message. - **/ - synchronized public void put(ClusteredHashTableEntry entry) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - // Validate arguments. - if (entry == null) - { - throw new NullPointerException("entry"); - } - - // ensure the properties are set - checkPropertiesSet(); - - // verify generated data is legal with the CHT code - if (entry.getUpdateOption() != ClusteredHashTableEntry.DUPLICATE_KEY_FAIL && entry.getUpdateOption() != ClusteredHashTableEntry.DUPLICATE_KEY_UPDATE) - { - throw new ExtendedIllegalArgumentException("entry", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // connect if necessary - if (!connected_) - { - open(); - } - - AS400Bin4 bin4 = new AS400Bin4(); - - // generate the put format CHTS0100 - byte[] theDescription = new byte[SIZE_OF_CHTS0100 + entry.getKey().length + entry.getUserData().length]; - - // offset to the key - int indx = 0; - byte[] len = bin4.toBytes(SIZE_OF_CHTS0100); - for (int i = 0; i < 4; ++i) - theDescription[indx++] = len[i]; - - // length of the key - len = bin4.toBytes(entry.getKey().length); - for (int i = 0; i < 4; ++i) - theDescription[indx++] = len[i]; - - // offset to the data - len = bin4.toBytes(SIZE_OF_CHTS0100 + entry.getKey().length); - for (int i = 0; i < 4; ++i) - theDescription[indx++] = len[i]; - - // length of the data - len = bin4.toBytes(entry.getUserData().length); - for (int i = 0; i < 4; ++i) - theDescription[indx++] = len[i]; - - // length and offset of additional fields (each is 4 bytes) - for (int i = 0; i < 8; ++i) - theDescription[indx++] = 0x00; - - // update option - len = bin4.toBytes(entry.getUpdateOption()); - for (int i = 0; i < 4; ++i) - theDescription[indx++] = len[i]; - - // authority access - len = bin4.toBytes(entry.getEntryAuthority()); - for (int i = 0; i < 4; ++i) - theDescription[indx++] = len[i]; - - // time to live - len = bin4.toBytes( (entry.getTimeToLive() / 60) ); // convert to minutes - for (int i = 0; i < 4; ++i) - theDescription[indx++] = len[i]; - - // key - len = entry.getKey(); - for (int i = 0; i < entry.getKey().length; ++i) - theDescription[indx++] = len[i]; - - // data - len = entry.getUserData(); - for (int i = 0; i < entry.getUserData().length; ++i) - theDescription[indx++] = len[i]; - - try - { - // Construct the parameter list. It contains the single parameter to the service program. - ProgramParameter[] parameterList = new ProgramParameter[4]; - - // set the parameter list - // input -- cht server handle - parameterList[0] = new ProgramParameter(connectionHandle_); - parameterList[0].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // input -- cht format - parameterList[1] = new ProgramParameter(theDescription); - parameterList[1].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // input -- store description - AS400Text text8 = new AS400Text(8, system_.getCcsid(), system_); - parameterList[2] = new ProgramParameter(text8.toBytes("CHTS0100")); - parameterList[2].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // i/o -- make an array to hold the i/o for the error code - byte [] errorCode = new byte[SIZE_OF_QUS_EC_T]; - parameterList[3] = new ProgramParameter(errorCode, SIZE_OF_QUS_EC_T); - parameterList[3].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - // Construct the ServiceProgramCall object. - ServiceProgramCall sPGMCall = new ServiceProgramCall(system_); - - // Set the fully qualified service program and the parameter list. - sPGMCall.setProgram("/QSYS.LIB/QCSTCHT.SRVPGM", parameterList); - - // Set the procedure to call in the service program. - sPGMCall.setProcedureName("QcstStoreCHTEntry"); - - // Set the format of returned value. The program we call returns an integer. - sPGMCall.setReturnValueFormat(ServiceProgramCall.NO_RETURN_VALUE); - - // Set the call to be thread safe - sPGMCall.suggestThreadsafe(); - - // Call the service program. If true is returned the program was successfully called. If - // false is returned the program could not be started. A list of messages is returned when - // the program cannot be started. - if (!sPGMCall.run()) - { - // Get the error messages when the call fails. - AS400Message[] messageList = sPGMCall.getMessageList(); - throw new AS400Exception(messageList); // at this point allow program continuation? or throw an exception to the user? - // We throw an exception because ProgramCall.run() only returns false if one of the messages is an escape message. - } - } - catch (PropertyVetoException pve) - { - } // Won't ever happen; just quiet the compiler - } - - - /** - Restores the state of this object from an object input stream. - @param ois The stream of state information. - @exception IOException - @exception ClassNotFoundException - **/ - private void readObject(java.io.ObjectInputStream ois) throws IOException, ClassNotFoundException - { - // Restore the non-static and non-transient fields. - ois.defaultReadObject(); - - // Initialize the transient fields. - initializeTransient(); - } - - - /** - Removes the listener from being notified when a bound property changes. - @see #addPropertyChangeListener - @param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) throw new NullPointerException("listener"); - changes_.removePropertyChangeListener(listener); - } - - - /** - Sets the name for the clustered hash table server. - The name can only be set while a connection is not established. - @param name The name of the clustered hash table server. - @exception ExtendedIllegalArgumentException If the user specifies a name longer than 10 - **/ - public void setName(String name) - { - if (name == null) - { - throw new NullPointerException("name"); - } - if (name.length() > 10) - { - throw new ExtendedIllegalArgumentException("name", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (connected_) - { - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - String old = name_; - name_ = name; - changes_.firePropertyChange("name", old, name_); - } - - - /** - Sets the node of the clustered hash table. - The system can only be set while a connection is not established. - @param system The system. - **/ - public void setSystem(AS400 system) - { - if (system == null) - { - throw new NullPointerException("system"); - } - if (connected_) - { - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - AS400 old = system_; - system_ = system; - changes_.firePropertyChange("system", old, system_); - } - - - /** - Return the number of entries in the clustered hash table. Expired entries will not be included. - This method implicitly opens the connection to the clustered hash table server. -

        Restrictions: -

          -
        • The Clustered Hash table server must be active on the system. -
        - @return The number of entries in the clustered hash table. - @exception AS400Exception If the system returns an error message. - **/ - public int size() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - if (!connected_) - { - open(); - } - - ClusteredHashTableEntry[] entriesList = elements(); - // return the number of entries that exist - return entriesList.length; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/ClusteredHashTable16.gif b/cvsroot/src/com/ibm/as400/access/ClusteredHashTable16.gif deleted file mode 100644 index 3dc20d9c4..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/ClusteredHashTable16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/ClusteredHashTable32.gif b/cvsroot/src/com/ibm/as400/access/ClusteredHashTable32.gif deleted file mode 100644 index 3c8456d11..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/ClusteredHashTable32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/ClusteredHashTableBeanInfo.java b/cvsroot/src/com/ibm/as400/access/ClusteredHashTableBeanInfo.java deleted file mode 100644 index 1b6ad778b..000000000 --- a/cvsroot/src/com/ibm/as400/access/ClusteredHashTableBeanInfo.java +++ /dev/null @@ -1,114 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ClusteredHashTableBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; - -/** - The ClusteredHashTableBeanInfo class provides bean information for - the ClusteredHashTable class. -**/ - -public class ClusteredHashTableBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private final static Class beanClass = ClusteredHashTable.class; - private static PropertyDescriptor[] properties_; - - static - { - try - { - // Define the property descriptors. - PropertyDescriptor property1 = - new PropertyDescriptor("name", beanClass, "getName", "setName"); - property1.setBound(true); - property1.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_NAME")); - property1.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_NAME")); - - PropertyDescriptor property2 = - new PropertyDescriptor("system", beanClass, "getSystem", "setSystem"); - property2.setBound(true); - property2.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - property2.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - PropertyDescriptor[] properties = - { - property1, property2 - }; - properties_ = properties; - - } - catch(Exception e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - /** - Returns the default property index. - @return The default property index. - **/ - public int getDefaultPropertyIndex() - { - return 1; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("ClusteredHashTable16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("ClusteredHashTable32.gif"); - break; - } - - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/ClusteredHashTableEntry.java b/cvsroot/src/com/ibm/as400/access/ClusteredHashTableEntry.java deleted file mode 100644 index 75753fb05..000000000 --- a/cvsroot/src/com/ibm/as400/access/ClusteredHashTableEntry.java +++ /dev/null @@ -1,479 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ClusteredHashTableEntry.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.net.*; -import java.io.*; -import java.util.*; -import java.beans.*; - -/** -The ClusteredHashTableEntry class represents an entry in an IBM i highly available -Clustered Hash Table. This class is only intended to be used with the -{@link com.ibm.as400.access.ClusteredHashTable ClusteredHashTable} class. -

        - -Note: This class uses APIs that are available only when connecting to systems running OS/400 V5R2M0 or later.

        -**/ -public class ClusteredHashTableEntry implements java.io.Serializable -{ - /** - Constants - **/ - - static final long serialVersionUID = 5L; - - /** - Entry authority option that identifies any user can access the entry in the clustered hash table. - **/ - public final static int ENTRY_AUTHORITY_ANY_USER = 1; - - /** - Entry authority option that identifies a user with *ALLOBJ authority, the user that owns the entry or both can access it. - **/ - public final static int ENTRY_AUTHORITY_LAST_USER = 0; - - /** - Update option to indicate if the specified key already exists then allow the entry to be updated on the ClusteredHashTable.put() request. - **/ - public final static int DUPLICATE_KEY_UPDATE = 1; - - /** - Update option to indicate if the specified key already exists then do not allow the ClusteredHashTable.put() request to succeed. - **/ - public final static int DUPLICATE_KEY_FAIL = 0; - - /** - Data is consistent across the clustered hash table domain. - **/ - public final static int ENTRY_STATUS_CONSISTENT = 0; - - /** - Data is not consistent across the clustered hash table domain. - **/ - public final static int ENTRY_STATUS_INCONSISTENT = 1; - - /** - Maximum amount of user data that can be stored in a clustered hash table entry. - **/ - public final static int MAX_USER_DATA_LENGTH = 61000; - - - /** - Variables - **/ - private byte[] userData_ = null; - private int entryAuthority_ = ENTRY_AUTHORITY_LAST_USER; - private int entryStatus_ = ENTRY_STATUS_CONSISTENT; - private int entryUpdateOption_ = DUPLICATE_KEY_FAIL; - private byte[] key_ = null; - private int timeToLive_ = 60; // minute - private String ownerProfile_ = null; - private String modifyProfile_ = null; - - private transient PropertyChangeSupport changes_ = new PropertyChangeSupport(this); - - /** - Constructs a default ClusteredHashTableEntry object. - The key and data must be set prior to invoking - the {@link com.ibm.as400.access.ClusteredHashTable#put ClusteredHashTable.put()} method. - **/ - public ClusteredHashTableEntry() - { - } - - - /** - Constructs a ClusteredHashTableEntry object that represents an entry in the clustered hash table. - @param key The key that identifies the entry. - The {@link com.ibm.as400.access.ClusteredHashTable#generateKey ClusteredHashTable.generateKey()} method can be used to provide a unique key. - @param userData The user data to be stored in the clustered hash table. - The length of this data must be 1 through MAX_USER_DATA_LENGTH (61000 bytes). - @param timeToLive The time (in seconds) that the entry will be allowed to remain in the clustered hash table. If the value is -1, the entry will never expire. - The value must be -1, greater than or equal to 60 seconds, and less than the seconds in 1 year (31,536,000). This value will be truncated to the nearest minute. - @param entryAuthority This field identifies who is allowed to access, for example update - and retrieve, the entry associated with the key. This value must be - ENTRY_AUTHORITY_LAST_USER if the current cluster version is 2. - Valid values are: -

          -
        • ENTRY_AUTHORITY_LAST_USER = The user who requests the ClusteredHashTable.put(), a user with *ALLOBJ authority or both is allowed to access the entry. -
        • ENTRY_AUTHORITY_ANY_USER = Any user can access the entry. -
        - @param updateOption This is the action used on a ClusteredHashTable.put() request when the key - specified on the constructor or set using setKey() already exists in the - clustered hash table. This value must be DUPLICATE_KEY_FAIL if the current - cluster version is 2. - It is only valid for the duration of the ClusteredHashTable.put() request. Valid values are: -
          -
        • DUPLICATE_KEY_FAIL = Do not allow the ClusteredHashTable.put() if the key already exists. -
        • DUPLICATE_KEY_UPDATE = Allow the entry associated with the key to be updated if it already exists in the clustered hash table and the requesting user is authorized to the data. -
        - **/ - public ClusteredHashTableEntry(byte[] key, byte[] userData, int timeToLive, int entryAuthority, int updateOption) - { - if (key == null) - { - throw new NullPointerException("key"); - } - if (userData == null) - { - throw new NullPointerException("userData"); - } - - if (userData.length < 1 || userData.length > MAX_USER_DATA_LENGTH) - { - throw new ExtendedIllegalArgumentException("userData", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - // must be at least one minute, or up to one year, -1 means infinity - if (((timeToLive != -1) && (timeToLive < 60)) || (timeToLive > 525600 * 60)) // @A1C - { - throw new ExtendedIllegalArgumentException("timeToLive", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (entryAuthority != ENTRY_AUTHORITY_LAST_USER && entryAuthority != ENTRY_AUTHORITY_ANY_USER) - { - throw new ExtendedIllegalArgumentException("entryAuthority", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (updateOption != DUPLICATE_KEY_FAIL && updateOption != DUPLICATE_KEY_UPDATE) - { - throw new ExtendedIllegalArgumentException("updateOption", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - - // set instance vars - key_ = new byte[key.length]; - System.arraycopy(key, 0, key_, 0, key.length); - userData_ = new byte[userData.length]; - System.arraycopy(userData, 0, userData_, 0, userData.length); - timeToLive_ = timeToLive; - entryAuthority_ = entryAuthority; - entryUpdateOption_ = updateOption; - } - - - /** - Adds a listener to be notified when the value of any bound property is changed. - @see #removePropertyChangeListener - @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) throw new NullPointerException("listener"); - changes_.addPropertyChangeListener(listener); - } - - - /** - Returns the entry status. Valid values are: -
          -
        • ENTRY_STATUS_CONSISTENT = The entry is consistent between the clustered hash table domain. -
        • ENTRY_STATUS_INCONSISTENT = The entry is not consistent between the clustered hash table domain. -
        - @return The entry status. - **/ - public int getEntryStatus() - { - return entryStatus_; - } - - - /** - Returns the entry authority. This field identifies who is allowed to access, for example - update and retrieve, the entry associated with the key. Valid values are: -
          -
        • ENTRY_AUTHORITY_LAST_USER = The user who owns the entry, users - with *ALLOBJ authority, or both are allowed to access the entry. -
        • ENTRY_AUTHORITY_ANY_USER = Any user can access the entry. -
        - @return The entry authority. The default value is ENTRY_AUTHORITY_LAST_USER. - **/ - public int getEntryAuthority() - { - return entryAuthority_; - } - - - /** - Returns the key. - @return A byte array copy of the key, or null if the key is not set. - **/ - public byte[] getKey() - { - if (key_ == null) return null; - byte[] b = new byte[key_.length]; - System.arraycopy(key_, 0, b, 0, key_.length); - return b; - } - - - /** - Returns the time to live (in seconds) that was passed to the constructor. This value cannot be retrieved from the hash table. The only purpose of this method is to see what the user passed into the ClusteredHashTableEntry. If no value was specified in the constructor, this will return the defaulted value. - @return The time to live. The default is 60 seconds. - **/ - public int getTimeToLive() - { - return timeToLive_; - } - - - /** - Returns the update option that was passed to the constructor. This value cannot be retrieved from the hash table. The only purpose of this method is to see what the user passed into the ClusteredHashTableEntry. If no value was specified in the constructor, this will return the defaulted value. - @return The update option. The default is DUPLICATE_KEY_FAIL. - **/ - public int getUpdateOption() - { - return entryUpdateOption_; - } - - - /** - Returns the user data. - @return A byte array copy of the user data, or null if the user data is not set. - **/ - public byte[] getUserData() - { - if (userData_ == null) return null; - byte[] b = new byte[userData_.length]; - System.arraycopy(userData_, 0, b, 0, userData_.length); - return b; - } - - - /** - Returns the user profile that created the entry. - @return The user profile that created the entry. - **/ - public String getOwnerProfile() // @A1C - { - if (ownerProfile_ == null) - return null; - return ownerProfile_; - } - - - /** - Sets the user profile that created the entry. - @param usr The user that created the entry. - **/ - protected void setOwnerProfile(String usr) // @A1C - { - if(usr == null) - { - throw new NullPointerException("usr"); - } - if ((usr.length() == 0) || (usr.length() > 10)) - { - throw new ExtendedIllegalArgumentException("usr", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - ownerProfile_ = usr; - } - - /** - Returns the user profile that last modified the entry. - @return The user profile that last modified the entry. - **/ - public String getModifiedProfile() // @A1A - { - if (modifyProfile_ == null) - return null; - return modifyProfile_; - } - - - /** - Sets the user profile that modified the entry. - @param usr The user that modified the entry. - **/ - protected void setModifiedProfile(String usr) // @A1A - { - if(usr == null) - { - throw new NullPointerException("usr"); - } - if ((usr.length() == 0) || (usr.length() > 10)) - { - throw new ExtendedIllegalArgumentException("usr", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - modifyProfile_ = usr; - } - - - /** - Provided to initialize transient data if this object is de-serialized. - **/ - private void initializeTransient() - { - changes_ = new PropertyChangeSupport(this); - } - - - /** - Restores the state of this object from an object input stream. - @param ois The stream of state information. - @exception IOException - @exception ClassNotFoundException - **/ - private void readObject(java.io.ObjectInputStream ois) throws IOException, ClassNotFoundException - { - // Restore the non-static and non-transient fields. - ois.defaultReadObject(); - - // Initialize the transient fields. - initializeTransient(); - } - - - /** - Removes the listener from being notified when a bound property changes. - @see #addPropertyChangeListener - @param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) throw new NullPointerException("listener"); - changes_.removePropertyChangeListener(listener); - } - - - /** - Sets the entry authority. This identifies who is allowed to access, for example - update and retrieve, the entry associated with the key. This value must be ENTRY_AUTHORITY_LAST_USER if - the current cluster version is 2. - Valid values are: -
          -
        • ENTRY_AUTHORITY_LAST_USER = The user who requests the ClusteredHashTable.put(), a user with *ALLOBJ authority or both is allowed to access the entry. -
        • ENTRY_AUTHORITY_ANY_USER = Any user can access the entry. -
        - @param entryAuthority The value of the entry authority. The default for this parameter is ENTRY_AUTHORITY_LAST_USER. - **/ - public void setEntryAuthority(int entryAuthority) - { - if (entryAuthority != ENTRY_AUTHORITY_LAST_USER && entryAuthority != ENTRY_AUTHORITY_ANY_USER) - { - throw new ExtendedIllegalArgumentException("entryAuthority", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - int old = entryAuthority_; - entryAuthority_ = entryAuthority; - changes_.firePropertyChange("entryAuthority", new Integer(old), new Integer(entryAuthority_)); - } - - - /** - Sets the key. The ClusteredHashTable.generateKey() method can be used to generate the key. Clustered hash table keys must be 16 bytes. - The key must be set before invoking the ClusteredHashTable.put() method. - @param key The key. - **/ - public void setKey(byte[] key) - { - if (key == null) - { - throw new NullPointerException("key"); - } - if (key.length != 16) // a cht key must be 16 bytes - - { - throw new ExtendedIllegalArgumentException("key", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - byte[] old = key_; - key_ = new byte[key.length]; - System.arraycopy(key, 0, key_, 0, key.length); - changes_.firePropertyChange("key", old, key_); - } - - /** - Sets the entry status for the entry. Can only be ENTRY_STATUS_CONSISTENT or ENTRY_STATUS_INCONSISTENT. - ENTRY_STATUS_CONSISTENT means consistent in the Cluster Hash Table. - ENTRY_STATUS_INCONSISTENT means it is inconstistent or the entry is not the same on all nodes in the clustered hash table domain. - @param entryStatus the status of the entry. - **/ - protected void setEntryStatus(int entryStatus) - { - // status can only be ENTRY_STATUS_INCONSISTENT or ENTRY_STATUS_CONSISTENT - if((entryStatus != ENTRY_STATUS_CONSISTENT) && (entryStatus != ENTRY_STATUS_INCONSISTENT)) - { - throw new ExtendedIllegalArgumentException("entryStatus", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - entryStatus_ = entryStatus; - } - - - /** - Sets the time to live (in seconds) an entry remains in the clustered hash table. - This value must be greater than or equal to 60 seconds. The time out will be truncated to the nearest minute. If the value is -1, the entry will never expire. - @param timeToLive The value of the time to live. The default for the timeToLive is 60 seconds. - **/ - public void setTimeToLive(int timeToLive) - { - // must be at least one minute, or up to one year, -1 means infinity - if (((timeToLive != -1) && (timeToLive < 60)) || (timeToLive > 525600 * 60)) // @A1C - { - throw new ExtendedIllegalArgumentException("timeToLive", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - int old = timeToLive_; - timeToLive_ = timeToLive; - changes_.firePropertyChange("timeToLive", new Integer(old), new Integer(timeToLive_)); - } - - - /** - Sets the update option. This is the action used by ClusteredHashTable.put() when the - specified key already exists in the clustered hash table. This value must be DUPLICATE_KEY_FAIL if the - current cluster version is 2. It is only valid - for the duration of the ClusteredHashTable.put() method. Valid values are: -
          -
        • DUPLICATE_KEY_FAIL = Do not allow the ClusteredHashTable.put() to succeed if the key already exists. -
        • DUPLICATE_KEY_UPDATE = Allow the entry associated with the key to be updated if it already exists in the clustered hash table. -
        - @param updateOption The value of the update option. - **/ - public void setUpdateOption(int updateOption) - { - if (updateOption != DUPLICATE_KEY_FAIL && updateOption != DUPLICATE_KEY_UPDATE) - { - throw new ExtendedIllegalArgumentException("updateOption", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - int old = entryUpdateOption_; - entryUpdateOption_ = updateOption; - changes_.firePropertyChange("updateOption", new Integer(old), new Integer(entryUpdateOption_)); - } - - - /** - Sets the user data to be stored in the clustered hash table. The length of the data - must be 1 through MAX_USER_DATA_LENGTH. The user data must be set before - invoking the ClusteredHashTable.put() method. - @param userData The user data. - **/ - public void setUserData(byte[] userData) - { - if (userData == null) - { - throw new NullPointerException("userData"); - } - if (userData.length < 1 || userData.length > MAX_USER_DATA_LENGTH) - { - throw new ExtendedIllegalArgumentException("userData", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - byte[] old = userData_; - userData_ = new byte[userData.length]; - System.arraycopy(userData, 0, userData_, 0, userData.length); - changes_.firePropertyChange("userData", old, userData_); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ClusteredHashTableEntry16.gif b/cvsroot/src/com/ibm/as400/access/ClusteredHashTableEntry16.gif deleted file mode 100644 index b46e81060..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/ClusteredHashTableEntry16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/ClusteredHashTableEntry32.gif b/cvsroot/src/com/ibm/as400/access/ClusteredHashTableEntry32.gif deleted file mode 100644 index f47f4bf07..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/ClusteredHashTableEntry32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/ClusteredHashTableEntryBeanInfo.java b/cvsroot/src/com/ibm/as400/access/ClusteredHashTableEntryBeanInfo.java deleted file mode 100644 index 722d0d4d8..000000000 --- a/cvsroot/src/com/ibm/as400/access/ClusteredHashTableEntryBeanInfo.java +++ /dev/null @@ -1,152 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ClusteredHashTableEntryBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; - -/** - The ClusteredHashTableEntryBeanInfo class provides bean information for - the ClusteredHashTableEntry class. -**/ - -public class ClusteredHashTableEntryBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private final static Class beanClass = ClusteredHashTableEntry.class; - private static PropertyDescriptor[] properties_; - - static - { - try - { - // Define the property descriptors. - PropertyDescriptor property1 = - new PropertyDescriptor("entryAuthority", beanClass, "getEntryAuthority", "setEntryAuthority"); - property1.setBound(true); - property1.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_ENTRY_AUTHORITY")); - property1.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_ENTRY_AUTHORITY")); - - PropertyDescriptor property2 = - new PropertyDescriptor("key", beanClass, "getKey", "setKey"); - property2.setBound(true); - property2.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_KEY")); - property2.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_KEY")); - - PropertyDescriptor property3 = - new PropertyDescriptor("timeToLive", beanClass, "getTimeToLive", "setTimeToLive"); - property3.setBound(true); - property3.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_TIME_TO_LIVE")); - property3.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_TIME_TO_LIVE")); - - PropertyDescriptor property4 = - new PropertyDescriptor("updateOption", beanClass, "getUpdateOption", "setUpdateOption"); - property4.setBound(true); - property4.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_UPDATE_OPTION")); - property4.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_UPDATE_OPTION")); - - PropertyDescriptor property5 = - new PropertyDescriptor("userData", beanClass, "getUserData", "setUserData"); - property5.setBound(true); - property5.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_USER_DATA")); - property5.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_USER_DATA")); - - PropertyDescriptor[] properties = - { - property1, property2, property3, property4, property5 - }; - properties_ = properties; - - } - catch(Exception e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - /** - Returns the default event index. - @return The default event index. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the default property index. - @return The default property index. - **/ - public int getDefaultPropertyIndex() - { - return 1; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return null; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("ClusteredHashTableEntry16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("ClusteredHashTableEntry32.gif"); - break; - } - - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/Command.java b/cvsroot/src/com/ibm/as400/access/Command.java deleted file mode 100644 index 7efac1377..000000000 --- a/cvsroot/src/com/ibm/as400/access/Command.java +++ /dev/null @@ -1,1544 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Command.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// -// @A1 - 9/18/2007 - Changes to follow proxy command chain -// -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.access; - -import java.io.*; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.util.*; -import org.xml.sax.InputSource; -import javax.xml.parsers.*; -import org.xml.sax.SAXException; - -/** - * Represents information about a CL command (*CMD) object on the system. - *

        - * To actually execute a CL command, use the - * {@link com.ibm.as400.access.CommandCall CommandCall} class. - *

        - * To generate HTML help for a CL command, see the - * {@link com.ibm.as400.util.CommandHelpRetriever CommandHelpRetriever} utility. - * -**/ -public class Command implements Serializable -{ - // NOTE: This class uses the QCDRCMDD and QCDRCMDI system APIs to retrieve information about a CL command. - - static final long serialVersionUID = 6L; - - /** - * Constant indicating that the multithreaded job action used by - * the command is not to run the command, but issue an escape message instead. - * @see #getMultithreadedJobAction - **/ - public static final byte ACTION_ESCAPE_MESSAGE = (byte)0xF3; - - /** - * Constant indicating that the multithreaded job action used by - * the command is to run the command and issue an informational message. - * @see #getMultithreadedJobAction - **/ - public static final byte ACTION_INFO_MESSAGE = (byte)0xF2; - - /** - * Constant indicating that the multithreaded job action used by - * the command is to run the command and issue no messages. - * @see #getMultithreadedJobAction - **/ - public static final byte ACTION_NO_MESSAGE = (byte)0xF1; - - /** - * Constant indicating that the multithreaded job action used by - * the command is specified by the QMLTTHDACN system value. - * @see #getMultithreadedJobAction - **/ - public static final byte ACTION_SYSTEM_VALUE = (byte)0xF0; - - /** - * Constant indicating that the command is allowed to run in all environments. - * @see #isAllowedToRun - **/ - public static final int ALLOW_ALL = 7; - - /** - * Constant indicating that the command is allowed to run in a batch job (*BATCH). - * @see #isAllowedToRun - **/ - public static final int ALLOW_BATCH_JOB = 4; - - /** - * Constant indicating that the command is allowed to run in a batch program (*BPGM). - * @see #isAllowedToRun - **/ - public static final int ALLOW_BATCH_PROGRAM = 0; - - /** - * Constant indicating that the command is allowed to run in a batch REXX procedure (*BREXX). - * @see #isAllowedToRun - **/ - public static final int ALLOW_BATCH_REXX_PROCEDURE = 5; - - /** - * Constant indicating that the command is allowed to run using QCMDEXC, QCAEXEC, or QCAPCMD (*EXEC). - * @see #isAllowedToRun - **/ - public static final int ALLOW_EXEC = 2; - - /** - * Constant indicating that the command is allowed to run in an interactive job (*INTERACT). - * @see #isAllowedToRun - **/ - public static final int ALLOW_INTERACTIVE_JOB = 3; - - /** - * Constant indicating that the command is allowed to run in an interactive program (*IPGM). - * @see #isAllowedToRun - **/ - public static final int ALLOW_INTERACTIVE_PROGRAM = 1; - - /** - * Constant indicating that the command is allowed to run in an interactive REXX procedure (*IREXX). - * @see #isAllowedToRun - **/ - public static final int ALLOW_INTERACTIVE_REXX_PROCEDURE = 6; - - /** - * Constant indicating that the command will run in all modes. - * @see #isOperatingMode - **/ - public static final int MODE_ALL = 13; - - /** - * Constant indicating that the command will run in debug mode of the operating environment. - * @see #isOperatingMode - **/ - public static final int MODE_DEBUG = 11; - - /** - * Constant indicating that the command will run in production mode of the operating environment. - * @see #isOperatingMode - **/ - public static final int MODE_PRODUCTION = 10; - - /** - * Constant indicating that the command will run in service mode of the operating environment. - * @see #isOperatingMode - **/ - public static final int MODE_SERVICE = 12; - - /** - * Constant indicating that a program is called from system state. - * @see #USER_STATE - **/ - public static final String SYSTEM_STATE = "*S"; - - /** - * Constant indicating that the command is threadsafe under certain conditions. See the API documentation - * for the command to determine the conditions for threadsafety. - * @see #THREADSAFE_NO - * @see #THREADSAFE_YES - * @see #getThreadSafety - **/ - public static final byte THREADSAFE_CONDITIONAL = (byte)0xF2; - - /** - * Constant indicating that the command is not threadsafe. - * @see #THREADSAFE_CONDITIONAL - * @see #THREADSAFE_YES - * @see #getThreadSafety - **/ - public static final byte THREADSAFE_NO = (byte)0xF0; - - /** - * Constant indicating that the command is threadsafe. - * @see #THREADSAFE_CONDITIONAL - * @see #THREADSAFE_NO - * @see #getThreadSafety - **/ - public static final byte THREADSAFE_YES = (byte)0xF1; - - /** - * Constant indicating that a program is called from user state. - * @see #SYSTEM_STATE - **/ - public static final String USER_STATE = "*U"; - - - private static final ProgramParameter errorCode_ = new ProgramParameter(new byte[4]); - - private AS400 system_; - private String path_; - - private String commandProcessingProgram_; - private String sourceFile_; - private String validityCheckProgram_; - private String mode_; - private String whereAllowedToRun_; - private boolean allowLimitedUser_; - private int maxPosParms_; - private String promptMessageFile_; - private String messageFile_; - private String helpPanelGroup_; - private String helpIdentifier_; - private String searchIndex_; - private String currentLibrary_; - private String productLibrary_; - private String promptOverrideProgram_; - private String restricted_; - private String description_; - private String cppState_; - private String vcState_; - private String poState_; - private int ccsid_; - private boolean guiEnabled_; - private byte threadsafe_; - private byte multithreadedJobAction_; - - private String xml_; - private String xml2_; - private transient PanelGroupHelpIdentifier[] helpIDs_; - private String xmlProductLibrary_; - private String xmlPanelGroup_; - private String xmlHelpText_; - - private boolean refreshed_ = false; - private boolean refreshedXML_ = false; - private boolean refreshedXML2_ = false; - private boolean refreshedHelpIDs_ = false; - private boolean refreshedHelpText_ = false; - private boolean refreshedParsedXML_ = false; - private boolean loadedDescription_ = false; - private boolean detectedMissingPTF_ = false; // V5R4 system is missing PTF SI29629 (5722SS1) - - - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_; - - - /** - * Constructs a Command object. The system and command path must be set - * before this object can be used. - * @see #setPath - * @see #setSystem - **/ - public Command() - { -// initializeTransient(); - } - - - /** - * Constructs a Command object. - * @param system The system on which the command resides. - * @param path The fully qualified integrated file system path of the command, - * e.g. "/QSYS.LIB/CRTUSRPRF.CMD". - * @see com.ibm.as400.access.QSYSObjectPathName - **/ - public Command(AS400 system, String path) - { - if (system == null) - throw new NullPointerException("system"); - - if (path == null) - throw new NullPointerException("path"); - - QSYSObjectPathName.validatePath(path, "CMD"); - - system_ = system; - path_ = path; - -// initializeTransient(); - } - - /** - * Called from CommandList. - **/ - Command(AS400 system, String path, String description) - { - system_ = system; - path_ = path; - description_ = description; - loadedDescription_ = true; - } - - - /** - * Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method will be called each time the value of any bound property is changed. - * The PropertyChangeListener object is added to a list of PropertyChangeListeners managed by this Command. It can be removed with removePropertyChangeListener. - * - * @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - synchronized(this) - { - if (propertyChangeListeners_ == null) propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - - - /** - * Indicates whether or not a user with limited authorities is allowed to run this command. - * @return true if a limited user is allowed to run this command; false otherwise. - **/ - public boolean allowsLimitedUser() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return allowLimitedUser_; - } - - /** - * Returns the coded character set ID (CCSID) associated with this command. - * It is the value of the job CCSID when this command was created. - * @return The CCSID of the command. - **/ - public int getCCSID() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return ccsid_; - } - - /** - * Returns the fully qualified integrated file system path of the program - * that accepts parameters from this command processes this command. - * @return The command processing program name, or *REXX if the command processing - * program is a REXX procedure. - **/ - public String getCommandProcessingProgram() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return commandProcessingProgram_; - } - - /** - * Returns the state from which the command processing program is called. - * Possible values are: - *

          - *
        • {@link #SYSTEM_STATE SYSTEM_STATE} - The command processing program is called from system state. - *
        • {@link #USER_STATE USER_STATE} - The command processing program is called from user state. - *
        - * @return The state. - **/ - public String getCommandProcessingState() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return cppState_; - } - - /** - * Returns the library used as the current library during the processing of this - * command. Special values include: - *
          - *
        • *NOCHG - The current library does not change for the processing of this command. - * If the current library is changed during the procesing of the command, the change - * remains in effect after command processing is complete. - *
        • *CRTDFT - No current library is active during processing of the command. The - * current library that was active before command processing began is restored when - * processing is complete. - *
        - * @return The current library name. - **/ - public String getCurrentLibrary() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return currentLibrary_; - } - - /** - * Returns the user text used to briefly describe this command and its function. - * @return The text description, or "" if there is none. - **/ - public String getDescription() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_ && !loadedDescription_) - refreshCommandInfo(); - - return description_; - } - - /** - * Returns the name of the general help module for the names of the help - * identifiers for this command. Special values include: - *
          - *
        • *NONE - No help identifier is specified. - *
        • *CMD - The name of the command is used. - *
        - * @return The help identifier. - **/ - public String getHelpIdentifier() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return helpIdentifier_; - } - - /** - * Returns the fully integrated file system path of the help panel group in which - * the online help information exists for this command. - * @return The help panel group, or null if no help panel group is defined - * for this command. - **/ - public PanelGroup getHelpPanelGroup() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - if (helpPanelGroup_.equals("*NONE")) return null; - return new PanelGroup(system_, helpPanelGroup_); - } - - /** - * Returns the fully qualified integrated file system path of the help search index - * used for this command. - * @return The search index name, or *NONE if no help search index is specified. - **/ - public String getHelpSearchIndex() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return searchIndex_; - } - - /** - * Returns the maximum number of parameters that can be coded in a positional - * manner for this command. - * @return The number of parameters, or -1 if there is no maximum positional coding - * limit specified for this command. - **/ - public int getMaximumPositionalParameters() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return maxPosParms_; - } - - /** - * Returns a MessageFile object representing the message file - * from which messages identified on the DEP statements used to define the command - * are retrieved. - * @return The message file. - **/ - public MessageFile getMessageFile() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return new MessageFile(system_, messageFile_); - } - - /** - * Returns the action taken when a command that is not threadsafe is called in - * a multithreaded job. Possible values are: - *
          - *
        • {@link #ACTION_SYSTEM_VALUE ACTION_SYSTEM_VALUE} - Use the action specified - * in the QMLTTHDACN system value. - *
        • {@link #ACTION_NO_MESSAGE ACTION_NO_MESSAGE} - Run the command. Do not - * send a message. - *
        • {@link #ACTION_INFO_MESSAGE ACTION_INFO_MESSAGE} - Send an informational - * message and run the command. - *
        • {@link #ACTION_ESCAPE_MESSAGE ACTION_ESCAPE_MESSAGE} - Send an escape - * message and do not run the command. - *
        - * If the threadsafe indicator is either {@link #THREADSAFE_YES THREADSAFE_YES} - * or {@link #THREADSAFE_CONDITIONAL THREADSAFE_CONDITIONAL}, - * then the multithreaded job action will be returned as {@link #ACTION_NO_MESSAGE ACTION_NO_MESSAGE}. - * @return The multithreaded job action for this command. - * @see #getThreadSafety - **/ - public byte getMultithreadedJobAction() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return multithreadedJobAction_; - } - - - /** - * Returns the path name of this Command object. - * @return The path name, or null if the path is not set. - * @see #setPath - **/ - public String getPath() - { - return path_; - } - - - /** - * Returns the library that is in effect during the processing of the command. - * Special values include: - *
          - *
        • *NOCHG - The product library does not change for the processing of this command. - *
        • *NONE - There is no product library in the job's library list. - *
        - * @return The product library name. - **/ - public String getProductLibrary() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return productLibrary_; - } - - /** - * Returns a MessageFile object representing the message file - * that contains the prompt text for this command. - * @return The message file, or null if no message file was specified for - * the prompt text. - **/ - public MessageFile getPromptMessageFile() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - if (promptMessageFile_ != null) - return new MessageFile(system_, promptMessageFile_); - - return null; - } - - /** - * Returns the fully qualified integrated file system path of the program - * that replaces default values on the prompt display with the current - * actual values for the parameter. - * @return The prompt override program name, or *NONE if no prompt override - * program was specified for this command. - **/ - public String getPromptOverrideProgram() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return promptOverrideProgram_; - } - - /** - * Returns the state from which the prompt override program is called. - * Possible values are: - *
          - *
        • {@link #SYSTEM_STATE SYSTEM_STATE} - The prompt override program is called from system state. - *
        • {@link #USER_STATE USER_STATE} - The prompt override program is called from user state. - *
        - * @return The state. - **/ - public String getPromptOverrideState() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return poState_; - } - - /** - * Returns the version, release, and modification level to which this command is - * restricted. If this field is blank, the command can be used in the current release. - * This applies only to a command used in a CL program. It must match the contents of - * the target release parameter on the Create CL Program (CRTCLPGM) command. - * @return The release in the format "VxRxMx", or "" if the command can be used in - * the current release. - * @see com.ibm.as400.access.AS400#getVRM - **/ - public String getRestrictedRelease() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return restricted_; - } - - /** - * Returns the fully qualified integrated file system path of the - * source file member that contains the command definition statements - * used to create this command. - * @return The source file name, or null if the source file is not known. - **/ - public String getSourceFile() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return sourceFile_; - } - - - /** - * Returns the system object for this command. - * @return The system, or null if the system is not set. - **/ - public AS400 getSystem() - { - return system_; - } - - - /** - * Returns the type of threadsafety for this command; that is, whether or not this command - * can be used safely in a multithreaded job. - * Possible values are: - *
          - *
        • {@link #THREADSAFE_NO THREADSAFE_NO} - This command is not threadsafe and should not be - * used in a multithreaded job. The value for the multithreaded job action defines the action - * to be taken by the command analyzer when the command is used in a multithreaded job. - *
        • {@link #THREADSAFE_YES THREADSAFE_YES} - This command is threadsafe and can be used - * safely in a multithreaded job. - *
        • {@link #THREADSAFE_CONDITIONAL THREADSAFE_CONDITIONAL} - This command is threadsafe - * under certain conditions. See the documentation for the command to determine the conditions - * under which the command can be used safely in a multithreaded job. - *
        - * @return The threadsafety indicator for this command. - * @see #getMultithreadedJobAction - **/ - public byte getThreadSafety() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return threadsafe_; - } - - /** - * Returns the fully qualified integrated file system path of the program - * that performs additional user-defined validity checking on the parameters - * for this command. - * @return The validity check program name, or *NONE if no separate user-defined - * validity checking is done for this command. - **/ - public String getValidityCheckProgram() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return validityCheckProgram_; - } - - /** - * Returns the state from which the validity check program is called. - * Possible values are: - *
          - *
        • {@link #SYSTEM_STATE SYSTEM_STATE} - The validity check program is called from system state. - *
        • {@link #USER_STATE USER_STATE} - The validity check program is called from user state. - *
        - * @return The state. - **/ - public String getValidityCheckState() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return vcState_; - } - - /** - * Returns the API string for the "where allowed to run" field. - * This method is externalized for those classes that need the entire - * field. Simpler access to this data can be achieved by using the - * following methods: - *
          - *
        • {@link #isAllowedToRun isAllowedToRun(mode)} - *
        • {@link #isAllowedToRunBatch isAllowedToRunBatch} - *
        • {@link #isAllowedToRunInteractive isAllowedToRunInteractive} - *
        - * @return The "where allowed to run" field. - **/ - public String getWhereAllowedToRun() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) refreshCommandInfo(); - - return whereAllowedToRun_; - } - - - /** - * Retrieves the XML source for this CL command. - * @return The XML describing this command. - **/ - public String getXML() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshedXML_) - refreshXML(true); - - return xml_; - } - - /** - * Retrieves the extended XML source for this CL command. This returns more - * information than {@link #getXML getXML()}. - *

        - * Note: This method uses the CMDD0200 format on the QCDRCMDD API. - * If the system does not support this format, an AS400Exception will be - * thrown with a message ID of CPF3C21, and you should use the getXML() method instead. - * @return The XML describing this command. - * @see #getXML - **/ - public String getXMLExtended() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshedXML2_) - refreshXML(false); - - return xml2_; - } - - /** - * Parses the XML source for this CL command and returns - * the help identifiers. - * @return The help identifiers, or null if no panel group was found in the XML source. - **/ - public PanelGroupHelpIdentifier[] getXMLHelpIdentifiers() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException, SAXException, ParserConfigurationException - { - if (!refreshedHelpIDs_) - refreshHelpIDs(); - return helpIDs_; - } - - /** - * Parses the XML source for this CL command and returns - * the product library. - * @return The product library, or null if no panel group was found in the XML source. - **/ - public String getXMLProductLibrary() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException, SAXException, ParserConfigurationException - { - if (!refreshedParsedXML_) - refreshParsedXML(); - return xmlProductLibrary_; - } - - /** - * Parses the XML source for this CL command and returns - * the name of the panel group. - * @return The panel group, or null if no panel group was found in the XML source. - **/ - public String getXMLPanelGroup() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException, SAXException, ParserConfigurationException - { - if (!refreshedParsedXML_) - refreshParsedXML(); - return xmlPanelGroup_; - } - - /** - * Parses the XML source for this CL command and returns - * the help text. - * @return The help text, or null if no panel group was found in the XML source. - **/ - public String getXMLHelpText() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException, SAXException, ParserConfigurationException - { - if (!refreshedHelpText_) - refreshHelpText(null); - return xmlHelpText_; - } - - /** - * Parses the XML source for this CL command and returns - * the help text. The XML help text generated by this method is not cached like - * the text generated by {@link #getXMLHelpText getXMLHelpText()}. - * @param panelGroup The panel group used to generate the help text, instead of the Command's defined panel group. - * @return The help text. - * @see #getXMLPanelGroup - **/ - public synchronized String getXMLHelpText(PanelGroup panelGroup) throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException, SAXException, ParserConfigurationException - { - if (panelGroup == null) throw new NullPointerException("panelGroup"); - // Don't preserve this one. - String oldText = xmlHelpText_; - refreshHelpText(panelGroup); - String newText = xmlHelpText_; - xmlHelpText_ = oldText; - return newText; - } - - private synchronized void refreshHelpText(PanelGroup pg) throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException, SAXException, ParserConfigurationException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Command.refreshHelpText("+pg+")."); - xmlHelpText_ = null; - String pGroup = (pg == null ? getXMLPanelGroup() : pg.getPath()); - String prdLib = getXMLProductLibrary(); - boolean added = false; - if (pGroup != null) - { - if (prdLib != null) - { - prdLib = prdLib.trim().toUpperCase(); - // Add the product library to the library list - // otherwise the API used by PanelGroup won't find the help text. - // First, check to see if it's there. - Job job = new Job(system_); // Current job - String[] userLibraries = job.getUserLibraryList(); - String[] sysLibraries = job.getSystemLibraryList(); - String curLibrary = job.getCurrentLibrary(); - boolean exists = false; - if (curLibrary.trim().equalsIgnoreCase(prdLib)) - { - exists = true; - } - for (int i=0; i - *

      • {@link #ALLOW_BATCH_PROGRAM ALLOW_BATCH_PROGRAM} - *
      • {@link #ALLOW_INTERACTIVE_PROGRAM ALLOW_INTERACTIVE_PROGRAM} - *
      • {@link #ALLOW_EXEC ALLOW_EXEC} - *
      • {@link #ALLOW_INTERACTIVE_JOB ALLOW_INTERACTIVE_JOB} - *
      • {@link #ALLOW_BATCH_JOB ALLOW_BATCH_JOB} - *
      • {@link #ALLOW_BATCH_REXX_PROCEDURE ALLOW_BATCH_REXX_PROCEDURE} - *
      • {@link #ALLOW_INTERACTIVE_REXX_PROCEDURE ALLOW_INTERACTIVE_REXX_PROCEDURE} - *
      • {@link #ALLOW_ALL ALLOW_ALL} - *
      - * @return true if this command is allowed to run in the specified environment; false otherwise. - **/ - public boolean isAllowedToRun(int environment) throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - switch (environment) - { - case ALLOW_BATCH_PROGRAM: - return whereAllowedToRun_.charAt(0) == '1'; - case ALLOW_INTERACTIVE_PROGRAM: - return whereAllowedToRun_.charAt(1) == '1'; - case ALLOW_EXEC: - return whereAllowedToRun_.charAt(2) == '1'; - case ALLOW_INTERACTIVE_JOB: - return whereAllowedToRun_.charAt(3) == '1'; - case ALLOW_BATCH_JOB: - return whereAllowedToRun_.charAt(4) == '1'; - case ALLOW_BATCH_REXX_PROCEDURE: - return whereAllowedToRun_.charAt(5) == '1'; - case ALLOW_INTERACTIVE_REXX_PROCEDURE: - return whereAllowedToRun_.charAt(6) == '1'; - case ALLOW_ALL: - return whereAllowedToRun_.startsWith("1111111"); - default: - break; - } - throw new ExtendedIllegalArgumentException("environment", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - - /** - * Indicates whether or not this command is allowed to run in one or more - * of the batch environments: - *
        - *
      • {@link #ALLOW_BATCH_PROGRAM ALLOW_BATCH_PROGRAM} - *
      • {@link #ALLOW_BATCH_JOB ALLOW_BATCH_JOB} - *
      • {@link #ALLOW_BATCH_REXX_PROCEDURE ALLOW_BATCH_REXX_PROCEDURE} - *
      - * @return true if this command is allowed to run in one or more of the batch environments; false otherwise. - * @see #isAllowedToRun - **/ - public boolean isAllowedToRunBatch() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return whereAllowedToRun_.charAt(0) == '1' || - whereAllowedToRun_.charAt(4) == '1' || - whereAllowedToRun_.charAt(5) == '1'; - } - - /** - * Indicates whether or not this command is allowed to run in one or more - * of the interactive environments: - *
        - *
      • {@link #ALLOW_INTERACTIVE_PROGRAM ALLOW_INTERACTIVE_PROGRAM} - *
      • {@link #ALLOW_INTERACTIVE_JOB ALLOW_INTERACTIVE_JOB} - *
      • {@link #ALLOW_INTERACTIVE_REXX_PROCEDURE ALLOW_INTERACTIVE_REXX_PROCEDURE} - *
      - * @return true if this command is allowed to run in one or more of the interactive environments; false otherwise. - * @see #isAllowedToRun - **/ - public boolean isAllowedToRunInteractive() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return whereAllowedToRun_.charAt(1) == '1' || - whereAllowedToRun_.charAt(3) == '1' || - whereAllowedToRun_.charAt(6) == '1'; - } - - /** - * Indicates whether or not the command prompt panels are enabled for conversion - * to a graphical user interface. - * @return true if the command prompt panels are enabled for conversion to a - * graphical user interface by including information about the panel content in - * the 5250 data stream; false otherwise. - **/ - public boolean isEnabledForGUI() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - return guiEnabled_; - } - - - /** - * Indicates if this command applies to the specified mode of operating environment. - * @param mode The operating mode to check. Possible values are: - *
        - *
      • {@link #MODE_PRODUCTION MODE_PRODUCTION} - Production mode. - *
      • {@link #MODE_DEBUG MODE_DEBUG} - Debug mode. - *
      • {@link #MODE_SERVICE MODE_SERVICE} - Service mode. - *
      • {@link #MODE_ALL MODE_ALL} - All of the above modes. - *
      - * @return true if this command applies to the specified operating mode; false otherwise. - **/ - public boolean isOperatingMode(int mode) throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (!refreshed_) - refreshCommandInfo(); - - switch (mode) - { - case MODE_PRODUCTION: - return mode_.charAt(0) == '1'; - case MODE_DEBUG: - return mode_.charAt(1) == '1'; - case MODE_SERVICE: - return mode_.charAt(2) == '1'; - case MODE_ALL: - return mode_.startsWith("111"); - default: - break; - } - throw new ExtendedIllegalArgumentException("mode", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - - // Called when this object is de-serialized - private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException - { - in.defaultReadObject(); -// initializeTransient(); - } - - - /** - * Refreshes the information for this Command object. - * This method is used to perform the call to the system - * that retrieves the command information, XML, and help ID information for this CL command. - * That information is cached internally until this method is called again. Note that - * this method does not currently refresh the extended XML information provided by - * the {@link #getXMLExtended getXMLExtended()} method. - *

      - * The necessary information is implicitly refreshed by the various getter methods. - * The system and path must be set before refresh() is called. - * @see #setPath - * @see #setSystem - **/ - public synchronized void refresh() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException, SAXException, ParserConfigurationException - { - refreshCommandInfo(); - refreshXML(true); // Refresh just the CMDD0100 format for now, since the 0200 format is new. - refreshParsedXML(); - refreshHelpIDs(); - } - - - // Worker method. - private synchronized void refreshCommandInfo() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Refreshing command information for "+path_+"."); - if (system_ == null) throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - if (path_ == null) throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - // Call the QCDRCMDI API to get all of the information. - int vrm = system_.getVRM(); // @A1A - int numParms; - if ((vrm >= 0x00060100) || - (vrm >= 0x00050400 && !detectedMissingPTF_)) { - numParms = 6; // @A1C - added support for proxy commands - } - else numParms = 5; - - ProgramParameter[] parms = new ProgramParameter[numParms]; - parms[0] = new ProgramParameter(335); // receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(335)); // length of receiver variable - parms[2] = new ProgramParameter(CharConverter.stringToByteArray(37, system_, "CMDI0100")); // format name - byte[] cmdBytes = new byte[20]; - AS400Text text10 = new AS400Text(10, system_.getCcsid()); - QSYSObjectPathName p = new QSYSObjectPathName(path_); - String command = p.getObjectName(); - String library = p.getLibraryName(); - text10.toBytes(command, cmdBytes, 0); - text10.toBytes(library, cmdBytes, 10); - parms[3] = new ProgramParameter(cmdBytes); // qualified command name - parms[4] = errorCode_; - - // @A1A - Add support for proxy commands - if (numParms > 5) // @A1A - parms[5] = new ProgramParameter(new byte[] { (byte) 0xF1 }); // @A1A Follow proxy chain, input CHAR(1) - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QCDRCMDI.PGM", parms); - // Note: This is a threadsafe API. However, on some code paths we may have called ADDLIBLE before getting here. Therefore we must be careful to stay in the same thread in which ADDLIBLE executed. - - boolean succeeded = pc.run(); - if (!succeeded) - { - // If the exception is "MCH0802: Total parameters passed does not match number required" and we're running to V5R4, that means that the user hasn't applied PTF SI29629. In that case, we will re-issue the program call, minus the new "follow proxy chain" parameter. - AS400Message[] msgList = pc.getMessageList(); - if (numParms > 5 && - vrm < 0x00060100 && vrm >= 0x00050400 && // system VRM is V5R4 - msgList[msgList.length - 1].getID().equals("MCH0802")) // wrong number of parms - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "PTF SI29629 is not installed: (MCH0802) " + msgList[msgList.length - 1].getText()); - detectedMissingPTF_ = true; // remember that the PTF is missing - ProgramParameter[] shorterParmList = new ProgramParameter[5]; - System.arraycopy(parms, 0, shorterParmList, 0, 5); - try { pc.setParameterList(shorterParmList); } catch (PropertyVetoException e) {} - succeeded = pc.run(); - } - if (!succeeded) throw new AS400Exception(pc.getMessageList()); - } - - byte[] outputData = parms[0].getOutputData(); - CharConverter conv = new CharConverter(system_.getCcsid()); - - String cppName = conv.byteArrayToString(outputData, 18, 10).trim(); - if (cppName.equals("*REXX")) - { - commandProcessingProgram_ = cppName; - } - else - { - String cppLib = conv.byteArrayToString(outputData, 28, 10).trim(); - commandProcessingProgram_ = QSYSObjectPathName.toPath(cppLib, cppName, "PGM"); - } - - String srcName = conv.byteArrayToString(outputData, 48, 10).trim(); - String srcLib = conv.byteArrayToString(outputData, 58, 10).trim(); - String srcMbr = conv.byteArrayToString(outputData, 68, 10).trim(); - try - { - sourceFile_ = QSYSObjectPathName.toPath(srcLib, srcName, srcMbr, "MBR"); - } - catch(ExtendedIllegalArgumentException eiae) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Unable to process source file: '"+srcName+","+srcLib+","+srcMbr+"'.", eiae); - sourceFile_ = null; - } - - String vldName = conv.byteArrayToString(outputData, 78, 10).trim(); - if (vldName.equals("*NONE")) - { - validityCheckProgram_ = vldName; - } - else - { - String vldLib = conv.byteArrayToString(outputData, 88, 10).trim(); - validityCheckProgram_ = QSYSObjectPathName.toPath(vldLib, vldName, "PGM"); - } - - mode_ = conv.byteArrayToString(outputData, 98, 10); // Don't trim! - - whereAllowedToRun_ = conv.byteArrayToString(outputData, 108, 15); // Don't trim! - - allowLimitedUser_ = outputData[123] == (byte)0xF1; // '1' for *YES, '0' for *NO - - maxPosParms_ = BinaryConverter.byteArrayToInt(outputData, 124); - - String promptName = conv.byteArrayToString(outputData, 128, 10).trim(); - if (promptName.equals("*NONE")) - { - promptMessageFile_ = null; - } - else - { - String promptLib = conv.byteArrayToString(outputData, 138, 10).trim(); - promptMessageFile_ = QSYSObjectPathName.toPath(promptLib, promptName, "MSGF"); - } - - String msgName = conv.byteArrayToString(outputData, 148, 10).trim(); - String msgLib = conv.byteArrayToString(outputData, 158, 10).trim(); - messageFile_ = QSYSObjectPathName.toPath(msgLib, msgName, "MSGF"); - - String helpName = conv.byteArrayToString(outputData, 168, 10).trim(); - if (helpName.equals("*NONE")) - { - helpPanelGroup_ = helpName; - } - else - { - String helpLib = conv.byteArrayToString(outputData, 178, 10).trim(); - helpPanelGroup_ = QSYSObjectPathName.toPath(helpLib, helpName, "PNLGRP"); - } - - helpIdentifier_ = conv.byteArrayToString(outputData, 188, 10).trim(); - - String searchName = conv.byteArrayToString(outputData, 198, 10).trim(); - if (searchName.equals("*NONE")) - { - searchIndex_ = searchName; - } - else - { - String searchLib = conv.byteArrayToString(outputData, 208, 10).trim(); - searchIndex_ = QSYSObjectPathName.toPath(searchLib, searchName, "SCHIDX"); - } - - currentLibrary_ = conv.byteArrayToString(outputData, 218, 10).trim(); - - productLibrary_ = conv.byteArrayToString(outputData, 228, 10).trim(); - - String pOverName = conv.byteArrayToString(outputData, 238, 10).trim(); - if (pOverName.equals("*NONE")) - { - promptOverrideProgram_ = pOverName; - } - else - { - String pOverLib = conv.byteArrayToString(outputData, 248, 10).trim(); - promptOverrideProgram_ = QSYSObjectPathName.toPath(pOverLib, pOverName, "PGM"); - } - - restricted_ = conv.byteArrayToString(outputData, 258, 6).trim(); - - description_ = conv.byteArrayToString(outputData, 264, 50).trim(); - - cppState_ = conv.byteArrayToString(outputData, 314, 2); - - vcState_ = conv.byteArrayToString(outputData, 316, 2); - - poState_ = conv.byteArrayToString(outputData, 318, 2); - - // Skipping bookshelf information - - ccsid_ = BinaryConverter.byteArrayToInt(outputData, 328); - - guiEnabled_ = outputData[332] == (byte)0xF1; // '1' means the command includes info about the panel content in the 5250 datastream - - threadsafe_ = outputData[333]; // '1' means it is threadsafe, '2' means threadsafe-conditional - - multithreadedJobAction_ = outputData[334]; - - refreshed_ = true; - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Successfully refreshed command information for "+path_+"."); - } - - - // Worker method. - private synchronized void refreshXML(boolean f) throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - String format = f ? "CMDD0100" : "CMDD0200"; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Refreshing XML (format "+format+") information for "+path_+"."); - if (system_ == null) throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - if (path_ == null) throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - ProgramParameter[] parms = new ProgramParameter[6]; - byte[] cmdBytes = new byte[20]; - AS400Text text10 = new AS400Text(10, system_.getCcsid()); - QSYSObjectPathName p = new QSYSObjectPathName(path_); - String command = p.getObjectName().trim().toUpperCase(); - String library = p.getLibraryName().trim().toUpperCase(); - text10.toBytes(command, cmdBytes, 0); - text10.toBytes(library, cmdBytes, 10); - - // Make 2 program calls. The first call tells us how much - // data is coming back. The second call actually retrieves the data. - // Since a large amount of data can be returned, and the size is so - // variable depending on the command, we do not send up an initial - // guess size on the first attempt, just enough to get the real amount back. - parms[0] = new ProgramParameter(cmdBytes); // qualified command name - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(8)); // destination, AKA length of receiver variable - parms[2] = new ProgramParameter(CharConverter.stringToByteArray(37, system_, "DEST0100")); // destination format name - parms[3] = new ProgramParameter(8); // receiver variable - parms[4] = new ProgramParameter(CharConverter.stringToByteArray(37, system_, format)); // receiver format name - parms[5] = errorCode_; - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QCDRCMDD.PGM", parms); // this is a threadsafe API - // Note: This is a threadsafe API. However, on some code paths we may have called ADDLIBLE before getting here. Therefore we must be careful to stay in the same thread in which ADDLIBLE executed. - - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - - byte[] outputData = parms[3].getOutputData(); - int bytesReturned = BinaryConverter.byteArrayToInt(outputData, 0); - int bytesAvailable = BinaryConverter.byteArrayToInt(outputData, 4); - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(bytesAvailable+8)); - try - { - parms[3].setOutputDataLength(bytesAvailable+8); - } - catch (java.beans.PropertyVetoException pve) - { - } - - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - - outputData = parms[3].getOutputData(); - bytesReturned = BinaryConverter.byteArrayToInt(outputData, 0); - //bytesAvailable = BinaryConverter.byteArrayToInt(outputData, 4); - ConvTable conv1208 = ConvTable.getTable(1208, null); // CCSID 1208 is UTF-8 - if (f) - { - xml_ = conv1208.byteArrayToString(outputData, 8, bytesReturned, 0); - refreshedXML_ = true; - } - else - { - xml2_ = conv1208.byteArrayToString(outputData, 8, bytesReturned, 0); - refreshedXML2_ = true; - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Successfully refreshed XML (format "+format+") information for "+path_+"."); - } - - - /** - * Removes the PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done. - * - * @param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - if (propertyChangeListeners_ != null) propertyChangeListeners_.removePropertyChangeListener(listener); - } - - - /** - * Sets the path name of the command. - * @param path The command path, e.g. "/QSYS.LIB/CRTUSRPRF.CMD". - * @see #getPath - **/ - public void setPath(String path) - { - if (path == null) throw new NullPointerException("path"); - - QSYSObjectPathName.validatePath(path, "CMD"); - - synchronized(this) - { - String old = path_; - path_ = path; - - // In case you want to switch commands on-the-fly. - refreshed_ = false; - refreshedXML_ = false; - refreshedXML2_ = false; - refreshedHelpIDs_ = false; - refreshedHelpText_ = false; - refreshedParsedXML_ = false; - loadedDescription_ = false; - - if (propertyChangeListeners_ != null) propertyChangeListeners_.firePropertyChange("path", old, path); - } - } - - /** - * Sets the system from which to retrieve the command list. - * - * @param system The system from which to retrieve the commands. - * @see #getSystem - **/ - public void setSystem(AS400 system) - { - if (system == null) throw new NullPointerException("system"); - - synchronized(this) - { - AS400 old = system_; - system_ = system; - - refreshed_ = false; - refreshedXML_ = false; - refreshedXML2_ = false; - refreshedHelpIDs_ = false; - refreshedHelpText_ = false; - refreshedParsedXML_ = false; - loadedDescription_ = false; - - if (propertyChangeListeners_ != null) propertyChangeListeners_.firePropertyChange("system", old, system); - } - } - - - /** - * Returns a String representation of this Command. - * @return The string, which includes the fully integrated file system - * path name of this command. - **/ - public String toString() - { - return super.toString()+"["+path_+"]"; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/Command16.gif b/cvsroot/src/com/ibm/as400/access/Command16.gif deleted file mode 100644 index 2da037a2f..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/Command16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/Command32.gif b/cvsroot/src/com/ibm/as400/access/Command32.gif deleted file mode 100644 index 15106345e..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/Command32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/CommandBeanInfo.java b/cvsroot/src/com/ibm/as400/access/CommandBeanInfo.java deleted file mode 100644 index eef345743..000000000 --- a/cvsroot/src/com/ibm/as400/access/CommandBeanInfo.java +++ /dev/null @@ -1,136 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CommandBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - - -/** - The CommandBeanInfo class provides bean information for the Command class. - **/ -public class CommandBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2002 International Business Machines Corporation and others."; - - // Class this bean info represents. - private static final Class BEAN_CLASS = Command.class; - - private static EventSetDescriptor[] eventSetDescriptors_; - private static PropertyDescriptor[] propertyDescriptors_; - - static - { - try - { - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - eventSetDescriptors_ = new EventSetDescriptor[] { propertyChange }; - - PropertyDescriptor path = new PropertyDescriptor("path", BEAN_CLASS); - path.setBound(true); - path.setConstrained(false); - path.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_PATH")); - path.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_PATH")); - - PropertyDescriptor system = new PropertyDescriptor("system", BEAN_CLASS); - system.setBound(true); - system.setConstrained(false); - system.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - - propertyDescriptors_ = new PropertyDescriptor[] { path, system }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return Zero (0), the index to the property change event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return Zero (0), the index to the path property. - **/ - public int getDefaultPropertyIndex() - { - // The index for the "path" property. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors_; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors_; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("Command16.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("Command32.gif"); - } - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/CommandCall.java b/cvsroot/src/com/ibm/as400/access/CommandCall.java deleted file mode 100644 index 4d8b13dd1..000000000 --- a/cvsroot/src/com/ibm/as400/access/CommandCall.java +++ /dev/null @@ -1,1001 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CommandCall.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.StringTokenizer; -import java.util.Vector; - -import com.ibm.as400.resource.RJob; // Remove when getJob() is removed. - -/** - Represents an IBM i command object. This class allows the user to call any non-interactive CL command. - Results of the command are returned in a message list. -

      Note: CommandCall is not designed to return interactive (screen-oriented) results, such as from - "WRK..." and "DSP..." commands. The recommended approach in such cases is to identify an equivalent - IBM i API or program, and use {@link ProgramCall ProgramCall} instead. -

      The following example demonstrates the use of CommandCall: -
      -

      - *    // Work with commands on system named "Hal."
      - *    AS400 system = new AS400("Hal");
      - *    CommandCall command = new CommandCall(system);
      - *    try
      - *    {
      - *        // Run the command "CRTLIB FRED."
      - *        if (command.run("CRTLIB FRED") != true)
      - *        {
      - *            // Note that there was an error.
      - *            System.out.println("Command failed!");
      - *        }
      - *        // Show the messages (returned whether or not there was an error.)
      - *        AS400Message[] messagelist = command.getMessageList();
      - *        for (int i = 0; i < messagelist.length; ++i)
      - *        {
      - *            // Show each message.
      - *            System.out.println(messagelist[i].getText());
      - *        }
      - *    }
      - *    catch (Exception e)
      - *    {
      - *        System.out.println("Command " + command.getCommand() + " issued an exception!");
      - *        e.printStackTrace();
      - *    }
      - *    // Done with the system.
      - *    system.disconnectService(AS400.COMMAND);
      - 
      -

      NOTE: When getting the message list from commands, users no longer have to create a - MessageFile to obtain the message help text. - The load() method can be used to retrieve additional message information. - Then the getHelp() method can be called directly on the AS400Message - object returned from getMessageList(). Here is an example: -

      - *    if (command.run("myCmd") != true)
      - *    {
      - *        // Show messages.
      - *        AS400Message[] messageList = command.getMessageList();
      - *        for (int i = 0; i < messageList.length; ++i)
      - *        {
      - *            // Show each message.
      - *            System.out.println(messageList[i].getText());
      - *            // Load additional message information.
      - *            messageList[i].load();
      - *            //Show help text.
      - *            System.out.println(messageList[i].getHelp());
      - *        }
      - *    }
      - 
      - @see Command - **/ -public class CommandCall implements Serializable -{ - private static final String CLASSNAME = "com.ibm.as400.access.CommandCall"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - static final long serialVersionUID = 4L; - - // Constants that indicate how thread safety is specified/determined. - private static final int UNSPECIFIED = 0; - // property not specified; setThreadSafe() not called - private static final int SPECIFIED_BY_PROPERTY = 1; - // property was set - private static final int SPECIFIED_BY_SETTER = 2; - // setThreadSafe() was called - - /** - Indicates that the command should be assumed to be non-threadsafe. - **/ - public static final Boolean THREADSAFE_FALSE = Boolean.FALSE; - - /** - Indicates that the command should be assumed to be threadsafe. - **/ - public static final Boolean THREADSAFE_TRUE = Boolean.TRUE; - - /** - Indicates that the command's threadsafety should be looked-up at runtime. - This setting should be used with caution, especially if this CommandCall object will be used to - call a sequence of different commands that need to use the same QTEMP library or the same modified - LIBLIST. - **/ - public static final Boolean THREADSAFE_LOOKUP = null; - - // The system where the command is located. - private AS400 system_ = null; - // The command to run. - private String command_ = ""; - // The messages returned by the command. - private AS400Message[] messageList_ = new AS400Message[0]; - - // The assumed thread safety of command. - private transient Boolean threadSafetyValue_ = THREADSAFE_FALSE; // default: assume not threadsafe - - // The following field is needed in order to preserve cross-release serializability between - // JTOpen 6.4 and later releases. - // Thread safety of command. - private boolean threadSafety_ = false; // must be kept in sync with threadSafetyValue_ - - // Indicates whether threadsafety is to be looked-up at run time. - private transient boolean threadSafetyIsLookedUp_ = false; - // How thread safety was specified by user. - private int threadSafetyDetermined_ = UNSPECIFIED; - - // The number of messages to retrieve. - private int messageOption_ = AS400Message.MESSAGE_OPTION_UP_TO_10; // Default for compatibility. - - // Implementation object shared with program call, interacts with host server or native methods. - private transient RemoteCommandImpl impl_ = null; - - // List of action completed event bean listeners. - private transient Vector actionCompletedListeners_ = null; // Set on first add. - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_ = null; // Set on first add. - // List of vetoable change event bean listeners. - private transient VetoableChangeSupport vetoableChangeListeners_ = null; // Set on first add. - - /** - Constructs a CommandCall object. The system and the command properties must be set before using - any method requiring a connection to the system. - **/ - public CommandCall() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing CommandCall object."); - applyThreadSafetyProperty(); - } - - /** - Constructs a CommandCall object. It uses the specified system. The command must be set later. - @param system The system on which to run the command. - **/ - public CommandCall(AS400 system) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing CommandCall object, system: " + system); - if (system == null) { - throw new NullPointerException("system"); - } - system_ = system; - applyThreadSafetyProperty(); - } - - /** - Constructs a CommandCall object. It uses the specified system and command. - @param system The system on which to run the command. - @param command The command to run on the system. If the command is not library qualified, - the library list will be used to find the command. - **/ - public CommandCall(AS400 system, String command) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing CommandCall object, system: " + system + " command: " + command); - if (system == null) { - throw new NullPointerException("system"); - } - if (command == null) { - throw new NullPointerException("command"); - } - - system_ = system; - command_ = command; - applyThreadSafetyProperty(); - } - - /** - Adds an ActionCompletedListener. The specified ActionCompletedListener's actionCompleted - method will be called each time a command has run. The ActionCompletedListener object is - added to a list of ActionCompletedListeners managed by this CommandCall. It can be removed - with removeActionCompletedListener. - @param listener The listener object. - **/ - public void addActionCompletedListener(ActionCompletedListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding action completed listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (actionCompletedListeners_ == null) - { - actionCompletedListeners_ = new Vector(); - } - actionCompletedListeners_.addElement(listener); - } - } - - /** - Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method - will be called each time the value of any bound property is changed. The PropertyChangeListener - object is added to a list of PropertyChangeListeners managed by this CommandCall. It can be removed - with removePropertyChangeListener. - @param listener The listener object. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Adds a VetoableChangeListener. The specified VetoableChangeListener's vetoableChange - method will be called each time the value of any constrained property is changed. - @param listener The listener object. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - } - - // Chooses the appropriate implementation, synchronize to protect impl_ object. - private synchronized void chooseImpl() throws AS400SecurityException, ErrorCompletingRequestException, - IOException, InterruptedException - { - if (system_ != null) system_.signon(false); - if (impl_ == null) - { - if (system_ == null) - { - /* - if (AS400.onAS400) - { - impl_ = (RemoteCommandImpl)AS400.loadImpl("com.ibm.as400.access.RemoteCommandImplNative"); - if (impl_ != null) return; - }*/ - Trace.log(Trace.ERROR, "Attempt to connect to command server before setting system." ); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - impl_ = (RemoteCommandImpl)system_.loadImpl3("com.ibm.as400.access.RemoteCommandImplNative", - "com.ibm.as400.access.RemoteCommandImplRemote", - "com.ibm.as400.access.RemoteCommandImplProxy"); - impl_.setSystem(system_.getImpl()); - } - - // If needed, look up the threadsafety indicator on the system. - if (threadSafetyValue_ == THREADSAFE_LOOKUP) - { - if (command_ == null || command_.length() == 0) { - // Until the command is set, assume it will be non-threadsafe. - threadSafetyValue_ = THREADSAFE_FALSE; - } - else if (!impl_.isNative()) { - // If not running natively, don't bother to lookup the threadsafe indicator. - threadSafetyValue_ = THREADSAFE_FALSE; - } - else { - int indicator = impl_.getThreadsafeIndicator(command_); // look it up - if (indicator == RemoteCommandImpl.THREADSAFE_INDICATED_YES) { - threadSafetyValue_ = THREADSAFE_TRUE; - } - else { - threadSafetyValue_ = THREADSAFE_FALSE; // treat *COND the same as *NO - } - } - threadSafety_ = (THREADSAFE_TRUE.equals(threadSafetyValue_ )); - } - } - - // Fires the action completed event. - private void fireActionCompleted() - { - Vector targets = (Vector)actionCompletedListeners_.clone(); - ActionCompletedEvent event = new ActionCompletedEvent(this); - for (int i = 0; i < targets.size(); ++i) - { - ActionCompletedListener target = (ActionCompletedListener)targets.elementAt(i); - target.actionCompleted(event); - } - } - - /** - Returns the command to run. It will return an empty string ("") if the command has not been previously - set. - @return The command to run. - **/ - public String getCommand() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting command: " + command_); - return command_; - } - - - // 2010-02-16: Temporarily reinstated the getJob() method, since it is used by V5R4 IPP Server, - // which is still in service. - // The getJob() method will be deleted, either: - // (1) when IBM i V5R4 goes out-of-service, or - // (2) when V5R4 IPP Server is PTF'd to not call this method, - // whichever comes first. - - // Removed this obsolete method. Deprecated on 2003-01-22. -// /** -// Returns an RJob object which represents the system job in which the command will be run. The information contained in the RJob object is invalidated by AS400.disconnectService() or AS400.disconnectAllServices(). -//
      Typical uses include: -//
      (1) before run() to identify the job before calling the command; -//
      (2) after run() to see what job the command ran under (to identify the job log, for example). -//

      Note: This method is not supported in the Toolbox proxy environment. -// @return The job in which the command will be run. -// @exception AS400SecurityException If a security or authority error occurs. -// @exception ErrorCompletingRequestException If an error occurs before the request is completed. -// @exception IOException If an error occurs while communicating with the system. -// @exception InterruptedException If this thread is interrupted. -// @deprecated Use getServerJob() instead. -// **/ - /** - Do not use this method. It is obsolete and will be removed in a future release. - @deprecated Use getServerJob() instead. - **/ - public RJob getJob() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting job."); - chooseImpl(); - String jobInfo = impl_.getJobInfo(threadSafetyValue_); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing RJob for job: " + jobInfo); - // Contents of the "job information" string: The name of the user job that the thread is associated with. The format of the job name is a 10-character simple job name, a 10-character user name, and a 6-character job number. - return new RJob(system_, jobInfo.substring(0, 10).trim(), jobInfo.substring(10, 20).trim(), jobInfo.substring(20, 26).trim()); - } - - /** - Returns the option for how many messages will be retrieved. - @return A constant indicating how many messages will be retrieved. Valid values are: -

        -
      • {@link AS400Message#MESSAGE_OPTION_UP_TO_10 MESSAGE_OPTION_UP_TO_10} -
      • {@link AS400Message#MESSAGE_OPTION_NONE MESSAGE_OPTION_NONE} -
      • {@link AS400Message#MESSAGE_OPTION_ALL MESSAGE_OPTION_ALL} -
      - **/ - public int getMessageOption() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting message option:", messageOption_); - return messageOption_; - } - - /** - Returns the list of messages returned from running the command. It will return an empty list if the - command has not been run yet or if there are no messages. - @return The array of messages returned by the command. - **/ - public AS400Message[] getMessageList() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting message list."); - return messageList_; - } - - /** - Returns a message returned from running the command. - @param index The index into the list of messages returned by the command. It must be greater than - or equal to zero and less than the number of messages in the list. - @return The message at the requested index returned by the command. - **/ - public AS400Message getMessageList(int index) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting message from message list:", index); - return messageList_[index]; - } - - /** - Returns a Job object which represents the system job in which the command will be run. - The information contained in the Job object is invalidated by AS400.disconnectService() - or AS400.disconnectAllServices(). -
      Typical uses include: -
      (1) before run() to identify the job before calling the command; -
      (2) after run() to see what job the command ran under (to identify the job log, for example). -

      Note: This method is not supported in the Toolbox proxy environment. - @return The job in which the command will be run. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - **/ - public Job getServerJob() throws AS400SecurityException, ErrorCompletingRequestException, - IOException, InterruptedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting job."); - chooseImpl(); - String jobInfo = impl_.getJobInfo(threadSafetyValue_); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing Job for job: " + jobInfo); - // Contents of the "job information" string: The name of the user job that the thread is - // associated with. The format of the job name is a 10-character simple job name, - // a 10-character user name, and a 6-character job number. - return new Job(system_, jobInfo.substring(0, 10).trim(), jobInfo.substring(10, 20).trim(), jobInfo.substring(20, 26).trim()); - } - - /** - Returns the system on which the command is to be run. - @return The system on which the command is to be run. If the system has not been set, null is returned. - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - /** - Returns the thread on which the command would be run, if it were to be called on-thread. - @return The thread on which the command would be run. - Returns null if either: -

        -
      • The client is communicating with the system through sockets. -
      • The command has not been marked as thread safe. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public Thread getSystemThread() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system thread."); - chooseImpl(); - Thread currentThread = impl_.isNative() ? Thread.currentThread() : null; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "System thread: " + currentThread); - return currentThread; - } - - static final String getThreadSafetyProperty() - { - String val = SystemProperties.getProperty(SystemProperties.COMMANDCALL_THREADSAFE); - return (val == null || val.length()==0 ? null : val.toLowerCase()); - } - - // Apply the value of the thread safety system property (if it has been set). - // Note: This method is reserved for use by the constructors. - // Caution: If you call this method elsewhere, you might override a value set by setThreadSafe(). - private void applyThreadSafetyProperty() - { - String property = getThreadSafetyProperty(); - if (property == null) // Property not set. - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Thread safe system property not set; thread safety property remains unspecified."); - } - else - { - if (property.equals("true")) { - threadSafetyValue_ = THREADSAFE_TRUE; - threadSafetyDetermined_ = SPECIFIED_BY_PROPERTY; - } - else if (property.equals("false")) { - threadSafetyValue_ = THREADSAFE_FALSE; - threadSafetyDetermined_ = SPECIFIED_BY_PROPERTY; - } - else if (property.equals("lookup")) { - threadSafetyValue_ = THREADSAFE_LOOKUP; - threadSafetyDetermined_ = SPECIFIED_BY_PROPERTY; - threadSafetyIsLookedUp_ = true; - } - else { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Unrecognized value for CommandCall.threadSafe property: " + property + ". Defaulting to 'false'."); - } - threadSafety_ = THREADSAFE_TRUE.equals(threadSafetyValue_); - } - } - - - /** - Returns the value of the "Threadsafe" attribute of the CL command on the system. - @return The value of the command's Threadsafe attribure. Valid values are: -
        -
      • 0 - The command is not threadsafe and should not be used in a multithreaded job. -
      • 1 - The command is threadsafe and can be used safely in a multithreaded job. -
      • 2 - The command is threadsafe under certain conditions. See the documentation for the command to determine the conditions under which the command can be used safely in a multithreaded job. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - **/ - public int getThreadsafeIndicator() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - if (command_ == null || command_.length() == 0) - { - Trace.log(Trace.ERROR, "Attempt to retrieve Threadsafe indicator before setting command."); - throw new ExtendedIllegalStateException ("command", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - chooseImpl(); - return impl_.getThreadsafeIndicator(command_); - } - - - /** - Indicates whether or not the command will actually get run on the current thread. -
      Note: If the command is run on-thread, it will run in a different job (with different QTEMP library and different job log) than if it were run off-thread. -
      Note: If the threadsafety behavior is set to {@link #THREADSAFE_LOOKUP THREADSAFE_LOOKUP}, then the value returned by this method will depend on the command string that has been specified, in either the constructor or in {@link #setCommand setCommand()}. - @return true if the command will be run on the current thread; false otherwise. - If the application is not running on IBM i, false is always returned. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @see #setThreadSafe(Boolean) - **/ - public boolean isStayOnThread() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if command will actually get run on the current thread."); - chooseImpl(); - boolean isStayOnThread = ((THREADSAFE_TRUE.equals(threadSafetyValue_)) && - impl_.isNative()); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Will command actually get run on the current thread:", isStayOnThread); - return isStayOnThread; - } - - /** - Indicates whether or not the command will be assumed thread-safe. The determination is based upon the settings specified by {@link #setThreadSafe(Boolean) setThreadSafe()} or the com.ibm.as400.access.CommandCall.threadSafe property. -
      Note: If the CL command on the system is not actually threadsafe (as indicated by its "threadsafe indicator" attribute), then the results of attempting to run the command on-thread will depend on the command's "multithreaded job action" attribute, in combination with the setting of system value QMLTTHDACN ("Multithreaded job action"). - Possible results are: -
        -
      • Run the command. Do not send a message. -
      • Send an informational message and run the command. -
      • Send an escape message, and do not run the command. -
      -
      Note: If the command is run on-thread, it will run in a different job (with different QTEMP library and different job log) than if it were run off-thread. - @return true if the command will be assumed thread-safe; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @deprecated The name of this method is misleading. Use {@link #isStayOnThread isStayOnThread()} or {@link #getThreadsafeIndicator getThreadsafeIndicator()} instead. - **/ - public boolean isThreadSafe() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if command will be assumed thread-safe."); - - chooseImpl(); - - return threadSafetyValue_.booleanValue(); - } - - - // Deserializes and initializes the transient data. - private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "De-serializing CommandCall object."); - in.defaultReadObject(); - - // impl_ remains null. - // actionCompletedListeners_ remains null. - // propertyChangeListeners_ remains null. - // vetoableChangeListeners_ remains null. - - threadSafetyIsLookedUp_ = false; // to maintain cross-version serializability - - // Prior to JTOpen 6.5, threadSafetyDetermined_ could have an additional value: BY_LOOK_UP = 3. If we get that obsolete value, convert it to UNSPECIFIED. - if (threadSafetyDetermined_ == 3) // old value that indicated "threadsafety is looked up" - { - threadSafetyDetermined_ = UNSPECIFIED; - // Note: Don't set threadSafetyIsLookedUp_ here; let applyThreadSafetyProperty() set it. We will tolerate the potential loss of "lookup" behavior during serialization/deserialization. - } - - - // See how we determined this object's thread-safety before it was serialized. - if (threadSafetyDetermined_ == SPECIFIED_BY_SETTER) - { - threadSafetyValue_ = (threadSafety_ == true ? THREADSAFE_TRUE : THREADSAFE_FALSE); - } - else // the thread-safety value was not explicitly specified by the application - { - // (Re)initialize the thread-safe attribute. Note: The threadSafety_ attribute is persistent, not transient. First see if object was previously serialized when its thread-safe behavior was determined by a system property (and not specified via setThreadSafe()). This system property may have since changed. - // Disregard any previous settings, since they were derived from properties. - threadSafetyValue_ = THREADSAFE_FALSE; - threadSafety_ = false; - threadSafetyIsLookedUp_ = false; - String property = getThreadSafetyProperty(); - if (property == null) // The property is not set in the current environment. - { - threadSafetyDetermined_ = UNSPECIFIED; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Thread safe system property not set, so thread safety property changed to unspecified."); - } - else // The property is set in the current environment, so use it. - { - applyThreadSafetyProperty(); - } - } - } - - /** - Removes the ActionCompletedListener. If the ActionCompletedListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removeActionCompletedListener(ActionCompletedListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing action completed listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - // If we have listeners. - if (actionCompletedListeners_ != null) - { - actionCompletedListeners_.removeElement(listener); - } - } - - /** - Removes the PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes the VetoableChangeListener. If the VetoableChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - // If we have listeners. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - /** - Runs the command on the system. The command must be set prior to this call. -
      Note: Interactive (screen-oriented) results are not returned. - @return true if command is successful; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - **/ - public boolean run() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "Running command: " + command_); - if (command_ == null || command_.length() == 0) - { - Trace.log(Trace.ERROR, "Attempt to run before setting command."); - throw new ExtendedIllegalStateException ("command", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - chooseImpl(); - - // Run the command. - boolean result = impl_.runCommand(command_, threadSafetyValue_, messageOption_); - // Retrieve the messages. - messageList_ = impl_.getMessageList(); - // Set our system into each of the messages. - if (system_ != null) - { - for (int i = 0; i < messageList_.length; ++i) - { - messageList_[i].setSystem(system_); - } - } - - // Fire action completed event. - if (actionCompletedListeners_ != null) fireActionCompleted(); - return result; - } - - /** - Sets the command and runs it on the system. -
      Note: Interactive (screen-oriented) results are not returned. - @param command The command to run. If the command is not library qualified, the library list will be used to find the command. - @return true if command is successful; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @exception PropertyVetoException If the change is vetoed. - **/ - public boolean run(String command) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, PropertyVetoException - { - setCommand(command); - return run(); - } - - /** - Runs the command on the system. This method takes the command to run as a byte array instead of a String. The most common use of CommandCall is to supply the command to run as a String and let the Toolbox convert the string to IBM i format (EBCDIC) before sending it to the system for processing. Use this method if the default conversion of the command to EBCDIC is not correct. In certain cases, especially bi-directional languages, the Toolbox conversion may not be correct. In this case the application can construct their own command and supply it to CommandCall as a byte array. -

      Unlike the run method that takes a string, this method cannot look up the thread safety of the command, and will assume that the command is not thread-safe. If this command is to be run on-thread when running on the system's JVM, setThreadSafe(true) must be called by the application. -
      Note: Interactive (screen-oriented) results are not returned. - @param command The command to run. - @return true if command is successful; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @exception PropertyVetoException If the change is vetoed. - **/ - public boolean run(byte[] command) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "Running command:", command); - if (command == null) { - throw new NullPointerException("command"); - } - if (command.length == 0) - { - throw new ExtendedIllegalArgumentException("command.length (" + command.length + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - chooseImpl(); - - // Run the command. - boolean success = impl_.runCommand(command, threadSafetyValue_, messageOption_); - - // Retrieve the messages. - messageList_ = impl_.getMessageList(); - - // Set our system into each of the messages. - if (system_ != null) - { - for (int i = 0; i < messageList_.length; ++i) - { - messageList_[i].setSystem(system_); - } - } - - // Fire action completed event. - if (actionCompletedListeners_ != null) fireActionCompleted(); - return success; - } - - /** - Sets the command to run. - @param command The command to run on the system. If the command is not library qualified, the library list will be used to find the command. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setCommand(String command) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting command: " + command); - if (command == null) { - throw new NullPointerException("command"); - } - if (Trace.traceOn_ && command.length() == 0) - { - Trace.log(Trace.WARNING, "Parameter 'command' is has length of 0."); - } - - // See if we need to force another lookup of command's threadsafety. - boolean forceLookup = false; - if (threadSafetyIsLookedUp_ && (threadSafetyValue_ != THREADSAFE_LOOKUP)) - { - // If the command name is different from before, force another lookup of threadsafety. - // We can disregard the command argument string when doing the compare. - if (!firstToken(command).equalsIgnoreCase(firstToken(command_))) - { - forceLookup = true; - } - } - - String oldValue = command_; - String newValue = command; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("command", oldValue, newValue); - } - command_ = newValue; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("command", oldValue, newValue); - } - - if (forceLookup) { - threadSafetyValue_ = THREADSAFE_LOOKUP; - threadSafety_ = false; - } - } - - // Returns the first token in the String, or "" if no first token. - private static final String firstToken(String string) - { - String token = null; - try - { - StringTokenizer tokenizer = new StringTokenizer(string); - token = tokenizer.nextToken(); - } - catch (java.util.NoSuchElementException e) { - token = ""; - } - return token; - } - - /** - Specifies the option for how many messages should be retrieved. By default, to preserve compatability, only the messages sent to the command caller and only up to ten messages are retrieved. This property will only take affect on systems that support the new option. - @param messageOption A constant indicating how many messages to retrieve. Valid values are: -

        -
      • {@link AS400Message#MESSAGE_OPTION_UP_TO_10 MESSAGE_OPTION_UP_TO_10} -
      • {@link AS400Message#MESSAGE_OPTION_NONE MESSAGE_OPTION_NONE} -
      • {@link AS400Message#MESSAGE_OPTION_ALL MESSAGE_OPTION_ALL} -
      - **/ - public void setMessageOption(int messageOption) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message option:", messageOption); - // Validate the messageOption parameter. - if (messageOption < 0 || messageOption > 2) - { - throw new ExtendedIllegalArgumentException("messageOption (" + messageOption + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - messageOption_ = messageOption; - } - - /** - Sets the system to run the command. The system cannot be changed once a connection is made to the system. - @param system The system on which to run the command. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem(AS400 system) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system: " + system); - if (system == null) { - throw new NullPointerException("system"); - } - if (impl_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - AS400 oldValue = system_; - AS400 newValue = system; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("system", oldValue, newValue); - } - system_ = newValue; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("system", oldValue, newValue); - } - } - - /** - Specifies whether or not the command should be assumed thread-safe. If not specified, the default is false; that is, the command will be assumed to be not thread-safe. -
      This method is an alternative to {@link #setThreadSafe(Boolean) setThreadSafe(Boolean)}. For example, calling setThreadSafe(true) is equivalent to calling setThreadSafe(Boolean.TRUE). -
      Note: This method has no effect if the Java application is running remotely, that is, is not running "natively" on an IBM i system. When running remotely, the Toolbox submits all command calls through the Remote Command Host Server, regardless of the value of the threadSafe attribute. -
      Note: This method does not modify the actual command object on the system. -
      Note: If the command is run on-thread, it will run in a different job (with different QTEMP library and different job log) than if it were run off-thread. - @param threadSafe true if the command should be assumed to be thread-safe; false otherwise. - @see #setThreadSafe(Boolean) - **/ - public void setThreadSafe(boolean threadSafe) - { - // Note to maintenance programmer: - // Currently all host server jobs are single-threaded. If that ever changes, then we'll need to communicate the threadsafety of the called command to the host server. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting thread safe: " + threadSafe); - Boolean newValue = (threadSafe ? THREADSAFE_TRUE : THREADSAFE_FALSE); - if (propertyChangeListeners_ != null) - { - Boolean oldValue = threadSafetyValue_; - propertyChangeListeners_.firePropertyChange ("threadSafe", oldValue, newValue); - } - - threadSafetyValue_ = newValue; - threadSafety_ = threadSafe; - threadSafetyDetermined_ = SPECIFIED_BY_SETTER; - threadSafetyIsLookedUp_ = false; - } - - /** - Specifies whether or not the command should be assumed thread-safe. If not specified, the default is {@link #THREADSAFE_FALSE THREADSAFE_FALSE}. -
      Note: This method has no effect if the Java application is running remotely, that is, is not "natively" on an IBM i system. When running remotely, all command calls are submitted through the Remote Command Host Server, regardless of the value of the threadSafe attribute. -
      Note: This method does not modify the actual command object on the system. -
      Note: If the command is run on-thread, it will run in a different job (with different QTEMP library and different job log) than if it were run off-thread. - @param threadSafe - Valid values are: -
        -
      • {@link #THREADSAFE_TRUE THREADSAFE_TRUE} -
      • {@link #THREADSAFE_FALSE THREADSAFE_FALSE} -
      • {@link #THREADSAFE_LOOKUP THREADSAFE_LOOKUP} -
      - @see #setThreadSafe - @see #isStayOnThread - **/ - public void setThreadSafe(Boolean threadSafe) - { - // Note to maintenance programmer: - // Currently all host server jobs are single-threaded. If that ever changes, then we'll need to communicate the threadsafety of the called command to the host server. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting thread safe: " + threadSafe); - - Boolean newValue; - - // Note: Assign the static constants, so that later we can use "==" rather than "equals()". - if (threadSafe.equals(THREADSAFE_TRUE)) { - newValue = THREADSAFE_TRUE; - threadSafetyIsLookedUp_ = false; - } - else if (threadSafe.equals(THREADSAFE_FALSE)) { - newValue = THREADSAFE_FALSE; - threadSafetyIsLookedUp_ = false; - } - else { - newValue = THREADSAFE_LOOKUP; - threadSafetyIsLookedUp_ = true; - } - - if (propertyChangeListeners_ != null) - { - Boolean oldValue = threadSafetyValue_; - propertyChangeListeners_.firePropertyChange ("threadSafe", oldValue, newValue); - } - - threadSafetyValue_ = newValue; - threadSafety_ = (threadSafetyValue_ == THREADSAFE_TRUE); - threadSafetyDetermined_ = SPECIFIED_BY_SETTER; - } - - /** - Specifies whether or not the command should be assumed to be thread-safe. - If the system property com.ibm.as400.access.CommandCall.threadSafe has been set - to a value other than "lookup", this method does nothing. - This method is typically used in order to suppress runtime lookups of - the CL command's "Threadsafe Indicator" attribute. - @param threadSafe true if the command should be assumed to be thread-safe; false if the command should be assumed to be not thread-safe. - **/ - public void suggestThreadsafe(boolean threadSafe) - { - String property = getThreadSafetyProperty(); - if (property == null || property.equals("lookup")) - { - setThreadSafe(Boolean.valueOf(threadSafe)); - } - } - - /** - Returns the string representation of this command call object. - @return The string representing this command call object. - **/ - public String toString() - { - return "CommandCall (system: " + system_ + " command: " + command_ + "):" + super.toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/CommandCall16.gif b/cvsroot/src/com/ibm/as400/access/CommandCall16.gif deleted file mode 100644 index d3558f912..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/CommandCall16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/CommandCall32.gif b/cvsroot/src/com/ibm/as400/access/CommandCall32.gif deleted file mode 100644 index cc2a9643c..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/CommandCall32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/CommandCallBeanInfo.java b/cvsroot/src/com/ibm/as400/access/CommandCallBeanInfo.java deleted file mode 100644 index 5c62da195..000000000 --- a/cvsroot/src/com/ibm/as400/access/CommandCallBeanInfo.java +++ /dev/null @@ -1,147 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CommandCallBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - The CommandCallBeanInfo class provides bean information for the CommandCall class. - **/ -public class CommandCallBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private static final Class BEAN_CLASS = CommandCall.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - EventSetDescriptor actionCompleted = new EventSetDescriptor(BEAN_CLASS, "actionCompleted", ActionCompletedListener.class, "actionCompleted"); - actionCompleted.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_ACTION_COMPLETED")); - actionCompleted.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_ACTION_COMPLETED")); - - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - - eventSetDescriptors = new EventSetDescriptor[] { actionCompleted, propertyChange, vetoableChange }; - - PropertyDescriptor command = new PropertyDescriptor("command", BEAN_CLASS); - command.setBound(true); - command.setConstrained(true); - command.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_COMMAND")); - command.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_COMMAND")); - - PropertyDescriptor system = new PropertyDescriptor("system", BEAN_CLASS); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - - PropertyDescriptor threadSafe = new PropertyDescriptor("threadSafe", BEAN_CLASS); - threadSafe.setBound(true); - threadSafe.setConstrained(false); - threadSafe.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_CMD_THREADSAFE")); - threadSafe.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_CMD_THREADSAFE")); - - propertyDescriptors = new PropertyDescriptor[] { command, system, threadSafe }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return Zero (0), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "actionCompleted" event. - return 0; - } - - /** - Returns the index of the default property. - @return Zero (0), the index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // The index for the "command" property. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("CommandCall16.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("CommandCall32.gif"); - } - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/CommandHelpHandler.java b/cvsroot/src/com/ibm/as400/access/CommandHelpHandler.java deleted file mode 100644 index 5aa7395d6..000000000 --- a/cvsroot/src/com/ibm/as400/access/CommandHelpHandler.java +++ /dev/null @@ -1,81 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CommandHelpHandler.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Vector; -import org.xml.sax.Attributes; -import org.xml.sax.helpers.DefaultHandler; -import org.xml.sax.SAXException; - -// This class is used by Command to parse the XML and get the help identifier keywords out of it. -class CommandHelpHandler extends DefaultHandler -{ - private static final String copyright = "Copyright (C) 1997-2002 International Business Machines Corporation and others."; - - private final Vector keywords_ = new Vector(); - private String panelGroup_; - private String helpID_; - private String productLibrary_; - - String getHelpID() - { - return helpID_; - } - - Vector getKeywords() - { - return keywords_; - } - - String getPanelGroup() - { - return panelGroup_; - } - - String getProductLibrary() - { - return productLibrary_; - } - - public void startElement(String namespaceURI, String localName, String name, Attributes attributes) throws SAXException - { - if (name.equals("Parm")) - { - String kwd = attributes.getValue("Kwd"); - if (kwd != null) - { - keywords_.addElement(kwd); - } - } - else if (name.equals("Cmd")) // Assume there is only one Cmd element in the XML. - { - String helpName = attributes.getValue("HlpPnlGrp"); - String helpLib = attributes.getValue("HlpPnlGrpLib"); - - if (helpLib != null && helpLib.equals("__LIBL")) - { - helpLib = "*LIBL"; - } - - if (helpLib != null && helpName != null) - { - panelGroup_ = QSYSObjectPathName.toPath(helpLib, helpName, "PNLGRP"); - } - - helpID_ = attributes.getValue("HlpID"); - productLibrary_ = attributes.getValue("PrdLib"); - } - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/CommandLineArguments.java b/cvsroot/src/com/ibm/as400/access/CommandLineArguments.java deleted file mode 100644 index fced63f00..000000000 --- a/cvsroot/src/com/ibm/as400/access/CommandLineArguments.java +++ /dev/null @@ -1,247 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CommandLineArguments.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - - - -/** - * A utility that parses command line arguments into - * options specified in the format "-optionName optionValue". - *

      - * Here is an example of calling a program from the command line with arguments: - *
      - *

      - *  A sample program:  java myProgram systemName -userid myID -password myPWD
      - *  

      - * The Java code to parse the command: - *
      - * // Create a vector to hold all the defined/expected command line arguments. - * Vector options = new Vector(); - * options.addElement("-userID"); - * options.addElement("-password"); - *

      - * // Create a Hashtable to map shortcuts to the command line arguments. - * Hashtable shortcuts = new Hashtable(); - * shortcuts.put("-u", "-userID"); - * shortcuts.put("-p", "-password"); - *

      - * // Create a CommandLineArguments object with the args array passed into main(String args[]) - * // along with the vector and hashtable just created. - * CommandLineArguments arguments = new CommandLineArguments(args, options, shortcuts); - *

      - * // Get the name of the IBM i system that the user wants to run to. - * String system = arguments.getOptionValue(""); - *

      - * // Get the user ID that the user wants to log in with. - * String uid = arguments.getOptionValue("-userID"); - *

      - * // Get the password that the user wants to log in with. - * String pwd = arguments.getOptionValue("-password"); - * - *

      - * -**/ -public class CommandLineArguments //$B1C -{ - // Private data. - private Vector extraOptions_ = new Vector (); - private Hashtable map_ = new Hashtable (); - - -/** -Creates a CommandLineArguments object. - -@param args The command line arguments. -**/ - public CommandLineArguments (String[] args) - { - this (args, null, new Hashtable ()); - } - - - -/** -Creates a CommandLineArguments object. - -@param args The command line arguments. -@param expectedOptions The expected options. This is a Vector of - Strings, each starting with a hyphen ("-"). - These are not case sensitive. Specify null - if any options are expected. -@param shortcuts The shortcuts. This is a Hashtable where - the keys are Strings for the shortcuts (e.g. "-?") and - the elements are Strings for the option (e.g. "-help"). - All strings start with a hyphen ("-"). Specify - null if no shortcuts are used. -**/ - public CommandLineArguments (String[] args, Vector expectedOptions, Hashtable shortcuts) - { - // Lowercase all of the expected option names. - if (expectedOptions != null) { - Vector normalizedExpectedOptions = new Vector (); - Enumeration list = expectedOptions.elements (); - while (list.hasMoreElements ()) - normalizedExpectedOptions.addElement (list.nextElement ().toString ().toLowerCase ()); - expectedOptions = normalizedExpectedOptions; - } - - // Parse through the args. - - // Note: Any leading arguments that aren't preceded by an option name, - // are associated as values to the special "unnamed" option, "-". - String currentOptionName = "-"; - StringBuffer currentOptionValue = new StringBuffer (); - for (int i = 0; i < args.length; ++i) { - String arg = args[i]; - if (isOptionName(arg)) { // @A2C - map_.put (currentOptionName, currentOptionValue); - currentOptionName = arg.toLowerCase (); - - if (shortcuts != null) - if (shortcuts.containsKey (currentOptionName)) - currentOptionName = ((String) shortcuts.get (currentOptionName)).toLowerCase (); - - if (expectedOptions != null) - if (! expectedOptions.contains (currentOptionName)) - extraOptions_.addElement (currentOptionName); - - if (map_.containsKey (currentOptionName)) - currentOptionValue = (StringBuffer) map_.get (currentOptionName); - else - currentOptionValue = new StringBuffer (); - } - else { - currentOptionValue.append (" "); - currentOptionValue.append (arg); - } - } - map_.put (currentOptionName, currentOptionValue); - } - - - -/** -Returns the list of any extra options that were specified. -These are options that the application was not expecting. - -@return The list of extra options. This is an Enumeration - which contains a String for each extra option. - If there were no extra options, an empty Enumeration is returned. -**/ - public Enumeration getExtraOptions () - { - return extraOptions_.elements (); - } - - - -/** -Returns the list of option names that were specified. - -@return The list of option names. This is an Enumeration - which contains a String for each option name. - Note: The list may include the special "unnamed" option, "-", - which is aliased as "". -**/ - public Enumeration getOptionNames () - { - return map_.keys (); - } - - - -/** -Returns the value of an option. - -@param optionName The option name. -@return The option value, or null if the - option was not specified. -**/ - public String getOptionValue (String optionName) - { - // Note: We map "" to the special (unnamed) option "-". - String key; - if (! optionName.startsWith ("-")) - key = "-" + optionName.toLowerCase (); - else - key = optionName.toLowerCase (); - - if (map_.containsKey (key)) - return map_.get (key).toString ().trim (); - else - return null; - } - - - -/** -Indicates whether the option was specified. - -@param optionName The option name. -@return true if the option was specified; false otherwise. -**/ - public boolean isOptionSpecified (String optionName) - { - return ( getOptionValue(optionName) != null ); - } - - - - private boolean isOptionName(String arg) // @A2A - { // @A2A - if (! arg.startsWith("-")) // @A2A - return false; // @A2A - // @A2A - // Allow numeric option values, but disallow numeric option names. // @A2A - // This is to avoid mistaking a negative number for an option indicator. - try { // @A2A - Double.valueOf(arg.substring(1)); // @A2A - return false; // @A2A - } // @A2A - catch(NumberFormatException e) { // @A2A - return true; // @A2A - } // @A2A - } // @A2A - - - -/** -The main() method for test this class. This should -be commented out for production code. -**/ - /* - public static void main (String[] args) - { - Hashtable shortcuts = new Hashtable (); - shortcuts.put ("-sc", "-shortcut"); - - CommandLineArguments cla = new CommandLineArguments (args, null, shortcuts); - Enumeration list = cla.getOptionNames (); - while (list.hasMoreElements ()) { - String optionName = (String) list.nextElement (); - String optionValue = cla.getOptionValue (optionName); - System.out.println ("Option:"); - System.out.println (" name: [" + optionName + "]"); - System.out.println (" value: [" + optionValue + "]"); - } - } - */ - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/CommandList.java b/cvsroot/src/com/ibm/as400/access/CommandList.java deleted file mode 100644 index e0d9850fe..000000000 --- a/cvsroot/src/com/ibm/as400/access/CommandList.java +++ /dev/null @@ -1,387 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CommandList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; - -/** - * The CommandList class represents a list of CL command (*CMD) objects on the system. This class allows the user to retrieve - * a list of {@link com.ibm.as400.access.Command Command} objects which can then be - * used to retrieve information about each individual CL command in the list. - * - *

      The following example demonstrates the use of CommandList: - *
      - *

      - *
      - *    AS400 system = new AS400("mySystem");
      - *
      - *    // Generate a list of commands that start with "CRT".
      - *    CommandList list = new CommandList(system, "QSYS", "CRT*");
      - *    try
      - *    {
      - *        Command[] cmdList = list.generateList();
      - *    }
      - *    catch (Exception e)
      - *    {
      - *        e.printStackTrace();
      - *    }
      - *  
      - * @see com.ibm.as400.access.Command - **/ -public class CommandList implements Serializable -{ - static final long serialVersionUID = 6L; - private static final String USERSPACE_PATH = "/QSYS.LIB/QTEMP.LIB/CMDLST.USRSPC"; - - /** - * Constant used to retrieve all commands in a given library. - **/ - public static final String ALL = "*ALL"; - - private AS400 sys_; - private String lib_; - private String cmd_; - - // Program Call parameters. These are always the same, so we hardcode them. - // Parm0: "CMDLST QTEMP " - private static final ProgramParameter parm0_ = new ProgramParameter(new byte[] { (byte)0xC3, (byte)0xD4, (byte)0xC4, (byte)0xD3, (byte)0xE2, (byte)0xE3, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0xD8, (byte)0xE3, (byte)0xC5, (byte)0xD4, (byte)0xD7, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40}); - // Parm1: "OBJL0200" - private static final ProgramParameter parm1_ = new ProgramParameter(new byte[] { (byte)0xD6, (byte)0xC2, (byte)0xD1, (byte)0xD3, (byte)0xF0, (byte)0xF2, (byte)0xF0, (byte)0xF0}); - // Parm3: "*CMD " - private static final ProgramParameter parm3_ = new ProgramParameter(new byte[] { (byte)0x5C, (byte)0xC3, (byte)0xD4, (byte)0xC4, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40}); - // Error code. - private static final ProgramParameter parm4_ = new ProgramParameter(new byte[4]); - - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_ = new PropertyChangeSupport(this); - - - /** - * Constructs a CommandList object. - **/ - public CommandList() - { - initializeTransient(); - } - - - /** - * Constructs a CommandList object. - * - * @param system The system on which the commands resides. - * @param library The library in which the commands resides, e.g. "QSYS". - * @param command The name of a command or list of commands, e.g. "CRTUSRPRF" or "CRT*". Wildcards or the {@link #ALL CommandList.ALL} constant can be used. - **/ - public CommandList(AS400 system, String library, String command) - { - if (system == null) - throw new NullPointerException("system"); - - if (library == null) - throw new NullPointerException("library"); - - if (command == null) - throw new NullPointerException("command"); - - sys_ = system; - lib_ = library; - cmd_ = command; - - initializeTransient(); - } - - - /** - * Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method will be called each time the value of any bound property is changed. - * The PropertyChangeListener object is added to a list of PropertyChangeListeners managed by this CommandList. It can be removed with removePropertyChangeListener. - * - * @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - - - /** - * Returns the command name used to generate a list for. - * - * @return The command, or null if no command has been set. - * @see #setCommand - **/ - public String getCommand() - { - return cmd_; - } - - - /** - * Returns the library where the command(s) reside. - * - * @return The library, or null if no library has been set. - * @see #setLibrary - **/ - public String getLibrary() - { - return lib_; - } - - - /** - * Returns the system from which to retrieve the command list. - * - * @return The system from which to retrieve the commands, or null if no system has been set. - * @see #setSystem - **/ - public AS400 getSystem() - { - return sys_; - } - - - /** - * Generate a list of commands. The system, library filter, and command filter must - * all be set before calling this method. - * @return The array of Command objects generated by this CommandList. If the command list - * is empty, an array of size 0 is returned. - * @see #setCommand - * @see #setLibrary - * @see #setSystem - **/ - public synchronized Command[] generateList() throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, "Generating list of commands using library filter '"+lib_+"' and command filter '"+cmd_+"'."); - - if (sys_ == null) - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - if (lib_ == null) - throw new ExtendedIllegalStateException("library", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - if (cmd_ == null) - throw new ExtendedIllegalStateException("command", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - CharConverter conv37_ = new CharConverter(37); - StringBuffer commandString = new StringBuffer(cmd_.toUpperCase().trim()); - while (commandString.length() < 10) commandString.append(' '); - StringBuffer libraryString = new StringBuffer(lib_.toUpperCase().trim()); - while (libraryString.length() < 10) libraryString.append(' '); - - // Create the program parameters for the list object program call. - ProgramParameter[] parms = new ProgramParameter[] - { - parm0_, parm1_, - new ProgramParameter(conv37_.stringToByteArray(commandString.toString()+libraryString.toString())), - parm3_, parm4_ - }; - - CharConverter textConv = new CharConverter(sys_.getCcsid()); - ProgramCall pgm = new ProgramCall(sys_, "/QSYS.LIB/QUSLOBJ.PGM", parms); - pgm.suggestThreadsafe(); // the called API is thread-safe - // Note: The program _must_ be allowed to run in the same job as is used for the UserSpace operations, otherwise a different QTEMP library will be used. - - // Determine the needed scope of synchronization. - Object lockObject; - boolean willRunProgramsOnThread = pgm.isStayOnThread(); - if (willRunProgramsOnThread) { - // The calls will run in the job of the JVM, so lock for entire JVM. - lockObject = USERSPACE_PATH; - } - else { - // The calls will run in the job of the Remote Command Host Server, so lock on the connection. - lockObject = sys_; - } - - byte[] bytes = new byte[140]; - int offsetOfList = 0; - int numberOfListEntries = 0; - int sizeOfListEntry = 0; - - synchronized(lockObject) // Synchronize so we don't step on our own user space. - { - // The userspace that is used to store the help data before the transformation. - UserSpace us = new UserSpace(sys_, USERSPACE_PATH); - us.setMustUseProgramCall(true); - if (!willRunProgramsOnThread) - { - us.setMustUseSockets(true); - // Force the use of sockets when running natively but not on-thread. - // We have to do it this way since UserSpace will otherwise make a native ProgramCall, and will use a different QTEMP library than that used by the host server. - } - try - { - us.create(140, true, " ", (byte)0, "", "*ALL"); - - // call the program - if (!pgm.run()) - { - AS400Message[] messages = pgm.getMessageList(); - throw new AS400Exception(messages); - } - - // Read from the userspace. - us.read(bytes, 0, 0, 140); - - offsetOfList = BinaryConverter.byteArrayToInt(bytes, 124); - numberOfListEntries = BinaryConverter.byteArrayToInt(bytes, 132); - sizeOfListEntry = BinaryConverter.byteArrayToInt(bytes, 136); - int neededSize = offsetOfList+(numberOfListEntries*sizeOfListEntry); - - // Read from the userspace. - bytes = new byte[neededSize]; - us.read(bytes, 0, 0, neededSize); - } - finally - { - // Delete the temporary user space, to allow other threads to re-create and use it. - try { us.delete(); } - catch (Exception e) { - Trace.log(Trace.ERROR, "Exception while deleting temporary user space", e); - } - } - } - - // Initialize the string data we plan to retrieve. - Command[] cmdList = new Command[numberOfListEntries]; - int offset = offsetOfList; - - // Fill in the string arrays for each command mathing the search criteria. - for (int i=0; i= 0) && - (poolItem.getInactivityTime() >= properties_.getMaxInactivity())) - { - return EXPIRED_INACTIVE; - } - - // See if the item has exceeded the maximum use count. - if ((properties_.getMaxUseCount() >= 0) && - (poolItem.getUseCount() >= properties_.getMaxUseCount())) - { - return EXPIRED_MAX_USE_COUNT; - } - - // See if the item has exceeded the maximum lifetime. - if ( (properties_.getMaxLifetime() >= 0) && - (poolItem.getLifeSpan() >= properties_.getMaxLifetime())) - { - return EXPIRED_MAX_LIFETIME; - } - - // See if the item has exceeded the maximum use time. - if ((properties_.getMaxUseTime() >= 0) && - (poolItem.getInUseTime() >= properties_.getMaxUseTime())) - { - return EXPIRED_MAX_USE_TIME; - } - - return NOT_EXPIRED; - } - - - /** - * Close the connection. - **/ - void close() - { - if (log_ != null || Trace.traceOn_) - log(ResourceBundleLoader.getText("CL_CLEANUP", new String[] {systemName_, userID_} )); - synchronized (connectionList_) - { - int size = connectionList_.size(); //@A5M - for (int i=0; i 0) && - (getConnectionCount() >= properties_.getMaxConnections())) - { - if (log_ != null || Trace.traceOn_) - log(ResourceBundleLoader.getText("CL_CLEANUPEXP")); - // see if anything frees up - removeExpiredConnections(poolListeners); - - // if that didn't do the trick, try shutting down unused connections - if (getConnectionCount() >= properties_.getMaxConnections()) - { - if (log_ != null || Trace.traceOn_) - log(ResourceBundleLoader.getText("CL_CLEANUPOLD")); - shutDownOldest(); - // if not enough connections were freed, throw an exception! - if (getConnectionCount() >= properties_.getMaxConnections()) - { - throw new ConnectionPoolException(ConnectionPoolException.MAX_CONNECTIONS_REACHED); //@A1C - } - } - } - - boolean threadUse = properties_.isThreadUsed(); - // create a new connection - PoolItem sys = new PoolItem (systemName_, userID_, poolAuth, secure, locale, service, connect, threadUse, socketProperties, ccsid); //@B2C //@B4C //@C1C - //@B4D if (connect) - //@B4D { - //@B4D sys.getAS400Object().connectService(service); - //@B4D } - - //@B4D if (!properties_.isThreadUsed()) //@A2A - //@B4D { //@A2A - //@B4D try - //@B4D { //@A2A //@A2A - //@B4D sys.getAS400Object().setThreadUsed(false); //@A2A - //@B4D } //@A2A - //@B4D catch (java.beans.PropertyVetoException e) //@A2A - //@B4D { //@A2A - //@B4D //Ignore //@A2A - //@B4D } //@A2A - //@B4D } //@A2A - - // set the item is in use since we are going to return it to caller - sys.setInUse(true); - connectionList_.addElement(sys); - - if (poolListeners != null) - { - ConnectionPoolEvent poolEvent = new ConnectionPoolEvent(sys.getAS400Object(), ConnectionPoolEvent.CONNECTION_CREATED); //@A5C - poolListeners.fireConnectionCreatedEvent(poolEvent); - } - if (log_ != null || Trace.traceOn_) - { - log(ResourceBundleLoader.getText("CL_CREATED", new String[] {systemName_, userID_} )); - } - return sys; - } - - /** - * Return the poolItem in the list that contains this AS400 instance. - * - * @return The matching poolItem. - **/ - PoolItem findElement(AS400 systemToFind) - { - synchronized (connectionList_) - { - int size = connectionList_.size(); - for (int i=0; i=0; i--) - { - PoolItem p = (PoolItem)connectionList_.elementAt(i); - - // Be conservative about removing in-use connections. - if (p.isInUse()) - { - // Reclaim an in-use connection, only if its maxUseTime limit is exceeded. - if ((properties_.getMaxUseTime() >= 0) && - (p.getInUseTime() >= properties_.getMaxUseTime())) - { - // Limit exceeded, so disconnect and remove the connection. - if (log_ != null || Trace.traceOn_) { - log(ResourceBundleLoader.getText(EXPIRED_MAX_USE_TIME, new String[] {systemName_, userID_} )); - } - if (Trace.traceOn_) { - log(Trace.WARNING, "Disconnecting pooled connection (currently in use) because it has exceeded the maximum use time limit of " + properties_.getMaxUseTime() + " milliseconds."); - } - p.getAS400Object().disconnectAllServices(); - connectionList_.removeElementAt(i); - if (poolListeners != null) - { - ConnectionPoolEvent poolEvent = new ConnectionPoolEvent(p.getAS400Object(), ConnectionPoolEvent.CONNECTION_EXPIRED); //@A5C - poolListeners.fireConnectionExpiredEvent(poolEvent); - } - } - } // if p.inUse() - - - // The remaining cases are for connections that aren't currently in use. - - - // See if the pool item has failed a connection validity pretest. - else if (p.isFailedPretest()) - { - // Failed a validation, so disconnect and remove the connection. - if (log_ != null || Trace.traceOn_) { - log(ResourceBundleLoader.getText(EXPIRED_FAILED_PRETEST, new String[] {systemName_, userID_} )); - } - if (Trace.traceOn_) { - log(Trace.DIAGNOSTIC, "Disconnecting pooled connection (not currently in use) because it has failed a validation pretest."); - } - p.getAS400Object().disconnectAllServices(); - connectionList_.removeElementAt(i); - if (poolListeners != null) - { - ConnectionPoolEvent poolEvent = new ConnectionPoolEvent(p.getAS400Object(), ConnectionPoolEvent.CONNECTION_EXPIRED); - poolListeners.fireConnectionExpiredEvent(poolEvent); - } - } - - - // See if the connection has exceeded the maximum inactivity time. - else if ((properties_.getMaxInactivity() >= 0) && - (p.getInactivityTime() >= properties_.getMaxInactivity())) - { - // Limit exceeded, so disconnect and remove the connection. - if (log_ != null || Trace.traceOn_) { - log(ResourceBundleLoader.getText(EXPIRED_INACTIVE, new String[] {systemName_, userID_} )); - } - if (Trace.traceOn_) { - log(Trace.DIAGNOSTIC, "Disconnecting pooled connection (not currently in use) because it has exceeded the maximum inactivity time limit of " + properties_.getMaxInactivity() + " milliseconds."); - } - p.getAS400Object().disconnectAllServices(); - connectionList_.removeElementAt(i); - if (poolListeners != null) - { - ConnectionPoolEvent poolEvent = new ConnectionPoolEvent(p.getAS400Object(), ConnectionPoolEvent.CONNECTION_EXPIRED); //@A5C - poolListeners.fireConnectionExpiredEvent(poolEvent); - } - } - - // See if the connection has exceeded the maximum use count. - else if ((properties_.getMaxUseCount() >= 0) && - (p.getUseCount() >= properties_.getMaxUseCount())) - { - // Limit exceeded, so disconnect and remove the connection. - if (log_ != null || Trace.traceOn_) { - log(ResourceBundleLoader.getText(EXPIRED_MAX_USE_COUNT, new String[] {systemName_, userID_} )); - } - if (Trace.traceOn_) { - log(Trace.DIAGNOSTIC, "Disconnecting pooled connection (not currently in use) because it has exceeded the maximum use count of " + properties_.getMaxUseCount()); - } - p.getAS400Object().disconnectAllServices(); - connectionList_.removeElementAt(i); - if (poolListeners != null) - { - ConnectionPoolEvent poolEvent = new ConnectionPoolEvent(p.getAS400Object(), ConnectionPoolEvent.CONNECTION_EXPIRED); //@A5C //@B2C - poolListeners.fireConnectionExpiredEvent(poolEvent); - } - } - - // See if the connection has exceeded the maximum lifetime. - else if ( (properties_.getMaxLifetime() >= 0) && - (p.getLifeSpan() >= properties_.getMaxLifetime())) - { - // Limit exceeded, so disconnect and remove the connection. - if (log_ != null || Trace.traceOn_) { - log(ResourceBundleLoader.getText(EXPIRED_MAX_LIFETIME, new String[] {systemName_, userID_} )); - } - if (Trace.traceOn_) { - log(Trace.DIAGNOSTIC, "Disconnecting pooled connection (not currently in use) because it has exceeded the maximum lifetime limit of " + properties_.getMaxLifetime() + " milliseconds."); - } - p.getAS400Object().disconnectAllServices(); - connectionList_.removeElementAt(i); - if (poolListeners != null) - { - ConnectionPoolEvent poolEvent = new ConnectionPoolEvent(p.getAS400Object(), ConnectionPoolEvent.CONNECTION_EXPIRED); //@A5C //@B2C - poolListeners.fireConnectionExpiredEvent(poolEvent); - } - } - - }//end 'for' loop - }//@B1A end synchronized - } - - /** - * Removes the connection from the pool if it is due for removal. - * - * @param poolItem The pool item. - * @param poolListeners The pool listeners to which events will be fired. - * @return true if the pool item was found and removed from the pool; false otherwise. - * @exception AS400SecurityException If a security error occured. - * @exception IOException If a communications error occured. - **/ - boolean removeIfExpired(PoolItem poolItem, ConnectionPoolEventSupport poolListeners) - { - if (connectionList_.isEmpty()) return false; - - boolean connectionIsExpired = false; - String expirationStatus = null; - synchronized (connectionList_) - { - expirationStatus = checkConnectionExpiration(poolItem); - if (expirationStatus == NOT_EXPIRED) {} // do nothing - else { - connectionList_.removeElement(poolItem); - connectionIsExpired = true; - } - } - // Now that we're out of the sync block (and the connection has been removed from connectionList_), disconnect the connection. - if (connectionIsExpired) - { - if ((log_ != null || Trace.traceOn_) && expirationStatus != null) - { - log(ResourceBundleLoader.getText(expirationStatus, new String[] {systemName_, userID_} )); - } - if (poolListeners != null) - { - ConnectionPoolEvent poolEvent = new ConnectionPoolEvent(poolItem.getAS400Object(), ConnectionPoolEvent.CONNECTION_EXPIRED); - poolListeners.fireConnectionExpiredEvent(poolEvent); - } - if (Trace.traceOn_) { - log(Trace.DIAGNOSTIC, "Disconnecting pooled connection (not currently in use) because it has expired."); - } - poolItem.getAS400Object().disconnectAllServices(); - } - - return connectionIsExpired; - } - - - //@A4A - /** - * New method to work with AS400ConnectionPool.removeFromPool(). - **/ - boolean removeUnusedElements() - { - synchronized (connectionList_) - { - if (connectionList_.size() > 0) - { - int size = connectionList_.size(); - //if there are no more elements remaining in the list, remove and - //return false. - if (size == 0) - return false; - //incrementally search the list, looking for elements that are not in - //use to remove - - for (int numToCheck = size - 1; numToCheck >= 0; numToCheck--) - { - PoolItem item = (PoolItem)connectionList_.elementAt(numToCheck); - if (!item.isInUse()) - { - if (Trace.traceOn_) { - log(Trace.DIAGNOSTIC, "Disconnecting pooled connection (not currently in use) because removeFromPool() was called."); - } - item.getAS400Object().disconnectAllServices(); - connectionList_.removeElementAt(numToCheck); - } - }// end 'for' loop - }//end if (connectionList_.size() > 0) - }//end synchronized - return true; - } - - /** - * Remove the pool item in the list that contains this AS400 instance. - * The caller takes responsibility for subsequently calling disconnectAllServices(). - * Called by AS400ConnectionPool. - **/ - void removeElement(AS400 systemToFind) - { - synchronized(connectionList_) //@A3A - { - int size = connectionList_.size(); - for (int i=0; i 0) - { - long t = 0; - int size = connectionList_.size(); - for (int i=0; i t || oldest == 0) - { - oldest = i; - t = item.getInactivityTime(); - } - } - } - - //only disconnect oldest item if it is not in use - PoolItem item = (PoolItem)connectionList_.elementAt(oldest); - if (!item.isInUse()) - { - if (Trace.traceOn_) { - log(Trace.DIAGNOSTIC, "Disconnecting pooled connection (not currently in use) during removal of oldest unallocated connections."); - } - item.getAS400Object().disconnectAllServices(); - connectionList_.removeElementAt(oldest); - if (log_ != null || Trace.traceOn_) - log(ResourceBundleLoader.getText("CL_REMOLDCOMP", new String[] {systemName_, userID_} )); - } - }//end if (connectionList_.size() > 0) - }//end 'for' loop - }//end synchronized - }//end shutDownOldest() -} diff --git a/cvsroot/src/com/ibm/as400/access/ConnectionListener.java b/cvsroot/src/com/ibm/as400/access/ConnectionListener.java deleted file mode 100644 index 23f16e4b8..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConnectionListener.java +++ /dev/null @@ -1,34 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConnectionListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.EventListener; - -/** - The ConnectionListener interface provides a listener interface for receiving Connection events. - **/ -public interface ConnectionListener extends EventListener -{ - /** - Invoked when a service has been connected. - @param event The connection event. - **/ - public void connected(ConnectionEvent event); - - /** - Invoked when a service has been disconnected. - @param event The connection event. - **/ - public void disconnected(ConnectionEvent event); -} diff --git a/cvsroot/src/com/ibm/as400/access/ConnectionPool.java b/cvsroot/src/com/ibm/as400/access/ConnectionPool.java deleted file mode 100644 index 3e566662a..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConnectionPool.java +++ /dev/null @@ -1,495 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConnectionPool.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.io.Serializable; -import java.io.IOException; -import java.io.ObjectInputStream; - -/** -* Represents a pool of connections to the system. -* -*

      ConnectionPool objects generate the following events: -*

        -*
      • {@link ConnectionPoolEvent ConnectionPoolEvent} - The events fired are: -*
          -*
        • {@link ConnectionPoolEvent#CONNECTION_CREATED CONNECTION_CREATED}
        • -*
        • {@link ConnectionPoolEvent#CONNECTION_EXPIRED CONNECTION_EXPIRED}
        • -*
        • {@link ConnectionPoolEvent#CONNECTION_POOL_CLOSED CONNECTION_POOL_CLOSED}
        • -*
        • {@link ConnectionPoolEvent#CONNECTION_RELEASED CONNECTION_RELEASED}
        • -*
        • {@link ConnectionPoolEvent#CONNECTION_RETURNED CONNECTION_RETURNED}
        • -*
        • {@link ConnectionPoolEvent#MAINTENANCE_THREAD_RUN MAINTENANCE_THREAD_RUN}
        • -*
        -*
      • -*
      • PropertyChangeEvent
      • -*
      -**/ -public abstract class ConnectionPool implements Serializable -{ - static final long serialVersionUID = 4L; - - /** - Indicates that the CCSID used for new connections is the same as the system default CCSID. - **/ - static final int CCSID_DEFAULT = ConnectionPoolProperties.CCSID_DEFAULT; - - ConnectionPoolProperties properties_ = new ConnectionPoolProperties(); - private boolean inUse_ = false; - private boolean isRunMaintenance_ = true; - //@A4D private boolean useThreads_ = true; - transient PoolMaintenance maintenance_; // Maintenance thread. - transient PropertyChangeSupport changes_; - transient ConnectionPoolEventSupport poolListeners_; // Manage the ConnectionPoolEvent listeners. - - public ConnectionPool() - { -//@CRS properties_ = new ConnectionPoolProperties(); -//@CRS initializeTransient(); - } - - /** - * Adds a ConnectionPoolListener. - * @param listener The ConnectionPoolListener. - * @see #removeConnectionPoolListener - **/ - public void addConnectionPoolListener(ConnectionPoolListener listener) - { - synchronized(this) - { - if (poolListeners_ == null) poolListeners_ = new ConnectionPoolEventSupport(); - } - poolListeners_.addConnectionPoolListener(listener); - } - - /** - * Adds a PropertyChangeListener. - * @param listener The PropertyChangeListener. - * @see #removePropertyChangeListener - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - synchronized(this) - { - if (changes_ == null) changes_ = new PropertyChangeSupport(this); - changes_.addPropertyChangeListener(listener); - properties_.addPropertyChangeListener(listener); - } - } - - /** - * Removes any connections that have exceeded the maximum inactivity time, replaces any - * connections that have aged past maximum usage or maximum lifetime, and removes any - * connections that have been in use too long. - **/ - abstract void cleanupConnections(); - - /** - * Closes the connection pool. - * @exception ConnectionPoolException If a pool error occurs. - **/ - public abstract void close() throws ConnectionPoolException; - - /** - * Closes the connection pool if not explicitly closed by the caller. - * @exception Throwable If an error occurs. - **/ - protected void finalize() throws Throwable - { - // Terminate the maintenance thread, if it's still alive. - if (maintenance_ != null && maintenance_.isAlive()) { - maintenance_.shutdown(); - } - super.finalize(); - } - - /** - * Returns the CCSID that is used when creating connections. - * The default value is the system default CCSID as determined by the AS400 class. - * @return The CCSID, or {@link #CCSID_DEFAULT CCSID_DEFAULT} if the system default CCSID is used. - **/ - int getCCSID() - { - return properties_.getCCSID(); - } - - /** - * Returns the time interval for how often the maintenance daemon is run. - * The default value is 300000 milliseconds (5 minutes). - * @return Number of milliseconds. - **/ - public long getCleanupInterval() - { - return properties_.getCleanupInterval(); - } - - /** - * Returns the maximum number of connections. - * The default value is -1 indicating no limit to the number of connections. - * @return Maximum number of connections. - **/ - public int getMaxConnections() - { - return properties_.getMaxConnections(); - } - - /** - * Returns the maximum amount of inactive time before an available connection is closed. -* The maintenance daemon closes the connection if the threshold is reached. -* The default value is 60 minutes. A value of -1 indicates that there is no limit. - * @return Number of milliseconds. - **/ - public long getMaxInactivity() - { - return properties_.getMaxInactivity(); - } - - /** - * Returns the maximum life for an available connection. -* The maintenance daemon closes the available connection if the threshold is reached. -* The default value is a 24 hour limit. A value of -1 indicates that there is no limit. -* @return Number of milliseconds. - **/ - public long getMaxLifetime() - { - return properties_.getMaxLifetime(); - } - - /** - * Returns the maximum number of times a connection can be used before it is replaced in the pool. - * The default value is -1. A value of -1 indicates that there is no limit. - * @return Maximum usage count. - **/ - public int getMaxUseCount() - { - return properties_.getMaxUseCount(); - } - - /** - * Returns the maximum amount of time a connection can be in use before it is closed and returned to the pool. - * The default value is -1 indicating that there is no limit. - * @return Number of milliseconds. - **/ - public long getMaxUseTime() - { - return properties_.getMaxUseTime(); - } - - /** - * Returns the connection pool properties used by the maintenance daemon. - * @return The ConnectionPoolProperties object. - **/ -//@CRS ConnectionPoolProperties getProperties() -//@CRS { -//@CRS return properties_; -//@CRS } - - /** - * Initializes the transient data. - **/ - private void initializeTransient() - { -//@CRS changes_ = new PropertyChangeSupport(this); -//@CRS poolListeners_ = new ConnectionPoolEventSupport(); - -// addPropertyChangeListener(new PropertyChangeListener() //@A2A -// { -// public void propertyChange(PropertyChangeEvent event) -// { -// String property = event.getPropertyName(); - -// if (property.equals("cleanupInterval")) -// { -// runMaintenance(false); -// } -// else if (property.equals("maxConnections")) -// { -// boolean reduced = false; -// Integer newValue = (Integer)event.getNewValue(); -// Integer oldValue = (Integer)event.getOldValue(); -// if (oldValue.intValue() == -1 || oldValue.intValue() > newValue.intValue()) //@A2C -// reduced = true; - -// runMaintenance(reduced); -// } -// else if (property.equals("runMaintenance")) -// { -// Boolean newValue = (Boolean)event.getNewValue(); -// if (!newValue.booleanValue() && maintenance_ != null && maintenance_.isRunning()) -// maintenance_.setRunning(false); -// if (newValue.booleanValue() && maintenance_ != null && !maintenance_.isRunning()) //@A3A -// maintenance_.setRunning(true); //@A3A -// } -// } -// }); - } - - /** - * Indicates whether the pool is in use. - * Used for checking state conditions. The default is false. - * @return true if the pool is in use; false otherwise. - **/ - synchronized boolean isInUse() - { - return inUse_; - } - - /** - * Indicates whether connections are pretested before they are allocated to requesters. - * Pretesting verifies that the connection is still valid. - * By default, connections are not pretested. - *

      Note: The pretestConnections property is not fully effective until IBM i 7.1. - * @return true if connections are pretested before being allocated; false otherwise. - * @see AS400#isConnectionAlive - **/ - public boolean isPretestConnections() - { - return properties_.isPretestConnections(); - } - - /** - * Indicates whether the maintenance thread is used to cleanup expired connections. - * The default is true. - * @return true if expired connection are cleaned up by the maintenance thread; false otherwise. - **/ - public boolean isRunMaintenance() - { - return isRunMaintenance_; - } - - /** - * Indicates whether threads are used in communication with the host servers and for running - * maintenance. This property affects AS400ConnectionPool and not AS400JDBCConnectionPool - * which is written to the JDBC specification. - * The default value is true. - * @return true if threads are used; false otherwise. - **/ - public boolean isThreadUsed() - { - //@A4D return useThreads_; - return properties_.isThreadUsed(); //@A4A - } - - /** - * Deserializes and initializes transient data. - * @exception IOException If a file I/O error occurs. - * @exception ClassNotFoundException If a file error occurs. - **/ - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - - initializeTransient(); - } - - /** - * Removes a PropertyChangeListener. - * @param listener The PropertyChangeListener. - * @see #addPropertyChangeListener - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (changes_ != null) changes_.removePropertyChangeListener(listener); - properties_.removePropertyChangeListener(listener); - } - - /** - * Removes a ConnectionPoolListener. - * @param listener The ConnectionPoolListener. - * @see #addConnectionPoolListener - **/ - public void removeConnectionPoolListener(ConnectionPoolListener listener) - { - if (poolListeners_ != null) poolListeners_.removeConnectionPoolListener(listener); - } - - //@A2A - /** - * Run cleanupConnections(). - * @param reduced true if need to check current num connections; false otherwise. - **/ - abstract void runMaintenance(boolean reduced); - - /** - * Sets the CCSID to use when creating connections. - * The default value is the system default CCSID as determined by the AS400 class. - * @param ccsid The CCSID to use for connections in the pool, or {@link #CCSID_DEFAULT CCSID_DEFAULT} to indicate that the system default CCSID should be used. - **/ - void setCCSID(int ccsid) - { - properties_.setCCSID(ccsid); - } - - /** - * Sets the time interval for how often the maintenance daemon is run. - * The default value is 300000 milliseconds or 5 minutes. - * @param cleanupInterval The number of milliseconds. - **/ - public void setCleanupInterval(long cleanupInterval) - { - properties_.setCleanupInterval(cleanupInterval); - runMaintenance(false); - -//@CRS if (getCleanupInterval() == 0) - if (cleanupInterval == 0) setRunMaintenance(false); - } - - /** - * Sets whether the pool is in use. - * Used for setting state conditions. - * @param inUse true if the pool is in use; false otherwise. - **/ - synchronized void setInUse(boolean inUse) - { - inUse_ = inUse; - } - - /** - * Sets the maximum number of connections. - * The default value is -1 indicating no limit to the number of connections. - * @param maxConnections Maximum number of connections. - **/ - public void setMaxConnections(int maxConnections) - { - int oldValue = getMaxConnections(); - properties_.setMaxConnections(maxConnections); - boolean reduced = (oldValue == -1 || oldValue > maxConnections); - runMaintenance(reduced); - } - - /** - * Sets the maximum amount of inactive time before an available connection is closed. -* The maintenance daemon closes the connection if the threshold is reached. -* The default value is 60 minutes. A value of -1 indicates that there is no limit. - * @param maxInactivity Number of milliseconds. - **/ - public void setMaxInactivity(long maxInactivity) - { - properties_.setMaxInactivity(maxInactivity); - } - - /** - * Sets the maximum life for an available connection. -* The maintenance daemon closes the available connection if the threshold is reached. -* The default value is a 24 hour limit. A value of -1 indicates that there is no limit. - * @param maxLifetime Number of milliseconds. - **/ - public void setMaxLifetime(long maxLifetime) - { - properties_.setMaxLifetime(maxLifetime); - } - - /** - * Sets the maximum number of times a connection can be used before it is replaced in the pool. - * The default value is -1. A value of -1 indicates that there is no limit. - * @param maxUseCount Maximum usage count. - **/ - public void setMaxUseCount(int maxUseCount) - { - properties_.setMaxUseCount(maxUseCount); - } - - /** - * Sets the maximum amount of time a connection can be in use before it is closed and returned to the pool. - * The default value is -1 indicating that there is no limit. - * @param maxUseTime Number of milliseconds. - **/ - public void setMaxUseTime(long maxUseTime) - { - properties_.setMaxUseTime(maxUseTime); - } - - /** - * Sets whether connections are pretested before they are allocated to requesters. - * Pretesting verifies that the connection is still valid. - * By default, connections are not pretested. - *

      Note: The pretestConnections property is not fully effective until IBM i 7.1. - * @param pretest If connections are pretested before being allocated. - * @see AS400#isConnectionAlive - **/ - public void setPretestConnections(boolean pretest) - { - properties_.setPretestConnections(pretest); - } - - /** - * Sets whether the Toolbox does periodic maintenance on the connection pool to clean up - * expired connections. If setThreadUsed is true, the Toolbox starts an extra thread to - * perform maintenance. If setThreadUsed is false, the Toolbox will perform maintenance - * on the user's thread when it uses the connection pool. - * This method and {@link #setThreadUsed setThreadUsed} can be set - * in interchangeable order. - * The default value is true. - * @param cleanup If expired connections are cleaned up by the maintenance daemon. - **/ - public void setRunMaintenance(boolean cleanup) - { - String property = "runMaintenance"; - -// Boolean oldValue = new Boolean(isRunMaintenance_); -// Boolean newValue = new Boolean(cleanup); - boolean oldValue = isRunMaintenance_; - - isRunMaintenance_ = cleanup; - if (changes_ != null) changes_.firePropertyChange(property, new Boolean(oldValue), new Boolean(cleanup)); - - if (maintenance_ != null) - { - //@CRS: We don't care if maintenance is currently running or not, - // we just want to tell it to either run or not, from now on. - maintenance_.setRunning(cleanup); - } - } - - /** - * Sets whether the IBM Toolbox for Java uses additional threads. - * The Toolbox creates additional threads for various purposes, including: - *

        - *
      • for communication with the host servers; and
      • - *
      • for running pool maintenance.
      • - *
      - * Letting the IBM Toolbox for Java use additional threads will be beneficial - * to performance, but turning threads off may be necessary if your application needs to be compliant - * with the Enterprise Java Beans specification. The threadUsed property cannot be changed once - * the pool is in use. This property affects AS400ConnectionPool and not AS400JDBCConnectionPool, - * which is written to the JDBC specification. This method and - * {@link #setRunMaintenance setRunMaintenance} can be called - * in interchangeable order. - * The default value is true. - * @param useThreads true to use additional threads; false otherwise. - **/ - public void setThreadUsed(boolean useThreads) - { - //@A4D Moved code to ConnectionPoolProperties - //@A4D String property = "threadUsed"; - //@A4D if (isInUse()) - //@A4D throw new ExtendedIllegalStateException(property, ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - //@A4D Boolean oldValue = new Boolean(isThreadUsed()); - //@A4D Boolean newValue = new Boolean(useThreads); - - //@A4D useThreads_ = useThreads; - //@A4D changes_.firePropertyChange(property, oldValue, newValue); - properties_.setThreadUsed(useThreads, isInUse()); //@A4A - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConnectionPoolBeanInfo.java b/cvsroot/src/com/ibm/as400/access/ConnectionPoolBeanInfo.java deleted file mode 100644 index ceda49064..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConnectionPoolBeanInfo.java +++ /dev/null @@ -1,183 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConnectionPoolBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - - -/** -* Provides bean information for the ConnectionPool class. -**/ -public class ConnectionPoolBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private final static Class beanClass = ConnectionPool.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = { changed }; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor runMaintenance = new PropertyDescriptor("runMaintenance", beanClass, - "isRunMaintenance", "setRunMaintenance"); - runMaintenance.setBound(true); - runMaintenance.setConstrained(false); - runMaintenance.setDisplayName(loader_.getText("PROP_NAME_CP_RUN_MAINTENANCE")); - runMaintenance.setShortDescription(loader_.getText("PROP_DESC_CP_RUN_MAINTENANCE")); - - PropertyDescriptor threadUsed = new PropertyDescriptor("threadUsed", beanClass, - "isThreadUsed", "setThreadUsed"); - threadUsed.setBound(true); - threadUsed.setConstrained(false); - threadUsed.setDisplayName(loader_.getText("PROP_NAME_CP_THREAD_USED")); - threadUsed.setShortDescription(loader_.getText("PROP_DESC_CP_THREAD_USED")); - - //@A2A Added 6 below property descriptors. - PropertyDescriptor cleanupInterval = new PropertyDescriptor("cleanupInterval", beanClass, - "getCleanupInterval", "setCleanupInterval"); - cleanupInterval.setBound(true); - cleanupInterval.setConstrained(false); - cleanupInterval.setDisplayName(loader_.getText("PROP_NAME_CPP_CLEANUP_INTERVAL")); - cleanupInterval.setShortDescription(loader_.getText("PROP_DESC_CPP_CLEANUP_INTERVAL")); - - PropertyDescriptor maxConnections = new PropertyDescriptor("maxConnections", beanClass, - "getMaxConnections", "setMaxConnections"); - maxConnections.setBound(true); - maxConnections.setConstrained(false); - maxConnections.setDisplayName(loader_.getText("PROP_NAME_CPP_MAX_CONNECTIONS")); - maxConnections.setShortDescription(loader_.getText("PROP_DESC_CPP_MAX_CONNECTIONS")); - - PropertyDescriptor maxInactivity = new PropertyDescriptor("maxInactivity", beanClass, - "getMaxInactivity", "setMaxInactivity"); - maxInactivity.setBound(true); - maxInactivity.setConstrained(false); - maxInactivity.setDisplayName(loader_.getText("PROP_NAME_CPP_MAX_INACTIVITY")); - maxInactivity.setShortDescription(loader_.getText("PROP_DESC_CPP_MAX_INACTIVITY")); - - PropertyDescriptor maxLifetime = new PropertyDescriptor("maxLifetime", beanClass, - "getMaxLifetime", "setMaxLifetime"); - maxLifetime.setBound(true); - maxLifetime.setConstrained(false); - maxLifetime.setDisplayName(loader_.getText("PROP_NAME_CPP_MAX_LIFETIME")); - maxLifetime.setShortDescription(loader_.getText("PROP_DESC_CPP_MAX_LIFETIME")); - - PropertyDescriptor maxUseCount = new PropertyDescriptor("maxUseCount", beanClass, - "getMaxUseCount", "setMaxUseCount"); - maxUseCount.setBound(true); - maxUseCount.setConstrained(false); - maxUseCount.setDisplayName(loader_.getText("PROP_NAME_CPP_MAX_USE_COUNT")); - maxUseCount.setShortDescription(loader_.getText("PROP_DESC_CPP_MAX_USE_COUNT")); - - PropertyDescriptor maxUseTime = new PropertyDescriptor("maxUseTime", beanClass, - "getMaxUseTime", "setMaxUseTime"); - maxUseTime.setBound(true); - maxUseTime.setConstrained(false); - maxUseTime.setDisplayName(loader_.getText("PROP_NAME_CPP_MAX_USE_TIME")); - maxUseTime.setShortDescription(loader_.getText("PROP_DESC_CPP_MAX_USE_TIME")); - - PropertyDescriptor pretestConnections = new PropertyDescriptor("pretestConnections", beanClass, - "isPretestConnections", "setPretestConnections"); - pretestConnections.setBound(true); - pretestConnections.setConstrained(false); - pretestConnections.setDisplayName(loader_.getText("PROP_NAME_CPP_PRETEST_CONNECTIONS")); - pretestConnections.setShortDescription(loader_.getText("PROP_DESC_CPP_PRETEST_CONNECTIONS")); - - - - properties_ = new PropertyDescriptor[] { runMaintenance, threadUsed, - cleanupInterval, maxConnections, maxInactivity, maxLifetime, maxUseCount, - maxUseTime, pretestConnections }; - - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - //@A1D public BeanInfo[] getAdditionalBeanInfo() - //@A1D { - //@A1D return new BeanInfo[] { new ConnectionPoolPropertiesBeanInfo() }; - //@A1D} - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the propertyChange event - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the "path" property - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConnectionPoolEvent.java b/cvsroot/src/com/ibm/as400/access/ConnectionPoolEvent.java deleted file mode 100644 index 11783f80e..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConnectionPoolEvent.java +++ /dev/null @@ -1,99 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConnectionPoolEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - The ConnectionPoolEvent class represents a connection pool event. -**/ -public class ConnectionPoolEvent extends java.util.EventObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - /** - Event ID indicating that a connection pool has been closed. - A call to getSource() on an event with this ID will return a reference to a ConnectionPool object. - **/ - public static final int CONNECTION_POOL_CLOSED = 0; - - /** - Event ID indicating that a connection has been created. - A call to getSource() on an event with this ID will return a reference to an AS400 object - if fired from an AS400ConnectionPool; or, a reference to a javax.sql.PooledConnection object - if fired from an AS400JDBCConnectionPool. - **/ - public static final int CONNECTION_CREATED = 1; - - /** - Event ID indicating that a connection has been given to an application. - A call to getSource() on an event with this ID will return a reference to an AS400 object - if fired from an AS400ConnectionPool; or, a reference to a javax.sql.PooledConnection object - if fired from an AS400JDBCConnectionPool. - **/ - public static final int CONNECTION_RELEASED = 2; - - /** - Event ID indicating that a connection has been returned to the pool. - A call to getSource() on an event with this ID will return a reference to an AS400 object - if fired from an AS400ConnectionPool; or, a reference to a javax.sql.PooledConnection object - if fired from an AS400JDBCConnectionPool. - **/ - public static final int CONNECTION_RETURNED = 3; - - /** - Event ID indicating that a connection has been cleaned up by the - maintenance thread because one or more of its properties expired. - A call to getSource() on an event with this ID will return a reference to an AS400 object - if fired from an AS400ConnectionPool; or, a reference to a javax.sql.PooledConnection object - if fired from an AS400JDBCConnectionPool. - **/ - public static final int CONNECTION_EXPIRED = 4; - - /** - Event ID indicating that the maintenance thread is running. - A call to getSource() on an event with this ID will return a reference to a ConnectionPool object. - **/ - public static final int MAINTENANCE_THREAD_RUN = 5; - - - private int eventID_; // event identifier - - - /** - * Constructs a ConnectionPoolEvent object. It uses the specified source and - * eventID. - * @param source The object where the event originated. - * @param eventID The event identifier. - **/ - public ConnectionPoolEvent(Object source, - int eventID) - { - super(source); - eventID_ = eventID; - } - - - /** - * Returns the identifier for this event. - * @return The identifier for this event. - **/ - public int getID() - { - return eventID_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConnectionPoolEventSupport.java b/cvsroot/src/com/ibm/as400/access/ConnectionPoolEventSupport.java deleted file mode 100644 index 8f3192de9..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConnectionPoolEventSupport.java +++ /dev/null @@ -1,147 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConnectionPoolEventSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Vector; - -/** -* The ConnectionPoolEventSupport class represents an event support -* facility for maintaining and notifying listeners of connection pool events. -**/ -class ConnectionPoolEventSupport -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private Vector connectionListeners_; // The listener list. - - /** - * Constructs a default ConnectionPoolEventSupport object. - **/ - public ConnectionPoolEventSupport() - { - connectionListeners_ = new Vector(); - } - - - /** - * Adds a ConnectionPoolListener to the internal list. - * @param listener The listener. - **/ - public void addConnectionPoolListener(ConnectionPoolListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - connectionListeners_.addElement(listener); - } - - /** - * Fires the connection pool closed event. - * @param event The ConnectionPoolEvent. - **/ - public void fireClosedEvent(ConnectionPoolEvent event) - { - Vector targets = (Vector) connectionListeners_.clone(); - for (int i=0; i< targets.size(); i++) - { - ConnectionPoolListener target = (ConnectionPoolListener) targets.elementAt(i); - target.connectionPoolClosed(event); - } - } - - /** - * Fires the connection created event. - * @param event The ConnectionPoolEvent. - **/ - public void fireConnectionCreatedEvent(ConnectionPoolEvent event) - { - Vector targets = (Vector) connectionListeners_.clone(); - for (int i=0; i< targets.size(); i++) - { - ConnectionPoolListener target = (ConnectionPoolListener) targets.elementAt(i); - target.connectionCreated(event); - } - } - - - /** - * Fires the connection expired event. - * @param event The ConnectionPoolEvent. - **/ - public void fireConnectionExpiredEvent(ConnectionPoolEvent event) - { - Vector targets = (Vector) connectionListeners_.clone(); - for (int i=0; i< targets.size(); i++) - { - ConnectionPoolListener target = (ConnectionPoolListener) targets.elementAt(i); - target.connectionExpired(event); - } - } - - - /** - * Fires the maintenance thread run event. - * @param event The ConnectionPoolEvent. - **/ - public void fireMaintenanceThreadRun(ConnectionPoolEvent event) - { - Vector targets = (Vector) connectionListeners_.clone(); - for (int i=0; i< targets.size(); i++) - { - ConnectionPoolListener target = (ConnectionPoolListener) targets.elementAt(i); - target.maintenanceThreadRun(event); - } - } - - /** - * Fires the connection released event. - * @param event The ConnectionPoolEvent. - **/ - public void fireConnectionReleasedEvent(ConnectionPoolEvent event) - { - Vector targets = (Vector) connectionListeners_.clone(); - for (int i=0; i< targets.size(); i++) - { - ConnectionPoolListener target = (ConnectionPoolListener) targets.elementAt(i); - target.connectionReleased(event); - } - } - - - /** - * Fires the connection returned event. - * @param event The ConnectionPoolEvent. - **/ - public void fireConnectionReturnedEvent(ConnectionPoolEvent event) - { - Vector targets = (Vector) connectionListeners_.clone(); - for (int i=0; i< targets.size(); i++) - { - ConnectionPoolListener target = (ConnectionPoolListener) targets.elementAt(i); - target.connectionReturned(event); - } - } - - - /** - * Removes a ConnectionPoolListener from the internal list. - * @param listener The listener to be removed. - **/ - public void removeConnectionPoolListener(ConnectionPoolListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - connectionListeners_.removeElement(listener); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/ConnectionPoolException.java b/cvsroot/src/com/ibm/as400/access/ConnectionPoolException.java deleted file mode 100644 index fe40819d2..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConnectionPoolException.java +++ /dev/null @@ -1,114 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConnectionPoolException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** -* The ConnectionPoolException class represents an exception -* which indicates that a problem occurred with the connection pool. -**/ -public class ConnectionPoolException extends Exception -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - private Exception exception_; - private int returnCode_ = UNKNOWN_ERROR; //@A1A - - /** - * The return code indicating that the minimum and maximum pool sizes conflict. - **/ - public static final int CONFLICTING_POOL_SIZES = 3; //@B0A - - /** - The return code indicating that max connection limit has been reached. - **/ - public static final int MAX_CONNECTIONS_REACHED = 1; //@A1A - - /** - The return code indicating that an unknown error occured. - **/ - static final int UNKNOWN_ERROR = 2; //@A1A - - /** - * Constructs a default ConnectionPoolException object. - **/ - ConnectionPoolException() - { - super(); - } - - /** - * Constructs a ConnectionPoolException object. - * @param exception The exception. - **/ - ConnectionPoolException(Exception exception) - { - super(exception.getMessage()); - exception_ = exception; - } - - //@A1A - /** - * Constructs a ConnectionPoolException object. - * @param returnCode The return code. - **/ - ConnectionPoolException(int returnCode) - { - super(ResourceBundleLoader.getText(getMRIKey(returnCode))); - returnCode_ = returnCode; - } - - - //@A1A - /** - * Returns the text associated with the return code. - * @param returnCode The return code associated with this exception. - * @return The text string which describes the error. - **/ - static String getMRIKey(int returnCode) // This method is required so the message can be created and sent in super() - { - switch (returnCode) - { - case MAX_CONNECTIONS_REACHED: - return "EXC_MAX_CONN_REACHED"; - case CONFLICTING_POOL_SIZES: //@B0A - return "EXC_CONFLICT_POOL_SIZES"; //@B0A - default: - return "EXC_UNKNOWN"; // Bad return code was provided. - } - } - - /** - * Returns the original exception. - * @return The exception. - **/ - public Exception getException() - { - return exception_; - } - - /** - * Returns the return code. - * @return The return code. - **/ - public int getReturnCode() - { - return returnCode_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/ConnectionPoolListener.java b/cvsroot/src/com/ibm/as400/access/ConnectionPoolListener.java deleted file mode 100644 index f2aa7b1a5..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConnectionPoolListener.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConnectionPoolListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; -/** - The ConnectionPoolListener interface provides a listener - interface for receiving Connection Pool events. -**/ - -public interface ConnectionPoolListener extends java.util.EventListener -{ - /** - * Invoked when a connection has been created. - * @param event The connection pool event. - **/ - public void connectionCreated(ConnectionPoolEvent event); - - /** - * Invoked when a connection is cleaned up by the maintenance thread - * because one or more of its properties has expired. - * @param event The connection pool event. - **/ - public void connectionExpired(ConnectionPoolEvent event); - - /** - * Invoked when a pool has been closed. - * @param event The connection pool event. - **/ - public void connectionPoolClosed(ConnectionPoolEvent event); - - /** - * Invoked when a connection has been given out. - * @param event The connection pool event. - **/ - public void connectionReleased(ConnectionPoolEvent event); - - /** - * Invoked when a connection has been returned. - * @param event The connection pool event. - **/ - public void connectionReturned(ConnectionPoolEvent event); - - /** - * Invoked when the maintenance thread runs. - * @param event The connection pool event. - **/ - public void maintenanceThreadRun(ConnectionPoolEvent event); -} diff --git a/cvsroot/src/com/ibm/as400/access/ConnectionPoolProperties.java b/cvsroot/src/com/ibm/as400/access/ConnectionPoolProperties.java deleted file mode 100644 index d51eb08c4..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConnectionPoolProperties.java +++ /dev/null @@ -1,410 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConnectionPoolProperties.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; - -/** -* Contains properties for maintaining a ConnectionPool. -* It is used to control the behavior of the connection pool. -* -* A maintenance daemon is used to validate the connection status and determine if the connection should -* be closed based on the timeout limits. The daemon can be set to run at any defined time interval. -**/ -class ConnectionPoolProperties implements Serializable -{ - static final long serialVersionUID = 4L; - - /** - Indicates that the CCSID used for new connections is the same as the system default CCSID. - **/ - static final int CCSID_DEFAULT = -1; - - // Default setting for pretestConnections property. - private static boolean defaultPretestConnections_ = false; - static - { - String propVal = SystemProperties.getProperty(SystemProperties.CONNECTIONPOOL_PRETEST); - if (propVal != null) - { - try { - defaultPretestConnections_ = Boolean.valueOf(propVal).booleanValue(); - } - catch (Exception e) { - Trace.log(Trace.WARNING, "Error retrieving default pretestConnections property value:", e); - } - } - } - - private long cleanupInterval_ = 300000; // 5 minutes maintenance intervals - private int maxConnections_ = -1; // maximum number of active connections for the datasource. - private long maxInactivity_ = 3600000; // 60 minutes - private long maxLifetime_ = 86400000; // 24 hours - private int maxUseCount_ = -1; // maximum number of times connection can be used. - private long maxUseTime_ = -1; // maximum usage time, release after this period, -1 for never - private boolean pretestConnections_ = defaultPretestConnections_; - private boolean useThreads_ = true; - private int ccsid_ = -1; // CCSID to use when creating connections - - transient private PropertyChangeSupport changes_; - - /** - * Constructs a default ConnectionPoolProperties object. - **/ - public ConnectionPoolProperties() - { -// initializeTransient(); - } - - /** - * Adds a PropertyChangeListener. - * @param listener The PropertyChangeListener. - * @see #removePropertyChangeListener - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - synchronized(this) - { - if (changes_ == null) changes_ = new PropertyChangeSupport(this); - changes_.addPropertyChangeListener(listener); - } - } - - /** - * Indicates whether connections are pretested before being allocated to a requester. - * The default value is false. - * @return true if connections are pretested; false otherwise. - **/ - public boolean isPretestConnections() - { - return pretestConnections_; - } - - /** - * Indicates whether threads are used in communication with the host servers. - * The default value is true. - * @return true if threads are used; false otherwise. - **/ - public boolean isThreadUsed() - { - return useThreads_; - } - - - /** - * Returns the CCSID used for connections in the pool. - * Special value {@link #CCSID_DEFAULT CCSID_DEFAULT} is the default. - * @return The CCSID. - **/ - public int getCCSID() - { - return ccsid_; - } - - - /** - * Returns the time interval for how often the maintenance daemon is run. - * The default value is 300000 milliseconds. - * @return Number of milliseconds. - **/ - public long getCleanupInterval() - { - return cleanupInterval_; - } - - /** - * Returns the maximum number of connections. - * The default value is -1 indicating no limit to the number of connections. - * @return Maximum number of connections. - **/ - public int getMaxConnections() - { - return maxConnections_; - } - - /** - * Returns the maximum amount of inactive time before the connection is closed. - * The maintenance daemon closes the connection if the threshold is reached. - * The default value is 60 minutes. A value of -1 indicates that there is no limit. - * @return Number of milliseconds. - **/ - public long getMaxInactivity() - { - return maxInactivity_; - } - - /** - * Returns the maximum life for an available connection. - * The maintenance daemon closes the available connection if the threshold is reached. - * The default value is a 24 hour limit. A value of -1 indicates that there is no limit. - * @return Number of milliseconds. - **/ - public long getMaxLifetime() - { - return maxLifetime_; - } - - /** - * Returns the maximum number of times a connection can be used before it is replaced in the pool. - * The default value is -1. A value of -1 indicates that there is no limit. - * @return Maximum usage count. - **/ - public int getMaxUseCount() - { - return maxUseCount_; - } - - /** - * Returns the maximum amount of time a connection can be in use before it is closed and returned to the pool. - * The default value is -1 indicating that there is no limit. - * @return Number of milliseconds. - **/ - public long getMaxUseTime() - { - return maxUseTime_; - } - - /** - * Initializes the transient data. - **/ -// private void initializeTransient() -// { -// changes_ = new PropertyChangeSupport(this); -// } - - /** - * Deserializes and initializes transient data. - * @exception IOException If a file I/O error occurs. - * @exception ClassNotFoundException If a file error occurs. - **/ - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - -// initializeTransient(); - } - - /** - * Removes a PropertyChangeListener. - * @param listener The PropertyChangeListener. - * @see #addPropertyChangeListener - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (changes_ != null) changes_.removePropertyChangeListener(listener); - } - - /** - * Sets the CCSID used for connections in the pool. - * The default value is the system default CCSID as determined by the AS400 class. - * @param ccsid The CCSID. - * Special value {@link #CCSID_DEFAULT CCSID_DEFAULT} is the default. - **/ - public void setCCSID(int ccsid) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "ConnectionPoolProperties.setCCSID("+ccsid+")"); - - String property = "ccsid"; - - if (ccsid < CCSID_DEFAULT || ccsid > 65535) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - int oldValue = ccsid_; - - ccsid_ = ccsid; - if (changes_ != null) changes_.firePropertyChange(property, new Integer(oldValue), new Integer(ccsid)); - } - - /** - * Sets the time interval for how often the maintenance daemon is run. - * The default value is 300000 milliseconds or 5 minutes. - * @param cleanupInterval The number of milliseconds. - **/ - public void setCleanupInterval(long cleanupInterval) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "ConnectionPoolProperties.setCleanupInterval("+cleanupInterval+")"); - - String property = "cleanupInterval"; - - if (cleanupInterval < 0) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - -// Long oldValue = new Long(getCleanupInterval()); -// Long newValue = new Long(cleanupInterval); - long oldValue = cleanupInterval_; - - cleanupInterval_ = cleanupInterval; - if (changes_ != null) changes_.firePropertyChange(property, new Long(oldValue), new Long(cleanupInterval)); - } - - /** - * Sets the maximum number of connections. - * The default value is -1 indicating no limit to the number of connections. - * @param maxConnections Maximum number of connections. - **/ - public void setMaxConnections(int maxConnections) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "ConnectionPoolProperties.setMaxConnections("+maxConnections+")"); - - String property = "maxConnections"; - if (maxConnections < -1) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - -// Integer oldValue = new Integer(getMaxConnections()); -// Integer newValue = new Integer(maxConnections); - int oldValue = maxConnections_; - - maxConnections_ = maxConnections; - if (changes_ != null) changes_.firePropertyChange(property, new Integer(oldValue), new Integer(maxConnections)); - } - - /** - * Sets the maximum amount of inactive time before the connection is closed. - * The maintenance daemon closes the connection if the threshold is reached. - * The default value is 60 minutes. A value of -1 indicates that there is no limit. - * @param maxInactivity Number of milliseconds. - **/ - public void setMaxInactivity(long maxInactivity) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "ConnectionPoolProperties.setMaxInactivity("+maxInactivity+")"); - - String property = "maxInactivity"; - if (maxInactivity < -1) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - -// Long oldValue = new Long(getMaxInactivity()); -// Long newValue = new Long(maxInactivity); - long oldValue = maxInactivity_; - - maxInactivity_ = maxInactivity; - if (changes_ != null) changes_.firePropertyChange(property, new Long(oldValue), new Long(maxInactivity)); - } - - /** - * Sets the maximum life for an available connection. - * The maintenance daemon closes the available connection if the threshold is reached. - * The default value is a 24 hour limit. A value of -1 indicates that there is no limit. - * @param maxLifetime Number of milliseconds. - **/ - public void setMaxLifetime(long maxLifetime) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "ConnectionPoolProperties.setMaxLifetime("+maxLifetime+")"); - - String property = "maxLifetime"; - if (maxLifetime < -1) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - -// Long oldValue = new Long(getMaxLifetime()); -// Long newValue = new Long(maxLifetime); - long oldValue = maxLifetime_; - - maxLifetime_ = maxLifetime; - if (changes_ != null) changes_.firePropertyChange(property, new Long(oldValue), new Long(maxLifetime)); - } - - - /** - * Sets whether connections are pretested before being allocated to requesters. - * The default value is false. - * @param pretest true to pretest connections; false otherwise. - **/ - public void setPretestConnections(boolean pretest) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "ConnectionPoolProperties.setPretestConnections("+pretest+")"); - - String property = "pretestConnections"; - boolean oldValue = pretestConnections_; - - pretestConnections_ = pretest; - if (changes_ != null) changes_.firePropertyChange(property, new Boolean(oldValue), new Boolean(pretest)); - - } - - - /** - * Sets whether the IBM Toolbox for Java uses threads in communication with the host servers - * and whether the pool uses threads for running maintenance. - * The default value is true. - * @param useThreads true to use threads; false otherwise. - **/ - public void setThreadUsed(boolean useThreads, boolean isInUse) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "ConnectionPoolProperties.setThreadUsed("+useThreads+","+isInUse+")"); - - String property = "threadUsed"; - if (isInUse) - throw new ExtendedIllegalStateException(property, ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - -// Boolean oldValue = new Boolean(isThreadUsed()); -// Boolean newValue = new Boolean(useThreads); - boolean oldValue = useThreads_; - - useThreads_ = useThreads; - if (changes_ != null) changes_.firePropertyChange(property, new Boolean(oldValue), new Boolean(useThreads)); - - } - - /** - * Sets the maximum number of times a connection can be used before it is replaced in the pool. - * The default value is -1. A value of -1 indicates that there is no limit. - * @param maxUseCount Maximum usage count. - **/ - public void setMaxUseCount(int maxUseCount) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "ConnectionPoolProperties.setMaxUseCount("+maxUseCount+")"); - - String property = "maxUseCount"; - if (maxUseCount < -1) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - -// Integer oldValue = new Integer(getMaxUseCount()); -// Integer newValue = new Integer(maxUseCount); - int oldValue = maxUseCount_; - - maxUseCount_ = maxUseCount; - if (changes_ != null) changes_.firePropertyChange(property, new Integer(oldValue), new Integer(maxUseCount)); - } - - /** - * Sets the maximum amount of time a connection can be in use before it is closed and returned to the pool. - * The default value is -1 indicating that there is no limit. - * @param maxUseTime Number of milliseconds. - **/ - public void setMaxUseTime(long maxUseTime) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "ConnectionPoolProperties.setMaxUseTime("+maxUseTime+")"); - - String property = "maxUseTime"; - if (maxUseTime < -1) - throw new ExtendedIllegalArgumentException(property, ExtendedIllegalArgumentException.RANGE_NOT_VALID); - -// Long oldValue = new Long(getMaxUseTime()); -// Long newValue = new Long(maxUseTime); - long oldValue = maxUseTime_; - - maxUseTime_ = maxUseTime; - if (changes_ != null) changes_.firePropertyChange(property, new Long(oldValue), new Long(maxUseTime)); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable.java b/cvsroot/src/com/ibm/as400/access/ConvTable.java deleted file mode 100644 index 681e6f40e..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable.java +++ /dev/null @@ -1,380 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; -import java.io.UnsupportedEncodingException; -import java.util.Hashtable; - -// Internal class representing a character set conversion table. -abstract class ConvTable -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - final static char cic_ = '\uFFFF'; // Used for decompression. - final static char ric_ = '\uFFFE'; // Used for decompression. - final static char hbic_ = '\u0000'; // Used for decompression. - final static char pad_ = '\u0000'; // Used for decompression. - - String encoding_; - int ccsid_ = -1; - int bidiStringType_ = BidiStringType.DEFAULT; - - // The highest number of all our supported CCSIDs. There's no point in making the pool larger than it needs to be. We only have a handful of CCSIDs in the 62000 range, so we could use a smaller number to save space and those CCSIDs outside the range just wouldn't get cached. However, 61952 is used extensively, so we might as well max it out. - private static final int LARGEST_CCSID = 62251; - private static final ConvTable[] ccsidPool_ = new ConvTable[LARGEST_CCSID + 1]; - private static final Hashtable converterPool_ = new Hashtable(); - private static final String prefix_ = "com.ibm.as400.access.ConvTable"; - - ConvTable(int ccsid) - { - ccsid_ = ccsid; - encoding_ = ConversionMaps.ccsidToEncoding(ccsid_); - if (encoding_ == null) encoding_ = "" + ccsid_; - - if (Trace.traceOn_) - { - Trace.log(Trace.CONVERSION, "Constructing conversion table for ccsid/encoding: " + ccsid_ + "/" + encoding_); - if (ccsid_ == 0) // See ConvTableJavaMap. - { - if (this instanceof ConvTableJavaMap) - { - Trace.log(Trace.CONVERSION, "This table is a wrapper around a Java table."); - } - else - { - Trace.log(Trace.CONVERSION, "Warning: 0 specified for CCSID when table is not a Java table."); - } - } - } - } - - // Perform an OS/400 CCSID to Unicode conversion. - String byteArrayToString(byte[] source, int offset, int length, int type) - { - return byteArrayToString(source, offset, length, new BidiConversionProperties(type)); - } - - abstract String byteArrayToString(byte[] source, int offset, int length, BidiConversionProperties properties); - - // This method can be overridden by subclasses for better performance. - String byteArrayToString(byte[] source, int offset, int length) - { - return byteArrayToString(source, offset, length, new BidiConversionProperties(bidiStringType_)); - } - - // Helper method used to decompress conversion tables when they are initialized. Note that this method also converts the char[] into a byte[] since these are single-byte tables. - byte[] decompressSB(char[] arr, byte subPad) - { - byte[] buf = new byte[65536]; - int c = 0; - - for (int i = 0; i < arr.length; ++i) - { - if (arr[i] == cic_) - { - if (arr.length > i+1 && arr[i+1] == pad_) - { - buf[c++] = (byte)(arr[i] / 256); - buf[c++] = (byte)(arr[i++] % 256); - } - else - { - long max = (0xFFFF & arr[i + 1] * 2) + (0xFFFF & c); - char ch = arr[i + 2]; - while (c < max) - { - buf[c++] = (byte)(ch / 256); - buf[c++] = (byte)(ch % 256); - } - i = i + 2; - } - } - else if (arr[i] == ric_) - { - if (arr.length > i + 1 && arr[i + 1] == pad_) - { - buf[c++] = (byte)(arr[i] / 256); - buf[c++] = (byte)(arr[i++] % 256); - } - else - { - int start = (0xFFFF & arr[i + 2]); - int num = (0xFFFF & arr[i + 1]); - for (int j = start; j < (num + start); ++j) - { - buf[c++] = (byte)(j / 256); - buf[c++] = (byte)(j % 256); - } - i = i + 2; - } - } - else if (arr[i] == hbic_) - { - if (arr.length > i + 1 && arr[i + 1] == pad_) - { - buf[c++] = (byte)(arr[i] / 256); - buf[c++] = (byte)(arr[i++] % 256); - } - else - { - int hbNum = (0x0000FFFF & arr[++i]); - char firstChar = arr[++i]; - char highByteMask = (char)(0xFF00 & firstChar); - buf[c++] = (byte)(firstChar / 256); - buf[c++] = (byte)(firstChar % 256); - ++i; - for (int j = 0; j < hbNum; ++j) - { - char both = arr[i + j]; - char c1 = (char)(highByteMask + ((0xFF00 & both) >>> 8)); - char c2 = (char)(highByteMask + (0x00FF & both)); - buf[c++] = (byte)(c1 / 256); - buf[c++] = (byte)(c1 % 256); - buf[c++] = (byte)(c2 / 256); - buf[c++] = (byte)(c2 % 256); - } - i = i + hbNum - 1; - } - } - else - { - // Regular character. - buf[c++] = (byte)(arr[i] / 256); - buf[c++] = (byte)(arr[i] % 256); - } - } - for (int i = c; i < buf.length; ++i) - { - buf[i] = subPad; - } - return buf; - } - - // Convenience function for tracing character strings. - static final byte[] dumpCharArray(char[] charArray, int offset, int length) - { - byte[] retData = new byte[length * 2]; - int inPos = offset; - int outPos = 0; - while(inPos < length) - { - retData[outPos++] = (byte)(charArray[inPos] >> 8); - retData[outPos++] = (byte)charArray[inPos++]; - } - return retData; - } - - static final byte[] dumpCharArray(char[] charArray, int numChars) - { - return dumpCharArray(charArray, 0, numChars); - } - - static final byte[] dumpCharArray(char[] charArray) - { - return dumpCharArray(charArray, charArray.length); - } - - // Returns the ccsid of this conversion object. - // @return The ccsid. - int getCcsid() - { - return ccsid_; - } - - // Returns the encoding of this conversion object. - // @return The encoding. - String getEncoding() - { - return encoding_; - } - - // Factory method for finding appropriate table based on encoding name. - static final ConvTable getTable(String encoding) throws UnsupportedEncodingException - { - String className = (NLS.forceJavaTables_) ? encoding : prefix_ + ConversionMaps.encodingToCcsidString(encoding); - - // First, see if we've already loaded the table. - ConvTable newTable = (ConvTable)converterPool_.get(className); - if (newTable != null) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Reusing previously loaded conversion table for encoding: " + encoding); - return newTable; - } - - // If we haven't, then we need to load it now. - try - { - if (NLS.forceJavaTables_) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "User set to force loading Java tables."); - throw new CharConversionException(); - } - newTable = (ConvTable)Class.forName(className).newInstance(); - } - catch (Throwable e) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Could not load conversion table class for encoding: " + encoding + ". Will attempt to let Java do the conversion.", e); - // Need to load a JavaMap. - className = encoding; - newTable = (ConvTable)converterPool_.get(className); - if (newTable != null) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Reusing previously loaded Java conversion table for encoding: " + encoding); - return newTable; - } - // It's not cached, so we can try to instantiate one. - newTable = new ConvTableJavaMap(encoding); - } - - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Successfully loaded conversion table for encoding: " + encoding); - converterPool_.put(className, newTable); - return newTable; - } - - // Factory method for finding appropriate table based on ccsid number. System may be null if no system was provided. - static final ConvTable getTable(int ccsid, AS400ImplRemote system) throws UnsupportedEncodingException - { - ccsid = ccsid & 0x00FFFF; // Remove sign-extended shorts that JDBC gives us. - - if (ccsid <= LARGEST_CCSID) //If it's negative, too bad... - { - ConvTable cachedTable = ccsidPool_[ccsid]; - if (cachedTable != null) return cachedTable; - } - - String className = null; - if (NLS.forceJavaTables_) - { - className = ConversionMaps.ccsidToEncoding(ccsid); - if (className == null) className = ""; - } - else - { - className = prefix_ + String.valueOf(ccsid); - } - - // First, see if we've already loaded the table. - ConvTable newTable = (ConvTable)converterPool_.get(className); - if (newTable != null) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Reusing previously loaded conversion table for ccsid: " + ccsid); - if (ccsid <= LARGEST_CCSID) ccsidPool_[ccsid] = newTable; - return newTable; - } - - // If we haven't, then we need to load it now. - try - { - if (NLS.forceJavaTables_) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "User set to force loading Java tables."); - throw new CharConversionException(); - } - newTable = (ConvTable)Class.forName(className).newInstance(); - } - catch (Throwable e) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Could not load conversion table class for ccsid: " + ccsid + ". Will attempt to let Java do the conversion.", e); - // Need to load a JavaMap. - className = ConversionMaps.ccsidToEncoding(ccsid); - if (className == null) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Could not find an encoding that matches ccsid: " + ccsid); - throw new UnsupportedEncodingException("CCSID " + ccsid); - } - newTable = (ConvTable)converterPool_.get(className); - if (newTable != null) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Reusing previously loaded Java conversion table for ccsid: " + ccsid); - if (ccsid <= LARGEST_CCSID) ccsidPool_[ccsid] = newTable; - return newTable; - } - // It's not cached, so we can try to instantiate one. - newTable = new ConvTableJavaMap(className); - } - - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Successfully loaded conversion table for ccsid: " + ccsid); - converterPool_.put(className, newTable); - if (ccsid <= LARGEST_CCSID) ccsidPool_[ccsid] = newTable; - return newTable; - } - - // Perform a Unicode to OS/400 CCSID conversion. - byte[] stringToByteArray(String source, int type) - { - return stringToByteArray(source, new BidiConversionProperties(type)); - } - abstract byte[] stringToByteArray(String source, BidiConversionProperties properties); - - // This method can be overridden by subclasses for better performance. - byte[] stringToByteArray(String source) - { - return stringToByteArray(source, new BidiConversionProperties(bidiStringType_)); - } - - // Subclasses should override this to avoid creating superflous String objects and char arrays. - byte[] stringToByteArray(char[] source, int offset, int length) - { - return stringToByteArray(new String(source, offset, length)); - } - - // Subclasses should override this to avoid creating superfluous byte arrays. - void stringToByteArray(String source, byte[] buf, int offset) throws CharConversionException - { - byte[] b = stringToByteArray(source, new BidiConversionProperties(bidiStringType_)); - try - { - System.arraycopy(b, 0, buf, offset, b.length); - } - catch (ArrayIndexOutOfBoundsException aioobe) - { - throw new CharConversionException(); - } - } - - // This method can be overridden by subclasses for better performance. - void stringToByteArray(String source, byte[] buf, int offset, int length) throws CharConversionException - { - stringToByteArray(source, buf, offset, length, new BidiConversionProperties(bidiStringType_)); - } - - // Subclasses should override this to avoid creating superfluous byte arrays. - void stringToByteArray(String source, byte[] buf, int offset, int length, int type) throws CharConversionException - { - stringToByteArray(source, buf, offset, length, new BidiConversionProperties(type)); - } - - int stringToByteArray(String source, byte[] buf, int offset, int length, BidiConversionProperties properties) throws CharConversionException - { - int truncated = 0; //@trnc - byte[] b = stringToByteArray(source, properties); - if (length > b.length) - length = b.length; - else if (length < stringToByteArray(source.trim(), properties).length){ //@trnc - truncated = b.length - length; //@trnc - } - - try - { - System.arraycopy(b, 0, buf, offset, length); - return truncated; //@trnc - } - catch (ArrayIndexOutOfBoundsException aioobe) - { - Trace.log(Trace.CONVERSION, "Source length: " + b.length + "; Source offset: 0; Destination length: " + buf.length + "; Destination offset: " + offset + "; Number of bytes to copy: " + length, aioobe); - throw new CharConversionException(); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1025.java b/cvsroot/src/com/ibm/as400/access/ConvTable1025.java deleted file mode 100644 index 272300e39..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1025.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1025.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1025 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u0452\u0453\u0451\u0454\u0455\u0456\u0457\u0458\u005B\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u0459\u045A\u045B\u045C\u045E\u045F\u042A\u2116\u0402\u005D\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u0403\u0401\u0404\u0405\u0406\u0407\u0408\u0409\u007C\u002C\u0025\u005F\u003E\u003F" + - "\u040A\u040B\u040C\u00AD\u040E\u040F\u044E\u0430\u0431\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u0446\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u0434\u0435\u0444\u0433\u0445\u0438" + - "\u0439\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u043A\u043B\u043C\u043D\u043E\u043F" + - "\u044F\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u0440\u0441\u0442\u0443\u0436\u0432" + - "\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u0425\u0418\u0419\u041A\u041B\u041C" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u041D\u041E\u041F\u042F\u0420\u0421" + - "\\\u00A7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u0422\u0423\u0416\u0412\u042C\u042B" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u0417\u0428\u042D\u0429\u0427\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u6AD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\u3F3F\u3F3F\u3FE1\u3F3F\u3F3F\u3F73\uFFFF\u01A9\u3F3F\u3F63\u5962\u6465\u6667\u6869\u7071" + - "\u723F\u7475\uB9BA\uEDBF\uBCBD\uECFA\uCBCC\uCDCE\uCFDA\uDBDC\uDEDF\uEAEB\uBECA\uBBFE\uFBFD\u57EF" + - "\uEEFC\uB8DD\u7778\uAF8D\u8A8B\uAEB2\u8F90\u9A9B\u9C9D\u9E9F\uAAAB\uACAD\u8C8E\u80B6\uB3B5\uB7B1" + - "\uB0B4\u76A0\u3F44\u4243\u4546\u4748\u4951\u5253\u543F\u5556\uFFFF\u0E5B\u3F3F\u583F\uFFFF\u6F74" + - "\u3F3F"; - - - ConvTable1025() - { - super(1025, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1026.java b/cvsroot/src/com/ibm/as400/access/ConvTable1026.java deleted file mode 100644 index c517fb5a0..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1026.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1026.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1026 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5\u007B\u00F1\u00C7\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u011E\u0130\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u005B\u00D1\u015F\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0131\u003A\u00D6\u015E\'\u003D\u00DC" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u007D\u0060\u00A6\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + - "\u00B5\u00F6\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u005D\u0024\u0040\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + - "\u00E7\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u007E\u00F2\u00F3\u00F5" + - "\u011F\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\\\u00F9\u00FA\u00FF" + - "\u00FC\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u0023\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\"\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\uFCEC\uAD6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\uAEC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE968\uDCAC\u5F6D" + - "\u8D81\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA948\uBB8C\uCC07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u9FB2\u8EB5\uBDB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u9E4A\u7471\u7273\u7875\u7677\u3F69\uEDEE\uEBEF\u7BBF\u80FD\uFEFB\u7F3F\u3F59" + - "\u4445\u4246\u4347\u9CC0\u5451\u5253\u5855\u5657\u3F49\uCDCE\uCBCF\uA1E1\u70DD\uDEDB\uE03F\u3FDF" + - "\uFFFF\u000F\u3F3F\u5AD0\uFFFF\b\u3F3F\u5B79\uFFFF\u0016\u3F3F\u7C6A\uFFFF\u7F50\u3F3F"; - - - ConvTable1026() - { - super(1026, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1027.java b/cvsroot/src/com/ibm/as400/access/ConvTable1027.java deleted file mode 100644 index 5050beb0e..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1027.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1027.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1027 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u001A\uFF61\uFF62\uFF63\uFF64\uFF65\uFF66\uFF67\uFF68\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\uFF69\uFF6A\uFF6B\uFF6C\uFF6D\uFF6E\uFF6F\uFF70\uFF71\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\uFF72\uFF73\uFF74\uFF75\uFF76\uFF77\uFF78\uFF79\u001A\u002C\u0025\u005F\u003E\u003F" + - "\uFF7A\uFF7B\uFF7C\uFF7D\uFF7E\uFF7F\uFF80\uFF81\uFF82\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u001A\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\uFF83\uFF84\uFF85\uFF86\uFF87\uFF88" + - "\u001A\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\uFF89\uFF8A\uFF8B\uFF8C\uFF8D\uFF8E" + - "\u203E\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\uFF8F\uFF90\uFF91\u005B\uFF92\uFF93" + - "\u005E\u00A3\u00A5\uFF94\uFF95\uFF96\uFF97\uFF98\uFF99\uFF9A\uFF9B\uFF9C\uFF9D\u005D\uFF9E\uFF9F" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u001A\u001A\u001A\u001A\u001A\u001A" + - "\\\u001A\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u001A\u001A\u001A\u001A\u001A\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9AD\uE0BD\uB06D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u3F3F\u4AB1\u3FB2\u3F3F\u3F3F\u3F3F\u5F3F\uFFFF\u0FC8\u3F3F\uA03F\uFFFF\u6F90\u3F3F\u3F42\u4344" + - "\u4546\u4748\u4951\u5253\u5455\u5657\u5859\u6263\u6465\u6667\u6869\u7071\u7273\u7475\u7677\u788A" + - "\u8B8C\u8D8E\u8F9A\u9B9C\u9D9E\u9FAA\uABAC\uAEAF\uB3B4\uB5B6\uB7B8\uB9BA\uBBBC\uBEBF\uFFFF\u0030" + - "\u3F3F"; - - - ConvTable1027() - { - super(1027, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1046.java b/cvsroot/src/com/ibm/as400/access/ConvTable1046.java deleted file mode 100644 index fd9d094ad..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1046.java +++ /dev/null @@ -1,66 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1046.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1046 extends ConvTableBidiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\uFE88\u00D7\u00F7\uFEB1\uFEB5\uFEB9\uFEBD\uFE71\u0088\u25A0\u2502\u2500\u2510\u250C\u2514\u2518" + - "\uFE79\uFE7B\uFE7D\uFE7F\uFE77\uFE8A\uFEF0\uFEF3\uFEF2\uFECE\uFECF\uFED0\uFEF6\uFEF8\uFEFA\uFEFC" + - "\u00A0\uFE82\uFE84\uFE88\u00A4\uFE8E\uFE8B\uFE91\uFE97\uFE9B\uFE9F\uFEA3\u060C\u00AD\uFEA7\uFEB3" + - "\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\uFEB7\u061B\uFEBB\uFEBF\uFECA\u061F" + - "\uFECB\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F" + - "\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063A\uFECC\uFE82\uFE84\uFE8E\uFED3" + - "\u0640\u0641\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064A\u064B\u064C\u064D\u064E\u064F" + - "\u0650\u0651\u0652\uFED7\uFEDB\uFEDF\u200B\uFEF5\uFEF7\uFEF9\uFEFB\uFEE3\uFEE7\uFEEC\uFEE9\u20AC"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\uFFFF\u0004\u1A1A\u881A\uFFFF\u000B\u1A1A\uA01A\u1A1A\uA41A\u1A1A\u1A1A\u1A1A\u1AAD\uFFFF\u0014" + - "\u1A1A\u1A81\uFFFF\u000F\u1A1A\u1A82\uFFFF\u0004\u1A1A\uFFFF\u0280\u7F7F\uFFFF\u0006\u1A1A\uAC1A" + - "\uFFFF\u0006\u1A1A\u1ABB\u1A1A\u1ABF\u1AC1\uC2C3\uC4C5\uC6C7\uC8C9\uCACB\uCCCD\uCECF\uD0D1\uD2D3" + - "\uD4D5\uD6D7\uD8D9\uDA1A\u1A1A\u1A1A\uE0E1\uE2E3\uE4E5\uE6E7\uE8E9\uEAEB\uECED\uEEEF\uF0F1\uF21A" + - "\uFFFF\u0006\u1A1A\uB0B1\uB2B3\uB4B5\uB6B7\uB8B9\u252C\u2E2A\uFFFF\u0049\u1A1A\uFFFF\u0C80\u7F7F" + - "\uFFFF\u0005\u1A1A\u1AF6\uFFFF\u0050\u1A1A\uFF1A\uFFFF\u0029\u1A1A\uFFFF\u0200\u7F7F\u8B1A\u8A1A" + - "\uFFFF\u0004\u1A1A\u8D1A\u1A1A\u8C1A\u1A1A\u8E1A\u1A1A\u8F1A\uFFFF\u0043\u1A1A\u891A\uFFFF\u002F" + - "\u1A1A\uFFFF\u6C00\u7F7F\uFFFF\u0038\u1A1A\uEB87\uEC1A\uED1A\uEE94\uEF90\uF091\uF192\uF293\uC1C2" + - "\uDCC3\uDDC4\uC4C5\u80C6\u95A6\uA6C7\uDEC8\uC8A7\uA7C9\uC9CA\uCAA8\uA8CB\uCBA9\uA9CC\uCCAA\uAACD" + - "\uCDAB\uABCE\uCEAE\uAECF\uCFD0\uD0D1\uD1D2\uD2D3\uD3AF\uAFD4\uD4BA\uBAD5\uD5BC\uBCD6\uD6BD\uBDD7" + - "\uD7D7\uD7D8\uD8D8\uD8D9\uBEC0\uDBDA\u999A\u9BE1\uE1DF\uDFE2\uE2F3\uF3E3\uE3F4\uF4E4\uE4F5\uF5E5" + - "\uE5FB\uFBE6\uE6FC\uFCFE\uFEE7\uFDE8\uE8E9\u96EA\u9897\u97F7\u9CF8\u9DF9\u9EFA\u9F1A\u1A1A\u1A21" + - "\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F\u4041" + - "\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F\u6061" + - "\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1A\uFFFF" + - "\u0044\u1A1A\u8A1A\u1A1A\u1A89\uFFFF\t\u1A1A"; - - - ConvTable1046() - { - super(1046, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1089.java b/cvsroot/src/com/ibm/as400/access/ConvTable1089.java deleted file mode 100644 index 0a6ec0dbe..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1089.java +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1089.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1089 extends ConvTableBidiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u001A\u001A\u001A\u00A4\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u060C\u00AD\u001A\u001A" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u061B\u001A\u001A\u001A\u061F" + - "\u001A\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F" + - "\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063A\u001A\u001A\u001A\u001A\u001A" + - "\u0640\u0641\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064A\u064B\u064C\u064D\u064E\u064F" + - "\u0650\u0651\u0652\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u8081\u8283\u8485\u8687\u8889\u8A8B\u8C8D\u8E8F\u9091\u9293\u9495\u9697\u9899\u9A9B\u9C9D\u9E9F" + - "\uA01A\u1A1A\uA41A\u1A1A\u1A1A\u1A1A\u1AAD\uFFFF\u02AF\u1A1A\uAC1A\uFFFF\u0006\u1A1A\u1ABB\u1A1A" + - "\u1ABF\u1AC1\uC2C3\uC4C5\uC6C7\uC8C9\uCACB\uCCCD\uCECF\uD0D1\uD2D3\uD4D5\uD6D7\uD8D9\uDA1A\u1A1A" + - "\u1A1A\uE0E1\uE2E3\uE4E5\uE6E7\uE8E9\uEAEB\uECED\uEEEF\uF0F1\uF21A\uFFFF\u0006\u1A1A\u3031\u3233" + - "\u3435\u3637\u3839\u252C\u2E2A\uFFFF\u7C01\u1A1A\uEBEB\uEC1A\uED1A\uEEEE\uEFEF\uF0F0\uF1F1\uF2F2" + - "\uC1C2\uC2C3\uC3C4\uC4C5\uC5C6\uC6C6\uC6C7\uC7C8\uC8C8\uC8C9\uC9CA\uCACA\uCACB\uCBCB\uCBCC\uCCCC" + - "\uCCCD\uCDCD\uCDCE\uCECE\uCECF\uCFD0\uD0D1\uD1D2\uD2D3\uD3D3\uD3D4\uD4D4\uD4D5\uD5D5\uD5D6\uD6D6" + - "\uD6D7\uD7D7\uD7D8\uD8D8\uD8D9\uD9D9\uD9DA\uDADA\uDAE1\uE1E1\uE1E2\uE2E2\uE2E3\uE3E3\uE3E4\uE4E4" + - "\uE4E5\uE5E5\uE5E6\uE6E6\uE6E7\uE7E7\uE7E8\uE8E9\uE9EA\uEAEA\uEA1A\uFFFF\u0005\u1A1A\u1A21\u2223" + - "\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F\u4041\u4243" + - "\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F\u6061\u6263" + - "\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1A\uFFFF\u0050" + - "\u1A1A"; - - - ConvTable1089() - { - super(1089, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1112.java b/cvsroot/src/com/ibm/as400/access/ConvTable1112.java deleted file mode 100644 index 7c75737d9..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1112.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1112.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1112 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u0161\u00E4\u0105\u012F\u016B\u00E5\u0113\u017E\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u00E9\u0119\u0117\u010D\u0173\u201E\u201C\u0123\u00DF\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u0160\u00C4\u0104\u012E\u016A\u00C5\u0112\u017D\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u0118\u0116\u010C\u0172\u012A\u013B\u0122\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u0101\u017C\u0144\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u0156\u0157\u00E6\u0137\u00C6\u00A4" + - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u201D\u017A\u0100\u017B\u0143\u00AE" + - "\u005E\u00A3\u012B\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u005B\u005D\u0179\u0136\u013C\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u014D\u00F6\u0146\u00F3\u00F5" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u0107\u00FC\u0142\u015B\u2019" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u014C\u00D6\u0145\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u0106\u00DC\u0141\u015A\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9BA\uE0BB\uB06D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\u4AB1\u9F3F\u6AB5\u3FB4\u3F8A\u5FCA\uAF3F\u908F\uEAFA\u3FA0\uB6B3\u3FDA\u3F8B\uB7B8\uB93F" + - "\u3F3F\u3F3F\u6367\u9E3F\u0000\u0003\u3F71\u3F3F\u3F3F\uEEEF\uECBF\u803F\u3F3F\uFC3F\u3F59\u3F3F" + - "\u3F3F\u4347\u9C3F\u0000\u0003\u3F51\u3F3F\u3F3F\uCECF\uCCE1\u703F\u3F3F\uDC3F\u3F3F\uAC8C\u3F3F" + - "\u6444\uFBDB\u3F3F\u3F3F\u7454\u3F3F\u3F3F\u6848\u3F3F\u7353\u7252\uFFFF\u0004\u3F3F\u7858\u3F3F" + - "\u3F3F\u3F3F\u76B2\u3F3F\u6545\u3F3F\u3F3F\u3F3F\uBD9D\u3F3F\u3F77\uBE3F\u3F3F\u3FFD\uDDAE\u8EED" + - "\uCD3F\u3F3F\u3F3F\uEBCB\uFFFF\u0004\u3F3F\u9A9B\u3F3F\uFEDE\u3F3F\u3F3F\u6242\uFFFF\u0004\u3F3F" + - "\u6646\u3F3F\u3F3F\u3F3F\u7555\u3F3F\u3F3F\u3FBC\uABAD\u8D69\u493F\uFFFF\u0F4C\u3F3F\u3FDF\u3F3F" + - "\u57AA\u563F\uFFFF\u6F70\u3F3F\u3F5A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5" + - "\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4" + - "\uE5E6\uE7E8\uE9BA\uE0BB\uB06D\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4" + - "\uA5A6\uA7A8\uA9C0\u4FD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable1112() - { - super(1112, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1122.java b/cvsroot/src/com/ibm/as400/access/ConvTable1122.java deleted file mode 100644 index fb98abb5d..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1122.java +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1122.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1122 extends ConvTableSingleMap -{ - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u007B\u00E0\u00E1\u00E3\u007D\u00E7\u00F1\u00A7\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u0060\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u00A4\u00C5\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u0023\u00C0\u00C1\u00C3\u0024\u00C7\u00D1\u00F6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\\\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u00E9\u003A\u00C4\u00D6\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u0161\u00FD\u017E\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u005D" + - "\u00B5\u00FC\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u0160\u00DD\u017D\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u005B\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + - "\u00E4\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00A6\u00F2\u00F3\u00F5" + - "\u00E5\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u007E\u00F9\u00FA\u00FF" + - "\u00C9\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u0040\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F63\u676C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\uECC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9B5\u719F\u5F6D" + - "\u5181\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA943\uBB47\uDC07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u5AB2\uCC4A\uBDB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u7B5B\u9E68\u74E0\u7273\u7875\u7677\u3F69\uEDEE\uEBEF\u7CBF\u80FD\uFEFB\uFCAD\u3F59" + - "\u4445\u4246\uC0D0\u9C48\u5479\u5253\u5855\u5657\u3F49\uCDCE\uCBCF\u6AE1\u70DD\uDEDB\uA18D\u3FDF" + - "\uFFFF\u0030\u3F3F\uAC8C\uFFFF\r\u3F3F\u3FAE\u8E3F\uFFFF\u0F5F\u3F3F\uBC3F\uFFFF\u6F60\u3F3F" + - "\u3F4F\u7F63\u676C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\uECC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9B5\u719F\u5F6D" + - "\u5181\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA943\uBB47\uDC3F" + - "\uFFFF\u0050\u3F3F"; - - - ConvTable1122() - { - super(1122, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1123.java b/cvsroot/src/com/ibm/as400/access/ConvTable1123.java deleted file mode 100644 index 97533b146..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1123.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1123.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1123 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u0452\u0491\u0451\u0454\u0455\u0456\u0457\u0458\u005B\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u0459\u045A\u045B\u045C\u045E\u045F\u042A\u2116\u0402\u005D\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u0490\u0401\u0404\u0405\u0406\u0407\u0408\u0409\u007C\u002C\u0025\u005F\u003E\u003F" + - "\u040A\u040B\u040C\u00AD\u040E\u040F\u044E\u0430\u0431\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u0446\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u0434\u0435\u0444\u0433\u0445\u0438" + - "\u0439\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u043A\u043B\u043C\u043D\u043E\u043F" + - "\u044F\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u0440\u0441\u0442\u0443\u0436\u0432" + - "\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u0425\u0418\u0419\u041A\u041B\u041C" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u041D\u041E\u041F\u042F\u0420\u0421" + - "\\\u00A7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u0422\u0423\u0416\u0412\u042C\u042B" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u0417\u0428\u042D\u0429\u0427\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u6AD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\u3F3F\u3F3F\u3FE1\u3F3F\u3F3F\u3F73\uFFFF\u01A9\u3F3F\u3F63\u593F\u6465\u6667\u6869\u7071" + - "\u723F\u7475\uB9BA\uEDBF\uBCBD\uECFA\uCBCC\uCDCE\uCFDA\uDBDC\uDEDF\uEAEB\uBECA\uBBFE\uFBFD\u57EF" + - "\uEEFC\uB8DD\u7778\uAF8D\u8A8B\uAEB2\u8F90\u9A9B\u9C9D\u9E9F\uAAAB\uACAD\u8C8E\u80B6\uB3B5\uB7B1" + - "\uB0B4\u76A0\u3F44\u423F\u4546\u4748\u4951\u5253\u543F\u5556\uFFFF\u0018\u3F3F\u6243\uFFFF\u0E42" + - "\u3F3F\u583F\uFFFF\u6EF4\u3F3F\u3F4F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5" + - "\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4" + - "\uE5E6\uE7E8\uE94A\uE05A\u5F6D\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4" + - "\uA5A6\uA7A8\uA9C0\u6AD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable1123() - { - super(1123, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1125.java b/cvsroot/src/com/ibm/as400/access/ConvTable1125.java deleted file mode 100644 index 23308c01e..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1125.java +++ /dev/null @@ -1,67 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1125.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1125 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F" + - "\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F" + - "\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F" + - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + - "\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F" + - "\u0401\u0451\u0490\u0491\u0404\u0454\u0406\u0456\u0407\u0457\u00F7\u00B1\u2116\u00A4\u25A0\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFF7F\u7F7F\uFD7F\u0000\u0003\u7F15\u7F7F\u7F7F\uFB7F\u7F7F\u147F\uFFFF\u001F" + - "\u7F7F\u7FFA\uFFFF\u0184\u7F7F\u7FF0\u7F7F\uF47F\uF6F8\uFFFF\u0004\u7F7F\u8081\u8283\u8485\u8687" + - "\u8889\u8A8B\u8C8D\u8E8F\u9091\u9293\u9495\u9697\u9899\u9A9B\u9C9D\u9E9F\uA0A1\uA2A3\uA4A5\uA6A7" + - "\uA8A9\uAAAB\uACAD\uAEAF\uE0E1\uE2E3\uE4E5\uE6E7\uE8E9\uEAEB\uECED\uEEEF\u7FF1\u7F7F\uF57F\uF7F9" + - "\uFFFF\u001C\u7F7F\uF2F3\uFFFF\u0DC8\u7F7F\u077F\uFFFF\f\u7F7F\u137F\uFFFF\u006C\u7F7F\uFC7F" + - "\uFFFF\u003C\u7F7F\u1B18\u1A19\u1D12\uFFFF\t\u7F7F\u177F\uFFFF\u003A\u7F7F\u7F1C\uFFFF\u0170" + - "\u7F7F\uC47F\uB37F\uFFFF\u0004\u7F7F\uDA7F\u7F7F\uBF7F\u7F7F\uC07F\u7F7F\uD97F\u7F7F\uC37F\u7F7F" + - "\u7F7F\u7F7F\uB47F\u7F7F\u7F7F\u7F7F\uC27F\u7F7F\u7F7F\u7F7F\uC17F\u7F7F\u7F7F\u7F7F\uC57F\uFFFF" + - "\t\u7F7F\uCDBA\uD5D6\uC9B8\uB7BB\uD4D3\uC8BE\uBDBC\uC6C7\uCCB5\uB6B9\uD1D2\uCBCF\uD0CA\uD8D7" + - "\uCE7F\uFFFF\t\u7F7F\uDF7F\u7F7F\uDC7F\u7F7F\uDB7F\u7F7F\uDD7F\u7F7F\uDEB0\uB1B2\uFFFF\u0006" + - "\u7F7F\uFE7F\uFFFF\u0005\u7F7F\u167F\u7F7F\u7F7F\u1E7F\u7F7F\u7F7F\u7F7F\u107F\u1F7F\u7F7F\u7F7F" + - "\u7F7F\u117F\u0000\u0004\u7F7F\u7F09\u7F7F\u7F7F\u7F7F\u080A\uFFFF\u0030\u7F7F\u0102\u0F7F\u7F7F" + - "\u0C7F\u0B7F\uFFFF\u000E\u7F7F\u067F\u7F05\u7F03\u047F\u7F7F\u0D0E\uFFFF\u6C4A\u7F7F\u7F21\u2223" + - "\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F\u4041\u4243" + - "\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F\u6061\u6263" + - "\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F\uFFFF\u0044" + - "\u7F7F\uB31B\u181A\u19FE\u097F\uFFFF\b\u7F7F"; - - - ConvTable1125() - { - super(1125, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1129.java b/cvsroot/src/com/ibm/as400/access/ConvTable1129.java deleted file mode 100644 index 9915e6d82..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1129.java +++ /dev/null @@ -1,60 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1129.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1129 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u0153\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u0178\u00B5\u00B6\u00B7\u0152\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u00C0\u00C1\u00C2\u0102\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u0300\u00CD\u00CE\u00CF" + - "\u0110\u00D1\u0309\u00D3\u00D4\u01A0\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC\u01AF\u0303\u00DF" + - "\u00E0\u00E1\u00E2\u0103\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u0301\u00ED\u00EE\u00EF" + - "\u0111\u00F1\u0323\u00F3\u00F4\u01A1\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u01B0\u20AB\u00FF"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u8081\u8283\u8485\u8687\u8889\u8A8B\u8C8D\u8E8F\u9091\u9293\u9495\u9697\u9899\u9A9B\u9C9D\u9E9F" + - "\uA0A1\uA2A3\uA4A5\uA6A7\u1AA9\uAAAB\uACAD\uAEAF\uB0B1\uB2B3\u1AB5\uB6B7\u1AB9\uBABB\uBCBD\uBEBF" + - "\uC0C1\uC21A\uC4C5\uC6C7\uC8C9\uCACB\u1ACD\uCECF\u1AD1\u1AD3\uD41A\uD6D7\uD8D9\uDADB\uDC1A\u1ADF" + - "\uE0E1\uE21A\uE4E5\uE6E7\uE8E9\uEAEB\u1AED\uEEEF\u1AF1\u1AF3\uF41A\uF6F7\uF8F9\uFAFB\uFC1A\u1AFF" + - "\u1A1A\uC3E3\uFFFF\u0006\u1A1A\uD0F0\uFFFF\u0020\u1A1A\uB8A8\uFFFF\u0012\u1A1A\uB41A\uFFFF\u0013" + - "\u1A1A\uD5F5\uFFFF\u0006\u1A1A\u1ADD\uFD1A\uFFFF\u00A7\u1A1A\uCCEC\u1ADE\u1A1A\u1A1A\u1AD2\uFFFF" + - "\f\u1A1A\u1AF2\uFFFF\u0EC3\u1A1A\u1AFE\uFFFF\u6F2A\u1A1A\u1A21\u2223\u2425\u2627\u2829\u2A2B" + - "\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F\u4041\u4243\u4445\u4647\u4849\u4A4B" + - "\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F\u6061\u6263\u6465\u6667\u6869\u6A6B" + - "\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1A\uFFFF\u0050\u1A1A"; - - - ConvTable1129() - { - super(1129, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1130.java b/cvsroot/src/com/ibm/as400/access/ConvTable1130.java deleted file mode 100644 index baa4b5b01..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1130.java +++ /dev/null @@ -1,60 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1130.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1130 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u0103\u00E5\u00E7\u00F1\u005B\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u0303\u00DF\u005D\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u0102\u00C5\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u20AB\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u0111\u0309\u0300\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u0152\u00C6\u00A4" + - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u0110\u0323\u0301\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u0153\u0178\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u01B0\u00F3\u01A1" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u01AF\u00D3\u01A0" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\uBBD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u9FB2\u6AB5\u3FB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\u3FA0\uB6B3\u3FDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u623F\u6367\u9E68\u7471\u7273\u3F75\u7677\u3F69\u3FEE\uEB3F\uECBF\u80FD\uFEFB\uFC3F\u3F59" + - "\u4445\u423F\u4347\u9C48\u5451\u5253\u3F55\u5657\u3F49\u3FCE\uCB3F\uCCE1\u70DD\uDEDB\uDC3F\u3FDF" + - "\u3F3F\u6646\uFFFF\u0006\u3F3F\uAC8C\uFFFF\u0020\u3F3F\u9DBD\uFFFF\u0012\u3F3F\uBE3F\uFFFF\u0013" + - "\u3F3F\uEFCF\uFFFF\u0006\u3F3F\u3FED\uCD3F\uFFFF\u00A7\u3F3F\u8EAE\u3F58\u3F3F\u3F3F\u3F8D\uFFFF" + - "\f\u3F3F\u3FAD\uFFFF\u0EC3\u3F3F\u3F78\uFFFF\u6F2A\u3F3F\u3F4F\u7F7B\u5B6C\u507D\u4D5D\u5C4E" + - "\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2" + - "\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D\u7981\u8283\u8485\u8687\u8889\u9192" + - "\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\uBBD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable1130() - { - super(1130, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1131.java b/cvsroot/src/com/ibm/as400/access/ConvTable1131.java deleted file mode 100644 index 11daa0058..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1131.java +++ /dev/null @@ -1,67 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1131.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1131 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F" + - "\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F" + - "\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F" + - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + - "\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F" + - "\u0401\u0451\u0404\u0454\u0407\u0457\u040E\u045E\u0406\u0456\u00B7\u00A4\u0490\u0491\u2219\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFF7F\u7F7F\uFB7F\u7F15\uFFFF\u0007\u7F7F\u14FA\uFFFF\u01A4\u7F7F\u7FF0\u7F7F" + - "\uF27F\uF8F4\u7F7F\u7F7F\u7F7F\uF67F\u8081\u8283\u8485\u8687\u8889\u8A8B\u8C8D\u8E8F\u9091\u9293" + - "\u9495\u9697\u9899\u9A9B\u9C9D\u9E9F\uA0A1\uA2A3\uA4A5\uA6A7\uA8A9\uAAAB\uACAD\uAEAF\uE0E1\uE2E3" + - "\uE4E5\uE6E7\uE8E9\uEAEB\uECED\uEEEF\u7FF1\u7F7F\uF37F\uF9F5\u7F7F\u7F7F\u7F7F\uF77F\uFFFF\u0018" + - "\u7F7F\uFCFD\uFFFF\u0DC8\u7F7F\u077F\uFFFF\f\u7F7F\u137F\uFFFF\u00A9\u7F7F\u1B18\u1A19\u1D12" + - "\uFFFF\t\u7F7F\u177F\uFFFF\u0037\u7F7F\u7FFE\u7F7F\u7F7F\u7F1C\uFFFF\u0170\u7F7F\uC47F\uB37F" + - "\uFFFF\u0004\u7F7F\uDA7F\u7F7F\uBF7F\u7F7F\uC07F\u7F7F\uD97F\u7F7F\uC37F\u7F7F\u7F7F\u7F7F\uB47F" + - "\u7F7F\u7F7F\u7F7F\uC27F\u7F7F\u7F7F\u7F7F\uC17F\u7F7F\u7F7F\u7F7F\uC57F\uFFFF\t\u7F7F\uCDBA" + - "\uD5D6\uC9B8\uB7BB\uD4D3\uC8BE\uBDBC\uC6C7\uCCB5\uB6B9\uD1D2\uCBCF\uD0CA\uD8D7\uCE7F\uFFFF\t" + - "\u7F7F\uDF7F\u7F7F\uDC7F\u7F7F\uDB7F\u7F7F\uDD7F\u7F7F\uDEB0\uB1B2\uFFFF\f\u7F7F\u167F\u7F7F" + - "\u7F7F\u1E7F\u7F7F\u7F7F\u7F7F\u107F\u1F7F\u7F7F\u7F7F\u7F7F\u117F\u0000\u0004\u7F7F\u7F09\u7F7F" + - "\u7F7F\u7F7F\u080A\uFFFF\u0030\u7F7F\u0102\u0F7F\u7F7F\u0C7F\u0B7F\uFFFF\u000E\u7F7F\u067F\u7F05" + - "\u7F03\u047F\u7F7F\u0D0E\uFFFF\u6C4A\u7F7F\u7F21\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031" + - "\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051" + - "\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071" + - "\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F\uFFFF\u0044\u7F7F\uB31B\u181A\u197F\u097F\uFFFF\b" + - "\u7F7F"; - - - ConvTable1131() - { - super(1131, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1132.java b/cvsroot/src/com/ibm/as400/access/ConvTable1132.java deleted file mode 100644 index 2dc4ce611..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1132.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1132.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1132 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u0E81\u0E82\u0E84\u0E87\u0E88\u0EAA\u0E8A\u005B\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u001A\u0E8D\u0E94\u0E95\u0E96\u0E97\u0E99\u0E9A\u005D\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u0E9B\u0E9C\u0E9D\u0E9E\u0E9F\u0EA1\u0EA2\u005E\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u006B\u001A\u0EA3\u0EA5\u0EA7\u0EAB\u0EAD\u0EAE\u001A\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u001A\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u001A\u001A\u0EAF\u0EB0\u0EB2\u0EB3" + - "\u001A\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u0EB4\u0EB5\u0EB6\u0EB7\u0EB8\u0EB9" + - "\u001A\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u0EBC\u0EB1\u0EBB\u0EBD\u001A\u001A" + - "\u0ED0\u0ED1\u0ED2\u0ED3\u0ED4\u0ED5\u0ED6\u0ED7\u0ED8\u0ED9\u001A\u0EC0\u0EC1\u0EC2\u0EC3\u0EC4" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u001A\u0EC8\u0EC9\u0ECA\u0ECB\u0ECC" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u0ECD\u0EC6\u001A\u0EDC\u0EDD\u001A" + - "\\\u001A\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u001A\u001A\u001A\u001A\u001A\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE949\uE059\u696D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\u4A3F\u3F3F\u6A3F\u3F3F\u3F3F\u5F3F\uFFFF\u06E9\u3F3F\u3F42\u433F\u443F\u3F45\u463F\u483F" + - "\u3F52\u3F3F\u3F3F\u3F3F\u5354\u5556\u3F57\u5862\u6364\u6566\u3F67\u6872\u3F73\u3F74\u3F3F\u4775" + - "\u3F76\u778C\u8DAB\u8E8F\u9A9B\u9C9D\u9E9F\u3FAC\uAAAD\u3F3F\uBBBC\uBDBE\uBF3F\uDB3F\uCBCC\uCDCE" + - "\uCFDA\u3F3F\uB0B1\uB2B3\uB4B5\uB6B7\uB8B9\u3F3F\uDDDE\uFFFF\u7811\u3F3F\u3F5A\u7F7B\u5B6C\u507D" + - "\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7" + - "\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE949\uE059\u696D\u7981\u8283\u8485\u8687" + - "\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable1132() - { - super(1132, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1137.java b/cvsroot/src/com/ibm/as400/access/ConvTable1137.java deleted file mode 100644 index 53304c398..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1137.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1137.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1137 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u0901\u0902\u0903\u0905\u0906\u0907\u0908\u0909\u090A\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u090B\u090C\u090D\u090E\u090F\u0910\u0911\u0912\u0913\u0021\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u0914\u0915\u0916\u0917\u0918\u0919\u091A\u091B\u091C\u002C\u0025\u005F\u003E\u003F" + - "\u091D\u091E\u091F\u0920\u0921\u0922\u0923\u0924\u0925\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u0926\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u0927\u0928\u092A\u092B\u092C\u092D" + - "\u092E\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u092F\u0930\u0932\u0933\u0935\u0936" + - "\u200C\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u0937\u0938\u0939\u005B\u093C\u093D" + - "\u093E\u093F\u0940\u0941\u0942\u0943\u0944\u0945\u0946\u0947\u0948\u0949\u094A\u005D\u094B\u094C" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u094D\u0950\u0951\u0952\u001A\u001A" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u0960\u0961\u0962\u0963\u0964\u0965" + - "\\\u200D\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u0966\u0967\u0968\u0969\u096A\u096B" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u096C\u096D\u096E\u096F\u0970\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9AD\uE0BD\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\uFFFF\u042F\u3F3F\u3F42\u4344\u3F45\u4647\u4849\u4A51\u5253\u5455\u5657\u5859\u6263\u6465" + - "\u6667\u6869\u6A70\u7172\u7374\u7576\u7778\u808A\u8B3F\u8C8D\u8E8F\u909A\u9B3F\u9C9D\u3F9E\u9FAA" + - "\uABAC\u3F3F\uAEAF\uB0B1\uB2B3\uB4B5\uB6B7\uB8B9\uBABB\uBCBE\uBFCA\u3F3F\uCBCC\uCD3F\uFFFF\u0006" + - "\u3F3F\uDADB\uDCDD\uDEDF\uEAEB\uECED\uEEEF\uFAFB\uFCFD\uFE3F\uFFFF\u0B4D\u3F3F\uA0E1\uFFFF\u6F79" + - "\u3F3F\u3F5A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E" + - "\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9AD\uE0BD" + - "\u5F6D\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0" + - "\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable1137() - { - super(1137, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1140.java b/cvsroot/src/com/ibm/as400/access/ConvTable1140.java deleted file mode 100644 index fb6612ba7..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1140.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1140.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1140 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5\u00E7\u00F1\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u20AC" + - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u005E\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u005B\u005D\u00AF\u00A8\u00B4\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9BA\uE0BB\uB06D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\u4AB1\u3FB2\u6AB5\uBDB4\u9A8A\u5FCA\uAFBC\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u9E68\u7471\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\uECBF\u80FD\uFEFB\uFCAD\uAE59" + - "\u4445\u4246\u4347\u9C48\u5451\u5253\u5855\u5657\u8C49\uCDCE\uCBCF\uCCE1\u70DD\uDEDB\uDC8D\u8EDF" + - "\uFFFF\u0F9F\u3F3F\uBC3F\uFFFF\u0036\u3F3F\u9F3F\uFFFF\u6F29\u3F3F\u3F5A\u7F7B\u5B6C\u507D\u4D5D" + - "\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9" + - "\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9BA\uE0BB\uB06D\u7981\u8283\u8485\u8687\u8889" + - "\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable1140() - { - super(1140, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1141.java b/cvsroot/src/com/ibm/as400/access/ConvTable1141.java deleted file mode 100644 index 62e5936a8..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1141.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1141.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1141 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u007B\u00E0\u00E1\u00E3\u00E5\u00E7\u00F1\u00C4\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u007E\u00DC\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u005B\u00C0\u00C1\u00C3\u00C5\u00C7\u00D1\u00F6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0060\u003A\u0023\u00A7\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u20AC" + - "\u00B5\u00DF\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u0040\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + - "\u00E4\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00A6\u00F2\u00F3\u00F5" + - "\u00FC\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u007D\u00F9\u00FA\u00FF" + - "\u00D6\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\\\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u005D\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\uB5C1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE963\uECFC\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA943\uBBDC\u5907" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u3FB2\uCC7C\uBDB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u4A67\u9E68\u7471\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\uE0BF\u80FD\uFEFB\u5AAD\uAEA1" + - "\u4445\u4246\uC047\u9C48\u5451\u5253\u5855\u5657\u8C49\uCDCE\uCBCF\u6AE1\u70DD\uDEDB\uD08D\u8EDF" + - "\uFFFF\u0F9F\u3F3F\uBC3F\uFFFF\u0036\u3F3F\u9F3F\uFFFF\u6F29\u3F3F\u3F4F\u7F7B\u5B6C\u507D\u4D5D" + - "\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\uB5C1\uC2C3\uC4C5\uC6C7\uC8C9" + - "\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE963\uECFC\u5F6D\u7981\u8283\u8485\u8687\u8889" + - "\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA943\uBBDC\u593F\uFFFF\u0050\u3F3F"; - - - ConvTable1141() - { - super(1141, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1142.java b/cvsroot/src/com/ibm/as400/access/ConvTable1142.java deleted file mode 100644 index 1749859c4..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1142.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1142.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1142 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u007D\u00E7\u00F1\u0023\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u20AC\u00C5\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u0024\u00C7\u00D1\u00F8\u002C\u0025\u005F\u003E\u003F" + - "\u00A6\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0060\u003A\u00C6\u00D8\'\u003D\"" + - "\u0040\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u007B\u00B8\u005B\u005D" + - "\u00B5\u00FC\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + - "\u00E6\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + - "\u00E5\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u007E\u00F9\u00FA\u00FF" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F4A\u676C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u80C1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE99E\uE09F\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA99C\uBB47\uDC07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u3FB2\u70B5\uBDB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u635B\u7B68\u7471\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\uECBF\u7CFD\uFEFB\uFCAD\uAE59" + - "\u4445\u4246\u43D0\uC048\u5451\u5253\u5855\u5657\u8C49\uCDCE\uCBCF\uCCE1\u6ADD\uDEDB\uA18D\u8EDF" + - "\uFFFF\u0F9F\u3F3F\uBC3F\uFFFF\u0036\u3F3F\u5A3F\uFFFF\u6F29\u3F3F\u3F4F\u7F4A\u676C\u507D\u4D5D" + - "\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u80C1\uC2C3\uC4C5\uC6C7\uC8C9" + - "\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE99E\uE09F\u5F6D\u7981\u8283\u8485\u8687\u8889" + - "\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA99C\uBB47\uDC3F\uFFFF\u0050\u3F3F"; - - - ConvTable1142() - { - super(1142, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1143.java b/cvsroot/src/com/ibm/as400/access/ConvTable1143.java deleted file mode 100644 index 3d46c882a..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1143.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1143.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1143 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u007B\u00E0\u00E1\u00E3\u007D\u00E7\u00F1\u00A7\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u0060\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u20AC\u00C5\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u0023\u00C0\u00C1\u00C3\u0024\u00C7\u00D1\u00F6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\\\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u00E9\u003A\u00C4\u00D6\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u005D" + - "\u00B5\u00FC\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u005B\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + - "\u00E4\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00A6\u00F2\u00F3\u00F5" + - "\u00E5\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u007E\u00F9\u00FA\u00FF" + - "\u00C9\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u0040\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F63\u676C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\uECC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9B5\u719F\u5F6D" + - "\u5181\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA943\uBB47\uDC07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u3FB2\uCC4A\uBDB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u7B5B\u9E68\u74E0\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\u7CBF\u80FD\uFEFB\uFCAD\uAE59" + - "\u4445\u4246\uC0D0\u9C48\u5479\u5253\u5855\u5657\u8C49\uCDCE\uCBCF\u6AE1\u70DD\uDEDB\uA18D\u8EDF" + - "\uFFFF\u0F9F\u3F3F\uBC3F\uFFFF\u0036\u3F3F\u5A3F\uFFFF\u6F29\u3F3F\u3F4F\u7F63\u676C\u507D\u4D5D" + - "\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\uECC1\uC2C3\uC4C5\uC6C7\uC8C9" + - "\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9B5\u719F\u5F6D\u5181\u8283\u8485\u8687\u8889" + - "\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA943\uBB47\uDC3F\uFFFF\u0050\u3F3F"; - - - ConvTable1143() - { - super(1143, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1144.java b/cvsroot/src/com/ibm/as400/access/ConvTable1144.java deleted file mode 100644 index ee93fd718..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1144.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1144.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1144 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u007B\u00E1\u00E3\u00E5\\\u00F1\u00B0\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u005D\u00EA\u00EB\u007D\u00ED\u00EE\u00EF\u007E\u00DF\u00E9\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u00C7\u00D1\u00F2\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u00F9\u003A\u00A3\u00A7\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u005B\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u20AC" + - "\u00B5\u00EC\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u0023\u00A5\u00B7\u00A9\u0040\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + - "\u00E0\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u00A6\u00F3\u00F5" + - "\u00E8\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u0060\u00FA\u00FF" + - "\u00E7\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7FB1\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\uB5C1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE990\u4851\u5F6D" + - "\uDD81\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA944\uBB54\u5807" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB07B\u3FB2\uCD7C\uBDB4\u9A8A\uBACA\uAFBC\u4A8F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u9E68\u7471\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\uECBF\u80FD\uFEFB\uFCAD\uAE59" + - "\uC045\u4246\u4347\u9CE0\uD05A\u5253\uA155\u5657\u8C49\u6ACE\uCBCF\uCCE1\u7079\uDEDB\uDC8D\u8EDF" + - "\uFFFF\u0F9F\u3F3F\uBC3F\uFFFF\u0036\u3F3F\u9F3F\uFFFF\u6F29\u3F3F\u3F4F\u7FB1\u5B6C\u507D\u4D5D" + - "\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\uB5C1\uC2C3\uC4C5\uC6C7\uC8C9" + - "\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE990\u4851\u5F6D\uDD81\u8283\u8485\u8687\u8889" + - "\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA944\uBB54\u583F\uFFFF\u0050\u3F3F"; - - - ConvTable1144() - { - super(1144, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1145.java b/cvsroot/src/com/ibm/as400/access/ConvTable1145.java deleted file mode 100644 index ce7f35b96..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1145.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1145.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1145 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5\u00E7\u00A6\u005B\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u005D\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u00C7\u0023\u00F1\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0060\u003A\u00D1\u0040\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u20AC" + - "\u00B5\u00A8\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u005E\u0021\u00AF\u007E\u00B4\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u40BB\u7F69\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\uBA6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uBD07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u3FB2\u49B5\uA1B4\u9A8A\u5FCA\uAFBC\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u9E68\u7471\u7273\u7875\u7677\uAC7B\uEDEE\uEBEF\uECBF\u80FD\uFEFB\uFCAD\uAE59" + - "\u4445\u4246\u4347\u9C48\u5451\u5253\u5855\u5657\u8C6A\uCDCE\uCBCF\uCCE1\u70DD\uDEDB\uDC8D\u8EDF" + - "\uFFFF\u0F9F\u3F3F\uBC3F\uFFFF\u0036\u3F3F\u9F3F\uFFFF\u6F29\u3F3F\u3FBB\u7F69\u5B6C\u507D\u4D5D" + - "\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9" + - "\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\uBA6D\u7981\u8283\u8485\u8687\u8889" + - "\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uBD3F\uFFFF\u0050\u3F3F"; - - - ConvTable1145() - { - super(1145, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1146.java b/cvsroot/src/com/ibm/as400/access/ConvTable1146.java deleted file mode 100644 index d7eb155b5..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1146.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1146.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1146 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5\u00E7\u00F1\u0024\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u0021\u00A3\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u20AC" + - "\u00B5\u00AF\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u005B\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u005E\u005D\u007E\u00A8\u00B4\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u4A6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9B1\uE0BB\uBA6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uBC07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB05B\u3FB2\u6AB5\uBDB4\u9A8A\u5FCA\uAFA1\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u9E68\u7471\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\uECBF\u80FD\uFEFB\uFCAD\uAE59" + - "\u4445\u4246\u4347\u9C48\u5451\u5253\u5855\u5657\u8C49\uCDCE\uCBCF\uCCE1\u70DD\uDEDB\uDC8D\u8EDF" + - "\uFFFF\u0F9F\u3F3F\uA13F\uFFFF\u0036\u3F3F\u9F3F\uFFFF\u6F29\u3F3F\u3F5A\u7F7B\u4A6C\u507D\u4D5D" + - "\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9" + - "\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9B1\uE0BB\uBA6D\u7981\u8283\u8485\u8687\u8889" + - "\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uBC3F\uFFFF\u0050\u3F3F"; - - - ConvTable1146() - { - super(1146, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1147.java b/cvsroot/src/com/ibm/as400/access/ConvTable1147.java deleted file mode 100644 index 8bc91088c..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1147.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1147.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1147 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u0040\u00E1\u00E3\u00E5\\\u00F1\u00B0\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u007B\u00EA\u00EB\u007D\u00ED\u00EE\u00EF\u00EC\u00DF\u00A7\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u00C7\u00D1\u00F9\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u00B5\u003A\u00A3\u00E0\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u005B\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u20AC" + - "\u0060\u00A8\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u0023\u00A5\u00B7\u00A9\u005D\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u007E\u00B4\u00D7" + - "\u00E9\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + - "\u00E8\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u00A6\u00FA\u00FF" + - "\u00E7\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7FB1\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u44C1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE990\u48B5\u5F6D" + - "\uA081\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA951\uBB54\uBD07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB07B\u3FB2\uDD5A\uA1B4\u9A8A\uBACA\uAFBC\u4A8F\uEAFA\uBE79\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u9E68\u7471\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\uECBF\u80FD\uFEFB\uFCAD\uAE59" + - "\u7C45\u4246\u4347\u9CE0\uD0C0\u5253\u5855\u5657\u8C49\uCDCE\uCBCF\uCCE1\u706A\uDEDB\uDC8D\u8EDF" + - "\uFFFF\u0F9F\u3F3F\uBC3F\uFFFF\u0036\u3F3F\u9F3F\uFFFF\u6F29\u3F3F\u3F4F\u7FB1\u5B6C\u507D\u4D5D" + - "\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u44C1\uC2C3\uC4C5\uC6C7\uC8C9" + - "\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE990\u48B5\u5F6D\uA081\u8283\u8485\u8687\u8889" + - "\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA951\uBB54\uBD3F\uFFFF\u0050\u3F3F"; - - - ConvTable1147() - { - super(1147, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1148.java b/cvsroot/src/com/ibm/as400/access/ConvTable1148.java deleted file mode 100644 index 95b64db56..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1148.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1148.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1148 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5\u00E7\u00F1\u005B\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u005D\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u20AC" + - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\uBBD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u3FB2\u6AB5\uBDB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u9E68\u7471\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\uECBF\u80FD\uFEFB\uFCAD\uAE59" + - "\u4445\u4246\u4347\u9C48\u5451\u5253\u5855\u5657\u8C49\uCDCE\uCBCF\uCCE1\u70DD\uDEDB\uDC8D\u8EDF" + - "\uFFFF\u0F9F\u3F3F\uBC3F\uFFFF\u0036\u3F3F\u9F3F\uFFFF\u6F29\u3F3F\u3F4F\u7F7B\u5B6C\u507D\u4D5D" + - "\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9" + - "\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D\u7981\u8283\u8485\u8687\u8889" + - "\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\uBBD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable1148() - { - super(1148, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1149.java b/cvsroot/src/com/ibm/as400/access/ConvTable1149.java deleted file mode 100644 index b60cd751f..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1149.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1149.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1149 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5\u00E7\u00F1\u00DE\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u00C6\u0024\u002A\u0029\u003B\u00D6" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u00F0\u003A\u0023\u00D0\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u0060\u00FD\u007B\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u007D\u00B8\u005D\u20AC" + - "\u00B5\u00F6\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u0040\u00DD\u005B\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\\\u00D7" + - "\u00FE\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u007E\u00F2\u00F3\u00F5" + - "\u00E6\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + - "\u00B4\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u005E\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\uACC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9AE\uBE9E\uEC6D" + - "\u8C81\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA98E\uBB9C\uCC07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u3FB2\u6AB5\uBDB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\uE0A0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u5A68\u7471\u7273\u7875\u7677\u7C69\uEDEE\uEBEF\u5FBF\u80FD\uFEFB\uFCAD\u4A59" + - "\u4445\u4246\u4347\uD048\u5451\u5253\u5855\u5657\u7949\uCDCE\uCBCF\uA1E1\u70DD\uDEDB\uDC8D\uC0DF" + - "\uFFFF\u0F9F\u3F3F\uBC3F\uFFFF\u0036\u3F3F\u9F3F\uFFFF\u6F29\u3F3F\u3F4F\u7F7B\u5B6C\u507D\u4D5D" + - "\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\uACC1\uC2C3\uC4C5\uC6C7\uC8C9" + - "\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9AE\uBE9E\uEC6D\u8C81\u8283\u8485\u8687\u8889" + - "\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA98E\uBB9C\uCC3F\uFFFF\u0050\u3F3F"; - - - ConvTable1149() - { - super(1149, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1153.java b/cvsroot/src/com/ibm/as400/access/ConvTable1153.java deleted file mode 100644 index e99680f71..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1153.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1153.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1153 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u0163\u00E1\u0103\u010D\u00E7\u0107\u005B\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u00E9\u0119\u00EB\u016F\u00ED\u00EE\u013E\u013A\u00DF\u005D\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u02DD\u00C1\u0102\u010C\u00C7\u0106\u007C\u002C\u0025\u005F\u003E\u003F" + - "\u02C7\u00C9\u0118\u00CB\u016E\u00CD\u00CE\u013D\u0139\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u02D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u015B\u0148\u0111\u00FD\u0159\u015F" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u0142\u0144\u0161\u00B8\u02DB\u20AC" + - "\u0105\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u015A\u0147\u0110\u00DD\u0158\u015E" + - "\u02D9\u0104\u017C\u0162\u017B\u00A7\u017E\u017A\u017D\u0179\u0141\u0143\u0160\u00A8\u00B4\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u0155\u00F3\u0151" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u011A\u0171\u00FC\u0165\u00FA\u011B" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u010F\u00D4\u00D6\u0154\u00D3\u0150" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u010E\u0170\u00DC\u0164\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u6AD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\u3F3F\u3F3F\u3FB5\uBD3F\u3F3F\u3FCA\u3F3F\u903F\u3F3F\uBE3F\u3F3F\u9D3F\u3F3F\u3F3F\u3F3F" + - "\u3F65\u623F\u633F\u3F68\u3F71\u3F73\u3F75\u763F\uAC3F\u3FEE\uEB3F\uECBF\u3F3F\uFE3F\uFCAD\u3F59" + - "\u3F45\u423F\u433F\u3F48\u3F51\u3F53\u3F55\u563F\u3F3F\u3FCE\uCB3F\uCCE1\u3F3F\uDE3F\uDC8D\u3F3F" + - "\u3F3F\u6646\uB1A0\u6949\u3F3F\u3F3F\u6747\uFAEA\uAC8C\u3F3F\u3F3F\u3F3F\u7252\uDADF\uFFFF\u000E" + - "\u3F3F\u3F78\u583F\u3F77\u573F\u3FBA\u9ABB\u9B3F\u3FAB\u8B3F\u3F3F\u3F3F\u3F3F\uEFCF\u3F3F\uEDCD" + - "\u3F3F\uAE8E\uAA8A\u3F3F\uAF8F\uBC9C\uB344\uFDDD\uFFFF\u0004\u3F3F\u7454\uFBDB\u3F3F\u3F3F\u3F3F" + - "\u3FB9\uB7B4\uB2B8\uB63F\uFFFF\u00A3\u3F3F\u3F70\uFFFF\b\u3F3F\u80B0\u3F9E\u3F64\uFFFF\u0EE7" + - "\u3F3F\u9F3F\uFFFF\u6F29\u3F3F\u3F4F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5" + - "\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4" + - "\uE5E6\uE7E8\uE94A\uE05A\u5F6D\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4" + - "\uA5A6\uA7A8\uA9C0\u6AD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable1153() - { - super(1153, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1154.java b/cvsroot/src/com/ibm/as400/access/ConvTable1154.java deleted file mode 100644 index 5a05ed465..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1154.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1154.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1154 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u0452\u0453\u0451\u0454\u0455\u0456\u0457\u0458\u005B\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u0459\u045A\u045B\u045C\u045E\u045F\u042A\u2116\u0402\u005D\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u0403\u0401\u0404\u0405\u0406\u0407\u0408\u0409\u007C\u002C\u0025\u005F\u003E\u003F" + - "\u040A\u040B\u040C\u00AD\u040E\u040F\u044E\u0430\u0431\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u0446\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u0434\u0435\u0444\u0433\u0445\u0438" + - "\u0439\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u043A\u043B\u043C\u043D\u043E\u043F" + - "\u044F\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u0440\u0441\u0442\u0443\u0436\u0432" + - "\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u0425\u0418\u0419\u041A\u041B\u041C" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u041D\u041E\u041F\u042F\u0420\u0421" + - "\\\u20AC\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u0422\u0423\u0416\u0412\u042C\u042B" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u0417\u0428\u042D\u0429\u0427\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u6AD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\uFFFF\u0005\u3F3F\u3F73\uFFFF\u01A9\u3F3F\u3F63\u5962\u6465\u6667\u6869\u7071\u723F\u7475" + - "\uB9BA\uEDBF\uBCBD\uECFA\uCBCC\uCDCE\uCFDA\uDBDC\uDEDF\uEAEB\uBECA\uBBFE\uFBFD\u57EF\uEEFC\uB8DD" + - "\u7778\uAF8D\u8A8B\uAEB2\u8F90\u9A9B\u9C9D\u9E9F\uAAAB\uACAD\u8C8E\u80B6\uB3B5\uB7B1\uB0B4\u76A0" + - "\u3F44\u4243\u4546\u4748\u4951\u5253\u543F\u5556\uFFFF\u0E26\u3F3F\uE13F\uFFFF\u0034\u3F3F\u583F" + - "\uFFFF\u6EF4\u3F3F\u3F4F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9" + - "\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8" + - "\uE94A\uE05A\u5F6D\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8" + - "\uA9C0\u6AD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable1154() - { - super(1154, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1155.java b/cvsroot/src/com/ibm/as400/access/ConvTable1155.java deleted file mode 100644 index e5958bc6c..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1155.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1155.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1155 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5\u007B\u00F1\u00C7\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u011E\u0130\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u005B\u00D1\u015F\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0131\u003A\u00D6\u015E\'\u003D\u00DC" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u007D\u0060\u00A6\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u20AC" + - "\u00B5\u00F6\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u005D\u0024\u0040\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + - "\u00E7\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u007E\u00F2\u00F3\u00F5" + - "\u011F\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\\\u00F9\u00FA\u00FF" + - "\u00FC\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u0023\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\"\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\uFCEC\uAD6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\uAEC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE968\uDCAC\u5F6D" + - "\u8D81\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA948\uBB8C\uCC07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u3FB2\u8EB5\uBDB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u9E4A\u7471\u7273\u7875\u7677\u3F69\uEDEE\uEBEF\u7BBF\u80FD\uFEFB\u7F3F\u3F59" + - "\u4445\u4246\u4347\u9CC0\u5451\u5253\u5855\u5657\u3F49\uCDCE\uCBCF\uA1E1\u70DD\uDEDB\uE03F\u3FDF" + - "\uFFFF\u000F\u3F3F\u5AD0\uFFFF\b\u3F3F\u5B79\uFFFF\u0016\u3F3F\u7C6A\uFFFF\u0FA6\u3F3F\u9F3F" + - "\uFFFF\u6F29\u3F3F\u3F4F\uFCEC\uAD6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9" + - "\u7A5E\u4C7E\u6E6F\uAEC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8" + - "\uE968\uDCAC\u5F6D\u8D81\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8" + - "\uA948\uBB8C\uCC3F\uFFFF\u0050\u3F3F"; - - - ConvTable1155() - { - super(1155, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1156.java b/cvsroot/src/com/ibm/as400/access/ConvTable1156.java deleted file mode 100644 index a1088d5ab..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1156.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1156.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1156 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u0161\u00E4\u0105\u012F\u016B\u00E5\u0113\u017E\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u00E9\u0119\u0117\u010D\u0173\u201E\u201C\u0123\u00DF\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u0160\u00C4\u0104\u012E\u016A\u00C5\u0112\u017D\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u0118\u0116\u010C\u0172\u012A\u013B\u0122\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u0101\u017C\u0144\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u0156\u0157\u00E6\u0137\u00C6\u20AC" + - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u201D\u017A\u0100\u017B\u0143\u00AE" + - "\u005E\u00A3\u012B\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u005B\u005D\u0179\u0136\u013C\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u014D\u00F6\u0146\u00F3\u00F5" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u0107\u00FC\u0142\u015B\u2019" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u014C\u00D6\u0145\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u0106\u00DC\u0141\u015A\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9BA\uE0BB\uB06D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\u4AB1\u3F3F\u6AB5\u3FB4\u3F8A\u5FCA\uAF3F\u908F\uEAFA\u3FA0\uB6B3\u3FDA\u3F8B\uB7B8\uB93F" + - "\u3F3F\u3F3F\u6367\u9E3F\u0000\u0003\u3F71\u3F3F\u3F3F\uEEEF\uECBF\u803F\u3F3F\uFC3F\u3F59\u3F3F" + - "\u3F3F\u4347\u9C3F\u0000\u0003\u3F51\u3F3F\u3F3F\uCECF\uCCE1\u703F\u3F3F\uDC3F\u3F3F\uAC8C\u3F3F" + - "\u6444\uFBDB\u3F3F\u3F3F\u7454\u3F3F\u3F3F\u6848\u3F3F\u7353\u7252\uFFFF\u0004\u3F3F\u7858\u3F3F" + - "\u3F3F\u3F3F\u76B2\u3F3F\u6545\u3F3F\u3F3F\u3F3F\uBD9D\u3F3F\u3F77\uBE3F\u3F3F\u3FFD\uDDAE\u8EED" + - "\uCD3F\u3F3F\u3F3F\uEBCB\uFFFF\u0004\u3F3F\u9A9B\u3F3F\uFEDE\u3F3F\u3F3F\u6242\uFFFF\u0004\u3F3F" + - "\u6646\u3F3F\u3F3F\u3F3F\u7555\u3F3F\u3F3F\u3FBC\uABAD\u8D69\u493F\uFFFF\u0F4C\u3F3F\u3FDF\u3F3F" + - "\u57AA\u563F\uFFFF\u0046\u3F3F\u9F3F\uFFFF\u6F29\u3F3F\u3F5A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60" + - "\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4" + - "\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9BA\uE0BB\uB06D\u7981\u8283\u8485\u8687\u8889\u9192\u9394" + - "\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable1156() - { - super(1156, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1157.java b/cvsroot/src/com/ibm/as400/access/ConvTable1157.java deleted file mode 100644 index 35cd3aa63..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1157.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1157.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1157 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u007B\u00E0\u00E1\u00E3\u007D\u00E7\u00F1\u00A7\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u0060\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u20AC\u00C5\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u0023\u00C0\u00C1\u00C3\u0024\u00C7\u00D1\u00F6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\\\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u00E9\u003A\u00C4\u00D6\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u0161\u00FD\u017E\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u005D" + - "\u00B5\u00FC\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u0160\u00DD\u017D\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u005B\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + - "\u00E4\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00A6\u00F2\u00F3\u00F5" + - "\u00E5\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u007E\u00F9\u00FA\u00FF" + - "\u00C9\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u0040\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F63\u676C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\uECC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9B5\u719F\u5F6D" + - "\u5181\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA943\uBB47\uDC07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u3FB2\uCC4A\uBDB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u7B5B\u9E68\u74E0\u7273\u7875\u7677\u3F69\uEDEE\uEBEF\u7CBF\u80FD\uFEFB\uFCAD\u3F59" + - "\u4445\u4246\uC0D0\u9C48\u5479\u5253\u5855\u5657\u3F49\uCDCE\uCBCF\u6AE1\u70DD\uDEDB\uA18D\u3FDF" + - "\uFFFF\u0030\u3F3F\uAC8C\uFFFF\r\u3F3F\u3FAE\u8E3F\uFFFF\u0F5F\u3F3F\uBC3F\uFFFF\u0036\u3F3F" + - "\u5A3F\uFFFF\u6F29\u3F3F\u3F4F\u7F63\u676C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7" + - "\uF8F9\u7A5E\u4C7E\u6E6F\uECC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6" + - "\uE7E8\uE9B5\u719F\u5F6D\u5181\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6" + - "\uA7A8\uA943\uBB47\uDC3F\uFFFF\u0050\u3F3F"; - - - ConvTable1157() - { - super(1157, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1158.java b/cvsroot/src/com/ibm/as400/access/ConvTable1158.java deleted file mode 100644 index d1860cf86..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1158.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1158.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1158 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u0452\u0491\u0451\u0454\u0455\u0456\u0457\u0458\u005B\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u0459\u045A\u045B\u045C\u045E\u045F\u042A\u2116\u0402\u005D\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u0490\u0401\u0404\u0405\u0406\u0407\u0408\u0409\u007C\u002C\u0025\u005F\u003E\u003F" + - "\u040A\u040B\u040C\u00AD\u040E\u040F\u044E\u0430\u0431\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u0446\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u0434\u0435\u0444\u0433\u0445\u0438" + - "\u0439\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u043A\u043B\u043C\u043D\u043E\u043F" + - "\u044F\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u0440\u0441\u0442\u0443\u0436\u0432" + - "\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u0425\u0418\u0419\u041A\u041B\u041C" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u041D\u041E\u041F\u042F\u0420\u0421" + - "\\\u20AC\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u0422\u0423\u0416\u0412\u042C\u042B" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u0417\u0428\u042D\u0429\u0427\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u6AD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\uFFFF\u0005\u3F3F\u3F73\uFFFF\u01A9\u3F3F\u3F63\u593F\u6465\u6667\u6869\u7071\u723F\u7475" + - "\uB9BA\uEDBF\uBCBD\uECFA\uCBCC\uCDCE\uCFDA\uDBDC\uDEDF\uEAEB\uBECA\uBBFE\uFBFD\u57EF\uEEFC\uB8DD" + - "\u7778\uAF8D\u8A8B\uAEB2\u8F90\u9A9B\u9C9D\u9E9F\uAAAB\uACAD\u8C8E\u80B6\uB3B5\uB7B1\uB0B4\u76A0" + - "\u3F44\u423F\u4546\u4748\u4951\u5253\u543F\u5556\uFFFF\u0018\u3F3F\u6243\uFFFF\u0E0D\u3F3F\uE13F" + - "\uFFFF\u0034\u3F3F\u583F\uFFFF\u6EF4\u3F3F\u3F4F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1" + - "\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8" + - "\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798" + - "\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u6AD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable1158() - { - super(1158, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1160.java b/cvsroot/src/com/ibm/as400/access/ConvTable1160.java deleted file mode 100644 index 233380b08..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1160.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1160.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1160 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07\u005B\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u0E48\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u005D\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u0E0F\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u005E\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u0E3F\u0E4E\u0E16\u0E17\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u0E4F\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u0E1D\u0E1E\u0E1F\u0E20\u0E21\u0E22" + - "\u0E5A\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u0E23\u0E24\u0E25\u0E26\u0E27\u0E28" + - "\u0E5B\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E" + - "\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59\u0E2F\u0E30\u0E31\u0E32\u0E33\u0E34" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u0E49\u0E35\u0E36\u0E37\u0E38\u0E39" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u0E3A\u0E40\u0E41\u0E42\u0E43\u0E44" + - "\\\u0E4A\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u0E45\u0E46\u0E47\u0E48\u0E49\u0E4A" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u0E4B\u0E4C\u0E4D\u0E4B\u20AC\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE949\uE059\u696D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\u4A3F\u3F3F\u6A3F\u3F3F\u3F3F\u5F3F\uFFFF\u06A9\u3F3F\u3F42\u4344\u4546\u4748\u5253\u5455" + - "\u5657\u5862\u6364\u6566\u6768\u7273\u7475\u7677\u788A\u8B8C\u8D8E\u8F9A\u9B9C\u9D9E\u9FAA\uABAC" + - "\uADAE\uAFBA\uBBBC\uBDBE\uBFCB\uCCCD\uCECF\uDA3F\u3F3F\u3F70\uDBDC\uDDDE\uDFEA\uEBEC\uEDEE\uEFFA" + - "\uFBFC\u7180\uB0B1\uB2B3\uB4B5\uB6B7\uB8B9\u90A0\uFFFF\u0928\u3F3F\uFE3F\uFFFF\u6F29\u3F3F\u3F5A" + - "\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1" + - "\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE949\uE059\u696D\u7981" + - "\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA13F\uFFFF" + - "\u0050\u3F3F"; - - - ConvTable1160() - { - super(1160, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1164.java b/cvsroot/src/com/ibm/as400/access/ConvTable1164.java deleted file mode 100644 index 10eaef1a2..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1164.java +++ /dev/null @@ -1,61 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1164.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1164 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u0103\u00E5\u00E7\u00F1\u005B\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u0303\u00DF\u005D\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u0102\u00C5\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u20AB\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u0111\u0309\u0300\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u0152\u00C6\u20AC" + - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u0110\u0323\u0301\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u0153\u0178\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u01B0\u00F3\u01A1" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u01AF\u00D3\u01A0" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\uBBD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u3FB2\u6AB5\u3FB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\u3FA0\uB6B3\u3FDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u623F\u6367\u9E68\u7471\u7273\u3F75\u7677\uAC69\u3FEE\uEB3F\uECBF\u80FD\uFEFB\uFC3F\u3F59" + - "\u4445\u423F\u4347\u9C48\u5451\u5253\u3F55\u5657\u3F49\u3FCE\uCB3F\uCCE1\u70DD\uDEDB\uDC3F\u3FDF" + - "\u3F3F\u6646\uFFFF\u0006\u3F3F\uAC8C\uFFFF\u0020\u3F3F\u9DBD\uFFFF\u0012\u3F3F\uBE3F\uFFFF\u0013" + - "\u3F3F\uEFCF\uFFFF\u0006\u3F3F\u3FED\uCD3F\uFFFF\u00A7\u3F3F\u8EAE\u3F58\u3F3F\u3F3F\u3F8D\uFFFF" + - "\f\u3F3F\u3FAD\uFFFF\u0E8D\u3F3F\uBC3F\uFFFF\u0035\u3F3F\u3F78\u9F3F\uFFFF\u6F29\u3F3F\u3F4F" + - "\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1" + - "\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D\u7981" + - "\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\uBBD0\uA13F\uFFFF" + - "\u0050\u3F3F"; - - - ConvTable1164() - { - super(1164, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1200.java b/cvsroot/src/com/ibm/as400/access/ConvTable1200.java deleted file mode 100644 index 3aecda908..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1200.java +++ /dev/null @@ -1,22 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1200.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1200 extends ConvTableUnicodeBigMap -{ - ConvTable1200() - { - super(1200); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1201.java b/cvsroot/src/com/ibm/as400/access/ConvTable1201.java deleted file mode 100644 index 4f675e422..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1201.java +++ /dev/null @@ -1,22 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1201.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1201 extends ConvTableUnicodeBigMap -{ - ConvTable1201() - { - super(1201); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1202.java b/cvsroot/src/com/ibm/as400/access/ConvTable1202.java deleted file mode 100644 index f397d9c77..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1202.java +++ /dev/null @@ -1,53 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1202.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// The 1202 ccsid is just little endian Unicode (13488) so all we do is flip the high and low bytes. This used to be CCSID 1200. -class ConvTable1202 extends ConvTable // Instead of ConvTableDoubleMap. -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable1202() - { - super(1202); - } - - // Perform a CCSID to Unicode conversion. - String byteArrayToString(byte[] buf, int offset, int length, BidiConversionProperties properties) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting byte array to string for ccsid: " + ccsid_, buf, offset, length); - char[] dest = new char[length / 2]; - for (int i = 0; i < length / 2; ++i) - { - dest[i] = (char)(((0x00FF & buf[(i * 2) + 1 + offset]) << 8) + (0x00FF & buf[(i * 2) + offset])); - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination string for ccsid: " + ccsid_, ConvTable.dumpCharArray(dest)); - return String.copyValueOf(dest); - } - - // Perform a Unicode to CCSID conversion. - byte[] stringToByteArray(String source, BidiConversionProperties properties) - { - char[] src = source.toCharArray(); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting string to byte array for ccsid: " + encoding_, ConvTable.dumpCharArray(src)); - byte[] dest = new byte[src.length * 2]; - for (int i = 0; i < src.length; ++i) - { - dest[i * 2 + 1] = (byte)(src[i] >>> 8); - dest[i * 2] = (byte)(0x00FF & src[i]); - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination byte array for ccsid: " + ccsid_, dest); - return dest; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1208.java b/cvsroot/src/com/ibm/as400/access/ConvTable1208.java deleted file mode 100644 index 11bc9e1cd..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1208.java +++ /dev/null @@ -1,314 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1208.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; - -class ConvTable1208 extends ConvTable -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable1208() - { - super(1208); - } - - // Perform an OS/400 CCSID to Unicode conversion. - final String byteArrayToString(byte[] buf, int offset, int length, BidiConversionProperties properties) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting byte array to string for ccsid: " + ccsid_, buf, offset, length); - char[] out = new char[length]; - int outCount = 0; - for (int i=offset; i 0x00FFFF) // Surrogate pair. - { - out[outCount++] = (char)((c - 0x10000) / 0x400 + 0xD800); - out[outCount++] = (char)((c - 0x10000) % 0x400 + 0xDC00); - } - else - { - out[outCount++] = (char)c; - } - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination string for ccsid: " + ccsid_, ConvTable.dumpCharArray(out)); - return String.copyValueOf(out, 0, outCount); - } - - // Perform a Unicode to OS/400 CCSID conversion. - final byte[] stringToByteArray(String source, BidiConversionProperties properties) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting string to byte array for ccsid: " + ccsid_, ConvTable.dumpCharArray(source.toCharArray(), 0, source.length())); - int len = source.length(); - byte[] buf = new byte[len * 4]; - int bufCount = 0; - for (int i = 0; i < len; ++i) - { - int c = source.charAt(i) & 0x00FFFF; - if (c > 0xD7FF && c < 0xDC00) - { - if (++i < len) - { - c = (c - 0xD800) * 0x400 + ((source.charAt(i) & 0x00FFFF) - 0xDC00) + 0x10000; - } - else if (!CharConverter.isFaultTolerantConversion()) - { - throw new ArrayIndexOutOfBoundsException(); - } - else - { - // We're fault tolerant, ignore the high surrogate and just return. - byte[] ret = new byte[bufCount]; - System.arraycopy(buf, 0, ret, 0, bufCount); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Fault-tolerant in mid-surrogate. Destination byte array for ccsid: " + ccsid_, ret); - return ret; - } - } - if (c < 0x80) - { - buf[bufCount++] = (byte)c; - } - else if (c < 0x800) - { - buf[bufCount++] = (byte)(0xC0 | (c >> 6)); - buf[bufCount++] = (byte)(0x80 | (c & 0x3F)); - } - else if (c < 0x10000) - { - buf[bufCount++] = (byte)(0xE0 | (c >> 12)); - buf[bufCount++] = (byte)(0x80 | ((c >> 6) & 0x3F)); - buf[bufCount++] = (byte)(0x80 | (c & 0x3F)); - } - else - { - buf[bufCount++] = (byte)(0xF0 | (c >> 18)); - buf[bufCount++] = (byte)(0x80 | ((c >> 12) & 0x3F)); - buf[bufCount++] = (byte)(0x80 | ((c >> 6) & 0x3F)); - buf[bufCount++] = (byte)(0x80 | (c & 0x3F)); - } - } - byte[] ret = new byte[bufCount]; - System.arraycopy(buf, 0, ret, 0, bufCount); - - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination byte array for ccsid: " + ccsid_, ret); - return ret; - } - - final byte[] stringToByteArray(char[] src, int offset, int length) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting string to byte array for ccsid: " + ccsid_, ConvTable.dumpCharArray(src, offset, length)); - byte[] buf = new byte[src.length * 4]; - int bufCount = 0; - int len = offset + length; - for (int i = offset; i < len; ++i) - { - int c = src[i] & 0x00FFFF; - if (c > 0xD7FF && c < 0xDC00) - { - if (++i < len) - { - c = (c - 0xD800) * 0x400 + ((src[i] & 0x00FFFF) - 0xDC00) + 0x10000; - } - else if (!CharConverter.isFaultTolerantConversion()) - { - throw new ArrayIndexOutOfBoundsException(); - } - else - { - // We're fault tolerant, ignore the high surrogate and just return. - byte[] ret = new byte[bufCount]; - System.arraycopy(buf, 0, ret, 0, bufCount); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Fault-tolerant in mid-surrogate. Destination byte array for ccsid: " + ccsid_, ret); - return ret; - } - } - if (c < 0x80) - { - buf[bufCount++] = (byte)c; - } - else if (c < 0x800) - { - buf[bufCount++] = (byte)(0xC0 | (c >> 6)); - buf[bufCount++] = (byte)(0x80 | (c & 0x3F)); - } - else if (c < 0x10000) - { - buf[bufCount++] = (byte)(0xE0 | (c >> 12)); - buf[bufCount++] = (byte)(0x80 | ((c >> 6) & 0x3F)); - buf[bufCount++] = (byte)(0x80 | (c & 0x3F)); - } - else - { - buf[bufCount++] = (byte)(0xF0 | (c >> 18)); - buf[bufCount++] = (byte)(0x80 | ((c >> 12) & 0x3F)); - buf[bufCount++] = (byte)(0x80 | ((c >> 6) & 0x3F)); - buf[bufCount++] = (byte)(0x80 | (c & 0x3F)); - } - } - byte[] ret = new byte[bufCount]; - System.arraycopy(buf, 0, ret, 0, bufCount); - - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination byte array for ccsid: " + ccsid_, ret); - return ret; - } - - final void stringToByteArray(String source, byte[] buf, int offset) throws CharConversionException - { - int bufCount = offset; - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting string to byte array for ccsid: " + ccsid_, ConvTable.dumpCharArray(source.toCharArray())); - try - { - int len = source.length(); - for (int i = 0; i < len; ++i) - { - int c = source.charAt(i) & 0x00FFFF; - if (c > 0xD7FF && c < 0xDC00) - { - if (++i < len) - { - c = (c - 0xD800) * 0x400 + ((source.charAt(i) & 0x00FFFF) - 0xDC00) + 0x10000; - } - else if (!CharConverter.isFaultTolerantConversion()) - { - throw new CharConversionException(); - } - else - { - // We're fault tolerant, ignore the high surrogate and just return. - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Fault-tolerant in mid-surrogate. Destination byte array for ccsid: " + ccsid_, buf, offset, bufCount - offset); - return; - } - } - if (c < 0x80) - { - buf[bufCount++] = (byte)c; - } - else if (c < 0x800) - { - buf[bufCount++] = (byte)(0xC0 | (c >> 6)); - buf[bufCount++] = (byte)(0x80 | (c & 0x3F)); - } - else if (c < 0x10000) - { - buf[bufCount++] = (byte)(0xE0 | (c >> 12)); - buf[bufCount++] = (byte)(0x80 | ((c >> 6) & 0x3F)); - buf[bufCount++] = (byte)(0x80 | (c & 0x3F)); - } - else - { - buf[bufCount++] = (byte)(0xF0 | (c >> 18)); - buf[bufCount++] = (byte)(0x80 | ((c >> 12) & 0x3F)); - buf[bufCount++] = (byte)(0x80 | ((c >> 6) & 0x3F)); - buf[bufCount++] = (byte)(0x80 | (c & 0x3F)); - } - } - } - catch (ArrayIndexOutOfBoundsException aioobe) - { - throw new CharConversionException(); - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination byte array for ccsid: " + ccsid_, buf, offset, bufCount - offset); - } - - final void stringToByteArray(String source, byte[] buf, int offset, int length) throws CharConversionException - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting string to byte array for ccsid: " + ccsid_, ConvTable.dumpCharArray(source.toCharArray())); - try - { - int len = source.length(); - int bufCount = offset; - int max = offset+length; - for (int i = 0; i < len && bufCount < max; ++i) - { - int c = source.charAt(i) & 0x00FFFF; - if (c > 0xD7FF && c < 0xDC00) - { - if (++i < len) - { - c = (c - 0xD800) * 0x400 + ((source.charAt(i) & 0x00FFFF) - 0xDC00) + 0x10000; - } - else if (!CharConverter.isFaultTolerantConversion()) - { - throw new CharConversionException(); - } - else - { - // We're fault tolerant, ignore the high surrogate and just return. - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Fault-tolerant in mid-surrogate. Destination byte array for ccsid: " + ccsid_, buf, offset, length); - return; - } - } - if (c < 0x80) - { - buf[bufCount++] = (byte)c; - } - else if (c < 0x800) - { - buf[bufCount++] = (byte)(0xC0 | (c >> 6)); - if (bufCount < max) buf[bufCount++] = (byte)(0x80 | (c & 0x3F)); - } - else if (c < 0x10000) - { - buf[bufCount++] = (byte)(0xE0 | (c >> 12)); - if (bufCount < max) buf[bufCount++] = (byte)(0x80 | ((c >> 6) & 0x3F)); - if (bufCount < max) buf[bufCount++] = (byte)(0x80 | (c & 0x3F)); - } - else - { - buf[bufCount++] = (byte)(0xF0 | (c >> 18)); - if (bufCount < max) buf[bufCount++] = (byte)(0x80 | ((c >> 12) & 0x3F)); - if (bufCount < max) buf[bufCount++] = (byte)(0x80 | ((c >> 6) & 0x3F)); - if (bufCount < max) buf[bufCount++] = (byte)(0x80 | (c & 0x3F)); - } - } - } - catch (ArrayIndexOutOfBoundsException aioobe) - { - throw new CharConversionException(); - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination byte array for ccsid: " + ccsid_, buf, offset, length); - } - - final int stringToByteArray(String source, byte[] buf, int offset, int length, BidiConversionProperties properties) throws CharConversionException - { - // Don't have a Bidi string type for UTF-8. - stringToByteArray(source, buf, offset, length); - return 0; //@trnc - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1250.java b/cvsroot/src/com/ibm/as400/access/ConvTable1250.java deleted file mode 100644 index dea252a22..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1250.java +++ /dev/null @@ -1,64 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1250.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1250 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u20AC\u0081\u201A\u0083\u201E\u2026\u2020\u2021\u0088\u2030\u0160\u2039\u015A\u0164\u017D\u0179" + - "\u0090\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u0098\u2122\u0161\u203A\u015B\u0165\u017E\u017A" + - "\u00A0\u02C7\u02D8\u0141\u00A4\u0104\u00A6\u00A7\u00A8\u00A9\u015E\u00AB\u00AC\u00AD\u00AE\u017B" + - "\u00B0\u00B1\u02DB\u0142\u00B4\u00B5\u00B6\u00B7\u00B8\u0105\u015F\u00BB\u013D\u02DD\u013E\u017C" + - "\u0154\u00C1\u00C2\u0102\u00C4\u0139\u0106\u00C7\u010C\u00C9\u0118\u00CB\u011A\u00CD\u00CE\u010E" + - "\u0110\u0143\u0147\u00D3\u00D4\u0150\u00D6\u00D7\u0158\u016E\u00DA\u0170\u00DC\u00DD\u0162\u00DF" + - "\u0155\u00E1\u00E2\u0103\u00E4\u013A\u0107\u00E7\u010D\u00E9\u0119\u00EB\u011B\u00ED\u00EE\u010F" + - "\u0111\u0144\u0148\u00F3\u00F4\u0151\u00F6\u00F7\u0159\u016F\u00FA\u0171\u00FC\u00FD\u0163\u02D9"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u1A81\u1A83\u1A1A\u1A1A\u881A\u1A1A\u1A1A\u1A1A\u901A\u1A1A\u1A1A\u1A1A\u981A\u1A1A\u1A1A\u1A1A" + - "\uA01A\u1A1A\uA41A\uA6A7\uA8A9\u1AAB\uACAD\uAE1A\uB0B1\u1A1A\uB4B5\uB6B7\uB81A\u1ABB\u1A1A\u1A1A" + - "\u1AC1\uC21A\uC41A\u1AC7\u1AC9\u1ACB\u1ACD\uCE1A\u1A1A\u1AD3\uD41A\uD6D7\u1A1A\uDA1A\uDCDD\u1ADF" + - "\u1AE1\uE21A\uE41A\u1AE7\u1AE9\u1AEB\u1AED\uEE1A\u1A1A\u1AF3\uF41A\uF6F7\u1A1A\uFA1A\uFCFD\u1A1A" + - "\u1A1A\uC3E3\uA5B9\uC6E6\u1A1A\u1A1A\uC8E8\uCFEF\uD0F0\u1A1A\u1A1A\u1A1A\uCAEA\uCCEC\uFFFF\u000E" + - "\u1A1A\u1AC5\uE51A\u1ABC\uBE1A\u1AA3\uB3D1\uF11A\u1AD2\uF21A\u1A1A\u1A1A\u1A1A\uD5F5\u1A1A\uC0E0" + - "\u1A1A\uD8F8\u8C9C\u1A1A\uAABA\u8A9A\uDEFE\u8D9D\uFFFF\u0004\u1A1A\uD9F9\uDBFB\u1A1A\u1A1A\u1A1A" + - "\u1A8F\u9FAF\uBF8E\u9E1A\uFFFF\u00A3\u1A1A\u1AA1\uFFFF\b\u1A1A\uA2FF\u1AB2\u1ABD\uFFFF\u0E9A" + - "\u1A1A\u1A96\u971A\u1A1A\u9192\u821A\u9394\u841A\u8687\u951A\u1A1A\u851A\uFFFF\u0004\u1A1A\u891A" + - "\u1A1A\u1A1A\u1A1A\u1A8B\u9B1A\uFFFF\u0038\u1A1A\u801A\uFFFF\u003A\u1A1A\u991A\uFFFF\u6EEE\u1A1A" + - "\u1A21\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1A" + - "\uFFFF\u0050\u1A1A"; - - - ConvTable1250() - { - super(1250, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1251.java b/cvsroot/src/com/ibm/as400/access/ConvTable1251.java deleted file mode 100644 index f71b6e960..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1251.java +++ /dev/null @@ -1,61 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1251.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1251 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0402\u0403\u201A\u0453\u201E\u2026\u2020\u2021\u20AC\u2030\u0409\u2039\u040A\u040C\u040B\u040F" + - "\u0452\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u0098\u2122\u0459\u203A\u045A\u045C\u045B\u045F" + - "\u00A0\u040E\u045E\u0408\u00A4\u0490\u00A6\u00A7\u0401\u00A9\u0404\u00AB\u00AC\u00AD\u00AE\u0407" + - "\u00B0\u00B1\u0406\u0456\u0491\u00B5\u00B6\u00B7\u0451\u2116\u0454\u00BB\u0458\u0405\u0455\u0457" + - "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F" + - "\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F" + - "\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F" + - "\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\uFFFF\f\u1A1A\u981A\u1A1A\u1A1A\u1A1A\uA01A\u1A1A\uA41A\uA6A7\u1AA9\u1AAB\uACAD\uAE1A\uB0B1" + - "\u1A1A\u1AB5\uB6B7\u1A1A\u1ABB\uFFFF\u01A2\u1A1A\u1AA8\u8081\uAABD\uB2AF\uA38A\u8C8E\u8D1A\uA18F" + - "\uC0C1\uC2C3\uC4C5\uC6C7\uC8C9\uCACB\uCCCD\uCECF\uD0D1\uD2D3\uD4D5\uD6D7\uD8D9\uDADB\uDCDD\uDEDF" + - "\uE0E1\uE2E3\uE4E5\uE6E7\uE8E9\uEAEB\uECED\uEEEF\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\uFAFB\uFCFD\uFEFF" + - "\u1AB8\u9083\uBABE\uB3BF\uBC9A\u9C9E\u9D1A\uA29F\uFFFF\u0018\u1A1A\uA5B4\uFFFF\u0DC0\u1A1A\u1A96" + - "\u971A\u1A1A\u9192\u821A\u9394\u841A\u8687\u951A\u1A1A\u851A\uFFFF\u0004\u1A1A\u891A\u1A1A\u1A1A" + - "\u1A1A\u1A8B\u9B1A\uFFFF\u0038\u1A1A\u881A\uFFFF\u0034\u1A1A\uB91A\uFFFF\u0005\u1A1A\u991A\uFFFF" + - "\u6EEE\u1A1A\u1A21\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B" + - "\u3C3D\u3E3F\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B" + - "\u5C5D\u5E5F\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B" + - "\u7C7D\u7E1A\uFFFF\u0050\u1A1A"; - - - ConvTable1251() - { - super(1251, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1252.java b/cvsroot/src/com/ibm/as400/access/ConvTable1252.java deleted file mode 100644 index fbc79b803..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1252.java +++ /dev/null @@ -1,61 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1252.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1252 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u20AC\u0081\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\u0160\u2039\u0152\u008D\u017D\u008F" + - "\u0090\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\u0161\u203A\u0153\u009D\u017E\u0178" + - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + - "\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u0000\u0003\u1A81\u1A1A\u1A1A\u1A8D\u1A8F\u901A\uFFFF\u0005\u1A1A\u1A9D\u1A1A\uA0A1\uA2A3\uA4A5" + - "\uA6A7\uA8A9\uAAAB\uACAD\uAEAF\uB0B1\uB2B3\uB4B5\uB6B7\uB8B9\uBABB\uBCBD\uBEBF\uC0C1\uC2C3\uC4C5" + - "\uC6C7\uC8C9\uCACB\uCCCD\uCECF\uD0D1\uD2D3\uD4D5\uD6D7\uD8D9\uDADB\uDCDD\uDEDF\uE0E1\uE2E3\uE4E5" + - "\uE6E7\uE8E9\uEAEB\uECED\uEEEF\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\uFAFB\uFCFD\uFEFF\uFFFF\u0029\u1A1A" + - "\u8C9C\uFFFF\u0006\u1A1A\u8A9A\uFFFF\u000B\u1A1A\u9F1A\u1A1A\u1A8E\u9E1A\uFFFF\t\u1A1A\u831A" + - "\uFFFF\u0099\u1A1A\u881A\uFFFF\n\u1A1A\u981A\uFFFF\u0E9A\u1A1A\u1A96\u971A\u1A1A\u9192\u821A" + - "\u9394\u841A\u8687\u951A\u1A1A\u851A\uFFFF\u0004\u1A1A\u891A\u1A1A\u1A1A\u1A1A\u1A8B\u9B1A\uFFFF" + - "\u0038\u1A1A\u801A\uFFFF\u003A\u1A1A\u991A\uFFFF\u6EEE\u1A1A\u1A21\u2223\u2425\u2627\u2829\u2A2B" + - "\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F\u4041\u4243\u4445\u4647\u4849\u4A4B" + - "\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F\u6061\u6263\u6465\u6667\u6869\u6A6B" + - "\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1A\uFFFF\u0050\u1A1A"; - - - ConvTable1252() - { - super(1252, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1253.java b/cvsroot/src/com/ibm/as400/access/ConvTable1253.java deleted file mode 100644 index 5d20a20e4..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1253.java +++ /dev/null @@ -1,61 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1253.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1253 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u20AC\u0081\u201A\u0192\u201E\u2026\u2020\u2021\u0088\u2030\u008A\u2039\u008C\u008D\u008E\u008F" + - "\u0090\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u0098\u2122\u009A\u203A\u009C\u009D\u009E\u009F" + - "\u00A0\u0385\u0386\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u2015" + - "\u00B0\u00B1\u00B2\u00B3\u0384\u00B5\u00B6\u00B7\u0388\u0389\u038A\u00BB\u038C\u00BD\u038E\u038F" + - "\u0390\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039A\u039B\u039C\u039D\u039E\u039F" + - "\u03A0\u03A1\u001A\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03AA\u03AB\u03AC\u03AD\u03AE\u03AF" + - "\u03B0\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF" + - "\u03C0\u03C1\u03C2\u03C3\u03C4\u03C5\u03C6\u03C7\u03C8\u03C9\u03CA\u03CB\u03CC\u03CD\u03CE\u001A"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u1A81\u1A1A\u1A1A\u1A1A\u881A\u8A1A\u8C8D\u8E8F\u901A\u1A1A\u1A1A\u1A1A\u981A\u9A1A\u9C9D\u9E9F" + - "\uA01A\u1AA3\uA4A5\uA6A7\uA8A9\uAAAB\uACAD\uAE1A\uB0B1\uB2B3\u1AB5\uB6B7\u1A1A\u1ABB\u1ABD\uFFFF" + - "\u006A\u1A1A\u831A\uFFFF\u00F8\u1A1A\uB4A1\uA21A\uB8B9\uBA1A\uBC1A\uBEBF\uC0C1\uC2C3\uC4C5\uC6C7" + - "\uC8C9\uCACB\uCCCD\uCECF\uD0D1\u1AD3\uD4D5\uD6D7\uD8D9\uDADB\uDCDD\uDEDF\uE0E1\uE2E3\uE4E5\uE6E7" + - "\uE8E9\uEAEB\uECED\uEEEF\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\uFAFB\uFCFD\uFE1A\u1A1A\u1A1A\u1AF6\uFFFF" + - "\u0E1E\u1A1A\u1A96\u97AF\u1A1A\u9192\u821A\u9394\u841A\u8687\u951A\u1A1A\u851A\uFFFF\u0004\u1A1A" + - "\u891A\u1A1A\u1A1A\u1A1A\u1A8B\u9B1A\uFFFF\u0038\u1A1A\u801A\uFFFF\u003A\u1A1A\u991A\uFFFF\u6EEE" + - "\u1A1A\u1A21\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D" + - "\u3E3F\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D" + - "\u5E5F\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D" + - "\u7E1A\uFFFF\u0050\u1A1A"; - - - ConvTable1253() - { - super(1253, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1254.java b/cvsroot/src/com/ibm/as400/access/ConvTable1254.java deleted file mode 100644 index d041421e2..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1254.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1254.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1254 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u20AC\u0081\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\u0160\u2039\u0152\u008D\u008E\u008F" + - "\u0090\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\u0161\u203A\u0153\u009D\u009E\u0178" + - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + - "\u011E\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC\u0130\u015E\u00DF" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u011F\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u0131\u015F\u00FF"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u0000\u0003\u1A81\u1A1A\u1A1A\u1A8D\u8E8F\u901A\uFFFF\u0005\u1A1A\u1A9D\u9E1A\uA0A1\uA2A3\uA4A5" + - "\uA6A7\uA8A9\uAAAB\uACAD\uAEAF\uB0B1\uB2B3\uB4B5\uB6B7\uB8B9\uBABB\uBCBD\uBEBF\uC0C1\uC2C3\uC4C5" + - "\uC6C7\uC8C9\uCACB\uCCCD\uCECF\u1AD1\uD2D3\uD4D5\uD6D7\uD8D9\uDADB\uDC1A\u1ADF\uE0E1\uE2E3\uE4E5" + - "\uE6E7\uE8E9\uEAEB\uECED\uEEEF\u1AF1\uF2F3\uF4F5\uF6F7\uF8F9\uFAFB\uFC1A\u1AFF\uFFFF\u000F\u1A1A" + - "\uD0F0\uFFFF\b\u1A1A\uDDFD\uFFFF\u0010\u1A1A\u8C9C\uFFFF\u0005\u1A1A\uDEFE\u8A9A\uFFFF\u000B" + - "\u1A1A\u9F1A\uFFFF\f\u1A1A\u831A\uFFFF\u0099\u1A1A\u881A\uFFFF\n\u1A1A\u981A\uFFFF\u0E9A" + - "\u1A1A\u1A96\u971A\u1A1A\u9192\u821A\u9394\u841A\u8687\u951A\u1A1A\u851A\uFFFF\u0004\u1A1A\u891A" + - "\u1A1A\u1A1A\u1A1A\u1A8B\u9B1A\uFFFF\u0038\u1A1A\u801A\uFFFF\u003A\u1A1A\u991A\uFFFF\u6EEE\u1A1A" + - "\u1A21\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1A" + - "\uFFFF\u0050\u1A1A"; - - - ConvTable1254() - { - super(1254, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1255.java b/cvsroot/src/com/ibm/as400/access/ConvTable1255.java deleted file mode 100644 index 1095ff7b2..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1255.java +++ /dev/null @@ -1,66 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1255.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1255 extends ConvTableBidiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u20AC\u0081\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\u008A\u2039\u008C\u008D\u008E\u008F" + - "\u0090\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\u009A\u203A\u009C\u009D\u009E\u009F" + - "\u00A0\u001A\u00A2\u00A3\u20AA\u00A5\u00A6\u00A7\u00A8\u00A9\u001A\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u001A\u00B9\u001A\u00BB\u00BC\u00BD\u00BE\u001A" + - "\u05B0\u05B1\u05B2\u05B3\u05B4\u05B5\u05B6\u05B7\u05B8\u05B9\u001A\u05BB\u05BC\u05BD\u05BE\u05BF" + - "\u05C0\u05C1\u05C2\u05C3\u05F0\u05F1\u05F2\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF" + - "\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u05EA\u001A\u001A\u200E\u200F\u001A"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u1A81\uFFFF\u0004\u1A1A\u8A1A\u8C8D\u8E8F\u901A\uFFFF\u0004\u1A1A\u9A1A\u9C9D\u9E9F\uA01A\uA2A3" + - "\u1AA5\uA6A7\uA8A9\u1AAB\uACAD\uAEAF\uB0B1\uB2B3\uB4B5\uB6B7\u1AB9\u1ABB\uBCBD\uBE1A\uFFFF\u0069" + - "\u1A1A\u831A\uFFFF\u0099\u1A1A\u881A\uFFFF\n\u1A1A\u981A\uFFFF\u0169\u1A1A\uC0C1\uC2C3\uC4C5" + - "\uC6C7\uC8C9\u1ACB\uCCCD\uCECF\uD0D1\uD2D3\uFFFF\u0006\u1A1A\uE0E1\uE2E3\uE4E5\uE6E7\uE8E9\uEAEB" + - "\uECED\uEEEF\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\uFA1A\u1A1A\u1A1A\uD4D5\uD61A\uFFFF\u0D0D\u1A1A\uFDFE" + - "\u1A1A\u1A96\u971A\u1A1A\u9192\u821A\u9394\u841A\u8687\u951A\u1A1A\u851A\uFFFF\u0004\u1A1A\u891A" + - "\u1A1A\u1A1A\u1A1A\u1A8B\u9B1A\uFFFF\u0037\u1A1A\uA41A\u801A\uFFFF\u003A\u1A1A\u991A\uFFFF\u6EEE" + - "\u1A1A\u1A21\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D" + - "\u3E3F\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D" + - "\u5E5F\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D" + - "\u7E1A\uFFFF\u0050\u1A1A"; - - - ConvTable1255() - { - super(1255, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } - - ConvTable1255(int ccsid) - { - super(ccsid, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1256.java b/cvsroot/src/com/ibm/as400/access/ConvTable1256.java deleted file mode 100644 index 2368d3bbd..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1256.java +++ /dev/null @@ -1,70 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1256.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1256 extends ConvTableBidiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u20AC\u067E\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\u008A\u2039\u0152\u0686\u0698\u008F" + - "\u06AF\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u0098\u2122\u009A\u203A\u0153\u200C\u200D\u009F" + - "\u00A0\u060C\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u001A\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u061B\u00BB\u00BC\u00BD\u00BE\u061F" + - "\u001A\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F" + - "\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u00D7\u0637\u0638\u0639\u063A\u0640\u0641\u0642\u0643" + - "\u00E0\u0644\u00E2\u0645\u0646\u0647\u0648\u00E7\u00E8\u00E9\u00EA\u00EB\u0649\u064A\u00EE\u00EF" + - "\u064B\u064C\u064D\u064E\u00F4\u064F\u0650\u00F7\u0651\u00F9\u0652\u00FB\u00FC\u200E\u200F\u001A"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\uFFFF\u0005\u1A1A\u8A1A\u1A1A\u1A8F\uFFFF\u0004\u1A1A\u981A\u9A1A\u1A1A\u1A9F\uA01A\uA2A3\uA4A5" + - "\uA6A7\uA8A9\u1AAB\uACAD\uAEAF\uB0B1\uB2B3\uB4B5\uB6B7\uB8B9\u1ABB\uBCBD\uBE1A\uFFFF\u000B\u1A1A" + - "\u1AD7\uFFFF\u0004\u1A1A\uE01A\uE21A\u1A1A\u1AE7\uE8E9\uEAEB\u1A1A\uEEEF\u1A1A\u1A1A\uF41A\u1AF7" + - "\u1AF9\u1AFB\uFC1A\uFFFF\u002A\u1A1A\u8C9C\uFFFF\u001F\u1A1A\u831A\uFFFF\u0099\u1A1A\u881A\uFFFF" + - "\u01A2\u1A1A\uA11A\uFFFF\u0006\u1A1A\u1ABA\u1A1A\u1ABF\u1AC1\uC2C3\uC4C5\uC6C7\uC8C9\uCACB\uCCCD" + - "\uCECF\uD0D1\uD2D3\uD4D5\uD6D8\uD9DA\uDB1A\u1A1A\u1A1A\uDCDD\uDEDF\uE1E3\uE4E5\uE6EC\uEDF0\uF1F2" + - "\uF3F5\uF6F8\uFA1A\uFFFF\u0006\u1A1A\u3031\u3233\u3435\u3637\u3839\u1A2C\u2E1A\uFFFF\b\u1A1A" + - "\u811A\u1A1A\u1A1A\u1A1A\u8D1A\uFFFF\b\u1A1A\u8E1A\uFFFF\n\u1A1A\u1A90\uFFFF\u0020\u1A1A" + - "\u3031\u3233\u3435\u3637\u3839\uFFFF\u0C89\u1A1A\u9D9E\uFDFE\u1A1A\u1A96\u971A\u1A1A\u9192\u821A" + - "\u9394\u841A\u8687\u951A\u1A1A\u851A\uFFFF\u0004\u1A1A\u891A\u1A1A\u1A1A\u1A1A\u1A8B\u9B1A\uFFFF" + - "\u0038\u1A1A\u801A\uFFFF\u003A\u1A1A\u991A\uFFFF\u6D19\u1A1A\u811A\u811A\uFFFF\u0010\u1A1A\u8D1A" + - "\u8D1A\uFFFF\u0006\u1A1A\u8E1A\u1A1A\u1A1A\u1A1A\u901A\u901A\uFFFF\u016D\u1A1A\uF0F0\uF11A\uF21A" + - "\uF3F3\uF5F5\uF6F6\uF8F8\uFAFA\uC1C2\uC2C3\uC3C4\uC4C5\uC5C6\uC6C6\uC6C7\uC7C8\uC8C8\uC8C9\uC9CA" + - "\uCACA\uCACB\uCBCB\uCBCC\uCCCC\uCCCD\uCDCD\uCDCE\uCECE\uCECF\uCFD0\uD0D1\uD1D2\uD2D3\uD3D3\uD3D4" + - "\uD4D4\uD4D5\uD5D5\uD5D6\uD6D6\uD6D8\uD8D8\uD8D9\uD9D9\uD9DA\uDADA\uDADB\uDBDB\uDBDD\uDDDD\uDDDE" + - "\uDEDE\uDEDF\uDFDF\uDFE1\uE1E1\uE1E3\uE3E3\uE3E4\uE4E4\uE4E5\uE5E5\uE5E6\uE6EC\uECED\uEDED\uED1A" + - "\uFFFF\u0005\u1A1A\u1A21\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839" + - "\u3A3B\u3C3D\u3E3F\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859" + - "\u5A5B\u5C5D\u5E5F\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879" + - "\u7A7B\u7C7D\u7E1A\uFFFF\u0050\u1A1A"; - - - ConvTable1256() - { - super(1256, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1257.java b/cvsroot/src/com/ibm/as400/access/ConvTable1257.java deleted file mode 100644 index 933147c87..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1257.java +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1257.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1257 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u20AC\u0081\u201A\u0083\u201E\u2026\u2020\u2021\u0088\u2030\u008A\u2039\u008C\u008D\u008E\u008F" + - "\u0090\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u0098\u2122\u009A\u203A\u009C\u009D\u009E\u009F" + - "\u00A0\u001A\u00A2\u00A3\u00A4\u001A\u00A6\u00A7\u00D8\u00A9\u0156\u00AB\u00AC\u00AD\u00AE\u00C6" + - "\u00B0\u00B1\u00B2\u00B3\u001A\u00B5\u00B6\u00B7\u00F8\u00B9\u0157\u00BB\u00BC\u00BD\u00BE\u00E6" + - "\u0104\u012E\u0100\u0106\u00C4\u00C5\u0118\u0112\u010C\u00C9\u0179\u0116\u0122\u0136\u012A\u013B" + - "\u0160\u0143\u0145\u00D3\u014C\u00D5\u00D6\u00D7\u0172\u0141\u015A\u016A\u00DC\u017B\u017D\u00DF" + - "\u0105\u012F\u0101\u0107\u00E4\u00E5\u0119\u0113\u010D\u00E9\u017A\u0117\u0123\u0137\u012B\u013C" + - "\u0161\u0144\u0146\u00F3\u014D\u00F5\u00F6\u00F7\u0173\u0142\u015B\u016B\u00FC\u017C\u017E\u001A"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u1A81\u1A83\u1A1A\u1A1A\u881A\u8A1A\u8C8D\u8E8F\u901A\u1A1A\u1A1A\u1A1A\u981A\u9A1A\u9C9D\u9E9F" + - "\uA01A\uA2A3\uA41A\uA6A7\u1AA9\u1AAB\uACAD\uAE1A\uB0B1\uB2B3\u1AB5\uB6B7\u1AB9\u1ABB\uBCBD\uBE1A" + - "\u1A1A\u1A1A\uC4C5\uAF1A\u0000\u0003\u1AC9\u1A1A\u1A1A\uD3D5\uD6D7\uA81A\u1A1A\uDC1A\u1ADF\u1A1A" + - "\u1A1A\uE4E5\uBF1A\u0000\u0003\u1AE9\u1A1A\u1A1A\uF3F5\uF6F7\uB81A\u1A1A\uFC1A\u1A1A\uC2E2\u1A1A" + - "\uC0E0\uC3E3\u1A1A\u1A1A\uC8E8\u1A1A\u1A1A\uC7E7\u1A1A\uCBEB\uC6E6\uFFFF\u0004\u1A1A\uCCEC\u1A1A" + - "\u1A1A\u1A1A\uCEEE\u1A1A\uC1E1\u1A1A\u1A1A\u1A1A\uCDED\u1A1A\u1ACF\uEF1A\u1A1A\u1AD9\uF9D1\uF1D2" + - "\uF21A\u1A1A\u1A1A\uD4F4\uFFFF\u0004\u1A1A\uAABA\u1A1A\uDAFA\u1A1A\u1A1A\uD0F0\uFFFF\u0004\u1A1A" + - "\uDBFB\u1A1A\u1A1A\u1A1A\uD8F8\u1A1A\u1A1A\u1ACA\uEADD\uFDDE\uFE1A\uFFFF\u0F49\u1A1A\u1A96\u971A" + - "\u1A1A\u9192\u821A\u9394\u841A\u8687\u951A\u1A1A\u851A\uFFFF\u0004\u1A1A\u891A\u1A1A\u1A1A\u1A1A" + - "\u1A8B\u9B1A\uFFFF\u0038\u1A1A\u801A\uFFFF\u003A\u1A1A\u991A\uFFFF\u6EEE\u1A1A\u1A21\u2223\u2425" + - "\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F\u4041\u4243\u4445" + - "\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F\u6061\u6263\u6465" + - "\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1A\uFFFF\u0050\u1A1A"; - - - ConvTable1257() - { - super(1257, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1258.java b/cvsroot/src/com/ibm/as400/access/ConvTable1258.java deleted file mode 100644 index cbc8f7b51..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1258.java +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1258.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable1258 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u20AC\u0081\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\u008A\u2039\u0152\u008D\u008E\u008F" + - "\u0090\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\u009A\u203A\u0153\u009D\u009E\u0178" + - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u00C0\u00C1\u00C2\u0102\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u0300\u00CD\u00CE\u00CF" + - "\u0110\u00D1\u0309\u00D3\u00D4\u01A0\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC\u01AF\u0303\u00DF" + - "\u00E0\u00E1\u00E2\u0103\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u0301\u00ED\u00EE\u00EF" + - "\u0111\u00F1\u0323\u00F3\u00F4\u01A1\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u01B0\u20AB\u00FF"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u1A81\uFFFF\u0004\u1A1A\u8A1A\u1A8D\u8E8F\u901A\uFFFF\u0004\u1A1A\u9A1A\u1A9D\u9E1A\uA0A1\uA2A3" + - "\uA4A5\uA6A7\uA8A9\uAAAB\uACAD\uAEAF\uB0B1\uB2B3\uB4B5\uB6B7\uB8B9\uBABB\uBCBD\uBEBF\uC0C1\uC21A" + - "\uC4C5\uC6C7\uC8C9\uCACB\u1ACD\uCECF\u1AD1\u1AD3\uD41A\uD6D7\uD8D9\uDADB\uDC1A\u1ADF\uE0E1\uE21A" + - "\uE4E5\uE6E7\uE8E9\uEAEB\u1AED\uEEEF\u1AF1\u1AF3\uF41A\uF6F7\uF8F9\uFAFB\uFC1A\u1AFF\u1A1A\uC3E3" + - "\uFFFF\u0006\u1A1A\uD0F0\uFFFF\u0020\u1A1A\u8C9C\uFFFF\u0012\u1A1A\u9F1A\uFFFF\f\u1A1A\u831A" + - "\uFFFF\u0006\u1A1A\uD5F5\uFFFF\u0006\u1A1A\u1ADD\uFD1A\uFFFF\u008A\u1A1A\u881A\uFFFF\n\u1A1A" + - "\u981A\uFFFF\u0011\u1A1A\uCCEC\u1ADE\u1A1A\u1A1A\u1AD2\uFFFF\f\u1A1A\u1AF2\uFFFF\u0E77\u1A1A" + - "\u1A96\u971A\u1A1A\u9192\u821A\u9394\u841A\u8687\u951A\u1A1A\u851A\uFFFF\u0004\u1A1A\u891A\u1A1A" + - "\u1A1A\u1A1A\u1A8B\u9B1A\uFFFF\u0037\u1A1A\u1AFE\u801A\uFFFF\u003A\u1A1A\u991A\uFFFF\u6EEE\u1A1A" + - "\u1A21\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1A" + - "\uFFFF\u0050\u1A1A"; - - - ConvTable1258() - { - super(1258, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable12588.java b/cvsroot/src/com/ibm/as400/access/ConvTable12588.java deleted file mode 100644 index 2806501cd..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable12588.java +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable12588.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// This is a Japanese character set. -class ConvTable12588 extends ConvTable16684 -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable12588() - { - super(12588); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable12708.java b/cvsroot/src/com/ibm/as400/access/ConvTable12708.java deleted file mode 100644 index 756240614..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable12708.java +++ /dev/null @@ -1,64 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable12708.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable12708 extends ConvTableBidiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u0651\uFE7D\u0640\u200B\u0621\u0622\uFE82\u0623\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\uFE84\u0624\u001A\u001A\u0626\u0627\uFE8E\u0628\uFE91\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u0629\u062A\uFE97\u062B\uFE9B\u062C\uFE9F\u062D\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\uFEA3\u062E\uFEA7\u062F\u0630\u0631\u0632\u0633\uFEB3\u060C\u003A\u0023\u0040\'\u003D\"" + - "\u0634\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\uFEB7\u0635\uFEBB\u0636\uFEBF\u0637" + - "\u0638\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u0639\uFECA\uFECB\uFECC\u063A\uFECE" + - "\uFECF\u00F7\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\uFED0\u0641\uFED3\u0642\uFED7\u0643" + - "\uFEDB\u0644\uFEF5\uFEF6\uFEF7\uFEF8\u001A\u001A\uFEFB\uFEFC\uFEDF\u0645\uFEE3\u0646\uFEE7\u0647" + - "\u061B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\uFEEB\u001A\uFEEC\u001A\u0648" + - "\u061F\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u0649\uFEF0\u064A\uFEF2\uFEF3\u0660" + - "\u00D7\u2007\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u0661\u0662\u001A\u0663\u0664\u0665" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u20AC\u0666\u0667\u0668\u0669\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE93F\u3F3F\u3F6D" + - "\u3F81\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA93F\u4F3F\u3F07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\u4A3F\u3F3F\u6A3F\u3F3F\u3F3F\u5FCA\uFFFF\u0014\u3F3F\u3FE0\uFFFF\u000F\u3F3F\u3FA1\uFFFF" + - "\u028A\u3F3F\u793F\uFFFF\u0006\u3F3F\u3FC0\u3F3F\u3FD0\u3F46\u4749\u5256\u5556\u5862\u6365\u6769" + - "\u7173\u7475\u7677\u808B\u8D8F\u909A\u9E3F\u3F3F\u3F3F\u44AB\uADAF\uB1BB\uBDBF\uCFDA\uDC3F\u3F3F" + - "\u3F3F\u3F42\uFFFF\u0007\u3F3F\uDFEA\uEBED\uEEEF\uFBFC\uFDFE\u6C6B\u4B5C\uFFFF\u0CCC\u3F3F\u3FE1" + - "\u3F3F\u3F45\uFFFF\u0050\u3F3F\uFA3F\uFFFF\u6EE1\u3F3F\u4044\u4045\u403F\u4044\u4044\u4044\u4243" + - "\u4044\u4647\u4849\u5152\u5256\u5755\u5555\u5556\u5758\u5859\u5962\u6263\u6364\u6465\u6566\u6667" + - "\u6768\u6869\u6970\u7071\u7172\u7273\u7374\u7475\u7576\u7677\u7778\u7880\u808A\u8A8B\u8B8C\u8C8D" + - "\u8D8E\u8E8F\u8F8F\u8F90\u9090\u909A\u9B9C\u9D9E\u9FA0\uAAAB\uABAC\uACAD\uADAE\uAEAF\uAFB0\uB0B1" + - "\uB1BA\uBABB\uBBBC\uBCBD\uBDBE\uBEBF\uBFCB\uCDCF\uCFDA\uDBDC\uDDDE\uDEB2\uB3B4\uB5B8\uB9B8\uB93F" + - "\u3F3F\u3F5A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E" + - "\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE93F\u3F3F" + - "\u3F6D\u3F81\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA93F\u4F3F" + - "\uFFFF\u0051\u3F3F"; - - - ConvTable12708() - { - super(12708, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable13121.java b/cvsroot/src/com/ibm/as400/access/ConvTable13121.java deleted file mode 100644 index b0ab4d8a8..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable13121.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable13121.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable13121 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u001A\uFFA0\uFFA1\uFFA2\uFFA3\uFFA4\uFFA5\uFFA6\uFFA7\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u001A\uFFA8\uFFA9\uFFAA\uFFAB\uFFAC\uFFAD\uFFAE\uFFAF\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\uFFB0\uFFB1\uFFB2\uFFB3\uFFB4\uFFB5\uFFB6\uFFB7\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u005B\u001A\uFFB8\uFFB9\uFFBA\uFFBB\uFFBC\uFFBD\uFFBE\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u005D\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\uFFC2\uFFC3\uFFC4\uFFC5\uFFC6\uFFC7" + - "\u001A\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\uFFCA\uFFCB\uFFCC\uFFCD\uFFCE\uFFCF" + - "\u203E\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\uFFD2\uFFD3\uFFD4\uFFD5\uFFD6\uFFD7" + - "\u005E\u001A\\\u001A\u001A\u001A\u001A\u001A\u001A\u001A\uFFDA\uFFDB\uFFDC\u001A\u001A\u001A" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u20A9\u001A\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u001A\u001A\u001A\u001A\u001A\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE970\uB280\uB06D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u3F3F\u4A3F\u3F3F\u6A3F\u3F3F\u3F3F\u5F3F\uFFFF\u0FC8\u3F3F\uA03F\uFFFF\u0034\u3F3F\u3FE0\uFFFF" + - "\u6F7B\u3F3F\u4243\u4445\u4647\u4849\u5253\u5455\u5657\u5859\u6263\u6465\u6667\u6869\u7273\u7475" + - "\u7677\u783F\u3F3F\u8A8B\u8C8D\u8E8F\u3F3F\u9A9B\u9C9D\u9E9F\u3F3F\uAAAB\uACAD\uAEAF\u3F3F\uBABB" + - "\uBC3F\uFFFF\u0011\u3F3F"; - - - ConvTable13121() - { - super(13121, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable13122.java b/cvsroot/src/com/ibm/as400/access/ConvTable13122.java deleted file mode 100644 index 1baa789f1..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable13122.java +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable13122.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// This is a Korean character set. -class ConvTable13122 extends ConvTable4930 -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable13122() - { - super(13122); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable13124.java b/cvsroot/src/com/ibm/as400/access/ConvTable13124.java deleted file mode 100644 index 237e7f90b..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable13124.java +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable13124.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable13124 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u00A3\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u0021\u00A5\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u001A\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u001A\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u007E\u203E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u005E\u001A\\\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u005B\u005D\u001A\u001A\u001A\u001A" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u0024\u001A\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u001A\u001A\u001A\u001A\u001A\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\uE06C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9BA\uB2BB\uB06D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA007" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u3F3F\u3F4A\u3F5B\u6A3F\u3F3F\u3F3F\u5F3F\uFFFF\u0FC8\u3F3F\uA13F\uFFFF\u6FE0\u3F3F"; - - - ConvTable13124() - { - super(13124, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } - - ConvTable13124(int ccsid) - { - super(ccsid, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable13488.java b/cvsroot/src/com/ibm/as400/access/ConvTable13488.java deleted file mode 100644 index 3ce40db61..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable13488.java +++ /dev/null @@ -1,24 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable13488.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable13488 extends ConvTableUnicodeBigMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable13488() - { - super(13488); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1364.java b/cvsroot/src/com/ibm/as400/access/ConvTable1364.java deleted file mode 100644 index 24ba1b843..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1364.java +++ /dev/null @@ -1,32 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1364.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; - - -class ConvTable1364 extends ConvTableMixedMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable1364() throws UnsupportedEncodingException - { - this(1364); - } - - ConvTable1364(int ccsid) throws UnsupportedEncodingException - { - super(ccsid, 833, 834); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1388.java b/cvsroot/src/com/ibm/as400/access/ConvTable1388.java deleted file mode 100644 index fbe507337..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1388.java +++ /dev/null @@ -1,32 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1388.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; - - -class ConvTable1388 extends ConvTableMixedMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable1388() throws UnsupportedEncodingException - { - this(1388); - } - - ConvTable1388(int ccsid) throws UnsupportedEncodingException - { - super(ccsid, 836, 837); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable1399.java b/cvsroot/src/com/ibm/as400/access/ConvTable1399.java deleted file mode 100644 index 8b3617ffa..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable1399.java +++ /dev/null @@ -1,32 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable1399.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; - - -class ConvTable1399 extends ConvTableMixedMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable1399() throws UnsupportedEncodingException - { - this(1399); - } - - ConvTable1399(int ccsid) throws UnsupportedEncodingException - { - super(ccsid, 5123, 16684); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable16684.java b/cvsroot/src/com/ibm/as400/access/ConvTable16684.java deleted file mode 100644 index b37120f52..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable16684.java +++ /dev/null @@ -1,1892 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable16684.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable16684 extends ConvTableDoubleMap -{ - private static final String toUnicode_ = - "\uFFFF\u4040\uFFFD\u3000\uFFFF\u0100\uFFFD\uFFFE\u0011\u03B1\uFFFE\u0007\u03C3\uFFFF\b\uFFFD" + - "\uFFFE\u0011\u0391\uFFFE\u0007\u03A3\uFFFF\u0007\uFFFD\uFFFE\u0006\u0430\u0451\uFFFE\u001A\u0436" + - "\uFFFF\u0010\uFFFD\uFFFE\n\u2170\uFFFF\u0005\uFFFD\uFFFE\u0006\u0410\u0401\uFFFE\u001A\u0416" + - "\uFFFF\u0010\uFFFD\uFFFE\n\u2160\uFFFF\u004F\uFFFD\u0000\u0003\uFFE1\u0E1C\u080B\u5C06\uFFFF" + - "\t\uFFFD\u0000\u0003\uFF01\uE50A\u091B\uE20D\uFF0F\uFFFF\b\uFFFD\uFFE4\uFF0C\uFF05\uFF3F" + - "\uFF1E\uFF1F\uFFFF\t\uFFFD\u0000\u0003\uFF40\u1A03\u2007\u1D02\uFFFD\uFFFE\t\uFF41\uFFFF" + - "\u0007\uFFFD\uFFFE\t\uFF4A\uFFFF\u0007\uFFFD\uFFE3\uFFFE\b\uFF53\uFFFF\u0016\uFFFD\uFF5B" + - "\uFFFE\t\uFF21\uFFFF\u0006\uFFFD\uFF5D\uFFFE\t\uFF2A\uFFFF\u0006\uFFFD\uFF04\u20AC\uFFFE" + - "\b\uFF33\uFFFF\u0006\uFFFD\uFFFE\n\uFF10\uFFFF\u0047\uFFFD\u0000\u0004\u3002\u0C0D\u01FB" + - "\uF2A1\uA3A5\uFFE0\u2220\u22A5\u2312\u2202\u2207\uFFFD\u0000\u0004\u30A7\uA9E3\uE5E7\uC3EE\uFCF5" + - "\u30F6\u0000\t\u2261\u526A\u6B1A\u3D1D\u2B2C\u080B\u8687\u8283\u2A29\u2728\u21D2\u21D4\u2200" + - "\u2203\u212B\u2030\u266F\u266D\u266A\u2020\u2021\u00B6\u25EF\uFFFD\u2500\u2502\u250C\u2510\uFFFD" + - "\u0000\u0004\u30A2\uA4A6\uA8AA\uABAD\uAFB1\u30B3\uFFFD\u0000\u0007\u30B5\uB7B9\uBBBD\uBFC1\uC4C6" + - "\uC8CA\uCBCC\uCDCE\uFFFD\uFFFD\u30CF\u30D2\u30D5\uFFFD\uFF5E\u0000\u0004\u30D8\uDBDE\uDFE0\uE1E2" + - "\uE4E6\uFFFD\uFFFE\u0004\u30E8\u0000\u0004\u2518\u141C\u2C24\u343C\u0103\u250F\u0000\u0011\u30EC" + - "\uEDEF\uF39B\u9CAC\uAEB0\uB2B4\uB6B8\uBABC\uBEC0\uC2C5\uC7C9\uD0D3\uD6D9\uDCF4\uD1D4\uD7DA\uDDF0" + - "\uF1FD\u30FE\uFFFD\uFFFD\uFF3C\u0000\b\u2513\u1B17\u2333\u2B3B\u4B20\u2F28\u373F\u1D30\u2538" + - "\u2542\uFFFF\u004F\uFFFD\u300E\u300F\uFF3B\uFF3D\u3092\u3041\u3043\u3045\u2015\u00B1\u2260\u221E" + - "\u2103\uFFFD\u00B4\u0000\u0003\u3047\u4983\u8587\u638E\uFFFD\uFFFD\u2010\u3003\u4EDD\u3005\u3006" + - "\u3007\u00A8\u2018\u201C\u3014\u3008\u300A\u3010\u2266\u2234\u2642\u00A7\u203B\u3012\u3231\u2116" + - "\u2121\uFF3E\u2019\u201D\u3015\u3009\u300B\u3011\u2267\u2235\u2640\u00D7\u00F7\u2225\u3013\u2025" + - "\u2026\uFFFD\u0000\u0004\u3042\u4446\u484A\u4B4D\u4F51\u3053\uFFFD\u0000\u0007\u3055\u5759\u5B5D" + - "\u5F61\u6466\u686A\u6B6C\u6D6E\uFFFD\uFFFD\u306F\u3072\u3075\uFFFD\uFFFD\u0000\u0004\u3078\u7B7E" + - "\u7F80\u8182\u8486\uFFFD\uFFFE\u0004\u3088\uFFFF\n\uFFFD\u308C\u308D\u308F\u3093\uFFFD\uFFFD" + - "\u0000\t\u304C\u4E50\u5254\u5658\u5A5C\u5E60\u6265\u6769\u7073\u7679\u307C\uFFFD\u0000\u0004" + - "\u3071\u7477\u7A7D\u9091\u9D9E\uFFFD\uFFFD\u25CB\u25CF\u25B3\u25B2\u25CE\u2606\u2605\u25C7\u25C6" + - "\u25A1\u25A0\u25BD\u25BC\u00B0\u2032\u2033\u2192\u2190\u2191\u2193\uFFFF\u004D\uFFFD\u4E00\u4E8C" + - "\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D\u5341\u767E\u5343\u4E07\u5104\u90FD\u9053\u5E9C\u770C" + - "\u5E02\u533A\u753A\u6751\u6771\u897F\u5357\u5317\u5927\u4E2D\u5C0F\u4E0A\u4E0B\u5E74\u6708\u65E5" + - "\u7530\u5B50\u5C71\u672C\u5DDD\u85E4\u91CE\u5DE5\u696D\u6728\u4E95\u90CE\u5CF6\u96C4\u9AD8\u5CA1" + - "\u592B\u539F\u4EAC\u4F50\u6B63\u677E\u6A5F\u548C\u88FD\u7537\u7F8E\u5409\u5D0E\u77F3\u8C37\u96FB" + - "\u9577\u6CBB\u6CA2\u91D1\u65B0\u53E3\u6A4B\u4E45\u798F\u6240\u5E73\u5185\u56FD\u5316\u962A\u5BAE" + - "\u4EBA\u4F5C\u90E8\u6E05\u6B21\u7FA9\u751F\u4EE3\u51FA\u6C34\u68EE\u5149\u52A0\u5408\u795E\u6797" + - "\u91CD\u884C\u4FE1\u660E\u6D77\u5B89\u5E78\u4FDD\u592A\u5BCC\u6C5F\u9234\u524D\u77E5\u6B66\u4F0A" + - "\u662D\u5206\u52DD\u7528\u5E83\u9020\u6C17\u6210\u898B\u5229\u4F1A\u5B66\u5CA9\u7523\u9593\u5730" + - "\u81EA\u826F\u95A2\u611B\u653F\u5C3E\u8A08\u6587\u624B\u7236\u65B9\u4E8B\u6238\u54C1\u559C\u6E21" + - "\u5F18\u53E4\u8FBA\u5009\u9244\u4E4B\u5834\u6D0B\u57CE\u6D25\u7ACB\u5EA6\u5348\u4ECA\u5F66\u8A2D" + - "\u901A\u52D5\u5F8C\u5948\u5B9A\u6C60\u5C4B\u6D5C\u7406\u5742\u5B9F\u82F1\u7684\u53F8\u79C0\u6A2A" + - "\u540D\u5B5D\u7AF9\u535A\u529B\u5EAB\u8449\u6804\u6C38\u5668\u7389\u591A\uFFFF\u0042\uFFFD\u8CC0" + - "\u771F\u6075\u9759\u5186\u8302\u654F\u8C4A\u5175\u6CD5\u767A\u9752\u5897\u6599\u5FE0\u8CC7\u6642" + - "\u7269\u8ECA\u5FB3\u8981\u5BFE\u585A\u79CB\u767D\u6CB3\u702C\u6CB9\u9686\u8535\u5F53\u4FCA\u5FD7" + - "\u6625\u793E\u99AC\u5165\u5EFA\u6839\u6749\u9032\u8208\u6D66\u7CBE\u540C\u6027\u7C73\u8005\u52A9" + - "\u679D\u8FD1\u76F4\u76EE\u6765\u753B\u76F8\u9ED2\u4E38\u8239\u7531\u58EB\u7B2C\u718A\u7D19\u5065" + - "\u68B0\u82B3\u571F\u6709\u5BB6\u7DDA\u7D4C\u8ABF\u5929\u671F\u7F6E\u6D45\u6589\u5F0F\u5F62\u9762" + - "\u7A2E\u8F38\u5916\u5143\u4F53\u9E7F\u5FA1\u5973\u5EB7\u4E16\u52C7\u5800\u597D\u5150\u5BFA\u92FC" + - "\u7279\u57FC\u9054\u5411\u53D6\u7B49\u667A\u56DE\u9580\u904B\u5099\u601D\u963F\u4E0D\u9808\u5168" + - "\u5BFF\u5584\u677F\u98EF\u8C9E\u73FE\u98DF\u7D44\u985E\u516C\u6750\u9999\u5546\u7D50\u8868\u77E2" + - "\u6F5F\u79C1\u5236\u90A6\u6CBC\u7CF8\u5B8F\u7B56\u6CE2\u54E1\u6570\u958B\u6E96\u6A39\u8CBB\u660C" + - "\u5F37\u7814\u53CB\u5B87\u82E5\u83CA\u6301\u82B1\u5F15\u7D00\u8352\u5225\u4FEE\u8D8A\u4F4F\u85AC" + - "\u6BDB\u9060\u554F\u5965\u578B\u5FC3\u767B\u65E9\u67F3\u6D69\u8CEA\u52D9\u6CC9\u5E38\u5B88\u57FA" + - "\u7BA1\u6CF0\u4F38\u6700\u4EE5\u6B4C\u88D5\u8D64\u8DB3\u898F\u6D41\u8AA0\u6607\uFFFF\u0042\uFFFD" + - "\u5DDE\u7167\u5869\u9001\u96C5\u672B\u54F2\u5CB8\u4E5F\u5C90\u521D\u8328\u5247\u6BD4\u80FD\u8A71" + - "\u6295\u8EE2\u83C5\u9023\u4ED6\u6C11\u7D66\u9152\u7E41\u4FA1\u6E80\u671D\u4ED8\u6761\u7121\u8003" + - "\u697D\u4E3B\u610F\u6226\u5207\u5264\u7247\u7D30\u6E08\u7A32\u5E03\u91CC\u5C5E\u7AE0\u5909\u4F55" + - "\u685C\u5F7C\u67FB\u76CA\u58F2\u4EC1\u6DF1\u53F0\u9CE5\u9DB4\u652F\u6574\u89D2\u5609\u5473\u885B" + - "\u8B70\u5727\u7387\u8DEF\u706B\u961C\u8F1D\u70B9\u4E0E\u6E1B\u7551\u9280\u7A7A\u4EA4\u7FBD\u534A" + - "\u53CE\u592E\u7DCF\u8A18\u6674\u69CB\u969B\u6885\u5370\u8A00\u6817\u8EAB\u66F8\u514B\u7D20\u96C6" + - "\u7BC0\u5148\u6EDD\u6C7A\u6559\u7D14\u67F4\u63A5\u661F\u7740\u7559\u6620\u5DF1\u754C\u5177\u656C" + - "\u7FA4\u9806\u5171\u6D3B\u91CF\u6307\u89E3\u5BA4\u679C\u5404\u671B\u9632\u7D04\u61B2\u967D\u4E80" + - "\u56F3\u4E88\u8272\u7A0E\u690D\u53EF\u6052\u4F4D\u5178\u5FC5\u7D9A\u6025\u5728\u57A3\u541B\u5EF6" + - "\u5D8B\u4F01\u6803\u670D\u71B1\u5272\u5354\u6B69\u53F2\u512A\u658E\u623F\u5B97\u683C\u8FB0\u7B20" + - "\u5712\u8AF8\u8107\u5553\u8CE2\u5F25\u98A8\u5F97\u6613\u6253\u982D\u65ED\u6BB5\u52E2\u7136\u56E3" + - "\u984D\u843D\u914D\u7A0B\u8FBB\u543E\u611F\u5BDB\u53CD\u7A14\u9700\u6E90\u6C96\u984C\uFFFF\u0042" + - "\uFFFD\u8FBC\u8349\u7B97\u76DB\u8FB2\u90A3\u7701\u69D8\u6BBF\u5C11\u4ECB\u53D7\u97F3\u7DE8\u59D4" + - "\u5E84\u4FC2\u72B6\u793A\u5E97\u5A9B\u682A\u6ECB\u68A8\u7E04\u53F3\u5DE6\u53CA\u9078\u5C45\u60C5" + - "\u7DF4\u70AD\u9928\u9271\u6A21\u6B8A\u7E3E\u4E9C\u7E4A\u4EF2\u5857\u6D88\u8853\u691C\u6717\u5B85" + - "\u529F\u5C1A\u8CBF\u60A6\u8102\u7BE0\u4F73\u7D21\u51A8\u6851\u78BA\u7267\u4E26\u5024\u89B3\u8CB4" + - "\u7DAD\u7D71\u5BBF\u4E21\u7CD6\u89AA\u9332\u6F84\u65BD\u5BB9\u98DB\u5C40\u7950\u904E\u6C0F\u6539" + - "\u76E4\u7A4D\u6E0B\u5DFB\u6DF3\u5FDC\u4E89\u8ECD\u88C5\u9178\u7E54\u67D3\u5E1D\u7DBF\u7C89\u822A" + - "\u7532\u5468\u4ED9\u5F85\u4F4E\u7DD1\u8EFD\u9EBB\u6176\u52B4\u78EF\u4E39\u80B2\u9650\u5C0E\u653E" + - "\u6643\u5EA7\u4EF6\u60F3\u9A13\u4ED5\u4F7F\u8F2A\u9854\u756A\u5F35\u805E\u4F9B\u6E6F\u6EB6\u6821" + - "\u9285\u92F3\u878D\u9756\u5199\u5B8C\u6E2F\u935B\u591C\u5145\u9F8D\u7DB1\u83F1\u901F\u52C9\u5237" + - "\u8D77\u6469\u53C2\u55B6\u7A42\u63A8\u8FD4\u8077\u6B62\u4F1D\u5E79\u7403\u6A29\u5C55\u5E61\u845B" + - "\u5EAD\u975E\u53F7\u5358\u6B73\u62E1\u51E6\u8A9E\u6628\u57DF\u6DF5\u518D\u50CD\u79D1\u9B5A\u7AEF" + - "\u9014\u6848\u5B57\u8AD6\u517C\u53C8\u632F\u6280\u5FB9\u672D\u7CFB\u5F93\u51B7\u614B\u5CF0\uFFFF" + - "\u0042\uFFFD\u5931\u539A\u5074\u6CE8\u6E2C\u9803\u4E57\u8A66\u576A\u8429\u515A\u6C7D\u5B9D\u606D" + - "\u6A0B\u6E29\u6577\u8AAC\u82B8\u544A\u6B74\u822C\u98FE\u793C\u5C06\u96E3\u7802\u5224\u5F79\u5F71" + - "\u66FD\u5E2F\u9678\u938C\u8AC7\u5F70\u60AA\u6A19\u7533\u5BB3\u6BCD\u88DC\u5E4C\u58F0\u9664\u7B39" + - "\u5A66\u4E7E\u7AF6\u829D\u725B\u8CB7\u79FB\u785D\u8336\u52B9\u990A\u52F2\u80A5\u8B19\u7089\u590F" + - "\u5802\u67CF\u6255\u5E30\u713C\u786B\u8001\u7A76\u5BE9\u91DD\u65AD\u5C04\u5DEE\u5D50\u6298\u8010" + - "\u5BA3\u59CB\u5F8B\u6B8B\u666F\u8C61\u90F7\u5353\u96E2\u85AB\u6B7B\u8015\u64CD\u4EAE\u4E91\u90E1" + - "\u52E4\u6C42\u8CAB\u5B98\u59BB\u88CF\u773C\u4F2F\u7AAF\u7BC9\u968E\u63DB\u6842\u99C5\u68B6\u5747" + - "\u8CA1\u547D\u738B\u84B2\u90C1\u78E8\u7B11\u66F2\u6975\u5831\u63D0\u8A3C\u96EA\u9055\u88C1\u9996" + - "\u75C5\u6850\u4F59\u74E6\u4EE4\u5439\u732A\u672A\u525B\u8CA0\u4F34\u5100\u542B\u9069\u8FC4\u5C3B" + - "\u5DCC\u7B54\u8FFD\u8A0E\u4E08\u925B\u71C3\u8AB2\u70BA\u9662\u679A\u76AE\u8B77\u7DBE\u96E8\u6211" + - "\u5BC4\u837B\u62BC\u7D0D\u76E3\u7E2B\u964D\u572D\u7ADC\u7BC4\u6BBA\u8C9D\u698E\u9047\u6F14\u5360" + - "\u8FEB\u5287\u624D\u6566\u7D1A\u7D42\u6BCE\u7D79\u7E2E\u666E\u7965\u500B\u5C02\u99D2\u8A55\u7560" + - "\uFFFF\u0042\uFFFD\u5B58\u8089\u50BE\u5E2B\u6DB2\u4F8B\u81E3\u81F3\u56E0\u7D99\u5DF2\u899A\u6E9D" + - "\u6D17\u8AAD\u8996\u731B\u5DE8\u7DB2\u888B\u4EFB\u5BC6\u8896\u6CC1\u8457\u8F03\u6BC5\u97FF\u8CA9" + - "\u5E45\u82E6\u63AA\u5F81\u78C1\u821E\u52AA\u7AAA\u5999\u6297\u8F14\u7FD2\u4FC3\u54C9\u967A\u66F4" + - "\u8B1B\u5E72\u5FA9\u8A2A\u6D3E\u7763\u6483\u8B58\u614E\u5A5A\u8D85\u71D0\u983C\u72E9\u583A\u5DFE" + - "\u8A8D\u67C4\u7DE0\u4F11\u77ED\u4F0F\u5BC5\u629C\u5C3C\u533B\u6DC0\u81FC\u96D1\u904A\u6D6E\u93E1" + - "\u5C64\u98FC\u524A\u6DFB\u8584\u968A\u56FA\u5883\u7766\u9805\u4E73\u8C46\u8A31\u7DD2\u8FF0\u6D6A" + - "\u4F9D\u6B6F\u6B27\u62C5\u511F\u9769\u5374\u9AA8\u6775\u887F\u5305\u7570\u8D70\u864E\u5CEF\u8CDE" + - "\u5FF5\u725F\u7686\u609F\u80CC\u59EB\u8131\u5E0C\u8A17\u9676\u82D7\u74B0\u84B8\u50D5\u96F2\u7248" + - "\u7834\u6DD1\u6E09\u67FF\u6F54\u5915\u500D\u72AC\u9EC4\u7B46\u9B3C\u6563\u53BB\u8A98\u91DC\u9818" + - "\u6FC3\u65C5\u501F\u7F8A\u6F64\u9031\u5F3E\u63F4\u9038\u8B66\u7BE4\u7206\u6843\u72EC\u65CF\u82A6" + - "\u5BA2\u6960\u9EA6\u52DF\u6790\u639B\u7D75\u9855\u5DF3\u5805\u8ACB\u95A3\u8863\u8CA8\u5B63\u5E8A" + - "\u5449\u786C\u7D2B\u8CA2\u5352\u7D76\u8CB8\u7070\u547C\u6545\u6676\u73B2\u56F2\u7BB1\u58A8\u7A81" + - "\u66AE\uFFFF\u0042\uFFFD\u8087\u59FF\u8840\u56F0\u7B51\u6DF7\u5F01\u934B\u9000\u4FE3\u675F\u4FBF" + - "\u8CC3\u526F\u63A1\u5442\u8907\u698A\u5E2D\u5A18\u7518\u514D\u5E7E\u50B5\u5BDD\u68D2\u745E\u69FB" + - "\u5FAE\u55E3\u8A70\u5BF8\u5824\u8358\u5F13\u5E95\u706F\u751A\u7D05\u60E3\u7E70\u5012\u5238\u83EF" + - "\u5373\u5F31\u6A2B\u9CF4\u53CC\u6D32\u4EAB\u4E92\u842C\u8A8C\u65E2\u6F01\u80A9\u9DF9\u8B72\u7B52" + - "\u9589\u6D74\u63A2\u6590\u5BD2\u6319\u8AB0\u76DF\u99A8\u7A74\u8236\u8846\u8061\u6557\u5922\u9644" + - "\u88AB\u9326\u7B4B\u62B5\u5371\u5E81\u5BDF\u4F75\u58C1\u7058\u7DCA\u5438\u73E0\u52D8\u5208\u78D0" + - "\u6B23\u6838\u4E43\u690E\u8377\u6ED1\u98F2\u8170\u8857\u8EF8\u798E\u83DC\u8FCE\u7E01\u5510\u4EA8" + - "\u8A33\u9162\u5EFB\u606F\u4E86\u664B\u6368\u5217\u8056\u51FD\u7642\u821F\u9685\u50CF\u662F\u4F3C" + - "\u4E59\u6A3D\u4E71\u523A\u8ACF\u6A58\u66FF\u670B\u653B\u9732\u5EC3\u8A13\u5782\u604B\u866B\u95D8" + - "\u60A9\u4E01\u63CF\u6FC0\u659C\u8CAC\u8305\u7CA7\u6050\u96F7\u5FCD\u640D\u5B54\u900F\u62D3\u59B9" + - "\u7159\u51AC\u79F0\u552F\u5275\u6697\u80F8\u4E98\u4ECF\u51CD\u9D5C\u5144\u7A93\u67F1\u5841\u7C21" + - "\u8861\u5C31\u68DA\u91E7\u9DF2\u63EE\u6575\u84EE\u523B\u6B32\u7C98\u5982\u969C\u8987\u7C9F\u9006" + - "\u62DB\u66DC\uFFFF\u0042\uFFFD\u6355\u6982\u50AC\u623B\u5FD8\u63DA\u75DB\u627F\u616E\u8266\u7C95" + - "\u716E\u96C7\u7F6A\u5426\u5200\u83D3\u5211\u594F\u9D28\u574A\u66C7\u9858\u820E\u6614\u733F\u50B7" + - "\u6551\u5EB8\u5B6B\u55AC\u5FEB\u6388\u8CAF\u676F\u5951\u5A01\u71E5\u5DE3\u8C6A\u6271\u81F4\u5C3A" + - "\u5F92\u9045\u7384\u7149\u79D8\u796D\u9003\u83CC\u5FB4\u5B8D\u6279\u64AE\u7D18\u723E\u5BEE\u65E7" + - "\u8D08\u9E78\u52E7\u5D07\u9F62\u6069\u536F\u6681\u9663\u5E3D\u62B1\u722A\u6E4A\u93AE\u79E6\u53E5" + - "\u809D\u88FE\u53B3\u6C88\u6E7F\u5141\u9091\u6F6E\u84C4\u85EA\u8129\u6BD2\u663C\u7F72\u73C2\u5F1F" + - "\u790E\u60B2\u72ED\u58EE\u8179\u8E8D\u5C65\u5DE7\u6C37\u6DE1\u862D\u72AF\u8E0A\u7C92\u8218\u8033" + - "\u63A7\u9291\u5019\u8155\u8A69\u8EDF\u66B4\u8133\u7591\u6B20\u6669\u90F5\u4E32\u73EA\u693F\u7687" + - "\u707D\u7D3A\u6148\u8607\u99FF\u59C9\u7832\u7815\u907F\u80A1\u5C3F\u66A2\u9418\u6D44\u5E55\u5854" + - "\u7B95\u8DE1\u4EA1\u8C5A\u81E8\u89E6\u9670\u5263\u74F6\u9A5A\u6012\u520A\u7434\u9801\u907A\u5504" + - "\u7956\u5230\u54B2\u8A34\u96A3\u4FF3\u9283\u91E3\u7D39\u9688\u4F51\u7D61\u5DBA\u9BAE\u5F80\u795D" + - "\u8597\u8DA3\u7C60\u5C0A\u7565\u85A9\u63D6\u9E97\u7D22\u5375\u9AEA\u9042\u6B3D\u7D0B\u6392\u80AA" + - "\u7DE9\u9F3B\u99C6\uFFFF\u0042\uFFFD\u6D78\u6731\u5531\u6398\u7825\u5CB3\u5DE1\u92AD\u98FD\u9810" + - "\u6CE3\u6B64\u5321\u6B53\u5E8F\u7AE5\u502B\u6E56\u62BD\u8276\u6A9C\u4E18\u57F7\u752B\u7C97\u82EB" + - "\u9802\u811A\u73CD\u8F9B\u5C0B\u63E1\u7372\u8150\u80E1\u5B99\u76D7\u6291\u65EC\u8A3A\u5947\u65E8" + - "\u6E7E\u6696\u55AB\u8F09\u92ED\u9396\u4EEE\u755C\u6F38\u8F9E\u7981\u5C01\u62E0\u9BE8\u91C8\u6276" + - "\u65CB\u8E0F\u8B21\u699B\u6216\u5A92\u90B8\u50DA\u79DF\u6C41\u5270\u9175\u8B39\u685D\u5875\u819C" + - "\u5B9C\u8A89\u8A72\u9D8F\u6377\u5974\u8AA4\u52B1\u6962\u5C48\u9CE9\u673A\u75B2\u6D1E\u4F0D\u7E6D" + - "\u7B48\u7FCC\u65E6\u59A5\u79E9\u6212\u6EDE\u770B\u8CA7\u65BC\u885D\u6ADB\u5C4A\u8074\u9084\u8ECC" + - "\u65D7\u57F9\u708E\u6F06\u5E7C\u77AC\u4FF5\u5949\u81ED\u9B45\u7FFC\u8178\u69FD\u6CCA\u69C7\u79D2" + - "\u8B1D\u9ED9\u81D3\u7A3C\u7968\u6F5C\u63B2\u8DDD\u6383\u6E9C\u5E33\u61F8\u76BF\u642C\u7DB4\u6247" + - "\u6458\u6816\u5F69\u9022\u7A1A\u82B9\u70C8\u9A12\u6163\u6FEF\u53EB\u9D3B\u62FE\u60A0\u9591\u6D99" + - "\u6162\u9298\u635C\u9707\u8972\u683D\u51E1\u9B54\u608C\u5B22\u99C4\u7126\u8A73\u971C\u7396\u67D4" + - "\u60A3\u4E11\u4EF0\u8CDB\u8CB0\u7912\u9774\u8986\u5146\u57DC\u99D0\u80C3\u8338\u78A7\u86CD\u7F85" + - "\u5049\u8247\u690B\u7C4D\uFFFF\u0042\uFFFD\u53EA\u5F26\u6E25\u6881\u9375\u5DFD\u5347\u9727\u643A" + - "\u75C7\u6FA4\u73A9\u77E9\u9451\u8B5C\u808C\u674E\u4EAD\u582F\u7573\u8ED2\u6CE5\u9320\u8FF7\u7D33" + - "\u72C2\u8217\u7422\u82C5\u9A30\u773A\u5F84\u9673\u64AD\u920D\u74DC\u60C7\u86ED\u4FFA\u52A3\u6A3A" + - "\u7720\u5320\u61B6\u5674\u8776\u6CBF\u505C\u602A\u8466\u6B96\u6DBC\u97D3\u968F\u6876\u60D1\u5378" + - "\u64A4\u51A0\u9154\u5DF4\u629E\u5E63\u929A\u7693\u6C5A\u6597\u50E7\u7C82\u5F6B\u6CE1\u5F6C\u5AC1" + - "\u6F2C\u852D\u6442\u5750\u58C7\u8CFC\u8A5E\u7A7F\u689D\u7E26\u7A40\u7344\u8AEB\u4FD7\u7A63\u8036" + - "\u7DEF\u80C6\u8AED\u731F\u8FEA\u4F0E\u758B\u518A\u6734\u5FD9\u61C7\u65AF\u9CF3\u5ECA\u9262\u68DF" + - "\u6CB8\u80F4\u57CB\u6C99\u96A0\u5B64\u58F1\u68C4\u5410\u982C\u8A87\u4E5E\u6167\u9BAB\u90AA\u55B0" + - "\u82BD\u596A\u66F3\u8299\u5893\u719F\u6284\u67D1\u9063\u5ACC\u6C57\u7CE7\u5851\u64B2\u58CA\u830E" + - "\u5968\u5302\u5A46\u8702\u6065\u72D9\u89A7\u6689\u66F9\u5D6F\u5BB0\u96BC\u636E\u60DC\u7948\u51DD" + - "\u8606\u5EC9\u7554\u596E\u6B04\u4F43\u7B94\u67DA\u62DD\u628A\u971E\u62ED\u6EC5\u508D\u67B6\u80E4" + - "\u9EBF\u5EB5\u638C\u85CD\u9867\u52C5\u6016\u68CB\u61D0\u5751\u8F29\u5FAA\u81A8\u7D62\u71C8\u54C0" + - "\u69CC\u6B3E\u65AC\u63C3\u4F46\uFFFF\u0042\uFFFD\u7B1B\u6B86\u88F8\u5203\u732E\u6687\u7D17\u57F4" + - "\u570F\u618E\u970A\u7C3F\u8B00\u7881\u8CE0\u548B\u7B87\u745B\u7C11\u8870\u5398\u5448\u6CF3\u6F22" + - "\u53F6\u88B4\u5301\u7A6B\u8695\u586B\u5D29\u88C2\u62D2\u4E1E\u5036\u96C0\u7363\u8A3B\u5176\u7199" + - "\u7FE0\u8888\u7E1E\u4E4F\u84CB\u6F2B\u5859\u936C\u53E9\u865A\u9149\u86EF\u5E06\u5507\u902E\u6795" + - "\u846C\u5BA5\u82A5\u8431\u6D8C\u63FA\u4EA5\u51C6\u6328\u7F70\u5B5F\u5DBD\u99C8\u53EC\u7985\u8A54" + - "\u7962\u88DF\u5B09\u4FB5\u4F91\u9B8E\u5192\u96F0\u6DAF\u622F\u8490\u8CDC\u5075\u5CE0\u4E14\u4F83" + - "\u7C54\u84D1\u77B3\u8AEE\u5CE8\u62F6\u663B\u8A93\u8526\u8A95\u65FA\u6714\u53D4\u62AB\u8CE6\u88F3" + - "\u5BE7\u868A\u668E\u582A\u6170\u696F\u9F13\u7A92\u7893\u6A7F\u9017\u9266\u7D10\u7BC7\u6EF4\u821C" + - "\u5C3D\u62CD\u85C1\u6F02\u6E67\u6691\u85A6\u637A\u821B\u4F8D\u5091\u8A02\u62EC\u9BC9\u7A3D\u7C9B" + - "\u50C5\u9019\u708A\u7C8B\u64EC\u665F\u6562\u732B\u5339\u67A0\u55A7\u6D2A\u7A3F\u64E6\u79A7\u67D8" + - "\u7B26\u96BB\u6311\u72A0\u5C6F\u7026\u97EE\u60DF\u8AFE\u8B04\u8494\u9BD6\u82AF\u932C\u6606\u9640" + - "\u5BC2\u86C7\u7949\u8017\u6919\u7092\u963B\u7C7E\u59D3\u5B5C\u7D1B\u91D8\u6A80\u85E9\u6905\u6C93" + - "\u502D\u4EA6\u7FC1\u61A4\u8CCA\u9665\uFFFF\u0042\uFFFD\u93D1\u53F1\u598A\u8EAC\u62D8\u6867\u71D5" + - "\u7B67\u504F\u67D0\u82D1\u978D\u748B\u80BA\u7336\u514E\u8105\u90CA\u584A\u67FE\u6FF1\u5FFD\u76C6" + - "\u9A0E\u507D\u9694\u5EF7\u7BB8\u904D\u6C4E\u85FB\u819D\u67AF\u564C\u5606\u8C8C\u56DA\u73ED\u8CC4" + - "\u8FC5\u96F6\u6C50\u8944\u8F3F\u7D5E\u60E8\u72FC\u7D9C\u8463\u5CFB\u5446\u5D16\u6CA1\u81B3\u58FA" + - "\u5BB4\u8108\u541F\u8CBC\u6182\u78A9\u6FE1\u91A4\u76F2\u6020\u76FE\u84C9\u7F36\u4EC7\u755D\u7A17" + - "\u84EC\u75F4\u4F3A\u676D\u7460\u62F3\u6F20\u79E4\u87F9\u6094\u6234\u66AB\u820C\u8499\u723A\u5FCC" + - "\u6109\u70CF\u7261\u7A50\u5098\u9AED\u5D69\u601C\u6667\u99B4\u5E7B\u643E\u5830\u53C9\u7A9F\u990C" + - "\u9B42\u8F5F\u7AAE\u5B9B\u68A2\u6249\u7984\u9DFA\u5451\u932F\u8AC4\u5F90\u8DF3\u5A2F\u80DE\u6D29" + - "\u7A4F\u84BC\u9D2B\u9010\u6D38\u916A\u6FC1\u9905\u6BBB\u5EB6\u91B8\u5076\u6F0F\u4E19\u540F\u9675" + - "\u6C72\u51B4\u5631\u9F20\u66A6\u5F0A\u75AB\u51F8\u674F\u8DF5\u6C70\u8A6B\u757F\u5CAC\u6841\u8CD3" + - "\u9BDB\u8475\u6893\u840C\u72DB\u7577\u8568\u783A\u847A\u5F10\u831C\u6813\u6E1A\u9DAF\u51F9\u7980" + - "\u4E99\u5EE3\u908A\u80AF\u59A8\u77DB\u8D74\u8A1F\u673D\u533F\u8A0A\u5618\u6756\u53D9\u4F10\u7409" + - "\u5A41\u4FF8\u79B0\u9838\u8E2A\u9D60\u8F44\uFFFF\u0042\uFFFD\u65A5\u75BE\u906D\u867B\u60BC\u51B6" + - "\u5937\u7D2F\u916C\u69AE\u7CE0\u792A\u5D14\u64C1\u58EC\u589C\u8D66\u66D9\u61F2\u912D\u6E58\u9435" + - "\u965B\u7272\u5F6A\u5E9A\u8F1B\u5B95\u5C39\u9013\u834F\u7CCE\u620A\u90ED\u691B\u6E15\u65DB\u66FE" + - "\u4E9F\u55AA\u7A83\u83E9\u8B83\u846D\u83F0\u7F50\u918D\u9190\u758E\u95A5\u81E7\u75E2\u61A9\u8A50" + - "\u95B2\u53A8\u59F6\u9813\u7891\u7C17\u6B3A\u57E0\u620E\u83D6\u8AD2\u75D4\u927E\u59DC\u5289\u9087" + - "\u6FFE\u7473\u5C09\u9D6C\u84FC\u7CDF\u7BAD\u8A6E\u594E\u56A2\u819A\u7947\u6636\u53E1\u7887\u58CC" + - "\u9397\u6E13\u5256\u828B\u9E9F\u9583\u658C\u9E93\u7345\u6E26\u9D07\u5983\u7DAC\u96C1\u61BE\u6762" + - "\u9ECE\u90A8\u9187\u9F0E\u7C38\u51F1\u8599\u524C\u540E\u7901\u655E\u6668\u5CE1\u7566\u76C8\u8679" + - "\u531D\u5506\u7926\u8912\u77EF\u7CC0\u570B\u515C\u7E8A\u535C\u8A60\u65A7\u8766\u5766\u6AE8\u87FB" + - "\u5E16\u7AEA\u8D73\u771E\u737A\u66E0\u9410\u816B\u7B08\u91FC\u5737\u6FE4\u856A\u7E55\u9957\u87BA" + - "\u694A\u818F\u5EFF\u891C\u72D0\u9846\u9EDB\u8D99\u5DD6\u62B9\u64AB\u4F76\u613F\u68AF\u5F14\u800C" + - "\u92F8\u7BC1\u52FE\u664F\u9177\u51F6\u97A0\u839E\u647A\u9C3A\u67F5\u7C4F\u685F\u9B6F\u9F4B\u7FFB" + - "\u9348\u4FF6\u9E92\u9197\u96DB\u5BE6\u6CCC\u7CFE\uFFFF\u0042\uFFFD\u9453\u6822\u66B9\u5BD4\u98F4" + - "\u8AE6\u8154\u7827\u74BD\u6ED3\u9288\u5A20\u5B8B\u86F8\u760D\u865C\u6641\u91C9\u5589\u7A4E\u59E5" + - "\u6042\u932B\u5B5A\u849C\u5C91\u96CD\u62D9\u675C\u6787\u5E7D\u8650\u9EB9\u5CB1\u80CE\u7A00\u8ABC" + - "\u5700\u8096\u7D72\u9211\u8098\u907C\u7761\u8737\u9075\u817A\u7C3E\u6EA2\u965E\u7E90\u72D7\u58FD" + - "\u60B3\u9786\u7E88\u587E\u6E20\u84DC\u6961\u77AD\u5197\u652A\u6777\u5DCD\u6101\u932E\u5954\u6367" + - "\u798D\u7AFF\u80D6\u58B3\u6168\u6AC3\u7483\u9B92\u660A\u642D\u5118\u6763\u809B\u9C10\u4FC9\u6953" + - "\u7A1C\u52FF\u6055\u768E\u817F\u5642\u5F6D\u7194\u70BB\u7436\u8000\u874B\u55DA\u7435\u7690\u96EB" + - "\u66DD\u751C\u633D\u6EC9\u7C64\u7CA5\u6D35\u935C\u7027\u5E25\u701D\u54BD\u611A\u6973\u6C6A\u559A" + - "\u6D19\u96CC\u5BE1\u59FB\u697C\u914C\u7709\u8500\u7A46\u7872\u92E4\u8CED\u7CFA\u9D1B\u814E\u9AC4" + - "\u68A0\u6DCB\u5918\u83B1\u5629\u9B41\u6897\u70B3\u9771\u9419\u67A2\u6802\u7895\u68A7\u50D6\u80B1" + - "\u5EF8\u82D4\u797A\u67CA\u7E4D\u69CD\u51C4\u723D\u6829\u99B3\u5F3C\u8F61\u682B\u6155\u6591\u8FB1" + - "\u7E1B\u9798\u9952\u8877\u5B2C\u6631\u4FA0\u6939\u6AFB\u5BB5\u7AC8\u5026\u5944\u9059\u7B25\u7B4F" + - "\u8E74\u8543\u5858\u8B0E\u5039\u8654\u97F6\u7569\u72F8\uFFFF\u0042\uFFFD\u4EF7\u9D89\u5016\u51CC" + - "\u62CC\u91C6\u8755\u649A\u88F4\u91E6\u6854\u695A\u6C40\u7B6C\u6741\u77D7\u8823\u5384\u8EAF\u7280" + - "\u8C6B\u788D\u7165\u8207\u68B1\u8D04\u9077\u701E\u8FE6\u810A\u81BF\u89DC\u68B3\u6ADF\u92EA\u95C7" + - "\u7957\u7A20\u53A9\u8E5F\u786F\u79B9\u5F27\u5ED6\u6853\u93AC\u919C\u691A\u5806\u64B0\u7E4B\u7D8F" + - "\u68F2\u6EA5\u82DB\u9192\u5243\u8EB0\u9081\u721B\u7DCB\u7656\u59AC\u6FE0\u8B28\u80A2\u5544\u6070" + - "\u5F4A\u68C8\u633A\u9438\u9B4F\u81E5\u6A17\u70DD\u69A7\u614C\u920E\u9310\u9BAD\u52D7\u925E\u92F9" + - "\u5993\u7696\u66FB\u5769\u73CA\u7678\u6A1F\u7E9C\u9811\u8CD1\u5840\u6349\u871C\u62D0\u60B4\u6B89" + - "\u86EE\u5764\u581D\u8549\u7235\u7652\u983B\u8237\u5351\u5C24\u59BE\u5815\u901D\u69B4\u834A\u9EA9" + - "\u976B\u8086\u53AD\u6068\u4FAE\u76C3\u6A05\u689B\u937E\u99D5\u91C7\u5C16\u585E\u61A7\u9699\u4FDF" + - "\u8278\u9C52\u5F45\u6108\u7C8D\u806F\u5DF7\u8D6B\u57B0\u98E2\u5703\u79BF\u5996\u7941\u540A\u83DF" + - "\u9C39\u52D2\u6BD8\u86CB\u4EC0\u9A28\u5366\u8006\u7337\u6492\u8FED\u5AC9\u5420\u537F\u4FAF\u807E" + - "\u543B\u7515\u7B18\u8749\u54B3\u704C\u8997\u6CAB\u85FA\u7114\u696E\u9328\u745A\u59D1\u6E5B\u617E" + - "\u53E2\u8317\u76E7\u848B\u85AF\u6925\u5C60\u7259\u75D5\u8B90\uFFFF\u0042\uFFFD\u6E07\u82AD\u5C4F" + - "\u7BED\u9784\u6F70\u764C\u88B7\u92D2\u4F36\u5EFE\u9061\u88E1\u8471\u711A\u6D1B\u80B4\u74E2\u7433" + - "\u5A7F\u905C\u980C\u5319\u906E\u6BB4\u85AA\u7897\u7AFA\u6AAE\u8910\u958F\u620C\u4F3D\u4F7C\u79BE" + - "\u9D0E\u4ED4\u57A2\u51A5\u6900\u6089\u707C\u7AE3\u8956\u93A7\u9C2D\u5112\u52FA\u7CCA\u60F9\u7078" + - "\u81C6\u559D\u6991\u96C9\u553E\u805A\u8304\u8332\u54FA\u565B\u8FBF\u5634\u6760\u5265\u840E\u5E5F" + - "\u7B65\u9035\u8387\u6B4E\u58BE\u6309\u727D\u97AD\u69D0\u546A\u984E\u632B\u714E\u8557\u7CDE\u6372" + - "\u68F9\u7511\u8602\u6EBA\u5A3C\u7A84\u851A\u95A4\u59D0\u60DA\u51EA\u5A29\u7169\u6F15\u696B\u63BB" + - "\u75E9\u4E4E\u7DBB\u6934\u8521\u8FFA\u9354\u9C3B\u5F17\u5ED3\u8258\u895F\u82E7\u52C3\u5C51\u83AB" + - "\u7826\u79E1\u7FF0\u626E\u60F0\u5CA8\u6F97\u71A8\u9909\u5132\u5E37\u5F04\u637B\u6753\u68D7\u6652" + - "\u9CF6\u88B0\u52AB\u4FC4\u4E3C\u67B3\u7BAA\u7F4D\u8A23\u63B4\u71E6\u65A4\u6F09\u853D\u5072\u7DBA" + - "\u5516\u7B04\u72FD\u6CD3\u8422\u621F\u50AD\u8235\u8718\u5919\u6028\u677C\u6F23\u75B9\u695C\u520E" + - "\u8018\u8B01\u71ED\u5713\u660F\u83EB\u7164\u7D9B\u5617\u7D7D\u8F4D\u9318\u8569\u5D17\u678C\u67DE" + - "\u87C7\u79AE\u5835\u8404\u9041\u7FD4\u6E8C\u8A63\u9D08\u670F\u939A\uFFFF\u0042\uFFFD\u63AC\u602F" + - "\u64E2\u608D\u96B7\u6357\u8461\u914B\u75D8\u60E7\u9913\u9C57\u5984\u6DEB\u5E96\u6D9C\u9BF0\u58BB" + - "\u7977\u60B6\u633F\u5BF5\u9812\u558B\u82D3\u5147\u6190\u7953\u79BD\u6C5D\u9EBA\u9C48\u8DA8\u5EE0" + - "\u7D43\u5EFC\u854E\u8CE4\u5AE1\u54E8\u5023\u52BE\u7DEC\u8511\u6666\u6C3E\u724C\u8ADC\u9C0D\u77A5" + - "\u8B02\u8D05\u6F11\u9834\u97FB\u50FB\u7F75\u5A03\u8513\u4FB6\u634C\u9D61\u808B\u5294\u65A1\u567A" + - "\u5957\u8D0B\u6A35\u6AD3\u70F9\u865E\u6FB1\u51E7\u7FEB\u59EA\u5E87\u6B6A\u754F\u717D\u914E\u7D2C" + - "\u8C79\u6062\u621A\u7FA8\u5F1B\u6C8C\u86FE\u7562\u7B86\u9AB8\u6627\u7ABA\u844E\u6F81\u8B2C\u86A4" + - "\u6FEB\u7B8B\u7F77\u8F2F\u8E44\u7E23\u4E4D\u79A6\u8AFA\u903C\u50D1\u9ECD\u5EDF\u758F\u631F\u53DB" + - "\u9910\u826E\u62F7\u68FA\u725D\u803D\u58D5\u5C4D\u86D9\u540B\u8805\u92F2\u9237\u5C61\u985B\u86E4" + - "\u966A\u7262\u6955\u6CD7\u6994\u9C2F\u77E7\u68C9\u8DE8\u6D6C\u67C1\u9BAA\u619A\u63A9\u7015\u9306" + - "\u934D\u6A61\u6258\u5283\u7525\u5687\u6C83\u6834\u649E\u4E9B\u7252\u59E6\u8FC2\u5FBD\u6DD8\u85F7" + - "\u8A51\u9817\u99C1\u63A0\u7C81\u5B30\u8139\u5403\u7E82\u8106\u532A\u6A8E\u7F6B\u54E9\u5678\u8AB9" + - "\u6715\u5BD3\u6478\u64FE\u6B1D\u8CC2\u51CB\u7E8F\uFFFF\u0046\uFFFD\u5F0C\u0000\u0007\u4E10\u1528" + - "\u2A31\u363F\u4256\u5862\u8285\u8A8E\u5F0D\u0000\b\u4E9E\uA0A2\uB0B3\uB6CE\uCDC4\uC6C2\uE1D7" + - "\uDEED\uDFFC\u0000\u0012\u4F09\u1C00\u035A\u305D\u3957\u475E\u565B\u928A\u888F\u9AAD\u987B\uAB69" + - "\u7094\u6F86\u96D4\uCED8\uDBD1\uDAD0\uCDE4\u4FE5\u0000\u0005\u501A\u4028\u142A\u2505\u2122\u292C" + - "\u4FFF\u4FFE\u4FEF\u0000\n\u5011\u1E06\u4347\u5550\u485A\u560F\u4670\u426C\u7880\u949A\u85B4" + - "\u6703\u0000\u0006\u50B2\uC9CA\uB3C2\uF4DE\uE5D8\uEDE3\uEEF9\u50F5\u0000\f\u5109\u0102\u1A15" + - "\u1416\u213A\u373C\u3B3F\u404A\u4C52\u5462\u6469\u6A6E\u8082\u56D8\u0000\u000F\u518C\u898F\u9193" + - "\u9596\u9DA4\uA6A2\uA9AA\uABB3\uB1B2\uB0B5\uBEBD\uC5C9\uDBE0\uE9EC\uEDF0\uF5FE\u0000\u0005\u5204" + - "\u0B14\u1527\u2A2E\u3339\u444B\uFFFF\u0042\uFFFD\u0000\u000F\u524F\u5E54\u716A\u7374\u697F\u7D8D" + - "\u8892\u919C\uA6AC\uADBC\uB5C1\uC0CD\uDBDE\uE3E6\uE0F3\uF5F8\u52F9\u5300\u5306\u5307\u5308\u7538" + - "\u0000\u0007\u530D\u100F\u151A\u2423\u2F31\u3338\u4045\u4649\u4E17\u534D\u51D6\u8209\u0000\b" + - "\u535E\u696E\u7277\u7B82\u9396\uA0A6\uA5AE\uB0B2\uB6C3\u7C12\u53DD\u53DF\u66FC\uFA0E\u71EE\u53EE" + - "\u53E8\u53ED\u53FA\u0000\u0016\u5401\u3D40\u2C2D\u3C2E\u3629\u1D4E\u8F75\u8E5F\u7177\u7092\u7B80" + - "\u9C76\u8490\u868A\uC7BC\uAFA2\uB8A5\uACC4\uD8C8\uA8AB\uC2A4\uA9BE\uE5FF\u54E6\u550F\u5514\u54FD" + - "\u54EE\u54ED\u54E2\u0000\u0010\u5539\u4063\u4C2E\u5C45\u5657\u3833\u5D99\u808A\u9F7B\u7E98\u9EAE" + - "\u7C86\u83A9\u87A8\uC5DF\uC4DC\uE4D4\u55F9\u5614\u55F7\u5616\u55FE\u55FD\u0000\u0005\u561B\u4E50" + - "\u3632\u386B\u6486\u2F6C\u566A\u71DF\u5694\u568F\u5680\uFFFF\u0042\uFFFD\u0000\t\u568A\uA0A5" + - "\uAEB6\uB4C8\uC2BC\uC1C3\uC0CE\uD3D1\uD7EE\uF9FF\u5704\u5709\u5708\u570D\u55C7\u0000\u000E\u5718" + - "\u161C\u2638\u4E3B\u5940\u4F65\u8861\u7F89\u93A0\uA4B3\uACAA\uC3C6\uC8C0\uD4C7\uD2D3\u57D6\uFA0F" + - "\u580A\u57E3\u580B\u5819\u5821\u584B\u5862\u6BC0\u583D\u5852\uFA10\u0000\r\u5870\u7985\u729F" + - "\uABB8\u9EAE\uB2B9\uBAC5\uD3D1\uD7D9\uD8DE\uDCDF\uE4E5\uEFF7\uF9FB\u58FC\u5902\u590A\u590B\u5910" + - "\u591B\u68A6\u0000\u000F\u5925\u2C2D\u3238\u3E55\u5053\u5A58\u5B5D\u6362\u6067\u6C69\u7881\u8D9B" + - "\u9DA3\uA4B2\uBAC6\uE8D9\u59DA\u0000\r\u5A25\u1F11\u1C1A\u0940\u6C49\u3536\u626A\u9ABC\uBED0" + - "\uCBC2\uBDE3\uD7E6\uE9D6\uFAFB\u0000\u0006\u5B0C\u0B16\u322A\u363E\u4345\u4051\u5556\u6588\u0000" + - "\u0007\u5B5B\u6569\u7073\u7578\u7A80\u83A6\uB8C3\uC7C0\u5BC9\u752F\uFFFF\u0042\uFFFD\u0000\u0005" + - "\u5BD0\uD8DE\uECE4\uE2E5\uEBF0\uF3F6\u0000\u0007\u5C05\u0708\u0D13\u1E20\u2228\u3841\u464E\u5350" + - "\u5B71\u0000\u000B\u5C6C\u6E76\u798C\u94BE\uABBB\uB6B7\uA6BA\uC5BC\uC7D9\uE9FD\uFAF5\uEDEA\u0000" + - "\u0006\u5D0B\u151F\u1B11\u2722\u1A19\u184C\u5253\uFA11\u0000\r\u5D5C\u4E4B\u426C\u736D\u7687" + - "\u8482\u8CA2\u9D90\uACAE\uB7B8\uBCB9\uC9D0\uD3D2\uDBEB\u5DF5\u0000\u0012\u5E0B\u1A19\u111B\u3644" + - "\u4340\u474E\u5754\u6264\u7576\u7A7F\uA0C1\uC2C8\uD0CF\uDDDA\uDBE2\uE1E8\uE9EC\uF0F1\uF3F4\u0000" + - "\u0018\u5F03\u090B\u1116\u2129\u2D2F\u3438\u4148\u4C4E\u5156\u5759\u5C5D\u6167\u7377\u8382\u7F8A" + - "\u8887\u9199\u9E98\uA0A8\uADB7\uBCD6\uFBE4\uF8F1\uF0DD\uDEFF\u0000\u0005\u6021\u1910\u290E\u311B" + - "\u152B\u260F\u603A\uFFFF\u0042\uFFFD\u0000\u0012\u605A\u4160\u5D6A\u775F\u4A46\u4D63\u4364\u6C6B" + - "\u5985\u8183\u9A84\u9B8A\u9697\u92A7\u8BE1\uB8DE\uE0D3\uBDC6\uB5D5\u60D8\u6120\u60F2\u6115\u6106" + - "\u60F6\u60F7\u6100\u60F4\u60FA\u6103\u6121\u60FB\u60F1\u0000\u0018\u610D\u0E11\u474D\u3728\u273E" + - "\u4A30\u3C2C\u3465\u5D3D\u4244\u7387\u7758\u595A\u6B74\u6F71\u5F53\u7598\u9996\uAC94\u8A91\uABAE" + - "\uCCCA\uC9C8\uC3C6\uBACB\u7F79\u0000\u0005\u61CD\uE6E3\uF4F7\uF6FD\uFAFF\uFCFE\u0000\u0016\u6200" + - "\u0809\u0D13\u141B\u1E21\u2A2E\u3032\u3341\u4E5E\u635B\u6068\u7C82\u8992\u7E93\u9683\u94D7\uD1BB" + - "\uCFAC\uC6C8\uDCD4\uCAC2\uA6C7\u9BC9\u630C\u62EE\u62F1\u6327\u6302\u6308\u62EF\u62F5\u62FF\u0000" + - "\u000B\u6350\u4D3E\u4F96\u8E80\uAB76\uA38F\u899F\u6B69\uB5BE\uE9C0\uC6F5\uE3C9\u63D2\uFFFF\u0042" + - "\uFFFD\u63F6\u63C4\u0000\u0014\u6434\u0613\u2636\u1C17\u280F\u164E\u676F\u6076\uB99D\uCE95\uBB93" + - "\uA5A9\u88BC\uDAD2\uC5C7\uD4D8\uC2F1\uE7E0\uE1E3\uEFF4\uF6F2\u64FA\u6500\u64FD\u0000\u0006\u6518" + - "\u1C1D\u0524\u232B\u2C34\u3537\u3638\u754B\u0000\u0005\u6548\u4E56\u4D58\u555D\u7278\u8283\u8B8A" + - "\u0000\u0006\u659B\u9FAB\uB7C3\uC6C1\uC4CC\uD2D9\uE1E0\u65F1\u6600\u6615\u6602\u6772\u6603\u65FB" + - "\u0000\b\u6609\u3F35\u2E1E\u341C\u2444\u4965\u575E\u6459\u625D\uFA12\u0000\f\u6673\u7083" + - "\u8884\u9998\uA09D\uB2C4\uC1BF\uC9BE\uBCB8\uD6DA\uE6E9\uF0F5\uF7FA\u670E\uF929\u6716\u671E\u7E22" + - "\u6726\u6727\u9738\u0000\r\u672E\u3F36\u3738\u465E\u5966\u6489\u8570\uA96A\u8B73\uA6A1\uBBB7" + - "\uEFB4\uECE9\uB8E7\u67E4\u6852\u67DD\u67E2\u67EE\u67C0\u67CE\u67B9\u6801\u67C6\u0000\u0004\u681E" + - "\u464D\u4044\u324E\u6359\u688D\uFFFF\u0042\uFFFD\u0000\u0006\u6877\u7F9F\u7E8F\uAD94\u83BC\uB974" + - "\uB5BA\u690F\u6901\u68CA\u6908\u68D8\u6926\u68E1\u690C\u68CD\u68D4\u68E7\u68D5\u6912\u68EF\u6904" + - "\u68E3\u68E0\u68CF\u68C6\u6922\u692A\u6921\u6923\u6928\uFA13\u0000\b\u6979\u7736\u7854\u6A74" + - "\u683D\u5930\u5E5D\u7E81\uB2BF\uFA14\u6998\u69C1\u69D3\u69BE\u69CE\u5BE8\u0000\u0004\u69CA\uB1DD" + - "\uBBC3\uA09C\u95DE\u6A2E\u69E8\u6A02\u6A1B\u69FF\u69F9\u69F2\u69E7\u69E2\u6A1E\u69ED\u6A14\u69EB" + - "\u0000\u0013\u6A0A\u2212\u2313\u306B\u440C\uA036\u7847\u6259\u6648\u4638\u7273\u908D\u84A2\uA37E" + - "\u97AC\uAABB\uC2B8\uB3C1\uDEE2\uD1DA\u6AE4\u8616\u8617\u6AEA\u6B05\u6B0A\u6AFA\u6B12\u6B16\u6B1F" + - "\u6B38\u6B37\u6B39\u76DC\u98EE\u0000\u0012\u6B47\u4349\u5059\u545B\u5F61\u7879\u7F80\u8483\u8D98" + - "\u959E\uA4AA\uABAF\uB1B2\uB3B7\uBCC6\uCBD3\uD6DF\uECEB\uF3EF\u0000\u0007\u6C08\u1314\u1B24\u233F" + - "\u5E55\u5C62\u828D\u866F\uFFFF\u0042\uFFFD\u0000\n\u6C9A\u819B\u7E68\u7392\u90C4\uF1BD\uC5AE" + - "\uDADD\uB1BE\uBADB\uEFD9\u6CEA\u0000\n\u6D1F\u0436\u2B3D\u3312\u0C63\u8793\u6F64\u5A79\u598E" + - "\u959B\u8596\u6DF9\u6E0A\u6E2E\u0000\n\u6DB5\uE6C7\uACB8\uCFC6\uECDE\uCCE8\uF8D2\uC5FA\uD9F2" + - "\uFCE4\uD5EA\u6DEE\u0000\u0011\u6E2D\u6E19\u725F\u393E\u236B\u5C2B\u764D\u1F27\u433C\u3A4E\u241D" + - "\u3882\uAA98\uB7BD\uAFC4\uB2D4\uD58F\uBFC2\u6E9F\u6F41\u6F45\u6EEC\u6EF8\u6EFE\u6F3F\u6EF2\u6F31" + - "\u6EEF\u6F32\u6ECC\u6EFF\u6F3E\u6F13\u6EF7\u0000\u000F\u6F86\u7A78\u806F\u5B6D\u7482\u887C\u58C6" + - "\u8E91\u66B3\uA3B5\uA1B9\uDBAA\uC2DF\uD5EC\uD8D4\uF5EE\u7005\u7007\u7009\u700B\u6FFA\u7011\u7001" + - "\u700F\u701B\u701A\u701F\u6FF3\u0000\b\u7028\u1830\u3E32\u5163\u8599\uAFAB\uACB8\uAEDF\uCBD9" + - "\u7109\u710F\u7104\u70F1\u70FD\u711C\u7119\u715C\u7146\u7147\u7166\uFFFF\u0042\uFFFD\u0000\u0003" + - "\u7162\u4C56\u6C88\u8F84\u7195\uFA15\u0000\b\u71AC\uC1B9\uBED2\uE7C9\uD4D7\uCEF5\uE0EC\uFBFC" + - "\uF9FE\u71FF\u0000\u0012\u720D\u1028\u2D2C\u3032\u3B3C\u3F40\u464B\u5874\u7E81\u8782\u9296\uA2A7" + - "\uB1B2\uBEC3\uC6C4\uB9CE\uD2E2\uE0E1\uF9F7\u0000\u0004\u7317\u0A1C\u161D\u2434\u292F\uFA16\u7325" + - "\u733E\u734F\u734E\u7357\u9ED8\u0000\n\u736A\u6870\u7778\u757B\uC8BD\uB3CE\uBBC0\uC9D6\uE5E3" + - "\uD2EE\uF1DE\u73F8\u7407\u73F5\u0000\u0013\u7405\u262A\u2529\u2E32\u3A55\u3F5F\u5941\u5C69\u7063" + - "\u6A64\u6289\u6F7E\u9F9E\uA2A7\uCACF\uD4E0\uE3E7\uE9EE\uF0F2\uF1F7\u74F8\u0000\u0016\u7501\u0403" + - "\u050D\u0C0E\u131E\u262C\u3C44\u4D4A\u4946\u5B5A\u6467\u6B6F\u746D\u7876\u8286\u878A\u8994\u9A9D" + - "\uA5A3\uC2B3\uC3B5\uBDB8\uBCB1\u75CD\uFFFF\u0042\uFFFD\u0000\u0003\u75CA\uD2D9\uE3DE\uFEFF\u75FC" + - "\u7601\u75F0\u75FA\u75F2\u75F3\u0000\u0015\u760B\u091F\u2720\u2122\u2434\u303B\u4748\u5846\u5C61" + - "\u6268\u6967\u6A6C\u7072\u767C\u8280\u8388\u8B99\u9A9C\u9E9B\uA6B0\uB4B8\uB9BA\u76C2\uFA17\u0000" + - "\u0003\u76CD\uD6D2\uDEE1\uE5EA\u862F\u76FB\u0000\u0012\u7708\u0704\u2429\u2526\u1B37\u3846\u475A" + - "\u686B\u5B65\u7F7E\u798E\u8B91\uA09E\uB0B6\uB9BF\uBCBD\uBBC7\uCDDA\uDCE3\u77EE\u52AF\u77FC\u0000" + - "\u000F\u780C\u1221\u3F20\u454E\u6474\u8E7A\u869A\u7C8C\uA3B5\uAAAF\uD1C6\uCBD4\uBEBC\uC5CA\uECE7" + - "\uDAFD\u78F4\u7907\u7911\u7919\u792C\u792B\u7930\uFA18\u7940\u7960\uFA19\u795F\u795A\u7955\uFA1A" + - "\u797F\u798A\u7994\uFA1B\u0000\u0004\u799D\u9BAA\uB3BA\uC9D5\uE7EC\u79E3\u0000\u0007\u7A08\u0D18" + - "\u191F\u313E\u373B\u4357\u4962\u6169\u9F9D\u0000\u0003\u7A70\u797D\u8895\u9896\uFFFF\u0042\uFFFD" + - "\u7A97\u7AA9\u7AB0\u7AB6\u9083\u0000\t\u7AC3\uBFC5\uC4C7\uCACD\uCFD2\uD1D5\uD3D9\uDADD\uE1E2" + - "\uE6E7\uFA1C\u7AEB\u7AED\u7AF0\u7AF8\u0000\u0014\u7B02\u0F0B\u0A06\u3336\u191E\u3528\u504D\u4C45" + - "\u5D75\u7A74\u7071\u6E9D\u989F\u8D9C\u9A92\u8F99\uCFCB\uCCB4\uC69E\uDDE9\uE6F7\u7BE5\u7C14\u7C00" + - "\u7C13\u7C07\u7BF3\u7C0D\u7BF6\u0000\u000E\u7C23\u272A\u1F37\u2B3D\u404C\u4356\u5058\u5F65\u6C75" + - "\u8390\uA4A2\uABA1\uADA8\uB3B2\uB1AE\u7CB9\uFA1D\u0000\u0005\u7CBD\uC5C2\uD2E2\uD8DC\uEFF2\uF4F6" + - "\u0000\u0015\u7D06\u021C\u150A\u454B\u2E32\u3F35\u4846\u5C73\u564E\u686E\u4F63\u9389\u5BAE\uA3B5" + - "\uB7C7\uBDAB\uA2AF\uA0B8\u9FB0\uD5D8\uDDD6\uE4DE\u7DFB\u7E0B\u7DF2\u7DE1\u7DDC\u0000\n\u7E05" + - "\u0A21\u121F\u093A\u4666\u313D\u353B\u3943\u3732\u5D56\u5E52\u7E59\uFFFF\u0042\uFFFD\u0000\u0003" + - "\u7E5A\u6779\u6A69\u7C7B\u7E7D\u8FAE\u0000\u0004\u7E7F\u8389\u8E8C\u9293\u9496\u7E9B\u0000\u0010" + - "\u7F38\u3A45\u474C\u4E51\u5554\u585F\u6068\u6769\u7882\u8683\u8788\u8C94\u9E9D\u9AA1\uA3AF\uAEB2" + - "\uB9B6\u7FB8\u8B71\uFA1E\u0000\u0004\u7FC5\uC6CA\uD5E1\uE6E9\uF3F9\u0000\r\u8004\u0B12\u191C" + - "\u2128\u3F3B\u4A46\u5258\u5F62\u6873\u7270\u7679\u7D7F\u8485\u939A\u80AD\u5190\u0000\u0003\u80AC" + - "\uDBE5\uD9DD\uC4DA\u8109\u80EF\u80F1\u0000\u0003\u811B\u232F\u4B46\u3E53\u8151\u80FC\u0000\u0012" + - "\u8171\u6E65\u5F66\u7483\u888A\u8082\uA095\uA393\uB5A4\uA9B8\uB0C8\uBEBD\uC0C2\uBAC9\uCDD1\uD8D9" + - "\uDADF\uE0FA\uFBFE\u0000\u0010\u8201\u0205\u0D10\u1216\u292B\u2E38\u3340\u595A\u5D5F\u6462\u686A" + - "\u6B71\u777E\u8D92\uAB9F\uBBAC\uE1E3\u82DF\u8301\u82D2\u82F4\u82F3\u8303\u82FB\u82F9\uFFFF\u0042" + - "\uFFFD\u82DE\u8306\u82DC\u82FA\u8309\u82D9\u0000\u000F\u8335\u6234\u1631\u4039\u5045\u2F2B\u189A" + - "\uAA9F\uA296\u238E\u757F\u8A7C\uB573\u93A0\u8589\uA8F4\u8413\u83C7\u83CE\u83F7\u83FD\u8403\u83D8" + - "\u840B\u83C1\u8407\u83E0\u83F2\u840D\u8420\u83F6\u83BD\u83FB\u0000\u000F\u842A\u623C\u8477\u6B79" + - "\u486E\u8269\u466F\u3835\uCAB9\uBF9F\uB4CD\uBBDA\uD0C1\uADC6\uD6A1\uD9FF\u84F4\u0000\u0010\u8517" + - "\u182C\u1F15\u1406\u535A\u4059\u6358\u4841\u4A4B\u6B55\u80A4\u8891\u8AA8\u6D94\u9BAE\u879C\u777E" + - "\u8590\uFA1F\u820A\u0000\u0005\u85B0\uC9BA\uCFB9\uD0D5\uDDE5\uDCF9\u860A\u8613\u860B\u85FE\u8622" + - "\u861A\u8630\u863F\uFA20\u864D\u4E55\u0000\b\u8655\u5F67\u7193\uA3A9\u8BAA\u8CB6\uAFC4\uC6B0" + - "\uC9CE\uFA21\u0000\u0003\u86AB\uD4DE\uE9EC\uDFDB\u8712\u8706\u8708\u8700\u8703\u86FB\u8711\u8709" + - "\u870D\u86F9\u0000\u0005\u870A\u343F\u3B25\u291A\u5F78\u4C4E\uFFFF\u0042\uFFFD\u0000\t\u8774" + - "\u5768\u826A\u606E\u5953\u637F\uA2C6\u9FAF\uCBBD\uC0D0\u96D6\u0000\u0003\u87AB\uC4B3\uD2BB\uEFF2" + - "\u87E0\u880E\u8807\u880F\u8816\u880D\u87FE\u87F6\u87F7\u0000\u0014\u8811\u1522\u2127\u3136\u393B" + - "\u4244\u4D52\u595E\u626B\u817E\u757D\u7282\u9E97\u92AE\u99A2\u8DA4\uBFB5\uB1C3\uC4D4\uD8D9\uDDF9" + - "\u8902\u88FC\u88F5\u88E8\u88F2\u0000\u0016\u8904\u0C2A\u1D0A\u131E\u252B\u413B\u3643\u384D\u4C60" + - "\u5E66\u6A64\u6D6F\u7477\u7E83\u888A\u9398\uA1A9\uA6AC\uAFB2\uBABF\uBDC0\uDADD\uE7F4\u89F8\u0000" + - "\u0013\u8A03\u1610\u0C12\u1B1D\u2536\u4137\u5B52\u4648\u7C6D\u6C62\u7985\u8284\uA8A1\u91A5\uA69A" + - "\uA3A7\uCCBE\uCDC2\uDAF3\uE7E4\u8AF1\u8B14\u8AE0\u8AE2\u8AE1\u8ADF\uFA22\u8AF6\u8AF7\u8ADE\u8ADB" + - "\u0000\u0004\u8B0C\u071A\u1610\u1720\u3341\u97AB\u8B26\u8B2B\uFFFF\u0042\uFFFD\u0000\u000B\u8B3E" + - "\u4C4F\u4E53\u4956\u5B5A\u746B\u5F6C\u6F7D\u7F80\u8C8E\u9992\u9396\u8B9A\u0000\n\u8C3A\u413F" + - "\u484C\u4E50\u5562\u6C78\u7A7C\u8289\u858A\u8D8E\u9894\u621D\u0000\b\u8CAD\uAAAE\uBDB2\uB3C1" + - "\uB6C8\uCECD\uE3DA\uF0F4\uFDFA\u8CFB\u0000\u0006\u8D07\u0A0F\u0D12\u1013\u1416\u676D\u7176\uFA23" + - "\u0000\u0007\u8D81\uC2BE\uBACF\uDAD6\uCCDB\uCBEA\uEBDF\uE3FC\u8E08\u8DFF\u0000\u0017\u8E09\u1D1E" + - "\u101F\u4235\u3034\u4A47\u494C\u5048\u5964\u6055\u6376\u7287\u7C81\u8584\u8B8A\u9391\u9499\uA1AA" + - "\uB1BE\uC6C5\uC8CB\uCFDB\uE3FC\uFBEB\u8EFE\u0000\u0010\u8F0A\u0C05\u1512\u131C\u191F\u2633\u3B39" + - "\u4542\u3E49\u464C\u4E57\u5C62\u6364\u9C9F\uA3A8\uA7AD\uAFB7\uFA24\u8FDA\u8FE5\u8FE2\u8FEF\u8FE9" + - "\u8FF4\u9005\u8FF9\u8FF8\u9011\u9015\u900E\u9021\uFFFF\u0042\uFFFD\u0000\u0003\u900D\u1E16\u0B27" + - "\u3639\u904F\uFA25\u0000\u0005\u9050\u5152\u493E\u5658\u5E68\u676F\u9076\u96A8\u9072\u9082\u907D" + - "\u9089\u9080\u908F\u6248\u0000\u0003\u90AF\uB1B5\uE2E4\uDBDE\u9102\uFA26\u0000\u0014\u9115\u1219" + - "\u3227\u304A\u5658\u6365\u6973\u728B\u8982\uA2AB\uAFAA\uB5B4\uBAC0\uC1CB\uD0DA\uDBD7\uDED6\uDFE1" + - "\uEDF5\uEEE4\uF6E5\u9206\u921E\u91FF\u0000\u0012\u9210\u140A\u2C15\u2957\u453A\u4964\u403C\u484E" + - "\u5059\u3F51\u394B\u675A\u9CA7\u7778\u9693\u9B95\uE9CF\uE7D7\uD9D0\uFA27\u92D5\u92B9\u92B7\u92E0" + - "\u92D3\u933A\u9335\u930F\u9325\u92FA\u9321\u9344\u92FB\uFA28\u9319\u931E\u92FF\u0000\u000E\u9322" + - "\u1A1D\u2302\u3B70\u607C\u6E56\u57B9\uB0A4\uAD94\uC8D6\uC6D7\uE8E5\uD8C3\uDDDE\uD0E4\u941A\u93F8" + - "\u0000\n\u9414\u1321\u0307\u362B\u313A\u4152\u4544\u485B\u5A60\u625E\u6A75\u9470\uFFFF\u0042" + - "\uFFFD\u9477\u947F\u947D\u947C\u947E\u9481\u0000\b\u9582\u878A\u9294\u9698\u99A0\uA8A7\uADBC" + - "\uBBB9\uBECA\u6FF6\u0000\u0004\u95C3\uCDCC\uD5D4\uD6DC\uE1E5\u95E2\u0000\b\u9621\u282E\u2F42" + - "\u4F4C\u4B5C\u5D5F\u6677\u726C\u8D8B\uF9DC\u9698\u9695\u9697\uFA29\u0000\b\u969D\uA7AA\uB1B2" + - "\uB0AF\uB4B6\uB8B9\uCECB\uD5DC\uD9F9\u0000\u001B\u9704\u0608\u190D\u130E\u110F\u1624\u2A30\u3339" + - "\u3B3D\u3E46\u4443\u4842\u494D\u4F51\u555C\u6064\u6668\u6D79\u857C\u817A\u8B8F\u909C\uA8A6\uA3B3" + - "\uB4C3\uC6C8\uCBDC\uEDF2\u7ADF\u97F5\u0000\f\u980F\u1A24\u2137\u3D4F\u4B57\u656B\u6F70\u7174" + - "\u73AA\uAFB1\uB6C4\uC3C6\uDCED\u98E9\uFA2A\u98EB\uFA2B\u9903\u991D\u9912\u9914\u9918\u9927\uFA2C" + - "\u0000\u000B\u9921\u1E24\u202C\u2E3D\u3E42\u4945\u504B\u514C\u5597\u989E\uA5AD\uAEBC\u99DF\uFFFF" + - "\u0042\uFFFD\u0000\u0005\u99DB\uDDD8\uD1ED\uEEE2\uF1F2\uFBF8\u0000\u0016\u9A01\u0F05\u192B\u3740" + - "\u4542\u433E\u554D\u4E5B\u575F\u6269\u6564\u6A6B\uADB0\uBCC0\uCFD3\uD4D1\uD9DC\uDEDF\uE2E3\uE6EF" + - "\uEBEE\uF4F1\uF7FB\u0000\u0019\u9B06\u181A\u1F22\u2325\u2728\u292A\u2E2F\u3132\u3B44\u434D\u4E51" + - "\u5875\u7472\u938F\u8391\u9697\u9FA0\uA8B1\uB4C0\uCABB\uB9C6\uCFD1\uD2E3\uE2E4\uD4E1\uF5F1\u9BF2" + - "\u0000\u000E\u9C04\u1B15\u1400\u0913\u0C06\u0812\u0A2E\u2524\u2130\u4732\u463E\u5A60\u6776\u78EB" + - "\uE7EC\u9CF0\u0000\u0014\u9D09\u0306\u2A26\u2C23\u1F15\u1241\u3F44\u3E46\u485D\u5E59\u5150\u6472" + - "\u7087\u6B6F\u7A9A\uA4A9\uABB2\uC4C1\uBBB8\uBAC6\uCFC2\uFA2D\u0000\u0003\u9DD9\uD3F8\uE6ED\uEFFD" + - "\u9E1A\u9E1B\u9E19\uFFFF\u0042\uFFFD\u0000\b\u9E1E\u7579\u7D81\u888B\u8C95\u919D\uA5B8\uAAAD" + - "\uBCBE\u9761\u0000\t\u9ECC\uCFD0\uD1D4\uDCDE\uDDE0\uE5E8\uEFF4\uF6F7\uF9FB\uFCFD\u9F07\u9F08" + - "\u76B7\u0000\u000B\u9F15\u212C\u3E4A\u4E4F\u5254\u635F\u6061\u6667\u6C6A\u7772\u7695\u9CA0\u5C2D" + - "\u69D9\u9065\u7476\u51DC\u7155\uFFFF\u00BB\uFFFD\uFFFE\u00BE\uE000\uFFFF\u0042\uFFFD\uFFFE\u00BE" + - "\uE0BE\uFFFF\u0042\uFFFD\uFFFE\u00BE\uE17C\uFFFF\u0042\uFFFD\uFFFE\u00BE\uE23A\uFFFF\u0042\uFFFD" + - "\uFFFE\u00BE\uE2F8\uFFFF\u0042\uFFFD\uFFFE\u00BE\uE3B6\uFFFF\u0042\uFFFD\uFFFE\u00BE\uE474\uFFFF" + - "\u0042\uFFFD\uFFFE\u00BE\uE532\uFFFF\u0042\uFFFD\uFFFE\u00BE\uE5F0\uFFFF\u0042\uFFFD\uFFFE\u00BE" + - "\uE6AE\uFFFF\u0042\uFFFD\uFFFE\u00BE\uE76C\uFFFF\u0042\uFFFD\uFFFE\u00BE\uE82A\uFFFF\u0042\uFFFD" + - "\uFFFE\u00BE\uE8E8\uFFFF\u0042\uFFFD\uFFFE\u00BE\uE9A6\uFFFF\u0042\uFFFD\uFFFE\u00BE\uEA64\uFFFF" + - "\u0042\uFFFD\uFFFE\u00BE\uEB22\uFFFF\u0042\uFFFD\uFFFE\u00BE\uEBE0\uFFFF\u0042\uFFFD\uFFFE\u00BE" + - "\uEC9E\uFFFF\u0042\uFFFD\uFFFE\u00BE\uED5C\uFFFF\u0042\uFFFD\uFFFE\u00BE\uEE1A\uFFFF\u0042\uFFFD" + - "\uFFFE\u00BE\uEED8\uFFFF\u0042\uFFFD\uFFFE\u00BE\uEF96\uFFFF\u0042\uFFFD\uFFFE\u00BE\uF054\uFFFF" + - "\u0042\uFFFD\uFFFE\u00BE\uF112\uFFFF\u0042\uFFFD\uFFFE\u00BE\uF1D0\uFFFF\u0042\uFFFD\uFFFE\u00BE" + - "\uF28E\uFFFF\u0042\uFFFD\uFFFE\u00BE\uF34C\uFFFF\u0042\uFFFD\uFFFE\u00BE\uF40A\uFFFF\u0042\uFFFD" + - "\uFFFE\u00BE\uF4C8\uFFFF\u0042\uFFFD\uFFFE\u00BE\uF586\uFFFF\u0042\uFFFD\uFFFE\u00BE\uF644\uFFFF" + - "\u0042\uFFFD\uFFFE\u00BE\uF702\uFFFF\u0042\uFFFD\uFFFE\u007D\uF7C0\uFFFF\u2E83\uFFFD\u0000\u0017" + - "\u4E02\u0405\u0C12\u1F23\u242B\u2E2F\u3035\u4041\u4447\u515A\u5C63\u6869\u7475\u797F\u8D96\u979D" + - "\uAFB9\uC3D0\uDADB\uE0E2\uE8EF\uF1F3\uF5FD\uFEFF\u0000\u0024\u4F02\u080B\u0C12\u1516\u1719\u2E31" + - "\u3335\u373B\u3E40\u4248\u494B\u4C52\u5458\u5F60\u636A\u6C6E\u7177\u7879\u7A7D\u7E81\u8284\u8589" + - "\u8C8E\u9093\u9799\u9E9F\uB2B7\uB9BB\uBCBD\uBEC0\uC1C5\uC6C8\uCBCC\uCFD2\uDCE0\uE2F0\uF2FC\u4FFD" + - "\u0000\"\u5000\u0104\u070A\u0C0E\u1013\u1718\u1B1C\u1D27\u2E30\u3233\u353B\u4145\u4A4C\u4E51" + - "\u5253\u5759\u5F60\u6263\u6667\u6A6D\u7181\u8384\u868A\u8E8F\u9092\u9396\u9B9C\u9E9F\uA0A1\uA2AA" + - "\uAFB0\uB9BA\uBDC0\uC3C4\uC7CC\uFFFF\u0042\uFFFD\u0000\b\u50CE\uD0D3\uD4DC\uDDDF\uE2E4\uE6E8" + - "\uE9EF\uF1F2\uF6FA\u50FE\u0000\u001F\u5103\u0607\u080B\u0C0D\u0E10\u1719\u1B1C\u1D1E\u2327\u282C" + - "\u2D2F\u3133\u3435\u3839\u424F\u5355\u5758\u5F66\u7E83\u848B\u8E98\uA1A3\uADB8\uBABC\uBFC2\uC8CF" + - "\uD1D2\uD3D5\uD8DE\uE2E5\uEEF2\uF3F4\u51F7\u0000\"\u5201\u0205\u1213\u1618\u2228\u3132\u353C" + - "\u4549\u5557\u585A\u5C5F\u6061\u666E\u7778\u7980\u8285\u8A8C\u9395\u9697\u989A\uA4A5\uA7B0\uB6B7" + - "\uB8BA\uBBBD\uC4C6\uC8CC\uCFD1\uD4D6\uDCE1\uE5E8\uE9EA\uECF0\uF1F4\uF6F7\u0000\u0013\u5303\u0A0B" + - "\u0C11\u1318\u1B1C\u1E1F\u2527\u2829\u2B2C\u2D30\u3235\u3C3D\u3E42\u4B4C\u595B\u6163\u656C\u6D79" + - "\u7E83\u8788\uFFFF\u0042\uFFFD\u0000\r\u538E\u9499\u9DA1\uA4AA\uABAF\uB4B5\uB7B8\uBABD\uC0C5" + - "\uCFD2\uD3D5\uDADE\uE0E6\uE7F5\u0000\u001D\u5402\u131A\u2127\u282A\u2F31\u3435\u4344\u474D\u4F5E" + - "\u6264\u6667\u696B\u6D6E\u747F\u8183\u8588\u898D\u9195\u969F\uA1A6\uA7AA\uADAE\uB1B7\uB9BA\uBBBF" + - "\uC6CA\uCDCE\uE0EA\uECEF\uF6FC\u54FE\u0000\u0020\u5500\u0105\u0809\u0C0D\u0E15\u2A2B\u3235\u363B" + - "\u3C3D\u4147\u494A\u4D50\u5158\u5A5B\u5E60\u6164\u667F\u8182\u888E\u8F91\u9293\u9497\uA3A4\uADB2" + - "\uBFC1\uC3C6\uC9CB\uCCCE\uD1D2\uD3D7\uD8DB\uDEE2\uE9F6\u55FF\u0000\u0012\u5605\u080A\u0D0E\u0F10" + - "\u1112\u192C\u3033\u3537\u393B\u3C3D\u3F40\u4143\u4446\u494B\u4D4F\u545E\u6061\u6263\u6669\uFFFF" + - "\u0042\uFFFD\u0000\u0018\u566D\u6F71\u7275\u8485\u888B\u8C95\u999A\u9D9E\u9FA6\uA7A8\uA9AB\uACAD" + - "\uB1B3\uB7BE\uC5C9\uCACB\uCCCD\uCFD0\uD9DC\uDDDF\uE1E4\uE5E6\uE7E8\uEBED\uF1F6\u56F7\u0000\u0029" + - "\u5701\u0207\u0A0C\u1115\u1A1B\u1D20\u2223\u2425\u292A\u2C2E\u2F33\u343D\u3E3F\u4546\u4C4D\u5262" + - "\u6768\u6B6D\u6E6F\u7071\u7374\u7577\u797A\u7B7C\u7E81\u838C\u9495\u9799\u9A9C\u9D9E\u9FA1\uA7A8" + - "\uA9B8\uBDCC\uCFD5\uDDDE\uE1E4\uE6E7\uE9ED\uF0F5\uF6F8\uFDFE\u57FF\u0000\u001B\u5803\u0408\u090C" + - "\u0D1B\u1E1F\u2026\u272D\u3239\u3F49\u4C4D\u4F50\u555F\u6164\u6768\u787C\u7F80\u8187\u8889\u8A8C" + - "\u8D8F\u9094\u969D\uA0A1\uA2A6\uA9B1\uBCC2\uC4C8\uCDCE\u58D0\uFFFF\u0042\uFFFD\u0000\u0004\u58D2" + - "\uD4D6\uDADD\uE1E2\uE9F3\u0000\u0021\u5905\u060C\u1213\u141D\u2123\u2428\u2F30\u3335\u363F\u4346" + - "\u5259\u5E5F\u616B\u6D6F\u7275\u7679\u7B7C\u8B8C\u8E92\u9597\u9FA7\uADAE\uAFB0\uB3B7\uBCC1\uC3C4" + - "\uC8CA\uCDD2\uDDDE\uDFE3\uE4E7\uEEEF\uF1F2\uF4F7\u0000\u001F\u5A00\u040C\u0D0E\u1213\u1E23\u2427" + - "\u282A\u2D30\u4445\u4748\u4C50\u555E\u6365\u676D\u777A\u7B7E\u8B90\u9396\u999C\u9E9F\uA0A2\uA7AC" + - "\uB1B2\uB3B5\uB8BA\uBBBF\uC4C6\uC8CF\uDADC\uE0E5\uEAEE\uF5F6\u5AFD\u0000\u0018\u5B00\u0108\u1719" + - "\u1B1D\u2125\u2D34\u3841\u4B4C\u525E\u686E\u6F7C\u7D7E\u7F81\u8486\u8A8E\u9091\u9394\u96A8\uA9AC" + - "\uADAF\uB1B2\uB7BA\uBCC1\uCDCF\uD6D7\u5BD9\uFFFF\u0042\uFFFD\u5BDA\u5BE0\u5BEF\u5BF1\u5BF4\u5BFD" + - "\u0000\u0019\u5C0C\u171F\u2326\u292B\u2C2E\u3032\u3536\u595A\u5C62\u6367\u6869\u6D70\u7475\u7A7B" + - "\u7C7D\u8788\u8A8F\u929D\u9FA0\uA2A3\uAAB2\uB4B5\uC9CB\uD2D7\uDDEE\uF1F2\u5CF4\u0000\u001D\u5D01" + - "\u060D\u1223\u2426\u2B31\u3439\u3D3F\u4346\u484A\u5155\u595F\u6061\u6264\u6A70\u797A\u7E7F\u8183" + - "\u888A\u9293\u9495\u999B\u9FA0\uA7AB\uB0B2\uB4C3\uC7CB\uCED8\uD9E0\uE4E9\uF8F9\u0000\u001B\u5E00" + - "\u070D\u1214\u1518\u1F20\u282E\u3235\u3E49\u4B50\u5156\u585B\u5C5E\u686A\u6B6C\u6D6E\u7080\u8B8E" + - "\uA2A4\uA5A8\uAAAC\uB1B3\uBDBE\uBFC6\uCBCC\uCED1\uD2D4\uD5DC\uDEE5\u5EEB\u0000\b\u5F02\u0607" + - "\u080E\u191C\u1D22\u2324\u282B\u2C2E\u3036\uFFFF\u0042\uFFFD\u0000\u001E\u5F3B\u3D3F\u4044\u474D" + - "\u5054\u585B\u6063\u646F\u7274\u7578\u7A7D\u7E89\u8D8F\u969C\u9DA2\uA4A7\uABAC\uAFB0\uB1B8\uC4C7" + - "\uC8C9\uCBD0\uD1D2\uD3D4\uE1E2\uE8E9\uEAEC\uEDEE\uEFF2\uF3F6\uFAFC\u0000\u001F\u6007\u0A0D\u1314" + - "\u1718\u1A1F\u242D\u3335\u4047\u4849\u4C51\u5456\u5761\u6771\u7E7F\u8286\u888E\u9193\u9598\u9D9E" + - "\uA2A4\uA5A8\uB0B1\uB7BB\uBEC2\uC4C8\uC9CA\uCBCE\uCFD4\uD9DB\uDDE2\uE5F5\uF8FC\u60FD\u0000\u0020" + - "\u6102\u070A\u0C10\u1213\u1416\u1719\u1C1E\u222A\u2B31\u3536\u3941\u4546\u495E\u606C\u7278\u7B7C" + - "\u7F80\u8183\u848B\u8D92\u9397\u9C9D\u9FA0\uA5A8\uAAAD\uB8B9\uBCC0\uC1C2\uCECF\uD5DC\uDDDE\uDFE1" + - "\uE2E5\uFFFF\u0042\uFFFD\u61E7\u61E9\u61EC\u61ED\u61EF\u0000\u001A\u6201\u0304\u0715\u1C20\u2223" + - "\u2729\u2B39\u3D42\u4344\u464C\u5051\u5254\u565A\u5C64\u6D6F\u737A\u7D8D\u8E8F\u90A8\uB3B6\uB7BA" + - "\uBEBF\uC4CE\uD5D6\uDAEA\uF2F4\uFCFD\u0000\u0024\u6303\u040A\u0B0D\u1013\u1618\u292A\u2D35\u3639" + - "\u3C41\u4243\u4446\u4A4B\u4E52\u5354\u585B\u6566\u6C6D\u7174\u7578\u7C7D\u7F82\u8487\u8A90\u9495" + - "\u999A\u9EA4\uA6AD\uAEAF\uBDC1\uC5C8\uCED1\uD3D4\uD5DC\uE0E5\uEAEC\uF2F3\uF8F9\u0000\u001D\u6409" + - "\u0A10\u1214\u181E\u2022\u2425\u292A\u2F30\u353D\u3F4B\u4F51\u5253\u545A\u5B5C\u5D5F\u6163\u6D73" + - "\u747B\u7D85\u878F\u9091\u9899\u9B9F\uA1A3\uA6A8\uACB3\uBDBE\uBFC4\uC9CA\uCBCC\uFFFF\u0042\uFFFD" + - "\u0000\u0006\u64D0\uD1D5\uD7E4\uE5E9\uEAED\uF0F5\uF7FB\u64FF\u0000\u001F\u6501\u0408\u090A\u0F13" + - "\u1416\u191B\u1E1F\u2226\u292E\u313A\u3C3D\u4347\u4950\u5254\u5F60\u676B\u7A7D\u8185\u8A92\u9598" + - "\u9DA0\uA3A6\uAEB2\uB3B4\uBFC2\uC8C9\uCED0\uD4D6\uD8DF\uF0F2\uF4F5\uF9FE\u65FF\u0000\u0023\u6604" + - "\u080D\u1112\u161D\u2122\u2326\u292A\u2B2C\u3033\u3739\u4045\u464A\u4C4E\u5158\u5B5C\u6061\u6A6B" + - "\u6C75\u7778\u797B\u7C7E\u7F80\u8B8C\u8D90\u929A\u9B9C\u9FA4\uADB1\uB5BB\uC0C2\uC3C8\uCCCE\uCFD4" + - "\uDBDF\uE8EB\uECEE\u0000\u0014\u6705\u0713\u191C\u2022\u333E\u4547\u484C\u5455\u5D6C\u6E74\u767B" + - "\u8184\u8E8F\u9193\u9698\u999B\uB0B1\uB2B5\uBCBD\uC2C3\uC5C8\uFFFF\u0042\uFFFD\u0000\u0005\u67C9" + - "\uD2D7\uD9DC\uE1E6\uF0F2\uF6F7\u67F9\u0000\"\u6814\u191D\u1F27\u282C\u2D2F\u3031\u333B\u3F45" + - "\u4A4C\u5557\u585B\u6B6E\u6F70\u7172\u7579\u7A7B\u7C82\u8486\u8896\u989A\u9CA1\uA3A5\uA9AA\uAEB2" + - "\uBBC5\uCCD0\uD1D3\uD6D9\uDCDD\uE5E8\uEAEB\uECED\uF0F1\uF5F6\uFBFC\u68FD\u0000\u001C\u6906\u090A" + - "\u1011\u1316\u1731\u3335\u383B\u4245\u494E\u575B\u6364\u6566\u696C\u7071\u727A\u7B7F\u808D\u9296" + - "\uA1A5\uA6A8\uABAD\uAFB7\uB8BA\uBCC5\uC8D1\uD6D7\uE5EE\uEFF1\uF3F5\u69FE\u0000\u0018\u6A00\u0103" + - "\u0F11\u151A\u1D20\u2428\u3234\u373B\u3E3F\u4549\u4A4E\u5051\u5255\u565B\u6467\u6A71\u8183\u8687" + - "\u898B\u919B\u9D9E\u9FA5\uABAF\uB0B1\uB4BD\u6ABE\uFFFF\u0042\uFFFD\u0000\b\u6ABF\uC6C8\uC9CC" + - "\uD0D4\uD5D6\uDCDD\uE7EC\uF0F1\uF2FC\u6AFD\u0000\u0021\u6B02\u0306\u0709\u0F10\u1117\u1B1E\u2428" + - "\u2B2C\u2F35\u363B\u3F46\u4A4D\u5256\u585D\u6067\u6B6E\u7075\u7D7E\u8285\u979B\u9FA0\uA2A3\uA8A9" + - "\uACAD\uAEB0\uB8B9\uBDBE\uC3C4\uC9CC\uDAE1\uE3E6\uE7EE\uF1F7\uF9FF\u0000\u0020\u6C02\u0405\u090D" + - "\u0E10\u1219\u1F26\u2728\u2C2E\u3335\u363A\u3B4A\u4B4D\u4F52\u5459\u5B67\u6B6D\u7476\u7879\u7B85" + - "\u8789\u9495\u9798\u9C9F\uB0B2\uB4C2\uC6CD\uCFD0\uD1D2\uD4D6\uDCE0\uE7E9\uEBEC\uEEF2\u6CF4\u0000" + - "\u0013\u6D07\u0A0E\u0F11\u131A\u2627\u282E\u2F31\u393C\u3F57\u5E5F\u6165\u6770\u7C82\u9192\u9497" + - "\u98AA\uB4B7\uB9BD\uBFC4\uC8CA\uFFFF\u0042\uFFFD\u0000\u0006\u6DCE\uD6DB\uDDDF\uE0E2\uE5E9\uEFF0" + - "\uF4F6\u0000\u0019\u6E00\u041E\u2232\u363B\u4445\u4849\u4B4F\u5152\u5354\u575D\u5E62\u6368\u737B" + - "\u7D8D\u9399\uA0A7\uADAE\uB1B3\uBBC0\uC1C3\uC7C8\uCACD\uCECF\uEBED\uEEF9\uFBFD\u0000\u0021\u6F04" + - "\u080A\u0C0D\u1618\u1A1B\u2629\u2A2D\u2F30\u3336\u3B3C\u4F51\u5253\u5759\u5A5D\u5E61\u6268\u6C7D" + - "\u7E83\u878B\u8C8D\u9092\u9394\u969A\u9FA0\uA5A6\uA7A8\uAEAF\uB0B6\uBCC5\uC7C8\uCADA\uDEE8\uE9F0" + - "\uF9FC\u6FFD\u0000\u0019\u7000\u060D\u1720\u232F\u3437\u393C\u4344\u4849\u4A4B\u4E54\u555D\u5E64" + - "\u656C\u6E75\u767E\u8186\u9495\u9697\u989B\uA4B0\uB1B4\uB7CA\uD1D3\uD4D5\uD6D8\uDCE4\u70FA\u7103" + - "\u7105\u7106\u7107\u710B\u710C\uFFFF\u0042\uFFFD\u0000\u0016\u711E\u202B\u2D2F\u3031\u3841\u454A" + - "\u4B50\u5257\u5A5E\u6068\u7980\u8587\u8C92\u9A9B\uA0A2\uAFB0\uB2B3\uBABF\uC0C4\uCBCC\uD3D6\uD9DA" + - "\uDCF8\u0000\u001F\u7200\u0708\u0913\u171A\u1D1F\u242B\u2F34\u3839\u4142\u4345\u4E4F\u5053\u5556" + - "\u5A5C\u5E60\u6368\u6B6E\u6F71\u7778\u7B7C\u7F84\u898D\u8E93\u9BA8\uADAE\uB4C1\uC7C9\uCCD5\uD6D8" + - "\uDFE5\uF3F4\uFAFB\u72FE\u0000\u0028\u7302\u0405\u070B\u0D12\u1318\u191E\u2227\u282C\u3132\u353A" + - "\u3B3D\u434D\u5052\u5658\u5D5E\u5F60\u6667\u696B\u6C6E\u6F71\u797C\u8081\u8385\u868E\u9093\u9597" + - "\u989C\u9E9F\uA0A2\uA5A6\uAAAB\uADB5\uB7B9\uBCBF\uC5C6\uCBCC\uCFD3\uD9DD\uE1E6\uE7E9\uF4F7\uFFFF" + - "\u0042\uFFFD\u73F9\u73FA\u73FB\u73FD\u73FF\u0000\u0029\u7400\u0104\u0A11\u1A1B\u2428\u2B2C\u2D2F" + - "\u3031\u3940\u4344\u4647\u4B4D\u5152\u575D\u6667\u686B\u6D6E\u7172\u8081\u8586\u878F\u9091\u9298" + - "\u999A\u9CA0\uA1A3\uA6A8\uA9AA\uABAE\uAFB1\uB2B5\uB9BB\uBFC8\uC9CC\uD0D3\uD8DA\uDBDE\uDFE4\uE8EA" + - "\uEBEF\uF4FA\uFBFC\u74FF\u0000\u0020\u7506\u1216\u1720\u2124\u2729\u2A36\u393D\u3E3F\u4043\u4748" + - "\u4E50\u5257\u5E5F\u6171\u797A\u7B7C\u7D7E\u8185\u9092\u9395\u999C\uA2A4\uB4BA\uBFC0\uC1C4\uC6CC" + - "\uCECF\uD7DC\uDFE0\uE1E4\uE7EC\uEEEF\uF1F9\u0000\u0011\u7600\u0203\u0407\u080A\u0C0F\u1213\u1516" + - "\u191B\u1C1D\u1E23\u2526\u292D\u3233\u3538\u393A\u3C40\u4143\u4445\u7649\uFFFF\u0042\uFFFD\u0000" + - "\u0016\u764A\u4B55\u595F\u6465\u6D6E\u6F71\u7481\u858C\u8D95\u9D9F\uA0A2\uA3A4\uA5A7\uA8AA\uADBD" + - "\uC1C5\uC9CB\uCCCE\uD4D9\uE0E6\uE8EC\uF0F1\uF6F9\u76FC\u0000\u0028\u7700\u060A\u0E12\u1415\u1719" + - "\u1A1C\u2228\u2D2E\u2F34\u3536\u393D\u3E42\u454A\u4D4E\u4F52\u5657\u5C5E\u5F60\u6264\u676A\u6C70" + - "\u7273\u747A\u7D80\u848C\u8D94\u9596\u9A9F\uA2A7\uAAAE\uAFB1\uB5BE\uC3C9\uD1D2\uD5D9\uDEDF\uE0E4" + - "\uE6EA\uECF0\uF1F4\uF8FB\u0000\u001F\u7805\u0609\u0D0E\u111D\u2223\u2D2E\u3035\u3743\u4447\u484C" + - "\u525C\u5E60\u6163\u686A\u6E7E\u8A8F\u9498\u9D9E\u9FA1\uA4A8\uACAD\uB0B1\uB2B3\uBBBD\uBFC7\uC8C9" + - "\uCCCE\uD2D3\uD5D6\uDBDF\uE0E1\uE4E6\uFFFF\u0042\uFFFD\u0000\u0003\u78EA\uF2F3\uF6F7\uFAFB\u78FF" + - "\u0000\u0025\u7900\u060C\u101A\u1C1E\u1F20\u2527\u292D\u3134\u353B\u3D3F\u4445\u464A\u4B4F\u5154" + - "\u585B\u5C67\u696B\u7279\u7B7C\u7E8B\u8C91\u9395\u9698\u9CA1\uA8A9\uABAF\uB1B4\uB8BB\uC2C4\uC7C8" + - "\uCACF\uD4D6\uDADD\uDEE0\uE2E5\uEAEB\uEDF1\uF8FC\u0000\u0023\u7A02\u0307\u090A\u0C11\u151B\u1E21" + - "\u272B\u2D2F\u3034\u3538\u393A\u4445\u4748\u4C55\u5659\u5C5D\u5F60\u6567\u6A6D\u7578\u7E80\u8285" + - "\u868A\u8B90\u9194\u9EA0\uA3AC\uB3B5\uB9BB\uBCC6\uC9CC\uCEDB\uE8E9\uECF1\uF4FB\uFDFE\u0000\u0011" + - "\u7B07\u141F\u2327\u292A\u2B2D\u2E2F\u3031\u343D\u3F40\u4147\u4E55\u6064\u6669\u6A6D\u6F72\u7377" + - "\u8489\u8E90\u7B91\uFFFF\u0042\uFFFD\u0000\u0010\u7B96\u9BA0\uA5AC\uAFB0\uB2B5\uB6BA\uBBBC\uBDC2" + - "\uC5C8\uCAD4\uD6D7\uD9DA\uDBE8\uEAF2\uF4F5\uF8F9\uFAFC\u7BFE\uFFFE\u0004\u7C01\u0000\u0024\u7C06" + - "\u090B\u0C0E\u0F19\u1B20\u2526\u282C\u3133\u3436\u393A\u464A\u5152\u5355\u595A\u5B5C\u5D5E\u6163" + - "\u6769\u6D6E\u7072\u797C\u7D86\u878F\u949E\uA0A6\uB0B6\uB7BA\uBBBC\uBFC4\uC7C8\uC9CD\uCFD3\uD4D5" + - "\uD7D9\uDADD\uE6E9\uEBF5\u0000\u0026\u7D03\u0708\u090F\u1112\u1316\u1D1E\u2326\u2A2D\u313C\u3D3E" + - "\u4041\u474D\u5153\u5759\u5A5D\u6567\u6A70\u787A\u7B7F\u8182\u8385\u8688\u8B8C\u8D91\u9697\u9D9E" + - "\uA6A7\uAAB3\uB6B9\uC2C3\uC4C5\uC6CC\uCDCE\uD7D9\uE2E5\uE6EA\uEBED\uF1F5\uF6F9\u7DFA\u7E00\uFFFF" + - "\u0042\uFFFD\u0000\u0014\u7E08\u1011\u1517\u1C1D\u2027\u282C\u2D2F\u3336\u3F44\u4547\u4E50\u585F" + - "\u6162\u656B\u6E6F\u7378\u7E81\u8687\u8D91\u9598\u9A9D\u7E9E\uFFFE\u0005\u7F3B\u0000\u0019\u7F43" + - "\u444F\u5253\u5B5C\u5D61\u6364\u6566\u6D71\u7D7E\u7F80\u8B8D\u8F90\u9196\u979C\uA2A6\uAAAD\uB4BC" + - "\uBFC0\uC3C8\uCECF\uDBDF\uE3E5\uE8EC\uEEEF\uF2FA\uFDFE\u7FFF\u0000\u001E\u8007\u080A\u0D0E\u0F11" + - "\u1314\u161D\u1E1F\u2024\u262C\u2E30\u3435\u3739\u3A3C\u3E40\u4460\u6466\u6D71\u7581\u888E\u9C9E" + - "\uA6A7\uABB8\uB9C8\uCDCF\uD2D4\uD5D7\uD8E0\uEDEE\uF0F2\uF3F6\uF9FA\u80FE\u0000\u000E\u8103\u0B16" + - "\u1718\u1C1E\u2024\u272C\u3035\u3A3C\u4547\u4A4C\u5257\u6061\u6768\u696D\u6F77\uFFFF\u0042\uFFFD" + - "\u0000\u0013\u8181\u8485\u868B\u8E90\u9698\u9B9E\uA2AE\uB2B4\uBBC3\uC5CA\uCBCE\uCFD5\uD7DB\uDDDE" + - "\uE1E4\uEBEC\uF0F1\uF2F5\uF6F8\uF9FD\u81FF\u0000\u0026\u8200\u030F\u1314\u191A\u1D21\u2228\u3234" + - "\u3A43\u4445\u464B\u4E4F\u5156\u5C60\u6367\u6D74\u7B7D\u7F80\u8183\u8487\u898A\u8E91\u9496\u989A" + - "\u9BA0\uA1A3\uA4A7\uA8A9\uAAAE\uB0B2\uB4B7\uBABC\uBEBF\uC6D0\uD5DA\uE0E2\uE4E8\uEAED\uEFF6\uF7FD" + - "\u82FE\u0000\u0021\u8300\u0708\u0A0B\u1B1D\u1E1F\u2122\u2C2D\u2E30\u3337\u3A3C\u3D42\u4344\u474D" + - "\u4E51\u5354\u5556\u5770\u787D\u8082\u8486\u8D92\u9495\u9899\u9B9C\u9DA6\uA7A9\uACAD\uBEBF\uC0C9" + - "\uCFD0\uD1D4\uDDE8\uEAF8\uF9FC\u8401\u8406\u840A\u840F\u8411\uFFFF\u0042\uFFFD\u0000\u001D\u8415" + - "\u192F\u3945\u474A\u4D4F\u5152\u5658\u595A\u5C60\u6465\u676A\u7073\u7476\u787C\u7D81\u8592\u9395" + - "\u9EA6\uA8A9\uAAAF\uB1BA\uBDBE\uC0C2\uC7C8\uCCCF\uD3E7\uEAEF\uF0F1\uF2F7\uFAFB\u84FD\u0000\r" + - "\u8502\u0307\u0C0E\u101C\u1E22\u2324\u2527\u2A2B\u2F32\u3334\u363F\u464F\u5051\u5256\uFFFE\u0007" + - "\u855C\u0000\u0017\u8564\u6F79\u7A7B\u7D7F\u8185\u8689\u8B8C\u8F93\u989D\u9FA0\uA2A5\uA7AD\uB4B6" + - "\uB7B8\uBCBD\uBEBF\uC2C7\uCACB\uCED8\uDADF\uE0E6\uE8ED\uF3F6\uFCFF\u0000\u0018\u8600\u0405\u0D0E" + - "\u1011\u1218\u191B\u1E21\u2729\u3638\u3A3C\u3D40\u4142\u4652\u5356\u5758\u595D\u6061\u6263\u6469" + - "\u6C6F\u7576\u777A\u888D\u9196\u989A\uFFFF\u0042\uFFFD\u0000\u000F\u869C\uA1A6\uA7A8\uADB1\uB3B4" + - "\uB5B7\uB8B9\uBFC0\uC1C3\uC5D1\uD2D5\uD7DA\uDCE0\uE3E5\uE7FA\uFCFD\u0000\u0012\u8704\u0507\u0B0E" + - "\u0F10\u1314\u191E\u1F21\u2328\u2E2F\u3132\u393A\u3C3D\u3E40\u4345\u4D58\u5D61\u6465\u6F71\u727B" + - "\uFFFE\u0007\u8783\u0000\u0014\u878B\u8C90\u9395\u9798\u999E\uA0A3\uA7AC\uADAE\uB1B5\uBEBF\uC1C8" + - "\uC9CA\uCED5\uD6D9\uDADC\uDFE2\uE3E4\uEAEB\uEDF1\uF3F8\uFAFF\u0000\u0024\u8801\u0306\u090A\u0B10" + - "\u1213\u1418\u191A\u1B1C\u1E1F\u282D\u2E30\u3235\u3A3C\u4143\u4548\u494A\u4B4E\u5155\u5658\u5A5C" + - "\u5F60\u6469\u7179\u7B80\u989A\u9B9C\u9FA0\uA8AA\uBABD\uBEC0\uCACB\uCCCD\uCED1\uD2D3\uDBDE\uE7EF" + - "\uF0F1\u88F7\uFFFF\u0042\uFFFD\u0000\u0025\u8901\u060D\u0E0F\u1516\u1819\u1A20\u2627\u2830\u3132" + - "\u3539\u3A3E\u4042\u4546\u494F\u5257\u5A5B\u5C61\u6263\u6B6E\u7073\u757A\u7B7C\u7D89\u8D90\u9495" + - "\u9B9C\u9FA0\uA5B0\uB4B5\uB6B7\uBCD4\uD5D6\uD7D8\uE5E9\uEBED\uF1F3\uF6F9\uFDFF\u0000\u0025\u8A04" + - "\u0507\u0F11\u1415\u1E20\u2224\u262B\u2C2F\u353D\u3E40\u4345\u4749\u4D4E\u5356\u5758\u5C5D\u6165" + - "\u6775\u7677\u7A7B\u7E7F\u8083\u868B\u8F90\u9296\u9799\u9FA9\uAEAF\uB3B6\uB7BB\uC3C6\uC8C9\uCAD1" + - "\uD3D4\uD5D7\uDDEC\uF0F4\uF5FC\u8AFF\u0000\u0013\u8B05\u060A\u0B11\u1C1E\u1F2D\u3037\u3C42\u4344" + - "\u4546\u484D\u5254\u595E\u636D\u7678\u797C\u7E81\u8485\u8B8D\u8F94\u959C\uFFFF\u0042\uFFFD\u8B9E" + - "\u8B9F\u0000\u001D\u8C38\u393D\u3E45\u4749\u4B4F\u5153\u5457\u5859\u5B5D\u6364\u6668\u696D\u7375" + - "\u767B\u7E86\u878B\u9092\u9399\u9B9C\uA4B9\uBAC5\uC6C9\uCBCF\uD5D6\uD9DD\uE1E8\uECEF\uF2F5\uF7F8" + - "\uFEFF\u0000\u0019\u8D01\u0309\u171B\u6569\u6C6E\u7F82\u8488\u8D90\u9195\u9E9F\uA0A6\uABAC\uAFB2" + - "\uB5B7\uB9BB\uBCC0\uC5C6\uC7C8\uCACE\uD1D4\uD5D7\uD9E4\uE5E7\uECF0\uF1F2\uF4FD\u0000\u0026\u8E01" + - "\u0405\u060B\u1114\u1620\u2122\u2326\u2731\u3336\u3738\u393D\u4041\u4B4D\u4E4F\u545B\u5C5D\u5E61" + - "\u6269\u6C6D\u6F70\u7179\u7A7B\u8283\u8990\u9295\u9A9B\u9D9E\uA2A7\uA9AD\uAEB3\uB5BA\uBBC0\uC1C3" + - "\uC4C7\uD1D4\uDCE8\uEDEE\uF0F1\uF7F9\u8EFA\uFFFF\u0042\uFFFD\u0000\u0021\u8F00\u0207\u080F\u1016" + - "\u1718\u1E20\u2123\u2527\u282C\u2D2E\u3435\u3637\u3A40\u4143\u474F\u5152\u5354\u5558\u5D5E\u659D" + - "\uA0A1\uA4A5\uA6B5\uB6B8\uBEC0\uC1C6\uCACB\uCDD0\uD2D3\uD5E0\uE3E4\uE8EE\uF1F5\uF6FB\u8FFE\u0000" + - "\u0023\u9002\u0408\u0C18\u1B28\u292A\u2C2D\u2F33\u3437\u3F43\u444C\u5B5D\u6266\u6C70\u7479\u8588" + - "\u8B8C\u8E90\u9597\u9899\u9BA0\uA1A2\uA5B0\uB2B3\uB4B6\uBDBE\uC3C4\uC5C7\uC8CC\uD2D5\uD7D8\uD9DC" + - "\uDDDF\uE5EB\uEFF0\uF4F6\uFEFF\u0000\u0019\u9100\u0405\u0608\u0D10\u1416\u1718\u1A1C\u1E20\u2223" + - "\u2529\u2E2F\u3134\u3637\u393A\u3C3D\u4347\u484F\u5357\u595A\u5B61\u6467\u6D74\u797A\u7B81\u8385" + - "\u868A\uFFFF\u0042\uFFFD\u0000\u0012\u918E\u9193\u9495\u989E\uA1A6\uA8AC\uADAE\uB0B1\uB2B3\uB6BB" + - "\uBCBD\uBFC2\uC3C5\uD3D4\uD9E9\uEAEC\uEFF0\uF1F7\uF9FB\u91FD\u0000\u002F\u9200\u0104\u0507\u090C" + - "\u1213\u1618\u1C1D\u2324\u2526\u282E\u2F30\u3335\u3638\u3E42\u4346\u474A\u4D4F\u585C\u5D60\u6165" + - "\u6869\u6E6F\u7075\u7679\u7B7C\u7D7F\u898A\u8D8E\u9297\u999F\uA0A4\uA5A8\uABAF\uB2B6\uB8BA\uBBBC" + - "\uBDBF\uC0C1\uC2C3\uC5C6\uC7C8\uCBCC\uCDCE\uD8DC\uDDDF\uE1E3\uE5E8\uECEE\u92F0\u0000\u001B\u9300" + - "\u080D\u1114\u151C\u1F24\u2729\u2A33\u3436\u3747\u4950\u5152\u5558\u5A5E\u6465\u6769\u6A6D\u6F71" + - "\u7374\u767A\u7D7F\u8081\u8288\u8A8B\u8D8F\u9295\u989B\u9EA1\uA3A6\u93A8\uFFFF\u0042\uFFFD\u0000" + - "\r\u93A9\uABB4\uB5B6\uBAC1\uC4C5\uC7C9\uCACB\uCCCD\uD3D9\uDCDF\uE2E6\uE7F7\uF9FA\uFBFD\u0000" + - "\u0012\u9401\u0204\u0809\u0D0E\u0F15\u1617\u1F2E\u2F32\u3334\u3B3D\u3F43\u4A4C\u5559\u5C5F\u6163" + - "\u686B\u6D6E\u6F71\u7283\u9484\u0000\u0012\u9578\u797E\u8488\u8C8D\u8E9D\u9E9F\uA1A6\uA9AB\uACB4" + - "\uB6BA\uBDBF\uC6C8\uC9CB\uD0D1\uD2D3\uD9DA\uDDDE\uDFE0\uE4E6\u0000\u001B\u961D\u1E22\u2425\u262C" + - "\u3133\u3738\u393A\u3C3D\u4152\u5456\u5758\u616E\u747B\u7C7E\u7F81\u8283\u8489\u9196\u9A9F\uA4A5" + - "\uA6A9\uAEB3\uBACA\uD2D8\uDADD\uDEDF\uE9EF\uF1FA\u0000\u0010\u9702\u0305\u091A\u1B1D\u2122\u2328" + - "\u3141\u4A4E\u5758\u5A5B\u6367\u6A6E\u7376\u7778\u7B7D\u7F80\u8995\uFFFF\u0042\uFFFD\u0000\u0016" + - "\u9796\u9799\u9A9E\u9FA2\uACAE\uB1B2\uB5B6\uB8B9\uBABC\uBEBF\uC1C4\uC5C7\uC9CA\uCCCD\uCED0\uD1D4" + - "\uD7D8\uD9DB\uDDDE\uE0E1\uE4EF\uF1F4\uF7F8\u97FA\u0000\u001C\u9807\u0A0D\u0E14\u1619\u1C1E\u2023" + - "\u2526\u2B2E\u2F30\u3233\u353E\u4447\u4A51\u5253\u5659\u5A62\u6366\u6A6C\uABAD\uAEB0\uB4B7\uB8BA" + - "\uBBBF\uC2C5\uC8CC\uE1E3\uE5E6\uE7EA\uF3F6\u0000\u0021\u9902\u0708\u1115\u1617\u1A1B\u1C1F\u2226" + - "\u2B31\u3233\u3435\u393A\u3B3C\u4041\u4647\u484D\u4E54\u5859\u5B5C\u5E5F\u609B\u9D9F\uA6B0\uB1B2" + - "\uB5B9\uBABD\uBFC3\uC9D3\uD4D9\uDADC\uDEE7\uEAEB\uECF0\uF4F5\uF9FD\u99FE\u0000\t\u9A02\u0304" + - "\u0B0C\u1011\u161E\u2022\u2324\u272D\u2E33\u3536\uFFFF\u0042\uFFFD\u0000\u0016\u9A38\u4144\u474A" + - "\u4B4C\u5154\u565D\uAAAC\uAEAF\uB2B4\uB5B6\uB9BB\uBEBF\uC1C3\uC6C8\uCED0\uD2D5\uD6D7\uDBE0\uE4E5" + - "\uE7E9\uECF2\uF3F5\uF9FA\u9AFD\uFFFE\u0007\u9AFF\u0000\u002D\u9B08\u090B\u0C0D\u0E10\u1216\u191B" + - "\u1C20\u262B\u2D33\u3435\u3739\u3A3D\u484B\u4C55\u5657\u5B5E\u6163\u6566\u686A\u6B6C\u6D6E\u7377" + - "\u7879\u7F80\u8485\u8687\u898A\u8B8D\u9094\u9A9D\u9EA6\uA7A9\uACB0\uB2B7\uB8BC\uBEBF\uC1C7\uC8CE" + - "\uD0D7\uD8DD\uDFE5\uE7EA\uEBEF\uF3F7\uF8F9\uFAFD\u9BFF\u0000\u0016\u9C02\u0B0F\u1116\u1819\u1A1C" + - "\u1E22\u2326\u2728\u292A\u3135\u3637\u3D41\u4344\u4549\u4A4E\u4F50\u5354\u5658\u5B5C\u5D5E\u5F63" + - "\u6869\u6A6B\uFFFF\u0042\uFFFD\u0000\u0004\u9C6E\u7072\u7577\u7BE6\uF2F7\u9CF9\u0000\u0025\u9D02" + - "\u0B11\u1718\u1C1D\u1E2F\u3032\u3334\u3A3C\u3D42\u4345\u474A\u5354\u5F62\u6365\u696A\u7677\u7B7C" + - "\u7E83\u8486\u8A8D\u8E92\u9395\u9697\u98A1\uAAAC\uAEB1\uB5B9\uBCBF\uC3C7\uC9CA\uD4D5\uD6D7\uDADE" + - "\uDFE0\uE5E7\uE9EB\uEEF0\uF3F4\u9DFE\u0000\u0019\u9E02\u070A\u0E10\u1112\u1516\u1C1D\u7A7B\u7C80" + - "\u8283\u8485\u878E\u8F96\u989B\u9EA4\uA8AC\uAEAF\uB0B3\uB4B5\uC6C8\uCBD5\uDFE4\uE7EC\uEDEE\uF0F1" + - "\uF2F5\uF8FF\u0000\u001A\u9F02\u0309\u0F10\u1112\u1416\u1719\u1A1B\u1F22\u262A\u2B2F\u3132\u3437" + - "\u393A\u3C3D\u3F41\u4344\u4546\u4753\u5556\u5758\u5A5D\u5E68\u696D\u6E6F\u7071\u7375\u7A7D\uFFFF" + - "\u0042\uFFFD\uFFFE\u0004\u9F8F\u0000\u0003\u9F94\u9697\u9EA1\uA2A3\u9FA5\uFFFF\u00F4\uFFFD\u0000" + - "\u0005\u00A0\uA1A4\uA9AA\uABAD\uAEAF\uB2B3\u00B5\uFFFE\u0020\u00B7\uFFFE\u001F\u00D8\uFFFE\b" + - "\u00F8\uFFFF\u0024\uFFFD\uFFFE\u0047\u0100\uFFFF\u0042\uFFFD\uFFFE\u0039\u0147\u0192\u01C2\uFFFE" + - "\u0010\u01CD\u0000\u0003\u01F5\uFAFB\uFCFD\uFEFF\uFFFF\u00F9\uFFFD\uFFFE\u0059\u0250\uFFFF\u0007" + - "\uFFFD\uFFFE\u0004\u02C6\u02CC\u02CD\uFFFE\u0007\u02D0\uFFFE\u0006\u02D8\uFFFF\u0042\uFFFD\u02DE" + - "\uFFFE\u0005\u02E5\uFFFF\u0037\uFFFD\u0374\u0375\u037A\u037E\uFFFE\u0007\u0384\u038C\u038E\u038F" + - "\u0390\uFFFE\u0007\u03AA\u03C2\uFFFE\u0005\u03CA\uFFFF\u0044\uFFFD\uFFFE\u000B\u0402\u040E\u040F" + - "\uFFFE\u000B\u0452\uFFFE\t\u045E\uFFFF\u0042\uFFFD\uFFFE\u0020\u0467\uFFFE\u0035\u0490\u04C7" + - "\u04C8\u04CB\u04CC\uFFFE\u001C\u04D0\uFFFE\b\u04EE\u04F8\u04F9\uFFFF\u001E\uFFFD\u0000\u0006" + - "\u1E3E\u3F80\u8182\u8384\u85BE\uBFC0\uC1F2\u1EF3\uFFFF\u0176\uFFFD\u1F72\uFFFF\u0141\uFFFD\uFFFE" + - "\u0010\u2000\u0000\u0005\u2011\u1213\u1517\u1A1B\u1E1F\u2223\u2024\uFFFE\b\u2027\u2031\uFFFE" + - "\u0007\u2034\u203C\u203D\uFFFE\b\u203F\uFFFF\u006D\uFFFD\u2070\uFFFE\u001B\u2074\uFFFF\u0014" + - "\uFFFD\uFFFE\u000B\u20A0\uFFFF\u0025\uFFFD\u2100\u2101\u2102\uFFFE\u0012\u2104\uFFFE\n\u2117" + - "\uFFFE\t\u2122\uFFFE\r\u212C\uFFFF\u0017\uFFFD\uFFFE\f\u2153\uFFFF\u0042\uFFFD\u0000" + - "\u0003\u215F\u6A6B\u6C6D\u6E6F\uFFFE\t\u217A\uFFFF\u0010\uFFFD\uFFFE\u003E\u2194\u21D3\uFFFE" + - "\u0016\u21D5\uFFFF\u0015\uFFFD\u0000\u0005\u2201\u0405\u0609\u0A0C\u0D0E\u0F10\u2211\uFFFE\u0007" + - "\u2213\u0000\u0004\u221B\u1C1F\u2122\u2324\u2526\uFFFE\u0007\u222D\uFFFE\u0007\u2236\uFFFE\n" + - "\u223E\uFFFF\u0042\uFFFD\uFFFE\n\u2248\uFFFE\r\u2253\uFFFE\u0004\u2262\u2268\u2269\uFFFE" + - "\u0016\u226C\u2284\u2285\uFFFE\u001D\u2288\uFFFE\u004C\u22A6\uFFFF\u000E\uFFFD\u0000\u0003\u2302" + - "\u0506\u1018\u2021\u232C\uFFFF\u017B\uFFFD\uFFFE\u008B\u2460\uFFFF\u0057\uFFFD\uFFFE\b\u2504" + - "\u0000\r\u250D\u0E11\u1215\u1619\u1A1E\u1F21\u2226\u2729\u2A2D\u2E31\u3235\u3639\u3A3D\u3E40" + - "\u2541\uFFFE\b\u2543\uFFFE\u004A\u254C\uFFFF\n\uFFFD\uFFFE\u0010\u25A2\uFFFE\b\u25B4" + - "\uFFFE\b\u25BE\u25C8\u25C9\u25CA\u25CC\u25CD\uFFFE\b\u25D0\uFFFF\u0042\uFFFD\uFFFE\u0017" + - "\u25D8\uFFFF\u0010\uFFFD\uFFFE\u0005\u2600\uFFFE\r\u2607\uFFFE\u0026\u261A\u2641\uFFFE\'" + - "\u2643\u266B\u266C\u266E\uFFFF\u00D8\uFFFD\uFFFE\u0004\u2701\uFFFE\u0004\u2706\uFFFE\u001C\u270C" + - "\uFFFE\u0023\u2729\u274D\uFFFE\u0004\u274F\u2756\uFFFE\u0007\u2758\uFFFE\u0007\u2761\u2776\uFFFF" + - "\u0042\uFFFD\uFFFE\u001E\u2777\uFFFE\u0018\u2798\uFFFE\u000E\u27B1\uFFFF\u0020\uFFFD\u0000\u0005" + - "\u3004\u1617\u1819\u1A1B\u1D1E\u1F20\uFFFE\b\u3030\uFFFF\u0017\uFFFD\u3094\uFFFF\b\uFFFD" + - "\uFFFE\u0004\u30F7\uFFFD\uFFFD\uFFFE\u0011\u3220\uFFFE\u0010\u3232\uFFFF\u0042\uFFFD\u3242\u3243" + - "\uFFFE\u0031\u3280\uFFFE\f\u32C0\uFFFE\u002F\u32D0\uFFFF\u00B2\uFFFD\uFFFE\u0077\u3300\uFFFE" + - "\'\u337B\uFFFF\u0042\uFFFD\uFFFE\u003C\u33A2\uFFFE\u001F\u33E0\uFFFF\u0007\uFFFD\uFB01\uFB02" + - "\uFFFF\u004E\uFFFD\uFF0D\uFF5E\uFFE4\uFFFF\u160A\uFFFD"; - - - private static final String fromUnicode_ = - "\uFFFF\u00A0\uFEFE\uD641\uD642\uFEFE\uFEFE\uD643\uFEFE\u426A\u446A\u4460\uD644\uD645\uD646\uFEFE" + - "\uD647\uD648\uD649\u44ED\u444B\uD64A\uD64B\u4450\uD64C\u4379\uFFFE\u0020\uD64D\u447A\uFFFE\u001F" + - "\uD66D\u447B\uFFFE\b\uD68C\uFFFE\u0047\uD6B8\uFFFE\u0039\uD741\uFFFF\u0012\uFEFE\uD77A\uFFFF" + - "\u002F\uFEFE\uD77B\uFFFF\n\uFEFE\uFFFE\u0010\uD77C\uFFFF\u0018\uFEFE\uD78C\uFFFF\u0004\uFEFE" + - "\uFFFE\u0006\uD78D\uFFFF\u0050\uFEFE\uFFFE\u0059\uD88C\uFFFF\u001D\uFEFE\uFFFE\u0004\uD8EC\uFEFE" + - "\uFEFE\uD8F0\uD8F1\uFEFE\uFEFE\uFFFE\u0007\uD8F2\uFEFE\uFFFE\u0006\uD8F9\uD941\uFFFF\u0006\uFEFE" + - "\uFFFE\u0005\uD942\uFFFF\u008A\uFEFE\uD97E\uD97F\uFFFF\u0004\uFEFE\uD980\uFEFE\uFEFE\uFEFE\uD981" + - "\uFFFF\u0005\uFEFE\uFFFE\u0007\uD982\uFEFE\uD989\uFEFE\uD98A\uD98B\uD98C\uFFFE\u0011\u4161\uFEFE" + - "\uFFFE\u0007\u4172\uFFFE\u0007\uD98D\uFFFE\u0011\u4141\uD994\uFFFE\u0007\u4152\uFFFE\u0005\uD995" + - "\uFFFF\u0032\uFEFE\u41C6\uFFFE\u000B\uD9DE\uFEFE\uD9E9\uD9EA\uFFFE\u0006\u41C0\uFFFE\u001A\u41C7" + - "\uFFFE\u0006\u4180\uFFFE\u001A\u4187\uFEFE\u4186\uFFFE\u000B\uD9EB\uFEFE\uFFFE\t\uD9F6\uFFFE" + - "\u0020\uDA41\uFFFF\t\uFEFE\uFFFE\u0035\uDA61\uFEFE\uFEFE\uDA96\uDA97\uFEFE\uFEFE\uDA98\uDA99" + - "\uFEFE\uFEFE\uFEFE\uFFFE\u001C\uDA9A\uFEFE\uFEFE\uFFFE\b\uDAB6\uFEFE\uFEFE\uDABE\uDABF\uFFFF" + - "\u1944\uFEFE\uDADE\uDADF\uFFFF\u0040\uFEFE\uFFFE\u0006\uDAE0\uFFFF\u0038\uFEFE\uFFFE\u0004\uDAE6" + - "\uFFFF\u0030\uFEFE\uDAEA\uDAEB\uFFFF\u007E\uFEFE\uDC62\uFFFF\u008D\uFEFE\uFFFE\u0010\uDDA4\u445A" + - "\uDDB4\uDDB5\uDDB6\u444A\u444A\u447C\uDDB8\u4461\u4471\uDDB9\uDDBA\u4462\u4472\uDDBB\uDDBC\u4377" + - "\u4378\uDDBD\uDDBE\uDDBF\u447E\u447F\uFFFE\b\uDDC0\uFEFE\u4373\uDDC8\u44EE\u44EF\uFFFE\u0007" + - "\uDDC9\u446B\uDDD0\uDDD1\uFEFE\uFFFE\b\uDDD2\uFFFF\u0029\uFEFE\uDE47\uFEFE\uFEFE\uFEFE\uFFFE" + - "\u001B\uDE48\uFFFF\u0011\uFEFE\uFFFE\u000B\uDE77\uFEFE\u42E1\uFFFF\u0053\uFEFE\uDEA7\uDEA8\uDEA9" + - "\u444E\uFFFE\u0012\uDEAA\u446E\uFFFE\n\uDEBC\u446F\uFFFE\t\uDEC6\u4372\uFFFE\r\uDECF" + - "\uFFFF\u001A\uFEFE\uFFFE\f\uDEF3\uDF41\uFFFE\n\u41F1\uFFFE\u0006\uDF42\uFFFE\n\u41B1" + - "\uFFFE\t\uDF48\uFFFF\r\uFEFE\u44F1\u44F2\u44F0\u44F3\uFFFE\u003E\uDF61\u436E\uDF9F\u436F" + - "\uFFFE\u0016\uDFA0\uFFFF\u0015\uFEFE\u4370\uDFCB\u434E\u4371\uDFCC\uDFCD\uDFCE\u434F\u4364\uDFCF" + - "\uDFD0\u4365\uFFFE\u0006\uDFD1\u4260\uFFFE\u0007\uDFD7\u435F\uDFDE\uDFDF\u4361\u444D\uDFE0\u434B" + - "\uFFFE\u0004\uDFE1\u447C\uDFE6\u436C\u436D\u436B\u436A\u4362\u4363\uFFFE\u0007\uDFE7\u4468\u4478" + - "\uFFFE\u0007\uDFEE\u4360\uFFFE\n\uDFF5\uFFFE\n\uE041\u435C\uFFFE\r\uE04B\u444C\u435B" + - "\uFFFE\u0004\uE058\u4467\u4477\uE05C\uE05D\u435D\u435E\uFFFE\u0016\uE05E\u4368\u4369\uE074\uE075" + - "\u4366\u4367\uFFFE\u001D\uE076\u434C\uFFFE\u004C\uE093\uFFFF\u0010\uFEFE\uE0ED\uFEFE\uFEFE\uE0EE" + - "\uE0EF\uFFFF\t\uFEFE\uE0F0\uFEFE\u434D\uFFFF\u0005\uFEFE\uE0F1\uFFFF\u0007\uFEFE\uE0F2\uE0F3" + - "\uFFFF\n\uFEFE\uE0F4\uFFFF\u0133\uFEFE\uFFFE\u008B\uE270\uFFFF\u0015\uFEFE\u437C\u43B7\u437D" + - "\u43B8\uFFFE\b\uE352\u437E\uE35A\uE35B\u43B9\u437F\uE35C\uE35D\u43E1\u43B1\uE35E\uE35F\u43E3" + - "\u43B0\uE360\uE361\u43E2\u43B2\u43EE\uE362\uE363\u43E9\uE364\uE365\u43E4\u43B4\u43F0\uE366\uE367" + - "\u43EB\uE368\uE369\u43E6\u43B3\uE36A\uE36B\u43EA\u43EF\uE36C\uE36D\u43E5\u43B5\uE36E\uE36F\u43EC" + - "\u43F1\uE370\uE371\u43E7\u43B6\uE372\uE373\u43ED\uE374\uE375\u43F2\uFFFE\b\uE376\u43E8\uFFFE" + - "\u004A\uE37E\uFFFF\n\uFEFE\u44EA\u44E9\uFFFE\u0010\uE3D2\u44E3\u44E2\uFFFE\b\uE3E2\u44EC" + - "\u44EB\uFFFE\b\uE3EA\u44E8\u44E7\uE3F2\uE3F3\uE3F4\u44E0\uE3F5\uE3F6\u44E4\u44E1\uFFFE\b" + - "\uE3F7\uFFFE\u0017\uE441\u437A\uFFFF\u0010\uFEFE\uFFFE\u0005\uE468\u44E6\u44E5\uFFFE\r\uE46D" + - "\uFFFF\u0006\uFEFE\uFFFE\u0026\uE47A\u4479\uE4A0\u4469\uFFFE\'\uE4A1\u4376\uE4C8\uE4C9\u4375" + - "\uE4CA\u4374\uFFFF\u0091\uFEFE\uFFFE\u0004\uE5A3\uFEFE\uFFFE\u0004\uE5A7\uFEFE\uFEFE\uFFFE\u001C" + - "\uE5AB\uFEFE\uFFFE\u0023\uE5C7\uFEFE\uE5EA\uFEFE\uFFFE\u0004\uE5EB\uFEFE\uFEFE\uFEFE\uE5EF\uFEFE" + - "\uFFFE\u0007\uE5F0\uFEFE\uFEFE\uFFFE\u0007\uE5F7\uFFFF\u000E\uFEFE\uE5FE\uFFFE\u001E\uE641\uFEFE" + - "\uFEFE\uFEFE\uFFFE\u0018\uE65F\uFEFE\uFFFE\u000E\uE677\uFFFF\u0841\uFEFE\u4040\u4344\u4341\u445B" + - "\uE6A5\u0000\u0003\u445D\u5E5F\u6474\u6575\u4342\u4343\u0000\u0003\u4442\u4366\u766C\u7D63\u4473" + - "\uFFFE\u0006\uE6A6\u43A1\uFFFE\u0004\uE6AC\uFFFF\u000F\uFEFE\uFFFE\b\uE6B0\uFFFF\t\uFEFE" + - "\u0000\u0029\u4447\u8148\u8249\u8351\u8452\u8586\uC087\uC188\uC289\uC38A\uC48C\uC58D\uC68E\uC78F" + - "\uC890\uC991\uCA92\uCB56\u93CC\u94CD\u95CE\u9697\u9899\u9A9D\uCFD5\u9ED0\uD69F\uD1D7\uA2D2\uD8A3" + - "\uD3D9\uA4A5\uA6A7\uA853\uA954\uAA55\uACAD\uAEAF\uBABB\u57BC\uDADB\u46BD\uE6CF\uFFFF\u0006\uFEFE" + - "\u43BE\u43BF\u44DC\u44DD\uFEFE\uFEFE\u0000\u002A\u4347\u8148\u8249\u8351\u8452\u8586\uC087\uC188" + - "\uC289\uC38A\uC48C\uC58D\uC68E\uC78F\uC890\uC991\uCA92\uCB56\u93CC\u94CD\u95CE\u9697\u9899\u9A9D" + - "\uCFD5\u9ED0\uD69F\uD1D7\uA2D2\uD8A3\uD3D9\uA4A5\uA6A7\uA853\uA954\uAA55\uACAD\uAEAF\uBABB\u57BC" + - "\uDADB\u46BD\uD459\u435A\uFFFE\u0004\uE6D8\u4345\u4358\u43DC\u43DD\uFFFF\u0121\uFEFE\uFFFE\u0011" + - "\uE6DE\u446D\uFFFE\u0010\uE6EF\uE741\uE742\uFFFF\u003C\uFEFE\uFFFE\u0031\uE743\uFFFF\u000F\uFEFE" + - "\uFFFE\f\uE774\uFFFF\u0004\uFEFE\uFFFE\u002F\uE780\uFEFE\uFFFE\u0077\uE861\uFFFF\u0004\uFEFE" + - "\uFFFE\'\uE8D8\uFFFE\u003C\uE941\uFEFE\uFEFE\uFFFE\u001F\uE97D\uFFFF\u1A01\uFEFE\u4541\u4BCE" + - "\uB841\u4547\uB842\uB843\uFEFE\u454D\u49D3\u4543\u455E\u455F\uB844\u46AF\u4789\uFEFE\u5642\u4DEC" + - "\uB845\uFEFE\u4F97\u5643\u469B\u5775\u4D56\u50C5\uFFFF\u0004\uFEFE\u4F62\uB846\uFEFE\u4883\uFEFE" + - "\uB847\uB848\uFEFE\u487C\uFEFE\u5644\uFEFE\u5645\uB849\uFEFE\u455C\uB84A\uB84B\uB84C\u5646\u4CB8" + - "\uFEFE\uFEFE\uB84D\u5647\uFEFE\u467A\u48AB\uFEFE\u4762\u54C8\uFEFE\uFEFE\u5648\uB84E\uB84F\u5649" + - "\u4B9F\uB850\u458A\uFEFE\uB851\uFEFE\uFEFE\uFEFE\u45D8\uFEFE\u55A9\u54A5\u4F6C\uFEFE\uB852\uFEFE" + - "\uFEFE\uFEFE\u62D0\u564A\u4947\u564B\u4BBD\uB853\uFEFE\uB854\u4549\u4EB5\u4749\uFEFE\uFEFE\u564C" + - "\uB855\uFFFF\u0004\uFEFE\uB856\uB857\uFFFF\u0007\uFEFE\u4BBF\uFEFE\u4A98\uB858\uB859\uFEFE\uFEFE" + - "\uFEFE\uB85A\uFFFF\u0004\uFEFE\u4970\uB85B\u47C0\uFEFE\u564D\uFEFE\uFEFE\u564E\u4BB1\uFEFE\u47C2" + - "\u4896\u564F\u45CE\u4542\uB85C\u5650\uFEFE\uFEFE\u499D\u4B74\uFEFE\u4545\u456D\uB85D\uB85E\u4BE4" + - "\u50E8\uFEFE\u55DC\u4867\uB85F\u5652\u5167\u5653\u4CCE\u5654\uFEFE\u478E\u4F7F\u4FFA\uFEFE\u4BAC" + - "\uFEFE\uFEFE\u4B73\u4575\u4E52\u499C\uB860\u5655\uFEFE\uFEFE\u5656\uFEFE\uFEFE\u5657\uFEFE\uFEFE" + - "\uB861\u4593\uFFFF\u0005\uFEFE\u53D9\u4776\u565C\uB862\u565A\uFEFE\u565B\u5085\uFEFE\uFEFE\u45E0" + - "\u484B\uFEFE\u5659\u5658\u4BE5\uB863\uFEFE\uFEFE\uFEFE\u5465\u48B5\u4755\u565E\u475D\u48A2\uB864" + - "\uB865\uFEFE\u445C\u565F\u5661\uB866\u565D\uB867\u459A\u49C3\u46F6\uFEFE\uFEFE\uB868\uFFFF\u0004" + - "\uFEFE\u5660\u4D71\uB869\u4DED\uB86A\u4869\uB86B\uFEFE\uB86C\u48B2\u5341\uFEFE\uFEFE\uFEFE\u4A55" + - "\u5662\uB86D\uB86E\uB86F\u5665\u47D2\uB870\u5666\uFFFF\u0004\uFEFE\uB871\u5663\u45B2\uB872\uB873" + - "\u4D99\u4E9F\u4A83\u50F6\u4A81\uB874\uFEFE\uFEFE\uB875\uB876\uB877\uFEFE\uB878\u45BD\uFEFE\u5664" + - "\u48D9\uFFFF\u0010\uFEFE\uB879\u49A6\u5668\uB87A\uFEFE\uB87B\u49C9\uB87C\u544A\uB87D\u46F4\u566A" + - "\u508A\uB87E\u4BBC\u5461\uB87F\uFEFE\uB880\uFEFE\uB881\u4EDF\uFEFE\uFEFE\u4EFE\u566C\uB882\uB883" + - "\uFEFE\uB884\uB885\u47C8\u48A4\u46E0\u4576\u4CE6\uB886\u4696\uB887\u4770\u566E\u566B\uB888\u49C1" + - "\u5667\u566F\u4594\u5669\u566D\uB889\uB88A\uFEFE\uFEFE\uB88B\uFFFF\u0005\uFEFE\u5679\uB88C\uFEFE" + - "\uB88D\uFEFE\uB88E\u567C\u567A\uB88F\uFEFE\u4876\uFEFE\u4B94\u51E2\uFFFE\u0004\uB890\u5677\u5462" + - "\uB894\uB895\u48B6\uFEFE\uB896\uB897\u4F98\uB898\uB899\u567D\uFEFE\u5672\uB89A\u5671\u4A46\uB89B" + - "\u4FC2\uB89C\u5673\uB89D\u4F8D\u5670\uB89E\u567B\uFEFE\u567E\uB89F\u5676\uB8A0\u5674\u48BC\uFEFE" + - "\u4A9E\uB8A1\uB8A2\u52EC\u475A\uFFFF\t\uFEFE\u5678\uFEFE\u5675\u53B9\u53E3\uFEFE\uFEFE\uB8A3" + - "\uFEFE\uFEFE\u4F8C\u557C\uB8A4\uFEFE\uB8A5\uFEFE\uFFFE\u0004\uB8A6\u4B4C\uB8AA\uB8AB\u4851\u4A6A" + - "\u54C7\uB8AC\uB8AD\uFEFE\uB8AE\u5294\u4660\uB8AF\uB8B0\u5686\u5680\uB8B1\u5685\u5683\uB8B2\uFEFE" + - "\u567F\uFEFE\uFEFE\u4E97\u5681\uFEFE\u5684\u5682\uB8B3\u45AA\uFEFE\u53C4\uB8B4\u45A5\uB8B5\u4B4A" + - "\u5687\u5688\uFFFF\b\uFEFE\u46DE\u5696\uB8B6\uFEFE\uB8B7\u4CE1\uFEFE\u4DB1\u51F8\uFEFE\u50F9" + - "\uFEFE\u4E67\uFEFE\uB8B8\uB8B9\u5695\u5694\uB8BA\uB8BB\uFEFE\uFEFE\uB8BC\u568F\u5699\uB8BD\uFEFE" + - "\u45D6\uB8BE\u49FA\uB8BF\u4AC4\uB8C0\u56A1\uB8C1\u5697\u4B6A\uB8C2\u568C\uFEFE\u5343\uB8C3\uB8C4" + - "\u4CAE\u5689\uB8C5\uB8C6\uB8C7\u5698\u4AD0\uFEFE\u5690\u5691\u5569\u487D\u568E\u52F1\uB8C8\u568B" + - "\u5692\u568D\u4D51\u5693\u4FF9\uB8C9\uFEFE\uB8CA\uFEFE\uB8CB\uB8CC\uFEFE\uB8CD\u4F63\uFEFE\uFEFE" + - "\u52FA\uFEFE\uB8CE\uFFFF\u0004\uFEFE\u568A\uB8CF\u56A4\u569A\uFEFE\uB8D0\u56A2\u569B\u569E\u4DFB" + - "\uB8D1\uFEFE\uB8D2\uFEFE\uB8D3\u5049\u569D\uB8D4\uB8D5\uB8D6\uFEFE\u569C\u56A0\uB8D7\uFEFE\uB8D8" + - "\u569F\uFEFE\u4E70\uFEFE\uFEFE\uB8D9\uB8DA\uFEFE\uB8DB\uB8DC\uFEFE\u4681\uB8DD\uB8DE\uFEFE\uFEFE" + - "\uB8DF\uFEFE\u56A5\uB8E0\uFEFE\uFEFE\u56A3\uB8E1\u54D2\uFEFE\u4943\u4F95\u50C3\uFEFE\u56A6\uFFFF" + - "\u0004\uFEFE\u5059\uFEFE\uFEFE\u56A7\uB8E2\uFEFE\uB8E3\uB8E4\u56AA\uB8E5\uFEFE\uFEFE\uFEFE\uB8E6" + - "\uFEFE\uFEFE\u4EE7\uB8E7\uB8E8\uB8E9\u4FC3\uB8EA\uB8EB\u56A8\uFEFE\uB8EC\uFEFE\u509C\u46AC\u56A9" + - "\uB8ED\uB8EE\uFEFE\uFFFE\u0005\uB8EF\uFFFF\u0007\uFEFE\uB8F4\uFEFE\u4C43\u54DA\uFEFE\uB8F5\uB8F6" + - "\uFEFE\u56AD\u56B0\u56AB\u4B58\uFEFE\u4C5B\uFEFE\uB8F7\uB8F8\uFEFE\uFEFE\uB8F9\u4A43\uFEFE\uB8FA" + - "\uFEFE\u56B1\uB8FB\uB8FC\u4FC9\uFEFE\uB8FD\uFEFE\u56AE\u56AF\uFEFE\uB8FE\u48EC\uB941\u4BBA\uB942" + - "\u55AD\uFEFE\uB943\uB944\u4ABB\u52D4\uFEFE\u56B5\uFEFE\u4D82\uFEFE\uB945\uB946\u56B3\uB947\uFEFE" + - "\uFEFE\uB948\u56B7\uB949\u56B4\uB94A\u4E84\uB94B\uB94C\uFEFE\uFEFE\uFEFE\u56B6\u56B8\uB94D\uFEFE" + - "\uB94E\uB94F\uFEFE\u56B2\u56BA\uB950\uFEFE\uFEFE\u56B9\uB951\u5578\uFEFE\uFEFE\uB952\uFEFE\u49CA" + - "\u56BC\u56BD\uB953\u454E\uFEFE\uB954\uB955\uB956\u56BB\uFEFE\uFFFE\u0004\uB957\uFEFE\uB95B\uFEFE" + - "\u546F\uFEFE\u56C0\u56BF\u56C1\uB95C\u5290\uB95D\u56BE\uFFFE\u0004\uB95E\u4AA2\uFEFE\u56C2\uFEFE" + - "\uB962\uFEFE\uFEFE\uFEFE\uB963\uB964\uFEFE\u47DA\uFEFE\uB965\uB966\uFEFE\uB967\uFEFE\uB968\u54BD" + - "\uB969\uB96A\uB96B\uFEFE\u56C4\uB96C\uB96D\u56C3\u56C6\u56C5\uFEFE\uFEFE\u56C7\u56C8\u4C91\uB96E" + - "\u4695\u4BE8\u48C9\u4DF3\u555A\u47A2\u459E\u56C9\u479E\u56CA\u4B56\u5050\uB96F\u469F\uFEFE\u56CB" + - "\uB970\u56CC\uB971\uFEFE\uB972\uB973\uFEFE\u494B\uFEFE\u51BE\uFEFE\uFEFE\uB974\uFEFE\uFEFE\u56CD" + - "\uFEFE\u56CE\u4665\uB975\uFEFE\u46B1\u56CF\u56D0\u4548\u46BB\u4546\u56D1\uFEFE\uFEFE\u47B3\uFEFE" + - "\uFEFE\uFEFE\u4649\u4F67\u47AF\u47C9\uFEFE\uFEFE\uFEFE\u48F4\uFEFE\uB976\uFEFE\u56D2\uFEFE\u56D3" + - "\uB977\uB978\u458E\u4645\uFEFE\uFEFE\u56D6\u4EA1\uB979\u56D5\u48EB\uB97A\u56D7\u619D\u56D8\u4F8F" + - "\u56D9\uFEFE\u56DA\u56DB\u527E\uB97B\u48C4\uFEFE\uFEFE\uFEFE\u56DC\uFEFE\uFEFE\u4E7B\uB97C\u56DF" + - "\uB97D\u56DD\u5467\u56DE\uFEFE\u4878\u56E0\u56E1\u56E2\u4BDE\uB97E\uFEFE\uFEFE\u56E6\u56E4\u56E5" + - "\u56E3\u50C9\u56E7\u5146\u48FC\uB97F\uFEFE\uB980\uFEFE\uB981\u56E9\u56E8\uB982\uFEFE\uFEFE\uB983" + - "\uFEFE\u52DC\u56EA\u4F80\uFEFE\uB984\u56EB\uFEFE\u55F9\u5344\u4BE6\uFEFE\uB985\uFEFE\uB986\uB987" + - "\uB988\uFEFE\uB989\u5777\uFEFE\uB98A\uFEFE\uFEFE\u56EC\u6884\u4ED9\uB98B\uFEFE\u56ED\u4DE1\uB98C" + - "\uFEFE\uFEFE\uB98D\u48E6\u558A\uFEFE\u56EE\u549E\uFEFE\u56EF\u56F0\uB98E\uFEFE\u56F1\u51AC\uB98F" + - "\uB990\uB991\u56F2\u51EC\uB992\u50CF\u50E6\u459B\uFEFE\uFEFE\u4BB6\u56F3\uFEFE\u4C50\uB993\uB994" + - "\u4F44\u56F4\uB995\u45B4\u4765\u4B9B\uFEFE\u4CD7\u56F5\uFEFE\uFEFE\u54E3\uFEFE\uFEFE\u4C52\uB996" + - "\uB997\u56F6\u56F7\uB998\u4BB4\uB999\uFFFF\u0004\uFEFE\u474B\uFFFF\u0004\uFEFE\uB99A\uFEFE\u495C" + - "\u46DD\uFEFE\u56F8\uB99B\u45BC\u56F9\uFEFE\uFEFE\uFEFE\u56FA\uFEFE\u4CDD\uB99C\uB99D\u56FB\uFEFE" + - "\uB99E\u46C4\u48CF\u4B6B\u56FC\u4BC0\u4BF5\uB99F\uFFFF\u0006\uFEFE\u5379\u56FD\uB9A0\uFEFE\u474D" + - "\uFEFE\uB9A1\u4A90\u56FE\u51AE\u45AF\uFEFE\u5741\uFFFF\u0004\uFEFE\u5743\uB9A2\u5199\uB9A3\uB9A4" + - "\uFEFE\uB9A5\u49C7\uB9A6\u5481\u5742\uB9A7\uB9A8\uB9A9\uFEFE\u4CD3\u4766\u5481\uB9AA\uFEFE\uFEFE" + - "\u5748\u5745\uFEFE\uFEFE\uFEFE\uB9AB\u4B4E\u4D85\u5744\u47D6\u5746\u5747\u4BE1\uFEFE\uB9AC\uB9AD" + - "\uB9AE\uFEFE\uFEFE\uFEFE\u574A\uFEFE\u5749\uB9AF\uFEFE\uB9B0\u55D6\uFEFE\uB9B1\uFEFE\u49F0\u574C" + - "\u5185\uB9B2\uFEFE\uB9B3\u574B\uFEFE\uFEFE\uFEFE\u574E\u574D\uB9B4\u5580\uFFFE\u0004\uB9B5\uFEFE" + - "\uB9B9\u45F7\u574F\uFEFE\uFEFE\u4870\u459F\uFEFE\uFEFE\u4E68\uB9BA\uB9BB\u5750\uB9BC\uFEFE\u4671" + - "\u4A64\u54C6\u5751\u5752\uFEFE\u5FAA\uB9BD\u4D92\uFEFE\uFEFE\u48A9\u5754\uB9BE\uB9BF\uB9C0\u4978" + - "\uB9C1\uB9C2\u5753\uB9C3\u556A\uFEFE\u5756\u5755\uFEFE\u54B1\uB9C4\u4EEF\uB9C5\u469C\uB9C6\u48CE" + - "\uFEFE\uFEFE\uB9C7\u5757\uFEFE\uB9C8\uFEFE\uB9C9\u53D6\uFEFE\uB9CA\u45E4\uB9CB\u5392\u4B9A\u46ED" + - "\uFEFE\u5758\uB9CC\u45B5\u5759\u4AE1\u575C\uB9CD\u47EE\u575A\u499F\uB9CE\u575B\u4C7E\uB9CF\uB9D0" + - "\uB9D1\uFEFE\uB9D2\uFEFE\uFEFE\uFEFE\uB9D3\uB9D4\u497A\u575D\uB9D5\u575E\uB9D6\uB9D7\u575F\u5760" + - "\u5470\uFEFE\uFEFE\uFEFE\u51E9\u5297\u5761\u4F5B\u4ECB\uB9D8\uFEFE\u4AA8\u5762\u5763\u5764\uFEFE" + - "\uB9D9\uB9DA\uB9DB\u5766\uFEFE\u5768\u5767\uB9DC\uFEFE\uB9DD\uFEFE\u5769\u4590\u455A\uB9DE\u5457" + - "\u576A\uB9DF\uB9E0\u51B7\uB9E1\uB9E2\u4E6B\u4D4D\uFEFE\u576C\u576B\uB9E3\uFEFE\uB9E4\uB9E5\uB9E6" + - "\u55ED\uB9E7\uB9E8\uB9E9\uFEFE\u576D\uB9EA\u576E\uB9EB\u576F\uFEFE\uB9EC\uFEFE\uFEFE\u5770\u4FD1" + - "\u4554\u4A87\uB9ED\uB9EE\uB9EF\u50F1\u5771\u454A\uB9F0\u454C\uFEFE\u5772\u5773\u4E47\u45DF\u5774" + - "\u4790\uB9F1\uB9F2\u5776\uFEFE\uFEFE\uFEFE\u53AD\u4AF2\u4996\u47D7\uFEFE\uFEFE\u4559\u48E3\uB9F3" + - "\u45F6\uB9F4\u51C0\uFEFE\u5779\uFEFE\u49EE\uB9F5\uFEFE\uB9F6\uFEFE\uB9F7\u53DB\uFEFE\uFEFE\u577A" + - "\uFEFE\uFEFE\uB9F8\uB9F9\u577B\u4C82\u4799\u4B91\u577C\u4B6D\u4AA4\u4CF5\uFEFE\u577D\u4E79\uB9FA" + - "\uFEFE\u577E\uFEFE\uFEFE\uB9FB\u53E2\uFEFE\uFEFE\u577F\uB9FC\u5352\uFEFE\uFEFE\uB9FD\uB9FE\uFFFF" + - "\u0005\uFEFE\uBA41\uFFFF\u0004\uFEFE\u5780\uBA42\uFEFE\u5781\uFEFE\u4F55\uBA43\u4942\uFEFE\uFEFE" + - "\uBA44\uFEFE\u4574\u5782\uBA45\uFEFE\uFEFE\uBA46\u5784\u5783\uFEFE\u5178\u5367\uBA47\uBA48\uFEFE" + - "\u53B7\u5785\uBA49\u5786\uFEFE\u5787\u4C8E\uBA4A\uBA4B\u5788\uBA4C\uBA4D\uFEFE\uBA4E\u4ACA\uFEFE" + - "\uBA4F\uFEFE\uFEFE\uBA50\uFEFE\u48D2\u5789\uFEFE\uBA51\uFEFE\uFEFE\u48F5\u50A5\u485C\u46D4\u4B71" + - "\u47F9\u4791\uBA52\uFEFE\uFEFE\uBA53\uBA54\u4FA5\uBA55\u46A6\u484C\uFEFE\u50F5\uBA56\u55B2\uFEFE" + - "\u578B\uBA57\u578C\uBA58\u5194\u53F5\u4588\u45D4\u4C8B\uBA59\uBA5A\u5791\u4F71\u4E41\u4DD5\u4F86" + - "\u5792\u5790\u47C6\u4778\u5042\u47D9\u485A\uFEFE\uBA5B\u4F59\u48E2\u45F0\uFEFE\u5793\uFFFF\u0006" + - "\uFEFE\u5794\uBA5C\u55EA\u47BA\uFEFE\uFEFE\uFEFE\u45A0\u457E\u53D3\u55BC\u466D\u45F3\u51AF\u50C6" + - "\u4EB2\u46A5\uFEFE\uBA5D\uFFFF\u0006\uFEFE\uBA5E\u47CF\uFEFE\u579D\uFEFE\u507A\u53E1\uBA5F\uFFFF" + - "\u0004\uFEFE\u4C4F\uBA60\uBA61\u579C\uBA62\u49CB\u5797\u5798\u579A\uBA63\uFEFE\uBA64\uFEFE\uFEFE" + - "\uBA65\uBA66\u579B\uFEFE\u4B98\u49C4\uFEFE\u53E5\u5799\u5795\u47F6\uFEFE\u5796\uFEFE\u4B50\uBA67" + - "\uBA68\uFEFE\u5073\uBA69\u4F56\u4AEE\u4954\uFEFE\uFEFE\uBA6A\u579E\uBA6B\uFEFE\u50B0\uFFFF\f" + - "\uFEFE\uBA6C\u57A2\uFEFE\uFEFE\uBA6D\uFEFE\uBA6E\uFEFE\uBA6F\uBA70\u48A1\uBA71\u548D\uBA72\uFEFE" + - "\uBA73\uBA74\uFEFE\u57A5\u57A3\uFEFE\u477F\uBA75\u57A0\u57AA\u57A4\uFEFE\uFEFE\uFEFE\u57A7\u4AF6" + - "\u49B0\uFEFE\uBA76\u57A8\uBA77\uFEFE\uBA78\u57AB\uBA79\u57AD\uFEFE\uBA7A\uBA7B\u57AE\u4F50\u457A" + - "\uBA7C\u57A1\u579F\u57AC\uBA7D\u57A6\uFEFE\uFEFE\uBA7E\uBA7F\uFFFF\u0005\uFEFE\u57A9\uFEFE\uFEFE" + - "\uBA80\uFEFE\uBA81\u57B2\uFEFE\u57BC\u57B4\uBA82\uBA83\u57B9\u57BD\uBA84\u57BA\u57B5\uBA85\uBA86" + - "\u57B1\uFEFE\uBA87\u4CDE\u53E9\uFEFE\uFEFE\uFEFE\uBA88\u57B3\uBA89\uBA8A\uBA8B\u57B0\u52B1\u57BE" + - "\uBA8C\u4EF9\u45D0\u57BB\uFEFE\u57B6\uFEFE\uBA8D\u57AF\u57B8\u4A6B\uBA8E\uFEFE\uFEFE\uBA8F\uBA90" + - "\uFFFF\t\uFEFE\u57B7\uFFFF\u0007\uFEFE\uBA91\u46CB\u57C7\uFEFE\uFEFE\u57BF\u57C1\uFEFE\u5568" + - "\u55F0\uBA92\uFEFE\uBA93\u57C6\u57C5\uBA94\uFEFE\uFEFE\u4747\uFEFE\uFEFE\uFEFE\uBA95\uFEFE\uFEFE" + - "\uFEFE\u547C\uFEFE\uBA96\u57C4\uBA97\u57C0\uBA98\uBA99\uFEFE\uFEFE\u4CDB\uBA9A\u51B8\u4F76\uBA9B" + - "\uBA9C\uFEFE\uFEFE\uBA9D\uBA9E\uBA9F\u57C2\u4BAB\uFEFE\uFEFE\uFEFE\u57C3\uBAA0\u54D4\uFFFF\u0013" + - "\uFEFE\uBAA1\uBAA2\uFEFE\uFEFE\u57CC\u4BE0\uFEFE\u4D43\uBAA3\u57D2\uFEFE\uBAA4\uBAA5\uFEFE\u57D1" + - "\u57C8\uFEFE\uBAA6\uBAA7\uBAA8\u5478\uFEFE\u57C9\uBAA9\uFEFE\uFEFE\u5383\u57CE\u46BE\uBAAA\uFEFE" + - "\uBAAB\uBAAC\uFEFE\u57CB\uBAAD\uFEFE\u46E4\uBAAE\uBAAF\uFEFE\u47E4\uFEFE\uFEFE\u57CF\u57D0\uBAB0" + - "\uFEFE\uBAB1\uBAB2\u57CD\u57D3\uBAB3\uFEFE\uBAB4\uBAB5\uFEFE\u57CA\uBAB6\uFEFE\uBAB7\uFFFF\u0014" + - "\uFEFE\u57D8\u57DD\uFEFE\u57D9\uBAB8\u57D5\uBAB9\uBABA\u57DF\u46B3\uFEFE\u57DE\u57E1\uBABB\u5253" + - "\u57D6\u5558\uFEFE\uFEFE\uBABC\uBABD\uFEFE\uFFFE\u0004\uBABE\uFEFE\uFEFE\uBAC2\u57DA\u57D4\u52B5" + - "\uFEFE\u45D1\u5475\u57DB\u57D7\uFEFE\uFEFE\uFEFE\uBAC3\uBAC4\uFEFE\uFEFE\u4FD3\u57E2\u57E0\u5168" + - "\u4D6D\u4C5F\uBAC5\u57DC\uFEFE\u4EB9\uFEFE\uBAC6\uFEFE\uFEFE\uFEFE\u48D3\uFFFF\b\uFEFE\uBAC7" + - "\uFEFE\uBAC8\uFEFE\uBAC9\u57E5\u57E3\uBACA\u5858\uFEFE\uBACB\uFEFE\uBACC\uBACD\uFEFE\uBACE\uFEFE" + - "\uFEFE\uBACF\uBAD0\uBAD1\u57E8\uFEFE\uFEFE\uBAD2\uBAD3\uFEFE\u52A2\uBAD4\u57E6\uFEFE\uBAD5\u57E4" + - "\uFEFE\uFEFE\uBAD6\u4B5E\u57E7\uFFFF\u0004\uFEFE\uBAD7\uFFFF\f\uFEFE\uBAD8\u57EB\uFEFE\u57E9" + - "\uFEFE\uFEFE\uFEFE\u57EE\u57ED\uBAD9\uFFFF\u0005\uFEFE\uBADA\u5063\uFEFE\uBADB\u477E\uBADC\uFEFE" + - "\uFEFE\uFFFE\u0006\uBADD\uFEFE\u57EA\uFEFE\u57EC\u54EC\u50F3\uBAE3\uFEFE\u57EF\uFFFF\r\uFEFE" + - "\u52CA\uFEFE\uFEFE\uBAE4\uFEFE\uFEFE\u57F8\uBAE5\u50CA\u57F3\uBAE6\u547F\uBAE7\u57F2\uBAE8\u57F4" + - "\uBAE9\uFEFE\uBAEA\uBAEB\uBAEC\uFEFE\uBAED\uBAEE\uBAEF\u529B\uBAF0\uBAF1\uFEFE\uBAF2\uFEFE\uFEFE" + - "\uBAF3\uFEFE\uBAF4\u5062\uBAF5\u57F0\uBAF6\u57F1\uFEFE\uFEFE\uFEFE\uBAF7\uFFFF\u0006\uFEFE\u547D" + - "\uFEFE\uFEFE\uBAF8\uFEFE\uFFFE\u0004\uBAF9\u57F6\uFEFE\uBAFD\uFEFE\u45FC\uBAFE\u57FA\u57F5\u57F9" + - "\uBB41\uFEFE\uBB42\uFEFE\uBB43\uBB44\uFEFE\u4E6D\uBB45\uFEFE\uFEFE\u55F1\uFEFE\u5582\uFFFF\u0005" + - "\uFEFE\u57FE\uFEFE\uFEFE\uFEFE\uBB46\uBB47\u57F7\u55D8\uBB48\uFEFE\u5841\uBB49\uBB4A\uFEFE\uFEFE" + - "\u57FD\uFFFF\u0004\uFEFE\u57FC\uBB4B\uFEFE\uFEFE\uFEFE\uBB4C\uBB4D\uFEFE\uFEFE\uBB4E\uBB4F\uBB50" + - "\u5842\uFEFE\u5190\uFEFE\uFEFE\u5843\uFFFE\u0004\uBB51\uFEFE\uBB55\uBB56\uBB57\u5844\uFEFE\uFEFE" + - "\uBB58\uFEFE\uBB59\u5846\uFEFE\u5845\uBB5A\uFFFF\u0004\uFEFE\u5849\uFEFE\uBB5B\uFEFE\u584C\u584A" + - "\u5848\u584B\uFEFE\uBB5C\uFEFE\uFEFE\u5847\uFFFE\u0005\uBB5D\u584D\uBB62\uBB63\u584F\uFEFE\u584E" + - "\uFEFE\uFEFE\uFEFE\u5850\u56D4\uBB64\u5065\u4544\uBB65\uBB66\u46A9\uBB67\u4A49\uBB68\uFEFE\u47F0" + - "\uFFFE\u0005\uBB69\uFEFE\uFEFE\uBB6E\uFEFE\uBB6F\u5851\uFEFE\u4B44\uBB70\u4AFA\u47C1\uFEFE\uFEFE" + - "\uBB71\uBB72\uFEFE\u5852\u4A94\uFEFE\uFEFE\u458F\uFEFE\u5853\u5266\uBB73\uBB74\u53CF\u5854\uFEFE" + - "\uFEFE\uBB75\u5856\u5855\uBB76\u51BD\uBB77\u5857\uFEFE\u4F49\uFEFE\uBB78\u47E1\u54E7\uFEFE\uBB79" + - "\u585A\uFEFE\u5859\uFEFE\uBB7A\uBB7B\u585B\uBB7C\uFEFE\u4684\uBB7D\uFEFE\uFFFE\u0004\uBB7E\u585C" + - "\u4782\u47CD\uBB82\uBB83\uFEFE\uBB84\u49E6\uBB85\uBB86\u45C2\uFEFE\uFEFE\uBB87\uBB88\uFEFE\uFEFE" + - "\u51D1\u585D\uFEFE\uFEFE\u585F\uFEFE\uBB89\uBB8A\uBB8B\u5861\uFEFE\u45EC\uFEFE\uFEFE\uBB8C\uBB8D" + - "\u49AE\uFEFE\uFEFE\u4C55\uFEFE\uBB8E\uBB8F\u585E\u5862\u4E8D\u4EF3\uBB90\uFFFF\u0006\uFEFE\u5860" + - "\uFFFF\u0007\uFEFE\u5865\uBB91\uFEFE\u53A6\u5863\u51C4\uBB92\uBB93\u5398\u4949\uBB94\uFEFE\uFFFE" + - "\u0005\uBB95\uFEFE\uBB9A\uBB9B\uBB9C\uFEFE\uBB9D\uFEFE\uFFFE\u0004\uBB9E\uFEFE\uBBA2\u5866\uFEFE" + - "\uBBA3\u4BC9\uBBA4\uFFFF\u0004\uFEFE\u5864\u5867\uFEFE\u46E6\uBBA5\uFFFF\u0006\uFEFE\u5868\uBBA6" + - "\uBBA7\uFEFE\uBBA8\uFEFE\uBBA9\uBBAA\uFEFE\uFFFE\u0004\uBBAB\u5869\uBBAF\u5466\u47CE\u586A\uFEFE" + - "\uFEFE\uBBB0\uBBB1\uBBB2\u586D\uFEFE\u586C\uFEFE\uFEFE\uFEFE\u53CD\uFEFE\uFEFE\u586B\uFFFF\u0004" + - "\uFEFE\uBBB3\uFFFF\u0004\uFEFE\uBBB4\uFEFE\uFEFE\u5871\uFEFE\uFEFE\u586E\uFEFE\uFEFE\u586F\u5873" + - "\u5870\uFEFE\uFEFE\u4EAC\uBBB5\uFEFE\u45DB\uBBB6\uFEFE\uFEFE\u5874\u5875\u5872\uBBB7\u5876\uFFFF" + - "\u0005\uFEFE\u4DF4\uBBB8\uBBB9\u48E9\u517E\uBBBA\uFEFE\u5879\uBBBB\uFEFE\uBBBC\uBBBD\uFEFE\uBBBE" + - "\uFEFE\uFEFE\uFEFE\uBBBF\uFEFE\uFEFE\uBBC0\uFEFE\uFEFE\uFEFE\u4F48\uBBC1\uBBC2\u4D57\uBBC3\u4DAC" + - "\u46F1\uFEFE\u46A3\uBBC4\uBBC5\uBBC6\u469D\uFEFE\u497F\uBBC7\uBBC8\u4AE7\u5371\uFEFE\uBBC9\uBBCA" + - "\u5878\u587A\uBBCB\uBBCC\uFFFF\u0007\uFEFE\u53B0\uFEFE\uFEFE\uFEFE\u587B\uFEFE\uBBCD\uFEFE\u53A7" + - "\uBBCE\uBBCF\uBBD0\u587C\uFEFE\uFEFE\u4B61\uFEFE\uBBD1\uBBD2\uFEFE\uFEFE\u4FAC\uFEFE\uFEFE\uBBD3" + - "\uFEFE\u4E53\u50A4\u49B8\uBBD4\uFEFE\u45D9\u54F6\uFEFE\uFEFE\uFEFE\uBBD5\u4A7C\uFEFE\uFEFE\u5880" + - "\uFEFE\uBBD6\u539F\u4BEB\uFFFF\u0007\uFEFE\uBBD7\u5053\u587D\uBBD8\uBBD9\uFEFE\uBBDA\uBBDB\u4EC6" + - "\u5881\uFEFE\u4CCB\uBBDC\uFEFE\u486A\u52F8\u4F6F\u4657\uFEFE\uFEFE\uFEFE\u53C1\uBBDD\uFEFE\uBBDE" + - "\u587E\uFEFE\uBBDF\uFEFE\uFEFE\uBBE0\uBBE1\u4743\uFEFE\u4F5E\uFFFF\u0004\uFEFE\u5883\uFEFE\u5886" + - "\uFEFE\uFEFE\u4D89\uFEFE\uFEFE\uBBE2\u5884\uFEFE\uFEFE\uBBE3\uFEFE\u5279\uBBE4\uBBE5\uBBE6\uFEFE" + - "\u4A95\uFEFE\u5885\uFEFE\uFFFE\u0004\uBBE7\uFEFE\uBBEB\uBBEC\uFEFE\uBBED\uBBEE\uFEFE\uFEFE\u4EBE" + - "\uBBEF\uFEFE\uBBF0\u464D\uFFFF\u0004\uFEFE\u5150\uBBF1\u588A\u5887\uBBF2\uBBF3\uBBF4\uFEFE\uFEFE" + - "\uFEFE\uBBF5\uFEFE\u4AFC\uBBF6\uFEFE\u5888\uFEFE\uFEFE\u588B\uFEFE\uFEFE\uBBF7\u588C\u5289\uFFFF" + - "\u0004\uFEFE\u5889\u588D\u588E\u5552\uBBF8\uFEFE\u5488\uFEFE\uFEFE\u4B95\uBBF9\uFEFE\uBBFA\u588F" + - "\uFEFE\u4E8E\uBBFB\uFEFE\u4EC8\uFEFE\u5196\uBBFC\uBBFD\uFEFE\uBBFE\u5891\uBC41\u5890\uBC42\u55B9" + - "\uBC43\u5892\u5894\u5893\uBC44\uFEFE\u5896\uBC45\u5895\u5897\uFEFE\uBC46\uBC47\uFEFE\u5898\u5899" + - "\uFEFE\uFEFE\uFEFE\uBC48\uFEFE\u467D\u514F\uFEFE\u4C9F\u589A\u496C\u4EB0\u4775\uBC49\uFEFE\uFEFE" + - "\uFEFE\u589B\uFEFE\u589C\u5077\u589D\u589E\u5275\uFFFF\u0004\uFEFE\u589F\uFEFE\uFEFE\uBC4A\uBC4B" + - "\uFEFE\uFEFE\u476F\u58A0\u58A1\uBC4C\uFEFE\uFEFE\u497E\u58A2\uFEFE\uBC4D\uBC4E\uBC4F\u4AC3\u4694" + - "\uFEFE\u52C8\u54DD\u45FE\u58A3\u48C8\uBC50\uFEFE\uFEFE\uFEFE\uBC51\u4B8B\uBC52\uBC53\u58A5\uFEFE" + - "\u455B\uBC54\u468A\u45AB\u4573\u58A6\u58A7\u4792\uBC55\uBC56\u4941\u58A8\uBC57\uFEFE\uBC58\uBC59" + - "\u5147\u58A9\uFFFF\u0005\uFEFE\u58AA\uBC5A\uFEFE\uFEFE\uFEFE\uBC5B\u52F2\uFEFE\uBC5C\u4D69\u45E6" + - "\u4DB2\uFFFF\u0004\uFEFE\u518F\u4C53\u58AC\u4C64\uBC5D\u58AD\u5284\u58AB\uFEFE\u5583\u58AF\uBC5E" + - "\u58AE\u58B0\uFEFE\u58B1\uBC5F\uBC60\u58B4\uBC61\u58B3\u58B2\uFEFE\u46E5\uFEFE\u58B5\u4ECA\u58B7" + - "\u4EBB\uBC62\u58B6\uBC63\u4EDD\uBC64\uFEFE\uFEFE\uBC65\u4699\u4D90\uBC66\uBC67\uFEFE\u58B8\uBC68" + - "\uFEFE\uBC69\uBC6A\u469E\uFEFE\uFEFE\uFEFE\u58B9\u4BF8\u51A2\u554D\uFFFF\u0005\uFEFE\u5043\uBC6B" + - "\uBC6C\u58BA\uBC6D\uFEFE\uFEFE\uFEFE\uBC6E\u5395\uFEFE\uBC6F\u53D1\uBC70\uFEFE\u4A66\uFEFE\u58BB" + - "\uFEFE\u58BC\uFEFE\uBC71\uFEFE\uFEFE\uFEFE\u58BD\u58BE\u4D9E\uFEFE\uBC72\u50EC\uFEFE\uFEFE\uFEFE" + - "\u537F\uFFFE\u0004\uBC73\uFEFE\u58BF\uBC77\uFEFE\uFEFE\uFEFE\uBC78\uFEFE\u4BDC\u58C0\u49A3\uBC79" + - "\uFEFE\u53AF\uFEFE\uFEFE\uBC7A\uFEFE\uBC7B\uBC7C\uFEFE\u58C1\uFEFE\uBC7D\u4CC1\uBC7E\u4990\uFEFE" + - "\uBC7F\uFEFE\uFEFE\u549C\u53F2\uBC80\u4FF1\u484F\uFFFF\u0004\uFEFE\u58C3\u58C4\uFEFE\u5184\uBC81" + - "\uBC82\uBC83\uFEFE\uFEFE\uFEFE\uBC84\uBC85\u5255\u55DE\uBC86\u58C2\uFEFE\u558C\u4AB3\uFEFE\uFEFE" + - "\uBC87\uBC88\uFEFE\uBC89\uBC8A\uFEFE\uBC8B\uFEFE\u5179\uBC8C\uFEFE\uFEFE\uFEFE\u52B9\uFEFE\uFEFE" + - "\uFEFE\u4B42\uBC8D\u4C65\uFEFE\u557A\uBC8E\uFFFF\u0004\uFEFE\u58CA\uFEFE\uFEFE\uBC8F\uBC90\uBC91" + - "\uFEFE\uFEFE\u58C7\uBC92\uBC93\uFFFF\u0004\uFEFE\u4B54\uFEFE\u58C9\uFEFE\u58C8\uFEFE\uBC94\u58C6" + - "\u524C\uFEFE\uFEFE\uBC95\uBC96\u58C5\uFEFE\uBC97\uBC98\u549F\uBC99\uFEFE\uFEFE\uBC9A\uFEFE\u50B5" + - "\uBC9B\uFFFF\u0004\uFEFE\u58CE\u58CF\uFFFF\u0005\uFEFE\u5498\uFEFE\uFEFE\uFEFE\u58CB\u50F8\uFEFE" + - "\uFEFE\uBC9C\uBC9D\u4ECC\uBC9E\uBC9F\u58CD\uFEFE\uFEFE\uBCA0\uFEFE\uFEFE\uFEFE\uBCA1\uFFFF\u0004" + - "\uFEFE\uBCA2\uFFFF\u0004\uFEFE\u4A77\uFEFE\uFEFE\uFEFE\uBCA3\uFEFE\uFEFE\uFEFE\u58D0\uBCA4\uFEFE" + - "\uBCA5\u496F\uBCA6\uFEFE\uFEFE\u58D1\uFEFE\u58CC\uBCA7\uFFFF\t\uFEFE\uBCA8\uFEFE\uFEFE\uBCA9" + - "\uBCAA\uFEFE\uFEFE\uBCAB\u5454\uFFFF\u000B\uFEFE\uBCAC\uFFFF\u0004\uFEFE\uBCAD\uFEFE\u4D80\uBCAE" + - "\uFEFE\uFEFE\uBCAF\uFEFE\uFEFE\uBCB0\u58D2\u4855\uBCB1\uFEFE\uBCB2\uBCB3\uBCB4\uFEFE\uBCB5\uFFFF" + - "\u0004\uFEFE\uBCB6\uFFFF\u0004\uFEFE\uBCB7\uFFFF\u0004\uFEFE\uBCB8\uBCB9\uBCBA\uFEFE\uBCBB\uFEFE" + - "\uFEFE\uBCBC\uFEFE\uBCBD\uBCBE\u58D3\u58D8\u58D4\uBCBF\uFEFE\u4E89\u58D7\uFEFE\uBCC0\uFEFE\uBCC1" + - "\uFEFE\uBCC2\u53E0\uFEFE\u58D6\u4EC3\uFEFE\uFEFE\uBCC3\u58D5\uFFFF\u0005\uFEFE\u58DD\u58DA\uFEFE" + - "\uFEFE\uBCC4\uFEFE\uBCC5\uFEFE\uFEFE\uFEFE\uBCC6\u5567\uFEFE\u58D9\uFEFE\uBCC7\u58DB\uFEFE\uFEFE" + - "\u58DC\uBCC8\uFEFE\uFEFE\uFEFE\uBCC9\uFFFF\u0006\uFEFE\uBCCA\uBCCB\uFEFE\uFEFE\uFEFE\u58DE\u58DF" + - "\uFEFE\uBCCC\uFEFE\uFEFE\uBCCD\uBCCE\uFFFF\u0006\uFEFE\uBCCF\u4F8B\uFEFE\u58E1\u58E0\uFFFF\t" + - "\uFEFE\u58E2\uBCD0\uFEFE\uBCD1\uFEFE\uBCD2\uFEFE\uBCD3\uFEFE\uFEFE\uFEFE\uBCD4\u4DE4\uFEFE\uFEFE" + - "\uBCD5\uFFFF\u0004\uFEFE\u58E4\uFEFE\u52EA\uBCD6\uFEFE\uFEFE\u55E8\uFEFE\u58E3\uFEFE\uBCD7\uFEFE" + - "\u58E5\uFEFE\uBCD8\uFFFF\u0005\uFEFE\u58E6\uFEFE\u58E9\uBCD9\uFEFE\u58E7\uFEFE\u58E8\uFFFF\u0005" + - "\uFEFE\uBCDA\uBCDB\uFEFE\uFEFE\uFEFE\u4564\u58EA\uBCDC\uFEFE\u4BD9\u58EB\u58EC\u48F2\u4A41\uFEFE" + - "\u5258\u58EE\u4FF2\u45F4\uBCDD\u4F83\uFEFE\uFEFE\uFEFE\u4AEC\u4EAF\u58EF\u45BE\uFEFE\uBCDE\u58F0" + - "\uFEFE\u4C5E\uFEFE\uFEFE\uBCDF\uBCE0\u58F1\u595B\uFEFE\u58F2\uFEFE\u58F3\uFEFE\uFEFE\u58F4\uFEFE" + - "\u58F5\uFEFE\uFFFE\u0004\uBCE1\u58F6\uBCE5\uFEFE\u58F7\uBCE6\u486F\uBCE7\u46D5\u46F0\u45A8\uBCE8" + - "\u524D\u48C5\u4C75\uBCE9\u46C8\uBCEA\uBCEB\uFEFE\uBCEC\uBCED\u515C\uBCEE\u47DD\u49A2\u4D64\u45E7" + - "\u50AB\u4D8B\u494D\uFEFE\u45ED\uFEFE\uFEFE\u4ADE\u498F\u47B8\u4F7A\u58F8\uFEFE\uBCEF\uBCF0\uFEFE" + - "\uFEFE\uBCF1\uBCF2\u4592\uBCF3\u4ED4\uBCF4\uBCF5\u4968\u5078\u52EF\u4686\uBCF6\u58F9\u4889\uBCF7" + - "\uFEFE\uBCF8\uFEFE\uFEFE\u4882\u58FC\uBCF9\u4FE9\u58FA\u49DF\u4A84\u4A56\u58FB\uFEFE\u58FD\uFEFE" + - "\uFEFE\u45AC\uBCFA\uFEFE\uBCFB\u5941\uFEFE\u4B81\u55F4\u5244\uFEFE\uBCFC\uBCFD\u5942\uBCFE\uBD41" + - "\u47F8\uFEFE\u4B59\u5943\u4B93\uBD42\u52B8\u5946\uFEFE\u5945\u5947\u51FC\u4FA9\u5C7E\u4987\uFEFE" + - "\u5948\u5944\uFEFE\u4C7A\uBD43\u5949\uBD44\uFEFE\u594A\uBD45\u5556\u594B\uFEFE\u4B60\uFEFE\u46A0" + - "\uFEFE\uFEFE\uBD46\u4656\u46B2\uFEFE\u4D76\u49FB\uFEFE\u498A\u594C\u4959\u594D\u594E\u5189\u4CEF" + - "\u4D5F\uBD47\u594F\u48AE\u455D\uFEFE\u484A\uFEFE\u5950\uFEFE\uFEFE\u53C0\uBD48\uFEFE\uFEFE\u4871" + - "\uFEFE\uFEFE\uFEFE\u5951\uBD49\u5952\uFEFE\u5953\uBD4A\u53AE\uFEFE\uBD4B\uFEFE\u5954\uBD4C\uFEFE" + - "\uBD4D\uBD4E\u6880\uBD4F\uFEFE\uBD50\u4BEE\uBD51\uFEFE\uFEFE\uBD52\uBD53\uFEFE\u5955\u515D\u4C6B" + - "\u49CE\u4A86\u4FB9\u45C8\u4CC6\u488B\u5956\uFEFE\uFEFE\uFEFE\u485E\u5957\uFEFE\u4D94\uFEFE\u4DA7" + - "\u45E9\uFEFE\u55BA\u5958\u5443\u595A\u54B2\uFEFE\u5959\uFEFE\u48DD\uFEFE\uFEFE\uFEFE\uBD54\uBD55" + - "\u5443\uBD56\uFEFE\u476D\uFEFE\u53FB\u55C0\uBD57\uBD58\u4A8E\u4CA2\uFEFE\uBD59\uBD5A\uBD5B\uFEFE" + - "\uFEFE\u595C\uBD5C\u595D\u4FDD\uBD5D\u4565\uFEFE\uFEFE\uBD5E\uBD5F\u595E\uFEFE\uFEFE\u595F\uFFFE" + - "\u0004\uBD60\uFFFF\t\uFEFE\uBD64\uBD65\uFEFE\uBD66\uFEFE\u5960\uFEFE\uFEFE\uBD67\u474A\u525A" + - "\uBD68\uFEFE\u5961\uFFFF\b\uFEFE\uBD69\uFEFE\uBD6A\uBD6B\u4572\uBD6C\uBD6D\uFEFE\uFEFE\u5967" + - "\uFEFE\u54B9\u45BF\uBD6E\u5963\u50D5\uFFFF\u0004\uFEFE\u5262\uBD6F\u4D46\uBD70\uBD71\u5965\u5966" + - "\u4748\uFEFE\u5968\u5964\u596A\uFEFE\u5962\uFFFF\u0006\uFEFE\u5969\uFEFE\u596B\uFEFE\uBD72\uFEFE" + - "\uBD73\uFFFF\u0006\uFEFE\uBD74\uFFFF\u0004\uFEFE\uBD75\uFEFE\u596C\uFEFE\uFEFE\uFEFE\uBD76\uFEFE" + - "\uFEFE\u4F96\u51B3\uFFFF\u0006\uFEFE\u4F9D\u596D\u5972\uFEFE\uFEFE\u5971\uBD77\u4AAC\u48FE\uBD78" + - "\uBD79\uFEFE\uBD7A\u5970\u456F\uFEFE\uFEFE\uFEFE\u596F\u5072\uFEFE\u596E\uFEFE\uFEFE\uFEFE\uBD7B" + - "\uFFFF\u0004\uFEFE\uBD7C\u4C7F\uFEFE\uFEFE\uFEFE\u5973\uFEFE\uBD7D\u457F\uFEFE\uFEFE\u5977\uBD7E" + - "\uFEFE\u514D\u5974\u5074\u54F1\u597C\u597B\u597A\u5976\uFEFE\uFEFE\uFEFE\u5975\uFEFE\uFEFE\u5979" + - "\uBD7F\uBD80\uFEFE\uBD81\u5978\uFEFE\u4F5F\uFEFE\uBD82\uFFFF\u0005\uFEFE\uBD83\uFEFE\uFEFE\uBD84" + - "\uFFFF\u0004\uFEFE\uBD85\uFEFE\uFEFE\uFEFE\uBD86\uFEFE\uBD87\uFEFE\uFEFE\u5984\uBD88\uFEFE\uFEFE" + - "\uBD89\uFEFE\uBD8A\uFEFE\uBD8B\u5983\u597D\uFEFE\u5982\uFEFE\u498C\uBD8C\u597E\u597F\uFEFE\uBD8D" + - "\uFEFE\uFEFE\uFEFE\uBD8E\uFEFE\uFEFE\u5981\uFEFE\uFEFE\uFFFE\u0004\uBD8F\uFEFE\uBD93\uFFFF\u0004" + - "\uFEFE\u509E\uBD94\uFEFE\u5985\u5987\uFEFE\u4ED3\uBD95\uFEFE\uFEFE\u5986\uFEFE\uFEFE\u5988\uFEFE" + - "\uFEFE\uBD96\uBD97\uFEFE\uFEFE\uFEFE\uBD98\uBD99\uFEFE\uBD9A\u598B\uBD9B\u598A\uFEFE\uFEFE\u5989" + - "\uBD9C\uFEFE\uBD9D\u47D1\u598C\uFEFE\uFEFE\uFEFE\u598F\uFEFE\uFFFE\u0004\uBD9E\uFEFE\uFEFE\uFEFE" + - "\uBDA2\uFEFE\uBDA3\uFEFE\u598E\uFEFE\uBDA4\uBDA5\uFEFE\u598D\uFFFF\u0004\uFEFE\uBDA6\uFEFE\uFEFE" + - "\uFEFE\uBDA7\u5990\uFEFE\u5991\uFEFE\uBDA8\uFEFE\uBDA9\uFEFE\uBDAA\uFEFE\uFEFE\u5992\u5993\u5995" + - "\u4CE8\uFEFE\u5994\u4F84\uFFFF\u0005\uFEFE\uBDAB\uFEFE\uFEFE\uFEFE\uBDAC\uFEFE\u5996\uFEFE\uBDAD" + - "\u49CF\u5281\uBDAE\uFEFE\u5997\uFEFE\u5999\u5998\uFEFE\uFEFE\u51DF\uFEFE\uBDAF\uBDB0\uFEFE\u599A" + - "\uFEFE\u4567\u4741\uFEFE\uBDB1\u4D47\uFEFE\u4C67\uBDB2\u456A\u485B\u4CA3\u4A52\uBDB3\uFEFE\u599B" + - "\uFEFE\uFEFE\u498B\uFEFE\uFEFE\u47AD\u4A4B\u4AE6\u4E7D\u599C\uFEFE\u53CB\uBDB4\uBDB5\uFEFE\u4893" + - "\uFEFE\u4E46\u4A7D\uFEFE\uBDB6\uFEFE\u4553\u476B\uFEFE\uFEFE\u4F75\uBDB7\uFEFE\uFEFE\uFEFE\u599D" + - "\u4AB5\uBDB8\uFEFE\uFEFE\uFEFE\u59A0\uBDB9\uFEFE\uBDBA\uBDBB\u51C7\uFEFE\uBDBC\u599F\u599E\u59A1" + - "\uFEFE\u489C\uFEFE\uBDBD\uBDBE\uFFFF\u0004\uFEFE\u52AF\uFEFE\uFEFE\uBDBF\uFEFE\uFEFE\u4A44\uFEFE" + - "\u4B53\uBDC0\u4960\u4982\uFEFE\uBDC1\u4DC5\uFEFE\uBDC2\u59A2\u54BE\u46EF\uFFFF\u0004\uFEFE\u4C85" + - "\uBDC3\uFEFE\u59A5\uFEFE\uFEFE\u59A4\u59A3\u4A5E\uFEFE\u59A6\uFEFE\uBDC4\uFEFE\uBDC5\u496B\uFEFE" + - "\u59A7\uFEFE\uBDC6\uBDC7\uFEFE\uFEFE\u59A9\u4CCA\uBDC8\u59A8\uBDC9\uFEFE\uFEFE\uBDCA\uBDCB\uFEFE" + - "\uBDCC\u5483\uFEFE\u48DE\u59AA\u4E7F\u59AB\uFEFE\uFEFE\uFEFE\uBDCD\uFEFE\uFFFE\u0005\uBDCE\uFEFE" + - "\uBDD3\uFEFE\u4A6F\u458D\u4560\u59AC\u59AD\uFEFE\u45A9\u48DA\u59AE\u50A2\u4DAF\u525F\u4B57\u59AF" + - "\uBDD4\u4B92\uFEFE\u45B7\u4850\uFEFE\uFEFE\u558D\uFEFE\uFEFE\u4AED\uBDD5\uFEFE\uFEFE\uBDD6\u4D4F" + - "\uFFFF\u0005\uFEFE\u4B64\u554F\u4854\uFEFE\uFEFE\u515A\uFEFE\u4551\uFEFE\uFEFE\uFEFE\u59B0\uFEFE" + - "\uBDD7\uFEFE\uBDD8\uBDD9\u45DE\u48B1\uBDDA\uFEFE\uBDDB\u45F8\uBDDC\u48E0\uFEFE\uFEFE\uFEFE\uBDDD" + - "\uFEFE\uBDDE\uFEFE\u4EEB\u50C1\u469A\u4C5D\uFFFF\u0004\uFEFE\uBDDF\uBDE0\uBDE1\uFEFE\u59B1\u59B2" + - "\u4BC7\uFEFE\uFEFE\uBDE2\uFEFE\u59B3\u4EDB\u4EA7\uBDE3\uBDE4\uFEFE\uBDE5\u59B5\u59B4\uBDE6\uBDE7" + - "\u54AD\uBDE8\uBDE9\u536C\uFEFE\uFEFE\uFEFE\u59B7\u59B8\uBDEA\u59B6\uBDEB\u55AF\u5562\u59BA\u59B9" + - "\u50E9\uFEFE\uBDEC\uFEFE\uFEFE\u59BB\u59BC\uFEFE\uBDED\u59BD\uFEFE\uFEFE\uFEFE\u59BE\u59BF\uFEFE" + - "\u59C0\u59C1\uFEFE\u47D0\u505B\u52D6\uFEFE\u4666\u4BAF\u5564\uFEFE\u544B\u51D9\uFEFE\u4B47\uBDEE" + - "\u59C2\u54BF\uFEFE\uBDEF\uBDF0\uBDF1\u59C3\u50CD\u59C4\u5641\u5651\uBDF2\u468F\u50E1\u59C5\uFEFE" + - "\u4B63\u51E5\u46DA\u59C6\u54AC\u45D3\uBDF3\uFEFE\u5597\uBDF4\uBDF5\uFEFE\u4C9B\uFEFE\u59C7\uBDF6" + - "\uBDF7\uBDF8\u47E6\u4E42\u536B\uBDF9\u59C8\uFEFE\uBDFA\uBDFB\u59C9\uBDFC\u59CA\uBDFD\u4B6E\uFEFE" + - "\uFEFE\u59CB\u48BA\uBDFE\u46D2\u59CC\uFEFE\uFEFE\uBE41\u52E0\uBE42\u4AD4\uBE43\uBE44\u59CD\uFEFE" + - "\uFEFE\uBE45\u53C7\uFEFE\uBE46\u59CE\uFEFE\u5385\uFEFE\u59CF\uBE47\u59D0\uFEFE\uBE48\u59D1\uFEFE" + - "\u465F\uBE49\uFEFE\u59D2\u59D3\uBE4A\u59D4\uFEFE\uBE4B\u59D5\u59D6\uFEFE\uFEFE\uBE4C\u59D7\u4690" + - "\uBE4D\uBE4E\uFEFE\u45E1\u59D8\uFEFE\u4DCD\u5159\u4E86\u4E88\u529C\uFEFE\uBE4F\u4964\u495E\uBE50" + - "\u59D9\uBE51\uBE52\uFEFE\u59DA\uBE53\u495D\uBE54\uFEFE\u4772\uBE55\uBE56\u59DD\u4CEA\u4A61\u59DC" + - "\u59DB\u4E60\u48A3\uFEFE\u59E0\u59DF\uBE57\u59DE\u4991\u45E5\uBE58\uFEFE\uBE59\u50B3\u59E1\u4C6C" + - "\u48FB\uFEFE\uFEFE\uBE5A\u47E8\u59E4\u59E2\uFEFE\uFEFE\uBE5B\uBE5C\u59E3\uFEFE\u59E5\u4698\uBE5D" + - "\uFEFE\uBE5E\uFEFE\uFEFE\uBE5F\u59E6\u4A70\u4EF5\uBE60\uBE61\u59E7\u4B5D\uBE62\uBE63\uBE64\uFEFE" + - "\u4654\u4C74\uFEFE\uFEFE\u59E8\uBE65\u48F8\uFEFE\uFEFE\u59E9\u55E0\uFFFF\u0005\uFEFE\u46E7\uBE66" + - "\u47CA\uFEFE\uBE67\uBE68\uBE69\uFEFE\uBE6A\u5097\u4BD7\uFEFE\uFEFE\uFFFE\u0005\uBE6B\uFEFE\u59EA" + - "\u4661\u4C45\u4EA3\uFEFE\uFEFE\u4895\u59F0\u59F1\uFEFE\u464F\uBE70\uBE71\uFEFE\u59EC\uFEFE\uFEFE" + - "\uFEFE\uBE72\uBE73\uBE74\u4C60\uFFFE\u0004\uBE75\u59EF\u59EE\uBE79\uBE7A\uFEFE\u4AAE\uBE7B\uFEFE" + - "\u59ED\uFEFE\uBE7C\u59EB\uBE7D\u5056\uFEFE\u59F2\uFFFF\u0007\uFEFE\uBE7E\uFEFE\uFEFE\uBE7F\uFEFE" + - "\uFEFE\uBE80\u59F7\u59FD\u59F5\uFEFE\u4CD6\uBE81\uBE82\u59FA\u4EF0\uBE83\uBE84\u59F4\uBE85\u59F9" + - "\u509F\u46AD\uFEFE\uBE86\u5081\u59F3\uFEFE\uFEFE\uBE87\u47CC\u59FC\u466E\u54DE\u59F6\u4E71\u59FB" + - "\uFEFE\uBE88\uFEFE\u5542\uFEFE\u59F8\uFEFE\uBE89\uFEFE\uBE8A\uFFFF\u0004\uFEFE\u59FE\uFFFF\u0005" + - "\uFEFE\uBE8B\u5A42\u5256\u5A4C\uFEFE\uFEFE\u5A49\uBE8C\uBE8D\uBE8E\u5A48\u4BCA\uBE8F\u5A4A\uFEFE" + - "\uFEFE\u4BD5\uBE90\u47C7\uFEFE\uBE91\u5298\uBE92\uBE93\uFEFE\u5A50\u5A41\uFEFE\uFEFE\u5A44\uFEFE" + - "\u5A47\u5A43\uBE94\u5594\u5A4B\u5A4D\u4ECE\uFEFE\uBE95\u53B8\u4C81\u5A45\u5A4F\u5A4E\u494E\uFEFE" + - "\u4BB0\u5384\uBE96\uFEFE\uFEFE\uFEFE\u4643\uFEFE\u5A46\uFFFF\u0006\uFEFE\uBE97\uBE98\uFEFE\u5A52" + - "\uBE99\u5A53\u5A55\u5A51\uBE9A\uFEFE\uBE9B\u5469\u5A57\u5A5C\u4DE3\u5544\uBE9C\uFEFE\uFEFE\uBE9D" + - "\u5A5A\uBE9E\u5091\uBE9F\u5A58\u5A59\uBEA0\uFEFE\u5A54\u5A56\uFEFE\uBEA1\uBEA2\u4AB1\u4DD8\uFEFE" + - "\uBEA3\u4DEB\uBEA4\uBEA5\u4873\u5A5B\uBEA6\u4BCD\u4965\uFFFF\u0005\uFEFE\uBEA7\uBEA8\u4C9D\u5276" + - "\u53A3\u5A64\u5554\uBEA9\u5A5E\uFEFE\uFEFE\uBEAA\u5145\u5A62\uBEAB\uFEFE\uFEFE\uFEFE\uBEAC\uFEFE" + - "\uBEAD\u485F\u5A63\u4E65\uFFFE\u0004\uBEAE\uFEFE\uFEFE\uBEB2\uBEB3\uFEFE\u4E78\uFEFE\u5A61\uBEB4" + - "\u5A65\uFEFE\uFEFE\u5A66\uBEB5\u549D\uBEB6\u4ED7\uBEB7\u5A5F\u4FE0\u5A60\u5A5D\uBEB8\u4B68\uFEFE" + - "\uBEB9\uFEFE\u554A\u506E\uFFFF\u0007\uFEFE\u54B8\u5A73\u5A68\u48B3\u5A6E\uBEBA\u5A6B\u5A6C\uBEBB" + - "\u5472\u5A6F\u5A72\uBEBC\uBEBD\uFEFE\uFEFE\u5A6D\u5282\uBEBE\u5A70\uFEFE\uFEFE\u5A6A\uBEBF\u53C8" + - "\u5098\uBEC0\uFEFE\uBEC1\u5A74\u5A75\u4763\uBEC2\u5A76\uBEC3\uBEC4\uBEC5\u5A69\uBEC6\uBEC7\uFEFE" + - "\uBEC8\u52B2\u45C6\uBEC9\uFEFE\uBECA\u47F7\u5A67\u5A71\uBECB\uFFFF\u0004\uFEFE\u5A7B\u5A7A\uFEFE" + - "\uBECC\uBECD\u5A80\uFEFE\uFEFE\uFEFE\u5A7E\uBECE\uFEFE\uFEFE\u5A81\uBECF\uBED0\u5A79\uFEFE\uBED1" + - "\uFEFE\uFEFE\u5A7F\u5A84\u5A7C\u51E3\uFEFE\uBED2\u5A85\uFEFE\u5A86\uBED3\uBED4\u5A77\u4CBE\uBED5" + - "\u5A7D\u48FD\u538E\u5A78\u4A76\uFFFF\u0004\uFEFE\u5A92\uFEFE\u52E3\uFEFE\uFEFE\u5A8A\u5A8B\u5A8C" + - "\uFEFE\uFEFE\u5A83\uBED6\u5A91\uBED7\uFEFE\u4DDB\u4DD3\uFEFE\u5A82\uFEFE\u4EB6\u528A\uFEFE\uFEFE" + - "\u5A8D\uBED8\uFEFE\u4C49\u5A8F\u4FAD\u5A90\uBED9\u5A87\u5A8E\u5A93\u48A8\u5A89\uBEDA\uFEFE\uFEFE" + - "\uBEDB\uBEDC\uFEFE\u53F4\uBEDD\uBEDE\uBEDF\u507C\uBEE0\uBEE1\uFEFE\uFEFE\u5A88\uFEFE\uFEFE\u5A99" + - "\uBEE2\uFEFE\uBEE3\u4F4A\uFEFE\u555B\u5A9A\uBEE4\uBEE5\u5A98\uFEFE\u5A96\uBEE6\u5A94\u5A95\u55CF" + - "\uFEFE\uBEE7\uBEE8\uFEFE\uBEE9\uBEEA\uFEFE\uFEFE\uFEFE\u4FFC\uBEEB\uFEFE\u53C2\uBEEC\u5175\uBEED" + - "\u5A9B\u5A97\uBEEE\u5A9C\uFEFE\uFEFE\uFEFE\u47BE\uFEFE\uFEFE\uFEFE\u4E6C\uFEFE\uBEEF\uBEF0\u5AA3" + - "\uFEFE\uBEF1\uFEFE\u51A5\uFEFE\uBEF2\uBEF3\uBEF4\u5AA1\uFEFE\uFEFE\u5AA2\u4EA4\u5AA0\u5A9F\u5A9E" + - "\u5AA4\u5A9D\u5AA6\uBEF5\uBEF6\u4EF2\uFFFF\u0004\uFEFE\uBEF7\uFFFF\u0006\uFEFE\uFFFE\u0004\uBEF8" + - "\uFEFE\uBEFC\uBEFD\u5AA8\uFEFE\uBEFE\u5AA7\uBF41\uFEFE\uBF42\uFEFE\uFEFE\uBF43\uBF44\uFEFE\uBF45" + - "\uFEFE\uFEFE\u5153\uFEFE\u5AA9\uFEFE\u5AAB\u5AAA\u4DC6\uFEFE\u5AAD\uFEFE\u5AAF\u5AAC\u5AB0\u5AAE" + - "\u5AB1\uBF46\uFEFE\uBF47\uBF48\uFEFE\uFEFE\uBF49\u5AB2\u5AB3\u5161\uFEFE\u5460\u5AB4\u517F\uFEFE" + - "\u45BA\u49DE\u4DA0\u5AB5\u5AB6\uBF4A\u4D7F\uFEFE\uFEFE\uFEFE\u5595\u5AB7\uBF4B\u646E\u5AB8\u54D9" + - "\uBF4C\u5AB9\uBF4D\uBF4E\uFEFE\uFEFE\u4764\uBF4F\uFEFE\uBF50\u5ABA\uBF51\uFEFE\uFEFE\u5ABB\u4F92" + - "\u5ABC\uFEFE\u5ABD\u5ABE\u5092\uFEFE\uFEFE\uFEFE\u45CF\uBF52\uFEFE\u4C44\uFEFE\uBF53\uFEFE\u47DC" + - "\u458C\u5ABF\uBF54\uBF55\uBF56\uFEFE\uBF57\u4DCA\u655D\u50AD\uFEFE\u45CB\uBF58\u49F1\u5AC0\uFEFE" + - "\uBF59\uBF5A\uBF5B\u47EA\uBF5C\u4981\uBF5D\uFEFE\u55D5\uFEFE\uBF5E\u5AC3\uBF5F\uFEFE\u5AC1\uFEFE" + - "\u5AC4\uFEFE\uFEFE\u5AC2\uBF60\uFEFE\uFEFE\uFEFE\u5AC5\uFFFF\u0004\uFEFE\uBF61\u54B7\uBF62\uFEFE" + - "\u4C69\uFEFE\uBF63\uFEFE\uFEFE\u4D7A\uFEFE\uFEFE\u4C76\uBF64\uFEFE\u5AC6\uBF65\u5ACA\u4C48\u48F7" + - "\uFEFE\u5AC7\u5ACD\u4EC0\uFFFF\u0004\uFEFE\u5AC8\u4EE3\uFEFE\uFEFE\uFFFE\u0004\uBF66\u4D66\u5AC9" + - "\u5ACB\u5ACE\u4751\u5ACC\u4A67\u498D\uFEFE\uFEFE\u5ADC\u4A85\uFEFE\u4E7E\uFFFF\u0007\uFEFE\u5ADA" + - "\uFEFE\uBF6A\uFEFE\uFEFE\u4FA6\u5AD3\uFFFF\u0004\uFEFE\u4C86\uFEFE\uBF6B\uFEFE\u4B90\uBF6C\uBF6D" + - "\uFEFE\u51E0\uBF6E\u5AD1\u49E1\u4D53\uBF6F\uBF70\uFEFE\uFEFE\u5AD9\uFEFE\uBF71\u4AA1\u5AD4\u5ADB" + - "\u5AD5\u5ADD\u5AD8\uFEFE\u5345\u4FBA\uBF72\u5AD2\u53A2\u5AD0\u4F61\u4BDB\u5AD7\uBF73\uBF74\u5ACF" + - "\u5045\u525C\uBF75\u4BFD\u5AD6\u4EE2\uFEFE\uFEFE\u4D77\u48E5\uFFFF\b\uFEFE\uBF76\uFEFE\u4FC5" + - "\u4EE5\u5ADF\u5AE4\uFEFE\u5AE0\uBF77\u508D\uBF78\u5AE5\u4F9E\u55B5\uFFFF\u0004\uFEFE\uBF79\uBF7A" + - "\u4DD7\u5AE6\uFEFE\u46D8\u5AE2\uBF7B\uBF7C\uFEFE\uFEFE\u47B6\u5AE3\u5489\uBF7D\uBF7E\u5ADE\uBF7F" + - "\uFEFE\uFEFE\uBF80\u4FDB\uFEFE\uBF81\uFEFE\uFEFE\uBF82\uFEFE\uBF83\u4B82\uFFFF\u0005\uFEFE\u55B1" + - "\uFFFF\u0007\uFEFE\u5AE1\u4F81\uBF84\uBF85\u548F\uFEFE\uBF86\uFEFE\u48F6\uFFFF\u0005\uFEFE\uBF87" + - "\uBF88\uFEFE\uFEFE\uBF89\u5387\uFEFE\uBF8A\u52A8\u5AE9\u5555\uFEFE\uFFFE\u0004\uBF8B\uFEFE\uBF8F" + - "\uFEFE\uFEFE\u53A0\uBF90\uBF91\u557D\u5AE8\uBF92\u5AEA\u5AE7\uFEFE\uBF93\uBF94\uBF95\u4C41\uFEFE" + - "\u5546\uBF96\uFEFE\uFEFE\uBF97\u4DDD\uFFFF\b\uFEFE\uBF98\uBF99\u5285\u4BB3\u5AF5\uFEFE\u5AF4" + - "\uBF9A\uBF9B\u4ED6\uFEFE\uFEFE\uBF9C\u5493\uFEFE\uBF9D\uBF9E\u5AEF\u4D8F\uBF9F\uFEFE\u4FC0\u54C0" + - "\uBFA0\uBFA1\uFEFE\uBFA2\u5AED\uFEFE\uBFA3\u4DC3\uBFA4\uFEFE\uFEFE\uBFA5\u4C61\u5AF2\uBFA6\uFEFE" + - "\u4EEC\uFEFE\u5AEC\u5AF1\uBFA7\uFEFE\u4CFA\uFEFE\uBFA8\uBFA9\u5AEB\uFEFE\u4D44\uBFAA\uBFAB\u4AE3" + - "\uFEFE\uFEFE\uBFAC\u5AF3\u55E6\u4B4F\u4B7F\u5AF0\uBFAD\u47A8\uBFAE\u4CAC\u48D5\u55D0\u4A60\u5AEE" + - "\u5541\uBFAF\uBFB0\uBFB1\uFEFE\uFEFE\u4DC1\uFEFE\u54CD\u5AF6\uFFFF\u0005\uFEFE\u54A3\uFEFE\uBFB2" + - "\u5AF7\uFEFE\u5AF9\uBFB3\uFEFE\u4EFD\u5B42\uBFB4\u5AFA\uFEFE\uBFB5\u5AFD\uFFFF\u0004\uFEFE\uBFB6" + - "\u4BCF\u49B9\uBFB7\u5AFE\uBFB8\uBFB9\uBFBA\u4CF2\uFEFE\uFEFE\uFEFE\u4C46\u49AA\uBFBB\uFEFE\uFEFE" + - "\uFEFE\uBFBC\u4D60\uFEFE\u5AFC\uFEFE\uBFBD\uFEFE\uFEFE\uFEFE\u5AF8\uBFBE\uFEFE\uBFBF\uFEFE\u4BF2" + - "\uFEFE\uFEFE\uFEFE\uBFC0\uBFC1\u4AD5\u5AFB\u5B41\uFEFE\uBFC2\uBFC3\u4F7E\uFFFF\u000B\uFEFE\u5B44" + - "\uFEFE\uFEFE\uBFC4\uBFC5\uFEFE\uFEFE\u4BD8\uFEFE\u5B4B\uBFC6\uFEFE\uBFC7\u5B45\uBFC8\uFEFE\u5B4C" + - "\u5B49\uBFC9\uFEFE\uFEFE\uFEFE\u5B48\uFEFE\uBFCA\uFEFE\uBFCB\uFEFE\uBFCC\uFEFE\uBFCD\uBFCE\u5B46" + - "\uFEFE\u5B4A\uBFCF\uBFD0\uFEFE\u4DC8\u528F\uFEFE\uBFD1\uBFD2\uFEFE\uFEFE\uFEFE\u5B43\uBFD3\u5B47" + - "\uFEFE\uFEFE\uFEFE\u4E49\uFEFE\uFEFE\uBFD4\u50A3\uBFD5\uFEFE\uFEFE\u4E8C\uFFFF\b\uFEFE\uBFD6" + - "\uFEFE\uFEFE\u5B4D\uBFD7\uFEFE\uFFFE\u0004\uBFD8\uFEFE\uFEFE\uFEFE\u4DCB\uFEFE\uFFFE\u0004\uBFDC" + - "\uFEFE\uBFE0\u5B50\uBFE1\uFEFE\uBFE2\uFEFE\uFEFE\uFEFE\u5B4E\uFEFE\u48D1\uFEFE\uFEFE\uFEFE\uBFE3" + - "\uFEFE\u5B4F\uFEFE\uFEFE\uFEFE\uBFE4\uBFE5\uFEFE\u5B51\uFEFE\u55F5\uFEFE\u51EF\uBFE6\uFEFE\uBFE7" + - "\uFFFF\u0005\uFEFE\u4A74\uFEFE\uBFE8\uFEFE\uBFE9\u5B5A\uFFFF\u0006\uFEFE\uBFEA\uBFEB\uBFEC\u53DE" + - "\u5B57\uFEFE\u5B55\uFEFE\uFEFE\uBFED\uBFEE\u5348\uBFEF\uFEFE\u5B53\u55DB\uBFF0\uFEFE\uBFF1\uFEFE" + - "\uBFF2\u4E7A\u5B58\uBFF3\uFEFE\uBFF4\u5B59\uFEFE\u51E1\uBFF5\u4E62\u4C77\uFEFE\u5372\uFEFE\u4EC7" + - "\uBFF6\uFFFF\u0005\uFEFE\u5B52\uFEFE\u5B56\u5B5B\uBFF7\uBFF8\uBFF9\uFEFE\u514E\u5B62\uFEFE\uBFFA" + - "\u5B5E\uFEFE\u5B5F\uFEFE\uFFFE\u0004\uBFFB\u499B\u5B54\uFEFE\uC041\uC042\u5B5D\uFEFE\u5B60\uC043" + - "\uFEFE\uC044\u5B61\uFEFE\u5B5C\uFFFF\u0005\uFEFE\u5B65\u5B66\u5543\u5B67\uC045\uC046\u4FD6\u5B64" + - "\uFEFE\uC047\uC048\uFEFE\u4FCD\uC049\uFEFE\u5B68\uC04A\u5B63\u5B6B\uFEFE\u5B69\uC04B\u5B6A\uC04C" + - "\uFEFE\uFEFE\u5B6C\uC04D\uFEFE\u5B6E\u55F6\uC04E\u5B6D\uC04F\uFEFE\uFEFE\uC050\u5B72\uFEFE\uFEFE" + - "\uC051\uC052\uC053\uFFFF\u0004\uFEFE\uC054\uFEFE\uFEFE\uFEFE\uC055\uC056\uFEFE\uC057\uFEFE\u5B6F" + - "\uC058\uFEFE\uC059\u5B70\u5B71\uC05A\uC05B\uFEFE\uFEFE\uC05C\u5B74\u5B73\uFEFE\uC05D\uFEFE\uFEFE" + - "\uC05E\u527F\u5B75\u5B76\uFEFE\uC05F\u477B\uFEFE\uC060\uFEFE\uFEFE\u5B77\u5B78\u5B7A\u5B79\u5B7B" + - "\u488F\uC061\u4BC5\uC062\uC063\u48AF\u45C7\uFEFE\uFEFE\uFEFE\uC064\uFEFE\u4AF7\uFEFE\uC065\u5B7D" + - "\uC066\uFEFE\uFEFE\uFEFE\u5B80\u5B7E\u4647\uC067\u4C5C\uC068\uFEFE\uC069\u5B82\u5B7F\u4B8A\u5B81" + - "\u47A5\uFEFE\uFEFE\uFEFE\u5B83\u51B1\uC06A\uC06B\uFEFE\u4FCF\u4AC9\uFEFE\uFEFE\u49F2\uC06C\uFEFE" + - "\uFEFE\uFEFE\uC06D\u47B0\uFEFE\uFEFE\uFEFE\u46CC\uFEFE\u5B84\uFEFE\u477C\u4BF3\uFEFE\u4951\u5B85" + - "\uFEFE\uC06E\uFEFE\uFEFE\uC06F\uFEFE\uFEFE\uFEFE\uC070\u5B86\u5B87\uFEFE\uC071\uFEFE\u45CA\u58ED" + - "\u468E\uC072\uFEFE\u519D\uFEFE\u47DB\uFEFE\u4B80\u52E4\uC073\uFEFE\uFEFE\uC074\uFEFE\u4E83\uC075" + - "\u464E\uFEFE\u5B89\u4BD1\uC076\uFEFE\u5B8A\uC077\u5581\uFEFE\uC078\u54CF\u5141\uC079\u51C2\uFEFE" + - "\uFEFE\uFEFE\u5B8B\u4EFC\u4989\uC07A\u4EA5\u4587\uFEFE\uC07B\uC07C\uC07D\uFEFE\uFEFE\u5B8C\uFEFE" + - "\u45CD\uFEFE\uFEFE\u4DA4\u4888\uFEFE\uC07E\uFEFE\u5B8F\uC07F\u5B8D\u5B90\u4ACF\u5B8E\uFEFE\uC080" + - "\uC081\uFEFE\u4D7B\u5B91\uFEFE\uC082\u4ADC\uC083\uFEFE\u5B92\uFEFE\uC084\uFEFE\uC085\u4DAB\uC086" + - "\u5B93\uFEFE\u5165\uFEFE\uFEFE\uFEFE\uC087\u5B95\u5B94\u4B77\uFEFE\uFEFE\u4562\u4D9D\u4C7B\u4D6A" + - "\u46E9\uFEFE\uFEFE\u4D67\u47EC\uFEFE\uFEFE\uC088\u5B96\uC089\uFEFE\uC08A\uC08B\uFEFE\uFEFE\uFEFE" + - "\uC08C\u4FA3\u5B9C\uFEFE\uFEFE\uC08D\uC08E\u5B97\uFEFE\u5B99\u5B9B\uC08F\uFEFE\u4FE7\u46FE\uC090" + - "\u5B9D\u528E\uFEFE\u46D1\uC091\u45A6\u54E8\uFEFE\uC092\uC093\u47E9\u4C59\u5B98\uC094\uFFFF\u0005" + - "\uFEFE\u5BA3\uC095\u5BA1\u47A9\u47AC\uC096\uC097\uC098\u5BA4\u4662\uC099\u559D\u48E8\uFFFE\u0004" + - "\uC09A\u45B3\u5BA0\u4BBB\uC09E\u52EB\uFEFE\uC09F\u5BA2\u5B9F\u5193\uC0A0\uFEFE\uC0A1\uFEFE\u4F9F" + - "\u4C98\uFEFE\uFEFE\u5B9E\uC0A2\u5251\u4651\u48B0\u5BA5\uC0A3\uC0A4\uFEFE\uFEFE\u5BA6\uC0A5\u4BB2" + - "\uC0A6\uFEFE\uC0A7\u51EA\uFEFE\uC0A8\u54C3\uFFFF\u0004\uFEFE\u5BA8\uC0A9\u5BAB\uFEFE\uC0AA\uC0AB" + - "\u5BAD\u5BA9\u4FCE\uC0AC\uC0AD\u5BAC\uFEFE\u5BAA\u5BA7\u556D\u50A0\u51B2\u4CB6\uC0AE\uC0AF\uC0B0" + - "\uFEFE\u49F8\u4993\u5BB0\uFEFE\uFEFE\u5BAF\u4795\uC0B1\u4AF8\uC0B2\uC0B3\uC0B4\u46A8\uC0B5\uC0B6" + - "\uFEFE\uC0B7\uC0B8\uC0B9\u4C83\uFEFE\u5BB1\u5BB3\uFEFE\uFEFE\u4F46\u5BB2\u4ED1\uFEFE\uC0BA\uC0BB" + - "\uC0BC\u4FAB\uFEFE\uC0BD\u4FBE\uC0BE\uFEFE\uFEFE\uFEFE\u4D6C\u4BE2\u5BB5\u5BB4\uC0BF\uC0C0\uC0C1" + - "\u5BB7\uFEFE\uC0C2\u5BB6\uFEFE\u4CC7\uFEFE\uC0C3\uFEFE\u50CC\uFFFF\u0004\uFEFE\u5093\uFEFE\uC0C4" + - "\u4AFE\uFEFE\uFEFE\uC0C5\u5BB8\uFEFE\u4CB2\uC0C6\uFEFE\uFEFE\u5BBF\u5243\uFEFE\uC0C7\u5BBE\uFEFE" + - "\u5BBD\u5BBB\uC0C8\u5BBA\uC0C9\uC0CA\u5BB9\uFEFE\uFEFE\u4C56\uC0CB\u5BBC\uFEFE\uFEFE\uC0CC\uFEFE" + - "\uC0CD\uC0CE\uFFFF\u0004\uFEFE\uC0CF\uFEFE\u5BC0\uFEFE\uFEFE\u5152\u5BC1\uC0D0\u4BFE\u52A6\uFEFE" + - "\uC0D1\u51CC\uFFFF\u0005\uFEFE\u5BC2\uFEFE\uC0D2\u5BC3\uFEFE\uC0D3\uC0D4\uFEFE\uC0D5\uFEFE\u5BC4" + - "\uFEFE\u49B6\u4EBC\u4A6D\u5BC5\uFEFE\u5BC6\u479D\u4ED2\u5BC7\u5397\u578D\u495F\u5166\u4BC3\u46F5" + - "\uFEFE\uFEFE\u56AC\uFEFE\uC0D6\uFEFE\uC0D7\u4561\u4685\uFEFE\u4BC4\uFEFE\u47D4\u5BC8\u54FD\uFEFE" + - "\uFEFE\uFEFE\uC0D8\u4FA4\u55F3\u5BCA\u486E\uFEFE\uC0D9\uFEFE\u47BB\uC0DA\u475C\u5BCB\u468B\uC0DB" + - "\uFEFE\uC0DC\uFEFE\uFEFE\uFEFE\u5BCD\u5BCE\u456C\uFEFE\u49C6\u4746\u4566\u48F9\u5BD0\uFEFE\uFEFE" + - "\u4D42\uFEFE\uC0DD\u4EA2\uFEFE\u5BD2\u5BD3\u5BD4\uFEFE\u4D96\uFEFE\uFEFE\u50F0\uC0DE\u5BD1\uFEFE" + - "\u534F\uFEFE\uFEFE\uFEFE\uC0DF\u5BD5\uC0E0\uC0E1\u4668\uFEFE\uFEFE\uC0E2\uFEFE\u4E51\u50D0\u46BC" + - "\u4556\uFEFE\u54C1\uC0E3\uC0E4\u50F4\uFEFE\uFEFE\u5BD7\uFEFE\uFEFE\u525D\uC0E5\u5BD6\u4B4B\u5480" + - "\u475E\u51A6\u5291\u5BD9\u4676\u5BD8\uFEFE\uFEFE\uFEFE\u5BDE\uFEFE\uC0E6\u508B\uC0E7\u4C63\u5BDC" + - "\u4557\u5B9A\u5BE0\uC0E8\u4AA6\uC0E9\u5280\uFEFE\uFEFE\uFEFE\uC0EA\u54DF\uFEFE\u4578\u46B4\uFEFE" + - "\uC0EB\uFEFE\uFEFE\uC0EC\u5BDB\uFEFE\u525E\uFEFE\u5BDA\uFEFE\u5BDF\u54F2\uFEFE\uC0ED\uC0EE\u4AE2" + - "\uC0EF\uFEFE\uC0F0\uFEFE\u4F78\uC0F1\u45A2\uC0F2\uC0F3\u49D9\uC0F4\u47B9\u4672\uFEFE\uFEFE\u4FD2" + - "\u5BE2\u52D0\uFEFE\uFEFE\uFEFE\u5BE1\uFEFE\uFEFE\u5BDD\uFFFF\u0005\uFEFE\u5061\uC0F5\uC0F6\uC0F7" + - "\u54C9\u5BE6\uC0F8\u4EE8\u5BE4\u5BE9\u5BF2\uFEFE\u5BE3\uC0F9\uC0FA\uFEFE\uFEFE\u5BF0\u55CD\uC0FB" + - "\uC0FC\u4A7F\uC0FD\u5BF4\uFEFE\uC0FE\uC141\u52D9\uFEFE\uFEFE\uFEFE\u5BF1\u4980\u504A\u4EC1\uC142" + - "\u489B\u4DEA\uFEFE\uFEFE\uC143\u4FD8\uC144\u4EE1\uFEFE\uC145\u5BED\u54F3\uFEFE\uFEFE\uC146\u5BEE" + - "\uFEFE\u5BEB\uFEFE\uC147\u5BEA\uFEFE\u5BE8\uFEFE\uFEFE\u5BE7\uFEFE\u5BEF\u5BE5\uC148\u4BEA\uC149" + - "\u46EA\u47A7\u51F1\uC14A\uC14B\uFEFE\uC14C\uFEFE\u4773\uFEFE\uFEFE\u5054\u4AC1\uFEFE\u5BF3\u52D1" + - "\u47D3\u45FA\u51F1\uFFFF\r\uFEFE\u50E3\uC14D\uFEFE\u4DCC\u479B\uFEFE\uC14E\uFEFE\uFEFE\uFEFE" + - "\uC14F\u5BF5\uC150\uFEFE\u48BF\u5242\uFFFF\u0004\uFEFE\uC151\uC152\u52DE\u4856\u52E2\uC153\uC154" + - "\uFEFE\uC155\uC156\uC157\u5BFA\uC158\u55DA\uFEFE\uFEFE\uFEFE\u4B9E\u4667\uFEFE\uC159\u47DE\u4DE0" + - "\uFEFE\uC15A\u5BF8\u50D6\u49AB\u4ADA\u5BF9\uC15B\u5BF6\uFEFE\u48F1\uFEFE\uC15C\uFEFE\uC15D\u5BF7" + - "\u5BFB\uFEFE\u49C0\u4879\u5BEC\u536D\u534B\uC15E\uFEFE\uC15F\uC160\u5BFD\uFEFE\uC161\u4771\u4D88" + - "\uFEFE\u51F3\uFEFE\uFEFE\uFEFE\u5BFC\uFEFE\uFEFE\uFEFE\u5046\uFEFE\uFEFE\uFEFE\uC162\uFEFE\uFEFE" + - "\uFFFE\u0005\uC163\uFEFE\u5C4B\uC168\u4E77\u5C41\uFEFE\uFFFE\u0004\uC169\uFEFE\u5C44\u5C42\uFEFE" + - "\u4E44\uC16D\u5C48\uC16E\u4798\uC16F\uFEFE\uC170\uFFFF\u0004\uFEFE\u5BFE\u5BFE\u5C45\uFEFE\uFEFE" + - "\uFEFE\u50DA\u5C47\uFEFE\uC171\u52CC\uC172\uFEFE\uC173\u53BC\uC174\u4E92\uFEFE\u5C43\u52C6\uC175" + - "\u50AC\uC176\uFEFE\uC177\u58A4\u52D3\u4858\uC178\uC179\uFEFE\uFEFE\u5C46\uC17A\u51E4\u4682\u5359" + - "\uC17B\u5361\uFEFE\u5C4C\u49AD\uFEFE\uFEFE\u5C4A\u5C4D\uC17C\u5C49\uFFFF\u0007\uFEFE\u4EB1\uC17D" + - "\u5C60\uFEFE\u5386\u55CA\u5C50\u4EF1\uC17E\u5C56\uFEFE\u5C5F\uC17F\uC180\u4B5A\uC181\u5C57\u5C59" + - "\uC182\u54C2\u5C52\uC183\u4BEF\uFEFE\uC184\uC185\uFEFE\u4EA9\u5C5E\u5C54\uFEFE\u5C5D\uFEFE\uC186" + - "\uFEFE\u5C58\uC187\uFEFE\uFFFE\u0004\uC188\u459D\u5C5B\uC18C\uC18D\u5375\uFEFE\uFEFE\uC18E\uC18F" + - "\uFEFE\uFEFE\u5494\u55B6\uC190\uC191\uC192\uFEFE\uFEFE\u5468\u5C4F\uFEFE\uFEFE\u5C5C\u4FF7\uC193" + - "\uFEFE\u5C51\uC194\uC195\u4DFD\u5C55\u47C5\u4BA0\u5C4E\uC196\uC197\u5C5A\uC198\uFEFE\uFEFE\uC199" + - "\uC19A\uFEFE\u4FED\u5370\u5163\u486D\uFFFF\u0004\uFEFE\u5C63\u5C61\u5C64\uFEFE\u53FA\u5C53\uFEFE" + - "\u5C65\uFEFE\u5C62\uFFFF\u0005\uFEFE\u5C71\uC19B\uFEFE\uC19C\u54A7\uC19D\u5C69\uFEFE\uC19E\u52ED" + - "\uFEFE\uC19F\uFEFE\u5C6F\uFEFE\u4CBA\uFEFE\uFEFE\uC1A0\uFEFE\uFEFE\uC1A1\uFEFE\uFEFE\uFEFE\uC1A2" + - "\u51D7\uFEFE\uFEFE\uFEFE\uC1A3\uFFFF\u0004\uFEFE\u5295\u5C6B\u55C5\uFEFE\uC1A4\uFEFE\u5C70\u534C" + - "\uC1A5\u54E2\u5C73\u5C72\uFEFE\u4ADF\u527C\u4D93\uFFFE\u0004\uC1A6\uFEFE\u5C6E\uC1AA\u5C6C\u54A2" + - "\uC1AB\u456B\u53EF\u4FAE\uC1AC\uC1AD\uC1AE\u52B3\u5C6D\u49B7\uFEFE\u5C68\u5C6A\u5C67\uC1AF\uC1B0" + - "\u52BA\u4761\u5C74\uC1B1\uC1B2\u5C75\u4C42\uFFFF\u0007\uFEFE\u4B52\uFEFE\uFEFE\uC1B3\u49EB\uFEFE" + - "\uFEFE\u5476\uC1B4\uFEFE\u55C7\u5C86\uC1B5\uFEFE\u5C79\uFEFE\uFEFE\u4D7E\u5C85\uFEFE\uFEFE\uFEFE" + - "\u5C84\uC1B6\uFEFE\uFEFE\uFEFE\uC1B7\uC1B8\u538D\uC1B9\uFEFE\uFEFE\uC1BA\uFEFE\uC1BB\u514A\uC1BC" + - "\uFEFE\u5C80\u5C76\uFEFE\u53B2\uFEFE\uFEFE\uC1BD\uC1BE\uFEFE\uC1BF\u5C82\uC1C0\uFEFE\u5C7C\u5C77" + - "\uFEFE\u5C7A\uFEFE\u5C83\uFEFE\uC1C1\uFEFE\u4DB9\uC1C2\uFEFE\u5C7F\u4796\u4EFA\u52DB\u5C7D\uFEFE" + - "\u548C\uC1C3\uFEFE\u5C7B\uFEFE\uFEFE\uC1C4\uC1C5\u4848\u6881\uFEFE\uFEFE\uFEFE\u5C81\u5C87\uFEFE" + - "\uFEFE\uFEFE\u5C90\uFEFE\uFEFE\uC1C6\uFEFE\u5C8F\u5C89\uFEFE\uFEFE\u5C94\uFEFE\u5C92\uC1C7\uC1C8" + - "\uFEFE\uC1C9\u5C8E\uC1CA\uFEFE\uC1CB\uFEFE\uFEFE\uFEFE\u5C8D\uFEFE\u4B5C\uFEFE\u4DB7\uC1CC\u5C8C" + - "\uC1CD\uC1CE\u5C8A\uC1CF\uFEFE\u53BB\uFFFF\u0004\uFEFE\u5C95\u494F\u5C9D\uFEFE\uFEFE\uC1D0\uFEFE" + - "\uC1D1\u5C97\u5C99\u5C93\uC1D2\uFEFE\u538B\uFEFE\u4966\uC1D3\u5C8B\uFEFE\uC1D4\u5C91\u539B\uC1D5" + - "\u4864\u5C96\u5C98\uC1D6\uFEFE\uFEFE\uFEFE\uC1D7\u48DC\u45F2\u4B6F\uFEFE\uFEFE\u5C88\uFEFE\u5C9A" + - "\uFEFE\uC1D8\uFEFE\uC1D9\u5585\u5C9F\uC1DA\u5CA7\u46CF\u4E69\uC1DB\uFEFE\u4BBE\uC1DC\uC1DD\uFFFF" + - "\u0004\uFEFE\u5C9C\uC1DE\u5CA6\u5CA1\u5CA5\uC1DF\uC1E0\u4589\uFEFE\uFEFE\uC1E1\uFEFE\uC1E2\uC1E3" + - "\uC1E4\uFEFE\uFEFE\uC1E5\uC1E6\uFEFE\u4BC2\u5CA3\uFEFE\uC1E7\uFEFE\uFEFE\uFEFE\u4579\uFEFE\u55D4" + - "\u5CA2\uFEFE\uC1E8\uFEFE\u5CA4\uC1E9\uFEFE\uFEFE\uC1EA\u5C9B\uFFFF\u0005\uFEFE\uC1EB\u5CA8\u5CA9" + - "\uFFFF\u0004\uFEFE\u5CA0\uFFFF\u0005\uFEFE\u5CAF\u4FB2\u4FF5\uC1EC\uFEFE\uC1ED\u5CAC\uFEFE\uC1EE" + - "\uC1EF\uFEFE\uC1F0\uFEFE\uC1F1\uFEFE\u5CAB\u55EE\uFEFE\u5CAA\uC1F2\uFFFF\u0005\uFEFE\u5CB0\uFEFE" + - "\uFEFE\uFEFE\uC1F3\u4D55\uC1F4\uC1F5\uC1F6\u5C9E\uFEFE\u5CAD\u5CAE\uFEFE\uC1F7\uFFFF\u0004\uFEFE" + - "\u5CB2\uC1F8\u5CB1\uFEFE\u545D\uC1F9\uC1FA\uC1FB\uFEFE\u5CB6\uC1FC\uFEFE\uFEFE\uFEFE\u5CB5\uFEFE" + - "\uFEFE\u5CB3\uFEFE\uC1FD\uC1FE\uC241\uFEFE\u5CB7\u5CB4\u528B\uFEFE\uFEFE\uC242\uFEFE\uC243\uC244" + - "\uFEFE\uFEFE\uC245\uFEFE\uFEFE\uFEFE\uC246\u5CBA\uFEFE\u5586\uC247\uC248\uC249\uFEFE\uFEFE\uFEFE" + - "\u5CBB\u4DA6\uC24A\uC24B\u5CB8\u5362\uFEFE\uFEFE\u5CB9\uFEFE\u5CBC\uFEFE\uFEFE\uC24C\u51C5\uFEFE" + - "\u5CBF\uFEFE\uC24D\uFEFE\uFEFE\uFEFE\uC24E\uC24F\uC250\uFFFF\u0007\uFEFE\u5CC2\u52EE\uC251\uC252" + - "\uFFFF\u0004\uFEFE\uC253\uC254\u4EDE\u5CC0\uC255\uC256\uFEFE\uC257\u5CC1\uFFFF\u0004\uFEFE\uC258" + - "\uC259\uC25A\u5CC3\uFEFE\uFEFE\uFEFE\u5CC4\uC25B\uFEFE\uFEFE\uFEFE\uC25C\uFEFE\u55F7\uC25D\u5CC5" + - "\u4CB5\u4597\uFEFE\u4B9D\uC25E\uFEFE\uFEFE\u4AA0\uC25F\uFEFE\uFEFE\uC260\uC261\uFEFE\uFEFE\uC262" + - "\uFEFE\uFEFE\u4BF6\uFEFE\uFEFE\uC263\uC264\u5CC7\u5CC6\u5CC8\u517D\uC265\uFEFE\u4CF8\u4EFB\uC266" + - "\uFEFE\uFEFE\uFEFE\u5CCC\uFEFE\uFEFE\uC267\u5CCB\uFEFE\u5CCD\uC268\uFEFE\u46F7\uC269\u5487\uFEFE" + - "\u5CCE\uFEFE\uC26A\u4D4E\u5CD0\uFEFE\uC26B\uFEFE\uC26C\u5CCF\uFEFE\u5CD1\uFEFE\uC26D\uFEFE\u5CD2" + - "\uC26E\u5CD3\u48D8\u4577\u4D4C\uFEFE\u45B1\uC26F\uFEFE\u47D8\u558E\uC270\uFEFE\uFEFE\uC271\u4A9F" + - "\uC272\uFEFE\uFEFE\u48E4\u4955\uC273\uFEFE\uFEFE\u5CD4\u5CD5\uFEFE\u4999\uFEFE\uC274\uC275\u5CD6" + - "\u5CD7\uFEFE\uC276\u5CD9\u5CD8\uC277\u4F42\uFEFE\uFEFE\u53A4\u4865\u4992\uFEFE\u5CDA\uFFFF\u0007" + - "\uFEFE\u5CDC\u4E73\uC278\u5CDB\uFEFE\uFEFE\uC279\uFEFE\uFEFE\u5CDD\uC27A\uC27B\uFEFE\uC27C\uC27D" + - "\u5CDE\uFEFE\uFEFE\uFEFE\uC27E\uC27F\u5CDF\u5CE0\uC280\uC281\uC282\u5CE1\uC283\u5CE2\u5CE3\u5CE4" + - "\u5459\u47ED\uFEFE\u5CE5\uC284\uC285\u49E9\u50C0\u5CE6\uC286\uC287\u4849\u587F\uFEFE\uFEFE\uC288" + - "\uC289\u4A5B\u5CE7\uFEFE\uFEFE\uC28A\uFEFE\u5CE8\uC28B\u4969\u49F5\uFEFE\uFEFE\uFEFE\u4C97\u5CE9" + - "\u474E\uFEFE\u5CEA\uFEFE\u53D7\uFEFE\uC28C\u46E2\uFEFE\uFEFE\uFEFE\u5CEB\uFEFE\uC28D\uFEFE\uC28E" + - "\uFEFE\uFEFE\uC28F\uC290\uFEFE\uFEFE\uFEFE\u5CED\u5CEC\uFEFE\uC291\u5CEF\uFEFE\uC292\uFEFE\u5CEE" + - "\uFEFE\uFEFE\uFEFE\uC293\uFEFE\uC294\uFFFF\u0005\uFEFE\uC295\uFEFE\uFEFE\uC296\uFEFE\uC297\uC298" + - "\uFEFE\uFEFE\u5CF0\uC299\uFEFE\uFEFE\uFEFE\uC29A\uC29B\u488E\uC29C\u4756\uC29D\u5CF1\u5CF2\uFEFE" + - "\uFEFE\u45B9\uFEFE\uC29E\uFEFE\u5CF3\uFEFE\uFEFE\uFEFE\uC29F\uFEFE\uFEFE\uFEFE\u5CF5\u5CF4\uFEFE" + - "\uC2A0\uC2A1\uC2A2\uFEFE\uFEFE\uFEFE\uC2A3\uFEFE\uC2A4\uFFFF\u0004\uFEFE\uC2A5\u459C\uC2A6\uC2A7" + - "\u4CA4\u45FB\uFEFE\uC2A8\uC2A9\uFEFE\uFEFE\u556E\u5CF6\u534D\u4D84\u49A0\uFFFF\u0007\uFEFE\uC2AA" + - "\uC2AB\uFEFE\uC2AC\u505E\uC2AD\u506A\uFEFE\uC2AE\uFEFE\uC2AF\u5CF8\uFEFE\u4EC4\uFEFE\uC2B0\u4E82" + - "\uC2B1\u5CF9\u555E\u5CF7\u45AD\u45E8\uFEFE\u5CFA\uFFFF\u0004\uFEFE\uC2B2\u5D45\uFEFE\u52B4\uC2B3" + - "\uFEFE\uC2B4\uFEFE\u5CFE\u50D2\uFEFE\u50C8\u5D46\uC2B5\uFEFE\uC2B6\uFEFE\uC2B7\uC2B8\u47A4\uC2B9" + - "\uFEFE\u494C\u5D44\uFEFE\uFEFE\u5D42\u5CFB\u55D9\uFEFE\uC2BA\u5CFD\uC2BB\u4C8F\uC2BC\uFEFE\uFEFE" + - "\u5598\u5CFC\uFEFE\uFEFE\u5D48\uFEFE\u5D47\u4FF8\uC2BD\uC2BE\u47FD\uC2BF\uC2C0\u4EAD\u5D41\u5D43" + - "\uC2C1\uFEFE\uFEFE\uC2C2\uFEFE\u5075\u4585\uFFFF\b\uFEFE\u53EC\uFEFE\uFEFE\u5D4D\uFEFE\uC2C3" + - "\u5D50\uC2C4\u465A\uC2C5\uFEFE\uFEFE\uFEFE\u4EAA\u465C\u5D52\u4584\u46C6\u5D4B\u5D51\u4E6F\uFEFE" + - "\u4A58\uC2C6\uFEFE\u5D49\u5D4C\uC2C7\uFEFE\uFEFE\u46EE\u4DB8\uFEFE\u51FD\uC2C8\uFEFE\uFFFE\u0004" + - "\uC2C9\u54D7\uC2CD\u464A\uC2CE\u55C6\uFEFE\u5D55\u5D4E\u5D53\uC2CF\u5D4F\uFEFE\uFEFE\uC2D0\u4E87" + - "\u46CA\u4D4B\uFEFE\u4E56\uFEFE\uC2D1\u4944\uC2D2\u5D56\uC2D3\uC2D4\uFEFE\uC2D5\u5D54\u46F3\u5D4A" + - "\uC2D6\u4F57\uC2D7\uFFFF\u000F\uFEFE\u5D58\uFEFE\uFEFE\uC2D8\uFEFE\uFEFE\uC2D9\u45DA\u5D5E\uFEFE" + - "\uC2DA\uC2DB\uFEFE\uC2DC\u5D5D\uC2DD\uFEFE\uFEFE\uFEFE\u4A4E\uFEFE\u52B6\uC2DE\u5450\uFEFE\uFEFE" + - "\u4D98\u5D57\uFFFF\u0005\uFEFE\u45DC\uC2DF\uC2E0\uC2E1\u50B7\u4FD4\u5D5A\uFEFE\uFEFE\uC2E2\uC2E3" + - "\uFEFE\uC2E4\u4B72\u5D5C\uFEFE\u52AC\u5D59\uFEFE\u50BC\uC2E5\uFEFE\u47B4\uC2E6\u5D5B\u4A72\uC2E7" + - "\uFEFE\u46FC\uFEFE\uFEFE\u4CC9\u468D\uFFFF\u0011\uFEFE\uC2E8\uFEFE\u5D66\u5D64\uFEFE\u45EA\uFEFE" + - "\uC2E9\uC2EA\uFEFE\uC2EB\uFEFE\u5D5F\u5D63\uC2EC\u466B\uC2ED\uFEFE\u46EB\u4A9D\uFEFE\u55CC\uFEFE" + - "\u4A8C\u5D62\uC2EE\uFEFE\uFEFE\uFEFE\u4B7E\uFEFE\uFEFE\u45A7\u4D41\u5D65\uFEFE\uFEFE\uC2EF\uFFFF" + - "\u0005\uFEFE\uC2F0\uFEFE\uFEFE\u5D6A\uFEFE\u5D60\u486B\uFEFE\uFEFE\uFEFE\u4F7D\uFEFE\u5D67\uFEFE" + - "\uFEFE\uC2F1\uC2F2\u5D61\uC2F3\u5D68\u5D6B\uC2F4\uC2F5\u4DDA\uFEFE\u5D69\u5550\uFFFF\r\uFEFE" + - "\uC2F6\uFEFE\u5D72\uFEFE\uFEFE\u4F91\uFEFE\uFEFE\u4A45\uFEFE\uC2F7\u5D6F\uFEFE\uC2F8\u5D73\uC2F9" + - "\uFEFE\uFEFE\u4E74\uC2FA\uFEFE\uC2FB\u4A88\uFEFE\uFEFE\uFEFE\uC2FC\u5D7C\u5D75\u5D71\uC2FD\uFEFE" + - "\uC2FE\u52C7\u5D78\uFEFE\uC341\u5D74\uFEFE\u4ABF\u5D7B\uFEFE\uFEFE\u5D82\uC342\uFEFE\u55E1\u5D7E" + - "\uFEFE\uC343\uFEFE\uC344\u5D77\uC345\uC346\u4CA5\uC347\uFEFE\u5D81\uC348\u5D70\uFEFE\u5D79\uC349" + - "\u5D83\u554E\u5D76\uFEFE\u5D84\uC34A\uC34B\u4777\u5D7F\u4894\uC34C\u48EA\uC34D\u4B46\u5D7A\u5D6C" + - "\u5D7D\u4A91\u5D80\uFEFE\uFEFE\uFEFE\uC34E\uFEFE\uFEFE\uFEFE\uC34F\u4596\uFEFE\u5441\u4769\u4AC0" + - "\u5D6D\u4892\uFFFF\u0007\uFEFE\u5198\uFEFE\u5164\uFEFE\uFEFE\uFEFE\u5D87\u50E4\u478A\uFEFE\u5D99" + - "\uC350\u5D92\u527A\u45D2\uC351\u5D8C\u5D98\u4E43\u51A0\u5D93\uFEFE\u4950\uFEFE\u5D8F\u4945\u5D85" + - "\u5D6E\u48C6\uFEFE\uFEFE\uC352\uFEFE\uFEFE\uFEFE\uC353\uFEFE\u5D9A\u5D8A\u5D96\uC354\u5D95\uFEFE" + - "\u5D8B\uFFFF\u0004\uFEFE\u5D94\uC355\uC356\uFEFE\uFEFE\uC357\uC358\u4C88\uC359\uFEFE\u5D91\u5D97" + - "\uC35A\uFEFE\uFFFE\u0004\uC35B\uFEFE\u4D52\uC35F\u5155\uFEFE\uFEFE\u53F3\u5D8E\uC360\uC361\u5D89" + - "\uFEFE\uFEFE\uC362\uC363\uFEFE\uFEFE\uFEFE\u4FBD\uC364\uFEFE\uFEFE\u5D8D\uFEFE\uFEFE\u5D86\u48BD" + - "\uFEFE\uFEFE\u5D88\uC365\uFEFE\uFEFE\u5D90\uFFFF\u0004\uFEFE\uC366\uFEFE\uC367\u4D6B\u4C90\u475B" + - "\uFEFE\u5D9B\uFFFF\t\uFEFE\u54FA\uC368\uFEFE\u5DA5\u47FC\uFEFE\uFEFE\uC369\uFEFE\uFEFE\u46CE" + - "\uFEFE\u5D9D\uC36A\uFEFE\uFEFE\u4DC4\u4A4D\uFEFE\u5DA8\uC36B\uFEFE\u5271\uFEFE\uFEFE\u5376\uFEFE" + - "\uC36C\uFEFE\uFEFE\u5D9C\uFEFE\uFEFE\uC36D\uC36E\u5DA0\uFEFE\uC36F\u5DA2\uC370\uFEFE\uFEFE\u48BE" + - "\u5D9E\uFEFE\uFEFE\u5497\uC371\uFEFE\u5D9F\uFEFE\u5DA6\uC372\uC373\u5DA7\uC374\u5DA1\u4EE6\uFEFE" + - "\uC375\uC376\u52A9\uC377\u4857\u5DB3\uC378\uC379\uC37A\uFEFE\u4BA2\uFEFE\u524A\u5DA3\u5DA4\uFFFF" + - "\u0007\uFEFE\u47A3\u4DA1\uFFFF\f\uFEFE\uC37B\u5DAB\uC37C\uC37D\u5DB1\uFEFE\uFEFE\u5DAF\uFEFE" + - "\u4FB7\uFEFE\uFEFE\u5DB7\u5DAC\uC37E\uFEFE\uC37F\uFEFE\uC380\u5DAD\u5DB4\uFEFE\u4B78\u4FBC\uFEFE" + - "\uC381\uFEFE\u4DAE\uFEFE\uC382\u54D0\uC383\uFEFE\uC384\uC385\uFEFE\u50C4\uFEFE\u5575\uFEFE\u5DB6" + - "\u49ED\u54A1\uC386\uFEFE\uC387\uFEFE\uC388\uC389\uFFFF\u0004\uFEFE\u508E\uFEFE\u4F58\u54E0\uFEFE" + - "\uFEFE\uC38A\uFEFE\uFEFE\uC38B\uC38C\u4F6E\u4E8A\uC38D\uFEFE\uC38E\uC38F\u5DB0\u5DB2\uC390\uFEFE" + - "\uFEFE\uC391\uFEFE\u4D73\uFEFE\uFEFE\uC392\uC393\uFEFE\u5DB5\u5DAE\uFEFE\u5DA9\uFEFE\uFEFE\uFEFE" + - "\u5DAA\uFFFF\t\uFEFE\uC394\uFEFE\uC395\uC396\uC397\u4AC2\uFEFE\uFEFE\uC398\u5DC3\uC399\uC39A" + - "\u5DBD\u4DC0\uC39B\uC39C\u46C2\uFEFE\uC39D\uC39E\uFEFE\u4AD2\uFEFE\u5DC7\uFEFE\uC39F\uFEFE\uFEFE" + - "\uFEFE\uC3A0\u5DBE\u4C93\u5DBC\u5446\uFEFE\uFEFE\uFEFE\u5DBF\uFEFE\uFEFE\uFEFE\u5DBA\uFEFE\u5DB9" + - "\uFEFE\u5DC2\uC3A1\uC3A2\uFEFE\u5DBB\u55A0\u5DC0\uC3A3\u4887\uFEFE\u5DB8\uC3A4\u5DC1\uFEFE\uFEFE" + - "\uC3A5\uC3A6\uC3A7\u5DC5\uFEFE\uC3A8\u5DC6\uC3A9\uC3AA\uC3AB\uFEFE\uC3AC\u54BA\uFEFE\uFEFE\uC3AD" + - "\uFFFF\u0004\uFEFE\uC3AE\uC3AF\u5DCB\uFEFE\u5DC9\u4E4B\uFFFE\u0004\uC3B0\uFEFE\u5DCE\uFEFE\uFEFE" + - "\uFEFE\uC3B4\uC3B5\uC3B6\u5589\uFEFE\u5DC8\uFEFE\u5DCA\uC3B7\uFEFE\uFEFE\u5DCC\uFEFE\uFEFE\uC3B8" + - "\uFEFE\uFEFE\uFEFE\u4BD0\u50BE\u5DCF\u4ACE\uFEFE\uC3B9\u5DC4\uC3BA\uC3BB\uFEFE\uC3BC\uFFFF\t" + - "\uFEFE\u5DD4\u5DD1\uFEFE\uFEFE\u5DD3\uFEFE\uC3BD\u5DCD\uFEFE\uFEFE\uC3BE\u5DD0\u5380\u507E\uFEFE" + - "\uFEFE\u51D2\uFEFE\uFEFE\uFEFE\uC3BF\uC3C0\uFEFE\u55A3\u5DD2\uFEFE\u5DD6\u4DD4\uC3C1\u5055\uFEFE" + - "\u5DE2\uFEFE\u5DD5\u6658\uFEFE\uFEFE\uC3C2\u5DDB\uFEFE\uC3C3\uC3C4\u5187\uFEFE\uC3C5\u5DDD\uFEFE" + - "\uFEFE\uFEFE\u5DD7\uC3C6\u5DD8\uFEFE\u5DD9\uFEFE\u5DDA\uFEFE\uC3C7\uFEFE\u5DDE\uFEFE\u5DDC\uFEFE" + - "\uFEFE\uFEFE\u55D1\uFEFE\uC3C8\u5DE4\uFEFE\u5DE0\u5DDF\uFEFE\u52B0\u535C\u5DE1\uC3C9\uFEFE\uFEFE" + - "\uC3CA\uFEFE\uFEFE\u4FDE\u52AE\u5DE3\uFEFE\uFEFE\uFEFE\u465B\uFEFE\uFEFE\uC3CB\u5DE5\uFEFE\u5DE7" + - "\uFEFE\uC3CC\uFEFE\uFEFE\uC3CD\uFEFE\uC3CE\uFEFE\uFEFE\uC3CF\uFEFE\u5DE6\uFFFF\u0004\uFEFE\uC3D0" + - "\uC3D1\uFEFE\uFEFE\uFEFE\uFFFE\u0004\uC3D2\u53EA\uFEFE\uC3D6\uFEFE\uFEFE\u5DE8\uFEFE\uFEFE\uC3D7" + - "\uC3D8\uFEFE\uFEFE\u4B96\uFFFF\u0004\uFEFE\uC3D9\uC3DA\uFFFF\u0004\uFEFE\u5DE9\uC3DB\uC3DC\uFFFF" + - "\u0005\uFEFE\u4785\uC3DD\uFEFE\uC3DE\u4B65\u4AF5\uFFFF\u0004\uFEFE\uC3DF\uC3E0\uFEFE\u5473\uFEFE" + - "\uFEFE\uFEFE\u546A\u4CBC\uC3E1\uFEFE\uFEFE\uC3E2\uFEFE\uFEFE\uFEFE\u5DEA\uC3E3\uFEFE\uFEFE\u497D" + - "\u4FCB\uFEFE\uFEFE\uFEFE\u4DAD\uFEFE\uFEFE\uFEFE\u4FEE\uFEFE\uFFFE\u0005\uC3E4\u5DEB\uFEFE\uC3E9" + - "\uFFFF\b\uFEFE\uC3EA\uFFFF\u0006\uFEFE\u5DED\u5DEE\u4861\u5DF0\u5DEC\uC3EB\uC3EC\uFEFE\u52CD" + - "\uC3ED\uFEFE\uFEFE\uC3EE\u5DEF\u4788\u49D7\u529E\uFFFF\f\uFEFE\u4DD1\uFEFE\uC3EF\u5DF2\uFEFE" + - "\uFEFE\uFEFE\u5099\uFEFE\uC3F0\uFEFE\uFFFE\u0004\uC3F1\uFEFE\uC3F5\u5DF3\uFEFE\uFEFE\uC3F6\u538C" + - "\uFEFE\u5DF1\uFFFF\u0004\uFEFE\uC3F7\uFFFF\f\uFEFE\u5DF7\uFFFF\u0007\uFEFE\u5587\uC3F8\uFEFE" + - "\uFEFE\u5DF8\uFFFF\u0005\uFEFE\uC3F9\u5DF6\uC3FA\uC3FB\uC3FC\uFEFE\u5DF4\uFEFE\uC3FD\uC3FE\uFEFE" + - "\uFEFE\u5DF5\uFFFF\u0004\uFEFE\u53EE\uFFFF\u0004\uFEFE\u5DFA\u544F\uFEFE\u5DF9\uFEFE\uC441\uFEFE" + - "\uC442\u475F\uFFFF\u0004\uFEFE\u4DE6\uFFFF\u0004\uFEFE\uC443\uFEFE\uC444\uFEFE\uC445\uC446\uC447" + - "\uFFFF\u0004\uFEFE\u47EF\uFEFE\uC448\uFEFE\uFEFE\uFEFE\u4983\uFFFF\u0004\uFEFE\uC449\uFEFE\uFEFE" + - "\uFEFE\uC44A\u5DFC\u5DFD\uFEFE\u4C6F\uC44B\uC44C\u5E42\uFEFE\u5490\uFEFE\uC44D\uFEFE\uC44E\uFEFE" + - "\uFEFE\u6885\u5E43\uC44F\uFEFE\u4BDD\uC450\uFEFE\u5DFB\uFEFE\uC451\uFEFE\uC452\uFEFE\u5E41\uFEFE" + - "\u54EA\u5357\u5DFE\u4742\uC453\u54A0\uFEFE\uFEFE\u5E44\uFEFE\u4C4C\uFFFF\n\uFEFE\uC454\uFEFE" + - "\uFEFE\uFEFE\u5590\uFEFE\uFEFE\uC455\uFEFE\uFEFE\uFEFE\u5E47\uC456\uFEFE\uC457\u5E45\uFEFE\u467F" + - "\uFEFE\uC458\uFEFE\uFEFE\u5E46\uFEFE\uFEFE\uC459\uFEFE\u529D\u5E48\uFEFE\uFEFE\uFEFE\u4F68\uC45A" + - "\uC45B\uFEFE\uFEFE\uFEFE\u4EBF\uC45C\uFEFE\uC45D\uFFFF\u0005\uFEFE\u54BB\uFEFE\uFEFE\uFEFE\u5E4A" + - "\uFEFE\uFEFE\uC45E\uC45F\u47D5\uC460\uC461\uFFFF\u0005\uFEFE\u5E4C\uC462\uFEFE\uFEFE\uFEFE\u5E4D" + - "\uC463\uC464\u5E4B\uFEFE\u49D5\uC465\uFEFE\uFEFE\uFEFE\u4EF8\u5E50\uFEFE\uC466\uC467\uFEFE\u5E53" + - "\uFEFE\u4A79\uFEFE\u5E4E\uC468\u5E51\u5047\uC469\u5E52\uFEFE\uC46A\uC46B\uFEFE\uC46C\uFEFE\uFEFE" + - "\u57FB\u5E55\uFFFF\u0004\uFEFE\u4C66\u54CE\u5E4F\uFFFF\u0004\uFEFE\u5E56\u54E6\u578F\uFFFF\u0006" + - "\uFEFE\u5E54\uFEFE\uFEFE\uC46D\u5E59\uFEFE\u5E57\u5E58\uFEFE\u5E5A\u5E5B\uC46E\uFFFF\u0005\uFEFE" + - "\u4AD9\uC46F\uC470\uC471\uFEFE\uFEFE\uFEFE\u5E5C\uFEFE\uFEFE\u5E5D\uFEFE\uFEFE\uC472\uFEFE\uFEFE" + - "\uFEFE\uC473\uFEFE\uFEFE\uC474\u537C\uFEFE\uC475\uFEFE\uC476\uFFFF\u0004\uFEFE\uC477\uFEFE\uFEFE" + - "\uFEFE\u5E5E\uFEFE\u4C87\uC478\u5E60\u5E5F\uFEFE\uC479\u5E61\uFEFE\u5E62\uFEFE\uC47A\u53A9\u45CC" + - "\uFEFE\uC47B\uC47C\u5096\u5E63\u5E64\u52DD\u4C79\u5E65\u5E66\uC47D\uC47E\uC47F\uFEFE\uC480\u5E67" + - "\u4767\u4ABD\uFEFE\uFEFE\u5E68\u556F\uFEFE\uC481\uC482\uC483\uFEFE\u55DD\uC484\uFEFE\uC485\uC486" + - "\uFEFE\u5E69\u53FC\uC487\u4973\uC488\u55B7\uC489\u4AAF\uC48A\u509A\u55C4\uC48B\uFEFE\uFEFE\uFEFE" + - "\u487B\uC48C\u4652\uFEFE\uC48D\uFEFE\uFEFE\uC48E\uC48F\uFEFE\uC490\u5158\uFEFE\u5E6A\uFEFE\uFEFE" + - "\uC491\uC492\u46A2\uFEFE\uC493\uC494\u548A\u5E6B\uC495\u5354\u5E6C\u5E6E\uFEFE\uC496\uFEFE\uFEFE" + - "\u5E6D\uFEFE\uC497\uFEFE\uFEFE\uFEFE\uC498\uC499\uFEFE\uFEFE\uFEFE\u5E6F\uC49A\uFEFE\uFEFE\u5E70" + - "\uFFFF\u0004\uFEFE\uC49B\uFFFF\u0004\uFEFE\u4FDC\uFEFE\u5E71\uFFFF\u0004\uFEFE\u5E72\uC49C\uFEFE" + - "\uFEFE\uFEFE\u4AC5\uC49D\uC49E\u4CA7\uFEFE\u5E73\u5E74\uFEFE\uC49F\uFEFE\u4852\uFEFE\uFEFE\u5E79" + - "\uFFFF\u0004\uFEFE\u5E75\uFEFE\uFEFE\uC4A0\u4E5A\u5E76\u5E78\uFEFE\u5E77\uC4A1\uFEFE\uC4A2\uFEFE" + - "\uFEFE\uC4A3\uFEFE\u5E7A\uFEFE\u51DB\uFEFE\u5E7B\uFEFE\uFEFE\uC4A4\uC4A5\u5274\uC4A6\u4ECF\uFEFE" + - "\u50DC\uFEFE\uFEFE\uFEFE\uC4A7\u5E7D\u5E7E\u5E7C\uFEFE\uFEFE\uC4A8\uFEFE\uFEFE\uFEFE\u4A7B\uFEFE" + - "\uFEFE\u4ADB\u4C9E\uFFFF\u0005\uFEFE\uC4A9\uC4AA\uFEFE\uFEFE\u5E80\u52FE\u5E7F\uC4AB\uC4AC\u506F" + - "\u54D6\uC4AD\uFEFE\uFEFE\uFEFE\uC4AE\uFEFE\uC4AF\uC4B0\uFEFE\uC4B1\uFEFE\uFEFE\u5E82\uC4B2\uFEFE" + - "\uC4B3\uFFFF\u0004\uFEFE\uC4B4\uC4B5\uFEFE\uFEFE\u5E84\u5E81\uC4B6\uC4B7\uFEFE\u4A51\u5E83\u5E85" + - "\uC4B8\u4E9D\uFEFE\uFEFE\uC4B9\uFEFE\u5E86\u5E8B\uFEFE\uC4BA\uC4BB\u5E88\u49C5\u4FD0\uC4BC\uFEFE" + - "\u4F45\u5E89\uFEFE\uC4BD\uC4BE\uFEFE\u5E87\uC4BF\u504F\u53DD\uFEFE\uFEFE\uC4C0\uC4C1\uFEFE\uC4C2" + - "\u5E8C\u4C5A\uFEFE\uFEFE\uFEFE\uC4C3\u4E95\u519F\uFFFF\u0007\uFEFE\uC4C4\u5E8E\u5E8D\uC4C5\uFEFE" + - "\uC4C6\uFEFE\uFEFE\uFEFE\uC4C7\u5E8F\uC4C8\uFFFF\u0004\uFEFE\uFFFE\u0004\uC4C9\uFEFE\uFEFE\u4F65" + - "\uFEFE\uFEFE\uC4CD\uC4CE\u5E92\uC4CF\u5E91\uC4D0\uC4D1\uFEFE\uC4D2\uC4D3\u5E93\uC4D4\u4D61\uFEFE" + - "\uFEFE\u5E96\uFEFE\u5E94\u5E95\uC4D5\u51CB\u5E97\uC4D6\uFEFE\uFEFE\uFEFE\uC4D7\uC4D8\uFEFE\uC4D9" + - "\u4C6E\uC4DA\uC4DB\u4783\uFEFE\u45FD\uFEFE\u49B1\uFEFE\uFEFE\uC4DC\uFEFE\uC4DD\uFEFE\uFEFE\uC4DE" + - "\uFEFE\uC4DF\u4DE9\uC4E0\uC4E1\uFEFE\uFEFE\uFEFE\uC4E2\uFEFE\uC4E3\uC4E4\uC4E5\uFEFE\uC4E6\uFEFE" + - "\uFEFE\uC4E7\uC4E8\uFEFE\uFEFE\u4E4C\uC4E9\uC4EA\uFEFE\uC4EB\uFFFF\u0004\uFEFE\u4AF9\u5E9A\uFEFE" + - "\uC4EC\uFEFE\uC4ED\uFEFE\uC4EE\uFEFE\u5E9C\uC4EF\u5E99\uFEFE\uC4F0\u5E9D\uFEFE\u4C9A\uFEFE\uFEFE" + - "\uC4F1\uC4F2\uFEFE\u5E98\u5E9E\u5399\uC4F3\uC4F4\u4D5D\u5E9B\uC4F5\uFEFE\uFEFE\u5EA2\uC4F6\uFEFE" + - "\uFEFE\u5E9F\uFEFE\uFEFE\uC4F7\uFEFE\uFEFE\uFEFE\uC4F8\u5EA5\uFEFE\u4B99\uC4F9\uFEFE\u5EA1\uFEFE" + - "\u5EA0\uC4FA\uC4FB\uFEFE\uC4FC\u4CB9\uFEFE\uFEFE\u5066\u5EA3\uFEFE\uFEFE\u5EA4\uFEFE\uFEFE\uC4FD" + - "\u5EA8\uFEFE\uC4FE\u5EA6\uC541\uC542\uC543\uFEFE\uC544\u46B7\uC545\uC546\uC547\uFEFE\u48DB\uC548" + - "\u5EA9\u45EB\u5EA7\uFEFE\u50F7\uC549\uFFFF\u0006\uFEFE\uC54A\uFFFF\b\uFEFE\uC54B\uC54C\uFFFF" + - "\u0006\uFEFE\u4E5C\uFEFE\uC54D\u5EAC\u5EAA\uFEFE\uC54E\u5EAD\u5EAB\uC54F\uC550\uC551\u5EAE\uC552" + - "\uC553\uC554\u5EAF\u5453\u4CD8\u52A3\u529F\uFEFE\uFEFE\uC555\u5EB0\uFFFF\u0004\uFEFE\u5EB2\uC556" + - "\u5EB5\uFEFE\uC557\uC558\uFEFE\uC559\uC55A\uFEFE\uFEFE\uFEFE\uC55B\uFEFE\uC55C\uFEFE\uFEFE\uFEFE" + - "\uC55D\uC55E\uFEFE\uFEFE\u5EB1\uFEFE\uC55F\uFEFE\u5EB4\u53F1\u4F52\u5EB6\uC560\u4B5B\u5EB3\u508C" + - "\uFEFE\u5EBC\u5EB9\u5EBB\uFEFE\uC561\uC562\uC563\u5EB7\u5EBA\uC564\uFEFE\uC565\uC566\u5EBE\u5EB8" + - "\uC567\uC568\u5188\uFEFE\uFEFE\u6883\uFFFF\u0007\uFEFE\u5EBF\uFEFE\uC569\uC56A\uFEFE\u528C\uFEFE" + - "\uC56B\uC56C\uC56D\uFEFE\u5EBD\uFEFE\u504D\uFEFE\uFEFE\uFEFE\uFFFE\u0004\uC56E\uFFFF\u0005\uFEFE" + - "\uC572\uC573\uC574\uFEFE\uC575\uFEFE\u5EC1\u5EC0\uC576\uC577\u5EC2\uC578\uFEFE\uFEFE\uC579\u5EC3" + - "\uFFFE\u0004\uC57A\uFEFE\uFEFE\uC57E\uC57F\u4AB9\uC580\uC581\uFEFE\uFEFE\uC582\uFEFE\uFEFE\uFEFE" + - "\uC583\uFEFE\uC584\uFEFE\u5249\uFEFE\uC585\uFFFF\b\uFEFE\uC586\uC587\u5EC4\uFEFE\uC588\uFEFE" + - "\uFEFE\u5EC5\uC589\uFEFE\uFEFE\uC58A\u5EC6\uFEFE\uFEFE\uFEFE\uC58B\uFEFE\uC58C\uC58D\u4E64\uFEFE" + - "\uC58E\uC58F\u5EC7\uFEFE\u5452\u5EC8\uC590\uFEFE\u49C2\u5EC9\uC591\u5ECA\uC592\uC593\uFEFE\uFEFE" + - "\u5ECB\uC594\u5ECC\u5ECE\u5ECD\uFEFE\uC595\uFEFE\u4CD4\u5ECF\u5ED0\uFEFE\uC596\uC597\uC598\uFEFE" + - "\uFEFE\uC599\uFEFE\u5ED1\uFEFE\u5ED3\u5ED2\u5ED4\uC59A\uFFFF\u0005\uFEFE\u5ED6\u5ED5\u5ED7\uFEFE" + - "\uFEFE\u5495\uC59B\u5ED8\uFEFE\u53E6\uC59C\uC59D\u4B55\uFEFE\u4B66\uFEFE\u52A7\uFEFE\u5ED9\u4599" + - "\uC59E\uC59F\uFEFE\u45C0\uC5A0\u55D7\u5EDA\uC5A1\u45B6\uC5A2\uC5A3\u4D58\u5EDB\uFEFE\uFEFE\u58FE" + - "\u4563\u467C\u48A0\u4967\uFEFE\uFEFE\uC5A4\u457C\u5765\uC5A5\u4555\u4677\u5EDC\uFFFE\u0004\uC5A6" + - "\uFEFE\uFEFE\uC5AA\u5EDD\uFEFE\u5EE1\uC5AB\uC5AC\u5EE0\u5EDF\u5B7C\u47AE\u5EDE\uC5AD\u558F\uC5AE" + - "\u478B\uC5AF\uFEFE\u4EDC\uFEFE\uFEFE\uC5B0\uFEFE\u47AB\u5EE3\u5EE2\u4D72\u5086\uC5B1\uC5B2\u49FE" + - "\uC5B3\u559A\uFEFE\u5EE4\u4CF0\u51B4\u5EE5\uFEFE\u52FD\u48B9\u5EE6\uFEFE\u5EE9\uFEFE\u5EE7\u4AA9" + - "\uC5B4\uFEFE\u4E54\u5EE8\uFEFE\u5EEB\u50DD\u5EEA\uFFFE\u0006\uC5B5\u50D4\uFEFE\uC5BB\u5EEC\uFEFE" + - "\uFEFE\uC5BC\u5EED\u5EEE\uFEFE\u5EF0\u5EEF\u4EA0\uFEFE\uFEFE\u5171\u55B0\uC5BD\u4CB4\uC5BE\uC5BF" + - "\u5EF1\uC5C0\uFEFE\uFEFE\uFEFE\uC5C1\u5EF2\uFEFE\uC5C2\u5EF3\uFFFF\u0004\uFEFE\uC5C3\u5EF5\uC5C4" + - "\u5EF4\uFFFF\u0005\uFEFE\u50CE\uFFFF\u0005\uFEFE\u5EFD\u4D97\u5EF7\uC5C5\u5EF9\uFEFE\uFEFE\u5EFB" + - "\u54E1\uC5C6\uFEFE\u5EFC\u5EFA\u5142\uC5C7\uC5C8\uC5C9\u5EF6\u5EF8\uC5CA\u49BF\uC5CB\u4E4A\uFEFE" + - "\uFEFE\u5F41\uFEFE\uC5CC\u5EFE\uC5CD\uC5CE\uFEFE\uFEFE\u5F42\uFEFE\u5182\u53FD\uFEFE\uC5CF\u5549" + - "\u5F43\uFEFE\u4C47\uC5D0\uFEFE\u5F45\uC5D1\uC5D2\uC5D3\u5174\u5F44\uC5D4\uFEFE\uFEFE\uC5D5\uFEFE" + - "\u54A4\uFEFE\uFEFE\uC5D6\uFEFE\uC5D7\uC5D8\u5F4A\uC5D9\u5F4C\u5F4D\u5089\uFFFF\u0004\uFEFE\uC5DA" + - "\u5F4B\uFEFE\u5F48\uFEFE\u5F46\u5F47\uC5DB\u5F49\uC5DC\uC5DD\uC5DE\uFEFE\uFEFE\uC5DF\uC5E0\u5F4F" + - "\uC5E1\u5F4E\uC5E2\u524F\uFEFE\uC5E3\uFEFE\uFEFE\uC5E4\uC5E5\uFEFE\uC5E6\uC5E7\uFEFE\uFEFE\uC5E8" + - "\uFEFE\uFFFE\u0004\uC5E9\u5F50\u5F52\u5F53\u5F54\uC5ED\u5F55\uC5EE\uC5EF\u5F51\uFEFE\uC5F0\uFEFE" + - "\uFEFE\uFEFE\uC5F1\uFEFE\uFEFE\u5F57\uFEFE\uC5F2\uC5F3\u5F56\uC5F4\uFEFE\uFEFE\uC5F5\uC5F6\uC5F7" + - "\u5F58\uC5F8\uFEFE\uFEFE\uFEFE\uC5F9\uC5FA\u4BB7\uC5FB\uC5FC\uC5FD\u5F5C\u5F59\u5F5A\uC5FE\uC641" + - "\uC642\u5447\uFFFF\u0005\uFEFE\u53AA\uFEFE\uFEFE\uC643\u537E\uFEFE\u5F5B\uC644\uFEFE\uFEFE\u5F5D" + - "\uFEFE\uFEFE\uC645\uFEFE\u5F5E\u5F5F\uFEFE\uC646\uC647\uFEFE\u5F62\u5F60\u5F61\u5F63\uFEFE\u5F64" + - "\uC648\uC649\uC64A\u5F65\uC64B\u5F66\uFEFE\uC64C\uFEFE\u5F67\uFEFE\u539A\uFEFE\u464B\u46E8\u5F68" + - "\u4659\u454B\uFEFE\u5F6A\uC64D\u5F69\u5F6B\u45EF\uC64E\u4AB0\u4CBB\u5F6C\uFEFE\uFEFE\u5F6D\uC64F" + - "\uC650\u5299\uFEFE\u52A4\uFEFE\uFEFE\u4E81\uFEFE\uC651\u5396\uFEFE\uFEFE\u5F6E\u5F6F\u5F72\u5F70" + - "\uC652\u5F71\uC653\uC654\uFEFE\uFFFE\u0004\uC655\u5F73\uC659\uC65A\uFEFE\uC65B\uFEFE\uFEFE\uC65C" + - "\u49DA\uFEFE\u5F74\uFEFE\uFEFE\uFEFE\u5F75\uFEFE\uFEFE\u6868\u5F76\u5F77\u5F78\uFEFE\uFEFE\uC65D" + - "\uFEFE\u4DC7\uFEFE\uC65E\u5F79\u53BA\uFEFE\uC65F\u5057\uFEFE\u51B5\uC660\u4774\uC661\uC662\u5F7B" + - "\uC663\uFEFE\uFEFE\uFEFE\u5F7D\uFEFE\uC664\uFEFE\u5F7C\u4D65\uFEFE\uC665\uFEFE\u4844\u5CC9\uFEFE" + - "\u5F7E\u4B84\uC666\u5F7F\uFEFE\u49E3\u4890\u5F80\uC667\u53F7\uC668\uFEFE\u5F81\uFEFE\uC669\uFEFE" + - "\u4675\uFEFE\uC66A\uC66B\u5080\uFEFE\u4674\uFEFE\uC66C\uFEFE\u4678\uC66D\uFEFE\u5F83\uC66E\uFEFE" + - "\u5082\uFEFE\uC66F\u4847\uFEFE\uFEFE\u5F86\uFEFE\uC670\u5F85\u5F84\u52BC\uC671\u4DA2\u4552\uFEFE" + - "\uC672\uFEFE\uFEFE\uFEFE\uC673\uFEFE\uC674\uC675\uFEFE\uC676\uFEFE\uC677\uC678\u5F8B\uC679\uFEFE" + - "\u51CA\u4642\u4E6A\uFEFE\uC67A\uFEFE\u5F87\u5F89\u5F8A\uFEFE\uC67B\u5F88\uFEFE\uFEFE\uFEFE\uC67C" + - "\uC67D\uC67E\uFFFF\u0004\uFEFE\uC67F\uC680\uC681\u5F8C\u5F8D\uC682\u4E5F\uFEFE\u49A5\uC683\uC684" + - "\uFEFE\u47AA\uFEFE\uC685\uFEFE\uFEFE\uC686\u5F8E\u5F8F\uFEFE\uFEFE\uC687\uFEFE\uFEFE\uC688\uC689" + - "\uC68A\uFEFE\uFEFE\uC68B\uFEFE\uFEFE\uFEFE\uC68C\uC68D\uFEFE\uFEFE\u5F90\u5F93\uC68E\uFEFE\uC68F" + - "\uC690\uC691\u526C\uC692\u4A73\uC693\u5F94\u4A96\uC694\u5F91\uFEFE\uC695\u5F92\uC696\uFEFE\uFEFE" + - "\uFEFE\uC697\uFEFE\uC698\uC699\uC69A\uFFFF\u0004\uFEFE\u5F97\uC69B\uFEFE\uFEFE\uC69C\u5F96\u5F95" + - "\uC69D\uFEFE\uFEFE\uFEFE\uC69E\uFFFF\u0006\uFEFE\u5F99\uC69F\uC6A0\u5F98\uFEFE\uFEFE\u5F9A\uFEFE" + - "\uFEFE\uC6A1\uC6A2\uC6A3\uFEFE\uFEFE\uFEFE\uC6A4\uFEFE\uFEFE\uFEFE\u5F9C\uC6A5\u5F9B\uFEFE\uC6A6" + - "\uFEFE\uFEFE\u5572\uFEFE\uC6A7\uFEFE\uFEFE\uC6A8\uFEFE\u4DB0\u527D\uC6A9\uC6AA\u5F9D\uC6AB\uFEFE" + - "\u4F9B\uFEFE\uC6AC\u5F9E\uFEFE\uFEFE\u5F9F\uFEFE\u5FA3\u5FA1\u5FA2\uC6AD\u5FA0\uFEFE\uFEFE\uFEFE" + - "\uC6AE\uFEFE\uFEFE\uFEFE\u5FA4\uFEFE\uC6AF\uFEFE\uFEFE\uFEFE\u5FA5\uFEFE\uFEFE\uFEFE\uC6B0\uC6B1" + - "\uFEFE\uFEFE\uC6B2\uFEFE\u5350\uFEFE\uC6B3\u5FA6\u50ED\u5FA7\uFEFE\uC6B4\uC6B5\uC6B6\uFEFE\u46C1" + - "\u5FA8\uC6B7\u45B0\uC6B8\u55C9\uFEFE\u4E4D\uC6B9\uFEFE\uC6BA\u4A82\u5FA9\u51BB\uC6BB\uC6BC\uFEFE" + - "\u4580\uC6BD\uFEFE\uFEFE\uFEFE\uC6BE\uFEFE\uFEFE\uC6BF\u5FAB\uFFFF\u0005\uFEFE\u495B\uFEFE\uFEFE" + - "\uC6C0\uC6C1\uFEFE\uFEFE\uC6C2\uFEFE\uFEFE\u5FAC\uC6C3\uC6C4\uFEFE\uFEFE\uC6C5\u5FAD\uFEFE\u46D3" + - "\u4CC3\uFFFF\u0007\uFEFE\uC6C6\uFEFE\uFEFE\u5FB0\u5FAE\uC6C7\uC6C8\uFEFE\u4D45\u54B4\u5248\uFFFF" + - "\u0005\uFEFE\uC6C9\uC6CA\uFEFE\uC6CB\uFEFE\u4CC2\uFEFE\u4ABE\uC6CC\uFEFE\uC6CD\uFEFE\uFEFE\u50DF" + - "\uFFFF\u0004\uFEFE\u5FAF\uFEFE\uFEFE\uFEFE\uC6CE\uC6CF\u5FB1\uFEFE\uC6D0\uC6D1\uFEFE\uFEFE\uFEFE" + - "\uC6D2\uFEFE\u5FB2\uFEFE\uFEFE\uFEFE\uC6D3\uFFFF\t\uFEFE\uC6D4\u4976\uC6D5\uFEFE\uC6D6\uC6D7" + - "\uFEFE\uC6D8\u5FB3\uFEFE\uFEFE\uFEFE\uC6D9\uFEFE\uC6DA\u4984\u4AEF\uFEFE\uC6DB\u5369\uFEFE\uFEFE" + - "\u52BF\uFEFE\u5FB4\uFFFF\u0005\uFEFE\u5FB6\uFEFE\u5FB9\uFEFE\uC6DC\uFEFE\uFEFE\u4F4E\uFFFF\u0004" + - "\uFEFE\u5FB7\u5195\uFEFE\uFEFE\uC6DD\uFEFE\u5FBA\u5356\u5FB5\uC6DE\uFEFE\u517B\uFEFE\u4FB1\uC6DF" + - "\u52D2\uFEFE\u545B\uC6E0\uFEFE\u5FB8\uFEFE\uFEFE\uC6E1\uC6E2\uC6E3\uFEFE\uC6E4\uFEFE\u5FBB\uC6E5" + - "\uFEFE\uFEFE\u4DF8\uC6E6\u507D\u5FBD\uFEFE\uC6E7\uC6E8\uFEFE\u5FBE\uFFFE\u0004\uC6E9\uFEFE\u5FBC" + - "\uFFFF\u0004\uFEFE\u487A\uC6ED\u5FC4\uC6EE\u5FC3\uC6EF\uFEFE\u4A62\uFEFE\uFEFE\uFEFE\u5FC5\u5FC0" + - "\uC6F0\uC6F1\uC6F2\u5FC6\u5FC1\uC6F3\uFEFE\uC6F4\uFEFE\u4B9C\u5FBF\uC6F5\uC6F6\u5FC2\uC6F7\uC6F8" + - "\uFEFE\uFEFE\uFEFE\u5FC9\uC6F9\uFEFE\uFEFE\uFEFE\uC6FA\uC6FB\uC6FC\uFEFE\uFEFE\uC6FD\uFEFE\uC6FE" + - "\u5FC8\u49B4\uFEFE\uC741\uFEFE\u5FC7\uFEFE\uFEFE\u48AA\uFEFE\uFEFE\uC742\uC743\u5FCB\uFEFE\uC744" + - "\uC745\uFEFE\uFEFE\uC746\uC747\uFEFE\u5FCA\uFEFE\uC748\uC749\u51B0\uFFFF\u0004\uFEFE\uC74A\u5FCC" + - "\uFFFF\u0004\uFEFE\uC74B\uFEFE\u4C9C\uFEFE\uC74C\u5FCD\u4DF0\uFFFF\u0006\uFEFE\u5FCE\uC74D\uFEFE" + - "\uC74E\uFEFE\uC74F\uC750\uC751\uFFFF\u0004\uFEFE\uC752\u51B9\uC753\uFEFE\uC754\u514C\u5FD0\u5FCF" + - "\uC755\uFEFE\uFEFE\u5FD1\uC756\uFEFE\uFEFE\uC757\uC758\uFFFF\u0004\uFEFE\u4853\uC759\u4958\uC75A" + - "\u4663\uC75B\u5FD3\u53D2\uFEFE\uFEFE\uC75C\uC75D\uC75E\u5192\u4ED8\u4FEB\uC75F\uC760\uFEFE\uFEFE" + - "\uFEFE\uC761\u488C\uC762\uFEFE\u555C\uC763\u5FD8\u4CDC\u5365\uC764\uFEFE\u5FD7\uC765\uC766\u4CEB" + - "\u45A1\u5FD6\u5FD4\uFEFE\u4F89\uFEFE\uFEFE\u49F9\uFEFE\uC767\u4DBF\uC768\uFEFE\uC769\uFEFE\u4C71" + - "\uFFFF\u0004\uFEFE\uC76A\uFFFF\u0004\uFEFE\u5553\uFEFE\uC76B\u52D8\uC76C\uC76D\uFEFE\uC76E\u5FDA" + - "\u50E7\u4D75\uFEFE\uFEFE\u50AE\u4F87\uFFFF\u0004\uFEFE\u5FDB\uC76F\uC770\u5286\u4BA7\u458B\uFEFE" + - "\uC771\uFEFE\uC772\u5FDC\uC773\uC774\uFEFE\uC775\uFEFE\uFEFE\u5FDF\uC776\u5FDE\uFEFE\uFEFE\uFEFE" + - "\uC777\uFFFF\u0004\uFEFE\u55AA\u4FD7\uC778\uC779\u5FE0\uC77A\uFEFE\uFEFE\u54F5\uC77B\u50FA\uC77C" + - "\uFEFE\u5FE1\uC77D\uFEFE\uFEFE\uFEFE\uC77E\u536A\u5FE2\uC77F\uFEFE\u555D\u5463\u53D0\u45F1\u46C3" + - "\uC780\uFEFE\uC781\uFEFE\uFEFE\uC782\uC783\u5FE3\uC784\u4658\uFEFE\uFEFE\uFEFE\uC785\uFEFE\u48ED" + - "\u4DBA\uFEFE\uC786\u5FE4\uC787\uFEFE\u4C70\uFEFE\uC788\uFEFE\uFEFE\uC789\uC78A\u4D83\uC78B\u54B5" + - "\uC78C\u5FE7\u508F\uC78D\u4C8A\u5FE5\uFEFE\u4D9F\uC78E\uC78F\u5FE6\uC790\uFEFE\uFEFE\u4BDF\uC791" + - "\uFFFF\u0006\uFEFE\uC792\uFEFE\uFEFE\u4975\uC793\uFEFE\uFEFE\uFEFE\u5264\uFEFE\uC794\uC795\uFEFE" + - "\uFEFE\uFEFE\uC796\u5FE8\uC797\uC798\u47F4\uC799\u5FE9\u47C4\uFEFE\uFEFE\uC79A\uFEFE\uFEFE\u47FA" + - "\uC79B\uFEFE\u5087\u5FEA\u5FEB\u4DCF\uC79C\u5296\uFEFE\uC79D\u5FEC\u5366\uC79E\uFFFF\u0005\uFEFE" + - "\uC79F\uFEFE\uFEFE\uFEFE\uC7A0\uFEFE\uC7A1\u4692\uC7A2\uC7A3\u5FED\u476A\uFEFE\uC7A4\uC7A5\uFEFE" + - "\u5FEF\uC7A6\uC7A7\uC7A8\u5FF0\u4DBE\u4FC7\u5FEE\u4FD5\u4E94\uFEFE\u48D4\u5FF1\uC7A9\uC7AA\u52BE" + - "\uC7AB\uC7AC\u5FF3\uFEFE\uFEFE\uC7AD\u4891\u5254\u50B8\u509B\uFFFF\u0004\uFEFE\uC7AE\uC7AF\u5FF2" + - "\uFEFE\uC7B0\uFEFE\uFEFE\uC7B1\uC7B2\uFEFE\uC7B3\uC7B4\u5FF5\u5FF4\u4E98\uFEFE\uC7B5\uFEFE\uC7B6" + - "\uFEFE\u5FF6\uC7B7\u4F5C\uFEFE\uC7B8\uFEFE\uFEFE\u5FF8\uFEFE\uFEFE\uFEFE\u4B86\uC7B9\u4986\uFEFE" + - "\uC7BA\u5FF9\u478D\uFEFE\uFEFE\u5FFA\uC7BB\u4E91\uC7BC\u4AFD\uC7BD\u5169\u5499\uC7BE\uC7BF\uFEFE" + - "\u5FFB\uFEFE\uC7C0\uC7C1\uFFFF\u0004\uFEFE\uC7C2\uC7C3\u4FB0\u4BE9\uC7C4\u5FFC\u5FFE\u6041\u5FFD" + - "\uFFFF\u0005\uFEFE\uC7C5\u50A6\uC7C6\uFEFE\uFEFE\uC7C7\uFFFF\u0005\uFEFE\u6042\u4A65\uFEFE\uC7C8" + - "\uFEFE\u50AA\u49A7\u6043\uFEFE\uFEFE\uC7C9\uFEFE\uC7CA\u6044\uFEFE\uFEFE\uC7CB\u559E\uC7CC\uC7CD" + - "\uFEFE\uFEFE\u6047\uFEFE\uFEFE\uFEFE\u6046\u6049\u6048\uC7CE\u604A\u52F0\uC7CF\u604B\u45DD\uC7D0" + - "\u604C\uC7D1\u604D\uFEFE\u604F\u604E\u6051\uFEFE\u6050\uFEFE\uFEFE\uFEFE\u6052\u6053\uC7D2\u49E7" + - "\u6054\uFEFE\u66C1\u476E\u6055\u6056\u546B\uFEFE\u4D50\u6057\u6058\uC7D3\uC7D4\u51C8\u605A\uC7D5" + - "\u605B\uFEFE\u48EF\u605C\uC7D6\uFEFE\uFEFE\uC7D7\uFEFE\u4971\uFEFE\u605D\u45F5\u545C\uC7D8\uFEFE" + - "\uC7D9\uC7DA\u5287\uFEFE\uFEFE\u605E\uFEFE\u54D5\uFEFE\u6062\uC7DB\u51CF\uFEFE\u6061\u6060\uFEFE" + - "\uFEFE\uFEFE\u605F\uFEFE\u49B5\uFEFE\uFEFE\uC7DC\uFEFE\uFEFE\uFEFE\u53E7\u6065\uFEFE\u4F41\uFEFE" + - "\uFEFE\u6066\uC7DD\u47E0\uFEFE\uFEFE\uC7DE\uFEFE\u52F4\u4FD9\uC7DF\u6068\uC7E0\uC7E1\uC7E2\u467E" + - "\uFFFE\u0005\uC7E3\uFEFE\u6063\uC7E8\u6067\u6064\uFEFE\uFEFE\u496E\uFEFE\uFEFE\uFEFE\uC7E9\uFEFE" + - "\uC7EA\uC7EB\uC7EC\uFEFE\uFEFE\uFEFE\u606C\u4AC7\uC7ED\u4D9B\u46A7\uFEFE\u4B8F\u606B\u606A\uC7EE" + - "\u52F5\u6069\u4B45\u4B7C\uFEFE\u49D0\uC7EF\u46C9\uFFFF\u0006\uFEFE\u606D\uFEFE\uFEFE\uC7F0\uFEFE" + - "\uFEFE\uFEFE\uC7F1\u5484\uC7F2\u5048\uFEFE\uC7F3\uC7F4\uFEFE\u534E\uC7F5\u6073\uC7F6\u6071\u6072" + - "\uC7F7\uC7F8\u6070\u606E\uFEFE\uC7F9\uFEFE\uFEFE\u606F\uFFFF\t\uFEFE\uC7FA\uFEFE\u559B\u4F51" + - "\uFEFE\uC7FB\uFEFE\u55A4\uFEFE\u6077\uC7FC\u607B\uC7FD\uC7FE\u607A\uFEFE\u4EE0\u4CCC\uC841\u4843" + - "\u6075\u607C\u6079\uC842\u6078\u6074\u6082\u6076\uC843\u46F2\uFEFE\uFEFE\uFEFE\uC844\uFFFF\u0004" + - "\uFEFE\u54CA\uFEFE\uC845\u518D\uFEFE\uC846\uC847\u4AFB\uC848\uFEFE\u6080\uC849\uC84A\uFEFE\u505C" + - "\uFEFE\uFFFE\u0004\uC84B\uFEFE\uFEFE\u47A1\u51E8\uC84F\uFEFE\u49E8\uC850\u6081\u4FB6\uC851\u49A8" + - "\uC852\u607E\u607F\uFEFE\uFEFE\u607D\uFFFF\u0004\uFEFE\uC853\uFEFE\uC854\uC855\uFEFE\uC856\uC857" + - "\uC858\uFEFE\u6083\uFEFE\uFEFE\u4875\uFEFE\uFEFE\uFEFE\u4AD8\u6087\u6085\uFEFE\uC859\u6084\uC85A" + - "\uFEFE\uFEFE\u5444\uFFFF\u0004\uFEFE\uC85B\u608C\uC85C\uC85D\u608E\u6086\uC85E\uC85F\uC860\uFEFE" + - "\uC861\uFEFE\uC862\uFEFE\u6089\uFFFE\u0004\uC863\uFEFE\uC867\u608B\uFEFE\uC868\uFEFE\uC869\uC86A" + - "\u608D\uC86B\uC86C\uFEFE\u4F53\u578A\u608A\u6088\uFEFE\uFEFE\u517C\uFEFE\uC86D\uFEFE\uC86E\uFEFE" + - "\uFEFE\u54CA\u6092\uC86F\u4BEC\uFEFE\u608F\uFEFE\uC870\uC871\u6090\uC872\uFEFE\u6091\u6094\uC873" + - "\uFFFF\u0004\uFEFE\uC874\uFEFE\uC875\uC876\uFEFE\uC877\u6093\u51AB\uC878\uC879\uFEFE\uFEFE\u6095" + - "\u5270\u4F4C\u6096\uFEFE\uFEFE\u6098\uFEFE\uFEFE\uC87A\uFEFE\uFEFE\uFEFE\uC87B\uFEFE\u6097\u4DFE" + - "\uFEFE\u51F2\u609A\uC87C\uC87D\uC87E\u4F99\uC87F\u6099\uFEFE\u609B\uFFFE\u0006\uC880\u609C\u4CEE" + - "\uC886\uFEFE\uC887\u52AA\u609D\uFEFE\uC888\uFEFE\uC889\uFEFE\uFEFE\u609E\uC88A\uC88B\uFEFE\uC88C" + - "\uFEFE\uC88D\u466F\uFEFE\u609F\uFEFE\uFEFE\uFEFE\uC88E\uFEFE\uFEFE\uC88F\uC890\u4FF0\uFEFE\uFEFE" + - "\u55E7\u4E85\u60A0\uFEFE\uFEFE\uC891\uC892\uFEFE\u489E\uFEFE\u4FCC\uFEFE\u53C9\uFEFE\uC893\u60A1" + - "\uFEFE\u4CA9\uFEFE\uC894\u4C4B\uFEFE\u4D59\u4BF7\uFEFE\uFEFE\u4FC8\uFEFE\uFEFE\uC895\u4BFB\uC896" + - "\u60A5\u60A3\uFEFE\u60A2\u52AB\uC897\u4BD4\u60A7\uFEFE\uFEFE\u60A4\uFEFE\u60A6\u60AB\uFEFE\uC898" + - "\u60AA\u60A9\u60A8\uFEFE\uFEFE\uC899\uC89A\uFEFE\u60AC\uC89B\uC89C\uC89D\u60AE\u466C\uC89E\u51BC" + - "\uFEFE\u60B0\uFEFE\uC89F\u60AF\uFEFE\uC8A0\uC8A1\uC8A2\u5471\uFEFE\uFEFE\uC8A3\u5160\uC8A4\uFEFE" + - "\uFEFE\u60B1\uC8A5\uC8A6\uC8A7\u4884\uC8A8\u60B3\uC8A9\uC8AA\uFEFE\u60B4\uC8AB\u5492\u518C\u514B" + - "\uFEFE\u60B2\uFEFE\uFEFE\uFEFE\uC8AC\u4EC5\uFEFE\uC8AD\uFEFE\uC8AE\uFEFE\uFEFE\uFEFE\u60B5\uFEFE" + - "\uFEFE\u60B6\uFEFE\u60B7\uC8AF\u60B8\uFEFE\u46C7\uFEFE\u52C2\u48FA\uFEFE\uFEFE\u51FE\uFEFE\u46DB" + - "\uFEFE\u60BA\uC8B0\u47BD\u4B67\u60B9\uC8B1\uC8B2\uC8B3\u60BD\u4CF9\uFEFE\u49E2\uFEFE\uC8B4\u4FB5" + - "\uC8B5\uC8B6\uC8B7\u47A6\u60BC\uC8B8\u4F47\u4C78\u4680\u49F3\u4FF3\u60BB\uC8B9\uC8BA\uFEFE\u479F" + - "\u4877\u4CF4\uC8BB\uFEFE\uFEFE\uC8BC\uFEFE\uFEFE\uFEFE\uC8BD\u4AF0\u5592\uC8BE\u60C0\u5148\u4768" + - "\uC8BF\u60C1\u4E59\uFEFE\u60C3\uFEFE\uFEFE\uFEFE\u4CE4\u4CBD\uFEFE\uC8C0\uC8C1\uC8C2\u60C2\uC8C3" + - "\uC8C4\u49F4\u5563\u46B9\u60BE\u60C5\uC8C5\u60C4\uFEFE\uFEFE\u60BF\u4688\uC8C6\u60C9\u60CC\u46BF" + - "\uC8C7\uFEFE\uC8C8\uFEFE\uFEFE\u60C8\uC8C9\uFEFE\uC8CA\uC8CB\u60D0\u60C6\uC8CC\u506D\uFEFE\uFEFE" + - "\u4CE7\u4EF7\u60CD\uFEFE\uC8CD\u4757\uC8CE\u60CA\uFEFE\uC8CF\uFEFE\uFEFE\uFEFE\u60CB\uFEFE\uC8D0" + - "\u4881\u5268\u60C7\uFEFE\u4AE4\u4AF3\uFEFE\uC8D1\u49F6\uC8D2\uC8D3\uFEFE\u54ED\uFEFE\uC8D4\uFEFE" + - "\uC8D5\uC8D6\uC8D7\uFEFE\uC8D8\uC8D9\uFEFE\uC8DA\u60CF\uFEFE\uC8DB\uC8DC\uC8DD\uFEFE\u5374\uFEFE" + - "\uC8DE\uFEFE\u60CE\uFEFE\uFEFE\uC8DF\uC8E0\uFEFE\u4A4A\u47CB\u54EB\u5070\uC8E1\uC8E2\u60DC\u60DA" + - "\uFEFE\u60D8\u60D2\uFEFE\uFEFE\uC8E3\uC8E4\uFEFE\uFEFE\uC8E5\u60D7\u51A3\u4880\u60D1\u60D9\u60DD" + - "\u48CB\u4A53\uC8E6\u4DC9\u60D3\uC8E7\u60D4\u60DB\uC8E8\u54D3\u54A6\uFEFE\u60D6\u49DC\u489D\uFEFE" + - "\uFEFE\uFFFE\u0005\uC8E9\u60D5\uFEFE\uFEFE\u4B97\u537D\uC8EE\uC8EF\uC8F0\u4793\uFEFE\u48A5\u4A9B" + - "\uFEFE\uFEFE\u60DE\u60E1\uC8F1\u60DF\uC8F2\u4687\uFEFE\u60E8\u60E0\u60E3\uFEFE\u4A80\u60E7\uC8F3" + - "\uFEFE\u60E2\uC8F4\uC8F5\uFEFE\u484E\u4CFC\uC8F6\uC8F7\u556B\uC8F8\uFEFE\u4E9A\uFEFE\uC8F9\u60E6" + - "\uFEFE\u4860\uC8FA\uC8FB\uFEFE\uFEFE\uC8FC\uC8FD\u60E4\uFFFF\u0004\uFEFE\uC8FE\u4BAA\uFEFE\uFEFE" + - "\u4859\u60E9\uFEFE\uFEFE\uC941\u60EE\u60EA\u60E5\uFFFF\u0004\uFEFE\uC942\uC943\u60EC\uFEFE\uFEFE" + - "\uC944\uFEFE\uC945\uFEFE\uFEFE\uFEFE\u52E6\uC946\uC947\u4F6B\u60ED\uC948\u60EB\u5BCC\u55A8\uFEFE" + - "\uFEFE\u4E93\uC949\uC94A\uFEFE\uFEFE\u49E4\uC94B\uC94C\u49F7\uC94D\uFEFE\u60F2\u60F9\uC94E\uFEFE" + - "\u60F4\uC94F\u60F8\uFEFE\u60F6\u60EF\u60F5\uFEFE\u60F3\u4866\uC950\uFEFE\u4759\uFEFE\u60F7\uC951" + - "\uC952\u60F0\uC953\u60F1\uFEFE\u4868\u5373\uFEFE\u52DA\uC954\uFEFE\uC955\uFEFE\u60FD\uFEFE\u489A" + - "\u51D4\u60FB\uFEFE\uC956\u60FE\u6141\uFEFE\uFEFE\u60FA\u60FC\uC957\uFEFE\uC958\uC959\uFEFE\uFEFE" + - "\uC95A\u60F1\u6142\uFEFE\u6145\u6144\uC95B\uFEFE\u4D9A\uC95C\uC95D\u4B69\uFEFE\uFEFE\uC95E\uFFFF" + - "\u0004\uFEFE\uC95F\u6143\uFEFE\u6147\u6146\u6148\uC960\u614A\uFEFE\uC961\u55EB\u614B\uFEFE\uFEFE" + - "\uC962\uC963\u5278\u614C\u51BF\uFEFE\u614E\uC964\u614D\u55FA\u5273\uC965\u614F\u6150\u6151\uC966" + - "\u6152\uFEFE\uC967\uFEFE\uC968\u6153\u539C\uC969\uC96A\uFFFF\u0097\uFEFE\u5084\uFEFE\u6154\uFEFE" + - "\u6155\uFFFE\u0005\uC96B\uFEFE\uFEFE\uFEFE\uC970\uC971\u6156\uFEFE\u6157\uFFFF\u0004\uFEFE\u6158" + - "\u54CB\u6159\uC972\u516E\u615A\uC973\uC974\u615C\u615B\uFEFE\uFEFE\u615D\uFEFE\uFEFE\uC975\uC976" + - "\uC977\uFEFE\u615E\u615F\uC978\uFEFE\uFFFE\u0004\uC979\u6161\u6160\u6162\u4C4E\u55EF\uFEFE\uC97D" + - "\u468C\uFEFE\u4F82\uC97E\u4C99\uFEFE\uFEFE\u5579\uFEFE\u55A5\u6163\u5AA5\uFEFE\uFEFE\uFEFE\uFFFE" + - "\u0004\uC97F\uFEFE\u6164\u6166\uFEFE\u4DFA\u6165\u6167\u6168\uFEFE\u4AD1\uC983\u6169\uC984\u457D" + - "\uC985\uC986\uC987\uFEFE\uFEFE\u616A\uFEFE\uC988\uC989\uFEFE\uFEFE\u616D\uFEFE\uC98A\u616C\u616B" + - "\uFEFE\uFEFE\u616E\uC98B\u616F\u47B1\uFEFE\uC98C\uFEFE\u5596\u4598\uC98D\uFEFE\uFEFE\uC98E\u6171" + - "\u6170\uFEFE\uFEFE\u6172\uFEFE\uC98F\uFEFE\u6174\uFEFE\u6175\u6173\uFEFE\uFEFE\uC990\u478F\uFEFE" + - "\uC991\uC992\u4FFB\uFEFE\uC993\uFEFE\u6178\u6179\uFEFE\uC994\uFEFE\u617A\uFEFE\u4D9C\uFEFE\uC995" + - "\uC996\uFEFE\uFEFE\u4A69\uFEFE\u54F9\u617B\uFFFF\u0005\uFEFE\uC997\uFEFE\uFEFE\uFEFE\uC998\u4F69" + - "\u617C\uFEFE\uC999\uFEFE\uC99A\u617D\uFEFE\uC99B\u617E\uFEFE\u558B\uC99C\uFEFE\uC99D\uC99E\u54B6" + - "\uFEFE\uC99F\u617F\uFFFF\u0005\uFEFE\u6180\uC9A0\u51F6\u4DB5\uC9A1\uC9A2\uC9A3\u52A0\u4985\uFEFE" + - "\u4760\u6181\u4670\u53DC\uC9A4\uC9A5\uFEFE\uC9A6\u6182\u51E6\uC9A7\uC9A8\uC9A9\u498E\uC9AA\u6183" + - "\uC9AB\uC9AC\u499A\uC9AD\u4FEC\u54E4\u6184\uFEFE\uFEFE\u6185\uFFFE\u0004\uC9AE\u6186\uFEFE\uFEFE" + - "\uC9B2\uFEFE\uC9B3\uFEFE\u6187\uFEFE\uFEFE\uFEFE\uC9B4\uFEFE\uC9B5\uFEFE\uC9B6\uFEFE\uFEFE\u4CAB" + - "\uC9B7\uC9B8\u4E99\uC9B9\uFEFE\uC9BA\uC9BB\u6189\uC9BC\u55B8\uC9BD\u6188\uC9BE\uFEFE\uFEFE\uFEFE" + - "\uC9BF\uFEFE\u618B\uFEFE\uFEFE\uFEFE\u618A\uFFFF\u0007\uFEFE\u618C\uFEFE\uFEFE\uFEFE\u4BB5\uFEFE" + - "\u618D\uFEFE\u5479\uFEFE\uFEFE\uFEFE\u48BB\u618E\uC9C0\u4B89\u618F\uFEFE\uC9C1\uFEFE\uC9C2\uFEFE" + - "\u6190\uFFFF\u0004\uFEFE\uC9C3\uFEFE\u53CA\u6193\uC9C4\u6192\u6191\u4DA8\uC9C5\u6194\u48D7\uFEFE" + - "\u6195\uFEFE\uFEFE\uFEFE\u6196\u53E4\u6197\uFEFE\uC9C6\uFEFE\uFEFE\u6198\u6199\u53B6\u4B41\uC9C7" + - "\u4A42\uFEFE\u557F\u4E50\uFEFE\uC9C8\uFFFF\u0004\uFEFE\u619A\uFEFE\uFEFE\u5267\uFEFE\u526A\uFEFE" + - "\u619B\u5292\uC9C9\u4C8C\uC9CA\uFEFE\uFEFE\u4CC5\u5382\uFEFE\uFEFE\u497B\uC9CB\uC9CC\uFEFE\u4B79" + - "\u4CFB\uC9CD\u619E\u619C\uFEFE\u50EB\uFEFE\u52D5\u48AC\uFEFE\u5451\uFEFE\uFEFE\uFEFE\uC9CE\uC9CF" + - "\u504E\uFFFF\b\uFEFE\u4DF6\u61A3\uFEFE\u4E9B\uFEFE\uC9D0\uFEFE\uFEFE\uFEFE\u4AB2\uC9D1\u5263" + - "\uC9D2\uFEFE\uFEFE\uC9D3\uFEFE\uC9D4\uC9D5\u5288\uC9D6\uC9D7\u61A1\u61A4\u619F\uFEFE\u61A2\u50B6" + - "\uFEFE\uC9D8\u4D63\uFEFE\uFEFE\u4EE9\u61A0\uFFFF\u0007\uFEFE\uC9D9\uC9DA\u61A6\uC9DB\u61A7\uC9DC" + - "\uC9DD\u4EAB\uFEFE\uC9DE\uFEFE\u4BE3\uC9DF\uC9E0\uFEFE\u61B0\u474F\uC9E1\uFEFE\uFEFE\uFEFE\u4874" + - "\uC9E2\uFEFE\u5051\u55EC\u47E3\u5079\u61A5\u535E\uC9E3\uFFFF\n\uFEFE\uC9E4\uC9E5\uC9E6\uFEFE" + - "\u4D5C\u61A8\uC9E7\uFEFE\uC9E8\uFEFE\uC9E9\uFEFE\uFEFE\u61A9\uC9EA\uFEFE\uFEFE\uC9EB\uFEFE\u4C96" + - "\uFEFE\uFEFE\uC9EC\uFEFE\uFEFE\u61AA\uC9ED\u4AB4\uFEFE\u4CB3\uFEFE\uC9EE\uFEFE\uFEFE\uFEFE\u55E9" + - "\uC9EF\uFEFE\uC9F0\uFEFE\u61AD\uFEFE\uFEFE\u61B0\uFEFE\uFEFE\uFEFE\uC9F1\u61AC\uC9F2\uFEFE\uFEFE" + - "\uC9F3\u61AB\uC9F4\uFEFE\u52C4\uFEFE\u4D62\u61AF\uC9F5\u61AE\u5247\u4CAF\uFEFE\uC9F6\uFFFF\u0007" + - "\uFEFE\u61B4\uC9F7\uC9F8\uFEFE\uFEFE\uFEFE\u61B3\u61B5\uC9F9\uC9FA\uC9FB\uFEFE\u51CE\uFEFE\uC9FC" + - "\u61B2\uC9FD\u4BA4\u61B1\uFEFE\uFEFE\u61B6\uFEFE\uFEFE\uC9FE\u4DB6\u4CA0\u526F\uFFFF\u0004\uFEFE" + - "\u529A\u61BA\uCA41\u61BB\u61B7\uCA42\uCA43\uCA44\uFEFE\u61B8\uFEFE\u61B9\uCA45\uFEFE\uFEFE\uCA46" + - "\u51D8\uCA47\uFEFE\uFEFE\u61BF\uFEFE\u61BD\uCA48\uFEFE\uCA49\uFEFE\u5191\uCA4A\u4D8A\u5060\uCA4B" + - "\uFEFE\u61BC\uFEFE\uCA4C\u61BE\u61C1\uFEFE\uFEFE\uFEFE\u4EF6\u61C2\uFFFF\u0004\uFEFE\uCA4D\uFEFE" + - "\u61C4\uFEFE\uCA4E\u5076\uCA4F\u61C0\uFEFE\uFEFE\u61C3\uFEFE\u61CA\uCA50\uFEFE\u61C7\u61C6\u535F" + - "\u61C8\uFEFE\u61C9\uCA51\uFEFE\uCA52\u5474\uFEFE\u61C5\u61CB\uCA53\uCA54\uFEFE\u61CC\uCA55\uCA56" + - "\uFEFE\u61CD\uFEFE\u4DBD\uFEFE\uCA57\uFEFE\uCA58\u61CE\u61CF\u61D0\uCA59\uFEFE\uCA5A\uCA5B\u61D1" + - "\u61D2\uCA5C\uFEFE\u4A47\uCA5D\u538A\uFEFE\u5173\u4CD0\uFEFE\u45C3\uCA5E\uCA5F\u4DB3\uFEFE\uFEFE" + - "\uCA60\uCA61\uCA62\u4A48\u4C6A\uCA63\uCA64\uFEFE\uCA65\uCA66\u61D3\u61D4\u4A89\uCA67\u61D5\uCA68" + - "\uCA69\u61D6\u61D7\uCA6A\uFEFE\u61D8\uFEFE\u5358\u466A\u5778\u62BA\uFEFE\u5094\u61D9\u4C58\uCA6B" + - "\u61DA\uFEFE\u61DB\uCA6C\uCA6D\uFEFE\u61DC\u4E5B\u4CAA\uCA6E\uCA6F\u4FC1\u4FB8\uCA70\u4A63\u4BB8" + - "\uFEFE\uCA71\uCA72\uFFFF\u0005\uFEFE\uCA73\u61DD\u489F\u61DE\u4956\uFEFE\u61DF\uFEFE\uFEFE\uFEFE" + - "\uCA74\u61E1\uCA75\u54DB\u4B87\u53AC\u61E0\u467B\uCA76\uFFFF\u0005\uFEFE\u61E2\uFEFE\uFEFE\uFFFE" + - "\u0004\uCA77\u4DFC\uFEFE\uFEFE\uFEFE\uCA7B\uFEFE\uFEFE\uCA7C\uCA7D\uFEFE\uCA7E\uFFFF\u0004\uFEFE" + - "\uCA7F\uFEFE\u54AE\u61E3\u61E4\uFEFE\uCA80\u61E5\uFEFE\u61E6\uCA81\uFEFE\u61E8\uCA82\u61E7\uFEFE" + - "\u4C4A\uCA83\u61E9\uFEFE\u61EA\u61EB\uFEFE\uCA84\u55B4\u45C4\uFEFE\u61EC\u47C3\uFEFE\uCA85\uFEFE" + - "\u4D54\u61ED\u53C5\uFEFE\uFEFE\uCA86\uFEFE\uCA87\u61EE\uCA88\uCA89\uCA8A\uFEFE\uCA8B\uCA8C\uFEFE" + - "\uFEFE\uCA8D\uFEFE\uCA8E\uCA8F\u519A\uFEFE\u61EF\uCA90\uFEFE\uFEFE\uCA91\u61F0\uFEFE\uCA92\uFEFE" + - "\uCA93\uFEFE\uCA94\u4EBD\uCA95\uCA96\uFEFE\u4972\uFEFE\u61F2\uCA97\uCA98\uFEFE\uCA99\uCA9A\u4F7B" + - "\u4ADD\uFFFE\u0004\uCA9B\u61F1\u61F4\u5442\uCA9F\u4FE5\uCAA0\u46D9\uCAA1\u4683\uCAA2\uFEFE\uFEFE" + - "\uCAA3\u4953\u4DD0\uCAA4\u61F3\uCAA5\u4EBA\uCAA6\uCAA7\uFFFF\u0005\uFEFE\u4E5D\uCAA8\uFFFF\t" + - "\uFEFE\uCAA9\u504B\u61F9\u5559\u52D7\uCAAA\uFEFE\u4AB8\uFEFE\u6246\uCAAB\u5377\u6243\uFEFE\u6241" + - "\u61F7\uCAAC\u61F5\uCAAD\u61F6\uCAAE\u46D6\u4A5F\u54B0\uCAAF\uFEFE\uCAB0\u4D5A\uFEFE\uCAB1\uFEFE" + - "\uCAB2\uFEFE\u45EE\uFEFE\u61FB\u61FA\uFEFE\uCAB3\uCAB4\uFEFE\u61FE\u6244\u61FD\uFEFE\uCAB5\uCAB6" + - "\uFEFE\uCAB7\u61F8\u4646\u61FC\u547A\u4BD3\u6242\uCAB8\uCAB9\u6245\uCABA\uCABB\uFEFE\uFEFE\u4EC9" + - "\uFFFF\u0007\uFEFE\u624A\u53F6\u6252\uFEFE\uFEFE\uCABC\u50E2\uCABD\uCABE\uCABF\uFEFE\uCAC0\uCAC1" + - "\u6258\uFFFF\u0004\uFEFE\u474C\uFEFE\uFEFE\u6251\uCAC2\uCAC3\uCAC4\u6250\uCAC5\u624B\u547B\uCAC6" + - "\u6249\u6247\u4977\uCAC7\u4DF7\u624D\uCAC8\uFEFE\uCAC9\uCACA\uFEFE\uFEFE\u624C\uFEFE\uCACB\uCACC" + - "\uCACD\u624F\u53B3\uCACE\uFEFE\u4842\u53B3\uFEFE\uFEFE\uCACF\uCAD0\u515F\u624E\uCAD1\u46DC\uFFFE" + - "\u0005\uCAD2\u4B62\uFFFF\t\uFEFE\u6248\uFFFF\r\uFEFE\uCAD7\uFEFE\uFEFE\u625F\uFEFE\u625A" + - "\uFEFE\u4BA1\uCAD8\uFEFE\uFEFE\u49E0\u625D\uCAD9\uFEFE\u625B\uCADA\uFEFE\uCADB\uFEFE\uCADC\u6262" + - "\uCADD\u5486\uFEFE\u6263\u625C\uFEFE\uFEFE\uCADE\u6259\uFEFE\uFEFE\uFEFE\uCADF\u6260\uCAE0\uCAE1" + - "\u6257\uFEFE\uCAE2\uCAE3\u6253\uCAE4\uCAE5\uCAE6\u51EE\u6255\u6261\uFEFE\u6256\uFEFE\uFEFE\uFEFE" + - "\uCAE7\uCAE8\u6264\uCAE9\u6254\u54B3\uCAEA\uCAEB\uFEFE\uFEFE\uFEFE\u52C9\uFEFE\uFEFE\uFEFE\u625E" + - "\uFFFF\u0007\uFEFE\u6275\uCAEC\uCAED\uCAEE\u626E\uFEFE\uFEFE\uFEFE\u4753\uFEFE\u6267\uFEFE\uCAEF" + - "\u46D7\uFEFE\u4C73\uFEFE\u6268\uCAF0\uCAF1\uCAF2\uFEFE\u4C51\uCAF3\uFEFE\u5180\uFEFE\u626C\uFEFE" + - "\uFEFE\uFEFE\u4BA8\uCAF4\uFEFE\u53D4\u6270\uFFFF\u0007\uFEFE\uCAF5\u516A\uCAF6\u54E9\uFEFE\uFEFE" + - "\uFEFE\u4B6C\u516D\u48CC\u6271\uFEFE\u6265\uFEFE\u6274\u6269\uCAF7\uCAF8\uFEFE\u6276\uCAF9\u626A" + - "\uFEFE\uFEFE\uFEFE\uCAFA\uFEFE\u626B\u54F7\uFEFE\uCAFB\u626F\uFEFE\uFEFE\uCAFC\u626D\u50DB\u6272" + - "\u5482\uCAFD\uFEFE\uCAFE\uFEFE\u6266\uFEFE\uCB41\uFEFE\uFEFE\uFEFE\uCB42\uFFFF\u0006\uFEFE\u6273" + - "\uFEFE\u54D8\uFFFF\u0006\uFEFE\u494A\u6277\uFEFE\u4B75\uFEFE\uFEFE\uCB43\uFEFE\u4F7C\uFEFE\uFEFE" + - "\uFEFE\u6285\uFEFE\uFEFE\u6284\uCB44\uFEFE\uFEFE\u6279\u47F2\uFFFF\u0007\uFEFE\uCB45\u6282\uCB46" + - "\u627E\u45F9\uCB47\uFEFE\uFEFE\uCB48\u559F\uCB49\uFEFE\uCB4A\uCB4B\uFEFE\uFEFE\uFEFE\uCB4C\u4A59" + - "\uCB4D\uCB4E\uCB4F\u48DF\uCB50\uFEFE\uFEFE\uFEFE\uCB51\u5547\u6278\u5071\uCB52\uCB53\u4E72\uCB54" + - "\uFEFE\u6281\uCB55\u627C\u4F79\u516C\u627F\u6283\uCB56\u544E\uFEFE\uCB57\uCB58\u50D9\uCB59\u627B" + - "\uCB5A\u627D\u50E0\uFEFE\uCB5B\uCB5C\uFEFE\uFEFE\uFEFE\uCB5D\u6280\uFEFE\u627A\uCB5E\uFFFF\u0005" + - "\uFEFE\u53F8\uFFFF\u0004\uFEFE\u4F93\uFEFE\uCB5F\uCB60\u4FE3\uCB61\uFEFE\uFEFE\uFEFE\u5095\uFEFE" + - "\uFEFE\u5259\uFEFE\uCB62\u6289\uFEFE\u6293\uFFFF\u0004\uFEFE\uCB63\uFEFE\uCB64\uCB65\uCB66\uFEFE" + - "\uFEFE\u6290\uFEFE\uCB67\uFEFE\uCB68\u49B2\uFEFE\u628A\uFEFE\uFEFE\uFEFE\u4ABA\u6287\uCB69\u628C" + - "\u50B9\uCB6A\uCB6B\u6288\uCB6C\u628F\uCB6D\uFEFE\u4C94\uFEFE\u6291\uCB6E\uCB6F\u5083\u6286\u4F6D" + - "\uCB70\u628B\uFEFE\uCB71\u628E\u4F9A\uFEFE\uCB72\uFEFE\uFEFE\u6292\uFEFE\uFEFE\u6294\u628D\uFEFE" + - "\u527B\uFFFF\n\uFEFE\uCB73\uFEFE\uFEFE\uCB74\uFEFE\u5088\uFEFE\u4BF4\uFFFE\u0004\uCB75\uFEFE" + - "\u6296\uFEFE\uFEFE\uCB79\uFEFE\uFEFE\uCB7A\uCB7B\u518B\uCB7C\uFEFE\u6295\u52BD\uFEFE\uCB7D\uCB7E" + - "\uFEFE\uFEFE\u629D\uCB7F\uFFFF\u0004\uFEFE\uCB80\uFEFE\uCB81\uFEFE\uCB82\u556C\uFEFE\u557B\u629C" + - "\u629B\uFEFE\u6297\u6298\uFEFE\u549A\uFEFE\uCB83\uFEFE\uCB84\u629A\uFEFE\u54A8\uFFFE\u0004\uCB85" + - "\u4FA1\uCB89\uFEFE\uFEFE\uCB8A\uCB8B\u6299\u4E8B\uFEFE\uCB8C\uFEFE\uFEFE\uCB8D\uCB8E\uCB8F\u465E" + - "\uCB90\uFFFF\u0006\uFEFE\u54D1\uFEFE\uCB91\u62A0\u62A5\uFEFE\u52F7\uFEFE\uFEFE\uCB92\uFEFE\u62A4" + - "\u53A8\u62A6\u62A7\uFEFE\uFEFE\u5565\uFFFE\u0004\uCB93\u629E\uFEFE\u62A9\uCB97\u5491\u62A3\u62A1" + - "\u629F\uFEFE\uFFFE\u0007\uCB98\u62A2\uCB9F\uFEFE\uFEFE\uFEFE\u50DE\u54F0\u51D3\u62A8\uFEFE\u62B0" + - "\uFEFE\uCBA0\uFFFF\u0007\uFEFE\u62B6\uFEFE\uCBA1\uCBA2\uCBA3\uFEFE\uCBA4\u62B7\uCBA5\u62AA\uCBA6" + - "\uFEFE\uFEFE\u4A92\uCBA7\uCBA8\u62B4\u62AC\uCBA9\u62AE\uCBAA\uCBAB\uFEFE\uFEFE\uCBAC\u62B8\u62AD" + - "\uFEFE\uCBAD\u62B1\uFEFE\uFEFE\u4CEC\uCBAE\u51AD\uFEFE\u62B2\u62B5\uCBAF\uFEFE\uCBB0\uCBB1\uFEFE" + - "\uCBB2\uFEFE\u62AB\uCBB3\u4FBF\uCBB4\u62AF\u4CF1\u545A\u4998\u46E1\uCBB5\u62B3\u53F9\u62BB\uFEFE" + - "\uFEFE\uFEFE\uCBB6\uFEFE\uCBB7\uCBB8\uCBB9\u62BF\u62BD\uFEFE\uFFFE\u0004\uCBBA\uFEFE\u4FBB\uCBBE" + - "\uFFFF\u0004\uFEFE\uCBBF\uFEFE\u62BC\uCBC0\uCBC1\uFEFE\u4EED\uCBC2\u62BE\u62C0\uFFFF\u0004\uFEFE" + - "\u62C1\uFEFE\uFEFE\uCBC3\uFEFE\uCBC4\uFEFE\u62C4\u62C2\uFEFE\uCBC5\uCBC6\uFEFE\uFEFE\uFEFE\u4568" + - "\u62C3\uCBC7\uFEFE\uCBC8\u4FF6\u4C95\uFEFE\uFEFE\uCBC9\uFFFF\u0005\uFEFE\uCBCA\uFEFE\uFEFE\uCBCB" + - "\u55E2\uFEFE\u62C5\u53ED\u505F\uCBCC\uFEFE\u62C9\uCBCD\uCBCE\uFEFE\u5496\uFEFE\uCBCF\uCBD0\u4EDA" + - "\u4CBF\uFEFE\uFEFE\u62C6\u62C8\uFEFE\uCBD1\uCBD2\uFEFE\uCBD3\uCBD4\uCBD5\u62C7\uFEFE\uFEFE\u5CBD" + - "\u5CBE\uCBD6\uCBD7\u62CB\uCBD8\uFEFE\uFEFE\uCBD9\uFEFE\uFEFE\uCBDA\u62CA\uFFFF\u0004\uFEFE\uCBDB" + - "\uFEFE\uCBDC\uFEFE\uFEFE\uFEFE\u4CA6\uFEFE\u5F82\u62CC\uFFFF\u0005\uFEFE\uCBDD\uFEFE\uCBDE\uFEFE" + - "\uCBDF\uFEFE\uCBE0\uCBE1\uFEFE\u62CD\uCBE2\uCBE3\uCBE4\uFEFE\uFEFE\uFEFE\uCBE5\uFFFF\u0006\uFEFE" + - "\u62CF\u4AAB\uFEFE\u5260\uFEFE\uCBE6\uCBE7\u52FB\u62D1\uFFFE\u0004\uCBE8\u4F72\uFEFE\u5250\uCBEC" + - "\u5588\u62D2\uFFFE\u0005\uCBED\uFEFE\uFEFE\u62D3\uFEFE\uCBF2\uFEFE\u4BCB\uCBF3\uFEFE\uFEFE\uCBF4" + - "\uFEFE\u62D4\uFEFE\uFEFE\uFEFE\uCBF5\uCBF6\uCBF7\uFEFE\u51B6\uCBF8\u5144\uFFFF\f\uFEFE\uCBF9" + - "\uFEFE\u4FAA\u62D8\u62DA\uCBFA\uFEFE\uFEFE\uFEFE\uCBFB\uFEFE\u62D5\uFEFE\u4F5D\uCBFC\uFEFE\uCBFD" + - "\uFEFE\uCBFE\uFEFE\uCC41\uFFFF\u0004\uFEFE\uCC42\uFEFE\u62D6\u55A2\uFEFE\uCC43\uCC44\uCC45\u62D7" + - "\u62D9\u62E3\uFEFE\uCC46\uFEFE\u62DC\u62DF\uCC47\uFEFE\uCC48\uCC49\uCC4A\u62DB\uCC4B\uCC4C\uCC4D" + - "\uFFFF\u0005\uFEFE\uCC4E\uCC4F\uCC50\uFEFE\uCC51\u62DD\uCC52\u62DE\u4FEA\uFEFE\u62E0\uFEFE\u53D8" + - "\uFEFE\u4DF9\u62E1\uFEFE\uFEFE\uCC53\uCC54\uFEFE\u62E4\uCC55\uFEFE\uCC56\uFEFE\u55BB\uCC57\u62E9" + - "\uCC58\uFEFE\u62E5\u62E8\uCC59\uFEFE\uFEFE\uCC5A\u55C2\uCC5B\uFEFE\uCC5C\uFEFE\u62E6\uFEFE\uFEFE" + - "\u62E7\u4E66\u53A5\u4F74\uFFFF\b\uFEFE\u524E\u62F3\uCC5D\u62EF\uCC5E\uCC5F\u5599\uFEFE\u62ED" + - "\uFEFE\u4ECD\u62EE\uCC60\uCC61\u62EB\uCC62\u62EC\u62F1\u62F4\uCC63\uFEFE\u62F2\uCC64\uCC65\uCC66" + - "\u62F0\u62EA\uCC67\uCC68\uFEFE\uFEFE\uFEFE\u54DC\uCC69\u62FA\uFEFE\u53A1\uFEFE\uCC6A\uCC6B\uFEFE" + - "\uCC6C\uFEFE\uCC6D\uFEFE\u62F8\uFEFE\uFEFE\uCC6E\u62F9\uFFFF\u0004\uFEFE\uCC6F\uCC70\uFEFE\uCC71" + - "\uCC72\uFEFE\u62F5\uFEFE\uFEFE\u526D\uFEFE\uCC73\uCC74\u62F7\uCC75\uCC76\uCC77\u62F6\uCC78\uFEFE" + - "\uFEFE\uCC79\uFEFE\uCC7A\uFEFE\uFEFE\uFEFE\u53E8\uFEFE\u52A1\u62FD\uCC7B\u62FE\uFFFF\u0004\uFEFE" + - "\u6349\uFEFE\u5347\uFEFE\u6342\uCC7C\u6348\uFEFE\uFEFE\uFEFE\uCC7D\uFEFE\u62FB\u6346\uCC7E\uFEFE" + - "\u634A\uCC7F\uCC80\u51C3\uFEFE\u6343\uFEFE\u6345\uFEFE\uFEFE\uFEFE\u6347\uCC81\uFEFE\uCC82\uCC83" + - "\uFEFE\u6341\uFEFE\u4E6E\uFEFE\u62FC\uFEFE\uFEFE\uCC84\uFEFE\uFEFE\uFEFE\u634B\uFEFE\uFEFE\u6344" + - "\uFFFE\u0007\uCC85\uFEFE\uCC8C\uCC8D\u48C2\uFEFE\uFEFE\uCC8E\uFEFE\uFEFE\uCC8F\uFEFE\uCC90\uFEFE" + - "\uCC91\uCC92\uCC93\uFFFF\u0004\uFEFE\uCC94\u634E\uCC95\uFEFE\u634C\uCC96\uFEFE\uFEFE\uFEFE\uCC97" + - "\uFEFE\uFEFE\uFEFE\u6355\uCC98\uCC99\uCC9A\u634F\uFEFE\uCC9B\uFEFE\u6357\uFEFE\uCC9C\uFFFF\u0004" + - "\uFEFE\u51D6\u6359\uFEFE\u6351\uCC9D\uCC9E\u6352\uCC9F\uFEFE\uFEFE\u6356\uFEFE\u634D\u54F4\uCCA0" + - "\uCCA1\uCCA2\u6350\uFEFE\uFEFE\uCCA3\uFEFE\u6353\uFEFE\u6358\uFEFE\uFEFE\uCCA4\uCCA5\uFEFE\uFEFE" + - "\uCCA6\uCCA7\uFEFE\uCCA8\uFEFE\uFEFE\uCCA9\u635C\uFEFE\uCCAA\uCCAB\uCCAC\uFFFF\u0005\uFEFE\uCCAD" + - "\uCCAE\u53E8\uCCAF\uFEFE\u635A\uFEFE\uCCB0\u635B\uCCB1\uFEFE\uFEFE\u6363\u6364\uCCB2\u5090\uCCB3" + - "\u51C6\uFEFE\uFEFE\u6362\uCCB4\uFEFE\uCCB5\uFEFE\uCCB6\uFEFE\u55BD\uCCB7\u635E\uFEFE\uCCB8\uCCB9" + - "\uCCBA\uFEFE\u6361\u635D\u635F\uCCBB\u6365\uCCBC\uCCBD\uCCBE\u6366\u6360\uFEFE\uFFFE\u0005\uCCBF" + - "\uFEFE\uCCC4\uCCC5\uFEFE\u6368\u6367\u5351\uFEFE\uFEFE\uFEFE\u6369\uCCC6\uFFFF\u0004\uFEFE\uCCC7" + - "\uCCC8\uFEFE\uCCC9\u636A\uCCCA\uFEFE\uFEFE\uCCCB\u636B\uFEFE\uFEFE\u636C\uCCCC\u636D\uCCCD\uFEFE" + - "\uFEFE\uFEFE\u4B43\uCCCE\u636E\uCCCF\u636F\uCCD0\u4B88\uFEFE\uFFFE\u0004\uCCD1\u45A4\u6370\uCCD5" + - "\uFEFE\uFEFE\uCCD6\u6371\u486C\uFEFE\uCCD7\uCCD8\u4BA5\uCCD9\u6372\uCCDA\u4780\uCCDB\u4DA5\u6373" + - "\uCCDC\uCCDD\u4BED\u6374\u4AEA\uCCDE\uFEFE\uFEFE\uFEFE\u46C0\uCCDF\uFEFE\u6375\uFFFF\u0004\uFEFE" + - "\u4F54\uCCE0\u637A\uFEFE\uFEFE\u6378\uFEFE\u52E9\uFEFE\uCCE1\uFEFE\uCCE2\uFEFE\u6379\u6377\u4AA7" + - "\uCCE3\u6376\u637B\uFFFF\u0005\uFEFE\u4F6A\uFEFE\uFEFE\u4A54\uFEFE\u6382\uFFFF\u0004\uFEFE\u637E" + - "\uFEFE\uFEFE\uFEFE\u4A57\u637D\uCCE4\u6380\uCCE5\uCCE6\uCCE7\uFEFE\u637C\uCCE8\uCCE9\uFEFE\u6381" + - "\uFEFE\u6383\uFEFE\uFEFE\uFEFE\uCCEA\uFEFE\uCCEB\u4B8D\uFEFE\uFEFE\u637F\uFEFE\u54C5\u6386\uFEFE" + - "\uFEFE\u4F5A\u6385\uFEFE\u5448\uFEFE\uFEFE\uCCEC\uFEFE\uFEFE\uCCED\uCCEE\u6384\uCCEF\u49BD\u4F60" + - "\u6387\u6388\u4898\uFFFF\u0004\uFEFE\uFFFE\u0005\uCCF0\u49A4\uFEFE\uCCF5\uCCF6\uCCF7\u6389\u46F8" + - "\uFEFE\uFEFE\u638A\u638B\uFEFE\uCCF8\u496A\u638C\uCCF9\u4F8A\uFEFE\u544D\uFFFF\u0005\uFEFE\uCCFA" + - "\u6391\uFFFF\u0006\uFEFE\uCCFB\uCCFC\uCCFD\u6392\u4FA8\u5349\u6390\uFEFE\uCCFE\u4F43\u638D\uFEFE" + - "\uFEFE\u638F\u457B\u4C8D\uFEFE\uFEFE\uCD41\u638E\uFEFE\u6393\uFEFE\uCD42\u4B51\uFEFE\uFEFE\u6397" + - "\uFEFE\u6394\uCD43\uCD44\uCD45\u545E\uFEFE\u51BA\u6398\uFEFE\uCD46\uCD47\uFEFE\uCD48\uCD49\uCD4A" + - "\uFEFE\u51DA\u6396\u6399\uFEFE\uCD4B\uFFFF\u0004\uFEFE\u639A\uCD4C\uCD4D\uCD4E\uFEFE\u6395\u639B" + - "\uFFFF\u0004\uFEFE\uCD4F\uCD50\uCD51\uFEFE\uFEFE\uCD52\u639E\uFEFE\u63A0\uCD53\uCD54\u639D\uFEFE" + - "\uFEFE\uCD55\uFEFE\uCD56\u639C\uCD57\u639F\u506B\uCD58\uCD59\uFEFE\uFEFE\uCD5A\uFEFE\uFEFE\u63A2" + - "\u63A1\uFEFE\uCD5B\uFEFE\uFEFE\uCD5C\uFEFE\uFEFE\uFEFE\u546C\uCD5D\uFEFE\uFEFE\uCD5E\uCD5F\uCD60" + - "\uFEFE\u63A4\u54AF\u63A3\uCD61\uCD62\uCD63\u63A7\uFEFE\u63A5\uFEFE\uFEFE\uFEFE\u63A6\uCD64\uFEFE" + - "\u63A8\uCD65\u63A9\uCD66\uFEFE\u4DDF\uCD67\u63AA\uCD68\uFEFE\u63AB\uFEFE\uFEFE\uFFFE\u0004\uCD69" + - "\u63AC\u4558\uFEFE\u4655\uFEFE\u63AD\uFEFE\uFEFE\u4DF2\u4BFA\u63AE\uCD6D\u63AF\u45BB\uFEFE\uCD6E" + - "\uFEFE\u46FB\uCD6F\uFEFE\uFEFE\u63B0\uCD70\uCD71\u4A50\u53EB\u63B1\uFEFE\u4A4C\uCD72\uCD73\uFEFE" + - "\uFEFE\uCD74\uCD75\u63B2\uFEFE\uFEFE\uFEFE\uCD76\u63B4\u4ED0\uFEFE\u63B3\u4885\uFEFE\u63B5\uFEFE" + - "\uFEFE\u63B6\uCD77\uFEFE\u63B7\u487E\uFFFE\u0004\uCD78\uFEFE\uFEFE\u63B8\uFEFE\uCD7C\u63BA\uFEFE" + - "\u63B9\u63BB\uFFFF\u0011\uFEFE\u477D\uFEFE\uFFFE\u0005\uCD7D\uFEFE\u63BC\uFEFE\u5360\u63BD\uFFFF" + - "\u0005\uFEFE\u47B7\uFEFE\uCD82\u4CD1\u63BE\uFEFE\uCD83\uFEFE\uCD84\uFEFE\uCD85\uFEFE\uFEFE\uFEFE" + - "\uCD86\uFEFE\uCD87\u63BF\uFEFE\uCD88\uFEFE\u63C0\uCD89\uFEFE\uFEFE\uFEFE\uCD8A\uFEFE\uCD8B\u479A" + - "\uFEFE\u4FC4\u63C1\uCD8C\uCD8D\uFEFE\uCD8E\u45C9\uFEFE\u50F2\uFEFE\u63C4\uFEFE\u49D2\uCD8F\u63C3" + - "\uCD90\u63C5\u4BC8\uCD91\uCD92\u63C2\u4AB6\u4794\uFEFE\uFEFE\u63C6\uFEFE\u63C7\uCD93\u50EF\uCD94" + - "\uFEFE\uCD95\u54CC\uCD96\u63C8\uCD97\uFEFE\uFEFE\uFEFE\u4A71\uCD98\uCD99\u45E2\uFEFE\uCD9A\uFEFE" + - "\u4A9A\uFEFE\u4BAD\u4CDF\uCD9B\u63C9\u63CB\uFEFE\uFEFE\u4D68\u4F66\u49BA\uCD9C\uCD9D\uFEFE\uCD9E" + - "\u63CA\uFEFE\uCD9F\uFEFE\uCDA0\u63CE\uCDA1\u63CF\uCDA2\uFEFE\uFEFE\uFEFE\uCDA3\uCDA4\uFEFE\u5176" + - "\u55E3\u63CD\uCDA5\u4F88\u49FD\uCDA6\uCDA7\uCDA8\uFEFE\uFEFE\u63CC\uCDA9\uCDAA\u4E90\uFEFE\u51C1" + - "\uCDAB\u63D3\u54FB\uFEFE\uCDAC\u4948\uCDAD\uFEFE\u4CB0\uFEFE\u50D3\u63D2\u63D1\u518E\uFEFE\u4B5F" + - "\u4750\u4D8D\u4DE7\uFEFE\uCDAE\uCDAF\uCDB0\uFEFE\u63D4\uCDB1\uCDB2\u63D0\uFEFE\uCDB3\uCDB4\uCDB5" + - "\uFEFE\u63D6\uCDB6\u63D7\u63D5\uCDB7\u4EB4\uFEFE\u4D8C\uFEFE\uCDB8\u4B76\u4A7E\uFEFE\uCDB9\uCDBA" + - "\u63DA\uCDBB\u4FA0\uFEFE\u4FA2\uCDBC\uCDBD\u4ACB\uCDBE\u63DD\uFEFE\uFEFE\uFEFE\u48E7\uCDBF\u46FD" + - "\u63D9\uFEFE\u63DE\u4D91\u63DB\u63DC\u63DF\u63D8\uCDC0\uFEFE\uFEFE\u4952\u4A4F\uCDC1\uCDC2\u4B83" + - "\uFEFE\u49D6\uCDC3\uFEFE\uFEFE\uCDC4\uCDC5\uFEFE\u55F2\uFEFE\uCDC6\u5265\uFEFE\u63E1\u4689\uFEFE" + - "\uFEFE\u63E3\uCDC7\u50B2\uFEFE\uCDC8\u4963\uCDC9\uCDCA\uCDCB\u4AE8\u63E0\u63E2\uFEFE\u4BC1\uFEFE" + - "\uCDCC\u5181\uCDCD\uCDCE\uCDCF\u48F3\uCDD0\uFEFE\uFEFE\u63E4\u63F2\u5570\uCDD1\u63F1\u63ED\u63EA" + - "\u63EC\u63EB\uFEFE\u63E7\uFEFE\u5246\u63E6\uFEFE\uFEFE\uFEFE\u4E96\uCDD2\u4E9C\u4F9C\uFEFE\uCDD3" + - "\u63E8\uFEFE\u63E5\uCDD4\uCDD5\u63EF\u63F0\u47E2\uFEFE\u55AB\uFEFE\uCDD6\uFEFE\u4FE1\uCDD7\u4F4D" + - "\u54E5\u5573\uFEFE\u4FE2\uCDD8\uCDD9\u63F4\uFEFE\uFEFE\uCDDA\uCDDB\u63F3\uFEFE\u52F9\uFEFE\u63F7" + - "\uCDDC\uFEFE\uFEFE\u63E9\uFEFE\u63F6\u63F8\uFEFE\u497C\u63F5\u4A6E\uCDDD\u4DBB\uCDDE\uCDDF\u63F9" + - "\u4D7D\uFFFF\u0004\uFEFE\u63FD\uFEFE\u5381\uFEFE\uFEFE\u63FE\u55A1\uCDE0\uFEFE\uFEFE\uCDE1\uFEFE" + - "\uFEFE\u63FA\uFEFE\uFEFE\uFEFE\uCDE2\uFEFE\u4D87\uFEFE\uFEFE\uCDE3\uFEFE\u6441\uFEFE\uFEFE\u63FB" + - "\uFFFE\u0005\uCDE4\uFEFE\uCDE9\u6446\uFEFE\uFEFE\u6442\uCDEA\u6444\u6443\uFEFE\uFEFE\uCDEB\u6445" + - "\uCDEC\uFEFE\u6447\uFEFE\u4A75\uCDED\u6449\u6448\u4E4F\uFEFE\uCDEE\u644C\uFEFE\uFEFE\uFEFE\uCDEF" + - "\uFEFE\uFEFE\u4AD7\uFFFF\u0004\uFEFE\u644B\u644D\uCDF0\uFEFE\u644E\u4781\u6176\u4B7B\uFEFE\u644A" + - "\uFEFE\uCDF1\u49DB\uCDF2\uCDF3\uFEFE\uFEFE\uCDF4\u644F\uCDF5\u6450\u6451\uCDF6\uFEFE\u516B\uCDF7" + - "\uCDF8\uFFFF\u0004\uFEFE\u5B88\uCDF9\u6452\uCDFA\u6453\uCDFB\u53FE\uFEFE\u6455\u6456\uCDFC\uCDFD" + - "\u6457\uFEFE\uFEFE\u6454\u6458\uFEFE\uCDFE\uFEFE\uCE41\uCE42\uFFFF\u0097\uFEFE\u4581\uCE43\uCE44" + - "\u6459\uFEFE\uFEFE\uCE45\uCE46\u645B\uFEFE\u645A\uFEFE\uFEFE\uFEFE\uCE47\u4A99\uCE48\u645C\uCE49" + - "\u4648\uCE4A\u645D\uFEFE\u645E\uCE4B\u645F\uCE4C\uFEFE\uCE4D\uCE4E\u6460\uFEFE\uCE4F\uCE50\uCE51" + - "\u4CCF\uCE52\uFEFE\uCE53\uFEFE\uFEFE\uFEFE\u4994\u6461\uCE54\uCE55\uFEFE\uCE56\uFEFE\uCE57\uCE58" + - "\u4C68\u5355\u6462\uCE59\uFFFF\u0005\uFEFE\uCE5A\uFEFE\uCE5B\uCE5C\uFEFE\u6463\u5593\u6464\uCE5D" + - "\u6465\uFEFE\uCE5E\uFEFE\uFEFE\uFEFE\u6466\uFEFE\uFEFE\u6468\uCE5F\uCE60\uFEFE\u6467\u6469\uCE61" + - "\u5064\u646A\u646B\uFEFE\uCE62\uFEFE\uCE63\uCE64\u646D\uFEFE\uFEFE\uFEFE\u646C\uCE65\uFEFE\uCE66" + - "\uCE67\u49EA\u46B6\uFEFE\u49C8\u49AF\u4AF1\uFEFE\uCE68\uFEFE\uFEFE\u4DA3\u4AEB\u4A5D\u6470\u49A1" + - "\u4BD2\u646F\u6471\u4C62\u4DEF\uFEFE\u6473\u6474\u487F\uFEFE\u6476\u4974\u4AF4\uCE69\uCE6A\u46D0" + - "\u507B\u6472\uFEFE\u4872\u4641\u6475\u55F8\u4B4D\u5067\uCE6B\uCE6C\u4650\u6477\uCE6D\u4FFD\uCE6E" + - "\uFEFE\u6479\u6478\uCE6F\uFEFE\u539E\uFEFE\u50D7\uFEFE\uCE70\uCE71\uFEFE\uFEFE\uCE72\u647B\u4DEE" + - "\u4F94\uCE73\u4AAD\uFEFE\u4F4F\uCE74\u47E5\u647A\u5566\uFEFE\u4FA7\uFEFE\uCE75\uFEFE\u46EC\uFEFE" + - "\uCE76\u52C1\uFEFE\uCE77\u647C\uFEFE\uCE78\uFEFE\u647D\uCE79\uFEFE\uCE7A\uCE7B\uFEFE\u647F\u6480" + - "\u4E8F\u647E\uCE7C\uCE7D\uFEFE\uCE7E\uFEFE\uCE7F\u535A\u5574\uFEFE\u6481\u4C7C\uCE80\u6482\u5584" + - "\uFEFE\u6484\uFEFE\u6483\u6486\uFEFE\u6485\u6487\u6488\uFEFE\u6489\uCE81\uFEFE\uFEFE\uFEFE\uCE82" + - "\uFFFF\u0048\uFEFE\u46F9\uCE83\u5151\u648A\uFEFE\uCE84\uFEFE\u53CC\uCE85\u648B\uCE86\uFEFE\u4AAA" + - "\u648C\uFEFE\u51C9\u50EE\uFEFE\u648D\u48D0\uFFFF\u0007\uFEFE\uCE87\uFEFE\u648F\uCE88\uFEFE\uCE89" + - "\u4A78\uFEFE\uFEFE\uCE8A\uFEFE\u46DF\uFEFE\uFEFE\uCE8B\uFEFE\uFEFE\uCE8C\uCE8D\uFEFE\uFEFE\uFEFE" + - "\uCE8E\uFEFE\uFEFE\uFEFE\u51DE\uFFFF\u0004\uFEFE\uCE8F\uCE90\uCE91\uFEFE\uFEFE\u4CED\uFEFE\uFEFE" + - "\uCE92\uFEFE\u5561\uFEFE\uFEFE\uCE93\uCE94\uFEFE\uFEFE\uCE95\uFEFE\uFEFE\uCE96\u46FA\uFEFE\uCE97" + - "\uFEFE\uCE98\uFEFE\uCE99\u6492\uCE9A\uCE9B\uFEFE\u6491\uFEFE\uCE9C\uFEFE\u6490\uFEFE\uFEFE\uFFFE" + - "\u0004\uCE9D\uFEFE\uCEA1\u6498\u6496\uFEFE\uCEA2\u6493\uFEFE\uCEA3\uFEFE\uFEFE\uCEA4\uCEA5\u6495" + - "\uCEA6\uFEFE\uCEA7\u6494\u6497\uFEFE\u4DC2\uFEFE\u649B\uFEFE\u4CCD\uFEFE\u649C\uCEA8\uCEA9\uFEFE" + - "\uCEAA\u55CB\uFEFE\u6499\u649A\uCEAB\uFEFE\uFEFE\u4784\uCEAC\uCEAD\uCEAE\u50B4\uCEAF\u50D1\uFFFF" + - "\u0006\uFEFE\u649D\uCEB0\uFEFE\u649F\uFEFE\uCEB1\uFEFE\uFEFE\uCEB2\uCEB3\uCEB4\uFEFE\u649E\u64A0" + - "\u4CA8\uCEB5\uFEFE\uFEFE\uFEFE\u4D7C\u64A3\uCEB6\uFEFE\uFEFE\uCEB7\uFEFE\uCEB8\uFFFF\u0006\uFEFE" + - "\u64A1\u64A2\u64A4\uFFFE\u0004\uCEB9\uFEFE\uFEFE\uCEBD\uCEBE\uFEFE\uFEFE\u50FC\uFFFF\u0005\uFEFE" + - "\u64A7\uCEBF\uFEFE\uCEC0\u64A8\u64A6\uFFFE\u0004\uCEC1\uFEFE\uFEFE\uFEFE\uCEC5\uFEFE\uFEFE\uCEC6" + - "\uCEC7\u64A5\uFEFE\u55A7\uFEFE\uFEFE\u64AA\u64AE\u64AB\u64A9\uCEC8\u64AC\uCEC9\uCECA\uCECB\u64AD" + - "\uFEFE\uFEFE\uFEFE\uCECC\u64B2\uFEFE\uFEFE\uFEFE\u64AF\uFEFE\uFFFE\u0004\uCECD\u5368\u64B1\uCED1" + - "\uCED2\u64B3\u64B0\uFFFF\u0004\uFEFE\uCED3\uFEFE\uFEFE\uCED4\uCED5\uFEFE\uCED6\uCED7\uCED8\u64B5" + - "\uFEFE\u52F6\uFEFE\u64B4\uFEFE\uFEFE\uCED9\uCEDA\uCEDB\u64B7\uFFFF\u0004\uFEFE\u64B8\uCEDC\uCEDD" + - "\u64BA\u64B9\uFEFE\u64B6\uFEFE\uCEDE\u64BC\u64BB\uFEFE\u4CA1\uFEFE\uFEFE\uCEDF\u64BE\uCEE0\u64BD" + - "\u64BF\uCEE1\uFEFE\uFEFE\uFEFE\u64C0\uCEE2\uCEE3\uFEFE\uCEE4\uCEE5\uFEFE\uFEFE\u64C1\uCEE6\uFFFF" + - "\u0004\uFEFE\uCEE7\uFEFE\uCEE8\u64C2\u479C\u5044\uCEE9\uCEEA\u5353\u537A\u64C3\uFEFE\uCEEB\uFEFE" + - "\uCEEC\uFFFF\u0004\uFEFE\uCEED\uCEEE\uFEFE\uFEFE\u64C4\uFEFE\uCEEF\uCEF0\uFEFE\uCEF1\uCEF2\u64C6" + - "\u64C5\uCEF3\u64C7\uFEFE\u4653\u64C8\u4DAA\u4897\uFEFE\u64C9\uFEFE\uCEF4\u4E55\uFEFE\uCEF5\uFFFF" + - "\u0006\uFEFE\u64CA\uCEF6\uFEFE\uFEFE\u4CB1\uFEFE\uFEFE\u4752\u64CB\uFFFF\u0004\uFEFE\uCEF7\uFEFE" + - "\uFEFE\u64CE\uFEFE\uCEF8\uCEF9\uFEFE\uCEFA\uCEFB\uFFFF\u0005\uFEFE\uCEFC\u4BA6\uCEFD\uCEFE\u64CD" + - "\u64CC\u48A6\u64CF\uFEFE\uCF41\uFEFE\uCF42\u4A5A\uFEFE\u64D2\uFEFE\uCF43\uCF44\u4D6E\u64D0\uFEFE" + - "\u64D1\uFEFE\uFEFE\uCF45\uCF46\uFEFE\u64D4\u64D5\u4A68\u64D3\uCF47\uCF48\uCF49\u64D7\uFEFE\u515B" + - "\u64D6\u4787\uCF4A\u64D8\uCF4B\uCF4C\uFEFE\uCF4D\uFEFE\uCF4E\u64D9\uCF4F\uCF50\u4EF4\u48B7\uFEFE" + - "\uCF51\uCF52\uCF53\u55A6\uFEFE\uFEFE\uFEFE\u64DA\uFFFE\u0004\uCF54\u4693\u64DC\uCF58\u64DB\uFEFE" + - "\uFEFE\u64DF\u506C\uCF59\uCF5A\u64DE\uCF5B\u50FE\u64DD\u64E1\uCF5C\uFEFE\u64E0\uFEFE\uFEFE\u64E2" + - "\u54EE\u64E3\uCF5D\uFEFE\uFFFE\u0005\uCF5E\uFEFE\u64E4\uCF63\uFEFE\uFEFE\uFEFE\u64E5\uCF64\uCF65" + - "\u50A9\uFEFE\u52E1\u64E6\u64E7\u64E8\uCF66\uFFFF\u0035\uFEFE\u4D5E\u64E9\uCF67\u4D74\u64EA\uCF68" + - "\uCF69\uFEFE\u64EB\uCF6A\uCF6B\uCF6C\u64ED\u64EC\uFFFF\u0004\uFEFE\u64EE\u6149\u64EF\u47DF\u52E5" + - "\u4845\uFEFE\uFEFE\uCF6D\uCF6E\u64F0\uCF6F\uFEFE\u45D5\u47F5\u4841\uFEFE\uCF70\u547E\uCF71\uCF72" + - "\u55DF\uFEFE\u49CD\u5068\uCF73\uFEFE\uFEFE\uFEFE\uCF74\uCF75\uFEFE\uCF76\u4BA9\uFEFE\uCF77\u4673" + - "\uCF78\uCF79\u48D6\uCF7A\uFFFF\u0004\uFEFE\u64F2\uFFFF\u0005\uFEFE\uCF7B\uFEFE\u64F4\uCF7C\uCF7D" + - "\u64F3\u535D\uFEFE\uCF7E\u64F6\u4E9E\u49EF\uFEFE\u53DF\uCF7F\u64F5\u4A9C\uCF80\uFEFE\uFEFE\u64F7" + - "\uCF81\uCF82\u4E58\u64FA\u64F9\u54A9\uCF83\uFEFE\u49D1\uCF84\uFEFE\u4B49\u4744\uCF85\u4C72\uCF86" + - "\u64F8\u4BFC\uFEFE\uCF87\uFEFE\uFEFE\u6544\uCF88\u6541\u64FD\u4BDA\u50BB\u64FB\uFEFE\u515E\u48F0" + - "\u64FC\u6543\u4FB3\uCF89\u4FCA\u45E3\uCF8A\uFEFE\u53B1\u6542\u48CD\u45B8\u64FE\u4DCE\u4754\uFEFE" + - "\uFEFE\uFEFE\u6545\uCF8B\uCF8C\uCF8D\uFEFE\uCF8E\uCF8F\u4F77\uCF90\uFEFE\u4AD3\u4669\uCF91\uCF92" + - "\u5485\u6546\uCF93\u4AD6\u6547\uFEFE\uFEFE\u55AC\uFEFE\u654E\uCF94\uFEFE\u54F8\u4CF7\uCF95\uCF96" + - "\u4C6D\uFEFE\u49EC\uFEFE\u654D\u4A8B\u46AB\uCF97\u505D\u488D\u6548\u654A\u654B\u654C\u4550\u46A4" + - "\u49BC\u654F\uFEFE\u6550\u52F3\uFEFE\uCF98\u5455\uCF99\u6551\uFEFE\u46E3\u544C\uCF9A\u4EC2\uFEFE" + - "\u6882\uCF9B\u6553\u6552\u49CC\uFEFE\uFEFE\uCF9C\u5143\u5458\u6554\uCF9D\uFEFE\u6557\uFEFE\uCF9E" + - "\u526E\u6555\u535B\u485D\uCF9F\u4CDA\uFEFE\u526B\u6559\uFEFE\u4CC4\u655B\u537B\u6558\u6045\u4DA9" + - "\uCFA0\uFEFE\u5186\uCFA1\u655A\u50EA\uCFA2\uCFA3\uFEFE\uCFA4\u655C\uCFA5\u4C92\uFEFE\uFEFE\uFEFE" + - "\uCFA6\uFEFE\uCFA7\uCFA8\uCFA9\uFEFE\uCFAA\uFFFF\u0004\uFEFE\uCFAB\uCFAC\uCFAD\u4846\uFEFE\uCFAE" + - "\u46C5\uFEFE\u51A8\uFEFE\u4EB8\uFFFF\u0004\uFEFE\u655E\uCFAF\u655F\uCFB0\uCFB1\uCFB2\u6560\uCFB3" + - "\uFEFE\u4D81\uFFFF\u0004\uFEFE\uCFB4\uCFB5\uFEFE\uFEFE\u49B3\uFEFE\uCFB6\uCFB7\uCFB8\uFEFE\uCFB9" + - "\uCFBA\uFEFE\u5052\uFEFE\uCFBB\uFEFE\u456E\uFEFE\uFEFE\uFEFE\uCFBC\uFEFE\uFEFE\uCFBD\uFEFE\uCFBE" + - "\uCFBF\uCFC0\uFEFE\u6563\uCFC1\uCFC2\u6564\uCFC3\uFEFE\u499E\u6561\uFEFE\u6562\uCFC4\uFEFE\uFEFE" + - "\u4595\uFEFE\uFEFE\uCFC5\uFEFE\u5162\uFEFE\uCFC6\uCFC7\uFEFE\uFEFE\uFEFE\uCFC8\u4CB7\uCFC9\u4995" + - "\uFFFF\u0005\uFEFE\u454F\uCFCA\uCFCB\uCFCC\uFEFE\u6565\uFEFE\uCFCD\uCFCE\uCFCF\uFEFE\uCFD0\uFFFF" + - "\u0004\uFEFE\uCFD1\uFEFE\uFEFE\uCFD2\uFEFE\u6568\uFEFE\uCFD3\u6567\uCFD4\uCFD5\uCFD6\u6569\uCFD7" + - "\uFEFE\uCFD8\uFEFE\uCFD9\uFEFE\uCFDA\uFEFE\uCFDB\uCFDC\uFEFE\uCFDD\uFEFE\u656B\uFEFE\uCFDE\uFEFE" + - "\uFEFE\uFEFE\u5154\uCFDF\uCFE0\u656C\uCFE1\u656A\uFEFE\uCFE2\uFEFE\uCFE3\uCFE4\uFEFE\uCFE5\uCFE6" + - "\uFEFE\uCFE7\uCFE8\uFFFF\u0005\uFEFE\uCFE9\uFEFE\uFEFE\uFEFE\uCFEA\uCFEB\u4F73\u656D\u5548\u52BB" + - "\u47F3\u5591\uCFEC\uFEFE\uFEFE\u4758\uCFED\u4E7C\uFEFE\u656E\uCFEE\u656F\uCFEF\uCFF0\uCFF1\uFFFF" + - "\u0005\uFEFE\uCFF2\u4BAE\u6570\uCFF3\u6571\uFEFE\uCFF4\uFEFE\u6572\u50BD\uFEFE\u5149\uCFF5\uFFFF" + - "\u0004\uFEFE\u6574\u6573\uCFF6\u4D86\uFEFE\u51EB\u4899\uCFF7\uCFF8\uCFF9\uFFFF\u0005\uFEFE\uCFFA" + - "\u6577\uCFFB\uFEFE\uCFFC\uCFFD\u51A9\uFEFE\u6576\uCFFE\u6575\uFEFE\u516F\uD041\uFEFE\u5170\uD042" + - "\u5378\uD043\uD044\uD045\uFEFE\u51FA\uD046\uFEFE\uFEFE\uFEFE\u536F\uFEFE\uD047\uFEFE\uFEFE\uD048" + - "\u6578\uFEFE\u507F\uFEFE\uD049\uFEFE\uD04A\uFEFE\u657B\u6579\uD04B\uD04C\uD04D\u657A\uFFFE\u0004" + - "\uD04E\u657D\u657C\uD052\uFEFE\u50C2\uFEFE\u657E\uD053\uD054\uD055\uFEFE\uD056\u657F\u6580\uD057" + - "\uD058\uFEFE\uD059\u5346\u53BF\u4D79\u5252\uFEFE\u6581\u476C\u45A3\u4569\u47B5\u6582\u4586\uFEFE" + - "\uD05A\uD05B\uFEFE\u6587\u6585\u4FF4\uD05C\u6583\u6584\u4ACC\u4988\u6586\u6588\uFEFE\u6589\uFEFE" + - "\u4CE3\u658D\u658F\u534A\u4BF0\uFEFE\uD05D\uD05E\uFEFE\uD05F\u658A\u658C\uD060\uD061\uD062\uFEFE" + - "\uFEFE\uFEFE\u658B\u658E\uD063\uFEFE\uD064\uFEFE\uD065\u51D0\uD066\uFEFE\u6592\uD067\uD068\uFEFE" + - "\uFEFE\uD069\uD06A\u6590\uD06B\uFEFE\uD06C\u6595\uFEFE\uD06D\u4E63\u538F\uFEFE\u6593\u5269\uD06E" + - "\uD06F\u6594\u6597\uD070\uFEFE\uD071\uFEFE\uFEFE\uFEFE\uD072\uD073\u6591\uFFFF\u0004\uFEFE\uFFFE" + - "\u0004\uD074\uFEFE\uD078\u6598\uFEFE\uFEFE\u6596\uFEFE\uD079\uD07A\uD07B\uFEFE\uFEFE\uD07C\u45AE" + - "\uD07D\uD07E\u55BF\uD07F\u65A6\u659B\uFEFE\u659F\uFEFE\uD080\u65A4\u659E\uFEFE\uD081\uD082\u45D7" + - "\u659A\uD083\uD084\u65A0\u659C\uD085\u65A7\uFEFE\uD086\u65A1\uD087\u65A2\u65A5\uFFFF\u0005\uFEFE" + - "\u6599\uD088\u65A3\u65A9\u49D4\uD089\uD08A\u5393\uFEFE\uD08B\uD08C\u4EA8\uFEFE\u659D\uD08D\u4FB4" + - "\u65A8\uD08E\uD08F\uFFFF\u0004\uFEFE\uD090\uD091\uD092\u4863\uFEFE\uFEFE\uFEFE\uD093\uD094\u65AC" + - "\u65AD\uD095\uFEFE\uD096\uD097\uD098\u5183\uD099\u478C\uFEFE\uFEFE\u4CE2\uFEFE\u48C0\uFEFE\uFEFE" + - "\u524B\uD09A\uD09B\uFEFE\uFEFE\uD09C\uD09D\uFEFE\uFEFE\u4CAD\uD09E\u65AF\uFEFE\u65B1\u65AE\uD09F" + - "\u4DDC\uD0A0\u4E80\u65B0\u65AA\uFEFE\uFEFE\uD0A1\uD0A2\uFEFE\uFEFE\uFEFE\uD0A3\uD0A4\uFEFE\u65AB" + - "\uD0A5\uFEFE\uFEFE\uD0A6\uFEFE\u4D48\uFEFE\uD0A7\uFEFE\uFEFE\uD0A8\uFEFE\uFEFE\uFEFE\uD0A9\u65BB" + - "\uD0AA\u65BA\uFFFE\u0004\uD0AB\uFEFE\uFFFE\u0005\uD0AF\uFEFE\uFFFE\u0004\uD0B4\uFEFE\uFEFE\uFFFE" + - "\u0004\uD0B8\u65B3\u65B7\uFEFE\u5449\u65BD\uFEFE\u65B9\uFEFE\u65B5\uD0BC\u65B6\uFEFE\uFEFE\uD0BD" + - "\uD0BE\uFEFE\uD0BF\u65BC\uD0C0\uFEFE\uD0C1\u52C0\uD0C2\uFEFE\u65B4\uD0C3\u65B2\u5363\uFEFE\uD0C4" + - "\u4D6F\uD0C5\uFEFE\uD0C6\uFEFE\u55BE\u48C1\uFFFF\u0004\uFEFE\u51E7\u5394\u65C2\u65C5\u46A1\uFEFE" + - "\uFEFE\u65C9\uD0C7\uFEFE\u65CE\uFEFE\uFEFE\uFEFE\u55D2\uFEFE\uD0C8\uFFFF\u0004\uFEFE\uD0C9\uFEFE" + - "\u65C0\u5390\uD0CA\uFEFE\uFEFE\uD0CB\uD0CC\uFEFE\uFEFE\u54EF\u65C7\u65CB\uFEFE\uD0CD\u65CC\u65C8" + - "\uD0CE\u4E57\u65C3\u65CA\u65CD\uD0CF\u65C1\u4B8E\uD0D0\u53F0\uD0D1\uD0D2\u5257\u4FE6\uFEFE\u5283" + - "\u50B1\uFEFE\uFEFE\u4886\uD0D3\uD0D4\u65BF\uD0D5\uD0D6\uFEFE\uFEFE\u65BE\u65CF\uFFFF\b\uFEFE" + - "\u65C4\uFEFE\uFEFE\uD0D7\u51F7\uD0D8\uFEFE\u4B48\uFEFE\u55D3\uFEFE\uFEFE\uD0D9\uD0DA\uD0DB\uFEFE" + - "\u54AA\uD0DC\u65D4\u65D5\uD0DD\uFEFE\uD0DE\u48C7\u52AD\uFEFE\uD0DF\uFEFE\u65D1\uFEFE\uFEFE\uFEFE" + - "\uD0E0\uD0E1\uFEFE\uD0E2\uFEFE\uD0E3\uD0E4\uFEFE\u4F70\uD0E5\u65D3\uD0E6\u65D0\uD0E7\uFEFE\uD0E8" + - "\uD0E9\u4E45\uD0EA\uFEFE\uFEFE\uFEFE\uD0EB\uFEFE\u65D2\uD0EC\u53BD\uFFFE\u0004\uD0ED\uFFFF\u0005" + - "\uFEFE\uD0F1\uFEFE\uD0F2\uD0F3\u4962\uD0F4\uFEFE\uD0F5\uFEFE\uFEFE\uD0F6\uFEFE\u65DA\uD0F7\u4D70" + - "\u5197\uD0F8\uFEFE\u54FE\uD0F9\uFEFE\uFEFE\uD0FA\uFEFE\uFEFE\uD0FB\uFEFE\uD0FC\u65D8\uFEFE\uD0FD" + - "\u546D\uD0FE\uD141\uFEFE\uD142\u536E\u65D9\u4C89\uFEFE\u65D7\uFEFE\uFEFE\uFEFE\uD143\uD144\uD145" + - "\uFEFE\uFEFE\u65D6\uD146\uFFFF\u0006\uFEFE\uD147\uFEFE\u65E2\uD148\uD149\u65DD\uD14A\u65DB\uFFFE" + - "\u0005\uD14B\uFEFE\uFEFE\u65E5\u5041\uFEFE\uD150\uFEFE\uFEFE\u65DC\u65DE\u65E1\uD151\uFEFE\uFEFE" + - "\uD152\u65E3\u65E4\uD153\uFEFE\u4A8D\uD154\uFEFE\u65E6\u65E0\uD155\uD156\u65DF\uFFFF\u000E\uFEFE" + - "\uD157\u65E8\uD158\uD159\uD15A\uFEFE\uD15B\uFEFE\uFEFE\uFEFE\uD15C\uD15D\u65EC\uD15E\uFEFE\uFEFE" + - "\u65ED\uD15F\uD160\uFEFE\uFEFE\uFEFE\uD161\uD162\uD163\u51CD\uFEFE\uFEFE\u65EA\u65E9\uD164\uD165" + - "\uD166\u4CC8\u52CF\u65E7\uFFFF\u0004\uFEFE\uD167\uFEFE\u65EB\uFFFF\t\uFEFE\u65EF\uFEFE\uFEFE" + - "\uD168\uD169\uFEFE\u65F0\uD16A\uD16B\uD16C\u5156\u65EE\uFEFE\u5388\uFEFE\u65F1\uD16D\uFEFE\uD16E" + - "\uFEFE\uD16F\uFEFE\u65F2\uFEFE\uD170\u65F5\u65F4\uFEFE\uFEFE\u65F6\uFEFE\uD171\uFEFE\uD172\uFFFF" + - "\u0004\uFEFE\u4E4E\u65F3\u5241\uFEFE\uD173\uFEFE\uFEFE\uFEFE\uD174\u65F8\u65F7\uD175\uFEFE\u65FB" + - "\uD176\u65F9\uD177\u65FA\uD178\uFFFF\u0004\uFEFE\uD179\uFEFE\u65FC\uD17A\uFEFE\uD17B\uD17C\uD17D" + - "\u65FE\uD17E\uD17F\uFEFE\uFEFE\u65FD\uFEFE\u6641\uFFFF\u0004\uFEFE\u6644\u6643\u6645\u6642\uFEFE" + - "\u6646\uFEFE\uD180\uD181\uFFFF\u00F2\uFEFE\u4583\uD182\uD183\uFFFF\u0004\uFEFE\uD184\uFEFE\u46AA" + - "\uFEFE\u6647\u519C\uD185\uFEFE\uFEFE\u6648\uD186\u4B7D\u6649\u46CD\uD187\uD188\uD189\u545F\uFEFE" + - "\u4DD9\u664A\u45C1\u664B\uFEFE\u664C\uFEFE\u664D\u664E\uFEFE\uFEFE\uFEFE\uD18A\uD18B\uD18C\u664F" + - "\uD18D\u45C5\u4AE9\u549B\u5172\uD18E\u6651\u6650\uD18F\uFEFE\uD190\uD191\u6652\uFFFF\u0004\uFEFE" + - "\u5177\uFEFE\uD192\uFEFE\uD193\uFEFE\uFEFE\u6655\uD194\u6654\u6653\uD195\u6656\uD196\uFEFE\uFEFE" + - "\uFEFE\u6659\uFEFE\uFEFE\uD197\u5364\uD198\uD199\u6657\uD19A\u665B\u665A\uFEFE\uFEFE\uFFFE\u0004" + - "\uD19B\u665D\u665C\u665E\uFEFE\u4BCC\uD19F\uD1A0\uFEFE\u665F\uFFFE\u0004\uD1A1\u6660\u6662\uFEFE" + - "\uD1A5\u6661\uD1A6\uFFFF\u0035\uFEFE\u4786\uD1A7\uD1A8\uFEFE\uFEFE\u6663\uD1A9\uFEFE\uD1AA\uD1AB" + - "\uD1AC\uFEFE\u6664\uFEFE\u4591\uFEFE\uD1AD\uFEFE\u6665\u6666\uFEFE\uD1AE\u47BC\uD1AF\uFEFE\uFEFE" + - "\uFEFE\uFFFE\u0004\uD1B0\u4FEF\uD1B4\uD1B5\uFEFE\u46AE\u4FE8\uD1B6\u6667\uFEFE\u4B8C\uFFFF\u0006" + - "\uFEFE\u666A\u6669\u49E5\uFEFE\u6668\u48AD\uFEFE\uD1B7\uFEFE\uD1B8\uFEFE\uD1B9\uD1BA\uD1BB\uFEFE" + - "\uFEFE\u5157\u666B\u666C\u5272\u666D\uFEFE\uD1BC\u49D8\u4C84\u496D\u4FFE\u666E\uFEFE\uFEFE\uFEFE" + - "\u55C3\uFEFE\u6671\uFEFE\uD1BD\uFEFE\u4CD2\uFEFE\u6670\u4E61\uD1BE\u50C7\u4AB7\u666F\u4961\uFEFE" + - "\u4A6C\uD1BF\uD1C0\u47BF\uD1C1\uD1C2\uFEFE\uFFFE\u0004\uD1C3\u4BB9\u465D\uFEFE\u4CE5\uD1C7\u4A93" + - "\u6673\uFEFE\u6672\u49A9\u4E76\uFEFE\uD1C8\uFEFE\uFEFE\u505A\u6676\uD1C9\u6677\u6675\u53C3\uD1CA" + - "\u4797\u4BF9\u6679\uFEFE\uD1CB\u4EAE\uFEFE\uFEFE\u4CE0\uD1CC\uD1CD\uD1CE\u667A\u6556\uD1CF\u667B" + - "\uFEFE\uFEFE\uFEFE\uD1D0\u667F\u667E\u667C\u667D\uD1D1\u6680\uFEFE\u6681\u5545\u6682\u6683\uD1D2" + - "\u4FDA\u4ED5\uFEFE\uFEFE\uFEFE\u4F64\u51A4\uFEFE\uFEFE\u4570\u4745\u47A0\u4C4D\uFEFE\u5477\uD1D3" + - "\u6685\u52B7\u525B\u6684\uFEFE\uFEFE\u4A8A\uD1D4\uFEFE\uFEFE\u6686\u6354\uFEFE\uD1D5\u6688\uD1D6" + - "\u51FB\u6687\uD1D7\uD1D8\uD1D9\uFEFE\uFEFE\u4997\u495A\uFFFF\u0004\uFEFE\u49DD\uD1DA\u49BB\u52A5" + - "\uFEFE\uFEFE\uFEFE\uD1DB\u4F90\uD1DC\u4ABC\uFEFE\uFEFE\uFEFE\u5069\u4BD6\uFEFE\u6689\uD1DD\u4582" + - "\uFFFF\u0004\uFEFE\u47FB\uFEFE\uD1DE\uD1DF\u668A\uD1E0\u668B\u4DDE\u668C\uD1E1\u4F4B\uFEFE\uFEFE" + - "\u668E\u6690\u6692\uFEFE\u6691\uFEFE\u668F\uFEFE\uFEFE\u6693\uFEFE\uFEFE\u668D\uD1E2\uD1E3\u4DE8" + - "\uD1E4\u4EE4\uFEFE\uFEFE\uD1E5\uD1E6\uD1E7\u6694\uFEFE\uFEFE\u4E48\uD1E8\uFEFE\u6695\uFFFF\u0005" + - "\uFEFE\u6696\uD1E9\u4BC6\u6697\uFFFF\u0004\uFEFE\u5BCF\u6698\uFEFE\u6699\uFEFE\u669A\u669B\uFEFE" + - "\uFEFE\uD1EA\u66A0\u669E\u669D\uFEFE\u669C\uFEFE\u669F\u66A1\uD1EB\uFEFE\uFEFE\u66A2\uD1EC\u66A3" + - "\uFEFE\u66A4\u464C\uFEFE\uFEFE\u66A5\u48C3\uD1ED\uD1EE\u4644\uD1EF\uD1F0\u66A6\uFEFE\u48E1\uFEFE" + - "\u66A7\u6852\u4691\uD1F1\u66A8\uFEFE\u66A9\uD1F2\u66AA\u4AA3\uD1F3\u53B5\uFEFE\u66AB\uD1F4\uFEFE" + - "\uFEFE\u52CE\uFEFE\uD1F5\u4DF1\uFEFE\uD1F6\uD1F7\uD1F8\u66AC\u66B0\uD1F9\u66AE\uD1FA\uFEFE\uD1FB" + - "\uD1FC\u66AF\uFEFE\uFEFE\u5445\u66AD\u5277\uFEFE\uFEFE\uD1FD\uFEFE\u66B1\uFEFE\u504C\uFEFE\u66B2" + - "\u66B3\uFFFF\u0004\uFEFE\uD1FE\uD241\uD242\u52E7\uD243\uD244\uFEFE\u66B4\uFEFE\uD245\uD246\u51ED" + - "\uFEFE\uD247\u66B7\uFEFE\uFEFE\u66B6\uFEFE\u66B5\uFEFE\uFEFE\u63FC\uD248\u548B\uD249\uFEFE\uFEFE" + - "\uD24A\uD24B\u66B8\u66B9\uD24C\uD24D\uFEFE\uD24E\uD24F\uD250\uFEFE\uD251\uFEFE\uD252\uD253\uFEFE" + - "\uD254\uFEFE\u66BA\uD255\uD256\u66BB\uD257\u66BC\uD258\uD259\u66BD\uD25A\uD25B\uD25C\uFEFE\uD25D" + - "\uD25E\uFEFE\u4E75\uD25F\uFEFE\uFEFE\uD260\uD261\uD262\uFEFE\uD263\u66BE\uD264\uD265\uFEFE\uD266" + - "\uD267\uFEFE\uFEFE\uD268\uFFFF\b\uFEFE\u66BF\u4FDF\uD269\uFEFE\uD26A\u66C0\u484D\uD26B\u66C2" + - "\u52FC\uD26C\uD26D\uFEFE\uD26E\u5577\uFEFE\uFEFE\uFEFE\u4A5C\uFEFE\u4CD9\u4D5B\u4946\uFEFE\u4A97" + - "\u47B2\uD26F\u46B0\uFEFE\uD270\uFEFE\u5456\uD271\uD272\u66C3\u4D4A\u539D\u5557\u517A\uD273\uFEFE" + - "\uD274\u55E4\u4ACD\uD275\u66C4\uFEFE\uD276\uFEFE\uD277\uFEFE\uD278\u66C6\uFEFE\uD279\u66C5\uD27A" + - "\uD27B\uFFFF\u0004\uFEFE\uD27C\u4EB3\u47EB\uD27D\uD27E\uD27F\uFEFE\uD280\uD281\u5576\uD282\uFEFE" + - "\u66C7\u50FB\u66C8\uFEFE\u53AB\u4A7A\u66C8\uD283\uFFFF\u0005\uFEFE\uD284\uFEFE\u51DC\uD285\uFEFE" + - "\uFEFE\uD286\u66CA\u47FE\u47F1\u548E\u66C9\uFEFE\uD287\uD288\uD289\u48B8\u4AE5\uD28A\u66CB\u4C57" + - "\uD28B\uD28C\u55C1\uFEFE\uFEFE\u46BA\uFEFE\uFEFE\uFEFE\uD28D\uD28E\uFEFE\u66CC\uD28F\u4EEE\uFEFE" + - "\uFEFE\uD290\u66CD\uD291\uFEFE\uFEFE\u66CE\u66CF\u66D0\uFEFE\u66D2\u66D1\uFFFF\u0033\uFEFE\u47E7" + - "\uFEFE\u66D3\uD292\uFEFE\uD293\uD294\u66D4\uD295\u66D5\uFEFE\uFEFE\uD296\uFEFE\u66D6\uD297\uD298" + - "\uFEFE\uD299\uD29A\uFEFE\uFEFE\uFEFE\uD29B\uFEFE\uFEFE\uD29C\u66D8\u66D7\uD29D\u66D9\uFEFE\uD29E" + - "\uFEFE\uFEFE\uFEFE\uD29F\uFFFF\u000E\uFEFE\u488A\u66DA\uFEFE\uFEFE\u46B8\uFEFE\uD2A0\u53CE\uD2A1" + - "\uFEFE\uD2A2\uD2A3\uD2A4\uFEFE\u66DC\uD2A5\u66DE\uFEFE\u66DB\u5CCA\u46B5\uFEFE\uFEFE\u4BA3\uD2A6" + - "\u5245\uFEFE\uD2A7\uFFFF\u0005\uFEFE\u4A8F\u4D49\u4957\uFEFE\uFEFE\uFEFE\uD2A8\u66E0\uFEFE\u50BF" + - "\uFEFE\uD2A9\uD2AA\u54BC\u4979\uFEFE\u50A7\uFEFE\uFEFE\uFEFE\u55B3\uD2AB\u66E2\u554B\u66E3\uD2AC" + - "\uD2AD\uD2AE\u66E4\uFEFE\uD2AF\uD2B0\uD2B1\u66E1\u66E8\uD2B2\u66EA\u66E7\uD2B3\uFEFE\u66E9\uFEFE" + - "\uD2B4\u66E5\u4862\uFEFE\uFEFE\uD2B5\u66EB\uFEFE\u66EC\uFEFE\uFEFE\uFFFE\u0005\uD2B6\uFEFE\uFEFE" + - "\uFEFE\uFFFE\u0004\uD2BB\u66ED\u66EE\uFEFE\uD2BF\uD2C0\u66EF\uFEFE\uFEFE\u66F1\uD2C1\uD2C2\uD2C3" + - "\u66F0\uFEFE\u66F3\u66F5\uD2C4\uD2C5\uFEFE\u66F2\u66F4\u52E8\uFEFE\uD2C6\u66F6\uFEFE\u51D5\uD2C7" + - "\uD2C8\uFEFE\uD2C9\uD2CA\uFEFE\uD2CB\uD2CC\uD2CD\uFFFF\u0035\uFEFE\u49BE\u66F7\u66F8\u46BD\uFEFE" + - "\uD2CE\uFEFE\uD2CF\u66F9\uD2D0\uFFFF\u0005\uFEFE\u66FA\uD2D1\uFEFE\u4B85\uFEFE\uFEFE\uFEFE\u4664" + - "\u66FB\u66FC\uFEFE\uD2D2\uD2D3\uD2D4\u52DF\u50A1\uD2D5\uFEFE\uFEFE\uFEFE\uD2D6\uD2D7\uFEFE\u66FD" + - "\uD2D8\uFEFE\uD2D9\uFEFE\u55E5\uFEFE\uD2DA\u4DE5\u49AC\u4CFE\uFEFE\u4F85\uD2DB\uFFFF\u0006\uFEFE" + - "\u4DF5\u6744\u49FC\uD2DC\uD2DD\u53BE\uFEFE\uFEFE\u6743\uD2DE\uD2DF\u6741\uD2E0\u6742\uD2E1\u66FE" + - "\uFEFE\uFEFE\u6747\uFFFF\u0004\uFEFE\uD2E2\uFEFE\uFEFE\uD2E3\uD2E4\uD2E5\u6745\u6746\uFEFE\uD2E6" + - "\u6748\u6749\uFEFE\uD2E7\uD2E8\uFEFE\uFEFE\u674B\uD2E9\uFEFE\u674A\uFEFE\uD2EA\uD2EB\u4CC0\uFEFE" + - "\u674C\uD2EC\uD2ED\uD2EE\u674E\uFFFF\u0005\uFEFE\uD2EF\uD2F0\uFEFE\u5058\u674D\uD2F1\uD2F2\u4DD2" + - "\u48B4\uFEFE\uFEFE\uD2F3\uFEFE\uFEFE\u674F\uFFFF\u0004\uFEFE\uD2F4\uFEFE\uD2F5\uFEFE\uD2F6\uD2F7" + - "\uD2F8\uFEFE\uFEFE\uD2F9\u53DA\uFEFE\uFEFE\u6750\uFEFE\uD2FA\uD2FB\uFEFE\u4E5E\uFEFE\uFEFE\uD2FC" + - "\uFEFE\uD2FD\uD2FE\u6751\uD341\uFFFF\u0005\uFEFE\u6756\uFEFE\u6752\uD342\u6754\u6755\uD343\u6753" + - "\uFEFE\uD344\uFEFE\uFEFE\uD345\uD346\uD347\u6758\u6759\uFEFE\uFEFE\uD348\u53DA\uFEFE\uD349\u6757" + - "\uD34A\u675B\uFEFE\uFEFE\u4CD5\u675A\uFEFE\uD34B\uFEFE\u675C\uFEFE\uFEFE\u675D\uFEFE\u6760\u675F" + - "\uFEFE\uFEFE\uFEFE\u675E\u6761\u6762\uFFFF\u003C\uFEFE\u4AA5\uFEFE\uD34C\uFEFE\uD34D\u6763\uD34E" + - "\uD34F\u6764\uFEFE\uD350\uFEFE\uD351\uD352\uD353\uFEFE\u559C\uD354\uFEFE\uD355\u6765\uFEFE\uD356" + - "\uD357\u6766\uD358\uFEFE\uD359\u52C5\uFEFE\uD35A\uFEFE\uD35B\uFFFF\u0005\uFEFE\uD35C\u6767\uD35D" + - "\u676A\uD35E\u6768\u6769\uD35F\uD360\uD361\u4571\u676B\uFEFE\uD362\u676C\uFEFE\u676D\u676E\uD363" + - "\uFEFE\u676F\u6770\uD364\uD365\u6771\uD366\uFEFE\uD367\u4CF6\u6773\uD368\u509D\u6774\u6772\uFEFE" + - "\u6776\uD369\uD36A\u6775\uD36B\uFEFE\u6777\uFEFE\uD36C\uD36D\u6778\uFEFE\uD36E\uFEFE\uFFFE\u0007" + - "\uD36F\u6779\uFEFE\uD376\uD377\uFEFE\uFFFE\u0004\uD378\uFEFE\uD37C\uFEFE\uD37D\uFEFE\uFEFE\uFEFE" + - "\uD37E\uFEFE\u677A\uD37F\u677B\uD380\uD381\uFEFE\uFEFE\u677C\uD382\uFEFE\u677D\u677E\uFEFE\u677F" + - "\uD383\uFFFE\u0004\u6780\uD384\uFEFE\uD385\u6784\u6785\uFEFE\u6786\u6787\uD386\uD387\uD388\uFEFE" + - "\uD389\uFEFE\uD38A\uD38B\u6788\u4AC8\uD38C\uFEFE\uFEFE\uFEFE\u52CB\u50A8\u678A\u6789\u4DB4\uFEFE" + - "\uFEFE\uD38D\uFEFE\uFEFE\uD38E\uD38F\u678B\u678C\u5389\uFEFE\u678D\uFEFE\uFEFE\u4DE2\uD390\uD391" + - "\uD392\u678E\uFEFE\u48EE\uD393\uFEFE\uFEFE\uD394\uFEFE\uFEFE\uD395\uFEFE\uD396\uFEFE\uD397\uD398" + - "\uFEFE\uD399\uFEFE\uFFFE\u0005\uD39A\u51F4\uFEFE\uFEFE\u6791\uD39F\u6790\u678F\uFEFE\uD3A0\uD3A1" + - "\uD3A2\uFFFF\u0005\uFEFE\uD3A3\uD3A4\uFEFE\uFEFE\u6794\uFFFE\u0004\uD3A5\uFEFE\uD3A9\uD3AA\uD3AB" + - "\uFEFE\uD3AC\u4F8E\u6793\uD3AD\u6795\u528D\u6792\uD3AE\uFEFE\u6796\u6797\uFEFE\uFEFE\uD3AF\uFEFE" + - "\uFEFE\uD3B0\uD3B1\u6798\u6799\uFFFF\u0005\uFEFE\uD3B2\uD3B3\u679A\uD3B4\u55CE\u4EB7\uD3B5\u5391" + - "\u4CE9\uFEFE\uD3B6\u679B\uD3B7\uFEFE\u679C\uFEFE\uFEFE\uD3B8\uD3B9\u67A0\uFEFE\u679F\uD3BA\uFEFE" + - "\uD3BB\uD3BC\u679D\uD3BD\uFFFF\u0004\uFEFE\u67A1\uD3BE\uD3BF\u4FC6\u679E\uFEFE\uFEFE\uFEFE\uD3C0" + - "\u67A2\uD3C1\u67A3\u67A4\uFEFE\u67A8\uFEFE\u4FE4\uD3C2\uD3C3\uFEFE\uFEFE\u50D8\uFEFE\uD3C4\uFEFE" + - "\uD3C5\uFEFE\u67A9\u67A6\u67A5\u67A7\uD3C6\uFEFE\uD3C7\u4D78\uFEFE\uD3C8\uD3C9\uFEFE\uFEFE\uFEFE" + - "\uD3CA\u5551\u67AB\u67AC\uD3CB\uFEFE\u67AA\uFEFE\uFFFE\u0004\uD3CC\uFEFE\uFEFE\uD3D0\uFEFE\uD3D1" + - "\u67B1\uFEFE\uD3D2\uFEFE\u67AD\uFEFE\u67B5\uFEFE\u67B6\u67B2\u67B8\uD3D3\u67B4\u5571\uFEFE\uD3D4" + - "\u5293\uD3D5\u67B7\u67B3\u67B0\u67AF\uD3D6\uFEFE\uD3D7\uD3D8\uD3D9\u67AE\uD3DA\uFEFE\uD3DB\uFEFE" + - "\uFEFE\u67BC\uD3DC\uD3DD\u67BB\u67BA\uFFFE\u0005\uD3DE\uFEFE\uFEFE\u546E\u67B9\u55C8\u67BD\uD3E3" + - "\u67BF\uFEFE\uFEFE\uD3E4\uD3E5\uD3E6\uFEFE\u53D5\u51F0\u54AB\uFEFE\uD3E7\u67C1\uFEFE\uFEFE\uD3E8" + - "\uFEFE\uD3E9\uD3EA\uD3EB\u67C0\u67BE\u5560\uD3EC\uD3ED\uFEFE\uFEFE\uFEFE\uD3EE\uD3EF\uD3F0\uFEFE" + - "\u53C6\uD3F1\uD3F2\uFEFE\uD3F3\u554C\uD3F4\uFEFE\u67C2\uFFFE\u0005\uD3F5\u67C3\uFEFE\uFEFE\uD3FA" + - "\uFEFE\uFEFE\uFEFE\u67C4\uFFFE\u0004\uD3FB\uFEFE\uFEFE\uD441\uFEFE\uD442\uFEFE\uD443\uFEFE\uFEFE" + - "\uD444\u67C5\uD445\u67C6\uFEFE\uFEFE\uD446\uFFFF\u0069\uFEFE\u4779\uD447\u67C8\uFEFE\u4D95\uFEFE" + - "\u67C7\u67C9\uFEFE\uFEFE\uFEFE\u67CA\uFEFE\uD448\u4EA6\u4B70\uFEFE\u54C4\uD449\uFEFE\uD44A\uFFFF" + - "\b\uFEFE\uD44B\u67CC\uFEFE\uFEFE\u67CD\u51A1\u54FC\u67CB\uFEFE\uD44C\uFEFE\uFEFE\u5464\uFEFE" + - "\uFEFE\uD44D\u67D4\uFEFE\uFEFE\u67D3\uFEFE\uD44E\uD44F\uFEFE\uFEFE\u52C3\uD450\uD451\uD452\u67D2" + - "\uFEFE\uFEFE\uFEFE\u67D1\uFEFE\uFEFE\u67CF\uFEFE\u4C54\uFEFE\u67CE\u50BA\u67D0\uFEFE\uFEFE\uD453" + - "\uD454\uFEFE\uD455\uD456\uD457\uFFFF\u0005\uFEFE\uD458\u4DD6\uD459\uD45A\u67D8\u67D6\uFEFE\u67D5" + - "\uD45B\uD45C\u67D7\uD45D\u67D9\uD45E\u67DA\uFEFE\uD45F\uFFFF\u0005\uFEFE\u67DF\u67DE\uFEFE\uD460" + - "\uD461\uFFFF\u0004\uFEFE\u67DD\uFEFE\uFEFE\u4BE7\u67DB\u67DC\uD462\u50FD\u557E\uD463\uD464\u67E0" + - "\uD465\uFEFE\uFEFE\uFEFE\uD466\uD467\u67E4\u518A\uFEFE\uFEFE\u67E5\u67E2\uFEFE\u67E1\uFEFE\uFEFE" + - "\uFEFE\uD468\uD469\uFEFE\uFEFE\u67E6\uD46A\uD46B\uFEFE\uD46C\uFFFF\u0004\uFEFE\uD46D\uD46E\uFEFE" + - "\uD46F\u67E3\uFEFE\u5342\uD470\uFEFE\uFEFE\uD471\uD472\u4D8E\uFEFE\uFEFE\uD473\uD474\uFEFE\uFFFE" + - "\u0004\uD475\uFEFE\u67E7\uFFFF\u0006\uFEFE\uD479\uFEFE\uFEFE\u67E8\uFFFF\u0004\uFEFE\u67E9\uD47A" + - "\u67EA\uD47B\uFEFE\uD47C\u50E5\uFEFE\uD47D\u67EB\uFEFE\u477A\uD47E\uFEFE\uFEFE\u67EF\uD47F\u67F0" + - "\u67EE\uD480\uFEFE\uFEFE\uD481\uFEFE\u67ED\u67F3\uD482\u67EC\uFEFE\u67F1\uD483\uFEFE\uD484\uD485" + - "\uFFFF\u0004\uFEFE\u67F2\uFEFE\uFEFE\uFEFE\u67F6\uFFFE\u0004\uD486\uFEFE\u67F5\uD48A\uFEFE\uFEFE" + - "\uFEFE\uD48B\uD48C\uD48D\uFFFF\u0004\uFEFE\uD48E\u67F8\uD48F\uFEFE\uD490\uFEFE\uD491\uFEFE\u67F9" + - "\uD492\u67FA\uD493\uFEFE\u4BF1\uD494\uD495\uFEFE\uFEFE\uFEFE\u67F7\u4B7A\u50AF\uFEFE\uFEFE\u67FB" + - "\uD496\uFEFE\uFEFE\uFEFE\uD497\uFFFF\u0004\uFEFE\uD498\uFEFE\uFEFE\uD499\uFEFE\uFEFE\uFEFE\uD49A" + - "\uFEFE\uD49B\uD49C\uD49D\uFEFE\uFEFE\uD49E\uD49F\uFEFE\uFEFE\u67FE\u67FC\u67FD\uD4A0\uD4A1\u6841" + - "\uFFFF\u0056\uFEFE\u6842\uFEFE\uFEFE\u4C7D\u6843\uD4A2\uD4A3\uD4A4\u6844\uFEFE\u4697\uD4A5\u6845" + - "\uFFFE\u0004\uD4A6\uFEFE\uD4AA\u6846\uFEFE\uFEFE\u6847\u6848\uFEFE\uD4AB\uD4AC\uFEFE\u684A\u51F9" + - "\u519E\uFEFE\u6849\uD4AD\u4CF3\uD4AE\uFEFE\uFEFE\uD4AF\uFEFE\u684B\uD4B0\u519B\uFFFF\u0004\uFEFE" + - "\uD4B1\u684C\u4AE0\uFEFE\uD4B2\u53B4\u684E\uFEFE\uD4B3\u684F\uD4B4\uD4B5\uD4B6\uFEFE\uFEFE\uD4B7" + - "\uD4B8\uD4B9\uFEFE\uFEFE\u684D\u5261\u555F\u48A7\u6850\uFEFE\u6851\u4EEA\uFFFF\u0004\uFEFE\u4AC6" + - "\uFEFE\uD4BA\uFEFE\uD4BB\uFEFE\uFEFE\uD4BC\u6853\u55AE\u51A7\u6854\u6855\u6856\u4679\uFEFE\u6857" + - "\uD4BD\uFEFE\uFEFE\u5E90\u4DBC\uFEFE\u51DD\u6858\u685A\u6859\uD4BE\u685B\uFEFE\uFEFE\uFEFE\uD4BF" + - "\u685C\uFEFE\uD4C0\u685D\uFEFE\uFEFE\uFEFE\uD4C1\uD4C2\uD4C3\u685E\uD4C4\uD4C5\uD4C6\uFEFE\u685F" + - "\uD4C7\u6860\u6861\uD4C8\u6862\uFEFE\u6863\u6864\u6865\uFEFE\uD4C9\uFEFE\uFEFE\uD4CA\uD4CB\uFEFE" + - "\uFEFE\uFEFE\u6866\u6867\uD4CC\uFFFF\u0004\uFEFE\u51AA\uFFFE\u0004\uD4CD\u4FAF\uD4D1\u6869\uD4D2" + - "\uD4D3\uFEFE\uD4D4\uD4D5\uD4D6\uFEFE\uFEFE\uFEFE\uD4D7\u50CB\u686A\uD4D8\uFEFE\uFEFE\uFEFE\uD4D9" + - "\uFEFE\uFEFE\uFEFE\uD4DA\uD4DB\u686B\uFEFE\uFEFE\uD4DC\uFEFE\uD4DD\uD4DE\uFEFE\uD4DF\uFEFE\uFEFE" + - "\uD4E0\uFEFE\uD4E1\uD4E2\u4CFD\uD4E3\uD4E4\u686C\uD4E5\uFEFE\uD4E6\uFEFE\uFFFE\u0005\uD4E7\uFEFE" + - "\uFEFE\u686D\u51F5\uFEFE\uFEFE\u686E\u686F\uFEFE\uFEFE\u6870\uD4EC\u6871\uFFFE\u0004\uD4ED\uFEFE" + - "\uD4F1\uFEFE\uFEFE\uD4F2\uD4F3\u6873\u6874\u6875\u4C80\u6872\uFEFE\uFEFE\u6876\u6877\uD4F4\uD4F5" + - "\u6879\uFEFE\u6878\uFFFE\u0005\uD4F6\u687B\uD4FB\uFEFE\uD4FC\u687C\u687A\uFEFE\uFEFE\uD4FD\uFEFE" + - "\uFEFE\uD4FE\uFFFF\u000F\uFEFE\u48CA\uFEFE\uFFFE\u0004\uD541\uFEFE\uD545\u687D\uD546\uD547\uFFFF" + - "\u0004\uFEFE\u687E\u5FF7\uD548\uFEFE\u687F\uD549\uD54A\uD54B\uFEFE\uD54C\uFFFF\u405A\uFEFE\uFFFE" + - "\u00BE\u6941\uFFFE\u00BE\u6A41\uFFFE\u00BE\u6B41\uFFFE\u00BE\u6C41\uFFFE\u00BE\u6D41\uFFFE\u00BE" + - "\u6E41\uFFFE\u00BE\u6F41\uFFFE\u00BE\u7041\uFFFE\u00BE\u7141\uFFFE\u00BE\u7241\uFFFE\u00BE\u7341" + - "\uFFFE\u00BE\u7441\uFFFE\u00BE\u7541\uFFFE\u00BE\u7641\uFFFE\u00BE\u7741\uFFFE\u00BE\u7841\uFFFE" + - "\u00BE\u7941\uFFFE\u00BE\u7A41\uFFFE\u00BE\u7B41\uFFFE\u00BE\u7C41\uFFFE\u00BE\u7D41\uFFFE\u00BE" + - "\u7E41\uFFFE\u00BE\u7F41\uFFFE\u00BE\u8041\uFFFE\u00BE\u8141\uFFFE\u00BE\u8241\uFFFE\u00BE\u8341" + - "\uFFFE\u00BE\u8441\uFFFE\u00BE\u8541\uFFFE\u00BE\u8641\uFFFE\u00BE\u8741\uFFFE\u00BE\u8841\uFFFE" + - "\u007D\u8941\uFFFF\u0032\uFEFE\u446E\uFFFF\u00B9\uFEFE\u5BC9\uFFFF\u00B2\uFEFE\u6674\uFFFF\u0031" + - "\uFEFE\u578E\u5877\u5882\u5980\u5BAE\u5C66\u5C78\u5E49\u5E8A\u5F7A\u5FD2\u5FD5\u5FD9\u5FDD\u6059" + - "\u60AD\u6177\u62B9\u62CE\u62E2\u63EE\u648E\u64F1\u6549\u6566\u65B8\u65C6\u6678\u66DD\u66DF\u66E6" + - "\u67F4\uFFFF\u00D3\uFEFE\uE9A3\uE9A4\uFFFF\u03FE\uFEFE\u0000\u0007\u425A\u7F7B\uE06C\u507D\u4D5D" + - "\u5C4E\u6B60\u4B61\uFFFE\n\u42F0\u0000\u0003\u427A\u5E4C\u7E6E\u6F7C\uFFFE\t\u42C1\uFFFE" + - "\t\u42D1\uFFFE\b\u42E2\u4444\u43E0\u4445\u4470\u426D\u4279\uFFFE\t\u4281\uFFFE\t" + - "\u4291\uFFFE\b\u42A2\u42C0\u424F\u42D0\u43A1\uFFFF\u0081\uFEFE\u434A\u424A\u425F\u42A1\u426A" + - "\u425B\uFFFF\u001A\uFEFE"; - - - ConvTable16684() - { - super(16684, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } - - ConvTable16684(int ccsid) - { - super(ccsid, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable17218.java b/cvsroot/src/com/ibm/as400/access/ConvTable17218.java deleted file mode 100644 index 8b2524b42..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable17218.java +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable17218.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// This is a Korean character set. -class ConvTable17218 extends ConvTable4930 -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable17218() - { - super(17218); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable17584.java b/cvsroot/src/com/ibm/as400/access/ConvTable17584.java deleted file mode 100644 index a7ee8c4e9..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable17584.java +++ /dev/null @@ -1,22 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable17584.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable17584 extends ConvTableUnicodeBigMap -{ - ConvTable17584() - { - super(17584); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable21680.java b/cvsroot/src/com/ibm/as400/access/ConvTable21680.java deleted file mode 100644 index 77e072315..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable21680.java +++ /dev/null @@ -1,22 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable21680.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable21680 extends ConvTableUnicodeBigMap -{ - ConvTable21680() - { - super(21680); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable256.java b/cvsroot/src/com/ibm/as400/access/ConvTable256.java deleted file mode 100644 index 4334898ed..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable256.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable256.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable256 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5\u00E7\u00F1\u005B\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u005D\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u00A3\u00A5\u20A7\u0192\u00A7\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u2017" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u0131\u00FB\u00FC\u00F9\u00FA\u00FF" + - "\\\u2007\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\uBBD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u9FB2\u6AB5\uBD3F\u9A8A\uBACA\uAFBC\u908F\uEAFA\uBEA0\uB63F\u9D3F\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u9E68\u7471\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\uEC3F\u80FD\uFEFB\uFCAD\uAE59" + - "\u4445\u4246\u4347\u9C48\u5451\u5253\u5855\u5657\u8C49\uCDCE\uCBCF\uCC3F\u70DD\uDEDB\uDC8D\u8EDF" + - "\uFFFF\u0018\u3F3F\u3FDA\uFFFF\u0030\u3F3F\uB43F\uFFFF\u0F39\u3F3F\u3FE1\uFFFF\u0007\u3F3F\u3FBF" + - "\uFFFF\u0047\u3F3F\u3FB3\uFFFF\u6FAC\u3F3F"; - - - ConvTable256() - { - super(256, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable273.java b/cvsroot/src/com/ibm/as400/access/ConvTable273.java deleted file mode 100644 index a644dfbf2..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable273.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable273.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable273 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u007B\u00E0\u00E1\u00E3\u00E5\u00E7\u00F1\u00C4\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u007E\u00DC\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u005B\u00C0\u00C1\u00C3\u00C5\u00C7\u00D1\u00F6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0060\u003A\u0023\u00A7\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + - "\u00B5\u00DF\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u0040\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + - "\u00E4\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00A6\u00F2\u00F3\u00F5" + - "\u00FC\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u007D\u00F9\u00FA\u00FF" + - "\u00D6\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\\\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u005D\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\uB5C1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE963\uECFC\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA943\uBBDC\u5907" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u9FB2\uCC7C\uBDB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u4A67\u9E68\u7471\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\uE0BF\u80FD\uFEFB\u5AAD\uAEA1" + - "\u4445\u4246\uC047\u9C48\u5451\u5253\u5855\u5657\u8C49\uCDCE\uCBCF\u6AE1\u70DD\uDEDB\uD08D\u8EDF" + - "\uFFFF\u7F80\u3F3F"; - - - ConvTable273() - { - super(273, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable277.java b/cvsroot/src/com/ibm/as400/access/ConvTable277.java deleted file mode 100644 index 297574c80..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable277.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable277.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable277 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u007D\u00E7\u00F1\u0023\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u00A4\u00C5\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u0024\u00C7\u00D1\u00F8\u002C\u0025\u005F\u003E\u003F" + - "\u00A6\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0060\u003A\u00C6\u00D8\'\u003D\"" + - "\u0040\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u007B\u00B8\u005B\u005D" + - "\u00B5\u00FC\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + - "\u00E6\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + - "\u00E5\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u007E\u00F9\u00FA\u00FF" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F4A\u676C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u80C1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE99E\uE09F\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA99C\uBB47\uDC07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u5AB2\u70B5\uBDB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u635B\u7B68\u7471\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\uECBF\u7CFD\uFEFB\uFCAD\uAE59" + - "\u4445\u4246\u43D0\uC048\u5451\u5253\u5855\u5657\u8C49\uCDCE\uCBCF\uCCE1\u6ADD\uDEDB\uA18D\u8EDF" + - "\uFFFF\u7F80\u3F3F"; - - - ConvTable277() - { - super(277, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable278.java b/cvsroot/src/com/ibm/as400/access/ConvTable278.java deleted file mode 100644 index b579f5c23..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable278.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable278.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable278 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u007B\u00E0\u00E1\u00E3\u007D\u00E7\u00F1\u00A7\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u0060\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u00A4\u00C5\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u0023\u00C0\u00C1\u00C3\u0024\u00C7\u00D1\u00F6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\\\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u00E9\u003A\u00C4\u00D6\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u005D" + - "\u00B5\u00FC\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u005B\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + - "\u00E4\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00A6\u00F2\u00F3\u00F5" + - "\u00E5\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u007E\u00F9\u00FA\u00FF" + - "\u00C9\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u0040\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F63\u676C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\uECC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9B5\u719F\u5F6D" + - "\u5181\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA943\uBB47\uDC07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u5AB2\uCC4A\uBDB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u7B5B\u9E68\u74E0\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\u7CBF\u80FD\uFEFB\uFCAD\uAE59" + - "\u4445\u4246\uC0D0\u9C48\u5479\u5253\u5855\u5657\u8C49\uCDCE\uCBCF\u6AE1\u70DD\uDEDB\uA18D\u8EDF" + - "\uFFFF\u7F80\u3F3F"; - - - ConvTable278() - { - super(278, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable280.java b/cvsroot/src/com/ibm/as400/access/ConvTable280.java deleted file mode 100644 index 645e61db5..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable280.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable280.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable280 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u007B\u00E1\u00E3\u00E5\\\u00F1\u00B0\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u005D\u00EA\u00EB\u007D\u00ED\u00EE\u00EF\u007E\u00DF\u00E9\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u00C7\u00D1\u00F2\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u00F9\u003A\u00A3\u00A7\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u005B\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + - "\u00B5\u00EC\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u0023\u00A5\u00B7\u00A9\u0040\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + - "\u00E0\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u00A6\u00F3\u00F5" + - "\u00E8\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u0060\u00FA\u00FF" + - "\u00E7\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7FB1\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\uB5C1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE990\u4851\u5F6D" + - "\uDD81\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA944\uBB54\u5807" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB07B\u9FB2\uCD7C\uBDB4\u9A8A\uBACA\uAFBC\u4A8F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u9E68\u7471\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\uECBF\u80FD\uFEFB\uFCAD\uAE59" + - "\uC045\u4246\u4347\u9CE0\uD05A\u5253\uA155\u5657\u8C49\u6ACE\uCBCF\uCCE1\u7079\uDEDB\uDC8D\u8EDF" + - "\uFFFF\u7F80\u3F3F"; - - - ConvTable280() - { - super(280, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable284.java b/cvsroot/src/com/ibm/as400/access/ConvTable284.java deleted file mode 100644 index 888890a27..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable284.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable284.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable284 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5\u00E7\u00A6\u005B\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u005D\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u00C7\u0023\u00F1\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0060\u003A\u00D1\u0040\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + - "\u00B5\u00A8\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u005E\u0021\u00AF\u007E\u00B4\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u40BB\u7F69\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\uBA6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uBD07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u9FB2\u49B5\uA1B4\u9A8A\u5FCA\uAFBC\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u9E68\u7471\u7273\u7875\u7677\uAC7B\uEDEE\uEBEF\uECBF\u80FD\uFEFB\uFCAD\uAE59" + - "\u4445\u4246\u4347\u9C48\u5451\u5253\u5855\u5657\u8C6A\uCDCE\uCBCF\uCCE1\u70DD\uDEDB\uDC8D\u8EDF" + - "\uFFFF\u7F80\u3F3F"; - - - ConvTable284() - { - super(284, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable285.java b/cvsroot/src/com/ibm/as400/access/ConvTable285.java deleted file mode 100644 index f8616d9c1..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable285.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable285.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable285 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5\u00E7\u00F1\u0024\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u0021\u00A3\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + - "\u00B5\u00AF\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u005B\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u005E\u005D\u007E\u00A8\u00B4\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u4A6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9B1\uE0BB\uBA6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uBC07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB05B\u9FB2\u6AB5\uBDB4\u9A8A\u5FCA\uAFA1\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u9E68\u7471\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\uECBF\u80FD\uFEFB\uFCAD\uAE59" + - "\u4445\u4246\u4347\u9C48\u5451\u5253\u5855\u5657\u8C49\uCDCE\uCBCF\uCCE1\u70DD\uDEDB\uDC8D\u8EDF" + - "\uFFFF\u7F80\u3F3F"; - - - ConvTable285() - { - super(285, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable28709.java b/cvsroot/src/com/ibm/as400/access/ConvTable28709.java deleted file mode 100644 index bbad9b6df..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable28709.java +++ /dev/null @@ -1,52 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable28709.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable28709 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u001A\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u001A\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u001A\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u005E\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u005B\u005D\u001A\u001A\u001A\u001A" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u001A\u001A\u001A\u001A\u001A\u001A" + - "\\\u001A\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u001A\u001A\u001A\u001A\u001A\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9BA\uE0BB\uB06D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u3F3F\u4A3F\u3F3F\u6A3F\u3F3F\u3F3F\u5F3F\uFFFF\u7FA9\u3F3F"; - - - ConvTable28709() - { - super(28709, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable290.java b/cvsroot/src/com/ibm/as400/access/ConvTable290.java deleted file mode 100644 index 458bf4bfb..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable290.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable290.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable290 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\uFF61\uFF62\uFF63\uFF64\uFF65\uFF66\uFF67\uFF68\uFF69\u00A3\u002E\u003C\u0028\u002B\u007C" + - "\u0026\uFF6A\uFF6B\uFF6C\uFF6D\uFF6E\uFF6F\u001A\uFF70\u001A\u0021\u00A5\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u001A\u002C\u0025\u005F\u003E\u003F" + - "\u005B\u0069\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u005D\uFF71\uFF72\uFF73\uFF74\uFF75\uFF76\uFF77\uFF78\uFF79\uFF7A\u0071\uFF7B\uFF7C\uFF7D\uFF7E" + - "\uFF7F\uFF80\uFF81\uFF82\uFF83\uFF84\uFF85\uFF86\uFF87\uFF88\uFF89\u0072\u001A\uFF8A\uFF8B\uFF8C" + - "\u007E\u203E\uFF8D\uFF8E\uFF8F\uFF90\uFF91\uFF92\uFF93\uFF94\uFF95\u0073\uFF96\uFF97\uFF98\uFF99" + - "\u005E\u00A2\\\u0074\u0075\u0076\u0077\u0078\u0079\u007A\uFF9A\uFF9B\uFF9C\uFF9D\uFF9E\uFF9F" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u0024\u001A\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u001A\u001A\u001A\u001A\u001A\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\uE06C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE970\uB280\uB06D" + - "\u7962\u6364\u6566\u6768\u6971\u7273\u7475\u7677\u788B\u9BAB\uB3B4\uB5B6\uB7B8\uB9C0\u4FD0\uA007" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u3F3F\uB14A\u3F5B\u3F3F\u3F3F\u3F3F\u5F3F\uFFFF\u0FC8\u3F3F\uA13F\uFFFF\u6F90\u3F3F\u3F41\u4243" + - "\u4445\u4647\u4849\u5152\u5354\u5556\u5881\u8283\u8485\u8687\u8889\u8A8C\u8D8E\u8F90\u9192\u9394" + - "\u9596\u9798\u999A\u9D9E\u9FA2\uA3A4\uA5A6\uA7A8\uA9AA\uACAD\uAEAF\uBABB\uBCBD\uBEBF\uFFFF\u0030" + - "\u3F3F"; - - - ConvTable290() - { - super(290, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable297.java b/cvsroot/src/com/ibm/as400/access/ConvTable297.java deleted file mode 100644 index b23d0af99..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable297.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable297.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable297 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u0040\u00E1\u00E3\u00E5\\\u00F1\u00B0\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u007B\u00EA\u00EB\u007D\u00ED\u00EE\u00EF\u00EC\u00DF\u00A7\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u00C7\u00D1\u00F9\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u00B5\u003A\u00A3\u00E0\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u005B\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + - "\u0060\u00A8\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u0023\u00A5\u00B7\u00A9\u005D\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u007E\u00B4\u00D7" + - "\u00E9\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + - "\u00E8\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u00A6\u00FA\u00FF" + - "\u00E7\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7FB1\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u44C1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE990\u48B5\u5F6D" + - "\uA081\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA951\uBB54\uBD07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB07B\u9FB2\uDD5A\uA1B4\u9A8A\uBACA\uAFBC\u4A8F\uEAFA\uBE79\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u9E68\u7471\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\uECBF\u80FD\uFEFB\uFCAD\uAE59" + - "\u7C45\u4246\u4347\u9CE0\uD0C0\u5253\u5855\u5657\u8C49\uCDCE\uCBCF\uCCE1\u706A\uDEDB\uDC8D\u8EDF" + - "\uFFFF\u7F80\u3F3F"; - - - ConvTable297() - { - super(297, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable300.java b/cvsroot/src/com/ibm/as400/access/ConvTable300.java deleted file mode 100644 index e7f2d5fb9..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable300.java +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable300.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// This is a Japanese character set. -class ConvTable300 extends ConvTable16684 -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable300() - { - super(300); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable367.java b/cvsroot/src/com/ibm/as400/access/ConvTable367.java deleted file mode 100644 index de4aca87b..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable367.java +++ /dev/null @@ -1,51 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable367.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable367 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\uFFFF\u7FC0\u1A1A"; - - - ConvTable367() - { - super(367, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable37.java b/cvsroot/src/com/ibm/as400/access/ConvTable37.java deleted file mode 100644 index da5eeeb32..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable37.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable37.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable37 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5\u00E7\u00F1\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u005E\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u005B\u005D\u00AF\u00A8\u00B4\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9BA\uE0BB\uB06D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\u4AB1\u9FB2\u6AB5\uBDB4\u9A8A\u5FCA\uAFBC\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u9E68\u7471\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\uECBF\u80FD\uFEFB\uFCAD\uAE59" + - "\u4445\u4246\u4347\u9C48\u5451\u5253\u5855\u5657\u8C49\uCDCE\uCBCF\uCCE1\u70DD\uDEDB\uDC8D\u8EDF" + - "\uFFFF\u7F80\u3F3F"; - - - ConvTable37() - { - super(37, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable420.java b/cvsroot/src/com/ibm/as400/access/ConvTable420.java deleted file mode 100644 index a0607970a..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable420.java +++ /dev/null @@ -1,64 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable420.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable420 extends ConvTableBidiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u0651\uFE7D\u0640\u200B\u0621\u0622\uFE82\u0623\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\uFE84\u0624\u001A\u001A\u0626\u0627\uFE8E\u0628\uFE91\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u0629\u062A\uFE97\u062B\uFE9B\u062C\uFE9F\u062D\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\uFEA3\u062E\uFEA7\u062F\u0630\u0631\u0632\u0633\uFEB3\u060C\u003A\u0023\u0040\'\u003D\"" + - "\u0634\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\uFEB7\u0635\uFEBB\u0636\uFEBF\u0637" + - "\u0638\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u0639\uFECA\uFECB\uFECC\u063A\uFECE" + - "\uFECF\u00F7\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\uFED0\u0641\uFED3\u0642\uFED7\u0643" + - "\uFEDB\u0644\uFEF5\uFEF6\uFEF7\uFEF8\u001A\u001A\uFEFB\uFEFC\uFEDF\u0645\uFEE3\u0646\uFEE7\u0647" + - "\u061B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\uFEEB\u001A\uFEEC\u001A\u0648" + - "\u061F\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u0649\uFEF0\u064A\uFEF2\uFEF3\u0660" + - "\u00D7\u2007\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u0661\u0662\u001A\u0663\u0664\u0665" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u20AC\u0666\u0667\u0668\u0669\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE93F\u3F3F\u3F6D" + - "\u3F81\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA93F\u4F3F\u3F07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\u4A3F\u3F3F\u6A3F\u3F3F\u3F3F\u5FCA\uFFFF\u0014\u3F3F\u3FE0\uFFFF\u000F\u3F3F\u3FA1\uFFFF" + - "\u028A\u3F3F\u793F\uFFFF\u0006\u3F3F\u3FC0\u3F3F\u3FD0\u3F46\u4749\u5256\u5556\u5862\u6365\u6769" + - "\u7173\u7475\u7677\u808B\u8D8F\u909A\u9E3F\u3F3F\u3F3F\u44AB\uADAF\uB1BB\uBDBF\uCFDA\uDC3F\u3F3F" + - "\u3F3F\u3F42\uFFFF\u0007\u3F3F\uDFEA\uEBED\uEEEF\uFBFC\uFDFE\u6C6B\u4B5C\uFFFF\u0CCC\u3F3F\u3FE1" + - "\u3F3F\u3F45\uFFFF\u0050\u3F3F\uFA3F\uFFFF\u6EE1\u3F3F\u4044\u4045\u403F\u4044\u4044\u4044\u4243" + - "\u4044\u4647\u4849\u5152\u5256\u5755\u5555\u5556\u5758\u5859\u5962\u6263\u6364\u6465\u6566\u6667" + - "\u6768\u6869\u6970\u7071\u7172\u7273\u7374\u7475\u7576\u7677\u7778\u7880\u808A\u8A8B\u8B8C\u8C8D" + - "\u8D8E\u8E8F\u8F8F\u8F90\u9090\u909A\u9B9C\u9D9E\u9FA0\uAAAB\uABAC\uACAD\uADAE\uAEAF\uAFB0\uB0B1" + - "\uB1BA\uBABB\uBBBC\uBCBD\uBDBE\uBEBF\uBFCB\uCDCF\uCFDA\uDBDC\uDDDE\uDEB2\uB3B4\uB5B8\uB9B8\uB93F" + - "\u3F3F\u3F5A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E" + - "\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE93F\u3F3F" + - "\u3F6D\u3F81\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA93F\u4F3F" + - "\uFFFF\u0051\u3F3F"; - - - ConvTable420() - { - super(420, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable423.java b/cvsroot/src/com/ibm/as400/access/ConvTable423.java deleted file mode 100644 index 5d64e63b4..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable423.java +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable423.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable423 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u005B\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u039A\u039B\u039C\u039D\u039E\u039F\u03A0\u03A1\u03A3\u005D\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u001A\u001A\u007C\u002C\u0025\u005F\u003E\u003F" + - "\u001A\u0386\u0388\u0389\u00A0\u038A\u038C\u038E\u038F\u0060\u003A\u00A3\u00A7\'\u003D\"" + - "\u00C4\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6" + - "\u00D6\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC" + - "\u00DC\u00A8\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u03BD\u03BE\u03BF\u03C0\u03C1\u03C3" + - "\u001A\u03AC\u03AD\u03AE\u03CA\u03AF\u03CC\u03CD\u03CB\u03CE\u03C2\u03C4\u03C5\u03C6\u03C7\u03C8" + - "\u00B8\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u03C9\u00E2\u00E0\u00E4\u00EA" + - "\u00B4\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B1\u00E9\u00E8\u00EB\u00EE\u00EF" + - "\u00B0\u001A\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00BD\u00F6\u00F4\u00FB\u00F9\u00FC" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00FF\u00E7\u00C7\u001A\u001A\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F3F\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u3FC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\u3F5A\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA93F\u6A3F\u3F07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u743F\u3F7B\u3F3F\u3F7C\uA13F\u3F3F\u3FCA\u3F3F\uE0DA\u3F3F\uD03F\u3F3F\uC03F\u3F3F\u3FEA\u3F3F" + - "\u3F3F\u3F3F\u803F\u3FFC\uFFFF\u0007\u3F3F\u903F\u3F3F\u3F3F\uA03F\u3F3F\uCD3F\uCC3F\uCE3F\u3FFB" + - "\uDCDB\uCFDD\u3F3F\uDEDF\u3F3F\u3F3F\uEC3F\uEB3F\u3FEE\u3FED\uEF3F\u3FFA\uFFFF\u0143\u3F3F\u713F" + - "\u7273\u753F\u763F\u7778\u3F41\u4243\u4445\u4647\u4849\u5152\u5354\u5556\u5758\u3F59\u6263\u6465" + - "\u6667\u3F3F\uB1B2\uB3B5\u3F8A\u8B8C\u8D8E\u8F9A\u9B9C\u9D9E\u9FAA\uABAC\uADAE\uBAAF\uBBBC\uBDBE" + - "\uBFCB\uB4B8\uB6B7\uB93F\uFFFF\u7E18\u3F3F"; - - - ConvTable423() - { - super(423, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable424.java b/cvsroot/src/com/ibm/as400/access/ConvTable424.java deleted file mode 100644 index 7b1703d08..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable424.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable424.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable424 extends ConvTableBidiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF\u05E0\u05E1\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u001A\u05EA\u001A\u001A\u00A0\u001A\u001A\u001A\u2017\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u001A\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u001A\u001A\u001A\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u001A\u001A\u20AC\u00B8\u20AA\u00A4" + - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u001A\u001A\u001A\u001A\u001A\u00AE" + - "\u005E\u00A3\u00A5\u2022\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u005B\u005D\u203E\u00A8\u00B4\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u001A\u001A\u001A\u001A\u001A" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u202D\u202E\u202C\u001A\u001A" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u001A\u001A\u001A\u001A\u001A" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u202A\u202B\u200E\u200F\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9BA\uE0BB\uB06D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u743F\u4AB1\u9FB2\u6AB5\uBDB4\u3F8A\u5FCA\uAF3F\u908F\uEAFA\uBEA0\uB63F\u9DDA\u3F8B\uB7B8\uB93F" + - "\uFFFF\u000B\u3F3F\u3FBF\uFFFF\u000F\u3F3F\u3FE1\uFFFF\u026C\u3F3F\u4142\u4344\u4546\u4748\u4951" + - "\u5253\u5455\u5657\u5859\u6263\u6465\u6667\u6869\u713F\uFFFF\u0D11\u3F3F\uFDFE\u0000\u0004\u3F3F" + - "\u3F3F\u783F\u3F3F\u3F3F\uB33F\u3F3F\u3F3F\u3F3F\uFBFC\uDDDB\uDC3F\uFFFF\u0007\u3F3F\uBC3F\uFFFF" + - "\u0035\u3F3F\u9E3F\u9C3F\uFFFF\u6F29\u3F3F\u3F5A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1" + - "\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8" + - "\uD9E2\uE3E4\uE5E6\uE7E8\uE9BA\uE0BB\uB06D\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798" + - "\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable424() - { - super(424, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable425.java b/cvsroot/src/com/ibm/as400/access/ConvTable425.java deleted file mode 100644 index 6b7e09fb0..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable425.java +++ /dev/null @@ -1,66 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable425.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable425 extends ConvTableBidiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u060C\u00E0\u061B\u0640\u061F\u00E7\u0621\u0622\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u0623\u00EE\u00EF\u0624\u0625\u0021\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u0626\u00C0\u0627\u0628\u0629\u00C7\u062A\u062B\u002C\u0025\u005F\u003E\u003F" + - "\u062C\u00C9\u00CA\u00CB\u00C8\u062D\u00CE\u00CF\u062E\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u062F\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u0630\u0631\u0632\u0633" + - "\u0634\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u0635\u0636\u00E6\u0637\u00C6\u20AC" + - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u0638\u0639\u063A\u005B\u0641\u0642" + - "\u0643\u0644\u0645\u0646\u00A9\u00A7\u0647\u0152\u0153\u0178\u0648\u0649\u064A\u005D\u064B\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u064C\u064D\u064E\u064F" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u0650\u00FB\u00FC\u00F9\u0651\u00FF" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u0652\u00D4\u200C\u200D\u200E\u200F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u001A\u00DB\u00DC\u00D9\u00A4\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9AD\uE0BD\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\u3F3F\uFE3F\u0000\u0006\u3FB5\uB48A\uCA3F\u3F3F\uA03F\u3F8B\u3F3F\u643F\u623F\u3F3F\u9E68" + - "\u7471\u7273\u3F3F\u7677\u3F3F\u3F3F\uEB3F\u3FBF\u3FFD\u3FFB\uFC3F\u3F3F\u443F\u423F\u3F3F\u9C48" + - "\u5451\u5253\u3F3F\u5657\u3F3F\u3F3F\uCB3F\u3FE1\u3FDD\u3FDB\uDC3F\u3FDF\uFFFF\u0029\u3F3F\uB7B8" + - "\uFFFF\u0012\u3F3F\uB93F\uFFFF\u0249\u3F3F\u433F\uFFFF\u0006\u3F3F\u3F45\u3F3F\u3F47\u3F49\u4A55" + - "\u5859\u6365\u6667\u696A\u7075\u7880\u8C8D\u8E8F\u909A\u9B9D\uAAAB\uAC3F\u3F3F\u3F3F\u46AE\uAFB0" + - "\uB1B2\uB3B6\uBABB\uBCBE\uCCCD\uCECF\uDADE\uEA3F\uFFFF\u0006\u3F3F\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9" + - "\u6C6B\u4B5C\uFFFF\u0CCF\u3F3F\uECED\uEEEF\uFFFF\u004E\u3F3F\u9F3F\uFFFF\u6EE1\u3F3F\uBEBE\uCC3F" + - "\uCD3F\uCECE\uCFCF\uDADA\uDEDE\uEAEA\u494A\u4A55\u5558\u5859\u5963\u6363\u6365\u6566\u6666\u6667" + - "\u6769\u6969\u696A\u6A6A\u6A70\u7070\u7075\u7575\u7578\u7878\u7880\u808C\u8C8D\u8D8E\u8E8F\u8F8F" + - "\u8F90\u9090\u909A\u9A9A\u9A9B\u9B9B\u9B9D\u9D9D\u9DAA\uAAAA\uAAAB\uABAB\uABAC\uACAC\uACAE\uAEAE" + - "\uAEAF\uAFAF\uAFB0\uB0B0\uB0B1\uB1B1\uB1B2\uB2B2\uB2B3\uB3B3\uB3B6\uB6B6\uB6BA\uBABB\uBBBC\uBCBC" + - "\uBC3F\uFFFF\u0005\u3F3F\u3F5A\u7F7B\u5B3F\u507D\u4D5D\u3F4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7" + - "\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6" + - "\uE7E8\uE9AD\uE0BD\u5F6D\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6" + - "\uA7A8\uA9C0\u4FD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable425() - { - super(425, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable437.java b/cvsroot/src/com/ibm/as400/access/ConvTable437.java deleted file mode 100644 index 90110c9a9..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable437.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable437.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable437 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u00B6\u00A7\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7\u00EA\u00EB\u00E8\u00EF\u00EE\u00EC\u00C4\u00C5" + - "\u00C9\u00E6\u00C6\u00F4\u00F6\u00F2\u00FB\u00F9\u00FF\u00D6\u00DC\u00A2\u00A3\u00A5\u20A7\u0192" + - "\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA\u00BF\u2310\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB" + - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + - "\u03B1\u00DF\u0393\u03C0\u03A3\u03C3\u03BC\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229" + - "\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u7F7F\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFFAD\u9B9C\u7F9D\u7F15\u7F7F\uA6AE\uAA7F\u7F7F\uF8F1\uFD7F\u7F7F\u14FA\u7F7F" + - "\uA7AF\uACAB\u7FA8\u7F7F\u7F7F\u8E8F\u9280\u0000\u0003\u7F90\u7F7F\u7FA5\u7F7F\u997F\u7F7F\u7F7F" + - "\u9A7F\u7FE1\u85A0\u837F\u8486\u9187\u8A82\u8889\u8DA1\u8C8B\u7FA4\u95A2\u937F\u94F6\u7F97\uA396" + - "\u817F\u7F98\uFFFF\u0049\u7F7F\u9F7F\uFFFF\u00FF\u7F7F\u7FE2\u7F7F\u7F7F\uE97F\uFFFF\u0004\u7F7F" + - "\u7FE4\u7F7F\uE87F\u7FEA\u7F7F\u7F7F\u7F7F\u7FE0\u7F7F\uEBEE\u7F7F\u7F7F\u7F7F\uE67F\u7F7F\uE37F" + - "\u7FE5\uE77F\uED7F\uFFFF\u0E5B\u7F7F\u7FFC\uFFFF\u0013\u7F7F\u7F9E\uFFFF\u00B8\u7F7F\u7FF9\uFB7F" + - "\u7F7F\uEC7F\uFFFF\u0004\u7F7F\u7FEF\uFFFF\u000F\u7F7F\uF77F\uFFFF\u000B\u7F7F\u7FF0\u7F7F\uF3F2" + - "\uFFFF\u0055\u7F7F\uA97F\uFFFF\u0007\u7F7F\uF4F5\uFFFF\u00EF\u7F7F\uC47F\uB37F\uFFFF\u0004\u7F7F" + - "\uDA7F\u7F7F\uBF7F\u7F7F\uC07F\u7F7F\uD97F\u7F7F\uC37F\u7F7F\u7F7F\u7F7F\uB47F\u7F7F\u7F7F\u7F7F" + - "\uC27F\u7F7F\u7F7F\u7F7F\uC17F\u7F7F\u7F7F\u7F7F\uC57F\uFFFF\t\u7F7F\uCDBA\uD5D6\uC9B8\uB7BB" + - "\uD4D3\uC8BE\uBDBC\uC6C7\uCCB5\uB6B9\uD1D2\uCBCF\uD0CA\uD8D7\uCE7F\uFFFF\t\u7F7F\uDF7F\u7F7F" + - "\uDC7F\u7F7F\uDB7F\u7F7F\uDD7F\u7F7F\uDEB0\uB1B2\uFFFF\u0006\u7F7F\uFE7F\uFFFF\u6D2F\u7F7F"; - - - ConvTable437() - { - super(437, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable4396.java b/cvsroot/src/com/ibm/as400/access/ConvTable4396.java deleted file mode 100644 index a06519eec..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable4396.java +++ /dev/null @@ -1,38 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable4396.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// This is a Japanese character set. -class ConvTable4396 extends ConvTable16684 -{ - ConvTable4396() - { - super(4396); - } - - static void makeAlternateMap(char[] toUnicode, char[] fromUnicode) - { - toUnicode[0x444A] = '\u2015'; - toUnicode[0x43A1] = '\uFF5E'; - toUnicode[0x447C] = '\u2225'; - toUnicode[0x4260] = '\uFF0D'; - toUnicode[0x426A] = '\uFFE4'; - - fromUnicode[0x2015] = '\u444A'; - fromUnicode[0xFF5E] = '\u43A1'; - fromUnicode[0x2225] = '\u447C'; - fromUnicode[0xFF0D] = '\u4260'; - fromUnicode[0xFFE4] = '\u426A'; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable4930.java b/cvsroot/src/com/ibm/as400/access/ConvTable4930.java deleted file mode 100644 index 17c1254ed..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable4930.java +++ /dev/null @@ -1,1670 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable4930.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable4930 extends ConvTableDoubleMap -{ - private static final String toUnicode_ = - "\uFFFF\u4040\uFFFD\u3000\uFFFF\u0100\uFFFD\u3001\u3002\u30FB\u2025\u2026\u00A8\u3003\u2010\u2014" + - "\u2225\uFF3C\uFFE3\u2018\u2019\u201C\u201D\u3014\u3015\uFFFE\n\u3008\u00B1\u00D7\u00F7\u01C2" + - "\u2266\u2267\u221E\u2234\u00B0\u2032\u2033\u2103\u212A\uFF3E\uFFE1\uFFE5\u3396\u3397\u2113\u33C4" + - "\u339C\u339D\u339E\u338E\u338F\u00A7\u203B\u2606\u2605\u0000\u0005\u25CB\uCFCE\uC7C6\uA1A0\uB3B2" + - "\uBDBC\u2192\u2190\u2191\u2193\u2194\u3013\uFF3B\uFF3D\u2260\u2264\u2265\u212B\u2642\u2640\u2220" + - "\u22A5\u2312\u0000\u0003\u2202\u0761\u526A\u6B1A\u223D\uFFFF\u00AC\uFFFD\u0000\u0003\uFFE0\u0E1C" + - "\u080B\u5C06\uFFFF\t\uFFFD\u0000\u0003\uFF01\u040A\u091B\uE20D\uFF0F\uFFFF\b\uFFFD\uFFE4" + - "\uFF0C\uFF05\uFF3F\uFF1E\uFF1F\uFFFF\t\uFFFD\u0000\u0003\uFF40\u1A03\u2007\u1D02\uFFFD\uFFFE" + - "\t\uFF41\uFFFF\u0007\uFFFD\uFFFE\t\uFF4A\uFFFF\u0007\uFFFD\u301C\uFFFE\b\uFF53\uFFFF" + - "\u0016\uFFFD\uFF5B\uFFFE\t\uFF21\uFFFF\u0006\uFFFD\uFF5D\uFFFE\t\uFF2A\uFFFF\u0006\uFFFD" + - "\uFFE6\uFFFD\uFFFE\b\uFF33\uFFFF\u0006\uFFFD\uFFFE\n\uFF10\uFFFF\u0047\uFFFD\uFFFE\u002A" + - "\u3165\uFFFF\u00D6\uFFFD\uFFFE\u0053\u3041\uFFFF\u00AD\uFFFD\uFFFE\u0056\u30A1\uFFFF\u00AA\uFFFD" + - "\uFFFE\n\u2170\uFFFF\u0005\uFFFD\uFFFE\n\u2160\uFFFF\u0007\uFFFD\uFFFE\u0011\u0391\uFFFE" + - "\u0007\u03A3\uFFFF\b\uFFFD\uFFFE\u0011\u03B1\uFFFE\u0007\u03C3\uFFFF\u00A8\uFFFD\u0000\u001D" + - "\u2500\u020C\u1018\u141C\u2C24\u343C\u0103\u0F13\u1B17\u2333\u2B3B\u4B20\u2F28\u373F\u1D30\u2538" + - "\u4212\u111A\u1916\u150E\u0D1E\u1F21\u2226\u2729\u2A2D\u2E31\u3235\u3639\u3A3D\u3E40\u2541\uFFFE" + - "\b\u2543\uFFFF\u00BC\uFFFD\u0000\n\u3395\u98A3\uA4A5\uA699\u9A9B\u9FA0\uA1A2\uCA8D\uCF88" + - "\u89C8\uA7A8\uFFFE\n\u33B0\uFFFE\u0005\u3380\uFFFE\u0006\u33BA\uFFFE\u0005\u3390\u2126\u0000" + - "\n\u33C0\uC18A\u8B8C\uD6C5\uADAE\uAFDB\uA9AA\uABAC\uDDD0\uD3C3\uC9DC\u33C6\uFFFF\u00BA\uFFFD" + - "\u0000\u0006\u221D\u352B\u2C08\u0B86\u8782\u832A\u2927\u2228\u21D2\u21D4\u2200\u2203\u00B4\u02DC" + - "\u02C7\u02D8\u02DD\u02DA\u02D9\u00B8\u02DB\u00A1\u00BF\u02D0\u222E\u2211\u220F\u00A4\u2109\u2030" + - "\u25C1\u25C0\u25B7\u25B6\u2664\u2660\u2661\u2665\u2667\u2663\u0000\u0005\u25C9\uC8A3\uD0D1\u92A4" + - "\uA5A8\uA7A6\u25A9\u2668\u260F\u260E\u261C\u261E\u00B6\u2020\u2021\u2195\u2197\u2199\u2196\u2198" + - "\u266D\u2669\u266A\u266C\u327F\u321C\u2116\u33C7\u2122\u33C2\u33D8\u2121\u02BA\u20AC\u00AE\uFFFF" + - "\u00AA\uFFFD\uFFFE\u0006\u0410\u0401\uFFFE\u0020\u0416\u0451\uFFFE\u001A\u0436\uFFFF\u00BE\uFFFD" + - "\u00C6\u00D0\u00AA\u0126\uFFFD\u0132\uFFFD\u013F\u0141\u00D8\u0152\u00BA\u00DE\u0166\u014A\uFFFD" + - "\uFFFE\u001C\u3260\uFFFE\u001A\u24D0\uFFFE\u000F\u2460\u00BD\u2153\u2154\u00BC\u00BE\uFFFE\u0004" + - "\u215B\uFFFD\u00E6\u0111\u00F0\u0127\u0131\u0133\u0138\u0140\u0142\u00F8\u0153\u00DF\u00FE\u0167" + - "\u014B\u0149\uFFFE\u001C\u3200\uFFFE\u001A\u249C\uFFFE\u000F\u2474\u00B9\u00B2\u00B3\u2074\u207F" + - "\uFFFE\u0004\u2081\uFFFF\u0043\uFFFD\uFFFE\u005A\u1100\uFFFF\u00A6\uFFFD\uFFFE\u0044\u115F\uFFFF" + - "\u00BC\uFFFD\uFFFE\u0052\u11A8\uFFFF\u01AE\uFFFD\u4F3D\u4F73\u5047\u50F9\u52A0\u53EF\u5475\u54E5" + - "\u5609\u5AC1\u5BB6\u6687\u67EF\u67B6\u6B4C\u7A3C\u82DB\u8304\u8857\u8888\u8A36\u8CC8\u8DCF\u8EFB" + - "\u8FE6\u99D5\u523B\u5374\u5404\uF843\u606A\u64F1\u6BBC\u73CF\u811A\u89BA\u89D2\u95A3\u520A\u58BE" + - "\u5978\u59E6\u5E72\u5E79\u61C7\u63C0\u6746\u6F97\u764E\u770B\u7A08\u7AFF\u7C21\u826E\u8271\u809D" + - "\u8AEB\u9593\u4E6B\u559D\u66F7\u6E34\u78A3\u7AED\u8910\u7FAF\u845B\u97A8\u52D8\u574E\u582A\u5D4C" + - "\u611F\u61BE\u6562\u67D1\u6A44\u6E1B\u7518\u75B3\u76E3\u7D3A\u9163\u9451\u9F95\u5323\u5CAC\u7532" + - "\u80DB\u9240\u9598\u5CA1\u525B\u59DC\u5D17\u5EB7\u5F3A\u5F4A\u6177\u6C5F\u7586\u7DB1\u8941\u7CE0" + - "\u8154\u8591\u8B1B\u92FC\u964D\u4ECB\u4EF7\u500B\u51F1\u6137\u613E\u6168\u6539\u69EA\u6F11\u75A5" + - "\u7686\u76D6\u7B87\u82A5\u84CB\u958B\u5BA2\u5751\uF901\u7CB3\u7FB9\u91B5\u53BB\u5C45\u5DE8\u62D2" + - "\u636E\u64DA\u6E20\u70AC\u64E7\u8DDD\u907D\uF902\uF844\u92F8\u4E7E\u4EF6\u5065\u5DFE\u5EFA\u6106" + - "\u8654\u8E47\u9375\u9A2B\u4E5E\u5091\u6770\u5109\u528D\u6AA2\u77BC\u9ED4\u52AB\u602F\u5048\u61A9" + - "\u63ED\u64CA\u683C\u6A84\u6FC0\u89A1\u9694\u9ABC\u5805\u80A9\u727D\u72AC\u7504\u7D79\u7E6D\u898B" + - "\u8B74\u9063\u9D51\u6F54\u6C7A\u7D50\uFFFF\u0042\uFFFD\u7F3A\u8A23\u517C\u614A\u7B9D\u84B9\u8B19" + - "\u938C\u4EAC\u50BE\u52C1\u52CD\u537F\u54FD\u5883\u5E9A\u5F91\u6176\u66BB\u6243\u64CE\u656C\u666F" + - "\u66F4\u6897\u6AA0\u6D87\u7085\u71B2\u749F\u74CA\u754A\u75D9\u786C\u78EC\u7ADF\u7AF6\u7D45\u7D93" + - "\u8015\u803F\u811B\u8396\u8B66\u8F15\u9015\u93E1\u9803\u9838\u9A5A\u9BE8\u4FC2\u5553\u5951\u5B63" + - "\u5C46\u60B8\u6212\u6842\u68B0\u6EAA\u754C\u7678\u78CE\uF845\u7A3D\u7CFB\u7E6B\u7E7C\u8A08\u8AA1" + - "\u968E\u8C3F\u96DE\u9DC4\u53E9\u53E4\u544A\u5471\u56FA\u59D1\u5B64\u5EAB\u62F7\u6537\u6545\u6572" + - "\u67AF\u6772\u6CBD\u75FC\u7690\u8831\u77BD\u7A3F\u777E\u8003\u80A1\u818F\u82E6\u85C1\u88B4\u8A41" + - "\u8AA5\uF903\u8F9C\u932E\u96C7\u9867\u9AD8\u9F13\u54ED\u659B\u66F2\u688F\u7A40\u8C37\u9D60\u56F0" + - "\u5764\u5D11\u6606\u68B1\u68CD\u6EFE\u889E\u6C68\uF904\u9AA8\u4F9B\u516C\u5171\u529F\u5B54\u5DE5" + - "\u8CA2\u606D\u6050\u62F1\u63A7\u653B\u6831\u69D3\u7A7A\u7B9C\u5BE1\u6208\u679C\u74DC\u79D1\u83D3" + - "\u874C\u8A87\u8AB2\u904E\u9846\u5ED3\u69E8\u85FF\u90ED\u970D\uF905\u51A0\u5B98\u5BEC\u6163\u68FA" + - "\u74D8\u6B3E\u704C\u76E5\u7BA1\u7F50\u83C5\u89C0\u8CAB\u95DC\u9928\u9E1B\u522E\u605D\u62EC\u9002" + - "\u5149\u5321\u58D9\u5EE3\u66E0\u6D38\u72C2\uFFFF\u0042\uFFFD\u73D6\u7B50\u80F1\u945B\u5366\u639B" + - "\u7F6B\u4E56\u5080\u584A\u58DE\u602A\u6127\u62D0\u69D0\u9B41\u5B8F\u7D18\u80B1\u8F5F\u4EA4\u50D1" + - "\u54AC\u55AC\u5B0C\u5DA0\u5DE7\u654E\u652A\u6821\u6A4B\u72E1\u768E\u77EF\u7D5E\u7FF9\u81A0\u854E" + - "\u86DF\u8F03\u8F4E\u90CA\u9278\u9903\u9A55\u9BAB\u4E18\u4E45\u4E5D\u4EC7\u4F5D\u4FF1\u50B4\u5177" + - "\u52FE\u5340\u53E3\u53E5\u548E\u5614\u57A2\u5ABE\u5AD7\u5BC7\u5D87\u5ED0\u61FC\u62D8\u6551\uF846" + - "\u67B8\u67E9\u69CB\u6B50\u6BC6\u6BEC\u6C42\u6E9D\u7078\u72D7\u7396\u7403\u750C\u77BF\u77E9\u7A76" + - "\u7D7F\u8CFC\u81FC\u8205\u820A\u82DF\u8862\u89AF\u8B33\u8EC0\u9011\u90B1\u9264\u98B6\u99D2\u9A45" + - "\u9CE9\u9DD7\u9F9C\u570B\u5C40\u63AC\u83CA\u97A0\u9EB4\u7A98\u7FA4\u8ECD\u541B\u90E1\u5800\u5C48" + - "\u6398\u7A9F\u5BAE\u5F13\u7A79\u7AAE\u8EAC\u5026\u5238\u52F8\u5377\u5708\u62F3\u6B0A\u7737\u53A5" + - "\u8E76\u95D5\u673A\u6AC3\u6F70\u8A6D\u8DEA\u8ECC\u994B\u6B78\u8CB4\u9B3C\uF907\u53EB\u572D\u594E" + - "\u63C6\u73EA\u7845\u7ABA\u8475\u7CFE\u898F\u8D73\u9035\u95A8\u5747\u7B60\u83CC\u921E\uF908\u6A58" + - "\u514B\u524B\u5287\u621F\u6975\u68D8\u9699\u50C5\u52E4\u5DF9\u61C3\u65A4\u6839\u69FF\u6F0C\u747E" + - "\u7B4B\u82B9\u83EB\u89B2\u8B39\u8FD1\u9949\uF909\uFFFF\u0042\uFFFD\u4ECA\u64D2\u6A8E\u7434\u7981" + - "\u79BD\u887F\u887E\u895F\uF90A\u9326\u53CA\u5C8C\u6025\u6271\u6C72\u7B08\u7D1A\u7D66\u4E98\u5162" + - "\u77DC\u80AF\u4F01\u4F0E\u5176\u5180\u55DC\u5668\u573B\u57FA\u5914\u5947\u5993\u5BC4\u5C90\u8C48" + - "\u5D0E\u5E7E\u5DF1\u5FCC\u6280\u65D7\u65E3\u671F\u675E\u68CB\u68C4\u6A5F\u6B3A\u6C23\u6C7D\u6C82" + - "\u6DC7\u7426\u742A\u74A3\u7578\u757F\u7881\u78EF\u7947\u7948\u797A\u7B95\u7D00\u7DBA\uF847\u8006" + - "\u802D\u808C\u671E\u8A18\u8B4F\u8D77\u9321\u98E2\u9951\u9A0E\u9A0F\u9A65\u9C2D\u9E92\u7DCA\u4F76" + - "\u5409\u62EE\u6854\u91D1\uF848\u55AB\u513A\u61E6\u62CF\u62FF\u7CEF\u90A3\u8AFE\u6696\u7156\u96E3" + - "\u637A\u634F\u5357\u5583\u7537\u7D0D\u56CA\u5A18\u66E9\u4E43\u5167\u5948\u67F0\u8010\u8FFA\u5973" + - "\u5E74\u79CA\u5FF5\u606C\u62C8\u637B\u4F5E\u5BE7\uF849\u52AA\u5974\u5B65\u5F29\u6012\u7459\u6FC3" + - "\u81BF\u8FB2\u60F1\u8166\u5C3F\uF84A\u5AE9\u8A25\u7D10\u80FD\u5C3C\u6CE5\u533F\u6EBA\u591A\u8336" + - "\u4E39\u4F46\u55AE\u5718\u58C7\u65B7\u65E6\u6A80\u6BB5\u6E4D\u77ED\u7AEF\u7C1E\u7DDE\u86CB\u8892" + - "\u9132\u935B\u977C\u601B\u64BB\u737A\u75B8\u9054\u95E5\u97C3\u5556\u64D4\u66C7\u6DE1\u6F6D\u6FB9" + - "\u75F0\u8043\u81BD\u8983\u8AC7\u8B5A\u6C93\u7B54\u8E0F\uFFFF\u0042\uFFFD\u905D\u515A\u5802\u5858" + - "\u5E62\u5510\u649E\u68E0\u7576\u7CD6\u87F7\u9EE8\u4EE3\u5788\u5927\u5C0D\u5CB1\u5E36\u5F85\u6234" + - "\u64E1\u73B3\u7893\u81FA\u888B\u8CB8\u968A\u9EDB\u5B85\u5FB7\u60B3\u5012\u5200\u5230\u5716\u5835" + - "\u5857\u5C0E\u5C60\u5CF6\u5EA6\u5F92\u60BC\u6311\u6417\u6843\u68F9\u6DD8\u6E21\u6ED4\u6FE4\u71FE" + - "\u76DC\u7779\u79B1\u7A3B\u8404\u83DF\u8CED\u8DF3\u8E48\u9003\u9014\u9053\u90FD\u934D\u9676\u97DC" + - "\u6BD2\u7006\u7258\u72A2\u7368\u7763\u79BF\u7BE4\u7E9B\u8B80\u58A9\u60C7\u6566\u66BE\u6C8C\u71C9" + - "\u8C5A\u9813\u5484\u4E6D\u7A81\u4EDD\u51AC\u51CD\u52D5\u540C\u578C\u61A7\u6771\u6850\u68DF\u6D1E" + - "\u6F7C\u7AE5\u75BC\u77B3\u8463\u80F4\u9285\u515C\u6597\u675C\u6793\u75D8\u7AC7\u8373\u809A\u86AA" + - "\uF95A\u8C46\u982D\u5C6F\u81C0\u9041\u906F\u920D\u5F97\u6A59\u6ED5\u706F\u71C8\u767B\u7B49\u85E4" + - "\u8B04\u9127\u9419\u9A30\u5587\u61F6\u7669\u7F85\u863F\u87BA\u88F8\u908F\uF95C\u6D1B\u70D9\u7296" + - "\u73DE\u7D61\u843D\u916A\u99F1\u4E82\u5375\u5E71\u6B04\u6B12\u703E\u721B\u862D\u9E1E\u524C\u57D3" + - "\u8FA3\u5D50\u64E5\u652C\u6B16\u6FEB\u7C43\u7E9C\u85CD\u8964\u89BD\u62C9\u81D8\u881F\u5ECA\u6717" + - "\u6994\u6D6A\u72FC\u7405\u746F\u8782\u90DE\u4F86\u840A\u51B7\uFFFF\u0042\uFFFD\u63A0\u7565\u4EAE" + - "\u5169\u5006\u51C9\u6881\u6DBC\u6A11\u7CAE\u7CB1\u7CE7\u826F\u8AD2\u8F1B\u91CF\u9B4E\u4FB6\u52F5" + - "\u5442\u5EEC\u623E\u65C5\u6ADA\u6FFE\u7658\u792A\u8182\u85DC\u616E\u8823\u8821\u9462\u95AD\u9A62" + - "\u9A6A\u9E97\u9ECE\u529B\u6B77\u66C6\u6ADF\u701D\u792B\u8F62\u9742\u6190\u6200\u6523\u6F23\u7149" + - "\u7DF4\u806F\u84EE\u8F26\u9023\u934A\u51BD\u52A3\u5217\u6D0C\u70C8\u88C2\u5EC9\u6582\u6BAE\u6FC2" + - "\u7C3E\u7375\u9B23\u4EE4\u4F36\u56F9\u5DBA\u601C\u6624\u6CE0\u73B2\u7F9A\u7FCE\u82D3\u86C9\u901E" + - "\u96F6\u9748\u9234\u9818\u9F61\u4F8B\u79AE\u91B4\u96B7\u52DE\u6488\u6AD3\u6F66\u7210\u7018\u76E7" + - "\u8001\u826B\u8606\u865C\u8DEF\u8F05\u8F64\u9732\u9B6F\u9DFA\u9E75\u6F09\u788C\uF84B\u7DA0\u8F46" + - "\u9304\u9E93\u9E7F\u8AD6\u58DF\u5F04\u6727\u7027\u74CF\u7C60\u807E\u5121\u7262\u78CA\u7C5F\u857E" + - "\u8A84\u8CF4\u8CC2\u96F7\u4E86\u50DA\uF84C\u5BEE\u5ED6\u71CE\u7642\u77AD\u6599\u804A\u84FC\u907C" + - "\u9F8D\u50C2\u58D8\u5C62\u6A13\u6DDA\u6F0F\u7D2F\u7E37\u8938\u964B\u9ACF\u5289\u67F3\u69B4\u6D41" + - "\u6E9C\u7409\u7460\u7559\u7624\u786B\u8B2C\u985E\u516D\u622E\u9678\u502B\u5D19\u6DEA\u7DB8\u8F2A" + - "\u5F8B\u6144\u6817\uF961\u7ABF\u9686\u808B\u52D2\u51DB\u5EE9\u51CC\uFFFF\u0042\uFFFD\u695E\u7A1C" + - "\u7DBE\u83F1\u9675\u4FDA\u5229\u5398\u540F\u5C65\u60A7\uF84D\u674E\u68A8\u6F13\u7281\u72F8\u7406" + - "\u7483\u75E2\u79BB\u7F79\u7C6C\u87AD\u88CF\u91CC\u91D0\u96E2\u9B51\u9BC9\u541D\u71D0\u7498\u85FA" + - "\u8EAA\u96A3\u9C57\u9E9F\u6797\u6DCB\u7433\u75F3\u81E8\u9716\u5CA6\u782C\u7ACB\u7B20\u7C92\u5ABD" + - "\u6469\u746A\u75F2\u78E8\u87C7\u99AC\u9B54\u9EBB\u5BDE\u5E55\u6F20\u819C\u83AB\u5A29\u5DD2\u5F4E" + - "\u6162\u633D\u6669\u66FC\u6EFF\u6F2B\u7063\u779E\u842C\u8513\u883B\u8B3E\u8F13\u93DD\u9945\u9B18" + - "\u9C3B\u62B9\u672B\u6CAB\u896A\u977A\u4EA1\u5984\u5FD8\u5FD9\u671B\u7DB2\u7F54\u8292\u832B\u83BD" + - "\u9099\u9B4D\u57CB\u59B9\u5A92\u5BD0\u6627\u679A\u6885\u6BCF\u7164\u771B\u7F75\u82FA\u8CB7\u8CE3" + - "\u9081\u9B45\u8108\u8109\u8C8A\u964C\u9A40\u9EA5\u5B5F\u6C13\u731B\u76DF\u76F2\u840C\u51AA\u8993" + - "\u4FDB\u514D\u52C9\u5195\u68C9\u7704\u7720\u7DBF\u7DEC\u9762\u9EB5\u6EC5\u8511\u547D\u51A5\u540D" + - "\u9CF4\u660E\u669D\u6E9F\u76BF\u8317\u879F\u9169\u9298\u8882\u4FAE\u52DF\u5E3D\u59C6\u6155\u6478" + - "\u66AE\u5192\u67D0\u6A21\u6BCD\u6BDB\u725F\u7261\u7738\u77DB\u8004\u8017\u8305\u8B00\u8B28\u8C8C" + - "\u927E\u6728\u6C90\u7267\u76EE\u7766\u7A46\u6B7F\u6C92\u5922\u6726\u6FDB\uFFFF\u0042\uFFFD\u77C7" + - "\u8499\u536F\u5893\u5999\u5EDF\u63CF\u6634\u6773\u6E3A\u732B\u82D7\u9328\u52D9\u5DEB\u61CB\u620A" + - "\u62C7\u64AB\u65E0\u6B66\u6BCB\u7121\u755D\u7E46\u821E\u8302\u856A\u8AA3\u8CBF\u9727\u9D61\u58A8" + - "\u9ED8\u520E\u543B\u6587\u6C76\u7D0B\u7D0A\u868A\u9580\u554F\u805E\u52FF\u7269\u5473\u5A9A\u5C3E" + - "\u5D4B\u9761\u5F4C\u5FAE\u672A\u6E3C\u7030\u7709\u7C73\u7CDC\u7F8E\u8587\u8B0E\u8FF7\u60B6\u610D" + - "\u61AB\u654F\u65FC\u65FB\u6C11\u6CEF\u739F\u73C9\u9594\u95A9\u5BC6\u871C\u8B10\uF84E\u525D\u535A" + - "\u62CD\u640F\u64B2\u6734\u6A38\u6B02\u6CCA\u7254\u73C0\u749E\u7B94\u7E1B\u7C95\u818A\u8236\u8584" + - "\u8FEB\u96F9\u99C1\u4F34\u534A\u53CD\u53DB\u62CC\u642C\u6500\u6591\u69C3\u6F58\u6CEE\u73ED\u7554" + - "\u76E4\u78FB\u792C\u7D46\u80D6\u87E0\u822C\u8FD4\u9812\u98EF\u52C3\u62D4\u6F51\u64A5\u767C\u8DCB" + - "\u91B1\u9262\u9AEE\u9B43\u5023\u508D\u574A\u59A8\u5C28\u5E47\u5F77\u623F\u653E\u65B9\u65C1\u6609" + - "\u699C\u7D21\u80AA\u8180\u822B\u82B3\u84A1\u868C\u8A2A\u8B17\u90A6\u9632\u9AE3\u9B74\u9F90\u4FF3" + - "\u500D\uF963\u57F9\u5F98\u62DC\u6392\u676F\u6E43\u76C3\u80DA\u80CC\u88F5\u88F4\u8919\u8CE0\u8F29" + - "\u914D\u966A\u4F2F\u4F70\u5E1B\u67CF\u6822\u767D\u767E\u9B44\u6A0A\uF84F\u7169\uFFFF\u0042\uFFFD" + - "\u756A\uF964\u7E41\u7FFB\u8543\u85E9\u98DC\u4F10\u7B4F\u7F70\u95A5\u51E1\u5E06\u68B5\u6C3E\u6C4E" + - "\u6CDB\u72AF\u7BC4\u8303\u6CD5\u743A\u50FB\u5288\u58C1\u64D8\u74A7\u7656\u78A7\u8F9F\u95E2\u9739" + - "\uF965\u535E\u5F01\u6C74\u8FAE\u8B8A\u8FA8\u8FAF\uF850\u908A\u99E2\u5225\u5F46\u77A5\u9C49\u9F08" + - "\u4E19\u5002\u5175\u5C5B\u5E77\u661E\u663A\u67C4\u70B3\u7501\u75C5\u7ADD\u79C9\u8F27\u8FF8\u9920" + - "\u4FDD\u5821\u5831\u5BF6\u666E\u6B65\u6E7A\u6D11\u6F7D\u752B\u88DC\u8913\u8B5C\u8F14\u9D07\u9EFC" + - "\u4F0F\u50D5\u5310\u535C\u5B93\u5FA9\u798F\u670D\u8179\u832F\u8514\u8986\u8760\u8907\u8F3B\u99A5" + - "\u9C12\u672C\u4E76\u4E30\u4FF8\u5949\u5C01\u5CF0\u5CEF\u6367\u742B\u68D2\u70FD\u7E2B\u8451\u84EC" + - "\u8702\u9022\u92D2\u9CF3\u4EC6\u4ED8\u5085\u5256\u526F\u5426\u57E0\u592B\u5A66\u5B75\u5BCC\u5E9C" + - "\uF966\u6276\u6577\u65A7\u6D6E\u6EA5\u7236\u7C3F\u7F36\u7B26\u7F58\u8151\u8150\u819A\u8299\u82FB" + - "\u8709\u8A03\u8CA0\u8CE6\u8CFB\u8D74\u8DBA\u90E8\u91DC\u961C\u9644\u982B\u99D9\u9B92\u9CE7\u5317" + - "\u5206\u5674\uF851\u58B3\u5954\u596E\u5FFF\u61A4\u626E\u6C7E\u711A\u76C6\u7C89\u7CDE\u7D1B\u82AC" + - "\u8561\u96F0\uF967\u4F5B\uF852\u5F17\u62C2\u9AF4\u9EFB\u5D29\u670B\u68DA\u787C\u7E43\uFFFF\u0042" + - "\uFFFD\u9D6C\u4E15\u5099\u5315\u532A\u5351\u5983\u59A3\u5A62\u5E87\u60B2\u618A\u6249\u6279\u6590" + - "\uF853\u69A7\u6C98\uF968\u6CB8\u6BD4\u6BD8\u7435\u75FA\u7765\u7812\u7891\u79D8\u7BE6\u7DCB\u7FE1" + - "\u80A5\u8153\u813E\u81C2\u83F2\u871A\u88E8\u8AB9\u8B6C\u8CBB\u8F61\u9119\u975E\u98DB\u9AC0\u9F3B" + - "\u5B2A\u8CD3\u5F6C\u64EF\u658C\u6AB3\u6BAF\u6FF1\u7015\u725D\u860B\u8CA7\uF854\u983B\u9870\u9B22" + - "\u6191\u6C37\u8058\u9A01\u4E4D\u4E8B\u4E9B\u4ED5\u4F3C\u4F3A\u820D\u4F7F\u50FF\u53F2\u53F8\u56DB" + - "\u5506\u55E3\u58EB\u5962\u59D2\u5A11\u5BEB\u5BFA\u5DF3\u5E2B\uF855\u5F99\u601D\u6368\u8D66\u65AF" + - "\u659C\u67FB\u68AD\u6942\u69CE\u6C99\u6CD7\u6E23\u7009\u90AA\u7345\u7940\u793E\u7960\u6B7B\u7802" + - "\u79C1\u7B25\u7BE9\u84D1\u7D17\u7D72\u838E\u86C7\u88DF\u8A50\u8A5E\u8B1D\u8CDC\u5C04\u8FAD\u8086" + - "\u98FC\u99DF\u524A\uF969\u69CA\u6714\uF96A\u9460\u5098\u522A\u5C71\u6563\u6C55\u73CA\u7523\u759D" + - "\u7B97\u849C\u9178\u6492\u6BBA\u4E77\u85A9\u4E09\uF96B\u6749\u68EE\u6E17\u886B\u829F\u8518\u6B43" + - "\u63F7\u6F81\u98AF\u9364\u970E\u4E0A\u50B7\u50CF\u511F\u5546\u55AA\u5617\u723D\u5B40\u5C19\u5E8A" + - "\u5EA0\u5EC2\u5E38\u60F3\u76F8\u6851\u6A61\u6BA4\u6E58\u72C0\u7240\u7965\u7BB1\u7FD4\u88F3\uFFFF" + - "\u0042\uFFFD\u89F4\u8C61\u8CDE\u8A73\u971C\u585E\u74BD\u8CFD\u9C13\uF96C\u7A61\u7D22\u8272\u7272" + - "\u751F\u7525\uF96D\u7B19\u566C\u58FB\u5885\u5A7F\u7280\u5DBC\u5E8F\u5EB6\u5F90\u6055\u6292\u654D" + - "\u6691\u66D9\u66F8\u6816\u68F2\u745E\u7D6E\u7DD6\u7F72\u80E5\u8212\u85AF\u897F\u8A93\u92E4\u901D" + - "\u9ECD\uF856\u9F20\u5915\u596D\uF857\u5E2D\u60DC\u6614\u6673\u6790\u6C50\u6DC5\u6F5F\u77F3\u78A9" + - "\u84C6\u91CB\u932B\u5148\u4ED9\u50CA\uF858\u5584\u5BA3\u5C20\u6103\u6247\u65CB\uF859\u717D\u71F9" + - "\u79AA\u7444\u7487\u74BF\u766C\u7DDA\u7E55\u7FA8\u817A\u81B3\u8239\u861A\u87EC\u8A75\u8DE3\u9078" + - "\u9291\uF85A\u9BAE\u5070\u5368\u820C\uF85B\u5C51\u6308\u6954\u6D29\u6E2B\u859B\u8A2D\u8AAA\u96EA" + - "\u6BB2\u7E96\u87FE\u8D0D\u66B9\u9583\u71EE\u651D\u6D89\uF96E\u57CE\u59D3\u6027\u60FA\u6210\u661F" + - "\u665F\u7329\u76DB\u7701\u7B6C\u8056\u8072\u8165\u8AA0\u9192\u4E16\u52E2\u6B72\u6D17\u7A05\u7B39" + - "\u7D30\uF96F\u8CB0\u53EC\u562F\u5851\u5C0F\u5C11\u5BB5\u5DE2\u6383\u6414\u6240\u662D\u68B3\u6CBC" + - "\u6D88\u6EAF\u701F\u70A4\u71D2\u7526\u758E\u758F\u7B11\u7C2B\u7D20\u7D39\u8258\u852C\u856D\u8607" + - "\u8A34\u900D\u9061\u90B5\u92B7\u9704\u97F6\u9A37\u4FD7\u5C6C\u675F\u7C9F\u7E8C\u901F\u5B6B\u640D" + - "\uFFFF\u0042\uFFFD\u905C\u7387\u87C0\u5B8B\u677E\u8A1F\u8AA6\u9001\u980C\u5237\uF970\u7051\u7463" + - "\u788E\u9396\u8870\u91D7\u4FEE\u53D7\u53DF\u56DA\u55FD\u5782\u58FD\u5AC2\u5B88\uF85C\u5CAB\u5E25" + - "\u620D\u6101\u624B\u6388\u641C\u6536\u6578\u666C\u6A39\u6B8A\u71E7\u6C34\u6D19\u6EB2\u6F31\u72E9" + - "\u7378\u795F\u7626\u7761\uF85D\u79C0\u7A57\u7AEA\u7CB9\u7D8F\u7DAC\u7E61\u7F9E\u8129\u8331\u8490" + - "\u84DA\u85EA\u8896\u8AB0\u8F38\u9042\u9083\u916C\u9296\u92B9\u968B\u96A8\u96D6\u9700\u9808\u9996" + - "\u9AD3\u9B1A\u53D4\u587E\u5919\u5B70\u5BBF\u6DD1\u719F\u8085\u83FD\u5FAA\u6042\u65EC\u696F\u6B89" + - "\u6D35\u6DF3\u73E3\u76FE\u77AC\u7B4D\u7D14\u8123\u821C\u8340\u8A62\u5DE1\u9187\u931E\u9806\u99B4" + - "\u9D89\u620C\u8853\u8FF0\u5D07\u5D27\u5D69\u745F\u819D\u8671\u8768\u62FE\u6FD5\u7FD2\u8936\u8972" + - "\u4E1E\u4E58\u50E7\u5347\u627F\u6607\u52DD\u7E69\u8805\u965E\u4F8D\u5319\u557B\u5636\u59CB\u5AA4" + - "\uF85E\u5C38\u5C4D\u5E02\u5F11\u6043\u65BD\u662F\u6642\u67BE\u67F4\u731C\u77E2\u793A\u8996\u7DE6" + - "\u7FC5\u8494\u84CD\u8A69\u8A66\u8AE1\u8C7A\u57F4\u5BD4\u5F0F\u606F\u62ED\u690D\u6B96\u6E5C\u7184" + - "\u8B58\u8EFE\u98DF\u98FE\u4F38\u4FE1\u547B\u5A20\u5BB8\u613C\u65B0\u6668\u71FC\u7533\u77E7\u795E" + - "\u7D33\uFFFF\u0042\uFFFD\u814E\u81E3\u8398\u85AA\u8703\u8A0A\u8EAB\u8F9B\uF971\u8FC5\u5931\u5BA4" + - "\u5BE6\u6089\uF85F\u5BE9\u5C0B\u5FC3\uF972\u6C81\u6DF1\u700B\u751A\u82AF\u4EC0\u5341\uF973\u96D9" + - "\u6C0F\u4E9E\u4FC4\u5152\u5A25\u5CE8\u6211\u7259\u82BD\u86FE\u8859\u8A1D\u963F\u96C5\u9913\u9D09" + - "\u9D5D\u580A\u5CB3\u5DBD\u6115\u60E1\u63E1\u6A02\u6E25\u843C\u984E\u9F77\u5B89\u5CB8\u6309\u664F" + - "\u6848\u773C\u96C1\u8D0B\u978D\u9854\u9D08\u621E\u65A1\u8B01\u8ECB\u904F\u95BC\u5D52\u5DD6\u5EB5" + - "\u6697\u764C\u83F4\u8AF3\u95C7\u9EEF\u58D3\u62BC\u72CE\u9D28\u4EF0\u592E\u600F\u663B\u6B83\u79E7" + - "\u9785\u9D26\u5393\u57C3\u5D16\u611B\u6B38\u6DAF\u769A\u66D6\u788D\u7919\u827E\u54C0\u9698\u9744" + - "\u9749\u5384\u6396\u6DB2\u814B\u9628\u984D\u6AFB\u7F4C\u9DAF\u9E1A\u4E5F\u503B\u51B6\u591C\uF860" + - "\u63F6\u6930\u723A\u8036\uF974\u60F9\u91CE\u5F31\u7BDB\u7C65\u7D04\u82E5\u846F\u85E5\u8E8D\u4F6F" + - "\u58E4\u5B43\u6059\u63DA\u6518\u656D\u6698\u694A\u6A23\u6D0B\u7001\u716C\u7A70\u75D2\u760D\u7F8A" + - "\u7F98\u8944\u8B93\u91C0\u967D\u990A\u5704\u5FA1\u6554\u65BC\u6F01\u79A6\u8A9E\u99AD\u9B5A\u9F6C" + - "\u5104\u61B6\u6291\u6A8D\u81C6\u5043\u5830\u5F66\u7109\u8A00\u8AFA\u5B7C\u513C\u56B4\u5944\u63A9" + - "\u6DF9\u5DAA\uFFFF\u0042\uFFFD\u696D\u605A\u4E88\u4F59\u5982\u6B5F\u6C5D\u8207\u9918\u4EA6\u57DF" + - "\uF861\u5F79\u6613\u75AB\u7E79\u8B6F\u9006\u9A5B\u56A5\u5827\u59F8\u5A1F\u5BB4\u5EF6\u6350\uF991" + - "\u693D\u6CBF\u6D93\u6D8E\u6DF5\u6F14\u70DF\u7136\u7159\u71C3\u71D5\u784F\u786F\u7B75\u7DE3\uF862" + - "\u81D9\u8815\u884D\u8B8C\u8EDF\u925B\u9CF6\uF99E\u6085\u6D85\u71B1\uF9A1\u95B1\u53AD\u5869\u67D3" + - "\u708E\u7130\u9E7D\u82D2\u8276\u95BB\u995C\u9AE5\u66C4\u71C1\u8449\u584B\u5B30\u5F71\u6620\u668E" + - "\u6979\u69AE\u6C38\u6CF3\u6F41\u701B\u71DF\u745B\uF9AE\u74D4\u76C8\u7E93\u82F1\u8A60\u8FCE\u502A" + - "\u5208\u53E1\u66F3\u6FCA\u730A\u7768\u777F\u7FF3\u82AE\u854B\u85DD\u8602\u88D4\u8A63\u8B7D\u8C6B" + - "\u92B3\u9713\u9810\u4E94\u4F0D\u50B2\u5348\u5433\u55DA\u58BA\u5967\u5A1B\u5BE4\u609F\uF9B9\u65FF" + - "\u6664\u68A7\u6C5A\u70CF\u7352\u8708\u8AA4\u9068\u543E\u5C4B\u6C83\u7344\u7389\u923A\u5ABC\u6EAB" + - "\u7465\u761F\u7A69\u8580\u860A\u9C2E\u5140\u58C5\u74EE\u7670\u64C1\u7515\u7FC1\u9095\u96CD\u6E26" + - "\u74E6\u7AA9\u86D9\u8778\u8A1B\u81E5\u5A49\u5B8C\u5B9B\u6D63\u73A9\u742C\u7897\u7DE9\u7FEB\u8155" + - "\u839E\u8C4C\u962E\u9811\u66F0\u5F80\u65FA\u6789\u6C6A\u738B\u502D\u6B6A\u77EE\u5916\u5DCD\u7325" + - "\u754F\u50E5\u51F9\uFFFF\u0042\uFFFD\u582F\u592D\u5996\u59DA\u5DA2\u62D7\u6416\u64FE\u66DC\u8170" + - "\uF9BF\u6A48\u7464\u7A88\u7AAF\u7E47\u7E5E\u8000\u8558\u87EF\u8981\u8B20\u9059\u9080\u9952\u8FB1" + - "\u617E\u6B32\u6D74\u8925\u50AD\u52C7\u5BB9\u5EB8\u5197\u6995\u6E67\u6EB6\u7194\u7462\u7528\u8073" + - "\u8202\u8338\u84C9\u86F9\u8E0A\u9394\u93DE\u4F51\u5076\u512A\u53C8\u53CB\u53F3\u5401\u5B87\u5BD3" + - "\u5C24\u4E8E\u611A\u6182\u725B\u76C2\u7950\u7991\u79B9\u7FBD\u828B\u865E\u8FC2\u9047\u90F5\u9685" + - "\u96E8\u96E9\u65ED\u6631\u715C\u7A36\u90C1\u980A\u4E91\uF9C5\u6B9E\u8018\u82B8\u904B\u9695\u96F2" + - "\u97FB\u71A8\u851A\u9B31\u718A\u96C4\u5143\u539F\u54E1\u5712\u5713\u7230\u57A3\u5A9B\u5BC3\u6028" + - "\u613F\u63F4\u6E90\u733F\u7457\u82D1\u873F\u8881\u8F45\u9060\u9662\u9858\u9D1B\u6708\u8D8A\u925E" + - "\u4F4D\u5049\u50DE\u5371\u570D\u59D4\u5C09\u5E43\u6170\u5A01\u6E2D\u7232\u744B\u7DEF\u80C3\u840E" + - "\u8466\u875F\u885B\u885E\u8B02\u9055\u97CB\u9B4F\u4E73\u6538\u4F91\u5112\u516A\u5E7C\u552F\u55A9" + - "\u56FF\u5B7A\u5BA5\u5E37\u5E7D\u5EBE\u60A0\u60DF\u6109\u6108\u63C4\u6709\u67D4\u67DA\u6961\u6CB9" + - "\u6E38\u6FE1\u7336\u745C\u7531\u7652\u7DAD\u81FE\u8438\u8564\u88D5\u8A98\u8ADB\u8AED\u8E42\u8E30" + - "\u904A\u903E\u907A\u9149\uFFFF\u0042\uFFFD\u91C9\u936E\u9EDD\u6BD3\u8089\u80B2\u9B3B\u5141\u596B" + - "\u5C39\u6F64\u73A7\u80E4\u958F\u807F\u620E\u7D68\u878D\u57A0\u6069\u6147\u6ABC\u6BB7\u73E2\u9280" + - "\u8ABE\u96B1\u9F66\u4E59\u541F\u6DEB\u852D\u9670\u98EE\u97F3\u6339\u63D6\u6CE3\u9091\u51DD\u61C9" + - "\u81BA\u9DF9\u4F9D\u501A\u5100\u7591\u77E3\u5B9C\u610F\u61FF\u64EC\u6BC5\u7FA9\u8264\u87FB\u8863" + - "\u8ABC\u8B70\u91AB\u4E8C\u4EE5\u4F0A\u5937\u59E8\u5DF2\u8CB3\u5F1B\u5F5B\u6021\uF9E0\u682E\u723E" + - "\u73E5\u7570\u75CD\u79FB\u800C\u8033\u8351\u98F4\u990C\u9823\u7037\u7FFC\u76CA\u7FCA\u7FCC\u4EBA" + - "\u4EC1\u4EDE\u5203\u5370\u54BD\u56E0\u59FB\u5BC5\u5F15\u5FCD\u6E6E\u8A8D\u976D\u9777\u4E00\u4F7E" + - "\u58F9\u65E5\u6EA2\u9038\u93B0\u99B9\u4EFB\u58EC\u598A\u59D9\u7A14\u834F\u8CC3\u5165\u4ECD\u5B55" + - "\u5269\u4ED4\u523A\u54A8\u59C9\u59FF\u5B50\u5B5C\u5B57\u6063\u6148\u6ECB\u7099\u716E\u7386\u74F7" + - "\u75B5\u7725\u78C1\u7CA2\u7D2B\u8005\u8014\u81EA\u8517\u85C9\u89DC\u8AEE\u8CC7\u8D6D\u96CC\u4F5C" + - "\u52FA\u56BC\u65AB\u6628\u67DE\u707C\u70B8\u7235\u7DBD\u828D\u914C\u96C0\u9D72\u68E7\u6B98\u6F7A" + - "\u76DE\u5C91\u66AB\u6F5B\u6F5C\u7BB4\u7C2A\u8695\u8836\u96DC\u4E08\u4ED7\u5320\u5834\u58BB\u596C" + - "\u5D82\u5E33\u5E84\u5F35\u638C\uFFFF\u0042\uFFFD\u66B2\u6756\u6A1F\u6AA3\u6B0C\u6F3F\u58EF\u5C07" + - "\u7246\uF9FA\u7350\u748B\u7634\u7AE0\u7CA7\u8178\u81DF\u838A\u846C\u8523\u8594\u85CF\u88C5\u88DD" + - "\u8D13\u91AC\u9577\u969C\u518D\u54C9\u5728\u5BB0\u624D\u6750\u683D\u6893\u6ED3\u707D\u7E94\u88C1" + - "\u8CA1\u8F09\u9F4B\u9F4E\u722D\u7B8F\u8ACD\u931A\u4F4E\u4F47\u5132\u5480\u59D0\u5E95\u62B5\u6775" + - "\u67E2\u696E\u6A17\u6CAE\u6E1A\u72D9\u732A\u75BD\u7BB8\u82E7\u8457\u85F7\u86C6\u8A5B\u8C6C\u8CAF" + - "\u8E87\u9019\u90B8\u52E3\u5AE1\u5BC2\u6458\u6575\u6EF4\u72C4\u7684\u7A4D\u7B1B\u7C4D\u7CF4\u7E3E" + - "\u837B\u8B2B\u8CCA\u8D64\u8DE1\u8E5F\u8FEA\u8FF9\u9069\u50B3\u5168\u5178\u524D\u526A\u56C0\u5861" + - "\u5960\u5C08\u5C55\u5DD3\u5EDB\u609B\u6230\u6813\u6BBF\u6C08\u6FB1\u714E\u7530\u7538\u7672\u78DA" + - "\u7B8B\u7BAD\u7BC6\u7E8F\u7FE6\u8A6E\u8F3E\u8F49\u923F\u9293\u9322\u96FB\u985A\u986B\u991E\u5207" + - "\u622A\u6298\u6D59\u7A83\u7ACA\u7BC0\u7D76\u5360\u5CBE\u5E97\u6F38\u70B9\u9EDE\u7C98\u9711\u63A5" + - "\u647A\u6904\u8776\u4E01\u4E95\u4EAD\u505C\u5075\u5448\u59C3\u5E40\u5EF7\u5F81\u5B9A\u5EAD\u60C5" + - "\u633A\u653F\u6574\u65CC\u6676\u6678\u6883\u6968\u6B63\u6C40\u6DE8\u6E1F\u753A\u775B\u7887\u798E" + - "\u7A0B\u7A7D\u9756\u7CBE\u8247\u8A02\uFFFF\u0042\uFFFD\u8AEA\u8C9E\u912D\u914A\u91D8\u9266\u9320" + - "\u9706\u975C\u9802\u9F0E\u5236\u5291\u557C\u5824\u5E1D\u5F1F\u608C\u63D0\u6662\u68AF\u6FDF\u7445" + - "\u81CD\u796D\u7B2C\u85BA\u88FD\u8AF8\u8E36\u8E44\u918D\u9664\u969B\u973D\u984C\u9F4A\u4FCE\u51CB" + - "\u5146\u52A9\uF863\u5632\u566A\u5F14\u5F6B\u63AA\u64CD\u65E9\u6641\u66FA\u66F9\u671D\u689D\u68D7" + - "\u69FD\u6F15\u6F6E\u7167\u71E5\u722A\u7681\u773A\u7956\u795A\u79DF\u7A20\u7A95\u7AC8\u7B0A\u7C97" + - "\u7CDF\u7CF6\u7D44\u7D5B\u7E70\u8087\u85FB\u86A4\u8A54\u8ABF\u8D99\u8E81\u9020\u906D\u91E3\u963B" + - "\u9BDB\u9CE5\u65CF\u7C07\u8DB3\u93C3\u5B58\u5C0A\u5352\u62D9\u731D\u5027\u5B97\u5F9E\u616B\u68D5" + - "\u6A05\u6DD9\u742E\u7A2E\u7D42\u7D9C\u7E31\u816B\u8E35\u8E64\u937E\u9418\u4F50\u5750\u5DE6\u5EA7" + - "\u632B\u7F6A\u4E3B\u4F4F\u4F8F\u505A\u5EDA\u546A\u5468\u55FE\u594F\u5B99\u5DDE\u665D\u6731\u67F1" + - "\u682A\u70B7\u6CE8\u6D32\u9152\u73E0\u7587\u851F\u7C4C\u7D02\u7D2C\u7DA2\u8098\u80C4\u821F\u86DB" + - "\u8A3B\u8A85\u8D70\u8E8A\u8F33\u914E\u9031\u9444\u99D0\u7AF9\u7CA5\u4FCA\u5101\u51C6\u57C8\u5CFB" + - "\u6659\u6A3D\u6D5A\u6E96\u6FEC\u756F\u7AE3\u8822\u9021\u9075\u96BC\u99FF\u8301\u4E2D\u4EF2\u8846" + - "\u91CD\uF864\u537D\u6ADB\u696B\u6C41\u847A\uFFFF\u0042\uFFFD\u589E\u618E\u62EF\u70DD\u66FE\u7511" + - "\u75C7\u84B8\u8A3C\u8B49\u8D08\u4E4B\u53EA\u54AB\u5730\u5740\u5FD7\u6301\u6307\u646F\u652F\u65E8" + - "\u667A\u679D\u67B3\u6B62\u6C60\u6F2C\u75E3\u77E5\u7825\u7957\u7949\u7D19\u80A2\u8102\u81F3\u829D" + - "\u8718\u8A8C\uF9FC\u8D04\u8DBE\u9072\u76F4\u7A19\u7A37\u7E54\u8077\u8FB0\u55D4\u5875\u632F\u6649" + - "\u699B\u6D25\u6EB1\u73CD\u7468\u74A1\u75B9\u76E1\u771E\u778B\u79E6\u7E09\u8A3A\u8CD1\u8EEB\u9032" + - "\u93AD\u9663\u9673\u9707\u53F1\u7A92\u59EA\u5AC9\u5E19\u684E\u75BE\u79E9\u81A3\u86ED\u8CEA\u8DCC" + - "\u8FED\u659F\u6715\u57F7\u96C6\u7DDD\u8F2F\u5FB5\u61F2\u6F84\u4E14\u501F\u7B9A\u53C9\u55DF\u5DEE" + - "\u5D6F\u6B21\u6B64\u78CB\uF9FE\u8E49\u906E\u8ECA\u6349\u643E\u7740\u7A84\u932F\u947F\u9F6A\u64B0" + - "\u6FAF\u71E6\u74A8\u74DA\u7AC4\u7E82\u7CB2\u7E98\u8B9A\u8D0A\u947D\uF865\u9910\u994C\u5239\u5BDF" + - "\u64E6\u672D\u50ED\u53C3\u5879\u6158\u6159\u615A\u61FA\u65AC\u7AD9\u8B92\u5021\u5009\u5231\u5275" + - "\u5531\u5A3C\u5EE0\u5F70\u60B5\u655E\u660C\u6636\u66A2\u69CD\u6C05\u6EC4\u6F32\u7621\u7A93\u8139" + - "\u8259\u83D6\u84BC\u50B5\u57F0\u5F69\u63A1\u7826\u7DB5\u83DC\u8521\u91C7\u91F5\u518A\u67F5\u7B56" + - "\u7C00\u8CAC\u51C4\u59BB\u60BD\u8655\uF9FF\u5254\uFFFF\u0042\uFFFD\u5C3A\u617D\u621A\u62D3\u64F2" + - "\u65A5\u6ECC\u7620\u810A\u8734\u8E91\u965F\u96BB\u4EDF\u5343\u5598\u5929\u5DDD\u64C5\u6CC9\u6DFA" + - "\u6FFA\u7A7F\u821B\u85A6\u8CE4\u8E10\u9077\u91E7\u95E1\u9621\u97C6\u51F8\u5FB9\u54F2\u5586\u64A4" + - "\u6F88\u7DB4\u8F4D\u9435\u50C9\u5C16\u6CBE\u6DFB\u751B\u77BB\u7C37\u7C64\u8AC2\u59BE\u5E16\u6377" + - "\u7252\u758A\u776B\u8ADC\u8CBC\u8F12\u5EF3\u6674\u6DF8\u807D\u83C1\u873B\u8ACB\u9751\u9BD6\uFA00" + - "\u5243\u66FF\u6D95\u6EEF\u780C\u7DE0\u8AE6\u902E\u905E\u9746\u9AD4\u521D\u54E8\u5CED\u6194\u6284" + - "\u62DB\u68A2\u6912\u695A\u6A35\u7092\u7126\u785D\u7901\u790E\u79D2\u7A0D\u7D83\u8096\u8349\u8549" + - "\u8C82\u8D85\u9162\u918B\u91AE\u9214\u9798\u4FC3\u56D1\uF866\u71ED\u77D7\u8700\u89F8\u8E85\u9AD1" + - "\u5BF8\u5FD6\u6751\u53E2\u585A\u5BF5\u6031\u6460\u7E3D\u8070\u8471\u9283\u64AE\u50AC\u5D14\u6467" + - "\u6700\u589C\u62BD\u63A8\u690E\u6978\uF867\u6A1E\u6E6B\u7503\u76BA\u79CB\u7B92\u82BB\u8429\u8DA8" + - "\u8FFD\u9112\u914B\u919C\u9318\u9310\u96DB\u97A6\u9C0D\u9E81\u9EA4\u4E11\uF868\u795D\u755C\u7AFA" + - "\u7B51\u7BC9\u7E2E\u8233\u84C4\u8E74\u8EF8\u9010\u6625\u693F\u51FA\u9EDC\u5145\u51B2\u5FE0\u6C96" + - "\u87F2\u885D\u8877\u60B4\u81B5\u8403\u53D6\u5439\u5634\uFFFF\u0042\uFFFD\u5A36\u5C31\u6A47\u708A" + - "\u7FE0\u805A\u8106\u81ED\uF869\u8DA3\u9189\u9A5F\u9DF2\u4EC4\u5074\u60FB\u6E2C\u5C64\u4F88\u5024" + - "\u55E4\u5CD9\u5DF5\u5E5F\u5FB4\u6894\u6CBB\u6DC4\u71BE\u75D4\u75F4\u7661\u96C9\u7A1A\u7DC7\u7DFB" + - "\u7F6E\u6065\u81F4\u8F1C\u99B3\u9D44\u9F52\u5247\u52C5\u98ED\u89AA\u4E03\u67D2\u6F06\u4FB5\u5BE2" + - "\u5FF1\u6795\u6C88\u6D78\u7827\u91DD\u937C\u87C4\u79E4\u7A31\u5FEB\u4ED6\u553E\u58AE\u59A5\u60F0" + - "\u6253\u6736\u6955\u8235\u9640\u99DD\u502C\u5353\u5544\uFA01\u6258\u62C6\uFA02\u64E2\u67DD\u6A50" + - "\u6FC1\u6FEF\u7422\u8A17\u9438\u5451\u5606\u5766\u5F48\u619A\u6B4E\u7058\u70AD\u7DBB\u8A95\u596A" + - "\u812B\u63A2\u803D\u8CAA\u5854\u642D\u69BB\u5B95\u5E11\u6E6F\u8569\u514C\u53F0\u592A\u6020\u614B" + - "\u6B86\u6C70\u6CF0\u7B1E\u80CE\u82D4\u8DC6\u90B0\u98B1\u99C4\uFA04\u64C7\u6FA4\uF86A\u6491\u6504" + - "\u514E\u5410\u571F\u8A0E\u615F\u6876\uFA05\u75DB\u7B52\u7D71\u901A\u5806\u817F\u892A\u9000\u9839" + - "\u5078\u5957\u59AC\u6295\u900F\u9B2A\u615D\u7279\u5A46\u5761\u5DF4\u628A\u64AD\u6777\u6CE2\u6D3E" + - "\u722C\u7436\u7834\u7F77\u82AD\u8DDB\u9817\u5742\u5224\u677F\u7248\u8CA9\u8FA6\u74E3\u962A\u516B" + - "\u53ED\u634C\u4F69\u5504\u6096\u6C9B\u6D7F\u724C\u72FD\u7A17\uFFFF\u0042\uFFFD\u8C9D\u6557\u8987" + - "\u5F6D\u6F8E\u70F9\u81A8\u610E\u4FBF\u504F\u6241\u7247\u7BC7\u7DE8\u7FE9\u8759\u904D\u97AD\u8CB6" + - "\u576A\u5E73\u840D\u8A55\u5420\u5B16\u5E63\u5EE2\u5F0A\u6583\u80BA\u853D\u9589\u965B\u4F48\u5305" + - "\u530D\u530F\u5486\u54FA\u5703\u5E96\u5E03\u6016\u62B1\u629B\u6355\u6CE1\u6D66\u70AE\u75B1\u7832" + - "\u80DE\u812F\u8216\u8461\u84B2\u888D\u8912\u924B\u92EA\u9784\u98FD\u9B91\u5E45\u66B4\u7011\u7206" + - "\u4FF5\u527D\u5F6A\u6153\u6753\u6A19\u6F02\u74E2\u7968\u8868\u8C79\u98C4\uF86B\u54C1\u7A1F\u99AE" + - "\u6953\u8AF7\u8C4A\u98A8\u5F7C\u62AB\u75B2\u76AE\u84D6\u88AB\u907F\u5339\u5F3C\u5FC5\u6CCC\u7562" + - "\u758B\u7B46\u8E55\u4E4F\u903C\u4E0B\u4F55\u590F\u5EC8\u6630\u6CB3\u7455\u8766\u8377\u8CC0\u9050" + - "\u971E\u9C15\u58D1\u5B78\u7627\u8650\u8B14\u9DB4\u5BD2\u6068\u608D\u65F1\u6C57\u6F22\u6FA3\u7F55" + - "\u7FF0\uF86C\u9592\u9591\u9650\u97D3\u9DF3\u5272\u8F44\u51FD\u542B\u54B8\u5563\u558A\u6ABB\u6DB5" + - "\u7DD8\u8266\u9677\u5408\u54C8\u76D2\u86E4\u95A4\u965C\u4EA2\u4F09\u59EE\u5DF7\u6052\u6297\u676D" + - "\u6841\u6C86\u6E2F\u7095\u7F38\u809B\u822A\uFA09\u9805\u4EA5\u5055\u54B3\u595A\u5793\u5B69\u5BB3" + - "\u5EE8\u61C8\u6977\u6D77\u87F9\u89E3\u8A72\u8AE7\u9082\u99ED\u9AB8\uFFFF\u0042\uFFFD\u52BE\u6838" + - "\u5016\u5E78\u674F\u884C\u4EAB\u5411\u56AE\u9115\u73E6\u97FF\u9909\u9957\u9999\u5653\u589F\u865B" + - "\u8A31\u61B2\u8ED2\u737B\u6B47\u96AA\u9A57\u5955\u7200\u8D6B\u9769\u5CF4\u5F26\u61F8\u70AB\u73FE" + - "\u7384\u7729\u7D43\u7D62\u7E23\u8237\u8852\uFA0A\u8CE2\u9249\u986F\u5B51\u7A74\u8840\u9801\u5ACC" + - "\uF86D\u4FE0\u5354\u593E\u5CFD\u633E\u6D79\u72F9\u7BCB\u8107\u8105\u83A2\uF86E\u92CF\u9830\u4EA8" + - "\u5211\u578B\u5F62\u5144\u7005\u70AF\u73E9\u834A\u87A2\u8861\u90A2\u93A3\u99A8\u516E\u5F57\u60E0" + - "\u6167\u8559\u91AF\u978B\u4E4E\u4E92\u8C6A\u547C\u58FA\u58D5\u597D\u5F27\u660A\u6236\u6BEB\u6D69" + - "\u6DCF\u6E56\u6EF8\u6F94\u6FE9\u6FE0\u705D\u72D0\u745A\u74E0\u7693\u769E\u795C\u7CCA\u7E1E\u80E1" + - "\u846B\u864E\u865F\u8774\u8B77\u6248\u9190\u93AC\u9800\u9865\u60D1\u6216\u9177\u5A5A\u660F\u6DF7" + - "\u6E3E\u743F\u9B42\u5FFD\u60DA\u7B0F\u9DBB\u5F18\u54C4\u6C5E\u6CD3\u6D2A\u9D3B\u7D05\u8679\u8A0C" + - "\u5316\u5B05\u6A3A\u706B\u798D\u7575\u79BE\u548C\u82B1\u83EF\u8A71\u9774\u8CA8\uFA0B\u64F4\u652B" + - "\u78BA\u78BB\u7A6B\u944A\u4E38\u559A\u571C\u5BA6\u5E7B\u60A3\u61FD\u63DB\u6853\u6B61\u6E19\u7165" + - "\u74B0\u7D08\u9084\u9A69\u9C25\u9B1F\u6D3B\u6ED1\u733E\u8C41\u95CA\u51F0\uFFFF\u0042\uFFFD\u5A93" + - "\u5FA8\u6033\u604D\u614C\u60F6\u6643\u6CC1\u6EC9\u714C\u7687\u7BC1\u8352\u8757\u9051\u968D\u9EC3" + - "\u56DE\u5EFB\u5F8A\u6062\u6094\u61F7\u6666\u6703\u6A9C\u6DEE\u6FAE\u7070\u736A\u7E6A\u81BE\u86D4" + - "\u8AA8\u8CC4\u5283\u7372\u6A6B\u54EE\u5686\u56C2\u5B5D\u6548\u66C9\u689F\u723B\u80B4\u9175\u4FAF" + - "\u5019\u539A\u540E\u543C\u5589\u55C5\u5F8C\u673D\u7334\u9005\u7BCC\u52F3\u5864\u58CE\u6688\u7104" + - "\u718F\u71FB\u85B0\u8A13\u85A8\u55A7\u8431\u5349\u5599\u6BC1\u5F59\u5FBD\u63EE\u6689\u7147\u8AF1" + - "\u8F1D\u9EBE\u4F11\u643A\u70CB\u7566\u8667\u6064\u8B4E\u9DF8\u51F6\u5308\u5147\u6D36\u80F8\u9ED1" + - "\u5FFB\u6615\u6B23\u75D5\u5403\u5C79\u7D07\u8FC4\u6B20\u6B46\u6B3D\u5438\u6070\u6D3D\u8208\u50D6" + - "\u559C\u566B\u59EC\u5B09\u5E0C\u66E6\u6199\u6231\u72A7\u7199\u51DE\u71B9\u79A7\u7A00\u7FB2\u8A70" + - "\u9821\uFFFF\u007E\uFFFD\u67B7\u73C2\u75C2\u6164\u4F83\u67EC\u687F\u78F5\u874E\u6221\u77B0\u90AF" + - "\u9452\u5808\u757A\u7D73\u7F8C\u8221\u9C47\u584F\uF900\u93A7\u5580\u5028\u795B\u8E1E\u9245\u6957" + - "\u8171\u6840\u5292\u9210\u8FF2\u8188\u6289\u9257\u4FD3\u501E\u5106\u5770\u61AC\u70F1\u74A5\u583A" + - "\u68E8\u5C3B\u66A0\u69C1\u7F94\u82FD\u83F0\u7428\u9BE4\u73D9\u86A3\u978F\u4E32\u8DE8\u934B\u742F" + - "\u4F8A\u709A\u5775\u8009\u92B6\u97AB\u88D9\u828E\u6372\u6DC3\u7357\u8568\uF906\u6677\u69FB\u7AC5" + - "\u52FB\u7547\u52A4\u5997\u6611\u82A9\u4F0B\u57FC\u7398\u7482\u7941\u7F88\u9324\uF90B\uF90C\u5A1C" + - "\uFFFE\u0015\uF90D\u678F\u6960\u6E73\uFFFE\u0006\uF922\u8872\uFFFE\u0007\uF928\u649A\u5BD7\uFFFE" + - "\n\uF92F\u99D1\uFFFE\u0019\uF939\u677B\uFFFE\b\uF952\u4EB6\u5F56\u6FBE\u574D\u61BA\u6E5B" + - "\u8541\u931F\u7553\u6207\u87B3\u576E\u5D8B\uFFFF\u0042\uFFFD\u6389\u6AC2\u89A9\u65FD\u711E\u9017" + - "\u829A\u5D9D\uF95B\uF95D\uF95E\u5D0D\u5FA0\u5137\u7489\uF95F\u5CBA\u7B2D\u8046\u6FA7\uF960\u64C4" + - "\u6F5E\u797F\u83C9\u7028\u8CDA\u9B27\u5A41\u763B\u851E\u93E4\u65D2\u700F\u4F96\u51DC\u550E\u6D6C" + - "\uF962\u7FB8\u8389\u88E1\u6F7E\u78BC\u9088\u4E07\u534D\u551C\u8309\u8F1E\u6C94\u6927\u7791\u84C2" + - "\u6479\u7441\u82BC\u9DA9\u7AD7\u61AE\u6959\u73F7\u5011\u96EF\u6C95\u68B6\u6963\u6E44\u9EF4\u5CB7" + - "\u7DE1\u7622\u76FC\u78D0\u6E24\u678B\u6EC2\u78C5\u7119\u5E61\u71D4\u6A97\u8617\u68C5\u9A08\u73E4" + - "\u83E9\u8F39\u71A2\u4E0D\u4FEF\u5490\u5B5A\u8240\u83A9\u5429\u6610\u8CC1\u5F7F\u6787\u6BD6\u6BD7" + - "\u79D5\u7C83\u56AC\u6D5C\u73AD\u4FDF\u67F6\u9E9D\u9730\u715E\u9212\u5CE0\u55C7\u637F\u7B6E\u5B0B" + - "\u657E\u6E32\u7401\u9425\u994D\u6CC4\u893B\u9F67\u5261\u965D\u5BAC\u73F9\u7619\u7BE0\u6D91\u8B16" + - "\u8D16\u5DFD\u84C0\u98E1\u609A\u6DDE\u5CC0\u7407\u74B2\u8B90\u96A7\u6F5A\u7421\u74B9\u5F87\u6812" + - "\u6A53\u84F4\u8563\u8AC4\u9265\u5C4E\u8C55\u7BD2\u8755\u4F81\u85CE\u8AF6\u555E\u83AA\u5E44\u9102" + - "\u9354\u9C10\u9B9F\u5535\u5CA9\u627C\u7E0A\uF975\uF976\u84BB\uFFFE\u0004\uF977\u79B3\uFFFE\u0004" + - "\uF97B\u7600\u8616\u4FFA\u5186\uF97F\uFFFF\u0042\uFFFD\uFFFE\u0005\uF980\u74B5\u7916\uF985\u8245" + - "\u8339\u8F3F\u8F5D\uFFFE\u000B\uF986\u633B\u6C87\uFFFE\u0005\uF992\u7E2F\uFFFE\u0007\uF997\uF99F" + - "\uF9A0\uFFFE\u0004\uF9A2\u7430\uFFFE\u0006\uF9A6\u5DB8\uF9AC\u6E36\u6FDA\u702F\u7150\u7370\uF9AD" + - "\u7A4E\uF9AF\uF9B0\uF9B1\u9348\uF9B2\u9719\uF9B3\uF9B4\u4E42\uF9B5\u6C6D\u7A62\uF9B6\uF9B7\uF9B8" + - "\u4FC9\u5862\u61CA\u6556\u6FB3\u71AC\u7B7D\u9C32\u9F07\u7E15\u9954\u7AAA\u68A1\u6900\u7413\u8118" + - "\u5A03\u5D6C\uF9BA\uF9BB\u5BE5\uF9BC\uF9BD\u6493\uF9BE\uF9C0\u71FF\uF9C1\uF9C2\uF9C3\u7E1F\u4FD1" + - "\u57C7\u5889\u6142\u6D8C\u752C\uF9C4\u65F4\u7397\u7440\u7D06\u85D5\u91EA\u52D6\u5F67\u682F\u6A52" + - "\u6F90\u7189\u8553\u4E90\u5AC4\u6C85\u6D39\u6E72\uF9C6\u6690\u853F\u8918\uF9C7\uF9C8\uF9C9\u6962" + - "\u6D27\uF9CA\uF9CB\u7337\uFFFE\u0006\uF9CC\u5809\uFFFE\u0005\uF9D2\u8D07\uF9D7\u9217\uFFFE\u0004" + - "\uF9D8\u701C\uF9DC\u6905\u858F\u0000\u0004\uF9DD\uDEDF\uE1E2\uE3E4\uE5E6\u8084\u82E1\uF9E7\uF9E8" + - "\u8CBD\u9087\uFFFE\u0004\uF9E9\u8B1A\uF9ED\uF9EE\uF9EF\u7D6A\uFFFF\u0042\uFFFD\u8335\uF9F0\u8693" + - "\uF9F1\uF9F2\uF9F3\u4F5A\u6041\uF9F4\uF9F5\uF9F6\u5344\uF9F7\uF9F8\uF9F9\u82BF\u8328\u5B71\u81E7" + - "\u6E3D\u7E21\u7D35\u83F9\u96CE\u9F5F\u540A\uF9FB\u7FDF\u93D1\u4F43\u4F7A\u587C\u7420\u7551\u7B4C" + - "\u942B\u7664\u9B8E\u67FE\u6A89\u6DC0\u6E5E\u701E\u70A1\u738E\u73FD\u7D8E\u92CC\u74AA\u96D5\u60B0" + - "\u8E2A\u59DD\u6E4A\u6F8D\u5BEF\u710C\u96CB\u7E52\u6C9A\u82B7\u5507\u6422\u664B\u686D\u6B84\u755B" + - "\u7E1D\u81FB\u852F\u8897\u4F84\u74C6\uF9FD\u6F57\u93F6\u4F98\u7C12\u7D2E\u8B96\u6134\u7316\u5BC0" + - "\u5BE8\u501C\u8E60\u7394\u8F1F\u7C3D\u8A79\u581E\u527F\u8278\u82D5\u90A8\u60A4\u6181\u8525\u8ACF" + - "\u939A\u9A36\u8E59\u7443\u672E\u8D05\u53A0\u7A49\u86A9\u741B\u54A4\u62D6\u99B1\u577C\u666B\u7438" + - "\u7708\uFA03\u69CC\u95D6\u64FA\u9211\u9A19\u67B0\uFA06\u82DE\u900B\u66DD\uFA07\u98C7\u9A43\u9642" + - "\u73CC\u82FE\u999D\u53A6\u701A\u929C\u9E79\u95D4\u5AE6\uFA08\u7023\u8347\u6AF6\u4FD4\u774D\u6CEB" + - "\u73B9\u665B\u6CC2\u6ECE\u7050\u7192\u7469\u9008\u66B3\u8E4A\u5CB5\u6667\u7425\u82A6\u84BF\u70D8" + - "\u8B41\u5950\u6665\u5E4C\u6130\u6644\u69A5\u6E5F\u6F62\u749C\u7C27\u532F\u8334\u5B96\u9404\u6585" + - "\u6D8D\u6DC6\u9A4D\u5E3F\u7166\u73DD\u52DB\u6684\u714A\u7098\u8A16\uFFFF\u0042\uFFFD\u7FD5\u56CD" + - "\u6198\u665E\u71BA\uFFFF\u17FB\uFFFD\u3164\uFFFD\uFFFD\u3133\uFFFD\u3135\u3136\uFFFD\uFFFD\uFFFE" + - "\u0007\u313A\uFFFD\uFFFD\uFFFD\u3144\uFFFF\f\uFFFD\u314F\uFFFF\u001F\uFFFD\u3150\uFFFF\u001F" + - "\uFFFD\u3151\uFFFF\u001F\uFFFD\u3152\uFFFF\u001F\uFFFD\u3153\uFFFF\u005F\uFFFD\u3154\uFFFF\u001F" + - "\uFFFD\u3155\uFFFF\u001F\uFFFD\u3156\uFFFF\u001F\uFFFD\u3157\uFFFF\u001F\uFFFD\u3158\uFFFF\u001F" + - "\uFFFD\u3159\uFFFF\u005F\uFFFD\u315A\uFFFF\u001F\uFFFD\u315B\uFFFF\u001F\uFFFD\u315C\uFFFF\u001F" + - "\uFFFD\u315D\uFFFF\u001F\uFFFD\u315E\uFFFF\u001F\uFFFD\u315F\uFFFF\u005F\uFFFD\u3160\uFFFF\u001F" + - "\uFFFD\u3161\uFFFF\u001F\uFFFD\u3162\uFFFF\u001F\uFFFD\u3163\uFFFF\u009F\uFFFD\u3131\uFFFF\u001F" + - "\uFFFD\uFFFE\u0011\uAC00\uFFFD\uFFFE\u000B\uAC11\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uAC1C\uFFFD\uFFFE" + - "\u000B\uAC2D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uAC38\uFFFD\uFFFE\u000B\uAC49\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uAC54\uFFFD\uFFFE\u000B\uAC65\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uAC70\uFFFD\uFFFE\u000B\uAC81" + - "\uFFFF\u0043\uFFFD\uFFFE\u0011\uAC8C\uFFFD\uFFFE\u000B\uAC9D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uACA8" + - "\uFFFD\uFFFE\u000B\uACB9\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uACC4\uFFFD\uFFFE\u000B\uACD5\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uACE0\uFFFD\uFFFE\u000B\uACF1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uACFC\uFFFD\uFFFE" + - "\u000B\uAD0D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uAD18\uFFFD\uFFFE\u000B\uAD29\uFFFF\u0043\uFFFD\uFFFE" + - "\u0011\uAD34\uFFFD\uFFFE\u000B\uAD45\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uAD50\uFFFD\uFFFE\u000B\uAD61" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uAD6C\uFFFD\uFFFE\u000B\uAD7D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uAD88" + - "\uFFFD\uFFFE\u000B\uAD99\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uADA4\uFFFD\uFFFE\u000B\uADB5\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uADC0\uFFFD\uFFFE\u000B\uADD1\uFFFF\u0043\uFFFD\uFFFE\u0011\uADDC\uFFFD\uFFFE" + - "\u000B\uADED\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uADF8\uFFFD\uFFFE\u000B\uAE09\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uAE14\uFFFD\uFFFE\u000B\uAE25\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uAE30\uFFFD\uFFFE\u000B\uAE41" + - "\uFFFF\u0083\uFFFD\u3132\uFFFF\u001F\uFFFD\uFFFE\u0011\uAE4C\uFFFD\uFFFE\u000B\uAE5D\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uAE68\uFFFD\uFFFE\u000B\uAE79\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uAE84\uFFFD\uFFFE" + - "\u000B\uAE95\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uAEA0\uFFFD\uFFFE\u000B\uAEB1\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uAEBC\uFFFD\uFFFE\u000B\uAECD\uFFFF\u0043\uFFFD\uFFFE\u0011\uAED8\uFFFD\uFFFE\u000B\uAEE9" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uAEF4\uFFFD\uFFFE\u000B\uAF05\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uAF10" + - "\uFFFD\uFFFE\u000B\uAF21\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uAF2C\uFFFD\uFFFE\u000B\uAF3D\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uAF48\uFFFD\uFFFE\u000B\uAF59\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uAF64\uFFFD\uFFFE" + - "\u000B\uAF75\uFFFF\u0043\uFFFD\uFFFE\u0011\uAF80\uFFFD\uFFFE\u000B\uAF91\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uAF9C\uFFFD\uFFFE\u000B\uAFAD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uAFB8\uFFFD\uFFFE\u000B\uAFC9" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uAFD4\uFFFD\uFFFE\u000B\uAFE5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uAFF0" + - "\uFFFD\uFFFE\u000B\uB001\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB00C\uFFFD\uFFFE\u000B\uB01D\uFFFF\u0043" + - "\uFFFD\uFFFE\u0011\uB028\uFFFD\uFFFE\u000B\uB039\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB044\uFFFD\uFFFE" + - "\u000B\uB055\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB060\uFFFD\uFFFE\u000B\uB071\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uB07C\uFFFD\uFFFE\u000B\uB08D\uFFFF\u0083\uFFFD\u3134\uFFFF\u001F\uFFFD\uFFFE\u0011\uB098" + - "\uFFFD\uFFFE\u000B\uB0A9\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB0B4\uFFFD\uFFFE\u000B\uB0C5\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uB0D0\uFFFD\uFFFE\u000B\uB0E1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB0EC\uFFFD\uFFFE" + - "\u000B\uB0FD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB108\uFFFD\uFFFE\u000B\uB119\uFFFF\u0043\uFFFD\uFFFE" + - "\u0011\uB124\uFFFD\uFFFE\u000B\uB135\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB140\uFFFD\uFFFE\u000B\uB151" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB15C\uFFFD\uFFFE\u000B\uB16D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB178" + - "\uFFFD\uFFFE\u000B\uB189\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB194\uFFFD\uFFFE\u000B\uB1A5\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uB1B0\uFFFD\uFFFE\u000B\uB1C1\uFFFF\u0043\uFFFD\uFFFE\u0011\uB1CC\uFFFD\uFFFE" + - "\u000B\uB1DD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB1E8\uFFFD\uFFFE\u000B\uB1F9\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uB204\uFFFD\uFFFE\u000B\uB215\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB220\uFFFD\uFFFE\u000B\uB231" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB23C\uFFFD\uFFFE\u000B\uB24D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB258" + - "\uFFFD\uFFFE\u000B\uB269\uFFFF\u0043\uFFFD\uFFFE\u0011\uB274\uFFFD\uFFFE\u000B\uB285\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uB290\uFFFD\uFFFE\u000B\uB2A1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB2AC\uFFFD\uFFFE" + - "\u000B\uB2BD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB2C8\uFFFD\uFFFE\u000B\uB2D9\uFFFF\u0083\uFFFD\u3137" + - "\uFFFF\u001F\uFFFD\uFFFE\u0011\uB2E4\uFFFD\uFFFE\u000B\uB2F5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB300" + - "\uFFFD\uFFFE\u000B\uB311\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB31C\uFFFD\uFFFE\u000B\uB32D\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uB338\uFFFD\uFFFE\u000B\uB349\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB354\uFFFD\uFFFE" + - "\u000B\uB365\uFFFF\u0043\uFFFD\uFFFE\u0011\uB370\uFFFD\uFFFE\u000B\uB381\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uB38C\uFFFD\uFFFE\u000B\uB39D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB3A8\uFFFD\uFFFE\u000B\uB3B9" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB3C4\uFFFD\uFFFE\u000B\uB3D5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB3E0" + - "\uFFFD\uFFFE\u000B\uB3F1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB3FC\uFFFD\uFFFE\u000B\uB40D\uFFFF\u0043" + - "\uFFFD\uFFFE\u0011\uB418\uFFFD\uFFFE\u000B\uB429\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB434\uFFFD\uFFFE" + - "\u000B\uB445\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB450\uFFFD\uFFFE\u000B\uB461\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uB46C\uFFFD\uFFFE\u000B\uB47D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB488\uFFFD\uFFFE\u000B\uB499" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB4A4\uFFFD\uFFFE\u000B\uB4B5\uFFFF\u0043\uFFFD\uFFFE\u0011\uB4C0" + - "\uFFFD\uFFFE\u000B\uB4D1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB4DC\uFFFD\uFFFE\u000B\uB4ED\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uB4F8\uFFFD\uFFFE\u000B\uB509\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB514\uFFFD\uFFFE" + - "\u000B\uB525\uFFFF\u0083\uFFFD\u3138\uFFFF\u001F\uFFFD\uFFFE\u0011\uB530\uFFFD\uFFFE\u000B\uB541" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB54C\uFFFD\uFFFE\u000B\uB55D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB568" + - "\uFFFD\uFFFE\u000B\uB579\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB584\uFFFD\uFFFE\u000B\uB595\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uB5A0\uFFFD\uFFFE\u000B\uB5B1\uFFFF\u0043\uFFFD\uFFFE\u0011\uB5BC\uFFFD\uFFFE" + - "\u000B\uB5CD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB5D8\uFFFD\uFFFE\u000B\uB5E9\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uB5F4\uFFFD\uFFFE\u000B\uB605\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB610\uFFFD\uFFFE\u000B\uB621" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB62C\uFFFD\uFFFE\u000B\uB63D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB648" + - "\uFFFD\uFFFE\u000B\uB659\uFFFF\u0043\uFFFD\uFFFE\u0011\uB664\uFFFD\uFFFE\u000B\uB675\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uB680\uFFFD\uFFFE\u000B\uB691\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB69C\uFFFD\uFFFE" + - "\u000B\uB6AD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB6B8\uFFFD\uFFFE\u000B\uB6C9\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uB6D4\uFFFD\uFFFE\u000B\uB6E5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB6F0\uFFFD\uFFFE\u000B\uB701" + - "\uFFFF\u0043\uFFFD\uFFFE\u0011\uB70C\uFFFD\uFFFE\u000B\uB71D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB728" + - "\uFFFD\uFFFE\u000B\uB739\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB744\uFFFD\uFFFE\u000B\uB755\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uB760\uFFFD\uFFFE\u000B\uB771\uFFFF\u0083\uFFFD\u3139\uFFFF\u001F\uFFFD\uFFFE" + - "\u0011\uB77C\uFFFD\uFFFE\u000B\uB78D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB798\uFFFD\uFFFE\u000B\uB7A9" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB7B4\uFFFD\uFFFE\u000B\uB7C5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB7D0" + - "\uFFFD\uFFFE\u000B\uB7E1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB7EC\uFFFD\uFFFE\u000B\uB7FD\uFFFF\u0043" + - "\uFFFD\uFFFE\u0011\uB808\uFFFD\uFFFE\u000B\uB819\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB824\uFFFD\uFFFE" + - "\u000B\uB835\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB840\uFFFD\uFFFE\u000B\uB851\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uB85C\uFFFD\uFFFE\u000B\uB86D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB878\uFFFD\uFFFE\u000B\uB889" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB894\uFFFD\uFFFE\u000B\uB8A5\uFFFF\u0043\uFFFD\uFFFE\u0011\uB8B0" + - "\uFFFD\uFFFE\u000B\uB8C1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB8CC\uFFFD\uFFFE\u000B\uB8DD\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uB8E8\uFFFD\uFFFE\u000B\uB8F9\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB904\uFFFD\uFFFE" + - "\u000B\uB915\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB920\uFFFD\uFFFE\u000B\uB931\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uB93C\uFFFD\uFFFE\u000B\uB94D\uFFFF\u0043\uFFFD\uFFFE\u0011\uB958\uFFFD\uFFFE\u000B\uB969" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB974\uFFFD\uFFFE\u000B\uB985\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB990" + - "\uFFFD\uFFFE\u000B\uB9A1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uB9AC\uFFFD\uFFFE\u000B\uB9BD\uFFFF\u0083" + - "\uFFFD\u3141\uFFFF\u001F\uFFFD\uFFFE\u0011\uB9C8\uFFFD\uFFFE\u000B\uB9D9\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uB9E4\uFFFD\uFFFE\u000B\uB9F5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBA00\uFFFD\uFFFE\u000B\uBA11" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBA1C\uFFFD\uFFFE\u000B\uBA2D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBA38" + - "\uFFFD\uFFFE\u000B\uBA49\uFFFF\u0043\uFFFD\uFFFE\u0011\uBA54\uFFFD\uFFFE\u000B\uBA65\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uBA70\uFFFD\uFFFE\u000B\uBA81\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBA8C\uFFFD\uFFFE" + - "\u000B\uBA9D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBAA8\uFFFD\uFFFE\u000B\uBAB9\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uBAC4\uFFFD\uFFFE\u000B\uBAD5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBAE0\uFFFD\uFFFE\u000B\uBAF1" + - "\uFFFF\u0043\uFFFD\uFFFE\u0011\uBAFC\uFFFD\uFFFE\u000B\uBB0D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBB18" + - "\uFFFD\uFFFE\u000B\uBB29\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBB34\uFFFD\uFFFE\u000B\uBB45\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uBB50\uFFFD\uFFFE\u000B\uBB61\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBB6C\uFFFD\uFFFE" + - "\u000B\uBB7D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBB88\uFFFD\uFFFE\u000B\uBB99\uFFFF\u0043\uFFFD\uFFFE" + - "\u0011\uBBA4\uFFFD\uFFFE\u000B\uBBB5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBBC0\uFFFD\uFFFE\u000B\uBBD1" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBBDC\uFFFD\uFFFE\u000B\uBBED\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBBF8" + - "\uFFFD\uFFFE\u000B\uBC09\uFFFF\u0083\uFFFD\u3142\uFFFF\u001F\uFFFD\uFFFE\u0011\uBC14\uFFFD\uFFFE" + - "\u000B\uBC25\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBC30\uFFFD\uFFFE\u000B\uBC41\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uBC4C\uFFFD\uFFFE\u000B\uBC5D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBC68\uFFFD\uFFFE\u000B\uBC79" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBC84\uFFFD\uFFFE\u000B\uBC95\uFFFF\u0043\uFFFD\uFFFE\u0011\uBCA0" + - "\uFFFD\uFFFE\u000B\uBCB1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBCBC\uFFFD\uFFFE\u000B\uBCCD\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uBCD8\uFFFD\uFFFE\u000B\uBCE9\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBCF4\uFFFD\uFFFE" + - "\u000B\uBD05\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBD10\uFFFD\uFFFE\u000B\uBD21\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uBD2C\uFFFD\uFFFE\u000B\uBD3D\uFFFF\u0043\uFFFD\uFFFE\u0011\uBD48\uFFFD\uFFFE\u000B\uBD59" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBD64\uFFFD\uFFFE\u000B\uBD75\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBD80" + - "\uFFFD\uFFFE\u000B\uBD91\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBD9C\uFFFD\uFFFE\u000B\uBDAD\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uBDB8\uFFFD\uFFFE\u000B\uBDC9\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBDD4\uFFFD\uFFFE" + - "\u000B\uBDE5\uFFFF\u0043\uFFFD\uFFFE\u0011\uBDF0\uFFFD\uFFFE\u000B\uBE01\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uBE0C\uFFFD\uFFFE\u000B\uBE1D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBE28\uFFFD\uFFFE\u000B\uBE39" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBE44\uFFFD\uFFFE\u000B\uBE55\uFFFF\u0083\uFFFD\u3143\uFFFF\u001F" + - "\uFFFD\uFFFE\u0011\uBE60\uFFFD\uFFFE\u000B\uBE71\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBE7C\uFFFD\uFFFE" + - "\u000B\uBE8D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBE98\uFFFD\uFFFE\u000B\uBEA9\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uBEB4\uFFFD\uFFFE\u000B\uBEC5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBED0\uFFFD\uFFFE\u000B\uBEE1" + - "\uFFFF\u0043\uFFFD\uFFFE\u0011\uBEEC\uFFFD\uFFFE\u000B\uBEFD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBF08" + - "\uFFFD\uFFFE\u000B\uBF19\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBF24\uFFFD\uFFFE\u000B\uBF35\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uBF40\uFFFD\uFFFE\u000B\uBF51\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBF5C\uFFFD\uFFFE" + - "\u000B\uBF6D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBF78\uFFFD\uFFFE\u000B\uBF89\uFFFF\u0043\uFFFD\uFFFE" + - "\u0011\uBF94\uFFFD\uFFFE\u000B\uBFA5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBFB0\uFFFD\uFFFE\u000B\uBFC1" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBFCC\uFFFD\uFFFE\u000B\uBFDD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uBFE8" + - "\uFFFD\uFFFE\u000B\uBFF9\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC004\uFFFD\uFFFE\u000B\uC015\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uC020\uFFFD\uFFFE\u000B\uC031\uFFFF\u0043\uFFFD\uFFFE\u0011\uC03C\uFFFD\uFFFE" + - "\u000B\uC04D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC058\uFFFD\uFFFE\u000B\uC069\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uC074\uFFFD\uFFFE\u000B\uC085\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC090\uFFFD\uFFFE\u000B\uC0A1" + - "\uFFFF\u0083\uFFFD\u3145\uFFFF\u001F\uFFFD\uFFFE\u0011\uC0AC\uFFFD\uFFFE\u000B\uC0BD\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uC0C8\uFFFD\uFFFE\u000B\uC0D9\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC0E4\uFFFD\uFFFE" + - "\u000B\uC0F5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC100\uFFFD\uFFFE\u000B\uC111\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uC11C\uFFFD\uFFFE\u000B\uC12D\uFFFF\u0043\uFFFD\uFFFE\u0011\uC138\uFFFD\uFFFE\u000B\uC149" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC154\uFFFD\uFFFE\u000B\uC165\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC170" + - "\uFFFD\uFFFE\u000B\uC181\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC18C\uFFFD\uFFFE\u000B\uC19D\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uC1A8\uFFFD\uFFFE\u000B\uC1B9\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC1C4\uFFFD\uFFFE" + - "\u000B\uC1D5\uFFFF\u0043\uFFFD\uFFFE\u0011\uC1E0\uFFFD\uFFFE\u000B\uC1F1\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uC1FC\uFFFD\uFFFE\u000B\uC20D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC218\uFFFD\uFFFE\u000B\uC229" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC234\uFFFD\uFFFE\u000B\uC245\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC250" + - "\uFFFD\uFFFE\u000B\uC261\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC26C\uFFFD\uFFFE\u000B\uC27D\uFFFF\u0043" + - "\uFFFD\uFFFE\u0011\uC288\uFFFD\uFFFE\u000B\uC299\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC2A4\uFFFD\uFFFE" + - "\u000B\uC2B5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC2C0\uFFFD\uFFFE\u000B\uC2D1\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uC2DC\uFFFD\uFFFE\u000B\uC2ED\uFFFF\u0083\uFFFD\u3146\uFFFF\u001F\uFFFD\uFFFE\u0011\uC2F8" + - "\uFFFD\uFFFE\u000B\uC309\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC314\uFFFD\uFFFE\u000B\uC325\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uC330\uFFFD\uFFFE\u000B\uC341\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC34C\uFFFD\uFFFE" + - "\u000B\uC35D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC368\uFFFD\uFFFE\u000B\uC379\uFFFF\u0043\uFFFD\uFFFE" + - "\u0011\uC384\uFFFD\uFFFE\u000B\uC395\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC3A0\uFFFD\uFFFE\u000B\uC3B1" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC3BC\uFFFD\uFFFE\u000B\uC3CD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC3D8" + - "\uFFFD\uFFFE\u000B\uC3E9\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC3F4\uFFFD\uFFFE\u000B\uC405\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uC410\uFFFD\uFFFE\u000B\uC421\uFFFF\u0043\uFFFD\uFFFE\u0011\uC42C\uFFFD\uFFFE" + - "\u000B\uC43D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC448\uFFFD\uFFFE\u000B\uC459\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uC464\uFFFD\uFFFE\u000B\uC475\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC480\uFFFD\uFFFE\u000B\uC491" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC49C\uFFFD\uFFFE\u000B\uC4AD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC4B8" + - "\uFFFD\uFFFE\u000B\uC4C9\uFFFF\u0043\uFFFD\uFFFE\u0011\uC4D4\uFFFD\uFFFE\u000B\uC4E5\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uC4F0\uFFFD\uFFFE\u000B\uC501\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC50C\uFFFD\uFFFE" + - "\u000B\uC51D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC528\uFFFD\uFFFE\u000B\uC539\uFFFF\u0083\uFFFD\u3147" + - "\uFFFF\u001F\uFFFD\uFFFE\u0011\uC544\uFFFD\uFFFE\u000B\uC555\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC560" + - "\uFFFD\uFFFE\u000B\uC571\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC57C\uFFFD\uFFFE\u000B\uC58D\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uC598\uFFFD\uFFFE\u000B\uC5A9\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC5B4\uFFFD\uFFFE" + - "\u000B\uC5C5\uFFFF\u0043\uFFFD\uFFFE\u0011\uC5D0\uFFFD\uFFFE\u000B\uC5E1\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uC5EC\uFFFD\uFFFE\u000B\uC5FD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC608\uFFFD\uFFFE\u000B\uC619" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC624\uFFFD\uFFFE\u000B\uC635\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC640" + - "\uFFFD\uFFFE\u000B\uC651\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC65C\uFFFD\uFFFE\u000B\uC66D\uFFFF\u0043" + - "\uFFFD\uFFFE\u0011\uC678\uFFFD\uFFFE\u000B\uC689\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC694\uFFFD\uFFFE" + - "\u000B\uC6A5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC6B0\uFFFD\uFFFE\u000B\uC6C1\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uC6CC\uFFFD\uFFFE\u000B\uC6DD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC6E8\uFFFD\uFFFE\u000B\uC6F9" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC704\uFFFD\uFFFE\u000B\uC715\uFFFF\u0043\uFFFD\uFFFE\u0011\uC720" + - "\uFFFD\uFFFE\u000B\uC731\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC73C\uFFFD\uFFFE\u000B\uC74D\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uC758\uFFFD\uFFFE\u000B\uC769\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC774\uFFFD\uFFFE" + - "\u000B\uC785\uFFFF\u0083\uFFFD\u3148\uFFFF\u001F\uFFFD\uFFFE\u0011\uC790\uFFFD\uFFFE\u000B\uC7A1" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC7AC\uFFFD\uFFFE\u000B\uC7BD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC7C8" + - "\uFFFD\uFFFE\u000B\uC7D9\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC7E4\uFFFD\uFFFE\u000B\uC7F5\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uC800\uFFFD\uFFFE\u000B\uC811\uFFFF\u0043\uFFFD\uFFFE\u0011\uC81C\uFFFD\uFFFE" + - "\u000B\uC82D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC838\uFFFD\uFFFE\u000B\uC849\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uC854\uFFFD\uFFFE\u000B\uC865\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC870\uFFFD\uFFFE\u000B\uC881" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC88C\uFFFD\uFFFE\u000B\uC89D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC8A8" + - "\uFFFD\uFFFE\u000B\uC8B9\uFFFF\u0043\uFFFD\uFFFE\u0011\uC8C4\uFFFD\uFFFE\u000B\uC8D5\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uC8E0\uFFFD\uFFFE\u000B\uC8F1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC8FC\uFFFD\uFFFE" + - "\u000B\uC90D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC918\uFFFD\uFFFE\u000B\uC929\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uC934\uFFFD\uFFFE\u000B\uC945\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC950\uFFFD\uFFFE\u000B\uC961" + - "\uFFFF\u0043\uFFFD\uFFFE\u0011\uC96C\uFFFD\uFFFE\u000B\uC97D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC988" + - "\uFFFD\uFFFE\u000B\uC999\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC9A4\uFFFD\uFFFE\u000B\uC9B5\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uC9C0\uFFFD\uFFFE\u000B\uC9D1\uFFFF\u0083\uFFFD\u3149\uFFFF\u001F\uFFFD\uFFFE" + - "\u0011\uC9DC\uFFFD\uFFFE\u000B\uC9ED\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uC9F8\uFFFD\uFFFE\u000B\uCA09" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCA14\uFFFD\uFFFE\u000B\uCA25\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCA30" + - "\uFFFD\uFFFE\u000B\uCA41\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCA4C\uFFFD\uFFFE\u000B\uCA5D\uFFFF\u0043" + - "\uFFFD\uFFFE\u0011\uCA68\uFFFD\uFFFE\u000B\uCA79\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCA84\uFFFD\uFFFE" + - "\u000B\uCA95\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCAA0\uFFFD\uFFFE\u000B\uCAB1\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uCABC\uFFFD\uFFFE\u000B\uCACD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCAD8\uFFFD\uFFFE\u000B\uCAE9" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCAF4\uFFFD\uFFFE\u000B\uCB05\uFFFF\u0043\uFFFD\uFFFE\u0011\uCB10" + - "\uFFFD\uFFFE\u000B\uCB21\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCB2C\uFFFD\uFFFE\u000B\uCB3D\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uCB48\uFFFD\uFFFE\u000B\uCB59\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCB64\uFFFD\uFFFE" + - "\u000B\uCB75\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCB80\uFFFD\uFFFE\u000B\uCB91\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uCB9C\uFFFD\uFFFE\u000B\uCBAD\uFFFF\u0043\uFFFD\uFFFE\u0011\uCBB8\uFFFD\uFFFE\u000B\uCBC9" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCBD4\uFFFD\uFFFE\u000B\uCBE5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCBF0" + - "\uFFFD\uFFFE\u000B\uCC01\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCC0C\uFFFD\uFFFE\u000B\uCC1D\uFFFF\u0083" + - "\uFFFD\u314A\uFFFF\u001F\uFFFD\uFFFE\u0011\uCC28\uFFFD\uFFFE\u000B\uCC39\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uCC44\uFFFD\uFFFE\u000B\uCC55\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCC60\uFFFD\uFFFE\u000B\uCC71" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCC7C\uFFFD\uFFFE\u000B\uCC8D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCC98" + - "\uFFFD\uFFFE\u000B\uCCA9\uFFFF\u0043\uFFFD\uFFFE\u0011\uCCB4\uFFFD\uFFFE\u000B\uCCC5\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uCCD0\uFFFD\uFFFE\u000B\uCCE1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCCEC\uFFFD\uFFFE" + - "\u000B\uCCFD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCD08\uFFFD\uFFFE\u000B\uCD19\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uCD24\uFFFD\uFFFE\u000B\uCD35\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCD40\uFFFD\uFFFE\u000B\uCD51" + - "\uFFFF\u0043\uFFFD\uFFFE\u0011\uCD5C\uFFFD\uFFFE\u000B\uCD6D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCD78" + - "\uFFFD\uFFFE\u000B\uCD89\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCD94\uFFFD\uFFFE\u000B\uCDA5\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uCDB0\uFFFD\uFFFE\u000B\uCDC1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCDCC\uFFFD\uFFFE" + - "\u000B\uCDDD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCDE8\uFFFD\uFFFE\u000B\uCDF9\uFFFF\u0043\uFFFD\uFFFE" + - "\u0011\uCE04\uFFFD\uFFFE\u000B\uCE15\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCE20\uFFFD\uFFFE\u000B\uCE31" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCE3C\uFFFD\uFFFE\u000B\uCE4D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCE58" + - "\uFFFD\uFFFE\u000B\uCE69\uFFFF\u0083\uFFFD\u314B\uFFFF\u001F\uFFFD\uFFFE\u0011\uCE74\uFFFD\uFFFE" + - "\u000B\uCE85\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCE90\uFFFD\uFFFE\u000B\uCEA1\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uCEAC\uFFFD\uFFFE\u000B\uCEBD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCEC8\uFFFD\uFFFE\u000B\uCED9" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCEE4\uFFFD\uFFFE\u000B\uCEF5\uFFFF\u0043\uFFFD\uFFFE\u0011\uCF00" + - "\uFFFD\uFFFE\u000B\uCF11\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCF1C\uFFFD\uFFFE\u000B\uCF2D\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uCF38\uFFFD\uFFFE\u000B\uCF49\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCF54\uFFFD\uFFFE" + - "\u000B\uCF65\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCF70\uFFFD\uFFFE\u000B\uCF81\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uCF8C\uFFFD\uFFFE\u000B\uCF9D\uFFFF\u0043\uFFFD\uFFFE\u0011\uCFA8\uFFFD\uFFFE\u000B\uCFB9" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCFC4\uFFFD\uFFFE\u000B\uCFD5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCFE0" + - "\uFFFD\uFFFE\u000B\uCFF1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uCFFC\uFFFD\uFFFE\u000B\uD00D\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uD018\uFFFD\uFFFE\u000B\uD029\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD034\uFFFD\uFFFE" + - "\u000B\uD045\uFFFF\u0043\uFFFD\uFFFE\u0011\uD050\uFFFD\uFFFE\u000B\uD061\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uD06C\uFFFD\uFFFE\u000B\uD07D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD088\uFFFD\uFFFE\u000B\uD099" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD0A4\uFFFD\uFFFE\u000B\uD0B5\uFFFF\u0083\uFFFD\u314C\uFFFF\u001F" + - "\uFFFD\uFFFE\u0011\uD0C0\uFFFD\uFFFE\u000B\uD0D1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD0DC\uFFFD\uFFFE" + - "\u000B\uD0ED\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD0F8\uFFFD\uFFFE\u000B\uD109\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uD114\uFFFD\uFFFE\u000B\uD125\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD130\uFFFD\uFFFE\u000B\uD141" + - "\uFFFF\u0043\uFFFD\uFFFE\u0011\uD14C\uFFFD\uFFFE\u000B\uD15D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD168" + - "\uFFFD\uFFFE\u000B\uD179\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD184\uFFFD\uFFFE\u000B\uD195\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uD1A0\uFFFD\uFFFE\u000B\uD1B1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD1BC\uFFFD\uFFFE" + - "\u000B\uD1CD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD1D8\uFFFD\uFFFE\u000B\uD1E9\uFFFF\u0043\uFFFD\uFFFE" + - "\u0011\uD1F4\uFFFD\uFFFE\u000B\uD205\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD210\uFFFD\uFFFE\u000B\uD221" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD22C\uFFFD\uFFFE\u000B\uD23D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD248" + - "\uFFFD\uFFFE\u000B\uD259\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD264\uFFFD\uFFFE\u000B\uD275\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uD280\uFFFD\uFFFE\u000B\uD291\uFFFF\u0043\uFFFD\uFFFE\u0011\uD29C\uFFFD\uFFFE" + - "\u000B\uD2AD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD2B8\uFFFD\uFFFE\u000B\uD2C9\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uD2D4\uFFFD\uFFFE\u000B\uD2E5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD2F0\uFFFD\uFFFE\u000B\uD301" + - "\uFFFF\u0083\uFFFD\u314D\uFFFF\u001F\uFFFD\uFFFE\u0011\uD30C\uFFFD\uFFFE\u000B\uD31D\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uD328\uFFFD\uFFFE\u000B\uD339\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD344\uFFFD\uFFFE" + - "\u000B\uD355\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD360\uFFFD\uFFFE\u000B\uD371\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uD37C\uFFFD\uFFFE\u000B\uD38D\uFFFF\u0043\uFFFD\uFFFE\u0011\uD398\uFFFD\uFFFE\u000B\uD3A9" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD3B4\uFFFD\uFFFE\u000B\uD3C5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD3D0" + - "\uFFFD\uFFFE\u000B\uD3E1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD3EC\uFFFD\uFFFE\u000B\uD3FD\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uD408\uFFFD\uFFFE\u000B\uD419\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD424\uFFFD\uFFFE" + - "\u000B\uD435\uFFFF\u0043\uFFFD\uFFFE\u0011\uD440\uFFFD\uFFFE\u000B\uD451\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uD45C\uFFFD\uFFFE\u000B\uD46D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD478\uFFFD\uFFFE\u000B\uD489" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD494\uFFFD\uFFFE\u000B\uD4A5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD4B0" + - "\uFFFD\uFFFE\u000B\uD4C1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD4CC\uFFFD\uFFFE\u000B\uD4DD\uFFFF\u0043" + - "\uFFFD\uFFFE\u0011\uD4E8\uFFFD\uFFFE\u000B\uD4F9\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD504\uFFFD\uFFFE" + - "\u000B\uD515\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD520\uFFFD\uFFFE\u000B\uD531\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uD53C\uFFFD\uFFFE\u000B\uD54D\uFFFF\u0083\uFFFD\u314E\uFFFF\u001F\uFFFD\uFFFE\u0011\uD558" + - "\uFFFD\uFFFE\u000B\uD569\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD574\uFFFD\uFFFE\u000B\uD585\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uD590\uFFFD\uFFFE\u000B\uD5A1\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD5AC\uFFFD\uFFFE" + - "\u000B\uD5BD\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD5C8\uFFFD\uFFFE\u000B\uD5D9\uFFFF\u0043\uFFFD\uFFFE" + - "\u0011\uD5E4\uFFFD\uFFFE\u000B\uD5F5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD600\uFFFD\uFFFE\u000B\uD611" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD61C\uFFFD\uFFFE\u000B\uD62D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD638" + - "\uFFFD\uFFFE\u000B\uD649\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD654\uFFFD\uFFFE\u000B\uD665\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uD670\uFFFD\uFFFE\u000B\uD681\uFFFF\u0043\uFFFD\uFFFE\u0011\uD68C\uFFFD\uFFFE" + - "\u000B\uD69D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD6A8\uFFFD\uFFFE\u000B\uD6B9\uFFFD\uFFFD\uFFFD\uFFFE" + - "\u0011\uD6C4\uFFFD\uFFFE\u000B\uD6D5\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD6E0\uFFFD\uFFFE\u000B\uD6F1" + - "\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD6FC\uFFFD\uFFFE\u000B\uD70D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD718" + - "\uFFFD\uFFFE\u000B\uD729\uFFFF\u0043\uFFFD\uFFFE\u0011\uD734\uFFFD\uFFFE\u000B\uD745\uFFFD\uFFFD" + - "\uFFFD\uFFFE\u0011\uD750\uFFFD\uFFFE\u000B\uD761\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD76C\uFFFD\uFFFE" + - "\u000B\uD77D\uFFFD\uFFFD\uFFFD\uFFFE\u0011\uD788\uFFFD\uFFFE\u000B\uD799\uFFFF\u0083\uFFFD\uFFFE" + - "\u003F\uE000\uFFFD\uFFFE\u007D\uE03F\uFFFF\u0043\uFFFD\uFFFE\u003F\uE0BC\uFFFD\uFFFE\u007D\uE0FB" + - "\uFFFF\u0043\uFFFD\uFFFE\u003F\uE178\uFFFD\uFFFE\u007D\uE1B7\uFFFF\u0043\uFFFD\uFFFE\u003F\uE234" + - "\uFFFD\uFFFE\u007D\uE273\uFFFF\u0043\uFFFD\uFFFE\u003F\uE2F0\uFFFD\uFFFE\u007D\uE32F\uFFFF\u0043" + - "\uFFFD\uFFFE\u003F\uE3AC\uFFFD\uFFFE\u007D\uE3EB\uFFFF\u0043\uFFFD\uFFFE\u003F\uE468\uFFFD\uFFFE" + - "\u007D\uE4A7\uFFFF\u0043\uFFFD\uFFFE\u003F\uE524\uFFFD\uFFFE\u007D\uE563\uFFFF\u0043\uFFFD\uFFFE" + - "\u003F\uE5E0\uFFFD\uFFFE\u007D\uE61F\uFFFF\u0043\uFFFD\uFFFE\u003F\uE69C\uFFFD\uFFFE\u007D\uE6DB" + - "\uFFFF\u2202\uFFFD"; - - - private static final String fromUnicode_ = - "\uFFFF\u00A1\uFEFE\u495C\uFEFE\uFEFE\u4962\uFEFE\uFEFE\u4176\u4146\uFEFE\u4B43\uFEFE\uFEFE\u4148" + - "\u4996\uFEFE\u4165\u415D\u4BF6\u4BF7\u4953\uFEFE\u4980\u4143\u495A\u4BF5\u4B4C\uFEFE\u4B99\u4B96" + - "\u4B9A\u495D\uFFFF\u0006\uFEFE\u4B41\uFFFF\t\uFEFE\u4B42\uFFFF\u0006\uFEFE\u415E\u4B4A\uFFFF" + - "\u0005\uFEFE\u4B4D\u4BAB\uFFFF\u0006\uFEFE\u4BA0\uFFFF\t\uFEFE\u4BA2\uFFFF\u0006\uFEFE\u415F" + - "\u4BA9\uFFFF\u0005\uFEFE\u4BAC\uFFFF\u0012\uFEFE\u4BA1\uFFFF\u0014\uFEFE\u4B44\u4BA3\uFFFF\t" + - "\uFEFE\u4BA4\u4B46\u4BA5\uFFFF\u0004\uFEFE\u4BA6\uFFFF\u0006\uFEFE\u4B48\u4BA7\u4B49\u4BA8\uFFFF" + - "\u0006\uFEFE\u4BAF\u4B4F\u4BAE\uFFFF\u0006\uFEFE\u4B4B\u4BAA\uFFFF\u0012\uFEFE\u4B4E\u4BAD\uFFFF" + - "\u005A\uFEFE\u4160\uFFFF\u00F7\uFEFE\u4994\uFFFF\f\uFEFE\u4955\uFFFF\b\uFEFE\u495E\uFFFF" + - "\u0007\uFEFE\u4956\u4959\u4958\u495B\u4954\u4957\uFFFF\u00B3\uFEFE\uFFFE\u0011\u4661\uFEFE\uFFFE" + - "\u0007\u4672\uFFFF\u0007\uFEFE\uFFFE\u0011\u4681\uFEFE\uFFFE\u0007\u4692\uFFFF\u0037\uFEFE\u4A47" + - "\uFFFF\u000E\uFEFE\uFFFE\u0006\u4A41\uFFFE\u0020\u4A48\uFFFE\u001A\u4A69\uFEFE\u4A68\uFFFF\u0CAE" + - "\uFEFE\uFFFE\u005A\u4C41\uFFFF\u0005\uFEFE\uFFFE\u0044\u4D41\uFFFF\u0005\uFEFE\uFFFE\u0052\u4E41" + - "\uFFFF\u0E16\uFEFE\u4148\uFEFE\uFEFE\uFEFE\u4149\u4149\uFEFE\uFEFE\u414D\u414E\uFEFE\uFEFE\u414F" + - "\u4150\uFEFE\uFEFE\u4981\u4982\uFEFE\uFEFE\uFEFE\u4144\u4145\uFFFF\t\uFEFE\u4964\uFEFE\u4166" + - "\u4167\uFFFF\u0007\uFEFE\u4177\uFFFF\u0038\uFEFE\u4BF8\uFFFF\n\uFEFE\u4BF9\uFEFE\uFFFE\u0004" + - "\u4BFA\uFFFF\'\uFEFE\u4995\uFFFF\u0056\uFEFE\u4168\uFFFF\u0005\uFEFE\u4963\uFFFF\t\uFEFE" + - "\u416F\uFEFE\uFEFE\u498E\uFFFF\n\uFEFE\u4993\u4990\uFEFE\uFEFE\uFEFE\u4870\uFEFE\uFEFE\uFEFE" + - "\u4169\u4190\uFFFF\'\uFEFE\u4B97\u4B98\uFFFF\u0006\uFEFE\uFFFE\u0004\u4B9B\uFEFE\uFFFE\n" + - "\u4650\uFFFF\u0006\uFEFE\uFFFE\n\u4641\uFFFF\u0016\uFEFE\u4186\u4187\u4185\u4188\u4189\u4983" + - "\u4986\u4984\u4987\u4985\uFFFF\u0038\uFEFE\u494F\uFEFE\u4950\uFFFF\u002B\uFEFE\u4951\uFEFE\u4196" + - "\u4952\uFEFE\uFEFE\uFEFE\u4197\u4945\uFEFE\uFEFE\u4946\uFEFE\uFEFE\uFEFE\u4961\uFEFE\u4960\uFFFF" + - "\b\uFEFE\u419C\uFEFE\uFEFE\u4941\u4163\uFEFE\u4193\uFFFF\u0004\uFEFE\u414A\uFEFE\u494D\u494E" + - "\u494C\u494B\u4943\u4944\uFEFE\u495F\uFFFF\u0005\uFEFE\u4164\u4942\uFFFF\u0006\uFEFE\u42A1\u419D" + - "\uFFFF\u0014\uFEFE\u4199\uFFFF\r\uFEFE\u418D\u4198\uFEFE\uFEFE\u418E\u418F\u4161\u4162\uFEFE" + - "\uFEFE\u419A\u419B\uFFFF\u0016\uFEFE\u4949\u494A\uFEFE\uFEFE\u4947\u4948\uFFFF\u0011\uFEFE\u496F" + - "\uFFFF\u000B\uFEFE\u4194\uFFFF\u006C\uFEFE\u4195\uFFFF\u014D\uFEFE\uFFFE\u000F\u4B87\uFFFF\u0005" + - "\uFEFE\uFFFE\u000F\u4BE6\uFFFF\u0019\uFEFE\uFFFE\u001A\u4BCC\uFFFF\u001A\uFEFE\uFFFE\u001A\u4B6D" + - "\uFFFF\u0016\uFEFE\u4741\u474C\u4742\u474D\uFFFF\b\uFEFE\u0000\u001B\u4743\u6867\u4E44\u6261" + - "\u4F46\u6665\u5145\u6463\u5047\u5C69\u6A57\u6B6C\u5249\u5E6D\u6E59\u6F70\u5448\u7172\u585D\u7374" + - "\u534A\u7576\u5A5F\u7778\u554B\u797A\u5B7B\u7C60\uFFFE\b\u477D\u4756\uFFFF\u0046\uFEFE\u4974" + - "\uFFFF\r\uFEFE\u4180\u417F\uFEFE\u0000\u0003\u4971\u7576\u7978\u777A\uFFFF\b\uFEFE\u4182" + - "\u4181\uFEFE\uFEFE\u4968\u4967\uFFFF\u0004\uFEFE\u4184\u4183\uFEFE\uFEFE\u4966\u4965\uFFFF\u0004" + - "\uFEFE\u417E\u417D\u4970\u496F\uFEFE\u417A\uFEFE\uFEFE\u417C\u417B\u4972\u4973\uFFFF\u0033\uFEFE" + - "\u4179\u4178\uFFFF\u0007\uFEFE\u497D\u497C\uFFFF\f\uFEFE\u497E\uFEFE\u497F\uFFFF\u0021\uFEFE" + - "\u4192\uFEFE\u4191\uFFFF\u001D\uFEFE\u496A\u496B\uFEFE\u496E\u4969\u496C\uFEFE\u496D\u497B\u4989" + - "\u498A\uFEFE\u498B\u4988\uFFFF\u0992\uFEFE\u4040\u4141\u4142\u4147\uFFFF\u0004\uFEFE\uFFFE\n" + - "\u4153\uFEFE\u418A\u4151\u4152\uFFFF\u0006\uFEFE\u42A1\uFFFF\u0024\uFEFE\uFFFE\u0053\u4441\uFFFF" + - "\r\uFEFE\uFFFE\u0056\u4541\uFFFF\u0004\uFEFE\u4143\uFFFF\u0035\uFEFE\u8841\u8C41\u8444\u9041" + - "\u8446\u8447\u9441\u9841\u9C41\uFFFE\u0007\u844A\uA041\uA441\uA841\u8454\uAC41\uB041\uB441\uB841" + - "\uBC41\uC041\uC441\uC841\uCC41\uD041\u8461\u8481\u84A1\u84C1\u84E1\u8541\u8561\u8581\u85A1\u85C1" + - "\u85E1\u8641\u8661\u8681\u86A1\u86C1\u86E1\u8741\u8761\u8781\u87A1\u8441\uFFFE\u002A\u4341\uFFFF" + - "\u0071\uFEFE\uFFFE\u001C\u4BB0\u498D\uFFFF\u0043\uFEFE\uFFFE\u001C\u4B51\uFEFE\uFEFE\uFEFE\u498C" + - "\uFFFF\u0100\uFEFE\uFFFE\u0005\u4860\uFEFE\uFEFE\uFEFE\u4851\u4852\u4873\u4874\u4875\u484F\u4174" + - "\u4175\uFFFE\u0005\u486B\u4841\u416D\u416E\u4842\u4847\u4848\u4849\u4171\u4172\u4173\uFFFE\u0004" + - "\u484A\uFFFE\u0004\u4843\u0000\u0004\u4854\u557C\u7D7E\u7F78\u797A\uFFFE\n\u4856\uFFFE\u0006" + - "\u4865\u4871\u4872\u4991\u4883\u4170\u4877\u4886\u498F\u4853\u4884\u484E\uFFFF\u0004\uFEFE\u4850" + - "\u4881\uFEFE\uFEFE\u4882\uFEFE\uFEFE\u4876\uFEFE\u4992\uFEFE\uFEFE\u487B\u4885\u4880\uFFFF\u1A22" + - "\uFEFE\u5FA8\u60DC\uFEFE\u6470\uFEFE\uFEFE\uFEFE\u696E\u5FF4\u59D7\u59E5\u65A9\uFEFE\u699A\uFEFE" + - "\uFEFE\uFEFE\u63E1\uFEFE\uFEFE\u62A1\u5942\u5AC9\uFEFE\u526F\u5871\uFFFF\u0004\uFEFE\u5BBE\uFFFF" + - "\u000E\uFEFE\u61F5\uFEFE\uFEFE\u58A4\uFEFE\u6879\uFFFF\u0005\uFEFE\u66E7\u53D6\uFEFE\u61BA\uFFFF" + - "\u0006\uFEFE\u6A85\u53AF\uFEFE\u5270\uFFFF\u0005\uFEFE\u624C\uFEFE\u5984\u6697\u65A7\uFFFF\u0006" + - "\uFEFE\u5248\uFEFE\u5BBF\u5F5D\uFEFE\uFEFE\uFEFE\u5271\u50DD\u5CB8\uFFFF\u000B\uFEFE\u507B\uFEFE" + - "\u5498\uFFFF\u0005\uFEFE\u5ED3\uFEFE\uFEFE\u58A3\u59D5\uFFFF\u0006\uFEFE\u50D3\uFEFE\uFEFE\uFEFE" + - "\u54DA\uFEFE\uFEFE\uFEFE\u55C8\uFEFE\u5D43\uFEFE\uFEFE\u5985\u5F7D\uFEFE\u5E7C\uFEFE\u6ABF\u5E93" + - "\u6698\uFEFE\u5DAF\u60DD\uFEFE\uFEFE\u5354\uFEFE\uFEFE\u5986\uFEFE\uFEFE\u5C5E\uFEFE\uFEFE\u5699" + - "\u65DD\uFEFE\u5255\u65ED\u5D4A\uFEFE\u6682\uFEFE\uFEFE\u6647\u5149\u60DE\u5543\uFFFF\u0007\uFEFE" + - "\u68F2\uFEFE\uFEFE\uFEFE\u5F99\uFFFF\u0005\uFEFE\u5C59\u5F9A\uFEFE\uFEFE\u644E\uFEFE\u58B5\u5272" + - "\uFEFE\uFEFE\u5341\u50AE\uFEFE\u5FB8\uFFFF\u0006\uFEFE\u5FBB\u5987\u6480\u5FF5\u58B6\u5A83\uFEFE" + - "\uFEFE\uFEFE\u549A\u5F9B\u634E\uFEFE\uFEFE\uFEFE\u544D\u5587\u5F7E\uFFFF\n\uFEFE\u5C97\uFEFE" + - "\u61F6\uFEFE\uFEFE\uFEFE\u50D4\u50AF\uFEFE\uFEFE\uFEFE\u5FB0\uFFFF\u0005\uFEFE\u5358\uFFFF\u0007" + - "\uFEFE\u65DE\u5F7F\u6893\uFEFE\u5DB0\u5359\u5891\u5848\u6794\uFFFF\u001D\uFEFE\u57F4\uFFFF\u0004" + - "\uFEFE\u57A5\uFEFE\u5588\uFEFE\u5BF2\uFEFE\u5989\uFEFE\u5988\u5041\uFFFF\u0005\uFEFE\u6B5E\uFEFE" + - "\uFEFE\u53D7\u6072\u6562\uFFFF\u0004\uFEFE\u5EBB\u6071\u61BB\u61B4\u5E72\uFEFE\uFEFE\uFEFE\u65AA" + - "\uFEFE\uFEFE\uFEFE\u5D44\u6B47\u58F4\u5FD9\u5273\u53BC\uFFFF\n\uFEFE\u64F7\uFFFF\u0005\uFEFE" + - "\u5CCC\u57F5\uFEFE\uFEFE\u5042\uFEFE\uFEFE\u5395\uFEFE\uFEFE\uFEFE\u6B5F\uFEFE\uFEFE\uFEFE\u5FA9" + - "\u598B\uFEFE\u69E0\uFEFE\u6845\u6B88\uFEFE\u54FC\uFEFE\u6453\uFEFE\u687D\u5599\uFEFE\u5BC8\uFEFE" + - "\u61BC\uFEFE\u5ED5\uFFFF\u0004\uFEFE\u6963\uFEFE\u6B8D\uFEFE\uFEFE\u51C2\uFEFE\u5F6C\uFFFF\u0010" + - "\uFEFE\u56DD\u6771\uFFFF\u0005\uFEFE\u6473\u5552\uFFFF\b\uFEFE\u6549\uFEFE\uFEFE\u5174\u63AD" + - "\u5C5F\uFFFF\u0004\uFEFE\u6A8C\u61E3\uFEFE\uFEFE\uFEFE\u6166\uFEFE\uFEFE\u6AAB\uFEFE\u6865\u6BD1" + - "\uFEFE\uFEFE\u5AF7\uFEFE\uFEFE\u5646\u56C3\uFEFE\u5881\uFEFE\u69AC\u6674\u5BF3\uFFFF\f\uFEFE" + - "\u5B52\u699B\uFEFE\u5274\uFEFE\u57E1\uFEFE\u6584\uFEFE\uFEFE\u58A5\uFEFE\u69FC\uFFFF\u0007\uFEFE" + - "\u5872\uFEFE\uFEFE\uFEFE\u5545\uFEFE\uFEFE\u62D4\uFEFE\u50B0\uFEFE\u57E2\uFEFE\uFEFE\uFEFE\u697F" + - "\u5460\uFEFE\uFEFE\uFEFE\u6643\uFEFE\uFEFE\u6772\u5F6D\uFEFE\u6B95\uFEFE\u6866\u62A2\uFEFE\u62D3" + - "\uFEFE\u57C6\u6454\uFEFE\u52BE\u61A3\u6858\uFEFE\u5D9B\u55EF\u648B\u5DF6\uFFFF\r\uFEFE\u5CB9" + - "\uFFFF\u0007\uFEFE\u5CF2\uFEFE\uFEFE\uFEFE\u5043\u50E7\u5EBC\uFFFF\u0005\uFEFE\u654A\uFFFF\u0005" + - "\uFEFE\u65EE\uFFFF\u0004\uFEFE\u61BD\uFEFE\u60DF\uFFFF\b\uFEFE\u50D5\uFFFF\n\uFEFE\u5AA2" + - "\uFEFE\uFEFE\uFEFE\u644F\u60E0\u5E73\uFEFE\u64D5\uFFFF\u0007\uFEFE\u5249\uFFFF\u0004\uFEFE\u58B7" + - "\uFFFF\u0007\uFEFE\u57C7\uFEFE\uFEFE\uFEFE\u50DE\uFFFF\u0006\uFEFE\u59C8\u5943\uFFFF\u0012\uFEFE" + - "\u63C3\u5E5F\uFFFF\u0004\uFEFE\u5DB1\u60A2\u5275\u62EA\uFEFE\u59E6\uFFFF\u0006\uFEFE\u514A\uFEFE" + - "\uFEFE\uFEFE\u55D5\uFEFE\uFEFE\u52EE\uFEFE\uFEFE\uFEFE\u636A\u5A84\uFFFF\u0004\uFEFE\u59E7\uFEFE" + - "\u5256\uFEFE\uFEFE\uFEFE\u5892\u67B1\uFEFE\uFEFE\uFEFE\u55C9\uFEFE\uFEFE\uFEFE\u5EBD\uFFFF\u0006" + - "\uFEFE\u5DFD\uFEFE\u5BC0\uFFFF\u0005\uFEFE\u62C9\uFFFF\u000B\uFEFE\u5044\uFEFE\u5857\uFEFE\uFEFE" + - "\uFEFE\u598C\u5F6E\u61E4\uFEFE\uFEFE\u5CED\uFEFE\u6867\uFEFE\uFEFE\u50E0\uFFFF\b\uFEFE\u5ED6" + - "\uFFFF\f\uFEFE\u59E8\uFEFE\u55BF\uFFFF\b\uFEFE\u5E74\uFFFF\u0007\uFEFE\u6073\uFFFF\u0004" + - "\uFEFE\u694E\uFEFE\uFEFE\u539C\uFEFE\u5CF9\uFEFE\uFEFE\uFEFE\u5DD2\u5F48\uFEFE\u5EA1\u6686\u63F2" + - "\u6168\u679E\u5A82\u51F8\uFEFE\u52E7\u64B0\u56C4\u64C5\uFEFE\uFEFE\uFEFE\u5C60\uFFFF\u0007\uFEFE" + - "\u5442\uFEFE\u54AC\uFFFF\u0005\uFEFE\u5355\uFEFE\uFEFE\u5FB7\uFEFE\u53B0\u60A3\u5544\u5ED7\u64F4" + - "\u51C3\u55EC\u6690\uFEFE\uFEFE\u51C4\uFEFE\uFEFE\uFEFE\u5873\u535A\u5276\u60A4\uFEFE\uFEFE\uFEFE" + - "\u5143\uFEFE\uFEFE\uFEFE\u535B\uFFFF\u0005\uFEFE\u69FD\uFEFE\uFEFE\uFEFE\u62F4\uFEFE\uFEFE\u605D" + - "\uFFFF\u0004\uFEFE\u56E4\uFEFE\uFEFE\u56C6\uFEFE\u5E63\uFFFF\b\uFEFE\u51E3\uFFFF\u0004\uFEFE" + - "\u56D1\uFFFF\u0004\uFEFE\u56C1\uFEFE\u549B\uFFFF\u0005\uFEFE\u63F3\uFEFE\uFEFE\uFEFE\u5CBA\u54FE" + - "\uFFFF\u0005\uFEFE\u557A\uFFFF\u0006\uFEFE\u62F9\uFEFE\u61E5\uFEFE\uFEFE\u5546\uFEFE\u6167\u55FE" + - "\u549C\uFFFF\r\uFEFE\u55FC\u6964\u5F68\u67BC\uFEFE\uFEFE\u584C\uFFFF\u000E\uFEFE\u66FE\u50B1" + - "\uFFFF\u0004\uFEFE\u679C\uFEFE\u6361\u5DFE\u63F0\uFEFE\uFEFE\u65CD\uFEFE\uFEFE\u5461\uFEFE\uFEFE" + - "\u5F9C\uFEFE\uFEFE\u58E1\u60C8\u5D9C\uFEFE\u5067\uFEFE\uFEFE\uFEFE\u5763\uFEFE\uFEFE\u6683\uFFFF" + - "\u0005\uFEFE\u557C\uFFFF\u0005\uFEFE\u6391\uFFFF\u0006\uFEFE\u64ED\u586C\uFEFE\uFEFE\uFEFE\u5647" + - "\u59C9\uFEFE\uFEFE\uFEFE\u51F4\uFEFE\u5462\u62D5\uFFFF\u0004\uFEFE\u614C\u5B4A\u52BF\u62C5\u5FBC" + - "\u505B\uFFFF\u0007\uFEFE\u6386\uFEFE\uFEFE\uFEFE\u646C\uFEFE\uFEFE\u59C2\u52E8\u54E3\u60A5\uFFFF" + - "\u0006\uFEFE\u62FE\uFEFE\u58B8\uFFFF\u0004\uFEFE\u509D\uFEFE\u5790\uFEFE\uFEFE\uFEFE\u69BF\uFFFF" + - "\u0007\uFEFE\u5FBA\u60A6\uFFFF\u0004\uFEFE\u58B9\uFEFE\uFEFE\u65CB\uFEFE\uFEFE\u62D6\uFFFF\u0007" + - "\uFEFE\u6585\uFEFE\u6B9C\uFEFE\uFEFE\uFEFE\u6764\uFEFE\uFEFE\uFEFE\u52E9\u5858\u55E0\uFEFE\uFEFE" + - "\uFEFE\u50E1\uFEFE\uFEFE\uFEFE\u614D\u685F\uFFFF\b\uFEFE\u5567\uFEFE\uFEFE\uFEFE\u51C5\u5045" + - "\uFEFE\uFEFE\u557B\u688F\uFFFF\u0004\uFEFE\u6169\u53BF\u50E5\uFFFF\u0012\uFEFE\u6641\uFEFE\uFEFE" + - "\u514B\uFEFE\u57BC\uFEFE\u646D\uFEFE\u5E60\uFEFE\u56C5\uFEFE\uFEFE\uFEFE\u514C\uFFFF\u0004\uFEFE" + - "\u55FB\uFEFE\uFEFE\u549D\u6AB8\uFEFE\u5085\u574E\uFEFE\u6BFA\uFEFE\u5BC4\u559D\u56DE\uFEFE\uFEFE" + - "\u5ACA\u608C\u52EF\uFFFF\u000E\uFEFE\u677D\uFEFE\u5553\uFEFE\uFEFE\u52C0\uFEFE\u5FDA\u688D\uFEFE" + - "\uFEFE\u5277\u576D\uFFFF\u0005\uFEFE\u6563\uFEFE\uFEFE\u679D\uFFFF\u0004\uFEFE\u6564\uFEFE\u6565" + - "\u5893\uFFFF\u0004\uFEFE\u5944\u66D3\u58E0\uFEFE\u5BC9\uFFFF\u0006\uFEFE\u5FF6\u51F9\uFEFE\u5096" + - "\uFFFF\u0006\uFEFE\u5945\uFFFF\u0004\uFEFE\u6BEF\uFFFF\t\uFEFE\u659F\uFFFF\u0005\uFEFE\u53D2" + - "\u5278\u5C5A\uFEFE\u634F\u6B4C\uFEFE\uFEFE\u5BC1\u5DB2\u6789\u57A6\uFEFE\uFEFE\u696F\uFEFE\uFEFE" + - "\uFEFE\u5946\u61A0\u648C\u6675\uFEFE\uFEFE\u53A8\uFEFE\uFEFE\u5791\uFEFE\u5894\uFEFE\u5862\uFEFE" + - "\u60D0\uFFFF\u0005\uFEFE\u5245\uFEFE\u5AA3\uFFFF\u0006\uFEFE\u5743\u5F9D\u5EBE\uFEFE\uFEFE\u505C" + - "\u54DB\uFEFE\u52C1\uFFFF\u0005\uFEFE\u61FA\uFEFE\u514D\uFFFF\u0004\uFEFE\u5CAE\uFFFF\u000E\uFEFE" + - "\u5C9F\uFFFF\u0004\uFEFE\u5648\uFEFE\u6773\uFFFF\u0004\uFEFE\u5EA2\u6BAA\uFFFF\u0004\uFEFE\u52C6" + - "\u6BC7\uFFFF\u0006\uFEFE\u5D79\uFFFF\r\uFEFE\u50C5\uFFFF\u0007\uFEFE\u62CA\uFFFF\u0004\uFEFE" + - "\u5E75\u62A4\u534C\u5E76\uFEFE\u57A7\uFFFF\u0006\uFEFE\u5B90\uFEFE\u63FC\u5B53\uFEFE\uFEFE\uFEFE" + - "\u57A8\uFEFE\uFEFE\uFEFE\u5B54\uFEFE\u5D9D\u63B9\u5279\u518D\u527A\uFEFE\uFEFE\uFEFE\u518C\u624D" + - "\u52D4\u5AD2\u64F5\uFEFE\u5046\u64B1\u628B\u598D\u5E77\uFFFF\u0004\uFEFE\u598E\uFFFF\b\uFEFE" + - "\u5E78\uFEFE\u67A6\u505D\uFEFE\uFEFE\uFEFE\u65D7\u5396\u6B5A\uFEFE\u549E\u56D2\u6774\u5649\u64C6" + - "\u6648\uFFFF\t\uFEFE\u52B3\uFEFE\u565F\uFEFE\u5F5E\u6558\uFFFF\u0005\uFEFE\u58BA\uFEFE\uFEFE" + - "\u69A0\uFEFE\u65CE\uFFFF\u0007\uFEFE\u5DB3\uFFFF\u0004\uFEFE\u67AD\u63FD\uFEFE\u5764\u6775\uFEFE" + - "\u5DC4\uFEFE\uFEFE\uFEFE\u5554\uFFFF\u0005\uFEFE\u60E1\uFEFE\u518E\uFFFF\u0006\uFEFE\u649A\uFFFF" + - "\u0016\uFEFE\u61C0\uFEFE\u61BF\uFFFF\u0006\uFEFE\u518F\uFEFE\u576F\uFEFE\u5047\uFFFF\u0005\uFEFE" + - "\u5BF4\u669A\u56D0\uFEFE\uFEFE\u6074\uFEFE\uFEFE\uFEFE\u5497\uFEFE\u6566\uFFFF\u0005\uFEFE\u66DA" + - "\uFEFE\u527B\uFEFE\u699C\uFFFF\u0013\uFEFE\u6BAE\uFEFE\uFEFE\uFEFE\u5FBD\uFEFE\uFEFE\u624E\u5257" + - "\uFFFF\u0006\uFEFE\u65EF\uFFFF\u0004\uFEFE\u65CF\uFFFF\u0004\uFEFE\u5F9E\uFEFE\uFEFE\u5CAA\u6591" + - "\uFEFE\uFEFE\u66CB\uFEFE\uFEFE\uFEFE\u65D8\u605E\uFFFF\u0017\uFEFE\u5EA3\uFEFE\uFEFE\uFEFE\u5048" + - "\uFEFE\uFEFE\u6392\uFFFF\u0004\uFEFE\u51B0\u6767\uFEFE\uFEFE\uFEFE\u6363\uFFFF\u0007\uFEFE\u6567" + - "\uFEFE\uFEFE\u514E\uFFFF\u0006\uFEFE\u64F8\uFEFE\u5990\u6B7E\uFFFF\u0006\uFEFE\u6965\uFEFE\u5446" + - "\uFFFF\u000B\uFEFE\u6970\uFFFF\u0012\uFEFE\u5ED9\uFEFE\u62D7\uFEFE\uFEFE\uFEFE\u69EA\uFFFF\b" + - "\uFEFE\u6481\uFFFF\u0005\uFEFE\u648D\uFEFE\u59E9\uFFFF\b\uFEFE\u576B\uFEFE\uFEFE\uFEFE\u5175" + - "\uFEFE\uFEFE\u53F0\uFFFF\u0007\uFEFE\u69E3\uFFFF\u0004\uFEFE\u65D0\uFFFF\u0017\uFEFE\u5BCA\u614E" + - "\uFEFE\uFEFE\uFEFE\u6857\uFEFE\uFEFE\u53A9\u5A86\uFEFE\u6364\u54C9\uFEFE\u6776\u65D1\uFFFF\r" + - "\uFEFE\u6350\u678A\u66E8\uFEFE\u67B2\u507C\uFFFF\t\uFEFE\u6787\uFEFE\u5EDA\u59EA\u539B\u5258" + - "\uFEFE\u53D8\uFFFF\u0016\uFEFE\u6777\uFEFE\u69B3\uFFFF\f\uFEFE\u6273\uFFFF\u0005\uFEFE\u5DB4" + - "\uFEFE\u535C\uFEFE\uFEFE\u62A5\uFEFE\uFEFE\uFEFE\u5991\u6455\uFFFF\u0018\uFEFE\u5B56\u61C1\uFFFF" + - "\u0007\uFEFE\u649B\uFEFE\uFEFE\u5049\uFFFF\n\uFEFE\u527C\uFEFE\uFEFE\u59EB\uFFFF\u0017\uFEFE" + - "\u5AD3\uFEFE\uFEFE\u616B\uFEFE\u63FE\uFEFE\u5BCB\uFFFF\u001C\uFEFE\u6650\uFFFF\u0014\uFEFE\u535D" + - "\uFEFE\u616C\u67B3\u5A53\uFFFF\u0007\uFEFE\u58E2\uFFFF\u0011\uFEFE\u6768\uFFFF\u001E\uFEFE\u5D54" + - "\uFFFF\u0006\uFEFE\u69A9\uFEFE\u6649\uFFFF\u0005\uFEFE\u5CFA\uFFFF\u0007\uFEFE\u5FDB\uFEFE\uFEFE" + - "\uFEFE\u60A7\uFEFE\u6769\uFFFF\u0007\uFEFE\u53AC\uFEFE\uFEFE\u6C42\uFEFE\uFEFE\uFEFE\u63AE\uFFFF" + - "\b\uFEFE\u5B55\u598F\uFEFE\uFEFE\u6752\uFEFE\u5F9F\uFFFF\u000F\uFEFE\u51B7\uFFFF\b\uFEFE" + - "\u5589\u5190\uFFFF\u0004\uFEFE\u5EDB\uFEFE\uFEFE\uFEFE\u6568\u5CE3\uFEFE\uFEFE\uFEFE\u52C2\uFEFE" + - "\uFEFE\u52AA\uFEFE\u5EBF\uFFFF\u0004\uFEFE\u5EA4\u5EA5\uFEFE\uFEFE\u5463\uFEFE\u53D9\uFEFE\uFEFE" + - "\uFEFE\u66E9\uFEFE\uFEFE\u64C7\uFFFF\b\uFEFE\u605F\uFFFF\u0004\uFEFE\u52D5\uFEFE\uFEFE\u624F" + - "\uFFFF\n\uFEFE\u535E\uFFFF\u0004\uFEFE\u6250\uFEFE\u64EC\uFFFF\u0004\uFEFE\u52E1\uFEFE\uFEFE" + - "\u57C8\uFEFE\uFEFE\u68F5\u5086\uFEFE\u61B5\u50C0\uFFFF\u000F\uFEFE\u64DE\uFEFE\uFEFE\u51B8\uFEFE" + - "\u649C\uFEFE\uFEFE\uFEFE\u6554\uFEFE\uFEFE\uFEFE\u68FD\uFEFE\u6868\uFFFF\u0004\uFEFE\u687F\uFFFF" + - "\u0006\uFEFE\u6BB1\uFFFF\u0005\uFEFE\u5B57\uFFFF\u0005\uFEFE\u544E\uFEFE\uFEFE\u6684\u549F\uFFFF" + - "\u0006\uFEFE\u65F1\uFFFF\f\uFEFE\u5F53\uFEFE\u527D\u5EA7\uFFFF\u001F\uFEFE\u5CA0\uFEFE\uFEFE" + - "\uFEFE\u6AAC\u61E6\uFEFE\uFEFE\u56A5\uFEFE\uFEFE\u5AB9\uFFFF\u0004\uFEFE\u54E4\uFFFF\u000B\uFEFE" + - "\u5D4B\u58BB\uFFFF\u000F\uFEFE\u62EB\uFEFE\uFEFE\uFEFE\u5BE5\uFEFE\uFEFE\u629A\uFEFE\u57E4\u535F" + - "\uFEFE\u6894\uFEFE\uFEFE\uFEFE\u52B5\uFEFE\u5443\uFEFE\uFEFE\u50F1\u64D0\uFEFE\u684E\u6AD6\u5C6E" + - "\uFFFF\u0013\uFEFE\u6B9B\uFEFE\uFEFE\u5882\uFEFE\uFEFE\u614F\uFEFE\uFEFE\u5D55\uFEFE\uFEFE\u5087" + - "\uFFFF\u0004\uFEFE\u5E41\u5CF3\u5883\uFEFE\uFEFE\u5FF7\u5464\uFFFF\u0004\uFEFE\u686C\uFFFF\u000F" + - "\uFEFE\u524A\u5D87\uFEFE\uFEFE\uFEFE\u6854\uFEFE\u5AD4\uFEFE\uFEFE\u64A9\uFEFE\uFEFE\u5465\u5444" + - "\uFEFE\u63BA\uFEFE\uFEFE\uFEFE\u5A46\uFEFE\uFEFE\u60A8\u6A8D\uFEFE\u677E\uFFFF\u0004\uFEFE\u5D7A" + - "\uFFFF\u000B\uFEFE\u6274\uFEFE\uFEFE\uFEFE\u62CB\uFEFE\uFEFE\u6B60\uFEFE\u5B91\uFFFF\u0004\uFEFE" + - "\u514F\uFEFE\u5A55\uFEFE\uFEFE\uFEFE\u6AAD\uFFFF\t\uFEFE\u5744\uFFFF\b\uFEFE\u63C7\uFEFE" + - "\u6241\u6651\uFFFF\b\uFEFE\u5761\u548F\uFFFF\u0004\uFEFE\u6482\uFFFF\u0004\uFEFE\u58E4\uFFFF" + - "\u0006\uFEFE\u5DB5\u5FF8\uFEFE\uFEFE\u5068\uFEFE\uFEFE\u5859\uFEFE\uFEFE\uFEFE\u5DD3\uFEFE\u53DA" + - "\uFFFF\u0006\uFEFE\u677F\uFEFE\uFEFE\u65B6\uFEFE\u5C93\uFEFE\u669C\uFEFE\uFEFE\u55D6\u51FA\uFFFF" + - "\u0004\uFEFE\u524B\u55B8\uFFFF\u0004\uFEFE\u5CCD\uFFFF\u0006\uFEFE\u5992\u5FB1\uFEFE\uFEFE\u6047" + - "\uFFFF\t\uFEFE\u5FAA\u669B\u5A54\uFEFE\u5B58\uFFFF\u0011\uFEFE\u65AB\uFFFF\u0004\uFEFE\u5360" + - "\u5A72\u5DF9\uFEFE\uFEFE\u5B92\u53D4\uFEFE\u5CBB\uFFFF\u0005\uFEFE\u56FC\uFFFF\u0004\uFEFE\u544F" + - "\uFEFE\u6351\u64B2\u58BC\uFEFE\u5E42\u5C98\uFEFE\uFEFE\u5C4B\uFFFF\u0005\uFEFE\u5F80\uFFFF\u0006" + - "\uFEFE\u6676\uFFFF\u0005\uFEFE\u5CFB\uFEFE\uFEFE\u5361\u53B1\u58A6\uFFFF\u0004\uFEFE\u52D6\u61C2" + - "\u6BE5\u5176\uFEFE\uFEFE\u58E5\u665A\uFEFE\u64D6\uFEFE\uFEFE\u65F0\uFFFF\u0005\uFEFE\u60A9\uFEFE" + - "\u5993\uFFFF\u0004\uFEFE\u5DB6\uFEFE\uFEFE\u64A4\u5F49\u5FF9\u5A73\u58E6\uFFFF\u0004\uFEFE\u53B5" + - "\u53C0\uFEFE\uFEFE\uFEFE\u5069\uFFFF\u0004\uFEFE\u669D\uFFFF\u0004\uFEFE\u5D45\u5947\u569A\uFFFF" + - "\u0005\uFEFE\u5FB2\uFFFF\b\uFEFE\u5362\uFEFE\uFEFE\u5E43\u6890\uFEFE\u5745\uFFFF\t\uFEFE" + - "\u5948\uFEFE\u6483\uFEFE\uFEFE\u57C9\uFEFE\uFEFE\uFEFE\u64D7\uFFFF\f\uFEFE\u56A6\uFEFE\u62FA" + - "\uFEFE\uFEFE\u6373\uFFFF\u0004\uFEFE\u60E2\uFEFE\uFEFE\u56E0\uFEFE\uFEFE\u5FBE\uFEFE\u5BCC\uFFFF" + - "\u0004\uFEFE\u6075\u5191\u5994\u5ABA\u5EC0\uFFFF\u0004\uFEFE\u5FB3\u5E44\uFEFE\u509E\u6B75\uFFFF" + - "\b\uFEFE\u506A\uFEFE\u5F81\uFEFE\u628D\uFEFE\u67B4\uFEFE\u65DF\uFFFF\t\uFEFE\u5D56\uFEFE" + - "\uFEFE\u5FA0\uFEFE\uFEFE\uFEFE\u5FBF\uFEFE\u5EC4\uFEFE\u6A9C\uFFFF\r\uFEFE\u5995\uFFFF\u0006" + - "\uFEFE\u53AD\uFEFE\uFEFE\u5DB7\u689C\uFEFE\uFEFE\u5D57\u5BF5\uFFFF\u0004\uFEFE\u5C61\uFEFE\uFEFE" + - "\uFEFE\u5680\uFFFF\f\uFEFE\u6441\uFFFF\u0005\uFEFE\u62D8\uFFFF\u0004\uFEFE\u695D\uFFFF\u0004" + - "\uFEFE\u64DD\uFEFE\uFEFE\u5DE2\uFFFF\u0010\uFEFE\u66C0\uFFFF\u0007\uFEFE\u5949\uFEFE\uFEFE\uFEFE" + - "\u58BD\uFFFF\u0018\uFEFE\u5A56\uFFFF\u0012\uFEFE\u56A7\u6741\uFFFF\u0006\uFEFE\u5770\u5EA8\uFFFF" + - "\b\uFEFE\u5BCD\uFFFF\u0017\uFEFE\u5DCA\u5672\u527E\uFEFE\uFEFE\u504A\u5B59\uFEFE\u6AC0\uFFFF" + - "\u0004\uFEFE\u628E\uFEFE\uFEFE\u6672\uFFFF\n\uFEFE\u527F\uFFFF\t\uFEFE\u608D\uFFFF\u0004" + - "\uFEFE\u6BCC\uFEFE\uFEFE\u53CC\uFFFF\u001B\uFEFE\u66D4\uFEFE\uFEFE\uFEFE\u67B5\uFEFE\u69B6\u5259" + - "\uFFFF\t\uFEFE\u6559\uFFFF\u0013\uFEFE\u5970\uFFFF\u0005\uFEFE\u5D88\uFFFF\u000F\uFEFE\u59ED" + - "\uFEFE\uFEFE\u5CCE\uFFFF\f\uFEFE\u5FC0\u666E\uFEFE\uFEFE\u51C6\u5FB9\uFEFE\u5FC2\u619E\uFEFE" + - "\u699D\uFEFE\u5FC1\u676A\uFEFE\u56BB\uFEFE\uFEFE\uFEFE\u5177\u5192\u53C1\uFEFE\uFEFE\uFEFE\u65F2" + - "\uFEFE\u5AFD\uFFFF\u0004\uFEFE\u5B93\u6B52\uFEFE\uFEFE\uFEFE\u58BE\uFEFE\uFEFE\u65B7\uFEFE\u5EDC" + - "\uFEFE\u5CF8\uFFFF\b\uFEFE\u545D\uFEFE\u5E79\u5B5A\u5C79\uFEFE\u5B44\u5DE3\uFEFE\uFEFE\u5251" + - "\uFEFE\uFEFE\uFEFE\u5895\uFEFE\u64AC\u6BF1\u61A4\u51E4\u61C3\u60E6\u5DE4\u5F71\uFFFF\u0005\uFEFE" + - "\u50BF\u5A87\u5C4C\u5EDD\u66EA\uFFFF\u0005\uFEFE\u69C1\uFEFE\u52B9\uFEFE\u6060\uFEFE\uFEFE\u65F3" + - "\u5D58\u5AD7\u504B\uFEFE\u5BF6\u5E61\uFFFF\u0005\uFEFE\u5B94\u6B93\uFEFE\u608E\u5EA9\u5363\u5FA1" + - "\u578C\u5280\uFFFF\u0004\uFEFE\u58BF\uFEFE\uFEFE\uFEFE\u56A8\uFEFE\u65BC\u5E7A\u5BE6\uFEFE\uFEFE" + - "\u68C4\uFFFF\u0006\uFEFE\u567B\u62C6\uFEFE\u51D2\u6474\uFEFE\u5DB8\u6AA0\u5C4D\u53BD\u6B94\u5C50" + - "\uFEFE\u5996\u51E5\uFEFE\u55CB\u6B78\uFFFF\u0005\uFEFE\u63BB\u5884\uFEFE\u63B6\uFEFE\u5997\uFFFF" + - "\u0006\uFEFE\u58A7\uFEFE\uFEFE\u59BD\uFEFE\uFEFE\u6048\u60AA\u5EC1\u619F\u5C51\uFEFE\u5450\u5466" + - "\u5AD5\uFEFE\u5AD6\uFFFF\u0004\uFEFE\u636B\uFEFE\uFEFE\u59EE\uFFFF\u0006\uFEFE\u5A88\uFEFE\uFEFE" + - "\uFEFE\u5E7B\uFEFE\uFEFE\uFEFE\u57CA\uFFFF\b\uFEFE\u6442\uFFFF\u0006\uFEFE\u5BCF\u5F4A\u6341" + - "\u686E\u53D0\uFEFE\u5771\u53CA\u52AB\uFFFF\u0004\uFEFE\u50C6\u5178\uFEFE\u52B6\uFEFE\uFEFE\u5DC5" + - "\uFEFE\u5BD0\u69DC\uFEFE\uFEFE\u5AA6\uFEFE\uFEFE\uFEFE\u60AB\uFFFF\u0005\uFEFE\u5874\uFFFF\u0004" + - "\uFEFE\u5467\uFEFE\u55D7\uFEFE\u6452\u564A\uFFFF\u0006\uFEFE\u5AF8\uFEFE\uFEFE\u54B8\uFEFE\u59CA" + - "\uFFFF\u0007\uFEFE\u67A7\uFFFF\u0012\uFEFE\u534D\uFEFE\uFEFE\uFEFE\u5364\u5FEB\uFFFF\u000F\uFEFE" + - "\u509C\uFFFF\u0004\uFEFE\u566D\uFEFE\uFEFE\u69EB\uFEFE\u5B5C\u5097\uFFFF\u0004\uFEFE\u5451\uFEFE" + - "\u5C6F\uFEFE\u6BDE\uFEFE\u6986\u5C7A\uFEFE\u6951\uFEFE\uFEFE\uFEFE\u60D1\uFEFE\u69CD\uFFFF\u0018" + - "\uFEFE\u6456\uFFFF\u0006\uFEFE\u69B2\uFFFF\u0007\uFEFE\u5C62\uFFFF\u0004\uFEFE\u6393\uFEFE\u58A9" + - "\u58A8\uFEFE\uFEFE\uFEFE\u665E\uFEFE\u5468\uFFFF\u0004\uFEFE\u61E7\uFEFE\u6677\uFFFF\t\uFEFE" + - "\u5BB2\uFFFF\u0005\uFEFE\u694C\u5366\uFEFE\uFEFE\u51B9\uFEFE\uFEFE\u63C4\uFEFE\u5CA1\u509F\uFEFE" + - "\u55F0\uFFFF\r\uFEFE\u5BB3\uFEFE\u58FA\uFFFF\u0021\uFEFE\u5772\u5088\uFEFE\uFEFE\uFEFE\u54E6" + - "\uFEFE\u5C8A\uFFFF\u0016\uFEFE\u5BB4\uFEFE\uFEFE\u6A9D\uFEFE\uFEFE\u62A7\uFFFF\u0012\uFEFE\u5FFA" + - "\uFFFF\u0004\uFEFE\u5281\uFEFE\uFEFE\uFEFE\u68FE\uFFFF\u0011\uFEFE\u6948\uFEFE\uFEFE\u525A\uFEFE" + - "\u5E45\uFFFF\u0007\uFEFE\u5CFE\uFFFF\r\uFEFE\u6A74\uFEFE\u558A\uFEFE\u5A58\u5C70\uFFFF\u000F" + - "\uFEFE\u5DFA\uFFFF\u0004\uFEFE\u5681\u60AC\uFEFE\uFEFE\u5C8B\uFFFF\u0006\uFEFE\u6352\u61C4\uFEFE" + - "\uFEFE\u5BA9\u5AD8\uFEFE\uFEFE\u51C7\u61B6\u525B\u50C7\uFEFE\uFEFE\u574F\uFEFE\uFEFE\u62A6\uFEFE" + - "\uFEFE\u5368\u5F82\u5998\u64DF\u6457\uFEFE\u65E0\uFEFE\u52F0\uFEFE\uFEFE\uFEFE\u69C8\u50D6\uFEFE" + - "\uFEFE\uFEFE\u5BD1\u656A\uFEFE\uFEFE\u584D\uFFFF\u0005\uFEFE\u67B6\uFFFF\u0004\uFEFE\u64AD\uFFFF" + - "\u0004\uFEFE\u6374\uFEFE\uFEFE\u628F\uFEFE\u57F6\uFEFE\u6150\uFFFF\u0007\uFEFE\u5B5D\uFFFF\u0005" + - "\uFEFE\u5999\uFEFE\u5A75\uFFFF\u0005\uFEFE\u5FFB\uFEFE\uFEFE\u5452\u5EDE\u59F2\uFFFF\u0004\uFEFE" + - "\u56DF\uFEFE\u6BF7\u60E3\uFEFE\uFEFE\u5EC2\u69E5\u6580\uFEFE\u57CB\uFFFF\u0004\uFEFE\u6BE7\uFFFF" + - "\b\uFEFE\u567C\uFFFF\t\uFEFE\u6458\uFEFE\u6990\u5445\u655A\uFFFF\r\uFEFE\u54DC\u506B" + - "\u6555\u53B6\uFEFE\uFEFE\u5875\u6644\u506C\uFEFE\u66EB\u5ED8\u5EDF\u5367\uFFFF\u0005\uFEFE\u5FFC" + - "\uFEFE\uFEFE\u594A\uFEFE\uFEFE\u59EF\uFFFF\u0004\uFEFE\u5A59\uFFFF\u0005\uFEFE\u6076\u6569\u60D2" + - "\uFEFE\uFEFE\u5150\uFEFE\u58C0\uFEFE\uFEFE\uFEFE\u59F0\uFFFF\u0005\uFEFE\u5469\u61B7\uFEFE\uFEFE" + - "\uFEFE\u5193\uFEFE\u60E7\uFFFF\u0007\uFEFE\u5C8C\u5A5A\u50A0\u5E62\uFFFF\u0005\uFEFE\u5EE0\uFEFE" + - "\uFEFE\uFEFE\u59F1\uFFFF\u0005\uFEFE\u65AC\u5580\u54F3\uFFFF\u0005\uFEFE\u5282\uFEFE\uFEFE\u51DD" + - "\uFEFE\uFEFE\u55CC\uFEFE\uFEFE\uFEFE\u61BE\u60AD\uFEFE\uFEFE\uFEFE\u5746\u62D9\uFEFE\u655B\u51FB" + - "\uFFFF\u0004\uFEFE\u65F4\u55FD\uFEFE\uFEFE\u5555\uFFFF\u0006\uFEFE\u637C\uFEFE\uFEFE\u5D59\u60E4" + - "\uFEFE\uFEFE\u50D7\u6753\uFFFF\u0005\uFEFE\u5863\uFEFE\uFEFE\u55B9\uFFFF\u0005\uFEFE\u655C\uFFFF" + - "\u0004\uFEFE\u5BE7\uFEFE\u5BD2\uFEFE\u52BA\u616D\u5FA2\uFEFE\u58F6\u66CA\uFEFE\uFEFE\u5F84\uFEFE" + - "\uFEFE\uFEFE\u6151\uFFFF\u0006\uFEFE\u665F\u669E\uFEFE\u53C2\uFFFF\u0007\uFEFE\u5CC4\uFEFE\uFEFE" + - "\uFEFE\u5FFD\uFFFF\u0004\uFEFE\u50A1\uFEFE\u65A0\uFFFF\t\uFEFE\u586D\uFEFE\u649D\uFEFE\u50A2" + - "\uFEFE\u5774\uFEFE\u5682\uFFFF\u0007\uFEFE\u68F3\u6691\uFEFE\u678C\uFEFE\u5F85\uFFFF\u0006\uFEFE" + - "\u6685\uFEFE\uFEFE\uFEFE\u5CF4\u6AB9\uFEFE\u62EC\u6586\u616E\u5972\u6544\uFEFE\uFEFE\u62DA\u5D89" + - "\uFFFF\u0005\uFEFE\u57CC\uFEFE\u5D4D\uFEFE\uFEFE\u6598\uFEFE\uFEFE\u69A3\u5DF1\u60E5\uFEFE\uFEFE" + - "\uFEFE\u5453\uFEFE\u69D5\uFEFE\uFEFE\u6754\u55F4\u6778\uFEFE\uFEFE\uFEFE\u5A5B\u5151\u546A\uFFFF" + - "\u0004\uFEFE\u54BD\u57E5\u599B\uFFFF\u0004\uFEFE\u61A5\uFEFE\u694D\u5CE4\uFFFF\u0006\uFEFE\u6742" + - "\u5896\u5B99\uFEFE\uFEFE\uFEFE\u5775\uFFFF\u0005\uFEFE\u6459\u629E\uFEFE\u545E\uFEFE\u6362\uFEFE" + - "\uFEFE\uFEFE\u678D\uFFFF\u0005\uFEFE\u5C52\uFEFE\u65A1\uFFFF\u0006\uFEFE\u5369\u5FA3\uFFFF\b" + - "\uFEFE\u63B7\u6251\u569B\u569C\uFFFF\u0006\uFEFE\u63F4\uFFFF\n\uFEFE\u647F\uFFFF\u0005\uFEFE" + - "\u6475\uFEFE\uFEFE\uFEFE\u53B8\uFFFF\u0005\uFEFE\u67A2\uFEFE\u66C6\uFEFE\u58E7\uFFFF\u000F\uFEFE" + - "\u5C99\uFEFE\uFEFE\u53C3\uFEFE\uFEFE\uFEFE\u656B\uFFFF\u0004\uFEFE\u53E9\u558B\u599C\uFEFE\uFEFE" + - "\u64B3\u5F86\uFEFE\uFEFE\uFEFE\u534E\uFEFE\u5ABB\u5EAA\uFEFE\u524C\uFFFF\u0004\uFEFE\u50E6\uFEFE" + - "\u63BC\uFEFE\u6743\uFFFF\r\uFEFE\u6B48\u5B9A\u5BD3\uFFFF\t\uFEFE\u6744\uFEFE\uFEFE\u51CA" + - "\uFEFE\u65E1\uFEFE\uFEFE\u5A5C\uFEFE\uFEFE\uFEFE\u5CCF\u5D42\uFEFE\uFEFE\u51F5\uFFFF\u0004\uFEFE" + - "\u6755\u5FC3\u6799\u6466\uFEFE\uFEFE\u65BD\u5F54\u505F\uFEFE\u53B9\u51C9\uFEFE\u5BE8\u67AE\uFFFF" + - "\u0014\uFEFE\u5D74\uFEFE\uFEFE\uFEFE\u5C4E\uFEFE\uFEFE\u6152\u65BE\uFFFF\u0006\uFEFE\u6756\uFEFE" + - "\u64F9\uFEFE\uFEFE\uFEFE\u69CB\u60AE\uFEFE\uFEFE\uFEFE\u5DB9\u5EE1\uFEFE\uFEFE\u66EC\u6BA0\uFEFE" + - "\uFEFE\u564B\uFFFF\b\uFEFE\u6B73\uFEFE\u594B\u545F\u63F9\u62DB\u5780\uFEFE\u5179\uFEFE\uFEFE" + - "\uFEFE\u546B\u62FB\uFFFF\u0007\uFEFE\u60E8\uFEFE\u5490\uFFFF\t\uFEFE\u66BD\uFFFF\b\uFEFE" + - "\u66C7\uFEFE\u5A76\uFEFE\uFEFE\u5EE2\u6692\u5C72\uFFFF\u000E\uFEFE\u6484\u53C8\uFEFE\u59F3\uFEFE" + - "\uFEFE\u6746\uFEFE\uFEFE\u5CC2\u5ABC\u6450\uFFFF\u0005\uFEFE\u5B5F\uFEFE\u5A89\uFEFE\uFEFE\u50D8" + - "\uFEFE\u5EE4\u5EE3\uFEFE\uFEFE\uFEFE\u5781\u6548\u5F72\uFFFF\u0005\uFEFE\u5C71\uFFFF\u0004\uFEFE" + - "\u5E7D\u5CA2\uFEFE\uFEFE\uFEFE\u5089\uFFFF\u0007\uFEFE\u524D\uFFFF\b\uFEFE\u6BE8\uFEFE\uFEFE" + - "\uFEFE\u6B91\uFEFE\uFEFE\u50B2\uFFFF\u0004\uFEFE\u5BF7\uFEFE\u50B3\u5EAB\uFEFE\uFEFE\u6AAE\uFEFE" + - "\u55F5\uFEFE\uFEFE\u5F55\u5FC4\uFEFE\u5144\u64B4\u6745\uFFFF\u0006\uFEFE\u6587\uFEFE\u56E1\uFEFE" + - "\uFEFE\u62CC\u62CD\u62CE\uFEFE\uFEFE\u64DB\uFEFE\u64C9\uFEFE\uFEFE\u5683\u51E6\u6844\uFEFE\uFEFE" + - "\u6693\u50B4\uFEFE\uFEFE\u61A6\uFEFE\uFEFE\u555E\uFEFE\u5EC3\uFFFF\u0005\uFEFE\u5152\u50A3\uFFFF" + - "\u0005\uFEFE\u6342\u5E5B\uFEFE\uFEFE\u6BA1\u5E7E\uFFFF\u0007\uFEFE\u594C\uFEFE\uFEFE\uFEFE\u6242" + - "\uFEFE\u556F\u5980\uFEFE\uFEFE\u6394\uFEFE\uFEFE\uFEFE\u6C43\u67B8\u649E\uFFFF\t\uFEFE\u58E8" + - "\uFEFE\uFEFE\u54A0\uFEFE\u50E8\uFEFE\u5782\u6869\uFEFE\u697C\uFEFE\uFEFE\uFEFE\u6654\uFEFE\uFEFE" + - "\uFEFE\u5CEE\uFEFE\uFEFE\uFEFE\u68F6\uFEFE\uFEFE\uFEFE\u508A\uFFFF\u0004\uFEFE\u52F1\uFEFE\uFEFE" + - "\uFEFE\u506D\u65F5\u5F69\u6A8E\u5750\uFFFF\u001A\uFEFE\u539D\uFFFF\u000B\uFEFE\u629F\uFEFE\uFEFE" + - "\uFEFE\u54CA\u6757\u6660\uFEFE\u62CF\uFEFE\u5283\u66ED\uFEFE\u5F73\u5570\uFFFF\u0006\uFEFE\u68FB" + - "\u51D3\uFEFE\u5751\uFEFE\u5BAF\u5B5E\u5F50\uFEFE\u5ABD\u5C63\u517A\uFEFE\uFEFE\uFEFE\u66BE\uFEFE" + - "\uFEFE\uFEFE\u6343\uFEFE\uFEFE\uFEFE\u5C84\u52EA\uFEFE\u684A\uFFFF\b\uFEFE\u60C9\uFEFE\uFEFE" + - "\uFEFE\u55ED\uFEFE\u60AF\u67B9\uFEFE\uFEFE\u5454\uFEFE\u66A0\uFFFF\u0007\uFEFE\u5556\u57CD\u5ADB" + - "\u654B\uFEFE\u5154\uFEFE\uFEFE\uFEFE\u5A8A\u66B8\u594D\uFEFE\u5B60\uFEFE\u6061\uFFFF\u0005\uFEFE" + - "\u6485\uFFFF\u0004\uFEFE\u648F\uFFFF\u0015\uFEFE\u58E9\uFEFE\uFEFE\u534F\uFFFF\u0004\uFEFE\u58C2" + - "\uFEFE\uFEFE\u594E\uFEFE\uFEFE\u69EC\uFEFE\uFEFE\u5BC2\u536A\uFEFE\uFEFE\uFEFE\u6395\uFFFF\u0004" + - "\uFEFE\u6863\u64E0\uFFFF\u0006\uFEFE\u5CEF\u5A5D\uFEFE\uFEFE\u64D8\uFEFE\u65E2\u60CA\uFEFE\uFEFE" + - "\u656D\uFFFF\u000F\uFEFE\u6599\uFFFF\u0005\uFEFE\u656C\uFEFE\uFEFE\uFEFE\u6077\uFEFE\uFEFE\uFEFE" + - "\u5694\uFEFE\uFEFE\u5C94\u63C8\uFFFF\u0004\uFEFE\u58F7\uFEFE\uFEFE\uFEFE\u6490\u5752\u53BA\u54F0" + - "\uFEFE\uFEFE\u57A9\u5792\uFEFE\u539E\u524E\uFEFE\u50C8\u6344\u57BD\uFEFE\u6BAF\u5E46\u5284\u61A1" + - "\uFEFE\u6396\u57E6\uFFFF\u000F\uFEFE\u51F6\u5BE9\u5397\u6243\uFEFE\u51CB\uFEFE\u52C3\uFEFE\uFEFE" + - "\uFEFE\u5194\uFFFF\u0006\uFEFE\u5BB9\u539F\uFEFE\u6252\uFFFF\u0005\uFEFE\u6253\u5AA7\u5C7B\uFFFF" + - "\u0007\uFEFE\u546C\uFFFF\u0019\uFEFE\u61B8\uFEFE\uFEFE\uFEFE\u6275\uFFFF\t\uFEFE\u5F64\u60E9" + - "\u6A58\uFEFE\u5684\u6678\uFFFF\n\uFEFE\u62AF\uFEFE\uFEFE\u64F6\uFEFE\uFEFE\u53A7\u5D5A\uFFFF" + - "\u0004\uFEFE\u656E\uFFFF\u0011\uFEFE\u58AA\u599D\uFFFF\u0005\uFEFE\u50C9\uFEFE\uFEFE\uFEFE\u6885" + - "\uFFFF\u0004\uFEFE\u6375\uFEFE\uFEFE\u53A6\u53BB\uFEFE\uFEFE\uFEFE\u69B4\uFEFE\uFEFE\uFEFE\u5AD9" + - "\uFFFF\u0004\uFEFE\u5B61\u6941\uFEFE\uFEFE\u5FFE\uFFFF\u0005\uFEFE\u57E7\uFEFE\uFEFE\uFEFE\u5CAF" + - "\uFEFE\u52B7\uFEFE\uFEFE\u5246\uFFFF\u0004\uFEFE\u5541\u62ED\u64A6\uFEFE\uFEFE\u60D8\uFEFE\u51CC" + - "\u63C9\u5CFC\u616F\uFEFE\u52AC\uFFFF\u0013\uFEFE\u506E\uFEFE\uFEFE\uFEFE\u5EE5\uFEFE\u52D7\uFFFF" + - "\b\uFEFE\u5747\u6153\uFFFF\u0005\uFEFE\u5F65\uFEFE\uFEFE\uFEFE\u5CD0\u66EE\uFFFF\u0005\uFEFE" + - "\u5C73\uFFFF\u000B\uFEFE\u50E9\u678E\uFFFF\u0005\uFEFE\u5EAC\uFEFE\u5CBD\u59E0\uFFFF\u0015\uFEFE" + - "\u5AFE\uFEFE\u5793\uFFFF\u0004\uFEFE\u5ADA\uFEFE\u5E47\u546D\uFFFF\u0004\uFEFE\u5B62\uFFFF\u0005" + - "\uFEFE\u6B7F\uFFFF\t\uFEFE\u57AA\u64AA\uFFFF\f\uFEFE\u6795\uFEFE\uFEFE\uFEFE\u62B0\uFFFF" + - "\u0019\uFEFE\u608F\uFFFF\u0007\uFEFE\u63BD\uFFFF\u0006\uFEFE\u63C5\uFEFE\u5673\uFFFF\u0005\uFEFE" + - "\u6254\uFFFF\b\uFEFE\u56E2\u6977\u60D9\uFFFF\r\uFEFE\u559E\uFFFF\b\uFEFE\u64C3\u59D3" + - "\u6AA3\uFFFF\u0006\uFEFE\u68C3\uFEFE\uFEFE\uFEFE\u5447\uFFFF\u0005\uFEFE\u6365\u57BF\uFFFF\u0005" + - "\uFEFE\u5753\uFEFE\u64E1\u63C2\uFEFE\u62B6\uFEFE\u5794\uFFFF\b\uFEFE\u53EA\uFFFF\u0005\uFEFE" + - "\u5DD6\uFEFE\uFEFE\u6956\u6353\uFEFE\u64C0\uFEFE\uFEFE\u50EA\uFEFE\uFEFE\u6170\u5155\uFEFE\uFEFE" + - "\uFEFE\u5342\uFEFE\u53F1\uFEFE\uFEFE\uFEFE\u585A\uFEFE\u50CA\uFFFF\u0006\uFEFE\u5455\u6492\uFEFE" + - "\uFEFE\u54E7\u62C7\u50CD\uFFFF\u0004\uFEFE\u5F74\uFEFE\uFEFE\u5973\uFEFE\u5060\u6345\uFEFE\u66E1" + - "\uFFFF\u0005\uFEFE\u6BB8\uFEFE\uFEFE\uFEFE\u5E48\uFEFE\u57AB\uFEFE\uFEFE\uFEFE\u64C4\uFFFF\u0013" + - "\uFEFE\u5CD1\uFFFF\u0004\uFEFE\u5AB6\uFFFF\u0005\uFEFE\u5571\uFFFF\u0006\uFEFE\u525D\u66E2\u54E8" + - "\uFEFE\uFEFE\u6255\uFFFF\u0006\uFEFE\u5B63\u5195\u5ED4\u50B5\uFEFE\u51CD\uFEFE\uFEFE\u57CE\u60EA" + - "\uFFFF\u0005\uFEFE\u5196\uFEFE\uFEFE\u676B\uFFFF\u0004\uFEFE\u5A5E\u525C\u5783\uFEFE\u5285\uFEFE" + - "\uFEFE\u5CE5\uFEFE\u6A8F\u6542\uFFFF\u0006\uFEFE\u62DC\uFEFE\uFEFE\uFEFE\u508B\u59CB\uFEFE\uFEFE" + - "\u5491\uFFFF\u0005\uFEFE\u5156\u5CD2\uFFFF\u0004\uFEFE\u5197\uFEFE\u60EB\u6090\uFEFE\u58C3\u5B64" + - "\uFFFF\u0005\uFEFE\u69B7\uFEFE\uFEFE\uFEFE\u5581\u655D\uFEFE\u6BF3\uFEFE\u5765\uFFFF\u0004\uFEFE" + - "\u5974\uFEFE\uFEFE\uFEFE\u594F\u57AC\uFFFF\u0005\uFEFE\u54AD\uFEFE\u55D0\uFEFE\u51B1\u59A0\uFEFE" + - "\uFEFE\u6298\uFEFE\u5C85\uFEFE\uFEFE\u52F2\u6346\uFEFE\u58C4\uFEFE\uFEFE\uFEFE\u5FDC\u62D0\uFEFE" + - "\uFEFE\u599F\u5BF8\uFFFF\u0006\uFEFE\u53DB\uFEFE\u57CF\uFEFE\uFEFE\u5CE6\u5BD4\uFEFE\uFEFE\uFEFE" + - "\u57D0\uFEFE\uFEFE\uFEFE\u5557\uFFFF\u0005\uFEFE\u5A8B\u60EC\uFEFE\uFEFE\u619A\uFEFE\uFEFE\u6961" + - "\uFFFF\u0004\uFEFE\u536B\uFFFF\b\uFEFE\u5754\uFEFE\uFEFE\u536C\uFEFE\u5FAB\u53DC\uFEFE\u6256" + - "\u6171\uFEFE\uFEFE\u5B9B\u5E8D\uFEFE\uFEFE\uFEFE\u65BF\uFEFE\uFEFE\u6AB2\uFFFF\u0005\uFEFE\u5DF2" + - "\u5785\u5784\u6944\uFEFE\u5DBB\uFFFF\u0006\uFEFE\u51BA\u5BC3\uFEFE\u57D1\u669F\uFEFE\u62DD\uFEFE" + - "\u56D4\u66C1\u69A1\u6891\uFEFE\u5D4E\u5A77\u67A3\uFFFF\b\uFEFE\u5876\u5ABE\u5D8A\uFEFE\uFEFE" + - "\uFEFE\u558C\u63EE\uFEFE\u56A9\u5FDD\uFFFF\u0004\uFEFE\u5ADC\uFEFE\u5BD5\u65AD\u5E8E\uFEFE\uFEFE" + - "\u5748\uFEFE\u62DE\uFEFE\uFEFE\uFEFE\u5877\u5C9A\uFFFF\u0005\uFEFE\u6172\u5BD6\u6747\u6BE9\uFFFF" + - "\u0004\uFEFE\u6276\uFEFE\u6B80\uFEFE\uFEFE\uFEFE\u5C7C\uFFFF\t\uFEFE\u61E8\uFEFE\u6BD5\uFEFE" + - "\u61C5\u6C44\u5ABF\uFEFE\uFEFE\u6154\uFEFE\u5DBC\u6BE6\u6758\u6BDF\u5BF9\u5685\uFEFE\u6BB2\u5B65" + - "\uFEFE\u5885\u5157\uFEFE\uFEFE\uFEFE\u5A78\u637D\uFEFE\u60ED\u688A\u60EE\uFEFE\u6257\uFFFF\t" + - "\uFEFE\u6BFB\uFEFE\uFEFE\u504C\u6780\u678F\uFFFF\u0004\uFEFE\u5D8B\uFEFE\u6AC5\u5A5F\uFFFF\u0004" + - "\uFEFE\u53A3\u5C8D\u5CD3\uFFFF\u0004\uFEFE\u56D5\uFEFE\uFEFE\u686F\uFEFE\u62DF\uFFFF\b\uFEFE" + - "\u5FEC\uFEFE\uFEFE\u56E3\uFEFE\uFEFE\uFEFE\u6041\u6BDC\u6581\uFFFF\u0004\uFEFE\u5AB3\uFEFE\u5153" + - "\uFEFE\uFEFE\u5492\uFFFF\u0005\uFEFE\u5D84\uFEFE\u5569\u53F2\uFEFE\u676C\uFFFF\f\uFEFE\u5CA6" + - "\uFEFE\uFEFE\u5A60\uFEFE\uFEFE\u5E49\u6BBF\uFEFE\uFEFE\u51FC\uFFFF\u0005\uFEFE\u67B7\uFEFE\uFEFE" + - "\u53AE\uFFFF\u0006\uFEFE\u5DF0\uFEFE\u51B2\u5D9E\u5158\uFEFE\uFEFE\u507D\u5A61\u6174\u6173\uFEFE" + - "\u5686\uFEFE\u6245\u6387\u63C6\uFEFE\uFEFE\u6759\uFFFF\u0004\uFEFE\u5EB8\u5EE6\uFEFE\u58FB\uFEFE" + - "\u5898\uFFFF\u0006\uFEFE\u59C5\u6299\uFEFE\u54F4\uFEFE\uFEFE\uFEFE\u569D\uFEFE\u6175\u5388\u536D" + - "\uFFFF\u0006\uFEFE\u56FD\u55BA\u56F4\uFEFE\u5776\u5695\u58A2\u62C8\u6BA8\uFEFE\uFEFE\u61C6\uFEFE" + - "\uFEFE\u5795\uFEFE\u6486\uFEFE\uFEFE\uFEFE\u52C9\uFEFE\uFEFE\u6779\uFFFF\b\uFEFE\u506F\uFEFE" + - "\uFEFE\u59D9\uFFFF\u0004\uFEFE\u564D\u6645\u6062\u63B8\uFEFE\u6588\uFEFE\uFEFE\u6042\uFFFF\u0005" + - "\uFEFE\u54AE\uFEFE\u536E\u5AF9\uFFFF\r\uFEFE\u65E3\uFEFE\u57E8\u50DF\u54A1\u5199\u5749\uFEFE" + - "\u6078\uFEFE\u64E2\uFEFE\uFEFE\uFEFE\u68E9\uFEFE\uFEFE\u5B45\u64EE\uFFFF\u0007\uFEFE\u69A4\uFEFE" + - "\u5DF3\uFEFE\u698C\uFEFE\uFEFE\uFEFE\u68B2\u5A79\uFEFE\uFEFE\u54AF\uFEFE\u6476\uFEFE\u5667\uFEFE" + - "\uFEFE\u56AA\uFEFE\u51D4\u6258\uFFFF\u0011\uFEFE\u5198\u6BBB\uFEFE\uFEFE\u6259\uFEFE\uFEFE\u504E" + - "\u6841\u5287\uFFFF\u0005\uFEFE\u5BD7\uFFFF\u0005\uFEFE\u5878\uFFFF\n\uFEFE\u57F7\u56E5\u508C" + - "\u6471\u5D7B\u5EE7\uFFFF\u0005\uFEFE\u5EE8\uFEFE\uFEFE\u6493\u5FDE\uFEFE\uFEFE\uFEFE\u6079\uFFFF" + - "\u0006\uFEFE\u5288\uFEFE\uFEFE\u6846\uFEFE\uFEFE\u504D\u53B2\u61C7\uFEFE\u55E1\u5BD8\u62F5\u69AD" + - "\uFFFF\u0004\uFEFE\u59A1\uFEFE\uFEFE\u6B67\uFFFF\u0013\uFEFE\u69D6\u60B0\uFEFE\uFEFE\u5A62\u55F6" + - "\uFFFF\t\uFEFE\u525E\u57F8\uFFFF\u0007\uFEFE\u61C8\uFEFE\uFEFE\uFEFE\u5F88\u6ABA\uFEFE\u51CE" + - "\uFFFF\u0006\uFEFE\u6642\u52F3\uFEFE\uFEFE\u50EB\u6063\uFEFE\uFEFE\u685E\u65E4\u517B\u546E\uFFFF" + - "\u0004\uFEFE\u5C7D\uFFFF\u0005\uFEFE\u6290\uFEFE\u54A2\u59F5\uFEFE\u66EF\u5398\uFFFF\u0018\uFEFE" + - "\u6B81\uFFFF\b\uFEFE\u64CA\uFFFF\b\uFEFE\u6847\uFEFE\u5547\uFEFE\u60EF\uFEFE\u56AB\uFFFF" + - "\t\uFEFE\u51B3\uFEFE\uFEFE\uFEFE\u6064\u645A\uFEFE\uFEFE\u5159\uFFFF\u0005\uFEFE\u6176\uFEFE" + - "\u676D\uFEFE\u6A98\u6397\uFFFF\u0004\uFEFE\u5DBD\u564E\uFFFF\u0004\uFEFE\u59A2\uFEFE\u6155\u517C" + - "\u51BB\uFEFE\u5ADD\uFEFE\u584E\u6982\uFFFF\r\uFEFE\u5370\u6994\uFEFE\uFEFE\uFEFE\u56C7\uFEFE" + - "\u536F\uFEFE\u51BC\uFFFF\u0004\uFEFE\u58AC\uFEFE\uFEFE\u61A7\uFEFE\u6177\u52EC\uFEFE\u58FC\uFFFF" + - "\u0004\uFEFE\u54A3\u5448\uFFFF\u0006\uFEFE\u5FE7\u686D\uFFFF\u0005\uFEFE\u59DA\uFEFE\uFEFE\uFEFE" + - "\u5A63\uFFFF\u0006\uFEFE\u546F\u51E7\uFFFF\u0005\uFEFE\u6A99\uFEFE\uFEFE\uFEFE\u60DA\u6AE5\uFFFF" + - "\u0007\uFEFE\u5BEA\u63CA\uFEFE\uFEFE\uFEFE\u6398\uFFFF\u0014\uFEFE\u6974\uFFFF\b\uFEFE\u5CBE" + - "\uFFFF\f\uFEFE\u5D5C\uFEFE\u63EF\uFEFE\uFEFE\u59A3\uFFFF\u0007\uFEFE\u5CD4\uFFFF\b\uFEFE" + - "\u6594\u5AA8\u6487\uFEFE\u685C\uFEFE\u697D\u6399\uFEFE\uFEFE\uFEFE\u5641\uFEFE\u68B3\u5EE9\u6ACB" + - "\u6983\uFFFF\u0004\uFEFE\u60F0\uFEFE\uFEFE\u61FC\uFEFE\u5D41\u607A\u5B9C\uFFFF\u0005\uFEFE\u52EB" + - "\uFEFE\u65F6\u63CB\u5D8C\uFFFF\u001A\uFEFE\u54F5\u5E64\uFFFF\u0005\uFEFE\u6277\u57D2\uFFFF\b" + - "\uFEFE\u6BEA\uFEFE\u5951\uFFFF\u0006\uFEFE\u5D8D\uFFFF\u0005\uFEFE\u55E2\uFFFF\u0006\uFEFE\u64AB" + - "\uFFFF\u0005\uFEFE\u6870\uFEFE\u57AD\uFFFF\u0006\uFEFE\u59C4\u5289\u6BB6\u62E0\u59A4\uFEFE\u524F" + - "\uFEFE\uFEFE\u51CF\uFFFF\u0014\uFEFE\u51DE\uFEFE\u50B6\uFFFF\u0010\uFEFE\u688B\uFEFE\u6178\uFEFE" + - "\u52F4\uFEFE\uFEFE\u5C74\uFEFE\uFEFE\u61A8\uFFFF\u0004\uFEFE\u57FC\uFFFF\u0006\uFEFE\u5549\uFEFE" + - "\u55D8\uFEFE\uFEFE\uFEFE\u607B\uFEFE\u6589\uFFFF\u0004\uFEFE\u63CD\u6043\uFEFE\u56E6\uFEFE\u5CD5" + - "\uFFFF\u0011\uFEFE\u639A\uFEFE\uFEFE\u5796\u5B66\u66D5\uFEFE\uFEFE\u61E9\uFFFF\u0006\uFEFE\u508D" + - "\uFEFE\uFEFE\u6443\u5E4C\uFEFE\uFEFE\u525F\uFFFF\u0004\uFEFE\u6494\uFEFE\u6ABB\u69D7\uFFFF\u0004" + - "\uFEFE\u52E6\u54BE\uFFFF\u0005\uFEFE\u5371\uFEFE\u59F6\uFFFF\t\uFEFE\u6766\uFFFF\u0014\uFEFE" + - "\u53DD\uFEFE\uFEFE\uFEFE\u50EC\uFFFF\u0004\uFEFE\u6B68\uFEFE\uFEFE\uFEFE\u5CF0\u5343\uFFFF\b" + - "\uFEFE\u6992\uFFFF\u0004\uFEFE\u675A\uFEFE\uFEFE\uFEFE\u515A\uFEFE\u50E2\u6044\uFFFF\u000F\uFEFE" + - "\u5975\uFFFF\u0007\uFEFE\u65D2\u5F56\uFFFF\u0005\uFEFE\u6942\u52CA\uFFFF\u000F\uFEFE\u559F\uFFFF" + - "\u0006\uFEFE\u5558\u61FB\uFEFE\uFEFE\uFEFE\u556A\uFFFF\u0016\uFEFE\u6BD0\uFFFF\u0004\uFEFE\u5CB4" + - "\uFFFF\u0006\uFEFE\u5797\uFEFE\u54DD\uFFFF\u0005\uFEFE\u52C4\uFEFE\u6045\uFFFF\u0005\uFEFE\u54DE" + - "\uFEFE\uFEFE\uFEFE\u54E9\uFFFF\t\uFEFE\u67AA\u62A8\uFEFE\u67A4\uFFFF\u000E\uFEFE\u5E5C\uFFFF" + - "\u0005\uFEFE\u5CA3\uFEFE\u5372\uFEFE\uFEFE\u67AC\u51E9\uFFFF\u0004\uFEFE\u59DF\uFEFE\uFEFE\u67AB" + - "\u6657\uFFFF\u0004\uFEFE\u504F\uFEFE\u649F\uFEFE\u528A\uFFFF\u000E\uFEFE\u5D46\uFEFE\u66F0\u625A" + - "\u60F1\u62A9\u5886\u5755\uFEFE\uFEFE\uFEFE\u5DF7\uFFFF\u0007\uFEFE\u5ACB\uFFFF\u0004\uFEFE\u5568" + - "\u52D0\uFEFE\uFEFE\u59AE\uFEFE\uFEFE\uFEFE\u56FA\uFEFE\uFEFE\uFEFE\u5C9B\u6B82\uFEFE\u64B5\uFEFE" + - "\uFEFE\u5B9D\u5B67\uFFFF\u000B\uFEFE\u5BEB\uFEFE\u5FE8\uFFFF\u0005\uFEFE\u5E95\uFFFF\u0005\uFEFE" + - "\u59F7\uFFFF\t\uFEFE\u5582\u5976\uFEFE\uFEFE\u5AAF\uFEFE\uFEFE\u53DE\uFEFE\u5F57\uFEFE\uFEFE" + - "\u59D4\uFEFE\u5061\uFEFE\uFEFE\u60B1\uFEFE\u678B\uFEFE\uFEFE\uFEFE\u5F75\u528B\uFFFF\u0004\uFEFE" + - "\u5756\uFEFE\u56E7\uFEFE\u56AC\uFEFE\uFEFE\u5485\u5F44\u5955\uFEFE\u69A5\u69A6\u5956\uFEFE\uFEFE" + - "\u56E8\uFFFF\u000F\uFEFE\u66A1\u528C\uFFFF\u0018\uFEFE\u62E1\uFEFE\uFEFE\u60B2\uFFFF\u0006\uFEFE" + - "\u5C5D\uFEFE\u5786\uFEFE\u56BC\uFFFF\u000F\uFEFE\u5373\uFFFF\u0010\uFEFE\u5B69\uFEFE\uFEFE\u5981" + - "\u5D8E\uFFFF\u0005\uFEFE\u584F\uFEFE\u60F2\u61FD\u528D\uFFFF\u000B\uFEFE\u5850\uFEFE\u5A7A\uFFFF" + - "\u0004\uFEFE\u59CC\uFEFE\u65C0\uFEFE\uFEFE\u5DBE\uFEFE\uFEFE\u5D47\u66CC\u50A4\u625B\uFFFF\u0007" + - "\uFEFE\u51BF\uFEFE\u5DF4\uFEFE\uFEFE\u6A87\uFEFE\uFEFE\u64B6\uFEFE\u5350\uFEFE\u5864\uFEFE\u5766" + - "\uFEFE\uFEFE\uFEFE\u50FD\uFEFE\uFEFE\u5374\u58EA\uFEFE\uFEFE\u5C54\u5375\u5DC6\uFEFE\u6AC1\u65E5" + - "\u6A59\u6477\uFEFE\uFEFE\uFEFE\u5493\uFEFE\uFEFE\uFEFE\u56F5\uFEFE\u56FB\u53FC\u6973\u6981\u63F5" + - "\uFEFE\u5952\u59A5\u6B7C\u64FA\uFFFF\u000F\uFEFE\u5696\uFEFE\uFEFE\u607C\uFFFF\u0004\uFEFE\u65AE" + - "\uFFFF\u0004\uFEFE\u5954\u5EEA\uFEFE\u645B\u5ADE\u519A\u636C\u5D5D\uFEFE\u6748\u6BD6\uFEFE\u69BC" + - "\uFFFF\u0004\uFEFE\u6354\u5798\uFEFE\u65A2\uFFFF\u0006\uFEFE\u66CD\uFEFE\u5855\uFEFE\u59A6\uFEFE" + - "\uFEFE\uFEFE\u5851\uFFFF\u0004\uFEFE\u558D\u656F\u64E3\u5F66\uFEFE\u53D1\uFEFE\uFEFE\u61CA\uFEFE" + - "\uFEFE\u6BD3\uFEFE\uFEFE\u57AF\u5787\u64B7\uFEFE\uFEFE\u5D8F\uFFFF\u0017\uFEFE\u5CD6\u557D\uFFFF" + - "\u0004\uFEFE\u5888\uFFFF\u0005\uFEFE\u5ACC\uFEFE\u5B6A\uFEFE\u54D2\uFEFE\uFEFE\u54A4\uFFFF\u0006" + - "\uFEFE\u6278\uFEFE\u6ACC\uFEFE\u5AA9\u66CE\uFFFF\u0007\uFEFE\u61CB\uFEFE\uFEFE\u5B9E\u679F\uFEFE" + - "\u51FD\u6AC2\uFEFE\u66F9\uFEFE\u67AF\u64E4\uFEFE\uFEFE\u55E3\uFFFF\u0017\uFEFE\u60CB\u61EA\uFEFE" + - "\u69AA\uFFFF\u0006\uFEFE\u5DE5\uFEFE\uFEFE\u6570\uFEFE\uFEFE\u66A2\u54F6\uFEFE\u6966\uFEFE\u58C5" + - "\uFFFF\u0005\uFEFE\u5E5D\uFEFE\uFEFE\u65F7\u6478\u6679\uFFFF\u0005\uFEFE\u64FB\uFFFF\u0005\uFEFE" + - "\u5D75\uFEFE\u515B\u5ADF\u5AB7\uFEFE\uFEFE\u6AAF\u6BF4\u5D5F\uFEFE\uFEFE\u69C5\uFEFE\u5D5E\uFEFE" + - "\u6388\uFFFF\u0019\uFEFE\u5CA4\uFEFE\uFEFE\u5CB0\uFEFE\uFEFE\u65D3\uFFFF\u0006\uFEFE\u5548\uFEFE" + - "\uFEFE\uFEFE\u6B69\uFEFE\uFEFE\u6886\u645C\u5A7B\u6BF5\u5376\uFEFE\uFEFE\uFEFE\u5668\uFEFE\uFEFE" + - "\uFEFE\u66A3\uFEFE\u5B95\uFFFF\u0006\uFEFE\u5470\u61A9\u55D9\uFEFE\uFEFE\uFEFE\u69CC\uFEFE\uFEFE" + - "\u53F3\uFFFF\u0006\uFEFE\u60F3\uFEFE\u55F1\u5F5F\uFEFE\uFEFE\u675B\uFEFE\uFEFE\u5C55\uFEFE\u5B9F" + - "\uFEFE\u5D60\uFEFE\u66C2\u637E\u5CFD\u6355\u636D\uFFFF\u001B\uFEFE\u59DB\uFEFE\u66F1\u607D\u508E" + - "\uFEFE\uFEFE\uFEFE\u60F4\u50CB\u5471\uFEFE\u59A7\u698B\u5C75\u5DDB\uFFFF\u0004\uFEFE\u5AAA\u6451" + - "\u5EC5\uFEFE\u65E6\uFEFE\uFEFE\u69B8\uFEFE\u507E\uFEFE\u6A76\uFEFE\u5EEB\uFEFE\u574A\uFEFE\u5777" + - "\u6B54\u66C3\uFFFF\u0004\uFEFE\u57E9\u6984\uFFFF\u0005\uFEFE\u6B76\uFEFE\uFEFE\u53DF\uFFFF\b" + - "\uFEFE\u66A4\uFEFE\u59F8\uFEFE\uFEFE\u68F7\u5BEC\uFEFE\u6B6A\u6BEB\uFFFF\u0007\uFEFE\u5E65\uFEFE" + - "\uFEFE\uFEFE\u63CE\uFEFE\uFEFE\u5FA4\u64AE\uFEFE\uFEFE\u6AC3\u68B4\uFFFF\u0006\uFEFE\u5887\uFFFF" + - "\u0015\uFEFE\u5EAD\uFFFF\u0005\uFEFE\u61EB\uFFFF\u0005\uFEFE\u55E4\u528E\uFEFE\u56D6\uFEFE\uFEFE" + - "\u5FAC\uFEFE\uFEFE\u58C6\uFFFF\u0004\uFEFE\u517D\u5DCB\uFEFE\uFEFE\uFEFE\u5AE0\uFEFE\u6279\u5B6B" + - "\uFEFE\uFEFE\uFEFE\u5E66\uFEFE\uFEFE\uFEFE\u53D3\uFFFF\u0007\uFEFE\u698D\uFEFE\u62E2\u56CE\uFEFE" + - "\uFEFE\uFEFE\u6749\uFEFE\u5FC5\u6347\uFEFE\u6BD7\uFEFE\uFEFE\u66FA\uFEFE\u6065\u5472\u54BF\uFFFF" + - "\u0019\uFEFE\u6389\uFFFF\u0004\uFEFE\u6091\uFEFE\uFEFE\uFEFE\u66A5\uFFFF\u0005\uFEFE\u51BD\u5687" + - "\uFEFE\u5CE7\u658A\uFEFE\uFEFE\uFEFE\u6472\uFEFE\uFEFE\u55AF\uFEFE\uFEFE\u52F5\uFEFE\uFEFE\u55DA" + - "\uFEFE\u50B7\uFEFE\u564F\u5D61\u6179\uFFFF\n\uFEFE\u567D\uFEFE\u65C1\u5572\uFFFF\u0007\uFEFE" + - "\u5688\u625C\uFFFF\u0004\uFEFE\u5B6C\u62E3\uFFFF\u0005\uFEFE\u60D3\uFFFF\u0006\uFEFE\u6046\uFEFE" + - "\u5D90\uFFFF\u000F\uFEFE\u57BE\uFEFE\uFEFE\u50FC\uFEFE\uFEFE\u6B8B\u57AE\uFEFE\u69D2\u5FED\u5FEE" + - "\uFEFE\u6957\u5A7C\uFEFE\uFEFE\u6BEC\uFEFE\u5F4B\uFEFE\u55A0\uFFFF\u0006\uFEFE\u53F4\u617A\uFEFE" + - "\u52CB\uFFFF\t\uFEFE\u5FE9\uFEFE\u54A5\u5889\u696B\uFEFE\uFEFE\u59E1\uFEFE\uFEFE\u62A0\uFEFE" + - "\uFEFE\uFEFE\u6366\uFFFF\u0004\uFEFE\u6B77\u6545\uFEFE\u6ABC\uFEFE\uFEFE\uFEFE\u66A6\uFEFE\uFEFE" + - "\u5070\uFFFF\u000B\uFEFE\u65C2\u64C1\uFEFE\uFEFE\u6954\uFFFF\u0006\uFEFE\u675C\u62B7\uFEFE\u60B3" + - "\uFEFE\u6A90\uFFFF\u0005\uFEFE\u53F5\uFFFF\u0004\uFEFE\u68F4\uFEFE\u50ED\u6495\u5583\u53C5\uFFFF" + - "\u0006\uFEFE\u5D9F\uFFFF\n\uFEFE\u5BBA\uFFFF\u0004\uFEFE\u6A77\u56FE\uFEFE\uFEFE\uFEFE\u6156" + - "\u66A8\u5EEC\uFEFE\uFEFE\u5473\uFFFF\u0004\uFEFE\u66A7\uFEFE\u54EA\u61EC\uFEFE\uFEFE\u6496\uFEFE" + - "\u5977\uFFFF\b\uFEFE\u6356\uFEFE\uFEFE\uFEFE\u5559\uFEFE\uFEFE\u5CD7\uFEFE\uFEFE\uFEFE\u6687" + - "\u5486\uFEFE\uFEFE\u59A8\uFEFE\u5C56\uFEFE\uFEFE\uFEFE\u6962\uFEFE\u6582\uFEFE\uFEFE\uFEFE\u5978" + - "\uFEFE\uFEFE\u55A2\uFEFE\u6BC8\u5D91\u6AE3\u556B\u6B6B\u5AE1\uFEFE\uFEFE\uFEFE\u6BCE\uFEFE\uFEFE" + - "\uFEFE\u55BB\u695A\uFFFF\u0006\uFEFE\u6A78\u5778\uFFFF\u0006\uFEFE\u5F94\uFFFF\u0006\uFEFE\u54DF" + - "\uFFFF\r\uFEFE\u51EA\uFEFE\uFEFE\uFEFE\u6BD8\u5B4C\uFFFF\u0006\uFEFE\u64A0\uFFFF\u0004\uFEFE" + - "\u66A9\uFFFF\u0005\uFEFE\u5689\uFFFF\u0007\uFEFE\u66D6\uFEFE\uFEFE\uFEFE\u54C0\u675D\uFFFF\u0007" + - "\uFEFE\u528F\uFEFE\uFEFE\uFEFE\u5FDF\u6066\uFFFF\u0007\uFEFE\u515C\uFFFF\u0004\uFEFE\u6444\uFEFE" + - "\uFEFE\uFEFE\u5D7C\uFEFE\uFEFE\uFEFE\u639B\uFEFE\uFEFE\u65E7\uFEFE\uFEFE\u6BFD\u5FC6\u687E\uFFFF" + - "\u0006\uFEFE\u6B6C\uFEFE\uFEFE\u5AE2\uFFFF\u0006\uFEFE\u6661\u50CC\u64A1\u6571\u6688\uFEFE\uFEFE" + - "\uFEFE\u5879\uFEFE\uFEFE\uFEFE\u61C9\u5FE0\u60D4\uFFFF\u000E\uFEFE\u557E\uFEFE\uFEFE\u6796\uFEFE" + - "\uFEFE\uFEFE\u5DBF\uFFFF\b\uFEFE\u6BE3\u54D3\uFEFE\uFEFE\uFEFE\u6244\uFEFE\u5D62\uFFFF\u0011" + - "\uFEFE\u686A\uFFFF\u0007\uFEFE\u6546\uFEFE\uFEFE\uFEFE\u58AD\uFFFF\u0006\uFEFE\u6781\uFFFF\u0004" + - "\uFEFE\u5CF5\uFEFE\uFEFE\u6B79\uFFFF\f\uFEFE\u698F\u58EB\uFEFE\uFEFE\uFEFE\u6945\uFEFE\uFEFE" + - "\u5757\uFFFF\u0004\uFEFE\u639C\uFFFF\t\uFEFE\u5D7D\uFFFF\u0005\uFEFE\u5D63\uFFFF\u0010\uFEFE" + - "\u6790\uFEFE\u5573\u6BFC\uFEFE\u674A\uFEFE\u60B4\uFEFE\u6A79\uFFFF\u0005\uFEFE\u53A4\uFEFE\uFEFE" + - "\u5D64\uFEFE\uFEFE\u5E8F\uFEFE\u69B0\uFFFF\u0005\uFEFE\u56AD\u66F2\u6BF8\u617B\uFEFE\u57FE\uFEFE" + - "\uFEFE\u5CD8\uFEFE\u5FC7\uFFFF\u000E\uFEFE\u5A8D\uFFFF\u0006\uFEFE\u5BED\uFFFF\u0004\uFEFE\u6ABD" + - "\u5E9F\uFFFF\u0004\uFEFE\u6782\uFEFE\uFEFE\u6BD9\uFEFE\u5E67\uFFFF\u0004\uFEFE\u67BB\uFFFF\u0005" + - "\uFEFE\u5B96\uFEFE\uFEFE\u6999\uFFFF\u0005\uFEFE\u5E9C\uFEFE\uFEFE\uFEFE\u6A91\uFFFF\u0004\uFEFE" + - "\u5D76\u515D\uFFFF\u0006\uFEFE\u67BD\u6C45\uFEFE\uFEFE\uFEFE\u645D\uFEFE\uFEFE\u5D85\uFEFE\u5D65" + - "\uFFFF\u0004\uFEFE\u54C1\u5494\uFFFF\u0004\uFEFE\u55CD\uFEFE\u5660\uFEFE\u5AE3\uFEFE\u6991\u5D66" + - "\uFFFF\t\uFEFE\u5D92\uFFFF\u0005\uFEFE\u617C\u62B8\u5B68\uFFFF\u0005\uFEFE\u63B0\u5AB5\uFFFF" + - "\n\uFEFE\u5A8E\uFEFE\u6783\u5BFA\uFEFE\u5474\u6AA6\u665B\uFFFF\u0005\uFEFE\u6583\uFFFF\t" + - "\uFEFE\u55A1\uFFFF\n\uFEFE\u54E0\uFFFF\u000E\uFEFE\u617D\uFEFE\u64E5\u606D\uFEFE\uFEFE\u5EA6" + - "\uFEFE\u5EC6\uFEFE\uFEFE\u5FE1\u58C7\uFEFE\uFEFE\uFEFE\u5CBF\u676E\uFEFE\u59EC\u5F89\uFEFE\u59FA" + - "\uFFFF\u0005\uFEFE\u6049\u654C\u64EF\uFEFE\uFEFE\uFEFE\u64FC\uFFFF\u0005\uFEFE\u6376\uFEFE\u5799" + - "\uFEFE\uFEFE\uFEFE\u5487\u5C64\uFEFE\u5E7F\uFEFE\u5979\uFEFE\u56E9\uFEFE\u56EA\u55C0\uFFFF\u0004" + - "\uFEFE\u56F6\uFEFE\u576E\uFFFF\b\uFEFE\u5A4E\uFFFF\u0006\uFEFE\u64DC\uFEFE\uFEFE\uFEFE\u50F3" + - "\uFEFE\uFEFE\u5A57\u5650\uFFFF\u0014\uFEFE\u54D4\uFFFF\u000B\uFEFE\u5488\uFFFF\u0004\uFEFE\u67BA" + - "\uFFFF\u0004\uFEFE\u50F4\uFEFE\uFEFE\u5852\uFFFF\u0010\uFEFE\u59F9\uFEFE\u51FE\uFEFE\u6092\uFFFF" + - "\t\uFEFE\u5C95\uFEFE\u66AA\uFFFF\u0006\uFEFE\u5290\uFEFE\u607E\uFFFF\u0007\uFEFE\u5260\uFFFF" + - "\u0007\uFEFE\u5B6D\uFFFF\u000E\uFEFE\u5651\u667A\uFEFE\uFEFE\u54F7\u64FD\uFFFF\f\uFEFE\u5DA0" + - "\uFFFF\u000B\uFEFE\u6B92\uFFFF\u0004\uFEFE\u56BD\u5BD9\u61A2\uFFFF\u0007\uFEFE\u5DFB\uFEFE\uFEFE" + - "\uFEFE\u5AC0\u607F\u574B\uFFFF\b\uFEFE\u677A\uFEFE\u5EED\u6ACF\uFFFF\u0006\uFEFE\u66FB\u5EAE" + - "\uFFFF\u0004\uFEFE\u5DC7\u59AA\uFFFF\n\uFEFE\u604B\uFEFE\u5DC0\uFFFF\u0004\uFEFE\u6887\uFFFF" + - "\u0010\uFEFE\u5489\uFEFE\u675E\uFFFF\u0005\uFEFE\u6A7A\uFEFE\u6765\uFEFE\uFEFE\u5585\uFEFE\uFEFE" + - "\u5B6E\uFEFE\u53EB\u6656\uFFFF\b\uFEFE\u6663\uFEFE\u5FC8\u5B42\uFEFE\u5DC8\uFEFE\u5DF5\uFEFE" + - "\uFEFE\u6B6D\uFFFF\u0005\uFEFE\u6B97\uFEFE\u5291\u6AB3\u6895\uFFFF\u0006\uFEFE\u5788\uFFFF\u0007" + - "\uFEFE\u5F4C\uFEFE\u5DE6\uFEFE\uFEFE\uFEFE\u69AB\uFFFF\u0004\uFEFE\u558E\u5456\uFFFF\u0005\uFEFE" + - "\u6BD4\uFFFF\u0006\uFEFE\u579A\uFEFE\u6842\uFFFF\u0006\uFEFE\u5789\u59CD\uFEFE\u6BC4\u627A\uFEFE" + - "\u5062\uFFFF\u0006\uFEFE\u5241\uFEFE\uFEFE\u6876\uFEFE\uFEFE\uFEFE\u6BF9\u54D5\uFEFE\u61CD\uFEFE" + - "\u5F58\u5BA0\u6996\u5F8A\u664B\uFEFE\uFEFE\u6689\u52D8\uFEFE\uFEFE\u57B0\uFFFF\t\uFEFE\u697E" + - "\uFEFE\u69C2\uFEFE\uFEFE\uFEFE\u6B6E\u6662\uFEFE\uFEFE\u69B9\uFEFE\u5292\uFEFE\u54F8\u5652\u69CE" + - "\uFEFE\u55E5\uFFFF\t\uFEFE\u6A9A\uFFFF\u0007\uFEFE\u6BAD\uFFFF\u0004\uFEFE\u6B61\u69D3\u6497" + - "\uFEFE\uFEFE\u6BE0\u5377\uFEFE\u6874\uFEFE\u5378\u58AB\u5DE7\uFEFE\u61AA\u687C\u6A6D\uFEFE\uFEFE" + - "\u5669\u5344\u5957\u64E6\uFEFE\u6BB3\uFEFE\u5856\uFFFF\u0004\uFEFE\u66C4\u6AB4\u6978\uFEFE\u6BA7" + - "\u5A90\u6157\uFFFF\u0005\uFEFE\u5EC7\uFFFF\t\uFEFE\u65AF\uFEFE\u5EAF\uFEFE\u53C4\u66AB\u5D93" + - "\u5EEE\uFEFE\u5A64\u5BB5\u55E6\uFEFE\u5E68\u5B4D\u5E4D\u5DCC\uFEFE\uFEFE\u627B\u6BDA\u5674\uFFFF" + - "\u0004\uFEFE\u54F9\uFFFF\u000E\uFEFE\u52F6\uFEFE\uFEFE\uFEFE\u6896\u5653\uFEFE\uFEFE\uFEFE\u5A91" + - "\uFEFE\u694F\uFEFE\u604C\uFFFF\f\uFEFE\u5661\uFEFE\uFEFE\uFEFE\u6BED\uFEFE\u579B\u515E\uFEFE" + - "\u627C\uFEFE\u5379\uFEFE\u686B\uFEFE\u585B\u62B9\uFEFE\u6B71\uFFFF\u0005\uFEFE\u66F3\uFEFE\u69CF" + - "\uFEFE\uFEFE\u6A46\uFEFE\uFEFE\uFEFE\u69D4\uFEFE\uFEFE\uFEFE\u5A47\uFEFE\u5A92\uFFFF\u0006\uFEFE" + - "\u6B89\uFEFE\uFEFE\uFEFE\u515F\uFFFF\u0004\uFEFE\u55BC\uFFFF\u0004\uFEFE\u5D95\uFEFE\uFEFE\uFEFE" + - "\u51E8\uFEFE\u62BA\uFEFE\u51D5\uFEFE\uFEFE\uFEFE\u66AC\uFEFE\u658B\u64F2\uFEFE\uFEFE\u5DDC\uFFFF" + - "\u0007\uFEFE\u5DD4\uFFFF\b\uFEFE\u5FC9\uFFFF\t\uFEFE\u587A\uFEFE\u63CF\u50F5\uFFFF\u0007" + - "\uFEFE\u5293\uFFFF\u0004\uFEFE\u6246\uFEFE\uFEFE\uFEFE\u5DD7\uFEFE\uFEFE\u508F\uFEFE\u5C57\u636E" + - "\uFEFE\uFEFE\uFEFE\u5A4F\uFEFE\uFEFE\uFEFE\u59CE\uFEFE\u5A50\u5AE4\uFEFE\u5E69\uFEFE\uFEFE\u588A" + - "\u6AB0\uFEFE\uFEFE\uFEFE\u60B5\u5EEF\u5098\u5BFB\uFEFE\uFEFE\uFEFE\u53AA\u60B6\uFEFE\u60F5\uFFFF" + - "\f\uFEFE\u688E\uFEFE\uFEFE\u5160\uFEFE\u517E\uFEFE\uFEFE\u5DFC\uFEFE\u6B62\uFEFE\u68FA\u57B1" + - "\uFFFF\u0004\uFEFE\u55E7\uFEFE\u6B83\u63E4\u5758\uFFFF\u0004\uFEFE\u65A3\uFEFE\uFEFE\u5542\u6797" + - "\uFEFE\uFEFE\uFEFE\u5841\uFFFF\u0004\uFEFE\u61ED\u5F8B\uFFFF\u0004\uFEFE\u66D8\u5449\uFEFE\u537A" + - "\uFEFE\u684F\uFFFF\u0004\uFEFE\u537B\uFFFF\u0006\uFEFE\u50A5\u61CE\uFEFE\uFEFE\u6377\u65A4\uFEFE" + - "\uFEFE\u5AE5\u5AE6\uFEFE\u5F6F\uFFFF\u000B\uFEFE\u59CF\uFFFF\u0007\uFEFE\u50B8\uFFFF\u0005\uFEFE" + - "\u5D4F\uFFFF\u0005\uFEFE\u6572\u659A\u5090\uFEFE\u5FCA\uFEFE\uFEFE\u53EC\u627D\uFEFE\uFEFE\u54A7" + - "\u6080\u6291\uFEFE\uFEFE\uFEFE\u6843\uFEFE\uFEFE\u587B\uFEFE\u6247\uFFFF\u0005\uFEFE\u5F8C\uFFFF" + - "\u0004\uFEFE\u5CDA\uFEFE\u645E\u67A5\uFEFE\uFEFE\u54B0\u5161\uFEFE\u64CC\uFFFF\u0006\uFEFE\u5654" + - "\u625D\uFFFF\f\uFEFE\u53F6\uFEFE\u5675\u566A\u645F\uFFFF\u0005\uFEFE\u5958\uFEFE\u519B\uFEFE" + - "\uFEFE\uFEFE\u69FA\uFFFF\f\uFEFE\u5CDB\uFFFF\u000B\uFEFE\u69C3\uFFFF\u0005\uFEFE\u5DCD\u6348" + - "\u62E4\u6988\uFEFE\u55E8\uFEFE\u5B70\u65B8\uFFFF\f\uFEFE\u604D\uFFFF\u0006\uFEFE\u695E\uFFFF" + - "\u0006\uFEFE\u55CE\uFFFF\t\uFEFE\u5C8E\uFEFE\u5071\uFEFE\uFEFE\uFEFE\u5EF0\uFEFE\uFEFE\uFEFE" + - "\u585C\uFEFE\u555A\uFFFF\b\uFEFE\u6460\uFEFE\uFEFE\u6B65\uFFFF\u0004\uFEFE\u54CB\uFEFE\uFEFE" + - "\u5A93\uFEFE\uFEFE\uFEFE\u5DD5\uFEFE\u60B7\uFFFF\u0005\uFEFE\u517F\uFEFE\uFEFE\u54C2\u57C0\u57F9" + - "\u57FA\uFEFE\uFEFE\u617E\uFEFE\uFEFE\u6093\uFEFE\u50B9\u674B\uFFFF\u0006\uFEFE\u5261\uFEFE\u519C" + - "\uFEFE\uFEFE\u66AD\uFFFF\u0006\uFEFE\u5CA5\uFEFE\uFEFE\uFEFE\u66AE\uFFFF\u000F\uFEFE\u659B\uFFFF" + - "\u000B\uFEFE\u63D0\uFFFF\u0004\uFEFE\u56D7\uFEFE\uFEFE\u5E80\u57EA\uFEFE\uFEFE\u58EC\uFEFE\u5D96" + - "\uFEFE\u5F96\uFFFF\u0007\uFEFE\u65D9\uFEFE\uFEFE\uFEFE\u50BA\uFFFF\u0004\uFEFE\u5AC1\u5475\uFEFE" + - "\u5FEA\u56BE\uFEFE\u627E\uFEFE\u5091\u57B2\u51EB\uFEFE\u55A3\uFFFF\u0006\uFEFE\u56F7\uFEFE\uFEFE" + - "\uFEFE\u56BF\uFEFE\u626D\uFEFE\uFEFE\uFEFE\u59F4\uFEFE\uFEFE\uFEFE\u6989\uFEFE\u5BA1\uFEFE\uFEFE" + - "\u5AC2\uFEFE\uFEFE\u56C8\uFEFE\uFEFE\uFEFE\u6BB4\u5779\uFEFE\u5072\uFFFF\u000F\uFEFE\u56AE\uFEFE" + - "\uFEFE\u627F\uFEFE\u56C9\uFFFF\u0004\uFEFE\u5FCB\uFEFE\uFEFE\uFEFE\u6664\uFFFF\r\uFEFE\u52C5" + - "\u56EB\uFEFE\u617F\uFEFE\u5C7E\uFEFE\uFEFE\uFEFE\u62B1\uFFFF\f\uFEFE\u6BD2\uFFFF\r\uFEFE" + - "\u60F6\uFFFF\u0005\uFEFE\u5B71\uFEFE\u548A\uFEFE\u5959\u56F8\uFEFE\u5DA1\uFEFE\uFEFE\u6378\uFFFF" + - "\r\uFEFE\u5476\uFFFF\u0004\uFEFE\u51A0\u5DA2\uFFFF\u000B\uFEFE\u6280\uFFFF\u0005\uFEFE\u6975" + - "\uFFFF\f\uFEFE\u568A\uFFFF\u0006\uFEFE\u586E\uFFFF\u0006\uFEFE\u5BA2\u55CF\uFEFE\uFEFE\u684B" + - "\uFEFE\uFEFE\u54A8\uFFFF\u0007\uFEFE\u636F\u50E3\u519E\uFEFE\u5294\uFFFF\u0007\uFEFE\u5741\uFFFF" + - "\u000F\uFEFE\u63B1\uFEFE\uFEFE\uFEFE\u56EC\u5356\uFFFF\u0005\uFEFE\u5BDA\u5F70\uFEFE\u625E\uFEFE" + - "\u5BFC\uFEFE\u5295\uFEFE\uFEFE\uFEFE\u53E0\u5DF8\u5262\uFEFE\uFEFE\uFEFE\u5A7D\uFFFF\u000E\uFEFE" + - "\u59AF\uFFFF\t\uFEFE\u638A\uFFFF\u0005\uFEFE\u595A\uFFFF\u0012\uFEFE\u625F\u62EE\u6479\uFFFF" + - "\u0004\uFEFE\u566E\uFFFF\u0005\uFEFE\u6573\uFEFE\u64E7\uFFFF\u0010\uFEFE\u52D9\uFFFF\t\uFEFE" + - "\u5D67\uFFFF\r\uFEFE\u639D\uFFFF\r\uFEFE\u55E9\u5162\uFEFE\uFEFE\u5D68\uFFFF\f\uFEFE" + - "\u58FD\uFFFF\u0004\uFEFE\u537C\uFFFF\u0005\uFEFE\u60F7\uFFFF\u0004\uFEFE\u55B0\u5CA7\u5B4E\uFEFE" + - "\uFEFE\u595B\uFEFE\u5457\uFEFE\uFEFE\uFEFE\u5DE8\uFFFF\u000B\uFEFE\u507F\uFEFE\uFEFE\uFEFE\u585D" + - "\uFEFE\u5A7E\uFFFF\u0010\uFEFE\u66E3\u66E4\u696C\uFFFF\u0004\uFEFE\u5FCC\uFEFE\uFEFE\uFEFE\u698E" + - "\uFFFF\u0004\uFEFE\u55C1\u62AA\uFEFE\uFEFE\u5180\uFEFE\u698A\uFFFF\t\uFEFE\u60B8\uFFFF\r" + - "\uFEFE\u5676\uFEFE\uFEFE\uFEFE\u5163\uFEFE\uFEFE\u537D\uFFFF\u0005\uFEFE\u6848\uFFFF\u0005\uFEFE" + - "\u57B3\uFFFF\u0005\uFEFE\u639E\uFFFF\f\uFEFE\u639F\uFFFF\u0007\uFEFE\u6A47\uFEFE\uFEFE\u5CA8" + - "\uFFFF\u0010\uFEFE\u555B\u556C\u57B4\uFFFF\r\uFEFE\u5BDB\uFEFE\uFEFE\uFEFE\u59AC\uFEFE\u59AB" + - "\u6897\uFFFF\u0005\uFEFE\u537E\u537F\u6261\uFFFF\u0006\uFEFE\u5E81\uFFFF\u0005\uFEFE\u6180\u6260" + - "\uFEFE\uFEFE\u6181\u6859\u66AF\u63E3\u5BFD\u5B6F\u59AD\uFFFF\u0004\uFEFE\u59FB\uFEFE\uFEFE\u658C" + - "\uFFFF\u0004\uFEFE\u6159\uFFFF\f\uFEFE\u5380\uFFFF\u0004\uFEFE\u6958\uFEFE\u5345\uFFFF\u000B" + - "\uFEFE\u66D7\u60F8\u5897\uFEFE\u5E82\uFFFF\u0014\uFEFE\u5CE8\u67BE\uFEFE\uFEFE\u5A8F\uFEFE\uFEFE" + - "\uFEFE\u559A\uFEFE\uFEFE\u5477\uFEFE\u69F5\uFFFF\u0005\uFEFE\u5E83\uFEFE\u5655\uFEFE\u5346\u66D9" + - "\u548B\u5B73\u59B0\uFFFF\u0007\uFEFE\u587D\u53B7\u63D1\uFFFF\u0005\uFEFE\u51D6\u63A0\uFEFE\uFEFE" + - "\u69A7\uFEFE\uFEFE\u595C\uFFFF\u0006\uFEFE\u6182\uFFFF\u0004\uFEFE\u647D\uFEFE\u6281\u5C9C\uFEFE" + - "\u6292\uFFFF\u0011\uFEFE\u5F8D\uFFFF\u0004\uFEFE\u67BF\uFFFF\u0004\uFEFE\u5ACD\uFEFE\uFEFE\u5073" + - "\uFEFE\uFEFE\u60F9\uFEFE\u63A1\uFFFF\u0006\uFEFE\u5FB4\uFEFE\uFEFE\u64FE\uFEFE\u626E\u6462\uFEFE" + - "\u5642\uFEFE\uFEFE\u6592\u6183\uFFFF\r\uFEFE\u61AB\uFEFE\uFEFE\u647E\uFFFF\u0004\uFEFE\u5E90" + - "\u626F\uFEFE\uFEFE\uFEFE\u5478\u5050\u5182\uFEFE\u519F\u51B4\uFFFF\u0005\uFEFE\u56F9\uFEFE\uFEFE" + - "\u6BAB\uFEFE\uFEFE\uFEFE\u6094\u6A7C\uFFFF\b\uFEFE\u5B74\uFFFF\t\uFEFE\u5A4B\u6A88\uFFFF" + - "\u0006\uFEFE\u5DCE\uFEFE\u66E5\uFFFF\u0004\uFEFE\u5CD9\uFEFE\uFEFE\uFEFE\u666F\uFEFE\u5296\uFEFE" + - "\uFEFE\u52BB\u51D0\uFEFE\uFEFE\u60FA\uFEFE\u6357\uFEFE\u5499\uFEFE\u60CC\u62B2\uFEFE\uFEFE\uFEFE" + - "\u5E4E\uFFFF\t\uFEFE\u628C\u62E5\uFEFE\u6184\uFEFE\uFEFE\u52B0\uFFFF\u0006\uFEFE\u52B8\uFFFF" + - "\t\uFEFE\u5DDD\u6A97\uFEFE\uFEFE\uFEFE\u52BC\u5E4F\uFFFF\n\uFEFE\u52DA\uFFFF\u0004\uFEFE" + - "\u55F8\uFFFF\u0004\uFEFE\u62BB\u688C\uFEFE\u54B1\u6185\uFEFE\u60CD\u566F\uFFFF\u000B\uFEFE\u697B" + - "\uFEFE\u62D1\uFEFE\uFEFE\uFEFE\u587C\uFEFE\u5164\u604E\uFEFE\uFEFE\u61EE\uFEFE\u54A6\uFFFF\u0004" + - "\uFEFE\u5B75\uFEFE\uFEFE\u5080\uFEFE\u53E1\uFFFF\u0006\uFEFE\u5165\uFEFE\uFEFE\u61E1\u63E5\uFFFF" + - "\u0004\uFEFE\u5074\uFFFF\b\uFEFE\u5351\uFEFE\u6186\uFFFF\u0004\uFEFE\u66C8\uFEFE\u5AE7\uFFFF" + - "\u0007\uFEFE\u5A52\uFEFE\u6095\uFEFE\uFEFE\u64B8\uFEFE\u5670\uFFFF\u0004\uFEFE\u59B1\u58CA\uFFFF" + - "\u0005\uFEFE\u615A\u6952\uFFFF\u000B\uFEFE\u5ACE\uFFFF\f\uFEFE\u65A5\uFEFE\uFEFE\u54C3\uFEFE" + - "\u52F7\u6B63\u5BA3\uFEFE\u5849\u5242\u63E6\u64CD\uFEFE\u53FD\uFEFE\u62F6\uFFFF\t\uFEFE\u52E2" + - "\uFFFF\u000B\uFEFE\u5AC3\uFEFE\u69B5\uFFFF\u0006\uFEFE\u5D69\uFFFF\u0007\uFEFE\u6A92\uFFFF\t" + - "\uFEFE\u50BB\uFEFE\uFEFE\uFEFE\u60B9\uFEFE\uFEFE\uFEFE\u606E\uFEFE\uFEFE\u63D2\uFEFE\u579C\u5381" + - "\uFEFE\u59D0\uFEFE\uFEFE\u62A3\uFEFE\u51D1\u5145\uFEFE\uFEFE\uFEFE\u51EC\uFFFF\u000B\uFEFE\u60BA" + - "\uFEFE\uFEFE\uFEFE\u59FC\uFEFE\uFEFE\u5FEF\uFEFE\uFEFE\uFEFE\u6081\uFFFF\u0007\uFEFE\u60CE\u674C" + - "\uFEFE\uFEFE\u5853\uFEFE\u60BB\u654D\uFEFE\u63E7\uFEFE\u667B\u677C\uFFFF\u0005\uFEFE\u69DE\uFFFF" + - "\b\uFEFE\u5CC5\uFFFF\u0004\uFEFE\u69C4\uFEFE\uFEFE\uFEFE\u548C\uFEFE\u595D\uFEFE\uFEFE\u59B2" + - "\uFFFF\u0016\uFEFE\u62F7\uFFFF\u0006\uFEFE\u619B\uFFFF\n\uFEFE\u6B8E\uFFFF\u000B\uFEFE\u53E2" + - "\uFEFE\uFEFE\u5075\uFFFF\u0005\uFEFE\u6BEE\uFEFE\uFEFE\u5FF0\u5AE8\uFFFF\u000B\uFEFE\u6370\uFFFF" + - "\u0005\uFEFE\u6B99\u5584\u58C8\uFEFE\uFEFE\uFEFE\u54EB\uFFFF\b\uFEFE\u61D0\u6096\uFFFF\u0011" + - "\uFEFE\u55C2\u55BD\uFEFE\uFEFE\uFEFE\u6371\u5CC6\uFFFF\u0006\uFEFE\u5657\uFFFF\u0006\uFEFE\u577A" + - "\uFFFF\u000F\uFEFE\u69A8\uFFFF\u0005\uFEFE\u58ED\uFFFF\b\uFEFE\u5671\uFEFE\uFEFE\u579E\uFEFE" + - "\u6187\u60D6\uFFFF\u0006\uFEFE\u5AFA\uFEFE\uFEFE\u5FCD\uFEFE\uFEFE\u61E2\uFEFE\u604F\uFFFF\u0006" + - "\uFEFE\u554A\uFEFE\uFEFE\u554B\u62BD\u50C2\uFFFF\u0005\uFEFE\u5B76\uFFFF\u0004\uFEFE\u60FC\uFFFF" + - "\u000B\uFEFE\u66B0\uFFFF\u000B\uFEFE\u544A\uFFFF\u0005\uFEFE\u577B\uFEFE\u58EE\u6188\u50A8\uFFFF" + - "\u0006\uFEFE\u554C\uFFFF\u0007\uFEFE\u53A0\uFFFF\u0004\uFEFE\u6097\uFEFE\u6189\uFFFF\u0004\uFEFE" + - "\u5183\uFEFE\uFEFE\u52DC\uFEFE\u5382\uFEFE\u61D1\uFEFE\u5CC7\u66D0\u6AB5\u67A8\u66F4\uFEFE\u5768" + - "\u5767\uFEFE\u53AB\uFEFE\uFEFE\u53CE\uFEFE\uFEFE\uFEFE\u5BA4\uFEFE\uFEFE\u59B4\u5252\u6262\u5352" + - "\u58EF\uFFFF\u0004\uFEFE\u5AE9\u57D3\u5A4C\uFFFF\b\uFEFE\u5FCE\u61D2\uFEFE\u6B8F\u55DB\u5ACF" + - "\uFEFE\uFEFE\u5BFE\uFEFE\u6B56\uFEFE\uFEFE\uFEFE\u5AEA\u5092\uFFFF\u0007\uFEFE\u61AC\u6665\u618A" + - "\u5166\u57B5\uFFFF\t\uFEFE\u50FE\uFFFF\n\uFEFE\u618B\uFEFE\uFEFE\u5263\uFEFE\uFEFE\u54D6" + - "\u6666\uFEFE\uFEFE\uFEFE\u5353\uFEFE\u5F51\uFEFE\u6AFE\uFEFE\uFEFE\uFEFE\u5A65\uFEFE\uFEFE\u64CE" + - "\u59B5\u6850\uFEFE\uFEFE\u60CF\uFEFE\uFEFE\u50F6\uFFFF\u0005\uFEFE\u5297\uFEFE\uFEFE\uFEFE\u63A2" + - "\uFFFF\n\uFEFE\u6B6F\u5B77\uFEFE\uFEFE\uFEFE\u5167\uFFFF\b\uFEFE\u61AD\uFEFE\uFEFE\uFEFE" + - "\u55B2\uFEFE\u61D3\uFFFF\t\uFEFE\u5B78\u5EF1\uFEFE\uFEFE\uFEFE\u50A6\u569E\uFEFE\u6367\u62EF" + - "\uFEFE\uFEFE\u55F2\uFEFE\u5383\u64A2\uFEFE\u5FE2\u5643\u56CA\uFFFF\u0007\uFEFE\u6463\uFEFE\uFEFE" + - "\u5394\u595E\uFFFF\n\uFEFE\u5A66\uFEFE\u65D4\uFEFE\u5A94\uFEFE\uFEFE\u629C\u53E3\uFEFE\u638B" + - "\u6987\uFEFE\u5D6A\uFEFE\uFEFE\u5BDD\uFEFE\u654E\u5DE9\uFEFE\uFEFE\u56CB\uFEFE\uFEFE\u5EC8\uFFFF" + - "\u0004\uFEFE\u5574\uFFFF\u0006\uFEFE\u6464\uFFFF\r\uFEFE\u6282\u69ED\uFFFF\n\uFEFE\u6A95" + - "\uFFFF\u0005\uFEFE\u579D\uFEFE\u6B84\u66B1\u6AAA\uFEFE\u6B55\uFEFE\u6667\uFFFF\u0007\uFEFE\u58AE" + - "\uFEFE\uFEFE\u63E8\u6A5F\uFEFE\u61AE\uFFFF\u0005\uFEFE\u55DC\uFFFF\u0005\uFEFE\u63BE\u6098\uFEFE" + - "\uFEFE\u5843\uFEFE\u58FE\uFEFE\uFEFE\u5759\u5E50\uFFFF\n\uFEFE\u6B7B\uFEFE\u6270\u5A95\uFFFF" + - "\b\uFEFE\u5E51\uFEFE\uFEFE\u5B79\uFFFF\u0007\uFEFE\u5BC5\u675F\u5184\uFEFE\u50F7\uFEFE\uFEFE" + - "\u618C\uFFFF\b\uFEFE\u5D50\uFEFE\uFEFE\u5185\uFFFF\u0005\uFEFE\u62BC\uFFFF\t\uFEFE\u5AFB" + - "\uFEFE\uFEFE\u60BC\uFEFE\uFEFE\uFEFE\u5D97\u6067\uFEFE\u5AB0\uFEFE\u62BE\uFEFE\uFEFE\u548D\u54EC" + - "\uFFFF\u0099\uFEFE\u58C9\uFEFE\u65E8\uFEFE\u5141\uFFFF\u0011\uFEFE\u5CB5\uFEFE\uFEFE\uFEFE\u51ED" + - "\uFEFE\uFEFE\uFEFE\u569F\u65C3\uFEFE\uFEFE\u58CB\uFFFF\u0011\uFEFE\u61B9\u5247\uFEFE\uFEFE\u6465" + - "\uFEFE\u584A\uFEFE\u5A67\uFEFE\uFEFE\u56AF\uFEFE\u64E8\uFEFE\u5656\uFFFF\u000B\uFEFE\u54CC\uFEFE" + - "\uFEFE\u6898\uFEFE\u5CDC\uFEFE\u6851\uFEFE\u577C\uFFFF\u0005\uFEFE\u6871\uFEFE\uFEFE\uFEFE\u5CDD" + - "\uFEFE\u558F\uFEFE\uFEFE\uFEFE\u5B7A\uFFFF\u0005\uFEFE\u52B1\uFEFE\uFEFE\uFEFE\u5A96\u5F76\uFFFF" + - "\u0005\uFEFE\u5082\uFEFE\uFEFE\u67C0\uFFFF\u0005\uFEFE\u6968\u50C3\uFEFE\uFEFE\uFEFE\u5E84\uFEFE" + - "\uFEFE\uFEFE\u5DD8\uFEFE\uFEFE\uFEFE\u5BDE\uFFFF\u0004\uFEFE\u5F97\uFEFE\u5F98\uFEFE\u5590\uFEFE" + - "\uFEFE\uFEFE\u5BBB\uFEFE\u59FD\u6C41\uFFFF\t\uFEFE\u6B5C\u6445\u595F\uFFFF\u0004\uFEFE\u60BD" + - "\uFEFE\uFEFE\u654F\uFEFE\u5DEA\uFFFF\u0004\uFEFE\u65C4\uFEFE\uFEFE\u5DA3\uFFFF\u0005\uFEFE\u5264" + - "\uFEFE\u5844\u5F95\uFEFE\uFEFE\uFEFE\u5E52\u55A4\uFEFE\u51A1\u56ED\u5FCF\u5385\uFEFE\uFEFE\u6880" + - "\uFEFE\uFEFE\u5F8E\uFEFE\uFEFE\uFEFE\u53B3\uFEFE\uFEFE\uFEFE\u5FD0\u5168\uFEFE\u56EE\u5E96\uFFFF" + - "\u0014\uFEFE\u5386\uFFFF\u0005\uFEFE\u5F8F\uFEFE\uFEFE\u5CC0\uFFFF\u0006\uFEFE\u64A7\uFEFE\u5169" + - "\uFEFE\uFEFE\uFEFE\u53F7\uFEFE\uFEFE\u6953\uFEFE\uFEFE\uFEFE\u55D1\uFFFF\u000B\uFEFE\u5AC4\uFEFE" + - "\u5982\uFEFE\u6446\uFEFE\uFEFE\uFEFE\u576C\uFFFF\u0010\uFEFE\u5575\u63BF\uFEFE\u5AC5\u5E6A\uFEFE" + - "\uFEFE\uFEFE\u6271\uFFFF\u0005\uFEFE\u637F\u55BE\u5F4F\uFFFF\u0004\uFEFE\u6AF0\u5B97\u59BF\u618D" + - "\uFEFE\u5F45\uFEFE\u55FA\u5387\uFFFF\t\uFEFE\u63A3\uFEFE\u61D4\uFEFE\u54B3\u65E9\uFEFE\u5078" + - "\uFEFE\uFEFE\uFEFE\u51A2\u6263\uFEFE\uFEFE\u5960\uFEFE\uFEFE\uFEFE\u50F2\u57D4\uFFFF\u0004\uFEFE" + - "\u5357\uFEFE\u5253\u5F46\uFEFE\u676F\uFFFF\u0005\uFEFE\u655E\uFFFF\b\uFEFE\u5EC9\u61D5\uFFFF" + - "\u0007\uFEFE\u57EC\uFEFE\u64B9\uFFFF\u0007\uFEFE\u57B6\uFEFE\uFEFE\uFEFE\u57EB\u5099\uFEFE\uFEFE" + - "\u6574\uFEFE\uFEFE\u66B2\uFEFE\uFEFE\u5F4D\u5A68\uFFFF\u000B\uFEFE\u5243\uFEFE\uFEFE\u54AA\uFEFE" + - "\uFEFE\uFEFE\u67A0\uFFFF\u0004\uFEFE\u53CF\uFFFF\u0004\uFEFE\u6264\uFEFE\uFEFE\u667D\u6447\u667C" + - "\u56B5\u56B6\u6349\uFFFF\r\uFEFE\u6A9B\uFEFE\u5063\u516A\uFFFF\u0007\uFEFE\u5BA5\uFFFF\u0005" + - "\uFEFE\u5B7B\uFEFE\u64A5\uFEFE\uFEFE\uFEFE\u6575\uFFFF\t\uFEFE\u62E6\uFFFF\u0004\uFEFE\u5962" + - "\uFFFF\f\uFEFE\u5CB1\uFEFE\uFEFE\u5C41\uFEFE\u58CD\u58CC\uFEFE\u5961\u50A9\u5DEB\uFFFF\u000F" + - "\uFEFE\u5AC6\u53C9\uFFFF\u0004\uFEFE\u61AF\uFFFF\u0004\uFEFE\u5E4A\u685D\uFFFF\u0006\uFEFE\u6050" + - "\u5899\u5A97\uFFFF\u0004\uFEFE\u64D1\u57D5\uFEFE\u555C\uFFFF\u0005\uFEFE\u6862\uFEFE\u579F\uFFFF" + - "\u0004\uFEFE\u51A3\uFFFF\n\uFEFE\u58CE\uFEFE\u567E\u5BB6\uFEFE\uFEFE\u5265\uFEFE\uFEFE\u6293" + - "\uFFFF\u0004\uFEFE\u6547\uFFFF\n\uFEFE\u5A98\uFEFE\u63FA\uFFFF\u0004\uFEFE\u5F6A\uFEFE\uFEFE" + - "\u53F8\u6760\u53C6\u54B9\uFEFE\u5963\uFEFE\uFEFE\uFEFE\u5CF1\uFFFF\u0006\uFEFE\u6158\uFFFF\n" + - "\uFEFE\u54F1\u5D6C\uFFFF\u0005\uFEFE\u6051\uFEFE\uFEFE\uFEFE\u5C42\uFEFE\u5DE1\uFEFE\u6B53\u566B" + - "\uFEFE\u5FD1\uFEFE\uFEFE\u6448\uFFFF\u0005\uFEFE\u6265\u6467\uFFFF\u0005\uFEFE\u5458\u6B85\u5299" + - "\uFEFE\u5EF2\uFEFE\uFEFE\uFEFE\u5E6B\uFEFE\uFEFE\u529A\uFEFE\u5D48\u67B0\uFEFE\u529B\uFEFE\u5AA4" + - "\u598A\uFFFF\u0004\uFEFE\u5A69\uFEFE\uFEFE\uFEFE\u6576\uFFFF\u0004\uFEFE\u6358\u5BA6\uFEFE\u575A" + - "\u61D6\uFEFE\u6852\uFFFF\b\uFEFE\u65EA\u57D6\u57B8\uFFFF\u0006\uFEFE\u63E9\uFEFE\u6488\u57A0" + - "\u6668\uFEFE\u5A99\uFFFF\u0006\uFEFE\u699E\uFFFF\u0004\uFEFE\u6A49\uFEFE\u60FD\uFFFF\u0010\uFEFE" + - "\u5AEB\u62E7\uFFFF\n\uFEFE\u5F77\uFEFE\u65D5\uFFFF\u0004\uFEFE\u55A5\uFEFE\uFEFE\u5076\u554D" + - "\uFEFE\u5077\u5A4D\uFEFE\uFEFE\uFEFE\u5D80\uFEFE\u6B9D\uFFFF\u0005\uFEFE\u5CA9\uFFFF\f\uFEFE" + - "\u5E85\uFEFE\u5FE3\u6884\uFEFE\uFEFE\uFEFE\u56A0\uFFFF\u0006\uFEFE\u58CF\u6947\uFEFE\uFEFE\u6266" + - "\uFEFE\u59DD\uFFFF\u0005\uFEFE\u50BC\u6BE1\uFEFE\uFEFE\u6892\uFEFE\uFEFE\u58F0\u64E9\u5DA4\u5C58" + - "\uFEFE\u66DB\uFEFE\u57D7\uFEFE\uFEFE\uFEFE\u6B7D\u5E97\u52F8\uFEFE\u63D3\u6979\u5C65\uFEFE\u6B50" + - "\uFFFF\u0011\uFEFE\u5EB0\u5D7F\u5591\u64BA\u6B9E\uFEFE\u574C\uFEFE\uFEFE\uFEFE\u5051\uFEFE\uFEFE" + - "\u6BBD\u529C\uFEFE\u6AF1\uFEFE\uFEFE\uFEFE\u5CC8\u51A4\u6082\uFFFF\t\uFEFE\u5D98\uFFFF\b" + - "\uFEFE\u56B0\u58D0\uFEFE\u6872\u6BC5\uFEFE\uFEFE\u61F4\u575B\u5854\u5052\u56EF\uFEFE\uFEFE\uFEFE" + - "\u6971\uFFFF\r\uFEFE\u56D8\uFFFF\u0010\uFEFE\u6B51\uFEFE\uFEFE\u56A1\uFEFE\uFEFE\uFEFE\u589A" + - "\uFEFE\u5B7C\uFEFE\uFEFE\u6BF0\u6B41\u53D5\uFEFE\u5E6C\u6A4A\uFFFF\u0006\uFEFE\u5BA7\uFFFF\u0006" + - "\uFEFE\u6BCF\uFEFE\u63A4\u668A\uFFFF\u0004\uFEFE\u5FB5\uFEFE\u5F90\u674D\uFFFF\u0020\uFEFE\u54B2" + - "\uFEFE\uFEFE\uFEFE\u65B1\uFEFE\uFEFE\uFEFE\u6099\uFFFF\r\uFEFE\u6969\u6052\uFEFE\uFEFE\uFEFE" + - "\u59B6\uFFFF\u0007\uFEFE\u516B\uFEFE\u5C43\uFFFF\u0005\uFEFE\u5DEC\uFEFE\uFEFE\uFEFE\u667E\uFFFF" + - "\u0006\uFEFE\u699F\u69E4\u567F\uFFFF\u0011\uFEFE\u56A2\uFEFE\uFEFE\uFEFE\u6380\uFEFE\uFEFE\uFEFE" + - "\u51EE\uFEFE\uFEFE\uFEFE\u6959\u52AD\uFEFE\u52E3\uFFFF\u0006\uFEFE\u51D7\uFEFE\uFEFE\u62E8\uFFFF" + - "\u0005\uFEFE\u62F0\uFEFE\uFEFE\u547A\uFFFF\t\uFEFE\u6997\uFEFE\u52F9\uFEFE\uFEFE\uFEFE\u66DC" + - "\u6873\u5644\u5964\uFEFE\u5C8F\uFFFF\u0004\uFEFE\u6B57\uFEFE\uFEFE\uFEFE\u5B98\uFFFF\u0005\uFEFE" + - "\u63FB\u5479\uFFFF\u0005\uFEFE\u54FD\uFEFE\u56C0\u6556\u5ECA\uFFFF\u001A\uFEFE\u63D4\uFEFE\uFEFE" + - "\u568B\uFFFF\u0004\uFEFE\u6788\uFFFF\u0006\uFEFE\u5EF3\uFEFE\uFEFE\uFEFE\u5C76\u54D7\uFFFF\u000B" + - "\uFEFE\u5D86\uFFFF\u0007\uFEFE\u58AF\uFFFF\u0005\uFEFE\u6083\uFEFE\uFEFE\uFEFE\u5083\uFFFF\u0005" + - "\uFEFE\u6577\uFEFE\u54A9\uFEFE\uFEFE\u5ECB\uFFFF\u0004\uFEFE\u66B3\u6053\uFEFE\uFEFE\u5CC9\uFEFE" + - "\u63C0\uFEFE\uFEFE\uFEFE\u52DB\uFFFF\u0004\uFEFE\u61FE\uFFFF\u0015\uFEFE\u5B7D\uFEFE\uFEFE\uFEFE" + - "\u5BDF\uFFFF\u0004\uFEFE\u5742\uFEFE\uFEFE\u59D1\uFFFF\u0004\uFEFE\u57D8\uFFFF\u0010\uFEFE\u6578" + - "\uFFFF\u0005\uFEFE\u6248\u5146\uFEFE\u69F0\u62E9\uFEFE\uFEFE\u6BE2\u69C9\uFEFE\u6976\uFEFE\u63EA" + - "\uFEFE\u5A7F\uFEFE\uFEFE\u5E6D\uFEFE\u50BD\uFEFE\u5BE0\uFEFE\uFEFE\uFEFE\u59B3\uFFFF\u0004\uFEFE" + - "\u659C\uFEFE\uFEFE\uFEFE\u5B7E\uFFFF\u0011\uFEFE\u58B0\uFEFE\u5576\uFFFF\u0005\uFEFE\u69D8\uFFFF" + - "\u0007\uFEFE\u55D2\uFFFF\u0014\uFEFE\u56CF\uFEFE\u568C\u589B\uFEFE\uFEFE\u5FD2\u59DE\uFEFE\u5E9D" + - "\uFEFE\uFEFE\uFEFE\u695F\u61CF\uFEFE\u62F1\uFEFE\u6054\uFEFE\u6BA2\uFFFF\u0006\uFEFE\u5AEC\u5F60" + - "\uFEFE\u6B86\uFFFF\r\uFEFE\u655F\uFEFE\u6AC6\uFEFE\u68F8\uFEFE\u5845\uFFFF\u0005\uFEFE\u63A5" + - "\uFEFE\u5DA5\uFEFE\uFEFE\u5266\uFFFF\u0004\uFEFE\u6ABE\uFFFF\u0004\uFEFE\u5E53\u6694\uFFFF\u0007" + - "\uFEFE\u58F1\uFEFE\u69D9\u5EF4\uFEFE\uFEFE\uFEFE\u6888\u64AF\u575C\uFEFE\uFEFE\u5AED\uFFFF\u0010" + - "\uFEFE\u55C3\uFEFE\u5DCF\uFEFE\uFEFE\uFEFE\u57A1\uFEFE\uFEFE\u577D\uFFFF\u0007\uFEFE\u6AE6\uFEFE" + - "\u50AA\uFEFE\uFEFE\u6055\uFFFF\u0006\uFEFE\u5AAB\uFFFF\n\uFEFE\u6359\uFEFE\u6786\u59D6\u5C44" + - "\uFFFF\u0004\uFEFE\u5A6A\u6784\uFFFF\t\uFEFE\u615B\uFFFF\u0006\uFEFE\u51A5\uFFFF\u0007\uFEFE" + - "\u5FD3\uFEFE\uFEFE\uFEFE\u54ED\u69E1\u6056\uFFFF\u0005\uFEFE\u6AB6\uFFFF\u0006\uFEFE\u555D\u5DA6" + - "\uFFFF\u0006\uFEFE\u54C4\u5CCA\uFEFE\uFEFE\uFEFE\u5846\u5B7F\uFFFF\f\uFEFE\u6084\uFEFE\uFEFE" + - "\u5662\u618E\uFEFE\uFEFE\uFEFE\u51DF\uFEFE\uFEFE\u5DA7\uFEFE\uFEFE\uFEFE\u55A6\u5AEE\uFEFE\uFEFE" + - "\u5DD0\u597A\uFFFF\n\uFEFE\u69FB\u6993\uFEFE\uFEFE\u5A9A\uFFFF\u0012\uFEFE\u54E1\uFFFF\u0011" + - "\uFEFE\u54CD\uFFFF\u000E\uFEFE\u66B4\uFEFE\u65B9\uFEFE\uFEFE\uFEFE\u50D9\u62FC\uFFFF\u0005\uFEFE" + - "\u6652\u55A7\uFEFE\u5E86\u66B5\uFFFF\u0007\uFEFE\u6798\uFFFF\t\uFEFE\u5BB7\uFFFF\u0007\uFEFE" + - "\u66D1\uFFFF\u0010\uFEFE\u5769\uFEFE\u57D9\uFFFF\u0006\uFEFE\u6B43\uFEFE\u5FF1\uFFFF\r\uFEFE" + - "\u6877\u618F\uFFFF\u0004\uFEFE\u6BAC\u54B4\uFFFF\u001B\uFEFE\u6085\u59B7\uFEFE\u5592\uFEFE\u53E4" + - "\uFFFF\b\uFEFE\u6761\uFFFF\u0004\uFEFE\u5DDE\uFEFE\u61D7\uFEFE\uFEFE\uFEFE\u5267\uFFFF\u0004" + - "\uFEFE\u65DA\uFFFF\b\uFEFE\u6294\uFFFF\u000B\uFEFE\u5E6E\uFFFF\u0004\uFEFE\u5C66\uFEFE\u63B2" + - "\uFEFE\u58B1\u5C45\uFFFF\u0004\uFEFE\u5DC1\u58D1\uFFFF\u000E\uFEFE\u6267\uFEFE\u5965\uFEFE\u578D" + - "\uFFFF\u0017\uFEFE\u634A\uFFFF\u0006\uFEFE\u6381\uFEFE\uFEFE\uFEFE\u5EB1\uFFFF\f\uFEFE\u51D8" + - "\uFEFE\u6849\uFFFF\u0006\uFEFE\u69DF\uFEFE\u674E\uFEFE\u6550\uFFFF\u0005\uFEFE\u5ECC\u589D\uFFFF" + - "\u0005\uFEFE\u65B0\uFEFE\u5BB8\uFFFF\u000B\uFEFE\u66B6\uFEFE\u60DB\uFEFE\u5DDF\uFFFF\t\uFEFE" + - "\u54FA\uFFFF\n\uFEFE\u5F52\uFFFF\u0011\uFEFE\u56D9\uFEFE\uFEFE\u668B\uFFFF\n\uFEFE\u5658" + - "\uFFFF\u0005\uFEFE\u68FC\uFFFF\u0006\uFEFE\u54CE\uFFFF\u0005\uFEFE\u5B43\uFEFE\uFEFE\uFEFE\u647C" + - "\uFEFE\uFEFE\u5677\uFFFF\u0018\uFEFE\u57B7\uFFFF\u000B\uFEFE\u5A9B\uFEFE\uFEFE\u5E54\uFEFE\uFEFE" + - "\u63F6\uFFFF\u0004\uFEFE\u544B\uFEFE\u65F8\uFEFE\u5F78\uFEFE\uFEFE\u5AB1\uFFFF\u0006\uFEFE\u5BC6" + - "\uFFFF\u000F\uFEFE\u5D6D\uFFFF\t\uFEFE\u54F2\uFEFE\u5560\u61EF\u555F\uFFFF\r\uFEFE\u519D" + - "\uFFFF\u0004\uFEFE\u5FF2\uFFFF\u0004\uFEFE\u568D\uFFFF\u0004\uFEFE\u6670\uFFFF\u0005\uFEFE\u61F7" + - "\uFFFF\u0005\uFEFE\u6646\u5D6E\uFFFF\u0004\uFEFE\u6669\u5BB0\uFEFE\uFEFE\uFEFE\u5053\uFEFE\u5C67" + - "\uFEFE\u5ECD\uFEFE\u63F7\u5ECE\uFEFE\uFEFE\u668C\u529D\u5F79\uFFFF\u0004\uFEFE\u658D\uFEFE\uFEFE" + - "\u59DC\uFFFF\u0004\uFEFE\u5B50\uFEFE\u68BB\uFFFF\u0004\uFEFE\u63F8\uFFFF\u0006\uFEFE\u5348\u5347" + - "\uFEFE\u5EB2\u56DC\uFFFF\u0005\uFEFE\u5054\uFEFE\uFEFE\u5459\uFEFE\u6579\uFFFF\u0004\uFEFE\u53E5" + - "\uFEFE\uFEFE\uFEFE\u5B80\u6B87\uFFFF\u0006\uFEFE\u51BE\uFFFF\f\uFEFE\u659D\uFFFF\b\uFEFE" + - "\u51A6\uFFFF\f\uFEFE\u6068\u557F\uFEFE\uFEFE\u6057\uFFFF\t\uFEFE\u5659\uFFFF\u0004\uFEFE" + - "\u5DA8\u5EF5\uFEFE\uFEFE\uFEFE\u6883\uFEFE\uFEFE\u588B\u6058\uFEFE\u59B8\uFEFE\u696A\uFFFF\u0006" + - "\uFEFE\u5966\uFFFF\n\uFEFE\u59FE\u57EE\u57ED\uFEFE\uFEFE\u54CF\uFFFF\u0004\uFEFE\u615C\uFFFF" + - "\t\uFEFE\u589E\uFFFF\b\uFEFE\u5081\uFEFE\u657A\u588C\uFFFF\u0004\uFEFE\u6AC7\u57EF\uFFFF" + - "\u000B\uFEFE\u5E5E\uFFFF\u0004\uFEFE\u64D2\uFFFF\u000B\uFEFE\u5BBC\uFEFE\u55DD\uFEFE\uFEFE\u69BD" + - "\uFFFF\u0005\uFEFE\u50A7\uFEFE\uFEFE\u5CDE\uFFFF\u001A\uFEFE\u5349\uFFFF\u0004\uFEFE\u54EE\uFFFF" + - "\u0005\uFEFE\u5697\uFFFF\u0007\uFEFE\u5BBD\uFFFF\f\uFEFE\u5A6B\uFEFE\u5E55\uFEFE\u53F9\uFEFE" + - "\uFEFE\u589C\u6543\uFEFE\uFEFE\uFEFE\u50F8\uFEFE\uFEFE\uFEFE\u52DD\uFEFE\uFEFE\uFEFE\u56C2\uFEFE" + - "\uFEFE\u5BDC\uFFFF\n\uFEFE\u50EE\uFFFF\u0007\uFEFE\u6943\u646F\uFFFF\u0004\uFEFE\u529E\uFEFE" + - "\uFEFE\u52FA\uFFFF\u0007\uFEFE\u5064\uFEFE\uFEFE\u54EF\uFEFE\uFEFE\u51EF\uFFFF\u0011\uFEFE\u5065" + - "\uFFFF\t\uFEFE\u5FD4\uFFFF\u0006\uFEFE\u65F9\uFFFF\u0010\uFEFE\u5A41\uFEFE\uFEFE\uFEFE\u63B3" + - "\uFFFF\u0007\uFEFE\u5CF6\uFEFE\u60FE\u58D2\uFFFF\u0004\uFEFE\u5186\uFEFE\u5C46\uFEFE\u66D2\uFEFE" + - "\u64C8\uFFFF\u0004\uFEFE\u6785\uFEFE\uFEFE\u6BFE\u6498\u5389\uFEFE\uFEFE\u5DE0\uFEFE\u5C68\uFEFE" + - "\u5B46\uFEFE\uFEFE\uFEFE\u5142\uFEFE\u53CD\uFFFF\u0004\uFEFE\u57DA\uFEFE\uFEFE\u5AAC\uFEFE\uFEFE" + - "\uFEFE\u6653\uFEFE\uFEFE\u5AEF\uFEFE\u5055\uFEFE\uFEFE\uFEFE\u6283\u61D8\u6249\uFFFF\u0004\uFEFE" + - "\u51A7\uFFFF\u000E\uFEFE\u59B9\uFEFE\uFEFE\uFEFE\u6190\u6557\uFFFF\u0005\uFEFE\u6086\uFEFE\uFEFE" + - "\u59BA\uFEFE\u5D99\uFEFE\u5BA8\u5DA9\uFEFE\uFEFE\u5BE2\uFEFE\uFEFE\u5BE1\uFEFE\uFEFE\uFEFE\u52CC" + - "\u60BE\uFEFE\u67C1\u66DD\u65FA\u5A44\uFEFE\u5A9C\uFEFE\uFEFE\uFEFE\u6B9A\uFFFF\n\uFEFE\u55C4" + - "\u61D9\uFEFE\u51D9\uFFFF\u0004\uFEFE\u6268\u5FA5\uFFFF\u0005\uFEFE\u5A6C\uFEFE\u64A3\uFEFE\uFEFE" + - "\u5EF6\uFFFF\u0005\uFEFE\u5CE9\uFEFE\u5AC7\u5187\uFEFE\u575D\u5DC2\u51A8\u5B47\uFEFE\u6762\uFEFE" + - "\u5AAD\uFFFF\u0005\uFEFE\u5B81\uFEFE\u51DA\uFFFF\u0006\uFEFE\u5967\uFEFE\uFEFE\u5F7A\uFEFE\u5F5A" + - "\u6191\uFEFE\uFEFE\u6372\uFEFE\u69DA\uFEFE\uFEFE\u53FA\uFEFE\uFEFE\uFEFE\u6382\uFEFE\u606F\uFEFE" + - "\u6BA3\uFEFE\uFEFE\u554E\uFEFE\uFEFE\uFEFE\u55B7\uFFFF\u0004\uFEFE\u5EF7\u6379\uFFFF\u0004\uFEFE" + - "\u5BE3\uFFFF\u0004\uFEFE\u638C\u65FB\uFEFE\uFEFE\u6141\u5079\uFEFE\u5EF8\u5FD5\uFEFE\uFEFE\u6791" + - "\uFEFE\u5C90\uFEFE\uFEFE\u69E2\u6595\u615D\uFEFE\u5CF7\uFEFE\uFEFE\uFEFE\u53A2\uFEFE\u56F0\u5C86" + - "\u5ECF\uFEFE\u54C5\uFFFF\t\uFEFE\u577E\uFEFE\u578E\uFEFE\uFEFE\uFEFE\u65BA\uFEFE\u69C6\u57DB" + - "\uFEFE\u5147\u6AFA\u50AB\uFEFE\u59BB\uFEFE\uFEFE\u5E56\uFFFF\u0007\uFEFE\u56F1\uFEFE\uFEFE\u609A" + - "\u55EA\uFFFF\u0006\uFEFE\u529F\uFFFF\u0005\uFEFE\u52FB\uFFFF\u0004\uFEFE\u568E\uFEFE\uFEFE\u6BE4" + - "\uFFFF\u0007\uFEFE\u624A\uFFFF\u0004\uFEFE\u679A\u538A\uFFFF\b\uFEFE\u5BEE\uFEFE\u53FB\uFEFE" + - "\u588D\uFFFF\t\uFEFE\u516C\uFFFF\u0005\uFEFE\u5968\uFEFE\uFEFE\u5D51\u5F7B\uFEFE\uFEFE\uFEFE" + - "\u50F9\uFEFE\uFEFE\u66B7\uFFFF\u0005\uFEFE\u5DAA\uFEFE\uFEFE\u548E\uFFFF\t\uFEFE\u5866\uFEFE" + - "\u5D6F\uFEFE\uFEFE\uFEFE\u69D0\uFEFE\u62D2\u5CDF\uFEFE\uFEFE\u6B90\uFEFE\uFEFE\uFEFE\u62BF\uFFFF" + - "\u009C\uFEFE\u51B5\uFFFF\u0007\uFEFE\u5189\uFEFE\u66FC\uFFFF\u0004\uFEFE\u54B6\uFEFE\u5365\uFEFE" + - "\u6596\uFEFE\u5DED\uFFFF\b\uFEFE\u69DD\uFFFF\u0004\uFEFE\u5495\uFFFF\u0006\uFEFE\u5A42\uFFFF" + - "\b\uFEFE\u6699\u5DAB\u6087\uFFFF\f\uFEFE\u658E\u5BE4\uFFFF\u0007\uFEFE\u63A6\uFFFF\u0007" + - "\uFEFE\u56B7\uFEFE\u56F2\uFFFF\u0010\uFEFE\u6541\u6142\uFEFE\u58D3\u6069\u51C8\uFFFF\u0004\uFEFE" + - "\u597B\u66DF\u64F0\u64A8\u51F0\u62F8\uFEFE\uFEFE\u6088\u5AD1\uFEFE\uFEFE\u5F83\u52D1\uFEFE\u6553" + - "\u56B1\u545A\uFEFE\uFEFE\u5969\u637A\u6AF4\uFEFE\u575E\u65B2\u69A2\u55C6\u5FB6\u6763\uFEFE\uFEFE" + - "\u5FD6\u5056\uFEFE\u609B\uFFFF\u0006\uFEFE\u6284\uFEFE\u5971\uFFFF\u0006\uFEFE\u695B\uFEFE\u59BC" + - "\uFEFE\u5A43\uFEFE\u57F0\uFEFE\u666B\u56B2\u635A\uFEFE\u58D4\uFEFE\uFEFE\uFEFE\u6295\uFEFE\uFEFE" + - "\u547B\uFFFF\u0006\uFEFE\u55C5\uFFFF\u0006\uFEFE\u58D5\u5298\u5A48\uFFFF\u0006\uFEFE\u626A\u6BA9" + - "\uFEFE\u6ADC\u624B\uFEFE\u62C0\u5C80\uFEFE\u5AB2\uFFFF\u0005\uFEFE\u6059\uFEFE\uFEFE\u69C7\uFFFF" + - "\u004D\uFEFE\u609C\uFEFE\u599E\uFFFF\u0004\uFEFE\u665C\uFEFE\u5FD7\uFEFE\uFEFE\u61DA\uFEFE\uFEFE" + - "\u52DE\u58D6\uFEFE\uFEFE\u538B\uFFFF\r\uFEFE\u63A7\uFFFF\u0004\uFEFE\u5EB9\uFFFF\u000E\uFEFE" + - "\u6192\uFFFF\t\uFEFE\u644A\uFFFF\u0004\uFEFE\u63D5\uFFFF\n\uFEFE\u619C\uFFFF\u0006\uFEFE" + - "\u58D7\uFEFE\uFEFE\uFEFE\u626B\uFFFF\u0007\uFEFE\u64BB\uFFFF\u0004\uFEFE\u57C1\u6296\uFEFE\uFEFE" + - "\u5057\uFFFF\u000B\uFEFE\u64EA\uFEFE\u50CE\uFEFE\uFEFE\uFEFE\u609D\uFEFE\u5A9D\uFFFF\u0004\uFEFE" + - "\u687A\uFEFE\u52CD\uFFFF\u0004\uFEFE\u55A8\uFEFE\uFEFE\uFEFE\u547C\uFFFF\u0016\uFEFE\u5E6F\uFFFF" + - "\u0004\uFEFE\u53FE\u635B\uFFFF\r\uFEFE\u685A\uFFFF\u000B\uFEFE\u6B74\uFFFF\u0005\uFEFE\u5EFA" + - "\uFFFF\u0004\uFEFE\u61B0\u615E\uFFFF\u000B\uFEFE\u5EF9\uFEFE\u615F\uFEFE\uFEFE\u50DA\u547D\u62AC" + - "\u6BDD\uFFFF\n\uFEFE\u65A6\uFEFE\uFEFE\uFEFE\u6BA6\uFFFF\u0005\uFEFE\u609E\u6B96\uFEFE\uFEFE" + - "\uFEFE\u61B1\uFFFF\u000F\uFEFE\u63EB\uFEFE\u52C7\uFFFF\n\uFEFE\u6193\uFEFE\uFEFE\uFEFE\u63B4" + - "\uFEFE\u6089\uFEFE\uFEFE\u61DB\uFEFE\uFEFE\u5CCB\uFEFE\uFEFE\uFEFE\u634B\uFFFF\u0018\uFEFE\u5663" + - "\u5C47\u52BD\uFFFF\u0013\uFEFE\u52A0\uFFFF\t\uFEFE\u62AE\u5C87\u52CE\u52B2\uFFFF\u0004\uFEFE" + - "\u6655\uFFFF\f\uFEFE\u5D70\uFFFF\u000B\uFEFE\u6285\uFFFF\f\uFEFE\u63EC\uFEFE\uFEFE\u5058" + - "\uFEFE\uFEFE\u5BEF\uFFFF\u0004\uFEFE\u5268\uFEFE\u55A9\uFEFE\uFEFE\uFEFE\u606A\uFFFF\b\uFEFE" + - "\u637B\u568F\u588E\u516D\uFFFF\u0005\uFEFE\u554F\u6468\u6792\u6972\u6B98\uFFFF\u0006\uFEFE\u5577" + - "\u587E\uFEFE\u57F1\u55F3\uFFFF\u0004\uFEFE\u629D\uFEFE\uFEFE\uFEFE\u61DC\uFFFF\u0004\uFEFE\u5B82" + - "\u6998\uFEFE\u589F\uFEFE\uFEFE\u60BF\u6A4B\uFFFF\u0004\uFEFE\u65CC\u5EB3\u55B3\uFEFE\uFEFE\u60C0" + - "\uFEFE\uFEFE\uFEFE\u6368\u5269\uFFFF\u000E\uFEFE\u6A4C\uFEFE\u5254\uFEFE\u596A\u556D\uFEFE\u55AA" + - "\uFFFF\u0036\uFEFE\u5C48\u51AA\uFEFE\uFEFE\u585E\uFEFE\uFEFE\uFEFE\u54E5\uFEFE\uFEFE\u64F1\uFEFE" + - "\u5867\uFFFF\u0004\uFEFE\u59BE\u5865\u5868\u6272\u5E5A\u53C7\uFFFF\u000F\uFEFE\u5E87\uFEFE\u67A9" + - "\u5C4A\uFFFF\b\uFEFE\u5D9A\uFEFE\uFEFE\u52FC\uFEFE\uFEFE\u57B9\uFFFF\u0011\uFEFE\u5059\uFEFE" + - "\uFEFE\uFEFE\u609F\u57A2\uFEFE\u6297\uFEFE\uFEFE\u5BB1\uFEFE\u6861\uFFFF\u0004\uFEFE\u577F\u587F" + - "\u60A0\u53B4\uFEFE\uFEFE\u63D6\uFEFE\uFEFE\u64D3\u5B48\u51F7\u547E\uFEFE\u677B\u5D52\uFEFE\u6BDB" + - "\uFEFE\uFEFE\u6BBE\uFEFE\u5AF0\uFEFE\u64D9\u63ED\u52A1\uFEFE\uFEFE\u547F\u516E\uFEFE\u6946\uFEFE" + - "\u608A\u64CF\uFEFE\uFEFE\u5A6E\u5593\u5AFC\u6194\u61F0\u58B2\u5578\uFFFF\n\uFEFE\u638D\uFEFE" + - "\uFEFE\u61DE\u6286\uFEFE\uFEFE\u52DF\uFEFE\uFEFE\u5FAD\uFEFE\uFEFE\uFEFE\u65A8\uFEFE\u5EFC\uFEFE" + - "\uFEFE\u54BA\u5B83\uFFFF\u0004\uFEFE\u5E88\uFEFE\uFEFE\u5EFB\u5E98\uFEFE\u6551\u51DB\u5C88\u65B3" + - "\u674F\uFEFE\u5480\u53ED\u5ED0\uFEFE\uFEFE\uFEFE\u5E57\uFEFE\uFEFE\u5B41\u5441\u638E\uFEFE\u5EB4" + - "\u5AF1\uFEFE\u50FA\uFFFF\u0004\uFEFE\u5DC3\u60A1\uFEFE\uFEFE\uFEFE\u6195\u62AD\u54BB\uFEFE\uFEFE" + - "\u626C\uFEFE\uFEFE\u61F1\uFEFE\u635C\u5A9E\uFEFE\u5EFD\uFEFE\u55D3\u50CF\uFEFE\u659E\u5E58\u56B3" + - "\u65FC\u5B84\u66F5\uFEFE\uFEFE\u6AF5\u696D\uFEFE\u586A\uFFFF\u0004\uFEFE\u54D0\uFEFE\u5F67\uFEFE" + - "\uFEFE\uFEFE\u5DD9\uFEFE\uFEFE\uFEFE\u56A3\uFFFF\b\uFEFE\u668D\u53A1\uFEFE\uFEFE\u57DC\uFEFE" + - "\u6B9F\uFEFE\u59A9\uFFFF\u0004\uFEFE\u684C\u64BC\u52A2\uFEFE\uFEFE\uFEFE\u5AF2\uFEFE\uFEFE\u608B" + - "\uFFFF\b\uFEFE\u5E91\uFFFF\b\uFEFE\u526A\uFFFF\u0013\uFEFE\u54FB\uFEFE\uFEFE\u52B4\uFFFF" + - "\u0006\uFEFE\u58D8\uFFFF\u0004\uFEFE\u51E0\uFFFF\u0007\uFEFE\u5E89\uFFFF\u0007\uFEFE\u5481\uFFFF" + - "\u0004\uFEFE\u69E6\uFFFF\u000F\uFEFE\u63D7\uFEFE\uFEFE\u664A\uFEFE\uFEFE\uFEFE\u596B\uFFFF\r" + - "\uFEFE\u54C6\uFFFF\u0005\uFEFE\u6143\uFFFF\u0004\uFEFE\u53E6\uFFFF\u0016\uFEFE\u5EFE\u6144\u63D8" + - "\u5FE4\u57F2\u61DD\uFEFE\uFEFE\uFEFE\u61CC\uFFFF\u000F\uFEFE\u63A8\u5093\uFFFF\u0005\uFEFE\u56DA" + - "\u54D8\uFEFE\u5B85\uFFFF\b\uFEFE\u6770\uFEFE\u66BF\u59D2\uFFFF\u000E\uFEFE\u5BAA\uFEFE\u644B" + - "\uFEFE\u63A9\uFEFE\u6160\uFEFE\uFEFE\u66B9\uFEFE\u5AC8\uFFFF\t\uFEFE\u63D9\uFFFF\u000E\uFEFE" + - "\u5F7C\u605A\uFEFE\u63AA\u6695\uFEFE\u57C2\uFEFE\uFEFE\u559B\u50C4\uFFFF\n\uFEFE\u5CE0\uFFFF" + - "\u0006\uFEFE\u62F2\uFEFE\u5F41\uFEFE\u5A80\u565A\u61F8\u5CC3\u5550\u565B\u5399\uFFFF\u0005\uFEFE" + - "\u5B51\u6145\uFEFE\uFEFE\uFEFE\u58D9\u647A\uFFFF\u0005\uFEFE\u6196\uFEFE\uFEFE\uFEFE\u635D\uFEFE" + - "\uFEFE\u6AB7\uFFFF\n\uFEFE\u62F3\uFFFF\u0017\uFEFE\u54BC\uFEFE\uFEFE\u6860\u6BB9\u69B1\uFEFE" + - "\u63AB\uFEFE\uFEFE\u6ADE\uFFFF\u0006\uFEFE\u52E4\uFFFF\u0015\uFEFE\u5596\uFFFF\u0005\uFEFE\u5DC9" + - "\uFFFF\u0004\uFEFE\u60C1\u509A\uFFFF\u0004\uFEFE\u685B\uFEFE\uFEFE\uFEFE\u666C\uFEFE\u657B\uFFFF" + - "\u000B\uFEFE\u6864\uFEFE\uFEFE\uFEFE\u5D71\uFEFE\uFEFE\u5EBA\uFEFE\uFEFE\uFEFE\u57C3\uFEFE\u52A3" + - "\u69DB\u6146\uFFFF\u0011\uFEFE\u526B\uFFFF\u0005\uFEFE\u56F3\uFEFE\u5F59\uFEFE\uFEFE\u63C1\uFEFE" + - "\u54AB\uFFFF\u000B\uFEFE\u5A9F\uFEFE\u60C2\uFEFE\uFEFE\u5B86\uFEFE\u56DB\uFEFE\uFEFE\uFEFE\u6BC9" + - "\uFFFF\u0016\uFEFE\u5DAC\uFEFE\uFEFE\u6881\u5AF3\uFEFE\u5B87\uFFFF\u0012\uFEFE\u6B70\uFEFE\uFEFE" + - "\u6680\uFEFE\uFEFE\u58B3\uFFFF\u0011\uFEFE\u5A6D\uFFFF\u0005\uFEFE\u657C\uFFFF\r\uFEFE\u50D2" + - "\uFEFE\uFEFE\uFEFE\u50AC\uFFFF\u0007\uFEFE\u55B4\uFFFF\u000B\uFEFE\u63DB\uFFFF\u0007\uFEFE\u63DA" + - "\uFEFE\u6070\uFEFE\uFEFE\uFEFE\u5BAB\u68F9\u6147\u538C\u60C3\uFEFE\u6899\uFEFE\u534B\uFEFE\u574D" + - "\uFEFE\uFEFE\u5A81\uFEFE\uFEFE\u51AB\u62B3\uFFFF\u0018\uFEFE\u6A80\uFEFE\u5579\u687B\uFEFE\u5482" + - "\uFFFF\u0006\uFEFE\u69E7\uFFFF\u0006\uFEFE\u53E7\uFFFF\b\uFEFE\u59E3\uFFFF\t\uFEFE\u5F42" + - "\uFFFF\u0006\uFEFE\u50DB\uFFFF\u0006\uFEFE\u647B\uFEFE\u61B2\uFFFF\r\uFEFE\u5148\uFFFF\u0007" + - "\uFEFE\u5E70\uFEFE\u5B4F\uFEFE\uFEFE\uFEFE\u6BA4\uFFFF\b\uFEFE\u668E\uFEFE\uFEFE\uFEFE\u6856" + - "\uFFFF\u0004\uFEFE\u66BA\u6287\uFEFE\uFEFE\u5FAE\uFFFF\u0012\uFEFE\u619D\uFFFF\r\uFEFE\u6B5D" + - "\uFFFF\u000B\uFEFE\u5690\u5E71\uFEFE\uFEFE\u516F\uFEFE\uFEFE\u6960\uFFFF\u0011\uFEFE\u6B8C\uFFFF" + - "\r\uFEFE\u6BF2\uFFFF\u0013\uFEFE\u61B3\u54C7\uFFFF\u000B\uFEFE\u69BA\uFFFF\u0005\uFEFE\u6B64" + - "\uFFFF\t\uFEFE\u6369\uFEFE\uFEFE\u6499\uFFFF\u000B\uFEFE\u61DF\uFFFF\u0005\uFEFE\u66E6\uFFFF" + - "\u0006\uFEFE\u5094\u684D\uFFFF\b\uFEFE\u5244\uFFFF\u0004\uFEFE\u59C7\uFEFE\u5561\uFFFF\u001A" + - "\uFEFE\u62C1\uFEFE\u62B4\uFFFF\u00F7\uFEFE\u605B\uFFFF\b\uFEFE\u576A\uFEFE\uFEFE\u5AB4\uFFFF" + - "\u0005\uFEFE\u6560\uFEFE\u50BE\uFEFE\uFEFE\uFEFE\u5F4E\uFEFE\u65C7\u65C6\u507A\u578A\uFEFE\uFEFE" + - "\uFEFE\u509B\uFFFF\n\uFEFE\u5066\u65DB\u584B\uFEFE\uFEFE\u52E0\u578B\uFEFE\uFEFE\uFEFE\u5562" + - "\uFEFE\uFEFE\uFEFE\u5D78\uFFFF\t\uFEFE\u5D81\u5C89\uFFFF\n\uFEFE\u5C91\uFEFE\uFEFE\u66FD" + - "\uFFFF\t\uFEFE\u6BCB\u52C8\u6BB7\uFFFF\u0005\uFEFE\u51F1\uFFFF\u0004\uFEFE\u635E\u585F\uFEFE" + - "\uFEFE\u53EE\uFFFF\u0036\uFEFE\u58DA\uFFFF\u0004\uFEFE\u635F\uFFFF\u0006\uFEFE\u5CB2\uFEFE\u64F3" + - "\uFEFE\uFEFE\uFEFE\u5DEE\uFEFE\uFEFE\uFEFE\u57DD\uFFFF\b\uFEFE\u6197\uFEFE\uFEFE\uFEFE\u5C69" + - "\u6489\uFEFE\u6BC3\uFEFE\u58DB\uFFFF\u0006\uFEFE\u55DE\u56B8\u50AD\uFEFE\uFEFE\u65C8\uFFFF\n" + - "\uFEFE\u6561\u65DC\u69C0\u5BC7\u634C\uFEFE\uFEFE\u5EB5\u6288\u6161\uFFFF\u0005\uFEFE\u57F3\uFFFF" + - "\u0005\uFEFE\u5F61\uFEFE\uFEFE\u6289\uFEFE\u5645\u5483\u65D6\u55EE\uFFFF\u0004\uFEFE\u5CE1\uFFFF" + - "\u0007\uFEFE\u5E8A\u55F9\uFEFE\uFEFE\uFEFE\u545B\u5B88\uFEFE\u6750\u5188\uFFFF\u0005\uFEFE\u50EF" + - "\u5E99\uFEFE\uFEFE\u5CAB\u52ED\uFEFE\u6162\u605C\uFFFF\u0006\uFEFE\u5664\uFEFE\uFEFE\uFEFE\u69D1" + - "\u5B89\uFEFE\u6658\uFFFF\u0006\uFEFE\u5F5B\uFFFF\u0005\uFEFE\u559C\uFEFE\uFEFE\uFEFE\u634D\u61F2" + - "\uFEFE\uFEFE\uFEFE\u5FE5\u5C7F\uFEFE\uFEFE\u5EA0\u5C6A\u629B\u51AC\uFEFE\u6461\uFEFE\u6B7A\u5FD8" + - "\u5DDA\u6B58\uFFFF\u0006\uFEFE\u6B72\u5B8A\uFEFE\uFEFE\u5C5C\uFEFE\u63DC\u5FF3\uFEFE\u518A\uFEFE" + - "\uFEFE\uFEFE\u565C\u53A5\uFFFF\u0004\uFEFE\u5E8B\u5E8C\u5AAE\uFFFF\u0004\uFEFE\u6980\u58F2\uFEFE" + - "\u5E9A\uFEFE\uFEFE\uFEFE\u5594\u55C7\uFEFE\u57A3\uFEFE\u60C4\uFFFF\u0004\uFEFE\u5B8B\uFEFE\uFEFE" + - "\uFEFE\u5AF4\uFEFE\u6148\u628A\uFFFF\u0005\uFEFE\u51E1\u59E4\uFEFE\uFEFE\u60D7\uFEFE\u5DAD\uFEFE" + - "\uFEFE\u566C\uFEFE\uFEFE\u6A82\uFEFE\uFEFE\u5A45\uFEFE\u65B4\uFFFF\b\uFEFE\u575F\uFFFF\b" + - "\uFEFE\u69AF\uFEFE\u55AB\uFFFF\u0006\uFEFE\u5860\uFEFE\uFEFE\uFEFE\u6163\uFFFF\u0004\uFEFE\u556E" + - "\uFEFE\u5CAC\uFEFE\u638F\uFEFE\u5595\u5CAD\uFFFF\u0007\uFEFE\u6383\uFFFF\u0004\uFEFE\u60FB\uFFFF" + - "\u0005\uFEFE\u6149\uFEFE\u596C\uFEFE\uFEFE\u5773\u56CC\uFFFF\u0006\uFEFE\u665D\uFEFE\uFEFE\uFEFE" + - "\u5FA6\uFFFF\u0006\uFEFE\u66DE\uFEFE\uFEFE\u5FA7\uFEFE\uFEFE\u5698\uFEFE\u53E8\uFFFF\u0007\uFEFE" + - "\u657D\u5C9D\uFFFF\u0005\uFEFE\u6696\uFEFE\u5C81\uFEFE\u6878\uFFFF\b\uFEFE\u63AC\uFFFF\u0007" + - "\uFEFE\u52AE\uFFFF\u0005\uFEFE\u63DD\uFEFE\u5084\uFEFE\uFEFE\u6882\uFEFE\u6552\uFFFF\u0015\uFEFE" + - "\u53EF\uFEFE\uFEFE\u6360\uFFFF\u0004\uFEFE\u5ED1\uFFFF\u0007\uFEFE\u65C9\uFFFF\b\uFEFE\u5484" + - "\uFFFF\u0016\uFEFE\u5F63\uFEFE\uFEFE\u5AF5\uFFFF\u0004\uFEFE\u5E9B\uFEFE\uFEFE\uFEFE\u664C\u66BB" + - "\u6671\u614A\u5170\uFEFE\u65EC\u5BAC\uFEFE\u5B8C\uFEFE\u5E92\uFEFE\u5B49\uFEFE\uFEFE\uFEFE\u5DAE" + - "\u5DEF\u57BA\u5496\uFEFE\uFEFE\uFEFE\u64EB\u5597\uFFFF\b\uFEFE\u67C2\uFEFE\u5F93\uFFFF\u0007" + - "\uFEFE\u58DC\uFEFE\u54B7\uFEFE\uFEFE\u6681\uFFFF\u0007\uFEFE\u5171\u64D4\uFEFE\u597D\uFFFF\n" + - "\uFEFE\u51DC\uFFFF\u0005\uFEFE\u6164\u5CB3\u5C77\uFFFF\u0005\uFEFE\u5C82\uFEFE\uFEFE\uFEFE\u5EB6" + - "\uFEFE\u60C5\uFEFE\uFEFE\uFEFE\u55EB\uFFFF\u0006\uFEFE\u66BC\uFEFE\u51AD\uFEFE\uFEFE\uFEFE\u60C6" + - "\uFEFE\uFEFE\uFEFE\u666D\u597E\uFFFF\u0037\uFEFE\u6597\uFFFF\u0006\uFEFE\u59E2\uFEFE\u64BD\uFFFF" + - "\u0004\uFEFE\u52A4\uFFFF\r\uFEFE\u658F\uFEFE\uFEFE\u6BC1\uFFFF\u0013\uFEFE\u596D\u5847\uFEFE" + - "\uFEFE\u5BF0\uFEFE\u69CA\u538D\uFFFF\n\uFEFE\u646E\u5F62\u57BB\uFFFF\u0004\uFEFE\u5F91\uFFFF" + - "\u0007\uFEFE\u59C0\u657E\u5BF1\uFFFF\u0004\uFEFE\u526C\uFFFF\u0005\uFEFE\u664D\u5CE2\uFEFE\u5F92" + - "\uFEFE\uFEFE\uFEFE\u62C3\uFEFE\uFEFE\u5C6B\uFFFF\u0004\uFEFE\u5D49\uFFFF\u0005\uFEFE\u60C7\uFEFE" + - "\u5880\uFFFF\u0007\uFEFE\u51F2\uFFFF\u001C\uFEFE\u5691\uFEFE\uFEFE\uFEFE\u52FD\uFEFE\u52CF\u62C4" + - "\u69BB\uFEFE\uFEFE\uFEFE\u538E\u5E59\uFEFE\u6A96\uFEFE\uFEFE\u664E\uFFFF\u0004\uFEFE\u5D82\uFFFF" + - "\u0039\uFEFE\u5B8D\uFEFE\uFEFE\u664F\uFEFE\uFEFE\uFEFE\u6BC6\uFFFF\u0007\uFEFE\u58A0\uFEFE\uFEFE" + - "\u668F\uFEFE\uFEFE\uFEFE\u5678\u5CEA\u6593\uFEFE\uFEFE\u6BB0\uFEFE\u6469\u5BAD\uFFFF\u0004\uFEFE" + - "\u5FAF\uFFFF\u0007\uFEFE\u57A4\uFEFE\uFEFE\u64BE\uFFFF\u000B\uFEFE\u61E0\u68CF\u52A5\uFEFE\uFEFE" + - "\u505A\uFEFE\uFEFE\uFEFE\u58DD\uFEFE\uFEFE\uFEFE\u648A\uFEFE\u59C1\uFEFE\uFEFE\u586B\uFFFF\n" + - "\uFEFE\u65FD\uFEFE\uFEFE\uFEFE\u54D9\uFFFF\r\uFEFE\u61F3\uFEFE\u5983\uFFFF\u0006\uFEFE\u6995" + - "\uFFFF\u0005\uFEFE\u538F\u5390\uFFFF\t\uFEFE\u6BBA\uFFFF\u0011\uFEFE\u50DC\uFFFF\u0004\uFEFE" + - "\u54C8\uFFFF\u0005\uFEFE\u6BA5\u5AF6\uFFFF\b\uFEFE\u56B9\uFEFE\uFEFE\u6BC2\uFEFE\u52A6\uFFFF" + - "\u0007\uFEFE\u6BF6\uFFFF\u0007\uFEFE\u526D\uFEFE\u6659\uFEFE\uFEFE\u5172\u5D53\uFEFE\uFEFE\uFEFE" + - "\u644C\uFEFE\uFEFE\u5563\uFEFE\uFEFE\u5391\uFEFE\uFEFE\uFEFE\u66F6\u5564\uFFFF\u003D\uFEFE\u51C1" + - "\uFFFF\u000F\uFEFE\u65FE\uFEFE\uFEFE\uFEFE\u50F0\uFEFE\uFEFE\uFEFE\u596E\uFFFF\u000E\uFEFE\u55DF" + - "\uFEFE\u63B5\uFEFE\u5B8E\u6390\uFEFE\uFEFE\uFEFE\u51AE\uFFFF\n\uFEFE\u57DE\uFEFE\u5D83\uFFFF" + - "\b\uFEFE\u57C4\uFFFF\u0005\uFEFE\u58F8\uFFFF\u0023\uFEFE\u5692\uFEFE\u5B8F\uFFFF\u0004\uFEFE" + - "\u66F8\uFEFE\uFEFE\u597F\u5586\uFEFE\uFEFE\uFEFE\u695C\uFEFE\uFEFE\u64DA\uFFFF\u0006\uFEFE\u5E9E" + - "\uFFFF\t\uFEFE\u5F47\u52D2\uFFFF\u0004\uFEFE\u5250\u66C5\u57C5\u57FB\u56B4\uFFFF\u0007\uFEFE" + - "\u56A4\u5551\u5ED2\uFEFE\u565D\uFEFE\uFEFE\u5679\uFFFF\u0005\uFEFE\u5CEB\uFFFF\u0014\uFEFE\u55AC" + - "\uFFFF\u0004\uFEFE\u57DF\uFFFF\u0019\uFEFE\u6B66\uFEFE\uFEFE\u657F\u58DE\uFFFF\f\uFEFE\u69E9" + - "\uFFFF\u000B\uFEFE\u526E\uFEFE\uFEFE\u5AA1\uFFFF\u001A\uFEFE\u565E\uFFFF\f\uFEFE\u6384\uFFFF" + - "\u0004\uFEFE\u6198\uFFFF\b\uFEFE\u6875\uFEFE\uFEFE\uFEFE\u5173\uFFFF\u0024\uFEFE\u63DE\uFEFE" + - "\uFEFE\u69E8\uFEFE\u58A1\u5A49\uFEFE\u65B5\uFFFF\u000F\uFEFE\u66F7\uFFFF\u0007\uFEFE\u5392\u5DD1" + - "\uFEFE\uFEFE\uFEFE\u6A93\uFFFF\b\uFEFE\u5693\uFFFF\u000B\uFEFE\u6853\uFEFE\u586F\uFFFF\r" + - "\uFEFE\u5665\uFFFF\u008D\uFEFE\u6199\uFEFE\u58DF\uFEFE\u52A7\uFFFF\t\uFEFE\u58B4\u56D3\uFEFE" + - "\u5D72\uFFFF\u0010\uFEFE\u588F\u5C83\u5C6C\uFFFF\u0011\uFEFE\u5EB7\uFFFF\n\uFEFE\u5C9E\uFEFE" + - "\u5C96\uFFFF\u0012\uFEFE\u66CF\uFFFF\b\uFEFE\u646A\uFFFF\f\uFEFE\u50FB\uFFFF\u000B\uFEFE" + - "\u5C6D\uFEFE\uFEFE\u51B6\u5760\uFFFF\n\uFEFE\u5941\uFFFF\u0005\uFEFE\u5FE6\uFFFF\u0016\uFEFE" + - "\u5BAE\uFFFF\u001F\uFEFE\u697A\uFFFF\u0005\uFEFE\u5CB6\uFFFF\u0004\uFEFE\u65BB\uFFFF\u0006\uFEFE" + - "\u66C9\uFFFF\b\uFEFE\u518B\uFFFF\u0012\uFEFE\u52A8\uFFFF\u001A\uFEFE\u644D\u65CA\uFFFF\u0004" + - "\uFEFE\u679B\u5F6B\u55AD\uFFFF\u001F\uFEFE\u5CB7\u51F3\uFEFE\uFEFE\u54E2\uFFFF\u0056\uFEFE\u55AE" + - "\uFEFE\uFEFE\uFEFE\u6BCA\uFEFE\uFEFE\uFEFE\u5D7E\uFEFE\u55B6\uFEFE\u63DF\uFFFF\u0010\uFEFE\u5393" + - "\u55B5\uFEFE\uFEFE\uFEFE\u5565\uFFFF\u0005\uFEFE\u69AE\uFEFE\u5666\uFFFF\u0004\uFEFE\u63E0\u56BA" + - "\uFFFF\u000E\uFEFE\u52AF\u56CD\uFFFF\u0005\uFEFE\u567A\uFEFE\uFEFE\u6793\uFFFF\u0004\uFEFE\u6751" + - "\uFFFF\t\uFEFE\u5A6F\u5566\uFEFE\uFEFE\u67A1\uFEFE\uFEFE\u50E4\uFEFE\uFEFE\uFEFE\u5762\uFEFE" + - "\uFEFE\u545C\u63F1\u5F43\u60D5\uFFFF\t\uFEFE\u544C\uFFFF\u0006\uFEFE\u5C92\uFFFF\u0004\uFEFE" + - "\u6985\uFFFF\u0006\uFEFE\u58F9\u5890\uFFFF\n\uFEFE\u6A94\u5870\uFFFF\u0005\uFEFE\u614B\uFFFF" + - "\u0004\uFEFE\u51AF\uFFFF\f\uFEFE\u5A71\uFFFF\u001A\uFEFE\u596F\uFFFF\u000E\uFEFE\u6165\u606B" + - "\uFEFE\uFEFE\u606C\uFEFE\uFEFE\uFEFE\u646B\uFFFF\f\uFEFE\u6B59\uFEFE\u5598\uFFFF\u0004\uFEFE" + - "\u5F5C\u69BE\uFEFE\uFEFE\u62B5\uFEFE\u5CEC\uFFFF\n\uFEFE\u5C78\uFFFF\u0015\uFEFE\u55D4\uFEFE" + - "\uFEFE\u57E0\uFFFF\u0004\uFEFE\u5095\uFFFF\u0006\uFEFE\u52A9\uFFFF\u0C63\uFEFE\uFFFE\u0011\u8861" + - "\uFFFE\u000B\u8873\uFFFE\u0011\u8881\uFFFE\u000B\u8893\uFFFE\u0011\u88A1\uFFFE\u000B\u88B3\uFFFE" + - "\u0011\u88C1\uFFFE\u000B\u88D3\uFFFE\u0011\u88E1\uFFFE\u000B\u88F3\uFFFE\u0011\u8941\uFFFE\u000B" + - "\u8953\uFFFE\u0011\u8961\uFFFE\u000B\u8973\uFFFE\u0011\u8981\uFFFE\u000B\u8993\uFFFE\u0011\u89A1" + - "\uFFFE\u000B\u89B3\uFFFE\u0011\u89C1\uFFFE\u000B\u89D3\uFFFE\u0011\u89E1\uFFFE\u000B\u89F3\uFFFE" + - "\u0011\u8A41\uFFFE\u000B\u8A53\uFFFE\u0011\u8A61\uFFFE\u000B\u8A73\uFFFE\u0011\u8A81\uFFFE\u000B" + - "\u8A93\uFFFE\u0011\u8AA1\uFFFE\u000B\u8AB3\uFFFE\u0011\u8AC1\uFFFE\u000B\u8AD3\uFFFE\u0011\u8AE1" + - "\uFFFE\u000B\u8AF3\uFFFE\u0011\u8B41\uFFFE\u000B\u8B53\uFFFE\u0011\u8B61\uFFFE\u000B\u8B73\uFFFE" + - "\u0011\u8B81\uFFFE\u000B\u8B93\uFFFE\u0011\u8BA1\uFFFE\u000B\u8BB3\uFFFE\u0011\u8C61\uFFFE\u000B" + - "\u8C73\uFFFE\u0011\u8C81\uFFFE\u000B\u8C93\uFFFE\u0011\u8CA1\uFFFE\u000B\u8CB3\uFFFE\u0011\u8CC1" + - "\uFFFE\u000B\u8CD3\uFFFE\u0011\u8CE1\uFFFE\u000B\u8CF3\uFFFE\u0011\u8D41\uFFFE\u000B\u8D53\uFFFE" + - "\u0011\u8D61\uFFFE\u000B\u8D73\uFFFE\u0011\u8D81\uFFFE\u000B\u8D93\uFFFE\u0011\u8DA1\uFFFE\u000B" + - "\u8DB3\uFFFE\u0011\u8DC1\uFFFE\u000B\u8DD3\uFFFE\u0011\u8DE1\uFFFE\u000B\u8DF3\uFFFE\u0011\u8E41" + - "\uFFFE\u000B\u8E53\uFFFE\u0011\u8E61\uFFFE\u000B\u8E73\uFFFE\u0011\u8E81\uFFFE\u000B\u8E93\uFFFE" + - "\u0011\u8EA1\uFFFE\u000B\u8EB3\uFFFE\u0011\u8EC1\uFFFE\u000B\u8ED3\uFFFE\u0011\u8EE1\uFFFE\u000B" + - "\u8EF3\uFFFE\u0011\u8F41\uFFFE\u000B\u8F53\uFFFE\u0011\u8F61\uFFFE\u000B\u8F73\uFFFE\u0011\u8F81" + - "\uFFFE\u000B\u8F93\uFFFE\u0011\u8FA1\uFFFE\u000B\u8FB3\uFFFE\u0011\u9061\uFFFE\u000B\u9073\uFFFE" + - "\u0011\u9081\uFFFE\u000B\u9093\uFFFE\u0011\u90A1\uFFFE\u000B\u90B3\uFFFE\u0011\u90C1\uFFFE\u000B" + - "\u90D3\uFFFE\u0011\u90E1\uFFFE\u000B\u90F3\uFFFE\u0011\u9141\uFFFE\u000B\u9153\uFFFE\u0011\u9161" + - "\uFFFE\u000B\u9173\uFFFE\u0011\u9181\uFFFE\u000B\u9193\uFFFE\u0011\u91A1\uFFFE\u000B\u91B3\uFFFE" + - "\u0011\u91C1\uFFFE\u000B\u91D3\uFFFE\u0011\u91E1\uFFFE\u000B\u91F3\uFFFE\u0011\u9241\uFFFE\u000B" + - "\u9253\uFFFE\u0011\u9261\uFFFE\u000B\u9273\uFFFE\u0011\u9281\uFFFE\u000B\u9293\uFFFE\u0011\u92A1" + - "\uFFFE\u000B\u92B3\uFFFE\u0011\u92C1\uFFFE\u000B\u92D3\uFFFE\u0011\u92E1\uFFFE\u000B\u92F3\uFFFE" + - "\u0011\u9341\uFFFE\u000B\u9353\uFFFE\u0011\u9361\uFFFE\u000B\u9373\uFFFE\u0011\u9381\uFFFE\u000B" + - "\u9393\uFFFE\u0011\u93A1\uFFFE\u000B\u93B3\uFFFE\u0011\u9461\uFFFE\u000B\u9473\uFFFE\u0011\u9481" + - "\uFFFE\u000B\u9493\uFFFE\u0011\u94A1\uFFFE\u000B\u94B3\uFFFE\u0011\u94C1\uFFFE\u000B\u94D3\uFFFE" + - "\u0011\u94E1\uFFFE\u000B\u94F3\uFFFE\u0011\u9541\uFFFE\u000B\u9553\uFFFE\u0011\u9561\uFFFE\u000B" + - "\u9573\uFFFE\u0011\u9581\uFFFE\u000B\u9593\uFFFE\u0011\u95A1\uFFFE\u000B\u95B3\uFFFE\u0011\u95C1" + - "\uFFFE\u000B\u95D3\uFFFE\u0011\u95E1\uFFFE\u000B\u95F3\uFFFE\u0011\u9641\uFFFE\u000B\u9653\uFFFE" + - "\u0011\u9661\uFFFE\u000B\u9673\uFFFE\u0011\u9681\uFFFE\u000B\u9693\uFFFE\u0011\u96A1\uFFFE\u000B" + - "\u96B3\uFFFE\u0011\u96C1\uFFFE\u000B\u96D3\uFFFE\u0011\u96E1\uFFFE\u000B\u96F3\uFFFE\u0011\u9741" + - "\uFFFE\u000B\u9753\uFFFE\u0011\u9761\uFFFE\u000B\u9773\uFFFE\u0011\u9781\uFFFE\u000B\u9793\uFFFE" + - "\u0011\u97A1\uFFFE\u000B\u97B3\uFFFE\u0011\u9861\uFFFE\u000B\u9873\uFFFE\u0011\u9881\uFFFE\u000B" + - "\u9893\uFFFE\u0011\u98A1\uFFFE\u000B\u98B3\uFFFE\u0011\u98C1\uFFFE\u000B\u98D3\uFFFE\u0011\u98E1" + - "\uFFFE\u000B\u98F3\uFFFE\u0011\u9941\uFFFE\u000B\u9953\uFFFE\u0011\u9961\uFFFE\u000B\u9973\uFFFE" + - "\u0011\u9981\uFFFE\u000B\u9993\uFFFE\u0011\u99A1\uFFFE\u000B\u99B3\uFFFE\u0011\u99C1\uFFFE\u000B" + - "\u99D3\uFFFE\u0011\u99E1\uFFFE\u000B\u99F3\uFFFE\u0011\u9A41\uFFFE\u000B\u9A53\uFFFE\u0011\u9A61" + - "\uFFFE\u000B\u9A73\uFFFE\u0011\u9A81\uFFFE\u000B\u9A93\uFFFE\u0011\u9AA1\uFFFE\u000B\u9AB3\uFFFE" + - "\u0011\u9AC1\uFFFE\u000B\u9AD3\uFFFE\u0011\u9AE1\uFFFE\u000B\u9AF3\uFFFE\u0011\u9B41\uFFFE\u000B" + - "\u9B53\uFFFE\u0011\u9B61\uFFFE\u000B\u9B73\uFFFE\u0011\u9B81\uFFFE\u000B\u9B93\uFFFE\u0011\u9BA1" + - "\uFFFE\u000B\u9BB3\uFFFE\u0011\u9C61\uFFFE\u000B\u9C73\uFFFE\u0011\u9C81\uFFFE\u000B\u9C93\uFFFE" + - "\u0011\u9CA1\uFFFE\u000B\u9CB3\uFFFE\u0011\u9CC1\uFFFE\u000B\u9CD3\uFFFE\u0011\u9CE1\uFFFE\u000B" + - "\u9CF3\uFFFE\u0011\u9D41\uFFFE\u000B\u9D53\uFFFE\u0011\u9D61\uFFFE\u000B\u9D73\uFFFE\u0011\u9D81" + - "\uFFFE\u000B\u9D93\uFFFE\u0011\u9DA1\uFFFE\u000B\u9DB3\uFFFE\u0011\u9DC1\uFFFE\u000B\u9DD3\uFFFE" + - "\u0011\u9DE1\uFFFE\u000B\u9DF3\uFFFE\u0011\u9E41\uFFFE\u000B\u9E53\uFFFE\u0011\u9E61\uFFFE\u000B" + - "\u9E73\uFFFE\u0011\u9E81\uFFFE\u000B\u9E93\uFFFE\u0011\u9EA1\uFFFE\u000B\u9EB3\uFFFE\u0011\u9EC1" + - "\uFFFE\u000B\u9ED3\uFFFE\u0011\u9EE1\uFFFE\u000B\u9EF3\uFFFE\u0011\u9F41\uFFFE\u000B\u9F53\uFFFE" + - "\u0011\u9F61\uFFFE\u000B\u9F73\uFFFE\u0011\u9F81\uFFFE\u000B\u9F93\uFFFE\u0011\u9FA1\uFFFE\u000B" + - "\u9FB3\uFFFE\u0011\uA061\uFFFE\u000B\uA073\uFFFE\u0011\uA081\uFFFE\u000B\uA093\uFFFE\u0011\uA0A1" + - "\uFFFE\u000B\uA0B3\uFFFE\u0011\uA0C1\uFFFE\u000B\uA0D3\uFFFE\u0011\uA0E1\uFFFE\u000B\uA0F3\uFFFE" + - "\u0011\uA141\uFFFE\u000B\uA153\uFFFE\u0011\uA161\uFFFE\u000B\uA173\uFFFE\u0011\uA181\uFFFE\u000B" + - "\uA193\uFFFE\u0011\uA1A1\uFFFE\u000B\uA1B3\uFFFE\u0011\uA1C1\uFFFE\u000B\uA1D3\uFFFE\u0011\uA1E1" + - "\uFFFE\u000B\uA1F3\uFFFE\u0011\uA241\uFFFE\u000B\uA253\uFFFE\u0011\uA261\uFFFE\u000B\uA273\uFFFE" + - "\u0011\uA281\uFFFE\u000B\uA293\uFFFE\u0011\uA2A1\uFFFE\u000B\uA2B3\uFFFE\u0011\uA2C1\uFFFE\u000B" + - "\uA2D3\uFFFE\u0011\uA2E1\uFFFE\u000B\uA2F3\uFFFE\u0011\uA341\uFFFE\u000B\uA353\uFFFE\u0011\uA361" + - "\uFFFE\u000B\uA373\uFFFE\u0011\uA381\uFFFE\u000B\uA393\uFFFE\u0011\uA3A1\uFFFE\u000B\uA3B3\uFFFE" + - "\u0011\uA461\uFFFE\u000B\uA473\uFFFE\u0011\uA481\uFFFE\u000B\uA493\uFFFE\u0011\uA4A1\uFFFE\u000B" + - "\uA4B3\uFFFE\u0011\uA4C1\uFFFE\u000B\uA4D3\uFFFE\u0011\uA4E1\uFFFE\u000B\uA4F3\uFFFE\u0011\uA541" + - "\uFFFE\u000B\uA553\uFFFE\u0011\uA561\uFFFE\u000B\uA573\uFFFE\u0011\uA581\uFFFE\u000B\uA593\uFFFE" + - "\u0011\uA5A1\uFFFE\u000B\uA5B3\uFFFE\u0011\uA5C1\uFFFE\u000B\uA5D3\uFFFE\u0011\uA5E1\uFFFE\u000B" + - "\uA5F3\uFFFE\u0011\uA641\uFFFE\u000B\uA653\uFFFE\u0011\uA661\uFFFE\u000B\uA673\uFFFE\u0011\uA681" + - "\uFFFE\u000B\uA693\uFFFE\u0011\uA6A1\uFFFE\u000B\uA6B3\uFFFE\u0011\uA6C1\uFFFE\u000B\uA6D3\uFFFE" + - "\u0011\uA6E1\uFFFE\u000B\uA6F3\uFFFE\u0011\uA741\uFFFE\u000B\uA753\uFFFE\u0011\uA761\uFFFE\u000B" + - "\uA773\uFFFE\u0011\uA781\uFFFE\u000B\uA793\uFFFE\u0011\uA7A1\uFFFE\u000B\uA7B3\uFFFE\u0011\uA861" + - "\uFFFE\u000B\uA873\uFFFE\u0011\uA881\uFFFE\u000B\uA893\uFFFE\u0011\uA8A1\uFFFE\u000B\uA8B3\uFFFE" + - "\u0011\uA8C1\uFFFE\u000B\uA8D3\uFFFE\u0011\uA8E1\uFFFE\u000B\uA8F3\uFFFE\u0011\uA941\uFFFE\u000B" + - "\uA953\uFFFE\u0011\uA961\uFFFE\u000B\uA973\uFFFE\u0011\uA981\uFFFE\u000B\uA993\uFFFE\u0011\uA9A1" + - "\uFFFE\u000B\uA9B3\uFFFE\u0011\uA9C1\uFFFE\u000B\uA9D3\uFFFE\u0011\uA9E1\uFFFE\u000B\uA9F3\uFFFE" + - "\u0011\uAA41\uFFFE\u000B\uAA53\uFFFE\u0011\uAA61\uFFFE\u000B\uAA73\uFFFE\u0011\uAA81\uFFFE\u000B" + - "\uAA93\uFFFE\u0011\uAAA1\uFFFE\u000B\uAAB3\uFFFE\u0011\uAAC1\uFFFE\u000B\uAAD3\uFFFE\u0011\uAAE1" + - "\uFFFE\u000B\uAAF3\uFFFE\u0011\uAB41\uFFFE\u000B\uAB53\uFFFE\u0011\uAB61\uFFFE\u000B\uAB73\uFFFE" + - "\u0011\uAB81\uFFFE\u000B\uAB93\uFFFE\u0011\uABA1\uFFFE\u000B\uABB3\uFFFE\u0011\uAC61\uFFFE\u000B" + - "\uAC73\uFFFE\u0011\uAC81\uFFFE\u000B\uAC93\uFFFE\u0011\uACA1\uFFFE\u000B\uACB3\uFFFE\u0011\uACC1" + - "\uFFFE\u000B\uACD3\uFFFE\u0011\uACE1\uFFFE\u000B\uACF3\uFFFE\u0011\uAD41\uFFFE\u000B\uAD53\uFFFE" + - "\u0011\uAD61\uFFFE\u000B\uAD73\uFFFE\u0011\uAD81\uFFFE\u000B\uAD93\uFFFE\u0011\uADA1\uFFFE\u000B" + - "\uADB3\uFFFE\u0011\uADC1\uFFFE\u000B\uADD3\uFFFE\u0011\uADE1\uFFFE\u000B\uADF3\uFFFE\u0011\uAE41" + - "\uFFFE\u000B\uAE53\uFFFE\u0011\uAE61\uFFFE\u000B\uAE73\uFFFE\u0011\uAE81\uFFFE\u000B\uAE93\uFFFE" + - "\u0011\uAEA1\uFFFE\u000B\uAEB3\uFFFE\u0011\uAEC1\uFFFE\u000B\uAED3\uFFFE\u0011\uAEE1\uFFFE\u000B" + - "\uAEF3\uFFFE\u0011\uAF41\uFFFE\u000B\uAF53\uFFFE\u0011\uAF61\uFFFE\u000B\uAF73\uFFFE\u0011\uAF81" + - "\uFFFE\u000B\uAF93\uFFFE\u0011\uAFA1\uFFFE\u000B\uAFB3\uFFFE\u0011\uB061\uFFFE\u000B\uB073\uFFFE" + - "\u0011\uB081\uFFFE\u000B\uB093\uFFFE\u0011\uB0A1\uFFFE\u000B\uB0B3\uFFFE\u0011\uB0C1\uFFFE\u000B" + - "\uB0D3\uFFFE\u0011\uB0E1\uFFFE\u000B\uB0F3\uFFFE\u0011\uB141\uFFFE\u000B\uB153\uFFFE\u0011\uB161" + - "\uFFFE\u000B\uB173\uFFFE\u0011\uB181\uFFFE\u000B\uB193\uFFFE\u0011\uB1A1\uFFFE\u000B\uB1B3\uFFFE" + - "\u0011\uB1C1\uFFFE\u000B\uB1D3\uFFFE\u0011\uB1E1\uFFFE\u000B\uB1F3\uFFFE\u0011\uB241\uFFFE\u000B" + - "\uB253\uFFFE\u0011\uB261\uFFFE\u000B\uB273\uFFFE\u0011\uB281\uFFFE\u000B\uB293\uFFFE\u0011\uB2A1" + - "\uFFFE\u000B\uB2B3\uFFFE\u0011\uB2C1\uFFFE\u000B\uB2D3\uFFFE\u0011\uB2E1\uFFFE\u000B\uB2F3\uFFFE" + - "\u0011\uB341\uFFFE\u000B\uB353\uFFFE\u0011\uB361\uFFFE\u000B\uB373\uFFFE\u0011\uB381\uFFFE\u000B" + - "\uB393\uFFFE\u0011\uB3A1\uFFFE\u000B\uB3B3\uFFFE\u0011\uB461\uFFFE\u000B\uB473\uFFFE\u0011\uB481" + - "\uFFFE\u000B\uB493\uFFFE\u0011\uB4A1\uFFFE\u000B\uB4B3\uFFFE\u0011\uB4C1\uFFFE\u000B\uB4D3\uFFFE" + - "\u0011\uB4E1\uFFFE\u000B\uB4F3\uFFFE\u0011\uB541\uFFFE\u000B\uB553\uFFFE\u0011\uB561\uFFFE\u000B" + - "\uB573\uFFFE\u0011\uB581\uFFFE\u000B\uB593\uFFFE\u0011\uB5A1\uFFFE\u000B\uB5B3\uFFFE\u0011\uB5C1" + - "\uFFFE\u000B\uB5D3\uFFFE\u0011\uB5E1\uFFFE\u000B\uB5F3\uFFFE\u0011\uB641\uFFFE\u000B\uB653\uFFFE" + - "\u0011\uB661\uFFFE\u000B\uB673\uFFFE\u0011\uB681\uFFFE\u000B\uB693\uFFFE\u0011\uB6A1\uFFFE\u000B" + - "\uB6B3\uFFFE\u0011\uB6C1\uFFFE\u000B\uB6D3\uFFFE\u0011\uB6E1\uFFFE\u000B\uB6F3\uFFFE\u0011\uB741" + - "\uFFFE\u000B\uB753\uFFFE\u0011\uB761\uFFFE\u000B\uB773\uFFFE\u0011\uB781\uFFFE\u000B\uB793\uFFFE" + - "\u0011\uB7A1\uFFFE\u000B\uB7B3\uFFFE\u0011\uB861\uFFFE\u000B\uB873\uFFFE\u0011\uB881\uFFFE\u000B" + - "\uB893\uFFFE\u0011\uB8A1\uFFFE\u000B\uB8B3\uFFFE\u0011\uB8C1\uFFFE\u000B\uB8D3\uFFFE\u0011\uB8E1" + - "\uFFFE\u000B\uB8F3\uFFFE\u0011\uB941\uFFFE\u000B\uB953\uFFFE\u0011\uB961\uFFFE\u000B\uB973\uFFFE" + - "\u0011\uB981\uFFFE\u000B\uB993\uFFFE\u0011\uB9A1\uFFFE\u000B\uB9B3\uFFFE\u0011\uB9C1\uFFFE\u000B" + - "\uB9D3\uFFFE\u0011\uB9E1\uFFFE\u000B\uB9F3\uFFFE\u0011\uBA41\uFFFE\u000B\uBA53\uFFFE\u0011\uBA61" + - "\uFFFE\u000B\uBA73\uFFFE\u0011\uBA81\uFFFE\u000B\uBA93\uFFFE\u0011\uBAA1\uFFFE\u000B\uBAB3\uFFFE" + - "\u0011\uBAC1\uFFFE\u000B\uBAD3\uFFFE\u0011\uBAE1\uFFFE\u000B\uBAF3\uFFFE\u0011\uBB41\uFFFE\u000B" + - "\uBB53\uFFFE\u0011\uBB61\uFFFE\u000B\uBB73\uFFFE\u0011\uBB81\uFFFE\u000B\uBB93\uFFFE\u0011\uBBA1" + - "\uFFFE\u000B\uBBB3\uFFFE\u0011\uBC61\uFFFE\u000B\uBC73\uFFFE\u0011\uBC81\uFFFE\u000B\uBC93\uFFFE" + - "\u0011\uBCA1\uFFFE\u000B\uBCB3\uFFFE\u0011\uBCC1\uFFFE\u000B\uBCD3\uFFFE\u0011\uBCE1\uFFFE\u000B" + - "\uBCF3\uFFFE\u0011\uBD41\uFFFE\u000B\uBD53\uFFFE\u0011\uBD61\uFFFE\u000B\uBD73\uFFFE\u0011\uBD81" + - "\uFFFE\u000B\uBD93\uFFFE\u0011\uBDA1\uFFFE\u000B\uBDB3\uFFFE\u0011\uBDC1\uFFFE\u000B\uBDD3\uFFFE" + - "\u0011\uBDE1\uFFFE\u000B\uBDF3\uFFFE\u0011\uBE41\uFFFE\u000B\uBE53\uFFFE\u0011\uBE61\uFFFE\u000B" + - "\uBE73\uFFFE\u0011\uBE81\uFFFE\u000B\uBE93\uFFFE\u0011\uBEA1\uFFFE\u000B\uBEB3\uFFFE\u0011\uBEC1" + - "\uFFFE\u000B\uBED3\uFFFE\u0011\uBEE1\uFFFE\u000B\uBEF3\uFFFE\u0011\uBF41\uFFFE\u000B\uBF53\uFFFE" + - "\u0011\uBF61\uFFFE\u000B\uBF73\uFFFE\u0011\uBF81\uFFFE\u000B\uBF93\uFFFE\u0011\uBFA1\uFFFE\u000B" + - "\uBFB3\uFFFE\u0011\uC061\uFFFE\u000B\uC073\uFFFE\u0011\uC081\uFFFE\u000B\uC093\uFFFE\u0011\uC0A1" + - "\uFFFE\u000B\uC0B3\uFFFE\u0011\uC0C1\uFFFE\u000B\uC0D3\uFFFE\u0011\uC0E1\uFFFE\u000B\uC0F3\uFFFE" + - "\u0011\uC141\uFFFE\u000B\uC153\uFFFE\u0011\uC161\uFFFE\u000B\uC173\uFFFE\u0011\uC181\uFFFE\u000B" + - "\uC193\uFFFE\u0011\uC1A1\uFFFE\u000B\uC1B3\uFFFE\u0011\uC1C1\uFFFE\u000B\uC1D3\uFFFE\u0011\uC1E1" + - "\uFFFE\u000B\uC1F3\uFFFE\u0011\uC241\uFFFE\u000B\uC253\uFFFE\u0011\uC261\uFFFE\u000B\uC273\uFFFE" + - "\u0011\uC281\uFFFE\u000B\uC293\uFFFE\u0011\uC2A1\uFFFE\u000B\uC2B3\uFFFE\u0011\uC2C1\uFFFE\u000B" + - "\uC2D3\uFFFE\u0011\uC2E1\uFFFE\u000B\uC2F3\uFFFE\u0011\uC341\uFFFE\u000B\uC353\uFFFE\u0011\uC361" + - "\uFFFE\u000B\uC373\uFFFE\u0011\uC381\uFFFE\u000B\uC393\uFFFE\u0011\uC3A1\uFFFE\u000B\uC3B3\uFFFE" + - "\u0011\uC461\uFFFE\u000B\uC473\uFFFE\u0011\uC481\uFFFE\u000B\uC493\uFFFE\u0011\uC4A1\uFFFE\u000B" + - "\uC4B3\uFFFE\u0011\uC4C1\uFFFE\u000B\uC4D3\uFFFE\u0011\uC4E1\uFFFE\u000B\uC4F3\uFFFE\u0011\uC541" + - "\uFFFE\u000B\uC553\uFFFE\u0011\uC561\uFFFE\u000B\uC573\uFFFE\u0011\uC581\uFFFE\u000B\uC593\uFFFE" + - "\u0011\uC5A1\uFFFE\u000B\uC5B3\uFFFE\u0011\uC5C1\uFFFE\u000B\uC5D3\uFFFE\u0011\uC5E1\uFFFE\u000B" + - "\uC5F3\uFFFE\u0011\uC641\uFFFE\u000B\uC653\uFFFE\u0011\uC661\uFFFE\u000B\uC673\uFFFE\u0011\uC681" + - "\uFFFE\u000B\uC693\uFFFE\u0011\uC6A1\uFFFE\u000B\uC6B3\uFFFE\u0011\uC6C1\uFFFE\u000B\uC6D3\uFFFE" + - "\u0011\uC6E1\uFFFE\u000B\uC6F3\uFFFE\u0011\uC741\uFFFE\u000B\uC753\uFFFE\u0011\uC761\uFFFE\u000B" + - "\uC773\uFFFE\u0011\uC781\uFFFE\u000B\uC793\uFFFE\u0011\uC7A1\uFFFE\u000B\uC7B3\uFFFE\u0011\uC861" + - "\uFFFE\u000B\uC873\uFFFE\u0011\uC881\uFFFE\u000B\uC893\uFFFE\u0011\uC8A1\uFFFE\u000B\uC8B3\uFFFE" + - "\u0011\uC8C1\uFFFE\u000B\uC8D3\uFFFE\u0011\uC8E1\uFFFE\u000B\uC8F3\uFFFE\u0011\uC941\uFFFE\u000B" + - "\uC953\uFFFE\u0011\uC961\uFFFE\u000B\uC973\uFFFE\u0011\uC981\uFFFE\u000B\uC993\uFFFE\u0011\uC9A1" + - "\uFFFE\u000B\uC9B3\uFFFE\u0011\uC9C1\uFFFE\u000B\uC9D3\uFFFE\u0011\uC9E1\uFFFE\u000B\uC9F3\uFFFE" + - "\u0011\uCA41\uFFFE\u000B\uCA53\uFFFE\u0011\uCA61\uFFFE\u000B\uCA73\uFFFE\u0011\uCA81\uFFFE\u000B" + - "\uCA93\uFFFE\u0011\uCAA1\uFFFE\u000B\uCAB3\uFFFE\u0011\uCAC1\uFFFE\u000B\uCAD3\uFFFE\u0011\uCAE1" + - "\uFFFE\u000B\uCAF3\uFFFE\u0011\uCB41\uFFFE\u000B\uCB53\uFFFE\u0011\uCB61\uFFFE\u000B\uCB73\uFFFE" + - "\u0011\uCB81\uFFFE\u000B\uCB93\uFFFE\u0011\uCBA1\uFFFE\u000B\uCBB3\uFFFE\u0011\uCC61\uFFFE\u000B" + - "\uCC73\uFFFE\u0011\uCC81\uFFFE\u000B\uCC93\uFFFE\u0011\uCCA1\uFFFE\u000B\uCCB3\uFFFE\u0011\uCCC1" + - "\uFFFE\u000B\uCCD3\uFFFE\u0011\uCCE1\uFFFE\u000B\uCCF3\uFFFE\u0011\uCD41\uFFFE\u000B\uCD53\uFFFE" + - "\u0011\uCD61\uFFFE\u000B\uCD73\uFFFE\u0011\uCD81\uFFFE\u000B\uCD93\uFFFE\u0011\uCDA1\uFFFE\u000B" + - "\uCDB3\uFFFE\u0011\uCDC1\uFFFE\u000B\uCDD3\uFFFE\u0011\uCDE1\uFFFE\u000B\uCDF3\uFFFE\u0011\uCE41" + - "\uFFFE\u000B\uCE53\uFFFE\u0011\uCE61\uFFFE\u000B\uCE73\uFFFE\u0011\uCE81\uFFFE\u000B\uCE93\uFFFE" + - "\u0011\uCEA1\uFFFE\u000B\uCEB3\uFFFE\u0011\uCEC1\uFFFE\u000B\uCED3\uFFFE\u0011\uCEE1\uFFFE\u000B" + - "\uCEF3\uFFFE\u0011\uCF41\uFFFE\u000B\uCF53\uFFFE\u0011\uCF61\uFFFE\u000B\uCF73\uFFFE\u0011\uCF81" + - "\uFFFE\u000B\uCF93\uFFFE\u0011\uCFA1\uFFFE\u000B\uCFB3\uFFFE\u0011\uD061\uFFFE\u000B\uD073\uFFFE" + - "\u0011\uD081\uFFFE\u000B\uD093\uFFFE\u0011\uD0A1\uFFFE\u000B\uD0B3\uFFFE\u0011\uD0C1\uFFFE\u000B" + - "\uD0D3\uFFFE\u0011\uD0E1\uFFFE\u000B\uD0F3\uFFFE\u0011\uD141\uFFFE\u000B\uD153\uFFFE\u0011\uD161" + - "\uFFFE\u000B\uD173\uFFFE\u0011\uD181\uFFFE\u000B\uD193\uFFFE\u0011\uD1A1\uFFFE\u000B\uD1B3\uFFFE" + - "\u0011\uD1C1\uFFFE\u000B\uD1D3\uFFFE\u0011\uD1E1\uFFFE\u000B\uD1F3\uFFFE\u0011\uD241\uFFFE\u000B" + - "\uD253\uFFFE\u0011\uD261\uFFFE\u000B\uD273\uFFFE\u0011\uD281\uFFFE\u000B\uD293\uFFFE\u0011\uD2A1" + - "\uFFFE\u000B\uD2B3\uFFFE\u0011\uD2C1\uFFFE\u000B\uD2D3\uFFFE\u0011\uD2E1\uFFFE\u000B\uD2F3\uFFFE" + - "\u0011\uD341\uFFFE\u000B\uD353\uFFFE\u0011\uD361\uFFFE\u000B\uD373\uFFFE\u0011\uD381\uFFFE\u000B" + - "\uD393\uFFFE\u0011\uD3A1\uFFFE\u000B\uD3B3\uFFFF\u085C\uFEFE\uFFFE\u003F\uD441\uFFFE\u007D\uD481" + - "\uFFFE\u003F\uD541\uFFFE\u007D\uD581\uFFFE\u003F\uD641\uFFFE\u007D\uD681\uFFFE\u003F\uD741\uFFFE" + - "\u007D\uD781\uFFFE\u003F\uD841\uFFFE\u007D\uD881\uFFFE\u003F\uD941\uFFFE\u007D\uD981\uFFFE\u003F" + - "\uDA41\uFFFE\u007D\uDA81\uFFFE\u003F\uDB41\uFFFE\u007D\uDB81\uFFFE\u003F\uDC41\uFFFE\u007D\uDC81" + - "\uFFFE\u003F\uDD41\uFFFE\u007D\uDD81\uFFFF\u10EB\uFEFE\u505E\u50D1\u5181\u5286\u5384\u539A\u53BE" + - "\u53CB\u55B1\u55CA\u564C\u578F\u57FD\u5869\u58E3\u58F5\u5950\u597C\u599A\u5A70\u5A74\u5A85\u5A8C" + - "\u5AA0\u5AA5\u5B5B\u5B72\u5BCE\u5C4F\u5CBC\u5D4C\u5D6B\u616A\u61F9\u62C2\u63AF\u63CC\u63E2\u6449" + - "\u64C2\u6590\u65C5\u6673\u667F\uFFFF\u0091\uFEFE\u6855\u50C1\u50D0\u51A9\u51C0\u51E2\u6889\u52D3" + - "\u52E5\u52FE\u534A\u689A\u689B\uFFFE\u0015\u689D\uFFFE\u0006\u68B5\uFFFE\u0007\u68BC\uFFFE\n" + - "\u68C5\uFFFE\u0019\u68D0\uFFFE\b\u68EA\u54B5\u6949\u54D1\u694A\u694B\u6950\u6955\u55F7\u6967" + - "\u57E3\u5842\u5861\u58C1\u58F3\u5953\u59C3\u59C6\u59D8\u5A4A\u5A51\u5AB8\u5AD0\u5B4B\u5C49\u5C53" + - "\u5C5B\u5CC1\u0000\u0005\u69EE\uEFF1\uF2F3\uF4F6\uF7F8\uF9FE\uFFFE\u0005\u6A41\u6A48\uFFFE\u000B" + - "\u6A4D\u5D5B\uFFFE\u0005\u6A5A\uFFFE\u0007\u6A60\u5D73\u6A67\u6A68\u5D77\uFFFE\u0004\u6A69\uFFFE" + - "\u0006\u6A6E\u6A75\u6A7B\u5D94\u0000\u0004\u6A7D\u7E7F\u8183\u8486\u898A\u6A8B\u5DBA\u6A9E\u6A9F" + - "\u6AA1\u6AA2\u6AA4\u5E4B\u6AA5\u6AA7\u6AA8\u6AA9\u6AB1\u5E94\u0000\f\u6AC4\uC8C9\uCACD\uCED0" + - "\uD1D2\uD3D4\uD5D7\uD8D9\uDADB\uDDDF\uE0E1\uE2E4\uE7E8\u6AE9\u5F87\uFFFE\u0006\u6AEA\u0000\u0004" + - "\u6AF2\uF3F6\uF7F8\uF9FB\uFCFD\u0000\u0004\u6B42\u4445\u4649\u4A4B\u4D4E\u6B4F\u604A\u6B5B\u6269" + - "\u6B8A\u62AB\u62FD\u6385\u648E\u6491\u6BB5\u64BF\u64CB\u6BBC\u6BC0\u6BCD\u65EB\u666A\u66E0\uFFFF" + - "\u04F5\uFEFE\u0000\u0007\u425A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uFFFE\n\u42F0\u0000" + - "\u0003\u427A\u5E4C\u7E6E\u6F7C\uFFFE\t\u42C1\uFFFE\t\u42D1\uFFFE\b\u42E2\u418B\u414B" + - "\u418C\u416A\u426D\u4279\uFFFE\t\u4281\uFFFE\t\u4291\uFFFE\b\u42A2\u42C0\u424F\u42D0" + - "\u4954\uFFFF\u0081\uFEFE\u424A\u416B\u425F\u414C\u426A\u416C\u42E0\uFFFF\u0019\uFEFE"; - - - ConvTable4930() - { - this(4930); - } - - ConvTable4930(int ccsid) - { - super(ccsid, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable4931.java b/cvsroot/src/com/ibm/as400/access/ConvTable4931.java deleted file mode 100644 index 20f2556bb..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable4931.java +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable4931.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// This is a Traditional Chinese character set. -class ConvTable4931 extends ConvTable835 -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable4931() - { - super(4931); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable4933.java b/cvsroot/src/com/ibm/as400/access/ConvTable4933.java deleted file mode 100644 index 1fc31b862..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable4933.java +++ /dev/null @@ -1,1864 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable4933.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable4933 extends ConvTableDoubleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\uFFFE\u0004\u0000\u0000\u0003\u009C\u0986\u7F97\u8D8E\uFFFE\t\u000B\u0000\u0016\u009D\u8508" + - "\u8718\u1992\u8F1C\u1D1E\u1F80\u8182\u8384\u0A17\u1B88\u898A\u8B8C\u0506\u0790\u9116\u9394\u9596" + - "\u0498\u999A\u9B14\u159E\u1A20\uFFFF\t\u001A\u0000\u0003\u00A3\u2E3C\u282B\u7C26\uFFFF\t" + - "\u001A\u0000\u0003\u0021\uA52A\u293B\uAC2D\u002F\uFFFF\b\u001A\u00A6\u002C\u0025\u005F\u003E" + - "\u003F\uFFFF\t\u001A\u0000\u0003\u0060\u3A23\u4027\u3D22\u001A\uFFFE\t\u0061\uFFFF\u0007" + - "\u001A\uFFFE\t\u006A\uFFFF\u0006\u001A\u007E\u203E\uFFFE\b\u0073\uFFFF\u0006\u001A\u005E" + - "\u001A\\\uFFFF\u0007\u001A\u0000\u0003\u005B\u5D1A\u1A1A\u1A7B\uFFFE\t\u0041\uFFFF\u0006" + - "\u001A\u007D\uFFFE\t\u004A\uFFFF\u0006\u001A\u0024\u001A\uFFFE\b\u0053\uFFFF\u0006\u001A" + - "\uFFFE\n\u0030\uFFFF\u0005\u001A\u009F\uFFFF\u3F40\uFFFD\u3000\uFFFF\u0100\uFFFD\uFFFE\u0011" + - "\u03B1\uFFFE\u0007\u03C3\uFFFF\b\uFFFD\uFFFE\u0011\u0391\uFFFE\u0007\u03A3\uFFFF\u0007\uFFFD" + - "\uFFFE\u0006\u0430\u0451\uFFFE\u001A\u0436\uFFFF\u0010\uFFFD\uFFFE\n\u2170\uFFFF\u0005\uFFFD" + - "\uFFFE\u0006\u0410\u0401\uFFFE\u001A\u0416\uFFFF\u0010\uFFFD\uFFFE\f\u2160\uFFFF\u004D\uFFFD" + - "\u0000\u0003\uFFE1\u0E1C\u080B\u5C06\uFFFF\t\uFFFD\u0000\u0003\uFF01\uE50A\u091B\uE20D\uFF0F" + - "\uFFFF\b\uFFFD\uFFE4\uFF0C\uFF05\uFF3F\uFF1E\uFF1F\uFFFF\t\uFFFD\u0000\u0003\uFF40\u1A03" + - "\u2007\u1D02\uFFFD\uFFFE\t\uFF41\uFFFF\u0007\uFFFD\uFFFE\t\uFF4A\uFFFF\u0007\uFFFD\uFFE3" + - "\uFFFE\b\uFF53\uFFFF\u0016\uFFFD\uFF5B\uFFFE\t\uFF21\uFFFF\u0006\uFFFD\uFF5D\uFFFE\t" + - "\uFF2A\uFFFF\u0006\uFFFD\uFF04\uFFFD\uFFFE\b\uFF33\uFFFF\u0006\uFFFD\uFFFE\n\uFF10\uFFFF" + - "\u0047\uFFFD\u3002\u300C\u300D\u3001\u00B7\u30F2\u30A1\u30A3\u30A5\u0000\u0003\uFFE0\uFDFD\uFDFD" + - "\uFDFD\u0000\u0004\u30A7\uA9E3\uE5E7\uC3EE\uFCF5\u30F6\uF83D\uFFFF\u0025\uFFFD\u0000\u0004\u30A2" + - "\uA4A6\uA8AA\uABAD\uAFB1\u30B3\uFFFD\u0000\u0007\u30B5\uB7B9\uBBBD\uBFC1\uC4C6\uC8CA\uCBCC\uCDCE" + - "\uFFFD\uFFFD\u30CF\u30D2\u30D5\uFFFD\uFF5E\u0000\u0004\u30D8\uDBDE\uDFE0\uE1E2\uE4E6\uFFFD\uFFFE" + - "\u0004\u30E8\uFFFF\n\uFFFD\u0000\u0011\u30EC\uEDEF\uF39B\u9CAC\uAEB0\uB2B4\uB6B8\uBABC\uBEC0" + - "\uC2C5\uC7C9\uD0D3\uD6D9\uDCF4\uD1D4\uD7DA\uDDF0\uF1FD\u30FE\uFFFD\uFFFD\uFF3C\uFFFF\u0061\uFFFD" + - "\u300E\u300F\uFF3B\uFF3D\u3092\u3041\u3043\u3045\u2015\u00B1\u2260\u221E\u2103\uFFFD\u00B4\u0000" + - "\u0003\u3047\u4983\u8587\u638E\uFFFD\uFFFD\u2010\u3003\uF83E\u3005\u3006\u3007\u00A8\u2018\u201C" + - "\u3014\u3008\u300A\u3010\u2264\u2234\u2642\u00A7\u203B\u3012\u3231\u2116\u2121\uFF3E\u2019\u201D" + - "\u3015\u3009\u300B\u3011\u2265\u2235\u2640\u00D7\u00F7\u2016\u3013\u2025\u2026\uFFFD\u0000\u0004" + - "\u3042\u4446\u484A\u4B4D\u4F51\u3053\uFFFD\u0000\u0007\u3055\u5759\u5B5D\u5F61\u6466\u686A\u6B6C" + - "\u6D6E\uFFFD\uFFFD\u306F\u3072\u3075\uFFFD\uFFFD\u0000\u0004\u3078\u7B7E\u7F80\u8182\u8486\uFFFD" + - "\uFFFE\u0004\u3088\uFFFF\n\uFFFD\u308C\u308D\u308F\u3093\uFFFD\uFFFD\u0000\t\u304C\u4E50" + - "\u5254\u5658\u5A5C\u5E60\u6265\u6769\u7073\u7679\u307C\uFFFD\u0000\u0004\u3071\u7477\u7A7D\u9091" + - "\u9D9E\uFFFD\uFFFD\u25CB\u25CF\u25B3\u25B2\u25CE\u2606\u2605\u25C7\u25C6\u25A1\u25A0\u25BD\u25BC" + - "\u00B0\u2032\u2033\u2192\u2190\u2191\u2193\uFFFF\u0051\uFFFD\u02C9\u02C7\uFFFF\u0014\uFFFD\u3016" + - "\u3017\uFFFF\u0005\uFFFD\u0000\u0006\u2236\u2728\u110F\u2A29\u0837\u1AA5\u2520\u2312\u0000\u0003" + - "\u2299\u2B2E\u614C\u483D\u221D\uFFFD\u226E\u226F\uFFFF\r\uFFFD\u00A4\uFFFD\uFFFD\u2030\uFFFF" + - "\u0025\uFFFD\uFFFE\u0014\u2488\uFFFE\u0014\u2474\uFFFF\b\uFFFD\uFFFE\n\u2460\u20AC\uFFFF" + - "\u0005\uFFFD\uFFFE\n\u3220\uFFFF\u0046\uFFFD\u0101\u00E1\u01CE\u00E0\u0113\u00E9\u011B\u00E8" + - "\u012B\u00ED\u01D0\u00EC\u014D\u00F3\u01D2\u00F2\u016B\u00FA\u01D4\u00F9\u01D6\u01D8\u01DA\u01DC" + - "\u00FC\u00EA\u0251\uE7C7\u0144\u0148\u01F9\u0261\uFFFF\u0004\uFFFD\uFFFE\u0025\u3105\uFFFF\u001A" + - "\uFFFD\uFFFE\u004C\u2500\uFFFF\u0051\uFFFD\u0000\t\uFE35\u3639\u3A3F\u403D\u3E41\u4243\u443B" + - "\u3C37\u3831\u3334\uFFFF\t\uFFFD\uFFFE\u00A2\u0600\uFFFF\u0042\uFFFD\uFFFE\u005E\u06A2\uFFFD" + - "\u554A\u963F\u57C3\u6328\u54CE\u5509\u54C0\u7691\u764C\u853C\u77EE\u827E\u788D\u7231\u9698\u978D" + - "\u6C28\u5B89\u4FFA\u6309\u6697\u5CB8\u80FA\u6848\u80AE\u6602\u76CE\u51F9\u6556\u71AC\u7FF1\u8884" + - "\u50B2\u5965\u61CA\u6FB3\u82AD\u634C\u6252\u53ED\u5427\u7B06\u516B\u75A4\u5DF4\u62D4\u8DCB\u9776" + - "\u628A\u8019\u575D\u9738\u7F62\u7238\u767D\u67CF\u767E\u6446\u4F70\u8D25\u62DC\u7A17\u6591\u73ED" + - "\u642C\u6273\u822C\u9881\u677F\u7248\u626E\u62CC\u4F34\u74E3\u534A\u529E\u7ECA\u90A6\u5E2E\u6886" + - "\u699C\u8180\u7ED1\u68D2\u78C5\u868C\u9551\u508D\u8C24\u82DE\u80DE\u5305\u8912\u5265\uFFFF\u0043" + - "\uFFFD\u8584\u96F9\u4FDD\u5821\u9971\u5B9D\u62B1\u62A5\u66B4\u8C79\u9C8D\u7206\u676F\u7891\u60B2" + - "\u5351\u5317\u8F88\u80CC\u8D1D\u94A1\u500D\u72C8\u5907\u60EB\u7119\u88AB\u5954\u82EF\u672C\u7B28" + - "\u5D29\u7EF7\u752D\u6CF5\u8E66\u8FF8\u903C\u9F3B\u6BD4\u9119\u7B14\u5F7C\u78A7\u84D6\u853D\u6BD5" + - "\u6BD9\u6BD6\u5E01\u5E87\u75F9\u95ED\u655D\u5F0A\u5FC5\u8F9F\u58C1\u81C2\u907F\u965B\u97AD\u8FB9" + - "\uFFFD\u7F16\u8D2C\u6241\u4FBF\u53D8\u535E\u8FA8\u8FA9\u8FAB\u904D\u6807\u5F6A\u8198\u8868\u9CD6" + - "\u618B\u522B\u762A\u5F6C\u658C\u6FD2\u6EE8\u5BBE\u6448\u5175\u51B0\u67C4\u4E19\u79C9\u997C\u70B3" + - "\u75C5\u5E76\u73BB\u83E0\u64AD\u62E8\u94B5\u6CE2\u535A\u52C3\u640F\u94C2\u7B94\u4F2F\u5E1B\u8236" + - "\u8116\u818A\u6E24\u6CCA\u9A73\u6355\u535C\u54FA\u8865\u57E0\u4E0D\u5E03\u6B65\u7C3F\u90E8\u6016" + - "\u64E6\u731C\u88C1\u6750\u624D\u8D22\u776C\u8E29\u91C7\u5F69\u83DC\u8521\u9910\u53C2\u8695\u6B8B" + - "\u60ED\u60E8\u707F\u82CD\u8231\u4ED3\u6CA7\u85CF\u64CD\u7CD9\u69FD\u66F9\u8349\u5395\u7B56\u4FA7" + - "\u518C\u6D4B\u5C42\u8E6D\u63D2\u53C9\u832C\u8336\u67E5\u78B4\u643D\u5BDF\u5C94\u5DEE\u8BE7\u62C6" + - "\u67F4\u8C7A\u6400\u63BA\u8749\u998B\u8C17\u7F20\u94F2\u4EA7\u9610\u98A4\u660C\u7316\uFFFF\u0043" + - "\uFFFD\u573A\u5C1D\u5E38\u957F\u507F\u80A0\u5382\u655E\u7545\u5531\u5021\u8D85\u6284\u949E\u671D" + - "\u5632\u6F6E\u5DE2\u5435\u7092\u8F66\u626F\u64A4\u63A3\u5F7B\u6F88\u90F4\u81E3\u8FB0\u5C18\u6668" + - "\u5FF1\u6C89\u9648\u8D81\u886C\u6491\u79F0\u57CE\u6A59\u6210\u5448\u4E58\u7A0B\u60E9\u6F84\u8BDA" + - "\u627F\u901E\u9A8B\u79E4\u5403\u75F4\u6301\u5319\u6C60\u8FDF\u5F1B\u9A70\u803B\u9F7F\u4F88\u5C3A" + - "\uFFFD\u8D64\u7FC5\u65A5\u70BD\u5145\u51B2\u866B\u5D07\u5BA0\u62BD\u916C\u7574\u8E0C\u7A20\u6101" + - "\u7B79\u4EC7\u7EF8\u7785\u4E11\u81ED\u521D\u51FA\u6A71\u53A8\u8E87\u9504\u96CF\u6EC1\u9664\u695A" + - "\u7840\u50A8\u77D7\u6410\u89E6\u5904\u63E3\u5DDD\u7A7F\u693D\u4F20\u8239\u5598\u4E32\u75AE\u7A97" + - "\u5E62\u5E8A\u95EF\u521B\u5439\u708A\u6376\u9524\u5782\u6625\u693F\u9187\u5507\u6DF3\u7EAF\u8822" + - "\u6233\u7EF0\u75B5\u8328\u78C1\u96CC\u8F9E\u6148\u74F7\u8BCD\u6B64\u523A\u8D50\u6B21\u806A\u8471" + - "\u56F1\u5306\u4ECE\u4E1B\u51D1\u7C97\u918B\u7C07\u4FC3\u8E7F\u7BE1\u7A9C\u6467\u5D14\u50AC\u8106" + - "\u7601\u7CB9\u6DEC\u7FE0\u6751\u5B58\u5BF8\u78CB\u64AE\u6413\u63AA\u632B\u9519\u642D\u8FBE\u7B54" + - "\u7629\u6253\u5927\u5446\u6B79\u50A3\u6234\u5E26\u6B86\u4EE3\u8D37\u888B\u5F85\u902E\uFFFF\u0043" + - "\uFFFD\u6020\u803D\u62C5\u4E39\u5355\u90F8\u63B8\u80C6\u65E6\u6C2E\u4F46\u60EE\u6DE1\u8BDE\u5F39" + - "\u86CB\u5F53\u6321\u515A\u8361\u6863\u5200\u6363\u8E48\u5012\u5C9B\u7977\u5BFC\u5230\u7A3B\u60BC" + - "\u9053\u76D7\u5FB7\u5F97\u7684\u8E6C\u706F\u767B\u7B49\u77AA\u51F3\u9093\u5824\u4F4E\u6EF4\u8FEA" + - "\u654C\u7B1B\u72C4\u6DA4\u7FDF\u5AE1\u62B5\u5E95\u5730\u8482\u7B2C\u5E1D\u5F1F\u9012\u7F14\u98A0" + - "\uFFFD\u6382\u6EC7\u7898\u70B9\u5178\u975B\u57AB\u7535\u4F43\u7538\u5E97\u60E6\u5960\u6DC0\u6BBF" + - "\u7889\u53FC\u96D5\u51CB\u5201\u6389\u540A\u9493\u8C03\u8DCC\u7239\u789F\u8776\u8FED\u8C0D\u53E0" + - "\u4E01\u76EF\u53EE\u9489\u9876\u9F0E\u952D\u5B9A\u8BA2\u4E22\u4E1C\u51AC\u8463\u61C2\u52A8\u680B" + - "\u4F97\u606B\u51BB\u6D1E\u515C\u6296\u6597\u9661\u8C46\u9017\u75D8\u90FD\u7763\u6BD2\u728A\u72EC" + - "\u8BFB\u5835\u7779\u8D4C\u675C\u9540\u809A\u5EA6\u6E21\u5992\u7AEF\u77ED\u953B\u6BB5\u65AD\u7F0E" + - "\u5806\u5151\u961F\u5BF9\u58A9\u5428\u8E72\u6566\u987F\u56E4\u949D\u76FE\u9041\u6387\u54C6\u591A" + - "\u593A\u579B\u8EB2\u6735\u8DFA\u8235\u5241\u60F0\u5815\u86FE\u5CE8\u9E45\u4FC4\u989D\u8BB9\u5A25" + - "\u6076\u5384\u627C\u904F\u9102\u997F\u6069\u800C\u513F\u8033\u5C14\u9975\u6D31\u4E8C\uFFFF\u0043" + - "\uFFFD\u8D30\u53D1\u7F5A\u7B4F\u4F10\u4E4F\u9600\u6CD5\u73D0\u85E9\u5E06\u756A\u7FFB\u6A0A\u77FE" + - "\u9492\u7E41\u51E1\u70E6\u53CD\u8FD4\u8303\u8D29\u72AF\u996D\u6CDB\u574A\u82B3\u65B9\u80AA\u623F" + - "\u9632\u59A8\u4EFF\u8BBF\u7EBA\u653E\u83F2\u975E\u5561\u98DE\u80A5\u532A\u8BFD\u5420\u80BA\u5E9F" + - "\u6CB8\u8D39\u82AC\u915A\u5429\u6C1B\u5206\u7EB7\u575F\u711A\u6C7E\u7C89\u594B\u4EFD\u5FFF\u6124" + - "\uFFFD\u7CAA\u4E30\u5C01\u67AB\u8702\u5CF0\u950B\u98CE\u75AF\u70FD\u9022\u51AF\u7F1D\u8BBD\u5949" + - "\u51E4\u4F5B\u5426\u592B\u6577\u80A4\u5B75\u6276\u62C2\u8F90\u5E45\u6C1F\u7B26\u4F0F\u4FD8\u670D" + - "\u6D6E\u6DAA\u798F\u88B1\u5F17\u752B\u629A\u8F85\u4FEF\u91DC\u65A7\u812F\u8151\u5E9C\u8150\u8D74" + - "\u526F\u8986\u8D4B\u590D\u5085\u4ED8\u961C\u7236\u8179\u8D1F\u5BCC\u8BA3\u9644\u5987\u7F1A\u5490" + - "\u5676\u560E\u8BE5\u6539\u6982\u9499\u76D6\u6E89\u5E72\u7518\u6746\u67D1\u7AFF\u809D\u8D76\u611F" + - "\u79C6\u6562\u8D63\u5188\u521A\u94A2\u7F38\u809B\u7EB2\u5C97\u6E2F\u6760\u7BD9\u768B\u9AD8\u818F" + - "\u7F94\u7CD5\u641E\u9550\u7A3F\u544A\u54E5\u6B4C\u6401\u6208\u9E3D\u80F3\u7599\u5272\u9769\u845B" + - "\u683C\u86E4\u9601\u9694\u94EC\u4E2A\u5404\u7ED9\u6839\u8DDF\u8015\u66F4\u5E9A\u7FB9\uFFFF\u0043" + - "\uFFFD\u57C2\u803F\u6897\u5DE5\u653B\u529F\u606D\u9F9A\u4F9B\u8EAC\u516C\u5BAB\u5F13\u5DE9\u6C5E" + - "\u62F1\u8D21\u5171\u94A9\u52FE\u6C9F\u82DF\u72D7\u57A2\u6784\u8D2D\u591F\u8F9C\u83C7\u5495\u7B8D" + - "\u4F30\u6CBD\u5B64\u59D1\u9F13\u53E4\u86CA\u9AA8\u8C37\u80A1\u6545\u987E\u56FA\u96C7\u522E\u74DC" + - "\u5250\u5BE1\u6302\u8902\u4E56\u62D0\u602A\u68FA\u5173\u5B98\u51A0\u89C2\u7BA1\u9986\u7F50\u60EF" + - "\uFFFD\u704C\u8D2F\u5149\u5E7F\u901B\u7470\u89C4\u572D\u7845\u5F52\u9F9F\u95FA\u8F68\u9B3C\u8BE1" + - "\u7678\u6842\u67DC\u8DEA\u8D35\u523D\u8F8A\u6EDA\u68CD\u9505\u90ED\u56FD\u679C\u88F9\u8FC7\u54C8" + - "\u9AB8\u5B69\u6D77\u6C26\u4EA5\u5BB3\u9A87\u9163\u61A8\u90AF\u97E9\u542B\u6DB5\u5BD2\u51FD\u558A" + - "\u7F55\u7FF0\u64BC\u634D\u65F1\u61BE\u608D\u710A\u6C57\u6C49\u592F\u676D\u822A\u58D5\u568E\u8C6A" + - "\u6BEB\u90DD\u597D\u8017\u53F7\u6D69\u5475\u559D\u8377\u83CF\u6838\u79BE\u548C\u4F55\u5408\u76D2" + - "\u8C89\u9602\u6CB3\u6DB8\u8D6B\u8910\u9E64\u8D3A\u563F\u9ED1\u75D5\u5F88\u72E0\u6068\u54FC\u4EA8" + - "\u6A2A\u8861\u6052\u8F70\u54C4\u70D8\u8679\u9E3F\u6D2A\u5B8F\u5F18\u7EA2\u5589\u4FAF\u7334\u543C" + - "\u539A\u5019\u540E\u547C\u4E4E\u5FFD\u745A\u58F6\u846B\u80E1\u8774\u72D0\u7CCA\u6E56\uFFFF\u0043" + - "\uFFFD\u5F27\u864E\u552C\u62A4\u4E92\u6CAA\u6237\u82B1\u54D7\u534E\u733E\u6ED1\u753B\u5212\u5316" + - "\u8BDD\u69D0\u5F8A\u6000\u6DEE\u574F\u6B22\u73AF\u6853\u8FD8\u7F13\u6362\u60A3\u5524\u75EA\u8C62" + - "\u7115\u6DA3\u5BA6\u5E7B\u8352\u614C\u9EC4\u78FA\u8757\u7C27\u7687\u51F0\u60F6\u714C\u6643\u5E4C" + - "\u604D\u8C0E\u7070\u6325\u8F89\u5FBD\u6062\u86D4\u56DE\u6BC1\u6094\u6167\u5349\u60E0\u6666\u8D3F" + - "\uFFFD\u79FD\u4F1A\u70E9\u6C47\u8BB3\u8BF2\u7ED8\u8364\u660F\u5A5A\u9B42\u6D51\u6DF7\u8C41\u6D3B" + - "\u4F19\u706B\u83B7\u6216\u60D1\u970D\u8D27\u7978\u51FB\u573E\u57FA\u673A\u7578\u7A3D\u79EF\u7B95" + - "\u808C\u9965\u8FF9\u6FC0\u8BA5\u9E21\u59EC\u7EE9\u7F09\u5409\u6781\u68D8\u8F91\u7C4D\u96C6\u53CA" + - "\u6025\u75BE\u6C72\u5373\u5AC9\u7EA7\u6324\u51E0\u810A\u5DF1\u84DF\u6280\u5180\u5B63\u4F0E\u796D" + - "\u5242\u60B8\u6D4E\u5BC4\u5BC2\u8BA1\u8BB0\u65E2\u5FCC\u9645\u5993\u7EE7\u7EAA\u5609\u67B7\u5939" + - "\u4F73\u5BB6\u52A0\u835A\u988A\u8D3E\u7532\u94BE\u5047\u7A3C\u4EF7\u67B6\u9A7E\u5AC1\u6B7C\u76D1" + - "\u575A\u5C16\u7B3A\u95F4\u714E\u517C\u80A9\u8270\u5978\u7F04\u8327\u68C0\u67EC\u78B1\u7877\u62E3" + - "\u6361\u7B80\u4FED\u526A\u51CF\u8350\u69DB\u9274\u8DF5\u8D31\u89C1\u952E\u7BAD\u4EF6\uFFFF\u0043" + - "\uFFFD\u5065\u8230\u5251\u996F\u6E10\u6E85\u6DA7\u5EFA\u50F5\u59DC\u5C06\u6D46\u6C5F\u7586\u848B" + - "\u6868\u5956\u8BB2\u5320\u9171\u964D\u8549\u6912\u7901\u7126\u80F6\u4EA4\u90CA\u6D47\u9A84\u5A07" + - "\u56BC\u6405\u94F0\u77EB\u4FA5\u811A\u72E1\u89D2\u997A\u7F34\u7EDE\u527F\u6559\u9175\u8F7F\u8F83" + - "\u53EB\u7A96\u63ED\u63A5\u7686\u79F8\u8857\u9636\u622A\u52AB\u8282\u6854\u6770\u6377\u776B\u7AED" + - "\uFFFD\u6D01\u7ED3\u89E3\u59D0\u6212\u85C9\u82A5\u754C\u501F\u4ECB\u75A5\u8BEB\u5C4A\u5DFE\u7B4B" + - "\u65A4\u91D1\u4ECA\u6D25\u895F\u7D27\u9526\u4EC5\u8C28\u8FDB\u9773\u664B\u7981\u8FD1\u70EC\u6D78" + - "\u5C3D\u52B2\u8346\u5162\u830E\u775B\u6676\u9CB8\u4EAC\u60CA\u7CBE\u7CB3\u7ECF\u4E95\u8B66\u666F" + - "\u9888\u9759\u5883\u656C\u955C\u5F84\u75C9\u9756\u7ADF\u7ADE\u51C0\u70AF\u7A98\u63EA\u7A76\u7EA0" + - "\u7396\u97ED\u4E45\u7078\u4E5D\u9152\u53A9\u6551\u65E7\u81FC\u8205\u548E\u5C31\u759A\u97A0\u62D8" + - "\u72D9\u75BD\u5C45\u9A79\u83CA\u5C40\u5480\u77E9\u4E3E\u6CAE\u805A\u62D2\u636E\u5DE8\u5177\u8DDD" + - "\u8E1E\u952F\u4FF1\u53E5\u60E7\u70AC\u5267\u6350\u9E43\u5A1F\u5026\u7737\u5377\u7EE2\u6485\u652B" + - "\u6289\u6398\u5014\u7235\u89C9\u51B3\u8BC0\u7EDD\u5747\u83CC\u94A7\u519B\u541B\u5CFB\uFFFF\u0043" + - "\uFFFD\u4FCA\u7AE3\u6D5A\u90E1\u9A8F\u5580\u5496\u5361\u54AF\u5F00\u63E9\u6977\u51EF\u6168\u520A" + - "\u582A\u52D8\u574E\u780D\u770B\u5EB7\u6177\u7CE0\u625B\u6297\u4EA2\u7095\u8003\u62F7\u70E4\u9760" + - "\u5777\u82DB\u67EF\u68F5\u78D5\u9897\u79D1\u58F3\u54B3\u53EF\u6E34\u514B\u523B\u5BA2\u8BFE\u80AF" + - "\u5543\u57A6\u6073\u5751\u542D\u7A7A\u6050\u5B54\u63A7\u62A0\u53E3\u6263\u5BC7\u67AF\u54ED\u7A9F" + - "\uFFFD\u82E6\u9177\u5E93\u88E4\u5938\u57AE\u630E\u8DE8\u80EF\u5757\u7B77\u4FA9\u5FEB\u5BBD\u6B3E" + - "\u5321\u7B50\u72C2\u6846\u77FF\u7736\u65F7\u51B5\u4E8F\u76D4\u5CBF\u7AA5\u8475\u594E\u9B41\u5080" + - "\u9988\u6127\u6E83\u5764\u6606\u6346\u56F0\u62EC\u6269\u5ED3\u9614\u5783\u62C9\u5587\u8721\u814A" + - "\u8FA3\u5566\u83B1\u6765\u8D56\u84DD\u5A6A\u680F\u62E6\u7BEE\u9611\u5170\u6F9C\u8C30\u63FD\u89C8" + - "\u61D2\u7F06\u70C2\u6EE5\u7405\u6994\u72FC\u5ECA\u90CE\u6717\u6D6A\u635E\u52B3\u7262\u8001\u4F6C" + - "\u59E5\u916A\u70D9\u6D9D\u52D2\u4E50\u96F7\u956D\u857E\u78CA\u7D2F\u5121\u5792\u64C2\u808B\u7C7B" + - "\u6CEA\u68F1\u695E\u51B7\u5398\u68A8\u7281\u9ECE\u7BF1\u72F8\u79BB\u6F13\u7406\u674E\u91CC\u9CA4" + - "\u793C\u8389\u8354\u540F\u6817\u4E3D\u5389\u52B1\u783E\u5386\u5229\u5088\u4F8B\u4FD0\uFFFF\u0043" + - "\uFFFD\u75E2\u7ACB\u7C92\u6CA5\u96B6\u529B\u7483\u54E9\u4FE9\u8054\u83B2\u8FDE\u9570\u5EC9\u601C" + - "\u6D9F\u5E18\u655B\u8138\u94FE\u604B\u70BC\u7EC3\u7CAE\u51C9\u6881\u7CB1\u826F\u4E24\u8F86\u91CF" + - "\u667E\u4EAE\u8C05\u64A9\u804A\u50DA\u7597\u71CE\u5BE5\u8FBD\u6F66\u4E86\u6482\u9563\u5ED6\u6599" + - "\u5217\u88C2\u70C8\u52A3\u730E\u7433\u6797\u78F7\u9716\u4E34\u90BB\u9CDE\u6DCB\u51DB\u8D41\u541D" + - "\uFFFD\u62CE\u73B2\u83F1\u96F6\u9F84\u94C3\u4F36\u7F9A\u51CC\u7075\u9675\u5CAD\u9886\u53E6\u4EE4" + - "\u6E9C\u7409\u69B4\u786B\u998F\u7559\u5218\u7624\u6D41\u67F3\u516D\u9F99\u804B\u5499\u7B3C\u7ABF" + - "\u9686\u5784\u62E2\u9647\u697C\u5A04\u6402\u7BD3\u6F0F\u964B\u82A6\u5362\u9885\u5E90\u7089\u63B3" + - "\u5364\u864F\u9C81\u9E93\u788C\u9732\u8DEF\u8D42\u9E7F\u6F5E\u7984\u5F55\u9646\u622E\u9A74\u5415" + - "\u94DD\u4FA3\u65C5\u5C65\u5C61\u7F15\u8651\u6C2F\u5F8B\u7387\u6EE4\u7EFF\u5CE6\u631B\u5B6A\u6EE6" + - "\u5375\u4E71\u63A0\u7565\u62A1\u8F6E\u4F26\u4ED1\u6CA6\u7EB6\u8BBA\u841D\u87BA\u7F57\u903B\u9523" + - "\u7BA9\u9AA1\u88F8\u843D\u6D1B\u9A86\u7EDC\u5988\u9EBB\u739B\u7801\u8682\u9A6C\u9A82\u561B\u5417" + - "\u57CB\u4E70\u9EA6\u5356\u8FC8\u8109\u7792\u9992\u86EE\u6EE1\u8513\u66FC\u6162\u6F2B\uFFFF\u0043" + - "\uFFFD\u8C29\u8292\u832B\u76F2\u6C13\u5FD9\u83BD\u732B\u8305\u951A\u6BDB\u77DB\u94C6\u536F\u8302" + - "\u5192\u5E3D\u8C8C\u8D38\u4E48\u73AB\u679A\u6885\u9176\u9709\u7164\u6CA1\u7709\u5A92\u9541\u6BCF" + - "\u7F8E\u6627\u5BD0\u59B9\u5A9A\u95E8\u95F7\u4EEC\u840C\u8499\u6AAC\u76DF\u9530\u731B\u68A6\u5B5F" + - "\u772F\u919A\u9761\u7CDC\u8FF7\u8C1C\u5F25\u7C73\u79D8\u89C5\u6CCC\u871C\u5BC6\u5E42\u68C9\u7720" + - "\uFFFD\u7EF5\u5195\u514D\u52C9\u5A29\u7F05\u9762\u82D7\u63CF\u7784\u85D0\u79D2\u6E3A\u5E99\u5999" + - "\u8511\u706D\u6C11\u62BF\u76BF\u654F\u60AF\u95FD\u660E\u879F\u9E23\u94ED\u540D\u547D\u8C2C\u6478" + - "\u6479\u8611\u6A21\u819C\u78E8\u6469\u9B54\u62B9\u672B\u83AB\u58A8\u9ED8\u6CAB\u6F20\u5BDE\u964C" + - "\u8C0B\u725F\u67D0\u62C7\u7261\u4EA9\u59C6\u6BCD\u5893\u66AE\u5E55\u52DF\u6155\u6728\u76EE\u7766" + - "\u7267\u7A46\u62FF\u54EA\u5450\u94A0\u90A3\u5A1C\u7EB3\u6C16\u4E43\u5976\u8010\u5948\u5357\u7537" + - "\u96BE\u56CA\u6320\u8111\u607C\u95F9\u6DD6\u5462\u9981\u5185\u5AE9\u80FD\u59AE\u9713\u502A\u6CE5" + - "\u5C3C\u62DF\u4F60\u533F\u817B\u9006\u6EBA\u852B\u62C8\u5E74\u78BE\u64B5\u637B\u5FF5\u5A18\u917F" + - "\u9E1F\u5C3F\u634F\u8042\u5B7D\u556E\u954A\u954D\u6D85\u60A8\u67E0\u72DE\u51DD\u5B81\uFFFF\u0043" + - "\uFFFD\u62E7\u6CDE\u725B\u626D\u94AE\u7EBD\u8113\u6D53\u519C\u5F04\u5974\u52AA\u6012\u5973\u6696" + - "\u8650\u759F\u632A\u61E6\u7CEF\u8BFA\u54E6\u6B27\u9E25\u6BB4\u85D5\u5455\u5076\u6CA4\u556A\u8DB4" + - "\u722C\u5E15\u6015\u7436\u62CD\u6392\u724C\u5F98\u6E43\u6D3E\u6500\u6F58\u76D8\u78D0\u76FC\u7554" + - "\u5224\u53DB\u4E53\u5E9E\u65C1\u802A\u80D6\u629B\u5486\u5228\u70AE\u888D\u8DD1\u6CE1\u5478\u80DA" + - "\uFFFD\u57F9\u88F4\u8D54\u966A\u914D\u4F69\u6C9B\u55B7\u76C6\u7830\u62A8\u70F9\u6F8E\u5F6D\u84EC" + - "\u68DA\u787C\u7BF7\u81A8\u670B\u9E4F\u6367\u78B0\u576F\u7812\u9739\u6279\u62AB\u5288\u7435\u6BD7" + - "\u5564\u813E\u75B2\u76AE\u5339\u75DE\u50FB\u5C41\u8B6C\u7BC7\u504F\u7247\u9A97\u98D8\u6F02\u74E2" + - "\u7968\u6487\u77A5\u62FC\u9891\u8D2B\u54C1\u8058\u4E52\u576A\u82F9\u840D\u5E73\u51ED\u74F6\u8BC4" + - "\u5C4F\u5761\u6CFC\u9887\u5A46\u7834\u9B44\u8FEB\u7C95\u5256\u6251\u94FA\u4EC6\u8386\u8461\u83E9" + - "\u84B2\u57D4\u6734\u5703\u666E\u6D66\u8C31\u66DD\u7011\u671F\u6B3A\u6816\u621A\u59BB\u4E03\u51C4" + - "\u6F06\u67D2\u6C8F\u5176\u68CB\u5947\u6B67\u7566\u5D0E\u8110\u9F50\u65D7\u7948\u7941\u9A91\u8D77" + - "\u5C82\u4E5E\u4F01\u542F\u5951\u780C\u5668\u6C14\u8FC4\u5F03\u6C7D\u6CE3\u8BAB\u6390\uFFFF\u0043" + - "\uFFFD\u6070\u6D3D\u7275\u6266\u948E\u94C5\u5343\u8FC1\u7B7E\u4EDF\u8C26\u4E7E\u9ED4\u94B1\u94B3" + - "\u524D\u6F5C\u9063\u6D45\u8C34\u5811\u5D4C\u6B20\u6B49\u67AA\u545B\u8154\u7F8C\u5899\u8537\u5F3A" + - "\u62A2\u6A47\u9539\u6572\u6084\u6865\u77A7\u4E54\u4FA8\u5DE7\u9798\u64AC\u7FD8\u5CED\u4FCF\u7A8D" + - "\u5207\u8304\u4E14\u602F\u7A83\u94A6\u4FB5\u4EB2\u79E6\u7434\u52E4\u82B9\u64D2\u79BD\u5BDD\u6C81" + - "\uFFFD\u9752\u8F7B\u6C22\u503E\u537F\u6E05\u64CE\u6674\u6C30\u60C5\u9877\u8BF7\u5E86\u743C\u7A77" + - "\u79CB\u4E18\u90B1\u7403\u6C42\u56DA\u914B\u6CC5\u8D8B\u533A\u86C6\u66F2\u8EAF\u5C48\u9A71\u6E20" + - "\u53D6\u5A36\u9F8B\u8DA3\u53BB\u5708\u98A7\u6743\u919B\u6CC9\u5168\u75CA\u62F3\u72AC\u5238\u529D" + - "\u7F3A\u7094\u7638\u5374\u9E4A\u69B7\u786E\u96C0\u88D9\u7FA4\u7136\u71C3\u5189\u67D3\u74E4\u58E4" + - "\u6518\u56B7\u8BA9\u9976\u6270\u7ED5\u60F9\u70ED\u58EC\u4EC1\u4EBA\u5FCD\u97E7\u4EFB\u8BA4\u5203" + - "\u598A\u7EAB\u6254\u4ECD\u65E5\u620E\u8338\u84C9\u8363\u878D\u7194\u6EB6\u5BB9\u7ED2\u5197\u63C9" + - "\u67D4\u8089\u8339\u8815\u5112\u5B7A\u5982\u8FB1\u4E73\u6C5D\u5165\u8925\u8F6F\u962E\u854A\u745E" + - "\u9510\u95F0\u6DA6\u82E5\u5F31\u6492\u6D12\u8428\u816E\u9CC3\u585E\u8D5B\u4E09\u53C1\uFFFF\u0043" + - "\uFFFD\u4F1E\u6563\u6851\u55D3\u4E27\u6414\u9A9A\u626B\u5AC2\u745F\u8272\u6DA9\u68EE\u50E7\u838E" + - "\u7802\u6740\u5239\u6C99\u7EB1\u50BB\u5565\u715E\u7B5B\u6652\u73CA\u82EB\u6749\u5C71\u5220\u717D" + - "\u886B\u95EA\u9655\u64C5\u8D61\u81B3\u5584\u6C55\u6247\u7F2E\u5892\u4F24\u5546\u8D4F\u664C\u4E0A" + - "\u5C1A\u88F3\u68A2\u634E\u7A0D\u70E7\u828D\u52FA\u97F6\u5C11\u54E8\u90B5\u7ECD\u5962\u8D4A\u86C7" + - "\uFFFD\u820C\u820D\u8D66\u6444\u5C04\u6151\u6D89\u793E\u8BBE\u7837\u7533\u547B\u4F38\u8EAB\u6DF1" + - "\u5A20\u7EC5\u795E\u6C88\u5BA1\u5A76\u751A\u80BE\u614E\u6E17\u58F0\u751F\u7525\u7272\u5347\u7EF3" + - "\u7701\u76DB\u5269\u80DC\u5723\u5E08\u5931\u72EE\u65BD\u6E7F\u8BD7\u5C38\u8671\u5341\u77F3\u62FE" + - "\u65F6\u4EC0\u98DF\u8680\u5B9E\u8BC6\u53F2\u77E2\u4F7F\u5C4E\u9A76\u59CB\u5F0F\u793A\u58EB\u4E16" + - "\u67FF\u4E8B\u62ED\u8A93\u901D\u52BF\u662F\u55DC\u566C\u9002\u4ED5\u4F8D\u91CA\u9970\u6C0F\u5E02" + - "\u6043\u5BA4\u89C6\u8BD5\u6536\u624B\u9996\u5B88\u5BFF\u6388\u552E\u53D7\u7626\u517D\u852C\u67A2" + - "\u68B3\u6B8A\u6292\u8F93\u53D4\u8212\u6DD1\u758F\u4E66\u8D4E\u5B70\u719F\u85AF\u6691\u66D9\u7F72" + - "\u8700\u9ECD\u9F20\u5C5E\u672F\u8FF0\u6811\u675F\u620D\u7AD6\u5885\u5EB6\u6570\u6F31\uFFFF\u0043" + - "\uFFFD\u6055\u5237\u800D\u6454\u8870\u7529\u5E05\u6813\u62F4\u971C\u53CC\u723D\u8C01\u6C34\u7761" + - "\u7A0E\u542E\u77AC\u987A\u821C\u8BF4\u7855\u6714\u70C1\u65AF\u6495\u5636\u601D\u79C1\u53F8\u4E1D" + - "\u6B7B\u8086\u5BFA\u55E3\u56DB\u4F3A\u4F3C\u9972\u5DF3\u677E\u8038\u6002\u9882\u9001\u5B8B\u8BBC" + - "\u8BF5\u641C\u8258\u64DE\u55FD\u82CF\u9165\u4FD7\u7D20\u901F\u7C9F\u50F3\u5851\u6EAF\u5BBF\u8BC9" + - "\uFFFD\u8083\u9178\u849C\u7B97\u867D\u968B\u968F\u7EE5\u9AD3\u788E\u5C81\u7A57\u9042\u96A7\u795F" + - "\u5B59\u635F\u7B0B\u84D1\u68AD\u5506\u7F29\u7410\u7D22\u9501\u6240\u584C\u4ED6\u5B83\u5979\u5854" + - "\u736D\u631E\u8E4B\u8E0F\u80CE\u82D4\u62AC\u53F0\u6CF0\u915E\u592A\u6001\u6C70\u574D\u644A\u8D2A" + - "\u762B\u6EE9\u575B\u6A80\u75F0\u6F6D\u8C2D\u8C08\u5766\u6BEF\u8892\u78B3\u63A2\u53F9\u70AD\u6C64" + - "\u5858\u642A\u5802\u68E0\u819B\u5510\u7CD6\u5018\u8EBA\u6DCC\u8D9F\u70EB\u638F\u6D9B\u6ED4\u7EE6" + - "\u8404\u6843\u9003\u6DD8\u9676\u8BA8\u5957\u7279\u85E4\u817E\u75BC\u8A8A\u68AF\u5254\u8E22\u9511" + - "\u63D0\u9898\u8E44\u557C\u4F53\u66FF\u568F\u60D5\u6D95\u5243\u5C49\u5929\u6DFB\u586B\u7530\u751C" + - "\u606C\u8214\u8146\u6311\u6761\u8FE2\u773A\u8DF3\u8D34\u94C1\u5E16\u5385\u542C\u70C3\uFFFF\u0043" + - "\uFFFD\u6C40\u5EF7\u505C\u4EAD\u5EAD\u633A\u8247\u901A\u6850\u916E\u77B3\u540C\u94DC\u5F64\u7AE5" + - "\u6876\u6345\u7B52\u7EDF\u75DB\u5077\u6295\u5934\u900F\u51F8\u79C3\u7A81\u56FE\u5F92\u9014\u6D82" + - "\u5C60\u571F\u5410\u5154\u6E4D\u56E2\u63A8\u9893\u817F\u8715\u892A\u9000\u541E\u5C6F\u81C0\u62D6" + - "\u6258\u8131\u9E35\u9640\u9A6E\u9A7C\u692D\u59A5\u62D3\u553E\u6316\u54C7\u86D9\u6D3C\u5A03\u74E6" + - "\uFFFD\u889C\u6B6A\u5916\u8C4C\u5F2F\u6E7E\u73A9\u987D\u4E38\u70F7\u5B8C\u7897\u633D\u665A\u7696" + - "\u60CB\u5B9B\u5A49\u4E07\u8155\u6C6A\u738B\u4EA1\u6789\u7F51\u5F80\u65FA\u671B\u5FD8\u5984\u5A01" + - "\u5DCD\u5FAE\u5371\u97E6\u8FDD\u6845\u56F4\u552F\u60DF\u4E3A\u6F4D\u7EF4\u82C7\u840E\u59D4\u4F1F" + - "\u4F2A\u5C3E\u7EAC\u672A\u851A\u5473\u754F\u80C3\u5582\u9B4F\u4F4D\u6E2D\u8C13\u5C09\u6170\u536B" + - "\u761F\u6E29\u868A\u6587\u95FB\u7EB9\u543B\u7A33\u7D0A\u95EE\u55E1\u7FC1\u74EE\u631D\u8717\u6DA1" + - "\u7A9D\u6211\u65A1\u5367\u63E1\u6C83\u5DEB\u545C\u94A8\u4E4C\u6C61\u8BEC\u5C4B\u65E0\u829C\u68A7" + - "\u543E\u5434\u6BCB\u6B66\u4E94\u6342\u5348\u821E\u4F0D\u4FAE\u575E\u620A\u96FE\u6664\u7269\u52FF" + - "\u52A1\u609F\u8BEF\u6614\u7199\u6790\u897F\u7852\u77FD\u6670\u563B\u5438\u9521\u727A\uFFFF\u0043" + - "\uFFFD\u7A00\u606F\u5E0C\u6089\u819D\u5915\u60DC\u7184\u70EF\u6EAA\u6C50\u7280\u6A84\u88AD\u5E2D" + - "\u4E60\u5AB3\u559C\u94E3\u6D17\u7CFB\u9699\u620F\u7EC6\u778E\u867E\u5323\u971E\u8F96\u6687\u5CE1" + - "\u4FA0\u72ED\u4E0B\u53A6\u590F\u5413\u6380\u9528\u5148\u4ED9\u9C9C\u7EA4\u54B8\u8D24\u8854\u8237" + - "\u95F2\u6D8E\u5F26\u5ACC\u663E\u9669\u73B0\u732E\u53BF\u817A\u9985\u7FA1\u5BAA\u9677\u9650\u7EBF" + - "\uFFFD\u76F8\u53A2\u9576\u9999\u7BB1\u8944\u6E58\u4E61\u7FD4\u7965\u8BE6\u60F3\u54CD\u4EAB\u9879" + - "\u5DF7\u6A61\u50CF\u5411\u8C61\u8427\u785D\u9704\u524A\u54EE\u56A3\u9500\u6D88\u5BB5\u6DC6\u6653" + - "\u5C0F\u5B5D\u6821\u8096\u5578\u7B11\u6548\u6954\u4E9B\u6B47\u874E\u978B\u534F\u631F\u643A\u90AA" + - "\u659C\u80C1\u8C10\u5199\u68B0\u5378\u87F9\u61C8\u6CC4\u6CFB\u8C22\u5C51\u85AA\u82AF\u950C\u6B23" + - "\u8F9B\u65B0\u5FFB\u5FC3\u4FE1\u8845\u661F\u8165\u7329\u60FA\u5174\u5211\u578B\u5F62\u90A2\u884C" + - "\u9192\u5E78\u674F\u6027\u59D3\u5144\u51F6\u80F8\u5308\u6C79\u96C4\u718A\u4F11\u4FEE\u7F9E\u673D" + - "\u55C5\u9508\u79C0\u8896\u7EE3\u589F\u620C\u9700\u865A\u5618\u987B\u5F90\u8BB8\u84C4\u9157\u53D9" + - "\u65ED\u5E8F\u755C\u6064\u7D6E\u5A7F\u7EEA\u7EED\u8F69\u55A7\u5BA3\u60AC\u65CB\u7384\uFFFF\u0043" + - "\uFFFD\u9009\u7663\u7729\u7EDA\u9774\u859B\u5B66\u7A74\u96EA\u8840\u52CB\u718F\u5FAA\u65EC\u8BE2" + - "\u5BFB\u9A6F\u5DE1\u6B89\u6C5B\u8BAD\u8BAF\u900A\u8FC5\u538B\u62BC\u9E26\u9E2D\u5440\u4E2B\u82BD" + - "\u7259\u869C\u5D16\u8859\u6DAF\u96C5\u54D1\u4E9A\u8BB6\u7109\u54BD\u9609\u70DF\u6DF9\u76D0\u4E25" + - "\u7814\u8712\u5CA9\u5EF6\u8A00\u989C\u960E\u708E\u6CBF\u5944\u63A9\u773C\u884D\u6F14\u8273\u5830" + - "\uFFFD\u71D5\u538C\u781A\u96C1\u5501\u5F66\u7130\u5BB4\u8C1A\u9A8C\u6B83\u592E\u9E2F\u79E7\u6768" + - "\u626C\u4F6F\u75A1\u7F8A\u6D0B\u9633\u6C27\u4EF0\u75D2\u517B\u6837\u6F3E\u9080\u8170\u5996\u7476" + - "\u6447\u5C27\u9065\u7A91\u8C23\u59DA\u54AC\u8200\u836F\u8981\u8000\u6930\u564E\u8036\u7237\u91CE" + - "\u51B6\u4E5F\u9875\u6396\u4E1A\u53F6\u66F3\u814B\u591C\u6DB2\u4E00\u58F9\u533B\u63D6\u94F1\u4F9D" + - "\u4F0A\u8863\u9890\u5937\u9057\u79FB\u4EEA\u80F0\u7591\u6C82\u5B9C\u59E8\u5F5D\u6905\u8681\u501A" + - "\u5DF2\u4E59\u77E3\u4EE5\u827A\u6291\u6613\u9091\u5C79\u4EBF\u5F79\u81C6\u9038\u8084\u75AB\u4EA6" + - "\u88D4\u610F\u6BC5\u5FC6\u4E49\u76CA\u6EA2\u8BE3\u8BAE\u8C0A\u8BD1\u5F02\u7FFC\u7FCC\u7ECE\u8335" + - "\u836B\u56E0\u6BB7\u97F3\u9634\u59FB\u541F\u94F6\u6DEB\u5BC5\u996E\u5C39\u5F15\u9690\uFFFF\u0043" + - "\uFFFD\u5370\u82F1\u6A31\u5A74\u9E70\u5E94\u7F28\u83B9\u8424\u8425\u8367\u8747\u8FCE\u8D62\u76C8" + - "\u5F71\u9896\u786C\u6620\u54DF\u62E5\u4F63\u81C3\u75C8\u5EB8\u96CD\u8E0A\u86F9\u548F\u6CF3\u6D8C" + - "\u6C38\u607F\u52C7\u7528\u5E7D\u4F18\u60A0\u5FE7\u5C24\u7531\u90AE\u94C0\u72B9\u6CB9\u6E38\u9149" + - "\u6709\u53CB\u53F3\u4F51\u91C9\u8BF1\u53C8\u5E7C\u8FC2\u6DE4\u4E8E\u76C2\u6986\u865E\u611A\u8206" + - "\uFFFD\u4F59\u4FDE\u903E\u9C7C\u6109\u6E1D\u6E14\u9685\u4E88\u5A31\u96E8\u4E0E\u5C7F\u79B9\u5B87" + - "\u8BED\u7FBD\u7389\u57DF\u828B\u90C1\u5401\u9047\u55BB\u5CEA\u5FA1\u6108\u6B32\u72F1\u80B2\u8A89" + - "\u6D74\u5BD3\u88D5\u9884\u8C6B\u9A6D\u9E33\u6E0A\u51A4\u5143\u57A3\u8881\u539F\u63F4\u8F95\u56ED" + - "\u5458\u5706\u733F\u6E90\u7F18\u8FDC\u82D1\u613F\u6028\u9662\u66F0\u7EA6\u8D8A\u8DC3\u94A5\u5CB3" + - "\u7CA4\u6708\u60A6\u9605\u8018\u4E91\u90E7\u5300\u9668\u5141\u8FD0\u8574\u915D\u6655\u97F5\u5B55" + - "\u531D\u7838\u6742\u683D\u54C9\u707E\u5BB0\u8F7D\u518D\u5728\u54B1\u6512\u6682\u8D5E\u8D43\u810F" + - "\u846C\u906D\u7CDF\u51FF\u85FB\u67A3\u65E9\u6FA1\u86A4\u8E81\u566A\u9020\u7682\u7076\u71E5\u8D23" + - "\u62E9\u5219\u6CFD\u8D3C\u600E\u589E\u618E\u66FE\u8D60\u624E\u55B3\u6E23\u672D\u8F67\uFFFF\u0043" + - "\uFFFD\u94E1\u95F8\u7728\u6805\u69A8\u548B\u4E4D\u70B8\u8BC8\u6458\u658B\u5B85\u7A84\u503A\u5BE8" + - "\u77BB\u6BE1\u8A79\u7C98\u6CBE\u76CF\u65A9\u8F97\u5D2D\u5C55\u8638\u6808\u5360\u6218\u7AD9\u6E5B" + - "\u7EFD\u6A1F\u7AE0\u5F70\u6F33\u5F20\u638C\u6DA8\u6756\u4E08\u5E10\u8D26\u4ED7\u80C0\u7634\u969C" + - "\u62DB\u662D\u627E\u6CBC\u8D75\u7167\u7F69\u5146\u8087\u53EC\u906E\u6298\u54F2\u86F0\u8F99\u8005" + - "\uFFFD\u9517\u8517\u8FD9\u6D59\u73CD\u659F\u771F\u7504\u7827\u81FB\u8D1E\u9488\u4FA6\u6795\u75B9" + - "\u8BCA\u9707\u632F\u9547\u9635\u84B8\u6323\u7741\u5F81\u72F0\u4E89\u6014\u6574\u62EF\u6B63\u653F" + - "\u5E27\u75C7\u90D1\u8BC1\u829D\u679D\u652F\u5431\u8718\u77E5\u80A2\u8102\u6C41\u4E4B\u7EC7\u804C" + - "\u76F4\u690D\u6B96\u6267\u503C\u4F84\u5740\u6307\u6B62\u8DBE\u53EA\u65E8\u7EB8\u5FD7\u631A\u63B7" + - "\u81F3\u81F4\u7F6E\u5E1C\u5CD9\u5236\u667A\u79E9\u7A1A\u8D28\u7099\u75D4\u6EDE\u6CBB\u7A92\u4E2D" + - "\u76C5\u5FE0\u949F\u8877\u7EC8\u79CD\u80BF\u91CD\u4EF2\u4F17\u821F\u5468\u5DDE\u6D32\u8BCC\u7CA5" + - "\u8F74\u8098\u5E1A\u5492\u76B1\u5B99\u663C\u9AA4\u73E0\u682A\u86DB\u6731\u732A\u8BF8\u8BDB\u9010" + - "\u7AF9\u70DB\u716E\u62C4\u77A9\u5631\u4E3B\u8457\u67F1\u52A9\u86C0\u8D2E\u94F8\u7B51\uFFFF\u0043" + - "\uFFFD\u4F4F\u6CE8\u795D\u9A7B\u6293\u722A\u62FD\u4E13\u7816\u8F6C\u64B0\u8D5A\u7BC6\u6869\u5E84" + - "\u88C5\u5986\u649E\u58EE\u72B6\u690E\u9525\u8FFD\u8D58\u5760\u7F00\u8C06\u51C6\u6349\u62D9\u5353" + - "\u684C\u7422\u8301\u914C\u5544\u7740\u707C\u6D4A\u5179\u54A8\u8D44\u59FF\u6ECB\u6DC4\u5B5C\u7D2B" + - "\u4ED4\u7C7D\u6ED3\u5B50\u81EA\u6E0D\u5B57\u9B03\u68D5\u8E2A\u5B97\u7EFC\u603B\u7EB5\u90B9\u8D70" + - "\uFFFD\u594F\u63CD\u79DF\u8DB3\u5352\u65CF\u7956\u8BC5\u963B\u7EC4\u94BB\u7E82\u5634\u9189\u6700" + - "\u7F6A\u5C0A\u9075\u6628\u5DE6\u4F50\u67DE\u505A\u4F5C\u5750\u5EA7\uFFFF\u0005\uFFFD\u4E8D\u4E0C" + - "\u5140\u4E10\u5EFF\u5345\u4E15\u4E98\u4E1E\u9B32\u5B6C\u5669\u4E28\u79BA\u4E3F\u5315\u4E47\u592D" + - "\u723B\u536E\u6C10\u56DF\u80E4\u9997\u6BD3\u777E\u9F17\u4E36\u4E9F\u9F10\u4E5C\u4E69\u4E93\u8288" + - "\u5B5B\u556C\u560F\u4EC4\u538D\u539D\u53A3\u53A5\u53AE\u9765\u8D5D\u531A\u53F5\u5326\u532E\u533E" + - "\u8D5C\u5366\u5363\u0000\u0005\u5202\u080E\u2D33\u3F40\u4C5E\u615C\u84AF\u527D\u5282\u5281\u5290" + - "\u5293\u5182\u7F54\u0000\u0003\u4EBB\uC3C9\uC2E8\uE1EB\u4EDE\u4F1B\u4EF3\u4F22\u4F64\u4EF5\u4F25" + - "\u4F27\u4F09\u4F2B\u4F5E\u4F67\u6538\u4F5A\u4F5D\uFFFF\u0043\uFFFD\u0000\f\u4F5F\u5732\u3D76" + - "\u7491\u8983\u8F7E\u7BAA\u7CAC\u94E6\uE8EA\uC5DA\uE3DC\uD1DF\u4FF8\u5029\u504C\u4FF3\u502C\u500F" + - "\u502E\u502D\u4FFE\u0000\u0007\u501C\u0C25\u287E\u4355\u484E\u6C7B\uA5A7\uA9BA\u50D6\u5106\u50ED" + - "\u50EC\u50E6\u50EE\u5107\u510B\u4EDD\u6C3D\u4F58\u4F65\u4FCE\u9FA0\uFFFD\u6C46\u7C74\u516E\u5DFD" + - "\u9EC9\u9998\u5181\u5914\u52F9\u530D\u8A07\u5310\u51EB\u5919\u5155\u4EA0\u5156\u4EB3\u886E\u88A4" + - "\u4EB5\u8114\u88D2\u7980\u5B34\u8803\u7FB8\u0000\u0003\u51AB\uB1BD\uBCC7\u96A2\u51A5\u0000\u000F" + - "\u8BA0\uA6A7\uAAB4\uB5B7\uC2C3\uCBCF\uCED2\uD3D4\uD6D8\uD9DC\uDFE0\uE4E8\uE9EE\uF0F3\uF6F9\uFCFF" + - "\u0000\r\u8C00\u0204\u070C\u0F11\u1214\u1516\u191B\u181D\u1F20\u2125\u272A\u2B2E\u2F32\u3335" + - "\u8C36\u5369\u537A\u0000\t\u961D\u2221\u312A\u3D3C\u4249\u545F\u676C\u7274\u888D\u97B0\u0000" + - "\u0004\u9097\u9B9D\u99AC\uA1B4\uB3B6\u90BA\uFFFF\u0043\uFFFD\u0000\b\u90B8\uB0CF\uC5BE\uD0C4" + - "\uC7D3\uE6E2\uDCD7\uDBEB\uEFFE\u0000\u0004\u9104\u221E\u2331\u2F39\u4346\u520D\u5942\u52A2\u52AC" + - "\u52AD\u52BE\u54FF\u52D0\u52D6\u52F0\u53DF\u71EE\u77CD\u5EF4\u51F5\u51FC\u9B2F\u53B6\u5F01\u755A" + - "\u5DEF\u574C\u57A9\u57A1\u587E\u58BC\u58C5\u58D1\u0000\u0004\u5729\u2C2A\u3339\u2E2F\u5C3B\uFFFD" + - "\u0000\u000F\u5742\u6985\u6B86\u7C7B\u686D\u7673\uADA4\u8CB2\uCFA7\uB493\uA0D5\uD8DA\uD9D2\uB8F4" + - "\uEFF8\uE4DD\u580B\u580D\u57FD\u57ED\u0000\u0005\u5800\u1E19\u4420\u656C\u8189\u9A80\u99A8\u9F19" + - "\u61FF\u0000\u0010\u8279\u7D7F\u8F8A\uA884\u8E91\u9799\uABB8\uBEB0\uC8CA\uE398\uB7AE\uCBCC\uC1A9" + - "\uB4A1\uAA9F\uC4CE\uA4E1\u8309\u82F7\u82E4\u830F\u8307\u82DC\u82F4\u82D2\u82D8\u830C\u82FB\u82D3" + - "\u8311\u831A\u8306\u8314\u8315\u82E0\u82D5\u0000\u000B\u831C\u515B\u5C08\u923C\u3431\u9B5E\u2F4F" + - "\u4743\u5F40\u1760\u2D3A\u3366\u8365\uFFFF\u0043\uFFFD\u0000\r\u8368\u1B69\u6C6A\u6D6E\uB078" + - "\uB3B4\uA0AA\u939C\u857C\uB6A9\u7DB8\u7B98\u9EA8\uBABC\u83C1\u8401\u83E5\u83D8\u5807\u8418\u840B" + - "\u83DD\u83FD\u83D6\u841C\u8438\u8411\u8406\u83D4\u83DF\u840F\u8403\u83F8\u83F9\u83EA\u83C5\u83C0" + - "\u8426\u83F0\u83E1\u0000\u0004\u845C\u515A\u5973\u8788\u7A89\u8478\uFFFD\u0000\u000B\u843C\u4669" + - "\u768C\u8E31\u6DC1\uCDD0\uE6BD\uD3CA\uBFBA\uE0A1\uB9B4\u97E5\u84E3\u850C\u750D\u8538\u84F0\u8539" + - "\u851F\u853A\u8556\u853B\u84FF\u84FC\u8559\u8548\u8568\u8564\u855E\u857A\u77A2\u0000\b\u8543" + - "\u727B\uA4A8\u878F\u79AE\u9C85\uB9B7\uB0D3\uC1DC\u85FF\u8627\u8605\u8629\u8616\u863C\u5EFE\u5F08" + - "\u593C\u5941\u8037\u5955\u595A\u5958\u530F\u5C22\u5C25\u5C2C\u5C34\u0000\u0003\u624C\u6A9F\uBBCA" + - "\uDAD7\u62EE\u6322\u62F6\u0000\n\u6339\u4B43\uADF6\u717A\u8EB4\u6DAC\u8A69\uAEBC\uF2F8\uE0FF" + - "\uC4DE\u63CE\u6452\u63C6\u63BE\u0000\u0005\u6445\u410B\u1B20\u0C26\u215E\u846D\u6496\uFFFF\u0043" + - "\uFFFD\u0000\u0004\u647A\uB7B8\u99BA\uC0D0\uD7E4\u64E2\u6509\u6525\u652E\u5F0B\u5FD2\u7519\u5F11" + - "\u535F\u53F1\u53FD\u53E9\u53E8\u53FB\u0000\u0013\u5412\u1606\u4B52\u5354\u5643\u2157\u5923\u3282" + - "\u9477\u7164\u9A9B\u8476\u669D\uD0AD\uC2B4\uD2A7\uA6D3\uD472\uA3D5\uBBBF\u54CC\uFFFD\u0000\u0004" + - "\u54D9\uDADC\uA9AA\uA4DD\uCFDE\u551B\u54E7\u5520\u54FD\u5514\u54F3\u0000\u0015\u5522\u230F\u1127" + - "\u2A67\u8FB5\u496D\u4155\u3F50\u3C37\u5675\u7677\u3330\u5C8B\uD283\uB1B9\u8881\u9F7E\uD691\u7BDF" + - "\uBDBE\u9499\uEAF7\u55C9\u561F\u0000\u0007\u55D1\uEBEC\uD4E6\uDDC4\uEFE5\uF2F3\uCCCD\uE8F5\u55E4" + - "\u8F94\u561E\u5608\u560C\u5601\u5624\u5623\u55FE\u0000\u000E\u5600\u272D\u5839\u572C\u4D62\u595C" + - "\u4C54\u8664\u716B\u7B7C\u8593\uAFD4\uD7DD\uE1F5\uEBF9\u56FF\u5704\u570A\u5709\u571C\u0000\u0003" + - "\u5E0F\u1914\u1131\u3B3C\uFFFF\u0043\uFFFD\u5E37\u5E44\u5E54\u5E5B\u5E5E\u5E61\u0000\f\u5C8C" + - "\u7A8D\u9096\u8898\u9991\u9A9C\uB5A2\uBDAC\uABB1\uA3C1\uB7C4\uD2E4\uCBE5\u0000\f\u5D02\u0327" + - "\u262E\u241E\u061B\u583E\u343D\u6C5B\u6F5D\u6B4B\u4A69\u7482\u999D\u8C73\u5DB7\u5DC5\u5F73\u5F77" + - "\u5F82\u5F87\uFFFD\u0000\u0004\u5F89\u8C95\u999C\uA8AD\uB5BC\u8862\u5F61\u0000\u0007\u72AD\uB0B4" + - "\uB7B8\uC3C1\uCECD\uD2E8\uEFE9\uF2F4\u72F7\u7301\u72F3\u7303\u72FA\u72FB\u0000\t\u7317\u1321" + - "\u0A1E\u1D15\u2239\u252C\u3831\u504D\u5760\u6C6F\u737E\u821B\u5925\u98E7\u5924\u5902\u0000\t" + - "\u9963\u6768\u696A\u6B6C\u7477\u7D80\u8487\u8A8D\u9091\u9394\u9995\u0000\u0004\u5E80\u918B\u96A5" + - "\uA0B9\uB5BE\u5EB3\u8D53\u5ED2\u5ED1\u5EDB\u5EE8\u5EEA\u81BA\u5FC4\u5FC9\u5FD6\u5FCF\u6003\u5FEE" + - "\u6004\u5FE1\u5FE4\u5FFE\u6005\u6006\u5FEA\u5FED\u5FF8\u0000\u0007\u6019\u3526\u1B0F\u0D29\u2B0A" + - "\u3F21\u7879\u7B7A\u6042\uFFFF\u0043\uFFFD\u0000\b\u606A\u7D96\u9AAD\u9D83\u928C\u9BEC\uBBB1" + - "\uDDD8\uC6DA\u60B4\u6120\u6126\u6115\u6123\u60F4\u0000\u0005\u6100\u0E2B\u4A75\uAC94\uA7B7\uD4F5" + - "\u5FDD\u96B3\u0000\u0003\u95E9\uEBF1\uF3F5\uF6FC\u95FE\u0000\u0007\u9603\u0406\u080A\u0B0C\u0D0F" + - "\u1215\u1617\u191A\u4E2C\u723F\u6215\u6C35\uFFFD\u0000\u000F\u6C54\u5C4A\uA385\u9094\u8C68\u6974" + - "\u7686\uA9D0\uD4AD\uF7F8\uF1D7\uB2E0\uD6FA\uEBEE\uB1D3\uEFFE\u0000\u000E\u6D39\u270C\u4348\u0704" + - "\u190E\u2B4D\u2E35\u1A4F\u5254\u3391\u6F9E\uA05E\u9394\u5C60\u7C63\u6E1A\u6DC7\u6DC5\u6DDE\u6E0E" + - "\u6DBF\u6DE0\u6E11\u6DE6\u6DDD\u6DD9\u6E16\u6DAB\u6E0C\u6DAE\u0000\u0007\u6E2B\u6E4E\u6BB2\u5F86" + - "\u5354\u3225\u44DF\uB198\u6EE0\u6F2D\u0000\u0005\u6EE2\uA5A7\uBDBB\uB7D7\uB4CF\u8FC2\u6E9F\u6F62" + - "\u6F46\u6F47\u6F24\u6F15\u6EF9\u0000\u0007\u6F2F\u364B\u742A\u0929\u898D\u8C78\u727C\u7AD1\uFFFF" + - "\u0043\uFFFD\u0000\u0004\u6FC9\uA7B9\uB6C2\uE1EE\uDEE0\u6FEF\u0000\u0003\u701A\u231B\u3935\u4F5E" + - "\u5B80\u5B84\u5B95\u5B93\u5BA5\u5BB8\u752F\u9A9E\u6434\u5BE4\u5BEE\u8930\u5BF0\u8E47\u8B07\u0000" + - "\u0004\u8FB6\uD3D5\uE5EE\uE4E9\uE6F3\u8FE8\u0000\t\u9005\u040B\u2611\u0D16\u2135\u362D\u2F44" + - "\u5152\u5068\u5862\u905B\u66B9\uFFFD\u9074\u907D\u9082\u9088\u9083\u908B\u5F50\u5F57\u5F56\u5F58" + - "\u5C3B\u54AB\u5C50\u5C59\u5B71\u5C63\u5C66\u7FBC\u5F2A\u5F29\u5F2D\u8274\u5F3C\u9B3B\u5C6E\u0000" + - "\u0007\u5981\u838D\uA9AA\uA397\uCAAB\u9EA4\uD2B2\uAFD7\u59BE\u5A05\u5A06\u59DD\u5A08\u59E3\u59D8" + - "\u59F9\u0000\u0006\u5A0C\u0932\u3411\u2313\u4067\u4A55\u3C62\u5A75\u80EC\u0000\b\u5AAA\u9B77" + - "\u7ABE\uEBB2\uD2D4\uB8E0\uE3F1\uD6E6\uD8DC\u5B09\u5B17\u5B16\u5B32\u5B37\u5B40\u5C15\u5C1C\u5B5A" + - "\u5B65\u5B73\u5B51\u5B53\u5B62\u0000\f\u9A75\u7778\u7A7F\u7D80\u8185\u888A\u9092\u9396\u989B" + - "\u9C9D\u9FA0\uA2A3\uA5A7\u7E9F\u7EA1\u7EA3\u7EA5\u7EA8\u7EA9\uFFFF\u0043\uFFFD\u0000\n\u7EAD" + - "\uB0BE\uC0C1\uC2C9\uCBCC\uD0D4\uD7DB\uE0E1\uE8EB\uEEEF\uF1F2\u7F0D\u7EF6\u7EFA\u7EFB\u7EFE\u0000" + - "\u0007\u7F01\u0203\u0708\u0B0C\u0F11\u1217\u191C\u1B1F\uFFFE\u0007\u7F21\uFFFE\u0004\u7F2A\uFFFE" + - "\u0005\u7F2F\u7F35\u5E7A\u757F\u5DDB\u753E\u9095\uFFFD\u0000\u0007\u738E\u91AE\uA29F\uCFC2\uD1B7" + - "\uB3C0\uC9C8\uE5D9\u987C\u740A\u73E9\u73E7\u73DE\u73BA\u73F2\u0000\u000F\u740F\u2A5B\u2625\u2830" + - "\u2E2C\u1B1A\u415C\u5755\u5977\u6D7E\u9C8E\u8081\u878B\u9EA8\uA990\uA7D2\u74BA\u97EA\u97EB\u97EC" + - "\u0000\t\u674C\u535E\u4869\uA587\u6A73\u98A7\u75A8\u9EAD\u8B77\u7CF0\u6809\u67D8\u680A\u67E9" + - "\u67B0\u680C\u67D9\u67B5\u67DA\u67B3\u67DD\u6800\u67C3\u67B8\u67E2\u680E\u67C1\u67FD\u0000\f" + - "\u6832\u3360\u614E\u6244\u6483\u1D55\u6641\u6740\u3E4A\u4929\uB58F\u7477\u936B\u68C2\u696E\u68FC" + - "\u691F\u6920\u68F9\uFFFF\u0043\uFFFD\u6924\u68F0\u690B\u6901\u6957\u68E3\u0000\u0010\u6910\u7139" + - "\u6042\u5D84\u6B80\u9878\u34CC\u8788\uCE89\u6663\u799B\uA7BB\uABAD\uD4B1\uC1CA\uDF95\uE08D\u69FF" + - "\u6A2F\u69ED\u6A17\u6A18\u6A65\u69F2\u0000\b\u6A44\u3EA0\u505B\u358E\u793D\u2858\u7C91\u90A9" + - "\u97AB\uFFFD\u7337\u7352\u0000\u0005\u6B81\u8287\u8492\u938D\u9A9B\uA1AA\u0000\u000B\u8F6B\u6D71" + - "\u7273\u7576\u7877\u797A\u7C7E\u8182\u8487\u8B8D\u8E8F\u989A\u8ECE\u0000\u0004\u620B\u171B\u1F22" + - "\u2125\u242C\u81E7\u74EF\u74F4\u74FF\u750F\u7511\u7513\u6534\u65EE\u65EF\u65F0\u660A\u6619\u6772" + - "\u6603\u6615\u6600\u7085\u66F7\u661D\u6634\u6631\u6636\u6635\u8006\u0000\b\u665F\u5441\u4F56" + - "\u6157\u7784\u8CA7\u9DBE\uDBDC\uE6E9\u0000\u0006\u8D32\u3336\u3B3D\u4045\u4648\u4947\u4D55\u8D59" + - "\u0000\u0003\u89C7\uCACB\uCCCE\uCFD0\u89D1\u0000\u0005\u726E\u9F5D\u666F\u7E7F\u848B\u8D8F\u7292" + - "\u6308\u6332\u63B0\uFFFF\u0043\uFFFD\u643F\u64D8\u8004\u6BEA\u6BF3\u6BFD\u6BF5\u6BF9\u0000\u0006" + - "\u6C05\u0706\u0D15\u1819\u1A21\u2924\u2A32\u6535\u6555\u656B\u724D\u7252\u7256\u7230\u8662\u5216" + - "\u809F\u809C\u8093\u80BC\u670A\u0000\u0007\u80BD\uB1AB\uADB4\uB7E7\uE8E9\uEADB\uC2C4\uD9CD\u80D7" + - "\u6710\u80DD\u80EB\u80F1\u80F4\u80ED\u810D\u810E\u80F2\u80FC\u6715\u8112\uFFFD\u8C5A\u0000\b" + - "\u8136\u1E2C\u1832\u484C\u5374\u595A\u7160\u697C\u7D6D\u8167\u584D\u5AB5\u8188\u8182\u8191\u6ED5" + - "\u81A3\u81AA\u81CC\u6726\u81CA\u81BB\u81C1\u81A6\u6B24\u6B37\u6B39\u6B43\u6B46\u6B59\u98D1\u98D2" + - "\u98D3\u98D5\u98D9\u98DA\u6BB3\u5F40\u6BC2\u89F3\u6590\u9F51\u0000\u0004\u6593\uBCC6\uC4C3\uCCCE" + - "\uD2D6\u0000\u0005\u7080\u9C96\u9DBB\uC0B7\uABB1\uE8CA\u0000\n\u7110\u1316\u2F31\u735C\u6845" + - "\u724A\u787A\u98B3\uB5A8\uA0E0\uD4E7\u71F9\u721D\u7228\u706C\u7118\u7166\u71B9\u623E\u623D\u6243" + - "\u6248\u6249\u0000\t\u793B\u4046\u495B\u5C53\u5A62\u5760\u6F67\u7A85\u8A9A\uA7B3\u5FD1\u5FD0" + - "\uFFFF\u0043\uFFFD\u0000\u0003\u603C\u5D5A\u6741\u5963\u60AB\u0000\u0003\u6106\u0D5D\uA99D\uCBD1" + - "\u6206\u8080\u807F\u6C93\u6CF6\u6DFC\u77F6\u77F8\u7800\u7809\u7817\u7818\u7811\u65AB\u0000\u0010" + - "\u782D\u1C1D\u393A\u3B1F\u3C25\u2C23\u294E\u6D56\u5726\u5047\u4C6A\u9B93\u9A87\u9CA1\uA3B2\uB9A5" + - "\uD4D9\u78C9\uFFFD\u78EC\u78F2\u7905\u78F4\u7913\u7924\u791E\u7934\u9F9B\u9EF9\u9EFB\u9EFC\u76F1" + - "\u7704\u770D\u76F9\u0000\r\u7707\u081A\u2219\u2D26\u3538\u5051\u4743\u5A68\u6265\u7F8D\u7D80" + - "\u8C91\u9FA0\uB0B5\u77BD\u0000\u0004\u753A\u404E\u4B48\u5B72\u7983\u7F58\u7F61\u7F5F\u8A48\u7F68" + - "\u7F74\u7F71\u7F79\u7F81\u7F7E\u76CD\u76E5\u8832\u0000\u0010\u9485\u8687\u8B8A\u8C8D\u8F90\u9497" + - "\u959A\u9B9C\uA3A4\uABAA\uADAC\uAFB0\uB2B4\uB6B7\uB8B9\uBABC\uBDBF\u94C4\uFFFE\u0007\u94C8\u0000" + - "\b\u94D0\uD1D2\uD5D6\uD7D9\uD8DB\uDEDF\uE0E2\uE4E5\uE7E8\u94EA\uFFFF\u0043\uFFFD\u0000\u0005" + - "\u94E9\uEBEE\uEFF3\uF4F5\uF7F9\uFCFD\u94FF\u0000\u0019\u9503\u0206\u0709\u0A0D\u0E0F\u1213\u1415" + - "\u1618\u1B1D\u1E1F\u222A\u2B29\u2C31\u3234\u3637\u383C\u3E3F\u4235\u4445\u4649\u4C4E\u4F52\u5354" + - "\u5657\u5859\u5B5E\uFFFD\u955F\u955D\u9561\u9562\uFFFE\t\u9564\u956F\u9571\u9572\u9573\u953A" + - "\u77E7\u77EC\u96C9\u79D5\u79ED\u79E3\u79EB\u7A06\u5D47\u0000\u0003\u7A03\u021E\u1439\u3751\u9ECF" + - "\u99A5\u7A70\u7688\u768E\u7693\u7699\u76A4\u74DE\u74E0\u752C\u0000\u0010\u9E20\u2228\u292A\u2B2C" + - "\u3231\u3638\u3739\u3A3E\u4142\u4446\u4748\u494B\u4C4E\u5155\u575A\u5B5C\u5E63\uFFFE\u0007\u9E66" + - "\u9E71\u9E6D\u9E73\u0000\u000B\u7592\u9496\uA09D\uACA3\uB3B4\uB8C4\uB1B0\uC3C2\uD6CD\uE3E8\uE6E4" + - "\uEBE7\u7603\u75F1\u75FC\u75FF\u0000\u0004\u7610\u0005\u0C17\u0A25\u1815\u7619\uFFFF\u0043\uFFFD" + - "\u0000\t\u761B\u3C22\u2040\u2D30\u3F35\u433E\u334D\u5E54\u5C56\u6B6F\u7FCA\u0000\u0006\u7AE6" + - "\u7879\u8086\u8895\uA6A0\uACA8\uADB3\u0000\u0007\u8864\u6972\u7D7F\u82A2\uC6B7\uBCC9\uE2CE\uE3E5" + - "\u88F1\u891A\u88FC\u88E8\u88FE\u88F0\u0000\u0004\u8921\u1913\u1B0A\u342B\u3641\uFFFD\u8966\u897B" + - "\u758B\u80E5\u76B2\u76B4\u77DC\u0000\t\u8012\u1416\u1C20\u2225\u2627\u2928\u310B\u3543\u464D" + - "\u5269\u8071\u8983\u0000\u0007\u9878\u8083\u898C\u8D8F\u949A\u9B9E\u9FA1\uA2A5\u98A6\u0000\u0011" + - "\u864D\u546C\u6E7F\u7A7C\u7BA8\u8D8B\uAC9D\uA7A3\uAA93\uA9B6\uC4B5\uCEB0\uBAB1\uAFC9\uCFB4\uE9F1" + - "\uF2ED\uF3D0\u8713\u86DE\u86F4\u86DF\u86D8\u86D1\u8703\u8707\u86F8\u0000\u0012\u8708\u0A0D\u0923" + - "\u3B1E\u252E\u1A3E\u4834\u3129\u373F\u8222\u7D7E\u7B60\u704C\u6E8B\u5363\u7C64\u5965\u93AF\uA8D2" + - "\uFFFF\u0043\uFFFD\u0000\n\u87C6\u8885\uAD97\u83AB\uE5AC\uB5B3\uCBD3\uBDD1\uC0CA\uDBEA\uE0EE" + - "\u8816\u8813\u87FE\u880A\u881B\u8821\u8839\u883C\u7F36\u7F42\u7F44\u7F45\u8210\u7AFA\u7AFD\u0000" + - "\r\u7B08\u0304\u150A\u2B0F\u4738\u2A19\u2E31\u2025\u2433\u3E1E\u585A\u4575\u4C5D\u606E\uFFFD" + - "\u0000\f\u7B7B\u6272\u7190\uA6A7\uB8AC\u9DA8\u85AA\u9CA2\uABB4\uD1C1\uCCDD\uDAE5\uE6EA\u7C0C" + - "\u7BFE\u7BFC\u0000\u0004\u7C0F\u160B\u1F2A\u2638\u4140\u81FE\u8201\u8202\u8204\u81EC\u8844\u0000" + - "\t\u8221\u2223\u2D2F\u282B\u383B\u3334\u3E44\u494B\u4F5A\u5F68\u887E\u8885\u8888\u88D8\u88DF" + - "\u895E\u7F9D\u7F9F\u7FA7\u7FAF\u7FB0\u7FB2\u7C7C\u6549\u0000\u0007\u7C91\u9D9C\u9EA2\uB2BC\uBDC1" + - "\uC7CC\uCDC8\uC5D7\u7CE8\u826E\u66A8\u0000\u0004\u7FBF\uCED5\uE5E1\uE6E9\uEEF3\u7CF8\u7D77\u7DA6" + - "\u7DAE\u7E47\u7E9B\u9EB8\u9EB4\u0000\u0003\u8D73\u8494\u91B1\u676D\u8C47\u8C49\u914A\u9150\u914E" + - "\u914F\u9164\uFFFF\u0043\uFFFD\u0000\u000B\u9162\u6170\u696F\u7D7E\u7274\u798C\u8590\u8D91\uA2A3" + - "\uAAAD\uAEAF\uB5B4\u91BA\u8C55\u9E7E\u8DB8\u8DEB\u8E05\u8E59\u8E69\u0000\t\u8DB5\uBFBC\uBAC4" + - "\uD6D7\uDADE\uCECF\uDBC6\uECF7\uF8E3\uF9FB\u8DE4\u8E09\u8DFD\u0000\u0004\u8E14\u1D1F\u2C2E\u232F" + - "\u3A40\u8E39\uFFFD\u0000\t\u8E35\u3D31\u4941\u4251\u524A\u7076\u7C6F\u7485\u8F94\u909C\u8E9E" + - "\u8C78\u8C82\u8C8A\u8C85\u8C98\u8C94\u659B\u0000\u0003\u89D6\uDEDA\uDCE5\uEBEF\u8A3E\u8B26\u9753" + - "\u96E9\u96F3\u96EF\u0000\u0004\u9706\u0108\u0F0E\u2A2D\u303E\u0000\u0004\u9F80\u8385\u8687\u8889" + - "\u8A8C\u9EFE\u9F0B\u9F0D\u96B9\u96BC\u96BD\u96CE\u96D2\u77BF\u96E0\u928E\u92AE\u92C8\u933E\u936A" + - "\u93CA\u938F\u943E\u946B\u9C7F\u9C82\uFFFE\u0004\u9C85\u7A23\u0000\u000B\u9C8B\u8E90\u9192\u9495" + - "\u9A9B\u9E9F\uA0A1\uA2A3\uA5A6\uA7A8\uA9AB\uADAE\uFFFE\b\u9CB0\uFFFE\u0004\u9CBA\uFFFE\u0004" + - "\u9CC4\u9CCA\u9CCB\uFFFF\u0043\uFFFD\uFFFE\u0005\u9CCC\u0000\u0004\u9CD3\uD4D5\uD7D8\uD9DC\uDDDF" + - "\u9CE2\u0000\u0004\u977C\u8591\u9294\uAFAB\uA3B2\u97B4\u9AB1\u9AB0\u9AB7\u9E58\u0000\u0004\u9AB6" + - "\uBABC\uC1C0\uC5C2\uCBCC\u9AD1\u0000\u0003\u9B45\u4347\u4948\u4D51\u98E8\u990D\u992E\u9955\u9954" + - "\u0000\u0003\u9ADF\uE1E6\uEFEB\uFBED\u9AF9\u9B08\u9B0F\u9B13\u9B1F\uFFFD\u9B23\u9EBD\u9EBE\u7E3B" + - "\u9E82\u9E87\u9E88\u9E8B\u9E92\u93D6\u0000\u0006\u9E9D\u9FDB\uDCDD\uE0DF\uE2E9\uE7E5\uEAEF\u0000" + - "\u0003\u9F22\u2C2F\u3937\u3D3E\u9F44\uFFFF\u00A1\uFFFD\uFFFE\u00BE\u0F00\uFFFF\u0042\uFFFD\uFFFE" + - "\u0042\u0FBE\uFFFE\u007C\u1800\uFFFF\u0042\uFFFD\uFFFE\u0034\u187C\uFFFE\u008A\uA000\uFFFF\u0042" + - "\uFFFD\uFFFE\u00BE\uA08A\uFFFF\u0042\uFFFD\uFFFE\u00BE\uA148\uFFFF\u0042\uFFFD\uFFFE\u00BE\uA206" + - "\uFFFF\u0042\uFFFD\uFFFE\u00BE\uA2C4\uFFFF\u0042\uFFFD\uFFFE\u00BE\uA382\uFFFF\u0042\uFFFD\uFFFE" + - "\u0090\uA440\uFFFF\u0070\uFFFD\uFFFE\u003F\uE000\uFFFD\uFFFE\u007D\uE03F\uFFFF\u0043\uFFFD\uFFFE" + - "\u003F\uE0BC\uFFFD\uFFFE\u007D\uE0FB\uFFFF\u0043\uFFFD\uFFFE\u003F\uE178\uFFFD\uFFFE\u007D\uE1B7" + - "\uFFFF\u0043\uFFFD\uFFFE\u003F\uE234\uFFFD\uFFFE\u007D\uE273\uFFFF\u0043\uFFFD\uFFFE\u003F\uE2F0" + - "\uFFFD\uFFFE\u007D\uE32F\uFFFF\u0043\uFFFD\uFFFE\u003F\uE3AC\uFFFD\uFFFE\u007D\uE3EB\uFFFF\u0043" + - "\uFFFD\uFFFE\u003F\uE468\uFFFD\uFFFE\u007D\uE4A7\uFFFF\u0043\uFFFD\uFFFE\u003F\uE524\uFFFD\uFFFE" + - "\u007D\uE563\uFFFF\u0043\uFFFD\uFFFE\u003F\uE5E0\uFFFD\uFFFE\u007D\uE61F\uFFFF\u0043\uFFFD\uFFFE" + - "\u003F\uE69C\uFFFD\uFFFE\u007D\uE6DB\uFFFF\u0043\uFFFD\uFFFE\u000E\uE758\uFFFF\u00F2\uFFFD\u0000" + - "\u0015\u4E02\u0405\u060F\u1217\u1F20\u2123\u2629\u2E2F\u3133\u3537\u3C40\u4142\u4446\u4A51\u5557" + - "\u5A5B\u6263\u6465\u6768\u6A6B\u6C6D\u6E6F\u4E72\uFFFE\n\u4E74\uFFFE\u0007\u4E7F\u4E87\u4E8A" + - "\uFFFD\u0000\u0015\u4E90\u9697\u999C\u9D9E\uA3AA\uAFB0\uB1B4\uB6B7\uB8B9\uBCBD\uBEC8\uCCCF\uD0D2" + - "\uDADB\uDCE0\uE2E6\uE7E9\uEDEE\uEFF1\uF4F8\uF9FA\uFCFE\u4F00\uFFFE\u0007\u4F02\u0000\u0024\u4F0B" + - "\u0C12\u1314\u1516\u1C1D\u2123\u2829\u2C2D\u2E31\u3335\u3739\u3B3E\u3F40\u4142\u4445\u4748\u494A" + - "\u4B4C\u5254\u5661\u6266\u686A\u6B6D\u6E71\u7275\u7778\u797A\u7D80\u8182\u8586\u878A\u8C8E\u9092" + - "\u9395\u9698\u999A\u9C9E\u4F9F\uFFFF\u0043\uFFFD\u0000\u0004\u4FA1\uA2A4\uABAD\uB0B1\uB2B3\u4FB4" + - "\uFFFE\t\u4FB6\u0000\u0010\u4FC0\uC1C2\uC6C7\uC8C9\uCBCC\uCDD2\uD3D4\uD5D6\uD9DB\uE0E2\uE4E5" + - "\uE7EB\uECF0\uF2F4\uF5F6\uF7F9\uFBFC\u4FFD\uFFFE\n\u4FFF\uFFFD\u0000\t\u5009\u0A0B\u0E10" + - "\u1113\u1516\u171B\u1D1E\u2022\u2324\u272B\uFFFE\u000B\u502F\u0000\u000B\u503B\u3D3F\u4041\u4244" + - "\u4546\u494A\u4B4D\u5051\u5253\u5456\u5758\u595B\uFFFE\b\u505D\uFFFE\u0006\u5066\uFFFE\t" + - "\u506D\u0000\u0007\u5078\u797A\u7C7D\u8182\u8384\u8687\u898A\u8B8C\uFFFE\u0015\u508E\u0000\u0006" + - "\u50A4\uA6AA\uABAD\uAEAF\uB0B1\uB3B4\uB5B6\uFFFF\u0043\uFFFD\u50B7\u50B8\u50B9\uFFFE\u0013\u50BC" + - "\uFFFE\u0006\u50D0\u50D7\u50D8\u50D9\uFFFE\u000B\u50DB\uFFFE\u0004\u50E8\uFFFE\u0004\u50EF\u50F4" + - "\uFFFE\u0005\u50F6\uFFFE\u0007\u50FC\uFFFD\u0000\u0005\u5103\u0405\u0809\u0A0C\u0D0E\u0F10\u5111" + - "\uFFFE\u000E\u5113\uFFFE\u001D\u5122\u0000\"\u5142\u474A\u4C4E\u4F50\u5253\u5758\u595B\u5D5E" + - "\u5F60\u6163\u6466\u6769\u6A6F\u727A\u7E7F\u8384\u8687\u8A8B\u8E8F\u9091\u9394\u989A\u9D9E\u9FA1" + - "\uA3A6\uA7A8\uA9AA\uADAE\uB4B8\uB9BA\uBEBF\uC1C2\uC3C5\uC8CA\uCDCE\u51D0\uFFFF\u0043\uFFFD\uFFFE" + - "\t\u51D2\u0000\b\u51DC\uDEDF\uE2E3\uE5E6\uE7E8\uE9EA\uECEE\uF1F2\uF4F7\u51FE\u0000\u0011" + - "\u5204\u0509\u0B0C\u0F10\u1314\u151C\u1E1F\u2122\u2325\u2627\u2A2C\u2F31\u3234\u353C\u3E44\u4546" + - "\u4748\u494B\u524E\uFFFD\u0000\u000B\u524F\u5253\u5557\u5859\u5A5B\u5D5F\u6062\u6364\u6668\u6B6C" + - "\u6D6E\u7071\uFFFE\n\u5273\u0000\u0003\u527E\u8083\u8485\u8687\uFFFE\u0007\u5289\u5291\u5292" + - "\uFFFE\u0007\u5294\u0000\u0003\u529C\uA4A5\uA6A7\uAEAF\u52B0\uFFFE\n\u52B4\u0000\r\u52C0" + - "\uC1C2\uC4C5\uC6C8\uCACC\uCDCE\uCFD1\uD3D4\uD5D7\uD9DA\uDBDC\uDDDE\uE0E1\uE2E3\uFFFE\u000B\u52E5" + - "\uFFFE\b\u52F1\u52FB\u52FC\u52FD\u5301\u5302\uFFFF\u0043\uFFFD\u0000\f\u5303\u0407\u090A" + - "\u0B0C\u0E11\u1213\u1418\u1B1C\u1E1F\u2224\u2527\u2829\u2B2C\u532D\uFFFE\n\u532F\u0000\r" + - "\u533C\u3D40\u4244\u464B\u4C4D\u5054\u5859\u5B5D\u6568\u6A6C\u6D72\u7679\u7B7C\u7D7E\uFFFD\u5380" + - "\u5381\u5383\u5387\u5388\u538A\uFFFE\u0007\u538E\u0000\u0006\u5396\u9799\u9B9C\u9EA0\uA1A4\uA7AA" + - "\uABAC\u53AD\uFFFE\u0007\u53AF\uFFFE\u0004\u53B7\u0000\f\u53BC\uBDBE\uC0C3\uC4C5\uC6C7\uCECF" + - "\uD0D2\uD3D5\uDADC\uDDDE\uE1E2\uE7F4\uFAFE\u53FF\u0000\u0014\u5400\u0205\u070B\u1418\u191A\u1C22" + - "\u2425\u2A30\u3336\u373A\u3D3F\u4142\u4445\u4749\u4C4D\u4E4F\u515A\u5D5E\u5F60\u6163\u6567\uFFFE" + - "\b\u5469\u0000\u0005\u5474\u797A\u7E7F\u8183\u8587\u8889\u548A\uFFFF\u0043\uFFFD\u0000\u0017" + - "\u548D\u9193\u9798\u9C9E\u9FA0\uA1A2\uA5AE\uB0B2\uB5B6\uB7B9\uBABC\uBEC3\uC5CA\uCBD6\uD8DB\uE0E1" + - "\uE2E3\uE4EB\uECEF\uF0F1\uF4F5\uF6F7\uF8F9\uFBFE\u0000\u0007\u5500\u0203\u0405\u080A\u0B0C\u0D0E" + - "\u1213\u1516\u5517\uFFFD\u0000\u0025\u5518\u191A\u1C1D\u1E1F\u2125\u2628\u292B\u2D32\u3435\u3638" + - "\u393A\u3B3D\u4042\u4547\u484B\u4C4D\u4E4F\u5152\u5354\u5758\u595A\u5B5D\u5E5F\u6062\u6368\u696B" + - "\u6F70\u7172\u7374\u797A\u7D7F\u8586\u8C8D\u8E90\u9293\u9596\u979A\u9B9E\uFFFE\u0007\u55A0\uFFFE" + - "\t\u55A8\u0000\u0010\u55B2\uB4B6\uB8BA\uBCBF\uC0C1\uC2C3\uC6C7\uC8CA\uCBCE\uCFD0\uD5D7\uD8D9" + - "\uDADB\uDEE0\uE2E7\uE9ED\uEEF0\u55F1\uFFFF\u0043\uFFFD\u0000\u0003\u55F4\uF6F8\uF9FA\uFBFC\u55FF" + - "\uFFFE\u0006\u5602\u560A\u560B\u560D\uFFFE\b\u5610\u0000\u000B\u5619\u1A1C\u1D20\u2122\u2526" + - "\u2829\u2A2B\u2E2F\u3033\u3537\u383A\u3C3D\u563E\uFFFE\f\u5640\u564F\u5650\uFFFD\u0000\r" + - "\u5651\u5253\u5556\u5A5B\u5D5E\u5F60\u6163\u6566\u676D\u6E6F\u7072\u7374\u7577\u7879\u567A\uFFFE" + - "\b\u567D\uFFFE\u0007\u5687\u5690\u5691\u5692\uFFFE\u000F\u5694\uFFFE\u000B\u56A4\uFFFE\u0007" + - "\u56B0\uFFFE\u0004\u56B8\uFFFE\r\u56BD\uFFFE\t\u56CB\u0000\t\u56D5\uD6D8\uD9DC\uE3E5" + - "\uE6E7\uE8E9\uEAEC\uEEEF\uF2F3\uF6F7\u56F8\uFFFF\u0043\uFFFD\u56FB\u56FC\u5700\u5701\u5702\u5705" + - "\u5707\uFFFE\u0011\u570B\u0000\u0013\u571D\u1E20\u2122\u2425\u2627\u2B31\u3234\u3536\u3738\u3C3D" + - "\u3F41\u4344\u4546\u4849\u4B52\u5354\u5556\u5859\u6263\u6567\uFFFD\u0000\u000B\u576C\u6E70\u7172" + - "\u7475\u7879\u7A7D\u7E7F\u8081\u8788\u898A\u8D8E\u8F90\u5791\uFFFE\u0007\u5794\uFFFE\u0004\u579C" + - "\u0000\u0005\u57A5\uA8AA\uACAF\uB0B1\uB3B5\uB6B7\uFFFE\t\u57B9\uFFFE\u0007\u57C4\u0000\u0006" + - "\u57CC\uCDD0\uD1D3\uD6D7\uDBDC\uDEE1\uE2E3\uFFFE\b\u57E5\u0000\u0005\u57EE\uF0F1\uF2F3\uF5F6" + - "\uF7FB\uFCFE\u57FF\u0000\u000E\u5801\u0304\u0508\u090A\u0C0E\u0F10\u1213\u1416\u1718\u1A1B\u1C1D" + - "\u1F22\u2325\u2627\u2829\u582B\uFFFF\u0043\uFFFD\uFFFE\u0004\u582C\uFFFE\u0004\u5831\uFFFE\u000E" + - "\u5836\uFFFE\u0007\u5845\u0000\u000B\u584E\u4F50\u5253\u5556\u5759\u5A5B\u5C5D\u5F60\u6162\u6364" + - "\u6667\u6869\u586A\uFFFE\n\u586D\uFFFD\uFFFE\u0007\u5877\u587F\u5882\u5884\u5886\u5887\u5888" + - "\uFFFE\b\u588A\uFFFE\u0005\u5894\u589B\u589C\u589D\uFFFE\b\u58A0\uFFFE\u0012\u58AA\uFFFE" + - "\u0004\u58BD\u58C2\u58C3\u58C4\uFFFE\u000B\u58C6\u58D2\u58D3\u58D4\uFFFE\u000E\u58D6\uFFFE\u0006" + - "\u58E5\u0000\u0003\u58ED\uEFF1\uF2F4\uF5F7\u58F8\uFFFE\b\u58FA\u0000\u0006\u5903\u0506\u0809" + - "\u0A0B\u0C0E\u1011\u1213\uFFFF\u0043\uFFFD\u0000\u0013\u5917\u181B\u1D1E\u2021\u2223\u2628\u2C30" + - "\u3233\u3536\u3B3D\u3E3F\u4043\u4546\u4A4C\u4D50\u5253\u595B\u5C5D\u5E5F\u6163\u5964\uFFFE\r" + - "\u5966\u0000\u0004\u5975\u777A\u7B7C\u7E7F\u8085\u5989\uFFFD\u0000\u000F\u598B\u8C8E\u8F90\u9194" + - "\u9598\u9A9B\u9C9D\u9FA0\uA1A2\uA6A7\uACAD\uB0B1\uB3B4\uB5B6\uB7B8\uBABC\u59BD\uFFFE\u0007\u59BF" + - "\u0000\n\u59C7\uC8C9\uCCCD\uCECF\uD5D6\uD9DB\uDEDF\uE0E1\uE2E4\uE6E7\uE9EA\u59EB\uFFFE\f" + - "\u59ED\u59FA\u59FC\u59FD\u59FE\u0000\u000B\u5A00\u020A\u0B0D\u0E0F\u1012\u1415\u1617\u191A\u1B1D" + - "\u1E21\u2224\u2627\u5A28\uFFFE\u0007\u5A2A\u0000\b\u5A33\u3537\u3839\u3A3B\u3D3E\u3F41\u4243" + - "\u4445\u4748\uFFFF\u0043\uFFFD\uFFFE\n\u5A4B\uFFFE\u0004\u5A56\uFFFE\u0007\u5A5B\uFFFE\u0004" + - "\u5A63\u5A68\u5A69\uFFFE\t\u5A6B\u5A78\u5A79\uFFFE\u0004\u5A7B\uFFFE\u0012\u5A80\u5A93\u5A94" + - "\u5A95\uFFFD\uFFFE\u0004\u5A96\uFFFE\u000E\u5A9C\uFFFE\u0007\u5AAB\u0000\u0015\u5AB4\uB6B7\uB9BA" + - "\uBBBC\uBDBF\uC0C3\uC4C5\uC6C7\uC8CA\uCBCD\uCECF\uD0D1\uD3D5\uD7D9\uDADB\uDDDE\uDFE2\uE4E5\uE7E8" + - "\uEAEC\uEDEE\uEFF0\uFFFE\u0017\u5AF2\uFFFE\f\u5B0A\uFFFE\u0016\u5B18\uFFFF\u0043\uFFFD\uFFFE" + - "\u0004\u5B2E\u5B33\u5B35\u5B36\uFFFE\b\u5B38\uFFFE\u000F\u5B41\u0000\u0010\u5B52\u565E\u6061" + - "\u6768\u6B6D\u6E6F\u7274\u7677\u7879\u7B7C\u7E7F\u8286\u8A8D\u8E90\u9192\u9496\u9FA7\uFFFD\u0000" + - "\u000B\u5BA8\uA9AC\uADAE\uAFB1\uB2B7\uBABB\uBCC0\uC1C3\uC8C9\uCACB\uCDCE\uCFD1\uFFFE\t\u5BD4" + - "\u0000\u0005\u5BE0\uE2E3\uE6E7\uE9EA\uEBEC\uEDEF\uFFFE\u0007\u5BF1\u5BFD\u5BFE\u0000\u001A\u5C00" + - "\u0203\u0507\u080B\u0C0D\u0E10\u1213\u1719\u1B1E\u1F20\u2123\u2628\u292A\u2B2D\u2E2F\u3032\u3335" + - "\u3637\u4344\u4647\u4C4D\u5253\u5456\u5758\u5A5B\u5C5D\u5F62\u5C64\uFFFE\u0007\u5C67\u5C70\uFFFE" + - "\u0007\u5C72\uFFFE\u0004\u5C7B\uFFFF\u0043\uFFFD\u0000\u001F\u5C80\u8384\u8586\u8789\u8A8B\u8E8F" + - "\u9293\u959D\u9E9F\uA0A1\uA4A5\uA6A7\uA8AA\uAEAF\uB0B2\uB4B6\uB9BA\uBBBC\uBEC0\uC2C3\uC5C6\uC7C8" + - "\uC9CA\uCCCD\uCECF\uD0D1\uD3D4\uD5D6\uD7D8\uDADB\uDCDD\uDEDF\uFFFD\u0000\u0004\u5CE0\uE2E3\uE7E9" + - "\uEBEC\uEEEF\uFFFE\n\u5CF1\uFFFE\u0006\u5CFC\u0000\u0011\u5D04\u0508\u090A\u0B0C\u0D0F\u1011" + - "\u1213\u1517\u1819\u1A1C\u1D1F\u2021\u2223\u2528\u2A2B\u2C2F\u3031\u3233\uFFFE\b\u5D35\uFFFE" + - "\b\u5D3F\u5D48\u5D49\uFFFE\u000B\u5D4D\u5D59\u5D5A\u5D5C\uFFFE\u000B\u5D5E\u0000\u0003\u5D6A" + - "\u6D6E\u7071\u7273\uFFFE\r\u5D75\u5D83\u5D84\uFFFF\u0043\uFFFD\uFFFE\u0014\u5D85\u5D9A\u5D9B" + - "\u5D9C\uFFFE\u0019\u5D9E\uFFFE\r\u5DB8\u5DC6\u5DC7\uFFFD\uFFFE\u0005\u5DC8\uFFFE\r\u5DCE" + - "\u0000\b\u5DDC\uDFE0\uE3E4\uEAEC\uEDF0\uF5F6\uF8F9\uFAFB\uFCFF\u0000\u0005\u5E00\u0407\u090A" + - "\u0B0D\u0E12\u1317\uFFFE\b\u5E1E\uFFFE\u0005\u5E28\u0000\t\u5E2F\u3032\u3334\u3536\u393A" + - "\u3E3F\u4041\u4346\u4748\u494A\u5E4B\uFFFE\u0007\u5E4D\uFFFE\u0005\u5E56\u5E5C\u5E5D\u5E5F\u5E60" + - "\uFFFE\u000F\u5E63\u0000\u0007\u5E75\u7779\u7E81\u8283\u8588\u898C\u8D8E\u9298\uFFFF\u0043\uFFFD" + - "\u0000\n\u5E9B\u9DA1\uA2A3\uA4A8\uA9AA\uABAC\uAEAF\uB0B1\uB2B4\uBABB\uBCBD\uFFFE\n\u5EBF" + - "\uFFFE\u0006\u5ECB\u5ED4\u5ED5\uFFFE\u0004\u5ED7\uFFFE\f\u5EDC\u5EE9\uFFFE\u0007\u5EEB\uFFFD" + - "\u0000\u0003\u5EF2\uF3F5\uF8F9\uFBFC\u5EFD\u0000\f\u5F05\u0607\u090C\u0D0E\u1012\u1416\u191A" + - "\u1C1D\u1E21\u2223\u2428\u2B2C\u2E30\uFFFE\u0007\u5F32\u5F3B\u5F3D\u5F3E\u5F3F\uFFFE\u000F\u5F41" + - "\u0000\u0020\u5F51\u5459\u5A5B\u5C5E\u5F60\u6365\u6768\u6B6E\u6F72\u7475\u7678\u7A7D\u7E7F\u8386" + - "\u8D8E\u8F91\u9394\u969A\u9B9D\u9E9F\uA0A2\uA3A4\uA5A6\uA7A9\uABAC\uAFB0\uB1B2\uB3B4\uB6B8\uB9BA" + - "\uBBBE\uBFC0\uC1C2\u5FC7\uFFFF\u0043\uFFFD\u0000\u000E\u5FC8\uCACB\uCED3\uD4D5\uDADB\uDCDE\uDFE2" + - "\uE3E5\uE6E8\uE9EC\uEFF0\uF2F3\uF4F6\uF7F9\uFAFC\u0000\u0010\u6007\u0809\u0B0C\u1011\u1317\u181A" + - "\u1E1F\u2223\u242C\u2D2E\u3031\u3233\u3436\u3738\u393A\u3D3E\u4044\u6045\uFFFD\uFFFE\u0005\u6046" + - "\u0000\u001D\u604C\u4E4F\u5153\u5456\u5758\u5B5C\u5E5F\u6061\u6566\u6E71\u7274\u7577\u7E80\u8182" + - "\u8586\u8788\u8A8B\u8E8F\u9091\u9395\u9798\u999C\u9EA1\uA2A4\uA5A7\uA9AA\uAEB0\uB3B5\uB6B7\uB9BA" + - "\uFFFE\b\u60BD\u0000\u000F\u60C7\uC8C9\uCCCD\uCECF\uD0D2\uD3D4\uD6D7\uD9DB\uDEE1\uE2E3\uE4E5" + - "\uEAF1\uF2F5\uF7F8\uFBFC\uFDFE\u60FF\uFFFE\u0004\u6102\u0000\b\u6107\u0A0B\u0C10\u1112\u1314" + - "\u1617\u1819\u1B1C\u1D1E\uFFFF\u0043\uFFFD\u6121\u6122\u6125\u6128\u6129\u612A\uFFFE\u0013\u612C" + - "\uFFFE\b\u6140\u0000\u0003\u6149\u4B4D\u4F50\u5253\u6154\uFFFE\u0007\u6156\uFFFE\u0004\u615E" + - "\uFFFE\u0004\u6163\uFFFE\u0007\u6169\uFFFD\uFFFE\u0004\u6171\u6176\uFFFE\u0013\u6178\u0000\u0003" + - "\u618C\u8D8F\u9091\u9293\uFFFE\b\u6195\uFFFE\t\u619E\u61AA\u61AB\uFFFE\n\u61AD\uFFFE" + - "\u0006\u61B8\u0000\u0007\u61BF\uC0C1\uC3C4\uC5C6\uC7C9\uCCCD\uCECF\uD0D3\uFFFE\u0011\u61D5\uFFFE" + - "\u000E\u61E7\uFFFE\t\u61F6\uFFFE\u0004\u6200\uFFFF\u0043\uFFFD\u0000\u0014\u6204\u0507\u0913" + - "\u1419\u1C1D\u1E20\u2326\u2728\u292B\u2D2F\u3031\u3235\u3638\u393A\u3B3C\u4244\u4546\u4A4F\u5055" + - "\u5657\u595A\uFFFE\u0007\u625C\u0000\u0007\u6264\u6568\u7172\u7475\u7778\u7A7B\u7D81\u8283\uFFFD" + - "\uFFFE\u0004\u6285\uFFFE\u0006\u628B\u0000\u0015\u6294\u999C\u9D9E\uA3A6\uA7A9\uAAAD\uAEAF\uB0B2" + - "\uB3B4\uB6B7\uB8BA\uBEC0\uC1C3\uCBCF\uD1D5\uDDDE\uE0E1\uE4EA\uEBF0\uF2F5\uF8F9\uFAFB\u0000\u0017" + - "\u6300\u0304\u0506\u0A0B\u0C0D\u0F10\u1213\u1415\u1718\u191C\u2627\u292C\u2D2E\u3031\u3334\u3536" + - "\u3738\u3B3C\u3E3F\u4041\u4447\u484A\u5152\u5354\uFFFE\b\u6356\u0000\b\u6360\u6465\u6668" + - "\u6A6B\u6C6F\u7072\u7374\u7578\u797C\uFFFF\u0043\uFFFD\u0000\u0007\u637D\u7E7F\u8183\u8485\u868B" + - "\u8D91\u9394\u9597\uFFFE\u0007\u6399\u0000\r\u63A1\uA4A6\uABAF\uB1B2\uB5B6\uB9BB\uBDBF\uC0C1" + - "\uC2C3\uC5C7\uC8CA\uCBCC\uD1D3\uD4D5\uFFFE\u0007\u63D7\u0000\u0003\u63DF\uE2E4\uE5E6\uE7E8\uFFFD" + - "\u0000\u0006\u63EB\uECEE\uEFF0\uF1F3\uF5F7\uF9FA\uFBFC\u63FE\u0000\u0016\u6403\u0406\u0708\u090A" + - "\u0D0E\u1112\u1516\u1718\u191A\u1D1F\u2223\u2425\u2728\u292B\u2E2F\u3031\u3233\u3536\u3738\u393B" + - "\u3C3E\u4042\u4349\uFFFE\u0007\u644B\u0000\u0004\u6453\u5556\u5759\u5A5B\u5C5D\uFFFE\b\u645F" + - "\u6468\u646A\u646B\u646C\uFFFE\n\u646E\uFFFE\u0007\u647B\u6483\u6486\uFFFE\t\u6488\u0000" + - "\u0004\u6493\u9497\u989A\u9B9C\u9D9F\u64A0\uFFFF\u0043\uFFFD\u0000\u000B\u64A1\uA2A3\uA5A6\uA7A8" + - "\uAAAB\uAFB1\uB2B3\uB4B6\uB9BB\uBDBE\uBFC1\uC3C4\uFFFE\u0007\u64C6\u0000\u0007\u64CF\uD1D3\uD4D5" + - "\uD6D9\uDADB\uDCDD\uDFE0\uE1E3\u64E5\uFFFE\u0011\u64E7\uFFFD\uFFFE\b\u64F8\uFFFE\b\u6501" + - "\uFFFE\b\u650A\uFFFE\u0005\u6513\uFFFE\f\u6519\uFFFE\u0005\u6526\u0000\u0016\u652C\u2D30" + - "\u3132\u3337\u3A3C\u3D40\u4142\u4344\u4647\u4A4B\u4D4E\u5052\u5354\u5758\u5A5C\u5F60\u6164\u6567" + - "\u6869\u6A6D\u6E6F\u7173\u7576\uFFFE\u000F\u6578\u0000\t\u6588\u898A\u8D8E\u8F92\u9495\u9698" + - "\u9A9D\u9EA0\uA2A3\uA6A8\uFFFF\u0043\uFFFD\u65AA\u65AC\u65AE\uFFFE\b\u65B1\u0000\u0007\u65BA" + - "\uBBBE\uBFC0\uC2C7\uC8C9\uCACD\uD0D1\uD3D4\u65D5\uFFFE\b\u65D8\u0000\u0007\u65E1\uE3E4\uEAEB" + - "\uF2F3\uF4F5\uF8F9\uFBFC\uFDFE\u65FF\u0000\u0005\u6601\u0405\u0708\u090B\u0D10\u1112\u6616\uFFFD" + - "\u0000\r\u6617\u181A\u1B1C\u1E21\u2223\u2426\u292A\u2B2C\u2E30\u3233\u3738\u393A\u3B3D\u3F40" + - "\u6642\uFFFE\u0007\u6644\u0000\u0019\u664D\u4E50\u5158\u595B\u5C5D\u5E60\u6263\u6567\u696A\u6B6C" + - "\u6D71\u7273\u7578\u797B\u7C7D\u7F80\u8183\u8586\u8889\u8A8B\u8D8E\u8F90\u9293\u9495\u9899\u9A9B" + - "\u669C\uFFFE\t\u669E\uFFFE\u0005\u66A9\uFFFE\u0005\u66AF\uFFFE\u0004\u66B5\uFFFE\u0004\u66BA" + - "\uFFFE\u000B\u66BF\uFFFF\u0043\uFFFD\uFFFE\u000F\u66CA\u66DA\uFFFE\b\u66DE\u0000\u0007\u66E7" + - "\uE8EA\uEBEC\uEDEE\uEFF1\uF5F6\uF8FA\uFBFD\uFFFE\u0007\u6701\u0000\b\u670C\u0E0F\u1112\u1316" + - "\u1819\u1A1C\u1E20\u2122\u2324\uFFFD\u0000\u0025\u6725\u2729\u2E30\u3233\u3637\u3839\u3B3C\u3E3F" + - "\u4144\u4547\u4A4B\u4D52\u5455\u5758\u595A\u5B5D\u6263\u6466\u676B\u6C6E\u7174\u7678\u797A\u7B7D" + - "\u8082\u8385\u8688\u8A8C\u8D8E\u8F91\u9293\u9496\u999B\u9FA0\uA1A4\uA6A9\uACAE\uB1B2\u67B4\uFFFE" + - "\b\u67B9\u67C2\uFFFE\n\u67C5\u0000\u0007\u67D5\uD6D7\uDBDF\uE1E3\uE4E6\uE7E8\uEAEB\uEDEE" + - "\u67F2\uFFFE\b\u67F5\u67FE\uFFFE\u0004\u6801\u6806\uFFFF\u0043\uFFFD\u0000\u0006\u680D\u1012" + - "\u1415\u1819\u1A1B\u1C1E\u1F20\uFFFE\u0007\u6822\uFFFE\u0007\u682B\u0000\u0005\u6834\u3536\u3A3B" + - "\u3F47\u4B4D\u4F52\uFFFE\n\u6856\u686A\uFFFE\b\u686C\u6875\uFFFE\u0005\u6878\uFFFD\uFFFE" + - "\u0004\u687D\u6882\u6884\uFFFE\b\u6887\u6890\u6891\u6892\u6894\u6895\u6896\uFFFE\n\u6898" + - "\u0000\u0005\u68A3\uA4A5\uA9AA\uABAC\uAEB1\uB2B4\uFFFE\n\u68B6\u0000\f\u68C1\uC3C4\uC5C6" + - "\uC7C8\uCACC\uCECF\uD0D1\uD3D4\uD6D7\uD9DB\uDCDD\uDEDF\uE1E2\uFFFE\n\u68E4\u0000\u0005\u68EF" + - "\uF2F3\uF4F6\uF7F8\uFBFD\uFEFF\u0000\u0005\u6900\u0203\u0406\u0708\u090A\u0C0F\u6911\uFFFE\f" + - "\u6913\u6921\u6922\u6923\u6925\uFFFF\u0043\uFFFD\uFFFE\u0007\u6926\u0000\u0007\u692E\u2F31\u3233" + - "\u3536\u3738\u3A3B\u3C3E\u4041\uFFFE\u0011\u6943\u0000\u000B\u6955\u5658\u595B\u5C5F\u6162\u6465" + - "\u6768\u696A\u6C6D\u6F70\u7273\u7475\u6976\uFFFD\u0000\n\u697A\u7B7D\u7E7F\u8183\u858A\u8B8C" + - "\u8E8F\u9091\u9293\u9697\u999A\uFFFE\n\u699D\u0000\b\u69A9\uAAAC\uAEAF\uB0B2\uB3B5\uB6B8" + - "\uB9BA\uBCBD\uBEBF\u69C0\uFFFE\b\u69C2\u0000\u0007\u69CB\uCDCF\uD1D2\uD3D5\uD6D7\uD8D9\uDADC" + - "\uDDDE\uFFFE\f\u69E1\uFFFE\u0004\u69EE\uFFFE\n\u69F3\u69FE\uFFFE\n\u6A00\uFFFE\f" + - "\u6A0B\uFFFE\u0004\u6A19\uFFFF\u0043\uFFFD\u0000\b\u6A1D\u1E20\u2223\u2425\u2627\u292B\u2C2D" + - "\u2E30\u3233\u6A34\uFFFE\u0007\u6A36\uFFFE\u0005\u6A3F\u6A45\u6A46\uFFFE\b\u6A48\uFFFE\u0007" + - "\u6A51\u0000\u0004\u6A5A\u5C5D\u5E5F\u6062\u6364\uFFFE\u0007\u6A66\uFFFD\uFFFE\u0004\u6A6D\uFFFE" + - "\u0007\u6A72\u0000\u0003\u6A7A\u7B7D\u7E7F\u8182\u6A83\uFFFE\t\u6A85\u6A8F\uFFFE\u0005\u6A92" + - "\uFFFE\b\u6A98\uFFFE\b\u6AA1\u6AAA\uFFFE\u004A\u6AAD\uFFFF\u0043\uFFFD\uFFFE\u0029\u6AF7" + - "\u6B25\u6B26\uFFFE\n\u6B28\uFFFE\u0004\u6B33\u6B38\u6B3B\u6B3C\u6B3D\u6B3F\u6B40\uFFFD\u0000" + - "\u0003\u6B41\u4244\u4548\u4A4B\uFFFE\f\u6B4D\uFFFE\b\u6B5A\u6B68\u6B69\uFFFE\u000E\u6B6B" + - "\u0000\n\u6B7A\u7D7E\u7F80\u8588\u8C8E\u8F90\u9194\u9597\u9899\u9C9D\u9E9F\u6BA0\uFFFE\b" + - "\u6BA2\uFFFE\b\u6BAB\u6BB6\uFFFE\u0007\u6BB8\u0000\t\u6BC0\uC3C4\uC6C7\uC8C9\uCACC\uCED0" + - "\uD1D8\uDADC\uDDDE\uDFE0\uFFFE\b\u6BE2\u0000\u0004\u6BEC\uEDEE\uF0F1\uF2F4\uF6F7\uFFFF\u0043" + - "\uFFFD\u6BF8\u6BFA\u6BFB\u6BFC\uFFFE\u0007\u6BFE\uFFFE\u0005\u6C08\u0000\u0017\u6C0E\u1217\u1C1D" + - "\u1E20\u2325\u2B2C\u2D31\u3336\u3739\u3A3B\u3C3E\u3F43\u4445\u484B\u4C4D\u4E4F\u5152\u5356\u5859" + - "\u5A62\u6365\u6667\u6B6C\u6D6E\uFFFD\u0000\u0021\u6C6F\u7173\u7577\u787A\u7B7C\u7F80\u8487\u8A8B" + - "\u8D8E\u9192\u9596\u9798\u9A9C\u9D9E\uA0A2\uA8AC\uAFB0\uB4B5\uB6B7\uBAC0\uC1C2\uC3C6\uC7C8\uCBCD" + - "\uCECF\uD1D2\uD8D9\uDADC\uDDDF\uE4E6\uE7E9\uECED\uF2F4\uF9FF\u0000\u001C\u6D00\u0203\u0506\u0809" + - "\u0A0D\u0F10\u1113\u1415\u1618\u1C1D\u1F20\u2122\u2324\u2628\u292C\u2D2F\u3034\u3637\u383A\u3F40" + - "\u4244\u494C\u5055\u5657\u585B\u5D5F\u6162\u6465\u6768\u6D6B\uFFFF\u0043\uFFFD\u0000\u001F\u6D6C" + - "\u6D70\u7172\u7375\u7679\u7A7B\u7D7E\u7F80\u8183\u8486\u878A\u8B8D\u8F90\u9296\u9798\u999A\u9CA2" + - "\uA5AC\uADB0\uB1B3\uB4B6\uB7B9\uBABB\uBCBD\uBEC1\uC2C3\uC8C9\uCACD\uCECF\uD0D2\uD3D4\uD5D7\uFFFD" + - "\u0000\t\u6DDA\uDBDC\uDFE2\uE3E5\uE7E8\uE9EA\uEDEF\uF0F2\uF4F5\uF6F8\u6DFA\uFFFE\b\u6DFD" + - "\uFFFE\u0004\u6E06\u0000\f\u6E0B\u0F12\u1315\u1819\u1B1C\u1E1F\u2226\u2728\u2A2C\u2E30\u3133" + - "\u3536\u3739\uFFFE\b\u6E3B\uFFFE\b\u6E45\uFFFE\u0004\u6E4F\u0000\u0003\u6E55\u5759\u5A5C" + - "\u5D5E\uFFFE\u000B\u6E60\u6E6C\u6E6D\uFFFE\u000F\u6E6F\u0000\u0006\u6E80\u8182\u8487\u888A\u8B8C" + - "\u8D8E\u9192\uFFFF\u0043\uFFFD\uFFFE\u0005\u6E93\u0000\u0016\u6E99\u9A9B\u9D9E\uA0A1\uA3A4\uA6A8" + - "\uA9AB\uACAD\uAEB0\uB3B5\uB8B9\uBCBE\uBFC0\uC3C4\uC5C6\uC8C9\uCACC\uCDCE\uD0D2\uD6D8\uD9DB\uDCDD" + - "\uE3E7\uFFFE\n\u6EEA\u6EF5\u6EF6\u6EF7\uFFFD\u6EF8\uFFFE\b\u6EFA\u0000\u0006\u6F03\u0405" + - "\u0708\u0A0B\u0C0D\u0E10\u1112\uFFFE\n\u6F16\u0000\u0006\u6F21\u2223\u2526\u2728\u2C2E\u3032" + - "\u3435\uFFFE\u0007\u6F37\uFFFE\u0007\u6F3F\u6F48\u6F49\u6F4A\u6F4C\uFFFE\n\u6F4E\u0000\f" + - "\u6F59\u5A5B\u5D5F\u6061\u6364\u6567\u6869\u6A6B\u6C6F\u7071\u7375\u7677\u797B\uFFFE\u0007\u6F7D" + - "\u6F85\u6F86\u6F87\u6F8A\u6F8B\uFFFE\r\u6F8F\u6F9D\u6F9E\uFFFF\u0043\uFFFD\u0000\u0003\u6F9F" + - "\uA0A2\uA3A4\uA5A6\uFFFE\u000B\u6FA8\u0000\b\u6FB4\uB5B7\uB8BA\uBBBC\uBDBE\uBFC1\uC3C4\uC5C6" + - "\uC7C8\uFFFE\u0007\u6FCA\uFFFE\u000B\u6FD3\u6FDF\uFFFE\t\u6FE2\uFFFD\u6FEB\u6FEC\u6FED\uFFFE" + - "\u0021\u6FF0\uFFFE\b\u7012\uFFFE\u0007\u701C\uFFFE\u0011\u7024\u7036\u7037\u7038\uFFFE\u0012" + - "\u703A\u704D\u704E\uFFFE\u000E\u7050\uFFFE\f\u705F\u0000\u0003\u706E\u7172\u7374\u7779\u707A" + - "\uFFFF\u0043\uFFFD\u0000\t\u707B\u7D81\u8283\u8486\u8788\u8B8C\u8D8F\u9091\u9397\u989A\u709B" + - "\uFFFE\r\u709E\u0000\u0006\u70B0\uB2B4\uB5B6\uBABE\uBFC4\uC5C6\uC7C9\uFFFE\r\u70CB\u70DA" + - "\u70DC\u70DD\u70DE\uFFFD\uFFFE\u0004\u70E0\u70E5\u70EA\u70EE\uFFFE\u0007\u70F0\u70F8\u70FA\u70FB" + - "\u70FC\uFFFE\u000B\u70FE\uFFFE\u0005\u710B\u7111\u7112\u7114\u7117\uFFFE\u000B\u711B\uFFFE\b" + - "\u7127\uFFFE\u0004\u7132\uFFFE\u000E\u7137\uFFFE\u0004\u7146\u714B\u714D\uFFFE\r\u714F\u0000" + - "\u000F\u715D\u5F60\u6162\u6365\u696A\u6B6C\u6D6F\u7071\u7475\u7677\u797B\u7C7E\u7F80\u8182\u8385" + - "\u8687\uFFFF\u0043\uFFFD\u0000\b\u7188\u898B\u8C8D\u8E90\u9192\u9395\u9697\u9A9B\u9C9D\u719E" + - "\uFFFE\u0007\u71A1\u0000\u0006\u71A9\uAAAB\uADAE\uAFB0\uB1B2\uB4B6\uB7B8\uFFFE\t\u71BA\uFFFE" + - "\n\u71C4\uFFFE\u0005\u71CF\u71D6\uFFFD\uFFFE\t\u71D7\uFFFE\u0004\u71E1\u0000\u0003\u71E6" + - "\uE8E9\uEAEB\uECED\uFFFE\n\u71EF\uFFFE\f\u71FA\uFFFE\u0016\u7207\uFFFE\n\u721E\u0000" + - "\u0005\u7229\u2B2D\u2E2F\u3233\u343A\u3C3E\uFFFE\u0007\u7240\u0000\u0010\u7249\u4A4B\u4E4F\u5051" + - "\u5354\u5557\u585A\u5C5E\u6063\u6465\u686A\u6B6C\u6D70\u7173\u7476\u7778\u7B7C\uFFFF\u0043\uFFFD" + - "\u0000\u0005\u727D\u8283\u8586\u8788\u898C\u8E90\u7291\uFFFE\f\u7293\uFFFE\f\u72A0\u72AE" + - "\u72B1\u72B2\u72B3\u72B5\uFFFE\u0007\u72BA\u0000\u0007\u72C5\uC6C7\uC9CA\uCBCC\uCFD1\uD3D4\uD5D6" + - "\uD8DA\uFFFD\u0000\b\u72DB\uDCDD\uDFE2\uE3E4\uE5E6\uE7EA\uEBF5\uF6F9\uFDFE\u72FF\u0000\u0012" + - "\u7300\u0204\u0506\u0708\u090B\u0C0D\u0F10\u1112\u1418\u191A\u1F20\u2324\u2627\u282D\u2F30\u3233" + - "\u3536\u3A3B\u3C3D\uFFFE\r\u7340\u0000\u0003\u734E\u4F51\u5354\u5556\uFFFE\b\u7358\uFFFE" + - "\u000B\u7361\u736E\uFFFE\u000E\u7370\uFFFE\u0005\u737F\u0000\u0005\u7385\u8688\u8A8C\u8D8F\u9092" + - "\u9394\uFFFF\u0043\uFFFD\u0000\u0012\u7395\u9798\u999A\u9C9D\u9EA0\uA1A3\uA4A5\uA6A7\uA8AA\uACAD" + - "\uB1B4\uB5B6\uB8B9\uBCBD\uBEBF\uC1C3\uC4C5\uC6C7\uCBCC\u73CE\uFFFE\u0007\u73D2\uFFFE\u0004\u73DA" + - "\u0000\u0006\u73DF\uE1E2\uE3E4\uE6E8\uEAEB\uECEE\uEFF0\u73F1\uFFFD\uFFFE\u0010\u73F3\u0000\u0003" + - "\u7404\u0708\u0B0C\u0D0E\uFFFE\t\u7411\uFFFE\u0006\u741C\u0000\b\u7423\u2427\u292B\u2D2F" + - "\u3132\u3738\u393A\u3B3D\u3E3F\u7440\uFFFE\u0013\u7442\u7456\u7458\u745D\uFFFE\r\u7460\u0000" + - "\u000B\u746E\u6F71\u7273\u7475\u7879\u7A7B\u7C7D\u7F82\u8485\u8688\u898A\u8C8D\u748F\uFFFE\n" + - "\u7491\uFFFF\u0043\uFFFD\u749B\u749D\uFFFE\b\u749F\uFFFE\u0010\u74AA\uFFFE\u0017\u74BB\uFFFE" + - "\t\u74D3\u74DD\u74DF\u74E1\u74E5\u74E7\uFFFD\uFFFE\u0006\u74E8\uFFFE\u0004\u74F0\u74F5\uFFFE" + - "\u0007\u74F8\uFFFE\u0004\u7500\uFFFE\b\u7505\u0000\u0014\u750E\u1012\u1415\u1617\u1B1D\u1E20" + - "\u2122\u2324\u2627\u2A2E\u3436\u393C\u3D3F\u4142\u4344\u4647\u494A\u4D50\u5152\u5355\u5657\u7558" + - "\uFFFE\b\u755D\u7567\u7568\u7569\uFFFE\u0007\u756B\u0000\u0011\u7573\u7576\u777A\u7B7C\u7D7E" + - "\u8081\u8284\u8587\u8889\u8A8C\u8D8E\u9093\u9598\u9B9C\u9EA2\uA6A7\uA8A9\uAAAD\uFFFF\u0043\uFFFD" + - "\u0000\u0013\u75B6\uB7BA\uBBBF\uC0C1\uC6CB\uCCCE\uCFD0\uD1D3\uD7D9\uDADC\uDDDF\uE0E1\uE5E9\uECED" + - "\uEEEF\uF2F3\uF5F6\uF7F8\uFAFB\uFDFE\u0000\u000B\u7602\u0406\u0708\u090B\u0D0E\u0F11\u1213\u1416" + - "\u1A1C\u1D1E\u2123\u2728\u762C\uFFFD\u0000\u0005\u762E\u2F31\u3236\u3739\u3A3B\u3D41\u7642\uFFFE" + - "\b\u7644\uFFFE\u0006\u764E\u0000\u0005\u7655\u5758\u595A\u5B5D\u5F60\u6162\uFFFE\u0007\u7664" + - "\u766C\u766D\u766E\uFFFE\b\u7670\u0000\t\u7679\u7A7C\u7F80\u8183\u8589\u8A8C\u8D8F\u9092" + - "\u9495\u9798\uFFFE\n\u769A\uFFFE\t\u76A5\u76AF\u76B0\u76B3\uFFFE\n\u76B5\u0000\t" + - "\u76C0\uC1C3\uC4C7\uC9CB\uCCD3\uD5D9\uDADC\uDDDE\uE0E1\uE2E3\uFFFF\u0043\uFFFD\u76E4\uFFFE\b" + - "\u76E6\u0000\u0004\u76F0\uF3F5\uF6F7\uFAFB\uFDFF\u0000\u0003\u7700\u0203\u0506\u0A0C\uFFFE\u000B" + - "\u770E\uFFFE\u0004\u771B\u0000\u000B\u7721\u2324\u2527\u2A2B\u2C2E\u3031\u3233\u3439\u3B3D\u3E3F" + - "\u4244\u4546\uFFFD\uFFFE\b\u7748\uFFFE\b\u7752\uFFFE\u0005\u775C\u7764\u7767\u7769\u776A" + - "\uFFFE\f\u776D\u0000\u0006\u777A\u7B7C\u8182\u8386\u8788\u898A\u8B8F\u7790\uFFFE\f\u7793" + - "\u0000\t\u77A1\uA3A4\uA6A8\uABAD\uAEAF\uB1B2\uB4B6\uB7B8\uB9BA\uBCBE\uFFFE\r\u77C0\uFFFE" + - "\t\u77CE\u0000\n\u77D8\uD9DA\uDDDE\uDFE0\uE1E4\uE6E8\uEAEF\uF0F1\uF2F4\uF5F7\uF9FA\uFFFF" + - "\u0043\uFFFD\u77FB\u77FC\uFFFE\u0006\u7803\u0000\u0016\u780A\u0B0E\u0F10\u1315\u191B\u1E20\u2122" + - "\u2428\u2A2B\u2E2F\u3132\u3335\u363D\u3F41\u4243\u4446\u4849\u4A4B\u4D4F\u5153\u5458\u595A\u5B5C" + - "\uFFFE\n\u785E\uFFFD\u7868\u7869\uFFFE\b\u786F\uFFFE\u0004\u7878\uFFFE\n\u787D\u0000" + - "\u0007\u7888\u8A8B\u8F90\u9294\u9596\u999D\u9EA0\uA2A4\u78A6\uFFFE\b\u78A8\uFFFE\u0004\u78B5" + - "\uFFFE\u0004\u78BA\u0000\b\u78BF\uC0C2\uC3C4\uC6C7\uC8CC\uCDCE\uCFD1\uD2D3\uD6D7\u78D8\uFFFE" + - "\u000E\u78DA\u0000\b\u78E9\uEAEB\uEDEE\uEFF0\uF1F3\uF5F6\uF8F9\uFBFC\uFDFE\u78FF\u7900\u7902" + - "\u7903\u7904\uFFFE\r\u7906\u7914\u7915\uFFFF\u0043\uFFFD\uFFFE\b\u7916\uFFFE\u0005\u791F" + - "\uFFFE\u000F\u7925\uFFFE\u0005\u7935\u0000\u0003\u793D\u3F42\u4344\u4547\uFFFE\t\u794A\u0000" + - "\u0006\u7954\u5558\u5961\u6364\u6669\u6A6B\u6C6E\u7970\uFFFD\uFFFE\u0006\u7971\u0000\u0007\u7979" + - "\u7B7C\u7D7E\u7F82\u8386\u8788\u898B\u8C8D\u798E\uFFFE\n\u7990\uFFFE\f\u799B\uFFFE\u000B" + - "\u79A8\uFFFE\u0005\u79B4\u0000\u000E\u79BC\uBFC2\uC4C5\uC7C8\uCACC\uCECF\uD0D3\uD4D6\uD7D9\uDADB" + - "\uDCDD\uDEE0\uE1E2\uE5E8\uEAEC\u79EE\uFFFE\u0007\u79F1\u79F9\u79FA\u79FC\u79FE\u79FF\u0000\u000B" + - "\u7A01\u0405\u0708\u090A\u0C0F\u1011\u1213\u1516\u1819\u1B1C\u1D1F\u2122\uFFFF\u0043\uFFFD\uFFFE" + - "\u000F\u7A24\u0000\u0005\u7A34\u3536\u383A\u3E40\u4142\u4344\u7A45\uFFFE\n\u7A47\uFFFE\u0005" + - "\u7A52\uFFFE\u0015\u7A58\uFFFD\u0000\u0013\u7A6D\u6E6F\u7172\u7375\u7B7C\u7D7E\u8285\u8789\u8A8B" + - "\u8C8E\u8F90\u9394\u999A\u9B9E\uA1A2\uA3A4\uA7A9\uAAAB\uAEAF\uB0B1\u7AB2\uFFFE\u000B\u7AB4\uFFFE" + - "\u000B\u7AC0\uFFFE\n\u7ACC\u0000\u0007\u7AD7\uD8DA\uDBDC\uDDE1\uE2E4\uE7E8\uE9EA\uEBEC\u7AEE" + - "\uFFFE\t\u7AF0\u7AFB\u7AFC\u7AFE\u0000\f\u7B00\u0102\u0507\u090C\u0D0E\u1012\u1316\u1718" + - "\u1A1C\u1D1F\u2122\u2327\u292D\uFFFF\u0043\uFFFD\u0000\u000E\u7B2F\u3032\u3435\u3637\u393B\u3D3F" + - "\u4041\u4243\u4446\u484A\u4D4E\u5355\u5759\u5C5E\u5F61\uFFFE\u000B\u7B63\u0000\u0006\u7B6F\u7073" + - "\u7476\u787A\u7C7D\u7F81\u8283\u7B84\uFFFE\u0007\u7B86\u7B8E\u7B8F\uFFFD\u0000\n\u7B91\u9293" + - "\u9698\u999A\u9B9E\u9FA0\uA3A4\uA5AE\uAFB0\uB2B3\uB5B6\u7BB7\uFFFE\b\u7BB9\uFFFE\u0004\u7BC2" + - "\uFFFE\u0004\u7BC8\uFFFE\u0004\u7BCD\u0000\u000F\u7BD2\uD4D5\uD6D7\uD8DB\uDCDE\uDFE0\uE2E3\uE4E7" + - "\uE8E9\uEBEC\uEDEF\uF0F2\uF3F4\uF5F6\uF8F9\uFAFB\u7BFD\uFFFE\b\u7BFF\u0000\u0005\u7C08\u090A" + - "\u0D0E\u1011\u1213\u1415\uFFFE\b\u7C17\uFFFE\u0006\u7C20\u7C28\u7C29\uFFFE\r\u7C2B\u7C39" + - "\u7C3A\u7C3B\uFFFF\u0043\uFFFD\u7C3C\u7C3D\u7C3E\uFFFE\u000B\u7C42\uFFFE\u0025\u7C4E\uFFFE\u0006" + - "\u7C75\uFFFE\u0006\u7C7E\uFFFD\uFFFE\u0005\u7C84\uFFFE\u0007\u7C8A\u0000\u0010\u7C93\u9496\u999A" + - "\u9BA0\uA1A3\uA6A7\uA8A9\uABAC\uADAF\uB0B4\uB5B6\uB7B8\uBABB\uBFC0\uC2C3\uC4C6\uC9CB\uFFFE\u0007" + - "\u7CCE\u7CD8\u7CDA\u7CDB\u7CDD\u7CDE\uFFFE\u0007\u7CE1\uFFFE\u0006\u7CE9\uFFFE\b\u7CF0\u7CF9" + - "\u7CFA\uFFFE\u000E\u7CFC\uFFFE\u0015\u7D0B\u0000\u0004\u7D21\u2324\u2526\u2829\u2A2C\u7D2D\uFFFF" + - "\u0043\uFFFD\u7D2E\uFFFE\u003E\u7D30\uFFFD\uFFFE\b\u7D6F\uFFFE\u002E\u7D78\uFFFE\u0007\u7DA7" + - "\uFFFE\u0040\u7DAF\uFFFF\u0043\uFFFD\uFFFE\u003F\u7DEF\uFFFD\uFFFE\r\u7E2E\uFFFE\u0005\u7E3C" + - "\uFFFE\u0005\u7E42\uFFFE\u003A\u7E48\uFFFE\u0018\u7E83\u0000\u0005\u7E9C\u9D9E\uAEB4\uBBBC\uD6E4" + - "\uECF9\u0000\u0004\u7F0A\u101E\u3739\u3B3C\u3D3E\uFFFF\u0043\uFFFD\u7F3F\u7F40\u7F41\u7F43\uFFFE" + - "\n\u7F46\u0000\u000E\u7F52\u5356\u595B\u5C5D\u5E60\u6364\u6566\u676B\u6C6D\u6F70\u7375\u7677" + - "\u787A\u7B7C\u7D7F\u7F80\uFFFE\b\u7F82\u0000\u0005\u7F8B\u8D8F\u9091\u9293\u9596\u9798\uFFFD" + - "\u0000\u0003\u7F99\u9B9C\uA0A2\uA3A5\u7FA6\uFFFE\u0007\u7FA8\u0000\u0015\u7FB1\uB3B4\uB5B6\uB7BA" + - "\uBBBE\uC0C2\uC3C4\uC6C7\uC8C9\uCBCD\uCFD0\uD1D2\uD3D6\uD7D9\uDADB\uDCDD\uDEE2\uE3E4\uE7E8\uEAEB" + - "\uECED\uEFF2\uFFFE\u0007\u7FF4\u7FFD\u7FFE\u7FFF\u0000\u0016\u8002\u0708\u090A\u0E0F\u1113\u1A1B" + - "\u1D1E\u1F21\u2324\u2B2C\u2D2E\u2F30\u3234\u393A\u3C3E\u4041\u4445\u4748\u494E\u4F50\u5153\u5556" + - "\u5759\uFFFE\f\u805B\uFFFF\u0043\uFFFD\u0000\u0003\u8067\u686B\u6C6D\u6E6F\u8070\uFFFE\r" + - "\u8072\u0000\u0010\u8081\u8285\u888A\u8D8E\u8F90\u9192\u9495\u9799\u9EA3\uA6A7\uA8AC\uB0B3\uB5B6" + - "\uB8B9\uBBC5\uC7C8\uC9CA\u80CB\uFFFE\u0007\u80CF\u80D8\uFFFD\u0000\u0005\u80DF\uE0E2\uE3E6\uEEF5" + - "\uF7F9\uFBFE\u80FF\u0000\u0007\u8100\u0103\u0405\u0708\u0B0C\u1517\u191B\u1C1D\uFFFE\r\u811F" + - "\u0000\u0005\u812D\u2E30\u3334\u3537\u393A\u3B3C\u813D\uFFFE\u0007\u813F\u0000\u001D\u8147\u494D" + - "\u4E4F\u5256\u5758\u5B5C\u5D5E\u5F61\u6263\u6466\u686A\u6B6C\u6F72\u7375\u7677\u7881\u8384\u8586" + - "\u8789\u8B8C\u8D8E\u9092\u9394\u9596\u9799\u9A9E\u9FA0\uA1A2\uA4A5\uA7A9\uFFFE\u0007\u81AB\uFFFF" + - "\u0043\uFFFD\u0000\b\u81B2\uB4B5\uB6B7\uB8B9\uBCBD\uBEBF\uC4C5\uC7C8\uC9CB\uFFFE\u0016\u81CD" + - "\u0000\t\u81E4\uE5E6\uE8E9\uEBEE\uEFF0\uF1F2\uF5F6\uF7F8\uF9FA\uFDFF\u8203\uFFFE\u0004\u8207" + - "\uFFFD\u0000\u0011\u820B\u0E0F\u1113\u1516\u1718\u191A\u1D20\u2425\u2627\u292E\u323A\u3C3D\u3F40" + - "\u4142\u4345\u4648\u4A4C\u4D4E\uFFFE\b\u8250\u8259\uFFFE\u0004\u825B\uFFFE\b\u8260\uFFFE" + - "\u0005\u8269\u0000\u001F\u8271\u7576\u7778\u7B7C\u8081\u8385\u8687\u898C\u9093\u9495\u969A\u9B9E" + - "\uA0A2\uA3A7\uB2B5\uB6BA\uBBBC\uBFC0\uC2C3\uC5C6\uC9D0\uD6D9\uDADD\uE2E7\uE8E9\uEAEC\uEDEE\uF0F2" + - "\uF3F5\uF6F8\uFAFC\uFDFE\u82FF\uFFFF\u0043\uFFFD\u0000\u0004\u8300\u0A0B\u0D10\u1213\u1618\u8319" + - "\uFFFE\n\u831D\u0000\r\u8329\u2A2E\u3032\u373B\u3D3E\u3F41\u4244\u4548\u4A4B\u4C4D\u4E53" + - "\u5556\u5758\u595D\u8362\uFFFE\u0007\u8370\u0000\u0003\u8379\u7A7E\u7F80\u8182\u8383\uFFFD\u0000" + - "\b\u8384\u8788\u8A8B\u8C8D\u8F90\u9194\u9596\u9799\u9A9D\u839F\uFFFE\u0007\u83A1\uFFFE\u0004" + - "\u83AC\u0000\u0015\u83B5\uBBBE\uBFC2\uC3C4\uC6C8\uC9CB\uCDCE\uD0D1\uD2D3\uD5D7\uD9DA\uDBDE\uE2E3" + - "\uE4E6\uE7E8\uEBEC\uEDEE\uEFF3\uF4F5\uF6F7\uFAFB\uFCFE\u83FF\u0000\u000B\u8400\u0205\u0708\u090A" + - "\u1012\u1314\u1516\u1719\u1A1B\u1E1F\u2021\u2223\uFFFE\b\u8429\uFFFE\u0006\u8432\u8439\u843A" + - "\u843B\uFFFE\b\u843E\uFFFE\u0004\u8447\uFFFF\u0043\uFFFD\uFFFE\u0006\u844B\uFFFE\u0005\u8452" + - "\u0000\t\u8458\u5D5E\u5F60\u6264\u6566\u6768\u6A6E\u6F70\u7274\u7779\uFFFE\u0007\u847B\uFFFE" + - "\u0004\u8483\u848A\u848D\uFFFE\b\u848F\u0000\u0005\u8498\u9A9B\u9D9E\u9FA0\uA2A3\uA4A5\u84A6" + - "\uFFFD\uFFFE\b\u84A7\u0000\u0014\u84B0\uB1B3\uB5B6\uB7BB\uBCBE\uC0C2\uC3C5\uC6C7\uC8CB\uCCCE" + - "\uCFD2\uD4D5\uD7D8\uD9DA\uDBDC\uDEE1\uE2E4\uE7E8\uE9EA\uEBED\uEEEF\uFFFE\u000B\u84F1\u84FD\u84FE" + - "\uFFFE\f\u8500\uFFFE\u0004\u850D\u0000\u0005\u8512\u1415\u1618\u191B\u1C1D\u1E20\uFFFE\t" + - "\u8522\uFFFE\n\u852D\uFFFE\u0005\u853E\uFFFE\u0004\u8544\uFFFE\b\u854B\uFFFF\u0043\uFFFD" + - "\u0000\b\u8553\u5455\u5758\u5A5B\u5C5D\u5F60\u6162\u6365\u6667\uFFFE\t\u8569\u0000\u0006" + - "\u8573\u7576\u7778\u7C7D\u7F80\u8182\u8386\uFFFE\u0007\u8588\uFFFE\u000B\u8590\uFFFE\u0006\u859D" + - "\uFFFD\u0000\u0007\u85A3\uA5A6\uA7A9\uABAC\uADB1\uB2B3\uB4B5\uB6B8\uFFFE\u0007\u85BA\uFFFE\u0007" + - "\u85C2\uFFFE\u0005\u85CA\u0000\u0004\u85D1\uD2D4\uD6D7\uD8D9\uDADB\uFFFE\u0007\u85DD\uFFFE\u0004" + - "\u85E5\uFFFE\u0011\u85EA\u85FC\u85FD\u85FE\uFFFE\u0005\u8600\uFFFE\u000B\u8606\uFFFE\u0004\u8612" + - "\uFFFE\u0010\u8617\u8628\uFFFE\u000E\u862A\uFFFF\u0043\uFFFD\u8639\u863A\u863B\uFFFE\u0010\u863D" + - "\u0000\u0006\u8652\u5355\u5657\u5859\u5B5C\u5D5F\u6061\uFFFE\b\u8663\u866D\u866F\u8670\uFFFE" + - "\u0007\u8672\uFFFE\u0007\u8683\uFFFE\u0005\u868E\u8694\uFFFD\uFFFE\u0006\u8696\uFFFE\u0005\u869E" + - "\u0000\u0018\u86A5\uA6AB\uADAE\uB2B3\uB7B8\uB9BB\uBCBD\uBEBF\uC1C2\uC3C5\uC8CC\uCDD2\uD3D5\uD6D7" + - "\uDADC\uDDE0\uE1E2\uE3E5\uE6E7\uE8EA\uEBEC\uEFF5\uF6F7\uFAFB\uFCFD\u86FF\u0000\u0011\u8701\u0405" + - "\u060B\u0C0E\u0F10\u1114\u1619\u1B1D\u1F20\u2426\u2728\u2A2B\u2C2D\u2F30\u3233\u3536\u3839\u3A3C" + - "\u873D\uFFFE\u0007\u8740\u0000\n\u874A\u4B4D\u4F50\u5152\u5455\u5658\u5A5B\u5C5D\u5E5F\u6162" + - "\u6667\uFFFF\u0043\uFFFD\uFFFE\u0006\u8768\u0000\f\u876F\u7172\u7375\u7778\u797A\u7F80\u8184" + - "\u8687\u898A\u8C8E\u8F90\u9192\u9495\u8796\uFFFE\u0007\u8798\uFFFE\b\u87A0\u0000\u0007\u87A9" + - "\uAAAE\uB0B1\uB2B4\uB6B7\uB8B9\uBBBC\uBEBF\u87C1\uFFFD\uFFFE\u0004\u87C2\u0000\u0003\u87C7\uC8C9" + - "\uCCCD\uCECF\u87D0\uFFFE\u0007\u87D4\uFFFE\u0004\u87DC\uFFFE\u0004\u87E1\uFFFE\u0004\u87E6\u87EB" + - "\u87EC\u87ED\uFFFE\n\u87EF\uFFFE\u0004\u87FA\uFFFE\u0004\u87FF\uFFFE\u0006\u8804\uFFFE\b" + - "\u880B\u0000\u0004\u8814\u1718\u191A\u1C1D\u1E1F\u8820\uFFFE\u000F\u8823\uFFFE\u0006\u8833\u0000" + - "\r\u883A\u3B3D\u3E3F\u4142\u4346\u4748\u494A\u4B4E\u4F50\u5152\u5355\u5658\u5A5B\u5C5D\u885E" + - "\uFFFF\u0043\uFFFD\u0000\u001F\u885F\u6066\u676A\u6D6F\u7173\u7475\u7678\u797A\u7B7C\u8083\u8687" + - "\u898A\u8C8E\u8F90\u9193\u9495\u9798\u999A\u9B9D\u9E9F\uA0A1\uA3A5\uA6A7\uA8A9\uAAAC\uAEAF\uB0B2" + - "\uB3B4\uB5B6\uB8B9\uBABB\uBDBE\uFFFD\u0000\f\u88BF\uC0C3\uC4C7\uC8CA\uCBCC\uCDCF\uD0D1\uD3D6" + - "\uD7DA\uDBDC\uDDDE\uE0E1\uE6E7\uFFFE\u0007\u88E9\u0000\u0003\u88F2\uF5F6\uF7FA\uFBFD\u88FF\u8900" + - "\u8901\uFFFE\u0007\u8903\uFFFE\u0005\u890B\u0000\f\u8911\u1415\u1617\u181C\u1D1E\u1F20\u2223" + - "\u2426\u2728\u292C\u2D2E\u2F31\u3233\u8935\uFFFE\n\u8937\u8942\u8943\uFFFE\u0019\u8945\uFFFE" + - "\u0006\u8960\u8967\u8968\uFFFF\u0043\uFFFD\uFFFE\u0012\u8969\u0000\u0003\u897C\u7D7E\u8082\u8485" + - "\uFFFE\u0026\u8987\uFFFD\uFFFE\u0014\u89AD\u0000\f\u89C3\uCDD3\uD4D5\uD7D8\uD9DB\uDDDF\uE0E1" + - "\uE2E4\uE7E8\uE9EA\uECED\uEEF0\uF1F2\uFFFE\f\u89F4\uFFFE\u0006\u8A01\uFFFE\u0036\u8A08\uFFFE" + - "\b\u8A3F\uFFFF\u0043\uFFFD\u8A47\uFFFE\u0030\u8A49\uFFFE\u000E\u8A7A\uFFFD\u8A88\uFFFE\b" + - "\u8A8B\uFFFE\u0073\u8A94\u8B08\uFFFF\u0043\uFFFD\uFFFE\u001D\u8B09\uFFFE\"\u8B27\uFFFD\uFFFE" + - "\u001D\u8B49\uFFFE\u0005\u8B67\uFFFE\u0033\u8B6D\u8BAC\u8BB1\u8BBB\u8BC7\u8BD0\u8BEA\u8C09\u8C1E" + - "\uFFFE\t\u8C38\uFFFE\u0004\u8C42\u8C48\u8C4A\u8C4B\uFFFE\b\u8C4D\uFFFE\u0004\u8C56\uFFFE" + - "\u0004\u8C5B\uFFFF\u0043\uFFFD\u8C5F\u8C60\uFFFE\u0007\u8C63\uFFFE\u0007\u8C6C\uFFFE\u0004\u8C74" + - "\uFFFE\u0007\u8C7B\u8C83\u8C84\u8C86\u8C87\u8C88\u8C8B\uFFFE\u0007\u8C8D\u8C95\u8C96\u8C97\uFFFE" + - "\u0014\u8C99\uFFFD\uFFFE\u0070\u8CAD\u0000\u0006\u8D20\u5152\u575F\u6568\u696A\u6C6E\u6F71\uFFFF" + - "\u0043\uFFFD\u8D72\uFFFE\t\u8D78\u0000\u0006\u8D82\u8386\u8788\u898C\u8D8E\u8F90\u9293\uFFFE" + - "\n\u8D95\u8DA0\u8DA1\u8DA2\uFFFE\r\u8DA4\u0000\u0006\u8DB2\uB6B7\uB9BB\uBDC0\uC1C2\uC5C7" + - "\uC8C9\u8DCA\uFFFD\u0000\u000B\u8DCD\uD0D2\uD3D4\uD5D8\uD9DC\uE0E1\uE2E5\uE6E7\uE9ED\uEEF0\uF1F2" + - "\uF4F6\u8DFC\uFFFE\u0007\u8DFE\u0000\u0004\u8E06\u0708\u0B0D\u0E10\u1112\u8E13\uFFFE\b\u8E15" + - "\u0000\u0010\u8E20\u2124\u2526\u2728\u2B2D\u3032\u3334\u3637\u383B\u3C3E\u3F43\u4546\u4C4D\u4E4F" + - "\u5053\u5455\u5657\u8E58\uFFFE\f\u8E5A\u0000\t\u8E67\u686A\u6B6E\u7173\u7577\u7879\u7A7B" + - "\u7D7E\u8082\u8384\u8E86\uFFFE\u0007\u8E88\u8E91\u8E92\u8E93\uFFFF\u0043\uFFFD\uFFFE\u0007\u8E95" + - "\u8E9D\uFFFE\f\u8E9F\u8EAD\u8EAE\u8EB0\u8EB1\uFFFE\u0007\u8EB3\uFFFE\u0013\u8EBB\uFFFE\r" + - "\u8ECF\uFFFD\uFFFE\u007D\u8EDC\uFFFF\u0043\uFFFD\uFFFE\r\u8F59\u0000\u0018\u8F6A\u808C\u929D" + - "\uA0A1\uA2A4\uA5A6\uA7AA\uACAD\uAEAF\uB2B3\uB4B5\uB7B8\uBABB\uBCBF\uC0C3\uC6C9\uCACB\uCCCD\uCFD2" + - "\uD6D7\uDAE0\uE1E3\uE7EC\uEFF1\uF2F4\u8FF5\uFFFD\u8FF6\u8FFA\u8FFB\u8FFC\u8FFE\u8FFF\u0000\u001E" + - "\u9007\u080C\u0E13\u1518\u191C\u2324\u2527\u2829\u2A2B\u2C30\u3132\u3334\u3739\u3A3D\u3F40\u4345" + - "\u4648\u494A\u4B4C\u4E54\u5556\u595A\u5C5D\u5E5F\u6061\u6466\u6769\u6A6B\u6C6F\u7071\u7273\uFFFE" + - "\u0007\u9076\u0000\u0019\u907E\u8184\u8586\u8789\u8A8C\u8D8E\u8F90\u9294\u9698\u9A9C\u9E9F\uA0A4" + - "\uA5A7\uA8A9\uABAD\uB2B7\uBCBD\uBFC0\uC2C3\uC6C8\uC9CB\uCCCD\uD2D4\uD5D6\uD8D9\uDADE\uFFFF\u0043" + - "\uFFFD\u0000\n\u90DF\uE0E3\uE4E5\uE9EA\uECEE\uF0F1\uF2F3\uF5F6\uF7F9\uFAFB\uFCFF\u9100\u9101" + - "\u9103\uFFFE\u0014\u9105\uFFFE\u0004\u911A\u911F\u9120\u9121\uFFFE\u000B\u9124\u9130\uFFFD\uFFFE" + - "\u0007\u9132\uFFFE\t\u913A\u0000\u0010\u9144\u4547\u4851\u5354\u5556\u5859\u5B5C\u5F60\u6667" + - "\u686B\u6D73\u7A7B\u7C80\u8182\u8384\u8688\u8A8E\u918F\uFFFE\u0007\u9193\uFFFE\u0006\u919C\uFFFE" + - "\u0006\u91A4\u0000\u0004\u91AB\uACB0\uB1B2\uB3B6\uB7B8\u91B9\uFFFE\f\u91BB\u91C8\u91CB\u91D0" + - "\uFFFE\n\u91D2\uFFFE\u0015\u91DD\uFFFF\u0043\uFFFD\uFFFE\u003F\u91F2\uFFFD\uFFFE\u0043\u9231" + - "\uFFFE\u0019\u9275\uFFFE\u001F\u928F\u92AF\u92B0\uFFFF\u0043\uFFFD\uFFFE\u0017\u92B1\uFFFE\u0028" + - "\u92C9\uFFFD\uFFFE\u004D\u92F1\uFFFE\u002B\u933F\uFFFE\u0005\u936B\uFFFF\u0043\uFFFD\uFFFE\u001F" + - "\u9370\uFFFE\u0020\u9390\uFFFD\uFFFE\u001A\u93B0\uFFFE\u000B\u93CB\uFFFE\u0058\u93D7\uFFFF\u0043" + - "\uFFFD\uFFFE\u000F\u942F\uFFFE\u002C\u943F\uFFFE\u0004\u946C\uFFFD\uFFFE\u0015\u9470\u0000\u0004" + - "\u9491\u9698\uC7CF\uD3D4\uDAE6\u94FB\u0000\u0006\u951C\u2027\u333D\u4348\u4B55\u5A60\u6E74\u9575" + - "\uFFFE\b\u9577\uFFFE\u0048\u9580\uFFFF\u0043\uFFFD\uFFFE\u0020\u95C8\u95EC\u95FF\u9607\u9613" + - "\u9618\u961B\u961E\u9620\uFFFE\u0007\u9623\u0000\u0007\u962B\u2C2D\u2F30\u3738\u393A\u3E41\u434A" + - "\u4E4F\u9651\uFFFD\u0000\n\u9652\u5356\u5758\u595A\u5C5D\u5E60\u6365\u666B\u6D6E\u6F70\u7173" + - "\uFFFE\r\u9678\u0000\u0005\u9687\u898A\u8C8E\u9192\u9395\u969A\u969B\uFFFE\n\u969D\uFFFE" + - "\b\u96A8\u0000\b\u96B1\uB2B4\uB5B7\uB8BA\uBBBF\uC2C3\uC8CA\uCBD0\uD1D3\u96D4\uFFFE\n" + - "\u96D6\uFFFE\u0007\u96E1\uFFFE\u0004\u96EB\u0000\u0005\u96F0\uF1F2\uF4F5\uF8FA\uFBFC\uFDFF\u0000" + - "\u0005\u9702\u0305\u0A0B\u0C10\u1112\u1415\uFFFF\u0043\uFFFD\uFFFE\u0005\u9717\u971D\uFFFE\u000B" + - "\u971F\u0000\u0006\u972B\u2C2E\u2F31\u3334\u3536\u373A\u3B3C\u973D\uFFFE\u0013\u973F\u0000\u0006" + - "\u9754\u5557\u585A\u5C5D\u5F63\u6466\u6768\uFFFD\uFFFE\t\u976A\u9775\uFFFE\u0005\u9777\uFFFE" + - "\b\u977D\uFFFE\u0005\u9786\u0000\u0003\u978C\u8E8F\u9093\u9596\u9797\uFFFE\u0007\u9799\u97A1" + - "\u97A2\uFFFE\u0007\u97A4\u97AC\u97AE\u97B0\u97B1\u97B3\uFFFE\u0031\u97B5\u0000\u0003\u97E8\uEEEF" + - "\uF0F1\uF2F4\uFFFE\f\u97F7\uFFFF\u0043\uFFFD\uFFFE\u003F\u9803\uFFFD\uFFFE\u0033\u9842\u988B" + - "\u988E\u9892\u9895\u9899\u98A3\uFFFE\u0026\u98A8\u0000\u0003\u98CF\uD0D4\uD6D7\uDBDC\u98DD\uFFFE" + - "\u0007\u98E0\uFFFE\u000F\u98E9\uFFFF\u0043\uFFFD\uFFFE\u0015\u98F8\u990E\u990F\uFFFE\u001D\u9911" + - "\uFFFE\u000B\u992F\uFFFD\uFFFE\u001A\u993A\uFFFE\r\u9956\u0000\u0005\u9964\u6673\u7879\u7B7E" + - "\u8283\u898C\u998E\uFFFE\u000B\u999A\u99A6\u99A7\uFFFE\u003D\u99A9\uFFFF\u0043\uFFFD\uFFFE\u003F" + - "\u99E6\uFFFD\uFFFE\u0047\u9A25\u0000\u0004\u9A72\u8389\u8D8E\u9495\u99A6\uFFFE\u0007\u9AA9\uFFFE" + - "\u0004\u9AB2\u0000\u0010\u9AB9\uBBBD\uBEBF\uC3C4\uC6C7\uC8C9\uCACD\uCECF\uD0D2\uD4D5\uD6D7\uD9DA" + - "\uDBDC\uDDDE\uE0E2\uE3E4\uE5E7\u9AE8\uFFFF\u0043\uFFFD\u9AE9\u9AEA\u9AEC\u9AEE\uFFFE\t\u9AF0" + - "\u9AFA\uFFFE\u0007\u9AFC\uFFFE\u0004\u9B04\uFFFE\u0006\u9B09\u9B10\u9B11\u9B12\uFFFE\u000B\u9B14" + - "\u9B20\u9B21\u9B22\uFFFE\u000B\u9B24\u9B30\u9B31\u9B33\u9B34\uFFFD\uFFFE\u0006\u9B35\uFFFE\u0004" + - "\u9B3D\u0000\u0003\u9B46\u4A4B\u4C4E\u5052\u9B53\uFFFE\u006B\u9B55\uFFFF\u0043\uFFFD\uFFFE\u003F" + - "\u9BC0\uFFFD\uFFFE\u007D\u9BFF\uFFFF\u0043\uFFFD\u0000\u000F\u9C7D\u7E80\u8384\u898A\u8C8F\u9396" + - "\u9798\u999D\uAAAC\uAFB9\uBEBF\uC0C1\uC2C8\uC9D1\uD2DA\uDBE0\u9CE1\uFFFE\u001F\u9CE3\uFFFD\uFFFE" + - "\u007D\u9D02\uFFFF\u0043\uFFFD\uFFFE\u003F\u9D7F\uFFFD\uFFFE\u0061\u9DBE\u0000\r\u9E24\u272E" + - "\u3034\u3B3C\u404D\u5052\u5354\u5659\u5D5F\u6061\u6265\u6E6F\u7274\u7576\u9E77\uFFFF\u0043\uFFFD" + - "\uFFFE\u0006\u9E78\u0000\u0006\u9E80\u8183\u8485\u8689\u8A8C\u8D8E\u8F90\u9E91\uFFFE\t\u9E94" + - "\u0000\u0003\u9E9E\uA0A1\uA2A3\uA4A5\uFFFE\r\u9EA7\u0000\u0006\u9EB5\uB6B7\uB9BA\uBCBF\uC0C1" + - "\uC2C3\uC5C6\u9EC7\uFFFD\u0000\n\u9EC8\uCACB\uCCD0\uD2D3\uD5D6\uD7D9\uDADE\uE1E3\uE4E6\uE8EB" + - "\uECED\u9EEE\uFFFE\t\u9EF0\u9EFA\u9EFD\uFFFE\f\u9EFF\u0000\u0007\u9F0C\u0F11\u1214\u1516" + - "\u181A\u1B1C\u1D1E\u1F21\uFFFE\t\u9F23\u9F2D\u9F2E\uFFFE\u0007\u9F30\u0000\u0003\u9F38\u3A3C" + - "\u3F40\u4142\u9F43\uFFFE\u000B\u9F45\uFFFE\u001C\u9F52\uFFFF\u0043\uFFFD\uFFFE\u0011\u9F6E\u9F81" + - "\u9F82\uFFFE\f\u9F8D\u0000\u0003\u9F9C\u9D9E\uA1A2\uA3A4\u9FA5\uFFFF\u00D9\uFFFD\u02CA\u02CB" + - "\u02D9\u2013\u2014\u2035\u2105\u2109\uFFFE\u0004\u2196\u0000\u0003\u2215\u1F23\u5266\u67BF\uFFFE" + - "\u0024\u2550\uFFFE\b\u2581\uFFFD\uFFFE\u0007\u2589\u0000\u0003\u2593\u9495\uE2E3\uE4E5\u2609" + - "\u2295\u301D\u301E\uFFFE\t\u3021\u32A3\u0000\u0005\u338E\u8F9C\u9D9E\uA1C4\uCED1\uD2D5\uFE30" + - "\uFFFE\n\uFE49\uFFFE\u0004\uFE54\uFFFE\u000E\uFE59\uFFFE\u0004\uFE68\u303E\uFFFE\f\u2FF0" + - "\uFFFF\u006B\uFFFD\uF92C\uF979\uF995\uF9E7\uF9F1\uFFFE\u0004\uFA0C\u0000\u0005\uFA11\u1314\u181F" + - "\u2021\u2324\u2728\uFA29\u2E81\uE816\uE817\uE818\u2E84\u3473\u3447\u2E88\u2E8B\uE81E\u359E\u361A" + - "\u360E\u2E8C\u2E97\u396E\u3918\uE826\u39CF\u39DF\u3A73\u39D0\uE82B\uE82C\u3B4E\u3C6E\u3CE0\u2EA7" + - "\uE831\uE832\u2EAA\u4056\u415F\u2EAE\u4337\u2EB3\u2EB6\u2EB7\uE83B\u43B1\u43AC\u2EBB\uFFFD\u43DD" + - "\u44D6\u4661\u464C\uE843\u4723\u4729\u477C\u478D\u2ECA\u0000\u0005\u4947\u7A7D\u8283\u8586\u9F9B" + - "\uB7B6\uE854\uE855\u4CA3\u4C9F\u4CA0\u4CA1\u4C77\u4CA2\uFFFE\u0007\u4D13\u4DAE\uE864\uFFFF\u009A" + - "\uFFFD\uFFFE\u0047\u3400\uFFFE\u002B\u3448\uFFFE\u004C\u3474\uFFFF\u0042\uFFFD\uFFFE\u00BE\u34C0" + - "\uFFFF\u0042\uFFFD\uFFFE\u0020\u357E\uFFFE\u006F\u359F\uFFFE\u000B\u360F\uFFFE\u0024\u361B\uFFFF" + - "\u0042\uFFFD\uFFFE\u00BE\u363F\uFFFF\u0042\uFFFD\uFFFE\u00BE\u36FD\uFFFF\u0042\uFFFD\uFFFE\u00BE" + - "\u37BB\uFFFF\u0042\uFFFD\uFFFE\u009F\u3879\uFFFE\u001F\u3919\uFFFF\u0042\uFFFD\uFFFE\u0036\u3938" + - "\uFFFE\u0060\u396F\uFFFE\u000E\u39D1\uFFFE\u001A\u39E0\uFFFF\u0042\uFFFD\uFFFE\u0079\u39FA\uFFFE" + - "\u0045\u3A74\uFFFF\u0042\uFFFD\uFFFE\u0095\u3AB9\uFFFE\u0029\u3B4F\uFFFF\u0042\uFFFD\uFFFE\u00BE" + - "\u3B78\uFFFF\u0042\uFFFD\uFFFE\u0038\u3C36\uFFFE\u0071\u3C6F\uFFFE\u0015\u3CE1\uFFFF\u0042\uFFFD" + - "\uFFFE\u00BE\u3CF6\uFFFF\u0042\uFFFD\uFFFE\u00BE\u3DB4\uFFFF\u0042\uFFFD\uFFFE\u00BE\u3E72\uFFFF" + - "\u0042\uFFFD\uFFFE\u00BE\u3F30\uFFFF\u0042\uFFFD\uFFFE\u0068\u3FEE\uFFFE\u0056\u4057\uFFFF\u0042" + - "\uFFFD\uFFFE\u00B2\u40AD\uFFFE\f\u4160\uFFFF\u0042\uFFFD\uFFFE\u00BE\u416C\uFFFF\u0042\uFFFD" + - "\uFFFE\u00BE\u422A\uFFFF\u0042\uFFFD\uFFFE\u004F\u42E8\uFFFE\u006F\u4338\uFFFF\u0042\uFFFD\uFFFE" + - "\u0005\u43A7\uFFFE\u0004\u43AD\uFFFE\u002B\u43B2\uFFFE\u008A\u43DE\uFFFF\u0042\uFFFD\uFFFE\u006E" + - "\u4468\uFFFE\u0050\u44D7\uFFFF\u0042\uFFFD\uFFFE\u00BE\u4527\uFFFF\u0042\uFFFD\uFFFE\u0067\u45E5" + - "\uFFFE\u0014\u464D\uFFFE\u0043\u4662\uFFFF\u0042\uFFFD\uFFFE\u007E\u46A5\uFFFE\u0005\u4724\uFFFE" + - "\u003B\u472A\uFFFF\u0042\uFFFD\uFFFE\u0017\u4765\uFFFE\u0010\u477D\uFFFE\u0097\u478E\uFFFF\u0042" + - "\uFFFD\uFFFE\u00BE\u4825\uFFFF\u0042\uFFFD\uFFFE\u0064\u48E3\uFFFE\u0032\u4948\u0000\u0003\u497B" + - "\u7C7E\u7F80\u8184\uFFFE\u0014\u4987\u499C\u499D\u499E\uFFFE\n\u49A0\uFFFF\u0042\uFFFD\uFFFE" + - "\f\u49AA\uFFFE\u00B2\u49B8\uFFFF\u0042\uFFFD\uFFFE\u00BE\u4A6A\uFFFF\u0042\uFFFD\uFFFE\u00BE" + - "\u4B28\uFFFF\u0042\uFFFD\uFFFE\u0091\u4BE6\uFFFE\'\u4C78\uFFFE\u0006\u4CA4\uFFFF\u0642\uFFFD" + - "\uFFFE\u0069\u4CAA\uFFFE\u0055\u4D1A\uFFFF\u0042\uFFFD\uFFFE\u003F\u4D6F\uFFFE\u0011\u4DAF\uFFFF" + - "\u00B6\uFFFD\uFFFE\u0004\uFB56\uFFFF\u0020\uFFFD\uFFFE\u0004\uFB7A\uFFFF\u0010\uFFFD\uFFFE\b" + - "\uFB8E\uFFFF\u0014\uFFFD\uFFFE\u0004\uFBAA\uFFFF\u0025\uFFFD\uFFFE\u002D\uFBD3\uFFFF\u02DF\uFFFD" + - "\uFFFE\n\uFE89\uFFFD\uFFFD\uFFFE\u0004\uFE95\uFFFF\u0004\uFFFD\uFFFE\u000E\uFE9D\uFFFD\uFFFD" + - "\uFFFE\u000B\uFEAD\uFFFF\u0042\uFFFD\uFEB8\uFFFF\u0010\uFFFD\uFFFE\u002C\uFEC9\uFFFF\u0006\uFFFD" + - "\uFEFB\uFEFC\uFFFF\n\uFFFD\uFFFE\n\uE78D\uFFFF\u0366\uFFFD"; - - - private static final String fromUnicode_ = - "\uFFFF\u00A4\uFEFE\u4588\uFEFE\uFEFE\u446A\u4460\uFFFF\u0007\uFEFE\u44ED\u444B\uFEFE\uFEFE\u4450" + - "\uFEFE\uFEFE\u4345\uFFFF\u001F\uFEFE\u447A\uFFFF\b\uFEFE\u4644\u4642\uFFFF\u0006\uFEFE\u4648" + - "\u4646\u465A\uFEFE\u464C\u464A\uFFFF\u0004\uFEFE\u4650\u464E\uFEFE\uFEFE\uFEFE\u447B\uFEFE\u4654" + - "\u4652\uFEFE\u4659\uFFFF\u0004\uFEFE\u4641\uFFFF\u0011\uFEFE\u4645\uFFFF\u0007\uFEFE\u4647\uFFFF" + - "\u000F\uFEFE\u4649\uFFFF\u0018\uFEFE\u465D\uFEFE\uFEFE\uFEFE\u465E\uFFFF\u0004\uFEFE\u464D\uFFFF" + - "\u001D\uFEFE\u4651\uFFFF\u0062\uFEFE\u4643\uFEFE\u464B\uFEFE\u464F\uFEFE\u4653\uFEFE\u4655\uFEFE" + - "\u4656\uFEFE\u4657\uFEFE\u4658\uFFFF\u001C\uFEFE\u465F\uFFFF\u0057\uFEFE\u465B\uFFFF\u000F\uFEFE" + - "\u4660\uFFFF\u0065\uFEFE\u4546\uFEFE\u4545\uCD41\uCD42\uFFFF\r\uFEFE\uCD43\uFFFF\u00B7\uFEFE" + - "\uFFFE\u0011\u4161\uFEFE\uFFFE\u0007\u4172\uFFFF\u0007\uFEFE\uFFFE\u0011\u4141\uFEFE\uFFFE\u0007" + - "\u4152\uFFFF\u0037\uFEFE\u41C6\uFFFF\u000E\uFEFE\uFFFE\u0006\u41C0\uFFFE\u001A\u41C7\uFFFE\u0006" + - "\u4180\uFFFE\u001A\u4187\uFEFE\u4186\uFFFF\u01AE\uFEFE\uFFFE\u00A2\u475D\uFFFE\u005E\u4841\uFFFF" + - "\u0800\uFEFE\uFFFE\u00BE\u6D41\uFFFE\u0042\u6E41\uFFFF\u0800\uFEFE\uFFFE\u007C\u6E83\uFFFE\u0034" + - "\u6F41\uFFFF\u0760\uFEFE\u445A\uFEFE\uFEFE\uCD44\uCD45\u444A\u447C\uFEFE\u4461\u4471\uFEFE\uFEFE" + - "\u4462\u4472\uFFFF\u0007\uFEFE\u447E\u447F\uFFFF\t\uFEFE\u458B\uFEFE\u44EE\u44EF\uFEFE\uCD46" + - "\uFFFF\u0005\uFEFE\u446B\uFFFF\u0070\uFEFE\u45EB\uFFFF\u0056\uFEFE\u444E\uFEFE\uCD47\uFEFE\uFEFE" + - "\uFEFE\uCD48\uFFFF\f\uFEFE\u446E\uFFFF\n\uFEFE\u446F\uFFFF\u003E\uFEFE\uFFFE\f\u41F1" + - "\uFFFF\u0004\uFEFE\uFFFE\n\u41B1\uFFFF\u0016\uFEFE\u44F1\u44F2\u44F0\u44F3\uFEFE\uFEFE\uFFFE" + - "\u0004\uCD49\uFFFF\u006E\uFEFE\u4569\uFFFF\u0006\uFEFE\u4566\uFEFE\u4565\uFEFE\uFEFE\uFEFE\uCD4D" + - "\uFFFF\u0004\uFEFE\u456B\uFEFE\uFEFE\u4577\u444D\uCD4E\u456E\uFEFE\uFEFE\uCD4F\uFEFE\u456D\uFEFE" + - "\u4563\u4564\u4568\u4567\u4571\uFEFE\uFEFE\u4572\uFFFF\u0005\uFEFE\u4468\u4478\u4562\u456A\uFFFF" + - "\u0005\uFEFE\u4576\uFFFF\n\uFEFE\u4575\uFEFE\uFEFE\uFEFE\u4574\uFFFF\u0005\uFEFE\uCD50\uFFFF" + - "\r\uFEFE\u444C\u4573\uFEFE\uFEFE\u4467\u4477\uCD51\uCD52\uFFFF\u0006\uFEFE\u4579\u457A\uFFFF" + - "\u0025\uFEFE\uCD90\uFEFE\uFEFE\uFEFE\u4570\uFFFF\u000B\uFEFE\u456C\uFFFF\u0019\uFEFE\uCD53\uFFFF" + - "\u0052\uFEFE\u456F\uFFFF\u014D\uFEFE\uFFFE\n\u45E1\uFFFF\n\uFEFE\uFFFE\u0014\u45C5\uFFFE" + - "\u0014\u45B1\uFFFF\u0064\uFEFE\uFFFE\u004C\u46A4\uFFFF\u0004\uFEFE\uFFFE\u0024\uCD54\uFFFF\r" + - "\uFEFE\uFFFE\b\uCD78\uFFFE\u0007\uCD81\uFEFE\uFEFE\uFEFE\uCD88\uCD89\uCD8A\uFFFF\n\uFEFE" + - "\u44EA\u44E9\uFFFF\u0010\uFEFE\u44E3\u44E2\uFFFF\b\uFEFE\u44EC\u44EB\uFFFF\b\uFEFE\u44E8" + - "\u44E7\uFEFE\uFEFE\uFEFE\u44E0\uFEFE\uFEFE\u44E4\u44E1\uFFFF\u0012\uFEFE\uFFFE\u0004\uCD8B\uFFFF" + - "\u001F\uFEFE\u44E6\u44E5\uFEFE\uFEFE\uCD8F\uFFFF\u0036\uFEFE\u4479\uFEFE\u4469\uFFFF\u083E\uFEFE" + - "\uCE56\uFEFE\uFEFE\uCE5A\uFEFE\uFEFE\uFEFE\uCE5D\uFEFE\uFEFE\uCE5E\uCE63\uFFFF\n\uFEFE\uCE64" + - "\uFFFF\u000F\uFEFE\uCE71\uFEFE\uFEFE\uCE74\uFEFE\uFEFE\uFEFE\uCE77\uFFFF\u0004\uFEFE\uCE79\uFEFE" + - "\uFEFE\uCE7A\uCE7B\uFEFE\uFEFE\uFEFE\uCE7F\uFFFF\u000E\uFEFE\uCE8A\uFFFF\u0125\uFEFE\uFFFE\f" + - "\uCDCA\uFFFF\u0004\uFEFE\u4040\u4344\u4341\u445B\uFEFE\u0000\u0003\u445D\u5E5F\u6474\u6575\u4342" + - "\u4343\u0000\u0003\u4442\u4366\u766C\u7D63\u4473\u455B\u455C\uFFFF\u0005\uFEFE\uCD91\uCD92\uFEFE" + - "\uFEFE\uFFFE\t\uCD93\uFFFF\u0014\uFEFE\uCDC9\uFEFE\uFEFE\u0000\u0029\u4447\u8148\u8249\u8351" + - "\u8452\u8586\uC087\uC188\uC289\uC38A\uC48C\uC58D\uC68E\uC78F\uC890\uC991\uCA92\uCB56\u93CC\u94CD" + - "\u95CE\u9697\u9899\u9A9D\uCFD5\u9ED0\uD69F\uD1D7\uA2D2\uD8A3\uD3D9\uA4A5\uA6A7\uA853\uA954\uAA55" + - "\uACAD\uAEAF\uBABB\u57BC\uDADB\u46BD\uFFFF\u0007\uFEFE\u43BE\u43BF\u44DC\u44DD\uFEFE\uFEFE\u0000" + - "\u002A\u4347\u8148\u8249\u8351\u8452\u8586\uC087\uC188\uC289\uC38A\uC48C\uC58D\uC68E\uC78F\uC890" + - "\uC991\uCA92\uCB56\u93CC\u94CD\u95CE\u9697\u9899\u9A9D\uCFD5\u9ED0\uD69F\uD1D7\uA2D2\uD8A3\uD3D9" + - "\uA4A5\uA6A7\uA853\uA954\uAA55\uACAD\uAEAF\uBABB\u57BC\uDADB\u46BD\uD459\u435A\uFFFF\u0004\uFEFE" + - "\u4345\u4358\u43DC\u43DD\uFFFF\u0006\uFEFE\uFFFE\u0025\u4665\uFFFF\u00F6\uFEFE\uFFFE\n\u45F1" + - "\uFFFF\u0007\uFEFE\u446D\uFFFF\u0071\uFEFE\uCD9C\uFFFF\u00EA\uFEFE\uCD9D\uCD9E\uFFFF\f\uFEFE" + - "\uCD9F\uCDA0\uCDA1\uFEFE\uFEFE\uCDA2\uFFFF\"\uFEFE\uCDA3\uFFFF\t\uFEFE\uCDA4\uFEFE\uFEFE" + - "\uCDA5\uCDA6\uFEFE\uFEFE\uCDA7\uFFFF\u002A\uFEFE\uFFFE\u0047\uCF41\uCE5C\uFFFE\u002B\uCF88\uCE5B" + - "\uFFFE\u004C\uCFB3\uFFFE\u00BE\uD041\uFFFE\u0020\uD141\uCE60\uFFFE\u006F\uD161\uCE62\uFFFE\u000B" + - "\uD1D0\uCE61\uFFFE\u0024\uD1DB\uFFFE\u00BE\uD241\uFFFE\u00BE\uD341\uFFFE\u00BE\uD441\uFFFE\u009F" + - "\uD541\uCE66\uFFFE\u001F\uD5E0\uFFFE\u0036\uD641\uCE65\uFFFE\u0060\uD677\uCE68\uCE6B\uFFFE\u000E" + - "\uD6D7\uCE69\uFFFE\u001A\uD6E5\uFFFE\u0079\uD741\uCE6A\uFFFE\u0045\uD7BA\uFFFE\u0095\uD841\uCE6E" + - "\uFFFE\u0029\uD8D6\uFFFE\u00BE\uD941\uFFFE\u0038\uDA41\uCE6F\uFFFE\u0071\uDA79\uCE70\uFFFE\u0015" + - "\uDAEA\uFFFE\u00BE\uDB41\uFFFE\u00BE\uDC41\uFFFE\u00BE\uDD41\uFFFE\u00BE\uDE41\uFFFE\u0068\uDF41" + - "\uCE75\uFFFE\u0056\uDFA9\uFFFE\u00B2\uE041\uCE76\uFFFE\f\uE0F3\uFFFE\u00BE\uE141\uFFFE\u00BE" + - "\uE241\uFFFE\u004F\uE341\uCE78\uFFFE\u006F\uE390\uFFFE\u0005\uE441\uCE7E\uFFFE\u0004\uE446\uCE7D" + - "\uFFFE\u002B\uE44A\uCE81\uFFFE\u008A\uE475\uFFFE\u006E\uE541\uCE82\uFFFE\u0050\uE5AF\uFFFE\u00BE" + - "\uE641\uFFFE\u0067\uE741\uCE84\uFFFE\u0014\uE7A8\uCE83\uFFFE\u0043\uE7BC\uFFFE\u007E\uE841\uCE86" + - "\uFFFE\u0005\uE8BF\uCE87\uFFFE\u003B\uE8C4\uFFFE\u0017\uE941\uCE88\uFFFE\u0010\uE958\uCE89\uFFFE" + - "\u0097\uE968\uFFFE\u00BE\uEA41\uFFFE\u0064\uEB41\uCE8B\uFFFE\u0032\uEBA5\uCE8C\uEBD7\uEBD8\uCE8D" + - "\uFFFE\u0004\uEBD9\uCE8E\uCE8F\uEBDD\uCE90\uCE91\uFFFE\u0014\uEBDE\uCE93\uEBF2\uEBF3\uEBF4\uCE92" + - "\uFFFE\n\uEBF5\uFFFE\f\uEC41\uCE95\uCE94\uFFFE\u00B2\uEC4D\uFFFE\u00BE\uED41\uFFFE\u00BE" + - "\uEE41\uFFFE\u0091\uEF41\uCE9C\uFFFE\'\uEFD2\uCE99\uCE9A\uCE9B\uCE9D\uCE98\uFFFE\u0006\uEFF9" + - "\uFFFE\u0069\uF641\uFFFE\u0007\uCE9E\uFFFE\u0055\uF6AA\uFFFE\u003F\uF741\uCEA5\uFFFE\u0011\uF780" + - "\uFFFF\u0040\uFEFE\u59BA\u4BA0\u8141\u53DE\u8142\u8143\u8144\u5793\u5B69\u54FC\u556F\u5862\u5CA1" + - "\u49BA\u5A8C\u8145\u5CA3\u4A94\u8146\u5C48\u5472\u5CA6\u55BF\u8147\u5491\u499C\u59B4\u4AD3\u4BAA" + - "\u565F\u5CA8\u8148\u8149\u814A\u4BA9\u814B\u515D\u596F\u814C\u5545\u5CAC\u814D\u4CF5\u595E\u627C" + - "\u5BCF\u814E\u814F\u4C82\u8150\u4AAD\u8151\u5179\u8152\u5CBB\u8153\u5789\u4B44\u57A9\u5BF6\u8154" + - "\u50F5\u4FD8\u5CAE\u8155\u8156\u8157\u52CA\u8158\u4FC2\u8159\u5CB0\u5254\u59E4\u815A\u5BAD\u57D9" + - "\u5B47\u4DF4\u4C46\u50D5\u815B\u53B8\u5372\u5467\u815C\u4D74\u815D\u4A6B\u59D1\u815E\u815F\u5CBE" + - "\u4FC4\u53F1\u59B1\u5850\u5888\uFFFE\u0004\u8160\u55E8\u8164\u8165\u5CBF\uFFFE\u0006\u8166\u51F1" + - "\u51D1\u816C\u54E8\uFFFE\n\u816D\u544C\uFFFE\u0007\u8177\u516B\u817E\u5A89\u5B9A\u817F\u55C1" + - "\u4BFD\u5CA0\u5A7A\u5098\u8181\u5AC5\u4E45\u5CC0\u57E4\u4FAD\u8182\u8183\u5CA7\u8184\u5967\u58A8" + - "\u8185\u8186\u8187\u5CBC\u5D90\u5797\u505A\u8188\u4F5B\u4DA4\u59DF\u49F9\u4DDF\u52B5\u8189\u588E" + - "\u4FA8\u5744\u5161\u818A\u818B\u818C\u5477\u5D92\u818D\u5D95\uFFFE\u0004\u818E\u54CA\u5CE8\u8192" + - "\u8193\u8194\u59D9\u55B1\u54C9\u5CEB\u5CE9\u5CC5\u4F97\u53CC\u4A91\u8195\u5CEA\u4F92\u4F8A\u8196" + - "\u54D3\u4AD2\u8197\u8198\u51D7\u8199\u49D5\u5C70\u55CA\u569C\u5B6C\u4CB5\u5869\u819A\u819B\u819C" + - "\u5D7A\u5CEF\u544A\u819D\u5CED\u819E\u4AF9\u518F\u59D3\u819F\u81A0\u5CEC\u81A1\u59C6\u5CEE\u5267" + - "\u81A2\u81A3\u81A4\u5997\u81A5\u5BD8\u5CF1\u81A6\u5CF4\u4EFD\u4EDA\u81A7\u81A8\u81A9\u54CD\u81AA" + - "\u4C7D\u81AB\u4C62\u81AC\u53F2\uFFFE\u0007\u81AD\u5CF7\u59C0\u81B4\u81B5\u57E8\u4EBE\u4C9D\u4C45" + - "\u58DC\uFFFE\u0005\u81B6\u5BD9\u5A65\u4E90\u4E82\u5CF0\u81BB\u81BC\u5541\u57AF\u4AAA\u81BD\u5CF2" + - "\u81BE\u556B\u5CF5\u51D6\u5CF6\u81BF\u81C0\u57B0\u5CF8\u81C1\u81C2\u81C3\u49AD\u4D60\u81C4\u5D43" + - "\u81C5\u48E8\u81C6\u5187\u81C7\u558D\u81C8\u5665\u81C9\u5666\u5D44\uFFFE\u0005\u81CA\u4B89\u81CF" + - "\u81D0\u4B4B\uFFFE\u0006\u81D1\u57BA\u4B6D\u5C41\u5C95\u5A73\u81D7\u56E4\u81D8\u4DCD\u81D9\u5D42" + - "\u5D7C\u5A81\u5CFC\u4C91\u5C98\u5CFD\u5CF9\u5D41\u52E2\u81DA\u81DB\u5A56\u5CF3\u5D7D\u81DC\u5CFA" + - "\u81DD\u5386\u81DE\u81DF\u50CF\u81E0\u81E1\u5991\u48DA\u81E2\u81E3\u4ED0\u5D46\u81E4\u5D45\uFFFE" + - "\u0004\u81E5\u5D4C\u5D4E\u81E9\u5D4B\u55B8\u81EA\u81EB\u81EC\u5D49\u5BB5\u81ED\u81EE\u81EF\u4A7E" + - "\u5D48\u81F0\u50FC\u81F1\u55CB\u81F2\u5D4A\u81F3\u5D47\u81F4\u81F5\u5D50\u81F6\u81F7\u4BB0\u81F8" + - "\u81F9\u81FA\u4D49\u81FB\u59BF\u81FC\u81FD\u5860\u8241\u8242\u51C1\u8243\u4F64\u5B8D\u49DF\u5468" + - "\u508C\u5D4D\u8244\u5D4F\u8245\u57E9\u4DED\uFFFE\u0005\u8246\u5476\uFFFE\t\u824B\u4984\u8254" + - "\u8255\u8256\u4AD8\u4BEC\u5D54\uFFFE\u0004\u8257\u5041\u825B\u825C\u825D\u5D7E\u546E\u50FD\u5D58" + - "\uFFFE\u0005\u825E\u5677\u4C9E\u8263\u5D55\u8264\u5D57\u4943\u5A82\u5D59\u8265\u58C4\u8266\u5D56" + - "\u8267\u8268\u5D51\u8269\u5D52\u5149\u5D53\u826A\u826B\u4EF2\u58DD\u4CA8\u826C\u4FE2\u826D\u5D5D" + - "\uFFFE\u0004\u826E\u5D5A\u8272\u48B2\u8273\u8274\u8275\u5D62\uFFFE\n\u8276\u8281\u8282\u8283" + - "\u5D64\u4956\u8284\u5D5F\u8285\u8286\u4B59\u8287\u4FF2\u8288\u8289\u828A\u56C7\u4DF1\u59CF\u828B" + - "\u5D63\u828C\u828D\u4F89\u828E\u4A4B\u828F\u8290\u8291\u5D65\u4FEA\u8292\u5D66\u5D5B\u52DE\u8293" + - "\u5D5E\u5D61\u5D60\uFFFE\u000B\u8294\u5B4E\u829F\u5BB4\u82A0\u5484\uFFFE\u0004\u82A1\u5D68\u82A5" + - "\u82A6\u82A7\u4ED8\u5D6A\u82A8\u82A9\u82AA\u5D5C\u82AB\u5D6B\u53AA\uFFFE\u0005\u82AC\u5D69\uFFFE" + - "\u0004\u82B1\u5C97\u82B5\u5743\uFFFE\b\u82B6\u4F41\uFFFE\u0006\u82BE\u5D6C\uFFFE\t\u82C4" + - "\u535C\u5755\u82CD\u82CE\u82CF\u5D6D\u82D0\u82D1\u5D67\u4A45\u509F\uFFFE\u0004\u82D2\u4CB4\u82D6" + - "\u82D7\u50FB\uFFFE\u0004\u82D8\u48F7\uFFFE\u0015\u82DC\u4AF5\u82F1\u5D6E\u82F2\u5D6F\u4AA1\u5D70" + - "\u82F3\u82F4\u4ADE\uFFFE\u0005\u82F5\u48C0\uFFFE\u0004\u82FA\u8341\u8342\u8343\u5D71\u5555\uFFFE" + - "\u0013\u8344\u5892\uFFFE\u0006\u8357\u5D72\u835D\u835E\u835F\u5165\uFFFE\u000B\u8360\u5D76\u554E" + - "\uFFFE\u0004\u836B\u5D75\u5D74\u5D77\uFFFE\u0004\u836F\u567B\u8373\u4F49\uFFFE\u0005\u8374\u53A6" + - "\uFFFE\u0007\u8379\u8381\u8382\u8383\u5D73\u5D78\u8384\u8385\u8386\u5D79\uFFFE\u0006\u8387\u54E4" + - "\uFFFE\u000E\u838D\u50DB\uFFFE\u001D\u839B\u4BF8\u5CA2\u5AC9\u83B8\u5AA9\u58D5\u4A85\u5B77\u83B9" + - "\u5868\u4D83\u83BA\u506B\u83BB\u5283\u83BC\u83BD\u83BE\u4BD1\u83BF\u83C0\u5763\u5D8F\u5D91\u83C1" + - "\u83C2\u83C3\u4B53\u83C4\u4BB4\uFFFE\u0005\u83C5\u4FA3\u83CA\u83CB\u54EA\u83CC\u83CD\u54AA\u83CE" + - "\u83CF\u48CA\u4D4B\u519A\u5D83\u83D0\u50BB\u4D52\u83D1\u4D78\u58CA\u4999\u53E3\u4FDE\u4B85\u5C68" + - "\u83D2\u5999\u4EE5\u55DD\u83D3\u83D4\u4EBC\u5D87\u5CE6\u83D5\u83D6\u52D9\u83D7\u83D8\u4CD3\u54BC" + - "\u83D9\u83DA\u49E0\u5AD8\uFFFE\u0004\u83DB\u5250\u83DF\u83E0\u5282\u5DA1\u54DE\u83E1\u58B3\u83E2" + - "\u4FFB\u5349\u83E3\u83E4\u83E5\u4D7A\u83E6\u5DA2\u83E7\u5AA8\u5DA3\uFFFE\u0005\u83E8\u5D9C\u4BAB" + - "\u83ED\u83EE\u4C8C\u499A\u5D9D\u4A86\u4FF5\u83EF\u5097\u59B0\u50E3\u83F0\u83F1\u83F2\u4BB2\u5D9F" + - "\u5D9E\u83F3\u83F4\u4FBA\u83F5\u83F6\u83F7\u53DF\u83F8\u5C5C\u5DA0\u83F9\u5159\u83FA\u4B93\u5189" + - "\u83FB\u83FC\u4EF4\u83FD\u4AD4\uFFFE\t\u8441\u517D\u844A\u52FC\u844B\u844C\u4EB7\u4C52\u844D" + - "\u844E\u4C90\uFFFE\u0006\u844F\u5D8D\u8455\u53BD\u8456\u504D\u4E6B\u8457\u8458\u4B6A\u8459\u5E69" + - "\u58D6\u845A\u5759\u48BB\u4A97\u4E98\u5E6A\u4DAE\u845B\u5AE3\u4B56\u4B94\u5CD5\u54CF\u845C\u845D" + - "\u4C76\u5470\u5CD6\u845E\u504F\u845F\u8460\u5E5B\u5CD7\u8461\u8462\u58CB\u4E4E\u8463\u8464\u8465" + - "\u665E\u5170\u5196\u5AF1\u4CD4\u4AB3\u8466\u4A96\u8467\u8468\u555E\u8469\u846A\u846B\u5370\u846C" + - "\u846D\u846E\u5379\u50FA\u846F\u4991\u8470\u5CD8\u4D6E\u8471\u4B5D\u8472\u8473\u5CD9\u8474\u8475" + - "\u5BC5\u5642\u54AE\u5552\u4ACB\u506C\u8476\u4D95\u8477\u5CDA\u5CDB\u4BE6\u4EC0\u56E9\uFFFE\u0006" + - "\u8478\u5898\u847E\u5CDC\u5450\u847F\u8481\u4D70\u4F43\u8482\u8483\u56DD\u8484\u53C9\uFFFE\u0005" + - "\u8485\u5CDF\u848A\u5CDD\u848B\u848C\u5CDE\u848D\u848E\u848F\u48FD\u8490\u4FE6\u8491\u55A2\u4EF3" + - "\uFFFE\u0004\u8492\u4CB0\u8496\u8497\u4CED\uFFFE\n\u8498\u5CE1\u84A2\u4F6B\u84A3\u5CE3\u5CE2" + - "\uFFFE\u0005\u84A4\u539D\uFFFE\u0007\u84A9\u5CE4\u84B0\u84B1\u5CE5\uFFFE\u0007\u84B2\u5146\u84B9" + - "\u54AF\u48EB\u4D46\u4ED2\u57F0\u5E5D\u5173\uFFFE\u0004\u84BA\u4BAE\u5BF9\u534C\u4F79\u5E5E\u5E5F" + - "\u84BE\u84BF\u84C0\u50F7\u4FA1\u50CC\uFFFE\n\u84C1\u5E60\u55C5\u84CB\u84CC\u84CD\u49A9\u84CE" + - "\u84CF\u84D0\u5A62\u84D1\u5284\u84D2\u594B\uFFFE\u0004\u84D3\u5E62\u84D7\u50D4\u84D8\u84D9\u84DA" + - "\u5E63\u84DB\u5051\uFFFE\u0006\u84DC\u52BB\uFFFE\u0004\u84E2\u547A\uFFFE\u000B\u84E6\u5E64\uFFFE" + - "\b\u84F1\u5D89\u5577\u84F9\u84FA\u84FB\u4D54\u57EF\u5AC7\u84FC\u84FD\u8541\u8542\u48FB\u4AD1" + - "\u8543\u58D8\uFFFE\u0004\u8544\u5D8A\u8548\u5FCA\u5D8C\uFFFE\u0004\u8549\u5CAF\u4E4F\u4951\u854D" + - "\u4A77\u5CCD\u854E\u854F\u5AD0\u8550\u8551\u4F53\u5090\u8552\u585B\u8553\u8554\u5CCF\u8555\u8556" + - "\u8557\u4C6B\u8558\u8559\u855A\u5CD0\uFFFE\n\u855B\u53A4\u5499\u59BC\u8565\u8566\u5CD1\u52E3" + - "\u8567\u55AD\u8568\u5447\u8569\u5CA5\u856A\u559E\u57E6\u4E7C\u48EA\u856B\u856C\u856D\u4E4A\u58AC" + - "\u856E\u4950\u5C85\u5C5F\u856F\u4B45\u51F3\u52CE\u8570\u8571\u49A8\u8572\u49B6\u8573\u4986\u6052" + - "\u5B5C\u5048\u51AB\u5CD4\u51B0\u8574\u5CD3\u57D3\u8575\u5DDF\u8576\u57BF\u8577\u8578\u5CB3\u524E" + - "\u5A41\u57A2\u8579\u4EB3\u54B3\u51D0\u857A\u4FEC\u58B5\u857B\u5DE0\uFFFE\u0004\u857C\u5485\u8581" + - "\u8582\u4A47\u8583\u4BF1\u56FB\u50F9\u8584\u8585\u50F6\u8586\u5959\u5982\u5CC6\uFFFE\u0007\u8587" + - "\u49DD\u858E\u858F\u50E4\u8590\u4DF0\u8591\u8592\u5CC7\u8593\u5AAC\u8594\u8595\u5882\u5CC8\u8596" + - "\u5CC9\u5863\u8597\u4A99\u4FC6\uFFFE\u0004\u8598\u5CCA\uFFFE\u0007\u859C\u5E6C\uFFFE\u0004\u85A3" + - "\u54A4\u85A7\u85A8\u85A9\u5878\u85AA\u54FD\u49CD\uFFFE\u0005\u85AB\u5A76\u49E5\u4EAF\u5A71\u564B" + - "\u4C54\u85B0\u85B1\u85B2\u4C42\u85B3\u85B4\u55E4\u85B5\u54A0\u55DB\u4985\u58EF\u85B6\u5371\u85B7" + - "\u85B8\u85B9\u5E65\u4B9F\u85BA\u85BB\u507A\u4D65\u4FE3\u518E\u85BC\u6056\u6055\u5BBA\u4F70\u5B79" + - "\u48C7\u4BA2\u5069\u56A7\u6053\u55B6\u5A72\u85BD\u5CCE\u59B5\u4DC4\u565E\u56BD\u85BE\u6057\u4B91" + - "\u6054\u85BF\u85C0\u85C1\u5A96\u85C2\u4A74\u4CF6\u85C3\u605A\u85C4\u4DCE\u4EA9\u4B96\u85C5\u574C" + - "\u529C\u4DF2\u50F3\u5762\u5893\u6058\u5865\u85C6\u51BF\u6059\u51EF\u85C7\u85C8\u85C9\u4FFC\u85CA" + - "\u517F\u576C\u59F6\u4C6D\u6061\u85CB\u6064\u85CC\u85CD\u4C92\u48C8\u4BD5\u4C74\u85CE\u4DAB\u56FC" + - "\u5074\u5651\u53F3\u85CF\u5BA7\u6065\u85D0\u57E1\u4A53\u85D1\u85D2\u57FB\u4AB4\u85D3\u57C6\u4DEF" + - "\u85D4\u57E0\u85D5\u595D\u85D6\u85D7\u6060\u85D8\u85D9\u4AF3\u85DA\u4A6A\u85DB\u4CE5\u605B\uFFFE" + - "\u0004\u85DC\u52C4\u85E0\u605C\u605D\u605E\u535B\u605F\u6062\u5AB0\u6063\u85E1\u545A\u57D7\uFFFE" + - "\u0005\u85E2\u52D7\u85E7\u606A\u85E8\u606F\u85E9\u5BDB\uFFFE\b\u85EA\u6069\u607A\u57B5\u85F2" + - "\u4DC6\u606E\u6068\u537E\u85F3\u85F4\u558C\u4DF3\u529D\u85F5\u85F6\u4FD6\u85F7\u6066\u85F8\u606D" + - "\u85F9\u5378\uFFFE\u0004\u85FA\u5B46\u4DCC\u8641\u4FCB\u5A5D\u4CBF\u8642\u5BE3\u8643\u6067\u4D5E" + - "\u5047\u8644\u8645\u519D\u606B\u606C\u8646\u6070\uFFFE\u0005\u8647\u607B\u6086\u864C\u6077\u6076" + - "\u5C69\u6084\u6085\u638C\u59A6\u6072\u864D\u5049\u864E\u5ADA\u864F\u5068\u6074\u8650\u8651\u8652" + - "\u586C\u8653\u8654\u607D\u8655\u596A\u8656\u607E\u48A6\u53B6\u6073\u8657\u4DE4\u8658\u4BDE\u577B" + - "\u4D9F\u5AD4\u8659\u865A\u607F\u588D\u48A4\u6088\u6071\u5966\u6075\u6078\u6079\u607C\u865B\u4E49" + - "\u865C\u6081\u6082\u865D\u6083\u6087\u6089\u5A54\uFFFE\u0005\u865E\u4CE6\u5356\u608B\u557A\u5148" + - "\u52C3\u8663\u8664\u507E\u5899\u8665\u8666\u8667\u5B7C\u608F\uFFFE\u0006\u8668\u49B7\u866E\u4DDE" + - "\u608D\u866F\u5E61\u8670\u5985\uFFFE\u0004\u8671\u5695\u4ABC\u8675\u48A5\uFFFE\u0005\u8676\u6092" + - "\u56C5\u6093\u867B\u867C\u608E\u867D\u867E\u867F\u8681\u8682\u8683\u608A\uFFFE\u0004\u8684\u608C" + - "\u8688\u6090\u6091\u4E5D\u8689\u868A\u6094\u868B\u868C\u6095\u868D\u4E43\u868E\u55DA\u57A7\u60A6" + - "\u4A4A\u868F\u60A5\u8690\u8691\u8692\u60A0\uFFFE\u0004\u8693\u609F\u8697\u5779\u609D\u8698\u609B" + - "\u8699\u5070\u5C64\u869A\u556C\u869B\u869C\u6099\u48A0\uFFFE\u0005\u869D\u609E\uFFFE\u0004\u86A2" + - "\u609C\u60A1\uFFFE\u0005\u86A6\u60A7\uFFFE\u0004\u86AB\u4C68\u86AF\u86B0\u53A0\u5556\u50B1\u6096" + - "\u86B1\u86B2\u535E\u86B3\u5CC3\u609A\u52F5\uFFFE\u0006\u86B4\u60A2\u60A3\u60A4\u58A4\u86BA\u86BB" + - "\u60B3\u56E3\u86BC\u60B0\u86BD\u5046\u60AE\u57B8\u60AA\u5566\u86BE\u86BF\u50AD\u60AD\u4DEC\u4DAF" + - "\u60A8\u86C0\u86C1\u86C2\u6097\u86C3\u60B2\u86C4\u86C5\u60B7\u86C6\u86C7\u86C8\u4AAC\u60B8\u86C9" + - "\u86CA\u5852\u4DC7\u86CB\u60AF\uFFFE\u0007\u86CC\u58F9\uFFFE\t\u86D3\u60AB\u86DC\u5AFA\u86DD" + - "\u6098\u86DE\u5388\u86DF\u60AC\u86E0\u5A98\u86E1\u60B5\u60B6\uFFFE\u0005\u86E2\u60C3\u58E0\u86E7" + - "\u86E8\u86E9\u60BB\u86EA\u86EB\u60C8\u60C9\u86EC\u86ED\u86EE\u60BD\u60A9\u5544\u60C0\u86EF\u60B1" + - "\uFFFE\u0005\u86F0\u55C7\u60C2\u86F5\u60B4\u86F6\u57CA\u86F7\u5663\u60CC\u60C5\u60C1\u86F8\u60CA" + - "\u86F9\u60B9\u60BE\u60BF\u86FA\u86FB\u60C4\u86FC\u86FD\u60C6\u60C7\u8741\u60CB\u8742\u60BA\uFFFE" + - "\u0005\u8743\u5674\u60D4\u8748\u60D5\u60D1\uFFFE\u0006\u8749\u60CF\u4ECD\u874F\u8750\u60D0\u8751" + - "\u4CC1\u5CC4\uFFFE\b\u8752\u58E9\u875A\u875B\u51EE\u875C\u875D\u60CE\u60BC\u875E\u875F\u8760" + - "\u60D3\u60D2\u8761\u8762\u60D6\uFFFE\u0004\u8763\u60DB\u60D7\u8767\u8768\u8769\u5BF5\u4A50\u876A" + - "\u5C8D\u876B\u565B\u876C\u876D\u60D9\u876E\u57FA\u876F\u8770\u8771\u4DD8\uFFFE\f\u8772\u60E0" + - "\u60DC\u59AC\u877E\u877F\u8781\u8782\u8783\u60E1\u8784\u8785\u60DA\u60D8\u60DE\u8786\u8787\u60DF" + - "\uFFFE\u0005\u8788\u60DD\u878D\u60E3\u878E\u878F\u8790\u53F6\u5CAB\u5AEA\u60E5\u55C8\uFFFE\u0004" + - "\u8791\u60E4\uFFFE\u0004\u8795\u4CC0\uFFFE\u0004\u8799\u60E6\u60E7\uFFFE\b\u879D\u60E8\u60E2" + - "\uFFFE\u0007\u87A5\u4DBE\u56E6\u87AC\u87AD\u87AE\u60E9\uFFFE\u000F\u87AF\u589A\uFFFE\u000B\u87BE" + - "\u60EA\uFFFE\u0007\u87C9\u54C1\uFFFE\u0004\u87D0\u4F60\uFFFE\r\u87D4\u52D1\uFFFE\t\u87E1" + - "\u60EB\u87EA\u87EB\u60EC\u87EC\u87ED\u5495\u5664\u87EE\u60ED\u4E78\u5CB5\u59F1\u60EE\u5765\u87EF" + - "\u4BD9\uFFFE\u0006\u87F0\u60F0\u87F6\u5AAF\u87F7\u87F8\u50A6\u4AD0\u87F9\u87FA\u57A6\u60EF\u87FB" + - "\u87FC\u87FD\u60F1\u4D6C\u8841\u8842\u4D9B\u575C\u60F2\u8843\u8844\u8845\u53D3\u60F3\u8846\u5AB1" + - "\u8847\u54A5\u60F5\u60F4\uFFFE\u0011\u8848\u60F6\u8859\u885A\u5761\u885B\u885C\u885D\u55A4\uFFFE" + - "\u0004\u885E\u5AD9\u5E77\u5E79\u8862\u5E78\u4D88\u5E7C\u5E7D\u4B78\u8863\u8864\u5E7A\uFFFE\u0005" + - "\u8865\u5E7B\u4A41\u5E7F\u886A\u886B\u4E99\u886C\u5BB6\u886D\u5E81\uFFFE\u0004\u886E\u4FF8\u8872" + - "\u8873\u4C5B\u8874\u5E70\u56AD\u5052\u4E55\u5C99\u5073\uFFFE\u0005\u8875\u508A\u887A\u887B\u4EE0" + - "\u56B2\u5E7E\u48D2\u57EA\u4C78\u5C59\u53C1\u887C\u887D\u50A3\u887E\u56B8\u887F\u5E88\u5E82\u53B9" + - "\u5E84\u8881\u5E89\u8882\u5398\u8883\u8884\u8885\u5E8B\u8886\u8887\u5E8A\u5060\u8888\u8889\u888A" + - "\u5E87\u5E86\uFFFE\u0005\u888B\u4AB8\u50AB\u51A1\u5E83\u5E85\uFFFE\u0004\u8890\u58CC\u5E8E\uFFFE" + - "\u0005\u8894\u50DC\u5E93\uFFFE\u0007\u8899\u4BE1\uFFFE\u0004\u88A0\u5E94\u5E72\u4D58\u5AAA\u5E8D" + - "\u88A4\u5071\u5E91\u88A5\u5E71\u88A6\u4B87\u88A7\u5E8C\u5086\u88A8\u88A9\u88AA\u5E8F\u88AB\u5E92" + - "\u88AC\u88AD\u88AE\u5E9A\uFFFE\t\u88AF\u4D41\u48A2\uFFFE\u0007\u88B8\u51F0\u88BF\u88C0\u4A67" + - "\u5E90\u88C1\u88C2\u5E99\u88C3\u53D1\u5E95\u88C4\u88C5\u5E96\u5E98\u5E97\u88C6\u88C7\u5E9F\u88C8" + - "\u5A93\u49B9\u88C9\u88CA\u88CB\u5E9E\uFFFE\b\u88CC\u5EA3\u88D4\u5E9C\uFFFE\u0004\u88D5\u5E9B" + - "\u88D9\u88DA\u88DB\u5E9D\u5381\u4E9A\u88DC\u88DD\u5EA2\u88DE\u88DF\u5EA4\u88E0\u56C2\u88E1\u88E2" + - "\u88E3\u4BD0\u5F60\u88E4\u88E5\u88E6\u5EA0\u88E7\u5EA1\u88E8\u88E9\u88EA\u5455\u88EB\u88EC\u88ED" + - "\u4BE8\u88EE\u88EF\u88F0\u5EA6\uFFFE\u0004\u88F1\u5EA5\u88F5\u5EA8\u4944\u88F6\u88F7\u4B6C\uFFFE" + - "\u0005\u88F8\u5050\u88FD\uFFFE\u0004\u8941\u597F\uFFFE\u0004\u8945\u4BC1\uFFFE\u000E\u8949\u5EA7" + - "\uFFFE\u0007\u8957\u569B\u6694\u895E\u895F\u8960\u567C\u8961\u8962\u569F\u8963\u8964\u8965\u56C0" + - "\uFFFE\u0005\u8966\u54FA\uFFFE\u0006\u896B\u5EA9\uFFFE\u0005\u8971\u56ED\u5EAA\uFFFE\n\u8976" + - "\uFFFE\u0007\u8981\u5E73\u8988\u5EAE\u5EAB\u8989\u4FB2\u898A\u55FA\u898B\u898C\u898D\u5EAC\uFFFE" + - "\b\u898E\u556A\u52B8\uFFFE\u0005\u8996\u545D\u5EAD\u899B\u899C\u899D\u5AF5\u58E5\uFFFE\b" + - "\u899E\u52AA\u4BD4\uFFFE\u0012\u89A6\u5E74\uFFFE\u0004\u89B8\u497A\u89BC\u89BD\u89BE\u5E75\uFFFE" + - "\u000B\u89BF\u5E76\u89CA\u89CB\u89CC\u4DBD\uFFFE\u000E\u89CD\u54BF\uFFFE\u0006\u89DB\u55BE\u54C8" + - "\u89E1\u5C53\u89E2\u559A\u89E3\u89E4\u5067\u89E5\u89E6\u4DF7\u89E7\u89E8\u59BB\uFFFE\b\u89E9" + - "\u61B9\u89F1\u4AA5\u89F2\u89F3\u4958\uFFFE\u0005\u89F4\u4CB3\u89F9\u5864\uFFFE\u0004\u89FA\u5D88" + - "\u5846\u5783\u8A41\u8A42\u5D8E\u4BDF\u8A43\u59B8\u8A44\u8A45\u4D5B\uFFFE\u0004\u8A46\u61B8\u61B6" + - "\u8A4A\u4AF2\u8A4B\u56EB\u56AA\u4C93\u8A4C\u5CB1\u598C\u4DBA\u8A4D\u55A6\u8A4E\u8A4F\u5757\u8A50" + - "\u8A51\u59C3\u5085\u4ECF\u4BE0\u8A52\u5FC4\uFFFE\u0004\u8A53\u5FC5\u5E5C\u8A57\u5979\u8A58\u8A59" + - "\u53E5\u52CD\u4C8F\u8A5A\u4C7C\u8A5B\u8A5C\u509D\u5C81\u8A5D\u53F4\u8A5E\u8A5F\u495C\u5FC7\u4F51" + - "\u56D6\u5FC9\u8A60\u5FC8\uFFFE\u0005\u8A61\u4B8D\u8A66\u557D\u8A67\u8A68\u48C1\uFFFE\r\u8A69" + - "\u534E\u534B\u8A76\u52CB\u8A77\u4EE8\u569E\u8A78\u8A79\u8A7A\u4DC2\u8A7B\u8A7C\u8A7D\u639A\u54E6" + - "\u639B\u579E\u8A7E\u5C51\u4CBD\u51E7\u8A7F\u54D0\u8A81\u8A82\u639C\uFFFE\u0004\u8A83\u4BC9\u4ECA" + - "\u8A87\u8A88\u599E\u63A0\u8A89\u528F\uFFFE\u0004\u8A8A\u63A3\uFFFE\u0004\u8A8E\u639F\u63A4\u5777" + - "\u8A92\u8A93\u4C61\u639D\u639E\u63A2\u8A94\u8A95\u52DC\u63A7\u8A96\u8A97\u63A6\uFFFE\u0006\u8A98" + - "\u5263\u8A9E\u53DD\u8A9F\u8AA0\u63A9\uFFFE\u0007\u8AA1\u52B6\u8AA8\u8AA9\u8AAA\u63A1\u55BB\uFFFE" + - "\u0004\u8AAB\u4F84\u4D63\u63A5\u58D4\u57AE\u8AAF\u8AB0\u63A8\u63AF\u8AB1\u59A5\u8AB2\u4F4A\u63AC" + - "\uFFFE\u0005\u8AB3\u63AE\u8AB8\u50D0\u8AB9\u8ABA\u59CB\u8ABB\u8ABC\u8ABD\u4EA6\uFFFE\f\u8ABE" + - "\u63B0\u8ACA\u59F5\u8ACB\u8ACC\u8ACD\u5C6B\u8ACE\u579F\u8ACF\u577E\u51A5\u63AA\u63AB\u4F5F\u63AD" + - "\u63B2\u8AD0\u8AD1\u63B1\uFFFE\u0004\u8AD2\u63B5\u8AD6\u63B7\uFFFE\u0004\u8AD7\u52EE\u8ADB\u8ADC" + - "\u8ADD\u52C7\u8ADE\u8ADF\u4FE9\u5590\u8AE0\u8AE1\u63B6\u8AE2\u4BEF\u8AE3\u8AE4\u8AE5\u5285\uFFFE" + - "\u0007\u8AE6\u5A8A\u63B3\u8AED\u63B4\u8AEE\u54A1\uFFFE\u0005\u8AEF\u63BC\u8AF4\u8AF5\u8AF6\u63B8" + - "\uFFFE\u0005\u8AF7\u53C4\u8AFC\u8AFD\u5792\u63BA\uFFFE\n\u8B41\u63BB\uFFFE\u0004\u8B4B\u4E8A" + - "\uFFFE\u0007\u8B4F\u63BD\uFFFE\u0004\u8B56\u63B9\u8B5A\u8B5B\u50B6\uFFFE\t\u8B5C\u5A44\u63BE" + - "\u5595\u63C2\u8B65\u8B66\u63C3\uFFFE\u0004\u8B67\u58F5\uFFFE\u0012\u8B6B\u525D\u0000\u0003\u8B7D" + - "\u7E7F\u8182\u8384\u5264\u63C1\uFFFE\u000E\u8B85\u63C0\uFFFE\u0007\u8B93\u63C6\u5851\u8B9A\u6695" + - "\u8B9B\u8B9C\u63C9\uFFFE\u0005\u8B9D\u63C4\u8BA2\u8BA3\u4EDD\u5549\uFFFE\u0006\u8BA4\u4EB4\u8BAA" + - "\u8BAB\u5873\uFFFE\u0005\u8BAC\u63C7\u8BB1\u63C8\u8BB2\u63CD\u8BB3\u63CF\u8BB4\u8BB5\u8BB6\u63D0" + - "\u8BB7\u8BB8\u8BB9\u63CA\u4B75\u8BBA\u63CB\u8BBB\u8BBC\u63CE\u8BBD\u8BBE\u52DA\u8BBF\u63C5\uFFFE" + - "\u0005\u8BC0\u63CC\uFFFE\u0017\u8BC5\u63D1\uFFFE\f\u8BDC\u63D3\u63D2\uFFFE\u0016\u8BE8\uFFFE" + - "\u0004\u8C41\u63D4\u8C45\u5D99\u8C46\u8C47\u63D5\uFFFE\b\u8C48\u63D6\uFFFE\u000F\u8C50\u5C73" + - "\u63DC\u8C5F\u63DD\u5077\u5ACF\u8C60\u5C76\u4AE5\u5690\u63D9\u5CC2\u5C6E\u58A1\u8C61\u526F\u8C62" + - "\u8C63\u63DE\u4EBD\u4D62\u63DA\u5947\u8C64\u8C65\u4DA1\u51CE\u8C66\u5CAA\u8C67\u8C68\u8C69\u55EA" + - "\u638F\u8C6A\u63DB\u8C6B\u4C96\uFFFE\u0004\u8C6C\u54E5\u8C70\u8C71\u52F4\u8C72\u8C73\u6352\u52FD" + - "\u8C74\u569D\u6353\u5B4C\u8C75\u5A8F\u55D7\u48B1\u8C76\u566E\u578B\u8C77\u8C78\u4DE9\u8C79\u8C7A" + - "\u8C7B\u6355\u8C7C\u6354\u8C7D\u5C7A\u4D79\u5BE5\u4BA7\u5791\u59CA\u4946\u55B4\u8C7E\u4A89\u5594" + - "\u506D\u58FA\u55D1\u6356\u4E62\u8C7F\u8C81\u8C82\u587C\u4D4C\uFFFE\u0004\u8C83\u5AD6\u8C87\u8C88" + - "\u4DA5\u5988\u589D\u4ED1\u8C89\u6357\u54DC\u8C8A\u8C8B\u8C8C\u508E\u4997\u567E\u8C8D\u8C8E\u4EC4" + - "\u8C8F\u4EC3\u59F9\u527C\u507C\uFFFE\u0004\u8C90\u4CBA\u8C94\u8C95\u8C96\u5262\u8C97\u4DAD\u5AA1" + - "\uFFFE\t\u8C98\u547E\u52AE\u49EB\u8CA1\u4D71\u8CA2\u8CA3\u635B\u5168\u8CA4\u8CA5\u5B4F\uFFFE" + - "\u0005\u8CA6\u635C\u8CAB\u635E\uFFFE\u0007\u8CAC\u4AE6\u4BD3\u5662\u5950\u4B5C\u8CB3\u8CB4\u55D8" + - "\u8CB5\u4C83\u8CB6\u8CB7\u5585\u8CB8\u4F4B\u8CB9\u8CBA\u57BD\u5C91\uFFFE\u0004\u8CBB\u58A0\u8CBF" + - "\u5579\u8CC0\u8CC1\u4BFA\u63D7\u4EE1\u8CC2\u4A5E\u8CC3\u5570\u8CC4\u63D8\u4A42\uFFFE\u0004\u8CC5" + - "\u5FCB\u8CC9\u5A68\u5FCC\u8CCA\u59A1\uFFFE\u0004\u8CCB\u5FCD\uFFFE\u0004\u8CCF\u4FCC\u8CD3\u8CD4" + - "\u5FCE\u8CD5\u8CD6\u8CD7\u55AB\u59FB\u4A7F\u638B\u52E0\u4FA0\u57B1\u52F1\u4FD5\u53A7\u49E2\u8CD8" + - "\u8CD9\u4FD2\u8CDA\u8CDB\u549D\u56EA\u4F8D\u57DC\u8CDC\u8CDD\u55B9\u53C0\u638D\u58BB\u8CDE\u8CDF" + - "\u8CE0\u5B59\u8CE1\u8CE2\u8CE3\u638E\uFFFE\u0004\u8CE4\u55F3\u8CE8\u5760\u51C4\u8CE9\u6390\u8CEA" + - "\u51C3\u6391\uFFFE\u0007\u8CEB\u6399\u576D\u8CF2\u555D\uFFFE\u0007\u8CF3\u59D8\u6148\uFFFE\u0004" + - "\u8CFA\u5A8D\u8D41\u568B\u53F0\uFFFE\u0005\u8D42\u614C\u8D47\u8D48\u8D49\u6147\u6149\u8D4A\u8D4B" + - "\u614A\u614F\u8D4C\u8D4D\u49EC\u8D4E\u614B\u4CD9\u614D\u614E\u6150\u4B5A\u6151\uFFFE\u0005\u8D4F" + - "\u6153\u6158\uFFFE\u0005\u8D54\u5972\u8D59\u6156\u6155\u518C\u8D5A\u8D5B\u8D5C\u6157\u8D5D\u5ABF" + - "\u8D5E\u6152\u8D5F\u615A\u48B5\uFFFE\u0004\u8D60\u6154\u8D64\u509A\u8D65\u6159\u8D66\u8D67\u615B" + - "\uFFFE\u0006\u8D68\u615E\uFFFE\u0006\u8D6E\u615C\uFFFE\u0006\u8D74\u5BC4\uFFFE\u0006\u8D7A\u8D81" + - "\u585F\u8D82\u8D83\u615D\u615F\u51CC\u8D84\u4BEA\u8D85\u5A99\u8D86\u8D87\u546D\u8D88\u8D89\u4C86" + - "\uFFFE\n\u8D8A\u4FFD\uFFFE\u0006\u8D94\u6160\u6161\u8D9A\u8D9B\u6167\u4A88\uFFFE\u0006\u8D9C" + - "\u53E8\uFFFE\u0005\u8DA2\u4ADD\u8DA7\u5962\uFFFE\u0004\u8DA8\u6168\u8DAC\u8DAD\u6166\uFFFE\u0005" + - "\u8DAE\u6165\u8DB3\u6163\u6162\u8DB4\u4960\u8DB5\u8DB6\u8DB7\u5B58\u6164\uFFFE\u0005\u8DB8\u616B" + - "\uFFFE\b\u8DBD\u616C\u616A\uFFFE\b\u8DC5\u689B\u8DCD\u8DCE\u6173\u6172\u5456\uFFFE\u000B" + - "\u8DCF\u6169\u8DDA\u8DDB\u616E\u8DDC\u6170\uFFFE\u000B\u8DDD\u6174\u8DE8\u6171\u616D\u8DE9\u8DEA" + - "\u616F\uFFFE\u0004\u8DEB\u6175\uFFFE\r\u8DEF\u6176\u8DFC\u8DFD\uFFFE\u0014\u8E41\u6177\u8E55" + - "\u8E56\u8E57\u6178\uFFFE\u0019\u8E58\u617A\uFFFE\r\u8E71\u617B\u0000\u0003\u8E7E\u7F81\u8283" + - "\u8485\u57A0\uFFFE\r\u8E86\u647D\u8E93\u4AA7\u5BDC\u8E94\u8E95\u5952\u4A52\u8E96\u8E97\u4D44" + - "\u5C94\u5469\u4FDD\u4D4E\u8E98\u57D6\u8E99\u8E9A\u49ED\u5E6F\u8E9B\u4EB9\u59D0\u5668\u48CC\u8E9C" + - "\u8E9D\u5890\uFFFE\u0005\u8E9E\u5D84\u4F8E\u8EA3\u8EA4\u4972\u55CF\u49BB\u8EA5\u5647\u4C4B\u8EA6" + - "\u55A5\u8EA7\u8EA8\u8EA9\u5843\u8EAA\u8EAB\u60F7\u5B6A\u60FA\u8EAC\u8EAD\u60F9\u5361\u56FA\u8EAE" + - "\u5151\u60F8\u5BE2\u49AE\u5BC3\u4B7B\uFFFE\b\u8EAF\u4AF7\u5BA0\uFFFE\u0005\u8EB7\u584F\u48EE" + - "\u8EBC\u8EBD\u60FB\uFFFE\u0005\u8EBE\u6141\u4A43\u8EC3\u8EC4\u60FC\u60FD\u5251\uFFFE\u0004\u8EC5" + - "\u527D\u8EC9\u6142\u4C9A\uFFFE\u0006\u8ECA\u4E6F\uFFFE\u0007\u8ED0\u6143\u52BA\uFFFE\u0005\u8ED7" + - "\u6144\u8EDC\u8EDD\u6145\u8EDE\u8EDF\u6146\u4AB0\uFFFE\u000F\u8EE0\u4CC8\u53BC\u52E9\u8EEF\u49A1" + - "\u8EF0\u58D1\u8EF1\u647B\u4E63\u5A77\u5A64\u8EF2\u4D84\u61CE\u8EF3\u8EF4\u8EF5\u5C4F\u8EF6\u548D" + - "\u4973\u8EF7\u8EF8\u4AB1\u61D0\u8EF9\u8EFA\u8EFB\u58F1\u51AD\u61CF\u8EFC\u5083\u5A46\u4B77\u61D1" + - "\u4B8B\u8EFD\u528E\u4CFC\u8F41\u4CAD\u8F42\u5373\u4C6F\u61D3\uFFFE\u0004\u8F43\u61D2\u4BC7\u5C9A" + - "\uFFFE\u0005\u8F47\u5745\uFFFE\u0005\u8F4C\u61D7\u8F51\u61D5\u55FB\u5055\u5A59\u61D4\uFFFE\u0004" + - "\u8F52\u61D6\uFFFE\n\u8F56\u514E\u50C7\uFFFE\u0006\u8F60\u61DA\u61D9\u50A9\u8F66\u8F67\u516E" + - "\uFFFE\u0004\u8F68\u61DB\uFFFE\f\u8F6C\u61DC\u8F78\u61DD\uFFFE\u0007\u8F79\u8F81\u8F82\u5E68" + - "\u8F83\u5973\u5742\u8F84\u8F85\u4F48\u8F86\u8F87\u8F88\u5FC2\u5CA4\u504A\u5E6D\u59EB\u53F9\u534A" + - "\u8F89\u8F8A\u8F8B\u5FC3\u8F8C\u4977\u604E\u8F8D\u8F8E\u8F8F\u55BC\u8F90\u6051\u8F91\u4D4D\u8F92" + - "\u59FC\u8F93\u4CA4\u4DEA\u8F94\u8F95\u4A7A\u8F96\u8F97\u8F98\u4B7C\u5B65\uFFFE\u0004\u8F99\u5276" + - "\u5872\u4E41\u8F9D\u6394\u6393\u8F9E\u8F9F\u6395\u8FA0\u5785\u8FA1\u54F4\uFFFE\u0007\u8FA2\u4B4F" + - "\u545F\u8FA9\u6397\u8FAA\u8FAB\u8FAC\u66AF\uFFFE\u000F\u8FAD\u6387\u8FBC\u4D8A\u4B51\u8FBD\u51BB" + - "\u6389\u6388\u638A\uFFFE\u0004\u8FBE\u59CC\u8FC2\u8FC3\u8FC4\u618B\u58CD\u8FC5\u574E\u8FC6\u5986" + - "\u8FC7\u8FC8\u49C9\u498C\u8FC9\u4993\u538E\u8FCA\u8FCB\u5B63\u5A50\u8FCC\u617C\u8FCD\u8FCE\u8FCF" + - "\u617D\u8FD0\u59DA\u8FD1\u4A59\u496B\u8FD2\u8FD3\u8FD4\u579A\u5B98\u617E\u8FD5\u4FB5\u4AFC\u8FD6" + - "\u617F\u4DDB\u6181\u4E52\u51C8\u6182\u8FD7\u8FD8\u8FD9\u58EB\u8FDA\u575D\u8FDB\u8FDC\u6183\u8FDD" + - "\u4B63\u5367\u6184\u8FDE\u8FDF\u6185\uFFFE\u0004\u8FE0\u5A9A\uFFFE\u0006\u8FE4\u6186\u8FEA\u594D" + - "\u8FEB\u8FEC\u6187\u57A1\uFFFE\u0006\u8FED\u6188\u8FF3\u4B62\uFFFE\u0004\u8FF4\u6189\u4E75\uFFFE" + - "\u0005\u8FF8\u58C3\u61DF\u4978\u59E3\u8FFD\u9041\u61E0\u9042\u9043\u4EC8\u54CB\u9044\u61E2\u66FD" + - "\u66FC\u604F\u9045\u9046\u9047\u61E1\u5BBD\u579D\u5246\u9048\u9049\u904A\u6263\u904B\u904C\u5BD1" + - "\u61E6\u904D\u904E\u61E7\u904F\u9050\u5A67\u9051\u9052\u61EB\u508D\u9053\u61EC\u61E4\u9054\u9055" + - "\u4A60\u9056\u9057\u9058\u52ED\u9059\u905A\u61ED\u905B\u905C\u58C2\u905D\u4DF5\u61E8\u4C7E\u4E53" + - "\u56AB\u566B\u61E3\u61E5\u61E9\u61EA\u905E\u905F\u9060\u61F6\u9061\u9062\u61F3\u5AF4\u61F2\u9063" + - "\u9064\u534D\u9065\u5B9B\u5362\u49BF\u9066\u9067\u61EE\u9068\u61F1\u514F\u565C\u9069\u906A\u4B41" + - "\u61F8\u906B\u906C\u906D\u4EB0\u61F0\u58D3\u5AB8\u61F4\u4D76\u61F5\u906E\u906F\u9070\u5473\uFFFE" + - "\u0005\u9071\u61EF\uFFFE\u0005\u9076\u5C7C\u6741\u907B\u907C\u61F7\u907D\u6745\u61FD\u55D0\u0000" + - "\u0003\u907E\u7F81\u8283\u8485\u5155\u9086\u4E70\u9087\u9088\u5076\u9089\u4DE2\u908A\u908B\u5641" + - "\u908C\u908D\u908E\u6746\u6743\u908F\u9090\u6742\uFFFE\u0004\u9091\u4E76\u6747\u58F3\u9095\u9096" + - "\u6744\u4DDD\u4BF6\u6241\u4BB1\u56F0\u4D47\u9097\u5842\u5441\u9098\u9099\u5072\u909A\u909B\u4BF0" + - "\u909C\u61F9\u61FA\u61FC\u61FB\u52D4\u6242\u909D\u5A61\u909E\u909F\u90A0\u6247\u5464\uFFFE\u0004" + - "\u90A1\u5844\u90A5\u90A6\u6249\u4DB6\uFFFE\u0004\u90A7\u6248\u90AB\u4E7A\u90AC\u6243\u90AD\u90AE" + - "\u90AF\u6244\u624A\u90B0\u6246\u90B1\u57F1\u5A66\u90B2\u90B3\u4E5C\u90B4\u90B5\u5AC2\u90B6\u52F9" + - "\u90B7\u90B8\u6748\u58FB\u6245\u90B9\u5296\u90BA\u624D\u494F\u90BB\u6252\u90BC\u90BD\u90BE\u4EC1" + - "\u90BF\u90C0\u624C\u4B5F\uFFFE\b\u90C1\u548A\u6250\u90C9\u90CA\u90CB\u4FA9\u5790\uFFFE\u0005" + - "\u90CC\u4E94\u90D1\u90D2\u90D3\u56E7\u90D4\u90D5\u624F\u90D6\u6251\u90D7\u5847\u624E\u90D8\u57A8" + - "\u4E7D\uFFFE\u0005\u90D9\u4B8C\u4FE4\u49D1\u4A6D\u90DE\u4959\u624B\u49D0\u4B4C\u4D7F\u4BE7\u90DF" + - "\u90E0\u588C\u6257\u90E1\u4E6C\u90E2\u90E3\u54C6\u58C9\uFFFE\u0005\u90E4\u6258\u4A8F\uFFFE\u0004" + - "\u90E9\u6749\u90ED\u5A9B\u5A85\u90EE\u90EF\u90F0\u674A\u6259\u59E1\uFFFE\u0005\u90F1\u6255\uFFFE" + - "\u0004\u90F6\u5A7E\uFFFE\u0004\u90FA\u4CCF\u6253\u9141\u9142\u6256\u4C7F\u9143\u6254\u50A1\u9144" + - "\u9145\u9146\u625A\uFFFE\u0013\u9147\u5AB7\uFFFE\b\u915A\u4AC7\u9162\u625B\u9163\u4E65\u9164" + - "\u5598\u9165\u9166\u5586\u9167\u9168\u9169\u52BC\uFFFE\u0007\u916A\u674B\uFFFE\u0004\u9171\u51FC" + - "\uFFFE\u0004\u9175\u4E7B\u504E\uFFFE\u0007\u9179\u57BE\uFFFE\u0004\u9181\u625C\u9185\u5056\uFFFE" + - "\u0013\u9186\u4990\u9199\u919A\u5AF6\uFFFE\u0005\u919B\u625E\uFFFE\b\u91A0\u674D\uFFFE\t" + - "\u91A8\u625F\u4DA8\u674C\u91B1\u91B2\u625D\uFFFE\n\u91B3\u6260\uFFFE\u0006\u91BD\u4DB5\u91C3" + - "\u91C4\u91C5\u4BAD\uFFFE\u0005\u91C6\u58B7\u91CB\u48C2\u674E\uFFFE\u0005\u91CC\u674F\u50C0\u91D1" + - "\u6261\uFFFE\u0011\u91D2\u5353\uFFFE\u000E\u91E3\u6262\uFFFE\t\u91F1\u5EB1\uFFFE\u0004\u91FA" + - "\u9241\u9242\u6750\u9243\u4CE9\u9244\u57EB\u65A6\u58E6\u55F8\u54D5\u5857\u4A69\u57D1\u4F85\u9245" + - "\u9246\u627E\u4E93\u65A7\u5B5D\u9247\u53DC\u65A8\u9248\u9249\u924A\u65A9\u924B\u65AB\u65AA\u924C" + - "\u65AD\u65AC\uFFFE\u0004\u924D\u4F78\u9251\u65AE\u9252\u51BD\uFFFE\u0004\u9253\u4AC0\u4AF6\u9257" + - "\u9258\u4E47\uFFFE\u0005\u9259\u66E5\u66E4\u4C5F\u569A\u4983\u925E\u66E6\u925F\u9260\u9261\u5568" + - "\u66E7\u66E8\u9262\u55D5\u5FCF\u49C4\u5AF9\u9263\u9264\u53CA\u48C6\u4AF1\u54D2\u9265\u9266\u9267" + - "\u5770\u9268\u9269\u5058\uFFFE\u0007\u926A\u507B\u9271\u9272\u5444\u5BB3\u9273\u50A8\u5FD0\u5548" + - "\u5990\u5344\u48E6\u4A56\u54C4\u9274\u9275\u48E1\u9276\u9277\u4C97\u9278\u9279\u539B\u927A\u927B" + - "\u4BF2\u927C\u5B72\u4A70\u4EBB\u927D\u927E\u927F\u4A4D\uFFFE\u0004\u9281\u4FF0\u48D0\uFFFE\u0006" + - "\u9285\u59D5\u55E2\u5C45\u928B\u5756\u4BB5\u5059\u5B7B\u928C\u4CA6\u5377\u928D\u928E\u928F\u5FD1" + - "\u5079\u51D4\u5460\u9290\u4E44\u4948\u9291\u9292\u538B\u9293\u9294\u539C\u56A6\uFFFE\u0004\u9295" + - "\u4947\u9299\u929A\u929B\u4B76\u929C\u929D\u929E\u52A7\u929F\u5FD2\u595A\u4A8A\u92A0\u5293\u92A1" + - "\u92A2\u4C98\u92A3\u5BF3\u4B43\u49EF\u52B3\u52E8\u50AC\u5FD3\u92A4\u48E7\u5364\u5181\u92A5\u4D75" + - "\u92A6\u4FDB\u5778\u48CD\u92A7\u576F\u5FD5\u4FCF\u5C5E\u5FD4\u5B70\u48DC\u92A8\u92A9\u52E1\u92AA" + - "\u92AB\u51A2\u4EEF\u92AC\u5A55\u50B8\u5341\u49A5\u5AF0\u92AD\u92AE\u50A7\u55C2\u5FD6\u5B9D\u92AF" + - "\u4D50\u92B0\u54AC\u5649\u92B1\u5FD8\u505D\uFFFE\u0004\u92B2\u53B3\u5C47\u55AF\u52C2\u92B6\u4A76" + - "\u4D72\uFFFE\u0004\u92B7\u5BB7\u65FB\u48B3\uFFFE\u0004\u92BB\u5087\u92BF\u92C0\u56F3\uFFFE\u0004" + - "\u92C1\u577A\u92C5\u92C6\u92C7\u5BBE\u51CD\u92C8\u57CD\u56A1\u58AD\u52D2\u4B52\u5FD7\u5B96\u4EB6" + - "\u4E73\u92C9\u92CA\u48A3\u92CB\u5352\u4AEB\u92CC\u92CD\u92CE\u5B92\u92CF\u92D0\u65FC\uFFFE\u0006" + - "\u92D1\u5FD9\u5746\u92D7\u92D8\u578D\uFFFE\u0004\u92D9\u57E5\u5FDB\u92DD\u5751\u50A5\u92DE\u92DF" + - "\u5C5D\u92E0\u5FDA\u48C5\u4DB3\u5573\u52F2\u4FE7\uFFFE\u0004\u92E1\u49B5\uFFFE\b\u92E5\u50CB" + - "\u5691\u92ED\u4EF0\u4E5B\u4B57\u92EE\u92EF\u92F0\u5396\u92F1\u5FE5\u92F2\u92F3\u92F4\u5FE2\u4FDC" + - "\u92F5\u92F6\u5FDE\uFFFE\u0004\u92F7\u4AB6\u4F7D\u92FB\u92FC\u5FDF\u52EC\u92FD\u9341\u9342\u9343" + - "\u5866\u9344\u4B81\uFFFE\u0004\u9345\u4BDD\u55D9\u4B95\u5FE4\u9349\u5B66\u934A\u5FE0\u56CC\u53FD" + - "\u934B\u5365\u934C\u934D\u934E\u59B3\u934F\u4FF1\uFFFE\u0007\u9350\u51D2\u9357\u56BC\u4A58\u9358" + - "\u4F73\u9359\u5078\u5766\u597A\u4AEA\u935A\u5FE3\u5FDC\u5FE6\u935B\u65FD\u935C\u935D\u51AF\u5FE1" + - "\u935E\u935F\u5BBF\u4B47\u9360\u49F3\u9361\u5FE7\u9362\u5FF1\uFFFE\u0005\u9363\u5FEC\u9368\u5FF0" + - "\u9369\u936A\u54DF\u936B\u936C\u936D\u5C82\u5FEE\u5289\u56E0\u936E\u49E4\u936F\u9370\u9371\u59BD" + - "\uFFFE\u0007\u9372\u5FED\u9379\u5FEA\u57D4\u937A\u4AA6\uFFFE\u0005\u937B\u504B\u4FBD\u9381\u9382" + - "\u4F72\uFFFE\u0004\u9383\u5FE8\u9387\u5AAD\u9388\u5FDD\u9389\u5FE9\uFFFE\u0004\u938A\u50BE\u938E" + - "\u5FEB\u49F2\u4CE8\u51A6\u938F\u9390\u4F61\uFFFE\u0005\u9391\u5FF4\u5FF7\u9396\u9397\u49AA\u4AA3" + - "\u9398\u9399\u4AE9\u5546\uFFFE\u0006\u939A\u5FF5\u5671\u93A0\u4CE2\u93A1\u5FF6\u5FF9\uFFFE\u0004" + - "\u93A2\u5FF8\u93A6\u93A7\u93A8\u56C1\u93A9\u48E0\u4AED\uFFFE\u0006\u93AA\u635A\uFFFE\u0005\u93B0" + - "\u58AE\u93B5\u93B6\u49EA\u93B7\u6641\u93B8\u5FF3\u93B9\u93BA\u5584\u5FF2\u48D9\u59A0\u4998\u93BB" + - "\u56AE\uFFFE\u0007\u93BC\u5FEF\u93C3\u5644\u93C4\u93C5\u93C6\u5B4A\uFFFE\u0005\u93C7\u5FFA\uFFFE" + - "\b\u93CC\u4ADC\u93D4\u52A5\u93D5\u93D6\u93D7\u5FFC\uFFFE\n\u93D8\u529F\u52A0\u6041\uFFFE" + - "\u0007\u93E2\u516C\u93E9\u5FFB\u4FEE\u93EA\u53B1\uFFFE\t\u93EB\u4A65\u54F5\u93F4\u93F5\u565A" + - "\u5FFD\u93F6\u93F7\u6044\uFFFE\u0004\u93F8\u5C52\u93FC\u93FD\u9441\u9442\u9443\u4A57\uFFFE\u0004" + - "\u9444\u5163\u9448\u9449\u546B\u49A4\u4AE8\u944A\u5C4B\uFFFE\u0004\u944B\u52EB\u944F\u6042\u6043" + - "\u9450\u6045\u9451\u4DB2\u9452\u9453\u9454\u6046\u9455\u50DD\u9456\u9457\u5563\uFFFE\u0007\u9458" + - "\u49D8\u5487\u945F\u6047\u9460\u547C\uFFFE\u0004\u9461\u6048\u6642\uFFFE\u0005\u9465\u5673\u946A" + - "\u946B\u946C\u604A\u946D\u6049\u946E\u49C0\uFFFE\u0011\u946F\uFFFE\b\u9481\u536A\uFFFE\b" + - "\u9489\u604B\uFFFE\b\u9491\u5ADB\uFFFE\u0005\u9499\u54C0\uFFFE\f\u949E\u604C\uFFFE\u0005" + - "\u94AA\u4FEF\u94AF\u94B0\u604D\u5BA6\uFFFE\u0004\u94B1\u65B6\u6656\u55D4\u94B5\u5CFB\u4CC3\u94B6" + - "\u4D45\u94B7\u94B8\u4C65\u5B9F\uFFFE\u0005\u94B9\u4D6A\u94BE\u94BF\u58A6\u6ACC\u94C0\u94C1\u4B70" + - "\u94C2\u94C3\u5295\u94C4\u4FC7\u94C5\u94C6\u94C7\u6657\u48BC\u94C8\u94C9\u4F6C\u94CA\u5152\u94CB" + - "\u4976\u4A48\u94CC\u94CD\u94CE\u4CD1\u5542\u94CF\u94D0\u4BD7\uFFFE\u0004\u94D1\u6658\u4FB3\u94D5" + - "\u94D6\u94D7\u55FC\u94D8\u5463\u94D9\u5B9C\u94DA\u94DB\u4C94\uFFFE\u000F\u94DC\u57C3\u94EB\u94EC" + - "\u94ED\u5B4B\u4994\u94EE\u94EF\u94F0\u66B2\u48DE\u94F1\u66B4\u94F2\u94F3\u94F4\u4BB6\u94F5\u516F" + - "\u94F6\u6B9B\u58B0\u94F7\u94F8\u5B86\u94F9\u57D2\u94FA\u94FB\u4F90\u4A83\u94FC\u4CAA\u94FD\u5B56" + - "\u9541\u675D\u9542\u4BCE\u9543\u5659\u58C1\uFFFE\b\u9544\u4C5D\u954C\u954D\u66B5\u55A8\u954E" + - "\u954F\u9550\u5374\u9551\u66B8\u66B7\u51C2\u66B6\uFFFE\u0004\u9552\u58FC\u66B9\u9556\u66BA\u5C86" + - "\u9557\u9558\u66BB\u9559\u955A\u955B\u66BC\u53EB\uFFFE\b\u955C\u57DD\u9564\u4EC7\u9565\u9566" + - "\u54D4\u4B49\u4FC8\u5BBB\u5AE6\u9567\u9568\u594E\u58F0\u65B7\u65B8\u65B9\u4DB4\uFFFE\u0004\u9569" + - "\u55B0\u5096\u956D\u956E\u579B\uFFFE\u0005\u956F\u65BF\u9574\u48B9\u65BD\u9575\u9576\u50A4\u9577" + - "\u9578\u9579\u65BA\u957A\u49FC\u957B\u5298\u4E89\u957C\u957D\u957E\u59D6\u57F3\u65BE\u957F\u9581" + - "\u9582\u65BB\u9583\u9584\u9585\u65C2\u9586\u58C6\u5A53\uFFFE\u0004\u9587\u4AB9\u958B\u5261\u5C93" + - "\uFFFE\u0004\u958C\u5B71\u9590\u55C6\u9591\u65C4\u9592\u9593\u65C3\u65C6\u65C5\uFFFE\u0005\u9594" + - "\u5BE6\u9599\u5874\u959A\u959B\u65CA\u959C\u4E6E\uFFFE\u0007\u959D\u4F9B\u556E\u95A4\u95A5\u65CB" + - "\u95A6\u95A7\u5559\u589F\u65C9\u5ACD\u65CC\u65CE\u95A8\u95A9\u578E\uFFFE\u0004\u95AA\u65C8\u95AE" + - "\u65CD\u95AF\u95B0\u57ED\u95B1\u4E7E\u95B2\u4A5F\uFFFE\u0005\u95B3\u53D4\u4FAF\u57F9\u95B8\u95B9" + - "\u95BA\u5488\u95BB\u4FA6\u65CF\u95BC\u95BD\u5BC6\u95BE\u95BF\u95C0\u5160\u95C1\u95C2\u95C3\u5ADC" + - "\u95C4\u65D0\u95C5\u95C6\u585E\uFFFE\u0004\u95C7\u65D1\uFFFE\u0004\u95CB\u55ED\uFFFE\u0004\u95CF" + - "\u534F\u48B4\uFFFE\u0005\u95D3\u65D3\uFFFE\t\u95D8\u65D2\u6ADE\uFFFE\u0005\u95E1\u52B9\uFFFE" + - "\u0005\u95E6\u4949\uFFFE\u0004\u95EB\u637F\uFFFE\u0004\u95EF\u65D4\uFFFE\u000B\u95F3\uFFFE\u000F" + - "\u9641\u55EE\u9650\u65D5\u65D6\u53D7\uFFFE\b\u9651\u65D7\u9659\u965A\u65D8\uFFFE\u0006\u965B" + - "\u5ABA\u9661\u549B\u59B6\u4CFB\u9662\u9663\u65C1\u9664\u49DB\u9665\u9666\u51FB\u9667\u5AF7\u56E5" + - "\u5C8F\uFFFE\u0007\u9668\u5AC1\u5A70\u6663\u5394\u966F\u4C9F\u9670\u9671\u6674\u9672\u9673\u9674" + - "\u5657\u667E\u9675\u50C9\u9676\u9677\u9678\u579C\u9679\u4A4F\u967A\u53D9\uFFFE\u0005\u967B\u9681" + - "\u669D\u9682\u52BD\u9683\u57B3\u52A8\u495E\u5AFC\u9684\u55F4\u9685\u5BEB\u9686\u9687\u53D2\u4BE3" + - "\uFFFE\u0004\u9688\u4E9B\u968C\u968D\u58DF\u968E\u968F\u5551\u9690\u5AD2\u54A7\u9691\u9692\u4CCA" + - "\u9693\u64BD\u555C\u9694\u9695\u64BA\u9696\u50ED\u58D2\u49C3\u4AE4\u9697\u64BB\u9698\u9699\u5B68" + - "\uFFFE\u0005\u969A\u4BC4\u969F\u64BC\u55F7\u4CDB\u56F4\u96A0\u96A1\u96A2\u50B3\u96A3\u96A4\u598F" + - "\u64BE\u64C1\u96A5\u96A6\u4DBB\u96A7\u494D\u4F7C\u96A8\u65BC\u64C2\u96A9\u64C5\u96AA\u64CA\uFFFE" + - "\u0004\u96AB\u64CB\u96AF\u5669\u48E4\u96B0\u4EAA\u96B1\u96B2\u4D59\u96B3\u96B4\u64C0\u96B5\u5798" + - "\u96B6\u64C9\uFFFE\u0004\u96B7\u57F5\uFFFE\u0004\u96BB\u5B8E\u96BF\u5176\u64C3\u96C0\u5256\u96C1" + - "\u4D9C\u5BA5\u64C7\u96C2\u96C3\u96C4\u55DF\u5AE5\u96C5\u64BF\u96C6\u64C4\u64C6\u96C7\u5459\u4C84" + - "\u96C8\u64C8\u96C9\u507D\u64D1\u96CA\u96CB\u64D6\u96CC\u64D4\u4EDB\u4ECE\u64DA\uFFFE\b\u96CD" + - "\u64DD\u96D5\u64D9\u499B\uFFFE\n\u96D6\u48D7\u52B2\u4CCB\u53E1\u54BD\u54E0\u96E0\u96E1\u96E2" + - "\u64CE\u64D3\u64D5\u96E3\u4D92\u64D7\u5C96\u96E4\u52FA\u96E5\u64DB\u96E6\u96E7\u49E8\u96E8\u96E9" + - "\u96EA\u64D0\u96EB\u96EC\u4EEC\u96ED\u96EE\u5062\u64CC\u5BF8\u96EF\u5199\u49F0\uFFFE\b\u96F0" + - "\u64DE\u96F8\u55C0\u64D8\uFFFE\u0004\u96F9\u5B44\u96FD\u498B\u5B5B\u64CD\u64CF\u4BAF\u64D2\u9741" + - "\u64DC\u50B7\u9742\u55F6\u9743\u5648\u9744\u9745\u53DB\u50F4\uFFFE\u0005\u9746\u64E8\u974B\u974C" + - "\u974D\u58A2\uFFFE\u0007\u974E\u64F1\u5BE9\uFFFE\u0007\u9755\u64DF\u64E0\u975C\u975D\u975E\u599A" + - "\u4DCA\u4CF8\u975F\u9760\u4CF0\u5AD3\u64EE\u9761\u64ED\u64EB\u4D91\u56D1\u64E5\u57A5\u5093\u9762" + - "\u48B7\u64F0\u64EF\u9763\u5C60\u9764\u64E3\u9765\u5749\u5543\u9766\u4E58\u4F7B\u64E9\uFFFE\n" + - "\u9767\u64E1\u64E2\u64E4\u4B55\u64E6\u5465\u64EA\u64EC\u4F50\u5C4E\u9771\u64F7\uFFFE\b\u9772" + - "\u64F4\u977A\u5750\u64F5\uFFFE\u0005\u977B\uFFFE\u0004\u9781\u515A\u9785\u64E7\u9786\u5257\u48EF" + - "\uFFFE\b\u9787\u64F3\u978F\u9790\u9791\u64F6\u9792\u9793\u9794\u4D43\uFFFE\n\u9795\u5572" + - "\u979F\u97A0\u97A1\u526E\u57DF\u50E5\uFFFE\u0004\u97A2\u5694\u97A6\u56DC\u58B4\u97A7\u97A8\u55E0" + - "\u97A9\u64F2\uFFFE\n\u97AA\u4EEB\u97B4\u64F8\uFFFE\u0006\u97B5\u527E\u97BB\u53E4\u97BC\u4D98" + - "\uFFFE\u0004\u97BD\u48F3\u97C1\u97C2\u5C78\u97C3\u97C4\u4EAB\u97C5\u5390\uFFFE\u0005\u97C6\u56C3" + - "\u97CB\u97CC\u6546\uFFFE\n\u97CD\u554D\u97D7\u6542\u50E1\u97D8\u97D9\u97DA\u5063\u97DB\u97DC" + - "\u97DD\u64FD\u4D77\u97DE\u64FA\uFFFE\u0004\u97DF\u6544\u97E3\u97E4\u97E5\u59CD\uFFFE\u0005\u97E6" + - "\u6543\u97EB\u5BB1\u5C55\u97EC\u6547\u97ED\u4F57\uFFFE\f\u97EE\u64FB\u64FC\u97FA\u97FB\u97FC" + - "\u6541\u97FD\uFFFE\u0007\u9841\u5776\u9848\u9849\u59AB\u984A\u984B\u984C\u6552\uFFFE\u0004\u984D" + - "\u6549\u9851\u9852\u9853\u4AA9\u9854\u4ABA\u9855\u9856\u654B\uFFFE\u0011\u9857\u58A7\u9868\u9869" + - "\u6545\u986A\u986B\u4A9F\u986C\u986D\u654C\u50E2\u986E\u654A\u986F\u9870\u6559\u9871\u9872\u6558" + - "\uFFFE\u0004\u9873\u654E\u9877\u9878\u64F9\u9879\u987A\u6548\uFFFE\u0005\u987B\u504C\u6551\u655A" + - "\u9881\u9882\u51A4\u9883\u9884\u9885\u654F\u9886\u4CC4\u9887\u654D\u9888\u5A7C\u6554\u6555\u6557" + - "\u9889\u988A\u988B\u6567\uFFFE\u0006\u988C\u50C5\u6565\u9892\u9893\u6550\u9894\u9895\u655B\u48F0" + - "\uFFFE\n\u9896\u655C\u5B45\u98A0\u98A1\u655E\u98A2\u655F\u98A3\u98A4\u98A5\u6561\u98A6\u98A7" + - "\u5192\u98A8\u98A9\u54B5\u98AA\u98AB\u98AC\u655D\uFFFE\u0005\u98AD\u6562\uFFFE\b\u98B2\u6563" + - "\u98BA\u6553\u98BB\u6556\u98BC\u4E51\u98BD\u98BE\u98BF\u6560\uFFFE\u0006\u98C0\u4EF6\u98C6\u98C7" + - "\u98C8\u6564\u6566\uFFFE\f\u98C9\u656A\uFFFE\u0004\u98D5\u656E\uFFFE\n\u98D9\u49DA\u98E3" + - "\u6568\uFFFE\n\u98E4\u4C4E\uFFFE\f\u98EE\u656B\u656C\uFFFE\u0004\u98FA\u9941\u9942\u5B61" + - "\u9943\u52A2\uFFFE\u0006\u9944\u6578\u994A\u4DE0\uFFFE\u0004\u994B\u6569\u994F\u5A43\u9950\u9951" + - "\u9952\u6574\uFFFE\u0007\u9953\u6577\u6570\uFFFE\u0005\u995A\u656F\u995F\u9960\u5461\uFFFE\b" + - "\u9961\u6572\uFFFE\u0007\u9969\u6579\u4A68\u9970\u6573\uFFFE\u0005\u9971\u5891\u9976\u9977\u9978" + - "\u656D\uFFFE\u0007\u9979\uFFFE\u0004\u9981\u4A98\uFFFE\u0007\u9985\u6576\u998C\u998D\u657A\u998E" + - "\u998F\u9990\u56B3\u9991\u9992\u9993\u584D\uFFFE\t\u9994\u6575\u999D\u657C\u657B\uFFFE\u0005" + - "\u999E\u657E\uFFFE\b\u99A3\u6571\uFFFE\b\u99AB\u657D\u99B3\u657F\u526A\uFFFE\u004A\u99B4" + - "\uFFFE\u0029\u9A41\u5457\u4ACD\u4E56\u58BF\u66A2\u9A6A\u9A6B\u5357\uFFFE\n\u9A6C\u5A9C\uFFFE" + - "\u0004\u9A76\u66A3\u9A7A\u66A4\u53DA\u9A7B\u9A7C\u9A7D\u508F\u9A7E\u9A7F\u9A81\u9A82\u66A5\u9A83" + - "\u9A84\u66A6\u58A9\u9A85\u5458\u9A86\u9A87\u4CE7\uFFFE\f\u9A88\u66A7\uFFFE\b\u9A94\u5BB8" + - "\u5B9E\u4ACA\u49BC\u57E3\u53E6\u9A9C\u9A9D\u5782\uFFFE\u000E\u9A9E\u4AF4\u9AAC\u5660\u4EDE\uFFFE" + - "\u0004\u9AAD\u6583\u6584\u598B\u6586\u9AB1\u4AF8\u6585\u9AB2\u5953\u55E1\u49CF\u9AB3\u6589\uFFFE" + - "\u0004\u9AB4\u6587\u6588\u9AB8\u9AB9\u5BB2\u9ABA\u9ABB\u9ABC\u658A\u658B\uFFFE\u0005\u9ABD\u658C" + - "\uFFFE\b\u9AC2\u658D\uFFFE\b\u9ACA\u66AE\u5359\u4BCD\u9AD2\u59F2\uFFFE\u0007\u9AD3\u4B8F" + - "\u9ADA\u4E79\u66B0\u9ADB\u9ADC\u59E2\uFFFE\u0005\u9ADD\u57E2\u9AE2\u52B7\u9AE3\u525F\u9AE4\u9AE5" + - "\u4BBD\u5CB8\u4968\u496F\u4971\u539F\u9AE6\u4970\u9AE7\u524B\uFFFE\u0005\u9AE8\u5B51\uFFFE\b" + - "\u9AED\u6644\u4DC0\u9AF5\u9AF6\u9AF7\u56B9\u9AF8\u9AF9\u9AFA\u6645\u9AFB\u6647\u9AFC\u9AFD\u9B41" + - "\u6648\u9B42\u9B43\u9B44\u6646\uFFFE\u0007\u9B45\u6649\u664B\u664A\uFFFE\u0005\u9B4C\u664C\u9B51" + - "\u55CE\u5CB4\u5292\u9B52\u5245\u53F7\u664D\u52C9\u9B53\u664E\u664F\u6650\u4C75\u9B54\u9B55\u9B56" + - "\u4C9B\u9B57\u6651\u5483\u9B58\u6653\u9B59\u4DA3\u5996\u48B0\u6652\u6654\u9B5A\u9B5B\u9B5C\u4B4A" + - "\u51C7\u5489\u9B5D\u6655\u9B5E\u564E\u627F\u9B5F\u9B60\u5A60\uFFFE\u0004\u9B61\u5D7B\u9B65\u9B66" + - "\u5741\u5BAC\u5494\u9B67\u9B68\u9B69\u5D81\u4E84\u9B6A\u4DB9\u6283\uFFFE\u0005\u9B6B\u584B\u9B70" + - "\u9B71\u9B72\u6281\u5567\u9B73\u4DB8\u9B74\u9B75\u9B76\u5954\u6282\u54E9\u4D4F\u4F4D\u4A78\u57DA" + - "\u9B77\u9B78\u56BF\u9B79\u9B7A\u9B7B\u6289\u628A\u5795\uFFFE\u0004\u9B7C\u9B81\u56AC\u9B82\u4EB2" + - "\u9B83\u628B\u9B84\u628C\u9B85\u9B86\u58D9\u9B87\u9B88\u9B89\u53FA\u4C7A\u9B8A\u9B8B\u547F\u59C9" + - "\u57D5\u9B8C\u6285\u628D\u9B8D\u5593\u4A61\u9B8E\u9B8F\u6288\u9B90\u9B91\u53E2\u6286\u9B92\u9B93" + - "\u6753\u6287\uFFFE\u0004\u9B94\u5553\u9B98\u5387\u9B99\u9B9A\u9B9B\u4D55\u9B9C\u525B\u9B9D\u6284" + - "\u535D\u5144\u51D8\u49D6\u9B9E\u628E\u4E46\u52AC\u9B9F\u6291\u4FD9\u9BA0\u9BA1\u629C\u6296\u4DD2" + - "\uFFFE\u0004\u9BA2\u4C70\u5A6D\u9BA6\u5BCD\u5B73\u4D61\u5B54\u5978\uFFFE\u0004\u9BA7\u58B8\u5497" + - "\u9BAB\u9BAC\u9BAD\u54A9\u49B3\u9BAE\u527A\u9BAF\u9BB0\u9BB1\u628F\u9BB2\u9BB3\u629D\u6290\u4C48" + - "\u6298\u6295\u9BB4\u9BB5\u9BB6\u4C5A\u9BB7\u9BB8\u5342\u9BB9\u6297\u537D\u49A7\u53FB\u9BBA\u52DF" + - "\u9BBB\u9BBC\u5C42\u9BBD\u50E0\u629A\u9BBE\u9BBF\u629B\u629E\u56A8\u6294\u9BC0\u5A5E\u9BC1\u4963" + - "\u6754\u6292\u6293\u9BC2\u6299\u58B9\u53C2\u5AF2\u629F\u9BC3\u9BC4\u4F81\u9BC5\u9BC6\u62A6\u9BC7" + - "\u9BC8\u62A5\u9BC9\u9BCA\u9BCB\u5994\u62A2\u9BCC\u62A8\u9BCD\u9BCE\u9BCF\u54F6\uFFFE\u0004\u9BD0" + - "\u5854\u9BD4\u62A7\u62AD\u51E4\u9BD5\u9BD6\u4BB3\uFFFE\u0006\u9BD7\u4F93\u9BDD\u62A1\u9BDE\u9BDF" + - "\u4DE8\u62A9\u9BE0\u9BE1\u62AB\u9BE2\u9BE3\u4BFC\u5BDD\u62B1\u9BE4\u62AC\u9BE5\u9BE6\u9BE7\u62A0" + - "\u9BE8\u4E8F\u577D\u5442\u5369\u9BE9\u9BEA\u5198\u9BEB\u62A3\u9BEC\u5453\u4F4C\u4F5D\u62A4\u9BED" + - "\u5C67\u49E1\u9BEE\u62AA\u4EC2\u62AE\u9BEF\u4E8C\u62AF\u5348\u62B0\uFFFE\u0004\u9BF0\u5B84\u5043" + - "\u9BF4\u62B9\u9BF5\u62B6\u9BF6\u62BA\u9BF7\u9BF8\u62BC\u9BF9\u9BFA\u53D5\u9BFB\u9BFC\u4DC5\u50CA" + - "\u9BFD\u9C41\u9C42\u4CA0\u62B3\uFFFE\u0004\u9C43\u5AA0\u9C47\u9C48\u4DA2\u4F9F\u9C49\u9C4A\u9C4B" + - "\u62BB\uFFFE\u0005\u9C4C\u575F\u9C51\u9C52\u52F8\u9C53\u9C54\u589C\u5587\u9C55\u9C56\u5A5F\u9C57" + - "\u5871\u9C58\u9C59\u62B2\u9C5A\u62B7\u62B8\u56E8\uFFFE\u0005\u9C5B\u56CD\u9C60\u50D3\u62B4\u5150" + - "\u62B5\u57CF\u9C61\u4E61\u4B73\u9C62\u54F2\u4F47\u5B67\u554C\u4CA1\u62C9\u9C63\u9C64\u62CB\u5964" + - "\u9C65\u9C66\u59B9\u9C67\u9C68\u4DAC\u9C69\u9C6A\u4DD3\uFFFE\u0006\u9C6B\u62C2\u4B8E\u9C71\u9C72" + - "\u9C73\u5C6D\u62BF\u589E\u62BE\u9C74\u9C75\u9C76\u517C\u56C9\uFFFE\u0004\u9C77\u55E6\uFFFE\u0004" + - "\u9C7B\u52D6\u9C7F\u56D3\u62C7\u9C81\u9C82\u9C83\u62C6\u62C0\u9C84\u62C3\u4B4D\u9C85\u9C86\u5A79" + - "\u9C87\u62C5\uFFFE\u0004\u9C88\u59F8\u4AE2\u9C8C\u4E54\u9C8D\u9C8E\u558F\u9C8F\u4ABD\u9C90\u9C91" + - "\u9C92\u4E8D\u9C93\u596D\u9C94\u56EC\u6755\uFFFE\b\u9C95\u5486\uFFFE\u0004\u9C9D\u5AA7\u9CA1" + - "\u62CA\u5C75\u62C1\u9CA2\u4F45\u62C4\u9CA3\u9CA4\u5A87\u9CA5\u62C8\u5599\u9CA6\u9CA7\u62BD\u9CA8" + - "\u9CA9\u5A86\u9CAA\u9CAB\u549F\u4BC8\u9CAC\u5AFB\u49B2\u62D6\u9CAD\u9CAE\u9CAF\u57C1\u9CB0\u62CC" + - "\u9CB1\u57BB\u9CB2\u4CDA\u9CB3\u9CB4\u62D5\u9CB5\u506A\u9CB6\u9CB7\u9CB8\u5A6E\u9CB9\u528D\uFFFE" + - "\b\u9CBA\u5368\u62D7\uFFFE\b\u9CC2\u5764\u62CE\uFFFE\u0004\u9CCA\u62D3\u62D4\u9CCE\u4DFD" + - "\u9CCF\u5887\u9CD0\u9CD1\u5B5F\u9CD2\u9CD3\u9CD4\u62D1\uFFFE\u000B\u9CD5\u62CF\u9CE0\u9CE1\u62CD" + - "\uFFFE\u000F\u9CE2\u5786\u55A9\u9CF1\u9CF2\u9CF3\u50A2\u9CF4\u4F46\u62D2\u9CF5\u9CF6\u4CC7\uFFFE" + - "\u0005\u9CF7\u62E6\u5AB3\u9CFC\u9CFD\uFFFE\u0005\u9D41\u62DA\u9D46\u9D47\u9D48\u5190\u9D49\u9D4A" + - "\u62E8\u9D4B\u9D4C\u59E6\u9D4D\u9D4E\u62DE\u9D4F\u62DF\u9D50\u9D51\u584A\uFFFE\u0004\u9D52\u567D" + - "\u9D56\u62D9\u62D0\u9D57\u62E4\u9D58\u54DB\u62E2\u9D59\u9D5A\u52E6\u62E1\u9D5B\u62E0\u9D5C\u9D5D" + - "\u9D5E\u4A9D\u62E7\uFFFE\u0004\u9D5F\u4B82\u9D63\u9D64\u9D65\u5C6C\u9D66\u9D67\u9D68\u62E5\u9D69" + - "\u4E4C\u9D6A\u5C72\u56CE\u6699\u9D6B\u62E3\u9D6C\u9D6D\u4D97\u9D6E\u9D6F\u9D70\u5BCC\u62D8\u62DB" + - "\u51F9\u62DD\u9D71\u51CA\u50C3\u51CF\u9D72\u4996\u56B1\uFFFE\n\u9D73\u4B6E\u9D7D\u9D7E\u9D7F" + - "\u9D81\u62EE\uFFFE\b\u9D82\u53AE\u9D8A\u9D8B\u9D8C\u53E0\u9D8D\u9D8E\u62F4\uFFFE\u0005\u9D8F" + - "\u51A8\u9D94\u9D95\u9D96\u50EB\u597D\u62ED\uFFFE\n\u9D97\u52AD\u9DA1\u9DA2\u9DA3\u62EC\uFFFE" + - "\u0004\u9DA4\u62F5\u62F3\u51FD\u9DA8\u62DC\u9DA9\u62EF\u9DAA\u55FD\u9DAB\u5B64\u9DAC\u9DAD\u62F0" + - "\uFFFE\u0007\u9DAE\u599B\uFFFE\u0007\u9DB5\u62EA\u62EB\u9DBC\u9DBD\u9DBE\u62F1\u9DBF\u57AA\uFFFE" + - "\n\u9DC0\u536B\u9DCA\u9DCB\u9DCC\u5451\u9DCD\u51B9\u9DCE\u9DCF\u9DD0\u62E9\u9DD1\u9DD2\u9DD3" + - "\u516A\uFFFE\u0006\u9DD4\u56B5\u4A51\u9DDA\u9DDB\u9DDC\u62FA\u9DDD\u62F2\u9DDE\u9DDF\u9DE0\u62F9" + - "\u9DE1\u62FC\u9DE2\u62FB\uFFFE\u0007\u9DE3\u4A6E\u9DEA\u9DEB\u9DEC\u4A5A\u62F6\u9DED\u9DEE\u62F8" + - "\u62F7\u538D\uFFFE\r\u9DEF\u50BC\u9DFC\u9DFD\u9E41\u9E42\u5AE7\uFFFE\u0005\u9E43\u6342\uFFFE" + - "\u000B\u9E48\u48C3\u9E53\u9E54\u6344\u9E55\u9E56\u6343\uFFFE\u0006\u9E57\u4EA3\u9E5D\u6345\uFFFE" + - "\u0006\u9E5E\u6341\uFFFE\u0007\u9E64\u62FD\u4995\uFFFE\u000B\u9E6B\u6348\u9E76\u6349\u6346\uFFFE" + - "\t\u9E77\u9E81\u9E82\u9E83\u6347\u634A\uFFFE\u0021\u9E84\u53D8\uFFFE\b\u9EA5\u634B\u634D" + - "\uFFFE\u0007\u9EAD\u634C\uFFFE\u0011\u9EB4\u634F\u9EC5\u9EC6\u9EC7\u634E\uFFFE\u0012\u9EC8\u4D81" + - "\u9EDA\u9EDB\u6350\uFFFE\u000E\u9EDC\u6351\uFFFE\f\u9EEA\u4E91\u66E0\u5291\u9EF6\u4B66\u4E72" + - "\uFFFE\u0004\u9EF7\u518A\u5AED\u9EFB\u4FC3\u9EFC\u9EFD\u9F41\u5C66\u9F42\u5AD5\u49D2\u66BD\uFFFE" + - "\u0004\u9F43\u65C0\u9F47\u9F48\u9F49\u51AE\u4AB5\u9F4A\u9F4B\u9F4C\u5977\u9F4D\u9F4E\u9F4F\u4A54" + - "\u9F50\u54B1\u505B\u66BF\u9F51\u9F52\u5BCA\u9F53\u9F54\u66BE\u66C0\uFFFE\r\u9F55\u66C4\u4FE5" + - "\u56BE\u537A\u4FBB\u9F62\u66C5\u9F63\u499F\u9F64\u9F65\u9F66\u66C3\u5B48\u4B84\u9F67\u66C1\u5156" + - "\u4A84\u9F68\u9F69\u66C2\u5658\u50C2\u56FD\uFFFE\u0004\u9F6A\u5172\u9F6E\u66C7\uFFFE\r\u9F6F" + - "\u4DE5\u50D2\u9F7C\u5BF1\u9F7D\u9F7E\u9F7F\u596C\uFFFE\u0004\u9F81\u505E\u9F85\u4C53\u5575\u66C6" + - "\u4E83\u9F86\u56CB\u4F9E\u54C7\u9F87\u5849\uFFFE\u0007\u9F88\u578A\u9F8F\u538C\u9F90\u9F91\u9F92" + - "\u4C8A\uFFFE\u000B\u9F93\u5969\u4DB7\uFFFE\u0005\u9F9E\u66C8\u9FA3\u9FA4\u66C9\u9FA5\u4E60\u66CA" + - "\u9FA6\u66E1\u495A\u4C79\uFFFE\u000B\u9FA7\u4F59\uFFFE\b\u9FB2\u66CB\u5987\u66CC\uFFFE\u0004" + - "\u9FBA\u54BA\uFFFE\u000E\u9FBE\u66D0\uFFFE\u0004\u9FCC\u66D2\u9FD0\u4E6D\u9FD1\u4EE4\uFFFE\r" + - "\u9FD2\u66CE\u9FDF\u5557\uFFFE\u0005\u9FE0\u525A\u9FE5\u66E2\u5B75\u66CF\uFFFE\u0005\u9FE6\u5BF2" + - "\u9FEB\u9FEC\u9FED\u66D1\u66CD\uFFFE\u0004\u9FEE\u66D3\u9FF2\u66D4\u9FF3\u9FF4\u555F\uFFFE\u0006" + - "\u9FF5\u5848\u9FFB\u9FFC\u9FFD\uA041\uA042\u58DB\uFFFE\u0004\uA043\u594C\uFFFE\u0004\uA047\u54DA" + - "\uA04B\uA04C\uA04D\u66D5\u57F4\uFFFE\u0005\uA04E\u55EB\u66D9\uFFFE\u0007\uA053\u66D8\uA05A\uA05B" + - "\uA05C\u48BD\uFFFE\u0006\uA05D\u66D6\uA063\u66D7\uA064\uA065\uA066\u66E3\uFFFE\t\uA067\u54BB" + - "\uFFFE\n\uA070\u5167\uFFFE\u0005\uA07A\u66DB\u5981\uA07F\uFFFE\t\uA081\u66DA\uFFFE\u0004" + - "\uA08A\u5AEE\uA08E\u66DC\uFFFE\u0006\uA08F\u5E66\uFFFE\n\uA095\u66DD\uFFFE\f\uA09F\u494C" + - "\uFFFE\u0016\uA0AB\u66DE\uFFFE\n\uA0C1\u66DF\uA0CB\u5C46\uA0CC\u5360\uA0CD\uA0CE\uA0CF\u665C" + - "\u48AD\uA0D0\uA0D1\uA0D2\u4FF3\u4CB7\u59AE\u48D5\u4B9A\uA0D3\u5CB2\uA0D4\u564C\uA0D5\u627D\uFFFE" + - "\u0007\uA0D6\u53AB\u48E5\uA0DD\uA0DE\uA0DF\u5366\u6659\uFFFE\u0004\uA0E0\u665A\uA0E4\uA0E5\uA0E6" + - "\u665B\uA0E7\uA0E8\u5960\uA0E9\u5343\uA0EA\u65F1\uA0EB\u52B1\uA0EC\u52B4\u50CD\uA0ED\uA0EE\uA0EF" + - "\u65F2\u52C0\uA0F0\u57EE\uFFFE\u0004\uA0F1\u65EF\u65F3\uA0F5\uA0F6\u559D\uA0F7\uA0F8\u5443\uA0F9" + - "\uA0FA\uA0FB\u56D7\u57FD\uA0FC\uA0FD\uA141\u65F4\u65F5\u584C\u50E6\uA142\uA143\u65F6\uFFFE\u0005" + - "\uA144\u4BBE\u65F7\uA149\u65F8\uA14A\u65F9\uA14B\uA14C\u65FA\uFFFE\f\uA14D\u65F0\uFFFE\f" + - "\uA159\u54AD\u618C\uA165\u4C58\u618D\uA166\uA167\uA168\u618E\uA169\u5C54\u618F\u6190\u5A6C\uFFFE" + - "\u0007\uA16A\u6192\u5092\u6191\u4B72\uA171\uA172\uA173\u4957\uFFFE\u0004\uA174\u6194\u6193\uA178" + - "\u4DFB\uA179\u6195\uFFFE\u0004\uA17A\u4D57\uA17E\u4FD0\uA17F\uA181\uA182\uA183\u52FB\uA184\u4DDC" + - "\u4F66\uFFFE\u0006\uA185\u6196\u6198\uA18B\uA18C\u4BBF\u5861\u55A7\u6197\u5B99\u5A9D\u6199\u619D" + - "\u619A\uA18D\uA18E\u619B\u50E9\uA18F\u619F\u61A0\u50C6\uFFFE\u0004\uA190\u619C\uA194\u619E\uFFFE" + - "\u0006\uA195\u61A4\uA19B\uA19C\uA19D\u5174\uFFFE\u0004\uA19E\u61A2\uA1A2\u61A7\u49FD\u61A1\uA1A3" + - "\uA1A4\uA1A5\u526D\u49C1\u61A6\u61A5\uA1A6\uA1A7\u61A3\u61A8\uA1A8\uA1A9\u61AA\uA1AA\uA1AB\uA1AC" + - "\u58C8\u5BEC\u5248\u61AB\uA1AD\u5877\uA1AE\uA1AF\u61AD\uA1B0\uA1B1\u4DEE\uA1B2\uA1B3\u6581\u61AC" + - "\u61A9\uFFFE\u0004\uA1B4\u4E4B\u5AB2\uFFFE\r\uA1B8\u61AF\uA1C5\uA1C6\u61AE\uA1C7\u6582\uFFFE" + - "\u0004\uA1C8\u61B0\uFFFE\b\uA1CC\u61B1\uFFFE\u000B\uA1D4\u61B2\u56A0\uA1DF\u61B3\uFFFE\u000E" + - "\uA1E0\u61B4\uFFFE\u0005\uA1EE\u58FD\uA1F3\uA1F4\u51C9\uA1F5\u5A92\uA1F6\u5796\uA1F7\uA1F8\u6481" + - "\uA1F9\uA1FA\u6482\uA1FB\uA1FC\uA1FD\uA241\u4FC0\uFFFE\u0004\uA242\u51E9\uA246\uA247\uA248\u6485" + - "\uA249\uA24A\u6484\uFFFE\u0006\uA24B\u5787\uA251\u5255\uA252\uA253\u6483\u4E57\u5876\uA254\u5182" + - "\u648A\uA255\uA256\uA257\u6489\uA258\uA259\u6495\u49A2\uFFFE\u0004\uA25A\u648B\uA25E\u6487\uFFFE" + - "\u0005\uA25F\u648D\u648C\u555A\uA264\uA265\u5B85\uA266\u6486\u4C49\u6488\uFFFE\u0007\uA267\u648F" + - "\uFFFE\u0004\uA26E\u6494\uA272\u5BE8\uFFFE\u0004\uA273\u648E\uA277\u6493\uA278\u6492\uA279\uA27A" + - "\uA27B\u48DF\uFFFE\u0004\uA27C\u6496\uFFFE\u0010\uA281\u5493\uA291\u50C4\u50EC\uA292\uA293\u5191" + - "\u6491\uFFFE\u0004\uA294\u6497\u5697\uFFFE\t\uA298\u64A1\u64A0\uFFFE\u0006\uA2A1\u5C61\uA2A7" + - "\uA2A8\u649B\u649A\uA2A9\u649C\uA2AA\u6498\uA2AB\u649F\uA2AC\u649E\uA2AD\u649D\uA2AE\uA2AF\u5175" + - "\u5479\u539E\u5363\uFFFE\u0005\uA2B0\u548E\uFFFE\u0004\uA2B5\u64A2\uFFFE\u0013\uA2B9\u64A5\uA2CC" + - "\u64A4\uA2CD\u64A6\u4DF6\u6499\u64A3\uA2CE\u54EF\u554A\uFFFE\r\uA2CF\u64A8\uA2DC\uA2DD\u4D86" + - "\uFFFE\u0005\uA2DE\u599F\u64A7\uFFFE\u0006\uA2E3\u64A9\uA2E9\u64AC\u64AD\uA2EA\u5147\uA2EB\uA2EC" + - "\uA2ED\u64AE\uA2EE\uA2EF\uA2F0\u64AF\uA2F1\uA2F2\u64AB\uA2F3\u64B3\uFFFE\n\uA2F4\uA341\u64AA" + - "\uA342\u64B0\uFFFE\b\uA343\u64B4\u64B1\u64B2\uFFFE\u0010\uA34B\u64B6\uFFFE\u0017\uA35B\u64B5" + - "\uFFFE\t\uA372\u4D6F\uA37B\u68AB\uA37C\u68AC\uA37D\u53AF\u48E9\u54BE\uA37E\u577F\u0000\u0003" + - "\uA37F\u8182\u8384\u8586\u57CC\u65B0\uFFFE\u0004\uA387\u65B1\uA38B\u53BE\u4AC8\uFFFE\u0007\uA38C" + - "\u65B2\uFFFE\u0004\uA393\u5B88\uFFFE\b\uA397\u5F9A\uA39F\u65B3\uA3A0\u65B4\uA3A1\u65B5\uFFFE" + - "\u0004\uA3A2\u4CC9\u6050\u5596\uA3A6\u56EF\uA3A7\uA3A8\u559B\uFFFE\u0005\uA3A9\u559C\uA3AE\uA3AF" + - "\u5A63\u5646\uA3B0\u4CA5\u68AD\u4962\uA3B1\u6358\u56EE\u5A69\u4ED6\u558B\uA3B2\u4B88\uA3B3\u52CF" + - "\u4B8A\uA3B4\u67AD\u4E4D\uA3B5\uA3B6\u647E\uA3B7\u67AE\uFFFE\u0004\uA3B8\u4A49\uA3BC\uA3BD\u67B1" + - "\uA3BE\uA3BF\u67B0\u4F88\uA3C0\u67AF\u57B6\uFFFE\u0004\uA3C1\u536F\uFFFE\u0004\uA3C5\u5195\u5E6E" + - "\u67B2\u58F2\uFFFE\b\uA3C9\u51D3\u53E7\uA3D1\uA3D2\uA3D3\u4C4C\uFFFE\u0007\uA3D4\u67B3\uA3DB" + - "\u4A8C\uA3DC\uA3DD\uA3DE\u4E9C\u67B4\uFFFE\u0005\uA3DF\u647C\uA3E4\uA3E5\uA3E6\u67B5\uA3E7\uA3E8" + - "\u4F4E\uFFFE\u0004\uA3E9\u6983\uA3ED\uA3EE\uA3EF\u55E7\uA3F0\u59C8\u68D9\uA3F1\u68DA\uA3F2\u68DB" + - "\u5166\uA3F3\u4CEC\u4FCD\uA3F4\uA3F5\u68DD\uA3F6\u5351\u68DC\u5992\uA3F7\u68DF\u48CB\u4F8B\uFFFE" + - "\u0005\uA3F8\u59DE\u68DE\uA3FD\u4AAE\u4C89\u68E5\u68E4\u53A2\u68E0\u68E1\u4AC2\uA441\uA442\u68E2" + - "\u5B8F\uA443\uA444\u56DA\u4FD1\u4EB1\uA445\uA446\uA447\u68E7\u68E6\u68E3\u49A0\uA448\u5BA1\u5A58" + - "\u4FB6\u54AB\uA449\uA44A\u68E9\uFFFE\u0004\uA44B\u5998\uA44F\u5BCB\u4DDA\u68E8\uA450\u4BBA\uA451" + - "\uA452\u5754\uA453\uA454\u53A5\uA455\uA456\uA457\u5141\u68EA\u68ED\uA458\u68EC\u68EF\u68EB\uA459" + - "\u4E5E\u68EE\uFFFE\u0004\uA45A\u56B4\u68F1\uA45E\uA45F\u4A75\uFFFE\u0004\uA460\u4974\uA464\uA465" + - "\u68F2\uA466\uA467\u68F3\u68F5\u4AE0\uA468\u68F0\uA469\u68F6\uFFFE\u0004\uA46A\u68F9\uA46E\u68F7" + - "\uA46F\uA470\uA471\u68F4\uFFFE\u0004\uA472\u68FC\uA476\u68F8\u68FB\u68FD\uA477\u6941\uA478\uA479" + - "\uA47A\u57C0\u6944\uA47B\u6943\uA47C\u5197\u68FA\u55DC\uA47D\uA47E\u4AF0\u4992\u56B0\uA47F\u6946" + - "\uA481\uA482\u6947\uA483\uA484\u694C\u5B6E\u6949\uA485\uA486\u54B2\uA487\uA488\uA489\u6942\uA48A" + - "\u694B\u6948\u6945\uA48B\uA48C\u694A\uFFFE\b\uA48D\u48A8\u694D\uFFFE\u0006\uA495\u694F\uA49B" + - "\u6951\uFFFE\u0005\uA49C\u6950\uA4A1\u694E\uFFFE\u0004\uA4A2\u5942\uFFFE\u0007\uA4A6\u6952\uA4AD" + - "\uA4AE\uA4AF\u6953\uFFFE\b\uA4B0\u4D90\uA4B8\uA4B9\u4B67\uA4BA\u48D6\u48D8\uA4BB\uA4BC\uA4BD" + - "\u5AEC\uA4BE\u4B64\uA4BF\u4F74\u4E6A\u68A6\uA4C0\uA4C1\u4CDD\uA4C2\uA4C3\u68A7\uA4C4\uA4C5\u48A7" + - "\uA4C6\u68A8\uA4C7\uA4C8\u578F\uA4C9\uA4CA\u68A9\uFFFE\n\uA4CB\u68AA\uFFFE\t\uA4D5\u53A3" + - "\uA4DE\uA4DF\u5BE4\u6985\uA4E0\u6986\uFFFE\n\uA4E1\u5294\uA4EB\uA4EC\u5A7B\uA4ED\uA4EE\u5BD0" + - "\u5389\uA4EF\u5A4F\uA4F0\u59E5\uA4F1\uA4F2\u67C0\u48BA\u5B55\u596E\u4EDF\u4DCF\uA4F3\u5099\uA4F4" + - "\u4CC6\u4B61\u536C\uA4F5\uA4F6\u55A1\uA4F7\uA4F8\uA4F9\u526B\uFFFE\u0004\uA4FA\uA541\u67C1\uFFFE" + - "\b\uA542\u52BE\u4BA1\uA54A\u678D\u5244\uA54B\u5BB0\uA54C\uA54D\uA54E\u5881\u6790\uA54F\uA550" + - "\u536E\uA551\u4BDB\uA552\uA553\u55A0\uA554\uA555\u678E\uA556\uA557\u6791\u6792\u525C\uA558\u5054" + - "\uA559\u678F\uFFFE\u000B\uA55A\u6795\u6793\uFFFE\u0004\uA565\u5B87\u527F\uA569\u6794\uA56A\uA56B" + - "\uA56C\u6797\uA56D\u5B43\u5943\uA56E\uA56F\uA570\u6796\uA571\u5270\uFFFE\u0005\uA572\u6798\u5095" + - "\u4FEB\u6799\uA577\u56F6\uA578\u597B\uA579\uA57A\uA57B\u5C65\u5B97\uA57C\u679D\uA57D\uA57E\uA57F" + - "\u679C\uFFFE\b\uA581\u679A\u679B\uFFFE\b\uA589\u679E\u4FA5\uFFFE\u0005\uA591\u564F\u67A0" + - "\u4BBC\uA596\u67A1\u52BF\uA597\u679F\uA598\uA599\u4F7E\u49C6\uFFFE\f\uA59A\u4BC2\uA5A6\uA5A7" + - "\uA5A8\u67A4\u5CB9\u67A2\u67A5\uA5A9\uA5AA\uA5AB\u528A\u4A93\uFFFE\u0006\uA5AC\u67A6\u67A3\u5859" + - "\uA5B2\uA5B3\u67A7\u51F6\uFFFE\f\uA5B4\u67A8\u67A9\uA5C0\u5FAA\uA5C1\uA5C2\u53B2\uA5C3\u5466" + - "\uA5C4\u5BF4\u4B69\uA5C5\u5652\uA5C6\uA5C7\uA5C8\u67AA\uA5C9\uA5CA\u574B\uA5CB\u67AB\uFFFE\u0005" + - "\uA5CC\u5B50\uA5D1\u67AC\uA5D2\u6BC3\uFFFE\r\uA5D3\u5E67\uFFFE\t\uA5E0\u4AA2\uA5E9\uA5EA" + - "\uA5EB\u524C\u6987\uFFFE\u0005\uA5EC\u55B7\u59D2\uA5F1\u5BA9\uA5F2\u6893\uA5F3\u4FD7\uA5F4\u4F63" + - "\u6894\u4BCB\u48AA\uFFFE\u0004\uA5F5\u55AE\uA5F9\uA5FA\u6756\uA5FB\u6757\uA5FC\uA5FD\uA641\uA642" + - "\u57F8\u4C4F\u5094\u6758\u51EA\u5550\uFFFE\u0006\uA643\u6759\uA649\uA64A\u53F5\u5053\uA64B\uA64C" + - "\uA64D\u675C\u5399\uA64E\u5970\uA64F\u5C49\u675A\u675B\uA650\u5983\uA651\u675F\u6760\uA652\u6764" + - "\uA653\uA654\uA655\u6768\uA656\u6766\u676E\u5B89\uA657\u6769\uA658\uA659\u6767\u675E\uA65A\uA65B" + - "\u538A\uA65C\uA65D\uA65E\u53C5\uA65F\uA660\u558A\u5AD1\u6761\u6762\u6763\u6765\uA661\u50F8\uA662" + - "\u4AA0\uFFFE\u0004\uA663\u4D89\uA667\u6770\uFFFE\u0004\uA668\u6771\uA66C\u676A\uA66D\u676F\uA66E" + - "\u57F7\uA66F\uA670\u5656\u676C\u676D\uFFFE\u0005\uA671\u5896\uFFFE\n\uA676\uA681\uA682\u6772" + - "\u5193\u5A52\u676B\u54B6\uFFFE\b\uA683\u4EEE\uFFFE\u0004\uA68B\u5391\uFFFE\n\uA68F\u6776" + - "\uA699\u4B90\uA69A\uA69B\u51B4\u48AC\u568A\uA69C\uA69D\u494E\uA69E\u6774\uA69F\uA6A0\uA6A1\u578C" + - "\u4B83\uA6A2\u6775\u6773\u6777\uA6A3\uA6A4\u4B9B\uA6A5\u6778\uA6A6\u6779\uA6A7\u677C\uA6A8\u496C" + - "\uFFFE\b\uA6A9\u5397\u4EED\u677A\u56BB\u49E9\uFFFE\u0004\uA6B1\u677B\uFFFE\u0004\uA6B5\u52EA" + - "\uA6B9\uA6BA\u4AC4\uA6BB\uA6BC\uA6BD\u48F4\uA6BE\uA6BF\uA6C0\u677F\u50D9\u4AE7\uFFFE\u0004\uA6C1" + - "\u536D\uA6C5\uA6C6\uA6C7\u677D\u5064\uA6C8\uA6C9\uA6CA\u677E\uFFFE\u000E\uA6CB\u52A4\uA6D9\uA6DA" + - "\uA6DB\u6781\uFFFE\u0005\uA6DC\u6782\uA6E1\u6784\uA6E2\uA6E3\u5177\uA6E4\uA6E5\u4E67\uFFFE\u0006" + - "\uA6E6\u4F58\uA6EC\uA6ED\uA6EE\u6783\uFFFE\r\uA6EF\u6785\uA6FC\uA6FD\uFFFE\b\uA741\u6787" + - "\uFFFE\u0005\uA749\u6786\uFFFE\u000F\uA74E\u6788\uFFFE\u0005\uA75D\u55BD\u66E9\u50F0\uA762\u5588" + - "\uA763\u66EA\u53ED\uFFFE\u0004\uA764\u66EB\uA768\u53EC\u66EC\uFFFE\t\uA769\u66EF\uA772\uA773" + - "\u5C87\u66F2\uA774\uA775\u66F0\u66ED\u66EE\u5C43\u5592\u568F\u66F3\uA776\u66F1\uA777\uA778\u588A" + - "\uA779\u66F5\u53B0\uFFFE\u0004\uA77A\u4EBF\uA77E\u66F4\u0000\u0003\uA77F\u8182\u8384\u8586\u4B5B" + - "\u4E97\uA787\u66F6\uFFFE\u0005\uA788\u5D98\u4F9C\uA78D\uA78E\u51BA\u66F7\uFFFE\u0004\uA78F\u66F8" + - "\uFFFE\u0004\uA793\u4CA2\uFFFE\n\uA797\u66F9\uFFFE\f\uA7A1\u66FA\uFFFE\u000B\uA7AD\u66FB" + - "\uFFFE\u0005\uA7B8\u5A8E\u5CAD\u50EA\uA7BD\u547D\u4DCB\uA7BE\u58E2\u565D\uA7BF\u575A\uA7C0\uA7C1" + - "\u4CD0\uA7C2\uA7C3\u499D\uA7C4\u5490\uA7C5\u5BD5\uA7C6\uA7C7\uA7C8\u5066\u528C\uA7C9\uA7CA\u6896" + - "\uA7CB\uA7CC\u5278\uFFFE\u0006\uA7CD\u5C83\uA7D3\uA7D4\uA7D5\u6898\u4A73\uA7D6\u5478\u598E\uA7D7" + - "\u5BC7\uA7D8\u6899\uA7D9\u6897\uA7DA\u4E9E\u4A66\uFFFE\u0007\uA7DB\u4F75\uA7E2\uA7E3\u59C5\uA7E4" + - "\u4E81\uA7E5\uA7E6\u5841\uA7E7\u689D\u689C\uA7E8\uA7E9\u689A\uFFFE\u0004\uA7EA\u4A6C\uA7EE\u5574" + - "\u5650\uFFFE\u0005\uA7EF\u689F\uA7F4\uA7F5\u48DD\uA7F6\uA7F7\u5BC8\uA7F8\uA7F9\uA7FA\u689E\uA7FB" + - "\u4A8E\uA7FC\uA7FD\u6BD4\uFFFE\u000F\uA841\u57C7\uA850\uA851\uA852\u68A1\uA853\u68A0\uA854\u4B5E" + - "\u4ED9\u4E9D\uA855\u4CE4\uFFFE\u0006\uA856\u52C1\uFFFE\n\uA85C\u68A2\uFFFE\u0005\uA866\u568C" + - "\uFFFE\u0015\uA86B\uA881\uA882\uA883\u68A5\uA884\uA885\uA886\u5948\uA887\u4FBE\u548F\u6956\u6957" + - "\u5075\uFFFE\u0004\uA888\u4AA8\u6958\u575B\uA88C\u5474\u5B4D\uA88D\u6959\uA88E\u695A\uFFFE\u0004" + - "\uA88F\u546F\uA893\uA894\uA895\u59A3\u5BCE\uA896\uA897\u695B\u4F71\u4AAF\u4FBC\uA898\uA899\uA89A" + - "\u4ADB\u57D0\uA89B\u507F\u695D\uFFFE\u0004\uA89C\u509B\u695C\uA8A0\u695F\uA8A1\uA8A2\uA8A3\u695E" + - "\u6960\uFFFE\u0005\uA8A4\u6961\uFFFE\u000B\uA8A9\u519F\uFFFE\u000B\uA8B4\u5142\uFFFE\n\uA8BF" + - "\u55F9\uA8C9\uA8CA\u5B5E\uFFFE\u0004\uA8CB\u4FB9\u4FB8\u5B62\uA8CF\uA8D0\u5042\uA8D1\u574F\u6955" + - "\uFFFE\u0006\uA8D2\u4F7F\uA8D8\u4BCA\uFFFE\t\uA8D9\u5BF0\u6A63\uA8E2\uA8E3\u6A64\uA8E4\u4CCC" + - "\uA8E5\uA8E6\uA8E7\u6A66\u6A67\uA8E8\u48C9\uA8E9\u6A65\uA8EA\u6A69\u5692\uA8EB\uA8EC\uA8ED\u6A6B" + - "\uA8EE\u58A5\uA8EF\uA8F0\u496A\u6A68\uA8F1\uA8F2\uA8F3\u6A6F\uA8F4\u4B71\uA8F5\uA8F6\u6A77\uA8F7" + - "\u6A72\uA8F8\uA8F9\uA8FA\u6A74\u6A73\u4C9C\uA8FB\u495F\uA8FC\u6A6E\u6A6A\u4B7A\uA8FD\u6A70\uA941" + - "\uA942\u6A71\uA943\u6A75\uFFFE\u0004\uA944\u6A6D\uA948\u4EE2\uA949\u519E\uA94A\u6A76\uFFFE\u0006" + - "\uA94B\u6A7A\uA951\u6A6C\uA952\u4B68\uA953\u4F8F\u6A7C\uA954\uA955\u4C44\u5091\u5BFD\u5752\uA956" + - "\u4AEF\uA957\u49DE\uA958\u6A78\uA959\u6A79\u5558\uA95A\u6A7D\uA95B\uA95C\u6A7E\uA95D\u6A82\uFFFE" + - "\u000B\uA95E\u6A7F\uA969\uA96A\u6A84\u6A83\uA96B\uA96C\u6A7B\uA96D\u508B\uA96E\u4A90\uA96F\u6A81" + - "\uA970\uA971\u5449\uA972\u4EF1\uFFFE\u0004\uA973\u6A8C\uFFFE\u0007\uA977\u4D5F\uA97E\uA97F\u6A85" + - "\uA981\uA982\uA983\u49AC\u4E9F\uA984\u5684\uFFFE\u0004\uA985\u6A8E\u6A8A\uA989\uA98A\uA98B\u4D7C" + - "\u6A8F\uA98C\uA98D\uA98E\u6A86\u6A87\u6A8B\u51E0\u6A8D\u6A90\u6A89\u4EFC\uA98F\uA990\uA991\u5885" + - "\uA992\uA993\u6A91\uA994\uA995\uA996\u6A88\uFFFE\b\uA997\u6A93\uFFFE\u0004\uA99F\u5C4D\u53A9" + - "\uFFFE\u0004\uA9A3\u6A94\uFFFE\u0004\uA9A7\u6A92\uA9AB\u51A7\uFFFE\u0005\uA9AC\u4CDC\u6A96\uA9B1" + - "\uA9B2\u6A95\uA9B3\uA9B4\uA9B5\u4ADA\uA9B6\uA9B7\uA9B8\u6A97\u6A98\uA9B9\uA9BA\uA9BB\u6A99\uA9BC" + - "\uA9BD\uA9BE\u50B9\uA9BF\uA9C0\u50E8\uFFFE\u0005\uA9C1\u5392\uFFFE\u0004\uA9C6\u6A9C\uA9CA\u6A9B" + - "\uFFFE\b\uA9CB\u4AD7\uA9D3\uA9D4\uA9D5\u6A9F\u6A9A\uA9D6\uA9D7\u6A9D\uFFFE\u0006\uA9D8\u6A9E" + - "\uFFFE\b\uA9DE\u6AA0\uFFFE\u0006\uA9E6\u6AA2\u4E69\uA9EC\uA9ED\u6AA1\uFFFE\r\uA9EE\u6AA3" + - "\uA9FB\uA9FC\uA9FD\uAA41\uAA42\uAA43\u49BD\u6AA5\u6AA4\uFFFE\u000B\uAA44\u4EAD\uFFFE\u0025\uAA4F" + - "\u5277\u5D82\uFFFE\u0006\uAA74\u50DF\u6ACB\u5C71\uFFFE\u0006\uAA7A\uFFFE\u0005\uAA81\u4C7B\uFFFE" + - "\u0007\uAA86\u6ACD\u5143\uAA8D\uAA8E\u53C8\uAA8F\u4AD5\u5B53\uAA90\uAA91\uAA92\u6ACF\u6ACE\u6AD0" + - "\u567A\uAA93\uAA94\u6AD1\uAA95\u5AC0\u5BDF\uFFFE\u0004\uAA96\u4C81\uAA9A\uAA9B\uAA9C\u5158\uAA9D" + - "\uAA9E\u515B\u6AD2\u4FAB\uFFFE\u0005\uAA9F\u4AE1\uAAA4\uAAA5\u6AD3\u6AD4\u4FAA\uAAA6\uAAA7\u6AD5" + - "\uAAA8\uAAA9\uAAAA\u6ADA\uAAAB\u6AD6\u6AD9\uAAAC\u4DFC\uAAAD\u6AD7\u6AD8\uFFFE\u0007\uAAAE\u4CE1" + - "\u56C6\u6ADB\uAAB5\u49D9\uAAB6\uAAB7\u5273\uAAB8\uAAB9\u5AE2\u5057\uFFFE\u0007\uAABA\u6ADC\uFFFE" + - "\u0006\uAAC1\u5354\uFFFE\b\uAAC7\u6AE8\uAACF\uAAD0\u5855\uFFFE\u000E\uAAD1\u57C8\uFFFE\u0015" + - "\uAADF\u5678\uAAF4\u5698\uFFFE\u0004\uAAF5\u4F95\uAAF9\uAAFA\uAAFB\u5C6F\uAAFC\uAAFD\uAB41\u50DA" + - "\uFFFE\u003E\uAB42\u58F4\uFFFE\b\uAB81\u6AE9\uFFFE\u002E\uAB89\u6AEA\uFFFE\u0007\uABB7\u6AEB" + - "\uFFFE\u0040\uABBE\uFFFE\u003F\uAC41\uFFFE\r\uAC81\u6C84\uFFFE\u0005\uAC8E\u4C51\uFFFE\u0005" + - "\uAC93\u6AEC\uFFFE\u003A\uAC98\u5C8C\uFFFE\u0018\uACD2\u6AED\uACEA\uACEB\uACEC\u63F8\u4FBF\u63F9" + - "\u4DEB\u63FA\u586B\u63FB\u5ABB\u4EB5\u63FC\u63FD\u4ECC\u54D1\u57B2\u6441\uACED\u4ABE\u6442\u5554" + - "\u4CD8\u52C8\uACEE\u5C7D\u51D9\u4C77\u5BBC\u57C5\u4C64\uACEF\uACF0\u5346\u6443\u587F\u6444\u6445" + - "\u6446\u5157\u5C8A\u5591\u5858\u5BAE\u5BD4\u6447\u48EC\u6448\u6449\u557C\u59EE\u4FAC\u644A\u48F2" + - "\u54DD\u4F82\u644B\u54C5\uACF1\u644C\u4E87\u4CF7\u5944\u644D\u51E6\u4FF7\u4F6A\u5753\u644E\u644F" + - "\u4FED\u58E4\uACF2\u5688\u56CF\u4ECB\u6450\u4EA7\u58F6\u6451\uACF3\u58F7\u6452\u6453\u4AC1\u6454" + - "\u6455\u559F\u57AB\u5281\u6457\u4961\u4A92\uACF4\u6458\u6459\u5C7B\u5B60\u645A\u51CB\u5C5A\u645B" + - "\u645C\u645D\u4EE9\u5286\u50C1\u645E\u645F\u4EA8\uACF5\u6460\u6461\u6456\u4BCF\u6462\uACF6\u6463" + - "\u6464\u4E5A\u4B7E\u51C5\u4981\u6465\u5AB4\u6466\u4CBE\u6468\u6467\u4C8D\uACF7\u6469\u49F7\uFFFE" + - "\u0007\u646A\u5A47\u5696\uFFFE\u0004\u6471\u5569\uFFFE\u0005\u6475\u4F69\u647A\u6A5E\uACF8\u4CD6" + - "\uACF9\u54B0\uFFFE\u0004\uACFA\uAD41\uAD42\uAD43\u6A5F\uAD44\u6A60\u6A61\uFFFE\n\uAD45\u4D7E" + - "\u5799\uAD4F\uAD50\u5CE7\u4DB0\uAD51\u51DD\u67B6\uAD52\u4C43\uFFFE\u0004\uAD53\u67B8\uAD57\u67B7" + - "\u48D4\uFFFE\u0005\uAD58\u67BA\u5B76\u5C90\uAD5D\uAD5E\uAD5F\u5BC2\uAD60\uAD61\u67BC\u55EF\uAD62" + - "\u67BB\uFFFE\u0004\uAD63\u67BD\uFFFE\u0004\uAD67\u67BF\uAD6B\uAD6C\u67BE\uFFFE\b\uAD6D\u5993" + - "\uAD75\u545C\uAD76\u5260\uFFFE\u0005\uAD77\u4CE0\uFFFE\u0004\uAD7C\uAD81\u5188\uAD82\uAD83\u6AC5" + - "\u58DE\u6AC6\uAD84\u587B\uAD85\uAD86\u54B9\uAD87\uAD88\u6AC7\uFFFE\u0007\uAD89\u6AC8\u6AC9\uAD90" + - "\u6ACA\uFFFE\u0005\uAD91\u5D9B\u4CFD\uAD96\uAD97\u6392\u5A91\uAD98\u6ADF\uAD99\u57CB\uAD9A\uAD9B" + - "\uAD9C\u4A82\uFFFE\u0004\uAD9D\u6954\uADA1\u59ED\uADA2\u6AE0\uFFFE\u0005\uADA3\u5889\u6AE1\uADA8" + - "\uADA9\u546C\uFFFE\u0006\uADAA\u4B74\u4AE3\u6AE3\uADB0\uADB1\uADB2\u6AE2\u6AE4\uADB3\uADB4\u6AE5" + - "\uFFFE\u0004\uADB5\u6AE6\uADB9\u4DB1\u48BE\uADBA\u6AE7\uFFFE\u0007\uADBB\u4C4D\u59EC\uADC2\uADC3" + - "\uADC4\u59AA\u50CE\uADC5\u505C\u6643\u5B7F\u65C7\uFFFE\u0004\uADC6\u6994\u4BF7\u5643\uADCA\uADCB" + - "\u52CC\uADCC\u6988\uADCD\u6989\u4CFA\u698A\u4DC3\u5AC4\u48D1\uADCE\uADCF\u698B\uADD0\uADD1\uADD2" + - "\u698C\uADD3\u698D\uADD4\uADD5\u698E\u698F\u6990\u6992\u6991\u5375\uFFFE\u0006\uADD6\u6993\uADDC" + - "\u4BF9\uADDD\u6995\u59AD\u5FC6\u566A\uADDE\uADDF\u4A7C\uADE0\u4B42\uADE1\u4D42\uADE2\uADE3\u52F3" + - "\u6996\uADE4\uADE5\u6997\uADE6\uADE7\uADE8\u5164\u519C\u5BAF\u6998\uFFFE\u0004\uADE9\u6999\uADED" + - "\u514A\uADEE\uADEF\uADF0\u53B7\uADF1\u4FDA\uFFFE\f\uADF2\uAE41\uAE42\u699A\u4ACE\uFFFE\u0006" + - "\uAE43\u699B\uFFFE\r\uAE49\u6752\u6751\uAE56\uAE57\u5681\u59DD\uAE58\u5661\u5B78\uAE59\u54E1" + - "\uAE5A\u50DE\u4EA0\uFFFE\u0006\uAE5B\u6661\uAE61\uAE62\u58A3\uAE63\u5BE1\uAE64\u4BC6\u4CD7\u6660" + - "\u4CCD\uAE65\u665F\u4A46\u4D69\u5BAA\uAE66\u4C95\u4C6A\uAE67\uAE68\uAE69\u4EE6\u4C5E\u6666\uAE6A" + - "\u6667\u48B8\u506F\uAE6B\u6665\u5A9E\uAE6C\u6668\uAE6D\uAE6E\u6669\uAE6F\uAE70\u4C6E\uAE71\u6662" + - "\u6664\u5597\u5BD6\u5B6D\u58B1\u666F\u57B7\u6670\uAE72\u4B48\uFFFE\u0005\uAE73\u4953\u6672\u56A4" + - "\uFFFE\u0007\uAE78\u5376\u6673\uAE7F\u6671\u537F\u666E\u55A3\u6675\u48FA\uAE81\uAE82\u4DF9\uAE83" + - "\uAE84\u5CB6\u6984\uAE85\uFFFE\u0004\u666A\u6676\u63BF\u6679\uAE86\u5089\u59C7\u6677\u667C\u4CEB" + - "\u6678\uAE87\u4F5A\uAE88\u58D7\uAE89\u48B6\uAE8A\u667D\u52DB\uFFFE\u0004\uAE8B\u5BAB\uAE8F\uAE90" + - "\uAE91\u4ADF\uAE92\uAE93\u51F5\u4EB8\uAE94\uAE95\u667A\u667B\u5ADF\u53E9\u52D3\u667F\u5347\u5D96" + - "\uAE96\u49B0\uAE97\u6685\uAE98\u4F65\uAE99\uAE9A\uAE9B\u6683\uFFFE\r\uAE9C\u6684\uAEA9\uAEAA" + - "\u4CAB\uAEAB\u5771\u6686\uAEAC\uAEAD\uAEAE\u6682\uAEAF\u5153\uFFFE\u0005\uAEB0\u53A1\uFFFE\u0007" + - "\uAEB5\u56F2\uAEBC\u6687\uAEBD\u50AF\u59B7\u6688\uAEBE\uAEBF\uAEC0\u4CAE\u4CAC\uAEC1\u6689\u545B" + - "\u5794\uAEC2\uAEC3\uAEC4\u668B\u668C\uFFFE\u0005\uAEC5\u668E\uFFFE\u0004\uAECA\u58C7\uAECE\u6693" + - "\uAECF\u668F\uAED0\uAED1\uAED2\u6692\u54F8\uAED3\u599D\u668D\uAED4\uAED5\u668A\uFFFE\u0004\uAED6" + - "\u4CB8\u5879\u52E4\u6690\u6691\u56D9\u5768\u48F1\uAEDA\u6697\uFFFE\u0005\uAEDB\u6696\uAEE0\u49B1" + - "\uFFFE\u0004\uAEE1\u4CDF\uAEE5\u6698\uFFFE\u0006\uAEE6\u498D\uAEEC\uAEED\u56C4\u52A3\u5845\uFFFE" + - "\u0005\uAEEE\u669A\uAEF3\uAEF4\u66A1\uAEF5\u5393\uAEF6\u669B\uFFFE\u0007\uAEF7\uAF41\u5565\uFFFE" + - "\u0006\uAF42\u61DE\u669F\uFFFE\u0004\uAF48\u576E\u66A0\u497B\u5A57\uAF4C\uAF4D\u59DB\uAF4E\uAF4F" + - "\uAF50\u669E\uAF51\u669C\uFFFE\u0016\uAF52\u4A5C\uAF68\uAF69\uAF6A\u65AF\uAF6B\uAF6C\u5C74\uAF6D" + - "\u6AAA\u4A95\uFFFE\u0005\uAF6E\u5BC0\u5BC1\uFFFE\u0006\uAF73\u5B8A\u4FC9\uAF79\u6AA6\uAF7A\u59A7" + - "\u6AA7\u6AA8\uAF7B\u6AA9\u4FCA\u5A7F\uFFFE\u0004\uAF7C\uAF81\u5581\u5582\uAF82\uAF83\u6A62\uAF84" + - "\u55E5\uAF85\u56F1\uFFFE\u0006\uAF86\u61B5\u5654\uAF8C\u57E7\u5BDA\uAF8D\u6AAC\u6AAD\u6AAE\uFFFE" + - "\u0004\uAF8E\u6AB1\uAF92\u4DBC\u6AB2\u48E2\u6AAF\uAF93\u6AB0\u4F42\u49D4\uAF94\u6AB5\u6AB6\u4BE5" + - "\u49AF\u586F\u6AB3\u4AAB\uAF95\u6AB4\uAF96\uAF97\u6AB7\uFFFE\u0005\uAF98\u6AB8\uAF9D\uAF9E\u5747" + - "\uAF9F\u6AB9\uAFA0\u6ABA\uAFA1\uAFA2\uAFA3\u6ABB\uFFFE\b\uAFA4\u5672\uAFAC\u6ABC\uFFFE\u0004" + - "\uAFAD\u6ABD\uFFFE\b\uAFB1\u6ABE\uFFFE\u0005\uAFB9\u6ADD\u515C\u4EE7\uAFBE\u554B\u597E\u6396" + - "\uFFFE\u0004\uAFBF\u5EB2\u59D4\uAFC3\uAFC4\u5EB3\u48AB\u5EB4\uAFC5\uAFC6\u4F7A\uAFC7\u5EB8\uAFC8" + - "\uAFC9\uAFCA\u5CC1\uAFCB\u5EB6\u5A94\uAFCC\u5576\u5EB9\u5EB5\uAFCD\u5EBA\u5242\uFFFE\u0004\uAFCE" + - "\u5EBB\u5EC4\u5EBC\uAFD2\uAFD3\u57DE\u5BA4\uAFD4\u5ECE\uAFD5\u5ECC\uAFD6\uAFD7\u5ED1\u4F87\u51AA" + - "\uAFD8\u5EB7\u5ECA\u5ECD\u5EBD\u4C72\u48C4\u5EC6\u58BD\u5EC0\u4E48\uAFD9\u4C5C\u5ECB\uAFDA\uAFDB" + - "\u5EC5\u5EBE\u547B\uAFDC\uAFDD\uAFDE\u595F\u5EBF\uAFDF\uAFE0\u5EC9\uAFE1\uAFE2\u5ECF\uAFE3\uAFE4" + - "\u57AC\u5EC1\uAFE5\u5EC2\u5EC7\u5EC8\u49D3\u5ED0\u5675\uAFE6\u5AB6\u5EDA\u5EDE\u56A5\u5EE5\uAFE7" + - "\u5288\u5EDB\uAFE8\uAFE9\u5061\u5ED8\uAFEA\u48F9\u4D56\u5EE4\u5ED2\uAFEB\u5EC3\u5ED5\u54F3\u5081" + - "\uFFFE\u0004\uAFEC\u555B\uAFF0\uAFF1\uAFF2\u495D\uAFF3\u5A42\uAFF4\uAFF5\u5ED9\uAFF6\uAFF7\u5ED4" + - "\uAFF8\u53BA\uAFF9\u5EDD\uFFFE\u0004\uAFFA\uB041\u5C62\u524F\u4C56\u5471\u5249\u5EE1\u5ED7\u5EEA" + - "\u5ED3\uB042\uB043\u5EDC\uB044\u4FA4\u5ED6\uB045\u5EDF\uB046\uB047\u5EE2\u5EE3\uB048\u5EF7\uB049" + - "\uB04A\u5EE0\u5F42\u5EE6\uFFFE\n\uB04B\u4EEA\u4AC3\uB055\uB056\u5243\u49E6\u5EF9\uB057\u5EF1" + - "\uB058\u5EEE\uB059\u5EFB\u5EED\u59EF\u49E7\uB05A\u54D6\u54E2\u5EFA\uB05B\u5EEC\uB05C\uB05D\uB05E" + - "\u5EF6\uB05F\uB060\u5EF4\uB061\uB062\u4FA2\u5EF3\uB063\u49DC\uFFFE\u0005\uB064\u5EF2\u4EF5\u5EE7" + - "\u4E64\uB069\u50F2\uFFFE\u0005\uB06A\u4ED3\u5EE8\u5EE9\uB06F\u5EF0\u5EF5\u5EF8\u4B54\uB070\u54D8" + - "\u4E88\u5EFD\u5EFC\u5A4B\u5F41\u5F43\u5F45\u59F0\u5F44\u5F46\u5F47\u59A8\uFFFE\u0007\uB071\u4DC8" + - "\u5F49\uB078\uB079\u5F56\u5F51\u5F54\uFFFE\u0006\uB07A\uB081\u5F50\u53CD\uB082\uB083\u50F1\uFFFE" + - "\u0004\uB084\u554F\uB088\uB089\uB08A\u5EEB\u5F4E\uFFFE\u0004\uB08B\u5F57\uB08F\uB090\u5EEF\u5F4F" + - "\uB091\u5F58\uB092\u5F4C\uFFFE\u0007\uB093\u5F59\u5F53\u5F4D\u52A9\uFFFE\u0004\uB09A\u5F48\u50B2" + - "\u514B\u5F4A\u5F4B\uB09E\u5F52\u4E92\u5F55\u5A48\u5F5A\uB09F\u5F5B\u5247\uB0A0\uB0A1\u5F72\u5F5C" + - "\uB0A2\uB0A3\uB0A4\u5F71\uB0A5\u4D5D\uB0A6\uB0A7\u4FD4\uB0A8\u4FF9\uB0A9\uB0AA\u4DC9\uFFFE\u0004" + - "\uB0AB\u5F6A\uB0AF\u5F65\uB0B0\u5F5F\uB0B1\uB0B2\uB0B3\u49CA\u5F63\uB0B4\u5F6B\u49A3\u5F75\uB0B5" + - "\uB0B6\uB0B7\u5F5E\uB0B8\uB0B9\uB0BA\u53CF\u5F70\uFFFE\u0005\uB0BB\u5F74\u5183\u4C66\uFFFE\u0005" + - "\uB0C0\u5F6E\u5F6F\uB0C5\uB0C6\uB0C7\u5F64\uB0C8\uB0C9\uB0CA\u5F5D\uB0CB\u5F6D\u56D0\uB0CC\u5F69" + - "\uFFFE\u0004\uB0CD\u5F62\u5268\u53BB\u57AD\u5F6C\uB0D1\u5F68\uFFFE\u0006\uB0D2\u5F61\uB0D8\uB0D9" + - "\uB0DA\u5F66\u51DB\uFFFE\u0006\uB0DB\u5A49\u5A4A\u5F73\u5895\u54F7\uFFFE\b\uB0E1\u5F87\uFFFE" + - "\u0006\uB0E9\u5F67\uB0EF\uB0F0\uB0F1\u5F81\u51E3\uFFFE\b\uB0F2\u5F82\uFFFE\u0004\uB0FA\uFFFE" + - "\u0006\uB141\u5F77\uFFFE\u0005\uB147\u5BF7\uB14C\u5F79\u5F78\u4CEF\u5F76\uFFFE\u0004\uB14D\u53CE" + - "\uB151\u4BAC\uFFFE\u0005\uB152\u5F83\uB157\u4DF8\u5AE0\u5F88\uB158\uB159\uB15A\u4ACF\uB15B\u5F7A" + - "\uB15C\u509C\u5F84\uB15D\u5F7F\uB15E\u5F7D\uFFFE\u0007\uB15F\u4B79\uFFFE\u0004\uB166\u5F7B\u5F7C" + - "\u5F7E\uB16A\u4F4F\u5F85\uB16B\u5F86\uFFFE\b\uB16C\u5F96\uB174\u5269\uB175\uB176\u5683\uFFFE" + - "\u0004\uB177\u5F93\uFFFE\u0005\uB17B\uFFFE\b\uB181\u5CE0\uB189\uB18A\u53D0\uB18B\u5F95\uB18C" + - "\uB18D\uB18E\u5B95\u5F94\u5F91\uB18F\uB190\u5F8D\uB191\u5F90\uB192\u5F89\uB193\uB194\u58ED\uFFFE" + - "\u0004\uB195\u54D7\u5F8F\uB199\uB19A\u5F8A\uB19B\uB19C\u5F8B\u5693\uB19D\u5F8E\uB19E\uB19F\u496D" + - "\uFFFE\u0006\uB1A0\u50B5\uB1A6\u4EBA\u5F92\uB1A7\uB1A8\u5F98\uB1A9\u5F97\u5F8C\uFFFE\u0005\uB1AA" + - "\u538F\uB1AF\uB1B0\uB1B1\u5F9C\uFFFE\u000B\uB1B2\u5FA3\uB1BD\uB1BE\u5FA2\uFFFE\f\uB1BF\u5F99" + - "\uFFFE\u0004\uB1CB\u5290\uB1CF\u51FA\uB1D0\uB1D1\uB1D2\u5B82\uB1D3\uB1D4\u57B4\uFFFE\u0004\uB1D5" + - "\u5F9E\uB1D9\u49CB\uFFFE\t\uB1DA\u52E7\u55DE\uFFFE\n\uB1E3\u545E\u5F9B\u5F9D\u5F9F\u5FA1" + - "\u48A9\u496E\uFFFE\u0005\uB1ED\u5FAB\uFFFE\u0004\uB1F2\u5FA5\u4F56\u54EE\uFFFE\b\uB1F6\uB241" + - "\uB242\uB243\u5FA0\uB244\uB245\u5FA4\uFFFE\u0004\uB246\u5FA8\uFFFE\u0005\uB24A\u5FA7\uB24F\uB250" + - "\uB251\u5FA6\uFFFE\t\uB252\u5FAC\uB25B\u5ACB\uFFFE\u0004\uB25C\u5FB2\u5FA9\u5FAD\uB260\uB261" + - "\u50D8\uFFFE\u0005\uB262\u4941\u5FB5\uB267\u5FB0\uFFFE\u0007\uB268\u5FB1\uFFFE\u000B\uB26F\u5946" + - "\u5FB4\uFFFE\u0006\uB27A\uB281\u5FAE\uB282\uB283\uB284\u5FAF\uB285\u58BC\uB286\uB287\uB288\u5FB3" + - "\u55EC\u5FB8\uFFFE\u0006\uB289\u5FB7\uB28F\u5FB6\uFFFE\u0007\uB290\u5FBA\uFFFE\u0007\uB297\u4F86" + - "\uFFFE\u0005\uB29E\u49D7\u528B\uB2A3\uB2A4\u5FB9\uB2A5\u535A\uFFFE\u0006\uB2A6\u5FBB\uFFFE\u0007" + - "\uB2AC\u56D8\uFFFE\u0004\uB2B3\u4C4A\uFFFE\u0011\uB2B7\u5AE4\uB2C8\uB2C9\uB2CA\u5FBC\uFFFE\u0005" + - "\uB2CB\u5FBE\uFFFE\u000B\uB2D0\u52A1\uFFFE\u0004\uB2DB\u5FC0\uFFFE\u0010\uB2DF\u5FBD\uB2EF\u5FBF" + - "\uFFFE\u000E\uB2F0\u5B5A\uB341\uB342\uB343\u5FC1\uFFFE\u0010\uB344\u69AD\u4E42\u51B1\u5350\u51C6" + - "\uB354\uB355\u69AE\uFFFE\u0005\uB356\u58E8\uB35B\uB35C\uB35D\u5A7D\uB35E\uB35F\uB360\u665D\uFFFE" + - "\b\uB361\u4A87\u69AF\uB369\u69B0\uB36A\uB36B\u55AC\uFFFE\u0007\uB36C\u4DE6\u69B2\u69B4\u69B3" + - "\u5685\u585A\u69B1\u55B3\u59CE\u51EB\uFFFE\u0007\uB373\u57C2\u69B7\u48F5\u69B6\uFFFE\u0005\uB37A" + - "\u69BD\uB37F\u49CE\uFFFE\u0006\uB381\u5961\u69B9\uFFFE\u0005\uB387\u69BB\u5AE8\uB38C\uB38D\u69BA" + - "\u69B5\u69BE\u69BC\uB38E\u69B8\uB38F\uB390\u69C6\u69C3\u69C5\uB391\uB392\u69C9\u69C1\u69BF\uB393" + - "\uB394\uB395\u69C4\uFFFE\u0005\uB396\u5BFA\uB39B\uB39C\uB39D\u69C0\uB39E\u549A\u557F\uB39F\u69C7" + - "\u4D66\u4B50\uB3A0\uB3A1\u69C2\u69C8\u69CF\u69D5\uB3A2\uB3A3\u4E77\uB3A4\uB3A5\uB3A6\u69D4\u577C" + - "\uB3A7\u5BEA\uB3A8\uB3A9\u69D1\u69D3\uFFFE\u0004\uB3AA\u4CF1\uFFFE\u0004\uB3AE\u69CA\uB3B2\uB3B3" + - "\uB3B4\u69CD\u51F8\uB3B5\u5B7D\u69CB\u69CC\u69CE\u69D2\uB3B6\uB3B7\uB3B8\u69D8\u5A5C\uFFFE\u0004" + - "\uB3B9\u4BE9\uB3BD\u55F0\uB3BE\u4C85\u69D6\uB3BF\uB3C0\uB3C1\u69D7\u69D9\u69DC\u69DA\uB3C2\uB3C3" + - "\u69DB\uFFFE\u0004\uB3C4\u5971\u69D0\uB3C8\u5769\uB3C9\u57CE\u5BA8\uB3CA\u69E2\uB3CB\u527B\uB3CC" + - "\u69DF\uB3CD\uB3CE\u50AE\u69EB\u69DD\uB3CF\u69E0\uB3D0\uB3D1\uB3D2\u69E7\uFFFE\u0004\uB3D3\u69E1" + - "\uB3D7\uB3D8\u69E6\uB3D9\uB3DA\u69E5\uB3DB\uB3DC\u69E8\uB3DD\uB3DE\uB3DF\u69DE\uB3E0\uB3E1\u69E3" + - "\u69E9\uFFFE\u0007\uB3E2\u5A4C\u69E4\u49F4\uB3E9\uB3EA\u69F1\uB3EB\u58AA\uFFFE\u0004\uB3EC\u69F4" + - "\uB3F0\uB3F1\uB3F2\u4E68\uB3F3\u69F8\uFFFE\u0006\uB3F4\u69EF\uB3FA\uB3FB\u69F5\u69F7\u69F9\uB3FC" + - "\uB3FD\uFFFE\u0006\uB441\u69F2\uB447\u69F0\uB448\uB449\uB44A\u4DFA\uB44B\u4B9C\uFFFE\u0004\uB44C" + - "\u69EE\u69F6\u69EC\u69ED\uB450\uB451\uB452\u69EA\u6A46\uB453\u6A43\uB454\uB455\u6A42\uB456\uB457" + - "\u69F3\uB458\u54D9\uFFFE\u0005\uB459\u69FA\uB45E\uB45F\uB460\u6A45\uFFFE\u0007\uB461\u5299\uFFFE" + - "\b\uB468\u69FC\uB470\uB471\u6A47\u6A49\u6A44\uB472\u69FB\uB473\uB474\uB475\u6A4B\uB476\u6A4A" + - "\uFFFE\u0004\uB477\u51DC\uB47B\uB47C\u6A4E\uB47D\uB47E\u6A50\uB47F\uFFFE\u0004\uB481\u6A41\uB485" + - "\uB486\uB487\u6A51\u6A4C\uFFFE\u0005\uB488\u6A4F\u69FD\u6A4D\uFFFE\u0007\uB48D\u6A52\uFFFE\u0004" + - "\uB494\u6A54\uFFFE\u0004\uB498\u6A48\uFFFE\u0004\uB49C\u6A53\uB4A0\uB4A1\uB4A2\u6A55\uFFFE\n" + - "\uB4A3\u58B6\uFFFE\u0004\uB4AD\u6A58\uFFFE\u0004\uB4B1\u5D9A\uFFFE\u0006\uB4B5\u6A59\uFFFE\b" + - "\uB4BB\u6A57\uB4C3\u54E3\u6A56\uFFFE\u0004\uB4C4\u6A5A\uFFFE\u0005\uB4C8\u6A5B\u4ABF\uFFFE\u000F" + - "\uB4CD\u67C2\uFFFE\u0006\uB4DC\u6A5C\uB4E2\uB4E3\u6A5D\uB4E4\uB4E5\uB4E6\u594A\uB4E7\uB4E8\uB4E9" + - "\u6AAB\u58C5\uFFFE\u0006\uB4EA\u58CF\u597C\uFFFE\u0006\uB4F0\u586E\uB4F6\uB4F7\u4F76\uB4F8\u5963" + - "\uFFFE\u0005\uB4F9\uB541\uB542\u4DE1\u618A\u59C1\u6962\u49B8\uB543\uB544\u498E\u6963\uB545\u5560" + - "\u4A64\uB546\u5D93\uB547\u5645\uB548\u6964\uFFFE\u0004\uB549\u5BD3\uFFFE\u0005\uB54D\u6965\u6ABF" + - "\u6966\uB552\u5AAB\u6967\uB553\u48BF\u6AC0\uB554\uB555\u6AC1\uB556\uB557\u4AFB\uB558\u537B\uFFFE" + - "\u0004\uB559\u56BA\uB55D\uB55E\uB55F\u58E3\uFFFE\u0005\uB560\u5781\uFFFE\u0005\uB565\u6968\uB56A" + - "\u5D94\uFFFE\u0006\uB56B\u495B\uB571\u584E\uB572\uB573\uB574\u4CA3\uFFFE\u0005\uB575\u696A\uFFFE" + - "\u0004\uB57A\u696B\uB57E\uB57F\uB581\uB582\u49C2\u5171\uB583\uB584\u5C50\u6969\uB585\uB586\u696C" + - "\uFFFE\u0004\uB587\u696E\uB58B\uB58C\uB58D\u5D97\uB58E\u59E0\u5AA2\uB58F\uB590\u6AC2\u54B8\uFFFE" + - "\u0005\uB591\u6AC3\uB596\uB597\u696D\u696F\u5084\u6970\uB598\uB599\u6974\uFFFE\u0007\uB59A\u6976" + - "\u6971\uB5A1\u5571\u5382\uB5A2\uB5A3\uB5A4\u51E2\u4D9D\uB5A5\uB5A6\u6973\uB5A7\u6975\uB5A8\uB5A9" + - "\uB5AA\u4D73\uFFFE\u0007\uB5AB\u697B\uFFFE\u0005\uB5B2\u4DD5\uB5B7\u48FC\u6979\uFFFE\u0005\uB5B8" + - "\u6978\u6972\u697A\uFFFE\u0005\uB5BD\u6977\uB5C2\uB5C3\uB5C4\u54EB\uFFFE\u0004\uB5C5\u576A\u697D" + - "\uFFFE\u0004\uB5C9\u635D\uB5CD\uB5CE\uB5CF\u697C\uB5D0\u697E\uFFFE\n\uB5D1\u697F\uB5DB\uB5DC" + - "\u5886\uFFFE\u0019\uB5DD\u6AC4\u4F94\uFFFE\u0006\uB5F6\u6981\uB5FC\uB5FD\uFFFE\u0012\uB641\u6982" + - "\uB653\uB654\uB655\u57F6\uB656\u59A9\uB657\u699C\uB658\uB659\u4CB1\uFFFE\u0026\uB65A\uFFFE\u0014" + - "\uB681\u4EFA\u4D7B\uB695\u4D87\u5279\u55D2\u65E7\u50BF\u4FF4\u65E8\u65E9\u65EA\uB696\uFFFE\u0004" + - "\u65EB\u4F67\uB697\uB698\uB699\u6B9C\uB69A\uB69B\uB69C\u6B9E\uB69D\u6B9F\uB69E\u6B9D\uFFFE\u0004" + - "\uB69F\u4F83\uB6A3\u6BA0\u4AA4\uFFFE\u0004\uB6A4\u6BA1\uB6A8\uB6A9\uB6AA\u6BA2\uB6AB\uB6AC\uB6AD" + - "\u66B1\uFFFE\f\uB6AE\u5974\uFFFE\u0006\uB6BA\u5D8B\uFFFE\u0036\uB6C0\u6BA3\uFFFE\b\uB6F6" + - "\uB741\u67B9\uFFFE\u0030\uB742\u5B52\uFFFE\u000E\uB772\uB781\u5A9F\u56DB\uFFFE\b\uB782\u55C3" + - "\uFFFE\u0073\uB78A\u6360\uB7FD\uFFFE\u001D\uB841\u6BA4\uFFFE\"\uB85E\uFFFE\u001D\uB881\u4FAE" + - "\uFFFE\u0005\uB89E\u53A8\uFFFE\u0033\uB8A3\u5DA4\u4EC5\u4BA8\u4CBB\u54CE\u4EA4\u5DA5\u5DA6\u56D5" + - "\u54C2\u5DA7\u53FC\uB8D6\u5955\u59E8\u5956\u4EC6\uB8D7\u4F52\u4E85\u5DA8\u5DA9\u5968\u5DAA\u58EC" + - "\u4BEE\u51DA\uB8D8\u566F\u4C8E\u5589\u4C63\u4FF6\u5BA3\u5DAB\u5DAC\u53BF\u5C88\u55B5\uB8D9\u5B49" + - "\u567F\u5B90\u5DAD\u5BDE\u4AC9\u5DAF\u5DAE\uB8DA\u59EA\u5DB0\u5DB1\u5DB2\u55D3\u5DB3\u55AA\u5DB4" + - "\u5DB5\u4A6F\u5BEE\u5DB6\u4E50\u4B4E\u5DB7\u5DB8\u4D8F\u594F\u59E7\u5DB9\u4CC2\u588B\u49EE\u5DBA" + - "\u5DBB\uB8DB\u4F8C\u57DB\u5A90\u5DBC\u57F2\u5DBD\u5A75\u4E86\u5DBE\u5655\u5670\u5DBF\u548C\u5BED" + - "\u5DC0\u5355\u4BC0\u5DC1\u4C6C\u506E\u5DC2\u5DC3\u564D\u5DC4\u4B98\u5DC5\u5162\u5C5B\u5DC6\u56B7" + - "\uB8DC\u59E9\u52B0\u5DC7\u4B9E\u4E71\u5DC8\u58B2\u5DC9\u5DCA\u57BC\u5DCB\u5DCC\u5DCD\u49F6\u5DD0" + - "\u5DCE\u5989\u5DCF\u5275\u5DD1\uB8DD\u5DD2\u5DD3\u5DD4\u58BA\u59A4\u48F8\u5DD5\u544B\u5DD6\u4F98" + - "\u5241\u5DD7\u5DD8\u529E\u56B6\u5DD9\u5DDA\u50BD\u53D6\u5DDB\u5DDC\u5454\u5DDD\u5DDE\u4D68\uFFFE" + - "\t\uB8DE\u4E8E\uFFFE\u0004\uB8E7\u4BB8\u6AF7\uB8EB\u6AF8\uB8EC\uB8ED\u5784\uFFFE\b\uB8EE" + - "\u6B59\uFFFE\u0004\uB8F6\u6681\uFFFE\u0004\uB8FA\uB941\uB942\u5894\u4E5F\uFFFE\u0007\uB943\u4DBF" + - "\u5AA4\uFFFE\u0007\uB94A\u6179\uFFFE\u0004\uB951\u6B95\u494A\u49F1\uFFFE\u0007\uB955\u6B96\uB95C" + - "\uB95D\u6B98\uB95E\uB95F\uB960\u4DD0\u6B97\uB961\u5252\uFFFE\u0007\uB962\u6B9A\uB969\uB96A\uB96B" + - "\u6B99\uFFFE\u0014\uB96C\uFFFE\u0070\uB981\u4954\u5B8B\u4CB9\uB9F1\u4D51\u49C5\u5AEF\u586D\u48DB" + - "\u5B6B\u4E96\u5BC9\u4C57\u56AF\u53B5\u4982\u4D5A\u5BFB\u4D82\u4C41\u4EF9\u65D9\u65DA\u56F8\u4D94" + - "\u65DB\u4AFA\u5253\u4C71\u4DD7\u65DC\u5AF3\u65DD\u4ED5\u4E7F\u65DE\u517E\u51B7\u5ADE\u5C6A\u65DF" + - "\u65E0\u65E3\u65E1\u65E2\u557E\u4CB2\u4BC3\u65E4\u55E9\u556D\u4ACC\uB9F2\uB9F3\u61D8\u5383\u65E5" + - "\u50B4\uB9F4\u5C58\u65E6\u5C4C\u54FB\u5CD2\u5CCC\u5ADD\uB9F5\u5AF8\u5564\u5A4E\u4CD2\u4A81\uB9F6" + - "\u5583\u6AF5\uB9F7\uB9F8\uB9F9\u4DD4\uB9FA\u6AF6\uB9FB\uB9FC\u5C7F\uB9FD\uBA41\u6AF0\u4CAF\u5B74" + - "\u4CCE\u53EF\uFFFE\t\uBA42\u4A63\uBA4B\uBA4C\u6AF1\u4A4C\uFFFE\u0004\uBA4D\u5ABC\u5498\uFFFE" + - "\u0005\uBA51\u6AF3\uBA56\uBA57\u6AF2\uFFFE\n\uBA58\u56CA\uBA62\uBA63\uBA64\u54A3\uFFFE\r" + - "\uBA65\u6AF4\uBA72\u5C84\u535F\u6B60\uBA73\uBA74\u6B5B\uBA75\u6B63\uBA76\u6B62\uBA77\u5BB9\u6B61" + - "\uBA78\uBA79\uBA7A\u5ABD\u6B64\uBA7B\u6B6C\uFFFE\u0004\uBA7C\u48CE\u4B99\uBA81\u6B69\u6B6A\uBA82" + - "\u537C\uFFFE\u0004\uBA83\u6B65\u6B66\uBA87\uBA88\u6B67\u6B6B\uBA89\u4FDF\u6B68\u4CF9\uBA8A\uBA8B" + - "\uBA8C\u6B70\u6B73\uBA8D\uBA8E\uBA8F\u5088\uBA90\u4D93\u6B5C\u6B6D\uBA91\uBA92\u51B6\uBA93\uBA94" + - "\uBA95\u56F7\uBA96\u4EF8\uBA97\u6B6E\u6B6F\u6B71\u4BE4\u6B72\uBA98\u6B75\uFFFE\u0007\uBA99\u6B5D" + - "\uBAA0\uBAA1\uBAA2\u6B74\u5A5B\uBAA3\u4A8D\uBAA4\uBAA5\u56A3\uFFFE\u0004\uBAA6\u6B76\uFFFE\b" + - "\uBAAA\u6B77\u4FE0\u6B78\uBAB2\uBAB3\u56DE\u6B7B\uFFFE\u0005\uBAB4\u49C7\u5C79\uBAB9\u6B79\uBABA" + - "\u6B7A\u6B7C\uBABB\u6B83\uBABC\uBABD\uBABE\u6B81\uBABF\uBAC0\uBAC1\u6B7F\u6B7D\uBAC2\uBAC3\u6B82" + - "\uBAC4\uBAC5\u6B7E\u6B85\u6B86\uBAC6\u56E2\uBAC7\uBAC8\u635F\u4B58\u6B84\u6B89\u56A2\uFFFE\u0005" + - "\uBAC9\u6B87\u6B88\uFFFE\u0006\uBACE\u6B5E\uFFFE\f\uBAD4\u4964\uBAE0\uBAE1\u6B5F\uBAE2\uBAE3" + - "\u4B65\u49E3\uBAE4\u6B8D\u6B8A\uBAE5\u4BD6\uBAE6\u6B8E\uBAE7\u6B8B\uFFFE\u0005\uBAE8\u6B8C\uBAED" + - "\uBAEE\u4AD9\uBAEF\u5AE9\uBAF0\uBAF1\uBAF2\u6B8F\uBAF3\u4A9A\uFFFE\u0007\uBAF4\u6B90\u6B92\uBAFB" + - "\uBAFC\uBAFD\u6B91\uFFFE\u0007\uBB41\u6B93\uBB48\u6B94\uFFFE\f\uBB49\u558E\u4D4A\uBB55\uBB56" + - "\u549C\uBB57\uBB58\u4BE2\uFFFE\u0007\uBB59\u56C8\uFFFE\u0013\uBB60\u65A5\uFFFE\r\uBB73\uFFFE" + - "\u007D\uBB81\uFFFE\r\uBC41\u4A55\u5AFD\u4D8D\u58F8\uBC4E\u658E\u5C4A\u658F\u51D5\u54EC\u4DE3" + - "\u6590\u6591\u6592\u5BE0\u6593\u6594\u6596\u6595\u6597\u6598\u5482\u6599\u5AD7\u659A\u4F6E\uBC4F" + - "\u659B\u659C\u4F6F\u659D\u4CA7\u515E\u659E\u4952\u4E74\u4D96\u659F\uBC50\u65A0\u65A1\u65A2\u4C99" + - "\u4EAC\uBC51\u55E3\u60CD\u5AAE\u585D\u5B57\u65A3\u5B7E\u65A4\u58C0\u4D5C\uBC52\u4AC6\u4979\uBC53" + - "\uBC54\uBC55\u50B0\uFFFE\u0004\uBC56\u4987\u4988\uBC5A\u4989\uFFFE\u0004\uBC5B\u4A5D\u54E7\uFFFE" + - "\u0004\uBC5F\u6361\uBC63\uBC64\u497F\uBC65\uBC66\uBC67\u5169\u4AEE\uBC68\uBC69\u5448\u5A78\uBC6A" + - "\u53F8\u5958\uBC6B\u4D9E\u51F4\uFFFE\u0005\uBC6C\u5A4D\uBC71\u5ACA\u4F9D\uBC72\u6362\u4C55\u6363" + - "\uBC73\uBC74\u4E59\u5B83\uBC75\u4F99\u5AB5\u57A4\u514C\u4A79\uBC76\uBC77\u56F5\uBC78\u6366\u6364" + - "\u6368\uBC79\u636A\u6367\u4B6F\u53C7\uBC7A\u4B9D\u6365\uBC7B\u55F5\uBC7C\uBC7D\u6369\uBC7E\uBC7F" + - "\uBC81\u5274\u4965\u4EA2\uBC82\uBC83\uBC84\u5C57\uBC85\uBC86\u576B\u566D\u55C9\u56D2\u636C\u636B" + - "\u52E5\uBC87\uBC88\u5941\u5957\u636D\uBC89\u6370\uBC8A\u5758\u5BEF\u636F\u4B7D\uBC8B\u575E\uBC8C" + - "\u6371\u4BB9\uBC8D\uBC8E\u5748\u4D85\uBC8F\u55C4\u4A71\u5679\u5AEB\u6372\u4C8B\uBC90\uBC91\uBC92" + - "\u636E\uFFFE\u0006\uBC93\u6375\u4AFD\u6376\uFFFE\u0005\uBC99\u6373\u6374\uBC9E\u59DC\uBC9F\uBCA0" + - "\u51DE\u4966\uBCA1\u5A83\uBCA2\uBCA3\u4BDC\u568D\uBCA4\u6377\uBCA5\uBCA6\u5A97\uFFFE\u0005\uBCA7" + - "\u498A\uBCAC\u4BF3\u637A\u6378\u6379\u4B60\uBCAD\uBCAE\uBCAF\u59C4\u637C\uBCB0\uBCB1\u637E\uFFFE" + - "\u0006\uBCB2\u637D\u5452\uBCB8\u59A2\uBCB9\uBCBA\u637B\uFFFE\u0004\uBCBB\u5AE1\u5B7A\uFFFE\u0005" + - "\uBCBF\u6381\u5C92\uFFFE\u0007\uBCC4\u6382\uBCCB\u497C\u599C\uBCCC\u6383\u6385\uFFFE\u0004\uBCCD" + - "\u6384\uBCD1\uBCD2\u6386\uFFFE\u0005\uBCD3\u59D7\uBCD8\u4B6B\uBCD9\u647F\uBCDA\u5DF4\uBCDB\u5DF7" + - "\uBCDC\u5DF5\uBCDD\u5DF6\uBCDE\uBCDF\uBCE0\u5DF9\u58CE\u52C6\uBCE1\uBCE2\u48ED\uBCE3\uBCE4\uBCE5" + - "\u58AF\uBCE6\u5DF8\uBCE7\u5A6A\u4DA9\u5E42\u5492\uBCE8\u5DFB\u5DFA\u557B\u5DFC\uBCE9\u5E41\u5C7E" + - "\u5DFD\u517A\uBCEA\uBCEB\u5E45\uBCEC\uBCED\u5A95\uBCEE\uBCEF\u5E47\u5E44\uBCF0\u5E48\uBCF1\uBCF2" + - "\u4F5C\uBCF3\uBCF4\uBCF5\u50C8\u5E43\u5E46\u5BA2\uBCF6\u5E49\uBCF7\uBCF8\uBCF9\u5E4D\uBCFA\uBCFB" + - "\uBCFC\u5E4E\u5E4C\u4DC1\uBCFD\uBD41\uBD42\u5044\u5E4B\uBD43\uBD44\uBD45\u5E4A\u5AC6\u49BE\uBD46" + - "\uBD47\u5E4F\uBD48\u4D9A\uBD49\u5E50\uFFFE\u0004\uBD4A\u4A5B\uBD4E\uBD4F\uBD50\u4B46\uFFFE\u0004" + - "\uBD51\u4BBB\u5E51\uBD55\uBD56\uBD57\u4BF4\uBD58\u5E52\uFFFE\u0014\uBD59\u4969\uFFFE\u0004\uBD6D" + - "\u5E54\uBD71\uBD72\uBD73\u5E53\u5E55\uFFFE\u000B\uBD74\u5E57\uBD7F\u5E56\uFFFE\u0007\uBD81\u5E58" + - "\uFFFE\t\uBD88\u5E59\uBD91\uBD92\u5E5A\uBD93\uBD94\u5A6F\u6AF9\u5496\u5C63\u5385\u6AFB\u6AFC" + - "\u6AFA\uBD95\u4FC5\uFFFE\u0004\uBD96\u58EE\uBD9A\uBD9B\u4C73\uBD9C\uBD9D\u5ACC\u56A9\uBD9E\uBD9F" + - "\u6B42\u6B41\u4DA7\u6AFD\u5676\uBDA0\uBDA1\uBDA2\u6B44\u50D1\uBDA3\u4A8B\uBDA4\u574A\u6B45\u6B43" + - "\u4F54\u6B48\uBDA5\u6B49\u4F6D\u5258\u5082\u5682\u6B4A\uBDA6\uBDA7\uBDA8\u6B46\u6B47\u52EF\uFFFE" + - "\u0005\uBDA9\u6B4C\uBDAE\u4ABB\uBDAF\u5C8E\uBDB0\u4AD6\u6B4B\u6B4E\uBDB1\uBDB2\u6B4D\u6B4F\u58D0" + - "\uFFFE\u0007\uBDB3\u5271\u54A8\uFFFE\u0006\uBDBA\u6B50\u6B51\uFFFE\u0006\uBDC0\u6B52\uBDC6\uBDC7" + - "\u6B53\u6B54\u6B55\uFFFE\u0004\uBDC8\u6B57\u6B56\uFFFE\u0004\uBDCC\u6B58\uFFFE\f\uBDD0\u49C8" + - "\uBDDC\u5A74\u55CC\uBDDD\u50EE\u5BD7\u59AF\u515F\uBDDE\u4F91\uFFFE\n\uBDDF\u4CA9\uFFFE\u0015" + - "\uBDE9\uFFFE\u003F\uBE41\uFFFE\u0043\uBE81\u4EF7\uFFFE\u0019\uBEC4\u6BC5\uFFFE\u001F\uBEDD\u6BC6" + - "\uBEFC\uBEFD\uFFFE\u0017\uBF41\u6BC7\uFFFE\u0028\uBF58\uFFFE\u004D\uBF81\u6BC8\uFFFE\u002B\uBFCE" + - "\u6BC9\uFFFE\u0005\uBFF9\uFFFE\u001F\uC041\u6BCB\uFFFE\u0020\uC060\uFFFE\u001A\uC081\u6BCA\uFFFE" + - "\u000B\uC09B\u6C8A\uFFFE\u0058\uC0A6\uFFFE\u000F\uC141\u6BCC\uFFFE\u002C\uC150\u6BCD\uFFFE\u0004" + - "\uC17C\uFFFE\u0015\uC181\u67C3\u67C4\u67C5\u5B8C\u4BA3\u67C7\u67C6\u67C8\u67C9\u5445\u67CA\u67CB" + - "\uC196\u4C50\u4B97\u67CC\u67CE\uC197\u67CD\uC198\u4CC5\u67CF\u67D0\u67D1\u4BDA\u4A4E\u5BD2\u52C5" + - "\u4955\u4CD5\u67D2\u67D3\u5ABE\u5475\u4FFA\u57D8\u4D53\u67D5\u67D4\u67D7\u67D6\u5345\u67D8\u67D9" + - "\u544E\u67DA\u544F\u67DB\u49A6\uFFFE\u0005\u67DC\u5C8B\u67E1\u67E2\u4ED7\u67E3\u5A6B\u56F9\u49AB" + - "\u5186\u67E4\u5446\u524D\uC199\uFFFE\u0007\u67E5\uC19A\u67EC\u67ED\u67EE\uC19B\uC19C\u67EF\u67F0" + - "\u67F1\u67F3\u67F2\uC19D\u67F4\u574D\u51C0\u67F5\u67F6\u67F7\u5B41\u67F8\u5853\u67F9\u67FA\uC19E" + - "\u67FB\u67FC\u6841\u67FD\u6842\u4CF4\u529B\u6843\u6844\u4F62\u59BE\u49F8\u6845\u6846\u6847\u59F7" + - "\u6848\u5BFC\u6849\u53CB\uC19F\u684A\u684B\u5154\u684C\u589B\u5699\u684E\u684D\u4A9B\u4D99\u684F" + - "\u6850\u58E1\u6851\u6852\u4C87\u58BE\u6853\u6854\u6855\u54F0\u56DF\uFFFE\u0005\u6856\u5B81\u685B" + - "\u4AEC\u524A\u685C\uC1A0\u685D\u685E\u685F\uC1A1\u57FC\u6860\u51DF\u4AB7\u5C56\u4F96\uC1A2\u5867" + - "\u6863\u6861\u6862\u6864\u4BA6\u4EFB\u4FE1\u526C\u6865\u6866\uC1A3\u6867\u686F\u6868\u6869\u686A" + - "\u5462\u6892\u4BCC\u686B\uC1A4\u686C\u686D\u4BC5\u525E\u686E\uC1A5\u6870\u6871\u6872\u5B93\uC1A6" + - "\u6873\u52F6\uC1A7\u6874\u52F7\u6875\u6876\u4CE3\u48F6\u6877\u6878\u6879\uC1A8\uFFFE\u0004\u687A" + - "\uC1A9\u687E\u4FB4\u6882\u687F\u6881\uC1AA\u6883\u6884\u516D\uFFFE\t\u6885\u50D7\uC1AB\u688E" + - "\u514D\u688F\u6890\u6891\uC1AC\uC1AD\u5883\uFFFE\b\uC1AE\u4A44\uFFFE\u0048\uC1B6\uFFFE\u0020" + - "\uC241\u5265\u6265\u5561\u6266\uC261\u4975\u57C9\u4AB2\u54F1\u6267\u5870\u6268\u4EE3\u6269\u626A" + - "\u5266\u5B42\u52D5\u4D8C\u57C4\u626B\u5297\u626C\uC262\u4C47\u4CF2\u4DD1\u626D\u626E\u5AC3\u626F" + - "\uC263\u6270\u596B\uFFFE\u0004\u6271\u5976\u6275\u49FA\u50BA\u6276\uC264\u50AA\u6277\u6278\u6279" + - "\uC265\u627A\u627B\uC266\u4CB6\u5DE1\uC267\u4BD2\uC268\u5DE3\u5DE2\uFFFE\u0007\uC269\u5DE5\uC270" + - "\uC271\uC272\u54ED\uC273\uC274\u5DE4\u4C60\u5995\u59F4\u5B94\u4F77\uFFFE\u0004\uC275\u5C89\u5DE7" + - "\u5DE6\uC279\u48A1\u5773\uC27A\u5DE8\uC27B\u4CBC\u4EC9\u51BC\u51A3\u4A62\u5DE9\uC27C\u51A9\u52AF" + - "\u4F55\uC27D\uC27E\u587E\uC27F\uC281\uC282\u5DEA\u5562\uFFFE\u0005\uC283\u497D\uC288\uC289\uC28A" + - "\u5DEB\uC28B\u4BB7\u5AB9\uC28C\u4A9E\uC28D\uC28E\u5DEC\u5AC8\u5875\u5384\uC28F\u5DED\uFFFE\u0005" + - "\uC290\u5DEE\uC295\u5DEF\u518B\u56D4\u587D\uFFFE\r\uC296\u5A88\u51A0\uC2A3\u5DF0\uC2A4\uC2A5" + - "\u5686\uC2A6\u5DF1\uC2A7\u5687\u59FD\uC2A8\uC2A9\uC2AA\u4CF3\uC2AB\uC2AC\u5DF2\u48AE\u5856\uC2AD" + - "\uC2AE\u5B6F\uFFFE\n\uC2AF\u568E\uFFFE\b\uC2B9\u5DF3\uC2C1\uC2C2\u6264\uC2C3\uC2C4\u5145" + - "\uC2C5\uC2C6\u6BBE\uC2C7\uC2C8\u6BBF\u6BC0\u52D0\uC2C9\u54B7\u5984\uC2CA\uC2CB\u58DA\u5965\u4EAE" + - "\u4D6D\uC2CC\u6895\uC2CD\uC2CE\u4AC5\u5A5A\u6BC1\u4A9C\uC2CF\uC2D0\u6BC2\uC2D1\uC2D2\u4B92\uFFFE" + - "\n\uC2D3\u6BC4\uFFFE\u0007\uC2DD\u5A8B\u6BA6\u5949\uFFFE\u0004\uC2E4\u6BA8\uC2E8\uC2E9\uC2EA" + - "\u6BA7\uC2EB\uC2EC\u5184\u50D6\uC2ED\u4942\uFFFE\u0004\uC2EE\u57EC\uC2F2\u58E7\u6BAA\uC2F3\uC2F4" + - "\u5897\uC2F5\u6BA9\u5B91\u6BAB\u5259\uC2F6\uC2F7\uC2F8\u4E95\u6BAD\u6BAC\uC2F9\uC2FA\uC2FB\u52DD" + - "\uC2FC\uC2FD\u5178\uFFFE\u0005\uC341\u564A\uC346\u585C\uFFFE\u000B\uC347\u6BAE\uC352\uC353\u6BAF" + - "\uC354\uC355\u6BB0\uC356\u51B5\uFFFE\u0005\uC357\u48D3\u539A\uFFFE\u0004\uC35C\u6BB1\uFFFE\u0013" + - "\uC360\u5481\u6BA5\uC373\uC374\u4FB7\uC375\uC376\u4FB1\uC377\u4B86\uC378\uC379\u4C67\uC37A\u505F" + - "\u5272\u5287\uC37B\uC37C\u5CCB\uC37D\uC37E\uC37F\u4CEE\uFFFE\t\uC381\u4F9A\u5945\uC38A\u48CF" + - "\uFFFE\u0005\uC38B\u6C50\uFFFE\b\uC390\u6C51\uFFFE\u0005\uC398\u58AB\uC39D\u48AF\uC39E\uC39F" + - "\uC3A0\u6C52\u6C53\uC3A1\u6C54\uC3A2\uC3A3\uC3A4\u546A\uFFFE\u0007\uC3A5\u4FCE\uC3AC\uC3AD\u6C57" + - "\uFFFE\u0007\uC3AE\u6C56\uC3B5\u497E\uC3B6\u6C55\uC3B7\uC3B8\u6C58\uC3B9\u6C59\uFFFE\u0031\uC3BA" + - "\u57A3\u54CC\uC3EB\u4DAA\u64B7\u64B8\u64B9\u4FC1\uFFFE\u0005\uC3EC\u59F3\uC3F1\u5ACE\u5578\uFFFE" + - "\f\uC3F2\uFFFE\u003F\uC441\uFFFE\u0033\uC481\u59B2\u4BA4\u548B\u699D\u588F\u5653\u58EA\u6490" + - "\u5788\u4D6B\u4BD8\u699E\u48E3\u566C\u699F\u5AA3\u51AC\u518D\u53C3\u4FB0\u69A0\u4ED4\uC4B4\u69A1" + - "\u69A2\uC4B5\u69A3\u59C2\u53B4\uC4B6\u5767\u69A4\uC4B7\u5A51\u5065\u56E1\uC4B8\u69A5\u69A6\u5975" + - "\u4BED\u69A7\u69A8\u4B7F\u69A9\u69AA\uC4B9\u49FB\u69AB\u69AC\u54A6\uFFFE\u0026\uC4BA\u4C88\uC4E0" + - "\uC4E1\u66A8\u66A9\u66AA\uC4E2\u66AB\uC4E3\uC4E4\u53AD\u66AC\u66AD\uC4E5\uC4E6\uC4E7\u4C69\u55B2" + - "\uFFFE\u0007\uC4E8\u61B7\u6C6F\uFFFE\u000F\uC4EF\uFFFE\u0015\uC541\u6C70\uC556\uC557\u49CC\uFFFE" + - "\u001D\uC558\u6C71\uFFFE\u000B\uC575\uFFFE\u001A\uC581\u6C73\u6C72\uFFFE\r\uC59B\u61BA\uC5A8" + - "\u4EA1\uC5A9\uFFFE\u0006\u61BB\u4C59\u59FA\u4F44\u55CD\u4945\u5667\uC5AA\u61C1\u4BFB\u54C3\u61C2" + - "\uC5AB\uC5AC\u4F68\uC5AD\u499E\u61C3\uC5AE\u4BF5\u61C4\u52D8\uC5AF\uC5B0\u61C5\u587A\u4D7D\u61C6" + - "\u50A0\uC5B1\u61C7\u49F5\uC5B2\u61C8\uC5B3\u5194\u61C9\u61CA\u51F7\u61CB\u61CC\u61CD\u55D6\u5CB7" + - "\u5D86\u5884\uFFFE\u000B\uC5B4\u68A4\uC5BF\uC5C0\u5EAF\uFFFE\u003D\uC5C1\uFFFE\u003F\uC641\uFFFE" + - "\u0047\uC681\u51EC\u5AA5\u5774\u5951\u4A7B\u549E\uC6C8\u49B4\u51BE\u63DF\u55BA\u63E0\u63E1\u4FD3" + - "\u63E2\u5C44\u5775\u63E4\u4EDC\u63E3\u63E5\u63E6\u51ED\uC6C9\u4F5E\u63E7\u51E5\u4DA6\u63E8\uC6CA" + - "\u63E9\u4A72\u598A\uC6CB\uC6CC\u5045\u63EA\u53EE\u63EB\u63EC\uC6CD\uC6CE\u63ED\u53AC\u63EE\uC6CF" + - "\u5547\u63EF\u63F0\u63F1\u6359\u63F2\u63F3\u51E1\u63F4\u63F5\u5BE7\u63F6\uC6D0\u63F7\u4D67\uFFFE" + - "\u0007\uC6D1\u6C5B\u6C5A\uFFFE\u0004\uC6D8\u6C5E\u6C5C\u4DA0\uC6DC\u6C5F\uC6DD\u6C60\uC6DE\uC6DF" + - "\uC6E0\u6C62\u6C61\u6C64\uC6E1\uC6E2\u6C63\uFFFE\u0005\uC6E3\u6C65\u6C66\uFFFE\u0004\uC6E8\u6C67" + - "\uC6EC\u5689\uFFFE\u0004\uC6ED\u4CDE\uFFFE\u0006\uC6F1\u6C74\uC6F7\u6C75\uFFFE\u0004\uC6F8\u6C76" + - "\uC6FC\uC6FD\uC741\uC742\u6C78\uC743\u6C7A\uC744\u6C77\uFFFE\t\uC745\u6C7B\uC74E\u6C79\uFFFE" + - "\u0007\uC74F\u5C77\uFFFE\u0004\uC756\u6C7C\uFFFE\u0006\uC75A\u6C7D\uC760\uC761\uC762\u6C7E\uFFFE" + - "\u000B\uC763\u6C7F\uC76E\uC76F\uC770\u6C81\uFFFE\u000B\uC771\u5E6B\uC77C\uC77D\u5CA9\u0000\u0003" + - "\uC77E\u7F81\u8283\u8485\uC786\u6398\u4D8E\uFFFE\u0004\uC787\u509E\u4E8B\u6C69\u53C6\u6C68\uC78B" + - "\u6C6A\u6C6C\u6C6B\uC78C\uC78D\uC78E\u6C6D\uC78F\u57B9\uC790\u6C6E\uC791\uC792\u52A6\uFFFE\u006B" + - "\uC793\uFFFE\u003F\uC841\uFFFE\u007D\uC881\u5A84\uC941\uC942\u6BCE\uC943\u51B2\u6BCF\uC944\uC945" + - "\uFFFE\u0004\u6BD0\uC946\uC947\u6BD5\uC948\u494B\u6BD6\uC949\u6BD7\u6BD8\u6BD9\uC94A\u6BDA\u6BDB" + - "\uFFFE\u0004\uC94B\u6BDC\u6BDD\u586A\uC94F\uFFFE\u0006\u6BDE\u50EF\uFFFE\u0005\u6BE4\uC950\u6BE9" + - "\uC951\u6BEA\u6BEB\uC952\uFFFE\b\u6BEC\u4FA7\uC953\uFFFE\u0004\u6BF4\uFFFE\u0005\uC954\u54F9" + - "\uFFFE\u0004\u6BF8\uC959\uC95A\u6BFC\u6BFD\uFFFE\u0005\u6C41\uC95B\uC95C\u6C46\u6C47\u6C48\u498F" + - "\u6C49\u6C4A\u6C4B\uC95D\uC95E\u6C4C\u6C4D\u517B\u6C4E\uC95F\uC960\u6C4F\uFFFE\u001F\uC961\uFFFE" + - "\u007D\uC981\uFFFE\u003F\uCA41\uFFFE\u0061\uCA81\u52F0\u68AE\u4EA5\u68AF\u529A\uCAE2\u5358\u595B" + - "\uCAE3\uFFFE\u0005\u68B0\u595C\uCAE4\u598D\uCAE5\u68B6\u68B5\u5AA6\uCAE6\u5772\u68B7\u68B9\u68B8" + - "\u68BA\u68BB\uCAE7\uCAE8\u4CEA\u68BC\u4DE7\uCAE9\u68BD\u68BE\u4FE8\u68BF\u4BEB\uFFFE\u0004\u68C0" + - "\u54B4\u68C4\u68C5\uCAEA\u68C6\u5395\uCAEB\u68C7\uCAEC\uCAED\uCAEE\u68C8\uCAEF\u68C9\u6C5D\uCAF0" + - "\u68CA\u68CB\u68CC\uCAF1\u68CD\uFFFE\u0004\uCAF2\u68CE\u4DD6\uCAF6\uFFFE\u0007\u68CF\u68D7\uCAF7" + - "\uCAF8\u5A45\u68D6\uCAF9\u68D8\uFFFE\u0004\uCAFA\uFFFE\u0006\uCB41\u6B5A\u51B8\uCB47\uCB48\u6C85" + - "\uFFFE\u0004\uCB49\u6C86\u6C87\uCB4D\uCB4E\u6C88\uFFFE\u0006\uCB4F\u6C89\u51B3\uFFFE\t\uCB55" + - "\u6C8B\uCB5E\u6C8C\uFFFE\u0006\uCB5F\u51F2\uFFFE\r\uCB65\u6AEF\uCB72\uCB73\uCB74\u6AEE\uCB75" + - "\uCB76\u51E8\uCB77\u6C82\u6C83\uFFFE\u0005\uCB78\u4E66\uCB7D\uCB7E\uCB7F\uCB81\u5D85\uCB82\uCB83" + - "\uCB84\u55F1\u50E7\u68A3\uCB85\u4DD9\uCB86\uCB87\u544D\uCB88\uCB89\uCB8A\u52AB\uCB8B\uCB8C\u6C8D" + - "\u6C8E\u6C8F\uCB8D\u6C91\u6C90\uCB8E\u6C92\uCB8F\uCB90\u6C95\uCB91\u6C94\uCB92\u6C93\u6C96\uFFFE" + - "\u0004\uCB93\u6C97\uFFFE\t\uCB97\u678A\uCBA0\u678B\u678C\uCBA1\u6BBB\uFFFE\f\uCBA2\u6BBC" + - "\uCBAE\u6BBD\u4BA5\uCBAF\u5CBD\uCBB0\uCBB1\u4D64\uCBB2\uCBB3\uCBB4\u5CBA\uCBB5\u5EB0\uFFFE\u0006" + - "\uCBB6\u55F2\uCBBC\u6C98\uFFFE\t\uCBBD\u6C99\uCBC6\uCBC7\u6C9A\uFFFE\u0007\uCBC8\u6C9C\uCBCF" + - "\u6C9B\uCBD0\u4967\uCBD1\u6C9D\u6C9E\uFFFE\u0005\uCBD2\u6C9F\uFFFE\u000B\uCBD7\u53EA\u66B3\uFFFE" + - "\u001C\uCBE2\uFFFE\u0011\uCC41\u4A7D\u6BB2\uCC52\uCC53\u6BB3\u5185\uFFFE\u0006\u6BB4\u54A2\u6BBA" + - "\uFFFE\f\uCC54\u519B\u4D48\u6789\uCC60\uCC61\uCC62\u4D8B\u5D7F\uFFFE\u0005\uCC63\uFFFF\u005A" + - "\uFEFE\uFFFE\u008A\u6F75\uFFFE\u00BE\u7041\uFFFE\u00BE\u7141\uFFFE\u00BE\u7241\uFFFE\u00BE\u7341" + - "\uFFFE\u00BE\u7441\uFFFE\u0090\u7541\uFFFF\u3B30\uFEFE\uFFFE\u003F\u7641\uFFFE\u007D\u7681\uFFFE" + - "\u003F\u7741\uFFFE\u007D\u7781\uFFFE\u003F\u7841\uFFFE\u007D\u7881\uFFFE\u003F\u7941\uFFFE\u007D" + - "\u7981\uFFFE\u003F\u7A41\uFFFE\u007D\u7A81\uFFFE\u003F\u7B41\uFFFE\u007D\u7B81\uFFFE\u003F\u7C41" + - "\uFFFE\u007D\u7C81\uFFFE\u003F\u7D41\uFFFE\u007D\u7D81\uFFFE\u003F\u7E41\uFFFE\u007D\u7E81\uFFFE" + - "\u003F\u7F41\uFFFE\u007D\u7F81\uFFFE\u000E\u8041\uFFFF\'\uFEFE\uFFFE\n\uFC90\uFFFF\u0030" + - "\uFEFE\u465C\uFFFF\u004E\uFEFE\uCE57\uCE58\uCE59\uFFFF\u0005\uFEFE\uCE5F\uFFFF\u0007\uFEFE\uCE67" + - "\uFFFF\u0004\uFEFE\uCE6C\uCE6D\uFFFF\u0004\uFEFE\uCE72\uCE73\uFFFF\b\uFEFE\uCE7C\uFFFF\u0007" + - "\uFEFE\uCE85\uFFFF\u0010\uFEFE\uCE96\uCE97\uFFFF\u000E\uFEFE\uCEA6\uFFFF\u0FD8\uFEFE\u435B\u445C" + - "\uFFFF\u00ED\uFEFE\uCE41\uFFFF\u004C\uFEFE\uCE42\uFFFF\u001B\uFEFE\uCE43\uFFFF\u0051\uFEFE\uCE44" + - "\uFFFF\t\uFEFE\uCE45\uFFFF\u001A\uFEFE\uFFFE\u0004\uCE46\uFEFE\uCE4A\uFEFE\uCE4B\uCE4C\uFEFE" + - "\uFEFE\uFEFE\uCE4D\uFFFF\u0006\uFEFE\uCE4E\uCE4F\uCE50\uFEFE\uCE51\uCE52\uFEFE\uFEFE\uCE53\uCE54" + - "\uCE55\uFFFF\u012C\uFEFE\uFFFE\u0004\uF847\uFFFF\u0020\uFEFE\uFFFE\u0004\uF86B\uFFFF\u0010\uFEFE" + - "\uFFFE\b\uF87F\uFFFF\u0014\uFEFE\uFFFE\u0004\uF89B\uFFFF\u0025\uFEFE\uFFFE\u002D\uF8C4\uFFFF" + - "\u0230\uFEFE\uCDA8\u4751\uFEFE\u0000\b\u4752\u5341\u424F\u5043\u444D\u4E47\u4845\u4649\u4A4B" + - "\u474C\uFFFF\u0004\uFEFE\uFFFE\n\uCDA9\uFEFE\uFFFE\u0004\uCDB3\uFEFE\uFFFE\u000E\uCDB7\uFEFE" + - "\uFFFE\u0004\uCDC5\uFFFF\u001D\uFEFE\uFFFE\n\uFBD0\uFEFE\uFEFE\uFFFE\u0004\uFBDC\uFFFF\u0004" + - "\uFEFE\uFFFE\u000E\uFBE4\uFEFE\uFEFE\uFFFE\u000B\uFBF4\uFC41\uFFFF\u0010\uFEFE\uFFFE\u002C\uFC52" + - "\uFFFF\u0006\uFEFE\uFC84\uFC85\uFFFF\u0004\uFEFE\u0000\u0007\u425A\u7F7B\uE06C\u507D\u4D5D\u5C4E" + - "\u6B60\u4B61\uFFFE\n\u42F0\u0000\u0003\u427A\u5E4C\u7E6E\u6F7C\uFFFE\t\u42C1\uFFFE\t" + - "\u42D1\uFFFE\b\u42E2\u4444\u43E0\u4445\u4470\u426D\u4279\uFFFE\t\u4281\uFFFE\t\u4291" + - "\uFFFE\b\u42A2\u42C0\u424F\u42D0\u43A1\uFFFF\u0081\uFEFE\u434A\u424A\u425F\u42A1\u426A\u425B" + - "\uFFFF\u001A\uFEFE"; - - - ConvTable4933() - { - super(4933, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } - - ConvTable4933(int ccsid) - { - super(ccsid, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable4948.java b/cvsroot/src/com/ibm/as400/access/ConvTable4948.java deleted file mode 100644 index 817fd30fa..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable4948.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable4948.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable4948 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u00B6\u0015\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u00C7\u00FC\u00E9\u00E2\u00E4\u016F\u0107\u00E7\u0142\u00EB\u0150\u0151\u00EE\u0179\u00C4\u0106" + - "\u00C9\u0139\u013A\u00F4\u00F6\u013D\u013E\u015A\u015B\u00D6\u00DC\u0164\u0165\u0141\u00D7\u010D" + - "\u00E1\u00ED\u00F3\u00FA\u0104\u0105\u017D\u017E\u0118\u0119\u001A\u017A\u010C\u015F\u001A\u001A" + - "\u001A\u001A\u001A\u001A\u001A\u00C1\u00C2\u011A\u015E\u001A\u001A\u001A\u001A\u017B\u017C\u001A" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u0102\u0103\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u00A4" + - "\u0111\u0110\u010E\u00CB\u010F\u0147\u00CD\u00CE\u011B\u001A\u001A\u001A\u001A\u0162\u016E\u001A" + - "\u00D3\u00DF\u00D4\u0143\u0144\u0148\u0160\u0161\u0154\u00DA\u0155\u0170\u00FD\u00DD\u0163\u00B4" + - "\u00AD\u02DD\u02DB\u02C7\u02D8\u00A7\u00F7\u00B8\u00B0\u00A8\u02D9\u0171\u0158\u0159\u001A\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u7F15\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFF7F\u7F7F\uCF7F\u7FF5\uF97F\u7F7F\u7FF0\u7F7F\uF87F\u7F7F\uEF7F\u147F\uF77F" + - "\u7F7F\u7F7F\u7F7F\u7FB5\uB67F\u8E7F\u7F80\u7F90\u7FD3\u7FD6\uD77F\u7F7F\u7FE0\uE27F\u999E\u7F7F" + - "\uE97F\u9AED\u7FE1\u7FA0\u837F\u847F\u7F87\u7F82\u7F89\u7FA1\u8C7F\u7F7F\u7FA2\u937F\u94F6\u7F7F" + - "\uA37F\u81EC\u7F7F\u7F7F\uC6C7\uA4A5\u8F86\u7F7F\u7F7F\uAC9F\uD2D4\uD1D0\u7F7F\u7F7F\u7F7F\uA8A9" + - "\uB7D8\uFFFF\u000E\u7F7F\u7F91\u927F\u7F95\u967F\u7F9D\u88E3\uE47F\u7FD5\uE57F\u7F7F\u7F7F\u7F7F" + - "\u8A8B\u7F7F\uE8EA\u7F7F\uFCFD\u9798\u7F7F\uB8AD\uE6E7\uDDEE\u9B9C\uFFFF\u0004\u7F7F\uDE85\uEBFB" + - "\u7F7F\u7F7F\u7F7F\u7F8D\uABBD\uBEA6\uA77F\uFFFF\u00A3\u7F7F\u7FF3\uFFFF\b\u7F7F\uF4FA\u7FF2" + - "\u7FF1\uFFFF\u7E91\u7F7F"; - - - ConvTable4948() - { - super(4948, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable4951.java b/cvsroot/src/com/ibm/as400/access/ConvTable4951.java deleted file mode 100644 index 3c2352891..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable4951.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable4951.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable4951 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u00B6\u0015\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u0452\u0402\u0453\u0403\u0451\u0401\u0454\u0404\u0455\u0405\u0456\u0406\u0457\u0407\u0458\u0408" + - "\u0459\u0409\u045A\u040A\u045B\u040B\u045C\u040C\u045E\u040E\u045F\u040F\u044E\u042E\u044A\u042A" + - "\u0430\u0410\u0431\u0411\u0446\u0426\u0434\u0414\u0435\u0415\u0444\u0424\u0433\u0413\u001A\u001A" + - "\u001A\u001A\u001A\u001A\u001A\u0445\u0425\u0438\u0418\u001A\u001A\u001A\u001A\u0439\u0419\u001A" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u043A\u041A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u043B\u041B\u043C\u041C\u043D\u041D\u043E\u041E\u043F\u001A\u001A\u001A\u001A\u041F\u044F\u001A" + - "\u042F\u0440\u0420\u0441\u0421\u0442\u0422\u0443\u0423\u0436\u0416\u0432\u0412\u044C\u042C\u2116" + - "\u00AD\u044B\u042B\u0437\u0417\u0448\u0428\u044D\u042D\u0449\u0429\u0447\u0427\u00A7\u001A\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u7F15\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFF7F\u0000\u0004\u7F7F\u7FFD\u7F7F\uF07F\u7F7F\u7F7F\u147F\uFFFF\u01A4\u7F7F" + - "\u7F85\u8183\u8789\u8B8D\u8F91\u9395\u977F\u999B\uA1A3\uECAD\uA7A9\uEAF4\uB8BE\uC7D1\uD3D5\uD7DD" + - "\uE2E4\uE6E8\uABB6\uA5FC\uF6FA\u9FF2\uEEF8\u9DE0\uA0A2\uEBAC\uA6A8\uE9F3\uB7BD\uC6D0\uD2D4\uD6D8" + - "\uE1E3\uE5E7\uAAB5\uA4FB\uF5F9\u9EF1\uEDF7\u9CDE\u7F84\u8082\u8688\u8A8C\u8E90\u9294\u967F\u989A" + - "\uFFFF\u0E5B\u7F7F\uEF7F\uFFFF\u6F74\u7F7F"; - - - ConvTable4951() - { - super(4951, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable4971.java b/cvsroot/src/com/ibm/as400/access/ConvTable4971.java deleted file mode 100644 index 09870a2a3..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable4971.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable4971.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable4971 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u005B\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u039A\u039B\u039C\u039D\u039E\u039F\u03A0\u03A1\u03A3\u005D\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03AA\u03AB\u007C\u002C\u0025\u005F\u003E\u003F" + - "\u00A8\u0386\u0388\u0389\u00A0\u038A\u038C\u038E\u038F\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u0385\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC" + - "\u00B4\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u03BD\u03BE\u03BF\u03C0\u03C1\u03C3" + - "\u00A3\u03AC\u03AD\u03AE\u03CA\u03AF\u03CC\u03CD\u03CB\u03CE\u03C2\u03C4\u03C5\u03C6\u03C7\u03C8" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u03C9\u0390\u03B0\u2018\u2015" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B1\u00BD\u001A\u0387\u2019\u00A6" + - "\\\u001A\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00A7\u001A\u001A\u00AB\u00AC" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00A9\u20AC\u001A\u00BB\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u6AD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u743F\u3FB0\u3F3F\uDFEB\u70FB\u3FEE\uEFCA\u3F3F\u90DA\uEAFA\uA03F\u3FDD\u3F3F\u3FFE\u3FDB\uFFFF" + - "\u0163\u3F3F\u3F80\u71DD\u7273\u753F\u763F\u7778\uCC41\u4243\u4445\u4647\u4849\u5152\u5354\u5556" + - "\u5758\u3F59\u6263\u6465\u6667\u6869\uB1B2\uB3B5\uCD8A\u8B8C\u8D8E\u8F9A\u9B9C\u9D9E\u9FAA\uABAC" + - "\uADAE\uBAAF\uBBBC\uBDBE\uBFCB\uB4B8\uB6B7\uB93F\u3F3F\u3F3F\u3FBD\uFFFF\u0E1F\u3F3F\u3FCF\u3F3F" + - "\uCEDE\uFFFF\u0049\u3F3F\uFC3F\uFFFF\u6F29\u3F3F\u3F4F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61" + - "\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6" + - "\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596" + - "\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u6AD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable4971() - { - super(4971, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable500.java b/cvsroot/src/com/ibm/as400/access/ConvTable500.java deleted file mode 100644 index c09141e69..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable500.java +++ /dev/null @@ -1,60 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable500.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable500 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5\u00E7\u00F1\u005B\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u005D\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\uBBD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u9FB2\u6AB5\uBDB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u9E68\u7471\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\uECBF\u80FD\uFEFB\uFCAD\uAE59" + - "\u4445\u4246\u4347\u9C48\u5451\u5253\u5855\u5657\u8C49\uCDCE\uCBCF\uCCE1\u70DD\uDEDB\uDC8D\u8EDF" + - "\uFFFF\u7F80\u3F3F"; - - - ConvTable500() - { - super(500, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } - - ConvTable500(int ccsid) - { - super(ccsid, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable5026.java b/cvsroot/src/com/ibm/as400/access/ConvTable5026.java deleted file mode 100644 index d7104c607..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable5026.java +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable5026.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; - -class ConvTable5026 extends ConvTableMixedMap -{ - ConvTable5026() throws UnsupportedEncodingException - { - super(5026, 290, 16684); // 16684 is a superset of 300. - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Using alternate map."); - ConvTable4396.makeAlternateMap(dbTable_.toUnicode_, dbTable_.fromUnicode_); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable5035.java b/cvsroot/src/com/ibm/as400/access/ConvTable5035.java deleted file mode 100644 index bb2d34f6a..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable5035.java +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable5035.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; - - -class ConvTable5035 extends ConvTable1399 -{ - ConvTable5035() throws UnsupportedEncodingException - { - super(5035); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Using alternate map."); - ConvTable4396.makeAlternateMap(dbTable_.toUnicode_, dbTable_.fromUnicode_); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable5123.java b/cvsroot/src/com/ibm/as400/access/ConvTable5123.java deleted file mode 100644 index 005c55363..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable5123.java +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable5123.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable5123 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u001A\uFF61\uFF62\uFF63\uFF64\uFF65\uFF66\uFF67\uFF68\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\uFF69\uFF6A\uFF6B\uFF6C\uFF6D\uFF6E\uFF6F\uFF70\uFF71\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\uFF72\uFF73\uFF74\uFF75\uFF76\uFF77\uFF78\uFF79\u001A\u002C\u0025\u005F\u003E\u003F" + - "\uFF7A\uFF7B\uFF7C\uFF7D\uFF7E\uFF7F\uFF80\uFF81\uFF82\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u001A\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\uFF83\uFF84\uFF85\uFF86\uFF87\uFF88" + - "\u001A\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\uFF89\uFF8A\uFF8B\uFF8C\uFF8D\uFF8E" + - "\u203E\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\uFF8F\uFF90\uFF91\u005B\uFF92\uFF93" + - "\u005E\u00A3\u00A5\uFF94\uFF95\uFF96\uFF97\uFF98\uFF99\uFF9A\uFF9B\uFF9C\uFF9D\u005D\uFF9E\uFF9F" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u001A\u001A\u001A\u001A\u001A\u001A" + - "\\\u20AC\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u001A\u001A\u001A\u001A\u001A\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9AD\uE0BD\uB06D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u3F3F\u4AB1\u3FB2\u3F3F\u3F3F\u3F3F\u5F3F\uFFFF\u0FC8\u3F3F\uA03F\uFFFF\u0036\u3F3F\uE13F\uFFFF" + - "\u6F29\u3F3F\u3F5A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E" + - "\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9AD" + - "\uE0BD\uB06D\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0" + - "\u4FD0\uA13F\u3F42\u4344\u4546\u4748\u4951\u5253\u5455\u5657\u5859\u6263\u6465\u6667\u6869\u7071" + - "\u7273\u7475\u7677\u788A\u8B8C\u8D8E\u8F9A\u9B9C\u9D9E\u9FAA\uABAC\uAEAF\uB3B4\uB5B6\uB7B8\uB9BA" + - "\uBBBC\uBEBF\uFFFF\u0030\u3F3F"; - - - ConvTable5123() - { - super(5123, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } - - ConvTable5123(int ccsid) - { - super(ccsid, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable5351.java b/cvsroot/src/com/ibm/as400/access/ConvTable5351.java deleted file mode 100644 index 82cb8041f..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable5351.java +++ /dev/null @@ -1,24 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable5351.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable5351 extends ConvTable1255 -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable5351() - { - super(5351); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable57777.java b/cvsroot/src/com/ibm/as400/access/ConvTable57777.java deleted file mode 100644 index 574686b1b..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable57777.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable57777.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable57777 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u0009\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5\u00E7\u00F1\u005B\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u005D\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\uBBD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u9FB2\u6AB5\uBDB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\uBEA0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u9E68\u7471\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\uECBF\u80FD\uFEFB\uFCAD\uAE59" + - "\u4445\u4246\u4347\u9C48\u5451\u5253\u5855\u5657\u8C49\uCDCE\uCBCF\uCCE1\u70DD\uDEDB\uDC8D\u8EDF" + - "\uFFFF\u7F80\u3F3F"; - - - ConvTable57777() - { - super(57777, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable61952.java b/cvsroot/src/com/ibm/as400/access/ConvTable61952.java deleted file mode 100644 index 404cb9f47..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable61952.java +++ /dev/null @@ -1,590 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable61952.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable61952 extends ConvTableDoubleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\uFFFE\u3400\u0000\u0000\u0003\uAC00\u0104\u0708\u090A\uFFFE\b\uAC10\uFFFE\u0005\uAC19\u0000" + - "\u0023\uAC20\u242C\u2D2F\u3031\u3839\u3C40\u4B4D\u5458\u5C70\u7174\u7778\u7A80\u8183\u8485\u8689" + - "\u8A8B\u8C90\u949C\u9D9F\uA0A1\uA8A9\uAAAC\uAFB0\uB8B9\uBBBC\uBDC1\uC4C8\uCCD5\uD7E0\uE1E4\uE7E8" + - "\uEAEC\uEFF0\uF1F3\uF5F6\uFCFD\u0000\u001E\uAD00\u0406\u0C0D\u0F11\u181C\u2029\u2C2D\u3435\u383C" + - "\u4445\u4749\u5054\u5861\u636C\u6D70\u7374\u7576\u7B7C\u7D7F\u8182\u8889\u8C90\u9C9D\uA4B7\uC0C1" + - "\uC4C8\uD0D1\uD3DC\uE0E4\uF8F9\uFCFF\u0000\u001E\uAE00\u0108\u090B\u0D14\u3031\u3437\u383A\u4041" + - "\u4345\u464A\u4C4D\u4E50\u5456\u5C5D\u5F60\u6165\u6869\u6C70\u7879\u7B7C\u7D84\u858C\uBCBD\uBEC0" + - "\uC4CC\uCDCF\uD0D1\uD8D9\uDCE8\uEBED\uF4F8\uAEFC\u0000\u0017\uAF07\u080D\u102C\u2D30\u3234\u3C3D" + - "\u3F41\u4243\u4849\u505C\u5D64\u6579\u8084\u8890\u9195\u9CB8\uB9BC\uC0C7\uC8C9\uCBCD\uCED4\uDCE8" + - "\uE9F0\uF1F4\uAFF8\u0000\u001E\uB000\u0104\u0C10\u141C\u1D28\u4445\u484A\u4C4E\u5354\u5557\u595D" + - "\u7C7D\u8084\u8C8D\u8F91\u9899\u9A9C\u9FA0\uA1A2\uA8A9\uABAC\uADAE\uAFB1\uB3B4\uB5B8\uBCC4\uC5C7" + - "\uC8C9\uD0D1\uD4D8\uE0E5\u0000\u001E\uB108\u090B\u0C10\u1213\u1819\u1B1C\u1D23\u2425\u282C\u3435" + - "\u3738\u3940\u4144\u4850\u5154\u5558\u5C60\u7879\u7C80\u8288\u898B\u8D92\u9394\u989C\uA8CC\uD0D4" + - "\uDCDD\uDFE8\uE9EC\uF0F9\uFBFD\u0000\u0020\uB204\u0508\u0B0C\u1415\u1719\u2034\u3C58\u5C60\u6869" + - "\u7475\u7C84\u8589\u9091\u9498\u999A\uA0A1\uA3A5\uA6AA\uACB0\uB4C8\uC9CC\uD0D2\uD8D9\uDBDD\uE2E4" + - "\uE5E6\uE8EB\uECED\uEEEF\uF3F4\uF5F7\uF8F9\uFAFB\uB2FF\u0000\u001C\uB300\u0104\u0810\u1113\u1415" + - "\u1C54\u5556\u585B\u5C5E\u5F64\u6567\u696B\u6E70\u7174\u7880\u8183\u8485\u8C90\u94A0\uA1A8\uACC4" + - "\uC5C8\uCBCC\uCED0\uD4D5\uD7D9\uDBDD\uE0E4\uE8FC\u0000\u0014\uB410\u181C\u2028\u292B\u3450\u5154" + - "\u5860\u6163\u656C\u8088\u9DA4\uA8AC\uB5B7\uB9C0\uC4C8\uD0D5\uDCDD\uE0E3\uE4E6\uECED\uEFF1\uB4F8" + - "\u0000\u001A\uB514\u1518\u1B1C\u2425\u2728\u292A\u3031\u3438\u4041\u4344\u454B\u4C4D\u5054\u5C5D" + - "\u5F60\u61A0\uA1A4\uA8AA\uABB0\uB1B3\uB4B5\uBBBC\uBDC0\uC4CC\uCDCF\uD0D1\uD8EC\u0000\n\uB610" + - "\u1114\u1825\u2C34\u4864\u689C\u9DA0\uA4AB\uACB1\uD4F0\uF4F8\u0000\u001B\uB700\u0105\u2829\u2C2F" + - "\u3038\u393B\u4448\u4C54\u5560\u6468\u7071\u7375\u7C7D\u8084\u8C8D\u8F90\u9192\u9697\u9899\u9CA0" + - "\uA8A9\uABAC\uADB4\uB5B8\uC7C9\uECED\uF0F4\uFCFD\uB7FF\u0000\u001C\uB800\u0107\u0809\u0C10\u1819" + - "\u1B1D\u2425\u282C\u3435\u3738\u3940\u4451\u535C\u5D60\u646C\u6D6F\u7178\u7C8D\uA8B0\uB4B8\uC0C1" + - "\uC3C5\uCCD0\uD4DD\uDFE1\uE8E9\uECF0\uF8F9\uFBFD\u0000\u001E\uB904\u1820\u3C3D\u4044\u4C4F\u5158" + - "\u595C\u6068\u696B\u6D74\u7578\u7C84\u8587\u898A\u8D8E\uACAD\uB0B4\uBCBD\uBFC1\uC8C9\uCCCE\uCFD0" + - "\uD1D2\uD8D9\uDBDD\uDEE1\uE3E4\uE5E8\uECF4\uF5F7\uF8F9\uB9FA\u0000\u0017\uBA00\u0108\u1538\u393C" + - "\u4042\u4849\u4B4D\u4E53\u5455\u585C\u6465\u6768\u6970\u7174\u7883\u8485\u878C\uA8A9\uABAC\uB0B2" + - "\uB8B9\uBBBD\uC4C8\uD8D9\uBAFC\u0000\u0017\uBB00\u040D\u0F11\u181C\u2029\u2B34\u3536\u383B\u3C3D" + - "\u3E44\u4547\u494D\u4F50\u5458\u6163\u6C88\u8C90\uA4A8\uACB4\uB7C0\uC4C8\uD0D3\uF8F9\uFCFF\u0000" + - "\u0025\uBC00\u0208\u090B\u0C0D\u0F11\u1415\u1617\u181B\u1C1D\u1E1F\u2425\u2729\u2D30\u3134\u3840" + - "\u4143\u4445\u494C\u4D50\u5D84\u8588\u8B8C\u8E94\u9597\u999A\uA0A1\uA4A7\uA8B0\uB1B3\uB4B5\uBCBD" + - "\uC0C4\uCDCF\uD0D1\uD5D8\uDCF4\uF5F6\uF8FC\u0000\u0014\uBD04\u0507\u0910\u1424\u2C40\u4849\u4C50" + - "\u5859\u6468\u8081\u8487\u8889\u8A90\u9193\u9599\u9A9C\uA4B0\uB8D4\uD5D8\uDCE9\uF0F4\uBDF8\u0000" + - "\u001A\uBE00\u0305\u0C0D\u1014\u1C1D\u1F44\u4548\u4C4E\u5455\u5759\u5A5B\u6061\u6468\u6A70\u7173" + - "\u7475\u7B7C\u7D80\u848C\u8D8F\u9091\u9899\uA8D0\uD1D4\uD7D8\uE0E3\uE4E5\uBEEC\u0000\f\uBF01" + - "\u0809\u1819\u1B1C\u1D40\u4144\u4850\u5155\u94B0\uC5CC\uCDD0\uD4DC\uDFE1\u0000\u0016\uC03C\u5158" + - "\u5C60\u6869\u9091\u9498\uA0A1\uA3A5\uACAD\uAFB0\uB3B4\uB5B6\uBCBD\uBFC0\uC1C5\uC8C9\uCCD0\uD8D9" + - "\uDBDC\uDDE4\uE5E8\uECF4\uF5F7\uC0F9\u0000\u0023\uC100\u0408\u1015\u1C1D\u1E1F\u2023\u2426\u272C" + - "\u2D2F\u3031\u3638\u393C\u4048\u494B\u4C4D\u5455\u585C\u6465\u6768\u6970\u7478\u858C\u8D8E\u9094" + - "\u969C\u9D9F\uA1A5\uA8A9\uACB0\uBDC4\uC8CC\uD4D7\uD8E0\uE4E8\uF0F1\uF3FC\uC1FD\u0000\u001F\uC200" + - "\u040C\u0D0F\u1118\u191C\u1F20\u2829\u2B2D\u2F31\u3234\u4850\u5154\u5860\u656C\u6D70\u747C\u7D7F" + - "\u8188\u8990\u989B\u9DA4\uA5A8\uACAD\uB4B5\uB7B9\uDCDD\uE0E3\uE4EB\uECED\uEFF1\uF6F8\uF9FB\uC2FC" + - "\u0000\u0013\uC300\u0809\u0C0D\u1314\u1518\u1C24\u2528\u2945\u6869\u6C70\u7278\u797C\u7D84\u888C" + - "\uC0D8\uD9DC\uDFE0\uE2E8\uE9ED\uF4F5\uC3F8\u0000\r\uC408\u1024\u2C30\u343C\u3D48\u6465\u686C" + - "\u7475\u7980\u949C\uB8BC\uE9F0\uF1F4\uF8FA\uC4FF\u0000\u001E\uC500\u010C\u1014\u1C28\u292C\u3038" + - "\u393B\u3D44\u4548\u494A\u4C4D\u4E53\u5455\u5758\u595D\u5E60\u6164\u6870\u7173\u7475\u7C7D\u8084" + - "\u878C\u8D8F\u9195\u9798\u9CA0\uA9B4\uB5B8\uB9BB\uBCBD\uC5BE\uFFFE\u0007\uC5C4\u0000\n\uC5CC" + - "\uCED0\uD1D4\uD8E0\uE1E3\uE5EC\uEDEE\uF0F4\uF6F7\uFCFD\uFEFF\u0000\u0028\uC600\u0105\u0607\u080C" + - "\u1018\u191B\u1C24\u2528\u2C2D\u2E30\u3334\u3537\u393B\u4041\u4448\u5051\u5354\u555C\u5D60\u6C6F" + - "\u7178\u797C\u8088\u898B\u8D94\u9598\u9CA4\uA5A7\uA9B0\uB1B4\uB8B9\uBAC0\uC1C3\uC5CC\uCDD0\uD4DC" + - "\uDDE0\uE1E8\uE9EC\uF0F8\uF9FD\u0000\f\uC704\u0508\u0C14\u1517\u1920\u2124\u2830\u3133\u3537" + - "\u3C3D\u4044\u4A4C\u4D4F\uFFFE\b\uC751\u0000\u0018\uC75C\u6068\u6B74\u7578\u7C7D\u7E83\u8485" + - "\u8788\u898A\u8E90\u9194\u9697\u989A\uA0A1\uA3A4\uA5A6\uACAD\uB0B4\uBCBD\uBFC0\uC1C8\uC9CC\uCED0" + - "\uD8DD\uE4E8\uC7EC\u0000\u001D\uC800\u0104\u080A\u1011\u1315\u161C\u1D20\u242C\u2D2F\u3138\u3C40" + - "\u4849\u4C4D\u5470\u7174\u787A\u8081\u8385\u8687\u8B8C\u8D94\u9D9F\uA1A8\uBCBD\uC4C8\uCCD4\uD5D7" + - "\uD9E0\uE1E4\uF5FC\uC8FD\u0000\u001C\uC900\u0405\u060C\u0D0F\u1118\u2C34\u5051\u5458\u6061\u636C" + - "\u7074\u7C88\u898C\u9098\u999B\u9DC0\uC1C4\uC7C8\uCAD0\uD1D3\uD5D6\uD9DA\uDCDD\uE0E2\uE4E7\uECED" + - "\uEFF0\uF1F8\uF9FC\u0000\u0011\uCA00\u0809\u0B0C\u0D14\u1829\u4C4D\u5054\u5C5D\u5F60\u6168\u7D84" + - "\u98BC\uBDC0\uC4CC\uCDCF\uD1D3\uD8D9\uE0EC\uCAF4\u0000\u000B\uCB08\u1014\u1820\u2141\u4849\u4C50" + - "\u5859\u5D64\u7879\u9CB8\uD4E4\uE7E9\u0000\u001C\uCC0C\u0D10\u141C\u1D21\u2227\u2829\u2C2E\u3038" + - "\u393B\u3C3D\u3E44\u4548\u4C54\u5557\u5859\u6064\u6668\u7075\u9899\u9CA0\uA8A9\uABAC\uADB4\uB5B8" + - "\uBCC4\uC5C7\uC9D0\uD4E4\uECF0\u0000\u0014\uCD01\u0809\u0C10\u1819\u1B1D\u2428\u2C39\u5C60\u646C" + - "\u6D6F\u7178\u8894\u9598\u9CA4\uA5A7\uA9B0\uC4CC\uD0E8\uECF0\uF8F9\uFBFD\u0000\u001A\uCE04\u080C" + - "\u1419\u2021\u2428\u3031\u3335\u5859\u5C5F\u6061\u6869\u6B6D\u7475\u787C\u8485\u8789\u9091\u9498" + - "\uA0A1\uA3A4\uA5AC\uADC1\uE4E5\uE8EB\uECF4\uF5F7\uF8F9\u0000\u0016\uCF00\u0104\u0810\u1113\u151C" + - "\u2024\u2C2D\u2F30\u3138\u5455\u585C\u6465\u6769\u7071\u7478\u8085\u8CA1\uA8B0\uC4E0\uE1E4\uE8F0" + - "\uF1F3\uF5FC\u0000\u0019\uD000\u0411\u182D\u3435\u383C\u4445\u4749\u5054\u5860\u6C6D\u7074\u7C7D" + - "\u81A4\uA5A8\uACB4\uB5B7\uB9C0\uC1C4\uC8C9\uD0D1\uD3D4\uD5DC\uDDE0\uE4EC\uEDEF\uF0F1\uD0F8\u0000" + - "\u0012\uD10D\u3031\u3438\u3A40\u4143\u4445\u4C4D\u5054\u5C5D\u5F61\u686C\u7C84\u88A0\uA1A4\uA8B0" + - "\uB1B3\uB5BA\uBCC0\uD8F4\uD1F8\u0000\u0015\uD207\u0910\u2C2D\u3034\u3C3D\u3F41\u485C\u6480\u8184" + - "\u8890\u9195\u9CA0\uA4AC\uB1B8\uB9BC\uBFC0\uC2C8\uC9CB\uD4D8\uDCE4\uE5F0\uF1F4\uD2F8\u0000\u001E" + - "\uD300\u0103\u050C\u0D0E\u1014\u161C\u1D1F\u2021\u2528\u292C\u3038\u393B\u3C3D\u4445\u7C7D\u8084" + - "\u8C8D\u8F90\u9198\u999C\uA0A8\uA9AB\uADB4\uB8BC\uC4C5\uC8C9\uD0D8\uE1E3\uECED\uF0F4\uFCFD\uD3FF" + - "\u0000\u0010\uD401\u081D\u4044\u5C60\u646D\u6F78\u797C\u7F80\u8288\u898B\u8D94\uA9CC\uD0D4\uDCDF" + - "\uE8EC\uF0F8\uFBFD\u0000\u0019\uD504\u080C\u1415\u173C\u3D40\u444C\u4D4F\u5158\u595C\u6065\u6869" + - "\u6B6D\u7475\u787C\u8485\u8788\u8990\uA5C8\uC9CC\uD0D2\uD8D9\uDBDD\uE4E5\uE8EC\uF4F5\uF7F9\u0000" + - "\u001E\uD600\u0104\u0810\u1113\u1415\u1C20\u242D\u3839\u3C40\u4548\u494B\u4D51\u5455\u585C\u6769" + - "\u7071\u7483\u858C\u8D90\u949D\u9FA1\uA8AC\uB0B9\uBBC4\uC5C8\uCCD1\uD4D7\uD9E0\uE4E8\uF0F5\uFCFD" + - "\u0000\u0015\uD700\u0411\u1819\u1C20\u2829\u2B2D\u3435\u383C\u4447\u4950\u5154\u5657\u5859\u6061" + - "\u6365\u696C\u7074\u7C7D\u8188\u898C\u9098\u999B\uD79D\uAC02\uAC0B\uFFFE\u0010\u3D30\uAC79\uAC87" + - "\u3D42\uAC93\uFFFE\r\u3D44\uACE9\uFFFE\u0004\u3D52\uACFA\u3D57\u3D58\u3D59\uAD19\u3D5B\u3D5C" + - "\uAD28\uAD2B\uFFFE\f\u3D5F\uAD9B\uFFFE\u000B\u3D6C\uADD5\u3D78\u3D79\uADEC\uFFFE\u0004\u3D7B" + - "\uAE02\uFFFE\u0004\u3D80\uAE0F\uAE11\uFFFE\b\u3D86\uAE27\u3D8F\u3D90\uAE3C\uAE44\u3D93\uAE49" + - "\u3D95\u3D96\uAE62\uFFFE\u000B\u3D98\uAEA0\uFFFE\u000E\u3DA4\uAF04\uFFFE\u0004\u3DB3\uAF33\uFFFE" + - "\u0005\u3DB8\uAF4C\u3DBE\uAF58\u3DC0\uAF5B\uAF68\uFFFE\u0007\u3DC3\uAF93\uFFFE\u0006\u3DCB\uAFB2" + - "\uAFBF\u3DD3\u3DD4\u3DD5\uAFD8\u3DD7\u3DD8\uAFE7\u3DDA\u3DDB\u3DDC\uB00D\u3DDE\u3DDF\uB021\uFFFE" + - "\b\u3DE1\uB060\uFFFE\b\u3DEA\uB090\uFFFE\u0006\u3DF3\uB0BB\uFFFE\u0006\u3DFA\uB0EC\u3E01" + - "\u3E02\uB10F\u3E04\uB11E\uFFFE\t\u3E06\uB147\u3E10\uB153\uB159\uFFFE\u0007\u3E13\uB16F\u3E1B" + - "\uB17A\uFFFE\n\u3E1D\uB1A7\u3E28\uB1B0\uFFFE\u0015\u3E2A\uB233\uFFFE\u0016\u3E40\uB2A7\uFFFE" + - "\u0007\u3E57\uB2C1\u3E5F\uB2D1\u3E61\u3E62\u3E63\uB2E0\uFFFE\u000F\u3E65\uB331\uB338\uFFFE\u0004" + - "\u3E76\uB368\uB36A\uFFFE\t\u3E7C\uB39C\uFFFE\u000B\u3E86\uB3D3\uFFFE\n\u3E92\uB400\uFFFE" + - "\u0004\u3E9D\uB40F\u3EA2\u3EA3\u3EA4\uB42C\uFFFE\n\u3EA6\uB457\uFFFE\n\u3EB1\uB47F\uFFFE" + - "\u000B\u3EBC\uB4B4\u3EC8\uB4C1\u3ECA\u3ECB\u3ECC\uB4E7\uFFFE\u000B\u3ECE\uB52E\u3EDA\uB532\uB537" + - "\u3EDD\u3EDE\u3EDF\uB53F\u3EE1\u3EE2\u3EE3\uB568\u3EE5\u3EE6\u3EE7\uB584\uFFFE\u000B\u3EE9\uB5F4" + - "\uFFFE\u001D\u3EF5\uB680\uFFFE\u0007\u3F13\uB6B8\uFFFE\f\u3F1B\uB70C\uFFFE\u0019\u3F28\uB7D0" + - "\uFFFE\u0007\u3F42\uB80F\uFFFE\u0019\u3F4A\uB894\uFFFE\n\u3F64\uB8DC\uFFFE\n\u3F6F\uB917" + - "\uFFFE\u0012\u3F7A\uB990\uFFFE\u0010\u3F8D\uB9DF\uFFFE\u0004\u3F9E\uB9FB\uFFFE\u0007\u3FA3\uBA1C" + - "\uFFFE\b\u3FAB\uBA6B\uBA6D\u3FB5\u3FB6\uBA80\uFFFE\r\u3FB8\uBAAF\u3FC6\u3FC7\u3FC8\uBAC3" + - "\uFFFE\u0006\u3FCA\uBAE0\uFFFE\u0026\u3FD1\uBBC1\uFFFE\u0005\u3FF8\uBBD5\u3FFE\uBBDC\u4000\uBBE0" + - "\uFFFE\b\u4002\uBC0E\u400B\u400C\u400D\uBC28\u400F\u4010\u4011\uBC37\u4013\u4014\uBC5C\u4016" + - "\u4017\u4018\uBC68\uFFFE\u0006\u401A\uBC98\uBC9C\u4022\u4023\u4024\uBCB9\u4026\u4027\uBCCC\uBCD2" + - "\uBCD3\uBCD4\uFFFE\u0013\u402C\uBD23\uFFFE\u0013\u4040\uBD97\uFFFE\t\u4054\uBDB4\uFFFE\u0013" + - "\u405E\uBE18\u4072\uBE21\u4074\u4075\u4076\uBE28\uFFFE\u0007\u4078\uBE4B\uFFFE\u000B\u4080\uBE9C" + - "\uBEB4\u408D\u408E\u408F\uBEED\uBEF0\u4092\uBEF4\u4094\u4095\uBEFF\uFFFE\u0005\u4097\uBF24\uFFFE" + - "\u0006\u409D\uBF5C\u40A4\u40A5\uBF78\uFFFE\u0004\u40A7\uBFC0\u40AC\u40AD\uBFD5\uBFDD\uBFE8\u40B1" + - "\uC004\uC020\u40B4\u40B5\u40B6\uC059\u40B8\u40B9\uC074\uFFFE\u0005\u40BB\uC0AE\uC0B7\u40C2\u40C3" + - "\uC0BB\u40C5\uC0C3\u40C7\u40C8\uC0C7\u40CA\uC0CF\uFFFE\u0006\u40CC\uC125\u40D3\u40D4\u40D5\uC13F" + - "\u40D7\uC151\u40D9\uC157\uFFFE\t\u40DB\uC193\uFFFE\u0007\u40E5\uC1BB\uFFFE\u001E\u40ED\uC28C" + - "\uFFFE\u0007\u410C\uC2B3\u4114\u4115\u4116\uC2C0\uFFFE\n\u4118\uC2E6\uFFFE\u0006\u4123\uC302" + - "\uC30B\u412B\u412C\u412D\uC327\u412F\uC330\uFFFE\u0006\u4131\uC343\uC34C\uFFFE\u0006\u4139\uC37B" + - "\u4140\uC385\uFFFE\u0005\u4142\uC399\u4148\uC3A0\uFFFE\t\u414A\uC3BC\uFFFE\t\u4154\uC3FC" + - "\uFFFE\u000B\u415E\uC43F\uFFFE\u000B\u416A\uC477\uFFFE\u0007\u4176\uC493\uFFFE\u0011\u417E\uC4D3" + - "\uC4D4\uFFFE\u0010\u4191\uC53C\uC53F\u41A3\u41A4\u41A5\uC54F\uFFFE\u0004\u41A7\uC55F\uFFFE\u0005" + - "\u41AC\uC590\uFFFE\u0005\u41B2\uC5AB\u41B8\u41B9\uC5B6\uFFFE\u0007\u41BB\uC5F1\uC5F3\uFFFE\u0004" + - "\u41C4\uC61D\u41C9\u41CA\u41CB\uC62B\u41CD\u41CE\uC63A\uFFFE\u0010\u41D0\uC6B7\uFFFE\u0007\u41E1" + - "\uC6DF\uFFFE\u0006\u41E9\uC70B\uFFFE\u0006\u41F0\uC736\uFFFE\f\u41F7\uC77B\uFFFE\t\u4204" + - "\uC7A7\u420E\uC7AA\uFFFE\u000E\u4210\uC807\u421F\uC814\u4221\uC81B\u4223\u4224\u4225\uC839\uFFFE" + - "\u0005\u4227\uC84B\uFFFE\u000B\u422D\uC890\u4239\u423A\u423B\uC89C\uC8A0\u423E\uC8AC\u4240\uC8B0" + - "\uC8B8\uFFFE\u0005\u4243\uC8E8\uC8F0\uC8F1\uFFFE\u000B\u424B\uC92B\uFFFE\f\u4257\uC96D\uFFFE" + - "\b\u4264\uC9A4\uFFFE\t\u426D\uC9D4\uFFFE\u000E\u4277\uCA30\u4286\uCA57\uFFFE\u0006\u4288" + - "\uCA70\uFFFE\u000B\u428F\uCA97\u429B\uCAA0\uFFFE\n\u429D\uCAD2\uFFFE\u0011\u42A8\uCB2C\uFFFE" + - "\u0011\u42BA\uCB80\uFFFE\u001B\u42CC\uCBE5\u42E8\uCBF0\uFFFE\t\u42EA\uCC1F\uCC26\uCC2F\u42F6" + - "\uCC3F\uCC42\uFFFE\u0004\u42F9\uCC71\u42FE\u42FF\uCC7C\uFFFE\r\u4301\uCCE3\uCCE5\uFFFE\u000B" + - "\u4310\uCD40\uFFFE\u0012\u431C\uCDC3\uFFFE\u0010\u432F\uCE3C\uFFFE\f\u4340\uCE7B\u434D\u434E" + - "\u434F\uCE97\uCEA9\uFFFE\u0006\u4352\uCEC8\u4359\u435A\uCEFD\u435C\u435D\u435E\uCF19\uFFFE\u0010" + - "\u4360\uCF8D\uCF90\uFFFE\u0004\u4372\uCF9F\u4377\uCFAC\u4379\u437A\u437B\uCFBD\uFFFE\u001E\u437D" + - "\uD088\uFFFE\u0018\u439C\uD114\uFFFE\u0006\u43B5\uD160\u43BC\uD169\uFFFE\u0035\u43BE\uD277\u43F4" + - "\u43F5\u43F6\uD293\uFFFE\u0006\u43F8\uD2CD\u43FF\u4400\uD2E7\u4402\u4403\u4404\uD30A\u4406\u4407" + - "\uD326\uFFFE\u0007\u4409\uD359\uD360\uFFFE\u0005\u4412\uD3B2\uD3B5\u4419\u441A\uD3C7\uFFFE\u0010" + - "\u441C\uD424\uFFFE\u0012\u442D\uD4B0\uFFFE\n\u4440\uD4E9\u444B\u444C\uD505\u444E\uD510\uD519" + - "\uD520\u4452\uD524\uFFFE\b\u4454\uD55F\uD561\u445E\u445F\u4460\uD56C\u4462\uD571\uFFFE\t" + - "\u4464\uD5AC\u446E\uD5CF\uFFFE\n\u4470\uD62C\uFFFE\u0015\u447B\uD6A9\u4491\uD6B8\uFFFE\u0006" + - "\u4493\uD6D5\uFFFE\u0007\u449A\uD70C\uFFFE\u000F\u44A2\uD76D\uFFFE\u0B2E\u44B2\u4FA0\uFFFE\u027C" + - "\u4FE1\u5265\uFFFE\u0300\u525E\u5516\uFFFE\u013A\u555F\u565B\uFFFE\u0030\u569A\u56A2\uFFFE\u0196" + - "\u56CB\u586B\uFFFE\u03F9\u5862\u0000\u0003\u5C4F\u5C5D\u5E5F\u6061\u5C61\uFFFE\u07B1\u5C63\u63BB" + - "\uFFFE\u003C\u6415\u63B4\uFFFE\u00D0\u6452\u6505\uFFFE\u036B\u6523\u688D\uFFFE\u06C2\u688F\u6E8C" + - "\uFFFE\u00B4\u6F52\u6D9C\uFFFE\u0129\u7007\u7114\uFFFE\u04F5\u7131\u75E9\uFFFE\u038A\u7627\u7977" + - "\uFFFE\u026C\u79B2\u7BAA\uFFFE\u0229\u7C1F\u7E66\uFFFE\u0018\u7E49\u7E4D\uFFFE\t\u7E62\u7E4B" + - "\uFFFE\u02D5\u7E6C\u80FC\uFFFE\u02C8\u8142\u83B1\uFFFE\u0118\u840B\u848B\uFFFE\u02C8\u8524\u8749" + - "\uFFFE\u0032\u87ED\u874B\uFFFE\u06A0\u8820\u8EAF\uFFFE\u02EB\u8EC1\u91A4\uFFFE\u0004\u91AD\u9197" + - "\uFFFE\u067E\u91B2\u982C\uFFFE\b\u9831\u983D\uFFFE\u0020\u983A\u985B\uFFFE\u01F7\u985B\u9A28" + - "\uFFFE\u0384\u9A53\u9D0E\uFFFE\u00A4\u9DD8\u9E78\uFFFE\u0037\u9E7D\u9EB9\u9EBA\uFFFE\u59B9\u9EB6" + - "\u2116\uFFFE\u0063\uF870\u0000\u0015\uF86E\u6D6C\u6B6A\u6968\u6766\u6564\u6362\u6160\u5F5E\u5D5C" + - "\u5B5A\u5958\u5756\u5554\u5352\u5150\u4F4E\u4D4C\u4B4A\u4948\u4746\u4544\uF843\u2116\uFFFE\u0700" + - "\uF900"; - - - private static final String fromUnicode_ = - "\uFFFE\uAC00\u0000\u3400\u3401\u3D2E\uAC03\u3402\uAC05\uAC06\uFFFE\u0004\u3403\u3D2F\uFFFE\u0004" + - "\uAC0C\uFFFE\b\u3407\uAC18\uFFFE\u0005\u340F\uAC1E\uAC1F\u3414\uAC21\uAC22\uAC23\u3415\uFFFE" + - "\u0007\uAC25\u3416\u3417\uAC2E\u3418\u3419\u341A\uFFFE\u0006\uAC32\u341B\u341C\uAC3A\uAC3B\u341D" + - "\uAC3D\uAC3E\uAC3F\u341E\uFFFE\n\uAC41\u341F\uAC4C\u3420\uFFFE\u0006\uAC4E\u3421\uAC55\uAC56" + - "\uAC57\u3422\uAC59\uAC5A\uAC5B\u3423\uFFFE\u0013\uAC5D\u3424\u3425\uAC72\uAC73\u3426\uAC75\uAC76" + - "\u3427\u3428\u3D40\u3429\uFFFE\u0005\uAC7B\u342A\u342B\uAC82\uFFFE\u0004\u342C\u3D41\uAC88\uFFFE" + - "\u0004\u3430\uAC8D\uAC8E\uAC8F\u3434\uAC91\uAC92\u3D43\u3435\uFFFE\u0007\uAC95\u3436\u3437\uAC9E" + - "\u3438\u3439\u343A\uFFFE\u0006\uACA2\u343B\u343C\u343D\uACAB\u343E\uACAD\uACAE\u343F\u3440\uFFFE" + - "\u0007\uACB1\u3441\u3442\uACBA\u3443\u3444\u3445\uACBE\uACBF\uACC0\u3446\uACC2\uACC3\u3447\uACC5" + - "\uACC6\uACC7\u3448\uACC9\uACCA\uACCB\u3449\uFFFE\b\uACCD\u344A\uACD6\u344B\uFFFE\b\uACD8" + - "\u344C\u344D\uACE2\uACE3\u344E\uACE5\uACE6\u344F\u3450\u3D51\u3451\uACEB\u3452\uACED\uACEE\u3453" + - "\u3454\u3455\uACF2\u3456\uACF4\u3457\u3458\uACF7\uACF8\uACF9\u3D56\uACFB\u3459\u345A\uACFE\uACFF" + - "\u345B\uAD01\uAD02\uAD03\u345C\uAD05\u345D\uFFFE\u0005\uAD07\u345E\u345F\uAD0E\u3460\uAD10\u3461" + - "\uFFFE\u0006\uAD12\u3462\u3D5A\uAD1A\uAD1B\u3463\uAD1D\uAD1E\uAD1F\u3464\uFFFE\u0007\uAD21\u3D5D" + - "\u3465\uAD2A\u3D5E\u3466\u3467\uFFFE\u0006\uAD2E\u3468\u3469\uAD36\uAD37\u346A\uAD39\uAD3A\uAD3B" + - "\u346B\uFFFE\u0007\uAD3D\u346C\u346D\uAD46\u346E\uAD48\u346F\uFFFE\u0006\uAD4A\u3470\uAD51\uAD52" + - "\uAD53\u3471\uAD55\uAD56\uAD57\u3472\uFFFE\b\uAD59\u3473\uAD62\u3474\uFFFE\b\uAD64\u3475" + - "\u3476\uAD6E\uAD6F\u3477\uAD71\uAD72\uFFFE\u0004\u3478\uFFFE\u0004\uAD77\u347C\u347D\u347E\uAD7E" + - "\u347F\uAD80\u3480\u3481\uFFFE\u0005\uAD83\u3482\u3483\uAD8A\uAD8B\u3484\uAD8D\uAD8E\uAD8F\u3485" + - "\uFFFE\n\uAD91\u3D6B\u3486\u3487\uFFFE\u0006\uAD9E\u3488\uFFFE\u0012\uADA5\u3489\uFFFE\b" + - "\uADB8\u348A\u348B\uADC2\uADC3\u348C\uADC5\uADC6\uADC7\u348D\uFFFE\u0007\uADC9\u348E\u348F\uADD2" + - "\u3490\uADD4\u3D77\uFFFE\u0006\uADD6\u3491\uADDD\uADDE\uADDF\u3492\uADE1\uADE2\uADE3\u3493\uFFFE" + - "\u0007\uADE5\u3D7A\uFFFE\u000B\uADED\u3494\u3495\uADFA\uADFB\u3496\uADFD\uADFE\u3497\u3498\u3499" + - "\u3D7F\uFFFE\u0005\uAE03\u349A\u349B\uAE0A\u349C\uAE0C\u349D\uAE0E\u3D84\uAE10\u3D85\uAE12\uAE13" + - "\u349E\uFFFE\u0012\uAE15\u3D8E\uFFFE\b\uAE28\u349F\u34A0\uAE32\uAE33\u34A1\uAE35\uAE36\u34A2" + - "\u34A3\uAE39\u34A4\uAE3B\u3D91\uAE3D\uAE3E\uAE3F\u34A5\u34A6\uAE42\u34A7\u3D92\u34A8\u34A9\uAE47" + - "\uAE48\u3D94\u34AA\uAE4B\u34AB\u34AC\u34AD\uAE4F\u34AE\uAE51\uAE52\uAE53\u34AF\uAE55\u34B0\uFFFE" + - "\u0005\uAE57\u34B1\u34B2\uAE5E\u34B3\u34B4\u34B5\u3D97\uAE63\uAE64\u34B6\uAE66\uAE67\u34B7\u34B8" + - "\uAE6A\uAE6B\u34B9\uAE6D\uAE6E\uAE6F\u34BA\uFFFE\u0007\uAE71\u34BB\u34BC\uAE7A\u34BD\u34BE\u34BF" + - "\uFFFE\u0006\uAE7E\u34C0\u34C1\uFFFE\u0006\uAE86\u34C2\uFFFE\u0013\uAE8D\u3DA3\uFFFE\u001B\uAEA1" + - "\u34C3\u34C4\u34C5\uAEBF\u34C6\uAEC1\uAEC2\uAEC3\u34C7\uFFFE\u0007\uAEC5\u34C8\u34C9\uAECE\u34CA" + - "\u34CB\u34CC\uFFFE\u0006\uAED2\u34CD\u34CE\uAEDA\uAEDB\u34CF\uFFFE\u000B\uAEDD\u34D0\uAEE9\uAEEA" + - "\u34D1\uAEEC\u34D2\uFFFE\u0006\uAEEE\u34D3\uAEF5\uAEF6\uAEF7\u34D4\uAEF9\uAEFA\uAEFB\u34D5\uFFFE" + - "\u0007\uAEFD\u3DB2\uAF05\uAF06\u34D6\u34D7\uFFFE\u0004\uAF09\u34D8\uAF0E\uAF0F\u34D9\uFFFE\u001B" + - "\uAF11\u34DA\u34DB\uAF2E\uAF2F\u34DC\uAF31\u34DD\u3DB7\u34DE\uFFFE\u0007\uAF35\u34DF\u34E0\uAF3E" + - "\u34E1\uAF40\u34E2\u34E3\u34E4\uFFFE\u0004\uAF44\u34E5\u34E6\uAF4A\uAF4B\u3DBD\uAF4D\uAF4E\uAF4F" + - "\u34E7\uFFFE\u0007\uAF51\u3DBF\uAF59\uAF5A\u3DC1\u34E8\u34E9\uFFFE\u0006\uAF5E\u34EA\u34EB\uAF66" + - "\uAF67\u3DC2\uFFFE\u0010\uAF69\u34EC\uFFFE\u0006\uAF7A\u34ED\uAF81\uAF82\uAF83\u34EE\uAF85\uAF86" + - "\uAF87\u34EF\uFFFE\u0007\uAF89\u34F0\u34F1\uAF92\u3DCA\uAF94\u34F2\uFFFE\u0006\uAF96\u34F3\uFFFE" + - "\u0015\uAF9D\u3DD1\uFFFE\u0005\uAFB3\u34F4\u34F5\uAFBA\uAFBB\u34F6\uAFBD\uAFBE\u3DD2\u34F7\uFFFE" + - "\u0006\uAFC1\u34F8\u34F9\u34FA\uAFCA\u34FB\uAFCC\u34FC\u34FD\uFFFE\u0005\uAFCF\u34FE\uAFD5\uAFD6" + - "\uAFD7\u3DD6\uAFD9\uAFDA\uAFDB\u34FF\uFFFE\n\uAFDD\u3DD9\u3500\u3501\uFFFE\u0006\uAFEA\u3502" + - "\u3503\uAFF2\uAFF3\u3504\uAFF5\uAFF6\uAFF7\u3505\uFFFE\u0007\uAFF9\u3506\u3507\uB002\uB003\u3508" + - "\uFFFE\u0007\uB005\u3509\u3DDD\uB00E\uB00F\u350A\uB011\uB012\uB013\u350B\uFFFE\u0007\uB015\u350C" + - "\u350D\uB01E\uB01F\uB020\u3DE0\uFFFE\u0006\uB022\u350E\uFFFE\u001B\uB029\u350F\u3510\uB046\uB047" + - "\u3511\uB049\u3512\uB04B\u3513\uB04D\u3514\uFFFE\u0004\uB04F\u3515\u3516\u3517\uB056\u3518\uB058" + - "\u3519\uB05A\uB05B\uB05C\u351A\uB05E\uB05F\u3DE9\uFFFE\u001B\uB061\u351B\u351C\uB07E\uB07F\u351D" + - "\uB081\uB082\uB083\u351E\uFFFE\u0007\uB085\u351F\u3520\uB08E\u3521\u3DF2\u3522\uFFFE\u0006\uB092" + - "\u3523\u3524\u3525\uB09B\u3526\uB09D\uB09E\uFFFE\u0004\u3527\uFFFE\u0005\uB0A3\u352B\u352C\uB0AA" + - "\uFFFE\u0005\u352D\uB0B0\u3532\uB0B2\u3533\u3534\u3535\uB0B6\uB0B7\u3536\uB0B9\uB0BA\u3DF9\u3537" + - "\uFFFE\u0007\uB0BD\u3538\u3539\uB0C6\u353A\u353B\u353C\uFFFE\u0006\uB0CA\u353D\u353E\uB0D2\uB0D3" + - "\u353F\uB0D5\uB0D6\uB0D7\u3540\uFFFE\u0007\uB0D9\u3541\uFFFE\u0004\uB0E1\u3542\uFFFE\u0006\uB0E6" + - "\u3E00\uFFFE\u001B\uB0ED\u3543\u3544\uB10A\u3545\u3546\uB10D\uB10E\u3E03\u3547\uB111\u3548\u3549" + - "\uFFFE\u0004\uB114\u354A\u354B\uB11A\u354C\u354D\u354E\u3E05\uFFFE\u0004\uB11F\u354F\u3550\u3551" + - "\uB126\uB127\u3552\uB129\uB12A\uB12B\u3553\uFFFE\u0007\uB12D\u3554\u3555\uB136\u3556\u3557\u3558" + - "\uFFFE\u0006\uB13A\u3559\u355A\uB142\uB143\u355B\uB145\uB146\u3E0F\u355C\uFFFE\u0007\uB149\u355D" + - "\u355E\uB152\u3E11\u355F\u3560\uB156\uB157\u3561\u3E12\uB15A\uB15B\u3562\uB15D\uB15E\uB15F\u3563" + - "\uFFFE\u000E\uB161\u3E1A\uFFFE\b\uB170\u3564\u3565\u3E1C\uB17B\u3566\uB17D\uB17E\uB17F\u3567" + - "\uB181\u3568\uFFFE\u0005\uB183\u3569\u356A\uB18A\u356B\uB18C\u356C\uFFFE\u0004\uB18E\u356D\u356E" + - "\u356F\uB195\uB196\uB197\u3570\uB199\uB19A\uB19B\u3571\uFFFE\n\uB19D\u3E27\u3572\uFFFE\u0007" + - "\uB1A9\u3E29\uFFFE\u001B\uB1B1\u3573\uB1CD\uB1CE\uB1CF\u3574\uB1D1\uB1D2\uB1D3\u3575\uFFFE\u0007" + - "\uB1D5\u3576\u3577\uB1DE\u3578\uFFFE\b\uB1E0\u3579\u357A\uB1EA\uB1EB\u357B\uB1ED\uB1EE\uB1EF" + - "\u357C\uFFFE\b\uB1F1\u357D\uB1FA\u357E\uB1FC\u357F\uFFFE\u0006\uB1FE\u3580\u3581\uB206\uB207" + - "\u3582\uB209\uB20A\u3583\u3584\uFFFE\u0007\uB20D\u3585\u3586\uB216\u3587\uB218\u3588\uFFFE\u0006" + - "\uB21A\u3589\uFFFE\u0012\uB221\u3E3F\u358A\uFFFE\u0007\uB235\u358B\uFFFE\u001B\uB23D\u358C\uB259" + - "\uB25A\uB25B\u358D\uB25D\uB25E\uB25F\u358E\uFFFE\u0007\uB261\u358F\u3590\uFFFE\n\uB26A\u3591" + - "\u3592\uFFFE\u0006\uB276\u3593\uFFFE\u0007\uB27D\u3594\u3595\uB286\uB287\uB288\u3596\uFFFE\u0006" + - "\uB28A\u3597\u3598\uB292\uB293\u3599\uB295\uB296\uB297\u359A\u359B\u359C\uFFFE\u0005\uB29B\u359D" + - "\u359E\uB2A2\u359F\uB2A4\u35A0\u35A1\u3E56\uB2A8\uB2A9\u35A2\uB2AB\u35A3\uB2AD\uB2AE\uB2AF\u35A4" + - "\uB2B1\uB2B2\uB2B3\u35A5\uFFFE\f\uB2B5\u3E5E\uFFFE\u0006\uB2C2\u35A6\u35A7\uB2CA\uB2CB\u35A8" + - "\uB2CD\uB2CE\uB2CF\u35A9\u3E60\u35AA\uFFFE\u0005\uB2D3\u35AB\u35AC\uB2DA\u35AD\uB2DC\u35AE\uB2DE" + - "\uB2DF\u3E64\uB2E1\u35AF\uB2E3\u35B0\u35B1\u35B2\uB2E7\u35B3\uB2E9\uB2EA\uFFFE\u0005\u35B4\uB2F0" + - "\uB2F1\uB2F2\u35B9\u35BA\u35BB\uB2F6\uFFFE\u0005\u35BC\uB2FC\uB2FD\uB2FE\u35C1\u35C2\u35C3\uB302" + - "\uB303\u35C4\uB305\uB306\uB307\u35C5\uFFFE\u0007\uB309\u35C6\u35C7\uB312\u35C8\u35C9\u35CA\uFFFE" + - "\u0006\uB316\u35CB\uFFFE\u0014\uB31D\u3E74\uFFFE\u0006\uB332\u3E75\uFFFE\u001B\uB339\u35CC\u35CD" + - "\u35CE\uB357\u35CF\uB359\uB35A\u35D0\u35D1\uB35D\u35D2\u35D3\uFFFE\u0004\uB360\u35D4\u35D5\uB366" + - "\u35D6\u3E7A\u35D7\u3E7B\u35D8\uB36C\uB36D\u35D9\uB36F\u35DA\u35DB\uB372\uB373\u35DC\uB375\uB376" + - "\uB377\u35DD\uFFFE\u0007\uB379\u35DE\u35DF\uB382\u35E0\u35E1\u35E2\uFFFE\u0006\uB386\u35E3\uB38D" + - "\uB38E\uB38F\u35E4\uB391\uB392\uB393\u35E5\uFFFE\u0007\uB395\u3E85\uB39D\uB39E\uB39F\u35E6\u35E7" + - "\uFFFE\u0006\uB3A2\u35E8\uB3A9\uB3AA\uB3AB\u35E9\uFFFE\u0017\uB3AD\u35EA\u35EB\uB3C6\uB3C7\u35EC" + - "\uB3C9\uB3CA\u35ED\u35EE\uB3CD\u35EF\uB3CF\u35F0\uB3D1\uB3D2\u3E91\u35F1\u35F2\uB3D6\u35F3\uB3D8" + - "\u35F4\uB3DA\u35F5\uB3DC\u35F6\uB3DE\uB3DF\u35F7\uB3E1\uB3E2\uB3E3\u35F8\uB3E5\uB3E6\uB3E7\u35F9" + - "\uFFFE\u0013\uB3E9\u35FA\uB3FD\uB3FE\uB3FF\u3E9C\uFFFE\u000E\uB401\u3EA1\u35FB\uFFFE\u0007\uB411" + - "\u35FC\uB419\uB41A\uB41B\u35FD\uB41D\uB41E\uB41F\u35FE\uFFFE\u0007\uB421\u35FF\u3600\uB42A\u3601" + - "\u3EA5\uFFFE\u0007\uB42D\u3602\uFFFE\u001B\uB435\u3603\u3604\uB452\uB453\u3605\uB455\uB456\u3EB0" + - "\u3606\uFFFE\u0007\uB459\u3607\u3608\uB462\u3609\uB464\u360A\uFFFE\u0006\uB466\u360B\uFFFE\u0012" + - "\uB46D\u3EBB\u360C\uFFFE\u0007\uB481\u360D\uFFFE\u0014\uB489\u360E\uFFFE\u0006\uB49E\u360F\uB4A5" + - "\uB4A6\uB4A7\u3610\uB4A9\uB4AA\uB4AB\u3611\uFFFE\u0007\uB4AD\u3EC7\u3612\uB4B6\u3613\uB4B8\u3614" + - "\uFFFE\u0006\uB4BA\u3615\u3EC9\uB4C2\uB4C3\u3616\uB4C5\uB4C6\uB4C7\u3617\uFFFE\u0007\uB4C9\u3618" + - "\uFFFE\u0004\uB4D1\u3619\uFFFE\u0006\uB4D6\u361A\u361B\uB4DE\uB4DF\u361C\uB4E1\uB4E2\u361D\u361E" + - "\uB4E5\u361F\u3ECD\uFFFE\u0004\uB4E8\u3620\u3621\uB4EE\u3622\uB4F0\u3623\uFFFE\u0006\uB4F2\u3624" + - "\uFFFE\u001B\uB4F9\u3625\u3626\uB516\uB517\u3627\uB519\uB51A\u3628\u3629\uFFFE\u0007\uB51D\u362A" + - "\u362B\uB526\uFFFE\u0004\u362C\uB52B\uB52C\uB52D\u3ED9\uB52F\u3630\u3631\u3EDB\uB533\u3632\uB535" + - "\uB536\u3EDC\u3633\uFFFE\u0006\uB539\u3EE0\u3634\u3635\uB542\u3636\u3637\u3638\uFFFE\u0005\uB546" + - "\u3639\u363A\u363B\uB54E\uB54F\u363C\uB551\uB552\uB553\u363D\uFFFE\u0007\uB555\u363E\u363F\uB55E" + - "\u3640\u3641\u3642\uFFFE\u0006\uB562\u3EE4\uFFFE\u001B\uB569\u3EE8\uFFFE\u001B\uB585\u3643\u3644" + - "\uB5A2\uB5A3\u3645\uB5A5\uB5A6\uB5A7\u3646\uB5A9\u3647\u3648\uFFFE\u0004\uB5AC\u3649\u364A\uB5B2" + - "\u364B\u364C\u364D\uFFFE\u0005\uB5B6\u364E\u364F\u3650\uB5BE\uB5BF\u3651\uB5C1\uB5C2\uB5C3\u3652" + - "\uFFFE\u0007\uB5C5\u3653\u3654\uB5CE\u3655\u3656\u3657\uFFFE\u0006\uB5D2\u3658\uFFFE\u0013\uB5D9" + - "\u3659\uFFFE\u0007\uB5ED\u3EF4\uFFFE\u001B\uB5F5\u365A\u365B\uB612\uB613\u365C\uB615\uB616\uB617" + - "\u365D\uFFFE\f\uB619\u365E\uFFFE\u0006\uB626\u365F\uFFFE\u0007\uB62D\u3660\uFFFE\u0013\uB635" + - "\u3661\uFFFE\u001B\uB649\u3662\uB665\uB666\uB667\u3663\uFFFE\u0017\uB669\u3F12\uFFFE\u001B\uB681" + - "\u3664\u3665\uB69E\uB69F\u3666\uB6A1\uB6A2\uB6A3\u3667\uFFFE\u0006\uB6A5\u3668\u3669\uFFFE\u0004" + - "\uB6AD\u366A\uFFFE\u0006\uB6B2\u3F1A\uFFFE\u001B\uB6B9\u366B\uFFFE\u001B\uB6D5\u366C\uB6F1\uB6F2" + - "\uB6F3\u366D\uB6F5\uB6F6\uB6F7\u366E\uFFFE\u0007\uB6F9\u366F\u3670\uB702\uB703\uB704\u3671\uFFFE" + - "\u0006\uB706\u3F27\uFFFE\u001B\uB70D\u3672\u3673\uB72A\uB72B\u3674\uB72D\uB72E\u3675\u3676\uFFFE" + - "\u0007\uB731\u3677\u3678\uB73A\u3679\uFFFE\b\uB73C\u367A\uB745\uB746\uB747\u367B\uB749\uB74A" + - "\uB74B\u367C\uFFFE\u0007\uB74D\u367D\u367E\uFFFE\n\uB756\u367F\uB761\uB762\uB763\u3680\uB765" + - "\uB766\uB767\u3681\uFFFE\u0007\uB769\u3682\u3683\uB772\u3684\uB774\u3685\uFFFE\u0006\uB776\u3686" + - "\u3687\uB77E\uB77F\u3688\uB781\uB782\uB783\u3689\uFFFE\u0007\uB785\u368A\u368B\uB78E\uFFFE\u0004" + - "\u368C\uB793\uB794\uB795\uFFFE\u0004\u3690\uB79A\uB79B\u3694\uB79D\uB79E\uB79F\u3695\uFFFE\u0007" + - "\uB7A1\u3696\u3697\uB7AA\u3698\u3699\u369A\uFFFE\u0006\uB7AE\u369B\u369C\uB7B6\uB7B7\u369D\uFFFE" + - "\u000E\uB7B9\u369E\uB7C8\u369F\uFFFE\u0006\uB7CA\u3F41\uFFFE\u001B\uB7D1\u36A0\u36A1\uB7EE\uB7EF" + - "\u36A2\uB7F1\uB7F2\uB7F3\u36A3\uFFFE\u0007\uB7F5\u36A4\u36A5\uB7FE\u36A6\u36A7\u36A8\uFFFE\u0005" + - "\uB802\u36A9\u36AA\u36AB\uB80A\uB80B\u36AC\uB80D\uB80E\u3F49\u36AD\uFFFE\u0007\uB811\u36AE\u36AF" + - "\uB81A\u36B0\uB81C\u36B1\uFFFE\u0006\uB81E\u36B2\u36B3\uB826\uB827\u36B4\uB829\uB82A\uB82B\u36B5" + - "\uFFFE\u0007\uB82D\u36B6\u36B7\uB836\u36B8\u36B9\u36BA\uFFFE\u0006\uB83A\u36BB\uB841\uB842\uB843" + - "\u36BC\uFFFE\f\uB845\u36BD\uB852\u36BE\uFFFE\b\uB854\u36BF\u36C0\uB85E\uB85F\u36C1\uB861" + - "\uB862\uB863\u36C2\uFFFE\u0007\uB865\u36C3\u36C4\uB86E\u36C5\uB870\u36C6\uFFFE\u0006\uB872\u36C7" + - "\uB879\uB87A\uB87B\u36C8\uFFFE\u0010\uB87D\u36C9\uFFFE\u0006\uB88E\u3F63\uFFFE\u0013\uB895\u36CA" + - "\uFFFE\u0007\uB8A9\u36CB\uB8B1\uB8B2\uB8B3\u36CC\uB8B5\uB8B6\uB8B7\u36CD\uFFFE\u0007\uB8B9\u36CE" + - "\u36CF\uB8C2\u36D0\uB8C4\u36D1\uFFFE\u0006\uB8C6\u36D2\uB8CD\uB8CE\uB8CF\u36D3\uB8D1\uB8D2\uB8D3" + - "\u36D4\uFFFE\u0007\uB8D5\u3F6E\u36D5\uB8DE\u36D6\uB8E0\u36D7\uFFFE\u0006\uB8E2\u36D8\u36D9\uB8EA" + - "\uB8EB\u36DA\uB8ED\uB8EE\uB8EF\u36DB\uFFFE\u0007\uB8F1\u36DC\u36DD\uB8FA\u36DE\uB8FC\u36DF\uFFFE" + - "\u0006\uB8FE\u36E0\uFFFE\u0012\uB905\u3F79\u36E1\uFFFE\u0007\uB919\u36E2\uFFFE\u001B\uB921\u36E3" + - "\u36E4\uB93E\uB93F\u36E5\uB941\uB942\uB943\u36E6\uFFFE\u0007\uB945\u36E7\uB94D\uB94E\u36E8\uB950" + - "\u36E9\uFFFE\u0006\uB952\u36EA\u36EB\uB95A\uB95B\u36EC\uB95D\uB95E\uB95F\u36ED\uFFFE\u0007\uB961" + - "\u36EE\u36EF\uB96A\u36F0\uB96C\u36F1\uFFFE\u0006\uB96E\u36F2\u36F3\uB976\uB977\u36F4\uB979\uB97A" + - "\uB97B\u36F5\uFFFE\u0007\uB97D\u36F6\u36F7\uB986\u36F8\uB988\u36F9\u36FA\uB98B\uB98C\u36FB\u36FC" + - "\uB98F\u3F8C\uFFFE\u001B\uB991\u36FD\u36FE\uB9AE\uB9AF\u36FF\uB9B1\uB9B2\uB9B3\u3700\uFFFE\u0007" + - "\uB9B5\u3701\u3702\uB9BE\u3703\uB9C0\u3704\uFFFE\u0006\uB9C2\u3705\u3706\uB9CA\uB9CB\u3707\uB9CD" + - "\uFFFE\u0005\u3708\uFFFE\u0005\uB9D3\u370D\u370E\uB9DA\u370F\uB9DC\u3710\u3711\u3F9D\uB9E0\u3712" + - "\uB9E2\u3713\u3714\u3715\uB9E6\uB9E7\u3716\uB9E9\uB9EA\uB9EB\u3717\uFFFE\u0007\uB9ED\u3718\u3719" + - "\uB9F6\uFFFE\u0004\u371A\u3FA2\uFFFE\u0004\uB9FC\u371E\u371F\uFFFE\u0006\uBA02\u3720\uFFFE\f" + - "\uBA09\u3721\uFFFE\u0006\uBA16\u3FAA\uFFFE\u001B\uBA1D\u3722\u3723\uBA3A\uBA3B\u3724\uBA3D\uBA3E" + - "\uBA3F\u3725\uBA41\u3726\uFFFE\u0005\uBA43\u3727\u3728\uBA4A\u3729\uBA4C\u372A\u372B\uFFFE\u0004" + - "\uBA4F\u372C\u372D\u372E\uBA56\uBA57\u372F\uBA59\uBA5A\uBA5B\u3730\uFFFE\u0007\uBA5D\u3731\u3732" + - "\uBA66\u3733\u3734\u3735\uBA6A\u3FB3\uBA6C\u3FB4\uBA6E\uBA6F\u3736\u3737\uBA72\uBA73\u3738\uBA75" + - "\uBA76\uBA77\u3739\uFFFE\u0007\uBA79\u3FB7\uBA81\uBA82\u373A\u373B\u373C\uBA86\u373D\uFFFE\u0004" + - "\uBA88\u373E\uFFFE\u001B\uBA8D\u373F\u3740\uBAAA\u3741\u3742\uBAAD\uBAAE\u3FC5\u3743\uBAB1\u3744" + - "\uFFFE\u0005\uBAB3\u3745\u3746\uBABA\u3747\uBABC\u3748\uFFFE\u0005\uBABE\u3FC9\u3749\uBAC5\uBAC6" + - "\uBAC7\u374A\uFFFE\u000F\uBAC9\u374B\u374C\uFFFE\u0006\uBADA\u3FD0\uFFFE\u001B\uBAE1\u374D\uBAFD" + - "\uBAFE\uBAFF\u374E\uBB01\uBB02\uBB03\u374F\uFFFE\b\uBB05\u3750\uBB0E\u3751\uBB10\u3752\uFFFE" + - "\u0006\uBB12\u3753\uBB19\uBB1A\uBB1B\u3754\uBB1D\uBB1E\uBB1F\u3755\uFFFE\b\uBB21\u3756\uBB2A" + - "\u3757\uFFFE\b\uBB2C\u3758\u3759\u375A\uBB37\u375B\uBB39\uBB3A\uFFFE\u0004\u375C\uFFFE\u0005" + - "\uBB3F\u3760\u3761\uBB46\u3762\uBB48\u3763\uBB4A\uBB4B\uBB4C\u3764\uBB4E\u3765\u3766\uBB51\uBB52" + - "\uBB53\u3767\uBB55\uBB56\uBB57\u3768\uFFFE\b\uBB59\u3769\uBB62\u376A\uFFFE\b\uBB64\u376B" + - "\uFFFE\u001B\uBB6D\u376C\uBB89\uBB8A\uBB8B\u376D\uBB8D\uBB8E\uBB8F\u376E\uFFFE\u0013\uBB91\u376F" + - "\uBBA5\uBBA6\uBBA7\u3770\uBBA9\uBBAA\uBBAB\u3771\uFFFE\u0007\uBBAD\u3772\uBBB5\uBBB6\u3773\uFFFE" + - "\b\uBBB8\u3774\u3FF7\uBBC2\uBBC3\u3775\uBBC5\uBBC6\uBBC7\u3776\uFFFE\u0007\uBBC9\u3777\uBBD1" + - "\uBBD2\u3778\uBBD4\u3FFD\uFFFE\u0006\uBBD6\u3FFF\uBBDD\uBBDE\uBBDF\u4001\uFFFE\u0017\uBBE1\u3779" + - "\u377A\uBBFA\uBBFB\u377B\uBBFD\uBBFE\u377C\u377D\uBC01\u377E\uFFFE\u0005\uBC03\u377F\u3780\uBC0A" + - "\u3781\u3782\u3783\u400A\u3784\uBC10\u3785\uBC12\uBC13\uFFFE\u0005\u3786\uBC19\uBC1A\uFFFE\u0005" + - "\u378B\uFFFE\u0004\uBC20\u3790\u3791\uBC26\u3792\u400E\u3793\uBC2A\uBC2B\uBC2C\u3794\uBC2E\uBC2F" + - "\u3795\u3796\uBC32\uBC33\u3797\uBC35\uBC36\u4012\u3798\uFFFE\u0007\uBC39\u3799\u379A\uBC42\u379B" + - "\u379C\u379D\uBC46\uBC47\uBC48\u379E\uBC4A\uBC4B\u379F\u37A0\uBC4E\uBC4F\u37A1\uFFFE\u000B\uBC51" + - "\u4015\u37A2\uFFFE\n\uBC5E\u4019\uFFFE\u001B\uBC69\u37A3\u37A4\uBC86\uBC87\u37A5\uBC89\uBC8A" + - "\u37A6\u37A7\uBC8D\u37A8\uFFFE\u0005\uBC8F\u37A9\u37AA\uBC96\u37AB\u4020\u37AC\u37AD\uBC9B\u4021" + - "\uBC9D\uBC9E\uBC9F\u37AE\u37AF\uBCA2\uBCA3\u37B0\uBCA5\uBCA6\u37B1\u37B2\uFFFE\u0007\uBCA9\u37B3" + - "\u37B4\uBCB2\u37B5\u37B6\u37B7\uBCB6\uBCB7\uBCB8\u4025\uBCBA\uBCBB\u37B8\u37B9\uBCBE\uBCBF\u37BA" + - "\uBCC1\uBCC2\uBCC3\u37BB\uFFFE\u0007\uBCC5\u4028\u37BC\uBCCE\u37BD\u37BE\u37BF\u4029\u402A\u402B" + - "\u37C0\uBCD6\uBCD7\u37C1\uBCD9\uBCDA\uBCDB\u37C2\uFFFE\u0017\uBCDD\u37C3\u37C4\u37C5\uBCF7\u37C6" + - "\uBCF9\uBCFA\uBCFB\u37C7\uFFFE\u0007\uBCFD\u37C8\u37C9\uBD06\u37CA\uBD08\u37CB\uFFFE\u0006\uBD0A" + - "\u37CC\uBD11\uBD12\uBD13\u37CD\uFFFE\u000E\uBD15\u403F\u37CE\uFFFE\u0007\uBD25\u37CF\uFFFE\u0013" + - "\uBD2D\u37D0\uFFFE\u0007\uBD41\u37D1\u37D2\uBD4A\uBD4B\u37D3\uBD4D\uBD4E\uBD4F\u37D4\uFFFE\u0007" + - "\uBD51\u37D5\u37D6\uFFFE\n\uBD5A\u37D7\uBD65\uBD66\uBD67\u37D8\uFFFE\u0017\uBD69\u37D9\u37DA" + - "\uBD82\uBD83\u37DB\uBD85\uBD86\uFFFE\u0004\u37DC\uFFFE\u0005\uBD8B\u37E0\u37E1\uBD92\u37E2\uBD94" + - "\u37E3\uBD96\u4053\uBD98\u37E4\u37E5\uBD9B\u37E6\uFFFE\u0007\uBD9D\u37E7\uFFFE\u000B\uBDA5\u37E8" + - "\uBDB1\uBDB2\uBDB3\u405D\uBDB5\uBDB6\uBDB7\u37E9\uFFFE\u001B\uBDB9\u37EA\u37EB\uBDD6\uBDD7\u37EC" + - "\uBDD9\uBDDA\uBDDB\u37ED\uFFFE\f\uBDDD\u37EE\uFFFE\u0006\uBDEA\u37EF\uBDF1\uBDF2\uBDF3\u37F0" + - "\uBDF5\uBDF6\uBDF7\u37F1\uFFFE\u0007\uBDF9\u37F2\uBE01\uBE02\u37F3\uBE04\u37F4\uFFFE\u0006\uBE06" + - "\u37F5\u37F6\uBE0E\uBE0F\u37F7\uBE11\uBE12\uBE13\u37F8\uBE15\uBE16\uBE17\u4071\uBE19\uBE1A\uBE1B" + - "\u37F9\u37FA\uBE1E\u37FB\uBE20\u4073\uFFFE\u0006\uBE22\u4077\uFFFE\u001B\uBE29\u37FC\u37FD\uBE46" + - "\uBE47\u37FE\uBE49\uBE4A\u407F\u37FF\uBE4D\u3800\uFFFE\u0005\uBE4F\u3801\u3802\uBE56\u3803\uBE58" + - "\u3804\u3805\u3806\uFFFE\u0004\uBE5C\u3807\u3808\uBE62\uBE63\u3809\uBE65\uBE66\uBE67\u380A\uBE69" + - "\u380B\uFFFE\u0005\uBE6B\u380C\u380D\uBE72\u380E\u380F\u3810\uFFFE\u0005\uBE76\u3811\u3812\u3813" + - "\uBE7E\uBE7F\u3814\uBE81\uBE82\uBE83\u3815\uFFFE\u0007\uBE85\u3816\u3817\uBE8E\u3818\u3819\u381A" + - "\uFFFE\u0006\uBE92\u381B\u381C\uBE9A\uBE9B\u408B\uFFFE\u000B\uBE9D\u381D\uFFFE\u000B\uBEA9\u408C" + - "\uFFFE\u001B\uBEB5\u381E\u381F\uBED2\uBED3\u3820\uBED5\uBED6\u3821\u3822\uFFFE\u0007\uBED9\u3823" + - "\uBEE1\uBEE2\u3824\u3825\u3826\uFFFE\u0006\uBEE6\u3827\u4090\uBEEE\uBEEF\u4091\uBEF1\uBEF2\uBEF3" + - "\u4093\uFFFE\n\uBEF5\u4096\uBF00\u3828\uFFFE\u0006\uBF02\u3829\u382A\uFFFE\u000E\uBF0A\u382B" + - "\u382C\uBF1A\u382D\u382E\u382F\uFFFE\u0006\uBF1E\u409C\uFFFE\u001B\uBF25\u3830\u3831\uBF42\uBF43" + - "\u3832\uBF45\uBF46\uBF47\u3833\uFFFE\u0007\uBF49\u3834\u3835\uBF52\uBF53\uBF54\u3836\uFFFE\u0006" + - "\uBF56\u40A3\uFFFE\u001B\uBF5D\u40A6\uFFFE\u001B\uBF79\u3837\uFFFE\u001B\uBF95\u3838\uFFFE\u000F" + - "\uBFB1\u40AB\uFFFE\u0004\uBFC1\u3839\uFFFE\u0006\uBFC6\u383A\u383B\uBFCE\uBFCF\u383C\uBFD1\uBFD2" + - "\uBFD3\u383D\u40AE\uFFFE\u0006\uBFD6\u383E\u40AF\uBFDE\u383F\uBFE0\u3840\uFFFE\u0006\uBFE2\u40B0" + - "\uFFFE\u001B\uBFE9\u40B2\uFFFE\u001B\uC005\u40B3\uFFFE\u001B\uC021\u3841\uFFFE\u0014\uC03D\u3842" + - "\uFFFE\u0006\uC052\u3843\u40B7\uC05A\uC05B\u3844\uC05D\uC05E\uC05F\u3845\uFFFE\u0007\uC061\u3846" + - "\u3847\uFFFE\n\uC06A\u40BA\uFFFE\u001B\uC075\u3848\u3849\uC092\uC093\u384A\uC095\uC096\uC097" + - "\u384B\uFFFE\u0007\uC099\u384C\u384D\uC0A2\u384E\uC0A4\u384F\uFFFE\u0006\uC0A6\u3850\u3851\u40C0" + - "\u3852\u3853\uC0B1\uC0B2\uFFFE\u0004\u3854\u40C1\uC0B8\uC0B9\uC0BA\u40C4\u3858\u3859\uC0BE\u385A" + - "\u385B\u385C\uC0C2\u40C6\uC0C4\u385D\uC0C6\u40C9\u385E\u385F\uC0CA\uC0CB\u3860\uC0CD\uC0CE\u40CB" + - "\u3861\uFFFE\u0007\uC0D1\u3862\u3863\uC0DA\u3864\u3865\u3866\uFFFE\u0006\uC0DE\u3867\u3868\uC0E6" + - "\uC0E7\u3869\uC0E9\uC0EA\uC0EB\u386A\uFFFE\u0007\uC0ED\u386B\u386C\uC0F6\u386D\uC0F8\u386E\uFFFE" + - "\u0006\uC0FA\u386F\uC101\uC102\uC103\u3870\uC105\uC106\uC107\u3871\uFFFE\u0007\uC109\u3872\uFFFE" + - "\u0004\uC111\u3873\uFFFE\u0006\uC116\uFFFE\u0005\u3874\uC121\uC122\u3879\u387A\u40D2\u387B\u387C" + - "\uFFFE\u0004\uC128\u387D\u387E\uC12E\u387F\u3880\u3881\uFFFE\u0004\uC132\u3882\uC137\u3883\u3884" + - "\uC13A\uC13B\u3885\uC13D\uC13E\u40D6\u3886\uFFFE\u0007\uC141\u3887\u3888\uC14A\u3889\u388A\u388B" + - "\uC14E\uC14F\uC150\u40D8\uC152\uC153\u388C\u388D\uC156\u40DA\u388E\uC159\uC15A\uC15B\u388F\uFFFE" + - "\u0007\uC15D\u3890\u3891\uC166\u3892\u3893\u3894\uFFFE\u0006\uC16A\u3895\uC171\uC172\uC173\u3896" + - "\uC175\uC176\uC177\u3897\uFFFE\f\uC179\u3898\uFFFE\u0006\uC186\u3899\u389A\u389B\uC18F\u389C" + - "\uC191\uC192\u40E4\u389D\uC195\u389E\uFFFE\u0005\uC197\u389F\u38A0\uC19E\u38A1\uC1A0\u38A2\uC1A2" + - "\uC1A3\uC1A4\u38A3\uC1A6\uC1A7\u38A4\u38A5\uC1AA\uC1AB\u38A6\uC1AD\uC1AE\uC1AF\u38A7\uFFFE\n" + - "\uC1B1\u40EC\uC1BC\u38A8\uFFFE\u0006\uC1BE\u38A9\uC1C5\uC1C6\uC1C7\u38AA\uC1C9\uC1CA\uC1CB\u38AB" + - "\uFFFE\u0007\uC1CD\u38AC\uC1D5\uC1D6\u38AD\u38AE\uFFFE\u0007\uC1D9\u38AF\uC1E1\uC1E2\uC1E3\u38B0" + - "\uC1E5\uC1E6\uC1E7\u38B1\uFFFE\u0007\uC1E9\u38B2\u38B3\uC1F2\u38B4\uFFFE\b\uC1F4\u38B5\u38B6" + - "\uC1FE\uC1FF\u38B7\uC201\uC202\uC203\u38B8\uFFFE\u0007\uC205\u38B9\u38BA\uC20E\u38BB\uC210\u38BC" + - "\uFFFE\u0006\uC212\u38BD\u38BE\uC21A\uC21B\u38BF\uC21D\uC21E\u38C0\u38C1\uFFFE\u0007\uC221\u38C2" + - "\u38C3\uC22A\u38C4\uC22C\u38C5\uC22E\u38C6\uC230\u38C7\u38C8\uC233\u38C9\uFFFE\u0013\uC235\u38CA" + - "\uFFFE\u0007\uC249\u38CB\u38CC\uC252\uC253\u38CD\uC255\uC256\uC257\u38CE\uFFFE\u0007\uC259\u38CF" + - "\uFFFE\u0004\uC261\u38D0\uFFFE\u0006\uC266\u38D1\u38D2\uC26E\uC26F\u38D3\uC271\uC272\uC273\u38D4" + - "\uFFFE\u0007\uC275\u38D5\u38D6\uC27E\u38D7\uC280\u38D8\uFFFE\u0006\uC282\u38D9\u38DA\uC28A\uC28B" + - "\u410B\uC28D\uC28E\uC28F\u38DB\uFFFE\u0007\uC291\u38DC\uC299\uC29A\u38DD\uC29C\u38DE\uFFFE\u0006" + - "\uC29E\u38DF\u38E0\uC2A6\uC2A7\u38E1\uC2A9\uC2AA\uC2AB\u38E2\u38E3\uFFFE\u0005\uC2AE\u4113\u38E4" + - "\u38E5\uC2B6\u38E6\uC2B8\u38E7\uFFFE\u0006\uC2BA\u4117\uFFFE\u001B\uC2C1\u38E8\u38E9\uC2DE\uC2DF" + - "\u38EA\uC2E1\uC2E2\u38EB\u38EC\uC2E5\u4122\uFFFE\u0004\uC2E7\u38ED\u38EE\u38EF\uC2EE\u38F0\uC2F0" + - "\u38F1\uFFFE\u0004\uC2F2\u38F2\uC2F7\u38F3\u38F4\uC2FA\u38F5\u38F6\uC2FD\uC2FE\uC2FF\u38F7\uC301" + - "\u4129\uFFFE\u0005\uC303\u38F8\u38F9\uC30A\u412A\u38FA\u38FB\uFFFE\u0005\uC30E\u38FC\u38FD\u38FE" + - "\uC316\uC317\u38FF\uC319\uC31A\uC31B\u3900\uFFFE\u0007\uC31D\u3901\u3902\uC326\u412E\u3903\u3904" + - "\uFFFE\u0006\uC32A\u4130\uFFFE\u0012\uC331\u4137\uC344\u3905\uFFFE\u0006\uC346\u4138\uFFFE\u001B" + - "\uC34D\u3906\u3907\uC36A\uC36B\u3908\uC36D\uC36E\uC36F\u3909\uC371\u390A\uFFFE\u0005\uC373\u390B" + - "\u390C\uC37A\u413F\u390D\u390E\uFFFE\u0006\uC37E\u390F\u4141\uC386\uC387\u3910\uC389\uC38A\uC38B" + - "\u3911\uFFFE\f\uC38D\u4147\uFFFE\u0006\uC39A\u4149\uFFFE\u001B\uC3A1\u4153\uC3BD\uC3BE\uC3BF" + - "\u3912\uFFFE\u0017\uC3C1\u3913\u3914\uC3DA\uC3DB\u3915\uC3DD\uC3DE\u3916\u3917\uC3E1\u3918\uFFFE" + - "\u0005\uC3E3\u3919\u391A\uC3EA\uC3EB\uC3EC\u391B\uFFFE\u0006\uC3EE\u391C\u391D\uC3F6\uC3F7\u391E" + - "\uC3F9\uC3FA\uC3FB\u415D\uFFFE\u000B\uC3FD\u391F\uFFFE\u0007\uC409\u3920\uFFFE\u0013\uC411\u3921" + - "\uFFFE\u0007\uC425\u3922\uC42D\uC42E\uC42F\u3923\uC431\uC432\uC433\u3924\uFFFE\u0007\uC435\u3925" + - "\u3926\uC43E\u4169\uFFFE\b\uC440\u3927\uFFFE\u001B\uC449\u3928\u3929\uC466\uC467\u392A\uC469" + - "\uC46A\uC46B\u392B\uFFFE\u0007\uC46D\u392C\u392D\uC476\u4175\uC478\u392E\uFFFE\u0006\uC47A\u392F" + - "\uFFFE\u0012\uC481\u417D\u3930\uFFFE\u0007\uC495\u3931\uFFFE\u001B\uC49D\u3932\uC4B9\uC4BA\uC4BB" + - "\u3933\uFFFE\u0016\uC4BD\u418F\u4190\uFFFE\u0014\uC4D5\u3934\uFFFE\u0006\uC4EA\u3935\u3936\uC4F2" + - "\uC4F3\u3937\uC4F5\uC4F6\uC4F7\u3938\uC4F9\u3939\uFFFE\u0004\uC4FB\u393A\u393B\u393C\uFFFE\n" + - "\uC502\u393D\uC50D\uC50E\uC50F\u393E\uC511\uC512\uC513\u393F\uFFFE\u0007\uC515\u3940\uFFFE\u000B" + - "\uC51D\u3941\u3942\uC52A\uC52B\u3943\uC52D\uC52E\uC52F\u3944\uFFFE\u0007\uC531\u3945\u3946\uC53A" + - "\u3947\u41A1\u3948\uC53E\u41A2\uFFFE\u0004\uC540\u3949\u394A\uC546\uC547\u394B\u394C\u394D\uC54B" + - "\u394E\u394F\u3950\u41A6\uC550\uC551\uC552\u3951\u3952\u3953\uC556\u3954\u3955\u3956\uC55A\uC55B" + - "\uC55C\u3957\u3958\u41AB\u3959\u395A\uC562\uC563\u395B\uC565\uC566\uC567\u395C\uFFFE\u0007\uC569" + - "\u395D\u395E\uC572\u395F\u3960\u3961\uFFFE\u0006\uC576\u3962\u3963\uC57E\uC57F\u3964\uC581\uC582" + - "\uC583\u3965\uC585\uC586\u3966\uFFFE\u0004\uC588\u3967\u3968\uC58E\u3969\u41B1\u396A\uC592\uC593" + - "\uC594\u396B\uC596\u396C\u396D\uC599\uC59A\uC59B\u396E\uC59D\uC59E\uC59F\u396F\uFFFE\b\uC5A1" + - "\u3970\uC5AA\u41B7\uFFFE\b\uC5AC\u3971\u3972\u41BA\uC5B7\u3973\u3974\uC5BA\uFFFE\u0004\u3975" + - "\uFFFE\u0005\uC5BF\uFFFE\u0007\u3979\uC5CB\u3980\uC5CD\u3981\uC5CF\u3982\u3983\uC5D2\uC5D3\u3984" + - "\uC5D5\uC5D6\uC5D7\u3985\uFFFE\u0007\uC5D9\u3986\u3987\uC5E2\u3988\uC5E4\u3989\uFFFE\u0006\uC5E6" + - "\u398A\u398B\u398C\uC5EF\u398D\u41C2\uC5F2\u41C3\u398E\uC5F5\u398F\u3990\uFFFE\u0004\uC5F8\uFFFE" + - "\u0006\u3991\uC602\uC603\uC604\uFFFE\u0004\u3997\uC609\uC60A\uC60B\u399B\uC60D\uC60E\uC60F\u399C" + - "\uFFFE\u0007\uC611\u399D\u399E\uC61A\u399F\u39A0\u41C8\uFFFE\u0006\uC61E\u39A1\u39A2\uC626\uC627" + - "\u39A3\uC629\uC62A\u41CC\u39A4\u39A5\u39A6\uC62F\u39A7\uC631\uC632\u39A8\u39A9\u39AA\uC636\u39AB" + - "\uC638\u39AC\u41CF\u39AD\uFFFE\u0004\uC63C\u39AE\u39AF\uC642\uC643\u39B0\uC645\uC646\uC647\u39B1" + - "\uFFFE\u0007\uC649\u39B2\u39B3\uC652\u39B4\u39B5\u39B6\uFFFE\u0006\uC656\u39B7\u39B8\uC65E\uC65F" + - "\u39B9\uFFFE\u000B\uC661\u39BA\uC66D\uC66E\u39BB\uC670\u39BC\uFFFE\u0006\uC672\u39BD\u39BE\uC67A" + - "\uC67B\u39BF\uC67D\uC67E\uC67F\u39C0\uFFFE\u0007\uC681\u39C1\u39C2\uC68A\u39C3\uC68C\u39C4\uFFFE" + - "\u0006\uC68E\u39C5\u39C6\uC696\uC697\u39C7\uC699\uC69A\uC69B\u39C8\uFFFE\u0007\uC69D\u39C9\u39CA" + - "\uC6A6\u39CB\uC6A8\u39CC\uFFFE\u0006\uC6AA\u39CD\u39CE\uC6B2\uC6B3\u39CF\uC6B5\uC6B6\u41E0\u39D0" + - "\u39D1\u39D2\uFFFE\u0005\uC6BB\u39D3\u39D4\uC6C2\u39D5\uC6C4\u39D6\uFFFE\u0006\uC6C6\u39D7\u39D8" + - "\uC6CE\uC6CF\u39D9\uC6D1\uC6D2\uC6D3\u39DA\uFFFE\u0007\uC6D5\u39DB\u39DC\uC6DE\u41E8\u39DD\u39DE" + - "\uFFFE\u0006\uC6E2\u39DF\u39E0\uC6EA\uC6EB\u39E1\uC6ED\uC6EE\uC6EF\u39E2\uFFFE\u0007\uC6F1\u39E3" + - "\u39E4\uC6FA\uC6FB\uC6FC\u39E5\uFFFE\u0006\uC6FE\u39E6\u39E7\uC706\uC707\u39E8\uC709\uC70A\u41EF" + - "\u39E9\uFFFE\u0007\uC70D\u39EA\u39EB\uC716\u39EC\uC718\u39ED\uFFFE\u0006\uC71A\u39EE\u39EF\uC722" + - "\uC723\u39F0\uC725\uC726\uC727\u39F1\uFFFE\u0007\uC729\u39F2\u39F3\uC732\u39F4\uC734\u39F5\u41F6" + - "\u39F6\uFFFE\u0004\uC738\u39F7\u39F8\uC73E\uC73F\u39F9\uC741\uC742\uC743\u39FA\uFFFE\u0005\uC745" + - "\u39FB\uC74B\u39FC\u39FD\uC74E\u39FE\uC750\uFFFE\b\u39FF\uC759\uC75A\uC75B\u3A07\uC75D\uC75E" + - "\uC75F\u3A08\uFFFE\u0007\uC761\u3A09\uC769\uC76A\u3A0A\uFFFE\b\uC76C\u3A0B\u3A0C\uC776\uC777" + - "\u3A0D\uC779\uC77A\u4203\u3A0E\u3A0F\u3A10\uFFFE\u0004\uC77F\u3A11\u3A12\u3A13\uC786\uFFFE\u0004" + - "\u3A14\uC78B\uC78C\uC78D\u3A18\uC78F\u3A19\u3A1A\uC792\uC793\u3A1B\uC795\u3A1C\u3A1D\u3A1E\uC799" + - "\u3A1F\uFFFE\u0005\uC79B\u3A20\u3A21\uC7A2\uFFFE\u0004\u3A22\u420D\uC7A8\uC7A9\u420F\uC7AB\u3A26" + - "\u3A27\uC7AE\uC7AF\u3A28\uC7B1\uC7B2\uC7B3\u3A29\uFFFE\u0007\uC7B5\u3A2A\u3A2B\uC7BE\u3A2C\u3A2D" + - "\u3A2E\uFFFE\u0006\uC7C2\u3A2F\u3A30\uC7CA\uC7CB\u3A31\uC7CD\u3A32\uC7CF\u3A33\uFFFE\u0007\uC7D1" + - "\u3A34\uFFFE\u0004\uC7D9\u3A35\uFFFE\u0006\uC7DE\u3A36\uC7E5\uC7E6\uC7E7\u3A37\uC7E9\uC7EA\uC7EB" + - "\u3A38\uFFFE\u0013\uC7ED\u3A39\u3A3A\uC802\uC803\u3A3B\uC805\uC806\u421E\u3A3C\uC809\u3A3D\uFFFE" + - "\u0005\uC80B\u3A3E\u3A3F\uC812\u3A40\u4220\u3A41\u3A42\uFFFE\u0004\uC817\u4222\u3A43\u3A44\uC81E" + - "\uC81F\u3A45\uC821\uC822\uC823\u3A46\uFFFE\u0007\uC825\u3A47\u3A48\uC82E\u3A49\uC830\u3A4A\uFFFE" + - "\u0006\uC832\u3A4B\u4226\uC83A\uC83B\u3A4C\uC83D\uC83E\uC83F\u3A4D\uFFFE\u0007\uC841\u3A4E\u3A4F" + - "\uC84A\u422C\u3A50\u3A51\uFFFE\u0006\uC84E\u3A52\uFFFE\u001B\uC855\u3A53\u3A54\uC872\uC873\u3A55" + - "\uC875\uC876\uC877\u3A56\uC879\u3A57\uFFFE\u0005\uC87B\u3A58\u3A59\uC882\u3A5A\uC884\u3A5B\u3A5C" + - "\u3A5D\uC888\uC889\uC88A\u3A5E\u3A5F\u3A60\uC88E\uC88F\u4238\uC891\uC892\uC893\u3A61\uFFFE\u0007" + - "\uC895\u423C\u3A62\uC89E\u3A63\u423D\u3A64\uFFFE\u0006\uC8A2\u3A65\uC8A9\uC8AA\uC8AB\u423F\uC8AD" + - "\uC8AE\uC8AF\u4241\uFFFE\u0007\uC8B1\u4242\uC8B9\uC8BA\uC8BB\u3A66\u3A67\uFFFE\u0006\uC8BE\u3A68" + - "\uC8C5\uC8C6\uC8C7\u3A69\uC8C9\uC8CA\uC8CB\u3A6A\uFFFE\u0007\uC8CD\u3A6B\u3A6C\uC8D6\u3A6D\uC8D8" + - "\u3A6E\uFFFE\u0006\uC8DA\u3A6F\u3A70\uC8E2\uC8E3\u3A71\uC8E5\uC8E6\uC8E7\u4248\uFFFE\u0007\uC8E9" + - "\u4249\u424A\uC8F2\uC8F3\uC8F4\u3A72\uFFFE\u0006\uC8F6\u3A73\u3A74\uC8FE\uC8FF\u3A75\uC901\uC902" + - "\uC903\u3A76\u3A77\u3A78\uFFFE\u0005\uC907\u3A79\u3A7A\uC90E\u3A7B\uC910\u3A7C\uFFFE\u0006\uC912" + - "\u3A7D\uFFFE\u0012\uC919\u4256\u3A7E\uFFFE\u0007\uC92D\u3A7F\uFFFE\u001B\uC935\u3A80\u3A81\uC952" + - "\uC953\u3A82\uC955\uC956\uC957\u3A83\uFFFE\u0007\uC959\u3A84\u3A85\uC962\u3A86\uFFFE\b\uC964" + - "\u3A87\u4263\uC96E\uC96F\u3A88\uC971\uC972\uC973\u3A89\uFFFE\u0007\uC975\u3A8A\uFFFE\u000B\uC97D" + - "\u3A8B\u3A8C\uC98A\uC98B\u3A8D\uC98D\uC98E\uC98F\u3A8E\uFFFE\u0007\uC991\u3A8F\u3A90\uC99A\u3A91" + - "\uC99C\u3A92\uFFFE\u0006\uC99E\u426C\uFFFE\u001B\uC9A5\u3A93\u3A94\uC9C2\uC9C3\u3A95\uC9C5\uC9C6" + - "\u3A96\u3A97\uC9C9\u3A98\uFFFE\u0005\uC9CB\u3A99\u3A9A\uC9D2\u3A9B\u4276\u3A9C\u3A9D\uC9D7\uC9D8" + - "\u3A9E\u3A9F\uC9DB\u3AA0\u3AA1\uC9DE\uC9DF\u3AA2\uC9E1\u3AA3\uC9E3\u3AA4\uC9E5\uC9E6\u3AA5\uFFFE" + - "\u0004\uC9E8\u3AA6\u3AA7\uC9EE\u3AA8\u3AA9\u3AAA\uFFFE\u0006\uC9F2\u3AAB\u3AAC\uC9FA\uC9FB\u3AAD" + - "\uC9FD\uC9FE\uC9FF\u3AAE\uFFFE\u0007\uCA01\u3AAF\u3AB0\uCA0A\u3AB1\u3AB2\u3AB3\uFFFE\u0006\uCA0E" + - "\u3AB4\uCA15\uCA16\uCA17\u3AB5\uFFFE\u0010\uCA19\u3AB6\uFFFE\u0006\uCA2A\u4285\uFFFE\u001B\uCA31" + - "\u3AB7\u3AB8\uCA4E\uCA4F\u3AB9\uCA51\uCA52\uCA53\u3ABA\uCA55\uCA56\u4287\uFFFE\u0004\uCA58\u3ABB" + - "\u3ABC\uCA5E\u3ABD\u3ABE\u3ABF\uFFFE\u0006\uCA62\u3AC0\uFFFE\u0007\uCA69\u428E\uFFFE\f\uCA71" + - "\u3AC1\uFFFE\u0006\uCA7E\u3AC2\uFFFE\u0012\uCA85\u429A\u3AC3\uFFFE\u0007\uCA99\u429C\uFFFE\u001B" + - "\uCAA1\u3AC4\u3AC5\uCABE\uCABF\u3AC6\uCAC1\uCAC2\uCAC3\u3AC7\uFFFE\u0007\uCAC5\u3AC8\u3AC9\uCACE" + - "\u3ACA\uCAD0\u3ACB\u42A7\u3ACC\uFFFE\u0004\uCAD4\u3ACD\u3ACE\uFFFE\u0006\uCADA\u3ACF\uFFFE\u000B" + - "\uCAE1\u3AD0\uFFFE\u0007\uCAED\u3AD1\uFFFE\u0013\uCAF5\u3AD2\uFFFE\u0007\uCB09\u3AD3\uCB11\uCB12" + - "\uCB13\u3AD4\uCB15\uCB16\uCB17\u3AD5\uFFFE\u0007\uCB19\u3AD6\u3AD7\uFFFE\n\uCB22\u42B9\uFFFE" + - "\u0014\uCB2D\u3AD8\uFFFE\u0006\uCB42\u3AD9\u3ADA\uCB4A\uCB4B\u3ADB\uCB4D\uCB4E\uCB4F\u3ADC\uFFFE" + - "\u0007\uCB51\u3ADD\u3ADE\uCB5A\uCB5B\uCB5C\u3ADF\uFFFE\u0006\uCB5E\u3AE0\uFFFE\u0013\uCB65\u3AE1" + - "\u3AE2\uFFFE\u0006\uCB7A\u42CB\uFFFE\u001B\uCB81\u3AE3\uFFFE\u001B\uCB9D\u3AE4\uFFFE\u001B\uCBB9" + - "\u3AE5\uFFFE\u000F\uCBD5\u3AE6\u42E7\uCBE6\u3AE7\uCBE8\u3AE8\uFFFE\u0006\uCBEA\u42E9\uFFFE\u001B" + - "\uCBF1\u3AE9\u3AEA\uCC0E\uCC0F\u3AEB\uCC11\uCC12\uCC13\u3AEC\uFFFE\u0007\uCC15\u3AED\u3AEE\uCC1E" + - "\u42F3\uCC20\u3AEF\u3AF0\uCC23\uCC24\uCC25\u42F4\u3AF1\u3AF2\u3AF3\uCC2A\uCC2B\u3AF4\uCC2D\u3AF5" + - "\u42F5\u3AF6\uFFFE\u0007\uCC31\u3AF7\u3AF8\uCC3A\uFFFE\u0004\u3AF9\u42F7\uCC40\uCC41\u42F8\uCC43" + - "\u3AFD\u3AFE\uCC46\uCC47\u3AFF\uCC49\uCC4A\uCC4B\u3B00\uFFFE\u0007\uCC4D\u3B01\u3B02\uCC56\u3B03" + - "\u3B04\u3B05\uFFFE\u0006\uCC5A\u3B06\uCC61\uCC62\uCC63\u3B07\uCC65\u3B08\uCC67\u3B09\uFFFE\u0007" + - "\uCC69\u3B0A\u42FD\uCC72\uCC73\uCC74\u3B0B\uFFFE\u0006\uCC76\u4300\uFFFE\u001B\uCC7D\u3B0C\u3B0D" + - "\uCC9A\uCC9B\u3B0E\uCC9D\uCC9E\uCC9F\u3B0F\uFFFE\u0007\uCCA1\u3B10\u3B11\uCCAA\u3B12\u3B13\u3B14" + - "\uFFFE\u0006\uCCAE\u3B15\u3B16\uCCB6\uCCB7\u3B17\uCCB9\uCCBA\uCCBB\u3B18\uFFFE\u0007\uCCBD\u3B19" + - "\u3B1A\uCCC6\u3B1B\uCCC8\u3B1C\uFFFE\u0006\uCCCA\u3B1D\uCCD1\uCCD2\uCCD3\u3B1E\uFFFE\u000E\uCCD5" + - "\u430E\u3B1F\u430F\uFFFE\u0006\uCCE6\u3B20\uCCED\uCCEE\uCCEF\u3B21\uFFFE\u0010\uCCF1\u3B22\uFFFE" + - "\u0006\uCD02\u3B23\u3B24\uCD0A\uCD0B\u3B25\uCD0D\uCD0E\uCD0F\u3B26\uFFFE\u0007\uCD11\u3B27\u3B28" + - "\uCD1A\u3B29\uCD1C\u3B2A\uFFFE\u0006\uCD1E\u3B2B\uCD25\uCD26\uCD27\u3B2C\uCD29\uCD2A\uCD2B\u3B2D" + - "\uFFFE\f\uCD2D\u3B2E\uFFFE\u0006\uCD3A\u431B\uFFFE\u001B\uCD41\u3B2F\uCD5D\uCD5E\uCD5F\u3B30" + - "\uCD61\uCD62\uCD63\u3B31\uFFFE\u0007\uCD65\u3B32\u3B33\uCD6E\u3B34\uCD70\u3B35\uFFFE\u0006\uCD72" + - "\u3B36\uFFFE\u000F\uCD79\u3B37\uFFFE\u000B\uCD89\u3B38\u3B39\uCD96\uCD97\u3B3A\uCD99\uCD9A\uCD9B" + - "\u3B3B\uFFFE\u0007\uCD9D\u3B3C\u3B3D\uCDA6\u3B3E\uCDA8\u3B3F\uFFFE\u0006\uCDAA\u3B40\uFFFE\u0012" + - "\uCDB1\u432E\u3B41\uFFFE\u0007\uCDC5\u3B42\uCDCD\uCDCE\uCDCF\u3B43\uFFFE\u0017\uCDD1\u3B44\uCDE9" + - "\uCDEA\uCDEB\u3B45\uCDED\uCDEE\uCDEF\u3B46\uFFFE\u0007\uCDF1\u3B47\u3B48\uCDFA\u3B49\uCDFC\u3B4A" + - "\uFFFE\u0006\uCDFE\u3B4B\uCE05\uCE06\uCE07\u3B4C\uCE09\uCE0A\uCE0B\u3B4D\uFFFE\u0007\uCE0D\u3B4E" + - "\uFFFE\u0004\uCE15\u3B4F\uFFFE\u0006\uCE1A\u3B50\u3B51\uCE22\uCE23\u3B52\uCE25\uCE26\uCE27\u3B53" + - "\uFFFE\u0007\uCE29\u3B54\u3B55\uCE32\u3B56\uCE34\u3B57\uFFFE\u0006\uCE36\u433F\uFFFE\u001B\uCE3D" + - "\u3B58\u3B59\uCE5A\uCE5B\u3B5A\uCE5D\uCE5E\u3B5B\u3B5C\u3B5D\uFFFE\u0006\uCE62\u3B5E\u3B5F\uCE6A" + - "\u3B60\uCE6C\u3B61\uFFFE\u0006\uCE6E\u3B62\u3B63\uCE76\uCE77\u3B64\uCE79\uCE7A\u434C\u3B65\uFFFE" + - "\u0007\uCE7D\u3B66\u3B67\uCE86\u3B68\uCE88\u3B69\uFFFE\u0006\uCE8A\u3B6A\u3B6B\uCE92\uCE93\u3B6C" + - "\uCE95\uCE96\u4350\u3B6D\uFFFE\u0007\uCE99\u3B6E\u3B6F\uCEA2\u3B70\u3B71\u3B72\uCEA6\uCEA7\uCEA8" + - "\u4351\uCEAA\uCEAB\u3B73\u3B74\uFFFE\u0013\uCEAE\u3B75\uFFFE\u0006\uCEC2\u4358\uFFFE\u001B\uCEC9" + - "\u3B76\u3B77\uCEE6\uCEE7\u3B78\uCEE9\uCEEA\u3B79\u3B7A\uFFFE\u0007\uCEED\u3B7B\u3B7C\uCEF6\u3B7D" + - "\u3B7E\u3B7F\uCEFA\uCEFB\uCEFC\u435B\uCEFE\uCEFF\u3B80\u3B81\uCF02\uCF03\u3B82\uCF05\uCF06\uCF07" + - "\u3B83\uFFFE\u0007\uCF09\u3B84\u3B85\uCF12\u3B86\uCF14\u3B87\uCF16\uCF17\uCF18\u435F\uCF1A\uCF1B" + - "\u3B88\uCF1D\uCF1E\uCF1F\u3B89\uCF21\uCF22\uCF23\u3B8A\uFFFE\u0007\uCF25\u3B8B\u3B8C\uCF2E\u3B8D" + - "\u3B8E\u3B8F\uFFFE\u0006\uCF32\u3B90\uFFFE\u001B\uCF39\u3B91\u3B92\uCF56\uCF57\u3B93\uCF59\uCF5A" + - "\uCF5B\u3B94\uFFFE\u0007\uCF5D\u3B95\u3B96\uCF66\u3B97\uCF68\u3B98\uFFFE\u0006\uCF6A\u3B99\u3B9A" + - "\uCF72\uCF73\u3B9B\uCF75\uCF76\uCF77\u3B9C\uFFFE\u0007\uCF79\u3B9D\uFFFE\u0004\uCF81\u3B9E\uFFFE" + - "\u0006\uCF86\u3B9F\u4370\uCF8E\uCF8F\u4371\uFFFE\u000E\uCF91\u4376\uCFA0\u3BA0\uFFFE\u0006\uCFA2" + - "\u3BA1\uCFA9\uCFAA\uCFAB\u4378\uCFAD\uCFAE\uCFAF\u3BA2\uFFFE\f\uCFB1\u437C\uFFFE\u0006\uCFBE" + - "\u3BA3\uFFFE\u001B\uCFC5\u3BA4\u3BA5\uCFE2\uCFE3\u3BA6\uCFE5\uCFE6\uCFE7\u3BA7\uFFFE\u0007\uCFE9" + - "\u3BA8\u3BA9\uCFF2\u3BAA\uCFF4\u3BAB\uFFFE\u0006\uCFF6\u3BAC\uCFFD\uCFFE\uCFFF\u3BAD\uD001\uD002" + - "\uD003\u3BAE\uFFFE\f\uD005\u3BAF\uFFFE\u0006\uD012\u3BB0\uFFFE\u0014\uD019\u3BB1\uFFFE\u0006" + - "\uD02E\u3BB2\u3BB3\uD036\uD037\u3BB4\uD039\uD03A\uD03B\u3BB5\uFFFE\u0007\uD03D\u3BB6\u3BB7\uD046" + - "\u3BB8\uD048\u3BB9\uFFFE\u0006\uD04A\u3BBA\uD051\uD052\uD053\u3BBB\uD055\uD056\uD057\u3BBC\uFFFE" + - "\u0007\uD059\u3BBD\uFFFE\u000B\uD061\u3BBE\u3BBF\uD06E\uD06F\u3BC0\uD071\uD072\uD073\u3BC1\uFFFE" + - "\u0007\uD075\u3BC2\u3BC3\uD07E\uD07F\uD080\u3BC4\uFFFE\u0006\uD082\u439B\uFFFE\u001B\uD089\u3BC5" + - "\u3BC6\uD0A6\uD0A7\u3BC7\uD0A9\uD0AA\uD0AB\u3BC8\uFFFE\u0007\uD0AD\u3BC9\u3BCA\uD0B6\u3BCB\uD0B8" + - "\u3BCC\uFFFE\u0006\uD0BA\u3BCD\u3BCE\uD0C2\uD0C3\u3BCF\uD0C5\uD0C6\uD0C7\u3BD0\u3BD1\uFFFE\u0006" + - "\uD0CA\u3BD2\u3BD3\uD0D2\u3BD4\u3BD5\u3BD6\uFFFE\u0006\uD0D6\u3BD7\u3BD8\uD0DE\uD0DF\u3BD9\uD0E1" + - "\uD0E2\uD0E3\u3BDA\uFFFE\u0007\uD0E5\u3BDB\u3BDC\uD0EE\u3BDD\u3BDE\u3BDF\uFFFE\u0006\uD0F2\u3BE0" + - "\uFFFE\u0014\uD0F9\u3BE1\uFFFE\u0006\uD10E\u43B4\uFFFE\u001B\uD115\u3BE2\u3BE3\uD132\uD133\u3BE4" + - "\uD135\uD136\uD137\u3BE5\uD139\u3BE6\uFFFE\u0005\uD13B\u3BE7\u3BE8\uD142\u3BE9\u3BEA\u3BEB\uFFFE" + - "\u0006\uD146\u3BEC\u3BED\uD14E\uD14F\u3BEE\uD151\uD152\uD153\u3BEF\uFFFE\u0007\uD155\u3BF0\u3BF1" + - "\uD15E\u3BF2\u43BB\u3BF3\uFFFE\u0006\uD162\u3BF4\u43BD\uD16A\uD16B\u3BF5\uFFFE\u000F\uD16D\u3BF6" + - "\uFFFE\u0007\uD17D\u3BF7\uD185\uD186\uD187\u3BF8\uFFFE\u0017\uD189\u3BF9\u3BFA\uD1A2\uD1A3\u3BFB" + - "\uD1A5\uD1A6\uD1A7\u3BFC\uFFFE\u0007\uD1A9\u3BFD\u3BFE\uD1B2\u3BFF\uD1B4\u3C00\uFFFE\u0004\uD1B6" + - "\u3C01\uD1BB\u3C02\uD1BD\uD1BE\uD1BF\u3C03\uFFFE\u0017\uD1C1\u3C04\uFFFE\u001B\uD1D9\u3C05\uD1F5" + - "\uD1F6\uD1F7\u3C06\uFFFE\u000E\uD1F9\u3C07\uD208\u3C08\uFFFE\u0006\uD20A\u3C09\uFFFE\u001B\uD211" + - "\u3C0A\u3C0B\uD22E\uD22F\u3C0C\uD231\uD232\uD233\u3C0D\uFFFE\u0007\uD235\u3C0E\u3C0F\uD23E\u3C10" + - "\uD240\u3C11\uFFFE\u0006\uD242\u3C12\uFFFE\u0013\uD249\u3C13\uFFFE\u0007\uD25D\u3C14\uFFFE\u0012" + - "\uD265\u43F3\uFFFE\b\uD278\u3C15\u3C16\uD282\uD283\u3C17\uD285\uD286\uD287\u3C18\uFFFE\u0007" + - "\uD289\u3C19\u3C1A\uD292\u43F7\uD294\u3C1B\uFFFE\u0006\uD296\u3C1C\uD29D\uD29E\uD29F\u3C1D\uD2A1" + - "\uD2A2\uD2A3\u3C1E\uFFFE\u0007\uD2A5\u3C1F\uFFFE\u0004\uD2AD\u3C20\uFFFE\u0006\uD2B2\u3C21\u3C22" + - "\uD2BA\uD2BB\u3C23\uD2BD\uD2BE\u3C24\u3C25\uD2C1\u3C26\uFFFE\u0005\uD2C3\u3C27\u3C28\uD2CA\u3C29" + - "\uD2CC\u43FE\uFFFE\u0006\uD2CE\u3C2A\uD2D5\uD2D6\uD2D7\u3C2B\uD2D9\uD2DA\uD2DB\u3C2C\uFFFE\u0007" + - "\uD2DD\u3C2D\u3C2E\uD2E6\u4401\uFFFE\b\uD2E8\u3C2F\u3C30\uD2F2\uD2F3\u3C31\uD2F5\uD2F6\uD2F7" + - "\u3C32\uFFFE\u0007\uD2F9\u3C33\u3C34\uD302\u3C35\uD304\u3C36\uFFFE\u0004\uD306\u4405\uD30B\u3C37" + - "\u3C38\u3C39\uD30F\u3C3A\uD311\uD312\uD313\u3C3B\uD315\u3C3C\uFFFE\u0005\uD317\u3C3D\u3C3E\uD31E" + - "\u3C3F\u3C40\u3C41\uD322\uD323\uD324\u3C42\u4408\uD327\u3C43\u3C44\uD32A\uD32B\u3C45\uD32D\uD32E" + - "\uD32F\u3C46\uFFFE\u0007\uD331\u3C47\u3C48\uD33A\u3C49\u3C4A\u3C4B\uFFFE\u0006\uD33E\u3C4C\u3C4D" + - "\uFFFE\u0013\uD346\u4410\uFFFE\u0006\uD35A\u4411\uFFFE\u001B\uD361\u3C4E\u3C4F\uD37E\uD37F\u3C50" + - "\uD381\uD382\uD383\u3C51\uFFFE\u0007\uD385\u3C52\u3C53\uD38E\u3C54\u3C55\u3C56\uFFFE\u0006\uD392" + - "\u3C57\u3C58\uD39A\uD39B\u3C59\uD39D\uD39E\uD39F\u3C5A\uFFFE\u0007\uD3A1\u3C5B\u3C5C\uD3AA\u3C5D" + - "\uD3AC\u3C5E\uFFFE\u0004\uD3AE\u4417\uD3B3\u3C5F\u4418\uD3B6\uD3B7\u3C60\uD3B9\uD3BA\uD3BB\u3C61" + - "\uFFFE\u0007\uD3BD\u3C62\u3C63\uD3C6\u441B\u3C64\u3C65\uFFFE\u0006\uD3CA\u3C66\uFFFE\u0007\uD3D1" + - "\u3C67\uFFFE\b\uD3D9\u3C68\uD3E2\u3C69\uFFFE\b\uD3E4\u3C6A\u3C6B\uD3EE\uD3EF\u3C6C\uD3F1" + - "\uD3F2\uD3F3\u3C6D\uFFFE\u0007\uD3F5\u3C6E\u3C6F\uD3FE\u3C70\uD400\u3C71\uFFFE\u0006\uD402\u3C72" + - "\uFFFE\u0014\uD409\u3C73\uFFFE\u0006\uD41E\u442C\uFFFE\u001B\uD425\u3C74\uD441\uD442\uD443\u3C75" + - "\uFFFE\u0017\uD445\u3C76\uD45D\uD45E\uD45F\u3C77\uD461\uD462\uD463\u3C78\uFFFE\b\uD465\u3C79" + - "\uD46E\u3C7A\uFFFE\b\uD470\u3C7B\u3C7C\uD47A\uD47B\u3C7D\uD47D\uD47E\u3C7E\u3C7F\uD481\u3C80" + - "\uFFFE\u0005\uD483\u3C81\u3C82\uD48A\u3C83\uD48C\u3C84\uFFFE\u0006\uD48E\u3C85\uFFFE\u0014\uD495" + - "\u3C86\uFFFE\u0006\uD4AA\u443F\uFFFE\u001B\uD4B1\u3C87\uD4CD\uD4CE\uD4CF\u3C88\uD4D1\uD4D2\uD4D3" + - "\u3C89\uFFFE\u0007\uD4D5\u3C8A\uD4DD\uD4DE\u3C8B\uFFFE\b\uD4E0\u3C8C\u444A\uD4EA\uD4EB\u3C8D" + - "\uD4ED\uD4EE\uD4EF\u3C8E\uFFFE\u0007\uD4F1\u3C8F\uD4F9\uD4FA\u3C90\uD4FC\u3C91\uFFFE\u0006\uD4FE" + - "\u3C92\u444D\uD506\uD507\u3C93\uD509\uD50A\uD50B\u3C94\uD50D\uD50E\uD50F\u444F\uD511\uD512\uD513" + - "\u3C95\u3C96\uD516\u3C97\uD518\u4450\uFFFE\u0006\uD51A\u4451\uD521\uD522\uD523\u4453\uFFFE\u0017" + - "\uD525\u3C98\u3C99\uD53E\uD53F\u3C9A\uD541\uD542\uD543\u3C9B\uFFFE\u0007\uD545\u3C9C\u3C9D\uD54E" + - "\u3C9E\uD550\u3C9F\uFFFE\u0006\uD552\u3CA0\u3CA1\uD55A\uD55B\u3CA2\uD55D\uD55E\u445C\u3CA3\u445D" + - "\uD562\uD563\uD564\u3CA4\uD566\uD567\u3CA5\u3CA6\uD56A\u3CA7\u4461\u3CA8\uD56E\uD56F\uD570\u4463" + - "\uD572\uD573\u3CA9\u3CAA\uD576\uD577\u3CAB\uD579\uD57A\uD57B\u3CAC\uFFFE\u0007\uD57D\u3CAD\u3CAE" + - "\uD586\u3CAF\u3CB0\u3CB1\uFFFE\u0006\uD58A\u3CB2\uFFFE\u0014\uD591\u3CB3\uFFFE\u0006\uD5A6\u446D" + - "\uFFFE\u001B\uD5AD\u3CB4\u3CB5\uD5CA\uD5CB\u3CB6\uD5CD\uD5CE\u446F\u3CB7\uD5D1\u3CB8\uFFFE\u0005" + - "\uD5D3\u3CB9\u3CBA\uD5DA\u3CBB\uD5DC\u3CBC\uFFFE\u0006\uD5DE\u3CBD\u3CBE\uD5E6\uD5E7\u3CBF\uD5E9" + - "\uD5EA\uD5EB\u3CC0\uFFFE\u0007\uD5ED\u3CC1\u3CC2\uD5F6\u3CC3\uD5F8\u3CC4\uFFFE\u0006\uD5FA\u3CC5" + - "\u3CC6\uD602\uD603\u3CC7\uD605\uD606\uD607\u3CC8\uFFFE\u0007\uD609\u3CC9\u3CCA\uD612\u3CCB\u3CCC" + - "\u3CCD\uFFFE\u0006\uD616\u3CCE\uD61D\uD61E\uD61F\u3CCF\uD621\uD622\uD623\u3CD0\uFFFE\u0007\uD625" + - "\u447A\u3CD1\uFFFE\n\uD62E\u3CD2\u3CD3\uD63A\uD63B\u3CD4\uD63D\uD63E\uD63F\u3CD5\uFFFE\u0004" + - "\uD641\u3CD6\uD646\uD647\u3CD7\u3CD8\uD64A\u3CD9\uD64C\u3CDA\uD64E\uD64F\uD650\u3CDB\uD652\uD653" + - "\u3CDC\u3CDD\uD656\uD657\u3CDE\uD659\uD65A\uD65B\u3CDF\uFFFE\n\uD65D\u3CE0\uD668\u3CE1\uFFFE" + - "\u0006\uD66A\u3CE2\u3CE3\uD672\uD673\u3CE4\uFFFE\u000E\uD675\u3CE5\uD684\u3CE6\uFFFE\u0006\uD686" + - "\u3CE7\u3CE8\uD68E\uD68F\u3CE9\uD691\uD692\uD693\u3CEA\uFFFE\b\uD695\u3CEB\uD69E\u3CEC\uD6A0" + - "\u3CED\uFFFE\u0006\uD6A2\u3CEE\u4490\uD6AA\uD6AB\u3CEF\uD6AD\uD6AE\uD6AF\u3CF0\uFFFE\u0007\uD6B1" + - "\u4492\u3CF1\uD6BA\u3CF2\uFFFE\b\uD6BC\u3CF3\u3CF4\uD6C6\uD6C7\u3CF5\uD6C9\uD6CA\uD6CB\u3CF6" + - "\uFFFE\u0004\uD6CD\u3CF7\uD6D2\uD6D3\u3CF8\u4499\uD6D6\u3CF9\uD6D8\u3CFA\uFFFE\u0006\uD6DA\u3CFB" + - "\uD6E1\uD6E2\uD6E3\u3CFC\uD6E5\uD6E6\uD6E7\u3CFD\uFFFE\u0007\uD6E9\u3CFE\uFFFE\u0004\uD6F1\u3CFF" + - "\uFFFE\u0006\uD6F6\u3D00\u3D01\uD6FE\uD6FF\u3D02\uD701\uD702\uD703\u3D03\uFFFE\u0007\uD705\u44A1" + - "\uFFFE\u0004\uD70D\u3D04\uFFFE\u0006\uD712\u3D05\u3D06\uD71A\uD71B\u3D07\uD71D\uD71E\uD71F\u3D08" + - "\uFFFE\u0007\uD721\u3D09\u3D0A\uD72A\u3D0B\uD72C\u3D0C\uFFFE\u0006\uD72E\u3D0D\u3D0E\uD736\uD737" + - "\u3D0F\uD739\uD73A\uD73B\u3D10\uFFFE\u0007\uD73D\u3D11\uD745\uD746\u3D12\uD748\u3D13\uFFFE\u0006" + - "\uD74A\u3D14\u3D15\uD752\uD753\u3D16\uD755\uFFFE\u0004\u3D17\uFFFE\u0006\uD75A\u3D1B\u3D1C\uD762" + - "\u3D1D\uD764\u3D1E\uD766\uD767\uD768\u3D1F\uD76A\uD76B\u3D20\u44B1\uD76E\uD76F\u3D21\uD771\uD772" + - "\uD773\u3D22\uFFFE\u0007\uD775\u3D23\u3D24\uD77E\uD77F\uD780\u3D25\uFFFE\u0006\uD782\u3D26\u3D27" + - "\uD78A\uD78B\u3D28\uD78D\uD78E\uD78F\u3D29\uFFFE\u0007\uD791\u3D2A\u3D2B\uD79A\u3D2C\uD79C\u3D2D" + - "\uFFFE\u20A5\uD79E\u0000\u0015\uF8FE\uFDFC\uFBFA\uF9F8\uF7F6\uF5F4\uF3F2\uF1F0\uEFEE\uEDEC\uEBEA" + - "\uE9E8\uE7E6\uE5E4\uE3E2\uE1E0\uDFDE\uDDDC\uDBDA\uD9D8\uD7D6\uD5D4\uF8D3\uFFFE\u0791\uF86F"; - - - ConvTable61952() - { - super(61952, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable62211.java b/cvsroot/src/com/ibm/as400/access/ConvTable62211.java deleted file mode 100644 index b1b24fd54..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable62211.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable62211.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable62211 extends ConvTableBidiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF\u05E0\u05E1\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u001A\u05EA\u001A\u001A\u00A0\u001A\u001A\u001A\u2017\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u001A\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u001A\u001A\u001A\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u001A\u001A\u20AC\u00B8\u20AA\u00A4" + - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u001A\u001A\u001A\u001A\u001A\u00AE" + - "\u005E\u00A3\u00A5\u2022\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u005B\u005D\u203E\u00A8\u00B4\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u001A\u001A\u001A\u001A\u001A" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u202D\u202E\u202C\u001A\u001A" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u001A\u001A\u001A\u001A\u001A" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u202A\u202B\u200E\u200F\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9BA\uE0BB\uB06D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u743F\u4AB1\u9FB2\u6AB5\uBDB4\u3F8A\u5FCA\uAF3F\u908F\uEAFA\uBEA0\uB63F\u9DDA\u3F8B\uB7B8\uB93F" + - "\uFFFF\u000B\u3F3F\u3FBF\uFFFF\u000F\u3F3F\u3FE1\uFFFF\u026C\u3F3F\u4142\u4344\u4546\u4748\u4951" + - "\u5253\u5455\u5657\u5859\u6263\u6465\u6667\u6869\u713F\uFFFF\u0D11\u3F3F\uFDFE\u0000\u0004\u3F3F" + - "\u3F3F\u783F\u3F3F\u3F3F\uB33F\u3F3F\u3F3F\u3F3F\uFBFC\uDDDB\uDC3F\uFFFF\u0007\u3F3F\uBC3F\uFFFF" + - "\u0035\u3F3F\u9E3F\u9C3F\uFFFF\u6F29\u3F3F\u3F5A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1" + - "\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8" + - "\uD9E2\uE3E4\uE5E6\uE7E8\uE9BA\uE0BB\uB06D\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798" + - "\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable62211() - { - super(62211, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable62224.java b/cvsroot/src/com/ibm/as400/access/ConvTable62224.java deleted file mode 100644 index fd8da54ae..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable62224.java +++ /dev/null @@ -1,64 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable62224.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable62224 extends ConvTableBidiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u0651\uFE7D\u0640\u200B\u0621\u0622\uFE82\u0623\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\uFE84\u0624\u001A\u001A\u0626\u0627\uFE8E\u0628\uFE91\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u0629\u062A\uFE97\u062B\uFE9B\u062C\uFE9F\u062D\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\uFEA3\u062E\uFEA7\u062F\u0630\u0631\u0632\u0633\uFEB3\u060C\u003A\u0023\u0040\'\u003D\"" + - "\u0634\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\uFEB7\u0635\uFEBB\u0636\uFEBF\u0637" + - "\u0638\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u0639\uFECA\uFECB\uFECC\u063A\uFECE" + - "\uFECF\u00F7\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\uFED0\u0641\uFED3\u0642\uFED7\u0643" + - "\uFEDB\u0644\uFEF5\uFEF6\uFEF7\uFEF8\u001A\u001A\uFEFB\uFEFC\uFEDF\u0645\uFEE3\u0646\uFEE7\u0647" + - "\u061B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\uFEEB\u001A\uFEEC\u001A\u0648" + - "\u061F\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u0649\uFEF0\u064A\uFEF2\uFEF3\u0660" + - "\u00D7\u2007\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u0661\u0662\u001A\u0663\u0664\u0665" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u20AC\u0666\u0667\u0668\u0669\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE93F\u3F3F\u3F6D" + - "\u3F81\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA93F\u4F3F\u3F07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\u4A3F\u3F3F\u6A3F\u3F3F\u3F3F\u5FCA\uFFFF\u0014\u3F3F\u3FE0\uFFFF\u000F\u3F3F\u3FA1\uFFFF" + - "\u028A\u3F3F\u793F\uFFFF\u0006\u3F3F\u3FC0\u3F3F\u3FD0\u3F46\u4749\u5256\u5556\u5862\u6365\u6769" + - "\u7173\u7475\u7677\u808B\u8D8F\u909A\u9E3F\u3F3F\u3F3F\u44AB\uADAF\uB1BB\uBDBF\uCFDA\uDC3F\u3F3F" + - "\u3F3F\u3F42\uFFFF\u0007\u3F3F\uDFEA\uEBED\uEEEF\uFBFC\uFDFE\u6C6B\u4B5C\uFFFF\u0CCC\u3F3F\u3FE1" + - "\u3F3F\u3F45\uFFFF\u0050\u3F3F\uFA3F\uFFFF\u6EE1\u3F3F\u4044\u4045\u403F\u4044\u4044\u4044\u4243" + - "\u4044\u4647\u4849\u5152\u5256\u5755\u5555\u5556\u5758\u5859\u5962\u6263\u6364\u6465\u6566\u6667" + - "\u6768\u6869\u6970\u7071\u7172\u7273\u7374\u7475\u7576\u7677\u7778\u7880\u808A\u8A8B\u8B8C\u8C8D" + - "\u8D8E\u8E8F\u8F8F\u8F90\u9090\u909A\u9B9C\u9D9E\u9FA0\uAAAB\uABAC\uACAD\uADAE\uAEAF\uAFB0\uB0B1" + - "\uB1BA\uBABB\uBBBC\uBCBD\uBDBE\uBEBF\uBFCB\uCDCF\uCFDA\uDBDC\uDDDE\uDEB2\uB3B4\uB5B8\uB9B8\uB93F" + - "\u3F3F\u3F5A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E" + - "\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE93F\u3F3F" + - "\u3F6D\u3F81\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA93F\u4F3F" + - "\uFFFF\u0051\u3F3F"; - - - ConvTable62224() - { - super(62224, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable62235.java b/cvsroot/src/com/ibm/as400/access/ConvTable62235.java deleted file mode 100644 index 802d32339..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable62235.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable62235.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable62235 extends ConvTableBidiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF\u05E0\u05E1\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u001A\u05EA\u001A\u001A\u00A0\u001A\u001A\u001A\u2017\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u001A\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u001A\u001A\u001A\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u001A\u001A\u20AC\u00B8\u20AA\u00A4" + - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u001A\u001A\u001A\u001A\u001A\u00AE" + - "\u005E\u00A3\u00A5\u2022\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u005B\u005D\u203E\u00A8\u00B4\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u001A\u001A\u001A\u001A\u001A" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u202D\u202E\u202C\u001A\u001A" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u001A\u001A\u001A\u001A\u001A" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u202A\u202B\u200E\u200F\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9BA\uE0BB\uB06D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u743F\u4AB1\u9FB2\u6AB5\uBDB4\u3F8A\u5FCA\uAF3F\u908F\uEAFA\uBEA0\uB63F\u9DDA\u3F8B\uB7B8\uB93F" + - "\uFFFF\u000B\u3F3F\u3FBF\uFFFF\u000F\u3F3F\u3FE1\uFFFF\u026C\u3F3F\u4142\u4344\u4546\u4748\u4951" + - "\u5253\u5455\u5657\u5859\u6263\u6465\u6667\u6869\u713F\uFFFF\u0D11\u3F3F\uFDFE\u0000\u0004\u3F3F" + - "\u3F3F\u783F\u3F3F\u3F3F\uB33F\u3F3F\u3F3F\u3F3F\uFBFC\uDDDB\uDC3F\uFFFF\u0007\u3F3F\uBC3F\uFFFF" + - "\u0035\u3F3F\u9E3F\u9C3F\uFFFF\u6F29\u3F3F\u3F5A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1" + - "\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8" + - "\uD9E2\uE3E4\uE5E6\uE7E8\uE9BA\uE0BB\uB06D\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798" + - "\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable62235() - { - super(62235, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable62245.java b/cvsroot/src/com/ibm/as400/access/ConvTable62245.java deleted file mode 100644 index bfdb532b0..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable62245.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable62245.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable62245 extends ConvTableBidiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF\u05E0\u05E1\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u001A\u05EA\u001A\u001A\u00A0\u001A\u001A\u001A\u2017\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u001A\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u001A\u001A\u001A\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u001A\u001A\u20AC\u00B8\u20AA\u00A4" + - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u001A\u001A\u001A\u001A\u001A\u00AE" + - "\u005E\u00A3\u00A5\u2022\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u005B\u005D\u203E\u00A8\u00B4\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u001A\u001A\u001A\u001A\u001A" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u202D\u202E\u202C\u001A\u001A" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u001A\u001A\u001A\u001A\u001A" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u202A\u202B\u200E\u200F\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9BA\uE0BB\uB06D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u743F\u4AB1\u9FB2\u6AB5\uBDB4\u3F8A\u5FCA\uAF3F\u908F\uEAFA\uBEA0\uB63F\u9DDA\u3F8B\uB7B8\uB93F" + - "\uFFFF\u000B\u3F3F\u3FBF\uFFFF\u000F\u3F3F\u3FE1\uFFFF\u026C\u3F3F\u4142\u4344\u4546\u4748\u4951" + - "\u5253\u5455\u5657\u5859\u6263\u6465\u6667\u6869\u713F\uFFFF\u0D11\u3F3F\uFDFE\u0000\u0004\u3F3F" + - "\u3F3F\u783F\u3F3F\u3F3F\uB33F\u3F3F\u3F3F\u3F3F\uFBFC\uDDDB\uDC3F\uFFFF\u0007\u3F3F\uBC3F\uFFFF" + - "\u0035\u3F3F\u9E3F\u9C3F\uFFFF\u6F29\u3F3F\u3F5A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1" + - "\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8" + - "\uD9E2\uE3E4\uE5E6\uE7E8\uE9BA\uE0BB\uB06D\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798" + - "\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable62245() - { - super(62245, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable62251.java b/cvsroot/src/com/ibm/as400/access/ConvTable62251.java deleted file mode 100644 index 731ea779e..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable62251.java +++ /dev/null @@ -1,66 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable62251.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable62251 extends ConvTableBidiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u060C\u00E0\u061B\u0640\u061F\u00E7\u0621\u0622\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u0623\u00EE\u00EF\u0624\u0625\u0021\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u0626\u00C0\u0627\u0628\u0629\u00C7\u062A\u062B\u002C\u0025\u005F\u003E\u003F" + - "\u062C\u00C9\u00CA\u00CB\u00C8\u062D\u00CE\u00CF\u062E\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u062F\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u0630\u0631\u0632\u0633" + - "\u0634\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u0635\u0636\u00E6\u0637\u00C6\u20AC" + - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u0638\u0639\u063A\u005B\u0641\u0642" + - "\u0643\u0644\u0645\u0646\u00A9\u00A7\u0647\u0152\u0153\u0178\u0648\u0649\u064A\u005D\u064B\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u064C\u064D\u064E\u064F" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u0650\u00FB\u00FC\u00F9\u0651\u00FF" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u0652\u00D4\u200C\u200D\u200E\u200F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u001A\u00DB\u00DC\u00D9\u00A4\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9AD\uE0BD\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\u3F3F\uFE3F\u0000\u0006\u3FB5\uB48A\uCA3F\u3F3F\uA03F\u3F8B\u3F3F\u643F\u623F\u3F3F\u9E68" + - "\u7471\u7273\u3F3F\u7677\u3F3F\u3F3F\uEB3F\u3FBF\u3FFD\u3FFB\uFC3F\u3F3F\u443F\u423F\u3F3F\u9C48" + - "\u5451\u5253\u3F3F\u5657\u3F3F\u3F3F\uCB3F\u3FE1\u3FDD\u3FDB\uDC3F\u3FDF\uFFFF\u0029\u3F3F\uB7B8" + - "\uFFFF\u0012\u3F3F\uB93F\uFFFF\u0249\u3F3F\u433F\uFFFF\u0006\u3F3F\u3F45\u3F3F\u3F47\u3F49\u4A55" + - "\u5859\u6365\u6667\u696A\u7075\u7880\u8C8D\u8E8F\u909A\u9B9D\uAAAB\uAC3F\u3F3F\u3F3F\u46AE\uAFB0" + - "\uB1B2\uB3B6\uBABB\uBCBE\uCCCD\uCECF\uDADE\uEA3F\uFFFF\u0006\u3F3F\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9" + - "\u6C6B\u4B5C\uFFFF\u0CCF\u3F3F\uECED\uEEEF\uFFFF\u004E\u3F3F\u9F3F\uFFFF\u6EE1\u3F3F\uBEBE\uCC3F" + - "\uCD3F\uCECE\uCFCF\uDADA\uDEDE\uEAEA\u494A\u4A55\u5558\u5859\u5963\u6363\u6365\u6566\u6666\u6667" + - "\u6769\u6969\u696A\u6A6A\u6A70\u7070\u7075\u7575\u7578\u7878\u7880\u808C\u8C8D\u8D8E\u8E8F\u8F8F" + - "\u8F90\u9090\u909A\u9A9A\u9A9B\u9B9B\u9B9D\u9D9D\u9DAA\uAAAA\uAAAB\uABAB\uABAC\uACAC\uACAE\uAEAE" + - "\uAEAF\uAFAF\uAFB0\uB0B0\uB0B1\uB1B1\uB1B2\uB2B2\uB2B3\uB3B3\uB3B6\uB6B6\uB6BA\uBABB\uBBBC\uBCBC" + - "\uBC3F\uFFFF\u0005\u3F3F\u3F5A\u7F7B\u5B3F\u507D\u4D5D\u3F4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7" + - "\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6" + - "\uE7E8\uE9AD\uE0BD\u5F6D\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6" + - "\uA7A8\uA9C0\u4FD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable62251() - { - super(62251, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable720.java b/cvsroot/src/com/ibm/as400/access/ConvTable720.java deleted file mode 100644 index 755294880..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable720.java +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable720.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable720 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u001A\u001A\u00E9\u00E2\u001A\u00E0\u001A\u00E7\u00EA\u00EB\u00E8\u00EF\u00EE\u001A\u001A\u001A" + - "\u001A\u0651\u0652\u00F4\u00A4\u0640\u00FB\u00F9\u0621\u0622\u0623\u0624\u00A3\u0625\u0626\u0627" + - "\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\u00AB\u00BB" + - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + - "\u0636\u0637\u0638\u0639\u063A\u0641\u00B5\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064A" + - "\u2261\u064B\u064C\u064D\u064E\u064F\u0650\u2248\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFF7F\u7F9C\u947F\u7F7F\u7F7F\u7FAE\u7F7F\u7F7F\uF87F\uFD7F\u7FE6\u7FFA\u7F7F" + - "\u7FAF\uFFFF\u0012\u7F7F\u857F\u837F\u7F7F\u7F87\u8A82\u8889\u7F7F\u8C8B\u7F7F\u7F7F\u937F\u7F7F" + - "\u7F97\u7F96\uFFFF\u0292\u7F7F\u7F98\u999A\u9B9D\u9E9F\uA0A1\uA2A3\uA4A5\uA6A7\uA8A9\uAAAB\uACAD" + - "\uE0E1\uE2E3\uE47F\u7F7F\u7F7F\u95E5\uE7E8\uE9EA\uEBEC\uEDEE\uEFF1\uF2F3\uF4F5\uF691\u927F\uFFFF" + - "\u0D15\u7F7F\u7FFC\uFFFF\u00CC\u7F7F\u7FF9\uFB7F\uFFFF\u0016\u7F7F\uF77F\uFFFF\u000B\u7F7F\u7FF0" + - "\uFFFF\u014F\u7F7F\uC47F\uB37F\uFFFF\u0004\u7F7F\uDA7F\u7F7F\uBF7F\u7F7F\uC07F\u7F7F\uD97F\u7F7F" + - "\uC37F\u7F7F\u7F7F\u7F7F\uB47F\u7F7F\u7F7F\u7F7F\uC27F\u7F7F\u7F7F\u7F7F\uC17F\u7F7F\u7F7F\u7F7F" + - "\uC57F\uFFFF\t\u7F7F\uCDBA\uD5D6\uC9B8\uB7BB\uD4D3\uC8BE\uBDBC\uC6C7\uCCB5\uB6B9\uD1D2\uCBCF" + - "\uD0CA\uD8D7\uCE7F\uFFFF\t\u7F7F\uDF7F\u7F7F\uDC7F\u7F7F\uDB7F\u7F7F\uDD7F\u7F7F\uDEB0\uB1B2" + - "\uFFFF\u0006\u7F7F\uFE7F\uFFFF\u6CAF\u7F7F\u7F21\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031" + - "\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051" + - "\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071" + - "\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F\uFFFF\u0044\u7F7F\uB37F\u7F7F\u7FFE\uFFFF\t\u7F7F"; - - - ConvTable720() - { - super(720, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable737.java b/cvsroot/src/com/ibm/as400/access/ConvTable737.java deleted file mode 100644 index f45bda7b4..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable737.java +++ /dev/null @@ -1,67 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable737.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable737 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039A\u039B\u039C\u039D\u039E\u039F\u03A0" + - "\u03A1\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7\u03B8" + - "\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0\u03C1\u03C3\u03C2\u03C4\u03C5\u03C6\u03C7\u03C8" + - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + - "\u03C9\u03AC\u03AD\u03AE\u03CA\u03AF\u03CC\u03CD\u03CB\u03CE\u0386\u0388\u0389\u038A\u038C\u038E" + - "\u038F\u00B1\u2265\u2264\u03AA\u03AB\u00F7\u2248\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFF7F\u0000\u0003\u7F7F\u7F15\u7F7F\u7F7F\uF8F1\uFD7F\u7F7F\u14FA\uFFFF\u001F" + - "\u7F7F\u7FF6\uFFFF\u0147\u7F7F\uEA7F\uEBEC\uED7F\uEE7F\uEFF0\u7F80\u8182\u8384\u8586\u8788\u898A" + - "\u8B8C\u8D8E\u8F90\u7F91\u9293\u9495\u9697\uF4F5\uE1E2\uE3E5\u7F98\u999A\u9B9C\u9D9E\u9FA0\uA1A2" + - "\uA3A4\uA5A6\uA7A8\uAAA9\uABAC\uADAE\uAFE0\uE4E8\uE6E7\uE97F\u7F7F\u7F7F\u7FAD\uFFFF\u0E26\u7F7F" + - "\u077F\uFFFF\f\u7F7F\u137F\uFFFF\u0020\u7F7F\u7FFC\uFFFF\u0088\u7F7F\u1B18\u1A19\u1D12\uFFFF" + - "\t\u7F7F\u177F\uFFFF\u0037\u7F7F\u7FF9\uFB7F\u7F7F\u7F1C\uFFFF\u0014\u7F7F\uF77F\uFFFF\r" + - "\u7F7F\uF3F2\uFFFF\u014D\u7F7F\uC47F\uB37F\uFFFF\u0004\u7F7F\uDA7F\u7F7F\uBF7F\u7F7F\uC07F\u7F7F" + - "\uD97F\u7F7F\uC37F\u7F7F\u7F7F\u7F7F\uB47F\u7F7F\u7F7F\u7F7F\uC27F\u7F7F\u7F7F\u7F7F\uC17F\u7F7F" + - "\u7F7F\u7F7F\uC57F\uFFFF\t\u7F7F\uCDBA\uD5D6\uC9B8\uB7BB\uD4D3\uC8BE\uBDBC\uC6C7\uCCB5\uB6B9" + - "\uD1D2\uCBCF\uD0CA\uD8D7\uCE7F\uFFFF\t\u7F7F\uDF7F\u7F7F\uDC7F\u7F7F\uDB7F\u7F7F\uDD7F\u7F7F" + - "\uDEB0\uB1B2\uFFFF\u0006\u7F7F\uFE7F\uFFFF\u0005\u7F7F\u167F\u7F7F\u7F7F\u1E7F\u7F7F\u7F7F\u7F7F" + - "\u107F\u1F7F\u7F7F\u7F7F\u7F7F\u117F\u0000\u0004\u7F7F\u7F09\u7F7F\u7F7F\u7F7F\u080A\uFFFF\u0030" + - "\u7F7F\u0102\u0F7F\u7F7F\u0C7F\u0B7F\uFFFF\u000E\u7F7F\u067F\u7F05\u7F03\u047F\u7F7F\u0D0E\uFFFF" + - "\u6C4A\u7F7F\u7F21\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B" + - "\u3C3D\u3E3F\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B" + - "\u5C5D\u5E5F\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B" + - "\u7C7D\u7E7F\uFFFF\u0044\u7F7F\uB31B\u181A\u19FE\u097F\uFFFF\b\u7F7F"; - - - ConvTable737() - { - super(737, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable775.java b/cvsroot/src/com/ibm/as400/access/ConvTable775.java deleted file mode 100644 index 0b207b2f9..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable775.java +++ /dev/null @@ -1,70 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable775.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable775 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u0106\u00FC\u00E9\u0101\u00E4\u0123\u00E5\u0107\u0142\u0113\u0156\u0157\u012B\u0179\u00C4\u00C5" + - "\u00C9\u00E6\u00C6\u014D\u00F6\u0122\u00A2\u015A\u015B\u00D6\u00DC\u00F8\u00A3\u00D8\u00D7\u00A4" + - "\u0100\u012A\u00F3\u017B\u017C\u017A\u201D\u00A6\u00A9\u00AE\u00AC\u00BD\u00BC\u0141\u00AB\u00BB" + - "\u2591\u2592\u2593\u2502\u2524\u0104\u010C\u0118\u0116\u2563\u2551\u2557\u255D\u012E\u0160\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u0172\u016A\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u017D" + - "\u0105\u010D\u0119\u0117\u012F\u0161\u0173\u016B\u017E\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + - "\u00D3\u00DF\u014C\u0143\u00F5\u00D5\u00B5\u0144\u0136\u0137\u013B\u013C\u0146\u0112\u0145\u2019" + - "\u00AD\u00B1\u201C\u00BE\u00B6\u00A7\u00F7\u201E\u00B0\u2219\u00B7\u00B9\u00B3\u00B2\u25A0\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFF7F\u969C\u9F7F\uA7F5\u7FA8\u7FAE\uAAF0\uA97F\uF8F1\uFDFC\u7FE6\uF4FA\u7FFB" + - "\u7FAF\uACAB\uF37F\u7F7F\u7F7F\u8E8F\u927F\u0000\u0003\u7F90\u7F7F\u7F7F\uE0E5\u999E\u9D7F\u7F7F" + - "\u9A7F\u7FE1\u7F7F\u7F7F\u8486\u917F\u0000\u0003\u7F82\u7F7F\u7F7F\uA2E4\u94F6\u9B7F\u7F7F\u817F" + - "\u7F7F\uA083\u7F7F\uB5D0\u8087\u7F7F\u7F7F\uB6D1\u7F7F\u7F7F\uED89\u7F7F\uB8D3\uB7D2\uFFFF\u0004" + - "\u7F7F\u9585\u7F7F\u7F7F\u7F7F\uA18C\u7F7F\uBDD4\u7F7F\u7F7F\u7F7F\uE8E9\u7F7F\u7FEA\uEB7F\u7F7F" + - "\u7FAD\u88E3\uE7EE\uEC7F\u7F7F\u7F7F\uE293\uFFFF\u0004\u7F7F\u8A8B\u7F7F\u9798\u7F7F\u7F7F\uBED5" + - "\uFFFF\u0004\u7F7F\uC7D7\u7F7F\u7F7F\u7F7F\uC6D6\u7F7F\u7F7F\u7F8D\uA5A3\uA4CF\uD87F\uFFFF\u0F4C" + - "\u7F7F\u7FEF\u7F7F\uF2A6\uF77F\u7F7F\u077F\uFFFF\f\u7F7F\u137F\uFFFF\u00A9\u7F7F\u1B18\u1A19" + - "\u1D12\uFFFF\t\u7F7F\u177F\uFFFF\u0037\u7F7F\u7FF9\u7F7F\u7F7F\u7F1C\uFFFF\u0170\u7F7F\uC47F" + - "\uB37F\uFFFF\u0004\u7F7F\uDA7F\u7F7F\uBF7F\u7F7F\uC07F\u7F7F\uD97F\u7F7F\uC37F\u7F7F\u7F7F\u7F7F" + - "\uB47F\u7F7F\u7F7F\u7F7F\uC27F\u7F7F\u7F7F\u7F7F\uC17F\u7F7F\u7F7F\u7F7F\uC57F\uFFFF\t\u7F7F" + - "\uCDBA\u7F7F\uC97F\u7FBB\u7F7F\uC87F\u7FBC\u7F7F\uCC7F\u7FB9\u7F7F\uCB7F\u7FCA\u7F7F\uCE7F\uFFFF" + - "\t\u7F7F\uDF7F\u7F7F\uDC7F\u7F7F\uDB7F\u7F7F\uDD7F\u7F7F\uDEB0\uB1B2\uFFFF\u0006\u7F7F\uFE7F" + - "\uFFFF\u0005\u7F7F\u167F\u7F7F\u7F7F\u1E7F\u7F7F\u7F7F\u7F7F\u107F\u1F7F\u7F7F\u7F7F\u7F7F\u117F" + - "\u0000\u0004\u7F7F\u7F09\u7F7F\u7F7F\u7F7F\u080A\uFFFF\u0030\u7F7F\u0102\u0F7F\u7F7F\u0C7F\u0B7F" + - "\uFFFF\u000E\u7F7F\u067F\u7F05\u7F03\u047F\u7F7F\u0D0E\uFFFF\u6C4A\u7F7F\u7F21\u2223\u2425\u2627" + - "\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F\u4041\u4243\u4445\u4647" + - "\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F\u6061\u6263\u6465\u6667" + - "\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F\uFFFF\u0044\u7F7F\uB31B" + - "\u181A\u19FE\u097F\uFFFF\b\u7F7F"; - - - ConvTable775() - { - super(775, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable813.java b/cvsroot/src/com/ibm/as400/access/ConvTable813.java deleted file mode 100644 index b9333053d..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable813.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable813.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable813 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u2018\u2019\u00A3\u001A\u001A\u00A6\u00A7\u00A8\u00A9\u001A\u00AB\u00AC\u00AD\u001A\u2015" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u0385\u0386\u00B7\u0388\u0389\u038A\u00BB\u038C\u00BD\u038E\u038F" + - "\u0390\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039A\u039B\u039C\u039D\u039E\u039F" + - "\u03A0\u03A1\u001A\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03AA\u03AB\u03AC\u03AD\u03AE\u03AF" + - "\u03B0\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF" + - "\u03C0\u03C1\u03C2\u03C3\u03C4\u03C5\u03C6\u03C7\u03C8\u03C9\u03CA\u03CB\u03CC\u03CD\u03CE\u001A"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u8081\u8283\u8485\u8687\u8889\u8A8B\u8C8D\u8E8F\u9091\u9293\u9495\u9697\u9899\u9A9B\u9C9D\u9E9F" + - "\uA01A\u1AA3\u1A1A\uA6A7\uA8A9\u1AAB\uACAD\u1A1A\uB0B1\uB2B3\uB41A\u1AB7\u1A1A\u1ABB\u1ABD\uFFFF" + - "\u0163\u1A1A\u1AB5\uB61A\uB8B9\uBA1A\uBC1A\uBEBF\uC0C1\uC2C3\uC4C5\uC6C7\uC8C9\uCACB\uCCCD\uCECF" + - "\uD0D1\u1AD3\uD4D5\uD6D7\uD8D9\uDADB\uDCDD\uDEDF\uE0E1\uE2E3\uE4E5\uE6E7\uE8E9\uEAEB\uECED\uEEEF" + - "\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\uFAFB\uFCFD\uFE1A\uFFFF\u0E22\u1A1A\u1AAF\u1A1A\uA1A2\uFFFF\u6FF3" + - "\u1A1A"; - - - ConvTable813() - { - super(813, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable819.java b/cvsroot/src/com/ibm/as400/access/ConvTable819.java deleted file mode 100644 index f79aecd27..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable819.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable819.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable819 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + - "\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u8081\u8283\u8485\u8687\u8889\u8A8B\u8C8D\u8E8F\u9091\u9293\u9495\u9697\u9899\u9A9B\u9C9D\u9E9F" + - "\uA0A1\uA2A3\uA4A5\uA6A7\uA8A9\uAAAB\uACAD\uAEAF\uB0B1\uB2B3\uB4B5\uB6B7\uB8B9\uBABB\uBCBD\uBEBF" + - "\uC0C1\uC2C3\uC4C5\uC6C7\uC8C9\uCACB\uCCCD\uCECF\uD0D1\uD2D3\uD4D5\uD6D7\uD8D9\uDADB\uDCDD\uDEDF" + - "\uE0E1\uE2E3\uE4E5\uE6E7\uE8E9\uEAEB\uECED\uEEEF\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\uFAFB\uFCFD\uFEFF" + - "\uFFFF\u7F80\u1A1A"; - - - ConvTable819() - { - super(819, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable833.java b/cvsroot/src/com/ibm/as400/access/ConvTable833.java deleted file mode 100644 index d420716a8..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable833.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable833.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable833 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u001A\uFFA0\uFFA1\uFFA2\uFFA3\uFFA4\uFFA5\uFFA6\uFFA7\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u001A\uFFA8\uFFA9\uFFAA\uFFAB\uFFAC\uFFAD\uFFAE\uFFAF\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\uFFB0\uFFB1\uFFB2\uFFB3\uFFB4\uFFB5\uFFB6\uFFB7\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u005B\u001A\uFFB8\uFFB9\uFFBA\uFFBB\uFFBC\uFFBD\uFFBE\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u005D\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\uFFC2\uFFC3\uFFC4\uFFC5\uFFC6\uFFC7" + - "\u001A\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\uFFCA\uFFCB\uFFCC\uFFCD\uFFCE\uFFCF" + - "\u203E\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\uFFD2\uFFD3\uFFD4\uFFD5\uFFD6\uFFD7" + - "\u005E\u001A\\\u001A\u001A\u001A\u001A\u001A\u001A\u001A\uFFDA\uFFDB\uFFDC\u001A\u001A\u001A" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u20A9\u001A\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u001A\u001A\u001A\u001A\u001A\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE970\uB280\uB06D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u3F3F\u4A3F\u3F3F\u6A3F\u3F3F\u3F3F\u5F3F\uFFFF\u0FC8\u3F3F\uA03F\uFFFF\u0034\u3F3F\u3FE0\uFFFF" + - "\u6F7B\u3F3F\u4243\u4445\u4647\u4849\u5253\u5455\u5657\u5859\u6263\u6465\u6667\u6869\u7273\u7475" + - "\u7677\u783F\u3F3F\u8A8B\u8C8D\u8E8F\u3F3F\u9A9B\u9C9D\u9E9F\u3F3F\uAAAB\uACAD\uAEAF\u3F3F\uBABB" + - "\uBC3F\uFFFF\u0011\u3F3F"; - - - ConvTable833() - { - super(833, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable834.java b/cvsroot/src/com/ibm/as400/access/ConvTable834.java deleted file mode 100644 index 078f7561b..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable834.java +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable834.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// This is a Korean character set. -class ConvTable834 extends ConvTable4930 -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable834() - { - super(834); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable835.java b/cvsroot/src/com/ibm/as400/access/ConvTable835.java deleted file mode 100644 index b74f86592..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable835.java +++ /dev/null @@ -1,2034 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable835.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable835 extends ConvTableDoubleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\uFFFE\u0004\u0000\u0000\u0003\u009C\u0986\u7F97\u8D8E\uFFFE\t\u000B\u0000\u0036\u009D\u8508" + - "\u8718\u1992\u8F1C\u1D1E\u1F80\u8182\u8384\u0A17\u1B88\u898A\u8B8C\u0506\u0790\u9116\u9394\u9596" + - "\u0498\u999A\u9B14\u159E\u1A20\uA0E2\uE4E0\uE1E3\uE5E7\uF1A2\u2E3C\u282B\u7C26\uE9EA\uEBE8\uEDEE" + - "\uEFEC\uDF21\u242A\u293B\uAC2D\u2FC2\uC4C0\uC1C3\uC5C7\uD1A6\u2C25\u5F3E\u3FF8\uC9CA\uCBC8\uCDCE" + - "\uCFCC\u603A\u2340\u273D\u22D8\uFFFE\t\u0061\u0000\u0003\u00AB\uBBF0\uFDFE\uB1B0\uFFFE\t" + - "\u006A\u0000\u0003\u00AA\uBAE6\uB8C6\uA4B5\u007E\uFFFE\b\u0073\u0000\u000B\u00A1\uBFD0\uDDDE" + - "\uAE5E\uA3A5\uB7A9\uA7B6\uBCBD\uBE5B\u5DAF\uA8B4\uD77B\uFFFE\t\u0041\u0000\u0003\u00AD\uF4F6" + - "\uF2F3\uF57D\uFFFE\t\u004A\u0000\u0003\u00B9\uFBFC\uF9FA\uFF5C\u00F7\uFFFE\b\u0053\u00B2" + - "\u00D4\u00D6\u00D2\u00D3\u00D5\uFFFE\n\u0030\u00B3\u00DB\u00DC\u00D9\u00DA\u009F\uFFFF\u3F40" + - "\uFFFD\u3000\uFFFF\u0100\uFFFD\uFFFE\u0011\u03B1\uFFFE\u0007\u03C3\uFFFF\b\uFFFD\uFFFE\u0011" + - "\u0391\uFFFE\u0007\u03A3\uFFFF\u0007\uFFFD\uFFFE\u0006\u0430\u0451\uFFFE\u001A\u0436\uFFFF\u0010" + - "\uFFFD\uFFFE\n\u2170\uFFFF\u0005\uFFFD\uFFFE\u0006\u0410\u0401\uFFFE\u001A\u0416\uFFFF\u0010" + - "\uFFFD\uFFFE\n\u2160\uFFFF\u004F\uFFFD\u0000\u0003\uFFE1\u0E1C\u080B\u5C06\uFFFF\t\uFFFD" + - "\uFF01\uFFE5\u273D\uFF09\uFF1B\uFFE2\uFF0D\uFF0F\uFFFF\b\uFFFD\uFFE4\uFF0C\uFF05\uFF3F\uFF1E" + - "\uFF1F\uFFFF\t\uFFFD\u2035\u0000\u0003\uFF1A\u0320\u071D\u02FD\uFFFE\t\uFF41\uFFFF\u0007" + - "\uFFFD\uFFFE\t\uFF4A\uFFFF\u0007\uFFFD\u203E\uFFFE\b\uFF53\uFFFF\u0016\uFFFD\uFF5B\uFFFE" + - "\t\uFF21\uFFFF\u0006\uFFFD\uFF5D\uFFFE\t\uFF2A\uFFFF\u0006\uFFFD\uFF04\uFFFD\uFFFE\b" + - "\uFF33\uFFFF\u0006\uFFFD\uFFFE\n\uFF10\uFFFF\u0047\uFFFD\u3002\u300C\u300D\u3001\u2027\u30F2" + - "\u30A1\u30A3\u30A5\uFFE0\uFFFD\uFFFD\u2312\u2202\u2207\uFFFD\u0000\u0004\u30A7\uA9E3\uE5E7\uC3EE" + - "\uFCF5\u30F6\uFFFD\uFFFD\u226A\u226B\uFFFD\u223D\u221D\uFFFD\u0000\u0003\u222C\u080B\u8687\u8283" + - "\uFFFD\uFFFD\u2227\u2228\u21D2\u21D4\u2200\u2203\u212B\u2030\u266F\u266D\u266A\u2020\u2021\u00B6" + - "\u25EF\uFFFF\u0006\uFFFD\u0000\u0004\u30A2\uA4A6\uA8AA\uABAD\uAFB1\u30B3\uFFFD\u0000\u0007\u30B5" + - "\uB7B9\uBBBD\uBFC1\uC4C6\uC8CA\uCBCC\uCDCE\uFFFD\uFFFD\u30CF\u30D2\u30D5\uFFFD\u223C\u0000\u0004" + - "\u30D8\uDBDE\uDFE0\uE1E2\uE4E6\uFFFD\uFFFE\u0004\u30E8\uFFFF\u0007\uFFFD\u2501\u2503\u250F\u0000" + - "\u0011\u30EC\uEDEF\uF39B\u9CAC\uAEB0\uB2B4\uB6B8\uBABC\uBEC0\uC2C5\uC7C9\uD0D3\uD6D9\uDCF4\uD1D4" + - "\uD7DA\uDDF0\uF1FD\u30FE\uFFFD\uFFFD\uFF3C\u0000\b\u2513\u1B17\u2333\u2B3B\u4B20\u2F28\u373F" + - "\u1D30\u2538\u2542\uFFFF\u004F\uFFFD\u300E\u300F\uFF3B\uFF3D\u3092\u3041\u3043\u3045\u2014\u00B1" + - "\u2260\u221E\u2103\uFFFD\u2032\u0000\u0003\u3047\u4983\u8587\u638E\uFFFD\uFFFD\u2010\u02BA\uF83E" + - "\u3005\u3006\u3007\u00A8\u2018\u201C\u3014\u3008\u300A\u3010\u2266\u2234\u2642\u00A7\u203B\u3012" + - "\u3231\u2116\u2121\uFF3E\u2019\u201D\u3015\u3009\u300B\u3011\u2267\u2235\u2640\u00D7\u00F7\u2225" + - "\u3013\u2025\u2026\uFFFD\u0000\u0004\u3042\u4446\u484A\u4B4D\u4F51\u3053\uFFFD\u0000\u0007\u3055" + - "\u5759\u5B5D\u5F61\u6466\u686A\u6B6C\u6D6E\uFFFD\uFFFD\u306F\u3072\u3075\uFFFD\uFFFD\u0000\u0004" + - "\u3078\u7B7E\u7F80\u8182\u8486\uFFFD\uFFFE\u0004\u3088\uFFFF\n\uFFFD\u308C\u308D\u308F\u3093" + - "\uFFFD\uFFFD\u0000\t\u304C\u4E50\u5254\u5658\u5A5C\u5E60\u6265\u6769\u7073\u7679\u307C\uFFFD" + - "\u0000\u0004\u3071\u7477\u7A7D\u9091\u9D9E\uFFFD\uFFFD\u25CB\u25CF\u25B3\u25B2\u25CE\u2606\u2605" + - "\u25C7\u25C6\u25A1\u25A0\u25BD\u25BC\u00B0\u00B4\u2033\u2192\u2190\u2191\u2193\uFFFF\u004D\uFFFD" + - "\uFFFE\t\u3021\u5341\u5344\u5345\uFFFF\u0004\uFFFD\u02C9\u02CA\u02C7\u02CB\u02D9\uFFFE\u0025" + - "\u3105\uFFFF\u00C6\uFFFD\uFFFE\n\u2460\uFFFF\u0006\uFFFD\uFFFE\n\u2474\uFFFF\u0005\uFFFD" + - "\uFFFE\b\u2581\u0000\u000B\u258F\u8E8D\u8C8B\u8A89\u3C34\u2C24\u1C94\u0002\u950C\u1014\u186D" + - "\u6E70\u256F\uFFFD\u0000\u0005\u2550\u5E6A\u61E2\uE3E5\uE471\u7273\uFFFF\u0014\uFFFD\uFFFE\u0004" + - "\uFE41\uFE3B\uFE3C\uFFFD\uFE31\uFFFE\u0004\uF83F\uFFFE\u0006\uFE35\uFFFE\u0004\uFE3D\uFE33\u2574" + - "\uFF0A\u3003\u32A3\u2105\u0000\u0004\uFE34\u4F49\u4A4D\u4E4B\u4C61\u0000\u0004\u221A\u5261\u292A" + - "\uA520\u1FBF\u33D2\u33D1\u222B\u222E\u2295\u2299\u2196\u2197\u2199\u2198\uFFFD\uFFFD\u2215\u2109" + - "\u0000\u0004\u33D5\u9C9D\u9ECE\uA18E\u8FC4\u00B7\uFFFD\uFFFD\uFFFD\u301D\u301E\uFFFD\uFFFD\uFFFD" + - "\u21E7\u21B8\u21B9\u5159\u515B\u515E\u515D\u5161\u5163\u55E7\u74E9\u7CCE\uFFFF\u0047\uFFFD\u0000" + - "\u0004\uFE30\u5051\u5254\u5556\u5732\uFFFE\u0007\uFE58\uFFE3\u02CD\u0000\u0005\uFE5F\u6062\u6364" + - "\u6566\u6869\u6A6B\uFFFF\u0023\uFFFD\uFFFE\u0020\u2400\u2421\uFFFF\u009F\uFFFD\u0000\u0004\u4E00" + - "\u2836\u3F59\u858C\uA0BA\u0000\u0003\u513F\u656B\u8296\uABE0\u51F5\u5200\u529B\u52F9\u0000\u0004" + - "\u5315\u1A38\u415C\u6982\uB6C8\u53E3\u56D7\u571F\u58EB\u590A\u5915\u5927\u5973\u5B50\u5B80\u5BF8" + - "\u5C0F\u5C22\u5C38\u5C6E\u5C71\u5DDB\u5DE5\u5DF1\u5DFE\u5E72\u5E7A\u5E7F\u5EF4\u5EFE\u5F0B\u5F13" + - "\u5F50\u5F61\u5F73\u5FC3\u6208\u6236\u624B\uFFFD\u0000\u0003\u652F\u3487\u97A4\uB9E0\u65E5\u66F0" + - "\u6708\u6728\u0000\u0003\u6B20\u6279\uB3CB\uD4DB\u6C0F\u6C14\u6C34\u706B\u0000\u0003\u722A\u363B" + - "\u3F47\u595B\u72AC\u7384\u7389\u74DC\u74E6\u7518\u751F\u7528\u7530\u758B\u7592\u7676\u767D\u76AE" + - "\u76BF\u76EE\u77DB\u77E2\u77F3\u793A\u79B8\u79BE\u7A74\u7ACB\u7AF9\u7C73\u7CF8\u7F36\u7F51\u7F8A" + - "\u7FBD\u8001\u800C\u8012\u8033\u807F\u8089\u81E3\u81EA\u81F3\u81FC\u820C\u821B\u821F\u826E\u8272" + - "\u8278\u864D\u866B\u8840\u884C\u8863\u897E\u898B\u89D2\u8A00\u8C37\u8C46\u8C55\u8C78\u8C9D\u8D64" + - "\u8D70\u8DB3\u8EAB\u8ECA\u8F9B\u8FB0\u8FB5\u9091\u9149\u91C6\u91CC\u91D1\u9577\u9580\u961C\u96B6" + - "\u96B9\u96E8\u0000\u0003\u9752\u5E62\u69CB\uEDF3\u9801\u98A8\u98DB\u98DF\u9996\u9999\u99AC\u9AA8" + - "\u9AD8\uFFFF\u0043\uFFFD\u9ADF\u9B25\u9B2F\u9B32\u9B3C\u9B5A\u9CE5\u0000\u0004\u9E75\u7FA5\uBBC3" + - "\uCDD1\uF9FD\u0000\u0004\u9F0E\u1320\u3B4A\u528D\u9CA0\uFFFF\u02E7\uFFFD\u0000\u0004\u4E00\u5901" + - "\u0343\u5D86\u8CBA\u513F\u5165\u516B\u51E0\u5200\u5201\u529B\u5315\u5341\u535C\u53C8\u4E09\u4E0B" + - "\u4E08\u4E0A\u4E2B\u4E38\u51E1\u4E45\u4E48\u4E5F\u4E5E\u4E8E\u4EA1\u5140\u5203\u52FA\u5343\u53C9" + - "\u53E3\u571F\u58EB\u5915\u5927\u5973\u5B50\u5B51\u5B53\u5BF8\u5C0F\u5C22\u5C38\u5C71\u5DDD\u5DE5" + - "\u5DF1\u5DF2\u5DF3\u5DFE\u5E72\u5EFE\u5F0B\u5F13\u624D\uFFFD\u0000\u0003\u4E11\u100D\u2D30\u394B" + - "\u5C39\u0000\u0007\u4E88\u9195\u9294\uA2C1\uC0C3\uC6C7\uCDCA\uCBC4\u0000\u0003\u5143\u4167\u6D6E" + - "\u6C97\u51F6\u5206\u5207\u5208\u52FB\u52FE\u52FF\u0000\u0004\u5316\u3948\u4745\u5E84\uCBCA\u53CD" + - "\u58EC\u5929\u592B\u592A\u592D\u5B54\u5C11\u5C24\u5C3A\u5C6F\u5DF4\u5E7B\u5EFF\u5F14\u5F15\u5FC3" + - "\u6208\u6236\u624B\u624E\u652F\u6587\u6597\u65A4\u65B9\u65E5\u66F0\u6708\u6728\u6B20\u6B62\u6B79" + - "\u6BCB\u6BD4\u6BDB\u6C0F\u6C34\u706B\u0000\u0003\u722A\u363B\u4759\u5BAC\u738B\u0000\t\u4E19" + - "\u1615\u1418\u3B4D\u4F4E\uE5D8\uD4D5\uD6D7\uE3E4\uD9DE\u0000\u0003\u5145\u4489\u8AAC\uF9FA\u51F8" + - "\u520A\u52A0\u529F\u5305\u5306\uFFFF\u0043\uFFFD\u5317\u531D\u4EDF\u0000\f\u534A\u4961\u606F" + - "\u6EBB\uEFE4\uF3EC\uEEE9\uE8FC\uF8F5\uEBE6\uEAF2\uF1F0\uE5ED\u53FB\u56DB\u56DA\u5916\u592E\u5931" + - "\u5974\u5976\u5B55\u5B83\u5C3C\u5DE8\u5DE7\u5DE6\u5E02\u5E03\u5E73\u5E7C\u5F01\u5F18\u5F17\u5FC5" + - "\u620A\u6253\u6254\u6252\u6251\u65A5\u65E6\u672E\u672C\u672A\u672B\u672D\u6B63\uFFFD\u6BCD\u6C11" + - "\u6C10\u6C38\u6C41\u6C40\u6C3E\u72AF\u7384\u7389\u74DC\u74E6\u0000\u0004\u7518\u1F28\u2930\u3132" + - "\u338B\u767D\u76AE\u76BF\u76EE\u77DB\u77E2\u77F3\u793A\u79BE\u7A74\u7ACB\u0000\u0004\u4E1E\u1F52" + - "\u5369\u99A4\uA6A5\u4EFF\u0000\u0003\u4F09\u190A\u150D\u1011\u4F0F\u4EF2\u4EF6\u4EFB\u4EF0\u4EF3" + - "\u4EFD\u4F01\u4F0B\u0000\u0003\u5149\u4746\u4868\u718D\u51B0\u5217\u5211\u5212\u520E\u5216\u52A3" + - "\u5308\u5321\u5320\u5370\u5371\u0000\u0007\u5409\u0F0C\u0A10\u010B\u0411\u0D08\u030E\u0612\u56E0" + - "\u56DE\u56DD\u0000\u0003\u5733\u3028\u2D2C\u2F29\u0000\u0005\u5919\u1A37\u3884\u7883\u7D79\u8281" + - "\u0000\u0003\u5B57\u5887\u8885\u89FA\u5C16\u5C79\u5DDE\u5E06\u5E76\uFFFF\u0043\uFFFD\u5E74\u5F0F" + - "\u5F1B\u5FD9\u5FD6\u0000\u0003\u620E\u0C0D\u1063\u5B58\u6536\u65E9\u65E8\u65EC\u65ED\u66F2\u66F3" + - "\u6709\u673D\u6734\u6731\u6735\u6B21\u6B64\u6B7B\u0000\u0005\u6C16\u5D57\u595F\u6050\u5561\u5B4D" + - "\u6C4E\u7070\u725F\u725D\u767E\u7AF9\u7C73\u7CF8\u7F36\u7F8A\u7FBD\u0000\u0004\u8001\u030C\u1233" + - "\u7F89\u8B8C\u81E3\u81EA\u81F3\u81FC\u820C\uFFFD\u821B\u821F\u826E\u8272\u827E\u866B\u8840\u884C" + - "\u8863\u897F\u9621\u4E32\u4EA8\u0000\r\u4F4D\u4F47\u575E\u345B\u5530\u5051\u3D3A\u3843\u543C" + - "\u4663\u5C60\u2F4E\u3659\u5D48\u4F5A\u514C\u514B\u514D\u5175\u51B6\u51B7\u0000\u0004\u5225\u2429" + - "\u2A28\uABA9\uAAAC\u5323\u5373\u5375\u0000\r\u541D\u2D1E\u3E26\u4E27\u4643\u3348\u421B\u294A" + - "\u393B\u382E\u3536\u203C\u4031\u2B1F\u542C\u56EA\u56F0\u56E4\u56EB\u0000\u0004\u574A\u5140\u4D47" + - "\u4E3E\u504F\u573B\u58EF\u0000\u0006\u593E\u9D92\uA89E\uA399\u968D\uA493\u8AA5\u0000\u0003\u5B5D" + - "\u5C5A\u5B8C\u8B8F\u5C2C\u5C40\u5C41\uFFFF\u0043\uFFFD\u5C3F\u5C3E\u5C90\u5C91\u5C94\u5C8C\u5DEB" + - "\u5E0C\u5E8F\u5E87\u5E8A\u5EF7\u0000\u0006\u5F04\u1F64\u6277\u79D8\uCCD7\uCDF1\uEBF8\u5FEA\u0000" + - "\n\u6212\u1184\u9796\u8076\u896D\u8A7C\u7E79\u7392\u6F98\u6E95\u9391\u6286\u6539\u653B\u6538" + - "\u65F1\u66F4\u0000\u0004\u675F\u4E4F\u5051\u5C56\u5E49\u6746\uFFFD\u6760\u6753\u6757\u6B65\u6BCF" + - "\u0000\r\u6C42\u5E99\u8188\u8985\u9B6A\u7A90\u708C\u6896\u927D\u8372\u7E74\u8676\u8D94\u9882" + - "\u7076\u707C\u707D\u7078\u7262\u7261\u7260\u72C4\u72C2\u7396\u752C\u752B\u7537\u7538\u7682\u76EF" + - "\u77E3\u79C1\u79C0\u79BF\u7A76\u7CFB\u7F55\u0000\u0003\u8096\u939D\u989B\u9AB2\u826F\u8292\u828B" + - "\u828D\u898B\u89D2\u8A00\u8C37\u8C46\u8C55\u8C9D\u8D64\u8D70\u8DB3\u8EAB\u8ECA\u8F9B\u8FB0\u8FC2" + - "\u8FC6\u8FC5\u8FC4\u5DE1\u9091\u90A2\u90AA\u90A6\u90A3\u9149\u91C6\u91CC\u9632\u962E\u9631\u962A" + - "\u962C\u0000\u0003\u4E26\u5673\u8B9B\u9EAB\u4EAC\u0000\t\u4F6F\u9D8D\u737F\u6C9B\u8B86\u8370" + - "\u7588\u697B\u967E\u8F91\uFFFF\u0043\uFFFD\u4F7A\u0000\u0004\u5154\u5255\u6977\u7678\uBDFD\u0000" + - "\u0004\u523B\u3837\u3A30\u2E36\u41BE\u52BB\u0000\u0005\u5352\u5453\u5166\u7778\u79D6\uD4D7\u0000" + - "\n\u5473\u7596\u7895\u807B\u7784\u9286\u7C90\u7176\u8C9A\u6268\u8B7D\u548E\u56FA\u0000\u0003" + - "\u5783\u776A\u6961\u6664\u577C\u591C\uFFFD\u0000\n\u5949\u4748\u4454\uBEBB\uD4B9\uAED1\uC6D0" + - "\uCDCB\uD3CA\uAFB3\uD2C5\u0000\u0004\u5B5F\u6463\u979A\u989C\u999B\u0000\u0005\u5C1A\u4845\u46B7" + - "\uA1B8\uA9AB\uB1B3\u0000\u0006\u5E18\u1A16\u151B\u1178\u9A97\u9C95\u96F6\u0000\u0005\u5F26\u2729" + - "\u8081\u7F7C\uDDE0\uFDF5\u5FFF\u0000\u0005\u600F\u142F\u3516\u2A15\u2127\u292B\u601B\u0000\u0011" + - "\u6216\u153F\u3E40\u7FC9\uCCC4\uBFC2\uB9D2\uDBAB\uD3D4\uCBC8\uA8BD\uBCD0\uD9C7\uCDB5\uDAB1\uD8D6" + - "\uD7C6\uACCE\u653E\u65A7\u65BC\u65FA\u0000\u0003\u6614\u130C\u0602\u0E00\u660F\uFFFF\u0043\uFFFD" + - "\u6615\u660A\u6607\u0000\u000B\u670D\u0B6D\u8B95\u719C\u7377\u879D\u976F\u707F\u897E\u9075\u9A93" + - "\u7C6A\u6772\u6B23\u6B66\u6B67\u6B7F\u0000\u000F\u6C13\u1BE3\uE8F3\uB1CC\uE5B3\uBDBE\uBCE2\uABD5" + - "\uD3B8\uC4B9\uC1AE\uD7C5\uF1BF\uBBE1\uDBCA\uACEF\u6CDC\uFFFD\u6CD6\u6CE0\u7095\u708E\u7092\u708A" + - "\u7099\u0000\u0005\u722C\u2D38\u4867\u69C0\uCED9\uD7D0\u73A9\u73A8\u739F\u73AB\u73A5\u753D\u759D" + - "\u7599\u759A\u7684\u76C2\u76F2\u76F4\u77E5\u77FD\u793E\u7940\u7941\u79C9\u79C8\u7A7A\u7A79\u7AFA" + - "\u7CFE\u7F54\u7F8C\u7F8B\u0000\u0005\u8005\uBAA5\uA2B1\uA1AB\uA9B4\uAAAF\u81E5\u81FE\u0000\b" + - "\u820D\uB39D\u99AD\uBD9F\uB9B1\uACA5\uAFB8\uA3B0\uBEB7\u864E\u8671\u521D\u8868\u8ECB\u8FCE\u8FD4" + - "\u8FD1\u90B5\u90B8\u90B1\u90B6\u91C7\u91D1\u9577\u9580\u0000\u0003\u961C\u403F\u3B44\u42B9\u96E8" + - "\u9752\u975E\u4E9F\u4EAD\u4EAE\u0000\n\u4FE1\uB5AF\uBFE0\uD1CF\uDDC3\uB6D8\uDFCA\uD7AE\uD0C4" + - "\uC2DA\uCEDE\uFFFF\u0043\uFFFD\u4FB7\u5157\u5192\u5191\u51A0\u0000\u0005\u524E\u434A\u4D4C\u4B47" + - "\uC7C9\uC3C1\u530D\u5357\u537B\u539A\u53DB\u0000\n\u54AC\uC0A8\uCEC9\uB8A6\uB3C7\uC2BD\uAAC1" + - "\uC4C8\uAFAB\uB1BB\uA9A7\u54BF\u56FF\u0000\u0003\u5782\u8BA0\uA3A2\uCEAE\u5793\u0000\u0004\u5955" + - "\u514F\u4E50\uDCD8\uFFE3\u59E8\u5A03\uFFFD\u59E5\u59EA\u59DA\u59E6\u5A01\u59FB\u5B69\u5BA3\u5BA6" + - "\u5BA4\u5BA2\u5BA5\u0000\u0003\u5C01\u4E4F\u4D4B\uD9D2\u5DF7\u0000\u0003\u5E1D\u251F\u7DA0\uA6FA" + - "\u0000\u0004\u5F08\u2D65\u8885\u8A8B\u878C\u5F89\u0000\u0007\u6012\u1D20\u250E\u284D\u7068\u6246" + - "\u436C\u6B6A\u6064\u6241\u62DC\u6316\u6309\u62FC\u62ED\u6301\u62EE\u62FD\u6307\u62F1\u62F7\u62EF" + - "\u62EC\u62FE\u62F4\u6311\u6302\u653F\u6545\u65AB\u65BD\u65E2\u0000\u0004\u6625\u2D20\u272F\u1F28" + - "\u3124\u66F7\u0000\f\u67FF\uD3F1\uD4D0\uECB6\uAFF5\uE9EF\uC4D1\uB4DA\uE5B8\uCFDE\uF3B0\uD9E2" + - "\uDDD2\u6B6A\u6B83\u6B86\u6BB5\u6BD2\u6BD7\u6C1F\u6CC9\u6D0B\u6D32\u6D2A\u6D41\u6D25\u6D0C\uFFFF" + - "\u0043\uFFFD\u0000\u0003\u6D31\u1E17\u3B3D\u3E36\u6D1B\u6CF5\u0000\u0003\u6D39\u2738\u292E\u350E" + - "\u6D2B\u0000\u0004\u70AB\uBAB3\uACAF\uADB8\uAEA4\u0000\u0003\u7230\u726F\u74E9\uE0E1\u0000\u0003" + - "\u73B7\uCABB\uB2CD\uC0B3\u0000\u0005\u751A\u2D4F\u4C4E\u4BAB\uA4A5\uA2A3\u0000\u0003\u7678\u8687" + - "\u88C8\uC6C3\u76C5\u7701\u76F9\u76F8\u7709\uFFFD\u770B\u76FE\u76FC\u7707\u77DC\u7802\u7814\u780C" + - "\u780D\u0000\u0004\u7946\u4948\u47B9\uBAD1\uD2CB\u7A7F\u7A81\u7AFF\u7AFD\u7C7D\u0000\u0003\u7D02" + - "\u0500\u0907\u0406\u7F38\u7F8E\u7FBF\u0000\b\u8004\u100D\u1136\uD6E5\uDAC3\uC4CC\uE1DB\uCEDE" + - "\uE4DD\u81F4\u8222\u82E7\u8303\u8305\u82E3\u82DB\u82E6\u8304\u82E5\u8302\u8309\u82D2\u82D7\u82F1" + - "\u8301\u0000\u0003\u82DC\uD4D1\uDED3\uDFEF\u8306\u8650\u8679\u867B\u867A\u884D\u886B\u8981\u89D4" + - "\u8A08\u8A02\u8A03\u8C9E\u8CA0\u8D74\u8D73\u8DB4\u8ECD\u8ECC\u0000\u0004\u8FF0\uE6E2\uEAE5\uEDEB" + - "\uE4E8\u90CA\u90CE\u90C1\u90C3\u914B\u914A\u91CD\u9582\u9650\u964B\u964C\u964D\u9762\u9769\u97CB" + - "\u97ED\u97F3\u9801\u98A8\u98DB\u98DF\u9996\u9999\u4E58\uFFFF\u0043\uFFFD\u4EB3\u500C\u500D\u5023" + - "\u4FEF\u5026\u5025\u4FF8\u0000\u0003\u5029\u1606\u3C1F\u1A12\u5011\u4FFA\u5000\u5014\u5028\u4FF1" + - "\u5021\u500B\u5019\u5018\u4FF3\u4FEE\u502D\u502A\u4FFE\u502B\u5009\u0000\u0003\u517C\uA4A5\uA2CD" + - "\uCCC6\u51CB\u5256\u525C\u5254\u525B\u525D\u532A\u537F\u539F\u539D\u53DF\u54E8\u5510\u5501\u5537" + - "\u54FC\u54E5\u54F2\u5506\u54FA\u5514\u54E9\u54ED\u54E1\uFFFD\u5509\u54EE\u54EA\u54E6\u5527\u5507" + - "\u54FD\u550F\u5703\u5704\u57C2\u57D4\u57CB\u57C3\u5809\u590F\u5957\u5958\u595A\u5A11\u5A18\u5A1C" + - "\u5A1F\u5A1B\u5A13\u59EC\u5A20\u5A23\u5A29\u5A25\u5A0C\u5A09\u5B6B\u5C58\u0000\u0003\u5BB0\uB3B6" + - "\uB4AE\uB5B9\u5BB8\u0000\u0005\u5C04\u5155\u50ED\uFDFB\uEAE8\uF0F6\u5D01\u5CF4\u5DEE\u5E2D\u5E2B" + - "\u5EAB\u5EAD\u5EA7\u5F31\u5F92\u5F91\u5F90\u0000\u0007\u6059\u6365\u5055\u6D69\u6F84\u9F9A\u8D94" + - "\u8C85\u6096\u6247\u62F3\u6308\u62FF\u0000\u0007\u634E\u3E2F\u5542\u464F\u493A\u503D\u2A2B\u284D" + - "\u634C\u6548\u6549\u6599\u65C1\u65C5\u0000\u0004\u6642\u494F\u4352\u4C45\u41F8\u6714\u6715\u6717" + - "\u0000\u0003\u6821\u3848\u4653\u3942\uFFFF\u0043\uFFFD\u0000\u0003\u6854\u29B3\u174C\u513D\u67F4" + - "\u0000\u0004\u6850\u403C\u432A\u4513\u1841\u6B8A\u6B89\u6BB7\u6C23\u6C27\u6C28\u6C26\u6C24\u6CF0" + - "\u0000\n\u6D6A\u9588\u8766\u7877\u5993\u6C89\u6E5A\u7469\u8C8A\u7985\u6594\u70CA\u70D8\u70E4" + - "\u70D9\u70C8\u70CF\u0000\u0003\u7239\u79FC\uF9FD\uF8F7\u7386\u73ED\u7409\uFFFD\u73EE\u73E0\u73EA" + - "\u73DE\u0000\u0007\u7554\u5D5C\u5A59\uBEC5\uC7B2\uB3BD\uBCB9\uC2B8\u768B\u76B0\u76CA\u76CD\u76CE" + - "\u7729\u771F\u7720\u7728\u77E9\u0000\u0005\u7830\u2738\u1D34\u3725\u2D20\u1F32\u0000\u0007\u7955" + - "\u5060\u5F56\u5E5D\u575A\uE4E3\uE7DF\uE6E9\u79D8\u7A84\u7A88\u7AD9\u7B06\u7B11\u7C89\u0000\u0006" + - "\u7D21\u170B\u0A20\u2214\u1015\u1A1C\u0D19\u7D1B\u7F3A\u7F5F\u7F94\u7FC5\u7FC1\u0000\u0003\u8006" + - "\u1815\u1917\u3D3F\u80F1\u8102\u80F0\u8105\u80ED\u80F4\u8106\u80F8\u80F3\u8108\u80FD\u810A\u80FC" + - "\u80EF\u81ED\u81EC\u0000\u0003\u8200\u102A\u2B28\u2CBB\u0000\u0006\u832B\u5254\u4A38\u5049\u3534" + - "\u4F32\u3936\u8317\uFFFF\u0043\uFFFD\u8340\u8331\u8328\u8343\u0000\u0004\u8654\u8AAA\u93A4\uA98C" + - "\uA39C\u8870\u8877\u8881\u8882\u887D\u8879\u0000\u0005\u8A18\u100E\u0C15\u0A17\u1316\u0F11\u8C48" + - "\u8C7A\u8C79\u8CA1\u8CA2\u8D77\u8EAC\u8ED2\u8ED4\u8ECF\u8FB1\u9001\u9006\u8FF7\u9000\u8FFA\u8FF4" + - "\u9003\u8FFD\u9005\u8FF8\u9095\u90E1\u90DD\u90E2\u0000\u0003\u9152\u4D4C\uD8DD\uD7DC\u91D9\uFFFD" + - "\u9583\u0000\u0004\u9662\u6361\u5B5D\u6458\u5EBB\u98E2\u99AC\u9AA8\u9AD8\u9B25\u9B32\u9B3C\u4E7E" + - "\u0000\t\u507A\u7D5C\u4743\u4C5A\u4965\u764E\u5575\u7477\u4F0F\u6F6D\u515C\u5195\u51F0\u526A" + - "\u526F\u52D2\u52D9\u52D8\u52D5\u0000\u0003\u5310\u0F19\u3F40\u3EC3\u66FC\u0000\n\u5546\u6A66" + - "\u445E\u6143\u4A31\u564F\u552F\u6438\u2E5C\u2C63\u3341\u5557\u5708\u570B\u5709\u57DF\u5805\u580A" + - "\u5806\u57E0\u57E4\u57FA\u5802\u5835\u57F7\u57F9\u5920\u5962\u0000\u0005\u5A36\u4149\u666A\u403C" + - "\u625A\u464A\u0000\u0003\u5B70\uC7C5\uC4C2\uBFC6\u5C09\u5C08\u5C07\u5C60\u5C5C\u5C5D\u0000\u0004" + - "\u5D07\u060E\u1B16\u2211\u2914\uFFFF\u0043\uFFFD\u5D19\u5D24\u5D27\u5D17\u5DE2\u0000\u0004\u5E38" + - "\u3633\u37B7\uB8B6\uB5BE\u0000\u0006\u5F35\u3757\u6C69\u6B97\u999E\u98A1\uA09C\u0000\n\u607F" + - "\uA389\uA0A8\uCBB4\uE6BD\uC5BB\uB5DC\uBCD8\uD5C6\uDFB8\uDAC7\u621A\u621B\u6248\u0000\u0005\u63A0" + - "\uA772\u96A2\uA577\u6798\uAA71\u63A9\uFFFD\u0000\b\u6389\u839B\u6BA8\u8488\u99A1\uAC92\u8F80" + - "\u7B69\u687A\u655D\u6556\u6551\u6559\u6557\u555F\u0000\u0005\u654F\u5855\u549C\u9BAC\uCFCB\uCCCE" + - "\u0000\u0003\u665D\u5A64\u6866\u5EF9\u52D7\u671B\u0000\n\u6881\uAFA2\u93B5\u7F76\uB1A7\u97B0" + - "\u83C4\uAD86\u8594\u9DA8\u9FA1\u6882\u6B32\u6BBA\u6BEB\u6BEC\u6C2B\u0000\u0004\u6D8E\uBCF3\uD9B2" + - "\uE1CC\uE4FB\u6DFA\u6E05\u0000\u0005\u6DC7\uCBAF\uD1AE\uDEF9\uB8F7\uF5C5\u6DD2\u6E1A\u0000\u0006" + - "\u6DB5\uDAEB\uD8EA\uF1EE\uE8C6\uC4AA\uECBF\u6DE6\u70F9\u7109\u710A\u70FD\u70EF\u723D\u727D\u7281" + - "\u731C\u731B\u7316\u7313\u7319\u7387\u7405\u740A\u7403\uFFFF\u0043\uFFFD\u7406\u73FE\u740D\u74E0" + - "\u74F6\u74F7\u0000\u0005\u751C\u2265\u6662\u708F\uD4D5\uB5CA\u75CD\u768E\u76D4\u76D2\u76DB\u7737" + - "\u773E\u773C\u7736\u7738\u773A\u786B\u7843\u784E\u7965\u7968\u796D\u79FB\u7A92\u7A95\u0000\u0003" + - "\u7B20\u281B\u2C26\u191E\u7B2E\u7C92\u7C97\u7C95\u0000\u0006\u7D46\u4371\u2E39\u3C40\u3033\u442F" + - "\u4232\u7D31\u7F3D\uFFFD\u7F9E\u7F9A\u7FCC\u7FCE\u7FD2\u801C\u804A\u8046\u0000\u0003\u812F\u1623" + - "\u2B29\u3024\u8202\u8235\u8237\u8236\u8239\u0000\b\u838E\u9E98\u78A2\u96BD\uAB92\u8A93\u89A0" + - "\u777B\u7C86\u83A7\u8655\u5F6A\u0000\u0004\u86C7\uC0B6\uC4B5\uC6CB\uB1AF\u86C9\u0000\u0003\u8853" + - "\u9E88\uAB92\u968D\u888B\u8993\u898F\u0000\u0004\u8A2A\u1D23\u2531\u2D1F\u1B22\u0000\u0003\u8C49" + - "\u5AA9\uACAB\uA8AA\u8CA7\u8D67\u8D66\u8DBE\u8DBA\u8EDB\u8EDF\u0000\t\u9019\u0D1A\u1723\u1F1D" + - "\u1015\u1E20\u0F22\u161B\u14E8\uEDFD\u0000\u0003\u9157\uCEF5\uE6E3\uE7ED\u91E9\u9589\u0000\u0005" + - "\u966A\u7573\u7870\u7476\u776C\uC0EA\u96E9\u7AE0\u7ADF\uFFFF\u0043\uFFFD\u9802\u9803\u9B5A\u9CE5" + - "\u9E75\u9E7F\u9EA5\u9EBB\u0000\u0004\u50A2\u8D85\u9991\u8096\u989A\u6700\u51F1\u0000\u0003\u5272" + - "\u7475\u69DE\uDDDB\u535A\u53A5\u0000\r\u557B\u80A7\u7C8A\u9D98\u829C\uAA94\u878B\u83B3\uAE9F" + - "\u3EB2\u9ABB\uACB1\u7E89\uAB99\u570D\u0000\u0003\u582F\u2A34\u2430\u3121\uFFFD\u581D\u5820\u58F9" + - "\u58FA\u5960\u5A77\u5A9A\u5A7F\u5A92\u5A9B\u5AA7\u5B73\u5B71\u5BD2\u5BCC\u5BD3\u5BD0\u5C0A\u5C0B" + - "\u5C31\u5D4C\u5D50\u5D34\u5D47\u5DFD\u0000\u0004\u5E45\u3D40\u437E\uCAC1\uC2C4\u5F3C\u5F6D\u5FA9" + - "\u5FAA\u5FA8\u60D1\u60E1\u60B2\u60B6\u60E0\u611C\u6123\u60FA\u6115\u60F0\u60FB\u60F4\u6168\u60F1" + - "\u610E\u60F6\u6109\u6100\u6112\u621F\u6249\u0000\t\u63A3\u8CCF\uC0E9\uC9C6\uCDD2\uE3D0\uE1D6" + - "\uEDEE\u76F4\uEADB\u6452\u63DA\u63F9\u0000\u0003\u655E\u6662\u6391\u90AF\u0000\u0005\u666E\u7074" + - "\u766F\u917A\u7E77\uFEFF\u671F\u671D\u68FA\u68D5\u68E0\u68D8\u68D7\u6905\u0000\u0004\u68DF\uF5EE" + - "\uE7F9\uD2F2\uE3CB\u68CD\u690D\u6912\u690E\u68C9\u68DA\u696E\u68FB\uFFFF\u0043\uFFFD\u0000\u0003" + - "\u6B3E\u3A3D\u9896\uBCEF\u6C2E\u6C2F\u6C2C\u0000\u0011\u6E2F\u3854\u2132\u674A\u2025\u231B\u5B58" + - "\u2456\u6E2D\u266F\u344D\u3A2C\u431D\u3ECB\u8919\u4E63\u4472\u695F\u0000\u0003\u7119\u1A26\u3021" + - "\u366E\u711C\u724C\u7284\u7280\u7336\u7325\u7334\u7329\u743A\u742A\u7433\uFFFD\u0000\u0004\u7422" + - "\u2535\u3634\u2F1B\u2628\u0000\u0005\u7525\u266B\u6AE2\uDBE3\uD9D8\uDEE0\u767B\u767C\u7696\u7693" + - "\u76B4\u76DC\u774F\u77ED\u785D\u786C\u786F\u0000\u0004\u7A0D\u080B\u0500\u9897\u96E5\u7AE3\u0000" + - "\u0004\u7B49\u5646\u5052\u544D\u4B4F\u7B51\u7C9F\u7CA5\u0000\u0005\u7D5E\u5068\u552B\u6E72\u6166" + - "\u6270\u7D73\u5584\u7FD4\u7FD5\u800B\u8052\u8085\u0000\u0005\u8155\u544B\u514E\u3946\u3E4C\u5374" + - "\u8212\u821C\u83E9\u8403\u83F8\u840D\u83E0\u83C5\u840B\u83C1\u83EF\u83F1\u83F4\u8457\u840A\u83F0" + - "\u840C\u83CC\u83FD\u83F2\u83CA\u8438\u840E\u8404\u83DC\u8407\u83D4\u83DF\u0000\u0004\u865B\uDFD9" + - "\uEDD4\uDBE4\uD0DE\u8857\u88C1\u88C2\u88B1\u8983\u8996\uFFFF\u0043\uFFFD\u0000\u0006\u8A3B\u6055" + - "\u5E3C\u4154\u5B50\u4634\u3A36\u8A56\u0000\u0006\u8C61\u82AF\uBCB3\uBDC1\uBBC0\uB4B7\uB6BF\u8CB8" + - "\u0000\u0005\u8D8A\u8581\uCEDD\uCBDA\uD1CC\uDBC6\u8EFB\u8EF8\u8EFC\u8F9C\u902E\u9035\u9031\u9038" + - "\u9032\u9036\u9102\u90F5\u9109\u90FE\u9163\u9165\u91CF\u0000\u0003\u9214\u1523\u091E\u0D10\uFFFD" + - "\u9207\u9211\u0000\u0003\u9594\u8F8B\u9193\u928E\u0000\u0007\u968A\u8E8B\u7D85\u868D\u7284\uC1C5" + - "\uC4C6\uC7EF\u96F2\u97CC\u0000\u0004\u9805\u0608\uE7EA\uEFE9\uF2ED\u99AE\u99AD\u9EC3\u9ECD\u9ED1" + - "\u4E82\u0000\u0005\u50AD\uB5B2\uB3C5\uBEAC\uB7BB\uAFC7\u0000\u0003\u527F\u777D\uDFE6\uE4E2\u52E3" + - "\u532F\u0000\b\u55DF\uE8D3\uE6CE\uDCC7\uD1E3\uE4EF\uDAE1\uC5C6\uE5C9\u5712\u5713\u0000\u0006" + - "\u585E\u5158\u575A\u546B\u4C6D\u4A62\u524B\u5967\u0000\u0004\u5AC1\uC9CC\uBEBD\uBCB3\uC2B2\u5D69" + - "\u5D6F\u5E4C\u5E79\u5EC9\u5EC8\u5F12\u5F59\u5FAC\u5FAE\u611A\u610F\u6148\u611F\u60F3\u611B\u60F9" + - "\u6101\u6108\u614E\u614C\u6144\uFFFF\u0043\uFFFD\u0000\u0003\u614D\u3E34\u270D\u0637\u6221\u6222" + - "\u0000\u0007\u6413\u3E1E\u2A2D\u3D2C\u0F1C\u140D\u3616\u1706\u656C\u659F\u65B0\u0000\u0003\u6697" + - "\u8987\u8896\u8498\u668D\u6703\u0000\t\u6994\u6D5A\u7760\u5475\u3082\u4A68\u6B5E\u5379\u865D" + - "\u635B\u6B47\u6B72\u6BC0\u6BBF\u6BD3\u6BFD\u6EA2\u6EAF\uFFFD\u0000\t\u6ED3\uB6C2\u909D\uC7C5" + - "\uA598\uBCBA\uABD1\u969C\uC4D4\uAAA7\u6EB4\u0000\u0007\u714E\u5969\u6449\u675C\u6C66\u4C65\u5E46" + - "\u6856\u723A\u7252\u7337\u7345\u733F\u733E\u0000\u0004\u746F\u5A55\u5F5E\u413F\u595B\u745C\u7576" + - "\u7578\u7600\u75F0\u7601\u75F2\u75F1\u75FA\u75FF\u75F4\u75F3\u76DE\u76DF\u0000\u0006\u775B\u6B66" + - "\u5E63\u796A\u6C5C\u6568\u62EE\u0000\u0004\u788E\uB097\u988C\u897C\u9193\u787F\u797A\u797F\u7981" + - "\u842C\u79BD\u0000\u0003\u7A1C\u1A20\u141F\u1E9F\u7AA0\u7B77\u7BC0\u7B60\u7B6E\u7B67\u7CB1\u7CB3" + - "\u7CB5\u7D93\u7D79\u7D91\u7D81\u7D8F\u7D5B\u0000\u0003\u7F6E\u696A\u72A9\uA8A4\u8056\u8058\u8086" + - "\u8084\uFFFF\u0043\uFFFD\u0000\u0004\u8171\u7078\u656E\u736B\u797A\u8166\u8205\u8247\u0000\b" + - "\u8482\u773D\u3175\u666B\u496C\u5B3C\u3561\u6369\u6D46\u865E\u865C\u865F\u86F9\u8713\u8708\u8707" + - "\u8700\u86FE\u86FB\u8702\u8703\u8706\u870A\u0000\u0005\u8859\uDFD4\uD9DC\uD8DD\uE1CA\uD5D2\u899C" + - "\u89E3\u0000\u0003\u8A6B\u7273\u6669\u7087\uFFFD\u0000\u0006\u8A7C\u63A0\u7185\u6D62\u6E6C\u797B" + - "\u3E68\u0000\u0005\u8C62\u8A89\uCAC7\uC8C4\uB2C3\uC2C5\u0000\u0004\u8DE1\uDFE8\uEFF3\uFAEA\uE4E6" + - "\u8EB2\u8F03\u8F09\u8EFE\u8F0A\u8F9F\u8FB2\u0000\u0007\u904B\u4A53\u4254\u3C55\u5047\u4F4E\u4D51" + - "\u3E41\u9112\u9117\u916C\u916A\u9169\u91C9\u0000\b\u9237\u5738\u3D40\u3E5B\u4B64\u5134\u494D" + - "\u4539\u3F5A\u9598\u0000\u0005\u9698\u9495\uCDCB\uC9CA\uF7FB\uF9F6\u9756\u9774\u9776\u0000\u0004" + - "\u9810\u1113\u0A12\u0CFC\uF4FD\u98FE\u99B3\u99B1\u99B4\u9AE1\u9CE9\u9E82\u9F0E\u9F13\u9F20\u0000" + - "\u0005\u50E7\uEEE5\uD6ED\uDAD5\uCFD1\uF1CE\u50E9\u5162\uFFFF\u0043\uFFFD\u51F3\u5283\u5282\u5331" + - "\u53AD\u55FE\u5600\u561B\u5617\u55FD\u5614\u5606\u5609\u560D\u560E\u55F7\u5616\u561F\u5608\u5610" + - "\u55F6\u5718\u5716\u0000\u0004\u5875\u7E83\u938A\u7985\u7DFD\u5925\u5922\u5924\u596A\u5969\u0000" + - "\u0003\u5AE1\uE6E9\uD7D6\uD8E3\u0000\u0004\u5B75\uDEE7\uE1E5\uE6E8\uE2E4\u5BDF\u5C0D\u5C62\u5D84" + - "\u5D87\u5E5B\u5E63\u5E55\u5E57\u5E54\uFFFD\u5ED3\u5ED6\u5F0A\u5F46\u5F70\u5FB9\u0000\u0004\u6147" + - "\u3F4B\u7762\u635F\u5A58\u6175\u622A\u0000\u0005\u6487\u5854\uA478\u5F7A\u5167\u346D\u647B\u6572" + - "\u65A1\u65D7\u65D6\u66A2\u66A8\u669D\u0000\t\u699C\uA895\uC1AE\uD3CB\u9BB7\uBBAB\uB4D0\uCDAD" + - "\uCCA6\uC3A3\u6B49\u6B4C\u6C33\u6F33\u6F14\u6EFE\u6F13\u6EF4\u0000\u0003\u6F29\u3E20\u2C0F\u0222" + - "\u6EFF\u6EEF\u0000\u0004\u6F06\u3138\u3223\u152B\u2F88\u6F2A\u6EEC\u6F01\u6EF2\u6ECC\u6EF7\u7194" + - "\u7199\u717D\u718A\u7184\u7192\u723E\u7292\u7296\u7344\u7350\u7464\u7463\u746A\u7470\u746D\u7504" + - "\u7591\u0000\u0003\u7627\u0D0B\u0913\uE1E3\u7784\u777D\u777F\u7761\u78C1\u789F\u78A7\u78B3\u78A9" + - "\u78A3\u798E\u798F\u798D\uFFFF\u0043\uFFFD\u7A2E\u7A31\u7AAA\u7AA9\u7AED\u7AEF\u0000\u0005\u7BA1" + - "\u958B\u7597\u9D94\u8FB8\u8784\u7CB9\u7CBD\u7CBE\u0000\t\u7DBB\uB09C\uBDBE\uA0CA\uB4B2\uB1BA" + - "\uA2BF\uB5B8\uADD2\uC7AC\u7F70\u7FE0\u7FE1\u7FDF\u805E\u805A\u8087\u0000\u0004\u8150\u808F\u888A" + - "\u7F82\uE7FA\u8207\u8214\u821E\u824B\u84C9\u84BF\u84C6\u84C4\uFFFD\u0000\u0005\u8499\u9EB2\u9CCB" + - "\uB8C0\uD390\uBCD1\u84CA\u0000\u0004\u873F\u1C3B\u2225\u3418\u5537\u8729\u88F3\u8902\u88F4\u88F9" + - "\u88F8\u88FD\u88E8\u891A\u88EF\u0000\u0007\u8AA6\u8C9E\uA38D\uA193\uA4AA\uA5A8\u9891\u9AA7\u8C6A" + - "\u8C8D\u8C8C\u8CD3\u8CD1\u8CD2\u8D6B\u8D99\u8D95\u8DFC\u8F14\u8F12\u8F15\u8F13\u8FA3\u0000\u0004" + - "\u9060\u585C\u6359\u5E62\u5D5B\u0000\u0003\u9119\u181E\u7578\u7774\u0000\u0005\u9278\u8085\u9896" + - "\u7B93\u9CA8\u7C91\u95A1\u95A8\u95A9\u95A3\u95A5\u95A4\u9699\u969C\u969B\u96CC\u96D2\u9700\u977C" + - "\u9785\u97F6\u9817\u9818\u98AF\u98B1\u9903\u9905\u990C\u9909\u99C1\u9AAF\u9AB0\u9AE6\u9B41\u9B42" + - "\u9CF4\u9CF6\u9CF3\u9EBC\u9F3B\u9F4A\u5104\u5100\uFFFF\u0043\uFFFD\u50FB\u50F5\u50F9\u5102\u5108" + - "\u5109\u5105\u51DC\u5287\u5288\u5289\u528D\u528A\u52F0\u53B2\u0000\u0006\u562E\u3B39\u323F\u3429" + - "\u534E\u5774\u362F\u5630\u0000\u0003\u5880\u9F9E\uB39C\uAEA9\u58A6\u596D\u5B09\u5AFB\u5B0B\u5AF5" + - "\u5B0C\u5B08\u5BEE\u5BEC\u5BE9\u5BEB\u5C64\u5C65\u5D9D\u5D94\u0000\u0004\u5E62\u5F61\uE2DA\uDFDD" + - "\uE3E0\u5F48\u5F71\uFFFD\u5FB7\u5FB5\u0000\t\u6176\u676E\u5D55\u827C\u706B\u7EA7\u90AB\u8EAC" + - "\u9AA4\u94AE\u622E\u0000\n\u6469\u6F79\u9EB2\u8890\uB0A5\u9395\uA992\uAEAD\uAB9A\uAC99\uA2B3" + - "\u6575\u6577\u6578\u66AE\u66AB\u66B4\u66B1\u6A23\u6A1F\u69E8\u6A01\u6A1E\u6A19\u69FD\u6A21\u6A13" + - "\u6A0A\u69F3\u6A02\u6A05\u69ED\u6A11\u6B50\u6B4E\u6BA4\u6BC5\u6BC6\u0000\b\u6F3F\u7C84\u5166" + - "\u5486\u6D5B\u786E\u8E7A\u7064\u9758\u6ED5\u6F6F\u6F60\u6F5F\u719F\u71AC\u71B1\u71A8\u7256\u729B" + - "\u734E\u7357\u7469\u748B\u7483\u747E\u7480\u757F\u0000\u0004\u7620\u291F\u2426\u2122\u9ABA\u76E4" + - "\u778E\u7787\u778C\u7791\u778B\u78CB\u78C5\u78BA\u78CA\u78BE\uFFFF\u0043\uFFFD\u78D5\u78BC\u78D0" + - "\u0000\u0003\u7A3F\u3C40\u3D37\u3BAF\u7AAE\u0000\u0004\u7BAD\uB1C4\uB4C6\uC7C1\uA0CC\u7CCA\u0000" + - "\u0007\u7DE0\uF4EF\uFBD8\uECDD\uE8E3\uDADE\uE99E\uD9F2\u7DF9\u7F75\u7F77\u7FAF\u7FE9\u8026\u819B" + - "\u819C\u819D\u81A0\u819A\u8198\u8517\u853D\u851A\u84EE\u0000\u0003\u852C\u2D13\u1123\u2114\u84EC" + - "\u8525\u84FF\u8506\uFFFD\u0000\u0005\u8782\u7476\u6066\u7868\u5957\u4C53\u885B\u885D\u8910\u8907" + - "\u8912\u8913\u8915\u890A\u0000\b\u8ABC\uD2C7\uC495\uCBF8\uB2C9\uC2BF\uB0D6\uCDB6\uB9DB\u0000" + - "\u0006\u8C4C\u4E6C\uE0DE\uE6E4\uECED\uE2E3\uDCEA\u8CE1\u8D6D\u8D9F\u8DA3\u0000\u0004\u8E2B\u101D" + - "\u220F\u291F\u211E\u8EBA\u0000\u0004\u8F1D\u1B1F\u2926\u2A1C\u1E25\u9069\u906E\u9068\u906D\u9077" + - "\u0000\u0003\u9130\u2D27\u3187\u898B\u9183\u0000\u0006\u92C5\uBBB7\uEAAC\uE4C1\uB3BC\uD2C7\uF0B2" + - "\u95AD\u95B1\u0000\u0003\u9704\u0607\u0960\u8D8B\u978F\u9821\u982B\u981C\u98B3\u0000\u0005\u990A" + - "\u1312\u18DD\uD0DF\uDBD1\uD5D2\u99D9\u9AB7\uFFFF\u0043\uFFFD\u9AEE\u9AEF\u9B27\u9B45\u9B44\u9B77" + - "\u9B6F\u9D06\u9D09\u9D03\u9EA9\u9EBE\u9ECE\u58A8\u9F52\u0000\u0003\u5112\u1814\u1015\u80AA\u51DD" + - "\u5291\u5293\u52F3\u0000\u0006\u5659\u6B79\u6964\u786A\u6865\u716F\u6C62\u5676\u58C1\u58BE\u58C7" + - "\u58C5\u596E\u5B1D\u5B34\u5B78\u5BF0\u5C0E\u5F4A\u0000\u0004\u61B2\u91A9\u8ACD\uB6BE\uCAC8\u6230" + - "\u64C5\u64C1\uFFFD\u0000\u0005\u64CB\uBBBC\uDAC4\uC7C2\uCDBF\uD2D4\u64BE\u6574\u66C6\u66C9\u66B9" + - "\u66C4\u66C7\u66B8\u0000\u0007\u6A3D\u383A\u596B\u5839\u4462\u614B\u4735\u5F48\u6B59\u6B77\u6C05" + - "\u0000\u0006\u6FC2\uB1A1\uC3A4\uC1A7\uB3C0\uB9B6\uA6A0\u6FB4\u0000\u0005\u71BE\uC9D0\uD2C8\uD5B9" + - "\uCED9\uDCC3\u71C4\u7368\u749C\u74A3\u7498\u749F\u749E\u74E2\u750C\u750D\u7634\u7638\u763A\u76E7" + - "\u76E5\u77A0\u779E\u779F\u77A5\u78E8\u78DA\u78EC\u78E7\u79A6\u7A4D\u7A4E\u7A46\u7A4C\u7A4B\u7ABA" + - "\u7BD9\u7C11\u7BC9\u7BE4\u7BDB\u7BE1\u7BE9\u7BE6\u7CD5\u7CD6\u0000\u0004\u7E0A\u1108\u1B23\u1E1D" + - "\u0910\u7F79\u7FB2\u7FF0\u7FF1\u7FEE\u8028\u81B3\u81A9\u81A8\u81FB\u8208\u8258\u8259\u854A\uFFFF" + - "\u0043\uFFFD\u0000\u0004\u8559\u4868\u6943\u496D\u6A5E\u8783\u879F\u879E\u87A2\u878D\u8861\u0000" + - "\u0003\u892A\u3225\u2B21\uAAA6\u8AE6\u8AFA\u8AEB\u8AF1\u8B00\u8ADC\u8AE7\u8AEE\u8AFE\u8B01\u8B02" + - "\u8AF7\u8AED\u8AF3\u8AF6\u8AFC\u8C6B\u8C6D\u8C93\u8CF4\u8E44\u8E31\u8E34\u8E42\u8E39\u8E35\u8F3B" + - "\u8F2F\u8F38\u8F33\u8FA8\u8FA6\u9075\u9074\u9078\u9072\u907C\u907A\u9134\u9192\u9320\uFFFD\u9336" + - "\u92F8\u9333\u932F\u9322\u92FC\u0000\u0004\u932B\u041A\u1026\u2115\u2E19\u95BB\u96A7\u96A8\u96AA" + - "\u96D5\u0000\u0004\u970E\u1116\u0D13\u0F5B\u5C66\u9798\u0000\u0003\u9830\u383B\u372D\u3924\u0000" + - "\u0004\u9910\u281E\u1B21\u1AED\uE2F1\u9AB8\u9ABC\u9AFB\u9AED\u9B28\u9B91\u9D15\u9D23\u9D26\u9D28" + - "\u9D12\u9D1B\u9ED8\u9ED4\u9F8D\u9F9C\u512A\u511F\u5121\u5132\u52F5\u568E\u5680\u5690\u5685\u5687" + - "\u568F\u58D5\u58D3\u58D1\u58CE\u5B30\u5B2A\u5B24\u5B7A\u5C37\u5C68\u5DBC\u5DBA\u5DBD\u5DB8\u5E6B" + - "\u5F4C\u5FBD\u61C9\u61C2\u61C7\u61E6\u61CB\u6232\u6234\u0000\u0004\u64CE\uCAD8\uE0F0\uE6EC\uF1E2" + - "\u64ED\u6582\u6583\u66D9\u66D6\u0000\u0005\u6A80\u9484\uA29C\uDBA3\u7E97\u90A0\u6B5C\u6BAE\u6BDA" + - "\uFFFF\u0043\uFFFD\u6C08\u0000\u0007\u6FD8\uF1DF\uE0DB\uE4EB\uEF80\uECE1\uE9D5\uEEF0\u0000\u0004" + - "\u71E7\uDFEE\uE6E5\uEDEC\uF4E0\u7235\u7246\u7370\u7372\u74A9\u74B0\u74A6\u74A8\u7646\u7642\u764C" + - "\u76EA\u0000\u0003\u77B3\uAAB0\uACA7\uADEF\u78F7\u78FA\u78F4\u78EF\u7901\u79A7\u79AA\u7A57\u7ABF" + - "\u7C07\u7C0D\u7BFE\u7BF7\u7C0C\u7BE0\u7CE0\u7CDC\u7CDE\u7CE2\uFFFD\u7CDF\u7CD9\u7CDD\u0000\b" + - "\u7E2E\u3E46\u3732\u432B\u3D31\u4541\u3439\u4835\u3F2F\u7F44\u7FF3\u7FFC\u8071\u8072\u8070\u806F" + - "\u8073\u0000\u0004\u81C6\uC3BA\uC2C0\uBFBD\uC9BE\u81E8\u8209\u8271\u0000\u0005\u85AA\u847E\u9C91" + - "\u94AF\u9B87\uA88A\u8667\u0000\u0004\u87C0\uD1B3\uD2C6\uABBB\uBAC8\u87CB\u893B\u8936\u8944\u8938" + - "\u893D\u89AC\u0000\u0004\u8B0E\u1719\u1B0A\u201D\u0410\u0000\u0003\u8C41\u3F73\uFAFD\uFCF8\u8CFB" + - "\u8DA8\u8E49\u8E4B\u8E48\u8E4A\u8F44\u8F3E\u8F42\u8F45\u8F3F\u907F\u907D\u9084\u9081\u9082\u9080" + - "\u9139\u91A3\u919E\u919C\u0000\u0006\u934D\u8228\u754A\u654B\u187E\u6C5B\u705A\u9354\u95CA\u95CB" + - "\u95CC\u95C8\u95C6\u96B1\uFFFF\u0043\uFFFD\u96B8\u96D6\u971C\u971E\u97A0\u97D3\u9846\u98B6\u9935" + - "\u9A01\u99FF\u9BAE\u9BAB\u9BAA\u9BAD\u9D3B\u9D3F\u9E8B\u9ECF\u9EDE\u9EDC\u9EDD\u9EDB\u9F3E\u9F4B" + - "\u53E2\u5695\u56AE\u58D9\u58D8\u5B38\u5F5E\u61E3\u6233\u64F4\u64F2\u64FE\u6506\u64FA\u64FB\u64F7" + - "\u65B7\u66DC\u6726\u0000\u0003\u6AB3\uACC3\uBBB8\uC2AE\u6AAF\u6B5F\u6B78\u6BAF\u7009\u700B\u6FFE" + - "\u7006\u6FFA\u7011\u700F\u71FB\uFFFD\u71FC\u71FE\u71F8\u7377\u7375\u74A7\u74BF\u7515\u7656\u7658" + - "\u7652\u77BD\u77BF\u77BB\u77BC\u790E\u79AE\u7A61\u7A62\u7A60\u7AC4\u7AC5\u0000\u0003\u7C2B\u272A" + - "\u1E23\u21E7\u0000\u0003\u7E54\u555E\u5A61\u5259\u7F48\u7FF9\u7FFB\u8077\u8076\u81CD\u81CF\u820A" + - "\u0000\u0004\u85CF\uA9CD\uD0C9\uB0BA\uB9A6\u87EF\u87EC\u87F2\u87E0\u8986\u89B2\u89F4\u8B28\u8B39" + - "\u8B2C\u8B2B\u8C50\u8D05\u0000\u0003\u8E59\u6366\u645F\u55C0\u8F49\u8F4D\u9087\u9083\u9088\u91AB" + - "\u91AC\u91D0\u0000\u0005\u9394\u8A96\uA2B3\uAEAC\uB098\u9A97\u95D4\u95D6\u95D0\u95D5\u96E2\u96DC" + - "\u96D9\u96DB\u96DE\u9724\u97A3\u97A6\u97AD\u97F9\u984D\u984F\u984C\u984E\u9853\u98BA\u993E\u993F" + - "\u993D\u992E\u99A5\u9A0E\u9AC1\u9B03\u9B06\u9B4F\u9B4E\u9B4D\u9BCA\uFFFF\u0043\uFFFD\u9BC9\u9BFD" + - "\u9BC8\u9BC0\u9D51\u9D5D\u9D60\u9EE0\u9F15\u9F2C\u5133\u56A5\u58DE\u58DF\u58E2\u5BF5\u9F90\u5EEC" + - "\u61F2\u61F7\u61F6\u61F5\u6500\u650F\u66E0\u66DD\u6AE5\u6ADD\u6ADA\u6AD3\u0000\u0003\u701B\u1F28" + - "\u1A1D\u1518\u7206\u720D\u7258\u72A2\u7378\u737A\u74BD\u74CA\u74E3\u7587\u7586\u765F\u7661\u77C7" + - "\u7919\u79B1\u7A6B\u7A69\u7C3E\u7C3F\u7C38\u7C3D\u7C37\u7C40\u7E6B\u7E6D\uFFFD\u7E79\u7E69\u7E6A" + - "\u7F85\u7E73\u7FB6\u7FB9\u7FB8\u81D8\u0000\u0003\u85E9\uDDEA\uD5E4\uE5F7\u87FB\u8805\u880D\u87F9" + - "\u87FE\u8960\u895F\u8956\u895E\u0000\u0004\u8B41\u5C58\u495A\u4E4F\u4659\u8D08\u8D0A\u0000\u0003" + - "\u8E7C\u7287\u766C\u7A74\u8F54\u8F4E\u8FAD\u908A\u908B\u91B1\u91AE\u0000\u0006\u93E1\uD1DF\uC3C8" + - "\uDCDD\uD6E2\uCDD8\uE4D7\u93E8\u95DC\u96B4\u96E3\u972A\u9727\u9761\u97DC\u97FB\u985E\u9858\u985B" + - "\u98BC\u9945\u9949\u9A16\u9A19\u9B0D\u9BE8\u9BE7\u9BD6\u9BDB\u9D89\u9D61\u9D72\u9D6A\u9D6C\u9E92" + - "\u9E97\u9E93\u9EB4\u52F8\u56A8\u56B7\u56B6\u56B4\u56BC\u58E4\u5B40\u5B43\u5B7D\u5BF6\u5DC9\u61F8" + - "\u61FA\u6518\u6514\u6519\u66E6\u6727\u6AEC\u703E\u7030\u7032\u7210\u737B\u74CF\u7662\u7665\u7926" + - "\u792A\u792C\uFFFF\u0043\uFFFD\u792B\u7AC7\u7AF6\u7C4C\u7C43\u7C4D\u7CEF\u7CF0\u8FAE\u7E7D\u7E7C" + - "\u7E82\u7F4C\u8000\u81DA\u8266\u85FB\u85F9\u8611\u85FA\u8606\u860B\u8607\u860A\u8814\u8815\u8964" + - "\u89BA\u89F8\u8B70\u8B6C\u8B66\u8B6F\u8B5F\u8B6B\u8D0F\u8D0D\u8E89\u8E81\u8E85\u8E82\u91B4\u91CB" + - "\u9418\u9403\u93FD\u95E1\u9730\u98C4\u9952\u9951\u99A8\u9A2B\u9A30\u9A37\u9A35\u9C13\u9C0D\u9E79" + - "\u9EB5\u9EE8\u9F2F\u9F5F\uFFFD\u9F63\u9F61\u5137\u5138\u56C1\u56C0\u56C2\u5914\u5C6C\u5DCD\u61FC" + - "\u61FE\u651D\u651C\u6595\u66E9\u6AFB\u6B04\u6AFA\u6BB2\u704C\u721B\u72A7\u74D6\u74D4\u7669\u77D3" + - "\u7C50\u7E8F\u7E8C\u7FBC\u8617\u862D\u861A\u8823\u8822\u8821\u881F\u896A\u896C\u89BD\u8B74\u8B77" + - "\u8B7D\u8D13\u8E8A\u8E8D\u8E8B\u8F5F\u8FAF\u91BA\u0000\u0003\u942E\u3335\u3A38\u322B\u95E2\u9738" + - "\u9739\u9732\u97FF\u9867\u9865\u9957\u9A45\u9A43\u9A40\u9A3E\u9ACF\u9B54\u9B51\u9C2D\u9C25\u9DAF" + - "\u9DB4\u9DC2\u9DB8\u9E9D\u9EEF\u9F19\u9F5C\u9F66\u9F67\u513C\u513B\u56C8\u56CA\u56C9\u5B7F\u5DD4" + - "\u5DD2\u5F4E\u61FF\u6524\u6B0A\u6B61\u7051\u7058\u7380\u74E4\u758A\u766E\u766C\u79B3\u7C60\u7C5F" + - "\u807E\u807D\u81DF\u8972\u896F\u89FC\u8B80\u8D16\u8D17\u8E91\u8E93\u8F61\u9148\u9444\u9451\u9452" + - "\u973D\uFFFF\u0043\uFFFD\u973E\u97C3\u97C1\u986B\u9955\u9A55\u9A4D\u9AD2\u9B1A\u9C49\u9C31\u9C3E" + - "\u9C3B\u9DD3\u9DD7\u9F34\u9F6C\u9F6A\u9F94\u56CC\u5DD6\u6200\u6523\u652B\u652A\u66EC\u6B10\u74DA" + - "\u7ACA\u7C64\u7C63\u7C65\u7E93\u7E96\u7E94\u81E2\u8638\u863F\u8831\u8B8A\u9090\u908F\u9463\u9460" + - "\u9464\u9768\u986F\u995C\u9A5A\u9A5B\u9A57\u9AD3\u9AD4\u9AD1\u9C54\u9C57\u9C56\u9DE5\u9E9F\u9EF4" + - "\u56D1\u58E9\u652C\uFFFD\u705E\u7671\u7672\u77D7\u7F50\u7F88\u8836\u8839\u8862\u8B93\u8B92\u8B96" + - "\u8277\u8D1B\u91C0\u946A\u9742\u9748\u9744\u97C6\u9870\u9A5F\u9B22\u9B58\u9C5F\u9DF9\u9DFA\u9E7C" + - "\u9E7D\u9F07\u9F77\u9F72\u5EF3\u6B16\u7063\u7C6C\u7C6E\u883B\u89C0\u8EA1\u91C1\u9472\u9470\u9871" + - "\u995E\u9AD6\u9B23\u9ECC\u7064\u77DA\u8B9A\u9477\u97C9\u9A62\u9A65\u7E9C\u8B9C\u8EAA\u91C5\u947D" + - "\u947E\u947C\u9C77\u9C78\u9EF7\u8C54\u947F\u9E1A\u7228\u9A6A\u9B31\u9E1B\u9E1E\u7C72\u6491\uFFFF" + - "\u0075\uFFFD\u4E42\u4E5C\u51F5\u531A\u5382\u4E07\u4E0C\u4E47\u4E8D\u56D7\uFA0C\u5C6E\u5F73\u4E0F" + - "\u5187\u4E0E\u4E2E\u4E93\u4EC2\u4EC9\u4EC8\u5198\u52FC\u536C\u53B9\u5720\u5903\u592C\u5C10\u5DFF" + - "\u65E1\u6BB3\u6BCC\u6C14\u723F\u0000\u0003\u4E31\u3CE8\uDCE9\uE1DD\u4EDA\u520C\u531C\u534C\u5722" + - "\u5723\u5917\u592F\u5B81\u5B84\u5C12\u5C3B\u5C74\u5C73\u5E04\u5E80\u5E82\u5FC9\u6209\u6250\u6C15" + - "\uFFFD\u6C36\u6C43\u6C3F\u6C3B\u72AE\u72B0\u738A\u79B8\u808A\u961E\u4F0E\u4F18\u4F2C\u4EF5\u4F14" + - "\u4EF1\u4F00\u4EF7\u0000\u0003\u4F08\u1D02\u0522\u1304\u4EF4\u4F12\u51B1\u5213\u5209\u5210\u52A6" + - "\u5322\u531F\u534D\u538A\u5407\u56E1\u56DF\u572E\u572A\u5734\u0000\u0003\u593C\u807C\u857B\u7E77" + - "\u597F\u5B56\u5C15\u5C25\u5C7C\u5C7A\u5C7B\u5C7E\u5DDF\u5E75\u5E84\u5F02\u5F1A\u5F74\u5FD5\u5FD4" + - "\u5FCF\u0000\u0004\u6265\u5C5E\u6461\u6662\u5960\u625A\u65EF\u65EE\u0000\u0003\u673E\u3938\u3B3A" + - "\u3F3C\u6733\u0000\u0004\u6C18\u4652\u5C4F\u4A54\u4B4C\u7071\u725E\u72B4\u72B5\u738E\u752A\u767F" + - "\u7A75\u7F51\u8278\u827C\u8280\u827D\u827F\u864D\u897E\u9099\u9097\u9098\u909B\u9094\u9622\u9624" + - "\u9620\u9623\u4F56\u4F3B\u4F62\u4F49\u4F53\uFFFF\u0043\uFFFD\u0000\u0005\u4F64\u3E67\u525F\u4158" + - "\u2D33\u3F61\u518F\u51B9\u521C\u521E\u5221\u52AD\u52AE\u5309\u5363\u5372\u538E\u538F\u0000\u0007" + - "\u5430\u372A\u5445\u191C\u2518\u3D4F\u4128\u2447\u56EE\u56E7\u56E5\u5741\u5745\u574C\u5749\u574B" + - "\u5752\u0000\u0005\u5906\u40A6\u98A0\u978E\uA290\u8FA7\u59A1\u5B8E\u5B92\u5C28\u5C2A\uFFFD\u0000" + - "\u0004\u5C8D\u8F88\u8B89\u928A\u8693\u5C95\u5DE0\u0000\u0003\u5E0A\u0E8B\u898C\u888D\u0000\b" + - "\u5F05\u1D78\u76D2\uD1D0\uEDE8\uEEF3\uE1E4\uE3FA\uEFF7\u5FFB\u6000\u5FF4\u0000\b\u623A\u838C" + - "\u8E8F\u9487\u717B\u7A70\u8188\u777D\u7274\u6537\u65F0\u65F4\u65F3\u65F2\u65F5\u0000\u0004\u6745" + - "\u4759\u554C\u485D\u4D5A\u674B\u6BD0\u0000\n\u6C19\u1A78\u676B\u848B\u8F71\u6F69\u9A6D\u8795" + - "\u9C66\u7365\u7B8E\u7074\u707A\u0000\u0003\u7263\uBFBD\uC3C6\uC1BA\u72C5\u7395\u7397\u7393\u7394" + - "\u7392\u753A\u7539\u7594\u7595\u7681\u793D\u8034\u8095\u8099\u8090\u8092\u809C\u8290\u828F\u8285" + - "\u828E\u8291\uFFFF\u0043\uFFFD\u8293\u828A\u8283\u8284\u8C78\u8FC9\u8FBF\u909F\u90A1\u90A5\u909E" + - "\u90A7\u90A0\u9630\u9628\u962F\u962D\u4E33\u0000\r\u4F98\u7C85\u7D80\u8776\u7489\u8477\u4C97" + - "\u6A9A\u7981\u7890\u9C94\u9E92\u8295\u6B6E\u519E\u51BC\u51BE\u5235\u5232\u5233\u5246\u5231\u52BC" + - "\u530A\u530B\u533C\u5392\u5394\u5487\u547F\u5481\u5491\uFFFD\u0000\b\u5482\u886B\u7A7E\u656C" + - "\u7466\u8D6F\u6160\u9863\u6764\u56F7\u56F9\u0000\u0007\u576F\u726D\u6B71\u7076\u8075\u7B73\u7462" + - "\u687D\u0000\t\u590C\u45B5\uBACF\uCEB2\uCCC1\uB6BC\uC3D6\uB1BD\uC0C8\uB4C7\u5B62\u5B65\u5B93" + - "\u5B95\u0000\t\u5C44\u47AE\uA4A0\uB5AF\uA8AC\u9FA3\uADA2\uAAA7\u9DA5\uB6B0\u5CA6\u5E17\u5E14" + - "\u5E19\u0000\u0004\u5F28\u2223\u2454\u827E\u7DDE\u5FE5\u0000\n\u602D\u2619\u320B\u340A\u1733" + - "\u1A1E\u2C22\u0D10\u2E13\u110C\u091C\u0000\u0006\u6214\u3DAD\uB4D1\uBEAA\uB6CA\uAEB3\uAFBB\u62A9" + - "\uFFFF\u0043\uFFFD\u62B0\u62B8\u653D\u65A8\u65BB\u6609\u65FC\u6604\u6612\u6608\u65FB\u6603\u660B" + - "\u660D\u6605\u65FD\u6611\u6610\u66F6\u0000\u000B\u670A\u856C\u8E92\u767B\u9886\u8474\u8D8C\u7A9F" + - "\u9199\u837D\u8178\u7994\u6B25\u6B80\u6B7E\u6BDE\u0000\b\u6C1D\u93EC\uEBEE\uD9B6\uD4AD\uE7B7" + - "\uD0C2\uBAC3\uC6ED\uFFFD\u0000\u0004\u6CF2\uD2DD\uB48A\u9D80\uDEC0\u6D30\u0000\u0003\u6CCD\uC7B0" + - "\uF9CF\uE9D1\u0000\u0005\u7094\u9885\u9386\u8491\u9682\u9A83\u0000\u0005\u726A\uD6CB\uD8C9\uDCD2" + - "\uD4DA\uCCD1\u0000\u0003\u73A4\uA1AD\uA6A2\uA0AC\u739D\u74DD\u74E8\u753F\u7540\u753E\u758C\u7598" + - "\u76AF\u76F3\u76F1\u76F0\u76F5\u77F8\u77FC\u77F9\u77FB\u77FA\u77F7\u7942\u793F\u79C5\u7A78\u7A7B" + - "\u7AFB\u7C75\u7CFD\u0000\u0003\u8035\u8FAE\uA3B8\uB5AD\u0000\n\u8220\uA0C0\uAB9A\u989B\uB5A7" + - "\uAEBC\u9EBA\uB4A8\uA1A9\uC2A4\uC3B6\u82A2\u8670\u866F\u866D\u866E\u8C56\u0000\u0003\u8FD2\uCBD3" + - "\uCDD6\uD5D7\u90B2\u90B4\u90AF\u90B3\u90B0\u9639\u963D\u963C\u963A\u9643\u4FCD\uFFFF\u0043\uFFFD" + - "\u0000\b\u4FC5\uD3B2\uC9CB\uC1D4\uDCD9\uBBB3\uDBC7\uD6BA\uC0B9\u4FEC\u5244\u5249\u52C0\u52C2" + - "\u533D\u537C\u5397\u5396\u5399\u5398\u54BA\u54A1\u54AD\u54A5\u54CF\u54C3\u830D\u0000\u0006\u54B7" + - "\uAED6\uB6C5\uC6A0\u70BC\uA2BE\u72DE\u54B0\u0000\u0006\u57B5\u9E9F\uA48C\u979D\u9B94\u988F\u99A5" + - "\u579A\uFFFD\u5795\u58F4\u590D\u5953\u59E1\u59DE\u59EE\u5A00\u0000\b\u59F1\uDDFA\uFDFC\uF6E4" + - "\uF2F7\uDBE9\uF3F5\uE0FE\uF4ED\u5BA8\u0000\n\u5C4C\uD0D8\uCCD7\uCBDB\uDEDA\uC9C7\uCAD6\uD3D4" + - "\uCFC8\uC6CE\uDFF8\u5DF9\u0000\u0005\u5E21\u2223\u2024\uB0A4\uA29B\uA3A5\u5F07\u5F2E\u5F56\u5F86" + - "\u0000\t\u6037\u3954\u725E\u4553\u4749\u5B4C\u4042\u5F24\u4458\u666E\u6242\u6243\u62CF\u630D" + - "\u630B\u62F5\u630E\u6303\u62EB\u62F9\u630F\u630C\u62F8\u62F6\u6300\u6313\u6314\u62FA\u6315\u62FB" + - "\u62F0\u6541\u6543\u65AA\u65BF\u0000\u0006\u6636\u2132\u351C\u2622\u332B\u3A1D\u3439\u662E\u670F" + - "\u6710\u67C1\u67F2\uFFFF\u0043\uFFFD\u0000\u0012\u67C8\uBADC\uBBF8\uD8C0\uB7C5\uEBE4\uDFB5\uCDB3" + - "\uF7F6\uEEE3\uC2B9\uCEE7\uF0B2\uFCC6\uEDCC\uAEE6\uDBFA\uC9CA\uC3EA\u67CB\u0000\u0003\u6B28\u8284" + - "\uB6D6\uD8E0\u6C20\u6C21\u0000\u0003\u6D28\u342D\u1F3C\u3F12\u6D0A\u6CDA\u0000\u0003\u6D33\u0419" + - "\u3A1A\u1100\uFFFD\u0000\u0007\u6D1D\u4201\u1837\u030F\u4007\u202C\u0822\u0910\u0000\u0004\u70B7" + - "\u9FBE\uB1B0\uA1B4\uB5A9\u0000\u0007\u7241\u494A\u6C70\u736E\uCAE4\uE8EB\uDFEA\uE6E3\u0000\b" + - "\u7385\uCCC2\uC8C5\uB9B6\uB5B4\uEBBF\uC7BE\uC3C6\uB8CB\u74EC\u74EE\u752E\u7547\u7548\u75A7\u75AA" + - "\u7679\u76C4\u7708\u7703\u7704\u7705\u770A\u76F7\u76FB\u76FA\u77E7\u77E8\u0000\u0004\u7806\u1112" + - "\u0510\u0F0E\u0903\u7813\u0000\u0004\u794A\u4C4B\u4544\uD5CD\uCFD6\u79CE\u7A80\u7A7E\u7AD1\u7B00" + - "\u7B01\u7C7A\u7C78\u7C79\u7C7F\u7C80\u7C81\u7D03\u7D08\u7D01\u7F58\u7F91\u7F8D\u7FBE\u0000\u0005" + - "\u8007\u0E0F\u1437\uD8C7\uE0D1\uC8C2\u80D0\uFFFF\u0043\uFFFD\u0000\u0005\u80C5\uE3D9\uDCCA\uD5C9" + - "\uCFD7\uE6CD\u81FF\u8221\u8294\u82D9\u82FE\u82F9\u8307\u82E8\u8300\u82D5\u833A\u0000\u0003\u82EB" + - "\uD6F4\uECE1\uF2F5\u830C\u0000\u0004\u82FB\uF6F0\uEAE4\uE0FA\uF3ED\u8677\u8674\u867C\u8673\u8841" + - "\u884E\u8867\u886A\u8869\u89D3\u8A04\u8A07\u8D72\u8FE3\u8FE1\u8FEE\u8FE0\u0000\u0003\u90F1\uBDBF" + - "\uD5C5\uBEC7\uFFFD\u90CB\u90C8\u91D4\u91D3\u9654\u964F\u9651\u9653\u964A\u964E\u0000\u0003\u501E" + - "\u0507\u1322\u301B\u4FF5\u4FF4\u5033\u5037\u502C\u4FF6\u4FF7\u0000\u0003\u5017\u1C20\u2735\u2F31" + - "\u500E\u0000\u0003\u515A\u9493\uCAC4\uC5C8\u51CE\u0000\u0003\u5261\u5A52\u5E5F\u5562\u52CD\u530E" + - "\u539E\u5526\u54E2\u5517\u5512\u54E7\u54F3\u54E4\u551A\u54FF\u5504\u5508\u54EB\u5511\u5505\u54F1" + - "\u550A\u54FB\u54F7\u54F8\u54E0\u550E\u5503\u550B\u5701\u5702\u57CC\u5832\u0000\u0006\u57D5\uD2BA" + - "\uC6BD\uBCB8\uB6BF\uC7D0\uB9C1\u590E\u594A\u0000\u0004\u5A19\u162D\u2E15\u0F17\u0A1E\u5A33\u5B6C" + - "\u5BA7\u5BAD\u5BAC\u0000\u0003\u5C03\u5654\uECFF\uEEF1\u5CF7\u5D00\u5CF9\u5E29\u5E28\u5EA8\u5EAE" + - "\u5EAA\u5EAC\u5F33\u5F30\u5F67\uFFFF\u0043\uFFFD\u0000\b\u605D\u5A67\u41A2\u8880\u9281\u9D83" + - "\u959B\u9787\u9C8E\u6219\u6246\u62F2\u0000\r\u6310\u562C\u4445\u3643\uE439\u4B4A\u3C29\u4134" + - "\u5854\u592D\u4733\u5A51\u3857\u4048\u654A\u6546\u65C6\u65C3\u65C4\u65C2\u664A\u665F\u6647\u6651" + - "\u6712\u6713\u681F\u681A\u6849\u6832\uFFFD\u0000\u000B\u6833\u3B4B\u4F16\u311C\u352B\u2D2F\u4E44" + - "\u341D\u1214\u2628\u2E4D\u3A25\u6820\u6B2C\u6B2F\u6B2D\u6B31\u6B34\u6B6D\u8082\u0000\u0003\u6B88" + - "\uE6E4\uE8E3\uE2E7\u6C25\u0000\u0012\u6D7A\u6364\u760D\u6192\u5862\u6D6F\u918D\uEF7F\u865E\u6760" + - "\u9770\u7C5F\u8298\u2F68\u8B7E\u8084\u1683\u7B7D\u7590\u70DC\u70D3\u70D1\u70DD\u70CB\u7F39\u0000" + - "\u0006\u70E2\uD7D2\uDEE0\uD4CD\uC5C6\uC7DA\uCEE1\u7242\u7278\u7277\u7276\u7300\u72FA\u72F4\u72FE" + - "\u72F6\u72F3\u72FB\u0000\b\u7301\uD3D9\uE5D6\uBCE7\uE3E9\uDCD2\uDBD4\uDDDA\uD7D8\u73E8\u74DE" + - "\uFFFF\u0043\uFFFD\u74DF\u74F4\u74F5\u0000\u0005\u7521\u5B5F\uB0C1\uBBC4\uC0BF\uB6BA\u768A\u76C9" + - "\u0000\u0005\u771D\u1B10\u1312\u2311\u1519\u1A22\u7727\u0000\u0006\u7823\u2C22\u352F\u282E\u2B21" + - "\u2933\u2A31\u0000\u0007\u7954\u5B4F\u5C53\u5251\uEBEC\uE0EE\uEDEA\uDCDE\u79DD\u7A86\u7A89\u7A85" + - "\u7A8B\u7A8C\u7A8A\uFFFD\u7A87\u7AD8\u0000\u0004\u7B10\u0413\u050F\u080A\u0E09\u7B12\u0000\u0003" + - "\u7C84\u918A\u8C88\u8D85\u0000\u0005\u7D1E\u1D11\u0E18\u1613\u1F12\u0F0C\u0000\u0005\u7F5C\u615E" + - "\u605D\u5B96\u92C3\uC2C0\u0000\u0003\u8016\u3E39\uFAF2\uF9F5\u8101\u80FB\u8100\u8201\u822F\u8225" + - "\u0000\u0010\u8333\u2D44\u1951\u2556\u3F41\u261C\u2242\u4E1B\u2A08\u3C4D\u1624\u2037\u2F29\u4745" + - "\u4C53\u1E2C\u4B27\u8348\u0000\u000B\u8653\u52A2\uA896\u8D91\u9E87\u9786\u8B9A\u85A5\u99A1\uA795" + - "\u988E\u9D90\u8694\u0000\u0006\u8843\u446D\u7576\u7280\u717F\u6F83\u7E74\uFFFF\u0043\uFFFD\u887C" + - "\u8A12\u8C47\u8C57\u8C7B\u8CA4\u8CA3\u8D76\u8D78\u8DB5\u8DB7\u8DB6\u8ED1\u8ED3\u8FFE\u8FF5\u9002" + - "\u8FFF\u8FFB\u9004\u8FFC\u8FF6\u0000\u0005\u90D6\uE0D9\uDAE3\uDFE5\uD8DB\uD7DC\u90E4\u9150\u914E" + - "\u914F\u91D5\u91E2\u91DA\u965C\u965F\u96BC\u98E3\u9ADF\u9B2F\u4E7F\u0000\u0007\u5070\u6A61\u5E60" + - "\u534B\u5D72\u484D\u415B\u4A62\u5015\uFFFD\u0000\u0005\u5045\u5F69\u6B63\u6446\u406E\u7357\u5051" + - "\u51D0\u526B\u526D\u526C\u526E\u52D6\u52D3\u532D\u539C\u0000\u000B\u5575\u763C\u4D50\u342A\u5162" + - "\u3635\u3052\u450C\u3265\u4E39\u482D\u3B40\u554B\u570A\u5707\u57FB\u5814\u57E2\u57F6\u57DC\u57F4" + - "\u5800\u57ED\u57FD\u5808\u57F8\u580B\u57F3\u57CF\u5807\u57EE\u57E3\u57F2\u57E5\u57EC\u57E1\u580E" + - "\u57FC\u5810\u57E7\u5801\u580C\u57F1\u57E9\u57F0\u580D\u5804\u595C\u0000\u0010\u5A60\u5855\u675E" + - "\u3835\u6D50\u5F65\u6C53\u6457\u435D\u5244\u5B48\u8E3E\u4D39\u4C70\u6947\u5156\u425C\u5B72\u5B6E" + - "\u5BC1\u5BC0\u5C59\u0000\u0003\u5D1E\u0B1D\u1A20\u0C28\uFFFF\u0043\uFFFD\u0000\u0004\u5D0D\u2625" + - "\u0F30\u1223\u1F2E\u0000\u0003\u5E3E\u34B1\uB4B9\uB2B3\u5F36\u5F38\u5F9B\u5F96\u5F9F\u0000\n" + - "\u608A\u9086\uBEB0\uBAD3\uD4CF\uE4D9\uDDC8\uB1DB\uB7CA\uBFC3\uCDC0\u0000\n\u6332\u658A\u827D" + - "\uBD9E\uAD9D\u97AB\u8E6F\u8790\u6EAF\u759C\u6DAE\uFFFD\u0000\u0004\u637C\uA43B\u9F78\u8581\u918D" + - "\u6370\u6553\u65CD\u6665\u6661\u665B\u6659\u665C\u6662\u6718\u0000\u0003\u6879\u8790\u9C6D\u6EAE" + - "\u68AB\u6956\u0000\u000E\u686F\uA3AC\uA975\u74B2\u8F77\u927C\u6B72\uAA80\u717E\u9B96\u8BA0\u89A4" + - "\u787B\u918C\u8A7D\u0000\u0004\u6B36\u3337\u3891\u8F8D\u8E8C\u6C2A\u6DC0\u6DAB\u6DB4\u6DB3\u6E74" + - "\u6DAC\u6DE9\u6DE2\u6DB7\u6DF6\u6DD4\u6E00\u0000\r\u6DC8\uE0DF\uD6BE\uE5DC\uDDDB\uF4CA\uBDED" + - "\uF0BA\uD5C2\uCFC9\uD0F2\uD3FD\uD7CD\uE3BB\u70FA\u710D\u70F7\u7117\u70F4\u710C\u70F0\u7104\u70F3" + - "\u7110\u70FC\u70FF\u7106\u7113\u7100\u70F8\u70F6\u710B\u7102\uFFFF\u0043\uFFFD\u710E\u727E\u727B" + - "\u727C\u727F\u0000\u0003\u731D\u1707\u1118\u0A08\u72FF\u730F\u731E\u7388\u73F6\u73F8\u73F5\u7404" + - "\u7401\u73FD\u7407\u7400\u73FA\u73FC\u73FF\u740C\u740B\u73F4\u7408\u0000\u0004\u7564\u63CE\uD2CF" + - "\uCBCC\uD1D0\u768F\u7689\u76D3\u0000\u0005\u7739\u2F2D\u3132\u3433\u3D25\u3B35\u0000\u0004\u7848" + - "\u5249\u4D4A\u4C26\u4550\uFFFD\u0000\u0005\u7964\u6769\u6A63\u6B61\uBBFA\uF8F6\u79F7\u7A8F\u7A94" + - "\u7A90\u0000\t\u7B35\u4734\u2530\u2224\u3318\u2A1D\u312B\u2D2F\u3238\u1A23\u7C94\u7C98\u7C96" + - "\u7CA3\u0000\u0007\u7D35\u3D38\u363A\u452C\u2941\u473E\u3F4A\u3B28\u0000\u0006\u7F63\u959C\u9D9B" + - "\uCACB\uCDD0\uD1C7\uCFC9\u801F\u801E\u801B\u8047\u8043\u8048\u0000\u0006\u8118\u2519\u1B2D\u1F2C" + - "\u1E21\u1527\u1D22\u0000\u0003\u8211\u3833\u3A34\u3274\u0000\u0010\u8390\uA3A8\u8D7A\u73A4\u748F" + - "\u8195\u9975\u94A9\u7D83\u8C9D\u9BAA\u8B7E\uA5AF\u8897\uB07F\uA687\uAE76\uFFFF\u0043\uFFFD\u839A" + - "\u0000\t\u8659\u56BF\uB7C2\uC1C5\uBAB0\uC8B9\uB3B8\uCCB4\uBBBC\uC3BD\u86BE\u0000\t\u8852" + - "\u8995\uA8A2\uAA9A\u91A1\u9F98\uA799\u9B97\uA4AC\u8C93\u888E\u8982\u89D6\u89D9\u89D5\u8A30\u8A27" + - "\u8A2C\u8A1E\u8C39\u8C3B\u8C5C\u8C5D\u8C7D\u8CA5\u0000\u0003\u8D7D\u7B79\uBCC2\uB9BF\u8DC1\uFFFD" + - "\u0000\u0003\u8ED8\uDEDD\uDCD7\uE0E1\u0000\u0007\u9024\u0B11\u1C0C\u21EF\uEAF0\uF4F2\uF3D4\uEBEC" + - "\u90E9\u0000\b\u9156\u585A\u5355\uECF4\uF1F3\uF8E4\uF9EA\uEBF7\uE8EE\u957A\u9586\u9588\u967C" + - "\u966D\u966B\u9671\u966F\u96BF\u976A\u9804\u98E5\u9997\u0000\u0007\u509B\u9594\u9E8B\uA383\u8C8E" + - "\u9D68\u9C92\u8287\u515F\u51D4\u5312\u5311\u53A4\u53A7\u5591\u55A8\u55A5\u55AD\u5577\u5645\u0000" + - "\u0007\u55A2\u9388\u8FB5\u81A3\u92A4\u7D8C\uA67F\u95A1\u558E\u570C\u0000\u0003\u5829\u3719\u1E27" + - "\u2328\u57F5\u0000\u0006\u5848\u251C\u1B33\u3F36\u2E39\u382D\u2C3B\u5961\u5AAF\u5A94\u5A9F\u5A7A" + - "\u5AA2\u5A9E\uFFFF\u0043\uFFFD\u0000\n\u5A78\uA67C\uA5AC\u95AE\u3784\u8A97\u838B\uA97B\u7D8C" + - "\u9C8F\u939D\u0000\u0003\u5BEA\uCDCB\uD4D1\uCACE\u5C0C\u5C30\u0000\f\u5D37\u436B\u414B\u3F35" + - "\u514E\u5533\u3A52\u3D31\u5942\u3949\u383C\u3236\u4045\u5E44\u5E41\u5F58\u5FA6\u5FA5\u5FAB\u60C9" + - "\u60B9\uFFFD\u60CC\u60E2\u60CE\u60C4\u6114\u60F2\u610A\u6116\u6105\u60F5\u6113\u60F8\u60FC\u60FE" + - "\u60C1\u6103\u6118\u611D\u6110\u60FF\u6104\u610B\u624A\u0000\u0003\u6394\uB1B0\uCEE5\uE8EF\u63C3" + - "\u649D\u0000\u0003\u63F3\uCAE0\uF6D5\uF2F5\u6461\u0000\u0007\u63DF\uBEDD\uDCC4\uD8D3\uC2C7\uCCCB" + - "\uC8F0\uD7D9\u0000\u0006\u6532\u676A\u645C\u6865\u8C9D\u9EAE\uD0D2\u0000\u0003\u667C\u6C7B\u8071" + - "\u796A\u6672\u6701\u690C\u68D3\u6904\u68DC\u692A\u68EC\u68EA\u68F1\u690F\u68D6\u68F7\u68EB\u68E4" + - "\u68F6\u6913\u6910\u68F3\u68E1\u6907\u68CC\u6908\u6970\u68B4\u6911\u68EF\u68C6\u6914\u68F8\u68D0" + - "\u68FD\u68FC\u68E8\u690B\u690A\u6917\u0000\u0003\u68CE\uC8DD\uDEE6\uF4D1\u6906\u68D4\u68E9\u6915" + - "\u6925\u68C7\uFFFF\u0043\uFFFD\u0000\u0005\u6B39\u3B3F\u3C94\u9799\u95BD\uF0F2\u6BF3\u6C30\u6DFC" + - "\u0000\u0017\u6E46\u471F\u4988\u3C3D\u4562\u2B3F\u415D\u731C\u334B\u4051\u3B03\u2E5E\u685C\u6131" + - "\u2860\u716B\u3922\u3053\u6527\u7864\u7755\u7952\u6635\u365A\u7120\u711E\uFFFD\u712F\u70FB\u0000" + - "\u0004\u712E\u3123\u2522\u321F\u283A\u711B\u0000\u0003\u724B\u5A88\u8986\u858B\u0000\u0006\u7312" + - "\u0B30\u2231\u3327\u322D\u2623\u350C\u0000\u0007\u742E\u2C30\u2B16\u1A21\u2D31\u2423\u1D29\u2032" + - "\u74FB\u0000\u0005\u752F\u6F6C\uE7DA\uE1E6\uDDDF\uE4D7\u7695\u7692\u76DA\u0000\u0005\u7746\u4744" + - "\u4D45\u4A4E\u4B4C\uDEEC\u0000\u0006\u7860\u6465\u5C6D\u716A\u6E70\u6968\u5E62\u7974\u7973\u7972" + - "\u7970\u0000\u0003\u7A02\u0A03\u0C04\u99E6\u7AE4\u0000\u0004\u7B4A\u3B44\u484C\u4E40\u5845\u7CA2" + - "\u7C9E\u7CA8\u7CA1\u0000\u0006\u7D58\u6F63\u5356\u676A\u4F6D\u5C6B\u5254\u7D69\uFFFF\u0043\uFFFD" + - "\u7D51\u7D5F\u7D4E\u0000\u0003\u7F3E\u3F65\u66A2\uA0A1\u7FD7\u8051\u804F\u8050\u80FE\u80D4\u0000" + - "\u0006\u8143\u4A52\u4F47\u3D4D\u3AE6\uEEF7\uF8F9\u8204\u823C\u823D\u823F\u8275\u833B\u83CF\u83F9" + - "\u8423\u83C0\u83E8\u8412\u83E7\u83E4\u83FC\u83F6\u8410\u83C6\u83C8\u83EB\u83E3\u83BF\u8401\u0000" + - "\u0004\u83DD\uE5D8\uFFE1\uCBCE\uD6F5\u83C9\u8409\uFFFD\u840F\u83DE\u8411\u8406\u0000\u0003\u83C2" + - "\uF3D5\uFAC7\uD1EA\u8413\u0000\u0003\u83C3\uECEE\uC4FB\uD7E2\u841B\u83DB\u83FE\u0000\u0007\u86D8" + - "\uE2E6\uD3E3\uDAEA\uDDEB\uDCEC\uE9D7\uE8D1\u0000\u0006\u8848\u5655\uBAD7\uB9B8\uC0BE\uB6BC\uB7BD" + - "\u88B2\u8901\u88C9\u8995\u8998\u8997\u89DD\u89DA\u89DB\u0000\u0007\u8A4E\u4D39\u5940\u5758\u4445" + - "\u5248\u514A\u4C4F\u0000\u0003\u8C5F\u8180\uBABE\uB0B9\u8CB5\u0000\u0007\u8D84\u8089\uD8D3\uCDC7" + - "\uD6DC\uCFD5\uD9C8\uD7C5\u0000\u0007\u8EEF\uF7FA\uF9E6\uEEE5\uF5E7\uE8F6\uEBF1\uECF4\u8EE9\u902D" + - "\u9034\u902F\u9106\u912C\u9104\u90FF\u90FC\u9108\u90F9\u90FB\u9101\uFFFF\u0043\uFFFD\u0000\u0004" + - "\u9100\u0705\u0361\u645F\u6260\u0000\u0004\u9201\u0A25\u031A\u260F\u0C00\u9212\u91FF\u91FD\u0000" + - "\u0004\u9206\u0427\u021C\u2419\u1705\u9216\u957B\u958D\u958C\u9590\u0000\u0005\u9687\u7E88\u8983" + - "\u80C2\uC8C3\uF1F0\u976C\u9770\u976E\u9807\u98A9\u98EB\u9CE6\u9EF9\u4E83\u4E84\u4EB6\u50BD\u50BF" + - "\u50C6\u50AE\u50C4\u50CA\uFFFD\u0000\u0005\u50B4\uC8C2\uB0C1\uBAB1\uCBC9\uB6B8\u51D7\u527A\u5278" + - "\u527B\u527C\u0000\u000B\u55C3\uDBCC\uD0CB\uCADD\uC0D4\uC4E9\uBFD2\u8DCF\uD5E2\uD6C8\uF2CD\uD9C2" + - "\u5714\u0000\b\u5853\u6864\u4F4D\u496F\u554E\u5D59\u655B\u3D63\u71FC\u0000\t\u5AC7\uC4CB" + - "\uBAB8\uB1B5\uB0BF\uC8BB\uC6B7\uC0CA\uB4B6\uCDB9\u5A90\u5BD6\u5BD8\u5BD9\u5C1F\u5C33\u0000\u0005" + - "\u5D71\u634A\u6572\u6C5E\u6867\u62F0\u0000\u0004\u5E4F\u4E4A\u4D4B\uC5CC\uC6CB\u5EC7\u5F40\u5FAF" + - "\u5FAD\u60F7\u0000\u0005\u6149\u4A2B\u4536\u322E\u462F\u4F29\u6140\u6220\u9168\u6223\u6225\u6224" + - "\u63C5\uFFFF\u0043\uFFFD\u63F1\u63EB\u0000\r\u6410\u1209\u2024\u3343\u1F15\u1839\u3722\u230C" + - "\u2630\u2841\u352F\u0A1A\u4025\u270B\u63E7\u641B\u642E\u6421\u640E\u656F\u6592\u65D3\u0000\u0004" + - "\u6686\u8C95\u908B\u8A99\u9478\u6720\u0000\u0007\u6966\u5F38\u4E62\u713F\u456A\u3942\u5759\u7A48" + - "\u6949\uFFFD\u6935\u696C\u6933\u693D\u6965\u68F0\u0000\n\u6978\u3469\u406F\u4476\u5841\u744C" + - "\u3B4B\u375C\u4F51\u3252\u2F7B\u693C\u0000\u0003\u6B46\u4543\u4248\u419B\uFA0D\u6BFB\u6BFC\u6BF9" + - "\u6BF7\u6BF8\u0000\u0013\u6E9B\uD6C8\u8FC0\u9F93\u94A0\uB1B9\uC6D2\uBDC1\u9EC9\uB7B0\uCDA6\uCFB2" + - "\uBEC3\uDCD8\u9992\u8E8D\uA4A1\uBFB3\uD0CA\u97AE\u6EA3\u0000\u000B\u7147\u5452\u6360\u415D\u6272" + - "\u786A\u6142\u5843\u4B70\u5F50\u5344\u4D5A\u724F\u728D\u728C\u7291\u7290\u728E\u0000\u0003\u733C" + - "\u423B\u3A40\u4A49\u0000\u0003\u7444\u4A4B\u5251\u5740\u744F\uFFFF\u0043\uFFFD\u0000\u0004\u7450" + - "\u4E42\u464D\u54E1\uFFFE\u74FD\u751D\u7579\u7577\u6983\u75EF\u760F\u7603\u75F7\u75FE\u75FC\u75F9" + - "\u75F8\u7610\u75FB\u75F6\u75ED\u75F5\u75FD\u7699\u76B5\u76DD\u0000\u0005\u7755\u5F60\u5256\u5A69" + - "\u6754\u596D\u77E0\u0000\u0007\u7887\u9A94\u8F84\u9585\u86A1\u8379\u9980\u967B\u797C\u7982\u797D" + - "\u7979\u7A11\uFFFD\u0000\u0006\u7A18\u1912\u1715\u2213\u1B10\uA3A2\u9EEB\u0000\u0006\u7B66\u646D" + - "\u7469\u7265\u7371\u7061\u7876\u7B63\u7CB2\u7CB4\u7CAF\u0000\u0007\u7D88\u8680\u8D7F\u857A\u8E7B" + - "\u837C\u8C94\u847D\u7D92\u0000\u0004\u7F6D\u6B67\u686C\uA6A5\uA7DB\u7FDC\u8021\u0000\u0003\u8164" + - "\u6077\u5C69\u5B62\u8172\u6721\u815E\u8176\u8167\u816F\u8144\u8161\u821D\u8249\u8244\u8240\u8242" + - "\u8245\u0000\t\u84F1\u3F56\u7679\u8F8D\u6551\u4086\u6730\u4D7D\u5A59\u7473\u845D\u8507\u0000" + - "\u0004\u845E\u373A\u347A\u4378\u3245\u8429\u83D9\u0000\u0007\u844B\u2F42\u2D5F\u7039\u4E4C\u526F" + - "\uC58E\u3B47\uFFFF\u0043\uFFFD\u0000\u0004\u8436\u3368\u7E44\u2B60\u546E\u8450\u870B\u8704\u86F7" + - "\u870C\u86FA\u86D6\u86F5\u874D\u86F8\u870E\u8709\u8701\u86F6\u870D\u8705\u0000\u0004\u88D6\uCBCD" + - "\uCEDE\uDBDA\uCCD0\u0000\u0004\u8985\u9BDF\uE5E4\uE1E0\uE2DC\u89E6\u0000\u0006\u8A76\u867F\u613F" + - "\u7782\u8475\u8381\u747A\u8C3C\u8C4B\u8C4A\u8C65\u8C64\u8C66\uFFFD\u8C86\u8C84\u8C85\u8CCC\u0000" + - "\u000B\u8D68\u6991\u8C8E\u8F8D\u9394\u9092\uF0E0\uECF1\uEED0\uE9E3\uE2E7\uF2EB\u8DF4\u8F06\u8EFF" + - "\u0000\u0003\u8F01\u0005\u0708\u020B\u9052\u903F\u9044\u9049\u903D\u0000\u0004\u9110\u0D0F\u1116" + - "\u140B\u0E6E\u916F\u0000\u000F\u9248\u5230\u3A66\u3365\u5E83\u2E4A\u466D\u6C4F\u6067\u6F36\u6170" + - "\u3154\u6350\u724E\u534C\u5632\u959F\u959C\u959E\u959B\u0000\u0004\u9692\u9391\u97CE\uFAFD\uF8F5" + - "\u9773\u9777\u9778\u9772\u980F\u980D\u980E\u98AC\u98F6\u98F9\u99AF\u99B2\u99B0\u99B5\u9AAD\u9AAB" + - "\u9B5B\u9CEA\u9CED\u9CE7\u9E80\u9EFD\u0000\u0003\u50E6\uD4D7\uE8F3\uDBEA\uFFFF\u0043\uFFFD\u0000" + - "\u0003\u50DD\uE4D3\uECF0\uEFE3\u50E0\u51D8\u5280\u5281\u52E9\u52EB\u5330\u53AC\u5627\u5615\u560C" + - "\u5612\u55FC\u560F\u561C\u5601\u5613\u5602\u55FA\u561D\u5604\u55FF\u55F9\u0000\t\u5889\u7C90" + - "\u9886\u817F\u748B\u7A87\u918E\u7682\u887B\u948F\u58FE\u596B\u0000\u0005\u5ADC\uEEE5\uD5EA\uDAED" + - "\uEBF3\uE2E0\u5ADB\uFFFD\u5AEC\u5ADE\u5ADD\u5AD9\u5AE8\u5ADF\u5B77\u5BE0\u5BE3\u5C63\u0000\u0007" + - "\u5D82\u807D\u867A\u8177\u8A89\u887E\u7C8D\u797F\u0000\u0005\u5E58\u5953\uD8D1\uD7CE\uDCD5\uD9D2" + - "\u5ED4\u5F44\u5F43\u5F6F\u5FB6\u0000\t\u612C\u2841\u5E71\u7352\u5372\u6C80\u7454\u7A5B\u653B" + - "\u6A61\u6156\u6229\u6227\u622B\u0000\r\u642B\u4D5B\u5D74\u7672\u737D\u7566\uA64E\u825E\u5C4B" + - "\u5360\u507F\u3F6C\u6B59\u6577\u6573\u65A0\u66A1\u66A0\u669F\u6705\u6704\u6722\u0000\f\u69B1" + - "\uB6C9\uA0CE\u96B0\uACBC\u9199\u8EA7\u8DA9\uBEAF\uBFC4\uBDA4\uD4B9\uCA9A\u69CF\uFFFF\u0043\uFFFD" + - "\u0000\u0005\u69B3\u93AA\uA19E\uD997\u90C2\uB5A5\u69C6\u0000\u0004\u6B4A\u4D4B\u9E9F\uA0C3\uC4FE" + - "\u6ECE\u6EF5\u6EF1\u6F03\u6F25\u6EF8\u6F37\u6EFB\u0000\u0004\u6F2E\u094E\u191A\u2718\u3B12\u6EED" + - "\u6F0A\u6F36\u6F73\u6EF9\u6EEE\u6F2D\u6F40\u6F30\u6F3C\u6F35\u6EEB\u6F07\u6F0E\u6F43\u6F05\u6EFD" + - "\u6EF6\u6F39\u6F1C\u6EFC\u6F3A\u6F1F\u6F0D\u6F1E\uFFFD\u6F08\u6F21\u0000\u0005\u7187\u9089\u8085" + - "\u828F\u7B86\u8197\u7244\u7253\u7297\u7295\u7293\u7343\u734D\u7351\u734C\u0000\u0003\u7462\u7371" + - "\u7572\u676E\u7500\u7502\u7503\u757D\u7590\u0000\u0003\u7616\u080C\u1511\u0A14\u76B8\u0000\u0004" + - "\u7781\u7C85\u826E\u806F\u7E83\u0000\u0006\u78B2\uAAB4\uADA8\u7EAB\u9EA5\uA0AC\uA2A4\u0000\u0005" + - "\u7998\u8A8B\u9695\u9493\u9788\u9290\u0000\u0004\u7A2B\u4A30\u2F28\u26A8\uABAC\u7AEE\u0000\u0005" + - "\u7B88\u9C8A\u9190\u968D\u8C9B\u8E85\u7B98\u5284\u7B99\u7BA4\u7B82\u7CBB\u7CBF\u7CBC\u7CBA\u0000" + - "\t\u7DA7\uB7C2\uA3AA\uC1C0\uC59D\uCEC4\uC6CB\uCCAF\uB996\uBC9F\u7DA6\uFFFF\u0043\uFFFD\u7DAE" + - "\u7DA9\u7DA1\u7DC9\u7F73\u7FE2\u7FE3\u7FE5\u7FDE\u8024\u805D\u805C\u0000\u0003\u8189\u8683\u878D" + - "\u8C8B\u8215\u0000\u0013\u8497\uA4A1\u9FBA\uCEC2\uACAE\uABB9\uB4C1\uCDAA\u9AB1\uD09D\uA7BB\uA294" + - "\uC7CC\u9BA9\uAFA8\uD698\uB6CF\uA0D7\uD4D2\uDBB0\u8491\u8661\u8733\u8723\uFFFD\u0000\u000E\u8728" + - "\u6B40\u2E1E\u2119\u1B43\u2C41\u3E46\u2032\u2A2D\u3C12\u3A31\u3542\u2627\u3824\u1A30\u8711\u0000" + - "\u0006\u88F7\uE7F1\uF2FA\uFEEE\uFCF6\uFBF0\uECEB\u0000\u0003\u899D\uA19F\u9EE9\uEBE8\u8AAB\u8A99" + - "\u8A8B\u8A92\u8A8F\u8A96\u8C3D\u8C68\u8C69\u8CD5\u8CCF\u8CD7\u8D96\u8E09\u8E02\u8DFF\u8E0D\u8DFD" + - "\u8E0A\u8E03\u8E07\u8E06\u8E05\u8DFE\u8E00\u8E04\u8F10\u8F11\u8F0E\u8F0D\u0000\u0006\u9123\u1C20" + - "\u221F\u1D1A\u2421\u1B7A\u7279\u9173\u0000\u000F\u92A5\uA476\u9B7A\uA094\uAA8D\uA69A\uAB79\u977F" + - "\uA3EE\u8E82\u95A2\u7D88\uA18A\u868C\u99A7\u7E87\uFFFF\u0043\uFFFD\u92A9\u929D\u928B\u922D\u969E" + - "\u96A1\u96FF\u0000\u0006\u9758\u7D7A\u7E83\u8082\u7B84\u817F\uCECD\u9816\u98AD\u98AE\u0000\u0005" + - "\u9902\u0007\u9D9C\uC3B9\uBBBA\uC2BD\u99C7\u9AB1\u9AE3\u9AE7\u9B3E\u9B3F\u9B60\u9B61\u9B5F\u9CF1" + - "\u9CF2\u9CF5\u9EA7\u50FF\u5103\u5130\u50F8\u5106\u5107\u50F6\u50FE\u510B\u510C\u50FD\u510A\u528B" + - "\u528C\u52F1\u52EF\uFFFD\u0000\b\u5648\u424C\u3541\u4A49\u4658\u5A40\u333D\u2C3E\u382A\u563A" + - "\u571A\u0000\u0004\u58AB\u9DB1\uA0A3\uAFAC\uA5A1\u58FF\u5AFF\u5AF4\u5AFD\u5AF7\u5AF6\u5B03\u5AF8" + - "\u5B02\u5AF9\u5B01\u5B07\u5B05\u5B0F\u5C67\u0000\u0005\u5D99\u979F\u92A2\u9395\uA09C\uA19A\u5D9E" + - "\u5E69\u5E5D\u5E60\u5E5C\u7DF3\u5EDB\u5EDE\u5EE1\u5F49\u5FB2\u0000\b\u618B\u8379\uB1B0\uA289" + - "\u9B93\uAFAD\u9F92\uAAA1\u8D66\u61B3\u622D\u0000\u0007\u646E\u7096\uA085\u979C\u8F8B\u8A8C\uA39F" + - "\u68B1\u6498\u6576\u657A\u6579\u657B\u65B2\u65B3\u0000\u0003\u66B5\uB0A9\uB2B7\uAAAF\u6A00\u6A06" + - "\u6A17\u69E5\u69F8\u6A15\u69F1\u69E4\u6A20\u69FF\u69EC\u69E2\uFFFF\u0043\uFFFD\u6A1B\u6A1D\u69FE" + - "\u6A27\u69F2\u69EE\u6A14\u69F7\u69E7\u6A40\u6A08\u69E6\u69FB\u6A0D\u69FC\u69EB\u6A09\u6A04\u6A18" + - "\u6A25\u6A0F\u69F6\u6A26\u6A07\u69F4\u6A16\u6B51\u6BA5\u6BA3\u6BA2\u6BA6\u6C01\u6C00\u6BFF\u6C02" + - "\u0000\r\u6F41\u267E\u87C6\u928D\u898C\u624F\u855A\u9676\u6C82\u5572\u5250\u5794\u935D\u0061" + - "\u6F6B\uFFFD\u0000\u0005\u6F7D\u6790\u538B\u697F\u9563\u776A\u6F7B\u0000\b\u71B2\uAF9B\uB0A0" + - "\u9AA9\uB59D\uA59E\uA4A1\uAA9C\uA7B3\u7298\u729A\u0000\u0005\u7358\u525E\u5F60\u5D5B\u615A\u5962" + - "\u0000\u0004\u7487\u898A\u8681\u7D85\u887C\u7479\u7508\u7507\u757E\u0000\u0006\u7625\u1E19\u1D1C" + - "\u231A\u281B\u9C9D\u9E9B\u778D\u778F\u7789\u7788\u0000\u0005\u78CD\uBBCF\uCCD1\uCED4\uC8C3\uC4C9" + - "\u799A\u79A1\u79A0\u799C\u79A2\u799B\u6B76\u7A39\u7AB2\u7AB4\u7AB3\u0000\u0004\u7BB7\uCBBE\uACCE" + - "\uAFB9\uCAB5\u7CC5\u7CC8\u7CCC\u7CCB\u7DF7\u7DDB\u7DEA\u7DE7\u7DD7\u7DE1\u7E03\u0000\u0003\u7DFA" + - "\uE6F6\uF1F0\uEEDF\u7F76\u7FAC\u7FB0\u7FAD\uFFFF\u0043\uFFFD\u7FED\u7FEB\u7FEA\u7FEC\u7FE6\u7FE8" + - "\u8064\u8067\u0000\u0003\u81A3\u9F9E\u95A2\u9997\u0000\u0003\u8216\u4F53\u5250\u4E51\u0000\u0005" + - "\u8524\u3B0F\u0029\u0E09\u0D1F\u0A27\u851C\u84FB\u852B\u84FA\u8508\u850C\u84F4\u852A\u84F2\u8515" + - "\u84F7\u84EB\u84F3\u84FC\u8512\u84EA\u84E9\u8516\u84FE\u8528\u851D\u852E\u8502\u84FD\u851E\u84F6" + - "\u8531\u8526\u84E7\u84E8\uFFFD\u84F0\u84EF\u84F9\u8518\u8520\u8530\u850B\u8519\u852F\u8662\u0000" + - "\u000F\u8756\u6364\u77E1\u7358\u545B\u5261\u5A51\u5E6D\u6A50\u4E5F\u5D6F\u6C7A\u6E5C\u654F\u7B75" + - "\u6267\u8769\u885A\u0000\b\u8905\u0C14\u0B17\u1819\u0616\u110E\u09A2\uA4A3\uEDF0\u89EC\u0000" + - "\b\u8ACF\uC6B8\uD3D1\uD4D5\uBBD7\uBEC0\uC5D8\uC3BA\uBDD9\u0000\u0004\u8C3E\u4D8F\uE5DF\uD9E8" + - "\uDADD\u8CE7\u8DA0\u8D9C\u8DA1\u8D9B\u0000\t\u8E20\u2325\u242E\u151B\u1611\u1926\u2714\u1218" + - "\u131C\u171A\u0000\u0003\u8F2C\u2418\u1A20\u2316\u8F17\u9073\u9070\u906F\u9067\u906B\u912F\uFFFF" + - "\u0043\uFFFD\u0000\u0006\u912B\u292A\u3226\u2E85\u868A\u8182\u8480\u0000\u0010\u92D0\uC3C4\uC0D9" + - "\uB6CF\uF1DF\uD8E9\uD7DD\uCCEF\uC2E8\uCAC8\uCEE6\uCDD5\uC9E0\uDEE7\uD1D3\uB5E1\uC6B4\u957C\u95AC" + - "\u95AB\u95AE\u95B0\u96A4\u96A2\u96D3\u0000\u0004\u9705\u0802\u5A8A\u8E88\uD0CF\uFFFD\u0000\u0004" + - "\u981E\u1D26\u2928\u201B\u27B2\u9908\u98FA\u0000\b\u9911\u1416\u1715\uDCCD\uCFD3\uD4CE\uC9D6" + - "\uD8CB\uD7CC\u9AB3\u9AEC\u9AEB\u9AF3\u9AF2\u9AF1\u0000\u0005\u9B46\u4367\u7471\u6676\u7570\u6864" + - "\u9B6C\u9CFC\u9CFA\u9CFD\u9CFF\u9CF7\u9D07\u9D00\u9CF9\u9CFB\u9D08\u9D05\u9D04\u9E83\u9ED3\u9F0F" + - "\u9F10\u511C\u5113\u5117\u511A\u5111\u51DE\u5334\u53E1\u0000\u0004\u5670\u606E\u7366\u636D\u725E" + - "\u5677\u571C\u571B\u0000\u0003\u58C8\uBDC9\uBFBA\uC2BC\u58C6\u0000\u0006\u5B17\u191B\u2114\u1310" + - "\u1628\u1A20\u1EEF\u0000\u0006\u5DAC\uB1A9\uA7B5\uB0AE\uAAA8\uB2AD\uAFB4\u0000\u0004\u5E67\u6866" + - "\u6FE9\uE7E6\uE8E5\uFFFF\u0043\uFFFD\u5F4B\u5FBC\u0000\u0005\u619D\uA896\uC5B4\uC6C1\uCCBA\uBFB8" + - "\u618C\u0000\u0005\u64D7\uD6D0\uCFC9\uBD89\uC3DB\uF3D9\u6533\u657F\u657C\u65A2\u0000\u0004\u66C8" + - "\uBEC0\uCACB\uCFBD\uBBBA\u66CC\u6723\u0000\u000B\u6A34\u6649\u6732\u683E\u5D6D\u765B\u5128\u5A3B" + - "\u3F41\u6A64\u504F\u546F\uFFFD\u0000\u0004\u6A69\u603C\u5E56\u554D\u4E46\u0000\u0003\u6B55\u5456" + - "\uA7AA\uABC8\u6BC7\u6C04\u6C03\u6C06\u0000\u0006\u6FAD\uCBA3\uC7BC\uCEC8\u5EC4\uBD9E\uCAA8\u7004" + - "\u0000\u0007\u6FA5\uAEBA\uACAA\uCFBF\uB8A2\uC9AB\uCDAF\uB2B0\u0000\b\u71C5\uC2BF\uB8D6\uC0C1" + - "\uCBD4\uCAC7\uCFBD\uD8BC\uC6DA\u71DB\u729D\u729E\u0000\u0003\u7369\u6667\u6C65\u6B6A\u0000\u0003" + - "\u747F\u9AA0\u9492\u95A1\u750B\u7580\u0000\u0005\u762F\u2D31\u3D33\u3C35\u3230\uBBE6\u0000\u0004" + - "\u779A\u9DA1\u9C9B\uA2A3\u9599\u7797\u0000\u0005\u78DD\uE9E5\uEADE\uE3DB\uE1E2\uEDDF\u78E0\u79A4" + - "\u7A44\u7A48\u7A47\u7AB6\u7AB8\u7AB5\uFFFF\u0043\uFFFD\u7AB1\u7AB7\u0000\u0007\u7BDE\uE3E7\uDDD5" + - "\uE5DA\uE8F9\uD4EA\uE2DC\uEBD8\u7BDF\u7CD2\u7CD4\u7CD7\u7CD0\u7CD1\u0000\t\u7E12\u2117\u0C1F" + - "\u2013\u0E1C\u151A\u220B\u0F16\u0D14\u2524\u7F43\u7F7B\u7F7C\u7F7A\u7FB1\u7FEF\u802A\u8029\u806C" + - "\u0000\u0005\u81B1\uA6AE\uB9B5\uABB0\uACB4\uB2B7\u81A7\uFFFD\u81F2\u8255\u8256\u8257\u0000\u000F" + - "\u8556\u456B\u4D53\u6158\u4046\u6441\u6244\u5147\u633E\u5B71\u4E6E\u7555\u6760\u8C66\u5D54\u656C" + - "\u8663\u8665\u8664\u0000\n\u879B\u8F97\u9392\u8881\u9698\u7987\uA385\u9091\u9D84\u949C\u9A89" + - "\u0000\u0006\u891E\u2630\u2D2E\u2731\u2229\u232F\u2C1F\u89F1\u8AE0\u8AE2\u8AF2\u8AF4\u8AF5\u8ADD" + - "\u8B14\u0000\u0004\u8AE4\uDFF0\uC8DE\uE1E8\uFFEF\u8AFB\u0000\u0003\u8C91\u9290\uF5EE\uF1F0\u8CF3" + - "\u8D6C\u8D6E\u8DA5\u8DA7\u0000\u0005\u8E33\u3E38\u4045\u363C\u3D41\u303F\u8EBD\u0000\u0003\u8F36" + - "\u2E35\u3239\u3734\u9076\u9079\u907B\u9086\uFFFF\u0043\uFFFD\u90FA\u0000\u0003\u9133\u3536\u9390" + - "\u918D\u918F\u0000\b\u9327\u1E08\u1F06\u0F7A\u383C\u1B23\u1201\u462D\u0E0D\u92CB\u931D\u92FA" + - "\u9325\u9313\u92F9\u92F7\u9334\u9302\u9324\u92FF\u0000\u0003\u9329\u3935\u2A14\u0C0B\u92FE\u9309" + - "\u9300\u92FB\u9316\u0000\u0004\u95BC\uCDBE\uB9BA\uB6BF\uB5BD\u96A9\u96D4\u970B\u9712\u9710\uFFFD" + - "\u9799\u9797\u9794\u97F0\u97F8\u9835\u982F\u9832\u0000\u0006\u9924\u1F27\u299E\uEEEC\uE5E4\uF0E3" + - "\uEAE9\u99E7\u0000\u0003\u9AB9\uBFB4\uBBF6\uFAF9\u9AF7\u0000\u0007\u9B33\u8085\u877C\u7E7B\u8293" + - "\u9290\u7A95\u7D88\u0000\u0005\u9D25\u1720\u1E14\u291D\u1822\u1019\u9D1F\u0000\u0003\u9E88\u8687" + - "\uAEAD\uD5D6\u9EFA\u9F12\u9F3D\u5126\u5125\u5122\u5124\u5120\u5129\u52F4\u0000\u0004\u5693\u8C8D" + - "\u8684\u837E\u827F\u5681\u58D6\u58D4\u58CF\u58D2\u0000\u0005\u5B2D\u2532\u232C\u2726\u2F2E\u7BF1" + - "\u5BF2\u5DB7\u5E6C\u5E6A\u5FBE\u5FBB\u0000\u0004\u61C3\uB5BC\uE7E0\uE5E4\uE8DE\u64EF\u64E9\u64E3" + - "\u64EB\u64E4\u64E8\u6581\u6580\u65B6\u65DA\u66D2\uFFFF\u0043\uFFFD\u0000\u000B\u6A8D\u9681\uA589" + - "\u9F9B\uA19E\u8793\u8E95\u83A8\uA491\u7FA6\u9A85\u8C92\u6B5B\u6BAD\u6C09\u0000\u0006\u6FCC\uA9F4" + - "\uD4E3\uDCED\uE7E6\uDEF2\uDDE2\u6FE8\u0000\u0003\u71E1\uF1E8\uF2E4\uF0E2\u7373\u736E\u736F\u0000" + - "\u0004\u7497\uB2AB\u90AA\uADB1\uA5AF\u7510\u7511\u7512\u750F\uFFFD\u7584\u7643\u7648\u7649\u7647" + - "\u76A4\u76E9\u0000\u0004\u77B5\uABB2\uB7B6\uB4B1\uA8F0\u78F3\u78FD\u7902\u78FB\u78FC\u78F2\u7905" + - "\u78F9\u78FE\u7904\u79AB\u79A8\u0000\u0004\u7A5C\u5B56\u5854\u5ABE\uC0C1\u7C05\u7C0F\u7BF2\u7C00" + - "\u7BFF\u7BFB\u7C0E\u7BF4\u7C0B\u7BF3\u7C02\u7C09\u7C03\u7C01\u7BF8\u7BFD\u7C06\u7BF0\u7BF1\u7C10" + - "\u7C0A\u7CE8\u7E2D\u7E3C\u7E42\u7E33\u9848\u0000\u0005\u7E38\u2A49\u4047\u294C\u303B\u3644\u7E3A" + - "\u7F45\u7F7F\u7F7E\u7F7D\u7FF4\u7FF2\u802C\u0000\u0003\u81BB\uC4CC\uCAC5\uC7BC\u81E9\u825B\u825A" + - "\u825C\u0000\u000F\u8583\u808F\uA795\uA08B\uA37B\uA49A\u9E77\u7C89\uA17A\u7857\u8E96\u868D\u999D" + - "\u81A2\u8288\u8579\uFFFF\u0043\uFFFD\u8576\u8598\u8590\u859F\u8668\u0000\f\u87BE\uAAAD\uC5B0" + - "\uACB9\uB5BC\uAEC9\uC3C2\uCCB7\uAFC4\uCAB4\uB6BF\uB8BD\uDEB2\u0000\u0006\u8935\u333C\u3E41\u5237" + - "\u42AD\uAFAE\uF2F3\u0000\b\u8B1E\u1816\u1105\u0B22\u0F12\u1507\u0D08\u061C\u131A\u8C4F\u8C70" + - "\u8C72\uFFFD\u8C71\u8C6F\u8C95\u8C94\u8CF9\u8D6F\u8E4E\u8E4D\u8E53\u8E50\u8E4C\u8E47\u8F43\u8F40" + - "\u9085\u907E\u0000\u0004\u9138\u9AA2\u9B99\u9FA1\u9DA0\u0000\u0010\u93A1\u83AF\u6456\u477C\u585C" + - "\u7649\u5051\u606D\u8F4C\u6A79\u5755\u524F\u7177\u7B61\u5E63\u6780\u4E59\u95C7\u95C0\u95C9\u95C3" + - "\u95C5\u95B7\u96AE\u96B0\u96AC\u0000\u0006\u9720\u1F18\u1D19\u9AA1\u9C9E\u9DD5\uD4F1\u9841\u9844" + - "\u984A\u9849\u9845\u9843\u0000\u0006\u9925\u2B2C\u2A33\u322F\u2D31\u3098\uA3A1\u9A02\u0000\u0004" + - "\u99FA\uF4F7\uF9F8\uF6FB\uFDFE\u99FC\u9A03\u9ABE\u9AFE\u9AFD\u9B01\u9AFC\u0000\u0004\u9B48\u9AA8" + - "\u9E9B\uA6A1\uA5A4\uFFFF\u0043\uFFFD\u9B86\u9BA2\u9BA0\u9BAF\u0000\u0007\u9D33\u4167\u362E\u2F31" + - "\u3830\u4542\u433E\u3740\u9D3D\u7FF5\u9D2D\u0000\u0003\u9E8A\u898D\uB0C8\uDAFB\u9EFF\u9F24\u9F23" + - "\u9F22\u9F54\u9FA0\u5131\u512D\u512E\u5698\u569C\u5697\u569A\u569D\u5699\u5970\u5B3C\u5C69\u5C6A" + - "\u5DC0\u5E6D\u5E6E\u0000\u0004\u61D8\uDFED\uEEF1\uEAF0\uEBD6\u61E9\u64FF\u6504\uFFFD\u64FD\u64F8" + - "\u6501\u6503\u64FC\u6594\u65DB\u66DA\u66DB\u66D8\u0000\u0005\u6AC5\uB9BD\uE1C6\uBAB6\uB7C7\uB4AD" + - "\u6B5E\u6BC9\u6C0B\u0000\u0003\u7007\u0C0D\u0105\u140E\u6FFF\u7000\u6FFB\u7026\u6FFC\u6FF7\u700A" + - "\u7201\u71FF\u71F9\u7203\u71FD\u7376\u0000\u0003\u74B8\uC0B5\uC1BE\uB6BB\u74C2\u7514\u7513\u0000" + - "\u0004\u765C\u6459\u5053\u575A\uA6BD\u76EC\u77C2\u77BA\u78FF\u0000\u0004\u790C\u1314\u0910\u1211" + - "\uADAC\u7A5F\u0000\u0005\u7C1C\u2919\u201F\u2D1D\u2628\u2225\u7C30\u0000\u0005\u7E5C\u5056\u6358" + - "\u625F\u5160\u5753\u7FB5\u7FB3\u7FF7\u7FF8\u8075\u81D1\u81D2\u81D0\u825F\u825E\u0000\u0007\u85B4" + - "\uC6C0\uC3C2\uB3B5\uBDC7\uC4BF\uCBCE\uC8C5\uFFFF\u0043\uFFFD\u85B1\u85B6\u85D2\u8624\u85B8\u85B7" + - "\u85BE\u8669\u0000\t\u87E7\uE6E2\uDBEB\uEAE5\uDFF3\uE4D4\uDCD3\uEDD8\uE3A4\uD7D9\u8801\u87F4" + - "\u87E8\u87DD\u0000\u0003\u8953\u4B4F\u4C46\u5051\u8949\u0000\t\u8B2A\u2723\u3330\u3547\u2F3C" + - "\u3E31\u2537\u2636\u2E24\u3B3D\u8B3A\u8C42\u8C75\u8C99\u8C98\uFFFD\u8C97\u8CFE\u8D04\u8D02\u8D00" + - "\u0000\u0006\u8E5C\u6260\u5756\u5E65\u675B\u5A61\u5D69\u8E54\u8F46\u8F47\u8F48\u8F4B\u0000\u0004" + - "\u9128\u3A3B\u3EA8\uA5A7\uAFAA\u0000\f\u93B5\u8C92\uB79B\u9D89\uA78E\uAA9E\uA695\u8899\u9F8D" + - "\uB191\uB2A4\uA8B4\uA3A5\u95D2\u95D3\u95D1\u96B3\u96D7\u96DA\u5DC2\u96DF\u96D8\u96DD\u0000\u0007" + - "\u9723\u2225\uACAE\uA8AB\uA4AA\uA2A5\uD7D9\uD6D8\u97FA\u9850\u9851\u9852\u98B8\u9941\u993C\u993A" + - "\u0000\u0005\u9A0F\u0B09\u0D04\u110A\u0507\u06C0\u9ADC\u0000\t\u9B08\u0405\u2935\u4A4C\u4BC7" + - "\uC6C3\uBFC1\uB5B8\uD3B6\uC4B9\u9BBD\u9D5C\u9D53\u9D4F\uFFFF\u0043\uFFFD\u0000\u0005\u9D4A\u5B4B" + - "\u5956\u4C57\u5254\u5F58\u9D5A\u9E8E\u9E8C\u9EDF\u0000\u0004\u9F01\u0016\u252B\u2A29\u284C\u9F55" + - "\u5134\u5135\u5296\u52F7\u53B4\u56AB\u56AD\u56A6\u56A7\u56AA\u56AC\u58DA\u58DD\u58DB\u5912\u5B3D" + - "\u5B3E\u5B3F\u5DC3\u5E70\u5FBF\u61FB\u0000\u0004\u6507\u100D\u090C\u0E84\uDEDD\u66DE\u6AE7\u6AE0" + - "\u6ACC\u6AD1\u6AD9\u6ACB\uFFFD\u0000\u0003\u6ADF\uDCD0\uEBCF\uCDDE\u6B60\u6BB0\u6C0C\u0000\u0006" + - "\u7019\u2720\u162B\u2122\u2329\u1724\u1C2A\u0000\u0004\u720C\u0A07\u0205\uA5A6\uA4A3\u72A1\u74CB" + - "\u74C5\u74B7\u74C3\u7516\u7660\u77C9\u77CA\u77C4\u77F1\u0000\u0003\u791D\u1B21\u1C17\u1EB0\u7A67" + - "\u7A68\u0000\u0003\u7C33\u3C39\u2C3B\uECEA\u0000\u0004\u7E76\u7578\u7077\u6F7A\u7274\u7E68\u0000" + - "\u0003\u7F4B\u4A83\u86B7\uFDFE\u8078\u81D7\u81D5\u8264\u8261\u8263\u0000\n\u85EB\uF1ED\uD9E1" + - "\uE8DA\uD7EC\uF2F8\uD8DF\uE3DC\uD1F0\uE6EF\uDEE2\u8800\u87FA\u8803\u87F6\u87F7\u8809\u880C\u880B" + - "\u8806\u87FC\u8808\u87FF\u880A\u8802\u0000\u0003\u8962\u5A5B\u5761\u5C58\u895D\uFFFF\u0043\uFFFD" + - "\u8959\u8988\u89B7\u89B6\u89F6\u0000\u0006\u8B50\u484A\u4053\u5654\u4B55\u5142\u5257\u8C43\u8C77" + - "\u8C76\u8C9A\u0000\u0003\u8D06\u0709\uACAA\uADAB\u0000\u0003\u8E6D\u7873\u6A6F\u7BC2\u8F52\u8F51" + - "\u8F4F\u8F50\u8F53\u8FB4\u9140\u913F\u91B0\u91AD\u0000\b\u93DE\uC7CF\uC2DA\uD0F9\uECCC\uD9A9" + - "\uE6CA\uD4EE\uE3D5\uFFFD\u93C4\u93CE\u93C0\u93D2\u93E7\u957D\u95DA\u95DB\u96E1\u0000\u0005\u9729" + - "\u2B2C\u2826\uB3B7\uB6DD\uDEDF\u0000\u0003\u985C\u595D\u57BF\uBDBB\u98BE\u9948\u9947\u9943\u99A6" + - "\u99A7\u0000\u0006\u9A1A\u1525\u1D24\u1B22\u2027\u231E\u1C14\u9AC2\u0000\n\u9B0B\u0A0E\u0C37" + - "\uEAEB\uE0DE\uE4E6\uE2F0\uD4D7\uECDC\uD9E5\uD5E1\u9BDA\u0000\f\u9D77\u818A\u8488\u7180\u7886" + - "\u8B8C\u7D6B\u7475\u7069\u8573\u7B82\u6F79\u7F87\u9D68\u9E94\u9E91\u9EC0\u9EFC\u0000\u0003\u9F2D" + - "\u4041\u4D56\u5758\u5337\u56B2\u56B5\u56B3\u58E3\u5B45\u5DC6\u5DC7\u5EEE\u5EEF\u5FC0\u5FC1\u61F9" + - "\u6517\u6516\u6515\u6513\u65DF\u66E8\uFFFF\u0043\uFFFD\u66E3\u66E4\u0000\u0003\u6AF3\uF0EA\uE8F9" + - "\uF1EE\u6AEF\u0000\u0007\u703C\u352F\u3734\u3142\u383F\u3A39\u403B\u3341\u7213\u7214\u72A8\u737D" + - "\u737C\u74BA\u76AB\u76AA\u76BE\u76ED\u77CC\u77CE\u77CF\u77CD\u77F2\u0000\u0003\u7925\u2327\u2824" + - "\u29B2\u7A6E\u7A6C\u7A6D\u7AF7\u7C49\u7C48\u7C4A\u7C47\u7C45\u7CEE\u7E7B\u7E7E\u7E81\u7E80\u7FBA" + - "\u7FFF\uFFFD\u8079\u81DB\u81D9\u820B\u8268\u8269\u8622\u85FF\u8601\u85FE\u861B\u8600\u85F6\u8604" + - "\u8609\u8605\u860C\u85FD\u8819\u8810\u8811\u8817\u8813\u8816\u8963\u8966\u89B9\u89F7\u0000\u0003" + - "\u8B60\u6A5D\u6863\u6567\u8B6D\u8DAE\u8E86\u8E88\u8E84\u8F59\u8F56\u8F57\u8F55\u8F58\u8F5A\u908D" + - "\u9143\u9141\u91B7\u91B5\u91B2\u91B3\u940B\u9413\u93FB\u9420\u940F\u9414\u93FE\u9415\u9410\u9428" + - "\u9419\u940D\u93F5\u9400\u93F7\u9407\u940E\u9416\u9412\u93FA\u9409\u93F8\u940A\u93FF\u93FC\u940C" + - "\u93F6\u9411\u9406\u95DE\u95E0\u95DF\u972E\u972F\u97B9\u97BB\u97FD\u97FE\u9860\u9862\u9863\u985F" + - "\u98C1\u98C2\u9950\u994E\u9959\u994C\u994B\u9953\u0000\u0006\u9A32\u3431\u2C2A\u3629\u2E38\u2DC7" + - "\uCAC6\u9B10\u9B12\u9B11\u9C0B\u9C08\u9BF7\u9C05\u9C12\u9BF8\uFFFF\u0043\uFFFD\u0000\u0003\u9C40" + - "\u070E\u0617\u1409\u0000\u000B\u9D9F\u99A4\u9D92\u9890\u9BA0\u949C\uAA97\uA19A\uA2A8\u9EA3\uBFA9" + - "\u96A6\u9DA7\u0000\u0003\u9E99\u9B9A\uE5E4\uE7E6\u0000\u0003\u9F30\u2E5B\u605E\u5D59\u9F91\u513A" + - "\u5139\u5298\u5297\u56C3\u56BD\u56BE\u5B48\u5B47\u5DCB\u5DCF\u5EF1\u61FD\u651B\u6B02\u6AFC\u6B03" + - "\uFFFD\u6AF8\u6B00\u0000\u0003\u7043\u444A\u4849\u4546\u721D\u721A\u7219\u737E\u7517\u766A\u77D0" + - "\u792D\u7931\u792F\u7C54\u7C53\u7CF2\u7E8A\u7E87\u7E88\u7E8B\u7E86\u7E8D\u7F4D\u7FBB\u8030\u81DD" + - "\u0000\u0006\u8618\u2A26\u1F23\u1C19\u272E\u2120\u291E\u8625\u0000\u0003\u8829\u1D1B\u2024\u1C2B" + - "\u884A\u896D\u8969\u896E\u896B\u89FA\u8B79\u8B78\u8B45\u8B7A\u8B7B\u8D10\u8D14\u8DAF\u8E8E\u8E8C" + - "\u8F5E\u8F5B\u8F5D\u9146\u9144\u9145\u91B9\u0000\u0006\u943F\u3B36\u293D\u3C30\u392A\u372C\u4031" + - "\u95E5\u95E4\u95E3\u9735\u973A\u97BF\u97E1\u9864\u98C9\u98C6\u98C0\u9958\u9956\u0000\u0004\u9A39" + - "\u3D46\u4442\u413A\u3FCD\u9B15\u9B17\u9B18\u9B16\u9B3A\u9B52\u0000\u0003\u9C2B\u1D1C\u2C23\u2829" + - "\u9C24\uFFFF\u0043\uFFFD\u9C21\u0000\u000B\u9DB7\uB6BC\uC1C7\uCACF\uBEC5\uC3BB\uB5CE\uB9BA\uACC8" + - "\uB1AD\uCCB3\uCDB2\u9E7A\u9E9C\u9EEB\u9EEE\u9EED\u0000\u0003\u9F1B\u181A\u314E\u6564\u9F92\u4EB9" + - "\u56C6\u56C5\u56CB\u5971\u5B4B\u5B4C\u5DD5\u5DD1\u5EF2\u6521\u6520\u6526\u6522\u6B0B\u6B08\u6B09" + - "\u6C0D\u7055\u7056\u7057\u7052\u721E\u721F\u72A9\u737F\uFFFD\u74D8\u74D5\u74D9\u74D7\u766D\u76AD" + - "\u7935\u79B4\u7A70\u7A71\u0000\u0003\u7C57\u5C59\u5B5A\uF4F1\u7E91\u7F4F\u7F87\u81DE\u826B\u8634" + - "\u8635\u8633\u862C\u8632\u8636\u882C\u8828\u8826\u882A\u8825\u8971\u89BF\u89BE\u89FB\u8B7E\u8B84" + - "\u8B82\u8B86\u8B85\u8B7F\u8D15\u0000\u0003\u8E95\u949A\u9290\u9697\u8F60\u8F62\u9147\u0000\u0004" + - "\u944C\u504A\u4B4F\u4745\u4849\u9446\u973F\u97E3\u986A\u9869\u98CB\u9954\u995B\u0000\u0005\u9A4E" + - "\u5354\u4C4F\u484A\u4952\u50D0\u9B19\u9B2B\u9B3B\u9B56\u9B55\u0000\u0006\u9C46\u483F\u4439\u3341" + - "\u3C37\u3432\u3D36\u0000\u0007\u9DDB\uD2DE\uDACB\uD0DC\uD1DF\uE9D9\uD8D6\uF5D5\u9DDD\u9EB6\u9EF0" + - "\u0000\u0003\u9F35\u3332\u426B\u95A2\uFFFF\u0043\uFFFD\u513D\u5299\u58E8\u58E7\u5972\u5B4D\u5DD8" + - "\u882F\u5F4F\u6201\u6203\u6204\u6529\u6525\u6596\u66EB\u6B11\u6B12\u6B0F\u6BCA\u705B\u705A\u7222" + - "\u7382\u7381\u7383\u7670\u77D4\u7C67\u7C66\u7E95\u826C\u0000\u0003\u863A\u4039\u3C31\u3B3E\u8830" + - "\u8832\u882E\u8833\u8976\u8974\u8973\u89FE\u8B8C\u8B8E\u8B8B\u8B88\u8C45\u8D19\u8E98\u8F64\u8F63" + - "\u91BC\u9462\u9455\u945D\u9457\u945E\u97C4\uFFFD\u97C5\u9800\u9A56\u9A59\u9B1E\u9B1F\u9B20\u0000" + - "\u0004\u9C52\u5850\u4A4D\u4B55\u594C\u9C4E\u0000\t\u9DFB\uF7EF\uE3EB\uF8E4\uF6E1\uEEE6\uF2F0" + - "\uE2EC\uF4F3\uE8ED\u9EC2\u9ED0\u9EF2\u9EF3\u0000\u0005\u9F06\u1C38\u3736\u434F\u7170\u6E6F\u56D3" + - "\u56CD\u5B4E\u5C6D\u652D\u66ED\u66EE\u6B13\u705F\u7061\u705D\u7060\u7223\u74DB\u74E5\u77D5\u7938" + - "\u79B7\u79B6\u7C6A\u7E97\u7F89\u826D\u8643\u8838\u8837\u8835\u884B\u8B94\u8B95\u8E9E\u8E9F\u8EA0" + - "\u8E9D\u91BE\u91BD\u91C2\u946B\u9468\u9469\u96E5\u9746\u9743\u9747\u97C7\u97E5\u9A5E\u9AD5\u9B59" + - "\u9C63\u9C67\u9C66\u9C62\u9C5E\u9C60\u9E02\u9DFE\u0000\u0003\u9E07\u0306\u0500\u0109\u9DFF\u9DFD" + - "\u9E04\u9EA0\u9F1E\u9F46\u9F74\u9F75\u9F76\u56D4\uFFFF\u0043\uFFFD\u652E\u65B8\u6B18\u6B19\u6B17" + - "\u6B1A\u7062\u7226\u72AA\u77D8\u77D9\u7939\u7C69\u7C6B\u7CF6\u7E9A\u7E98\u7E9B\u7E99\u81E0\u81E1" + - "\u8646\u8647\u8648\u8979\u897A\u897C\u897B\u89FF\u8B98\u8B99\u8EA5\u8EA4\u8EA3\u946E\u946D\u946F" + - "\u9471\u9473\u9749\u9872\u995F\u9C68\u9C6E\u9C6D\u0000\u0003\u9E0B\u0D10\u0F12\u11A1\u9EF5\u9F09" + - "\u9F47\u9F78\u9F7B\u9F7A\u9F79\u571E\u7066\u7C6F\u883C\uFFFD\u8DB2\u8EA6\u91C3\u9474\u9478\u9476" + - "\u9475\u9A60\u9C74\u9C73\u9C71\u9C75\u9E14\u9E13\u9EF6\u9F0A\u9FA4\u7068\u7065\u7CF7\u866A\u883E" + - "\u883D\u883F\u8B9E\u8C9C\u8EA9\u8EC9\u974B\u9873\u9874\u98CC\u9961\u99AB\u9A64\u9A66\u9A67\u9B24" + - "\u9E15\u9E17\u9F48\u6207\u6B1E\u7227\u864C\u8EA8\u9482\u9480\u9481\u9A69\u9A68\u9B2E\u9E19\u7229" + - "\u864B\u8B9F\u9483\u9C79\u9EB7\u7675\u9A6B\u9C7A\u9E1D\u7069\u706A\u9EA4\u9F7E\u9F49\u9F98\u691E" + - "\u6EB8\uFFFF\u3079\uFFFD\uFFFE\u003F\uE000\uFFFD\uFFFE\u007D\uE03F\uFFFF\u0043\uFFFD\uFFFE\u003F" + - "\uE0BC\uFFFD\uFFFE\u007D\uE0FB\uFFFF\u0043\uFFFD\uFFFE\u003F\uE178\uFFFD\uFFFE\u007D\uE1B7\uFFFF" + - "\u0043\uFFFD\uFFFE\u003F\uE234\uFFFD\uFFFE\u007D\uE273\uFFFF\u0043\uFFFD\uFFFE\u003F\uE2F0\uFFFD" + - "\uFFFE\u007D\uE32F\uFFFF\u0043\uFFFD\uFFFE\u003F\uE3AC\uFFFD\uFFFE\u007D\uE3EB\uFFFF\u0043\uFFFD" + - "\uFFFE\u003F\uE468\uFFFD\uFFFE\u007D\uE4A7\uFFFF\u0043\uFFFD\uFFFE\u003F\uE524\uFFFD\uFFFE\u007D" + - "\uE563\uFFFF\u0043\uFFFD\uFFFE\u003F\uE5E0\uFFFD\uFFFE\u007D\uE61F\uFFFF\u0043\uFFFD\uFFFE\u003F" + - "\uE69C\uFFFD\uFFFE\u007D\uE6DB\uFFFF\u0043\uFFFD\uFFFE\u003F\uE758\uFFFD\uFFFE\u007D\uE797\uFFFF" + - "\u0043\uFFFD\uFFFE\u003F\uE814\uFFFD\uFFFE\u007D\uE853\uFFFF\u0043\uFFFD\uFFFE\u003F\uE8D0\uFFFD" + - "\uFFFE\u007D\uE90F\uFFFF\u0043\uFFFD\uFFFE\u003F\uE98C\uFFFD\uFFFE\u007D\uE9CB\uFFFF\u0043\uFFFD" + - "\uFFFE\u003F\uEA48\uFFFD\uFFFE\u007D\uEA87\uFFFF\u0043\uFFFD\uFFFE\u003F\uEB04\uFFFD\uFFFE\u007D" + - "\uEB43\uFFFF\u0043\uFFFD\uFFFE\u003F\uEBC0\uFFFD\uFFFE\u007D\uEBFF\uFFFF\u0043\uFFFD\uFFFE\u003F" + - "\uEC7C\uFFFD\uFFFE\u007D\uECBB\uFFFF\u0043\uFFFD\uFFFE\u003F\uED38\uFFFD\uFFFE\u007D\uED77\uFFFF" + - "\u0043\uFFFD\uFFFE\u003F\uEDF4\uFFFD\uFFFE\u007D\uEE33\uFFFF\u0043\uFFFD\uFFFE\u003F\uEEB0\uFFFD" + - "\uFFFE\u007D\uEEEF\uFFFF\u0043\uFFFD\uFFFE\u003F\uEF6C\uFFFD\uFFFE\u007D\uEFAB\uFFFF\u0043\uFFFD" + - "\uFFFE\u003F\uF028\uFFFD\uFFFE\u007D\uF067\uFFFF\u0043\uFFFD\uFFFE\u003F\uF0E4\uFFFD\uFFFE\u007D" + - "\uF123\uFFFF\u0043\uFFFD\uFFFE\u003F\uF1A0\uFFFD\uFFFE\u007D\uF1DF\uFFFF\u0043\uFFFD\uFFFE\u003F" + - "\uF25C\uFFFD\uFFFE\u007D\uF29B\uFFFF\u0043\uFFFD\uFFFE\u003F\uF318\uFFFD\uFFFE\u007D\uF357\uFFFF" + - "\u0043\uFFFD\uFFFE\u003F\uF3D4\uFFFD\uFFFE\u007D\uF413\uFFFF\u0043\uFFFD\uFFFE\u003F\uF490\uFFFD" + - "\uFFFE\u007D\uF4CF\uFFFF\u0043\uFFFD\uFFFE\u003F\uF54C\uFFFD\uFFFE\u007D\uF58B\uFFFF\u0043\uFFFD" + - "\uFFFE\u003F\uF608\uFFFD\uFFFE\u007D\uF647\uFFFF\u0043\uFFFD\uFFFE\u003F\uF6C4\uFFFD\uFFFE\u007D" + - "\uF703\uFFFF\u0043\uFFFD\uFFFE\u003F\uF780\uFFFD\uFFFE\u007D\uF7BF\uFFFF\u1D02\uFFFD"; - - - private static final String fromUnicode_ = - "\uFFFF\u02BA\uFEFE\u445B\uFFFF\f\uFEFE\u4553\uFEFE\u4551\u4552\u4554\uFEFE\u4752\uFFFF\u000B" + - "\uFEFE\u4555\uFFFF\u00B7\uFEFE\uFFFE\u0011\u4161\uFEFE\uFFFE\u0007\u4172\uFFFF\u0007\uFEFE\uFFFE" + - "\u0011\u4141\uFEFE\uFFFE\u0007\u4152\uFFFF\u0037\uFEFE\u41C6\uFFFF\u000E\uFEFE\uFFFE\u0006\u41C0" + - "\uFFFE\u001A\u41C7\uFFFE\u0006\u4180\uFFFE\u001A\u4187\uFEFE\u4186\uFFFF\u1BBE\uFEFE\u445A\uFEFE" + - "\uFEFE\uFEFE\u444A\uFEFE\uFEFE\uFEFE\u4461\u4471\uFEFE\uFEFE\u4462\u4472\uFEFE\uFEFE\u4377\u4378" + - "\uFEFE\uFEFE\uFEFE\u447E\u447F\u4345\uFFFF\b\uFEFE\u4373\uFEFE\u4450\u44EF\uFEFE\u4279\uFFFF" + - "\u0005\uFEFE\u446B\uFEFE\uFEFE\u42A1\uFFFF\u00C4\uFEFE\u444E\uFEFE\u46BB\uFEFE\uFEFE\uFEFE\u46DB" + - "\uFFFF\f\uFEFE\u446E\uFFFF\n\uFEFE\u446F\uFFFF\t\uFEFE\u4372\uFFFF\u0034\uFEFE\uFFFE" + - "\n\u41F1\uFFFF\u0006\uFEFE\uFFFE\n\u41B1\uFFFF\u0016\uFEFE\u44F1\u44F2\u44F0\u44F3\uFEFE" + - "\uFEFE\u46D4\u46D5\u46D7\u46D6\uFFFF\u001E\uFEFE\u46EF\u46F0\uFFFF\u0018\uFEFE\u436E\uFEFE\u436F" + - "\uFFFF\u0012\uFEFE\u46EE\uFFFF\u0018\uFEFE\u4370\uFEFE\u434E\u4371\uFEFE\uFEFE\uFEFE\u434F\u4364" + - "\uFEFE\uFEFE\u4365\uFFFF\t\uFEFE\u46DA\uFFFF\u0004\uFEFE\u46C5\uFEFE\uFEFE\u4361\u444D\u46CC" + - "\u46CB\uFFFF\u0004\uFEFE\u447C\uFEFE\u436C\u436D\u46C8\u46C9\u46D0\u4363\uFEFE\u46D1\uFFFF\u0005" + - "\uFEFE\u4468\u4478\uFFFF\u0006\uFEFE\u43A1\u4360\uFFFF\u0014\uFEFE\u46C6\uFFFF\r\uFEFE\u444C" + - "\u46C7\uFFFF\u0004\uFEFE\u4467\u4477\uFEFE\uFEFE\u435D\u435E\uFFFF\u0016\uFEFE\u4368\u4369\uFEFE" + - "\uFEFE\u4366\u4367\uFFFF\r\uFEFE\u46D2\uFEFE\uFEFE\uFEFE\u46D3\uFFFF\u000B\uFEFE\u46CA\uFFFF" + - "\u0019\uFEFE\u46CD\uFFFF\u0052\uFEFE\u434D\uFFFF\u00ED\uFEFE\uFFFE\u0020\u4781\uFEFE\u47A1\uFFFF" + - "\u003E\uFEFE\uFFFE\n\u4641\uFFFF\n\uFEFE\uFFFE\n\u4651\uFFFF\u0082\uFEFE\u4675\u43B7" + - "\u4676\u43B8\uFFFF\b\uFEFE\u4678\uFEFE\uFEFE\u43B9\u4679\uFEFE\uFEFE\u43E1\u467A\uFEFE\uFEFE" + - "\u43E3\u467B\uFEFE\uFEFE\u43E2\u4673\u43EE\uFEFE\uFEFE\u43E9\uFEFE\uFEFE\u43E4\u4672\u43F0\uFEFE" + - "\uFEFE\u43EB\uFEFE\uFEFE\u43E6\u4671\uFEFE\uFEFE\u43EA\u43EF\uFEFE\uFEFE\u43E5\u4670\uFEFE\uFEFE" + - "\u43EC\u43F1\uFEFE\uFEFE\u43E7\u466F\uFEFE\uFEFE\u43ED\uFEFE\uFEFE\u43F2\uFFFF\b\uFEFE\u43E8" + - "\uFFFF\u0004\uFEFE\u4681\uFFFF\r\uFEFE\u4682\uFEFE\uFEFE\u4684\uFFFF\b\uFEFE\u4683\uFEFE" + - "\uFEFE\u0000\u0003\u467C\u7D7F\u7E89\u8A8B\u46B7\uFFFF\f\uFEFE\uFFFE\b\u4660\u0000\u0003" + - "\u466E\u6D6C\u6B6A\u6968\uFFFF\u0004\uFEFE\u4674\u4677\uFFFF\n\uFEFE\u44EA\u44E9\uFFFF\u0010" + - "\uFEFE\u44E3\u44E2\uFFFF\b\uFEFE\u44EC\u44EB\uFFFF\b\uFEFE\u44E8\u44E7\uFEFE\uFEFE\uFEFE" + - "\u44E0\uFEFE\uFEFE\u44E4\u44E1\uFFFF\u0012\uFEFE\u4685\u4686\u4688\u4687\uFFFF\t\uFEFE\u437A" + - "\uFFFF\u0015\uFEFE\u44E6\u44E5\uFFFF\u0039\uFEFE\u4479\uFEFE\u4469\uFFFF\'\uFEFE\u4376\uFEFE" + - "\uFEFE\u4375\uFEFE\u4374\uFFFF\u00CD\uFEFE\u425C\uFFFF\u08C2\uFEFE\u4040\u4344\u4341\u46B9\uFEFE" + - "\u0000\u0003\u445D\u5E5F\u6474\u6575\u4342\u4343\u0000\u0003\u4442\u4366\u766C\u7D63\u4473\uFFFF" + - "\u0007\uFEFE\u46E9\u46EA\uFEFE\uFEFE\uFFFE\t\u4541\uFFFF\u0017\uFEFE\u0000\u0029\u4447\u8148" + - "\u8249\u8351\u8452\u8586\uC087\uC188\uC289\uC38A\uC48C\uC58D\uC68E\uC78F\uC890\uC991\uCA92\uCB56" + - "\u93CC\u94CD\u95CE\u9697\u9899\u9A9D\uCFD5\u9ED0\uD69F\uD1D7\uA2D2\uD8A3\uD3D9\uA4A5\uA6A7\uA853" + - "\uA954\uAA55\uACAD\uAEAF\uBABB\u57BC\uDADB\u46BD\uFFFF\u0007\uFEFE\u43BE\u43BF\u44DC\u44DD\uFEFE" + - "\uFEFE\u0000\u002A\u4347\u8148\u8249\u8351\u8452\u8586\uC087\uC188\uC289\uC38A\uC48C\uC58D\uC68E" + - "\uC78F\uC890\uC991\uCA92\uCB56\u93CC\u94CD\u95CE\u9697\u9899\u9A9D\uCFD5\u9ED0\uD69F\uD1D7\uA2D2" + - "\uD8A3\uD3D9\uA4A5\uA6A7\uA853\uA954\uAA55\uACAD\uAEAF\uBABB\u57BC\uDADB\u46BD\uD459\u435A\uFFFF" + - "\u0005\uFEFE\u4358\u43DC\u43DD\uFFFF\u0006\uFEFE\uFFFE\u0025\u4556\uFFFF\u0107\uFEFE\u446D\uFFFF" + - "\u0071\uFEFE\u46BA\uFFFF\u00EA\uFEFE\u46E2\u46E3\uFFFF\f\uFEFE\u46DD\u46DE\u46DF\uFEFE\uFEFE" + - "\u46E1\uFFFF\"\uFEFE\u46E4\uFFFF\t\uFEFE\u46E0\uFEFE\uFEFE\u46CF\u46CE\uFEFE\uFEFE\u46DC" + - "\uFFFF\u1A2A\uFEFE\u4C41\u4C43\uFEFE\u4C44\uFEFE\uFEFE\uFEFE\u6946\u4C57\u4C55\u4C58\u4C56\u6947" + - "\u4C83\u6950\u694E\u4C82\u4C81\uFEFE\uFEFE\u4CE1\u4CE0\u4CDF\uFEFE\u4CE2\u4CDE\uFFFF\u0004\uFEFE" + - "\u4DA1\u4DA2\uFFFF\u0006\uFEFE\u4FE3\uFEFE\u4842\uFEFE\uFEFE\u4C59\uFEFE\u4C84\u6951\uFEFE\u4C85" + - "\u6964\u4E8C\u6B52\uFEFE\uFEFE\u4843\uFEFE\u4C5A\u4C86\uFEFE\u4CE3\u6965\uFEFE\uFEFE\u4844\uFEFE" + - "\uFEFE\u6941\u4C45\uFEFE\u4C5C\uFEFE\u6948\u4C5D\uFEFE\uFEFE\u4C87\uFEFE\u4CE4\u4CE6\u4CE5\uFEFE" + - "\uFEFE\u4DA3\u4DA4\uFEFE\uFEFE\u4FE4\uFEFE\u53FD\u4C42\uFEFE\uFEFE\u6942\u4C46\u4C5F\u4C5E\uFFFF" + - "\t\uFEFE\u4DA5\uFFFF\t\uFEFE\u4FE5\uFFFF\n\uFEFE\u5692\u726F\uFEFE\uFEFE\u5BA9\u7977" + - "\u7978\u4846\u4C47\uFEFE\u4C89\uFEFE\uFEFE\u4FE6\u4C48\u6949\u4C60\uFEFE\uFEFE\u4C8A\u4C8C\u6952" + - "\u4C8D\u4C8B\uFEFE\uFEFE\uFEFE\u4DA6\uFEFE\u4FE7\uFEFE\uFEFE\u4FE8\u51E6\u4848\u4C61\u4C8E\uFEFE" + - "\u4DA7\u4DA9\u4DA8\uFEFE\u4E8D\uFEFE\uFEFE\u4FE9\u4FEA\u51E7\u51E8\uFFFF\u0004\uFEFE\u5441\uFEFE" + - "\uFEFE\u7979\uFEFE\uFEFE\u8F66\u4C49\uFFFF\u0005\uFEFE\u4C90\u4C8F\u6953\u4C91\u4C97\uFEFE\u4C92" + - "\u4C93\u6955\u6954\u4C95\u4C96\uFEFE\u4C94\uFFFF\u0006\uFEFE\uFFFE\u0004\u4CE9\u4CE8\u4CEF\u696B" + - "\uFEFE\u6967\u696A\u4CF0\u4D43\uFEFE\u6969\uFEFE\u4CED\u4CEE\u4CE7\uFEFE\uFEFE\u6966\u6968\uFFFF" + - "\u0006\uFEFE\u4DB6\u6990\u4DB3\u4DB7\u699A\u698E\u4DB4\u6992\uFEFE\uFEFE\uFEFE\u4DB5\uFEFE\u4DB8" + - "\uFEFE\u4DAA\u6991\u4DB9\u6995\uFEFE\u6999\u6996\uFEFE\uFEFE\u6993\u4DAB\u4DAD\u4DBA\uFEFE\u4DAF" + - "\u698B\u4DB2\u4DB0\u4DB1\u699B\u6998\u698F\u4DAE\uFEFE\uFEFE\u698C\u4DAC\uFEFE\uFEFE\uFEFE\u6994" + - "\uFFFF\u0004\uFEFE\u6997\uFFFF\t\uFEFE\u698D\u6A48\uFEFE\u4EA3\u4E96\uFEFE\uFEFE\u6A49\u4E93" + - "\uFEFE\u4EA5\uFEFE\u4E9B\uFEFE\u4E9A\u69FA\u4E9E\u4E99\u6A42\u6A4A\uFEFE\u6A46\uFEFE\u4E9C\uFEFE" + - "\uFEFE\u4E9F\u4E90\u4EA8\u69FC\uFEFE\uFEFE\u6B5E\u4E8E\u4EA4\u4E8F\u4E97\u4E98\u6A44\u69FD\u4E9D" + - "\u4E95\u69F9\u4E91\u6A47\u4EA6\u4EA9\u4E94\u4EA1\u4EA7\u4E92\u6A45\u4EA2\u6A4B\u69FB\u4EA0\u6A41" + - "\uFEFE\uFEFE\u6A43\uFEFE\u4FF8\u6B60\u6B6C\u4FF0\uFEFE\u6B6D\u4FEB\u4FF5\uFEFE\uFEFE\u4FEE\u6B5A" + - "\u4FF6\u6B59\u6B5D\u6B64\u6B62\u5041\u4FF9\u6B54\u6B56\u4FFB\u4FEF\u6B57\u6B63\u6B6A\u4FF4\u6B5C" + - "\u6B55\u4FF3\u6B58\u4FF7\u6B5B\uFEFE\u4FF2\uFEFE\u4FED\uFEFE\u4FFC\u6B65\u4FFD\u6B69\uFEFE\u6B67" + - "\u6B6B\u4FFA\u6B5F\u6B53\uFEFE\u6B61\u4FF1\u6B66\u4FEC\u6B68\uFFFF\u000F\uFEFE\u51F7\u51EB\uFEFE" + - "\uFEFE\u6D43\u6D4B\uFEFE\u51EA\u51F2\u5241\uFEFE\u6D51\u6D4F\u6D4A\uFEFE\uFEFE\uFEFE\u51EC\u6D50" + - "\u6D46\u51FA\u51F1\u51F9\u6D41\uFEFE\u6D4D\uFEFE\u6D44\u51F5\u6D45\uFEFE\u6CFD\u51FC\u51EF\u51F8" + - "\u51EE\uFEFE\u6D42\u6D47\uFEFE\u6D4E\u51F6\u51F3\u6D49\u51FB\u6D4C\u6D48\u51F0\u51FD\u51F4\u51ED" + - "\u51E9\uFFFF\n\uFEFE\u6D52\uFEFE\u545B\u5445\uFEFE\u5455\uFEFE\u545A\u6F93\u6F92\u6F97\u6F98" + - "\u5448\uFEFE\u5451\uFEFE\uFEFE\uFEFE\u545E\uFEFE\u5452\uFFFF\u0004\uFEFE\u6F8C\u544B\u6F8D\uFEFE" + - "\u5460\uFEFE\u5457\u5442\u5443\u6FA0\u56A3\uFEFE\u5450\u544F\u6F8E\u5453\u727F\u544A\u6F99\u5459" + - "\u5458\u544E\u6F91\u6F9A\uFEFE\u6F8B\u544D\u6F9B\u5456\u6F8F\u5444\uFEFE\u5447\u5446\u6F9C\u5454" + - "\u5449\u545D\u545F\u6F96\u545C\uFEFE\u6F9E\u6F90\u6F9F\uFEFE\u6F94\uFEFE\u6F9D\uFEFE\u6F95\uFFFF" + - "\u0004\uFEFE\u544C\uFEFE\uFEFE\uFEFE\u7288\u727B\uFEFE\u5697\uFEFE\u7281\u7287\u5696\u7279\u569A" + - "\u727D\u7276\u5698\u727A\u569D\u56A2\uFEFE\u728C\uFEFE\u7275\uFEFE\u569E\uFEFE\u728B\uFEFE\uFEFE" + - "\u5699\u727C\u5695\u0000\u0003\u7277\u7382\u7472\u7E85\u7286\u569B\uFEFE\uFEFE\u75C0\u7283\u7271" + - "\u7284\uFEFE\u56A5\u7289\u56A4\u7270\uFEFE\u7278\u728A\u56A0\u569F\u569C\u56A1\uFEFE\uFEFE\u5693" + - "\uFEFE\uFEFE\u5694\uFEFE\uFEFE\u594E\uFEFE\u75C3\u75BC\uFEFE\u594B\uFEFE\u75C4\uFEFE\uFEFE\uFEFE" + - "\u75BA\u75BD\u594A\u75BE\uFEFE\uFEFE\u594D\u75C2\uFEFE\u75B8\u75B7\u594F\uFEFE\u5950\u594C\u5951" + - "\u75B6\u75C1\u75BF\u75B9\uFEFE\uFEFE\uFEFE\u5949\u75BB\uFFFF\b\uFEFE\u5BB0\u5BAA\u797D\u5BB3" + - "\u7984\u7987\u5BAC\u5BAD\u7981\u5BAB\u798A\u5BB1\u798B\uFEFE\u7986\u5BB2\uFEFE\u797A\u5BAF\u797B" + - "\uFEFE\u7985\u7983\uFEFE\u797E\u5BAE\u797C\u5BB4\u7982\u7989\u797F\u7988\uFEFE\uFEFE\u5DFB\u5DF8" + - "\uFEFE\u5DF9\uFEFE\u7D43\u7CF8\u5DF7\u5DF4\u7CF9\uFEFE\uFEFE\u5DF6\u7CFC\uFEFE\u7D41\uFEFE\uFEFE" + - "\u7D48\uFEFE\uFEFE\u7D47\u7D42\u5DF3\u7CF7\u5DF1\u7CFA\u5DFC\u7CFD\uFEFE\u7D44\u5DF5\u5DF2\u7D46" + - "\u7D45\u5DFA\uFEFE\u7CFB\uFEFE\u6042\u8076\uFEFE\u8073\u6043\uFEFE\u6041\uFEFE\u807A\u8077\u8070" + - "\u5FFD\uFEFE\u6044\u8071\u5FFC\u6047\u8074\u8075\u6045\u6046\u807B\u8078\u8079\uFEFE\uFEFE\uFEFE" + - "\u6253\u83C3\u6250\u83C0\u6252\u6254\uFEFE\u83C1\u6251\uFEFE\u83C2\uFEFE\u83BF\uFEFE\uFEFE\u63C0" + - "\u86C8\u63C1\u86C6\uFEFE\u86C7\u86C5\u86C4\uFEFE\uFEFE\u86C9\u63BF\uFEFE\uFEFE\u8965\u8966\uFEFE" + - "\u8072\u8964\u63C2\u664B\u8B5A\u8B5B\uFEFE\u6783\u6784\u8E70\u8E6F\u67D7\u67D6\u9041\uFEFE\u4C4A" + - "\u4C62\u4C99\uFEFE\u4C98\u4CF2\u4CF1\u4DBD\u4DBC\u4DBE\u4DBB\uFEFE\u4EAB\u4EAA\u4EAC\uFFFF\u0004" + - "\uFEFE\u5043\uFEFE\u5042\u5044\uFEFE\u5242\uFEFE\u46F1\u6FA1\u46F2\u56A6\u46F4\u46F3\u75C5\uFEFE" + - "\u46F5\u5DFD\u46F6\uFEFE\u4C4B\uFEFE\u4C9A\u4DBF\u5045\uFEFE\u4C4C\u4C9D\u4C9B\u4C9C\uFEFE\uFEFE" + - "\u4DC0\uFEFE\uFEFE\uFEFE\u4EAD\u5047\u5046\u5048\uFEFE\uFEFE\uFEFE\u5461\uFEFE\uFEFE\uFEFE\u6255" + - "\uFEFE\u484D\uFFFF\u0004\uFEFE\u694F\uFEFE\u4CF3\u4CF4\uFEFE\uFEFE\u4DC1\uFEFE\u6A4C\uFEFE\u5244" + - "\u5243\u6FA3\u6FA2\u56A7\u484E\u4C9E\u6956\uFFFF\u0005\uFEFE\u6B6E\uFEFE\u5245\uFEFE\u5464\uFEFE" + - "\u5462\u5463\uFFFF\u0004\uFEFE\u6256\u484F\u4CF5\uFEFE\uFEFE\uFEFE\u4DC2\u699C\uFFFF\u0004\uFEFE" + - "\u4EAE\u4EAF\uFEFE\u6A4D\uFEFE\uFEFE\u6B6F\u5049\u6B70\uFFFF\u0005\uFEFE\u6FA5\u6FA6\u5467\uFEFE" + - "\u6FA7\uFEFE\u6FA4\u5468\u5466\u5465\u6FA8\uFEFE\u728D\uFEFE\uFEFE\uFEFE\u75C6\uFEFE\uFEFE\u798C" + - "\u7D49\uFEFE\uFEFE\uFEFE\u6048\u6257\u83C4\uFEFE\u4C4D\u4C5B\uFFFF\u000E\uFEFE\u56A8\u5953\uFEFE" + - "\u5E41\uFEFE\u6943\u4C9F\uFEFE\u4CF8\u4CF6\u4CF7\uFEFE\uFEFE\u504A\uFEFE\uFEFE\u4C4E\u4C4F\uFEFE" + - "\u4C63\uFEFE\uFEFE\u4CA0\u4CA1\u4CA2\u699E\u4CF9\uFEFE\u696C\uFEFE\u4DC6\uFEFE\u699F\u4DC4\u4DC5" + - "\u699D\uFEFE\uFEFE\u4DC7\u4DC3\uFFFF\u0004\uFEFE\u6A4E\u51CE\u6A4F\uFEFE\uFEFE\u6A50\uFEFE\uFEFE" + - "\u4EB1\u4EB0\uFEFE\uFEFE\u4EB4\u4EB2\u4EB3\uFEFE\uFEFE\uFEFE\u5050\uFEFE\u504F\u6B75\u6B72\u6B73" + - "\uFEFE\u6B71\u5051\u504D\u504C\uFEFE\u504E\u504B\uFFFF\u0005\uFEFE\u5052\uFEFE\u5247\u6D53\uFEFE" + - "\u6B74\u524C\uFEFE\u6D54\u5248\u524B\u524A\u5249\u5246\uFEFE\uFEFE\uFEFE\u6FAB\uFEFE\u546B\u6FAE" + - "\u5469\uFEFE\uFEFE\uFEFE\u6FAA\u546C\u546A\u546D\u6FAC\u6FAD\uFEFE\u6FA9\u6FAF\uFFFF\u0006\uFEFE" + - "\u5957\u56A9\u728E\u7290\u728F\u7291\u56AA\uFEFE\uFEFE\u5954\uFEFE\u5955\u5956\uFEFE\u5BB6\u798E" + - "\uFEFE\u798D\u798F\u7990\u5BB7\uFEFE\u5BB5\u7D4A\u7D4B\u5E43\u5E42\u7EE2\uFEFE\uFEFE\u6049\u604A" + - "\u604B\u604D\u807C\u807D\u604C\uFEFE\uFEFE\uFEFE\u6258\uFEFE\u6259\uFEFE\uFEFE\u8B5C\u8E72\u8E71" + - "\u9042\uFEFE\u4C50\uFEFE\uFEFE\uFEFE\u4CFB\u4CFA\uFEFE\uFEFE\u4DC8\uFEFE\uFEFE\u69A0\uFEFE\uFEFE" + - "\u4EB6\u4EB7\u4EB5\u4EB8\u6A51\u6A52\uFFFF\f\uFEFE\u5054\u6B76\uFEFE\u5053\uFEFE\u6D55\u5250" + - "\u6D56\u524F\uFEFE\uFEFE\uFEFE\u524D\uFEFE\u524E\uFEFE\uFEFE\uFEFE\u6FB0\uFFFF\u0004\uFEFE\u56AB" + - "\u7293\uFEFE\u56AE\u7292\u57AA\u56AD\u56AC\uFEFE\u595A\uFEFE\u5959\u5958\u5BB8\uFEFE\uFEFE\u5BBB" + - "\u5BBC\u5BBA\uFEFE\u5BB9\uFEFE\uFEFE\u7D4C\uFEFE\u7D4D\uFEFE\uFEFE\uFEFE\u807F\u604E\u807E\uFEFE" + - "\u625A\u86CA\u63C3\uFEFE\u8B5D\u66DF\u4854\u4C64\u4CA3\u6957\uFEFE\u4CA4\u4CA5\uFFFF\u0005\uFEFE" + - "\u4CFC\u4CFD\uFEFE\u4DC9\u6A53\u6B77\u6B78\uFEFE\u5251\u6FB1\u56B0\u56AF\u75C8\u75C7\uFEFE\uFEFE" + - "\u4C51\u4CA6\u4D41\uFEFE\u56B1\u6944\uFEFE\u696D\u4D42\uFEFE\u69A2\u4DCB\u4DCA\u69A1\u4EB9\uFFFF" + - "\u0006\uFEFE\u546E\uFEFE\uFEFE\u7294\uFEFE\u5BBD\u7D4E\u5E44\uFEFE\uFEFE\u83C5\uFEFE\uFEFE\u8CEB" + - "\u4857\u4CA7\uFEFE\uFEFE\u6B79\u6D57\u56B4\u56B2\u56B3\u4C52\uFEFE\u4C65\u454B\u4CAA\uFEFE\u4CA9" + - "\u4CA8\u4D45\u4D44\uFEFE\u696E\u69A3\uFEFE\uFEFE\uFEFE\u5058\u5055\u5057\u5056\uFEFE\uFEFE\u5252" + - "\uFEFE\uFEFE\u595B\uFEFE\u4C53\uFEFE\u4CAB\uFEFE\u4D47\u4D46\uFEFE\u6A54\uFEFE\uFEFE\u5059\uFEFE" + - "\uFEFE\u485A\uFEFE\uFEFE\u6958\uFEFE\u4D49\u4D48\u4DCC\u4DCD\u6A55\u4EBA\uFEFE\u4EBB\uFEFE\u505A" + - "\u505B\u505C\uFEFE\u5253\u6D58\uFEFE\uFEFE\u546F\uFEFE\uFEFE\u6945\uFEFE\u4CAC\uFFFF\u0005\uFEFE" + - "\u69A4\uFEFE\uFEFE\uFEFE\u6A56\u6A57\uFEFE\uFEFE\u6B7A\uFEFE\u6B7B\uFEFE\u6D5A\u6D59\u6D5C\u6D5B" + - "\u5254\uFEFE\u7295\u5471\u6FB2\u5470\uFFFF\u0004\uFEFE\u75C9\u595C\uFEFE\u75CA\uFFFF\u0004\uFEFE" + - "\u7D4F\u5E45\uFFFF\u0004\uFEFE\u604F\uFEFE\u8B5E\uFEFE\u485C\uFEFE\uFEFE\u6959\uFEFE\u4D4A\uFFFF" + - "\u0007\uFEFE\u56B5\uFFFF\u0004\uFEFE\u4C54\u4C66\u4CAE\u4CAD\uFEFE\u4CAF\uFFFF\u0006\uFEFE\u505E" + - "\uFEFE\u505D\u505F\uFEFE\uFEFE\uFEFE\u5255\uFEFE\uFEFE\uFEFE\u5472\uFEFE\u83C6\u655A\u4C67\u4D4C" + - "\u4D5B\u4D56\uFEFE\u0000\u0005\u4D51\u5057\u554E\u5C4F\u4B5A\u5958\u4D4D\uFEFE\u4D54\uFEFE\uFEFE" + - "\u4D53\uFEFE\uFEFE\u4D5D\u4D52\uFFFF\u0004\uFEFE\u4DD3\uFEFE\u4DD9\u4DD5\uFEFE\u4DDB\u69A5\u0000" + - "\u0005\u4DD8\uCED1\uD4D0\uD7DA\uCFD2\uD6DC\uFFFF\u0005\uFEFE\u6A60\u6A5D\uFEFE\u4EC8\u6A5E\u4EBC" + - "\u4EBE\u4ED6\u4ED1\uFEFE\uFEFE\uFEFE\u6A65\u6A5F\u4EC0\u4EC2\u6A64\u4EC9\u6A5A\u4ED5\u4ED7\u4EBD" + - "\u4ECE\uFEFE\u6A58\u4ED4\uFEFE\u4EC5\uFEFE\u4ECF\u4ED0\u6A59\u4ECD\u4ECB\uFEFE\u4ECC\u4ED2\u6A61" + - "\u4EBF\uFEFE\u4ED3\u6A63\u4EC7\u4EC4\uFEFE\u6A5C\u4EC3\u6A66\u4EC6\uFEFE\u4ECA\uFEFE\uFEFE\uFEFE" + - "\u4EC1\u6A62\uFFFF\u0004\uFEFE\u6A5B\uFFFF\u000B\uFEFE\u6B8D\u6B8C\u5071\u6B8F\u6B91\u6B86\u6B89" + - "\u6B90\u5072\uFEFE\uFEFE\u6B83\u6B87\uFEFE\uFEFE\u6B8B\u6D6B\u506D\u6D6F\u5060\u6B88\u5061\u506E" + - "\u5067\u5063\uFEFE\u6B84\u5066\u506B\u5074\u6B85\u6B7D\u5065\u6B7E\u6B81\uFEFE\u5068\uFEFE\u506A" + - "\u6B7C\u6B82\uFEFE\uFEFE\u5073\u506F\u6B8A\u5075\uFEFE\u506C\u6B7F\u5069\uFEFE\uFEFE\u5064\u5062" + - "\uFEFE\u6B8E\uFEFE\u5070\uFFFF\u0005\uFEFE\u6D6A\u6D5E\u6D6D\uFEFE\uFEFE\u6D60\u0000\u0003\u525C" + - "\u6A58\u6961\u6656\u6D5F\u6D65\u5265\u6D71\u5267\uFEFE\u525D\uFEFE\uFEFE\u6D67\u6D64\u525B\uFEFE" + - "\u6D5D\u5268\u6D6C\u5260\u6D6E\u526B\u5257\u5262\u525F\u6D62\u5263\u6D68\u6D69\u525E\u5264\u525A" + - "\uFFFF\u0004\uFEFE\u5259\u6D61\uFFFF\u0006\uFEFE\u6D66\uFFFF\u0007\uFEFE\u6D70\uFEFE\u6FC6\u547F" + - "\u6FB4\uFEFE\u6FB9\u5478\u5484\u6FB7\u5473\u547D\u5483\u6FBE\uFEFE\u547E\u5482\uFEFE\uFEFE\u6FC1" + - "\u5479\u6FB8\uFEFE\uFEFE\uFEFE\u6FC4\u6FC5\uFEFE\u547B\u6FC3\u5477\u5487\uFEFE\u6FBB\uFEFE\u5475" + - "\uFEFE\u6FC8\u6FBC\u6FC0\u547A\u5486\u6FBD\u5481\u6FC2\u6FC9\u72A4\uFEFE\u6FC7\u5488\u5474\u6FBF" + - "\u6FB6\uFEFE\u547C\uFEFE\uFEFE\u6FB5\uFEFE\uFEFE\u6FBA\uFFFF\u000B\uFEFE\u6FB3\u5485\uFEFE\uFEFE" + - "\u729C\uFEFE\u56C8\u72AA\u56C6\u56C3\u72A1\u56BF\u72A5\u56CA\u729B\u72A0\u729F\u5476\u56C5\u72A8" + - "\uFEFE\u72AB\u7298\uFEFE\u596E\uFEFE\u72AC\u56CB\uFEFE\u56BD\u56BA\u72A3\u56B7\uFEFE\u72A9\uFEFE" + - "\u56BE\u72AD\uFEFE\u7299\u72A7\u56C1\u729A\u729D\u72A2\uFEFE\uFEFE\u56C2\u56C0\u56CC\uFFFF\u0004" + - "\uFEFE\u56C7\uFEFE\u56BB\u5797\uFEFE\u56BC\u729E\u56C9\u56C4\u72A6\u56B9\uFEFE\uFEFE\uFEFE\u56B8" + - "\uFFFF\n\uFEFE\u7296\u7297\u75CF\uFEFE\uFEFE\uFEFE\u595D\u5960\u75DA\u5974\u75DD\u595E\u75D6" + - "\u5964\u596A\u5AC2\uFEFE\uFEFE\u5968\u75D3\u5975\u5961\u5969\u75DB\u799E\u75E0\u75D4\uFEFE\u75CB" + - "\u75D8\u75D2\u5967\u75DE\uFEFE\uFEFE\u5963\u5977\u5970\uFEFE\u5965\u5962\uFEFE\u596D\uFEFE\u75DF" + - "\u75D1\u75D7\u75D9\u75CD\u75DC\u595F\u75CC\uFEFE\u5966\u5976\u5972\u75CE\u596C\uFEFE\uFEFE\u5973" + - "\u596F\u596B\uFEFE\u75D5\uFFFF\u0005\uFEFE\u5971\uFEFE\uFEFE\uFEFE\u799C\u7998\uFEFE\u79A7\u7991" + - "\u799A\u5BCB\u5BCC\u5BC4\u79A3\u5BCE\u7996\u7995\u7993\u79A5\u5BC2\u799F\u7994\u5BC5\u799D\u5BC0" + - "\u7999\u79A0\u79A2\uFEFE\uFEFE\u79A6\u5BC9\u7992\u5BC3\u7997\uFEFE\u5BBE\uFEFE\u5BCA\u79A1\u5BC6" + - "\u5BC7\u5BCD\u5BC1\u46F7\u5BBF\u799B\uFFFF\u0005\uFEFE\u5BC8\uFEFE\uFEFE\u79A4\uFEFE\uFEFE\uFEFE" + - "\u5E55\u5E50\uFEFE\u7D5E\u7D5A\uFEFE\u7D54\u5E4A\u5E46\u7D5D\u5E47\u7D57\u7D59\uFEFE\u7D5C\uFEFE" + - "\u5E4C\uFEFE\u5E53\u5E4D\uFEFE\uFEFE\u7D52\u5E4E\u5E4F\u7D55\u5E54\uFEFE\u7D53\u7D58\u5E4B\u7D51" + - "\u5E51\u5E49\uFEFE\uFEFE\uFEFE\u5E48\u7D56\u7D5B\uFEFE\u5E52\uFFFF\u0007\uFEFE\u7D50\uFEFE\u6056" + - "\u8091\uFEFE\u808E\uFEFE\u6050\u605C\u605D\uFEFE\u6053\u808C\u6055\u8084\u605B\uFEFE\u8090\u6052" + - "\u8092\u6051\uFEFE\u808D\u808F\u6054\u808B\u8085\u8082\uFEFE\uFEFE\u75D0\u8088\uFEFE\u8081\u8087" + - "\u8086\uFEFE\u8083\uFEFE\u6058\uFFFF\u0004\uFEFE\u6057\uFEFE\uFEFE\uFEFE\u6059\u8089\u625B\u808A" + - "\uFEFE\uFEFE\uFEFE\u83CF\uFEFE\u83C8\uFEFE\u6267\u83CC\u625F\u6263\u83CB\uFEFE\u6262\u625E\u6261" + - "\u625C\u6266\u83CD\u83C9\u6265\u83C7\u6264\u83CE\u83CA\u605A\uFEFE\u6268\u83D0\u6260\u625D\uFFFF" + - "\u0004\uFEFE\u86D1\u86D3\u63C5\u86D4\u86D2\u86D0\u86CF\u63C7\u86CE\u63C8\uFFFF\u0004\uFEFE\u86CC" + - "\u86CD\u63C4\u63C9\u63C6\uFEFE\uFEFE\u86CB\uFEFE\u655B\uFEFE\u8969\u8967\u896C\u896A\uFEFE\u8968" + - "\u896B\uFFFF\u0007\uFEFE\u664C\u8B61\u8B62\u66E0\uFEFE\u8B63\u8B5F\u8B64\u8B60\u655C\uFEFE\uFEFE" + - "\uFEFE\u8CEC\u8CEE\u66E3\u8CED\u66E2\u66E1\uFFFF\u0004\uFEFE\u66E4\u8E74\u8E75\uFEFE\u6786\u6785" + - "\u6787\u8E73\uFEFE\u8F68\u8F67\uFEFE\u67D8\u67DA\u67D9\u8F69\u6854\u90B5\uFEFE\uFEFE\uFEFE\u687D" + - "\uFEFE\u90B4\u90FD\uFEFE\uFEFE\u694A\uFEFE\uFEFE\u4D5F\u4D5E\uFEFE\u4DDF\u4DDE\u69A7\u4DDD\u69A6" + - "\uFEFE\uFEFE\u4EDA\u6A69\uFEFE\u6A68\uFEFE\uFEFE\u4ED8\u4EDB\uFEFE\uFEFE\u6A67\uFEFE\u4ED9\uFFFF" + - "\u0006\uFEFE\u6B92\uFEFE\u6B93\u5076\uFFFF\u0004\uFEFE\u526C\uFEFE\u6FCA\u6FCB\u5489\u548A\uFEFE" + - "\uFEFE\u72AF\u56CD\u56CF\u72AE\u56CE\u75E1\u5978\uFFFF\u0004\uFEFE\u5BCF\u5BD0\u79A8\uFEFE\u5E57" + - "\uFEFE\u5E56\uFEFE\u8093\u83D2\u83D1\uFEFE\u917C\u4C68\u695A\uFEFE\u696F\u6970\uFFFF\u0004\uFEFE" + - "\u4DE2\u4DE6\u69A9\uFEFE\u4DE4\u4DE3\u69A8\u4DE5\u4DE1\uFEFE\uFEFE\u4DE0\u69AA\uFFFF\u0006\uFEFE" + - "\u4EE5\uFEFE\uFEFE\u4EE2\uFEFE\u4EDE\u6A6A\uFEFE\uFEFE\uFEFE\u6A6B\uFEFE\u4EE0\uFEFE\u6A6D\u4EDC" + - "\u6A6E\u6A6C\u4EDF\u4EE1\u4EE4\u4EE3\u4EDD\u6A6F\uFFFF\u000E\uFEFE\u507B\u6BA0\uFEFE\u507D\uFEFE" + - "\u507C\uFEFE\u6BA1\u507A\u5079\u6B97\uFEFE\u6B96\uFEFE\u0000\u0003\u6B94\u9998\u959E\u9F9C\u6B9A" + - "\u5078\uFEFE\uFEFE\uFEFE\u6B9D\u507E\u6BA2\uFEFE\uFEFE\u6B9B\uFEFE\u526D\u5077\uFFFF\u0007\uFEFE" + - "\u526E\u6D76\uFEFE\uFEFE\u6D7C\uFEFE\uFEFE\uFEFE\u5274\u6D7A\u6D81\uFEFE\u6D77\u6D7B\u6D7D\u6D7F" + - "\u6D79\uFEFE\u6D78\u6D73\u6D74\u526F\uFEFE\u5271\u5270\u6D75\u6D7E\uFFFF\b\uFEFE\u5273\uFFFF" + - "\u0006\uFEFE\u6D72\u6FD5\uFEFE\u6FD4\u6FD9\u6FD0\uFEFE\u6FD3\u6FD2\uFEFE\u6FD6\uFEFE\u6FDA\u548B" + - "\u548E\uFEFE\uFEFE\u6FD1\u6FD7\uFEFE\uFEFE\uFEFE\u548D\u6FCC\uFEFE\u5272\u72BD\u6FD8\uFEFE\u6FCF" + - "\uFEFE\u548C\u6FCE\uFFFF\u0006\uFEFE\u72B4\uFEFE\uFEFE\u56D0\u56D4\u72C4\u72B2\u72C0\u56D5\u72C2" + - "\uFEFE\u72C8\uFEFE\u72CC\uFEFE\uFEFE\u72C3\u72B7\u72BF\uFEFE\u72CD\u72CB\u72C1\u72BC\u72B5\u75E9" + - "\u72B3\u56D9\u72BA\u56DA\u56D6\u72B0\u72C6\u72B8\uFEFE\uFEFE\u72B6\u72C9\u56D7\uFEFE\u72CF\u56D1" + - "\u56D3\u72BE\u72B9\u548F\u56D2\u72BB\u72CA\u72CE\u72C5\uFEFE\u72C7\uFEFE\uFEFE\uFEFE\u72B1\uFFFF" + - "\u0004\uFEFE\u75E4\uFEFE\u75ED\u75EC\u5981\u75E5\uFEFE\u5982\u597F\uFEFE\u75E7\u597C\u75EB\uFEFE" + - "\u75E6\u75E8\u75E2\u597A\uFEFE\u75F5\u75F4\u75F1\u5979\u597D\u597E\u6FCD\u75EE\u597B\u56D8\u75F0" + - "\u75E3\u75F3\u75F2\uFEFE\u75F6\uFEFE\u79B6\uFEFE\u75EF\uFFFF\b\uFEFE\u75EA\u79AE\u5BDA\u5BDD" + - "\u5BD8\u79AD\u79B1\u79AC\uFEFE\u5BD2\u5BDC\u79A9\u5BD6\u79B0\uFEFE\u5BD4\u5BD3\u79B3\u5BD5\u79B5" + - "\uFEFE\u79B2\u5BD1\uFEFE\uFEFE\uFEFE\u5BDB\u79B7\u79AB\u79B4\uFEFE\uFEFE\u79AA\uFEFE\uFEFE\u5BD7" + - "\uFEFE\u5BD9\uFEFE\u79AF\uFEFE\u79B8\uFEFE\uFEFE\u7D66\u5E58\u7D6C\uFEFE\uFEFE\u5E5D\u7D68\u7D6F" + - "\u7D60\u5E5F\u5E59\u7D65\u605E\u7D64\u7D6D\u5E5A\uFEFE\u5E5E\u7D63\u7D69\u7D6E\u7D5F\u5E5C\u7D67" + - "\uFEFE\uFEFE\u7D6B\u7D71\u7D61\u7D6A\uFEFE\u5E5B\u7D70\uFEFE\uFEFE\uFEFE\u7D62\uFEFE\uFEFE\uFEFE" + - "\u6062\u8095\u6060\u605F\u8097\u809C\uFEFE\u8098\uFEFE\u809B\u6065\uFEFE\u624E\u6064\uFEFE\u8094" + - "\u809A\uFEFE\u6063\u8099\uFEFE\u8096\uFEFE\u6061\uFFFF\u0006\uFEFE\u83D7\uFEFE\u83D9\u83D4\u626A" + - "\u83D6\uFEFE\u6269\u83D8\uFEFE\uFEFE\u626C\u83DA\u626B\u83D3\u83D5\uFFFF\u0004\uFEFE\u63CD\u86D7" + - "\uFEFE\u63CC\u86D8\u63CB\u86D6\u63CA\u86D5\uFEFE\u655E\u655D\u8B65\u8B67\uFEFE\u8B66\u664D\u664E" + - "\uFEFE\uFEFE\u664F\u8CEF\u66E5\uFEFE\uFEFE\u9044\u9043\u687E\uFEFE\u4C69\u4CB0\uFEFE\uFEFE\u4EE6" + - "\uFFFF\u0004\uFEFE\u6D82\uFFFF\u0004\uFEFE\u5983\u5984\uFEFE\u79B9\u5E60\u7D72\u809D\uFEFE\uFEFE" + - "\uFEFE\u695B\uFEFE\uFEFE\u6A70\uFEFE\uFEFE\uFEFE\u4862\uFEFE\u6BA3\u6D83\u6FDB\u5490\uFEFE\uFEFE" + - "\u8B68\uFEFE\u6788\u4C6A\u4D60\u6971\uFEFE\u4DE7\u4DE8\uFEFE\u507F\uFEFE\uFEFE\uFEFE\u56DB\uFEFE" + - "\u5E62\uFEFE\u5E63\u5E61\uFEFE\u4C6B\uFEFE\u4CB1\u4CB3\u4CB2\u695C\u4CB4\u4D61\u6972\uFEFE\u4D62" + - "\uFFFF\u0005\uFEFE\u4DE9\u4DEA\uFEFE\uFEFE\uFEFE\u69AB\uFEFE\u4EE7\uFEFE\u6A71\uFEFE\uFEFE\uFEFE" + - "\u5084\u6BA4\uFEFE\u5082\u5083\u5081\u6FDC\uFEFE\uFEFE\uFEFE\u5278\u5277\u5279\u5276\uFEFE\u6D84" + - "\u5085\u5275\uFEFE\u5491\u5492\uFEFE\u5493\uFEFE\u72D0\uFEFE\uFEFE\uFEFE\u5985\u75F7\u56DC\uFFFF" + - "\u0004\uFEFE\u5BDE\uFEFE\u5E65\u5E64\u7D73\uFEFE\u6066\u626D\uFEFE\u896D\u8F6A\u9045\u4C6C\u4D63" + - "\uFEFE\u4D64\u69B1\u4DEC\u4DEF\uFEFE\u69AF\u69AD\u4DEE\u69B0\u69B2\u69AC\u4DF1\u4DF0\u4DED\u4DEB" + - "\u69AE\uFFFF\u0004\uFEFE\u4EF2\uFEFE\uFEFE\u4EEF\u6A76\u6A79\u6A78\uFEFE\u4EE9\u4EF1\uFEFE\uFEFE" + - "\u4EEE\u6A75\u6A73\u4EED\uFEFE\uFEFE\uFEFE\u4EE8\u4EEB\uFEFE\u6A74\u6A7B\u6A77\u4EEC\u4EF0\u4EF3" + - "\u6A72\u6A7A\u4EEA\uFFFF\u0005\uFEFE\u508A\u5092\uFEFE\u6BB0\u6BA9\u5093\u6BB4\u6BA5\u6BAC\uFEFE" + - "\uFEFE\u5089\u6BA6\u5087\u6BAD\u6BB1\u5086\uFEFE\u6BB2\u6BAB\uFEFE\u6BAE\uFEFE\u5095\u508C\u6BB5" + - "\u6BB3\uFEFE\u5091\u508F\u6BAA\u508E\u6BA8\u6BA7\u508D\u508B\u5094\u5090\u5088\uFEFE\u6BAF\uFEFE" + - "\u527B\uFEFE\u5283\u6D92\u527A\u6D8A\u6D86\uFEFE\u6D96\u6D85\uFEFE\u527D\u6D8F\u5281\u5284\uFEFE" + - "\u527E\u6D93\u5282\uFEFE\u549A\u6D99\u6D87\uFEFE\uFEFE\u0000\u0003\u6D89\u9094\u9895\u8E91\uFEFE" + - "\uFEFE\u6D8B\u5286\u6D8D\u6D8C\u6D97\u527C\u6D88\u5285\uFEFE\u527F\uFFFF\u0005\uFEFE\u54A0\u6FE4" + - "\uFEFE\u549F\uFEFE\uFEFE\u6FE2\uFEFE\u5494\uFEFE\u5499\uFEFE\u6FE1\u6FDE\u6FE3\u5495\u6FDD\uFEFE" + - "\u5498\u5496\uFEFE\u6FE5\u5497\u549B\uFEFE\uFEFE\u549C\uFEFE\u549E\uFEFE\uFEFE\uFEFE\u549D\uFEFE" + - "\uFEFE\uFEFE\u6FDF\u6FE0\uFFFF\u0004\uFEFE\u6FE6\uFEFE\u72D7\u56DD\u7648\u72D6\u72E9\uFEFE\uFEFE" + - "\u56E3\uFEFE\u72E7\uFEFE\u56E2\u56DE\u72F0\u72E0\u72E3\uFEFE\u56E6\u72ED\u72E5\u56DF\u56E7\uFEFE" + - "\u72EA\u72E8\uFEFE\uFEFE\u72D9\u72EE\u72E2\u72DD\uFEFE\u72D3\u72EF\u72DF\u72D2\uFEFE\u56E5\u72E4" + - "\u72F1\u72E1\u72D5\u72DA\u72D1\uFEFE\u56E4\uFEFE\u72DE\u72DB\u56E0\u72D4\uFEFE\u72EC\u56E1\uFEFE" + - "\u72DC\u72D8\uFEFE\uFEFE\u72EB\uFFFF\u0006\uFEFE\u5986\u7641\uFEFE\u75FB\u764F\u7643\u7650\uFEFE" + - "\u5988\uFEFE\uFEFE\uFEFE\u764C\u7649\uFFFF\u0005\uFEFE\u764A\u764D\u7651\uFEFE\u72E6\u7653\u79CD" + - "\uFEFE\u5989\u7654\u75F9\u7646\uFEFE\u764B\uFEFE\uFEFE\u5987\u598A\u7652\u7655\u75FD\u75FA\uFEFE" + - "\uFEFE\u75FC\uFEFE\uFEFE\u7644\u7642\u598B\uFEFE\u764E\uFEFE\uFEFE\u7645\uFEFE\u7647\u75F8\u79C1" + - "\u79BF\u5BE7\u5BE5\u0000\u0003\u79C9\uC0CA\uC6BE\uCCBD\u79C4\u5BE4\u5BE3\u5BE2\u79C2\u79C7\u5BDF" + - "\u5BE6\uFEFE\u79BB\uFEFE\u79C5\u79BA\u79C3\u5BE0\u79C8\u79BC\u5BE1\u79CB\uFFFF\u0007\uFEFE\u7D77" + - "\u5E6A\u5E69\u5E6B\u0000\u0003\u7D84\u797F\u7483\u8286\u7D7E\u5E66\u7D7D\u5E6C\uFEFE\u7D76\u5E67" + - "\uFEFE\u7D85\u5E68\u7D78\u7D7B\u7D81\u7D7A\u7D75\uFFFF\u0004\uFEFE\u7D7C\u809F\u606A\u80A2\u80A1" + - "\u80A4\u80A6\uFEFE\u6068\uFEFE\u80A0\uFEFE\u809E\uFEFE\u80A7\u80A5\u80A3\uFEFE\u80A9\uFEFE\u80A8" + - "\u606C\u6067\uFEFE\u6069\u606B\uFEFE\uFEFE\u80AA\u83E1\uFEFE\uFEFE\u83E0\u83DF\uFEFE\u83E2\u83DB" + - "\uFEFE\u83DC\u83E4\u83DD\uFEFE\u626E\u83E6\uFEFE\u83E5\u83DE\uFEFE\u86DC\u63D0\u86DA\u86DF\u86DE" + - "\u83E3\uFEFE\u63CF\uFEFE\u86DD\u86D9\u86E1\u86E0\u63CE\uFEFE\u86DB\uFEFE\u626F\uFEFE\uFEFE\uFEFE" + - "\u655F\uFEFE\uFEFE\uFEFE\u896E\u8B69\u8B6A\u8B6B\u66E6\uFEFE\uFEFE\u66E7\uFEFE\u8CF0\uFEFE\u8E77" + - "\u8E76\uFEFE\uFEFE\u8F6B\u8F6C\u9046\u90B6\uFEFE\u4C6D\u4C6E\uFEFE\u4C6F\u4CB5\u4D65\u69B3\u4DF2" + - "\u4DF3\uFEFE\u4EF6\u4EF7\u4EF5\u4EF4\uFEFE\u5096\uFEFE\uFEFE\u6BB6\u5098\u5097\u6BB7\uFEFE\uFEFE" + - "\uFEFE\u5287\uFEFE\u54A1\u6FE7\uFEFE\u72F3\uFEFE\u56E8\u598D\u72F2\u598C\uFEFE\u5E6D\uFEFE\u7D87" + - "\u6270\uFEFE\u63D1\u86E2\uFEFE\u66E8\uFEFE\u67DB\u4867\u6973\uFEFE\u4D66\u6974\u4DF6\uFEFE\u4DF4" + - "\u4DF5\u4DF7\uFEFE\u4EF9\u4EF8\uFEFE\u6A7C\u4EFA\uFEFE\uFEFE\u6A7D\u6BB8\uFEFE\u6BB9\uFEFE\u5099" + - "\u509B\u509D\u509A\u509E\u509C\uFFFF\u0005\uFEFE\u528B\u5288\u528A\u528C\u5289\u6FE8\u6D9A\uFEFE" + - "\uFEFE\uFEFE\u6FEA\u6FE9\u54A7\uFEFE\u54A3\uFEFE\uFEFE\u54A4\u54A6\u54A8\u54A5\uFEFE\u54AA\u54A9" + - "\uFFFF\u0005\uFEFE\u56ED\u72F5\u72F4\u56EC\uFEFE\u56EB\u56EA\u56EE\u56E9\uFEFE\uFEFE\u765B\u7658" + - "\u598F\u7657\u765C\uFEFE\u5991\u765A\u598E\u5990\u7659\uFEFE\u79CE\uFEFE\u79CF\u79D0\uFFFF\u0004" + - "\uFEFE\u5E6E\u5E76\u7D88\u5E70\u5E74\u7D89\u5E75\u5E71\u5E72\u5E6F\u5E73\u606F\u7656\u6070\u606E" + - "\uFEFE\u606D\u83E7\u6271\u86E3\u86E4\uFEFE\uFEFE\u6650\u66E9\uFEFE\u4C70\uFEFE\u4DF8\uFFFF\u0006" + - "\uFEFE\u528D\uFEFE\u6FEB\u54AB\uFEFE\uFEFE\u56F1\u56F0\u56EF\u5992\u5993\u765D\u5E77\u6272\u4C71" + - "\u695D\u4CB6\u6975\uFEFE\uFEFE\u69B4\u4DF9\uFEFE\uFEFE\uFEFE\u509F\uFFFF\u0004\uFEFE\u79D1\uFEFE" + - "\uFEFE\u4C72\uFEFE\u4CB7\u69B5\uFEFE\uFEFE\u6A7E\uFEFE\u6A7F\uFEFE\u4EFB\uFEFE\uFEFE\uFEFE\u765E" + - "\u5994\uFEFE\u79D2\uFEFE\uFEFE\uFEFE\u63D2\u4C73\u4C88\u4CB8\u6976\u4D67\uFEFE\u4F42\u4F41\u4EFC" + - "\u4EFD\uFEFE\uFEFE\u6BBA\u50A1\u50A2\u6BBB\u50A0\uFEFE\uFEFE\u5291\u6D9B\u5290\u528E\u528F\u54AE" + - "\u54AC\uFEFE\uFEFE\u6FED\u54AD\u6FEC\uFEFE\u54A2\u72F6\uFEFE\uFEFE\u56F3\u56F4\uFEFE\uFEFE\u56F2" + - "\uFEFE\u5E78\u7D8A\u6071\u6072\uFEFE\u80AB\u63D3\u896F\u8970\uFEFE\u6789\u90B7\u694C\u4CB9\uFEFE" + - "\u4C74\uFEFE\u6978\u6977\uFFFF\u0004\uFEFE\u4DFA\u69B7\u69B8\u69B6\uFEFE\u69B9\uFFFF\u0007\uFEFE" + - "\u6A88\uFEFE\u6A83\u6A85\u6A87\u6A84\u4F46\u6A81\uFEFE\u6A82\u4F43\u4F44\u6A86\u6A89\u4F45\u6A8A" + - "\uFFFF\u0007\uFEFE\u6BC9\uFEFE\u6BC3\u6BBE\u50A4\u0000\u0003\u6BC6\uC4BD\uCACD\uC8C1\u50A6\u6BC7" + - "\u50A7\u6BC2\u6BC5\u6BBC\u6BC0\u6BCC\u50A8\uFEFE\u50A9\uFEFE\u6BBF\u6BCB\u50A3\u50A5\uFFFF\r" + - "\uFEFE\u0000\u0003\u6DAC\uA5AB\uA4A6\uA09E\uFEFE\u6DAD\u6DAA\u6D9C\uFEFE\u5293\u6DA8\u6DA9\uFEFE" + - "\u6DA7\u6D9F\u6D9D\u5292\u6DA3\u6DA1\uFEFE\uFEFE\u6DA2\u6DAE\uFFFF\b\uFEFE\u54B3\uFEFE\u54B2" + - "\uFEFE\u6FEE\u54AF\u6FF0\uFEFE\u54B4\u6FF1\uFEFE\uFEFE\u54B7\uFEFE\u54B5\u6FF2\u6DAF\u6FF4\uFEFE" + - "\u54B1\uFEFE\u54B0\uFEFE\u6FEF\u6FF3\u54B6\uFFFF\u0004\uFEFE\u56F6\u56F5\uFEFE\uFEFE\uFEFE\u72F8" + - "\u72FC\u7341\u56F7\u7344\uFEFE\u56FB\u7346\uFEFE\u56FD\uFEFE\u56F9\u5744\uFEFE\u5741\u72FA\u56F8" + - "\uFEFE\u72F9\u72F7\u7348\u72FB\uFEFE\u56FA\u7347\u5742\u7343\u7342\u5743\u72FD\u56FC\uFFFF\u0004" + - "\uFEFE\u7349\uFEFE\u7345\u766D\u7674\u7669\u5997\u7665\u7675\u765F\u7672\u7670\u766A\uFEFE\u7673" + - "\u766C\uFEFE\u7664\u7676\u7662\u766F\u7660\uFEFE\u7677\uFEFE\u5998\uFEFE\u7671\u79D5\u7663\u5995" + - "\uFEFE\u7667\uFEFE\u5996\u7666\u766B\uFEFE\uFEFE\u7668\uFEFE\uFEFE\uFEFE\u766E\uFFFF\u0004\uFEFE" + - "\u79D9\uFEFE\uFEFE\uFEFE\u79DC\u79D4\uFEFE\u79D6\uFEFE\u79DB\u79DA\u5BE8\uFEFE\u7661\u79D8\uFEFE" + - "\uFEFE\u5BE9\uFEFE\u79D3\u79D7\uFFFF\u0004\uFEFE\u7D91\uFEFE\u7D98\u7D8F\uFEFE\u0000\u0003\u7D96" + - "\u8D95\u998C\u908B\uFEFE\u5E79\uFEFE\u7D8E\u5E7A\u7D94\u7D93\u7D92\uFEFE\uFEFE\u7D97\uFFFF\u0004" + - "\uFEFE\u80AF\u80B1\u6074\u80B2\uFEFE\u80AD\uFEFE\u80AC\u80B6\uFEFE\u80B4\u6073\u80B7\u80AE\u80B3" + - "\u80B5\u80B0\uFFFF\u0004\uFEFE\u83EB\u83F0\u83EA\u83EF\uFEFE\u0000\u0003\u83E8\uF2EE\uF3ED\uE9F1" + - "\uFEFE\u83F4\u83EC\uFEFE\u86E5\u63D7\uFEFE\u63D5\uFEFE\u63D4\u63D6\uFEFE\uFEFE\u8971\uFEFE\u8AC0" + - "\u8B6C\uFEFE\uFEFE\u8CF1\u8CF2\uFEFE\u66EA\uFEFE\u8E78\uFEFE\u678A\uFEFE\u8E79\uFEFE\u8F6E\u67DD" + - "\uFEFE\u67DC\u8F6D\u6855\uFEFE\u9047\uFEFE\uFEFE\u486E\uFEFE\u4C75\u4DFB\u69BA\u6A8B\u4FD5\u5745" + - "\uFEFE\uFEFE\u4C76\u4D6A\u4D69\u4D68\uFEFE\uFEFE\u4F47\uFEFE\uFEFE\u54B8\uFEFE\u79DD\u4C77\u4C78" + - "\u4C79\u4CBA\uFEFE\uFEFE\u5294\uFEFE\u6DB0\uFEFE\uFEFE\uFEFE\u5999\u4C7A\u695E\uFEFE\uFEFE\u4D6B" + - "\u4D6C\u6979\uFEFE\u4DFC\uFEFE\uFEFE\uFEFE\u6A8C\uFEFE\u4F48\uFEFE\u6A8D\uFEFE\uFEFE\u50AF\uFEFE" + - "\uFEFE\u6BCF\u50AD\u50AC\u6BCE\u50AA\u6BD0\u50AB\u50AE\uFEFE\u5295\uFEFE\u5297\u6DB4\u6DB1\u6DB2" + - "\u6DB3\u6DB5\u5296\uFEFE\uFEFE\u6FF6\u6FF5\uFEFE\u54BA\uFEFE\u54B9\uFFFF\u0005\uFEFE\u5748\u734B" + - "\uFEFE\u5747\u5749\u5746\uFFFF\u0004\uFEFE\u599B\u734A\uFEFE\u599C\u7679\uFEFE\u599D\u7678\u599A" + - "\uFFFF\u0004\uFEFE\u79E0\u79E2\u5BEA\u79E1\u79DF\u79DE\uFEFE\uFEFE\uFEFE\u7D9C\u5E7F\u5E7D\uFEFE" + - "\u5E7E\u7D9A\u7D9B\uFEFE\u5E7B\u80BB\u80B9\uFEFE\u6076\u80BA\u6077\u6075\u5E7C\uFEFE\uFEFE\u83F7" + - "\u83F5\u83F6\u80B8\u86E7\u63D8\u86E6\u8972\u8973\u83F8\u8B6D\uFEFE\u4C7B\u4D6D\u4E41\u69BB\u4DFD" + - "\uFEFE\u50B0\u5BEB\u4873\u4CBB\u4D6E\u5298\u599E\u4874\u697A\uFEFE\u697B\uFEFE\u69BC\uFEFE\uFEFE" + - "\u4F4A\u6A91\u6A8F\u4F4B\u6A8E\u6A90\u6A92\uFEFE\u4F49\uFFFF\u0005\uFEFE\u50B4\u50B5\u50B2\uFEFE" + - "\uFEFE\u50B1\u6DB9\u50B3\uFEFE\uFEFE\uFEFE\u5299\uFEFE\u6DB8\u6DBA\u6DB7\u6DBB\u529A\u54BD\u6FF7" + - "\uFEFE\u6FF9\u54BB\u6FFA\u54BC\u6FF8\uFEFE\u6DB6\u734C\u734F\u7350\u734D\u574D\u574C\u574A\u574B" + - "\u734E\uFFFF\u0004\uFEFE\u574E\uFEFE\uFEFE\u59A0\u59A1\uFEFE\u59A2\u79E3\u79E5\u79E7\u5BED\u5BEC" + - "\u599F\u79E6\u79E4\uFEFE\u7DA0\uFEFE\uFEFE\u7D9E\u7DA4\u5E81\u7DA5\u7DA2\u5E82\u7D9F\u7D9D\u7DA3" + - "\u6079\u80BD\u7DA1\u607B\u80BE\u607A\u607D\u80BF\u6078\u607C\uFEFE\u83FD\u83FB\u83FA\u83FC\u83F9" + - "\uFEFE\uFEFE\u6652\uFEFE\u8CF3\u8CF4\uFEFE\u8E7A\u8F6F\u68A1\u4875\uFEFE\u50B6\u4F4C\uFEFE\uFEFE" + - "\u529B\uFEFE\uFEFE\uFEFE\u4C7C\u4CBC\uFEFE\u4D6F\u69BD\uFEFE\u4F4D\u6A93\uFEFE\u6DBC\u529C\uFEFE" + - "\u5E83\u4C7D\uFEFE\uFEFE\uFEFE\u4E42\uFEFE\uFEFE\u5BEE\u4C7E\u4CBD\u4CBE\uFEFE\u4D71\u4D70\uFEFE" + - "\u69BE\u4E43\uFEFE\u6A94\uFEFE\u4F4E\uFEFE\uFEFE\u6BD2\u6BD3\u6BD4\uFEFE\u50B7\u50B8\u6BD1\u50B9" + - "\uFEFE\uFEFE\uFEFE\u529D\u6DBD\uFEFE\u6FFC\u54BE\uFEFE\u6FFB\uFEFE\u574F\u7351\u5750\u7352\uFEFE" + - "\uFEFE\uFEFE\u59A3\uFEFE\uFEFE\uFEFE\u79E8\uFEFE\uFEFE\u7DA7\u7DA6\uFEFE\u5E84\uFEFE\u607E\u80C0" + - "\u6273\u8441\u63D9\uFEFE\u67DE\u9049\u4879\uFEFE\uFEFE\uFEFE\u6BD5\uFEFE\u6DBE\u5751\u767A\u5BEF" + - "\uFFFF\u0004\uFEFE\u6560\uFEFE\uFEFE\u487A\u4F50\uFEFE\u4F4F\u529E\uFEFE\u6FFD\uFEFE\u5753\u58A8" + - "\u5754\u5752\u59A4\uFEFE\u7DA8\u5E85\u607F\uFEFE\u694D\u69BF\uFEFE\u6A96\u4F51\u6A95\u4F52\uFEFE" + - "\uFEFE\u50BD\u6BD8\u6BD7\u50BC\u50BA\u50BB\u6BD6\uFEFE\uFEFE\u52A0\u6DBF\u52A3\u529F\u52A5\u52A1" + - "\u52A2\u52A4\uFEFE\uFEFE\uFEFE\u54C1\u54C0\u54BF\uFEFE\uFEFE\uFEFE\u7354\u5755\u5758\u5756\uFEFE" + - "\u7353\u575B\uFEFE\u5757\u7355\u575A\u5759\uFEFE\uFEFE\uFEFE\u767C\u767B\uFEFE\u59A7\u59A5\u59A6" + - "\u767D\u5BF0\u79EA\u5BF1\u79E9\uFEFE\uFEFE\u80C1\uFEFE\uFEFE\u6082\u7DA9\u6081\uFEFE\u5E86\uFEFE" + - "\u86E9\u8442\u63DA\u86E8\u8B6E\u8CF5\u8CF6\uFEFE\u4CBF\uFEFE\u4D72\uFEFE\uFEFE\uFEFE\u697C\uFEFE" + - "\uFEFE\u4F54\u4F56\uFEFE\u69C2\u6A99\u6A98\u6A97\uFEFE\u69C1\u69C0\u4E45\u4F55\u4F53\u4E44\uFEFE" + - "\uFEFE\uFEFE\u50BE\u6BD9\uFEFE\u50BF\u6A9E\uFEFE\u6AA0\u6A9F\u6BDA\uFEFE\uFEFE\u6A9B\uFEFE\u4F5A" + - "\u4F58\uFEFE\u6A9A\u6A9C\u6AA2\uFEFE\u4F57\uFEFE\u6A9D\u6AA6\u50C1\uFEFE\u6AA3\u4F59\uFEFE\u6AA1" + - "\u6AA4\uFEFE\u50C0\uFEFE\u50C2\u6AA5\uFFFF\b\uFEFE\u6BEE\u6BE1\u6BDF\u6BED\u6BE8\u52AA\u50C3" + - "\u6BE9\u6BEC\u52A6\u6BEB\u50C4\u50C9\u50C7\u6BE2\uFEFE\u6BDD\u6BE4\u50CE\u6BEF\u52A7\u6BE5\uFEFE" + - "\u52A8\u50CA\u6BE7\uFEFE\u6DCE\u52A9\u6BDC\u50CB\u52AB\u50CC\u50C8\u50CD\u6BE6\u6BDB\u6BEA\u50C5" + - "\uFEFE\uFEFE\u6BDE\u6BE3\u6BE0\u50C6\uFEFE\u6DC0\uFEFE\u6DC1\uFFFF\u0006\uFEFE\u6DCB\u7044\u6DCC" + - "\u52B1\u6DCF\u6DC5\u52B0\u6DC7\uFEFE\u6DC8\uFEFE\uFEFE\u6DCA\u52AC\uFEFE\uFEFE\u54C5\uFEFE\uFEFE" + - "\u6DC6\u6DC2\u54C6\uFEFE\uFEFE\u6DD0\u54C2\u7042\u6DC9\uFEFE\u7041\u6DC4\u6DCD\uFEFE\uFEFE\u52AF" + - "\u54C3\u52B5\u54C4\u6DD1\u7043\u52AE\u54C8\u52B4\u52B3\u52B2\u54C7\u6DD2\u54C9\u52AD\uFEFE\u6DC3" + - "\uFFFF\f\uFEFE\u575C\u7047\u7049\uFEFE\u704B\u54CA\u54D0\u7358\u704F\u7046\u575E\u7356\uFEFE" + - "\u54CF\u54CD\u7051\uFEFE\u7357\uFEFE\u7048\uFEFE\u54CE\u704C\u54D1\u704E\uFEFE\uFEFE\u54CC\u704D" + - "\u7050\u704A\uFEFE\u54CB\u575F\uFEFE\u7045\u575D\uFFFF\u0004\uFEFE\u5760\uFFFF\u0007\uFEFE\u735A" + - "\u7363\u59AA\uFEFE\u5762\u5767\u59AB\u7365\u576E\u767F\u735B\u5766\u5769\u5764\u7359\u7367\u736A" + - "\u768F\uFEFE\u7368\u7684\u5765\u576C\u5770\u7362\u767E\u7366\u5761\u7681\u7369\u7683\u735E\uFEFE" + - "\u59A8\uFEFE\u735C\u735D\u576B\uFEFE\uFEFE\u576A\u7360\u576F\u7364\u5768\u7361\uFEFE\u576D\u59AC" + - "\u59A9\u7682\uFEFE\u735F\uFEFE\u5763\uFFFF\t\uFEFE\u59B1\u59B5\u7686\u5BF6\u59B3\u768A\u59B7" + - "\u79EB\u768C\u5BF8\u59AF\u59B2\u768D\uFEFE\u768E\u7694\u59B9\u5BF9\uFEFE\u7690\u7695\u7689\u5C46" + - "\uFEFE\u5BFA\u59B8\u7687\u7696\uFEFE\u5C45\u59B6\u5BF3\u7693\uFEFE\u59BA\u768B\u7685\u59B0\u7688" + - "\uFEFE\u7691\uFEFE\u5BF2\u5BF7\u59AD\u7692\uFEFE\u5BF5\uFEFE\uFEFE\uFEFE\u59AE\uFEFE\uFEFE\uFEFE" + - "\u5C44\u7DAB\u79F6\uFEFE\u79EE\u7DAA\uFEFE\u79F2\u79F4\uFEFE\uFEFE\u79F1\uFEFE\u5C43\uFEFE\u79F0" + - "\u5C47\uFEFE\uFEFE\uFEFE\u7DBA\uFEFE\uFEFE\u5C42\u5E88\u79F7\u7DAC\uFEFE\uFEFE\u5BFD\u79EF\u79F3" + - "\u5E87\u5BF4\u79EC\u79ED\u5E89\u5BFC\u5C41\u5BFB\u79F5\uFEFE\uFEFE\u7DB0\u7DB1\u7DB6\u6087\u7DBD" + - "\uFEFE\u5E8F\uFEFE\u5E8E\u7DB8\uFEFE\u6086\u7DAD\u5E8D\uFEFE\u7DBC\u5E8B\u5E8C\uFEFE\u7DB9\u80D2" + - "\u6084\u59B4\uFEFE\u7DBB\u608B\u7DB3\uFEFE\u6085\uFEFE\u608A\u7DAE\u7DB2\u7DAF\u7DB5\u5E90\u6083" + - "\u5E8A\uFEFE\u80C4\u7DB7\uFEFE\u6089\uFEFE\u608C\uFEFE\u7DB4\uFEFE\u6088\u80C3\uFFFF\u0005\uFEFE" + - "\u80C8\u6277\u80C2\u844E\u80D1\u6090\uFEFE\u608E\u6275\u80CE\u80CA\u6094\uFEFE\u8445\uFEFE\uFEFE" + - "\uFEFE\u6092\u80C9\uFEFE\u8443\uFEFE\u80CD\uFEFE\u80D0\u80C7\uFEFE\u6093\uFEFE\uFEFE\u608D\u8444" + - "\u6276\u80CF\u608F\u6091\u80CC\u6095\u80CB\u80C6\u80C5\u6274\u80D3\u8447\u86EB\u6279\uFEFE\u844D" + - "\uFEFE\u844B\uFEFE\u86EC\uFEFE\u627A\u844C\uFEFE\u8449\u63DC\u86EA\uFEFE\u8446\u8448\u63DD\u627C" + - "\u63DB\u627B\u63DF\u844A\u6278\uFFFF\b\uFEFE\u897C\uFEFE\u8974\uFFFF\u0005\uFEFE\u86F2\u8975" + - "\u86EE\uFEFE\uFEFE\u6561\u86F0\u86EF\u63DE\u86ED\u86F1\u897D\u8979\u897B\uFEFE\u8976\u8977\uFEFE" + - "\u897A\u8978\u6653\uFEFE\uFEFE\u6656\u6655\u6654\u66EB\u8CF7\u66EC\u8B6F\u678B\u8E7B\u678C\u67DF" + - "\u6856\u904A\uFEFE\u904B\u904C\uFEFE\uFEFE\u91AA\u4CC0\u697D\u4D73\uFEFE\u4E47\u4E48\u4E46\uFEFE" + - "\u4E49\u4F5C\u4F5B\uFEFE\u6BF0\u50D0\u50CF\uFEFE\uFEFE\u7052\u5771\u5772\uFEFE\uFEFE\uFEFE\u59BB" + - "\u79F8\u5C48\u5C49\u79FA\u79FC\u79FB\uFEFE\u7DBF\uFEFE\u7DBE\u5E91\u7DC0\uFEFE\u80D4\u6096\uFEFE" + - "\u627D\uFEFE\u63E0\u6562\u63E1\uFEFE\u4CC1\uFEFE\uFEFE\uFEFE\u6AA7\uFEFE\uFEFE\u6BF1\u50D2\u50D1" + - "\u50D3\u52B6\u6DD3\u6DD4\uFEFE\uFEFE\u7053\u54D2\u5773\u59BC\u7697\u4CC2\uFEFE\u4C7F\u4CC3\uFEFE" + - "\u697E\u4D77\u4D76\u4D74\u4D75\uFEFE\uFEFE\uFEFE\u4E4C\u69CA\u69CC\u4E4B\u69C4\uFEFE\u69C5\uFEFE" + - "\u69CB\u69C7\u69C9\u4E4A\u69C6\u69C3\u69C8\uFFFF\u0006\uFEFE\u4F63\u4F6C\u4F6A\u6AB1\u6AAE\u6AB6" + - "\u4F68\u6AB7\uFEFE\u4F61\u6AB4\uFEFE\u4F67\u6AB0\u6AAF\u4F65\u6AB5\u4F66\u50D4\u4F60\u6AB2\uFEFE" + - "\u6AA8\u4F5D\uFEFE\u4F70\u6AAD\u6AB3\u4F62\u4F64\uFEFE\u6AA9\uFEFE\u6AAA\u6AAB\uFEFE\u4F6F\u4F69" + - "\u4F6E\u6AAC\u4F6D\u4F5F\u4F5E\u4F6B\uFFFF\u000F\uFEFE\u50E2\u6BFD\u6BF6\u50DD\u50F0\u6BF2\u6BF9" + - "\u6BFB\u6C41\u50EB\uFEFE\u6BFA\u6BF3\u50E9\u6BF7\uFEFE\u6C42\u50DA\uFEFE\u6BFC\u50E4\u50E3\u6BF5" + - "\u50D8\uFEFE\uFEFE\u50D9\uFEFE\u50D7\uFEFE\u50EF\u50E7\u50E1\u50D5\u6BF8\u50E0\u50D6\u50E8\u50F1" + - "\u6DD5\u50E5\u6BF4\u50DB\u50DE\u50DF\uFEFE\u50ED\u50EE\u50EC\u50E6\u50EA\u50DC\u52B7\uFFFF\u000E" + - "\uFEFE\u6DDB\u52C3\u52BB\u52BD\u52C2\u6DE7\u52C0\u7054\u54D3\u52C5\u6DD8\u6DE0\u52C1\u6DDF\u6DDC" + - "\u6DE4\u6DE6\u52BA\u52BE\u52C4\u54D5\u6DE1\u52BC\u52C7\u6DDA\uFEFE\uFEFE\uFEFE\u52BF\u54D4\u52B9" + - "\uFEFE\u6DD7\u6DDE\u6DD6\u6DD9\u6DDD\u7055\u52C6\uFEFE\u6DE2\u6DE3\u6DE5\u52B8\uFFFF\u0011\uFEFE" + - "\u54E3\u7061\u54E1\u54E2\u7057\u7067\uFEFE\u54D8\uFEFE\uFEFE\u736B\u7069\u7063\uFEFE\u705A\uFEFE" + - "\u706C\u705D\u54DE\u7383\u7060\u54E0\u54D7\uFEFE\u706E\u7062\u54DA\u705B\u7058\u7059\u54DB\u7068" + - "\u706F\u54DD\u705F\u705E\u54E5\u54E4\u54D6\u54DC\u54DF\u706B\uFEFE\uFEFE\u7065\u54D9\u7056\u706D" + - "\u7064\u7066\u706A\uFFFF\n\uFEFE\u736C\uFEFE\u577B\u5790\u578F\uFEFE\u5784\uFEFE\u737E\u737A" + - "\u7377\u738A\u577E\u5776\uFEFE\uFEFE\u737C\u59CC\u577A\u7385\uFEFE\u5791\u578E\u7381\u736F\uFEFE" + - "\uFEFE\u578D\u7387\u736E\u5782\u5786\u7386\uFEFE\u7378\u5787\u5781\u736D\uFEFE\u59BE\u7389\u7376" + - "\u578C\u7379\u7388\u578B\uFEFE\u7698\uFEFE\u5777\u7374\u577C\u5788\uFEFE\u5783\u737D\u7373\u7371" + - "\u7384\u5774\u5789\u5778\u59BD\u7382\u5779\uFEFE\u5775\u5785\u577F\u577D\u7375\u578A\u7372\u737F" + - "\u737B\u769A\u7699\uFFFF\u000B\uFEFE\u7370\u76AA\uFEFE\u59C0\uFEFE\u76B0\u769F\u76AD\u79FD\u59C3" + - "\u76B1\u76B4\u59C2\u76A2\u76B3\u76B2\u59C4\u769B\u59BF\u59C7\uFEFE\u59C5\u76AF\uFEFE\u76A5\u59C9" + - "\u76B6\u76AE\u76B7\u59D1\u59CF\u76AC\u76AB\uFEFE\u76A9\u76A3\u59C8\uFEFE\u59C6\u705C\u769C\uFEFE" + - "\u7A5E\u769D\u59C1\u59CE\u7A42\uFEFE\u59CA\u59CB\u769E\u76B5\u7A41\u76A6\u76A1\u59CD\u76A7\u76A4" + - "\uFEFE\uFEFE\u59D2\uFFFF\f\uFEFE\u5C58\uFEFE\uFEFE\u7A45\u7A58\u7A5D\u7A51\u5C54\u7A62\u5C51" + - "\u7A43\uFEFE\u7A44\u5C4A\u5C53\u7A4B\u5C56\u5C57\u7A4C\uFEFE\u7A59\u7A5F\u5C52\uFEFE\u5C4C\u0000" + - "\u0004\u7A4A\u4661\u4F50\u475B\u525C\u7A54\uFEFE\u5C4D\u7DC1\u5C50\u5C4E\u7A60\u7A57\u7A53\uFEFE" + - "\uFEFE\u7A48\u5E9B\u7A56\u5C55\u7A4E\uFEFE\u7A4D\uFEFE\uFEFE\uFEFE\u5C4F\u5C4B\u7DD6\u7A5A\u7A55" + - "\uFEFE\u7A49\uFFFF\u0007\uFEFE\u7DD1\uFEFE\u7DC2\u7DCD\uFEFE\u7DD4\u5E99\u59D0\u7DD2\u5E94\uFEFE" + - "\uFEFE\uFEFE\u5E93\u7DD9\uFEFE\u7DC3\u7DD0\u7DC4\u7DCF\u5E97\u7DD3\u76A8\uFEFE\uFEFE\uFEFE\u7DDA" + - "\u7DCB\u5E9A\u80E2\u6097\uFEFE\u7DD8\u7DD7\u5E9C\u80D5\u6098\u80D6\uFEFE\u7DC7\u7DC8\u7DC5\u7DCA" + - "\u7DC6\u7DDB\u5E96\u6099\u5E98\u5E9D\uFEFE\u7DC9\uFEFE\u7DD5\uFEFE\uFEFE\u7DCE\uFEFE\uFEFE\u80D9" + - "\uFEFE\u5E92\u609C\u8455\u80DE\u80DD\u80DF\uFEFE\uFEFE\u80DC\u609D\u68CB\u60A3\u60A0\uFEFE\u60A1" + - "\u80D7\u80DA\u80E4\u60A9\u60A7\uFEFE\u80DB\u76A0\u609A\u80E1\u80D8\uFEFE\u60AA\u80E0\u5E95\u609F" + - "\u7DCC\uFEFE\uFEFE\u60A2\uFEFE\u60A6\u60A8\u60A5\u60A4\uFEFE\u609E\u80E3\u609B\u60AB\uFFFF\u0007" + - "\uFEFE\u6282\u6283\u8454\u628C\u6289\uFEFE\u627F\u6287\u8456\u6285\u627E\uFEFE\u6286\uFEFE\u8453" + - "\u63E3\u6281\uFEFE\u6288\u63E2\u8452\u8451\uFEFE\u628A\uFEFE\u628B\uFEFE\u8450\u844F\u63E4\u8459" + - "\u6284\u8457\uFFFF\u0004\uFEFE\u63E5\uFEFE\u63EA\u86F5\u86F7\uFEFE\u63E7\uFEFE\u86F8\u86F4\uFEFE" + - "\u86F6\u63E8\u63EB\uFEFE\u86F3\u63E6\u63E9\u6564\u8458\u6563\uFEFE\uFEFE\u6569\u8982\uFEFE\u6567" + - "\u6568\u8985\u8981\u6565\u897E\u6657\u8983\uFEFE\u8984\u897F\uFEFE\u6566\u8B70\uFEFE\u8B73\uFEFE" + - "\uFEFE\u8B74\u8B72\u8B75\u6658\u8B71\uFEFE\uFEFE\u8CFB\u66EE\u8CFA\u8CF9\u8CF8\u66ED\u66EF\uFEFE" + - "\u8E7C\u678E\u678D\uFEFE\uFEFE\u8F71\u8F70\u8F73\u6857\u67E0\u904E\u8F72\uFEFE\uFEFE\u904D\u6859" + - "\u6858\u687F\u90B8\u9141\u4CC4\uFEFE\uFEFE\u76B8\u845A\u4882\uFEFE\u4E4D\u6AB8\u4F73\u4F71\uFEFE" + - "\u4F72\uFEFE\u6C43\u50F2\u52C8\uFEFE\u6DE8\uFEFE\u6DE9\uFEFE\u52C9\u7071\uFEFE\u54E6\u54E7\u7070" + - "\uFFFF\u0004\uFEFE\u5798\uFEFE\u5794\uFEFE\u738B\u579B\u579A\u5793\u5796\u5799\u5795\uFEFE\uFEFE" + - "\u76BC\u5792\u59D3\uFEFE\uFEFE\uFEFE\u59D5\u59D6\u76BB\u76BE\u59D4\u76B9\u76BD\uFEFE\u76BA\uFEFE" + - "\u5C59\uFEFE\uFEFE\u7A63\uFEFE\uFEFE\u5E9E\u7DDC\u628D\u60AC\u80E5\u60AD\u60AE\u80E7\u80E6\u80E8" + - "\u845C\uFEFE\uFEFE\u845B\u86FA\u86F9\u63EC\u63ED\u8B76\uFEFE\uFEFE\u4CC5\uFFFF\u0004\uFEFE\u76BF" + - "\uFEFE\uFEFE\uFEFE\u59D8\u59D7\u7A64\uFEFE\u8986\u678F\u904F\u4CC6\uFEFE\u54E8\uFEFE\u579D\u579C" + - "\u76C0\u76C1\u5C5A\u7DDD\u5E9F\u845D\uFEFE\u4CC7\u4D78\uFEFE\u50F3\u6C44\uFEFE\u6DEA\u52CA\u579E" + - "\uFEFE\u76C2\u59D9\u5C5B\uFEFE\u80E9\u80EA\uFEFE\uFEFE\u86FB\u656A\u9142\u4CC8\uFEFE\u6C45\u50F4" + - "\u52CB\uFEFE\u6DEB\uFEFE\u54E9\u7075\u7073\u7074\u54EA\u7072\uFFFF\u0004\uFEFE\u57A0\u57A1\u738C" + - "\u57A2\u579F\u76C3\uFEFE\u76C4\u7A65\uFEFE\uFEFE\u5EA1\u5EA0\uFEFE\uFEFE\u86FC\u8987\uFEFE\u8B78" + - "\u8B77\u8CFC\u4887\u695F\u52CC\uFEFE\uFEFE\u4CC9\u4D79\uFEFE\u4E4F\u4E4E\uFEFE\uFEFE\u4E50\u4E51" + - "\u69CE\u69CD\u6AB9\u4F74\u6ABC\u6ABB\u6ABA\u6ABD\uFFFF\u0004\uFEFE\u50F5\u6C4B\u6C47\u6C50\uFEFE" + - "\uFEFE\u50FC\uFEFE\u50FA\u6C4C\u6C48\u6C4F\u50F9\u5143\u6C4A\u6C46\u5142\u6C4D\u50F8\u6C4E\u50FB" + - "\u50FD\u6C52\u6C51\u6C49\u50F7\u50F6\u5141\uFFFF\u0006\uFEFE\u6DF0\u6DF6\uFEFE\u52D2\u52CF\u6DED" + - "\u6DF2\uFEFE\u52D5\u52CD\u6DF1\u52D0\u52D3\uFEFE\uFEFE\u6DF4\uFEFE\u52CE\u6DF9\u52D1\uFEFE\u52D4" + - "\u6DEE\u6DF3\u6DF7\u6DEF\u6DEC\uFEFE\uFEFE\u6DF8\u6DF5\uFFFF\u0006\uFEFE\u54F2\u54EB\u54EE\uFEFE" + - "\u54F1\uFEFE\u7078\uFEFE\u54EC\u7076\uFEFE\u54F0\uFEFE\uFEFE\u54ED\uFEFE\u7079\u54EF\uFFFF\u0006" + - "\uFEFE\u7390\u57A4\u738F\u7391\u57A3\u57A8\u7077\uFEFE\u738E\u7392\uFEFE\u57A5\u738D\u57A7\uFEFE" + - "\u57A6\uFEFE\u76CB\uFEFE\u76C6\uFEFE\u59DA\u59DE\u59DB\u76C9\u76CC\uFEFE\u59DC\uFEFE\u59DD\u59E2" + - "\u7A6E\u76CA\u59E0\u76C7\u76C5\uFEFE\u59E1\uFEFE\u76C8\uFEFE\uFEFE\uFEFE\u5C61\uFEFE\u7A66\u5C5E" + - "\u5C5F\u5C5D\u7A6B\u7A6A\u7A67\u5C63\uFEFE\uFEFE\u7A69\u59DF\uFEFE\uFEFE\u7A6D\u7A68\u5C60\u5C5C" + - "\u5C62\u7A6C\uFEFE\uFEFE\uFEFE\u5EA4\uFEFE\u7DE0\u7DDF\u7DDE\u5EA2\uFFFF\u0005\uFEFE\u5EA3\u80ED" + - "\u80F0\u60B0\uFEFE\uFEFE\u60AF\u80F1\u80EC\u60B2\u80EE\uFEFE\u60B1\u80EB\uFEFE\u80EF\u6293\u6290" + - "\u8466\u8465\uFEFE\u8464\u845F\uFEFE\u8460\uFEFE\uFEFE\uFEFE\u6291\uFEFE\u628E\u6292\u845E\u628F" + - "\u8461\u8462\u8467\uFEFE\uFEFE\u8463\uFEFE\uFEFE\u86FD\uFEFE\uFEFE\uFEFE\u63EF\uFEFE\u898A\u63EE" + - "\u8988\u8989\u656B\u665A\u8B79\uFEFE\u6659\uFEFE\uFEFE\u8D41\u8D42\uFEFE\u66F0\uFEFE\u8CFD\u6790" + - "\uFEFE\u9050\u685A\u90B9\u90BA\uFEFE\u4CCA\uFEFE\u4E52\u4E53\u4F75\uFEFE\u6C53\u52D6\u54F3\u57A9" + - "\uFEFE\uFEFE\u56B6\uFEFE\u59E3\u59E4\u5952\u76CD\uFEFE\u5C64\u7DE2\u7DE1\uFEFE\uFEFE\u4CCB\u4E54" + - "\u6C54\u5145\uFEFE\u5144\uFEFE\u6DFA\u6DFB\uFEFE\u707A\u707B\u54F4\u54F5\uFEFE\u54F6\u7393\uFEFE" + - "\uFEFE\u57AB\uFEFE\u59E6\uFEFE\u59E5\u7A6F\u7BC2\u7DE3\u8468\uFEFE\uFEFE\u656C\u66F1\u4CCC\uFEFE" + - "\u4D7C\u4D7D\u4D7B\u4D7E\u4D7A\uFEFE\uFEFE\u4E57\uFEFE\u69D6\u4E56\u4E58\uFEFE\uFEFE\u69D1\u69D0" + - "\u69D3\u69D2\u69D5\u4E55\u69CF\u69D4\uFFFF\u0005\uFEFE\u6ABE\u4F7F\u6ABF\u6AC3\u4F7E\uFEFE\u6AC7" + - "\u6AC2\u6AC5\uFFFE\u0004\u4F77\uFEFE\u4F82\uFEFE\u6AC1\u4F7C\u4F83\uFEFE\u6AC0\u6AC6\uFEFE\u4F7B" + - "\u6AC4\u4F7D\u4F76\u4F81\uFFFF\t\uFEFE\u515A\uFEFE\u6C56\u5146\uFEFE\u5150\u5151\u5149\u515B" + - "\u514B\u6C5E\u5156\u6C59\u514C\u6C68\u6C69\u6C61\u6C5A\u5159\u6C66\u5154\u5152\uFEFE\u6C67\uFEFE" + - "\u6C65\u6C5D\u6C55\u6C5C\u514D\uFEFE\u5153\uFEFE\u5147\u6C60\u6C5F\u6C57\uFEFE\u5155\u6C63\u6C58" + - "\u5158\u6C6A\u5148\uFEFE\u514F\u6C5B\u6C64\u5157\uFEFE\u514A\u514E\uFEFE\u6C62\uFFFF\u000E\uFEFE" + - "\u6E5E\u52DE\u52EB\uFEFE\u6E59\u6E4F\u52E4\u6E4D\u52DD\u6E48\u52E7\u6E55\u6E42\u6E44\uFFFF\u0004" + - "\uFEFE\u6E47\u6DFC\u6E54\u6E64\u52E2\u6E49\u6E5B\uFEFE\u0000\u0003\u6E41\u6263\u665D\u4E56\u52E8" + - "\u52DB\u52E3\u52EF\u52D8\u52DA\uFEFE\uFEFE\uFEFE\u6E46\u52EC\u52E5\u6E60\u6E43\u52EE\u52E9\u6E4C" + - "\uFEFE\uFEFE\u52ED\u6E53\u6E4B\u52E6\u6E5F\u6E57\uFEFE\u52E0\u6E65\u6E4A\u52DC\u6E5C\u6E52\u52E1" + - "\u6E58\u52D9\u6DFD\u52EA\u5548\u52DF\u6E51\u6E50\u6E45\uFEFE\u6E61\uFEFE\u6E5A\uFEFE\uFEFE\u52D7" + - "\uFFFF\u0012\uFEFE\u7090\u554F\u7091\uFEFE\u7085\u5544\u5550\uFEFE\u707D\uFEFE\u7087\u708F\uFEFE" + - "\u707C\u7098\u54F7\uFEFE\uFEFE\uFEFE\u7097\u7092\uFEFE\u7093\u5542\u554D\u7089\uFEFE\u708A\u7094" + - "\u708B\uFEFE\u7086\u707F\u7081\u708E\u7088\uFEFE\uFEFE\u54F8\u54FC\u7096\u7082\u554B\u5547\uFEFE" + - "\uFEFE\u554A\u5551\u54FD\u554C\u708D\u554E\u54FA\uFEFE\u54F9\u707E\uFEFE\u7083\u5545\u7095\u708C" + - "\u7084\u5549\u5546\uFEFE\u54FB\u5541\uFFFF\u0016\uFEFE\u73A8\uFEFE\u7398\u7399\u739D\uFEFE\u73AC" + - "\u73A9\uFEFE\u73A2\u73A1\u57B2\u73A5\u73B4\u7394\uFEFE\u73B5\u73A7\u73B9\u73AD\u57B1\u73AB\u57AC" + - "\u57C1\u57B7\uFEFE\u57BB\u57BA\u7395\uFEFE\u73B2\u73B8\u73B0\u73B7\uFEFE\uFEFE\u73A4\u7396\u73B6" + - "\u73A6\u57AF\u57BC\uFEFE\u73AF\u57B5\uFEFE\uFEFE\uFEFE\u73AE\u7397\u57BD\uFEFE\u57BF\u73B1\u57C0" + - "\u57AE\u739E\u73B3\uFEFE\uFEFE\u57B4\u57BE\u73A0\u73AA\u739B\u739F\u57B9\u739A\u57AD\u57B6\u57B3" + - "\u73A3\u5543\u76E4\u57B0\uFFFF\u000E\uFEFE\u57B8\uFEFE\u76E7\u76FD\u76F2\u59FA\uFEFE\u59F5\u76E1" + - "\u59F6\u76F1\uFEFE\u76EA\u76F7\u59F2\u76CF\u76F9\u59E8\u76D7\u59EB\u59EA\uFEFE\u59FB\uFEFE\u76D1" + - "\u76F3\u76F4\u59ED\u59E9\u76DF\uFEFE\u59F4\u76DA\uFEFE\u76F5\u59F0\u76ED\u76FA\u76D4\u76D9\u76D3" + - "\uFEFE\u59EF\u76E6\u7A86\u76D5\u59F3\u76DE\u76F6\u59EE\u76DB\u76D8\u76E9\u59F1\u59E7\u59FD\u76EC" + - "\u76EB\uFFFF\u0006\uFEFE\u76D0\u59EC\u76F8\u76E0\u76E2\uFEFE\u76EF\u76EE\u76CE\u59F7\u59F9\u76D6" + - "\u76DD\u76E5\u59F8\u76DC\u76E8\u76FB\uFEFE\u76F0\uFFFF\u0006\uFEFE\u91C6\uFFFF\u0006\uFEFE\u76FC" + - "\uFFFF\u0004\uFEFE\u76D2\uFFFF\u0004\uFEFE\u7A9A\u5C6C\uFEFE\u7A98\u7A83\u7A88\u7A81\uFEFE\u7A94" + - "\u7A72\u7A79\uFEFE\u7A92\u7A9C\u7A84\uFEFE\u7A76\u7A8A\u7A8F\u7A7A\uFEFE\u7A8C\u7A77\uFEFE\uFEFE" + - "\u7A7E\u7A7F\u5C6E\u7A93\u7A91\uFEFE\u7A73\u7A96\uFEFE\u7A97\u7A99\u5C72\u5C6A\uFEFE\u739C\u7A7B" + - "\u7A8E\u7A7C\u5C67\u5C77\u7A95\u5C75\u5C71\u7A71\u5C69\uFEFE\u7A74\u5C76\uFEFE\u7A85\u7A70\uFEFE" + - "\u5C6F\u7A89\u7A78\u5C70\u7A82\u5C66\u59FC\u7A8B\u76E3\u7A75\uFEFE\uFEFE\u7A90\u5C6B\u7A8D\u5C68" + - "\u7A87\u5C73\u7A7D\u7A9B\uFFFF\u0006\uFEFE\u5C6D\u7B4E\uFEFE\uFEFE\u5C74\uFFFF\u0006\uFEFE\u7DF1" + - "\u7DEF\uFEFE\u7E48\u7DED\uFEFE\u7E42\u5C65\u5EA7\u7DE9\u7E47\uFEFE\u7DEE\u7DFC\u5EAC\u5EA5\uFEFE" + - "\u7E45\uFEFE\u7DE7\u7E44\uFEFE\u5EB7\u7DF8\u7E4B\u5EB5\u7DF0\u5EA6\u7DF2\u7E43\u5EAF\u7DEB\u5EB3" + - "\u5EA9\u7DF4\u7DEA\u7DE4\uFEFE\u7E41\u5EB0\u7E4A\u7DE5\u5EAD\uFEFE\u7DFA\uFEFE\u5EAE\u7DEC\u7DF7" + - "\u7DF3\u7DF5\uFEFE\u5EA8\u7E49\u5EB6\u7DF6\uFEFE\u7E4C\uFEFE\uFEFE\u7DE6\u7DFB\u5EAB\u5EB4\u5EB2" + - "\u7DE8\u7DFD\u5EB1\uFEFE\uFEFE\u5EAA\u7DF9\uFFFF\u0004\uFEFE\u7E46\uFFFF\b\uFEFE\u80FD\uFEFE" + - "\u80F9\u80F5\u814C\u8149\u60B5\uFEFE\uFEFE\u8150\u80FC\u60C0\u8146\uFEFE\uFEFE\u80F8\u8145\u60BD" + - "\u8159\uFEFE\u8156\u8148\u80F6\uFEFE\uFEFE\u814D\u814F\u60B9\u8143\u80FB\u80F2\u60B6\u60BE\uFEFE" + - "\u8152\u60BF\u80F3\u8158\u814B\u8151\u60BC\uFEFE\uFEFE\u814E\uFEFE\u8155\uFEFE\u60C1\uFEFE\u60BB" + - "\u8147\u80F7\u815A\u80F4\u8153\u60B8\uFEFE\u8141\uFEFE\u8142\u60B7\u60B4\u80FA\u60BA\uFEFE\u60B3" + - "\uFEFE\u8154\u8157\u8144\u8475\uFFFF\t\uFEFE\u846D\uFEFE\u8469\u62A0\uFEFE\uFEFE\u6295\u629A" + - "\u6296\u8477\u8483\u6294\u846F\u8478\u814A\u8479\uFEFE\uFEFE\u629B\uFEFE\u8489\u629F\u62A2\u846B" + - "\uFEFE\u629E\uFEFE\u8487\u8488\u847D\u847C\u8474\uFEFE\uFEFE\u847E\u8486\u8485\uFEFE\u6299\u6297" + - "\u8476\u8473\uFEFE\u8470\u8484\u62A1\u8482\u629D\u629C\uFEFE\u847B\uFEFE\u846A\u846C\u846E\u8481" + - "\u847A\u6298\uFEFE\u8471\uFEFE\u847F\uFFFF\u0006\uFEFE\u8472\uFFFF\u0007\uFEFE\u63F7\u8752\u63F0" + - "\u8743\uFEFE\u874E\u63F2\u8755\uFEFE\u874A\uFEFE\u8745\uFEFE\uFEFE\u8756\u8741\u874C\uFEFE\u63F9" + - "\u8751\u8757\u874B\u63F1\u874D\u8742\u63F8\uFEFE\uFEFE\u8754\u8747\u63F4\uFEFE\u8749\u8746\u63FA" + - "\u8748\u63F3\u63F6\u8750\u8744\u8753\uFEFE\u874F\uFEFE\uFEFE\uFEFE\u656E\u8995\u6573\u6574\uFEFE" + - "\uFEFE\uFEFE\u656D\u8994\uFEFE\u8991\u8992\u6571\u898C\u8990\u6570\uFEFE\u898D\uFFFF\u0004\uFEFE" + - "\u6572\u656F\uFEFE\u898B\u898F\u8993\uFEFE\uFEFE\uFEFE\u8B7F\u8B7C\u8B86\uFEFE\u8B85\u8B83\u8B7D" + - "\uFEFE\u665E\uFFFF\u0005\uFEFE\u8B7E\u665D\u63F5\u8B82\u665C\u8B87\u8B81\u8B7B\u898E\uFEFE\uFEFE" + - "\uFEFE\u665B\uFEFE\u8B7A\u8D46\uFEFE\u8D45\u8B84\u66F2\uFEFE\u8D49\u8D4A\u8D44\u8D48\uFEFE\u8D43" + - "\uFFFF\u0004\uFEFE\u8E81\u8D47\u6793\u6791\u8E7E\uFEFE\uFEFE\uFEFE\u8E82\uFEFE\u8E7D\u8E7F\u6792" + - "\uFEFE\uFEFE\uFEFE\u8F75\u8F76\u67E1\u8F74\uFEFE\uFEFE\uFEFE\u9053\u685B\u9051\u9052\u90BB\uFEFE" + - "\uFEFE\u68A2\u9145\u9143\u9144\u9146\uFEFE\uFEFE\uFEFE\u91AB\uFEFE\u4CCD\u4E59\uFEFE\u515C\uFEFE" + - "\u6C6B\uFEFE\uFEFE\u6E67\uFEFE\uFEFE\uFEFE\u7099\u709B\uFEFE\u709A\uFEFE\u709C\u57C2\u73BB\u709D" + - "\uFEFE\u73BA\u73BC\u73BD\u7741\u5A42\u7742\u7744\u5A43\u5A41\u7743\uFEFE\u7AA2\u7AA0\u7A9F\uFEFE" + - "\u7A9E\u7A9D\u5C78\u7AA1\u5EB8\u7E4D\u7E4F\u5EB9\u7E4E\u60C3\uFEFE\u60C2\u815B\uFEFE\uFEFE\u848B" + - "\u848A\u848C\uFEFE\uFEFE\u62A3\uFEFE\u8758\u63FB\uFEFE\u8996\u6575\u8B88\u67E2\u4CCE\u4D7F\u4E5A" + - "\u4F84\u515D\u515E\uFEFE\uFEFE\u52F0\uFEFE\uFEFE\u709E\uFFFF\u0004\uFEFE\u5C79\uFEFE\uFEFE\uFEFE" + - "\u81DA\u62A4\u6576\u4CCF\uFEFE\u4E5B\uFEFE\uFEFE\u6C6D\u515F\u6C6C\uFEFE\u6E68\u52F1\u6E69\uFEFE" + - "\u52F2\uFEFE\u70A0\u5553\u5552\uFEFE\u73C2\u73C0\u73C1\u73BF\uFEFE\u73BE\uFEFE\uFEFE\u7745\u7748" + - "\u5A45\u7746\u5A44\u7747\uFEFE\u7AA3\uFEFE\uFEFE\u7E50\u7E51\u7E52\uFEFE\u815E\u815D\u60C4\u815C" + - "\u815F\u848D\uFEFE\uFEFE\u848E\u848F\uFEFE\u8759\u63FC\u6577\u8B89\uFEFE\u6794\u6960\uFEFE\u52F3" + - "\u6E6A\u5554\uFEFE\uFEFE\u57C3\uFEFE\u5A46\u7749\uFEFE\u5C7B\u5C7A\uFEFE\uFEFE\u7E53\u7E54\u60C5" + - "\u60C6\u8491\u8490\u8997\u9054\u4CD0\u6961\u4D81\uFEFE\u4F85\u6AC8\uFEFE\u52F4\u5C7C\u4CD1\uFEFE" + - "\u6E6B\u52F5\u6E6C\uFEFE\u63FD\u4CD2\uFEFE\uFEFE\u6C6E\uFEFE\u6E6D\uFEFE\u70A5\u70A4\u70A2\uFEFE" + - "\u70A1\u70A6\u70A3\uFEFE\uFEFE\u57C4\u57C5\uFEFE\uFEFE\u5A47\u774A\uFEFE\u774B\u774C\uFEFE\uFEFE" + - "\uFEFE\u7AA8\u7AA9\u7AA7\uFEFE\u7AA5\u7AA6\u5C7D\u7E55\u8162\u8161\u8160\u8163\u8493\u8492\u62A5" + - "\u8494\uFEFE\u6441\u875A\uFEFE\u8998\u8B8A\u8F77\uFEFE\u4CD3\u4D83\u4D82\uFEFE\u5160\u6962\u697F" + - "\u4E5C\uFEFE\u69D7\u6AC9\u6ACA\u5161\uFEFE\u6C6F\uFEFE\u52F6\u6E6E\u6E6F\uFEFE\u5555\u5559\u70A7" + - "\u5558\u5556\u5557\uFEFE\u73C3\u57C6\u5A4A\uFEFE\u5A48\u5A49\u774D\uFEFE\uFEFE\u5EBA\u4CD4\uFEFE" + - "\u6981\uFEFE\u4D84\uFEFE\uFEFE\u6984\uFEFE\uFEFE\u4D87\u6983\u4D86\u4D85\u4F86\u6982\uFEFE\uFEFE" + - "\u69D8\uFEFE\uFEFE\uFEFE\u69DC\u69DE\u69DF\u4E66\u4E67\u69DB\u4E62\uFEFE\u69D9\uFEFE\u69DD\u4E63" + - "\uFEFE\u4E5E\uFEFE\u4E5F\uFEFE\u4E65\u69DA\u4E5D\u4F87\u4E60\u4E61\u4E64\uFEFE\uFEFE\uFEFE\u6ADB" + - "\u6AD9\u6ACC\u4F93\u6AD3\u4F8E\u6ACD\uFEFE\u6AD5\uFEFE\u6AD2\u4F91\u6AD1\u4F98\u6ADA\u4F9A\uFEFE" + - "\u4F9C\uFEFE\u6ACB\uFEFE\u4F8F\u6ADC\uFEFE\u4F96\u4F99\uFEFE\u6C87\u4F89\u4FA0\u4F97\u6ACE\u4F8C" + - "\u4F9B\u6AD6\u4F8A\u4F8B\u6C85\u6ACF\u4F92\u4F9D\u6ADD\u6AD0\u4F90\uFEFE\u4F95\u6C70\u4F9E\u6AD7" + - "\u4F94\uFEFE\u4F9F\u4F88\u6AD4\u4F8D\u6AD8\u6C86\uFFFF\r\uFEFE\u516D\u517D\u6C77\u5174\uFEFE" + - "\u6C8D\u5165\uFEFE\u5168\u6C84\uFEFE\u6C75\u6C79\u5170\u5172\u6C7C\u5179\u516B\u5169\u516A\u5178" + - "\u6C89\u5173\u6C7B\u6C7D\u5171\u5176\u6C7E\u6C8C\uFEFE\u52F7\u517C\uFEFE\u5166\u6C8B\uFEFE\u6C8F" + - "\u6C7A\u6C91\u6C82\u516F\u6C76\u516E\u5181\u5175\uFEFE\u6C74\u6E78\u517B\u517F\u6C83\u6C88\uFEFE" + - "\u5182\u517A\u516C\u5162\uFEFE\u5167\uFEFE\u6C78\u5163\u6C90\uFEFE\u6C72\u6C71\u6C7F\u6C73\u517E" + - "\u555A\u5177\u6C81\u5164\uFEFE\u5349\uFEFE\uFEFE\uFEFE\u6C8E\uFFFF\u0006\uFEFE\u6E7F\u6E83\uFEFE" + - "\u6E86\u6E7A\uFEFE\uFEFE\u6E89\u6E8C\u6E8E\u6E77\u52F8\u52FD\u70AC\u5350\u6E87\u6E8F\u6E7E\u6E76" + - "\uFEFE\uFEFE\uFEFE\u70C7\u5343\u6E84\u6E7B\u6E7D\u5348\uFEFE\u6E81\u5342\u6E73\u6E8A\uFEFE\u6E8D" + - "\uFEFE\uFEFE\u52FC\uFEFE\u534B\u6E70\u534D\u52FA\u5351\u6E8B\u6E72\u534E\u70C1\u6C8A\u5341\u52F9" + - "\u6E79\u6E71\u534F\u5347\u6E85\u534C\u534A\u6E7C\u5344\u6E74\u5345\u5346\u6E75\u6E88\u52FB\u6E82" + - "\uFFFF\u0015\uFEFE\u70AF\u5562\u5567\uFEFE\uFEFE\uFEFE\u0000\u0003\u70B8\uBEBA\uADB0\uA9AA\u556E" + - "\u555F\u70B9\u70C2\u5569\u555B\uFEFE\u5564\u70B1\u5566\u70B2\u70BC\uFEFE\uFEFE\uFEFE\u5568\u70CB" + - "\u70AB\u5561\u5560\u556C\u0000\u0003\u70A8\uC9BD\uCAC4\uB6C5\uFEFE\u70BF\u70C8\u70C6\u556D\u70B7" + - "\u555E\u555D\u5565\u556B\u70C3\u556A\u70B4\u57C7\uFEFE\u70CC\u70B3\u70AE\u5563\u556F\u555C\uFEFE" + - "\u70BB\u70C0\uFFFF\u0011\uFEFE\u57E9\u73C5\u73C9\uFEFE\u57D6\u57D4\uFEFE\uFEFE\u57CB\u73C7\u73C6" + - "\u57DF\uFEFE\u73CC\u57D9\uFEFE\u73DE\u73EA\u57C8\u73DB\u73D4\u57EB\u73C4\uFEFE\u73E0\uFEFE\u57E8" + - "\u57DC\u57E7\u57D2\u73D0\u73E2\u73DA\u57D3\u57CD\u73E8\uFEFE\u73E1\u73E3\u57D5\u57DD\u73E5\u73CE" + - "\u73DF\u73D3\u73E7\u57E2\u57CA\u57E0\u73D8\u73D6\u73D7\u57D7\u73D2\u73D1\u57CC\u73CB\u73E9\u57CE" + - "\u73D5\u57EC\uFEFE\u57E6\u73CA\u57E3\u57E1\u57EA\u73DC\u57E5\u70B5\u73DD\u57E4\u73E4\u57C9\u73D9" + - "\u57DB\u73CD\u57DA\uFEFE\u57D8\u57D0\u57CF\u774E\u73E6\uFEFE\uFEFE\u73CF\uFEFE\uFEFE\u7763\uFEFE" + - "\u57D1\uFFFF\u0013\uFEFE\u5A67\u57DE\u5A55\u775D\u5A63\uFEFE\u7751\u5A52\u5A4E\u776F\u5A54\u5A58" + - "\u5A53\u5A5C\u7773\u776A\uFEFE\uFEFE\u7758\u5A61\u5A5B\u7764\u5A4B\u7770\u7769\u5A4F\u775E\u5A5E" + - "\u777B\u777C\uFEFE\u5A4C\u776E\u5A60\u7762\u7754\u7755\u5A64\u7759\u7760\u775A\uFEFE\u5A62\u5A6A" + - "\u7756\u774F\u7750\uFEFE\u7752\u5A51\u775F\uFEFE\u5A5F\u5A68\uFEFE\uFEFE\u7761\u7779\u7771\u5A4D" + - "\u7777\u5A59\uFEFE\u5A57\uFEFE\u777D\u5A56\u7767\u775B\u7765\u5A6D\u776B\u7768\u7757\u5A69\u7775" + - "\u7772\u777A\u5A50\u7766\u5A6C\uFEFE\u776D\uFEFE\uFEFE\u5A5A\u5A5D\uFEFE\u776C\u5A6B\u775C\u73C8" + - "\uFEFE\uFEFE\u7776\u7774\u7778\uFFFF\u000E\uFEFE\u7753\u5A66\uFEFE\uFEFE\uFEFE\u7AC8\u7AC7\u7AAD" + - "\u5C84\uFEFE\u7AC6\u7AB0\u7AB1\uFEFE\u5C8E\u7ACF\u5C89\u7AC5\uFEFE\u7AAA\u5C8F\u5C85\u7AB9\u7AAF" + - "\u7AB2\u7ACA\u5C7E\u7AD1\u7AC9\u5C88\u7ABE\u5C93\uFEFE\uFEFE\u5C92\u5C8C\uFEFE\uFEFE\u7AD0\u5C7F" + - "\u7ABC\u7AB3\u7AC0\u7ACC\u5C94\uFEFE\u5C82\u7ABB\u91C7\u7AB4\u5C8B\uFEFE\u5C8A\u7AB7\u7AC1\u7ACB" + - "\u7AAE\u7AB8\u5C83\u7AC2\u5C90\u5C87\u7AB5\u5C86\u7AAC\u7ABA\u7ACE\u5A65\u5ED6\u7ABD\u7E56\u7ABF" + - "\u7ACD\u5C8D\u7AB6\u5C81\u5C91\u60D8\u7AAB\uFEFE\u7AC4\uFEFE\uFEFE\uFEFE\u7AC3\uFFFF\u000E\uFEFE" + - "\u7E72\u5ED3\u7E67\u7E6C\u5EC8\uFEFE\u7E58\u5ED5\uFEFE\u5EBF\u7E57\u7E78\u5ED7\u7E5B\u7E6B\uFEFE" + - "\u7E5D\u7E7B\u7E77\u5EBD\u5EC7\u817D\u5ED4\u5EC5\u7E59\uFEFE\u7E76\u5EC9\u7E73\u7E81\u7E5F\u7E68" + - "\uFEFE\uFEFE\u7E7E\u7E74\u5EC4\uFEFE\uFEFE\u7E66\u5EBE\u5EBC\u5ECE\uFEFE\uFEFE\u7E64\u7E61\u7E62" + - "\uFEFE\u7E7A\uFEFE\u7E7F\u7E7D\u5EC2\u7E82\u5EC6\u5ECD\uFEFE\u7E5A\u8165\u7E63\uFEFE\u5EC0\u5ED2" + - "\u5ECF\u5EC3\u7E6D\u7E5E\u5ED0\u7E6F\u5ECA\u5ECC\u5EBB\uFEFE\u7E71\u7E69\u7E5C\u5ECB\u7E79\u7E7C" + - "\u7E65\u7E70\uFEFE\u5EC1\u60C7\u7E6E\u8164\uFEFE\u7E75\uFFFF\n\uFEFE\u7E60\u816E\u8178\u60CA" + - "\u8177\u8184\u60CC\u8175\uFEFE\u8179\u60D7\uFEFE\u8170\u60CF\uFEFE\u817C\u849C\u60DB\u60DA\u817E" + - "\u816D\u8189\u60D5\uFEFE\u60CB\u8182\uFEFE\u8186\u818B\u817F\u8173\u60CE\u60D1\u60D9\u60D4\uFEFE" + - "\u8176\u7E6A\uFEFE\uFEFE\u8172\u818A\u60D0\uFEFE\u60D3\u818C\u60C8\u8181\u8166\u8187\u644A\uFEFE" + - "\u8174\uFEFE\u60C9\u816F\u60CD\u8167\u5ED1\u816B\uFEFE\u8185\u816C\u816A\u60D2\uFEFE\u8183\uFEFE" + - "\u8169\u817B\u817A\u8188\u8171\u60D6\uFFFF\u0006\uFEFE\u849F\uFEFE\u62B2\u62A8\u84AB\u8497\u62AA" + - "\u84A3\u62B1\u62AC\u84A1\u875C\u0000\u0003\u84A7\uADA6\u95A4\uAFB1\u62A7\u84B0\u62AD\u62B3\uFEFE" + - "\u62B0\uFEFE\u84AA\u62AF\u84A5\uFEFE\u8499\u849E\uFEFE\u84A9\u62AE\u62AB\u62A6\u62A9\u849D\uFEFE" + - "\u8168\u8498\u849B\u84AC\u84A0\u8496\u875B\u84AE\u849A\u84A8\uFFFF\u0004\uFEFE\u875E\u644E\uFEFE" + - "\uFEFE\u6442\uFEFE\uFEFE\u6446\u8760\u8766\u8764\u6444\u6445\u644C\u8767\u875F\u6447\uFEFE\u8763" + - "\u8762\u8768\u644D\uFEFE\u6448\u644B\u8761\u644F\u6449\u6450\u6443\u8765\uFEFE\u875D\uFEFE\uFEFE" + - "\u89A5\uFEFE\uFEFE\u657C\u89A2\u89A4\uFEFE\u657A\u89A0\u89A1\u899C\uFEFE\uFEFE\u84A2\u899D\u657B" + - "\u8999\uFEFE\u6578\u89A6\u6579\u899A\u899B\u899F\u657E\uFEFE\u657D\uFEFE\uFEFE\u899E\u6664\u8B8E" + - "\u8B94\u6665\u8B8B\u6662\u665F\u8B96\u6663\uFEFE\u6660\u8B8D\u8B90\u8B91\u8B92\u8B95\uFEFE\u89A3" + - "\u8B8C\u6661\u8B93\u8B97\u8B8F\uFEFE\uFEFE\uFEFE\u8D4D\u66F4\u8D50\u66F5\u8D58\u8D4F\u8D4C\uFEFE" + - "\u8D4E\u8D52\u8D55\u8D54\u8D57\u8D4B\uFEFE\u66F3\u8D53\u8D56\u8D59\u8D51\u8E83\u8E84\u8E88\u8E89" + - "\uFEFE\u8E86\u8E87\u8E85\uFEFE\u6795\uFFFF\u0004\uFEFE\u67E3\u8F7B\uFEFE\uFEFE\u8F78\u8F79\u8F7A" + - "\u67E4\uFEFE\u9056\u9055\uFEFE\u90BE\u6881\u90BC\u90BF\u90BD\u9147\u68A3\u68B1\u9193\u917D\uFEFE" + - "\u9192\u91C0\u91C1\u4CD5\uFFFF\u0004\uFEFE\u4E68\u69E0\uFEFE\uFEFE\u6ADE\uFEFE\u4FA1\uFEFE\u4FA4" + - "\uFEFE\u6ADF\uFEFE\u4FA2\u4FA3\uFFFF\u0004\uFEFE\u6C9A\u6C9C\u6C97\u6C94\u6C96\uFEFE\uFEFE\uFEFE" + - "\u5186\uFEFE\uFEFE\uFEFE\u5184\uFEFE\uFEFE\u6C98\u5185\u6C95\u6C92\u5183\u6C99\uFEFE\u6C93\u5187" + - "\u6C9B\uFFFF\u0004\uFEFE\u6E91\uFEFE\u6E95\uFEFE\uFEFE\u535A\uFFFF\u0004\uFEFE\u6E98\uFEFE\u5352" + - "\u5355\u5357\u5359\u5356\u6E94\u6E93\uFEFE\u5354\u6E96\u6E97\uFEFE\u6E90\u5358\uFEFE\u5353\uFEFE" + - "\uFEFE\uFEFE\u6E92\uFFFF\u0006\uFEFE\u70DA\u70DB\u70DC\u5574\uFEFE\u5570\u70D1\uFEFE\u70D9\u70DE" + - "\u5575\uFEFE\u70CF\u70D5\u70CE\u70D8\uFEFE\uFEFE\u70D4\u5571\u5573\u70DD\uFEFE\u70CD\u70D0\u70D6" + - "\uFEFE\u70D7\u70DF\u70D3\uFEFE\u5572\uFFFF\n\uFEFE\u57F1\u73F1\uFEFE\uFEFE\u73F3\u73EF\uFEFE" + - "\u73FB\u73ED\u73FA\u57ED\u73EB\u7782\u73F5\u57F0\uFEFE\u73F6\u73F9\uFEFE\u73FD\uFEFE\u73F2\uFEFE" + - "\u73F7\uFEFE\uFEFE\u57EE\u57EF\u73FC\u73F0\u73EC\u7441\uFEFE\u73F4\uFEFE\uFEFE\u73F8\uFEFE\uFEFE" + - "\uFEFE\u73EE\uFEFE\u5A6E\u5A6F\u778C\u5A75\uFEFE\u777F\u7789\u777E\u5A72\u7787\u7785\uFEFE\u7786" + - "\u5A70\uFEFE\u778A\uFFFF\u0005\uFEFE\u7783\u7781\u5A71\u7784\u7788\uFEFE\uFEFE\uFEFE\u5A73\uFEFE" + - "\uFEFE\uFEFE\u778B\uFFFF\u0006\uFEFE\u7AD7\u7ADE\u7AE0\u7AE6\uFEFE\u5CA1\u7AD2\uFEFE\u5C99\uFEFE" + - "\u7AE1\u5C9E\u7AE7\u5C95\uFEFE\u7AE4\uFEFE\u7AD4\u7AE5\u7AD3\uFEFE\u5CA3\uFEFE\u7ADF\u5C96\u7AE8" + - "\uFEFE\u5C9B\u7AD8\u5CA0\u7AE3\u7AD6\u7ADD\u7AD9\u7AD5\u5C98\u5C9F\u5C9D\u5C9A\u5CA2\u5C97\u7ADC" + - "\uFEFE\u5C9C\uFEFE\u5A74\uFEFE\u7AE2\uFEFE\u7ADA\uFFFF\u0005\uFEFE\u7ADB\uFEFE\uFEFE\u7E8A\uFEFE" + - "\u5EDA\uFEFE\uFEFE\u7E86\u7E8C\u7E88\uFEFE\u5EDC\u7E87\u7E8B\u7E83\uFEFE\u7E85\u5EDB\uFFFF\u0004" + - "\uFEFE\u7E89\u7E84\uFEFE\u5EDD\uFEFE\u5ED8\uFEFE\uFEFE\u7E8D\uFEFE\u5ED9\u8192\u818F\u819B\u8195" + - "\u8197\u60DC\u8191\u8199\uFEFE\uFEFE\u8198\u8196\uFEFE\u819C\u60DF\u8193\u819A\uFEFE\u60DD\uFEFE" + - "\uFEFE\u818E\u8190\u60DE\u818D\u819D\uFEFE\u8194\uFEFE\uFEFE\u84B5\u62BA\uFEFE\uFEFE\u84C0\u84BE" + - "\u62B4\u84B4\u84B7\u84B8\u84B3\u62BE\u62BF\u84B2\u84C1\u84BC\u62B8\u62B5\u84BB\u84B9\uFEFE\uFEFE" + - "\u62BB\u84BD\u62B6\uFEFE\u62B7\uFEFE\u84BA\u62B9\u84B6\uFEFE\u84BF\u62BC\u84C2\u84C3\u62BD\uFEFE" + - "\uFEFE\u6452\u6459\u8769\u876F\uFEFE\u876D\u6455\u6454\u6451\u876B\uFEFE\uFEFE\uFEFE\u6457\u6456" + - "\u6453\uFEFE\u876E\u876A\u876C\uFEFE\u6458\uFEFE\uFEFE\uFEFE\u6583\u89A9\uFEFE\u657F\u6581\u89AB" + - "\u6582\u89A8\uFEFE\u89A7\u8B9B\u89AA\uFEFE\u8B9C\u6666\u8B9A\uFEFE\uFEFE\u8B99\uFEFE\u8B98\u6667" + - "\uFEFE\uFEFE\u66F6\uFEFE\uFEFE\u8D5A\u8D5B\uFFFF\u0004\uFEFE\u8E8C\u8E8B\u6796\uFEFE\u8E8A\u8F7C" + - "\u8F7D\uFEFE\uFEFE\u9057\u90C0\uFEFE\uFEFE\u9148\u91AC\u68C5\u91B6\u4CD6\uFEFE\u5188\u5189\uFEFE" + - "\uFEFE\u535B\uFFFF\u0004\uFEFE\u645A\u4CD7\uFEFE\u518A\u5576\u5CA4\u4CD8\uFEFE\u57F2\u5EDE\u6963" + - "\uFEFE\u6E99\u70E0\uFEFE\u7E8E\uFEFE\u645B\u4CD9\u518B\u6E9A\u6E9B\u778D\u5A76\uFEFE\uFEFE\u7AE9" + - "\uFEFE\uFEFE\u5CA5\u7E8F\uFEFE\uFEFE\u60E0\uFEFE\u6668\u4CDA\u778E\u4CDB\uFEFE\u4E6A\u69E1\u4E69" + - "\u4FA7\u4FA6\u4FA5\u6AE0\uFEFE\uFEFE\uFEFE\u518C\uFEFE\u518D\u6C9D\uFEFE\u6E9C\uFEFE\u6E9F\u535D" + - "\u6E9D\uFEFE\u535C\u6E9E\u535E\uFEFE\u70E3\u70E2\u70E1\u5577\uFEFE\u7443\u7444\u57F3\u7442\u7445" + - "\u5A78\u57F4\uFEFE\uFEFE\u5A77\u7792\u7791\uFEFE\u778F\u7790\uFEFE\u7793\u7AEB\u7AEA\u7AEE\uFEFE" + - "\u7AED\u7AEC\u5EDF\u7E92\uFEFE\u7E91\u5EE0\u7E90\u819E\uFEFE\u819F\u60E1\uFEFE\u84C4\u84C5\uFEFE" + - "\uFEFE\u8BA1\u6669\u8BA0\u8B9F\u8B9D\u8B9E\u6797\u8D5C\u8F7E\u9149\uFEFE\u4CDC\uFEFE\u6985\u4D88" + - "\u6986\uFEFE\uFEFE\uFEFE\u69E2\u69E3\uFFFF\u0004\uFEFE\u6AE6\uFEFE\uFEFE\u6AE2\uFEFE\u6AE1\u518E" + - "\u6AE5\u4FA9\u6AE3\u4FA8\u6AE7\u6AE4\uFEFE\uFEFE\u6CA1\u6EA0\u6C9F\u6CA6\uFEFE\u518F\uFEFE\u5192" + - "\u6CA7\u6CA3\uFEFE\u6CA4\uFEFE\u6C9E\u5191\u6CA0\u5190\u6CA5\uFEFE\u6CA2\uFEFE\uFEFE\u6EA4\u5360" + - "\u5361\uFEFE\u6EA7\u6EA1\uFEFE\u6EA6\uFEFE\u6EA2\u535F\u6EA5\u6EA3\uFFFF\u0007\uFEFE\u70E9\u70E6" + - "\uFEFE\u70E8\u557C\u557B\u5579\u70E5\u70EA\u5578\u557A\u70E7\u744D\u70E4\u70EB\uFFFF\u0005\uFEFE" + - "\u7448\u744C\uFEFE\u744B\u7795\u77A0\uFEFE\uFEFE\u744E\uFEFE\u7449\u7794\u57F8\uFEFE\uFEFE\u57F7" + - "\u7447\u744A\u57F9\uFEFE\u57F6\u57F5\u7446\u744F\uFEFE\uFEFE\uFEFE\u7797\u779E\uFEFE\u5A7A\u779D" + - "\u779A\uFEFE\u5A7C\uFEFE\uFEFE\uFEFE\u779C\uFEFE\uFEFE\u7796\u7798\u779B\u7799\u5A7B\u779F\u5A79" + - "\u5CA6\uFEFE\uFEFE\u7AF2\u7AF1\u7AEF\uFEFE\u5CA9\u5CA8\u7AF3\uFEFE\u7AF0\u7E93\u5EE1\u5CA7\uFEFE" + - "\uFEFE\uFEFE\u7AF5\u7AF4\uFEFE\u7E96\u7E94\u60E2\uFEFE\u5EE2\u7E95\u81A1\uFFFF\u0004\uFEFE\u60E3" + - "\u81A0\u81A9\u81A8\u81A6\uFEFE\u81A5\u81A2\u81A3\u81A4\u81A7\u81AA\uFEFE\uFEFE\u84CA\u84C7\u84C8" + - "\u62C0\u84C6\u84CC\u84CB\u84C9\uFEFE\u8771\u8772\u645C\uFEFE\u645D\u8770\uFEFE\u6585\u89AC\u6584" + - "\u666A\uFEFE\u666B\u66F7\u8D5E\u8D5D\u8E8D\u8F7F\u67E5\u9059\u9058\u905A\u4D89\u6EA8\u557D\u57FA" + - "\u7450\u4D8A\u6987\u4CDD\uFEFE\uFEFE\u69E4\uFEFE\uFEFE\uFEFE\u6AEC\u6AEA\u6AEB\u6AE8\u4FAA\u6AE9" + - "\uFFFF\u0005\uFEFE\u6CAF\uFEFE\u5195\u6CAD\u6CA9\u6CAC\uFEFE\u6CA8\u5197\u6CAB\uFEFE\u5194\u5193" + - "\uFEFE\u5196\u6CAE\u6CAA\uFFFF\u0004\uFEFE\u5365\u5368\u6EB0\u6EAF\u6EAE\u5362\u6EB7\u6EAD\uFEFE" + - "\u5364\u70F0\uFEFE\u6EB4\u6EB2\u5367\uFEFE\u6EAA\u6EB5\uFEFE\u6EAC\u6EB6\u6EB3\u6EAB\uFEFE\u5363" + - "\u6EB8\u6EA9\u5366\uFFFF\u0004\uFEFE\u70F5\u70EC\u70F7\uFEFE\u0000\u0003\u70EF\uFAFB\uEDF9\uF6F4" + - "\u70F8\u5584\uFEFE\u5582\uFEFE\uFEFE\u70F2\uFEFE\u70EE\uFEFE\u70F1\u70FC\u70F3\u5583\u6EB1\uFEFE" + - "\u557E\u5581\uFFFF\u0005\uFEFE\u745E\u7453\u7451\uFEFE\u7452\uFEFE\u7459\uFEFE\u745A\u7456\u5842" + - "\u745B\u7458\u7455\uFEFE\u57FD\u7454\u57FB\u5841\u7457\u745F\u557F\u57FC\u745D\u745C\u5843\uFFFF" + - "\b\uFEFE\u77A5\uFEFE\uFEFE\uFEFE\u77A6\u5A87\uFEFE\u77AC\uFEFE\uFEFE\u77AE\u77A7\u5A81\u77AB" + - "\u77AA\u5A82\u5A88\uFEFE\u5A89\u77AD\u5A7E\u77A4\u77A2\u77A8\u77A1\u5A86\u77A3\u77A9\u77AF\u5A7F" + - "\u5A85\u5A83\u5A84\uFEFE\uFEFE\uFEFE\u5A7D\uFFFF\u0004\uFEFE\u5CB0\u7AFC\u5CAF\u7B43\uFEFE\u7AF6" + - "\uFEFE\u7B44\uFEFE\uFEFE\uFEFE\u7AF7\u7AF8\uFEFE\u7B45\u7B42\u7AFD\u7B41\u7AFA\u7AF9\uFEFE\u7B46" + - "\u5CAC\uFEFE\u7AFB\uFEFE\u5CB1\u5CAB\u5CB2\u5CB3\uFEFE\u5CAE\u5CAD\uFEFE\uFEFE\u7E97\u5EE4\u5EE3" + - "\uFEFE\uFEFE\u7E9C\uFEFE\u60E4\u5EE5\uFEFE\uFEFE\u5EE7\u7E9D\u5CAA\u5EE6\u7E99\u7E9B\u7E98\uFEFE" + - "\u7E9A\uFEFE\uFEFE\uFEFE\u81B4\uFEFE\uFEFE\u81B3\u81B0\u60E7\u84CD\u60E8\u81AF\uFEFE\u60E6\uFEFE" + - "\u81B1\u81AE\u81AB\u81B2\u81AC\u81AD\u60E5\uFFFF\u0004\uFEFE\u8776\uFEFE\u84D1\uFEFE\u84D0\u84D2" + - "\uFEFE\u8773\u62C3\uFEFE\u84CE\uFEFE\u62C1\uFEFE\u62C5\u62C4\u84CF\u84D3\uFEFE\u62C2\uFEFE\u877A" + - "\u6460\u6586\u6461\u645E\u8777\u8775\uFEFE\u8778\uFEFE\u877B\u645F\u8779\u8774\uFEFE\uFEFE\u89AF" + - "\u89B2\u8BA4\u89AD\uFEFE\u8D5F\u89B3\uFEFE\u666C\u89B1\u6587\u89AE\u89B0\u89B4\u8BA5\uFEFE\u8BA3" + - "\uFFFF\u0004\uFEFE\u666D\u8BA2\uFEFE\uFEFE\uFEFE\u66F8\uFFFF\u0004\uFEFE\u6799\u8F82\u6798\u8F84" + - "\u8F81\u8F83\u685C\u90C1\u4D8B\u6CB0\u70FD\u7141\u5844\u7B47\u62C6\u666E\u67E6\u90C2\u4D8C\uFEFE" + - "\u6CB1\u46F8\uFEFE\uFEFE\u6EB9\uFEFE\u6EBA\uFFFF\u0005\uFEFE\u7142\u7143\u5845\u5846\uFEFE\uFEFE" + - "\uFEFE\u77B0\uFEFE\u7B4A\u7B49\u7B48\u7E9E\uFEFE\u7E9F\u7EA0\u5EE8\uFEFE\uFEFE\u81B6\u81B5\uFEFE" + - "\uFEFE\u84D4\u62C7\u62C8\uFEFE\u877F\u877C\u877D\u877E\u89B6\u89B5\u6588\u8BA6\u8E8E\u4D8D\uFEFE" + - "\u5369\uFEFE\u5847\u7B4B\uFEFE\u4D8E\uFEFE\u7144\u5848\uFEFE\uFEFE\u5A8A\u5A8B\uFEFE\u4D8F\u4D90" + - "\u69E5\u4FAC\u4FAB\u536A\u6EBB\u77B1\uFFFE\u0004\u4D91\uFEFE\uFEFE\uFEFE\u4FAD\u4FAE\u6AEE\u6AED" + - "\uFEFE\uFEFE\u5198\u6CB4\u6CB2\u6CB3\uFFFF\u0006\uFEFE\u6EBC\u6EBD\uFEFE\uFEFE\u536E\u536C\uFEFE" + - "\u536D\u536B\uFFFF\u0004\uFEFE\u5585\uFFFF\u0004\uFEFE\u5589\u5588\u7145\u5587\u5586\uFEFE\u7146" + - "\uFEFE\uFEFE\u584B\u7461\u7460\u5849\u584A\uFEFE\uFEFE\uFEFE\u5A8D\u5A8C\u77B3\uFEFE\uFEFE\u77B2" + - "\u584C\uFFFF\u0005\uFEFE\u5CB4\u7B4D\u5CB5\u7B4C\uFEFE\uFEFE\uFEFE\u7EA1\u81B7\u60E9\u84D5\uFEFE" + - "\uFEFE\uFEFE\u8781\uFEFE\u6670\u666F\uFEFE\uFEFE\u67E7\u4D95\u6CB5\uFEFE\uFEFE\u584D\u7EA2\u5EE9" + - "\u48A8\uFEFE\u6AEF\u6AF0\uFEFE\uFEFE\u6CB6\u519A\u519B\uFEFE\uFEFE\u5199\uFFFF\u0004\uFEFE\u5372" + - "\u5373\u5370\u5371\uFEFE\u6EBE\uFEFE\uFEFE\u6EBF\u536F\uFFFF\u0004\uFEFE\u7147\uFEFE\u558D\u558E" + - "\uFEFE\u5850\u714D\uFEFE\u5593\u5591\u714E\u7149\u5590\u558F\u558A\u714C\u714B\u7148\u5592\uFEFE" + - "\u714A\u558B\uFEFE\u558C\uFEFE\uFEFE\u5851\u7465\u7466\u5852\u7462\u7464\u7468\u7467\u7463\uFEFE" + - "\u584E\u584F\uFEFE\u77BB\u5A92\u5A91\u77B5\u5A8F\uFEFE\u77B8\u5A93\u77B9\u5A94\u77B6\u5A8E\u5A90" + - "\u77BA\uFEFE\u77B7\u77B4\uFFFF\u0005\uFEFE\u7B5A\uFEFE\u7B4F\u5CB7\u5CBA\u5CB9\u5CBE\u5CBD\u7B5B" + - "\u7B59\u7B52\u7B56\u7B55\u5CBB\u7B58\u7B54\u7B5C\u7B53\u5CBC\u5CB6\u5CB8\uFEFE\u7B51\uFFFF\u0004" + - "\uFEFE\u7EA4\u5EED\u7EA8\u5EEC\u7EA5\u5EEB\uFEFE\u7B50\u7B57\u7EA7\uFEFE\u5EEE\u7EA9\u7EA6\u7EA3" + - "\uFEFE\uFEFE\u81BA\u81BE\u81C0\u81BC\u81BB\u81B9\u60EC\u60EA\u60EF\u60F0\u81BD\u60ED\u81B8\u60EE" + - "\u5EEA\u81BF\u60EB\uFEFE\uFEFE\uFEFE\u84D7\uFEFE\u84D6\u84DE\u84D8\u84DD\u84DA\u62C9\u84DC\uFEFE" + - "\uFEFE\u62CA\uFEFE\u62CB\uFEFE\u84DB\u84D9\uFFFF\u0004\uFEFE\u6463\u8782\uFEFE\uFEFE\u6462\u8785" + - "\u8783\u8784\uFEFE\uFEFE\u6464\uFEFE\uFEFE\uFEFE\u89BA\uFEFE\u658B\u89BB\uFEFE\uFEFE\u6589\u89BC" + - "\u658A\u89B9\u89BD\uFEFE\u89B7\uFEFE\uFEFE\u6671\u8BA7\u6672\u66F9\uFEFE\u89B8\u66FA\uFEFE\uFEFE" + - "\uFEFE\u679A\u8E8F\uFEFE\u67E9\u8F85\u67E8\uFEFE\u905B\u6882\u6883\uFEFE\uFEFE\u91BC\u48A9\uFEFE" + - "\u5374\u6EC0\uFEFE\u5A95\u5A96\u4D96\u4E6B\u69E6\uFEFE\u6AF1\u4FAF\uFEFE\u519C\uFEFE\u5375\u5376" + - "\u5377\u746A\u714F\u5594\uFEFE\uFEFE\u5853\u7469\uFEFE\uFEFE\u77BD\u5A98\uFEFE\u77BC\u5A97\uFEFE" + - "\uFEFE\u7B5D\u60F1\u81C4\u81C1\u81C2\u81C3\uFFFF\u0005\uFEFE\u8786\uFEFE\u89BE\uFEFE\uFEFE\uFEFE" + - "\u8D61\u8D60\uFEFE\u8F86\u4D97\u6CB7\u5595\uFEFE\uFEFE\uFEFE\u5A99\u7B5E\uFEFE\uFEFE\u7EAA\uFEFE" + - "\u60F2\u84DF\uFEFE\u89BF\u8D62\u4D98\uFEFE\uFEFE\u519D\u537A\u6EC1\u537B\u5379\uFEFE\u5378\u7150" + - "\u5596\uFEFE\uFEFE\u5597\u5598\uFEFE\uFEFE\uFEFE\u5855\u746B\u5854\uFFFF\u0005\uFEFE\u77BE\u5856" + - "\u5A9A\u7B5F\u5CBF\u5CC0\uFEFE\u5EEF\uFEFE\u5EF0\u60F3\u62CD\u84E0\u62CC\uFEFE\u8787\u6465\uFEFE" + - "\u89C0\u8D63\u4D99\u4FB0\u6CBA\u6CB9\u519E\u6CB8\u519F\u6CBB\uFEFE\u6EC7\u537E\u537D\u6EC9\u6EC8" + - "\u5383\uFEFE\u5382\uFEFE\uFEFE\u537C\uFEFE\u6EC3\u6EC4\u6EC5\uFEFE\u5384\u6EC2\u537F\u6EC6\u5381" + - "\uFFFF\u0004\uFEFE\u7153\u7157\u7155\u7154\uFEFE\u7158\uFEFE\uFEFE\uFEFE\u7159\u715A\u7152\uFEFE" + - "\u7151\uFEFE\u559A\u559B\uFEFE\u715B\u7156\uFEFE\u7474\uFEFE\u715C\u559C\u5599\uFEFE\uFEFE\uFEFE" + - "\u746E\uFEFE\u746D\uFEFE\u746F\u7470\u7472\u7471\u7476\u585A\u5857\u585B\u746C\u585C\u7475\u5859" + - "\u7473\u5858\uFFFF\u0005\uFEFE\u77C1\u77C3\u77BF\u77C0\uFEFE\uFEFE\u77C4\u77C6\u77C7\u77C2\u77C5" + - "\u5A9B\uFEFE\uFEFE\u7B63\uFEFE\u7B68\u7B60\u7B64\uFEFE\uFEFE\u7B69\u7B65\u5CC1\u5CC9\uFEFE\u5CC4" + - "\u7B61\u7B62\u5EF4\u5CCC\u5CC5\uFEFE\u5CCA\u5CC3\u7B67\u5CCB\u7B66\u5CC7\u5CC2\u5CC8\u7B6A\u7EAF" + - "\u7EB1\uFFFF\t\uFEFE\u5CC6\uFEFE\uFEFE\u7EAC\u5EF2\u7EB2\u5EF3\u7EB0\u7EAB\u7EAE\u7EB3\u5EF1" + - "\u7EAD\uFEFE\u60F5\u81C8\u81C7\uFEFE\u60F8\u60F6\u81C5\u60F4\u81C6\uFEFE\u60F7\uFEFE\uFEFE\uFEFE" + - "\u84E8\uFEFE\u84EA\uFEFE\u84E9\u84E1\u84E5\u84E4\u84E2\u62CF\u62D0\u62CE\u84E3\u84E6\u84E7\uFEFE" + - "\u62D1\uFEFE\u646A\u878F\uFEFE\u6467\u8789\u6469\u646B\uFEFE\uFEFE\u6468\u878E\u878A\u6466\u878D" + - "\u8788\u878C\u878B\uFEFE\uFEFE\u89C2\u658E\u658F\u658C\uFEFE\u658D\uFEFE\uFEFE\u89C1\uFEFE\u8BAA" + - "\uFEFE\uFEFE\u6673\uFEFE\u8BA8\u8BA9\uFEFE\u8D64\u8D67\u8D65\u8D66\u8E90\uFEFE\uFEFE\u679B\u905C" + - "\u90C3\uFEFE\u6884\u914A\u914B\u68B2\u4D9A\u5385\uFEFE\u77C8\uFEFE\u7B6B\uFEFE\u4D9B\u4FB1\uFEFE" + - "\u51A0\uFEFE\u6ECA\u6ECB\u559D\uFEFE\uFEFE\u77C9\u5A9C\u5CCD\u646C\u8790\u8BAB\u8D68\u4D9C\uFEFE" + - "\uFEFE\uFEFE\u6CC1\u6CBC\u6CBE\u6CC0\u6CBF\u6CBD\u51A1\uFFFF\u0004\uFEFE\u5386\u6ED4\uFEFE\u6ECF" + - "\u6ECC\uFEFE\uFEFE\u6ED3\uFEFE\uFEFE\u5388\u5389\u6ED2\u6ED1\u6ED0\u6ECD\u6ECE\u6ED5\u5387\uFFFF" + - "\b\uFEFE\u55A1\uFEFE\u55A7\u55A6\u7165\u715F\u715D\uFEFE\u55A4\u747D\u559F\u7162\u7166\u7168" + - "\u7164\u715E\u55A5\u7163\u7161\u559E\u7169\u55A8\u7167\u55A2\u7160\uFEFE\u55A3\u55A0\uFFFF\n" + - "\uFEFE\u585E\uFEFE\u747E\uFEFE\uFEFE\u7477\u7479\u747B\uFEFE\u747C\u747A\u585F\uFEFE\u747F\uFEFE" + - "\u7478\uFFFF\t\uFEFE\u77CD\u5A9D\u77D5\uFEFE\u77CA\uFEFE\u77D6\uFEFE\u77CB\u77CC\uFEFE\uFEFE" + - "\u77D4\u77D3\u77D0\u585D\u5A9E\u77CE\u77D1\u5A9F\u77D2\u77CF\uFFFF\u0007\uFEFE\u7B76\uFEFE\u7B7A" + - "\u5CD4\uFEFE\u7EB9\u5CD7\u7B78\uFEFE\uFEFE\u7B75\u7B70\u7B72\u7B73\u7B6C\uFEFE\u5CD3\uFEFE\uFEFE" + - "\u5CD2\uFEFE\u5CCE\u7B6F\uFEFE\u5CD5\uFEFE\u5CD6\u7B6E\u7B71\u7B79\u5CD0\u5CD1\u7B77\u7B6D\uFEFE" + - "\uFEFE\uFEFE\u7EBB\u5EF6\u7EBD\u7B74\u7EBF\u5EFA\u7EC0\u7EBC\uFEFE\u5EF7\u7EB8\u5EF9\u7EB5\u7EBA" + - "\u7EBE\u7EB7\uFEFE\uFEFE\u5CCF\uFEFE\u7EB4\u5EF8\u7EB6\uFFFF\u0005\uFEFE\u60FB\u81CA\u6142\uFEFE" + - "\u60FD\uFEFE\uFEFE\u5EF5\uFEFE\u81D1\u81D2\u60FA\uFEFE\uFEFE\u81D0\u81D3\u60FC\u60F9\u81CC\u81C9" + - "\u81CE\u81CB\u6143\u81CD\uFEFE\uFEFE\u81CF\u6141\uFFFF\u0004\uFEFE\u62D3\u84F1\uFEFE\u0000\u0003" + - "\u84EB\uEFF5\uF6F2\uF3F0\uFEFE\u84ED\uFEFE\u62D5\u62D2\u84EC\u84EE\uFEFE\u62D4\u84F4\uFEFE\u6470" + - "\uFEFE\uFEFE\u8796\u8791\u646F\uFEFE\uFEFE\u646D\uFEFE\u8798\u646E\u8794\u8795\u8792\u8799\u89C3" + - "\uFEFE\u6471\u8793\uFEFE\u879A\u8797\uFEFE\uFEFE\uFEFE\u89C7\uFEFE\uFEFE\u89C4\uFEFE\u6590\uFEFE" + - "\u89C8\u89CA\u89C9\u89C5\u89C6\uFEFE\uFEFE\u8BB0\uFEFE\u6674\uFEFE\u8BAD\u8BAF\u8BAC\u8BB1\uFEFE" + - "\uFEFE\u8BAE\uFEFE\u8D6A\u8D6D\u8D69\u66FB\u8D6B\u8D6C\u8D6E\u66FC\u6741\u66FD\u8E91\uFEFE\u8E93" + - "\uFEFE\u8E92\uFEFE\uFEFE\uFEFE\u8F87\uFEFE\uFEFE\u90C4\u914C\u4D9D\uFEFE\uFEFE\u6AF2\u51A2\u6CC3" + - "\u51A3\u51A4\u6CC2\uFEFE\u6EDA\u6ED9\u538A\u538D\u538C\u538B\u6ED6\u6ED8\u6ED7\uFEFE\uFEFE\u716C" + - "\u55AA\u7170\u716F\u716E\u716A\u55A9\u55AD\u55B0\uFEFE\uFEFE\u55B1\u716B\u716D\u55AF\u55AE\u55AC" + - "\u55AB\u7487\uFEFE\u7485\u7481\u5860\uFEFE\u7482\u5861\u7483\u7484\u7486\uFEFE\u5862\uFEFE\uFEFE" + - "\u77DA\uFEFE\u77D9\u77D8\u77D7\uFFFF\u0004\uFEFE\u7B7E\u5CD8\uFEFE\u7B7B\u7B7D\uFEFE\u5CD9\uFEFE" + - "\u5CDA\u7B7C\uFFFF\u0005\uFEFE\u7EC9\uFEFE\u7EC2\u7EC3\uFEFE\u5EFD\u5EFB\u5EFC\u7ECB\uFEFE\u0000" + - "\u0003\u7ECA\uC7C6\uC5C4\uC8C1\uFEFE\u81D4\u81D9\u81D7\uFEFE\uFEFE\uFEFE\u81D6\u81D5\u81D8\uFEFE" + - "\u84F7\uFEFE\u62D6\u6472\u879C\uFEFE\u6473\u879B\u89CC\u89CB\u6591\uFEFE\u8BB2\u6675\u8D6F\u67EA" + - "\u8F88\uFEFE\u90C6\u90C5\u6988\u538E\u538F\u7488\uFEFE\u5CDC\u4D9E\u4FB4\u4FB3\u4FB2\uFEFE\uFEFE" + - "\uFEFE\u6CC4\uFEFE\uFEFE\u51A6\u51A5\uFEFE\u5392\uFEFE\u6EDC\u6EDF\u6EDD\uFEFE\u5390\u5391\uFEFE" + - "\uFEFE\u6EDB\u6EDE\uFEFE\u55B8\uFEFE\uFEFE\uFEFE\u7177\u7179\u7178\u55B5\u7173\uFEFE\uFEFE\u55B3" + - "\u55B2\uFEFE\u55B6\u55B4\uFEFE\u55B7\u7176\u7171\u7172\u7175\u7174\uFFFF\u0007\uFEFE\u748B\u748C" + - "\u748A\uFEFE\u7489\u5863\uFFFF\u0004\uFEFE\u5AA4\uFEFE\u77DB\u77DD\u77DF\u5AA3\uFEFE\uFEFE\u5AA1" + - "\uFEFE\u77DC\u5AA2\u77DE\u5AA0\uFEFE\uFEFE\u7B89\u7B7F\u7B83\u7B87\u5CE0\u7B85\uFEFE\u7B84\u7B81" + - "\u7B82\u5CDE\u7B88\u5CDD\uFEFE\u5CE2\u5CE1\u5CDF\uFEFE\u7B86\uFEFE\uFEFE\uFEFE\u7ED1\uFEFE\u7ED0" + - "\uFEFE\uFEFE\u7ECC\uFEFE\uFEFE\u5F41\u7ECF\u7ECE\u5F42\uFFFF\u0005\uFEFE\u6148\uFEFE\u81DB\uFEFE" + - "\u6149\u6145\u6147\uFEFE\u6144\u6146\uFEFE\uFEFE\uFEFE\u84F8\uFEFE\u62D9\u84FA\u84F9\uFEFE\u7ECD" + - "\u62DB\u62DA\u62D7\u62D8\uFFFF\u0005\uFEFE\u87A1\uFEFE\u879F\u6474\u87A0\uFEFE\u87A2\u879E\u879D" + - "\uFEFE\uFEFE\u89CD\u6594\u6592\u6593\uFFFF\u0004\uFEFE\u8BB3\u8BB4\u6677\uFEFE\u6676\u8D71\u8D72" + - "\u8D70\uFEFE\u8F89\u8F8A\uFEFE\uFEFE\u4D9F\u69E7\u4FB5\uFEFE\u6CC5\u51A8\u51A7\u6CC6\uFEFE\uFEFE" + - "\u6EE1\u5393\u6EE0\u5394\uFEFE\uFEFE\u55B9\u717C\u717A\u7181\u55BA\u717B\u717F\u717D\u717E\uFEFE" + - "\uFEFE\u748D\u748F\uFEFE\u5864\uFEFE\u748E\u5865\u5AA7\u5AA6\u5AA5\u77E0\uFFFF\u0004\uFEFE\u7B8C" + - "\u5CE3\u5CE4\uFEFE\u7B8B\u7B8A\uFFFF\u0004\uFEFE\u7ED2\u5F44\u5F43\u7ED3\u7ED4\uFEFE\u614B\u614A" + - "\uFEFE\u8541\u81DC\u81DE\u81DD\u84FD\u84FB\u8542\u84FC\uFEFE\u62DC\uFEFE\uFEFE\uFEFE\u87A3\u6475" + - "\u87A4\u87A5\uFEFE\uFEFE\u6595\u6596\uFEFE\u6742\uFEFE\uFEFE\u685D\u4DA0\uFFFF\u0005\uFEFE\u6EE2" + - "\uFFFF\u0006\uFEFE\u7182\u55BB\uFFFF\u0005\uFEFE\u58FD\u58FC\uFEFE\uFEFE\u5AA9\u77E2\u5AA8\u77E1" + - "\uFFFF\u0004\uFEFE\u7B8D\uFEFE\u5F45\u7ED5\u5F46\uFFFF\u0006\uFEFE\u6743\u8D73\uFEFE\u4E6C\u51A9" + - "\u6CC7\uFEFE\u5396\uFEFE\u5395\u6EE3\u6EE4\uFEFE\uFEFE\u7184\u7186\u55BC\uFEFE\u7188\u718B\u7189" + - "\uFEFE\uFEFE\uFEFE\u718A\u7187\u7183\u55BD\u718C\u7185\uFFFF\u0004\uFEFE\u7498\u586B\u74A1\u5868" + - "\uFEFE\u749A\u586C\uFEFE\u5866\uFEFE\u7495\u74A2\u7496\u7493\u586A\uFEFE\u5867\uFEFE\u7499\u749C" + - "\u5869\u749D\u586D\u0000\u0003\u749E\u949B\u9F97\u9290\uFEFE\uFEFE\u74A0\uFEFE\uFEFE\u77E4\uFFFF" + - "\u0004\uFEFE\u77E9\uFEFE\uFEFE\uFEFE\u77E5\u77EB\u5AAC\u7491\u77E6\u5AAA\u77E3\u5AB1\u77E7\u5AB0" + - "\u77E8\u5AB2\u5AAD\u5AB3\u5AAE\uFEFE\u5AAF\uFEFE\u5AAB\uFEFE\u77EA\uFFFF\u0007\uFEFE\u5CE7\u7B98" + - "\uFEFE\u7B9B\u7B8F\u7B94\u7B8E\u5CE9\uFEFE\u7B92\uFEFE\uFEFE\uFEFE\u7B90\u5CE8\uFEFE\u7B97\u7B96" + - "\u7B93\u7B95\u7B91\u5F4A\u7B9A\u5CE5\u7B99\uFFFF\t\uFEFE\u7EE5\uFEFE\u5F51\u7EE0\uFEFE\u5F50" + - "\u7ED6\uFEFE\u7ED8\u5F49\u7EDD\u7EDC\u7EDF\u5F4E\u7EDA\u7ED9\uFEFE\uFEFE\u5F4D\u5F48\u7EDB\u5F4B" + - "\u7EE1\u7EE3\uFEFE\u7EDE\u7ED7\u5F4C\uFEFE\uFEFE\u6153\u5F47\uFEFE\uFEFE\u7EE4\uFFFF\u0007\uFEFE" + - "\u81E2\u614C\uFEFE\u81E4\uFEFE\u614D\uFEFE\uFEFE\u614F\u81E7\uFEFE\u81DF\u5F4F\u81E5\uFFFF\u0004" + - "\uFEFE\u81E1\uFEFE\u5CE6\u6152\uFEFE\uFEFE\u614E\uFEFE\u6150\u6151\uFEFE\u62DF\u81E6\u81E0\u6154" + - "\uFEFE\u81E3\uFFFF\u0005\uFEFE\u854C\u8547\uFEFE\uFEFE\u8551\u62DD\u8549\u62E1\u854F\u8546\u8543" + - "\u8552\u647B\u62E2\u854E\u8544\u62E0\u8548\u62E4\u8545\u854A\u62E3\u854D\u8550\uFFFF\u0004\uFEFE" + - "\u87B7\u87B8\u87A8\u87AF\u87AD\uFEFE\uFEFE\u6479\u87B4\u854B\uFEFE\u87AB\uFEFE\u87B5\u6478\u87AA" + - "\u87A9\u87B3\u87B0\u87B2\uFEFE\u87A6\u87B6\u6476\uFEFE\u87B1\u87BA\u87AE\u647A\u6477\u87AC\u87A7" + - "\u87B9\u62DE\uFFFF\u0007\uFEFE\u89D0\uFEFE\uFEFE\u89CE\u89D4\u659A\u89D2\u89D1\u659C\u89D7\u659B" + - "\uFEFE\u89D8\u89D5\u6598\u89D6\u89CF\u6599\u6597\u8BB8\u89D3\uFEFE\uFEFE\u89D9\uFEFE\uFEFE\u8BB5" + - "\uFEFE\uFEFE\uFEFE\u667C\u667A\u8BB7\uFEFE\u8BB9\u8BB6\u667B\u6678\u6679\u667D\uFEFE\uFEFE\u6745" + - "\uFEFE\u8D78\uFEFE\u8D77\u8D75\u8D74\u8D76\uFEFE\u6744\u6746\uFEFE\uFEFE\u679C\uFEFE\uFEFE\u8E95" + - "\u8E94\uFEFE\uFEFE\u8F8B\uFEFE\u8F8D\u8F8F\u8F8E\u8F8C\uFEFE\uFEFE\u67EC\u67EB\uFEFE\uFEFE\u685F" + - "\u685E\u6860\u905E\u905D\uFEFE\u914D\u90C7\u914E\u68A4\uFEFE\u68A5\u917E\uFEFE\uFEFE\u68CA\u4E6D" + - "\uFEFE\u6CC8\uFEFE\uFEFE\u6EE6\u6EE7\u6EE5\uFEFE\uFEFE\u5397\uFEFE\u6EE8\u6EE9\u6EEA\uFEFE\uFEFE" + - "\u718D\u7193\uFEFE\uFEFE\u7191\u55BE\u718F\uFEFE\u7190\u7192\uFEFE\uFEFE\uFEFE\u718E\u586E\uFEFE" + - "\u74A3\u5870\u74A5\u586F\u74A4\uFFFF\u0005\uFEFE\u77ED\u5AB4\uFEFE\u77EF\u77EC\u74A6\uFEFE\u5AB5" + - "\uFEFE\uFEFE\u77EE\uFFFF\u0006\uFEFE\u7B9E\uFEFE\u5CEA\u7B9C\u5CEB\u7B9D\u5CEC\uFEFE\uFEFE\uFEFE" + - "\u5F52\u7EE9\u7EE6\u7EE8\u5F53\u5F54\u7EE7\uFFFF\u0005\uFEFE\u81E8\uFEFE\uFEFE\u81E9\uFEFE\u6155" + - "\u81EB\u81EA\uFEFE\u46F9\uFEFE\u8556\u8557\u8553\uFEFE\u8554\u62E5\u62E6\u8555\uFEFE\u6482\uFEFE" + - "\uFEFE\u647D\u6483\u647E\u6481\u647C\uFEFE\u647F\uFFFF\u0004\uFEFE\u659D\u87BB\uFEFE\u8BBB\uFEFE" + - "\u8BBA\uFEFE\u8D79\u6747\u6748\u8F91\u8E96\uFEFE\u8F90\uFEFE\u914F\u9194\u4E6E\uFEFE\uFEFE\u4FB6" + - "\uFEFE\u6CC9\u51AA\uFEFE\u539A\u6EED\u5398\u6EEB\u539D\u5399\u539E\u539C\u6EEC\u539B\u55C2\u55C1" + - "\u719E\u55CA\u7197\u719D\u55C6\u7196\u719C\u719A\u55C5\u55C7\u7199\u55C0\u7198\u55CB\u55C8\u55CC" + - "\u55C9\u7195\u7194\u719B\u55C3\u55BF\u55C4\uFFFF\u0005\uFEFE\u74B5\u74AE\uFEFE\u5ABA\u74AD\uFEFE" + - "\u5874\u587B\u5878\u587E\u587D\u5879\uFEFE\u74A7\u74AA\uFEFE\u74A9\u5875\u74AB\u74B4\u5876\u74A8" + - "\u74B1\u74B2\u5877\u74AF\u587C\u5872\u587A\u74AC\u5871\u74B0\uFEFE\uFEFE\u74B3\uFEFE\uFEFE\uFEFE" + - "\u7843\u77F7\u5AB7\u7841\u77FB\u77F3\u77FC\u5AB9\u77F4\uFEFE\u77F0\uFEFE\uFEFE\u5CF2\u77F9\uFEFE" + - "\u5AB6\u7842\uFEFE\u5ABD\u5ABF\u77F2\uFEFE\uFEFE\u5ABE\u77F5\u5AB8\u77FD\u77F6\u77FA\uFEFE\u77F8" + - "\u5ABB\u77F1\u5AC0\u5873\u5ABC\u5AC1\uFFFF\u0005\uFEFE\u5CEE\u7BA5\u7BA7\u7BA9\u7BAD\uFEFE\u7BA3" + - "\u7BA1\u5CF0\uFEFE\u7BA8\u7BAC\u7BA4\u7BA0\uFEFE\u7B9F\uFEFE\uFEFE\uFEFE\u7BAA\u7BA2\u7BA6\u5CF1" + - "\uFEFE\u5CEF\u7BAE\u5CED\u7BAB\uFEFE\u7EFA\uFFFF\u0005\uFEFE\u5F57\u7EF2\u6162\u7EFC\u5F5A\u7F43" + - "\u5F60\u7EED\uFEFE\uFEFE\u7EFD\u7EEA\uFEFE\u7F42\u7EEE\uFEFE\u5F67\u5F64\u7F41\u7EF8\u5F56\u5F5E" + - "\u5F5D\uFEFE\u5F5C\u5F62\uFEFE\u7EEB\u5F63\u7EF9\u5F5F\u5F55\u7EFB\u5F58\u5F59\u5F61\u7EF0\u7EEF" + - "\u7EEC\uFEFE\u7EF4\u7EF1\u7EF5\u5F66\uFEFE\u7F44\u5F5B\u7EF6\u7EF7\uFEFE\u7EF3\uFEFE\uFEFE\uFEFE" + - "\u5F65\uFFFF\u0004\uFEFE\u81F0\u615A\u6163\u615F\u81ED\uFEFE\u615C\u6160\u81F9\u6156\u81F1\uFEFE" + - "\u615E\uFEFE\uFEFE\u81F4\u81EF\u615D\u6161\u81EE\uFEFE\u615B\uFEFE\u81F8\u6158\u81F7\u81F6\u6164" + - "\u80BC\u6157\uFEFE\u81F5\u81EC\uFEFE\u6165\u81F3\u6159\uFFFF\u0007\uFEFE\u81F2\uFFFF\u0004\uFEFE" + - "\u62E9\u62EE\u62E7\u8564\u855B\u8567\u855F\u8565\u62EF\u62E8\u8558\u855E\u8568\u8561\u8566\u855A" + - "\uFEFE\uFEFE\u8562\u62EA\u8560\u62ED\u62EC\u855C\u855D\u8559\u8563\u62EB\u856A\u8569\uFEFE\uFEFE" + - "\uFEFE\u87C6\u87C2\u648A\uFEFE\u87BC\u6484\u6494\u87C8\u648C\u6488\u87BF\u648F\u6492\u87CA\u6487" + - "\u87C1\u6490\u87CC\u87C9\u87BD\u648B\u6485\u6493\u87C4\u648E\u87BE\u6489\u87CB\u648D\u6486\u87C5" + - "\u6491\u87C3\uFEFE\uFEFE\u87C7\uFEFE\uFEFE\uFEFE\u89DB\u89E1\u65A3\u89E4\u659E\u659F\u89DC\u89E3" + - "\u89DE\u65A4\u65A1\uFEFE\u89DA\uFEFE\u65A0\u89E0\u89E2\u65A2\u89DF\u89DD\uFFFF\u0004\uFEFE\u8BC5" + - "\u6682\u6683\u667E\uFEFE\u667F\uFEFE\u8BC1\u8BBF\uFEFE\u8BC3\u6685\u8BC4\u8BBD\u8BBC\u8BC0\u8BBE" + - "\u6681\u8BC2\u8D7A\u674B\u674A\u8D7B\uFEFE\u8D7D\u8D7C\u674C\uFEFE\uFEFE\uFEFE\u8E9B\u8E98\u8E99" + - "\uFEFE\u8E97\u8E9A\u679E\u8E9C\uFEFE\u679D\uFEFE\u8F92\uFEFE\u6861\u6863\u905F\u6862\u90C8\u9151" + - "\u9153\u9150\u9152\u68B8\uFFFF\u0099\uFEFE\u4E6F\uFEFE\u539F\u70D2\u55CD\uFEFE\uFEFE\u587F\u7844" + - "\u7845\uFEFE\uFEFE\uFEFE\u856B\u6495\u87CD\uFEFE\uFEFE\u65A5\uFEFE\u8BC7\u8BC6\u674D\u8E9D\uFEFE" + - "\u8F93\u6885\u69E8\uFEFE\uFEFE\u51AB\u4FB7\uFEFE\uFEFE\u6EEE\uFEFE\uFEFE\u71A4\u719F\u71A3\u71A1" + - "\u55CE\u71A2\u71A0\uFEFE\u74B6\uFEFE\u7846\u7847\u7BB1\u7BB2\u5CF4\u5CF5\u7BB0\u7BB3\u7BAF\u5CF3" + - "\uFEFE\u5F68\uFEFE\u5CF6\u7F45\uFEFE\u6166\u81FA\u6167\uFEFE\u62F0\u856E\u856C\u856D\u87D0\u87CF" + - "\u87CE\uFEFE\uFEFE\uFEFE\u8BC8\uFEFE\u6684\u8BC9\u8F94\u6886\u90C9\u4E70\u51AD\u51AC\u6EF0\u53A0" + - "\uFEFE\uFEFE\u6EEF\u71A6\uFEFE\u55CF\u74B7\u71A5\uFEFE\uFEFE\uFEFE\u5882\u74BA\u74B8\u74B9\u5881" + - "\uFEFE\u7849\u784A\u7848\uFEFE\u5CF9\u7BB5\u7BB4\u7BB6\u5CF8\u5CF7\uFEFE\uFEFE\u81FB\u81FD\uFEFE" + - "\u6168\u81FC\u856F\u62F1\u89E6\uFEFE\u89E5\u6686\u8BCA\u6688\u6687\u8D7E\u8E9E\u679F\u4E71\u6EF1" + - "\u53A1\u71A9\u55D1\u71A8\u71A7\uFEFE\u55D0\uFEFE\u74C0\uFEFE\u74C2\u74BB\u74BC\u5883\u74BD\u5884" + - "\u74C1\u74BE\u74BF\u5885\uFEFE\u5AC3\u5AC4\uFEFE\u784B\uFEFE\uFEFE\uFEFE\u7BB7\u7BB8\uFEFE\u7F49" + - "\u5F6B\u5F69\u5F6A\u7F46\u7F47\uFEFE\u7F48\u8245\uFEFE\u8246\u6169\u8243\u8242\u8244\u8241\u62F4" + - "\u8570\u62F2\u62F3\u87D2\u6496\u87D1\u8955\uFEFE\u89E7\u89E8\u65A6\uFEFE\u65A7\u6497\u8BCB\u8BCC" + - "\u8D7F\u674E\u4E72\uFEFE\u4E73\u53A2\u51AE\u55D2\u6EF2\uFEFE\uFEFE\uFEFE\u5AC5\u4E74\u53A4\u6EF3" + - "\u6EF4\u53A3\u53A5\u4E75\uFEFE\u6EF5\u55D4\u71AA\u55D6\u55D3\u55D5\uFEFE\u74C5\u5886\uFEFE\u74C4" + - "\u74C3\uFEFE\u7BB9\uFEFE\uFEFE\u7F4A\uFEFE\u616A\uFEFE\u62F5\u8572\u8571\uFEFE\u87D3\uFEFE\uFEFE" + - "\uFEFE\u8E9F\uFEFE\uFEFE\u4E76\u6AF3\u6CCA\u53A6\u6EF6\uFEFE\u71AC\uFEFE\uFEFE\uFEFE\u55D7\u71AB" + - "\u55D8\uFEFE\uFEFE\uFEFE\u74C7\uFEFE\uFEFE\u5888\u74C6\u74C8\uFEFE\u5887\uFFFF\u0004\uFEFE\u784D" + - "\u784E\u784C\u5AC6\uFEFE\uFEFE\uFEFE\u5CFA\uFEFE\u5CFB\uFEFE\u5F6D\uFEFE\u7F4C\u7F4B\u5F6C\uFFFF" + - "\u0005\uFEFE\u8247\uFEFE\uFEFE\u8248\uFFFF\u0004\uFEFE\u8573\uFEFE\uFEFE\u649B\u649A\u6498\u6499" + - "\u649C\uFEFE\u89E9\u65A9\u65A8\u8BCD\u8D81\uFEFE\uFEFE\uFEFE\u67EE\u67ED\u4E77\uFEFE\uFEFE\u709F" + - "\uFEFE\u5CFD\u5AC7\u5CFC\u5F6E\uFEFE\u4E78\u6989\u4E79\u4E7A\uFEFE\uFEFE\u6CCB\u6AF6\uFEFE\u6AF7" + - "\u4FB9\uFEFE\u6AF4\u4FB8\uFEFE\u4FBB\u6AF5\u4FBD\u4FBC\u6AF8\u4FBA\uFEFE\uFEFE\uFEFE\u51B3\u51B1" + - "\u6CCD\uFEFE\u51B0\uFEFE\uFEFE\uFEFE\u51B5\u51B7\u51B4\uFEFE\u6CD0\u6CCC\u51B8\uFEFE\u51B2\u4FBE" + - "\uFEFE\u51B6\u6CCF\uFEFE\uFEFE\u6CCE\uFEFE\u51AF\uFFFF\u0007\uFEFE\u6EFC\u53AA\u53AB\u6F41\uFEFE" + - "\u6EF8\u6EFB\u6F47\u6F45\uFEFE\u53AC\u6F4B\u53AF\u6F48\u6EFD\u6EFA\uFEFE\uFEFE\u7850\u6F46\u53A7" + - "\u6F49\u6EF7\u6F43\u53A9\u53AE\u6F44\u53B2\u53B0\uFEFE\u6EF9\u53AD\uFEFE\u6F42\u53B1\u53A8\u6F4A" + - "\uFFFF\u0006\uFEFE\u55DD\uFEFE\u55E6\u55DB\u55D9\u71AE\u55E1\u55DE\u71B0\uFEFE\uFEFE\u55E0\u71AF" + - "\u71AD\u71B2\u55E5\u55E3\u784F\uFEFE\u71B3\u71B1\u55DA\uFEFE\uFEFE\u55DC\u55DF\uFEFE\u55E2\uFEFE" + - "\u55E4\uFFFF\n\uFEFE\u74D2\u588A\uFEFE\u74C9\u74CB\uFEFE\u74CC\uFEFE\u74D4\u74D0\u74CE\uFEFE" + - "\u74D1\u74D5\u588B\u588F\u74CA\uFEFE\u74D3\uFEFE\u588D\uFEFE\u588C\u74CF\u74CD\uFEFE\u5889\u588E" + - "\uFFFF\b\uFEFE\u5ACD\u7858\uFEFE\uFEFE\u7856\u5ACF\uFFFF\u0004\uFEFE\u7851\u7BC7\uFEFE\u5ACE" + - "\u7855\uFEFE\uFEFE\u7852\u5ACA\u5AD0\u7857\u5ACC\u7854\u5F6F\u5ACB\u7853\u5AD1\u5AC9\u5AC8\uFFFF" + - "\u0005\uFEFE\u7BBF\u7BBD\uFEFE\u7BC3\uFEFE\u7BBB\u7BC8\u7BC0\uFEFE\u7BBA\u5D44\u5D4A\u7BC5\uFEFE" + - "\u7BBE\uFEFE\u5D47\uFEFE\uFEFE\u5D45\u7BC6\u5D42\u5D41\u7BC1\u5D46\u5AD2\uFEFE\u7BC4\u7BBC\u5D43" + - "\u5D48\u5D49\uFFFF\u0004\uFEFE\u5F74\u5F70\uFEFE\u5F75\u7F4F\uFEFE\uFEFE\u7F4E\u7F50\u5F72\u7F4D" + - "\u5F73\u7F53\u7F52\u7F51\uFEFE\u5F71\uFFFF\u0005\uFEFE\u824C\uFEFE\u824F\u6170\u824E\u616F\u616B" + - "\u616C\u616D\u824B\u824A\u616E\uFEFE\u824D\u8249\uFEFE\uFEFE\u8575\u857F\u62F8\u62F7\uFEFE\u8579" + - "\u857B\uFEFE\u8576\uFEFE\u857A\u8574\u857D\u62F6\u857C\u8578\uFEFE\u857E\uFEFE\u8577\u649F\u87D4" + - "\u87DA\u64A3\u64A5\u64A2\u64A1\uFEFE\u64A0\u649E\u87D5\u87D8\u649D\u87D9\uFEFE\u64A4\u87D7\uFEFE" + - "\u87D6\u65AA\uFEFE\u65AB\u89EC\u89EA\u89EB\uFEFE\uFEFE\u8BCF\uFEFE\u8BCE\u6689\u8D83\u674F\u8D82" + - "\uFEFE\u8EA0\u8F95\u67EF\u9154\u9155\u6864\u4E7B\uFEFE\u51B9\u7859\u5F76\u64A6\u87DB\u4E7C\uFEFE" + - "\u55E8\u55E7\u785A\uFEFE\uFEFE\uFEFE\u8581\u4E7D\u53B3\uFEFE\uFEFE\u785B\u785C\u785D\u5F77\u62F9" + - "\u4E7E\uFEFE\u51BA\u6F4C\u55E9\u71B4\u5890\uFEFE\u785E\u5D4B\uFEFE\u5F78\u62FA\u64A7\u65AC\u8D84" + - "\u4E7F\u51BB\uFEFE\uFEFE\u55EA\u74D6\u5AD3\uFEFE\u5F79\u7F54\u8250\uFFFF\u0004\uFEFE\u4E81\u5AD4" + - "\u7BC9\u5F7A\u4E82\u6CD1\u6F4D\u53B4\uFEFE\uFEFE\u71B6\uFEFE\uFEFE\u55ED\uFEFE\u55EB\u55EC\u55EE" + - "\uFEFE\uFEFE\u71B5\uFEFE\uFEFE\u74DB\u74D8\u74DA\u5891\u5893\u5892\u74D7\u5894\u74D9\uFEFE\u785F" + - "\u7860\uFEFE\u7861\u7BCC\uFEFE\u7BCD\uFEFE\u7BCB\u7BCE\uFEFE\u5D4C\uFEFE\u7BCA\uFEFE\u5F7B\uFEFE" + - "\uFEFE\u8255\u8251\u8254\u8256\u8253\u8252\uFEFE\u8582\u8583\u8584\u62FB\u62FC\u87DD\u87DC\u87DE" + - "\uFEFE\u89EE\u89ED\uFEFE\u8BD1\uFEFE\u8BD2\u8BD0\uFEFE\u6750\uFEFE\u8D85\u8D86\uFEFE\u8F96\u9060" + - "\u90CA\u4E83\u4FBF\uFEFE\u64A8\u4E84\uFEFE\u74DC\u7862\uFEFE\u688D\u69E9\uFEFE\uFEFE\uFEFE\u69EA" + - "\u69EC\u4E85\u69ED\u69EB\uFEFE\uFEFE\u6B43\u6B44\u6AFB\uFFFF\u0004\uFEFE\u6B42\u4FC1\uFEFE\u4FC2" + - "\u6AFC\u6AFA\u6AF9\u6AFD\u4FC0\u6B41\u6F4E\uFEFE\uFEFE\uFEFE\u6CD6\u51BE\u6CD5\u6CD7\uFEFE\u51BD" + - "\u6CDC\u51C1\u6CD2\u6CE0\u6CE6\u51C8\u6CE3\u51C5\uFEFE\u6CD9\u6CDF\u6CE1\uFEFE\u6CD4\u51C4\u51BF" + - "\u6CDA\u51C6\u51C9\u51C3\uFEFE\u51BC\u6CDE\u6CD8\u6CE5\u51CB\u51C7\u51C2\u6CDD\u55EF\u6CDB\u51C0" + - "\u51CA\uFEFE\u6CD3\uFEFE\u6CE2\u6CE4\uFFFF\r\uFEFE\u53C5\u53BF\u53C7\u53C4\u6F55\u6F58\u53C0" + - "\uFEFE\u6F4F\uFEFE\u53B9\u53C3\uFEFE\u53C6\u53C8\u6F64\u6F5B\uFEFE\u53B8\u6F63\u53BC\u53BA\u53B5" + - "\u6F53\uFEFE\u6F62\u6F57\u6F5A\u6F67\uFEFE\u53C9\u6F61\u53C1\u6F5C\u6F66\u6F59\u6F5D\u6F60\uFEFE" + - "\uFEFE\u6F51\u6F65\u6F5F\uFEFE\uFEFE\u6F50\uFEFE\u6F54\u53C2\u53BD\u53B6\u53BB\u53B7\u53CA\u6F52" + - "\u71C7\u53BE\uFEFE\uFEFE\u6F5E\u6D63\uFFFF\b\uFEFE\u71CA\u55FD\uFEFE\u71BA\uFEFE\u71C5\u71C1" + - "\uFEFE\u71D4\uFEFE\u71CC\uFEFE\u71C2\uFEFE\u71CB\u71BC\u71C0\u71D7\u5643\u71CF\u71C6\u55F0\u71D5" + - "\u71B8\uFEFE\u71CE\uFEFE\u5642\u55FA\u71B7\u55F8\u55F7\u55FC\u71CD\u55F4\u55FB\u6F56\u7863\u71C8" + - "\uFEFE\uFEFE\u71BE\u5641\u71BF\u71C3\u5644\u71B9\u71D1\uFEFE\u71D0\u71D8\u55F6\u55F3\u71D6\u71D2" + - "\u71C9\u71C4\u55F9\u55F5\u71BB\u55F1\u71D3\u55F2\uFEFE\u71BD\uFFFF\u001C\uFEFE\u74E2\u74E4\u74E9" + - "\u74FD\u58A2\u5898\uFEFE\u74E1\u58A3\u58A4\u74EC\u74F3\u74F9\uFEFE\u74E6\uFEFE\u74ED\uFEFE\uFEFE" + - "\u58A5\u74FB\u74F6\u58A0\u589E\u74F2\u74EE\u74E0\u5895\u74E5\u74DD\uFEFE\u589D\u589F\u74EA\u74E7" + - "\u589A\u74F7\u5897\u74E8\u7541\u74F0\uFEFE\u74EF\u5896\uFEFE\u58A1\uFEFE\u5899\u74DE\u74E3\u74F4" + - "\u74FA\u58A6\u74DF\u74EB\u74F1\u589C\uFEFE\uFEFE\u74FC\u74F5\u74F8\uFFFF\f\uFEFE\u589B\uFEFE" + - "\u7873\u7867\u5ADC\u7885\u788D\u7890\u5ADA\u786F\u7889\u7870\u787E\u5AE7\u787A\u5AE4\uFEFE\u787B" + - "\u7864\uFEFE\u788A\uFEFE\uFEFE\u5AED\u7887\u787C\u7892\u7877\u7BEE\uFEFE\u7895\u5AEB\u7875\u7882" + - "\u5AEE\u5AD9\u7879\u7893\u7872\u786B\u7876\uFEFE\u786A\u7868\u5AD5\u788B\u7871\u788E\uFEFE\u788F" + - "\u5ADD\u5AE2\u5ADE\u5AE6\u7886\u5ADF\u787D\u786D\uFEFE\u5AD7\u7865\u7888\u7891\u786C\u5AE5\u7896" + - "\u7878\uFEFE\u7874\uFEFE\u5AD6\u5AEA\uFEFE\u7884\u5AEC\uFEFE\u787F\u5AE1\u5ADB\u5AE3\u5AD8\u5AE9" + - "\u7881\u786E\u7883\u7869\u788C\uFFFF\u0007\uFEFE\u7894\uFFFF\u0007\uFEFE\u7866\uFFFF\u0005\uFEFE" + - "\u7BED\uFEFE\u7C46\u5CDB\u7BF2\uFEFE\u7BF0\u7BDB\u5D50\u7BEB\u7C42\u7BE7\u5D58\u7C41\u7BE5\u5AE8" + - "\u7BF5\u7BE6\u7BFC\u5D57\u5D4F\uFEFE\u7BD0\u7BD8\uFEFE\u7BF1\u7BE9\u7C45\u7BEC\u5D5D\u7BFD\uFEFE" + - "\u5D54\uFEFE\u7BEF\u7BF7\u7BDC\u7BF6\uFEFE\u7C4A\u7BD7\u7BF8\uFEFE\u7C48\uFEFE\u7BD1\u5AE0\uFEFE" + - "\u7BDF\u7BDE\u5D56\uFEFE\u7BE2\u7BE4\u7BF3\u7C47\u5D59\uFEFE\u5D5A\uFEFE\u7BD6\u5D52\u7BDA\u7C43" + - "\u5D5B\uFEFE\u5D53\u5D55\u5D5C\u7C49\u7BF9\u7BF4\uFEFE\uFEFE\u7BE1\u7BE0\u5D51\u7BD2\u5D4E\u7BEA" + - "\u7BD3\u7BE8\uFEFE\uFEFE\u7BDD\u7C44\uFEFE\uFEFE\uFEFE\u5D4D\uFEFE\uFEFE\uFEFE\u7BD9\uFFFF\u0006" + - "\uFEFE\u7BD5\u7BFB\u7BD4\u5F89\u7F7C\uFEFE\uFEFE\u7F6B\uFEFE\uFEFE\u7F55\u7F73\u5F81\u7F64\u7F6E" + - "\u5F84\u7F67\u5F82\u7F58\u7F76\u7F57\u7F6A\uFEFE\u7F56\uFEFE\uFEFE\u7F68\u7F71\u7F6F\u7F63\u7F5E" + - "\u7F5C\uFEFE\u7F5D\u7F70\u7F7B\u7F65\u5F83\uFEFE\u7F60\uFEFE\u7F74\uFEFE\u5F86\u7F5F\u7F59\u7F69" + - "\u5F8A\uFEFE\uFEFE\u5F7D\u5F87\u7F61\u7F5B\uFEFE\u5F7F\u7BFA\u5F7E\u7F6C\uFEFE\u5F7C\u5F8C\u5F85" + - "\u7F6D\u7F62\u7F5A\u7F75\u7F66\u5F8B\u7F79\u5F88\u7F78\uFEFE\u7F72\u7F77\uFEFE\uFEFE\uFEFE\u7F7A" + - "\uFFFF\u000B\uFEFE\u827E\u827F\u8272\u8271\u826D\u617C\uFEFE\u6174\u8282\u8281\u7BCF\u826A\u826E" + - "\u8268\uFEFE\u827B\u826C\uFEFE\u8283\u8265\u8263\u826F\u8279\u8274\u617E\u825A\uFEFE\u8278\uFEFE" + - "\uFEFE\uFEFE\u617F\u7BE3\u0000\u0003\u8266\u5D60\u8767\u5E5C\u8259\uFEFE\u6178\u8270\u6177\u617B" + - "\u826B\u8273\u6171\u8284\u8288\u6173\uFEFE\u8262\u8276\u827A\u825F\u8285\u617A\uFEFE\u6179\u8257" + - "\u617D\u827D\u8261\u8275\u825B\u8269\u8264\u6175\u6176\u8277\u8289\u8286\u827C\uFFFF\t\uFEFE" + - "\u8258\uFEFE\u6172\u8595\uFEFE\u858C\u858F\uFEFE\u6345\u8591\u8586\u858D\u8593\u6342\u6346\u62FD" + - "\uFEFE\uFEFE\u8588\u8598\uFEFE\uFEFE\u8592\uFEFE\u8589\u85A1\u859B\u8585\u87F1\u858B\u6341\uFEFE" + - "\u8596\uFEFE\u85A0\u6349\uFEFE\u0000\u0003\u859D\u8A90\u948E\uA29F\u859C\u6343\u6344\u6348\u8587" + - "\u85A3\u6347\u8599\uFEFE\uFEFE\u8597\uFEFE\uFEFE\uFEFE\u859A\u8841\u87EB\u87F0\u87FD\u87EF\u87E7" + - "\u87EC\uFEFE\u64AB\uFEFE\u87E0\u87F8\u87FA\u87DF\u64AA\u87FC\u87F4\u64B1\u87FB\u87ED\u64B3\u87E5" + - "\u859E\u87F5\u87F2\u87E1\u8843\u64AD\uFEFE\uFEFE\u64AE\u87E3\u87F3\uFEFE\u8842\u87F6\u87E9\u64B0" + - "\u64AC\u87F7\u87EA\u8844\u87E4\u87EE\u87F9\u87E6\u87E8\uFEFE\u65B5\u87E2\u64B2\u65AE\u64A9\uFFFF" + - "\u0004\uFEFE\u64AF\u65B2\u8A41\uFEFE\u89F4\u89EF\u89F5\u8A42\u8A46\u8A45\u65B4\u65B3\uFEFE\uFEFE" + - "\u89F6\u8A47\u89F9\u89F1\uFEFE\u0000\u0003\u89F3\uF2F8\uFDF0\uF7FC\u65B1\uFEFE\u89FA\uFEFE\u65AF" + - "\u89FB\u65AD\u65B0\u8BE2\u8A43\uFEFE\uFEFE\u668D\uFEFE\u8BDA\u8BDE\u8BD6\u8BD9\uFEFE\u8BE1\u668B" + - "\u8BE6\u8BDF\uFEFE\u8BD7\u8BE7\u8BE0\u668E\u668F\u8BE4\uFEFE\u8BD8\u668A\u668C\u8BD3\u8BDB\u8BD5" + - "\uFEFE\u8BE5\u8BE3\u8BD4\u8BDC\uFEFE\uFEFE\uFEFE\u8D8D\u6690\u8BDD\u6752\u6754\u6751\uFEFE\u8D92" + - "\u8D8A\u8D88\u8D8C\u8D89\uFEFE\uFEFE\u8D8E\u8D90\u6755\u6757\uFEFE\u8D8F\u6758\u6756\u8D91\uFFFF" + - "\u0004\uFEFE\u6753\uFFFF\u0005\uFEFE\u67A0\u8EA1\u8EA7\u67A2\u8D8B\u8EA6\uFEFE\u8EAD\u8EA4\u8EAB" + - "\u8EAA\u8D87\u8EA5\u8A44\u8EAE\u8EA3\u8EA8\uFEFE\u8EAC\u8EA2\uFEFE\u8F9A\u67A1\u8EA9\uFEFE\uFEFE" + - "\u9065\u8F9B\u8F99\u8F97\u8F98\u8F9C\uFEFE\u6865\u9063\u9061\u9066\u9064\uFEFE\u9067\u6866\u9062" + - "\uFEFE\uFEFE\u90CB\uFEFE\uFEFE\u9156\u9157\u9158\uFEFE\uFEFE\u91B7\u91AD\u69EE\u51CC\uFEFE\u53CB" + - "\uFEFE\u71DA\u71D9\u5645\u58A7\u7543\uFEFE\uFEFE\u7542\uFEFE\u5AEF\u5D5F\uFEFE\u5D5E\u5D60\uFEFE" + - "\u7F7D\u828A\u85A4\u85A6\u85A5\uFEFE\u64B4\u8845\u8A48\u9195\u4E86\uFEFE\u6CE9\u6CEA\u6CE8\u6CE7" + - "\u51CD\uFEFE\u6F6B\u6F69\uFEFE\uFEFE\u6F68\uFEFE\u53CC\u53CE\u53CD\u6F6A\uFFFF\b\uFEFE\u71E6" + - "\u71E3\u71E1\uFEFE\uFEFE\u5646\u71E4\u564B\u71DE\u71ED\uFEFE\u71EF\u71DF\uFEFE\u5648\u0000\u0003" + - "\u71F0\uEBDD\uE2EC\uE8E5\uFEFE\u564D\u71EE\u71E0\uFEFE\uFEFE\u71E9\u71DB\u564C\u5649\u71E7\uFEFE" + - "\u71EA\u71DC\u564A\u5647\uFFFF\u0004\uFEFE\u58B1\u754A\u58B0\uFEFE\u754D\u7550\u58AD\u58AB\u0000" + - "\u0004\u7545\u4E4C\u4951\u5254\u5544\u58AA\u7547\u7546\u7553\u58AC\u7548\u58AE\u58A9\u754B\u58B2" + - "\uFEFE\u58AF\u754F\uFEFE\uFEFE\uFEFE\u5AF6\u78A5\uFEFE\u789A\u5AF3\uFEFE\u7C50\u78A3\u7897\u5AF1" + - "\u789C\u5AF4\u78A0\u789E\u5AF7\u5AF0\uFEFE\uFEFE\u7898\u789B\u5AF5\uFEFE\u7899\uFEFE\u78A4\u78A2" + - "\u789D\u789F\u78A1\u5AF2\uFFFF\u0007\uFEFE\u7C51\u7C57\u7C4D\u7C53\u5D61\u7C4F\u5D67\uFEFE\uFEFE" + - "\u5D66\uFEFE\u5D65\u7C56\u5D68\u5D69\u7C4C\u7C59\u5D6A\u5D64\u5D63\u7C55\u5D6B\u7C4B\u7C4E\u7C58" + - "\u7C54\uFEFE\uFEFE\u7F9E\u7F93\u5D62\uFFFF\u0004\uFEFE\u5F93\u7F87\u7F9C\u7F88\u5F8E\uFEFE\u7F85" + - "\uFEFE\u7F8E\u7F86\u5F90\u7F7F\u7F9B\u5F91\u7F98\u7F99\u7F81\u5F96\u7F90\uFEFE\u7F8A\u7F91\u7F84" + - "\uFEFE\u7F9D\u7F95\u7F8F\u7F7E\u5F92\u7F96\uFEFE\u5F95\u7F9A\uFEFE\u7F94\u5F8F\u7F92\uFEFE\u7F8C" + - "\u5F8D\u7F83\u7F8B\u7F97\u7F89\uFEFE\uFEFE\u7F8D\uFFFF\u0005\uFEFE\u618A\u7C52\u829C\u82A5\u829B" + - "\u8297\u8294\u618B\u8292\u5F94\u828B\u6189\u8291\u6188\u8296\u8293\u82A3\u829E\u8298\u829D\u6184" + - "\u8295\u82A8\u828C\u828D\u82A4\u6185\u82A9\u6187\u82AA\u829A\u7F82\u82A0\u8299\u82A2\u829F\uFEFE" + - "\uFEFE\uFEFE\u8290\u6182\u82A7\u6183\u828E\u6186\u85B0\u82A1\u82A6\uFFFF\u0005\uFEFE\u85AD\u6181" + - "\u634A\u85B7\u85B3\uFEFE\u85B1\u85AC\u85BB\uFEFE\uFEFE\uFEFE\u634E\uFEFE\u85A8\u85B4\u85B5\u85AB" + - "\u85AA\u85B8\uFEFE\u85AE\u85A9\u85AF\uFEFE\u85BA\u85A7\u85B9\u85B6\u634C\u634B\uFEFE\uFEFE\u634D" + - "\u85B2\u8A59\uFFFF\u0005\uFEFE\u8847\u64BA\u884B\u8848\u884F\u8855\u884A\uFEFE\u885E\u64B7\u8858" + - "\u884D\u8859\u8854\u885B\u884C\u64BC\u64BB\u884E\u885C\u8846\u885A\u64B5\uFEFE\u8852\u8851\u8856" + - "\u8849\u64B9\uFEFE\u64BD\u8850\u8857\u64BE\u8853\uFFFF\u0004\uFEFE\u64B6\u64B8\u8A55\u8A53\uFEFE" + - "\uFEFE\u8A5A\u8A57\u8A5B\uFEFE\u8A4C\u8A54\u8A5F\u885D\u8A50\u65B9\u828F\u0000\u0003\u8A4B\u5852" + - "\u4F4A\u495E\uFEFE\u8A4E\u8A4D\u65B7\u8A56\uFEFE\u65B6\uFEFE\uFEFE\u65B8\u8A51\u8A5D\uFEFE\u8BEB" + - "\u8BEC\uFEFE\u6694\u8BE9\u6691\u8BF1\uFEFE\u6695\u8BF3\u8BE8\u8A5C\u8BF5\u8BEA\uFEFE\u6692\u8BF0" + - "\uFEFE\u8BF2\u8BED\u8BF4\u8BEF\u8BEE\u6693\uFEFE\uFEFE\u8D94\u8D95\uFEFE\u8D97\u6759\u675A\u8D98" + - "\u8D96\uFEFE\u8D93\uFEFE\u8EB1\u8EB4\u8EB0\uFEFE\u67A6\u8EB2\u67A5\u67A4\u67A3\u8EB3\u8FA1\u8F9F" + - "\uFEFE\u8F9E\u8EAF\u8FA0\u8EB5\u8F9D\uFEFE\u906A\u9048\u9068\u6867\u9069\u906B\uFEFE\u90CE\u6887" + - "\u90CD\u90CC\u6888\uFEFE\u68A6\u917F\u9197\u9196\u9198\u4E87\u6F6C\uFEFE\u71F1\u71F2\uFEFE\uFEFE" + - "\uFEFE\u78A6\uFEFE\u8EB6\u90CF\u4E88\u53CF\u6F6D\uFEFE\uFEFE\uFEFE\u7556\u58B3\uFEFE\u78A8\u78A7" + - "\u5AF8\uFEFE\u5D6C\u82AB\u618C\uFEFE\u618D\uFEFE\uFEFE\uFEFE\u634F\u6889\u4E89\uFEFE\uFEFE\uFEFE" + - "\u6F6E\u51CF\u6F70\u6F6F\u53D0\uFEFE\u71F3\uFEFE\u71FA\u564E\u71F8\u71F6\uFEFE\u71FD\u71F4\u71F5" + - "\u564F\uFEFE\u5653\uFEFE\uFEFE\u7241\u5652\u71FC\u71F9\u71F7\u5650\u5651\u71FB\uFFFF\u0004\uFEFE" + - "\u58B5\u7557\uFEFE\u58BA\u7567\u58B9\u7569\uFEFE\uFEFE\u755D\u58B7\u7568\uFEFE\u7558\u58B8\u7564" + - "\u7560\u7562\u755C\u7563\uFEFE\uFEFE\u58B4\u755F\uFEFE\u755E\u755A\uFEFE\u7565\uFEFE\uFEFE\u7561" + - "\u7559\uFEFE\u755B\u58B6\u7566\uFFFF\u0004\uFEFE\u5AFB\u78B3\uFEFE\uFEFE\uFEFE\u78AF\u78B1\u78AC" + - "\u78AB\u78A9\uFEFE\u78B0\u78B2\u78AE\uFEFE\u78AD\u5AF9\u5AFA\uFFFF\u0006\uFEFE\u78B5\u5D74\u7C5B" + - "\u7C61\u7C5C\u7C5D\uFEFE\u7C62\uFEFE\u5D76\uFEFE\u5D6E\u5D75\u7C5A\u78AA\u5D71\u5D6F\u7C60\u7C5F" + - "\u5D70\u5D72\u7C5E\u5D6D\uFEFE\u5D73\uFFFF\u0005\uFEFE\u7FA0\u5F9D\uFEFE\uFEFE\u7FAB\u7FAA\uFEFE" + - "\u7FA5\u5F9F\u7FA9\u7FA1\u7FA2\u5F97\u5F99\uFEFE\u7FA7\u7F9F\u5F9B\u5F9A\u7FA3\u7FA8\u7FA6\u5F9C" + - "\u7FA4\uFEFE\uFEFE\u78B4\u5F98\uFEFE\uFEFE\u82AC\u82B3\u618F\uFEFE\u82B7\u6193\u82AF\u82AD\uFEFE" + - "\u82B6\uFEFE\u618E\u82B5\u6190\u6191\u82AE\u6192\u82B4\u82B0\u82B1\u82B2\u5F9E\uFEFE\uFEFE\uFEFE" + - "\u85BC\u85C8\uFEFE\u6354\u85C3\u85C5\uFEFE\u6352\u85BD\u85C1\uFEFE\u85C4\u6350\u6353\u85C7\u85BF" + - "\u85C0\u85C6\u85BE\u85C2\u6351\u8860\uFEFE\u885F\u64C0\u8865\u64C2\uFEFE\uFEFE\u64BF\u8861\u64C3" + - "\u8862\uFEFE\uFEFE\u8863\u8866\uFEFE\u64C1\uFEFE\u8A64\uFEFE\uFEFE\u8A67\uFEFE\u8A61\u8A63\uFEFE" + - "\uFEFE\u8A62\u8A65\u8A66\u8864\u8A60\uFEFE\uFEFE\u6698\u8BF9\u8BFC\u8C41\u8BF7\u8BF8\u8BFB\u8BFD" + - "\u6699\u6697\u6696\u8BFA\u8BF6\u8D99\u675B\uFEFE\u8D9A\uFEFE\uFEFE\u8EB8\u67A7\u8EBA\u67A8\u8EB7" + - "\u8EB9\u67F1\uFEFE\u8FA2\u67F0\u906E\u906D\uFEFE\u906C\uFEFE\uFEFE\u9159\u915A\u915C\u915B\uFEFE" + - "\u69EF\u4E8A\uFEFE\u53D1\u756A\u5AFC\uFEFE\u7C63\u65BA\uFEFE\u8C42\uFEFE\uFEFE\u4FC3\uFEFE\uFEFE" + - "\uFEFE\u58BC\uFEFE\uFEFE\uFEFE\u58BB\uFEFE\u78B6\u5AFD\u78B8\u78B7\uFEFE\uFEFE\u7C64\u5D77\u7FAC" + - "\u7FAF\u7FAE\uFEFE\u7FAD\u82B8\u82BA\u82B9\uFEFE\u6356\uFEFE\uFEFE\uFEFE\u6355\uFEFE\u64C4\u8867" + - "\u8869\u8868\uFEFE\uFEFE\u65BB\uFEFE\uFEFE\uFEFE\u8C44\u8C43\uFEFE\u8D9B\u675C\uFEFE\uFEFE\u67A9" + - "\u8FA4\u8FA3\u68A7\uFFFF\u0011\uFEFE\u4FC4\u6F71\u53D2\u756D\u756B\uFEFE\uFEFE\u756C\u78BA\u78BB" + - "\u7C6B\u78B9\uFEFE\u7C65\u7C69\u7C68\u7C6A\u5D78\u7C67\u7C66\u7C6C\uFEFE\u7FB2\u7FB0\uFEFE\u7FB1" + - "\u82BD\u82BB\uFEFE\uFEFE\u82BC\u85C9\u886A\u886B\u65BC\uFEFE\u8C45\u8D9C\u675D\uFEFE\u8EBB\u8FA5" + - "\u67F2\uFEFE\u906F\u915D\u4FC5\uFEFE\u53D4\u53D5\u6F72\uFEFE\uFEFE\u6F73\u53D3\uFEFE\u5659\uFEFE" + - "\u5657\uFEFE\u5656\u565D\u5655\u565E\u7242\u565B\uFEFE\u5658\u565C\u565A\u5654\uFEFE\uFEFE\u58C4" + - "\uFEFE\u58BE\u7571\u58C3\uFEFE\uFEFE\u58C5\u58BF\uFEFE\u58C0\uFEFE\u756F\uFEFE\uFEFE\u58BD\uFEFE" + - "\u7570\u58C2\uFEFE\uFEFE\u756E\u58C1\uFEFE\uFEFE\u5B4B\uFEFE\u5B4D\uFEFE\uFEFE\u78BE\u5B4C\u5B41" + - "\u5B45\uFEFE\u5D8C\u7C71\u78C0\u5B46\uFEFE\uFEFE\u78C3\u78C4\u5B4A\uFEFE\u78C6\uFEFE\u78C8\uFEFE" + - "\u78C9\u78BD\u78BC\u78CA\u5B49\u78C7\u78C5\uFEFE\u5B47\u5B43\u5B4E\u78C1\u78C2\u78BF\uFEFE\u5B48" + - "\uFEFE\uFEFE\u5B44\uFEFE\u5B42\u7C70\u5D87\u5D82\uFEFE\uFEFE\u5D7C\uFEFE\u5D8D\u5D7D\uFEFE\u5D79" + - "\u5D89\u5D86\u5D88\uFEFE\u5D7E\u5D84\u5D7A\u5D7B\u7C78\u7C75\u7C6D\u7C72\uFEFE\u5D8A\u7C79\u5D8B" + - "\u5D81\uFEFE\uFEFE\u7C6F\uFEFE\u7C77\u7C73\u7C76\u7C74\u5D85\u7C6E\u5D7F\uFEFE\uFEFE\uFEFE\u7FB5" + - "\u5FA1\u5FA4\uFEFE\u7FB7\uFEFE\u5FAC\u7FB6\u5FA6\uFEFE\u6198\u7FB8\uFEFE\u5FAB\u7FB4\u5FAD\uFEFE" + - "\uFEFE\uFEFE\u5FA2\uFEFE\u5D83\u5FA5\uFEFE\u5FA3\u5FA7\u5FA9\u5FA0\u5FAE\u5FAA\uFEFE\u5FA8\u7FB3" + - "\uFFFF\u0004\uFEFE\u619F\uFEFE\u619B\uFEFE\uFEFE\uFEFE\u61A2\uFEFE\u82C0\u61A3\u82CC\u82C5\u6194" + - "\u82CD\u82C7\u619E\u82C8\uFEFE\u619D\u82CB\u6197\u82C9\u82BF\u6196\u85D4\u619C\uFEFE\u6199\uFEFE" + - "\u61A1\uFEFE\u82BE\uFEFE\u82C2\u6195\u82C1\u82C3\u82C4\u61A0\u82C6\u82CA\u82CE\uFEFE\u61A4\u635C" + - "\u85CF\u85D5\u85D2\u85CA\u85D6\u85CB\uFEFE\u85D1\uFEFE\u6357\u635D\u85D7\uFEFE\uFEFE\u6359\uFEFE" + - "\u6363\u635E\u85D9\u85D3\u635A\u85CC\u6364\u85CD\u85CE\u6365\u6362\u619A\uFEFE\u6358\u85DA\u6366" + - "\uFEFE\u635F\u85D8\u635B\u6360\u6361\uFEFE\u64CC\u8870\u8879\u8876\u8878\uFEFE\u64C9\u8871\uFEFE" + - "\u8877\u64C5\u8873\u64CD\u886F\u8874\u887B\u85D0\u8875\u886E\u64C6\u886D\u64C7\u887C\u64C8\u887A" + - "\u64CB\u886C\uFEFE\u64CA\uFEFE\u8872\u8A6A\u8A78\u8A73\u8A75\u8A69\u65BD\uFEFE\u8A68\u65C0\u65BF" + - "\uFEFE\u8A77\u8A6F\u8A6C\u8A72\uFEFE\u8A6B\uFEFE\u8A6D\u8A76\u8A74\uFEFE\u65BE\u8A7B\u8A79\u8A70" + - "\u8A7A\u8A71\uFEFE\u8C49\u669A\u8C50\uFEFE\uFEFE\u8EBE\u66A1\u8A6E\u8C47\u669D\u8C48\u8C4D\uFEFE" + - "\uFEFE\u669F\u66A0\u0000\u0003\u8C46\u4F51\u4A4C\u4E4B\u8C52\u669C\u66A2\u669E\uFEFE\u669B\u8D9F" + - "\uFEFE\u6762\u8D9D\uFEFE\uFEFE\u8DA1\uFEFE\u8DA2\u6760\u8DA3\u8DA0\uFEFE\u8D9E\u6763\u675F\u8DA4" + - "\uFEFE\u6761\u675E\uFEFE\uFEFE\uFEFE\u67AA\uFEFE\uFEFE\u67AB\u8EBD\u8EBC\u8EBF\u8EC0\uFEFE\u67AC" + - "\u8FA6\u8FAB\u67F3\uFEFE\u8FA8\uFEFE\u8FA7\u8FAA\u8FA9\uFEFE\u9073\uFEFE\u6868\u9072\u9070\uFEFE" + - "\u9071\uFEFE\uFEFE\uFEFE\u688B\u688A\u90D0\u90D1\u688C\uFEFE\u915E\u915F\u68B3\uFEFE\u68B9\uFEFE" + - "\u9199\u91B8\uFFFF\u0097\uFEFE\u4FC6\uFEFE\u7572\uFEFE\u7573\u7C7A\u7FB9\u82CF\u64CF\uFEFE\u64CE" + - "\u8A7C\u8C53\uFEFE\u9074\u4FC7\u7243\u565F\u58C6\u7C7C\u7C7B\u61A5\u82D0\u61A6\u887D\u65C1\uFEFE" + - "\uFEFE\uFEFE\u68C2\u4FC8\u6CEB\u7244\uFEFE\uFEFE\u58C7\uFEFE\u7574\u7575\uFEFE\u78CB\uFEFE\u5B4F" + - "\u5D8E\uFEFE\u7C7E\u7C7D\u7C7F\uFEFE\u7FBA\u7FBB\u5FAF\u6367\u61A7\u6368\uFEFE\u8882\u887E\u8881" + - "\u887F\u64D0\uFEFE\u8A7D\u8C55\u8C54\u6B45\u5661\u5660\u7245\uFEFE\u7576\uFEFE\uFEFE\u78CD\u78CC" + - "\u5B50\uFEFE\u7C82\u7C83\u7C81\uFEFE\uFEFE\u5D90\u5D8F\uFEFE\u5FB1\u5FB0\uFEFE\u82D1\u85DD\u85DB" + - "\u85DC\u6369\u8884\u8883\uFEFE\u8A81\u8A7F\u8A7E\u8C56\uFEFE\u919A\u4FC9\u53D6\uFEFE\u53D7\u5662" + - "\u5663\u7247\u7246\u7577\uFEFE\u58CD\u58CB\u58C8\u58CC\u58CA\u58C9\uFEFE\uFEFE\u5B51\u78D0\uFEFE" + - "\u5D95\u5B53\u5B58\u78D2\u5B5A\u5B59\u5B5C\u78D1\u78CE\u5B56\u5B52\u5B54\u78CF\u5B5B\u5B57\u5B55" + - "\u5D97\u5D96\u5D94\u5D98\uFEFE\u5D92\u5D93\uFEFE\u5D91\uFEFE\u7C84\uFEFE\uFEFE\u7FBD\uFEFE\u5FB3" + - "\u5FB4\u5FB2\uFEFE\u7FBC\uFEFE\u7FBE\uFEFE\u82D4\u82D6\uFEFE\u61B0\u82D7\u61A9\u82D3\u61A8\u61B2" + - "\u61AE\u61AF\u61AB\u82D2\u61AA\u82D8\u82D5\uFEFE\u61B1\uFEFE\u61AC\u61AD\u85DF\uFEFE\u85E1\u85E0" + - "\uFEFE\u85E2\u636A\u85DE\uFEFE\uFEFE\u64D4\u8885\u64D1\u64D5\u64D3\u64D2\u8A82\uFEFE\u8A85\uFEFE" + - "\u8A84\uFEFE\u8A83\u65C2\u8C57\u8C58\u66A3\u8C59\u66A4\uFEFE\uFEFE\u6765\uFEFE\u6764\u8EC1\uFEFE" + - "\uFEFE\u67AD\u8EC2\u8FAC\u67F4\u67F5\uFEFE\u9075\uFEFE\u688E\uFFFF\u0048\uFEFE\u4FCA\uFEFE\u58CF" + - "\u58CE\u7C85\u7C86\uFEFE\u5FB5\u85E3\u61B3\u85E4\u8886\u4FCB\uFEFE\u6F74\u53D9\u53D8\uFEFE\u7248" + - "\u5664\u7249\u757A\uFEFE\u7579\uFEFE\u7578\uFEFE\uFEFE\u78D4\u5B5F\uFEFE\uFEFE\u78D3\u5B5E\uFEFE" + - "\uFEFE\uFEFE\u78D5\u5B5D\uFEFE\u0000\u0004\u7C88\u8B89\u8A8E\u878F\u8C8D\u5FB7\u7FBF\uFEFE\uFEFE" + - "\u5FB6\uFEFE\u82DC\u82DA\uFEFE\uFEFE\u61B4\u82D9\u82DB\uFEFE\u61B5\uFEFE\u85E5\uFEFE\u85E6\u64D6" + - "\uFEFE\u8C5B\u8C5D\u8C5A\u8C5C\u8DA5\u8EC3\uFEFE\uFEFE\u9181\u4FCC\u53DA\u724A\u724C\u724B\uFEFE" + - "\u757D\u58D1\uFEFE\u757B\uFEFE\u58D0\u757E\uFEFE\u757F\u757C\uFEFE\uFEFE\u78E1\u5B67\u78D9\u78DF" + - "\uFEFE\uFEFE\u5B62\u5B65\u78D8\u5B60\u78DC\u7C95\u5B64\uFEFE\u78D7\uFEFE\u78DD\u78DA\u78E0\u78D6" + - "\u78DE\u5B63\u5B66\u78DB\u5B61\uFEFE\u5D9A\u7C91\u5D99\u7C98\u7C97\u5DA0\uFEFE\u5DA1\u7C99\u5D9B" + - "\u7C96\u5D9F\u7C9B\u7C92\uFEFE\u7C94\u5D9C\u7C90\u7C93\u7C9A\u5D9D\u7C9C\uFFFF\u0005\uFEFE\u5D9E" + - "\uFEFE\u5FB8\u7FC4\u7FCA\u7FC2\u7FCB\uFEFE\u7FC1\u7FC6\u7FCC\u7FC9\u7FC8\u7FC7\uFEFE\u7FC0\u7FC5" + - "\uFEFE\uFEFE\u7FC3\uFEFE\u61BA\u61B7\u0000\u0005\u82E5\uEAEC\uE9E2\uE4EE\uEBE6\uEFE3\u82ED\u61B8" + - "\u61BE\u61BC\u82DD\u61BD\u61B9\u82DE\u82E0\u82DF\u82E7\u82E8\uFEFE\u61BB\uFEFE\u61B6\uFEFE\uFEFE" + - "\u82E1\uFEFE\u85F0\u636C\uFEFE\u85E7\u636D\u6370\u85EC\uFEFE\u85E9\u636F\uFEFE\uFEFE\u85ED\u85EE" + - "\u85E8\u85F1\u85EA\u85EF\u636E\uFEFE\u636B\u85EB\uFEFE\u888C\u64D9\u64D7\u64DA\u64D8\u888B\u8888" + - "\u8887\uFEFE\u888A\uFEFE\uFEFE\u8889\u8A93\u65C8\u8A8A\u8A89\uFEFE\u65C3\u8A8F\u8A8E\u8A86\u8A91" + - "\u8A8B\u65C7\u8A88\u8A90\u8A87\u65C4\u65C6\u8A8C\u65C5\u8A8D\uFEFE\u8A92\u8C61\uFEFE\u66A9\u8C5E" + - "\uFEFE\u8C62\uFEFE\uFEFE\u66A6\u8C60\u66AB\uFEFE\u66A8\uFEFE\u8C5F\uFEFE\u66AA\u8C63\u66A5\uFFFF" + - "\u0004\uFEFE\u6767\u6769\uFEFE\u8DA8\u6768\u8DA6\u66A7\u8DA7\u6766\u67AE\u67B0\u8EC5\u67AF\u8EC4" + - "\uFEFE\u8FB1\u67F6\u8FB0\u67F7\u8FAE\u8FAD\u8FB2\u8FB3\u9076\uFEFE\u8FAF\uFEFE\uFEFE\u90D5\u90D2" + - "\u90D3\u90D4\u68A8\uFEFE\u9162\u9161\u9160\u9182\uFEFE\u91AE\u919B\u68BA\u4FCD\u5665\uFFFF\u0005" + - "\uFEFE\u5DA2\uFFFF\u0007\uFEFE\u61BF\uFEFE\uFEFE\u85F2\uFEFE\uFEFE\u65C9\uFEFE\u8C64\uFFFF\u0006" + - "\uFEFE\u919C\u4FCE\u51D0\u53DC\u53DB\uFEFE\u5668\uFEFE\u724D\u5666\u724E\u5667\uFEFE\uFEFE\u7585" + - "\u7581\uFEFE\uFEFE\u58D2\u7584\u7583\u7582\u58D3\u7586\u7587\uFEFE\uFEFE\uFEFE\u78E8\u78E6\u78EA" + - "\u78EB\u78F1\uFEFE\u78ED\u78EF\uFEFE\u78E7\u78E2\uFEFE\u78EE\uFEFE\uFEFE\u78F0\u78E9\u78EC\u78E3" + - "\u5B69\u78E5\u78E4\u5B68\u5B6A\uFEFE\u5DA5\u7C9E\u7CA0\u7C9F\u7CA4\u5DA3\uFEFE\u7CA1\u7C9D\u7CA2" + - "\u7CA3\u5DA4\u5DA6\u7CA5\uFEFE\u7FD0\u7FCF\uFEFE\u7FCD\u7FCE\u5FBA\u5FBC\u5FB9\u5FBB\u82F6\u82F7" + - "\u82F2\uFEFE\u82F3\u61C1\u61C6\u61C0\u61C7\u61C2\u82F4\uFEFE\uFEFE\u82F5\u82F1\u61C8\u61C4\uFEFE" + - "\uFEFE\u61C3\u61C5\uFEFE\u82F0\uFEFE\u85F4\u6372\uFEFE\uFEFE\u85F6\u6374\u85F9\u85F5\u85F3\u85F8" + - "\u6373\u85F7\uFEFE\u6371\uFEFE\uFEFE\u64DC\u64DF\u888E\uFEFE\u64DD\u888D\u64DB\u64DE\u8A94\u8A95" + - "\u8A96\u65CA\uFEFE\u8A97\uFEFE\u65CB\u66AD\u8C67\u8C68\u8C66\u8C65\u8C69\u66AC\u8DAC\u8DAA\u8DAB" + - "\u8DAD\u8DA9\u8DAE\u8EC7\uFEFE\u8EC8\u8EC6\u67B1\u8FB4\u67F8\u8FB5\u9078\u9077\uFFFF\u0036\uFEFE" + - "\u4FCF\u5B6B\uFEFE\uFEFE\u5DA7\uFEFE\uFEFE\uFEFE\u5FBD\uFEFE\uFEFE\u6376\uFEFE\u6375\uFFFF\u0004" + - "\uFEFE\u66AE\u6749\u67B2\u4FD0\u5669\u5DA8\uFEFE\u8C6A\u48E2\uFFFF\t\uFEFE\u6B47\uFEFE\uFEFE" + - "\u4FD1\uFEFE\u4FD4\u4FD3\u4FD2\uFEFE\uFEFE\u6B46\uFEFE\u6CED\uFEFE\u6CEF\u51D1\uFEFE\uFEFE\u51D3" + - "\u6CEC\u6CEE\u51D2\u6CF1\u6CF0\u6CF2\uFFFF\b\uFEFE\u6F78\u6F76\u53DF\u6F75\u53E4\u53E1\u53DE" + - "\uFEFE\u53E5\uFEFE\u53E0\u53E3\uFEFE\u53E2\u6F77\uFEFE\u53DD\uFEFE\uFEFE\uFEFE\u566F\u7250\u7256" + - "\u566C\u5673\uFEFE\u566E\u7253\u7255\u5671\u724F\u7252\u566D\u566A\u7251\u5670\u7254\u5672\u566B" + - "\uFFFF\u0004\uFEFE\u7589\u758C\u58D5\uFEFE\u58DF\u58DB\u758A\uFEFE\uFEFE\u58E3\u58DC\u58E1\u58D7" + - "\uFEFE\u58D4\u58D6\u58E2\u758B\u58DA\u58DD\u58D9\u58DE\u758D\u58E0\u58D8\u7588\uFFFF\b\uFEFE" + - "\u78F2\u5B6C\u78F4\uFEFE\u5B6E\u5B70\uFEFE\u78F3\u5B6D\u5B71\uFEFE\u5B6F\uFEFE\uFEFE\uFEFE\u5DAE" + - "\u7CAA\u5DB6\u7CA7\uFEFE\u5DB7\u5DAC\uFEFE\u7CA8\uFEFE\uFEFE\u5DB1\uFEFE\u7CA9\u5DAA\u5DA9\uFEFE" + - "\u5DB4\u5DB3\u5DB2\u5DB0\u5DB5\u7CA6\u5DAB\u5DAD\u5DAF\uFEFE\uFEFE\u5FBF\u5FC2\uFEFE\u5FC6\u5FC0" + - "\u5FC5\u5FC3\uFEFE\u5FBE\uFEFE\u5FC4\u5FC1\uFEFE\uFEFE\uFEFE\u82FB\u61CB\u61C9\uFEFE\u82FC\uFEFE" + - "\u61CC\u61CA\u82FA\u82F9\uFEFE\u637A\u82F8\u6378\u6377\u85FA\u61CD\u6379\u85FB\u637C\u85FC\u637B" + - "\u64E1\u8890\u64E0\u64E5\u64E3\u64E4\u65CD\u64E2\u888F\u85FD\u65CC\u65CE\uFEFE\u66AF\u66B0\uFEFE" + - "\u8DAF\uFEFE\u686A\u6869\u4FD6\uFEFE\uFEFE\u69F4\u5674\uFEFE\u69F1\u69F2\u69F0\uFEFE\u69F3\uFEFE" + - "\uFEFE\u6B4B\u6B48\u6B4D\u6B49\u4FD7\u4FDA\uFEFE\u6B4A\u4FD9\u6B4C\uFEFE\uFEFE\u4FD8\uFFFF\u0004" + - "\uFEFE\u6CF5\u6CF7\u51D6\u6CF3\u6CF6\u6CF4\u51D4\u51D7\uFEFE\u51D5\uFFFF\u0004\uFEFE\u6F7A\u6F7E" + - "\u6F7B\uFEFE\u53E8\uFEFE\u53E9\uFEFE\u6F7D\uFEFE\u6F7F\u6F82\uFEFE\u53E6\u6F81\uFEFE\uFEFE\u53E7" + - "\uFFFF\u0005\uFEFE\u7594\u6F7C\u0000\u0003\u7257\u605E\u595A\u5F61\u5676\uFEFE\u725C\u7258\u5675" + - "\u5677\u725B\u7262\u725D\uFEFE\uFEFE\u58E4\u7597\u758F\u7595\u7596\u58E5\uFEFE\u758E\u7590\u6F79" + - "\u7592\u7593\u7591\u5B73\uFEFE\uFEFE\uFEFE\u78FB\u8641\u78FC\u78F9\u58E6\u5B75\u78F8\u7941\u78FD" + - "\u5B72\u7944\u78F7\u7943\u78F5\u7942\u78FA\u5B74\uFEFE\u7CB1\uFEFE\u7CAC\u7CB2\u7CAD\u7CAB\u7CAE" + - "\u5DB8\uFEFE\u7CB0\uFEFE\u7CAF\u5DB9\u5FC8\u5FC7\u7FD7\u7FDA\u7FD2\u7FD6\u5FC9\u7FD5\u7FD3\u7FD9" + - "\u7FD4\u7FD1\u7FD8\uFEFE\u8345\u61D0\u8A98\u8342\u8343\u8341\u78F6\u61CF\u8346\u82FD\u61CE\u61D1" + - "\u8344\u8642\u637D\u8643\u8644\uFEFE\u8891\u64E6\u8A99\u8A9A\uFEFE\uFEFE\u8A9B\u8C6C\u8C6B\u8DB1" + - "\uFEFE\u8DB0\u8ECA\u8ECB\u8EC9\u8FB6\u67F9\u4FDB\u53EB\u53EA\u567A\u5679\u7264\u7265\u7263\uFEFE" + - "\u5678\u759B\uFEFE\u759C\u7598\u58E7\u7599\uFEFE\u759A\uFFFF\u0004\uFEFE\u7947\u7949\u7945\u7948" + - "\u5B76\u7946\u5B77\uFEFE\uFEFE\u79F9\u5DBC\u5DBB\uFEFE\u5DBA\uFEFE\u7CB3\u7CB4\uFEFE\uFEFE\u7FDC" + - "\u7FDE\u5FCD\u5FCA\uFEFE\u5FCC\u5FCB\u7FDD\u7FDB\uFFFF\u0005\uFEFE\u834D\u834A\u834B\u61D5\u834C" + - "\u8347\u8348\u61D2\uFEFE\u61D3\u8349\u61D4\uFEFE\u8648\uFEFE\u8649\u8646\u8647\u637E\u8645\uFFFF" + - "\u0005\uFEFE\u8895\u8892\u8894\u64E9\u8898\u64E8\u8896\u8899\u8897\u8893\u64E7\uFEFE\u8A9D\uFEFE" + - "\u8A9E\u8A9C\uFEFE\u8AA0\u65CF\u65D0\u8C6E\u66B2\u8A9F\u8C6D\u66B1\u8DB4\u8DB5\u676A\u8DB3\uFEFE" + - "\u8DB2\uFEFE\u8ECC\u67B3\uFEFE\u9079\u90D7\u90D6\uFEFE\u688F\u68A9\u90D8\u9183\uFEFE\u68BB\u4FDC" + - "\u51D8\uFEFE\u5DBD\uFEFE\u676B\u4FDD\u53EC\u58E8\u5B78\u65D1\u51D9\uFEFE\u6F84\u6F83\u7266\uFEFE" + - "\u567D\u567B\u567F\u7268\uFEFE\u567E\u567C\uFFFF\u0004\uFEFE\u7267\u58EB\u75A2\uFEFE\u58EA\u58EC" + - "\u75A7\u58EE\u75A4\u75A5\u759D\u58ED\u75A8\uFEFE\uFEFE\u759F\uFEFE\u75A0\u759E\u58E9\uFEFE\u75A6" + - "\u75A1\u75A3\uFEFE\uFEFE\uFEFE\u7955\uFEFE\u0000\u0003\u7954\u524A\u594D\u575E\u7956\u5B81\uFEFE" + - "\u5B7C\u794B\uFEFE\u7951\u5B7E\uFEFE\u7950\u5B7F\u5B82\u7953\uFEFE\u5B79\u5B7A\u795F\u795D\uFEFE" + - "\u795C\u794E\uFEFE\u795A\uFEFE\u5B7D\uFFFF\u0004\uFEFE\u5B7B\u795B\u794C\u794F\u7958\uFFFF\u0005" + - "\uFEFE\u8044\u7CBE\uFEFE\u7CB7\u7CCA\u7CD3\u7CBA\u5DC8\uFEFE\u7CC7\u5DBE\u5DC0\u5DCC\u7CB8\uFEFE" + - "\uFEFE\u5DC1\u5DC3\u5DCD\u5DC2\uFFFF\u0004\uFEFE\u5DCB\u7CC0\uFEFE\u7CB5\u5DC9\u7CBF\u5DC5\u7CD1" + - "\u5DCA\u7CCF\u7CC3\u7CCD\u5DC7\u7CB6\u7CD0\u7CCB\uFEFE\u7CD2\u5DBF\uFEFE\uFEFE\u5DCE\u5DC4\uFEFE" + - "\uFEFE\u7CBC\uFEFE\u7CC4\u7CC8\uFEFE\u7CCC\u5DC6\u7CBB\u7CB9\u7CC5\uFFFF\u0004\uFEFE\u7CC2\u7CC1" + - "\uFEFE\u7CC6\u7CC9\uFEFE\u7CCE\uFEFE\uFEFE\uFEFE\u7FE1\uFEFE\u5FCE\u7FEB\u7FE3\u5FD3\u5FD7\u7FF4" + - "\u7FFC\u7FED\u5FCF\uFEFE\u7FF1\u7CBD\uFEFE\u5FD0\u7FF8\u7FFD\u7FF5\uFEFE\u7FF7\u8043\u7FF9\u7FE7" + - "\u7FF0\uFEFE\uFEFE\u5FD8\uFEFE\u5FD4\u7FE5\u7FF2\u5FD2\u7FEC\u5FD1\u7FFA\u7FE9\u7FE2\u5FD5\u8042" + - "\uFEFE\uFEFE\u0000\u0003\u7FE4\uF6F3\uEEE0\uDFE8\u7FFB\u5FD6\u8041\u7FE6\u7FEA\u61DA\uFFFF\u0005" + - "\uFEFE\u61E2\u61DD\u836E\u836B\u8353\u61D8\uFEFE\uFEFE\uFEFE\u61D7\u61DE\uFEFE\uFEFE\uFEFE\u8351" + - "\u61DC\u835D\u834F\u8350\u61D6\u836D\u61E0\u8360\u8365\u835F\u865B\u835B\u8363\u8361\u8354\u834E" + - "\u8369\u61DF\u836A\uFEFE\u8364\uFEFE\u8359\u8357\u8352\uFEFE\uFEFE\uFEFE\u835A\u8367\u8356\u8366" + - "\u836C\uFEFE\uFEFE\u61DB\uFEFE\u8362\u8368\u835E\u8358\u61D9\uFEFE\uFEFE\uFEFE\u7FEF\u835C\u61E1" + - "\u8355\uFFFF\u0005\uFEFE\u8661\u6382\u8660\u865D\u8670\u6386\uFEFE\u866D\u8665\u866F\u8656\u8663" + - "\uFEFE\u6388\uFEFE\u864E\uFEFE\u864C\u866E\uFEFE\u866C\u866B\u865A\u8659\u864F\u638A\uFEFE\u8655" + - "\u865F\u866A\u638D\u8671\uFEFE\u64F1\u638F\u6389\u8653\uFEFE\u865C\u864B\u864D\u637F\u638C\u6385" + - "\u8654\u8664\u865E\u638B\u864A\u64EC\u8666\u8669\u6387\uFEFE\u8658\u638E\u6384\uFEFE\uFEFE\uFEFE" + - "\u6383\u8662\u8668\u6381\uFEFE\u8651\u8667\uFEFE\uFEFE\u8652\uFFFF\t\uFEFE\u8657\u889F\uFEFE" + - "\u88A4\u64EE\u64F0\u88AA\u64EA\u88B9\u88B0\u88A5\u88A6\u88AF\uFEFE\u64F7\u88AE\u889E\u88AD\u88A1" + - "\u88BA\u64F6\u64F4\u88A2\uFEFE\u88B5\uFEFE\u88A7\u88B4\uFEFE\u88B6\u889D\u64EF\uFEFE\u88B7\uFEFE" + - "\uFEFE\u88AB\uFEFE\u64F3\u88A8\uFEFE\uFEFE\u64F5\u88B1\uFEFE\uFEFE\uFEFE\u64ED\u88A3\u88B2\uFEFE" + - "\u88AC\u8650\u88B3\u88A0\uFEFE\u64F2\uFEFE\u88B8\uFEFE\u64EB\u889B\uFFFF\u0004\uFEFE\u8AAE\u8AA7" + - "\u65D3\uFEFE\u8AA2\u8AB1\u8AA9\u88A9\uFEFE\u8AB3\u8AA3\uFEFE\u65D2\u8AAD\u65D4\u65DC\u65DA\u8AAF" + - "\u65DB\u8AA5\uFEFE\u8AA6\u8AAB\u8AB0\uFEFE\u889A\u65D5\u8AB8\u8AB5\u8AB9\u8AAC\u8AA8\u8AB6\u8C79" + - "\u8AAA\uFEFE\u65D8\uFEFE\u65D7\u889C\u65D9\u8AB2\u8AB4\u65D6\u8AB7\u8AA1\uFEFE\u8AA4\uFFFF\b" + - "\uFEFE\u8C83\uFEFE\u8C72\u66B6\u8C81\uFEFE\uFEFE\u8C70\u66B7\uFEFE\u8C7B\uFEFE\u8C77\u66BC\u8C82" + - "\u8C71\u8C74\u66B4\u8C84\uFEFE\u8C7C\u8C7F\u66BA\u66BF\u66BD\u8C78\u8C73\uFEFE\u66B8\u66B9\u8C6F" + - "\u66B5\uFEFE\u66B3\u66BB\u8C7E\u66BE\uFEFE\u8C7A\u8C85\u66C0\uFEFE\uFEFE\uFEFE\u8C76\uFEFE\u8C7D" + - "\uFFFF\u0006\uFEFE\u8DC2\u8DD0\u8DC4\u8DCB\u8C75\u8DC9\u8DB8\u8DCE\u676E\u8DBC\u8DCD\u8DC3\uFEFE" + - "\uFEFE\u676D\uFEFE\uFEFE\u8DD2\u8DC5\uFEFE\u0000\u0006\u8DCA\uCCB6\uCFC1\uC6BA\uBED1\uC8B7\uBBBD" + - "\u8DC7\uFEFE\u676C\u8DC0\uFFFF\u0006\uFEFE\u8DB9\uFFFF\u0007\uFEFE\u8DBF\u8ED0\u8ED5\u67BA\u8ED7" + - "\uFEFE\u67B4\uFEFE\u8ED3\u8ED9\u67B9\u67B5\uFEFE\u67B6\u8ECF\u8ED6\u67B8\u8ED4\u67B7\u8ECE\u8ED2" + - "\u8ED1\uFEFE\u8ECD\u8ED8\uFEFE\uFEFE\uFEFE\u67FA\u0000\u0003\u8FBD\uC0BC\uBEBF\uB9BA\u8FB7\uFEFE" + - "\uFEFE\u8FBB\u8FB8\u67FB\u67FC\uFEFE\uFEFE\u907B\uFEFE\u907D\uFFFF\u0005\uFEFE\u907C\u907E\uFEFE" + - "\u686C\uFEFE\u907A\u686B\u686D\uFEFE\uFEFE\uFEFE\u90DA\u90DB\u6890\u90D9\uFEFE\u9164\u9163\u9165" + - "\u68AB\u9166\u68AA\u9167\u9184\u9187\u9186\u68B4\u9185\uFEFE\uFEFE\uFEFE\u68BE\u68BC\u68BD\u68C3" + - "\u91B0\u91B1\u91AF\u91B9\uFFFF\u00F3\uFEFE\u51DA\uFEFE\uFEFE\u75A9\u7960\u836F\u8C86\uFEFE\uFEFE" + - "\u51DB\uFEFE\u53ED\u5681\uFEFE\uFEFE\u75AA\uFEFE\u75AB\u58EF\uFEFE\u5B85\u7962\u7961\u5B89\u5B84" + - "\u7963\u5B86\u5B88\u5B87\u5B83\uFEFE\uFEFE\uFEFE\u5DCF\uFEFE\uFEFE\u7CD7\u7CD5\uFEFE\u7CD6\u7CD4" + - "\uFEFE\u5FD9\uFEFE\u5FDC\u5FDE\u5FDD\uFEFE\uFEFE\u5FDA\u5FDB\uFEFE\u8371\u8370\u61E3\u8372\uFEFE" + - "\u8373\u61E4\uFEFE\uFEFE\uFEFE\u8679\u8677\u88C0\uFEFE\u8675\u8676\u6390\u8672\u867A\u8674\u8678" + - "\u88BC\uFEFE\uFEFE\u88BE\uFEFE\u88BF\u64FC\u88BB\u64FB\u88BD\u64F8\u64F9\u64FA\u8673\uFEFE\uFEFE" + - "\u65DF\u8ABC\u8ABA\u8ABB\u65DD\u65E0\u65DE\uFEFE\uFEFE\uFEFE\u8C87\u8C88\u66C1\uFEFE\u8DD3\u8DD5" + - "\u8DD4\u676F\u67BB\u8EDC\u8EDB\u8EDA\uFFFF\u0036\uFEFE\u51DC\uFEFE\u698A\uFEFE\u69F7\u4E8B\u69F5" + - "\u69F8\u69F6\uFEFE\uFEFE\uFEFE\u6B4F\uFEFE\u4FE1\uFEFE\u4FE2\u6B51\u4FDF\u6B50\u6B4E\u4FE0\u4FDE" + - "\uFFFF\u0006\uFEFE\u6CF8\u6CFB\u51DF\u6CFA\u6CF9\uFEFE\u51DE\u51DD\uFEFE\u51E1\u6CFC\u51E0\uFFFF" + - "\u0005\uFEFE\u6F89\u53EF\u53F0\u53F1\u6F8A\u6F86\u53EE\u6F87\uFEFE\u6F88\u6F85\uFEFE\uFEFE\uFEFE" + - "\u5688\uFEFE\uFEFE\u5685\u7269\u5686\u5689\u726A\uFEFE\u5684\u5682\u5683\u5687\uFFFF\u0005\uFEFE" + - "\u58F0\u75AE\u58F8\u75AD\uFEFE\u75B0\u58F4\u75AF\u5B91\u58F2\u58F5\u58F1\u58F6\u58F7\u58F3\uFEFE" + - "\uFEFE\uFEFE\u75AC\u5B8D\u7965\uFEFE\u7969\uFEFE\uFEFE\u7968\u5B92\u5B8E\u5B8F\u7964\u7966\u7967" + - "\u5B8A\u5B8C\uFEFE\u5B90\u5B8B\uFEFE\uFEFE\u7CDA\u7CD8\u7CD9\u5DD1\u5DD2\uFEFE\u7CDB\u5DD0\u5FDF" + - "\uFEFE\u5FE1\u5FE0\uFEFE\u8045\uFEFE\uFEFE\u8046\u8375\uFEFE\u8374\uFEFE\uFEFE\u6391\u6392\u867B" + - "\u6393\uFEFE\u88C3\uFEFE\u88C1\uFEFE\u88C2\u64FD\uFEFE\u8ABD\u66C2\uFEFE\u48EB\uFEFE\u6541\u51E2" + - "\uFEFE\u568A\u726B\uFEFE\uFEFE\u75B1\u58F9\u5B93\u796A\u796C\u5B95\u5B94\u5B96\u5B97\u796B\u5DD5" + - "\u5DD6\u5DD4\u5FE2\u5DD3\u7CDC\uFEFE\uFEFE\uFEFE\u5FE3\u8376\u867C\u6394\u6542\u8ABE\u8AC2\u65E3" + - "\u8ABF\u65E4\u65E2\u8AC3\u65E5\u8AC1\uFEFE\u8C89\u65E1\u66C3\uFEFE\u90DC\uFEFE\uFEFE\u51E3\u58FB" + - "\u58FA\uFFFF\u0004\uFEFE\u5B98\u796E\u796D\u5B99\uFEFE\uFEFE\u7CE0\u5DDA\u5DD7\u7CDF\u5DD9\u7CDD" + - "\u5DD8\uFEFE\u7CDE\uFEFE\u8047\u5FE4\uFEFE\u8379\uFEFE\u61E5\u8377\u61E6\u61E7\u8378\u61E8\uFEFE" + - "\u867D\uFEFE\u6398\u6395\u639A\u867F\u6396\u867E\u6399\uFEFE\uFEFE\u6397\uFEFE\u88C6\u88C8\uFEFE" + - "\uFEFE\u6543\u88C7\u6544\u88C5\u88C4\uFEFE\u8AC5\u8AC4\u65E6\u8AC6\u8C8E\u66C5\u8C8D\u8C8A\u66C4" + - "\u8C8B\u8C8C\uFEFE\u8DD6\u8DD7\u6770\uFEFE\u67BE\uFEFE\uFEFE\u8EDD\uFEFE\uFEFE\u67BC\u67BD\u8EDE" + - "\uFEFE\uFEFE\u67FD\u6841\u8FC1\uFEFE\uFEFE\u6891\u90DE\u6893\uFEFE\u90DD\u90DF\u6892\u9168\uFEFE" + - "\u919D\uFFFF\u0006\uFEFE\u51E4\uFEFE\uFEFE\uFEFE\u5DDB\uFEFE\u8048\uFEFE\u837A\u639B\u639C\uFEFE" + - "\u51E5\uFEFE\u61E9\u66C6\u53F2\uFEFE\uFEFE\uFEFE\u639D\uFEFE\u686E\u53F3\u75B2\uFEFE\u796F\uFEFE" + - "\u7971\uFEFE\u7970\uFEFE\u7CE4\u7CE1\u5DDC\uFEFE\u5DDD\u7CE2\u7CE3\uFEFE\u804A\u804F\u5FE5\u0000" + - "\u0003\u8049\u4B52\u4D51\u4E4C\u8050\u5FE6\uFEFE\uFEFE\u837D\uFEFE\u837B\u61EB\uFEFE\u61EA\u837C" + - "\u61EC\uFFFF\u0004\uFEFE\u8683\uFEFE\uFEFE\u8682\u639E\u8681\u88C9\uFEFE\u88CB\u88CD\u88CC\uFEFE" + - "\u6545\u88CA\u8ACD\u65E7\u8ACB\u8ACE\u65E8\uFEFE\u8AC9\uFEFE\u8ACC\u8ACA\u8AC7\u65E9\u8AC8\uFFFF" + - "\u0004\uFEFE\u8C8F\uFEFE\uFEFE\u8C91\u8C90\uFEFE\u8DD8\uFEFE\u8DD9\uFEFE\uFEFE\uFEFE\u8EDF\uFEFE" + - "\u6843\uFEFE\u6842\u907F\u9081\u6894\u90E0\uFEFE\u68B5\uFEFE\u53F4\u5B9A\u8054\u8053\u837F\u837E" + - "\uFEFE\uFEFE\u6546\u88CF\u88CE\u8AD1\u8ACF\u8AD2\u8AD0\uFEFE\uFEFE\u66C7\u8C92\u8C93\u8C94\uFEFE" + - "\u8EE0\uFEFE\u8FC2\uFEFE\u90E1\uFFFF\u0007\uFEFE\u53F5\uFEFE\uFEFE\u8684\u88D0\uFEFE\u53F6\uFEFE" + - "\uFEFE\u5FE7\uFEFE\u8685\u65EA\u8AD3\u66C8\uFEFE\u8DDA\u8DDB\u67BF\u9082\u53F7\u5941\u5942\u75B3" + - "\u5B9B\u5B9C\u7972\u5B9D\uFEFE\u5DE1\uFEFE\u5DE3\u7CE6\u7CE7\u7CE5\u5DDE\u5DDF\u5DE2\u5DE0\uFEFE" + - "\uFEFE\u8055\u5FE8\u5FE9\uFEFE\uFEFE\u8387\u61EF\u8382\u8381\uFEFE\u8386\u61ED\uFEFE\uFEFE\u63A5" + - "\uFEFE\u8383\u8388\u8385\u8384\uFEFE\u61EE\uFEFE\u63A3\uFEFE\u8687\u639F\uFEFE\u8688\uFEFE\uFEFE" + - "\u8686\uFEFE\u63A2\u63A0\u63A4\uFEFE\u63A1\uFFFF\u0005\uFEFE\u88D1\uFEFE\u88D6\u88D2\u88D5\u6547" + - "\uFEFE\u87C0\u88D4\u88D3\uFEFE\u65ED\u65EB\u65EE\u65EC\u8AD4\u8AD5\u8AD6\u65EF\uFEFE\uFEFE\uFEFE" + - "\u8C98\u66CA\u8C96\uFEFE\u66CB\u8C95\u8C97\u66C9\u8DDF\u8DDC\uFEFE\u8DDD\u8DDE\u8EE1\u67C1\uFEFE" + - "\u67C0\uFEFE\u8FC4\u8FC3\u6844\uFEFE\uFEFE\uFEFE\u686F\u6895\u68AC\u9169\u919E\u919F\uFFFF\u0033" + - "\uFEFE\u53F8\u7973\uFEFE\uFEFE\u7CE8\u8056\u8057\u5FEA\uFEFE\u5FEB\u8389\u61F0\uFEFE\uFEFE\u6548" + - "\uFEFE\u8AD7\uFEFE\u65F0\u8C9B\u66CC\u8C9A\u8C9C\u8C99\u8EE4\u8DE0\u8DE1\uFEFE\u6771\uFEFE\u8EE3" + - "\uFEFE\uFEFE\u8EE2\uFEFE\u8FC5\u91A0\uFFFF\u000E\uFEFE\u53F9\uFEFE\uFEFE\uFEFE\u53FA\uFEFE\uFEFE" + - "\u568B\u726C\uFEFE\u75B4\uFEFE\u5B9E\uFEFE\u5BA1\u5B9F\u7974\uFEFE\u5BA3\uFEFE\u5BA0\uFEFE\uFEFE" + - "\u5BA2\uFEFE\u5DE5\uFEFE\u7CE9\uFEFE\uFEFE\u7CEA\u838B\uFEFE\u5DE4\u5DE6\u5DE7\uFEFE\u8059\uFEFE" + - "\u8058\u5FEC\uFEFE\u5FED\uFEFE\u805A\u838A\u5FEF\u61F1\uFEFE\u5FEE\uFEFE\uFEFE\uFEFE\u63A6\u838C" + - "\u61F3\u61F2\u838D\u8390\u838E\u838F\u61F4\uFEFE\u63AB\u63A9\uFEFE\uFEFE\u63A8\u868A\uFEFE\u63AA" + - "\uFEFE\uFEFE\u8689\u88D7\uFEFE\u868B\u63A7\u868C\u88DA\u88D8\u88D9\u88DE\u65F4\u88DD\u88E0\u88DF" + - "\u88DC\u88DB\uFEFE\u6549\uFFFF\u0004\uFEFE\u8ADA\uFEFE\u8AD9\u65F3\u65F1\u65F2\uFEFE\u8AD8\uFEFE" + - "\u8C9F\uFEFE\u66CD\uFEFE\u8C9E\u8C9D\u66CE\uFEFE\u8DE6\u8DE5\uFEFE\u8DE3\uFEFE\u8DE2\u6773\u6772" + - "\u8DE7\u8FC6\u6845\u8EE6\u67C2\u8EE5\u8DE4\uFEFE\u8FC7\u6870\uFEFE\u68AD\u916A\uFEFE\u91A1\uFFFF" + - "\u0034\uFEFE\u53FB\u75B5\u88E1\u53FC\uFEFE\uFEFE\u805C\u805B\u868D\uFEFE\uFEFE\u88E3\uFEFE\u88E2" + - "\uFEFE\u65F5\u8CA0\u8CA1\u6774\uFEFE\uFEFE\u91A2\u568C\u5BA5\u5BA4\u7CEB\u7CED\u5DE9\u7CEC\u5DE8" + - "\u5DEA\u7CEE\uFEFE\uFEFE\uFEFE\u805E\u8060\u805F\uFEFE\u8062\uFEFE\uFEFE\uFEFE\u5FF0\u8061\u805D" + - "\uFEFE\uFEFE\uFEFE\u8063\uFEFE\u8397\uFEFE\u839A\u839C\u8392\u8396\u8393\u61F6\u61F9\u61FB\u8394" + - "\u8395\u61FA\u8398\u839B\u8399\u61FC\uFEFE\u61F8\u8391\u61F5\uFEFE\u61F7\uFEFE\uFEFE\u63AD\u8693" + - "\u8691\u8690\uFEFE\u8696\uFEFE\u8695\u8694\uFEFE\u868F\u63AC\u868E\uFEFE\u8692\u63AE\uFEFE\uFEFE" + - "\u88E6\uFEFE\u0000\u0004\u88EA\uE7E9\uE8E5\uEBEE\uECED\u654B\uFEFE\u654A\u88E4\u88EF\u8ADF\u8AE2" + - "\u8AE4\u8AE3\uFEFE\u8ADD\u8AE1\u8ADC\uFEFE\u8ADE\u65F6\u8ADB\uFEFE\u8AE0\uFEFE\uFEFE\u8CAE\u8CA3" + - "\u66CF\uFEFE\uFEFE\u66D0\u8CA2\u8CA7\u8CAD\u8CA5\u8CAC\uFEFE\u8CA9\uFEFE\u8CA8\u8CAB\u8CA6\u8CA4" + - "\uFEFE\u8CAA\uFEFE\u8DEE\u8DEC\u6775\u8DEB\u8DF1\u8DEF\uFEFE\u6776\u8DEA\u8DE8\uFEFE\u8DE9\u6778" + - "\u8DED\u6777\u8DF0\u8EE7\u8EED\uFEFE\uFEFE\u8EE8\u67C6\u8EEE\u67C5\u8EEC\u8EEB\u67C4\u8EEA\u67C3" + - "\u8EE9\uFEFE\u8FCD\u8FCF\u8FCE\uFEFE\u8FCB\u6847\u8FC8\u8FCC\u8FD1\uFEFE\u8FD0\u8FC9\u8FCA\u6846" + - "\u9083\u6873\uFEFE\u9084\u6871\u6872\uFEFE\uFEFE\u90E2\u6896\u9188\uFEFE\u68B6\uFEFE\u91A3\u68B7" + - "\u91A4\u91A5\u91B3\u91B2\u68C6\u91BD\uFFFF\u003C\uFEFE\u568D\uFEFE\uFEFE\u7CF0\uFEFE\u7CEF\uFEFE" + - "\u5FF1\u5FF2\u8064\uFEFE\u839D\u8699\uFEFE\uFEFE\u61FD\u63AF\u8697\uFEFE\u869A\u63B0\uFEFE\u88F0" + - "\u8698\u8AE5\u65F7\u8CAF\uFEFE\uFEFE\uFEFE\u8DF4\u8DF2\uFEFE\uFEFE\u8DF3\uFEFE\uFEFE\u8EEF\uFEFE" + - "\u67C7\u8FD2\u6876\u6848\u6874\u6875\u90E3\u68AE\uFEFE\u568E\uFEFE\uFEFE\uFEFE\u8AE6\uFEFE\uFEFE" + - "\u726D\uFEFE\u5DEB\uFEFE\u8065\uFEFE\uFEFE\u5FF3\u8066\uFEFE\uFEFE\uFEFE\u839F\u839E\u63B2\u6241" + - "\u6242\uFEFE\u83A2\u83A1\u83A0\uFEFE\uFEFE\u869B\u869E\uFEFE\u869D\u869C\u63B1\u88F4\u88F2\u88F1" + - "\uFEFE\uFEFE\u88F3\uFEFE\u65F8\u8AE8\u8AE9\u65F9\uFEFE\u8AE7\uFEFE\u8CB1\u8CB0\u8CB3\u66D1\u8CB2" + - "\uFEFE\u8DF5\u8DF7\u8DF6\uFEFE\uFEFE\u8EF0\u8EF3\u8EF1\u8EF2\u8FD3\u6849\uFEFE\uFEFE\uFEFE\u9085" + - "\u9086\u9087\uFEFE\u6897\u68AF\u91A6\u568F\uFEFE\u6243\u63B3\u8AEA\uFEFE\u8FD4\uFEFE\uFEFE\u91B4" + - "\u726E\uFEFE\u68C7\u5690\u869F\uFEFE\u8AEB\uFEFE\u8CB4\uFEFE\uFEFE\u8EF4\u8FD5\u5691\uFEFE\u8067" + - "\u8068\uFEFE\u5FF4\u5FF5\u83A4\u6245\u6244\u83A3\uFEFE\u88F5\uFEFE\u8AEC\u8AEE\u8AED\u65FC\u65FB" + - "\u65FA\uFEFE\u67C9\u8EF5\uFEFE\u67C8\u8FD7\u8FD6\uFEFE\u6898\u90E4\u5943\u7CF1\uFEFE\uFEFE\uFEFE" + - "\u806B\u8069\u806A\uFEFE\uFEFE\u83AD\uFEFE\u83A8\u83A5\u83AC\uFEFE\uFEFE\uFEFE\u83AE\uFEFE\uFEFE" + - "\u6247\u83AB\u83A7\uFEFE\uFEFE\u83A6\u83AA\u83A9\u6246\uFEFE\uFEFE\u86AA\u86A5\u86A3\u86AC\u86A4" + - "\uFEFE\u86A0\uFEFE\u86A6\uFEFE\uFEFE\u86A1\u8941\u86A2\u86AD\uFFFF\u0007\uFEFE\u86A9\u63B4\u86A8" + - "\u86A7\uFEFE\u86AB\uFFFF\u0004\uFEFE\u88F6\u88F9\uFEFE\uFEFE\u88F8\uFEFE\u8943\u88FB\u8942\uFEFE" + - "\u88FD\u88FC\u88FA\uFEFE\u88F7\uFEFE\u654E\u654D\uFEFE\u654F\u654C\u8944\uFFFF\u0005\uFEFE\u8AF4" + - "\u8AF7\uFEFE\u8AF5\u8AF9\uFEFE\uFEFE\uFEFE\u8AFA\uFEFE\u8AF2\u6644\u8AF3\uFEFE\u8AF1\u8AF8\uFEFE" + - "\u8AF0\u8AEF\u6643\u6641\u65FD\uFFFF\b\uFEFE\u8AF6\u8CBD\u8CC3\u66D4\u8CBE\uFEFE\u8CC1\u8CC5" + - "\u66D5\u8CC0\uFEFE\u8CB8\uFEFE\u8CB7\u8CC4\u8CBB\uFEFE\u8CB9\u8CC2\u8CBA\u66D3\u66D2\uFEFE\u8CB5" + - "\u8CB6\u8CBF\uFEFE\uFEFE\uFEFE\u8CBC\uFFFF\u0006\uFEFE\u8DFA\u8DFD\uFFFF\u0004\uFEFE\u6642\uFFFF" + - "\u0007\uFEFE\u8DFB\u8E44\u8E42\u8DF9\u8E47\uFEFE\u8DF8\uFEFE\u677A\u8E43\uFEFE\uFEFE\uFEFE\u8DFC" + - "\u6779\u8E46\uFEFE\uFEFE\u8E45\uFFFF\u0004\uFEFE\u8EF8\u8EF7\uFEFE\uFEFE\uFEFE\u8F41\uFEFE\u8EFA" + - "\u8EFD\u67CB\uFEFE\uFEFE\u8EFB\u8EFC\uFEFE\u8EF6\u8EF9\u67CA\uFEFE\uFEFE\uFEFE\u684B\u8FE2\u8FDD" + - "\u8FE1\uFEFE\u8FE4\u8FE0\uFEFE\u8FDC\uFEFE\u684D\u8FDF\u8FE3\u684C\u8FDA\u8E41\u8FDE\uFEFE\uFEFE" + - "\u8FDB\uFEFE\u8FD8\uFEFE\u8FD9\u684A\u908B\u908D\u9090\u908C\u9091\uFEFE\u908A\uFEFE\u9088\uFEFE" + - "\u6877\u908E\u6879\u6878\u9089\u908F\uFFFF\u0004\uFEFE\u90E9\u6899\u90EA\uFEFE\u90E8\u90E5\uFEFE" + - "\uFEFE\u90E7\u90E6\u916B\uFFFF\u0004\uFEFE\u916D\u916C\uFEFE\uFEFE\u918B\uFEFE\u918A\u9189\u918C" + - "\uFEFE\u68BF\u68C0\u91BA\u91BE\uFFFF\u006A\uFEFE\u5944\u7975\u7CF4\uFEFE\u5DEC\u7CF2\uFEFE\uFEFE" + - "\u7CF3\uFEFE\uFEFE\uFEFE\u806C\u806D\u5FF8\u5FF6\u806E\u5FF7\u83B3\uFEFE\u83B6\u83B0\u83B7\u83AF" + - "\u83B1\uFEFE\u83B2\u83B5\uFEFE\uFEFE\u624A\u83BA\u83B9\u6248\u83B4\u83B8\u6249\uFFFF\u0006\uFEFE" + - "\u86B7\uFEFE\u63B9\uFEFE\u86B2\u63B5\uFEFE\u86AF\u86B5\u86B8\uFEFE\u63BA\uFEFE\u86B4\u86B1\u86B9" + - "\u86B0\uFEFE\u86B6\u63B6\uFEFE\u86AE\u63B7\uFEFE\u63B8\u86B3\uFEFE\uFEFE\uFEFE\u8956\u8949\u894A" + - "\u894D\u894B\uFEFE\u8945\uFEFE\uFEFE\u8948\u8952\u894C\uFEFE\uFEFE\u6550\uFEFE\u8954\u8951\u6551" + - "\u8953\u8946\u894F\u8950\uFEFE\u894E\uFFFF\u0004\uFEFE\u8B41\u8B43\u8B46\uFEFE\uFEFE\u8AFD\uFEFE" + - "\u6645\u8B48\u8AFC\u8B49\uFEFE\u8B45\u8B47\u8B4B\u8B44\u8B4C\u8B42\u8AFB\u6646\uFEFE\u8B4A\u6647" + - "\u66D7\uFFFF\u0005\uFEFE\u8947\u8CDF\u8CD6\u66D9\u8CD2\u66DA\uFEFE\uFEFE\u8CDB\u8CD5\u8CCB\u66D8" + - "\u8CD8\u8CD3\u8CD4\uFEFE\u8CC6\u8CCD\u8CDC\uFEFE\u8CD9\uFEFE\u8CD1\uFEFE\u8CDD\u8CCC\u8CC7\u8CDA" + - "\uFEFE\u8CC9\u8CD7\u8CCE\u8CDE\u8CCA\u66D6\u8CC8\u8CCF\u8CD0\uFEFE\uFEFE\uFEFE\u8E4E\uFEFE\u8E4C" + - "\uFEFE\u8E51\uFEFE\u0000\u0007\u8E5D\u544D\u4956\u4F52\u4B59\u4850\u5557\u5A4A\uFEFE\u8E5E\u8E5F" + - "\u8E58\u8E5C\u8E53\uFEFE\u8F51\u8F54\uFEFE\u67CC\uFEFE\u8F53\u8F58\u8F56\u67CD\u8F4D\u8F43\u8F42" + - "\u67CF\u8F4F\u8F50\u8F4C\u8F44\uFEFE\u8F49\u8E5B\uFEFE\u8F45\u67CE\u8F4B\uFEFE\u8F4A\uFEFE\u8F46" + - "\u8F52\uFEFE\u0000\u0004\u8F47\uE955\u574E\u48EA\uECE6\u684E\uFEFE\u8FF3\u8FF1\u684F\u0000\u0003" + - "\u8FF0\uEFE8\uE5EB\uF4E7\u8FED\uFEFE\u909A\u909F\u9095\u9098\u687A\u909C\uFEFE\u90A3\u8FEE\uFEFE" + - "\u9096\u90A0\u90A4\u909B\u9094\u909E\uFEFE\u909D\u90A2\u90A1\u8FF2\u9099\u9093\u9097\u689A\u689B" + - "\u9092\uFEFE\u0000\u0005\u90F5\uECF4\uF1F2\uEBEE\uF6F0\uEFED\uFEFE\u90F3\uFEFE\u916E\uFEFE\u916F" + - "\uFEFE\u0000\u0003\u9171\u7073\u728E\u8DA7\uFEFE\u91A8\uFEFE\u91B5\u68C4\u68C8\uFEFE\u91BF\u68C9" + - "\uFFFF\u0056\uFEFE\u5945\uFEFE\uFEFE\uFEFE\u677B\u8F59\uFEFE\u689C\u689D\uFEFE\u5946\u7CF5\uFEFE" + - "\u5DED\u83BB\uFEFE\uFEFE\u86BB\u86BC\u86BA\u8958\u8957\u6552\u8B4E\u8959\u8B4D\uFEFE\uFEFE\u8CE1" + - "\u66DB\u66DD\u8CE0\uFEFE\uFEFE\u66DC\uFEFE\u8E60\u8E62\u8E61\u8F5A\u67D0\uFEFE\u687B\u90F7\u9174" + - "\uFEFE\uFEFE\u91C2\u5947\uFEFE\u806F\uFEFE\u624B\uFEFE\uFEFE\uFEFE\u86BE\u86BD\uFEFE\u895A\uFEFE" + - "\uFEFE\uFEFE\u66DE\u677C\u8FF5\u91BB\uFEFE\uFEFE\uFEFE\u5948\u5FF9\uFEFE\u624C\uFEFE\u8CE2\uFEFE" + - "\u90A5\u5BA6\uFFFF\u0004\uFEFE\u895B\uFEFE\uFEFE\uFEFE\u68B0\u5BA7\u624D\u6553\u90A6\u5BA8\uFEFE" + - "\u83BC\u63BC\u86BF\u86C0\uFEFE\u63BB\uFEFE\u895C\u6557\u6555\u6556\u6554\u8B4F\u6648\uFEFE\uFEFE" + - "\uFEFE\u8E64\u8E63\u8E66\u8E65\u677D\uFEFE\uFEFE\u8F5B\uFEFE\u8F5D\u8F5C\u67D1\u8FF6\uFEFE\u90A7" + - "\u90A8\u687C\u9175\u918F\u68C1\uFEFE\u7976\u86C1\u895D\u8CE3\u7CF6\uFEFE\u895E\u8B51\u8B50\uFFFF" + - "\u0004\uFEFE\u90A9\u689E\uFEFE\u9176\u9190\uFEFE\uFEFE\uFEFE\u5DEE\u83BD\u83BE\uFEFE\u86C2\u5DEF" + - "\uFEFE\u6649\u8B52\uFEFE\u8F5F\u67D2\u8F60\u8F5E\u90AA\uFEFE\u90F8\uFEFE\u5DF0\uFEFE\u8961\u8960" + - "\u895F\u8B53\uFEFE\uFEFE\u8B57\u8B56\u8B55\u8B54\u664A\u8CE4\u8E68\u677E\u8E67\u8F61\u8FF9\u8FF8" + - "\u6850\u8FF7\u90AD\u90AC\u90AB\uFEFE\uFEFE\u5FFA\uFEFE\u86C3\u6558\uFEFE\u8CE5\u8CE6\u8FFA\u90AE" + - "\uFEFE\uFEFE\u90F9\u9177\u91A9\u91C4\u5FFB\u6559\u8B58\u8CE7\u8F62\u90AF\uFEFE\uFEFE\u624F\uFEFE" + - "\u8962\u8B59\u8CE8\u8CE9\u8CEA\u8E6D\uFEFE\u8E69\u67D3\u8E6C\u8E6B\u677F\u8E6A\u6782\uFEFE\u6781" + - "\u8F64\u8F63\u67D4\u67D5\uFEFE\uFEFE\u6852\u8FFB\u6851\uFEFE\u90B2\u90B3\u90B1\u90B0\u68A0\uFEFE" + - "\u90FA\u90FB\u90FC\u689F\u9178\u917B\u917A\u9179\uFEFE\uFEFE\u91C3\uFFFF\u000E\uFEFE\u63BD\uFEFE" + - "\uFEFE\u6651\u8E6E\u8F65\uFEFE\u6853\u8FFC\uFEFE\uFEFE\u91C5\uFEFE\uFEFE\uFEFE\u63BE\uFEFE\uFEFE" + - "\uFEFE\u8963\uFEFE\u8FFD\uFEFE\u9191\uFFFF\u405B\uFEFE\uFFFE\u003F\uC241\uFFFE\u007D\uC281\uFFFE" + - "\u003F\uC341\uFFFE\u007D\uC381\uFFFE\u003F\uC441\uFFFE\u007D\uC481\uFFFE\u003F\uC541\uFFFE\u007D" + - "\uC581\uFFFE\u003F\uC641\uFFFE\u007D\uC681\uFFFE\u003F\uC741\uFFFE\u007D\uC781\uFFFE\u003F\uC841" + - "\uFFFE\u007D\uC881\uFFFE\u003F\uC941\uFFFE\u007D\uC981\uFFFE\u003F\uCA41\uFFFE\u007D\uCA81\uFFFE" + - "\u003F\uCB41\uFFFE\u007D\uCB81\uFFFE\u003F\uCC41\uFFFE\u007D\uCC81\uFFFE\u003F\uCD41\uFFFE\u007D" + - "\uCD81\uFFFE\u003F\uCE41\uFFFE\u007D\uCE81\uFFFE\u003F\uCF41\uFFFE\u007D\uCF81\uFFFE\u003F\uD041" + - "\uFFFE\u007D\uD081\uFFFE\u003F\uD141\uFFFE\u007D\uD181\uFFFE\u003F\uD241\uFFFE\u007D\uD281\uFFFE" + - "\u003F\uD341\uFFFE\u007D\uD381\uFFFE\u003F\uD441\uFFFE\u007D\uD481\uFFFE\u003F\uD541\uFFFE\u007D" + - "\uD581\uFFFE\u003F\uD641\uFFFE\u007D\uD681\uFFFE\u003F\uD741\uFFFE\u007D\uD781\uFFFE\u003F\uD841" + - "\uFFFE\u007D\uD881\uFFFE\u003F\uD941\uFFFE\u007D\uD981\uFFFE\u003F\uDA41\uFFFE\u007D\uDA81\uFFFE" + - "\u003F\uDB41\uFFFE\u007D\uDB81\uFFFE\u003F\uDC41\uFFFE\u007D\uDC81\uFFFE\u003F\uDD41\uFFFE\u007D" + - "\uDD81\uFFFE\u003F\uDE41\uFFFE\u007D\uDE81\uFFFE\u003F\uDF41\uFFFE\u007D\uDF81\uFFFE\u003F\uE041" + - "\uFFFE\u007D\uE081\uFFFE\u003F\uE141\uFFFE\u007D\uE181\uFFFE\u003F\uE241\uFFFE\u007D\uE281\uFEFE" + - "\uFEFE\u445C\uFFFE\u0004\u46A8\uFFFF\u01C9\uFEFE\u694B\u7AA4\uFFFF\u0422\uFEFE\u4741\u46A7\u4749" + - "\u0000\b\u46B6\uBCAC\uADAE\uAFB0\uB1A4\uA5B2\uB3B4\uB5A0\uA1A2\u46A3\uFFFF\u0004\uFEFE\u0000" + - "\u0003\u46BE\uBFC2\uC3C0\uC1BD\u4742\u4743\u4744\uFEFE\uFFFE\u0004\u4745\uFFFE\u0007\u474A\u4753" + - "\u4754\u46C4\uFFFE\u0005\u4755\uFEFE\uFFFE\u0004\u475A\uFFFF\u0095\uFEFE\u0000\u0004\u425A\u7F7B" + - "\uE06C\u507D\u4D5D\u46B8\u424E\u426B\u4260\u424B\u4261\uFFFE\n\u42F0\u0000\u0003\u427A\u5E4C" + - "\u7E6E\u6F7C\uFFFE\t\u42C1\uFFFE\t\u42D1\uFFFE\b\u42E2\u4444\u43E0\u4445\u4470\u426D" + - "\uFEFE\uFFFE\t\u4281\uFFFE\t\u4291\uFFFE\b\u42A2\u42C0\u424F\u42D0\uFFFF\u0082\uFEFE" + - "\u434A\u424A\u425F\u4751\u426A\u425B\uFFFF\u001A\uFEFE"; - - - ConvTable835() - { - super(835, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } - - ConvTable835(int ccsid) - { - super(ccsid, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable836.java b/cvsroot/src/com/ibm/as400/access/ConvTable836.java deleted file mode 100644 index fa4a48856..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable836.java +++ /dev/null @@ -1,24 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable836.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable836 extends ConvTable13124 -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable836() - { - super(836); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable837.java b/cvsroot/src/com/ibm/as400/access/ConvTable837.java deleted file mode 100644 index f8e50eeb7..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable837.java +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable837.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// This is a Simplified Chinese character set. -class ConvTable837 extends ConvTable4933 -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable837() - { - super(837); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable838.java b/cvsroot/src/com/ibm/as400/access/ConvTable838.java deleted file mode 100644 index 82f3e1206..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable838.java +++ /dev/null @@ -1,60 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable838.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable838 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07\u005B\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u0E48\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u005D\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u0E0F\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u005E\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u0E3F\u0E4E\u0E16\u0E17\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u0E4F\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u0E1D\u0E1E\u0E1F\u0E20\u0E21\u0E22" + - "\u0E5A\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u0E23\u0E24\u0E25\u0E26\u0E27\u0E28" + - "\u0E5B\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E" + - "\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59\u0E2F\u0E30\u0E31\u0E32\u0E33\u0E34" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u0E49\u0E35\u0E36\u0E37\u0E38\u0E39" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u0E3A\u0E40\u0E41\u0E42\u0E43\u0E44" + - "\\\u0E4A\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u0E45\u0E46\u0E47\u0E48\u0E49\u0E4A" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u0E4B\u0E4C\u0E4D\u0E4B\u0E4C\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE949\uE059\u696D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\u4A3F\u3F3F\u6A3F\u3F3F\u3F3F\u5F3F\uFFFF\u06A9\u3F3F\u3F42\u4344\u4546\u4748\u5253\u5455" + - "\u5657\u5862\u6364\u6566\u6768\u7273\u7475\u7677\u788A\u8B8C\u8D8E\u8F9A\u9B9C\u9D9E\u9FAA\uABAC" + - "\uADAE\uAFBA\uBBBC\uBDBE\uBFCB\uCCCD\uCECF\uDA3F\u3F3F\u3F70\uDBDC\uDDDE\uDFEA\uEBEC\uEDEE\uEFFA" + - "\uFBFC\u7180\uB0B1\uB2B3\uB4B5\uB6B7\uB8B9\u90A0\uFFFF\u78D2\u3F3F"; - - - ConvTable838() - { - super(838, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } - - ConvTable838(int ccsid) - { - super(ccsid, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable8492.java b/cvsroot/src/com/ibm/as400/access/ConvTable8492.java deleted file mode 100644 index 551e2ceaf..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable8492.java +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable8492.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// This is a Japanese character set. -class ConvTable8492 extends ConvTable16684 -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable8492() - { - super(8492); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable850.java b/cvsroot/src/com/ibm/as400/access/ConvTable850.java deleted file mode 100644 index 273fb89a3..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable850.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable850.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable850 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7\u00EA\u00EB\u00E8\u00EF\u00EE\u00EC\u00C4\u00C5" + - "\u00C9\u00E6\u00C6\u00F4\u00F6\u00F2\u00FB\u00F9\u00FF\u00D6\u00DC\u00F8\u00A3\u00D8\u00D7\u0192" + - "\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA\u00BF\u00AE\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB" + - "\u2591\u2592\u2593\u2502\u2524\u00C1\u00C2\u00C0\u00A9\u2563\u2551\u2557\u255D\u00A2\u00A5\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u00E3\u00C3\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u00A4" + - "\u00F0\u00D0\u00CA\u00CB\u00C8\u0131\u00CD\u00CE\u00CF\u2518\u250C\u2588\u2584\u00A6\u00CC\u2580" + - "\u00D3\u00DF\u00D4\u00D2\u00F5\u00D5\u00B5\u00FE\u00DE\u00DA\u00DB\u00D9\u00FD\u00DD\u00AF\u00B4" + - "\u00AD\u00B1\u2017\u00BE\u00B6\u00A7\u00F7\u00B8\u00B0\u00A8\u00B7\u00B9\u00B3\u00B2\u25A0\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFFAD\uBD9C\uCFBE\uDDF5\uF9B8\uA6AE\uAAF0\uA9EE\uF8F1\uFDFC\uEFE6\uF4FA\uF7FB" + - "\uA7AF\uACAB\uF3A8\uB7B5\uB6C7\u8E8F\u9280\uD490\uD2D3\uDED6\uD7D8\uD1A5\uE3E0\uE2E5\u999E\u9DEB" + - "\uE9EA\u9AED\uE8E1\u85A0\u83C6\u8486\u9187\u8A82\u8889\u8DA1\u8C8B\uD0A4\u95A2\u93E4\u94F6\u9B97" + - "\uA396\u81EC\uE798\uFFFF\u0018\u7F7F\u7FD5\uFFFF\u0030\u7F7F\u9F7F\uFFFF\u0F41\u7F7F\u7FF2\uFFFF" + - "\u0274\u7F7F\uC47F\uB37F\uFFFF\u0004\u7F7F\uDA7F\u7F7F\uBF7F\u7F7F\uC07F\u7F7F\uD97F\u7F7F\uC37F" + - "\u7F7F\u7F7F\u7F7F\uB47F\u7F7F\u7F7F\u7F7F\uC27F\u7F7F\u7F7F\u7F7F\uC17F\u7F7F\u7F7F\u7F7F\uC57F" + - "\uFFFF\t\u7F7F\uCDBA\u7F7F\uC97F\u7FBB\u7F7F\uC87F\u7FBC\u7F7F\uCC7F\u7FB9\u7F7F\uCB7F\u7FCA" + - "\u7F7F\uCE7F\uFFFF\t\u7F7F\uDF7F\u7F7F\uDC7F\u7F7F\uDB7F\u7F7F\u7F7F\u7F7F\u7FB0\uB1B2\uFFFF" + - "\u0006\u7F7F\uFE7F\uFFFF\u6D2F\u7F7F"; - - - ConvTable850() - { - super(850, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable851.java b/cvsroot/src/com/ibm/as400/access/ConvTable851.java deleted file mode 100644 index 87685a176..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable851.java +++ /dev/null @@ -1,60 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable851.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable851 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u00B6\u0015\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u0386\u00E7\u00EA\u00EB\u00E8\u00EF\u00EE\u0388\u00C4\u0389" + - "\u038A\u001A\u038C\u00F4\u00F6\u038E\u00FB\u00F9\u038F\u00D6\u00DC\u03AC\u00A3\u03AD\u03AE\u03AF" + - "\u03CA\u0390\u03CC\u03CD\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u00BD\u0398\u0399\u00AB\u00BB" + - "\u2591\u2592\u2593\u2502\u2524\u039A\u039B\u039C\u039D\u2563\u2551\u2557\u255D\u039E\u039F\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u03A0\u03A1\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u03A3" + - "\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03B1\u03B2\u03B3\u2518\u250C\u2588\u2584\u03B4\u03B5\u2580" + - "\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0\u03C1\u03C3\u03C2\u03C4\u00B4" + - "\u00AD\u00B1\u03C5\u03C6\u03C7\u00A7\u03C8\u00B8\u00B0\u00A8\u03C9\u03CB\u03B0\u03CE\u25A0\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u7F15\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFF7F\u7F9C\u7F7F\u7FF5\uF97F\u7FAE\u7FF0\u7F7F\uF8F1\u7F7F\uEF7F\u147F\uF77F" + - "\u7FAF\u7FAB\u7F7F\u7F7F\u7F7F\u8E7F\u7F80\uFFFF\u0007\u7F7F\u997F\u7F7F\u7F7F\u9A7F\u7F7F\u857F" + - "\u837F\u847F\u7F87\u8A82\u8889\u7F7F\u8C8B\u7F7F\u7F7F\u937F\u947F\u7F97\u7F96\u817F\uFFFF\u0144" + - "\u7F7F\u867F\u8D8F\u907F\u927F\u9598\uA1A4\uA5A6\uA7A8\uA9AA\uACAD\uB5B6\uB7B8\uBDBE\uC6C7\u7FCF" + - "\uD0D1\uD2D3\uD4D5\u7F7F\u9B9D\u9E9F\uFCD6\uD7D8\uDDDE\uE0E1\uE2E3\uE4E5\uE6E7\uE8E9\uEAEB\uEDEC" + - "\uEEF2\uF3F4\uF6FA\uA0FB\uA2A3\uFD7F\uFFFF\u1098\u7F7F\uC47F\uB37F\uFFFF\u0004\u7F7F\uDA7F\u7F7F" + - "\uBF7F\u7F7F\uC07F\u7F7F\uD97F\u7F7F\uC37F\u7F7F\u7F7F\u7F7F\uB47F\u7F7F\u7F7F\u7F7F\uC27F\u7F7F" + - "\u7F7F\u7F7F\uC17F\u7F7F\u7F7F\u7F7F\uC57F\uFFFF\t\u7F7F\uCDBA\u7F7F\uC97F\u7FBB\u7F7F\uC87F" + - "\u7FBC\u7F7F\uCC7F\u7FB9\u7F7F\uCB7F\u7FCA\u7F7F\uCE7F\uFFFF\t\u7F7F\uDF7F\u7F7F\uDC7F\u7F7F" + - "\uDB7F\u7F7F\u7F7F\u7F7F\u7FB0\uB1B2\uFFFF\u0006\u7F7F\uFE7F\uFFFF\u6D2F\u7F7F"; - - - ConvTable851() - { - super(851, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable852.java b/cvsroot/src/com/ibm/as400/access/ConvTable852.java deleted file mode 100644 index 3dfa18e46..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable852.java +++ /dev/null @@ -1,67 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable852.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable852 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u00B6\u0015\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u00C7\u00FC\u00E9\u00E2\u00E4\u016F\u0107\u00E7\u0142\u00EB\u0150\u0151\u00EE\u0179\u00C4\u0106" + - "\u00C9\u0139\u013A\u00F4\u00F6\u013D\u013E\u015A\u015B\u00D6\u00DC\u0164\u0165\u0141\u00D7\u010D" + - "\u00E1\u00ED\u00F3\u00FA\u0104\u0105\u017D\u017E\u0118\u0119\u001A\u017A\u010C\u015F\u00AB\u00BB" + - "\u2591\u2592\u2593\u2502\u2524\u00C1\u00C2\u011A\u015E\u2563\u2551\u2557\u255D\u017B\u017C\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u0102\u0103\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u00A4" + - "\u0111\u0110\u010E\u00CB\u010F\u0147\u00CD\u00CE\u011B\u2518\u250C\u2588\u2584\u0162\u016E\u2580" + - "\u00D3\u00DF\u00D4\u0143\u0144\u0148\u0160\u0161\u0154\u00DA\u0155\u0170\u00FD\u00DD\u0163\u00B4" + - "\u00AD\u02DD\u02DB\u02C7\u02D8\u00A7\u00F7\u00B8\u00B0\u00A8\u02D9\u0171\u0158\u0159\u25A0\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u7F15\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFF7F\u7F7F\uCF7F\u7FF5\uF97F\u7FAE\u7FF0\u7F7F\uF87F\u7F7F\uEF7F\u147F\uF77F" + - "\u7FAF\u7F7F\u7F7F\u7FB5\uB67F\u8E7F\u7F80\u7F90\u7FD3\u7FD6\uD77F\u7F7F\u7FE0\uE27F\u999E\u7F7F" + - "\uE97F\u9AED\u7FE1\u7FA0\u837F\u847F\u7F87\u7F82\u7F89\u7FA1\u8C7F\u7F7F\u7FA2\u937F\u94F6\u7F7F" + - "\uA37F\u81EC\u7F7F\u7F7F\uC6C7\uA4A5\u8F86\u7F7F\u7F7F\uAC9F\uD2D4\uD1D0\u7F7F\u7F7F\u7F7F\uA8A9" + - "\uB7D8\uFFFF\u000E\u7F7F\u7F91\u927F\u7F95\u967F\u7F9D\u88E3\uE47F\u7FD5\uE57F\u7F7F\u7F7F\u7F7F" + - "\u8A8B\u7F7F\uE8EA\u7F7F\uFCFD\u9798\u7F7F\uB8AD\uE6E7\uDDEE\u9B9C\uFFFF\u0004\u7F7F\uDE85\uEBFB" + - "\u7F7F\u7F7F\u7F7F\u7F8D\uABBD\uBEA6\uA77F\uFFFF\u00A3\u7F7F\u7FF3\uFFFF\b\u7F7F\uF4FA\u7FF2" + - "\u7FF1\uFFFF\u1111\u7F7F\uC47F\uB37F\uFFFF\u0004\u7F7F\uDA7F\u7F7F\uBF7F\u7F7F\uC07F\u7F7F\uD97F" + - "\u7F7F\uC37F\u7F7F\u7F7F\u7F7F\uB47F\u7F7F\u7F7F\u7F7F\uC27F\u7F7F\u7F7F\u7F7F\uC17F\u7F7F\u7F7F" + - "\u7F7F\uC57F\uFFFF\t\u7F7F\uCDBA\u7F7F\uC97F\u7FBB\u7F7F\uC87F\u7FBC\u7F7F\uCC7F\u7FB9\u7F7F" + - "\uCB7F\u7FCA\u7F7F\uCE7F\uFFFF\t\u7F7F\uDF7F\u7F7F\uDC7F\u7F7F\uDB7F\u7F7F\u7F7F\u7F7F\u7FB0" + - "\uB1B2\uFFFF\u0006\u7F7F\uFE7F\uFFFF\u6D2F\u7F7F"; - - - ConvTable852() - { - super(852, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } - - ConvTable852(int ccsid) - { - super(ccsid, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable855.java b/cvsroot/src/com/ibm/as400/access/ConvTable855.java deleted file mode 100644 index 0237e8111..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable855.java +++ /dev/null @@ -1,64 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable855.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable855 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u00B6\u0015\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u0452\u0402\u0453\u0403\u0451\u0401\u0454\u0404\u0455\u0405\u0456\u0406\u0457\u0407\u0458\u0408" + - "\u0459\u0409\u045A\u040A\u045B\u040B\u045C\u040C\u045E\u040E\u045F\u040F\u044E\u042E\u044A\u042A" + - "\u0430\u0410\u0431\u0411\u0446\u0426\u0434\u0414\u0435\u0415\u0444\u0424\u0433\u0413\u00AB\u00BB" + - "\u2591\u2592\u2593\u2502\u2524\u0445\u0425\u0438\u0418\u2563\u2551\u2557\u255D\u0439\u0419\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u043A\u041A\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u00A4" + - "\u043B\u041B\u043C\u041C\u043D\u041D\u043E\u041E\u043F\u2518\u250C\u2588\u2584\u041F\u044F\u2580" + - "\u042F\u0440\u0420\u0441\u0421\u0442\u0422\u0443\u0423\u0436\u0416\u0432\u0412\u044C\u042C\u2116" + - "\u00AD\u044B\u042B\u0437\u0417\u0448\u0428\u044D\u042D\u0449\u0429\u0447\u0427\u00A7\u25A0\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u7F15\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFF7F\u7F7F\uCF7F\u0000\u0003\u7FFD\u7FAE\uF07F\u7F7F\u7F7F\u147F\u7F7F\u7FAF" + - "\uFFFF\u01A2\u7F7F\u7F85\u8183\u8789\u8B8D\u8F91\u9395\u977F\u999B\uA1A3\uECAD\uA7A9\uEAF4\uB8BE" + - "\uC7D1\uD3D5\uD7DD\uE2E4\uE6E8\uABB6\uA5FC\uF6FA\u9FF2\uEEF8\u9DE0\uA0A2\uEBAC\uA6A8\uE9F3\uB7BD" + - "\uC6D0\uD2D4\uD6D8\uE1E3\uE5E7\uAAB5\uA4FB\uF5F9\u9EF1\uEDF7\u9CDE\u7F84\u8082\u8688\u8A8C\u8E90" + - "\u9294\u967F\u989A\uFFFF\u0E5B\u7F7F\uEF7F\uFFFF\u01F4\u7F7F\uC47F\uB37F\uFFFF\u0004\u7F7F\uDA7F" + - "\u7F7F\uBF7F\u7F7F\uC07F\u7F7F\uD97F\u7F7F\uC37F\u7F7F\u7F7F\u7F7F\uB47F\u7F7F\u7F7F\u7F7F\uC27F" + - "\u7F7F\u7F7F\u7F7F\uC17F\u7F7F\u7F7F\u7F7F\uC57F\uFFFF\t\u7F7F\uCDBA\u7F7F\uC97F\u7FBB\u7F7F" + - "\uC87F\u7FBC\u7F7F\uCC7F\u7FB9\u7F7F\uCB7F\u7FCA\u7F7F\uCE7F\uFFFF\t\u7F7F\uDF7F\u7F7F\uDC7F" + - "\u7F7F\uDB7F\u7F7F\u7F7F\u7F7F\u7FB0\uB1B2\uFFFF\u0006\u7F7F\uFE7F\uFFFF\u6D2F\u7F7F"; - - - ConvTable855() - { - super(855, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } - - ConvTable855(int ccsid) - { - super(ccsid, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable857.java b/cvsroot/src/com/ibm/as400/access/ConvTable857.java deleted file mode 100644 index 376f2e7f2..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable857.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable857.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable857 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7\u00EA\u00EB\u00E8\u00EF\u00EE\u0131\u00C4\u00C5" + - "\u00C9\u00E6\u00C6\u00F4\u00F6\u00F2\u00FB\u00F9\u0130\u00D6\u00DC\u00F8\u00A3\u00D8\u015E\u015F" + - "\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u011E\u011F\u00BF\u00AE\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB" + - "\u2591\u2592\u2593\u2502\u2524\u00C1\u00C2\u00C0\u00A9\u2563\u2551\u2557\u255D\u00A2\u00A5\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u00E3\u00C3\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u00A4" + - "\u00BA\u00AA\u00CA\u00CB\u00C8\u001A\u00CD\u00CE\u00CF\u2518\u250C\u2588\u2584\u00A6\u00CC\u2580" + - "\u00D3\u00DF\u00D4\u00D2\u00F5\u00D5\u00B5\u001A\u00D7\u00DA\u00DB\u00D9\u00EC\u00FF\u00AF\u00B4" + - "\u00AD\u00B1\u001A\u00BE\u00B6\u00A7\u00F7\u00B8\u00B0\u00A8\u00B7\u00B9\u00B3\u00B2\u25A0\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFFAD\uBD9C\uCFBE\uDDF5\uF9B8\uD1AE\uAAF0\uA9EE\uF8F1\uFDFC\uEFE6\uF4FA\uF7FB" + - "\uD0AF\uACAB\uF3A8\uB7B5\uB6C7\u8E8F\u9280\uD490\uD2D3\uDED6\uD7D8\u7FA5\uE3E0\uE2E5\u99E8\u9DEB" + - "\uE9EA\u9A7F\u7FE1\u85A0\u83C6\u8486\u9187\u8A82\u8889\uECA1\u8C8B\u7FA4\u95A2\u93E4\u94F6\u9B97" + - "\uA396\u817F\u7FED\uFFFF\u000F\u7F7F\uA6A7\uFFFF\b\u7F7F\u988D\uFFFF\u0016\u7F7F\u9E9F\uFFFF" + - "\u11D0\u7F7F\uC47F\uB37F\uFFFF\u0004\u7F7F\uDA7F\u7F7F\uBF7F\u7F7F\uC07F\u7F7F\uD97F\u7F7F\uC37F" + - "\u7F7F\u7F7F\u7F7F\uB47F\u7F7F\u7F7F\u7F7F\uC27F\u7F7F\u7F7F\u7F7F\uC17F\u7F7F\u7F7F\u7F7F\uC57F" + - "\uFFFF\t\u7F7F\uCDBA\u7F7F\uC97F\u7FBB\u7F7F\uC87F\u7FBC\u7F7F\uCC7F\u7FB9\u7F7F\uCB7F\u7FCA" + - "\u7F7F\uCE7F\uFFFF\t\u7F7F\uDF7F\u7F7F\uDC7F\u7F7F\uDB7F\u7F7F\u7F7F\u7F7F\u7FB0\uB1B2\uFFFF" + - "\u0006\u7F7F\uFE7F\uFFFF\u6D2F\u7F7F"; - - - ConvTable857() - { - super(857, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable860.java b/cvsroot/src/com/ibm/as400/access/ConvTable860.java deleted file mode 100644 index 980540081..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable860.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable860.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable860 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u00B6\u00A7\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u00C7\u00FC\u00E9\u00E2\u00E3\u00E0\u00C1\u00E7\u00EA\u00CA\u00E8\u00CD\u00D4\u00EC\u00C3\u00C2" + - "\u00C9\u00C0\u00C8\u00F4\u00F5\u00F2\u00DA\u00F9\u00CC\u00D5\u00DC\u00A2\u00A3\u00D9\u20A7\u00D3" + - "\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA\u00BF\u00D2\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB" + - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + - "\u03B1\u00DF\u0393\u03C0\u03A3\u03C3\u03BC\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229" + - "\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u7F7F\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFFAD\u9B9C\u7F7F\u7F15\u7F7F\uA6AE\uAA7F\u7F7F\uF8F1\uFD7F\u7F7F\u14FA\u7F7F" + - "\uA7AF\uACAB\u7FA8\u9186\u8F8E\u7F7F\u7F80\u9290\u897F\u988B\u7F7F\u7FA5\uA99F\u8C99\u7F7F\u7F9D" + - "\u967F\u9A7F\u7FE1\u85A0\u8384\u7F7F\u7F87\u8A82\u887F\u8DA1\u7F7F\u7FA4\u95A2\u9394\u7FF6\u7F97" + - "\uA37F\u817F\uFFFF\u014A\u7F7F\u7FE2\u7F7F\u7F7F\uE97F\uFFFF\u0004\u7F7F\u7FE4\u7F7F\uE87F\u7FEA" + - "\u7F7F\u7F7F\u7F7F\u7FE0\u7F7F\uEBEE\u7F7F\u7F7F\u7F7F\uE67F\u7F7F\uE37F\u7FE5\uE77F\uED7F\uFFFF" + - "\u0E5B\u7F7F\u7FFC\uFFFF\u0013\u7F7F\u7F9E\uFFFF\u00B8\u7F7F\u7FF9\uFB7F\u7F7F\uEC7F\uFFFF\u0004" + - "\u7F7F\u7FEF\uFFFF\u000F\u7F7F\uF77F\uFFFF\u000B\u7F7F\u7FF0\u7F7F\uF3F2\uFFFF\u005D\u7F7F\uF4F5" + - "\uFFFF\u00EF\u7F7F\uC47F\uB37F\uFFFF\u0004\u7F7F\uDA7F\u7F7F\uBF7F\u7F7F\uC07F\u7F7F\uD97F\u7F7F" + - "\uC37F\u7F7F\u7F7F\u7F7F\uB47F\u7F7F\u7F7F\u7F7F\uC27F\u7F7F\u7F7F\u7F7F\uC17F\u7F7F\u7F7F\u7F7F" + - "\uC57F\uFFFF\t\u7F7F\uCDBA\uD5D6\uC9B8\uB7BB\uD4D3\uC8BE\uBDBC\uC6C7\uCCB5\uB6B9\uD1D2\uCBCF" + - "\uD0CA\uD8D7\uCE7F\uFFFF\t\u7F7F\uDF7F\u7F7F\uDC7F\u7F7F\uDB7F\u7F7F\uDD7F\u7F7F\uDEB0\uB1B2" + - "\uFFFF\u0006\u7F7F\uFE7F\uFFFF\u6D2F\u7F7F"; - - - ConvTable860() - { - super(860, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable861.java b/cvsroot/src/com/ibm/as400/access/ConvTable861.java deleted file mode 100644 index cce05a219..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable861.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable861.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable861 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u00B6\u00A7\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7\u00EA\u00EB\u00E8\u00D0\u00F0\u00DE\u00C4\u00C5" + - "\u00C9\u00E6\u00C6\u00F4\u00F6\u00FE\u00FB\u00DD\u00FD\u00D6\u00DC\u00F8\u00A3\u00D8\u20A7\u0192" + - "\u00E1\u00ED\u00F3\u00FA\u00C1\u00CD\u00D3\u00DA\u00BF\u2310\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB" + - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + - "\u03B1\u00DF\u0393\u03C0\u03A3\u03C3\u03BC\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229" + - "\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u7F7F\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFFAD\u7F9C\u7F7F\u7F15\u7F7F\u7FAE\uAA7F\u7F7F\uF8F1\uFD7F\u7F7F\u14FA\u7F7F" + - "\u7FAF\uACAB\u7FA8\u7FA4\u7F7F\u8E8F\u9280\u7F90\u7F7F\u7FA5\u7F7F\u8B7F\u7FA6\u7F7F\u997F\u9D7F" + - "\uA77F\u9A97\u8DE1\u85A0\u837F\u8486\u9187\u8A82\u8889\u7FA1\u7F7F\u8C7F\u7FA2\u937F\u94F6\u9B7F" + - "\uA396\u8198\u957F\uFFFF\u0049\u7F7F\u9F7F\uFFFF\u00FF\u7F7F\u7FE2\u7F7F\u7F7F\uE97F\uFFFF\u0004" + - "\u7F7F\u7FE4\u7F7F\uE87F\u7FEA\u7F7F\u7F7F\u7F7F\u7FE0\u7F7F\uEBEE\u7F7F\u7F7F\u7F7F\uE67F\u7F7F" + - "\uE37F\u7FE5\uE77F\uED7F\uFFFF\u0E5B\u7F7F\u7FFC\uFFFF\u0013\u7F7F\u7F9E\uFFFF\u00B8\u7F7F\u7FF9" + - "\uFB7F\u7F7F\uEC7F\uFFFF\u0004\u7F7F\u7FEF\uFFFF\u000F\u7F7F\uF77F\uFFFF\u000B\u7F7F\u7FF0\u7F7F" + - "\uF3F2\uFFFF\u0055\u7F7F\uA97F\uFFFF\u0007\u7F7F\uF4F5\uFFFF\u00EF\u7F7F\uC47F\uB37F\uFFFF\u0004" + - "\u7F7F\uDA7F\u7F7F\uBF7F\u7F7F\uC07F\u7F7F\uD97F\u7F7F\uC37F\u7F7F\u7F7F\u7F7F\uB47F\u7F7F\u7F7F" + - "\u7F7F\uC27F\u7F7F\u7F7F\u7F7F\uC17F\u7F7F\u7F7F\u7F7F\uC57F\uFFFF\t\u7F7F\uCDBA\uD5D6\uC9B8" + - "\uB7BB\uD4D3\uC8BE\uBDBC\uC6C7\uCCB5\uB6B9\uD1D2\uCBCF\uD0CA\uD8D7\uCE7F\uFFFF\t\u7F7F\uDF7F" + - "\u7F7F\uDC7F\u7F7F\uDB7F\u7F7F\uDD7F\u7F7F\uDEB0\uB1B2\uFFFF\u0006\u7F7F\uFE7F\uFFFF\u6D2F\u7F7F"; - - - ConvTable861() - { - super(861, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable8612.java b/cvsroot/src/com/ibm/as400/access/ConvTable8612.java deleted file mode 100644 index b1c7c3072..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable8612.java +++ /dev/null @@ -1,64 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable8612.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable8612 extends ConvTableBidiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u0651\uFE7D\u0640\u200B\u0621\u0622\uFE82\u0623\u00A2\u002E\u003C\u0028\u002B\u007C" + - "\u0026\uFE84\u0624\u001A\u001A\u0626\u0627\uFE8E\u0628\uFE91\u0021\u0024\u002A\u0029\u003B\u00AC" + - "\u002D\u002F\u0629\u062A\uFE97\u062B\uFE9B\u062C\uFE9F\u062D\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\uFEA3\u062E\uFEA7\u062F\u0630\u0631\u0632\u0633\uFEB3\u060C\u003A\u0023\u0040\'\u003D\"" + - "\u0634\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\uFEB7\u0635\uFEBB\u0636\uFEBF\u0637" + - "\u0638\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u0639\uFECA\uFECB\uFECC\u063A\uFECE" + - "\uFECF\u00F7\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\uFED0\u0641\uFED3\u0642\uFED7\u0643" + - "\uFEDB\u0644\uFEF5\uFEF6\uFEF7\uFEF8\u001A\u001A\uFEFB\uFEFC\uFEDF\u0645\uFEE3\u0646\uFEE7\u0647" + - "\u061B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\uFEEB\u001A\uFEEC\u001A\u0648" + - "\u061F\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u0649\uFEF0\u064A\uFEF2\uFEF3\u0660" + - "\u00D7\u2007\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u0661\u0662\u001A\u0663\u0664\u0665" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u20AC\u0666\u0667\u0668\u0669\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE93F\u3F3F\u3F6D" + - "\u3F81\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA93F\u4F3F\u3F07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\u4A3F\u3F3F\u6A3F\u3F3F\u3F3F\u5FCA\uFFFF\u0014\u3F3F\u3FE0\uFFFF\u000F\u3F3F\u3FA1\uFFFF" + - "\u028A\u3F3F\u793F\uFFFF\u0006\u3F3F\u3FC0\u3F3F\u3FD0\u3F46\u4749\u5256\u5556\u5862\u6365\u6769" + - "\u7173\u7475\u7677\u808B\u8D8F\u909A\u9E3F\u3F3F\u3F3F\u44AB\uADAF\uB1BB\uBDBF\uCFDA\uDC3F\u3F3F" + - "\u3F3F\u3F42\uFFFF\u0007\u3F3F\uDFEA\uEBED\uEEEF\uFBFC\uFDFE\u6C6B\u4B5C\uFFFF\u0CCC\u3F3F\u3FE1" + - "\u3F3F\u3F45\uFFFF\u0050\u3F3F\uFA3F\uFFFF\u6EE1\u3F3F\u4044\u4045\u403F\u4044\u4044\u4044\u4243" + - "\u4044\u4647\u4849\u5152\u5256\u5755\u5555\u5556\u5758\u5859\u5962\u6263\u6364\u6465\u6566\u6667" + - "\u6768\u6869\u6970\u7071\u7172\u7273\u7374\u7475\u7576\u7677\u7778\u7880\u808A\u8A8B\u8B8C\u8C8D" + - "\u8D8E\u8E8F\u8F8F\u8F90\u9090\u909A\u9B9C\u9D9E\u9FA0\uAAAB\uABAC\uACAD\uADAE\uAEAF\uAFB0\uB0B1" + - "\uB1BA\uBABB\uBBBC\uBCBD\uBDBE\uBEBF\uBFCB\uCDCF\uCFDA\uDBDC\uDDDE\uDEB2\uB3B4\uB5B8\uB9B8\uB93F" + - "\u3F3F\u3F5A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E" + - "\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE93F\u3F3F" + - "\u3F6D\u3F81\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA93F\u4F3F" + - "\uFFFF\u0051\u3F3F"; - - - ConvTable8612() - { - super(8612, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable862.java b/cvsroot/src/com/ibm/as400/access/ConvTable862.java deleted file mode 100644 index eabeb69f1..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable862.java +++ /dev/null @@ -1,70 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable862.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable862 extends ConvTableBidiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF" + - "\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u05EA\u00A2\u00A3\u00A5\u20A7\u0192" + - "\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA\u00BF\u2310\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB" + - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + - "\u03B1\u00DF\u0393\u03C0\u03A3\u03C3\u03BC\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229" + - "\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFFAD\u9B9C\u7F9D\u7F15\u7F7F\uA6AE\uAA7F\u7F7F\uF8F1\uFD7F\u7F7F\u14FA\u7F7F" + - "\uA7AF\uACAB\u7FA8\uFFFF\b\u7F7F\u0000\n\u7FA5\u7F7F\u7F7F\u7F7F\uE1A0\u7F7F\u7F7F\u7FA1" + - "\u7FA4\uA27F\uF67F\uA37F\uFFFF\u004B\u7F7F\u9F7F\uFFFF\u00FF\u7F7F\u7FE2\u7F7F\u7F7F\uE97F\uFFFF" + - "\u0004\u7F7F\u7FE4\u7F7F\uE87F\u7FEA\u7F7F\u7F7F\u7F7F\u7FE0\u7F7F\uEBEE\u7F7F\u7F7F\u7F7F\uE67F" + - "\u7F7F\uE37F\u7FE5\uE77F\uED7F\uFFFF\u0104\u7F7F\u8081\u8283\u8485\u8687\u8889\u8A8B\u8C8D\u8E8F" + - "\u9091\u9293\u9495\u9697\u9899\u9A7F\uFFFF\u0D1B\u7F7F\u077F\uFFFF\f\u7F7F\u137F\uFFFF\u0020" + - "\u7F7F\u7FFC\uFFFF\u0013\u7F7F\u7F9E\uFFFF\u0074\u7F7F\u1B18\u1A19\u1D12\uFFFF\t\u7F7F\u177F" + - "\uFFFF\u0037\u7F7F\u7FF9\uFB7F\u7F7F\uEC1C\uFFFF\u0004\u7F7F\u7FEF\uFFFF\u000F\u7F7F\uF77F\uFFFF" + - "\u000B\u7F7F\u7FF0\u7F7F\uF3F2\uFFFF\u0055\u7F7F\uA97F\uFFFF\u0007\u7F7F\uF4F5\uFFFF\u00EF\u7F7F" + - "\uC47F\uB37F\uFFFF\u0004\u7F7F\uDA7F\u7F7F\uBF7F\u7F7F\uC07F\u7F7F\uD97F\u7F7F\uC37F\u7F7F\u7F7F" + - "\u7F7F\uB47F\u7F7F\u7F7F\u7F7F\uC27F\u7F7F\u7F7F\u7F7F\uC17F\u7F7F\u7F7F\u7F7F\uC57F\uFFFF\t" + - "\u7F7F\uCDBA\uD5D6\uC9B8\uB7BB\uD4D3\uC8BE\uBDBC\uC6C7\uCCB5\uB6B9\uD1D2\uCBCF\uD0CA\uD8D7\uCE7F" + - "\uFFFF\t\u7F7F\uDF7F\u7F7F\uDC7F\u7F7F\uDB7F\u7F7F\uDD7F\u7F7F\uDEB0\uB1B2\uFFFF\u0006\u7F7F" + - "\uFE7F\uFFFF\u0005\u7F7F\u167F\u7F7F\u7F7F\u1E7F\u7F7F\u7F7F\u7F7F\u107F\u1F7F\u7F7F\u7F7F\u7F7F" + - "\u117F\u0000\u0004\u7F7F\u7F09\u7F7F\u7F7F\u7F7F\u080A\uFFFF\u0030\u7F7F\u0102\u0F7F\u7F7F\u0C7F" + - "\u0B7F\uFFFF\u000E\u7F7F\u067F\u7F05\u7F03\u047F\u7F7F\u0D0E\uFFFF\u6C4A\u7F7F\u7F21\u2223\u2425" + - "\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F\u4041\u4243\u4445" + - "\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F\u6061\u6263\u6465" + - "\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F\uFFFF\u0044\u7F7F" + - "\uB31B\u181A\u19FE\u097F\uFFFF\b\u7F7F"; - - - ConvTable862() - { - super(862, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable863.java b/cvsroot/src/com/ibm/as400/access/ConvTable863.java deleted file mode 100644 index 7dc19ed87..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable863.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable863.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable863 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u00C7\u00FC\u00E9\u00E2\u00C2\u00E0\u00B6\u00E7\u00EA\u00EB\u00E8\u00EF\u00EE\u2017\u00C0\u00A7" + - "\u00C9\u00C8\u00CA\u00F4\u00CB\u00CF\u00FB\u00F9\u00A4\u00D4\u00DC\u00A2\u00A3\u00D9\u00DB\u0192" + - "\u00A6\u00B4\u00F3\u00FA\u00A8\u00B8\u00B3\u00AF\u00CE\u2310\u00AC\u00BD\u00BC\u00BE\u00AB\u00BB" + - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + - "\u03B1\u00DF\u0393\u03C0\u03A3\u03C3\u03BC\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229" + - "\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFF7F\u9B9C\u987F\uA08F\uA47F\u7FAE\uAA7F\u7FA7\uF8F1\uFDA6\uA17F\u86FA\uA57F" + - "\u7FAF\uACAB\uAD7F\u8E7F\u847F\u7F7F\u7F80\u9190\u9294\u7F7F\uA895\u7F7F\u7F7F\u997F\u7F7F\u7F9D" + - "\u7F9E\u9A7F\u7FE1\u857F\u837F\u7F7F\u7F87\u8A82\u8889\u7F7F\u8C8B\u7F7F\u7FA2\u937F\u7FF6\u7F97" + - "\uA396\u817F\uFFFF\u004A\u7F7F\u9F7F\uFFFF\u00FF\u7F7F\u7FE2\u7F7F\u7F7F\uE97F\uFFFF\u0004\u7F7F" + - "\u7FE4\u7F7F\uE87F\u7FEA\u7F7F\u7F7F\u7F7F\u7FE0\u7F7F\uEBEE\u7F7F\u7F7F\u7F7F\uE67F\u7F7F\uE37F" + - "\u7FE5\uE77F\uED7F\uFFFF\u0E27\u7F7F\u7F8D\uFFFF\u0033\u7F7F\u7FFC\uFFFF\u00CC\u7F7F\u7FF9\uFB7F" + - "\u7F7F\uEC7F\uFFFF\u0004\u7F7F\u7FEF\uFFFF\u000F\u7F7F\uF77F\uFFFF\u000B\u7F7F\u7FF0\u7F7F\uF3F2" + - "\uFFFF\u0055\u7F7F\uA97F\uFFFF\u0007\u7F7F\uF4F5\uFFFF\u00EF\u7F7F\uC47F\uB37F\uFFFF\u0004\u7F7F" + - "\uDA7F\u7F7F\uBF7F\u7F7F\uC07F\u7F7F\uD97F\u7F7F\uC37F\u7F7F\u7F7F\u7F7F\uB47F\u7F7F\u7F7F\u7F7F" + - "\uC27F\u7F7F\u7F7F\u7F7F\uC17F\u7F7F\u7F7F\u7F7F\uC57F\uFFFF\t\u7F7F\uCDBA\uD5D6\uC9B8\uB7BB" + - "\uD4D3\uC8BE\uBDBC\uC6C7\uCCB5\uB6B9\uD1D2\uCBCF\uD0CA\uD8D7\uCE7F\uFFFF\t\u7F7F\uDF7F\u7F7F" + - "\uDC7F\u7F7F\uDB7F\u7F7F\uDD7F\u7F7F\uDEB0\uB1B2\uFFFF\u0006\u7F7F\uFE7F\uFFFF\u6D2F\u7F7F"; - - - ConvTable863() - { - super(863, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable864.java b/cvsroot/src/com/ibm/as400/access/ConvTable864.java deleted file mode 100644 index 8acdd3902..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable864.java +++ /dev/null @@ -1,71 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable864.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable864 extends ConvTableBidiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u00B0\u00B7\u2219\u221A\u2592\u2500\u2502\u253C\u2524\u252C\u251C\u2534\u2510\u250C\u2514\u2518" + - "\u03B2\u221E\u03C6\u00B1\u00BD\u00BC\u2248\u00AB\u00BB\uFEF7\uFEF8\u001A\u001A\uFEFB\uFEFC\u200B" + - "\u00A0\u00AD\uFE82\u00A3\u00A4\uFE84\u001A\u20AC\uFE8E\uFE8F\uFE95\uFE99\u060C\uFE9D\uFEA1\uFEA5" + - "\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\uFED1\u061B\uFEB1\uFEB5\uFEB9\u061F" + - "\u00A2\uFE80\uFE81\uFE83\uFE85\uFECA\uFE8B\uFE8D\uFE91\uFE93\uFE97\uFE9B\uFE9F\uFEA3\uFEA7\uFEA9" + - "\uFEAB\uFEAD\uFEAF\uFEB3\uFEB7\uFEBB\uFEBF\uFEC3\uFEC7\uFECB\uFECF\u00A6\u00AC\u00F7\u00D7\uFEC9" + - "\u0640\uFED3\uFED7\uFEDB\uFEDF\uFEE3\uFEE7\uFEEB\uFEED\uFEEF\uFEF3\uFEBD\uFECC\uFECE\uFECD\uFEE1" + - "\uFE7D\uFE7C\uFEE5\uFEE9\uFEEC\uFEF0\uFEF2\uFED0\uFED5\uFEF5\uFEF6\uFEDD\uFED9\uFEF1\u25A0\u001A"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uA07F\uC0A3\uA47F\uDB15\u7F7F\u7F97\uDCA1\u7F7F\u8093\u7F7F\u7F7F\u1481\u7F7F" + - "\u7F98\u9594\uFFFF\f\u7F7F\u7FDE\uFFFF\u000F\u7F7F\u7FDD\uFFFF\u015D\u7F7F\u907F\uFFFF\t" + - "\u7F7F\u927F\uFFFF\u0122\u7F7F\uAC7F\uFFFF\u0006\u7F7F\u7FBB\u7F7F\u7FBF\u7FC1\uC2C3\uC4C7\uC6C7" + - "\uC8C9\uCACB\uCCCD\uCECF\uD0D1\uD2D3\uD4D5\uD6D7\uD8D9\uDA7F\u7F7F\u7F7F\uE0E1\uE2E3\uE4E5\uE6E7" + - "\uE8E9\uFD7F\u7F7F\u7F7F\u7FF1\uFFFF\u0007\u7F7F\uB0B1\uB2B3\uB4B5\uB6B7\uB8B9\u252C\u2E2A\uFFFF" + - "\u0CCE\u7F7F\u7F9F\uFFFF\u0018\u7F7F\u137F\uFFFF\u0037\u7F7F\uA77F\uFFFF\u0071\u7F7F\u1B18\u1A19" + - "\u1D12\uFFFF\t\u7F7F\u177F\uFFFF\u0037\u7F7F\u7F82\u837F\u7F7F\u911C\uFFFF\u0014\u7F7F\u967F" + - "\uFFFF\u015B\u7F7F\u857F\u867F\uFFFF\u0004\u7F7F\u8D7F\u7F7F\u8C7F\u7F7F\u8E7F\u7F7F\u8F7F\u7F7F" + - "\u8A7F\u7F7F\u7F7F\u7F7F\u887F\u7F7F\u7F7F\u7F7F\u897F\u7F7F\u7F7F\u7F7F\u8B7F\u7F7F\u7F7F\u7F7F" + - "\u877F\uFFFF\t\u7F7F\u0506\u7F7F\u0D7F\u7F0C\u7F7F\u0E7F\u7F0F\u7F7F\u0A7F\u7F08\u7F7F\u097F" + - "\u7F0B\u7F7F\u077F\uFFFF\u0012\u7F7F\u847F\uFFFF\u0006\u7F7F\uFE7F\uFFFF\u0005\u7F7F\u167F\u7F7F" + - "\u7F7F\u1E7F\u7F7F\u7F7F\u7F7F\u107F\u1F7F\u7F7F\u7F7F\u7F7F\u117F\uFFFF\u003A\u7F7F\u017F\u047F" + - "\uFFFF\u0016\u7F7F\u027F\u037F\uFFFF\u6C07\u7F7F\uF1F0\u7F7F\uC1C2\uA2C3\uA5C4\uC4C7\uA8C6\uC6C6" + - "\uC6C7\uA8A9\uA9C8\uC8C9\uC9AA\uAACA\uCAAB\uABCB\uCBAD\uADCC\uCCAE\uAECD\uCDAF\uAFCE\uCECF\uCFD0" + - "\uD0D1\uD1D2\uD2BC\uBCD3\uD3BD\uBDD4\uD4BE\uBED5\uD5EB\uEBD6\uD6D7\uD7D7\uD7D8\uD8D8\uD8DF\uC5D9" + - "\uECEE\uEDDA\uF7BA\uBAE1\uE1F8\uF8E2\uE2FC\uFCE3\uE3FB\uFBE4\uE4EF\uEFE5\uE5F2\uF2E6\uE6F3\uF3E7" + - "\uF4E8\uE8E9\uF5FD\uF6EA\uEAF9\uFA99\u9A9D\u9E9D\u9E7F\u7F7F\u7F21\u2223\u2425\u2627\u2829\u2A2B" + - "\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F\u4041\u4243\u4445\u4647\u4849\u4A4B" + - "\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F\u6061\u6263\u6465\u6667\u6869\u6A6B" + - "\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F\uFFFF\u0044\u7F7F\u861B\u181A\u19FE" + - "\uFFFF\t\u7F7F"; - - - ConvTable864() - { - super(864, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable865.java b/cvsroot/src/com/ibm/as400/access/ConvTable865.java deleted file mode 100644 index 2a7ecefa6..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable865.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable865.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable865 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u00B6\u00A7\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7\u00EA\u00EB\u00E8\u00EF\u00EE\u00EC\u00C4\u00C5" + - "\u00C9\u00E6\u00C6\u00F4\u00F6\u00F2\u00FB\u00F9\u00FF\u00D6\u00DC\u00F8\u00A3\u00D8\u20A7\u0192" + - "\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA\u00BF\u2310\u00AC\u00BD\u00BC\u00A1\u00AB\u00A4" + - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + - "\u03B1\u00DF\u0393\u03C0\u03A3\u03C3\u03BC\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229" + - "\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u7F7F\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFFAD\u7F9C\uAF7F\u7F15\u7F7F\uA6AE\uAA7F\u7F7F\uF8F1\uFD7F\u7F7F\u14FA\u7F7F" + - "\uA77F\uACAB\u7FA8\u7F7F\u7F7F\u8E8F\u9280\u0000\u0003\u7F90\u7F7F\u7FA5\u7F7F\u997F\u9D7F\u7F7F" + - "\u9A7F\u7FE1\u85A0\u837F\u8486\u9187\u8A82\u8889\u8DA1\u8C8B\u7FA4\u95A2\u937F\u94F6\u9B97\uA396" + - "\u817F\u7F98\uFFFF\u0049\u7F7F\u9F7F\uFFFF\u00FF\u7F7F\u7FE2\u7F7F\u7F7F\uE97F\uFFFF\u0004\u7F7F" + - "\u7FE4\u7F7F\uE87F\u7FEA\u7F7F\u7F7F\u7F7F\u7FE0\u7F7F\uEBEE\u7F7F\u7F7F\u7F7F\uE67F\u7F7F\uE37F" + - "\u7FE5\uE77F\uED7F\uFFFF\u0E5B\u7F7F\u7FFC\uFFFF\u0013\u7F7F\u7F9E\uFFFF\u00B8\u7F7F\u7FF9\uFB7F" + - "\u7F7F\uEC7F\uFFFF\u0004\u7F7F\u7FEF\uFFFF\u000F\u7F7F\uF77F\uFFFF\u000B\u7F7F\u7FF0\u7F7F\uF3F2" + - "\uFFFF\u0055\u7F7F\uA97F\uFFFF\u0007\u7F7F\uF4F5\uFFFF\u00EF\u7F7F\uC47F\uB37F\uFFFF\u0004\u7F7F" + - "\uDA7F\u7F7F\uBF7F\u7F7F\uC07F\u7F7F\uD97F\u7F7F\uC37F\u7F7F\u7F7F\u7F7F\uB47F\u7F7F\u7F7F\u7F7F" + - "\uC27F\u7F7F\u7F7F\u7F7F\uC17F\u7F7F\u7F7F\u7F7F\uC57F\uFFFF\t\u7F7F\uCDBA\uD5D6\uC9B8\uB7BB" + - "\uD4D3\uC8BE\uBDBC\uC6C7\uCCB5\uB6B9\uD1D2\uCBCF\uD0CA\uD8D7\uCE7F\uFFFF\t\u7F7F\uDF7F\u7F7F" + - "\uDC7F\u7F7F\uDB7F\u7F7F\uDD7F\u7F7F\uDEB0\uB1B2\uFFFF\u0006\u7F7F\uFE7F\uFFFF\u6D2F\u7F7F"; - - - ConvTable865() - { - super(865, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable866.java b/cvsroot/src/com/ibm/as400/access/ConvTable866.java deleted file mode 100644 index 9106d9ef2..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable866.java +++ /dev/null @@ -1,60 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable866.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable866 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u00B6\u00A7\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F" + - "\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F" + - "\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F" + - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + - "\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F" + - "\u0401\u0451\u0404\u0454\u0407\u0457\u040E\u045E\u00B0\u2219\u00B7\u221A\u2116\u00A4\u25A0\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u7F7F\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFF7F\u7F7F\uFD7F\u7F15\uFFFF\u0004\u7F7F\uF87F\u7F7F\u7F7F\u14FA\uFFFF\u01A4" + - "\u7F7F\u7FF0\u7F7F\uF27F\u7FF4\u7F7F\u7F7F\u7F7F\uF67F\u8081\u8283\u8485\u8687\u8889\u8A8B\u8C8D" + - "\u8E8F\u9091\u9293\u9495\u9697\u9899\u9A9B\u9C9D\u9E9F\uA0A1\uA2A3\uA4A5\uA6A7\uA8A9\uAAAB\uACAD" + - "\uAEAF\uE0E1\uE2E3\uE4E5\uE6E7\uE8E9\uEAEB\uECED\uEEEF\u7FF1\u7F7F\uF37F\u7FF5\u7F7F\u7F7F\u7F7F" + - "\uF77F\uFFFF\u0E5B\u7F7F\uFC7F\uFFFF\u0080\u7F7F\u7FF9\uFB7F\uFFFF\u0172\u7F7F\uC47F\uB37F\uFFFF" + - "\u0004\u7F7F\uDA7F\u7F7F\uBF7F\u7F7F\uC07F\u7F7F\uD97F\u7F7F\uC37F\u7F7F\u7F7F\u7F7F\uB47F\u7F7F" + - "\u7F7F\u7F7F\uC27F\u7F7F\u7F7F\u7F7F\uC17F\u7F7F\u7F7F\u7F7F\uC57F\uFFFF\t\u7F7F\uCDBA\uD5D6" + - "\uC9B8\uB7BB\uD4D3\uC8BE\uBDBC\uC6C7\uCCB5\uB6B9\uD1D2\uCBCF\uD0CA\uD8D7\uCE7F\uFFFF\t\u7F7F" + - "\uDF7F\u7F7F\uDC7F\u7F7F\uDB7F\u7F7F\uDD7F\u7F7F\uDEB0\uB1B2\uFFFF\u0006\u7F7F\uFE7F\uFFFF\u6D2F" + - "\u7F7F"; - - - ConvTable866() - { - super(866, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable869.java b/cvsroot/src/com/ibm/as400/access/ConvTable869.java deleted file mode 100644 index a06edc821..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable869.java +++ /dev/null @@ -1,67 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable869.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable869 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u0386\u001A\u0387\u00AC\u00A6\u2018\u2019\u0388\u2015\u0389" + - "\u038A\u03AA\u038C\u001A\u001A\u038E\u03AB\u00A9\u038F\u00B2\u00B3\u03AC\u00A3\u03AD\u03AE\u03AF" + - "\u03CA\u0390\u03CC\u03CD\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u00BD\u0398\u0399\u00AB\u00BB" + - "\u2591\u2592\u2593\u2502\u2524\u039A\u039B\u039C\u039D\u2563\u2551\u2557\u255D\u039E\u039F\u2510" + - "\u2514\u2534\u252C\u251C\u2500\u253C\u03A0\u03A1\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u03A3" + - "\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03B1\u03B2\u03B3\u2518\u250C\u2588\u2584\u03B4\u03B5\u2580" + - "\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0\u03C1\u03C3\u03C2\u03C4\u00B4" + - "\u00AD\u00B1\u03C5\u03C6\u03C7\u00A7\u03C8\u0385\u00B0\u00A8\u03C9\u03CB\u03B0\u03CE\u25A0\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFF7F\u7F9C\u7F7F\u8AF5\uF997\u7FAE\u89F0\u7F7F\uF8F1\u999A\uEF7F\u1488\u7F7F" + - "\u7FAF\u7FAB\uFFFF\u0163\u7F7F\u7FF7\u8688\u8D8F\u907F\u927F\u9598\uA1A4\uA5A6\uA7A8\uA9AA\uACAD" + - "\uB5B6\uB7B8\uBDBE\uC6C7\u7FCF\uD0D1\uD2D3\uD4D5\u9196\u9B9D\u9E9F\uFCD6\uD7D8\uDDDE\uE0E1\uE2E3" + - "\uE4E5\uE6E7\uE8E9\uEAEB\uEDEC\uEEF2\uF3F4\uF6FA\uA0FB\uA2A3\uFD7F\u7F7F\u7F7F\u7FF3\uFFFF\u0E1F" + - "\u7F7F\u7F8E\u7F7F\u8B8C\uFFFF\u0004\u7F7F\u077F\uFFFF\f\u7F7F\u137F\uFFFF\u00A9\u7F7F\u1B18" + - "\u1A19\u1D12\uFFFF\t\u7F7F\u177F\uFFFF\u003A\u7F7F\u7F1C\uFFFF\u0170\u7F7F\uC47F\uB37F\uFFFF" + - "\u0004\u7F7F\uDA7F\u7F7F\uBF7F\u7F7F\uC07F\u7F7F\uD97F\u7F7F\uC37F\u7F7F\u7F7F\u7F7F\uB47F\u7F7F" + - "\u7F7F\u7F7F\uC27F\u7F7F\u7F7F\u7F7F\uC17F\u7F7F\u7F7F\u7F7F\uC57F\uFFFF\t\u7F7F\uCDBA\u7F7F" + - "\uC97F\u7FBB\u7F7F\uC87F\u7FBC\u7F7F\uCC7F\u7FB9\u7F7F\uCB7F\u7FCA\u7F7F\uCE7F\uFFFF\t\u7F7F" + - "\uDF7F\u7F7F\uDC7F\u7F7F\uDB7F\u7F7F\u7F7F\u7F7F\u7FB0\uB1B2\uFFFF\u0006\u7F7F\uFE7F\uFFFF\u0005" + - "\u7F7F\u167F\u7F7F\u7F7F\u1E7F\u7F7F\u7F7F\u7F7F\u107F\u1F7F\u7F7F\u7F7F\u7F7F\u117F\u0000\u0004" + - "\u7F7F\u7F09\u7F7F\u7F7F\u7F7F\u080A\uFFFF\u0030\u7F7F\u0102\u0F7F\u7F7F\u0C7F\u0B7F\uFFFF\u000E" + - "\u7F7F\u067F\u7F05\u7F03\u047F\u7F7F\u0D0E\uFFFF\u6C4A\u7F7F\u7F21\u2223\u2425\u2627\u2829\u2A2B" + - "\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F\u4041\u4243\u4445\u4647\u4849\u4A4B" + - "\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F\u6061\u6263\u6465\u6667\u6869\u6A6B" + - "\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F\uFFFF\u0044\u7F7F\uB31B\u181A\u19FE" + - "\u097F\uFFFF\b\u7F7F"; - - - ConvTable869() - { - super(869, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable870.java b/cvsroot/src/com/ibm/as400/access/ConvTable870.java deleted file mode 100644 index fdd78fe08..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable870.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable870.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable870 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u0163\u00E1\u0103\u010D\u00E7\u0107\u005B\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u00E9\u0119\u00EB\u016F\u00ED\u00EE\u013E\u013A\u00DF\u005D\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u02DD\u00C1\u0102\u010C\u00C7\u0106\u007C\u002C\u0025\u005F\u003E\u003F" + - "\u02C7\u00C9\u0118\u00CB\u016E\u00CD\u00CE\u013D\u0139\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u02D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u015B\u0148\u0111\u00FD\u0159\u015F" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u0142\u0144\u0161\u00B8\u02DB\u00A4" + - "\u0105\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u015A\u0147\u0110\u00DD\u0158\u015E" + - "\u02D9\u0104\u017C\u0162\u017B\u00A7\u017E\u017A\u017D\u0179\u0141\u0143\u0160\u00A8\u00B4\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u0155\u00F3\u0151" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u011A\u0171\u00FC\u0165\u00FA\u011B" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u010F\u00D4\u00D6\u0154\u00D3\u0150" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u010E\u0170\u00DC\u0164\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u6AD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\u3F3F\u9F3F\u3FB5\uBD3F\u3F3F\u3FCA\u3F3F\u903F\u3F3F\uBE3F\u3F3F\u9D3F\u3F3F\u3F3F\u3F3F" + - "\u3F65\u623F\u633F\u3F68\u3F71\u3F73\u3F75\u763F\u3F3F\u3FEE\uEB3F\uECBF\u3F3F\uFE3F\uFCAD\u3F59" + - "\u3F45\u423F\u433F\u3F48\u3F51\u3F53\u3F55\u563F\u3F3F\u3FCE\uCB3F\uCCE1\u3F3F\uDE3F\uDC8D\u3F3F" + - "\u3F3F\u6646\uB1A0\u6949\u3F3F\u3F3F\u6747\uFAEA\uAC8C\u3F3F\u3F3F\u3F3F\u7252\uDADF\uFFFF\u000E" + - "\u3F3F\u3F78\u583F\u3F77\u573F\u3FBA\u9ABB\u9B3F\u3FAB\u8B3F\u3F3F\u3F3F\u3F3F\uEFCF\u3F3F\uEDCD" + - "\u3F3F\uAE8E\uAA8A\u3F3F\uAF8F\uBC9C\uB344\uFDDD\uFFFF\u0004\u3F3F\u7454\uFBDB\u3F3F\u3F3F\u3F3F" + - "\u3FB9\uB7B4\uB2B8\uB63F\uFFFF\u00A3\u3F3F\u3F70\uFFFF\b\u3F3F\u80B0\u3F9E\u3F64\uFFFF\u7E91" + - "\u3F3F"; - - - ConvTable870() - { - super(870, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable871.java b/cvsroot/src/com/ibm/as400/access/ConvTable871.java deleted file mode 100644 index e1ca22b44..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable871.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable871.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable871 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5\u00E7\u00F1\u00DE\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u00C6\u0024\u002A\u0029\u003B\u00D6" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u00F0\u003A\u0023\u00D0\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u0060\u00FD\u007B\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u007D\u00B8\u005D\u00A4" + - "\u00B5\u00F6\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u0040\u00DD\u005B\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\\\u00D7" + - "\u00FE\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u007E\u00F2\u00F3\u00F5" + - "\u00E6\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + - "\u00B4\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u005E\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\uACC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9AE\uBE9E\uEC6D" + - "\u8C81\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA98E\uBB9C\uCC07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u9FB2\u6AB5\uBDB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\uE0A0\uB6B3\u9DDA\u9B8B\uB7B8\uB9AB" + - "\u6465\u6266\u6367\u5A68\u7471\u7273\u7875\u7677\u7C69\uEDEE\uEBEF\u5FBF\u80FD\uFEFB\uFCAD\u4A59" + - "\u4445\u4246\u4347\uD048\u5451\u5253\u5855\u5657\u7949\uCDCE\uCBCF\uA1E1\u70DD\uDEDB\uDC8D\uC0DF" + - "\uFFFF\u7F80\u3F3F"; - - - ConvTable871() - { - super(871, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable874.java b/cvsroot/src/com/ibm/as400/access/ConvTable874.java deleted file mode 100644 index 44be36040..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable874.java +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable874.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// This is a Thai character set. -class ConvTable874 extends ConvTable9066 -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable874() - { - super(874); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable875.java b/cvsroot/src/com/ibm/as400/access/ConvTable875.java deleted file mode 100644 index 958167ec5..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable875.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable875.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable875 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u005B\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u039A\u039B\u039C\u039D\u039E\u039F\u03A0\u03A1\u03A3\u005D\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03AA\u03AB\u007C\u002C\u0025\u005F\u003E\u003F" + - "\u00A8\u0386\u0388\u0389\u00A0\u038A\u038C\u038E\u038F\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u0385\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC" + - "\u00B4\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u03BD\u03BE\u03BF\u03C0\u03C1\u03C3" + - "\u00A3\u03AC\u03AD\u03AE\u03CA\u03AF\u03CC\u03CD\u03CB\u03CE\u03C2\u03C4\u03C5\u03C6\u03C7\u03C8" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u03C9\u0390\u03B0\u2018\u2015" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B1\u00BD\u001A\u0387\u2019\u00A6" + - "\\\u001A\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00A7\u001A\u001A\u00AB\u00AC" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00A9\u001A\u001A\u00BB\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u6AD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u743F\u3FB0\u3F3F\uDFEB\u70FB\u3FEE\uEFCA\u3F3F\u90DA\uEAFA\uA03F\u3FDD\u3F3F\u3FFE\u3FDB\uFFFF" + - "\u0163\u3F3F\u3F80\u71DD\u7273\u753F\u763F\u7778\uCC41\u4243\u4445\u4647\u4849\u5152\u5354\u5556" + - "\u5758\u3F59\u6263\u6465\u6667\u6869\uB1B2\uB3B5\uCD8A\u8B8C\u8D8E\u8F9A\u9B9C\u9D9E\u9FAA\uABAC" + - "\uADAE\uBAAF\uBBBC\uBDBE\uBFCB\uB4B8\uB6B7\uB93F\u3F3F\u3F3F\u3FBD\uFFFF\u0E1F\u3F3F\u3FCF\u3F3F" + - "\uCEDE\uFFFF\u6F73\u3F3F\u3F4F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7" + - "\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6" + - "\uE7E8\uE94A\uE05A\u5F6D\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6" + - "\uA7A8\uA9C0\u6AD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable875() - { - super(875, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable878.java b/cvsroot/src/com/ibm/as400/access/ConvTable878.java deleted file mode 100644 index c66c99c1e..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable878.java +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable878.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable878 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2580\u2584\u2588\u258C\u2590" + - "\u2591\u2592\u2593\u2320\u25A0\u2219\u221A\u2248\u2264\u2265\u00A0\u2321\u00B0\u00B2\u00B7\u00F7" + - "\u2550\u2551\u2552\u0451\u2553\u2554\u2555\u2556\u2557\u2558\u2559\u255A\u255B\u255C\u255D\u255E" + - "\u255F\u2560\u2561\u0401\u2562\u2563\u2564\u2565\u2566\u2567\u2568\u2569\u256A\u256B\u256C\u00A9" + - "\u044E\u0430\u0431\u0446\u0434\u0435\u0444\u0433\u0445\u0438\u0439\u043A\u043B\u043C\u043D\u043E" + - "\u043F\u044F\u0440\u0441\u0442\u0443\u0436\u0432\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A" + - "\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413\u0425\u0418\u0419\u041A\u041B\u041C\u041D\u041E" + - "\u041F\u042F\u0420\u0421\u0422\u0423\u0416\u0412\u042C\u042B\u0417\u0428\u042D\u0429\u0427\u042A"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\uFFFF\u0010\u1A1A\u9A1A\u0000\u0003\u1A1A\u1A1A\uBF1A\u1A1A\u9C1A\u9D1A\u1A1A\u1A9E\uFFFF\u001F" + - "\u1A1A\u1A9F\uFFFF\u0184\u1A1A\u1AB3\uFFFF\u0007\u1A1A\uE1E2\uF7E7\uE4E5\uF6FA\uE9EA\uEBEC\uEDEE" + - "\uEFF0\uF2F3\uF4F5\uE6E8\uE3FE\uFBFD\uFFF9\uF8FC\uE0F1\uC1C2\uD7C7\uC4C5\uD6DA\uC9CA\uCBCC\uCDCE" + - "\uCFD0\uD2D3\uD4D5\uC6C8\uC3DE\uDBDD\uDFD9\uD8DC\uC0D1\u1AA3\uFFFF\u0EE3\u1A1A\u1A95\u961A\uFFFF" + - "\u0016\u1A1A\u971A\uFFFF\r\u1A1A\u9899\uFFFF\u005D\u1A1A\u939B\uFFFF\u00EF\u1A1A\u801A\u811A" + - "\uFFFF\u0004\u1A1A\u821A\u1A1A\u831A\u1A1A\u841A\u1A1A\u851A\u1A1A\u861A\u1A1A\u1A1A\u1A1A\u871A" + - "\u1A1A\u1A1A\u1A1A\u881A\u1A1A\u1A1A\u1A1A\u891A\u1A1A\u1A1A\u1A1A\u8A1A\uFFFF\t\u1A1A\uA0A1" + - "\uA2A4\uA5A6\uA7A8\uA9AA\uABAC\uADAE\uAFB0\uB1B2\uB4B5\uB6B7\uB8B9\uBABB\uBCBD\uBE1A\uFFFF\t" + - "\u1A1A\u8B1A\u1A1A\u8C1A\u1A1A\u8D1A\u1A1A\u8E1A\u1A1A\u8F90\u9192\uFFFF\u0006\u1A1A\u941A\uFFFF" + - "\u6CAF\u1A1A\u1A21\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B" + - "\u3C3D\u3E3F\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B" + - "\u5C5D\u5E5F\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B" + - "\u7C7D\u7E1A\uFFFF\u0044\u1A1A\u811A\u1A1A\u1A94\uFFFF\t\u1A1A"; - - - ConvTable878() - { - super(878, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable880.java b/cvsroot/src/com/ibm/as400/access/ConvTable880.java deleted file mode 100644 index fb96cb40b..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable880.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable880.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable880 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u0452\u0453\u0451\u0454\u0455\u0456\u0457\u0458\u005B\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u0459\u045A\u045B\u045C\u045E\u045F\u042A\u2116\u0402\u005D\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u0403\u0401\u0404\u0405\u0406\u0407\u0408\u0409\u007C\u002C\u0025\u005F\u003E\u003F" + - "\u040A\u040B\u040C\u00AD\u040E\u040F\u044E\u0430\u0431\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u0446\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u0434\u0435\u0444\u0433\u0445\u0438" + - "\u0439\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u043A\u043B\u043C\u043D\u043E\u043F" + - "\u044F\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u0440\u0441\u0442\u0443\u0436\u0432" + - "\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u0425\u0418\u0419\u041A\u041B\u041C" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u041D\u041E\u041F\u042F\u0420\u0421" + - "\\\u00A4\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u0422\u0423\u0416\u0412\u042C\u042B" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u0417\u0428\u042D\u0429\u0427\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE94A\uE05A\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u6AD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\u3F3F\uE13F\u3F3F\u3F3F\u3F3F\u3F73\uFFFF\u01A9\u3F3F\u3F63\u5962\u6465\u6667\u6869\u7071" + - "\u723F\u7475\uB9BA\uEDBF\uBCBD\uECFA\uCBCC\uCDCE\uCFDA\uDBDC\uDEDF\uEAEB\uBECA\uBBFE\uFBFD\u57EF" + - "\uEEFC\uB8DD\u7778\uAF8D\u8A8B\uAEB2\u8F90\u9A9B\u9C9D\u9E9F\uAAAB\uACAD\u8C8E\u80B6\uB3B5\uB7B1" + - "\uB0B4\u76A0\u3F44\u4243\u4546\u4748\u4951\u5253\u543F\u5556\uFFFF\u0E5B\u3F3F\u583F\uFFFF\u6F74" + - "\u3F3F"; - - - ConvTable880() - { - super(880, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable9026.java b/cvsroot/src/com/ibm/as400/access/ConvTable9026.java deleted file mode 100644 index 0b9a2fac7..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable9026.java +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable9026.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// This is a Korean character set. -class ConvTable9026 extends ConvTable4930 -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable9026() - { - super(9026); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable9029.java b/cvsroot/src/com/ibm/as400/access/ConvTable9029.java deleted file mode 100644 index f74ed06d0..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable9029.java +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable9029.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// This is a Simplified Chinese character set. -class ConvTable9029 extends ConvTable4933 -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable9029() - { - super(9029); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable9030.java b/cvsroot/src/com/ibm/as400/access/ConvTable9030.java deleted file mode 100644 index de2b0dbe9..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable9030.java +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable9030.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// This is the Thai CCSID. In real life, 9030 is a superset of 838. But the server table for 838 was just updated to include the additions made when 9030 was created. Therefore the 838 table we got from the server is actually the real life 9030 table. So for 9030, we just extend 838 to pick up the new characters. -class ConvTable9030 extends ConvTable838 -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable9030() - { - super(9030); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable905.java b/cvsroot/src/com/ibm/as400/access/ConvTable905.java deleted file mode 100644 index ad1f9801e..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable905.java +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable905.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable905 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u001A\u010B\u007B\u00F1\u00C7\u002E\u003C\u0028\u002B\u0021" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u011E\u0130\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u001A\u010A\u005B\u00D1\u015F\u002C\u0025\u005F\u003E\u003F" + - "\u001A\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0131\u003A\u00D6\u015E\'\u003D\u00DC" + - "\u02D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u0127\u0109\u015D\u016D\u001A\u007C" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u0125\u011D\u0135\u00B8\u001A\u00A4" + - "\u00B5\u00F6\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u0126\u0108\u015C\u016C\u001A\u0040" + - "\u02D9\u00A3\u017C\u007D\u017B\u00A7\u005D\u00B7\u00BD\u0024\u0124\u011C\u0134\u00A8\u00B4\u00D7" + - "\u00E7\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u007E\u00F2\u00F3\u0121" + - "\u011F\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u0060\u00FB\\\u00F9\u00FA\u001A" + - "\u00FC\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u0023\u00D2\u00D3\u0120" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\"\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u404F\uFCEC\uB96C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\uAFC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE968\uDCB6\u5F6D" + - "\uDA81\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA948\u8FB3\uCC07" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u413F\u3FB1\u9F3F\u3FB5\uBD3F\u3F3F\u3FCA\u3F3F\u903F\uEAFA\uBEA0\u3FB7\u9D3F\u3F3F\u3FB8\u3F3F" + - "\u6465\u623F\u633F\u3F4A\u7471\u7273\u7875\u7677\u3F69\uEDEE\uEB3F\u7BBF\u3FFD\uFEFB\u7F3F\u3F59" + - "\u4445\u423F\u433F\u3FC0\u5451\u5253\u5855\u5657\u3F49\uCDCE\uCB3F\uA1E1\u3FDD\uDEDB\uE03F\uFFFF" + - "\u0005\u3F3F\uAB8B\u6747\uFFFF\b\u3F3F\uBB9B\u5AD0\uEFCF\u3F3F\uBA9A\uAA8A\uFFFF\u0004\u3F3F" + - "\u5B79\u3F3F\uBC9C\uFFFF\u0013\u3F3F\uAC8C\u7C6A\uFFFF\u0006\u3F3F\uAD8D\uFFFF\u0006\u3F3F\u3FB4" + - "\uB23F\uFFFF\u00AD\u3F3F\u80B0\uFFFF\u7E93\u3F3F"; - - - ConvTable905() - { - super(905, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable9066.java b/cvsroot/src/com/ibm/as400/access/ConvTable9066.java deleted file mode 100644 index 35368bd9c..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable9066.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable9066.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable9066 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001C\u001B\u007F\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u001A" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u0E48\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F" + - "\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F" + - "\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F" + - "\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37\u0E38\u0E39\u0E3A\u0E49\u0E4A\u0E4B\u0E4C\u0E3F" + - "\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u0E4E\u0E4F" + - "\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59\u0E5A\u0E5B\u00A2\u00AC\u00A6\u00A0"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u7F1B\u1A1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1C" + - "\uFFFF\u0010\u7F7F\uFF7F\uFC7F\u7F7F\uFE7F\u7F7F\u7F7F\uFD7F\uFFFF\u06A9\u7F7F\u7FA1\uA2A3\uA4A5" + - "\uA6A7\uA8A9\uAAAB\uACAD\uAEAF\uB0B1\uB2B3\uB4B5\uB6B7\uB8B9\uBABB\uBCBD\uBEBF\uC0C1\uC2C3\uC4C5" + - "\uC6C7\uC8C9\uCACB\uCCCD\uCECF\uD0D1\uD2D3\uD4D5\uD6D7\uD8D9\uDA7F\u7F7F\u7FDF\uE0E1\uE2E3\uE4E5" + - "\uE6E7\uE8E9\uEAEB\uECED\uEEEF\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\uFAFB\uFFFF\u78D2\u7F7F"; - - - ConvTable9066() - { - super(9066, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } - - ConvTable9066(int ccsid) - { - super(ccsid, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable912.java b/cvsroot/src/com/ibm/as400/access/ConvTable912.java deleted file mode 100644 index 0c2c48094..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable912.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable912.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable912 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u0104\u02D8\u0141\u00A4\u013D\u015A\u00A7\u00A8\u0160\u015E\u0164\u0179\u00AD\u017D\u017B" + - "\u00B0\u0105\u02DB\u0142\u00B4\u013E\u015B\u02C7\u00B8\u0161\u015F\u0165\u017A\u02DD\u017E\u017C" + - "\u0154\u00C1\u00C2\u0102\u00C4\u0139\u0106\u00C7\u010C\u00C9\u0118\u00CB\u011A\u00CD\u00CE\u010E" + - "\u0110\u0143\u0147\u00D3\u00D4\u0150\u00D6\u00D7\u0158\u016E\u00DA\u0170\u00DC\u00DD\u0162\u00DF" + - "\u0155\u00E1\u00E2\u0103\u00E4\u013A\u0107\u00E7\u010D\u00E9\u0119\u00EB\u011B\u00ED\u00EE\u010F" + - "\u0111\u0144\u0148\u00F3\u00F4\u0151\u00F6\u00F7\u0159\u016F\u00FA\u0171\u00FC\u00FD\u0163\u02D9"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u8081\u8283\u8485\u8687\u8889\u8A8B\u8C8D\u8E8F\u9091\u9293\u9495\u9697\u9899\u9A9B\u9C9D\u9E9F" + - "\uA01A\u1A1A\uA41A\u1AA7\uA81A\u1A1A\u1AAD\u1A1A\uB01A\u1A1A\uB41A\u1A1A\uB81A\u1A1A\u1A1A\u1A1A" + - "\u1AC1\uC21A\uC41A\u1AC7\u1AC9\u1ACB\u1ACD\uCE1A\u1A1A\u1AD3\uD41A\uD6D7\u1A1A\uDA1A\uDCDD\u1ADF" + - "\u1AE1\uE21A\uE41A\u1AE7\u1AE9\u1AEB\u1AED\uEE1A\u1A1A\u1AF3\uF41A\uF6F7\u1A1A\uFA1A\uFCFD\u1A1A" + - "\u1A1A\uC3E3\uA1B1\uC6E6\u1A1A\u1A1A\uC8E8\uCFEF\uD0F0\u1A1A\u1A1A\u1A1A\uCAEA\uCCEC\uFFFF\u000E" + - "\u1A1A\u1AC5\uE51A\u1AA5\uB51A\u1AA3\uB3D1\uF11A\u1AD2\uF21A\u1A1A\u1A1A\u1A1A\uD5F5\u1A1A\uC0E0" + - "\u1A1A\uD8F8\uA6B6\u1A1A\uAABA\uA9B9\uDEFE\uABBB\uFFFF\u0004\u1A1A\uD9F9\uDBFB\u1A1A\u1A1A\u1A1A" + - "\u1AAC\uBCAF\uBFAE\uBE1A\uFFFF\u00A3\u1A1A\u1AB7\uFFFF\b\u1A1A\uA2FF\u1AB2\u1ABD\uFFFF\u7E91" + - "\u1A1A"; - - - ConvTable912() - { - super(912, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable914.java b/cvsroot/src/com/ibm/as400/access/ConvTable914.java deleted file mode 100644 index 7c5f32b23..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable914.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable914.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable914 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u0104\u0138\u0156\u00A4\u0128\u013B\u00A7\u00A8\u0160\u0112\u0122\u0166\u00AD\u017D\u00AF" + - "\u00B0\u0105\u02DB\u0157\u00B4\u0129\u013C\u02C7\u00B8\u0161\u0113\u0123\u0167\u014A\u017E\u014B" + - "\u0100\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u012E\u010C\u00C9\u0118\u00CB\u0116\u00CD\u00CE\u012A" + - "\u0110\u0145\u014C\u0136\u00D4\u00D5\u00D6\u00D7\u00D8\u0172\u00DA\u00DB\u00DC\u0168\u016A\u00DF" + - "\u0101\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u012F\u010D\u00E9\u0119\u00EB\u0117\u00ED\u00EE\u012B" + - "\u0111\u0146\u014D\u0137\u00F4\u00F5\u00F6\u00F7\u00F8\u0173\u00FA\u00FB\u00FC\u0169\u016B\u02D9"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u8081\u8283\u8485\u8687\u8889\u8A8B\u8C8D\u8E8F\u9091\u9293\u9495\u9697\u9899\u9A9B\u9C9D\u9E9F" + - "\uA01A\u1A1A\uA41A\u1AA7\uA81A\u1A1A\u1AAD\u1AAF\uB01A\u1A1A\uB41A\u1A1A\uB81A\u1A1A\u1A1A\u1A1A" + - "\u1AC1\uC2C3\uC4C5\uC61A\u1AC9\u1ACB\u1ACD\uCE1A\u1A1A\u1A1A\uD4D5\uD6D7\uD81A\uDADB\uDC1A\u1ADF" + - "\u1AE1\uE2E3\uE4E5\uE61A\u1AE9\u1AEB\u1AED\uEE1A\u1A1A\u1A1A\uF4F5\uF6F7\uF81A\uFAFB\uFC1A\u1A1A" + - "\uC0E0\u1A1A\uA1B1\u1A1A\u1A1A\u1A1A\uC8E8\u1A1A\uD0F0\uAABA\u1A1A\uCCEC\uCAEA\uFFFF\u0004\u1A1A" + - "\uABBB\u1A1A\u1A1A\uA5B5\uCFEF\u1A1A\uC7E7\u1A1A\u1A1A\u1A1A\uD3F3\uA21A\u1AA6\uB61A\u1A1A\u1A1A" + - "\u1A1A\u1AD1\uF11A\u1A1A\uBDBF\uD2F2\uFFFF\u0004\u1A1A\uA3B3\uFFFF\u0004\u1A1A\uA9B9\u1A1A\u1A1A" + - "\uACBC\uDDFD\uDEFE\u1A1A\u1A1A\u1A1A\uD9F9\uFFFF\u0004\u1A1A\u1AAE\uBE1A\uFFFF\u00A3\u1A1A\u1AB7" + - "\uFFFF\b\u1A1A\u1AFF\u1AB2\uFFFF\u7E12\u1A1A\u1A21\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F" + - "\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F" + - "\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F" + - "\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1A\uFFFF\u0050\u1A1A"; - - - ConvTable914() - { - super(914, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable915.java b/cvsroot/src/com/ibm/as400/access/ConvTable915.java deleted file mode 100644 index 8b29135e3..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable915.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable915.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable915 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u0401\u0402\u0403\u0404\u0405\u0406\u0407\u0408\u0409\u040A\u040B\u040C\u00AD\u040E\u040F" + - "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F" + - "\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F" + - "\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F" + - "\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F" + - "\u2116\u0451\u0452\u0453\u0454\u0455\u0456\u0457\u0458\u0459\u045A\u045B\u045C\u00A7\u045E\u045F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u8081\u8283\u8485\u8687\u8889\u8A8B\u8C8D\u8E8F\u9091\u9293\u9495\u9697\u9899\u9A9B\u9C9D\u9E9F" + - "\uA01A\u1A1A\u1A1A\u1AFD\u1A1A\u1A1A\u1AAD\uFFFF\u01A9\u1A1A\u1AA1\uA2A3\uA4A5\uA6A7\uA8A9\uAAAB" + - "\uAC1A\uAEAF\uB0B1\uB2B3\uB4B5\uB6B7\uB8B9\uBABB\uBCBD\uBEBF\uC0C1\uC2C3\uC4C5\uC6C7\uC8C9\uCACB" + - "\uCCCD\uCECF\uD0D1\uD2D3\uD4D5\uD6D7\uD8D9\uDADB\uDCDD\uDEDF\uE0E1\uE2E3\uE4E5\uE6E7\uE8E9\uEAEB" + - "\uECED\uEEEF\u1AF1\uF2F3\uF4F5\uF6F7\uF8F9\uFAFB\uFC1A\uFEFF\uFFFF\u0E5B\u1A1A\uF01A\uFFFF\u6F74" + - "\u1A1A"; - - - ConvTable915() - { - super(915, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable916.java b/cvsroot/src/com/ibm/as400/access/ConvTable916.java deleted file mode 100644 index 745def189..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable916.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable916.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable916 extends ConvTableBidiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u001A\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00D7\u00AB\u00AC\u00AD\u00AE\u203E" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u2022\u00B8\u00B9\u00F7\u00BB\u00BC\u00BD\u00BE\u001A" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A" + - "\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u001A\u2017" + - "\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF" + - "\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u05EA\u001A\u001A\u001A\u001A\u001A"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u8081\u8283\u8485\u8687\u8889\u8A8B\u8C8D\u8E8F\u9091\u9293\u9495\u9697\u9899\u9A9B\u9C9D\u9E9F" + - "\uA01A\uA2A3\uA4A5\uA6A7\uA8A9\u1AAB\uACAD\uAE1A\uB0B1\uB2B3\uB4B5\uB61A\uB8B9\u1ABB\uBCBD\uBE1A" + - "\uFFFF\u000B\u1A1A\u1AAA\uFFFF\u000F\u1A1A\u1ABA\uFFFF\u026C\u1A1A\uE0E1\uE2E3\uE4E5\uE6E7\uE8E9" + - "\uEAEB\uECED\uEEEF\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\uFA1A\uFFFF\u0D15\u1A1A\u1ADF\uFFFF\u0005\u1A1A" + - "\uB71A\uFFFF\r\u1A1A\uAF1A\uFFFF\u6FE0\u1A1A"; - - - ConvTable916() - { - super(916, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable920.java b/cvsroot/src/com/ibm/as400/access/ConvTable920.java deleted file mode 100644 index c136d54af..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable920.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable920.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable920 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + - "\u011E\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC\u0130\u015E\u00DF" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u011F\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u0131\u015F\u00FF"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u8081\u8283\u8485\u8687\u8889\u8A8B\u8C8D\u8E8F\u9091\u9293\u9495\u9697\u9899\u9A9B\u9C9D\u9E9F" + - "\uA0A1\uA2A3\uA4A5\uA6A7\uA8A9\uAAAB\uACAD\uAEAF\uB0B1\uB2B3\uB4B5\uB6B7\uB8B9\uBABB\uBCBD\uBEBF" + - "\uC0C1\uC2C3\uC4C5\uC6C7\uC8C9\uCACB\uCCCD\uCECF\u1AD1\uD2D3\uD4D5\uD6D7\uD8D9\uDADB\uDC1A\u1ADF" + - "\uE0E1\uE2E3\uE4E5\uE6E7\uE8E9\uEAEB\uECED\uEEEF\u1AF1\uF2F3\uF4F5\uF6F7\uF8F9\uFAFB\uFC1A\u1AFF" + - "\uFFFF\u000F\u1A1A\uD0F0\uFFFF\b\u1A1A\uDDFD\uFFFF\u0016\u1A1A\uDEFE\uFFFF\u7F50\u1A1A"; - - - ConvTable920() - { - super(920, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable921.java b/cvsroot/src/com/ibm/as400/access/ConvTable921.java deleted file mode 100644 index 326e688bc..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable921.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable921.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable921 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u201D\u00A2\u00A3\u00A4\u201E\u00A6\u00A7\u00D8\u00A9\u0156\u00AB\u00AC\u00AD\u00AE\u00C6" + - "\u00B0\u00B1\u00B2\u00B3\u201C\u00B5\u00B6\u00B7\u00F8\u00B9\u0157\u00BB\u00BC\u00BD\u00BE\u00E6" + - "\u0104\u012E\u0100\u0106\u00C4\u00C5\u0118\u0112\u010C\u00C9\u0179\u0116\u0122\u0136\u012A\u013B" + - "\u0160\u0143\u0145\u00D3\u014C\u00D5\u00D6\u00D7\u0172\u0141\u015A\u016A\u00DC\u017B\u017D\u00DF" + - "\u0105\u012F\u0101\u0107\u00E4\u00E5\u0119\u0113\u010D\u00E9\u017A\u0117\u0123\u0137\u012B\u013C" + - "\u0161\u0144\u0146\u00F3\u014D\u00F5\u00F6\u00F7\u0173\u0142\u015B\u016B\u00FC\u017C\u017E\u2019"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u8081\u8283\u8485\u8687\u8889\u8A8B\u8C8D\u8E8F\u9091\u9293\u9495\u9697\u9899\u9A9B\u9C9D\u9E9F" + - "\uA01A\uA2A3\uA41A\uA6A7\u1AA9\u1AAB\uACAD\uAE1A\uB0B1\uB2B3\u1AB5\uB6B7\u1AB9\u1ABB\uBCBD\uBE1A" + - "\u1A1A\u1A1A\uC4C5\uAF1A\u0000\u0003\u1AC9\u1A1A\u1A1A\uD3D5\uD6D7\uA81A\u1A1A\uDC1A\u1ADF\u1A1A" + - "\u1A1A\uE4E5\uBF1A\u0000\u0003\u1AE9\u1A1A\u1A1A\uF3F5\uF6F7\uB81A\u1A1A\uFC1A\u1A1A\uC2E2\u1A1A" + - "\uC0E0\uC3E3\u1A1A\u1A1A\uC8E8\u1A1A\u1A1A\uC7E7\u1A1A\uCBEB\uC6E6\uFFFF\u0004\u1A1A\uCCEC\u1A1A" + - "\u1A1A\u1A1A\uCEEE\u1A1A\uC1E1\u1A1A\u1A1A\u1A1A\uCDED\u1A1A\u1ACF\uEF1A\u1A1A\u1AD9\uF9D1\uF1D2" + - "\uF21A\u1A1A\u1A1A\uD4F4\uFFFF\u0004\u1A1A\uAABA\u1A1A\uDAFA\u1A1A\u1A1A\uD0F0\uFFFF\u0004\u1A1A" + - "\uDBFB\u1A1A\u1A1A\u1A1A\uD8F8\u1A1A\u1A1A\u1ACA\uEADD\uFDDE\uFE1A\uFFFF\u0F4C\u1A1A\u1AFF\u1A1A" + - "\uB4A1\uA51A\uFFFF\u6F70\u1A1A\u1A21\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435" + - "\u3637\u3839\u3A3B\u3C3D\u3E3F\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455" + - "\u5657\u5859\u5A5B\u5C5D\u5E5F\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475" + - "\u7677\u7879\u7A7B\u7C7D\u7E1A\uFFFF\u0050\u1A1A"; - - - ConvTable921() - { - super(921, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable922.java b/cvsroot/src/com/ibm/as400/access/ConvTable922.java deleted file mode 100644 index c40c51dbf..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable922.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable922.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable922 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u203E" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + - "\u0160\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u017D\u00DF" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u0161\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u017E\u00FF"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u8081\u8283\u8485\u8687\u8889\u8A8B\u8C8D\u8E8F\u9091\u9293\u9495\u9697\u9899\u9A9B\u9C9D\u9E9F" + - "\uA0A1\uA2A3\uA4A5\uA6A7\uA8A9\uAAAB\uACAD\uAE1A\uB0B1\uB2B3\uB4B5\uB6B7\uB8B9\uBABB\uBCBD\uBEBF" + - "\uC0C1\uC2C3\uC4C5\uC6C7\uC8C9\uCACB\uCCCD\uCECF\u1AD1\uD2D3\uD4D5\uD6D7\uD8D9\uDADB\uDCDD\u1ADF" + - "\uE0E1\uE2E3\uE4E5\uE6E7\uE8E9\uEAEB\uECED\uEEEF\u1AF1\uF2F3\uF4F5\uF6F7\uF8F9\uFAFB\uFCFD\u1AFF" + - "\uFFFF\u0030\u1A1A\uD0F0\uFFFF\r\u1A1A\u1ADE\uFE1A\uFFFF\u0F5F\u1A1A\uAF1A\uFFFF\u6F60\u1A1A" + - "\u1A21\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E1A" + - "\uFFFF\u0050\u1A1A"; - - - ConvTable922() - { - super(922, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable923.java b/cvsroot/src/com/ibm/as400/access/ConvTable923.java deleted file mode 100644 index 6c128875a..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable923.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable923.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable923 extends ConvTableAsciiMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u00A1\u00A2\u00A3\u20AC\u00A5\u0160\u00A7\u0161\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u017D\u00B5\u00B6\u00B7\u017E\u00B9\u00BA\u00BB\u0152\u0153\u0178\u00BF" + - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + - "\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u0405\u0607\u0809\u0A0B\u0C0D\u0E0F\u1011\u1213\u1415\u1617\u1819\u1A1B\u1C1D\u1E1F" + - "\u2021\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F" + - "\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F" + - "\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273\u7475\u7677\u7879\u7A7B\u7C7D\u7E7F" + - "\u8081\u8283\u8485\u8687\u8889\u8A8B\u8C8D\u8E8F\u9091\u9293\u9495\u9697\u9899\u9A9B\u9C9D\u9E9F" + - "\uA0A1\uA2A3\u1AA5\u1AA7\u1AA9\uAAAB\uACAD\uAEAF\uB0B1\uB2B3\u1AB5\uB6B7\u1AB9\uBABB\u1A1A\u1ABF" + - "\uC0C1\uC2C3\uC4C5\uC6C7\uC8C9\uCACB\uCCCD\uCECF\uD0D1\uD2D3\uD4D5\uD6D7\uD8D9\uDADB\uDCDD\uDEDF" + - "\uE0E1\uE2E3\uE4E5\uE6E7\uE8E9\uEAEB\uECED\uEEEF\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\uFAFB\uFCFD\uFEFF" + - "\uFFFF\u0029\u1A1A\uBCBD\uFFFF\u0006\u1A1A\uA6A8\uFFFF\u000B\u1A1A\uBE1A\u1A1A\u1AB4\uB81A\uFFFF" + - "\u0F96\u1A1A\uA41A\uFFFF\u6F29\u1A1A\u1A21\u2223\u2425\u2627\u2829\u2A2B\u2C2D\u2E2F\u3031\u3233" + - "\u3435\u3637\u3839\u3A3B\u3C3D\u3E3F\u4041\u4243\u4445\u4647\u4849\u4A4B\u4C4D\u4E4F\u5051\u5253" + - "\u5455\u5657\u5859\u5A5B\u5C5D\u5E5F\u6061\u6263\u6465\u6667\u6869\u6A6B\u6C6D\u6E6F\u7071\u7273" + - "\u7475\u7677\u7879\u7A7B\u7C7D\u7E1A\uFFFF\u0050\u1A1A"; - - - ConvTable923() - { - super(923, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable924.java b/cvsroot/src/com/ibm/as400/access/ConvTable924.java deleted file mode 100644 index af32e0dc6..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable924.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable924.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class ConvTable924 extends ConvTableSingleMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final String toUnicode_ = - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5\u00E7\u00F1\u00DD\u002E\u003C\u0028\u002B\u007C" + - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF\u00EC\u00DF\u0021\u0024\u002A\u0029\u003B\u005E" + - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5\u00C7\u00D1\u0160\u002C\u0025\u005F\u003E\u003F" + - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u0060\u003A\u0023\u0040\'\u003D\"" + - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070\u0071\u0072\u00AA\u00BA\u00E6\u017E\u00C6\u20AC" + - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007A\u00A1\u00BF\u00D0\u005B\u00DE\u00AE" + - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u0152\u0153\u0178\u00AC\u0161\u00AF\u005D\u017D\u00D7" + - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F"; - - - private static final String fromUnicode_ = - "\u0001\u0203\u372D\u2E2F\u1605\u250B\u0C0D\u0E0F\u1011\u1213\u3C3D\u3226\u1819\u3F27\u1C1D\u1E1F" + - "\u405A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F" + - "\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2\uE3E4\uE5E6\uE7E8\uE9AD\uE0BD\u5F6D" + - "\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA107" + - "\u2021\u2223\u2415\u0617\u2829\u2A2B\u2C09\u0A1B\u3031\u1A33\u3435\u3608\u3839\u3A3B\u0414\u3EFF" + - "\u41AA\uB0B1\u3FB2\u3FB5\u3FB4\u9A8A\uBACA\uAFBC\u908F\uEAFA\u3FA0\uB6B3\u3FDA\u9B8B\u3F3F\u3FAB" + - "\u6465\u6266\u6367\u9E68\u7471\u7273\u7875\u7677\uAC69\uEDEE\uEBEF\uECBF\u80FD\uFEFB\uFC4A\uAE59" + - "\u4445\u4246\u4347\u9C48\u5451\u5253\u5855\u5657\u8C49\uCDCE\uCBCF\uCCE1\u70DD\uDEDB\uDC8D\u8EDF" + - "\uFFFF\u0029\u3F3F\uB7B8\uFFFF\u0006\u3F3F\u6ABB\uFFFF\u000B\u3F3F\uB93F\u3F3F\u3FBE\u9D3F\uFFFF" + - "\u0F96\u3F3F\u9F3F\uFFFF\u6F29\u3F3F\u3F5A\u7F7B\u5B6C\u507D\u4D5D\u5C4E\u6B60\u4B61\uF0F1\uF2F3" + - "\uF4F5\uF6F7\uF8F9\u7A5E\u4C7E\u6E6F\u7CC1\uC2C3\uC4C5\uC6C7\uC8C9\uD1D2\uD3D4\uD5D6\uD7D8\uD9E2" + - "\uE3E4\uE5E6\uE7E8\uE9AD\uE0BD\u5F6D\u7981\u8283\u8485\u8687\u8889\u9192\u9394\u9596\u9798\u99A2" + - "\uA3A4\uA5A6\uA7A8\uA9C0\u4FD0\uA13F\uFFFF\u0050\u3F3F"; - - - ConvTable924() - { - super(924, toUnicode_.toCharArray(), fromUnicode_.toCharArray()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable930.java b/cvsroot/src/com/ibm/as400/access/ConvTable930.java deleted file mode 100644 index 4de70c781..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable930.java +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable930.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; - -class ConvTable930 extends ConvTableMixedMap -{ - ConvTable930() throws UnsupportedEncodingException - { - super(930, 290, 16684); // 16684 is a superset of 300. - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Using alternate map."); - ConvTable4396.makeAlternateMap(dbTable_.toUnicode_, dbTable_.fromUnicode_); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable933.java b/cvsroot/src/com/ibm/as400/access/ConvTable933.java deleted file mode 100644 index 9aa05f2b4..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable933.java +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable933.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; - -class ConvTable933 extends ConvTable1364 -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable933() throws UnsupportedEncodingException - { - super(933); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable935.java b/cvsroot/src/com/ibm/as400/access/ConvTable935.java deleted file mode 100644 index 1207d0997..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable935.java +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable935.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; - -class ConvTable935 extends ConvTableMixedMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable935() throws UnsupportedEncodingException - { - super(935, 836, 837); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable937.java b/cvsroot/src/com/ibm/as400/access/ConvTable937.java deleted file mode 100644 index 4a1c2727f..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable937.java +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable937.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; - -class ConvTable937 extends ConvTableMixedMap -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable937() throws UnsupportedEncodingException - { - super(937, 37, 835); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTable939.java b/cvsroot/src/com/ibm/as400/access/ConvTable939.java deleted file mode 100644 index 894906bdf..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTable939.java +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTable939.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; - -class ConvTable939 extends ConvTable1399 -{ - ConvTable939() throws UnsupportedEncodingException - { - super(939); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Using alternate map."); - ConvTable4396.makeAlternateMap(dbTable_.toUnicode_, dbTable_.fromUnicode_); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTableAsciiMap.java b/cvsroot/src/com/ibm/as400/access/ConvTableAsciiMap.java deleted file mode 100644 index 39d0654d5..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTableAsciiMap.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTableAsciiMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// This is the parent class for all ConvTableXXX classes that represent single-byte ASCII ccsids. -abstract class ConvTableAsciiMap extends ConvTable -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - char[] toUnicode_ = null; - byte[] fromUnicode_ = null; - - // Constructor. - ConvTableAsciiMap(int ccsid, char[] toUnicode, char[] fromUnicode) - { - super(ccsid); - ccsid_ = ccsid; - toUnicode_ = toUnicode; - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Decompressing single-byte ASCII conversion table for ccsid: " + ccsid_, fromUnicode.length); - fromUnicode_ = decompressSB(fromUnicode, (byte)0x1A); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Successfully loaded single-byte ASCII map for ccsid: " + ccsid_); - } - - // Perform an OS/400 CCSID to Unicode conversion. - final String byteArrayToString(byte[] buf, int offset, int length, BidiConversionProperties properties) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting byte array to string for ccsid: " + ccsid_, buf, offset, length); - char[] dest = new char[length]; - // The 0x00FF is so we don't get any negative indices. - for (int i=0; i>> 8)); - buf[c++] = (char)(highByteMask + (0x00FF & both)); - } - i = i + hbNum - 1; - } - } - else - { // Regular character. - buf[c++] = arr[i]; - } - } - - return buf; - } - - // Perform an OS/400 CCSID to Unicode conversion. - final String byteArrayToString(byte[] buf, int offset, int length, BidiConversionProperties properties) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting byte array to string for ccsid: " + ccsid_, buf, offset, length); - char[] dest = new char[length / 2]; - for (int i = 0; i < length / 2; ++i) - { - try - { - dest[i] = toUnicode_[((0x00FF & buf[(i * 2) + offset]) << 8) + (0x00FF & buf[(i * 2) + 1 + offset])]; - } - catch(ArrayIndexOutOfBoundsException aioobe) - { - // Swallow this if we are doing fault-tolerant conversion. - if(!CharConverter.isFaultTolerantConversion()) - { - throw aioobe; - } - } - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination string for ccsid: " + ccsid_, ConvTable.dumpCharArray(dest)); - return String.copyValueOf(dest); - } - - // Perform a Unicode to AS/400 CCSID conversion. - final byte[] stringToByteArray(String source, BidiConversionProperties properties) - { - char[] src = source.toCharArray(); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting string to byte array for ccsid: " + ccsid_, ConvTable.dumpCharArray(src)); - byte[] dest = new byte[src.length * 2]; - for (int i = 0; i < src.length; ++i) - { - dest[i * 2] = (byte)(fromUnicode_[src[i]] >>> 8); - dest[i * 2 + 1] = (byte)(0x00FF & fromUnicode_[src[i]]); - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination byte array for ccsid: " + ccsid_, dest); - return dest; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTableInputStream.java b/cvsroot/src/com/ibm/as400/access/ConvTableInputStream.java deleted file mode 100644 index 19ab6bd47..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTableInputStream.java +++ /dev/null @@ -1,90 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTableInputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; - -// ConvTableInputStream is a single purpose InputStream that should be used only be the ConvTable class. It is designed to improve the performance of character set conversion. -class ConvTableInputStream extends InputStream -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - // The buffer into which incoming data is placed. - private byte[] buffer_ = null; - private int offset_ = 0; - private int end_ = 0; - - ConvTableInputStream() - { - } - - // Hold this buffer. - void setContents(byte[] buffer, int offset, int length) - { - buffer_ = buffer; - offset_ = offset; - end_ = offset + length; - } - - // Read one byte. - public int read() - { - if (buffer_ == null) - { - return -1; - } - int ret = buffer_[offset_++] & 0xFF; - if (offset_ == end_) - { - // Now empty. - buffer_ = null; - } - return ret; - } - - // Read array of bytes. - public int read(byte[] buffer, int offset, int length) - { - if (buffer_ == null) - { - return -1; - } - int bytesAvail = end_ - offset_; - if (length < bytesAvail) - { - System.arraycopy(buffer_, offset_, buffer, offset, length); - offset_ += length; - return length; - } - else - { - System.arraycopy(buffer_, offset_, buffer, offset, bytesAvail); - buffer_ = null; - return bytesAvail; - } - } - - // Number of bytes available. - public int available() - { - if (buffer_ == null) - { - return 0; - } - else - { - return end_ - offset_; - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTableJavaMap.java b/cvsroot/src/com/ibm/as400/access/ConvTableJavaMap.java deleted file mode 100644 index e833cb82c..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTableJavaMap.java +++ /dev/null @@ -1,110 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTableJavaMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; - -// This is the class representing a Java converter table. Each instance of this class handles an encoding that the Toolbox does not support and Java does. Hence, multiple instances of this class could be cached in the converter pool. -class ConvTableJavaMap extends ConvTable -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - InputStreamReader reader_; // The stream that does the actual conversion. - OutputStreamWriter writer_; // The stream that does the actual conversion. - ByteArrayOutputStream outBuffer_; - ConvTableInputStream inBuffer_; - - // Constructor. - ConvTableJavaMap(String encoding) throws UnsupportedEncodingException - { - super(0); // Just for compatibility. - encoding_ = encoding; - String ccsid = ConversionMaps.encodingToCcsidString(encoding); - try - { - ccsid_ = (new Integer(ccsid)).intValue(); - } - catch (Exception e) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "No associated CCSID for encoding '" + encoding + "'. Lookup returned " + ccsid + "."); - ccsid_ = 0; - } - - inBuffer_ = new ConvTableInputStream(); - outBuffer_ = new ByteArrayOutputStream(); - writer_ = new OutputStreamWriter(outBuffer_, encoding_); - reader_ = new InputStreamReader(inBuffer_, encoding_); - - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Successfully loaded Java map for encoding: " + encoding_); - } - - // Let Java perform an Encoding to Unicode conversion. - final String byteArrayToString(byte[] buf, int offset, int length, BidiConversionProperties properties) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting byte array to string for encoding: " + encoding_, buf, offset, length); - char[] dest = new char[length]; - int count = 0; - synchronized (inBuffer_) - { - inBuffer_.setContents(buf, offset, length); - try - { - if (reader_ == null) - { - reader_ = new InputStreamReader(inBuffer_, encoding_); - } - count = reader_.read(dest); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "IOException occurred on byteArrayToString for encoding " + encoding_, e); - } - reader_ = null; - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination string for encoding: " + encoding_ + " (" + count + ")", ConvTable.dumpCharArray(dest)); - return String.copyValueOf(dest, 0, count); - } - - // Let Java perform a Unicode to Encoding conversion. - final byte[] stringToByteArray(String source, BidiConversionProperties properties) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting string to byte array for encoding: " + encoding_, ConvTable.dumpCharArray(source.toCharArray())); - byte[] ret = null; - synchronized (outBuffer_) - { - try - { - outBuffer_.reset(); - if (writer_ == null) - { - writer_ = new OutputStreamWriter(outBuffer_, encoding_); - } - writer_.write(source); - writer_.flush(); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "IOException occurred on stringToByteArray for encoding " + encoding_, e); - } - writer_ = null; - ret = outBuffer_.toByteArray(); - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination byte array for encoding: " + encoding_, ret); - return ret; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTableMixedMap.java b/cvsroot/src/com/ibm/as400/access/ConvTableMixedMap.java deleted file mode 100644 index 4d29123c8..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTableMixedMap.java +++ /dev/null @@ -1,220 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTableMixedMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; - -// This is the parent class for all ConvTableXXX classes that represent mixed-byte ccsids. -abstract class ConvTableMixedMap extends ConvTable -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - - ConvTableSingleMap sbTable_ = null; // The single-byte portion of this mixed-byte table. - ConvTableDoubleMap dbTable_ = null; // The double-byte portion of this mixed-byte table. - - private static final byte sbSubChar_ = 0x003F; // Single-byte EBCDIC substitution character. - private static final char dbSubChar_ = '\uFEFE'; // Double-byte EBCDIC substitution character. - private static final char sbSubUnic_ = '\u001A'; // Single-byte Unicode substitution character. - private static final char dbSubUnic_ = '\uFFFD'; // Double-byte Unicode substitution character. - private static final char euro_ = '\u20AC'; // Euro character. - - static final byte shiftOut_ = 0x0E; // Byte used to shift-out of single byte mode. - static final byte shiftIn_ = 0x0F; // Byte used to shift-in to single byte mode. - - // Constructor. - ConvTableMixedMap(int ccsid, int sbCcsid, int dbCcsid) throws UnsupportedEncodingException - { - super(ccsid); - sbTable_ = (ConvTableSingleMap)ConvTable.getTable(sbCcsid, null); - dbTable_ = (ConvTableDoubleMap)ConvTable.getTable(dbCcsid, null); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Successfully loaded mixed-byte map for ccsid: " + ccsid_); - } - - // Perform an OS/400 CCSID to Unicode conversion. - final String byteArrayToString(byte[] buf, int offset, int length, BidiConversionProperties properties) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting byte array to string for ccsid: " + ccsid_, buf, offset, length); - char[] dest = new char[length]; - boolean inSBMode = true; - - int destPos = 0; - - for (int srcPos = offset; srcPos < offset + length; ++srcPos) - { - byte curByte = buf[srcPos]; - if (inSBMode) - { - // In single byte mode. - if (curByte == shiftOut_) - { - // Shift out character. Switch to double byte mode. - inSBMode = false; - } - else - { - // Normal character. Perform single-byte lookup. - dest[destPos++] = sbTable_.toUnicode_[(0x00FF & curByte)]; - } - } - else - { - // In double byte mode. - if (curByte == shiftIn_) - { - // Shift in character. Switch to single byte mode. - inSBMode = true; - } - else - { - try - { - // Normal character. Perform double-byte lookup. - dest[destPos++] = dbTable_.toUnicode_[((0x00FF & curByte) << 8) + (0x00FF & buf[++srcPos])]; - } - catch (ArrayIndexOutOfBoundsException aioobe) - { - // Swallow this if we are doing fault-tolerant conversion. - if(!CharConverter.isFaultTolerantConversion()) - { - throw aioobe; - } - --destPos; - } - } - } - } - - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination string for ccsid: " + ccsid_ + ": 0," + destPos, ConvTable.dumpCharArray(dest)); - return String.copyValueOf(dest, 0, destPos); - } - - // Perform a Unicode to OS/400 CCSID conversion. - final byte[] stringToByteArray(String source, BidiConversionProperties properties) - { - char[] src = source.toCharArray(); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting string to byte array for ccsid: " + ccsid_, ConvTable.dumpCharArray(src)); - // Max possible length for mixed-byte byte array. - byte[] dest = new byte[(src.length * 5 + 3) / 2]; - - boolean inSBMode = true; - - byte sbLookup = 0x00; - char dbLookup = '\u0000'; - - int destPos = 0; - for (int srcPos = 0; srcPos < src.length; ++srcPos) - { - char curChar = src[srcPos]; - - // There is no concept of mode context when converting a String to a byte array. - // The table we look at first is only based on the current character in the String. - if ((curChar & 0xFF00) == 0x0000 || curChar == euro_) - { - // Use single-byte table first. - sbLookup = sbTable_.fromUnicode_[curChar]; - if (sbLookup == sbSubChar_ && curChar != sbSubUnic_) - { - // Character wasn't in single-byte table. Check double-byte table next. - dbLookup = dbTable_.fromUnicode_[curChar]; - if (dbLookup == dbSubChar_) - { - // Character wasn't in the double-byte table either, so use single-byte substitution character. - if (!inSBMode) - { - inSBMode = true; - dest[destPos++] = shiftIn_; - } - dest[destPos++] = sbSubChar_; - } - else - { - // Character found in double-byte table. - if (inSBMode) - { - inSBMode = false; - dest[destPos++] = shiftOut_; - } - dest[destPos++] = (byte)((0xFFFF & dbLookup) >>> 8); - dest[destPos++] = (byte)(0x00FF & dbLookup); - } - } - else - { - // Character found in single-byte table. - if (!inSBMode) - { - inSBMode = true; - dest[destPos++] = shiftIn_; - } - dest[destPos++] = sbLookup; - } - } - else - { - // Use double-byte table first. - dbLookup = dbTable_.fromUnicode_[curChar]; - if (dbLookup == dbSubChar_ && curChar != dbSubUnic_) - { - // Character wasn't in double-byte table. Check single-byte table next. - sbLookup = sbTable_.fromUnicode_[curChar]; - if (sbLookup == sbSubChar_) - { - // Character wasn't in the single-byte table either, so use double-byte substitution character. - if (inSBMode) - { - inSBMode = false; - dest[destPos++] = shiftOut_; - } - dest[destPos++] = (byte)((0xFFFF & dbSubChar_) >>> 8); - dest[destPos++] = (byte)(0x00FF & dbSubChar_); - } - else - { - // Character found in single-byte table. - if (!inSBMode) - { - inSBMode = true; - dest[destPos++] = shiftIn_; - } - dest[destPos++] = sbLookup; - } - } - else - { - // Character found in double-byte table. - if (inSBMode) - { - inSBMode = false; - dest[destPos++] = shiftOut_; - } - dest[destPos++] = (byte)((0xFFFF & dbLookup) >>> 8); - dest[destPos++] = (byte)(0x00FF & dbLookup); - } - } - } - - // Write final shift in, just in case. - if (!inSBMode) - { - dest[destPos++] = shiftIn_; - } - - byte[] ret = new byte[destPos]; - System.arraycopy(dest, 0, ret, 0, destPos); - - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination byte array for ccsid: " + ccsid_, ret); - return ret; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTableReader.java b/cvsroot/src/com/ibm/as400/access/ConvTableReader.java deleted file mode 100644 index c977045b6..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTableReader.java +++ /dev/null @@ -1,735 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTableReader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.BufferedInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.UnsupportedEncodingException; -import java.sql.SQLException; - -/** - Represents a Toolbox converter that uses stateful character conversion. That is, it wraps an underlying InputStream and reads/caches the appropriate number of bytes to return the requested number of Unicode characters. This is especially useful for mixed-byte tables where the number of converted Unicode characters is almost never the same as the number of underlying EBCDIC bytes. This class exists primarily for use with the IFSTextFile... classes, but other components are free to use it as well. - @see com.ibm.as400.access.ConvTableWriter - @see com.ibm.as400.access.ReaderInputStream - **/ -public class ConvTableReader extends InputStreamReader -{ - private BufferedInputStream is_ = null; - - private int ccsid_ = -1; - private ConvTable table_ = null; - - private BidiConversionProperties properties_ = new BidiConversionProperties(); - - // The mode is used for mixed-byte tables only. - static final int DB_MODE = 1; - static final int SB_MODE = 2; - private int mode_ = SB_MODE; // default to single-byte mode unless we receive a shift-out - - // The different table types, based on the instance of the ConvTable. - private static final int SB_TABLE = 10; - private static final int DB_TABLE = 11; - private static final int MB_TABLE = 12; - private static final int JV_TABLE = 13; - private static final int UTF8_TABLE = 14; - private int tableType_ = SB_TABLE; - - private char[] cache_ = new char[1024]; // The character cache. - private byte[] b_cache_ = new byte[2562]; // ((1024*5)+3)/2 == worst case mixed-byte array size +1 for extra shift byte, just in case. - private boolean isCachedByte_ = false; // Used for double-byte tables. - private byte cachedByte_ = 0; // Used for double-byte tables. - - private byte[] leftovers = new byte[3]; // Used for portions of utf-8 characters at the cache_ boundary. - private int leftoverCount = 0; // How many bytes are in the leftovers. - - private int nextRead_ = 0; // Cache needs to be filled when nextRead_ >= nextWrite_ - private int nextWrite_ = 0; - boolean isXML_ = false; //@xml3 true if this data originated from a native XML column type //@xml4 @ascii - private boolean isFirstRead_ = true; //@xml3 - - /** - Creates a ConvTableReader that uses the default character encoding. The CCSID this reader uses may be set if a known mapping exists for this platform's default character encoding. - @param in The InputStream from which to read characters. - @exception UnsupportedEncodingException If the default character encoding or its associated CCSID is not supported. - **/ - public ConvTableReader(InputStream in) throws UnsupportedEncodingException - { - super(in); - is_ = new BufferedInputStream(in); - initializeCcsid(); - initializeTable(); - } - - /** - Creates a ConvTableReader that uses the specified character encoding. The CCSID this reader uses may be set if a known mapping exists for the given encoding. - @param in The InputStream from which to read characters. - @param encoding The name of a supported character encoding. - @exception UnsupportedEncodingException If the specified character encoding or its associated CCSID is not supported. - **/ - public ConvTableReader(InputStream in, String encoding) throws UnsupportedEncodingException - { - super(in, encoding); - is_ = new BufferedInputStream(in); - initializeCcsid(); - initializeTable(); - } - - /** - Creates a ConvTableReader that uses the specified CCSID. - @param in The InputStream from which to read characters. - @param ccsid The CCSID. - @exception UnsupportedEncodingException If the specified CCSID or its corresponding character encoding is not supported. - **/ - public ConvTableReader(InputStream in, int ccsid) throws UnsupportedEncodingException - { - super(in); - if (ccsid < 0 || ccsid > 65535) - { - Trace.log(Trace.ERROR, "Value of parameter 'ccsid' is not valid:", ccsid); - throw new ExtendedIllegalArgumentException("ccsid", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - is_ = new BufferedInputStream(in); - ccsid_ = ccsid; - initializeTable(); - } - - //@xml3 new constructor - /** - Creates a ConvTableReader that uses the specified CCSID. - @param in The InputStream from which to read characters. - @param ccsid The CCSID. - @param isXML flag that stream is from an XML column type (needed to strip xml declaration) - @exception UnsupportedEncodingException If the specified CCSID or its corresponding character encoding is not supported. - **/ - public ConvTableReader(InputStream in, int ccsid, boolean isXML) throws UnsupportedEncodingException - { - this(in, ccsid); - isXML_ = isXML; - } - - /** - Creates a ConvTableReader that uses the specified CCSID and bi-directional string type. - @param in The InputStream from which to read characters. - @param ccsid The CCSID. - @param bidiStringType The {@link com.ibm.as400.access.BidiStringType bi-directional string type}. - @exception UnsupportedEncodingException If the specified CCSID or its corresponding character encoding is not supported. - **/ - public ConvTableReader(InputStream in, int ccsid, int bidiStringType) throws UnsupportedEncodingException - { - this(in, ccsid, new BidiConversionProperties(bidiStringType)); - } - - //@xml3 new constructor - /** - Creates a ConvTableReader that uses the specified CCSID and bi-directional string type. - @param in The InputStream from which to read characters. - @param ccsid The CCSID. - @param bidiStringType The {@link com.ibm.as400.access.BidiStringType bi-directional string type}. - @param isXML flag that stream is from an XML column type (needed to strip xml declaration) - @exception UnsupportedEncodingException If the specified CCSID or its corresponding character encoding is not supported. - **/ - public ConvTableReader(InputStream in, int ccsid, int bidiStringType, boolean isXML) throws UnsupportedEncodingException - { - this(in, ccsid, new BidiConversionProperties(bidiStringType)); - isXML_ = isXML; - } - - - /** - Creates a ConvTableReader that uses the specified CCSID and bi-directional string type. - @param in The InputStream from which to read characters. - @param ccsid The CCSID. - @param properties The bidi conversion properties. - @exception UnsupportedEncodingException If the specified CCSID or its corresponding character encoding is not supported. - **/ - public ConvTableReader(InputStream in, int ccsid, BidiConversionProperties properties) throws UnsupportedEncodingException - { - super(in); - if (ccsid < 0 || ccsid > 65535) - { - Trace.log(Trace.ERROR, "Value of parameter 'ccsid' is not valid:", ccsid); - throw new ExtendedIllegalArgumentException("ccsid", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - is_ = new BufferedInputStream(in); - ccsid_ = ccsid; - properties_ = properties; - initializeTable(); - } - - /** - Creates a ConvTableReader that uses the specified CCSID, bi-directional string type, and internal cache size. - @param in The InputStream from which to read characters. - @param ccsid The CCSID. - @param bidiStringType The {@link com.ibm.as400.access.BidiStringType bi-directional string type}. - @param cacheSize The number of characters to store in the internal buffer. The default is 1024. This number must be greater than zero. - @exception UnsupportedEncodingException If the specified CCSID or its corresponding character encoding is not supported. - **/ - public ConvTableReader(InputStream in, int ccsid, int bidiStringType, int cacheSize) throws UnsupportedEncodingException - { - this(in, ccsid, bidiStringType); - if (cacheSize < 1) - { - Trace.log(Trace.ERROR, "Value of parameter 'cacheSize' is not valid:", cacheSize); - throw new ExtendedIllegalArgumentException("cacheSize", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - cache_ = new char[cacheSize]; // The character cache. - b_cache_ = new byte[((cacheSize*5)+3)/2]; // ((1024*5)+3)/2 == worst case mixed-byte array size +1 for extra shift byte, just in case. - } - - /** - Closes this ConvTableReader and its underlying input stream. Calling close() multiple times will not throw an exception. - @exception IOException If an I/O exception occurs. - **/ - public void close() throws IOException - { - synchronized (lock) - { - if (table_ == null) return; //we are already closed - table_ = null; - cache_ = null; - b_cache_ = null; - super.close(); - is_.close(); - } - } - - private boolean fillCache() throws IOException - { - synchronized (lock) - { - checkOpen(); - if (nextRead_ >= nextWrite_) - { - int numRead = 0; - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Filling cache for reader " + ccsid_ + "/" + tableType_ + " [" + toString() + "]: " + nextRead_ + "," + nextWrite_ + "," + cache_.length); - if (tableType_ == SB_TABLE || tableType_ == JV_TABLE) - { - numRead = is_.read(b_cache_, 0, cache_.length); - } - else if (tableType_ == DB_TABLE) - { - if (isCachedByte_) - { - numRead = is_.read(b_cache_, 1, cache_.length-1); - if (numRead == -1) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Cache not filled, end of stream reached."); - return false; - } - b_cache_[0] = cachedByte_; - if (numRead % 2 == 0) // if we've read an even number of chars, need to proliferate the last byte. - { - cachedByte_ = b_cache_[numRead]; - isCachedByte_ = true; - } - else - { - isCachedByte_ = false; - } - } - else - { - numRead = is_.read(b_cache_, 0, cache_.length); - if (numRead > 0 && numRead % 2 != 0) // did we read an odd number of chars - { - cachedByte_ = b_cache_[numRead-1]; - isCachedByte_ = true; - --numRead; - } - } - } - else if (tableType_ == MB_TABLE) - { - // Max number of bytes for worst-case mixed-byte data scenario is (5x+3)/2. - int c = 0; - if (mode_ == DB_MODE) - { - // Begin with a shift-out since we left off in DB_MODE last time. - b_cache_[numRead++] = ConvTableMixedMap.shiftOut_; - if (isCachedByte_) // Note that we don't ever cache a shift byte or a single-byte char - we only cache half of a double-byte char. - { - b_cache_[numRead++] = cachedByte_; - isCachedByte_ = false; - } - } - // Don't read too much, we only want to read enough that will fit in our character cache after conversion. - int curRead = is_.read(b_cache_, numRead, cache_.length - 1); - if (curRead == -1 && numRead == 0) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Cache not filled, end of stream reached."); - return false; // End-of-stream. - } - if (curRead > -1) numRead += curRead; - - // Find out which mode we are in when we stopped reading. - boolean needToCache = false; - for (int i = 0; i < numRead; ++i) - { - if (mode_ == SB_MODE) - { - if (b_cache_[i] == ConvTableMixedMap.shiftOut_) mode_ = DB_MODE; - } - else - { - // In DB_MODE. - if (b_cache_[i] == ConvTableMixedMap.shiftIn_) - { - mode_ = SB_MODE; - needToCache = false; - } - else - { - needToCache = !needToCache; - } - } - } - if (mode_ == DB_MODE) - { - if (needToCache) - { - cachedByte_ = b_cache_[--numRead]; - isCachedByte_ = true; - } - - // Need to finish with a shift-in. - b_cache_[numRead++] = ConvTableMixedMap.shiftIn_; - } - } - else if (tableType_ == UTF8_TABLE) - { - // Were there leftovers from the previous read? - if (leftoverCount > 0) - { - // Move the leftovers into the cache prior to reading in any more. - System.arraycopy(leftovers, 0, b_cache_, 0, leftoverCount); - // Fill in the rest of the cache bytes read from the stream. - numRead = is_.read(b_cache_, leftoverCount, cache_.length-leftoverCount); - - // It's possible that the numRead is -1, we still have to pretend to read the number of bytes indicated by leftoverCount. - numRead = numRead == -1 ? leftoverCount : numRead + leftoverCount; - } - else - { - // No leftovers, try to fill the entire cache with bytes from the stream. - numRead = is_.read(b_cache_, 0, cache_.length); - } - - // If no bytes were read, then we have reached the end. - if (numRead == -1) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Cache not filled, end of stream reached."); - return false; - } - - // If fewer bytes were read than requested, can we assume there are no characaters remaining to be read? - if (numRead < cache_.length) - { - leftoverCount = 0; - } - else - { - // This is where we figure out if a utf-8 character (1-4 bytes) is straddling the cache boundary (|) - // The leftoverCount is how many bytes we need to carryover to the next read. - // case 1: 0xxxxxxx | - // case 2: 110xxxxx 10xxxxxx | - // case 3: 1110xxxx 10xxxxxx 10xxxxxx | - // case 4: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx | - // leftoverCount = 0 - // - // case 5: 110xxxxx | - // case 6: 1110xxxx | - // case 7: 11110xxx | - // leftoverCount = 1 - // - // case 8: 1110xxxx 10xxxxxx | - // case 9: 11110xxx 10xxxxxx | - // leftoverCount = 2 - // - // case 10: 11110xxx 10xxxxxx 10xxxxxx | - // leftoverCount = 3 - - int n = cache_.length - 1; - if ((b_cache_[n] & 0x80) == 0 ) - { - leftoverCount = 0; // Case 1. - } - else if ((b_cache_[n] & 0xC0) == 0xC0) - { - leftoverCount = 1; // Case 5, 6, and 7. - leftovers[0] = b_cache_[n]; - } - else if (n>0 && ((b_cache_[n-1] & 0xE0) == 0xE0)) - { - leftoverCount = 2; // Case 8, and 9. - System.arraycopy(b_cache_, n-1, leftovers, 0, leftoverCount); - } - else if (n>1 && ((b_cache_[n-2] & 0xF0) == 0xF0)) - { - leftoverCount = 3; // Case 10. - System.arraycopy(b_cache_, n-2, leftovers, 0, leftoverCount); - } - else - { - leftoverCount = 0; // Case 2, 3, and 4. - } - // Adjust the numRead, so it appears the the leftovers aren't in the cache yet. - numRead -= leftoverCount; - } - } - else - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Unknown table type during conversion: " + tableType_); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - - if (numRead == -1) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Cache not filled, end of stream reached."); - return false; - } - - String s = table_.byteArrayToString(b_cache_, 0, numRead, properties_); - nextWrite_ = s.length(); - s.getChars(0, nextWrite_, cache_, 0); - nextRead_ = 0; - - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Filled cache for reader: " + nextRead_ + "," + nextWrite_ + "," + cache_.length, ConvTable.dumpCharArray(cache_, nextWrite_)); - } - - if (nextRead_ >= nextWrite_) // Still didn't read enough, so try again. - { - // This should never happen, but the javadoc for InputStream is unclear if the read(byte[],int,int) method will sometimes return 0 or always read at least 1 byte. - return fillCache(); - } - //@xml3 trim xml declaration if needed "" - //read from stream until declaration is matched. - if(isXML_ && isFirstRead_) - { - String s = String.copyValueOf(cache_,0, nextWrite_); - int origLen = s.length(); - try{ - s = JDUtilities.stripXMLDeclaration(s); - //here, we know s has no declaration (to begin with or after strip) - //next shift chars after declaration to index 0 - s.getChars(0, s.length(), cache_, 0); - int trimmed = origLen - s.length(); - nextWrite_ -= trimmed; - isFirstRead_ = false; - }catch(SQLException e){ - //here we know that start was found, but no ending - //get some more data and remove any chars after " (nextWrite_ - nextRead_) ? (nextWrite_ - nextRead_) : buffer.length; - System.arraycopy(cache_, nextRead_, buffer, 0, max); - nextRead_ += max; - return max; - } - } - return -1; - } - - /** - Reads characters into a portion of the specified array. If close() is called prior to calling this method, an exception will be thrown. - @param buffer The destination buffer. - @param offset The offset into the buffer at which to begin storing data. - @param length The maximum number of characters to store. If a zero length is specified, this method does nothing and returns 0. - @return The number of characters read, or -1 if the end of the stream has been reached. - @exception IOException If an I/O exception occurs. - **/ - public int read(char[] buffer, int offset, int length) throws IOException - { - if (buffer == null) - { - Trace.log(Trace.ERROR, "Parameter 'buffer' is null."); - throw new NullPointerException("buffer"); - } - if (length == 0) return 0; // The JDK doesn't throw exceptions when the length is 0. - if (offset < 0 || offset >= buffer.length) - { - Trace.log(Trace.ERROR, "Value of parameter 'offset' is not valid:", offset); - throw new ExtendedIllegalArgumentException("offset", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (length < 0 || (offset + length) > buffer.length) - { - // Note: InputStreamReader throws IndexOutOfBoundsException if length overflow buffer. We try to be a little nicer. - Trace.log(Trace.ERROR, "Specified length would overflow buffer:", length); - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - synchronized (lock) - { - if (fillCache()) - { - int max = length > (nextWrite_ - nextRead_) ? (nextWrite_ - nextRead_) : length; - System.arraycopy(cache_, nextRead_, buffer, offset, max); - nextRead_ += max; - return max; - } - } - return -1; - } - - /** - Reads up to length characters out of the underlying stream. If close() is called prior to calling this method, an exception will be thrown. - @param length The maximum number of Unicode characters to return as a String. Note that the number of bytes read from the underlying InputStream could be greater than length. If a zero length is specified, this method does nothing and returns "". - @return A String of up to length Unicode characters, or null if the end of the stream has been reached. The actual number of characters returned may be less than the specified length if the end of the underlying InputStream is reached while reading. - @exception IOException If an I/O exception occurs. - **/ - public String read(int length) throws IOException - { - if (length < 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'length' is not valid:", length); - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (length == 0) return ""; - synchronized (lock) - { - StringBuffer buf = new StringBuffer(); - if (fillCache()) - { - while (fillCache() && buf.length() < length) - { - buf.append(cache_, nextRead_++, 1); - } - return buf.toString(); - } - } - return null; - } - - /** - Tells whether this ConvTableReader is ready to be read. A ConvTableReader is ready if its input buffer is not empty or if bytes are available to be read from the underlying input stream. If close() is called, a call to ready() will always return false. - @return true if the ConvTableReader is ready to read characters; false otherwise. - @exception IOException If an I/O exception occurs. - **/ - public boolean ready() throws IOException - { - synchronized (lock) - { - if (table_ == null) // We are closed. - { - return super.ready(); // This should throw an IOException. - } - return (nextRead_ < nextWrite_) || is_.available() > 0; - } - } - - /** - Skips the specified number of characters in the underlying stream. If close() is called prior to calling this method, an exception will be thrown. - @param length The number of characters to skip. - @return The number of characters actually skipped. - @exception IOException If an I/O exception occurs. - **/ - public long skip(long length) throws IOException - { - if (length < 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'length' is not valid: " + length); - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (length == 0) return 0; - long total = 0; - synchronized (lock) - { - // Note: We can't just call is_.skip(length), since that would just skip 'length' bytes, but we need to skip 'length' characters. - checkOpen(); - char[] buf = new char[length < cache_.length ? (int)length : cache_.length]; - int r = read(buf); - total += r; - while (r > 0 && total < length) - { - r = read(buf); - if (r > 0) total += r; - } - - if (isXML_) - { - if((r!=total) && (length > (total-r))) //@xml5 (if length is > than the total read from previous reads (skips)) - { - nextRead_ = (int)(length - (total-(long)r));//@xml5 (set nextRead_ to offset that could be after reading in first buffer of chars) - } - } - } - return total; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTableSingleMap.java b/cvsroot/src/com/ibm/as400/access/ConvTableSingleMap.java deleted file mode 100644 index b3c483772..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTableSingleMap.java +++ /dev/null @@ -1,95 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTableSingleMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; - -// This is the parent class for all ConvTableXXX classes that represent single-byte ccsids. -abstract class ConvTableSingleMap extends ConvTable -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - char[] toUnicode_ = null; - byte[] fromUnicode_ = null; - - // Constructor. - ConvTableSingleMap(int ccsid, char[] toUnicode, char[] fromUnicode) - { - super(ccsid); - ccsid_ = ccsid; - toUnicode_ = toUnicode; - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Decompressing single-byte conversion table for ccsid: " + ccsid_, fromUnicode.length); - //Moved decompression algorithm to parent. - fromUnicode_ = decompressSB(fromUnicode, (byte)0x3F); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Successfully loaded single-byte map for ccsid: " + ccsid_); - } - - // Perform an OS/400 CCSID to Unicode conversion. - final String byteArrayToString(byte[] buf, int offset, int length, BidiConversionProperties properties) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting byte array to string for ccsid: " + ccsid_, buf, offset, length); - char[] dest = new char[length]; - // The 0x00FF is so we don't get any negative indices. - for (int i = 0; i < length; dest[i] = toUnicode_[0x00FF & buf[offset + (i++)]]); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination string for ccsid: " + ccsid_, ConvTable.dumpCharArray(dest)); - return String.copyValueOf(dest); - } - - // Perform a Unicode to OS/400 CCSID conversion. - final byte[] stringToByteArray(String source, BidiConversionProperties properties) - { - char[] src = source.toCharArray(); - // Call char[] method. - return stringToByteArray(src, 0, src.length); - } - - final byte[] stringToByteArray(char[] src, int offset, int length) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting string to byte array for ccsid: " + ccsid_, ConvTable.dumpCharArray(src, offset, length)); - byte[] dest = new byte[length]; - for (int i = offset; i < length; dest[i] = fromUnicode_[src[i++]]); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination byte array for ccsid: " + ccsid_, dest); - return dest; - } - - final void stringToByteArray(String source, byte[] buf, int offset) throws CharConversionException - { - char[] src = source.toCharArray(); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting string to byte array for ccsid: " + ccsid_, ConvTable.dumpCharArray(src)); - try - { - for (int i = 0; i < src.length; buf[i + offset] = fromUnicode_[src[i++]]); - } - catch (ArrayIndexOutOfBoundsException aioobe) - { - throw new CharConversionException(); - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination byte array for ccsid: " + ccsid_, buf, offset, src.length); - } - - final void stringToByteArray(String source, byte[] buf, int offset, int length) throws CharConversionException - { - char[] src = source.toCharArray(); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting string to byte array for ccsid: " + ccsid_, ConvTable.dumpCharArray(src)); - try - { - for (int i = 0; i < src.length && i < length; buf[i + offset] = fromUnicode_[src[i++]]); - } - catch (ArrayIndexOutOfBoundsException aioobe) - { - throw new CharConversionException(); - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination byte array for ccsid: " + ccsid_, buf, offset, src.length); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTableUnicodeBigMap.java b/cvsroot/src/com/ibm/as400/access/ConvTableUnicodeBigMap.java deleted file mode 100644 index f05223a1d..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTableUnicodeBigMap.java +++ /dev/null @@ -1,125 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTableUnicodeBigMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; - -public class ConvTableUnicodeBigMap extends ConvTable -{ - ConvTableUnicodeBigMap(int ccsid) - { - super(ccsid); - } - - // Perform an OS/400 CCSID to Unicode conversion. - final String byteArrayToString(byte[] buf, int offset, int length, int type) - { - return byteArrayToString(buf, offset, length); - } - - final String byteArrayToString(byte[] buf, int offset, int length, BidiConversionProperties properties) - { - return byteArrayToString(buf, offset, length); - } - - final String byteArrayToString(byte[] buf, int offset, int length) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting byte array to string for ccsid: " + ccsid_, buf, offset, length); - char[] dest = new char[length / 2]; - for (int destPos = 0, bufPos = offset; destPos < dest.length; ++destPos) - { - dest[destPos] = (char)(((buf[bufPos++] & 0xFF) << 8) + (buf[bufPos++] & 0xFF)); - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination string for ccsid: " + ccsid_, ConvTable.dumpCharArray(dest)); - return String.copyValueOf(dest); - } - - // Perform a Unicode to OS/400 CCSID conversion. - final byte[] stringToByteArray(String source, int type) - { - char[] src = source.toCharArray(); - return stringToByteArray(src, 0, src.length); - } - - final byte[] stringToByteArray(String source, BidiConversionProperties properties) - { - char[] src = source.toCharArray(); - return stringToByteArray(src, 0, src.length); - } - - final byte[] stringToByteArray(char[] src, int offset, int length) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting string to byte array for ccsid: " + ccsid_, ConvTable.dumpCharArray(src, offset, length)); - byte[] dest = new byte[length * 2]; - for (int destPos = 0, srcPos = offset; srcPos < length; ++srcPos) - { - dest[destPos++] = (byte)(src[srcPos] >>> 8); - dest[destPos++] = (byte)src[srcPos]; - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination byte array for ccsid: " + ccsid_, dest); - return dest; - } - - final void stringToByteArray(String source, byte[] buf, int offset) throws CharConversionException - { - char[] src = source.toCharArray(); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting string to byte array for ccsid: " + ccsid_, ConvTable.dumpCharArray(src)); - try - { - for (int bufPos = offset, srcPos = 0; srcPos < src.length; ++srcPos) - { - buf[bufPos++] = (byte)(src[srcPos] >>> 8); - buf[bufPos++] = (byte)src[srcPos]; - } - } - catch (ArrayIndexOutOfBoundsException e) - { - Trace.log(Trace.ERROR, "Source length: " + src.length + "; Source offset: 0; Destination length: " + buf.length + "; Destination offset: " + offset + ";", e); - throw new CharConversionException(); - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination byte array for ccsid: " + ccsid_, buf, offset, src.length*2); - } - - final void stringToByteArray(String source, byte[] buf, int offset, int length) throws CharConversionException - { - char[] src = source.toCharArray(); - int copyLength = Math.min(src.length, length / 2); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Converting string to byte array for ccsid: " + ccsid_, ConvTable.dumpCharArray(src, 0, copyLength)); - try - { - for (int bufPos = offset, srcPos = 0; srcPos < copyLength; ++srcPos) - { - buf[bufPos++] = (byte)(src[srcPos] >>> 8); - buf[bufPos++] = (byte)src[srcPos]; - } - } - catch (ArrayIndexOutOfBoundsException e) - { - Trace.log(Trace.CONVERSION, "Source length: " + src.length + "; Source offset: 0; Destination length: " + buf.length + "; Destination offset: " + offset + "; Number of bytes to copy: " + length, e); - throw new CharConversionException(); - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination byte array for ccsid: " + ccsid_, buf, offset, copyLength * 2); - } - - final void stringToByteArray(String source, byte[] buf, int offset, int length, int type) throws CharConversionException - { - stringToByteArray(source, buf, offset, length); - } - - final int stringToByteArray(String source, byte[] buf, int offset, int length, BidiConversionProperties properties) throws CharConversionException - { - stringToByteArray(source, buf, offset, length); - return 0; //@trnc - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConvTableWriter.java b/cvsroot/src/com/ibm/as400/access/ConvTableWriter.java deleted file mode 100644 index ae1d5e6dd..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConvTableWriter.java +++ /dev/null @@ -1,417 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConvTableWriter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.BufferedOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; - -/** - A ConvTableWriter represents a Toolbox converter that uses stateful character conversion. That is, it wraps an underlying OutputStream and caches/writes the appropriate number of bytes for the given Unicode characters and CCSID/encoding. This is especially useful when converting Strings and characters to a mixed-byte CCSID, and you don't want to have to keep track of which shift state the conversion stream is in between writes. - @see ConvTableReader - **/ -public class ConvTableWriter extends OutputStreamWriter -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private BufferedOutputStream os_ = null; - - private int ccsid_ = -1; - private ConvTable table_ = null; - - private BidiConversionProperties properties_ = new BidiConversionProperties(); - - // The table type, based on the instance of the ConvTable. - private boolean isMixedByte_ = false; - - private char[] cache_ = new char[1024]; // The character cache. - private boolean isCachedByte_ = false; // Used for double-byte tables. - private byte cachedByte_ = 0; // Used for double-byte tables. - - private int nextWrite_ = 0; - - /** - Creates a ConvTableWriter that uses the default character encoding. The CCSID this writer uses may be set if a known mapping exists for this platform's default character encoding. - @param out The OutputStream to which to write characters. - @exception UnsupportedEncodingException If the default character encoding or its associated CCSID is not supported. - **/ - public ConvTableWriter(OutputStream out) throws UnsupportedEncodingException - { - super(out); - os_ = new BufferedOutputStream(out); - initializeCcsid(); - initializeTable(); - } - - /** - Creates a ConvTableWriter that uses the specified character encoding. The CCSID this writer uses may be set if a known mapping exists for the given encoding. - @param out The OutputStream to which to write characters. - @param encoding The name of a supported character encoding. - @exception UnsupportedEncodingException If the specified character encoding or its associated CCSID is not supported. - **/ - public ConvTableWriter(OutputStream out, String encoding) throws UnsupportedEncodingException - { - super(out, encoding); - os_ = new BufferedOutputStream(out); - initializeCcsid(); - initializeTable(); - } - - /** - Creates a ConvTableWriter that uses the specified CCSID. - @param out The OutputStream to which to write characters. - @param ccsid The CCSID. - @exception UnsupportedEncodingException If the specified CCSID or its corresponding character encoding is not supported. - **/ - public ConvTableWriter(OutputStream out, int ccsid) throws UnsupportedEncodingException - { - super(out); - if (ccsid < 0 || ccsid > 65535) - { - Trace.log(Trace.ERROR, "Value of parameter 'ccsid' is not valid:", ccsid); - throw new ExtendedIllegalArgumentException("ccsid", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - os_ = new BufferedOutputStream(out); - ccsid_ = ccsid; - initializeTable(); - } - - /** - Creates a ConvTableWriter that uses the specified CCSID and bi-directional string type. - @param out The OutputStream to which to write characters. - @param ccsid The CCSID. - @param bidiStringType The {@link com.ibm.as400.access.BidiStringType bi-directional string type}. - @exception UnsupportedEncodingException If the specified CCSID or its corresponding character encoding is not supported. - **/ - public ConvTableWriter(OutputStream out, int ccsid, int bidiStringType) throws UnsupportedEncodingException - { - this(out, ccsid, new BidiConversionProperties(bidiStringType)); - } - - /** - Creates a ConvTableWriter that uses the specified CCSID and bi-directional string type. - @param out The OutputStream to which to write characters. - @param ccsid The CCSID. - @param properties The bidi conversion properties. - @exception UnsupportedEncodingException If the specified CCSID or its corresponding character encoding is not supported. - **/ - public ConvTableWriter(OutputStream out, int ccsid, BidiConversionProperties properties) throws UnsupportedEncodingException - { - super(out); - if (ccsid < 0 || ccsid > 65535) - { - throw new ExtendedIllegalArgumentException("ccsid", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - os_ = new BufferedOutputStream(out); - ccsid_ = ccsid; - properties_ = properties; - initializeTable(); - } - - /** - Creates a ConvTableWriter that uses the specified CCSID, bi-directional string type, and internal cache size. - @param out The OutputStream to which to write characters. - @param ccsid The CCSID. - @param bidiStringType The {@link com.ibm.as400.access.BidiStringType bi-directional string type}. - @param cacheSize The number of characters to store in the internal buffer. The default is 1024. This number must be greater than zero. - @exception UnsupportedEncodingException If the specified CCSID or its corresponding character encoding is not supported. - **/ - public ConvTableWriter(OutputStream out, int ccsid, int bidiStringType, int cacheSize) throws UnsupportedEncodingException - { - this(out, ccsid, bidiStringType); - if (cacheSize < 1) throw new ExtendedIllegalArgumentException("cacheSize", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - cache_ = new char[cacheSize]; - } - - private void addToCache(char c) throws IOException - { - synchronized (lock) - { - checkOpen(); - if (nextWrite_ == cache_.length) - { - flush(); - } - cache_[nextWrite_++] = c; - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Added to ConvTableWriter(" + this.toString() + ") cache: " + c + "," + nextWrite_ + "," + cache_.length, ConvTable.dumpCharArray(cache_, nextWrite_)); - } - } - - private void addToCache(char[] c, int off, int len) throws IOException - { - if (len == 0) return; // nothing to cache - synchronized (lock) - { - checkOpen(); - int reps = len / cache_.length; - for (int i = 0; i < reps; ++i) - { - flush(); - System.arraycopy(c, off+(i*cache_.length), cache_, 0, cache_.length); - nextWrite_ = cache_.length; - } - int leftover = len % cache_.length; - flush(); - System.arraycopy(c, off+(reps*cache_.length), cache_, 0, leftover); - nextWrite_ = leftover; - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Added to ConvTableWriter(" + this.toString() + ") cache: " + off + "," + len + "," + nextWrite_ + "," + cache_.length, ConvTable.dumpCharArray(cache_, nextWrite_)); - } - } - - private void checkOpen() throws IOException - { - if (table_ == null) // If we are explicitly closed. - { - super.flush(); // Will hopefully throw an IOException. - // If not, we'll throw our own. - throw new IOException(); - } - } - - /** - Closes this ConvTableWriter and its underlying output stream. - @exception IOException If an I/O exception occurs. - **/ - public void close() throws IOException - { - synchronized (lock) - { - if (table_ == null) return; // We are already closed. - flush(); - if (isCachedByte_) - { - // We were saving the last byte in case we had another mixed byte conversion to do. - // Write it out now since the user wants us to close. - os_.write(cachedByte_); - os_.flush(); - } - table_ = null; - cache_ = null; - super.close(); - os_.close(); - } - } - - /** - Flushes the underlying output stream. - @exception IOException If an I/O exception occurs. - **/ - public void flush() throws IOException - { - synchronized (lock) - { - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Flushing cache for ConvTableWriter(" + this.toString() + ") with size " + nextWrite_ + "."); - if (nextWrite_ > 0 && table_ != null) // In case we've been closed. - { - String s = new String(cache_, 0, nextWrite_); - nextWrite_ = 0; - - byte[] b = table_.stringToByteArray(s, properties_); - - if (isMixedByte_) // Mixed-byte tables only. - { - // Always save off the last byte in b for the next time around. - if (cachedByte_ == ConvTableMixedMap.shiftIn_ && b[0] == ConvTableMixedMap.shiftOut_) - { - os_.write(b, 1, b.length - 2); - cachedByte_ = b[b.length - 1]; - isCachedByte_ = true; - } - else - { - if (isCachedByte_) - { - os_.write(cachedByte_); - } - os_.write(b, 0, b.length - 1); - cachedByte_ = b[b.length - 1]; - isCachedByte_ = true; - } - } - else // All other table types... single, double, java. - { - // Don't have any shift characters for these table types, so we don't need to cache anything for the next time around. - os_.write(b); - } - os_.flush(); - } - super.flush(); // this will throw our IOException if we've been closed - } - } - - /** - Returns the CCSID used by this ConvTableWriter. - @return The CCSID, or -1 if the CCSID is not known. - **/ - public int getCcsid() - { - return ccsid_; - } - - /** - Returns the encoding used by this ConvTableWriter. If the CCSID is not known, the superclass encoding is returned. Otherwise, the corresponding encoding for the CCSID is returned, which may be null if no such mapping exists. - @return The encoding, or null if the encoding is not known. - **/ - public String getEncoding() - { - if (ccsid_ == -1) - { - return super.getEncoding(); - } - else - { - return ConversionMaps.ccsidToEncoding(ccsid_); - } - } - - private void initializeCcsid() - { - String enc = super.getEncoding(); - if (enc != null) - { - String ccsidStr = ConversionMaps.encodingToCcsidString(enc); - if (ccsidStr != null) - { - ccsid_ = Integer.parseInt(ccsidStr); - } - } - } - - private void initializeTable() throws UnsupportedEncodingException - { - try - { - if (ccsid_ == -1) - { - table_ = ConvTable.getTable(getEncoding()); - } - else - { - table_ = ConvTable.getTable(ccsid_, null); - } - if (table_ instanceof ConvTableMixedMap) - { - isMixedByte_ = true; - } - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "ConvTableWriter initialized with CCSID " + ccsid_ + ", encoding " + getEncoding() + ", string type " + properties_.getBidiStringType() + ", and table type " + isMixedByte_ + "."); - } - catch(UnsupportedEncodingException uee) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "The specified CCSID is not supported in the current JVM nor by the Toolbox: " + ccsid_ + "/" + getEncoding(), uee); - throw uee; - } - } - - /** - Writes a single character. - @param c The character to write. - @exception IOException If an I/O exception occurs. - **/ - public void write(int c) throws IOException - { - addToCache((char)c); - } - - /** - Writes the specified array of characters. - @param buffer The characters to be written. - @exception IOException If an I/O exception occurs. - **/ - public void write(char[] buffer) throws IOException - { - if (buffer == null) - { - Trace.log(Trace.ERROR, "Parameter 'buffer' is null."); - throw new NullPointerException("buffer"); - } - addToCache(buffer, 0, buffer.length); - } - - /** - Writes a portion of the specified array of characters. - @param buffer The characters to be written. - @param offset The offset into the array from which to begin extracting characters to write. - @param length The number of characters to write. If zero is specified, this method does nothing. - @exception IOException If an I/O exception occurs. - **/ - public void write(char[] buffer, int offset, int length) throws IOException - { - if (buffer == null) - { - Trace.log(Trace.ERROR, "Parameter 'buffer' is null."); - throw new NullPointerException("buffer"); - } - if (length == 0) return; // nothing to write - if (offset < 0 || offset >= buffer.length) - { - Trace.log(Trace.ERROR, "Value of parameter 'offset' is not valid:", offset); - throw new ExtendedIllegalArgumentException("offset", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (length < 0 || length > buffer.length) - { - Trace.log(Trace.ERROR, "Value of parameter 'length' is not valid:", length); - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - addToCache(buffer, offset, length); - } - - /** - Writes the specified String. - @param data The String to write. - @exception IOException If an I/O exception occurs. - **/ - public void write(String data) throws IOException - { - if (data == null) - { - Trace.log(Trace.ERROR, "Parameter 'data' is null."); - throw new NullPointerException("data"); - } - addToCache(data.toCharArray(), 0, data.toCharArray().length); - } - - /** - Writes a portion of the specified String. - @param data The String to write. - @param offset The offset into the String from which to begin extracting characters to write. - @param length The number of characters to write. If zero is specified, this method does nothing. - @exception IOException If an I/O exception occurs. - **/ - public void write(String data, int offset, int length) throws IOException - { - if (data == null) - { - Trace.log(Trace.ERROR, "Parameter 'data' is null."); - throw new NullPointerException("data"); - } - if (length == 0) return; // nothing to write - if (offset < 0 || offset >= data.length()) - { - Trace.log(Trace.ERROR, "Value of parameter 'offset' is not valid:", offset); - throw new ExtendedIllegalArgumentException("offset", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (length < 0 || length > data.length()) - { - Trace.log(Trace.ERROR, "Value of parameter 'length' is not valid:", length); - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - addToCache(data.toCharArray(), offset, length); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConversionMaps.java b/cvsroot/src/com/ibm/as400/access/ConversionMaps.java deleted file mode 100644 index e3286d5c4..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConversionMaps.java +++ /dev/null @@ -1,409 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConversionMaps.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Enumeration; -import java.util.Hashtable; - -abstract class ConversionMaps -{ - // To prevent rehashing of a Hashtable as it's being built, we construct it with a certain number of entries. However, the default load factor for a table is .75, meaning that when it becomes 3/4 full, the table is automatically increased in size and rehashed. We could specify a load factor of 1.0 on the constructor, since that would efficiently utilize memory and prevent rehashing, but we might get ineffective hashing since the algorithm might not be good, so instead, we leave the load factor at the default .75 and just use a size of hash table big enough to accommodate the number of entries we have without rehashing. This is a pretty good tradeoff between lookup time and memory footprint. - - // If we ever pre-req Java 2, we should use HashMaps for these instead of Hashtables. Hashtables are synchronized which makes the table lookup slow, especially if multiple threads bottleneck on these static tables. HashMaps are not synchronized yet provide the same function. - final static Hashtable ccsidEncoding_ = new Hashtable(175); // 127 actual entries. - final static Hashtable encodingCcsid_ = new Hashtable(175); // 127 actual entries. - final static Hashtable localeCcsidMap_ = new Hashtable(120); // 87 actual entries. - final static Hashtable localeNlvMap_ = new Hashtable(100); // 74 actual entries. - - // Convenience function to get corresponding ccsid number as String. - static final String encodingToCcsidString(String encoding) - { - return (String)encodingCcsid_.get(encoding); - } - - // Convenience function to get corresponding encoding from ccsid. - static final String ccsidToEncoding(int ccsid) - { - return (String)ccsidEncoding_.get(String.valueOf(ccsid)); - } - - // This is a table that maps all Java encodings to IBM i CCSIDs. Some encodings could map to more than one CCSID, so they are not included in the table. When a lookup is performed, it will then return null. Some encodings are supported by the IBM i but not by the Toolbox. The ConvTable code handles this. - // Based on http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html - // V5R1 JVM encodings: http://publib.boulder.ibm.com/pubs/html/as400/v5r1/ic2924/info/rzaha/fileenc.htm - // V5R1 JVM locales: http://publib.boulder.ibm.com/pubs/html/as400/v5r1/ic2924/info/rzaha/locales.htm - - //See also http://java.sun.com/j2se/1.4/docs/guide/intl/encoding.doc.html and http://java.sun.com/j2se/1.4/docs/guide/intl/locale.doc.html - - static - { - // 137+ possible Java encodings. 13 have unknown CCSIDs. - // We have 128 known in this table. - encodingCcsid_.put("ASCII", "367"); // ANSI X.34 ASCI. - encodingCcsid_.put("Cp1252", "1252"); - encodingCcsid_.put("ISO8859_1", "819"); - encodingCcsid_.put("Unicode", "13488"); - encodingCcsid_.put("UnicodeBig", "13488"); // BOM is 0xFEFF. - // encodingCcsid_.put("UnicodeBigUnmarked", 13488); - encodingCcsid_.put("UnicodeLittle", "1202"); // BOM is 0xFFFE. - // encodingCcsid_.put("UnicodeLittleUnmarked", 13488); - encodingCcsid_.put("UTF8", "1208"); - encodingCcsid_.put("UTF-8", "1208"); - encodingCcsid_.put("UTF-16BE", "1200"); - - encodingCcsid_.put("Big5", "950"); - // encodingCcsid_.put("Big5 HKSCS", ???); // Big5 with Hong Kong extensions. - encodingCcsid_.put("CNS11643", "964"); - encodingCcsid_.put("Cp037", "37"); - encodingCcsid_.put("Cp273", "273"); - encodingCcsid_.put("Cp277", "277"); - encodingCcsid_.put("Cp278", "278"); - encodingCcsid_.put("Cp280", "280"); - encodingCcsid_.put("Cp284", "284"); - encodingCcsid_.put("Cp285", "285"); - encodingCcsid_.put("Cp297", "297"); - encodingCcsid_.put("Cp420", "420"); - encodingCcsid_.put("Cp424", "424"); - encodingCcsid_.put("Cp437", "437"); - encodingCcsid_.put("Cp500", "500"); - encodingCcsid_.put("Cp737", "737"); - encodingCcsid_.put("Cp775", "775"); - encodingCcsid_.put("Cp838", "838"); - encodingCcsid_.put("Cp850", "850"); - encodingCcsid_.put("Cp852", "852"); - encodingCcsid_.put("Cp855", "855"); - encodingCcsid_.put("Cp856", "856"); - encodingCcsid_.put("Cp857", "857"); - encodingCcsid_.put("Cp858", "858"); - encodingCcsid_.put("Cp860", "860"); - encodingCcsid_.put("Cp861", "861"); - encodingCcsid_.put("Cp862", "862"); - encodingCcsid_.put("Cp863", "863"); - encodingCcsid_.put("Cp864", "864"); - encodingCcsid_.put("Cp865", "865"); - encodingCcsid_.put("Cp866", "866"); - encodingCcsid_.put("Cp868", "868"); - encodingCcsid_.put("Cp869", "869"); - encodingCcsid_.put("Cp870", "870"); - encodingCcsid_.put("Cp871", "871"); - encodingCcsid_.put("Cp874", "874"); - encodingCcsid_.put("Cp875", "875"); - encodingCcsid_.put("Cp918", "918"); - encodingCcsid_.put("Cp921", "921"); - encodingCcsid_.put("Cp922", "922"); - encodingCcsid_.put("Cp923", "923"); // IBM Latin-9. - encodingCcsid_.put("Cp930", "930"); - encodingCcsid_.put("Cp933", "933"); - encodingCcsid_.put("Cp935", "935"); - encodingCcsid_.put("Cp937", "937"); - encodingCcsid_.put("Cp939", "939"); - encodingCcsid_.put("Cp942", "942"); - // encodingCcsid_.put("Cp942C", ???); // Don't know the CCSID - unclear what the 'C' means. - encodingCcsid_.put("Cp943", "943"); - // encodingCcsid_.put("Cp943C", ???); // Don't know the CCSID - unclear what the 'C' means. - encodingCcsid_.put("Cp948", "948"); - encodingCcsid_.put("Cp949", "949"); - // encodingCcsid_.put("Cp949C", ???); // Don't know the CCSID - unclear what the 'C' means. - encodingCcsid_.put("Cp950", "950"); - encodingCcsid_.put("Cp964", "964"); - encodingCcsid_.put("Cp970", "970"); - encodingCcsid_.put("Cp1006", "1006"); - encodingCcsid_.put("Cp1025", "1025"); - encodingCcsid_.put("Cp1026", "1026"); - encodingCcsid_.put("Cp1046", "1046"); - encodingCcsid_.put("Cp1097", "1097"); - encodingCcsid_.put("Cp1098", "1098"); - encodingCcsid_.put("Cp1112", "1112"); - encodingCcsid_.put("Cp1122", "1122"); - encodingCcsid_.put("Cp1123", "1123"); - encodingCcsid_.put("Cp1124", "1124"); - encodingCcsid_.put("Cp1140", "1140"); - encodingCcsid_.put("Cp1141", "1141"); - encodingCcsid_.put("Cp1142", "1142"); - encodingCcsid_.put("Cp1143", "1143"); - encodingCcsid_.put("Cp1144", "1144"); - encodingCcsid_.put("Cp1145", "1145"); - encodingCcsid_.put("Cp1146", "1146"); - encodingCcsid_.put("Cp1147", "1147"); - encodingCcsid_.put("Cp1148", "1148"); - encodingCcsid_.put("Cp1149", "1149"); - encodingCcsid_.put("Cp1250", "1250"); - encodingCcsid_.put("Cp1251", "1251"); - encodingCcsid_.put("Cp1253", "1253"); - encodingCcsid_.put("Cp1254", "1254"); - encodingCcsid_.put("Cp1255", "1255"); - encodingCcsid_.put("Cp1256", "1256"); - encodingCcsid_.put("Cp1257", "1257"); - encodingCcsid_.put("Cp1258", "1258"); - encodingCcsid_.put("Cp1381", "1381"); - encodingCcsid_.put("Cp1383", "1383"); - encodingCcsid_.put("Cp33722", "33722"); - - // The Toolbox does not directly support EUC at this time, Java will do the conversion. - encodingCcsid_.put("EUC_CN", "1383"); // Superset of 5479. - encodingCcsid_.put("EUC_JP", "33722"); - encodingCcsid_.put("EUC_KR", "970"); // Superset of 5066. - encodingCcsid_.put("EUC_TW", "964"); // Superset of 5060. - - encodingCcsid_.put("GB2312", "1381"); - encodingCcsid_.put("GB18030", "1392"); //1392 is mixed 4-byte; the individual component CCSIDs are not supported. - encodingCcsid_.put("GBK", "1386"); - - // encodingCcsid_.put("ISCII91", ???); // Indic scripts. - - // The Toolbox does not directly support ISO2022. - // encodingCcsid_.put("ISO2022CN", ???); // Not sure of the CCSID, possibly 9575? - // encodingCcsid_.put("ISO2022CN_CNS", "965"); // Java doesn't support this one? - // encodingCcsid_.put("ISO2022CN_GB", "9575"); // Java doesn't support this one? - - encodingCcsid_.put("ISO2022JP", "5054"); // Could be 956 also, but the IBM i JVM uses 5054. - encodingCcsid_.put("ISO2022KR", "25546"); // Could be 17354 also, but the IBM i JVM uses 25546. - - encodingCcsid_.put("ISO8859_2", "912"); - encodingCcsid_.put("ISO8859_3", "913"); - encodingCcsid_.put("ISO8859_4", "914"); - encodingCcsid_.put("ISO8859_5", "915"); - encodingCcsid_.put("ISO8859_6", "1089"); - encodingCcsid_.put("ISO8859_7", "813"); - encodingCcsid_.put("ISO8859_8", "916"); - encodingCcsid_.put("ISO8859_9", "920"); - // encodingCcsid_.put("ISO8859_13", ???); // Latin alphabet No. 7. - // encodingCcsid_.put("ISO8859_15_FDIS", ???); // Don't know the CCSID; FYI, this codepage is ISO 28605. - - // The Toolbox does not directly support JIS. - encodingCcsid_.put("JIS0201", "897"); // Could be 895, but the IBM i JVM uses 897. - encodingCcsid_.put("JIS0208", "952"); - encodingCcsid_.put("JIS0212", "953"); - // encodingCcsid_.put("JISAutoDetect", ???); // Can't do this one. Would need to look at the bytes to determine the CCSID. - - encodingCcsid_.put("Johab", "1363"); - encodingCcsid_.put("KOI8_R", "878"); - encodingCcsid_.put("KSC5601", "949"); - - encodingCcsid_.put("MS874", "874"); - encodingCcsid_.put("MS932", "943"); - encodingCcsid_.put("MS936", "1386"); - encodingCcsid_.put("MS949", "949"); - encodingCcsid_.put("MS950", "950"); - - // encodingCcsid_.put("MacArabic", ???); // Don't know. - encodingCcsid_.put("MacCentralEurope", "1282"); - encodingCcsid_.put("MacCroatian", "1284"); - encodingCcsid_.put("MacCyrillic", "1283"); - // encodingCcsid_.put("MacDingbat", ???); // Don't know. - encodingCcsid_.put("MacGreek", "1280"); - // encodingCcsid_.put("MacHebrew", ???); // Don't know. - encodingCcsid_.put("MacIceland", "1286"); - encodingCcsid_.put("MacRoman", "1275"); - encodingCcsid_.put("MacRomania", "1285"); - // encodingCcsid_.put("MacSymbol", ???); // Don't know. - // encodingCcsid_.put("MacThai", ???); // Don't know. - encodingCcsid_.put("MacTurkish", "1281"); - // encodingCcsid_.put("MacUkraine", ???); // Don't know. - - encodingCcsid_.put("SJIS", "932"); // Could be 943, but the IBM i JVM uses 932. - encodingCcsid_.put("TIS620", "874"); // IBM i JVM uses 874. - } - - // With the encodingCcsid map, we try to assign a CCSID to every Java encoding. With the ccsidEncoding map, the reverse happens... - // We try to assign an encoding to each CCSID. This is not always possible, so some CCSIDs may have a null encoding. Also, some CCSIDs may have multiple Java encodings, in this case the first one wins. - static - { - // Build the CCSID to encoding map. - for (Enumeration keys = encodingCcsid_.keys(); keys.hasMoreElements(); ) - { - Object key = keys.nextElement(); - ccsidEncoding_.put(encodingCcsid_.get(key), key); - } - - ccsidEncoding_.put("17584", "UTF-16BE"); // IBM i doesn't support this, but other people use it. - - // Any other ccsids that are used for which we know no encoding will have their encoding set to equal their ccsid. - - // Any encodings that are used for which we know no ccsid will have their ccsid set to 0. - } - - // localeNlvMap. - static - { - // 74 entries. - localeNlvMap_.put("ar", "2954"); - localeNlvMap_.put("ar_SA", "2954"); - localeNlvMap_.put("be", "2979"); - localeNlvMap_.put("bg", "2974"); - localeNlvMap_.put("ca", "2931"); - localeNlvMap_.put("cs", "2975"); - localeNlvMap_.put("da", "2926"); - localeNlvMap_.put("de", "2929"); - localeNlvMap_.put("de_CH", "2939"); - localeNlvMap_.put("de_DE", "2929"); - localeNlvMap_.put("el", "2957"); - localeNlvMap_.put("en", "2924"); - localeNlvMap_.put("en_BE", "2909"); - localeNlvMap_.put("en_CN", "2984"); - localeNlvMap_.put("en_JP", "2938"); - localeNlvMap_.put("en_KR", "2984"); - localeNlvMap_.put("en_SG", "2984"); - localeNlvMap_.put("en_TW", "2984"); - localeNlvMap_.put("es", "2931"); - localeNlvMap_.put("es_ES", "2931"); - localeNlvMap_.put("et", "2902"); - localeNlvMap_.put("fa", "2998"); - localeNlvMap_.put("fi", "2925"); - localeNlvMap_.put("fr", "2928"); - localeNlvMap_.put("fr_BE", "2966"); - localeNlvMap_.put("fr_CA", "2981"); - localeNlvMap_.put("fr_CH", "2940"); - localeNlvMap_.put("fr_FR", "2928"); - localeNlvMap_.put("hr", "2912"); - localeNlvMap_.put("hu", "2976"); - localeNlvMap_.put("is", "2958"); - localeNlvMap_.put("it", "2932"); - localeNlvMap_.put("it_CH", "2942"); - localeNlvMap_.put("iw", "2961"); - localeNlvMap_.put("ja", "2962"); - localeNlvMap_.put("ji", "2961"); - localeNlvMap_.put("ka", "2979"); - localeNlvMap_.put("kk", "2979"); - localeNlvMap_.put("ko", "2986"); - localeNlvMap_.put("ko_KR", "2986"); - localeNlvMap_.put("lo", "2906"); - localeNlvMap_.put("lt", "2903"); - localeNlvMap_.put("lv", "2904"); - localeNlvMap_.put("mk", "2913"); - localeNlvMap_.put("nl", "2923"); - localeNlvMap_.put("nl_BE", "2963"); - localeNlvMap_.put("nl_NL", "2923"); - localeNlvMap_.put("no", "2933"); - localeNlvMap_.put("pl", "2978"); - localeNlvMap_.put("pt", "2996"); - localeNlvMap_.put("pt_BR", "2980"); - localeNlvMap_.put("pt_PT", "2922"); - localeNlvMap_.put("ro", "2992"); - localeNlvMap_.put("ru", "2979"); - localeNlvMap_.put("sh", "2912"); - localeNlvMap_.put("sk", "2994"); - localeNlvMap_.put("sl", "2911"); - localeNlvMap_.put("sq", "2995"); - localeNlvMap_.put("sr", "2914"); - localeNlvMap_.put("sv", "2937"); - localeNlvMap_.put("sv_SE", "2937"); - localeNlvMap_.put("th", "2972"); - localeNlvMap_.put("th_TH", "2972"); - localeNlvMap_.put("tr", "2956"); - localeNlvMap_.put("uk", "2979"); - localeNlvMap_.put("uz", "2979"); - localeNlvMap_.put("vi", "2905"); - localeNlvMap_.put("zh", "2989"); - localeNlvMap_.put("zh_CN", "2989"); - localeNlvMap_.put("zh_HK", "2987"); - localeNlvMap_.put("zh_SG", "2989"); - localeNlvMap_.put("zh_TW", "2987"); - localeNlvMap_.put("cht", "2987"); // Chinese/Taiwan - localeNlvMap_.put("cht_CN", "2987"); // Chinese/Taiwan - } - - // localeCcsidMap. - // Make sure that we have a hardcoded ConvTable for each of the ccsids in this map. - static - { - // 87 entries. - localeCcsidMap_.put("ar", "420"); - localeCcsidMap_.put("ar_SA", "420"); - localeCcsidMap_.put("be", "1025"); - localeCcsidMap_.put("bg", "1025"); - localeCcsidMap_.put("ca", "284"); - localeCcsidMap_.put("cs", "870"); - localeCcsidMap_.put("da", "277"); - localeCcsidMap_.put("de", "273"); - localeCcsidMap_.put("de_CH", "500"); - localeCcsidMap_.put("de_DE", "273"); - localeCcsidMap_.put("de_AT_EURO", "1141"); - localeCcsidMap_.put("de_DE_EURO", "1141"); - localeCcsidMap_.put("de_LU_EURO", "1141"); - localeCcsidMap_.put("el", "875"); - localeCcsidMap_.put("el_GR_EURO", "4971"); - localeCcsidMap_.put("en", "37"); - localeCcsidMap_.put("en_BE", "500"); - localeCcsidMap_.put("en_CN", "1388"); // Was 935. - localeCcsidMap_.put("en_IE_EURO", "1140"); - localeCcsidMap_.put("en_JP", "1399"); // Was 930 Was 5026. - localeCcsidMap_.put("en_KR", "1364"); // Was 933. - localeCcsidMap_.put("en_SG", "1388"); // Was 935. - localeCcsidMap_.put("en_TW", "937"); - localeCcsidMap_.put("es", "284"); - localeCcsidMap_.put("es_ES", "284"); - localeCcsidMap_.put("es_ES_EURO", "1145"); - localeCcsidMap_.put("et", "1122"); - localeCcsidMap_.put("fi", "278"); - localeCcsidMap_.put("fi_FI_EURO", "1143"); - localeCcsidMap_.put("fr", "297"); - localeCcsidMap_.put("fr_BE", "500"); - localeCcsidMap_.put("fr_BE_EURO", "1148"); - localeCcsidMap_.put("fr_CA", "37"); - localeCcsidMap_.put("fr_CH", "500"); - localeCcsidMap_.put("fr_FR", "297"); - localeCcsidMap_.put("fr_FR_EURO", "1147"); - localeCcsidMap_.put("fr_LU_EURO", "1147"); - localeCcsidMap_.put("hr", "870"); - localeCcsidMap_.put("hu", "870"); - localeCcsidMap_.put("is", "871"); - localeCcsidMap_.put("it", "280"); - localeCcsidMap_.put("it_CH", "500"); - localeCcsidMap_.put("it_IT_EURO", "1144"); - localeCcsidMap_.put("iw", "424"); - localeCcsidMap_.put("ja", "1399"); // Was 930 Was 5026. - localeCcsidMap_.put("ji", "424"); - localeCcsidMap_.put("ka", "1025"); - localeCcsidMap_.put("kk", "1025"); - localeCcsidMap_.put("ko", "1364"); // Was 933. - localeCcsidMap_.put("ko_KR", "1364"); - localeCcsidMap_.put("lo", "1132"); // Was 1133. - localeCcsidMap_.put("lt", "1112"); - localeCcsidMap_.put("lv", "1112"); - localeCcsidMap_.put("mk", "1025"); - localeCcsidMap_.put("nl", "37"); - localeCcsidMap_.put("nl_BE", "500"); - localeCcsidMap_.put("nl_NL", "37"); - localeCcsidMap_.put("nl_BE_EURO", "1148"); - localeCcsidMap_.put("nl_NL_EURO", "1140"); - localeCcsidMap_.put("no", "277"); - localeCcsidMap_.put("pl", "870"); - localeCcsidMap_.put("pt", "500"); - localeCcsidMap_.put("pt_BR", "37"); - localeCcsidMap_.put("pt_PT", "37"); - localeCcsidMap_.put("pt_PT_EURO", "1140"); - localeCcsidMap_.put("ro", "870"); - localeCcsidMap_.put("ru", "1025"); - localeCcsidMap_.put("sh", "870"); - localeCcsidMap_.put("sk", "870"); - localeCcsidMap_.put("sl", "870"); - localeCcsidMap_.put("sq", "500"); - localeCcsidMap_.put("sr", "1025"); - localeCcsidMap_.put("sv", "278"); - localeCcsidMap_.put("sv_SE", "278"); - localeCcsidMap_.put("th", "838"); - localeCcsidMap_.put("th_TH", "838"); - localeCcsidMap_.put("tr", "1026"); - localeCcsidMap_.put("uk", "1123"); // Was 1025. - localeCcsidMap_.put("uz", "1025"); - localeCcsidMap_.put("vi", "1130"); - localeCcsidMap_.put("zh", "1388"); // Was 935. - localeCcsidMap_.put("zh_CN", "1388"); - localeCcsidMap_.put("zh_HK", "937"); - localeCcsidMap_.put("zh_SG", "1388"); // Was 935. - localeCcsidMap_.put("zh_TW", "937"); - localeCcsidMap_.put("cht", "937"); // Chinese/Taiwan - localeCcsidMap_.put("cht_CN", "937"); // Chinese/Taiwan - } -} diff --git a/cvsroot/src/com/ibm/as400/access/Converter.java b/cvsroot/src/com/ibm/as400/access/Converter.java deleted file mode 100644 index a6ec562ff..000000000 --- a/cvsroot/src/com/ibm/as400/access/Converter.java +++ /dev/null @@ -1,300 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Converter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; - -// A character set converter between Java String objects and native code pages. -class Converter implements Serializable -{ - static final long serialVersionUID = 4L; - private static final String BUFFER_OVERFLOWED = "Converted field overflows destination array."; - - transient ConverterImpl impl; - private String encoding_ = null; - private int ccsid_ = -1; - private AS400 system_ = null; - - // Gets a Converter object from the pool using a "best guess" based on the default Locale. - Converter() - { - ccsid_ = ExecutionEnvironment.getBestGuessAS400Ccsid(); - try - { - chooseImpl(); - } - catch (UnsupportedEncodingException e) - { - Trace.log(Trace.ERROR, "Unexpected CCSID returned from getBestGuessAS400Ccsid: " + ccsid_, e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - } - - // Constructs a character set conversion object using the specified character encoding. - // @param encoding The name of a character encoding. - // @exception UnsupportedEncodingException If the encoding is not supported. - Converter(String encoding) throws UnsupportedEncodingException - { - encoding_ = encoding; - chooseImpl(); - } - - // Constructs a character set conversion object using the specified ccsid. - // @param ccsid The CCSID of the server text. - // @param system The system object representing the server with which to connect. - // @exception UnsupportedEncodingException If the ccsid is not supported. - Converter(int ccsid) throws UnsupportedEncodingException - { - ccsid_ = ccsid; - chooseImpl(); - } - - // Constructs a character set conversion object using the specified ccsid. - // @param ccsid The CCSID of the server text. - // @param system The system object representing the server with which to connect. - // @exception UnsupportedEncodingException If the ccsid is not supported. - Converter(int ccsid, AS400 system) throws UnsupportedEncodingException - { - ccsid_ = ccsid; - system_ = system; - chooseImpl(); - } - - // Deserializes and initializes transient data. - private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException - { - in.defaultReadObject(); - chooseImpl(); - } - - // Get the proper implementation object. - private void chooseImpl() throws UnsupportedEncodingException - { - if (system_ == null) - { - // Only alternative is to try to load remote impl. - impl = (ConverterImpl)AS400.loadImpl("com.ibm.as400.access.ConverterImplRemote"); - if (impl == null) throw new UnsupportedEncodingException(); - if (encoding_ != null) - { - impl.setEncoding(encoding_); - } - else - { - impl.setCcsid(ccsid_, null); - } - } - else - { - // Load proxy or remote impl. - impl = (ConverterImpl)system_.loadImpl2("com.ibm.as400.access.ConverterImplRemote", "com.ibm.as400.access.ConverterImplProxy"); - AS400Impl systemImpl = system_.getImpl(); - try - { - impl.setCcsid(ccsid_, systemImpl); - } - catch (UnsupportedEncodingException e) - { - try - { - system_.connectService(AS400.CENTRAL); - impl.setCcsid(ccsid_, systemImpl); - } - catch (Exception ee) - { - throw e; - } - } - } - } - - // Converts the specified bytes into a String. - // @param source The bytes to convert. - // @return The resultant String. - String byteArrayToString(byte[] source) - { - return impl.byteArrayToString(source, 0, source.length); - } - - // Converts the specified bytes into a String. - // @param source The bytes to convert. - // @param offset The offset into the source array for the start of the data. - // @return The resultant String. - String byteArrayToString(byte[] source, int offset) - { - return impl.byteArrayToString(source, offset, source.length - offset); - } - - // Converts the specified bytes into a String. - // @param source The bytes to convert. - // @param offset The offset into the source array for the start of the data. - // @param length The number of bytes of data to read from the array. - // @return The resultant String. - String byteArrayToString(byte[] source, int offset, int length) - { - return impl.byteArrayToString(source, offset, length); - } - - // Converts the specified bytes into a String. - // @param source The bytes to convert. - // @param offset The offset into the source array for the start of the data. - // @param length The number of bytes of data to read from the array. - // @param type The output string type as defined by the CDRA (Character Data Respresentation Architecture). One of the following constants defined in BidiStringType: ST5 (LTR), ST6 (RTL), ST10 (Contextual LTR), or ST11 (Contextual RTL). - // @return The resultant String. - String byteArrayToString(byte[] source, int offset, int length, int type) - { - return byteArrayToString(source, offset, length, new BidiConversionProperties(type)); - } - - // Converts the specified bytes into a String. - // @param source The bytes to convert. - // @param offset The offset into the source array for the start of the data. - // @param length The number of bytes of data to read from the array. - // @param properties The bidi conversion properties. - // @return The resultant String. - String byteArrayToString(byte[] source, int offset, int length, BidiConversionProperties properties) - { - return impl.byteArrayToString(source, offset, length, properties); - } - - // Returns the ccsid of this conversion object. - // @return The ccsid. - int getCcsid() - { - return impl.getCcsid(); - } - - // Returns the encoding of this conversion object. - // @return The encoding. - String getEncoding() - { - return impl.getEncoding(); - } - - // Converts the specified String into bytes. - // @param source The String to convert. - // @return The resultant byte array. - byte[] stringToByteArray(String source) - { - return impl.stringToByteArray(source); - } - - // Converts the specified String into bytes. - // @param source The String to convert. - // @param type The output string type as defined by the CDRA (Character Data Respresentation Architecture). One of the following constants defined in BidiStringType: ST5 (LTR), ST6 (RTL), ST10 (Contextual LTR), or ST11 (Contextual RTL). - // @return The resultant byte array. - byte[] stringToByteArray(String source, int type) - { - return stringToByteArray(source, new BidiConversionProperties(type)); - } - - // Converts the specified String into bytes. - // @param source The String to convert. - // @param properties The bidi conversion properties. - // @return The resultant byte array. - byte[] stringToByteArray(String source, BidiConversionProperties properties) - { - return impl.stringToByteArray(source, properties); - } - - // Converts the specified String into bytes. - // @param source The String to convert. - // @param destination The destination byte array. - // @exception CharConversionException If destination is not large enough to hold the converted string. - void stringToByteArray(String source, byte[] destination) throws CharConversionException - { - byte[] convertedBytes = impl.stringToByteArray(source); - if (convertedBytes.length > destination.length) - { - // Copy as much as will fit. - System.arraycopy(convertedBytes, 0, destination, 0, destination.length); - Trace.log(Trace.ERROR, BUFFER_OVERFLOWED); - throw new CharConversionException(); - } - System.arraycopy(convertedBytes, 0, destination, 0, convertedBytes.length); - } - - // Converts the specified String into bytes. - // @param source The String to convert. - // @param destination The destination byte array. - // @param offset The offset into the destination array for the start of the data. - // @exception CharConversionException If destination is not large enough to hold the converted string. - void stringToByteArray(String source, byte[] destination, int offset) throws CharConversionException - { - byte[] convertedBytes = impl.stringToByteArray(source); - if (convertedBytes.length > destination.length - offset) - { - // Copy as much as will fit. - System.arraycopy(convertedBytes, 0, destination, offset, destination.length - offset); - Trace.log(Trace.ERROR, BUFFER_OVERFLOWED); - throw new CharConversionException(); - } - System.arraycopy(convertedBytes, 0, destination, offset, convertedBytes.length); - } - - // Converts the specified String into bytes. - // @param source The String to convert. - // @param destination The destination byte array. - // @param offset The offset into the destination array for the start of the data. - // @param length The number of bytes of data to write into the array. - // @exception CharConversionException If destination is not large enough to hold the converted string. - void stringToByteArray(String source, byte[] destination, int offset, int length) throws CharConversionException - { - byte[] convertedBytes = impl.stringToByteArray(source); - if (convertedBytes.length > length) - { - // Copy as much as will fit. - System.arraycopy(convertedBytes, 0, destination, offset, length); - Trace.log(Trace.ERROR, BUFFER_OVERFLOWED); - throw new CharConversionException(); - } - System.arraycopy(convertedBytes, 0, destination, offset, convertedBytes.length); - } - - // Converts the specified String into bytes. - // @param source The String to convert. - // @param destination The destination byte array. - // @param offset The offset into the destination array for the start of the data. - // @param length The number of bytes of data to write into the array. - // @param type The output string type as defined by the CDRA (Character Data Respresentation Architecture). One of the following constants defined in BidiStringType: ST5 (LTR), ST6 (RTL), ST10 (Contextual LTR), or ST11 (Contextual RTL). - // @exception CharConversionException If destination is not large enough to hold the converted string. - void stringToByteArray(String source, byte[] destination, int offset, int length, int type) throws CharConversionException - { - stringToByteArray(source, destination, offset, length, new BidiConversionProperties(type)); - } - - // Converts the specified String into bytes. - // @param source The String to convert. - // @param destination The destination byte array. - // @param offset The offset into the destination array for the start of the data. - // @param length The number of bytes of data to write into the array. - // @param properties The bidi conversion properties. - // @exception CharConversionException If destination is not large enough to hold the converted string. - void stringToByteArray(String source, byte[] destination, int offset, int length, BidiConversionProperties properties) throws CharConversionException - { - byte[] convertedBytes = impl.stringToByteArray(source, properties); - if (convertedBytes.length > length) - { - // Copy as much as will fit. - System.arraycopy(convertedBytes, 0, destination, offset, length); - Trace.log(Trace.ERROR, BUFFER_OVERFLOWED); - throw new CharConversionException(); - } - System.arraycopy(convertedBytes, 0, destination, offset, convertedBytes.length); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConverterImpl.java b/cvsroot/src/com/ibm/as400/access/ConverterImpl.java deleted file mode 100644 index abd76fa53..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConverterImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConverterImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; - -interface ConverterImpl -{ - abstract void setEncoding(String encoding) throws UnsupportedEncodingException; - abstract void setCcsid(int ccsid, AS400Impl systemImpl) throws UnsupportedEncodingException; - abstract String getEncoding(); - abstract int getCcsid(); - abstract String byteArrayToString(byte[] source, int offset, int length); - abstract String byteArrayToString(byte[] source, int offset, int length, BidiConversionProperties properties); - abstract byte[] stringToByteArray(String source); - abstract byte[] stringToByteArray(String source, BidiConversionProperties properties); -} diff --git a/cvsroot/src/com/ibm/as400/access/ConverterImplProxy.java b/cvsroot/src/com/ibm/as400/access/ConverterImplProxy.java deleted file mode 100644 index fc4f735b2..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConverterImplProxy.java +++ /dev/null @@ -1,127 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConverterImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.io.UnsupportedEncodingException; - -class ConverterImplProxy extends AbstractProxyImpl implements ConverterImpl -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConverterImplProxy() - { - super("Converter"); - } - - public void setEncoding(String encoding) throws UnsupportedEncodingException - { - try - { - connection_.callMethod(pxId_, "setEncoding", new Class[] { String.class}, new Object[] { encoding }); - } - catch (InvocationTargetException e) - { - Throwable target = e.getTargetException(); - if (target instanceof UnsupportedEncodingException) throw (UnsupportedEncodingException) target; - throw ProxyClientConnection.rethrow(e); - } - } - - public void setCcsid(int ccsid, AS400Impl systemImpl) throws UnsupportedEncodingException - { - try - { - connection_.callMethod(pxId_, "setCcsid", new Class[] { Integer.TYPE, AS400Impl.class }, new Object[] { new Integer(ccsid), systemImpl }); - } - catch (InvocationTargetException e) - { - Throwable target = e.getTargetException(); - if (target instanceof UnsupportedEncodingException) throw (UnsupportedEncodingException) target; - throw ProxyClientConnection.rethrow(e); - } - } - - public String getEncoding() - { - try - { - return(String)connection_.callMethod(pxId_, "getEncoding").getReturnValue(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - public int getCcsid() - { - try - { - return connection_.callMethod(pxId_, "getCcsid").getReturnValueInt(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - public String byteArrayToString(byte[] source, int offset, int length) - { - try - { - return(String)connection_.callMethod(pxId_, "byteArrayToString", new Class[] { byte[].class, Integer.TYPE, Integer.TYPE}, new Object[] { source, new Integer(offset), new Integer(length)}).getReturnValue(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - public String byteArrayToString(byte[] source, int offset, int length, BidiConversionProperties properties) - { - try - { - return(String)connection_.callMethod(pxId_, "byteArrayToString", new Class[] { byte[].class, Integer.TYPE, Integer.TYPE, BidiConversionProperties.class }, new Object[] { source, new Integer(offset), new Integer(length), properties }).getReturnValue(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - public byte[] stringToByteArray(String source) - { - try - { - return(byte[])connection_.callMethod(pxId_, "stringToByteArray", new Class[] { String.class}, new Object[] { source }).getReturnValue(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - public byte[] stringToByteArray(String source, BidiConversionProperties properties) - { - try - { - return(byte[])connection_.callMethod(pxId_, "stringToByteArray", new Class[] { String.class, BidiConversionProperties.class}, new Object[] { source, properties }).getReturnValue(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ConverterImplRemote.java b/cvsroot/src/com/ibm/as400/access/ConverterImplRemote.java deleted file mode 100644 index 46c492440..000000000 --- a/cvsroot/src/com/ibm/as400/access/ConverterImplRemote.java +++ /dev/null @@ -1,189 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConverterImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; -import java.io.UnsupportedEncodingException; - -class ConverterImplRemote implements ConverterImpl -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - ConvTable table_; - - ConverterImplRemote() - { - } - - ConverterImplRemote(ConvTable table) - { - table_ = table; - } - - String byteArrayToString(byte[] source) - { - // Note: The type of BidiConversionProperties reflects the Java String type. - // This should be the default value instead of being set from the ccsid. @C5C - return byteArrayToString(source, 0, source.length, new BidiConversionProperties()); - } - - String byteArrayToString(byte[] source, int offset) - { - // Note: The type of BidiConversionProperties reflects the Java String type. - // This should be the default value instead of being set from the ccsid. @C5C - return byteArrayToString(source, offset, source.length - offset, new BidiConversionProperties()); - } - - public String byteArrayToString(byte[] source, int offset, int length) - { - // Note: The type of BidiConversionProperties reflects the Java String type. - // This should be the default value instead of being set from the ccsid. @C5C - return byteArrayToString(source, offset, length, new BidiConversionProperties()); - } - - public String byteArrayToString(byte[] source, int offset, int length, int type) - { - return byteArrayToString(source, offset, length, new BidiConversionProperties(type)); - } - - public String byteArrayToString(byte[] source, int offset, int length, BidiConversionProperties properties) - { - return table_.byteArrayToString(source, offset, length, properties); - } - - static ConverterImplRemote getConverter(int ccsid, AS400ImplRemote system) throws UnsupportedEncodingException - { - return new ConverterImplRemote(ConvTable.getTable(ccsid, system)); - } - - public String getEncoding() - { - return table_.getEncoding(); - } - - public int getCcsid() - { - return table_.getCcsid(); - } - - // Returns the string type of the text based on the ccsid. If the text is bidi, then the string type will be set accordingly. - // If not, the default it LTR (left-to-right) text. - // @return The string type. - int getStringType(int ccsid) - { - if (AS400BidiTransform.isBidiCcsid(ccsid)) - { - return AS400BidiTransform.getStringType(ccsid); - } - else - { - return BidiStringType.DEFAULT; - } - } - - public void setCcsid(int ccsid, AS400Impl system) throws UnsupportedEncodingException - { - table_ = ConvTable.getTable(ccsid, null); - } - - public void setEncoding(String encoding) throws UnsupportedEncodingException - { - table_ = ConvTable.getTable(encoding); - } - - public byte[] stringToByteArray(String source) - { - // Note: The type of BidiConversionProperties reflects the Java String type. - // This should be the default value instead of being set from the ccsid. @C5C - return stringToByteArray(source, new BidiConversionProperties()); - } - - public byte[] stringToByteArray(String source, int type) - { - return stringToByteArray(source, new BidiConversionProperties(type)); - } - - public byte[] stringToByteArray(String source, BidiConversionProperties properties) - { - return table_.stringToByteArray(source, properties); - } - - void stringToByteArray(String source, byte[] destination) throws CharConversionException - { - // Note: The type of BidiConversionProperties reflects the Java String type. - // This should be the default value instead of being set from the ccsid. @C5C - byte[] convertedBytes = stringToByteArray(source, new BidiConversionProperties()); - if (convertedBytes.length > destination.length) - { - // Copy as much as will fit. - System.arraycopy(convertedBytes, 0, destination, 0, destination.length); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination not large enough during conversion: " + source.length()+"," + destination.length); - throw new CharConversionException(); - } - System.arraycopy(convertedBytes, 0, destination, 0, convertedBytes.length); - } - - void stringToByteArray(String source, byte[] destination, int offset) throws CharConversionException - { - // Note: The type of BidiConversionProperties reflects the Java String type. - // This should be the default value instead of being set from the ccsid. @C5C - byte[] convertedBytes = stringToByteArray(source, new BidiConversionProperties()); - if (convertedBytes.length > destination.length - offset) - { - // Copy as much as will fit. - System.arraycopy(convertedBytes, 0, destination, offset, destination.length - offset); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination not large enough during conversion: " + source.length() + "," + destination.length + "," + offset); - throw new CharConversionException(); - } - System.arraycopy(convertedBytes, 0, destination, offset, convertedBytes.length); - } - - // Converts the specified String into bytes. - // @param source the String to convert. - // @param destination the destination byte array. - // @param offset the offset into the destination array for the start of the data. - // @param length the length of data to write into the array. - // @exception CharConversionException If destination is not large enough to hold the converted string. - void stringToByteArray(String source, byte[] destination, int offset, int length) throws CharConversionException - { - // Note: The type of BidiConversionProperties reflects the Java String type. - // This should be the default value instead of being set from the ccsid. @C5C - stringToByteArray(source, destination, offset, length, new BidiConversionProperties()); - } - - // Converts the specified String into bytes. - // @param source the String to convert. - // @param destination the destination byte array. - // @param offset the offset into the destination array for the start of the data. - // @param length the length of data to write into the array. - // @param type the bidi string type. - // @exception CharConversionException If destination is not large enough to hold the converted string. - void stringToByteArray(String source, byte[] destination, int offset, int length, int type) throws CharConversionException - { - stringToByteArray(source, destination, offset, length, new BidiConversionProperties(type)); - } - - void stringToByteArray(String source, byte[] destination, int offset, int length, BidiConversionProperties properties) throws CharConversionException - { - byte[] convertedBytes = stringToByteArray(source, properties); - if (convertedBytes.length > length) - { - // Copy as much as will fit. - System.arraycopy(convertedBytes, 0, destination, offset, length); - if (Trace.traceOn_) Trace.log(Trace.CONVERSION, "Destination not large enough during conversion: " + source.length() + "," + destination.length + "," + offset + "," + length); - throw new CharConversionException(); - } - System.arraycopy(convertedBytes, 0, destination, offset, convertedBytes.length); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/Copyright.java b/cvsroot/src/com/ibm/as400/access/Copyright.java deleted file mode 100644 index 514a3faac..000000000 --- a/cvsroot/src/com/ibm/as400/access/Copyright.java +++ /dev/null @@ -1,31 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Copyright.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - The Copyright interface is used to hold the copyright string and the version information for the IBM Toolbox for Java. - **/ -public interface Copyright -{ - /** @deprecated This field is reserved for use within the Toolbox product. **/ - public static String copyright = "Copyright (C) 1997-2011 International Business Machines Corporation and others."; - public static String version = "Open Source Software, JTOpen 7.4, codebase 5770-SS1 V7R1M0.03 2011/03/3 @C7"; // As of V7R1: JC1 is merged into SS1 Option 3 - - // Constants for reference by AS400JDBCDriver. - static final int MAJOR_VERSION = 9; // ex: "9" indicates V7R1 - static final int MINOR_VERSION = 5; // ex: "1" indicates PTF #1 - //Note: JTOpen 7.4 is synching with ptf 9.5 - static final String DRIVER_LEVEL = "07010005"; //(ex: 05040102 -> V5R4M1 PTF#2) (needed for hidden clientInfo) (each # is 2 digits in length) - -} diff --git a/cvsroot/src/com/ibm/as400/access/CoreMRI.java b/cvsroot/src/com/ibm/as400/access/CoreMRI.java deleted file mode 100644 index adcbfa6d8..000000000 --- a/cvsroot/src/com/ibm/as400/access/CoreMRI.java +++ /dev/null @@ -1,91 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CoreMRI.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.ListResourceBundle; - - - -/** -Locale-specific objects for IBM Toolbox for Java. -**/ -// -// @B0A - Implementation note: -// This MRI contains ONLY resources that are part of the "core". -// This is the small set of access classes needed throughout the -// Toolbox -// -public class CoreMRI extends ListResourceBundle -{ - // NLS_MESSAGEFORMAT_NONE - // Each string is assumed NOT to be processed by the MessageFormat class. - // This means that a single quote must be coded as 1 single quote. - - // NLS_ENCODING=UTF-8 - // Instructs the translation tools to interpret the text as UTF-8. - - public Object[][] getContents() - { - return resources; - } - - private final static Object[][] resources= { - - // #TRANNOTE Before you add a new resource, please make - // #TRANNOTE sure you are not duplicating another. The - // #TRANNOTE goal is to keep the amount of translatable - // #TRANNOTE text down. - // #TRANNOTE - // #TRANNOTE NOTE TO TRANSLATORS: The format of a line of MRI - // #TRANNOTE is { "KEY", "value" }, - // #TRANNOTE - // #TRANNOTE The key must be left alone so translate only the value. - // #TRANNOTE - { "DLG_PASSWORD_LABEL", "Password:" }, - { "DLG_SYSTEM_LABEL", "System:" }, - { "DLG_USER_ID_LABEL", "User ID:" }, - { "DLG_CANCEL_BUTTON", "Cancel" }, - { "DLG_OK_BUTTON", "OK" }, - { "DLG_CACHE_PASSWORD_CHECK_BOX", "Save password" }, - { "DLG_DEFAULT_PASSWORD_CHECK_BOX", "Default User ID" }, - - { "EXC_COMMITMENT_CONTROL_ALREADY_STARTED", "Commitment control is already started." }, - { "EXC_FIELD_NOT_FOUND", "Field was not found." }, - { "EXC_LENGTH_NOT_VALID", "Length is not valid." }, - { "EXC_IMPLEMENTATION_NOT_FOUND", "Implementation class not found." }, // @B1A - { "EXC_INFORMATION_NOT_AVAILABLE", "Information not available." }, // @B3A - { "EXC_LICENSE_CAN_NOT_BE_REQUESTED", "License can not be requested." }, // @B3A - { "EXC_OBJECT_CANNOT_BE_FOUND", "Object cannot be found."}, //@B2A - { "EXC_OBJECT_CANNOT_BE_OPEN", "Object cannot be in an open state." }, - { "EXC_OBJECT_CANNOT_START_THREADS", "Object cannot start threads." }, - { "EXC_OBJECT_IS_READ_ONLY", "Object is read-only." }, //@B0A - { "EXC_OBJECT_MUST_BE_OPEN", "Object must be open." }, - { "EXC_PARAMETER_VALUE_NOT_VALID", "Parameter value is not valid." }, - { "EXC_PROPERTY_NOT_CHANGED", "Property was not changed." }, - { "EXC_PROPERTY_NOT_SET", "Property is not set." }, - { "EXC_PATH_NOT_VALID", "Path name is not valid." }, - { "EXC_RANGE_NOT_VALID", "The parameter value is out of the allowed range." }, - { "EXC_SIGNON_CHAR_NOT_VALID", "The user ID or password contains a character that is not valid." }, - { "EXC_SIGNON_ALREADY_IN_PROGRESS", "A sign-on is already in progress." }, // @F4A - { "EXC_UNKNOWN", "An unknown problem has occurred." }, - { "EXC_PARAMETER_VALUE_DATATYPE_NOT_VALID", "The data type requested is not valid for the parameter value." }, - - { "EXC_PROXY_SERVER_EVENT_NOT_FIRED", "The proxy server was not able to fire an event." }, - { "PROXY_SERVER_ALREADY_STARTED", "Proxy server already started." }, - { "PROXY_SERVER_NOT_STARTED", "Proxy server not started." }, - - }; - -} - diff --git a/cvsroot/src/com/ibm/as400/access/CoverLetterReader.java b/cvsroot/src/com/ibm/as400/access/CoverLetterReader.java deleted file mode 100644 index 486979f39..000000000 --- a/cvsroot/src/com/ibm/as400/access/CoverLetterReader.java +++ /dev/null @@ -1,344 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CoverLetterReader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.beans.*; - -final class CoverLetterReader extends Reader -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - private static final RecordFormat coverLetterRF_ = new RecordFormat("QAPZCOVER"); - static - { - coverLetterRF_.addFieldDescription(new HexFieldDescription(new AS400ByteArray(80), "QAPZCOVER")); - } - - private final SequentialFile file_ = new SequentialFile(); - - private String currentLine_; - private int currentOffset_; - private ConvTable table_; - - CoverLetterReader(AS400 system, String path, int ccsid) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - super(coverLetterRF_); - try - { - file_.setSystem(system); - file_.setPath(path); - file_.setRecordFormat(coverLetterRF_); - } - catch(PropertyVetoException pve) {} - table_ = ConvTable.getTable(ccsid, null); - file_.open(AS400File.READ_ONLY, 10, AS400File.COMMIT_LOCK_LEVEL_NONE); - readRecord(); - } - - protected void finalize() - { - try - { - file_.close(); - } - catch(Exception e) - { - } - } - - public int read() throws IOException - { - try - { - synchronized(lock) - { - if (currentLine_ == null) return -1; - if (currentOffset_ >= currentLine_.length()) - { - readRecord(); - } - return currentLine_.charAt(currentOffset_++); - } - } - catch(AS400Exception e) - { - handleException(e); - } - catch(AS400SecurityException e) - { - handleException(e); - } - catch(ErrorCompletingRequestException e) - { - handleException(e); - } - catch(InterruptedException e) - { - handleException(e); - } - catch(ObjectDoesNotExistException e) - { - handleException(e); - } - return -1; - } - - public int read(char[] cbuf) throws IOException - { - try - { - synchronized(lock) - { - if (currentLine_ == null) return -1; - int cbufOffset = 0; - while (currentLine_ != null && cbufOffset < cbuf.length) - { - char[] cur = currentLine_.toCharArray(); - int max = cur.length-currentOffset_; - if (max > cbuf.length) max = cbuf.length; - System.arraycopy(cur, currentOffset_, cbuf, cbufOffset, max); - currentOffset_ += max; - cbufOffset += max; - if (currentOffset_ >= currentLine_.length()) - { - readRecord(); - } - } - return cbufOffset; - } - } - catch(AS400Exception e) - { - handleException(e); - } - catch(AS400SecurityException e) - { - handleException(e); - } - catch(ErrorCompletingRequestException e) - { - handleException(e); - } - catch(InterruptedException e) - { - handleException(e); - } - catch(ObjectDoesNotExistException e) - { - handleException(e); - } - return -1; - } - - public int read(char[] cbuf, int off, int len) throws IOException - { - try - { - synchronized(lock) - { - if (currentLine_ == null) return -1; - int numChars = 0; - int cbufOffset = off; - while (currentLine_ != null && cbufOffset < (off+len)) - { - char[] cur = currentLine_.toCharArray(); - int max = cur.length-currentOffset_; - if (max > (len-cbufOffset)) max = (len-cbufOffset); - System.arraycopy(cur, currentOffset_, cbuf, cbufOffset, max); - cbufOffset += max; - currentOffset_ += max; - if (currentOffset_ >= currentLine_.length()) - { - readRecord(); - } - } - return cbufOffset-off; - } - } - catch(AS400Exception e) - { - handleException(e); - } - catch(AS400SecurityException e) - { - handleException(e); - } - catch(ErrorCompletingRequestException e) - { - handleException(e); - } - catch(InterruptedException e) - { - handleException(e); - } - catch(ObjectDoesNotExistException e) - { - handleException(e); - } - return -1; - } - - private void handleException(Exception e) throws IOException - { - if (Trace.traceOn_) - { - Trace.log(Trace.ERROR, "Error on SequentialFileReader:", e); - } - throw new IOException(); - } - - public boolean ready() throws IOException - { - synchronized(lock) - { - return currentLine_ != null && currentOffset_ < currentLine_.length(); - } - } - - public void reset() throws IOException - { - try - { - synchronized(lock) - { - file_.positionCursorBeforeFirst(); - readRecord(); - } - } - catch(AS400Exception e) - { - handleException(e); - } - catch(AS400SecurityException e) - { - handleException(e); - } - catch(ErrorCompletingRequestException e) - { - handleException(e); - } - catch(InterruptedException e) - { - handleException(e); - } - catch(ObjectDoesNotExistException e) - { - handleException(e); - } - } - - public long skip(long n) throws IOException - { - try - { - synchronized(lock) - { - if (currentLine_ == null) return -1; - long numChars = 0; - while (currentLine_ != null && numChars < n) - { - int max = currentLine_.length()-currentOffset_; - if (max > n) max = (int)n; - numChars += max; - currentOffset_ += max; - if (currentOffset_ >= currentLine_.length()) - { - readRecord(); - } - } - return numChars; - } - } - catch(AS400Exception e) - { - handleException(e); - } - catch(AS400SecurityException e) - { - handleException(e); - } - catch(ErrorCompletingRequestException e) - { - handleException(e); - } - catch(InterruptedException e) - { - handleException(e); - } - catch(ObjectDoesNotExistException e) - { - handleException(e); - } - return -1; - } - - private void readRecord() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - Record r = file_.readNext(); - if (r == null) - { - currentLine_ = null; - } - else - { - byte[] contents = r.getContents(); - currentLine_ = table_.byteArrayToString(contents, 0, contents.length)+'\n'; - //currentLine_ = ((String)r.getField(0))+'\n'; - } - currentOffset_ = 0; - } - - public void close() throws IOException - { - try - { - synchronized(lock) - { - file_.close(); - } - } - catch(AS400Exception e) - { - handleException(e); - } - catch(AS400SecurityException e) - { - handleException(e); - } - catch(ErrorCompletingRequestException e) - { - handleException(e); - } - catch(InterruptedException e) - { - handleException(e); - } - } -} - - - diff --git a/cvsroot/src/com/ibm/as400/access/CredentialVault.java b/cvsroot/src/com/ibm/as400/access/CredentialVault.java deleted file mode 100644 index 152a06be5..000000000 --- a/cvsroot/src/com/ibm/as400/access/CredentialVault.java +++ /dev/null @@ -1,391 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CredentialVault.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2009-2009 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; - -/** - * A vault which holds an authentication credential to one or more IBM i host servers. - * The type of credential stored varies, depending on the sub-class implementation. - */ -abstract class CredentialVault implements Cloneable, Serializable -{ - static final boolean PASSWORD_TRACE = false; - - // Random number generator for seeds. - static java.util.Random rng = new java.util.Random(); - - /** The credential, which is always encoded before being stored */ - protected byte[] encodedCredential_; - - /** - * A credential is encoded with an algorithm that requires a set of seeds. - * These seeds can be generated internally or they can be provided - * by an external source. If they are provided by an external source, - * then seeds to decode the credential must be provided for us to decode it. - */ - private boolean externalSeedsWereUsed_; - - /** - * Constructs a CredentialVault object that does not contain a credential. - */ - protected CredentialVault() { - this(null); - } - - /** - * Constructs a CredentialVault object that contains the provided credential. - * - * @param credential The credential to store within the vault - */ - protected CredentialVault(byte[] credential) - { - if (credential == null) { - encodedCredential_ = null; - } - else { - // Never store the credential "as is" - encodedCredential_ = store(credential); - } - // We have encoded the credential using internally generated seeds. - externalSeedsWereUsed_ = false; - } - - /** - * Creates and returns a copy of the credential vault. Implementation of this - * method is specific to the type of credential vault being copied. - * Some vaults will copy the credential itself into the new vault, - * others will not. - * - * @return A newly created credential vault that is a copy of this one - */ - public Object clone() - { - CredentialVault vaultClone; - try { - vaultClone = (CredentialVault)super.clone(); - } - catch (CloneNotSupportedException e) { - Trace.log(Trace.ERROR, e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - synchronized(this) - { - if (encodedCredential_ != null) - { - byte[] credentialCopy = new byte[encodedCredential_.length]; - System.arraycopy(encodedCredential_, 0, credentialCopy, 0, credentialCopy.length); - vaultClone.encodedCredential_ = credentialCopy; - } - vaultClone.externalSeedsWereUsed_ = externalSeedsWereUsed_; - } - return vaultClone; - } - - /** - * Retrieves the type of credential stored in the vault. - * - * @return The type of credential stored in the vault. - * Possible values are: - *
        - *
      • AS400.AUTHENTICATION_SCHEME_PASSWORD - *
      • AS400.AUTHENTICATION_SCHEME_GSS_TOKEN - *
      • AS400.AUTHENTICATION_SCHEME_PROFILE_TOKEN - *
      • AS400.AUTHENTICATION_SCHEME_IDENTITY_TOKEN - *
          - */ - protected abstract int getType(); - - /** - * Purges the credential inside the vault. All resources consumed by the - * credential vault are freed. If this method is invoked and the vault is - * already empty, the method simply returns and no exception is thrown. - */ - protected synchronized void empty() { - disposeOfCredential(); - } - - // Cleans up the credential information. - protected void finalize() throws Throwable - { - try { - empty(); - } - finally { - super.finalize(); - } - } - - /** - * Queries the vault to see if it contains a credential. - * - * @return true if the vault does not contain a credential, false if it does - */ - protected boolean isEmpty() { - return (encodedCredential_ == null); - } - - /** - * Retrieves the unencoded credential from the vault. Note that the - * credential will only be "clear" in the sense that any encoding done - * internally by the CredentialVault is removed. Any encoding done - * externally to the credential will remain intact. - * - * @return The unencoded credential from the vault. - */ - protected synchronized byte[] getClearCredential() { - // Make sure we have a credential to give them. - if (isEmpty()) { - Trace.log(Trace.ERROR, "Credential vault is empty"); - throw new ExtendedIllegalStateException("credential", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - return resolve(encodedCredential_); - } - - /** - * Store the credential, after encoding using the provided external seeds. - * Any internal encoding previously done by the CredentialVault will be undone - * prior to encoding the credential with the provided external seeds. - * - * @param firstSeed The first seed to use for encoding - * @param secondSeed The second seed to use for encoding - */ - protected synchronized void storeEncodedUsingExternalSeeds(byte[] firstSeed, byte[] secondSeed) - { - // If the credential was already encoded using externally-supplied seeds, then we must not encode it again. - if (externalSeedsWereUsed_) { - Trace.log(Trace.ERROR, "Called storeEncodedUsingExternalSeeds() when credential was already encoded using external seeds."); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - else { - externalSeedsWereUsed_ = true; - } - - if (!isEmpty()) { - encodedCredential_ = CredentialVault.encode(firstSeed, secondSeed, getClearCredential()); - } - } - - /** - * Store the credential, after encoding using internally generated seeds. - * The credential is first decoded using the provided external seeds. - * The decoded credential will then be encoded using internally generated seeds - * and remain in the vault. - * - * @param firstSeed The first seed to use for decoding - * @param secondSeed The second seed to use for decoding - */ - protected synchronized void storeEncodedUsingInternalSeeds(byte[] firstSeed, byte[] secondSeed) - { - // If the credential was not encoded using externally-supplied seeds, then we cannot decode it. - if (!externalSeedsWereUsed_) { - Trace.log(Trace.ERROR, "Called storeEncodedUsingInternalSeeds() when credential was not previously encoded using external seeds."); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - else { - externalSeedsWereUsed_ = false; - } - - if (!isEmpty()) { - encodedCredential_ = store(CredentialVault.decode(firstSeed, secondSeed, encodedCredential_)); - } - } - - /** - * Disposes of the credential, thus emptying the vault. - */ - protected void disposeOfCredential() { - encodedCredential_ = null; - } - - /** - * Encodes the credential, represented as a array of bytes, using - * internally generated random seeds. The provided credential - * byte array is never modified by this method. - * - * @param credential The credential to encode - * @return The encoded credential - */ - protected byte[] store(byte[] credential) - { - byte[] newAdder = new byte[9]; - rng.nextBytes(newAdder); - - byte[] newMask = new byte[7]; - rng.nextBytes(newMask); - - byte[] infoBytes = encode(newAdder, newMask, credential); - byte[] returnBytes = new byte[infoBytes.length + 16]; - - // - // The format for the stored bytes is - // - // adder : mask : encodedBytes - // - - // First store the adder - System.arraycopy(newAdder, 0, returnBytes, 0, 9); - - // Next store the mask - System.arraycopy(newMask, 0, returnBytes, 9, 7); - - // Finally, store the encoded bytes - System.arraycopy(infoBytes, 0, returnBytes, 16, infoBytes.length); - - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "AS400 object store, bytes:", returnBytes); - } - - return returnBytes; - } - - /** - * Decodes and returns the internally encoded credential. - * The encoded credential byte array is never modified by this method. - * - * @return The credential stored in the vault, with all internal encoding removed - */ - protected synchronized byte[] resolve(byte[] encodedBytes) - { - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "AS400 object resolve:", encodedBytes); - } - - if (encodedBytes == null) - { - return null; - } - - // The first 9 bytes in the array are the adder - byte[] adder = new byte[9]; - System.arraycopy(encodedBytes, 0, adder, 0, 9); - - // The next 7 bytes are the mask - byte[] mask = new byte[7]; - System.arraycopy(encodedBytes, 9, mask, 0, 7); - - // And everything that is left is the encoded bytes - byte[] infoBytes = new byte[encodedBytes.length - 16]; - System.arraycopy(encodedBytes, 16, infoBytes, 0, encodedBytes.length - 16); - - return decode(adder, mask, infoBytes); - } - - /** - * Encodes the given credential bytes using the provided adder and mask. - * The encoded credential is stored and returned in a newly allocated byte array. - * The provided credential byte array is never modified by this method. - * - * @param adder Used for encoding - * @param mask Used for encoding - * @param credential The credential to encode, represented as an array of bytes - * - * @return A newly allocated array of bytes representing the encoded credential - */ - protected static byte[] encode(byte[] adder, byte[] mask, final byte[] credential) - { - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "AS400 object encode:"); - Trace.log(Trace.DIAGNOSTIC, " adder:", adder); - Trace.log(Trace.DIAGNOSTIC, " mask:", mask); - Trace.log(Trace.DIAGNOSTIC, " bytes:", credential); - } - if (credential == null) return null; - int length = credential.length; - byte[] buf = new byte[length]; - for (int i = 0; i < length; ++i) - { - buf[i] = (byte)(credential[i] + adder[i % 9]); - } - for (int i = 0; i < length; ++i) - { - buf[i] = (byte)(buf[i] ^ mask[i % 7]); - } - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, " return:", buf); - } - return buf; - } - - /** - * Decodes the given credential bytes using the provided adder and mask. - * The decoded credential is returned in a newly allocated byte array. - * The provided credential byte array is never modified by this method. - * - * @param adder Used for encoding - * @param mask Used for encoding - * @param credential The credential to encode, represented as an array of bytes - * - * @return A newly allocated array of bytes representing the decoded credential - */ - protected static byte[] decode(byte[] adder, byte[] mask, byte[] credential) - { - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "AS400 object decode:"); - Trace.log(Trace.DIAGNOSTIC, " adder:", adder); - Trace.log(Trace.DIAGNOSTIC, " mask:", mask); - Trace.log(Trace.DIAGNOSTIC, " bytes:", credential); - } - int length = credential.length; - byte[] buf = new byte[length]; - for (int i = 0; i < length; ++i) - { - buf[i] = (byte)(mask[i % 7] ^ credential[i]); - } - for (int i = 0; i < length; ++i) - { - buf[i] = (byte)(buf[i] - adder[i % 9]); - } - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, " return:", buf); - } - return buf; - } - - /** - * Decodes the credential bytes using the provided adder and mask. - * The decoded credential is returned in a newly allocated byte array. - * - * @param adder Used for encoding - * @param mask Used for encoding - * - * @return A newly allocated array of bytes representing the decoded credential - */ - protected byte[] decode(byte[] adder, byte[] mask) { - return CredentialVault.decode(adder, mask, encodedCredential_); - } - - /** - * Provides a minimal amount of tracing information about the credential - * vault in a nicely formatted string. - * - * @return The tracing information represented as a string - */ - protected String trace() - { - StringBuffer sb = new StringBuffer(); - sb.append("type="); - sb.append(getType()); - sb.append(" : bytes="); - Trace.printByteArray(sb, encodedCredential_); // accepts null arg - - return sb.toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/CurrentUser.java b/cvsroot/src/com/ibm/as400/access/CurrentUser.java deleted file mode 100644 index db8e893ba..000000000 --- a/cvsroot/src/com/ibm/as400/access/CurrentUser.java +++ /dev/null @@ -1,84 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CurrentUser.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -// The currentUser class interfaces with the native code for retrieving the current user's userid and encrypted password. -class CurrentUser -{ - static String getUserID(int vrm) - { - byte[] currentUser = null; - try - { - if (vrm >= 0x00050400) - { - currentUser = NativeMethods.getUserId(); - } - else if (vrm >= 0x00050200) - { - if (NativeMethods.loadSCK()) - { - currentUser = getUserIdNative(); - } - } - else - { - UnixSocketUser user = new UnixSocketUser(); - currentUser = user.getUserId(); - } - } - catch (NativeException e) - { - Trace.log(Trace.ERROR, "Error retrieving current userID:", e); - } - catch (Throwable e) - { - Trace.log(Trace.ERROR, "Error retrieving current userID:", e); - } - if (currentUser != null) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Current userID in EBCDIC: ", currentUser); - String userID = SignonConverter.byteArrayToString(currentUser); - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Current userID: '" + userID + "'"); - return userID; - } - return null; - } - - static byte[] getUserInfo(int vrm, byte[] clientSeed, byte[] serverSeed) throws AS400SecurityException, IOException - { - try - { - if (vrm >= 0x00050400) - { - return NativeMethods.getUserInfo(clientSeed, serverSeed); - } - else if (vrm >= 0x00050200) - { - return getUserInfoNative(clientSeed, serverSeed); - } - UnixSocketUser user = new UnixSocketUser(); - return user.getSubstitutePassword(clientSeed, serverSeed); - } - catch (NativeException e) - { - throw AS400ImplRemote.returnSecurityException(BinaryConverter.byteArrayToInt(e.data, 0)); - } - } - - private static native byte[] getUserIdNative() throws NativeException; - private static native byte[] getUserInfoNative(byte[] cSeed, byte[] sSeed) throws NativeException; -} diff --git a/cvsroot/src/com/ibm/as400/access/DBBaseReplyDS.java b/cvsroot/src/com/ibm/as400/access/DBBaseReplyDS.java deleted file mode 100644 index bf6c5d9b0..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBBaseReplyDS.java +++ /dev/null @@ -1,974 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBBaseReplyDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.IOException; -import java.io.PrintStream; - -//-------------------------------------------------------------------- -// -// Each reply consists of 3 parts: Header, Template, and -// Optional / Variable-length Data -// -// Header: Bytes 1 - 4: Length of the reply -// 5 - 6: Header id -// 7 - 8: Client/Server id -// 9 - 12: Client/Server instance -// 13 - 16: Correlation id -// 17 - 18: Length of template -// 19 - 20: Reply id -// -// Template: This is fixed length data that is required. -// Each reply has it's own template format and may vary -// depending on both the request id and client/server id. -// The operational results are stored on the IBM i -// system and can be received at a later time. -// Bitmap: Used to identify the operation results to -// return. Bit 1 is the left-most bit when it -// arrives at the IBM i system -// Bit 1: 1=reply should be sent immediately to -// the client application -// 0=reply is not sent and the rest of -// the bit map is ignored -// Bit 2: Message Id -// Bit 3: First Level Text -// Bit 4: Second Level Text -// Bit 5: Data Format -// Bit 6: Result Data -// Bit 7: SQLCA SQL Communications Area -// Bit 8: Server Attributes -// Bit 9: Parameter Marker format -// Bit 10: Translation Tables -// Bit 11: Data Source Information -// Bit 12: Package Information -// Bit 13: Request is RLE compressed @E2A -// Bit 14: RLE compression reply desired @E2A -// Bit 15: Extended column descriptors @K54 -// Bit 16: Varying Character Column Compression @K54 -// Bit 17: Cursor Attributes @cur -// Bit 18-32: Reserved @E2C @K54 -// Reserved Area: -// Bit 1: Are indicators and data compressed? // @D1A -// Bit 2-32: Reserved // @D1A -// RTNORS: Numeric value of the Operation Results Set -// (ORS) that contains the data to be returned -// to the client. -// It must be non-negative. -// RTN_FID: Contains the ID of the function that -// requested this data to be returned to the -// client application -// RQSD_FID: Contains the ID of the function that -// requested this data to be put in the ORS -// Error Data: Contains the error level and the -// error return code for that level. -// -// Optional / Variable-length Data: -// This is optional data and/or mandatory data that -// varies in length. The following fields may be -// returned. -// -// Message ID: A seven character field that contains -// the id of the message generated as a -// results of the last operation performed -// by the system. -// First Level Message Text: -// The first level text of the message -// generated as a result of the last operation -// performed by the system. -// Second Level Message Text: -// The second level text of the message -// generated as a result of the last operation -// performed by the system. -// Server Attributes: -// Character string that contains the server -// attribute information. -// SQLCA: Character string that contains SQL -// information. -// Data Format: Contains the format (lay out) of the -// result data. -// Result Data: A string of data that was requested by -// function identified in the result function -// ID field. -// Parameter Marker Format: -// Contains the format (lay out) of the -// parameter markers for the statement. -// Translation Table Information: -// Two 256 byte translate tables are returned. -// -// See the readAfterHeader() method for the complete -// list. -// -//--------------------------------------------------------------------- - -/** - This is the base class for all database server reply data - streams. Every concrete database server reply data stream - should inherit from this class. - - Here are the steps needed to handle a reply data stream - from the IBM i system. - - 1. Add a prototype reply data stream to the collection - of reply prototypes. There must be a prototype reply - for every type of reply that must be constructed - automatically. - - static - { - AS400Server.addReplyStream (new DBReplyRequestedDS (), - "as-database"); - } - - 2. Send a request and ask for reply data - - DBReplyRequestedDS reply = sendAndReceive (request); - - a. AS400Server run method will call ClientAccessDataStream - construct method. - b. ClientAccessDataStream construct method will call - readAfterHeader which parses out the data stream - - 3. Check for errors - An error class and return code are always returned. These - report on the success or failure of the request. The - meanings of the various error classes and return codes - are described in the database server specification. - - int ErrorClass = requestedData.getErrorClass(); - int ErrorClassReturnCode = requestedData.getReturnCode() - - 4. Use the methods provided to get the information needed from - the data stream. The results returned will depend on the - values in the Operation Results Bitmap. - - -**/ - -// -// Performance note: -// -// (C.Nock 06/30/97): -// -// I have been investigating how to speed up the construction of -// replies. I would like to reuse storage between replies (like -// is done with requests) using DBStorage and DBStoragePool objects. -// There are two reasons why this is currently not possible. -// -// * We are not responsible for allocating the byte array. This -// is done in ClientAccessDataStream.construct(). -// -// * Reusing storage for replies requires the code to explicitly -// state that it is done using a particular reply, which would -// make the code really messy. Of course, we could release the -// storage in the finalize() method of the reply, but this would -// somewhat unreliable. -// -// It was suggested that we override DataStream.read(), but all that -// does is the copying of the bytes from an input stream into a -// byte array. This is a necessary action and I am not sure how -// we could improve on it. -// - -// Performance note: -// -// (C. Smith 09/07/01): -// -// I am pooling reply datastreams. It is not messy. - -abstract class DBBaseReplyDS -extends ClientAccessDataStream -{ - // Constants. - private static final String NODATA_ = "0"; - private static final int TEMPLATE_LENGTH_ = 20; - - - - // Template variables. - private int errorClass_ = 0; - private int returnCode_ = 0; - - - - // Optional variables. - private int byteCount_ = -1; // @E2A - private long currentLOBLength_ = -1; // @E1A, see @E6 comment below - private DBDataFormat dataFormat_ = null; - private DBExtendedColumnDescriptors extendedColumnDescriptors_ = null; // @G4A - private String firstLevelMessageText_ = null; - private DBLobData lobData_ = null; // @D2C - // @C1D private int lobLocatorHandle_ = -1; - private String messageId_ = null; - private DBReplyPackageInfo packageInfo_ = null; - private DBDataFormat parameterMarkerFormat_ = null; - private DBData resultData_ = null; - private boolean rleCompressed_ = false; // @E3A - private String secondLevelMessageText_ = null; - private DBReplyServerAttributes serverAttributes_ = null; - private DBReplySQLCA sqlca_ = null; - private DBReplyXids xids_ = null; // @E0A - - - // Don't pool this objects, but rely on the pooling of DBReplayRequestedDS objects - DBStorage storage_ = DBDSPool.storagePool_.getUnpooledStorage(); //@P0A @B5C - private boolean inPool_ = false; // Is this reply part of a pool? @B5A - - private int holdable = -1; //@cur - private int scrollable = -1; //@cur - private int updatable = -1; //@cur - private int sensitive = -1; //@cur - - private int isolationLevel = -1; //@isol - - - - //@P0A - Call this in place of constructing a new reply datastream. - final void initialize() - { - data_ = storage_.getData(); - errorClass_ = 0; - returnCode_ = 0; - byteCount_ = -1; - currentLOBLength_ = -1; - dataFormat_ = null; - firstLevelMessageText_ = null; - lobData_ = null; - messageId_ = null; - packageInfo_ = null; - parameterMarkerFormat_ = null; - resultData_ = null; - rleCompressed_ = false; - secondLevelMessageText_ = null; - serverAttributes_ = null; - sqlca_ = null; - xids_ = null; - holdable = -1; //@cur - scrollable = -1; //@cur - updatable = -1; //@cur - sensitive = -1; //@cur - extendedColumnDescriptors_ = null; //@79jqev - isolationLevel = -1; //@isol - - } - - -/** -Output the byte stream contents to the specified PrintStream. -The output format is two hex digits per byte, one space every -four bytes, and sixteen bytes per line. - -@param ps the output stream -**/ - void dump(PrintStream ps) - { - DBBaseRequestDS.dump(ps, data_, data_.length); - - // Report whether or not the datastream was compressed. @E3A - if (rleCompressed_) // @E3A - ps.println("Reply was received RLE compressed."); // @E3A - - } - - - - // See @E6 comment below - public long getCurrentLOBLength() // @E1A - { // @E1A - return currentLOBLength_; // @E1A - } // @E1A - - - //@cur new method - /** - Returns the cursor attribute holdable. - @return The server attribute holdable. (1 is holdable, 0 is not holdable, -1 if unknown (pre-550)) - **/ - public int getCursorAttributeHoldable() - { - return holdable; - } - - //@cur new method - /** - Returns the cursor attribute Scrollable. - @return The server attribute Scrollable. (1 is Scrollable, 0 is not Scrollable, -1 if unknown (pre-550)) - **/ - public int getCursorAttributeScrollable() - { - return scrollable; - } - - //@cur new method - /** - Returns the cursor attribute Updatable. - @return The server attribute Updatable. (1 is Updatable, 0 is not Updatable, -1 if unknown (pre-550)) - **/ - public int getCursorAttributeUpdatable() - { - return updatable; - } - - //@cur new method - /** - Returns the cursor attribute Sensitive. - @return The server attribute Sensitive. (1 is Sensitive, 0 is not Sensitive, -1 if unknown (pre-550)) - **/ - public int getCursorAttributeSensitive() - { - return sensitive; - } - - -/** -Returns the data format. - -@return The data format, or null if not included or empty. -**/ - public DBDataFormat getDataFormat() - { - return dataFormat_; - } - - - -/** -Returns the error class. - -@return The error class. -**/ - public int getErrorClass() - { - return errorClass_; - } - - - -//@G4A -/** -Returns the extended column descriptors. - -@return The extended column descriptors, or null if not included or empty. -**/ - public DBExtendedColumnDescriptors getExtendedColumnDescriptors () - { - return extendedColumnDescriptors_; - } - - - -/** -Returns the first level message text. - -@return The first level message text, or null if not included or empty. -**/ - public String getFirstLevelMessageText() - { - return firstLevelMessageText_; - } - - - - //@isol - /** - Returns the cursor isolation level. - @return The cursor isolation level. - **/ - public int getCursorIsolationLevel() - { - return isolationLevel; - } - - -/** -Returns the LOB data. - -@return The LOB data, or null if not included or empty. -**/ - public DBLobData getLOBData() // @D2C - { - return lobData_; - } - - - -// @C1D /** -// @C1D Returns the LOB locator handle. -// @C1D -// @C1D @return The LOB locator handle, or -1 if not included or empty. -// @C1D **/ -// @C1D public int getLOBLocatorHandle () -// @C1D { -// @C1D return lobLocatorHandle_; -// @C1D } - - - -/** -Returns the message id. - -@return The message id, or null if not included or empty. -**/ - public String getMessageId() - { - return messageId_; - } - - - -/** -Returns the package info. - -@return The package info, or null if not included or empty. -**/ - public DBReplyPackageInfo getPackageInfo() - { - return packageInfo_; - } - - - -/** -Returns the parameter marker format. - -@return The parameter marker format, or null if not included or empty. -**/ - public DBDataFormat getParameterMarkerFormat() - { - return parameterMarkerFormat_; - } - - - -/** -Returns the result data. - -@return The result data, or null if not included or empty. -**/ - public DBData getResultData() - { - return resultData_; - } - - - -/** -Returns the return code. - -@return The return code. -**/ - public int getReturnCode() - { - return returnCode_; - } - - - -/** -Returns the function id of the corresponding request. - -@return The function id of the corresponding request. -**/ - public int getReturnDataFunctionId() - { - return get16bit(30); - } - - - -/** -Returns the second level message text. - -@return The second level message text, or null if not - included or empty. -**/ - public String getSecondLevelMessageText() - { - return secondLevelMessageText_; - } - - - -/** -Returns the server attributes. - -@return The server attributes, or null if not included or empty. -**/ - public DBReplyServerAttributes getServerAttributes() - { - return serverAttributes_; - } - - - -/** -Returns the SQLCA. - -@return The SQLCA, or null if not included or empty. -**/ - public DBReplySQLCA getSQLCA() - { - return sqlca_; - } - - - -// @E0A -/** -Returns the Xids. - -@return The Xids, or null if not included or empty. -**/ - public DBReplyXids getXids() - { - return xids_; - } - - - -/** -Parses the datastream. -**/ - public int readAfterHeader(InputStream in) - throws IOException - { - byteCount_ = super.readAfterHeader(in); // @E2C - return byteCount_; // @E2C - } - - - - // @E2A - Moved from readAfterHeader(). - void parse(int dataCompression) // @E2A - throws IOException // @E2A - { // @E2A - - //Determine if the variable-length fields have been compressed. //@K54 - boolean vlfCompressed = ((get16bit(20) & 0x0001) ==0x0001); //@K54 - boolean dataCompressed = ((get32bit(24) & 0x80000000) == 0x80000000); // @D1A - boolean oldCompressed = (dataCompressed && // @E2A - (dataCompression == AS400JDBCConnection.DATA_COMPRESSION_OLD_)); // @E2A - - // Check to see if the data is RLE compressed. If so, expand it. // @E2A - rleCompressed_ = (dataCompressed && // @E2A - (dataCompression == AS400JDBCConnection.DATA_COMPRESSION_RLE_)); // @E2A - if (rleCompressed_) - { // @E2A - // Decompress the bytes not including the 44 bytes header and template. @E2A - // @E2A - // The format of the header and template is this: @E2A - // Bytes: Description: @E2A - // 4 LL - Compressed length of the entire datastream. @E2A - // 36 The rest of the uncompressed header and template. @E2A - // 4 ll - Length of the compressed data + 10. @E3A - // 2 CP - The compression code point. @E3A - // 4 Decompressed length of the data. @E2A - // LL-10 Compressed data. @E2A @E3C - // - // After decompression, the header and template should look like this: @E2A - // Bytes: Description: @E2A - // 4 LL - Length of the entire datastream after decompress. @E2A - // 36 The rest of the uncompressed header and template. @E2A - // LL-40 Decompressed data. @E2A - - // Check the CP to determine the compression scheme. We currently only // @E3A - // handle RLE. // @E3A - int compressionSchemeCP = get16bit(44); // @E3A - - if (compressionSchemeCP != AS400JDBCConnection.DATA_COMPRESSION_RLE_) // @E3A - throw new IOException(); // @E3A - int lengthOfDecompressedData = get32bit(46); // @E2A @E3C - byte[] newData = new byte[lengthOfDecompressedData + 40]; // @E2A - BinaryConverter.intToByteArray(newData.length, newData, 0); // @E2A - System.arraycopy(data_, 4, newData, 4, 36); // @E2A - DataStreamCompression.decompressRLE(data_, 50, get32bit(0)-50, // @E2A @E3C - newData, 40, DataStreamCompression.DEFAULT_ESCAPE); // @E2A - data_ = newData; // @E2A - byteCount_ = data_.length - 20; // @E2A - } // @E2A - - // Read the template portion of data stream. - errorClass_ = get16bit(34); - returnCode_ = get32bit(36); - - // Move offset to the start of the optional - variable - // length portion of the data stream. - int offset = HEADER_LENGTH + TEMPLATE_LENGTH_; - - // Using offset as a pointer into the datastream, - // walk through the optional - variable length portion - // of the data stream. - while (offset < byteCount_ + HEADER_LENGTH) - { // @E2C - - int parmLength = get32bit (offset); - int codePoint = get16bit (offset + 4); - - // There may be times when a length (ll) and a - // codepoint were returned but no data. In this - // case the length will be = 6. We will treat - // this as if no such parameter came down. - switch (codePoint) - { - - // Message ID. - case 0x3801: - // 8 = length (4) + codePoint (2) + ccsid (2) - if (parmLength != 6) - { // data was sent - ConverterImplRemote converter = ConverterImplRemote.getConverter (get16bit (offset + 6), system_); // @D0C - messageId_ = converter.byteArrayToString (data_, offset + 8, parmLength - 8); - } - else // no data was sent - messageId_ = NODATA_; - break; - - // First level message text. - case 0x3802: - // 10 = length (4) + codePoint (2) + ccsid (2) + streamlength (2) - if (parmLength != 6) - { // data was sent - ConverterImplRemote converter = ConverterImplRemote.getConverter (get16bit (offset + 6), system_); // @D0C - firstLevelMessageText_ = converter.byteArrayToString (data_, offset + 10, parmLength - 10); - } - else // no data was sent - firstLevelMessageText_ = NODATA_; - break; - - // Second level message text. - case 0x3803: - // 10 = length (4) + codePoint (2) + ccsid (2) + streamlength (2) - if (parmLength != 6) - { // data was sent - ConverterImplRemote converter = ConverterImplRemote.getConverter (get16bit (offset + 6), system_); // @D0C - secondLevelMessageText_ = converter.byteArrayToString (data_, offset + 10, parmLength - 10); - } - else // no data was sent - secondLevelMessageText_ = NODATA_; - break; - - // Server attributes. - case 0x3804: - try - { - serverAttributes_ = new DBReplyServerAttributes (data_, - offset + 8, - parmLength); - } - catch (DBDataStreamException x) - { - throw new IOException (); - } - break; - - // Data format. - case 0x3805: - if (parmLength != 6) - { - dataFormat_ = new DBOriginalDataFormat (); - dataFormat_.overlay (data_, offset + 6); - } - else //@79jqev - { - if (Trace.traceOn_) //@79jqev - Trace.log(Trace.DIAGNOSTIC, "Received empty data format."); //@79jqev - } - break; - - // Result data. - case 0x3806: - if (parmLength != 6) - { - resultData_ = new DBOriginalData (parmLength, oldCompressed); // @D1C @E2C - resultData_.overlay (data_, offset + 6); - } - else //@79jqev - { - if (Trace.traceOn_) //@79jqev - Trace.log(Trace.DIAGNOSTIC, "Received empty result data."); //@79jqev - } - break; - - // SQLCA. - case 0x3807: - sqlca_ = new DBReplySQLCA (data_, offset + 6, parmLength); - - break; - - // Parameter marker format. - case 0x3808: - if (parmLength != 6) - { - parameterMarkerFormat_ = new DBOriginalDataFormat (); - parameterMarkerFormat_.overlay (data_, offset + 6); - } - else //@79jqev - { - if (Trace.traceOn_) //@79jqev - Trace.log(Trace.DIAGNOSTIC, "Received empty parameter marker format."); //@79jqev - } - break; - - // Translation table information. - // case 0x3809: - // We don't care much about translatation - // table information. - // break; - - // DSN attributes. - // case 0x380A: - // We don't care much about DSN attributes. - // break; - - // Package return information. - case 0x380B: - packageInfo_ = new DBReplyPackageInfo (data_, - offset + 6, parmLength, system_.getCcsid()); // @D3C - break; - - // Extended data format. - case 0x380C: - if (parmLength != 6) - { - dataFormat_ = new DBExtendedDataFormat (); - dataFormat_.overlay (data_, offset + 6); - } - else //@79jqev - { - if (Trace.traceOn_) //@79jqev - Trace.log(Trace.DIAGNOSTIC, "Received empty extended data format."); //@79jqev - } - break; - - // Extended parameter marker format. - case 0x380D: - if (parmLength != 6) - { - parameterMarkerFormat_ = new DBExtendedDataFormat (); - parameterMarkerFormat_.overlay (data_, offset + 6); - } - else //@79jqev - { - if (Trace.traceOn_) //@79jqev - Trace.log(Trace.DIAGNOSTIC, "Received empty extended parameter marker format."); //@79jqev - } - break; - - // Extended result data. - case 0x380E: - if (parmLength != 6) - { - //@K54D if(vlfCompressed) //@K54 //Note: oldCompressed should always be false for V5R1 systems and greater - resultData_ = new DBExtendedData(parmLength, oldCompressed, vlfCompressed); //@K54 - //@K54D else //@K54 - //@K54D resultData_ = new DBExtendedData(parmLength, oldCompressed); // @D1C @E2C @K54C - resultData_.overlay (data_, offset + 6); - - // @C1D // This doubles as lob data. - // @C1D lobData_ = new DBByteSubarray (parmLength - 6); - // @C1D lobData_.overlay (data_, offset + 6); - } - else //@79jqev - { - if (Trace.traceOn_) //@79jqev - Trace.log(Trace.DIAGNOSTIC, "Received empty extended result data."); //@79jqev - } - break; - - // LOB locator data. // @C1A - case 0x380F: - if (parmLength != 6) - { // @C1A - // @C1D lobLocatorHandle_ = get32bit (offset + 6); - // @D2D int ccsid = get16bit (offset + 6); // @C1A - int length = get32bit (offset + 8); // @C1A - lobData_ = new DBLobData (length, parmLength -12, oldCompressed); // @C1A @D2C @D4C @E2C @E4C - lobData_.overlay (data_, offset + 12); // @C1A - } // @C1A - else //@79jqev - { //@79jqev - if (Trace.traceOn_) //@79jqev - Trace.log(Trace.DIAGNOSTIC, "Received empty lob locator."); //@79jqev - } //@79jqev - break; - - // @E6 Warning, currentLOBLength_ is wrong if the lob is a - // graphic lob (DBClob)! It is too hard to get that - // information through the collective so this code - // can do the right thing. At the time of the @E6 - // change, the only code that uses this value is JDLobLocator, - // and it fixes it up because it knows the field is a - // graphic field. - // Current LOB length. // @E1A - case 0x3810: // @E1A - int sl = get16bit(offset + 6); // @E1A - if (sl == 0) // @E7A - currentLOBLength_ = 0; // @E7A - else if (sl == 4) // @E1A @E7C - currentLOBLength_ = get32bit(offset + 8); // @E1A - else // @E1A - currentLOBLength_ = get64bit(offset + 8); // @E1A - break; // @E1A - - // Xids. // @E0A - case 0x38A1: // @E0A - xids_ = new DBReplyXids(data_, offset, parmLength); // @E0A @E5C - break; // @E0A - - // @G4A Extended column descriptors information (can be turned on and off by the user - // @G4A with the "extended metadata" property) - case 0x3811: - if (parmLength != 6) // @G4A - { // @G4A - extendedColumnDescriptors_ = new DBExtendedColumnDescriptors( // @G4A - data_, offset + 6); // @G4A - } // @G4A - else //@79jqev - { - if (Trace.traceOn_) //@79jqev - Trace.log(Trace.DIAGNOSTIC, "Received empty extended column descriptor."); //@79jqev - } - break; - - // Super Extended data format. //@540 - case 0x3812: - if (parmLength != 6) - { - //System.out.println("Extended data format: "); - dataFormat_ = new DBSuperExtendedDataFormat (); - dataFormat_.overlay (data_, offset + 6); - } - else //@79jqev - { - if (Trace.traceOn_) //@79jqev - Trace.log(Trace.DIAGNOSTIC, "Received empty super extended data format."); //@79jqev - } - break; - - // Super Extended parameter marker format. //@540 - case 0x3813: - if (parmLength != 6) - { - //System.out.println("extended parameter marker format"); - parameterMarkerFormat_ = new DBSuperExtendedDataFormat (); - parameterMarkerFormat_.overlay (data_, offset + 6); - } - else //@79jqev - { - if (Trace.traceOn_) //@79jqev - Trace.log(Trace.DIAGNOSTIC, "Received empty parameter marker format."); //@79jqev - } - break; - - // Cursor attributes //@cur - case 0x3814: - if (parmLength != 6) - { - int attrs = get32bit(offset + 6); //4 bytes, 1 per byte - holdable = (attrs >> 24) & 0x0001; - scrollable = (attrs >> 16) & 0x0001; - updatable = (attrs >> 8) & 0x0001; - sensitive = ((attrs >> 0) & 0x0001) == 1 ? 0 : 1; //attr from zda is INsensitive - - attrs = get32bit(offset + 10); //@isol - isolationLevel = (attrs >> 24) & 0x000f; //@isol - /*(Byte 5 - Cursor Isolation Level - '0' None - '1' Cursor Stability - '2' Uncommitted Read (*CHG) - '3' Read Stability (*ALL) - '4' Repeatable Read */ - - } - else //@79jqev - { //@79jqev - if (Trace.traceOn_) //@79jqev - Trace.log(Trace.DIAGNOSTIC, "Received empty cursor attributes."); //@79jqev - } - break; - - case 0x3901: //@array - // Variable result data. (used when getting output parms from stored procedure if a parm is an array) - if (parmLength != 6) - { - //ouput parms - resultData_ = new DBVariableData(); // x3901 codepoint - resultData_.overlay (data_, offset + 6); - } - else //@79jqev - { - if (Trace.traceOn_) //@79jqev - Trace.log(Trace.DIAGNOSTIC, "Received empty extended result data."); //@79jqev - } - break; - - //README: When adding a new codepoint, please add any needed initializations - //of references to the initialize() method since this object gets reused. - } - - offset += parmLength; - } - } - - void setInPool(boolean inPool) { - inPool_ = inPool; - } /*@B5A*/ - - synchronized void returnToPool() { - // - // Note: At this point the data_ pointer contains memory that was allocated - // in the static ClientAccessDataStream.construct(). This data_ pointer has - // probably been shared with other data structures. Reset the data_ pointer - // to the one from the storage object so that the one allocated by - // ClientAccessDataStream.construct() will not be overwritten by - // super.returnToPool(); - // - // - data_ = storage_.getData(); - - super.returnToPool(); - // In this is not in the pool, go ahead and free the storage - if (!inPool_) { - // Note: storage_ was allocated using getUnpooledStorage. - // We do not need to return it to the pool. - // if (storage_ != null) { - // storage_.returnToPool(); - // } - storage_ = null; - data_ = null; - } - } /*@B5A*/ - - - // Make sure the storage is freed before going away. @B5A - synchronized protected void finalize() - throws Throwable - { - // Note: storage_ was allocated using getUnpooledStorage. - // We do not need to return it to the pool. - // if (storage_ != null) { - // storage_.returnToPool(); - // } - storage_ = null; - data_ = null; - super.finalize(); - } /*@B5A*/ - - -} - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/DBBaseRequestDS.java b/cvsroot/src/com/ibm/as400/access/DBBaseRequestDS.java deleted file mode 100644 index 6c3be896f..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBBaseRequestDS.java +++ /dev/null @@ -1,1082 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBBaseRequestDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayOutputStream; //@PDA for lazy close check -import java.io.CharConversionException; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintStream; -import java.util.Enumeration; -import java.util.Hashtable; -import java.sql.SQLException; - - - -//-------------------------------------------------------------------- -// -// Each request consists of 3 parts: Header, Template, and -// Optional / Variable-length Data -// -// Header: Bytes 1 - 4: Length of the request -// 5 - 6: Header id -// 7 - 8: Client/Server id -// 9 - 12: Client/Server instance -// 13 - 16: Correlation id -// 17 - 18: Length of template -// 19 - 20: Request id -// -// Template: This is fixed length data that is required. -// Each request has it's own template format and may vary -// depending on both the request id and client/server id. -// The operational results are stored on the IBM i -// system and can be received at a later time. -// Bitmap: Used to identify the operation results to -// return. Bit 1 is the left-most bit when it -// arrives at the IBM i system -// Bit 1: 1=reply should be sent immediately to -// the client application -// 0=reply is not sent and the rest of -// the bit map is ignored -// Bit 2: Message Id -// Bit 3: First Level Text -// Bit 4: Second Level Text -// Bit 5: Data Format -// Bit 6: Result Data -// Bit 7: SQLCA SQL Communications Area -// Bit 8: Server Attributes -// Bit 9: Parameter Marker format -// Bit 10: Translation Tables -// Bit 11: Data Source Information -// Bit 12: Package Information -// Bit 13: Request is RLE compressed @E3A -// Bit 14: RLE compression reply desired @E3A -// Bit 15: Extended column descriptors @F1C -// Bit 16: Varying Length Column Compression @K54 -// Bit 17-32: Reserved @E3C @F1C @K54 -// Reserved Area: -// RTNORS: Numeric value of the Operation Results Set -// (ORS) that contains the data to be returned -// to the client. -// It must be non-negative. -// FILLORS: Numeric value of the ORS used to store the -// data for this function. -// It must be non-negative. -// BONORS: Numeric value of the "based-on" ORS. -// If used, it must be positive. If it is not -// positive, it will be ignored. -// RPBHNDL: Numeric value of the Request Parameter Block -// (RPB) to be used. -// This may be set to zero indicating that an RPB -// will not be used. -// PM DESCHNDL: Parameter marker descriptor handle -// identifier. -// This field is only used when the serverId -// is "E004"X (SQL). -// PARMCNT: Number of parameters in the optional/variable- -// length data. -// -// Optional / Variable-length Data: -// This is optional data and/or mandatory data that -// varies in length. -// o Use format LL CP data -// LL = length -// CP = code point -// o Character data is optionally preceede by a -// coded character set of the data (CCSID) -// o The CCSID can identify the code page and the -// character set of the data -// o All LLs include the length of the LL -// o The client is responsible for providing numerics -// in the server format so the system will not -// need to perform data conversions. -// -//--------------------------------------------------------------------- - -/** - This is the base class for all database server request data - streams. Every concrete database server request data stream - should inherit from this class. - - Here are the steps needed to send a request data stream to the - server: - - 1. For all such requests, construct the data stream object, - passing the required parameters. - - 2. The header and template portions of the data stream will - be created by the constructor. - - 3. Use the addParameter function to add any additional - parameters required by the specific function. These - parameters will be part of the Optional / Variable-length - section of the header. - - 4. After setting all the parameters, but before sending the - request, invoke the dataStreamReady function. - This function will: - - Clean up the data stream - - Set values that can not be calculated until all - all parameters are set - - Request length - - parameter count - - 5. Then you are ready to send the request to the system. There are - two choices: - - If no reply is needed use: - try { - server.send (request); - } - catch { - // Handle the exception. - } - - - If a reply is needed use: - DataStream reply = null; - try { - reply = server.sendAndReceive (request); - } - catch (Exception e) { - // Handle the exception. - } - - - @See com.ibm.as400.access.DBReturnRequestedDataDS - @See com.ibm.as400.access.AS400Server -**/ - -//-----------------------------------------------------// -// // -// addParameter is used to add an optional / variable-// -// length parameter to the datastream. After all // -// the parameters are added, dataStreamReady should // -// be called and then the data stream will be done. // -// // -// The addParameter method is used to handle the // -// following types of parameters: // -// Request Function Parameters // -// Attribute Function Parameters // -// Descriptor Function Parameters // -// Result Set Function Parameters // -// RPB Function Parameters // -// // -// The addParameter used will depend on the format, // -// not the type. // -// // -// Each addParameter will do the following: // -// 1. Test to make sure there is room in the // -// data stream. // -// 2. Put the length (LL) into the data stream. // -// Include the 4 bytes for the LL in the length. // -// 3. Put the code point (parameter id) into the // -// the data stream. // -// 4. Put the data into the data stream. // -// 5. Add the length to the total request length. // -// 6. Add to parameter count. // -// // -//-----------------------------------------------------// - - -abstract class DBBaseRequestDS -extends ClientAccessDataStream -{ - public static int SEND_HISTORY_SIZE=10; /*@A8A*/ - // Private data. - private int currentOffset_; - private int lockedLength_; - private int operationResultBitmap_; - private int parameterCount_; - private boolean rleCompressed_ = false; // @E3A - private final DBStorage storage_ = DBDSPool.storagePool_.getUnusedStorage(); //@P0A - private int[] sendHistory = new int[SEND_HISTORY_SIZE]; // @A8A - private int sendHistoryOffset = 0; // @A8A - - // Values for operation result bitmap. - public static final int ORS_BITMAP_RETURN_DATA = 0x80000000; // Bit 1 - public static final int ORS_BITMAP_MESSAGE_ID = 0x40000000; // Bit 2 - public static final int ORS_BITMAP_FIRST_LEVEL_TEXT = 0x20000000; // Bit 3 - public static final int ORS_BITMAP_SECOND_LEVEL_TEXT = 0x10000000; // Bit 4 - public static final int ORS_BITMAP_DATA_FORMAT = 0x08000000; // Bit 5 - public static final int ORS_BITMAP_RESULT_DATA = 0x04000000; // Bit 6 - public static final int ORS_BITMAP_SQLCA = 0x02000000; // Bit 7 - public static final int ORS_BITMAP_SERVER_ATTRIBUTES = 0x01000000; // Bit 8 - public static final int ORS_BITMAP_PARAMETER_MARKER_FORMAT = 0x00800000; // Bit 9 - // public static final int ORS_BITMAP_TRANSLATION_TABLES = 0x00400000; // Bit 10 - // public static final int ORS_BITMAP_DATA_SOURCE_INFORMATION = 0x00200000; // Bit 11 - public static final int ORS_BITMAP_PACKAGE_INFO = 0x00100000; // Bit 12 - public static final int ORS_BITMAP_REQUEST_RLE_COMPRESSION = 0x00080000; // Bit 13 @E3A - public static final int ORS_BITMAP_REPLY_RLE_COMPRESSION = 0x00040000; // Bit 14 @E3A - public static final int ORS_BITMAP_EXTENDED_COLUMN_DESCRIPTORS = 0x00020000; // Bit 15 @F1A - public static final int ORS_BITMAP_VARIABLE_LENGTH_FIELD_COMPRESSION = 0x00010000; //Bit 16 @K54 - public static final int ORS_BITMAP_CURSOR_ATTRIBUTES = 0x00008000; //Bit 17 @CUR - - - - // Server IDs. - protected static final int SERVER_SQL = 0xE004; - protected static final int SERVER_NDB = 0xE005; - protected static final int SERVER_ROI = 0xE006; - - - // This is the length that data must be to be considered for RLE compression. @E3A - // It is currently set to 1024 + 40 (header and template + 1K). It must be @E3A - // set to at least 40. @E3A - private static final int RLE_THRESHOLD_ = 1064; // @E3A - - -/** -Constructor. -**/ - protected DBBaseRequestDS(int requestId, - int rpbId, - int operationResultBitmap, - int parameterMarkerDescriptorHandle) - { - super(); - - initialize(requestId, rpbId, operationResultBitmap, parameterMarkerDescriptorHandle); //@P0A - } - - - - //@P0A - This code used to be in the constructor. - // Now, just call initialize() instead of constructing a new datastream. - void initialize(int requestId, - int rpbId, - int operationResultBitmap, - int parameterMarkerDescriptorHandle) - { - // Allocate the large byte array for storage of the - // data stream. - - data_ = storage_.getData(); //@P0C - - // Initialization. - currentOffset_ = HEADER_LENGTH + 20; - parameterCount_ = 0; - operationResultBitmap_ = operationResultBitmap; - rleCompressed_ = false; //@P0A - lockedLength_ = 0; //@P0A - - // Data stream header. - setHeaderID(0); - setCSInstance(0); - setTemplateLen(20); - setReqRepID(requestId); - - // Data stream template. - set32bit(operationResultBitmap, 20); // Operation result bitmap. - set16bit(rpbId, 28); // Return ORS handle. - set16bit(rpbId, 30); // Fill ORS handle. - setBasedOnORSHandle(0); // Based on ORS handle. - set16bit(rpbId, 34); // RPB handle. - setParameterMarkerDescriptorHandle(parameterMarkerDescriptorHandle); - - } - - -/** -Adds another operation result to the operation result bitmap. -**/ - public void addOperationResultBitmap(int value) - { - operationResultBitmap_ |= value; - set32bit(operationResultBitmap_, 20); - } - - - -/** -Adds a 1 byte parameter. -**/ - protected void addParameter(int codePoint, byte value) throws DBDataStreamException - { - lock(1, codePoint); - - data_[currentOffset_] = value; - - unlock(); - } - - - -/** -Adds a 2 byte parameter. -**/ - protected void addParameter(int codePoint, short value) - throws DBDataStreamException - { - lock(2, codePoint); - - set16bit(value, currentOffset_); - - unlock(); - } - - - -/** -Adds a 2 byte parameter with an extra 4 byte value. -**/ - protected void addParameter(int codePoint, short value, int extra) - throws DBDataStreamException - { - lock(6, codePoint); - - set16bit(value, currentOffset_); - set32bit(extra, currentOffset_ + 2); - - unlock(); - } - - - -/** -Adds a 4 byte parameter. -**/ - protected void addParameter(int codePoint, int value) - throws DBDataStreamException - { - lock(4, codePoint); - - set32bit(value, currentOffset_); - - unlock(); - } - - - -/** -Adds a byte array parameter. -**/ - protected void addParameter(int codePoint, byte[] value) - throws DBDataStreamException - { - if(value == null){ //@eWLM Can pass a null value in - //"Locks" the request datastream for addition of a parameter. This will determine if there is space left in the data byte array and grow it as needed. - lock(0, codePoint); //@eWLM Locks the datastream and adds the codepoint to it - unlock(); //@eWLM "Unlocks" the datastream - if(Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Value is null, sending only length and codepoint."); //@eWLM - } //@eWLM - else //@eWLM - addParameter(codePoint, value, 0, value.length); - } - - protected void addParameter(int codePoint, byte[] value, int offset, int length) throws DBDataStreamException - { - lock(length, codePoint); - System.arraycopy(value, offset, data_, currentOffset_, length); - unlock(); - } - -/** -@B2A Adds a byte array parameter including CCSID and length. -**/ - protected void addParameter(int codePoint, - byte[] value, - boolean overloadThisMethod) - throws DBDataStreamException - { - addParameter(codePoint, value, 0, value.length, overloadThisMethod); - } - - - protected void addParameter(int codePoint, byte[] value, int offset, int length, boolean overloadThisMethod) throws DBDataStreamException - { - lock(value.length + 6, codePoint); - set16bit((short)0xFFFF, currentOffset_); - set32bit(length, currentOffset_ + 2); - System.arraycopy(value, offset, data_, currentOffset_ + 6, length); - unlock(); - } - -// @E4A -/** -Adds a fixed length string parameter which contains only numbers. -This assumption avoids character conversion. -**/ - protected void addParameter(int codePoint, String value) // @E4A - throws DBDataStreamException // @E4A - { // @E4A - char[] asChars = value.toCharArray(); // @E4A - lock(asChars.length + 2, codePoint); // @E4A - - set16bit(37, currentOffset_); // CCSID @E4A - - int offset = currentOffset_ + 2; // @E4A - for (int i = 0; i < asChars.length; ++i, ++offset) - { // @E4A - if (asChars[i] == ' ') // @E4A - data_[offset] = 0x40; // @E4A - else // @E4A - data_[offset] = (byte)(asChars[i] | 0x00F0); // @E4A - } // @E4A - - unlock(); // @E4A - } // @E4A - - - -/** -Adds a fixed length string parameter. -**/ -// -// This does not need to work with double byte character sets -// as far as I know. -// - protected void addParameter(int codePoint, - ConvTable converter, //@P0C - String value, - int valueLength) - throws DBDataStreamException - { - lock(valueLength + 2, codePoint); - - set16bit(converter.ccsid_, currentOffset_); // CCSID @P0C - - try - { - converter.stringToByteArray(value.substring (0, valueLength), - data_, currentOffset_ + 2); - } - catch (CharConversionException e) - { - throw new DBDataStreamException(); - } - - unlock(); - } - - - -/** -Adds a variable length string parameter. -**/ - protected void addParameter(int codePoint, - ConvTable converter, //@P0C - String value) - throws DBDataStreamException, SQLException // @E9a - { - // @A1C - // Changed code to use the converter to find out the exact - // number of bytes the string needs to occupy so that it works - // for both single-byte and double-byte strings. - byte[] rawBytes = converter.stringToByteArray(value); - - if (rawBytes.length > 65535) // @E9a - JDError.throwSQLException (JDError.EXC_SQL_STATEMENT_TOO_LONG); // @E9a - - lock(rawBytes.length + 4, codePoint); - - set16bit(converter.ccsid_, currentOffset_); // CCSID @P0C - set16bit(rawBytes.length, currentOffset_ + 2); // SL - - try - { - System.arraycopy(rawBytes, 0, data_, currentOffset_ + 4, - rawBytes.length); - } - catch (Exception e) - { - throw new DBDataStreamException(); - } - - unlock(); - } - -//@540 -/** -Adds a variable length string parameter with a four byte length. -**/ -//Note: This method will only be called if running to a V5R4 or later system. boolean v5r4 is just to distinguish this -// method from the method above (protected void addParameter(int codePoint,ConvTable converter, String value)). - protected void addParameter(int codePoint, boolean v5r4, - ConvTable converter, - String value) - throws DBDataStreamException, SQLException - { - byte[] rawBytes = converter.stringToByteArray(value); - - if (rawBytes.length > 2097152) //CHECK TO SEE IF GREATER THAN 2MB - JDError.throwSQLException (JDError.EXC_SQL_STATEMENT_TOO_LONG); - - lock(rawBytes.length + 6, codePoint); - - set16bit(converter.ccsid_, currentOffset_); // CCSID - set32bit(rawBytes.length, currentOffset_ + 2); // SL - Set 4-byte length - - try - { - System.arraycopy(rawBytes, 0, data_, currentOffset_ + 6, - rawBytes.length); - } - catch (Exception e) - { - throw new DBDataStreamException(); - } - - unlock(); - } - - /** -Adds a fixed length string parameter, but uses character conversion. -**/ - protected void addParameter(int codePoint, - ConvTable converter, //@P0C - String value, - boolean fixed) - throws DBDataStreamException, SQLException // @E9a - { - if(fixed){ - // Changed code to use the converter to find out the exact - // number of bytes the string needs to occupy so that it works - // for both single-byte and double-byte strings. - byte[] rawBytes = converter.stringToByteArray(value); - - if (rawBytes.length > 65535) - JDError.throwSQLException (JDError.EXC_SQL_STATEMENT_TOO_LONG); - - lock(rawBytes.length + 4, codePoint); - - set16bit(converter.ccsid_, currentOffset_); - - try - { - System.arraycopy(rawBytes, 0, data_, currentOffset_ + 2, - rawBytes.length); - } - catch (Exception e) - { - throw new DBDataStreamException(); - } - - unlock(); - } - else - addParameter(codePoint, converter, value); - } - -/** -Adds an empty code point -**/ - protected void addParameter(int codePoint) - throws DBDataStreamException - { - lock(0, codePoint); - unlock(); - } - - -/** -Adds a library list parameter. -**/ - protected void addParameter(int codePoint, - ConvTable converter, //@P0C - char[] indicators, - String[] libraries) - throws DBDataStreamException - { - int parameterLength = 4; - for (int i = 0; i < libraries.length; ++i) - parameterLength += 3 + libraries[i].length(); - - lock(parameterLength, codePoint); - - set16bit(converter.ccsid_, currentOffset_); // CCSID @P0C - set16bit(libraries.length, currentOffset_ + 2); // number of libraries - - int offset = 4; - try - { - for (int i = 0; i < libraries.length; ++i) - { - Character ch = new Character(indicators[i]); - converter.stringToByteArray(ch.toString(), data_, currentOffset_ + offset); - set16bit(libraries[i].length(), currentOffset_ + offset + 1); - converter.stringToByteArray(libraries[i], data_, currentOffset_ + offset + 3); - offset += 3 + libraries[i].length(); - } - } - catch (CharConversionException e) - { - throw new DBDataStreamException(); - } - - unlock(); - } - - - -/** -Adds a NLSS indicator parameter. -**/ - protected void addParameter(int codePoint, - ConvTable converter, //@P0C - int type, - String tableFile, - String tableLibrary, - String languageId) - throws DBDataStreamException - { - int parameterLength; - switch (type) - { - case 0: - default: - parameterLength = 2; - break; - case 1: - case 2: - parameterLength = 7; - break; - case 3: - parameterLength = 8 + tableFile.length() + tableLibrary.length(); - break; - } - - lock(parameterLength, codePoint); - - set16bit(type, currentOffset_); // sort value - - try - { - switch (type) - { - case 0: - default: - break; - case 1: - case 2: - set16bit(converter.ccsid_, currentOffset_ + 2); // CCSID @P0C - converter.stringToByteArray(languageId, data_, - currentOffset_ + 4); // sort language id - break; - case 3: - set16bit(converter.ccsid_, currentOffset_ + 2); // CCSID @P0C - set16bit(tableFile.length(), - currentOffset_ + 4); // SL - converter.stringToByteArray(tableFile, data_, - currentOffset_ + 6); // sort table file - set16bit(tableLibrary.length(), - currentOffset_ + 6 + tableFile.length()); // SL - converter.stringToByteArray(tableLibrary, data_, - currentOffset_ + 8 + tableFile.length()); // sort table library - break; - } - } - catch (CharConversionException e) - { - throw new DBDataStreamException(); - } - - unlock(); - } - - - -/** -Adds a DBOverlay parameter. -**/ - protected void addParameter(int codePoint, - DBOverlay value) - throws DBDataStreamException - { - lock(value.getLength(), codePoint); - - value.overlay(data_, currentOffset_); - - unlock(); - } - - - -/** -Clears an operation result from the operation result bitmap. -**/ - public void clearOperationResultBitmap(int value) // @E3A - { // @E3A - if ((operationResultBitmap_ & value) != 0) - { // @E3A - operationResultBitmap_ ^= value; // @E3A - set32bit(operationResultBitmap_, 20); // @E3A - } // @E3A - } // @E3A - - - - public void compress() // @E3A - { // @E3A - rleCompressed_ = true; // @E3A - } // @E3A - - - -/** -Output the byte stream contents to the specified PrintStream. -The output format is two hex digits per byte, one space every -four bytes, and sixteen bytes per line. - -@param ps the output stream -**/ -// -// We need to override the implementation from the super class, since it -// depends on the length of the byte array. We reuse long byte arrays, -// and store the length in a separate variable. -// -// If we did not override this, the dump of a single request would show -// a bunch of extra zero bytes. -// -// In addition, we take the opportunity to also print -// limited character output. -// - void dump(PrintStream ps) - { - dump(ps, data_, currentOffset_); - - // Report whether or not the datastream was compressed. @E3A - if (rleCompressed_) // @E3A - ps.println("Request was sent RLE compressed."); // @E3A - } - - - -/** -Output the byte stream contents to the specified PrintStream. -The output format is two hex digits per byte, one space every -four bytes, and sixteen bytes per line. - -@param ps the output stream -@param data the data -@param length the length -**/ - static void dump(PrintStream ps, byte[] data, int length) - { - synchronized(ps) - { // @E1A - - StringBuffer hexBuffer = new StringBuffer(); - StringBuffer charBuffer = new StringBuffer(); - int i; - for (i = 0; i < length; i++) - { - - // Convert the data to 2 digits of hex. - String temp = "00" + Integer.toHexString(data[i]); - String hex = temp.substring(temp.length() - 2); - hexBuffer.append(hex.toUpperCase()); - - // Pad hex output at every 4 bytes. - if (i % 4 == 3) - hexBuffer.append(" "); - - // Convert the data to an ASCII character. - short ascii = (short) ((data[i] >= 0) - ? data[i] : 256 + data[i]); - char ch; - if ((ascii >= 0x81) && (ascii <= 0x89)) - ch = (char) ('a' + ascii - 0x81); - - else if ((ascii >= 0x91) && (ascii <= 0x99)) - ch = (char) ('j' + ascii - 0x91); - - else if ((ascii >= 0xA2) && (ascii <= 0xA9)) - ch = (char) ('s' + ascii - 0xA2); - - else if ((ascii >= 0xC1) && (ascii <= 0xC9)) - ch = (char) ('A' + ascii - 0xC1); - - else if ((ascii >= 0xD1) && (ascii <= 0xD9)) - ch = (char) ('J' + ascii - 0xD1); - - else if ((ascii >= 0xE2) && (ascii <= 0xE9)) - ch = (char) ('S' + ascii - 0xE2); - - else if ((ascii >= 0xF0) && (ascii <= 0xF9)) - ch = (char) ('0' + ascii - 0xF0); - - else - { // @E1C - // If we are here, it means that the EBCDIC to ASCII // @E1A - // conversion resulted in an ASCII character that does // @E1A - // not make sense. Lets try it as a Unicode character // @E1A - // straight up. // @E1A - if (data[i] == 0x40) // This could be either Unicode '@' // @E1A - ch = ' '; // or EBCDIC ' '. We will assume the // @E1A - // latter for dumps. // @E1A - else if ((data[i] >= 0x20) && (data[i] <= 0x7E)) // @E1A - ch = (char) data[i]; // @E1A - else // @E1A - ch = '.'; - } // @E1A - - charBuffer.append(ch); - - // Start a new line at every 16 bytes. - if (i % 16 == 15) - { - ps.println(hexBuffer + " [" + charBuffer + "]"); - hexBuffer = new StringBuffer(); - charBuffer = new StringBuffer(); - } - } - - // Pad out and print the last line if necessary. - if (i % 16 != 0) - { - int hexBufferLength = hexBuffer.length(); - for (int j = hexBufferLength; j <= 35; ++j) - hexBuffer.append(" "); - ps.println(hexBuffer + " [" + charBuffer + "]"); - } - - } // @E1A - } - - - public int getOperationResultBitmap() // @E2A - { // @E2A - return operationResultBitmap_; // @E2A - } // @E2A - - // @E7a new method. - // Make sure the buffer is free before going away. - protected void finalize() - throws Throwable - { - //@P0D freeCommunicationsBuffer(); - if (storage_ != null) { - storage_.returnToPool(); /* storage_ = null; */ //@P0A - } - data_ = null; //@P0A - super.finalize(); - } - - - -/** -"Locks" the request datastream for addition of a parameter. -This will determine if there is space left in the data -byte array and grow it as needed. - -@param length The length to be added to the data stream, - in bytes, not including the LL and CP. -**/ - private void lock(int length, int codePoint) - throws DBDataStreamException - { - if (storage_.checkSize(currentOffset_ + length + 6)) - data_ = storage_.getData(); //@P0C - lockedLength_ = length; - - set32bit(length + 6, currentOffset_); // LL - set16bit(codePoint, currentOffset_ + 4); // CP - - currentOffset_ += 6; - } - - - -/** -Sets the numeric value of the "based-on" Operation Results -Set (ORS) into the request datastream. - -@param value The numeric value of the based-on ORS. -**/ -//------------------------------------------------------------ -// The based-on ORS handle specifies an ORS from a previous -// operation. It is used to be able to "chain" requests -// together without checking the results or the previous -// request. If the previous request (whose results are stored -// in the based-on ORS) failed, then this request will not be -// executed. -// -// The based-on ORS handle should be 0 for the first request -// in a chain. -//----------------------------------------------------------- - public void setBasedOnORSHandle(int value) - { - set16bit(value, 32); - } - - - -/** -"Unlocks" the request datastream after addition of a parameter. -**/ - private void unlock() - { - currentOffset_ += lockedLength_; - ++parameterCount_; - } - - - -/** -Sets the parameter marker descriptor handle. -**/ - public void setParameterMarkerDescriptorHandle(int value) - { - set16bit(value, 36); - } - - - - - -/** -Overrides the superclass to write the datastream. -**/ - void write(OutputStream out) - throws IOException - { - // record the length of this packet for each send @A8A - sendHistory[sendHistoryOffset] = currentOffset_; - sendHistoryOffset = (sendHistoryOffset + 1) % SEND_HISTORY_SIZE; - - setLength(currentOffset_); - set16bit(parameterCount_, 38); - - if (rleCompressed_) - { // @E3A - - // Check to see if it is worth doing compression. @E3A - if (currentOffset_ > RLE_THRESHOLD_) - { // @E3A - - // Get another piece of storage from the pool. @E3A - DBStorage secondaryStorage = DBDSPool.storagePool_.getUnusedStorage(); // @E3A @P0C - try //@P0A - { - secondaryStorage.checkSize(currentOffset_); // @E3A - byte[] compressedBytes = secondaryStorage.getData(); // @E3A @P0C - - // Compress the bytes not including the header (20 bytes) and template @E3A - // (20 bytes). If the compression was successful, send the compressed @E3A - // bytes. Otherwise, send the bytes as normal. @E3A - // - // The format is this: @E3A - // Bytes: Description: @E3A - // 4 LL - Compressed length of the entire datastream. @E3A - // 36 The rest of the uncompressed header and template. @E3A - // 4 ll - Length of the compressed data + 10. @E5A - // 2 CP - The compression code point. @E5A - // 4 Decompressed length of the data. @E3A - // ll-10 Compressed data. @E3A @E5C - int dataLength = currentOffset_ - 40; // @E3A - - int compressedSize = DataStreamCompression.compressRLE(data_, 40, // @E3A - dataLength, compressedBytes, 50, // @E3A @E5C - DataStreamCompression.DEFAULT_ESCAPE); // @E3A - if (compressedSize > 0) - { // @E3A - int compressedSizeWithHeader = compressedSize + 50; // @E3A @E5C - BinaryConverter.intToByteArray(compressedSizeWithHeader, compressedBytes, 0); // @E3A - System.arraycopy(data_, 4, compressedBytes, 4, 36); // @E3A - BinaryConverter.intToByteArray(compressedSize + 10, compressedBytes, 40); // @E5A - BinaryConverter.shortToByteArray((short)AS400JDBCConnection.DATA_COMPRESSION_RLE_, compressedBytes, 44); // @E5A - BinaryConverter.intToByteArray(dataLength, compressedBytes, 46); // @E3A @E5C - - // Synchronization is added around the socket @E3A - // write so that requests from multiple threads @E3A - // that use the same socket won't be garbled. @E3A - synchronized(out) - { // @E3A - out.write(compressedBytes, 0, compressedSizeWithHeader); // @E3A - out.flush(); // @W1A - } - if (Trace.traceOn_) Trace.log(Trace.DATASTREAM, "Data stream sent (connID="+connectionID_+") ...", compressedBytes, 0, compressedSizeWithHeader); //@E6A @P0C - } // @E3A - else - { // @E3A - rleCompressed_ = false; // Compression failed. // @E3A - } // @E3A - } - finally //@P0A - { - secondaryStorage.returnToPool(); secondaryStorage = null; //@P0A - } - } // @E3A - else - { // @E3A - rleCompressed_ = false; // Compression is not worth it. // @E3A - } // @E3A - } // @E3A - - if (!rleCompressed_) - { // @E3A - - // The compression was not successful, send the request uncompressed @E3A - // (but still ask for the reply to be compressed). @E3A - clearOperationResultBitmap(ORS_BITMAP_REQUEST_RLE_COMPRESSION); // @E3A - - // @A0A - // Synchronization is added around the socket - // write so that requests from multiple threads - // that use the same socket won't be garbled. - synchronized(out) - { - out.write(data_, 0, currentOffset_); - out.flush(); //@W1a - } - //@PDA only trace if stream is actually being sent now. (no trace on lazy close here) - if (Trace.traceOn_ && !(out instanceof ByteArrayOutputStream)) Trace.log(Trace.DATASTREAM, "Data stream sent (connID="+connectionID_+") ...", data_, 0, currentOffset_); //@E6A @P0C - } // @E3A - } - - - - // - // Indicate that the buffer can be returned to the pool. In the past, the pooling implementation - // just set inUse_=false to return to the pool. This is provided so that the request buffer can be resized. - // - synchronized void returnToPool() { // @A8A - // Determine the maximum size of the most recent X request. - // Resize the data. - // - int length = DBStorage.DEFAULT_SIZE; - - for (int i = 0 ; i < SEND_HISTORY_SIZE; i++ ) { - if (sendHistory[i] > length) length = sendHistory[i]; - } - // System.out.println("Reclaiming when returning to pool"); - storage_.reclaim(length); - - data_ = null; //Safe, this is assigned during initialize. - - super.returnToPool(); - } - - - - // - // reclaim the storage - // - void reclaim() { - // System.out.println("Start resetting history"); - int defaultSize = DBStorage.DEFAULT_SIZE; - for (int i = 0 ; i < SEND_HISTORY_SIZE; i++ ) { - sendHistory[i] = defaultSize; - } - storage_.reclaim(defaultSize); - // System.out.println("Done resetting history"); - - data_ = null; //Safe, this is assigned during initialize. - - } - -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/DBCSEitherFieldDescription.java b/cvsroot/src/com/ibm/as400/access/DBCSEitherFieldDescription.java deleted file mode 100644 index b553007f9..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBCSEitherFieldDescription.java +++ /dev/null @@ -1,292 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBCSEitherFieldDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.util.Vector; - -/** - *The DBCSEitherFieldDescription class represents the description of the data in a DBCS-either field. - *It allows: - *
            - *
          • The user to describe a DBCS-either field to the RecordFormat object. - *
          • The RecordFormat object to describe a DBCS-either field to the user. - *
          - *Click hereto see an example. -**/ -public class DBCSEitherFieldDescription extends FieldDescription implements VariableLengthFieldDescription, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - // CCSID keyword - String ccsid_ = ""; - // Value specified for the VARLEN keyword - private int variableLength_; - // Is the field a variable length field - private boolean isVariableLength_; - - /** - *Constructs a DBCSEitherFieldDescription object. - **/ - public DBCSEitherFieldDescription() - { - } - - /** - *Constructs a DBCSEitherFieldDescription object. It uses the specified data type and name - *of the field. - *The length of the field will be the length specified on the AS400Text object. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public DBCSEitherFieldDescription(AS400Text dataType, String name) - { - super(dataType, name); - } - - /** - *Constructs a DBCSEitherFieldDescription object. It uses the specified data type, name, - *and DDS name of the field. - *The length of the field will be the length specified on the AS400Text object. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - **/ - public DBCSEitherFieldDescription(AS400Text dataType, String name, String ddsName) - { - super(dataType, name, ddsName); - } - - /** - *Returns the value specified for the CCSID keyword for this field. - *@return The value specified for the CCSID keyword - * for this field. If CCSID was not specified for this field, - * an empty string is returned. - **/ - public String getCCSID() - { - return ccsid_; - } - - - /** - *Returns the DDS description for the field. This is a string containing - *the description of the field as it would be specified in a DDS source file. - *This method is used by AS400File.createDDSSourceFile to specify the field - *in the DDS source file which is used to create the file for the user who - *has passed in a RecordFormat object. - *@return The DDS description of this field properly formatted for entry - *into a DDS source file. - **/ - String[] getDDSDescription() - { - Vector v = new Vector(); - // Name columns (10) - StringBuffer desc = new StringBuffer(ddsName_); - // Blank pad the ddsName to 10 characters. - while(desc.length() < 10) - { - desc.append(" "); - } - // Reference column (1) - if (!refFld_.equals("")) - { - desc.append("R"); - } - else - { - desc.append(" "); - } - // Get length as 5 digit string, right justified -/* StringBuffer len = new StringBuffer(new Integer(length_).toString()); - if (len.length() < 5) - { - int blanksNeeded = 5 - len.length(); - for (short i = 0; i < blanksNeeded; ++i) - { - len.insert(0, " "); - } - } -*/ - String len = String.valueOf(length_); - int numSpaces = 5-len.length(); - for (int i=0; i 0) - { - v.addElement("VARLEN(" + new Integer(variableLength_).toString() + ") "); - } - else - { - v.addElement("VARLEN "); - } - } - if (defaultValue_ != null) - { - v.addElement("DFT('" + defaultValue_.toString() + "') "); - } - //@B0A - else if (isDFTNull_) - { - v.addElement("DFT(*NULL) "); - } - - String[] s = new String[v.size()]; - v.copyInto(s); - return s; - } - - /** - *Returns the value specified for the VARLEN keyword for this field. - *@return The value specified for VARLEN for this field. If VARLEN was not - * specified for this field, 0 is returned. - **/ - public int getVARLEN() - { - return variableLength_; - } - - /** - *Indicates if the field is a variable-length field. - *@return true if the field is a variable-length field; false otherwise. - **/ - public boolean isVariableLength() - { - return isVariableLength_; - } - - /** - *Sets the value for the CCSID keyword for this field. - *@param ccsid The value for the CCSID keyword - * for this field. - **/ - public void setCCSID(String ccsid) - { - if (ccsid == null) - { - throw new NullPointerException("ccsid"); - } - ccsid_ = ccsid; - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400Text dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length of the field based on the data type - length_ = dataType.getByteLength(); - } - - //@B0C - javadoc - /** - *Sets the value for the DFT keyword for this field. - *@param defaultValue The default value for this - * field. The defaultValue cannot be null. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(String defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; //@B0A - isDFTCurrent_ = false; //@B0A - DFTCurrentValue_ = null; //@B0A - } - - //@B0A - /** - *Sets the value for the DFT keyword to be *NULL for this field. - *Calling this method will replace the DFT keyword that was previously - *set on a call to setDFT(). Note: This field - *must also have its ALWNULL keyword set to true to prevent DDS errors. - **/ - public void setDFTNull() - { - isDFTNull_ = true; - defaultValue_ = null; - isDFTCurrent_ = false; - DFTCurrentValue_ = null; - } - - /** - *Sets the value that indicates if the field is a variable-length field. - *@param value true if the field is a variable-length field; false otherwise. - **/ - public void setVariableLength(boolean value) - { - isVariableLength_ = value; - if (!value) - { - variableLength_ = 0; - } - } - - /** - *Sets the value to specify for the VARLEN keyword for this field. - *@param varLen The value to specify for the VARLEN keyword for this field. - *The varLen cannot be less than zero. - **/ - public void setVARLEN(int varLen) - { - if (varLen < 0) - { - throw new ExtendedIllegalArgumentException("varLen (" + String.valueOf(varLen) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - variableLength_ = varLen; - isVariableLength_ = true; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DBCSGraphicFieldDescription.java b/cvsroot/src/com/ibm/as400/access/DBCSGraphicFieldDescription.java deleted file mode 100644 index f54e45528..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBCSGraphicFieldDescription.java +++ /dev/null @@ -1,291 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBCSGraphicFieldDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.util.Vector; - -/** - *The DBCSGraphicFieldDescription class represents the description of the data in a DBCS-graphic field. - *It allows: - *
            - *
          • The user to describe a DBCS-graphic field to the RecordFormat object. - *
          • The RecordFormat object to describe a DBCS-graphic field to the user. - *
          - *Click hereto see an example. -**/ -public class DBCSGraphicFieldDescription extends FieldDescription implements VariableLengthFieldDescription, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - // CCSID keyword - String ccsid_ = ""; - // Value specified for the VARLEN keyword - private int variableLength_; - // Is the field a variable length field - private boolean isVariableLength_; - - /** - *Constructs a DBCSGraphicFieldDescription object. - **/ - public DBCSGraphicFieldDescription() - { - } - - /** - *Constructs a DBCSGraphicFieldDescription object. It uses the specified - *data type and name of the field. - *The length of the field will be the length specified on the AS400Text object. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public DBCSGraphicFieldDescription(AS400Text dataType, String name) - { - super(dataType, name); - } - - /** - *Constructs a DBCSGraphicFieldDescription object. It uses the specified - *data type, name, and DDS name of the field. - *The length of the field will be the length specified on the AS400Text object. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - **/ - public DBCSGraphicFieldDescription(AS400Text dataType, String name, String ddsName) - { - super(dataType, name, ddsName); - } - - /** - *Returns the value specified for the CCSID keyword for this field. - *@return The value specified for the CCSID keyword - * for this field. If CCSID was not specified for this field, - * an empty string is returned. - **/ - public String getCCSID() - { - return ccsid_; - } - - - /** - *Returns the DDS description for the field. This is a string containing - *the description of the field as it would be specified in a DDS source file. - *This method is used by AS400File.createDDSSourceFile to specify the field - *in the DDS source file which is used to create the file for the user who - *has passed in a RecordFormat object. - *@return The DDS description of this field properly formatted for entry - *into a DDS source file. - **/ - String[] getDDSDescription() - { - Vector v = new Vector(); - // Name columns (10) - StringBuffer desc = new StringBuffer(ddsName_); - // Blank pad the ddsName to 10 characters. - while(desc.length() < 10) - { - desc.append(" "); - } - // Reference column (1) - if (!refFld_.equals("")) - { - desc.append("R"); - } - else - { - desc.append(" "); - } - // Get length as 5 digit string, right justified - // Because the byte length of a DBCSGraphicFieldDescription is twice - // the number of characters, we divide by two, since "length" is the - // number of characters. -/* StringBuffer len = new StringBuffer(new Integer(length_/2).toString()); - if (len.length() < 5) - { - int blanksNeeded = 5 - len.length(); - for (short i = 0; i < blanksNeeded; ++i) - { - len.insert(0, " "); - } - } -*/ - String len = String.valueOf(length_); - int numSpaces = 5-len.length(); - for (int i=0; i 0) - { - v.addElement("VARLEN(" + new Integer(variableLength_).toString() + ") "); - } - else - { - v.addElement("VARLEN "); - } - } - if (defaultValue_ != null) - { - v.addElement("DFT('" + defaultValue_.toString() + "') "); - } - //@B0A - else if (isDFTNull_) - { - v.addElement("DFT(*NULL) "); - } - - String[] s = new String[v.size()]; - v.copyInto(s); - return s; - } - - /** - *Returns the value specified for the VARLEN keyword for this field. - *@return The value specified for VARLEN for this field. If VARLEN was not - * specified for this field, 0 is returned. - **/ - public int getVARLEN() - { - return variableLength_; - } - - /** - *Indicates if the field is a variable-length field. - *@return true if the field is a variable-length field; false otherwise. - **/ - public boolean isVariableLength() - { - return isVariableLength_; - } - - /** - *Sets the value for the CCSID keyword for this field. - *@param ccsid The value for the CCSID keyword - * for this field. - **/ - public void setCCSID(String ccsid) - { - if (ccsid == null) - { - throw new NullPointerException("ccsid"); - } - ccsid_ = ccsid; - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400Text dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length of the field based on the data type - length_ = dataType.getByteLength(); - } - - //@B0C - javadoc - /** - *Sets the value for the DFT keyword for this field. - *@param defaultValue The default value for this - * field. The defaultValue cannot be null. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(String defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; //@B0A - isDFTCurrent_ = false; //@B0A - DFTCurrentValue_ = null; //@B0A - } - - //@B0A - /** - *Sets the value for the DFT keyword to be *NULL for this field. - *Calling this method will replace the DFT keyword that was previously - *set on a call to setDFT(). Note: This field - *must also have its ALWNULL keyword set to true to prevent DDS errors. - **/ - public void setDFTNull() - { - isDFTNull_ = true; - defaultValue_ = null; - isDFTCurrent_ = false; - DFTCurrentValue_ = null; - } - - /** - *Sets the value that indicates if the field is a variable-length field. - *@param value The value that indicates if the field is a variable-length field. - If set to true, the field is a variable-length field. - **/ - public void setVariableLength(boolean value) - { - isVariableLength_ = value; - } - - /** - *Sets the value to specify for the VARLEN keyword for this field. - *@param varLen The value to specify for the VARLEN keyword for this field. - *The varLen cannot be less than zero. - **/ - public void setVARLEN(int varLen) - { - if (varLen < 0) - { - throw new ExtendedIllegalArgumentException("varLen (" + String.valueOf(varLen) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - variableLength_ = varLen; - isVariableLength_ = true; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DBCSOnlyFieldDescription.java b/cvsroot/src/com/ibm/as400/access/DBCSOnlyFieldDescription.java deleted file mode 100644 index 47e844826..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBCSOnlyFieldDescription.java +++ /dev/null @@ -1,287 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBCSOnlyFieldDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.util.Vector; - -/** - *The DBCSOnlyFieldDescription class represents the description of the data in a DBCS-only field. - *It allows: - *
            - *
          • The user to describe a DBCS-only field to the RecordFormat object. - *
          • The RecordFormat object to describe a DBCS-only field to the user. - *
          - *Click hereto see an example. -**/ -public class DBCSOnlyFieldDescription extends FieldDescription implements VariableLengthFieldDescription, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - // CCSID keyword - String ccsid_ = ""; - // Value specified for the VARLEN keyword - private int variableLength_; - // Is the field a variable length field - private boolean isVariableLength_; - - /** - *Constructs a DBCSOnlyFieldDescription object. - **/ - public DBCSOnlyFieldDescription() - { - } - - /** - *Constructs a DBCSOnlyFieldDescription object. It uses the specified - *data type and name of the field. - *The length of the field will be the length specified on the AS400Text object. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public DBCSOnlyFieldDescription(AS400Text dataType, String name) - { - super(dataType, name); - } - - /** - *Constructs a DBCSOnlyFieldDescription object. It uses the specified - *data type, name, and DDS name of the field. - *The length of the field will be the length specified on the AS400Text object. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - **/ - public DBCSOnlyFieldDescription(AS400Text dataType, String name, String ddsName) - { - super(dataType, name, ddsName); - } - - /** - *Returns the value specified for the CCSID keyword for this field. - *@return The value specified for the CCSID keyword - * for this field. If CCSID was not specified for this field, - * an empty string is returned. - **/ - public String getCCSID() - { - return ccsid_; - } - - - /** - *Returns the DDS description for the field. This is a string containing - *the description of the field as it would be specified in a DDS source file. - *This method is used by AS400File.createDDSSourceFile to specify the field - *in the DDS source file which is used to create the file for the user who - *has passed in a RecordFormat object. - *@return The DDS description of this field properly formatted for entry - *into a DDS source file. - **/ - String[] getDDSDescription() - { - Vector v = new Vector(); - // Name columns (10) - StringBuffer desc = new StringBuffer(ddsName_); - // Blank pad the ddsName to 10 characters. - while(desc.length() < 10) - { - desc.append(" "); - } - // Reference column (1) - if (!refFld_.equals("")) - { - desc.append("R"); - } - else - { - desc.append(" "); - } - // Get length as 5 digit string, right justified -/* StringBuffer len = new StringBuffer(new Integer(length_).toString()); - if (len.length() < 5) - { - int blanksNeeded = 5 - len.length(); - for (short i = 0; i < blanksNeeded; ++i) - { - len.insert(0, " "); - } - } -*/ - String len = String.valueOf(length_); - int numSpaces = 5-len.length(); - for (int i=0; i 0) - { - v.addElement("VARLEN(" + new Integer(variableLength_).toString() + ") "); - } - else - { - v.addElement("VARLEN "); - } - } - if (defaultValue_ != null) - { - v.addElement("DFT('" + defaultValue_.toString() + "') "); - } - //@B0A - else if (isDFTNull_) - { - v.addElement("DFT(*NULL) "); - } - - String[] s = new String[v.size()]; - v.copyInto(s); - return s; - } - - /** - *Returns the value specified for the VARLEN keyword for this field. - *@return The value specified for VARLEN for this field. If VARLEN was not - * specified for this field, 0 is returned. - **/ - public int getVARLEN() - { - return variableLength_; - } - - /** - *Indicates if the field is a variable-length field. - *@return true if the field is a variable-length field; false otherwise. - **/ - public boolean isVariableLength() - { - return isVariableLength_; - } - - /** - *Sets the value for the CCSID keyword for this field. - *@param ccsid The value for the CCSID keyword - * for this field. - **/ - public void setCCSID(String ccsid) - { - if (ccsid == null) - { - throw new NullPointerException("ccsid"); - } - ccsid_ = ccsid; - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400Text dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length of the field based on the data type - length_ = dataType.getByteLength(); - } - - //@B0C - javadoc - /** - *Sets the value for the DFT keyword for this field. - *@param defaultValue The default value for this - * field. The defaultValue cannot be null. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(String defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; //@B0A - isDFTCurrent_ = false; //@B0A - DFTCurrentValue_ = null; //@B0A - } - - //@B0A - /** - *Sets the value for the DFT keyword to be *NULL for this field. - *Calling this method will replace the DFT keyword that was previously - *set on a call to setDFT(). Note: This field - *must also have its ALWNULL keyword set to true to prevent DDS errors. - **/ - public void setDFTNull() - { - isDFTNull_ = true; - defaultValue_ = null; - isDFTCurrent_ = false; - DFTCurrentValue_ = null; - } - - /** - *Sets the value that indicates if the field is a variable-length field. - *@param value true if the field is a variable-length field; false otherwise. - **/ - public void setVariableLength(boolean value) - { - isVariableLength_ = value; - } - - /** - *Sets the value to specify for the VARLEN keyword for this field. - *@param varLen The value to specify for the VARLEN keyword for this field. - *The varLen cannot be less than zero. - **/ - public void setVARLEN(int varLen) - { - if (varLen < 0) - { - throw new ExtendedIllegalArgumentException("varLen (" + String.valueOf(varLen) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - variableLength_ = varLen; - isVariableLength_ = true; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DBCSOpenFieldDescription.java b/cvsroot/src/com/ibm/as400/access/DBCSOpenFieldDescription.java deleted file mode 100644 index b0e4a5a1c..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBCSOpenFieldDescription.java +++ /dev/null @@ -1,287 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBCSOpenFieldDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.util.Vector; - -/** - *The DBCSOpenFieldDescription class represents the description of the data in a DBCS-open field. - *It allows: - *
            - *
          • The user to describe a DBCS-open field to the RecordFormat object. - *
          • The RecordFormat object to describe a DBCS-open field to the user. - *
          - *Click hereto see an example. -**/ -public class DBCSOpenFieldDescription extends FieldDescription implements VariableLengthFieldDescription, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - // CCSID keyword - String ccsid_ = ""; - // Value specified for the VARLEN keyword - private int variableLength_; - // Is the field a variable length field - private boolean isVariableLength_; - - /** - *Constructs a DBCSOpenFieldDescription object. - **/ - public DBCSOpenFieldDescription() - { - } - - /** - *Constructs a DBCSOpenFieldDescription object. It uses the specified - *data type and name of the field. - *The length of the field will be the length specified on the AS400Text object. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public DBCSOpenFieldDescription(AS400Text dataType, String name) - { - super(dataType, name); - } - - /** - *Constructs a DBCSOpenFieldDescription object. It uses the specified - *data type, name, and DDS name of the field. - *The length of the field will be the length specified on the AS400Text object. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - **/ - public DBCSOpenFieldDescription(AS400Text dataType, String name, String ddsName) - { - super(dataType, name, ddsName); - } - - /** - *Returns the value specified for the CCSID keyword for this field. - *@return The value specified for the CCSID keyword - * for this field. If CCSID was not specified for this field, - * an empty string is returned. - **/ - public String getCCSID() - { - return ccsid_; - } - - /** - *Returns the DDS description for the field. This is a string containing - *the description of the field as it would be specified in a DDS source file. - *This method is used by AS400File.createDDSSourceFile to specify the field - *in the DDS source file which is used to create the file for the user who - *has passed in a RecordFormat object. - *@return The DDS description of this field properly formatted for entry - *into a DDS source file. - **/ - String[] getDDSDescription() - { - Vector v = new Vector(); - // Name columns (10) - StringBuffer desc = new StringBuffer(ddsName_); - // Blank pad the ddsName to 10 characters. - while(desc.length() < 10) - { - desc.append(" "); - } - // Reference column (1) - if (!refFld_.equals("")) - { - desc.append("R"); - } - else - { - desc.append(" "); - } - // Get length as 5 digit string, right justified -/* StringBuffer len = new StringBuffer(new Integer(length_).toString()); - if (len.length() < 5) - { - int blanksNeeded = 5 - len.length(); - for (short i = 0; i < blanksNeeded; ++i) - { - len.insert(0, " "); - } - } -*/ - String len = String.valueOf(length_); - int numSpaces = 5-len.length(); - for (int i=0; i 0) - { - v.addElement("VARLEN(" + new Integer(variableLength_).toString() + ") "); - } - else - { - v.addElement("VARLEN "); - } - } - if (defaultValue_ != null) - { - v.addElement("DFT('" + defaultValue_.toString() + "') "); - } - //@B0A - else if (isDFTNull_) - { - v.addElement("DFT(*NULL) "); - } - - String[] s = new String[v.size()]; - v.copyInto(s); - return s; - } - - /** - *Returns the value specified for the VARLEN keyword for this field. - *@return The value specified for VARLEN for this field. If VARLEN was not - * specified for this field, 0 is returned. - **/ - public int getVARLEN() - { - return variableLength_; - } - - /** - *Indicates if the field is a variable-length field. - *@return true if the field is a variable-length field; false otherwise. - **/ - public boolean isVariableLength() - { - return isVariableLength_; - } - - /** - *Sets the value for the CCSID keyword for this field. - *@param ccsid The value for the CCSID keyword - * for this field. - **/ - public void setCCSID(String ccsid) - { - if (ccsid == null) - { - throw new NullPointerException("ccsid"); - } - ccsid_ = ccsid; - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400Text dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length of the field based on the data type - length_ = dataType.getByteLength(); - } - - //@B0C - javadoc - /** - *Sets the value for the DFT keyword for this field. - *@param defaultValue The default value for this - * field. The defaultValue cannot be null. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(String defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; //@B0A - isDFTCurrent_ = false; //@B0A - DFTCurrentValue_ = null; //@B0A - } - - //@B0A - /** - *Sets the value for the DFT keyword to be *NULL for this field. - *Calling this method will replace the DFT keyword that was previously - *set on a call to setDFT(). Note: This field - *must also have its ALWNULL keyword set to true to prevent DDS errors. - **/ - public void setDFTNull() - { - isDFTNull_ = true; - defaultValue_ = null; - isDFTCurrent_ = false; - DFTCurrentValue_ = null; - } - - /** - *Sets the value to specify if the field is a variable-length field. - *@param value true if the field is a variable-length field; false otherwise. - **/ - public void setVariableLength(boolean value) - { - isVariableLength_ = value; - } - - /** - *Sets the value to specify for the VARLEN keyword for this field. - *@param varLen The value to specify for the VARLEN keyword for this field. - *The varLen cannot be less than zero. - **/ - public void setVARLEN(int varLen) - { - if (varLen < 0) - { - throw new ExtendedIllegalArgumentException("varLen (" + String.valueOf(varLen) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - variableLength_ = varLen; - isVariableLength_ = true; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DBColumnDescriptorsDataFormat.java b/cvsroot/src/com/ibm/as400/access/DBColumnDescriptorsDataFormat.java deleted file mode 100644 index 0bdbf0476..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBColumnDescriptorsDataFormat.java +++ /dev/null @@ -1,190 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBColumnDescriptorsDataFormat.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; -import java.sql.SQLException; - - - -/** -The DBColumnDescriptorsDataFormat describes the -data in the variable length column descriptor. -**/ -class DBColumnDescriptorsDataFormat -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Store these as byte arrays so we can - private byte[] baseColumnName_; - private byte[] baseTableName_; - private byte[] baseTableSchemaName_; - - // Column label is a string because we are given the CCSID in the field if we receive - // a column label from the system. - private String columnLabel_; - private int jobCCSID_; // Fix for JTOpen Bug 4034 - - - /** - Constructs a DBColumnDescriptorsDataFormat object. Use this when overlaying - on a reply datastream. The cached data will be set when overlay() - is called. - **/ - DBColumnDescriptorsDataFormat() - { - } - - // Fix for JTOpen Bug 4034 - /** - Constructs a DBColumnDescriptorsDataFormat object. Use this when overlaying - on a reply datastream. The cached data will be set when overlay() - is called. - @param jobCCSID The ccsid of the server job. - **/ - DBColumnDescriptorsDataFormat(int jobCCSID) - { - jobCCSID_ = jobCCSID; - } - - /** - Positions the overlay structure. This reads the cached data only - when it was not previously set by the constructor. - **/ - void overlay (byte[] rawBytes, int offset, int variableColumnInfoLength) - throws SQLException - { - // Parse through how ever many of the 3900, 3901, 3902, and 3904 there are (can be 0 - // to 4). - - // Make sure variableColumnInfoLength is greater than 0. If it is 0, - // that means the query did not return us variable column information. - while (variableColumnInfoLength > 0) - { - int length = BinaryConverter.byteArrayToInt (rawBytes, offset); - short codePoint = BinaryConverter.byteArrayToShort (rawBytes, offset + 4); - switch (codePoint) - { - case 0x3900: - // base column name - baseColumnName_ = new byte[length-6]; - System.arraycopy(rawBytes, offset + 6, baseColumnName_, 0, length-6); - break; - - case 0x3901: - // base table name - baseTableName_ = new byte[length-6]; - System.arraycopy(rawBytes, offset + 6, baseTableName_, 0, length-6); - break; - - case 0x3902: - // column label (carries its own CCSID, so make it a String, not a byte array) - int ccsid = BinaryConverter.byteArrayToShort (rawBytes, offset + 6); - if(ccsid == -1) // Fix for JTOpen Bug 4034 - CCSID is 65535, use the server job's ccsid - ccsid = jobCCSID_; // Fix for JTOpen Bug 4034 - try - { - columnLabel_ = (ConvTable.getTable(ccsid, null)).byteArrayToString(rawBytes, - offset + 8, - length-8); - } - catch (UnsupportedEncodingException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - break; - - case 0x3904: - // schema name - baseTableSchemaName_ = new byte[length-6]; - System.arraycopy(rawBytes, offset + 6, baseTableSchemaName_, 0, length-6); - break; - } - //Subtract off the length what we took off the datastream. - variableColumnInfoLength = variableColumnInfoLength - length; - //Move the offset to the next code point. - offset = offset + length; - } - } - - - - String getBaseColumnName(ConvTable convTable) - { - //We don't have to be returned a baseColumnName by the system, depending on the query - if (baseColumnName_ != null) - { - return convTable.byteArrayToString (baseColumnName_, 0, baseColumnName_.length); - } - else - return null; - } - - - - String getBaseTableName(ConvTable convTable) - { - //We don't have to be returned a baseTableName by the system, depending on the query - if (baseTableName_ != null) - { - return convTable.byteArrayToString (baseTableName_, 0, baseTableName_.length); - } - else - return null; - } - - - - String getBaseTableSchemaName(ConvTable convTable) - { - //We don't have to be returned a baseTableSchemaName by the system, depending on the query - if (baseTableSchemaName_ != null) - { - return convTable.byteArrayToString (baseTableSchemaName_, 0, - baseTableSchemaName_.length); - } - else - return null; - } - - - - String getColumnLabel(ConvTable convTable) - { - //We don't have to be returned a column label by the system, depending on the query. - //In fact, if the column label is the same as the base column name, we will not be returned - //it. If we get a base column name and not a column label, we can assume that the column - //label is the same as the base column name and return that. - if (columnLabel_ != null) - { - // If we have a column label, we already converted it based on the CCSID provided - // by the database, so don't use the converter the user passed in. - return columnLabel_; - } - // We weren't returned a column label, so try to return the base column name. - //@D9 If a alias is being used, the base column name will be different from the alias name - // We should be returning the alias name - - //@D9D else if (baseColumnName_ != null) - //@D9D { - //@D9D return convTable.byteArrayToString (baseColumnName_, 0, baseColumnName_.length); - //@D9D } - // We weren't returned a column label or a base column name, so return null. - else - return null; - } -} - - diff --git a/cvsroot/src/com/ibm/as400/access/DBConcatenatedRequestDS.java b/cvsroot/src/com/ibm/as400/access/DBConcatenatedRequestDS.java deleted file mode 100644 index 6f4f91751..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBConcatenatedRequestDS.java +++ /dev/null @@ -1,133 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBConcatenatedRequestDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Vector; - - - -/** -The DBConcatenatedRequestDS class represents a datstream -whose contents are the concatenated contents of multiple -DBBaseRequestDS datastreams. -**/ -class DBConcatenatedRequestDS -extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - // Private data. - private int count_; - private int countMinusOne_; - private DBBaseRequestDS[] requests_; - - - -/** -Constructs a DBConcatenatedRequestDS object. - -@param heldRequests A Vector of DBBaseRequestDS objects which have been held. - It is assumed that only the last request will have/need - a corresponding reply. -@param lastRequest The most recent request. -**/ - public DBConcatenatedRequestDS(Vector heldRequests, DBBaseRequestDS lastRequest) - { - count_ = heldRequests.size() + 1; - countMinusOne_ = count_ - 1; - - requests_ = new DBBaseRequestDS[count_]; - heldRequests.copyInto(requests_); - requests_[countMinusOne_] = lastRequest; - } - - - - -/** -Returns the correlation ID. - -@return The correlation ID. -**/ - int getCorrelation() - { - // Since we only need a reply from the last request, then - // we will use its correlation ID. - return requests_[countMinusOne_].getCorrelation(); - } - - - -/** -Sets the correlation ID. - -@param id The correlation ID. -**/ - void setCorrelation(int id) - { - // Since we only need a reply from the last request, then - // we will set its correlation ID. The rest will be 0. - for(int i = 0; i < countMinusOne_; ++i) - requests_[i].setCorrelation(0); - requests_[countMinusOne_].setCorrelation(id); - } - - - -/** -Write the datastream. - -@param out The output stream. - -@exception IOException If an I/O error occurs. -**/ - void write(OutputStream out) throws IOException - { - // I tried just writing the requests in succession to "out" - // but that resulted in separate requests (which is exactly - // what we are trying to avoid here). - // - // This code writes each request to a temporary byte array - // and then sends that byte array all at once. This results - // in a superfluous byte copy which would be nice to avoid. - // In most cases, the size of this byte array will be small, - // since its used mostly for close requests, so it is still - // beneficial. - // - ByteArrayOutputStream concatenated = new ByteArrayOutputStream(); - for(int i = 0; i < countMinusOne_; ++i) //@P1C - Don't mark the last one free yet... - { - synchronized(requests_[i]) { // @A7A - requests_[i].write(concatenated); - requests_[i].returnToPool(); requests_[i]=null; - } - } - requests_[countMinusOne_].write(concatenated); //@P1A - ...the caller will mark it free, we just write it. - - synchronized(out) // @W1a - { // @W1a - out.write(concatenated.toByteArray()); - out.flush(); - } // @W1a - if (Trace.traceOn_) Trace.log(Trace.DATASTREAM, "Data stream sent (connID="+connectionID_+") ...", concatenated.toByteArray()); //@A1A @P0C - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/DBDSPool.java b/cvsroot/src/com/ibm/as400/access/DBDSPool.java deleted file mode 100644 index 3ea0da8bf..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBDSPool.java +++ /dev/null @@ -1,475 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBDSPool.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.ref.SoftReference; - - -// This handles all of the datastream pooling for JDBC. -final class DBDSPool -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - private DBDSPool() {} - - // Request streams. - private static DBSQLRPBDS[] dbsqlrpbdsPool_ = new DBSQLRPBDS[4]; - private static final Object dbsqlrpbdsPoolLock_ = new Object(); //@P1A - - private static DBSQLDescriptorDS[] dbsqldescriptordsPool_ = new DBSQLDescriptorDS[4]; - private static final Object dbsqldescriptordsPoolLock_ = new Object(); //@P1A - - private static DBSQLResultSetDS[] dbsqlresultsetdsPool_ = new DBSQLResultSetDS[4]; - private static final Object dbsqlresultsetdsPoolLock_ = new Object(); //@P1A - - private static DBSQLRequestDS[] dbsqlrequestdsPool_ = new DBSQLRequestDS[4]; - private static final Object dbsqlrequestdsPoolLock_ = new Object(); //@P1A - private static int dbsqlrequestdsPoolHighMark_ = 0; // @A8A - private static int dbsqlrequestdsPoolAllocations_ = 0; - private static int dbsqlrequestdsPoolReclaimThreshold = 1000; - - private static DBNativeDatabaseRequestDS[] dbnativedatabaserequestdsPool_ = new DBNativeDatabaseRequestDS[4]; - private static final Object dbnativedatabaserequestdsPoolLock_ = new Object(); //@P1A - - private static DBReturnObjectInformationRequestDS[] dbreturnobjectinformationrequestdsPool_ = new DBReturnObjectInformationRequestDS[4]; - private static final Object dbreturnobjectinformationrequestdsPoolLock_ = new Object(); //@P1A - - private static DBSQLAttributesDS[] dbsqlattributesdsPool_ = new DBSQLAttributesDS[4]; - private static final Object dbsqlattributesdsPoolLock_ = new Object(); //@P1A - - private static DBXARequestDS[] dbxarequestdsPool_ = new DBXARequestDS[4]; - private static final Object dbxarequestdsPoolLock_ = new Object(); //@P1A - - // Reply streams. - /* private */ - static SoftReference[] dbreplyrequesteddsPool_ = new SoftReference[4]; - private static final Object dbreplyrequesteddsPoolLock_ = new Object(); //@P1A - private static int dbReplyRequestedPoolSearchStart_=0; //@B5A - private static final int DB_REPLY_REQUEST_POOL_SEARCH_RESET = 4096; // @B5A - private static final int DB_REPLY_REQUEST_LOCALITY = 256; - private static int dbReplyRequestedPoolSearchCount_ = 0; // @B5A - private static boolean dbReplyRequestedPoolFull_ = false; - - static final DBStoragePool storagePool_ = new DBStoragePool(); - - - // IMPORTANT: These methods only retrieve free streams from their respective pools. - // It is up to the code using these pools to free up the streams by setting - // their inUse_ flags to false. - static String changeTime="2010/06/14 08:09"; - static boolean noDBReplyPooling = false; - static boolean monitor = false; //@B5A - - static { - String noPoolingProperty = System.getProperty("com.ibm.as400.access.noDBReplyPooling"); - if (noPoolingProperty != null) { - noDBReplyPooling = true; - } - String monitorProperty = System.getProperty("com.ibm.as400.access.DBDSPool.monitor"); //@B5A - if (monitorProperty != null) { - monitor = true; - } - } - - static void returnToDBReplyRequestedPool(int poolIndex) { //@B5A - if (poolIndex >= 0) { - if (dbReplyRequestedPoolFull_) { - dbReplyRequestedPoolFull_ = false; - dbReplyRequestedPoolSearchStart_ = poolIndex; - } else { - if (poolIndex < dbReplyRequestedPoolSearchStart_ && - poolIndex >= (dbReplyRequestedPoolSearchStart_ - DB_REPLY_REQUEST_LOCALITY )) { - dbReplyRequestedPoolSearchStart_ = poolIndex; - } - } - } - } - - public static int getDBReplyRequestedDSPoolSize() { - return dbreplyrequesteddsPool_.length; - } - - static final DBReplyRequestedDS getDBReplyRequestedDS() - { - if (noDBReplyPooling) { - DBReplyRequestedDS unpooledDS = new DBReplyRequestedDS(monitor, -1); //@B5C - unpooledDS.canUse(); - unpooledDS.setInPool(false); // @B5A - return unpooledDS; - } else { - synchronized(dbreplyrequesteddsPoolLock_) //@P1C - { - // This pools is maintained as weak references to - // all the garbage collector to free up as needed. - // DBReplyRequestedDS[] pool = dbreplyrequesteddsPool_; //@P1M - SoftReference[] pool = dbreplyrequesteddsPool_; //@P1M - int max = pool.length; - - // Periodically begin the search for free items at the beginning of the pool @B5A - int searchStart = dbReplyRequestedPoolSearchStart_; - if (dbReplyRequestedPoolFull_) { - searchStart = pool.length; - } - if (dbReplyRequestedPoolSearchCount_ > DB_REPLY_REQUEST_POOL_SEARCH_RESET) { - dbReplyRequestedPoolFull_ = false; - searchStart = 0; - dbReplyRequestedPoolSearchCount_ = 0; - } - dbReplyRequestedPoolSearchCount_++; - - - for (int i=searchStart; i dbsqlrequestdsPoolReclaimThreshold) { - // System.out.println("Running cleanup in getDBSQLRequestDS"); - dbsqlrequestdsPoolAllocations_ = 0; - for (int i = dbsqlrequestdsPoolHighMark_+1; i < max; i++) { - if (pool[i] != null) { - if (( pool[i].inUse_ == false) && pool[i].canUse()) { - pool[i].reclaim(); - pool[i].returnToPool(); - } - } - } - dbsqlrequestdsPoolHighMark_ = 0; - // System.out.println("Finished cleanup in getDBSQLRequestDS"); - } - - for (int i=0; i dbsqlrequestdsPoolHighMark_) dbsqlrequestdsPoolHighMark_ = i; // @A8A - return pool[i]; - } - if (( pool[i].inUse_ == false) && pool[i].canUse()) - { - pool[i].initialize(a,b,c,d); - if (i > dbsqlrequestdsPoolHighMark_) dbsqlrequestdsPoolHighMark_ = i; - return pool[i]; - } - } - // All are in use, so expand the pool. - DBSQLRequestDS[] temp = new DBSQLRequestDS[max*2]; - System.arraycopy(pool, 0, temp, 0, max); - temp[max] = new DBSQLRequestDS(a,b,c,d); - temp[max].canUse(); - dbsqlrequestdsPool_ = temp; - if (max > dbsqlrequestdsPoolHighMark_) dbsqlrequestdsPoolHighMark_ = max; // @A8A - return temp[max]; - } - } - - static final DBSQLResultSetDS getDBSQLResultSetDS(int a, int b, int c, int d) - { - synchronized(dbsqlresultsetdsPoolLock_) //@P1C - { - DBSQLResultSetDS[] pool = dbsqlresultsetdsPool_; //@P1M - int max = pool.length; - for (int i=0; i 0) { - int offsetToDescriptor = getVariableColumnInfoOffset (columnIndex); - DBColumnDescriptorsDataFormat columnDescriptorsDataFormat = new DBColumnDescriptorsDataFormat(); - columnDescriptorsDataFormat.overlay (data_, ((offset_ - 6) + offsetToDescriptor), variableColumnInfoLength); - return columnDescriptorsDataFormat; - } - else - return null; - } - - // Fix for JTOpen Bug 4034 - The CCSID for a column label may be 65535, if that is the case, we want to use the server job's ccsid. - public DBColumnDescriptorsDataFormat getColumnDescriptors (int columnIndex, ConvTable convTable) - throws SQLException - { - // if variable column info length is 0, then no variable length column information - // was returned - int variableColumnInfoLength = getVariableColumnInfoLength(columnIndex); - if (variableColumnInfoLength > 0) { - int offsetToDescriptor = getVariableColumnInfoOffset (columnIndex); - DBColumnDescriptorsDataFormat columnDescriptorsDataFormat = new DBColumnDescriptorsDataFormat(convTable.getCcsid()); - columnDescriptorsDataFormat.overlay (data_, ((offset_ - 6) + offsetToDescriptor), variableColumnInfoLength); - return columnDescriptorsDataFormat; - } - else - return null; - } - - - - private int getExtendedColumnDescriptorOffset (int columnIndex) - { - return(((columnIndex-1) * 16) + 10); //@A1C - } - - - private int getVariableColumnInfoLength (int columnIndex) - { - return BinaryConverter.byteArrayToInt (data_, (offset_ + getExtendedColumnDescriptorOffset (columnIndex) + 8)); - } - - - private int getVariableColumnInfoOffset (int columnIndex) - { - return BinaryConverter.byteArrayToInt (data_, (offset_ + getExtendedColumnDescriptorOffset (columnIndex) + 4)); - } - - - int getNumberOfColumns () - { - return BinaryConverter.byteArrayToInt (data_, offset_); - } - - - byte getSearchable (int columnIndex) - { - return data_[offset_ + getExtendedColumnDescriptorOffset (columnIndex) + 1]; - } - - - byte getUpdateable (int columnIndex) - { - return data_[offset_ + getExtendedColumnDescriptorOffset (columnIndex)]; - } - - -} - - - diff --git a/cvsroot/src/com/ibm/as400/access/DBExtendedData.java b/cvsroot/src/com/ibm/as400/access/DBExtendedData.java deleted file mode 100644 index 6ab9f802b..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBExtendedData.java +++ /dev/null @@ -1,336 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBExtendedData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The DBExtendedData class is an implementation of DBData which -describes the data used in datastreams for V4R4 and later -systems. -**/ -class DBExtendedData -implements DBData -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - // Private data. - private byte[] rawBytes_ = null; - private int offset_ = -1; - private int actualLength_ = -1; // @D0A - private boolean dataCompressed_ = false; // @D0A - private boolean vlfCompressed_ = false; // @K54 - - private int rowCount_ = -1; - private int columnCount_ = -1; - private int indicatorSize_ = -1; - private int rowSize_ = -1; - - private int indicatorOffset_ = -1; - private int dataOffset_ = -1; - private int length_ = -1; - - private int offsetToRowInformationHeader_ = -1; //@K54 - private int offsetToRowInformationArray_ = -1; //@K54 - private int aliasCount_ = 0; //@K3A - - -/** -Constructs a DBExtendedData object. Use this when overlaying -on a reply datastream. The cached data will be set when overlay() -is called. -**/ - public DBExtendedData (int actualLength, boolean dataCompressed) // @D0C - { - actualLength_ = actualLength; // @D0A - dataCompressed_ = dataCompressed; // @D0A - } - - -//@K54 -/** -Constructs a DBExtendedData object. Use this when overlaying -on a reply datastream. The cached data will be set when overlay() -is called. -**/ -public DBExtendedData (int actualLength, boolean dataCompressed, boolean vlfCompressed) -{ - actualLength_ = actualLength; - dataCompressed_ = dataCompressed; - vlfCompressed_ = vlfCompressed; -} - -/** -Constructs a DBExtendedData object. Use this when overlaying -on a request datastream. This sets the cached data so that -the total length can be calculated before calling overlay(). -**/ - public DBExtendedData (int rowCount, - int columnCount, - int indicatorSize, - int rowSize) - throws DBDataStreamException - { - rowCount_ = rowCount; - columnCount_ = columnCount; - indicatorSize_ = indicatorSize; - rowSize_ = rowSize; - - length_ = 20 + rowCount_ * (columnCount_ * indicatorSize_ - + rowSize_); - } - - - -/** -Positions the overlay structure. This reads the cached data only -when it was not previously set by the constructor. -**/ - public void overlay (byte[] rawBytes, int offset) - { - offset_ = offset; - - if (rowCount_ == -1) { - rowCount_ = BinaryConverter.byteArrayToInt (rawBytes, offset_ + 4); - columnCount_ = BinaryConverter.byteArrayToShort (rawBytes, offset_ + 8); - indicatorSize_ = BinaryConverter.byteArrayToShort (rawBytes, offset_ + 10); - rowSize_ = BinaryConverter.byteArrayToInt (rawBytes, offset_ + 16); - length_ = 20 + rowCount_ * (columnCount_ * indicatorSize_ + rowSize_); - - // If the data is compressed, then we need to uncompress it and store // @D0A - // it in a new byte array. Note that only the indicators and data are // @D0A - // compressed. // @D0A - if (dataCompressed_) { // @D0A - length_ = length_ + offset; //@E0A - byte[] decompressedBytes = new byte[length_]; // @D0A - System.arraycopy(rawBytes, 0, decompressedBytes, 0, offset_ + 20); // @D0A //@E0C - JDUtilities.decompress(rawBytes, offset_ + 20, actualLength_ - 26, // @D0A - decompressedBytes, offset_ + 20); // @D0A //@E0C - - rawBytes_ = decompressedBytes; // @D0A - indicatorOffset_ = offset_ + 20; // @D0A //@E0C - } // @D0A - else { // @D0A - rawBytes_ = rawBytes; - indicatorOffset_ = offset_ + 20; - } // @D0A - //If the variable-length fields are compressed, then we need to know where each row starts //@K54 - // Note: only the data is compressed //@K54 - //Format is: - // Consistency Token 4 bytes (will match data format token for returned data, unused on parameter marker data) - // Row count 4 bytes (number of rows being sent. This must be 1 for the open function.) - // Column count 2 bytes (number of columns/parameter markers in 1 row) - // Indicator size 2 bytes (0 if no indicators, otherwise 2) - // Reserved 4 bytes - // Row size 4 bytes (size of 1 row in bytes) - // Indicators x bytes (x = column count * row count * Indicator size) - // *********** above remained unchanged ************* - // Row Information Header: - // Row-Information-Array-Offset 4 bytes - // Number-of-rows-fetched 4 bytes - // - // - // - // Row Information Array: - // Offset-to-row-data(1) 4 bytes - // Offset-to-row-data(2) 4 bytes - // Offset-to-row-data(3) 4 bytes - if(vlfCompressed_){ //@K54 - offsetToRowInformationHeader_ = indicatorOffset_ + (columnCount_ * rowCount_ * indicatorSize_); - //offset is calculated from the offset to Row Information header - offsetToRowInformationArray_ = offsetToRowInformationHeader_ + BinaryConverter.byteArrayToInt(rawBytes, offsetToRowInformationHeader_); - } - } - else { - rawBytes_ = rawBytes; - indicatorOffset_ = offset_ + 20; - - setRowCount (rowCount_); - setColumnCount (columnCount_); - setIndicatorSize (indicatorSize_); - setRowSize (rowSize_); - } - - dataOffset_ = indicatorOffset_ + (rowCount_ * columnCount_ * indicatorSize_); - } - - - - public int getLength () - { - return length_; - } - - - - public int getConsistencyToken () - { - return BinaryConverter.byteArrayToInt (rawBytes_, offset_); - } - - - - public int getRowCount () - { - return rowCount_; - } - - - - public int getColumnCount () - { - return columnCount_; - } - - - - public int getIndicatorSize () - { - return indicatorSize_; - } - - - - public int getRowSize () - { - return rowSize_; - } - - - - public int getIndicator (int rowIndex, int columnIndex) - { - if (indicatorSize_ == 0) - return 0; - else - return BinaryConverter.byteArrayToShort (rawBytes_, - indicatorOffset_ + indicatorSize_ - * ((rowIndex + aliasCount_) * columnCount_ + columnIndex)); //@K3A If aliasCount_ > 0, then DatabaseMetaData.getTables(...) was called and our result data contains aliases. We want to skip the rows that are aliases. - } - - - - public int getRowDataOffset (int rowIndex) - { - //if variable-length fields are comrpessed return row offset - if(vlfCompressed_) //@K54 - { - if((rowIndex >= rowCount_) || rowIndex < 0) //We do not have data for that row. - return -1; - else - return offsetToRowInformationHeader_ + BinaryConverter.byteArrayToInt(rawBytes_, offsetToRowInformationArray_ + (rowIndex*4));//return rowOffset_[rowIndex]; //@K54 - } - else //@K54 - { - return dataOffset_ + ((rowIndex + aliasCount_) * rowSize_); //@K3C If aliasCount_ > 0, then DatabaseMetaData.getTables(...) was called and our result data contains aliases. We want to skip the rows that are aliases. - } - } - - - - public byte[] getRawBytes () - { - return rawBytes_; - } - - - - public void setConsistencyToken (int consistencyToken) - { - BinaryConverter.intToByteArray (consistencyToken, rawBytes_, - offset_); - } - - - - public void setRowCount (int rowCount) - { - BinaryConverter.intToByteArray (rowCount, rawBytes_, - offset_ + 4); - } - - - - public void setColumnCount (int columnCount) - { - BinaryConverter.shortToByteArray ((short) columnCount, rawBytes_, - offset_ + 8); - } - - - - public void setIndicatorSize (int indicatorSize) - { - BinaryConverter.shortToByteArray ((short) indicatorSize, rawBytes_, - offset_ + 10); - } - - - - public void setRowSize (int rowSize) - { - BinaryConverter.intToByteArray (rowSize, rawBytes_, - offset_ + 16); - } - - - - public void setIndicator (int rowIndex, int columnIndex, int indicator) - { - if (indicatorSize_ != 0) - BinaryConverter.shortToByteArray ((short) indicator, - rawBytes_, - indicatorOffset_ + indicatorSize_ - * (rowIndex * columnCount_ + columnIndex)); - } - - - //@K54 - /* - Specifies if variable-length fields are compressed. - @return true if variable-length fields are compressed, false otherwise. - */ - public boolean isVariableFieldsCompressed() - { - return vlfCompressed_; - } - - // Resets the number of rows to the total number of rows minus the number of rows that contain aliases. - // This method is called by AS400JDBCDatabaseMetaData.parseResultData(). - public void resetRowCount(int rowCount){ //@K3A - rowCount_ = rowCount; - } - - // Sets the number of aliases the result data contains. - // This method is called by AS400JDBCDatabaseMetaData.parseResultData(). - public void setAliasCount(int aliases){ //@K3A - aliasCount_ = aliases; - } - - //@array - //Returns indicator - public int getIndicator (int rowIndex, int columnIndex, int arrayIndex){ - return -9999; //valid in DBVariableData - } - - //@array - //returns size footprint of data in column - public int getDataTotalSize (int colIndex){ - return -9999; //valid in DBVariableData - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/DBExtendedDataFormat.java b/cvsroot/src/com/ibm/as400/access/DBExtendedDataFormat.java deleted file mode 100644 index 9779dec5b..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBExtendedDataFormat.java +++ /dev/null @@ -1,365 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBExtendedDataFormat.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; - - - -/** -The DBExtendedDataFormat class is an implementation of -DBDataFormat which describes the data format used in -datastreams for V4R4 and later systems. -**/ -class DBExtendedDataFormat -implements DBDataFormat -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - // Private data. - private static final int FIXED_LENGTH_ = 16; - private static final int REPEATED_LENGTH_ = 64; - - private byte[] rawBytes_ = null; - private int offset_ = -1; - - private int numberOfFields_ = -1; - - private int length_ = -1; - private boolean csRsData_ = false; // @550A indicates whether the data associated with this format is from a stored procedure result set - - - -/** -Constructs a DBExtendedDataFormat object. Use this when overlaying -on a reply datastream. The cached data will be set when overlay() -is called. -**/ - public DBExtendedDataFormat () - { - } - - - -/** -Constructs a DBExtendedDataFormat object. Use this when overlaying -on a request datastream. This sets the cached data so that -the total length can be calculated before calling overlay(). -**/ - public DBExtendedDataFormat (int numberOfFields) - { - numberOfFields_ = numberOfFields; - length_ = FIXED_LENGTH_ + numberOfFields_ * REPEATED_LENGTH_; - } - - - -/** -Positions the overlay structure. This reads the cached data only -when it was not previously set by the constructor. -**/ - public void overlay (byte[] rawBytes, int offset) - { - rawBytes_ = rawBytes; - offset_ = offset; - - if (numberOfFields_ == -1) - { - numberOfFields_ = BinaryConverter.byteArrayToInt (rawBytes_, offset + 4); - length_ = FIXED_LENGTH_ + numberOfFields_ * REPEATED_LENGTH_; - } - else - { - setNumberOfFields (numberOfFields_); - } - } - - - public int getLength () - { - return length_; - } - - - - public int getConsistencyToken () - { - return BinaryConverter.byteArrayToInt (rawBytes_, offset_); - } - - - - public int getNumberOfFields () - { - return numberOfFields_; - } - - - - public int getRecordSize () - { - return BinaryConverter.byteArrayToInt (rawBytes_, offset_ + 12); - } - - - - public int getFieldSQLType (int fieldIndex) - { - return BinaryConverter.byteArrayToShort (rawBytes_, - offset_ + 18 + (fieldIndex * REPEATED_LENGTH_)); - } - - - - public int getFieldLength (int fieldIndex) - { - return BinaryConverter.byteArrayToInt (rawBytes_, - offset_ + 20 + (fieldIndex * REPEATED_LENGTH_)); - } - - - - public int getFieldScale (int fieldIndex) - { - return BinaryConverter.byteArrayToShort (rawBytes_, - offset_ + 24 + (fieldIndex * REPEATED_LENGTH_)); - } - - - - public int getFieldPrecision (int fieldIndex) - { - return BinaryConverter.byteArrayToShort (rawBytes_, - offset_ + 26 + (fieldIndex * REPEATED_LENGTH_)); - } - - - - public int getFieldCCSID (int fieldIndex) - { - return BinaryConverter.byteArrayToUnsignedShort (rawBytes_, //@B0C - offset_ + 28 + (fieldIndex * REPEATED_LENGTH_)); - } - - - - public int getFieldParameterType (int fieldIndex) - { - return rawBytes_[offset_ + 30 + (fieldIndex * REPEATED_LENGTH_)]; - } - - - - public int getFieldLOBLocator (int fieldIndex) // @A1A - { // @A1A - return BinaryConverter.byteArrayToInt (rawBytes_, // @A1A - offset_ + 33 + (fieldIndex * REPEATED_LENGTH_)); // @A1A - } // @A1A - - - public int getFieldLOBMaxSize (int fieldIndex) // @A1A - { // @A1A - return BinaryConverter.byteArrayToInt (rawBytes_, // @A1A - offset_ + 42 + (fieldIndex * REPEATED_LENGTH_)); // @A1A - } // @A1A - - - public int getFieldNameLength (int fieldIndex) - { - return BinaryConverter.byteArrayToShort (rawBytes_, - offset_ + 46 + (fieldIndex * REPEATED_LENGTH_)); - } - - - - public int getFieldNameCCSID (int fieldIndex) - { - return BinaryConverter.byteArrayToShort (rawBytes_, - offset_ + 48 + (fieldIndex * REPEATED_LENGTH_)); - } - - - - public String getFieldName (int fieldIndex, ConvTable converter) //@P0C - { - return converter.byteArrayToString (rawBytes_, - offset_ + 50 + (fieldIndex * REPEATED_LENGTH_), - getFieldNameLength (fieldIndex)); - } - - - - public void setConsistencyToken (int consistencyToken) - { - BinaryConverter.intToByteArray (consistencyToken, rawBytes_, - offset_); - } - - - - public void setNumberOfFields (int numberOfFields) - { - BinaryConverter.intToByteArray (numberOfFields, rawBytes_, - offset_ + 4); - } - - - - public void setRecordSize (int recordSize) - { - BinaryConverter.intToByteArray (recordSize, rawBytes_, - offset_ + 12); - } - - - - public void setFieldDescriptionLength (int fieldIndex) - { - BinaryConverter.shortToByteArray ((short) REPEATED_LENGTH_, - rawBytes_, offset_ + fieldIndex * REPEATED_LENGTH_ + 16); - } - - - - public void setFieldSQLType (int fieldIndex, int sqlType) - { - BinaryConverter.shortToByteArray ((short) sqlType, - rawBytes_, offset_ + fieldIndex * REPEATED_LENGTH_ + 18); - } - - - - public void setFieldLength (int fieldIndex, int length) - { - BinaryConverter.intToByteArray (length, - rawBytes_, offset_ + fieldIndex * REPEATED_LENGTH_ + 20); - } - - - - public void setFieldScale (int fieldIndex, int scale) - { - BinaryConverter.shortToByteArray ((short) scale, - rawBytes_, offset_ + fieldIndex * REPEATED_LENGTH_ + 24); - } - - - - public void setFieldPrecision (int fieldIndex, int precision) - { - BinaryConverter.shortToByteArray ((short) precision, - rawBytes_, offset_ + fieldIndex * REPEATED_LENGTH_ + 26); - } - - - - public void setFieldCCSID (int fieldIndex, int ccsid) - { - BinaryConverter.shortToByteArray ((short) ccsid, - rawBytes_, offset_ + fieldIndex * REPEATED_LENGTH_ + 28); - } - - - - public void setFieldParameterType (int fieldIndex, int parameterType) - { - rawBytes_[offset_ + fieldIndex * REPEATED_LENGTH_ + 30] = (byte) parameterType; - } - - - - public void setFieldNameLength (int fieldIndex, int nameLength) - { - BinaryConverter.shortToByteArray ((short) nameLength, - rawBytes_, offset_ + fieldIndex * REPEATED_LENGTH_ + 46); - } - - - - public void setFieldNameCCSID (int fieldIndex, int nameCCSID) - { - BinaryConverter.shortToByteArray ((short) nameCCSID, - rawBytes_, offset_ + fieldIndex * REPEATED_LENGTH_ + 48); - } - - - - public void setFieldName (int fieldIndex, String name, ConvTable converter) //@P0C - throws DBDataStreamException - { - try - { - converter.stringToByteArray (name, rawBytes_, - offset_ + fieldIndex * REPEATED_LENGTH_ + 50); - } - catch (CharConversionException e) - { - throw new DBDataStreamException (); - } - - // Pad the remaining field with zeros. - int length = name.length (); - int padOffset = offset_ + fieldIndex * REPEATED_LENGTH_ + 50; - for (int i = length; i < 30; i++) - rawBytes_[padOffset + i] = 0; - } - - - // @550A - This isn't included in the Extended Data Stream Format - public int getDateFormat() throws DBDataStreamException { - return -1; - } - - // @550A - This isn't included in the Extended Data Stream Format - public int getTimeFormat() throws DBDataStreamException { - return -1; - } - - // @550A - This isn't included in the Extended Data Stream Format - public int getDateSeparator() throws DBDataStreamException { - return -1; - } - - // @550A - This isn't included in the Extended Data Stream Format - public int getTimeSeparator() throws DBDataStreamException { - return -1; - } - - // @550A - returns whether or not this data is associated with a stored procedure result set - public boolean getCSRSData() - { - return csRsData_; - } - - //@550A - sets whether or not this data is associated with a stored procedure result set - public void setCSRSData(boolean csRsData) - { - csRsData_ = csRsData; - } - - //@xml3 This isn't included in the Extended Data Stream Format - public int getXMLCharType(int fieldIndex) - { - return -1; - } - - //@array - This isn't included in the Extended Data Stream Format - public int getArrayType(int fieldIndex) - { - return -1; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DBLobData.java b/cvsroot/src/com/ibm/as400/access/DBLobData.java deleted file mode 100644 index 2a932faeb..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBLobData.java +++ /dev/null @@ -1,104 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBLobData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The DBLobData class represents the data retrieved using a LOB locator. -**/ -class DBLobData -implements DBOverlay -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - // Private data. - private byte[] rawBytes_ = null; - private int offset_ = -1; - private int actualLength_ = -1; - private boolean dataCompressed_ = false; - private int physicalLength_ = -1; // @A1C - - // Note: The "actual length" is the length of the lob data. The // @A1A - // "physical length" is the number of bytes as they appear // @A1A - // in the datastream. // @A1A - - -/** -Constructs a DBLobData object. Use this when overlaying -on a reply datastream. -**/ - public DBLobData (int actualLength, - int physicalLength, // @A1A - boolean dataCompressed) - { - actualLength_ = actualLength; - physicalLength_ = physicalLength; // @A1A - dataCompressed_ = dataCompressed; - } - - - - public int getOffset() - { - return offset_; - } - - - -/** -Positions the overlay structure. This reads the cached data only -when it was not previously set by the constructor. -**/ - public void overlay (byte[] rawBytes, int offset) - { - offset_ = offset; - - // If the data is compressed, then we need to uncompress it and store - // it in a new byte array. - if (dataCompressed_) { - byte[] decompressedBytes = new byte[actualLength_]; // @A1C - JDUtilities.decompress(rawBytes, offset_, physicalLength_, decompressedBytes, 0); - offset_ = 0; // @A2A - rawBytes_ = decompressedBytes; - } - else { - rawBytes_ = rawBytes; - } - } - - - - public int getLength () - { - return actualLength_; - } - - - - public byte[] getRawBytes () - { - return rawBytes_; - } - - - void adjustForGraphic() // @A3A - { - actualLength_ = actualLength_ * 2; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/DBNativeDatabaseRequestDS.java b/cvsroot/src/com/ibm/as400/access/DBNativeDatabaseRequestDS.java deleted file mode 100644 index 575cb8832..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBNativeDatabaseRequestDS.java +++ /dev/null @@ -1,330 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBNativeDatabaseRequestDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; //@E9a - -/** - Create a Native Data Base (NDB) Request Datastream. -**/ - -class DBNativeDatabaseRequestDS -extends DBBaseRequestDS -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - public static final int FUNCTIONID_ADD_DATABASE_FILE_MBR = 0x1802; - public static final int FUNCTIONID_ADD_LIBRARY_LIST = 0x180C; - public static final int FUNCTIONID_CLEAR_DATABASE_FILE_MBR = 0x1803; - public static final int FUNCTIONID_CLEAR_SAVE_FILE = 0x1808; - public static final int FUNCTIONID_CREATE_DATABASE_FILE = 0x1801; - public static final int FUNCTIONID_CREATE_SAVE_FILE = 0x1807; - public static final int FUNCTIONID_CREATE_SRC_PHYSICAL_FILE = 0x1800; - public static final int FUNCTIONID_DELETE_DATABASE_FILE_MBR = 0x1804; - public static final int FUNCTIONID_DELETE_FILE = 0x1809; - public static final int FUNCTIONID_DELETE_OVERRIDE_DB_FILE = 0x1806; - public static final int FUNCTIONID_OVERRIDE_DATABASE_FILE = 0x1805; - public static final int FUNCTIONID_READ_FROM_SAVE_FILE = 0x180A; - public static final int FUNCTIONID_WRITE_TO_SAVE_FILE = 0x180B; - - -/** - Constructs a datastream for the NDB Server request functions. - @param requestId the 4 digit code that represents the function being called. - @param rpbId the request parameter block id. - @param operationResultsBitmap the bitmap which describes how the results are to be returned. - @param parameterMarkerDescriptorHandle the Parameter marker descriptor handle identifier. -**/ - public DBNativeDatabaseRequestDS(int requestId, - int rpbId, - int operationResultsBitmap, - int parameterMarkerDescriptorHandle) - - { - // Create the datastream header and template - super(requestId, rpbId, operationResultsBitmap, - parameterMarkerDescriptorHandle); - setServerID(SERVER_NDB); - } - - - - //--------------------------------------------------// - // Create the data stream optional / // - // variable length data section via addParameters // - //--------------------------------------------------// - - -/** - Sets the Authority parameter in the data stream. - @param value the public access authority. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setAuthority (String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3808, converter, value); - } - - -/** - Sets the Based File Name parameter in the data stream. - @param value the name of the file from which the file - to created is based. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setBasedFileName (String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x380B, converter, value); - } - - -/** - Sets the Based Library Name parameter in the data stream. - @param value the name of the library where the - based on file is located. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setBasedLibraryName (String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x380C, converter, value); - } - - - -/** - Sets the Copy Based File Data parameter in the data stream. - @param value the value that indicates if the data in the - based on file should be copied into the file just created. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setCopyBasedFileData(int value) - throws DBDataStreamException - { - addParameter (0x3811, (byte)value); - } - - -/** - Sets the File Description parameter in the data stream. - @param value the description of the file. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFileDescription (String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3809, converter, value); - } - - - -/** - Sets the File Name parameter in the data stream. - @param value the name of the file. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFileName (String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3802, converter, value); - } - - - -/** - Sets the Library Name parameter in the data stream. - @param value the name of the library. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setLibraryName (String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3801, converter, value); - } - - - -/** - Sets the List of Libraries parameter in the data stream. - @param indicators the list of indicators that describe - where to add the libraries to the list. - @param libraries the list of libraries to add to - the job's library list. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setListOfLibraries (char[] indicators, - String[] libraries, - ConvTable converter) //@P0C - throws DBDataStreamException - { - addParameter (0x3813, converter, indicators, libraries); - } - - - -/** - Sets the Maxmimum Number of Members parameter to the data stream. - @param value the values that indicates the maximum - number of members the created source physical file can have. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setMaxNumberOfMembers (int value) - throws DBDataStreamException - { - addParameter (0x3807, (short) value); - } - - - -/** - Sets the Member Description parameter in the data stream. - @param value the description of the member. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setMemberDescription (String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x380A, converter, value); - } - - - -/** - Sets the Member Name parameter in the data stream. - @param value the name of the member. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setMemberName (String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3803, converter, value); - } - - - -/** - Sets the Override File Name parameter in the data stream. - @param value the name of the file to be overridden. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setOverrideFileName (String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x380D, converter, value); - } - - - -/** - Sets the Override Library Name parameter in the data stream. - @param value the name of the library where the overriden - file is located. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setOverrideLibraryName (String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x380E, converter, value); - } - - - -/** - Sets the Override Member Name parameter in the data stream. - @param value the name of the overridden member. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setOverrideMemberName (String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x380F, converter, value); - } - - - -/** - Sets the Record Length parameter in the data stream. - @param value the record length. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setRecordLength (int value) - throws DBDataStreamException - { - addParameter (0x3806, (short) value); - } - - - -/** - Sets the Save File Data parameter in the data stream. - @param value the data that is to be written to the - specified save file. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setSaveFileData (String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3812, converter, value); - } - - - -/** - Sets the Save File Description parameter in the data stream. - @param value the description of the save file. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setSaveFileDescription (String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3810, converter, value); - } - - - -/** - Sets the Translate Indicator parameter in the data stream. - @param value the value that indicates if the data in the - operational result set generated by the function should be translated - to the client's CCSID before the data is returned. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setTranslateIndicator (int value) - throws DBDataStreamException - { - addParameter (0x3805, (byte) value); - } - - -} - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/DBOriginalData.java b/cvsroot/src/com/ibm/as400/access/DBOriginalData.java deleted file mode 100644 index d72955754..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBOriginalData.java +++ /dev/null @@ -1,282 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBOriginalData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The DBOriginalData class is an implementation of DBData which -describes the data used in datastreams for V4R3 and previous -systems. -**/ -class DBOriginalData -implements DBData -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - // Private data. - private byte[] rawBytes_ = null; - private int offset_ = -1; - private int actualLength_ = -1; // @D0A - private boolean dataCompressed_ = false; // @D0A - - private int rowCount_ = -1; - private int columnCount_ = -1; - private int indicatorSize_ = -1; - private int rowSize_ = -1; - - private int indicatorOffset_ = -1; - private int dataOffset_ = -1; - private int length_ = -1; - - private int aliasCount_ = 0; //@K3A - - - -/** -Constructs a DBOriginalData object. Use this when overlaying -on a reply datastream. The cached data will be set when overlay() -is called. -**/ - public DBOriginalData (int actualLength, boolean dataCompressed) // @D0C - { - actualLength_ = actualLength; // @D0A - dataCompressed_ = dataCompressed; // @D0A - } - - - -/** -Constructs a DBOriginalData object. Use this when overlaying -on a request datastream. This sets the cached data so that -the total length can be calculated before calling overlay(). -**/ - public DBOriginalData (int rowCount, - int columnCount, - int indicatorSize, - int rowSize) - throws DBDataStreamException - { - rowCount_ = rowCount; - columnCount_ = columnCount; - indicatorSize_ = indicatorSize; - rowSize_ = rowSize; - - length_ = 14 + rowCount_ * (columnCount_ * indicatorSize_ - + rowSize_); - } - - - -/** -Positions the overlay structure. This reads the cached data only -when it was not previously set by the constructor. -**/ - public void overlay (byte[] rawBytes, int offset) - { - offset_ = offset; - - if (rowCount_ == -1) { - rowCount_ = BinaryConverter.byteArrayToInt (rawBytes, offset_ + 4); - columnCount_ = BinaryConverter.byteArrayToShort (rawBytes, offset_ + 8); - indicatorSize_ = BinaryConverter.byteArrayToShort (rawBytes, offset_ + 10); - rowSize_ = BinaryConverter.byteArrayToShort (rawBytes, offset_ + 12); - length_ = 14 + rowCount_ * (columnCount_ * indicatorSize_ + rowSize_); - - // If the data is compressed, then we need to uncompress it and store // @D0A - // it in a new byte array. Note that only the indicators and data are // @D0A - // compressed. // @D0A - if (dataCompressed_) { // @D0A - byte[] decompressedBytes = new byte[length_]; // @D0A - System.arraycopy(rawBytes, offset_, decompressedBytes, 0, 14); // @D0A - JDUtilities.decompress(rawBytes, offset_ + 14, actualLength_ - 20, // @D0A - decompressedBytes, 14); // @D0A - - rawBytes_ = decompressedBytes; // @D0A - indicatorOffset_ = 14; // @D0A - } // @D0A - else { // @D0A - rawBytes_ = rawBytes; - indicatorOffset_ = offset_ + 14; - } // @D0A - } - else { - rawBytes_ = rawBytes; - indicatorOffset_ = offset_ + 14; - - setRowCount (rowCount_); - setColumnCount (columnCount_); - setIndicatorSize (indicatorSize_); - setRowSize (rowSize_); - } - - dataOffset_ = indicatorOffset_ + (rowCount_ * columnCount_ * indicatorSize_); - } - - - - public int getLength () - { - return length_; - } - - - - public int getConsistencyToken () - { - return BinaryConverter.byteArrayToInt (rawBytes_, offset_); - } - - - - public int getRowCount () - { - return rowCount_; - } - - - - public int getColumnCount () - { - return columnCount_; - } - - - - public int getIndicatorSize () - { - return indicatorSize_; - } - - - - public int getRowSize () - { - return rowSize_; - } - - - - public int getIndicator (int rowIndex, int columnIndex) - { - if (indicatorSize_ == 0) - return 0; - else - return BinaryConverter.byteArrayToShort (rawBytes_, - indicatorOffset_ + indicatorSize_ - * ((rowIndex+aliasCount_) * columnCount_ + columnIndex)); //@K3C If aliasCount_ > 0, then DatabaseMetaData.getTables(...) was called and our result data contains aliases. We want to skip the rows that are aliases. - } - - - - public int getRowDataOffset (int rowIndex) - { - return dataOffset_ + ((rowIndex+aliasCount_) * rowSize_); //@K3C If aliasCount_ > 0, then DatabaseMetaData.getTables(...) was called and our result data contains aliases. We want to skip the rows that are aliases. - } - - - - public byte[] getRawBytes () - { - return rawBytes_; - } - - - - public void setConsistencyToken (int consistencyToken) - { - BinaryConverter.intToByteArray (consistencyToken, rawBytes_, - offset_); - } - - - - public void setRowCount (int rowCount) - { - BinaryConverter.intToByteArray (rowCount, rawBytes_, - offset_ + 4); - } - - - - public void setColumnCount (int columnCount) - { - BinaryConverter.shortToByteArray ((short) columnCount, rawBytes_, - offset_ + 8); - } - - - - public void setIndicatorSize (int indicatorSize) - { - BinaryConverter.shortToByteArray ((short) indicatorSize, rawBytes_, - offset_ + 10); - } - - - - public void setRowSize (int rowSize) - { - BinaryConverter.shortToByteArray ((short) rowSize, rawBytes_, - offset_ + 12); - } - - - - public void setIndicator (int rowIndex, int columnIndex, int indicator) - { - if (indicatorSize_ != 0) - BinaryConverter.shortToByteArray ((short) indicator, - rawBytes_, - indicatorOffset_ + indicatorSize_ - * (rowIndex * columnCount_ + columnIndex)); - } - - - //This will always return false, because variable-length field compression only applies - //to information returned in a result set for V5R3 and later systems. This class only - //applies to V4R3 and previous systems. - public boolean isVariableFieldsCompressed(){ //@K54 - return false; - } - - // Resets the number of rows to the total number of rows minus the number of rows that contain aliases if DatabaseMetaData.getTables(...) was called. - // This method is called by AS400JDBCDatabaseMetaData.parseResultData(). - public void resetRowCount(int rowCount) //@K3A - { - rowCount_ = rowCount; - } - - // Sets the number of aliases the result data contains if DatabaseMetaData.getTables(...) was called. - // This method is called by AS400JDBCDatabaseMetaData.parseResultData(). - public void setAliasCount(int aliasCount) //@K3A - { - aliasCount_ = aliasCount; - } - - //@array - //Returns indicator - public int getIndicator (int rowIndex, int columnIndex, int arrayIndex){ - return -9999; //valid in DBVariableData - } - - //@array - //returns size footprint of data in column - public int getDataTotalSize (int colIndex){ - return -9999; //valid in DBVariableData - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/DBOriginalDataFormat.java b/cvsroot/src/com/ibm/as400/access/DBOriginalDataFormat.java deleted file mode 100644 index c227a614b..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBOriginalDataFormat.java +++ /dev/null @@ -1,359 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBOriginalDataFormat.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; - - - -/** -The DBOriginalDataFormat class is an implementation of -DBDataFormat which describes the data format used in -datastreams for V4R3 and previous systems. -**/ -class DBOriginalDataFormat -implements DBDataFormat -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - // Private data. - private static final int REPEATED_LENGTH_ = 54; - - private byte[] rawBytes_ = null; - private int offset_ = -1; - - private int numberOfFields_ = -1; - - private int length_ = -1; - - private boolean csRsData_ = false; // @550A Indicates if the data associated with this format is from a stored procedure result set. - - - -/** -Constructs a DBOriginalDataFormat object. Use this when overlaying -on a reply datastream. The cached data will be set when overlay() -is called. -**/ - public DBOriginalDataFormat () - { } - - - -/** -Constructs a DBOriginalDataFormat object. Use this when overlaying -on a request datastream. This sets the cached data so that -the total length can be calculated before calling overlay(). -**/ - public DBOriginalDataFormat (int numberOfFields) - { - numberOfFields_ = numberOfFields; - length_ = 8 + numberOfFields_ * REPEATED_LENGTH_; - } - - - -/** -Positions the overlay structure. This reads the cached data only -when it was not previously set by the constructor. -**/ - public void overlay (byte[] rawBytes, int offset) - { - rawBytes_ = rawBytes; - offset_ = offset; - - if (numberOfFields_ == -1) { - numberOfFields_ = BinaryConverter.byteArrayToShort (rawBytes_, offset + 4); - length_ = 8 + numberOfFields_ * REPEATED_LENGTH_; - } - else { - setNumberOfFields (numberOfFields_); - } - } - - - - public int getLength () - { - return length_; - } - - - - public int getConsistencyToken () - { - return BinaryConverter.byteArrayToInt (rawBytes_, offset_); - } - - - - public int getNumberOfFields () - { - return numberOfFields_; - } - - - - public int getRecordSize () - { - return BinaryConverter.byteArrayToShort (rawBytes_, offset_ + 6); - } - - - - public int getFieldSQLType (int fieldIndex) - { - return BinaryConverter.byteArrayToShort (rawBytes_, - offset_ + 10 + (fieldIndex * REPEATED_LENGTH_)); - } - - - - public int getFieldLength (int fieldIndex) - { - return BinaryConverter.byteArrayToShort (rawBytes_, - offset_ + 12 + (fieldIndex * REPEATED_LENGTH_)); - } - - - - public int getFieldScale (int fieldIndex) - { - return BinaryConverter.byteArrayToShort (rawBytes_, - offset_ + 14 + (fieldIndex * REPEATED_LENGTH_)); - } - - - - public int getFieldPrecision (int fieldIndex) - { - return BinaryConverter.byteArrayToShort (rawBytes_, - offset_ + 16 + (fieldIndex * REPEATED_LENGTH_)); - } - - - - public int getFieldCCSID (int fieldIndex) - { - return BinaryConverter.byteArrayToUnsignedShort (rawBytes_, //@D0C - offset_ + 18 + (fieldIndex * REPEATED_LENGTH_)); - } - - - - public int getFieldParameterType (int fieldIndex) - { - return rawBytes_[offset_ + 20 + (fieldIndex * REPEATED_LENGTH_)]; - } - - - public int getFieldLOBLocator (int fieldIndex) // @C1A - { // @C1A - return -1; // @C1A - } - - - public int getFieldLOBMaxSize (int fieldIndex) // @C1A - { // @C1A - return -1; // @C1A - } - - - public int getFieldNameLength (int fieldIndex) - { - return BinaryConverter.byteArrayToShort (rawBytes_, - offset_ + 28 + (fieldIndex * REPEATED_LENGTH_)); - } - - - - public int getFieldNameCCSID (int fieldIndex) - { - return BinaryConverter.byteArrayToShort (rawBytes_, - offset_ + 30 + (fieldIndex * REPEATED_LENGTH_)); - } - - - - public String getFieldName (int fieldIndex, ConvTable converter) //@P0C - { - return converter.byteArrayToString (rawBytes_, - offset_ + 32 + (fieldIndex * REPEATED_LENGTH_), - getFieldNameLength (fieldIndex)); - } - - - - public void setConsistencyToken (int consistencyToken) - { - BinaryConverter.intToByteArray (consistencyToken, rawBytes_, - offset_); - } - - - - public void setNumberOfFields (int numberOfFields) - { - BinaryConverter.shortToByteArray ((short) numberOfFields, rawBytes_, - offset_ + 4); - } - - - - public void setRecordSize (int recordSize) - { - BinaryConverter.shortToByteArray ((short) recordSize, rawBytes_, - offset_ + 6); - } - - - - public void setFieldDescriptionLength (int fieldIndex) - { - BinaryConverter.shortToByteArray ((short) REPEATED_LENGTH_, - rawBytes_, offset_ + fieldIndex * REPEATED_LENGTH_ + 8); - } - - - - public void setFieldSQLType (int fieldIndex, int sqlType) - { - BinaryConverter.shortToByteArray ((short) sqlType, - rawBytes_, offset_ + fieldIndex * REPEATED_LENGTH_ + 10); - } - - - - public void setFieldLength (int fieldIndex, int length) - { - BinaryConverter.shortToByteArray ((short) length, - rawBytes_, offset_ + fieldIndex * REPEATED_LENGTH_ + 12); - } - - - - public void setFieldScale (int fieldIndex, int scale) - { - BinaryConverter.shortToByteArray ((short) scale, - rawBytes_, offset_ + fieldIndex * REPEATED_LENGTH_ + 14); - } - - - - public void setFieldPrecision (int fieldIndex, int precision) - { - BinaryConverter.shortToByteArray ((short) precision, - rawBytes_, offset_ + fieldIndex * REPEATED_LENGTH_ + 16); - } - - - - public void setFieldCCSID (int fieldIndex, int ccsid) - { - BinaryConverter.shortToByteArray ((short) ccsid, - rawBytes_, offset_ + fieldIndex * REPEATED_LENGTH_ + 18); - } - - - - public void setFieldParameterType (int fieldIndex, int parameterType) - { - rawBytes_[offset_ + fieldIndex * REPEATED_LENGTH_ + 20] = (byte) parameterType; - } - - - - public void setFieldNameLength (int fieldIndex, int nameLength) - { - BinaryConverter.shortToByteArray ((short) nameLength, - rawBytes_, offset_ + fieldIndex * REPEATED_LENGTH_ + 28); - } - - - - public void setFieldNameCCSID (int fieldIndex, int nameCCSID) - { - BinaryConverter.shortToByteArray ((short) nameCCSID, - rawBytes_, offset_ + fieldIndex * REPEATED_LENGTH_ + 30); - } - - - - public void setFieldName (int fieldIndex, String name, ConvTable converter) //@P0C - throws DBDataStreamException - { - try { - converter.stringToByteArray (name, rawBytes_, - offset_ + fieldIndex * REPEATED_LENGTH_ + 32); - } - catch (CharConversionException e) { - throw new DBDataStreamException (); - } - - // Pad the remaining field with zeros. - int length = name.length (); - int padOffset = offset_ + fieldIndex * REPEATED_LENGTH_ + 32; - for (int i = length; i < 30; i++) - rawBytes_[padOffset + i] = 0; - } - - - // @550A - This isn't included in the Original Data Stream Format - public int getDateFormat() throws DBDataStreamException { - return -1; - } - - // @550A - This isn't included in the Original Data Stream Format - public int getTimeFormat() throws DBDataStreamException { - return -1; - } - - // @550A - This isn't included in the Original Data Stream Format - public int getDateSeparator() throws DBDataStreamException { - return -1; - } - - // @550A - This isn't included in the Original Data Stream Format - public int getTimeSeparator() throws DBDataStreamException { - return -1; - } - - // @550A - returns whether or not this data is associated with a stored procedure result set - public boolean getCSRSData() - { - return csRsData_; - } - - //@550A - sets whether or not this data is associated with a stored procedure result set - public void setCSRSData(boolean csRsData) - { - csRsData_ = csRsData; - } - - //@xml3 This isn't included in the Extended Data Stream Format - public int getXMLCharType(int fieldIndex) - { - return -1; - } - - //@array - This isn't included in the Original Data Stream Format - public int getArrayType(int fieldIndex) - { - return -1; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/DBOverlay.java b/cvsroot/src/com/ibm/as400/access/DBOverlay.java deleted file mode 100644 index 5393011be..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBOverlay.java +++ /dev/null @@ -1,51 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBOverlay.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The DBOverlay interface describes a structure that lays on top of -an existing byte array. An implementation will set the bytes according -to some structure. - -

          The main point to this interface is to reduce the number of -intermediate byte array creations and copies by allowing structures -to set a given byte array directly. -**/ -interface DBOverlay -{ - - - -/** -Positions the overlay structure. - -@param rawBytes The byte array to overlay. -@param offset The starting offset. -**/ - public abstract void overlay (byte[] rawBytes, int offset); - - - -/** -Returns the length of the overlay structure. - -@return The length of the overlay structure. -**/ - public abstract int getLength (); - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/DBReplyPackageInfo.java b/cvsroot/src/com/ibm/as400/access/DBReplyPackageInfo.java deleted file mode 100644 index bb3420e24..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBReplyPackageInfo.java +++ /dev/null @@ -1,214 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBReplyPackageInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; -import java.io.UnsupportedEncodingException; //@F1A - - - -/** - Provides access to the package info portion of the reply data stream. -**/ -class DBReplyPackageInfo { - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - private byte[] data_; - private int offset_; - private int length_; - private int jobCCSID_; // @D1A - - - /** - Constructs a new DBReplyPackageInfo object. It initializes - the variables using the data provided. - **/ - public DBReplyPackageInfo (byte[] data, - int offset, - int length, - int jobCCSID) // @D1A - { - data_ = data; - offset_ = offset; - length_ = length; - jobCCSID_ = jobCCSID; // @D1A - } - - - - //--------------------------------------------------------- - // The following structure is used to determine the amount - // needed to be added to the offset to get the appropriate - // data. - // - // offset+ field length - // - // 0 total length 4 bytes - // 4 ccsid 2 bytes - // 6 default collection 18 bytes - // 24 statement count 2 bytes - // 26 reserved 16 bytes - // - // 42 package entry info (repeated for each field) - // 0 statement needs default collection 1 byte - // 1 statement type 2 bytes - // 3 statement name 18 bytes - // 21 reserved 19 bytes - // 40 format offset 4 bytes - // 44 format length 4 bytes - // 48 text offset 4 bytes - // 52 text length 4 bytes - // 56 parameter marker format offset 4 bytes - // 60 parameter marker format length 4 bytes - // - // Note: these offsets are in terms of the start - // of the LL for this parameter (i.e. - // actually count from (offset_ - 6). - // - // x package statement text and formats - // - //--------------------------------------------------------- - - - - public DBDataFormat getDataFormat (int statementIndex) - throws DBDataStreamException - { - int offset = BinaryConverter.byteArrayToInt (data_, offset_ + getPackageEntryInfoOffset (statementIndex) + 40); - int length = BinaryConverter.byteArrayToInt (data_, offset_ + getPackageEntryInfoOffset (statementIndex) + 44); - if ((length != 6) && (length != 0)) { // @C0C - DBDataFormat dataFormat = new DBSQLDADataFormat(jobCCSID_); // @D1C - dataFormat.overlay (data_, (offset_ - 6) + offset); - return dataFormat; - } - else - return null; - } - - - - public String getDefaultCollection (ConvTable converter) //@P0C - throws DBDataStreamException - { - return converter.byteArrayToString (data_, offset_ + 6, 18); - } - - - - public int getCCSID () - throws DBDataStreamException - { - return BinaryConverter.byteArrayToShort (data_, offset_ + 4); - } - - - - private int getPackageEntryInfoOffset (int statementIndex) - { - return 42 + 64 * (statementIndex); - } - - - - public DBDataFormat getParameterMarkerFormat (int statementIndex) - throws DBDataStreamException - { - int offset = BinaryConverter.byteArrayToInt (data_, offset_ + getPackageEntryInfoOffset (statementIndex) + 56); - int length = BinaryConverter.byteArrayToInt (data_, offset_ + getPackageEntryInfoOffset (statementIndex) + 60); - if ((length != 6) && (length != 0)) { // @C0C - DBDataFormat parameterMarkerFormat = new DBSQLDADataFormat(jobCCSID_); // @D1C - parameterMarkerFormat.overlay (data_, (offset_ - 6) + offset); - return parameterMarkerFormat; - } - else - return null; - } - - - - public int getStatementCount () - throws DBDataStreamException - { - return BinaryConverter.byteArrayToShort (data_, offset_ + 24); - } - - - - public String getStatementName (int statementIndex, ConvTable converter) //@P0C - throws DBDataStreamException - { - try //@F1A - { - //@F1A Should use job CCSID, not unicode, to interpret statement name from datastream. - return ConvTable.getTable(jobCCSID_, null).byteArrayToString (data_, offset_ + getPackageEntryInfoOffset (statementIndex) + 3, 18); //@F1A - //@F1D return converter.byteArrayToString (data_, offset_ + getPackageEntryInfoOffset (statementIndex) + 3, 18); - //@F1A Changed code in JDPackageManager to now pass in null for converter. - } - catch (UnsupportedEncodingException uee) //@F1A - { - //@F1A Error shouldn't happen, but just in case, return "" so that - //@F1A code in AS400JDBCStatement which checks the length of what is - //@F1A returned from here to see if it's 0 will correctly detect that - //@F1A we are unable to use this name and will prepare the statement - //@F1A again on the system instead of taking a NullPointerException. - return ""; //@F1A - } - } - - - - public int getStatementNeedsDefaultCollection (int statementIndex) - throws DBDataStreamException - { - return data_[offset_ + getPackageEntryInfoOffset (statementIndex)]; - } - - - - public String getStatementText (int statementIndex, ConvTable converter) //@P0C - throws DBDataStreamException - { - int offset = BinaryConverter.byteArrayToInt (data_, offset_ + getPackageEntryInfoOffset (statementIndex) + 48); - int length = BinaryConverter.byteArrayToInt (data_, offset_ + getPackageEntryInfoOffset (statementIndex) + 52); - return converter.byteArrayToString (data_, (offset_ - 6) + offset, length); - } - - - - public int getStatementTextLength (int statementIndex) - throws DBDataStreamException - { - return BinaryConverter.byteArrayToInt (data_, offset_ + getPackageEntryInfoOffset (statementIndex) + 52); - } - - - - public int getStatementType (int statementIndex) - throws DBDataStreamException - { - return BinaryConverter.byteArrayToShort (data_, offset_ + getPackageEntryInfoOffset (statementIndex) + 1); - } - - - - public int getTotalLength () - throws DBDataStreamException - { - return BinaryConverter.byteArrayToInt (data_, offset_); - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/DBReplyRequestedDS.java b/cvsroot/src/com/ibm/as400/access/DBReplyRequestedDS.java deleted file mode 100644 index 0fdb73756..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBReplyRequestedDS.java +++ /dev/null @@ -1,103 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBReplyRequestedDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.PrintWriter; -import java.io.StringBufferInputStream; -import java.io.StringWriter; - - - -/** - * Creates requested reply data streams. -**/ -final class DBReplyRequestedDS extends DBBaseReplyDS -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - private static long firstUsed = 0; // @B5A - long lastUsed = 0; // @B5A - Exception allocatedLocation = null; // @B5A - int poolIndex = -1; // @B5A - - - public DBReplyRequestedDS(boolean setAllocatedLocation, int poolIndex) - { - super(); - if (setAllocatedLocation) { - setAllocatedLocation(); - } /*@B5A*/ - this.poolIndex = poolIndex; /*@B5A*/ - } - - - final public int hashCode() - { - return 0x2800; - } - - - /** - * Returns a DBReplyRequestedDS - **/ - final public Object getNewDataStream() - { - //@P0D return new DBReplyRequestedDS (); - return DBDSPool.getDBReplyRequestedDS(); //@P0A - } - - void setAllocatedLocation() { - if (firstUsed == 0) { - firstUsed = System.currentTimeMillis(); - } - lastUsed = System.currentTimeMillis() - firstUsed; - allocatedLocation = new Exception("location"); - storage_.setAllocatedLocation(); - - - }/* @B5A*/ - - String getAllocatedLocation() { - if (allocatedLocation == null) { - return "NONE"; - } else { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - allocatedLocation.printStackTrace(pw); - String result = sw.toString(); - result.replace('\n', ' '); - return "Used at "+lastUsed+" "+result; - } - } /*@B5A*/ - - void returnToPool() { - if (poolIndex >= 0) { - DBDSPool.returnToDBReplyRequestedPool(poolIndex); - } - super.returnToPool(); - } /*@B5A*/ - - -// void setPoolIndex(int poolIndex) { -// if (DBDSPool.monitor) { -// System.out.println("Using pool at index "+poolIndex); -// } -// this.poolIndex = poolIndex; -// allocatedLocation = null; -// } - -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/DBReplySQLCA.java b/cvsroot/src/com/ibm/as400/access/DBReplySQLCA.java deleted file mode 100644 index 2736ee1f8..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBReplySQLCA.java +++ /dev/null @@ -1,204 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBReplySQLCA.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; -import java.math.BigDecimal; //@F3A - - - - -/** - Provides access to the SQLCA portion of the reply - data stream. -**/ -class DBReplySQLCA -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - private byte[] data_; - private int offset_; - private int length_; - // Add 96 to offset_ for Errd1, 100 to offset_ for Errd2, etc. - private static final int[] locationFromOffset_ = {96, 100, 104, 108, 112}; //@F1A @F4C - - - - public DBReplySQLCA (byte[] data, - int offset, - int length) - { - data_ = data; - offset_ = offset; - length_ = length; - } - - - - //@F1A Combined getErrd1, getErrd2, getErrd3, getErrd4 methods - final public int getErrd (int requestedErrd) throws DBDataStreamException - { - if (length_ <= 6) - return 0; - - return BinaryConverter.byteArrayToInt (data_, - offset_ + locationFromOffset_[requestedErrd-1]); - } - - - - // @E4A - //@F1D final public int getErrd1 () throws DBDataStreamException // @E4A - //@F1D { // @E4A - //@F1D if (length_ <= 6) // @E4A - //@F1D return 0; // @E4A - //@F1D // @E4A - //@F1D return BinaryConverter.byteArrayToInt (data_, offset_ + 96); // @E4A - //@F1D } // @E4A - - - - //@F1D final public int getErrd2 () throws DBDataStreamException - //@F1D { - //@F1D if (length_ <= 6) // @D1A - //@F1D return 0; // @D1A - //@F1D - //@F1D return BinaryConverter.byteArrayToInt (data_, offset_ + 100); - //@F1D } - - - - //@F1D final public int getErrd3 () throws DBDataStreamException - //@F1D { - //@F1D if (length_ <= 6) // @D1A - //@F1D return 0; // @D1A - //@F1D - //@F1D return BinaryConverter.byteArrayToInt (data_, offset_ + 104); - //@F1D } - - - - //@F1D final public int getErrd4 () throws DBDataStreamException // @E6A - //@F1D { // @E6A - //@F1D if (length_ <= 6) // @E6A - //@F1D return 0; // @E6A - //@F1D // @E6A - //@F1D return BinaryConverter.byteArrayToInt (data_, offset_ + 108); // @E6A - //@F1D } // @E6A - - - - // @E3A - final public String getErrmc(ConvTable converter) throws DBDataStreamException // @E3A @P0C - { // @E3A - if (length_ <= 6) // @E3A - return ""; // @E3A - short errml = BinaryConverter.byteArrayToShort(data_, offset_ + 16); // @E3A - return converter.byteArrayToString(data_, offset_ + 18, errml); // @E3A - } // @E3A - - - - // @E5A - final public String getErrmc(int substitutionVariable, // @E5A - ConvTable converter) throws DBDataStreamException // @E5A @P0C - { // @E5A - if (length_ <= 6) // @E5A - return ""; // @E5A - short errml = BinaryConverter.byteArrayToShort(data_, offset_ + 16); // @E5A - int currentVariable = 1; // @E5A - int i = offset_ + 18; // @E5A - int j = 0; // @E5A - short currentLength; // @E5A - while ((currentVariable < substitutionVariable) && (j < errml)) { // @E5A - ++currentVariable; // @E5A - currentLength = (short)(BinaryConverter.byteArrayToShort(data_, i) + 2); // @E5A - i += currentLength; // @E5A - j += currentLength; // @E5A - } // @E5A - currentLength = BinaryConverter.byteArrayToShort(data_, i); // @E5A - return converter.byteArrayToString(data_, i+2, currentLength); // @E5A - } // @E5A - - - - // @E2A - final public boolean getEyecatcherBit54() throws DBDataStreamException // @E2A - { // @E2A - if (length_ <= 6) // @E2A - return false; // @E2A - // It is actually 6 of Byte 6. // @E2A - byte b = data_[offset_ + 6]; // @E2A - return((b & (byte)0x02) > 0); // @E2A - } // @E2A - - - // @F2A Added method for auto-generated key support. - // - // ONLY call this method after checking if sqlState != 0 because otherwise the error - // message will be in this space. - // - // Note: Although we check the length above in getErrmc, we do not have in this method - // because the auto-generated key will ALWAYS be in bytes 55 through 70 even if the length - // in SQLERRML reports a length other than 70. This is bytes 72 through 87 from our offset. - // - // We shouldn't need a "throws DBDataStreamException" because we are not handling - // SIGNAL 443 cases here. - final public BigDecimal getGeneratedKey() //@P0C @F3C - { - AS400PackedDecimal typeConverter = new AS400PackedDecimal (30, 0); //@F3A - try //@F3A - { //@F3A - return((BigDecimal) typeConverter.toObject (data_, offset_ + 72)); //@F3A - } //@F3A - catch (NumberFormatException nfe) //@F3A - { //@F3A - //If we got a bad number back from the database, don't return it //@F3A - //to the user //@F3A - return null; //@F3A - } //@F3A - //@F3D return converter.byteArrayToString(data_, offset_ + 72, 16); - } - - - // Return SQLCODE from sqlca - final public int getSQLCode () throws DBDataStreamException //@PDA - { - return BinaryConverter.byteArrayToInt (data_, offset_ + 12); - } - - // Returns the SQLState - // It needs to run thru EbcdicToAscii since it is a string - final public String getSQLState (ConvTable converter) throws DBDataStreamException //@P0C - { - if (length_ <= 6) - return null; - - return converter.byteArrayToString (data_, offset_ + 131, 5); - } - - - - final public byte getWarn5() throws DBDataStreamException // @E1A - { // @E1A - if (length_ <= 6) // @E1A - return 0; // @E1A - return data_[offset_ + 124]; // @E1A - } // @E1A - - - -} // End of DBReplySQLCA class - - diff --git a/cvsroot/src/com/ibm/as400/access/DBReplyServerAttributes.java b/cvsroot/src/com/ibm/as400/access/DBReplyServerAttributes.java deleted file mode 100644 index 6ac086df1..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBReplyServerAttributes.java +++ /dev/null @@ -1,193 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBReplyServerAttributes.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** - Provides access to the Server Attributes portion of the - reply data stream. -**/ -class DBReplyServerAttributes -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - private byte[] data_; - private int offset_; - private int length_; - - - - public DBReplyServerAttributes (byte[] data, - int offset, - int length) - throws DBDataStreamException - { - data_ = data; - offset_ = offset; - length_ = length; - } - - - - final public int getCommitmentControlLevelPO () throws DBDataStreamException - { - return BinaryConverter.byteArrayToShort (data_, offset_ + 14); - } - - - - final public int getDateFormatPO () throws DBDataStreamException - { - return BinaryConverter.byteArrayToShort (data_, offset_); - } - - - final public int getDateSeparatorPO () throws DBDataStreamException - { - return BinaryConverter.byteArrayToShort (data_, offset_ + 2); // @D1c (used to be "offset_ + 14") - } - - - final public int getDecimalSeparatorPO () throws DBDataStreamException - { - return BinaryConverter.byteArrayToShort (data_, offset_ + 8); - } - - - - final public String getDefaultSQLLibraryName (ConvTable converter) throws DBDataStreamException //@P0C - { - return converter.byteArrayToString (data_, offset_ + 78, 10); - } - - - //@128sch - /* method for retrieving default SQL schema of lengh up to 128 */ - //adding this method now eventhough it is not called anywhere yet. (same as getDefaultSQLLibraryName) - final public String getDefaultSQLSchemaName (ConvTable converter) throws DBDataStreamException - { - int schemaLen = BinaryConverter.byteArrayToShort (data_, offset_ + 114); //orig doc says bin(15), but should be bin(16)? - return converter.byteArrayToString (data_, offset_ + 116, schemaLen); - } - - - - final public int getDRDAPackageSize () throws DBDataStreamException - { - return BinaryConverter.byteArrayToShort (data_, offset_ + 16); - } - - - - final public int getIgnoreDecimalDataErrorPO () throws DBDataStreamException - { - return BinaryConverter.byteArrayToShort (data_, offset_ + 12); - } - - - - final public String getLanguageFeatureCode (ConvTable converter) throws DBDataStreamException //@P0C - { - return converter.byteArrayToString (data_, offset_ + 46, 4); - } - - - - final public int getNamingConvetionPO () throws DBDataStreamException - { - return BinaryConverter.byteArrayToShort (data_, offset_ + 10); - } - - - - final public String getRelationalDBName (ConvTable converter) throws DBDataStreamException //@P0C - { - return converter.byteArrayToString (data_, offset_ + 60, 18); - } - - - - final public int getServerCCSID () throws DBDataStreamException - { - return BinaryConverter.byteArrayToUnsignedShort (data_, offset_ + 19); //@P1C - } - - - - final public String getServerFunctionalLevel (ConvTable converter) throws DBDataStreamException //@P0C - { - return converter.byteArrayToString (data_, offset_ + 50, 10); - } - - - - final public String getServerJobIdentifier(ConvTable converter) throws DBDataStreamException // @E1A @P0C - { // @E1A - return converter.byteArrayToString(data_, offset_ + 88, 26); // @E1A - } // @E1A - - - - final public String getServerLanguageId (ConvTable converter) throws DBDataStreamException //@P0C - { - return converter.byteArrayToString (data_, offset_ + 23, 3); - } - - - - final public String getServerLanguageTable (ConvTable converter) throws DBDataStreamException //@P0C - { - return converter.byteArrayToString (data_, offset_ + 26, 10); - } - - - - final public String getServerLanguageTableLibrary (ConvTable converter) //@P0C - { - return converter.byteArrayToString (data_, offset_ + 36, 10); - } - - - final public int getServerNLSSValue () throws DBDataStreamException - { - return BinaryConverter.byteArrayToShort (data_, offset_ + 21); - } - - - - final public int getTimeFormatPO () throws DBDataStreamException - { - return BinaryConverter.byteArrayToShort (data_, offset_ + 4); - } - - - - final public int getTimeSeparatorPO () throws DBDataStreamException - { - return BinaryConverter.byteArrayToShort (data_, offset_ + 6); - } - - - - final public int getTranslationIndicator () - { - return data_[offset_ + 18]; - } - - - } - diff --git a/cvsroot/src/com/ibm/as400/access/DBReplyXids.java b/cvsroot/src/com/ibm/as400/access/DBReplyXids.java deleted file mode 100644 index 6d788888e..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBReplyXids.java +++ /dev/null @@ -1,71 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBReplyXids.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The DBReplyXids class provides access to the Xids portion -of the reply data stream. -**/ -class DBReplyXids -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - private byte[] data_; - private int offset_; - private int length_; - - private AS400JDBCXid[] xidArray_; - - - - public DBReplyXids(byte[] data, - int offset, - int length) - { - data_ = data; - offset_ = offset; - length_ = length; - } - - - - public AS400JDBCXid[] getXidArray() - throws DBDataStreamException - { - if (xidArray_ == null) { - - // @A1D if (length_ <= 6) - // @A1D xidArray_ = new AS400JDBCXid[0]; - // @A1D else { - int count = BinaryConverter.byteArrayToInt(data_, offset_ + 6); - xidArray_ = new AS400JDBCXid[count]; - for (int i = 0; i < count; ++i) - { - xidArray_[i] = new AS400JDBCXid(data_, offset_ + 14 + i * 140); // @A1C - } - // @A1D } - - } - return xidArray_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/access/DBReturnObjectInformationRequestDS.java b/cvsroot/src/com/ibm/as400/access/DBReturnObjectInformationRequestDS.java deleted file mode 100644 index ebbe08bd3..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBReturnObjectInformationRequestDS.java +++ /dev/null @@ -1,736 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBReturnObjectInformationRequestDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; //@E9a - - -/** - Create a Return Object Information (ROI) Request Datastream -**/ - -class DBReturnObjectInformationRequestDS -extends DBBaseRequestDS -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - public static final int FUNCTIONID_FIELD_INFO = 0x1807; - public static final int FUNCTIONID_FILE_INFO = 0x1804; - public static final int FUNCTIONID_FILE_MBR_INFO = 0x1805; - public static final int FUNCTIONID_FOREIGN_KEY_INFO = 0x1809; - public static final int FUNCTIONID_INDEX_INFO = 0x1808; - public static final int FUNCTIONID_PACKAGE_INFO = 0x1802; - public static final int FUNCTIONID_PACKAGE_STATEMENT_INFO = 0x1803; - public static final int FUNCTIONID_PRIMARY_KEY_INFO = 0x180A; - public static final int FUNCTIONID_RECORD_FORMAT_INFO = 0x1806; - public static final int FUNCTIONID_RETRIEVE_LIBRARY_INFO = 0x1800; - public static final int FUNCTIONID_RETRIEVE_RELATIONAL_DB_INFO = 0x1801; - public static final int FUNCTIONID_SPECIAL_COLUMN_INFO = 0x180B; - public static final int FUNCTIONID_USER_PROFILE_INFO = 0x180C; - - -/** - Constructs a datastream for the ROI Server functions. - @param requestId the 4 digit code that represents the function being called. - @param rpbId the request parameter block id. - @param operationResultsBitmap the bitmap which describes how the results are to be returned. - @param parameterMarkerDescriptorHandle the Parameter marker descriptor handle identifier. -**/ - public DBReturnObjectInformationRequestDS(int requestId, - int rpbId, - int operationResultsBitmap, - int parameterMarkerDescriptorHandle) - - { - // Create the data stream header and template - super(requestId, rpbId, operationResultsBitmap, - parameterMarkerDescriptorHandle); - setServerID(SERVER_ROI); - } - - - //--------------------------------------------------// - // Create the data stream optional / // - // variable length data section via addParameters // - //--------------------------------------------------// - - -/** - Sets the Field Information Order By Indicator parameter in the data stream. - @param value the value that indicates how the returned rows - will be ordered - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFieldInformationOrderByIndicator(int value) - throws DBDataStreamException - { - addParameter (0x382E, (short)value); - } - - - -/** - Sets the Field Name parameter in the data stream. - @param value the name of the field. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFieldName(String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x380C, converter, value); - } - - - -/** - Sets the Field Name Search Pattern Indicator parameter in the data stream. - @param value the value used to indicate if search pattern - and escape character checking should be done on the field. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFieldNameSearchPatternIndicator(int value) - throws DBDataStreamException - { - addParameter (0x381B, (byte)value); - } - - - -/** - Sets the Field Information to Return bitmap parameter in the data stream. - @param value the value used to determine what field - information the client wants returned. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFieldReturnInfoBitmap(int value) - throws DBDataStreamException - { - addParameter (0x3824, value); - } - - - -/** - Sets the File Attribute parameter in the data stream. - @param value the file types to obtain information about. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFileAttribute(int value) - throws DBDataStreamException - { - addParameter (0x3809, (short)value); - } - - - -/** - Sets the File Info Order By Indicator parameter in the data stream. - @param value the value used to determine how the rows - will be ordered. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFileInfoOrderByIndicator(int value) - throws DBDataStreamException - { - addParameter (0x382D, (short)value); - } - - - -/** - Sets the File Name parameter in the data stream. - @param value the name of the file. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFileName(String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3802, converter, value); - } - - - -/** - Sets the File Name Search Pattern Indicator parameter in the data stream. - @param value the value used to indicate if search pattern - and escape character checking should be done on the file name. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFileNameSearchPatternIndicator(int value) - throws DBDataStreamException - { - addParameter (0x3817, (byte)value); - } - - - -/** - Sets the File Owner Name parameter in the data stream. - @param value the name of the file owner. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFileOwnerName(String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3808, converter, value); - } - - - -/** - Sets the File Owner Name Search Pattern Indicator parameter in the data stream. - @param value the value used to indicate if search pattern - and escape character checking should be done on the file owner name. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFileOwnerNameSearchPatternIndicator(int value) - throws DBDataStreamException - { - addParameter (0x3818, (byte)value); - } - - - -/** - Sets the File Information to Return Bitmap parameter in the data stream. - @param value the value used to determine what file - information the client wants returned. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFileReturnInfoBitmap(int value) - throws DBDataStreamException - { - addParameter (0x3821, value); - } - - - -/** - Sets the File Short / long Name Indicator parameter in the data stream. - @param value the value used to determine if the file name - specified is to be used as a short or long file name. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFileShortOrLongNameIndicator(int value) - throws DBDataStreamException - { - addParameter (0x382A, (byte)value); - } - - - -/** - Sets the Foreign Key File Library Name parameter in the data stream. - @param value the name of the library which contains - the foreign key file. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setForeignKeyFileLibraryName(String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3811, converter, value); - } - - - -/** - Sets the Foreign Key File Name parameter in the data stream. - @param value the name of the foreign key file. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setForeignKeyFileName(String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3813, converter, value); - } - - - -/** - Sets the Foreign Key File Owner parameter in the data stream. - @param value the name of the foreign key file owner. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setForeignKeyFileOwner(String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3812, converter, value); - } - - - -/** - Sets the Foreign Keys Information to Return bitmap parameter in the data stream. - @param value the value used to determine what foreign key - information the client wants returned. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setForeignKeyReturnInfoBitmap(int value) - throws DBDataStreamException - { - addParameter (0x3826, value); - } - - - -/** - Sets the Format Name parameter in the data stream. - @param value the name of the file records. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFormatName(String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x380B, converter, value); - } - - - -/** - Sets the Format Name Search Pattern Indicator parameter in the data stream. - @param value the value used to indicate if search pattern - and escape character checking should be done on the format name. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFormatNameSearchPatternIndicator(int value) - throws DBDataStreamException - { - addParameter (0x381A, (byte)value); - } - - - -/** - Sets the Record Format Information to Return Bitmap parameter in the data stream. - @param value the value used to determine what record format - information the client wants returned. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFormatReturnInfoBitmap(int value) - throws DBDataStreamException - { - addParameter (0x3823, value); - } - - - -/** - Sets the Index Information to Return Bitmap parameter in the data stream. - @param value the value used to determine what index - information the client wants returned. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setIndexReturnInfoBitmap(int value) - throws DBDataStreamException - { - addParameter (0x3825, value); - } - - - -/** - Sets the Index Unique Rule parameter to the data stream. - @param value the index rule to follow. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setIndexUniqueRule(int value) - throws DBDataStreamException - { - addParameter (0x380D, (short)value); - } - - - -/** - Sets the library name parameter in the data stream. - @param value the name of the library. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setLibraryName(String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3801, converter, value); - } - - - -/** - Sets the Library Name Search Pattern Indicator parameter in the data stream. - @param value the value used to indicate if search pattern - and escape character checking should be done on the library name. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setLibraryNameSearchPatternIndicator(int value) - throws DBDataStreamException - { - addParameter (0x3816, (byte)value); - } - - - -/** - Sets the Library Information to Return Bitmap parameter in the data stream. - @param value the value used to determine what library - information the client wants returned. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setLibraryReturnInfoBitmap(int value) - throws DBDataStreamException - { - addParameter (0x381D, value); - } - - - -/** - Sets the Member Name parameter in the data stream. - @param value the name of the member. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - - void setMemberName(String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3803, converter, value); - } - - - -/** - Sets the Member Name Search Pattern Indicator parameter in the data stream. - @param value the value used to indicate if search pattern - and escape character checking should be done on the member name. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setMemberNameSearchPatternIndicator(int value) - throws DBDataStreamException - { - addParameter (0x3819, (byte)value); - } - - - -/** - Sets the Member Information to Return bitmap parameter in the data stream. - @param value the value used to determine what member - information the client wants returned. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setMemberReturnInfoBitmap(int value) - throws DBDataStreamException - { - addParameter (0x3822, value); - } - - - -/** - Sets the Package Name parameter in the data stream. - @param value the name of the package. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setPackageName(String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3804, converter, value); - } - - - -/** - Sets the Package Name Search Pattern Indicator parameter in the data stream. - @param value the value used to indicate if search pattern - and escape character checking should be done on the package name. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setPackageNameSearchPatternIndicator(int value) - throws DBDataStreamException - { - addParameter (0x382C, (byte)value); - } - - - -/** - Sets the Package Information to Return bitmap parameter in the data stream. - @param value the value used to determine what package - information the client wants returned. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setPackageReturnInfoBitmap(int value) - throws DBDataStreamException - { - addParameter (0x381F, value); - } - - - -/** - Sets the Package Statement Type parameter in the data stream. - @param value the type of package statement to obtain - information about. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setPackageStatementType(int value) - throws DBDataStreamException - { - addParameter (0x3807, (short)value); - } - - - -/** - Sets the Physical File Type parameter in the data stream. - @param value the type of physical file to obtain - information about. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setPhysicalFileType(int value) - throws DBDataStreamException - { - addParameter (0x380A, (short)value); - } - - - -/** - Sets the Primary Key File Library Name parameter in the data stream. - @param value the library which contains the primary key - file. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setPrimaryKeyFileLibraryName(String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x380E, converter, value); - } - - - -/** - Sets the Primary Key File Name parameter in the data stream. - @param value the name of the primary key file. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setPrimaryKeyFileName(String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3810, converter, value); - } - - - -/** - Sets the Primary Key File Owner parameter in the data stream. - @param value the name of the primary key file owner. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setPrimaryKeyFileOwner(String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x380F, converter, value); - } - - - -/** - Sets the Primary Keys Information to Return bitmap parameter in the data stream. - @param value the value used to determine what primary key - information the client wants returned. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setPrimaryKeyReturnInfoBitmap(int value) - throws DBDataStreamException - { - addParameter (0x3827, value); - } - - - -/** - Sets the Relational Database Name parameter in the data stream. - @param value the name of the relational database. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setRelationalDatabaseName(String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3806, converter, value); - } - - - -/** - Sets the Relational Database Name Search Pattern Indicator parameter in the data stream. - @param value the value used to indicate if search pattern - and escape character checking should be done on the relational - database. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setRelationalDatabaseNameSearchPatternIndicator(int value) - throws DBDataStreamException - { - addParameter (0x382B, (byte)value); - } - - - -/** - Sets the Relational Database Information to Return bitmap parameter in the data stream. - @param value the value used to determine what relation database - information the client wants returned. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setRealtionalDatabaseReturnInfoBitmap(int value) - throws DBDataStreamException - { - addParameter (0x381E, value); - } - - - -/** - Sets the Special Columns Nullable Indicator parameter in the data stream. - @param value the value which indicates if columns or - nullable or not. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setSpecialColumnsNullableIndicator(int value) - throws DBDataStreamException - { - addParameter (0x3814, (byte)value); - } - - - -/** - Sets the Special Columns Information to Return bitmap parameter in the data stream. - @param value the value used to determine what special columns - information the client wants returned. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setSpecialColumnsReturnInfoBitmap(int value) - throws DBDataStreamException - { - addParameter (0x3828, value); - } - - - -/** - Sets the Statement Information to Return bitmap parameter in the data stream. - @param value the value used to determine what statement - information the client wants returned. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setStatementReturnInfoBitmap(int value) - throws DBDataStreamException - { - addParameter (0x3820, value); - } - - - -/** - Sets the Statement Text Length To Return parameter in the data stream. - @param value the length of the statement text to be - returned to the client. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setStatementTextLengthToReturn(int value) - throws DBDataStreamException - { - addParameter (0x382F, (short)value); - } - - - -/** - Sets the Translate Indicator parameter in the data stream. - @param value the value that indicates if the data in the - operational result set generated by this function should be - translated to the client's CCSID before the data is returned. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setTranslateIndicator(int value) - throws DBDataStreamException - { - addParameter (0x3805, (byte)value); - } - - - -/** - Sets the User Profile Name parameter in the data stream. - @param value the name of the user profile. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setUserProfileName(String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3815, converter, value); - } - - - -/** - Sets the User Profile Name Search Pattern Indicator parameter in the data stream. - @param value the value used to indicate if search pattern - and escape character checking should be done on the user profile. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setUserProfileNameSearchPatternIndicator(int value) - throws DBDataStreamException - { - addParameter (0x381C, (byte)value); - } - - - -/** - Sets the User Profile Information to Return bitmap parameter in the data stream. - @param value the value used to determine what user profile - information the client wants returned. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setUserProfileReturnInfoBitmap(int value) - throws DBDataStreamException - { - addParameter (0x3829, value); - } - - - -} // End of DBReturnObjectInformationRequestDS class - - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/DBSQLAttributesDS.java b/cvsroot/src/com/ibm/as400/access/DBSQLAttributesDS.java deleted file mode 100644 index 758e07775..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBSQLAttributesDS.java +++ /dev/null @@ -1,592 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBSQLAttributesDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; //@E9a -import java.io.UnsupportedEncodingException; //@H1A - -/** - Create an SQL Attribute data stream -**/ - -class DBSQLAttributesDS -extends DBBaseRequestDS -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - public static final int FUNCTIONID_RETRIEVE_ATTRIBUTES = 0x1F81; - public static final int FUNCTIONID_SET_ATTRIBUTES = 0x1F80; - - /** - Constructs a datastream for the SQL Server Attribute functions. - @param requestId the 4 digit code that represents the function being called. - @param rpbId the request parameter block id. - @param operationResultsBitmap the bitmap which describes how the results are to be returned. - @param basedOnORSHandle the based on operational results set. - @param parameterMarkerDescriptorHandle the Parameter marker descriptor handle identifier. - **/ - - public DBSQLAttributesDS(int requestId, - int rpbId, - int operationResultsBitmap, - //@P0D int basedOnORSHandle, // This isn't used - int parameterMarkerDescriptorHandle) - - { - // Create the datastream header and template - super(requestId, rpbId, operationResultsBitmap, - parameterMarkerDescriptorHandle); - setServerID(SERVER_SQL); - } - - //--------------------------------------------------// - // Create the data stream optional / // - // variable length data section via addParameters // - //--------------------------------------------------// - - /** - Sets the Ambiguous Select Option parameter in the data stream. - @param value the value that indicates how SQL SELECT - statements which do not have explicit FOR FETCH ONLY or FOR - UPDATE OF clauses specified should be treated with regard to - updatability. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setAmbiguousSelectOption(int value) - throws DBDataStreamException - { - addParameter(0x3811, (short)value); - } - - /** - Sets the ASCII CCSID for Translation Table parameter in the data stream. - @param value the ASCII CCSID for the translation table. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - - void setASCIICCSIDForTranslationTable(int value) - throws DBDataStreamException - { - addParameter(0x3810, (short)value); - } - - void setAutoCommit(int value) // @E1A //@KBC uncommented the code - throws DBDataStreamException // @E1A //@KBC - { // @E1A //@KBC - addParameter(0x3824, (byte)value); // @E1A //@KBC - } // @E1A //@KBC - - //@KBL - //Sets whether or not input locators should be allocated as type hold. - void setInputLocatorType(int value) //@KBL - throws DBDataStreamException //@KBL - { //@KBL - addParameter(0x3829, (byte)value); //@KBL - } - - //@KBL - //Sets whether or not locators should be scoped to the transaction or to the cursor. - void setLocatorPersistence(int value) //@KBL - throws DBDataStreamException //@KBL - { //@KBL - addParameter(0x3830, (short)value); //@KBL - } - - /** - Sets the Client CCSID parameter in the data stream. - @param value the value to be used to set the default - client CCSID. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setClientCCSID(int value) - throws DBDataStreamException - { - addParameter(0x3801, (short)value); - } - - // @E2C - /** - Sets the Client Functional Level parameter in the data stream. - @param value the client functional level. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - - void setClientFunctionalLevel(String value) // @E2C - throws DBDataStreamException - { - try //@H1A - { - //@H1D There is no need to use a Converter for this value @E2A - //@H1D since it is always numeric. @E2A - //@H1A Need to use Converter now since this is not all numeric any more. - addParameter(0x3803, ConvTable.getTable(37, null), value, true); // @E2C @H1C - } - catch(SQLException se) //@H1A - { - //@H1A - //only throws an SQL exception if bytes.length when converted > //@H1A - //65535, which they will never be in this case //@H1A - } //@H1A - catch(UnsupportedEncodingException e) //@H1A - { - //@H1A - //37 will always be supported //@H1A - } //@H1A - } - - /** - Sets the Commitment Control Level Parser Option parameter in the data stream. - @param value the commitment control level. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setCommitmentControlLevelParserOption(int value) - throws DBDataStreamException - { - addParameter(0x380E, (short)value); - } - - // @D0A - void setDataCompressionOption(int value) - throws DBDataStreamException - { - addParameter(0x3823, (short)value); - } - - /** - Sets the Date Format Parser Option parameter in the data stream. - @param value the date format. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setDateFormatParserOption(int value) - throws DBDataStreamException - { - addParameter(0x3807, (short)value); - } - - /** - Sets the Date Separator Parser Option parameter in the data stream. - @param value the date separator. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setDateSeparatorParserOption(int value) - throws DBDataStreamException - { - addParameter(0x3808, (short)value); - } - - /** - Sets the Decimal Separator Parser Option parameter in the data stream. - @param value the decimal separator. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setDecimalSeparatorParserOption(int value) - throws DBDataStreamException - { - addParameter(0x380B, (short)value); - } - - //@DFA 550 decfloat rounding - /** - Sets the decfloat rounding mode for this connection. - **/ - void setDecfloatRoundingMode(short value) - throws DBDataStreamException, SQLException - { - addParameter(0x3835, value); - } - - - /** - Sets the Default SQL Library Name parameter in the data stream. - @param value the qualified library name to use on the - SQL statement text when no library name is specified in the - statement text. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setDefaultSQLLibraryName(String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter(0x380F, converter, value); - } - - /** - Sets the DRDA Package Size parameter in the data stream. - @param value the DRDA package size. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setDRDAPackageSize(int value) - throws DBDataStreamException, SQLException // @E9c - { - addParameter(0x3806, (short)value); - } - - /** - Sets the Ignore Decimal Data Error Parser Option parameter in the data stream. - @param value the value that indicates if decimal data - errors are to be ignored or not. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setIgnoreDecimalDataErrorParserOption(int value) - throws DBDataStreamException - { - addParameter(0x380D, (short)value); - } - - // @E2C - /** - Sets the Language Feature Code parameter in the data stream. - @param value the language feature code. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setLanguageFeatureCode(String value) // @E2C - throws DBDataStreamException - { - // There is no need to use a Converter for this value @E2A - // since it is always numeric. @E2A - addParameter(0x3802, value); // @E2C - } - - /** - Sets the LOB Field Threshold parameter in the data stream. - @param value the LOB field threshold. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setLOBFieldThreshold(int value) - throws DBDataStreamException - { - addParameter(0x3822, value); - } - - /** - Sets the Naming Convention Parser Option parameter in the data stream. - @param value the naming convention to be used. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setNamingConventionParserOption(int value) - throws DBDataStreamException - { - addParameter(0x380C, (short)value); - } - - /** - Sets the NLSS indentifier in the data stream. - @param type the NLSS type. - @param tableFile the name of the language table. - @param tableLibrary the name of the library containing - the language table. - @param languageId the language id of the NLSS table to use. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setNLSSortSequence(int type, - String tableFile, - String tableLibrary, - String languageId, - ConvTable converter) //@P0C - throws DBDataStreamException - { - addParameter(0x3804, converter, type, tableFile, tableLibrary, languageId); - } - - /** - Sets the Package Add Statement Allowed parameter in the data stream. - @param value the value that indicates whether SQL statements - should be added to the package, if one is in use. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setPackageAddStatementAllowed(int value) - throws DBDataStreamException - { - addParameter(0x3812, (short)value); - } - - /** - Set the optimization goal that should be used for queries. - @param value the optimization goal - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setQueryOptimizeGoal(int value) // @540 - throws DBDataStreamException // @540 - { // @540 - addParameter(0x3833, (byte)value); // @540 - } // @540 - - /** - Set the query storage limit that should be used for queries. - @param value the storage limit - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setQueryStorageLimit(int value) //@550 - throws DBDataStreamException //@550 - { //@550 - addParameter(0x3834, value); //@550 - } //@550 - - // @J2 new method - /** - Sets the database (IASP) name for this connection. The RDB name - is an 18 byte (blank padded) name. - **/ - void setRDBName(String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter(0x3826, converter, value, value.length()); - } - - - //@PDA 550 client info methods - /** - Sets the client info for the application name for this connection. - This has a 255 byte length. - **/ - void setClientInfoApplicationName(String value, ConvTable converter) - throws DBDataStreamException, SQLException - { - addParameter(0x3838, converter, value); //@pdc length - } - - //@PDA 550 client info methods - /** - Sets the client info for the account for this connection. - This has a 255 byte length. - **/ - void setClientInfoClientAccounting(String value, ConvTable converter) - throws DBDataStreamException, SQLException - { - addParameter(0x3837, converter, value); //@pdc length - } - - - //@PDA 550 client info methods - /** - Sets the client info for the user name for this connection. - This has a 255 byte length. - **/ - void setClientInfoClientUser(String value, ConvTable converter) - throws DBDataStreamException, SQLException - { - addParameter(0x3839, converter, value); //@pdc length - } - - - //@PDA 550 client info methods - /** - Sets the client info for the computer name for this connection. - This has a 255 byte length. - **/ - void setClientInfoClientHostname(String value, ConvTable converter) - throws DBDataStreamException, SQLException - { - addParameter(0x383A, converter, value); //@pdc length - } - - - //@PDA 550 client info methods - /** - Sets the client info for the program ID. - This has a 255 byte length. - **/ - void setClientInfoProgramID(String value, ConvTable converter) - throws DBDataStreamException, SQLException - { - addParameter(0x383B, converter, value); //@pdc length - } - - - - //@PDA 550 - middleware type - /** - Sets the middleware type for this connection. - This setting is designed to be set by driver only. - This gives driver information to host for any logging or future diagnostics. - **/ - void setInterfaceType(String value, ConvTable converter) - throws DBDataStreamException, SQLException - { - addParameter(0x383C, converter, value); //@pdc length - } - - //@PDA 550 - product name - /** - Sets the product name for this connection. - This setting is designed to be set by driver only. - This gives driver information to host for any logging or future diagnostics. - **/ - void setInterfaceName(String value, ConvTable converter) - throws DBDataStreamException, SQLException - { - addParameter(0x383D, converter, value); //@pdc length - } - - //@PDA 550 - client version - /** - Sets the client version for this connection. - This setting is designed to be set by driver only. - This gives driver information to host for any logging or future diagnostics. - Note: Viewable in iNav display. - **/ - void setInterfaceLevel(String value, ConvTable converter) - throws DBDataStreamException, SQLException - { - addParameter(0x383E, converter, value); //@pdc length - } - - // @J1 - added support for ROWID data type - /** - Sets client support information such as whether we - support the ROWID type directly or if the host - should return a VARCHAR FOR BIT DATA instead. - @parm value of the client support info bitmap - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setClientSupportInformation(int value) - throws DBDataStreamException - { - addParameter(0x3825, value); - } - - /** - Sets the Time Format Parser Option parameter in the data stream. - @param value the time format. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setTimeFormatParserOption(int value) - throws DBDataStreamException - { - addParameter(0x3809, (short)value); - } - - /** - Sets the Time Separator Parser Option parameter in the data stream. - @param value the time separator. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setTimeSeparatorParserOption(int value) - throws DBDataStreamException - { - addParameter(0x380A, (short)value); - } - - /** - Sets the Translate Indicator parameter in the data stream. - @param value the value that indicates if the data in the - operational results set generated by this function should be - translated to the client's CCSID before the data is returned. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setTranslateIndicator(int value) - throws DBDataStreamException - { - addParameter(0x3805, (byte)value); - } - - /** - Sets the Use Extended Formats Indicator parameter in the data stream. - @param value the value that indicates if the data in the - operational results set generated by this function should be - using extended formats. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setUseExtendedFormatsIndicator(int value) - throws DBDataStreamException - { - addParameter(0x3821, (byte)value); - } - - // @M0A - added method to support new codepoint on datastream for 63 digit decimal precision - /** - * Sets the 63 digit decimal precision parameters in the datastream. - * @param maximumDecimalPrecision The maximum decimal precision the system should use. - * @param maximumDecimalScale The maximum decimal scale the system should use. - * @param minimumDivideScale The minimum scale the system should use for decimal division. - * @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setDecimalPrecisionIndicators(int maximumDecimalPrecision, int maximumDecimalScale, int minimumDivideScale) - throws DBDataStreamException - { - // build the 6 byte value from its parts - byte[] value = new byte[6]; - value[0] = (byte)(maximumDecimalPrecision >>> 8); - value[1] = (byte)maximumDecimalPrecision; - value[2] = (byte)(maximumDecimalScale >>> 8); - value[3] = (byte)maximumDecimalScale; - value[4] = (byte)(minimumDivideScale >>> 8); - value[5] = (byte)minimumDivideScale; - - addParameter(0x3827, value); - } - - // @M0A - added method to support new codepoint on datastream for hex constant parser option - /** - * Sets the hex constant parser option in the datastream. - * @param parserOption The hex constant parser option. - * @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setHexConstantParserOption(int parserOption) - throws DBDataStreamException - { - addParameter(0x3828, (byte)parserOption); - } - - // @eWLM - added support for an eWLM Correlator - /** - Sets the eWLM correlator in the datastream - If the value is null, all ARM/eWLM implementation is turned off. - @parm eWLM correlator - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void seteWLMCorrelator(byte[] value) - throws DBDataStreamException - { - addParameter(0x3831, value); - } - - - //@eof Close on EOF support for 550 - /** - Turns on Close on EOF support. - By default, this is turned off. - @parm value - 'E8'x -- Implicitly close cursors which qualify and pass a return code/return class pair that indicates the cursor was closed. - 'D5'x -- Do not implicitly close cursors. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setCloseEOF(int value) - throws DBDataStreamException - { - addParameter(0x383F, (byte)value); - } - - //@cc1 currently committed support in 710 - /** - Turns on or off Currently Committed support. - @parm value - 'E8'x -- Implicitly close cursors which qualify and pass a return code/return class pair that indicates the cursor was closed. - 'D5'x -- Do not implicitly close cursors. - @exception DBDataStreamException If there is not enough space left in the data byte array. - **/ - void setConcurrentAccessResolution(int value) - throws DBDataStreamException - { - addParameter(0x3840, value); - } -} - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/DBSQLDADataFormat.java b/cvsroot/src/com/ibm/as400/access/DBSQLDADataFormat.java deleted file mode 100644 index f3c2db9f9..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBSQLDADataFormat.java +++ /dev/null @@ -1,423 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBSQLDADataFormat.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The DBSQLDADataFormat class is an implementation of -DBDataFormat which describes the data format used in -the SQLDA, specifically for the package cache. -**/ -class DBSQLDADataFormat -implements DBDataFormat -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - // Private data. - private static final int REPEATED_LENGTH_ = 80; - - private byte[] rawBytes_ = null; - private int offset_ = -1; - - private int numberOfFields_ = -1; - - private int jobCCSID_; // @D1A - private int length_ = -1; - private boolean csRsData_ = false; // @550A Indicates if the data associated with this format is from a stored procedure result set. - - - - /** - Constructs a DBSQLDADataFormat object. Use this when overlaying - on a reply datastream. The cached data will be set when overlay() - is called. - **/ - public DBSQLDADataFormat(int jobCCSID) // @D1C - { - jobCCSID_ = jobCCSID; // @D1A - } - - - - // @D1D /** - // @D1D Constructs a DBSQLDADataFormat object. Use this when overlaying - // @D1D on a request datastream. This sets the cached data so that - // @D1D the total length can be calculated before calling overlay(). - // @D1D **/ - // @D1D public DBSQLDADataFormat (int numberOfFields) - // @D1D { - // @D1D numberOfFields_ = numberOfFields; - // @D1D } - - - - /** - Positions the overlay structure. This reads the cached data only - when it was not previously set by the constructor. - **/ - public void overlay (byte[] rawBytes, int offset) - { - rawBytes_ = rawBytes; - offset_ = offset; - - if(numberOfFields_ == -1) - numberOfFields_ = BinaryConverter.byteArrayToShort (rawBytes_, offset_ + 14); - - length_ = 16 + numberOfFields_ * REPEATED_LENGTH_; - } - - - - public int getLength () - { - return length_; - } - - - - public int getConsistencyToken () - { - // Not applicable. - return -1; - } - - - - public int getNumberOfFields () - { - return numberOfFields_; - } - - - - public int getRecordSize() - { - int recordSize = 0; - int numberOfFields = getNumberOfFields (); - for(int i = 0; i = v5r2 systems) - public static final int CURSOR_NOT_SCROLLABLE_ASENSITIVE = 0; - public static final int CURSOR_SCROLLABLE_ASENSITIVE = 1; - public static final int CURSOR_SCROLLABLE_INSENSITIVE = 2; - public static final int CURSOR_SCROLLABLE_SENSITIVE = 3; - public static final int CURSOR_NOT_SCROLLABLE_SENSITIVE = 4; - public static final int CURSOR_NOT_SCROLLABLE_INSENSITIVE = 5; - - -/** - Constructs a datastream for the SQL Server request functions. - @param requestId the 4 digit code that represents the function being called. - @param rpbId the request parameter block id. - @param operationResultsBitmap the bitmap which describes how the results are to be returned. - @param parameterMarkerDescriptorHandle the Parameter marker descriptor handle identifier. -**/ - public DBSQLRequestDS(int requestId, - int rpbId, - int operationResultsBitmap, - int parameterMarkerDescriptorHandle) - - { - // Create the datastream header and template - super(requestId, rpbId, operationResultsBitmap, - parameterMarkerDescriptorHandle); - setServerID(SERVER_SQL); - } - - - - - -/** - Sets the Blocking Factor parameter in the data stream. - @param value the blocking factor to be used on the fetch. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setBlockingFactor(int value) - throws DBDataStreamException - { - addParameter (0x380C, value); - } - - -//@F2A -/** - Sets the Column Index parameter in the data stream. - @param value the column index to be used on a Retrieve LOB Data. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setColumnIndex(int value) - throws DBDataStreamException - { - addParameter (0x3828, value); - } - - -/** - Sets the Compression Indicator parameter in the data stream. - @param value the value that indicates whether the LOB data - should be compressed. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setCompressionIndicator (int value) - throws DBDataStreamException - { - addParameter (0x381B, (byte)value); - } - - - - void setReturnCurrentLengthIndicator(int value) // @E1A - throws DBDataStreamException // @E1A - { // @E1A - addParameter(0x3821, (byte)value); // @E1A - } // @E1A - - - -/** - Sets the Cursor Name parameter in the data stream. - @param value the name for the open cursor. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. - @exception SQLException If the SQL statement is too long. -**/ - void setCursorName (String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x380B, converter, value); - } - - - -/** - Sets the Describe Option parameter in the data stream. - @param value the describe option to be used. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setDescribeOption(int value) - throws DBDataStreamException - { - addParameter (0x380A, (byte)value); - } - - - //@F5A - /** - Sets the Extended Column Descriptor Option parameter in the data stream. - @param value the extended column descriptor option to be used. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setExtendedColumnDescriptorOption(int value) - throws DBDataStreamException - { - addParameter (0x3829, (byte)value); - } - - - -/** - Sets the Fetch Scroll Option parameter in the data stream. - @param value the scroll option to used with the cursor. - @param rows the number of rows, when value is FETCH_RELATIVE. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFetchScrollOption(int value, int rows) - throws DBDataStreamException - { - // The system gives an error when we pass rows - // and value != FETCH_RELATIVE. - if (value == FETCH_RELATIVE || value == FETCH_DIRECT) //@abs2 - addParameter (0x380E, (short)value, rows); - else - addParameter (0x380E, (short)value); - } - - - -/** - Sets the Hold Indicator parameter in the data stream. - @param value the commit operation that is to be performed. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setHoldIndicator(int value) - throws DBDataStreamException - { - addParameter (0x380F, (byte)value); - } - - - - void setJobIdentifier(String value, ConvTable converter) // @E2A @P0C - throws DBDataStreamException, SQLException // @E9c @E2A - { // @E2A - addParameter(0x3826, converter, value); // @E2A - } // @E2A - - - -/** - Sets the Library Name parameter in the data stream. - @param value the name of the library. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. - @exception SQLException If the SQL statement is too long. -**/ - void setLibraryName (String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3801, converter, value); - } - - - -/** - Sets the LOB Allocate Locator Indicator parameter in the data stream. - @param value the value that indicates whether a LOB locator - should be allocated for this request. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setLOBAllocateLocatorIndicator (int value) - throws DBDataStreamException - { - addParameter (0x381C, (byte)value); - } - - -/** - Sets the LOB Data parameter in the data stream. - @param value the LOB data. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setLOBData (byte[] value) - throws DBDataStreamException - { - addParameter (0x381D, value, true); // @C1C - } - - void setLOBData(byte[] value, int offset, int length) throws DBDataStreamException - { - addParameter(0x381D, value, offset, length, true); - } - - -/** - Sets the LOB Locator Handle parameter in the data stream. - @param value the LOB locator handle. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setLOBLocatorHandle (int value) - throws DBDataStreamException - { - addParameter (0x3818, value); - } - - - -/** - Sets the Open Attributes parameter in the data stream. - @param value the open attributes of the referenced file. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setOpenAttributes(int value) - throws DBDataStreamException - { - addParameter (0x3809, (byte)value); - } - - - -/** - Sets the SQL Package Name parameter in the data stream. - @param value the name of the SQL package to use. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. - @exception SQLException If the SQL statement is too long. -**/ - void setPackageName (String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - if(value == null) - { - addParameter(0x3804); //send an empty code point - } - else - addParameter (0x3804, converter, value); - } - - - -// $F1 This parameter no longer needs to be passed on a data stream. Package clearing -// $F1 and the decision for the threshold where package clearing is needed is now handled -// $F1 automatically by the database. Passing this code point results in a no-op. -//@F1D /** -//@F1D Sets the Package Threshold Value parameter in the data stream. -//@F1D @param value the value used to determine if the package -//@F1D should be cleared. -//@F1D @exception DBDataStreamException If there is not enough space left in the data byte array. -//@F1D **/ -//@F1D void setPackageThresholdValue(int value) -//@F1D throws DBDataStreamException -//@F1D { -//@F1D addParameter (0x3813, (short)value); -//@F1D } - - - -/** - Sets the Parameter Marker Block Indicator parameter in the data stream. - @param value the value that indicates whether the parameter - marker data is intended for a block operation or a non-block operation. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setParameterMarkerBlockIndicator(int value) - throws DBDataStreamException - { - addParameter (0x3814, (short)value); - } - - - -/** - Sets the Parameter Marker Data parameter in the data stream. - @param value the parameter marker data object. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setParameterMarkerData(DBData value) - throws DBDataStreamException - { - if (value instanceof DBOriginalData) - addParameter (0x3811, value); - else if (value instanceof DBExtendedData) - addParameter (0x381F, value); - else if (value instanceof DBVariableData) //@array - addParameter (0x382F, value); //@array - else - throw new DBDataStreamException (); - } - - - -/** - Sets the Prepare Option parameter in the data stream. - @param value the prepare option to use. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setPrepareOption(int value) - throws DBDataStreamException - { - addParameter (0x3808, (byte)value); - } - - - -/** - Sets the Prepare Statement Name parameter in the data stream. - @param value the name of the parameter statement. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. - @exception SQLException If the SQL statement is too long. -**/ - void setPrepareStatementName (String value, ConvTable converter) //@P0C - throws DBDataStreamException, SQLException // @E9c - { - addParameter (0x3806, converter, value); - } - - - -/** - Sets the Requested Size parameter in the data stream. - @param value the request size, in bytes. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setRequestedSize (int value) - throws DBDataStreamException - { - addParameter (0x3819, value); - } - - - -//@F3A -/** - Sets the ResultSet Holdability Option parameter in the data stream. - @param value the value that contains the option to indicate how the cursor should - be opened. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setResultSetHoldabilityOption(byte value) - throws DBDataStreamException - { - addParameter (0x3830, value); - } - - - -/** - Sets the Return Size parameter in the data stream. - @param value the value that indicates the number - of megabytes of data to return from the package. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setReturnSize(int value) - throws DBDataStreamException - { - addParameter (0x3815, value); - } - - - -/** - Sets the Reuse Indicator parameter in the data stream. - @param value the value that indicates if the client - intends to open the cursor again for the same statement or not. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setReuseIndicator(int value) - throws DBDataStreamException - { - addParameter (0x3810, (byte)value); - } - - - -/** - Sets the Scrollable Cursor Flag parameter in the data stream. - @param value the value to indicate whether or not - cursor scrolling is supported. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setScrollableCursorFlag(int value) - throws DBDataStreamException - { - addParameter (0x380D, (short)value); - } - - - -/** - Sets the Start Offset parameter in the data stream. - @param value the start offset, in bytes. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setStartOffset (int value) - throws DBDataStreamException - { - addParameter (0x381A, value); - } - - - -/** - Sets the Statement Text parameter in the data stream. - @param value the text for the SQL statement. - @param converter the converter. - @param extended true if using extended statement text, false otherwise - @exception DBDataStreamException If there is not enough space left in the data byte array. - @exception SQLException If the SQL statement is too long. -**/ - void setStatementText (String value, ConvTable converter, boolean extended) //@P0C //@540C - throws DBDataStreamException, SQLException // @E9c - { - if(!extended) - addParameter (0x3807, converter, value); - else - setExtendedStatementText(value, converter); - } - - -//@540 -/** - Sets the Extended Statement Text parameter in the data stream. - @param value the text for the SQL statement. - @param converter the converter. - @exception DBDataStreamException If there is not enough space left in the data byte array. - @exception SQLException If the SQL statement is too long. -**/ - void setExtendedStatementText (String value, ConvTable converter) - throws DBDataStreamException, SQLException - { - addParameter (0x3831, true, converter, value); - } - - -/** - Sets the Statement Type parameter in the data stream. - @param value the statement type. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setStatementType (int value) - throws DBDataStreamException - { - addParameter (0x3812, (short)value); - } - - - -/** - Sets the Translate Indicator parameter in the data stream. - @param value the value that indicates if the data in the - operational result set generated by this function should be - translated to the client's CCSID before the data is returned. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setTranslateIndicator(int value) - throws DBDataStreamException - { - addParameter (0x3805, (byte)value); - } - -//@K1A -/** - Sets the Truncation Indicator parameter in the data stream to specify whether or not the LOB data should be - truncated after the last byte is written in the write LOB data request - @param value the value that indicates if the data should be truncated - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - - void setLobTruncation (boolean truncate) - throws DBDataStreamException - { - int value = 0xF0; - if(truncate == false) - { - value = 0xF1; - } - addParameter (0x3822, (byte)value); - } - - -//@K54 -/** - Sets the Variable-length Field Compression parameter in the data stream to specify whether or not Variable-length fields - should be compressed. By default, variable-length fields are not compressed. - @param value the value that indicates if variable-length fields should be compressed. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setVariableFieldCompression(boolean compressed) - throws DBDataStreamException - { - if(compressed) - addParameter(0x3833, (byte)0xE8); - else - addParameter(0x3833, (byte)0xD5); - } - -//@K54 -/** - Sets the buffer size parameter in the data stream. - @param value the buffer size to be used on the fetch. - @exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setBufferSize(int value) - throws DBDataStreamException - { - addParameter (0x3834, value); - } -} - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/DBSQLResultSetDS.java b/cvsroot/src/com/ibm/as400/access/DBSQLResultSetDS.java deleted file mode 100644 index 74ec887f1..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBSQLResultSetDS.java +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBSQLResultSetDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - Create SQL Result Set data stream -**/ -class DBSQLResultSetDS -extends DBBaseRequestDS - -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - public static final int FUNCTIONID_DELETE_RESULTS_SET = 0x1F01; - public static final int FUNCTIONID_SEND_RESULTS_SET = 0x1F00; - -/** - Constructs a datastream for the SQL Server Result Set functions. - @param requestId the 4 digit code that represents the function being called. - @param rpbId the request parameter block id. - @param operationResultsBitmap the bitmap which describes how the results are to be returned. - @param parameterMarkerDescriptorHandle the Parameter marker descriptor handle identifier. -**/ - - public DBSQLResultSetDS(int requestId, - int rpbId, - int operationResultsBitmap, - int parameterMarkerDescriptorHandle) - - { - // Create the datastream header and template - super(requestId, rpbId, operationResultsBitmap, - parameterMarkerDescriptorHandle); - setServerID(SERVER_SQL); - } - - - // There are no parameters for Result Set functions - // and therefore no addParameters are required - - -} // End of DBSQLResultSetDS - - - - diff --git a/cvsroot/src/com/ibm/as400/access/DBStorage.java b/cvsroot/src/com/ibm/as400/access/DBStorage.java deleted file mode 100644 index 9178709c8..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBStorage.java +++ /dev/null @@ -1,245 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBStorage.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.PrintWriter; -import java.io.StringWriter; - - - -/** -

          This class manages a large byte arrays for use -in creating request datastreams. This enables reuse of -the byte array, so that it does not have to be reallocated -repeatedly. -**/ -final class DBStorage //@P0C -{ - public final static int DEFAULT_SIZE = 1024; - private byte[] data_ = new byte[DEFAULT_SIZE]; //@P0C - private int id_; // @B5A - private DBStoragePool pool_; // @B5A - - private boolean inUse_ = false; //@P0A - private Exception allocatedLocation; // @B5A - - - /** - Constructs a DBStorage object. - - @param id an id assigned by the pool. This is -1 if the storage does not belong to the pool. - @param pool pool that this object belongs to - **/ - // @B5A - DBStorage(int id, DBStoragePool pool) { - id_ = id; - pool_ = pool; - } - -/** -Constructs a DBStorage object. - -@param id an id assigned by the pool. -**/ - -//@P0D DBStorage (int id) -//@P0D { - // Initialize to 63 KB. This used to be 64K - // The IBM i JVM adds 24 bytes of - // overhead to each object so a 64K byte array really - // takes 64K + 24 bytes. The IBM i JVM has a boundary - // at 64K. Objects 64K or smaller go into the 64K - // segment pool. Objects 64K + 1 byte or larger go into the - // 1 meg pool. We used to allocate a 64K byte array - // but that ended up in the 1 meg pool because of the - // added JVM overhead. This wasted a lot of heap because - // 1 meg was allocated but only 64K + 24 was used. Making - // the buffer smaller puts us back into the 64K segment - // greatly reducing heap loss. This object automatically - // increases the size of the byte array if necessary so if any - // caller really needs 64K the byte array will grow to that size. -//@P0 - The data is initialized to 1K now, so this isn't an issue. -// The data streams rarely need as much as 64K, so it's worth the -// memory savings. -//@P0D data_ = new byte[64512]; // @D1C - -//@P0D id_ = id; -//@P0D } - - - -/** -Checks the size of the array and resizes the storage if needed. - -@param size size that is needed. - -@return true if the storage was resize; false otherwise. -**/ - final synchronized boolean checkSize(final int size) //@P0C - { - if (size > data_.length) - { - // Double the size each time, until the size is greater then 4 meg. - // Then just go up 4 meg at a time to avoid excessive storage consumption @A8A - int increment = data_.length; - // - // Limiting the increment to 4 meg caused performance problems with applications - // creating huge batches. - // if (increment > 4096 * 1024 ) increment = 4096 * 1024; - byte[] newdata = new byte[Math.max(data_.length + increment, size)]; // @C1C - System.arraycopy(data_, 0, newdata, 0, data_.length); - data_ = newdata; - return true; - } - return false; - } - -/** - * Reduce the size of the allocated buffer if needed. @A8A - */ -public synchronized void reclaim(int length) { - if(data_.length>length && length >= DEFAULT_SIZE ) { - // System.out.println("Reclaiming to "+length+" from "+data_.length); - byte[] oldData = data_; - data_ = new byte[length]; - // The two byte client server ID is only set in the constructor, NOT in initialize. - // This caused a failure unless those 2 bytes are preserved - System.arraycopy(oldData, 6, data_, 6, 2); - } -} - -/** - * Set the inUse_ flags so that the storage can be returned to the pool - */ -public synchronized void returnToPool() { - // Fill the array with garbage before it is reused. - // This is to catch the case where the array is still being - // used but has been returned to the pool. - // if (data_ != null) { - // Arrays.fill(data_, (byte) 0xeb); - // } - inUse_ = false; - if (id_>= 0) { - pool_.returned(id_); //@B5A - } -} - -/** - * Can this be used. If not, false is returned. - * If it can be used, then inUse_ is set to return and true is returned. - * Note: We first check unsynchronized. Then check after synchronizing. - * @return - */ -public boolean canUse() { - if (inUse_) { - return false; - } else { - synchronized(this) { - if (inUse_) { - return false; - } else { - inUse_ = true; - return true; - } - } - } -} - - -/** - * get the data buffer - */ -public synchronized byte[] getData() { - // if (!inUse_) { - // Error case for now just trace it - // Debugging code. - // if (! DataStream.traceOpened) { - // SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmm"); - // try { - // Trace.setFileName("/tmp/toolboxTrace."+sdf.format(new Date())+".txt"); - // } catch (Exception e) { - // - // } - // DataStream.traceOpened=true; - //} - - //boolean traceTurnedOn = false; - //if (!Trace.traceOn_) { - // traceTurnedOn = true; - // Trace.setTraceAllOn(true); - // Trace.setTraceOn(true); - //} - // Exception e = new Exception("getData() called when inUse_ = "+inUse_); - // Trace.log(Trace.ERROR, "Debug0601: DBStorage.getData() called when DBStorage not in use", e); - // if (traceTurnedOn) { - // Trace.setTraceAllOn(false); - // Trace.setTraceOn(false); - //} - - // } - return data_; -} -/** -Clears the contents of the storage. -**/ -//@P0D void clear () -//@P0D { - // No-op. -//@P0D } - -public void setAllocatedLocation() { - allocatedLocation = new Exception("location"); -} - -String getAllocatedLocation() { - if (allocatedLocation == null) { - return "NONE"; - } else { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - allocatedLocation.printStackTrace(pw); - String result = sw.toString(); - result.replace('\n', ' '); - return result; - } -} - - -/** -Returns the id. - -@return id -**/ -//@P0D int getId () -//@P0D { -//@P0D return id_; -//@P0D } - - - -/** -Returns a reference to the enclosed byte array. - -@return a reference to the byte array. -**/ -//@P0D byte[] getReference () -//@P0D { -//@P0D return data_; -//@P0D } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/access/DBStoragePool.java b/cvsroot/src/com/ibm/as400/access/DBStoragePool.java deleted file mode 100644 index 59bac523f..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBStoragePool.java +++ /dev/null @@ -1,187 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBStoragePool.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.ref.SoftReference; - -//@P0D import java.util.BitSet; -//@P0D import java.util.Vector; - - - -/** -

          This class manages a pool of large byte arrays for use -in creating request datastreams. This enables reduction in -the number of allocations and the amount of synchronization -involved in sending request datastreams. -**/ -class DBStoragePool -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - static final int MAX_POOL_INCREMENT = 4096; //@B5A - - private static final int STORAGE_POOL_LOCALITY = 256; //@B5A - - - //@P0D private int count_; - //@P0D private BitSet lockState_; - //@P0D private Vector pool_; - - // - // Use soft references to avoid running the JVM out of memory - // - private SoftReference[] pool_ = new SoftReference[16]; //@P0A - private int lastReturned_; // @B5A - private int searches_ = 0; // @B5A - -/** -Constructs a DBStoragePool object. -**/ -//@P0D DBStoragePool () -//@P0D { -//@P0D count_ = 0; - - // The initial capacity is 128. This is pretty - // large and would only be hit if we had 128 data - // streams being created at the same time. Even - // if this does happen (an extremely stressed - // scenario), the resizing should not happen too - // often. -//@P0D lockState_ = new BitSet (128); -//@P0D pool_ = new Vector (128, 128); -//@P0D } - - int getSize() { return pool_.length; } // @B5A - -/** -Frees a DBStorage object for reuse. - -@param a DBStorage object. -**/ -//@P0D synchronized void freeStorage (DBStorage storage) // @B1C -//@P0D { -//@P0D lockState_.clear (storage.getId ()); -//@P0D } - - - /** - Returns an unused DBStorage object. - - @return a DBStorage object. - **/ - - - final synchronized DBStorage getUnpooledStorage() { - DBStorage storage = new DBStorage(-1, this); - storage.canUse(); - return storage; - } //@B5A - -/** -Returns an unused, pre-allocated DBStorage object. If none -are available, a brand new one will be allocated. - -@return a DBStorage object. -**/ -// -// Note: This method must be synchronized to make it -// threadsafe. -// - final synchronized DBStorage getUnusedStorage() // @B0C @B1C @P0C - { -//@P0D DBStorage storage; - int max = pool_.length; //@P0A - - // Start the search at the last returned location @B5A - int searchStart = lastReturned_; - searches_++; - if (searches_ > MAX_POOL_INCREMENT) { - searchStart = 0; - searches_ = 0; - } - // Find an unused storage object. - for (int i=searchStart; i MAX_POOL_INCREMENT) increment = MAX_POOL_INCREMENT; // @B5A - - SoftReference[] tempPool = new SoftReference[max+increment]; //@P0A@B5C - - for (int i=0; i= (lastReturned_ - STORAGE_POOL_LOCALITY))) { - lastReturned_ = id_; - } - } -} - - diff --git a/cvsroot/src/com/ibm/as400/access/DBSuperExtendedDataFormat.java b/cvsroot/src/com/ibm/as400/access/DBSuperExtendedDataFormat.java deleted file mode 100644 index 5452677aa..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBSuperExtendedDataFormat.java +++ /dev/null @@ -1,405 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBSuperExtendedDataFormat.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2004-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; - -/* -Super Extended Data Format - -consistency token - 4 bytes 0 -# of fields - 4 bytes 4 -RESERVED - 4 bytes 8 - In the release(s) after V5R4, the above reserved bytes are replaced with (unless this is a x3813 codepoint) - Date Format - 1 byte - Time Format - 1 byte - Date Separator - 1 byte - Time Separator - 1 byte -record size - 4 bytes 12 - -//following is repeated for each field -(fixed length info) -field description LL - 2 bytes 16 -field (SQL) type - 2 bytes 18 -field length - 4 bytes 20 -field scale - 2 bytes 24 // scale for numeric or character count for GRAPHIC -field precision - 2 bytes 26 -field CCSID - 2 bytes 28 -RESERVED - 1 byte 30 (field paramter type for parameter marker format) -field Join Ref Position - 2 bytes 31 -RESERVED - 9 bytes 33 (field lob locator for parameter marker fromat) -field lob locator - 4 bytes 33 (field lob locator for parameter marker fromat) -field flags - 1 byte 37 (field flags in x3813 for parameter marker fromat) (bits 3-5 xml) //@xml3 (bit 2 is array bit) //@array -field max cardinality of array - 4 bytes 38 (field max array size for parameter marker fromat) //@array -field Lob max size - 4 bytes 42 -Reserved - 2 bytes (for alignment) 46 -Offset to variable length info - 4 bytes 48 // offset is based on the start of the fixed length info -Length of variable info - 4 bytes 52 -Reserved - 8 bytes 56 - -//following describes the variable length info -LL - 4 bytes 64 -CP - 2 bytes 68 // '3840'x for field name, '38xx'x for future variable length column options -Field name CCSID - 2 bytes 70 -Field Name - Char(*) 72 -*/ - - -/** -The DBSuperExtendedDataFormat class is an implementation of -DBDataFormat which describes the data format used in -datastreams for V5R4 and later systems. -**/ -class DBSuperExtendedDataFormat -implements DBDataFormat -{ - // Private data. - private static final int FIXED_LENGTH_ = 16; - private static final int REPEATED_FIXED_LENGTH_ = 48; - private byte[] rawBytes_ = null; - private int offset_ = -1; - private int numberOfFields_ = -1; - private boolean csRsData_ = false; // @550A indicates whether or not the data associated with this format is from a stored procedure result set - -/** -Constructs a DBSuperExtendedDataFormat object. Use this when overlaying -on a reply datastream. The cached data will be set when overlay() -is called. -**/ - public DBSuperExtendedDataFormat () - { - } - -/** -Constructs a DBSuperExtendedDataFormat object. Use this when overlaying -on a request datastream. This sets the cached data so that -the total length can be calculated before calling overlay(). -**/ - public DBSuperExtendedDataFormat (int numberOfFields) - { - numberOfFields_ = numberOfFields; - } - -/** -Positions the overlay structure. This reads the cached data only -when it was not previously set by the constructor. -**/ - public void overlay (byte[] rawBytes, int offset) - { - rawBytes_ = rawBytes; - offset_ = offset; - - if (numberOfFields_ == -1) - { - numberOfFields_ = BinaryConverter.byteArrayToInt (rawBytes_, offset + 4); - } - else - { - setNumberOfFields (numberOfFields_); - } - } - - public int getConsistencyToken () - { - return BinaryConverter.byteArrayToInt (rawBytes_, offset_); - } - - public int getNumberOfFields () - { - return numberOfFields_; - } - - // @550 - public int getDateFormat() - { - return (new Byte(rawBytes_[offset_+ 8])).intValue(); - } - - // @550 - public int getTimeFormat() - { - return (new Byte(rawBytes_[offset_+ 9])).intValue(); - } - - // @550 - public int getDateSeparator() - { - return (new Byte(rawBytes_[offset_+ 10])).intValue(); - } - - // @550 - public int getTimeSeparator() - { - return (new Byte(rawBytes_[offset_+ 11])).intValue(); - } - - public int getRecordSize () - { - return BinaryConverter.byteArrayToInt (rawBytes_, offset_ + 12); - } - - public int getFieldSQLType (int fieldIndex) - { - return BinaryConverter.byteArrayToShort (rawBytes_, - offset_ + 18 + (fieldIndex * REPEATED_FIXED_LENGTH_)); - } - - public int getFieldLength (int fieldIndex) - { - return BinaryConverter.byteArrayToInt (rawBytes_, - offset_ + 20 + (fieldIndex * REPEATED_FIXED_LENGTH_)); - } - - public int getFieldScale (int fieldIndex) - { - return BinaryConverter.byteArrayToShort (rawBytes_, - offset_ + 24 + (fieldIndex * REPEATED_FIXED_LENGTH_)); - } - - public int getFieldPrecision (int fieldIndex) - { - return BinaryConverter.byteArrayToShort (rawBytes_, - offset_ + 26 + (fieldIndex * REPEATED_FIXED_LENGTH_)); - } - - public int getFieldCCSID (int fieldIndex) - { - // CCSID of the data that goes in the field/column - return BinaryConverter.byteArrayToUnsignedShort (rawBytes_, - offset_ + 28 + (fieldIndex * REPEATED_FIXED_LENGTH_)); - } - - public int getFieldParameterType (int fieldIndex) - { - return rawBytes_[offset_ + 30 + (fieldIndex * REPEATED_FIXED_LENGTH_)]; - } - - public int getFieldLOBLocator (int fieldIndex) - { - return BinaryConverter.byteArrayToInt (rawBytes_, - offset_ + 33 + (fieldIndex * REPEATED_FIXED_LENGTH_)); - } - - //@xml3 return 0 if single, 1 if is doublebyte - //Note: if 65535, then this is not applicable - public int getXMLCharType(int fieldIndex) - { - - int flag = BinaryConverter.byteArrayToInt (rawBytes_, - offset_ + 37 + (fieldIndex * REPEATED_FIXED_LENGTH_)); - //flag is actually only 1 byte long - //array bit is bit #5 - int isDBChar = (flag >> 27) & 0x00000001; - return isDBChar; - } - - //@array return 1 if is array, 0 if not - public int getArrayType(int fieldIndex) - { - int flag = BinaryConverter.byteArrayToInt (rawBytes_, - offset_ + 37 + (fieldIndex * REPEATED_FIXED_LENGTH_)); - //flag is actually only 1 byte long - //array bit is bit #2 - int isArray = (flag >> 30) & 0x00000001; - return isArray; - - } - - public int getFieldLOBMaxSize (int fieldIndex) - { - return BinaryConverter.byteArrayToInt (rawBytes_, - offset_ + 42 + (fieldIndex * REPEATED_FIXED_LENGTH_)); - } - - public int getFieldNameLength (int fieldIndex) - { - // Variable Length info LL - 8 - // LL is the length of the variable length info which includes 4 bytes for the LL, 2 bytes for the CP, 2 bytes for the field name ccsid, and ? bytes for the field name - int offsetToVariableFieldInformation = BinaryConverter.byteArrayToInt(rawBytes_, offset_ + 48 + (fieldIndex * REPEATED_FIXED_LENGTH_)); - int lengthOfVariableFieldInformation = BinaryConverter.byteArrayToInt(rawBytes_, offset_ + 16 + (fieldIndex * REPEATED_FIXED_LENGTH_) + offsetToVariableFieldInformation); // Length of the variable information for a specific codepoint - int fieldLength = lengthOfVariableFieldInformation - 8; - return fieldLength; - } - - public int getFieldNameCCSID (int fieldIndex) - { - // CCSID of the field/column name. Usually the same as the job ccsid. - int length = findCodePoint(fieldIndex, 0x3840); - if(length >=0) - { - return BinaryConverter.byteArrayToShort (rawBytes_, - offset_ + 16 + length + 6 + (fieldIndex * REPEATED_FIXED_LENGTH_)); - } - else - { - JDTrace.logInformation("Did not find the code point for the field name"); - return getFieldCCSID(fieldIndex); - } - } - - public String getFieldName (int fieldIndex, ConvTable converter) - { - int length = findCodePoint(fieldIndex, 0x3840); - - if(length >= 0) - { - return converter.byteArrayToString (rawBytes_, - offset_ + 16 + length + 8 + (fieldIndex * REPEATED_FIXED_LENGTH_), - getFieldNameLength (fieldIndex)); - } - else - { - JDTrace.logInformation("Did not find the code point for the field name."); - return ""; - } - } - - // Finds a specified codepoint in the variable length information and returns a length that can be used when calculating offsets - // for the variable length information - private int findCodePoint(int fieldIndex, int cp){ - - int lengthOfVariableInformation = BinaryConverter.byteArrayToInt(rawBytes_, offset_ + 52 + (fieldIndex * REPEATED_FIXED_LENGTH_)); // length of the variable information for this field - - int length = 0; // Used to keep track of the length of all of the variable information for this field - - // retrieve the length of the variable field information for the first codepoint - int offsetToVariableFieldInformation = BinaryConverter.byteArrayToInt(rawBytes_, offset_ + 48 + fieldIndex * REPEATED_FIXED_LENGTH_); - int lengthOfVariableFieldInformation = BinaryConverter.byteArrayToInt(rawBytes_, offset_ + 16 + (fieldIndex * REPEATED_FIXED_LENGTH_) + offsetToVariableFieldInformation); // Length of the variable information for a specific codepoint - // retrieve the first codepoint in the variable length information - int codePoint = BinaryConverter.byteArrayToShort(rawBytes_, offset_ + 16 + (fieldIndex * REPEATED_FIXED_LENGTH_) + offsetToVariableFieldInformation + 4);; - - // Search until you find the codepoint for the information you want, or until the end of of the variable length info - // move to the next LL CP in the variable inforamtion - while((codePoint != cp) && (length < lengthOfVariableInformation)) - { - length += lengthOfVariableFieldInformation; - lengthOfVariableFieldInformation = BinaryConverter.byteArrayToInt(rawBytes_, offset_ + 16 + length + (fieldIndex * REPEATED_FIXED_LENGTH_) + offsetToVariableFieldInformation); - codePoint = BinaryConverter.byteArrayToShort(rawBytes_, offset_ + 16 + length + offsetToVariableFieldInformation + (fieldIndex * REPEATED_FIXED_LENGTH_)); - } - - // Check to see if we found the codepoint, otherwise we looped through all of the information and didn't find the codepoint we wanted - if(codePoint != cp){ - return -1; - } - - return length + offsetToVariableFieldInformation; - } - - public void setConsistencyToken (int consistencyToken) - { - BinaryConverter.intToByteArray (consistencyToken, rawBytes_, - offset_); - } - - public void setNumberOfFields (int numberOfFields) - { - BinaryConverter.intToByteArray (numberOfFields, rawBytes_, - offset_ + 4); - } - - public void setRecordSize (int recordSize) - { - // not applicable - only called by AS400JDBCPreparedStatement.changeDescriptor() - // At this time we will continue to use the Extended Data Format. - Trace.log(Trace.DIAGNOSTIC, "called DBSuperExtendedDataFormat.setRecordSize()"); - } - - public void setFieldDescriptionLength (int fieldIndex) - { - // not applicable - only called by AS400JDBCPreparedStatement.changeDescriptor() - // At this time we will continue to use the Extended Data Format. - Trace.log(Trace.DIAGNOSTIC, "called DBSuperExtendedDataFormat.setFieldDescriptionLength()"); - } - - public void setFieldSQLType (int fieldIndex, int sqlType) - { - // not applicable - only called by AS400JDBCPreparedStatement.changeDescriptor() - // At this time we will continue to use the Extended Data Format. - Trace.log(Trace.DIAGNOSTIC, "called DBSuperExtendedDataFormat.setFieldSQLType()"); - } - - public void setFieldLength (int fieldIndex, int length) - { - // not applicable - only called by AS400JDBCPreparedStatement.changeDescriptor() - // At this time we will continue to use the Extended Data Format. - Trace.log(Trace.DIAGNOSTIC, "called DBSuperExtendedDataFormat.setFieldLength()"); - } - - public void setFieldScale (int fieldIndex, int scale) - { - // not applicable - only called by AS400JDBCPreparedStatement.changeDescriptor() - // At this time we will continue to use the Extended Data Format. - Trace.log(Trace.DIAGNOSTIC, "called DBSuperExtendedDataFormat.setFieldScale()"); - } - - public void setFieldPrecision (int fieldIndex, int precision) - { - // not applicable - only called by AS400JDBCPreparedStatement.changeDescriptor() - // At this time we will continue to use the Extended Data Format. - Trace.log(Trace.DIAGNOSTIC, "called DBSuperExtendedDataFormat.setFieldPrecision()"); - } - - public void setFieldCCSID (int fieldIndex, int ccsid) - { - // not applicable - only called by AS400JDBCPreparedStatement.changeDescriptor() - // At this time we will continue to use the Extended Data Format. - Trace.log(Trace.DIAGNOSTIC, "called DBSuperExtendedDataFormat.setFieldCCSID()"); - } - - public void setFieldParameterType (int fieldIndex, int parameterType) - { - rawBytes_[offset_ + fieldIndex * REPEATED_FIXED_LENGTH_ + 30] = (byte) parameterType; - } - - // Note: No spot for field name length, could be part of LL - length of variable field info - public void setFieldNameLength (int fieldIndex, int nameLength) - { - // not applicable - only called by AS400JDBCPreparedStatement.changeDescriptor() - // At this time we will continue to use the Extended Data Format. - Trace.log(Trace.DIAGNOSTIC, "called DBSuperExtendedDataFormat.setFieldNameLength()"); - } - - public void setFieldNameCCSID (int fieldIndex, int nameCCSID) - { - // not applicable - only called by AS400JDBCPreparedStatement.changeDescriptor() - // At this time we will continue to use the Extended Data Format. - Trace.log(Trace.DIAGNOSTIC, "called DBSuperExtendedDataFormat.setFieldNameCCSID()"); - } - - public void setFieldName (int fieldIndex, String name, ConvTable converter) - throws DBDataStreamException - { - // not applicable - only called by AS400JDBCPreparedStatement.changeDescriptor() - // At this time we will continue to use the Extended Data Format. - Trace.log(Trace.DIAGNOSTIC, "called DBSuperExtendedDataFormat.setFieldName()"); - } - - // Don't know actual length without actually parsing all of the data - public int getLength () - { - return 0; - } - - //@550A - returns whether or not this data is associated with a stored procedure result set - public boolean getCSRSData() - { - return csRsData_; - } - - //@550A - sets whether or not this data is associated with a stored procedure result set - public void setCSRSData(boolean csRsData) - { - csRsData_ = csRsData; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DBVariableData.java b/cvsroot/src/com/ibm/as400/access/DBVariableData.java deleted file mode 100644 index 0eb64413e..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBVariableData.java +++ /dev/null @@ -1,539 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// - -//JTOpen (IBM Toolbox for Java - OSS version) - -//Filename: DBVariableDataInput.java - -//The source code contained herein is licensed under the IBM Public License -//Version 1.0, which has been approved by the Open Source Initiative. -//Copyright (C) 2009-2009 International Business Machines Corporation and -//others. All rights reserved. - -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -//@array new class -/** -An implementation of DBData which -describes the data used in datastreams for (the release following v6r1) and later -systems when sending arrays as input to stored procedures. -This is the implementation of the x382f and x3901 codepoints. -Since input and output are different, we have toHost and fromHost member data. -Output data from host is received in one byte array, which we parse and save various offsets for later use. -Input data size of header, indicators, data is calculated externally and passed in to constructor. -Before arrays, input/output parms for stored procedures were handled with codepoints x381f and x380e via DBExtendedData. -If an input or output parm is an array, then we use x382f and x3901 codepoints instead. -Note: This class is modeled after DBExtendedData since (x382F is like x381f and x3901 is like x380e codepoints) - -382f (input parms): - Consistency token 4 bytes - Count of '9911'x and '9912'x code points that follow 2 bytes - '9911'x , data type 2 bytes, data length 4 bytes, # of data items 4 bytes - '9912'x , data type 2 bytes, data length 4 bytes - all of the indicator data - all of the data bytes - - -3901 (output parms): - Consistency token 4 bytes - Row Count 4 bytes - Column Count 2 bytes - Indicator Size 2 bytes - RESERVED 4 bytes - Row Size 4 bytes - Consistency token 4 bytes - Count of '9911'x and '9912'x code points that follow 2 bytes - '9911'x , data type 2 bytes, data length 4 bytes, # of data items 4 bytes - '9912'x , data type 2 bytes, data length 4 bytes - all of the indicator data - all of the data bytes - -NOTE 1: Clients will only receive the information about output parameters. If a stored procedure is called with 3 IN and 2 OUT/INOUT parameters(in any order), the count of parameters returned on this flow is 2, followed by the indicator and data for those 2 OUT/INOUT parameters. -NOTE 2: When returning a NULL array, ZDA will pass '9911'x followed by 'FFFF'x. -*/ - -class DBVariableData -implements DBData -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - // Private data. - private byte[] rawBytes_ = null; //will be all data combined when sending in request and receiveing data - private int headerCurOffsetToHost_ = -1; //index into rawBytes_[] (toHost) - private int indicatorCurOffsetToHost_ = -1; //index into rawBytesIndicatorsToHost_[] - private int dataCurOffsetToHost_ = -1; //index into rawBytesDataToHost_[] (may not be used since we call SQLData.convertToRawBytes externally which tracks this offset) - private int headerTotalSizeToHost_ = -1; //length for rawBytesToHost_ when sending to host (could be smaller if null arrays etc) - //block size starting from count of 9911/9912s up to indicators (not consistency token etc) - private int indicatorTotalSizeToHost_ = -1; //length for rawBytesIndicatorsToHost_ - private int dataTotalSizeToHost_ = -1; //length for rawBytesDataToHost_ when sending to host - - private int offset_ = -1; // - - //This was for pre-V5R1 private boolean dataCompressed_ = false; (old pre-ILE compression) - //Also note: ILE compression is done outside this class on whole stream - private boolean vlfCompressed_ = false; //For now, not supported in arrays - - private int rowCount_ = -1; //for now, only 1 row - private int columnCount_ = -1; - private int indicatorSize_ = -1; - //now always variable private int rowSize_ = -1; - - //for input parms, offset_, add +4 to get to count of parms. - //for output parms, here, we addjust +4 to get to begining of array data (count of parms) - final private int actual382fInArrayStart_ = 4; - final private int actual3901OutArrayStart_ = 4; //@arraylen - private int headerOffsetFromHost_ = -1; //same as offset_, but a user-friendly name - private int indicatorOffsetFromHost_ = -1; - private int dataOffsetFromHost_ = -1; - private int lengthFromHost_ = -1; //Total length of x382f/x3901 (header/indicators/data) - - - //Four parallel arrays below are generated to maintain header, indicator, data offset info from a reply from the Host. - //These four arrays are all 0 offset based. So you will have to add values in them to headerOffsetFromHost_ or dataOffsetFromHost_ when used - //This is because data are variable depending upon the number/type of columns etc - //Instead of making JDServerRow more messy than it already is, adding these four parallel arrays here - private int[] indicatorOffsetsFromHost_ = null; //@array - private int[] dataOffsetsFromHost_ = null; //@array - private int[] indicatorCountsFromHost_ = null; //@array number of indicators for a given column (1 if non-array, else array length) - private int[] dataLengthsFromHost_ = null; //@array total length of data portion in stream - private int[] dataIsArrayFromHost_ = null; //@nullelem flag 1 = array 0 = non-array - private int[] dataIsNullArrayFromHost_ = null; //@nullelem flag -1 = null array 0 = non null - - /** - Constructs a DBVariableData object. Use this when overlaying - on a reply datastream. The cached data will be set when overlay() - is called. - **/ - public DBVariableData () - { - //@array nothing to do. overlay will calculate offsets etc. - } - - /** - Constructs a DBVariableData object. Use this when overlaying - on a request datastream. This sets the cached data so that - the total length can be calculated before calling overlay(). - **/ - public DBVariableData ( - int columnCount, - int indicatorSize, - int headerTotalSize, - int indicatorTotalSize, - int dataTotalSize) - throws DBDataStreamException - { - //input parm constructor - rowCount_ = 1; //always 1 row when sending array - columnCount_ = columnCount; - indicatorSize_ = 2; //always 2 for now - - headerTotalSizeToHost_ = headerTotalSize; - indicatorTotalSizeToHost_ = indicatorTotalSize; - dataTotalSizeToHost_ = dataTotalSize; - - } - - /** - Positions the overlay structure. This reads the cached data only - when it was not previously set by the constructor. - **/ - public void overlay (byte[] rawBytes, int offset) - { - - - - if (rowCount_ == -1) { - //output array - offset_ = offset; - lengthFromHost_ = 0; //Total length of x3901 (header/indicators/data) - //Header is also variable depending on number of columns and whether they are arrays/nulls etc. - int headerLength = 0; //(consistency=4, count=2, x9911/x9912 blocks) - - //on reply stream, we only need one array rawBytes_[] since host already assembled it. - //ouput 3901: useful data starts at offset 20, not 4 like input. - columnCount_ = BinaryConverter.byteArrayToShort(rawBytes, offset_ + actual3901OutArrayStart_); //count of 9911s or 9912s - rowCount_ = 1; //always 1 row - indicatorSize_ = 2; //always 2 bytes - - indicatorOffsetsFromHost_ = new int[columnCount_]; //one per column - indicatorCountsFromHost_ = new int[columnCount_]; //one per column - number of indicators for a given column - dataOffsetsFromHost_ = new int[columnCount_]; //one per column - dataLengthsFromHost_ = new int[columnCount_]; //one per column - dataIsArrayFromHost_ = new int[columnCount_]; //one per column //@nullelem - dataIsNullArrayFromHost_ = new int[columnCount_]; //one per column //@nullelem - - //iterate through columns to get total length of data and indicators - //colDescs used to iterate through each of the 9911/9912 col descriptions. - int colDescs = offset_ + actual3901OutArrayStart_ + 2; //start of first col description: offset + 4 + 2 (# of 9911 and 9912 descriptors) - int dataLenAll = 0; - int indicatorLenAll = 0; - - for(int i = 0; i < columnCount_; i++){ - short descType = BinaryConverter.byteArrayToShort(rawBytes, colDescs); //9911=array or 9912=non-array - - if(descType == (short)0x9911){ - //array - boolean isNull = BinaryConverter.byteArrayToShort (rawBytes, colDescs + 2) == (short)0Xffff ? true : false; //is whole array null //@nullelem - dataIsArrayFromHost_[i] = 1; //@nullelem array type - - if(isNull){ - colDescs += 4; //null = x9911 xffff skip 4 to next description - indicatorOffsetsFromHost_[i] = (i == 0 ? 0 : indicatorOffsetsFromHost_[i-1] + (indicatorCountsFromHost_[i-1] * indicatorSize_)); - indicatorCountsFromHost_[i] = 0; //flag that array is null or zero length array if 0 indicator counts and type of array - dataOffsetsFromHost_[i] = (i == 0 ? 0 : dataOffsetsFromHost_[i-1]); //keep same as prev since null arrays have no data (so we can later keep a running total)(ie no -1 values) - dataLengthsFromHost_[i] = 0; - - dataIsNullArrayFromHost_[i] = -1; //@nullelem null array - }else{ - int dataLen = BinaryConverter.byteArrayToInt (rawBytes, colDescs + 4); - int arrayLen = BinaryConverter.byteArrayToInt(rawBytes, colDescs + 8); //element count //@array2 - dataLenAll += (dataLen * arrayLen); - indicatorLenAll += (indicatorSize_ * arrayLen); - indicatorOffsetsFromHost_[i] = (i == 0 ? 0 : indicatorOffsetsFromHost_[i-1] + (indicatorCountsFromHost_[i-1] * indicatorSize_)); - indicatorCountsFromHost_[i] = arrayLen; - dataOffsetsFromHost_[i] = (i == 0 ? 0 : dataOffsetsFromHost_[i-1] + dataLengthsFromHost_[i-1]); //keep same as prev since null arrays have no data (so we can later keep a running total)(ie no -1 values) - dataLengthsFromHost_[i] = arrayLen * dataLen; - colDescs += 12; //0x9911=2, datatype=2, datalen=4, arraylen=4 -> 12 //@array2 - - dataIsNullArrayFromHost_[i] = 0; //@nullelem null array - } - }else if(descType == (short)0x9912){ - //non-array - dataIsArrayFromHost_[i] = 0; //@nullelem non-array type - - int dataLen = BinaryConverter.byteArrayToInt (rawBytes, colDescs + 4); - dataLenAll += dataLen; - indicatorLenAll += indicatorSize_; - indicatorOffsetsFromHost_[i] = (i == 0 ? 0 : indicatorOffsetsFromHost_[i-1] + (indicatorCountsFromHost_[i-1] * indicatorSize_)); - indicatorCountsFromHost_[i] = 1; - dataOffsetsFromHost_[i] = (i == 0 ? 0 : dataOffsetsFromHost_[i-1] + dataLengthsFromHost_[i-1]); //keep same as prev since null arrays have no data (so we can later keep a running total)(ie no -1 values) - dataLengthsFromHost_[i] = dataLen; - colDescs += 8; //0x9911=2, datatype=2, datalen=4 -> 8 - - } - } - - - //headerLength is len of all non-relevant datastream data and count and 9911s and 9912s (not array header portion only!) - headerLength = colDescs - offset_ ; //above, colDescs did not start at 0, just decrement offset - //Here, lengthFromHost_ is length of all the indicators and data - lengthFromHost_ = headerLength + indicatorLenAll + dataLenAll; //total size of x382f/x3901 - - rawBytes_ = rawBytes; - headerOffsetFromHost_ = offset_; - indicatorOffsetFromHost_ = offset_ + headerLength; - dataOffsetFromHost_ = indicatorOffsetFromHost_ + indicatorLenAll; //@array start of data in rawBytes[] - //Note: end of stream offset= offset_ + lengthFromHost_ - - } - else { - //input array - //This part is when sending input parms x382f - rawBytes_ = rawBytes; - //offset_ is start of header block (including non array info not used) - offset_ = offset; //index into rawBytes_[] (toHost) - headerCurOffsetToHost_ = offset_ + actual382fInArrayStart_; //initialize to 4 for consistency token - setColumnCount (columnCount_); - - indicatorCurOffsetToHost_ = offset_ + actual382fInArrayStart_ + headerTotalSizeToHost_; //index into rawBytes_[] (toHost) - dataCurOffsetToHost_ = indicatorCurOffsetToHost_ + indicatorTotalSizeToHost_; //index into rawBytes_[] (toHost) - } - } - - - - public int getLength () - { - if(dataTotalSizeToHost_ == -1) - return lengthFromHost_; //total stream length - else - return actual382fInArrayStart_ + headerTotalSizeToHost_ + indicatorTotalSizeToHost_ + dataTotalSizeToHost_; - } - - - - public int getConsistencyToken () - { - //from output stream - return BinaryConverter.byteArrayToInt (rawBytes_, offset_); - } - - - - public int getRowCount () - { - return rowCount_; - } - - - - public int getColumnCount () - { - return columnCount_; - } - - - - public int getIndicatorSize () - { - return indicatorSize_; - } - - - - public int getRowSize () - { - //@array no-op - return -1; - } - - - - public int getIndicator (int rowIndex, int columnIndex) - { - return getIndicator(rowIndex, columnIndex, -1); //@nullelem -1 is for getting indicator of array (not element) or non-array data type - } - - - - public int getRowDataOffset (int rowIndex) - { - //return offset to start of row. In our case we only have 1 row, so we can ignore rowIndex. (for now at least) - //@array - if(dataCurOffsetToHost_ == -1) - return dataOffsetFromHost_; - else - return dataCurOffsetToHost_; //Note that this index may increment with each write to the byte array. (but currently does not) - - } - - - - public byte[] getRawBytes () - { - //@array - return rawBytes_; - } - - - - public void setConsistencyToken (int consistencyToken) - { - //same for both input and output - BinaryConverter.intToByteArray (consistencyToken, rawBytes_, - offset_); //@array - } - - - - public void setRowCount (int rowCount) - { - //@array no-op - - } - - - - public void setColumnCount (int columnCount) - { - //input parm offset only - BinaryConverter.shortToByteArray ((short) columnCount, rawBytes_, - headerCurOffsetToHost_); //@array - headerCurOffsetToHost_ += 2; //increment to location of first 9911/9912 - } - - - - public void setIndicatorSize (int indicatorSize) - { - //@array no-op - } - - - - public void setRowSize (int rowSize) - { - //@array no-op - } - - /** - * - * @param columnIndex - * @param type type of column - * @param indicatorValue - * @param elementDataType if type is array, then type of elements in array - * @param dataTypeSize size of data (if array, then array length * element datatype size) - * @param arrayLength - */ - public void setHeaderColumnInfo (int columnIndex, short type, short indicatorValue, short elementDataType, int dataTypeSize, short arrayLength) - { - //3 possibilities: - //1 Array = �9911'x , data type 2 bytes, data length 4 bytes, # of data items 4 bytes - //2 Null Array = �9911'x , FFFF (9911 + indicator) - //3 NonArray = �9912'x , data type 2 bytes, data length 4 bytes - if(type == SQLData.NATIVE_ARRAY) - { - if(indicatorValue == 0) - { - //1 - BinaryConverter.shortToByteArray ((short) 0x9911, - rawBytes_, headerCurOffsetToHost_); - headerCurOffsetToHost_ += 2; //increment 2 bytes - - //set datatype of element - BinaryConverter.shortToByteArray (elementDataType, - rawBytes_, headerCurOffsetToHost_); - headerCurOffsetToHost_ += 2; //increment 2 bytes - - //set element data size - BinaryConverter.intToByteArray (dataTypeSize, - rawBytes_, headerCurOffsetToHost_); - headerCurOffsetToHost_ += 4; //increment 2 bytes - - //set array length - BinaryConverter.intToByteArray (arrayLength, - rawBytes_, headerCurOffsetToHost_); - headerCurOffsetToHost_ += 4; //increment 4 bytes //@array2 - - } - else - { - //2 - BinaryConverter.shortToByteArray ((short) 0x9911, - rawBytes_, headerCurOffsetToHost_); - headerCurOffsetToHost_ += 2; //increment 2 bytes - - //set indicator value of array (not elements) - BinaryConverter.shortToByteArray ((short) indicatorValue, - rawBytes_, headerCurOffsetToHost_); - headerCurOffsetToHost_ += 2; //increment 2 bytes - - - } - - } - else - { - - //3 non array type - BinaryConverter.shortToByteArray ((short) 0x9912, - rawBytes_, headerCurOffsetToHost_); - headerCurOffsetToHost_ += 2; //increment 2 bytes - - //set datatype of column - BinaryConverter.shortToByteArray (type, - rawBytes_, headerCurOffsetToHost_); - headerCurOffsetToHost_ += 2; //increment 2 bytes - - //set length of data - BinaryConverter.intToByteArray (dataTypeSize, - rawBytes_, headerCurOffsetToHost_); - headerCurOffsetToHost_ += 4; //increment 2 bytes - - - } - - } - - - public void setIndicator (int rowIndex, int columnIndex, int indicator) - { - //Call this iteratively for each element in the array. (for both null and non-null so that indicatorCurOffsetToHost_ will increment properly) - //We do not know anything about where to set the indicator for a given column since array lengths vary - - //A rowIndex of -1 tells us that the array is null. (need to update inside of header region id flow - //0x9911FFFF to 0x382F datastream) - if(rowIndex == -1) - { - //set header 9911ffff - //If array is null we set the indicator in the header part of the stream. - //This means that we must also set the header part at the same time. So call setHeaderColumnInfo() - setHeaderColumnInfo(columnIndex, (short)SQLData.NATIVE_ARRAY, (short)-1, (short)0, 0, (short)0); - //just need to set header for null arrays - } - else - { - //this sets indicator for both array elements and for non-array single data types - BinaryConverter.shortToByteArray ((short) indicator, - rawBytes_, indicatorCurOffsetToHost_); - indicatorCurOffsetToHost_ += 2; //increment 2 bytes - } - } - - - - /* - Specifies if variable-length fields are compressed. - @return true if variable-length fields are compressed, false otherwise. - */ - public boolean isVariableFieldsCompressed() - { - return false; - } - - // Resets the number of rows to the total number of rows minus the number of rows that contain aliases. - // This method is called by AS400JDBCDatabaseMetaData.parseResultData(). - public void resetRowCount(int rowCount){ - //@array no-op - } - - // Sets the number of aliases the result data contains. - // This method is called by AS400JDBCDatabaseMetaData.parseResultData(). - public void setAliasCount(int aliases){ - //@array no-op - } - - - //@array - //Returns indicator (-1 array index means to get indicator of array or non-array data) 0-x means indicator of that elem in the array - public int getIndicator (int rowIndex, int columnIndex, int arrayIndex){ - if(arrayIndex == -1) //@nullelem - { - if( dataIsArrayFromHost_[columnIndex] == 0) - { - //non array - return BinaryConverter.byteArrayToShort (rawBytes_, - indicatorOffsetFromHost_ + indicatorOffsetsFromHost_[columnIndex] ); //first elem in indicatorOffsetsFromHost_ is for non-array data - }else - { - return dataIsNullArrayFromHost_[columnIndex]; //@nullelem already set above in this array - //is array - /* if ( indicatorCountsFromHost_[columnIndex] == 0) //@nullelem - return -1; //array type and it is null (special case) (whole array is null, no elements) - else - { - //not null - return 0; - }*/ - } - } - else //get indicator of array element - { - return BinaryConverter.byteArrayToShort (rawBytes_, - indicatorOffsetFromHost_ + indicatorOffsetsFromHost_[columnIndex] + (arrayIndex * indicatorSize_)); //get indicator of array elem - } - } - - //@array - //returns size footprint of data in column - public int getDataTotalSize (int colIndex){ - return dataLengthsFromHost_[colIndex]; - } - - public int[] getDataLengthsFromHost(){ - return dataLengthsFromHost_; - } - - public int[] getIndicatorCountsFromHost(){ - return indicatorCountsFromHost_; - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/DBXARequestDS.java b/cvsroot/src/com/ibm/as400/access/DBXARequestDS.java deleted file mode 100644 index 5fa3ed9c1..000000000 --- a/cvsroot/src/com/ibm/as400/access/DBXARequestDS.java +++ /dev/null @@ -1,200 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBXARequestDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The DBXARequestDS class represents a request datastream to the -XA server. -**/ -class DBXARequestDS -extends DBBaseRequestDS -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - // Server id. - private static final int SERVER_XA = 0xE00A; - - - // Request ids. - public static final int REQUESTID_XA_CLOSE = 0x18A0; - public static final int REQUESTID_XA_COMMIT = 0x18A1; - public static final int REQUESTID_XA_COMPLETE = 0x18A2; - public static final int REQUESTID_XA_END = 0x18A3; - public static final int REQUESTID_XA_FORGET = 0x18A4; - public static final int REQUESTID_XA_OPEN = 0x18A5; - public static final int REQUESTID_XA_PREPARE = 0x18A6; - public static final int REQUESTID_XA_RECOVER = 0x18A7; - public static final int REQUESTID_XA_ROLLBACK = 0x18A8; - public static final int REQUESTID_XA_START = 0x18A9; - - - -/** -Constructs an XA Server request datastream. - -@param requestId The request id. -@param rpbId The request parameter block id. -@param operationResultBitmap The operation result bitmap. -@param parameterMarkerDescriptorHandle The parameter marker descriptor handle. -**/ - public DBXARequestDS(int requestId, - int rpbId, - int operationResultBitmap, - int parameterMarkerDescriptorHandle) - { - super(requestId, - rpbId, - operationResultBitmap, - parameterMarkerDescriptorHandle); - setServerID(SERVER_XA); - } - - - -/** -Sets the resource manager ID. - -@param value The resource manager ID. -@exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setResourceManagerID(int value) - throws DBDataStreamException - { - addParameter(0x38A0, value); - } - - - -/** -Sets the XA information. - -@param value The XA information. -@exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setXAInformation(byte[] value) - throws DBDataStreamException - { - addParameter(0x38A1, value); - } - - - -/** -Sets the Xid. - -@param value The Xid. -@exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setXid(byte[] value) - throws DBDataStreamException - { - addParameter(0x38A2, value); - } - - - -/** -Sets the handle. - -@param value The handle. -@exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setHandle(int value) - throws DBDataStreamException - { - addParameter(0x38A3, value); - } - - - -/** -Sets the flags. - -@param value The flags. -@exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setFlags(int value) - throws DBDataStreamException - { - addParameter(0x38A5, value); - } - - - -/** -Sets the count. - -@param value The count. -@exception DBDataStreamException If there is not enough space left in the data byte array. -**/ - void setCount(int value) - throws DBDataStreamException - { - addParameter(0x38A6, value); - } - -//@K1A -/** -Sets the CTL Timeout. - -@param value The number of seconds -@exception DBDataStreamException if there is not enough space left in the data byte array. -**/ - void setCtlTimeout(int value) - throws DBDataStreamException - { - addParameter(0x38A7, value); - } - -//@K1A -/** -Sets the Lock wait time. - -@param value The number of seconds -@exception DBDataStreamException if there is not enough space left in the data byte array. -**/ - void setLockWait(int value) - throws DBDataStreamException - { - addParameter(0x38A9, value); - } - -//@540 -/** -Sets whether lock sharing is allowed for loosely coupled transaction branches. - -@param value The 'lock sharing' setting: 0=="not shared", 1=="shared". -@exception DBDataStreamException if there is not enough space left in the data byte array. -**/ - void setXALooselyCoupledSupport(int value) - throws DBDataStreamException - { - if (value != 0) { // 0 is the default, don't bother sending it down - addParameter(0x38AA, (byte)0xE2); // "locks can be shared" @PDC value needs to be byte - } - } - -} - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/DDMACCSECReplyDataStream.java b/cvsroot/src/com/ibm/as400/access/DDMACCSECReplyDataStream.java deleted file mode 100644 index 998b124dd..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMACCSECReplyDataStream.java +++ /dev/null @@ -1,81 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMACCSECReplyDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -class DDMACCSECReplyDataStream extends DDMDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Check the reply. - boolean checkReply(int byteType) - { - if (getCodePoint() != DDMTerm.ACCSECRD) - { - Trace.log(Trace.ERROR, "DDM ACCSEC failed with code point:", data_, 8, 2); - return false; - } - if (byteType == AS400.AUTHENTICATION_SCHEME_PASSWORD) - { - if (data_.length < 19) - { - Trace.log(Trace.ERROR, "DDM ACCSEC failed: system may be set to *KERBEROS while client is not.", data_); - return false; - } - - int rc = get16bit(18); - if (rc == DDMTerm.SECCHKCD) - { - // The server didn't like the SECCHKCD. - Trace.log(Trace.ERROR, "DDM ACCSEC SECCHKCD failed:", data_, 18, 2); - return false; - } - if (rc != DDMTerm.SECTKN) - { - // The server didn't like the SECTKN. - Trace.log(Trace.ERROR, "DDM ACCSEC SECTKN failed:", data_, 18, 2); - return false; - } - } - return true; - } - - byte[] getServerSeed() - { - byte[] seed = new byte[8]; - System.arraycopy(data_, 20, seed, 0, 8); - return seed; - } - - void read(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving DDM ACCSEC reply..."); - // Receive the header. - byte[] header = new byte[6]; - if (readFromStream(in, header, 0, 6) < 6) - { - Trace.log(Trace.ERROR, "Failed to read all of the DDM EXCSAT Reply header."); - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - - // Allocate bytes for datastream. - data_ = new byte[BinaryConverter.byteArrayToUnsignedShort(header, 0)]; - System.arraycopy(header, 0, data_, 0, 6); - - // Read in the rest of the data. - readAfterHeader(in); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DDMACCSECRequestDataStream.java b/cvsroot/src/com/ibm/as400/access/DDMACCSECRequestDataStream.java deleted file mode 100644 index a57889ea1..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMACCSECRequestDataStream.java +++ /dev/null @@ -1,103 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMACCSECRequestDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -class DDMACCSECRequestDataStream extends DDMDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - DDMACCSECRequestDataStream(boolean useStrongEncryption, int byteType, byte[] iasp) - { - super(new byte[byteType == AS400.AUTHENTICATION_SCHEME_PASSWORD ? 28 : 16]); - - // Initialize the header: Don't continue on error, not chained, GDS id = D0, type = RQSDSS, no same request correlation. - setGDSId((byte)0xD0); - // setIsChained(false); - // setContinueOnError(false); - // setHasSameRequestCorrelation(false); - setType(1); - // Set total length remaining after header. - if (byteType == AS400.AUTHENTICATION_SCHEME_PASSWORD) - { - set16bit(22, 6); - } - else - { - set16bit(10, 6); - } - - set16bit(DDMTerm.ACCSEC, 8); // Set ACCSEC code point. - set16bit(6, 10); // Set SECMEC length. - set16bit(DDMTerm.SECMEC, 12); // Set SECMEC code point. - // Set value of SECMEC parm. - switch (byteType) - { - case AS400.AUTHENTICATION_SCHEME_GSS_TOKEN: - set16bit(11, 14); - break; - case AS400.AUTHENTICATION_SCHEME_PROFILE_TOKEN: - set16bit(16, 14); - break; - default: - if (useStrongEncryption) - { - // Use a value of SECMEC=8 for encrypted password. - set16bit(8, 14); - } - else - { - // Use a value of SECMEC=6 for a substituted password. - set16bit(6, 14); - } - - // Need to send a client seed as the security token. - // The SECTKN is 8 bytes and the PASSWORD is 20 bytes. - set16bit(12, 16); // Set length of this+remaining SECTKN bytes. - set16bit(DDMTerm.SECTKN, 18); // Set SECTKN code point. - - // This code taken from AS400XChgRandSeedDS constructor. Generate the client seed. We generate a "random" seed using the current time in milliseconds. This seed will be used to encrypt the password. - long t = System.currentTimeMillis(); - - // Performance: break into 2 ints first and avoid long temporaries. - int high = (int)(t >>> 32); - int low = (int)t; - - data_[20] = (byte)(high >>> 24); - data_[21] = (byte)(high >>> 16); - data_[22] = (byte)(high >>> 8); - data_[23] = (byte)high; - - data_[24] = (byte)(low >>> 24); - data_[25] = (byte)(low >>> 16); - data_[26] = (byte)(low >>> 8); - data_[27] = (byte)low; - } - } - - byte[] getClientSeed() - { - byte[] seed = new byte[8]; - System.arraycopy(data_, 20, seed, 0, 8); - return seed; - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending DDM ACCSEC request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DDMAS400MessageReply.java b/cvsroot/src/com/ibm/as400/access/DDMAS400MessageReply.java deleted file mode 100644 index 4873d965a..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMAS400MessageReply.java +++ /dev/null @@ -1,165 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMAS400MessageReply.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Vector; - -/** - *Represents the S38MSGRM DDM data stream. This reply stream is returned - *when an error has occurred for which there is an IBM i error message(s). - *Format: - * Bytes Description - * ---------- ------------------------------------------------------- - * 0-5 Header - * 6-9 LL-CP for S38MSGRM - * The folowing items are optional and may or may not exist. - * ? LL-CP, 16-bit severity code - * ? LL-CP, 7-byte message id - * ? LL-CP, 2-byte msg type - * ? LL-CP, message file name - * ? LL-CP, server diagnostic info - * ? LL-CP, message replacement data - * ? LL-CP, message text -**/ -class DDMAS400MessageReply extends DDMReplyDataStream -{ - ConverterImplRemote conv; //@B5C - Vector messages_ = new Vector(); - String msgId_ = null; - //String msgFile_ = null; - //String msgReplData_ = null; - String msgText_ = null; - //int msgType_ = -1; // Set msgType_ to -1 to indicate that it has not been set - //String srvDiagnostic_ = null; - int svrCode_ = -1; // Set svrCode_ to -1 to indicate that it has not been set - - /** - *Constructs an S38MSGRM reply message data stream. - *@param system The system we are connected to. - *Used to determine CCSID/encoding for conversions. - *@param data the S38MSGRM data - **/ - DDMAS400MessageReply(AS400ImplRemote system, byte[] data) //@B5C - throws AS400SecurityException, - InterruptedException, - IOException - { - super(data); - conv = ConverterImplRemote.getConverter(system.getCcsid(), system); //@B5C - parseMessageInfo(); - } - - /** - *Returns the first AS400Message object associated with this object. - *@return the first AS400Message object associated with this object. - **/ - AS400Message getAS400Message() - { - return (messages_.size() > 0)? (AS400Message)messages_.elementAt(0): new AS400Message(); - } - - /** - *Returns the AS400Message objects associated with this object. - *@return the AS400Message objects associated with this object. - **/ - AS400Message[] getAS400MessageList() - { - if (messages_.size() > 0) - { - AS400Message[] msgList = new AS400Message[messages_.size()]; - messages_.copyInto(msgList); - return msgList; - } - return new AS400Message[0]; - } - - /** - *Extracts the AS400Messages from the data supplied on the constructor - *for this object. - **/ - void parseMessageInfo() - { - int offset = 8; // Start after header - int length; - int codePoint; - while(offset < data_.length) - { // Go through the data extracting AS400Messages - codePoint = get16bit(offset); - length = get16bit(offset - 2); - if (codePoint == DDMTerm.S38MSGRM) - { // This is an AS400Message; extract it. - AS400Message msg = getMessage(offset + 2, length - 4); - messages_.addElement(msg); - } - offset += length; - } - } - - /** - *Extracts the message details for a single AS400Message. - *@param offset the offset in data_ at which to start extracting. - *@param len the length of the data for this AS400Message. - *@return the AS400Message that the data represents. - **/ - AS400Message getMessage(int offset, int len) - { - int end = offset + len; - boolean done = false; - int codePoint = get16bit(offset + 2);; - int length; - while (!done && (offset < end)) - { // Extract the information we want (if it exists) from the message data - length = get16bit(offset); // Length of a particular piece of message info - codePoint = get16bit(offset + 2); // Code point indicating which particular - // piece of message info we are at. - switch(codePoint) - { - case DDMTerm.SVRCOD: // Severity code; we want it - svrCode_ = get16bit(offset + 4); - offset += length; - break; - case DDMTerm.S38MID: // Message id; we want it - msgId_ = conv.byteArrayToString(data_, offset + 4, length - 4); - offset += length; - break; - case DDMTerm.S38MTEXT: // Message text; we want it - msgText_ = conv.byteArrayToString(data_, offset + 6, get16bit(offset + 4)); - offset += length; - break; - case DDMTerm.S38MTYPE: // Message type - case DDMTerm.S38MDATA: // Message substitution data (already in message text) - case DDMTerm.S38MFILE: // Message file - case DDMTerm.SRVDGN: // Server diagnostics - offset += length; // We don't want any of these - break; - default: // Done with this particular AS400Message - done = true; - break; - } - } - // Create an AS400Message object to add to our list of AS400Messages in this reply - // msgId_ and msgText_ may be null if no information was supplied by the - // server for these items (yes it does happen, see AS400File.close()) - AS400Message msg = new AS400Message(msgId_, msgText_); - if (svrCode_ != -1) - { - msg.setSeverity(svrCode_); - } - return msg; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/DDMASPReplyDataStream.java b/cvsroot/src/com/ibm/as400/access/DDMASPReplyDataStream.java deleted file mode 100644 index 1e4557988..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMASPReplyDataStream.java +++ /dev/null @@ -1,53 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMASPReplyDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -class DDMASPReplyDataStream extends DDMDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - - // Check the reply. - boolean checkReply() - { - if (getCodePoint() != DDMTerm.CMDCMPRM) - { - Trace.log(Trace.ERROR, "DDM ASP failed with code point:", data_, 8, 2); - return false; - } - return true; - } - - void read(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving DDM ASP reply..."); - // Receive the header. - byte[] header = new byte[6]; - if (readFromStream(in, header, 0, 6) < 6) - { - Trace.log(Trace.ERROR, "Failed to read all of the DDM ASP Reply header."); - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - - // Allocate bytes for datastream. - data_ = new byte[BinaryConverter.byteArrayToUnsignedShort(header, 0)]; - System.arraycopy(header, 0, data_, 0, 6); - - // Read in the rest of the data. - readAfterHeader(in); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DDMASPRequestDataStream.java b/cvsroot/src/com/ibm/as400/access/DDMASPRequestDataStream.java deleted file mode 100644 index a86415faf..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMASPRequestDataStream.java +++ /dev/null @@ -1,45 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMASPRequestDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -class DDMASPRequestDataStream extends DDMDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - DDMASPRequestDataStream(byte[] iasp) - { - super(new byte[32]); - - // Initialize the header: Don't continue on error, not chained, GDS id = D0, type = RQSDSS, no same request correlation. - setGDSId((byte)0xD0); - // setIsChained(false); - // setContinueOnError(false); - // setHasSameRequestCorrelation(false); - setType(1); - set16bit(26, 6); // Total length remaining after header. - set16bit(DDMTerm.SXXASPRQ, 8); // Set ASPRQ code point. - set16bit(22, 10); // Set RDBNAM length. - set16bit(DDMTerm.RDBNAM, 12); // Set RDBNAM code point. - System.arraycopy(iasp, 0, data_, 14, iasp.length); - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending DDM ASP request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DDMDataStream.java b/cvsroot/src/com/ibm/as400/access/DDMDataStream.java deleted file mode 100644 index 77dd3d05a..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMDataStream.java +++ /dev/null @@ -1,481 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Hashtable; - -// Base class for DDM data streams. Provides methods to access the DDM data stream header. -class DDMDataStream extends DataStream -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - //////////////////////////////////////////////////////////////////////////// - // DDM header length is 6 bytes: - // Description Bytes - // ------------------------------- ------ - // Total length of data stream 0,1 - // if the hi-order bit of byte 0 is on, the datastream is continued - // SNA GDS architecture ID, (x'D0') 2 - // 1-byte format identifier* 3 - // Request correlation identifier 4,5 - // - // *Format identifier bits: - // Bit Description/Values - // --- ------------------------------- - // 0 Reserved bit, always 0. - // 1 Indicates if structure is chained, 0 = No, 1 = Yes. - // 2 Indicates is continue after error, 0 = No, 1 = Yes. - // 3 Indicates if next DSS has same request correlator, 0 = No, 1 = Yes. - // 4-7 4-bit value indicating type of data stream: - // '0001' = RQSDSS, '0010' = RPYDSS, '0011' = OBJDSS - //////////////////////////////////////////////////////////////////////////// - protected static final int HEADER_LENGTH = 6; - - // Maximum data stream length. - protected static final int MAX_DATA_STREAM_LEN = 32767; - - // Continuation bit. - protected static final int CONTINUATION_MASK = 0x80; - - // Determine/set chaining bit - protected static final byte CHAINED_MASK = 0x40; - - // Determine/set continue on error bit - protected static final byte CONTINUE_ON_ERROR_MASK = 0x20; - - // Indicates if type is OBJDSS - protected static final int OBJECT_DATA_STREAM = 17; - - // Indicates if type is RPYDSS - protected static final int REPLY_DATA_STREAM = 16; - - // Indicates if type is RQSDSS - protected static final int REQUEST_DATA_STREAM = 1; - - // Determine/set same correlation number bit - protected static final byte SAME_CORRELATOR_MASK = 0x10; - - // Determines type of the data stream - protected static final byte TYPE_MASK = 0x03; - - // Constructs a model of this data stream object. Read from the InputStream to obtain the data stream data for the model. - // @param is InputStream from which to read to obtain the data stream contents. - // @param dataStreams Hashtable containing DDMDataStream objects from which to obtain a model of this object. - // @param system The system from which to get the CCSID for conversion. - // @return DDMDataStream object - // @exception IOException We are unable to read from the input stream for some reason. - static DDMDataStream construct(InputStream is, Hashtable dataStreams, AS400ImplRemote system, int connectionID) throws IOException - { - // Construct a DDM data stream to receive the data stream header. By using the default constructor for DDMDataStream, we get a data stream of size HEADER_LENGTH. - DDMDataStream baseDataStream = new DDMDataStream(); - - // Receive the header. - if (readFromStream(is, baseDataStream.data_, 0, HEADER_LENGTH, connectionID) < HEADER_LENGTH) - { - Trace.log(Trace.ERROR, "Failed to read all of the DDM data stream header."); - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - - // Fetch a 'model' of this particular data stream. - DDMDataStream modelDataStream = (DDMDataStream)dataStreams.get(baseDataStream); - - DDMDataStream newDataStream = null; - if (modelDataStream == null) - { - // No model was found in the hash table, so we will return a generic data stream. - newDataStream = new DDMDataStream(); - } - else - { - // Get a new instance of the data stream - newDataStream = (DDMDataStream) modelDataStream.getNewDataStream(); - if (newDataStream == null) - { - newDataStream = new DDMDataStream(); - } - } - - newDataStream.setSystem(system); - newDataStream.setConnectionID(connectionID); - - int packetLength = baseDataStream.getLength(); - if (packetLength - HEADER_LENGTH > 0) - { - // There is more data to read from the input stream for this data stream - if (baseDataStream.isContinued()) - { - // If the data stream has the continuation bit on (hi order bit of the first byte of data_), the data being sent to us on the input stream has been broken up into packets. This is not not the same as chaining. When a DDM data stream is continued, the next packet to be received does not have a full header. Only two bytes of header information (the length of the packet) are sent with the data. - // So we need to: - // Read the data specified for the first packet - this will be 32767 bytes. - // Read the first two bytes of data from the next packet into a separate byte array. - // These two bytes are the length of the packet. We then read the rest of the packet into our byte array output stream. - byte[] maxPacket = new byte[32765]; // 32K - 2 for the two bytes of length - byte[] nextLength = new byte[2]; // Two byte array to hold size of continued packets - - // Initialize the header section of the new data stream. - ByteArrayOutputStream b = new ByteArrayOutputStream(); - b.write(baseDataStream.data_, 0, HEADER_LENGTH); - // Read the first packet from the input stream - byte[] packet = new byte[packetLength - HEADER_LENGTH]; - if (readFromStream(is, packet, 0, packetLength - HEADER_LENGTH, connectionID) < packetLength - HEADER_LENGTH) - { - Trace.log(Trace.ERROR, "Failed to read all of the DDM data stream packet."); - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - b.write(packet); - - // Get subsequent packets - boolean done = false; - while (!done) - { - // Get the length of the next packet - if (readFromStream(is, nextLength, 0, 2, connectionID) < 2) - { - Trace.log(Trace.ERROR, "Failed to read all of the DDM data stream packet length."); - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - packetLength = BinaryConverter.byteArrayToUnsignedShort(nextLength, 0); - if (packetLength == 0xFFFF) - { - // Hi-order bit is on, indicating that there are more packets and that this packet is 32K in length - packet = maxPacket; // Use the maxPacket array to store the data - packetLength = 0x7FFF; // Turn off the hi-order bit to get the true length - } - else - { - // This is the last packet; create an array of the appropriate size - packet = new byte[packetLength - 2]; - done = true; - } - - // Read the rest of the packet from the input stream - if (readFromStream(is, packet, 0, packetLength - 2, connectionID) < packetLength - 2) - { - Trace.log(Trace.ERROR, "Failed to read all of the DDM data stream continuation packet."); - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - b.write(packet); - } - - // Copy the data read into the data stream object - newDataStream.data_ = b.toByteArray(); - } - else - { - // Data stream is not continued (typical case) - newDataStream.data_ = new byte[packetLength]; - System.arraycopy(baseDataStream.data_, 0, newDataStream.data_, 0, HEADER_LENGTH); - - if (newDataStream.data_.length - HEADER_LENGTH > 0) - { - // Receive any remaining bytes. - newDataStream.readAfterHeader(is); - } - } - } - - return newDataStream; - } - - // Constructs an empty DDMDataStream object. - DDMDataStream() - { - super(HEADER_LENGTH); - } - - // Constructs a DDMDataStream object. - // @param data the data with which to initialize this data stream. - DDMDataStream(byte [] data) - { - super(HEADER_LENGTH, data); - // The total length of the data stream is the length of the byte array, data - setLength(data_.length); - } - - // Constructs a DDMDataStream object with the specified total length. - // @param totalLength the total length that the data stream will be. - DDMDataStream(int totalLength) - { - super(HEADER_LENGTH); - data_ = new byte[totalLength]; - // The caller has supplied the total length of the data stream - setLength(data_.length); - } - - // Indicates whether to continue to the next chained data stream if an error occurs. - // @return true if we are to continue on error, false otherwise. - boolean continueOnError() - { - // Use bit-wise & with the continue on error mask to get byte data that contains a 1 or 0 for the continue on error bit and 0's in all other bit positions. - return (data_[3] & CONTINUE_ON_ERROR_MASK) != 0; - } - - // Retrieve the code point indicating the DDM term that this data stream represents. - // Note: This is the DDM term at the level below RQSDSS, RPYDSS, and OBJDSS. If this data stream has not yet had any data besides the header associated with it, 0 is returned. - // @return The code point indicating the DDM term that this data stream represents. - int getCodePoint() - { - if (data_.length > HEADER_LENGTH) - { - return get16bit(HEADER_LENGTH + 2); - } - return 0; - } - - // Retrieve the request correlation for this data stream. - // @return The request correlation number. - int getCorrelation() - { - // The request correlation number starts at byte 4 - return get16bit(4); - } - - // Retrieve the GDS architecture id. Currently, this should always be x'D0'. - // @return byte representing the GDS id. - byte getGDSId() - { - return data_[2]; - } - - // Retrieve the total length of the data stream. - // @return The total length of this data stream - int getLength() - { - int len; - // Length is the first two bytes of data_. - if (isContinued()) - { - byte[] length = new byte[2]; - System.arraycopy(data_, 0, length, 0, 2); - // Do a bit-wise "and" with 0x7F to turn of the hi-order bit and leave the remaining bits unchanged - length[0] &= 0x7F; - len = BinaryConverter.byteArrayToUnsignedShort(length, 0); - } - else - { - len = get16bit(0); - } - - return len; - } - - // Retrieve integer value indicating the type of this data stream. - // @return Integer representation of the type of this data stream. Valid values are: 1 = RQSDSS, 2 = RPYDSS or 3 = OBJDSS. - int getType() - { - // Use bit-wise & with the type mask to get byte data that contains binary 0001, 0010 or 0011 indicating the type of the data stream. - return data_[3] & TYPE_MASK; - } - - // Retrieve the hash code for this datastream. - // Note: Reply data stream sub-classes should override this method to return the reply id directly instead of calling getType(). - // @returns The hash code for this object. - public int hashCode() - { - // We use the data stream type for the hash code. - return getType(); - } - - // Indicates if the next data stream will have the same request correlation. - // @return true if the next data stream will have the same request correlation, false otherwise. - boolean hasSameRequestCorrelation() - { - // Use bit-wise & with the same correlator mask to get byte data that contains a 1 or 0 for the same correlator bit and 0's in all other bit positions. - return ((data_[3] & SAME_CORRELATOR_MASK) != 0); - } - - // Indicates whether this data stream is chained. - // @return true if this data stream is chained, false otherwise. - boolean isChained() - { - // Use bit-wise & with the chained mask to get byte data that contains a 1 or 0 for the chained bit and 0's in all other bit positions. - return ((data_[3] & CHAINED_MASK) != 0); - } - - // Indicates whether this data stream is continued. If a data stream is continued, the next reply will have a truncated header that consists of two bytes indicating the length of the reply. This differs from chaining where a complete header is sent with the object. - boolean isContinued() - { - return (data_[0] & CONTINUATION_MASK) != 0; - } - - // Set whether to continue to the next chained data stream if an error occurs. - // @param cont true if we are to continue on error, false otherwise. - void setContinueOnError(boolean cont) - { - if (cont) - { - // Do a bit-wise "or" with the continue on error mask to set the continue on error bit to 1 if it is 0 and to leave all other bits unchanged. - data_[3] |= CONTINUE_ON_ERROR_MASK; - } - else - { - // Do a bit-wise and with logical "not" of the continue on error mask to set the continue on error bit to 0 if it is 1 and to leave all remaining bits unchanged. - data_[3] &= (~CONTINUE_ON_ERROR_MASK); - } - } - - // Set the request/reply correlation for this data stream. - // @param correlation the request correlation number. - void setCorrelation(int correlation) - { - set16bit(correlation, 4); - } - - // Set the GDS architecture id. Currently, this should always be x'D0'. - // @param id the GDS id. - void setGDSId(byte id) - { - data_[2] = id; - } - - // Set whether this data stream is chained. - // @param chained true if this data stream is chained, false otherwise. - void setIsChained(boolean chained) - { - if (chained) - { - // Do a bit-wise "or" with the chained mask to set the chained bit to 1 if it is 0 and to leave all other bits unchanged. - data_[3] |= CHAINED_MASK; - } - else - { - // Do a bit-wise and with logical "not" of the chained mask to set the chained bit to 0 if it is 1 and to leave all remaining bits unchanged. - data_[3] &= ~CHAINED_MASK; - } - } - - // Set the total length of the data stream. - // @param length the total length of this data stream. - void setLength(int length) - { - // Set the first two bytes of data_. - set16bit(length, 0); - } - - // Set whether the next data stream will have the same request correlation. - // @param same true if the next data stream will have the same request correlation, false otherwise. - void setHasSameRequestCorrelation(boolean same) - { - if (same) - { - // Do a bit-wise "or" with the same correlator mask to set the same correlator to 1 if it is 0 and to leave all other bits unchanged. - data_[3] |= SAME_CORRELATOR_MASK; - } - else - { - // Do a bit-wise and with logical "not" of the same correlator mask to set the same correlator bit to 0 if it is 1 and to leave all remaining bits unchanged. - data_[3] &= (~SAME_CORRELATOR_MASK); - } - } - - // Set the type of this data stream. - // @param type the type of this data stream. Valid values are: 1 = RQSDSS, 2 = RPYDSS or 3 = OBJDSS. - void setType(int type) - { - if (type == 1) - { - // Do a bit-wise "or" with byte 0x01 to set the type to a request DSS and leave all other bits unchanged. - data_[3] |= 0x01; - } - else if (type == 2) - { - // Do a bit-wise "or" with byte 0x02 to set the type to a reply DSS and leave all other bits unchanged. - data_[3] |= 0x02; - } - else - { - // Do a bit-wise "or" with byte 0x03 to set the type to an object DSS and leave all other bits unchanged. - data_[3] |= 0x03; - } - } - - // Write the data in this data stream out to the specified OutputStream. - // @param out OutputStream to which to write the data. - // @exception IOException Unable to write to the output stream. - void write(OutputStream out) throws IOException - { - // Write the data stream to the output stream. If the data stream is longer than the maximum, set the length to the maximum and signal continuation. The high bit of the length signals continuation (on = continued, off = not continued). - int bytesToWrite = data_.length; - if (bytesToWrite > MAX_DATA_STREAM_LEN) - { - bytesToWrite = MAX_DATA_STREAM_LEN; - data_[0] = (byte)0xFF; data_[1] = (byte)0xFF; - } - - // Write the data stream. - synchronized(out) - { - out.write(data_, 0, bytesToWrite); - out.flush(); - } - if (Trace.isTraceOn()) Trace.log(Trace.DATASTREAM, "DDMDataStream.write() (connID="+connectionID_+"):", data_, 0, bytesToWrite); - - // Is there data stream remaining to be written? If so, the rest of the data stream is written as packets. Packets are similar to regular data streams but lack a full header. The first two bytes of a packet indicate the length of the data in the packet (doesn't include the two byte packet length indicator). The high bit of the length controls continuation (on = continued, off = not continued). The rest of the packet is data. - if (data_.length > bytesToWrite) - { - // Write the rest of the data stream as packets. - DataOutputStream dos = new DataOutputStream(out); - for (int i = bytesToWrite, packetLength = 0; i < data_.length; i += packetLength - 2) - { - // Calculate the length of the next packet. - packetLength = data_.length - i + 2; - - // Are there more bytes to write than the maximum allowed? - if (packetLength > MAX_DATA_STREAM_LEN) - { - // Set the bytes to write to the maximum allowed. - packetLength = MAX_DATA_STREAM_LEN; - - // Write the two byte packet length with the high bit on. - synchronized(out) - { - dos.writeShort((short)0xFFFF); - dos.flush(); - } - if (Trace.isTraceOn()) Trace.log(Trace.DATASTREAM, "DDMDataStream.write() continuation (connID="+connectionID_+"):", new byte[] {(byte)0xFF, (byte)0xFF}); - } - else - { - // Write the two byte packet length. - synchronized(out) - { - dos.writeShort(packetLength); - dos.flush(); - } - if (Trace.isTraceOn()) Trace.log(Trace.DATASTREAM, "DDMDataStream.write() packetLength (connID="+connectionID_+"):", new byte[] {(byte)(packetLength >> 8), (byte)packetLength}); - } - - // Write the data. - synchronized(out) - { - dos.write(data_, i, packetLength - 2); - dos.flush(); - } - if (Trace.isTraceOn()) - { - Trace.log(Trace.DATASTREAM, "DDMDataStream.write() (connID="+connectionID_+"):", data_, i, packetLength - 2); - } - } - } - synchronized(out) - { - out.flush(); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DDMEXCSATReplyDataStream.java b/cvsroot/src/com/ibm/as400/access/DDMEXCSATReplyDataStream.java deleted file mode 100644 index 60335fece..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMEXCSATReplyDataStream.java +++ /dev/null @@ -1,119 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMEXCSATReplyDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Hashtable; - -class DDMEXCSATReplyDataStream extends DDMDataStream -{ - // Check the reply. - boolean checkReply() - { - if (getCodePoint() != DDMTerm.EXCSATRD) - { - Trace.log(Trace.ERROR, "DDM EXCSAT failed with code point:", data_, 8, 2); - String text; - switch (getCodePoint()) - { // Some common errors, that might be meaningful to user: - case DDMTerm.AGNPRMRM : text = "Permanent agent error."; break; - case DDMTerm.CMDATHRM : text = "Not authorized to command."; break; - case DDMTerm.CMDCHKRM : text = "Command check."; break; - case DDMTerm.CMDNSPRM : text = "Command not supported."; break; - case DDMTerm.PRMNSPRM : text = "Parameter not supported."; break; - case DDMTerm.RDBAFLRM : text = "RDB access failed reply message."; break; - case DDMTerm.RDBATHRM : text = "Not authorized to RDB."; break; - case DDMTerm.SYNTAXRM : text = "Data stream syntax error."; break; - default: text = null; - } - if (text != null) Trace.log(Trace.ERROR, text); - return false; - } - return true; - } - - // Parses the returned terms, and returns the value of the EXTNAM term. - // This is the job identifier for the DDM Host Server job. - byte[] getEXTNAM() - { - byte[] extNam = null; - - int offset = 6; // Start after header. - int streamLL = get16bit(offset); // LL: Total length of the data stream after the header. - //int streamCP = get16bit(offset+2); // CP: Code point of reply - - // Assume we've already verified the datastream code point. - //if (streamCP != DDMTerm.EXCSATRD) - //{ - // if (Trace.traceOn_) Trace.log(Trace.WARNING, "Incorrect code point: 0x" + Integer.toHexString(streamCP)); - // return new byte[0]; - //} - - if (streamLL <= 4) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Insufficient reply length: 0x" + Integer.toHexString(streamLL)); - return new byte[0]; - } - - offset += 4; // get past the reply's LL/CP - - while (!(offset > (data_.length - 4))) - { - // Note to maintenance programmer: If you are generalizing this loop logic so as to parse any term in any DDM datastream, be aware that there's special DRDA term-parsing logic in the case where the high-order bit of the LL value is turned on. - // Assumption: The high-order LL bit will never be turned on in an EXCSAT reply. - - int termLL = get16bit(offset); // Get LL (length of term) - int termCP = get16bit(offset+2); // get CP (code point of this term) - - switch(termCP) - { - case DDMTerm.EXTNAM: - { - if (termLL > 4) - { - extNam = new byte[termLL-4]; - System.arraycopy(data_, offset+4, extNam, 0, extNam.length); - } - else { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "No data returned in EXTNAM term."); - } - break; - } - } - offset += termLL; - } - - return (extNam == null ? new byte[0] : extNam); - } - - void read(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving DDM EXCSAT Reply..."); - // Receive the header. - byte[] header = new byte[6]; - if (readFromStream(in, header, 0, 6) < 6) - { - Trace.log(Trace.ERROR, "Failed to read all of the DDM EXCSAT reply header."); - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - - // Allocate bytes for datastream. - data_ = new byte[BinaryConverter.byteArrayToUnsignedShort(header, 0)]; - System.arraycopy(header, 0, data_, 0, 6); - - // Read in the rest of the data. - readAfterHeader(in); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DDMEXCSATRequestDataStream.java b/cvsroot/src/com/ibm/as400/access/DDMEXCSATRequestDataStream.java deleted file mode 100644 index d91732d2e..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMEXCSATRequestDataStream.java +++ /dev/null @@ -1,191 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMEXCSATRequestDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -// Constructs the DDM "exchange server attributes" data stream request. -// -// Exchange attributes request: -// Term = EXCSAT. -// Parms = SRVCLSNM -> CHRSTRDR => Character string containing server class name in EBCDIC. -// EXTNAM => Character string containing external name in EBCDIC. -// -// Size = 6 --> Header (0 - 5). -// 2 --> LL Length of EXCSAT term and parms (6, 7). -// 2 --> CP EXCSAT code point (8, 9). -// 2 --> LL Length of EXTNAM term and parms (10, 11). -// 2 --> CP EXTNAM code point (12, 13). -// 5 --> EXTNAM parm (JT400) (14 - 18). -// 2 --> LL Length of SRVCLSNM term and parm (19, 20). -// 2 --> CP SRVCLSNM code point (21, 22). -// 2 --> LL Length of CHRSTRDR term and parms (23, 24). -// 2 --> CP CHRSTRDR code point (25, 26). -// 3 --> SRVCLSNM parm (QAS) (27 - 29). -// 2 --> LL Length of MGRLVLLS term and parms. -// 2 --> CP MGRLVLLS code point. -// 4 * 23 --> Manager level parms and their values. -// ---- -// 126 --> Total length of the data stream. -class DDMEXCSATRequestDataStream extends DDMDataStream -{ - private static final int TOTAL_LENGTH = 126; - private static final int HEADER_LENGTH = 6; - - DDMEXCSATRequestDataStream() - { - super(new byte[TOTAL_LENGTH]); - - // Initialize the header: Don't continue on error, not chained, GDS id = D0, type = RQSDSS, no same request correlation. - setGDSId((byte)0xD0); - // setIsChained(false); - // setContinueOnError(false); - // setHasSameRequestCorrelation(false); - setType(1); - - int offset = HEADER_LENGTH; // start just after the 6-byte header - - set16bit(TOTAL_LENGTH - HEADER_LENGTH, offset); // Set length of EXCSAT term and parms. - set16bit(DDMTerm.EXCSAT, offset+2); // Set code point for EXCSAT term. - offset += 4; - - set16bit(9, offset); // Set length of EXTNAM parm. (LL + CP + parm) - set16bit(DDMTerm.EXTNAM, offset+2); // Set code point for EXTNAM parm. - offset += 4; - // Set the external name (EXTNAM parm). - data_[offset++] = (byte)0xD1; data_[offset++] = (byte)0xE3; data_[offset++] = (byte)0xF4; data_[offset++] = (byte)0xF0; data_[offset++] = (byte)0xF0; // EBCDIC "JT400" - // Note: We send EXTNAM in order to get the DDM Server's job info returned in the reply. - - set16bit(11, offset); // Set length of SRVCLSNM parm. (Includes CHRSTRDR) - set16bit(DDMTerm.SRVCLSNM, offset+2); // Set code point for SRVCLSNM parm. - offset += 4; - - // Note to maintenance programmer: - // CHRSTRDR is ignored by the DDM Server, and is probably not needed. - // We're not sure why it was added in the first place. - set16bit(7, offset); // Set length of CHRSTRDR parm. - set16bit(DDMTerm.CHRSTRDR, offset+2); // Set code point for CHRSTRDR parm. - offset += 4; - - // Set the server class name (SRVCLSNM parm). - data_[offset++] = (byte)0xD8; data_[offset++] = (byte)0xC1; data_[offset++] = (byte)0xE2; // EBCDIC "QAS". - - - // Set the MGRLVLLS values. Each parameter for the MGRLVLLS term is appended to the array as code point/value pairs. No 'length' bytes precede the parameters. - - - set16bit(96, offset); // Set length of MGRLVLLS term and parms (4-byte LL/CP, plus 23 4-byte parms) - set16bit(DDMTerm.MGRLVLLS, offset+2); // Set code point for MGRLVLLS. - offset += 4; - - set16bit(DDMTerm.AGENT, offset); - set16bit(3, offset+2); - offset += 4; - - set16bit(DDMTerm.ALTINDF, offset); - set16bit(3, offset+2); - offset += 4; - - set16bit(DDMTerm.CMBACCAM, offset); - set16bit(3, offset+2); - offset += 4; - - set16bit(DDMTerm.CMBKEYAM, offset); - set16bit(3, offset+2); - offset += 4; - - set16bit(DDMTerm.CMBRNBAM, offset); - set16bit(3, offset+2); - offset += 4; - - // V4R2 system or later. - set16bit(DDMTerm.CMNTCPIP, offset); // Set CMNTCPIP code point. (V4R2 system or later) - set16bit(5, offset+2); // Set value for CMNTCPIP. Must be 5. - offset += 4; - - set16bit(DDMTerm.DICTIONARY, offset); - set16bit(1, offset+2); - offset += 4; - - set16bit(DDMTerm.DIRECTORY, offset); - set16bit(3, offset+2); - offset += 4; - - set16bit(DDMTerm.DIRFIL, offset); - set16bit(3, offset+2); - offset += 4; - - set16bit(DDMTerm.DRCAM, offset); - set16bit(3, offset+2); - offset += 4; - - set16bit(DDMTerm.KEYFIL, offset); - set16bit(3, offset+2); - offset += 4; - - set16bit(DDMTerm.LCKMGR, offset); - set16bit(3, offset+2); - offset += 4; - - set16bit(DDMTerm.RDB, offset); - set16bit(3, offset+2); - offset += 4; - - set16bit(DDMTerm.RELKEYAM, offset); - set16bit(3, offset+2); - offset += 4; - - set16bit(DDMTerm.RELRNBAM, offset); - set16bit(3, offset+2); - offset += 4; - - set16bit(DDMTerm.SECMGR, offset); - set16bit(1, offset+2); - offset += 4; - - set16bit(DDMTerm.SEQFIL, offset); - set16bit(3, offset+2); - offset += 4; - - set16bit(DDMTerm.SQLAM, offset); - set16bit(3, offset+2); - offset += 4; - - set16bit(DDMTerm.STRAM, offset); - set16bit(3, offset+2); - offset += 4; - - set16bit(DDMTerm.STRFIL, offset); - set16bit(3, offset+2); - offset += 4; - - set16bit(DDMTerm.SUPERVISOR, offset); - set16bit(3, offset+2); - offset += 4; - - set16bit(DDMTerm.SYSCMDMGR, offset); - set16bit(4, offset+2); - offset += 4; - - set16bit(DDMTerm.RSCRCVM, offset); - set16bit(4, offset+2); - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending DDM EXCSAT request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DDMEndUnitOfWorkReply.java b/cvsroot/src/com/ibm/as400/access/DDMEndUnitOfWorkReply.java deleted file mode 100644 index c55d604c0..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMEndUnitOfWorkReply.java +++ /dev/null @@ -1,99 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMEndUnitOfWorkReply.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Hashtable; - -/** - *Represents the ENDUOWRM DDM data stream. This reply stream is returned - *when an commit or rollback is done -**/ -class DDMEndUnitOfWorkReply extends DDMReplyDataStream -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - int uowDsp_ = -1; // uowDsp_ to -1 to indicate that it has not been set - int svrCode_ = -1; // Set svrCode_ to -1 to indicate that it has not been set - - /** - *Constructs an ENDUOWRM reply message data stream. - *@param data the data with which to populate this object - **/ - DDMEndUnitOfWorkReply(byte[] data) - { - super(data); - parseDataStream(); - } - - /** - *Returns the value of the UOWDSP parameter of this ENDUOWRM reply - *@return the status returned in this ENDUOWRM data stream. - **/ - int getStatus() - { - return uowDsp_; - } - - /** - *Returns the value of the SVRCOD parameter of this ENDUOWRM reply - *@return the severity codes returned in this ENDUOWRM data stream. - **/ - int getSeverityCode() - { - return svrCode_; - } - - /** - *Extracts the UOWDSP and SVRCOD parameter values from the data. - **/ - void parseDataStream() - { - int offset = 6; // Start after header - int length = get16bit(offset); // Total length of the data stream after the header. - int codePoint = get16bit(8); // Code point; should be D202 = ENDUOWRM - if (codePoint != DDMTerm.ENDUOWRM) - { - return; - } - if (length <= 4) - { - return; - } - - offset += 4; // Get to the first code point after ENDUOWRM - while (!(offset > data_.length - 4)) - { - length = get16bit(offset); // Get length of term - codePoint = get16bit(offset + 2); // get code point of this term - - switch(codePoint) - { - case DDMTerm.SVRCOD: - { - svrCode_ = get16bit(offset + 4); - break; - } - case DDMTerm.UOWDSP: - { - uowDsp_ = data_[offset + 4]; - break; - } - } - offset += length; - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DDMObjectDataStream.java b/cvsroot/src/com/ibm/as400/access/DDMObjectDataStream.java deleted file mode 100644 index cde88efce..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMObjectDataStream.java +++ /dev/null @@ -1,250 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMObjectDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// -// @A1 - 09/19/2007 - The NULL Field Byte Map array must be set based on the -// maximum number of fields for any format in a given file. See further -// detailed explaination below for the getObjectS38BUF() method. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.CharConversionException; -import java.io.UnsupportedEncodingException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Hashtable; - -/** - *DDM object data stream. -**/ -class DDMObjectDataStream extends DDMDataStream -{ - private static final String copyright = "Copyright (C) 1997-2002 International Business Machines Corporation and others."; - - /** - *Constructs a DDMObjectDataStream object. - **/ - DDMObjectDataStream() - { - super(); - } - - /** - *Constructs a DDMObjectDataStream object. - *@param data the data with which to populate the object. - **/ - DDMObjectDataStream(byte[] data) - { - super(data); - } - - /** - *Constructs a DDMObjectDataStream object. - *@param length the length of the data stream. - **/ - DDMObjectDataStream(int length) - { - super(length); - // Initialize the header: - // Don't continue on error, not chained, GDS id = D0, type = RQSDSS, - // no same request correlation. - setContinueOnError(false); - setIsChained(false); - setGDSId((byte)0xD0); - setHasSameRequestCorrelation(false); - setType(3); - } - - /** - *Returns a new instance of a DDMObjectDataStream. - *used by the DDMDataStream.construct() method. - *@return a new instance of a DDMObjectDataStream. - **/ - Object getNewDataStream() - { - return new DDMObjectDataStream(); - } - - /** - *Returns a unique identifier for this type of object. - *@return a unique identifier for this type of object. - **/ - public int hashCode() - { - return 3; // Object - } - - /** - *Returns the S38BUF object data stream. - *@param records the data in the buffer. - *@param recordIncrement the bytes between the start of each record. - *@param maxNumberOfFieldsPerFormatInFile indicates the largest of the @A1A - * record.getNumberOfFields() values for this file. A physical file - * has only one record format so maxNumberOfFieldsPerFormatInFile would - * be the same as getNumberOfFields(). However, a multi-format logical - * file may have multiple record formats. maxNumberOfFieldsPerFormatInFile - * should be set to the largest getNumberOfFields() value for the various - * record formats in a multi-format logical file. In some cases, - * getObjectS38BUF() may be called before the recordFormat's are known. In - * that case, maxNumberOfFieldsPerFormatInFile may be set to -1 to obtain - * equivalent behavior prior to the addition of this new parameter. - *@return S38BUF data stream - * Term = S38BUF - * Size = 6 --> Header (0-5) - * 2 --> LL S38BUF term and parm (6,7) - * 2 --> CP S38BUF code point (8,9) - *@exception CharConversionException If an error occurs during conversion. - *@exception UnsupportedEncodingException If an error occurs during conversion. - * - * #SSPDDM1 - Changed method to accept isSSPFile parameter and skip null field - * map if it is set to true - **/ - static DDMObjectDataStream[] getObjectS38BUF(Record[] records, - DDMS38OpenFeedback openFeedback, - boolean isSSPFile, // #SSPDDM1 - int maxNumberOfFieldsPerFormatInFile) //@A1C - throws CharConversionException, - UnsupportedEncodingException - { - // Get the record format, the record increment, and the blocking - // factor. - RecordFormat format = records[0].getRecordFormat(); - int recordIncrement = openFeedback.getRecordIncrement(); - int blockingFactor = openFeedback.getMaxNumberOfRecordsTransferred(); - - // Instantiate an array of data streams. - DDMObjectDataStream[] dataStreams = - new DDMObjectDataStream[records.length / blockingFactor + - (records.length % blockingFactor == 0 ? 0 : 1)]; - - // Create a data stream every 'blockingFactor' records. - for (int dataStreamIndex = 0, recordIndex = 0; - dataStreamIndex < dataStreams.length; dataStreamIndex++) - { - // We can only copy 'blockingFactor' records per data stream. - // Calculate the end index of the last record to be copied to the - // current data stream. - int endIndex = recordIndex + blockingFactor; - if (endIndex > records.length) - { - endIndex = records.length; - } - - // Compute the total data stream length, the record data offset, and - // the S38BUF LL. If the record data length is greater than the - // maximum data stream length, we must account for extra bookkeeping - // data. - int fourByteLength = 0; - int recDataLength = recordIncrement * (endIndex - recordIndex); - int recordOffset = 10; - int dsLength = recDataLength + 10; - int s38BUFLL = recDataLength + 4; - if (recDataLength > MAX_DATA_STREAM_LEN - 10) - { - if (recDataLength > MAX_DATA_STREAM_LEN - 4) - { - // We need the four byte length indicator. - fourByteLength = recDataLength; - recDataLength -= 4; - dsLength += 4; // 4 byte length indicator - s38BUFLL = 0x8008; - recordOffset = 14; - } - - // Subtract from record data length the amount before the packets. - recDataLength -= (MAX_DATA_STREAM_LEN - 10); - } - - // Instantiate the data stream. - dataStreams[dataStreamIndex] = new DDMObjectDataStream(dsLength); - - // Set the S38BUF LL, and CP. - dataStreams[dataStreamIndex].set16bit(s38BUFLL, 6); - dataStreams[dataStreamIndex].set16bit(DDMTerm.S38BUF, 8); - - // Set the four byte length indicator if needed. - if (fourByteLength != 0) - { - dataStreams[dataStreamIndex].set32bit(fourByteLength, 10); - } - - // For each record, write the record data and the null field byte - // map after the record data. - for (; recordIndex < endIndex; recordIndex++, - recordOffset += recordIncrement) - { - // Copy the record data to the data stream. - byte[] recordData = records[recordIndex].getContents(); - System.arraycopy(recordData, 0, dataStreams[dataStreamIndex].data_, - recordOffset, recordData.length); - - // Write the null field byte map array after the record data. It - // immediately preceeds the next record. 0xf1 = null, 0xf0 != null - // There may be a gap between the end of the record data and the - // start of the null field byte map. - int numFields = records[recordIndex].getNumberOfFields(); - // Skip writing the null field map for SSP files // #SSPDDM1 - if (!isSSPFile) // #SSPDDM1 - { - // The NULL byte field map is left justified and has as many bytes as there @A1A - // are fields in the file. In the case of a multi-format logical file, some - // formats may have more/less getNumberOfFields() than others. In that case, - // the NULL byte field map has entries for the format with the largest - // getNumberOfFields(). - // The parameter maxNumberOfFieldsPerFormatInFile is the largest of the - // record format's getNumberOfFields() values. - // Therefore, if we are writing a - // record to a format that has 2 fields we need to set two entries into the NULL - // byte field map. However, since the file could be a multi-format logical file - // there may be other recordFormats in the file that have more fields than the one - // currently being written to. So, for example if maxNumberOfFieldsPerFormatInFile - // is 3 then we need to start writing the 0xf1 or 0xf0 values at an offset as if - // there were 3 fields, but only need to set 2 values (if there are 2 fields in - // this particular record's recordFormat) - // Previously, the code was setting the 0xf0 and 0xf1 values in the NULL byte - // field map right-justified because we did not know/care about - // maxNumberOfFieldsPerFormatInFile. This would work for physical files, single - // format logical files, and multi-format logical files only if each of the formats - // in the multi-format logical file had the exact same number of fields. - // #SSPDDM1 - // If maxNumberOfFieldsPerFormatInFile - if (maxNumberOfFieldsPerFormatInFile == -1) //@A1A - { - maxNumberOfFieldsPerFormatInFile = numFields; //@A1A - } - for (int f = 0, fieldOffset = recordOffset + //@A1C - (recordIncrement - maxNumberOfFieldsPerFormatInFile); f < numFields; fieldOffset++, f++) - { - dataStreams[dataStreamIndex].data_[fieldOffset] = - (records[recordIndex].isNullField(f) ? (byte) 0xf1 : (byte) 0xf0); - } - } // #SSPDDM1 - } - } - - return dataStreams; - } - -/* COMMENT OUT UNUSED METHOD @A1D - // #SSPDDM1 - method changed to all overloaded method with isSSP parameter - static DDMObjectDataStream[] getObjectS38BUF(Record[] records, - DDMS38OpenFeedback openFeedback) - throws CharConversionException, - UnsupportedEncodingException - { - return getObjectS38BUF(records, openFeedback, false); // #SSPDDM1 - Call with isSSP default to false - } -*/ -} diff --git a/cvsroot/src/com/ibm/as400/access/DDMRecordCache.java b/cvsroot/src/com/ibm/as400/access/DDMRecordCache.java deleted file mode 100644 index 20a64adb7..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMRecordCache.java +++ /dev/null @@ -1,653 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMRecordCache.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; - -/** - *Class providing caching services to the AS400File classes. -**/ -class DDMRecordCache -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Constant indicating direction of BACKWARD for the cache - static final int BACKWARD = 1; - // Constant indicating direction of FORWARD for the cache - static final int FORWARD = 0; - // Indicates current direction of the cache. This is set whenever - // the cache is refreshed. - int currentDirection_ = FORWARD; - // Current record position in the cache - private int currentPosition_; - // Indicates if the first record of the cache is the first record of the file - private boolean containsFirstRecord_; - // Indicates if the last record of the cache is the last record of the file - private boolean containsLastRecord_; - // Indicates if the cache contains any records - private boolean isEmpty_; - // The records contained in this cache - private Record[] records_ = new Record[0]; - // The current size of the cache (number of records cached currently) - private int size_; - - /** - *Constructs a DDMRecordCache object. - **/ - DDMRecordCache() - { - setIsEmpty(); - } - - /** - *Constructs a DDMRecordCache object. - *@param records the records with which to populate the cache. This value may be - *null. - *@param direction the direction in which to populate the cache. Valid values are - *FORWARD and BACKWARD. If direction is FORWARD, the records are stored - *in the cache in the order in which they occur in records. If - *direction is BACKWARD, the records are stored in the reverse order in which - *they occur in records. - *@param firstRecord indicates if the first record of the file is in records. - *@param lastRecord indicates if the last record of the file is in records. - **/ - DDMRecordCache(Record[] records, int direction, boolean firstRecord, boolean lastRecord) - { - refresh(records, direction, firstRecord, lastRecord); - } - - /** - *Adds a record to the cache. - *@param record the record to add. - *@param end indicates if the record is to be added to the end of the cache. If - *true, the record is added to the end of the cache; otherwise the record is added - *to the beginning of the cache. - **/ - void add(Record record, boolean end) - { // Create new record array to hold the old records plus the new record - Record[] newRecords = new Record[records_.length + 1]; - if (end) - { // Add the record to the end of the cache - System.arraycopy(records_, 0, newRecords, 0, records_.length); - newRecords[records_.length] = record; - } - else - { // Add new record to the beginning of the cache - System.arraycopy(records_, 0, newRecords, 1, records_.length); - newRecords[0] = record; - // Need to update the current position - currentPosition_++; - } - // Update state variables - records_ = newRecords; - size_ = records_.length; - isEmpty_ = false; - } - - /** - *Determines if the keys are the same. - *@param key key to compare - *@param recKey key of record being compared to - *@return true if the keys match; false otherwise - **/ - boolean compareKeys(Object[] key, Object[] recKey) - { - if (key.length > recKey.length) - { // Key is greater in length than recKey; not valid - return false; - } - // Key has possibilities - may be a partial key, or may be a full key - // so we only check matches up to the length of the "key" passed in. - boolean match = true; // Assume we have a match until proven otherwise - int keyIndex = 0; - int recKeyIndex = 0; - RecordFormat rf = records_[0].getRecordFormat(); // Record format for the records - // in the cache. - for (int j = 0; j < key.length && match; ++j) - { - if (key[j] instanceof byte[] && recKey[j] instanceof byte[]) - { - if (((byte[])key[j]).length != ((byte[])recKey[j]).length) - { // Key field length mismatch; keys don't match - match = false; - } - else - { // Check field byte by byte - for (int k = 0; k < ((byte[])key[j]).length; ++k) - { - if (((byte[])key[j])[k] != ((byte[])recKey[j])[k]) - { // Key field mismatch; keys don't match, get out of loop - match = false; - break; - } - } - } - } - else if (rf.getKeyFieldDescription(j) instanceof VariableLengthFieldDescription) - { - if (((String)key[j]).equals("") && ((String)recKey[j]).equals("")) - { - // We have a match for this field - } - else - { - // @A1D - // Deleted the code that checks for variable length field. - // Strip the trailing blanks off the key and recKey for both - // the variable length & fixed length fields. -// if (((VariableLengthFieldDescription)rf.getKeyFieldDescription(j)).isVariableLength()) // @A1D -// { // @A1D - // For variable length character fields (i.e. not hex fields) we strip - // the trailing blanks from the keys prior to checking for a match. - // We do this because that is how DDM does it when retrieving from the file. - keyIndex = ((String)key[j]).length() - 1; - while (((String)key[j]).charAt(keyIndex) == ' ') - { - keyIndex--; - } - recKeyIndex = ((String)recKey[j]).length() - 1; - while (((String)recKey[j]).charAt(recKeyIndex) == ' ') - { - recKeyIndex--; - } - // Check stripped values - if (!((String)key[j]).substring(0, keyIndex + 1).equals(((String)recKey[j]).substring(0, recKeyIndex + 1))) - { - match = false; - } - // Start of @A1D - /* - } - else - { - if (!key[j].equals(recKey[j])) - { // Key field mismatch; keys don't match - match = false; - } - } - */ - // End of @A1D - } - } - else - { // Not variable length/not character field - if (!key[j].equals(recKey[j])) - { // Key field mismatch; keys don't match - match = false; - } - } - } - return match; - } - - /** - *Indicates if the cache contains the first record of the file. - *@return true if the cache contains the first record of the file; false otherwise. - **/ - boolean containsFirstRecord() - { - return containsFirstRecord_; - } - - /** - *Indicates if the cache contains the last record of the file. - *@return true if the cache contains the last record of the file; false otherwise. - **/ - boolean containsLastRecord() - { - return containsLastRecord_; - } - - /** - *Dump the contents of the cache to standard out. - **/ - void dump() - { - System.out.println("Dumping cache:"); - for (int i = 0; i < records_.length; ++i) - { - System.out.println(records_[i]); - } - } - - /** - *Find the record specified by record number in the cache. - *@param recordNumber the record number for which to search. - *@return the index of the record in the cache or -1 if the record does not exist - *in the cache. - **/ - int findRecord(int recordNumber) - { - for (int i = 0; i < size_; ++i) - { // Look for the record - if (records_[i].getRecordNumber() == recordNumber) - { // Match; return now - return i; - } - } - // No match - return -1; - } - - /** - *Find the record specified by key from the current position in the cache. - *@param key the key of the record for which to search. - *@return the index of the record in the cache or -1 if the record does not exist - *in the cache. - *@exception UnsupportedEncodingException If an error occurs when converting - *the server data to a Java Object. - **/ - int findRecord(Object[] key, boolean searchForward) - throws UnsupportedEncodingException - { - boolean match; // Indicates if we have a match - - // Search for a match. If a match occurs we will return before this loop finishes - if (key.length > records_[0].getKeyFields().length) - { // Key passed in is invalid; return -1 - return -1; - } - if (searchForward) - { - for (int i = currentPosition_ + 1; i < size_; ++i) - { - match = compareKeys(key, records_[i].getKeyFields()); - if (match) - { - return i; - } - } - } - else - { - for (int i = currentPosition_ - 1; i > -1; --i) - { - match = compareKeys(key, records_[i].getKeyFields()); - if (match) - { - return i; - } - } - } - - // No record found matching key - return -1; - } - - /** - *Returns the record currently pointed to in the cache. - *@return the record currently pointed to in the cache or null if not currently - *positioned on a record. - **/ - Record getCurrent() - { - return (currentPosition_ > -1 && currentPosition_ < size_)? records_[currentPosition_] : null; - } - - /** - *Returns the first record in the cache. - *@return the first record in the cache or null if cache is empty. - **/ - Record getFirst() - { - if (isEmpty_) - { - return null; - } - currentPosition_ = 0; - return records_[currentPosition_]; - } - - /** - *Returns the last record in the cache. - *@return the last record in the cache or null if cache is empty. - **/ - Record getLast() - { - if (isEmpty_) - { - return null; - } - currentPosition_ = size_ - 1; - return records_[currentPosition_]; - } - - /** - *Returns the next record in the cache. - *@return the next record in the cache, or null if cache is empty or if - *we are at the end of the cache. - **/ - Record getNext() - { - if (isEmpty_) - { - return null; - } - return (currentPosition_ < size_ - 1)? records_[++currentPosition_] : null; - } - - /** - *Returns the previous record in the cache. - *@return the previous record in the cache, or null if cache is empty or if - *we are at the beginning of the cache. - **/ - Record getPrevious() - { - if (isEmpty_) - { - return null; - } - return (currentPosition_ != 0)? records_[--currentPosition_] : null; - } - - /** - *Returns the first record in the cache that matches the specified record number. - *@param recordNumber the record number of the record to return. - *@return the first record in the cache that matches the specified record number, - *or null if cache is empty or if the record is not found. - **/ - Record getRecord(int recordNumber) - { - if (isEmpty_) - { - return null; - } - int index = findRecord(recordNumber); - if (index != -1) - { - currentPosition_ = index; - return records_[index]; - } - else - { - return null; - } - } - - /** - *Returns the next record in the cache that matches the specified key. - *@param key the key of the record to return. - *@return the next record in the cache that matches the specified key, - *or null if cache is empty or if the record is not found. - *@exception UnsupportedEncodingException If an error occurs when converting - *the server data to a Java Object. - **/ - Record getNextEqualRecord(Object[] key) - throws UnsupportedEncodingException - { - if (isEmpty_) - { - return null; - } - int index = findRecord(key, true); - if (index != -1) - { - currentPosition_ = index; - return records_[index]; - } - else - { - return null; - } - } - - /** - *Returns the previous record in the cache that matches the specified key. - *@param key the key of the record to return. - *@return the previous record in the cache that matches the specified key, - *or null if cache is empty or if the record is not found. - *@exception UnsupportedEncodingException If an error occurs when converting - *the server data to a Java Object. - **/ - Record getPreviousEqualRecord(Object[] key) - throws UnsupportedEncodingException - { - if (isEmpty_) - { - return null; - } - int index = findRecord(key, false); - if (index != -1) - { - currentPosition_ = index; - return records_[index]; - } - else - { - return null; - } - } - - /** - *Indicates if we are after the last record. - **/ - boolean isAfterLast() - { - return (isEmpty_)? false : (currentPosition_ == size_); - } - - /** - *Indicates if we are before the first record. - **/ - boolean isBeforeFirst() - { - return (isEmpty_)? false : (currentPosition_ == -1); - } - - /** - *Indicates if we are at the beginning of the cache. - *@return true if we are at the beginning of the cache; false otherwise. - **/ - boolean isBeginningOfCache() - { - return (currentPosition_ <= 0); - } - - /** - *Indicates if the cache is empty. - *@return true if the cache is empty; false otherwise. - **/ - boolean isEmpty() - { - return isEmpty_; - } - - /** - *Indicates if we are at the end of the cache. - *@return true if we are at the end of the cache; false otherwise. - **/ - boolean isEndOfCache() - { - return (currentPosition_ >= size_ - 1); - } - - /** - *Refreshes the cache with the supplied records. - *@param records the records with which to populate the cache. This value may be - *null. - *@param direction the direction in which to populate the cache. Valid values are - *FORWARD and BACKWARD. If direction is FORWARD, the records are stored - *in the cache in the order in which they occur in records. If - *direction is BACKWARD, the records are stored in the reverse order in which - *they occur in records. - *@param firstRecord indicates if the first record of the file is in records. - *@param lastRecord indicates if the last record of the file is in records. - **/ - void refresh(Record[] records, int direction, boolean firstRecord, boolean lastRecord) - { - // Set the current direction - currentDirection_ = direction; - if (records == null || records.length == 0) - { - // Set the state variables - isEmpty_ = true; - containsFirstRecord_ = false; - containsLastRecord_ = false; - currentPosition_ = -1; - size_ = 0; - } - else - { - if (direction == FORWARD) - { // Records are ordered correctly - records_ = records; - } - else - { // Need to reverse the order of the records to place them into the array correctly - records_ = new Record[records.length]; - for (int i = records.length - 1, j = 0; i >= 0; --i, ++j) - { - records_[j] = records[i]; - } - } - containsFirstRecord_ = firstRecord; - containsLastRecord_ = lastRecord; - // The current position of the cache depends on the direction - if we are going forward it - // is prior to the first record in the cache; if we are going backward it is after the last - // record in the cache. When direction is backward it is expected that the user will be - // doing readPrevious()'s to search from the end of the cache (file). - currentPosition_ = (direction == FORWARD)? 0 : records.length - 1; - size_ = records_.length; - isEmpty_ = false; - } - if (Trace.isTraceOn()) - { - Trace.log(Trace.INFORMATION, "Record cache refreshed:"); - for (int i = 0; i < records_.length; ++i) - { - Trace.log(Trace.INFORMATION, records_[i].toString()); - } - } - } - - /** - *Sets the state of the cache to empty. - **/ - void setIsEmpty() - { - // Set the state variables - isEmpty_ = true; - containsFirstRecord_ = false; - containsLastRecord_ = false; - currentPosition_ = -1; - size_ = 0; - } - - /** - *Sets the current cache position to the record matching the specified record number. - *@param recordNumber the record number of the record to position to. - *@return true if the record was found and positioned to; false otherwise. - **/ - boolean setPosition(int recordNumber) - { - if (isEmpty_) - { - return false; - } - int i = findRecord(recordNumber); - if (i > -1) - { - currentPosition_ = i; - } - return (i > -1); - } - - /** - *Sets the current cache position to the record matching the specified key. - *@param key the key of the record to position to. - *@return true if the record was found and positioned to; false otherwise. - *@exception UnsupportedEncodingException If an error occurs when converting - *the server data to a Java Object. - **/ - boolean setPosition(Object[] key) - throws UnsupportedEncodingException - { - if (isEmpty_) - { - return false; - } - int i = findRecord(key, true); - if (i > -1) - { - currentPosition_ = i; - } - return (i > -1); - } - - /** - *Sets the current cache position to after the last record in the cache - **/ - void setPositionAfterLast() - { - if (!isEmpty_) - { - currentPosition_ = size_; - } - } - - /** - *Sets the current cache position to before the first record in the cache - **/ - void setPositionBeforeFirst() - { - if (!isEmpty_) - { - currentPosition_ = -1; - } - } - - /** - *Sets the current cache position to the first record in the cache - **/ - void setPositionFirst() - { - if (!isEmpty_) - { - currentPosition_ = 0; - } - } - - /** - *Sets the current cache position to the last record in the cache - **/ - void setPositionLast() - { - if (!isEmpty_) - { - currentPosition_ = size_ - 1; - } - } - - /** - *Sets the current cache position to the next record in the cache - **/ - void setPositionNext() - { - if (!isEmpty_ && currentPosition_ < size_) - { - currentPosition_++; - } - } - - /** - *Sets the current cache position to the previous record in the cache - **/ - void setPositionPrevious() - { - if (!isEmpty_ && currentPosition_ > -1) - { - currentPosition_--; - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DDMReplyDataStream.java b/cvsroot/src/com/ibm/as400/access/DDMReplyDataStream.java deleted file mode 100644 index 65a80f9a2..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMReplyDataStream.java +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMReplyDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Hashtable; - -/** - *DDM reply data stream. -**/ -class DDMReplyDataStream extends DDMDataStream -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - /** - *Constructs a DDM reply data stream with default values for the header -. **/ - DDMReplyDataStream() - { - super(); - } - - /** - *Constructs a DDMObjectDataStream object. - *@param data the data with which to populate the object. - **/ - DDMReplyDataStream(byte[] data) - { - super(data); - } - - /** - *Returns a new instance of a DDMObjectDataStream. - *used by the DDMDataStream.construct() method. - *@return a new instance of a DDMObjectDataStream. - **/ - Object getNewDataStream() - { - return new DDMReplyDataStream(); - } - - /** - *Returns a unique identifier for this type of object. - *@return a unique identifier for this type of object. - **/ - public int hashCode() - { - return 2; // Reply - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DDMRequestDataStream.java b/cvsroot/src/com/ibm/as400/access/DDMRequestDataStream.java deleted file mode 100644 index 1b6c00537..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMRequestDataStream.java +++ /dev/null @@ -1,1631 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMRequestDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.ByteArrayOutputStream; -import java.io.CharConversionException; -import java.io.UnsupportedEncodingException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Hashtable; - -/** - *Base class for DDM request data streams. Initializes request data - *streams appropriately. -**/ -class DDMRequestDataStream extends DDMDataStream -{ - /** - *Constructs request data stream with defaults: - * Don't continue on error, not chained, GDS id = D0, type = RQSDSS, - * no same request correlation. - *Because the length is unknown, only the header is constructed. - **/ - DDMRequestDataStream() - { - super(); - // Initialize the header: - // Don't continue on error, not chained, GDS id = D0, type = RQSDSS, - // no same request correlation. - setContinueOnError(false); - setIsChained(false); - setGDSId((byte)0xD0); - setHasSameRequestCorrelation(false); - setType(1); - } - - /** - *Constructs request data stream with defaults: - * Don't continue on error, not chained, GDS id = D0, type = RQSDSS, - * no same request correlation. - *@param length The total length of the data stream. - **/ - DDMRequestDataStream(int length) - { - super(length); - // Initialize the header: - // Don't continue on error, not chained, GDS id = D0, type = RQSDSS, - // no same request correlation. - setContinueOnError(false); - setIsChained(false); - setGDSId((byte)0xD0); - setHasSameRequestCorrelation(false); - setType(1); - } - - /** - *Constructs request data stream as specified with defaults: - * GDS id = D0, type = RQSDSS. - *@param The total length of the data stream. - *@param contOnError true if we are to continue on error, false otherwise. - *@param chained true if this data stream is chained, false otherwise. - *@param sameRequestCorrelator true if this data stream has the same - * request correlator as the last, false otherwise. - **/ - DDMRequestDataStream(int length, boolean contOnError, boolean chained, - boolean sameRequestCorrelator) - { - super(length); - // Initialize the header: - // Don't continue on error, not chained, GDS id = D0, type = RQSDSS, - // no same request correlation. - setContinueOnError(contOnError); - setIsChained(chained); - setGDSId((byte)0xD0); - setHasSameRequestCorrelation(sameRequestCorrelator); - setType(1); - } - - /** - *Returns the commit data stream request. - *@return DDMRequestDataStream for committing transactions. - *Commit request: - * Term = CMMUOW - * Parms = LUWHLDCSR => byte[1] Hold cursor parameter. Always set to F1 for DDM. - * Size = 6 --> Header (0 - 5) - * 2 --> LL Length of CMMUOW term and parms (6,7) - * 2 --> CP CMMUOW code point (8,9) - * 2 --> LL Length of LUWHLDCSR term and parm (10,11) - * 2 --> CP LUWHLDCSR code point (12,13) - * 1 --> LUWHLDCSR parm (14) - * ----- - * 15 --> Total length of the data stream - **/ - static DDMRequestDataStream getRequestCMMUOW() - { - // The total length of this data stream is 15 - DDMRequestDataStream req = new DDMRequestDataStream(15); - - req.set16bit(9, 6); // Set the total length remaining after the header - req.set16bit(DDMTerm.CMMUOW, 8); // Set code point for CMMUOW term - req.set16bit(5, 10); // Set length of the LUWHLDCSR parm - req.set16bit(DDMTerm.LUWHLDCSR, 12); // Set code point for LUWHLDCSR parm - // Set the LUWHLDCSR parm to '1' - req.data_[14] = (byte)0xF1; - - return req; - } - -// This method is not used anywhere -// /** -// *Returns the exchange attributes data stream request. -// *@param release indicates if we are exchanging attributes with a pre-v4r2 -// *system or a v4r2 or later system. Valid values are: V4R2 or PREV4R2. -// *@return DDMRequestDataStream for exchanging attributes. -// *Exchange attributes request: -// * Term = EXCSAT -// * Parms = SRVCLSNM -> CHRSTRDR => Character string containing server class name -// * in EBCDIC -// * Size = 6 --> Header (0 - 5) -// * 2 --> LL Length of EXCSAT term and parms (6,7) -// * 2 --> CP EXCSAT code point (8,9) -// * 2 --> LL Length of SRVCLSNM term and parm (10,11) -// * 2 --> CP SRVCLSNM code point (12, 13) -// * 2 --> LL Length of CHRSTRDR term and parms (14,15) -// * 2 --> CP CHRSTRDR code point (16,17) -// * 3 --> SRVCLSNM parm (QAS) (18 - 20) -// * 2 --> LL length of MGRLVLLS term and parms -// * 2 --> MGRLVLLS code point -// * 4 * 23 --> Manager level parms and their values -// * ---- -// * 117 --> Total length of the data stream -// **/ -// static DDMRequestDataStream getRequestEXCSAT(String release, AS400ImplRemote system) //@B5C -// throws IOException -// { -// DDMRequestDataStream req; -// req = new DDMRequestDataStream(117); -// req.set16bit(111, 6); // Set total length remaining after header -// -// req.set16bit(DDMTerm.EXCSAT, 8); // Set code point for EXCSAT term -// req.set16bit(11, 10); // Set length of SRVCLSNM parm -// req.set16bit(DDMTerm.SRVCLSNM, 12); // Set code point for SRVCLSNM parm -// req.set16bit(7, 14); // Set length of CHRSTRDR parm -// req.set16bit(DDMTerm.CHRSTRDR, 16); // Set code point for CHRSTRDR parm -// // Set the server class name (SRVCLSNM parm) -// ConverterImplRemote c = ConverterImplRemote.getConverter(system.getCcsid(), system); //@B5C -// c.stringToByteArray("QAS", req.data_, 18); -// // Set the MGRLVLS values. Each parameter for the MGRLVLS term is appended to -// // to the array as code point/value pairs. No length bytes precede the -// // parameters. -// req.set16bit(96, 21); -// req.set16bit(DDMTerm.MGRLVLLS, 23); -// req.set16bit(DDMTerm.AGENT, 25); -// req.set16bit(3, 27); -// req.set16bit(DDMTerm.ALTINDF, 29); -// req.set16bit(3, 31); -// req.set16bit(DDMTerm.CMBACCAM, 33); -// req.set16bit(3, 35); -// req.set16bit(DDMTerm.CMBKEYAM, 37); -// req.set16bit(3, 39); -// req.set16bit(DDMTerm.CMBRNBAM, 41); -// req.set16bit(3, 43); -// if (release.equalsIgnoreCase("PREV4R2")) -// { -// req.set16bit(DDMTerm.CMNAPPC, 45); -// req.set16bit(3, 47); -// } -// else -// { // V4R2 system or later -// req.set16bit(DDMTerm.CMNTCPIP, 45); // Set CMNTCPIP code point -// req.set16bit(5, 47); // Set value for CMNTCPIP. Must be 5. -// } -// req.set16bit(DDMTerm.DICTIONARY, 49); -// req.set16bit(1, 51); -// req.set16bit(DDMTerm.DIRECTORY, 53); -// req.set16bit(3, 55); -// req.set16bit(DDMTerm.DIRFIL, 57); -// req.set16bit(3, 59); -// req.set16bit(DDMTerm.DRCAM, 61); -// req.set16bit(3, 63); -// req.set16bit(DDMTerm.KEYFIL, 65); -// req.set16bit(3, 67); -// req.set16bit(DDMTerm.LCKMGR, 69); -// req.set16bit(3, 71); -// req.set16bit(DDMTerm.RDB, 73); -// req.set16bit(3, 75); -// req.set16bit(DDMTerm.RELKEYAM, 77); -// req.set16bit(3, 79); -// req.set16bit(DDMTerm.RELRNBAM, 81); -// req.set16bit(3, 83); -// req.set16bit(DDMTerm.SECMGR, 85); -// req.set16bit(1, 87); -// req.set16bit(DDMTerm.SEQFIL, 89); -// req.set16bit(3, 91); -// req.set16bit(DDMTerm.SQLAM, 93); -// req.set16bit(3, 95); -// req.set16bit(DDMTerm.STRAM, 97); -// req.set16bit(3, 99); -// req.set16bit(DDMTerm.STRFIL, 101); -// req.set16bit(3, 103); -// req.set16bit(DDMTerm.SUPERVISOR, 105); -// req.set16bit(3, 107); -// req.set16bit(DDMTerm.SYSCMDMGR, 109); -// req.set16bit(4, 111); -// req.set16bit(DDMTerm.RSCRCVM, 113); -// req.set16bit(4, 115); -// -// return req; -// } - - - /** - *Returns the rollback data stream request. - *@return DDMRequestDataStream for rolling back transactions. - *Rollback request: - * Term = RLLBCKUOW - * Parms = LUWHLDCSR => byte[1] Hold cursor parameter. Always set to F1 for DDM. - * Size = 6 --> Header (0 - 5) - * 2 --> LL Length of CMMUOW term and parms (6,7) - * 2 --> CP CMMUOW code point (8,9) - * 2 --> LL Length of LUWHLDCSR term and parm (10,11) - * 2 --> CP LUWHLDCSR code point (12,13) - * 1 --> LUWHLDCSR parm (14) - * ----- - * 15 --> Total length of the data stream - **/ - static DDMRequestDataStream getRequestRLLBCKUOW() - { - // The total length of this data stream is 15 - DDMRequestDataStream req = new DDMRequestDataStream(15); - - req.set16bit(9, 6); // Set the total length remaining after the header - req.set16bit(DDMTerm.RLLBCKUOW, 8); // Set code point for RLLBCKUOW term - req.set16bit(5, 10); // Set length of the LUWHLDCSR parm - req.set16bit(DDMTerm.LUWHLDCSR, 12); // Set code point for LUWHLDCSR parm - // Set the LUWHLDCSR parm to '1' - req.data_[14] = (byte)0xF1; - - return req; - } - -// This method is not used anywhere -// /** -// *Returns the start commitment control data stream request. -// *@param lockLevel commitment lock level. -// *@return DDMRequestDataStream for starting commitment control. -// *Start commitment control request: -// * Term = STRCMMCTL -// * Parms = CMMCTLTYP => byte[2] Commitment control type. Always set to 0x0001. -// * FILISOLVL => byte[2] Commitment control lock level. -// * 0x2441 - *CHG -// * 0x2442 - *CS -// * 0x2443 - *ALL -// * 0x2445 = *NONE -// * Size = 6 --> Header (0 - 5) -// * 2 --> LL Length of SSTRCMMCTL term and parms (6,7) -// * 2 --> CP STRCMMCTL code point (8,9) -// * 2 --> LL Length of CMMCTLTYP term and parm (10,11) -// * 2 --> CP CMMCTLTYP code point (12,13) -// * 2 --> CMMCTLTYP parm (14, 15) -// * 2 --> LL Length of FILISOLVL term and parm (16,17) -// * 2 --> CP FILISOLVL code point (18,19) -// * 2 --> FILISOLVL parm (20,21) -// * ----- -// * 22 --> Total length of the data stream -// **/ -// static DDMRequestDataStream getRequestSTRCMMCTL(int lockLevel) -// { -// // The total length of this data stream is 22 -// DDMRequestDataStream req = new DDMRequestDataStream(22); -// -// req.set16bit(16, 6); // Set the total length remaining after the header -// req.set16bit(DDMTerm.STRCMMCTL, 8); // Set code point for STRCMMCTL term -// req.set16bit(6, 10); // Set length of the CMMCTLTYP parm -// req.set16bit(DDMTerm.CMMCTLTYP, 12); // Set code point for CMMCTLTYP parm -// // Set the commitment control type -// req.data_[14] = (byte)0x00; -// req.data_[15] = (byte)0x01; -// -// req.set16bit(6, 16); // Set length of the FILISOLVL parm -// req.set16bit(DDMTerm.FILISOLVL, 18);// Set code point for FILISOLVL parm -// req.data_[20] = (byte)0x24; // All the commit lock levels start with 24 -// switch (lockLevel) -// { -// case AS400FileConstants.COMMIT_LOCK_LEVEL_CHANGE: //@C0C -// { -// req.data_[21] = (byte)0x41; -// break; -// } -// case AS400FileConstants.COMMIT_LOCK_LEVEL_CURSOR_STABILITY: //@C0C -// { -// req.data_[21] = (byte)0x42; -// break; -// } -// case AS400FileConstants.COMMIT_LOCK_LEVEL_ALL: //@C0C -// { -// req.data_[21] = (byte)0x43; -// break; -// } -// default: -// { -// // Note: We should never get here. Presumably the lock level is checked -// // by the calling method. -// throw new ExtendedIllegalArgumentException("lockLevel", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); -// } -// } -// -// return req; -// } - -// This method is not used anywhere -// /** -// *Returns the allocate object data stream request. -// *@param lock the lock to obtain. -// *@param library library name. -// *@param file file name. -// *@param member member name. -// *@param wait number of seconds to wait for locks. -// *@param system the system from which to get the CCSID for conversions -// *@return DDMRequestDataStream for locking a file. -// *S38ALCOB request: -// * Term = S38ALCOB -// * Parms = S38LRQS => FILANM => RQSFILLK =>Lock request structure: -// * S38LWAIT => bin4 => Amount of time to wait for the lock -// * Size = 6 --> Header (0 - 5) -// * 2 --> LL Length of S38ALCOB term and parms -// * 2 --> CP S38ALCOB code point -// * 2 --> LL Length of S38LRQS term and parm -// * 2 --> CP S38LRQS code point -// * 2 --> LL FILNAM term length -// * 2 --> CP FILNAM code point -// * library.length + file.length + member.length + 3 -// * --> FILNAM value = library/file(member) -// * 2 --> LL RQSFILLK length -// * 2 --> CP of RQSFILLK term -// * 1 --> Value for RQSFILLK -// * 2 --> LL Length of S38LWAIT term and parm -// * 2 --> CP S38LWAIT code point -// * 4 --> S38LWAIT parm -// * ----- -// * 34 + library.length + file.length + member.length -// * --> Total length of the data stream -// **/ -// static DDMRequestDataStream getRequestS38ALCOB(byte lock, String library, -// String file, String member, int wait, -// AS400ImplRemote system) //@B5C -// throws AS400SecurityException, -// InterruptedException, -// IOException -// { -// DDMRequestDataStream req = -// new DDMRequestDataStream(34 + library.length() + -// file.length() + member.length()); -// // Determine the lengths of the terms -// int fileNameLength = 3 + library.length() + file.length() + member.length(); -// int llFILNAM = 4 + fileNameLength; -// int llRQSFILLK = 5; -// int llS38LWAIT = 8; -// int llS38LRQS = 13 + fileNameLength; -// -// // Set the total length remaining after the header -// req.set16bit(25 + fileNameLength, 6); -// req.set16bit(DDMTerm.S38ALCOB, 8); // Set code point for S38ALCOB term -// -// // Set the S38LRQS term -// req.set16bit(llS38LRQS, 10); // Length of S38LRQS term -// req.set16bit(DDMTerm.S38LRQS, 12); // Set S38LRQS code point -// req.set16bit(llFILNAM, 14); // Length of FILNAM term - first parameter of the S38LRQS term -// req.set16bit(DDMTerm.FILNAM, 16); // Set FILNAM codepoint -// // Determine the value for the FILNAM parm -// ConverterImplRemote c = ConverterImplRemote.getConverter(system.getCcsid(), system); //@B5C -// c.stringToByteArray(library + "/" + file + "(" + member + ")", req.data_, 18); -// int offset = 18 + fileNameLength; -// req.set16bit(llRQSFILLK, offset); // Length of RQSFILLK term - second parameter of the S38LRQS term -// req.set16bit(DDMTerm.RQSFILLK, offset + 2); // Set RQSFILLK code point -// req.data_[offset + 4] = lock; // Value for the RQSFILLK term - already checked by the calling method -// -// // Set the S38LWAIT term -// req.set16bit(llS38LWAIT, offset + 5); // Length of the S38LWAIT term -// req.set16bit(DDMTerm.S38LWAIT, offset + 7); // Set S38LWAIT code point -// req.set32bit(wait, offset + 9); // S38LWAIT value -// -// return req; -// } - - /** - *Returns the close file data stream request. - *@param dclName the declared file name for the file. - *@return DDMRequestDataStream for closing a file. - *Close file request: - * Term = S38CLOSE - * Parms = DCLNAM => byte[8] containing declared name (alias) - * for the file. The first byte must be >= 0x40. - * S38CLOST => 1 byte indicating type of close - * Size = 6 --> Header (0 - 5) - * 2 --> LL Length of S38CLOSE term and parms (6,7) - * 2 --> CP S38CLOSE code point (8,9) - * 2 --> LL Length of DCLNAM term and parm (10,11) - * 2 --> CP DCLNAM code point (12,13) - * 8 --> DCLNAM parm (14 - 21) - * 2 --> LL Length of S38CLOST term and parm (22,23) - * 2 --> CP S38CLOST code point (24,25) - * 1 --> S38CLOST parm (26) - * ----- - * 27 --> Total length of the data stream - **/ - static DDMRequestDataStream getRequestS38CLOSE(byte[] dclName) - { - // The total length of this data stream is 27 - DDMRequestDataStream req = new DDMRequestDataStream(27); - - req.set16bit(21, 6); // Set the total length remaining after the header - req.set16bit(DDMTerm.S38CLOSE, 8); // Set code point for S38CLOSE term - req.set16bit(12, 10); // Set length of the DCLNAM parm - req.set16bit(DDMTerm.DCLNAM, 12); // Set code point for DCLNAM parm - // Set the declared name; declaredName is an 8-byte array - System.arraycopy(dclName, 0, req.data_, 14, 8); - req.set16bit(5, 22); // Set length of the S38CLOST parm - req.set16bit(DDMTerm.S38CLOST, 24);// Set code point for S38CLOST parm - req.data_[26] = (byte)0x02; // Set value for S38CLOST - 2 indicates permanent close - - return req; - } - - /** - *Returns the submit command data stream request. - *@param command the command to submit. - *@param system the system from which to get the CCSID for conversions. - *@return DDMRequestDataStream for submitting a command. - *Submit remote command request: - * Term = S38CMD - * Parms = S38CMDST => byte[] containing the command to be submitted. - * Size = 6 --> Header (0 - 5) - * 2 --> LL Length of S38CMD term and parms (6,7) - * 2 --> CP S38CMD code point (8,9) - * 2 --> LL Length of S38CMDST term and parm (10,11) - * 2 --> CP S38CMDST code point (12,13) - * command.length() - * --> S38CMDST parm (14 - 14 + command.length() - 1) - * ----- - * 14 + command.length() --> Total length of the data stream - **/ - static DDMRequestDataStream getRequestS38CMD(String command, AS400ImplRemote system) //@B5C - throws AS400SecurityException, - InterruptedException, - IOException - { - // Convert command reight away in order to determine number of bytes - // need for the command - ConverterImplRemote c = ConverterImplRemote.getConverter(system.getCcsid(), system); //@B5C - byte[] cmd = c.stringToByteArray(command); - // The total length of this data stream is 14 + cmd.length() - DDMRequestDataStream req = new DDMRequestDataStream(14 + cmd.length); - req.set16bit(8 + cmd.length, 6); // Set total length remaining after header - req.set16bit(DDMTerm.S38CMD, 8); // Set code point for S38CMD term - req.set16bit(4 + cmd.length, 10);// Set length of S38CMDST parm - req.set16bit(DDMTerm.S38CMDST, 12); // Set code point for S38CMDST parm - // Set the command - System.arraycopy(cmd, 0, req.data_, 14, cmd.length); - - return req; - } - - /** - *Returns the delete record data stream request. - *@param dclName the declared file name for the file. - *@return DDMRequestDataStream for opening file. - *Open file request: - * Term = S38DEL - * Parms = DCLNAM => byte[8] containing declared name (alias) - * for the file. The first byte must be >= 0x40. - * Size = 6 --> Header (0 - 5) - * 2 --> LL Length of S38DEL term and parms (6,7) - * 2 --> CP S38DEL code point (8,9) - * 2 --> LL Length of DCLNAM term and parm (10,11) - * 2 --> CP DCLNAM code point (12,13) - * 8 --> DCLNAM parm (14 - 21) - * ----- - * 22 --> Total length of the data stream - **/ - static DDMRequestDataStream getRequestS38DEL(byte[] dclName) - { - // The total length of this data stream is 22 - DDMRequestDataStream req = new DDMRequestDataStream(22); - - req.set16bit(16, 6); // Set total length remaining after header - req.set16bit(DDMTerm.S38DEL, 8); // Set code point for S38DEL term - req.set16bit(12, 10); // Set length of DCLNAM parm - req.set16bit(DDMTerm.DCLNAM, 12);// Set code point for DCLNAM parm - // Set the declared name; declaredName is an 8-byte array - System.arraycopy(dclName, 0, req.data_, 14, 8); - - return req; - } - -// This method is not used anywhere -// /** -// *Returns the deallocate object data stream request. -// *@param locks The locks to release. -// *@param library library name. -// *@param file file name. -// *@param member member name. -// *@param system the system from which to get the CCSID for conversions. -// *@return DDMRequestDataStream for releasing explicit locks on a file. -// *S38DLCOB: -// * Term = S38DLCOB -// * Parms = S38LRLS => RLSFILLK => Lock request structure: -// * 2 --> LL Length of FILNAM term and parm -// * 2 --> CP FILNAM code point -// * library.length() + file.length() + member.length() + 3 -// * --> FILNAM parm, library/file(member) -// * 2 --> LL Length of RLSFILLK term and parm -// * 2 --> CP RLSFILLK code point -// * 1 --> byte indicating type of lock -// * There can be one or more S38LRLS terms -// * Size = 6 --> Header (0 - 5) -// * 2 --> LL Length of S38DLCOB term and parms -// * 2 --> CP S38DLCOB code point -// * Repeatable: -// * 2 --> LL Length of S38LRLS term and parm -// * 2 --> CP S38LRLS code point -// * 2 --> LL FILNAM term -// * 2 --> CP FILNAM term -// * library.length + file.length + member.length + 3 -// * --> FILNAM value = library/file(member) -// * 2 --> LL RLSFILLK length -// * 2 --> CP of RLSFILLK term -// * 1 --> Value for RQSFILLK -// * ----- -// * 10 + -// * locks.length * (16 + library.length() + file.length() + member.length()) -// **/ -// static DDMRequestDataStream getRequestS38DLCOB(byte[] locks, String library, -// String file, String member, -// AS400ImplRemote system) //@B5C -// throws AS400SecurityException, -// InterruptedException, -// IOException -// { -// DDMRequestDataStream req = -// new DDMRequestDataStream(10 + locks.length * (16 + library.length() + -// file.length() + member.length())); -// // Determine the lengths of the terms -// int fileNameLength = 3 + library.length() + file.length() + member.length(); -// int llFILNAM = 4 + fileNameLength; -// int llRLSFILLK = 5; -// int llS38LRLS = 13 + fileNameLength; -// -// // Set the total length remaining after the header -// req.set16bit(req.data_.length - 6, 6); -// req.set16bit(DDMTerm.S38DLCOB, 8); // Set code point for S38DLCOB term -// -// // Determine the value for the FILNAM parm -// byte[] fileName = new byte[fileNameLength]; -// ConverterImplRemote c = ConverterImplRemote.getConverter(system.getCcsid(), system); //@B5C -// c.stringToByteArray(library + "/" + file + "(" + member + ")", fileName, 0); -// -// // Set the repeatable portion of the data stream (one or more S38LRLS terms) -// int offsetRLSFILLK; -// for (short i = 0, offset = 10; i < locks.length; ++i) -// { -// req.set16bit(llS38LRLS, offset); // Set length of the S38LRLS term -// req.set16bit(DDMTerm.S38LRLS, offset + 2); // Set code point for S38LRLS term -// req.set16bit(llFILNAM, offset + 4); // Set the length of the FILNAM term -// req.set16bit(DDMTerm.FILNAM, offset + 6); // Set the code point for FILNAM term -// // Set the FILNAM parm -// System.arraycopy(fileName, 0, req.data_, offset + 8, fileName.length); -// offsetRLSFILLK = offset + 8 + fileName.length; -// req.set16bit(llRLSFILLK, offsetRLSFILLK);// Set length of the RLSFILLK term -// req.set16bit(DDMTerm.RLSFILLK, offsetRLSFILLK + 2); // Set code point for RLSFILLK term -// req.data_[offsetRLSFILLK + 4] = locks[i]; // Set the RLSFILLK parm -// offset += llS38LRLS; -// } -// -// return req; -// } - - /** - *Returns the S38FEOD request data stream with the operation specified for - *positioning. - *@param dclName the declared file name for the file. - *@param type type option - *@param share share option - *@param data data option - *@return DDMRequestDataStream for retrieving a record. - * Term = S38FEOD - * Parms = DCLNAM => byte[8] containing declared name (alias) - * for the file. The first byte must be >= 0x40. - * Size = 6 --> Header (0-5) - * 2 --> LL S38FEOD term and parms (6,7) - * 2 --> CP S38FEOD code point (8,9) - * 2 --> LL DCLNAM term and parm length (10,11) - * 2 --> CP DCLNAM code point (12,13) - * 8 --> DCLNAM parm (14-21) - * 2 --> LL S38OPTL term and parm length (22,23) - * 2 --> CP S38OPTL code point (24,25) - * 4 --> S38OPTL parm - * 1 --> type (26) - * 1 --> share (27) - * 1 --> data (28) - * 1 --> operation (29) - * --- - * 30 --> data stream length - **/ - static DDMRequestDataStream getRequestS38FEOD(byte[] dclName, int type, - int share, int data) - { - DDMRequestDataStream req = new DDMRequestDataStream(30); - - req.set16bit(req.data_.length - 6, 6); // total length after header - req.set16bit(DDMTerm.S38FEOD, 8); - - // Set the DCLNAM LL, CP, and parm. - req.set16bit(12, 10); - req.set16bit(DDMTerm.DCLNAM, 12); - System.arraycopy(dclName, 0, req.data_, 14, 8); - - // Set the S38OPTL LL, CP, and parm. - req.set16bit(8, 22); - req.set16bit(DDMTerm.S38OPTL, 24); - req.data_[26] = (byte)type; - req.data_[27] = (byte)share; - req.data_[28] = (byte)data; - req.data_[29] = 0x01; // _OPER_GET - - return req; - } - - /** - *Returns the S38GET request data stream. - *@param dclName the declared file name for the file. - *@param type type option - *@param share share option - *@param data data option - *@return DDMRequestDataStream for retrieving a record. - * Term = S38GET - * Parms = DCLNAM => byte[8] containing declared name (alias) - * for the file. The first byte must be >= 0x40. - * Size = 6 --> Header (0-5) - * 2 --> LL S38GET term and parms (6,7) - * 2 --> CP S38GET code point (8,9) - * 2 --> LL DCLNAM term and parm length (10,11) - * 2 --> CP DCLNAM code point (12,13) - * 8 --> DCLNAM parm (14-21) - * 2 --> LL S38OPTL term and parm length (22,23) - * 2 --> CP S38OPTL code point (24,25) - * 4 --> S38OPTL parm - * 1 --> type (26) - * 1 --> share (27) - * 1 --> data (28) - * 1 --> operation (29) - * --- - * 30 --> data stream length - **/ - static DDMRequestDataStream getRequestS38GET(byte[] dclName, int type, - int share, int data) - { - DDMRequestDataStream req = new DDMRequestDataStream(30); - - req.set16bit(req.data_.length - 6, 6); // total length after header - req.set16bit(DDMTerm.S38GET, 8); - - // Set the DCLNAM LL, CP, and parm. - req.set16bit(12, 10); - req.set16bit(DDMTerm.DCLNAM, 12); - System.arraycopy(dclName, 0, req.data_, 14, 8); - - // Set the S38OPTL LL, CP, and parm. - req.set16bit(8, 22); - req.set16bit(DDMTerm.S38OPTL, 24); - req.data_[26] = (byte)type; - req.data_[27] = (byte)share; - req.data_[28] = (byte)data; - req.data_[29] = 1; // _OPER_GET - - return req; - } - - /** - *Returns the S38GETD request data stream. - *@param dclName the declared file name for the file. - *@param recordFormat the record format for the file. - *@param type type option - *@param share share option - *@param data data option - *@param rrn relative record number - *@param system the system from which to get the CCSID for conversions. - *@return DDMRequestDataStream for retrieving a record. - * Term = S38GETD - * Parms = DCLNAM => byte[8] containing declared name (alias) - * for the file. The first byte must be >= 0x40. - * Size = 6 --> Header (0-5) - * 2 --> LL S38GETD term and parms (6,7) - * 2 --> CP S38GETD code point (8,9) - * 2 --> LL DCLNAM term and parm length (10,11) - * 2 --> CP DCLNAM code point (12,13) - * 8 --> DCLNAM parm (14-21) - * 2 --> LL S38OPTL term and parm length (22,23) - * 2 --> CP S38OPTL code point (24,25) - * 4 --> S38OPTL parm - * 1 --> type (26) - * 1 --> share (27) - * 1 --> data (28) - * 1 --> operation (29) - * 2 --> LL S38CTLL term and parm length (30,31) - * 2 --> CP S38CTLL code point (32,33) - * 26--> S38CTLL parm - * 1 --> record format ID (34) - * 2 --> record format length (35,36) - * 10--> record format name (37-46) - * 1 --> member number ID (47) - * 2 --> member number length (48,49) - * 2 --> member number value (50,51) - * 1 --> relative record number ID (52) - * 2 --> relative record number length (53,54) - * 4 --> relative record number (55-58) - * 1 --> control list end (59) - * --- - * 60 --> data stream length - **/ -// static DDMRequestDataStream getRequestS38GETD(byte[] dclName, RecordFormat recordFormat, int type, int share, int data, int rrn, AS400 system) // @A1D - static DDMRequestDataStream getRequestS38GETD(byte[] dclName, - byte[] recordFormatCTLLName, - int type, - int share, - int data, - int rrn, - AS400ImplRemote system) // @A1A @B5C - throws AS400SecurityException, - InterruptedException, - IOException - { - DDMRequestDataStream req = new DDMRequestDataStream(60); - - req.set16bit(req.data_.length - 6, 6); // total length after header - req.set16bit(DDMTerm.S38GETD, 8); - - // Set the DCLNAM LL, CP, and parm. - req.set16bit(12, 10); - req.set16bit(DDMTerm.DCLNAM, 12); - System.arraycopy(dclName, 0, req.data_, 14, 8); - - // Set the S38OPTL LL, CP, and parm. - req.set16bit(8, 22); - req.set16bit(DDMTerm.S38OPTL, 24); - req.data_[26] = (byte)type; - req.data_[27] = (byte)share; - req.data_[28] = (byte)data; - req.data_[29] = 2; // _OPER_GETD - - // Set the S38CTLL LL, CP, and parm. The control list sequence for - // GETD parm is record format, member number, relative record number, - // and control list end. - req.set16bit(30, 30); - req.set16bit(DDMTerm.S38CTLL, 32); - req.data_[34] = 1; // record format ID - req.set16bit(10, 35); // record format length - - // Start of @A2D - /* - StringBuffer recordName = new StringBuffer(recordFormat.getName()); - while (recordName.length() < 10) recordName.append(' '); - Converter c = Converter.getConverter(system.getCcsid(), system); - c.stringToByteArray(recordName.toString(), req.data_, 37); - */ - // End of @A2D - - // @A2A - System.arraycopy(recordFormatCTLLName, 0, req.data_, 37, recordFormatCTLLName.length); - - req.data_[47] = 0xf; // member number ID - req.set16bit(2, 48); // member number length - req.set16bit(0, 50); // member number value - req.data_[52] = 2; // relative record number ID - req.set16bit(4, 53); // relative record number length - req.set32bit(rrn, 55); // relative record number value - req.data_[59] = (byte) 0xff; // control list end - - return req; - } - - - /** - *Returns the S38GETK request data stream. - *@param dclName the declared file name for the file. - *@param recordFormat the record format for the file. - *@param type type option - *@param share share option - *@param data data option - *@param keyFields the fields of the key - *@param system the system from which to get the CCSID for conversions. - *@return DDMRequestDataStream for retrieving a record. - * Term = S38GETK - * Parms = DCLNAM => byte[8] containing declared name (alias) - * for the file. The first byte must be >= 0x40. - * Size = 6 --> Header (0-5) - * 2 --> LL S38GETK term and parms (6,7) - * 2 --> CP S38GETK code point (8,9) - * 2 --> LL DCLNAM term and parm length (10,11) - * 2 --> CP DCLNAM code point (12,13) - * 8 --> DCLNAM parm (14-21) - * 2 --> LL S38OPTL term and parm length (22,23) - * 2 --> CP S38OPTL code point (24,25) - * 4 --> S38OPTL parm - * 1 --> type (26) - * 1 --> share (27) - * 1 --> data (28) - * 1 --> operation (29) - * 2 --> LL S38CTLL term and parm length (30,31) - * 2 --> CP S38CTLL code point (32,33) - * ? --> S38CTLL parm - * 1 --> record format ID (34) - * 2 --> record format length (35,36) - * 10--> record format name (37-46) - * 1 --> member number ID (47) - * 2 --> member number length (48,49) - * 2 --> member number value (50,51) - * 1 --> number of fields ID (52) - * 2 --> number of fields length (53,54) - * 4 --> number of fields value (55-58) - * ? --> trio of ID, length, and value for each field (?) - * 1 --> control list end (?) - * --- - * 60 + length of the key fields as bytes + 3 - * --> data stream length - **/ -// static DDMRequestDataStream getRequestS38GETK(byte[] dclName, RecordFormat recordFormat, int type, int share, int data, Object[] keyFields, AS400 system) // @A2D - static DDMRequestDataStream getRequestS38GETK(byte[] dclName, - RecordFormat recordFormat, - byte[] recordFormatCTLLName, - int type, - int share, - int data, - Object[] keyFields, - AS400ImplRemote system) // @A2A @B5C - throws AS400SecurityException, - InterruptedException, - IOException - { - // Set up null key field map - // Set to true if any field is null -/*@E0D boolean containsNullKey = false; //@C2A - for (int i=0; ikeyFields. - *@return DDMRequestDataStream for retrieving a record. - * Term = S38GETK - * Parms = DCLNAM => byte[8] containing declared name (alias) - * for the file. The first byte must be >= 0x40. - * Size = 6 --> Header (0-5) - * 2 --> LL S38GETK term and parms (6,7) - * 2 --> CP S38GETK code point (8,9) - * 2 --> LL DCLNAM term and parm length (10,11) - * 2 --> CP DCLNAM code point (12,13) - * 8 --> DCLNAM parm (14-21) - * 2 --> LL S38OPTL term and parm length (22,23) - * 2 --> CP S38OPTL code point (24,25) - * 4 --> S38OPTL parm - * 1 --> type (26) - * 1 --> share (27) - * 1 --> data (28) - * 1 --> operation (29) - * 2 --> LL S38CTLL term and parm length (30,31) - * 2 --> CP S38CTLL code point (32,33) - * ? --> S38CTLL parm - * 1 --> record format ID (34) - * 2 --> record format length (35,36) - * 10--> record format name (37-46) - * 1 --> member number ID (47) - * 2 --> member number length (48,49) - * 2 --> member number value (50,51) - * 1 --> number of fields ID (52) - * 2 --> number of fields length (53,54) - * 4 --> number of fields value (55-58) - * ? --> trio of ID, length, and value for each field (?) - * 1 --> control list end (?) - * --- - * 60 + length of the key fields as bytes + 3 - * --> data stream length - **/ -// static DDMRequestDataStream getRequestS38GETK(byte[] dclName, RecordFormat recordFormat, int type, int share, int data, byte[] keyFields, AS400 system, int numberOfKeyFields) // @A2D - static DDMRequestDataStream getRequestS38GETK(byte[] dclName, - byte[] recordFormatCTLLName, - int type, - int share, - int data, - byte[] keyFields, - AS400ImplRemote system, //@B5C - int numberOfKeyFields) // @A2A - throws AS400SecurityException, - InterruptedException, - IOException - { - int reqLength = 60; - // Determine the total length of all data in keyFields. - FieldDescription description; - int keyLength = keyFields.length; - reqLength += keyLength + 3; // account for ID and length bytes when specifying - // the key parm on the control list. - - // Instantiate a DDM request stream. - DDMRequestDataStream req = new DDMRequestDataStream(reqLength); - - req.set16bit(reqLength - 6, 6); // total length after header - req.set16bit(DDMTerm.S38GETK, 8); - - // Set the DCLNAM LL, CP, and parm. - req.set16bit(12, 10); - req.set16bit(DDMTerm.DCLNAM, 12); - System.arraycopy(dclName, 0, req.data_, 14, 8); - - // Set the S38OPTL LL, CP, and parm. - req.set16bit(8, 22); - req.set16bit(DDMTerm.S38OPTL, 24); - req.data_[26] = (byte)type; - req.data_[27] = (byte)share; - req.data_[28] = (byte)data; - req.data_[29] = 3; // _OPER_GETK - - // Set the S38CTLL CP and parm. The control list sequence for - // GETK parm is record format, member number, number of fields, key - // fields, and control list end. - req.set16bit(DDMTerm.S38CTLL, 32); - req.data_[34] = 1; // record format ID - req.set16bit(10, 35); // record format length - - // Start of @A2D - /* - StringBuffer recordName = new StringBuffer(recordFormat.getName()); - while (recordName.length() < 10) recordName.append(' '); - Converter c = Converter.getConverter(system.getCcsid(), system); - c.stringToByteArray(recordName.toString(), req.data_, 37); - */ - // End of @A2D - - // @A2A - System.arraycopy(recordFormatCTLLName, 0, req.data_, 37, recordFormatCTLLName.length); - - req.data_[47] = 0xf; // member number ID - req.set16bit(2, 48); // member number length - req.set16bit(0, 50); // member number value - req.data_[52] = 8; // number of fields ID - req.set16bit(4, 53); // number of fields length - req.set32bit(numberOfKeyFields, 55); // number of fields value - - // Add key fields to the request. - int offset = 59; - AS400DataType dataType; - // Add the ID and length for this key field. - req.data_[offset++] = 7; - req.set16bit(keyLength, offset); - offset += 2; - System.arraycopy(keyFields, 0, req.data_, offset, keyLength); - offset += keyLength; - // Mark the end of control list. - req.data_[offset] = (byte) 0xff; - - // Set the S38CTLL LL. - req.set16bit(offset - 29, 30); - if (Trace.isTraceOn() && Trace.isTraceDiagnosticOn()) - { - Trace.log(Trace.DIAGNOSTIC, "GETK req: ", req.data_); - } - return req; - } - - - /** - *Returns the S38GETM request data stream. - *@param dclName the declared file name for the file. - *@param type type option - *@param share share option - *@param data data option - *@param oper operation option - *@return DDMRequestDataStream for retrieving a record. - * Term = S38GETM - * Parms = DCLNAM => byte[8] containing declared name (alias) - * for the file. The first byte must be >= 0x40. - * Size = 6 --> Header (0-5) - * 2 --> LL S38GETM term and parms (6,7) - * 2 --> CP S38GETM code point (8,9) - * 2 --> LL DCLNAM term and parm length (10,11) - * 2 --> CP DCLNAM code point (12,13) - * 8 --> DCLNAM parm (14-21) - * 2 --> LL S38OPTL term and parm length (22,23) - * 2 --> CP S38OPTL code point (24,25) - * 4 --> S38OPTL parm - * 1 --> type (26) - * 1 --> share (27) - * 1 --> data (28) - * 1 --> operation (29) - * 2 --> LL S38CTLL term and parm length (30,31) - * 2 --> CP S38CTLL code point (32,33) - * 5 --> S38CTLL parm - * 1 --> number of records ID (34) - * 2 --> number records value length (35,36) - * 2 --> number of records value (37,38) - * 1 --> control list end (39) - * - * --- - * 40 --> data stream length - **/ - static DDMRequestDataStream getRequestS38GETM(byte[] dclName, - int numberOfRecords, - int type, - int share, - int data, - int oper) - { - DDMRequestDataStream req = new DDMRequestDataStream(40); - - req.set16bit(req.data_.length - 6, 6); // total length after header - req.set16bit(DDMTerm.S38GETM, 8); - - // Set the DCLNAM LL, CP, and parm. - req.set16bit(12, 10); - req.set16bit(DDMTerm.DCLNAM, 12); - System.arraycopy(dclName, 0, req.data_, 14, 8); - - // Set the S38OPTL LL, CP, and parm. - req.set16bit(8, 22); - req.set16bit(DDMTerm.S38OPTL, 24); - req.data_[26] = (byte) type; - req.data_[27] = (byte) share; - req.data_[28] = (byte) data; - req.data_[29] = (byte) oper; - - // Set the S38CTLL LL, CP, and parm. The control list sequence for - // GETD parm is record format, member number, relative record number, - // and control list end. - req.set16bit(10, 30); - req.set16bit(DDMTerm.S38CTLL, 32); - req.data_[34] = 0x10; // number of records ID - req.set16bit(2, 35); // number of records length - req.set16bit(numberOfRecords, 37); // number of records value - req.data_[39] = (byte) 0xff; // control list end - return req; - } - - /** - *Returns the open file data stream request. - *@param ufcb the user file control block byte array. - *@param dclName the declared file name for the file. - *@return DDMRequestDataStream for opening file. - *Open file request: - * Term = S38OPEN - * Parms = DCLNAM => byte[8] containing declared name (alias) - * for the file. The first byte must be >= 0x40. - * S38UFCB => byte string containing the user file control block - * format. This format is defined by XPF PLMIINC - * WWUFCB. - * Size = 6 --> Header (0 - 5) - * 2 --> LL Length of S38OPEN term and parms (6,7) - * 2 --> CP S38OPEN code point (8,9) - * 2 --> LL Length of DCLNAM term and parm (10,11) - * 2 --> CP DCLNAM code point (12,13) - * 8 --> DCLNAM parm (14 - 21) - * 2 --> LL Length of S38UFCB term and parm (22,23) - * 2 --> CP S38UFCB code point (23,24) - * ufcb.length - * --> S38UFCB parm (25 - 25 + ufcb.length - 1) - * ----- - * 26 + ufcb.length --> Total length of the data stream - **/ - static DDMRequestDataStream getRequestS38OPEN(byte[] ufcb, byte[] dclName) - { - // The total length of this data stream is 26 + ufcb.length - DDMRequestDataStream req = new DDMRequestDataStream(26 + ufcb.length); - - req.set16bit(20 + ufcb.length, 6); // Set total length remaining after header - req.set16bit(DDMTerm.S38OPEN, 8); // Set code point for S38OPEN term - req.set16bit(12, 10); // Set length of DCLNAM parm - req.set16bit(DDMTerm.DCLNAM, 12); // Set code point for DCLNAM parm - // Set the declared name; declaredName is an 8-byte array - System.arraycopy(dclName, 0, req.data_, 14, 8); - req.set16bit(4 + ufcb.length, 22); // Set length of S38UFCB parm - req.set16bit(DDMTerm.S38UFCB, 24); // Set code point for S38UFCB - System.arraycopy(ufcb, 0, req.data_, 26, ufcb.length); - - return req; - } - - - /** - *Returns the S38PUTM request data stream. - *@param dclName the declared file name. - *@return DDMRequestDataStream to put multiple records. - * Term = S38PUTM - * Parms = DCLNAM => byte[8] containing declared name (alias) - * for the file. The first byte must be >= 0x40. - * Size = 6 --> Header (0-5) - * 2 --> LL S38PUT term and parms (6,7) - * 2 --> CP S38PUT code point (8,9) - * 2 --> LL DCLNAM term and parm length (10,11) - * 2 --> CP DCLNAM code point (12,13) - * 8 --> DCLNAM parm (14-21) - * -------------------------- - * 22--> total length - **/ - static DDMRequestDataStream getRequestS38PUTM(byte[] dclName) - { - DDMRequestDataStream req = new DDMRequestDataStream(22); - - req.set16bit(req.data_.length - 6, 6); // total length after header - req.set16bit(DDMTerm.S38PUTM, 8); - - // Set the DCLNAM LL, CP, and parm. - req.set16bit(12, 10); - req.set16bit(DDMTerm.DCLNAM, 12); - System.arraycopy(dclName, 0, req.data_, 14, 8); - - return req; - } - - - -// /** -// *Returns the SXXPUTDR request data stream. -// *@param dclName the declared file name for the file. -// *@param recordFormat the record format for the file. -// *@param type type option -// *@param share share option -// *@param data data option -// *@param rrn relative record number -// *@param system the system from which to get the CCSID for conversions. -// *@return DDMRequestDataStream for putting a record by record number. -// * Term = SXXPUTDR -// * Parms = DCLNAM => byte[8] containing declared name (alias) -// * for the file. The first byte must be >= 0x40. -// * Size = 6 --> Header (0-5) -// * 2 --> LL SXXPUTDR term and parms (6,7) -// * 2 --> CP SXXPUTDR code point (8,9) -// * 2 --> LL DCLNAM term and parm length (10,11) -// * 2 --> CP DCLNAM code point (12,13) -// * 8 --> DCLNAM parm (14-21) -// * 2 --> LL S38CTLL term and parm length (22,23) -// * 2 --> CP S38CTLL code point (24,25) -// * 26--> S38CTLL parm -// * 1 --> record format ID (26) -// * 2 --> record format length (27,28) -// * 10--> record format name (29-38) -// * 1 --> member number ID (39) -// * 2 --> member number length (40,41) -// * 2 --> member number value (42,43) -// * 1 --> relative record number ID (44) -// * 2 --> relative record number length (45,46) -// * 4 --> relative record number (47-50) -// * 1 --> control list end (51) -// * 2 --> LL S38OPTL term and parm length (52,53) -// * 2 --> CP S38OPTL code point (54,55) -// * 4 --> S38OPTL parm -// * 1 --> type (56) -// * 1 --> share (57) -// * 1 --> data (58) -// * 1 --> operation (59) -// * 2 --> LL S38BUF term and parm length (60,61) -// * 2 --> CP S38BUF code point (62,63) -// * recordData.length -// * --> S38BUF parm (64 - 64 + openFeedback.getRecordIncrement()) -// * -// * --- -// * 64 + openFeedback.getRecordIncrement() --> data stream length -// *@exception CharConversionException If an error occurs during conversion. -// *@exception UnsupportedEncodingException If an error occurs during conversion. -// **/ -// /* Currently not used. -// static DDMRequestDataStream getRequestSXXPUTDR(byte[] dclName, -// DDMS38OpenFeedback openFeedback, -// Record record, -// int rrn, -// AS400 system) -// throws CharConversionException, -// UnsupportedEncodingException -// { -// DDMRequestDataStream req = -// new DDMRequestDataStream(64 + openFeedback.getRecordIncrement()); -// -// req.set16bit(req.data_.length - 6, 6); // total length after header -// req.set16bit(DDMTerm.SXXPUTDR, 8); -// -// // Set the DCLNAM LL, CP, and parm. -// req.set16bit(12, 10); -// req.set16bit(DDMTerm.DCLNAM, 12); -// System.arraycopy(dclName, 0, req.data_, 14, 8); -// -// // Set the S38CTLL LL, CP, and parm. The control list sequence for -// // PUTDR parm is record format, member number, relative record number, -// // and control list end. -// RecordFormat recordFormat = record.getRecordFormat(); -// req.set16bit(30, 22); -// req.set16bit(DDMTerm.S38CTLL, 24); -// req.data_[36] = 1; // record format ID -// req.set16bit(10, 27); // record format length -// StringBuffer recordName = new StringBuffer(recordFormat.getName()); -// while (recordName.length() < 10) recordName.append(' '); -// Converter c = Converter.getConverter(system.getCcsid(), system); -// c.stringToByteArray(recordName.toString(), req.data_, 29); -// req.data_[39] = 0xf; // member number ID -// req.set16bit(2, 40); // member number length -// req.set16bit(0, 50); // member number value -// req.data_[44] = 2; // relative record number ID -// req.set16bit(4, 45); // relative record number length -// req.set32bit(rrn, 47); // relative record number value -// req.data_[51] = (byte) 0xff; // control list end -// -// // Set the S38OPTL LL, CP, and parm. -// req.set16bit(8, 52); -// req.set16bit(DDMTerm.S38OPTL, 54); -// req.data_[56] = 0x11; -// req.data_[57] = 0; // not used, must be zero -// req.data_[58] = 0; // not used, must be zero -// req.data_[59] = 4; // -// -// // Set the S38BUF LL, CP. -// req.set16bit(openFeedback.getRecordIncrement() + 4, 60); -// req.set16bit(DDMTerm.S38BUF, 62); -// -// // Write the record data. -// byte[] recordData = record.getContents(); -// System.arraycopy(recordData, 0, req.data_, 64, recordData.length); -// -// // Write the null byte map array after the record data. It starts -// // openFeedback.getNullFieldByteMapOffset() bytes from the -// // beginning of the record. 0xf1 == null, 0xf0 != null -// int byteMapOffset = 64 + openFeedback.getNullFieldByteMapOffset(); -// for (int i = 0; i < record.getNumberOfFields(); i++) -// { -// req.data_[byteMapOffset + i] = -// (record.isNullField(i) ? (byte) 0xf1 : (byte) 0xf0); -// } -// -// if (Trace.isTraceOn() && Trace.isTraceDiagnosticOn()) -// { -// Trace.log(Trace.DIAGNOSTIC, "getRequestS38PUTDR", req.data_); -// } -// -// return req; -// } -// */ - - -//@B1D: Removed this method since readAll() no longer uses it. -// /** -// *Returns the unload all records data stream request. -// *@param fileType the type of access, SEQ or KEY. -// *@param library the library name. -// *@param file the file name. -// *@param member the member name. -// *@param system the AS400object from which to get the CCSID for conversions. -// *@return DDMRequestDataStream for reading all records from a file. -// *ULDRECF: -// * Term = ULDRECF -// * Parms = FILNAM => File name -// * 2 --> LL Length of FILNAM term and parm -// * 2 --> CP FILNAM code point -// * library.length() + file.length() + member.length() + 3 -// * --> FILNAM parm, library/file(member) -// * ACCORD => Access order - valid values: RNBORD or KEYORD -// * -// * Size = 6 --> Header (0 - 5) -// * 2 --> LL Length of ULDRECF term and parms -// * 2 --> CP ULDRECF code point -// * 2 --> LL Length of FILNAM term and parm -// * 2 --> CP FILNAM code point -// * library.length() + file.length() + member.length() + 3 -// * --> FILNAM parm, library/file(member) -// * 2 --> LL Length of RTNINA term and parms -// * 2 --> CP RTNINA code point -// * 1 --> 'F0' == false -// * If fileType = "key": -// * 2 --> LL Length of ACCORD term and parm -// * 2 --> CP ACCORD code point -// * 2 --> RNBORD or KEYORD code point -// * ----- -// * 25|19 + library.length() + file.length() + member.length() + 3 -// **/ -// //@B1D: start block -// /* -// static DDMRequestDataStream getRequestULDRECF(String fileType, String library, -// String file, String member, AS400 system) -// throws AS400SecurityException, -// InterruptedException, -// IOException -// { -// int dsLength = (fileType.equalsIgnoreCase("key"))? 25 : 19; -// int fileNameLength = library.length() + file.length() + member.length() + 3; -// DDMRequestDataStream req = new DDMRequestDataStream(dsLength + fileNameLength); -// -// req.set16bit(dsLength + fileNameLength - 6, 6); // Set length after header -// req.set16bit(DDMTerm.ULDRECF, 8); // Set code point for ULDRECF -// req.set16bit(fileNameLength + 4, 10); // Set length for FILNAM parm -// req.set16bit(DDMTerm.FILNAM, 12); // Set code point for FILNAM -// // Set the file name parm -// Converter c = Converter.getConverter(system.getCcsid(), system); -// c.stringToByteArray(library + "/" + file + "(" + member + ")", req.data_, 14); -// req.set16bit(5, 14 + fileNameLength); // Set LL for RTNINA -// req.set16bit(DDMTerm.RTNINA, 16 + fileNameLength); // Set RTNINA code point -// req.data_[18 + fileNameLength] = (byte)0xF0; // false; don't return inactive records -// // Set ACCORD parm value -// if (dsLength == 25) -// { -// req.set16bit(6, 19 + fileNameLength); // Set length of ACCORD parm -// req.set16bit(DDMTerm.ACCORD, 21 + fileNameLength); // Set code point for ACCORD -// req.set16bit(DDMTerm.KEYORD, 23 + fileNameLength); -// } -// return req; -// } -//*/ -//@B1D: end block - - /** - *Returns the S38UPDAT request data stream. - *@param type type option - *@param share share option - *@param data data option - *@param dclName the declared file name. - *@return DDMRequestDataStream to put a record. - * Term = S38UPDAT - * Parms = DCLNAM => byte[8] containing declared name (alias) - * for the file. The first byte must be >= 0x40. - * Size = 6 --> Header (0-5) - * 2 --> LL S38UPDAT term and parms (6,7) - * 2 --> CP S38UPDAT code point (8,9) - * 2 --> LL DCLNAM term and parm length (10,11) - * 2 --> CP DCLNAM code point (12,13) - * 8 --> DCLNAM parm (14-21) - * 2 --> LL S38OPTL term and parm length (22,23) - * 2 --> CP S38OPTL code point (24,25) - * 4 --> S38OPTL parm - * 1 --> type (26) - * 1 --> share (27) - * 1 --> data (28) - * 1 --> operation (29) - * ---- - * 30 --> total request length - **/ - static DDMRequestDataStream getRequestS38UPDAT(int type, - int share, - int data, - byte[] dclName) - { - DDMRequestDataStream req = new DDMRequestDataStream(30); - - req.set16bit(req.data_.length - 6, 6); // total length after header - req.set16bit(DDMTerm.S38UPDAT, 8); - - // Set the DCLNAM LL, CP, and parm. - req.set16bit(12, 10); - req.set16bit(DDMTerm.DCLNAM, 12); - System.arraycopy(dclName, 0, req.data_, 14, 8); - - // Set the S38OPTL LL, CP, and parm. - req.set16bit(8, 22); - req.set16bit(DDMTerm.S38OPTL, 24); - req.data_[26] = (byte) type; - req.data_[27] = (byte) share; - req.data_[28] = (byte) data; - req.data_[29] = 7; // update operation - - if (Trace.isTraceOn() && Trace.isTraceDiagnosticOn()) - { - Trace.log(Trace.DIAGNOSTIC, "getRequestS38UPDAT", req.data_); - } - - return req; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/DDMS38IOFB.java b/cvsroot/src/com/ibm/as400/access/DDMS38IOFB.java deleted file mode 100644 index bd9045dc9..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMS38IOFB.java +++ /dev/null @@ -1,101 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMS38IOFB.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - *Class representing the S38IOFB data returned for the S38IOFB DDM term when - *a I/O operation is done on a database file. -**/ -class DDMS38IOFB -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private static final int RECORD_FORMAT = 0; // Offset to the record format name - private static final int RECORD_FORMAT_LENGTH = 10; // Length of the record format name - private static final int RECORD_LEN = 10; // Offset to the record length (4 bytes) - private static final int NUMBER_OF_RECORDS = 14; // Offset to the number of records returned - private static final int NUMBER_OF_RECORDS_LOCKED = 17; // Offset to the number of records locked - private static final int RRN_MOST_RECENTLY_LOCKED = 19; // Offset to the relative record number of the most recently locked record (4 bytes) - private static final int MEMBER_LOCKED = 23; // Offset to the member number of the most recently locked member - private static final int RECORD_NUMBER = 55; // Offset to record number of the record read - // Array containing IO feedback information - protected byte[] data_; - // Offset in data_ at which the IO feedback info starts - protected int offset_; - - /** - *Constructs a DDMS38IOFB object from the specified data starting at the - *specified offset in data. - *@param data the data from which to extract the S38IOFB info. - *@param offset the offset in data at which the S38IOFB info starts. - **/ - DDMS38IOFB(byte[] data, int offset) - { - // Set the instance data - // The getters will extract the information directly from data_ based on the - // defined constants and offset_. - // Both data and offset are expected to be valid and will not be checked here. - data_ = data; - offset_ = offset; - } - - /** - *Returns the number of records returned from the i/o operation that this - *object provides feedback for. - *@return the number of records. - **/ - int getNumberOfRecordsReturned() - { - return BinaryConverter.byteArrayToUnsignedShort(data_, offset_ + NUMBER_OF_RECORDS); - } - - /** - *Returns the record length of the records for the i/o operation that this - *object provides feedback for. - *@return the record length. - **/ - int getRecordLength() - { - return BinaryConverter.byteArrayToInt(data_, offset_ + RECORD_LEN); - } - - /** - *Returns the record number of the record returned from the i/o operation that this - *object provides feedback for. - *@return the record number. - **/ - int getRecordNumber() - { - return BinaryConverter.byteArrayToInt(data_, offset_ + RECORD_NUMBER); - } - - /** - *Returns the information provided in the S38IOFB as a string. This method is - *used for logging S38IOFB information. - *@return the S38IOFB as a string. - **/ - public String toString() - { - StringBuffer str = new StringBuffer(); - str.append("Number of records returned: "); - str.append((new Integer(getNumberOfRecordsReturned())).toString()); - str.append("\n"); - - str.append("Record length: "); - str.append((new Integer(getRecordLength())).toString()); - str.append("\n"); - - return str.toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DDMS38OpenFeedback.java b/cvsroot/src/com/ibm/as400/access/DDMS38OpenFeedback.java deleted file mode 100644 index 307341b86..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMS38OpenFeedback.java +++ /dev/null @@ -1,411 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMS38OpenFeedback.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - *Class representing the open feedback structure. The structure - *is described by CINC WWODPOFB. -**/ -class DDMS38OpenFeedback -{ - // offsets and byte lengths of the various portions of the feedback structure - // that we are interested in - private static final int FILE_OPEN_TYPE = 10; - private static final int FILE_NAME = 11; - private static final int FILE_NAME_LENGTH = 10; - private static final int LIB_NAME = 21; - private static final int LIB_NAME_LENGTH = 10; - private static final int MBR_NAME = 31; - private static final int MBR_NAME_LENGTH = 10; - private static final int RECORD_LEN = 41; - private static final int INP_BUFFER_LEN = 45; - private static final int OUT_BUFFER_LEN = 49; - private static final int NUM_RECORDS = 53; - private static final int ACCESS_TYPE = 57; - private static final int ACCESS_TYPE_LENGTH = 2; - private static final int SUPPORT_DUPLICATE_KEYS = 59; - private static final int SUPPORT_DUPLICATE_KEYS_LENGTH = 1; - private static final int SOURCE_FILE_INDICATOR = 60; - private static final int SOURCE_FILE_INDICATOR_LENGTH = 1; - private static final int UFCB_PARAMETERS = 61; - private static final int UFCB_PARAMETERS_LENGTH = 10; - private static final int MAX_BLOCKED_RECORDS_TRANSFERRED = 71; - private static final int RECORD_INCREMENT = 73; - private static final int OPEN_FLAGS_1= 75; // Contains info on if MBR(*ALL) was specified, if this - // is a logical join file, etc. - private static final int NUMBER_OF_ASSOCIATED_PHYS_FILE_MBRS = 76; - private static final int MAX_RECORD_LENGTH = 82; - private static final int RECORD_WAIT_TIME = 84; - private static final int OPEN_FLAGS_2 = 88; // Contains info indicating if file contains variable - // length fields, whether variable length processing will - // be done, ODP scope, etc. - private static final int NULL_FIELD_BYTE_MAP = 90; - private static final int NULL_KEY_FIELD_BYTE_MAP = 92; - private static final int CCSID = 98; - private static final int FIXED_FIELD_LEN = 100; // Total length of the fixed fields in a variable length - // record. - private static final int MIN_RECORD_LEN = 102; - - // The openfeedback data - byte[] data_; - // The offset into the data. - int offset_; - // Converter for EBCDIC to ASCII conversions - ConverterImplRemote conv_; //@B5C - - /** - *Construct a DDMS38OpenFeedback object from the specified data. - *@param system the system from which to get the CCSID for converions. - *@param data the data from which to obtain the open feedback information. - **/ - DDMS38OpenFeedback(AS400ImplRemote system, byte[] data) //@B5C - throws AS400SecurityException, - InterruptedException, - IOException - { - this(system, data, 0); - } - - /** - *Construct a DDMS38OpenFeedback object from the specified data. - *@param system the system from which to get the CCSID for converions. - *@param data the data from which to obtain the open feedback information. - **/ - DDMS38OpenFeedback(AS400ImplRemote system, byte[] data, int offset) //@B5C - throws AS400SecurityException, - InterruptedException, - IOException - { - data_ = data; - offset_ = offset; - conv_ = ConverterImplRemote.getConverter(system.getCcsid(), system); //@B5C - } - - /** - *Returns the access type of the file. - *@return the access type if the the file. - **/ - String getAccessType() - throws AS400SecurityException, - InterruptedException, - IOException - { - return conv_.byteArrayToString(data_, offset_ + ACCESS_TYPE, - ACCESS_TYPE_LENGTH); - } - - /** - *Returns the CCSID of the file. - *@return the CCSID of the file. - **/ - int getCCSID() - { - return BinaryConverter.byteArrayToUnsignedShort(data_, offset_ + CCSID); - } - - /** - *Indicates if duplicate keys are supported by the file. - *@return true if duplicate keys are supported; false otherwise. - **/ - boolean duplicateKeysSupported() - { - if (data_[offset_ + SUPPORT_DUPLICATE_KEYS] == (byte)0xC4) - { - return true; - } - return false; - } - - /** - *Returns the file name of the file. - *@return the file name of the file. - **/ - String getFileName() - throws AS400SecurityException, - InterruptedException, - IOException - { - return conv_.byteArrayToString(data_, offset_ + FILE_NAME, - FILE_NAME_LENGTH); - } - - /** - *Returns the input buffer length for the file. - *@return the input buffer length. - **/ - int getInputBufferLength() - { - return BinaryConverter.byteArrayToInt(data_, offset_ + INP_BUFFER_LEN); - } - - /** - *Returns the library name of the file. - *@return the library name of the file. - **/ - String getLibraryName() - throws AS400SecurityException, - InterruptedException, - IOException - { - return conv_.byteArrayToString(data_, offset_ + LIB_NAME, LIB_NAME_LENGTH); - } - - /** - *Returns the maximum number of records that can read or written at one time. - *@return the maximum number of records that can be transferred at one time. - **/ - int getMaxNumberOfRecordsTransferred() - { - return BinaryConverter.byteArrayToUnsignedShort(data_, offset_ + MAX_BLOCKED_RECORDS_TRANSFERRED); - } - - /** - *Returns the member name. - *@return the member name. - **/ - String getMemberName() - throws AS400SecurityException, - InterruptedException, - IOException - { - return conv_.byteArrayToString(data_, offset_ + MBR_NAME, MBR_NAME_LENGTH); - } - - /** - *Returns the offset to the null field byte map for a record. - *@return the offset to the null field byte map. - **/ - int getNullFieldByteMapOffset() - { - return BinaryConverter.byteArrayToUnsignedShort(data_, offset_ + NULL_FIELD_BYTE_MAP); - } - - /** - *Returns the number of records in the file at open time. - *@return the number of records in the file at open time. - **/ - int getNumberOfRecords() - { - return BinaryConverter.byteArrayToInt(data_, offset_ + NUM_RECORDS); - } - - /** - *Returns the type of open for which the file is opened. - *@return the type of open for which the file is opened. - **/ - int getOpenType() - { - int type = data_[offset_ + FILE_OPEN_TYPE] & 0xFFFF; - if (type == 64 || type == 68 || type == 192 || type == 196) - { - return AS400FileConstants.READ_ONLY; //@B0C - } - else if (type == 32 || type == 36 || type == 160 || type == 164) - { - return AS400FileConstants.WRITE_ONLY; //@B0C - } - else - { - return AS400FileConstants.READ_WRITE; //@B0C - } - } - - /** - *Returns the output buffer length for the file. - *@return the output buffer length. - **/ - int getOutputBufferLength() - { - return BinaryConverter.byteArrayToInt(data_, offset_ + OUT_BUFFER_LEN); - } - - /** - *Returns the record increment for the records in the file. This is the number - *of bytes that will be returned or that need to be sent for a single record. - *It includes bytes for the record data, a gap of zero or more bytes and bytes - *for the null field byte map. - *@return the record increment. - **/ - int getRecordIncrement() - { - return BinaryConverter.byteArrayToUnsignedShort(data_, offset_ + RECORD_INCREMENT); - } - - /** - *Returns the record length of the records in the file. - *@return the record length of the records in the file. - **/ - int getRecordLength() - { - return BinaryConverter.byteArrayToUnsignedShort(data_, offset_ + RECORD_LEN); - } - - /** - *Indicates if the file contains variable length fields. - *@return true if the file contains variable length fields; false otherwise. - **/ - boolean hasVariableLengthFields() - { - if ((data_[offset_ + OPEN_FLAGS_2 + 1] & 0x80) == 0x80) - { - return true; - } - return false; - } - - /** - *Indicates if the file is a logical file. - *@return true if the file is a logical file; false otherwise. - **/ - boolean isLogicalFile() - { - if ((data_[offset_ + OPEN_FLAGS_1] & 0x80) == 0x80) - { - return true; - } - return false; - } - - /** - *Indicates if the file is a logical join file. - *@return true if the file is a logical join file; false otherwise. - **/ - boolean isLogicalJoinFile() - { - if ((data_[offset_ + OPEN_FLAGS_1] & 0x04) == 0x04) - { - return true; - } - return false; - } - - /** - *Indicates if the file contains null capable fields. - *@return true if the file contains null capable fields; false otherwise. - **/ - boolean isNullCapable() - { - if ((data_[offset_ + OPEN_FLAGS_2 + 1] & 0x40) == 0x40) - { - return true; - } - return false; - } - - /** - *Indicates if the file is a source file. - *@return true if the file is a source file; false otherwise. - **/ - boolean isSourceFile() - { - return (data_[offset_ + SOURCE_FILE_INDICATOR] == (byte)0xE8); - } - - /** - *Returns the contents of the openfeedback area as a string. Used for - *logging diagnostic information regarding the open of a file. - *@return the contents of the openfeedback area as a string. - **/ - public String toString() - { - StringBuffer str = new StringBuffer(0); - try - { - str.append("Open type: "); - str.append(getOpenType()); - str.append("\n"); - - str.append("Library name: "); - str.append(getLibraryName()); - str.append("\n"); - - str.append("File name: "); - str.append(getFileName()); - str.append("\n"); - - str.append("Member name: "); - str.append(getMemberName()); - str.append("\n"); - - str.append("Record length: "); - str.append(getRecordLength()); - str.append("\n"); - - str.append("Input buffer length: "); - str.append(getInputBufferLength()); - str.append("\n"); - - str.append("Output buffer length: "); - str.append(getOutputBufferLength()); - str.append("\n"); - - str.append("Number of records: "); - str.append(getNumberOfRecords()); - str.append("\n"); - - str.append("Access type: "); - str.append(getAccessType()); - str.append("\n"); - - str.append("Duplicate keys supported: "); - str.append(duplicateKeysSupported()); - str.append("\n"); - - str.append("Source file: "); - str.append(isSourceFile()); - str.append("\n"); - - str.append("Max blocked records transferred: "); - str.append(getMaxNumberOfRecordsTransferred()); - str.append("\n"); - - str.append("Record increment: "); - str.append(getRecordIncrement()); - str.append("\n"); - - str.append("Has variable length fields: "); - str.append(hasVariableLengthFields()); - str.append("\n"); - - str.append("Is null capable: "); - str.append(isNullCapable()); - str.append("\n"); - - str.append("Offset to null byte field map: "); - str.append(getNullFieldByteMapOffset()); - str.append("\n"); - - str.append("Logical file: "); - str.append(isLogicalFile()); - str.append("\n"); - - str.append("Logical join file: "); - str.append(isLogicalJoinFile()); - str.append("\n"); - - str.append("CCSID: "); - str.append(getCCSID()); - str.append("\n"); - } - catch(Exception e) - { // This should never happen; the AS400 object is connected when - // it is provided to us on the constructor. Need to shut up the compiler. - Trace.log(Trace.ERROR, e); - throw new InternalErrorException(InternalErrorException.UNKNOWN, e.getMessage()); - } - return str.toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DDMSECCHKReplyDataStream.java b/cvsroot/src/com/ibm/as400/access/DDMSECCHKReplyDataStream.java deleted file mode 100644 index 558479543..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMSECCHKReplyDataStream.java +++ /dev/null @@ -1,74 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMSECCHKReplyDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -class DDMSECCHKReplyDataStream extends DDMDataStream -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Check the reply. - boolean checkReply() - { - if (getCodePoint() != DDMTerm.SECCHKRD) - { - Trace.log(Trace.ERROR, "DDM SECCHK failed with code point:", data_, 8, 2); - return false; - } - if (get16bit(18) != DDMTerm.SECCHKCD) - { - Trace.log(Trace.ERROR, "DDM SECCHK failed with rc:", data_, 18, 2); - return false; - } -//@G0D if (data_[data_.length - 1] != 0x00) // The last byte in the stream. -//@G0D { -//@G0D Trace.log(Trace.ERROR, "DDM SECCHK failed with last byte:", data_, data_.length - 1, 1); -//@G0D return false; -//@G0D } - if (data_.length < 21) //@G0A - { - Trace.log(Trace.ERROR, "DDM SECCHK failed with length < 21:", data_); - return false; - } - if (data_[20] != 0) //@G0A - { - Trace.log(Trace.ERROR, "DDM SECCHK failed with bad SECCHKCD:", data_, 20, 1); - return false; - } - - // A code of 0x00 means the password was accepted. - return true; - } - - void read(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving DDM SECCHK reply..."); - // Receive the header. - byte[] header = new byte[6]; - if (readFromStream(in, header, 0, 6) < 6) - { - Trace.log(Trace.ERROR, "Failed to read all of the DDM SECCHK Reply header."); - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - - // Allocate bytes for datastream. - data_ = new byte[BinaryConverter.byteArrayToUnsignedShort(header, 0)]; - System.arraycopy(header, 0, data_, 0, 6); - - // Read in the rest of the data. - readAfterHeader(in); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DDMSECCHKRequestDataStream.java b/cvsroot/src/com/ibm/as400/access/DDMSECCHKRequestDataStream.java deleted file mode 100644 index 63ba47b54..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMSECCHKRequestDataStream.java +++ /dev/null @@ -1,101 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMSECCHKRequestDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -class DDMSECCHKRequestDataStream extends DDMDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - DDMSECCHKRequestDataStream(byte[] userIDbytes, byte[] authenticationBytes, byte[] iasp, int byteType) - { - super(new byte[authenticationBytes.length + (iasp == null ? 0 : 22) + (byteType == AS400.AUTHENTICATION_SCHEME_PASSWORD ? 34 : 26)]); - - // Initialize the header: Don't continue on error, not chained, GDS id = D0, type = RQSDSS, no same request correlation. - setGDSId((byte)0xD0); - if (byteType != AS400.AUTHENTICATION_SCHEME_PASSWORD) - { - setLength(16); - setIsChained(true); - // setContinueOnError(false); - setHasSameRequestCorrelation(true); - setType(1); - set16bit(10, 6); // Set total length remaining after header. - set16bit(DDMTerm.SECCHK, 8); // Set code point for SECCHK. - set16bit(6, 10); // Set LL for SECMEC term. - set16bit(DDMTerm.SECMEC, 12); // Set code point for SECMEC. - // Set value of SECMEC parm. - if (byteType == AS400.AUTHENTICATION_SCHEME_GSS_TOKEN) - { - set16bit(11, 14); - } - else - { - set16bit(16, 14); - } - set16bit(authenticationBytes.length + 10, 16); // Set LL for SECCHK term. - set16bit(0xD003, 18); - - set16bit(authenticationBytes.length + 4, 22); // Set LL for SECCHK term. - set16bit(0x11DC, 24); // Set LL for SECMEC term. - System.arraycopy(authenticationBytes, 0, data_, 26, authenticationBytes.length); - } - else - { - boolean useRDB = (iasp != null); - // setIsChained(false); - // setContinueOnError(false); - // setHasSameRequestCorrelation(false); - setType(1); - set16bit(authenticationBytes.length + (useRDB ? 50 : 28), 6); // Set LL for SECCHK term. - set16bit(DDMTerm.SECCHK, 8); // Set code point for SECCHK. - set16bit(6, 10); // Set LL for SECMEC term. - set16bit(DDMTerm.SECMEC, 12); // Set code point for SECMEC. - if (authenticationBytes.length == 20) - { - set16bit(8, 14); // Set value for SECMEC term. - } - else - { - set16bit(6, 14); // Set value for SECMEC term. - } - set16bit(14, 16); // Set LL for USRID term. - set16bit(DDMTerm.USRID, 18); // Set code point for USRID. - // Set the user ID. - System.arraycopy(userIDbytes, 0, data_, 20, 10); - - set16bit(authenticationBytes.length + 4, 30); // Set LL for PASSWORD term. - set16bit(DDMTerm.PASSWORD, 32); // Set code point for PASSWORD. - // Set the password. - System.arraycopy(authenticationBytes, 0, data_, 34, authenticationBytes.length); - - if (useRDB) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending SECCHK request with RDB / IASP name."); - int offset = 34 + authenticationBytes.length; - set16bit(22, offset); - set16bit(DDMTerm.RDBNAM, offset + 2); - System.arraycopy(iasp, 0, data_, offset + 4, iasp.length); - } - } - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending DDM SECCHK request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DDMTerm.java b/cvsroot/src/com/ibm/as400/access/DDMTerm.java deleted file mode 100644 index 23cba0656..000000000 --- a/cvsroot/src/com/ibm/as400/access/DDMTerm.java +++ /dev/null @@ -1,146 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DDMTerm.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - *DDM terms. This class consists of defined constants for the DDM term code points. -**/ -class DDMTerm -{ -//@B1D static final int ACCORD = 0x1162; // Access order for ULDRECF - static final int ACCSEC = 0x106D; // Access method for exchange attributes - added by DDM server - static final int ACCRDBRM = 0x2201; // Access to RDB completed - static final int ACCSECRD = 0x14AC; // Access method reply from ACCSEC - static final int AGENT = 0x1403; // Agent resource manager - static final int AGNPRMRM = 0x1232; // Permanent agent error - static final int ALTINDF = 0x1423; // Alternate index file - static final int BYTDR = 0x0043; // Byte character - static final int BYTSTRDR = 0x0044; // Byte string - static final int CHRSTRDR = 0x0009; // Character string - static final int CMBACCAM = 0x1405; // Combined access access method - static final int CMBKEYAM = 0x1406; // Combined keyed access method - static final int CMBRNBAM = 0x1407; // Combined record number access method - static final int CMDATHRM = 0x121C; // Not authorized to command - static final int CMDCHKRM = 0x1254; // Command check - static final int CMDCMPRM = 0x124B; // Command processing complete reply - static final int CMDNSPRM = 0x1250; // Command not supported - static final int CMMCTLTYP = 0x11BA; // Commitment control type - static final int CMMUOW = 0x105A; // Commit - static final int CMNAPPC = 0x1444; // APPC communications manager - Used for pre-V4R2 connections - static final int CMNTCPIP = 0x1474; // TCP/IP communications manager - added by DDM server - static final int CODPNTDR = 0x0064; // Code point data - byte[2] - static final int DCLFIL = 0x102C; // Declare the file name - static final int DCLNAM = 0x1136; // Declared file name - static final int DCLNAMRM = 0x1256; // Invalid declared name - static final int DICTIONARY = 0x1458; // Dictionary manager - static final int DIRECTORY = 0x1457; // Directory file - static final int DIRFIL = 0x140C; // Direct file - static final int DRCAM = 0x1419; // Directory access method - static final int DRCNAM = 0x1165; // Library name - static final int DUPDCLRM = 0x1255; // Duplicate declared file name reply - static final int ENDUOWRM = 0x220C; // End unit of work reply message - static final int FILISOLVL = 0x1472; // Commitment control lock level - static final int FILNAM = 0x110E; // File name - static final int EXCSAT = 0x1041; // Exchange server attributes - static final int EXCSATRD = 0x1443; // Exchange server attributes reply - static final int EXTNAM = 0x115E; // External name - static final int KEYFIL = 0x141E; // Keyed file - static final int KEYORD = 0x145D; // Key order - static final int LCKMGR = 0x1422; // Lock manager - static final int LUWHLDCSR = 0x11B5; // Hold cursor parameter - static final int MGRDEPRM = 0x1218; // Manager dependency error - static final int MGRLVLLS = 0x1404; // Manager level list - static final int NAMDR = 0x0066; // Name string - static final int NAMSYMDR = 0x0061; // Name string with only A-Z, 0-9 and '_' - static final int PASSWORD = 0x11A1; // Password for connecting - static final int PRCCNVRM = 0x1245; // Conversational protocol error - static final int PRMNSPRM = 0x1251; // Parameter not supported - static final int RDB = 0x240F; // Relational database - static final int RDBACCRM = 0x2207; // RDB currently accessed - static final int RDBAFLRM = 0x221A; // RDB access failed reply message - static final int RDBATHRM = 0x2203; // Not authorized to RDB - static final int RDBNAM = 0x2110; // Relational database name - static final int RDBNFNRM = 0x2211; // RDB not found -//@B1D static final int RECCNT = 0x111A; // Record count returned from ULDRECF - static final int RECAL = 0x1430; // Record attribute list -//@B1D static final int RECORD = 0x144A; // Record object returned from ULDRECF - static final int RELKEYAM = 0x1432; // Relative by key access method - static final int RELRNBAM = 0x1433; // Relative by record number access method - static final int RLLBCKUOW = 0x105B; // Rollback - static final int RLSFILLK = 0x1143; // Release file lock - static final int RNBORD = 0x145E; // Record number order - static final int RNDKEYAM = 0x1434; // Random by key access method - static final int RNDRNBAM = 0x1435; // Random by record number access method - static final int RQSFILLK = 0x1145; // Request file lock - static final int RSCLMTRM = 0x1233; // Resource limits reached - static final int RSCRCVM = 0x14A0; // @E0M - static final int RTNINA = 0x1155; // Return inactive records - static final int SECCHK = 0x106E; // Security check - added by DDM server - static final int SECCHKCD = 0x11A4; // Security check code - added by DDM server @B0A - static final int SECCHKRD = 0x1219; // Security check reply- added by DDM server - static final int SECMEC = 0x11A2; // Security mechanism - added by DDM server - static final int SECMGR = 0x1440; // Security manager - static final int SECTKN = 0x11DC; // Security token @B0A - static final int SEQFIL = 0x143B; // Sequential file - static final int SQLAM = 0x2407; // SQL Application manager - static final int SRVCLSNM = 0x1147; // Server class name - static final int SRVDGN = 0x1153; // Server diagnostic information - static final int STRAM = 0x1463; // Stream access method - static final int STRFIL = 0x1465; // Stream file - static final int STRCMMCTL = 0x105C; // Start commitment control - static final int SUPERVISOR = 0x143C; // Supervisor - static final int SVRCOD = 0x1149; // Severity code - static final int SYNTAXRM = 0x124C; // Data stream syntax error - static final int SYSCMDMGR = 0x147F; // System command manager - static final int S38ALCOB = 0xD002; // Allocate object (lock object) - static final int S38BUF = 0xD405; // Input/Output buffer - static final int S38CLOSE = 0xD004; // Close file - static final int S38CLOST = 0xD121; // Close type - static final int S38CMD = 0xD006; // Submit remote command - static final int S38CMDST = 0xD103; // Command string - static final int S38CTLL = 0xD105; // Control list - static final int S38DEL = 0xD007; // Delete record - static final int S38DLCOB = 0xD008; // Deallocate object (release explicit locks) - static final int S38FEOD = 0xD00B; // Force end of data - static final int S38GET = 0xD00C; // Get record - static final int S38GETD = 0xD00D; // Get record at file position - static final int S38GETK = 0xD00E; // Get record by key - static final int S38GETM = 0xD00F; // Get multiple records - static final int S38IOFB = 0xD402; // Input/output feedback - static final int S38LCNRD = 0xD406; // Number of files unlocked count reply object - static final int S38LRLS = 0xD115; // Lock release structure - static final int S38LRQS = 0xD10B; // Lock request structure - static final int S38LWAIT = 0xD10C; // Lock wait time - static final int S38MDATA = 0xD10E; // Message replacement data - static final int S38MFILE = 0xD111; // Message file - static final int S38MID = 0xD112; // Message id - static final int S38MTEXT = 0xD116; // Message text - static final int S38MTYPE = 0xD117; // Message type - static final int S38MSGRM = 0xD201; // AS400 error message reply - static final int S38OPEN = 0xD011; // Open file - static final int S38OPNFB = 0xD404; // File open feed back area - static final int S38OPTL = 0xD119; // Option list - static final int S38PUT = 0xD012; // Put record - static final int S38PUTM = 0xD013; // Put multiple record - static final int S38UFCB = 0xD11F; // User file control block structure - static final int S38UPDAT = 0xD019; // Update record - static final int SXXASPRQ = 0xD02A; // Set ASP group - static final int SXXPUTDR = 0xD01C; // Insert record at file position - static final int TRGNSPRM = 0x125F; // Target not supported -//@B1D static final int ULDRECF = 0x1040; // Unload records from file - static final int UOWDSP = 0x2115; // Unit of work disposition - static final int USRID = 0x11A0; // Userid for connecting - static final int VALNSPRM = 0x1252; // Parameter value not supported - -} diff --git a/cvsroot/src/com/ibm/as400/access/DLOPermission.java b/cvsroot/src/com/ibm/as400/access/DLOPermission.java deleted file mode 100644 index 859d224f1..000000000 --- a/cvsroot/src/com/ibm/as400/access/DLOPermission.java +++ /dev/null @@ -1,326 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DLOPermission.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** -

          The DLOPermission class represents the permission for the specfied user for -document library objects (DLO) stored in QDLS. -

          A user can have one of the following authorities to a document library object -can have one of the following values: -

            -
          • *ALL -
          • *AUTL -
          • *CHANGE -
          • *EXCLUDE -
          • *USE -
          • USER DEFINED. -
          -Use getAuthority() to display the current value and the setAuthority() -to set the authority to one of the valid values. Use commit() from the -Permission class to send the changes to the system. -**/ -public class DLOPermission extends UserPermission -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - /** - * Constructs a DLOPermission object. This is the permission of the specified user. - * @param userProfileName The name of the user profile. - * - **/ - public DLOPermission( String userProfileName ) - { - super(userProfileName); - dataAuthority_ = "*EXCLUDE"; - return; - } - - - /** - Returns the data authority of the user. - @return The data authority of the user. The possible values are: -
            -
          • *ALL The user can perform all operations except those - limited to the owner or controlled by authorization list - management authority. The user can control the object's - existence, specify the security for the object, change the - object, and perform basic functions on the object. The - user can also change ownership of the object. -
          • *AUTL The authority of the authorization list is used for - the document. This is valid for user *PUBLIC. -
          • *CHANGE The user can change and perform basic functions - on the object. Change authority provides object operational - authority and all data authorities. -
          • *EXCLUDE The user cannot access the object. -
          • *USE The user has object operational authority, read authority, and execute - authority. -
          • USER DEFINED The user has specifically defined authority to the object. -
          - @see #setDataAuthority(String) - **/ - public String getDataAuthority() - { - if (isFromAuthorizationList()) - return "*AUTL"; - parseBasic(); - switch (objectAuthority_) - { - case BASIC_ALL : - return "*ALL"; - case BASIC_EXCLUDE : - return "*EXCLUDE"; - case BASIC_USE : - return "*USE"; - case BASIC_CHANGE : - return "*CHANGE"; - case BASIC_USER_DEF: //@A2A - return "USER DEFINED"; //@A2A - default : -//@A2D return "*EXLUDE"; - return "USER DEFINED"; //@A2A - } - } - - - /** - * Parses the basic authority type. - **/ - private synchronized void parseBasic() - { - for (int j=0;j<4;j++) - { - boolean match = true; - for (int i=0;i<10;i++) - { - if (authorities_[i] != basicAutMapping[j][i]) - { - match = false; - break; - } - } - if (match == true) - { - objectAuthority_= j; - return; - } - } -//@A2D objectAuthority_= 1; - objectAuthority_= BASIC_USER_DEF; //@A2A - return; - } - - /** - * Sets the add data authority. - * @param authority true to set the data authority of add on; - * false to set the data authority of add off. - * - **/ - synchronized void setAdd(boolean authority) - { - changeAuthority(); - authorities_[DATA_ADD] = authority; - return; - } - - - /** - * Sets the alter object authority. - * @param authority true to set the object authority of alter on; - * false to set the object authority of alter off. - * - **/ - synchronized void setAlter(boolean authority) - { - changeAuthority(); - authorities_[OBJECT_ALTER] = authority; - return; - } - - /** - Sets the data authority of the user. - @param authority The data authority of the user. -

          Valid values are: -

            -
          • *ALL The user can perform all operations except those - limited to the owner or controlled by authorization list - management authority. The user can control the object's - existence, specify the security for the object, change the - object, and perform basic functions on the object. The - user can also change ownership of the object. -
          • *AUTL The authority of the authorization list is used for - the document. This is valid for user *PUBLIC. -
          • *CHANGE The user can change and perform basic functions - on the object. Change authority provides object operational - authority and all data authorities. -
          • *EXCLUDE The user cannot access the object. -
          • *USE The user has object operational authority, read authority, and execute - authority. -
          - **/ - public synchronized void setDataAuthority(String authority) - { - if (authority == null) - throw new NullPointerException("authority"); - String aut = authority.trim().toUpperCase(); - - changeAuthority(); - if (getDataAuthority().equals(aut) == true) - return; - if (aut.equals("*ALL")) - { - for (int i=0;i<10;i++) - { - authorities_[i] = basicAutMapping[BASIC_ALL][i]; - } - objectAuthority_ = BASIC_ALL; - } else if (aut.equals("*EXCLUDE")) - { - for (int i=0;i<10;i++) - { - authorities_[i] = basicAutMapping[BASIC_EXCLUDE][i]; - } - objectAuthority_ = BASIC_EXCLUDE; - } else if (aut.equals("*USE")) - { - for (int i=0;i<10;i++) - { - authorities_[i] = basicAutMapping[BASIC_USE][i]; - } - objectAuthority_ = BASIC_USE; - } else if (aut.equals("*CHANGE")) - { - for (int i=0;i<10;i++) - { - authorities_[i] = basicAutMapping[BASIC_CHANGE][i]; - } - objectAuthority_ = BASIC_CHANGE; - } - else if (aut.equals("*AUTL")) // @1JU - if *AUTL, then setFromAuthorizationList - setFromAuthorizationList(true); // @1JU - return; - } - - /** - * Sets the delete data authority. - * @param authority true to set the data authority of delete on; - * false to set the data authority of delete off. - * - **/ - synchronized void setDelete(boolean authority) - { - changeAuthority(); - authorities_[DATA_DELETE] = authority; - return; - } - - - /** - * Sets the execute data authority. - * @param authority true to set the data authority of execute on; - * false to set the data authority of execute off. - **/ - synchronized void setExecute(boolean authority) - { - changeAuthority(); - authorities_[DATA_EXECUTE] = authority; - return; - } - - - /** - * Sets the existence object authority. - * @param authority true to set the object authority of existence on; - * false to set the object authority of existence off. - * - **/ - - synchronized void setExistence(boolean authority) - { - changeAuthority(); - authorities_[OBJECT_EXIST] = authority; - return; - } - - - /** - * Sets the management object authority. - * @param authority true to set the object authority of management on; - * false to set the object authority of management off. - * - **/ - - synchronized void setManagement(boolean authority) - { - changeAuthority(); - authorities_[OBJECT_MANAGEMENT] = authority; - return; - } - - /** - * Sets the operational object authority. - * @param authority true to set the object authority of operational on; - * false to set the object authority of operational off. - * - **/ - synchronized void setOperational(boolean authority) - { - changeAuthority(); - authorities_[OBJECT_OPERATION] = authority; - return; - } - - /** - * Sets the read data authority. - * @param authority true to set the data authority of read on; - * false to set the data authority of read off. - * - **/ - synchronized void setRead(boolean authority) - { - changeAuthority(); - authorities_[DATA_READ] = authority; - return; - } - - /** - * Sets the reference object authority. - * @param authority true to set the object authority of reference on; - * false to set the object authority of reference off. - **/ - synchronized void setReference(boolean authority) - { - changeAuthority(); - authorities_[OBJECT_REFERENCE] = authority; - return; - } - - - /** - * Sets the update data authority. - * @param authority true to set the data authority of update on; - * false to set the data authority of update off. - * - **/ - synchronized void setUpdate(boolean authority) - { - changeAuthority(); - authorities_[DATA_UPDATE] = authority; - return; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/DQAttsAuthorityEditor.java b/cvsroot/src/com/ibm/as400/access/DQAttsAuthorityEditor.java deleted file mode 100644 index 4329c30b6..000000000 --- a/cvsroot/src/com/ibm/as400/access/DQAttsAuthorityEditor.java +++ /dev/null @@ -1,33 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DQAttsAuthorityEditor.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyEditorSupport; - -/** - The DQAttsAuthorityEditor class provides the list of data queue editor authorities. - **/ -public class DQAttsAuthorityEditor extends PropertyEditorSupport -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - /** - Returns the list of data queue editor authorities. - @return The list of data queue editor authorities. - **/ - public String[] getTags() - { - return new String[] { "*ALL", "*CHANGE", "*EXCLUDE", "*USE", "*LIBCRTAUT" }; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DQClearDataStream.java b/cvsroot/src/com/ibm/as400/access/DQClearDataStream.java deleted file mode 100644 index d1da3044b..000000000 --- a/cvsroot/src/com/ibm/as400/access/DQClearDataStream.java +++ /dev/null @@ -1,49 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DQClearDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -// Clear data queue request data stream. -class DQClearDataStream extends DQDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - DQClearDataStream(byte[] name, byte[] library, byte[] key) - { - super((key == null) ? 41 : 47 + key.length); - setTemplateLen(21); - setReqRepID(0x0006); - - // Fill in data queue name and library name. - setQueueAndLibrary(name, library); - - data_[40] = (key == null) ? (byte)0xF0 : (byte)0xF1; - - if (key != null) - { - // Fill in key. - set32bit(6 + key.length, 41); - set16bit(0x5002, 45); - System.arraycopy(key, 0, data_, 47, key.length); - } - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending clear data queue request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DQCommonReplyDataStream.java b/cvsroot/src/com/ibm/as400/access/DQCommonReplyDataStream.java deleted file mode 100644 index 68feec455..000000000 --- a/cvsroot/src/com/ibm/as400/access/DQCommonReplyDataStream.java +++ /dev/null @@ -1,69 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DQCommonReplyDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -// Common reply data stream is used for the following reply data streams: -// - Create data queue reply data stream, -// - Delete data queue reply data stream, -// - Add record to data queue reply data stream, -// - Clear data queue reply data stream, -// - Data queue exchange client/server attributes reply (error) data stream, -// - Query data queue attributes reply (error) data stream, -// - Receive record from data queue reply (error) data stream. -class DQCommonReplyDataStream extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - Object getNewDataStream() - { - return new DQCommonReplyDataStream(); - } - - public int hashCode() - { - return 0x8002; // Returns the reply ID. - } - - int getRC() - { - return get16bit(20); - } - - byte[] getMessage() - { - // Get message if there is one. - if (getLength() > 22) - { - // Determine length of msg (LL). - int length = get32bit(22) - 6; - - // Get message. - byte[] message = new byte[length]; - System.arraycopy(data_, 28, message, 0, length); - return message; - } - return null; - } - - int readAfterHeader(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving data queue common reply..."); - - // Read in remaining data. - return super.readAfterHeader(in); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DQCreateDataStream.java b/cvsroot/src/com/ibm/as400/access/DQCreateDataStream.java deleted file mode 100644 index 255841d23..000000000 --- a/cvsroot/src/com/ibm/as400/access/DQCreateDataStream.java +++ /dev/null @@ -1,53 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DQCreateDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -// Create data queue request data stream. -class DQCreateDataStream extends DQDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - DQCreateDataStream(byte[] name, byte[] library, int entryLength, String authority, boolean saveSenderInfo, boolean FIFO, int keyLength, boolean forceToAuxiliaryStorage, byte[] description) - { - super(100); - setReqRepID(0x0003); - - // Fill in data queue name and library name. - setQueueAndLibrary(name, library); - - set32bit(entryLength, 40); // Set max entry length. - - // Set authority. - data_[44] = authority.equals("*LIBCRTAUT") ? (byte)0xF4 : authority.equals("*ALL") ? (byte)0xF0 : authority.equals("*CHANGE") ? (byte)0xF1 : authority.equals("*EXCLUDE") ? (byte)0xF2 : /* authority.equals("*USE") */ (byte)0xF3; - // Set save sender info flag. - data_[45] = (saveSenderInfo) ? (byte)0xF1 : (byte)0xF0; - // Set Queue Type: F0=FIFO, F1=LIFO, F2=KEYED. - data_[46] = (keyLength == 0) ? (FIFO) ? (byte)0xF0 : (byte)0xF1 : (byte)0xF2; - // Set key length. - set16bit(keyLength, 47); - // Set force. - data_[49] = (forceToAuxiliaryStorage) ? (byte)0xF1 : (byte)0xF0; - // Fill in text description. - System.arraycopy(description, 0, data_, 50, 50); - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending create data queue request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DQDataStream.java b/cvsroot/src/com/ibm/as400/access/DQDataStream.java deleted file mode 100644 index f8e8bab64..000000000 --- a/cvsroot/src/com/ibm/as400/access/DQDataStream.java +++ /dev/null @@ -1,41 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DQDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// Base class for common data queue data stream requests. -class DQDataStream extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - protected DQDataStream(int size) - { - super(new byte[size]); - setLength(size); - // setHeaderID(0x0000); - setServerID(0xE007); - // setCSInstance(0x00000000); - // setCorrelation(0x00000000); - setTemplateLen(size - 20); - // May need to setTemplateLen in subclass. - // Need to setReqRepID(id) in subclass. - } - - protected void setQueueAndLibrary(byte[] name, byte[] library) - { - // Fill in data queue name. - System.arraycopy(name, 0, data_, 20, 10); - // Fill in library. - System.arraycopy(library, 0, data_, 30, 10); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DQDeleteDataStream.java b/cvsroot/src/com/ibm/as400/access/DQDeleteDataStream.java deleted file mode 100644 index f31843196..000000000 --- a/cvsroot/src/com/ibm/as400/access/DQDeleteDataStream.java +++ /dev/null @@ -1,39 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DQDeleteDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -// Delete data queue request data stream. -// The reply to a delete request is a DQCommonReplyDataStream. -class DQDeleteDataStream extends DQDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - DQDeleteDataStream(byte[] name, byte[] library) - { - super(40); - setReqRepID(0x0004); - - // Fill in data queue name and library name. - setQueueAndLibrary(name, library); - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending delete data queue request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DQExchangeAttributesDataStream.java b/cvsroot/src/com/ibm/as400/access/DQExchangeAttributesDataStream.java deleted file mode 100644 index 89b06963f..000000000 --- a/cvsroot/src/com/ibm/as400/access/DQExchangeAttributesDataStream.java +++ /dev/null @@ -1,37 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DQExchangeAttributesDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -// Data queue exchange client/server attributes request datastream. -class DQExchangeAttributesDataStream extends DQDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - DQExchangeAttributesDataStream() - { - super(26); - // setReqRepID(0x0000); - set32bit(0x00000001, 20); // Client version, 1 means we support 64K data queues. - // set16bit(0x0000, 24); // Client datastream level, always 0. - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending data queue exchange client/server attributes request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DQExchangeAttributesNormalReplyDataStream.java b/cvsroot/src/com/ibm/as400/access/DQExchangeAttributesNormalReplyDataStream.java deleted file mode 100644 index 7270eec12..000000000 --- a/cvsroot/src/com/ibm/as400/access/DQExchangeAttributesNormalReplyDataStream.java +++ /dev/null @@ -1,40 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DQExchangeAttributesNormalReplyDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -// Data queue exchange client/server attributes reply (normal). -// If there is an error, the reply to an exchange attributes request is a DQCommonReplyDataStream. -class DQExchangeAttributesNormalReplyDataStream extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - Object getNewDataStream() - { - return new DQExchangeAttributesNormalReplyDataStream(); - } - - public int hashCode() - { - return 0x8000; // Returns the reply ID. - } - - int readAfterHeader(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving data queue exchange client/server attributes (normal) reply..."); - return super.readAfterHeader(in); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DQQueryRecord.java b/cvsroot/src/com/ibm/as400/access/DQQueryRecord.java deleted file mode 100644 index 0ddcb594e..000000000 --- a/cvsroot/src/com/ibm/as400/access/DQQueryRecord.java +++ /dev/null @@ -1,31 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DQQueryRecord.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; - -class DQQueryRecord implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - // These variables contain the values for the data queue attributes. - int maxEntryLength_; - boolean saveSenderInformation_; - boolean FIFO_; - int keyLength_; - boolean forceToAuxiliaryStorage_; - String description_; -} diff --git a/cvsroot/src/com/ibm/as400/access/DQReadDataStream.java b/cvsroot/src/com/ibm/as400/access/DQReadDataStream.java deleted file mode 100644 index 40bf7d674..000000000 --- a/cvsroot/src/com/ibm/as400/access/DQReadDataStream.java +++ /dev/null @@ -1,52 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DQReadDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -// Receive record from data queue request data stream. -class DQReadDataStream extends DQDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - DQReadDataStream(byte[] name, byte[] library, byte[] search, int wait, boolean peek, byte[] key) - { - super((key == null) ? 48 : 54 + key.length); - setTemplateLen(28); - setReqRepID(0x0002); - - // Fill in data queue name and library name. - setQueueAndLibrary(name, library); - - data_[40] = (key == null) ? (byte)0xF0 : (byte)0xF1; - System.arraycopy(search, 0, data_, 41, 2); - set32bit(wait, 43); - data_[47] = peek ? (byte)0xF1 : (byte)0xF0; - - if (key != null) - { - // Fill in key. - set32bit(6 + key.length, 48); - set16bit(0x5002, 52); - System.arraycopy(key, 0, data_, 54, key.length); - } - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending receive record from data queue request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DQReadNormalReplyDataStream.java b/cvsroot/src/com/ibm/as400/access/DQReadNormalReplyDataStream.java deleted file mode 100644 index 5fa6d525b..000000000 --- a/cvsroot/src/com/ibm/as400/access/DQReadNormalReplyDataStream.java +++ /dev/null @@ -1,82 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DQReadNormalReplyDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -// Receive record from data queue reply (normal). -// If there is an error, the reply to a read request is a DQCommonReplyDataStream. -class DQReadNormalReplyDataStream extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - Object getNewDataStream() - { - return new DQReadNormalReplyDataStream(); - } - - public int hashCode() - { - return 0x8003; // Returns the reply ID. - } - - // Get sender information. - byte[] getSenderInformation() - { - byte[] senderInformation = new byte[36]; - System.arraycopy(data_, 22, senderInformation, 0, 36); - return senderInformation; - } - - byte[] getEntry() - { - return getOptionalParameter(0x5001); - } - - byte[] getKey() - { - return getOptionalParameter(0x5002); - } - - private byte[] getOptionalParameter(int codePoint) - { - int offset = 58; - byte[] parameter = null; - - while (offset < data_.length - 6) - { - int length = get32bit(offset); - if (get16bit(offset + 4) != codePoint) - { - offset += length; - } - else - { - parameter = new byte[length - 6]; - System.arraycopy(data_, offset + 6, parameter, 0, length - 6); - break; - } - } - return parameter; - } - - int readAfterHeader(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving receive record from data queue (normal) reply..."); - - // Read in rest of data. - return super.readAfterHeader(in); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DQReceiveRecord.java b/cvsroot/src/com/ibm/as400/access/DQReceiveRecord.java deleted file mode 100644 index 7476908ea..000000000 --- a/cvsroot/src/com/ibm/as400/access/DQReceiveRecord.java +++ /dev/null @@ -1,34 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DQReceiveRecord.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; - -class DQReceiveRecord implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - String senderInformation_; - byte[] data_; - byte[] key_; - - DQReceiveRecord(String senderInformation, byte[] data, byte[] key) - { - senderInformation_ = senderInformation; - data_ = data; - key_ = key; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DQRequestAttributesDataStream.java b/cvsroot/src/com/ibm/as400/access/DQRequestAttributesDataStream.java deleted file mode 100644 index 4ed7b257b..000000000 --- a/cvsroot/src/com/ibm/as400/access/DQRequestAttributesDataStream.java +++ /dev/null @@ -1,38 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DQRequestAttributesDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -// Query data queue attributes request data stream. -class DQRequestAttributesDataStream extends DQDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - DQRequestAttributesDataStream(byte[] name, byte[] library) - { - super(40); - setReqRepID(0x0001); - - // Fill in data queue name and library name. - setQueueAndLibrary(name, library); - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending query data queue attributes request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DQRequestAttributesNormalReplyDataStream.java b/cvsroot/src/com/ibm/as400/access/DQRequestAttributesNormalReplyDataStream.java deleted file mode 100644 index acf3446f2..000000000 --- a/cvsroot/src/com/ibm/as400/access/DQRequestAttributesNormalReplyDataStream.java +++ /dev/null @@ -1,81 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DQRequestAttributesNormalReplyDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -// Query data queue attributes reply (normal) data stream. -// If there is an error, the reply to a attribute request is a DQCommonReplyDataStream. -class DQRequestAttributesNormalReplyDataStream extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - Object getNewDataStream() - { - return new DQRequestAttributesNormalReplyDataStream(); - } - - public int hashCode() - { - return 0x8001; // Returns the reply ID. - } - - // Get max entry length. - int getMaxEntryLength() - { - return get32bit(22); - } - - // Get if sender information is saved. - boolean getSaveSenderInformation() - { - return data_[26] == (byte)0xF1; - } - - // Get queue type. - int getType() - { - // 0=FIFO, 1=LIFO, 2=KEYED. - return data_[27] & 0x0F; - } - - // Get key length. - int getKeyLength() - { - return get16bit(28); - } - - // Get force to auxiliary storage. - boolean getForceToAuxiliaryStorage() - { - return data_[30] == (byte)0xF1; - } - - // Get text description. - byte[] getDescription() - { - byte[] description = new byte[50]; - System.arraycopy(data_, 31, description, 0, 50); - return description; - } - - int readAfterHeader(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving query data queue attributes (normal) reply..."); - - // Read in rest of data. - return super.readAfterHeader(in); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DQWriteDataStream.java b/cvsroot/src/com/ibm/as400/access/DQWriteDataStream.java deleted file mode 100644 index 7cc16cd09..000000000 --- a/cvsroot/src/com/ibm/as400/access/DQWriteDataStream.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DQWriteDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -// Add record to data queue request data stream. -class DQWriteDataStream extends DQDataStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - DQWriteDataStream(byte[] name, byte[] library, byte[] key, byte[] entry) - { - super((key == null) ? 48 + entry.length : 54 + entry.length + key.length); - setTemplateLen(22); - setReqRepID(0x0005); - - // Fill in data queue name and library name. - setQueueAndLibrary(name, library); - - data_[40] = key == null ? (byte)0xF0 : (byte)0xF1; - data_[41] = (byte)0xF1; // Want reply. - - // Fill in entry data. - set32bit(6 + entry.length, 42); - set16bit(0x5001, 46); - System.arraycopy(entry, 0, data_, 48, entry.length); - - if (key != null) - { - // Fill in key. - set32bit(6 + key.length, 48 + entry.length); - set16bit(0x5002, 52 + entry.length); - System.arraycopy(key, 0, data_, 54 + entry.length, key.length); - } - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending add record to data queue request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DataArea.java b/cvsroot/src/com/ibm/as400/access/DataArea.java deleted file mode 100644 index d8ca2d0b4..000000000 --- a/cvsroot/src/com/ibm/as400/access/DataArea.java +++ /dev/null @@ -1,733 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DecimalDataArea.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.io.IOException; -import java.util.Vector; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.net.UnknownHostException; - -/** -The DataArea class is an abstract base class that represents a -data area object. -

          DataArea objects generate the following events: -

            -
          • DataAreaEvent -
              -
            • DA_CLEARED -
            • DA_CREATED -
            • DA_DELETED -
            • DA_READ -
            • DA_WRITTEN -
            -
          • PropertyChangeEvent -
          • VetoableChangeEvent -
          -**/ - -public abstract class DataArea implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - /** - Constants - **/ - - static final int UNKNOWN_LENGTH = 0; - - // Type of data area. - static final int UNINITIALIZED = 0; - static final int CHARACTER_DATA_AREA = 1; - static final int DECIMAL_DATA_AREA = 2; - static final int LOCAL_DATA_AREA = 3; - static final int LOGICAL_DATA_AREA = 4; - - /** - Variables - **/ - - private AS400 system_ = null; // The system where the data area is located. - private String dataAreaPathName_ = null; // The full path name of the data area, - // as specified by the user. - private String name_ = null; // The name of the data area. - private QSYSObjectPathName ifsPathName_ = null; // The full path name of the data area. - - // Should be "private protected" but are really package scope - // so the subclasses can get at them. - - //@B0 It was decided that the data area length should NOT be a bean property - // because the property getter getLength() needs to go the system. Bean property - // constructors, getters, and setters should not make connections to the system - // because of the way a visual builder environment manipulates bean objects. - int length_ = UNKNOWN_LENGTH; // The maximum number of bytes the data area can contain. - String textDescription_ = "*BLANK"; // A text description of the data area. - String authority_ = "*LIBCRTAUT"; // The authority level that public has to the data area. - int dataAreaType_ = UNINITIALIZED; - - private transient Vector daListeners_; - private transient PropertyChangeSupport changes_ ; - private transient VetoableChangeSupport vetos_; - transient DataAreaImpl impl_; - - - /** - Constructs a DataArea object. - It creates a default DataArea object. The system and path - properties must be set before attempting a connection. - **/ - public DataArea() - { - super(); - initializeTransient(); - } - - - /** - Constructs a DataArea object. - It creates a DataArea instance that represents the data area path - on system. - @param system The system that contains the data area. - @param path The fully qualified integrated file system path name. The - integrated file system file extension for a data area is DTAARA. An example of a - fully qualified integrated file system path to a data area "MYDATA" in library - "MYLIB" is: /QSYS.LIB/MYLIB.LIB/MYDATA.DTAARA - **/ - public DataArea(AS400 system, String path) - { - super(); - // Validate system parm. - if (system == null) - throw new NullPointerException("system"); - // Validate path parm. - if (path == null) - throw new NullPointerException("path"); - - initializeTransient(); - ifsPathName_ = new QSYSObjectPathName(path, "DTAARA"); - name_ = ifsPathName_.getObjectName(); - system_ = system; - dataAreaPathName_ = path; - } - - - /** - Adds a data area listener to receive data area events from this data area. - @see #removeDataAreaListener - @param listener The data area listener. - **/ - public void addDataAreaListener(DataAreaListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - this.daListeners_.addElement(listener); - } - - - /** - Adds a PropertyChangeListener. The specified PropertyChangeListener's - propertyChange method will be called each time the value of any - bound property is changed. - @see #removePropertyChangeListener - @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - this.changes_.addPropertyChangeListener(listener); - } - - - /** - Adds the VetoableChangeListener. The specified VetoableChangeListener's - vetoableChange method will be called each time the value of any - constrained property is changed. - @see #removeVetoableChangeListener - @param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - this.vetos_.addVetoableChangeListener(listener); - } - - - /** - Chooses the appropriate implementation. - This method is available for use by subclasses. - Subclasses must first set dataAreaType_ to a valid value: - either CHARACTER_DATA_AREA, DECIMAL_DATA_AREA, LOCAL_DATA_AREA, - or LOGICAL_DATA_AREA. - **/ - void chooseImpl () - throws AS400SecurityException, IOException - { - // Verify required attributes have been set. - if (system_ == null) - { - Trace.log(Trace.ERROR, "Attempt to connect before setting system."); - throw new ExtendedIllegalStateException("System", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (ifsPathName_ == null) - { - Trace.log(Trace.ERROR, "Attempt to connect before setting data area pathname."); - throw new ExtendedIllegalStateException("Path", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - // Assume that dataAreaType_ is a valid. - - impl_ = (DataAreaImpl) system_.loadImpl2 - ("com.ibm.as400.access.DataAreaImplRemote", - "com.ibm.as400.access.DataAreaImplProxy"); - system_.connectService(AS400.COMMAND); - impl_.setAttributes(system_.getImpl(), ifsPathName_, dataAreaType_); - } - - // Returns the descriptive text name corresponding to a specified data area type. - static String dataAreaTypeToString(int dataAreaType) - { - String type = null; - switch (dataAreaType) - { - case CHARACTER_DATA_AREA : - type = "Character"; - break; - case DECIMAL_DATA_AREA : - type = "Decimal"; - break; - case LOCAL_DATA_AREA : - type = "Local"; - break; - case LOGICAL_DATA_AREA : - type = "Logical"; - break; - case UNINITIALIZED : - type = "Uninitialized"; - break; - default : - Trace.log(Trace.ERROR, "Unrecognized data area type: " + dataAreaType); - type = "Unrecognized"; - break; - } - return type; - } - - - /** - Removes the data area from the system. - This is a common implementation for the delete() methods of the subclasses. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist. - **/ - void delete0() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (impl_ == null) - chooseImpl(); - - impl_.delete(); - - // Fire the DELETED event. - fireDeleted(); - } - - - /** - Fires a DA_CLEARED event. - @param obj The source object from which the event originated. - **/ - void fireCleared() - { - Vector targets = (Vector) daListeners_.clone(); - DataAreaEvent event = new DataAreaEvent(this, DataAreaEvent.DA_CLEARED); - for (int i=0; idataLength bytes, without conversion, - beginning at offset dataAreaOffset in the data area. - Note that the first byte in the data area is at offset 0. - @param dataBuffer The buffer into which to read the data. Must be non-null. - @param dataBufferOffset The starting offset in dataBuffer. - @param dataAreaOffset The offset in the data area at which to start reading. - @param dataLength The number of bytes to read. Valid values are from - 1 through (data area size - dataAreaOffset). - @return The total number of bytes read into the buffer. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - int read(byte[] dataBuffer, int dataBufferOffset, int dataAreaOffset, int dataLength) - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - // Validate the data parameter. - if (dataBuffer == null) - throw new NullPointerException("dataBuffer"); - - // Get size of the data area. - if (length_ == UNKNOWN_LENGTH) - { - try { - length_ = getLength(); - } - catch(IllegalObjectTypeException iote) { - if (Trace.isTraceOn() && Trace.isTraceWarningOn()) { - Trace.log(Trace.WARNING, "Unexpected exception when retrieving length for data area.", iote); - } - } - } - - // Validate the data length. - if (dataBuffer.length < 1) - throw new ExtendedIllegalArgumentException("dataBuffer", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - // Validate the dataBufferOffset parameter. - if (dataBufferOffset < 0 || dataBufferOffset > dataBuffer.length-1) - throw new ExtendedIllegalArgumentException("dataBufferOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the dataAreaOffset parameter. - if (dataAreaOffset < 0 || dataAreaOffset >= length_) - throw new ExtendedIllegalArgumentException("dataAreaOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the dataLength parameter. - if (dataLength < 1 || dataLength > dataBuffer.length) - throw new ExtendedIllegalArgumentException("dataLength", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the (dataBufferOffset, dataLength) combination. - if (dataBufferOffset+dataLength > dataBuffer.length) - throw new ExtendedIllegalArgumentException("dataLength", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the (dataAreaOffset, dataLength) combination. - if (dataAreaOffset+dataLength > length_) - throw new ExtendedIllegalArgumentException("dataLength", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - if (impl_ == null) - chooseImpl(); - - // Do the read - int bytesRead = impl_.readBytes(dataBuffer, dataBufferOffset, dataAreaOffset, dataLength); - - // Fire the READ event. - fireRead(); - - return bytesRead; - } - - - /** - Refreshes the attributes of the data area. - This method should be called if the underlying system data area has changed - and it is desired that this object should reflect those changes. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void refreshAttributes() - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (impl_ == null) - chooseImpl(); - - impl_.refreshAttributes(); - } - - - /** - Removes the DataAreaListener from the internal list. - If the DataAreaListener is not on the list, nothing is done. - @see #addDataAreaListener - @param listener The data area listener. - **/ - public void removeDataAreaListener(DataAreaListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - daListeners_.removeElement(listener); - } - - - /** - Removes the PropertyChangeListener from the internal list. - If the PropertyChangeListener is not on the list, nothing is done. - @see #addPropertyChangeListener - @param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - changes_.removePropertyChangeListener(listener); - } - - - /** - Removes the VetoableChangeListener from the internal list. - If the VetoableChangeListener is not on the list, nothing is done. - @see #addVetoableChangeListener - @param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - vetos_.removeVetoableChangeListener(listener); - } - - - /** - Sets the type of data area. - This method is only used internally, by subclasses. - Valid values are: CHARACTER_DATA_AREA, DECIMAL_DATA_AREA, - LOCAL_DATA_AREA, LOGICAL_DATA_AREA. - **/ - void setImplType(int dataAreaType) - { - dataAreaType_ = dataAreaType; // Trust that the argument is valid. - } - - - /** - Sets the fully qualified data area name. Note this method is NOT public. - It is overridden as a public method in the subclasses that use it. - @exception PropertyVetoException If the change is vetoed. - **/ - void setPath(String path) throws PropertyVetoException - { - // check parm - if (path == null) - throw new NullPointerException("path"); - - // Make sure we have not already connected. - if (impl_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property after connect."); - throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // Ask for any vetos. - String old = dataAreaPathName_; - vetos_.fireVetoableChange("path", old, path ); - - // Verify name is valid IFS path name. - ifsPathName_ = new QSYSObjectPathName(path, "DTAARA"); - - // Set instance vars. - name_ = ifsPathName_.getObjectName(); - dataAreaPathName_ = path; - - changes_.firePropertyChange("path", old, path ); - } - - - /** - Sets the system on which the data area exists. The system cannot be set - if a connection has already been established. - @param system The system on which the data area exists. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem(AS400 system) throws PropertyVetoException - { - // check parm - if (system == null) - throw new NullPointerException("system"); - - // Make sure we have not already connected. - if (impl_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - AS400 old = system_; - vetos_.fireVetoableChange("system", old, system); - - // Set instance var. - system_ = system; - - changes_.firePropertyChange("system", old, system_); - } - - - // Design note: This method is relevant only to CharacterDataArea and LocalDataArea. - // It is irrelevant to DecimalDataArea and LogicalDataArea, since those types of data - // areas have restrictions on what byte values can exist in them. - /** - Writes the data to the data area. - It writes the specified bytes, without conversion, to the data area, at offset dataAreaOffset. - Note that the first byte in the data area is at offset 0. - @param dataBuffer The data to be written. Must be non-null. - @param dataBufferOffset The starting offset in dataBuffer. - @param dataAreaOffset The offset in the data area at which to start writing. - @param dataLength The number of bytes to write. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - void write(byte[] dataBuffer, int dataBufferOffset, int dataAreaOffset, int dataLength) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - // Validate the data parameter. - if (dataBuffer == null) - throw new NullPointerException("dataBuffer"); - - // Get size of the data area. - if (length_ == UNKNOWN_LENGTH) - { - try { - length_ = getLength(); - } - catch(IllegalObjectTypeException iote) { - if (Trace.isTraceOn() && Trace.isTraceWarningOn()) { - Trace.log(Trace.WARNING, "Unexpected exception when retrieving length for data area.", iote); - } - } - } - - // Validate the data length. - if (dataBuffer.length < 1) - throw new ExtendedIllegalArgumentException("dataBuffer", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - // Validate the dataBufferOffset parameter. - if (dataBufferOffset < 0 || dataBufferOffset > dataBuffer.length-1) - throw new ExtendedIllegalArgumentException("dataBufferOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the dataAreaOffset parameter. - if (dataAreaOffset < 0 || dataAreaOffset >= length_) - throw new ExtendedIllegalArgumentException("dataAreaOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the dataLength parameter. - if (dataLength < 1 || dataLength > dataBuffer.length) - throw new ExtendedIllegalArgumentException("dataLength", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the (dataBufferOffset, dataLength) combination. - if (dataBufferOffset+dataLength > dataBuffer.length) - throw new ExtendedIllegalArgumentException("dataLength", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the (dataAreaOffset, dataLength) combination. - if (dataAreaOffset+dataLength > length_) - throw new ExtendedIllegalArgumentException("dataLength", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if (impl_ == null) - chooseImpl(); - - // Do the write - impl_.write(dataBuffer, dataBufferOffset, dataAreaOffset, dataLength); - - // Fire the WRITTEN event. - fireWritten(); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/DataAreaBeanInfo.java b/cvsroot/src/com/ibm/as400/access/DataAreaBeanInfo.java deleted file mode 100644 index 665c57f29..000000000 --- a/cvsroot/src/com/ibm/as400/access/DataAreaBeanInfo.java +++ /dev/null @@ -1,152 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataAreaBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; - - -/** -The DataAreaBeanInfo class provides -bean information for the DataArea class. -**/ -public class DataAreaBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = DataArea.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - String[] daListeners = {"cleared", - "created", - "deleted", - "read", - "written"}; - EventSetDescriptor da = new EventSetDescriptor(beanClass, - "dataArea", - com.ibm.as400.access.DataAreaListener.class, - daListeners, - "addDataAreaListener", - "removeDataAreaListener"); - da.setDisplayName(loader_.getText("EVT_NAME_DA_EVENT")); - da.setShortDescription(loader_.getText("EVT_DESC_DA_EVENT")); - - EventSetDescriptor[] events = {da, changed, veto}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor name = new PropertyDescriptor("name", beanClass, - "getName", null); - name.setBound(false); - name.setConstrained(false); - name.setDisplayName(loader_.getText("PROP_NAME_NAME")); - name.setShortDescription(loader_.getText("PROP_DESC_NAME")); - - PropertyDescriptor system = new PropertyDescriptor("system", beanClass); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(loader_.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(loader_.getText("PROP_DESC_SYSTEM")); - - properties_ = new PropertyDescriptor[] {name, system}; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the propertyChange event - return 0; - } - - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the "path" property - return 0; - } - - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/DataAreaEvent.java b/cvsroot/src/com/ibm/as400/access/DataAreaEvent.java deleted file mode 100644 index c29efe0d8..000000000 --- a/cvsroot/src/com/ibm/as400/access/DataAreaEvent.java +++ /dev/null @@ -1,83 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataAreaEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - The DataAreaEvent class represents a data area event. -**/ - -public class DataAreaEvent extends java.util.EventObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - /** - Event ID indicating that a data area has been cleared. - **/ - public static final int DA_CLEARED = 0; - - /** - Event ID indicating that a data area has been created. - **/ - public static final int DA_CREATED = 1; - - /** - Event ID indicating that a data area has been deleted. - **/ - public static final int DA_DELETED = 2; - - /** - Event ID indicating that a data area has been read. - **/ - public static final int DA_READ = 3; - - /** - Event ID indicating that a data area has been written. - **/ - public static final int DA_WRITTEN = 4; - - - private int id_; // event identifier - - - /** - Constructs a DataAreaEvent object. - @param source The object where the event originated. - @param id The event identifier. - **/ - public DataAreaEvent(Object source, int id) - { - super(source); - - if (id < DA_CLEARED || id > DA_WRITTEN) - { - throw new ExtendedIllegalArgumentException("id", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - id_ = id; - } - - - - /** - Returns the identifier for this event. - @return The identifier for this event. - **/ - public int getID() - { - return id_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DataAreaImpl.java b/cvsroot/src/com/ibm/as400/access/DataAreaImpl.java deleted file mode 100644 index 771ec713c..000000000 --- a/cvsroot/src/com/ibm/as400/access/DataAreaImpl.java +++ /dev/null @@ -1,196 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataAreaImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.math.BigDecimal; - -/** -Specifies the methods which the implementation objects for the Data Area classes -need to support. The Data Area classes are: -
            -
          • DataArea (abstract base class) -
          • CharacterDataArea -
          • DecimalDataArea -
          • LocalDataArea -
          • LogicalDataArea -
          -**/ -interface DataAreaImpl -{ - - // For all xxxDataArea classes: - void clear() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException; - - // For CharacterDataArea: - void create(int length, String initialValue, - String textDescription, String authority) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectAlreadyExistsException, - ObjectDoesNotExistException, - IOException; - - // For DecimalDataArea: - void create(int length, int decimalPositions, - BigDecimal initialValue, String textDescription, - String authority) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectAlreadyExistsException, - ObjectDoesNotExistException, - IOException; - - // For LogicalDataArea: - void create(boolean initialValue, String textDescription, - String authority) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectAlreadyExistsException, - ObjectDoesNotExistException, - IOException; - - // For all except LocalDataArea: - void delete() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException; - - // For DecimalDataArea: - int getDecimalPositions() - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - ObjectDoesNotExistException, - IOException; - - // For all xxxDataArea classes: - int getLength() - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - ObjectDoesNotExistException, - IOException; - - // For DecimalDataArea: - BigDecimal readBigDecimal() - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - ObjectDoesNotExistException, - IOException; - - // For LogicalDataArea: - boolean readBoolean() - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - ObjectDoesNotExistException, - IOException; - - // For all: - int readBytes(byte[] data, int dataBufferOffset, int dataAreaOffset, int dataLength) - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - ObjectDoesNotExistException, - IOException; - - // For all: - void refreshAttributes() - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - ObjectDoesNotExistException, - IOException; - - // For CharacterDataArea, LocalDataArea: - String retrieve(int dataAreaOffset, int dataLength) - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - ObjectDoesNotExistException, - IOException; - - // For CharacterDataArea, LocalDataArea: - String retrieve(int dataAreaOffset, int dataLength, int type) //$D2A - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - ObjectDoesNotExistException, - IOException; - - // For all xxxDataArea classes: - void setAttributes(AS400Impl system, QSYSObjectPathName path, int dataAreaType) - throws IOException; - - // For CharacterDataArea, LocalDataArea: - void write(String data, int dataAreaOffset) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException; - - // For CharacterDataArea, LocalDataArea: - void write(String data, int dataAreaOffset, int type) //$D2A - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException; - - // For DecimalDataArea: - void write(BigDecimal data) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException; - - // For LogicalDataArea: - void write(boolean data) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException; - - // For all: - void write(byte[] data, int dataBufferOffset, int dataAreaOffset, int dataLength) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException; - -} diff --git a/cvsroot/src/com/ibm/as400/access/DataAreaImplProxy.java b/cvsroot/src/com/ibm/as400/access/DataAreaImplProxy.java deleted file mode 100644 index 4bd722268..000000000 --- a/cvsroot/src/com/ibm/as400/access/DataAreaImplProxy.java +++ /dev/null @@ -1,670 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataAreaImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.math.BigDecimal; - -/** -Provides implementations of the public Data Area classes, -when used on a client communicating with a proxy server: -
            -
          • DataArea (abstract base class) -
          • CharacterDataArea -
          • DecimalDataArea -
          • LocalDataArea -
          • LogicalDataArea -
          -**/ - -class DataAreaImplProxy -extends AbstractProxyImpl -implements DataAreaImpl -{ - DataAreaImplProxy () - { - super ("DataArea"); - } - - - /** - Resets the data area to contain all blanks. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void clear() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException - { - try { - connection_.callMethod (pxId_, "clear"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow5 (e); - } - } - - - /** - Creates a character data area with the specified attributes. - @param length The maximum number of characters in the data area. - Valid values are 1 through 2000. - @param initialValue The initial value for the data area. - @param textDescription The text description for the data area. - The maximum length is 50 characters. - @param authority The public authority level for the data area. Valid - values are *ALL, *CHANGE, *EXCLUDE, *LIBCRTAUT, *USE, or the name - of an authorization list. The maximum length is 10 characters. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectAlreadyExistsException If the system object already exists. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void create(int length, String initialValue, - String textDescription, String authority) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectAlreadyExistsException, - ObjectDoesNotExistException, - IOException - { - try { - connection_.callMethod (pxId_, "create", - new Class[] { Integer.TYPE, String.class, - String.class, String.class}, - new Object[] { new Integer(length), initialValue, - textDescription, authority}); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6 (e); - } - } - - - /** - Creates a decimal data area with the specified attributes. - @param length The maximum number of digits in the data area. Valid - values are 1 through 24. - @param decimalPositions The number of digits to the right of the decimal - point. Valid values are 0 through 9. - @param initialValue The initial value for the data area. - @param textDescription The text description for the data area. The maximum length is 50 characters. - @param authority The public authority level for the data area. Valid - values are *ALL, *CHANGE, *EXCLUDE, *LIBCRTAUT, *USE, or the - name of an authorization list. The maximum length is 10 characters. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectAlreadyExistsException If the system object already exists. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void create(int length, int decimalPositions, - BigDecimal initialValue, String textDescription, - String authority) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectAlreadyExistsException, - ObjectDoesNotExistException, - IOException - { - try { - connection_.callMethod (pxId_, "create", - new Class[] { Integer.TYPE, - Integer.TYPE, - BigDecimal.class, - String.class, String.class}, - new Object[] { new Integer(length), - new Integer(decimalPositions), - initialValue, - textDescription, authority}); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6 (e); - } - } - - - - /** - Creates a logical data area with the specified attributes. - @param initialValue The initial value for the data area. - @param textDescription The text description for the data area. The maximum length is 50 characters. - @param authority The public authority level for the data area. Valid - values are *ALL, *CHANGE, *EXCLUDE, *LIBCRTAUT, *USE, or the - name of an authorization list. The maximum length is 10 characters. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectAlreadyExistsException If the system object already exists. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void create(boolean initialValue, String textDescription, - String authority) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectAlreadyExistsException, - ObjectDoesNotExistException, - IOException - { - try { - connection_.callMethod (pxId_, "create", - new Class[] { Boolean.TYPE, - String.class, String.class}, - new Object[] { new Boolean(initialValue), - textDescription, authority}); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6 (e); - } - } - - - /** - Removes the data area from the system. Note this method is NOT public. - It is overridden as a public method in the subclasses that use it. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - @exception IOException If an error occurs while communicating with the system. - **/ - public void delete() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException - { - try { - connection_.callMethod (pxId_, "delete"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow5 (e); - } - } - - - /** - Returns the number of digits to the right of the decimal point in this data area. - @return The number of decimal positions. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public int getDecimalPositions() - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - ObjectDoesNotExistException, - IOException - { - try { - return connection_.callMethod (pxId_, "getDecimalPositions") - .getReturnValueInt(); - } - catch (InvocationTargetException e) { - Throwable e2 = e.getTargetException (); - if (e2 instanceof IllegalObjectTypeException) - throw (IllegalObjectTypeException) e2; - else - throw ProxyClientConnection.rethrow5 (e); - } - } - - - /** - Returns the size of the data area. - @return The size of the data area. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public int getLength() - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - ObjectDoesNotExistException, - IOException - { - try { - return connection_.callMethod (pxId_, "getLength") - .getReturnValueInt(); - } - catch (InvocationTargetException e) { - Throwable e2 = e.getTargetException (); - if (e2 instanceof IllegalObjectTypeException) - throw (IllegalObjectTypeException) e2; - else - throw ProxyClientConnection.rethrow5 (e); - } - } - - - /** - Returns the data read from the data area. - @return The decimal data read from the data area. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - // Note that doing a read() will also set the attributes of this - // object to what is returned from the 400, namely the length and - // number of decimal positions. - public BigDecimal readBigDecimal() - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - ObjectDoesNotExistException, - IOException - { - try { - return (BigDecimal) connection_.callMethod (pxId_, "readBigDecimal") - .getReturnValue (); - } - catch (InvocationTargetException e) { - Throwable e2 = e.getTargetException (); - if (e2 instanceof IllegalObjectTypeException) - throw (IllegalObjectTypeException) e2; - else - throw ProxyClientConnection.rethrow5 (e); - } - } - - - /** - Returns the value in the data area. - @return The data read from the data area. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public boolean readBoolean() - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - ObjectDoesNotExistException, - IOException - { - try { - return connection_.callMethod (pxId_, "readBoolean") - .getReturnValueBoolean(); - } - catch (InvocationTargetException e) { - Throwable e2 = e.getTargetException (); - if (e2 instanceof IllegalObjectTypeException) - throw (IllegalObjectTypeException) e2; - else - throw ProxyClientConnection.rethrow5 (e); - } - } - - - /** - Reads the data from the data area. - It retrieves dataLength bytes beginning at - dataAreaOffset in the data area. The first byte in - the data area is at offset 0. - **/ - public int readBytes(byte[] data, int dataBufferOffset, int dataAreaOffset, int dataLength) - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - try { - ProxyReturnValue rv = connection_.callMethod (pxId_, "readBytes", - new Class[] { byte[].class, Integer.TYPE, Integer.TYPE, Integer.TYPE }, - new Object[] { data, new Integer(dataBufferOffset), new Integer(dataAreaOffset), new Integer(dataLength) }, - new boolean[] { true, false, false, false }, // returnArguments - true); - byte[] returnData = (byte[])rv.getArgument(0); - System.arraycopy(returnData, 0, data, 0, returnData.length); - return rv.getReturnValueInt(); - } - catch (InvocationTargetException e) { - Throwable e2 = e.getTargetException (); - if (e2 instanceof IllegalObjectTypeException) - throw (IllegalObjectTypeException) e2; - else - throw ProxyClientConnection.rethrow5 (e); - } - } - - - /** - Refreshes the attributes of the data area. - This method should be called if the underlying IBM i data area has changed - and it is desired that this object should reflect those changes. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void refreshAttributes() - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - ObjectDoesNotExistException, - IOException - { - try { - connection_.callMethod (pxId_, "refreshAttributes"); - } - catch (InvocationTargetException e) { - Throwable e2 = e.getTargetException (); - if (e2 instanceof IllegalObjectTypeException) - throw (IllegalObjectTypeException) e2; - else - throw ProxyClientConnection.rethrow5 (e); - } - } - - - /** - Makes the API call to retrieve the data area data and attributes. - @return The String value read from the data area as a result of - retrieving the data area's attributes. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public String retrieve(int dataAreaOffset, int dataLength) - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - ObjectDoesNotExistException, - IOException - { - try { - return (String) connection_.callMethod (pxId_, "retrieve", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer(dataAreaOffset), new Integer(dataLength) }) - .getReturnValue (); - } - catch (InvocationTargetException e) { - Throwable e2 = e.getTargetException (); - if (e2 instanceof IllegalObjectTypeException) - throw (IllegalObjectTypeException) e2; - else - throw ProxyClientConnection.rethrow5 (e); - } - } - - - /** - Makes the API call to retrieve the data area data and attributes. - @return The String value read from the data area as a result of - retrieving the data area's attributes. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public String retrieve(int dataAreaOffset, int dataLength, int type) //$A2C - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - ObjectDoesNotExistException, - IOException - { - try { - return (String) connection_.callMethod (pxId_, "retrieve", - new Class[] { Integer.TYPE, Integer.TYPE, Integer.TYPE }, //$A2C - new Object[] { new Integer(dataAreaOffset), new Integer(dataLength), new Integer(type) }) //$A2C - .getReturnValue (); - } - catch (InvocationTargetException e) { - Throwable e2 = e.getTargetException (); - if (e2 instanceof IllegalObjectTypeException) - throw (IllegalObjectTypeException) e2; - else - throw ProxyClientConnection.rethrow5 (e); - } - } - - - /** - Sets the system, path, and data area type. - **/ - public void setAttributes(AS400Impl system, QSYSObjectPathName path, int dataAreaType) - throws IOException - { - try { - connection_.callMethod (pxId_, "setAttributes", - new Class[] { AS400Impl.class, - QSYSObjectPathName.class, - Integer.TYPE }, - new Object[] { system, - path, - new Integer(dataAreaType) - }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - - /** - Writes the data to the data area. - It writes data.length() characters from data to the - data area beginning at dataAreaOffset. The first character - in the data area is at offset 0. - @param data The data to be written. - @param dataAreaOffset The offset in the data area at which to start writing. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void write(String data, int dataAreaOffset) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException - { - try { - connection_.callMethod (pxId_, "write", - new Class[] { String.class, Integer.TYPE }, - new Object[] { data, new Integer(dataAreaOffset) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow5 (e); - } - } - - - /** - Writes the data to the data area. - It writes data.length() characters from data to the - data area beginning at dataAreaOffset. The first character - in the data area is at offset 0. - @param data The data to be written. - @param dataAreaOffset The offset in the data area at which to start writing. - @param type The Data Area bidi string type, as defined by the CDRA (Character - Data Representataion Architecture). See - BidiStringType for more information and valid values. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void write(String data, int dataAreaOffset, int type) //$A2C - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException - { - try { - connection_.callMethod (pxId_, "write", - new Class[] { String.class, Integer.TYPE , Integer.TYPE}, //$A2C - new Object[] { data, new Integer(dataAreaOffset), new Integer(type) }); //$A2C - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow5 (e); - } - } - - - /** - Writes data to the data area. - @param data The decimal data to be written. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void write(BigDecimal data) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException - { - try { - connection_.callMethod (pxId_, "write", - new Class[] { BigDecimal.class }, - new Object[] { data }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow5 (e); - } - } - - - /** - Writes the value in data to the data area. - @param data The data to be written. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void write(boolean data) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException - { - try { - connection_.callMethod (pxId_, "write", - new Class[] { Boolean.TYPE }, - new Object[] { new Boolean(data) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow5 (e); - } - } - - - /** - Writes the data to the data area. - It writes data.length() bytes from data to the - data area beginning at dataAreaOffset. The first byte - in the data area is at offset 0. - **/ - public void write(byte[] data, int dataBufferOffset, int dataAreaOffset, int dataLength) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - try { - connection_.callMethod (pxId_, "write", - new Class[] { byte[].class, Integer.TYPE, Integer.TYPE, Integer.TYPE }, - new Object[] { data, new Integer(dataBufferOffset), new Integer(dataAreaOffset), new Integer(dataLength) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow5 (e); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/DataAreaImplRemote.java b/cvsroot/src/com/ibm/as400/access/DataAreaImplRemote.java deleted file mode 100644 index 68643270f..000000000 --- a/cvsroot/src/com/ibm/as400/access/DataAreaImplRemote.java +++ /dev/null @@ -1,1316 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataAreaImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @A2 - 07/27/2007 - Allow users to write data containing single quote -// characters. User needs to specify two single quote -// characters to be interpretted as a single character. -// This would have resulted in potential length errors -// being reported by toolbox code. Therefore, some toolbox -// length verification has been removed. The IBM i API's -// will report an error if the data length is invalid. -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.access; - -import java.io.CharConversionException; -import java.io.UnsupportedEncodingException; -import java.io.IOException; -import java.math.BigDecimal; -import java.net.UnknownHostException; - -/** - Provides the remote implementations for the public Data Area classes: -
            -
          • DataArea (abstract base class) -
          • CharacterDataArea -
          • DecimalDataArea -
          • LocalDataArea -
          • LogicalDataArea -
          - **/ -class DataAreaImplRemote implements DataAreaImpl -{ - private AS400ImplRemote system_; // The system where the data area is located. - private String library_; // The library that contains the data area. - private String name_; // The name of the data area. - private QSYSObjectPathName ifsPathName_; // The full path name of the data area. - - private byte[] dataAreaSystemPathName_; // The name and library of the data area used in program call. - private ConverterImplRemote converter_; // The ccsid converter for this system. - - private int ccsid_; // The ccsid for this system. - private RemoteCommandImpl rmtCmd_; // Impl object for remote command host server. - private AS400Message[] messageList_; // The message list for the command object. - - private int length_; // The maximum number of bytes the data area can contain. - - private boolean attributesRetrieved_; // Flag indicating if this data area object contains current information regarding its corresponding IBM i data area. - private int dataAreaType_ = DataArea.UNINITIALIZED; // Type of data area object. - private static final QSYSObjectPathName PROGRAM_NAME = new QSYSObjectPathName("/QSYS.LIB/QWCRDTAA.PGM"); - private static final int RETURNED_DATA_FIXED_HEADER_LENGTH = 36; // length of fixed part of returned data from QWCRDTAA - private static final boolean COMMAND_CALL = true; - private static final boolean PROGRAM_CALL = false; - - // For DecimalDataArea only: - private int decimalPositions_ = 5; // The default number of decimal positions. - - /** - Resets the character data area to contain default values (blank, zero, or false). - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void clear() throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, ServerStartupException, UnknownHostException - { - // Build the string for the write. - // In the case of Character Data Area and Local Data Area, - // if a substring starting position and length aren't specified, - // the IBM i API assumes '*ALL' for the starting position and hence - // performs an overwrite of the remainder of the data area using - // all blanks. - String clrcmd = null; - switch (dataAreaType_) - { - case DataArea.CHARACTER_DATA_AREA: - clrcmd = "QSYS/CHGDTAARA DTAARA(" + library_ + "/" + name_ + ") VALUE(' ')"; - break; - case DataArea.DECIMAL_DATA_AREA: - clrcmd = "QSYS/CHGDTAARA DTAARA(" + library_ + "/" + name_ + ") VALUE(0.0)"; - break; - case DataArea.LOCAL_DATA_AREA: - clrcmd = "QSYS/CHGDTAARA DTAARA(*LDA) VALUE(' ')"; - break; - case DataArea.LOGICAL_DATA_AREA: - clrcmd = "QSYS/CHGDTAARA DTAARA(" + library_ + "/" + name_ + ") VALUE('0')"; - break; - default: - Trace.log (Trace.ERROR, "Programming error: clear() was called as dataAreaType=" + dataAreaType_); - throw new InternalErrorException (InternalErrorException.UNKNOWN, dataAreaType_); - } - - // Run the command. - if(!run(clrcmd)) // CHGDTAARA is known to be not threadsafe - { - // Throw AS400MessageList. - processExceptions(getMessages()); - } - } - - /** - Creates a character data area with the specified attributes. - @param length The maximum number of bytes in the data area. Valid values are 1 through 2000. - @param initialValue The initial value for the data area. - @param textDescription The text description for the data area. The maximum length is 50 characters. - @param authority The public authority level for the data area. Valid values are *ALL, *CHANGE, *EXCLUDE, *LIBCRTAUT, *USE, or the name of an authorization list. The maximum length is 10 characters. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectAlreadyExistsException If the system object already exists. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void create(int length, String initialValue, String textDescription, String authority) throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectAlreadyExistsException, ObjectDoesNotExistException, ServerStartupException, UnknownHostException - { - // Assume the arguments have been validated by the public class. - if (dataAreaType_ != DataArea.CHARACTER_DATA_AREA) - { - Trace.log (Trace.ERROR, "Programming error: create(int,String,String,String) " + - "was called when dataAreaType=" + dataAreaType_); - throw new InternalErrorException (InternalErrorException.UNKNOWN, dataAreaType_); - } - - length_ = length; - - // Build the string for the create. - String crtcmd = "QSYS/CRTDTAARA DTAARA(" + library_ + "/" + name_ + ") TYPE(*CHAR) LEN(" + String.valueOf(length_) + " " + ") VALUE('" + initialValue + "') TEXT('" + textDescription + "')" + " AUT(" + authority + ")"; - - // Run the command. - if(!run(crtcmd)) // CRTDTAARA is known to be not threadsafe - { - // Throw AS400MessageList. - processCreateExceptions(getMessages()); - } - attributesRetrieved_ = true; - } - - /** - Creates a decimal data area with the specified attributes. - @param length The maximum number of digits in the data area. Valid values are 1 through 24. - @param decimalPositions The number of digits to the right of the decimal point. Valid values are 0 through 9. - @param initialValue The initial value for the data area. - @param textDescription The text description for the data area. The maximum length is 50 characters. - @param authority The public authority level for the data area. Valid values are *ALL, *CHANGE, *EXCLUDE, *LIBCRTAUT, *USE, or the name of an authorization list. The maximum length is 10 characters. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectAlreadyExistsException If the system object already exists. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void create(int length, int decimalPositions, BigDecimal initialValue, String textDescription, String authority) throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectAlreadyExistsException, ObjectDoesNotExistException, ServerStartupException, UnknownHostException - { - // Assume the arguments have been validated by the public class. - if (dataAreaType_ != DataArea.DECIMAL_DATA_AREA) - { - Trace.log(Trace.ERROR, "Programming error: create(int,int,BigDecimal,String,String) was called when dataAreaType=" + dataAreaType_); - throw new InternalErrorException (InternalErrorException.UNKNOWN, dataAreaType_); - } - - length_ = length; - decimalPositions_ = decimalPositions; - - // Build the string for the create. - String crtcmd = "QSYS/CRTDTAARA DTAARA(" + library_ + "/" + name_ + ") TYPE(*DEC) LEN(" + String.valueOf(length_) + " " + String.valueOf(decimalPositions_) + ") VALUE(" + initialValue.toString() + ") TEXT('" + textDescription + "')" + " AUT(" + authority + ")"; - - // Run the command. - if(!run(crtcmd)) // CRTDTAARA is known to be not threadsafe - { - // Throw AS400MessageList. - processCreateExceptions(getMessages()); - } - - attributesRetrieved_ = true; - } - - /** - Creates a logical data area with the specified attributes. - @param initialValue The initial value for the data area. - @param textDescription The text description for the data area. The maximum length is 50 characters. - @param authority The public authority level for the data area. Valid values are *ALL, *CHANGE, *EXCLUDE, *LIBCRTAUT, *USE, or the name of an authorization list. The maximum length is 10 characters. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectAlreadyExistsException If the system object already exists. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void create(boolean initialValue, String textDescription, String authority) throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectAlreadyExistsException, ObjectDoesNotExistException, ServerStartupException, UnknownHostException - { - // Assume the arguments have been validated by the public class. - if (dataAreaType_ != DataArea.LOGICAL_DATA_AREA) - { - Trace.log (Trace.ERROR, "Programming error: create(boolean,String,String) was called when dataAreaType=" + dataAreaType_); - throw new InternalErrorException (InternalErrorException.UNKNOWN, dataAreaType_); - } - - // Build the string for the create. - String crtcmd = "QSYS/CRTDTAARA DTAARA(" + library_ + "/" + name_ + ") TYPE(*LGL) LEN(1) VALUE('" + (initialValue ? "1" : "0") + "') TEXT('" + textDescription + "')" + " AUT(" + authority + ")"; - - // Run the command. - if(!run(crtcmd)) // CRTDTAARA is known to be not threadsafe - { - // Throw AS400MessageList. - processCreateExceptions(getMessages()); - } - - attributesRetrieved_ = true; - } - - /** - Removes the data area from the system. Note this method is NOT public. It is overridden as a public method in the subclasses that use it. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void delete() throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, ServerStartupException, UnknownHostException - { - if (dataAreaType_ == DataArea.LOCAL_DATA_AREA) - { - Trace.log(Trace.ERROR, "Programming error: delete() was called when dataAreaType=" + dataAreaType_); - throw new InternalErrorException(InternalErrorException.UNKNOWN, dataAreaType_); - } - - // Do the delete. - String dltcmd = "QSYS/DLTDTAARA DTAARA(" + library_ + "/" + name_ + ")"; - - // Run the command. - if(!run(dltcmd)) // DLTDTAARA is known to be threadsafe - { - // Throw AS400MessageList. - processExceptions(getMessages()); - return; - } - - attributesRetrieved_ = false; - } - - /** - Returns the number of digits to the right of the decimal point in this decimal data area. - @return The number of decimal positions. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public int getDecimalPositions() throws AS400SecurityException, ErrorCompletingRequestException, IllegalObjectTypeException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (dataAreaType_ != DataArea.DECIMAL_DATA_AREA) - { - Trace.log(Trace.ERROR, "Programming error: create(int,String,String,String) was called when dataAreaType=" + dataAreaType_); - throw new InternalErrorException (InternalErrorException.UNKNOWN, dataAreaType_); - } - - if (!attributesRetrieved_) - retrieveAttributes(); - - return decimalPositions_; - } - - /** - Returns the size of the data area. - @return The size of the data area, in bytes. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public int getLength() throws AS400SecurityException, ErrorCompletingRequestException, IllegalObjectTypeException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!attributesRetrieved_) - retrieveAttributes(); - - return length_; - } - - /** - Returns the messages from the previously run command. - @return The list of messages. - **/ - private AS400Message[] getMessages() - { - return messageList_; - } - - /** - Throws the appropriate data area exception for each particular AS400Message. - @param messageList The array of AS400Message objects. - **/ - void processCreateExceptions(AS400Message[] messageList) throws AS400SecurityException, ObjectAlreadyExistsException, ObjectDoesNotExistException, AS400Exception - { - if (messageList == null) - return; - - for (int msg = 0; msg < messageList.length; msg++) - { - Trace.log(Trace.ERROR, messageList[msg].toString()); - String xid = messageList[msg].getID(); - if (xid.equals("CPF1023")) - { - Trace.log(Trace.ERROR, "Re-throwing as ObjectAlreadyExistsException."); - throw new ObjectAlreadyExistsException(ObjectAlreadyExistsException.OBJECT_ALREADY_EXISTS); - } - AS400Message[] ml = { messageList[msg] }; - processExceptions(ml); - } - } - - /** - Throws the appropriate data area exception for each particular AS400Message. - @param messageList The array of AS400Message objects. - **/ - static void processExceptions(AS400Message[] messageList) throws AS400SecurityException, ObjectDoesNotExistException, AS400Exception - { - if (messageList == null) - return; - - for (int msg = 0; msg < messageList.length; ++msg) - { - Trace.log(Trace.ERROR, messageList[msg].toString()); - String xid = messageList[msg].getID(); - - if (xid.equals("CPF1015")) - { - Trace.log(Trace.ERROR, "Re-throwing as ObjectDoesNotExistException."); - throw new ObjectDoesNotExistException(ObjectDoesNotExistException.OBJECT_DOES_NOT_EXIST); - } - if (xid.equals("CPF1016")) - { - Trace.log(Trace.ERROR, "Re-throwing as AS400SecurityException."); - throw new AS400SecurityException(AS400SecurityException.OBJECT_AUTHORITY_INSUFFICIENT); - } - if (xid.equals("CPF1018")) - { - Trace.log(Trace.ERROR, "Re-throwing as AS400SecurityException."); - throw new AS400SecurityException(AS400SecurityException.OBJECT_AUTHORITY_INSUFFICIENT); - } - if (xid.equals("CPF1021")) - { - Trace.log(Trace.ERROR, "Re-throwing as ObjectDoesNotExistException."); - throw new ObjectDoesNotExistException(ObjectDoesNotExistException.LIBRARY_DOES_NOT_EXIST); - } - if (xid.equals("CPF1022")) - { - Trace.log(Trace.ERROR, "Re-throwing as AS400SecurityException."); - throw new AS400SecurityException(AS400SecurityException.LIBRARY_AUTHORITY_INSUFFICIENT); - } - if (xid.equals("CPF2105")) - { - Trace.log(Trace.ERROR, "Re-throwing as ObjectDoesNotExistException."); - throw new ObjectDoesNotExistException(ObjectDoesNotExistException.OBJECT_DOES_NOT_EXIST); - } - if (xid.equals("CPF2182")) - { - Trace.log(Trace.ERROR, "Re-throwing as AS400SecurityException."); - throw new AS400SecurityException(AS400SecurityException.LIBRARY_AUTHORITY_INSUFFICIENT); - } - if (xid.equals("CPF2189")) - { - Trace.log(Trace.ERROR, "Re-throwing as AS400SecurityException."); - throw new AS400SecurityException(AS400SecurityException.OBJECT_AUTHORITY_INSUFFICIENT); - } - - throw new AS400Exception(messageList[msg]); - } - } - - /** - Returns the data read from the decimal data area. - @return The decimal data read from the data area. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - // Note that doing a read() will also set the attributes of this - // object to what is returned from the system, namely the length and - // number of decimal positions. - public BigDecimal readBigDecimal() throws AS400SecurityException, ErrorCompletingRequestException, IllegalObjectTypeException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (dataAreaType_ != DataArea.DECIMAL_DATA_AREA) - { - Trace.log (Trace.ERROR, "Programming error: readBigDecimal() was called when dataAreaType=" + dataAreaType_); - throw new InternalErrorException (InternalErrorException.UNKNOWN, dataAreaType_); - } - - // Do the read. - BigDecimal val = (BigDecimal)retrieveAttributes(); - - return val; - } - - /** - Returns the value in the logical data area. - @return The data read from the data area. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public boolean readBoolean() throws AS400SecurityException, ErrorCompletingRequestException, IllegalObjectTypeException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (dataAreaType_ != DataArea.LOGICAL_DATA_AREA) - { - Trace.log(Trace.ERROR, "Programming error: readBoolean() was called when dataAreaType=" + dataAreaType_); - throw new InternalErrorException (InternalErrorException.UNKNOWN, dataAreaType_); - } - - // Do the read - - // We expect to retrieve the fixed header, plus 1 byte. - int lengthOfReceiverVariable = RETURNED_DATA_FIXED_HEADER_LENGTH + 1; - - // Call the "Retrieve Data Area" API. - byte[] dataReceived = retrieveDataAreaContents(lengthOfReceiverVariable, dataAreaSystemPathName_, -1, 1); - - // Format of data returned: - // Offset - Type - Field - // 0 - Bin 4 - Bytes available - // 4 - Bin 4 - Bytes returned - // 8 - Char 10 - Type of value returned - // 18 - Char 10 - Library name - // 28 - Bin 4 - Length of value returned - // 32 - Bin 4 - Number of decimal positions - // 36 - Char * - Value - - // Check the type - String type = converter_.byteArrayToString(dataReceived, 8, 10).toUpperCase().trim(); //@A1C - if (!type.equals("*LGL")) - { - if (type.equals("*CHAR")) - { - Trace.log(Trace.ERROR, "Illegal data area type for logical data area object: "+type); - throw new IllegalObjectTypeException(IllegalObjectTypeException.DATA_AREA_CHARACTER); - } - else if (type.equals("*DEC")) - { - Trace.log(Trace.ERROR, "Illegal data area type for logical data area object: "+type); - throw new IllegalObjectTypeException(IllegalObjectTypeException.DATA_AREA_DECIMAL); - } - else - { - Trace.log(Trace.ERROR, "Unknown data area type for logical data area object: "+type); - throw new IOException(ResourceBundleLoader.getText("EXC_OBJECT_TYPE_UNKNOWN")); - } - } - - // Set the attributes - length_ = BinaryConverter.byteArrayToInt(dataReceived, 28); - if (length_ != 1) - { - Trace.log(Trace.ERROR, "Logical data area length not valid: "+length_); - throw new IOException(ResourceBundleLoader.getText("EXC_LENGTH_NOT_VALID")); - } - - // Get the data - String val = converter_.byteArrayToString(dataReceived, 36, 1); - boolean data = false; - if (val.equals("1")) - { - data = true; - } - else if (!val.equals("0")) - { - Trace.log(Trace.ERROR, "Data received not valid: "+val); - throw new IOException(ResourceBundleLoader.getText("EXC_DATA_NOT_VALID")); - } - - return data; - } - - - /** - Reads raw bytes from the data area. - It retrieves dataLength bytes beginning at - dataAreaOffset in the data area. The first byte in - the data area is at offset 0. - @param data The data to be written. - @param dataBufferOffset The starting offset in data. - @param dataAreaOffset The offset in the data area at which to start reading. (0-based) - @param dataLength The number of bytes to read. Valid values are from - 1 through (data area size - dataAreaOffset). - @return The total number of bytes read into the buffer. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public int readBytes(byte[] data, int dataBufferOffset, int dataAreaOffset, int dataLength) - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - // Do the read - - // We expect to retrieve the fixed header, plus dataLength bytes. - int lengthOfReceiverVariable = RETURNED_DATA_FIXED_HEADER_LENGTH + dataLength; - - // Call the "Retrieve Data Area" API. - byte[] dataReceived = retrieveDataAreaContents(lengthOfReceiverVariable, dataAreaSystemPathName_, dataAreaOffset+1, dataLength); - - // Format of data returned: - // Offset - Type - Field - // 0 - Bin 4 - Bytes available The length of all data available to - // return. All available data is returned if enough space - // is provided. - // 4 - Bin 4 - Bytes returned The length of all data actually - // returned. If the data truncated because the receiver - // variable was not sufficiently large to hold all of the - // data available, this value will be less than the bytes - // available. - // 8 - Char 10 - Type of value returned - // 18 - Char 10 - Library name - // 28 - Bin 4 - Length of value returned - // 32 - Bin 4 - Number of decimal positions - // 36 - Char * - Value - - int numBytesReturned = BinaryConverter.byteArrayToInt(dataReceived, 4); - numBytesReturned = numBytesReturned - 36; // Disregard the header bytes - if (numBytesReturned > dataLength) - { - Trace.log(Trace.ERROR, "Unexpected number of bytes returned: "+numBytesReturned); - throw new InternalErrorException (InternalErrorException.UNKNOWN, numBytesReturned); - } - else if (numBytesReturned < dataLength) - { - Trace.log(Trace.WARNING, "Fewer bytes returned than requested: "+numBytesReturned); - } - - // The rest of the receiver array is the retrieved data. - System.arraycopy(dataReceived, 36, data, dataBufferOffset, numBytesReturned); - return numBytesReturned; - } - - - /** - Calls the Retrieve Data Area (QWCRDTAA) API to retrieve bytes from specified location in the data area. - @param lengthOfReceiverVariable The length of the receiver variable (in bytes). - @param qualifiedDataAreaName Byte array containing library and name of the data area. - @param startingPosition The position (1-based) in the data area at which to start the retrieve. A value of 1 specifies the first byte in the data area. A value of -1 will return all the bytes in the data area. - @param dataLength The number of bytes to retrieve. - @return The retrieved bytes. - **/ - private byte[] retrieveDataAreaContents(int lengthOfReceiverVariable, byte[] qualifiedDataAreaName, int startingPosition, int dataLength) throws AS400SecurityException, ErrorCompletingRequestException, IllegalObjectTypeException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Do the read - // **** Setup the parameter list **** - // Format for Retrieve Data Area API (QWCRDTAA): - // 1 - Receiver variable - Output - Char * - // 2 - Length of receiver variable - Input - Bin 4 - // 3 - Qualified data area name - Input - Char 20 - // 4 - Starting position - Input - Bin 4 - // 5 - Length of data - Input - Bin 4 - // 6 - Error code - I/O - Char * - - ProgramParameter[] parmlist = new ProgramParameter[6]; - - // First parameter: output, is the receiver variable - // Format of data returned: - // Offset - Type - Field - // 0 - Bin 4 - Bytes available The length of all data available to - // return. All available data is returned if enough space - // is provided. - // 4 - Bin 4 - Bytes returned The length of all data actually - // returned. If the data truncated because the receiver - // variable was not sufficiently large to hold all of the - // data available, this value will be less than the bytes - // available. - // 8 - Char 10 - Type of value returned - // 18 - Char 10 - Library name - // 28 - Bin 4 - Length of value returned - // 32 - Bin 4 - Number of decimal positions - // 36 - Char * - Value - byte[] dataReceived = new byte[lengthOfReceiverVariable]; - parmlist[0] = new ProgramParameter(dataReceived.length); - - // Second parameter: input, length of receiver variable - byte[] receiverLength = new byte[4]; - BinaryConverter.intToByteArray(dataReceived.length, receiverLength, 0); - parmlist[1] = new ProgramParameter(receiverLength); - - // Third parameter: input, qualified data area name - parmlist[2] = new ProgramParameter(qualifiedDataAreaName); - - // Fourth parameter: input, starting position - // 1 through 2000; -1 retrieves all - byte[] startingPos = BinaryConverter.intToByteArray(startingPosition); - parmlist[3] = new ProgramParameter(startingPos); - - // Fifth parameter: input, length of data - byte[] lengthOfData = BinaryConverter.intToByteArray(dataLength); - parmlist[4] = new ProgramParameter(lengthOfData); - - // Sixth parameter: input/output, error code - // Format ERRC0100: (could also use ERRC0200 instead?) - // Offset - Use - Type - Field - // 0 - Input - Bin 4 - Bytes provided - // 4 - Output - Bin 4 - Bytes available - // 8 - Output - Char 7 - Exception ID - // 15 - Output - Char 1 - Reserved - // 16 - Output - Char * - Exception data - byte[] errorCode = new byte[17]; - // A value >=8 of bytes provided means the system will return exception - // information on the parameter instead of throwing an exception - // to the application. We provide 0 to ensure it does indeed - // throw us an exception. - BinaryConverter.intToByteArray(0, errorCode, 0); - parmlist[5] = new ProgramParameter(errorCode, 17); - - // Create the pgm call object - if (rmtCmd_ == null) { - setupRemoteCommand(); - } - - // Run the program. Failure is returned as a message list. - if(!rmtCmd_.runProgram("QSYS", "QWCRDTAA", parmlist)) // QWCRDTAA isn't threadsafe. $B1C - { - // Throw AS400MessageList - processExceptions(rmtCmd_.getMessageList()); - } - - // Get the data returned from the program - dataReceived = parmlist[0].getOutputData(); - - if (Trace.isTraceOn() && Trace.isTraceDiagnosticOn()) - { - String areaType = DataArea.dataAreaTypeToString(dataAreaType_); - Trace.log(Trace.DIAGNOSTIC, areaType + " data area data retrieved:", dataReceived); - } - - return dataReceived; - } - - /** - Refreshes the attributes of the data area. - This method should be called if the underlying IBM i data area has changed and it is desired that this object should reflect those changes. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void refreshAttributes() throws AS400SecurityException, ErrorCompletingRequestException, IllegalObjectTypeException, InterruptedException, IOException, ObjectDoesNotExistException - { - attributesRetrieved_ = false; - retrieveAttributes(); - } - - //$D2C - /** - Makes the API call to retrieve the character data area data and attributes. - @param offset The offset in the data area at which to start retrieving. (0-based) - @param length The number of bytes to read. - @return The String value read from the data area as a result of retrieving the data area's attributes. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public String retrieve(int offset, int length) throws AS400SecurityException, ErrorCompletingRequestException, IllegalObjectTypeException, InterruptedException, IOException, ObjectDoesNotExistException - { - if(AS400BidiTransform.isBidiCcsid(ccsid_)) - return retrieve(offset, length, AS400BidiTransform.getStringType((char)ccsid_)); - else - return retrieve(offset, length, BidiStringType.DEFAULT); - } - - - //$D2A - /** - Makes the API call to retrieve the character data area data and attributes. - @param offset The offset in the data area at which to start retrieving. (0-based) - @param length The number of bytes to read. - @param stringType The Data Area bidi string type, as defined by the CDRA (Character - Data Representataion Architecture). See - BidiStringType for more information and valid values. - @return The String value read from the data area as a result of retrieving the data area's attributes. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public String retrieve(int offset, int length, int stringType) throws AS400SecurityException, ErrorCompletingRequestException, IllegalObjectTypeException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (dataAreaType_ != DataArea.CHARACTER_DATA_AREA && dataAreaType_ != DataArea.LOCAL_DATA_AREA) - { - Trace.log(Trace.ERROR, "Programming error: retrieve(int,int) was called when dataAreaType=" + dataAreaType_); - throw new InternalErrorException (InternalErrorException.UNKNOWN, dataAreaType_); - } - - // Do the read - - // We expect to retrieve the fixed header, plus the data bytes. - int lengthOfReceiverVariable = RETURNED_DATA_FIXED_HEADER_LENGTH + 4001; - // 36 fixed header bytes, plus a max of 4001 bytes from data area. - // With a max of 2000 characters, the worst case - // scenario is that every other character is DBCS - // (i.e. for a mixed byte Unicode String) - // so that there would be a SI/SO, like this: - // SI-1-SO 2 SI-3-SO 4 SI-5-SO etc... - // So for 3 initial chars, you get 7 bytes; - // for 5 initial chars, you get 11 bytes; etc. - // This equates to: - // max # bytes needed = (2 * initial_chars) + 1 - - // Call the "Retrieve Data Area" API. - int startingPosition = (offset == -1 ? offset : offset+1); // -1 means "retrieve all" - byte[] dataReceived = retrieveDataAreaContents(lengthOfReceiverVariable, dataAreaSystemPathName_, startingPosition, length); - - // Format of data returned: - // Offset - Type - Field - // 0 - Bin 4 - Bytes available The length of all data available to - // return. All available data is returned if enough space - // is provided. - // 4 - Bin 4 - Bytes returned The length of all data actually - // returned. If the data truncated because the receiver - // variable was not sufficiently large to hold all of the - // data available, this value will be less than the bytes - // available. - // 8 - Char 10 - Type of value returned - // 18 - Char 10 - Library name - // 28 - Bin 4 - Length of value returned - // 32 - Bin 4 - Number of decimal positions - // 36 - Char * - Value - - // Check the type - String type = converter_.byteArrayToString(dataReceived, 8, 10).toUpperCase().trim(); //@A1C - if (!type.equals("*CHAR")) - { - if (type.equals("*DEC")) - { - Trace.log(Trace.ERROR, "Illegal data area type for character data area object: "+type); - throw new IllegalObjectTypeException(IllegalObjectTypeException.DATA_AREA_DECIMAL); - } - else if (type.equals("*LGL")) - { - Trace.log(Trace.ERROR, "Illegal data area type for character data area object: "+type); - throw new IllegalObjectTypeException(IllegalObjectTypeException.DATA_AREA_LOGICAL); - } - else - { - Trace.log(Trace.ERROR, "Illegal data area type for character data area object: "+type); - throw new IOException(ResourceBundleLoader.getText("EXC_OBJECT_TYPE_UNKNOWN")); - } - } - - // Set the attributes - if (offset == -1) // (the entire data area was retrieved) - { - length_ = BinaryConverter.byteArrayToInt(dataReceived, 28); - } - - // bytesReturned reflects the number of bytes of data in the data area - int bytesReturned = BinaryConverter.byteArrayToInt(dataReceived, 4); - bytesReturned = bytesReturned - 36; // Don't count the first 36 bytes - - // The rest of the receiver array is the character data. - - return converter_.byteArrayToString(dataReceived, 36, bytesReturned, stringType); //@A1C //$D2C - } - - /** - Retrieves/refreshes the data area's attributes. - @return The data read from the data area as a result of retrieving the data area's attributes. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - private Object retrieveAttributes() throws AS400SecurityException, ErrorCompletingRequestException, IllegalObjectTypeException, InterruptedException, IOException, ObjectDoesNotExistException - { - switch (dataAreaType_) - { - case DataArea.CHARACTER_DATA_AREA: - case DataArea.LOCAL_DATA_AREA: - return retrieveAttributesString(); - case DataArea.DECIMAL_DATA_AREA: - return retrieveAttributesBigDecimal(); - case DataArea.LOGICAL_DATA_AREA: - return retrieveAttributesBoolean(); - default: - Trace.log (Trace.ERROR, "Programming error: retrieveAttributes() was called as dataAreaType=" + dataAreaType_); - throw new InternalErrorException (InternalErrorException.UNKNOWN, dataAreaType_); - } - } - - /** - Retrieves/refreshes the logical data area's attributes. - @return The BigDecimal value read from the data area as a result of retrieving the data area's attributes. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - private Object retrieveAttributesBigDecimal() throws AS400SecurityException, ErrorCompletingRequestException, IllegalObjectTypeException, InterruptedException, IOException, ObjectDoesNotExistException - { - // For a decimal data area, need to get the length & decimal positions - // But since this is the only API available to us, we might as well - // do a read of the data too. - - // Do the read - - // We expect to retrieve the fixed header, plus a max of 24 digits from data area. - int lengthOfReceiverVariable = RETURNED_DATA_FIXED_HEADER_LENGTH + 24; - - // Call the "Retrieve Data Area" API. - byte[] dataReceived = retrieveDataAreaContents(lengthOfReceiverVariable, dataAreaSystemPathName_, -1, 24); - - // Check the type - String type = converter_.byteArrayToString(dataReceived, 8, 10).toUpperCase().trim(); //@A1C - if (!type.equals("*DEC")) - { - if (type.equals("*CHAR")) - { - Trace.log(Trace.ERROR, "Illegal data area type for decimal data area object: "+type); - throw new IllegalObjectTypeException(IllegalObjectTypeException.DATA_AREA_CHARACTER); - } - else if (type.equals("*LGL")) - { - Trace.log(Trace.ERROR, "Illegal data area type for decimal data area object: "+type); - throw new IllegalObjectTypeException(IllegalObjectTypeException.DATA_AREA_LOGICAL); - } - else - { - Trace.log(Trace.ERROR, "Illegal data area type for decimal data area object: "+type); - throw new IOException(ResourceBundleLoader.getText("EXC_OBJECT_TYPE_UNKNOWN")); - } - } - - // Set the attributes - length_ = BinaryConverter.byteArrayToInt(dataReceived, 28); - decimalPositions_ = BinaryConverter.byteArrayToInt(dataReceived, 32); - - // The rest of the receiver array is the packed decimal data. - // Need to convert: packed decimal bytes -> AS400PackedDecimal -> BigDecimal. - AS400PackedDecimal packedJava = new AS400PackedDecimal(length_, decimalPositions_); - byte[] packed400 = new byte[24]; - System.arraycopy(dataReceived, 36, packed400, 0, 24); - BigDecimal val = (BigDecimal)packedJava.toObject(packed400); - - attributesRetrieved_ = true; - - return val; - } - - /** - Retrieves/refreshes the data area's attributes. - @return The boolean[] value read from the data area as a result of retrieving the data area's attributes. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - private Object retrieveAttributesBoolean() throws AS400SecurityException, ErrorCompletingRequestException, IllegalObjectTypeException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Read in the entire data area to get the total length - boolean[] obj = new boolean[1]; - obj[0] = readBoolean(); - - attributesRetrieved_ = true; - - return obj; - } - - /** - Retrieves/refreshes the character (or local) data area's attributes. - @return The String value read from the data area as a result of retrieving the data area's attributes. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - private Object retrieveAttributesString() throws AS400SecurityException, ErrorCompletingRequestException, IllegalObjectTypeException, InterruptedException, IOException, ObjectDoesNotExistException - { - // For a character data area, need to get the length. - // But since this is the only API available to us, we might as well - // do a read of the data too. - - // Read in the entire data area to get the total length - String obj = retrieve(-1, 1); - - attributesRetrieved_ = true; - - return obj; - } - - /** - Runs the specified command using CommandCall. - @return True if the command ran without errors; otherwise false. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - private boolean run(String command) throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ServerStartupException, UnknownHostException - { - boolean result = false; - if (rmtCmd_ == null) { - setupRemoteCommand(); - } - result = rmtCmd_.runCommand(command); // @B2C - messageList_ = rmtCmd_.getMessageList(); - - return result; - } - - /** - Sets the system, path, and data area type. - Note: This method should be called only once per DataAreaImplRemote object, immediately after object creation. - **/ - public void setAttributes(AS400Impl system, QSYSObjectPathName path, int dataAreaType) throws IOException - { - // Assume the arguments have been validated by the public class. - setSystem((AS400ImplRemote)system); - setPath(path); - setType(dataAreaType); - } - - /** - Sets the fully qualified data area name. Note this method is NOT public in the public class. - It is overridden as a public method in the subclasses that use it. - **/ - private void setPath(QSYSObjectPathName path) throws CharConversionException, UnsupportedEncodingException - { - // Assume the argument has been validated by the public class. - - // Set instance vars - ifsPathName_ = path; - library_ = ifsPathName_.getLibraryName(); - name_ = ifsPathName_.getObjectName(); - - // Set up the data area system path name buffer. - - if (ccsid_ == 0) - ccsid_ = system_.getCcsid(); - if (converter_ == null) - converter_ = ConverterImplRemote.getConverter(ccsid_, system_); - dataAreaSystemPathName_ = new byte[20]; - for (int i=0; i<20; i++) // Fill the array with blanks. - dataAreaSystemPathName_[i] = (byte)0x40; - - converter_.stringToByteArray(name_, dataAreaSystemPathName_, 0, 10); - converter_.stringToByteArray(library_, dataAreaSystemPathName_, 10, 10); - } - - /** - Sets the system on which the data area exists. The system cannot be set if a connection has already been established. - @param system The system on which the data area exists. - **/ - private void setSystem(AS400ImplRemote system) - { - // Assume the argument has been validated by the public class. - system_ = system; - } - - /** - Sets the specific type for the Data Area object. - @param data The type for Data Area object. - **/ - private void setType(int dataAreaType) - { - switch (dataAreaType) - { - case DataArea.CHARACTER_DATA_AREA: - length_ = CharacterDataArea.DEFAULT_LENGTH; - break; - case DataArea.DECIMAL_DATA_AREA: - length_ = DecimalDataArea.DEFAULT_LENGTH; - break; - case DataArea.LOCAL_DATA_AREA: - length_ = LocalDataArea.DEFAULT_LENGTH; - break; - case DataArea.LOGICAL_DATA_AREA: - length_ = LogicalDataArea.DEFAULT_LENGTH; - break; - default: - Trace.log (Trace.ERROR, "Programming error: setType() was called with arg=" + dataAreaType); - throw new InternalErrorException (InternalErrorException.UNKNOWN, dataAreaType); - } - dataAreaType_ = dataAreaType; - } - - // Setup remote command object on first touch. Synchronized to protect instance variables. This method can safely be called multiple times because it checks for a previous call before changing the instance variables. - protected synchronized void setupRemoteCommand() throws IOException - { - // If not already setup. - if (rmtCmd_ == null) - { - if (system_.canUseNativeOptimizations()) - { - try - { - rmtCmd_ = (RemoteCommandImpl)Class.forName("com.ibm.as400.access.RemoteCommandImplNative").newInstance(); - // Avoid direct reference - it can cause NoClassDefFoundError at class loading time on Sun JVM's. - } - catch (Throwable e) { - // A ClassNotFoundException would be unexpected, since canUseNativeOptions() returned true. - Trace.log(Trace.WARNING, "Unable to instantiate class RemoteCommandImplNative.", e); - } - } - if (rmtCmd_ == null) - { - rmtCmd_ = new RemoteCommandImplRemote(); - } - rmtCmd_.setSystem(system_); - } - } - - - //$D2C - /** - Writes the data to the character (or local) data area. It writes data.length() characters from data to the data area beginning at dataAreaOffset. The first character in the data area is at offset 0. - @param data The data to be written. - @param dataAreaOffset The offset in the data area at which to start writing. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void write(String data, int dataAreaOffset) throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, ServerStartupException, UnknownHostException - { - if(AS400BidiTransform.isBidiCcsid(ccsid_)) - write(data, dataAreaOffset, AS400BidiTransform.getStringType((char)ccsid_)); - else - write(data, dataAreaOffset, BidiStringType.DEFAULT); - } - - - //$D2A - /** - Writes the data to the character (or local) data area. It writes data.length() characters from data to the data area beginning at dataAreaOffset. The first character in the data area is at offset 0. - @param data The data to be written. - @param dataAreaOffset The offset in the data area at which to start writing. - @param type The Data Area bidi string type, as defined by the CDRA (Character - Data Representataion Architecture). See - BidiStringType for more information and valid values. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void write(String data, int dataAreaOffset, int type) throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, ServerStartupException, UnknownHostException - { - // Assume the arguments have been validated by the public class. - if (dataAreaType_ != DataArea.CHARACTER_DATA_AREA && dataAreaType_ != DataArea.LOCAL_DATA_AREA) - { - Trace.log (Trace.ERROR, "Programming error: write(String,int) was called when dataAreaType=" + dataAreaType_); - throw new InternalErrorException (InternalErrorException.UNKNOWN, dataAreaType_); - } - - // Build the string for the write. - //String wrtcmd = null; - byte[] wrtcmd; - - // convert to get the actual number of bytes being written. In mixed - // environments a character can expand to more than one byte. The - // number of byte is passed on the command. - - // To allow bidi data to be written to a data area, each - // part (the beginning of the command, the data, the end of the commmand) - // must be converted into bytes and passed to command call. - byte[] part1; //@D2A - byte[] part2 = converter_.stringToByteArray(data, type); //@D1a //$D2C - byte[] part3 = converter_.stringToByteArray("')"); //@D2A - int dataLength = part2.length; //@D2C - int countSingleQuotePairs = 0; //@A2A - - switch (dataAreaType_) - { - case DataArea.CHARACTER_DATA_AREA: - // Start Changes ----------------------------------------- @A2A - // Search/count the number of single-quote pairs in "data" parm. - // Single-quote pairs are treated as a single-quote for - // the "Substring length" parameter of the CHGDTAARA command. - // For example, the following is valid: - // QSYS/CHGDTAARA DTAARA(DPRIGGE/CHAR1 (1 5)) VALUE('AB''''E') - // Notice that we need to specify (1 5) rather than (1 7) - - int searchIndex = 0, foundIndex; - while(searchIndex < data.length()) - { - foundIndex = data.indexOf("''", searchIndex); - if (foundIndex != -1) - { - ++countSingleQuotePairs; - searchIndex = foundIndex+2; // Skip search past this double-quote pair - } - else searchIndex = data.length(); - } - // End Changes ------------------------------------------- @A2A - - //wrtcmd = "QSYS/CHGDTAARA DTAARA(" + library_ + "/" + name_ + " (" + (dataAreaOffset+1) + " " + dataLength + ")" + ") VALUE('" + data + "')"; //@D1c - part1 = converter_.stringToByteArray("QSYS/CHGDTAARA DTAARA(" + library_ + "/" + name_ + " (" + (dataAreaOffset+1) + " " + (dataLength-countSingleQuotePairs)+ ")" + ") VALUE('"); //@D2C //@A2A - break; - case DataArea.LOCAL_DATA_AREA: - //wrtcmd = "QSYS/CHGDTAARA DTAARA(*LDA (" + (dataAreaOffset+1) + " " + dataLength + ")) VALUE('" + data + "')"; //@D1c - part1 = converter_.stringToByteArray("QSYS/CHGDTAARA DTAARA(*LDA (" + (dataAreaOffset+1) + " " + dataLength + ")) VALUE('"); //@D2C - break; - default: - Trace.log(Trace.ERROR, "Programming error: write(String,int) was called as dataAreaType=" + dataAreaType_); - throw new InternalErrorException (InternalErrorException.UNKNOWN, dataAreaType_); - } - - // Allocate the proper byte array size for the command. - wrtcmd = new byte[part1.length + dataLength + part3.length]; //@D2A - - // Copy each part of the chgdtaara command bytes into the end byte array. - System.arraycopy(part1,0,wrtcmd,0,part1.length); //@D2A - System.arraycopy(part2,0,wrtcmd,part1.length,dataLength); //@D2A - System.arraycopy(part3,0,wrtcmd,part1.length+dataLength,part3.length); //@D2A - - if (rmtCmd_ == null) { - setupRemoteCommand(); - } - - if (Trace.isTraceOn()) //@A2A - { //@A2A - String wrtcmd2 = converter_.byteArrayToString(wrtcmd); //@A2A - Trace.log(Trace.DIAGNOSTIC, "wrtcmd2=["+wrtcmd2+"]"); //@A2A - } //@A2A - // Run the command as bytes - boolean result = rmtCmd_.runCommand(wrtcmd, "QSYS/CHGDTAARA"); // not threadsafe - messageList_ = rmtCmd_.getMessageList(); //$D2A - - if(!result) //$D2C - { - // Throw AS400MessageList - processExceptions(getMessages()); - } - } - - /** - Writes the BigDecimal data value to the decimal data area. - @param data The decimal data to be written. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void write(BigDecimal data) throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, ServerStartupException, UnknownHostException - { - // Assume the argument has been validated by the public class. - if (dataAreaType_ != DataArea.DECIMAL_DATA_AREA) - { - Trace.log (Trace.ERROR, "Programming error: write(BigDecimal) was called when dataAreaType=" + dataAreaType_); - throw new InternalErrorException (InternalErrorException.UNKNOWN, dataAreaType_); - } - - // Build the string for the write. - String wrtcmd = "QSYS/CHGDTAARA DTAARA(" + library_ + "/" + name_ + ") VALUE(" + data.toString() + ")"; - - // Run the command - if(!run(wrtcmd)) // CHGDTAARA is known to be not threadsafe - { - // Throw AS400MessageList - processExceptions(getMessages()); - } - } - - /** - Writes the boolean value in data to the logical data area. - @param data The data to be written. - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void write(boolean data) throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, ServerStartupException, UnknownHostException - { - if (dataAreaType_ != DataArea.LOGICAL_DATA_AREA) - { - Trace.log(Trace.ERROR, "Programming error: write(boolean) was called when dataAreaType=" + dataAreaType_); - throw new InternalErrorException (InternalErrorException.UNKNOWN, dataAreaType_); - } - - // Build the string for the write. - String wrtcmd = "QSYS/CHGDTAARA DTAARA(" + library_ + "/" + name_ + ") VALUE('" + (data ? "1" : "0") + "')"; - - // Run the command - if(!run(wrtcmd)) // CHGDTAARA is known to be not threadsafe - { - // Throw AS400MessageList - processExceptions(getMessages()); - } - } - - - /** - Writes the data to the data area. - It writes the specified bytes to the data area, at offset dataAreaOffset. - The first byte in the data area is at offset 0. - @param data The data to be written. - @param dataBufferOffset The starting offset in data. - @param dataAreaOffset The offset in the data area at which to start writing. (0-based) - @param dataLength The number of bytes to write. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void write(byte[] data, int dataBufferOffset, int dataAreaOffset, int dataLength) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - // Assume the arguments have been validated by the public class. - - // Build the string for the write. - String dataAreaIdentifier = null; - switch (dataAreaType_) - { - case DataArea.CHARACTER_DATA_AREA: - dataAreaIdentifier = library_ + "/" + name_; - break; - case DataArea.LOCAL_DATA_AREA: - dataAreaIdentifier = "*LDA"; - break; - default: - Trace.log(Trace.ERROR, "Programming error: write(byte[],int,int,int) was called when dataAreaType=" + dataAreaType_); - throw new InternalErrorException (InternalErrorException.UNKNOWN, dataAreaType_); - } - String wrtcmd = "QSYS/CHGDTAARA DTAARA(" + dataAreaIdentifier + - " (" + (dataAreaOffset+1) + " " + dataLength + "))" + - " VALUE(X'" + BinaryConverter.bytesToString(data, dataBufferOffset, dataLength) + "')"; - - if (rmtCmd_ == null) { - setupRemoteCommand(); - } - - if (Trace.isTraceOn()) { - Trace.log(Trace.DIAGNOSTIC, "wrtcmd=["+wrtcmd+"]"); - } - // Run the command as bytes - boolean result = rmtCmd_.runCommand(wrtcmd); // CHGDTAARA is not threadsafe - messageList_ = rmtCmd_.getMessageList(); - - if(!result) - { - // Throw AS400MessageList - processExceptions(getMessages()); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DataAreaListener.java b/cvsroot/src/com/ibm/as400/access/DataAreaListener.java deleted file mode 100644 index 71cd0a694..000000000 --- a/cvsroot/src/com/ibm/as400/access/DataAreaListener.java +++ /dev/null @@ -1,52 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataAreaListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - The DataAreaListener interface provides - an interface for receiving DataAreaEvents. -**/ - -public interface DataAreaListener extends java.util.EventListener -{ - /** - Invoked when a clear has been performed. - @param event The data area event. - **/ - public void cleared(DataAreaEvent event); - - /** - Invoked when a create has been performed. - @param event The data area event. - **/ - public void created(DataAreaEvent event); - - /** - Invoked when a delete has been performed. - @param event The data area event. - **/ - public void deleted(DataAreaEvent event); - - /** - Invoked when a read has been performed. - @param event The data area event. - **/ - public void read(DataAreaEvent event); - - /** - Invoked when a write has been performed. - @param event The data area event. - **/ - public void written(DataAreaEvent event); -} diff --git a/cvsroot/src/com/ibm/as400/access/DataQueue.java b/cvsroot/src/com/ibm/as400/access/DataQueue.java deleted file mode 100644 index 3606e35c0..000000000 --- a/cvsroot/src/com/ibm/as400/access/DataQueue.java +++ /dev/null @@ -1,323 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataQueue.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - The DataQueue class represents an IBM i sequential data queue object. - **/ -public class DataQueue extends BaseDataQueue -{ - static final long serialVersionUID = 4L; - - /** - Constructs a DataQueue object. The system and path properties must be set before using any method requiring a connection to the system. - **/ - public DataQueue() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing DataQueue object."); - } - - /** - Constructs a DataQueue object. - @param system The system object representing the system on which the data queue exists. - @param path The fully qualified integrated file system path name of the data queue. The library and queue name must each be 10 characters or less. - **/ - public DataQueue(AS400 system, String path) - { - super(system, path); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing DataQueue object."); - } - - /** - Creates a sequential data queue on the system. The queue will be created with the attributes provided. - @param attributes The attributes of the data queue to be created. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectAlreadyExistsException If the object already exists on the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void create(DataQueueAttributes attributes) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectAlreadyExistsException, ObjectDoesNotExistException - { - if (attributes.getKeyLength() > 0) - { - Trace.log(Trace.ERROR, "Using DataQueue for keyed data queue."); - throw new IllegalObjectTypeException(IllegalObjectTypeException.DATA_QUEUE_KEYED); - } - create(attributes.getEntryLength(), attributes.getAuthority(), attributes.isSaveSenderInfo(), attributes.isFIFO(), attributes.isForceToAuxiliaryStorage(), attributes.getDescription()); - } - - /** - Creates a sequential data queue on the system. The queue will be created with the following attributes: authority = *LIBCRTAUT, saveSenderInformation = false, FIFO = true, forceToAuxiliaryStorage = false, description = (50 blanks). - @param maxEntryLength The maximum number of bytes per data queue entry. Valid values are 1-64512. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @exception ObjectAlreadyExistsException If the object already exists on the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void create(int maxEntryLength) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectAlreadyExistsException, ObjectDoesNotExistException - { - create(maxEntryLength, "*LIBCRTAUT", false, true, false, ""); - } - - /** - Creates a sequential data queue on the system. - @param maxEntryLength The maximum number of bytes per data queue entry. Valid values are 1-64512. - @param authority The public authority for the data queue. Valid values are *ALL, *CHANGE, *EXCLUDE, *USE, *LIBCRTAUT. - @param saveSenderInformation true if entry origin information will be saved; false otherwise. - @param FIFO true if queue entries are processed in FIFO order, false if queue entries are processed in LIFO order. - @param forceToAuxiliaryStorage true if writes are forced to storage before return; false otherwise. - @param description The text description. This string must be 50 characters or less. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @exception ObjectAlreadyExistsException If the object already exists on the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void create(int maxEntryLength, String authority, boolean saveSenderInformation, boolean FIFO, boolean forceToAuxiliaryStorage, String description) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectAlreadyExistsException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Creating data queue."); - - // Check parmameters. - if (maxEntryLength < 1 || maxEntryLength > 64512) - { - Trace.log(Trace.ERROR, "Value of parameter 'maxEntryLength' is not valid:", maxEntryLength); - throw new ExtendedIllegalArgumentException("maxEntryLength (" + maxEntryLength + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (authority == null) - { - Trace.log(Trace.ERROR, "Parameter 'authority' is null."); - throw new NullPointerException("authority"); - } - authority = authority.toUpperCase().trim(); - if (!authority.equals("*LIBCRTAUT") && !authority.equals("*ALL") && !authority.equals("*CHANGE") && !authority.equals("*EXCLUDE") && !authority.equals("*USE")) - { - Trace.log(Trace.ERROR, "Value of parameter 'authority' is not valid: " + authority); - throw new ExtendedIllegalArgumentException("authority (" + authority + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (description == null) - { - Trace.log(Trace.ERROR, "Parameter 'description' is null."); - throw new NullPointerException("description"); - } - if (description.length() > 50) - { - Trace.log(Trace.ERROR, "Length of parameter 'description' is not valid: " + description); - throw new ExtendedIllegalArgumentException("description (" + description + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - // Start a socket connection to the system. - chooseImpl(); - - // Don't commit to the change in attributes until the create completes. - attributesRetrieved_ = false; - - // Save attribute values. - maxEntryLength_ = maxEntryLength; - saveSenderInformation_ = saveSenderInformation; - FIFO_ = FIFO; - forceToAuxiliaryStorage_ = forceToAuxiliaryStorage; - description_ = description; - - // Send create request. - impl_.create(maxEntryLength, authority, saveSenderInformation, FIFO, 0, forceToAuxiliaryStorage, description); - - if (objectListeners_ != null) fireObjectEvent(ObjectEvent.OBJECT_CREATED); - // Attributes are complete and official. - attributesRetrieved_ = true; - } - - /** - Reads an entry from the data queue without removing it from the queue. This method will not wait for entries if none are on the queue. - @return The entry read from the queue. If no entries were available, null is returned. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public DataQueueEntry peek() throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - return peek(0); - } - - /** - Reads an entry from the data queue without removing it from the queue. - @param wait The number of seconds to wait if the queue contains no entries. Negative one (-1) means to wait until an entry is available. - @return The entry read from the queue. If no entries were available, null is returned. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public DataQueueEntry peek(int wait) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Peeking data queue."); - - // Check parmameters. - if (wait < -1) - { - Trace.log(Trace.ERROR, "Value of parameter 'wait' is not valid:", wait); - throw new ExtendedIllegalArgumentException("wait (" + wait + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - open(); - // Send request. - DQReceiveRecord record = impl_.read(null, wait, true, null); - if (record == null) return null; - - DataQueueEntry entry = new DataQueueEntry(this, record.data_, record.senderInformation_); - if (dataQueueListeners_ != null) fireDataQueueEvent(DataQueueEvent.DQ_PEEKED); - return entry; - } - - /** - Reads an entry from the data queue and removes it from the queue. This method will not wait for entries if none are on the queue. - @return The entry read from the queue. If no entries were available, null is returned. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public DataQueueEntry read() throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - return read(0); - } - - /** - Reads an entry from the data queue and removes it from the queue. - @param wait The number of seconds to wait if the queue contains no entries. Negative one (-1) means to wait until an entry is available. - @return The entry read from the queue. If no entries were available, null is returned. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public DataQueueEntry read(int wait) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Reading data queue."); - - // Check parmameters. - if (wait < -1) - { - Trace.log(Trace.ERROR, "Value of parameter 'wait' is not valid:", wait); - throw new ExtendedIllegalArgumentException("wait (" + wait + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - open(); - // Send request. - DQReceiveRecord record = impl_.read(null, wait, false, null); - if (record == null) return null; - - DataQueueEntry entry = new DataQueueEntry(this, record.data_, record.senderInformation_); - if (dataQueueListeners_ != null) fireDataQueueEvent(DataQueueEvent.DQ_READ); - return entry; - } - - // Retrieves the attributes of the data queue. This method assumes that the connection to the system has been started. It must only be called by open(). - void retrieveAttributes() throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving data queue attributes."); - // Send retrieve attribute request. - DQQueryRecord record = impl_.retrieveAttributes(false); - - maxEntryLength_ = record.maxEntryLength_; - saveSenderInformation_ = record.saveSenderInformation_; - FIFO_ = record.FIFO_; - forceToAuxiliaryStorage_ = record.forceToAuxiliaryStorage_; - description_ = record.description_; - - attributesRetrieved_ = true; - } - - /** - Returns the String representation of this data queue object. - @return The String representation of this data queue object. - **/ - public String toString() - { - return "DataQueue " + super.toString(); - } - - /** - Writes an entry to the data queue. - @param data The array of bytes to write to the queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void write(byte[] data) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Writing data queue."); - - // Check parmameters. - if (data == null) - { - Trace.log(Trace.ERROR, "Parameter 'data' is null."); - throw new NullPointerException("data"); - } - if (data.length > 64512) - { - Trace.log(Trace.ERROR, "Length of parameter 'data' is not valid:", data.length); - throw new ExtendedIllegalArgumentException("data.length (" + data.length + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - open(); - // Send write request. - impl_.write(null, data); - if (dataQueueListeners_ != null) fireDataQueueEvent(DataQueueEvent.DQ_WRITTEN); - } - - /** - Writes a string entry to the data queue. - @param data The string to write to the queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void write(String data) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - // Check parmameters. - if (data == null) - { - Trace.log(Trace.ERROR, "Parameter 'data' is null."); - throw new NullPointerException("data"); - } - - write(stringToByteArray(data)); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DataQueue16.gif b/cvsroot/src/com/ibm/as400/access/DataQueue16.gif deleted file mode 100644 index 3e96d17b0..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/DataQueue16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/DataQueue32.gif b/cvsroot/src/com/ibm/as400/access/DataQueue32.gif deleted file mode 100644 index 89f0230ef..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/DataQueue32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/DataQueueAttributes.java b/cvsroot/src/com/ibm/as400/access/DataQueueAttributes.java deleted file mode 100644 index cb5a4f7a7..000000000 --- a/cvsroot/src/com/ibm/as400/access/DataQueueAttributes.java +++ /dev/null @@ -1,447 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataQueueAttributes.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.Serializable; - -/** - The DataQueueAttributes class represents a data queue attributes object. - **/ -public class DataQueueAttributes implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - // The public authority of the data queue. - private String authority_ = "*LIBCRTAUT"; - //The text description for the data queue. - private String description_ = ""; - //The maximum length of each entry on the data queue. - private int entryLength_ = 1000; - //If entries on the queue are read in LIFO or FIFO order. - private boolean FIFO_ = true; // False = LIFO. - //Whether data is forced to auxillary storage. - private boolean forceToAuxiliaryStorage_ = false; - // The byte length of the keys in the data queue. - private int keyLength_ = 0; - //Whether information about the origin of each entry is saved. - private boolean saveSenderInfo_ = false; - - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_ = null; // Set on first add. - // List of vetoable change event bean listeners. - private transient VetoableChangeSupport vetoableChangeListeners_ = null; // Set on first add. - - /** - Adds a listener to be notified when the value of any bound property changes. - @param listener The listener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Adds a listener to be notified when the value of any constrained property changes. - @param listener The listener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - } - - /** - Returns the public authority of the data queue. - @return The public authority of the data queue. Valid values are *ALL, *CHANGE, *EXCLUDE, *USE, *LIBCRTAUT. - **/ - public String getAuthority() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting authority: " + authority_); - return authority_; - } - - /** - Returns the text description of the data queue. - @return The text description of the data queue. - **/ - public String getDescription() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting description: " + description_); - return description_; - } - - /** - Returns the maximum entry length of the data queue. - @return The maximum entry length of the data queue. - **/ - public int getEntryLength() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting max entry length:", entryLength_); - return entryLength_; - } - - /** - Returns the byte length of the keys of the data queue. - @return The byte length of the keys of the data queue. - **/ - public int getKeyLength() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting key length:", keyLength_); - return keyLength_; - } - - /** - Returns a value that indicates if entries are read in FIFO order. Returns true if entries are read off the data queue in FIFO order. Returns false if entries are read off the data queue in LIFO order. - @return true if entries are read off the data queue in FIFO order; false otherwise. - **/ - public boolean isFIFO() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if is FIFO:", FIFO_); - return FIFO_; - } - - /** - Returns a value that indicates if entries are forced to auxiliary storage. If true, entries are immediately written to permanent storage. If false, written entries may be kept in memory and could be lost in the case of a power outage. - @return true if entries are immediately written to permanent storage; false otherwise. - **/ - public boolean isForceToAuxiliaryStorage() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if force to auxiliary storage:", forceToAuxiliaryStorage_); - return forceToAuxiliaryStorage_; - } - - /** - Returns whether sender information is stored with each data queue entry. - @return true if sender information is saved; false otherwise. - **/ - public boolean isSaveSenderInfo() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if save sender information:", saveSenderInfo_); - return saveSenderInfo_; - } - - /** - Removes a property change listener. - @param listener The listener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes a vetoable change listener. - @param listener The listener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - /** - Sets the public authority of the data queue. - @param authority The public authority of the data queue. Valid values are *ALL, *CHANGE, *EXCLUDE, *USE, *LIBCRTAUT. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setAuthority(String authority) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting authority: " + authority); - if (authority == null) - { - Trace.log(Trace.ERROR, "Parameter 'authority' is null."); - throw new NullPointerException("authority"); - } - authority = authority.toUpperCase().trim(); - if (!(authority.equals("*ALL") || authority.equals("*CHANGE") || authority.equals("*EXCLUDE") || authority.equals("*USE") || authority.equals("*LIBCRTAUT"))) - { - Trace.log(Trace.ERROR, "Value of parameter 'authority' is not valid: " + authority); - throw new ExtendedIllegalArgumentException("authority (" + authority + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - authority_ = authority; - } - else - { - String oldValue = authority_; - String newValue = authority; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("authority", oldValue, newValue); - } - authority_ = authority; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("authority", oldValue, newValue); - } - } - } - - /** - Sets the text description of the data queue. - @param description The text description. This string must be 50 characters or less. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setDescription(String description) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting description: " + description); - if (description == null) - { - Trace.log(Trace.ERROR, "Parameter 'description' is null."); - throw new NullPointerException("description"); - } - if (description.length() > 50) - { - Trace.log(Trace.ERROR, "Length of parameter 'description' is not valid: " + description); - throw new ExtendedIllegalArgumentException("description (" + description + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - description_ = description; - } - else - { - String oldValue = description_; - String newValue = description; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("description", oldValue, newValue); - } - description_ = description; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("description", oldValue, newValue); - } - } - } - - /** - Sets the maximum number of bytes per data queue entry. - @param entryLength The maximum number of bytes per data queue entry. Valid values are 1-64512. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setEntryLength(int entryLength) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting max entry length:", entryLength); - if (entryLength < 1 || entryLength > 64512) - { - Trace.log(Trace.ERROR, "Value of parameter 'entryLength' is not valid:", entryLength); - throw new ExtendedIllegalArgumentException("entryLength (" + entryLength + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - entryLength_ = entryLength; - } - else - { - Integer oldValue = new Integer(entryLength_); - Integer newValue = new Integer(entryLength); - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("entryLength", oldValue, newValue); - } - entryLength_ = entryLength; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("entryLength", oldValue, newValue); - } - } - } - - /** - Sets a value that indicates if entries are read in FIFO order. If true, entries are read off the data queue in FIFO order. If false, entries are read off the data queue in LIFO order. - @param FIFO true if queue entries are processed in FIFO order; false otherwise. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setFIFO(boolean FIFO) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting FIFO:", FIFO); - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - FIFO_ = FIFO; - } - else - { - Boolean oldValue = new Boolean(FIFO_); - Boolean newValue = new Boolean(FIFO); - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("FIFO", oldValue, newValue); - } - FIFO_ = FIFO; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("FIFO", oldValue, newValue); - } - } - } - - /** - Sets a value that indicates if entries are forced to auxiliary storage. If true, entries are immediately written to permanent storage. If false, written entries may be kept in memory and could be lost in the case of a power outage. - @param forceToAuxiliaryStorage true if writes are forced to storage before return; false otherwise. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setForceToAuxiliaryStorage(boolean forceToAuxiliaryStorage) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting force to auxiliary storage:", forceToAuxiliaryStorage); - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - forceToAuxiliaryStorage_ = forceToAuxiliaryStorage; - } - else - { - Boolean oldValue = new Boolean(forceToAuxiliaryStorage_); - Boolean newValue = new Boolean(forceToAuxiliaryStorage); - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("forceToAuxiliaryStorage", oldValue, newValue); - } - forceToAuxiliaryStorage_ = forceToAuxiliaryStorage; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("forceToAuxiliaryStorage", oldValue, newValue); - } - } - } - - /** - Sets the number of bytes per data queue key. - @param keyLength The number of bytes per data queue key. Valid values are 1-256. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setKeyLength(int keyLength) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting key length:", keyLength); - - if (keyLength < 1 || keyLength > 256) - { - Trace.log(Trace.ERROR, "Value of parameter 'keyLength' is not valid:", keyLength); - throw new ExtendedIllegalArgumentException("keyLength (" + keyLength + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - keyLength_ = keyLength; - } - else - { - Integer oldValue = new Integer(keyLength_); - Integer newValue = new Integer(keyLength); - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("keyLength", oldValue, newValue); - } - keyLength_ = keyLength; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("keyLength", oldValue, newValue); - } - } - } - - /** - Sets whether sender information is stored with each data queue entry. - @param saveSenderInfo true if sender information is saved; false otherwise. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setSaveSenderInfo(boolean saveSenderInfo) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting save sender information:", saveSenderInfo); - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - saveSenderInfo_ = saveSenderInfo; - } - else - { - Boolean oldValue = new Boolean(saveSenderInfo_); - Boolean newValue = new Boolean(saveSenderInfo); - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("saveSenderInfo", oldValue, newValue); - } - saveSenderInfo_ = saveSenderInfo; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("saveSenderInfo", oldValue, newValue); - } - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DataQueueAttributes16.gif b/cvsroot/src/com/ibm/as400/access/DataQueueAttributes16.gif deleted file mode 100644 index 052817fbf..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/DataQueueAttributes16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/DataQueueAttributes32.gif b/cvsroot/src/com/ibm/as400/access/DataQueueAttributes32.gif deleted file mode 100644 index 878af57ba..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/DataQueueAttributes32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/DataQueueAttributesBeanInfo.java b/cvsroot/src/com/ibm/as400/access/DataQueueAttributesBeanInfo.java deleted file mode 100644 index 045751757..000000000 --- a/cvsroot/src/com/ibm/as400/access/DataQueueAttributesBeanInfo.java +++ /dev/null @@ -1,170 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataQueueAttributesBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - The DataQueueAttributesBeanInfo class provides bean information for the DataQueueAttributes class. - **/ -public class DataQueueAttributesBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class BEAN_CLASS = DataQueueAttributes.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - - eventSetDescriptors = new EventSetDescriptor[] { propertyChange, vetoableChange }; - - PropertyDescriptor entryLength = new PropertyDescriptor("entryLength", BEAN_CLASS); - entryLength.setBound(true); - entryLength.setConstrained(true); - entryLength.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_ENTRYLENGTH")); - entryLength.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_ENTRYLENGTH")); - - PropertyDescriptor authority = new PropertyDescriptor("authority", BEAN_CLASS); - authority.setBound(true); - authority.setConstrained(true); - authority.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_AUTHORITY")); - authority.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_AUTHORITY")); - authority.setPropertyEditorClass(DQAttsAuthorityEditor.class); - - PropertyDescriptor saveSenderInfo = new PropertyDescriptor("saveSenderInfo", BEAN_CLASS); - saveSenderInfo.setBound(true); - saveSenderInfo.setConstrained(true); - saveSenderInfo.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SAVESENDERINFO")); - saveSenderInfo.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SAVESENDERINFO")); - - PropertyDescriptor FIFO = new PropertyDescriptor("FIFO", BEAN_CLASS); - FIFO.setBound(true); - FIFO.setConstrained(true); - FIFO.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_FIFO")); - FIFO.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_FIFO")); - - PropertyDescriptor forceToAuxiliaryStorage = new PropertyDescriptor("forceToAuxiliaryStorage", BEAN_CLASS); - forceToAuxiliaryStorage.setBound(true); - forceToAuxiliaryStorage.setConstrained(true); - forceToAuxiliaryStorage.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_FORCETOAUX")); - forceToAuxiliaryStorage.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_FORCETOAUX")); - - PropertyDescriptor description = new PropertyDescriptor("description", BEAN_CLASS); - description.setBound(true); - description.setConstrained(true); - description.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_DESCRIPTION")); - description.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_DESCRIPTION")); - - PropertyDescriptor keyLength = new PropertyDescriptor("keyLength", BEAN_CLASS); - keyLength.setBound(true); - keyLength.setConstrained(true); - keyLength.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_KEYLENGTH")); - keyLength.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_KEYLENGTH")); - - propertyDescriptors = new PropertyDescriptor[] { entryLength, authority, saveSenderInfo, FIFO, forceToAuxiliaryStorage, description, keyLength }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return Zero (0), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "propertyChange" event. - return 0; - } - - /** - Returns the index of the default property. - @return Zero (0), the index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // The index for the "entryLength" property - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("DataQueueAttributes16.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("DataQueueAttributes32.gif"); - } - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DataQueueBeanInfo.java b/cvsroot/src/com/ibm/as400/access/DataQueueBeanInfo.java deleted file mode 100644 index 221dcb645..000000000 --- a/cvsroot/src/com/ibm/as400/access/DataQueueBeanInfo.java +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataQueueBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; - -/** - The DataQueueBeanInfo class provides bean information for the DataQueue class. - **/ -public class DataQueueBeanInfo extends BaseDataQueueBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class BEAN_CLASS = DataQueue.class; - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("DataQueue16.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("DataQueue32.gif"); - } - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DataQueueEntry.java b/cvsroot/src/com/ibm/as400/access/DataQueueEntry.java deleted file mode 100644 index 0d49e3f07..000000000 --- a/cvsroot/src/com/ibm/as400/access/DataQueueEntry.java +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataQueueEntry.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; - -/** - The DataQueueEntry class represents an entry on a data queue. - **/ -public class DataQueueEntry -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Source data queue, used for String conversion. - BaseDataQueue dq_; - // The data for this entry. - byte[] data_; - // Sender info associated with this entry. - String senderInformation_ = ""; - - // Constructs a DataQueueEntry object. - // @param data The data of the entry read. - // @param senderInformation The sender information of the entry read. This may be null. - DataQueueEntry(BaseDataQueue dq, byte[] data, String senderInformation) - { - super(); - dq_ = dq; - data_ = data; - if (senderInformation != null) senderInformation_ = senderInformation; - } - - /** - Returns the data for this data queue entry. - @return The data for this data queue entry. - **/ - public byte[] getData() - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Getting data queue entry data."); - return data_; - } - - /** - Returns the data for this data queue entry as a string. - @return The data for this data queue entry as a string. - @exception UnsupportedEncodingException If the ccsid is not supported. - **/ - public String getString() throws UnsupportedEncodingException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Getting data queue entry data as String."); - return dq_.byteArrayToString(data_); - } - - /** - Returns the sender information for this data queue entry. If sender information is not available for this entry, an empty String ("") is returned. - @return The data for this data queue entry. - **/ - public String getSenderInformation() - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Getting data queue sender information."); - return senderInformation_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DataQueueEvent.java b/cvsroot/src/com/ibm/as400/access/DataQueueEvent.java deleted file mode 100644 index 6a61292e8..000000000 --- a/cvsroot/src/com/ibm/as400/access/DataQueueEvent.java +++ /dev/null @@ -1,76 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataQueueEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.EventObject; - -/** - The DataQueueEvent class represents a DataQueue event. - **/ -public class DataQueueEvent extends EventObject -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - /** - The DataQueue clear event ID. This event is delivered when a clear has been performed. - **/ - public static final int DQ_CLEARED = 0; - - /** - The DataQueue peek event ID. This event is delivered when a peek has been performed. - **/ - public static final int DQ_PEEKED = 1; - - /** - The DataQueue read event ID. This event is delivered when a read has been performed. - **/ - public static final int DQ_READ = 2; - - /** - The DataQueue write event ID. This event is delivered when a write has been performed. - **/ - public static final int DQ_WRITTEN = 3; - - // Event identifier. - private int id_; - - /** - Constructs a DataQueueEvent object. It uses the specified source and ID. - @param source The object where the event originated. - @param id The event identifier. - **/ - public DataQueueEvent(Object source, int id) - { - super(source); - - if (id < DQ_CLEARED || id > DQ_WRITTEN) - { - Trace.log(Trace.ERROR, "Value of parameter 'id' is not valid:", id); - throw new ExtendedIllegalArgumentException("id (" + id + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - id_ = id; - } - - /** - Returns the identifier for this event. - @return The identifier for this event. - **/ - public int getID() - { - return id_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DataQueueListener.java b/cvsroot/src/com/ibm/as400/access/DataQueueListener.java deleted file mode 100644 index 07f52b394..000000000 --- a/cvsroot/src/com/ibm/as400/access/DataQueueListener.java +++ /dev/null @@ -1,48 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataQueueListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.EventListener; - -/** - Provides an interface for receiving DataQueue events. -

          Note: Only actions performed via the Java object that implements this interface will fire events to listeners. - Data queue accesses performed by other means (such as by calling system APIs or CL commands) do not fire events to listeners. - **/ -public interface DataQueueListener extends EventListener -{ - /** - Invoked when a clear has been performed. - @param event The DataQueue event. - **/ - public void cleared(DataQueueEvent event); - - /** - Invoked when a peek has been performed. - @param event The DataQueue event. - **/ - public void peeked(DataQueueEvent event); - - /** - Invoked when a read has been performed. - @param event The DataQueue event. - **/ - public void read(DataQueueEvent event); - - /** - Invoked when a write has been performed. - @param event The DataQueue event. - **/ - public void written(DataQueueEvent event); -} diff --git a/cvsroot/src/com/ibm/as400/access/DataStream.java b/cvsroot/src/com/ibm/as400/access/DataStream.java deleted file mode 100644 index 547927437..000000000 --- a/cvsroot/src/com/ibm/as400/access/DataStream.java +++ /dev/null @@ -1,320 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.text.SimpleDateFormat; -import java.util.Date; - -// Base class for data streams. Provides methods to access common data stream parts. -abstract class DataStream -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - protected static ConverterImplRemote converter_; // Character set conversion object. - protected int connectionID_; - static ConverterImplRemote getDefaultConverter() - { - return converter_; - } - static void setDefaultConverter(ConverterImplRemote converter) - { - converter_ = converter; - } - - // Read the number of bytes asked for and loop until either that many bytes have been read or until we hit the end of file. - // @param in Inputstream to read from. - // @param buf Where to read the data into. - // @param offset Offset within buf array to start reading into. - // @param length How many bytes to read. - // @param connectionID The connection ID. - // @exception IOException from Inputstream.read() operation. - // @returns Number of bytes read. - static final int readFromStream(InputStream in, byte[] buf, int offset, int length, int connectionID) throws IOException //@P0C - { - boolean endOfFile = false; - int bytesRead = 0; - while ((bytesRead < length) && !endOfFile) - { - int temp = in.read(buf, offset + bytesRead, length - bytesRead); - if (temp == -1) - { - endOfFile = true; - } - else - { - bytesRead += temp; - } - - } - - if (Trace.traceOn_) Trace.log(Trace.DATASTREAM, "Data stream data received (connID="+connectionID+") ...", buf, offset, bytesRead); //@P0C - - return bytesRead; - } - - - // readFromStreamDebug is used to debugging problems with readFromStream - // left here so that it can be easily reused @A7A - static boolean traceOpened = false; - - static final int readFromStreamDebug(InputStream in, byte[] buf, int offset, int length, int connectionID) throws IOException //@P0C - { - long lastReadTime = System.currentTimeMillis(); - boolean endOfFile = false; - int bytesRead = 0; - while ((bytesRead < length) && !endOfFile) - { - int availableCount = in.available(); - if ( availableCount > 0) { - int temp = in.read(buf, offset + bytesRead, length - bytesRead); - if (temp == -1) { - endOfFile = true; - } else { - bytesRead += temp; - } - lastReadTime = System.currentTimeMillis(); - } else { - if (System.currentTimeMillis() > lastReadTime+120000) { - if (! traceOpened) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmm"); - - Trace.setFileName("/tmp/toolboxTrace."+sdf.format(new Date())+".txt"); - traceOpened=true; - } - boolean traceTurnedOn = false; - if (!Trace.traceOn_) { - traceTurnedOn = true; - Trace.setTraceAllOn(true); - Trace.setTraceOn(true); - } - // Trace.log(Trace.DATASTREAM, "Debug0601: Waited more than 120 seconds to read "+length+" bytes. Current buffer with header is "); - // Trace.log(Trace.DATASTREAM, "Debug0601: Data stream data received (connID="+connectionID+") ...", buf, 0, offset + bytesRead); //@P0C - if (traceTurnedOn) { - Trace.setTraceAllOn(false); - Trace.setTraceOn(false); - } - } - try { - Thread.sleep(50); - } catch (Exception e) { - - } - } - } - - if (Trace.traceOn_) Trace.log(Trace.DATASTREAM, "Data stream data received (connID="+connectionID+") ...", buf, offset, bytesRead); //@P0C - - return bytesRead; - } - - - // Read the number of bytes asked for and loop until either that many bytes have been read or until we hit the end of file. - // @param in Inputstream to read from. - // @param buf Where to read the data into. - // @param offset Offset within buf array to start reading into. - // @param length How many bytes to read. - // @exception IOException from Inputstream.read() operation. - // @returns Number of bytes read. - final int readFromStream(InputStream in, byte[] buf, int offset, int length) throws IOException - { - return readFromStream(in, buf, offset, length, connectionID_); - } - - final int readFromStreamDebug(InputStream in, byte[] buf, int offset, int length) throws IOException - { - return readFromStreamDebug(in, buf, offset, length, connectionID_); - } - - - protected AS400ImplRemote system_; - - protected byte[] data_; // Contains complete data stream data. - - // Length of the header portion of the data stream. This should be set by sub-classes of this class during construction via calls to super. - protected int headerLength_; - - - // Constructs a data stream object with data of length headerLength initialized to hex 0's. - // @param headerLength Length of the header for the data stream. - DataStream(int headerLength) - { - // Initialize instance data. - headerLength_ = headerLength; - data_ = new byte[headerLength_]; - - // Set the total length field of the data stream. - setLength(headerLength_); - } - - // Constructs a data stream object with data. It is expected that data is properly formatted for the data stream (header information and remaining data stream information). - // @param headerLength Length of the header for the data stream. - // @param data A byte array to be used for this data stream. The size of the byte array is the number of bytes to be used for this data stream. - DataStream(int headerLength, byte[] data) - { - headerLength_ = headerLength; - data_ = data; - } - - // Override Object.equals so that this object is "equal" to another if they are of the same base type and their hash codes are the same. - // @param obj The object with which to compare this object. - // @return true is the objects are equal, false otherwise. - public boolean equals(Object obj) - { - if (obj instanceof DataStream) - { - return (hashCode() == ((DataStream)obj).hashCode()); - } - return false; - } - - // Retrieve the request/reply correlation for this data stream. - // @return The request correlation number. - abstract int getCorrelation(); - - // Retrieve the length of the data stream. - // @return The length of the data stream. - abstract int getLength(); - - // Get a new instance of this class. The code for this method should be provided by the subclasses. In the event that a sub-class does not override this method, null will be returned. - // @return Object representing a clone of this object. - Object getNewDataStream() - { - return null; - } - - // Retrieve the system associated with this object. - // @return Object representing the system. - AS400ImplRemote getSystem() - { - return system_; - } - - // Retrieve data from the data stream as a 16-bit number from the specified offset. - // @param offset Offset in the data stream from which to retrieve. - protected final int get16bit(final int offset) //@P0C - { - //@P0D return BinaryConverter.byteArrayToUnsignedShort(data_, offset); - return ((data_[offset] & 0xFF) << 8) + (data_[offset+1] & 0xFF); //@P0A - } - - // Retrieve data from the data stream as an int from the specified offset. - // @param offset Offset in the data stream from which to retrieve. - protected final int get32bit(final int offset) //@P0C - { - //@P0D return BinaryConverter.byteArrayToInt(data_, offset); - return ((data_[offset] & 0xFF) << 24) + ((data_[offset+1] & 0xFF) << 16) + ((data_[offset+2] & 0xFF) << 8) + (data_[offset+3] & 0xFF); //@P0A - } - - // Retrieve data from the data stream as a long from the specified offset. - // @param offset Offset in the data stream from which to retrieve. - protected final long get64bit(final int offset) //@P0C - { - return BinaryConverter.byteArrayToLong(data_, offset); - } - - // Retrieve the hash code for this data stream. - // @return Hash code for this data stream. - public int hashCode() - { - // This method should be overriden in the sub-class. - return super.hashCode(); - } - - // Read from input stream into this data stream placing the data read into this data stream after the header portion of the data stream. - // @param in InputStream from which to read the data. - // @exception IOException Unable to read from the input stream. - int readAfterHeader(InputStream in) throws IOException - { - // int bytesRead = readFromStreamDebug(in, data_, headerLength_, data_.length - headerLength_); - int bytesRead = readFromStream(in, data_, headerLength_, data_.length - headerLength_); - - if (bytesRead < data_.length - headerLength_) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Failed to read all of the data stream."); //@P0C - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - - return bytesRead; - } - - // Set the connection ID associated with this data stream. - // @param connectionID the connection ID. - void setConnectionID(int connectionID) - { - connectionID_ = connectionID; - } - - // Set the request correlation for this data stream. - // @param correlation The request correlation number. - abstract void setCorrelation(int correlation); - - // Set the length of the data stream. This is the total length of the data stream. - // @param len The length of the data stream. - abstract void setLength(int len); - - // Set the system to be associated with this data stream. - // @param system the object representing the system. - void setSystem(AS400ImplRemote system) - { - system_ = system; - } - - // Set the 2 bytes at the specified offset to the specified value. - // @param i Value to be set. - // @param offset Offset in the data stream at which to place the value. - protected final void set16bit(int i, int offset) //@P0C - { - //@P0D BinaryConverter.unsignedShortToByteArray(i, data_, offset); - data_[offset] = (byte)(i >>> 8); //@P0A - data_[offset+1] = (byte) i; //@P0A - } - - // Set the 4 bytes at the specified offset to the specified value. - // @param i Value to be set. - // @param offset Offset in the data stream at which to place the value. - protected final void set32bit(int i, int offset) //@P0C - { - //@P0D BinaryConverter.intToByteArray(i, data_, offset); - data_[offset] = (byte)(i >>> 24); //@P0A - data_[offset+1] = (byte)(i >>> 16); //@P0A - data_[offset+2] = (byte)(i >>> 8); //@P0A - data_[offset+3] = (byte) i; //@P0A - } - - // Set the 8 bytes at the specified offset to the specified value. - // @param longVal Value to be set. - // @param offset Offset in the data stream at which to place the value. - protected final void set64bit(long longVal, int offset) //@LFS - { - BinaryConverter.longToByteArray(longVal, data_, offset); - } - - // Write the data in this data stream out to the specified OutputStream. - // @param out OutputStream to which to write the data. - // @exception IOException Unable to write to the output stream. - void write(OutputStream out) throws IOException - { - // Synchronization is added around the socket write so that requests from multiple threads that use the same socket won't be garbled. - synchronized(out) - { - out.write(data_); - out.flush(); - } - - if (Trace.traceOn_) Trace.log(Trace.DATASTREAM, "Data stream sent (connID="+connectionID_+") ...", data_); //@P0C - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DataStreamCompression.java b/cvsroot/src/com/ibm/as400/access/DataStreamCompression.java deleted file mode 100644 index b8310d3de..000000000 --- a/cvsroot/src/com/ibm/as400/access/DataStreamCompression.java +++ /dev/null @@ -1,804 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataStreamCompression.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The DataStreamCompression class provides support for RLE (Run Length Encoding) -compression and decompression. When data is compressed using RLE, contiguous -repeating bytes in the datastream are replaced with an RLE record. When data -is decompressed, the RLE record is expanded out into repeating bytes again. - -The format of the output RLE record is as follows: - -

            - -
          • RLE repeater record: - -
              -
            • 1 byte escape -
            • 2 byte repeater -
            • 2 byte repeat count -
            - -
          • RLE escape record: - -
              -
            • 1 byte escape -
            • 1 byte escape -
            - -
          - -During compression, each escape byte will be replaced with an RLE escape -record (two escape bytes). If a byte is not an escape byte, then two bytes -are compared to the next two bytes to determine if the byte pair is repeated. -Compression is done and an RLE repeater record built if the byte pairs are -repeated more than five times (totaling 10 or more bytes repeated). - -For additional information on RLE, see the LIPI documentation for the -Remote Command/Program Server. - -**/ -class DataStreamCompression -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - final static byte DEFAULT_ESCAPE = (byte) 0x1B; - - final static int ESCAPE_SIZE = 1; - final static int REPEATER_SIZE = 2; - final static int COUNT_SIZE = 2; - - final static int REPEATER_RECORD_SIZE = ESCAPE_SIZE + REPEATER_SIZE + COUNT_SIZE; - final static int ESCAPE_RECORD_SIZE = ESCAPE_SIZE + ESCAPE_SIZE; - - - /** - No need to instantiate an object of this class since the class - only contains two static methods. Emphasizing this fact with a - private ctor. - **/ - private DataStreamCompression () - { - } - - - /** - Compress data in the source byte array and write the compressed data - to the returned byte array. - - @param source The source (decompressed) bytes. - @param sourceOffset The offset in the source bytes at which to start - compressing. - @param length The length of the bytes to compress. - @param escape The escape character. Use DEFAULT_ESCAPE. - - @return The compressed bytes or null if the data was not compressed. - If the compressed data length is larger than the uncompressed - length, null is returned. - - **/ - static byte[] compressRLE (byte[] source, - int sourceOffset, - int length, - byte escape) - { - // Validate the input byte array. - if (source == null) - { - throw new NullPointerException("source"); - } - - // Validate the source offset value. - if (sourceOffset >= source.length) - { - throw new ExtendedIllegalArgumentException("sourceOffset", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Validate the length value. - if (length <= 0) - { - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Set flags to indicate which type of tracing, if any, should be done. - boolean traceDiagnostic = Trace.isTraceOn() && Trace.isTraceDiagnosticOn(); - - byte[] destination = new byte[length]; - - int compressedCount = compressRLEInternal(source, sourceOffset, length, destination, 0, escape); // @A1A - if (compressedCount >= 0) - { // @A1A - byte[] returnBytes = new byte[compressedCount]; // @A1A - System.arraycopy(destination, 0, returnBytes, 0, compressedCount); // @A1A - return returnBytes; // @A1A - } // @A1A - else // @A1A - return null; // @A1A - } - - -// @A1A - /** - Compress data in the source byte array and write the compressed data - to the destination byte array. - - @param source The source (decompressed) bytes. - @param sourceOffset The offset in the source bytes at which to start - compressing. - @param length The length of the bytes to compress. - @param destination The destination (compressed) bytes. - @param destinationOffset The offset in the destination bytes at which to - assign compressed bytes. - @param escape The escape character. Use DEFAULT_ESCAPE. - - @return The number of compressed bytes, or -1 if the data was not compressed. - If the compressed data length is larger than the uncompressed length, - null is returned. - **/ - static int compressRLE (byte[] source, - int sourceOffset, - int length, - byte[] destination, - int destinationOffset, - byte escape) - { - // Validate the input byte array. - if (source == null) - { - throw new NullPointerException("source"); - } - - // Validate the source offset value. - if (sourceOffset >= source.length) - { - throw new ExtendedIllegalArgumentException("sourceOffset", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Validate the length value. - if (length <= 0) - { - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Validate the input byte array. - if (destination == null) - { - throw new NullPointerException("destinationOffset"); - } - - // Validate the source offset value. - if (destinationOffset >= destination.length) - { - throw new ExtendedIllegalArgumentException("destinationOffset", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - return compressRLEInternal(source, sourceOffset, length, destination, destinationOffset, escape); - } - - - -// @A1A - Moved from compressRLE(byte[], int, int, byte) - /** - Compress data in the source byte array and write the compressed data - to the destination byte array. - - @param source The source (decompressed) bytes. - @param sourceOffset The offset in the source bytes at which to start - compressing. - @param length The length of the bytes to compress. - @param destination The destination (compressed) bytes. - @param destinationOffset The offset in the destination bytes at which to - assign compressed bytes. - @param escape The escape character. Use DEFAULT_ESCAPE. - - @return The number of compressed bytes, or -1 if the data was not compressed. - If the compressed data length is larger than the uncompressed length, - null is returned. - **/ - private static int compressRLEInternal (byte[] source, - int sourceOffset, - int length, - byte[] destination, - int destinationOffset, - byte escape) - { - // Set flags to indicate which type of tracing, if any, should be done. - boolean traceDiagnostic = Trace.isTraceOn() && Trace.isTraceDiagnosticOn(); - - int returnCount = -1; - - int i = sourceOffset; // Index into source. - int j = destinationOffset; // Index into destination. - - boolean overflow = false; // destination array overflow indicator - - int sourceLength = sourceOffset + length; - int destinationLength = destination.length; - if (traceDiagnostic) - { - Trace.log(Trace.DIAGNOSTIC, "compressRLE() sourceLength: " + sourceLength); - } - - while (i < sourceLength && overflow != true) - { - - // Have an escape byte - if (source[i] == escape) - { - // Bytes fit in destination array - if (j + ESCAPE_RECORD_SIZE <= destinationLength) - { - // Write out an escape record - destination[j++] = escape; - destination[j++] = escape; - ++i; - } - // Destination array overflow - else - { - if (traceDiagnostic) - Trace.log(Trace.DIAGNOSTIC, "Overflow when writing out escape record starting at dest " + j + " ..."); - overflow = true; - } - } - // Have a single, non-escape byte and end of source data. - else if ((i+1) >= sourceLength) - { - // Bytes fit in destination array - if (j < destinationLength) - { - // Write out the last byte. - destination[j++] = source[i++]; - } - // Destination array overflow - else - { - if (traceDiagnostic) - Trace.log(Trace.DIAGNOSTIC, "Overflow when writing out last byte before EOD to dest " + j + " ..."); - overflow = true; - } - } - // Have a single byte, followed by an escape character. - else if (source[i+1] == escape) - { - // Bytes fit in destination array - if ((j + 1 + ESCAPE_RECORD_SIZE) <= destinationLength) - { - // Write out the single byte and then the escape record. - destination[j++] = source[i++]; // byte before the escape byte - destination[j++] = escape; - destination[j++] = escape; - ++i; // byte after the escape byte - } - // Destination array overflow - else - { - if (traceDiagnostic) - Trace.log(Trace.DIAGNOSTIC, "Overflow when writing out single byte and escape record starting at dest " + j + " ..."); - overflow = true; - } - } - // Have at least two non-escape bytes that could be a repeater. - // Compare two bytes with next two bytes. - else - { - int saveOffset = i; - //@P0D int repeater = BinaryConverter.byteArrayToUnsignedShort(source, i); // @A2C - int repeater = ((source[i] & 0xFF) << 8) + (source[i+1] & 0xFF); //@P0A - int count = 1; // @A2C - i += 2; - // Calculate the number of times these two bytes are repeated. - while (((i+1) < sourceLength) && repeater == (((source[i] & 0xFF) << 8) + (source[i+1] & 0xFF)) && count < 65535) //@P0C @B1A - //@P0D (BinaryConverter.byteArrayToUnsignedShort(source, i) == repeater)) - { // @A2C - count++; - i += 2; - } - // Calculate the length of the repeating characters. - int repeatLength = count * REPEATER_SIZE; - - // Determine if we have enough repeating bytes to merit an RLE record. - if (repeatLength >= REPEATER_RECORD_SIZE * 2) - { - // Enough repeating data. Build RLE record. - if (j + REPEATER_RECORD_SIZE <= destinationLength) - { - // Bytes fit in destination array; write out the repeated bytes. - destination[j] = escape; //@P0C - //@P0D BinaryConverter.unsignedShortToByteArray(repeater, destination, j); // @A2C - destination[++j] = (byte)(repeater >>> 8); //@P0A - destination[++j] = (byte) repeater; //@P0A - //@P0D BinaryConverter.unsignedShortToByteArray(count, destination, j+2); // @A2C - //@P0D j += 4; - destination[++j] = (byte)(count >>> 8); //@P0A - destination[++j] = (byte) count; //@P0A - ++j; //@P0A - } - // Destination array overflow - else - { - if (traceDiagnostic) - Trace.log(Trace.DIAGNOSTIC, "Overflow when writing out RLE repeater record starting at dest " + j + " ..."); - overflow = true; - } - } - else - { - // Not enough repeating data. Just copy the data to destination array. - i = saveOffset; - // Bytes fit in destination array - if ((j + (repeatLength - 1)) < destinationLength) - { - // Write out the repeated bytes. - for (int n=0; n < repeatLength; n++) - { - destination[j++] = source[i++]; - } - } - // Destination array overflow - else - { - if (traceDiagnostic) - Trace.log(Trace.DIAGNOSTIC, "Overflow when writing out non-repeating bytes to dest " + j + " ..."); - overflow = true; - } - } - } - } - - returnCount = j - destinationOffset; // @A1A - if (!overflow && (returnCount < length)) - { // @A1C - if (traceDiagnostic) - Trace.log(Trace.DIAGNOSTIC, "compressRLE() length of compressed bytes returned: " + j); - } - else - { - returnCount = -1; - if (traceDiagnostic) - Trace.log(Trace.DIAGNOSTIC, "compressRLE() returning null (compressed size >= decompressed size)"); - } - - return returnCount; - } - - - - /** - Decompress data in the source byte array and write the decompressed data - to the returned byte array. - - @param source The source (compressed) bytes. - @param sourceOffset The offset in the source bytes at which to start - decompressing. - @param length The length of the bytes to decompress. - @param decompressedLength The length of the bytes in their decompressed state. - If this length is provided, the byte array to be - returned will be created using this length. If this - length is not known, input 0. When set to 0, this - value will be calculated and the returned byte array - will be created with the calculated length. - Performance is improved when the correct decompressed - length is provided as input. - @param escape The escape character. Use DEFAULT_ESCAPE. - - @return The decompressed bytes. - - **/ - static byte[] decompressRLE (byte[] source, - int sourceOffset, - int length, - int decompressedLength, - byte escape) - { - // Validate the input byte array. - if (source == null) - { - throw new NullPointerException("source"); - } - - // Validate the source offset value. - if (sourceOffset >= source.length) - { - throw new ExtendedIllegalArgumentException("sourceOffset", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Validate the length value. - if (length <= 0) - { - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Validate the decompressed length value. - if (decompressedLength < 0) - { - throw new ExtendedIllegalArgumentException("decompressedLength", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Create a temporary buffer for the decompressed data. - byte[] destination; - if (decompressedLength == 0) - { - destination = new byte[2048]; - } - else - { - destination = new byte[decompressedLength]; - } - - return decompressRLEInternal(source, sourceOffset, length, destination, 0, escape, true); // @A1A - } - - - -// @A1A - /** - Decompress data in the source byte array and write the decompressed data - to the destination byte array. - - @param source The source (compressed) bytes. - @param sourceOffset The offset in the source bytes at which to start - decompressing. - @param length The length of the bytes to decompress. - @param destination The destination (decompressed) bytes. - @param destinationOffset The offset in the destination bytes at which to - assign decompressed bytes. - @param escape The escape character. Use DEFAULT_ESCAPE. - - @return The decompressed bytes. - - **/ - static void decompressRLE (byte[] source, - int sourceOffset, - int length, - byte[] destination, - int destinationOffset, - byte escape) - { - // Validate the input byte array. - if (source == null) - { - throw new NullPointerException("source"); - } - - // Validate the source offset value. - if (sourceOffset >= source.length) - { - throw new ExtendedIllegalArgumentException("sourceOffset", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Validate the length value. - if (length <= 0) - { - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Validate the input byte array. - if (destination == null) - { - throw new NullPointerException("destination"); - } - - // Validate the source offset value. - if (destinationOffset >= destination.length) - { - throw new ExtendedIllegalArgumentException("destinationOffset", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - decompressRLEInternal(source, sourceOffset, length, destination, destinationOffset, escape, false); - } - - -// @A1A - Moved from decompressRLE(byte[], int, int, int, byte) - /** - Decompress data in the source byte array and write the decompressed data - to the destination byte array. - - @param source The source (compressed) bytes. - @param sourceOffset The offset in the source bytes at which to start - decompressing. - @param length The length of the bytes to decompress. - @param destination The destination (decompressed) bytes. - @param destinationOffset The offset in the destination bytes at which to - assign decompressed bytes. - @param escape The escape character. Use DEFAULT_ESCAPE. - @param reallocate true to reallocate the destination array, if needed, - false otherwise. - - @return The decompressed bytes. - **/ - private static byte[] decompressRLEInternal (byte[] source, - int sourceOffset, - int length, - byte[] destination, - int destinationOffset, - byte escape, - boolean reallocate) - { - // Set flags to indicate which type of tracing, if any, should be done. - boolean traceDiagnostic = Trace.isTraceOn() && Trace.isTraceDiagnosticOn(); - boolean traceError = Trace.isTraceOn() && Trace.isTraceErrorOn(); - - int i = sourceOffset; // Index into source. - int j = destinationOffset; // Index into destination. - int saveI = -1; // keep current position of the source index - int saveJ = -1; // keep current position of the destination index - - boolean overflow = false; // destination array overflow indicator - int bytesNeeded = 0; // number of additional bytes needed - - int sourceLength = sourceOffset + length; - int destinationLength = destination.length; - - if (traceDiagnostic) - { - Trace.log(Trace.DIAGNOSTIC, "decompressRLE() sourceLength: " + sourceLength); - Trace.log(Trace.DIAGNOSTIC, "decompressRLE() destinationLength: " + destinationLength); - } - - while (i < sourceLength) - { - - // Have an escape byte - if (source[i] == escape) - { - // Not end of source - if ((i + ESCAPE_SIZE) < sourceLength) - { - - // Second byte is escape; have an RLE escape record - if (source[i + ESCAPE_SIZE] == escape) - { - - // Byte fits in destination array - if (j < destinationLength) - { - // Add escape byte to destination array - destination[j] = escape; - } - // Destination array overflow - else - { - if (traceDiagnostic) - { - Trace.log(Trace.DIAGNOSTIC, "Overflow while decompressing RLE escape record starting at " + j + " ..."); - } - // save each index only when overflow is encountered - // the first time; otherwise, just tally up the number of - // additional bytes needed - if (!overflow) - { - saveI = i; - saveJ = j; - } - overflow = true; - bytesNeeded += ESCAPE_SIZE; - } - i += ESCAPE_RECORD_SIZE; - j += ESCAPE_SIZE; - } - - // Should have an RLE repeater record; - // have an escape byte followed by a non-escape byte - else - { - - // Not end of source; have a complete RLE repeater record - if ((i + REPEATER_SIZE + COUNT_SIZE) < sourceLength) - { - - // Get repeater - //@P0D int repeater = BinaryConverter.byteArrayToUnsignedShort(source, i + ESCAPE_SIZE); // @A2C - int repeater = ((source[i+ESCAPE_SIZE] & 0xFF) << 8) + (source[i+ESCAPE_SIZE+1] & 0xFF); //@P0A - // Get repeat count - //@P0D int count = BinaryConverter.byteArrayToUnsignedShort(source, i + ESCAPE_SIZE + REPEATER_SIZE); // @A2C - int count = ((source[i+ESCAPE_SIZE+REPEATER_SIZE] & 0xFF) << 8) + (source[i+ESCAPE_SIZE+REPEATER_SIZE+1] & 0xFF); //@P0A - - // Bytes fit in destination array - if ((j + (count * REPEATER_SIZE)) <= destinationLength) - { - // Write out the bytes to destination array - for (int k = 1; k <= count; ++k) - { // @A2C - //@P0D BinaryConverter.unsignedShortToByteArray(repeater, destination, j); // @A2C - destination[j] = (byte)(repeater >>> 8); //@P0A - destination[j+1] = (byte) repeater; //@P0A - j += REPEATER_SIZE; - } - } - // Destination array overflow - else - { - if (traceDiagnostic) - { - Trace.log(Trace.DIAGNOSTIC, "Overflow while decompressing RLE repeater record starting at dest " + j + " ..."); - } - // save each index only when overflow is encountered - // the first time; otherwise, just tally up the number of - // additional bytes needed - if (!overflow) - { - saveI = i; - saveJ = j; - } - overflow = true; - bytesNeeded += (count * REPEATER_SIZE); - j += (count * REPEATER_SIZE); - } - i += REPEATER_RECORD_SIZE; - } - // Error (don't have a complete RLE repeater record before EOD) - else - { - if (traceError) - Trace.log(Trace.ERROR, "Don't have a complete RLE repeater record before EOD ..."); - throw new InternalErrorException(InternalErrorException.SYNTAX_ERROR ); - } - } - - } - // End of source reached and have single escape byte - else - { - if (traceError) - Trace.log(Trace.ERROR, "Don't have a complete RLE escape record before EOD ..."); - throw new InternalErrorException(InternalErrorException.SYNTAX_ERROR ); - } - } - - // No RLE record found; just copy bytes from source to destination arrray - else - { - // Byte fits in destination array - if (j < destinationLength) - { - // Add byte to destination array - destination[j++] = source[i++]; - } - // Destination array overflow - else - { - if (traceDiagnostic) - { - Trace.log(Trace.DIAGNOSTIC, "Overflow when writing out single bytes ..."); - } - // save each index only when overflow is encountered - // the first time; otherwise, just tally up the number of - // additional bytes needed - if (!overflow) - { - saveI = i; - saveJ = j; - } - overflow = true; - bytesNeeded += 1; - ++i; - ++j; - } - } - - } - - // Buffer for decompressed bytes that will be returned. - byte[] returnBytes; - - if ((overflow) && (reallocate)) - { - // Destination array too small. Add bytes needed to length - // and create a return buffer of the correct length. - j = saveJ; - returnBytes = new byte[(j + bytesNeeded)]; - int returnBytesLength = returnBytes.length; - if (traceDiagnostic) - { - Trace.log(Trace.DIAGNOSTIC, "Overflow. Size updated to " + returnBytesLength + " bytes."); - } - System.arraycopy(destination, 0, returnBytes, 0, j); - i = saveI; - overflow = false; - - while (i < sourceLength) - { - - // Have an escape byte - if (source[i] == escape) - { - - // Not end of source - if ((i + ESCAPE_SIZE) < sourceLength) - { - - // Second byte is escape; have an RLE escape record - if (source[i + ESCAPE_SIZE] == escape) - { - // Add escape byte to destination array - returnBytes[j++] = escape; - i += ESCAPE_RECORD_SIZE; - } - - // Should have an RLE repeater record; - // have an escape byte followed by a non-escape byte - else - { - - // Not end of source; have a complete RLE repeater record - if ((i + REPEATER_SIZE + COUNT_SIZE) < sourceLength) - { - - // Get repeater - //@P0D int repeater = BinaryConverter.byteArrayToUnsignedShort(source, i + ESCAPE_SIZE); // @A2C - int repeater = ((source[i+ESCAPE_SIZE] & 0xFF) << 8) + (source[i+ESCAPE_SIZE+1] & 0xFF); //@P0A - // Get repeat count - //@P0D int count = BinaryConverter.byteArrayToUnsignedShort(source, i + ESCAPE_SIZE + REPEATER_SIZE); // @A2C - int count = ((source[i+ESCAPE_SIZE+REPEATER_SIZE] & 0xFF) << 8) + (source[i+ESCAPE_SIZE+REPEATER_SIZE+1] & 0xFF); //@P0A - - // Write out the bytes to destination array - for (int k = 1; k <= count; k++) - { // @A2C - //@P0D BinaryConverter.unsignedShortToByteArray(repeater, returnBytes, j); // @A2C - returnBytes[j] = (byte)(repeater >>> 8); //@P0A - returnBytes[j+1] = (byte)repeater; //@P0A - j += REPEATER_SIZE; - } - i += REPEATER_RECORD_SIZE; - } - // Error (don't have a complete RLE repeater record before EOD) - else - { - if (traceError) - Trace.log(Trace.ERROR, "Don't have a complete RLE repeater record before EOD ..."); - throw new InternalErrorException(InternalErrorException.SYNTAX_ERROR ); - } - } - - } - // End of source reached and have single escape byte - else - { - if (traceError) - Trace.log(Trace.ERROR, "Don't have a complete RLE escape record before EOD ..."); - throw new InternalErrorException(InternalErrorException.SYNTAX_ERROR ); - } - } - - // No RLE record found; just copy bytes from source to destination arrray - else - { - returnBytes[j++] = source[i++]; - } - - } - return returnBytes; - } - else if ((destination.length > j) && (reallocate)) - { - // Destination array too big. Create a return buffer of the correct length, - // copy data into it, and return the decompressed bytes. - returnBytes = new byte[j]; - System.arraycopy(destination, destinationOffset, returnBytes, 0, returnBytes.length); - return returnBytes; - } - else - { - // Destination array is correct length. Return the decompressed bytes. - return destination; - } - - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/DateFieldDescription.java b/cvsroot/src/com/ibm/as400/access/DateFieldDescription.java deleted file mode 100644 index 080e57fa4..000000000 --- a/cvsroot/src/com/ibm/as400/access/DateFieldDescription.java +++ /dev/null @@ -1,359 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: DateFieldDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.util.Vector; -//@B0A -import java.util.Date; -import java.util.HashSet; -import java.text.SimpleDateFormat; - -/** - *Represents the description of the data in a date field. - *It allows: - *
            - *
          • The user to describe a date field to the RecordFormat object. - *
          • The RecordFormat object to describe a date field to the user. - *
          - *Click hereto see an example. -**/ -public class DateFieldDescription extends FieldDescription implements Serializable -{ - static final long serialVersionUID = 4L; - - static HashSet formatsWithFixedSeparators_; - - // The date format for this field - private String dateFormat_ = null; - // The date separator for this field - private String dateSeparator_ = null; - - /** - *Constructs a DateFieldDescription object. - **/ - public DateFieldDescription() - { - } - - /** - *Constructs a DateFieldDescription object. It uses the specified data type and name - *of the field. - *The length of the field will be the length specified on the AS400Text object. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public DateFieldDescription(AS400Text dataType, String name) - { - super(dataType, name); - } - - /** - *Constructs a DateFieldDescription object. It uses the specified data type, name, and - *DDS name of the field. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - **/ - public DateFieldDescription(AS400Text dataType, String name, String ddsName) - { - super(dataType, name, ddsName); - } - - /** - *Constructs a DateFieldDescription object. It uses the specified data type and name - *of the field. - *The length of the field will be the length reported by the AS400Date object. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public DateFieldDescription(AS400Date dataType, String name) - { - super(dataType, name); - } - - /** - *Constructs a DateFieldDescription object. It uses the specified data type, name, and - *DDS name of the field. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - **/ - public DateFieldDescription(AS400Date dataType, String name, String ddsName) - { - super(dataType, name, ddsName); - } - - - /** - *Returns the value specified for the DATFMT keyword for this field. - *@return The value specified for DATFMT for - * this field. If DATFMT was not specified for this field, - * an empty string is returned. - **/ - public String getDATFMT() - { - return (dateFormat_ == null ? "" : dateFormat_); - } - - /** - *Returns the value specified for the DATSEP keyword for this field. - *@return The value specified for DATSEP for - * this field. If DATSEP was not specified for this field, - * an empty string is returned. - **/ - public String getDATSEP() - { - return dateSeparator_ == null ? "" : dateSeparator_; - } - - /** - *Returns the DDS description for the field. This is a string containing - *the description of the field as it would be specified in a DDS source file. - *This method is used by AS400File.createDDSSourceFile (called by the AS400File.create methods) - *to specify the field - *in the DDS source file which is used to create the file for the user who - *has passed in a RecordFormat object. - *@return The DDS description of this field properly formatted for entry - *into a DDS source file. - **/ - String[] getDDSDescription() - { - Vector v = new Vector(); - // Name columns (10) - StringBuffer desc = new StringBuffer(ddsName_); - // Blank pad the ddsName to 10 characters. - while(desc.length() < 10) - { - desc.append(" "); - } - // Reference column (1) - if (!refFld_.equals("")) - { - desc.append("R"); - } - else - { - desc.append(" "); - } - // Get length as 5 digit string, right justified - // Length columns (5) - desc.append(" "); // No length can be specified for a date field - // Type column (1) - desc.append("L"); - // Decimal positions columns (2) - desc.append(" "); - // Not used columns (7) - desc.append(" "); - // Add fixed portion of DDS description to Vector - v.addElement(desc.toString()); - // Add the field level keywords - String[] keywords = super.getFieldFunctions(); - if (keywords != null) - { - for (int i = 0; i < keywords.length; ++i) - { - v.addElement(keywords[i]); - } - } - if (dateFormat_ != null) - { - v.addElement("DATFMT(" + dateFormat_ + ") "); - } - if (dateSeparator_ != null) - { - if (!formatHasFixedSeparator(dateFormat_)) { - v.addElement("DATSEP('" + dateSeparator_ + "') "); - } - else { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "DDS date format " + dateFormat_ + " has a fixed separator."); - } - } - if (defaultValue_ != null) - { - v.addElement("DFT('" + defaultValue_.toString() + "') "); - } - //@B0A - else if (isDFTNull_) - { - v.addElement("DFT(*NULL) "); - } - String[] s = new String[v.size()]; - v.copyInto(s); - return s; - } - - static boolean formatHasFixedSeparator(String format) - { - // According to the DDS spec for DATSEP: - // "If you specify the *ISO, *USA, *EUR, or *JIS date format value on the DATFMT keyword, you cannot specify the DATSEP keyword. These formats have a fixed date separator." - - // Similarly, according to the DDS spec for TIMTSEP: - // "If you specify *ISO, *USA, *EUR, or *JIS time format on the TIMFMT keyword, you cannot specify the TIMSEP keyword. These formats have a fixed separator." - - if (getFormatsWithFixedSeparators().contains(format)) return true; - else return false; - } - - private static HashSet getFormatsWithFixedSeparators() - { - if (formatsWithFixedSeparators_ == null) - { - synchronized (DateFieldDescription.class) - { - if (formatsWithFixedSeparators_ == null) - { - formatsWithFixedSeparators_ = new HashSet(6); - formatsWithFixedSeparators_.add("*ISO"); - formatsWithFixedSeparators_.add("*USA"); - formatsWithFixedSeparators_.add("*EUR"); - formatsWithFixedSeparators_.add("*JIS"); - } - } - } - return formatsWithFixedSeparators_; - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400Text dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length of the field based on the data type - length_ = dataType.getByteLength(); - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400Date dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length of the field based on the data type - length_ = dataType.getByteLength(); - } - - /** - *Sets the value to specify for the DATFMT keyword for this field. - *@param dateFormat The value to specify for DATFMT for - * this field. The dateFormat cannot be null. - **/ - public void setDATFMT(String dateFormat) - { - if (dateFormat == null) throw new NullPointerException("dateFormat"); - - if (dateFormat.startsWith("*")) { - dateFormat_ = dateFormat.toUpperCase(); - } - else { - dateFormat_ = "*" + dateFormat.toUpperCase(); - } - - // Inform the AS400Date object of the format. - if (dataType_ instanceof AS400Date) { - ((AS400Date)dataType_).setFormat(dateFormat); - } - } - - /** - *Sets the value to specify for the DATSEP keyword for this field. - *@param separator The value to specify for DATSEP for this field. - *A null value indicates "no separator". - **/ - public void setDATSEP(String separator) - { - // Inform the AS400Date object of the separator. - if (dataType_ instanceof AS400Date) - { - if (separator != null && separator.length() > 1) { - throw new ExtendedIllegalArgumentException("separator (" + separator + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - Character sep = ( separator == null ? null : new Character(separator.charAt(0))); - ((AS400Date)dataType_).setSeparator(sep); - } - dateSeparator_ = separator; - } - - //@B0C - javadoc - /** - *Sets the value for the DFT keyword for this field. - *@param defaultValue The default value for this - * field. The defaultValuecannot be null. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(String defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; //@B0A - isDFTCurrent_ = false; //@B0A - DFTCurrentValue_ = null; //@B0A - } - - //@B0A - /** - *Sets the default value for this field to be the current date. - *Calling this method will replace the DFT keyword that was previously - *set on a call to setDFT(String) or setDFTNull(). - **/ - public void setDFTCurrent() - { - isDFTCurrent_ = true; - isDFTNull_ = false; - defaultValue_ = null; - DFTCurrentValue_ = (new SimpleDateFormat("yyyy-MM-dd")).format(new Date()); - } - - //@B0A - /** - *Sets the value for the DFT keyword to be *NULL for this field. - *Calling this method will replace the DFT keyword that was previously - *set on a call to setDFT(String) or setDFTCurrent(). Note: This field - *must also have its ALWNULL keyword set to true to prevent DDS errors. - **/ - public void setDFTNull() - { - isDFTNull_ = true; - defaultValue_ = null; - isDFTCurrent_ = false; - DFTCurrentValue_ = null; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/DateTimeConverter.java b/cvsroot/src/com/ibm/as400/access/DateTimeConverter.java deleted file mode 100644 index ee26fa9b9..000000000 --- a/cvsroot/src/com/ibm/as400/access/DateTimeConverter.java +++ /dev/null @@ -1,708 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DateTimeConverter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// 2008-05-21 @A1 Changes for *CURRENT when returning Date objects. Adjust the -// AS400 system time to the local client time. -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.Calendar; -import java.util.Date; -import java.util.TimeZone; //@A1A - - -/** - A utility for converting date/time values. - The system API QWCCVTDT is used to convert a date and time value - from one format to another format. - - @see AS400Date - @see AS400Time - @see AS400Timestamp -**/ -public class DateTimeConverter -{ - private AS400 system_; - private ProgramCall program_; - private AS400Text text10_; - - private Calendar calendar_; - //private Calendar calendarGMT_; - private DateTime17Format format17_; - //private DateTime16Format format16_; - private TimeZone systemTimeZone_; // the time zone for the IBM i server - - /** - * Constructs a DateTimeConverter object. - * @param system The system. - **/ - public DateTimeConverter(AS400 system) - { - if (system == null) - throw new NullPointerException("system"); - system_ = system; - program_ = new ProgramCall(system_); - text10_ = new AS400Text(10, system_.getCcsid(), system_); - ///format17_ = new DateTime17Format(system_); - //format16_ = new DateTime16Format(system_); - } - - - /** - * Converts date and time values from the input format to the requested output format. - * The system API QWCCVTDT (Convert Date and Time Format) is called to perform the conversion. - *

          This method effectively just re-arranges the time format and returns it. - * The input and output values are relative to the same time zone. - * Therefore, no adjustments are made based on time-zone. - * - * @param data The date and time value to be converted. - * @param inFormat The input date and time format. - * Possible values are: -

            -
          • *CURRENT -
          • *DTS -
          • *JOB -
          • *SYSVAL -
          • *YMD -
          • *YYMD -
          • *MDY -
          • *MDYY -
          • *DMY -
          • *DMYY -
          • *JUL -
          • *LONGJUL -
          - * @param outFormat The output date and time format. - * Possible values are: -
            -
          • *DTS -
          • *JOB -
          • *SYSVAL -
          • *YMD -
          • *YYMD -
          • *MDY -
          • *MDYY -
          • *DMY -
          • *DMYY -
          • *JUL -
          • *LONGJUL -
          • *DOS -
          - * @return The converted date and time value, left-justified in the array. - * Refer to the specification for the QWCCVTDT API to determine how many of the - * returned bytes are meaningful. - * - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public byte[] convert(byte[] data, String inFormat, String outFormat) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - return convert(data, inFormat, outFormat, null); - } - - private byte[] convert(byte[] data, String inFormat, String outFormat, String timezone) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (data == null) throw new NullPointerException("data"); - if (inFormat == null) throw new NullPointerException("inFormat"); - if (outFormat == null) throw new NullPointerException("outFormat"); - - // Set up the parameters. - // Design note: We don't need to use the optional parms, since we're not converting between different time zones. - ProgramParameter[] parmList; - if (timezone == null) { - parmList = new ProgramParameter[5]; - setRequiredParameters(parmList, data, inFormat, outFormat); - } - else { - parmList = new ProgramParameter[10]; - setRequiredParameters(parmList, data, inFormat, outFormat); - setOptionalParameters(parmList, timezone); - } - - // Set the program name and parameter list - try - { - program_.setProgram("/QSYS.LIB/QWCCVTDT.PGM", parmList); - } - catch(PropertyVetoException pve) {} // Quiet the compiler - - program_.suggestThreadsafe(); //@A2A - - // Run the program - if (!program_.run()) - { - // Note that there was an error - Trace.log(Trace.ERROR, "DateTimeConverter call to QWCCVTDT failed."); - - // Show the messages - AS400Message[] messageList = program_.getMessageList(); - for (int i=0; iQWCCVTDT (Convert Date and Time Format) is called to perform the conversion. - * @param data The date and time value to be converted. - * The value is assumed to be relative to the IBM i system's time zone. - * @param inFormat The format of the date and time value being provided. - * Possible values are: -
            -
          • *CURRENT -
          • *DTS -
          • *JOB -
          • *SYSVAL -
          • *YMD -
          • *YYMD -
          • *MDY -
          • *MDYY -
          • *DMY -
          • *DMYY -
          • *JUL -
          • *LONGJUL -
          - * Note: When *CURRENT is specified, the data parameter is disregarded. - * @return The converted date and time. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Date convert(byte[] data, String inFormat) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (data == null) throw new NullPointerException("data"); - if (inFormat == null) throw new NullPointerException("inFormat"); - - // Use output format *YYMD which gives us a full Date: YYYYMMDD. - byte[] converted = convert(data, inFormat, "*YYMD", null); // call QWCCVTDT - Record rec = getFormat17().getNewRecord(converted); - - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "DateTimeConverter record parsed from bytes: "+rec.toString()); - } - - Calendar calendar = getCalendar(); - calendar.set(Integer.parseInt(((String)rec.getField("year")).trim()), - Integer.parseInt(((String)rec.getField("month")).trim())-1, - Integer.parseInt(((String)rec.getField("day")).trim()), - Integer.parseInt(((String)rec.getField("hour")).trim()), - Integer.parseInt(((String)rec.getField("minute")).trim()), - Integer.parseInt(((String)rec.getField("second")).trim())); - calendar.set(Calendar.MILLISECOND, Integer.parseInt(((String)rec.getField("millisecond")).trim())); - - return calendar.getTime(); - } - - -// For testing and/or future enhancement: -// /** -// * Returns a converted Date object, relative to the GMT time zone. -// * The system API QWCCVTDT (Convert Date and Time Format) is called to perform the conversion. -// * @param data The date and time value to be converted. -// * The value is assumed to be relative to the IBM i system's time zone. -// * @param inFormat The format of the date and time value being provided. -// * Possible values are: -//
            -//
          • *CURRENT -//
          • *DTS -//
          • *JOB -//
          • *SYSVAL -//
          • *YMD -//
          • *YYMD -//
          • *MDY -//
          • *MDYY -//
          • *DMY -//
          • *DMYY -//
          • *JUL -//
          • *LONGJUL -//
          -// * Note: When *CURRENT is specified, the data parameter is disregarded. -// * @return The converted date and time. -// * @exception AS400SecurityException If a security or authority error -// * occurs. -// * @exception ErrorCompletingRequestException If an error occurs before -// * the request is completed. -// * @exception InterruptedException If this thread is interrupted. -// * @exception IOException If an error occurs while communicating with -// * the system. -// * @exception ObjectDoesNotExistException If the object does not exist on the system. -// **/ -// public Date convertGMT(byte[] data, String inFormat) -// throws AS400SecurityException, -// ErrorCompletingRequestException, -// InterruptedException, -// IOException, -// ObjectDoesNotExistException -// { -// if (data == null) throw new NullPointerException("data"); -// if (inFormat == null) throw new NullPointerException("inFormat"); -// -// // Use output format *YYMD which gives us a full Date: YYYYMMDD. -// byte[] converted = convert(data, inFormat, "*YYMD", "*UTC"); // call QWCCVTDT -// Record rec = getFormat17().getNewRecord(converted); -// -// if (Trace.traceOn_) -// { -// Trace.log(Trace.DIAGNOSTIC, "DateTimeConverter record parsed from bytes: "+rec.toString()); -// } -// -// Calendar calendar = getCalendarGMT(); -// calendar.set(Integer.parseInt(((String)rec.getField("year")).trim()), -// Integer.parseInt(((String)rec.getField("month")).trim())-1, -// Integer.parseInt(((String)rec.getField("day")).trim()), -// Integer.parseInt(((String)rec.getField("hour")).trim()), -// Integer.parseInt(((String)rec.getField("minute")).trim()), -// Integer.parseInt(((String)rec.getField("second")).trim())); -// calendar.set(Calendar.MILLISECOND, Integer.parseInt(((String)rec.getField("millisecond")).trim())); -// -// return calendar.getTime(); -// } - - /** - * Returns the converted date and time in a byte array. - * @param date The Date object to be converted. - * @param outFormat The format of the returned date and time value. - * Possible values are: -
            -
          • *DTS -
          • *JOB -
          • *SYSVAL -
          • *YMD -
          • *YYMD -
          • *MDY -
          • *MDYY -
          • *DMY -
          • *DMYY -
          • *JUL -
          • *LONGJUL -
          - * @return The converted date and time value, left-justified in the array. - * The context of the value is the IBM i system's time zone. - * Refer to the specification for the QWCCVTDT API to determine how many of the - * returned bytes are meaningful. - * - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public byte[] convert(Date date, String outFormat) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (date == null) throw new NullPointerException("date"); - if (outFormat == null) throw new NullPointerException("outFormat"); - - byte[] data = dateToBytes(date); - - return convert(data, "*YYMD", outFormat, null); - } - - -// For testing and/or future enhancement: -// /** -// * Returns the converted date and time in a byte array, relative to the GMT time zone. -// * @param date The Date object to be converted. -// * @param outFormat The format of the returned date and time value. -// * Possible values are: -//
            -//
          • *DTS -//
          • *JOB -//
          • *SYSVAL -//
          • *YMD -//
          • *YYMD -//
          • *MDY -//
          • *MDYY -//
          • *DMY -//
          • *DMYY -//
          • *JUL -//
          • *LONGJUL -//
          -// * @return The converted date and time value, left-justified in the array. -// * The context of the value is the GMT time zone. -// * Refer to the specification for the QWCCVTDT API to determine how many of the -// * returned bytes are meaningful. -// * -// * @exception AS400SecurityException If a security or authority error -// * occurs. -// * @exception ErrorCompletingRequestException If an error occurs before -// * the request is completed. -// * @exception InterruptedException If this thread is interrupted. -// * @exception IOException If an error occurs while communicating with -// * the system. -// * @exception ObjectDoesNotExistException If the object does not exist on the system. -// **/ -// public byte[] convertGMT(Date date, String outFormat) -// throws AS400SecurityException, -// ErrorCompletingRequestException, -// InterruptedException, -// IOException, -// ObjectDoesNotExistException -// { -// if (date == null) throw new NullPointerException("date"); -// if (outFormat == null) throw new NullPointerException("outFormat"); -// -// byte[] data = dateToBytes(date); -// return convert(data, "*YYMD", outFormat, "*UTC"); // "*UTC" == GMT timezone -// } - - - // Converts a Date value to an IBM i byte sequence in *YYMD format. - private byte[] dateToBytes(Date date) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - Calendar calendar = getCalendar(); - calendar.setTime(date); - - // Start with *YYMD for conversion. Seems like a good format to use. - Record rec = getFormat17().getNewRecord(); - rec.setField("year", Integer.toString(calendar.get(Calendar.YEAR))); - - // Need to pad each number with 0s if necessary, so it will fill the format - int month = calendar.get(Calendar.MONTH)+1; - String monthStr = (month < 10 ? "0" : "") + month; - rec.setField("month", monthStr); - int day = calendar.get(Calendar.DAY_OF_MONTH); - String dayStr = (day < 10 ? "0" : "") + day; - rec.setField("day", dayStr); - int hour = calendar.get(Calendar.HOUR_OF_DAY); - String hourStr = (hour < 10 ? "0" : "") + hour; - rec.setField("hour", hourStr); - int minute = calendar.get(Calendar.MINUTE); - String minuteStr = (minute < 10 ? "0" : "") + minute; - rec.setField("minute", minuteStr); - int second = calendar.get(Calendar.SECOND); - String secondStr = (second < 10 ? "0" : "") + second; - rec.setField("second", secondStr); - int ms = calendar.get(Calendar.MILLISECOND); - String msStr = (ms < 100 ? "0" : "") + (ms < 10 ? "0" : "") + ms; - rec.setField("millisecond", msStr); - - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "DateTimeConverter record parsed from Date: "+rec.toString()); - } - - return rec.getContents(); - } - - - // Utility method. - // Returns a Calendar object for the current system, set to the IBM i system's time zone. - private final Calendar getCalendar() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (calendar_ == null) { - // Create a Calendar object, based in the system's time zone. - calendar_ = Calendar.getInstance(getSystemTimeZone()); - } - else calendar_.clear(); - return calendar_; - } - - -// For testing and/or future enhancement: -// // Utility method. -// // Returns a Calendar object set to the GMT time zone. -// private final Calendar getCalendarGMT() -// { -// if (calendarGMT_ == null) { -// // Create a Calendar object, based in the GMT time zone. -// calendarGMT_ = Calendar.getInstance(TimeZone.getTimeZone("GMT-0")); -// } -// else calendarGMT_.clear(); -// return calendarGMT_; -// } - - - // Utility method. - private synchronized DateTime17Format getFormat17() - { - if (format17_ == null) { - format17_ = new DateTime17Format(system_); - } - return format17_; - } - - - /** - * Returns a TimeZone object to represent the time zone for the system. - * The TimeZone object will have the correct UTC offset for the system. - * @return A TimeZone object representing the system's configured time zone setting. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the API used to retrieve the information does not exist on the system. - **/ - final TimeZone getSystemTimeZone() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (systemTimeZone_ == null) { - systemTimeZone_ = timeZoneForSystem(system_); - } - return systemTimeZone_; - } - - - /** - * Returns a TimeZone object to represent the time zone for the specified system. - * The TimeZone object will have the correct UTC offset for the system. - * @param system The IBM i system. - * @return A TimeZone object representing the time zone for the system. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the API used to retrieve the information does not exist on the system. - * @see AS400#getTimeZone() - **/ - public static TimeZone timeZoneForSystem(AS400 system) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - // To obtain a standard ID for the time zone, simply concatenate "GMT" and the QUTCOFFSET value. - String utcOffset = null; - try - { - SystemValue sv = new SystemValue(system, "QUTCOFFSET"); - utcOffset = (String)sv.getValue(); // returns a value such as "-0500" - if (utcOffset == null || utcOffset.length() == 0) - { - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, "QUTCOFFSET is not set. Assuming server is in the same time zone as client application."); - } - return TimeZone.getDefault(); - } - else return TimeZone.getTimeZone("GMT" + utcOffset); - } - catch (RequestNotSupportedException e) // this won't happen - { // ... but if it does happen, trace it and rethrow as a runtime exception - Trace.log(Trace.ERROR, e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - catch (RuntimeException e) - { - // Note: We've observed the following error during testing: - // java.lang.NullPointerException at java.util.TimeZone.parseCustomTimeZone() - if (Trace.traceOn_) { - Trace.log(Trace.WARNING, "["+e.toString()+"] Unable to determine time zone of system. " + - "QUTCOFFSET value is " + utcOffset + ". " + - "Assuming server is in the same time zone as client application."); - } - return TimeZone.getDefault(); - } - } - - - // Utility method, for use by other Toolbox classes. - // Trims-down a QWCCVTDT-generated EBCDIC date string, for use in a CL command parameter. - // Depending on the specified format, this method strips extra leading and trailing digits that aren't expected by CL commands. - static final String formatDateForCommandParameter(byte[] dateBytes, String dateFormat) - throws UnsupportedEncodingException - { - int expectedLength = 0; - String outVal = null; - - // Convert EBCDIC characters to a Unicode String. - final String dateString = CharConverter.byteArrayToString(37, dateBytes); - - if (dateFormat.equals("*DTS")) expectedLength = 8; - else if (dateFormat.equals("*YYMD") || - dateFormat.equals("*MDYY") || - dateFormat.equals("*DMYY") || - dateFormat.equals("*LONGJUL")) - { - expectedLength = 17; // for details, refer to the API spec for QWCCVTDT - } - else if (dateFormat.equals("*MDY") || - dateFormat.equals("*YMD") || - dateFormat.equals("*DMY")) - { - // For these formats, CL commands expect 6 digits, with no leading "century guard digit". - outVal = dateString.substring(1,7); - } - else if (dateFormat.equals("*JUL")) - { - // For *JUL, CL commands expect 5 digits, with no leading "century guard digit". - outVal = dateString.substring(1,6); - } - else - { - expectedLength = 16; // for details, refer to the API spec for QWCCVTDT - } - - if (outVal != null) return outVal; - else - { - if (dateString.length() == expectedLength) return dateString; // no truncation needed - else return dateString.substring(0,expectedLength); // truncate extra trailing digits - } - } - - - /** - * Specifies the 17-byte character date and time value format returned - * on the QWCCVTDT API. - **/ - private static class DateTime17Format extends RecordFormat - { - DateTime17Format(AS400 system) - { - int ccsid = system.getCcsid(); - AS400Text text2 = new AS400Text(2, ccsid, system); - addFieldDescription(new CharacterFieldDescription(new AS400Text(4, ccsid, system), "year")); - addFieldDescription(new CharacterFieldDescription(text2, "month")); - addFieldDescription(new CharacterFieldDescription(text2, "day")); - addFieldDescription(new CharacterFieldDescription(text2, "hour")); - addFieldDescription(new CharacterFieldDescription(text2, "minute")); - addFieldDescription(new CharacterFieldDescription(text2, "second")); - addFieldDescription(new CharacterFieldDescription(new AS400Text(3, ccsid, system), "millisecond")); - } - } - - - // /** - // * Specifies the 16-byte character date and time value format returned - // * on the QWCCVTDT API. - //**/ - //private static class DateTime16Format extends RecordFormat - //{ - // DateTime16Format(AS400 system) - // { - // int ccsid = system.getCcsid(); - // AS400Text text2 = new AS400Text(2, ccsid, system); - // addFieldDescription(new CharacterFieldDescription(new AS400Text(1, ccsid, system), "century")); - // addFieldDescription(new CharacterFieldDescription(text2, "year")); - // addFieldDescription(new CharacterFieldDescription(text2, "month")); - // addFieldDescription(new CharacterFieldDescription(text2, "day")); - // addFieldDescription(new CharacterFieldDescription(text2, "hour")); - // addFieldDescription(new CharacterFieldDescription(text2, "minute")); - // addFieldDescription(new CharacterFieldDescription(text2, "second")); - // addFieldDescription(new CharacterFieldDescription(new AS400Text(3, ccsid, system), "millisecond")); - // } - //} - -} diff --git a/cvsroot/src/com/ibm/as400/access/DecimalDataArea.java b/cvsroot/src/com/ibm/as400/access/DecimalDataArea.java deleted file mode 100644 index 4df2f379f..000000000 --- a/cvsroot/src/com/ibm/as400/access/DecimalDataArea.java +++ /dev/null @@ -1,390 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DecimalDataArea.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.io.IOException; -import java.math.BigDecimal; -import java.beans.PropertyVetoException; -import java.net.UnknownHostException; - -/** -The DecimalDataArea class represents a decimal data area on the system. -

          -The following example demonstrates the use of DecimalDataArea: -

          -// Prepare to work with the system named "My400".
          -AS400 system = new AS400("My400");
          -
          -// Create a DecimalDataArea object.
          -QSYSObjectPathName path = new QSYSObjectPathName("MYLIB", "MYDATA", "DTAARA");
          -DecimalDataArea dataArea = new DecimalDataArea(system, path.getPath());
          -
          -// Create the decimal data area on the system using default values.
          -dataArea.create();
          -
          -// Clear the data area.
          -dataArea.clear();
          -
          -// Write to the data area.
          -dataArea.write(new BigDecimal("1.2"));
          -
          -// Read from the data area.
          -BigDecimal data = dataArea.read();
          -
          -// Delete the data area from the system.
          -dataArea.delete();
          -
          -**/ - -// Note: (length, decimalPositions) for a DDA corresponds to -// (precision, scale) for a decimal number. - -// Note: If the value you write to the 400 has a greater scale (number -// of decimal positions) than the DDA will hold, the number will be -// truncated. - -// Note: The largest precision (currently) for a DDA on the 400 is -// 24 digits which includes a scale of 9 digits. This means that the -// base part of the number (i.e. to the left of the decimal point) can -// only have a maximum of 15 digits, irrespective of the fact that the -// DDA may have been created with a greater precision. -// For example, a DDA created with a precision of 20 and a scale of 3 -// means that the length of the DDA is 20, which includes the 3 digits -// of scale. This means that there are theoretically 17 digits left to -// use for the base part of the number. However, the DDA will still -// only accept a maximum base of 15 digits. - - -public class DecimalDataArea extends DataArea implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - /** - Constants - **/ - - static final int DEFAULT_LENGTH = 15; - - /** - Variables - ***/ - - private BigDecimal initialValue_ = new BigDecimal("0.0"); // The initial value written to the data area upon creation. - - //@B0 It was decided that the number of decimal positions should NOT be a bean property - // because the property getter getDecimalPositions() needs to go the system. Bean property - // constructors, getters, and setters should not make connections to the system - // because of the way a visual builder environment manipulates bean objects. - private int decimalPositions_ = 5; // The default number of decimal positions. - - - /** - Constructs a DecimalDataArea object. - It creates a default DecimalDataArea object. The system and path - properties must be set before attempting a connection. - **/ - public DecimalDataArea() - { - super(); - length_ = DEFAULT_LENGTH; - dataAreaType_ = DECIMAL_DATA_AREA; - } - - - /** - Constructs a DecimalDataArea object. - It creates a DecimalDataArea instance that represents the data area path - on system. - @param system The system that contains the data area. - @param path The fully qualified integrated file system path name. The - integrated file system file extension for a data area is DTAARA. An example of a - fully qualified integrated file system path to a data area "MYDATA" in library - "MYLIB" is: /QSYS.LIB/MYLIB.LIB/MYDATA.DTAARA - **/ - public DecimalDataArea(AS400 system, String path) - { - super(system, path); - length_ = DEFAULT_LENGTH; - dataAreaType_ = DECIMAL_DATA_AREA; - } - - - /** - Resets the data area to contain 0.0. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void clear() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (impl_ == null) - chooseImpl(); - - impl_.clear(); - - // Fire the CLEARED event. - fireCleared(); - } - - - /** - Creates a decimal data area on the system. - This method uses the following default property values. -
            -
          • length - 15 digits. -
          • decimalPositions - 5 digits. -
          • initialValue - A value of 0.0. -
          • textDescription - A blank string. -
          • authority - A value of *LIBCRTAUT. -
          - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectAlreadyExistsException If the system object already exists. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void create() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectAlreadyExistsException, - ObjectDoesNotExistException - { - if (impl_ == null) - chooseImpl(); - - impl_.create(length_, decimalPositions_, initialValue_, textDescription_, authority_); - - // Fire the CREATED event. - fireCreated(); - } - - - /** - Creates a decimal data area with the specified attributes. - @param length The maximum number of digits in the data area. Valid - values are 1 through 24. - @param decimalPositions The number of digits to the right of the decimal - point. Valid values are 0 through 9. - @param initialValue The initial value for the data area. - @param textDescription The text description for the data area. The maximum length is 50 characters. - @param authority The public authority level for the data area. Valid - values are *ALL, *CHANGE, *EXCLUDE, *LIBCRTAUT, *USE, or the - name of an authorization list. The maximum length is 10 characters. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectAlreadyExistsException If the system object already exists. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void create(int length, int decimalPositions, - BigDecimal initialValue, String textDescription, - String authority) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectAlreadyExistsException, - ObjectDoesNotExistException - { - // Validate the length parameter. - if (length < 1 || length > 24) - throw new ExtendedIllegalArgumentException("length", - ExtendedIllegalArgumentException.RANGE_NOT_VALID); - // Validate the number of decimal positions. - if (decimalPositions < 0 || decimalPositions > 9) - throw new ExtendedIllegalArgumentException("decimalPositions", - ExtendedIllegalArgumentException.RANGE_NOT_VALID); - // Validate the number of decimal positions in relation to the length. - if (decimalPositions > length) - throw new ExtendedIllegalArgumentException("decimalPositions", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - // Validate the initialValue parameter. - if (initialValue == null) - throw new NullPointerException("initialValue"); - // Validate the text description parameter - if (textDescription == null) - throw new NullPointerException("textDescription"); - if (textDescription.length() > 50) - throw new ExtendedIllegalArgumentException("textDescription", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - // Validate the authority parameter. - if (authority == null) - throw new NullPointerException("authority"); - if (authority.length() == 0 || authority.length() > 10) - throw new ExtendedIllegalArgumentException("authority", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - length_ = length; - decimalPositions_ = decimalPositions; - initialValue_ = initialValue; - textDescription_ = textDescription; - authority_ = authority; - - create(); - } - - - /** - Removes the data area from the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist. - **/ - public void delete() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - super.delete0(); - } - - - /** - Returns the number of digits to the right of the decimal point in this data area. - @return The number of decimal positions. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public int getDecimalPositions() - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - //@B0 It was decided that the number of decimal positions should NOT be a bean property - // because the property getter getDecimalPositions() needs to go the system. Bean property - // constructors, getters, and setters should not make connections to the system - // because of the way a visual builder environment manipulates bean objects. - if (impl_ == null) - chooseImpl(); - - return impl_.getDecimalPositions(); - } - - - /** - Returns the integrated file system path name of the object represented by the data area. - @return The integrated file system path name of the object represented by the data area. - **/ - public String getPath() - { - return super.getPath(); - } - - - /** - Returns the data read from the data area. - @return The decimal data read from the data area. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public BigDecimal read() - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (impl_ == null) - chooseImpl(); - - BigDecimal val = impl_.readBigDecimal(); - - fireRead(); // Fire the READ event. - - return val; - } - - - /** - Sets the fully qualified data area name. - The following example demonstrates the use of setPath: -
          -   // Create a DecimalDataArea object.
          -   DecimalDataArea dataArea = new DecimalDataArea();
          -
          -   // Set its path to be the data area "MYDATA" in the library "MYLIB".
          -   dataArea.setPath("/QSYS.LIB/MYLIB.LIB/MYDATA.DTAARA");
          -   
          - @param path The fully qualified integrated file system path name of the data area. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setPath(String path) throws PropertyVetoException - { - super.setPath(path); - } - - - /** - Writes data to the data area. - @param data The decimal data to be written. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void write(BigDecimal data) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - // Validate the data parameter. - if (data == null) - throw new NullPointerException("data"); - - // Do the write - if (impl_ == null) - chooseImpl(); - - impl_.write(data); - - // Fire the WRITTEN event. - fireWritten(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/DecimalDataArea16.gif b/cvsroot/src/com/ibm/as400/access/DecimalDataArea16.gif deleted file mode 100644 index 08ae790d2..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/DecimalDataArea16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/DecimalDataArea32.gif b/cvsroot/src/com/ibm/as400/access/DecimalDataArea32.gif deleted file mode 100644 index 268822f05..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/DecimalDataArea32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/DecimalDataAreaBeanInfo.java b/cvsroot/src/com/ibm/as400/access/DecimalDataAreaBeanInfo.java deleted file mode 100644 index 2c617070b..000000000 --- a/cvsroot/src/com/ibm/as400/access/DecimalDataAreaBeanInfo.java +++ /dev/null @@ -1,123 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DecimalDataAreaBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; -import java.awt.Image; - - -/** -The DecimalDataAreaBeanInfo class provides -bean information for the DecimalDataArea class. -**/ -public class DecimalDataAreaBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class dbeanClass = DecimalDataArea.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - - private static PropertyDescriptor[] properties_; //@D1A - - static - { - try - { - PropertyDescriptor path = new PropertyDescriptor("path", dbeanClass); - path.setBound(true); - path.setConstrained(true); - path.setDisplayName(loader_.getText("PROP_NAME_PATH")); - path.setShortDescription(loader_.getText("PROP_DESC_PATH")); - properties_ = new PropertyDescriptor[] {path}; //@D1A - } - catch(Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns additional bean information. - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new DataAreaBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(dbeanClass); - } - - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("DecimalDataArea16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("DecimalDataArea32.gif"); - break; - } - - return image; - } - - /** //D1A - Returns the index of the default property. //D1A - @return The index to the default property. //D1A - **/ //D1A - public int getDefaultPropertyIndex() //D1A - { //D1A - // the index for the "path" property //D1A - return 0; //D1A - } //D1A - //D1A - - /** - Returns the descriptors for all properties. //D1A - @return The descriptors for all properties. //D1A - **/ //D1A - public PropertyDescriptor[] getPropertyDescriptors() //D1A - { //D1A - return properties_; //D1A - } //D1A -} - diff --git a/cvsroot/src/com/ibm/as400/access/DirectoryEntry.java b/cvsroot/src/com/ibm/as400/access/DirectoryEntry.java deleted file mode 100644 index eddfb56b7..000000000 --- a/cvsroot/src/com/ibm/as400/access/DirectoryEntry.java +++ /dev/null @@ -1,827 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DirectoryEntry.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The DirectoryEntry class represents system distribution directory information - * for a particular directory entry. Use the {@link com.ibm.as400.access.DirectoryEntryList#getEntries DirectoryEntryList.getEntries()} - * method to obtain a DirectoryEntry object. - *

          - * For more information on the system distribution directory and its entries, see - * the WRKDIRE, ADDDIRE, and RMVDIRE OS/400 CL commands. - * - * @see com.ibm.as400.access.DirectoryEntryList - * @see com.ibm.as400.access.User -**/ -public class DirectoryEntry -{ - private static final String copyright = "Copyright (C) 1997-2002 International Business Machines Corporation and others."; - - private AS400 system_; - private String[] values_; - - - DirectoryEntry(AS400 system, String[] values) - { - system_ = system; - values_ = values; - } - - - /** - * Returns the administration domain. - * @return The administration domain. - **/ - public String getAdministrationDomain() - { - return values_[39].trim(); - } - - - /** - * Returns the building. - * @return The building. - **/ - public String getBuilding() - { - return values_[23].trim(); - } - - - /** - * Returns the cc:Mail address. - * @return The address. - **/ - public String getCCMailAddress() - { - return values_[29].trim(); - } - - - /** - * Returns the cc:Mail comment. - * @return The comment. - **/ - public String getCCMailComment() - { - return values_[30].trim(); - } - - - /** - * Returns the company. - * @return The company. - **/ - public String getCompany() - { - return values_[16].trim(); - } - - - /** - * Returns the country or region. - * @return The country or region code. - **/ - public String getCountry() - { - return values_[38].trim(); - } - - - /** - * Returns the department. - * @return The department. - **/ - public String getDepartment() - { - return values_[17].trim(); - } - - - /** - * Returns which profile will be assigned ownership of the document - * library objects (DLOs) for this directory entry. - * Valid values are: - *

            - *
          • *USRPRF - The user profile. - *
          • *GRPPRF - The group profile. - *
          - * @return The DLO owner. - **/ - public String getDLOOwner() - { - return values_[35].trim(); - } - - - /** - * Returns the type of domain-defined attribute 1. - * @return The type. - **/ - public String getDomainDefinedAttributeType1() - { - return values_[50].trim(); - } - - - /** - * Returns the type of domain-defined attribute 2. - * @return The type. - **/ - public String getDomainDefinedAttributeType2() - { - return values_[52].trim(); - } - - - /** - * Returns the type of domain-defined attribute 3. - * @return The type. - **/ - public String getDomainDefinedAttributeType3() - { - return values_[54].trim(); - } - - - /** - * Returns the type of domain-defined attribute 4. - * @return The type. - **/ - public String getDomainDefinedAttributeType4() - { - return values_[56].trim(); - } - - - /** - * Returns the value of domain-defined attribute 1. - * @return The value. - **/ - public String getDomainDefinedAttributeValue1() - { - return values_[51].trim(); - } - - - /** - * Returns the value of domain-defined attribute 2. - * @return The value. - **/ - public String getDomainDefinedAttributeValue2() - { - return values_[53].trim(); - } - - - /** - * Returns the value of domain-defined attribute 3. - * @return The value. - **/ - public String getDomainDefinedAttributeValue3() - { - return values_[55].trim(); - } - - - /** - * Returns the value of domain-defined attribute 4. - * @return The value. - **/ - public String getDomainDefinedAttributeValue4() - { - return values_[57].trim(); - } - - - /** - * Returns the fax telephone number. - * @return The fax telephone number. - **/ - public String getFaxNumber() - { - return values_[21].trim(); - } - - - /** - * Returns the first name. - * @return The first name. - **/ - public String getFirstName() - { - return values_[10].trim(); - } - - - /** - * Returns the full name. - * @return The full name. - **/ - public String getFullName() - { - return values_[14].trim(); - } - - - /** - * Returns the generation qualifier. - * @return The generation qualifier. - **/ - public String getGenerationQualifier() - { - return values_[45].trim(); - } - - - /** - * Returns the given name. - * @return The given name. - **/ - public String getGivenName() - { - return values_[43].trim(); - } - - - /** - * Returns the initials. - * @return The initials. - **/ - public String getInitials() - { - return values_[44].trim(); - } - - - /** - * Returns the job title. - * @return The job title. - **/ - public String getJobTitle() - { - return values_[15].trim(); - } - - - /** - * Returns the last name. - * @return The last name. - **/ - public String getLastName() - { - return values_[13].trim(); - } - - - /** - * Returns the location. - * @return The location. - **/ - public String getLocation() - { - return values_[22].trim(); - } - - - /** - * Returns line 1 of the mailing address. - * @return The mailing address. - **/ - public String getMailingAddress1() - { - return values_[25].trim(); - } - - - /** - * Returns line 2 of the mailing address. - * @return The mailing address. - **/ - public String getMailingAddress2() - { - return values_[26].trim(); - } - - - /** - * Returns line 3 of the mailing address. - * @return The mailing address. - **/ - public String getMailingAddress3() - { - return values_[27].trim(); - } - - - /** - * Returns line 4 of the mailing address. - * @return The mailing address. - **/ - public String getMailingAddress4() - { - return values_[28].trim(); - } - - - /** - * Returns the type of mail notification. - * Possible values are: - *
            - *
          • *SPECIFIC - Notification is enabled for specific types of mail. See - * {@link #isMessageMailNotification isMessageMailNotification()} and - * {@link #isPriorityMailNotification isPriorityMailNotification()} for - * more information. - *
          • *ALLMAIL - Notification is enabled for all types of mail. - *
          • *NOMAIL - Mail notification is not enabled. - *
          - * @return The type of mail notification. - * @see #isMessageMailNotification - * @see #isPriorityMailNotification - **/ - public String getMailNotification() - { - char byte1 = values_[3].charAt(0); - if (byte1 == '1') return "*SPECIFIC"; - if (byte1 == '2') return "*ALLMAIL"; - return "*NOMAIL"; - } - - - /** - * Returns the value of the mail service level field and product ID. This - * value is blank when the mail service name is one of the special values: - * *USRIDX, *SYSMS, or *DOMINO; or the mail service level field does not - * exist in the directory entry; or the mail service level field in the - * directory entry is blank. - * @return The mail service level. - * @see #getMailServiceName - **/ - public String getMailServiceLevel() - { - String mail = values_[32]; - if (mail.length() < 22) return ""; - return mail.substring(21,mail.length()).trim(); - } - - - /** - * Returns the field name portion of the mail server framework service level. - * Special values include: - *
            - *
          • *USRIDX - User index. - *
          • *SYSMS - System message store. - *
          • *DOMINO - Lotus Domino mail database. - *
          - * @return The mail service name. - **/ - public String getMailServiceName() - { - String mail = values_[32]; - return mail.substring(0,10).trim(); - } - - - /** - * Returns the product ID portion of the mail server framework service level. - * Special values include *NONE, which indicates that there is no product ID. - * @return The mail service product ID. - **/ - public String getMailServiceProductID() - { - String mail = values_[32]; - return mail.substring(10,17).trim(); - } - - - /** - * Returns the middle name. - * @return The middle name. - **/ - public String getMiddleName() - { - return values_[12].trim(); - } - - - /** - * Returns the network user ID. - * @return The network user ID. - **/ - public String getNetworkUserID() - { - return values_[18].trim(); - } - - - /** - * Returns the office. - * @return The office. - **/ - public String getOffice() - { - return values_[24].trim(); - } - - - /** - * Returns the organization. - * @return The organization. - **/ - public String getOrganization() - { - return values_[41].trim(); - } - - - /** - * Returns organization unit 1. - * @return The organization unit. - **/ - public String getOrganizationUnit1() - { - return values_[46].trim(); - } - - - /** - * Returns organization unit 1. - * @return The organization unit. - **/ - public String getOrganizationUnit2() - { - return values_[47].trim(); - } - - - /** - * Returns organization unit 1. - * @return The organization unit. - **/ - public String getOrganizationUnit3() - { - return values_[48].trim(); - } - - - /** - * Returns organization unit 1. - * @return The organization unit. - **/ - public String getOrganizationUnit4() - { - return values_[49].trim(); - } - - - /** - * Returns the paper representation of the X.400 O/R name, - * if one exists. - * @return The X.400 O/R name. - **/ - public String getORName() - { - return values_[37].trim(); - } - - - /** - * Returns the field name portion of the preferred address. - * The field name can be a special value, user-defined field name, or an - * IBM-defined field name. Special values include: - *
            - *
          • *USRID - User ID/address. - *
          • *ORNAME - X.400 O/R name. - *
          • *SMTP - SMTP name. - *
          - * @return The preferred address name. - **/ - public String getPreferredAddressName() - { - String addr = values_[33]; - return addr.substring(0,10).trim(); - } - - - /** - * Returns the product ID portion of the preferred address. - * Special values include: - *
            - *
          • *IBM - Indicates an IBM-defined field name. - *
          • *NONE - Indicates that there is no product ID. - *
          - * @return The product ID. - **/ - public String getPreferredAddressProductID() - { - String addr = values_[33]; - return addr.substring(10,17).trim(); - } - - - /** - * Returns the address type name of the preferred address. - * @return The name of the preferred address type. - **/ - public String getPreferredAddressTypeName() - { - String addr = values_[33]; - return addr.substring(21,29).trim(); - } - - - /** - * Returns the address type value of the preferred address. - * @return The value of the preferred address type. - **/ - public String getPreferredAddressTypeValue() - { - String addr = values_[33]; - return addr.substring(17,21).trim(); - } - - - /** - * Returns the value of the preferred address field and product ID. - * This format of this String is dependent upon the preferred address name: - *
            - *
          • When the name is *USRID, the value consists of an 8-character user ID, - * 8-character user address, 8-character system name, and 8-character system group. - *
          • When the name is *ORNAME, the value consists of an X.400 O/R name formatted - * based on those fields that exist for this user, up to 909 characters. - *
          • When the name is *SMTP, the value consists of a 24-character STMP user ID and - * a 256-character SMTP domain or route, followed by an optional 64-character SMTP user ID - * (if the SMTP names are converted using the CVTNAMSMTP command). - *
          • When the name is an IBM-defined or user-defined field, the value consists of - * the field in the system distribution directory, with a maximum size of 512 characters. - *
          - * @return The value of the preferred address. - * @see #getPreferredAddressName - **/ - public String getPreferredAddressValue() - { - String addr = values_[33]; - return addr.substring(33,addr.length()).trim(); - } - - - /** - * Returns the preferred name. - * @return The preferred name. - **/ - public String getPreferredName() - { - return values_[11].trim(); - } - - - /** - * Returns the private management domain. - * @return The private management domain. - **/ - public String getPrivateManagementDomain() - { - return values_[40].trim(); - } - - - /** - * Returns the SMTP domain, if one exists. Either the SMTP domain - * or route can exist, not both. - * @return The SMTP domain. - * @see #getSMTPRoute - **/ - public String getSMTPDomain() - { - return values_[59].trim(); - } - - - /** - * Returns the SMTP route, if one exists. Either the SMTP domain - * or route can exist, not both. - * @return The SMTP route. - * @see #getSMTPDomain - **/ - public String getSMTPRoute() - { - return values_[60].trim(); - } - - - /** - * Returns the SMTP user ID, if one exists. - * @return The SMTP user ID. - **/ - public String getSMTPUserID() - { - return values_[58].trim(); - } - - - /** - * Returns the surname. - * @return The surname. - **/ - public String getSurname() - { - return values_[42].trim(); - } - - - /** - * Returns the system. - * @return The system. - **/ - public AS400 getSystem() - { - return system_; - } - - - /** - * Returns the system group of this directory entry. - * @return The system group. - **/ - public String getSystemGroup() - { - return values_[8].trim(); - } - - - /** - * Returns the system name of this directory entry. - * @return The system name. - **/ - public String getSystemName() - { - return values_[7].trim(); - } - - - /** - * Returns the first telephone number. - * @return The telephone number. - **/ - public String getTelephoneNumber1() - { - return values_[19].trim(); - } - - - /** - * Returns the second telephone number. - * @return The telephone number. - **/ - public String getTelephoneNumber2() - { - return values_[20].trim(); - } - - - /** - * Returns the text for this directory entry. This is not the same - * as the user description. - * @return The text. - **/ - public String getText() - { - return values_[31].trim(); - } - - - /** - * Returns the address of this directory entry. - * @return The address. - **/ - public String getUserAddress() - { - return values_[6].trim(); - } - - - /** - * Returns the user description field for this directory entry. - * @return The description. - **/ - public String getUserDescription() - { - return values_[9].trim(); - } - - - /** - * Returns the user ID of this directory entry. This is not the - * same as the associated user profile. - * @return The user ID (which has a maximum length of 8 characters). - * @see #getUserProfile - **/ - public String getUserID() - { - return values_[4].trim(); - } - - - /** - * Returns the user profile name associated with this entry. This is not - * the same as the entry's user ID. - * @return The user profile (which has a maximum length of 10 characters). - * @see #getUserID - **/ - public String getUserProfile() - { - return values_[0]; - } - - - /** - * Indicates if this entry represents an indirect user. This only - * applies to local directory entries. - * @return true if the user is an indirect user; false otherwise. - * @see #isLocal - **/ - public boolean isIndirectUser() - { - return values_[1].trim().equals("1"); - } - - /** - * Indicates if this entry is a local entry. - * @return true if this is a local entry; false if it is a shadowed entry. - **/ - public boolean isLocal() - { - return values_[5].trim().equals("0"); // 1 means shadowed - } - - - /** - * Indicates if this entry represents a manager. - * @return true if the user is a manager; false otherwise. - **/ - public boolean isManager() - { - return values_[36].charAt(0) == '1'; - } - - - /** - * Indicates a type of mail notification used for this entry. - * @return true if notification of messages is enabled for this entry; - * false otherwise. - * @see #getMailNotification - * @see #isPriorityMailNotification - **/ - public boolean isMessageMailNotification() - { - return values_[3].charAt(2) == '1'; - } - - - /** - * Indicates if the cover page is to be printed. This only applies to - * local directory entries. - * @return true if the cover page is to be printed; false otherwise. - * @see #isLocal - **/ - public boolean isPrintCoverPage() - { - return values_[2].trim().equals("1"); - } - - - /** - * Indicates a type of mail notification used for this entry. - * @return true if notification of priority, private, and important mail - * is enabled for this entry; false otherwise. - * @see #getMailNotification - * @see #isMessageMailNotification - **/ - public boolean isPriorityMailNotification() - { - return values_[3].charAt(1) == '1'; - } - - - /** - * Indicates whether this entry should be synchronized with directories - * other than the System Distribution Directory. - * @return true if synchronization is allowed; false otherwise. - **/ - public boolean isSynchronized() - { - return values_[34].charAt(0) == '1'; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/DirectoryEntryList.java b/cvsroot/src/com/ibm/as400/access/DirectoryEntryList.java deleted file mode 100644 index ba998347e..000000000 --- a/cvsroot/src/com/ibm/as400/access/DirectoryEntryList.java +++ /dev/null @@ -1,481 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DirectoryEntryList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.util.Enumeration; -import java.util.Hashtable; - -/** - * Retrieves a list of system distribution directory entries. - *

          - * By default, all entries are returned as if by calling addSelection(DirectoryEntryList.USER_PROFILE, "*"). - * - *

          - * AS400 system = new AS400();
          - * DirectoryEntryList list = new DirectoryEntryList(system);
          - * // Retrieves all of the entries that map to user profiles that begin with the letter 'B'.
          - * list.addSelection(DirectoryEntryList.USER_PROFILE, "B*");
          - * DirectoryEntry[] entries = list.getEntries();
          - * 
          - *

          - * Here is an example of using selection IDs: - *

          - * AS400 system = new AS400();
          - * DirectoryEntryList list = new DirectoryEntryList(system);
          - * list.addSelection(DirectoryEntryList.LAST_NAME, "SMITH");
          - * list.addSelection(DirectoryEntryList.FIRST_NAME, "C*");
          - * list.setKey(DirectoryEntryList.FIRST_NAME); // Set the primary sort to be the first name field.
          - * DirectoryEntry[] entries = list.getEntries();
          - * 
          - * - * @see com.ibm.as400.access.DirectoryEntry - * @see com.ibm.as400.access.User -**/ -public class DirectoryEntryList -{ - private static final ProgramParameter errorCode_ = new ProgramParameter(new byte[4]); - - private AS400 system_; - private String keyValue_ = null; - - private final Hashtable selectionValues_ = new Hashtable(); - - /** - * Constant used to filter the list of directory entries by mailing address. - * @see com.ibm.as400.access.DirectoryEntry#getMailingAddress1 - **/ - public static final String ADDRESS1 = "ADDR1"; - - /** - * Constant used to filter the list of directory entries by mailing address. - * @see com.ibm.as400.access.DirectoryEntry#getMailingAddress2 - **/ - public static final String ADDRESS2 = "ADDR2"; - - /** - * Constant used to filter the list of directory entries by mailing address. - * @see com.ibm.as400.access.DirectoryEntry#getMailingAddress3 - **/ - public static final String ADDRESS3 = "ADDR3"; - - /** - * Constant used to filter the list of directory entries by mailing address. - * @see com.ibm.as400.access.DirectoryEntry#getMailingAddress4 - **/ - public static final String ADDRESS4 = "ADDR4"; - - /** - * Constant used to filter the list of directory entries by building. - * @see com.ibm.as400.access.DirectoryEntry#getBuilding - **/ - public static final String BUILDING = "BLDG"; - - /** - * Constant used to filter the list of directory entries by company. - * @see com.ibm.as400.access.DirectoryEntry#getCompany - **/ - public static final String COMPANY = "CMPNY"; - - /** - * Constant used to filter the list of directory entries by department. - * @see com.ibm.as400.access.DirectoryEntry#getDepartment - **/ - public static final String DEPARTMENT = "DEPT"; - - /** - * Constant used to filter the list of directory entries by fax number. - * @see com.ibm.as400.access.DirectoryEntry#getFaxNumber - **/ - public static final String FAX = "FAXTELNBR"; - - /** - * Constant used to filter the list of directory entries by first name. - * @see com.ibm.as400.access.DirectoryEntry#getFirstName - **/ - public static final String FIRST_NAME = "FSTNAM"; - - /** - * Constant used to filter the list of directory entries by first or preferred name. - * This constant is only used as input to filter the list. Its value cannot be - * retrieved from a DirectoryEntry object. - **/ - public static final String FIRST_OR_PREFERRED_NAME = "FSTPREFNAM"; - - /** - * Constant used to filter the list of directory entries by full name. - * @see com.ibm.as400.access.DirectoryEntry#getFullName - **/ - public static final String FULL_NAME = "FULNAM"; - - /** - * Constant used to filter the list of directory entries by job title. - * @see com.ibm.as400.access.DirectoryEntry#getJobTitle - **/ - public static final String JOB_TITLE = "TITLE"; - - /** - * Constant used to filter the list of directory entries by last name. - * @see com.ibm.as400.access.DirectoryEntry#getLastName - **/ - public static final String LAST_NAME = "LSTNAM"; - - /** - * Constant used to filter the list of directory entries by location. - * @see com.ibm.as400.access.DirectoryEntry#getLocation - **/ - public static final String LOCATION = "LOC"; - - /** - * Constant used to filter the list of directory entries by middle name. - * @see com.ibm.as400.access.DirectoryEntry#getMiddleName - **/ - public static final String MIDDLE_NAME = "MIDNAM"; - - /** - * Constant used to filter the list of directory entries by network user ID. - * @see com.ibm.as400.access.DirectoryEntry#getNetworkUserID - **/ - public static final String NETWORK_USER_ID = "NETUSRID"; - - /** - * Constant used to filter the list of directory entries by office. - * @see com.ibm.as400.access.DirectoryEntry#getOffice - **/ - public static final String OFFICE = "OFC"; - - /** - * Constant used to filter the list of directory entries by preferred name. - * @see com.ibm.as400.access.DirectoryEntry#getPreferredName - **/ - public static final String PREFERRED_NAME = "PREFNAM"; - - /** - * Constant used to filter the list of directory entries by system group. - * @see com.ibm.as400.access.DirectoryEntry#getSystemGroup - **/ - public static final String SYSTEM_GROUP = "SYSGRP"; - - /** - * Constant used to filter the list of directory entries by system name. - * @see com.ibm.as400.access.DirectoryEntry#getSystemName - **/ - public static final String SYSTEM_NAME = "SYSNAME"; - - /** - * Constant used to filter the list of directory entries by telephone number. - * @see com.ibm.as400.access.DirectoryEntry#getTelephoneNumber1 - **/ - public static final String TELEPHONE1 = "TELNBR1"; - - /** - * Constant used to filter the list of directory entries by telephone number. - * @see com.ibm.as400.access.DirectoryEntry#getTelephoneNumber2 - **/ - public static final String TELEPHONE2 = "TELNBR2"; - - /** - * Constant used to filter the list of directory entries by text description. - * @see com.ibm.as400.access.DirectoryEntry#getText - **/ - public static final String TEXT = "TEXT"; - - /** - * Constant used to filter the list of directory entries by directory entry user address. - * @see com.ibm.as400.access.DirectoryEntry#getUserAddress - **/ - public static final String USER_ADDRESS = "USRADDR"; - - /** - * Constant used to filter the list of directory entries by user description. - * @see com.ibm.as400.access.DirectoryEntry#getUserDescription - **/ - public static final String USER_DESCRIPTION = "USRD"; - - /** - * Constant used to filter the list of directory entries by directory entry user ID. - * @see com.ibm.as400.access.DirectoryEntry#getUserID - **/ - public static final String USER_ID = "USRID"; - - /** - * Constant used to filter the list of directory entries by user profile name. - * @see com.ibm.as400.access.DirectoryEntry#getUserProfile - **/ - public static final String USER_PROFILE = "USER"; - - - /** - * Constructs a DirectoryEntryList. - * By default, no selection IDs have been added. You must add at least one selection ID in order - * to retrieve any directory entries. The most common way to retrieve a list of all entries on - * the system is to add a selection for USER_PROFILE with a value of "*". - * @param system The system. - **/ - public DirectoryEntryList(AS400 system) - { - if (system == null) throw new NullPointerException("system"); - system_ = system; - } - - /** - * Adds a value used to filter the list of directory entries returned by {@link #getEntries getEntries()}. - * See the list of constants in this class for some possible selection IDs. Other selection IDs - * can be used, if they are allowed by the QOKSCHD system API. - * If the specified selectionID has already been added, then the specified value will override - * the previously added value. - * @param selectionID The selectionID, e.g. {@link #LAST_NAME LAST_NAME} or {@link #USER_PROFILE USER_PROFILE}. - * @param value The value used as the filter for the specified selectionID, e.g. "SMITH" or "A*". - * The asterisk '*' is allowed as a wildcard character. - * @see #clearSelection - * @see #setKey - **/ - public void addSelection(String selectionID, String value) - { - if (selectionID == null) throw new NullPointerException("selectionID"); - if (value == null) throw new NullPointerException("value"); - if (selectionValues_.isEmpty()) - { - keyValue_ = selectionID; - } - selectionValues_.put(selectionID, value); - } - - /** - * Removes all selection IDs and values that were previously added by {@link #addSelection addSelection()}. - * This also clears the key. - * @see #addSelection - * @see #setKey - **/ - public void clearSelection() - { - selectionValues_.clear(); - keyValue_ = null; - } - - /** - * Retrieves the directory entry information from the system. - * This method internally calls the following system API: QOKSCHD - * @return An array of directory entries. - **/ - public DirectoryEntry[] getEntries() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (system_ == null) throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - if (selectionValues_.isEmpty()) addSelection(USER_PROFILE, "*"); // The default. - - ProgramParameter[] parms = new ProgramParameter[9]; - int bufferSize = 33+636*20; - final int ccsid = system_.getCcsid(); - final ConvTable conv = ConvTable.getTable(ccsid, null); - final AS400Text text10 = new AS400Text(10, ccsid); - parms[0] = new ProgramParameter(bufferSize); // receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(bufferSize)); // length of receiver variable - parms[2] = new ProgramParameter(conv.stringToByteArray("SRCV0100")); // format name of receiver variable - parms[3] = new ProgramParameter(text10.toBytes("*SEARCH")); // function - parms[4] = new ProgramParameter(new byte[] { (byte)0xF0 }); // '0' to not keep temporary resources, otherwise we'd have to call it with *CLEANUP - - // First, calculate the amount of selection bytes. - int numValues = selectionValues_.size(); - Enumeration list = selectionValues_.keys(); - int totalSelectionLength = 0; - while (list.hasMoreElements()) - { - String selectionID = (String)list.nextElement(); - String val = (String)selectionValues_.get(selectionID); - totalSelectionLength += val.length(); - } - byte[] request = new byte[130+(numValues*28)+totalSelectionLength]; - - // CCSID of data input = 0 (default to job CCSID) - // character set of data input (ignored unless CCSID is -1) - // code page of data input (ignored unless CCSID is -1) - conv.stringToByteArray("* ", request, 12, 4); // wildcard character (blank means no wildcard searches) - request[16] = (byte)0xF1; // convert receiver data ('1' = convert it to CCSID specified) - request[17] = (byte)0xF0; // data to search ('0' = only search local data, not shadowed data) - request[18] = (byte)0xF1; // run verify ('1' = verify the input parameters are valid) - request[19] = (byte)0xF0; // continuation handle ('0' for the first search) - conv.stringToByteArray(" ", request, 20, 16); // resource handle (blank for the first search) - conv.stringToByteArray("SREQ0101", request, 36, 8); // format name of the search request array - BinaryConverter.intToByteArray(130, request, 44); // offset to search request array - BinaryConverter.intToByteArray(numValues, request, 48); // number of elements in search request array - conv.stringToByteArray("SREQ0103", request, 52, 8); // format name of array of fields to return - BinaryConverter.intToByteArray(100, request, 60); // offset to array of fields to return - BinaryConverter.intToByteArray(3, request, 64); // number of elements in fields to return array - conv.stringToByteArray("SRCV0101", request, 68, 8); // format name of array of users to return - BinaryConverter.intToByteArray(0xFFFF, request, 76); // number of elements in array of users. Note: Fix this so we can chain. - conv.stringToByteArray("SRCV0112", request, 80, 8); // format name of array of fields for each user - conv.stringToByteArray(" ", request, 88, 8); // format name of the order of field names to return (blanks = order is not returned) - request[96] = (byte)0xF0; // return fields in order specified ('0' = return fields in the predefined order) - conv.stringToByteArray(" ", request, 97, 3); // reserved - // Array of fields to return: - text10.toBytes("*SYSDIR", request, 100); // special value of fields to be returned (SREQ0103) - text10.toBytes("*SMTP", request, 110); - text10.toBytes("*ORNAME", request, 120); - // Search request array: - int offset = 130; - - // Do the key first, then the rest of the selection criteria. - if (keyValue_ != null) - { - String selectionID = keyValue_; - String val = (String)selectionValues_.remove(selectionID); - int len = val.length(); - BinaryConverter.intToByteArray(28+len, request, offset); - request[offset+4] = (byte)0xF1; - text10.toBytes(selectionID, request, offset+5); - conv.stringToByteArray("*IBM ", request, offset+15, 7); - request[offset+22] = 0x40; - request[offset+23] = 0x40; - BinaryConverter.intToByteArray(len, request, offset+24); - AS400Text textConv = new AS400Text(len, ccsid); - textConv.toBytes(val, request, offset+28); - offset += 28+len; - } - - // Do the rest of the selection criteria. - list = selectionValues_.keys(); - while (list.hasMoreElements()) - { - String selectionID = (String)list.nextElement(); - String val = (String)selectionValues_.get(selectionID); - int len = val.length(); - BinaryConverter.intToByteArray(28+len, request, offset); // SREQ0101 - length of entry - request[offset+4] = (byte)0xF1; // SREQ0101 - compare value ('1' means 'equal') - text10.toBytes(selectionID, request, offset+5); // SREQ0101 - field name - conv.stringToByteArray("*IBM ", request, offset+15, 7); // SREQ0101 - product ID - request[offset+22] = 0x40; // SREQ0101 - case of data input (blank means case insensitive search except for SMTPUSRID and SMTPRTE fields) - request[offset+23] = 0x40; // reserved - BinaryConverter.intToByteArray(len, request, offset+24); // SREQ0101 - length of value - AS400Text textConv = new AS400Text(len, ccsid); - textConv.toBytes(val, request, offset+28); // SREQ0101 - value to match (blank means ignore) - offset += 28+len; - } - - parms[5] = new ProgramParameter(request); // request variable - parms[6] = new ProgramParameter(BinaryConverter.intToByteArray(request.length)); // length of request variable - parms[7] = new ProgramParameter(conv.stringToByteArray("SREQ0100")); // format name of request variable - parms[8] = errorCode_; - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QOKSCHD.PGM", parms); - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - - byte[] data = parms[0].getOutputData(); - int numReturned = BinaryConverter.byteArrayToInt(data, 0); - while ((bufferSize - numReturned) <= 636) - { - bufferSize = bufferSize*2; - try - { - parms[0].setOutputDataLength(bufferSize); - parms[1].setInputData(BinaryConverter.intToByteArray(bufferSize)); - } - catch(PropertyVetoException pve) {} - - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - data = parms[0].getOutputData(); - numReturned = BinaryConverter.byteArrayToInt(data, 0); - } - //int orderArrayOffset = BinaryConverter.byteArrayToInt(data, 4); - int userArrayOffset = BinaryConverter.byteArrayToInt(data, 8); - int numEntries = BinaryConverter.byteArrayToInt(data, 12); - byte continuationHandle = data[16]; - String resourceHandle = conv.byteArrayToString(data, 17, 16); - - DirectoryEntry[] entries = new DirectoryEntry[numEntries]; - offset = userArrayOffset; - for (int i=0; i - * If no key has been set, then the first entry added via addSelection() is used. - * @see #setKey - **/ - public String getKey() - { - return keyValue_; - } - - /** - * Returns the system. - * @return The system. - * @see #setSystem - **/ - public AS400 getSystem() - { - return system_; - } - - - /** - * Sets the primary selection ID used when searching the system distribution directory. - * If the key has not been added as a selection ID by {@link #addSelection addSelection()} - * then it has no effect on how the list is sorted when returned by {@link #getEntries getEntries()}. - *

          - * If no key has been set, then the first entry added via addSelection() is used. - * @see #addSelection - * @see #getKey - **/ - public void setKey(String selectionID) - { - keyValue_ = selectionID; - } - - - /** - * Sets the system. - * @param system The new system. - * @see #getSystem - **/ - public void setSystem(AS400 system) - { - system_ = system; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/EnvironmentVariable.java b/cvsroot/src/com/ibm/as400/access/EnvironmentVariable.java deleted file mode 100644 index 59f239eca..000000000 --- a/cvsroot/src/com/ibm/as400/access/EnvironmentVariable.java +++ /dev/null @@ -1,706 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: EnvironmentVariable.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.Serializable; - -/** - Represents an IBM i system-level environment variable. An environment variable is uniquely identified by the system and the environment variable name. Environment variable names are case sensitive and cannot contain spaces or equals signs (=). -

          This class can only access system-level environment variables. You must have *JOBCTL special authority to add, change, or delete system-level environment variables. -

          Every environment variable has a CCSID associated with it which describes the CCSID in which its contents are stored. The default CCSID is that of the current job. -

          Note that environment variables are different than system values, although they are often used for the same purpose. See SystemValue for more information on how to access system values. -

          The environment variable value and CCSID are cached after being read once. Call refreshValue() to force the value and CCSID to be refreshed. -

          The following example creates two EnvironmentVariables and sets and gets their values. -

          - *    AS400 system = new AS400("mysystem");
          - *    EnvironmentVariable fg = new EnvironmentVariable(system, "FOREGROUND");
          - *    fg.setValue("RED");
          - *
          - *    EnvironmentVariable bg = new EnvironmentVariable(system, "BACKGROUND");
          - *    String background = bg.getValue();
          - 
          - @see EnvironmentVariableList - **/ -// Implementation note: -// * Currently only system-level environment variables are supported. Job-level environment variables are not supported, since the get-value API (Qp0zGetEnv) requires the ability to call a service program procedure which returns a char*, and the ServiceProgramCall class does not support that. -// * This is probably not a major limitation, since job-level environment variables would only be valid to the program call job. However, if the ServiceProgramCall support improves in the future, then it may be worth adding the job-level support here. -public class EnvironmentVariable implements Serializable -{ - static final long serialVersionUID = 4L; - - // Service program return codes. - static final int RV_ENOENT = 3025; // No such path or directory. - static final int RV_EPERM = 3027; // The operation is not permitted. - static final int RV_ENOSPC = 3404; // No space is available. - - // Null parameter for service program calls. - static final ProgramParameter nullParameter = new ProgramParameter(); - static - { - try - { - EnvironmentVariable.nullParameter.setParameterType(ProgramParameter.PASS_BY_REFERENCE); - } - catch (PropertyVetoException e) - { - Trace.log(Trace.ERROR, "Unexpected PropertyVetoException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - // Convenience method for seting up common properties of service program call. - static ServiceProgramCall setupServiceProgramCall(AS400 system) - { - if (system == null) - { - Trace.log(Trace.ERROR, "Attempt to connect before setting system." ); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - ServiceProgramCall spc = new ServiceProgramCall(system); - try - { - spc.setProgram("/QSYS.LIB/QP0ZSYSE.SRVPGM"); - spc.suggestThreadsafe(); - spc.setReturnValueFormat(ServiceProgramCall.RETURN_INTEGER); - } - catch (PropertyVetoException e) - { - Trace.log(Trace.ERROR, "Unexpected PropertyVetoException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - return spc; - } - - // Convenience method for running service program calls. - static int runServiceProgram(ServiceProgramCall spc, String procedureName, ProgramParameter[] parameters, int rv1, int rv2) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - synchronized (spc) - { - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "Calling service program procedure: " + procedureName); - try - { - spc.setProcedureName(procedureName); - spc.setParameterList(parameters); - } - catch (PropertyVetoException e) - { - Trace.log(Trace.ERROR, "Unexpected PropertyVetoException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - if (spc.run()) - { - int rv = spc.getIntegerReturnValue(); - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "Service program procedure: " + procedureName + ", returned value: " + rv); - if (rv == 0 || rv == rv1 || rv == rv2) - { - return rv; - } - if (rv == EnvironmentVariable.RV_EPERM) - { - Trace.log(Trace.ERROR, "*JOBCTL special authority required to add, change, or delete system-level environment variable."); - throw new AS400SecurityException(AS400SecurityException.SPECIAL_AUTHORITY_INSUFFICIENT); - } - Trace.log(Trace.ERROR, "Service program return value was unexpected."); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_RETURN_CODE); - } - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "Service program procedure: " + procedureName + ", failed."); - throw new AS400Exception(spc.getMessageList()); - } - } - - // The system where the environment variable is located. - private AS400 system_ = null; - // Service program call object for running environment variable entry points. - private transient ServiceProgramCall spc_ = null; - // Converter for environment variable data. - private transient Converter converter_ = null; - - // Name of environment variable. - private String name_ = null; - // Converted name of environment variable, null terminated. - private byte[] nameBytes_ = null; - - // Value of enviroment variable. - private transient String value_ = null; - // Converted value of environment variable, null terminated. - private transient byte[] valueBytes_ = null; - - // CCSID for environment variable data. - private transient int ccsid_ = 0; - // BiDi String type. - private int stringType_ = 0; - - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_ = null; // Set on first add. - - /** - Constructs an EnvironmentVariable object. - **/ - public EnvironmentVariable() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing EnvironmentVariable object."); - } - - /** - Constructs an EnvironmentVariable object. - @param system The system on which the environment variable exists. - **/ - public EnvironmentVariable(AS400 system) - { - this(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, " system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - system_ = system; - } - - /** - Constructs an EnvironmentVariable object. -

          Environment variable names are case sensitive and cannot contain spaces or equals signs (=). - @param system The system on which the environment variable exists. - @param name The environment variable name. - **/ - public EnvironmentVariable(AS400 system, String name) - { - this(system); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, " name: '" + name + "'"); - if (name == null) - { - Trace.log(Trace.ERROR, "Parameter 'name' is null."); - throw new NullPointerException("name"); - } - if ((name.indexOf(' ') >= 0) || (name.indexOf('=') >= 0)) - { - Trace.log(Trace.ERROR, "Value of parameter 'name' is not valid: " + name); - throw new ExtendedIllegalArgumentException("name (" + name + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - name_ = name; - } - - // Implementation note: - // * This package scope constructor is intended for use when populating EnvironmentVariableList. - EnvironmentVariable(AS400 system, ServiceProgramCall spc, String name) throws IOException - { - this(system, name); - spc_ = spc; - } - - // Implementation note: - // * This package scope constructor is intended for use when populating EnvironmentVariableList. - EnvironmentVariable(AS400 system, ServiceProgramCall spc, byte[] nameBytes, byte[] valueBytes, int ccsid) throws IOException - { - this(); - system_ = system; - spc_ = spc; - converter_ = new Converter(ccsid, system); - - nameBytes_ = nameBytes; - - valueBytes_ = valueBytes; - - ccsid_ = ccsid; - stringType_ = AS400BidiTransform.getStringType(ccsid); - } - - /** - Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange() method will be called each time the value of any bound property is changed. - @param listener The listener object. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Deletes the environment variable. You must have *JOBCTL special authority to delete system-level environment variables. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void delete() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Deleting environment variable."); - if (name_ == null && nameBytes_ == null) - { - Trace.log(Trace.ERROR, "Attempt to delete before setting name."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (spc_ == null) - { - spc_ = EnvironmentVariable.setupServiceProgramCall(system_); - } - if (converter_ == null) - { - converter_ = new Converter(system_.getCcsid(), system_); - } - - if (nameBytes_ == null) - { - byte[] tempBytes = converter_.stringToByteArray(name_, stringType_); - nameBytes_ = new byte[tempBytes.length + 1]; - System.arraycopy(tempBytes, 0, nameBytes_, 0, tempBytes.length); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Name bytes:", nameBytes_); - - // Initialize the API parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, nameBytes_), - EnvironmentVariable.nullParameter - }; - int rv = runServiceProgram(spc_, "Qp0zDltSysEnv", parameters, RV_ENOENT, 0); - if (rv == EnvironmentVariable.RV_ENOENT) - { - Trace.log(Trace.ERROR, "Environment variable does not exist."); - throw new ObjectDoesNotExistException(getName(), ObjectDoesNotExistException.OBJECT_DOES_NOT_EXIST); - } - - // Clear the cache. - value_ = null; - valueBytes_ = null; - ccsid_ = 0; - stringType_ = 0; - } - - /** - Returns the environment variable CCSID. - @return The environment variable CCSID. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getCCSID() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting environment variable CCSID."); - if (ccsid_ == 0) refreshValue(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "CCSID:", ccsid_); - return ccsid_; - } - - /** - Returns the environment variable name. - @return The environment variable name. - **/ - public String getName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting environment variable name."); - if (name_ == null && nameBytes_ != null) - { - name_ = converter_.byteArrayToString(nameBytes_, 0, nameBytes_.length - 1, stringType_); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Name: " + name_); - return name_; - } - - /** - Returns the environment variable name. - @param stringType The environment variable bidi string type, as defined by the CDRA (Character Data Representataion Architecture). See BidiStringType for more information and valid values. - @return The environment variable name. - **/ - public String getName(int stringType) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting environment variable name."); - if (stringType_ != stringType && nameBytes_ != null) - { - name_ = converter_.byteArrayToString(nameBytes_, 0, nameBytes_.length - 1, stringType); - } - stringType_ = stringType; - return getName(); - } - - /** - Returns the system on which the environment variable exists. - @return The system on which the environment variable exists. If the system has not been set, null is returned. - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - /** - Returns the value of the environment variable. - @return The value. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getValue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting environment variable value."); - if (value_ == null) - { - if (valueBytes_ == null) refreshValue(); - value_ = converter_.byteArrayToString(valueBytes_, 0, valueBytes_.length - 1, stringType_); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Value: " + value_); - return value_; - } - - /** - Returns the value of the environment variable. - @param stringType The environment variable bidi string type, as defined by the CDRA (Character Data Representataion Architecture). See BidiStringType for more information and valid values. - @return The value. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getValue(int stringType) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - stringType_ = stringType; - return getValue(); - } - - // Help de-serialize the object. - private void readObject(java.io.ObjectInputStream ois) - throws IOException, ClassNotFoundException - { - // Restore the non-static and non-transient fields. - ois.defaultReadObject(); - - // Initialize the transient fields. - spc_ = null; - converter_ = null; - value_ = null; - valueBytes_ = null; - ccsid_ = 0; - propertyChangeListeners_ = null; - } - - /** - Refreshes the environment variable value and CCSID. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void refreshValue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Refreshing environment variable value."); - if (name_ == null && nameBytes_ == null) - { - Trace.log(Trace.ERROR, "Attempt to refresh before setting name."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (spc_ == null) - { - spc_ = EnvironmentVariable.setupServiceProgramCall(system_); - } - if (converter_ == null) - { - converter_ = new Converter(system_.getCcsid(), system_); - } - - if (nameBytes_ == null) - { - byte[] tempBytes = converter_.stringToByteArray(name_, stringType_); - nameBytes_ = new byte[tempBytes.length + 1]; - System.arraycopy(tempBytes, 0, nameBytes_, 0, tempBytes.length); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Name bytes:", nameBytes_); - - ProgramParameter[] parameters = new ProgramParameter[] - { - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, nameBytes_), - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, 1024), - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, new byte[] { 0x00, 0x00, 0x04, 0x00 }, 4), - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, 4), - EnvironmentVariable.nullParameter - }; - int rv = runServiceProgram(spc_, "Qp0zGetSysEnv", parameters, EnvironmentVariable.RV_ENOSPC, EnvironmentVariable.RV_ENOENT); - - // If the size came back as ENOSPC, then call it again with the correct amount of bytes. - int actualValueSize = BinaryConverter.byteArrayToInt(parameters[2].getOutputData(), 0); - if (rv == EnvironmentVariable.RV_ENOSPC) - { - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "ENOSPC returned, getting environment variable again with " + actualValueSize + " bytes."); - try - { - parameters[1].setOutputDataLength(actualValueSize); - parameters[2].setInputData(BinaryConverter.intToByteArray(actualValueSize)); - } - catch (PropertyVetoException e) - { - Trace.log(Trace.ERROR, "Unexpected PropertyVetoException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - runServiceProgram(spc_, "Qp0zGetSysEnv", parameters, 0, 0); - } - else if (rv == EnvironmentVariable.RV_ENOENT) - { - Trace.log(Trace.ERROR, "Environment variable does not exist."); - throw new ObjectDoesNotExistException(getName(), ObjectDoesNotExistException.OBJECT_DOES_NOT_EXIST); - } - - // Get the value. - valueBytes_ = new byte[actualValueSize]; - System.arraycopy(parameters[1].getOutputData(), 0, valueBytes_, 0, actualValueSize); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Value bytes:", valueBytes_); - value_ = null; - - // Get the ccsid. - int ccsid = BinaryConverter.byteArrayToInt(parameters[3].getOutputData(), 0); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "CCSID:", ccsid); - if (ccsid != ccsid_) - { - converter_ = new Converter(ccsid, system_); - ccsid_ = ccsid; - stringType_ = AS400BidiTransform.getStringType(ccsid); - } - } - - /** - Removes the PropertyChangeListener. - @param listener The listener object. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Sets the environment variable name. This does not change the environment variable name on the system. Instead, it changes the environment variable to which this EnvironmentVariable object references. -

          Environment variable names are case sensitive and cannot contain spaces or equals signs (=). - @param name The environment variable name. - **/ - public void setName(String name) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting environment variable name: '" + name + "'"); - if (name == null) - { - Trace.log(Trace.ERROR, "Parameter 'name' is null."); - throw new NullPointerException("name"); - } - if ((name.indexOf(' ') >= 0) || (name.indexOf('=') >= 0)) - { - Trace.log(Trace.ERROR, "Value of parameter 'name' is not valid: " + name); - throw new ExtendedIllegalArgumentException("name (" + name + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Clear the cache. - nameBytes_ = null; - value_ = null; - valueBytes_ = null; - ccsid_ = 0; - stringType_ = 0; - - if (propertyChangeListeners_ == null) - { - name_ = name; - } - else - { - String oldValue = name_; - String newValue = name; - name_ = newValue; - propertyChangeListeners_.firePropertyChange("name", oldValue, newValue); - } - } - - /** - Sets the environment variable name. This does not change the environment variable name on the system. Instead, it changes the environment variable to which this EnvironmentVariable object references. -

          Environment variable names are case sensitive and cannot contain spaces or equals signs (=). - @param name The environment variable name. - @param stringType The environment variable bidi string type, as defined by the CDRA (Character Data Representataion Architecture). See BidiStringType for more information and valid values. - **/ - public void setName(String name, int stringType) - { - setName(name); - stringType_ = stringType; - } - - /** - Sets the system for the environment variable. The system cannot be changed once a connection is made to the system. - @param system The system on which the environment variable exists. - **/ - public void setSystem(AS400 system) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (spc_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null) - { - system_ = system; - } - else - { - AS400 oldValue = system_; - AS400 newValue = system; - system_ = newValue; - propertyChangeListeners_.firePropertyChange("system", oldValue, newValue); - } - } - - /** - Sets the value of the environment variable. The CCSID will be set to the job CCSID. You must have *JOBCTL special authority to add or change system-level environment variables. - @param value The value. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setValue(String value) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setValue(value, 0, 0); - } - - /** - Sets the value of the environment variable. You must have *JOBCTL special authority to add or change system-level environment variables. - @param value The value. - @param ccsid The CCSID. Possible values are: -

            -
          • 0 - Use the job CCSID. -
          • 65535 - Do not translate. -
          • Any valid CCSID -
          - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setValue(String value, int ccsid) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setValue(value, ccsid, AS400BidiTransform.getStringType(ccsid)); - } - - /** - Sets the value of the environment variable. You must have *JOBCTL special authority to add or change system-level environment variables. - @param value The value. - @param ccsid The CCSID. Possible values are: -
            -
          • 0 - Use the job CCSID. -
          • 65535 - Do not translate. -
          • Any valid CCSID -
          - @param stringType The environment variable bidi string type, as defined by the CDRA (Character Data Representataion Architecture). See BidiStringType for more information and valid values. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setValue(String value, int ccsid, int stringType) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting environment variable value: '" + value + "', ccsid: " + ccsid + ", string type: " + stringType); - if (value == null) - { - Trace.log(Trace.ERROR, "Parameter 'value' is null."); - throw new NullPointerException("value"); - } - if ((ccsid < 0) || (ccsid > 65535)) - { - Trace.log(Trace.ERROR, "Value of parameter 'ccsid' is not valid:", ccsid); - throw new ExtendedIllegalArgumentException("ccsid (" + ccsid + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (name_ == null && nameBytes_ == null) - { - Trace.log(Trace.ERROR, "Attempt to set value before setting name."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (spc_ == null) - { - spc_ = EnvironmentVariable.setupServiceProgramCall(system_); - } - - if (ccsid == 0) ccsid = system_.getCcsid(); - converter_ = new Converter(ccsid, system_); - ccsid_ = ccsid; - stringType_ = stringType; - - if (nameBytes_ == null) - { - byte[] tempBytes = converter_.stringToByteArray(name_, stringType_); - nameBytes_ = new byte[tempBytes.length + 1]; - System.arraycopy(tempBytes, 0, nameBytes_, 0, tempBytes.length); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Name bytes:", nameBytes_); - - byte[] tempBytes = converter_.stringToByteArray(value, stringType_); - valueBytes_ = new byte[tempBytes.length + 1]; - System.arraycopy(tempBytes, 0, valueBytes_, 0, tempBytes.length); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Value bytes:", valueBytes_); - - // Build the byte array for the environment variable. - // Length is name length - one byte for null + one byte for equal sign + value length (including the null). - byte[] parameterBytes = new byte[nameBytes_.length + valueBytes_.length]; - - // Copy each part into the parameter byte array. - System.arraycopy(nameBytes_, 0, parameterBytes, 0, nameBytes_.length - 1); - parameterBytes[nameBytes_.length - 1] = 0x7E; // EBCCIC equal (=). - System.arraycopy(valueBytes_, 0, parameterBytes, nameBytes_.length, valueBytes_.length); - - // Initialize the program parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, parameterBytes), - new ProgramParameter(ProgramParameter.PASS_BY_VALUE, BinaryConverter.intToByteArray(ccsid)), - EnvironmentVariable.nullParameter - }; - runServiceProgram(spc_, "Qp0zPutSysEnv", parameters, 0, 0); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/EnvironmentVariable16.gif b/cvsroot/src/com/ibm/as400/access/EnvironmentVariable16.gif deleted file mode 100644 index 81269504b..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/EnvironmentVariable16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/EnvironmentVariable32.gif b/cvsroot/src/com/ibm/as400/access/EnvironmentVariable32.gif deleted file mode 100644 index 4c1d26243..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/EnvironmentVariable32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/EnvironmentVariableBeanInfo.java b/cvsroot/src/com/ibm/as400/access/EnvironmentVariableBeanInfo.java deleted file mode 100644 index e607fe7bf..000000000 --- a/cvsroot/src/com/ibm/as400/access/EnvironmentVariableBeanInfo.java +++ /dev/null @@ -1,143 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: EnvironmentVariableBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2000-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - -/** - The EnvironmentVariableBeanInfo class represents the bean information for the EnvironmentVariable class. - **/ -public class EnvironmentVariableBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 2000-2003 International Business Machines Corporation and others."; - - // Class this bean info represents. - private static final Class BEAN_CLASS = EnvironmentVariable.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - // Set up the event descriptors. - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - eventSetDescriptors = new EventSetDescriptor[] { propertyChange }; - - // Set up the property descriptors. - PropertyDescriptor name = new PropertyDescriptor("name", BEAN_CLASS); - name.setBound(true); - name.setConstrained(false); - name.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_NAME")); - name.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_NAME")); - - PropertyDescriptor system = new PropertyDescriptor("system", BEAN_CLASS); - system.setBound(true); - system.setConstrained(false); - system.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - - propertyDescriptors = new PropertyDescriptor[] { name, system }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return Zero (0), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "propertyChange" event. - return 0; - } - - /** - Returns the index of the default property. - @return Zero (0), the index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // The index for the "name" property. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param iconKind The desired icon size and color. Possible values are: -
            -
          • BeanInfo.ICON_MONO_16x16 -
          • BeanInfo.ICON_MONO_32x32 -
          • BeanInfo.ICON_COLOR_16x16 -
          • BeanInfo.ICON_COLOR_32x32 -
          - @return The Image for the icon. - **/ - public Image getIcon(int iconKind) - { - switch (iconKind) - { - case ICON_MONO_16x16: - case ICON_COLOR_16x16: - return loadImage("EnvironmentVariable16.gif"); - case ICON_MONO_32x32: - case ICON_COLOR_32x32: - return loadImage("EnvironmentVariable32.gif"); - default: - Trace.log(Trace.ERROR, "Value of parameter 'iconKind' is not valid:", iconKind); - throw new ExtendedIllegalArgumentException("iconKind (" + iconKind + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/EnvironmentVariableList.java b/cvsroot/src/com/ibm/as400/access/EnvironmentVariableList.java deleted file mode 100644 index 4f228c660..000000000 --- a/cvsroot/src/com/ibm/as400/access/EnvironmentVariableList.java +++ /dev/null @@ -1,330 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: EnvironmentVariableList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2000-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.Serializable; -import java.util.Enumeration; -import java.util.Properties; -import java.util.Vector; - -/** - The EnvironmentVariableList class represents a list of IBM i system-level environment variables. -

          This class can only access system-level environment variables. You must have *JOBCTL special authority to add, change, or delete system-level environment variables. -

          This example gets the list of environment variables as a java.util.Properties object: -

          - *    AS400 system = new AS400("mysystem");
          - *    EnvironmentVariableList evList = new EnvironmentVariableList(system);
          - *    Properties p = evList.getProperties();
          - 
          -

          This example uses an Enumeration to print the list of environment variable names and values: -

          - *    AS400 system = new AS400("mysystem");
          - *    EnvironmentVariableList evList = new EnvironmentVariableList(system);
          - *    Enumeration list = evList.getEnvironmentVariables();
          - *    while (list.hasMoreElements())
          - *    {
          - *        EnvironmentVariable ev = (EnvironmentVariable)list.nextElement();
          - *        System.out.println(ev.getName() + "=" + ev.getValue());
          - *    }
          - 
          - @see EnvironmentVariable - **/ -// Implementation note: -// * There is currently no API to get a list of job-level environment variables. This is not available since C programs can get the list via the ENVIRON environment variable. -public class EnvironmentVariableList implements Serializable -{ - static final long serialVersionUID = 4L; - - private AS400 system_ = null; - private transient ServiceProgramCall spc_ = null; - - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_ = null; // Set on first add. - - /** - Constructs a EnvironmentVariableList object. - **/ - public EnvironmentVariableList() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing EnvironmentVariableList object."); - } - - /** - Constructs a EnvironmentVariableList object. - @param system The system. - **/ - public EnvironmentVariableList(AS400 system) - { - this(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, " system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - system_ = system; - } - - /** - Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange() method will be called each time the value of any bound property is changed. - @param listener The listener object. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Returns an enumeration that contains an EnvironmentVariable object for each environment variable on the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Enumeration getEnvironmentVariables() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting environment variables."); - if (spc_ == null) - { - spc_ = EnvironmentVariable.setupServiceProgramCall(system_); - } - - ProgramParameter[] parameters = new ProgramParameter[] - { - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, 4096), - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, new byte[] { 0x00, 0x00, 0x10, 0x00 }, 4), - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, 1024), - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, new byte[] { 0x00, 0x00, 0x04, 0x00 }, 4), - EnvironmentVariable.nullParameter - }; - - int rv = EnvironmentVariable.runServiceProgram(spc_, "Qp0zGetAllSysEnv", parameters, EnvironmentVariable.RV_ENOSPC, EnvironmentVariable.RV_ENOENT); - - int actualListBufferSize = BinaryConverter.byteArrayToInt(parameters[1].getOutputData(), 0); - int actualCcsidBufferSize = BinaryConverter.byteArrayToInt(parameters[3].getOutputData(), 0); - // If the size came back as ENOSPC, then call it again with the correct amount of bytes. - if (rv == EnvironmentVariable.RV_ENOSPC) - { - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "ENOSPC returned, getting environment variable list again with " + actualListBufferSize + " bytes for the list and " + actualCcsidBufferSize + " bytes for the ccsids."); - try - { - parameters[0].setOutputDataLength(actualListBufferSize); - parameters[1].setInputData(BinaryConverter.intToByteArray(actualListBufferSize)); - parameters[2].setOutputDataLength(actualCcsidBufferSize); - parameters[3].setInputData(BinaryConverter.intToByteArray(actualCcsidBufferSize)); - } - catch (PropertyVetoException e) - { - Trace.log(Trace.ERROR, "Unexpected PropertyVetoException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - EnvironmentVariable.runServiceProgram(spc_, "Qp0zGetAllSysEnv", parameters, 0, 0); - } - // If ENOENT is returned, then there are no environment variables. - else if (rv == EnvironmentVariable.RV_ENOENT) - { - return new Vector().elements(); - } - - // Build up a Vector of EnvironmentVariable objects. - Vector list = new Vector(); - int offsetIntoListBuffer = 0; - int offsetIntoCcsidBuffer = 0; - byte[] listBufferBytes = parameters[0].getOutputData(); - byte[] ccsidBufferBytes = parameters[2].getOutputData(); - - do - { - // Find the EBCDIC equals (=). - int equalPosition = offsetIntoListBuffer; - while (listBufferBytes[equalPosition] != 0x7E) ++equalPosition; - - // Find the null. - int nullPosition = equalPosition; - while (listBufferBytes[nullPosition] != 0) ++nullPosition; - - // Get the name, make null terminated. - byte[] nameBytes = new byte[equalPosition - offsetIntoListBuffer + 1]; - System.arraycopy(listBufferBytes, offsetIntoListBuffer, nameBytes, 0, nameBytes.length - 1); - // Get the value, make null terminated. - byte[] valueBytes = new byte[nullPosition - equalPosition]; - System.arraycopy(listBufferBytes, equalPosition + 1, valueBytes, 0, valueBytes.length - 1); - - // Get the CCSID. - int ccsid = BinaryConverter.byteArrayToInt(ccsidBufferBytes, offsetIntoCcsidBuffer); - - // Create the EnvironmentVariable object, add it to vector. - list.addElement(new EnvironmentVariable(system_, spc_, nameBytes, valueBytes, ccsid)); - - // Get ready for the next iteration. - offsetIntoListBuffer = nullPosition + 1; - offsetIntoCcsidBuffer += 4; - - // Until ending null terminator. - } while (listBufferBytes[offsetIntoListBuffer] != 0); - - return list.elements(); - } - - /** - Returns a new Properties object which contains an entry for each environment variable in the list. - @return The new Properties object. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Properties getProperties() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting environment variables as Properties."); - Properties properties = new Properties(); - Enumeration list = getEnvironmentVariables(); - while (list.hasMoreElements()) - { - EnvironmentVariable environmentVariable = (EnvironmentVariable)list.nextElement(); - properties.put(environmentVariable.getName(), environmentVariable.getValue()); - } - return properties; - } - - /** - Returns the system on which the environment variable list exists. - @return The system on which the environment variable list exists. If the system has not been set, null is returned. - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - /** - Removes a PropertyChangeListener. - @param listener The listener object. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Sets the value of each environment variable defined in a Properties object. - @param properties The Properties object. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setProperties(Properties properties) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Set string type to -1 to signal lookup based on CCSID. - setProperties(properties, -1); - } - - /** - Sets the value of each environment variable defined in a Properties object. - @param properties The Properties object. - @param stringType The environment variable bidi string type, as defined by the CDRA (Character Data Representataion Architecture). See {@link com.ibm.as400.access.BidiStringType BidiStringType} for more information and valid values. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setProperties(Properties properties, int stringType) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting environment variables from Properties."); - if (properties == null) - { - Trace.log(Trace.ERROR, "Parameter 'properties' is null."); - throw new NullPointerException("properties"); - } - if (spc_ == null) - { - spc_ = EnvironmentVariable.setupServiceProgramCall(system_); - } - - if (stringType == -1) stringType = AS400BidiTransform.getStringType(system_.getCcsid()); - - Enumeration propertyNames = properties.propertyNames(); - while (propertyNames.hasMoreElements()) - { - String propertyName = (String)propertyNames.nextElement(); - EnvironmentVariable environmentVariable = new EnvironmentVariable(system_, spc_, propertyName); - environmentVariable.setValue(properties.getProperty(propertyName), 0, stringType); - } - } - - /** - Sets the system for the environment variable list. The system cannot be changed once a connection is made to the system. - @param system The system on which the environment variable list exists. - **/ - public void setSystem(AS400 system) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (spc_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null) - { - system_ = system; - } - else - { - AS400 oldValue = system_; - AS400 newValue = system; - system_ = newValue; - propertyChangeListeners_.firePropertyChange("system", oldValue, newValue); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/EnvironmentVariableList16.gif b/cvsroot/src/com/ibm/as400/access/EnvironmentVariableList16.gif deleted file mode 100644 index e7d4bf4a4..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/EnvironmentVariableList16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/EnvironmentVariableList32.gif b/cvsroot/src/com/ibm/as400/access/EnvironmentVariableList32.gif deleted file mode 100644 index 2a6f57c33..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/EnvironmentVariableList32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/EnvironmentVariableListBeanInfo.java b/cvsroot/src/com/ibm/as400/access/EnvironmentVariableListBeanInfo.java deleted file mode 100644 index 623d5f7d8..000000000 --- a/cvsroot/src/com/ibm/as400/access/EnvironmentVariableListBeanInfo.java +++ /dev/null @@ -1,137 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: EnvironmentVariableListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2000-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - -/** - The EnvironmentVariableListBeanInfo class represents the bean information for the EnvironmentVariableList class. - **/ -public class EnvironmentVariableListBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 2000-2003 International Business Machines Corporation and others."; - - // Class this bean info represents. - private static final Class BEAN_CLASS = EnvironmentVariableList.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - // Set up the event descriptors. - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - eventSetDescriptors = new EventSetDescriptor[] { propertyChange }; - - // Set up the property descriptors. - PropertyDescriptor system = new PropertyDescriptor("system", BEAN_CLASS); - system.setBound(true); - system.setConstrained(false); - system.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - - propertyDescriptors = new PropertyDescriptor[] { system }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return Zero (0), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "propertyChange" event. - return 0; - } - - /** - Returns the index of the default property. - @return Zero (0), the index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // The index for the "system" property. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param iconKind The desired icon size and color. Possible values are: -
            -
          • BeanInfo.ICON_MONO_16x16 -
          • BeanInfo.ICON_MONO_32x32 -
          • BeanInfo.ICON_COLOR_16x16 -
          • BeanInfo.ICON_COLOR_32x32 -
          - @return The Image for the icon. - **/ - public Image getIcon(int iconKind) - { - switch (iconKind) - { - case ICON_MONO_16x16: - case ICON_COLOR_16x16: - return loadImage("EnvironmentVariableList16.gif"); - case ICON_MONO_32x32: - case ICON_COLOR_32x32: - return loadImage("EnvironmentVariableList32.gif"); - default: - Trace.log(Trace.ERROR, "Value of parameter 'iconKind' is not valid:", iconKind); - throw new ExtendedIllegalArgumentException("iconKind (" + iconKind + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ErrnoException.java b/cvsroot/src/com/ibm/as400/access/ErrnoException.java deleted file mode 100644 index 110f80358..000000000 --- a/cvsroot/src/com/ibm/as400/access/ErrnoException.java +++ /dev/null @@ -1,45 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ErrnoException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - The ErrnoException class represents an exception that indicates that an errno has been returned by a system API. The AS400Message corresponding to the errno is set, however the load() method must be called to retrieve the text and help. -**/ -public class ErrnoException extends AS400Exception -{ - static final long serialVersionUID = 4L; - - int errno_; - - ErrnoException(AS400 system, int errno) - { - super(createMessage(system, errno)); - errno_ = errno; - } - - public int getErrno() - { - return errno_; - } - - private static AS400Message createMessage(AS400 system, int errno) - { - AS400Message msg = new AS400Message(); - msg.setFileName("QCPFMSG"); - msg.setID("CPE" + errno); - msg.setLibraryName("*LIBL"); - msg.setSystem(system); - return msg; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ErrorCodeParameter.java b/cvsroot/src/com/ibm/as400/access/ErrorCodeParameter.java deleted file mode 100644 index 9b268302a..000000000 --- a/cvsroot/src/com/ibm/as400/access/ErrorCodeParameter.java +++ /dev/null @@ -1,289 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ErrorCodeParameter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2009-2009 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.beans.PropertyVetoException; - -/** - Represents an IBM i "error code parameter". -

          - An API error code parameter is a variable-length structure that is common to most of the system APIs. The error code parameter controls how errors are returned to the application. - The error code parameter must be initialized before the application calls the API. Depending on how the error code structure is set, this parameter either returns information associated with an error condition, or causes the Toolbox to return the errors as AS400Message objects. - For some APIs, the error code parameter is optional. If you do not code the optional error code parameter, the API returns both diagnostic and escape messages. If you do code the optional error code parameter, the API returns only escape messages or error codes, and never returns diagnostic messages. - @see ProgramCall - @see ServiceProgramCall - @see AS400Message - **/ -public class ErrorCodeParameter extends ProgramParameter implements Serializable -{ - static final long serialVersionUID = 4L; - - private static final boolean DEBUG = false; - - private static final boolean FORMAT_ERRC0100 = true; - private static final boolean FORMAT_ERRC0200 = false; - private final static int CCSID_EBCDIC = 37; // the CCSID for standard EBCDIC - - private CharConverter charConverter_; - private boolean format_; - private boolean returnSubstitutionData_; - private boolean usedMinimalConstructor_; - - - /** - Constructs a simple default ErrorCodeParameter object. - The error information resulting from the API execution will be returned as AS400Message objects, which can be accessed via {@link ProgramCall#getMessageList ProgramCall.getMessageList()} or {@link ServiceProgramCall#getMessageList ServiceProgramCall.getMessageList()}. -
          Note: This is the constructor that is recommended for the vast majority of applications. - @see AS400Message - **/ - public ErrorCodeParameter() - { - // Set the "bytes provided" input parameter to 0, which indicates: - // "If an error occurs, an exception is returned to the application to indicate that the requested function failed." - super(BinaryConverter.intToByteArray(0), 8); // minimum output length is 8 - - format_ = FORMAT_ERRC0100; - returnSubstitutionData_ = false; - usedMinimalConstructor_ = true; - } - - - /** - Constructs an ErrorCodeParameter object. - The error information resulting from the API execution will be returned as output data in the error code parameter, rather than as AS400Message objects. - To retrieve the error information, call {@link #getMessageID getMessageID()} and {@link #getSubstitutionData getSubstitutionData()}. -

          Usage note: This constructor creates error code parameters which cause the run() methods of ProgramCall and ServiceProgramCall to return true even if the called program failed. With this constructor, in order to detect program failure the application must examine the error information returned in the ErrorCodeParameter. - @param returnSubstitutionData Whether the error information returned from the system is to include error message substitution data. - The default is false; that is, error message substitution data is not returned. - @param useCCHAR Whether convertible character (CCHAR) support is to be used. - The default is false; that is, CCHAR support is not used. - @see ProgramCall#run() - @see ServiceProgramCall#run() - **/ - public ErrorCodeParameter(boolean returnSubstitutionData, boolean useCCHAR) - { - returnSubstitutionData_ = returnSubstitutionData; - usedMinimalConstructor_ = false; - - if (useCCHAR) format_ = FORMAT_ERRC0200; - else format_ = FORMAT_ERRC0100; - - try - { - int offsetOfBytesProvidedField; // offset of the "bytes provided" field - byte[] inputData; - int outputDataLength; - // Note: Even though some fields are specified as INPUT, _all_ of the fields are actually returned in the output. Therefore we must include the sizes of the INPUT fields in the parameter's "output data length". - - if (format_ == FORMAT_ERRC0100) // 4 bytes of input, 12(+) bytes of output. - { - // Error Code format ERRC0100: - // - // Offset | Use | Type | Field - // - // Dec Hex - // 0 0 INPUT BINARY(4) Bytes provided - // 4 4 OUTPUT BINARY(4) Bytes available - // 8 8 OUTPUT CHAR(7) Exception ID - // 15 F OUTPUT CHAR(1) Reserved - // 16 10 OUTPUT CHAR(*) Exception data - - outputDataLength = 16; // total length of fixed-length fields - offsetOfBytesProvidedField = 0; // "bytes provided" is 1st input field - inputData = new byte[4]; - } - - else // format_ == FORMAT_ERRC0200: 8 bytes of input, 24(+) bytes of output. - { - // Error Code format ERRC0200: - // - // Offset | Use | Type | Field - // - // Dec Hex - // 0 0 INPUT BINARY(4) Key ( must be -1 ) - // 4 4 INPUT BINARY(4) Bytes provided - // 8 8 OUTPUT BINARY(4) Bytes available - // 12 C OUTPUT CHAR(7) Exception ID - // 19 13 OUTPUT CHAR(1) Reserved - // 20 14 OUTPUT BINARY(4) CCSID of the CCHAR data - // 24 18 OUTPUT BINARY(4) Offset to the exception data - // 28 1C OUTPUT BINARY(4) Length of the exception data - // 32 20 OUTPUT CHAR(*) Exception data - - outputDataLength = 32; // total length of fixed-length fields - offsetOfBytesProvidedField = 4; // "bytes provided" is 2nd input field - - // Note: Setting the first input field ("key") to -1 indicates that CCHAR support is used. - inputData = new byte[8]; // two BINARY(4) input fields - BinaryConverter.intToByteArray(-1, inputData, 0); // key == -1 - } - - if (returnSubstitutionData) { - // Add 100 extra output bytes, to accommodate returned "exception data". - outputDataLength += 100; - } - - // Set the "bytes provided" input field, to the output data length. - BinaryConverter.intToByteArray(outputDataLength, inputData, offsetOfBytesProvidedField); - - // Set the input data for this ProgramParameter object. - setInputData(inputData); - - // Set the output data length for this ProgramParameter object. - setOutputDataLength(outputDataLength); - } - catch (PropertyVetoException e) // will never happen - { - Trace.log(Trace.ERROR, e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - } - - - /** - Returns the CCSID of the error message substitution data. - 0 is returned if no data CCSID has been returned from the system. - @return The CCSID of the substitution data. - Note that special CCSID value 65535 indicates "no character conversion is to be performed". - @see #getSubstitutionData - **/ - int getDataCCSID() - { - // Design note: Since getSubstitutionData() pre-converts the returned substitution text to Unicode, we do not surface this method, since it might confuse the user. - if (format_ != FORMAT_ERRC0200) return 0; - - final byte[] outputData = getOutputData(); - if (outputData == null) return 0; - final int offsetToCCSID = 20; - - if (outputData.length < (offsetToCCSID+4)) - { - Trace.log(Trace.ERROR, "Output data buffer is too short: " + outputData.length + " bytes. Minimum size required: " + (offsetToCCSID+4)); - throw new InternalErrorException(InternalErrorException.UNKNOWN, "Output buffer too short."); - } - - return BinaryConverter.byteArrayToInt(outputData, offsetToCCSID); - } - - - /** - Returns the error message ID that was returned in the error code parameter. - For example: "CPF7B03". - Null is returned if no message ID has been returned from the system. - @return The message ID. - **/ - public String getMessageID() - { - if (usedMinimalConstructor_) return null; - final byte[] outputData = getOutputData(); - if (outputData == null) return null; - - final int offsetToID = (format_ == FORMAT_ERRC0100 ? 8 : 12); - - if (outputData.length < (offsetToID+7)) - { - Trace.log(Trace.ERROR, "Output data buffer is too short: " + outputData.length + " bytes. Minimum size required: " + (offsetToID+7)); - throw new InternalErrorException(InternalErrorException.UNKNOWN, "Output buffer too short."); - } - - String exceptionID = getCharConverter().byteArrayToString(outputData, offsetToID, 7).trim(); - if (exceptionID.length() == 0) { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Blank message ID returned."); - return null; - } - else return exceptionID; - } - - - /** - Returns the error message substitution data that was returned in the error code parameter. - Null is returned if no error information has been returned from the system. - To insert the data into the message, call {@link MessageFile#getMessage(String,String) MessageFile.getMessage(String,String)}. - @return The substitution data. - **/ - public String getSubstitutionData() - { - if (!returnSubstitutionData_) return null; - - final byte[] outputData = getOutputData(); - if (outputData == null) return null; - - final int offsetToBytesAvail = (format_ == FORMAT_ERRC0100 ? 4 : 8); - final int offsetToData = (format_ == FORMAT_ERRC0100 ? 16 : 32); - - if (outputData.length < (offsetToData+1)) - { - Trace.log(Trace.ERROR, "Output data buffer is too short: " + outputData.length + " bytes. Minimum size required: " + (offsetToData+1)); - throw new InternalErrorException(InternalErrorException.UNKNOWN, "Output buffer too short."); - } - - final int bytesAvailable = BinaryConverter.byteArrayToInt(outputData, offsetToBytesAvail); - - int lengthOfExceptionData; - if (format_ == FORMAT_ERRC0100) { - lengthOfExceptionData = bytesAvailable - 16; - // Omit the length of the fixed-length fields (16 bytes). - } - else { - // Get the value of the "length of exception data" field. - lengthOfExceptionData = BinaryConverter.byteArrayToInt(outputData, 28); - } - - String exceptionData; - int ccsid = getDataCCSID(); - if (ccsid == 0 || ccsid == 65535) { - exceptionData = getCharConverter().byteArrayToString(outputData, offsetToData, lengthOfExceptionData); // use our default converter (EBCDIC) - } - else // Use the CCSID returned in the field "CCSID of the CCHAR data". - { - try { - CharConverter conv = new CharConverter(ccsid); - exceptionData = conv.byteArrayToString(outputData, offsetToData, lengthOfExceptionData); - } - catch (java.io.UnsupportedEncodingException e) { - Trace.log(Trace.ERROR, "Received UnsupportedEncodingException for CCSID " + ccsid, e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - } - - return exceptionData; - } - - - private CharConverter getCharConverter() - { - try - { - if (charConverter_ == null) charConverter_ = new CharConverter(CCSID_EBCDIC); - return charConverter_; - } - catch (java.io.UnsupportedEncodingException e) // will never happen - { - Trace.log(Trace.ERROR, "Received UnsupportedEncodingException for CCSID " + CCSID_EBCDIC, e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - } - - - // Deserialize and initialize transient data. - private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "De-serializing ErrorCodeParameter object."); - in.defaultReadObject(); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/ErrorCompletingRequestException.java b/cvsroot/src/com/ibm/as400/access/ErrorCompletingRequestException.java deleted file mode 100644 index 74f2fe0d6..000000000 --- a/cvsroot/src/com/ibm/as400/access/ErrorCompletingRequestException.java +++ /dev/null @@ -1,196 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ErrorCompletingRequestException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** - The ErrorCompletingRequestException class represents - an exception that indicates an error occurred - that prevented the request from completing. -**/ -public class ErrorCompletingRequestException extends Exception - implements ReturnCodeException -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - private int rc_; // Return code associated with this exception - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - - - // Return code values used by this class. - // If a value is added here, it must also be added to MRI.properties. - - - /** - The return code indicating that - an error has occurred on the system. - **/ - public static final int AS400_ERROR = 1; - /** - The return code indicating that - an error occurred while processing the exit point. - **/ - public static final int EXIT_POINT_PROCESSING_ERROR = 2; - /** - The return code indicating that - an error occurred with the user exit program call. - **/ - public static final int EXIT_PROGRAM_CALL_ERROR = 3; - /** - The return code indicating that - the user exit program associated with the server job rejected - the request. - **/ - public static final int EXIT_PROGRAM_DENIED_REQUEST = 4; - /** - The return code indicating that - the user exit program associated with the server job failed. - **/ - public static final int EXIT_PROGRAM_ERROR = 5; - /** - The return code indicating that - the user exit program associated with the server job could - not be found. - **/ - public static final int EXIT_PROGRAM_NOT_FOUND = 6; - /** - The return code indicating that - the number of user exit programs associated - with the server job is not valid. - **/ - public static final int EXIT_PROGRAM_NUMBER_NOT_VALID = 7; - /** - The return code indicating that - an error occurred when resolving to the exit program. - **/ - public static final int EXIT_PROGRAM_RESOLVE_ERROR = 8; - /** - The return code indicating that - the system resource has a length that is not valid or cannot - be handled through this interface. - **/ - public static final int LENGTH_NOT_VALID = 9; - /** - The return code indicating that - the exact cause of the failure is not known. The detailed message - may contain additional information. - **/ - public static final int UNKNOWN = 11; - /** - The return code indicating that - the spooled file does not have a - message waiting. - **/ - public static final int SPOOLED_FILE_NO_MESSAGE_WAITING = 12; - /** - The return code indicating that - the writer job has ended. - **/ - public static final int WRITER_JOB_ENDED = 13; - - - - - - - // Required for AS400Exception class. - /** - Constructs an ErrorCompletingRequestException object. It indicates - an error has occurred that prevented the request from completing. - @param returnCode The return code associated with this error. - @param message The detailed message describing this error. - **/ - ErrorCompletingRequestException(int returnCode, - String message) - { - super(message); - rc_ = returnCode; - } - - - - - - /** - Constructs an ErrorCompletingRequestException object. It indicates - an error has occurred that prevented the request from completing. - Exception message will look like this: User ID is not known. - @param returnCode The return code which identifies the message to be returned. - **/ - ErrorCompletingRequestException(int returnCode) - { - // Create the message - super(loader_.getText(getMRIKey(returnCode))); - rc_ = returnCode; - } - - - - - /** - Returns the text associated with the return code. - @param returnCode The return code associated with this exception. - @return The text string which describes the error. - **/ - // This method is required so the message can be created and sent in super() - static String getMRIKey (int returnCode) - { - switch(returnCode) - { case AS400_ERROR : - return "EXC_AS400_ERROR"; - case EXIT_POINT_PROCESSING_ERROR : - return "EXC_EXIT_POINT_PROCESSING_ERROR"; - case EXIT_PROGRAM_CALL_ERROR: - return "EXC_EXIT_PROGRAM_CALL_ERROR"; - case EXIT_PROGRAM_DENIED_REQUEST : - return "EXC_EXIT_PROGRAM_DENIED_REQUEST"; - case EXIT_PROGRAM_ERROR: - return "EXC_EXIT_PROGRAM_ERROR"; - case EXIT_PROGRAM_NOT_FOUND : - return "EXC_EXIT_PROGRAM_NOT_FOUND"; - case EXIT_PROGRAM_NUMBER_NOT_VALID: - return "EXC_EXIT_PROGRAM_NUMBER_NOT_VALID"; - case EXIT_PROGRAM_RESOLVE_ERROR: - return "EXC_EXIT_PROGRAM_RESOLVE_ERROR"; - case LENGTH_NOT_VALID: - return "EXC_LENGTH_NOT_VALID"; - case UNKNOWN: - return "EXC_UNKNOWN"; - case SPOOLED_FILE_NO_MESSAGE_WAITING: - return "EXC_SPOOLED_FILE_NO_MESSAGE_WAITING"; - case WRITER_JOB_ENDED: - return "EXC_WRITER_JOB_ENDED"; - default: - return "EXC_UNKNOWN"; // Bad return code was provided. - } - } - - - - /** - Returns the return code associated with this exception. - @return The return code. - **/ - public int getReturnCode () - { - return rc_; - } - - - - } // End of ErrorCompletingRequestException class diff --git a/cvsroot/src/com/ibm/as400/access/EventLog.java b/cvsroot/src/com/ibm/as400/access/EventLog.java deleted file mode 100644 index 48553ac8c..000000000 --- a/cvsroot/src/com/ibm/as400/access/EventLog.java +++ /dev/null @@ -1,174 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: EventLog.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.PrintWriter; -import java.io.File; -import java.io.OutputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.Date; -import java.lang.StringBuffer; - - -/** - * The EventLog class is an implementation of - * Log which logs - * exceptions and messages to the specified file or PrintStream. - *

          - * - * Here is an example use of EventLog, which will - * write a timestamp and message to the specified file: - *

          - *

          -  *  EventLog myLog = new EventLog("myFile");
          -  *  myLog.log("You have successfully written to my log file.");
          -  *  myLog.log("Another log message.");
          -  *  
          - *

          - * Each successive message will be appended to the previous - * messages in the log. - *

          - * Here is what the log file will look like: - *

          - * Mon Jan 03 09:00:00 CST 2000 Yout have successfully written to my log file.
          - * Mon Jan 03 09:00:01 CST 2000 Another log message. - * - **/ - -public class EventLog implements Log -{ - private PrintWriter writer_; - private boolean writerIsPrivate_ = false; - - /** - * Constructs a default EventLog object. Using this constructor, - * all log output will be sent to standard out. - * - **/ - public EventLog() - { - writer_ = new PrintWriter(System.out, true); - } - - - /** - * Constructs an EventLog object with the specified file pathname. - * If a log file already exists with the specified pathname, all - * messages will be appended to the existing log file. - * - * @param pathname The file pathname. - * - * @exception IOException If an error occurs while accessing the file. - **/ - public EventLog(String pathname) throws IOException - { - if (pathname == null) - throw new NullPointerException("pathname"); - - // Create a FileOutputStream and PrintWriter to handle the logging. - // If the file exists we want to append to it. - File file = new File(pathname); - FileOutputStream os = new FileOutputStream(pathname, file.exists()); - writer_ = new PrintWriter(os, true); - writerIsPrivate_ = true; - } - - /** - * Constructs an EventLog object with the specified OutputStream. - * - * @param stream The log OutputStream. - * - * @exception IOException If an error occurs while accessing the stream. - **/ - public EventLog(OutputStream stream) throws IOException - { - if (stream == null) - throw new NullPointerException("stream"); - - // Create a PrintWriter to handle the logging. - writer_ = new PrintWriter(stream, true); - } - - /** - * Constructs an EventLog object with the specified PrintWriter. - * - * @param out The PrintWriter. - **/ - public EventLog(PrintWriter out) - { - if (out == null) - throw new NullPointerException("out"); - - writer_ = out; - } - - - protected void finalize() throws Throwable - { - try - { - // If we "own" the writer (it's not attached to someone else's stream), - // then close it. - if (writerIsPrivate_ && writer_ != null) { - writer_.close(); - } - } - finally { - super.finalize(); - } - } - - - /** - * Logs a message to the event log. - * The log will contain a timestamp - * then the message. - * - * @param msg The message to log. - **/ - public void log(String msg) - { - log(msg, null); - } - - - /** - * Logs an exception and message to the event log. - * The log will contain a timestamp, the message, - * and then the exception stack trace. - * - * @param msg The message to log. - * @param exception The exception to log. - */ - public void log(String msg, Throwable exception) - { - StringBuffer buffer = new StringBuffer(new Date().toString()); - buffer.append(" "); - buffer.append(msg); - - writer_.println(buffer); - - if (exception != null) - exception.printStackTrace(writer_); - - // The writer is created with 'true' being passed in so - // the writer automatically fushes the buffer. But there was a - // case where the JVM garbage collected before the buffer was - // flushed, so I added a flush here to make sure the buffer is flushed - // right after the message is logged. - writer_.flush(); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/ExecutionEnvironment.java b/cvsroot/src/com/ibm/as400/access/ExecutionEnvironment.java deleted file mode 100644 index e4b67b35e..000000000 --- a/cvsroot/src/com/ibm/as400/access/ExecutionEnvironment.java +++ /dev/null @@ -1,115 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ExecutionEnvironment.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Locale; - -class ExecutionEnvironment -{ - // No need for instances of this class. - private ExecutionEnvironment() - { - } - - // Get the "best guess" CCSID for the server based on the default locale. - // @return The CCSID. - static int getBestGuessAS400Ccsid() - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Getting best guess CCSID."); - try - { - // See if the "fallback CCSID" property has been set. - String ccsidString = SystemProperties.getProperty(SystemProperties.FALLBACK_CCSID); - if (ccsidString != null) - { - Trace.log(Trace.DIAGNOSTIC, "Fallback CCSID specified:", ccsidString); - try { - return Integer.parseInt(ccsidString); - } - catch (NumberFormatException e) { - Trace.log(Trace.ERROR, "Ignoring invalid fallback CCSID value.", e); - } - } - else Trace.log(Trace.DIAGNOSTIC, "Fallback CCSID not specified, using Locale."); - - String localeString = Locale.getDefault().toString(); - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Default Locale: " + localeString); - // Search from most specific to most general. - while (true) - { - ccsidString = (String)ConversionMaps.localeCcsidMap_.get(localeString); - if (ccsidString != null) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Best guess for Locale: " + localeString + ", CCSID: " + ccsidString); - return Integer.parseInt(ccsidString); - } - localeString = localeString.substring(0, localeString.lastIndexOf('_')); - } - } - catch (Exception e) - { - // If all else fails return 37. - Trace.log(Trace.DIAGNOSTIC, "Exception taking best guess CCSID, default to 37:", e); - return 37; - } - } - - // Get the CCSID for this execution environment. - // @return The CCSID. - static int getCcsid() - { - return 13488; // Unicode. - } - - // Get the corresponding CCSID number as a String. - static int getCcsid(String encoding) - { - return Integer.parseInt((String)ConversionMaps.encodingCcsid_.get(encoding)); - } - - // Get the corresponding encoding from a CCSID. - static String getEncoding(int ccsid) - { - return (String)ConversionMaps.ccsidEncoding_.get(String.valueOf(ccsid)); - } - - // Get the NLV for the given Locale. - // @return String that represents the national language version. - static String getNlv(Locale locale) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Getting NLV."); - try - { - String localeString = locale.toString(); - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "NLV Locale: " + localeString); - // Search from most specific to most general. - while(true) - { - String nlvString = (String)ConversionMaps.localeNlvMap_.get(localeString); - if (nlvString != null) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "NLV for Locale: " + localeString + ", NLV: " + nlvString); - return nlvString; - } - localeString = localeString.substring(0, localeString.lastIndexOf('_')); - } - } - catch (Exception e) - { - // If all else fails return 2924. - Trace.log(Trace.DIAGNOSTIC, "Exception getting NLV, default to 2924:", e); - return "2924"; - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ExtendedIOException.java b/cvsroot/src/com/ibm/as400/access/ExtendedIOException.java deleted file mode 100644 index 3a3632a06..000000000 --- a/cvsroot/src/com/ibm/as400/access/ExtendedIOException.java +++ /dev/null @@ -1,353 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ExtendedIOException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -import java.io.IOException; - - -/** - The ExtendedIOException class represents an exception - that indicates that an error has occurred while - communicating with the system. -**/ - -public class ExtendedIOException extends IOException - implements ReturnCodeException -{ - static final long serialVersionUID = 4L; - - private int rc_; // Return code associated with this exception - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - - // Return code values used by this class. - // If a value is added here, it must also be added to MRI.properties, - // and possibly also to IFSReturnCodeRep, which references most of these constants. - // The numbers assigned to these constants are significant - // and must not be changed. - - /** - The return code indicating that - the file is in use. - **/ - public final static int FILE_IN_USE = 1; - /** - The return code indicating that - the file was not found. - **/ - public final static int FILE_NOT_FOUND = 2; - /** - The return code indicating that - the path is not found. - **/ - public final static int PATH_NOT_FOUND = 3; - /** - The return code indicating that - the directory entry exists. - **/ - public final static int DIR_ENTRY_EXISTS = 4; - /** - The return code indicating that - the access to the request was denied. - **/ - public final static int ACCESS_DENIED = 5; - /** - The return code indicating that - the handle is not valid. - **/ - public final static int INVALID_HANDLE = 6; - /** - The return code indicating that - the directory entry name is not valid. - **/ - public final static int INVALID_DIR_ENTRY_NAME = 7; - /** - The return code indicating that - the attribute name is not valid. - **/ - public final static int INVALID_ATTRIBUTE_NAME = 8; - /** - The return code indicating that - the directory is not empty. - **/ - public final static int DIR_NOT_EMPTY = 9; - /** - The return code indicating that - the file substream is in use. - **/ - public final static int FILE_SUBSTREAM_IN_USE = 10; - /** - The return code indicating that - the resource limit was exceeded. - **/ - public final static int RESOURCE_LIMIT_EXCEEDED = 11; - /** - The return code indicating that - the resource is not available. - **/ - public final static int RESOURCE_NOT_AVAILABLE = 12; - /** - The return code indicating that - the request was denied. - **/ - public final static int REQUEST_DENIED = 13; - /** - The return code indicating that - the directory entry is damaged. - **/ - public final static int DIR_ENTRY_DAMAGED = 14; - /** - The return code indicating that - the connection is not valid. - **/ - public final static int INVALID_CONNECTION = 15; - /** - The return code indicating that - the request is not valid. - **/ - public final static int INVALID_REQUEST = 16; - /** - The return code indicating that - there is a syntax error in the data stream. - **/ - public final static int DATA_STREAM_SYNTAX_ERROR = 17; - /** - The return code indicating that - no more files are available. - **/ - public final static int NO_MORE_FILES = 18; - /** - The return code indicating that - the parameter is not supported. - **/ - public final static int PARM_NOT_SUPPORTED = 19; - /** - The return code indicating that - the parameter value is not supported. - **/ - public final static int PARM_VALUE_NOT_SUPPORTED = 20; - /** - The return code indicating that - the value cannot be converted. - **/ - public final static int CANNOT_CONVERT_VALUE = 21; - /** - The return code indicating that - the end of file has been reached. - **/ - public final static int END_OF_FILE = 22; - /** - The return code indicating that - the request is not supported. - **/ - public final static int REQUEST_NOT_SUPPORTED = 23; - /** - The return code indicating that - the user ID is not valid. - **/ - public final static int INVALID_USER = 24; - /** - The return code indicating that - an unknown problem has occurred. - **/ - public final static int UNKNOWN_ERROR = 25; - /** - The return code indicating that - a sharing violation has occurred. - **/ - public final static int SHARING_VIOLATION = 32; - /** - The return code indicating that - a lock violation has occurred. - **/ - public final static int LOCK_VIOLATION = 33; - /** - The return code indicating that - the handle is stale. - **/ - public final static int STALE_HANDLE = 34; - - - // Additional constants, that are not referenced by IFSReturnCodeRep. - - /** - The return code indicating that - no certificate was found. - "Certificate was not found." - **/ - public final static int CERTIFICATE_NOT_FOUND = 40; - /** - The return code indicating that - the certificate was already added. - "Certificate association already exists." - **/ - public final static int CERTIFICATE_ALREADY_ADDED = 41; - /** - The return code indicating that - the certificate or certificate format was not valid. - "Certificate or certificate type is not valid." - **/ - public final static int INVALID_CERTIFICATE = 42; - - - - - /** - Constructs an ExtendedIOException object. It indicates - that an IO Exception occurred. - Exception message will look like this: End of file reached. - @param returnCode The return code which identifies the message to be returned. - **/ - - ExtendedIOException(int returnCode) - { - // Create the message - super(loader_.getText(getMRIKey(returnCode))); - rc_ = returnCode; - - } - - - - /** - Constructs an ExtendedIOException object. It indicates - that an IO Exception occurred. - Exception message will look like this: myuserid: User ID not valid. - @param objectName The name of the object. - @param returnCode The return code which identifies the message to be returned. - **/ - ExtendedIOException(String objectName, int returnCode) - { - // Create the message - super(objectName + ": " + loader_.getText(getMRIKey(returnCode))); - rc_ = returnCode; - - } - - - - /** - Constructs an ExtendedIOException object. It indicates - that an IO Exception occurred. - Exception message will look like this: myuserid: User ID not valid. (errno: 2345) - @param objectName The name of the object. - @param returnCode The return code which identifies the message to be returned. - @param errno The errno value associated with the error. - **/ - ExtendedIOException(String objectName, int returnCode, int errno) - { - // Create the message - super(objectName + ": " + loader_.getText(getMRIKey(returnCode)) + " (errno: " + errno + ")"); - rc_ = returnCode; - - } - - - - /** - Returns the translatable text associated with the - return code. - @param returnCode The return code associated with this exception. - @return The translatable text string which describes the error. - **/ - // This method is required so the message can be created and sent in super() - static String getMRIKey (int returnCode) - { - switch(returnCode) - { - case ACCESS_DENIED : - return "EXC_ACCESS_DENIED"; - case CANNOT_CONVERT_VALUE: - return "EXC_VALUE_CANNOT_CONVERT"; - case CERTIFICATE_ALREADY_ADDED: - return "EXC_CERTIFICATE_ALREADY_ADDED"; - case CERTIFICATE_NOT_FOUND: - return "EXC_CERTIFICATE_NOT_FOUND"; - case DATA_STREAM_SYNTAX_ERROR: - return "EXC_DATA_STREAM_SYNTAX_ERROR"; - case DIR_ENTRY_DAMAGED: - return "EXC_DIRECTORY_ENTRY_DAMAGED"; - case DIR_ENTRY_EXISTS : - return "EXC_DIRECTORY_ENTRY_EXISTS"; - case DIR_NOT_EMPTY : - return "EXC_DIRECTORY_NOT_EMPTY"; - case END_OF_FILE: - return "EXC_FILE_END"; - case FILE_IN_USE : - return "EXC_FILE_IN_USE"; - case FILE_NOT_FOUND: - return "EXC_FILE_NOT_FOUND"; - case FILE_SUBSTREAM_IN_USE : - return "EXC_FILE_SUBSTREAM_IN_USE"; - case INVALID_ATTRIBUTE_NAME: - return "EXC_ATTRIBUTE_NOT_VALID"; - case INVALID_CERTIFICATE: - return "EXC_CERTIFICATE_NOT_VALID"; - case INVALID_CONNECTION: - return "EXC_CONNECTION_NOT_VALID"; - case INVALID_DIR_ENTRY_NAME: - return "EXC_DIRECTORY_NAME_NOT_VALID"; - case INVALID_HANDLE: - return "EXC_HANDLE_NOT_VALID"; - case INVALID_REQUEST: - return "EXC_REQUEST_NOT_VALID"; - case INVALID_USER: - return "EXC_USERID_UNKNOWN"; - case LOCK_VIOLATION: - return "EXC_LOCK_VIOLATION"; - case NO_MORE_FILES: - return "EXC_FILES_NOT_AVAILABLE"; - case PARM_NOT_SUPPORTED: - return "EXC_PARAMETER_NOT_SUPPORTED"; - case PARM_VALUE_NOT_SUPPORTED: - return "EXC_PARAMETER_VALUE_NOT_SUPPORTED"; - case PATH_NOT_FOUND: - return "EXC_PATH_NOT_FOUND"; - case REQUEST_DENIED: - return "EXC_REQUEST_DENIED"; - case RESOURCE_LIMIT_EXCEEDED: - return "EXC_RESOURCE_LIMIT_EXCEEDED"; - case RESOURCE_NOT_AVAILABLE : - return "EXC_RESOURCE_NOT_AVAILABLE"; - case REQUEST_NOT_SUPPORTED : - return "EXC_REQUEST_NOT_SUPPORTED"; - case SHARING_VIOLATION : - return "EXC_SHARE_VIOLATION"; - case UNKNOWN_ERROR : - return "EXC_UNKNOWN"; - default: - return "EXC_UNKNOWN"; // Bad return code was provided. - } - } - - - - /** - Returns the return code associated with this exception. - @return The return code. - **/ - public int getReturnCode () - { - return rc_; - } - - - -} // End of ExtendedIOException class - - - - diff --git a/cvsroot/src/com/ibm/as400/access/ExtendedIllegalArgumentException.java b/cvsroot/src/com/ibm/as400/access/ExtendedIllegalArgumentException.java deleted file mode 100644 index 2567ff42e..000000000 --- a/cvsroot/src/com/ibm/as400/access/ExtendedIllegalArgumentException.java +++ /dev/null @@ -1,105 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: ExtendedIllegalArgumentException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - The ExtendedIllegalArgumentException class represents an exception that indicates that an argument is not valid. -**/ -public class ExtendedIllegalArgumentException extends IllegalArgumentException implements ReturnCodeException -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - private int rc_; // Return code associated with this exception - - // Return code values used by this class. If a value is added here, it must also be added to CoreMRI.java. - - /** - The return code indicating that the length is not valid. - **/ - public static final int LENGTH_NOT_VALID = 1; - /** - The return code indicating that the parameter value is not valid. - **/ - public static final int PARAMETER_VALUE_NOT_VALID = 2; - /** - The return code indicating that the path is not valid. - **/ - public static final int PATH_NOT_VALID = 3; - /** - The return code indicating that the parameter value is out of the allowed range. - **/ - public static final int RANGE_NOT_VALID = 4; - /** - The return code indicating that the field was not found. - **/ - public static final int FIELD_NOT_FOUND = 5; - /** - The return code indicating that the user ID or password contains a character that is not valid. - **/ - public static final int SIGNON_CHAR_NOT_VALID = 6; - /** - The return code indicating that the data type requested is not valid. - **/ - public static final int PARAMETER_VALUE_DATATYPE_NOT_VALID = 7; - /** - Constructs an ExtendedIllegalArgumentException object. It indicates that a method has been passed an illegal argument. - @param argument The type and value of the argument that was illegal. It should be in the format: argument (value). For example: library (mylib). - @param returnCode The return code which identifies the message to be returned. - **/ - public ExtendedIllegalArgumentException(String argument, int returnCode) - { - // Create the message - super(argument + ": " + ResourceBundleLoader.getCoreText(getMRIKey(returnCode))); - rc_ = returnCode; - } - - /** - Returns the text associated with the return code. - @param returnCode The return code associated with this exception. - @return The text string which describes the error. - **/ - static String getMRIKey(int returnCode) // This method is required so the message can be created and sent in super() - { - switch(returnCode) - { - case LENGTH_NOT_VALID: - return "EXC_LENGTH_NOT_VALID"; - case PARAMETER_VALUE_NOT_VALID: - return "EXC_PARAMETER_VALUE_NOT_VALID"; - case PATH_NOT_VALID: - return "EXC_PATH_NOT_VALID"; - case RANGE_NOT_VALID: - return "EXC_RANGE_NOT_VALID"; - case FIELD_NOT_FOUND: - return "EXC_FIELD_NOT_FOUND"; - case SIGNON_CHAR_NOT_VALID: - return "EXC_SIGNON_CHAR_NOT_VALID"; - case PARAMETER_VALUE_DATATYPE_NOT_VALID: - return "EXC_PARAMETER_VALUE_DATATYPE_NOT_VALID"; - default: - return "EXC_UNKNOWN"; // Bad return code was provided. - } - } - - /** - Returns the return code associated with this exception. - @return The return code. - **/ - public int getReturnCode() - { - return rc_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ExtendedIllegalStateException.java b/cvsroot/src/com/ibm/as400/access/ExtendedIllegalStateException.java deleted file mode 100644 index 2d1d12e8e..000000000 --- a/cvsroot/src/com/ibm/as400/access/ExtendedIllegalStateException.java +++ /dev/null @@ -1,236 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ExtendedIllegalStateException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** - The ExtendedIllegalStateException class represents an exception - that indicates that an object is not in the proper state to perform - the requested operation. -**/ -public class ExtendedIllegalStateException extends IllegalStateException -implements ReturnCodeException -{ - static final long serialVersionUID = 4L; - - - private int rc_; // Return code associated with this exception - - // Handles loading the appropriate resource bundle - //@E0D private static ResourceBundleLoader loader_; - - - // Return code values used by this class. - // If a value is added here, it must also be added to MRI.properties. - - - /** - The return code indicating that - the commitment control has already been started. - **/ - public static final int COMMITMENT_CONTROL_ALREADY_STARTED = 1; - - /** - The return code indicating that an IBM Toolbox for Java implementation - class was not found. - **/ - public static final int IMPLEMENTATION_NOT_FOUND = 11; // @D0A - - /** - The return code indicating that the requested information - is not available. - **/ - public static final int INFORMATION_NOT_AVAILABLE = 14; // @E2A - - /** - The return code indicating that the license can not be - requested. - **/ - public static final int LICENSE_CAN_NOT_BE_REQUESTED = 15; // @E2A - - /** - The return code indicating that - a request was made to find an object and that object - was not found. - **/ - public static final int OBJECT_CANNOT_BE_FOUND = 13; //@E1A - - /** - The return code indicating that - a request was made that requires the object to - not be open and the object was in an open state. - **/ - public static final int OBJECT_CAN_NOT_BE_OPEN = 2; - - /** - The return code indicating that - a request was made that requires the object to be - writable and the object was in a read-only state. - **/ - public static final int OBJECT_IS_READ_ONLY = 12; //@E0A - - /** - The return code indicating that - a request was made that requires the object to be - open and the object was not in an open state. - **/ - public static final int OBJECT_MUST_BE_OPEN = 3; - - /** - The return code indicating that - one or more properties have not been set. - **/ - public static final int PROPERTY_NOT_SET = 4; - - /** - The return code indicating that - the property cannot be changed. This usually - results when an object - is in a state where the property cannot be changed. - **/ - public static final int PROPERTY_NOT_CHANGED = 5; - - /** - The return code indicating that the proxy server has already been - started. - **/ - public static final int PROXY_SERVER_ALREADY_STARTED = 7; // @D0A - - /** - The return code indicating that the proxy server has not been - started. - **/ - public static final int PROXY_SERVER_NOT_STARTED = 8; // @D0A - - /** - The return code indicating that the proxy server did - not fire an event because the listener was not - accessible. - **/ - public static final int PROXY_SERVER_EVENT_NOT_FIRED = 10; // @D0A - - /** - The return code indicating that this object is not - allowed to start threads. - **/ - public static final int OBJECT_CAN_NOT_START_THREADS = 9; // @D1A - - /** - The return code indicating that a signon is already in progress. - **/ - public static final int SIGNON_ALREADY_IN_PROGRESS = 16; - - - /** - The return code indicating that - the exact cause of the failure is not known. The detailed message - may contain additional information. - **/ - public static final int UNKNOWN = 6; - - - - - /** - Constructs an ExtendedIllegalStateException object. - It indicates that an object is not in the proper state - to perform the requested operation. - @param returnCode The return code which identifies the message to be returned. - **/ - public ExtendedIllegalStateException(int returnCode) // @D2C - { - // Create the message - super(ResourceBundleLoader.getCoreText(getMRIKey(returnCode))); // @D2C @E0C - rc_ = returnCode; - - } - - - /** - Constructs an ExtendedIllegalStateException object. - It indicates that an object is not in the proper state - to perform the requested operation. - @param property The property that was not set. - @param returnCode The return code which identifies the message to be returned. - **/ - public ExtendedIllegalStateException(String property, int returnCode) // @D2C - { - // Create the message - super(property + ": " + ResourceBundleLoader.getCoreText(getMRIKey(returnCode))); // @D2C @E0C - rc_ = returnCode; - } - - - - /** - Returns the text associated with the return code. - @param returnCode The return code associated with this exception. - @return The text string which describes the error. - **/ - // This method is required so the message can be created and sent in super() - static String getMRIKey(int returnCode) - { - switch (returnCode) - { - case COMMITMENT_CONTROL_ALREADY_STARTED: - return "EXC_COMMITMENT_CONTROL_ALREADY_STARTED"; - case OBJECT_CAN_NOT_BE_OPEN: - return "EXC_OBJECT_CANNOT_BE_OPEN"; - case OBJECT_MUST_BE_OPEN: - return "EXC_OBJECT_MUST_BE_OPEN"; - case PROPERTY_NOT_SET: - return "EXC_PROPERTY_NOT_SET"; - case PROPERTY_NOT_CHANGED: - return "EXC_PROPERTY_NOT_CHANGED"; - case PROXY_SERVER_ALREADY_STARTED: // @D0A - return "PROXY_SERVER_ALREADY_STARTED"; // @D0A - case PROXY_SERVER_NOT_STARTED: // @D0A - return "PROXY_SERVER_NOT_STARTED"; // @D0A - case PROXY_SERVER_EVENT_NOT_FIRED: // @D0A - return "PROXY_SERVER_EVENT_NOT_FIRED"; // @D0A - case IMPLEMENTATION_NOT_FOUND: // @D0A - return "EXC_IMPLEMENTATION_NOT_FOUND"; // @D0A - case OBJECT_CAN_NOT_START_THREADS: // @D1A - return "EXC_OBJECT_CANNOT_START_THREADS"; // @D1A - case OBJECT_IS_READ_ONLY: // @E0A - return "EXC_OBJECT_IS_READ_ONLY"; // @E0A - case OBJECT_CANNOT_BE_FOUND: // @E1A - return "EXC_OBJECT_CANNOT_BE_FOUND"; // @E1A - case INFORMATION_NOT_AVAILABLE: // @E2A - return "EXC_INFORMATION_NOT_AVAILABLE"; // @E2A - case LICENSE_CAN_NOT_BE_REQUESTED: // @E2A - return "EXC_LICENSE_CAN_NOT_BE_REQUESTED"; // @E2A - case SIGNON_ALREADY_IN_PROGRESS: // @E2A - return "EXC_SIGNON_ALREADY_IN_PROGRESS"; - case UNKNOWN: - // @D0A - drop through to default case... return "EXC_UNKNOWN"; - default: - return "EXC_UNKNOWN"; // Bad return code was provided. - } - } - - - - /** - Returns the return code associated with this exception. - @return The return code. - **/ - public int getReturnCode () - { - return rc_; - } - - - -} // End of ExtendedIllegalStateException class diff --git a/cvsroot/src/com/ibm/as400/access/FTP.java b/cvsroot/src/com/ibm/as400/access/FTP.java deleted file mode 100644 index a74e2391c..000000000 --- a/cvsroot/src/com/ibm/as400/access/FTP.java +++ /dev/null @@ -1,2500 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FTP.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.net.*; -import java.util.*; -import java.beans.*; - - -/** - * Represents a generic FTP client. Methods - * on this class allow you to connect to an FTP server, - * send commands to the system, list files on the system, - * get files from the system, and put files to the system. - *

          - * Most methods that communicate with the system return a boolean - * to indicate if the request was successful. The message returned - * from the system is also available. getLastMessage() is used - * to retrieve the message from the previous request. - *

          - * By default, FTP commands are sent via port 21. The initial - * data transfer type is ASCII. Passive mode is used. - *

          - * No encryption is provided by this class. The user and password - * flow un-encrypted to the system. This class is not SSL enabled. - *

          - * The forward slash is the separator character for paths sent - * to the FTP server. - *

          - * Trace information is available by using the com.ibm.as400.access.Trace - * class. When trace is turned on via that class, FTP will - * produce debug information. - *

          - * The following example copies a set of files from a directory - * on the system. - * - *

          - * FTP client = new FTP("mysystem", "myUID", "myPWD");
          - * client.cd("/myDir");
          - * client.setDataTransferType(FTP.BINARY);
          - * String [] entries = client.ls();
          - *
          - * for (int i = 0; i < entries.length; i++)
          - * {
          - *    System.out.println("Copying " + entries[i]);
          - *    try
          - *    {
          - *       client.get(entries[i], "c:\\ftptest\\" + entries[i]);
          - *    }
          - *    catch (Exception e)
          - *    {
          - *       System.out.println("  copy failed, likely this is a directory");
          - *    }
          - * }
          - *
          - * client.disconnect();
          - *
          - * 
          - * -**/ - -public class FTP implements java.io.Serializable -{ - static final long serialVersionUID = 4L; - private static final boolean DEBUG = false; - - - // ********************************************************** - // * * - // * Don't forget to update readObject() if transient * - // * variables are added! * - // * * - // ********************************************************** - - // ********************************************************** - // * * - // * Don't forget to update AS400FTP if a method is added * - // * * - // ********************************************************** - - // connect to this system, with the specified user and password - // Do not just grab "clearPassword"!!!! Always use getPassword() - private String server_; - private String user_; - transient private String clearPassword_ = null; - transient private byte[] encryptedPassword_ = null; - transient private byte[] mask_ = null; - transient private byte[] adder_ = null; - transient private boolean encrypted_ = false; - - private final static int PARKED = 0; //waiting to try first connection - private final static int ACTIVE = 1; //connection active - private final static int FAILED = 2; //connection no longer active, - // reconnect must be off - transient private int connectionState_ = PARKED; - - // flag used to make sure we don't go into an - // infininte loop calling connect - transient private boolean inConnect_ = false; - - transient String lastMessage_ = ""; - - // default port - private int port_ = 21; - - // socket for sending commands / receiving replies - transient private Socket controlSocket_; - - // replies arrive via this reader - transient private BufferedReader reader_; - - // requests are sent via this writer. - transient private PrintWriter ps_; - - transient private boolean externallyConnected_ = false; // @D2a - boolean reuseSocket_ = true; // default behavior is to reuse socket - - // Lists of listeners - transient PropertyChangeSupport changes_ = null; - transient VetoableChangeSupport vetos_ = null; - transient Vector listeners_ = null; - transient private Object listenerLock_ = new Object(); - - - // amount of data to transfer at one time - private int bufferSize_ = 4096; - - private int mode_ = PASSIVE_MODE; - - /** - * Transfer files in ASCII mode. - **/ - public static final int ASCII = 0; - - /** - * Transfer files in binary mode. - **/ - public static final int BINARY = 1; - - - /** - * Use active mode transfers with the system. - **/ - public static final int ACTIVE_MODE = 10; - - /** - * Use passive mode transfers with the system. - * This is the default. - **/ - public static final int PASSIVE_MODE = 11; - - - private transient FTPThread activeModeObject_; - private transient Thread activeModeThread_; - -// ----------------------------------------------------------------------- - /** - * Constructs an FTP object. - * The system name, user and password must be set before - * requests are sent to the system. - **/ - - public FTP() - { - checkSocketProperty(); // see if "reuseSocket" property is set - } - - - - - -// ----------------------------------------------------------------------- - /** - * Constructs an FTP object. - * The user and password must be set before requests are - * sent to the system. - * @param server The system to which to connect. - **/ - - public FTP(String server) - { - try - { - setServer(server); - checkSocketProperty(); // see if "reuseSocket" property is set - } - catch (PropertyVetoException e) { Trace.log(Trace.ERROR, e); } - } - - - -// ----------------------------------------------------------------------- - /** - * Constructs an FTP object. - * @param server The system to which to connect. - * @param user The userid to use during the login. - * @param password The password to use during the login. - **/ - - public FTP(String server, String user, String password) - { - try - { - setServer(server); - setUser(user); - setPassword(password); - checkSocketProperty(); // see if "reuseSocket" property is set - } - catch (PropertyVetoException e) { Trace.log(Trace.ERROR, e); } - } - - - - -// ----------------------------------------------------------------------- - /** - * Adds a listener to be notified when the value of any bound property - * is changed. It can be removed with removePropertyChangeListener. - * - * @param listener The PropertyChangeListener. - **/ - - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - if (changes_ == null) - { - synchronized(listenerLock_) - { - if (changes_ == null) { - changes_ = new PropertyChangeSupport(this); - } - } - } - changes_.addPropertyChangeListener(listener); - } - - - - -// ----------------------------------------------------------------------- - /** - * Adds a listener to be notified when an FTP event is fired. - * - * @param listener The object listener. - **/ - - public void addFTPListener(FTPListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - if (listeners_ == null) - { - synchronized(listenerLock_) - { - if (listeners_ == null) { - listeners_ = new Vector(); - } - } - } - listeners_.addElement(listener); - } - - - - - -// --------------------------------------------------------------------------- -// @D5 new method - /** - * Starts the process of appending data to a file on the system. FTP - * opens the data connection to the system, then opens the file on - * the system and returns an output stream to the caller. The caller - * then writes the file's data to the output stream. - *
          Throws SecurityException if userid or password is invalid. - * @param fileName The file to put. - * @return An output stream to the file. The caller uses the output - * stream to write data to the file. - * Null is returned if the connection to the system fails. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized OutputStream append(String fileName) - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering append(file)"); - - - if (fileName == null) - throw new NullPointerException("file"); - - if (fileName.length() == 0) - throw new IllegalArgumentException("file"); - - return doAppendOrPut(fileName, "APPE"); - } - - - - - -// --------------------------------------------------------------------------- -// @D5 new method - /** - * Appends data to a file on the system. - * @param sourceFileName The file to put. - * @param targetFileName The file on the system. - * @return true if the copy was successful; false otherwise. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized boolean append(String sourceFileName, String targetFileName) - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering append(String, String)"); - - - if (sourceFileName == null) - throw new NullPointerException("source"); - - if (sourceFileName.length() == 0) - throw new IllegalArgumentException("source"); - - if (targetFileName == null) - throw new NullPointerException("target"); - - if (targetFileName.length() == 0) - throw new IllegalArgumentException("target"); - - boolean result = append(new java.io.File(sourceFileName), targetFileName); - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving append(String, String)"); - - return result; - } - - - - - - -// --------------------------------------------------------------------------- - /** - * Appends data to a file on the system. - *
          Throws SecurityException if userid or password is invalid. - * @param sourceFileName The file to put. - * @param targetFileName The file on the system. - * @return true if the copy was successful; false otherwise. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized boolean append(java.io.File sourceFileName, String targetFileName) - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering append(File, String)"); - - - if (sourceFileName == null) - throw new NullPointerException("source"); - - if (targetFileName == null) - throw new NullPointerException("target"); - - if (targetFileName.length() == 0) - throw new IllegalArgumentException("target"); - - - connect(); - - byte[] buffer = new byte[bufferSize_]; - - FileInputStream f = null; - OutputStream out = null; - try - { - f = new FileInputStream(sourceFileName); - out = append(targetFileName); - - int length = f.read(buffer); - - while (length > 0) - { - out.write(buffer,0,length); - length = f.read(buffer); - } - } - finally - { - try - { - if (out != null) out.close(); - } - finally - { - if (f != null) f.close(); - } - } - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving append(String, String)"); - - return true; - } - - - - - - - -// ----------------------------------------------------------------------- - /** - * Adds a listener to be notified when the value of any - * constrained property is changed. - * - * @param listener The VetoableChangeListener. - **/ - - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - if (vetos_ == null) - { - synchronized(listenerLock_) - { - if (vetos_ == null){ - vetos_ = new VetoableChangeSupport(this); - } - } - } - vetos_.addVetoableChangeListener(listener); - } - - - - - -// --------------------------------------------------------------------------- - /** - * Sets the current directory on the system to directory. - * The method is the same as setCurrentDirectory(). - * The message returned from the system is saved. Use getLastMessage() - * to retrieve it. - *
          Throws SecurityException if userid or password is invalid. - * @param directory The current directory to set on the system. - * @return true if directory changed; false otherwise. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized boolean cd(String directory) - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering cd()"); - - if (directory == null) - throw new NullPointerException("directory"); - - if (directory.length() == 0) - throw new IllegalArgumentException("directory"); - - - connect(); - issueCommand("CWD " + directory); - - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving cd()"); - - return lastMessage_.startsWith("250"); - } - - - - -// --------------------------------------------------------------------------- - /** - * Connects to the system. The connection is via - * port port. The user and password must be set - * before calling this method. - * Calling connect is optional. Methods that communicate - * with the system such as get, put, cd, and ls call connect() - * if necessary. - * The message returned from the system is saved. Use getLastMessage() - * to retrieve it. - *
          Throws SecurityException if userid or password is invalid. - * @return true if connection is successful; false otherwise. - * @exception UnknownHostException If a path to the system cannot be found. - * @exception IOException If an error occurs while connecting to the system. - * @exception IllegalStateException If called before user and password are set. - **/ - - public synchronized boolean connect() - throws UnknownHostException, IOException, IllegalStateException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering connect()"); - - inConnect_ = true; - - // possible state 1 -- we were connected but the connection - // failed or timed out. If reconnect is off simply return false - if (connectionState_ == FAILED) - { - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving connect(), state=failed"); - - inConnect_ = false; - return false; - } - - // possible state 2 -- we are connected. - if (connectionState_ == ACTIVE) - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving connect(), state=active"); - - inConnect_ = false; - return true; - } - - //possible state 3 -- this is the first try at connecting - //or the connection failed and the user wants us to retry. - //Attempt to connect to the system. - if ((server_ == null) || (server_.length() == 0)) - { - inConnect_ = false; - throw new IllegalStateException("server"); - } - - if ((user_ == null) || (user_.length() == 0)) - { - inConnect_ = false; - throw new IllegalStateException("user"); - } - - String password_ = getPassword(); - if ((password_ == null) || (password_.length() == 0)) - { - inConnect_ = false; - throw new IllegalStateException("password"); - } - - - controlSocket_ = new Socket(server_, port_); - - reader_ = new BufferedReader(new InputStreamReader(controlSocket_.getInputStream())); - ps_ = new PrintWriter(controlSocket_.getOutputStream(), true); - - readReply(); - - login(user_, password_); - - if (lastMessage_.startsWith("230")) - connectionState_ = ACTIVE; - else - { - ps_.close(); - reader_.close(); - controlSocket_.close(); - connectionState_ = PARKED; - inConnect_ = false; - throw new java.lang.SecurityException(); - } - - inConnect_ = false; - - if (connectionState_ == ACTIVE) - fireEvent(FTPEvent.FTP_CONNECTED); - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving connect(), state = " + connectionState_ ); - - return (connectionState_ == ACTIVE); - } - - - -// --------------------------------------------------------------------------- - // - // Decode the password so because it must be in the clear going - // to the system. - // - - private byte[] decode(byte[] data, byte[] mask, byte[] adder) - { - return decode(data, 0, data.length, mask, adder); - } - - private byte[] decode(byte[] data, int offset, int len, byte[] mask, byte[] adder) - { - int i; - byte[] b = new byte[len]; - - for (i=0; iquit command to the system. - * The message returned from the system is saved. Use getLastMessage() - * to retrieve it. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized void disconnect() - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering disconnect()"); - - if (connectionState_ == ACTIVE) - { - - try - { - issueCommand("QUIT"); - } - catch (Exception e) {} - - try - { - if (activeModeThread_ != null) - { - activeModeThread_.interrupt(); - } - } - catch (Exception e) {} - - ps_.close(); - reader_.close(); - controlSocket_.close(); - connectionState_ = PARKED; - fireEvent(FTPEvent.FTP_DISCONNECTED); - } - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving disconnect()"); - } - - - - - - -// --------------------------------------------------------------------------- -// @D5 new method. This code used to be the put() method that did work. - /** - * Starts the process of putting a file or appending data to a file on - * the system. FTP opens the data connection to the system, then opens - * the file on the system and returns an output stream to the caller. The - * caller then writes the file's data to the output stream. - *
          Throws SecurityException if userid or password is invalid. - * @param fileName The file to put. - * @param command "APPE" to append data, "STOR" to simply put - * @return An output stream to the file. The caller uses the output - * stream to write data to the file. - * Null is returned if the connection to the system fails. - * @exception IOException If an error occurs while communicating with the system. - **/ - - OutputStream doAppendOrPut(String fileName, String command) - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering doAppendOrPut(file)"); - - connect(); - - Socket dataSocket = null; - if (mode_ == PASSIVE_MODE) - { - dataSocket = getDataSocket(); - } - else - { - initiateActiveMode(); - } - - String result = issueCommand(command + " " + fileName); - - if (result.startsWith("4") || result.startsWith("5")) - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"put failed " + result); - if (dataSocket != null) { // passive_mode - dataSocket.close(); - } - throw new IOException(result); - } - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving put(file)"); - - if (dataSocket == null) - { - dataSocket = activeModeObject_.getSocket(); - } - - fireEvent(FTPEvent.FTP_PUT); - - return new FTPOutputStream(dataSocket, this); - } - - - - - - - -// --------------------------------------------------------------------------- - // - // Encode the password so it is not in the clear sitting in memory - // - - private byte[] encode(byte[] b, byte[] mask, byte[] adder) - { - int i; - - byte[] buf = new byte[b.length]; - - for (i=0; iThrows SecurityException if userid or password is invalid. - * - * @param fileName The file to get. - * @return An input stream to the file. The caller uses the input - * stream to read the data from the file. - * Null is returned if the connection to the system fails. - * @exception IOException If an error occurs while communicating with the system. - * @exception FileNotFoundException If the name is a directory or the name is not found. - **/ - - public synchronized InputStream get(String fileName) - throws IOException, FileNotFoundException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering get(file)"); - - if (fileName == null) - throw new NullPointerException("file"); - - if (fileName.length() == 0) - throw new IllegalArgumentException("file"); - - - connect(); - - Socket dataSocket = null; - if (mode_ == PASSIVE_MODE) - { - dataSocket = getDataSocket(); - } - else // active_mode - { - initiateActiveMode(); - } - - issueCommand("RETR " + fileName); - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving get(file)"); - - // 150 appears to be success. - // Some possible error messages: - // 426-MEMBER IN FILE IN LIBRARY NOT FOUND. - // 501 UNKNOWN EXTENSION IN DATABASE FILE NAME. - // 550 FILE IN LIBRARY NOT FOUND. - if (lastMessage_.startsWith("426") || - lastMessage_.startsWith("501") || // member not found - lastMessage_.startsWith("550")) // unknown extension - { - if (dataSocket != null) { // passive_mode - dataSocket.close(); - } - throw new FileNotFoundException(); - } - - if (dataSocket == null) - { - dataSocket = activeModeObject_.getSocket(); - } - - fireEvent(FTPEvent.FTP_RETRIEVED); - return new FTPInputStream(dataSocket, this); - } - - - - -// --------------------------------------------------------------------------- - /** - * Gets a file from the system. - * The source file is on the system, accessed via FTP so the path - * separator character (if any) must be a forward slash. - * The target file is on the client, accessed via java.io - * so the path separator character (if any) must be client specific. - * @param sourceFileName The file to get on the system. - * @param targetFileName The file on the target file system. - * @return true if the copy was successful; false otherwise. - * @exception IOException If an error occurs while communicating with the system. - * @exception FileNotFoundException If the source file or the targe file - * cannot be accessed. - **/ - - public synchronized boolean get(String sourceFileName, String targetFileName) - throws IOException, FileNotFoundException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering get(String, String"); - - - if (sourceFileName == null) - throw new NullPointerException("source"); - - if (sourceFileName.length() == 0) - throw new IllegalArgumentException("source"); - - if (targetFileName == null) - throw new NullPointerException("target"); - - if (targetFileName.length() == 0) - throw new IllegalArgumentException("target"); - - boolean result = get(sourceFileName, new java.io.File(targetFileName)); - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving get(String, String"); - - return result; - } - - - - - -// --------------------------------------------------------------------------- - /** - * Gets a file from the system. - * The source file is on the system, accessed via FTP so the path - * separator character (if any) must be a forward slash. - * The target file is an instance of Java.io.file. - *
          Throws SecurityException if userid or password is invalid. - * @param sourceFileName The file to get on the system. - * @param targetFile The file on the target file system. - * @return true if the copy was successful; false otherwise. - * @exception IOException If an error occurs while communicating with the system. - * @exception FileNotFoundException If the source file or the targe file - * cannot be accessed. - **/ - - public synchronized boolean get(String sourceFileName, java.io.File targetFile) - throws IOException, FileNotFoundException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering get(String, file)"); - - - - if (sourceFileName == null) - throw new NullPointerException("source"); - - if (sourceFileName.length() == 0) - throw new IllegalArgumentException("source"); - - if (targetFile == null) - throw new NullPointerException("target"); - - boolean result = true; - - connect(); - - byte[] buffer = new byte[bufferSize_]; - - InputStream in = get(sourceFileName); - - if (in != null) - { - FileOutputStream f = null; - try - { - f = new FileOutputStream(targetFile); - - int length = in.read(buffer); - while (length > 0) - { - f.write(buffer,0,length); - length = in.read(buffer); - } - } - finally - { - try { in.close(); } catch (Throwable t) { Trace.log(Trace.ERROR, t); } - if (f != null) f.close(); - } - // readReply(); - } - else - result = false; - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving get(String, file"); - - return result; - } - - - - - -// --------------------------------------------------------------------------- - /** - * Returns the size of the buffer used when transferring files. - * When this class copies data between the source file and target file, - * a buffer of this size is used. The default buffer size is 4096 bytes. - * @return The buffer size used when transferring files. - **/ - - public int getBufferSize() - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering getBufferSize(), (no leaving entry)"); - - return bufferSize_; - } - - - - -// --------------------------------------------------------------------------- - - - - -// --------------------------------------------------------------------------- - /** - * Returns the current directory on the system. - * @return The current directory on the system. - * Null is returned if the connection to the system fails. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized String getCurrentDirectory() - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering pwd(), (no leaving entry)"); - - return pwd(); - } - - - - -// --------------------------------------------------------------------------- - /** - * Returns the text of the last reply returned from the system. - * Empty string is returned if no request has been sent. - * @return The text of the last reply returned from the system. - **/ - - public synchronized String getLastMessage() - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering lastMessage(), (no leaving entry)"); - - return lastMessage_; - } - - - /** - * Returns the current transfer mode. - * @return The transfer mode. Valid values are ACTIVE_MODE or PASSIVE_MODE. - * The default is PASSIVE_MODE. - **/ - public int getMode() - { - return mode_; - } - - - -// --------------------------------------------------------------------------- - // - // Returns the password as a string. This method should *NEVER* - // be public! If necessary, this method decrypts the password - // - - private String getPassword() - { - if (encrypted_) - { - if (encryptedPassword_ == null) - return null; - else - return new String(decode(encryptedPassword_, mask_, adder_)); - } - else - return clearPassword_; - } - - - - -// --------------------------------------------------------------------------- - /** - * Returns the port used to connect to the system. - * @return The port used to connect to the system. - **/ - - public int getPort() - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering getPort(), (no leaving entry)"); - - return port_; - } - - - - -// --------------------------------------------------------------------------- - /** - * Returns the name of the system. Null is returned if no system has - * been set. - * @return The name of the system to which this object connects. - **/ - - public String getServer() - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering getServer(), (no leaving entry)"); - - return server_; - } - - - -// --------------------------------------------------------------------------- - /** - * Returns the user. Null is returned if no user has - * been set. - * @return The name of the user. - **/ - - public String getUser() - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering getUser(), (no leaving entry)"); - - return user_; - } - - - -// --------------------------------------------------------------------------- - /** - * Indicates whether the socket is reused for multiple file transfers, when in active mode. - * @return true if the socket is reused; false if a new socket is created. - * @see #setMode - **/ - public boolean isReuseSocket() - { - return reuseSocket_; - } - - - - - -// --------------------------------------------------------------------------- - /** - * Sends a command to the system, returning the reply from the system. - *

          - * The command is not altered before sending it to the system, so it - * must be recognized by the system. Many FTP applications change - * commands so they are recognized by the system. For example, the - * command to get a list of files from the system is NLST, not ls. Many - * FTP applications convert ls to NLST before sending the command to - * the system. This method will not do the conversion. - *
          Throws SecurityException if userid or password is invalid. - * @param cmd The command to send to the system. - * @return The reply to the command. - * Null is returned if the connection to the system fails. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized String issueCommand(String cmd) - throws IOException - { - if (Trace.isTraceOn()) - { - String traceString = cmd; - - if (cmd.startsWith("PASS")) - { - traceString = "PASS " + "********************".substring(0, cmd.length() - 5); - } - - Trace.log(Trace.DIAGNOSTIC,"entering issueCommand(), command is: " + traceString); - } - - // make sure we are not in connect to prevent an infinite loop - // (connect calls this method to issue the user and pass commands) - if (! inConnect_) - connect(); - - ps_.print(cmd + "\r\n"); - ps_.flush(); - readReply(); - - //if (echo) - // lastMessage_ = cmd + "\n" + reply; - //else - // lastMessage_ = reply; - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving issueCommand(), message is: " + lastMessage_); - - return lastMessage_; - } - - - - private void initiateActiveMode() throws IOException - { - if (!activeModeThread_.isAlive()) - { - activeModeObject_.setLocalAddress(controlSocket_.getLocalAddress()); - activeModeThread_.start(); - activeModeObject_.waitUntilStarted(); - } - activeModeObject_.issuePortCommand(); - } - -// --------------------------------------------------------------------------- - /** - * Lists the contents of the current working directory. If details - * is true, additional information is returned. If false, only the - * file name is returned. An array of length zero is returned if the - * directory is empty. - * @param details True if file details will be returned. - * @return The contents of the directory as an array of Strings. - * @exception IOException If an error occurs while communicating with the system. - **/ - - String[] list(boolean details, String criteria) // @D4c - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering list"); - - connect(); - - Socket dataSocket = null; - if (mode_ == PASSIVE_MODE) - { - dataSocket = getDataSocket(); - } - else // active_mode - { - initiateActiveMode(); - } - - String FTPCommand; // @D4a - - if (details) - { - FTPCommand = "LIST"; // @D4c - } - else - { - FTPCommand = "NLST"; // @D4c - } - - if (criteria != null) // @D4a - FTPCommand = FTPCommand + " " + criteria; // @D4a - - issueCommand(FTPCommand); // @D4c - - String[] result = new String[0]; - - if (lastMessage_.startsWith("125") || lastMessage_.startsWith("150")) - { - - if (dataSocket == null) - { - dataSocket = activeModeObject_.getSocket(); - } - - InputStream in = dataSocket.getInputStream(); - Vector v = new Vector(); - BufferedReader rdr = new BufferedReader(new InputStreamReader(in)); - - String s; - while ((s = rdr.readLine()) != null) - { - v.addElement(s); - } - - result = new String[v.size()]; - v.copyInto(result); - - rdr.close(); - in.close(); - dataSocket.close(); - - readReply(); - - fireEvent(FTPEvent.FTP_LISTED); - } - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving list()"); - - return result; - } - - - -// --------------------------------------------------------------------------- - /** - * Logs on to the system - * @param user The user. - * @param password The password. - * @return String containing the reply from the system. - * @exception IOException If an error occurs while communicating with the system. - */ - - private String login(String user, String password) - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering login"); - - // connect(); - // user_ = user; - // password_ = password; - - String s1 = issueCommand("USER " + user); - String s2 = issueCommand("PASS " + password); - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving login"); - - return s1 + "\n" + s2; - } - - - - -// --------------------------------------------------------------------------- - /** - * Lists the contents of the current working directory. If the directory - * is empty, an empty list is returned. - * @return The contents of the directory as an array of Strings. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized String[] ls() - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering ls(), (no leaving entry)"); - - return list(false, null); // @D4c - } - - - - -// --------------------------------------------------------------------------- -// @D4 new method - /** - * Lists the contents of the current working directory. If the directory - * is empty or no files match the search criteria, an empty list is returned. - * @return The contents of the directory as an array of Strings. - * @param criteria The search criteria. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized String[] ls(String criteria) - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering ls(), (no leaving entry)"); - - return list(false, criteria); - } - - - - -// --------------------------------------------------------------------------- - /** - * Sends the NOOP (no operation) command to the system. This - * request is most useful to see if the connection to the system - * is still active. - *
          Throws SecurityException if userid or password is invalid. - * @return true if the request was successful, false otherwise. - * @exception IOException If an error occurs while communicating with the system. - **/ - - // $$$ change this to package scoped after testing - public synchronized boolean noop() - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering noop"); - - if (! inConnect_) - connect(); - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving noop()"); - - - return issueCommand("NOOP").startsWith("200"); - } - - - - -// --------------------------------------------------------------------------- - /** - * Starts the process of putting a file to the system. FTP - * opens the data connection to the system, then opens the file on - * the system and returns an output stream to the caller. The caller - * then writes the file's data to the output stream. - *
          Throws SecurityException if userid or password is invalid. - * @param fileName The file to put. - * @return An output stream to the file. The caller uses the output - * stream to write data to the file. - * Null is returned if the connection to the system fails. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized OutputStream put(String fileName) - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering put(file)"); - - - if (fileName == null) - throw new NullPointerException("file"); - - if (fileName.length() == 0) - throw new IllegalArgumentException("file"); - - return doAppendOrPut(fileName, "STOR"); - - // @D5d the rest of this method is now in worker method doAppendOrPut() - } - - - - - -// --------------------------------------------------------------------------- - /** - * Puts a file to the system. - * @param sourceFileName The file to put. - * @param targetFileName The file on the system. - * @return true if the copy was successful; false otherwise. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized boolean put(String sourceFileName, String targetFileName) - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering put(String, String)"); - - - if (sourceFileName == null) - throw new NullPointerException("source"); - - if (sourceFileName.length() == 0) - throw new IllegalArgumentException("source"); - - if (targetFileName == null) - throw new NullPointerException("target"); - - if (targetFileName.length() == 0) - throw new IllegalArgumentException("target"); - - boolean result = put(new java.io.File(sourceFileName), targetFileName); - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving put(String, String)"); - - return result; - } - - - - - - -// --------------------------------------------------------------------------- - /** - * Puts a file to the system. - *
          Throws SecurityException if userid or password is invalid. - * @param sourceFileName The file to put. - * @param targetFileName The file on the system. - * @return true if the copy was successful; false otherwise. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized boolean put(java.io.File sourceFileName, String targetFileName) - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering put(File, String)"); - - - if (sourceFileName == null) - throw new NullPointerException("source"); - - if (targetFileName == null) - throw new NullPointerException("target"); - - if (targetFileName.length() == 0) - throw new IllegalArgumentException("target"); - - - connect(); - - byte[] buffer = new byte[bufferSize_]; - - FileInputStream f = null; - OutputStream out = null; - try - { - f = new FileInputStream(sourceFileName); - out = put(targetFileName); - - int length = f.read(buffer); - - while (length > 0) - { - out.write(buffer,0,length); - length = f.read(buffer); - } - } - finally - { - try - { - if (out != null) out.close(); - } - finally - { - if (f != null) f.close(); - } - } - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving put(String, String)"); - - return true; - } - - - - -// --------------------------------------------------------------------------- - /** - * Returns the current directory on the system. PWD is the ftp - * command Print Working Directory. - *
          Throws SecurityException if userid or password is invalid. - * @return The current directory on the system. - * Null is returned if the connection to the system fails. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized String pwd() - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering pwd(), (no leaving entry)"); - - connect(); - return issueCommand("PWD"); - } - - - - - -// --------------------------------------------------------------------------- - /** - * Removes this listener from being notified when a bound property changes. - * - * @param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - - if (changes_ != null) { - changes_.removePropertyChangeListener(listener); - } - } - - - -// --------------------------------------------------------------------------- - /** - * Removes a listener from the list. - * - * @param listener The FTP listener. - **/ - public void removeFTPListener(FTPListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - - if (listeners_ != null) { - listeners_.removeElement(listener); - } - } - - - -// --------------------------------------------------------------------------- - /** - * Removes this listener from being notified when a constrained property changes. - * - * @param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - - if (vetos_ != null) { - vetos_.removeVetoableChangeListener(listener); - } - } - - - - - - -// --------------------------------------------------------------------------- - /** - * During object deserialization, this method is called. When it is called - * we need to initialize transient data. - **/ - - private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - - connectionState_ = PARKED; - inConnect_ = false; - lastMessage_ = ""; - changes_ = null; - vetos_ = null; - listeners_ = null; - listenerLock_ = new Object(); - externallyConnected_ = false; // @D2a - } - - - - - - - - -// --------------------------------------------------------------------------- - /** - * Receives a reply from the system. This method is called only - * after calling the get() or put() methods where the calling program - * copies the data. - * @return The reply from the system. - * @exception IOException If an error occurs while communicating with the system. - **/ - - // - // Protocol is a reply is a three digit number followed by a dash or - // space, followed by text. A request can result in multiple replies. - // The three digit number of the last reply must match number of the - // first replay -- AND -- the character following the number must - // be a space. For example, a request could result in the following: - // 123-First line - // Second line - // 123-Third line - // 456-Fourth line - // 123 Last line - // - - String readReply() - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering readReply()"); - - String currentLine = reader_.readLine(); - - if ((currentLine == null) || (currentLine.length() == 0)) - throw new IOException(); - - String code = currentLine.substring(0, 3); - StringBuffer buf = new StringBuffer(currentLine); - - boolean Continue = true; - - while (Continue) - { - if ((currentLine.length() > 3) && - (currentLine.substring(0, 3).equals(code)) && - (currentLine.charAt(3) == ' ')) - { Continue = false; } - else - { - currentLine = reader_.readLine(); - buf.append("\n" + currentLine); - } - } - - lastMessage_ = buf.toString(); - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving readReply()"); - - return lastMessage_; - } - - - - - -// --------------------------------------------------------------------------- - /** - * Sets the buffer size used when transferring files. The default - * buffer size is 4096 bytes. - * @param bufferSize The size of the buffer used when transferring files. - * @exception PropertyVetoException If the change is vetoed. - **/ - - public synchronized void setBufferSize(int bufferSize) - throws PropertyVetoException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering setBufferSize()"); - - if (bufferSize < 1) - throw new IllegalArgumentException("bufferSize"); - - // Remember the old value. - int oldValue = bufferSize_; - - // Fire a vetoable change event. - if (vetos_ != null) { - vetos_.fireVetoableChange("bufferSize", new Integer(oldValue), new Integer(bufferSize)); - } - - bufferSize_ = bufferSize; - - // Fire the property change event. - if (changes_ != null) { - changes_.firePropertyChange("bufferSize", new Integer(oldValue), new Integer(bufferSize)); - } - } - - - - - - - -// --------------------------------------------------------------------------- - /** - * Sets the current directory on the system to directory. - * The method is the same as cd(). - * The message returned from the system is saved. Use getLastMessage() - * to retrieve it. - * @param directory The current directory to set on the system. - * @return true if directory changed; false otherwise. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized boolean setCurrentDirectory(String directory) - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering setCurrentDirectory(), (no leaving entry)"); - - return cd(directory); - } - - - - - - -// --------------------------------------------------------------------------- - /** - * Sets the data transfer type. Valid values are: - *

            - *
          • {@link #ASCII ASCII} - *
          • {@link #BINARY BINARY} - *
          - *

          - * If a connection does not - * already exist, a connection is made to the system. - * The message returned from the system is saved. Use getLastMessage() - * to retrieve it. - *
          Throws SecurityException if userid or password is invalid. - * @exception IOException If an error occurs while communicating with the system. - **/ - - public synchronized void setDataTransferType(int transferType) - throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering setDataTransferType()"); - - if ((transferType == ASCII) || - (transferType == BINARY)) - { - connect(); - if (transferType == ASCII) - issueCommand("TYPE A"); - else - issueCommand("TYPE I"); - } - else - throw new IllegalArgumentException("transferType"); - - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"leaving setDataTransferType()"); - } - - - - /** - * Sets the transfer mode. - * @param mode The mode. Valid values are {@link #ACTIVE_MODE ACTIVE_MODE} or {@link #PASSIVE_MODE PASSIVE_MODE}. - **/ - public void setMode(int mode) - { - if (mode != ACTIVE_MODE && mode != PASSIVE_MODE) - { - throw new IllegalArgumentException("mode"); - } - if (mode == ACTIVE_MODE && activeModeThread_ == null) - { - activeModeObject_ = new FTPThread(this); - activeModeThread_ = new Thread(activeModeObject_); - activeModeThread_.setDaemon(true); - // Don't start the thread yet, because we need to set our local InetAddress into it first, - // and we don't know what that is until we have connect()ed. - } - mode_ = mode; - } - -// --------------------------------------------------------------------------- - /** - * Sets the password. The password cannot be changed once - * a connection is made to the system. - * @param password The password for the user. - **/ - - public synchronized void setPassword(String password) - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering setPassword(), (no leaving entry)"); - - if (password == null) - throw new NullPointerException("password"); - - if (password.length() == 0) - throw new IllegalArgumentException("password"); - - try - { - Date d = new Date(); - Random r = new Random(d.getTime()); - - mask_ = new byte[7]; - r.nextBytes(mask_); - - adder_ = new byte[9]; - r.nextBytes(adder_); - - encryptedPassword_ = encode(password.getBytes(), mask_, adder_); - encrypted_ = true; - } - catch (Exception e) - { - encrypted_ = false; - clearPassword_ = password; - } - } - - - - -// --------------------------------------------------------------------------- - /** - * Sets the port to use when connecting to the system. - * The port cannot be changed once - * a connection is made to the system. - * @param port The port to use when connecting to the system. - * @exception PropertyVetoException If the change is vetoed. - **/ - - public synchronized void setPort(int port) - throws PropertyVetoException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering setPort()"); - - if (port < 1) - throw new IllegalArgumentException("port"); - - if (connectionState_ != PARKED) - throw new IllegalStateException("connected"); - - // Remember the old value. - int oldValue = port_; - - // Fire a vetoable change event. - if (vetos_ != null) { - vetos_.fireVetoableChange("port", new Integer(oldValue), new Integer(port)); - } - - port_ = port; - - // Fire the property change event. - if (changes_ != null) { - changes_.firePropertyChange("port", new Integer(oldValue), new Integer(port)); - } - } - - - - /** - * Indicates whether to reuse a socket for multiple file transfers, when in active mode. - * By default, the "reuse socket" attribute is set to the value of the com.ibm.as400.access.FTP.reuseSocket property. - * If the property is not set, the default is true (sockets are reused). - * The "reuse socket" attribute (of an FTP object) cannot be reset after that object has connected to the system. - * @param reuse If true, the socket is reused. If false, a new socket is created for each subsequent file transfer. - * @see #setMode - **/ - public void setReuseSocket(boolean reuse) - { - if (connectionState_ != PARKED) - throw new IllegalStateException("connected"); - - reuseSocket_ = reuse; - } - - - - - - -// --------------------------------------------------------------------------- - /** - * Sets the name of the system. The system name cannot be changed once - * a connection is made to the system. - * @param server The name of the system to which this object connects. - * @exception PropertyVetoException If the change is vetoed. - **/ - - public synchronized void setServer(String server) - throws PropertyVetoException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering setServer(), (no leaving entry)"); - - if (server == null) - throw new NullPointerException("server"); - - if (server.length() == 0) - throw new IllegalArgumentException("server"); - - if (connectionState_ != PARKED) - throw new IllegalStateException("connected"); - - // Remember the old system. - String oldServer = server_; - - // Fire a vetoable change event for system. - if (vetos_ != null) { - vetos_.fireVetoableChange("server", oldServer, server); - } - - server_ = server; - - // Fire the property change event. - if (changes_ != null) { - changes_.firePropertyChange("server", oldServer, server); - } - } - - - - - -// --------------------------------------------------------------------------- - /** - * Sets the user identifier used when connecting to the system. - * If the client is connected to the system, this method - * will disconnect the connection - * @param user The user identifier used when connecting to the system. - * @exception PropertyVetoException If the change is vetoed. - * @exception IllegalStateException If connection already established to the system. - **/ - - public synchronized void setUser(String user) - throws PropertyVetoException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"entering getUser(), (no leaving entry)"); - - if (user == null) - throw new NullPointerException("user"); - - if (user.length() == 0) - throw new IllegalArgumentException("user"); - - if (connectionState_ != PARKED) - throw new IllegalStateException("connected"); - - // Remember the old value. - String oldUser = user_; - - // Fire a vetoable change event. - if (vetos_ != null) { - vetos_.fireVetoableChange("user", oldUser, user); - } - - try - { - disconnect(); - } - catch (Exception e) {} - - user_ = user; - - // Fire the property change event. - if (changes_ != null) { - changes_.firePropertyChange("user", oldUser, user); - } - - } - - /** - * Renames one or more files on the system, according to a specified pattern. - *

          - * For example: - *

            - *
          • ren("*.txt","*.DONE") renames "file1.txt" to "file1.DONE", and so on - *
          • ren("*.txt","*_DONE.*) renames "file1.txt" to "file1_DONE.txt", and so on - *
          • ren("*.txt","*_1055am") renames "file1.txt" to "file1.txt_1055am", and so on - *
          - * - * @param fromName A pattern specifying the file(s) to be renamed. - * The syntax of the pattern is similar to the syntax for {@link #ls ls()}. - * @param toName The new file name, or a simple pattern - * describing how to construct the new name out of fromName. - * toName can contain up to two asterisks, one on each side of the ".". - * @return The number of files renamed. - * @throws IOException If an error occurs while communicating with the system. - **/ - - public synchronized int ren(String fromName, String toName) - throws IOException - { - int renamedCount = 0; - - if (Trace.isTraceOn()) - Trace.log( - Trace.DIAGNOSTIC, - "entering ren(), from file name is " - + fromName - + ", to file name is " - + toName - + "."); - - if (fromName == null) - throw new NullPointerException("fromName"); - if (toName == null) - throw new NullPointerException("toName"); - - if (fromName.trim().length() == 0) - throw new IllegalArgumentException("fromName"); - if (toName.trim().length() == 0) - throw new IllegalArgumentException("toName"); - - String[] entries = ls(fromName); - - for (int i=0; igenerateNewName("file.txt","*_DONE.*) returns "file_DONE.txt" - *
        • generateNewName("file.txt","*_1055am") returns "file.txt_1055am" - *
        - * - * @param fromName The original file name - * @param toName The new file name, or a simple pattern - * describing how to construct the new name out of fromName. - * toName can contain up to two asterisks, one on each side of the ".". - * @return The new file name. - * @throws NullPointerException if the fromName or toName - * parameters are null. - * @throws IllegalArgumentException if fromName or toName - * is null, or if the toName contains an invalid expression. - **/ - public static String generateNewName(String fromName, String toName) - { - if (fromName == null) - throw new NullPointerException("fromName"); - if (toName == null) - throw new NullPointerException("toName"); - - fromName = fromName.trim(); - if (fromName.length() < 1) - throw new IllegalArgumentException("fromName"); - toName = toName.trim(); - if (toName.length() < 1) - throw new IllegalArgumentException("toName"); - - if (toName.indexOf('*') < 0) - return toName; - - if (toName.indexOf('.') < 0) - return newNamePart(fromName, toName); - - String[] fromParts = splitName(fromName, '.'); - String[] toParts = splitName(toName, '.'); - - String theFront = newNamePart(fromParts[0], toParts[0]); - String theBack = newNamePart(fromParts[1], toParts[1]); - - String theNewName = theFront; - if (theBack.length() > 0) - theNewName = theNewName + "." + theBack; - - if (DEBUG) System.out.println("generateNewName(): " + fromName +", " + toName + ", -> " + theNewName); - return theNewName; - } - - /** - * Returns a new name constructed out of an old name - * using a very simple pattern containing at most one - * asterisk. The asterisk is replaced with the value - * of the old name. - *

        - * For example: - *

          - *
        • newNamePart("abc","xyz") returns "xyz" - *
        • newNamePart("abc","*_DONE") returns "abc_DONE"
        • - *
        • newNamePart("abc","DONE_*") returns "DONE_abc"
        • - *
        • newNamePart("abc","DONE_*_DONE") returns "DONE_abc_DONE" - *
        - * @param fromName the old name. - * @param toName the new name, containing no more than 1 asterisk. - * @return the constructed name. - **/ - static String newNamePart(String fromName, String toName) - { - int indexA = toName.indexOf('*'); - - // Return immediately if there is no asterisk in the to name. - if (indexA < 0) - return toName; - - // Cannot be more than 1 asterisk in the to name. - if ((indexA < (toName.length() - 1)) - && (toName.indexOf('*', indexA + 1) > 0)) - throw new IllegalArgumentException("toName"); - - StringBuffer nameBuff = new StringBuffer(); - - // LHS of asterisk - if (indexA > 0) - nameBuff.append(toName.substring(0, indexA)); - - // Asterisk is replaced with original name - nameBuff.append(fromName); - - // RHS of asterisk - if (indexA < (toName.length() - 1)) - nameBuff.append(toName.substring(indexA + 1)); - - return nameBuff.toString(); - } - - /** - * Utility method used to split a string into exactly - * two parts at the last occurrence of a - * given character. If the character is not found then - * the original string is returned as the first part. - * - * @param stringValue the striung value to split. - * @param c the character at which to split the string. - * @return String array with exactly 2 elements. - */ - static String[] splitName(String stringValue, char c) { - - String[] pieces = new String[2]; - - int splitIndex = stringValue.lastIndexOf(c); - - if (splitIndex >= 0) { - pieces[0] = stringValue.substring(0, splitIndex); - if (splitIndex < (stringValue.length() - 1)) { - pieces[1] = stringValue.substring(splitIndex + 1); - } else { - pieces[1] = ""; - } - } else { - pieces[0] = stringValue; - pieces[1] = ""; - } - - return pieces; - } - - - /** - * Utility method used to establish "passive" mode. - * - * @return The socket. - */ - final Socket getDataSocket() - throws IOException - { - // Try the extended passive command. - String response = issueCommand("EPSV"); - if (response.startsWith("229")) - { - // System supports EPSV. - - // Note: The response will be something like this (without the double-quotes): - // "229 Entering Extended Passive Mode (|||52900|)." - // Note: For some languages we will see a delimiter other than "|". - - // Locate the left-parenthesis. - int begin = response.indexOf('('); - if (begin == -1) { - Trace.log(Trace.ERROR, "FTP server response does not contain a left parenthesis."); - throw new InternalErrorException(InternalErrorException.SYNTAX_ERROR, response); - } - - // Locate the first digit of the port number. - int ii; - final int responseLength = response.length(); - for (ii=begin+1; ii LAST_EVENT) - { - throw new IllegalArgumentException("identifier"); - } - - id_ = id; - } - - - - - - - - - - /** - * Returns the identifier for this event. - * @return The identifier for this event. - **/ - public int getID() - { - return id_; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/FTPInputStream.java b/cvsroot/src/com/ibm/as400/access/FTPInputStream.java deleted file mode 100644 index 9193a8299..000000000 --- a/cvsroot/src/com/ibm/as400/access/FTPInputStream.java +++ /dev/null @@ -1,70 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FTPInputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.net.*; -import java.util.*; - -class FTPInputStream extends FilterInputStream -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - private FTP client_; - Socket dataSocket_; - private boolean open_ = false; - - - FTPInputStream(Socket dataSocket, FTP client) - throws IOException - { - super(dataSocket.getInputStream()); - - dataSocket_ = dataSocket; - client_ = client; - open_ = true; - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"Opening the input stream"); - } - - - public void close() throws IOException - { - if (open_) - { - super.close(); - dataSocket_.close(); - client_.readReply(); - open_ = false; - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"Closing the input stream"); - } - } - - - protected void finalize() - throws Throwable - { - super.finalize(); - close(); - } - - - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/FTPListener.java b/cvsroot/src/com/ibm/as400/access/FTPListener.java deleted file mode 100644 index 3290b50de..000000000 --- a/cvsroot/src/com/ibm/as400/access/FTPListener.java +++ /dev/null @@ -1,53 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FTPListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; -/** - The FTPListener interface provides - an interface for receiving FTPEvents. -**/ - -public interface FTPListener extends java.util.EventListener -{ - /** - * Invoked after a connection has been established. - * @param event The ftp event. - **/ - public void connected( FTPEvent event ); - - /** - * Invoked after the connection has been disconnected. - * @param event The ftp event. - **/ - public void disconnected( FTPEvent event ); - - /** - * Invoked after a file has been retrieved from the system. - * @param event The ftp event. - **/ - public void retrieved( FTPEvent event ); - - /** - * Invoked after a file has been put to the system. - * @param event The ftp event. - **/ - public void put( FTPEvent event ); - - /** - * Invoked after a list of files on the system has been retrieved. - * @param event The ftp event. - **/ - public void listed( FTPEvent event ); - -} - diff --git a/cvsroot/src/com/ibm/as400/access/FTPOutputStream.java b/cvsroot/src/com/ibm/as400/access/FTPOutputStream.java deleted file mode 100644 index f5a45ad43..000000000 --- a/cvsroot/src/com/ibm/as400/access/FTPOutputStream.java +++ /dev/null @@ -1,76 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FTPOutputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.net.*; -import java.util.*; - -class FTPOutputStream extends FilterOutputStream -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - private FTP client_; - private Socket dataSocket_; - private boolean open_ = false; - - - FTPOutputStream(Socket dataSocket, FTP client) - throws IOException - { - super(dataSocket.getOutputStream()); - dataSocket_ = dataSocket; - client_ = client; - open_ = true; - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"Opening the output stream"); - } - - - public void close() throws IOException - { - if (open_) - { - super.close(); - dataSocket_.close(); - client_.readReply(); - open_ = false; - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC,"Closing the output stream"); - } - } - - - protected void finalize() - throws Throwable - { - super.finalize(); - close(); - } - - - //@A1A: The performance of the default write() method in - // FilterOutputStream is atrocious. The javadoc says it only - // writes one byte at a time to the underlying stream and that - // subclasses should provide a more efficient implementation. - // We override it here to make it faster. - public void write(byte[] b, int off, int len) throws IOException //@A1A - { //@A1A - out.write(b, off, len); // out is inherited from the parent @A1A - } //@A1A -} - diff --git a/cvsroot/src/com/ibm/as400/access/FTPThread.java b/cvsroot/src/com/ibm/as400/access/FTPThread.java deleted file mode 100644 index bc4aed341..000000000 --- a/cvsroot/src/com/ibm/as400/access/FTPThread.java +++ /dev/null @@ -1,212 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FTPThread.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2004-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.net.*; -import java.io.*; -import java.util.*; - -class FTPThread implements Runnable -{ - private FTP ftp_; - - private int port_; - private Socket socket_; - private boolean running_ = false; - private final Object runLock_ = new Object(); - - private InetAddress localAddress_; - - FTPThread(FTP ftp) - { - ftp_ = ftp; - } - - // This must be called before the thread is started. - public void setLocalAddress(InetAddress localAddress) - { - localAddress_ = localAddress; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "FTP thread's local address set to: "+localAddress_.toString()); - } - - public void waitUntilStarted() - { - try - { - while (!running_) - { - synchronized (runLock_) - { - if (!running_) runLock_.wait(); - } - } - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Error while waiting for FTP thread to start.", e); - } - } - - public int getLocalPort() - { - return port_; - } - - public Socket getSocket() - { - if (socket_ == null) - { - try - { - synchronized(this) - { - if (socket_ == null) wait(60000); // Wait 60 seconds to prevent hanging. - } - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Error while getting socket from FTP thread.", e); - return null; - } - } - Socket s = socket_; - socket_ = null; - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "FTP thread returned previously accepted socket."); - if (s == null) Trace.log(Trace.DIAGNOSTIC, "FTPThread.getSocket() is returning null."); - } - return s; - } - - public void issuePortCommand() throws IOException - { - String addr = localAddress_.getHostAddress(); - // Try the extended port command. - String response = ftp_.issueCommand("EPRT |" + (addr.indexOf(':') == -1 ? "1" : "2") + "|" + addr + "|" + port_ + "|"); - if (response.startsWith("200")) return; - - // System may not support EPRT, fallback to the port command. - StringTokenizer st = new StringTokenizer(addr, "."); - StringBuffer cmd = new StringBuffer("PORT "); - while (st.hasMoreTokens()) - { - cmd.append(st.nextToken()); - cmd.append(","); - } - cmd.append(port_/256); - cmd.append(","); - cmd.append(port_ % 256); - response = ftp_.issueCommand(cmd.toString()); - // A "successful" response will begin with 200. - if (!response.startsWith("200")) - { - Trace.log(Trace.ERROR, "Unexpected response to " + cmd + ": " + response); - } - } - - public void run() - { - ServerSocket ss = null; - try - { - if (ftp_.isReuseSocket()) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "FTP thread will reuse socket if multiple transfers."); - ss = new ServerSocket(0, 50, localAddress_); - port_ = ss.getLocalPort(); - while (true) - { - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "FTP thread waiting for new active mode socket."); - } - if (!running_) - { - running_ = true; - synchronized (runLock_) - { - runLock_.notifyAll(); - } - } - socket_ = ss.accept(); - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "FTP thread accepted active mode socket: "+socket_); - } - synchronized (this) - { - notifyAll(); - } - } - } - else // don't reuse socket - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "FTP thread create new socket if multiple transfers."); - while (true) - { - if (ss == null) - { - ss = new ServerSocket(0, 1, localAddress_); - port_ = ss.getLocalPort(); - } - if (!running_) - { - running_ = true; - synchronized (runLock_) - { - runLock_.notifyAll(); - } - } - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "FTP thread waiting for new active mode socket."); - } - socket_ = ss.accept(); - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "FTP thread accepted active mode socket: "+socket_); - } - synchronized (this) - { - notifyAll(); - } - // Get a new server socket each time to avoid bug on AIX. - // We create the server socket with only 1 connection in the backlog - // so any other incoming requests will have to wait until we can get them - // a new server socket. This bottlenecks a multi-threaded client that is - // sharing an FTP object across threads, but they shouldn't be doing that anyway. - ss.close(); - ss = null; - } - } - } - catch (Throwable e) - { - Trace.log(Trace.ERROR, "Exception in FTP thread.", e); - } - finally - { - if (socket_ != null) { - try { socket_.close(); } - catch (Throwable e) { Trace.log(Trace.ERROR, e); } - } - if (ss != null) { - try { ss.close(); } - catch (Throwable e) { Trace.log(Trace.ERROR, e); } - } - } - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/FieldDescription.java b/cvsroot/src/com/ibm/as400/access/FieldDescription.java deleted file mode 100644 index c424b1cde..000000000 --- a/cvsroot/src/com/ibm/as400/access/FieldDescription.java +++ /dev/null @@ -1,737 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FieldDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.util.Vector; - -/** - *An abstract base class that allows the user to describe the data in a field - *with an AS400DataType object and a name. Optionally, the user can specify a - *data definition specification (DDS) field name and DDS keywords if the field will - *be used with the record level access classes to define a RecordFormat object - *with which to create a physical file. - *The FieldDescription class contains methods to - *set and get field attributes that are common to all field types.
        - *

        - *Examples - *

        -**/ -abstract public class FieldDescription implements Serializable -{ - static final long serialVersionUID = 4L; - - - - // Public constants. - /** Constant indicating left alignment of data within the field layout. **/ - /** This is only used for record level writing. **/ - public static final int ALIGN_LEFT = 1; // @C1A - /** Constant indicating right alignment of data within the field layout. **/ - /** This is only used for record level writing. **/ - public static final int ALIGN_RIGHT = 2; // @C1A - - // ALIAS keyword - String alias_ = ""; - // ALWNUL keyword - boolean allowNull_ = false; - // COLHDG keyword - String columnHeading_ = ""; - // AS400DataType object containing the description of the data as well - // as methods to convert the data to and from its IBM i format. - AS400DataType dataType_ = null; - // The DDS name of the field - String ddsName_ = ""; - // DFT keyword - Object defaultValue_ = null; - // Key field keywords specific to this key field. - String[] keyFieldFunctions_ = null; - // The layout length of the field. @C1A - int layoutLength_ = 0; // @C1A - // The layoutAlignment of the field. @C1A - int layoutAlignment_ = 0; // @C1A - // The length of the field - int length_; - // The name of the field. - String name_ = ""; - // REFFIL keyword - String refFil_ = ""; - // REFFLD keyword - String refFld_ = ""; - // REFFMT keyword - String refFmt_ = ""; - // REFLIB keyword - String refLib_ = ""; - // TEXT keyword - must be less than or equal to 50 characters - String text_ = ""; - //@B0A - // Is the default value for the field set to be CURRENT_DATE, CURRENT_TIME, or CURRENT_TIMESTAMP? - boolean isDFTCurrent_ = false; - //@B0A - // Is the default value for the field set to be *NULL - String DFTCurrentValue_ = null; - //@B0A - // Is the default value for the field set to be *NULL - boolean isDFTNull_ = false; - - /** - *Constructs a FieldDescription object. - **/ - protected FieldDescription() - { - } - - /** - *Constructs a FieldDescription object. It uses the specified data type and name of the field. - *The length of the field will be the length - *specified on the AS400DataType object. The DDS name of the field will be name - *if name is 10 characters or less. The DDS name of the field will be name - *truncated to 10 characters if name is greater than 10 characters. - *The layout length will be the length of the field, and the - *layout alignment will be ALIGN_LEFT. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - protected FieldDescription(AS400DataType dataType, String name) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - if (name == null) - { - throw new NullPointerException("name"); - } - dataType_ = dataType; - name_ = name; - ddsName_ = (name.length() > 10)? name.substring(0, 10).toUpperCase() : name.toUpperCase(); - length_ = dataType.getByteLength(); - } - - /** - *Constructs a FieldDescription object. It uses the specified data type, - *name, and DDS name of the field. - * The length of the field will be the length - *specified on the AS400DataType object. - *The layout length will be the length of the field, and the - *layout alignment will be ALIGN_LEFT. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - **/ - protected FieldDescription(AS400DataType dataType, String name, String ddsName) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - if (name == null) - { - throw new NullPointerException("name"); - } - if (ddsName == null) - { - throw new NullPointerException("ddsName"); - } - if (ddsName.length() > 10) - { - throw new ExtendedIllegalArgumentException("ddsName", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - dataType_ = dataType; - name_ = name; - ddsName_ = ddsName.toUpperCase(); - length_ = dataType.getByteLength(); - } - - /** - *Returns the value specified for the ALIAS keyword for this field. - *@return The value specified for the ALIAS keyword for this field. If ALIAS - * was not specified for this field, an empty string is returned. - **/ - public String getALIAS() - { - return alias_; - } - - /** - *Returns the value specified for the ALWNULL keyword for this field. - *@return The value specified for the ALWNULL (allow null value) keyword. If ALWNULL was not - *specified for this field, false is returned. - **/ - public boolean getALWNULL() - { - return allowNull_; - } - - /** - *Returns the value specified for the COLHDG keyword for this field. - *@return The value specified for the COLHDG (column heading) - * keyword for this field. If COLHDG was not specified for this field, - * an empty string is returned. - * For a description of the format of the 3-part column heading string, - * refer to {@link #setCOLHDG setCOLHDG()}. - **/ - public String getCOLHDG() - { - return columnHeading_; - } - - /** - *Returns the AS400DataType object describing this field, as specified on construction. - *@return The AS400DataType object that describes this field. If the - *data type has not been specified for this field, null is returned. - **/ - public AS400DataType getDataType() - { - return dataType_; - } - - /** - *Returns the value specified for the DFT keyword for this field. - *@return The value specified for the DFT (default) keyword for this field. - *If DFT was not specified for this field, null is returned. - **/ - public Object getDFT() - { - return defaultValue_; - } - - //@B0A - /** - *Returns the default value setting based on the current timestamp. - *If this field has had its default value set by calling setDFTCurrent(), - *then this method will return the value of the current Date, Time, or - *Timestamp to be used for that default value; otherwise, it returns null. - *@return The value being used as the "current" default value for this field. - *If DFT was not specified for this field, null is returned. - **/ - public String getDFTCurrentValue() - { - return DFTCurrentValue_; - } - - /** - *Returns the DDS description for the field. This is a string containing - *the description of the field as it would be specified in a DDS source file. - *This method is used by AS400File.createDDSSourceFile to specify the field - *in the DDS source file which is used to create the file for the user who - *has passed in a RecordFormat object. - *@return The DDS description of this field properly formatted for entry - *into a DDS source file. - **/ - abstract String[] getDDSDescription(); - - /** - *Returns the DDS name of this field, as specified on the construct. - *@return The DDS name of this field. If the DDS name for this field - *has not been specified, an empty string is returned. - **/ - public String getDDSName() - { - return ddsName_; - } - - /** - *Returns the common field level key words for the field. - *This method returns a string containing any keywords common to all fields - *that have been specified for the field, formatted for entry in a DDS source - *file. - *@return The common field level keywords specified for this field, properly - *formatted for entry into a DDS source file. - **/ - String[] getFieldFunctions() - { - Vector v = new Vector(); - if (!alias_.equals("")) - { - v.addElement("ALIAS(" + alias_ + ") "); - } - if (allowNull_) - { - v.addElement("ALWNULL "); - } - if (!columnHeading_.equals("")) - { - v.addElement("COLHDG(" + columnHeading_ + ") "); - } - if (!refFld_.equals("")) - { - v.addElement("REFFLD(" + refFld_ + ") "); - } - if (!refFil_.equals("")) - { - v.addElement("REFFIL(" + refFil_ + ") "); - } - if (!refFmt_.equals("")) - { - v.addElement("REFFMT(" + refFmt_ + ") "); - } - if (!refLib_.equals("")) - { - v.addElement("REFLIB(" + refLib_ + ") "); - } - if (!text_.equals("")) - { - v.addElement("TEXT('" + text_ + "') "); - } - if (v.size() != 0) - { - String[] s = new String[v.size()]; - v.copyInto(s); - return s; - } - // No field functions, return null - return null; - } - - /** - *Returns the name of this field. - *@return The name of this field. If the field name for this field - *has not been specified, an empty string is returned. - **/ - public String getFieldName() - { - return name_; - } - - /** - *Returns the string specified for any key field-level keywords for this - *field. - *@return The key field-level keywords that have - * been specified for this key field. If no key field - * functions have been specified, null is returned. - **/ - public String[] getKeyFieldFunctions() - { - return keyFieldFunctions_; - } - - - - // @C1A - added method - /** - *Returns the layout alignment of this field. The layout alignment specifies - *the location of the data as presented within the layout length of the field. - *This value is only used in conjunction with line data record writer class, - *and only if the including record format is of type - *FIXED_LAYOUT_LENGTH. - * - *@return The layout alignment of this field. - **/ - public int getLayoutAlignment() - { - return layoutAlignment_; - } - - - - // @C1A - added method - /** - *Returns the layout length of this field. The layout length is the - *actual character length of the field when written using the line - *data record writer class. The layout length is only valid - *if the including record format is of type - *FIXED_LAYOUT_LENGTH. - * - *@return The layout length of this field. - **/ - public int getLayoutLength() - { - return layoutLength_; - } - - - - /** - *Returns the length of this field. If this field is a character field (single byte or - *double byte, date, time, timestamp), the length is the number of characters allowed in the field. - *If this field is a numeric field (binary, float, packed, zoned), the length is the total - *number of digits allowed in the field. If this field is a hexadecimal field, the - *length is the number of bytes allowed in the field. - * - *@return The length of the field. - **/ - public int getLength() - { - return length_; - } - - /** - *Returns the value specified for the REFFIL keyword for this field. - *@return The value specified for the REFFIL (reference file) keyword - * for this field. If REFFIL was not specified for this field, - * an empty string is returned. - **/ - public String getREFFIL() - { - return refFil_; - } - - /** - *Returns the value specified for the REFFLD keyword for this field. - *@return The value specified for the REFFLD (reference field) keyword - * for this field. If REFFLD was not specified for this field, - * an empty string is returned. - **/ - public String getREFFLD() - { - return refFld_; - } - - /** - *Returns the value specified for the REFFMT keyword for this field. - *@return The value specified for the REFFMT (reference record format) keyword - * for this field. If REFFMT was not specified for this field, - * an empty string is returned. - **/ - public String getREFFMT() - { - return refFmt_; - } - - /** - *Returns the value specified for the REFLIB keyword for this field. - *@return The value specified for the REFLIB (reference library) keyword - * for this field. If REFLIB was not specified for this field, - * an empty string is returned. - **/ - public String getREFLIB() - { - return refLib_; - } - - /** - *Returns the value specified for the TEXT keyword for this field. - *@return The value specified for the TEXT keyword - * for this field. If TEXT was not specified for this field, - * an empty string is returned. - **/ - public String getTEXT() - { - return text_; - } - - //@B0A - /** - *Indicates if the default value for this field is set to one of the - *SQL special values of CURRENT_DATE, CURRENT_TIME, or CURRENT_TIMESTAMP. - *@return True if the default value is set to one of the above. - **/ - public boolean isDFTCurrent() - { - return isDFTCurrent_; - } - - /** - *Sets the value for the ALIAS keyword for this field. - *@param alias The alias for this field. - **/ - public void setALIAS(String alias) - { - if (alias == null) - { - throw new NullPointerException("alias"); - } - alias_ = alias; - } - - /** - *Sets the value for the ALWNULL keyword for this field. - *@param allowNull true if a null value is allowed; false otherwise. - **/ - public void setALWNULL(boolean allowNull) - { - allowNull_ = allowNull; - } - - /** - *Sets the value for the COLHDG keyword for this field. - *@param colHdg The value for the COLHDG (column heading) keyword - * for this field.
        - * Format: "'Col heading 1' 'Col heading 2' 'Col heading 3'"
        - * Examples: - *
        -   *                        String colHdg = "'Name'";
        -   *                        String colHdg = "'Employee' 'Number'";
        -   *                        String colHdg = "'Name' 'And' 'Address'";
        -   *                     
        - **/ - public void setCOLHDG(String colHdg) - { - if (colHdg == null) - { - throw new NullPointerException("colHdg"); - } - columnHeading_ = colHdg; - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - protected void setDataType(AS400DataType dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - } - - /** - *Sets the DDS name of this field. - *@param ddsName The DDS name of this field. The ddsName cannot be - *more than 10 characters in length. - **/ - public void setDDSName(String ddsName) - { - // Verify parameters - if (ddsName == null) - { - throw new NullPointerException("ddsName"); - } - if (ddsName.length() > 10) - { - throw new ExtendedIllegalArgumentException("ddsName", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - ddsName_ = ddsName.toUpperCase(); - } - - /** - *Sets the name of this field. - *@param fieldName The name of this field. The fieldName cannot be null. - **/ - public void setFieldName(String fieldName) - { - // Verify parameters - if (fieldName == null) - { - throw new NullPointerException("fieldName"); - } - name_ = fieldName; - } - - /** - *Sets the string to be specified for all key field-level keywords for this - *field. - *@param keyFunctions The key field-level keywords to be - * specified for this key field. - *The keyFunctions must contain at least one element. - **/ - public void setKeyFieldFunctions(String[] keyFunctions) - { - if (keyFunctions == null) - { - throw new NullPointerException("keyFunctions"); - } - if (keyFunctions.length == 0) - { - throw new ExtendedIllegalArgumentException("keyFunctions", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - keyFieldFunctions_ = keyFunctions; - } - - - - // @C1A - added method - /** - *Sets the layout alignment of this field. The layout alignment specifies - *the location of the data as presented within the layout length of the field. - *This value is only used in conjunction with the line data record writer class, - *and only if the including record format is of type - *FIXED_LAYOUT_LENGTH. -

        - *The following special values are valid: - *

          - *
        • ALIGN_LEFT - Left alignment of data within the field layout. - *
        • ALIGN_RIGHT - Right alignment of data within the field layout. - *
        - * - *@param layoutAlignment The layout alignment of this field. - **/ - public void setLayoutAlignment(int layoutAlignment) - { - if ((layoutAlignment != ALIGN_LEFT) && (layoutAlignment != ALIGN_RIGHT)) { - throw new ExtendedIllegalArgumentException("layoutAlignment", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - layoutAlignment_ = layoutAlignment; - } - - - - // @C1A - added method - /** - *Sets the layout length and layout alignment of this field. - *The layout length is the - *actual character length of the field when written using - *the line data record writer class. - *The layout length must be 50 characters or less. - *The layout alignment specifies - *the location of the data as presented within the layout length of the field. - *These values are only used in conjunction with the line data record writer class, - *and only if the including record format is of type - *FIXED_LAYOUT_LENGTH. - *

        - *The following special values for the layout alignment are valid: - *

          - *
        • ALIGN_LEFT - Left alignment of data within the field layout. - *
        • ALIGN_RIGHT - Right alignment of data within the field layout. - *
        - * - *@param layoutLength The layout length of this field. - *@param layoutAlignment The layout alignment of this field. - **/ - public void setLayoutAttributes(int layoutLength, int layoutAlignment) - { - if ((layoutLength > 50) || (layoutLength < 0)) { - throw new ExtendedIllegalArgumentException("layoutLength", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - if ((layoutAlignment != ALIGN_LEFT) && (layoutAlignment != ALIGN_RIGHT)) { - throw new ExtendedIllegalArgumentException("layoutAlignment", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - layoutLength_ = layoutLength; - layoutAlignment_ = layoutAlignment; - } - - - - // @C1A - added method - /** - *Sets the layout length of this field. The layout length is the - *actual character length of the field when written using the - *line data record writer class. The layout length is only valid - *if the including record format is of type - *FIXED_LAYOUT_LENGTH. - *The layout length must be 50 characters or less. - *NOTE: The layout length does not have to equal the length of the field. - * - *@param layoutLength The layout length of this field. - **/ - public void setLayoutLength(int layoutLength) - { - if ((layoutLength > 50) || (layoutLength < 0)) { - throw new ExtendedIllegalArgumentException("layoutLength", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - layoutLength_ = layoutLength; - } - - - - /** - *Sets the value to be specified for the REFFIL keyword for this field. - *@param refFil The value for the REFFIL (reference file) keyword - * for this field. - **/ - public void setREFFIL(String refFil) - { - if (refFil == null) - { - throw new NullPointerException("refFil"); - } - refFil_ = refFil; - } - - - /** - *Sets the value to be specified for the REFFLD keyword for this field. - *@param refFld The value for the REFFLD (reference field) keyword - * for this field. - **/ - public void setREFFLD(String refFld) - { - if (refFld == null) - { - throw new NullPointerException("refFld"); - } - refFld_ = refFld; - } - - - /** - *Sets the value to be specified for the REFFMT keyword for this field. - *@param refFmt The value for the REFFMT (reference record format) keyword - * for this field. - **/ - public void setREFFMT(String refFmt) - { - if (refFmt == null) - { - throw new NullPointerException("refFmt"); - } - refFmt_ = refFmt; - } - - - /** - *Sets the value to be specified for the REFLIB keyword for this field. - *@param refLib The value for the REFLIB (reference library) keyword - * for this field. - **/ - public void setREFLIB(String refLib) - { - if (refLib == null) - { - throw new NullPointerException("refLib"); - } - refLib_ = refLib; - } - - /** - *Sets the value to be specified for the TEXT keyword for this field. - *@param text The value for the TEXT keyword - * for this field. The single quotes required to - * surround the TEXT keyword value are added by this class. - *The text must be 50 characters or less in length. - **/ - public void setTEXT(String text) - { - if (text == null) - { - throw new NullPointerException("text"); - } - if (text.length() > 50) - { - throw new ExtendedIllegalArgumentException("text", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - text_ = text; - } - - //@B0A - /** - *Indicates if the DFT keyword for this field is set to *NULL. - *@return True if the DFT keyword is set to *NULL. - **/ - public boolean isDFTNull() - { - return isDFTNull_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/FileAttributes.java b/cvsroot/src/com/ibm/as400/access/FileAttributes.java deleted file mode 100644 index d77ed0dbd..000000000 --- a/cvsroot/src/com/ibm/as400/access/FileAttributes.java +++ /dev/null @@ -1,2113 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FileAttributes.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.util.Date; - -/** - Represents the set of file attributes that can be retrieved and set through the Qp0lGetAttr() and Qp0lSetAttr() API's. The object must exist and the caller must have authority to it. Only attributes supported by the specific file system, object type, and operating system release can be retrieved or set. - **/ -public class FileAttributes -{ - // The system where file is located. - private AS400 system_; - // Path to the object. - private String path_; - // Whether symlinks are followed. - private boolean followSymbolicLink_; - - // Flag indicating if the attributes have been retrieved. - private boolean attributesRetrieved_ = false; - - /** - Constructs a FileAttributes object. - If the file specified by path is a symbolic link, the link is followed to its destination. - @param system The system object representing the system on which the file exists. - @param path The path name of the object for which attribute information is retrieved or set. - **/ - public FileAttributes(AS400 system, String path) - { - this(system, path, true); - } - - /** - Constructs a FileAttributes object. - @param system The system object representing the system on which the file exists. - @param path The path name of the object for which attribute information is retrieved or set. - @param followSymbolicLink If the last component in the path is a symbolic link, indicates if the symbolic link is followed. true to operate on the attributes of the object contained in the symbolic link, false to operate on the symbolic link. - **/ - public FileAttributes(AS400 system, String path, boolean followSymbolicLink) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing FileAttributes object, system: " + system + ", path: " + path + ", followSymbolicLink: " + followSymbolicLink); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (path == null) - { - Trace.log(Trace.ERROR, "Parameter 'path' is null."); - throw new NullPointerException("path"); - } - system_ = system; - path_ = path; - followSymbolicLink_ = followSymbolicLink; - } - - // Utility method to convert String path into path name parameter used by API's. - private byte[] createPathName() throws IOException - { - Converter conv = new Converter(1200, system_); - - byte[] pathName = new byte[32 + path_.length() * 2]; - BinaryConverter.intToByteArray(1200, pathName, 0); - BinaryConverter.intToByteArray(2, pathName, 12); - BinaryConverter.intToByteArray(path_.length() * 2, pathName, 16); - conv.stringToByteArray("/", pathName, 20, 2); - conv.stringToByteArray(path_, pathName, 32); - return pathName; - } - - // The object type. - String objectType_; - /** - Returns the object type. - @return The object type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getObjectType() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return objectType_; - } - - // The size of the extended attributes. - long extendedAttributeSize_; - /** - Returns the total number of extended attribute bytes. - @return The total number of extended attribute bytes. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getExtendedAttributeSize() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return extendedAttributeSize_; - } - - // The time the object was created. - Date createTime_; - /** - Returns the time the object was created. - @return The time the object was created. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Date getCreateTime() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return createTime_; - } - /** - Sets the time the object was created. - @param createTime The time the object was created. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setCreateTime(Date createTime) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (createTime == null) - { - Trace.log(Trace.ERROR, "Parameter 'createTime' is null."); - throw new NullPointerException("createTime"); - } - setAttributes(createTime, (byte)4); - } - - // The time that the object's data was last accessed. - Date accessTime_; - /** - Returns the time that the object's data was last accessed. - @return The time that the object's data was last accessed. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Date getAccessTime() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return accessTime_; - } - /** - Sets the time that the object's data was last accessed. - @param accessTime The time that the object's data was last accessed. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setAccessTime(Date accessTime) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (accessTime == null) - { - Trace.log(Trace.ERROR, "Parameter 'accessTime' is null."); - throw new NullPointerException("accessTime"); - } - setAttributes(accessTime, (byte)5); - } - - // The time that the object's data or attributes were last changed. - Date changeTime_; - /** - Returns the time that the object's data or attributes were last changed. - @return The time that the object's data or attributes were last changed. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Date getChangeTime() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return changeTime_; - } - - // The time that the object's data was last changed. - Date modifyTime_; - /** - Returns the time that the object's data was last changed. - @return The time that the object's data was last changed. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Date getModifyTime() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return modifyTime_; - } - /** - Sets the time that the object's data was last changed. - @param modifyTime The time that the object's data was last changed. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setModifyTime(Date modifyTime) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (modifyTime == null) - { - Trace.log(Trace.ERROR, "Parameter 'modifyTime' is null."); - throw new NullPointerException("modifyTime"); - } - setAttributes(modifyTime, (byte)7); - } - - // Indicates if storage is freed. - boolean storageFree_; - /** - Returns whether the object's data has been moved offline, freeing its online storage. - @return true if the object's data is offline; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isStorageFree() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return storageFree_; - } - - // Indicates if object is checked out. - boolean checkedOut_; - /** - Returns whether the object is checked out or not. When an object is checked out, other users can read and copy the object. Only the user who has the object checked out can change the object. - @return true if object is checked out; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isCheckedOut() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return checkedOut_; - } - - // The user who has the object checked out. - String checkedOutUser_; - /** - Returns the user who has the object checked out. - @return The user who has the object checked out. An empty string ("") is returned if the object is not checked out. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getCheckedOutUser() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return checkedOutUser_; - } - - // The time the object was checked out. - Date checkOutTime_; - /** - Returns the time the object was checked out. - @return The time the object was checked out. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Date getCheckOutTime() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return checkOutTime_; - } - - /** - Constant indicating that the object's data is stored locally. - @see #getLocalRemote - **/ - public static final int LOCAL_OBJECT = 0x01; - /** - Constant indicating that the object's data is on a remote system. - @see #getLocalRemote - **/ - public static final int REMOTE_OBJECT = 0x02; - // The location of an object's storage. - int localRemote_; - /** - Returns whether the object is stored locally or stored on a remote system. The decision of whether a file is local or remote varies according to the respective file system rules. Objects in file systems that do not carry either a local or remote indicator are treated as remote. - @return The location of an object's storage. Possible values are: -
          -
        • {@link #LOCAL_OBJECT LOCAL_OBJECT} - The object's data is stored locally. -
        • {@link #REMOTE_OBJECT REMOTE_OBJECT} - The object's data is on a remote system. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getLocalRemote() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return localRemote_; - } - - // The name of the owner of the object. - String objectOwner_; - /** - Returns the name of the user profile that is the owner of the object. - @return The name of the user profile that is the owner of the object or the special value "*NOUSRPRF" which is an indication by the Network File System that there is no user profile on the local IBM i system with a user ID (UID) matching the UID of the remote object. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getObjectOwner() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return objectOwner_; - } - - // The name of the primary group of the object. - String primaryGroup_; - /** - Returns the name of the user profile that is the primary group of the object. - @return The name of the user profile that is the primary group of the object or the following special values: -
          -
        • "*NONE" - The object does not have a primary group. -
        • "*NOUSRPRF" - This special value is used by the Network File System to indicate that there is no user profile on the local system with a group ID (GID) matching the GID of the remote object. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getPrimaryGroup() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return primaryGroup_; - } - - // The name of the authorization list. - String authorizationListName_; - /** - Returns the name of the authorization list that is used to secure the named object. - @return The name of the authorization list that is used to secure the named object. The value *NONE indicates that no authorization list is used in determining authority to the object. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getAuthorizationListName() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return authorizationListName_; - } - - // The identifier associated with the referred to object. - byte[] fileId_; - /** - Returns the identifier associated with the referred to object. - @return The identifier associated with the referred to object. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public byte[] getFileId() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return fileId_; - } - - // The auxiliary storage pool in which the object is stored. - short asp_; - /** - Returns the auxiliary storage pool in which the object is stored. - @return The auxiliary storage pool (ASP) in which the object is stored. - Possible values are: -
          -
        • 1: the system ASP (QASP01, also known as the system disk pool) -
        • 2 to 32: user ASPs (QASP02 to QASP32) -
        • 33 to 255: independent ASPs -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public short getAsp() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return asp_; - } - - // - long dataSize_; - /** - Returns the size in bytes of the data in this object. The size varies by object type and file system. This size does not include object headers or the size of extended attributes associated with the object. - @return The size in bytes of the data in this object. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getDataSize() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return dataSize_; - } - - // The number of bytes that have been allocated for this object. - long allocatedSize_; - /** - Returns the number of bytes that have been allocated for this object. The allocated size varies by object type and file system. For example, the allocated size includes the object data size as shown in getDataSize() as well as any logically sized extents to accommodate anticipated future requirements for the object data. It may or may not include additional bytes for attribute information. - @return The number of bytes that have been allocated for this object. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getAllocatedSize() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return allocatedSize_; - } - - // The date the days used count was last reset to zero (0). - Date resetDate_; - /** - Returns the date the days used count was last reset to zero (0). This date is set to the current date when resetDate() is called to reset the days used count to zero. - @return The date the days used count was last reset to zero (0). - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Date getResetDate() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return resetDate_; - } - - // The date the object was last used. - Date lastUsedDate_; - /** - Returns the date the object was last used. If the object has not been used or if usage data is not maintained for the IBM i type or the file system to which an object belongs, null is returned. - @return The date the object was last used. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Date getLastUsedDate() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return lastUsedDate_; - } - - // The number of days an object has been used. - int daysUsedCount_; - /** - Returns the number of days an object has been used. Usage has different meanings according to the specific file system and according to the individual object types supported within a file system. Usage can indicate the opening or closing of a file or can refer to adding links, renaming, restoring, or checking out an object. This count is incremented once each day that an object is used and is reset to zero by calling resetDate(). - @return The number of days an object has been used. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getDaysUsedCount() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return daysUsedCount_; - } - - // Whether the object is read only. - boolean pcReadOnly_; - /** - Returns whether the object can be written to or deleted, have its extended attributes changed or deleted, or have its size changed. - @return true if the object cannot be changed; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isPcReadOnly() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return pcReadOnly_; - } - /** - Sets whether the object can be written to or deleted, have its extended attributes changed or deleted, or have its size changed. - @param pcReadOnly true if the object cannot be changed; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setPcReadOnly(boolean pcReadOnly) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAttributes(pcReadOnly, (byte)17); - } - - // Whether the object is hidden. - boolean pcHidden_; - /** - Returns whether the object can be displayed using an ordinary directory listing. - @return true if the object is hidden; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isPcHidden() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return pcHidden_; - } - /** - Sets the whether the object can be displayed using an ordinary directory listing. - @param pcHidden true if the object is hidden; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setPcHidden(boolean pcHidden) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAttributes(pcHidden, (byte)18); - } - - // Whether the object is a system file. - boolean pcSystem_; - /** - Returns whether the object is a system file and is excluded from normal directory searches. - @return true if the object is a system file; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isPcSystem() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return pcSystem_; - } - /** - Sets whether the object is a system file and is excluded from normal directory searches. - @param pcSystem true if the object is a system file; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setPcSystem(boolean pcSystem) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAttributes(pcSystem, (byte)19); - } - - // Whether the object has changed. - boolean pcArchive_; - /** - Returns whether the object has changed since the last time the file was examined. - @return true if the object has changed; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isPcArchive() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return pcArchive_; - } - /** - Sets whether the object has changed since the last time the file was saved or reset by a PC client. - @param pcArchive true if the object has changed; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setPcArchive(boolean pcArchive) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAttributes(pcArchive, (byte)20); - } - - // Whether the object has changed and needs to be saved. - boolean systemArchive_; - /** - Returns whether the object has changed and needs to be saved. It is set on when an object's change time is updated, and set off when the object has been saved. - @return true if the object has changed and does need to be saved; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isSystemArchive() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return systemArchive_; - } - /** - Sets whether the object has changed and needs to be saved. It is set on when an object's change time is updated, and set off when the object has been saved. - @param systemArchive true if the object has changed and does need to be saved; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setSystemArchive(boolean systemArchive) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAttributes(systemArchive, (byte)21); - } - - // The code page. - int codePage_; - /** - Returns the code page derived from the coded character set identifier (CCSID) used for the data in the file or the extended attributes of the directory. If the returned value of this field is zero (0), there is more than one code page associated with the st_ccsid. If the st_ccsid is not a supported system CCSID, the st_codepage is set equal to the st_ccsid. - @return The code page derived from the coded character set identifier (CCSID) used for the data in the file or the extended attributes of the directory. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getCodePage() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return codePage_; - } - /** - Sets the code page used to derive a coded character set identifier (CCSID) used for the data in the file or the extended attributes of the directory. - @param codePage The code page used to derive a coded character set identifier (CCSID) used for the data in the file or the extended attributes of the directory. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setCodePage(int codePage) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAttributes(codePage, (byte)22); - } - - /** - Constant indicating that the file has format type 1. - @see #getFileFormat - **/ - public static final int FILE_FORMAT_TYPE1 = 0x00; - /** - Constant indicating that the file has format type 2. - @see #getFileFormat - **/ - public static final int FILE_FORMAT_TYPE2 = 0x01; - // The format of the stream file. - int fileFormat_; - /** - Returns the format of the stream file. - @return The format of the stream file (*STMF). Possible values are: -
          -
        • {@link #FILE_FORMAT_TYPE1 FILE_FORMAT_TYPE1} - The object has the same format as *STMF objects created on releases prior to Version 4 Release 4. It has a minimum object size of 4096 bytes and a maximum object size of approximately 128 gigabytes. -
        • {@link #FILE_FORMAT_TYPE2 FILE_FORMAT_TYPE2} - The *STMF has high performance file access and was new in OS/400 V4R4. It has a minimum object size of 4096 bytes and a maximum object size of approximately one terabyte in the "root" (/), QOpenSys and user-defined file systems. Otherwise, the maximum is approximately 256 gigabytes. A *TYPE2 *STMF is capable of memory mapping as well as the ability to specify an attribute to optimize disk storage allocation. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getFileFormat() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return fileFormat_; - } - - /** - Constant indicating that the default file format of stream files created in the user-defined file system is format type 1. - @see #getUdfsDefaultFormat - **/ - public static final int UDFS_DEFAULT_TYPE1 = 0x00; - /** - Constant indicating that the default file format of stream files created in the user-defined file system is format type 2. - @see #getUdfsDefaultFormat - **/ - public static final int UDFS_DEFAULT_TYPE2 = 0x01; - // The default file format of stream files created in the user-defined file system. - int udfsDefaultFormat_ = UDFS_DEFAULT_TYPE1; - - - /** - Returns the default file format of stream files (*STMF) created in the user-defined file system. - @return The default file format of stream files (*STMF) created in the user-defined file system. Possible values are: -
          -
        • {@link #UDFS_DEFAULT_TYPE1 UDFS_DEFAULT_TYPE1} - The stream file (*STMF) has the same format as *STMF's created on releases prior to OS/400 V4R4. It has a minimum object size of 4096 bytes and a maximum object size of approximately 256 gigabytes. -
        • {@link #UDFS_DEFAULT_TYPE2 UDFS_DEFAULT_TYPE2} - A *TYPE2 *STMF has high performance file access and was new in OS/400 V4R4. It has a minimum object size of 4096 bytes and a maximum object size of approximately one terabyte in the "root" (/), QOpenSys and user-defined file systems. Otherwise, the maximum is approximately 256 gigabytes. A *TYPE2 *STMF is capable of memory mapping as well as the ability to specify an attribute to optimize disk storage allocation. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getUdfsDefaultFormat() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return udfsDefaultFormat_; - } - - -/* /// -45 -QP0L_ATTR_UDFS_PREFERRED_STORAGE_UNIT: (CHAR(1)) The preferred -storage media for the objects in the UDFS. Possible values are: -x'00' QP0L_UDFS_PREFERRED_STORAGE_UNIT_ANY: No storage media is -preferred. Storage will be allocated from any available storage media. -x'01' QP0L_UDFS_PREFERRED_STORAGE_UNIT_SSD: Solid state drive storage media is preferred. Storage should be allocated from solid state drive storage media, if available. - -*/ - // Attribute added in the release after V7R1, and PTF'd back to V7R1. - /** - Constant indicating that no storage media is preferred. Storage will be allocated from any available storage media. - @see #getUdfsPreferredStorageUnit - **/ - public static final int UDFS_PREFERRED_STORAGE_UNIT_ANY = 0x00; - /** - Constant indicating that solid state drive storage media is preferred. Storage should be allocated from solid state drive storage media, if available. - @see #getUdfsPreferredStorageUnit - **/ - public static final int UDFS_PREFERRED_STORAGE_UNIT_SSD = 0x01; - // The preferred storage media for the objects in the UDFS. Added in V7R1 (in a PTF). - private int udfsStorageUnit_ = UDFS_PREFERRED_STORAGE_UNIT_ANY; // default is "ANY" - - /** - Returns the preferred storage media for the objects in the UDFS. -

        Note: This method is supported only on IBM i version 7.1 and higher. On IBM i version 7.1 it is supported only if IBM i 7.1 PTF SI39439 is installed. - When unsupported, this method simply returns {@link #UDFS_PREFERRED_STORAGE_UNIT_ANY UDFS_PREFERRED_STORAGE_UNIT_ANY}. - @return The preferred storage media for the objects in the UDFS. Possible values are: -

          -
        • {@link #UDFS_PREFERRED_STORAGE_UNIT_ANY UDFS_PREFERRED_STORAGE_UNIT_ANY} - No storage media is preferred. Storage will be allocated from any available storage media. -
        • {@link #UDFS_PREFERRED_STORAGE_UNIT_SSD UDFS_PREFERRED_STORAGE_UNIT_SSD} - Solid state drive storage media is preferred. Storage should be allocated from solid state drive storage media, if available. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getUdfsPreferredStorageUnit() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return udfsStorageUnit_; - } - - - // Whether the stream file can be shared during checkpoint processing. - boolean allowCheckpointWrite_; - /** - Returns whether a stream file (*STMF) can be shared with readers and writers during the save-while-active checkpoint processing. - @return true if the object can be shared with readers and writers; false if the object can be shared with readers only. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isAllowCheckpointWrite() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return allowCheckpointWrite_; - } - /** - Sets whether a stream file (*STMF) can be shared with readers and writers during the save-while-active checkpoint processing. Setting this attribute may cause unexpected results. See the Back up your system topic for details on this attribute. - @param allowCheckpointWrite true if the object can be shared with readers and writers; false if the object can be shared with readers only. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setAllowCheckpointWrite(boolean allowCheckpointWrite) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAttributes(allowCheckpointWrite, (byte)26); - } - - // The CCSID of the data and extended attributes of the object. - int ccsid_; - /** - Returns the CCSID of the data and extended attributes of the object. - @return The CCSID of the data and extended attributes of the object. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getCcsid() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return ccsid_; - } - /** - Sets the CCSID of the data and extended attributes of the object. - @param ccsid The CCSID of the data and extended attributes of the object. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setCcsid(int ccsid) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAttributes(ccsid, (byte)27); - } - - // Whether the object has an IBM i digital signature. - boolean signed_; - /** - Returns whether the object has an IBM i digital signature. This attribute is only returned for *STMF objects. - @return true if the object does have an IBM i digital signature; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isSigned() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return signed_; - } - - // Whether the object was signed by a source that is trusted by the system. - boolean systemSigned_; - /** - Returns whether the object was signed by a source that is trusted by the system. This attribute is only returned for *STMF objects. - @return true if the object was signed by a source that is trusted by the system, if the object has multiple signatures, at least one of the signatures came from a source that is trusted by the system; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isSystemSigned() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return systemSigned_; - } - - // Whether the object has more than one IBM i digital signature. - boolean multipleSignatures_; - /** - Returns whether the object has more than one IBM i digital signature. This attribute is only returned for *STMF objects. - @return true if the object has more than one digital signature; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isMultipleSignatures() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return multipleSignatures_; - } - - /** - Constant indicating that storage will be allocated normally. - @see #getDiskStorageOption - @see #setDiskStorageOption - @see #getMainStorageOption - @see #setMainStorageOption - **/ - public static final int STORAGE_NORMAL = 0x00; - /** - Constant indicating that storage will be allocated to minimize the space used by the object. - @see #getDiskStorageOption - @see #setDiskStorageOption - @see #getMainStorageOption - @see #setMainStorageOption - **/ - public static final int STORAGE_MINIMIZE = 0x01; - /** - Constant indicating that the system will dynamically determine the optimum storage allocation for the object. - @see #getDiskStorageOption - @see #setDiskStorageOption - @see #getMainStorageOption - @see #setMainStorageOption - **/ - public static final int STORAGE_DYNAMIC = 0x02; - // How auxiliary storage is allocated by the system. - int diskStorageOption_; - /** - Returns how auxiliary storage is allocated by the system for the specified object. This option can only be specified for stream files in the "root" (/), QOpenSys and user-defined file systems. This option will be ignored for *TYPE1 byte stream files. - @return How auxiliary storage is allocated by the system for the specified object. Possible values are: -
          -
        • {@link #STORAGE_NORMAL STORAGE_NORMAL} - The auxiliary storage will be allocated normally. That is, as additional auxiliary storage is required, it will be allocated in logically sized extents to accommodate the current space requirement, and anticipated future requirements, while minimizing the number of disk I/O operations. -
        • {@link #STORAGE_MINIMIZE STORAGE_MINIMIZE} - The auxiliary storage will be allocated to minimize the space used by the object. That is, as additional auxiliary storage is required, it will be allocated in small sized extents to accommodate the current space requirement. Accessing an object composed of many small extents may increase the number of disk I/O operations for that object. -
        • {@link #STORAGE_DYNAMIC STORAGE_DYNAMIC} - The system will dynamically determine the optimum auxiliary storage allocation for the object, balancing space used versus disk I/O operations. For example, if a file has many small extents, yet is frequently being read and written, then future auxiliary storage allocations will be larger extents to minimize the number of disk I/O operations. Or, if a file is frequently truncated, then future auxiliary storage allocations will be small extents to minimize the space used. Additionally, information will be maintained on the stream file sizes for this system and its activity. This file size information will also be used to help determine the optimum auxiliary storage allocations for this object as it relates to the other objects sizes. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getDiskStorageOption() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return diskStorageOption_; - } - /** - Sets which option should be used to determine how auxiliary storage is allocated by the system for the specified object. The option will take effect immediately and be part of the next auxiliary storage allocation for the object. This option can only be specified for byte stream files in the "root" (/), QOpenSys and user-defined file systems. This option will be ignored for *TYPE1 byte stream files. - @param diskStorageOption The option which should be used to determine how auxiliary storage is allocated by the system for the specified object. Possible values are: -
          -
        • {@link #STORAGE_NORMAL STORAGE_NORMAL} - The auxiliary storage will be allocated normally. That is, as additional auxiliary storage is required, it will be allocated in logically sized extents to accommodate the current space requirement, and anticipated future requirements, while minimizing the number of disk I/O operations. This option is the default. -
        • {@link #STORAGE_MINIMIZE STORAGE_MINIMIZE} - The auxiliary storage will be allocated to minimize the space used by the object. That is, as additional auxiliary storage is required, it will be allocated in small sized extents to accommodate the current space requirement. Accessing an object composed of many small extents may increase the number of disk I/O operations for that object. -
        • {@link #STORAGE_DYNAMIC STORAGE_DYNAMIC} - The system will dynamically determine the optimum auxiliary storage allocation for the object, balancing space used versus disk I/O operations. For example, if a file has many small extents, yet is frequently being read and written, then future auxiliary storage allocations will be larger extents to minimize the number of disk I/O operations. Or, if a file is frequently truncated, then future auxiliary storage allocations will be small extents to minimize the space used. Additionally, information will be maintained on the stream file sizes for this system and its activity. This file size information will also be used to help determine the optimum auxiliary storage allocations for this object as it relates to the other objects sizes. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setDiskStorageOption(int diskStorageOption) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAttributes((byte)diskStorageOption, (byte)31); - } - - // How main storage is allocated by the system. - int mainStorageOption_; - /** - Returns how main storage is allocated and used by the system for the specified object. This option can only be specified for stream files in the "root" (/), QOpenSys and user-defined file systems. - @return How main storage is allocated and used by the system for the specified object. Possible values are: -
          -
        • {@link #STORAGE_NORMAL STORAGE_NORMAL} - The main storage will be allocated normally. That is, as much main storage as possible will be allocated and used. This minimizes the number of disk I/O operations since the information is cached in main storage. -
        • {@link #STORAGE_MINIMIZE STORAGE_MINIMIZE} - The main storage will be allocated to minimize the space used by the object. That is, as little main storage as possible will be allocated and used. This minimizes main storage usage while increasing the number of disk I/O operations since less information is cached in main storage. -
        • {@link #STORAGE_DYNAMIC STORAGE_DYNAMIC} - The system will dynamically determine the optimum main storage allocation for the object depending on other system activity and main storage contention. That is, when there is little main storage contention, as much storage as possible will be allocated and used to minimize the number of disk I/O operations. And when there is significant main storage contention, less main storage will be allocated and used to minimize the main storage contention. This option only has an effect when the storage pool's paging option is *CALC. When the storage pool's paging option is *FIXED, the behavior is the same as STORAGE_NORMAL. When the object is accessed through a file server, this option has no effect. Instead, its behavior is the same as STORAGE_NORMAL. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getMainStorageOption() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return mainStorageOption_; - } - /** - Sets which option should be used to determine how main storage is allocated and used by the system for the specified object. The option will take effect the next time the specified object is opened. This option can only be specified for byte stream files in the "root" (/), QOpenSys and user-defined file systems. - @param mainStorageOption The option which should be used to determine how main storage is allocated and used by the system for the specified object. Possible values are: -
          -
        • {@link #STORAGE_NORMAL STORAGE_NORMAL} - The main storage will be allocated normally. That is, as much main storage as possible will be allocated and used. This minimizes the number of disk I/O operations since the information is cached in main storage. This option is the default. -
        • {@link #STORAGE_MINIMIZE STORAGE_MINIMIZE} - The main storage will be allocated to minimize the space used by the object. That is, as little main storage as possible will be allocated and used. This minimizes main storage usage while increasing the number of disk I/O operations since less information is cached in main storage. -
        • {@link #STORAGE_DYNAMIC STORAGE_DYNAMIC} - The system will dynamically determine the optimum main storage allocation for the object depending on other system activity and main storage contention. That is, when there is little main storage contention, as much storage as possible will be allocated and used to minimize the number of disk I/O operations. And when there is significant main storage contention, less main storage will be allocated and used to minimize the main storage contention. This option only has an effect when the storage pool's paging option is *CALC. When the storage pool's paging option is *FIXED, the behavior is the same as *NORMAL. When the object is accessed through a file server, this option has no effect. Instead, its behavior is the same as *NORMAL. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setMainStorageOption(int mainStorageOption) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAttributes((byte)mainStorageOption, (byte)32); - } - - /** - Constant indicating that the directory has format type 1. - @see #getDirectoryFormat - **/ - public static final int DIRECTORY_FORMAT_TYPE1 = 0x00; - /** - Constant indicating that the directory has format type 2. - @see #getDirectoryFormat - **/ - public static final int DIRECTORY_FORMAT_TYPE2 = 0x01; - // The format of the directory. - int directoryFormat_; - /** - Returns the format of the specified directory object. - @return The format of the specified directory object. Possible values are: -
          -
        • {@link #DIRECTORY_FORMAT_TYPE1 DIRECTORY_FORMAT_TYPE1} - The directory of type *DIR has the original directory format. The Convert Directory (CVTDIR) command may be used to convert from the *TYPE1 format to the *TYPE2 format. -
        • {@link #DIRECTORY_FORMAT_TYPE2 DIRECTORY_FORMAT_TYPE2} - The directory of type *DIR is optimized for performance, size, and reliability compared to directories having the *TYPE1 format. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getDirectoryFormat() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return directoryFormat_; - } - - // The auditing value associated with the object. - String audit_; - /** - Returns the auditing value associated with the object. Note: The user must have all object (*ALLOBJ) or audit (*AUDIT) special authority to retrieve the auditing value. - @return The auditing value associated with the object. Possible values are: -
          -
        • "*NONE" - No auditing occurs for this object when it is read or changed regardless of the user who is accessing the object. -
        • "*USRPRF" - Audit this object only if the current user is being audited. The current user is tested to determine if auditing should be done for this object. The user profile can specify if only change access is audited or if both read and change accesses are audited for this object. The OBJAUD parameter of the Change User Auditing (CHGUSRAUD) command is used to change the auditing for a specific user. -
        • "*CHANGE" - Audit all change access to this object by all users on the system. -
        • "*ALL" - Audit all access to this object by all users on the system. All access is defined as a read or change operation. -
        • "*NOTAVL" - The user performing the operation is not allowed to retrieve the current auditing value. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getAudit() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return audit_; - } - - /** - Constant indicating that the object will not be scanned. - @see #getCreateObjectScan - @see #setCreateObjectScan - @see #getScan - @see #setScan - **/ - public static final int SCANNING_NO = 0x00; - /** - Constant indicating that the object will be scanned. - @see #getCreateObjectScan - @see #setCreateObjectScan - @see #getScan - @see #setScan - **/ - public static final int SCANNING_YES = 0x01; - /** - Constant indicating that the object will be scanned only if the object has been modified since the last time the object was scanned. - @see #getCreateObjectScan - @see #setCreateObjectScan - @see #getScan - @see #setScan - **/ - public static final int SCANNING_CHANGE_ONLY = 0x02; - // Whether the objects created in a directory will be scanned. - int createObjectScan_; - /** - Returns whether the objects created in a directory will be scanned when exit programs are registered with any of the integrated file system scan-related exit points. This attribute can only have been specified for directories in the "root" (/), QOpenSys and user-defined file systems. Even though this attribute can be set for *TYPE1 and *TYPE2 directories, only objects which are in file systems that have completely converted to the *TYPE2 directory format will actually be scanned, no matter what value is set for this attribute. - @return Whether the objects created in a directory will be scanned when exit programs are registered with any of the integrated file system scan-related exit points. Possible values are: -
          -
        • {@link #SCANNING_NO SCANNING_NO} - After an object is created in the directory, the object will not be scanned according to the rules described in the scan-related exit programs. Note: If the Scan file systems control (QSCANFSCTL) value *NOPOSTRST is not specified when an object with this attribute is restored, the object will be scanned at least once after the restore. -
        • {@link #SCANNING_YES SCANNING_YES} - After an object is created in the directory, the object will be scanned according to the rules described in the scan-related exit programs if the object has been modified or if the scanning software has been updated since the last time the object was scanned. -
        • {@link #SCANNING_CHANGE_ONLY SCANNING_CHANGE_ONLY} - After an object is created in the directory, the object will be scanned according to the rules described in the scan-related exit programs only if the object has been modified since the last time the object was scanned. It will not be scanned if the scanning software has been updated. This attribute only takes effect if the Scan file systems control (QSCANFSCTL) system value has *USEOCOATR specified. Otherwise, it will be treated as if the attribute is SCANNING_YES. Note: If the Scan file systems control (QSCANFSCTL) value *NOPOSTRST is not specified when an object with this attribute is restored, the object will be scanned at least once after the restore. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getCreateObjectScan() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return createObjectScan_; - } - /** - Sets whether the objects created in a directory will be scanned when exit programs are registered with any of the integrated file system scan-related exit points. This attribute can only be specified for directories in the "root" (/), QOpenSys and user-defined file systems. Even though this attribute can be set for *TYPE1 and *TYPE2 directories, only objects which are in *TYPE2 directories will actually be scanned, no matter what value is set for this attribute. - @param createObjectScan Whether the objects created in a directory will be scanned when exit programs are registered with any of the integrated file system scan-related exit points. Possible values are: -
          -
        • {@link #SCANNING_NO SCANNING_NO} - After an object is created in the directory, the object will not be scanned according to the rules described in the scan-related exit programs. Note: If the Scan file systems control (QSCANFSCTL) value *NOPOSTRST is not specified when an object with this attribute is restored, the object will be scanned at least once after the restore. -
        • {@link #SCANNING_YES SCANNING_YES} - After an object is created in the directory, the object will be scanned according to the rules described in the scan-related exit programs if the object has been modified or if the scanning software has been updated since the last time the object was scanned. This value is the default. -
        • {@link #SCANNING_CHANGE_ONLY SCANNING_CHANGE_ONLY} - After an object is created in the directory, the object will be scanned according to the rules described in the scan-related exit programs only if the object has been modified since the last time the object was scanned. It will not be scanned if the scanning software has been updated. This attribute only takes effect if the Scan file systems control (QSCANFSCTL) system value has *USEOCOATR specified. Otherwise, it will be treated as if the attribute is SCANNING_YES. Note: If the Scan file systems control (QSCANFSCTL) value *NOPOSTRST is not specified when an object with this attribute is restored, the object will be scanned at least once after the restore. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setCreateObjectScan(int createObjectScan) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAttributes((byte)createObjectScan, (byte)35); - } - - // Whether the object will be scanned. - int scan_; - /** - Returns whether the object will be scanned when exit programs are registered with any of the integrated file system scan-related exit points. This attribute can only have been specified for stream files in the "root" (/), QOpenSys and user-defined file systems. Even though this attribute can be set for objects in *TYPE1 and *TYPE2 directories, only objects which are in file systems that have completely converted to the *TYPE2 directory format will actually be scanned, no matter what value is set for this attribute. - @return Whether the object will be scanned when exit programs are registered with any of the integrated file system scan-related exit points. Possible values are: -
          -
        • {@link #SCANNING_NO SCANNING_NO} - The object will not be scanned according to the rules described in the scan-related exit programs. Note: If the Scan file systems control (QSCANFSCTL) value *NOPOSTRST is not specified when an object with this attribute is restored, the object will be scanned at least once after the restore. -
        • {@link #SCANNING_YES SCANNING_YES} - The object will be scanned according to the rules described in the scan-related exit programs if the object has been modified or if the scanning software has been updated since the last time the object was scanned. -
        • {@link #SCANNING_CHANGE_ONLY SCANNING_CHANGE_ONLY} - The object will be scanned according to the rules described in the scan-related exit programs only if the object has been modified since the last time the object was scanned. It will not be scanned if the scanning software has been updated. This attribute only takes effect if the Scan file systems control (QSCANFSCTL) system value has *USEOCOATR specified. Otherwise, it will be treated as if the attribute is SCANNING_YES. Note: If the Scan file systems control (QSCANFSCTL) value *NOPOSTRST is not specified when an object with this attribute is restored, the object will be scanned at least once after the restore. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getScan() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return scan_; - } - /** - Sets the whether the object will be scanned when exit programs are registered with any of the integrated file system scan-related exit points. This attribute can only be specified for stream files in the "root" (/), QOpenSys and user-defined file systems that are not virtual volumes or network server storage spaces. Even though this attribute can be set for objects in *TYPE1 and *TYPE2 directories, only objects which are in *TYPE2 directories will actually be scanned, no matter what value is set for this attribute. - @param scan Whether the object will be scanned when exit programs are registered with any of the integrated file system scan-related exit points. Possible values are: -
          -
        • {@link #SCANNING_NO SCANNING_NO} - The object will not be scanned according to the rules described in the scan-related exit programs. Note: If the Scan file systems control (QSCANFSCTL) value *NOPOSTRST is not specified when an object with this attribute is restored, the object will be scanned at least once after the restore. -
        • {@link #SCANNING_YES SCANNING_YES} - The object will be scanned according to the rules described in the scan-related exit programs if the object has been modified or if the scanning software has been updated since the last time the object was scanned. This value is the default. -
        • {@link #SCANNING_CHANGE_ONLY SCANNING_CHANGE_ONLY} - The object will be scanned according to the rules described in the scan-related exit programs only if the object has been modified since the last time the object was scanned. It will not be scanned if the scanning software has been updated. This attribute only takes effect if the Scan file systems control (QSCANFSCTL) system value has *USEOCOATR specified. Otherwise, it will be treated as if the attribute is SCANNING_YES. Note: If the Scan file systems control (QSCANFSCTL) value *NOPOSTRST is not specified when an object with this attribute is restored, the object will be scanned at least once after the restore. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setScan(int scan) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAttributes((byte)scan, (byte)36); - } - - /** - Constant indicating that a scan is required for the object either because it has not yet been scanned by the scan-related exit programs, or because the objects data or CCSID has been modified since it was last scanned. Examples of object data or CCSID modifications are: writing to the object, directly or through memory mapping; truncating the object; clearing the object; and changing the objects CCSID attribute etc.. - @see #getScanStatus - **/ - public static final int SCAN_REQUIRED = 0x00; - /** - Constant indicating that the object has been scanned by a scan-related exit program, and at the time of that last scan request, the object did not fail the scan. - @see #getScanStatus - **/ - public static final int SCAN_SUCCESS = 0x01; - /** - Constant indicating that the object has been scanned by a scan-related exit program, and at the time of that last scan request, the object failed the scan and the operation did not complete. Once an object has been marked as a failure, it will not be scanned again until the object's scan signature is different than the global scan key signature or independent ASP group scan key signature as appropriate. Therefore, subsequent requests to work with the object will fail with a scan failure indication if that access meets the criteria for when an object is to be scanned. Examples of requests which will fail are opening the object with more than write-only access, changing the CCSID of the object, copying the object etc.. See Integrated File System Scan on Open Exit Programs and Integrated File System Scan on Close Exit Programs for the criteria for when an object is to be scanned. Note: 1. If scanning has been turned off using the QSCANFS system value, or if no exit programs are registered for a specific exit point, then any requests which trigger that specific exit point will return a scan failure indication. 2. If the scan attribute is set to not scan the object, then requests to work with the object will not fail with a scan failure indication. - @see #getScanStatus - **/ - public static final int SCAN_FAILURE = 0x02; - /** - Constant indicating that the object is in a file system that has not completely converted to the *TYPE2 directory format, and therefore will not be scanned until the file system is completely converted. For information on the *TYPE2 directory format, see the Convert Directory (CVTDIR) command and the Integrated file system information in the Files and file systems topic. - @see #getScanStatus - **/ - public static final int SCAN_PENDING_CONVERSION = 0x05; - /** - Constant indicating that the object does not require any scanning because the object is marked to not be scanned. - @see #getScanStatus - **/ - public static final int SCAN_NOT_REQUIRED = 0x06; - // The scan status associated with this object. - int scanStatus_; - /** - Returns the scan status associated with this object. - @return The scan status associated with this object. Possible values are: -
          -
        • {@link #SCAN_REQUIRED SCAN_REQUIRED} - A scan is required for the object either because it has not yet been scanned by the scan-related exit programs, or because the objects data or CCSID has been modified since it was last scanned. Examples of object data or CCSID modifications are: writing to the object, directly or through memory mapping; truncating the object; clearing the object; and changing the objects CCSID attribute etc.. -
        • {@link #SCAN_SUCCESS SCAN_SUCCESS} - The object has been scanned by a scan-related exit program, and at the time of that last scan request, the object did not fail the scan. -
        • {@link #SCAN_FAILURE SCAN_FAILURE} - The object has been scanned by a scan-related exit program, and at the time of that last scan request, the object failed the scan and the operation did not complete. Once an object has been marked as a failure, it will not be scanned again until the object's scan signature is different than the global scan key signature or independent ASP group scan key signature as appropriate. Therefore, subsequent requests to work with the object will fail with a scan failure indication if that access meets the criteria for when an object is to be scanned. Examples of requests which will fail are opening the object with more than write-only access, changing the CCSID of the object, copying the object etc.. See Integrated File System Scan on Open Exit Programs and Integrated File System Scan on Close Exit Programs for the criteria for when an object is to be scanned. Note: 1. If scanning has been turned off using the QSCANFS system value, or if no exit programs are registered for a specific exit point, then any requests which trigger that specific exit point will return a scan failure indication. 2. If the scan attribute is set to not scan the object, then requests to work with the object will not fail with a scan failure indication. -
        • {@link #SCAN_PENDING_CONVERSION SCAN_PENDING_CONVERSION} - The object is in a file system that has not completely converted to the *TYPE2 directory format, and therefore will not be scanned until the file system is completely converted. For information on the *TYPE2 directory format, see the Convert Directory (CVTDIR) command and the Integrated file system information in the Files and file systems topic. -
        • {@link #SCAN_NOT_REQUIRED SCAN_NOT_REQUIRED} - The object does not require any scanning because the object is marked to not be scanned. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getScanStatus() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return scanStatus_; - } - // Whether the scan signatures are different. - boolean scanSignaturesDifferent_; - /** - Returns whether the scan signatures are different. The scan signatures give an indication of the level of the scanning software support. For more information, see Scan Key List and Scan Key Signatures in Integrated File System Scan on Open Exit Program. When an object is in an independent ASP group, the object scan signature is compared to the associated independent ASP group scan signature. When an object is not in an independent ASP group, the object scan signature is compared to the global scan signature value. - @return true if the compared signatures are different; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isScanSignaturesDifferent() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return scanSignaturesDifferent_; - } - // Whether the object has been scanned in binary mode. - boolean binaryScan_; - /** - Returns whether the object has been scanned in binary mode when it was previously scanned. - @return true if the object was scanned in binary mode; false otherwise. If the object scan status is SCAN_SUCCESS, then the object was successfully scanned in binary. If the object scan status is SCAN_FAILURE, then the object failed the scan in binary. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isBinaryScan() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return binaryScan_; - } - // The first CCSID value that the object has been scanned in. - int scanCcsid1_; - /** - Returns the CCSID value that the object has been scanned in if it was previously scanned in a CCSID. If the object scan status is SCAN_SUCCESS, then the object was successfully scanned in this CCSID. If the object scan status is SCAN_FAILURE, then the object failed the scan in this CCSID. A value of 0 means this field does not apply. - @return The CCSID value that the object has been scanned in if it was previously scanned in a CCSID. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getScanCcsid1() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return scanCcsid1_; - } - // The second CCSID value that the object has been scanned in. - int scanCcsid2_; - /** - Returns the CCSID value that the object has been scanned in if it was previously scanned in a CCSID. If the object scan status is SCAN_SUCCESS, then the object was successfully scanned in this CCSID. If the object scan status is SCAN_FAILURE, then this field will be 0. A value of 0 means this field does not apply. - @return The CCSID value that the object has been scanned in if it was previously scanned in a CCSID. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getScanCcsid2() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return scanCcsid2_; - } - - // Whether the object can be saved or not. - boolean allowSave_; - /** - Returns whether the object can be saved or not. - @return true if the object will be saved when using the Save Object (SAV) command or the QsrSave() API. false if the object will not be saved when using the Save Object (SAV) command or the QsrSave() API. Additionally, if this object is a directory, none of the objects in the directory's subtree will be saved unless they were explicitly specified as an object to be saved. The subtree includes all subdirectories and the objects within those subdirectories. Note: If this attribute is chosen for an object that has private authorities associated with it, or is chosen for the directory of an object that has private authorities associated with it, then the following consideration applies. When the private authorities are saved, the fact that this attribute is false is not taken into consideration. (Private authorities can be saved using either the Save System (SAVSYS) or Save Security Data (SAVSECDTA) command or the Save Object List (QSRSAVO) API.) Therefore, when a private authority is restored using the Restore Authority (RSTAUT) command, message CPD3776 will be seen for each object that was not saved either because it had this attribute specified as false, or because the object was not specified on the save and it was in a directory that had this attribute specified as false. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isAllowSave() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return allowSave_; - } - /** - Sets whether the object can be saved or not. Note: It is highly recommended that this attribute not be changed for any system created objects. - @param allowSave true if the object will be saved when using the Save Object (SAV) command or the QsrSave() API. This value is the default. false if the object will not be saved when using the Save Object (SAV) command or the QsrSave() API. Additionally, if this object is a directory, none of the objects in the directory's subtree will be saved unless they were explicitly specified as an object to be saved. The subtree includes all subdirectories and the objects within those subdirectories. Note: If this attribute is chosen for an object that has private authorities associated with it, or is chosen for the directory of an object that has private authorities associated with it, then the following consideration applies. When the private authorities are saved, the fact that this attribute is false is not taken into consideration. (Private authorities can be saved using either the Save System (SAVSYS) or Save Security Data (SAVSECDTA) command or the Save Object List (QSRSAVO) API.) Therefore, when a private authority is restored using the Restore Authority (RSTAUT) command, message CPD3776 will be seen for each object that was not saved either because it had this attribute specified as false, or because the object was not specified on the save and it was in a directory that had this attribute specified as false. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setAllowSave(boolean allowSave) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAttributes(allowSave, (byte)38); - } - - // Whether renames and unlinks are restricted. - boolean restrictedRenameAndUnlink_; - /** - Returns whether renames and unlinks are restricted for objects within a directory. Objects can be linked into a directory that has this attribute set on, but cannot be renamed or unlinked from it unless one or more of the following are true for the user performing the operation: -
          -
        • The user is the owner of the object. -
        • The user is the owner of the directory. -
        • The user has *ALLOBJ special authority. -
        - This restriction only applies to directories. Other types of object can have this attribute on, however, it will be ignored. This attribute is equivalent to the S_ISVTX mode bit for an object. - @return true if the additional restrictions for rename and unlink operations are on; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isRestrictedRenameAndUnlink() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return restrictedRenameAndUnlink_; - } - /** - Sets whether renames and unlinks are restricted for objects within a directory. Objects can be linked into a directory that has this attribute set on, but cannot be renamed or unlinked from it unless one or more of the following are true for the user performing the operation: -
          -
        • The user is the owner of the object. -
        • The user is the owner of the directory. -
        • The user has *ALLOBJ special authority. -
        - This restriction only applies to directories. Other types of object can have this attribute on, however, it will be ignored. In addition, this attribute can only be specified for objects within the Network File System (NFS), QFileSvr.400, "root" (/), QOpenSys, or user-defined file systems. Both the NFS and QFileSvr.400 file systems support this attribute by passing it to the system and surfacing it to the caller. This attribute is also equivalent to the S_ISVTX mode bit for an object. - @param restrictedRenameAndUnlink true if the additional restrictions for rename and unlink operations are on; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setRestrictedRenameAndUnlink(boolean restrictedRenameAndUnlink) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAttributes(restrictedRenameAndUnlink, (byte)39); - } - - // Whether the object is currently being journaled. - boolean journalingStatus_; - /** - Returns whether the object is currently being journaled. - @return true if the object is currently being journaled; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isJournalingStatus() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return journalingStatus_; - } - /** - Constant indicating that this object is a directory with IFS journaling subtree semantics. New objects created within this directory's subtree will inherit the journaling attributes and options from this directory. - @see #getJournalingOptions - **/ - public static final int JOURNAL_SUBTREE = 0x80; - /** - Constant indicating that when journaling is active, entries that are considered optional are journaled. The list of optional journal entries varies for each object type. See the Integrated file system information in the Files and file systems topic for information regarding these optional entries for various objects. - @see #getJournalingOptions - **/ - public static final int JOURNAL_OPTIONAL_ENTRIES = 0x08; - /** - Constant indicating that when journaling is active, the image of the object after a change is journaled. - @see #getJournalingOptions - **/ - public static final int JOURNAL_AFTER_IMAGES = 0x20; - /** - Constant indicating that when journaling is active, the image of the object prior to a change is journaled. - @see #getJournalingOptions - **/ - public static final int JOURNAL_BEFORE_IMAGES = 0x40; - // The current journaling options. - int journalingOptions_; - /** - Returns the current journaling options. - @return The current journaling options. This field is composed of several bit flags and contains one or more of the following bit values: -
          -
        • {@link #JOURNAL_SUBTREE JOURNAL_SUBTREE} - When this flag is returned, this object is a directory with IFS journaling subtree semantics. New objects created within this directory's subtree will inherit the journaling attributes and options from this directory. -
        • {@link #JOURNAL_OPTIONAL_ENTRIES JOURNAL_OPTIONAL_ENTRIES} - When journaling is active, entries that are considered optional are journaled. The list of optional journal entries varies for each object type. See the Integrated file system information in the Files and file systems topic for information regarding these optional entries for various objects. -
        • {@link #JOURNAL_AFTER_IMAGES JOURNAL_AFTER_IMAGES} - When journaling is active, the image of the object after a change is journaled. -
        • {@link #JOURNAL_BEFORE_IMAGES JOURNAL_BEFORE_IMAGES} - When journaling is active, the image of the object prior to a change is journaled. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getJournalingOptions() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return journalingOptions_; - } - // The journal identifier (JID). - byte[] journalIdentifier_; - /** - Returns the field that associates the object being journaled with an identifier that can be used on various journaling-related commands and APIs. - @return The field that associates the object being journaled with an identifier that can be used on various journaling-related commands and APIs. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public byte[] getJournalIdentifier() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return journalIdentifier_; - } - // The current or last journal. - String journal_; - /** - Returns the fully qualified integrated file system path name of the current or last journal. If the value of isJournalingStatus() is true, then this field contains the name of the journal currently being used. If the value of isJournalingStatus() is false, then this field contains the name of the journal last used for this object. If this object has never been journaled, null is returned. - @return The fully qualified integrated file system path name of the current or last journal. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getJournal() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return journal_; - } - - // The last date and time for which the object had journaling started for it. - Date lastJournalingStartTime_; - /** - Returns the last date and time for which the object had journaling started for it. If this object has never been journaled, null is returned. - @return The last date and time for which the object had journaling started for it. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @deprecated Use {@link #getJournalingStartTime getJournalingStartTime()} instead. - **/ - public Date getJounalingStartTime() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getJournalingStartTime(); - } - /** - Returns the last date and time for which the object had journaling started for it. If this object has never been journaled, null is returned. - @return The last date and time for which the object had journaling started for it. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Date getJournalingStartTime() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return lastJournalingStartTime_; - } - - - // The starting journal receiver for apply. - String startingJournalReceiverForApply_; - /** - Returns the fully qualified integrated file system path name of the starting journal receiver for apply. The oldest journal receiver needed to successfully Apply Journaled Changes (APYJRNCHG). When getApplyJournaledChangesRequired() is true the journal receiver contains the journal entries representing the start of the partial transaction. Otherwise; the journal receiver contains the journal entries representing the start-of-the-save operation. If no information is available, null is returned. - @return The fully qualified integrated file system path name of the starting journal receiver for apply. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getStartingJournalReceiverForApply() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return startingJournalReceiverForApply_; - } - // The name of the ASP for the library that contains the starting journal receiver. - String startingJournalReceiverAspDevice_; - /** - Returns the name of the ASP for the library that contains the starting journal receiver. The special value "*SYSBAS" means the journal receiver library resides in the system or user ASP's. - @return The name of the ASP for the library that contains the starting journal receiver. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getStartingJournalReceiverAspDevice() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return startingJournalReceiverAspDevice_; - } - // Whether the object was restored with partial transactions. - boolean applyJournaledChangesRequired_; - /** - Returns whether the object was restored with partial transactions which would require an Apply Journaled Changes (APYJRNCHG) command to complete the transaction. A partial transaction can occur if an object was saved using save-while-active requesting that transactions with pending record changes do not have to reach a commit boundary before the object is saved. - @return true if the object was restored with partial transactions. This object can not be used until the Apply Journaled Changes (APYJRNCHG) or Remove Journaled Changes (RMVJRNCHG) command is used to complete or rollback the partial transactions. false if the object does not have partial transactions. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isApplyJournaledChangesRequired() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return applyJournaledChangesRequired_; - } - // Whether the rollback was ended. - boolean rollbackWasEnded_; - /** - Returns whether the object had rollback ended prior to completion of a request to roll back a transaction. - @return true if the object had a rollback operation ended using the "End Rollback" option on the Work with Commitment Definition (WRKCMTDFN) screen. It is recommended that the object be restored as it can not be used. As a last resort, the Change Journaled Object (CHGJRNOBJ) command can be used to allow the object to be used. Doing this, however, may leave the object in an inconsistent state. false if the object did not have a rollback operation ended prior to completion of a request to roll back a transaction. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isRollbackWasEnded() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return rollbackWasEnded_; - } - - // The create object auditing value associated with the directory. - String createObjectAuditing_; - /** - Returns the create object auditing value associated with the directory. This is the auditing value given to any objects created in the directory. Note: The user must have all object (*ALLOBJ) or audit (*AUDIT) special authority to retrieve the create object auditing value. - @return The create object auditing value associated with the directory. Possible values are: -
          -
        • "*SYSVAL" - The object auditing value for the objects created in the directory is determined by the system auditing value (QCRTOBJAUD). -
        • "*NONE" - No auditing occurs for this object when it is read or changed regardless of the user who is accessing the object. -
        • "*USRPRF" - Audit this object only if the current user is being audited. The current user is tested to determine if auditing should be done for this object. The user profile can specify if only change access is audited or if both read and change accesses are audited for this object. The OBJAUD parameter of the Change User Auditing (CHGUSRAUD) command is used to change the auditing for a specific user. -
        • "*CHANGE" - Audit all change access to this object by all users on the system. -
        • "*ALL" - Audit all access to this object by all users on the system. All access is defined as a read or change operation. -
        • "*NOTAVL" - The user performing the operation is not allowed to retrieve the current create object auditing value. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getCreateObjectAuditing() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return createObjectAuditing_; - } - /** - Sets the create object auditing value associated with the directory. This is the auditing value given to any objects created in the directory. This attribute can only be specified for directories in the "root" (/), QOpenSys, QSYS.LIB, independent ASP QSYS.LIB, QFileSvr.400 and user-defined file systems. - @param createObjectAuditing The create object auditing value associated with the directory. Possible values are: -
          -
        • "*SYSVAL" - The object auditing value for the objects created in the directory is determined by the system auditing value (QCRTOBJAUD). -
        • "*NONE" - No auditing occurs for this object when it is read or changed regardless of the user who is accessing the object. -
        • "*USRPRF" - Audit this object only if the current user is being audited. The current user is tested to determine if auditing should be done for this object. The user profile can specify if only change access is audited or if both read and change accesses are audited for this object. The OBJAUD parameter of the Change User Auditing (CHGUSRAUD) command is used to change the auditing for a specific user. -
        • "*CHANGE" - Audit all change access to this object by all users on the system. -
        • "*ALL" - Audit all access to this object by all users on the system. All access is defined as a read or change operation. -
        - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setCreateObjectAuditing(String createObjectAuditing) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (createObjectAuditing == null) - { - Trace.log(Trace.ERROR, "Parameter 'createObjectAuditing' is null."); - throw new NullPointerException("createObjectAuditing"); - } - setAttributes(createObjectAuditing, (byte)41); - } - - /** - Constant indicating that the file is a generic stream file. - @see #getSystemUse - **/ - public static final int SYSTEM_USE_NONE = 0x00; - /** - Constant indicating that the file is a virtual volume. Examples include tape and optical virtual volumes. - @see #getSystemUse - **/ - public static final int SYSTEM_USE_VIRTUAL_VOLUME = 0x01; - /** - Constant indicating that the file is a network server storage space. - @see #getSystemUse - **/ - public static final int SYSTEM_USE_NETWORK_SERVER_STORAGE = 0x02; - // Whether the file has a special use by the system. - int systemUse_; - /** - Returns whether the file has a special use by the system. This attribute is valid only for stream files. -
          -
        • {@link #SYSTEM_USE_NONE SYSTEM_USE_NONE} - The file is a generic stream file. -
        • {@link #SYSTEM_USE_VIRTUAL_VOLUME SYSTEM_USE_VIRTUAL_VOLUME} - The file is a virtual volume. Examples include tape and optical virtual volumes. -
        • {@link #SYSTEM_USE_NETWORK_SERVER_STORAGE SYSTEM_USE_NETWORK_SERVER_STORAGE} - The file is a network server storage space. -
        - @return Whether the file has a special use by the system. Possible values are: - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getSystemUse() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return systemUse_; - } - - /** - Resets the count of the number of days an object has been used. Usage has different meanings according to the file system and according to the individual object types supported within a file system. Usage can indicate the opening or closing of a file or can refer to adding links, renaming, restoring, or checking out an object. When this attribute is set, the date use count reset for the object is set to the current date. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void resetDate() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - byte[] attribute = new byte[18]; - attribute[7] = (byte)200; - attribute[11] = 2; - setAttributes(attribute); - } - - // Whether the effective user ID (UID) is set at execution time. - boolean setEffectiveUserId_; - /** - Returns whether the effective user ID (UID) is set at execution time. This value is ignored if the specified object is a directory. - @return true if the object owner is the effective user ID (UID) at execution time; false if the user ID (UID) is not set at execution time. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isSetEffectiveUserId() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return setEffectiveUserId_; - } - /** - Sets whether the effective user ID (UID) is set at execution time. This value is ignored if the specified object is a directory. - @param setEffectiveUserId true if the object owner is the effective user ID (UID) at execution time; false if the user ID (UID) is not set at execution time. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setSetEffectiveUserId(boolean setEffectiveUserId) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAttributes(setEffectiveUserId, (byte)0x01, (byte)0x2C); - } - - // Whether the effective group ID (GID) is set at execution time. - boolean setEffectiveGroupId_; - /** - Returns whether the effective group ID (GID) is set at execution time. - @return true if the object is a file, the group ID (GID) is set at execution time. If the object is a directory, the group ID (GID) of objects created in the directory is set to the GID of the parent directory. false if the object is a file, the group ID (GID) is not set at execution time. If the object is a directory in the "root" (/), QOpenSys, and user-defined file systems, the group ID (GID) of objects created in the directory is set to the effective GID of the thread creating the object. This value cannot be set for other file systems. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isSetEffectiveGroupId() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return setEffectiveGroupId_; - } - /** - Sets whether the effective group ID (GID) is set at execution time. - @param setEffectiveGroupId true if the object is a file, the group ID (GID) is set at execution time. If the object is a directory, the group ID (GID) of objects created in the directory is set to the GID of the parent directory. false if the object is a file, the group ID (GID) is not set at execution time. If the object is a directory in the "root" (/), QOpenSys, and user-defined file systems, the group ID (GID) of objects created in the directory is set to the effective GID of the thread creating the object. This value cannot be set for other file systems. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setSetEffectiveGroupId(boolean setEffectiveGroupId) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAttributes(setEffectiveGroupId, (byte)0x01, (byte)0x2D); - } - - // Whether the objects in the UDFS are temporary system objects. - boolean containsTemporaryObjects_; - /** - Returns whether the objects in the user-defined file system (UDFS) are temporary system objects. -

        Note: This method is not supported until the release following IBM i V6R1. For IBM i V6R1 and earlier, this method always returns false. - @return true if the objects in the UDFS are temporary system objects; false if the objects in the UDFS are permanent system objects. - If the file system represented by this object is not a UDFS, this method returns false. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean containsTemporaryObjects() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return containsTemporaryObjects_; - } - - // Whether the object is a temporary system object. - boolean temporaryObject_; - /** - Returns whether the object is a temporary system object. -

        Note: This method is not supported until the release following IBM i V6R1. For IBM i V6R1 and earlier, this method always returns false. - @return true if the object is a temporary system object; false if the object is a permanent system object. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isTemporaryObject() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - getAttributes(); - return temporaryObject_; - } - - /** - Refreshes the attributes from the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void refresh() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - attributesRetrieved_ = false; - getAttributes(); - } - - private void getAttributes() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (attributesRetrieved_) return; - - int vrm = system_.getVRM(); - - int bufferSizeProvided = 2048; - ProgramParameter[] parameters = new ProgramParameter[] - { - // Qlg_Path_Name_T *Path_Name - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, createPathName()), - // Qp0l_AttrTypes_List_t *Attr_Array_ptr - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, new byte[4]), - // char *Buffer_ptr - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, bufferSizeProvided), - // uint Buffer_Size_Provided - new ProgramParameter(ProgramParameter.PASS_BY_VALUE, BinaryConverter.intToByteArray(bufferSizeProvided)), - // uint *Buffer_Size_Needed_ptr - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, 4), - // uint *Num_Bytes_Returned_ptr - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, 4), - // uint Follow_Symlnk - new ProgramParameter(ProgramParameter.PASS_BY_VALUE, BinaryConverter.intToByteArray(followSymbolicLink_ ? 1 : 0)) - }; - - ServiceProgramCall spc = new ServiceProgramCall(system_, "/QSYS.LIB/QP0LLIB2.SRVPGM", "Qp0lGetAttr", ServiceProgramCall.RETURN_INTEGER, parameters); - boolean repeatRun; - do - { - repeatRun = false; - if (!spc.run()) - { - throw new AS400Exception(spc.getMessageList()); - } - if (spc.getIntegerReturnValue() == -1) - { - int errno = spc.getErrno(); - Trace.log(Trace.ERROR, "Get attributes was not successful, errno:", errno); - throw new ErrnoException(system_, errno); - } - int bufferSizeNeeded = BinaryConverter.byteArrayToInt(parameters[2].getOutputData(), 0); - if (bufferSizeProvided < bufferSizeNeeded) - { - repeatRun = true; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Get attributes buffer too small, buffer size provided: " + bufferSizeProvided + ", buffer size needed: " + bufferSizeNeeded); - bufferSizeProvided = bufferSizeNeeded; - parameters[2] = new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, bufferSizeProvided); - parameters[3] = new ProgramParameter(ProgramParameter.PASS_BY_VALUE, BinaryConverter.intToByteArray(bufferSizeProvided)); - } - } - while (repeatRun); - attributesRetrieved_ = true; - - Converter conv = new Converter(system_.getJobCcsid(), system_); - - byte[] buffer = parameters[2].getOutputData(); - int offset = 0; - int nextOffset = -1; - while (nextOffset != 0) - { - nextOffset = BinaryConverter.byteArrayToInt(buffer, offset); - int entrySize = BinaryConverter.byteArrayToInt(buffer, offset + 8); - if (entrySize != 0) - { - switch (BinaryConverter.byteArrayToInt(buffer, offset + 4)) - { - case 0: - objectType_ = conv.byteArrayToString(buffer, offset + 16, 10).trim(); - break; - case 1: - break; - case 2: - break; - case 3: - extendedAttributeSize_ = BinaryConverter.byteArrayToUnsignedInt(buffer, offset + 16); - break; - case 4: - createTime_ = new Date(BinaryConverter.byteArrayToUnsignedInt(buffer, offset + 16) * 1000); - break; - case 5: - accessTime_ = new Date(BinaryConverter.byteArrayToUnsignedInt(buffer, offset + 16) * 1000); - break; - case 6: - changeTime_ = new Date(BinaryConverter.byteArrayToUnsignedInt(buffer, offset + 16) * 1000); - break; - case 7: - modifyTime_ = new Date(BinaryConverter.byteArrayToUnsignedInt(buffer, offset + 16) * 1000); - break; - case 8: - storageFree_ = buffer[offset + 16] == 0x01; - break; - case 9: - checkedOut_ = buffer[offset + 16] == 0x01; - checkedOutUser_ = conv.byteArrayToString(buffer, offset + 17, 10).trim(); - checkOutTime_ = new Date(BinaryConverter.byteArrayToUnsignedInt(buffer, offset + 28) * 1000); - break; - case 10: - localRemote_ = buffer[offset + 16]; - break; - case 11: - objectOwner_ = conv.byteArrayToString(buffer, offset + 16, 10).trim(); - primaryGroup_ = conv.byteArrayToString(buffer, offset + 26, 10).trim(); - authorizationListName_ = conv.byteArrayToString(buffer, offset + 36, 10).trim(); - break; - case 12: - fileId_ = new byte[16]; - System.arraycopy(buffer, offset + 16, fileId_, 0, 16); - break; - case 13: - asp_ = BinaryConverter.byteArrayToShort(buffer, offset + 16); - break; - case 14: - dataSize_ = BinaryConverter.byteArrayToLong(buffer, offset + 16); - break; - case 15: - allocatedSize_ = BinaryConverter.byteArrayToLong(buffer, offset + 16); - break; - case 16: - resetDate_ = new Date(BinaryConverter.byteArrayToUnsignedInt(buffer, offset + 16) * 1000); - long seconds = BinaryConverter.byteArrayToUnsignedInt(buffer, offset + 20); - lastUsedDate_ = seconds == 0 ? null : new Date(seconds * 1000); - //daysUsedCount_ = BinaryConverter.byteArrayToInt(buffer, offset + 24); - daysUsedCount_ = BinaryConverter.byteArrayToUnsignedShort(buffer, offset + 24); - break; - case 17: - pcReadOnly_ = buffer[offset + 16] == 0x01; - break; - case 18: - pcHidden_ = buffer[offset + 16] == 0x01; - break; - case 19: - pcSystem_ = buffer[offset + 16] == 0x01; - break; - case 20: - pcArchive_ = buffer[offset + 16] == 0x01; - break; - case 21: - systemArchive_ = buffer[offset + 16] == 0x01; - break; - case 22: - codePage_ = BinaryConverter.byteArrayToInt(buffer, offset + 16); - break; - case 23: - fileFormat_ = buffer[offset + 16]; - break; - case 24: - udfsDefaultFormat_ = buffer[offset + 16]; - break; - case 25: - if (vrm < 0x00050300) - { - journalingStatus_ = buffer[offset + 16] == 0x01; - journalingOptions_ = buffer[offset + 17] & 0xFF; - journalIdentifier_ = new byte[10]; - System.arraycopy(buffer, 18, journalIdentifier_, 0, 10); - if (buffer[offset + 28] == 0x00) - { - journal_ = null; - } - else - { - String journalName = conv.byteArrayToString(buffer, offset + 28, 10).trim(); - String journalLibrary = conv.byteArrayToString(buffer, offset + 38, 10).trim(); - journal_ = QSYSObjectPathName.toPath(journalLibrary, journalName, "JRN"); - } - seconds = BinaryConverter.byteArrayToUnsignedInt(buffer, offset + 48); - lastJournalingStartTime_ = seconds == 0 ? null : new Date(seconds * 1000); - } - break; - case 26: - allowCheckpointWrite_ = buffer[offset + 16] == 0x01; - break; - case 27: - ccsid_ = BinaryConverter.byteArrayToInt(buffer, offset + 16); - break; - case 28: - signed_ = buffer[offset + 16] == 0x01; - break; - case 29: - systemSigned_ = buffer[offset + 16] == 0x01; - break; - case 30: - multipleSignatures_ = buffer[offset + 16] == 0x01; - break; - case 31: - diskStorageOption_ = buffer[offset + 16]; - break; - case 32: - mainStorageOption_ = buffer[offset + 16]; - break; - case 33: - directoryFormat_ = buffer[offset + 16]; - break; - case 34: - audit_ = conv.byteArrayToString(buffer, offset + 16, 10).trim(); - break; - case 35: - createObjectScan_ = buffer[offset + 16]; - break; - case 36: - scan_ = buffer[offset + 16]; - break; - case 37: - scanStatus_ = buffer[offset + 16]; - scanSignaturesDifferent_ = buffer[offset + 17] == 0x01; - binaryScan_ = buffer[offset + 18] == 0x01; - scanCcsid1_ = BinaryConverter.byteArrayToInt(buffer, offset + 20); - scanCcsid2_ = BinaryConverter.byteArrayToInt(buffer, offset + 24); - break; - case 38: - allowSave_ = buffer[offset + 16] == 0x01; - break; - case 39: - restrictedRenameAndUnlink_ = buffer[offset + 16] == 0x01; - break; - case 40: - journalingStatus_ = buffer[offset + 16] == 0x01; - journalingOptions_ = buffer[offset + 17] & 0xFF; - journalIdentifier_ = new byte[10]; - System.arraycopy(buffer, 18, journalIdentifier_, 0, 10); - if (buffer[offset + 28] == 0x00) - { - journal_ = null; - } - else - { - String journalName = conv.byteArrayToString(buffer, offset + 28, 10).trim(); - String journalLibrary = conv.byteArrayToString(buffer, offset + 38, 10).trim(); - journal_ = QSYSObjectPathName.toPath(journalLibrary, journalName, "JRN"); - } - seconds = BinaryConverter.byteArrayToUnsignedInt(buffer, offset + 48); - lastJournalingStartTime_ = seconds == 0 ? null : new Date(seconds * 1000); - String journalReceiverName = conv.byteArrayToString(buffer, offset + 52, 10).trim(); - String journalReceiverLibrary = conv.byteArrayToString(buffer, offset + 62, 10).trim(); - startingJournalReceiverForApply_ = journalReceiverName.equals("") ? null : QSYSObjectPathName.toPath(journalReceiverLibrary, journalReceiverName, "JRNRCV"); - startingJournalReceiverAspDevice_ = conv.byteArrayToString(buffer, offset + 72, 10).trim(); - applyJournaledChangesRequired_ = buffer[offset + 82] == 0x01; - rollbackWasEnded_ = buffer[offset + 83] == 0x01; - break; - case 41: - createObjectAuditing_ = conv.byteArrayToString(buffer, offset + 16, 10).trim(); - break; - case 42: - systemUse_ = buffer[offset + 16]; - break; - case 43: - temporaryObject_ = buffer[offset + 16] == 0x01; - break; - case 44: - containsTemporaryObjects_ = buffer[offset + 16] == 0x01; - break; - case 45: - udfsStorageUnit_ = buffer[offset + 16]; - break; - case 300: - setEffectiveUserId_ = buffer[offset + 16] == 0x01; - break; - case 301: - setEffectiveGroupId_ = buffer[offset + 16] == 0x01; - break; - default: - // Ignore unrecognized entries. - } - } - offset = nextOffset; - } - } - - private void setAttributes(String value, byte attributeId) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - byte[] attribute = new byte[26]; - attribute[7] = attributeId; - attribute[11] = 10; - for (int i = 16; i < 26; ++i) attribute[i] = 0x40; - Converter conv = new Converter(system_.getJobCcsid(), system_); - conv.stringToByteArray(value, attribute, 16, 10); - setAttributes(attribute); - } - private void setAttributes(byte value, byte attributeId) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - byte[] attribute = new byte[17]; - attribute[7] = attributeId; - attribute[11] = 1; - attribute[16] = value; - setAttributes(attribute); - } - private void setAttributes(int value, byte attributeId) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - byte[] attribute = new byte[20]; - attribute[7] = attributeId; - attribute[11] = 4; - BinaryConverter.intToByteArray(value, attribute, 16); - setAttributes(attribute); - } - private void setAttributes(boolean value, byte attributeId) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAttributes(value, (byte)0x00, attributeId); - } - private void setAttributes(boolean value, byte attributeId1, byte attributeId2) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - byte[] attribute = new byte[17]; - attribute[6] = attributeId1; - attribute[7] = attributeId2; - attribute[11] = 1; - if (value) attribute[16] = 0x01; - setAttributes(attribute); - } - private void setAttributes(Date value, byte attributeId) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - byte[] attribute = new byte[20]; - attribute[7] = attributeId; - attribute[11] = 4; - BinaryConverter.unsignedIntToByteArray(value.getTime() / 1000, attribute, 16); - setAttributes(attribute); - } - private void setAttributes(byte[] attribute) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - attributesRetrieved_ = false; - - ProgramParameter[] parameters = new ProgramParameter[] - { - // Qlg_Path_Name_T *Path_Name. - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, createPathName()), - // char *Buffer_ptr. - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, attribute), - // uint Buffer_Size. - new ProgramParameter(ProgramParameter.PASS_BY_VALUE, BinaryConverter.intToByteArray(attribute.length)), - // uint Follow_Symlnk. - new ProgramParameter(ProgramParameter.PASS_BY_VALUE, BinaryConverter.intToByteArray(followSymbolicLink_ ? 1 : 0)) - }; - - ServiceProgramCall spc = new ServiceProgramCall(system_, "/QSYS.LIB/QP0LLIB3.SRVPGM", "Qp0lSetAttr", ServiceProgramCall.RETURN_INTEGER, parameters); - if (!spc.run()) - { - throw new AS400Exception(spc.getMessageList()); - } - if (spc.getIntegerReturnValue() == -1) - { - int errno = spc.getErrno(); - Trace.log(Trace.ERROR, "Set attributes was not successful, errno:", errno); - throw new ErrnoException(system_, errno); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/FileEvent.java b/cvsroot/src/com/ibm/as400/access/FileEvent.java deleted file mode 100644 index 14f4301f1..000000000 --- a/cvsroot/src/com/ibm/as400/access/FileEvent.java +++ /dev/null @@ -1,90 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: FileEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - The FileEvent class represents a File event. -**/ - -public class FileEvent extends java.util.EventObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - - /** - The file closed event ID. This event is delivered when a file is closed. - **/ - public static final int FILE_CLOSED = 0; - - /** - The file deleted event ID. This event is delivered when a file is deleted. - **/ - public static final int FILE_DELETED = 1; - - /** - The file modified event ID. This event is delivered when a file is modified. - **/ - public static final int FILE_MODIFIED = 2; - - /** - The file opened event ID. This event is delivered when a file is opened. - **/ - public static final int FILE_OPENED = 3; - - /** - The file created event ID. This event is delivered when a file is created. - **/ - public static final int FILE_CREATED = 4; - - - private int id_; // event identifier - - - /** - Constructs a FileEvent object. It uses the specified source and ID. - @param source The object where the event originated. - @param id The event identifier. - **/ - public FileEvent(Object source, - int id) - { - super(source); - - if (id < FILE_CLOSED || id > FILE_CREATED) - { - throw new ExtendedIllegalArgumentException("id", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - id_ = id; - } - - - /** - Returns the identifier for this event. - @return The identifier for this event. - **/ - public int getID() - { - return id_; - } -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/FileListener.java b/cvsroot/src/com/ibm/as400/access/FileListener.java deleted file mode 100644 index a6bef2352..000000000 --- a/cvsroot/src/com/ibm/as400/access/FileListener.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: FileListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; -/** - The FileListener interface provides an interface for receiving - File events. -**/ - -public interface FileListener extends java.util.EventListener -{ - /** - Invoked when a file has been closed. - @param event The file event. - **/ - public void fileClosed(FileEvent event); - - /** - Invoked when a file has been created. - @param event The file event. - **/ - public void fileCreated(FileEvent event); - - /** - Invoked when a file is deleted. - @param event The file event. - **/ - public void fileDeleted(FileEvent event); - - /** - Invoked when a file has been modified. - @param event The file event. - **/ - public void fileModified(FileEvent event); - - /** - Invoked when a file has been opened. - @param event The file event. - **/ - public void fileOpened(FileEvent event); -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/FloatFieldDescription.java b/cvsroot/src/com/ibm/as400/access/FloatFieldDescription.java deleted file mode 100644 index 2098591b7..000000000 --- a/cvsroot/src/com/ibm/as400/access/FloatFieldDescription.java +++ /dev/null @@ -1,429 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FloatFieldDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.util.Vector; - -/** - *Represents the description of the data in a float field. - *It allows: - *

          - *
        • The user to describe a float field to the RecordFormat object. - *
        • The RecordFormat object to describe a float field to the user. - *
        - *Click hereto see an example. -**/ -public class FloatFieldDescription extends FieldDescription implements Serializable -{ - static final long serialVersionUID = 4L; - // Number of decimal positions for this field - private int decimalPositions_; - // Value specified for the FLTPCN keyword - private String floatPrecision_ = ""; - - /** - *Constructs a FloatFieldDescription object. - **/ - public FloatFieldDescription() - { - } - - /** - *Constructs a FloatFieldDescription object. It uses the specified - *data type and name of the field. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public FloatFieldDescription(AS400Float8 dataType, String name) - { - // We pass 9 for the length in case this field will be used for DDS. We pass 9 - // because if the length is greater than 9, then keyword FLTPCN must be specified - // with a value of *DOUBLE. The user should have called the appropriate constructor - // if that is what they wished. - super(dataType, name); - length_ = 9; - } - - /** - *Constructs a FloatFieldDescription object. It uses the specified - *data type, name, DDS name, and length of the field. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - *@param length The number of digits that the field will hold. This is the length of - * the field as it would appear in a DDS description. The length - * must be greater than zero. - **/ - public FloatFieldDescription(AS400Float8 dataType, String name, String ddsName, int length) - { - super(dataType, name, ddsName); - if (length < 1) - { - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - length_ = length; - } - - /** - *Constructs a FloatFieldDescription object. It uses the specified data type, - *name, DDS name, length and decimal positions of the field. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - *@param length The number of digits that the field will hold. This is the length of - * the field as it would appear in a DDS description. The length - * must be greater than zero. - *@param decimalPositions The number of digits to the right of the decimal point. - * The decimalPositions cannot be negative. - **/ - public FloatFieldDescription(AS400Float8 dataType, String name, String ddsName, int length, - int decimalPositions) - { - super(dataType, name, ddsName); - if (length < 1) - { - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (decimalPositions < 0) - { - throw new ExtendedIllegalArgumentException("decimalPositions", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - length_ = length; - decimalPositions_ = decimalPositions; - } - - /** - *Constructs a FloatFieldDescription object. It uses the specified - *data type and name of the field. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public FloatFieldDescription(AS400Float4 dataType, String name) - { - // We pass 9 for the length in case this field will be used for DDS. We pass 9 - // because if the length is greater than 9, then keyword FLTPCN must be specified - // with a value of *DOUBLE. The user should have called the appropriate constructor - // if that is what they wished. - super(dataType, name); - length_ = 9; - } - - /** - *Constructs a FloatFieldDescription object. It uses the specified data type, name, - *DDS name, and length of the field. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - *@param length The number of digits that the field will hold. This is the length of - * the field as it would appear in a DDS description. The length - * must be greater than zero. - **/ - public FloatFieldDescription(AS400Float4 dataType, String name, String ddsName, int length) - { - super(dataType, name, ddsName); - if (length < 1) - { - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - length_ = length; - } - - /** - *Constructs a FloatFieldDescription object. It uses the specified data type, name, - *DDS name, length and decimal positions of the field. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - *@param length The number of digits that the field will hold. This is the length of - * the field as it would appear in a DDS description. The length must be - * greater than zero. - *@param decimalPositions The number of digits to the right of the decimal point. The - *decimalPositions cannot be negative. - **/ - public FloatFieldDescription(AS400Float4 dataType, String name, String ddsName, int length, - int decimalPositions) - { - super(dataType, name, ddsName); - if (length < 1) - { - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (decimalPositions < 0) - { - throw new ExtendedIllegalArgumentException("decimalPositions", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - length_ = length; - decimalPositions_ = decimalPositions; - } - - - /** - *Returns the DDS description for the field. This is a string containing - *the description of the field as it would be specified in a DDS source file. - *This method is used by AS400File.createDDSSourceFile to specify the field - *in the DDS source file which is used to create the file for the user who - *has passed in a RecordFormat object. - *@return The DDS description of this field properly formatted for entry - *into a DDS source file. - **/ - String[] getDDSDescription() - { - Vector v = new Vector(); - // Name columns (10) - StringBuffer desc = new StringBuffer(ddsName_); - // Blank pad the ddsName to 10 characters. - while(desc.length() < 10) - { - desc.append(" "); - } - // Reference column (1) - if (!refFld_.equals("")) - { - desc.append("R"); - } - else - { - desc.append(" "); - } - // Get length as 5 digit string, right justified -/* StringBuffer len = new StringBuffer(new Integer(length_).toString()); - if (len.length() < 5) - { - int blanksNeeded = 5 - len.length(); - for (short i = 0; i < blanksNeeded; ++i) - { - len.insert(0, " "); - } - } -*/ - String len = String.valueOf(length_); - int numSpaces = 5-len.length(); - for (int i=0; idataType - *cannot be null. - **/ - public void setDataType(AS400Float4 dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length of the field based on the data type - length_ = 9; // 9 is the maximum number of digits for a single precision number in DDS - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400Float8 dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length of the field based on the data type - length_ = 17; // 17 is the maximum number of digits for a double precision number in DDS - } - - /** - *Sets the number of digits after the decimal point for this field. - *@param decimalPositions The number of digits after the decimal point. - *The decimalPositions cannot be less than zero. - **/ - public void setDecimalPositions(int decimalPositions) - { - if (decimalPositions < 0) - { - throw new ExtendedIllegalArgumentException("decimalPositions (" + String.valueOf(decimalPositions) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - decimalPositions_ = decimalPositions; - } - - /** - *Sets the value for the FLTPCN keyword for this field. - *@param floatPrecision The value to set for the FLTPCN keyword for - * this field. Possible values are *SINGLE or *DOUBLE. - *The floatPrecision cannot be null. - **/ - public void setFLTPCN(String floatPrecision) - { - if (floatPrecision == null) - { - throw new NullPointerException("floatPrecision"); - } - if (!(floatPrecision.equalsIgnoreCase("*SINGLE") || floatPrecision.equalsIgnoreCase("*DOUBLE"))) - { - throw new ExtendedIllegalArgumentException("floatPrecision (" + floatPrecision + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - floatPrecision_ = floatPrecision; - } - - //@B0C - javadoc - /** - *Sets the value for the DFT keyword for this field. Use this version - *of setDFT() when an AS400Float8 was used to construct the object. - *@param defaultValue The default value for this - * field. The defaultValue cannot be null. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(Double defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; //@B0A - isDFTCurrent_ = false; //@B0A - DFTCurrentValue_ = null; //@B0A - } - - //@B0C - javadoc - /** - *Sets the value for the DFT keyword for this field. Use this version - *of setDFT() when an AS400Float4 was used to construct the object. - *@param defaultValue The default value for this - * field. The defaultValue cannot be null. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(Float defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; //@B0A - isDFTCurrent_ = false; //@B0A - DFTCurrentValue_ = null; //@B0A - } - - //@B0A - /** - *Sets the value for the DFT keyword to be *NULL for this field. - *Calling this method will replace the DFT keyword that was previously - *set on a call to setDFT(). Note: This field - *must also have its ALWNULL keyword set to true to prevent DDS errors. - **/ - public void setDFTNull() - { - isDFTNull_ = true; - defaultValue_ = null; - isDFTCurrent_ = false; - DFTCurrentValue_ = null; - } - - /** - *Sets the length of this field. - *@param length The length of this field. The length must be greater than - *zero. - **/ - public void setLength(int length) - { - if (length < 1) - { - throw new ExtendedIllegalArgumentException("length (" + String.valueOf(length) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - length_ = length; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/GSSTokenVault.java b/cvsroot/src/com/ibm/as400/access/GSSTokenVault.java deleted file mode 100644 index 11fa8a3b9..000000000 --- a/cvsroot/src/com/ibm/as400/access/GSSTokenVault.java +++ /dev/null @@ -1,97 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: GSSTokenVault.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2009-2009 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * A vault which holds a GSS Token. The token can be used for authenticating - * to one or more IBM i host servers. - */ -class GSSTokenVault extends CredentialVault implements Cloneable -{ - /** - * Constructs a GSSTokenVault object that does not contain a credential - */ - protected GSSTokenVault() { - super(); - } - - /** - * Constructs a GSSTokenVault object that contains the provided GSS Token credential. - * - * @param tokenBytes The GSS Token bytes - */ - protected GSSTokenVault(byte[] tokenBytes) { - super(); - encodedCredential_ = tokenBytes; - } - - /** - * Returns a copy of this GSSTokenVault. The new copy will be - * an exact copy of this vault, which means the new copy will - * contain the same identity token credential as this vault. - * - * @return A newly created IdentityTokenVault that is a copy of this one - */ - public Object clone() { - GSSTokenVault vaultClone = (GSSTokenVault)super.clone(); - return vaultClone; - } - - /** - * {@inheritDoc} - */ - protected int getType() { - return AS400.AUTHENTICATION_SCHEME_GSS_TOKEN; - } - - /** - * {@inheritDoc} - */ - protected synchronized byte[] getClearCredential() { - // GSS token bytes are never encoded or clear, so just return the token. - return encodedCredential_; - } - - /** - * {@inheritDoc} - */ - protected synchronized void storeEncodedUsingExternalSeeds(byte[] firstSeed, byte[] secondSeed) { - // GSS token bytes are never encoded, so nothing to do. - } - - /** - * {@inheritDoc} - */ - protected synchronized void storeEncodedUsingInternalSeeds(byte[] firstSeed, byte[] secondSeed) { - // GSS token bytes are never encoded, so nothing to do. - } - - /** - * {@inheritDoc} - */ - protected byte[] store(byte[] credential) { - // GSS token bytes are never encoded, so just store them directly. - encodedCredential_ = credential; - return credential; - } - - /** - * {@inheritDoc} - */ - protected synchronized byte[] resolve(byte[] info) { - // GSS token bytes are never encoded or clear, so just return the token. - return info; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/HexFieldDescription.java b/cvsroot/src/com/ibm/as400/access/HexFieldDescription.java deleted file mode 100644 index ffbe9078a..000000000 --- a/cvsroot/src/com/ibm/as400/access/HexFieldDescription.java +++ /dev/null @@ -1,264 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: HexFieldDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.util.Vector; - -/** - *The HexFieldDescription class represents the description of the data in a hexadecimal field. - *It allows: - *
          - *
        • The user to describe a hexadecimal field to the RecordFormat object. - *
        • The RecordFormat object to describe a hexadecimal field to the user. - *
        - *Click hereto see an example. -**/ -public class HexFieldDescription extends FieldDescription implements VariableLengthFieldDescription, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - - // Value specified for the VARLEN keyword - private int variableLength_; - // Is the field a variable length field - private boolean isVariableLength_; - - /** - *Constructs a HexFieldDescription object. - **/ - public HexFieldDescription() - { - } - - /** - *Constructs a HexFieldDescription object. It uses the specified data type - *and name of the field. - *The length of the field will be the length specified on the AS400ByteArray object. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public HexFieldDescription(AS400ByteArray dataType, String name) - { - super(dataType, name); - } - - /** - *Constructs a HexFieldDescription object. It uses the specified data type, - *name, and DDS name of the field. - *The length of the field will be the length specified on the AS400ByteArray object. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - **/ - public HexFieldDescription(AS400ByteArray dataType, String name, String ddsName) - { - super(dataType, name, ddsName); - } - - - - /** - *Returns the DDS description for the field. This is a string containing - *the description of the field as it would be specified in a DDS source file. - *This method is used by AS400File.createDDSSourceFile to specify the field - *in the DDS source file which is used to create the file for the user who - *has passed in a RecordFormat object. - *@return The DDS description of this field properly formatted for entry - *into a DDS source file. - **/ - String[] getDDSDescription() - { - Vector v = new Vector(); - // Name columns (10) - StringBuffer desc = new StringBuffer(ddsName_); - // Blank pad the ddsName to 10 characters. - while(desc.length() < 10) - { - desc.append(" "); - } - // Reference column (1) - if (!refFld_.equals("")) - { - desc.append("R"); - } - else - { - desc.append(" "); - } - // Get length as 5 digit string, right justified -/* StringBuffer len = new StringBuffer(new Integer(length_).toString()); - if (len.length() < 5) - { - int blanksNeeded = 5 - len.length(); - for (short i = 0; i < blanksNeeded; ++i) - { - len.insert(0, " "); - } - } -*/ - String len = String.valueOf(length_); - int numSpaces = 5-len.length(); - for (int i=0; i 0) - { - v.addElement("VARLEN(" + new Integer(variableLength_).toString() + ") "); - } - else - { - v.addElement("VARLEN "); - } - } - //@B0A - if (defaultValue_ != null) - { - v.addElement("DFT('" + new String((byte[])defaultValue_) + "') "); - } - else if (isDFTNull_) - { - v.addElement("DFT(*NULL) "); - } - - String[] s = new String[v.size()]; - v.copyInto(s); - return s; - } - - /** - *Returns the value specified for the VARLEN keyword for this field. - *@return The value specified for VARLEN for this field. If VARLEN was not - * specified for this field, 0 is returned. - **/ - public int getVARLEN() - { - return variableLength_; - } - - /** - *Indicates if the field is a variable-length field. - *@return true if the field is a variable-length field; false otherwise. - **/ - public boolean isVariableLength() - { - return isVariableLength_; - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400ByteArray dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length of the field based on the data type - length_ = dataType.getByteLength(); - } - - //@B0C - javadoc - /** - *Sets the value for the DFT keyword for this field. - *@param defaultValue The default value for this - * field. The length of defaultValue - * must be greater than zero. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(byte[] defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - if (defaultValue.length < 1) - { - throw new ExtendedIllegalArgumentException("defaultValue (" + String.valueOf(defaultValue) + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; //@B0A - isDFTCurrent_ = false; //@B0A - DFTCurrentValue_ = null; //@B0A - } - - //@B0A - /** - *Sets the value for the DFT keyword to be *NULL for this field. - *Calling this method will replace the DFT keyword that was previously - *set on a call to setDFT(). Note: This field - *must also have its ALWNULL keyword set to true to prevent DDS errors. - **/ - public void setDFTNull() - { - isDFTNull_ = true; - defaultValue_ = null; - isDFTCurrent_ = false; - DFTCurrentValue_ = null; - } - - /** - *Indicates that the field is a variable-length field. - *@param value true if the field is a variable-length field; false otherwise. - **/ - public void setVariableLength(boolean value) - { - isVariableLength_ = value; - } - - /** - *Sets the value to specify for the VARLEN keyword for this field. - *@param varLen The value to specify for the VARLEN keyword for this field. - *The varLen cannot be less than zero. - **/ - public void setVARLEN(int varLen) - { - if (varLen < 0) - { - throw new ExtendedIllegalArgumentException("varLen (" + String.valueOf(varLen) + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - variableLength_ = varLen; - isVariableLength_ = true; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/HexReader.java b/cvsroot/src/com/ibm/as400/access/HexReader.java deleted file mode 100644 index e84cc84cc..000000000 --- a/cvsroot/src/com/ibm/as400/access/HexReader.java +++ /dev/null @@ -1,82 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HexReader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; - -/** - * Converts a stream of bytes to their character hexadecimal representation. - * For example, if the underlying InputStream contains the sequence of bytes: - *
        - * 0xFF 0xAB 0x40 0x20
        - * 
        - * this Reader will return the following sequence of Unicode characters when read() is called: - * "FFAB4020" - * @see com.ibm.as400.access.HexReaderInputStream -**/ -class HexReader extends InputStreamReader -{ - private InputStream in_; - private boolean cached_ = false; - private byte cachedByte_; - - public HexReader(InputStream in) - { - super(in); - in_ = in; - } - - public int read() throws IOException - { - synchronized(lock) - { - if (cached_) - { - cached_ = false; - return BinaryConverter.loNibbleToChar(cachedByte_); - } - else - { - cachedByte_ = (byte)in_.read(); - cached_ = true; - return BinaryConverter.hiNibbleToChar(cachedByte_); - } - } - } - - public int read(char[] cbuf, int offset, int length) throws IOException - { - if (cbuf == null) throw new NullPointerException("cbuf"); - if (length == 0) return 0; - synchronized(lock) - { - if (cached_) - { - cached_ = false; - cbuf[offset] = BinaryConverter.loNibbleToChar(cachedByte_); - return 1; - } - else - { - byte[] buf = new byte[length/2]; - int numRead = in_.read(buf); - int numConverted = BinaryConverter.bytesToHexString(buf, 0, numRead, cbuf, offset); - return numConverted; - } - } - } -} - - - diff --git a/cvsroot/src/com/ibm/as400/access/HexReaderInputStream.java b/cvsroot/src/com/ibm/as400/access/HexReaderInputStream.java deleted file mode 100644 index 1c0df2a84..000000000 --- a/cvsroot/src/com/ibm/as400/access/HexReaderInputStream.java +++ /dev/null @@ -1,141 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HexReaderInputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; - -/** - * Converts a stream of hexadecimal characters to their actual - * integer (byte) values. - * For example, if the underlying Reader contains the data "123ABC", - * this InputStream will return the following bytes when read() is called: - * 0x12, 0x3A, 0xBC. - * @see com.ibm.as400.access.HexReader -**/ -class HexReaderInputStream extends InputStream -{ - private Reader reader_; - private boolean cached_ = false; - private char cachedChar_; - - public HexReaderInputStream(Reader reader) - { - super(); - reader_ = reader; - } - - public int available() throws IOException - { - synchronized(this) - { - if (cached_ && reader_.ready()) return 1; - } - return 0; - } - - public void close() throws IOException - { - reader_.close(); - } - - public synchronized int read() throws IOException - { - if (cached_) - { - cached_ = false; - int lo = reader_.read(); - if (lo == -1) return -1; - - try - { - return BinaryConverter.charsToByte(cachedChar_, (char)lo); - } - catch(NumberFormatException e) - { - throw new ExtendedIOException(ExtendedIOException.CANNOT_CONVERT_VALUE); - } - } - else - { - int hi = reader_.read(); - if (hi == -1) return -1; - int lo = reader_.read(); - if (lo == -1) return -1; - - try - { - return BinaryConverter.charsToByte((char)hi, (char)lo); - } - catch(NumberFormatException e) - { - throw new ExtendedIOException(ExtendedIOException.CANNOT_CONVERT_VALUE); - } - } - } - - public synchronized int read(byte[] b) throws IOException - { - return read(b, 0, b.length); - } - - public synchronized int read(byte[] b, int off, int len) throws IOException - { - if (b == null) throw new NullPointerException("b"); - if (len == 0) return 0; - if (cached_) - { - cached_ = false; - int lo = reader_.read(); - if (lo == -1) return -1; - try - { - b[off] = BinaryConverter.charsToByte(cachedChar_, (char)lo); - } - catch(NumberFormatException e) - { - throw new ExtendedIOException(ExtendedIOException.CANNOT_CONVERT_VALUE); - } - return 1; - } - else - { - char[] buf = new char[len*2]; - int numRead = reader_.read(buf); - if (numRead == -1) return -1; - if (numRead % 2 != 0) // did we read an odd number of bytes - { - cached_ = true; - cachedChar_ = buf[numRead-1]; - --numRead; - } - try - { - return BinaryConverter.stringToBytes(buf, 0, numRead, b, off); - } - catch(NumberFormatException e) - { - throw new ExtendedIOException(ExtendedIOException.CANNOT_CONVERT_VALUE); - } - } - } - - public synchronized long skip(long n) throws IOException - { - if (n == 0) return 0; - if (cached_) cached_ = false; - long skipped = reader_.skip(n*2); - return skipped / 2; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/HistoryLog.java b/cvsroot/src/com/ibm/as400/access/HistoryLog.java deleted file mode 100644 index 292dcb2d6..000000000 --- a/cvsroot/src/com/ibm/as400/access/HistoryLog.java +++ /dev/null @@ -1,1072 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HistoryLog.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.access; - -import java.io.IOException; -import java.util.Calendar; -import java.util.Date; -import java.util.Enumeration; - -/** -* Represents a history log on the system. This class is used to get a list of messages in a history log. -* The {@link #close close()} method should be called when you are finished retrieving messages from the list. -*

        Note: The System API this class uses is NOT available when connecting to V5R4 or earlier systems. -*

        QueuedMessage objects have many attributes. Only some of these attribute values are set, depending -* on how a QueuedMessage object is created. The following is a list of attributes whose values are set on -* QueuedMessage objects returned in a list of history log messages: -*

          -*
        • date sent -*
        • message file name -*
        • message file library -*
        • message ID -*
        • message severity -*
        • message text -*
        • message type -*
        • sending job name -*
        • sending job number -*
        • sending job user name -*
        • sending current user -*
        -* @see com.ibm.as400.access.QueuedMessage -**/ -public class HistoryLog -{ - static final long serialVersionUID = 4L; - - /** - * Constant indicating the current date. The value of this constant is {@value}. - **/ - public static final String CURRENT_DATE = "*CURRENT"; - - /** - * Constant indicating to list data logged from the beginning of the log. The value of this constant is {@value}. - **/ - public static final String BEGIN = "*BEGIN"; - - /** - * Constant indicating the last day on which data was logged is the last day for which logged - * data is listed. The value of this constant is {@value}. - **/ - public static final String END = "*END"; - - /** - * Constant indicating that any logged data that is available for the specified dates should be listed. - * The value of this constant is {@value}. - */ - public static final String AVAIL = "*AVAIL"; - - /** - * Constant indicating that the message IDs in the list are to be omitted. - */ - public static final int OMIT = 1; - - /** - * Constant indicating that the message IDs in the list are to be selected. - */ - public static final int SELECT = 0; - - /** - * Message type for completion messages. - */ - public static final String TYPE_COMPLETION = "*COMP"; - - /** - * Message type for copy messages. - */ - public static final String TYPE_COPY = "*COPY"; - - /** - * Message type for diagnostic messages. - */ - public static final String TYPE_DIAGNOSTIC = "*DIAG"; - - /** - * Message type for escape messages. - */ - public static final String TYPE_ESCAPE = "*ESCAPE"; - - /** - * Message type for informational messages. - */ - public static final String TYPE_INFORMATIONAL = "*INFO"; - - /** - * Message type for inquiry messages. You can send inquiry messages only - * to the external message queue. - */ - public static final String TYPE_INQUIRY = "*INQ"; - - /** - * Message type for notify messages. - */ - public static final String TYPE_NOTIFY = "*NOTIFY"; - - /** - * Message type for reply messages. - */ - public static final String TYPE_REPLY = "*RPY"; - - /** - * Message type for request messages. - */ - public static final String TYPE_REQUEST = "*RQS"; - - // starting date for messages and jobs to be listed, the default is *CURRENT - private String startingDate_ = CURRENT_DATE; - // starting time for messages and jobs to be listed, the default is *AVAIL - private String startingTime_ = AVAIL; - // ending date for messages and jobs to be listed, the default is *END - private String endingDate_ = END; - // ending time for messages and jobs to be listed, the default is *AVAIL - private String endingTime_ = AVAIL; - // jobs for which messages in the log are listed - private Job[] jobsToList_ = new Job[0]; - // message ids to be retrieved or omitted - private String[] messageIDs_ = new String[0]; - // indicator if messages ids in the list should be omitted or selected - private int idListIndicator_ = SELECT; // the default is selected (0) - // minimum severity of messages to be listed - private int messageSeverity_ = 0; - // indicator if message types in the list should be omitted or selected - private int typesListIndicator_ = SELECT; // the default is selected (0) - // message types to be retrieved or omitted - private String[] messageTypes_ = new String[0]; - - // The system where the history log is located. - private AS400 system_; - // Length of the history log message list. - private int length_; - // Handle that references the user space used by the open list APIs. - private byte[] handle_; - // If the list info has changed, close the old handle before loading the new one. - private boolean closeHandle_ = false; - - /** - * Constructs a HistoryLog object for the specified system. - * @param system The system object representing the system on which the history log exists. - */ - public HistoryLog(AS400 system) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing HistoryLog object, system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - system_ = system; - } - - /** - Closes the message list on the system. This releases any system resources previously in use by this message list. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public synchronized void close() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Closing job log message list, handle: ", handle_); - if (handle_ == null) return; - - try { - ListUtilities.closeList(system_, handle_); - } - finally { - handle_ = null; - closeHandle_ = false; - } - } - - /** - Returns the number of messages in the history log. This method implicitly calls {@link #load load()}. - @return The number of messages, or 0 if no list was retrieved. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system or when running to V5R4 or an earlier release. - @see #load - **/ - public int getLength() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting history log list length."); - if (handle_ == null || closeHandle_) load(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Length:", length_); - return length_; - } - - /** - Returns the list of messages in the history log. The messages are listed from oldest to newest. - @return An Enumeration of QueuedMessage objects. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system or when running to V5R4 or an earlier release. - **/ - public Enumeration getMessages() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving history log message list."); - // Need to get the length. - if (handle_ == null || closeHandle_) load(); - return new QueuedMessageEnumeration(this, length_); - } - - /** - Returns a subset of the list of messages in the history log. This method allows the user to retrieve the message list from the system in pieces. If a call to {@link #load load()} is made (either implicitly or explicitly), then the messages at a given list offset will change, so a subsequent call to getMessages() with the same listOffset and number will most likely not return the same QueuedMessages as the previous call. - @param listOffset The starting offset in the list of messages (0-based). This value must be greater than or equal to 0 and less than the list length; or specify -1 to retrieve all of the messages. - Note: Prior to JTOpen 7.2, this parameter was incorrectly described. - @param number The number of messages to retrieve out of the list, starting at the specified listOffset. This value must be greater than or equal to 0 and less than or equal to the list length. If the listOffset is -1, this parameter is ignored. - @return The array of retrieved {@link com.ibm.as400.access.QueuedMessage QueuedMessage} objects. The length of this array may not necessarily be equal to number, depending upon the size of the list on the system, and the specified listOffset. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system, or when running to V5R4 or an earlier release. - @see com.ibm.as400.access.QueuedMessage - **/ - public QueuedMessage[] getMessages(int listOffset, int number) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving history log message list, list offset: " + listOffset + ", number:", number); - if (listOffset < -1) - { - throw new ExtendedIllegalArgumentException("listOffset (" + listOffset + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (number < 0 && listOffset != -1) - { - throw new ExtendedIllegalArgumentException("number (" + number + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (handle_ == null || closeHandle_) load(); // this sets the length_ variable - - if (length_ == 0 || (number == 0 && listOffset != -1)) { - return new QueuedMessage[0]; - } - - if (listOffset == -1) - { - number = length_; // request entire list - listOffset = 0; // ... starting at beginning of list - } - else if (listOffset >= length_) - { - if (Trace.traceOn_) - Trace.log(Trace.WARNING, "Value of parameter 'listOffset' is beyond end of list:", listOffset + " (list length: " + length_ + ")"); - - return new QueuedMessage[0]; - } - else if (listOffset + number > length_) - { - number = length_ - listOffset; - } - - int lengthOfReceiverVariable = 1024 * number; - - // Retrieve the entries in the list that was built by the most recent load(). - byte[] data = ListUtilities.retrieveListEntries(system_, handle_, lengthOfReceiverVariable, number, listOffset, null); - - Converter conv = new Converter(system_.getCcsid(), system_); - - QueuedMessage[] messages = new QueuedMessage[number]; - int offset = 0; - for (int i = 0; i < messages.length; ++i) // each message - { - // Data in the HSTL0100 Format - int entryLength = BinaryConverter.byteArrayToInt(data, offset); - int messageSeverity = BinaryConverter.byteArrayToInt(data, offset + 4); - String messageIdentifier = conv.byteArrayToString(data, offset + 8, 7).trim(); - int messageType = (data[offset + 15] & 0x0F) * 10 + (data[offset + 16] & 0x0F); - if (messageType == 0) messageType = -1; - String messageFileName = conv.byteArrayToString(data, offset + 17, 10).trim(); - String messageFileLibrarySpecified = conv.byteArrayToString(data, offset + 27, 10).trim(); - String dateSent = conv.byteArrayToString(data, offset + 37, 7); // CYYMMDD - String timeSent = conv.byteArrayToString(data, offset + 44, 6); // HHMMSS - String fromJob = conv.byteArrayToString(data, offset + 56, 10).trim(); - String fromJobUser = conv.byteArrayToString(data, offset + 66, 10).trim(); - String fromJobNumber = conv.byteArrayToString(data, offset + 76, 6); - String currentUser = conv.byteArrayToString(data, offset + 82, 10).trim(); - - int locOfMessageData = BinaryConverter.byteArrayToInt(data, offset+96); - int lengthOfMessageData = BinaryConverter.byteArrayToInt(data, offset + 100); - int locOfReplacementData = BinaryConverter.byteArrayToInt(data, offset+104); - int lengthOfReplacementData = BinaryConverter.byteArrayToInt(data, offset+108); - String messageText = conv.byteArrayToString(data, offset + locOfMessageData, lengthOfMessageData); - byte[] replacementDataBytes = new byte[lengthOfReplacementData]; - System.arraycopy(data, offset+locOfReplacementData, replacementDataBytes, 0, lengthOfReplacementData); - messages[i] = new QueuedMessage(system_, messageSeverity, messageIdentifier, messageType, messageFileName, messageFileLibrarySpecified, dateSent, timeSent, fromJob, fromJobUser, fromJobNumber, currentUser, messageText, replacementDataBytes); - - offset += entryLength; - } - - return messages; - } - - /** - Returns the system object representing the system on which the history log exists. - @return The system object representing the system on which the history log exists. If the system has not been set, null is returned. - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - /** - Loads the list of messages on the system. This method informs the system to build a list of messages. This method blocks until the system returns the total number of messages it has compiled. A subsequent call to {@link #getMessages getMessages()} will retrieve the actual message information and attributes for each message in the list from the system. -

        This method updates the list length. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system or when running to V5R4 or an earlier release. - @see #getLength - **/ - public synchronized void load() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loading history log message list."); - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Close the previous list. - if (closeHandle_) close(); - - // Generate text objects based on system CCSID. - Converter conv = new Converter(system_.getCcsid(), system_); - - // Determine size and number of message ids to filter by - int numMessageIDs = messageIDs_.length; - int sizeMessageIDs = numMessageIDs * 7; - // Determine the size and number of jobs to filter by - int numJobs = jobsToList_.length; - int sizeJobs = numJobs * 26; - // Determine the size and number of message types to filter by - int numMessageTypes = messageTypes_.length; - int sizeMessageTypes = numMessageTypes * 10; - - // Determine the offsets for the start of the variable information - int offsetToVariableInformation = 92; - int offsetToMessageIDs = offsetToVariableInformation; - int offsetToJobs = offsetToMessageIDs + sizeMessageIDs; - int offsetToMessageTypes = offsetToJobs + sizeJobs; - - // Create the message selection information. - // message selection information will be 92 + size of message ids + size of jobs + size of message types - byte[] messageSelectionInformation = new byte[92 + sizeMessageIDs + sizeJobs + sizeMessageTypes]; - // The length of the fixed portion of information. This must be set to 92. Binary(4) - BinaryConverter.intToByteArray(92, messageSelectionInformation, 0); - // Blank pad through date and time fields. - for (int i = 4; i < 56; ++i) messageSelectionInformation[i] = 0x40; - // Start date - Char(10) - conv.stringToByteArray(startingDate_, messageSelectionInformation, 4); - // Start time - Char(10) - conv.stringToByteArray(startingTime_, messageSelectionInformation, 14); - // Start after time microseconds - Char(6) - for (int i=24; i<30; ++i) messageSelectionInformation[i] = 0x00; - // End by date - Char(10) - conv.stringToByteArray(endingDate_, messageSelectionInformation, 30); - // End by time - Char(10) - conv.stringToByteArray(endingTime_, messageSelectionInformation, 40); - // End by time microseconds - Char(6) - for (int i=50; i<56; ++i) messageSelectionInformation[i] = 0x00; - // Message ids list contents indicator - Binary(4) - BinaryConverter.intToByteArray(idListIndicator_, messageSelectionInformation, 56); - // Offset to list of message ids - Binary(4) - BinaryConverter.intToByteArray((numMessageIDs == 0) ? 0 : offsetToMessageIDs, messageSelectionInformation, 60); - // Number of message ids in list - Binary(4) - BinaryConverter.intToByteArray((numMessageIDs == 0) ? 0 : numMessageIDs, messageSelectionInformation, 64); - // Offset to jobs to list - Binary(4) - BinaryConverter.intToByteArray((numJobs == 0) ? 0 : offsetToJobs, messageSelectionInformation, 68); - // Number of jobs to list - Binary(4) - BinaryConverter.intToByteArray((numJobs == 0) ? 0 : numJobs, messageSelectionInformation, 72); - // Message severity - Binary(4) - BinaryConverter.intToByteArray(messageSeverity_, messageSelectionInformation, 76); - // Message type list contents indicator - Binary(4) - BinaryConverter.intToByteArray(typesListIndicator_, messageSelectionInformation, 80); - // Offset to list of message types - Binary(4) - BinaryConverter.intToByteArray((numMessageTypes == 0) ? 0 : offsetToMessageTypes, messageSelectionInformation, 84); - // Number of message types in list - Binary(4) - BinaryConverter.intToByteArray((numMessageTypes == 0) ? 0 : numMessageTypes, messageSelectionInformation, 88); - // Reserved - Char(*) - An ignored Field - // Blank pad through variable length area. - int padFor = sizeMessageIDs + sizeJobs + sizeMessageTypes; - for (int n = offsetToMessageIDs; n < (offsetToMessageIDs + padFor); ++n) messageSelectionInformation[n] = 0x40; - // Message ids list - Char(*) - each message id is Char(7) - for(int i=0; i - *

      • {@link #CURRENT_DATE} (default)
      • - *
      • {@link #BEGIN}
      • - *
      • A date in the format CYYMMDD: - *
          - *
        • C - Century, where 0 indicates years 19xx and 1 indicates years 20xx
        • - *
        • YY - Year
        • - *
        • MM - Month
        • - *
        • DD - Day
        • - *
        - *
      • - *
      - * @param time The starting time. - * Valid values include: - *
        - *
      • {@link #AVAIL} (default) - *
      • A time specified in the 24 hour format HHMMSS: - *
          - *
        • HH - Hour
        • - *
        • MM - Minute
        • - *
        • SS - Second
        • - *
        - *
      - * @exception ExtendedIllegalArgumentException if the date is not in a valid format. - */ - public void setStartingDate(String date, String time) throws ExtendedIllegalArgumentException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting starting date: " + date + " " + time); - synchronized(this) - { - // Set the starting date - if(date == null || date.length() == 0) - startingDate_ = CURRENT_DATE; - else if(date.trim().equalsIgnoreCase(CURRENT_DATE)) - startingDate_ = CURRENT_DATE; - else if(date.trim().equalsIgnoreCase(BEGIN)) - startingDate_ = BEGIN; - else // assume the String is in the CYYMMDD format - { - if(date.trim().length() > 7) - throw new ExtendedIllegalArgumentException("date (" + date + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - startingDate_ = date; - } - - // Set the starting time - if(time == null || time.length() == 0) - startingTime_ = AVAIL; - else if(time.trim().equalsIgnoreCase(AVAIL)) - startingTime_ = AVAIL; - else // assume the String is in HHMMSS format - { - if(time.trim().length() > 6) - throw new ExtendedIllegalArgumentException("time (" + time + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - startingTime_ = time; - } - if(handle_ != null) closeHandle_ = true; - } - } - - /** - * Specifies the starting date and time for messages and jobs to be listed. - * @param date The starting date. - * @throws ExtendedIllegalArgumentException if the date is not valid. - */ - public void setStartingDate(Date date)throws ExtendedIllegalArgumentException{ - if (date == null) - { - Trace.log(Trace.ERROR, "Parameter 'date' is null."); - throw new NullPointerException("date"); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting starting date: " + date); - String start = dateToString(date); - synchronized(this) - { - startingDate_ = start.substring(0, 7); - startingTime_ = start.substring(7); - if(handle_ != null) closeHandle_ = true; - } - } - - /** - * Returns the starting date for messages and jobs to be listed. - * @return The starting date, or null if one of the following values - * was used to specify the starting date: - *
        - *
      • {@link #CURRENT_DATE}
      • - *
      • {@link #BEGIN}
      • - *
      - */ - public Date getStartingDate() - { - if(startingDate_.equals(CURRENT_DATE) || startingDate_.equals(BEGIN)) - return null; - else - return stringToDate(startingDate_, startingTime_); - } - - /** - * Specifies the ending date and time for messages and jobs to be listed. - * @param date The ending date. - * Valid values include: - *
        - *
      • {@link #CURRENT_DATE}
      • - *
      • {@link #END} (default)
      • - *
      • A date in the format CYYMMDD: - *
          - *
        • C - Century, where 0 indicates years 19xx and 1 indicates years 20xx
        • - *
        • YY - Year
        • - *
        • MM - Month
        • - *
        • DD - Day
        • - *
        - *
      • - *
      - * @param time The ending time. - * Valid values include: - *
        - *
      • {@link #AVAIL} (default) - *
      • A time specified in the 24 hour format HHMMSS: - *
          - *
        • HH - Hour
        • - *
        • MM - Minute
        • - *
        • SS - Second
        • - *
        - *
      - * @throws ExtendedIllegalArgumentException if the date is not in a valid format. - */ - public void setEndingDate(String date, String time) throws ExtendedIllegalArgumentException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting list ending date " + date + " " + time); - synchronized(this) - { - // Set the ending date - if(date == null || date.length() == 0) - endingDate_ = END; - else if(date.trim().equalsIgnoreCase(CURRENT_DATE)) - endingDate_ = CURRENT_DATE; - else if(date.trim().equalsIgnoreCase(END)) - endingDate_ = END; - else{ // assume the string is in CYYMMDD format - if(date.trim().length() > 7) - throw new ExtendedIllegalArgumentException("date (" + date + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - endingDate_ = date; - } - - // Set the ending time - if(time == null || time.length() == 0) - endingTime_ = AVAIL; - else if(time.trim().equalsIgnoreCase(AVAIL)) - endingTime_ = AVAIL; - else // assume the String is in HHMMSS format - { - if(time.trim().length() > 6) - throw new ExtendedIllegalArgumentException("time (" + time + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - endingTime_ = time; - } - if(handle_ != null) closeHandle_ = true; - } - } - - /** - * Specifies the end date and time for messages and jobs to be listed. - * @param date The ending date. - * @throws ExtendedIllegalArgumentException if the date is not valid. - */ - public void setEndingDate(Date date) throws ExtendedIllegalArgumentException{ - if (date == null) - { - Trace.log(Trace.ERROR, "Parameter 'date' is null."); - throw new NullPointerException("date"); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting list ending date: " + date); - String end = dateToString(date); - synchronized(this) - { - endingDate_ = end.substring(0, 7); - endingTime_ = end.substring(7); - if(handle_ != null) closeHandle_ = true; - } - } - - /** - * Returns the ending date for messages and jobs to be listed. - * @return The ending date, or null if one of the following special - * values were used for the date: - *
        - *
      • {@link #CURRENT_DATE}
      • - *
      • {@link #END}
      • - *
      - */ - public Date getEndingDate(){ - if(endingDate_.equals(CURRENT_DATE) || endingDate_.equals(END)) - return null; - else - return stringToDate(endingDate_, endingTime_); - } - - private Date stringToDate(String date, String time){ - - Calendar calendar = Calendar.getInstance(); - - int centuryAndYear = Integer.parseInt(date.substring(0,3)); - int month = Integer.parseInt(date.substring(3,5)); - int day = Integer.parseInt(date.substring(5,7)); - boolean timeAvail = time.equals(AVAIL); - int hour = timeAvail ? 0 : Integer.parseInt(time.substring(0,2)); - int minute = timeAvail ? 0 : Integer.parseInt(time.substring(2,4)); - int second = timeAvail ? 0 : Integer.parseInt(time.substring(4)); - - calendar.set(Calendar.YEAR, centuryAndYear + 1900); - calendar.set(Calendar.MONTH, month - 1); - calendar.set(Calendar.DAY_OF_MONTH, day); - calendar.set(Calendar.HOUR_OF_DAY, hour); - calendar.set(Calendar.MINUTE, minute); - calendar.set(Calendar.SECOND, second); - calendar.set(Calendar.MILLISECOND, 0); - return calendar.getTime(); - } - - /** - * Converts the specified Date object to a String in the format CYYMMDDHHMMSS. - * @param date - * @return the date represented in the format CYYMMDD - */ - private String dateToString(Date date){ - StringBuffer buffer = new StringBuffer(13); - Calendar calendar = Calendar.getInstance(); - calendar.setTime(date); - int year = calendar.get(Calendar.YEAR); - buffer.append((year<2000) ? '0' : '1'); - buffer.append(twoDigits(year % 100)); - buffer.append(twoDigits(calendar.get(Calendar.MONTH) + 1)); - buffer.append(twoDigits(calendar.get(Calendar.DAY_OF_MONTH))); - buffer.append(twoDigits(calendar.get(Calendar.HOUR_OF_DAY))); - buffer.append(twoDigits(calendar.get(Calendar.MINUTE))); - buffer.append(twoDigits(calendar.get(Calendar.SECOND))); - return buffer.toString(); - } - - /** - * Verifies if the date specified is in CYYMMDD - * @param date - */ - /*private void verifyDate(String date){ - // Parse the date to verify it is in the CYYMMDD format - int century = Integer.parseInt(date.substring(0,1)); - if(century != 0 && century != 1) - throw new ExtendedIllegalArgumentException("date(" + date + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - int year = Integer.parseInt(date.substring(1,3)); - if(!(year >= 0) && !(year<=99)) - throw new ExtendedIllegalArgumentException("date(" + date + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - int month = Integer.parseInt(date.substring(3,5)); - if(!(month > 0) && !(month<=12)) - throw new ExtendedIllegalArgumentException("date(" + date + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - int day = Integer.parseInt(date.substring(5)); - if(!(day > 0)) - throw new ExtendedIllegalArgumentException("date(" + date + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - switch(month){ - case 1: - case 3: - case 5: - case 7: - case 8: - case 10: - case 12: - if(!(day <= 31)) - throw new ExtendedIllegalArgumentException("date(" + date + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - break; - case 4: - case 6: - case 9: - case 11: - if(!(day <= 30)) - throw new ExtendedIllegalArgumentException("date(" + date + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - case 2: - if((year%4)==0) - { - if(!(day <= 29)) - throw new ExtendedIllegalArgumentException("date(" + date + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - else - if(!(day <= 28)) - throw new ExtendedIllegalArgumentException("date(" + date + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - */ - /** - * Specifies the specific messaged IDs to be retrieved or omitted. Each message id - * should be 7 characters. Up to 100 message IDs are supported. If not specified, all - * of the messages will be listed for the jobs and times specified. To select - * specific generic types of messages, specify the 3 character code that identifies - * the message file followed by all zeros. If the message ID is less than 7 characters, - * 0's will be appended to the ID. - * @param ids The message IDs. - * @throws ExtendedIllegalArgumentException if more than 100 message IDs are specified, or if - * a message ID is more than 7 characters. - */ - public void setMessageIDs(String[] ids) throws ExtendedIllegalArgumentException{ - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting list ids"); - - if(ids == null) - { - Trace.log(Trace.ERROR, "Parameter 'ids' is null."); - throw new NullPointerException("ids"); - } - if(ids.length > 100) // up to 100 message ids are supported - { - Trace.log(Trace.ERROR, "Length of ids not valid."); - throw new ExtendedIllegalArgumentException("ids (" + ids.length + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - int length = ids.length; - // verify the length of each id - for(int i=0; i 7) - { - Trace.log(Trace.ERROR, "Length of message id is not valid. Message ID = " + ids[i]); - throw new ExtendedIllegalArgumentException("ids[" + i + "] (" + ids[i] + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - else if(idLength < 7) - { - StringBuffer buffer = new StringBuffer(ids[i]); - // append zeros to the end, zeros indicating to match everything before the zeros - for(int j=idLength; j < 7; j++) - buffer.append("0"); - ids[i]=buffer.toString(); - } - } - synchronized(this) - { - messageIDs_ = ids; - if(handle_ != null) closeHandle_ = true; - } - } - - /** - * Returns the list of message ids used to filter which messages in the log are listed. - * @return The list of message ids or an empty array if no message ids were specified. - */ - public String[] getMessageIDs(){ - return messageIDs_; - } - - /** - * Specifies if the message IDs in the list are to be omitted or selected. - * @param indicator The indicator. - * Valid values are: - *
        - *
      • {@link #OMIT}
      • - *
      • {@link #SELECT} (default)
      • - *
      - * @throws ExtendedIllegalArgumentException - */ - public void setMessageIDsListIndicator(int indicator) throws ExtendedIllegalArgumentException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message ids list indicator: " + indicator); - - if(indicator != OMIT && indicator != SELECT) - throw new ExtendedIllegalArgumentException("indicator(" + indicator + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - synchronized(this) - { - idListIndicator_ = indicator; - if(handle_ != null) closeHandle_ = true; - } - } - - /** - * Returns the list indicator indicating if the message ids in the list are omitted or selected. - * @return The list indicator. Possible values are: - *
        - *
      • {@link #OMIT}
      • - *
      • {@link #SELECT}
      • - *
      - */ - public int getMessageIDsListIndicator() - { - return idListIndicator_; - } - - /** - * Specifies if the message types in the list are to be omitted or selected. - * @param indicator The indicator. - * Valid values are: - *
        - *
      • {@link #OMIT}
      • - *
      • {@link #SELECT} (default)
      • - *
      - * @throws ExtendedIllegalArgumentException - */ - public void setMessageTypeListIndicator(int indicator) throws ExtendedIllegalArgumentException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message type list indicator: " + indicator); - - if(indicator != OMIT && indicator != SELECT) - throw new ExtendedIllegalArgumentException("indicator(" + indicator + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - synchronized(this) - { - typesListIndicator_ = indicator; - if(handle_ != null) closeHandle_ = true; - } - } - - /** - * Returns the list indicator indicating if the message types in the list should - * be omitted or selected. - * @return The list indicator. Possibe values are: - *
        - *
      • {@link #OMIT}
      • - *
      • {@link #SELECT}
      • - *
      - */ - public int getMessageTypeListIndicator() - { - return typesListIndicator_; - } - - /** - * Specifies the specific message types to be retrieved or omitted. Up to 10 - * message types are supported. If not specified, all of the messages will - * be listed for the jobs, message severity and times specified. - * @param types The message types to be retrieved or omitted. Valid values are: - *
        - *
      • {@link #TYPE_COMPLETION}
      • - *
      • {@link #TYPE_COPY}
      • - *
      • {@link #TYPE_DIAGNOSTIC}
      • - *
      • {@link #TYPE_ESCAPE}
      • - *
      • {@link #TYPE_INFORMATIONAL}
      • - *
      • {@link #TYPE_INQUIRY}
      • - *
      • {@link #TYPE_NOTIFY}
      • - *
      • {@link #TYPE_REPLY}
      • - *
      • {@link #TYPE_REQUEST}
      • - *
      - * @throws ExtendedIllegalArgumentException - */ - public void setMessageTypes(String[] types)throws ExtendedIllegalArgumentException{ - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message types"); - if(types == null) - { - Trace.log(Trace.ERROR, "Parameter 'types' is null."); - throw new NullPointerException("types"); - } - // up to 10 message types are supported - if(types.length > 10) - { - Trace.log(Trace.ERROR, "Length of types not valid."); - throw new ExtendedIllegalArgumentException("types (" + types.length + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - // verify each type is one of the valid types - for(int i=0; i - *
    • {@link #TYPE_COMPLETION}
    • - *
    • {@link #TYPE_COPY}
    • - *
    • {@link #TYPE_DIAGNOSTIC}
    • - *
    • {@link #TYPE_ESCAPE}
    • - *
    • {@link #TYPE_INFORMATIONAL}
    • - *
    • {@link #TYPE_INQUIRY}
    • - *
    • {@link #TYPE_NOTIFY}
    • - *
    • {@link #TYPE_REPLY}
    • - *
    • {@link #TYPE_REQUEST}
    • - *
    - */ - public String[] getMessageTypes() - { - return messageTypes_; - } - - /** - * The minimum severity of the messages to be listed. Possible values are - * 0 through 99. Specify 0 to list all messages for the jobs, times, message types, - * and message IDs specified. - * @param severity The minumum severity of the messages to be listed. The default is zero. - * @throws ExtendedIllegalArgumentException - */ - public void setMessageSeverity(int severity) throws ExtendedIllegalArgumentException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message severity: " + severity); - if(severity < 0 || severity > 99) - throw new ExtendedIllegalArgumentException("severity (" + severity + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - synchronized(this) - { - messageSeverity_ = severity; - if(handle_ != null) closeHandle_ = true; - } - } - - /** - * Returns the minimum severity of the messages to be listed. - * @return The minumum severity. Possible values are 0 through 99. 0 indicates - * all messages for the jobs, times, message types, and message ids specified - * should be listed. - */ - public int getMessageSeverity() - { - return messageSeverity_; - } - - /** - * Specifies the specific jobs (if any) for which messages in the log are listed. - * The messages for the specified jobs are retrieved only if they are logged in the - * period of time, message severity, and messages specified on the call. - * Up to 5 jobs are supported. - * @param jobs The list of jobs. - * @throws ExtendedIllegalArgumentException if the number of jobs is greater than five - */ - public void setJobs(Job[] jobs) throws ExtendedIllegalArgumentException{ - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting jobs"); - // Only up to five jobs are supported - if(jobs == null) - { - Trace.log(Trace.ERROR, "Parameter 'jobs' is null."); - throw new NullPointerException("jobs"); - } - - if(jobs.length > 5) - { - Trace.log(Trace.ERROR, "Length of jobs not valid."); - throw new ExtendedIllegalArgumentException("jobs (" + jobs.length + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - //verify the name, user, and number are set on each of the jobs - for(int i=0; i 99) - throw new ExtendedIllegalArgumentException("value", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - String full = "00" + Integer.toString(value); - return full.substring(full.length() - 2); - } - - - /** - Closes the list on the system when this object is garbage collected. - **/ - protected void finalize() throws Throwable - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Finalize method for history log invoked."); - if (handle_ != null) try { close(); } catch (Throwable t) {} - super.finalize(); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSCachedAttributes.java b/cvsroot/src/com/ibm/as400/access/IFSCachedAttributes.java deleted file mode 100644 index ffdc6b8e6..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSCachedAttributes.java +++ /dev/null @@ -1,159 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSCachedAttributes.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; -import java.io.Serializable; - - -/** -Store cached attributes. -**/ -class IFSCachedAttributes implements Serializable -{ - static final long serialVersionUID = 4L; - - static final int FA_READONLY = 0x01; - static final int FA_HIDDEN = 0x02; - - long accessDate_; - long creationDate_; - int fixedAttributes_; - boolean isDirectory_; - boolean isFile_; - boolean isSymbolicLink_; - long modificationDate_; - String name_; - int objectType_; - String parent_; // path of directory - long size_; // @A1c - byte[] restartID_; // @C3a - -/** -Construct listCachedAttributes object from a list of attributes. -**/ - IFSCachedAttributes(long accessDate, long creationDate, int fixedAttributes, - long modificationDate, int objectType, long size, - String name, String parent, boolean isDirectory, boolean isFile, byte[] restartID, boolean isSymbolicLink) // @A1c @C3c - { - accessDate_ = accessDate; - creationDate_ = creationDate; - fixedAttributes_ = fixedAttributes; - isDirectory_ = isDirectory; - isFile_ = isFile; - modificationDate_ = modificationDate; - name_ = name; - objectType_ = objectType; - parent_ = parent; - size_ = size; - restartID_ = restartID; // @C3a - isSymbolicLink_ = isSymbolicLink; - } - -/** -Return access date. -**/ - long getAccessDate() - { - return accessDate_; - } - -/** -Return creation date. -**/ - long getCreationDate() - { - return creationDate_; - } - -/** -Return fixed attributes. -**/ - int getFixedAttributes() - { - return fixedAttributes_; - } - -/** -Return isDir_ -**/ - boolean getIsDirectory() - { - return isDirectory_; - } - -/** -Return isFile_ -**/ - boolean getIsFile() - { - return isFile_; - } - -/** -Return modification date. -**/ - long getModificationDate() - { - return modificationDate_; - } - -/** -Return name. -**/ - String getName() - { - return name_; - } - -/** -Return object type. -**/ - int getObjectType() - { - return objectType_; - } - -/** -Return path of parent directory. -**/ - String getParent() - { - return parent_; - } - -// @C3a -/** -Return restart ID. -**/ - byte[] getRestartID() - { - return restartID_; - } - -/** -Return size. -**/ - long getSize() // @A1c - { - return size_; - } - -/** -Return isSymbolicLink_ -**/ - boolean isSymbolicLink() - { - return isSymbolicLink_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSChangeAttrsReq.java b/cvsroot/src/com/ibm/as400/access/IFSChangeAttrsReq.java deleted file mode 100644 index 05d3b5c0a..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSChangeAttrsReq.java +++ /dev/null @@ -1,308 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSChangeAttrsReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** -"Change attributes" request. -**/ -class IFSChangeAttrsReq extends IFSDataStreamReq -{ - private static final int HEADER_LENGTH = 20; - - private static final int FILE_HANDLE_OFFSET = 22; - private static final int CCSID_OFFSET = 26; // CCSID of the filename - private static final int WORKING_DIR_HANDLE_OFFSET = 28; - private static final int ATTR_LIST_LEVEL_OFFSET = 32; - private static final int CREATE_DATE_OFFSET = 34; - private static final int MODIFY_DATE_OFFSET = 42; - private static final int ACCESS_DATE_OFFSET = 50; - private static final int SET_FLAGS_OFFSET = 58; - private static final int FIXED_ATTRS_OFFSET = 60; - private static final int FILE_SIZE_OFFSET = 64; - - // Additional field if datastreamLevel >= 16: - private static final int LARGE_FILE_SIZE_OFFSET = 68; - -/** -Construct a change attributes request. Use this request to change -the size of the file by file handle (the file is open) -@param fileHandle handle of file to change -@param fileSize the desired file size in bytes -@param datastreamLevel the datastream level of the server -**/ - IFSChangeAttrsReq(int fileHandle, - long fileSize, - int datastreamLevel) - { - super(HEADER_LENGTH + getTemplateLength(datastreamLevel)); // No optional/variable fields are used here. - setLength(data_.length); - setTemplateLen(getTemplateLength(datastreamLevel)); - setReqRepID(0x000b); - set32bit(fileHandle, FILE_HANDLE_OFFSET); - set32bit(1, WORKING_DIR_HANDLE_OFFSET); - set16bit(1, ATTR_LIST_LEVEL_OFFSET); - setData(0L, CREATE_DATE_OFFSET); - setData(0L, MODIFY_DATE_OFFSET); - setData(0L, ACCESS_DATE_OFFSET); - set16bit(1, SET_FLAGS_OFFSET); - - setFileSizeFields(fileSize, datastreamLevel); - } - -/** -Construct a change attributes request. Use this form to change the -date/time stamps of the file by handle (the file is open). -@param fileHandle handle of file to change -@param createDate the desired creation date (measured in milliseconds since -January 1, 1970 00:00:00 GMT) -@param modifyDate the desired last modification date (measured in milliseconds since -January 1, 1970 00:00:00 GMT) -@param accessDate the desired last access date (measured in milliseconds since -January 1, 1970 00:00:00 GMT) -**/ - IFSChangeAttrsReq(int fileHandle, - long createDate, - long modifyDate, - long accessDate, - int datastreamLevel) - { - super(HEADER_LENGTH + getTemplateLength(datastreamLevel)); // No optional/variable fields are used here. - setLength(data_.length); - setTemplateLen(getTemplateLength(datastreamLevel)); - setReqRepID(0x000b); - set32bit(fileHandle, FILE_HANDLE_OFFSET); - set32bit(1, WORKING_DIR_HANDLE_OFFSET); - set16bit(1, ATTR_LIST_LEVEL_OFFSET); - setDate(createDate, CREATE_DATE_OFFSET); - setDate(modifyDate, MODIFY_DATE_OFFSET); - setDate(accessDate, ACCESS_DATE_OFFSET); - set16bit(0, SET_FLAGS_OFFSET); - } - -/** -Construct a change attributes request. Use this form to change -the size of the file by file name. -@param fileName the name of the file to change -@param fileNameCCSID file name CCSID -@param fileSize the desired file size in bytes -**/ - IFSChangeAttrsReq(byte[] fileName, - int fileNameCCSID, - long fileSize, - int datastreamLevel) - { - super(HEADER_LENGTH + getTemplateLength(datastreamLevel) + 6 + fileName.length); - setLength(data_.length); - setTemplateLen(getTemplateLength(datastreamLevel)); - setReqRepID(0x000b); - set32bit(0, FILE_HANDLE_OFFSET); - set16bit(fileNameCCSID, CCSID_OFFSET); - set32bit(1, WORKING_DIR_HANDLE_OFFSET); - set16bit(1, ATTR_LIST_LEVEL_OFFSET); - setData(0L, CREATE_DATE_OFFSET); - setData(0L, MODIFY_DATE_OFFSET); - setData(0L, ACCESS_DATE_OFFSET); - set16bit(1, SET_FLAGS_OFFSET); - - setFileSizeFields(fileSize, datastreamLevel); - - // Set the LL. - set32bit(fileName.length + 6, getFilenameLLOffset(datastreamLevel)); - - // Set the code point. - set16bit(0x0002, getFilenameCPOffset(datastreamLevel)); - - // Set the file name characters. - System.arraycopy(fileName, 0, data_, getFilenameOffset(datastreamLevel), fileName.length); - } - -/** -Construct a change attributes request. Use this form to change the fixed attributes -of the file. -@param fileName the name of the file to change -@param fileNameCCSID file name CCSID -@param fixedAttributes the fixed attributes to set -@param stuff an extra boolean that is ignored. It is needed - so the signature of this constructor is unique. -**/ - IFSChangeAttrsReq(byte[] fileName, //@D1a - int fileNameCCSID, //@D1a - int fixedAttributes, //@D1a - boolean extraneousDataToMakeSignatureUnique, //@D1a - int datastreamLevel) - { //@D1a - super(HEADER_LENGTH + getTemplateLength(datastreamLevel) + 6 + fileName.length); //@D1a - setLength(data_.length); //@D1a - setTemplateLen(getTemplateLength(datastreamLevel)); //@D1a - setReqRepID(0x000b); //@D1a - set32bit(0, FILE_HANDLE_OFFSET); //@D1a - set16bit(fileNameCCSID, CCSID_OFFSET); //@D1a - set32bit(1, WORKING_DIR_HANDLE_OFFSET); //@D1a - set16bit(1, ATTR_LIST_LEVEL_OFFSET); //@D1a - setData(0L, CREATE_DATE_OFFSET); //@D1a - setData(0L, MODIFY_DATE_OFFSET); //@D1a - setData(0L, ACCESS_DATE_OFFSET); //@D1a - set16bit(2, SET_FLAGS_OFFSET); //@D1a - set32bit(fixedAttributes, FIXED_ATTRS_OFFSET); //@D1a - - setFileSizeFields(0L, datastreamLevel); - //@D1a - // Set the LL. //@D1a - set32bit(fileName.length + 6, getFilenameLLOffset(datastreamLevel)); //@D1a - //@D1a - // Set the code point. //@D1a - set16bit(0x0002, getFilenameCPOffset(datastreamLevel)); //@D1a - //@D1a - // Set the file name characters. //@D1a - System.arraycopy(fileName, 0, data_, getFilenameOffset(datastreamLevel), fileName.length); //@D1a - } //@D1a - //@D1a - //@D1a - -/** -Construct a change attributes request. Use this form to change the -date/time stamp of the file by file name. -@param fileName the name of the file to change -@param fileNameCCSID file name CCSID -@param createDate the desired creation date (measured in milliseconds since -January 1, 1970 00:00:00 GMT) -@param modifyDate the desired last modification date (measured in milliseconds since -January 1, 1970 00:00:00 GMT) -@param accessDate the desired last access date (measured in milliseconds since -January 1, 1970 00:00:00 GMT) -**/ - IFSChangeAttrsReq(byte[] fileName, - int fileNameCCSID, - long createDate, - long modifyDate, - long accessDate, - int datastreamLevel) - { - super(HEADER_LENGTH + getTemplateLength(datastreamLevel) + 6 + fileName.length); - setLength(data_.length); - setTemplateLen(getTemplateLength(datastreamLevel)); - setReqRepID(0x000b); - set32bit(0, FILE_HANDLE_OFFSET); - set16bit(fileNameCCSID, CCSID_OFFSET); - set32bit(1, WORKING_DIR_HANDLE_OFFSET); - set16bit(1, ATTR_LIST_LEVEL_OFFSET); - setDate(createDate, CREATE_DATE_OFFSET); - setDate(modifyDate, MODIFY_DATE_OFFSET); - setDate(accessDate, ACCESS_DATE_OFFSET); - set16bit(0, SET_FLAGS_OFFSET); - - // Set the LL. - set32bit(fileName.length + 6, getFilenameLLOffset(datastreamLevel)); - - // Set the code point. - set16bit(0x0002, getFilenameCPOffset(datastreamLevel)); - - // Set the file name characters. - System.arraycopy(fileName, 0, data_, getFilenameOffset(datastreamLevel), fileName.length); - } - - -/** -Construct a change attributes request. Use this form to change the file data CCSID. -@param fileName the name of the file to change -@param fileNameCCSID file name CCSID -@param oa2Structure The updated OA2x structure. This does not include the LLCP. -**/ - IFSChangeAttrsReq(byte[] fileName, - int fileNameCCSID, - IFSObjAttrs2 oa2Structure, - int datastreamLevel) - { - super(HEADER_LENGTH + getTemplateLength(datastreamLevel) + 6 + fileName.length + 6 + oa2Structure.length()); - setLength(data_.length); - setTemplateLen(getTemplateLength(datastreamLevel)); - setReqRepID(0x000b); - set32bit(0, FILE_HANDLE_OFFSET); - set16bit(fileNameCCSID, CCSID_OFFSET); - set32bit(1, WORKING_DIR_HANDLE_OFFSET); - set16bit(5, ATTR_LIST_LEVEL_OFFSET); // we're specifying an OA2b or OA2c - set16bit(0, SET_FLAGS_OFFSET); - - // Set the filename LL. (4 bytes) - set32bit(fileName.length + 6, getFilenameLLOffset(datastreamLevel)); // include length of LLCP (6 bytes) - - // Set the filename code point. (2 bytes) - set16bit(0x0002, getFilenameCPOffset(datastreamLevel)); - - // Set the filename characters. - System.arraycopy(fileName, 0, data_, getFilenameOffset(datastreamLevel), fileName.length); - - // Set the OA2 structure's LL. (4 bytes) - int offset = getFilenameOffset(datastreamLevel) + fileName.length; - set32bit(oa2Structure.getLength() + 6, offset); // include length of LLCP (6 bytes) - - // Set the OA2 structure's code point. (2 bytes) - set16bit(0x000F, offset + 4); - - // Set the OA2 structure (does not include the leading LLCP bytes). - System.arraycopy(oa2Structure.getData(), 0, data_, offset + 6, oa2Structure.length()); - } - - private final static int getTemplateLength(int datastreamLevel) - { - return (datastreamLevel < 16 ? 48 : 56); - } - - - // Determine offset (from beginning of request) to the 4-byte File Name "LL" field. - private final static int getFilenameLLOffset(int datastreamLevel) - { - return (datastreamLevel < 16 ? 68 : 76); - } - - // Determine offset (from beginning of request) to the 2-byte File Name "CP" field. - private final static int getFilenameCPOffset(int datastreamLevel) - { - return (datastreamLevel < 16 ? 72 : 80); - } - - // Determine offset (from beginning of request) to the File Name value field (follows LL/CP). - private final static int getFilenameOffset(int datastreamLevel) - { - return (datastreamLevel < 16 ? 74 : 82); - } - - // Sets the values of the fields relating to file size. - private final void setFileSizeFields(long fileSize, int datastreamLevel) - { - if (datastreamLevel < 16) - { // Just set the old field. - if (fileSize > (long)Integer.MAX_VALUE) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Specified fileSize value ("+fileSize+") exceeds maximum file length supported by system."); - fileSize = (long)Integer.MAX_VALUE; // set to maximum possible 'int' value - } - set32bit((int)fileSize, FILE_SIZE_OFFSET); - } - else - { - // The old field must be zero. - set32bit(0, FILE_SIZE_OFFSET); - - // Also set the new "large" field. - set64bit(fileSize, LARGE_FILE_SIZE_OFFSET); - } - } - -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSCloseRep.java b/cvsroot/src/com/ibm/as400/access/IFSCloseRep.java deleted file mode 100644 index 7a137c306..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSCloseRep.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSCloseRep.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -/** -Close file reply. -**/ -class IFSCloseRep extends IFSDataStream -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final int RETURN_CODE_OFFSET = 22; - - -/** -Generate a new instance of this type. -@return a reference to the new instance -**/ - public Object getNewDataStream() - { - return new IFSCloseRep(); - } - -/** -Determines the return code. -@return the return code -**/ - int getReturnCode() - { - return get16bit( RETURN_CODE_OFFSET); - } - -/** -Generates a hash code for this data stream. -@return the hash code -**/ - public int hashCode() - { - return 0x8004; - } -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSCloseReq.java b/cvsroot/src/com/ibm/as400/access/IFSCloseReq.java deleted file mode 100644 index 815013be0..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSCloseReq.java +++ /dev/null @@ -1,87 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSCloseReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - - -/** -Close file request. -**/ -class IFSCloseReq extends IFSDataStreamReq -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final int FILE_HANDLE_OFFSET = 22; - private static final int DATA_FLAGS_OFFSET = 26; - private static final int CCSID = 28; - private static final int AMOUNT_ACCESSED_OFFSET = 30; - private static final int ACCESS_HISTORY_OFFSET = 32; - private static final int MODIFY_DATE_OFFSET = 33; - private static final int TEMPLATE_LENGTH = 21; - -/** -Construct a close request. -@param fileHandle the file handle returned from an open request -**/ - IFSCloseReq(int fileHandle) - { - super(20 + TEMPLATE_LENGTH); - setLength(data_.length); - setTemplateLen(TEMPLATE_LENGTH); - setReqRepID(0x0009); - set32bit(fileHandle, FILE_HANDLE_OFFSET); - set16bit(2, DATA_FLAGS_OFFSET); - set16bit(0xffff, CCSID); - set16bit(100, AMOUNT_ACCESSED_OFFSET); - data_[ACCESS_HISTORY_OFFSET] = 0; - setData(0L, MODIFY_DATE_OFFSET); - } - -/** -Construct a close request. -**/ - IFSCloseReq() - { - super(20 + TEMPLATE_LENGTH); - setLength(data_.length); - setTemplateLen(TEMPLATE_LENGTH); - setReqRepID(0x0009); - set16bit(0xffff, CCSID); - set16bit(100, AMOUNT_ACCESSED_OFFSET); - data_[ACCESS_HISTORY_OFFSET] = 0; - setData(0L, MODIFY_DATE_OFFSET); - } - - /** - **/ - void setFileHandle(int fileHandle) - { - set32bit(fileHandle, FILE_HANDLE_OFFSET); - } - - /** - **/ - void setDataFlags(int dataFlags) - { - set16bit(dataFlags, DATA_FLAGS_OFFSET); - } - -} - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSCommitReq.java b/cvsroot/src/com/ibm/as400/access/IFSCommitReq.java deleted file mode 100644 index 03d76f354..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSCommitReq.java +++ /dev/null @@ -1,48 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSCommitReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - - -/** -Commit changes request. -**/ -class IFSCommitReq extends IFSDataStreamReq -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final int FILE_HANDLE_OFFSET = 22; - private static final int TEMPLATE_LENGTH = 6; - -/** -Construct a commit changes request. -@param fileHandle the file handle returned from an open request -**/ - IFSCommitReq(int fileHandle) - { - super(20 + TEMPLATE_LENGTH); - setLength(data_.length); - setTemplateLen(TEMPLATE_LENGTH); - setReqRepID(0x0006); - set32bit(fileHandle, FILE_HANDLE_OFFSET); - } - -} - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSCopyReq.java b/cvsroot/src/com/ibm/as400/access/IFSCopyReq.java deleted file mode 100644 index 1150022c2..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSCopyReq.java +++ /dev/null @@ -1,85 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSCopyReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - - -/** -Copy file request. -**/ -class IFSCopyReq extends IFSDataStreamReq -{ - private static final int SOURCE_CCSID_OFFSET = 22; // CCSID of source filename - private static final int TARGET_CCSID_OFFSET = 24; // CCSID of target filename - private static final int SOURCE_WORKING_DIR_HANDLE_OFFSET = 26; - private static final int TARGET_WORKING_DIR_HANDLE_OFFSET = 30; - private static final int DUPLICATE_TARGET_OPTION_OFFSET = 34; - private static final int TEMPLATE_LENGTH = 16; - private static final int SOURCE_NAME_LL_OFFSET = 36; - -/** -Construct a copy request. This request uses a standard IFSReturnCodeRep datastream for its reply. -**/ - IFSCopyReq(String sourcePath, String destinationPath, boolean replace) - { - // 20-byte header, plus template length, plus two 6-byte LLCP's, plus (sourcePath length plus targetPath length)*(2 bytes per Unicode char). - super(20 + TEMPLATE_LENGTH + 12 + (sourcePath.length()+destinationPath.length())*2); - setLength(data_.length); - setTemplateLen(TEMPLATE_LENGTH); - setReqRepID(0x0001); - // We always use UCS-2 for filenames; this could be upgraded to UTF-16 when the server supports it. - set16bit(13488, SOURCE_CCSID_OFFSET); - set16bit(13488, TARGET_CCSID_OFFSET); - set32bit(1, SOURCE_WORKING_DIR_HANDLE_OFFSET); // '1' is always the system root "/" - set32bit(1, TARGET_WORKING_DIR_HANDLE_OFFSET); // '1' is always the system root "/" - - // Duplicate target option - // Bits 3,2 = "deep copy" versus "shallow copy" - // 11 = not allowed - // 10 = copy the directory, its immediate children, and all of its subdirs - // 01 = copy the directory and its immediate children only - // 00 = create the directory name in the target; copy no children - // Bits 1,0 = "append" versus "replace" - // 11 = append data from the source file to the target file if the target exists - // 10 = same as 00 (bit 1 is ignored if bit 0 is off) - // 01 = replace the target file with the source file, if the target exists - // 00 = do not overwrite the destination if it exists, unless source is a dir - int dupTargetOpt = 0x08 + (replace ? 0x01 : 0x00); // We always do a deep copy. - set16bit(dupTargetOpt, DUPLICATE_TARGET_OPTION_OFFSET); - - int offset = SOURCE_NAME_LL_OFFSET; - set32bit(6+sourcePath.length()*2, offset); // source name LL - set16bit(0x0003, offset+4); // source name CP - - for (int i=0; i>>= 8) - { - data_[offset + i] = (byte) v; - } - } - -/** -Set a String value. -@param value the value -@param offset the data stream offset -**/ - protected void setData(String value, - int offset) - { - for (int i = 0, j = 0; i < value.length(); i++, j += 2) - { - int character = (int) value.charAt(i) & 0xffff; - data_[offset + j + 1] = (byte) (character & 0xff); - data_[offset + j] = (byte) (character >>> 8); - } - } - -/** -Set a date/time value. -@param date number of milliseconds since January 1, 1970, 00:00:00 GMT -@param offset the data stream offset -**/ - protected void setDate(long date, - int offset) - { - int seconds = (int) (date / 1000); - long s = seconds * 1000L; - - // @A1C - // Since the second byte needs to be in microseconds, need to multiply by 1000. - // - // Original code: - // int ms = (int) (date - s); - int ms = ((int) (date - s)) * 1000; - - set32bit(seconds, offset); - set32bit(ms, offset + 4); - } -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSDeleteDirReq.java b/cvsroot/src/com/ibm/as400/access/IFSDeleteDirReq.java deleted file mode 100644 index d332363d4..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSDeleteDirReq.java +++ /dev/null @@ -1,66 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSDeleteDirReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - - -/** -Delete directory request. -**/ -class IFSDeleteDirReq extends IFSDataStreamReq -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final int CCSID_OFFSET = 22; - private static final int WORKING_DIR_HANDLE_OFFSET = 24; - private static final int FLAGS_OFFSET = 28; - private static final int DIR_NAME_LL_OFFSET = 30; - private static final int DIR_NAME_CP_OFFSET = 34; - private static final int DIR_NAME_OFFSET = 36; - private static final int TEMPLATE_LENGTH = 10; - -/** -Construct a delete directory request. -@param name the directory to delete -@param fileNameCCSID file name CCSID -**/ - IFSDeleteDirReq(byte[] name, - int fileNameCCSID) - { - super(20 + TEMPLATE_LENGTH + 6 + name.length); - setLength(data_.length); - setTemplateLen(TEMPLATE_LENGTH); - setReqRepID(0x000E); - set16bit(fileNameCCSID, CCSID_OFFSET); - set32bit(1, WORKING_DIR_HANDLE_OFFSET); - set16bit(0, FLAGS_OFFSET); - - // Set the directory name length. - set32bit(name.length + 6, DIR_NAME_LL_OFFSET); - - // Set the code point. - set16bit(0x0001, DIR_NAME_CP_OFFSET); - - // Set the directory name characters. - System.arraycopy(name, 0, data_, DIR_NAME_OFFSET, name.length); - } - -} - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSDeleteFileReq.java b/cvsroot/src/com/ibm/as400/access/IFSDeleteFileReq.java deleted file mode 100644 index 7d9f4830c..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSDeleteFileReq.java +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSDeleteFileReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - - -/** -Delete file request. -**/ -class IFSDeleteFileReq extends IFSDataStreamReq -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final int CCSID_OFFSET = 22; - private static final int WORKING_DIR_HANDLE_OFFSET = 24; - private static final int FILE_NAME_LL_OFFSET = 28; - private static final int FILE_NAME_CP_OFFSET = 32; - private static final int FILE_NAME_OFFSET = 34; - private static final int TEMPLATE_LENGTH = 8; - -/** -Construct a delete file request. -@param name the file to delete -**/ - IFSDeleteFileReq(byte[] name, - int fileNameCCSID) - { - super(20 + TEMPLATE_LENGTH + 6 + name.length); - setLength(data_.length); - setTemplateLen(TEMPLATE_LENGTH); - setReqRepID(0x000C); - set16bit(fileNameCCSID, CCSID_OFFSET); - set32bit(1, WORKING_DIR_HANDLE_OFFSET); - - // Set the directory name length. - set32bit(name.length + 6, FILE_NAME_LL_OFFSET); - - // Set the code point. - set16bit(0x0002, FILE_NAME_CP_OFFSET); - - // Set the directory name characters. - System.arraycopy(name, 0, data_, FILE_NAME_OFFSET, name.length); - } - -} - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSExchangeAttrRep.java b/cvsroot/src/com/ibm/as400/access/IFSExchangeAttrRep.java deleted file mode 100644 index 963386a6d..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSExchangeAttrRep.java +++ /dev/null @@ -1,97 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSExchangeAttrRep.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - - - -/** -Exchange server attributes reply. -**/ -class IFSExchangeAttrRep extends IFSDataStream -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private static final int DATA_STREAM_LEVEL_OFFSET = 22; // @A1A - private static final int MAX_DATA_BLOCK_OFFSET = 26; - private static final int CCSID_LL_OFFSET = 30; - private static final int CCSID_CP_OFFSET = 34; - private static final int CCSID_OFFSET = 36; - - -/** -Generate a new instance of this type. -@return a reference to the new instance -**/ - public Object getNewDataStream() - { - return new IFSExchangeAttrRep(); - } - -/** -Get the highest data stream level supported by this server. -@return the data stream level -**/ - int getDataStreamLevel() // @A1A - { - return get16bit( DATA_STREAM_LEVEL_OFFSET); - } - -/** -Get the maximum data block size in bytes. -@return the maximum block size -**/ - int getMaxDataBlockSize() - { - return get32bit( MAX_DATA_BLOCK_OFFSET); - } - -/** -Get the server's preferred CCSID. -**/ - int getPreferredCCSID() - { - return get16bit(CCSID_OFFSET); - } - -/** -Get the server's preferred CCSIDs. Used for debugging. -**/ - int[] getPreferredCCSIDs() // @A1A - { - int llValue = get32bit(CCSID_LL_OFFSET); - int count = (llValue - 6) / 2; - int[] list = new int[count]; - for (int i=0, offset=CCSID_OFFSET; - i - * IFSFile objects are capable of generating file events that call the - * following {@link FileListener FileListener} methods: {@link FileListener#fileDeleted fileDeleted()} and {@link FileListener#fileModified fileModified()}. - *

    - * The following example demonstrates the use of IFSFile: - * - *

    -  * // Work with /Dir/File.txt on the system named MYSYSTEM.
    -  * AS400 as400 = new AS400("MYSYSTEM");
    -  * IFSFile file = new IFSFile(as400, "/Dir/File.txt");
    -  *
    -  * // Determine the parent directory of the file.
    -  * String directory = file.getParent();
    -  *
    -  * // Determine the name of the file.
    -  * String name = file.getName();
    -  *
    -  * // Determine the file size.
    -  * long length = file.length();
    -  *
    -  * // Determine when the file was last modified.
    -  * Date date = new Date(file.lastModified());
    -  *
    -  * // Delete the file.
    -  * if (file.delete() == false)
    -  * {
    -  *   // Display the error code.
    -  *   System.out.println("Unable to delete file.");
    -  * }
    -  * 
    - * - *

    Note: Because of a host server restriction, you cannot use this class to - * access files in QTEMP.LIB. - * - *

    Note: Support for "large files" (files larger than 2 gigabytes) was added - * to the File Server in IBM i V6R1, and was not PTF'd back to prior IBM i versions. - * The Toolbox's IFS classes rely on the File Server to access and - * manipulate files in the integrated file system. - * - *

    - * Note on the use of IFS classes when accessing QSYS files: - *
    The IFS classes are of limited usefulness when accessing formatted - * file objects under QSYS, such as physical files and save files. - * The IFS classes perform their work via datastream - * requests that are sent to the "File Server" job on the IBM i system. - * The File Server has its own idea of what is a "file" versus a "directory". - * In the case of a QSYS file object that contains records and/or members, - * the File Server tends to view such an object as a composite "directory" - * rather than a flat data "file" (since the File Server wouldn't be free to just - * start reading/writing bytes of data from/to the file at whatever offset, - * without ending up with meaningless or corrupted data). - * The File Server has no awareness of, or respect for, file record structure. - * When accessing QSYS file objects, consider the use of other classes such as - * {@link SequentialFile SequentialFile}, {@link KeyedFile KeyedFile}, and - * {@link SaveFile SaveFile}. - * - * @see FileEvent - * @see #addFileListener(FileListener) - * @see #removeFileListener(FileListener) - * @see IFSJavaFile - * @see IFSRandomAccessFile - * @see IFSFileInputStream - * @see IFSFileOutputStream - * @see IFSFileReader - * @see IFSFileWriter - **/ - -public class IFSFile - implements Serializable, Comparable // @B9c -{ - static final long serialVersionUID = 4L; - - /** - The integrated file system path separator string used to separate paths in a path list. - **/ - public final static String pathSeparator = ";"; - /** - The integrated file system path separator character used to separate paths in a - path list. - **/ - public final static char pathSeparatorChar = ';'; - /** - The integrated file system directory separator string used to separate - directory/file components in a path. - **/ - public final static String separator = "/"; - /** - The integrated file system directory separator character used to separate - directory/file components in a path. - **/ - public final static char separatorChar = '/'; - - private final static String DOT = "."; // @D4A - private final static String DOTDOT = "..";// @D4A - - // Constants used by QlgChmod and QlgAccess. Defined in system header file "stat.h". - // Note that these values are expressed in octal. - final static int ACCESS_EXECUTE = 001; - final static int ACCESS_WRITE = 002; - final static int ACCESS_READ = 004; - - /** - Value for indicating that "POSIX" pattern-matching is used by the various list() and listFiles() methods. -
    Using POSIX semantics, all files are listed that match the pattern and do not begin with a period (unless the pattern begins with a period). In that case, names beginning with a period are also listed. Note that when no pattern is specified, the default pattern is "*". -
    Note: In OS/400 V5R1 and earlier, all files that match the pattern are listed, including those that begin with a period. - **/ - public final static int PATTERN_POSIX = 0; - final static int PATTERN_DEFAULT = PATTERN_POSIX; // for use within package - /** - Value for indicating that "POSIX-all" pattern-matching is used by the various list() and listFiles() methods. -

    Using POSIX semantics, all files are listed that match the pattern, including those that begin with a period. - **/ - public final static int PATTERN_POSIX_ALL = 1; - /** - Value for indicating that "OS/2" pattern-matching is used by the various list() and listFiles() methods. - Using DOS semantics, all files are listed that match the pattern. - **/ - public final static int PATTERN_OS2 = 2; - - private final static String SECURITY_EXCEPTION = "Security exception."; - - transient private PropertyChangeSupport changes_; - transient private VetoableChangeSupport vetos_; - transient private Vector fileListeners_; - transient private IFSFileImpl impl_; - transient private ServiceProgramCall servicePgm_; - - private AS400 system_; - private String path_ = ""; // Note: This is never allowed to be null. - private Permission permission_; //@A6A - private String subType_; - - //@D2C Changed IFSListAttrsRep to IFSCachedAttributes - transient private IFSCachedAttributes cachedAttributes_;//@A7A - private boolean isDirectory_; //@A7A - private boolean isFile_; //@A7A - private boolean isSymbolicLink_; - private int patternMatching_; // type of pattern matching to use when listing files - private boolean sortLists_; // whether file-lists are returned from the File Server in sorted order - - - // Several pieces of member data set by listFiles0() for IFSFileEnumeration @D5A - // to indicate the number of objects returned from the IFS File Server and @D5A - // also the restartName and restartID info of the last object returned. @D5A - private int listFiles0LastNumObjsReturned_; //@D5A - private String listFiles0LastRestartName_=null; //@D5A - private byte[] listFiles0LastRestartID_; //@D5A - - - /** - Constructs an IFSFile object. - It creates a default IFSFile instance. - **/ - public IFSFile() - { - initializeTransient(); - } - - - /** - Constructs an IFSFile object. - It creates an IFSFile instance that represents the integrated file system - object on system that has a path name of directory, that is - followed by the separator character and name. - @param system The system that contains the file. - @param directory The directory. - @param name The file name. - **/ - public IFSFile(AS400 system, - IFSFile directory, - String name) - { - // Validate arguments. - if (system == null) - throw new NullPointerException("system"); - if (directory == null) - throw new NullPointerException("directory"); - else if (name == null) - throw new NullPointerException("name"); - - initializeTransient(); - - // Build the file's full path name. - path_ = directory.getAbsolutePath(); - if (path_.charAt(path_.length() - 1) != separatorChar) - { - // Append a separator character. - path_ += separator; - } - path_ += name; - - system_ = system; - - // @A6A Add permission property. - permission_ = null; - } - - - /** - Constructs an IFSFile object. - It creates an IFSFile instance that represents the integrated file system - object on system that has a path name of path. - @param system The system that contains the file. - @param path The absolute path name of the file. - **/ - public IFSFile(AS400 system, - String path) - { - // Validate arguments. - if (system == null) - throw new NullPointerException("system"); - else if (path == null) - throw new NullPointerException("path"); - - initializeTransient(); - - // If the specified path doesn't start with the separator character, - // add one. All paths are absolute for IFS. - if (path.length() == 0 || path.charAt(0) != separatorChar) - { - path_ = separator + path; - } - else - { - path_ = path; - } - - system_ = system; - } - - - /** - Constructs an IFSFile object. - It creates an IFSFile instance that represents the integrated file system - object on system that has a - path name is of directory, followed by the separator character - and name. - @param system The system that contains the file. - @param directory The directory path name. - @param name The file name. - **/ - public IFSFile(AS400 system, - String directory, - String name) - { - // Validate arguments. - if (system == null) - throw new NullPointerException("system"); - else if (directory == null) - throw new NullPointerException("directory"); - else if (name == null) - throw new NullPointerException("name"); - - initializeTransient(); - - // Build the file's full path name. Prepend a separator character - // to the directory name if there isn't one already. All paths - // are absolute in IFS. - if (directory.length() == 0 || directory.charAt(0) != separatorChar) - { - path_ = separator + directory; - } - else - { - path_ = directory; - } - if (path_.charAt(path_.length() - 1) != separatorChar) - { - // Append a separator character. - path_ += separator; - } - path_ += name; - - system_ = system; - } - - /** - Constructs an IFSFile object. - It creates an IFSFile instance that represents the integrated file system - object on system that has a path name of directory, that is - followed by the separator character and name. - @param system The system that contains the file. - @param directory The directory. - @param name The file name. - **/ - // @A4A - public IFSFile(AS400 system, - IFSJavaFile directory, - String name) - { - // Validate arguments. - if (system == null) - throw new NullPointerException("system"); - else if (directory == null) - throw new NullPointerException("directory"); - else if (name == null) - throw new NullPointerException("name"); - - initializeTransient(); - - // Build the file's full path name. - path_ = directory.getAbsolutePath().replace (directory.separatorChar, separatorChar); - if (path_.charAt(path_.length() - 1) != separatorChar) - { - // Append a separator character. - path_ += separator; - } - path_ += name; - - system_ = system; - } - - //@A7A Added new IFSFile method to support caching file attributes. - /** - Constructs an IFSFile object. - It creates an IFSFile instance that represents the integrated file system object - on system that has a path name of directory, that is followed by the - separator character and name. - {@link #isDirectory() isDirectory} and {@link #isFile() isFile} will both return false - for invalid symbolic links. - @param system The system that contains the file. - @param attributes The attributes of the file. - **/ - IFSFile(AS400 system, IFSCachedAttributes attributes) //@D2C - Use IFSCachedAttributes - { - // Validate arguments. - if (attributes == null) - throw new NullPointerException("attributes"); - - initializeTransient(); - - String directory = attributes.getParent(); //@D2C - Use IFSCachedAttributes - String name = attributes.getName(); //@D2C - Use IFSCachedAttributes - - // Build the file's full path name. Prepend a separator character - // to the directory name if there isn't one already. All paths - // are absolute in IFS. - StringBuffer buff = new StringBuffer(); - if (directory.length() == 0 || directory.charAt(0) != separatorChar) - { - buff.append(separator).append(directory); - } - else - { - buff.append(directory); - } - if (buff.toString().charAt(buff.toString().length() - 1) != separatorChar) - { - // Append a separator character. - buff.append(separator); - } - - path_ = buff.append(name).toString(); - - system_ = system; - - // Cache file attributes. - cachedAttributes_ = attributes; - //isDirectory and isFile can both be false if the object is an invalid - //symbolic link. - isDirectory_ = attributes.getIsDirectory(); - isFile_ = attributes.getIsFile(); - isSymbolicLink_ = attributes.isSymbolicLink(); - } - -/** - * Creates a new IFSFile instance from a parent abstract pathname and a child pathname string. - *

    - * The directory argument cannot be null. The constructed - * IFSFile instance uses the following settings taken from - * directory: - *

      - *
    • system - *
    • path - *
    - * The resulting file name is taken from the path name of directory, - * followed by the separator character, followed by name. - * - * @param directory The directory where the IFSFile is or will be stored. - * @param name The name of the IFSFile object. -**/ - public IFSFile(IFSFile directory, String name) - { - this((directory == null ? null : directory.getSystem()), - (directory == null ? null : directory.getPath()), - name); - } - - - /** - Adds a file listener to receive file events from this IFSFile. - @param listener The file listener. - **/ - public void addFileListener(FileListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - fileListeners_.addElement(listener); - } - - /** - Adds a property change listener. - @param listener The property change listener to add. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - changes_.addPropertyChangeListener(listener); - } - - /** - Adds a vetoable change listener. - @param listener The vetoable change listener to add. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - vetos_.addVetoableChangeListener(listener); - } - - - /** - Determines if the application is allowed to execute the integrated file system - object represented by this object. - This method is supported for IBM i V5R1 and higher. For older releases, it simply returns false. - If the user profile has *ALLOBJ special authority (and system is V5R1 or higher), this method always returns true. - @return true if the object exists and is executable by the application; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public boolean canExecute() - throws IOException - { - try - { - // Note: The called API (QlgAccess) is supported for V5R1 and higher. - if (impl_ == null) - chooseImpl(); - - return impl_.canExecute(); - } - catch (AS400SecurityException e) - { - // If we got the exception simply because we don't have "execute" access, ignore it. - if (e.getReturnCode() == AS400SecurityException.DIRECTORY_ENTRY_ACCESS_DENIED) - { - // Assume it's already been traced. - return false; - } - else // some other return code - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); - } - } - } - - - /** - Determines if the application can read from the integrated file system - object represented by this object. - Note that IBM i directories are never readable; only files can be readable. - @return true if the object exists and is readable by the application; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public boolean canRead() - throws IOException - { - try - { - if (impl_ == null) - chooseImpl(); - - return impl_.canRead(); - } - catch (AS400SecurityException e) - { - // If we got the exception simply because we don't have "read" access, ignore it. - if (e.getReturnCode() == AS400SecurityException.DIRECTORY_ENTRY_ACCESS_DENIED) - { - // Assume it's already been traced. - return false; - } - else // some other return code - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); - } - } - } - - - /** - Determines if the application can write to the integrated file system - object represented by this object. - Note that IBM i directories are never writable; only files can be writable. - @return true if the object exists and is writeable by the application; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public boolean canWrite() - throws IOException - { - try - { - if (impl_ == null) - chooseImpl(); - - return impl_.canWrite(); - } - catch (AS400SecurityException e) - { - // If we got the exception simply because we don't have "write" access, ignore it. - if (e.getReturnCode() == AS400SecurityException.DIRECTORY_ENTRY_ACCESS_DENIED) - { - // Assume it's already been traced. - return false; - } - else // some other return code - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); - } - } - } - - /** - Chooses the appropriate implementation. - **/ - void chooseImpl() - throws IOException, AS400SecurityException - { - if (impl_ == null) - { - // Ensure that the system has been set. - if (system_ == null) - { - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Ensure that the path name is set. - if (path_.length() == 0) - { - throw new ExtendedIllegalStateException("path", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - impl_ = (IFSFileImpl) system_.loadImpl2 - ("com.ibm.as400.access.IFSFileImplRemote", - "com.ibm.as400.access.IFSFileImplProxy"); - system_.connectService(AS400.FILE); - impl_.setSystem(system_.getImpl()); - impl_.setPath(path_); - } - } - - - -// @D6A - /** - Clear the cached attributes. This is needed when cached attributes - need to be refreshed. - - @see #listFiles - **/ - public void clearCachedAttributes() - { - cachedAttributes_ = null; - - if (impl_ != null) //@D8A - { - impl_.clearCachedAttributes(); //@D8A - } - } - - - -// @B9a -/** - * Compares the path of this IFSFile with an Object's path. - * If the other object is not an IFSFile or java.io.File, - * this method throws a ClassCastException, since - * IFSFile is comparable only to IFSFile and java.io.File. - * - *

    Note:
    The comparison is case sensitive. - * - * @param obj The Object to be compared. - * - * @return 0 if this IFSFile path equals the argument's path; - * a value less than 0 if this IFSFile path is less than the argument's - * path; and a value greater than 0 if this IFSFile path is greater - * than the argument's path. - * -**/ - public int compareTo(Object obj) - { - if (obj instanceof IFSFile) - return getPath().compareTo(((IFSFile)obj).getPath()); - else - return getPath().compareTo(((java.io.File)obj).getPath()); - } - - - /** - * Copies this file or directory to the specified file or directory - * on the system. - * If the destination file already exists, it is overwritten. - * If this IFSFile represents a directory: - *

      - *
    • The destination directory must be nonexistent, otherwise an exception is thrown. - *
    • The entire directory (including all of its contents and subdirectories) is copied. - *
    - * @param path The destination path to copy this IFSFile to. - *
    If the system is V5R2 or earlier: If the current object is a file (rather than a directory), the destination path must also specify a file (rather than a directory), otherwise the copy may fail. - * @return true if the copy succeeded (or at least one file of a source - * directory's contents was copied); false otherwise. - **/ - public boolean copyTo(String path) throws IOException, AS400SecurityException, ObjectAlreadyExistsException - { - return copyTo(path, true); - } - - - /** - * Copies this file or directory to the specified file or directory - * on the system. - * If the destination file already exists: - *
      - *
    • If replace is true, the destination file is overwritten. - *
    • If replace is false, an exception is thrown. - *
    - * If this IFSFile represents a directory: - *
      - *
    • The destination directory must be nonexistent, otherwise an exception is thrown. - *
    • The entire directory (including all of its contents and subdirectories) is copied. - *
    - * @param path The destination path to copy this IFSFile to. - *
    Note: If the system is V5R2 or earlier: If the current object is a file (rather than a directory), the destination path must also specify a file (rather than a directory), otherwise the copy may fail. - * @param replace true to overwrite the destination if it already exists, false otherwise. - *
    Note: If the system is V5R2 or earlier, this parameter has no effect; that is, the destination is always overwritten. - * @return true if the copy succeeded (or at least one file of a source - * directory's contents was copied); false otherwise. - **/ - // Note: Don't make this method public for now. The limitations of the 'replace' - // option are too complex, in terms of what the File Server can do for us. - // Wait until we have better support from the File Server. - boolean copyTo(String path, boolean replace) throws IOException, AS400SecurityException, ObjectAlreadyExistsException - { - if (path == null) throw new NullPointerException("path"); - if (impl_ == null) chooseImpl(); - return impl_.copyTo(path, replace); - } - - - /** - Determines the time that the integrated file system object represented by this - object was created. - @return The time (measured in milliseconds since 01/01/1970 00:00:00 GMT) - that the integrated file system object was created, or 0L if - the object does not exist or is not accessible. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public long created() //D3a - throws IOException //D3a - { //D3a - try //D3a - { //D3a - //@A7A Added check for cached attributes. //@D3a - if (cachedAttributes_ != null) //@D3a - { //@D3a - return cachedAttributes_.getCreationDate(); //@D3a - } //@D3a - else //@D3a - { //@D3a - if (impl_ == null) //@D3a - chooseImpl(); //@D3a - //@D3a - return impl_.created(); //@D3a - } //@D3a - } //D3a - catch (AS400SecurityException e) //D3a - { //D3a - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); //D3a - //return 0L; //D3a @B6d - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); // @B6a - } //D3a - } //D3a - - - /** - Atomically creates a new, empty file named by this abstract pathname if and only if a file with this name does not yet exist. - The check for the existence of the file and the creation of the file if it does not exist are a single operation that is atomic with respect to all other filesystem activities that might affect the file. - If the file already exists, its data are left intact. - @return true if the named file does not exist and was successfully created; false if the named file already exists. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - @exception IOException If the user is not authorized to create the file. - **/ - // @D1 - new method because of changes to java.io.File in Java 2. - public boolean createNewFile() - throws IOException - { - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - try - { - if (impl_ == null) - chooseImpl(); - - returnCode = impl_.createNewFile(); - switch (returnCode) - { - case IFSReturnCodeRep.SUCCESS: - break; - case IFSReturnCodeRep.DUPLICATE_DIR_ENTRY_NAME: // file already exists - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "File already exists: " + path_); - break; - case IFSReturnCodeRep.PATH_NOT_FOUND: // directory doesn't exist - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Path not found: " + path_); - break; - default: - Trace.log(Trace.ERROR, "Return code " + returnCode + " from createNewFile()."); - throw new ExtendedIOException(returnCode); - // Note: The return codes in IFSReturnCodeRep are replicated in ExtendedIOException. - } - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); // @B6a - } - return (returnCode == IFSReturnCodeRep.SUCCESS); - } - - - -//internal delete that returns a return code status indicator - int delete0() - throws IOException, AS400SecurityException - { - if (impl_ == null) - chooseImpl(); - - int rc = impl_.delete(); - - // Verify that the request was successful. - if (rc == IFSReturnCodeRep.SUCCESS) - { - // Fire the file deleted event. - if (fileListeners_.size() != 0) - { - FileEvent event = new FileEvent(this, FileEvent.FILE_DELETED); - synchronized(fileListeners_) - { - Enumeration e = fileListeners_.elements(); - while (e.hasMoreElements()) - { - FileListener listener = (FileListener)e.nextElement(); - listener.fileDeleted(event); - } - } - } - - // Clear any cached attributes. - cachedAttributes_ = null; //@A7a - } - - return rc; - } - - /** - Deletes the integrated file system object represented by this object. - - @return true if the file system object is successfully deleted; false otherwise. - Returns false if the file system object did not exist prior to the delete() or is not accessible. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public boolean delete() - throws IOException - { - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - try - { - returnCode = delete0(); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - // returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; //@A7D Unnecessary assignment. - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); // @B6a - } - return (returnCode == IFSReturnCodeRep.SUCCESS); - } - - - // @D4A - /** - Lists the integrated file system objects in the directory represented by this - object that satisfy filter. The returned Enumeration contains an IFSFile - object for each file or directory in the list. The list is loaded incrementally, - which will improve initial response time for large lists. - - @param filter A file object filter. - @param pattern The pattern that all filenames must match. Acceptable - characters are wildcards (*) and question marks (?). - - @return An Enumeration of IFSFile objects which represent the contents of the directory that satisfy the filter - and pattern. This Enumeration does not include the current directory or the parent - directory. If this object does not represent a directory, - this object represents an empty directory, or the filter or pattern does - not match any files, then an empty Enumeration is returned. The IFSFile object - passed to the filter object has cached file attribute information. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system, or the directory is not accessible. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public Enumeration enumerateFiles(IFSFileFilter filter, String pattern) - throws IOException - { - // Validate arguments. Note that we tolerate a null-valued 'filter'. - if (pattern == null) - throw new NullPointerException("pattern"); - - try { - return new IFSFileEnumeration(this, filter, pattern); - } - catch (AS400SecurityException e) { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - //return null; // @B6d - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); // @B6a - } - } - - -// @D4A - /** - Lists the integrated file system objects in the directory represented by this - object. The returned Enumeration contains an IFSFile - object for each file or directory in the list. The list is loaded incrementally, - which will improve initial response time for large lists. - - @param pattern The pattern that all filenames must match. Acceptable - characters are wildcards (*) and question marks (?). - - @return An Enumeration of IFSFile objects which represent the contents of the directory. - This Enumeration does not include the current directory or the parent - directory. If this object does not represent a directory, - this object represents an empty directory, or the pattern does - not match any files, then an empty Enumeration is returned. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system, or the directory is not accessible. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public Enumeration enumerateFiles(String pattern) - throws IOException - { - // Validate arguments. Note that we tolerate a null-valued 'filter'. - if (pattern == null) - throw new NullPointerException("pattern"); - - try { - return new IFSFileEnumeration(this, null, pattern); - } - catch (AS400SecurityException e) { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - //return null; // @B6d - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); // @B6a - } - } - - -// @D4A - /** - Lists the integrated file system objects in the directory represented by this - object that satisfy filter. The returned Enumeration contains an IFSFile - object for each file or directory in the list. The list is loaded incrementally, - which will improve initial response time for large lists. - - @param filter A file object filter. - - @return An Enumeration of IFSFile objects which represent the contents of the directory. - This Enumeration does not include the current directory or the parent - directory. If this object does not represent a directory, - this object represents an empty directory, or the filter does - not match any files, then an empty Enumeration is returned. The IFSFile object - passed to the filter object has cached file attribute information. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system, or the directory is not accessible. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public Enumeration enumerateFiles(IFSFileFilter filter) - throws IOException - { - try { - return new IFSFileEnumeration(this, filter, "*"); - } - catch (AS400SecurityException e) { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - // return null; // @B6d - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); // @B6a - } - } - - -// @D4A - /** - Lists the integrated file system objects in the directory represented by this - object. The returned Enumeration contains an IFSFile - object for each file or directory in the list. The list is loaded incrementally, - which will improve initial response time for large lists. - - @return An Enumeration of IFSFile objects which represent the contents of the directory. - This Enumeration does not include the current directory or the parent - directory. If this object does not represent a directory, - this object represents an empty directory, or the filter or pattern does - not match any files, then an empty Enumeration is returned. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system, or the directory is not accessible. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public Enumeration enumerateFiles() - throws IOException - { - try { - return new IFSFileEnumeration(this, null, "*"); - } - catch (AS400SecurityException e) { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - // return null; // @B6d - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); // @B6a - } - } - - - - /** - Determines if two IFSFile objects are equal. - @param obj The object with which to compare. - @return true if the path name and system names of the objects are equal; - false otherwise. - **/ - public boolean equals(Object obj) - { - if (obj == null || !(obj instanceof IFSFile)) // @A8C - return false; - - // Determine the system name and path name. - IFSFile target = (IFSFile) obj; - String targetPathName = target.getPath(); - AS400 targetSystem = target.getSystem(); - String targetSystemName = null; - if (targetSystem != null) - { - targetSystemName = targetSystem.getSystemName(); - } - - // @A8D - //return (system_ != null && targetSystemName != null && - // path_.equals(targetPathName) && - // system_.getSystemName().equals(targetSystemName)); - - // @A8A: - boolean result = true; - // It's OK for *neither* or *both* objects have system==null. - if (system_ == null) - result = (targetSystemName == null); - else - result = system_.getSystemName().equals(targetSystemName); - result = result && (path_.equals(targetPathName)); - return result; - } - -//internal exists that returns a return code status indicator - int exists0() - throws IOException, AS400SecurityException - { - // Assume the argument has been validated as non-null. - - if (impl_ == null) - chooseImpl(); - - return impl_.exists(); - } - - /** - Determines if the integrated file system object represented by this object exists. - @return true if the object exists; false if the object does not exist or is not accessible. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public boolean exists() - throws IOException - { - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - try - { - returnCode = exists0(); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); // @B6a - } - return (returnCode == IFSReturnCodeRep.SUCCESS); - } - - - - /** - Returns the path name of the integrated file system object represented by - this object. This is the full path starting at the root directory. - @return The absolute path name of this integrated file system object. - **/ - public String getAbsolutePath() - { - return path_; - } - - - /** - Returns the canonical pathname string of the integrated file system - object represented by this object. This is the full path starting - at the root directory. This typically involves removing redundant - names such as "." and ".." from the pathname. - Symbolic links are not resolved. - @return The canonical path name of this integrated file system object. - **/ - public String getCanonicalPath() - { - // Numerous changes added to remove DOT, DOTDOT, and multiple @D4A - // separator characters. Previously, this method simply @D4A - // returned path_ @D4A - StringBuffer pathBuffer = new StringBuffer(""); - String pathElem; - - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, " path_='"+path_+"'"); - - StringTokenizer st = new StringTokenizer(path_, separator); - - // Process each path element. - while (st.hasMoreTokens()) - { - pathElem = st.nextToken(); - - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, " pathElem='"+pathElem+"'"); - - if (pathElem.length() == 0) - { - // pathElem is empty... or is only the separator - // Nothing to add to pathBuffer... - } - else if (pathElem.equals(DOT)) - { - // Remove the "." from the path... copy nothing to pathBuffer. - } - else if (pathElem.equals(DOTDOT)) - { - // Remove last element of current canPath - int lastSepIndex = pathBuffer.lastIndexOf(separator); - if (lastSepIndex == -1) - { - // Can get here if too many DOT-DOTs which would result - // in trying to preceed the root directory.... - // Ignore this path element - } - else - { - // This will remove the last element of canPath - //(e.g. "/abc/xyz" will become "/abc") - pathBuffer.delete(lastSepIndex, pathBuffer.length()); - } - } - else - { - // Normal path element... so append it - pathBuffer.append(separator); - pathBuffer.append(pathElem); - } - } - - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, " pathBuffer.toString()='"+pathBuffer.toString()+"'"); - - if (pathBuffer.length() == 0) - { - // This is possible if original path_ contains nothing but DOTs and DOTDOTs - return(separator); - } - else - { - return(pathBuffer.toString()); - } - } - - - //@A9a - /** - Returns the file's data CCSID. All files in the system's integrated file system - are tagged with a CCSID. This method returns the value of that tag. - If the file is non-existent or is a directory, returns -1. - @return The file's CCSID. - @exception IOException If an error occurs while communicating with the system. - **/ - public int getCCSID() - throws IOException - { - int result = -1; - try - { - if (impl_ == null) - chooseImpl(); - - result = impl_.getCCSID(); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); - } - return result; - } - - - //@A6A - /** - * Returns the full path of the object. - * @return The full path of the object. - * - **/ - public String getFileSystem() - { - return getPath(); - } - - - - /** - Returns the amount of unused storage space that is available to the user. - @return The number of bytes of storage available to the user, or special value {@link Long#MAX_VALUE Long.MAX_VALUE} if the system reports "no maximum". - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public long getFreeSpace() - throws IOException - { - try - { - if (impl_ == null) - chooseImpl(); - - return impl_.getAvailableSpace(true); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); - } - } - - - /** - Returns the amount of unused storage space that is available to the user. - @param system The system of interest. - @return The number of bytes of storage available to the user, or special value {@link Long#MAX_VALUE Long.MAX_VALUE} if the system reports "no maximum". - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public static long getFreeSpace(AS400 system) - throws IOException - { - if (system == null) { - throw new NullPointerException("system"); - } - - try - { - IFSFileImpl impl = (IFSFileImpl) system.loadImpl2 - ("com.ibm.as400.access.IFSFileImplRemote", - "com.ibm.as400.access.IFSFileImplProxy"); - system.connectService(AS400.FILE); - impl.setSystem(system.getImpl()); - impl.setPath("/"); - return impl.getAvailableSpace(true); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(ExtendedIOException.ACCESS_DENIED); - } - } - - - - /** - Returns the amount of unused storage space that is available to the user. - Note: If the user profile has a "maximum storage allowed" setting of *NOMAX, then getAvailableSpace(true) returns the same value as getAvailableSpace(false). - @param forUserOnly Whether to report only the space for the user. If false, report space available in the entire file system. - @return The number of bytes of storage available. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - long getAvailableSpace(boolean forUserOnly) - throws IOException, AS400SecurityException - { - if (impl_ == null) - chooseImpl(); - - return impl_.getAvailableSpace(forUserOnly); - } - - - /** - Returns the total amount of storage space on the file system. - @param forUserOnly Whether to report only the space for the user. If false, report total space in the entire file system. - @return The total number of bytes on the file system. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - long getTotalSpace(boolean forUserOnly) - throws IOException, AS400SecurityException - { - if (impl_ == null) - chooseImpl(); - - return impl_.getTotalSpace(forUserOnly); - } - - IFSFileImpl getImpl() - throws IOException, AS400SecurityException - { - if (impl_ == null) - chooseImpl(); - return impl_; - } - - // Package scope getter methods to return data set by listFiles0() @D5A - // Number of objects returned by the File Server to listFiles0() and @D5A - // also the restartName and restartID info of the last object returned. @D5A - int getListFiles0LastNumObjsReturned() //@D5A - { //@D5A - return listFiles0LastNumObjsReturned_; //@D5A - } //@D5A - String getListFiles0LastRestartName() //@D5A - { //@D5A - if (listFiles0LastRestartName_ == null) //@D5A - return ""; //@D5A - else //@D5A - return listFiles0LastRestartName_; //@D5A - } //@D5A - byte[] getListFiles0LastRestartID() //@D5A - { //@D5A - return listFiles0LastRestartID_; //@D5A - } //@D5A - - - /** - Determines the name of the integrated file system object represented by this object. - @return The name (without directory components). - **/ - public String getName() - { - String name = null; - - // The name is everything after the last occurrence of the - // file separator character. - // (Unless quoted, e.g. /parent/"/filename", in which case the name is "/filename", quotes included.) - int index = path_.lastIndexOf(separatorChar); - if (index >= 0) - { - if (index < path_.length() - 1) - { - name = path_.substring(index + 1); - } - else - { - name = ""; - } - } - else - { - name = path_; - } - - // If name contains exactly 1 quote, and there's another quote earlier in the path, back up to the separator character before the prior quote. - int quoteIndex = name.indexOf('"'); - if (quoteIndex >= 0) // name includes at least 1 quote - { - if (quoteIndex == name.lastIndexOf('"')) // we only captured 1 quote - { - int priorQuoteIndex = path_.lastIndexOf('"', index); - if (priorQuoteIndex >= 0) // there's an earlier quote in path - { - int priorSeparatorIndex = path_.lastIndexOf(separatorChar, priorQuoteIndex); - if (priorSeparatorIndex >= 0) // there's a separator prior to 1st quote - { - name = path_.substring(priorSeparatorIndex+1); - } - else // no separator, so back up to beginning of path - { - name = path_; - } - } - } - } - - return name; - } - - - /** - Returns the name of the user profile that is the owner of the file. - @return The name of the user profile that owns the file, or "" if owner cannot be determined (for example, if the file is a directory). - - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ExtendedIOException If the file does not exist. - **/ - public String getOwnerName() - throws IOException, - AS400SecurityException - { - // Design note: The File Server doesn't support changing the owner name. - // It only supports retrieving it. Hence we do not provide a setOwnerName() method. - - if (impl_ == null) - chooseImpl(); - - return impl_.getOwnerName(); - } - - - // @C0a - /** - Returns the "user ID number" of the owner of the integrated file system file. - If the file is non-existent or is a directory, returns -1. - @return The file owner's ID number. - @exception IOException If an error occurs while communicating with the system. - **/ - public long getOwnerUID() - throws IOException - { - // Design note: It would be preferable if we could report the user profile name instead of UID number. However, the File Server doesn't report the user name. FYI: There is a service program (QSYPAPI/getpwuid()) that reports the user profile name associated with a given uid number, but getpwuid returns its results as a pointer to a struct, which our ServiceProgramCall class can't handle at the moment. - long result = -1L; - try - { - if (impl_ == null) - chooseImpl(); - - result = impl_.getOwnerUID(); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); - } - return result; - } - - - // @B7a - /** - Returns the "user ID number" of the owner of the integrated file system file. - If the file is non-existent or is a directory, returns -1. - @return The file owner's ID number. - @exception IOException If an error occurs while communicating with the system. - @deprecated Use getOwnerUID() instead. - **/ // @C0c - public int getOwnerId() - throws IOException - { - // Design note: It would be preferable if we could report the user profile name instead of UID number. However, the File Server doesn't report the user name. FYI: There is a service program (QSYPAPI/getpwuid()) that reports the user profile name associated with a given uid number, but getpwuid returns its results as a pointer to a struct, which our ServiceProgramCall class can't handle at the moment. - 1 Feb 2001 - int result = -1; - try - { - if (impl_ == null) - chooseImpl(); - - result = (int)impl_.getOwnerUID(); // @C0c - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); - } - return result; - } - - /** - Returns the path of the parent directory of the integrated file system object - represented by this object. The parent directory is everything in - the path name before the last occurrence of the separator character, - or null if the separator character does not appear in the path name. - @return The parent directory. - @see #getParentFile() - **/ - public String getParent() - { - return getParent(path_); // Note: path_ is never allowed to be null. - } - - - // Returns the parent directory of the file represented by this object. - static String getParent(String directory) - { - String parent = null; - - // The parent directory is everything in the pathname before - // the last occurrence of the file separator character. - if (!directory.equals(separator)) - { - if (directory.length() == 0) return null; - int index = directory.lastIndexOf(separatorChar); - if (index <= 0) - { - // This object is in the root. - parent = separator; - } - else if (index == directory.length() - 1) - { - // The path has a trailing separator, ignore it. - return getParent(directory.substring(0, directory.length() - 1)); - } - else - { - parent = directory.substring(0, index); - } - } - - return parent; - } - - /** - Returns the parent directory of the current object. - The parent is the path name before the - last occurrence of the separator character. - Null is returned if the separator character does not appear in the path, - or if the current object is the file system root. - If the system property is not yet set in the current object, - then the system property will not be set in the returned object. - - @return an IFSJavaFile object representing the - parent directory if one exists; null otherwise. - - @see #getParent() - **/ - public IFSFile getParentFile() - { - String parentPath = getParent(); - - if (parentPath == null) - return null; - - if (system_ == null) - { - IFSFile parent = new IFSFile(); - try { parent.setPath(parentPath); } - catch (PropertyVetoException e) { // will never happen - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - return parent; - } - - return new IFSFile(system_, parentPath); - } - - - /** - Returns the path of the integrated file system object represented by this object. - @return The integrated file system path name. - **/ - public String getPath() - { - return path_; - } - - - /** - Returns the path of the integrated file system object that is directly pointed to by the symbolic link represented by this object; or null if the file is not a symbolic link or does not exist. -

    - This method is not supported for files in the following file systems: -

      -
    • QSYS.LIB -
    • Independent ASP QSYS.LIB -
    • QDLS -
    • QOPT -
    • QNTC -
    - - @return The path directly pointed to by the symbolic link, or null if the IFS object is not a symbolic link or does not exist. Depending on how the symbolic link was defined, the path may be either relative or absolute. - - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getPathPointedTo() - throws IOException, AS400SecurityException - { - // See if we've already determined that the file isn't a symbolic link. - if (cachedAttributes_ != null && !isSymbolicLink_) return null; - - if (impl_ == null) - chooseImpl(); - - return impl_.getPathPointedTo(); - } - - - /** - Returns the pattern-matching behavior used when files are listed by any of the list() or listFiles() methods. The default is PATTERN_POSIX. - @return Either {@link #PATTERN_POSIX PATTERN_POSIX}, {@link #PATTERN_POSIX_ALL PATTERN_POSIX_ALL}, or {@link #PATTERN_OS2 PATTERN_OS2} - @see #setPatternMatching(int) - **/ - public int getPatternMatching() - throws IOException - { - return patternMatching_; - } - - - // @A6A - /** - * Returns the permission of the object. - * @return The permission of the object. - * @see #setPermission - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnknownHostException If the system cannot be located. - * - **/ - public Permission getPermission() - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException, - UnsupportedEncodingException - - { - if (permission_ == null) - { - permission_ = new Permission(this); - } - return permission_; - } - - -// @C3a - // Returns the Restart ID associated with the file, or null if no attributes have been cached. - byte[] getRestartID() - { - if (cachedAttributes_ != null) - { - return cachedAttributes_.getRestartID(); - } - else - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, - "IFSFile.getRestartID() was called when cachedAttributes_==null."); - return null; - } - } - - -// @B5a - /** - Returns the subtype of the integrated file system object represented by this object. Some possible values that might be returned include:
    - CMNF, DKTF, DSPF, ICFF, LF, PF, PRTF, SAVF, TAPF.
    - Note that many file system objects do not have a subtype: for example, - .MBR objects, and any Root, QOpenSys or UDFS object. -
    Returns a zero-length string if the object has no subtype. - @return The subtype of the object. - - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception AS400SecurityException If a security or authority error occurs. - **/ - public String getSubtype() - throws IOException, AS400SecurityException - { - if (subType_ == null) - { - if (impl_ == null) - { - chooseImpl(); - } - subType_ = impl_.getSubtype(); - } - return subType_; - } - - - /** - Determines if the file is an IBM i "source physical file". - Physical files reside under QSYS, and can be either source files (type *SRC) or data files (type *DATA). - For further information, refer to the specification of the QDBRTVFD (Retrieve Database File Description) API. - @return Whether the file is a source file. - - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @see AS400File#TYPE_SOURCE - @see AS400File#TYPE_DATA - **/ - public boolean isSourcePhysicalFile() - throws AS400Exception, AS400SecurityException, IOException - { - if (!path_.endsWith(".FILE") || - path_.indexOf("/QSYS.LIB") == -1 || - !getSubtype().equals("PF")) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Not a physical file."); - return false; - } - - return impl_.isSourcePhysicalFile(); - } - - - /** - Returns the system that this object references. - @return The system object. - **/ - public AS400 getSystem() - { - return system_; - } - - /** - Computes a hash code for this object. - @return A hash code value for this object. - **/ - public int hashCode() - { - // @A3 - We need to be about to compute a hash code even when - // the path is not set. This ends up getting called - // when serializing the object via MS Internet Explorer. - // As a result, we were not able to serialize an object - // unless its path was set. - // - // I commented out this chunk of code: - // - // // Ensure that the path name is set. - // if (path_.length() == 0) - // { - // throw new ExtendedIllegalStateException("path", - // ExtendedIllegalStateException.PROPERTY_NOT_SET); - // } - - return path_.hashCode(); - } - - /** - Provided to initialize transient data if this object is de-serialized. - **/ - private void initializeTransient() - { - changes_ = new PropertyChangeSupport(this); - vetos_ = new VetoableChangeSupport(this); - fileListeners_ = new Vector(); - - cachedAttributes_ = null; - impl_ = null; - } - - /** - Determines if the path name of this integrated file system object is an - absolute path name. - @return true if the path name specification is absolute; false otherwise. - **/ - public boolean isAbsolute() - { - // Ensure that the path name is set. - if (path_.length() == 0) - { - throw new ExtendedIllegalStateException("path", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - return (path_.length() > 0 && path_.charAt(0) == '/'); - } - -//internal isDirectory that returns a return code status indicator - int isDirectory0() - throws IOException, AS400SecurityException - { - //@A7A Added check for cached attributes. - if (cachedAttributes_ != null) - { - if (isDirectory_) - return IFSReturnCodeRep.SUCCESS; - else - return IFSReturnCodeRep.FILE_NOT_FOUND; - } - else - { - if (impl_ == null) - chooseImpl(); - - return impl_.isDirectory(); - } - } - - /** - Determines if the integrated file system object represented by this object is a - directory. -
    Both isDirectory() and {@link #isFile() isFile} will return false - for invalid symbolic links. - - @return true if the integrated file system object exists and is a directory; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public boolean isDirectory() - throws IOException - { - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - try - { - returnCode = isDirectory0(); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - // returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; //@A7D Unnecessary assignment. - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); // @B6a - } - return (returnCode == IFSReturnCodeRep.SUCCESS); - } - -//internal isFile that returns a return code status indicator - int isFile0() - throws IOException, AS400SecurityException - { - //@A7A Added check for cached attributes. - if (cachedAttributes_ != null) - { - if (isFile_) - return IFSReturnCodeRep.SUCCESS; - else - return IFSReturnCodeRep.FILE_NOT_FOUND; - } - else - { - if (impl_ == null) - chooseImpl(); - - return impl_.isFile(); - } - } - - /** - Determines if the integrated file system object represented by this object is a - "normal" file. -
    A file is "normal" if it is not a directory or a container of other objects.
    - Both {@link #isDirectory() isDirectory} and isFile() will return false - for invalid symbolic links. - - @return true if the specified file exists and is a "normal" file; false otherwise. - - @see #isSymbolicLink() - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public boolean isFile() - throws IOException - { - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - try - { - returnCode = isFile0(); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - // returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; //@A7D Unnecessary assignment. - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); // @B6a - } - return (returnCode == IFSReturnCodeRep.SUCCESS); - } - - /** - Determines if the integrated file system object represented by this object is hidden. - - @return true if the hidden attribute of this integrated file system object - is set; false otherwise. - - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - // @D1 - new method because of changes to java.io.File in Java 2. - public boolean isHidden() - throws IOException, AS400SecurityException - { - // If the attributes are cached from an earlier listFiles() operation - // use the cached attributes instead of getting a new set from the system. - if (cachedAttributes_ != null) - return (cachedAttributes_.getFixedAttributes() & - IFSCachedAttributes.FA_HIDDEN) != 0; - //@D2C - Changed IFSListAttrsRep to IFSCached Attributes - else - { - if (impl_ == null) - chooseImpl(); - - return impl_.isHidden(); - } - } - - /** - Determines if the integrated file system object represented by this object is a - symbolic link. -
    Note: Both {@link #isDirectory() isDirectory} and {@link #isFile() isFile} resolve symbolic links to their ultimate destination. For example, if this object represents a symbolic link on the system, that resolves to a file object, then isSymbolicLink() will return true, isFile() will return true, and isDirectory() will return false. -
    Note: If the system is V5R2 or earlier, this method always returns false, regardless of whether the system object is a link or not. - - @return true if the specified file exists and is a symbolic link; false otherwise. -
    If the system is V5R2 or earlier, this method always returns false. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public boolean isSymbolicLink() - throws IOException, AS400SecurityException - { - if (cachedAttributes_ != null) { - return isSymbolicLink_; - } - else - { - if (impl_ == null) - chooseImpl(); - - return impl_.isSymbolicLink(); - } - } - - - /** - Determines if the integrated file system object represented by this object is read only. - - @return true if the read only attribute of this integrated file system object - is set; false otherwise. - - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - // @D1 - new method because of changes to java.io.File in Java 2. - public boolean isReadOnly() - throws IOException, AS400SecurityException - { - // If the attributes are cached from an earlier listFiles() operation - // use the cached attributes instead of getting a new set from the system. - if (cachedAttributes_ != null) - return (cachedAttributes_.getFixedAttributes() & - IFSCachedAttributes.FA_READONLY) != 0; - //@D2C - Changed IFSListAttrsRep to IFSCached Attributes - else - { - if (impl_ == null) - chooseImpl(); - - return impl_.isReadOnly(); - } - } - - - /** - Returns the sorting behavior used when files are listed by any of the list() or listFiles() methods. - @return true if lists of files are returned in sorted order; false otherwise. - **/ - public boolean isSorted() - throws IOException - { - return sortLists_; - } - - - /** - Determines the time that the integrated file system object represented by this - object was last accessed. With the use of the {@link #listFiles() listFiles} methods, attribute - information is cached and will not be automatically refreshed from the system. - This means the reported last accessed time may become inconsistent with the system. - @return The time (measured in milliseconds since 01/01/1970 00:00:00 GMT) - that the integrated file system object was last accessed, or 0L if - the object does not exist or is not accessible. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public long lastAccessed() //D3a - throws IOException //D3a - { //D3a - try //D3a - { //D3a - //@A7A Added check for cached attributes. //@D3a - if (cachedAttributes_ != null) //@D3a - { //@D3a - return cachedAttributes_.getAccessDate(); //@D3a - } //@D3a - else //@D3a - { //@D3a - if (impl_ == null) //@D3a - chooseImpl(); //@D3a - //@D3a - return impl_.lastAccessed(); //@D3a - } //@D3a - } //D3a - catch (AS400SecurityException e) //D3a - { //D3a - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); //D3a - //return 0L; //D3a @B6d - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); // @B6a - } //D3a - } //D3a - - - - - -//internal lastModified that throws a security exception - long lastModified0() - throws IOException, AS400SecurityException - { - //@A7A Added check for cached attributes. - if (cachedAttributes_ != null) - { - return cachedAttributes_.getModificationDate(); - } - else - { - if (impl_ == null) - chooseImpl(); - - return impl_.lastModified(); - } - } - - /** - Determines the time that the integrated file system object represented by this - object was last modified. With the use of the {@link #listFiles() listFiles} methods, attribute - information is cached and will not be automatically refreshed from the system. - This means the reported last modified time may become inconsistent with the system. - @return The time (measured in milliseconds since 01/01/1970 00:00:00 GMT) - that the integrated file system object was last modified, or 0L if it does not exist - or is not accessible. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public long lastModified() - throws IOException - { - try - { - return lastModified0(); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - //return 0L; // @B6d - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); // @B6a - } - } - -//internal length that throws a security exception - long length0() - throws IOException, AS400SecurityException - { - //@A7A Added check for cached attributes. - if (cachedAttributes_ != null) - { - return cachedAttributes_.getSize(); - } - else - { - if (impl_ == null) - chooseImpl(); - - return impl_.length(); - } - } - - /** - Determines the length of the integrated file system object represented by this - object. With the use of the {@link #listFiles() listFiles} methods, attribute - information is cached and will not be automatically refreshed from the system. - This means the reported length may become inconsistent with the system. - @return The length, in bytes, of the integrated file system object, or - 0L if it does not exist or is not accessible. -
    Note: When used following {@link #listFiles() listFiles} or - {@link #enumerateFiles() enumerateFiles} methods (for symbolic link objects) - this method will return the length of the symbolic link object as returned by the File Server. - In order to retrieve the length of the target object, you must use - {@link #clearCachedAttributes() clearCachedAttributes()} followed by {@link #length() length()}. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public long length() - throws IOException - { - try - { - return length0(); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - // return 0L; // @B6d - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); // @B6a - } - } - - /** - Lists the integrated file system objects in the directory represented by this object. - - @return An array of object names in the directory. This list does not - include the current directory or the parent directory. If this object - does not represent a directory, null is returned. If this object represents - an empty directory, an empty string array is returned. -
    Note: Due to a limitation in the File Server, at most 65,535 files will be listed. - - @see #listFiles() - @see #setPatternMatching(int) - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system, or the directory is not accessible. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public String[] list() - throws IOException - { - return list("*"); - } - - /** - Lists the integrated file system objects in the directory represented by this - object that satisfy filter. - @param filter A file object filter. If null, then no filtering is done. - @return An array of object names in the directory that satisfy the filter. This - list does not include the current directory or the parent directory. If this - object does not represent a directory, null is returned. If this object - represents an empty directory, or the filter does not match any files, - an empty string array is returned. The IFSFile object passed to the filter - object have cached file attribute information. Maintaining references to - these IFSFile objects after the list operation increases the chances that - their file attribute information will not be valid. -
    Note: Due to a limitation in the File Server, at most 65,535 files will be listed. - - @see #listFiles(IFSFileFilter) - @see #setPatternMatching(int) - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system or the directory is not accessible. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public String[] list(IFSFileFilter filter) - throws IOException - { // @A5D Removed null filter check (null means no filtering) - return list(filter, "*"); - } - - - /** - Lists the integrated file system objects in the directory represented by this object - that satisfy filter. - @param filter A file object filter. - @param pattern The pattern that all filenames must match. - Acceptable characters are wildcards (*) and question marks (?). - **/ - String[] list0(IFSFileFilter filter, String pattern) - throws IOException, AS400SecurityException - { // @A5D removed check for null filter (null means no filtering). - // Ensure that we are connected to the system. - if (impl_ == null) - chooseImpl(); - - // Assume that the 'pattern' argument has been validated as non-null. - // Note that we tolerate a null-valued 'filter' argument. - - // List the attributes of all files in this directory. Have to append - // a file separator and * to the path so that all files in the - // directory are returned. - String directory = path_; - if (directory.lastIndexOf(separatorChar) != directory.length() - 1) - { - // Add a separator character. - directory = directory + separatorChar; - } - String[] allNames = impl_.listDirectoryContents(directory + pattern); - - // Add the name for each reply that matches the filter to the array - // of names. - - // @A1C - // Changed the behavior of the list() to conform to that of the JDK1.1.x - // so that a NULL is returned if and only if the directory or file represented - // by this IFSFile object doesn't exist. - // - // Original code: - // if (replys != null && replys.size() != 0) - String[] names = null; - if (allNames != null) - { - names = new String[allNames.length]; - int j = 0; - for (int i = 0; i < allNames.length; i++) - { - String name = allNames[i]; - boolean addThisOne = false; - if (!(name.equals(".") || name.equals(".."))) - { - addThisOne = false; // Broke up this "double if" check to avoid constructing - if (filter == null) // the IFSFile object when there is no filter specified. - { - addThisOne = true; - } else - { - IFSFile file = new IFSFile(system_, directory, name); - if (filter.accept(file)) - { - addThisOne = true; - } - } - if (addThisOne == true) // Specified the add in only one place to avoid confusion - { // over how many add sequences actually take place. - names[j++] = name; - } - } - } - - if (j == 0) - { - // @A1C - // - // Original code: - // names = null; - names = new String[0]; // @A1C - } - else if (names.length != j) - { - // Copy the names to an array of the exact size. - String[] newNames = new String[j]; - System.arraycopy(names, 0, newNames, 0, j); - names = newNames; - } - } - - return names; - } - - /** - Lists the integrated file system objects in the directory represented by this - object that satisfy filter. - @param filter A file object filter. - @param pattern The pattern that all filenames must match. Acceptable characters - are wildcards (*) and - question marks (?). - @return An array of object names in the directory that satisfy the filter - and pattern. This list does not include the current directory or the parent - directory. If this object does not represent a directory, null is returned. - If this object represents an empty directory, or the filter or pattern does - not match any files, an empty string array is returned. The IFSFile object - passed to the filter object have cached file attribute information. - Maintaining references to these IFSFile objects after the list operation - increases the chances that their file attribute information will not be valid. -
    Note: Due to a limitation in the File Server, at most 65,535 files will be listed. - - @see #listFiles(IFSFileFilter,String) - @see #setPatternMatching(int) - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system or the directory is not accessible. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public String[] list(IFSFileFilter filter, - String pattern) - throws IOException - { - // Validate arguments. Note that we tolerate a null-valued 'filter'. - if (pattern == null) - throw new NullPointerException("pattern"); - - try - { - return list0(filter, pattern); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - // return null; // @B6d - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); // @B6a - } - } - - /** - Lists the integrated file system objects in the directory represented - by this object that match pattern. - @param pattern The pattern that all filenames must match. Acceptable - characters are wildcards (*) and - question marks (?). - @return An array of object names in the directory that match the pattern. - This list does not include the current directory or the parent directory. - If this object does not represent a directory, null is returned. If - this object represents an empty directory, or the pattern does not - match any files, an empty string array is returned. -
    Note: Due to a limitation in the File Server, at most 65,535 files will be listed. - - @see #listFiles(String) - @see #setPatternMatching(int) - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system, or the directory is not accessible. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public String[] list(String pattern) - throws IOException - { - return list(null, pattern); - } - - //@A7A Added function to return an array of files in a directory. - /** - Lists the integrated file system objects in the directory represented by this object. With the use of this method, attribute information is cached and will not be automatically refreshed from the system. This means that retrieving attribute information for files returned in the list is much faster than using the {@link #list() list} method, but attribute information may become inconsistent with the system. -

    - When the IFSFile object represents the root of the QSYS file system, this method may return a partial list of the contents of the directory. - - @return An array of objects in the directory. This list does not - include the current directory or the parent directory. If this - object does not represent a directory, or this object represents - an empty directory, an empty object array is returned. -
    Note: Due to a limitation in the File Server, at most 65,535 files will be listed. - - @see #setPatternMatching(int) - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system, or the directory is not accessible. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public IFSFile[] listFiles() - throws IOException - { - return listFiles((IFSFileFilter)null, "*"); - } - - - //@A7A Added function to return an array of files in a directory. - /** - Lists the integrated file system objects in the directory represented by this object that satisfy filter. With the use of this method, attribute information is cached and will not be automatically refreshed from the system. This means that retrieving attribute information for files returned in the list is much faster than using the {@link #list(IFSFileFilter) list} method, but attribute information may become inconsistent with the system. -

    - When the IFSFile object represents the root of the QSYS file system, this method may return a partial list of the contents of the directory. - - @param filter A file object filter. - @return An array of objects in the directory. This list does not - include the current directory or the parent directory. If this - object does not represent a directory, or this - object represents an empty directory, an empty object array is returned. -
    Note: Due to a limitation in the File Server, at most 65,535 files will be listed. - - @see #setPatternMatching(int) - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system, or the directory is not accessible. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public IFSFile[] listFiles(IFSFileFilter filter) - throws IOException - { - return listFiles(filter, "*"); - } - - - //@A7A Added function to return an array of files in a directory. - /** - Lists the integrated file system objects in the directory represented by this object that satisfy filter. With the use of this method, attribute information is cached and will not be automatically refreshed from the system. This means that retrieving attribute information for files returned in the list is much faster than using the {@link #list(IFSFileFilter,String) list} method, but attribute information may become inconsistent with the system. -

    - When pattern is "*" and the IFSFile object represents the root of the QSYS file system, this method may return a partial list of the contents of the directory. - - @param filter A file object filter. - @param pattern The pattern that all filenames must match. Acceptable - characters are wildcards (*) and - question marks (?). - @return An array of object names in the directory that satisfy the filter - and pattern. This list does not include the current directory or the parent - directory. If this object does not represent a directory, this object represents an empty directory, or the filter or pattern does - not match any files, an empty object array is returned. The IFSFile object - passed to the filter object has cached file attribute information. Maintaining - references to these IFSFile objects after the list operation increases the - chances that their file attribute information will not be valid. -
    Note: Due to a limitation in the File Server, at most 65,535 files will be listed. - - @see #setPatternMatching(int) - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system, or the directory is not accessible. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public IFSFile[] listFiles(IFSFileFilter filter, String pattern) - throws IOException - { - // Validate arguments. Note that we tolerate a null-valued 'filter'. - if (pattern == null) - throw new NullPointerException("pattern"); - - try - { - return listFiles0(filter, pattern, -1, (String)null, (byte[])null, true); // @D4C @C3C @D7C - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - // return null; // @B6d - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); // @B6a - } - } - - - //@A7A Added function to return an array of files in a directory. - /** - Lists the integrated file system objects in the directory represented by this object that match pattern. With the use of this method, attribute information is cached and will not be automatically refreshed from the system. This means that retrieving attribute information for files returned in the list is much faster than using the {@link #list(String) list} method, but attribute information may become inconsistent with the system. -

    - When pattern is "*" and the IFSFile object represents the root of the QSYS file system, this method may return a partial list of the contents of the directory. - - @param pattern The pattern that all filenames must match. Acceptable characters - are wildcards (*) and - question marks (?). - @return An array of object names in the directory that match the pattern. This - list does not include the current directory or the parent directory. If this - object does not represent a directory, this object - represents an empty directory, or the pattern does not match any files, - an empty object array is returned. -
    Note: Due to a limitation in the File Server, at most 65,535 files will be listed. - - @see #setPatternMatching(int) - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system, or the directory is not accessible. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public IFSFile[] listFiles(String pattern) - throws IOException - { - return listFiles((IFSFileFilter)null, pattern); - } - - //@A7A Added function to return an array of files in a directory. - //@C3c Moved logic to new private method. - /** - Lists the integrated file system objects in the directory represented by this - object that satisfy filter. With the use of this method, attribute - information is cached and will not be automatically refreshed from the system. - This means attribute information may become inconsistent with the system. - @param filter A file object filter. - @param pattern The pattern that all filenames must match. - @param maxGetCount The maximum number of directory entries to retrieve. - -1 indicates that all entries that match the search criteria should be retrieved. - @param restartName The file name from which to start the search. - If null, the search is started at the beginning of the list. - Acceptable characters are wildcards (*) and question marks (?). - **/ - IFSFile[] listFiles0(IFSFileFilter filter, String pattern, int maxGetCount, String restartName) // @D4C - throws IOException, AS400SecurityException - { - return listFiles0(filter, pattern, maxGetCount, restartName, null, true); //@D7C - } - - //@C3a Relocated logic from original listFiles0 method. - /** - Lists the integrated file system objects in the directory represented by this - object that satisfy filter. With the use of this method, attribute - information is cached and will not be automatically refreshed from the system. - This means attribute information may become inconsistent with the system. - @param filter A file object filter. - @param pattern The pattern that all filenames must match. - Acceptable characters are wildcards (*) and question marks (?). - **/ - private IFSFile[] listFiles0(IFSFileFilter filter, String pattern, int maxGetCount, String restartName, - byte[] restartID, boolean allowSortedRequests) // @D4C @D7C - throws IOException, AS400SecurityException - { - // Do not specify both restartName and restartID. Specify one or the other. - - // Ensure that we are connected to the system. - if (impl_ == null) - chooseImpl(); - - // Assume that the 'pattern' argument has been validated as non-null. - // Note that we tolerate a null-valued 'filter' argument. - - // List the attributes of all files in this directory. Have to append - // a file separator and * to the path so that all files in the - // directory are returned. - String directory = path_; - if (directory.lastIndexOf(separatorChar) != directory.length() - 1) - { - // Add a separator character. - directory = directory + separatorChar; - } - IFSCachedAttributes[] fileAttributeList; //@C3C - if (restartName != null) { - fileAttributeList = impl_.listDirectoryDetails(directory + pattern, directory, maxGetCount, restartName); //@D2C @D4C - } - else { - fileAttributeList = impl_.listDirectoryDetails(directory + pattern, directory, maxGetCount, restartID,allowSortedRequests); //@C3a @D7C - } - - // Add the name for each reply that matches the filter to the array - // of files. - - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "IFSFile::listFile0(): returned ("+listFiles0LastNumObjsReturned_+") pre objects"); - if (fileAttributeList == null) - { - return new IFSFile[0]; - } - else - { - // Save number of objects read, restartname, and restartID @D5A - listFiles0LastNumObjsReturned_ = fileAttributeList.length; // @D5A - - IFSFile[] files = new IFSFile[fileAttributeList.length]; - - if (fileAttributeList.length > 0) - { - IFSFile lastFile = new IFSFile(system_, fileAttributeList[fileAttributeList.length - 1]); - - // Save the last restartName and restartID from the files @D5A - // returned from the server (to be used for subsequent reads) @D5A - listFiles0LastRestartName_ = lastFile.getName(); // @D5A - listFiles0LastRestartID_ = lastFile.getRestartID(); // @D5A - } - - int j = 0; - for (int i = 0; i < fileAttributeList.length; i++) { - IFSFile file = new IFSFile(system_, fileAttributeList[i]); //@D2C - if (filter == null || filter.accept(file)) //@D2C - { - files[j++] = file; //@D2C - } - } - - if (j == 0) - { - files = new IFSFile[0]; - } - else if (files.length != j) - { - // Copy the objects to an array of the exact size. - IFSFile[] newFiles = new IFSFile[j]; - System.arraycopy(files, 0, newFiles, 0, j); - files = newFiles; - } - - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "IFSFile::listFile0(): returned ("+files.length+") post objects"); - return files; - } - } - - //@C3a - IFSFile[] listFiles0(IFSFileFilter filter, String pattern, int maxGetCount, byte[] restartID) - throws IOException, AS400SecurityException - { - // This method is only called by IFSEnumeration() which reads 128 objects at a time. @D7A - // The IFS file server does not allow "sort" and "restart ID" to be set in the same server request. - // Therefore, since the user may have previously called setSorted(), we need to inform - // IFSFileImplRemote to not allow sorting on this server request. The last parameter - // indicates "allowSortedRequests" and is set to "false" - return listFiles0(filter, pattern, maxGetCount, null, restartID, false); //@D7C - } - - //@C3a - IFSFile[] listFiles0(IFSFileFilter filter, String pattern) - throws IOException, AS400SecurityException - { - return listFiles0(filter, pattern, -1, null, null, true); //@D7C - } - - -//internal mkdir that returns return codes and throws exceptions. - int mkdir0(String directory) - throws IOException, AS400SecurityException - { - // Assume the argument has been validated as non-null. - - if (impl_ == null) - chooseImpl(); - - return impl_.mkdir(directory); - } - - /** Creates an integrated file system directory whose path name is - specified by this object. - - @return true if the directory was created; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public boolean mkdir() - throws IOException - { - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - try - { - returnCode = mkdir0(path_); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); - } - - return (returnCode == IFSReturnCodeRep.SUCCESS); - } - -//internal mkdirs that returns return codes and throws exceptions - int mkdirs0() - throws IOException, AS400SecurityException - { - if (impl_ == null) - chooseImpl(); - - return impl_.mkdirs(); - } - - /** - Creates an integrated file system directory whose path name is - specified by this object. In addition, create all parent directories as necessary. - - @return true if the directory (or directories) were created; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public boolean mkdirs() - throws IOException - { - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - try - { - returnCode = mkdirs0(); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - // returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; //@A7D Unnecessary assignment. - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); // @B6a - } - return (returnCode == IFSReturnCodeRep.SUCCESS); - } - - /** - Restores the state of this object from an object input stream. - @param ois The stream of state information. - @exception IOException - @exception ClassNotFoundException - **/ - private void readObject(java.io.ObjectInputStream ois) - throws IOException, ClassNotFoundException - { - // Restore the non-static and non-transient fields. - ois.defaultReadObject(); - - // Initialize the transient fields. - initializeTransient(); - } - - /** - Removes a file listener so that it no longer receives file events from - this IFSFile. - @param listener The file listener. - **/ - public void removeFileListener(FileListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - fileListeners_.removeElement(listener); - } - - /** - Removes a property change listener. - @param listener The property change listener to remove. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - changes_.removePropertyChangeListener(listener); - } - - /** - Removes a vetoable change listener. - @param listener The vetoable change listener to remove. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - vetos_.removeVetoableChangeListener(listener); - } - - -//internal renameTo that returns an error code - int renameTo0(IFSFile file) - throws IOException, PropertyVetoException, AS400SecurityException - { - // Assume the argument has been validated as non-null. - - if (impl_ == null) - chooseImpl(); - - String targetPath = file.getAbsolutePath(); - if (targetPath.length() == 0) - { - throw new ExtendedIllegalStateException("path", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Fire a vetoable change event. - vetos_.fireVetoableChange("path", path_, file.getAbsolutePath()); - - // Rename the file. - int rc = impl_.renameTo(file.getImpl()); - - if (rc == IFSReturnCodeRep.SUCCESS) - { - String oldPath = path_; - path_ = file.getAbsolutePath(); - - // Fire the property change event having null as the name to - // indicate that the path, parent, etc. have changed. - changes_.firePropertyChange("path", oldPath, path_); - - // Clear any cached attributes. - cachedAttributes_ = null; //@A7a - } - - return rc; - } - - /** - Renames the integrated file system object specified by this object to - have the path name of file. Wildcards are not permitted in this file name. - @param file The new file name. - - @return true if successful; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception PropertyVetoException If the change is vetoed. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public boolean renameTo(IFSFile file) - throws IOException, PropertyVetoException - { - // Validate the argument. - if (file == null) - throw new NullPointerException("file"); - - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - try - { - returnCode = renameTo0(file); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - // returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; //@A7D Unnecessary assignment. - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); // @B6a - } - return (returnCode == IFSReturnCodeRep.SUCCESS); - } - - - /** - Sets the access mode of the integrated file system object. - This method is supported for IBM i V5R1 and higher. For older releases, it does nothing and returns false. - @param accessType The type of access to set on the file. Valid values are: -

      -
    • {@link #ACCESS_READ ACCESS_READ} -
    • {@link #ACCESS_WRITE ACCESS_WRITE} -
    • {@link #ACCESS_EXECUTE ACCESS_EXECUTE} -
    - @param accessMode If true, sets the access permission to allow the specified type of operation; if false, to disallow the operation. - @param ownerOnly If true, the specified permission applies only to the owner's permission; otherwise, it applies to everybody. - @return true if successful; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - boolean setAccess(int accessType, boolean enableAccess, boolean ownerOnly) - throws IOException, AS400SecurityException - { - // Note: The called API (QlgChmod) is supported for V5R1 and higher. - // The impl object will check the VRM. - - if (accessType != ACCESS_READ && accessType != ACCESS_WRITE && accessType != ACCESS_EXECUTE) - { - throw new ExtendedIllegalArgumentException("accessType ("+accessType+")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (impl_ == null) - chooseImpl(); - - return impl_.setAccess(accessType, enableAccess, ownerOnly); - } - - - /** - Sets the file's data CCSID. - @param ccsid The file data CCSID. Note that the data in the file is not changed; only the CCSID "tag" on the file is changed. - @return true if successful; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system, or if the file doesn't exist or is a directory. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public boolean setCCSID(int ccsid) - throws IOException - { - boolean success = false; - try - { - if (impl_ == null) chooseImpl(); - success = impl_.setCCSID(ccsid); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); - } - - if (success) - { - // Fire the file modified event. - if (fileListeners_.size() != 0) { - IFSFileDescriptor.fireModifiedEvents(this, fileListeners_); - } - } - return success; - } - - - - /** - Changes the fixed attributes (read only, hidden, etc.) of the integrated - file system object - represented by this object to attributes. - @param attributes The attributes to set on the file. These attributes are not - ORed with existing attributes. They replace the existing - fixed attributes of the file. The attributes are a bit map as - follows -
      -
    • 0x0001: on = file is a readonly file -
    • 0x0002: on = file is a hidden file -
    • 0x0004: on = file is a system file -
    • 0x0010: on = file is a directory -
    • 0x0020: on = file has been changed (archive bit) -
    - For example, 0x0023 is a readonly, hidden file with the - archive bit on. - @return true if successful; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - // @D1 - new method because of changes to java.io.File in Java 2. - boolean setFixedAttributes(int attributes) - throws IOException - { - // Validate arguments. - if ((attributes & 0xFFFFFF00) != 0) - { - throw new ExtendedIllegalArgumentException("attributes ("+attributes+")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - try - { - if (impl_ == null) - chooseImpl(); - - boolean success = impl_.setFixedAttributes(attributes); - - if (success) - { - cachedAttributes_ = null; - } - - return success; - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); - } - } - - /** - Marks the integrated file system object represented by this object as hidden. - @return true if successful; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - // @D1 - new method because of changes to java.io.File in Java 2. - public boolean setHidden() - throws IOException - { - return setHidden(true); - } - - - /** - Changes the hidden attribute of the integrated file system object - represented by this object. - @param attribute True to set the hidden attribute of the file. - False to turn off the hidden attribute. - - @return true if successful; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - // @D1 - new method because of changes to java.io.File in Java 2. - public boolean setHidden(boolean attribute) - throws IOException - { - try - { - if (impl_ == null) - chooseImpl(); - - boolean success = impl_.setHidden(attribute); - - if (success) - { - cachedAttributes_ = null; - - // Fire the file modified event. - if (fileListeners_.size() != 0) { - IFSFileDescriptor.fireModifiedEvents(this, fileListeners_); - } - } - return success; - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); - } - } - - - /** - Changes the last modified time of the integrated file system object - represented by this object to time. - @param time The desired last modification time (measured in milliseconds - since January 1, 1970 00:00:00 GMT), or 0 to leave the last modification - time unchanged, or -1 to set the last modification time to the current system time. - - @return true if successful; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - @exception PropertyVetoException If the change is vetoed. - **/ - public boolean setLastModified(long time) - throws IOException, PropertyVetoException - { - // Fire a vetoable change event for lastModified. - vetos_.fireVetoableChange("lastModified", null, new Long(time)); - - try - { - return setLastModified0(time); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); - } - } - - - /** - Changes the last modified time of the integrated file system object - represented by this object to time. - @param time The desired last modification time (measured in milliseconds - since January 1, 1970 00:00:00 GMT), or 0 to leave the last modification - time unchanged, or -1 to set the last modification time to the current system time. - - @return true if successful; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - @exception PropertyVetoException If the change is vetoed. - **/ - boolean setLastModified0(long time) - throws IOException, AS400SecurityException - { - // Validate arguments. - if (time < -1) // @B8c - { - throw new ExtendedIllegalArgumentException("time (" + - Long.toString(time) + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (impl_ == null) - chooseImpl(); - - boolean success = impl_.setLastModified(time); - - if (success) - { - // Fire the property change event. - changes_.firePropertyChange("lastModified", null, new Long(time)); - - // Fire the file modified event. - if (fileListeners_.size() != 0) { - IFSFileDescriptor.fireModifiedEvents(this, fileListeners_); - } - - // Clear any cached attributes. - cachedAttributes_ = null; //@A7a - } - - return success; - } - - // @B8a - /** - Sets the length of the integrated file system object represented by this object. The file can be made larger or smaller. If the file is made larger, the contents of the new bytes of the file are undetermined. - @param length The new length, in bytes. - @return true if successful; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public boolean setLength(int length) - throws IOException - { - try - { - return setLength0(length); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); - } - } - - // @B8a - /** - Sets the length of the integrated file system object represented by this object. The file can be made larger or smaller. If the file is made larger, the contents of the new bytes of the file are undetermined. - @param length The new length, in bytes. - @return true if successful; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - boolean setLength0(int length) - throws IOException, AS400SecurityException - { - // Validate arguments. - if (length < 0) - { - throw new ExtendedIllegalArgumentException("length (" + - Integer.toString(length) + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - // Note: The file system will not allow us to set the length of a file to a value larger than (2Gig minus 1), or 2147483647 (0x7FFFFFFF) bytes, which happens to be the maximum positive value which an 'int' will hold. Therefore we do not provide a setLength(long) method. - - if (impl_ == null) - chooseImpl(); - - boolean success = impl_.setLength(length); - - if (success) - { - // Fire the file modified event. - if (fileListeners_.size() != 0) { - IFSFileDescriptor.fireModifiedEvents(this, fileListeners_); - } - - // Clear any cached attributes. - cachedAttributes_ = null; - } - - return success; - } - - /** - Sets the file path. - @param path The absolute file path. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setPath(String path) - throws PropertyVetoException - { - if (path == null) - { - throw new NullPointerException("path"); - } - - // Ensure that the path is not altered after the connection is - // established. - if (impl_ != null) - { - throw new ExtendedIllegalStateException("path", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // Remember the current path value. - String oldPath = path_; - - // If the specified path doesn't start with the separator character, - // add one. All paths are absolute for IFS. - String newPath; - if (path.length() == 0 || path.charAt(0) != separatorChar) - { - newPath = separator + path; - } - else - { - newPath = path; - } - - // Fire a vetoable change event for the path. - vetos_.fireVetoableChange("path", oldPath, newPath); - - // Update the path value. - path_ = newPath; - - // Fire the property change event having null as the name to - // indicate that the path, parent, etc. have changed. - changes_.firePropertyChange("path", oldPath, newPath); - } - - - /** - Sets the pattern-matching behavior used when files are listed by any of the list() or listFiles() methods. The default is PATTERN_POSIX. - @param patternMatching Either {@link #PATTERN_POSIX PATTERN_POSIX}, {@link #PATTERN_POSIX_ALL PATTERN_POSIX_ALL}, or {@link #PATTERN_OS2 PATTERN_OS2} - - @see #getPatternMatching() - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void setPatternMatching(int patternMatching) - throws IOException - { - if (patternMatching < PATTERN_POSIX || patternMatching > PATTERN_OS2) { - throw new ExtendedIllegalArgumentException("patternMatching ("+patternMatching+")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (impl_ == null) - try - { - chooseImpl(); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); - } - - impl_.setPatternMatching(patternMatching); - patternMatching_ = patternMatching; - } - - -// @A6A - /** - * Sets the permission of the object. - * @param permission The permission that will be set to the object. - * @see #getPermission - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnknownHostException If the system cannot be located. - - * - **/ - public void setPermission(Permission permission) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - ServerStartupException, - PropertyVetoException, - UnknownHostException - { - if (permission == null) - { - throw new NullPointerException("permission"); - } - - AS400 system=permission.getSystem(); - if (system == null) - { - throw new ExtendedIllegalArgumentException("permission.system (null)", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (system.equals(system_)) - { - if ((this.getFileSystem()).equals(permission.getObjectPath())) - { - vetos_.fireVetoableChange("permission", null, permission_); - - this.permission_=permission; - permission.commit(); - - changes_.firePropertyChange("permission", null, permission_); - - } - else - { - throw new ExtendedIllegalArgumentException("permission.objectPath (" + - permission.getObjectPath() + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - else - { - String systemName = system.getSystemName(); - throw new ExtendedIllegalArgumentException("permission.system (" + - systemName + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - - /** - Marks the integrated file system object represented by this object so - that only read operations are allowed. - @return true if successful; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - // @D1 - new method because of changes to java.io.File in Java 2. - public boolean setReadOnly() - throws IOException - { - return setReadOnly(true); - } - - - /** - Changes the read only attribute of the integrated file system object - represented by this object. - @param attribute True to set the read only attribute of the file such that - the file cannot be changed. False to set the read only - attributes such that the file can be changed. - - @return true if successful; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - - // @D1a new method because of changes to java.io.File in Java 2. - public boolean setReadOnly(boolean attribute) - throws IOException - { - try - { - return setReadOnly0(attribute); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); - } - } - - - /** - Changes the read only attribute of the integrated file system object - represented by this object. - @param attribute True to set the read only attribute of the file such that - the file cannot be changed. False to set the read only - attributes such that the file can be changed. - - @return true if successful; false otherwise. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - - // @D1a new method because of changes to java.io.File in Java 2. - boolean setReadOnly0(boolean attribute) - throws IOException, AS400SecurityException - { - if (impl_ == null) - chooseImpl(); - - boolean success = impl_.setReadOnly(attribute); - - if (success) - { - cachedAttributes_ = null; - - // Fire the file modified event. - if (fileListeners_.size() != 0) { - IFSFileDescriptor.fireModifiedEvents(this, fileListeners_); - } - - } - return success; - } - - - /** - Sets the sorting behavior used when files are listed by any of the list() or listFiles() methods. The default is false (unsorted). - @param sort If true: Lists of files are returned in sorted order. - If false: Lists of files are returned in whatever order the file system provides. - - @exception IOException If an error occurs while communicating with the system. - @exception AS400SecurityException If a security or authority error occurs. - **/ - public void setSorted(boolean sort) - throws IOException, AS400SecurityException - { - if (impl_ == null) - try - { - chooseImpl(); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, SECURITY_EXCEPTION, e); - throw new ExtendedIOException(path_, ExtendedIOException.ACCESS_DENIED); - } - - impl_.setSorted(sort); - sortLists_ = sort; - } - - - - /** - Sets the system. - The system cannot be changed once a connection is made to the system. - @param system The system object. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem(AS400 system) - throws PropertyVetoException - { - if (system == null) - { - throw new NullPointerException("system"); - } - - // Ensure that system is not altered after the connection is - // established. - if (impl_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // Fire a vetoable change event for system. - vetos_.fireVetoableChange("system", system_, system); - - // Remember the old system value. - AS400 oldSystem = system_; - - system_ = system; - - // Fire the property change event. - changes_.firePropertyChange("system", oldSystem, system_); - } - - /** - Generates a String representation of this object. - @return The path name of the integrated file system object represented by this object. - **/ - public String toString() - { - return path_; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/IFSFile16.gif b/cvsroot/src/com/ibm/as400/access/IFSFile16.gif deleted file mode 100644 index 28fb1f8f6..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/IFSFile16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/IFSFile32.gif b/cvsroot/src/com/ibm/as400/access/IFSFile32.gif deleted file mode 100644 index 8d0a05403..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/IFSFile32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileBeanInfo.java b/cvsroot/src/com/ibm/as400/access/IFSFileBeanInfo.java deleted file mode 100644 index b64344e79..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileBeanInfo.java +++ /dev/null @@ -1,201 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.VetoableChangeListener; - -/** - The IFSFileBeanInfo class provides BeanInfo for IFSFile. -**/ -public class IFSFileBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private final static Class beanClass = IFSFile.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - private static ResourceBundleLoader rbl_; - - static - { - try - { - // Define the property descriptors. - PropertyDescriptor property1 = - new PropertyDescriptor("path", beanClass, "getPath", "setPath"); - property1.setBound(true); - property1.setConstrained(true); - property1.setDisplayName(rbl_.getText("PROP_NAME_PATH")); - property1.setShortDescription(rbl_.getText("PROP_DESC_PATH")); - PropertyDescriptor property2 = - new PropertyDescriptor("system", beanClass, "getSystem", "setSystem"); - property2.setBound(true); - property2.setConstrained(true); - property2.setDisplayName(rbl_.getText("PROP_NAME_SYSTEM")); - property2.setShortDescription(rbl_.getText("PROP_DESC_SYSTEM")); - - // The introspecition process will reveal features that aren't - // really properties. We must declare them and mark as hidden. - PropertyDescriptor property3 = - new PropertyDescriptor("absolutePath", beanClass, "getAbsolutePath", - null); - property3.setHidden(true); - PropertyDescriptor property4 = - new PropertyDescriptor("canonicalPath", beanClass, "getCanonicalPath", - null); - property4.setHidden(true); - PropertyDescriptor property5 = - new PropertyDescriptor("freeSpace", beanClass, "getFreeSpace", - null); - property5.setHidden(true); - PropertyDescriptor property6 = - new PropertyDescriptor("name", beanClass, "getName", - null); - property6.setHidden(true); - PropertyDescriptor property7 = - new PropertyDescriptor("parent", beanClass, "getParent", - null); - property7.setHidden(true); - PropertyDescriptor property8 = - new PropertyDescriptor("absolute", beanClass, "isAbsolute", - null); - property8.setHidden(true); - PropertyDescriptor property9 = - new PropertyDescriptor("directory", beanClass, "isDirectory", - null); - property9.setHidden(true); - PropertyDescriptor property10 = - new PropertyDescriptor("file", beanClass, "isFile", - null); - property10.setHidden(true); - PropertyDescriptor property11 = - new PropertyDescriptor("lastModified", beanClass, null, - "setLastModified"); - property11.setHidden(true); - - PropertyDescriptor[] properties = - { - property1, property2, property3, property4, property5, property6, - property7, property8, property9, property10, property11 - }; - properties_ = properties; - - // Define the event descriptors. - EventSetDescriptor event1 = - new EventSetDescriptor(beanClass, "propertyChange", - PropertyChangeListener.class, - "propertyChange"); - event1.setShortDescription(rbl_.getText("EVT_DESC_PROPERTY_CHANGE")); - event1.setDisplayName(rbl_.getText("EVT_NAME_PROPERTY_CHANGE")); - String[] listenerMethods = { "fileDeleted", "fileModified" }; - EventSetDescriptor event2 = - new EventSetDescriptor(beanClass, "file", FileListener.class, - listenerMethods, "addFileListener", - "removeFileListener"); - event2.setDisplayName(rbl_.getText("EVT_NAME_FILE_EVENT")); - event2.setShortDescription(rbl_.getText("EVT_DESC_FILE_EVENT")); - EventSetDescriptor event3 = - new EventSetDescriptor(beanClass, "propertyChange", - VetoableChangeListener.class, - "vetoableChange"); - event3.setDisplayName(rbl_.getText("EVT_NAME_PROPERTY_VETO")); - event3.setShortDescription(rbl_.getText("EVT_DESC_PROPERTY_VETO")); - EventSetDescriptor[] events = { event1, event2, event3 }; - events_ = events; - } - catch(Exception e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the default event index. - @return The default event index (always 1). - **/ - public int getDefaultEventIndex() - { - return 1; - } - - /** - Returns the default property index. - @return The default property index (always 0). - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("IFSFile16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("IFSFile32.gif"); - break; - } - - return image; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileDescriptor.java b/cvsroot/src/com/ibm/as400/access/IFSFileDescriptor.java deleted file mode 100644 index 79516304e..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileDescriptor.java +++ /dev/null @@ -1,373 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileDescriptor.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @A1 2008-02-22 Change setFileOffset() parameter from int to long -// This is a private method and calls the impl.setFileOffset which already -// takes a long. -// setFileOffset() is called from IFSRandomAccessFile.seek(long) -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.util.Enumeration; -import java.util.Vector; - - -/** -Represents an integrated file system file descriptor. -Instances of the file descriptor class serve as an opaque handle to the underlying structure representing an open file or an open socket. Applications should not create their own file descriptors.
    -Here is an example of two input streams sharing a file descriptor: -
    -    AS400 as400 = new AS400("mySystem");
    -    IFSFileInputStream is1 = new IFSFileInputStream(as400, "/Dir/File");
    -    IFSFileInputStream is2 = new IFSFileInputStream(is1.getFD());
    -
    -Reading in one object advances the current file position of all objects that share the same descriptor. -@see IFSFileInputStream#getFD -@see IFSFileOutputStream#getFD -@see IFSRandomAccessFile#getFD -**/ -public final class IFSFileDescriptor - implements java.io.Serializable -{ - static final long serialVersionUID = 4L; - - private transient long fileOffset_; - private transient Object parent_; // The object that instantiated - // this IFSDescriptor. - private String path_ = ""; - private int shareOption_; - private AS400 system_; - private boolean closed_ = false; - - private transient Object fileOffsetLock_ = new Object(); - // Semaphore for synchronizing access to fileOffset_. - - private transient IFSFileDescriptorImpl impl_; - - -/** -Constructs an IFSFileDescriptor object. -**/ - public IFSFileDescriptor() - { - } - - IFSFileDescriptor(AS400 system, - String path, - int shareOption, - Object parent) - { - system_ = system; - path_ = path; - shareOption_ = shareOption; - parent_ = parent; - } - - IFSFileDescriptor(int shareOption, - Object parent) - { - shareOption_ = shareOption; - parent_ = parent; - } - - /** - Chooses the appropriate implementation. - **/ - void chooseImpl () - { - if (impl_ == null) - { - impl_ = (IFSFileDescriptorImpl) system_.loadImpl2 - ("com.ibm.as400.access.IFSFileDescriptorImplRemote", - "com.ibm.as400.access.IFSFileDescriptorImplProxy"); - - // Get the "impl" object for the parent, so we can pass it to the impl_. - Object parentImpl = null; - if (parent_ != null) - { - // Get the impl object for the parent. - //@A3D Class clazz = parent_.getClass (); - //@A3D Method method = clazz.getDeclaredMethod ("getImpl", new Class[] {}); - //@A3D parentImpl = method.invoke (parent_, new Object[] {}); - //@A3A - String className = parent_.getClass().getName(); - if (parent_ instanceof IFSFileInputStream) { - parentImpl = ((IFSFileInputStream)parent_).getImpl(); - } - else if (parent_ instanceof IFSFileOutputStream) { - parentImpl = ((IFSFileOutputStream)parent_).getImpl(); - } - else if (parent_ instanceof IFSTextFileInputStream) { - parentImpl = ((IFSTextFileInputStream)parent_).getImpl(); - } - else if (parent_ instanceof IFSTextFileOutputStream) { - parentImpl = ((IFSTextFileOutputStream)parent_).getImpl(); - } - else if (parent_ instanceof IFSRandomAccessFile) { - parentImpl = ((IFSRandomAccessFile)parent_).getImpl(); - } - else { - Trace.log(Trace.ERROR, "IFSFileDescriptor has invalid parent: " + className); - throw new InternalErrorException (InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - impl_.initialize(fileOffset_, parentImpl, - path_, shareOption_, system_.getImpl()); - } - } - - void close() - { - if (impl_ != null) impl_.close(); - closed_ = true; - } - - - /** - Fires events to indicate file has been closed. - This static method is provided as a utility for use by other classes. - **/ - static void fireClosedEvents(Object source, Vector fileListeners) - { - FileEvent event = new FileEvent(source, FileEvent.FILE_CLOSED); - synchronized(fileListeners) - { - Enumeration e = fileListeners.elements(); - while (e.hasMoreElements()) - { - FileListener listener = (FileListener)e.nextElement(); - listener.fileClosed(event); - } - } - } - - - /** - Fires events to indicate file has been modified. - This static method is provided as a utility for use by other classes. - **/ - static void fireModifiedEvents(Object source, Vector fileListeners) - { - FileEvent event = new FileEvent(source, FileEvent.FILE_MODIFIED); - synchronized(fileListeners) - { - Enumeration e = fileListeners.elements(); - while (e.hasMoreElements()) - { - FileListener listener = (FileListener)e.nextElement(); - listener.fileModified(event); - } - } - } - - - /** - Fires events to indicate file has been opened. - This static method is provided as a utility for use by other classes. - **/ - static void fireOpenedEvents(Object source, Vector fileListeners) - { - FileEvent event = new FileEvent(source, FileEvent.FILE_OPENED); - synchronized(fileListeners) - { - Enumeration e = fileListeners.elements(); - while (e.hasMoreElements()) - { - FileListener listener = (FileListener)e.nextElement(); - listener.fileOpened(event); - } - } - } - - - // Design note: The policy for 'get' and 'is' methods is: - // If impl_ is null, or the field is never reset by the ImplRemote, - // simply return the local copy of the data member. - // If impl_ is non-null, and the field can be reset by the ImplRemote, - // get the value from impl_ (and disregard the local value). - // Note that various IFSxxxImplRemote classes are given direct access to impl_. - - IFSFileDescriptorImpl getImpl() - { - if (impl_ == null) chooseImpl(); - return impl_; - } - - /** - Returns the file's "data CCSID" setting. - **/ - int getCCSID() - throws IOException - { - if (impl_ == null) chooseImpl(); - return impl_.getCCSID(); - } - - long getFileOffset() - { - if (impl_ == null) - { - return fileOffset_; - } - else - return impl_.getFileOffset(); - } - - String getPath() - { - return path_; // this field is never reset by the ImplRemote - } - - int getShareOption() - { - return shareOption_; // this field is never reset by the ImplRemote - } - - AS400 getSystem() - { - return system_; // this field is never reset by the ImplRemote - } - - void incrementFileOffset(long fileOffsetIncrement) - { - if (impl_ == null) - { - synchronized(fileOffsetLock_) - { - fileOffset_ += fileOffsetIncrement; - } - } - else - impl_.incrementFileOffset(fileOffsetIncrement); - } - - boolean isClosed() - { - return closed_; - } - - boolean isOpen() - { - if (impl_ == null) - return false; - else - return impl_.isOpen(); - } - - /** - Restores the state of this object from an object input stream. - @param ois The stream of state information. - @exception IOException If an error occurs while communicating with the server. - @exception ClassNotFoundException - **/ - private void readObject(java.io.ObjectInputStream ois) - throws IOException, ClassNotFoundException - { - // Restore the non-static and non-transient fields. - ois.defaultReadObject(); - - // Initialize the transient fields. - fileOffset_ = 0; - parent_ = null; - fileOffsetLock_ = new Object(); - impl_ = null; - } - - void setFileOffset(long fileOffset) //@A1C - Change parameter from int to long - { - if (impl_ == null) - { - synchronized(fileOffsetLock_) - { - fileOffset_ = fileOffset; - } - } - else - impl_.setFileOffset(fileOffset); - } - - void setPath(String path) - { - if (impl_ == null) - path_ = path; - else - throw new ExtendedIllegalStateException("path", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - void setShareOption(int shareOption) - { - if (impl_ == null) - shareOption_ = shareOption; - else - throw new ExtendedIllegalStateException("shareOption", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - void setSystem(AS400 system) - { - if (impl_ == null) - system_ = system; - else - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - /** - Force the system buffers to synchronize with the underlying device. - **/ // $A1 - public void sync() throws IOException - { - if (impl_ == null) - { - if (parent_ == null) - { - Trace.log(Trace.ERROR, "Parent is null, nothing to synchronize."); - // Tolerate the error. - } - else if (parent_ instanceof IFSRandomAccessFile) - { - ((IFSRandomAccessFile)parent_).flush(); - } - else if (parent_ instanceof IFSFileOutputStream) - { - ((IFSFileOutputStream)parent_).flush(); - } - else - { - Trace.log(Trace.ERROR, "Parent does not have a flush() method: " + - parent_.getClass().getName()); - // Tolerate the error. - } - } - else - { - impl_.sync(); - } - } - -/** -Determines if this file descriptor represents an open file. -@return true if this file descriptor represents a valid, open file; false otherwise. -**/ - public boolean valid() - { - return isOpen(); - } -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileDescriptor16.gif b/cvsroot/src/com/ibm/as400/access/IFSFileDescriptor16.gif deleted file mode 100644 index 13d8e8002..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/IFSFileDescriptor16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileDescriptor32.gif b/cvsroot/src/com/ibm/as400/access/IFSFileDescriptor32.gif deleted file mode 100644 index 90150fbeb..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/IFSFileDescriptor32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileDescriptorImpl.java b/cvsroot/src/com/ibm/as400/access/IFSFileDescriptorImpl.java deleted file mode 100644 index e186b7bf7..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileDescriptorImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileDescriptorImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - - -/** - Specifies the methods which the implementation objects for the IFSFileDescriptor class - need to support. - **/ -interface IFSFileDescriptorImpl -{ - void close(); - - int getCCSID() throws IOException; - - long getFileOffset(); - - void incrementFileOffset(long fileOffsetIncrement); // used by IFSRandomAccessFile.skipBytes() - - // Note: This should be the first method called on a newly-constructed object. - void initialize(long fileOffset, Object parentImpl, String path, int shareOption, - AS400Impl system); - - boolean isOpen(); - - void setFileOffset(long fileOffset); - - void sync() throws IOException; - -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileDescriptorImplProxy.java b/cvsroot/src/com/ibm/as400/access/IFSFileDescriptorImplProxy.java deleted file mode 100644 index a8d49aa67..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileDescriptorImplProxy.java +++ /dev/null @@ -1,140 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileDescriptorImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - - -/** - Provides a local proxy implementation for the IFSFileDescriptor class. - **/ -class IFSFileDescriptorImplProxy -extends AbstractProxyImpl -implements IFSFileDescriptorImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - IFSFileDescriptorImplProxy () - { - super ("IFSFileDescriptor"); - } - - public void close() - { - try { - connection_.callMethod (pxId_, "close"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - public int getCCSID() throws IOException - { - try { - return connection_.callMethod (pxId_, "getCCSID") - .getReturnValueInt(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - public long getFileOffset() - { - try { - return connection_.callMethod (pxId_, "getFileOffset") - .getReturnValueLong(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - public void incrementFileOffset(long fileOffsetIncrement) - { - try { - connection_.callMethod (pxId_, "incrementFileOffset", - new Class[] { Long.TYPE }, - new Object[] { new Long(fileOffsetIncrement) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - public void initialize(long fileOffset, Object parentImpl, String path, int shareOption, - AS400Impl system) - { - try { - connection_.callMethod (pxId_, "initialize", - new Class[] { Long.TYPE, - Object.class, - String.class, - Integer.TYPE, - AS400Impl.class - }, - new Object[] { new Long(fileOffset), - parentImpl, - path, - new Integer(shareOption), - system - }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - public boolean isOpen() - { - try { - return connection_.callMethod (pxId_, "isOpen") - .getReturnValueBoolean(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - public void setFileOffset(long fileOffset) - { - try { - connection_.callMethod (pxId_, "setFileOffset", - new Class[] { Long.TYPE }, - new Object[] { new Long(fileOffset) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - public void sync() throws IOException - { - try { - connection_.callMethod (pxId_, "sync"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileDescriptorImplRemote.java b/cvsroot/src/com/ibm/as400/access/IFSFileDescriptorImplRemote.java deleted file mode 100644 index 85b25f8e4..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileDescriptorImplRemote.java +++ /dev/null @@ -1,1509 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileDescriptorImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @A3 - 10/18/2007 - Update finalize0() method to not send TWO close requests -// to the server. When garbage collection finds a descriptor -// that has not been closed, it calls the finalize method on -// one of the various IFSFilexxx classes which calls the -// finalize0() method of this class. -// This class was sending TWO close requests to the server -// for the same fileHandle_. Normally, the second close would -// silently fail. However, in some cases another thread might -// issue an open request for another file BETWEEN the two close -// requests sent by the garbage collection thread. This -// results in the newly opened file being incorrectly closed. -// Fix to finalize0() is to issue ONE close request to the -// File server. -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InterruptedIOException; -import java.util.Vector; - - -/** - Provides a full remote implementation for the IFSFileDescriptor class. - **/ -class IFSFileDescriptorImplRemote -implements IFSFileDescriptorImpl -{ - private static final int UNINITIALIZED = -1; // @B8a - private static final int MAX_BYTES_PER_READ = 16000000; // limit of file server - - // Note: We allow direct access to some of these fields, for performance. @B2C - ConverterImplRemote converter_; - private int fileHandle_ = UNINITIALIZED; // @B8c - int preferredServerCCSID_; - private int fileDataCCSID_ = UNINITIALIZED; - int serverDatastreamLevel_; // @B3A - int requestedDatastreamLevel_; // @B6a - private long fileOffset_; - boolean isOpen_; - boolean isOpenAllowed_ = true; - private Object parent_; // The object that instantiated this IFSDescriptor. - String path_ = ""; - byte[] pathnameBytes_; - AS400Server server_; // Note: AS400Server is not serializable. - private int shareOption_; - AS400ImplRemote system_; - - private Object fileOffsetLock_ = new Object(); - // Semaphore for synchronizing access to fileOffset_. - - private int maxDataBlockSize_ = 1024; // @B2A - // Used by IFSFileOutputStreamImplRemote, IFSRandomAccessFileImplRemote. - - private boolean determinedSystemVRM_ = false; // @B3A @B4C - private int systemVRM_; // @B3A @B4C - transient int errorRC_; // error return code from most recent request - int patternMatching_ = IFSFile.PATTERN_DEFAULT; // pattern-matching semantics - - // Used for debugging only. This should always be false for production. - // When this is false, all debug code will theoretically compile out. - private static final boolean DEBUG = false; // @B3A - - // Static initialization code. - static - { - // Add all byte stream reply data streams of interest to the - // AS400 server's reply data stream hash table. - AS400Server.addReplyStream(new IFSCloseRep(), AS400.FILE); - AS400Server.addReplyStream(new IFSExchangeAttrRep(), AS400.FILE); - AS400Server.addReplyStream(new IFSLockBytesRep(), AS400.FILE); - AS400Server.addReplyStream(new IFSReturnCodeRep(), AS400.FILE); - AS400Server.addReplyStream(new IFSWriteRep(), AS400.FILE); - AS400Server.addReplyStream(new IFSReadRep(), AS400.FILE); - } - - - // Cast an IFSFileDescriptorImpl object into an IFSFileDescriptorImplRemote. - // Used by various IFS*ImplRemote classes. - static IFSFileDescriptorImplRemote castImplToImplRemote(IFSFileDescriptorImpl fd) - { - try - { - return (IFSFileDescriptorImplRemote)fd; - } - catch (ClassCastException e) - { - Trace.log(Trace.ERROR, "Argument is not an instance of IFSFileDescriptorImplRemote", e); - throw new - InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - // @B8m - Moved this method here from IFSFileImplRemote. - // Determine if the directory entry can be accessed in the specified - // manner. - // Returns the returnCode that was set (as a side effect) by createFileHandle(). - int checkAccess(int access, int openOption) // @D1C @B8c - throws IOException, AS400SecurityException - { - int fileHandle = UNINITIALIZED; - try { - fileHandle = createFileHandle(access, openOption); - } - finally { - if (fileHandle != UNINITIALIZED) close(fileHandle); // we don't need this handle anymore - } - return errorRC_; - } - - - public void close() - { - try { - close0(); - } - catch (IOException e) { - Trace.log(Trace.ERROR, "Error while closing file " + path_, e); - } - } - - - public void close0() throws IOException - { - isOpen_ = false; - close(fileHandle_); - fileHandle_ = UNINITIALIZED; - } - - void close(int fileHandle) throws IOException - { - if (fileHandle == UNINITIALIZED) return; // @B8c - - // Close the file. Send a close request to the server. - ClientAccessDataStream ds = null; - IFSCloseReq req = new IFSCloseReq(fileHandle); - try - { - ds = (ClientAccessDataStream) server_.sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream connection lost during close", e); - connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted", e); - throw new InterruptedIOException(e.getMessage()); - } - - // Validate the reply. - if (ds instanceof IFSCloseRep) - { - int rc = ((IFSCloseRep) ds).getReturnCode(); - if (rc != 0) - { - Trace.log(Trace.ERROR, "IFSCloseRep return code", rc); - throw new ExtendedIOException(path_, rc); - } - } - else if (ds instanceof IFSReturnCodeRep) - { - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc != IFSReturnCodeRep.SUCCESS) - { - Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", descriptionForReturnCode(rc)); - throw new ExtendedIOException(path_, rc); - } - } - else - { - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - - - /** - Establishes communications with the server. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the server. - **/ - void connect() // @B2A - code relocated from IFSFileOutputStreamImplRemote,etc. - throws IOException, AS400SecurityException - { - // Connect to the byte stream server if not already connected. - if (server_ == null) - { - // Ensure that the system has been set. - if (system_ == null) - { - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - try { - server_ = system_.getConnection(AS400.FILE, false); - } - catch(AS400SecurityException e) - { - Trace.log(Trace.ERROR, "Access to byte stream server on '" + - system_.getSystemName() + "' denied.", e); - throw e; - } - - // Exchange attributes with the server. - exchangeServerAttributes(); - } - } - - /** - Disconnects from the byte stream server. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - **/ - void connectionDropped(ConnectionDroppedException e) // @B2A - code relocated from IFSFileOutputStreamImplRemote,etc. - throws ConnectionDroppedException - { - if (server_ != null) - { - system_.disconnectServer(server_); - server_ = null; - try { close(); } catch (Exception exc) {} // Note: Not relevant for IFSFileImplRemote. - } - Trace.log(Trace.ERROR, "Byte stream connection lost."); - throw e; - } - - /** - * Copies a file or directory to another file or directory. - **/ - boolean copyTo(String destinationPath, boolean replace) - throws AS400SecurityException, IOException - { - ClientAccessDataStream ds = null; - IFSCopyReq req = new IFSCopyReq(path_, destinationPath, replace); - try - { - ds = (ClientAccessDataStream) server_.sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream connection lost during copy", e); - connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted", e); - throw new InterruptedIOException(e.getMessage()); - } - if (ds instanceof IFSReturnCodeRep) - { - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc != IFSReturnCodeRep.SUCCESS) - { - String path = (rc == IFSReturnCodeRep.DUPLICATE_DIR_ENTRY_NAME ? destinationPath : path_); - throwSecurityExceptionIfAccessDenied(path,rc); // check for "access denied" - Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", descriptionForReturnCode(rc)); - throw new ExtendedIOException(path, rc); - } - return true; - } - else - { - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - - - // Opens the file for 'read' access, and returns a file handle. - // If failure, sets errorRC_ and returns UNINITIALIZED. - private final int createFileHandle() - throws IOException, AS400SecurityException - { - return createFileHandle(IFSOpenReq.READ_ACCESS, IFSOpenReq.OPEN_OPTION_FAIL_OPEN); - } - - // Opens the file with specified access and option, and returns a file handle. - // If failure, sets errorRC_ and returns UNINITIALIZED. - int createFileHandle(int access, int openOption) // @D1C @B8c - throws IOException, AS400SecurityException - { - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - int fileHandle = UNINITIALIZED; - errorRC_ = 0; - - // Try to open the file for the specified type of access. - try - { - // Process an open file request. - // For 3rd parm (file data CCSID), specify 0 since we don't care about CCSID. - IFSOpenReq req = new IFSOpenReq(getPathnameAsBytes(), preferredServerCCSID_, - 0, access, IFSOpenReq.DENY_NONE, - IFSOpenReq.NO_CONVERSION, - openOption, serverDatastreamLevel_); // @D1C - ClientAccessDataStream ds = (ClientAccessDataStream) server_.sendAndReceive(req); - if (ds instanceof IFSOpenRep) - { - // The open was successful. Close the file if appropriate. - returnCode = IFSReturnCodeRep.SUCCESS; - fileHandle = ((IFSOpenRep) ds).getFileHandle(); // @B8a - } - else if (ds instanceof IFSReturnCodeRep) - { - returnCode = ((IFSReturnCodeRep) ds).getReturnCode(); - throwSecurityExceptionIfAccessDenied(path_,returnCode); // check for "access denied" - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost", e); - connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted", e); - throw new InterruptedIOException(e.getMessage()); - } - - if (returnCode != IFSReturnCodeRep.SUCCESS) - { - if (Trace.isTraceOn() && Trace.isTraceDiagnosticOn()) - { - Trace.log(Trace.DIAGNOSTIC, "Unable to open file " + path_ + ": " + - "IFSReturnCodeRep return code", descriptionForReturnCode(returnCode)); - } - errorRC_ = returnCode; - return UNINITIALIZED; - } - - return fileHandle; - } - - /** - Exchanges server attributes. - @exception IOException If an error occurs while communicating with the server. - **/ - void exchangeServerAttributes() // @B2A - code relocated from IFSFileOutputStreamImplRemote,etc. - throws IOException, AS400SecurityException - { - synchronized (server_) - { - DataStream ds = server_.getExchangeAttrReply(); - IFSExchangeAttrRep rep = null; - try { rep = (IFSExchangeAttrRep)ds; } - catch (ClassCastException e) - { - if (ds instanceof IFSReturnCodeRep) - { - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - throwSecurityExceptionIfAccessDenied(path_,rc); // check for "access denied" - Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", descriptionForReturnCode(rc)); - throw new ExtendedIOException(path_, rc); - } - else { - String className = ( ds == null ? "null" : ds.getClass().getName()); - Trace.log(Trace.ERROR, "Unexpected reply from Exchange Server Attributes: " + className); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - - // Note: For releases after V5R4, we ask for Datastream Level 16; - // for V5R3 thru V5R4, we ask for Datastream Level 8; - // for V4R5 thru V5R2, we ask for Datastream Level 2; - // for earlier systems, we ask for Datastream Level 0. // @B6c - if (getSystemVRM() >= 0x00060100) - requestedDatastreamLevel_ = 16; - else if (getSystemVRM() >= 0x00050300) - requestedDatastreamLevel_ = 8; - else if (getSystemVRM() >= 0x00040500) // @B3A @B4C - requestedDatastreamLevel_ = 2; - else - requestedDatastreamLevel_ = 0; - if (rep == null) - { - ds = null; - try - { - int[] preferredCcsids; // @A2A - // Datastream level 8 was introduced in release V5R3. - if (getSystemVRM() >= 0x00050300) - { // System is post-V5R2. - preferredCcsids = new int[] {0x04b0,0x34b0,0xf200}; // UTF-16, new or old Unicode. - } - // Note: Pre-V4R5 systems hang when presented with multiple - // preferred CCSIDs in the exchange of attributes. @B3A @B4C - else if (getSystemVRM() >= 0x00040500) // @B3A @B4C - { // System is V4R5 or later. We can present a list of preferred CCSIDs. - preferredCcsids = new int[] {0x34b0,0xf200}; // New or old Unicode. - } - else - { // System is pre-V4R5. Exchange attr's the old way. - preferredCcsids = new int[] {0xf200}; // Old Unicode only. - } - - // Use GMT date/time, don't use posix style return codes, - // use PC pattern matching semantics, - // maximum data transfer size of 0xffffffff. - ds = server_.sendExchangeAttrRequest( //@B3A - new IFSExchangeAttrReq(true, false, - IFSExchangeAttrReq.PC_PATTERN_MATCH, - 0xffffffff, - requestedDatastreamLevel_, - preferredCcsids)); // @A2C - rep = (IFSExchangeAttrRep)ds; - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost"); - connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted", e); - system_.disconnectServer(server_); - server_ = null; - throw new InterruptedIOException(e.getMessage()); - } - catch(IOException e) - { - Trace.log(Trace.ERROR, "I/O error during attribute exchange."); - system_.disconnectServer(server_); - server_ = null; - throw e; - } - catch(ClassCastException e) - { - if (ds instanceof IFSReturnCodeRep) - { - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - throwSecurityExceptionIfAccessDenied(path_,rc); // check for "access denied" - Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", descriptionForReturnCode(rc)); - throw new ExtendedIOException(path_, rc); - } - else { - String className = ( ds == null ? "null" : ds.getClass().getName()); - Trace.log(Trace.ERROR, "Unexpected reply from Exchange Server Attributes: " + className); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - } - - // Process the exchange attributes reply. - if (rep != null) - { - maxDataBlockSize_ = ((IFSExchangeAttrRep) rep).getMaxDataBlockSize(); - preferredServerCCSID_ = rep.getPreferredCCSID(); - serverDatastreamLevel_ = rep.getDataStreamLevel(); - setConverter(ConverterImplRemote.getConverter(preferredServerCCSID_, - system_)); - if (DEBUG) { - System.out.println("DEBUG: IFSFileDescriptorImplRemote.exchangeServerAttributes(): " + - "preferredServerCCSID_ == " + preferredServerCCSID_); - int[] list = rep.getPreferredCCSIDs(); - for (int i=0; i 1) { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Received multiple replies from listAttributes(fileHandle) (" + - replys.size() + ")"); - } - else { - reply = (IFSListAttrsRep) replys.elementAt(0); - } - } - finally { - if(!usedGlobalHandle && fileHandle != UNINITIALIZED) //@KKBA - close(fileHandle); - } - - return reply; - } - - - /** - Places a lock on the file at the specified bytes. - @param offset The first byte of the file to lock (zero is the first byte). - @param length The number of bytes to lock. - @return A key for undoing this lock. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the server. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the server cannot be started. - @exception UnknownHostException If the system cannot be located. - - @see IFSKey - @see #unlock - **/ - IFSKey lock(long length) // @B2A - throws IOException, AS400SecurityException - { - return lock(fileOffset_, length); - } - - IFSKey lock(long offset, // @B2A - code relocated from IFSFileOutputStreamImplRemote,etc. - long length) - throws IOException, AS400SecurityException - { - // Assume the arguments have been validated by the caller. - - // Attempt to lock the file. - ClientAccessDataStream ds = null; - try - { - // Issue a mandatory, exclusive lock bytes request. Mandatory - // means that the file system enforces the lock by causing any - // operation which conflicts with the lock to fail. Exclusive - // means that only the owner of the lock can read or write the - // locked area. - IFSLockBytesReq req = - new IFSLockBytesReq(fileHandle_, true, false, offset, - length, serverDatastreamLevel_); - ds = (ClientAccessDataStream) server_.sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost"); - connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted", e); - throw new InterruptedIOException(e.getMessage()); - } - - // Verify the reply. - if (ds instanceof IFSLockBytesRep) - { - int rc = ((IFSLockBytesRep) ds).getReturnCode(); - if (rc != 0) - { - Trace.log(Trace.ERROR, "IFSLockBytesRep return code", rc); - throw new ExtendedIOException(path_, rc); - } - } - else if (ds instanceof IFSReturnCodeRep) - { - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc != IFSReturnCodeRep.SUCCESS) - { - throwSecurityExceptionIfAccessDenied(path_,rc); // check for "access denied" - Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", descriptionForReturnCode(rc)); - throw new ExtendedIOException(path_, rc); - } - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - - // Generate the key for this lock. - IFSKey key = new IFSKey(fileHandle_, offset, length, true); - - return key; - } - - // Common code used by IFSFileInputStreamImplRemote and IFSRandomAccessFileImplRemote. - /** - Reads up to length bytes of data from this input stream into data, - starting at the array offset dataOffset. - @param data The buffer into which the data is read. - @param offset The start offset of the data in the buffer. - @param length The maximum number of bytes to read - @return The total number of bytes read into the buffer, or -1 if there is no more data because the end of file has been reached. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the server. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - int read(byte[] data, // @B2A - code relocated from IFSFileInputStreamImplRemote,etc. - int dataOffset, - int length) - throws IOException, AS400SecurityException - { - // Assume the arguments have been validated by the public class. - - // If length is zero then return zero. - if (length == 0) - { - return 0; - } - - int totalBytesRead = 0; - int bytesRemainingToRead = length; - boolean endOfFile = false; - while (totalBytesRead < length && !endOfFile) - { - // If the number of bytes being requested is greater than 16 million, then submit multiple requests for smaller chunks. The File Server has a limit that is somewhat below 16 megabytes (allowing for headers, etc), so 16 _million_ bytes is a safe limit. - - // Issue the read data request. - int bytesToReadThisTime = Math.min(bytesRemainingToRead, MAX_BYTES_PER_READ); - IFSReadReq req = new IFSReadReq(fileHandle_, fileOffset_, - bytesToReadThisTime, serverDatastreamLevel_); - ClientAccessDataStream ds = null; - try - { - ds = (ClientAccessDataStream) server_.sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost"); - connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted", e); - throw new InterruptedIOException(e.getMessage()); - } - - // Receive replies until the end of chain. - boolean endOfChain = false; - int bytesReadByThisRequest = 0; - do - { - if (ds instanceof IFSReadRep) - { - // Copy the data from the reply to the data parameter. - byte[] buffer = ((IFSReadRep) ds).getData(); - if (buffer.length > 0) - { - System.arraycopy(buffer, 0, data, dataOffset, buffer.length); - bytesReadByThisRequest += buffer.length; - dataOffset += buffer.length; - } - else // no data returned. This implies end-of-file (e.g. if file is empty). - { - bytesReadByThisRequest = -1; - endOfFile = true; - } - } - else if (ds instanceof IFSReturnCodeRep) - { - // Check for failure. - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - - if (rc == IFSReturnCodeRep.SUCCESS) - { // It worked, so nothing special to do here. - } - else if (rc == IFSReturnCodeRep.NO_MORE_DATA) - { - // End of file. - bytesReadByThisRequest = -1; - endOfFile = true; - } - else // none of the above - { - throwSecurityExceptionIfAccessDenied(path_,rc); // check for "access denied" - Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", descriptionForReturnCode(rc)); - throw new ExtendedIOException(path_, rc); - } - } - else // neither IFSReadRep nor IFSReturnCodeRep - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - - // Get the next reply if not end of chain. - endOfChain = ((IFSDataStream) ds).isEndOfChain(); - if (!endOfChain) - { - try - { - ds = (ClientAccessDataStream) - server_.receive(req.getCorrelation()); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost"); - connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted", e); - throw new InterruptedIOException(e.getMessage()); - } - } - } - while (!endOfChain); - - // Advance the file pointer. - if (bytesReadByThisRequest > 0) { - incrementFileOffset(bytesReadByThisRequest); - totalBytesRead += bytesReadByThisRequest; - bytesRemainingToRead -= bytesReadByThisRequest; - } - - } - - // If we have read zero bytes and hit end-of-file, indicate that by returning -1. - // Otherwise return total number of bytes read. - return (endOfFile && totalBytesRead == 0 ? -1 : totalBytesRead); - } - - void setConverter(ConverterImplRemote converter) - { - converter_ = converter; - } - - - /** - Sets the cached "file data CCSID" value. - **/ - void setCCSID(int ccsid) - throws IOException - { - fileDataCCSID_ = ccsid; - } - - public void setFileOffset(long fileOffset) - { - synchronized(fileOffsetLock_) - { - fileOffset_ = fileOffset; - } - } - - - // @B8a - boolean setLength(long length) - throws IOException, AS400SecurityException - { - // Assume that we are connected to the server. - - // Prepare to issue a 'change attributes' request. - ClientAccessDataStream ds = null; - - int fileHandle = UNINITIALIZED; - - try - { - // Open the file for read/write, get a file handle, and call 'change attributes'. - fileHandle = createFileHandle(IFSOpenReq.WRITE_ACCESS, IFSOpenReq.OPEN_OPTION_FAIL_OPEN); - if (fileHandle == UNINITIALIZED) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Unable to create handle to file " + path_ + ". IFSReturnCodeRep return code", errorRC_); - return false; - } - IFSChangeAttrsReq req = new IFSChangeAttrsReq(fileHandle, length, serverDatastreamLevel_); - ds = (ClientAccessDataStream) server_.sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost."); - connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted"); - throw new InterruptedIOException(e.getMessage()); - } - finally { - close(fileHandle); // we don't need this handle anymore - } - - // Verify the reply. - boolean success = false; - if (ds instanceof IFSReturnCodeRep) - { - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc == IFSReturnCodeRep.SUCCESS) - success = true; - else - { - throwSecurityExceptionIfAccessDenied(path_,rc); // check for "access denied" - Trace.log(Trace.ERROR, path_ + ": IFSReturnCodeRep return code", descriptionForReturnCode(rc)); - } - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - - // Back off the file pointer if needed. - if (fileOffset_ > length) { - fileOffset_ = length; - } - - return success; - } - - - // Ignores fileHandle if state==false. - void setOpen(boolean state, int fileHandle) - { - if (state == true) - { - if (fileHandle == UNINITIALIZED) - { - Trace.log(Trace.ERROR, "Called setOpen with invalid file handle: " + fileHandle); - throw new - InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - else - { - if (fileHandle != fileHandle_) close(); // close currently-open handle if different - fileHandle_ = fileHandle; - } - } - isOpen_ = state; - } - - void setOpenAllowed(boolean state) - { - isOpenAllowed_ = state; - } - - void setPreferredCCSID(int ccsid) - { - preferredServerCCSID_ = ccsid; - } - - void setServer(AS400Server server) - { - server_ = server; - } - - /** - Force the system buffers to synchronize with the underlying device. - **/ // $A1 - public void sync() throws IOException - { - if (parent_ == null) - { - Trace.log(Trace.ERROR, "IFSFileDescriptor.sync() was called when parent is null."); - } - // Note: UserSpaceImplRemote creates an IFSFileDescriptorImplRemote directly. - else if (parent_ instanceof IFSRandomAccessFileImplRemote) - { - ((IFSRandomAccessFileImplRemote)parent_).flush(); - } - else if (parent_ instanceof IFSFileOutputStreamImplRemote) - { - ((IFSFileOutputStreamImplRemote)parent_).flush(); - } - else - { - Trace.log(Trace.WARNING, "IFSFileDescriptor.sync() was called " + - "when parent is neither an IFSRandomAccessFile nor an IFSFileOutputStream."); - } - } - - private static final void throwSecurityExceptionIfAccessDenied(String path, int returnCode) - throws AS400SecurityException - { - if (returnCode == IFSReturnCodeRep.ACCESS_DENIED_TO_DIR_ENTRY || - returnCode == IFSReturnCodeRep.ACCESS_DENIED_TO_REQUEST) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Access denied to file " + path + ". " + - "IFSReturnCodeRep return code", returnCode); - throw new AS400SecurityException(path, AS400SecurityException.DIRECTORY_ENTRY_ACCESS_DENIED); - } - } - - - /** - Undoes a lock on this file. - @param key The key for the lock. - - @exception IOException If an error occurs while communicating with the server. - - @see IFSKey - @see #lock - **/ - void unlock(IFSKey key) // @B2A - code relocated from IFSFileOutputStreamImplRemote,etc. - throws IOException, AS400SecurityException - { - // Assume the argument has been validated by the caller. - - // Verify that this key is compatible with this file. - if (key.fileHandle_ != fileHandle_) - { - Trace.log(Trace.ERROR, "Attempt to use IFSKey on different file stream."); - throw new ExtendedIllegalArgumentException("key", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Attempt to unlock the file. - ClientAccessDataStream ds = null; - // Issue an unlock bytes request. - IFSUnlockBytesReq req = - new IFSUnlockBytesReq(key.fileHandle_, key.offset_, - key.length_, key.isMandatory_, serverDatastreamLevel_); - try - { - ds = (ClientAccessDataStream) server_.sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost"); - connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted", e); - throw new InterruptedIOException(e.getMessage()); - } - - // Verify the reply. - if (ds instanceof IFSReturnCodeRep) - { - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc != IFSReturnCodeRep.SUCCESS) - { - throwSecurityExceptionIfAccessDenied(path_,rc); // check for "access denied" - Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", descriptionForReturnCode(rc)); - throw new ExtendedIOException(path_, rc); - } - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - - - // Common code used by IFSFileOutputStreamImplRemote and IFSRandomAccessFileImplRemote. - /** - Writes length bytes from the byte array data, starting at dataOffset, to this File. - @param data The data. - @param dataOffset The start offset in the data. - @param length The number of bytes to write. - @parm forceToStorage Whether data must be written before the server replies. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the server. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - void writeBytes(byte[] data, // @B2A - int dataOffset, - int length) - throws IOException, AS400SecurityException - { - writeBytes(data, dataOffset, length, false); - } - void writeBytes(byte[] data, // @B2A - code relocated from IFSFileOutputStreamImplRemote,etc. - int dataOffset, - int length, - boolean forceToStorage) - throws IOException, AS400SecurityException - { - // Assume the arguments have been validated by the caller. - - // Send write requests until all data has been written. - while(length > 0) - { - // Determine how much data can be written on this request. - int writeLength = (length > maxDataBlockSize_ ? - maxDataBlockSize_ : length); - - // Build the write request. Set the chain bit if there is - // more data to write. - IFSWriteReq req = new IFSWriteReq(fileHandle_, fileOffset_, - data, dataOffset, writeLength, - 0xffff, forceToStorage, serverDatastreamLevel_); - if (length - writeLength > 0) - { - // Indicate that there is more to write. - req.setChainIndicator(1); - } - - // Send the request. - ClientAccessDataStream ds = null; - try - { - // Send the request and receive the response. - ds = (ClientAccessDataStream) server_.sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost"); - connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted", e); - throw new InterruptedIOException(e.getMessage()); - } - - // Check the reply. - if (ds instanceof IFSWriteRep) - { - IFSWriteRep rep = (IFSWriteRep) ds; - int rc = rep.getReturnCode(); - if (rc != 0) - { - Trace.log(Trace.ERROR, "IFSWriteRep return code", rc); - throw new ExtendedIOException(path_, rc); - } - - // Advance the file pointer the length of the data - // written. - int lengthWritten = writeLength - rep.getLengthNotWritten(); - incrementFileOffset(lengthWritten); - dataOffset += lengthWritten; - length -= lengthWritten; - - // Ensure that all data requested was written. - if (lengthWritten != writeLength) - { - Trace.log(Trace.ERROR, "Incomplete write. Only " + - Integer.toString(lengthWritten) + " bytes of a requested " + - Integer.toString(writeLength) + " were written."); - throw new ExtendedIOException(path_, ExtendedIOException.UNKNOWN_ERROR); - } - } - else if (ds instanceof IFSReturnCodeRep) - { - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc != IFSReturnCodeRep.SUCCESS) - { - throwSecurityExceptionIfAccessDenied(path_,rc); // check for "access denied" - Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", descriptionForReturnCode(rc)); - throw new ExtendedIOException(path_, rc); - } - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - } - -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileEnumeration.java b/cvsroot/src/com/ibm/as400/access/IFSFileEnumeration.java deleted file mode 100644 index a5973ad74..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileEnumeration.java +++ /dev/null @@ -1,220 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileEnumeration.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// -// @D5 - 06/18/2007 - Changes to better handle when objects are filtered from -// the list returned by the IFS File Server. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.util.Enumeration; -import java.util.NoSuchElementException; - - -class IFSFileEnumeration -implements Enumeration -{ - // The block size is hardcoded based on the value chosen by OpNav. - // For now, it is not configurable. - private static final int MAXIMUM_GET_COUNT_ = 128; - - private IFSFile[] contents_; - private IFSFile[] contentsPending_; // Staging area for contents_ @A1a - private IFSFile file_; - private IFSFileFilter filter_; - private int index_; - private String pattern_; - //private String restartName_; - //private byte[] restartID_; // @C3a - private boolean isRestartByNameSupported_; // @A1a - - - - IFSFileEnumeration(IFSFile file, IFSFileFilter filter, String pattern) - throws AS400SecurityException, IOException - { - file_ = file; - filter_ = filter; - pattern_ = pattern; - - // @A1a: - // Note from the File Server team on 02/05/01: - // "The vnode architecture allows a file system to use the cookie - // (Restart Number) or a Restart Name to find the entry - // that processing should start at. - // QDLS and QSYS allow Restart Name, but /root (EPFS) does not." - - // "Restart by name" only works for QSYS.LIB and QDLS. @A1a - String path = file_.getPath().toUpperCase(); - int indexOfQSYS = path.indexOf("/QSYS.LIB"); // @D1A - added support to look for /IASPNAME../QSYS.LIB - if (path.startsWith("/QSYS.LIB") || path.startsWith("/QDLS.LIB") || - path.startsWith("/QDLS") || ((indexOfQSYS != -1) && (indexOfQSYS <= 11))) { // @C3a //@D1C - added support to look for /IASPNAME../QSYS.LIB - isRestartByNameSupported_ = true; - contentsPending_ = loadPendingBlock((String)null);// "Prime the pump" with the first block. @A1a @C3c - /*if (contentsPending_ != null) { // @C3a - restartName_ = contentsPending_[contentsPending_.length - 1].getName(); - } */ - } - else { // Use "restart by ID". - isRestartByNameSupported_ = false; -//@C3d if (Trace.traceOn_) Trace.log(Trace.WARNING, -//@C3d "Restart-by-name is not supported for directory " + path); - contentsPending_ = loadPendingBlock((byte[])null);// "Prime the pump" with the first block. @C3a - /*if (contentsPending_ != null) { // @C3a - restartID_ = contentsPending_[contentsPending_.length - 1].getRestartID(); - } */ - } - - getNextBlock(); - } - - - public boolean hasMoreElements() - { - return ((contents_ != null && index_ < contents_.length) || - (contentsPending_ != null)); // @A1c - } - - - // @A1a @C3c - private IFSFile[] loadPendingBlock(String restartName) - throws AS400SecurityException, IOException - { - IFSFile[] block = null; - // Design note: Using contents_ and contentsPending_ allows us to "look ahead" and detect end-of-list in all situations, including when the number of matching files in the directory is an exact multiple of MAXIMUM_GET_COUNT. - // Continue reading/loading until we have something to return (that @D5A - // didn't all get filtered out) @D5A - do //@D5A - { //@D5A - block = file_.listFiles0(filter_, pattern_, MAXIMUM_GET_COUNT_, restartName); - restartName = file_.getListFiles0LastRestartName(); //@D5A - } //@D5A - while ((block.length == 0) && (file_.getListFiles0LastNumObjsReturned() > 0)); //@D5A - - if (block.length == 0) block = null; // Never return an empty list. - return block; - } - - - // @C3a - private IFSFile[] loadPendingBlock(byte[] restartID) - throws AS400SecurityException, IOException - { - IFSFile[] block = null; - // Design note: Using contents_ and contentsPending_ allows us to "look ahead" and detect end-of-list in all situations, including when the number of matching files in the directory is an exact multiple of MAXIMUM_GET_COUNT. - // Continue reading/loading until we have something to return (that @D5A - // didn't all get filtered out) @D5A - do //@D5A - { //@D5A - block = file_.listFiles0(filter_, pattern_, MAXIMUM_GET_COUNT_, restartID); - restartID = file_.getListFiles0LastRestartID(); //@D5A - } //@D5A - while ((block.length == 0) && (file_.getListFiles0LastNumObjsReturned() > 0)); //@D5A - - if (block.length == 0) block = null; // Never return an empty list. - return block; - } - - - // Transfers the "pending block" into the "current block". - // Assumes loadPendingBlock() has been called at least once, to initialize contentsPending_. - private void getNextBlock() - throws AS400SecurityException, IOException - { - // @A1a - if (contentsPending_ == null) { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, - "getNextBlock() was called when contentsPending_==null."); - return; - } - - // Transfer the "pending contents" into "current contents". - contents_ = contentsPending_; - contentsPending_ = null; // @C3M - index_ = 0; - - // If contentsPending held fewer than max_get_count entries, we know that there are no more entries remaining to be read from the server. - - - // Note: Prior to V5R2, the file list returned by the "List Contents of Directory" request included "." and "..", which get weeded out by IFSFileImplRemote, so we need to check for (max_get_count - 2). @C3A - if (file_.getListFiles0LastNumObjsReturned() == 0) { // No objects last time. @D5C - // We're done. // @C3C - } - else // previous listFiles0 returned 1 to max_get_count number of objects - { - if (isRestartByNameSupported_) - { - // Load the next block from the system. - contentsPending_ = loadPendingBlock(file_.getListFiles0LastRestartName());// @C3c @D5C - } - else - { - // Load the next block from the system. - byte[] restartID = file_.getListFiles0LastRestartID(); - - // See if a zero-valued restartID was returned. - if (isAllZeros(restartID)) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, - "IFSFileEnumeration::getNextBlock(): A zero-valued restartID was returned."); - - // Try setting the last filename returned, as the "restart name" for the next request. - // Note that this is the only circumstance where the File Server supports "restart by name" for file systems other than QSYS and QDLS. - if (contents_ != null && contents_.length != 0) { - String restartName = contents_[contents_.length-1].getName(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, - "IFSFileEnumeration::getNextBlock(): Specifying restartName '"+restartName+"' for next request."); - contentsPending_ = loadPendingBlock(restartName); - return; - } - else { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, - "IFSFileEnumeration::getNextBlock(): No restartName available from prior reply."); - } - } - contentsPending_ = loadPendingBlock(restartID);// @C3c @D5C - } - } - } - - private static final boolean isAllZeros(byte[] arry) - { - if (arry == null || arry.length == 0) return false; - for (int i=0; ilist() or listFiles() methods. The default is false (unsorted). - @param sort If true: Return lists of files in sorted order. - If false: Return lists of files in whatever order the file system provides. - - @exception IOException If an error occurs while communicating with the server. - @exception AS400SecurityException If a security or authority error occurs. - **/ - public void setSorted(boolean sort) - { - try { - connection_.callMethod (pxId_, "setSorted", - new Class[] { Boolean.TYPE }, - new Object[] { new Boolean(sort) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - public void setSystem(AS400Impl system) - { - try { - connection_.callMethod (pxId_, "setSystem", - new Class[] { AS400Impl.class }, - new Object[] { system }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileImplRemote.java b/cvsroot/src/com/ibm/as400/access/IFSFileImplRemote.java deleted file mode 100644 index 59765caf8..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileImplRemote.java +++ /dev/null @@ -1,2800 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @D7 - 07/25/2007 - Add allowSortedRequests to the listDirectoryDetails() -// method to resolve problem of issuing PWFS List Attributes -// request with both "Sort" indication and "RestartByID" -// which is documented to be an invalid combination. -// @D8 - 10/04/2007 - Remove obsolete code for determining whether QSYS objects -// are to be treated as a "directory" or a "file". -// For QSYS objects, those which may be treated as directories -// have the attribute IFSListAttrsRep.DIRECTORY. -// For QSYS objects, those which may be treated as files -// have the attribute IFSListAttrsRep.FILE. -// All other QSYS objects are neither dirs/files (e.g OUTQ, -// DSPF, TAPF, or PRTF objects). -// @D9 - 04/03/2008 - Add clearCachedAttributes() to clear impl cache attributes. -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InterruptedIOException; -import java.io.IOException; -import java.util.Hashtable; -import java.util.Vector; -import java.beans.PropertyVetoException; - -/** - Provides a full remote implementation for the IFSFile class. - **/ -class IFSFileImplRemote -implements IFSFileImpl -{ - // Used for debugging only. This should always be false for production. - // When this is false, all debug code will theoretically compile out. - private static final boolean DEBUG = false; // @B2A - - private static final boolean IS_RESTART_NAME = true; // mnemonic for use in argument lists - private static final boolean NO_RESTART_NAME = IS_RESTART_NAME; // mnemonic - private static final boolean SORT_LIST = true; // mnemonic - private static final int NO_MAX_GET_COUNT = -1; // mnemonic - private static final int UNINITIALIZED = -1; - - // Constants for QlgAccess(), from system definitions file "unistd.h" - //private static final int ACCESS_MODE_READ = 0x04; // R_OK: test for read permission - //private static final int ACCESS_MODE_WRITE = 0x02; // W_OK: test for write permission - private static final int ACCESS_MODE_EXECUTE = 0x01; // X_OK: test for execute permission - //private static final int ACCESS_MODE_EXISTS = 0x00; // F_OK: test for existence of file - - // Static initialization code. - static - { - // Add all byte stream reply data streams of interest to the - // server's reply data stream hash table. - AS400Server.addReplyStream(new IFSListAttrsRep(), AS400.FILE); - AS400Server.addReplyStream(new IFSOpenRep(), AS400.FILE); - AS400Server.addReplyStream(new IFSCreateDirHandleRep(), AS400.FILE); - AS400Server.addReplyStream(new IFSQuerySpaceRep(), AS400.FILE); - AS400Server.addReplyStream(new IFSReturnCodeRep(), AS400.FILE); - } - - transient private IFSListAttrsRep attributesReply_; // "list attributes" reply - - private IFSFileDescriptorImplRemote fd_ = new IFSFileDescriptorImplRemote(); // @B2A - - private boolean isSymbolicLink_; - private boolean determinedIsSymbolicLink_; - private boolean sortLists_; // whether file-lists are returned from the File Server in sorted order - private RemoteCommandImpl rmtCmd_; // Impl object for remote command host server. - - private byte[] qualifiedFileName_; - private Integer databaseFileAttributes_; - - /** - Determines if the application can execute the integrated file system object represented by this object. If the file does not exist, returns false. - **/ - public boolean canExecute() - throws IOException, AS400SecurityException - { - // Ensure that we are connected to the server. - fd_.connect(); - - return canAccess(ACCESS_MODE_EXECUTE); - } - - - /** - Determines if the applet or application can read from the integrated file system object represented by this object. - **/ - public boolean canRead() - throws IOException, AS400SecurityException - { - // Ensure that we are connected to the server. - fd_.connect(); - - int rc = fd_.checkAccess(IFSOpenReq.READ_ACCESS, IFSOpenReq.OPEN_OPTION_FAIL_OPEN); - return (rc == IFSReturnCodeRep.SUCCESS); - // Design note: The QlgAccess() API gives somewhat different results in certain scenarios. - // Using IFSOpenReq appears to be a bit more "thorough". - } - - - /** - Determines if the applet or application can write to the integrated file system object represented by this object. - **/ - public boolean canWrite() - throws IOException, AS400SecurityException - { - // Ensure that we are connected to the server. - fd_.connect(); - - int rc = fd_.checkAccess(IFSOpenReq.WRITE_ACCESS, IFSOpenReq.OPEN_OPTION_FAIL_OPEN); - return (rc == IFSReturnCodeRep.SUCCESS); - // Design note: The QlgAccess() API gives somewhat different results in certain scenarios. - // Using IFSOpenReq appears to be a bit more "thorough". - } - - - /** - Calls QlgAccess() to determine whether the current user can access the file in the specified mode. - If the file does not exist, returns false. - Note: The QlgAccess API was introduced in V5R1. - **/ - private boolean canAccess(int accessMode) - throws IOException, AS400SecurityException - { - // Assume that the caller has already connected to the server. - - if (fd_.getSystemVRM() < 0x00050100) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Server is pre-V5R1, so canAccess() is returning false."); - return false; - } - - // We will call the QlgAccess API, to determine whether the current user can access the file in the specified mode. - // Note: According to the spec for QlgAccess: "If the [user profile] has *ALLOBJ special authority, access() will indicate success for R_OK, W_OK, or X_OK even if none of the permission bits are set." - // Note: QlgAccess() is only _conditionally_ threadsafe. - - boolean result; - try - { - // Create the pgm call object - if (rmtCmd_ == null) { - setupRemoteCommand(); - } - - ProgramParameter[] parameters = new ProgramParameter[] - { - // Parameter 1: Qlg_Path_Name_T *Path_Name (input) : - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, createPathName()), - // Parameter 2: int amode (input) : - new ProgramParameter(ProgramParameter.PASS_BY_VALUE, BinaryConverter.intToByteArray(accessMode)) - }; - - // Call the service program. - byte[] returnedBytes = rmtCmd_.runServiceProgram("QSYS", "QP0LLIB1", "QlgAccess", parameters); - if (returnedBytes == null) - { - Trace.log(Trace.ERROR, "Call to QlgAccess() returned null."); - throw new AS400Exception(rmtCmd_.getMessageList()); - } - - int returnValue = BinaryConverter.byteArrayToInt(returnedBytes, 0); - - switch (returnValue) - { - case -1: // this indicates that we got an "errno" back - { - result = false; - int errno = BinaryConverter.byteArrayToInt(returnedBytes, 4); - switch (errno) - { - case 3025: // ENOENT: "No such path or directory." - // Assume that we got this error because the file isn't a symlink. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Received errno "+errno+" from QlgAccess() for file " + fd_.path_ + ". Assuming that the file does not exist."); - break; - case 3401: // EACCES: "Permission denied." - // Assume that we got this error because we don't have the specified access. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Received errno "+errno+" from QlgAccess() for file " + fd_.path_ + ". Assuming that the user does not have the specified access."); - break; - default: // some other errno - Trace.log(Trace.ERROR, "Received errno "+errno+" from QlgAccess() for file " + fd_.path_); - throw new ExtendedIOException(fd_.path_, ExtendedIOException.UNKNOWN_ERROR, errno); - // Note: An ErrnoException might be more appropriate, but the ErrnoException constructor requires an AS400 object, and we don't have one to give it. - } - break; - } - - case 0: // the call to QlgAccess() was successful. - { - result = true; - break; - } - default: // This should never happen. The API spec says it only returns 0 or -1. - { - Trace.log(Trace.ERROR, "Received unexpected return value " + returnValue + " from QlgAccess() for file " + fd_.path_); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_RETURN_CODE, "QlgAccess()", returnValue); - } - } - } - catch (AS400SecurityException e) { - throw e; - } - catch (IOException e) { - throw e; - } - catch (Exception e) { - Trace.log(Trace.ERROR, "Error while determining accessibility of file.", e); - throw new ExtendedIOException(fd_.path_, ExtendedIOException.UNKNOWN_ERROR); - } - - return result; - } - - - /** - Calls QlgChmod() to reset the access mode for the file. - // If the file does not exist, returns false. - Note: The QlgChmod API was introduced in V5R1. - **/ - public boolean setAccess(int accessType, boolean enableAccess, boolean ownerOnly) - throws IOException, AS400SecurityException - { - // Assume that the caller has already connected to the server. - - // We will call the QlgChmod API, to determine whether the current user can access the file in the specified mode. - // Note: QlgChmod() is only _conditionally_ threadsafe. - - if (fd_.getSystemVRM() < 0x00050100) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Server is pre-V5R1, so setAccess() is not supported."); - return false; - } - - try - { - // Create the pgm call object - if (rmtCmd_ == null) { - setupRemoteCommand(); - } - - // Get the current access modes, so that we can selectively turn on/off the desired bit(s). - int oldAccessMode = getAccess(); - - int bitMask = accessType << 6; // for example: 0000400 == [ 'read' for owner ] - if (!ownerOnly) { - bitMask = bitMask | (accessType << 3) | accessType; - // for example: 0000444 == [ 'read' for owner, group, and other ] - } - - int newAccessMode; - if (enableAccess) { - newAccessMode = oldAccessMode | bitMask; // selectively turn bits _on_ - } - else { // disable access - newAccessMode = oldAccessMode & ~bitMask; // selectively turn bits _off_ - } - newAccessMode = newAccessMode & 0007777; // QlgChmod can only set the low 12 bits - - ProgramParameter[] parameters = new ProgramParameter[] - { - // Parameter 1: Qlg_Path_Name_T *Path_Name (input) : - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, createPathName()), - // Parameter 2: int amode (input) : - new ProgramParameter(ProgramParameter.PASS_BY_VALUE, BinaryConverter.intToByteArray(newAccessMode)) - }; - - // Call the service program. - byte[] returnedBytes = rmtCmd_.runServiceProgram("QSYS", "QP0LLIB1", "QlgChmod", parameters); - if (returnedBytes == null) - { - Trace.log(Trace.ERROR, "Call to QlgChmod() returned null."); - throw new AS400Exception(rmtCmd_.getMessageList()); - } - - int returnValue = BinaryConverter.byteArrayToInt(returnedBytes, 0); - - switch (returnValue) - { - case -1: // this indicates that we got an "errno" back - { - int errno = BinaryConverter.byteArrayToInt(returnedBytes, 4); - Trace.log(Trace.ERROR, "Received errno " + errno + " from QlgChmod() for file " + fd_.path_); - throw new ExtendedIOException(fd_.path_, ExtendedIOException.UNKNOWN_ERROR, errno); - } - - case 0: // the call to QlgChmod() was successful. - { - break; - } - default: // This should never happen. The API spec says it only returns 0 or -1. - { - Trace.log(Trace.ERROR, "Received unexpected return value " + returnValue + " from QlgChmod() for file " + fd_.path_); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_RETURN_CODE, "QlgChmod()", returnValue); - } - } - } - catch (AS400SecurityException e) { - throw e; - } - catch (IOException e) { - throw e; - } - catch (Exception e) { - Trace.log(Trace.ERROR, "Error while determining accessibility of file.", e); - throw new ExtendedIOException(fd_.path_, ExtendedIOException.UNKNOWN_ERROR); - } - - return true; - } - - - /** - Calls QlgStat() to get status information about the file. - If the file does not exist, throws an ObjectDoesNotExistException. - Note: The QlgStat API was introduced in V5R1. Do not call this method without checking VRM. - **/ - private int getAccess() - throws IOException, AS400SecurityException, ObjectDoesNotExistException - { - // Assume that the caller has already connected to the server. - // Assume that the caller has already verified that the server is V5R1 or higher. - - // We will call the QlgStat API, to get status information about the file. - // Note: QlgStat() is only _conditionally_ threadsafe. - - int statInfo = 0; - try - { - // Create the pgm call object - if (rmtCmd_ == null) { - setupRemoteCommand(); - } - - int bufferSizeProvided = 128; // large enough to accommodate a 'stat' structure - - ProgramParameter[] parameters = new ProgramParameter[] - { - // Parameter 1: Qlg_Path_Name_T *Path_Name (input) : - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, createPathName()), - // Parameter 2: struct stat *buf (output) : - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, bufferSizeProvided), - }; - - // Call the service program. - byte[] returnedBytes = rmtCmd_.runServiceProgram("QSYS", "QP0LLIB1", "QlgStat", parameters); - if (returnedBytes == null) - { - Trace.log(Trace.ERROR, "Call to QlgStat() returned null."); - throw new AS400Exception(rmtCmd_.getMessageList()); - } - - int returnValue = BinaryConverter.byteArrayToInt(returnedBytes, 0); - - switch (returnValue) - { - case -1: // this indicates that we got an "errno" back - { - int errno = BinaryConverter.byteArrayToInt(returnedBytes, 4); - switch (errno) - { - case 3025: // ENOENT: "No such path or directory." - // Assume that we got this error because the file isn't a symlink. - Trace.log(Trace.ERROR, "Received errno "+errno+" from QlgStat() for file " + fd_.path_ + ". Assuming that the file does not exist."); - throw new ObjectDoesNotExistException(fd_.path_, ObjectDoesNotExistException.OBJECT_DOES_NOT_EXIST); - case 3401: // EACCES: "Permission denied." - // Assume that we got this error because we don't have the specified access. - Trace.log(Trace.ERROR, "Received errno "+errno+" from QlgStat() for file " + fd_.path_ + ". Assuming that the user does not have permission to access the file."); - throw new AS400SecurityException(fd_.path_, AS400SecurityException.DIRECTORY_ENTRY_ACCESS_DENIED); - default: // some other errno - Trace.log(Trace.ERROR, "Received errno " + errno + " from QlgStat() for file " + fd_.path_); - throw new ExtendedIOException(fd_.path_, ExtendedIOException.UNKNOWN_ERROR, errno); - } - } - - case 0: // the call to QglStat() was successful. - { - // Parse the "file modes" from the returned stat structure (second parameter). - statInfo = parseStatInfo(parameters[1].getOutputData()); - break; - } - default: // This should never happen. The API spec says it only returns 0 or -1. - { - Trace.log(Trace.ERROR, "Received unexpected return value " + returnValue + " from QlgStat() for file " + fd_.path_); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_RETURN_CODE, "QlgStat()", returnValue); - } - } - } - catch (AS400SecurityException e) { - throw e; - } - catch (IOException e) { - throw e; - } - catch (Exception e) { - Trace.log(Trace.ERROR, "Error while determining accessibility of file.", e); - throw new ExtendedIOException(fd_.path_, ExtendedIOException.UNKNOWN_ERROR); - } - - return statInfo; - } - - /** - Clear the cached attributes. This is needed when cached attributes - need to be refreshed. - **/ - public void clearCachedAttributes() //@D9A - { - attributesReply_ = null; - databaseFileAttributes_ = null; - } - - /** - Copies the current file to the specified path. - **/ - public boolean copyTo(String destinationPath, boolean replace) - throws IOException, AS400SecurityException, ObjectAlreadyExistsException - { - fd_.connect(); - if (Trace.traceOn_ && replace==false && fd_.getSystemVRM() < 0x00050300) { - Trace.log(Trace.WARNING, "Server is V5R2 or lower, so the 'Do not replace' argument will be ignored."); - } - - // If the source is a directory, verify that the destination doesn't already exist. - if (isDirectory() == IFSReturnCodeRep.SUCCESS && - exists(destinationPath) == IFSReturnCodeRep.SUCCESS) { - throw new ObjectAlreadyExistsException(destinationPath, ObjectAlreadyExistsException.OBJECT_ALREADY_EXISTS); - } - - return fd_.copyTo(destinationPath, replace); - } - - /** - @D3a created0 is a new method - Determines the time that the integrated file system object represented by this object was created. - **/ - public long created() - throws IOException, AS400SecurityException - { - // Ensure that we are connected to the server. - fd_.connect(); - - long creationDate = 0L; - - - // Attempt to list the attributes of the specified file. - // Note: Do not use cached attributes, since they may be out of date. - IFSListAttrsRep attrs = getAttributeSetFromServer(fd_.path_); - if (attrs != null) - { - attributesReply_ = attrs; - creationDate = attrs.getCreationDate(); - } - - return creationDate; - } - - - - - /** - If file does not exist, create it. If the file - does exist, return an error. The goal is to atomically - create a new file if and only if the file does not - yet exist. - **/ - // @D1 - new method because of changes to java.io.file in Java 2. - - public int createNewFile() - throws IOException, AS400SecurityException - { - // Ensure that we are connected to the server. - fd_.connect(); - - return (fd_.checkAccess(IFSOpenReq.WRITE_ACCESS, IFSOpenReq.OPEN_OPTION_CREATE_FAIL)); - } - - - - - /** - Deletes the integrated file system object represented by this object. - **/ - public int delete() - throws IOException, AS400SecurityException - { - // Ensure that we are connected to the server. - fd_.connect(); - - // Convert the path name to the server CCSID. - byte[] pathname = fd_.converter_.stringToByteArray(fd_.path_); - - // Determine if this is a file or directory and instantiate the - // appropriate type of delete request. - IFSDataStreamReq req = - new IFSDeleteFileReq(pathname, fd_.preferredServerCCSID_); - try - { - if (isDirectory() == IFSReturnCodeRep.SUCCESS) - { - req = new IFSDeleteDirReq(pathname, fd_.preferredServerCCSID_); - } - } - catch (Exception e) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, - "Unable to determine if file or directory.\n" + e.toString()); - } - - // Delete this entry. - ClientAccessDataStream ds = null; - try - { - // Send a delete request. - ds = (ClientAccessDataStream) fd_.server_.sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost."); - fd_.connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted"); - throw new InterruptedIOException(e.getMessage()); - } - - // Verify that the request was successful. - int rc = 0; - if (ds instanceof IFSReturnCodeRep) - { - rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc != IFSReturnCodeRep.SUCCESS) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", rc); - } - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN, - Integer.toHexString(ds.getReqRepID())); - } - - // Clear any cached file attributes. - attributesReply_ = null; - - return (rc); - } - - //@B1A Moved code from isDirectory() to support determining if a file is a directory - //without a call to the server. - /** - Determines if a file is a directory without a call to the server. - **/ - private boolean determineIsDirectory(IFSListAttrsRep attributeList) - { - boolean answer = false; - // Determine if the file attributes indicate a directory. - // Don't need to check if attributeList == null because it has already been - // checked by the two methods that call it. Also don't check converter - // because it is set by a connect() method before calling this. - -// String name = fd_.converter_.byteArrayToString(attributeList.getName(/*fd_.serverDatastreamLevel_*/)); - switch (attributeList.getObjectType()) - { - case IFSListAttrsRep.DIRECTORY: - case IFSListAttrsRep.FILE: - answer = ((attributeList.getFixedAttributes() & IFSListAttrsRep.FA_DIRECTORY) != 0); - break; -// * Deleted the following case... treat as default (false) @D8A -// * For example, OUTQ, DSPF, PRTF, and TAPF objects are NOT directories @D8A -// * LIB, PF, LF, SRCPF are returned as IFSListAttrsRep.DIRECTORY @D8A -// * SAVF is returned as IFSListAttrsRep.FILE @D8A -// case IFSListAttrsRep.AS400_OBJECT: @D8D -// // Server libraries and database files look like directories @D8D -// String nameUpper = name.toUpperCase(); // @C2a @D8D -// answer = (nameUpper.endsWith(".LIB") || @D8D -// nameUpper.endsWith(".FILE")); //B1C Changed path_ to name @D8D -// //@C2c -// //@B1D Removed code that checked for file separators -// //|| path_.endsWith(".LIB" + IFSFile.separator) || -// //path_.endsWith(".FILE" + IFSFile.separator)); -// break; @D8D*/ - default: - answer = false; - } - return answer; - } - - //@B1A Moved code from isFile() to support determining if a file is a file - //without a call to the server. - /** - Determines if a file is a file without a call to the server. - **/ - private boolean determineIsFile(IFSListAttrsRep attributeList) - { - boolean answer = false; - // Determine if the file attributes indicate a file. - // Don't need to check if attributeList == null because it has already been - // checked by the two methods that call it. Also don't check converter - // because it is set by a connect() method before calling this. - -// String name = fd_.converter_.byteArrayToString(attributeList.getName(/*fd_.serverDatastreamLevel_*/)); - switch(attributeList.getObjectType()) - { - case IFSListAttrsRep.DIRECTORY: - case IFSListAttrsRep.FILE: - answer = ((attributeList.getFixedAttributes() & IFSListAttrsRep.FA_DIRECTORY) == 0); - break; -// * Deleted the following case... treat as default (false) @D8A -// * For example, OUTQ, DSPF, PRTF, and TAPF objects are NOT files @D8A -// * LIB, PF, LF, SRCPF are returned as IFSListAttrsRep.DIRECTORY @D8A -// * SAVF is returned as IFSListAttrsRep.FILE @D8A -// case IFSListAttrsRep.AS400_OBJECT: @D8D -// //Server libraries and database files look like directories. -// String nameUpper = name.toUpperCase(); // @C2a @D8D -// answer = !(nameUpper.endsWith(".LIB") || @D8D -// nameUpper.endsWith(".FILE")); //B1C Changed path_ to name @D8D -// //@C2c -// //@B1D Removed code that checked for file separators -// //|| path_.endsWith(".LIB" + IFSFile.separator) || -// //path_.endsWith(".FILE" + IFSFile.separator)); -// break; @D8D*/ - default: - answer = false; - } - return answer; - } - - /** - Determines if the integrated file system object represented by this object exists. - **/ - public int exists() - throws IOException, AS400SecurityException - { - return exists(fd_.path_); - } - - - //@B4a - /** - Determines if the integrated file system object represented by this object exists. - **/ - private int exists(String name) - throws IOException, AS400SecurityException - { - int returnCode = IFSReturnCodeRep.SUCCESS; - - // Ensure that we are connected to the server. - fd_.connect(); - - returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - // Attempt to list the attributes of the specified file. - try - { - IFSListAttrsRep attrs = getAttributeSetFromServer(name); - if (attrs != null) - { - returnCode = IFSReturnCodeRep.SUCCESS; - attributesReply_ = attrs; - } - } - catch (AS400SecurityException e) - { - returnCode = IFSReturnCodeRep.ACCESS_DENIED_TO_DIR_ENTRY; - // Note: This is consistent with the behavior of java.io.File on IBM JVMs. - // On IBM i, java.io.File.exists() returns false if the profile is denied access to the file being queried. - } - - return (returnCode); - // Design note: - // The QlgAccess() API gives somewhat different results in certain scenarios. - // For example, in one test it returned 'true' when the directory didn't exist. - // Using IFSListAttrsReq appears to be more reliable. - } - - - /** - Returns the path name of the integrated file system object represented by this object. This is the full path starting at the root directory. - @return The absolute path name of this integrated file system object. - **/ - String getAbsolutePath() - { - return fd_.path_; - } - - - /** - Get a list attribute reply from the server for a single entity (get the attributes - of a specific object, not the attributes of every file in a directory). - **/ - // @D1 - new method because of changes to java.io.file in Java 2. - - private IFSListAttrsRep getAttributeSetFromServer(String filePath) - throws IOException, AS400SecurityException - { - IFSListAttrsRep reply = null; - - // Attempt to list the attributes of the specified file. - Vector replys = listAttributes(filePath, NO_MAX_GET_COUNT, null, NO_RESTART_NAME, !SORT_LIST); - // Note: This does setFD() on each returned IFSListAttrsRep. - - // If this is a directory then there must be exactly one reply. - if (replys != null && replys.size() == 1) - { - reply = (IFSListAttrsRep) replys.elementAt(0); - } - - return reply; - } - - - // @B4a - /** - Returns the file's data CCSID. Returns -1 if failure or if directory. - **/ - public int getCCSID() - throws IOException, AS400SecurityException - { - fd_.connect(); - return fd_.getCCSID(); - } - - - private static final boolean SPACE_AVAILABLE = true; - private static final boolean SPACE_TOTAL = false; - /** - Determines the amount of unused storage space in the file system. - @param forUserOnly Whether to report only the space for the user. If false, report space in entire file system. - @return The number of bytes of storage available. - Returns special value Long.MAX_VALUE if the system reports "no maximum". - **/ - public long getAvailableSpace(boolean forUserOnly) - throws IOException, AS400SecurityException - { - long spaceAvailable = getAmountOfSpace(forUserOnly, SPACE_AVAILABLE); - - // Design note: When querying the space available for a specific user, - // the File Server team advises us to make two queries: - // First query the space available to the user (within the user profile's "Maximum Storage Allowed" limit). - // Then query the total space available in the file system. - // The smaller of the two values is what we should then report to the application. - if (forUserOnly) - { - long spaceAvailableInFileSystem = getAmountOfSpace(false, SPACE_AVAILABLE); - spaceAvailable = Math.min(spaceAvailable, spaceAvailableInFileSystem); - } - - return spaceAvailable; - } - - - /** - Determines the total amount of storage space in the file system. - @param forUserOnly Whether to report only the space for the user. If false, report space in entire file system. - @return The number of bytes of storage. - Returns special value Long.MAX_VALUE if the system reports "no maximum". - **/ - public long getTotalSpace(boolean forUserOnly) - throws IOException, AS400SecurityException - { - return getAmountOfSpace(forUserOnly, SPACE_TOTAL); - } - - - /** - Returns the amount of storage space. - @param forUserOnly Whether to report only the space for the user. If false, report space in entire file system. - @param availableSpaceOnly Whether to report only the space available. If false, report total space, rather than just available space. - @return The number of bytes of storage. - Returns special value Long.MAX_VALUE if the system reports "no maximum". - **/ - private long getAmountOfSpace(boolean forUserOnly, boolean availableSpaceOnly) - throws IOException, AS400SecurityException - { - // Ensure that we are connected to the server. - fd_.connect(); - - long amountOfSpace = 0L; - int directoryHandle; - ClientAccessDataStream ds = null; - int rc = 0; - - if (forUserOnly) // prepare to get space info for specific user - { - // Special value for file handle, indicating that space attributes for the user should be retrieved, rather than space attributes of the file system. - // According to the PWSI Datastream Spec: - // "When the client sends 0 as the working directory handle ... the space characteristics of the user are returned instead of the characteristics of the system." - directoryHandle = 0; - } - else // prepare to get space info for the entire file system - { - // To query the file system, we need to specify a "working directory handle" to the directory. So first, get a handle. - String path = fd_.path_; - if (isDirectory() != IFSReturnCodeRep.SUCCESS) { - path = IFSFile.getParent(fd_.path_); - } - byte[] pathname = fd_.getConverter().stringToByteArray(path); - try - { - // Issue a Create Working Directory Handle request. - IFSCreateDirHandleReq req = new IFSCreateDirHandleReq(pathname, fd_.preferredServerCCSID_); - ds = (ClientAccessDataStream) fd_.server_.sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost."); - fd_.connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted"); - throw new InterruptedIOException(e.getMessage()); - } - - // Verify that we got a handle back. - rc = 0; - if (ds instanceof IFSCreateDirHandleRep) - { - directoryHandle = ((IFSCreateDirHandleRep) ds).getHandle(); - } - else if (ds instanceof IFSReturnCodeRep) - { - rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc != IFSReturnCodeRep.SUCCESS) - { - Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", rc); - } - throw new ExtendedIOException(fd_.path_, rc); - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", - ds.getReqRepID()); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - - // Query the amount of space. - ds = null; - try - { - // Issue a query space request. - IFSQuerySpaceReq req = new IFSQuerySpaceReq(directoryHandle); - ds = (ClientAccessDataStream) fd_.server_.sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost."); - fd_.connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted"); - throw new InterruptedIOException(e.getMessage()); - } - - // Verify the reply. - rc = 0; - if (ds instanceof IFSQuerySpaceRep) - { - if (availableSpaceOnly) { - amountOfSpace = ((IFSQuerySpaceRep) ds).getSpaceAvailable(); - } - else { - amountOfSpace = ((IFSQuerySpaceRep) ds).getTotalSpace(); - } - } - else if (ds instanceof IFSReturnCodeRep) - { - rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc != IFSReturnCodeRep.SUCCESS) - { - Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", rc); - } - throw new ExtendedIOException(fd_.path_, rc); - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", - ds.getReqRepID()); - throw new - InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN, - Integer.toHexString(ds.getReqRepID())); - } - - return amountOfSpace; - } - - - /** - Returns the name of the user profile that is the owner of the file. - Returns "" if called against a directory. - **/ - public String getOwnerName() - throws IOException, AS400SecurityException - { - // Design note: This method demonstrates how to get attributes that are returned in the OA1* structure (as opposed to the OA2). - String ownerName = null; - - fd_.connect(); - // The 'owner name' field is in the OA1 structure; the flag is in the first Flags() field. - try - { - IFSListAttrsRep reply = fd_.listObjAttrs1(IFSObjAttrs1.OWNER_NAME_FLAG, 0); - if (reply != null) { - ownerName = reply.getOwnerName(fd_.system_.getCcsid()); - } - else { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "getOwnerName: " + - "IFSReturnCodeRep return code", fd_.errorRC_); - if (fd_.errorRC_ == IFSReturnCodeRep.FILE_NOT_FOUND || - fd_.errorRC_ == IFSReturnCodeRep.PATH_NOT_FOUND) - { - throw new ExtendedIOException(fd_.path_, ExtendedIOException.PATH_NOT_FOUND); - } - } - } - catch (ExtendedIOException e) { - if (e.getReturnCode() == ExtendedIOException.DIR_ENTRY_EXISTS) { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Unable to determine owner of directory.", e); - } - else throw e; - } - - return (ownerName == null ? "" : ownerName); - } - - - // Design note: The following is an alternative implementation of getOwnerName(), using the Qp0lGetAttr API. - -// /** -// Returns the name of the user profile that is the owner of the file. -// Returns null if *NOUSRPRF or if error. -// **/ -// private String getOwnerName(AS400 system) -// throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException -// { -// String ownerName = null; -// int pathnameCCSID = fd_.converter_.getCcsid(); -// ProgramParameter[] parms = new ProgramParameter[7]; -// -// // -// // Parameter 0 (input, reference): The "path name" structure. -// -// ByteArrayOutputStream baos = new ByteArrayOutputStream(600); -// byte[] zeros = { (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, -// (byte)0, (byte)0, (byte)0, (byte)0, (byte)0 }; -// // BINARY(4): CCSID of pathname and path delimiter -// baos.write(BinaryConverter.intToByteArray(pathnameCCSID),0,4); -// // CHAR(2): Country or region ID. X'0000' == Use the current job country or region ID. -// baos.write(zeros,0,2); -// // CHAR(3): Language ID. X'000000' == Use the current job language ID. -// baos.write(zeros,0,3); -// // CHAR(3): Reserved. Must be set to hexadecimal zeros. -// baos.write(zeros,0,3); -// // BINARY(4): Path type indicator. 0 == The path name is a character string, and the path name delimiter character is 1 character long. -// baos.write(zeros,0,4); -// // BINARY(4): Length of path name (in bytes). -// byte[] pathnameBytes = fd_.getPathnameAsBytes(); -// baos.write(BinaryConverter.intToByteArray(pathnameBytes.length),0,4); -// // CHAR(2): Path name delimiter character. -// baos.write(fd_.converter_.stringToByteArray("/"),0,2); -// // CHAR(10): Reserved. Must be set to hexadecimal zeros. -// baos.write(zeros,0,10); -// // CHAR(*): Path name. -// baos.write(pathnameBytes, 0, pathnameBytes.length); -// -// parms[0] = new ProgramParameter(baos.toByteArray()); -// setPassByReference(parms[0]); -// -// // -// // Parameter 1 (input, reference): The attribute identifiers array. -// -// baos.reset(); -// // BINARY(4): Number of requested attributes. -// baos.write(BinaryConverter.intToByteArray(1),0,4); -// // BINARY(4): Attribute identifier. 11 == QP0L_ATTR_AUTH, public/private authorities -// baos.write(BinaryConverter.intToByteArray(11),0,4); -// parms[1] = new ProgramParameter(baos.toByteArray()); -// setPassByReference(parms[1]); -// -// // -// // Parameter 2 (input, reference): Buffer for the returned attribute values. -// parms[2] = new ProgramParameter(64); -// setPassByReference(parms[2]); -// -// // -// // Parameter 3 (input): Buffer size provided. -// parms[3] = new ProgramParameter(BinaryConverter.intToByteArray(64)); -// -// // -// // Parameter 4 (output, reference): Buffer size needed. -// parms[4] = new ProgramParameter(4); -// setPassByReference(parms[4]); -// -// // -// // Parameter 5 (output, reference): Number of bytes returned. -// parms[5] = new ProgramParameter(4); -// setPassByReference(parms[5]); -// -// // Parameter 6 (input): Follow symlink. 0 == Do not follow symlink; 1 == follow symlink -// boolean followSymlink = false; // this should probably be a parameter on the method -// int follow = (followSymlink ? 1 : 0); -// parms[6] = new ProgramParameter(BinaryConverter.intToByteArray(follow)); -// -// ServiceProgramCall spc = new ServiceProgramCall(system, "/QSYS.LIB/QP0LLIB2.SRVPGM", "Qp0lGetAttr", ServiceProgramCall.RETURN_INTEGER, parms); -// //pc.suggestThreadsafe(true); -// -// if (!spc.run()) { -// throw new AS400Exception(spc.getMessageList()); -// } -// -// // Check the returned byte counts. -// int bufSizeNeeded = BinaryConverter.byteArrayToInt(parms[4].getOutputData(), 0); -// int numBytesReturned = BinaryConverter.byteArrayToInt(parms[5].getOutputData(), 0); -// -// // The 'Object Owner' field is the CHAR(10) at offset 16 in the output data. -// byte[] outputData = parms[2].getOutputData(); -// -// int ccsid = fd_.system_.getCcsid(); // system CCSID (usually EBCDIC) -// ConvTable conv = ConvTable.getTable(ccsid, null); -// ownerName = conv.byteArrayToString(outputData, 16, 10).trim(); -// if (ownerName.equals("*NOUSRPRF")) ownerName = null; -// -// return ownerName; -// } - - - // @B7a - /** - Returns the file's owner's "user ID" number. - Returns -1 if error. - **/ - public long getOwnerUID() - throws IOException, AS400SecurityException // @C0c - { - fd_.connect(); - IFSListAttrsRep reply = fd_.listObjAttrs2(); // the "owner UID" field is in the OA2 structure - if (reply != null) - { - return reply.getOwnerUID(); - } - else return -1L; // @C0c - } - - - /** - Returns the path of the integrated file system object that is directly pointed to by the symbolic link represented by this object. Returns null if the file is not a symbolic link, does not exist, or is in an unsupported file system. -

    - This method is not supported for files in the following file systems: -

      -
    • QSYS.LIB -
    • Independent ASP QSYS.LIB -
    • QDLS -
    • QOPT -
    • QNTC -
    - - @return The path directly pointed to by the symbolic link, or null if the IFS object is not a symbolic link or does not exist. Depending on how the symbolic link was defined, the path may be either relative or absolute. - - @exception IOException If an error occurs while communicating with the system. - @exception AS400SecurityException If a security or authority error occurs. - **/ - public String getPathPointedTo() - throws IOException, AS400SecurityException - { - // Ensure that we are connected to the server. - fd_.connect(); - - // We will call the QlgReadlink API, to determine the path of the immediately pointed-to file. Note that QlgReadlink is only _conditionally_ threadsafe. - - String resolvedPathname = null; - try - { - // Create the pgm call object - if (rmtCmd_ == null) { - setupRemoteCommand(); - } - - int bufferSizeProvided = 1024; // large enough for most anticipated paths - - ProgramParameter[] parameters = new ProgramParameter[] - { - // Parameter 1: Qlg_Path_Name_T *path (input) : - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, createPathName()), - // Parameter 2: Qlg_Path_Name_T *buf (output) : - new ProgramParameter(ProgramParameter.PASS_BY_REFERENCE, bufferSizeProvided), - // Parameter 3: size_t bufsiz (input) : - new ProgramParameter(ProgramParameter.PASS_BY_VALUE, BinaryConverter.intToByteArray(bufferSizeProvided)) - }; - - final int HEADER_LENGTH = 32; // fixed header of returned Qlg_Path_Name_T structure - - boolean repeatRun; - do - { - repeatRun = false; - // Call the service program. - byte[] returnedBytes = rmtCmd_.runServiceProgram("QSYS", "QP0LLIB1", "QlgReadlink", parameters); - if (returnedBytes == null) - { - Trace.log(Trace.ERROR, "Call to QlgReadlink() returned null."); - throw new AS400Exception(rmtCmd_.getMessageList()); - } - - int returnValue = BinaryConverter.byteArrayToInt(returnedBytes, 0); - - if (returnValue == -1) // this indicates that we got an "errno" back - { - int errno = BinaryConverter.byteArrayToInt(returnedBytes, 4); - switch (errno) - { - case 3021: // EINVAL: "The value specified for the argument is not correct." - // Assume that we got this error because the file isn't a symlink. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Received errno "+errno+" from QlgReadlink() for file " + fd_.path_ + ". Assuming that the file is not a symbolic link."); - break; - case 3025: // ENOENT: "No such path or directory." - // Assume that we got this error because the file isn't a symlink. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Received errno "+errno+" from QlgReadlink() for file " + fd_.path_ + ". Assuming that the file does not exist."); - break; - default: // some other errno - Trace.log(Trace.ERROR, "Received errno " + errno + " from QlgReadlink() for file " + fd_.path_); - throw new ExtendedIOException(fd_.path_, ExtendedIOException.UNKNOWN_ERROR, errno); - } - } - - else if ((returnValue + HEADER_LENGTH) > bufferSizeProvided) - { - repeatRun = true; - // Note: returnValue is number of bytes required to hold complete path. - int bufferSizeNeeded = returnValue + HEADER_LENGTH; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "QlgReadlink() buffer too small. Buffer size provided: " + bufferSizeProvided + ". Buffer size needed: " + bufferSizeNeeded+". Calling QlgReadLink() with larger buffer."); - bufferSizeProvided = bufferSizeNeeded; - parameters[1].setOutputDataLength(bufferSizeProvided); - parameters[2].setInputData(BinaryConverter.intToByteArray(bufferSizeProvided)); - } - - else // We allocated a sufficiently large buffer for the returned data. - { - // Parse the pathname from the returned pathname structure (second parameter). - resolvedPathname = parsePathName(parameters[1].getOutputData()); - } - } - while (repeatRun); - } // try - catch (AS400SecurityException e) { - throw e; - } - catch (IOException e) { - throw e; - } - catch (Exception e) { - Trace.log(Trace.ERROR, "Error while resolving symbolic link.", e); - throw new ExtendedIOException(fd_.path_, ExtendedIOException.UNKNOWN_ERROR); - } - - return resolvedPathname; - } - - -// -// Path name structure for QlgAccess(): -// -// 0 INPUT BINARY(4) CCSID -// 4 INPUT CHAR(2) Country or region ID -// 6 INPUT CHAR(3) Language ID -// 9 INPUT CHAR(3) Reserved -// 12 INPUT BINARY(4) Path type indicator -// 16 INPUT BINARY(4) Length of path name -// 20 INPUT CHAR(2) Path name delimiter character -// 22 INPUT CHAR(10) Reserved -// 32 INPUT CHAR(*) Path name -// -// -// Value of "path type indicator" field: -// 2: The path name is a character string, and the path name delimiter character is 2 characters long. -// - - - // Utility method to convert String path into path name parameter used by the QlgAccess() API. - private byte[] createPathName() throws IOException - { - ConverterImplRemote conv = new ConverterImplRemote(); - conv.setCcsid(1200, fd_.system_); - int pathLength = fd_.path_.length(); // number of Unicode chars - - byte[] buf = new byte[32 + pathLength * 2]; // 2 bytes per Unicode char - BinaryConverter.intToByteArray(1200, buf, 0); // CCSID - BinaryConverter.intToByteArray(2, buf, 12); // path type indicator - BinaryConverter.intToByteArray(pathLength * 2, buf, 16); // length of path name (#bytes) - conv.stringToByteArray("/", buf, 20, 2); // path name delimiter - conv.stringToByteArray(fd_.path_, buf, 32); // path name - return buf; - } - - - // Utility method to parse the path name parameter returned by the QlgAccess() API. - private String parsePathName(byte[] buf) throws IOException - { - ConverterImplRemote conv = new ConverterImplRemote(); - conv.setCcsid(1200, fd_.system_); - int offset = 0; - int nameLength; - if (DEBUG) - { - System.out.println("Buffer length: " + buf.length); - System.out.println("CCSID: " + BinaryConverter.byteArrayToInt(buf, offset)); - offset += 4; - //System.out.println("Country: " + conv.byteArrayToString(buf, offset, 2)); - offset += 2; - //System.out.println("LangID: " + conv.byteArrayToString(buf, offset, 3)); - offset += 3; - offset += 3; // reserved field - System.out.println("Path type: " + BinaryConverter.byteArrayToInt(buf, offset)); - offset += 4; - nameLength = BinaryConverter.byteArrayToInt(buf, offset); - System.out.println("Path name length: " + nameLength); - offset += 4; - System.out.println("Delimiter: " + conv.byteArrayToString(buf, offset, 2)); - offset += 2; - offset += 10; // reserved field - } - else { - offset += 16; - nameLength = BinaryConverter.byteArrayToInt(buf, offset); - offset += 16; - } - - // We will assume that the caller has verified that the buffer was big enough to accommodate the returned data. - String pathname = conv.byteArrayToString(buf, offset, nameLength); - return pathname; - } - - - // Utility method to parse the structure returned by the QlgStat() API. - private int parseStatInfo(byte[] buf) throws IOException - { - ConverterImplRemote conv = new ConverterImplRemote(); - conv.setCcsid(37, fd_.system_); // always EBCDIC - - int fileMode = BinaryConverter.byteArrayToInt(buf, 0); - return fileMode; - - -// This is for future reference, in case we ever want to exploit other returned fields. -// Note that the QlgStat structure is specified in system header files stat.h and types.h -// -// int offset = 0; -// System.out.println("File mode (octal): " + Integer.toOctalString(fileMode) ); -// offset += 4; -// System.out.println("File serial number: " + BinaryConverter.byteArrayToInt(buf, offset)); -// offset += 4; -// System.out.println("Number of links: " + BinaryConverter.byteArrayToShort(buf, offset)); -// offset += 2; -// offset += 2; // reserved field -// System.out.println("UID of owner: " + BinaryConverter.byteArrayToInt(buf, offset)); -// offset += 4; -// System.out.println("Group ID: " + BinaryConverter.byteArrayToInt(buf, offset)); -// offset += 4; -// System.out.println("File size (#bytes): " + BinaryConverter.byteArrayToInt(buf, offset)); -// offset += 4; -// System.out.println("Time of last access: " + BinaryConverter.byteArrayToInt(buf, offset)); -// offset += 4; -// System.out.println("Time of last mod: " + BinaryConverter.byteArrayToInt(buf, offset)); -// offset += 4; -// System.out.println("Time of status chg: " + BinaryConverter.byteArrayToInt(buf, offset)); -// offset += 4; -// System.out.println("Device ID: " + BinaryConverter.byteArrayToInt(buf, offset)); -// offset += 4; -// System.out.println("Block size (#bytes): " + BinaryConverter.byteArrayToInt(buf, offset)); -// offset += 4; -// System.out.println("Allocation size (#bytes): " + BinaryConverter.byteArrayToInt(buf, offset)); -// offset += 4; -// System.out.println("Object type: " + conv.byteArrayToString(buf, offset, 10)); // field is 11 characters, null-terminated, so exclude the final null -// offset += 11; -// offset += 1; // reserved -// System.out.println("Data codepage: " + BinaryConverter.byteArrayToShort(buf, offset)); -// offset += 2; -// System.out.println("Data CCSID: " + BinaryConverter.byteArrayToShort(buf, offset)); -// offset += 2; -// System.out.println("Device ID: " + BinaryConverter.byteArrayToInt(buf, offset)); -// offset += 4; -// System.out.println("Number of links: " + BinaryConverter.byteArrayToInt(buf, offset)); -// offset += 4; -// System.out.println("Device ID (64bit): " + BinaryConverter.byteArrayToLong(buf, offset)); -// offset += 8; -// System.out.println("File system ID (64bit): " + BinaryConverter.byteArrayToLong(buf, offset)); -// offset += 8; -// System.out.println("Mount ID: " + BinaryConverter.byteArrayToInt(buf, offset)); -// offset += 4; -// offset += 32; // reserved -// System.out.println("Serial# gen ID: " + BinaryConverter.byteArrayToInt(buf, offset)); - } - - - // @B5a - // Returns zero-length string if the file has no subtype. - public String getSubtype() - throws IOException, AS400SecurityException - { - String subtype = ""; - - // Ensure that we are connected to the server. - fd_.connect(); - - // Convert the path name to the server CCSID. - byte[] pathname = fd_.converter_.stringToByteArray(fd_.path_); - - boolean needCodePage; - if (fd_.getSystemVRM() >= 0x00060100 && - fd_.path_.indexOf("/QSYS.LIB") != -1) { - needCodePage = true; - } - else needCodePage = false; - - // Prepare the List Attributes request. - - // Set up the list of Extended Attributes Names. - byte[] eaName_TYPE = fd_.converter_.stringToByteArray(".TYPE"); - int eaNameBytesLength; - byte[][] eaNamesList; - // Special handling for QSYS files, starting in V6R1. - // Starting in V6R1, for QSYS files, the ".TYPE" EA value field is returned in the CCSID of the object. - // Prior to V6R1, the field is always returned in EBCDIC. - if (needCodePage) - { - byte[] eaName_CODEPAGE = fd_.converter_.stringToByteArray(".CODEPAGE"); - eaNameBytesLength = eaName_TYPE.length + eaName_CODEPAGE.length; - eaNamesList = new byte[][] { eaName_TYPE, eaName_CODEPAGE }; - } - else // not in QSYS, or pre-V6R1 - { - eaNameBytesLength = eaName_TYPE.length; - eaNamesList = new byte[][] { eaName_TYPE }; - } - - IFSListAttrsReq req = new IFSListAttrsReq(pathname, fd_.preferredServerCCSID_, - IFSListAttrsReq.NO_AUTHORITY_REQUIRED, NO_MAX_GET_COUNT, - null, false, eaNamesList, eaNameBytesLength, false, fd_.patternMatching_); // @C3c - - Vector replys = fd_.listAttributes(req); - - // Verify that we got at least one reply. - if (replys == null) { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Received null from listAttributes(req)."); - } - else if (replys.size() == 0) { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Received no replies from listAttributes(req)."); - } - else - { - if (replys.size() > 1) { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Received multiple replies from listAttributes(req) (" + - replys.size() + ")"); - } - IFSListAttrsRep reply = (IFSListAttrsRep)replys.elementAt(0); - Hashtable extendedAttributes = reply.getExtendedAttributeValues(); - byte[] subtypeAsBytes = (byte[])extendedAttributes.get(".TYPE"); - if (subtypeAsBytes != null) - { - int ccsid; - if (!needCodePage) { - ccsid = 37; // the returned bytes are in EBCDIC - } - else { - // Get the ".CODEPAGE" extended attribute value from the reply. - byte[] codepageAsBytes = (byte[])extendedAttributes.get(".CODEPAGE"); - // The .CODEPAGE attribute is returned as 2 bytes in little-endian format. - // Therefore we need to swap the bytes. - byte[] swappedBytes = new byte[2]; // the codepage is returned in 2 bytes - swappedBytes[0] = codepageAsBytes[1]; - swappedBytes[1] = codepageAsBytes[0]; - ccsid = BinaryConverter.byteArrayToUnsignedShort(swappedBytes,0); - if (ccsid == 1400) ccsid = 1200; // codepage 1400 corresponds to CCSID 1200 - } - try { - subtype = (new CharConverter(ccsid)).byteArrayToString(subtypeAsBytes, 0).trim(); - } - catch (java.io.UnsupportedEncodingException e) { - Trace.log(Trace.ERROR, "Unrecognized codepage returned: " + ccsid, e); - subtype = "??"; - } - } - } - return subtype; - } - - - /** - Determines if the file is a "source physical file". - **/ - public boolean isSourcePhysicalFile() - throws IOException, AS400SecurityException, AS400Exception - { - // Assume that the caller has verified that the file is a Physical File in QSYS. - - // Layout of first 2 attribute bytes returned in FILD0100 format: - // - // BIT(2): Reserved. - // BIT(1): Type of file. If on, the file is a logical database file. - // If off, a physical database file. - // BIT(1): Reserved. - // BIT(1): File type (FILETYPE). If on, the file is a source file (*SRC). - // If off, a data file (*DATA). - // BIT(1): Reserved. - // BIT(1): Access path. If on, the file has a keyed sequence access path. - // If off, an arrival sequence access path. - // BIT(1): Reserved. - // BIT(1): Record format level check (LVLCHK). - // If on, the record format level identifiers are checked when the file is opened (*YES). - // If off, they are not checked when the file is opened (*NO). - // BIT(1): Select/omit. If on, the file is a select/omit logical file. - // BIT(4): Reserved. - // BIT(1): Double-byte character set (DBCS) or Graphic data. - // If on, the file's record format(s) contains DBCS or Graphic data fields. - // BIT(1): Double-byte character set (DBCS) or Graphic literals. - // If on, the file's record format(s) contains DBCS or Graphic literals. - // - - // Examine the FILETYPE bit (the 12th bit from the right). - // If the bit is on, that indicates the file is a source file (*SRC). - // If the bit is off, that indicates the file is a data file (*DATA). - int attributeFlags = retrieveDatabaseFileAttributes(); - return ((attributeFlags & 0x00000800) != 0); // 12th bit from the right - } - - /** - Call QDBRTVFD (if necessary) to get additional status information about the file. - If the file does not exist, throws an ObjectDoesNotExistException. - **/ - private int retrieveDatabaseFileAttributes() throws IOException, AS400SecurityException, AS400Exception - { - if (databaseFileAttributes_ == null) - { - try - { - int bufferSizeProvided = 400; // the FILD0100-format structure occupies 400 bytes - ProgramParameter[] parameters = new ProgramParameter[] - { - // Receiver variable, Output, Char(*) - new ProgramParameter(bufferSizeProvided), - // Length of receiver variable, Input, Binary(4) - new ProgramParameter(BinaryConverter.intToByteArray(bufferSizeProvided)), - // Qualified returned file name, Output, Char(20) - new ProgramParameter(20), - // Format name, Input, Char(8) : EBCDIC 'FILD0100' - new ProgramParameter(new byte[] { (byte)0xC6, (byte)0xC9, (byte)0xD3, (byte)0xC4, (byte)0xF0, (byte)0xF1, (byte)0xF0, (byte)0xF0 } ), - // Qualified file name, Input, Char(20) : fileName + libraryName - new ProgramParameter(composeQualifiedNameBytes()), - // Record format name, Input, Char(10) : 10 EBCDIC blanks - new ProgramParameter(new byte[] { (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40 } ), - // Override processing, Input, Char(1) : EBCDIC '0' (no override processing) - new ProgramParameter(new byte[] { (byte)0xF0 } ), - // System, Input, Char(10) : EBCDIC '*LCL' (local files only) - new ProgramParameter(new byte[] { (byte)0x5C, (byte)0xD3, (byte)0xC3, (byte)0xD3, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40 } ), - // Format type, Input, Char(10) : EBCDIC '*INT' - new ProgramParameter(new byte[] { (byte)0x5C, (byte)0xC9, (byte)0xD5, (byte)0xE3, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40 } ), - // Error Code, I/O, Char(*) - new ErrorCodeParameter() - }; - - // Create the pgm call object - if (rmtCmd_ == null) { - setupRemoteCommand(); - } - - if (!rmtCmd_.runProgram("QSYS", "QDBRTVFD", parameters)) // conditionally threadsafe - { - throw new AS400Exception(rmtCmd_.getMessageList()); - } - - byte[] outputData = parameters[0].getOutputData(); - int bytesReturned = BinaryConverter.byteArrayToInt(outputData, 0); - if (bytesReturned < 10) - { - Trace.log(Trace.ERROR, "Insufficient output bytes returned from QDBRTVFD: " + bytesReturned); - throw new InternalErrorException(fd_.path_, InternalErrorException.UNKNOWN); - } - - // Grab the "attribute bytes". These are the 2 bytes starting at offset 8. - databaseFileAttributes_ = new Integer(BinaryConverter.byteArrayToUnsignedShort(outputData, 8)); - } - catch (AS400Exception e) { - throw e; - } - catch (AS400SecurityException e) { - throw e; - } - catch (IOException e) { - throw e; - } - catch (Exception e) { - Trace.log(Trace.ERROR, "Error while retrieving database file attributes.", e); - throw new ExtendedIOException(fd_.path_, ExtendedIOException.UNKNOWN_ERROR); - } - } - - return databaseFileAttributes_.intValue(); - } - - // Setup qualified file name program parameter object on first touch. Synchronized to protect instance variables. This method can safely be called multiple times because it checks for a previous call before changing the instance variables. - private synchronized byte[] composeQualifiedNameBytes() throws IOException - { - // If not already setup. - if (qualifiedFileName_ == null) - { - CharConverter converter = new CharConverter(37); // converts Unicode chars to EBCDIC bytes - - // Start with 20 EBCDIC spaces. - qualifiedFileName_ = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - - // Parse out the library and filename from the path. - QSYSObjectPathName qsysPath = new QSYSObjectPathName(fd_.path_); - String libraryName = qsysPath.getLibraryName(); - String fileName = qsysPath.getObjectName(); - - // Put the converted file name at the beginning of the array. - converter.stringToByteArray(fileName, qualifiedFileName_, 0); - // Put the converted library name at position ten. - converter.stringToByteArray(libraryName, qualifiedFileName_, 10); - } - - return qualifiedFileName_; - } - - - /** - Determines if the integrated file system object represented by this object is a directory. - **/ - public int isDirectory() - throws IOException, AS400SecurityException - { - // Ensure that we are connected to the server. - fd_.connect(); - - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - - if (attributesReply_ == null) - { - attributesReply_ = getAttributeSetFromServer(fd_.path_); - } - - //@B1A Added code to call determineIsDirectory(). - if (attributesReply_ != null) - { - if (determineIsDirectory(attributesReply_)) - returnCode = IFSReturnCodeRep.SUCCESS; - } - - return returnCode; - } - - - /** - Determines if the integrated file system object represented by this object is a "normal" file.
    - A file is "normal" if it is not a directory or a container of other objects. - **/ - public int isFile() - throws IOException, AS400SecurityException - { - // Ensure that we are connected to the server. - fd_.connect(); - - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - - if (attributesReply_ == null) - { - attributesReply_ = getAttributeSetFromServer(fd_.path_); - } - - //@B1A Added code to call determineIsFile(). - if (attributesReply_ != null) - { - if (determineIsFile(attributesReply_)) - returnCode = IFSReturnCodeRep.SUCCESS; - } - - return returnCode; - } - - /** - Determines if the integrated file system object represented by this - object has its hidden attribute set. - **/ - // @D1 - new method because of changes to java.io.file in Java 2. - - public boolean isHidden() - throws IOException, AS400SecurityException - { - // Ensure that we are connected to the server. - fd_.connect(); - - boolean result = false; - - if (attributesReply_ == null) - { - // Attempt to get the attributes of this object. - attributesReply_ = getAttributeSetFromServer(fd_.path_); - } - - // Determine if the file attributes indicate hidden. - if (attributesReply_ != null) - { - result = (attributesReply_.getFixedAttributes() & IFSListAttrsRep.FA_HIDDEN) != 0; - } - - return result; - } - - /** - Determines if the integrated file system object represented by this - object has its hidden attribute set. - **/ - // @D1 - new method because of changes to java.io.file in Java 2. - - public boolean isReadOnly() - throws IOException, AS400SecurityException - { - // Ensure that we are connected to the server. - fd_.connect(); - - boolean result = false; - - if (attributesReply_ == null) - { - // Attempt to get the attributes of this object. - attributesReply_ = getAttributeSetFromServer(fd_.path_); - } - - // Determine if the file attributes indicate hidden. - if (attributesReply_ != null) - { - result = (attributesReply_.getFixedAttributes() & IFSListAttrsRep.FA_READONLY) != 0; - } - - return result; - } - - - /** - Determines if the integrated file system object represented by this object is a symbolic link. - **/ - public boolean isSymbolicLink() - throws IOException, AS400SecurityException - { - // Ensure that we are connected to the server. - fd_.connect(); - - if (fd_.getSystemVRM() < 0x00050300) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Server is V5R2 or lower, so isSymbolicLink() will always report false."); - return false; - } - - // Temporary workaround, until better File Server support is in place. - // if (attributesReply_ != null) - // { - // System.out.println("DEBUG IFSFileImplRemote.isSymbolicLink(): attributesReply_ != null"); - // result = attributesReply_.isSymbolicLink(fd_.serverDatastreamLevel_); - // } - // else - // - if (!determinedIsSymbolicLink_) - { - // Note: As of V5R3, we can't get accurate symbolic link info by querying the attrs of a specific file. - // Instead, we must query the contents of the parent directory. - int pathLen = fd_.path_.length(); - if (pathLen <= 1) { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Path length is less than 2, so assuming not a symbolic link: " + fd_.path_); - isSymbolicLink_ = false; - determinedIsSymbolicLink_ = true; - } - else - { - // Do a wildcard search. - StringBuffer wildCardPatternBuf = new StringBuffer(fd_.path_); - wildCardPatternBuf.setCharAt(pathLen-1, '*'); - String wildCardPattern = wildCardPatternBuf.toString(); - String dirPath = wildCardPattern.substring(0,1+wildCardPattern.lastIndexOf('/')); - - byte[] pathBytes = fd_.converter_.stringToByteArray(wildCardPattern); - IFSCachedAttributes[] attrList = listDirectoryDetails(wildCardPattern, dirPath, NO_MAX_GET_COUNT, pathBytes, IS_RESTART_NAME, !SORT_LIST); - - IFSCachedAttributes attrs = null; - String filename = fd_.path_.substring(1+(fd_.path_.lastIndexOf('/'))); - for (int i=0; attrs == null && i> 8 != 0x00000502) // system is other than V5R2 @C1c - { - // Attempt to list the attributes of the specified file. - // Note: Do not use cached attributes, since they may be out of date. - IFSListAttrsRep attrs = getAttributeSetFromServer(fd_.path_); - - if (attrs != null) - { - attributesReply_ = attrs; - size = attrs.getSize(fd_.serverDatastreamLevel_); - } - } - else // the system is V5R2 (and therefore, datastream level is 3) - { - // Convert the path name to the server CCSID. - byte[] pathname = fd_.converter_.stringToByteArray(fd_.path_); - - // Send the List Attributes request. Indicate that we want the "8-byte file size". - IFSListAttrsReq req = new IFSListAttrsReq(pathname, fd_.preferredServerCCSID_, - IFSListAttrsReq.NO_AUTHORITY_REQUIRED, NO_MAX_GET_COUNT, - null, true, null, 0, true, fd_.patternMatching_); // @C3c - Vector replys = fd_.listAttributes(req); - - if (replys == null) { - if (fd_.errorRC_ != 0) { - throw new ExtendedIOException(fd_.path_, fd_.errorRC_); - } - else throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - else if (replys.size() == 0) { - // Assume this simply indicates that the file does not exist. - if (Trace.traceOn_) { - Trace.log(Trace.WARNING, "Received no replies from listAttributes(req)."); - } - } - else - { - if ( replys.size() > 1 && - Trace.traceOn_ ) - { - Trace.log(Trace.WARNING, "Received multiple replies from listAttributes(req) (" + - replys.size() + ")"); - } - IFSListAttrsRep reply = (IFSListAttrsRep)replys.elementAt(0); // use first reply - size = reply.getSize8Bytes(/*fd_.serverDatastreamLevel_*/); - } - } - return size; - } - - - - // Fetch list attributes reply(s) for the specified path. - private Vector listAttributes(String path, int maxGetCount, byte[] restartNameOrID, boolean isRestartName, boolean sortList) // @D4C @C3c - throws IOException, AS400SecurityException - { - // Assume connect() has already been done. - - // Convert the pathname to the server CCSID. - byte[] pathname = fd_.converter_.stringToByteArray(path); - - // Prepare the 'list attributes' request. - IFSListAttrsReq req = new IFSListAttrsReq(pathname, fd_.preferredServerCCSID_, // @D4A - IFSListAttrsReq.NO_AUTHORITY_REQUIRED, maxGetCount, // @D4A - restartNameOrID, // @D4A @C3c - isRestartName, // @C3a - null, 0, false, fd_.patternMatching_); - - if (sortList) req.setSorted(true); - return fd_.listAttributes(req); // Note: This does setFD() on each returned IFSListAttrsRep.. - } - - - // @A7A - // List the files/directories in the specified directory. - // Returns null if specified file or directory does not exist. - public String[] listDirectoryContents(String directoryPath) - throws IOException, AS400SecurityException - { - // Ensure that we are connected to the server. - fd_.connect(); - - Vector replys = listAttributes(directoryPath, NO_MAX_GET_COUNT, null, NO_RESTART_NAME, sortLists_); - String[] names = null; - - // Add the name for each file or directory in the specified directory, - // to the array of names. - - // @A1C - // Changed the behavior of the list() to conform to that of the JDK1.1.x - // so that a NULL is returned if and only if the directory or file represented - // by this IFSFile object doesn't exist. - // - // Original code: - // if (replys != null && replys.size() != 0) - if (replys != null) // @A1C - { - names = new String[replys.size()]; - int j = 0; - for (int i = 0; i < replys.size(); i++) - { - IFSListAttrsRep reply = (IFSListAttrsRep) replys.elementAt(i); - String name = fd_.converter_.byteArrayToString(reply.getName(/*dsl*/)); - if (!(name.equals(".") || name.equals(".."))) - { - names[j++] = name; - } - } - - if (j == 0) - { - // @A1C - // - // Original code: - // names = null; - names = new String[0]; // @A1C - } - else if (names.length != j) - { - // Copy the names to an array of the exact size. - String[] newNames = new String[j]; - System.arraycopy(names, 0, newNames, 0, j); - names = newNames; - } - } - - return names; - } - - - // @B1A Added this function to support caching attributes. - // @C3C Morphed this method by adding a parameter and making it private. - // List the files/directories details in the specified directory. - // Returns null if specified file or directory does not exist. - private IFSCachedAttributes[] listDirectoryDetails(String pathPattern, - String directoryPath, - int maxGetCount, // @D4A - byte[] restartNameOrID, // @C3C - boolean isRestartName, // @C3A - boolean sortList) - throws IOException, AS400SecurityException - { - // Ensure that we are connected to the server. - fd_.connect(); - - IFSCachedAttributes[] fileAttributes = null; - - try - { - // Design note: Due to a limitation in the File Server, if we specify a "filename pattern", we cannot get OA1 or OA2 structures in the reply. - // Only "handle-based" requests can get OA* structures in the reply; and a handls is specific to a single file. - // This prevents us, for example, from obtaining the "name of file owner" values for an entire list of files at once; rather, we must obtain that attribute one file at a time. - Vector replys = listAttributes(pathPattern, maxGetCount, restartNameOrID, isRestartName, sortList); - - // Add each file or directory in the specified directory, - // to the array of files. - - int j = 0; - if (replys != null) - { - fileAttributes = new IFSCachedAttributes[replys.size()]; - int dsl = fd_.serverDatastreamLevel_; - for (int i = 0; i < replys.size(); i++) - { - IFSListAttrsRep reply = (IFSListAttrsRep) replys.elementAt(i); - String name = fd_.converter_.byteArrayToString(reply.getName(/*dsl*/)); - if (!(name.equals(".") || name.equals(".."))) - { - // isDirectory and isFile should be different unless the - // file is an invalid symbolic link (circular or points - // to a non-existent object). Such a link cannot - // be resolved and both determineIsDirectory and - // determineIsFile will return false. Regular symbolic links - // will resolve. For example, a symbolic link to a file will return - // true from isFile and false from determineIsDirectory. - boolean isDirectory = determineIsDirectory(reply); - boolean isFile = determineIsFile(reply); - IFSCachedAttributes attributes = new IFSCachedAttributes(reply.getAccessDate(), - reply.getCreationDate(), reply.getFixedAttributes(), reply.getModificationDate(), - reply.getObjectType(), reply.getSize(dsl), name, directoryPath, isDirectory, isFile, reply.getRestartID(), reply.isSymbolicLink(dsl)); //@B3A @C3C - fileAttributes[j++] = attributes; - } - } - }//end if - - if (j == 0) - { - fileAttributes = new IFSCachedAttributes[0]; //@B3C - } - else if (fileAttributes.length != j) - { - //Copy the attributes to an array of the exact size. - IFSCachedAttributes[] newFileAttributes = new IFSCachedAttributes[j]; //@B3C - System.arraycopy(fileAttributes, 0, newFileAttributes, 0, j); //@B3C - fileAttributes = newFileAttributes; - } - } - catch (AS400SecurityException e) - { - fileAttributes = null; - throw e; - } - return fileAttributes; - } - - - // @B1A Added this function to support caching attributes. - // @C3c Moved logic from this method into new private method. - // List the files/directories details in the specified directory. - // Returns null if specified file or directory does not exist. - public IFSCachedAttributes[] listDirectoryDetails(String pathPattern, - String directoryPath, - int maxGetCount, // @D4A - String restartName) // @D4A - throws IOException, AS400SecurityException - { - byte[] restartNameBytes = fd_.converter_.stringToByteArray(restartName); // @C3M - return listDirectoryDetails(pathPattern, directoryPath, maxGetCount, restartNameBytes, IS_RESTART_NAME, sortLists_); //@D7C - } - - // @C3a - // List the files/directories details in the specified directory. - // Returns null if specified file or directory does not exist. - public IFSCachedAttributes[] listDirectoryDetails(String pathPattern, - String directoryPath, - int maxGetCount, - byte[] restartID, - boolean allowSortedRequests) //@D7C - throws IOException, AS400SecurityException - { - boolean sortParameter = (allowSortedRequests ? sortLists_ : false); //@D7A - return listDirectoryDetails(pathPattern, directoryPath, maxGetCount, restartID, !IS_RESTART_NAME, sortParameter); //@D7C - } - - - - /** - Creates an integrated file system directory whose path name is specified by this object. - **/ - public int mkdir(String directory) - throws IOException, AS400SecurityException - { - // Ensure that the path name is set. - fd_.connect(); - - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - - try - { - // Convert the directory name to the server CCSID. - byte[] pathname = fd_.converter_.stringToByteArray(directory); - - // Send a create directory request. - IFSCreateDirReq req = new IFSCreateDirReq(pathname, - fd_.preferredServerCCSID_); - ClientAccessDataStream ds = - (ClientAccessDataStream) fd_.server_.sendAndReceive(req); - - // Verify the reply. - if (ds instanceof IFSReturnCodeRep) - { - returnCode = ((IFSReturnCodeRep) ds).getReturnCode(); - if (returnCode == IFSReturnCodeRep.ACCESS_DENIED_TO_DIR_ENTRY - || returnCode == IFSReturnCodeRep.ACCESS_DENIED_TO_REQUEST) - { - throw new AS400SecurityException(directory, AS400SecurityException.DIRECTORY_ENTRY_ACCESS_DENIED); - } - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost."); - fd_.connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted"); - throw new InterruptedIOException(e.getMessage()); - } - - return returnCode; - } - - - /** - Creates an integrated file system directory whose path name is specified by this object. In addition, create all parent directories as necessary. - **/ - public int mkdirs() - throws IOException, AS400SecurityException - { - // Ensure that we are connected to the server. - fd_.connect(); - - // Traverse up the parent directories until the first parent - // directory that exists is found, saving each parent directory - // as we go. - boolean success = false; - Vector nonexistentDirs = new Vector(); - String directory = fd_.path_; - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - - returnCode = exists(directory); - if (returnCode != IFSReturnCodeRep.SUCCESS) - { - do - { - nonexistentDirs.addElement(directory); - directory = IFSFile.getParent(directory); - } - while ((directory != null) && (exists(directory) != IFSReturnCodeRep.SUCCESS)); - } else - { - returnCode = IFSReturnCodeRep.DUPLICATE_DIR_ENTRY_NAME; - } - - // Create each parent directory in the reverse order that - // they were saved. - for (int i = nonexistentDirs.size(); i > 0; i--) - { - // Get the name of the next directory to create. - //try //@B1D - //{ //@B1D - directory = (String) nonexistentDirs.elementAt(i - 1); - //} //@B1D - //catch(Exception e) //@B1D - //{ //@B1D - // Trace.log(Trace.ERROR, "Error fetching element from vector.\n" + //@B1D - // "length = " + nonexistentDirs.size() + " index = ", //@B1D - // i - 1); - // throw new InternalErrorException(InternalErrorException.UNKNOWN); //@B1D - //} - - // Create the next directory. - returnCode = mkdir(directory); - if (returnCode != IFSReturnCodeRep.SUCCESS) - { - // Unable to create a directory. - break; - } - } - - return returnCode; - } - - - /** - Renames the integrated file system object specified by this object to have the path name of file. Wildcards are not permitted in this file name. - @param file The new file name. - **/ - public int renameTo(IFSFileImpl file) - throws IOException, AS400SecurityException - { - // Ensure that we are connected to the server. - fd_.connect(); - - // Assume the argument has been validated by the public class. - - // Rename the file. - boolean success = false; - ClientAccessDataStream ds = null; - IFSFileImplRemote otherFile = (IFSFileImplRemote)file; - try - { - // Convert the path names to the server CCSID. - byte[] oldName = fd_.converter_.stringToByteArray(fd_.path_); - byte[] newName = fd_.converter_.stringToByteArray(otherFile.getAbsolutePath()); - - // Issue a rename request. - IFSRenameReq req = new IFSRenameReq(oldName, newName, - fd_.preferredServerCCSID_, - false); - ds = (ClientAccessDataStream) fd_.server_.sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost."); - fd_.connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted"); - throw new InterruptedIOException(e.getMessage()); - } - - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - // Verify the reply. - if (ds instanceof IFSReturnCodeRep) - { - returnCode = ((IFSReturnCodeRep) ds).getReturnCode(); - if (returnCode == IFSReturnCodeRep.SUCCESS) - success = true; - else - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Error renaming file: " + - "IFSReturnCodeRep return code", returnCode); - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN, - Integer.toHexString(ds.getReqRepID())); - } - - if (success) - { - fd_.path_ = otherFile.getAbsolutePath(); - - // Clear any cached attributes. - attributesReply_ = null; - } - - return returnCode; - } - - - /** - Sets the file's "data CCSID" tag. - **/ - public boolean setCCSID(int ccsid) - throws IOException, AS400SecurityException - { - // To change the file data CCSID, we need to get the file's current attributes (in an OA2 structure), reset the 'CCSID' field, and then send back the modified OA2 struct in a Change Attributes request. - - fd_.connect(); - IFSListAttrsRep reply = fd_.listObjAttrs2(); // get current attributes (OA2 structure) - if (reply == null) { - if (fd_.errorRC_ != 0) { - throw new ExtendedIOException(fd_.path_, fd_.errorRC_); - } - else throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - - boolean success = false; - IFSObjAttrs2 objAttrs = reply.getObjAttrs2(); // get the OA2* structure - - // Sanity-check the length: If it's an OA2a or OA2b, the length will be 144 bytes. If it's an OA2c, the length will be 160 bytes. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Length of returned OA2* structure (should be 144 or 160): " + objAttrs.length()); - - // Reset the "CCSID of the object" field in the OA2* structure. - objAttrs.setCCSID(ccsid, fd_.serverDatastreamLevel_); - - // Issue a change attributes request. - ClientAccessDataStream ds = null; - try - { - // Convert the path name to the server CCSID. - byte[] pathname = fd_.converter_.stringToByteArray(fd_.path_); - - IFSChangeAttrsReq req = new IFSChangeAttrsReq(pathname, - fd_.preferredServerCCSID_, - objAttrs, - fd_.serverDatastreamLevel_); - ds = (ClientAccessDataStream) fd_.server_.sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost."); - fd_.connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted"); - throw new InterruptedIOException(e.getMessage()); - } - - if (ds instanceof IFSReturnCodeRep) - { - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc == IFSReturnCodeRep.SUCCESS) { - success = true; - fd_.setCCSID(ccsid); // update the cached CCSID value in the fd_ - } - else { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Error setting file data CCSID: " + - "IFSReturnCodeRep return code", rc); - } - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN, - Integer.toHexString(ds.getReqRepID())); - } - - return success; - } - - - - /** - Changes the fixed attributes (read only, hidden, etc.) of the integrated - file system object represented by this object to attributes. - - @param attributes The set of attributes to apply to the object. Note - these attributes are not ORed with the existing - attributes. They replace the existing fixed - attributes of the file. - @return true if successful; false otherwise. - **/ - // @D1 - new method because of changes to java.io.file in Java 2. - - public boolean setFixedAttributes(int attributes) - throws IOException, AS400SecurityException - { - // Assume the argument has been validated by the public class. - - // Ensure that we are connected to the server. - fd_.connect(); - - // Issue a change attributes request. - ClientAccessDataStream ds = null; - try - { - // Convert the path name to the server CCSID. - byte[] pathname = fd_.converter_.stringToByteArray(fd_.path_); - - IFSChangeAttrsReq req = new IFSChangeAttrsReq(pathname, - fd_.preferredServerCCSID_, - attributes, - true, - fd_.serverDatastreamLevel_); - ds = (ClientAccessDataStream) fd_.server_.sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost."); - fd_.connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted"); - throw new InterruptedIOException(e.getMessage()); - } - - // Verify the reply. - boolean success = false; - if (ds instanceof IFSReturnCodeRep) - { - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc == IFSReturnCodeRep.SUCCESS) - success = true; - else - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Error setting file attributes: " + - "IFSReturnCodeRep return code", rc); - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN, - Integer.toHexString(ds.getReqRepID())); - } - - // Clear any cached attributes. - attributesReply_ = null; - - return success; - } - - - - /** - Alters the hidden attribute of the object. If attribute - is true, the bit is turned on. If attribute is turned off, - the bit is turned off. - - @param attributes The new state of the hidden attribute. The hidden - attribute is the second bit from the right. - - @return true if successful; false otherwise. - **/ - // @D1 - new method because of changes to java.io.file in Java 2. - - public boolean setHidden(boolean attribute) - throws IOException, AS400SecurityException - { - // Assume the argument has been validated by the public class. - - // Ensure that we are connected to the server. - fd_.connect(); - - boolean success = false; - - // Setting the fixed attributes of a file involves - // replacing the current set of attributes. The first - // set is to get the current set. - IFSListAttrsRep attributes = getAttributeSetFromServer(fd_.path_); - - if (attributes != null) - { - // Now that we have the current set of attributes, figure - // out if the bit is currently on. - int currentFixedAttributes = attributes.getFixedAttributes(); - boolean currentHiddenBit = (currentFixedAttributes & 2) != 0; - - // If current does not match what the user wants we need to go - // to the server to fix it. - if (currentHiddenBit != attribute) - { - int newAttributes; - - // If the user wants hidden on set the bit else the - // user wants the bit off so clear it. - if (attribute) - newAttributes = currentFixedAttributes + 2; - else - newAttributes = currentFixedAttributes & 0x7ffffffd; - - // Issue a change attributes request. - ClientAccessDataStream ds = null; - try - { - // Convert the path name to the server CCSID. - byte[] pathname = fd_.converter_.stringToByteArray(fd_.path_); - - IFSChangeAttrsReq req = new IFSChangeAttrsReq(pathname, - fd_.preferredServerCCSID_, - newAttributes, - true, - fd_.serverDatastreamLevel_); - ds = (ClientAccessDataStream) fd_.server_.sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost."); - fd_.connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted"); - throw new InterruptedIOException(e.getMessage()); - } - - if (ds instanceof IFSReturnCodeRep) - { - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc == IFSReturnCodeRep.SUCCESS) - success = true; - else - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Error setting hidden attribute: " + - "IFSReturnCodeRep return code", rc); - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - - // Clear any cached attributes. - attributesReply_ = null; - - } - else - success = true; - } - return success; - } - - - // @B8c - /** - Changes the last modified time of the integrated file system object represented by this object to time. - @param time The desired last modification time (measured in milliseconds - since January 1, 1970 00:00:00 GMT), or -1 to set the last modification time to the current system time. - - @return true if successful; false otherwise. - **/ - - public boolean setLastModified(long time) - throws IOException, AS400SecurityException - { - // Assume the argument has been validated by the public class. - - int fileHandle = UNINITIALIZED; - boolean success = false; - - // Ensure that we are connected to the server. - try - { - fd_.connect(); - - if (time == -1) // @B8a - { - // We are setting modification time to "current system time". - // To do that, we will simply read and write-back the first byte in the file. - - // Open the file for read/write. - fileHandle = fd_.createFileHandle(IFSOpenReq.WRITE_ACCESS, IFSOpenReq.OPEN_OPTION_FAIL_OPEN); - if (fileHandle == UNINITIALIZED) return false; - else fd_.setOpen(true, fileHandle); // inform the descriptor of the file handle - - byte[] buffer = new byte[1]; // buffer for reading/writing a single byte - - // If we're setting timestamp to "current system time", we'll need to know how big the file is. - boolean fileIsEmpty = false; // @B8a - if (time == -1) fileIsEmpty = (length()==0 ? true : false); // @B8a - - if (fileIsEmpty) - { - // Update last-modification date by writing one byte (the value doesn't matter). - fd_.writeBytes(buffer, 0, 1, true); - - // Reset the file size to zero. - success = fd_.setLength(0); - } - else // the file is not empty - { - // Read the first byte. - if (1 == fd_.read(buffer, 0, 1)) - { - // Write back the first byte. - fd_.setFileOffset(0); - fd_.writeBytes(buffer, 0, 1, true); - success = true; - } - else - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Unable to read first byte of file."); - success = false; - } - } - } - else // the caller specified a last-modified time - { - // Issue a change attributes request. - ClientAccessDataStream ds = null; - try - { - // Convert the path name to the server CCSID. - byte[] pathname = fd_.converter_.stringToByteArray(fd_.path_); - - IFSChangeAttrsReq req = new IFSChangeAttrsReq(pathname, - fd_.preferredServerCCSID_, - 0, time, 0, - fd_.serverDatastreamLevel_); - ds = (ClientAccessDataStream) fd_.server_.sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost."); - fd_.connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted"); - throw new InterruptedIOException(e.getMessage()); - } - - // Verify the reply. - if (ds instanceof IFSReturnCodeRep) - { - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc == IFSReturnCodeRep.SUCCESS) - success = true; - else - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Error setting last-modified date: " + - "IFSReturnCodeRep return code", rc); - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - - // Clear any cached attributes. - attributesReply_ = null; - } - finally { - if (fileHandle != UNINITIALIZED) fd_.close(fileHandle); - } - - return success; - } - - - // @B8a - /** - Sets the length of the integrated file system object represented by this object. The file can be made larger or smaller. If the file is made larger, the contents of the new bytes of the file are undetermined. - @param length The new length, in bytes. - @return true if successful; false otherwise. - **/ - public boolean setLength(int length) - throws IOException, AS400SecurityException - { - // Assume the argument has been validated by the public class. - - // Ensure that we are connected to the server. - fd_.connect(); - - // Clear any cached attributes. - attributesReply_ = null; - - return fd_.setLength(length); - } - - /** - Sets the file path. - @param path The absolute file path. - **/ - public void setPath(String path) - { - // Assume the argument has been validated by the public class. - - // Ensure that the path is not altered after the connection is - // established. - if (fd_.server_ != null) - { - throw new ExtendedIllegalStateException("path", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // If the specified path doesn't start with the separator character, - // add one. All paths are absolute for IFS. - String newPath; - if (path.length() == 0 || path.charAt(0) != IFSFile.separatorChar) - { - newPath = IFSFile.separator + path; - } - else - { - newPath = path; - } - - // Update the path value. - fd_.path_ = newPath; - } - - - // Sets a ProgramParameter to "pass by reference". - private static final void setPassByReference(ProgramParameter parm) - { - try { parm.setParameterType(ProgramParameter.PASS_BY_REFERENCE); } - catch (PropertyVetoException pve) { Trace.log(Trace.ERROR, pve); } // should never happen - } - - - /** - Sets the pattern-matching behavior used when files are listed by any of the list() or listFiles() methods. The default is PATTERN_POSIX. - @param patternMatching Either {@link IFSFile#PATTERN_POSIX PATTERN_POSIX}, {@link IFSFile#PATTERN_POSIX_ALL PATTERN_POSIX_ALL}, or {@link IFSFile#PATTERN_OS2 PATTERN_OS2} - **/ - public void setPatternMatching(int patternMatching) - { - fd_.patternMatching_ = patternMatching; - } - - - /** - Alters the read only attribute of the object. If attribute - is true, the bit is turned on. If attribute is turned off, - the bit is turned off. - - @param attributes The new state of the read only attribute - - @return true if successful; false otherwise. - **/ - // @D1 - new method because of changes to java.io.file in Java 2. - - public boolean setReadOnly(boolean attribute) - throws IOException, AS400SecurityException - { - // Assume the argument has been validated by the public class. - - // Ensure that we are connected to the server. - fd_.connect(); - - boolean success = false; - IFSListAttrsRep attributes = getAttributeSetFromServer(fd_.path_); - - // Same as setHidden -- setting fixed attributes is a total replacement - // of the fixed attributes. So, we have to get the current set, fix up - // the readonly bit, then put them back. - if (attributes != null) - { - int currentFixedAttributes = attributes.getFixedAttributes(); - boolean currentReadOnlyBit = (currentFixedAttributes & 1) != 0; - - // If the bit is not currently set to what the user wants. - if (currentReadOnlyBit != attribute) - { - int newAttributes; - - // If the user wants readonly on, add to the current set. - // If the user wants it off, clear the bit. - if (attribute) - newAttributes = currentFixedAttributes + 1; - else - newAttributes = currentFixedAttributes & 0x7ffffffe; - - // Issue a change attributes request. - ClientAccessDataStream ds = null; - try - { - // Convert the path name to the server CCSID. - byte[] pathname = fd_.converter_.stringToByteArray(fd_.path_); - - IFSChangeAttrsReq req = new IFSChangeAttrsReq(pathname, - fd_.preferredServerCCSID_, - newAttributes, - true, - fd_.serverDatastreamLevel_); - ds = (ClientAccessDataStream) fd_.server_.sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost."); - fd_.connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted"); - throw new InterruptedIOException(e.getMessage()); - } - - if (ds instanceof IFSReturnCodeRep) - { - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc == IFSReturnCodeRep.SUCCESS) - success = true; - else - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Error setting read-only attribute: " + - "IFSReturnCodeRep return code", rc); - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - - // Clear any cached attributes. - attributesReply_ = null; - } - else - success = true; - } - return success; - } - - - /** - Sets the sorting behavior used when files are listed by any of the list() or listFiles() methods. The default is false (unsorted). - @param sort If true: Return lists of files in sorted order. - If false: Return lists of files in whatever order the file system provides. - **/ - public void setSorted(boolean sort) - { - sortLists_ = sort; - } - - - /** - Sets the system. - @param system The server object. - **/ - public void setSystem(AS400Impl system) - { - // Assume the argument has been validated by the public class. - - fd_.system_ = (AS400ImplRemote)system; - } - - - // Setup remote service program object on first touch. Synchronized to protect instance variables. This method can safely be called multiple times because it checks for a previous call before changing the instance variables. - protected synchronized void setupRemoteCommand() throws IOException - { - // If not already setup. - if (rmtCmd_ == null) - { - if (fd_.system_.canUseNativeOptimizations()) - { - try - { - rmtCmd_ = (RemoteCommandImpl)Class.forName("com.ibm.as400.access.RemoteCommandImplNative").newInstance(); - // Avoid direct reference - it can cause NoClassDefFoundError at class loading time on Sun JVM's. - } - catch (Throwable e) { - // A ClassNotFoundException would be unexpected, since canUseNativeOptions() returned true. - Trace.log(Trace.WARNING, "Unable to instantiate class RemoteCommandImplNative.", e); - } - } - if (rmtCmd_ == null) - { - rmtCmd_ = new RemoteCommandImplRemote(); - } - rmtCmd_.setSystem(fd_.system_); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileInputStream.java b/cvsroot/src/com/ibm/as400/access/IFSFileInputStream.java deleted file mode 100644 index 9202f7537..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileInputStream.java +++ /dev/null @@ -1,989 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileInputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.io.InputStream; -import java.io.IOException; -import java.util.Enumeration; -import java.util.Vector; - - -/** - Represents an integrated file system input stream. - An integrated file system file input stream is an input stream for reading - data from integrated file system objects.
    IFSFileInputStream objects are - capable of generating file events that call the following FileListener - methods: fileClosed and fileOpened.
    - The following example illustrates the use of IFSFileInputStream: -
    - // Work with /Dir/File on the system eniac.
    - AS400 as400 = new AS400("eniac");
    - IFSFileInputStream file = new IFSFileInputStream(as400, "/Dir/File");
    - // Determine how many bytes are available on the stream. - int available = file.available();
    - // Lock the first 8 bytes of the file. - IFSKey key = file.lock(8);
    - // Read the first 8 bytes. - byte[] data = new byte[8]; - int bytesRead = file.read(data, 0, 8);
    - // Unlock the first 8 bytes of the file. - file.unlock(key);
    - // Close the file. - file.close(); -
    - -

    - Note on the use of IFS classes when accessing QSYS files: -
    The IFS classes are of limited usefulness when accessing formatted - file objects under QSYS, such as physical files and save files. - The IFS classes perform their work via datastream - requests that are sent to the "File Server" job on the IBM i system. - The File Server has no awareness of, or respect for, file record structure. - When accessing QSYS file objects, consider the use of other classes such as - {@link SequentialFile SequentialFile}, {@link KeyedFile KeyedFile}, and - {@link SaveFile SaveFile}. - -@see com.ibm.as400.access.FileEvent -@see #addFileListener -@see #removeFileListener - **/ -public class IFSFileInputStream extends InputStream - implements java.io.Serializable -{ - static final long serialVersionUID = 4L; - - - /** - Share option that allows read and write access by other users. - **/ - public final static int SHARE_ALL = 0xffffffff; - /** - Share option that does not allow read or write access by other users. - **/ - public final static int SHARE_NONE = 0xfffffffc; - /** - Share option that allows only read access by other users. - **/ - public final static int SHARE_READERS = 0xfffffffd; - /** - Share option that allows only write access by other users. - **/ - public final static int SHARE_WRITERS = 0xfffffffe; - - protected IFSFileDescriptor fd_; // file info - never allowed to be null - - - - transient private PropertyChangeSupport changes_ ; - transient private Vector fileListeners_; - transient private VetoableChangeSupport vetos_; - transient IFSFileInputStreamImpl impl_; - // Design note: impl_ is available for use by subclasses. - - /** - Constructs an IFSFileInputStream. - It creates a default file input stream. - **/ - public IFSFileInputStream() - { - // Instantiate a file descriptor. - fd_ = new IFSFileDescriptor(SHARE_ALL, this); - initializeTransient(); - } - - /** - Constructs an IFSFileInputStream. - It creates a file input stream to read from the file name. - Other readers and writers are allowed to access the file. - The file is opened if it exists; otherwise, an exception is thrown. - @param system The AS400 that contains the file. - @param name The integrated file system name. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSFileInputStream(AS400 system, - String name) - throws AS400SecurityException, IOException - { - this(system, name, SHARE_ALL); - } - - /** - Constructs an IFSFileInputStream. - It creates a file input stream to read from the file name. - @param system The system that contains the file. - @param name The integrated file system name. - @param shareOption Indicates how users can access the file.

    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSFileInputStream(AS400 system, - String name, - int shareOption) - throws AS400SecurityException, IOException - { - // Validate arguments. - if (system == null) - throw new NullPointerException("system"); - else if (name == null) - throw new NullPointerException("name"); - validateShareOption(shareOption); - initializeTransient(); - - // Instantiate a file descriptor. - fd_ = new IFSFileDescriptor(system, name, shareOption, this); - - // Connect to the byte stream server, and - // open the file. - connectAndOpen(); - } - - - // @A5a - /** - Creates a file input stream to read from the file specified by file. - Other readers and writers are allowed to access the file. - The file is opened if it exists; otherwise, an exception is thrown. - @param file The file to be opened for reading. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSFileInputStream(IFSFile file) - throws AS400SecurityException, IOException - { - this((file==null ? null : file.getSystem()), file, SHARE_ALL); - } - - - /** - Creates a file input stream to read from the file specified by file. - @param system The system that contains the file. - @param file The file to be opened for reading. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @deprecated Use IFSFileInputStream(IFSFile, int) instead. - **/ - public IFSFileInputStream(AS400 system, - IFSFile file, - int shareOption) - throws AS400SecurityException, IOException - { - // Validate arguments. - if (file == null) // @A5c Swapped order of checks. - throw new NullPointerException("file"); - else if (system == null) - throw new NullPointerException("system"); - validateShareOption(shareOption); - initializeTransient(); - - // Instantiate a file descriptor. - fd_ = new IFSFileDescriptor(system, file.getAbsolutePath(), shareOption, this); - - // Connect to the byte stream server, and - // open the file. - connectAndOpen(); - } - - - /** - Creates a file input stream to read from the file specified by file. - @param file The file to be opened for reading. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSFileInputStream(IFSFile file, - int shareOption) - throws AS400SecurityException, IOException - { - this((file==null ? null : file.getSystem()), file, shareOption); - } - - - /** - Creates a file input stream to read from file descriptor fd. - @param fd The file descriptor to be opened for reading. - **/ - public IFSFileInputStream(IFSFileDescriptor fd) - { - // Validate arguments. - if (fd == null) - throw new NullPointerException("fd"); - validateShareOption(fd.getShareOption()); - - initializeTransient(); - - fd_ = fd; - - // Design note: The original implementation did not do a connect/open. -jlee 1/27/99 - } - - - // @A5a - /** - Creates a file input stream to read from the file specified by file. - Other readers and writers are allowed to access the file. - @param file The file to be opened for reading. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSFileInputStream(IFSJavaFile file) - throws AS400SecurityException, IOException - { - this((file==null ? null : file.getSystem()), file, SHARE_ALL); - } - - // @A1A Added IFSJavaFile support - /** - Creates a file input stream to read from the file specified by file. - @param system The system that contains the file. - @param file The file to be opened for reading. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @deprecated Use IFSFileInputStream(IFSJavaFile, int) instead. - **/ - public IFSFileInputStream(AS400 system, - IFSJavaFile file, - int shareOption) - throws AS400SecurityException, IOException - { - // Validate arguments. - if (file == null) // @A5c Swapped order of checks. - throw new NullPointerException("file"); - else if (system == null) - throw new NullPointerException("system"); - validateShareOption(shareOption); - initializeTransient(); - - // Instantiate a file descriptor. - fd_ = new IFSFileDescriptor(system, file.getAbsolutePath().replace (file.separatorChar, IFSFile.separatorChar), shareOption, this); - - // Connect to the byte stream server, and open the file. - connectAndOpen(); - } - //@A1A End of IFSJavaFile support. - - - /** - Creates a file input stream to read from the file specified by file. - @param file The file to be opened for reading. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSFileInputStream(IFSJavaFile file, - int shareOption) - throws AS400SecurityException, IOException - { - this((file==null ? null : file.getSystem()), file, shareOption); - } - - - /** - Adds a file listener to receive file events from this IFSFileInputStream. - @param listener The file listener. - **/ - public void addFileListener(FileListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - synchronized(fileListeners_) - { - fileListeners_.addElement(listener); - } - } - - /** - Adds a property change listener. - @param listener The property change listener to add. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - changes_.addPropertyChangeListener(listener); - } - - /** - Adds a vetoable change listener. - @param listener The vetoable change listener to add. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - vetos_.addVetoableChangeListener(listener); - } - - /** - Returns the number of bytes that can be read from this file input stream. - If the actual number of available bytes exceeds Integer.MAX_VALUE, then Integer.MAX_VALUE is returned. - @return The number of bytes that can be read from this file input stream, or Integer.MAX_VALUE, whichever is less. - - @exception IOException If an error occurs while communicating with the system. - **/ - public int available() - throws IOException - { - // Ensure that the file is open. - open(); - - return impl_.available(); - } - - /** - Chooses the appropriate implementation. - This method is available for use by subclasses. - **/ - private void chooseImpl () - { - if (impl_ == null) - { - // Ensure that the system has been set. - AS400 system = fd_.getSystem(); - if (system == null) - { - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - impl_ = (IFSFileInputStreamImpl) system.loadImpl2 - ("com.ibm.as400.access.IFSFileInputStreamImplRemote", - "com.ibm.as400.access.IFSFileInputStreamImplProxy"); - impl_.setFD(fd_.getImpl()); - } - } - - /** - Closes this file input stream and releases any system resources associated - with the stream. - - @exception IOException If an error occurs while communicating with the system. - **/ - public void close() - throws IOException - { - if (!fd_.isClosed() && fd_.isOpen()) - { - if (impl_ != null) - impl_.close(); - else - fd_.close(); - - // Fire the file close event. - if (fileListeners_.size() != 0) - { - IFSFileDescriptor.fireClosedEvents(this, fileListeners_); - } - } - } - - /** - Establishes communications with the AS400, and opens the file. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - private void connectAndOpen() - throws AS400SecurityException, IOException - { - if (impl_ == null) - { - chooseImpl(); - fd_.getSystem().connectService(AS400.FILE); - } - - impl_.connectAndOpen(); - - // Fire the file opened event. - if (fileListeners_.size() != 0) - IFSFileDescriptor.fireOpenedEvents(this, fileListeners_); - } - - - /** - Ensures that the file input stream is closed when there are no more - references to it. - @exception IOException If an error occurs while communicating with the system. - **/ - protected void finalize() - throws IOException - { - if (fd_ != null && fd_.isOpen()) - { - // Close the file. Send a close request to the server. - if (impl_ != null) - impl_.close(); - else - fd_.close(); - } - - try - { - super.finalize(); - } - catch(Throwable e) - { - Trace.log(Trace.ERROR, "Error during finalization."); - throw new IOException(e.toString()); - } -} - - - /** - Returns the opaque file descriptor associated with this stream. - @return The file descriptor object associated with this stream. - @exception IOException If an error occurs while communicating with the system. - **/ - public final IFSFileDescriptor getFD() - throws IOException - { - return fd_; - } - - - /** - Returns the implementation object. - @return The implementation object associated with this stream. - **/ - IFSFileInputStreamImpl getImpl() - { - return impl_; // Note: This may be null. - } - - - /** - Returns the integrated file system path name of the object represented by this IFSFileInputStream object. - @return The absolute path name of the object. - **/ - public String getPath() - { - return fd_.getPath(); - } - - - /** - Returns the share option for this object. - @return The share option. - **/ - public int getShareOption() - { - return fd_.getShareOption(); - } - - - /** - Returns the AS400 system object for this file input stream. - @return The AS400 system object. - **/ - public AS400 getSystem() - { - return fd_.getSystem(); - } - - - /** - Provided to initialize transient data if this object is de-serialized. - **/ - private void initializeTransient() - { - changes_ = new PropertyChangeSupport(this); - fileListeners_ = new Vector(); - vetos_ = new VetoableChangeSupport(this); - impl_ = null; - } - - - /** - Places a lock on the file at the current position for the specified - number of bytes. - Note: This method is not supported for files under QSYS. - @param length The number of bytes to lock. - @return The key for undoing this lock. - - @exception ExtendedIOException If the specified bytes are already locked by another process. - @exception IOException If an error occurs while communicating with the system. - - @see IFSKey - @see #unlock - @deprecated Replaced by {@link #lock(long) lock(long)} - **/ - public IFSKey lock(int length) - throws IOException - { - return lock((long)length); - } - - - /** - Places a lock on the file at the current position for the specified - number of bytes. - Note: This method is not supported for files under QSYS. - @param length The number of bytes to lock. - @return The key for undoing this lock. - - @exception IOException If an error occurs while communicating with the system. - - @see IFSKey - @see #unlock - **/ - public IFSKey lock(long length) - throws IOException - { - // Validate the argument. - if (length <= 0L) - { - throw new ExtendedIllegalArgumentException("length (" + - Long.toString(length) + - ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Ensure that the file is open. - open(); - - return impl_.lock(length); - } - - - /** - Opens the specified file. - @exception IOException If an error occurs while communicating with the system. - **/ - protected void open() - throws IOException - { - if (impl_ == null) - { - chooseImpl(); - try { fd_.getSystem().connectService(AS400.FILE); } - catch(AS400SecurityException e) - { - Trace.log(Trace.ERROR, "Access to byte stream server on '" + - fd_.getSystem().getSystemName() + "' denied.", e); - throw new ExtendedIOException(ExtendedIOException.ACCESS_DENIED); - } - } - - // If the file is already open, do nothing. - if (fd_.isOpen()) - { - return; - } - else - { - impl_.open(); - - // Fire the file opened event. - if (fileListeners_.size() != 0) - IFSFileDescriptor.fireOpenedEvents(this, fileListeners_); - } - } - - /** - Restores the state of this object from an object input stream. - @param ois The stream of state information. - @exception IOException If an error occurs while communicating with the system. - @exception ClassNotFoundException - **/ - private void readObject(java.io.ObjectInputStream ois) - throws IOException, ClassNotFoundException - { - // Restore the non-static and non-transient fields. - ois.defaultReadObject(); - - // Initialize the transient fields. - initializeTransient(); - } - - /** - Reads the next byte of data from this input stream. - @return The next byte of data, or -1 if the end of file is reached. - - @exception IOException If an error occurs while communicating with the system. - **/ - public int read() - throws IOException - { - byte[] data = new byte[1]; - int rc = read(data, 0, 1); - int value; - - if (rc == 1) - { - value = (int) data[0]; - value = value & 0xff; - } - else - { - value = -1; - } - - return value; - } - - /** - Reads up to data.length bytes of data from this input stream into - data. - @param data The buffer into which data is read. - @return The total number of bytes read into the buffer, or -1 if there is no more data because the end of file has been reached. - - @exception IOException If an error occurs while communicating with the system. - **/ - public int read(byte[] data) - throws IOException - { - // Validate arguments. - if (data == null) - throw new NullPointerException("data"); - - return read(data, 0, data.length); - } - - /** - Reads up to length bytes of data from this input stream into data, starting at the array offset dataOffset. - @param data The buffer into which the data is read. - @param dataOffset The start offset of the data in the buffer. - @param length The maximum number of bytes to read - @return The total number of bytes read into the buffer, or -1 if there is no more data because the end of file has been reached. - - @exception IOException If an error occurs while communicating with the system. - **/ - public int read(byte[] data, - int dataOffset, - int length) - throws IOException - { - // Validate arguments. - if (data == null) - throw new NullPointerException("data"); - if (dataOffset < 0) - throw new ExtendedIllegalArgumentException("dataOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if (length < 0) - throw new ExtendedIllegalArgumentException("length", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - // If length is zero then return zero. - if (length == 0) - { - return 0; - } - - // Ensure that the file is open. - open(); - - return impl_.read(data, dataOffset, length); - } - - /** - Removes a file listener so that it no longer receives file events from - this IFSFileInputStream. - @param listener The file listener . - **/ - public void removeFileListener(FileListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - synchronized(fileListeners_) - { - fileListeners_.removeElement(listener); - } - } - - /** - Removes a property change listener. - @param listener The property change listener to remove. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - changes_.removePropertyChangeListener(listener); - } - - - /** - Removes a vetoable change listener. - @param listener The vetoable change listener to remove. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - vetos_.removeVetoableChangeListener(listener); - } - - /** - Rewinds the input stream. After this call, the stream will read from the beginning. - **/ - public void reset() throws IOException - { - if (fd_.isClosed()) { - Trace.log(Trace.ERROR, "The stream has been closed."); - //throw new java.nio.channels.ClosedChannelException(); // requires JDK 1.4 - throw new IOException(); - } - rewind(); - } - - //@A2A Added rewind. - /** - Rewinds the input stream. After this call, the stream will read from the beginning. - @deprecated Use reset() instead. - **/ - public void rewind() - { - if (fd_.isOpen()) - { - fd_.setFileOffset(0); - } - } - //@A2A End of rewind - - /** - Sets the file descriptor. - @param fd The file descriptor. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setFD(IFSFileDescriptor fd) - throws PropertyVetoException - { - if (fd == null) - { - throw new NullPointerException("fd"); - } - - // Ensure that FD is not altered after the connection is established. - if (fd_.valid()) - { - throw new ExtendedIllegalStateException("FD", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // Remember the current FD value. - IFSFileDescriptor oldFD = fd_; - - // Fire a vetoable change event for FD. - vetos_.fireVetoableChange("FD", oldFD, fd); - - fd_ = fd; - - // Fire the property change event. - changes_.firePropertyChange("FD", oldFD, fd_); - } - - - /** - Sets the integrated file system path name. - @param path The absolute integrated file system path name. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setPath(String path) - throws PropertyVetoException - { - if (path == null) - { - throw new NullPointerException("path"); - } - - // Ensure that the path is not altered after the connection is - // established. - if (fd_.valid()) - { - throw new ExtendedIllegalStateException("path", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - String newPath; - if (path.length() == 0 || path.charAt(0) != IFSFile.separatorChar) - { - newPath = IFSFile.separator + path; - } - else - { - newPath = path; - } - - // Remember the current path value. - String oldPath = fd_.getPath(); - - // Fire a vetoable change event for the path. - vetos_.fireVetoableChange("path", oldPath, newPath); - - // Update the path value. - fd_.setPath(newPath); - - // Fire the property change event. - changes_.firePropertyChange("path", oldPath, newPath); - } - - - /** - Sets the share option. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @exception PropertyVetoException If the change is vetoed. - **/ - public void setShareOption(int shareOption) - throws PropertyVetoException - { - validateShareOption(shareOption); - - // Ensure that shareOption is not altered after the connection - // is established. - if (fd_.valid()) - { - throw new ExtendedIllegalStateException("shareOption", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - Integer oldShareOption = null; - Integer newShareOption = null; - - oldShareOption = new Integer(fd_.getShareOption()); - newShareOption = new Integer(shareOption); - - // Fire a vetoable change event for shareOption. - vetos_.fireVetoableChange("shareOption", oldShareOption, - newShareOption); - - fd_.setShareOption(shareOption); - - // Fire the property change event. - changes_.firePropertyChange("shareOption", oldShareOption, - newShareOption); - } - - - /** - Validates a share option value. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - **/ - static final void validateShareOption(int shareOption) - { - if ((shareOption < SHARE_NONE) || (shareOption > SHARE_ALL)) - { - throw new ExtendedIllegalArgumentException("shareOption (" + - Integer.toString(shareOption) + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - - /** - Sets the system. - The system cannot be changed once a connection is made to the system. - @param system The system object. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem(AS400 system) - throws PropertyVetoException - { - if (system == null) - throw new NullPointerException("system"); - - // Ensure that system is not altered after the connection is - // established. - if (fd_.valid()) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // Remember the old system value. - AS400 oldSystem = fd_.getSystem(); - - // Fire a vetoable change event for system. - vetos_.fireVetoableChange("system", oldSystem, system); - - fd_.setSystem(system); - - // Fire the property change event. - changes_.firePropertyChange("system", oldSystem, system); - } - - - /** - Skips over the next bytesToSkip bytes in the file input stream. - This method may skip less bytes than specified if the end of file is - reached. The actual number of bytes skipped is returned. - - @param bytesToSkip The number of bytes to skip. - @return The actual number of bytes skipped. - - @exception IOException If an error occurs while communicating with the system. - **/ - public long skip(long bytesToSkip) - throws IOException - { - // Validate argument. - if (bytesToSkip < 0) - { - throw new ExtendedIllegalArgumentException("bytesToSkip (" + - Long.toString(bytesToSkip) + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Ensure that the file is open. - open(); - - return impl_.skip(bytesToSkip); - } - - /** - Undoes a lock on this file. - Note: This method is not supported for files under QSYS. - @param key The key for the lock. - - @exception IOException If an error occurs while communicating with the system. - - @see IFSKey - @see #lock(long) - **/ - public void unlock(IFSKey key) - throws IOException - { - // Validate the argument. - if (key == null) - throw new NullPointerException("key"); - - // Ensure that the file is open. - open(); - - impl_.unlock(key); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileInputStream16.gif b/cvsroot/src/com/ibm/as400/access/IFSFileInputStream16.gif deleted file mode 100644 index a7709a992..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/IFSFileInputStream16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileInputStream32.gif b/cvsroot/src/com/ibm/as400/access/IFSFileInputStream32.gif deleted file mode 100644 index fcc295d41..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/IFSFileInputStream32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileInputStreamBeanInfo.java b/cvsroot/src/com/ibm/as400/access/IFSFileInputStreamBeanInfo.java deleted file mode 100644 index ce6a09abd..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileInputStreamBeanInfo.java +++ /dev/null @@ -1,181 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileInputStreamBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.VetoableChangeListener; - -/** - The IFSFileInputStreamBeanInfo class provides bean information - for the IFSFileInputStream class. -**/ - -public class IFSFileInputStreamBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private final static Class beanClass = IFSFileInputStream.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_ = null; - private static ResourceBundleLoader rbl_; - - static - { - try - { - // Define the event descriptors. - EventSetDescriptor event1 = - new EventSetDescriptor(beanClass, "propertyChange", - PropertyChangeListener.class, - "propertyChange"); - event1.setDisplayName(rbl_.getText("EVT_NAME_PROPERTY_CHANGE")); - event1.setShortDescription(rbl_.getText("EVT_DESC_PROPERTY_CHANGE")); - String[] listenerMethods = { "fileClosed", "fileOpened" }; - EventSetDescriptor event2 = - new EventSetDescriptor(beanClass, "file", FileListener.class, - listenerMethods, "addFileListener", - "removeFileListener"); - event2.setDisplayName(rbl_.getText("EVT_NAME_FILE_EVENT")); - event2.setShortDescription(rbl_.getText("EVT_DESC_FILE_EVENT")); - EventSetDescriptor event3 = - new EventSetDescriptor(beanClass, "propertyChange", - VetoableChangeListener.class, - "vetoableChange"); - event3.setDisplayName(rbl_.getText("EVT_NAME_PROPERTY_VETO")); - event3.setShortDescription(rbl_.getText("EVT_DESC_PROPERTY_VETO")); - EventSetDescriptor[] events = { event1, event2, event3 }; - - events_ = events; - - - // Define the property descriptors. - PropertyDescriptor property1 = - new PropertyDescriptor("FD", beanClass, "getFD", "setFD"); - property1.setBound(true); - property1.setConstrained(true); - property1.setDisplayName(rbl_.getText("PROP_NAME_FILE_DESCRIPTOR")); - property1.setShortDescription(rbl_.getText("PROP_DESC_FILE_DESCRIPTOR")); - PropertyDescriptor property2 = - new PropertyDescriptor("path", beanClass, "getPath", "setPath"); - property2.setBound(true); - property2.setConstrained(true); - property2.setDisplayName(rbl_.getText("PROP_NAME_PATH")); - property2.setShortDescription(rbl_.getText("PROP_DESC_PATH")); - PropertyDescriptor property3 = - new PropertyDescriptor("shareOption", beanClass, "getShareOption", - "setShareOption"); - property3.setBound(true); - property3.setConstrained(true); - property3.setDisplayName(rbl_.getText("PROP_NAME_SHARE_OPTION")); - property3.setPropertyEditorClass(IFSShareOptionEditor.class); - property3.setShortDescription(rbl_.getText("PROP_DESC_SHARE_OPTION")); - PropertyDescriptor property4 = - new PropertyDescriptor("system", beanClass, "getSystem", "setSystem"); - property4.setBound(true); - property4.setConstrained(true); - property4.setDisplayName(rbl_.getText("PROP_NAME_SYSTEM")); - property4.setShortDescription(rbl_.getText("PROP_DESC_SYSTEM")); - PropertyDescriptor[] properties = - { - property1, property2, property3, property4 - }; - - properties_ = properties; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - /** - Returns the default event index. - @return The default event index (always 1). - **/ - public int getDefaultEventIndex() - { - return 1; - } - - /** - Returns the default property index. - @return The default property index (always 1). - **/ - public int getDefaultPropertyIndex() - { - return 1; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - // @A1A - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("IFSFileInputStream16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("IFSFileInputStream32.gif"); - break; - } - - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileInputStreamImpl.java b/cvsroot/src/com/ibm/as400/access/IFSFileInputStreamImpl.java deleted file mode 100644 index 989dd1ad8..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileInputStreamImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileInputStreamImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - Specifies the methods which the implementation objects for the IFSFileInputStream - and IFSTextFileInputStream classes need to support. - **/ -interface IFSFileInputStreamImpl -{ - int available() throws IOException; - void close() throws IOException; - void connectAndOpen() throws AS400SecurityException, IOException; - IFSKey lock(long length) throws IOException; - void open() throws IOException; - int read(byte[] data, - int dataOffset, - int length) throws IOException; - // Used only by subclass IFSTextFileInputStream: - String readText(int length) throws IOException; - - // Note: This must be the first method called on a new object: - void setFD(IFSFileDescriptorImpl fd); - - long skip(long bytesToSkip) throws IOException; - void unlock(IFSKey key) throws IOException; - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileInputStreamImplProxy.java b/cvsroot/src/com/ibm/as400/access/IFSFileInputStreamImplProxy.java deleted file mode 100644 index bfed3f664..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileInputStreamImplProxy.java +++ /dev/null @@ -1,178 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileInputStreamImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - - -/** - Provides a local proxy implementation for the IFSFileInputStream and - IFSTextFileInputStream classes. - **/ -class IFSFileInputStreamImplProxy -extends AbstractProxyImpl -implements IFSFileInputStreamImpl -{ - IFSFileInputStreamImplProxy () - { - super ("IFSFileInputStream"); - } - - public int available() - throws IOException - { - try { - return connection_.callMethod (pxId_, "available").getReturnValueInt(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - public void close() - throws IOException - { - try { - connection_.callMethod (pxId_, "close"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - public void connectAndOpen() - throws AS400SecurityException, IOException - { - try { - connection_.callMethod (pxId_, "connectAndOpen"); - } - catch (InvocationTargetException e) { - Throwable e1 = e.getTargetException (); - if (e1 instanceof AS400SecurityException) - throw (AS400SecurityException) e1; - else - throw ProxyClientConnection.rethrow1 (e); - } - } - - - public IFSKey lock(long length) - throws IOException - { - try { - return (IFSKey) connection_.callMethod (pxId_, "lock", - new Class[] { Long.TYPE }, - new Object[] { new Long(length) }) - .getReturnValue(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - - public void open() - throws IOException - { - try { - connection_.callMethod (pxId_, "open"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - private static final boolean[] ARGS_TO_RETURN = new boolean[] {true, false, false}; - - public int read(byte[] data, - int dataOffset, - int length) - throws IOException - { - try { - ProxyReturnValue rv = connection_.callMethod (pxId_, "read", - new Class[] { byte[].class, - Integer.TYPE, - Integer.TYPE }, - new Object[] { data, - new Integer (dataOffset), - new Integer (length) }, - ARGS_TO_RETURN, false ); - byte [] returnDataBuffer = (byte[])rv.getArgument(0); - for (int i=0; iInteger.MAX_VALUE, then Integer.MAX_VALUE is returned. - @return The number of bytes that can be read from this file input stream, or Integer.MAX_VALUE, whichever is less. - - @exception IOException If an error occurs while communicating with the server. - **/ - public int available() - throws IOException - { - return (int)Math.min(availableLong(), (long)Integer.MAX_VALUE); - } - - - /** - Returns the number of bytes that can be read from this file input stream. - @return The number of bytes that can be read from this file input stream. - - @exception IOException If an error occurs while communicating with the server. - **/ - private long availableLong() - throws IOException - { - // Ensure that the file is open. - open(); - - // Bytes available = (file size) minus (current cursor position). - return (getFileSize() - fd_.getFileOffset()); // @B8c - } - - /** - Closes this file input stream and releases any system resources associated - with the stream. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the server. - @exception InterruptedIOException If this thread is interrupted. - - **/ - public void close() - throws IOException - { - fd_.close0(); // @B2C - } - - public void connectAndOpen() - throws AS400SecurityException, IOException - { - fd_.connect(); - open(); - } - - - /** - Ensures that the file input stream is closed when there are no more - references to it. - @exception IOException If an error occurs while communicating with the server. - **/ - protected void finalize() - throws Throwable - { - try - { - if (fd_ != null) - fd_.finalize0(); // @B2C - } - catch(Throwable e) - { - Trace.log(Trace.ERROR, "Error during finalization.", e); - } - finally - { - super.finalize(); - } - } - - - /** - Returns the file length (in bytes). - @return The file length. - **/ - private final long getFileSize() // @B8c - throws IOException - { - long size = 0; // @B8c - - // Process attribute replies. - IFSListAttrsRep reply = null; - IFSListAttrsReq req = new IFSListAttrsReq(fd_.getFileHandle()); - ClientAccessDataStream ds = null; - try - { - ds = (ClientAccessDataStream) fd_.getServer().sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - fd_.connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted.", e); - throw new InterruptedIOException(e.getMessage()); - } - - boolean done = false; - do - { - if ((reply == null) && (ds instanceof IFSListAttrsRep)) - { - reply = (IFSListAttrsRep) ds; - } - else if (ds instanceof IFSReturnCodeRep) - { - // If the return code is NO_MORE_FILES then all files - // that match the specification have been returned. - // Anything else indicates an error. - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc != IFSReturnCodeRep.NO_MORE_FILES) - { - Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", rc); - throw new ExtendedIOException(rc); - } - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - - // Fetch the next reply if not already done. - done = ((IFSDataStream) ds).isEndOfChain(); - if (!done) - { - try - { - ds = (ClientAccessDataStream) - fd_.getServer().receive(req.getCorrelation()); - } - catch(ConnectionDroppedException e) - { - fd_.connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted", e); - throw new InterruptedIOException(e.getMessage()); - } - } - } - while (!done); - - if (reply == null) - { - // This shouldn't happen. Since there is no reply to return we - // throw an exception. - Trace.log(Trace.ERROR, "No reply available."); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - size = reply.getSize(fd_.serverDatastreamLevel_); - - return size; - } - - - /** - Places a lock on the file at the current position for the specified - number of bytes. - @param length The number of bytes to lock. - @return The key for undoing this lock. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the server. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the server cannot be started. - @exception UnknownHostException If the server cannot be located. - - @see IFSKey - @see #unlock - **/ - public IFSKey lock(long length) - throws IOException - { - // Assume the argument has been validated by the public class. - - // Ensure that the file is open. - open(); - - try { - return fd_.lock(length); // @B2C - } - catch (AS400SecurityException e) { - throw new IOException(e.getMessage()); - } - } - - - /** - Opens the specified file. - **/ - public void open() - throws IOException - { - // If the file is already open, do nothing. - if (fd_.isOpen_) - { - return; - } - - // Throw ConnectionDroppedException if attempting to reopen the file. - if (!fd_.isOpenAllowed_) - { - Trace.log(Trace.ERROR, "Attempting to re-open a closed stream."); - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_NOT_ACTIVE); - } - - // Ensure that the path has been set. - String path = fd_.getPath(); - if (path.length() == 0) - { - throw new ExtendedIllegalStateException("path", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Ensure that we are connected to the byte stream server. - try - { - fd_.connect(); - } - catch(AS400SecurityException e) - { - Trace.log(Trace.ERROR, "Access to byte stream server on '" + - fd_.getSystem().getSystemName() + "' denied.", e); - throw new ExtendedIOException(ExtendedIOException.ACCESS_DENIED); - } - - // Convert the path name to the server CCSID. - byte[] pathname = fd_.getConverter().stringToByteArray(path); - - // Request that the file be opened. - IFSOpenReq req = new IFSOpenReq(pathname, fd_.preferredServerCCSID_, - fd_.preferredServerCCSID_, - IFSOpenReq.READ_ACCESS, - ~fd_.getShareOption(), - IFSOpenReq.NO_CONVERSION, 8, - fd_.serverDatastreamLevel_); - ClientAccessDataStream ds = null; - try - { - ds = (ClientAccessDataStream) fd_.getServer().sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - fd_.connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted", e); - throw new InterruptedIOException(e.getMessage()); - } - - // Verify that the open request was successful. - if (ds instanceof IFSOpenRep) - { - // Get the file information. - IFSOpenRep rep = (IFSOpenRep) ds; - fd_.setOpen(true, rep.getFileHandle()); - fd_.setOpenAllowed(false); - } - else if (ds instanceof IFSReturnCodeRep) - { - // The byte stream server reports file-not-found or path-not-found - // if the file can't be opened. If the file can't be opened - // because another open instance of this file isn't allowing - // file sharing, then the byte stream server returns file-in-use. Throw - // FileNotFoundException with the file name as the detail - // message in the first two cases. For the third case, throw - // an IOException with a detail message of 32 (sharing-violation). - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc == IFSReturnCodeRep.FILE_NOT_FOUND || - rc == IFSReturnCodeRep.PATH_NOT_FOUND) - { - Trace.log(Trace.ERROR, fd_.getPath() + " not found."); - throw new FileNotFoundException(fd_.getPath()); - } - else if (rc == IFSReturnCodeRep.FILE_IN_USE) - { - Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", rc); - throw new ExtendedIOException(ExtendedIOException.SHARING_VIOLATION); - } - else - { - Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", rc); - throw new ExtendedIOException(rc); - } - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - - - /** - Reads the next byte of data from this input stream. -
    Note: This method is included in order to qualify this class as an extension - of java.io.InputStream. - @return The next byte of data, or -1 if the end of file is reached. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the server. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the server cannot be started. - @exception UnknownHostException If the server cannot be located. - - **/ - public int read() - throws IOException - { - byte[] data = new byte[1]; - int rc = read(data, 0, 1); - int value; - - if (rc == 1) - { - value = (int) data[0]; - value = value & 0xff; - } - else - { - value = -1; - } - - return value; - } - - /** - Reads up to length bytes of data from this input stream into data, starting at the array offset dataOffset. - @param data The buffer into which the data is read. - @param offset The start offset of the data in the buffer. - @param length The maximum number of bytes to read - @return The total number of bytes read into the buffer, or -1 if there is no more data because the end of file has been reached. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the server. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the server cannot be started. - @exception UnknownHostException If the server cannot be located. - - **/ - public int read(byte[] data, - int dataOffset, - int length) - throws IOException - { - // Assume the arguments have been validated by the public class. - - // Ensure that the file is open. - open(); - - try { - return fd_.read(data, dataOffset, length); // @B2C - } - catch (AS400SecurityException e) { - throw new IOException(e.getMessage()); - } - } - - // Used by IFSTextFileInputStream.read(int) only: - /** - Reads up to length characters from this text file input stream. - The file contents are converted from the file data CCSID to Unicode if - the encoding is supported. -
    Note: This method is for use by subclass IFSTextFileInputStream only. - @param length The number of characters to read from the stream. - @return The characters read from the stream. If the end of file has been - reached an empty String is returned. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the server. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the server cannot be started. - @exception UnknownHostException If the server cannot be located. - @exception UnsupportedEncodingException If the file's character encoding is not supported. - **/ - public String readText(int length) - throws IOException - { - // Assume the argument has been validated by the public class. - - String data = ""; - - // Ensure that the file is open. - open(); - - // Create the InputStreamReader if we don't already have one. - if (reader_ == null) // @B4c - { - reader_ = new ConvTableReader(this, fd_.getCCSID()); // @B7a - } - - data = reader_.read(length); // @B7a - if (data == null) data = ""; // @B7a - - return data; - } - - - /** - Sets the file descriptor. - @param fd The file descriptor. - **/ - public void setFD(IFSFileDescriptorImpl fd) - { - // Assume the argument has been validated by the public class. - - // Cast the argument to an xxxImplRemote. - fd_ = IFSFileDescriptorImplRemote.castImplToImplRemote(fd); // @B2C - } - - - /** - Skips over the next bytesToSkip bytes in the file input stream. - This method may skip less bytes than specified if the end of file is - reached. The actual number of bytes skipped is returned. - - @param bytesToSkip The number of bytes to skip. - @return The actual number of bytes skipped. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the server. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the server cannot be started. - @exception UnknownHostException If the server cannot be located. - - **/ - public long skip(long bytesToSkip) - throws IOException - { - // Assume the argument has been validated by the public class. - - // Ensure that the file is open. - open(); - - long bytesSkipped; - long bytesAvail = availableLong(); - if (bytesToSkip > bytesAvail) - { - // Skip to the end of file. - fd_.incrementFileOffset(bytesAvail); - bytesSkipped = bytesAvail; - } - else - { - // Skip ahead the specified number of bytes. - fd_.incrementFileOffset(bytesToSkip); - bytesSkipped = bytesToSkip; - } - - return bytesSkipped; - } - - /** - Undoes a lock on this file. - @param key The key for the lock. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the server. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the server cannot be started. - @exception UnknownHostException If the server cannot be located. - - @see IFSKey - @see #lock - **/ - public void unlock(IFSKey key) - throws IOException - { - // Assume the argument has been validated by the public class. - - // Ensure that the file is open. - open(); - - try { - fd_.unlock(key); // @B2C - } - catch (AS400SecurityException e) { - throw new IOException(e.getMessage()); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileOutputStream.java b/cvsroot/src/com/ibm/as400/access/IFSFileOutputStream.java deleted file mode 100644 index 09503dfd9..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileOutputStream.java +++ /dev/null @@ -1,1179 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileOutputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Enumeration; -import java.util.Vector; - - -/** - Represents an integrated file system file output stream. - An integrated file system file output stream is an output stream for writing - data to integrated file system objects. -
    - IFSFileOutputStream objects - are capable of generating file events that call the following FileListener - methods: fileClosed, fileModified, and fileOpended. -
    - The following example illustrates the use of IFSFileOutputStream: -
    - // Work with /Dir/File on the system eniac.
    - AS400 as400 = new AS400("eniac");
    - IFSFileOutputStream file = new IFSFileOutputStream(as400, "/Dir/File");
    - // Lock the first 8 bytes of the file. - IFSKey key = file.lock(8);
    - // Write 8 bytes to the file. - byte[] data = { 0, 1, 2, 3, 4, 5, 6, 7 }; - file.write(data, 0, 8);
    - // Unlock the first 8 bytes. - file.unlock(key);
    - // Close the file. - file.close(); -
    - @see com.ibm.as400.access.FileEvent - @see #addFileListener - @see #removeFileListener -**/ -public class IFSFileOutputStream extends OutputStream - implements java.io.Serializable -{ - static final long serialVersionUID = 4L; - - - /** - Share option that allows read and write access by other users. - **/ - public final static int SHARE_ALL = 0xffffffff; - /** - Share option that does not allow read or write access by other users. - **/ - public final static int SHARE_NONE = 0xfffffffc; - /** - Share option that allows only read access by other users. - **/ - public final static int SHARE_READERS = 0xfffffffd; - /** - Share option that allows only write access by other users. - **/ - public final static int SHARE_WRITERS = 0xfffffffe; - - - transient protected PropertyChangeSupport changes_; - transient protected VetoableChangeSupport vetos_; - protected IFSFileDescriptor fd_; // file info - never allowed to be null - - - - transient Vector fileListeners_; - transient IFSFileOutputStreamImpl impl_; - // Note: Leave impl_ available to subclasses. - - private boolean append_ = false; - - private int ccsid_ = -1; // The CCSID for tagging the data in the file. - - /** - Constructs an IFSFileOutputStream object. - It is a default file output stream. - **/ - public IFSFileOutputStream() - { - // Instantiate a file descriptor. - fd_ = new IFSFileDescriptor(SHARE_ALL, this); - initializeTransient(); - } - - - /** - Constructs an IFSFileOutputStream object. - It creates a file output stream to write to the file with the specified name. - Other readers and writers are allowed to access the file. The file is - replaced if it exists; otherwise, the file is created. - @param system The system that contains the file. - @param name The file to be opened for writing. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSFileOutputStream(AS400 system, - String name) - throws AS400SecurityException, IOException - { - // Validate arguments. @C2a - if (system == null) - throw new NullPointerException("system"); - if (name == null) - throw new NullPointerException("name"); - - myConstructor(system, name, SHARE_ALL, false, -1); // @C2c - } - - - // @A2A - /** - Constructs an IFSFileOutputStream object. - It creates a file output stream to write to the file with the specified name and ccsid. - Other readers and writers are allowed to access the file. The file is - replaced if it exists; otherwise, the file is created. - @param system The system that contains the file. - @param name The file to be opened for writing. - @param ccsid The CCSID with which to tag the data in the file. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSFileOutputStream(AS400 system, // @C1A - String name, - int ccsid) - throws AS400SecurityException, IOException - { - this(system, name, SHARE_ALL, false, ccsid); - } - - - /** - Constructs an IFSFileOutputStream object. - It creates a file output stream to write to the file with the specified name. - @param system The system that contains the file. - @param name The file to be opened for writing. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param append Controls the behavior of the file. - If true, output is appended to the file; - otherwise, the current contents of the file are erased, - and output replaces the file contents. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - // @A2A - public IFSFileOutputStream(AS400 system, - String name, - int shareOption, - boolean append) - throws AS400SecurityException, IOException - { - // Validate arguments. @C2a - if (system == null) - throw new NullPointerException("system"); - if (name == null) - throw new NullPointerException("name"); - IFSFileInputStream.validateShareOption(shareOption); - - myConstructor(system, name, shareOption, append, -1); // @C2c - } - - - /** - Constructs an IFSFileOutputStream object. - It creates a file output stream to write to the file with the specified name and ccsid. - @param system The system that contains the file. - @param name The file to be opened for writing. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param append Controls the behavior of the file. - If true, output is appended to the file; - otherwise, the current contents of the file are erased, - and output replaces the file contents. - @param ccsid The CCSID with which to tag the data in the file. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - - public IFSFileOutputStream(AS400 system, // @A2D, @C1B - String name, - int shareOption, - boolean append, - int ccsid) // @A2A - throws AS400SecurityException, IOException - { - // Validate arguments. - if (system == null) - throw new NullPointerException("system"); - if (name == null) - throw new NullPointerException("name"); - IFSFileInputStream.validateShareOption(shareOption); - if (ccsid < 0) // @C2a - throw new ExtendedIllegalArgumentException("ccsid", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - myConstructor(system, name, shareOption, append, ccsid); // @C2c - } - - - // @A5a - /** - Constructs an IFSFileOutputStream object. - It creates a file output stream to write to the file specified by file. - Other readers and writers are allowed to access the file. - The file is replaced if it exists; otherwise, the file is created. - @param file The file to be opened for writing. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSFileOutputStream(IFSFile file) - throws AS400SecurityException, IOException - { - this((file==null ? null : file.getSystem()), file, SHARE_ALL, false); - } - - - /** - Constructs an IFSFileOutputStream object. - It creates a file output stream to write to the file specified by file. - @param system The system that contains the file. - @param file The file to be opened for writing. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param append Controls the behavior of the file. - If true, output is appended to the file; - otherwise, the current contents of the file are erased, - and output replaces the file contents. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @deprecated Use IFSFileOutputStream(IFSFile, int, boolean) instead. - **/ - - // @A2A - public IFSFileOutputStream(AS400 system, - IFSFile file, - int shareOption, - boolean append) - throws AS400SecurityException, IOException - { - // Validate arguments. @C2c - if (file == null) // @A5c Swapped order of checks. - throw new NullPointerException("file"); - else if (system == null) - throw new NullPointerException("system"); - IFSFileInputStream.validateShareOption(shareOption); - - myConstructor(system, file.getAbsolutePath(), shareOption, append, -1); // @C2c - } - - - /** - Constructs an IFSFileOutputStream object. - It creates a file output stream to write to the file specified by file. - @param file The file to be opened for writing. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param append Controls the behavior of the file. - If true, output is appended to the file; - otherwise, the current contents of the file are erased, - and output replaces the file contents. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSFileOutputStream(IFSFile file, - int shareOption, - boolean append) - throws AS400SecurityException, IOException - { - // Validate arguments. - if (file == null) throw new NullPointerException("file"); - IFSFileInputStream.validateShareOption(shareOption); - - myConstructor(file.getSystem(), file.getAbsolutePath(), shareOption, append, -1); - } - - - /** - Constructs an IFSFileOutputStream object. - Creates a file output stream to write to the file specified by file, tagging the data with the CCSID specified by ccsid. - @param system The system that contains the file. - @param file The file to be opened for writing. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param append Controls the behavior of the file. - If true, output is appended to the file; - otherwise, the current contents of the file are erased, - and output replaces the file contents. - @param ccsid The CCSID with which to tag the data in the file. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @deprecated Use IFSFileOutputStream(IFSFile, int, boolean, int) instead. - **/ - - public IFSFileOutputStream(AS400 system, // @A2D, @C1C - IFSFile file, - int shareOption, - boolean append, - int ccsid) // @A2A - throws AS400SecurityException, IOException - { - // Validate arguments. - if (system == null) - throw new NullPointerException("system"); - if (file == null) - throw new NullPointerException("file"); - IFSFileInputStream.validateShareOption(shareOption); - if (ccsid < 0) // @C2a - throw new ExtendedIllegalArgumentException("ccsid", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - myConstructor(system, file.getAbsolutePath(), shareOption, append, ccsid); - } - - - /** - Constructs an IFSFileOutputStream object. - Creates a file output stream to write to the file specified by file, tagging the data with the CCSID specified by ccsid. - @param file The file to be opened for writing. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param append Controls the behavior of the file. - If true, output is appended to the file; - otherwise, the current contents of the file are erased, - and output replaces the file contents. - @param ccsid The CCSID with which to tag the data in the file. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - - public IFSFileOutputStream(IFSFile file, - int shareOption, - boolean append, - int ccsid) - throws AS400SecurityException, IOException - { - // Validate arguments. - if (file == null) - throw new NullPointerException("file"); - IFSFileInputStream.validateShareOption(shareOption); - if (ccsid < 0) - throw new ExtendedIllegalArgumentException("ccsid", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - myConstructor(file.getSystem(), file.getAbsolutePath(), shareOption, append, ccsid); - } - - - // common package scope constructor - void myConstructor (AS400 system, - String filePath, - int shareOption, - boolean append, - int ccsid) // @A2A - throws AS400SecurityException, IOException - { - // Assume the arguments have been been validated. - append_ = append; - ccsid_ = ccsid; - initializeTransient(); - - // Instantiate a file descriptor. - fd_ = new IFSFileDescriptor(system, filePath, shareOption, this); - - // Connect to the AS400 byte stream server, and - // open the file. - connectAndOpen(); - } - - /** - Creates a file output stream to write to file descriptor fd. - @param fd The file descriptor to be opened for writing. - **/ - public IFSFileOutputStream(IFSFileDescriptor fd) - { - // Validate arguments. - if (fd == null) - throw new NullPointerException("fd"); - IFSFileInputStream.validateShareOption(fd.getShareOption()); - - initializeTransient(); - - fd_ = fd; - } - - - // @A5a - /** - Constructs an IFSFileOutputStream object. - Creates a file output stream to write to the file specified by file. - Other readers and writers are allowed to access the file. - The file is replaced if it exists; otherwise, the file is created. - @param file The file to be opened for writing. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSFileOutputStream(IFSJavaFile file) - throws AS400SecurityException, IOException - { - this((file==null ? null : file.getSystem()), file, SHARE_ALL, false); - } - - // @A3A - /** - Constructs an IFSFileOutputStream object. - Creates a file output stream to write to the file specified by file. - @param system The system that contains the file. - @param file The file to be opened for writing. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param append Controls the behavior of the file. - If true, output is appended to the file; - otherwise, the current contents of the file are erased, - and output replaces the file contents. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSFileOutputStream(AS400 system, - IFSJavaFile file, - int shareOption, - boolean append) - throws AS400SecurityException, IOException - { - // Validate arguments. - if (file == null) // @A5c Swapped order of checks. - throw new NullPointerException("file"); - else if (system == null) - throw new NullPointerException("system"); - IFSFileInputStream.validateShareOption(shareOption); - - myConstructor(system, file.getAbsolutePath().replace (file.separatorChar, IFSFile.separatorChar), shareOption, append, -1); - } - - - // @A3A - /** - Constructs an IFSFileOutputStream object. - Creates a file output stream to write to the file specified by file, tagging the data with the CCSID specified by ccsid. - @param system The system that contains the file. - @param file The file to be opened for writing. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param append Controls the behavior of the file. - If true, output is appended to the file; - otherwise, the current contents of the file are erased, - and output replaces the file contents. - @param ccsid The CCSID with which to tag the data in the file. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSFileOutputStream(AS400 system, - IFSJavaFile file, - int shareOption, - boolean append, - int ccsid) - throws AS400SecurityException, IOException - { - // Validate arguments. - if (system == null) - throw new NullPointerException("system"); - if (file == null) - throw new NullPointerException("file"); - IFSFileInputStream.validateShareOption(shareOption); - if (ccsid < 0) // @C2a - throw new ExtendedIllegalArgumentException("ccsid", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - myConstructor(system, file.getAbsolutePath().replace (file.separatorChar, IFSFile.separatorChar), shareOption, append, ccsid); - } - - - /** - Adds a file listener to receive file events from this IFSFileOutputStream. - @param listener The file listener. - **/ - public void addFileListener(FileListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - synchronized(fileListeners_) - { - fileListeners_.addElement(listener); - } - } - - /** - Adds a property change listener. - @param listener The property change listener to add. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - changes_.addPropertyChangeListener(listener); - } - - /** - Adds a vetoable change listener. - @param listener The vetoable change listener to add. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - vetos_.addVetoableChangeListener(listener); - } - - /** - Chooses the appropriate implementation. - Note: This method is available for use by subclasses. - **/ - private void chooseImpl () - { - if (impl_ == null) - { - // Ensure that the system has been set. - AS400 system = fd_.getSystem(); - if (system == null) - { - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - impl_ = (IFSFileOutputStreamImpl) system.loadImpl2 - ("com.ibm.as400.access.IFSFileOutputStreamImplRemote", - "com.ibm.as400.access.IFSFileOutputStreamImplProxy"); - impl_.setFD(fd_.getImpl()); - impl_.setAppend(append_); - } - } - - /** - Closes this file output stream and releases any system resources associated - with this stream. - - @exception IOException If an error occurs while communicating with the system. - **/ - public void close() - throws IOException - { - if (!fd_.isClosed() && fd_.isOpen()) - { - if (impl_ != null) - impl_.close(); - else - fd_.close(); - - // Fire the file close event. - if (fileListeners_.size() != 0) - { - IFSFileDescriptor.fireClosedEvents(this, fileListeners_); - } - } - } - - /** - Establishes communications with the AS400, and opens the file. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - private void connectAndOpen() - throws AS400SecurityException, IOException - { - if (impl_ == null) - { - chooseImpl(); - fd_.getSystem().connectService(AS400.FILE); - } - - impl_.connectAndOpen(ccsid_); - - // Fire the file opened event. - if (fileListeners_.size() != 0) - IFSFileDescriptor.fireOpenedEvents(this, fileListeners_); - } - - /** - Ensures that the file output stream is closed when there are no more - references to it. - @exception IOException If an error occurs while communicating with the system. - **/ - protected void finalize() - throws IOException - { - if (fd_ != null && fd_.isOpen()) - { - // Close the file. Send a close request to the server. - if (impl_ != null) - impl_.close(); - else - fd_.close(); - } - - try - { - super.finalize(); - } - catch(Throwable e) - { - throw new IOException(e.toString()); - } - } - - /** - Forces any buffered output bytes to be written. - - @exception IOException If an error occurs while communicating with the system. - **/ - public void flush() - throws IOException - { - if (fd_.isClosed()) { - Trace.log(Trace.ERROR, "The stream has been closed."); - //throw new java.nio.channels.ClosedChannelException(); // requires JDK 1.4 - throw new IOException(); - } - - // Ensure that the file is open. - open(ccsid_); - - impl_.flush(); - } - - /** - Returns the CCSID. - @return The CCSID. - **/ - // Note: This method is provided for use by IFSTextFileOutputStream. - int getCCSID() - { - return ccsid_; - } - - - /** - Returns the file descriptor associated with this stream. - @return The file descriptor associated with this stream. - @exception IOException If an error occurs while communicating with the system. - **/ - public final IFSFileDescriptor getFD() - throws IOException - { - return fd_; - } - - - /** - Returns the implementation object. - @return The implementation object associated with this stream. - **/ - IFSFileOutputStreamImpl getImpl() - { - return impl_; // Note: This may be null. - } - - /** - Returns the integrated file system path name of the object represented by - this IFSFileOutputStream object. - @return The absolute path name of the object. - **/ - public String getPath() - { - return fd_.getPath(); - } - - - /** - Returns the share option for this object. - @return The share option. - **/ - public int getShareOption() - { - return fd_.getShareOption(); - } - - - /** - Returns the AS400 system object for this stream. - @return The AS400 system object. - **/ - public AS400 getSystem() - { - return fd_.getSystem(); - } - - - /** - Provided to initialize transient data if this object is de-serialized. - **/ - private void initializeTransient() - { - changes_ = new PropertyChangeSupport(this); - vetos_ = new VetoableChangeSupport(this); - fileListeners_ = new Vector(); - impl_ = null; - } - - - /** - Places a lock on the file at the current position for the specified number - of bytes. - Note: This method is not supported for files under QSYS. - @param length The number of bytes to lock. - @return A key for undoing this lock. - - @exception ExtendedIOException If the specified bytes are already locked by another process. - @exception IOException If an error occurs while communicating with the system. - - @see #unlock - @deprecated Replaced by {@link #lock(long) lock(long)} - **/ - public IFSKey lock(int length) - throws IOException - { - return lock((long)length); - } - - - /** - Places a lock on the file at the current position for the specified number - of bytes. - Note: This method is not supported for files under QSYS. - @param length The number of bytes to lock. - @return A key for undoing this lock. - - @exception IOException If an error occurs while communicating with the system. - @see #unlock - **/ - public IFSKey lock(long length) - throws IOException - { - // Validate the argument. - if (length <= 0L) - { - throw new ExtendedIllegalArgumentException("length (" + - Long.toString(length) + - ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Ensure that the file is open. - open(ccsid_); - - return impl_.lock(length); - } - - - /** - Opens the specified file. If the file is already open, does nothing. - @param fileDataCCSID The CCSID with which to tag the data in the file. - - @exception IOException If an error occurs while communicating with the system. - **/ - protected void open(int fileDataCCSID) - throws IOException - { - if (impl_ == null) - { - chooseImpl(); - try { fd_.getSystem().connectService(AS400.FILE); } - catch(AS400SecurityException e) - { - Trace.log(Trace.ERROR, "Access to byte stream server on '" + - fd_.getSystem().getSystemName() + "' denied.", e); - throw new ExtendedIOException(ExtendedIOException.ACCESS_DENIED); - } - } - - // If the file is already open, do nothing. - if (fd_.isOpen()) - { - return; - } - else - { - impl_.open(fileDataCCSID); - - // Fire the file opened event. - if (fileListeners_.size() != 0) - IFSFileDescriptor.fireOpenedEvents(this, fileListeners_); - } - } - - /** - Restores the state of this object from an object input stream. - @param ois The stream of state information. - @exception IOException If an error occurs while communicating with the system. - @exception ClassNotFoundException - **/ - private void readObject(java.io.ObjectInputStream ois) - throws IOException, ClassNotFoundException - { - // Restore the non-static and non-transient fields. - ois.defaultReadObject(); - - // Initialize the transient fields. - initializeTransient(); - } - - /** - Removes a file listener so that it no longer receives file events from - this IFSFileOutputStream. - @param listener The file listener. - **/ - public void removeFileListener(FileListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - synchronized(fileListeners_) - { - fileListeners_.removeElement(listener); - } - } - - /** - Removes a property change listener. - @param listener The property change listener to remove. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - changes_.removePropertyChangeListener(listener); - } - - /** - Removes a vetoable change listener. - @param listener The vetoable change listener to remove. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - vetos_.removeVetoableChangeListener(listener); - } - - /** - Sets the append option. - @param append If true, data is appended to an existing file; - otherwise, output replaces the file contents. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setAppend(boolean append) - throws PropertyVetoException - { - // Ensure that append is not changed after a connection is established. - if (fd_.valid()) - { - throw new ExtendedIllegalStateException("append", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - Boolean oldAppend = new Boolean(append_); - Boolean newAppend = new Boolean(append); - - // Fire a vetoable change event for append. - vetos_.fireVetoableChange("append", oldAppend, newAppend); - - append_ = append; - - // Fire the property change event. - changes_.firePropertyChange("append", oldAppend, newAppend); - } - - - /** - Sets the CCSID for tagging the data written to the file. - @param ccsid The target CCSID. - @exception PropertyVetoException If the change is vetoed. - **/ - // Note: This method is provided for use by IFSTextFileOutputStream. - void setCCSID(int ccsid) - throws PropertyVetoException - { - // Validate the arguments. - if (ccsid < 0) - { - throw new ExtendedIllegalArgumentException("ccsid", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // @A1A - // Ensure that the CCSID isn't changed after the file is opened. - if (fd_.isOpen()) - { - throw new ExtendedIllegalStateException("CCSID", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - // End of @A1A - - Integer oldCCSID = new Integer(ccsid_); - Integer newCCSID = new Integer(ccsid); - - // Fire a vetoable change event for shareOption. - vetos_.fireVetoableChange("CCSID", oldCCSID, newCCSID); - - ccsid_ = ccsid; - - // Fire the property change event. - changes_.firePropertyChange("CCSID", oldCCSID, newCCSID); - } - - /** - Sets the file descriptor. - @param fd The file descriptor. - - @exception PropertyVetoException If the change is vetoed. - - **/ - public void setFD(IFSFileDescriptor fd) - throws PropertyVetoException - { - if (fd == null) - { - throw new NullPointerException("fd"); - } - - // Ensure that FD is not changed after a connection is established. - if (fd_.valid()) - { - throw new ExtendedIllegalStateException("FD", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // Fire a vetoable change event for FD. - vetos_.fireVetoableChange("FD", fd_, fd); - - // Remember the current FD value. - IFSFileDescriptor oldFD = fd_; - - fd_ = fd; - - // Fire the property change event. - changes_.firePropertyChange("FD", oldFD, fd_); - } - - /** - Sets the integrated file system path name. - @param path The absolute integrated file system path name. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setPath(String path) - throws PropertyVetoException - { - if (path == null) - { - throw new NullPointerException("path"); - } - - // Ensure that the path is not altered after a connection is - // established. - if (fd_.valid()) - { - throw new ExtendedIllegalStateException("path", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // Remember the current path value. - String oldPath = fd_.getPath(); - - String newPath; - if (path.length() == 0 || path.charAt(0) != IFSFile.separatorChar) - { - newPath = IFSFile.separator + path; - } - else - { - newPath = path; - } - - // Fire a vetoable change event for the path. - vetos_.fireVetoableChange("path", oldPath, newPath); - - // Update the path value. - fd_.setPath(newPath); - - // Fire the property change event. - changes_.firePropertyChange("path", oldPath, newPath); - } - - - /** - Sets the share option. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @exception PropertyVetoException If the change is vetoed. - **/ - public void setShareOption(int shareOption) - throws PropertyVetoException - { - IFSFileInputStream.validateShareOption(shareOption); - - // Ensure that shareOption is not altered after a connection - // is established. - if (fd_.valid()) - { - throw new ExtendedIllegalStateException("shareOption", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - Integer oldShareOption = new Integer(fd_.getShareOption()); - Integer newShareOption = new Integer(shareOption); - - // Fire a vetoable change event for shareOption. - vetos_.fireVetoableChange("shareOption", oldShareOption, - newShareOption); - - fd_.setShareOption(shareOption); - - // Fire the property change event. - changes_.firePropertyChange("shareOption", oldShareOption, - newShareOption); - } - - - /** - Sets the system. - The system cannot be changed once a connection is made to the system. - @param system The system object. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem(AS400 system) - throws PropertyVetoException - { - if (system == null) - { - throw new NullPointerException("system"); - } - - // Ensure that system is not altered after the connection is - // established. - if (fd_.valid()) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // Remember the old system value. - AS400 oldSystem = fd_.getSystem(); - - // Fire a vetoable change event for system. - vetos_.fireVetoableChange("system", oldSystem, system); - - fd_.setSystem(system); - - // Fire the property change event. - changes_.firePropertyChange("system", oldSystem, system); - } - - - - /** - Undoes a lock on this file. - Note: This method is not supported for files under QSYS. - @param key The key for the lock. - - @exception IOException If an error occurs while communicating with the system. - - @see IFSKey - @see #lock(long) - **/ - public void unlock(IFSKey key) - throws IOException - { - // Validate the argument. - if (key == null) - throw new NullPointerException("key"); - - // Ensure that the file is open. - open(ccsid_); - - impl_.unlock(key); - } - - - /** - Writes the specified byte to this file output stream. - @param b The byte to be written. - - @exception IOException If an error occurs while communicating with the system. - - **/ - public void write(int b) - throws IOException - { - byte[] data = new byte[1]; - data[0] = (byte) b; - write(data, 0, 1); - } - - - /** - Writes data.length bytes of data from the byte array data - to this file output stream. - @param data The data to be written. - - @exception IOException If an error occurs while communicating with the system. - **/ - public void write(byte[] data) - throws IOException - { - // Validate arguments. - if (data == null) - throw new NullPointerException("data"); - - write(data, 0, data.length); - } - - /** - Writes length bytes of data from the byte array data, starting - at offset, to this file output stream. - @param data The data to be written. - @param dataOffset The start offset in the data. - @param length The number of bytes to write. - - @exception IOException If an error occurs while communicating with the system. - **/ - public void write(byte[] data, - int dataOffset, - int length) - throws IOException - { - // Validate arguments. - if (data == null) - throw new NullPointerException("data"); - if (dataOffset < 0) - { - throw new ExtendedIllegalArgumentException("dataOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (length < 0) - { - throw new ExtendedIllegalArgumentException("length", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Ensure that the file is open. - open(ccsid_); - - impl_.write(data, dataOffset, length); - - // Fire the file modified event. - if (fileListeners_.size() != 0) - { - IFSFileDescriptor.fireModifiedEvents(this, fileListeners_); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileOutputStream16.gif b/cvsroot/src/com/ibm/as400/access/IFSFileOutputStream16.gif deleted file mode 100644 index 1b6633842..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/IFSFileOutputStream16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileOutputStream32.gif b/cvsroot/src/com/ibm/as400/access/IFSFileOutputStream32.gif deleted file mode 100644 index 0b35ae264..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/IFSFileOutputStream32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileOutputStreamBeanInfo.java b/cvsroot/src/com/ibm/as400/access/IFSFileOutputStreamBeanInfo.java deleted file mode 100644 index 507f4f863..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileOutputStreamBeanInfo.java +++ /dev/null @@ -1,204 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileOutputStreamBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.VetoableChangeListener; - - -/** -The IFSFileOutputStreamBeanInfo class provides BeanInfo for the IFSFileOutputStream class. -**/ -public class IFSFileOutputStreamBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private final static Class beanClass = IFSFileOutputStream.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] ifsFileOutputStreamProperties_; - protected static PropertyDescriptor[] ifsTextFileOutputStreamProperties_; - private static ResourceBundleLoader rbl_; - - static - { - try - { - // Define the property descriptors. - PropertyDescriptor property1 = - new PropertyDescriptor("append", beanClass, null, "setAppend"); - property1.setBound(true); - property1.setConstrained(true); - property1.setDisplayName(rbl_.getText("PROP_NAME_APPEND_PROP")); - property1.setShortDescription(rbl_.getText("PROP_DESC_APPEND")); - PropertyDescriptor property2 = - new PropertyDescriptor("FD", beanClass, "getFD", "setFD"); - property2.setBound(true); - property2.setConstrained(true); - property2.setDisplayName(rbl_.getText("PROP_NAME_FILE_DESCRIPTOR")); - property2.setShortDescription(rbl_.getText("PROP_DESC_FILE_DESCRIPTOR")); - PropertyDescriptor property3 = - new PropertyDescriptor("path", beanClass, "getPath", "setPath"); - property3.setBound(true); - property3.setConstrained(true); - property3.setDisplayName(rbl_.getText("PROP_NAME_PATH")); - property3.setShortDescription(rbl_.getText("PROP_DESC_PATH")); - PropertyDescriptor property4 = - new PropertyDescriptor("shareOption", beanClass, "getShareOption", - "setShareOption"); - property4.setBound(true); - property4.setConstrained(true); - property4.setPropertyEditorClass(IFSShareOptionEditor.class); - property4.setDisplayName(rbl_.getText("PROP_NAME_SHARE_OPTION")); - property4.setShortDescription(rbl_.getText("PROP_DESC_SHARE_OPTION")); - PropertyDescriptor property5 = - new PropertyDescriptor("system", beanClass, "getSystem", "setSystem"); - property5.setBound(true); - property5.setConstrained(true); - property5.setDisplayName(rbl_.getText("PROP_NAME_SYSTEM")); - property5.setShortDescription(rbl_.getText("PROP_DESC_SYSTEM")); - - PropertyDescriptor property6 = - new PropertyDescriptor("CCSID", - IFSTextFileOutputStream.class, - "getCCSID", "setCCSID"); - property6.setBound(true); - property6.setConstrained(true); - property6.setShortDescription(rbl_.getText("PROP_DESC_AS400_CCSID")); - - PropertyDescriptor[] ifsFileOutputStreamProperties = - { - property1, property2, property3, property4, property5 - }; - ifsFileOutputStreamProperties_ = ifsFileOutputStreamProperties; - PropertyDescriptor[] ifsTextFileOutputStreamProperties = - { - property1, property2, property3, property4, property5, property6 - }; - ifsTextFileOutputStreamProperties_ = ifsTextFileOutputStreamProperties; - - // Define the event descriptors. - EventSetDescriptor event1 = - new EventSetDescriptor(beanClass, "propertyChange", - PropertyChangeListener.class, - "propertyChange"); - event1.setDisplayName(rbl_.getText("EVT_NAME_PROPERTY_CHANGE")); - event1.setShortDescription(rbl_.getText("EVT_DESC_PROPERTY_CHANGE")); - String[] listenerMethods = { "fileClosed", "fileModified", - "fileOpened" }; - EventSetDescriptor event2 = - new EventSetDescriptor(beanClass, "file", FileListener.class, - listenerMethods, "addFileListener", - "removeFileListener"); - event2.setDisplayName(rbl_.getText("EVT_NAME_FILE_EVENT")); - event2.setShortDescription(rbl_.getText("EVT_DESC_FILE_EVENT")); - EventSetDescriptor event3 = - new EventSetDescriptor(beanClass, "propertyChange", - VetoableChangeListener.class, - "vetoableChange"); - event3.setDisplayName(rbl_.getText("EVT_NAME_PROPERTY_VETO")); - event3.setShortDescription(rbl_.getText("EVT_DESC_PROPERTY_VETO")); - EventSetDescriptor[] events = { event1, event2, event3 }; - events_ = events; - } - catch(Exception e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - /** - Returns the default event index. - @return The default event index (always 1). - **/ - public int getDefaultEventIndex() - { - return 1; - } - - /** - Returns the default property index. - @return The default property index (always 1). - **/ - public int getDefaultPropertyIndex() - { - return 2; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - // @A1A - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("IFSFileOutputStream16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("IFSFileOutputStream32.gif"); - break; - } - - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return ifsFileOutputStreamProperties_; - } - -} - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileOutputStreamImpl.java b/cvsroot/src/com/ibm/as400/access/IFSFileOutputStreamImpl.java deleted file mode 100644 index 81244f7f4..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileOutputStreamImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileOutputStreamImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - Specifies the methods which the implementation objects for the IFSFileOutputStream - and IFSTextFileOutputStream classes need to support. - **/ -interface IFSFileOutputStreamImpl -{ - void close() throws IOException; - void connectAndOpen(int ccsid) - throws AS400SecurityException, IOException; - void flush() throws IOException; - IFSKey lock(long length) throws IOException; - void open(int fileDataCCSID) throws IOException; - void setAppend(boolean append); - - // Note: This must be the first method called on a new object: - void setFD(IFSFileDescriptorImpl fd); - - void unlock(IFSKey key) throws IOException; - void write(byte[] data, - int dataOffset, - int length) throws IOException; - - // Provided for use by IFSTextFileOutputStream: - void writeText(String data, int ccsid) throws IOException; - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileOutputStreamImplProxy.java b/cvsroot/src/com/ibm/as400/access/IFSFileOutputStreamImplProxy.java deleted file mode 100644 index 9c601a58b..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileOutputStreamImplProxy.java +++ /dev/null @@ -1,170 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileOutputStreamImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - - -/** - Provides a local proxy implementation for the IFSFileOutputStream and - IFSTextFileOutputStream classes. - **/ -class IFSFileOutputStreamImplProxy -extends AbstractProxyImpl -implements IFSFileOutputStreamImpl -{ - IFSFileOutputStreamImplProxy () - { - super ("IFSFileOutputStream"); - } - - public void close() - throws IOException - { - try { - connection_.callMethod (pxId_, "close"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - public void connectAndOpen(int ccsid) - throws AS400SecurityException, IOException - { - try { - connection_.callMethod (pxId_, "connectAndOpen", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(ccsid) }); - } - catch (InvocationTargetException e) { - Throwable e1 = e.getTargetException (); - if (e1 instanceof AS400SecurityException) - throw (AS400SecurityException) e1; - else - throw ProxyClientConnection.rethrow1 (e); - } - } - - public void flush() - throws IOException - { - try { - connection_.callMethod (pxId_, "flush"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - - public IFSKey lock(long length) - throws IOException - { - try { - return (IFSKey) connection_.callMethod (pxId_, "lock", - new Class[] { Long.TYPE }, - new Object[] { new Long(length) }) - .getReturnValue(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - - public void open(int fileDataCCSID) - throws IOException - { - try { - connection_.callMethod (pxId_, "open", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(fileDataCCSID) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - - public void setAppend(boolean append) - { - try { - connection_.callMethod (pxId_, "setAppend", - new Class[] { Boolean.TYPE }, - new Object[] { new Boolean(append) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - public void setFD(IFSFileDescriptorImpl fd) - { - try { - connection_.callMethod (pxId_, "setFD", - new Class[] { IFSFileDescriptorImpl.class }, - new Object[] { fd }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - public void unlock(IFSKey key) - throws IOException - { - try { - connection_.callMethod (pxId_, "unlock", - new Class[] { IFSKey.class }, - new Object[] { key }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - public void write(byte[] data, - int dataOffset, - int length) - throws IOException - { - try { - connection_.callMethod (pxId_, "write", - new Class[] { byte[].class, Integer.TYPE, Integer.TYPE }, - new Object[] { data, new Integer(dataOffset), - new Integer(length) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - - public void writeText(String data, int ccsid) - throws IOException - { - try { - connection_.callMethod (pxId_, "writeText", - new Class[] { String.class, Integer.TYPE }, - new Object[] { data, new Integer(ccsid) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileOutputStreamImplRemote.java b/cvsroot/src/com/ibm/as400/access/IFSFileOutputStreamImplRemote.java deleted file mode 100644 index 439ebfc92..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileOutputStreamImplRemote.java +++ /dev/null @@ -1,544 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileOutputStreamImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @A1 2008-02-22 Change write() method to pass 'long' rather than 'int' to -// the fd_.setFileOffset() method which accepts a long parameter. -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -import java.io.InterruptedIOException; -import java.io.IOException; -import java.io.OutputStream; - - -/** - Provides a full remote implementation for the IFSFileOutputStream and - IFSTextFileOutputStream classes. - **/ -class IFSFileOutputStreamImplRemote -extends OutputStream -implements IFSFileOutputStreamImpl -{ - private boolean append_ = false; - private IFSFileDescriptorImplRemote fd_; // file info - - // Variables needed by subclass IFSTextFileOutputStream: - transient private ConverterImplRemote converter_; // @B3a - - // Used for debugging only. This should always be false for production. - // When this is false, all debug code will theoretically compile out. - private static final boolean DEBUG = false; // @B2A - - // Static initialization code. - static - { - // Add all byte stream reply data streams of interest to the - // AS400 server's reply data stream hash table. - AS400Server.addReplyStream(new IFSListAttrsRep(), AS400.FILE); - AS400Server.addReplyStream(new IFSOpenRep(), AS400.FILE); - AS400Server.addReplyStream(new IFSReturnCodeRep(), AS400.FILE); - } - - /** - Closes this file output stream and releases any system resources associated - with this stream. - @exception IOException If an error occurs while communicating with the server. - **/ - public void close() - throws IOException - { - // Close the OutputStream. - fd_.close0(); // @B4a - } - - - public void connectAndOpen(int ccsid) - throws AS400SecurityException, IOException - { - fd_.connect(); - if (ccsid == -1) - open(fd_.getPreferredCCSID()); - else - open(ccsid); - } - - - /** - Ensures that the file output stream is closed when there are no more - references to it. - @exception IOException If an error occurs while communicating with the server. - **/ - protected void finalize() - throws Throwable - { - try - { - if (fd_ != null) - fd_.finalize0(); // @B2C - } - catch(Throwable e) - { - Trace.log(Trace.ERROR, "Error during finalization.", e); - } - finally - { - super.finalize(); - } - } - - /** - Forces any buffered output bytes to be written. - - @exception IOException If an error occurs while communicating with the server. - **/ - public void flush() - throws IOException - { - // Flush the OutputStream. - open(fd_.getPreferredCCSID()); // @B4a - - try { - fd_.flush(); // @B4a - } - catch (AS400SecurityException e) { - throw new IOException(e.getMessage()); - } - } - - - /** - Places a lock on the file at the current position for the specified number - of bytes. - @param length The number of bytes to lock. - @return A key for undoing this lock. - - @exception IOException If an error occurs while communicating with the server. - - @see IFSKey - @see #unlock - **/ - public IFSKey lock(long length) - throws IOException - { - // Assume the argument has been validated by the public class. - - // Ensure that the file is open. - open(fd_.getPreferredCCSID()); - - try { - return fd_.lock(length); // @B2C - } - catch (AS400SecurityException e) { - throw new IOException(e.getMessage()); - } - } - - - /** - Opens the specified file. - - @exception IOException If an error occurs while communicating with the server. - **/ - public void open(int fileDataCCSID) - throws IOException - { - // If the file is already open, do nothing. - if (fd_.isOpen_) - { - return; - } - - // Throw ConnectionDroppedException if attempting to open the file - // after it has been closed. - if (!fd_.isOpenAllowed_) - { - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_NOT_ACTIVE); - } - - // Ensure that the path has been set. - String path = fd_.getPath(); - if (path.length() == 0) - { - throw new ExtendedIllegalStateException("path", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Ensure that we are connected to the byte stream server. - try - { - fd_.connect(); - } - catch(AS400SecurityException e) - { - Trace.log(Trace.ERROR, "Security exception", e); - throw new ExtendedIOException(ExtendedIOException.ACCESS_DENIED); - } - - // Convert the path name to the server CCSID. - byte[] pathname = fd_.getConverter().stringToByteArray(path); - - // Request that the file be created if it doesn't exist, opened - // if it does. - if (fileDataCCSID == -1) - { - fileDataCCSID = fd_.getPreferredCCSID(); - } - IFSOpenReq req = new IFSOpenReq(pathname, fd_.getPreferredCCSID(), - fileDataCCSID, - IFSOpenReq.WRITE_ACCESS, - ~fd_.getShareOption(), - IFSOpenReq.NO_CONVERSION, - (append_ ? 1 : 2), - fd_.serverDatastreamLevel_); - ClientAccessDataStream ds = null; - try - { - ds = (ClientAccessDataStream) fd_.getServer().sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost"); - fd_.connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted", e); - throw new InterruptedIOException(e.getMessage()); - } - - // Verify that the open request was successful. - if (ds instanceof IFSOpenRep) - { - // Get the file information. - IFSOpenRep rep = (IFSOpenRep) ds; - fd_.setOpen(true, rep.getFileHandle()); - fd_.setOpenAllowed(false); - if (append_) - { - // We must append to the file. - fd_.setFileOffset(rep.getFileSize(fd_.serverDatastreamLevel_)); // @B7c - } - } - else if (ds instanceof IFSReturnCodeRep) - { - // If the file can't be opened because another open instance of - // this file isn't allowing file sharing, then the byte stream - // server returns file-in-use. In this case, throw an IOException - // with a detail message of 32 (sharing-violation). - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc == IFSReturnCodeRep.FILE_IN_USE) - { - Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", rc); - throw new ExtendedIOException(ExtendedIOException.SHARING_VIOLATION); - } - else - { - Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", rc); - throw new ExtendedIOException(rc); - } - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - - - public void setAppend(boolean append) - { - append_ = append; - } - - /** - Sets the file descriptor. - @param fd The file descriptor. - - **/ - public void setFD(IFSFileDescriptorImpl fd) - { - // Assume the argument has been validated by the public class. - - // Cast the argument to an xxxImplRemote. - fd_ = IFSFileDescriptorImplRemote.castImplToImplRemote(fd); // @B2C - } - - - - /** - Undoes a lock on this file. - @param key The key for the lock. - - @exception IOException If an error occurs while communicating with the server. - - @see IFSKey - @see #lock - **/ - public void unlock(IFSKey key) - throws IOException - { - // Assume the argument has been validated by the public class. - - // Ensure that the file is open. - open(fd_.getPreferredCCSID()); - - try { - fd_.unlock(key); // @B2C - } - catch (AS400SecurityException e) { - throw new IOException(e.getMessage()); - } - } - - - /** - Writes the specified byte to this file output stream. -
    This method is implemented to qualify this class as an OutputStream. - @param b The byte to be written. - - @exception IOException If an error occurs while communicating with the server. - **/ - public void write(int b) - throws IOException - { - byte[] data = new byte[1]; - data[0] = (byte) b; - write(data, 0, 1); - } - - - /** - Writes data.length bytes of data from the byte array data - to this file output stream. -
    This method is implemented to qualify this class as an OutputStream. - @param data The data to be written. - - @exception IOException If an error occurs while communicating with the server. - **/ - public void write(byte[] data) - throws IOException - { - write(data, 0, data.length); - } - - /** - Writes length bytes of data from the byte array data, starting - at offset, to this file output stream. - @param data The data to be written. - @param offset The start offset in the data. - @param length The number of bytes to write. - - @exception IOException If an error occurs while communicating with the server. - **/ - public void write(byte[] data, - int dataOffset, - int length) - throws IOException - { - // Assume the arguments have been validated by the public class. - - // Ensure that the file is open. - open(fd_.getPreferredCCSID()); - - int fileHandle = fd_.getFileHandle(); - - // @A4A (beginning of code block) - if (append_) // We must append to the very end of the file. - { - IFSListAttrsReq req = new IFSListAttrsReq(fileHandle); - - // Send the request. - ClientAccessDataStream ds = null; - try - { - // Send the request and receive the response. - ds = (ClientAccessDataStream) fd_.getServer().sendAndReceive(req); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost"); - fd_.connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted", e); - throw new InterruptedIOException(e.getMessage()); - } - - if (ds instanceof IFSListAttrsRep) - { - // Get the file information. - IFSListAttrsRep rep = (IFSListAttrsRep) ds; - - fd_.setFileOffset(rep.getSize(fd_.serverDatastreamLevel_)); // @B7c //@A1C remove (int) cast - } - else if (ds instanceof IFSReturnCodeRep) - { - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc != IFSReturnCodeRep.SUCCESS) - { - Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", rc); - throw new ExtendedIOException(rc); - } - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - // @A4A (end of code block) - - try { - fd_.writeBytes(data, dataOffset, length); // @B2C - } - catch (AS400SecurityException e) { - throw new IOException(e.getMessage()); - } - } - - - // Used by IFSTextFileOutputStream.write(String) only: - /** - Writes characters to this text file output stream. - The characters that are written to the file are converted to the - specified CCSID. - @param data The characters to write to the stream. - @param ccsid The CCSID for the data. - - @exception IOException If an error occurs while communicating with the server. - **/ - public void writeText(String data, int ccsid) - throws IOException - { - // Assume the arguments have been validated by the public class. - - // Ensure that the file is open. - open(ccsid); - - // Create the OutputStreamWriter if we don't already have one. - if (converter_ == null) // @B4c - { - int fileCCSID = 0; // @B2C - formerly codePage - - // Determine the file character encoding if the CCSID property - // value has not been set. - if (ccsid == -1) - { - // Issue a List File Attributes request to obtain the CCSID (or code page) - // of the file. - try - { - ClientAccessDataStream ds = null; - - // Issue the "list attributes" request. - IFSListAttrsReq req = - new IFSListAttrsReq(fd_.getFileHandle(), IFSListAttrsReq.OA2, 0, 0); - // We need to get an OA2 structure in the reply, since it contains the CCSID field. - - ds = (ClientAccessDataStream) fd_.getServer().sendAndReceive(req); - - boolean done = false; - boolean gotCCSID = false; - do - { - if (ds instanceof IFSListAttrsRep) - { - if (Trace.traceOn_ && gotCCSID) - Trace.log(Trace.DIAGNOSTIC, "Received multiple replies " + - "from ListAttributes request."); - fileCCSID = ((IFSListAttrsRep) ds).getCCSID(fd_.serverDatastreamLevel_); - if (DEBUG) - System.out.println("DEBUG: IFSFileOutputStreamImplRemote.writeText(): " + - "Reported CCSID for file is " + fileCCSID); // @B2A - gotCCSID = true; - } - else if (ds instanceof IFSReturnCodeRep) - { - // If the return code is NO_MORE_FILES then all files - // that match the specification have been returned. - int rc = ((IFSReturnCodeRep) ds).getReturnCode(); - if (rc != IFSReturnCodeRep.NO_MORE_FILES && - rc != IFSReturnCodeRep.SUCCESS) - { - Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", rc); - throw new ExtendedIOException(rc); - } - - } - else - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); - throw new - InternalErrorException(Integer.toHexString(ds.getReqRepID()), - InternalErrorException.DATA_STREAM_UNKNOWN); - } - - // Fetch the next reply if not already done. - done = ((IFSDataStream) ds).isEndOfChain(); - if (!done) - { - try - { - ds = (ClientAccessDataStream) fd_.getServer().receive(req.getCorrelation()); - } - catch(ConnectionDroppedException e) - { - Trace.log(Trace.ERROR, "Byte stream server connection lost."); - fd_.connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted"); - throw new InterruptedIOException(e.getMessage()); - } - } - } - while (!done); - - if (!gotCCSID || fileCCSID == 0) - { - Trace.log(Trace.ERROR, "Unable to determine CCSID of file " + fd_.path_); - throw new ExtendedIOException(ExtendedIOException.UNKNOWN_ERROR); - } - - } - catch(ConnectionDroppedException e) - { - fd_.connectionDropped(e); - } - catch(InterruptedException e) - { - Trace.log(Trace.ERROR, "Interrupted", e); - throw new InterruptedIOException(e.getMessage()); - } - - ccsid = fileCCSID; - } - - converter_ = ConverterImplRemote.getConverter(ccsid, fd_.getSystem()); //@B3a - } - - // Write the characters of the String. - this.write(converter_.stringToByteArray(data)); //@B3a - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileReader.java b/cvsroot/src/com/ibm/as400/access/IFSFileReader.java deleted file mode 100644 index b3f44b8e8..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileReader.java +++ /dev/null @@ -1,325 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileReader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2004-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.Reader; - -/** -Convenience class for reading character files in the integrated file system. -The behavior of this class is comparable to java.io.FileReader. -
    -IFSFileReader is meant for reading streams of characters. -For reading streams of raw bytes, use {@link IFSFileInputStream IFSFileInputStream}. -If an InputStream is required, use {@link IFSTextFileInputStream IFSTextFileInputStream}. -

    -The following example illustrates the use of IFSFileReader: -

    -import java.io.BufferedReader;
    -// Work with /File1 on the system eniac.
    -AS400 system = new AS400("eniac");
    -IFSFile file = new IFSFile(system, "/File1");
    -BufferedReader reader = new BufferedReader(new IFSFileReader(file));
    -// Read the first line of the file, converting characters.
    -String line1 = reader.readLine();
    -// Display the String that was read.
    -System.out.println(line1);
    -// Close the reader.
    -reader.close();
    -
    - **/ -public class IFSFileReader extends Reader -{ - static final long serialVersionUID = 4L; - - - /** - Share option that allows read and write access by other users. - **/ - public final static int SHARE_ALL = IFSFileInputStream.SHARE_ALL; - /** - Share option that does not allow read or write access by other users. - **/ - public final static int SHARE_NONE = IFSFileInputStream.SHARE_NONE; - /** - Share option that allows only read access by other users. - **/ - public final static int SHARE_READERS = IFSFileInputStream.SHARE_READERS; - /** - Share option that allows only write access by other users. - **/ - public final static int SHARE_WRITERS = IFSFileInputStream.SHARE_WRITERS; - - transient private ConvTableReader reader_; - - private IFSFileInputStream inputStream_; - - - /** - Constructs an IFSFileReader object. - Other readers and writers are allowed to access the file. - The file is opened if it exists; otherwise an exception is thrown. - The file's CCSID is obtained by referencing the file's "coded character set ID" tag on the system. - Other readers and writers are allowed to access the file. - @param file The file to be opened for reading. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSFileReader(IFSFile file) - throws AS400SecurityException, IOException - { - if (file == null) throw new NullPointerException("file"); - int ccsid = file.getCCSID(); // do this before opening the stream, to avoid "File In Use" - if (ccsid == -1) throwException(file.getPath()); - inputStream_ = new IFSFileInputStream(file); - reader_ = new ConvTableReader(inputStream_, ccsid); - } - - - /** - Constructs an IFSFileReader object. - The file is opened if it exists; otherwise an exception is thrown. - Other readers and writers are allowed to access the file. - @param file The file to be opened for reading. - @param ccsid The CCSID that the file data is currently in. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSFileReader(IFSFile file, int ccsid) - throws AS400SecurityException, IOException - { - if (file == null) throw new NullPointerException("file"); - inputStream_ = new IFSFileInputStream(file); - reader_ = new ConvTableReader(inputStream_, ccsid); - } - - - /** - Constructs an IFSFileReader object. - The file is opened if it exists; otherwise an exception is thrown. - @param file The file to be opened for reading. - @param ccsid The CCSID that the file data is currently in. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSFileReader(IFSFile file, int ccsid, int shareOption) - throws AS400SecurityException, IOException - { - if (file == null) throw new NullPointerException("file"); - inputStream_ = new IFSFileInputStream(file, shareOption); - reader_ = new ConvTableReader(inputStream_, ccsid); - } - - /** - Constructs an IFSFileReader object. - The file is opened if it exists; otherwise an exception is thrown. - @param fd The file descriptor to be opened for reading. - **/ - public IFSFileReader(IFSFileDescriptor fd) - throws AS400SecurityException, IOException - { - int ccsid = fd.getCCSID(); // do this before opening the stream, to avoid "File In Use" - if (ccsid == -1) throwException(fd.getPath()); - inputStream_ = new IFSFileInputStream(fd); - reader_ = new ConvTableReader(inputStream_, ccsid); - // Note: IFSFileDescriptor has a shareOption data member. - } - - - /** - Closes the stream. Once a stream has been closed, further read(), ready(), mark(), or reset() invocations will throw an IOException. Closing a previously-closed stream, however, has no effect. - @exception IOException If an error occurs while communicating with the system. - **/ - public void close() - throws IOException - { - reader_.close(); // let the Reader close the IFSFileInputStream - } - - /** - Returns the CCSID used by this IFSFileReader. - @return The CCSID, or -1 if the CCSID is not known. - **/ - public int getCCSID() - { - return reader_.getCcsid(); - } - - /** - Returns the encoding used by this IFSFileReader. - @return The encoding, or null if the encoding is not known. - **/ - public String getEncoding() - { - return reader_.getEncoding(); - } - - - /** - IFSFileReader does not support the mark() operation. - @return false. - **/ - public boolean markSupported() - { - return false; - } - - - /** - Reads a single character. - @return The character read, or -1 if the end of the stream has been reached. - @exception IOException If an error occurs while communicating with the system. - **/ - public int read() throws IOException - { - return reader_.read(); - } - - - /** - Reads characters into an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached. - @param cbuf Destination buffer. - @return The number of characters read, or -1 if the end of the stream has been reached. - - @exception IOException If an error occurs while communicating with the system. - **/ - public int read(char[] cbuf) throws IOException - { - return reader_.read(cbuf); - } - - /** - Reads characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached. - @param cbuf Destination buffer. - @param off Offset at which to start storing characters. - @param len Maximum number of characters to read. - @return The number of characters read, or -1 if the end of the stream has been reached. - - @exception IOException If an error occurs while communicating with the system. - **/ - public int read(char[] cbuf, int off, int len) - throws IOException - { - return reader_.read(cbuf, off, len); - } - - - /** - Tells whether this stream is ready to be read. - @return true if the next read() is guaranteed not to block for input, false otherwise. Note that returning false does not guarantee that the next read will block. - @exception IOException If an error occurs while communicating with the system. - **/ - public boolean ready() - throws IOException - { - return reader_.ready(); - } - - - /** - Resets the stream. After this call, the stream will read from the beginning. - @exception IOException If an error occurs while communicating with the system. - **/ - public void reset() - throws IOException - { - // Just create a new ConvTableReader. We thereby avoid complications that arise when reset() is supported but mark() isn't. - - // Let the ConvTableReader finish whatever it's doing. - synchronized(inputStream_) - { - inputStream_.reset(); - reader_ = new ConvTableReader(inputStream_, reader_.getCcsid()); - } - } - - - /** - Skip characters. This method will block until some characters are available, an I/O error occurs, or the end of the stream is reached. - - @param charsToSkip The number of characters to skip. - @return The number of characters actually skipped. - - @exception IOException If an error occurs while communicating with the system. - **/ - public long skip(long charsToSkip) - throws IOException - { - return reader_.skip(charsToSkip); - } - - - /** - Places a lock on the file at the current position for the specified - number of bytes. - Note: This method is not supported for files under QSYS. - @param length The number of bytes to lock. - @return The key for undoing this lock. - - @exception IOException If an error occurs while communicating with the system. - @see #unlockBytes - @deprecated Replaced by {@link #lockBytes(long) lock(long)} - **/ - public IFSKey lockBytes(int length) - throws IOException - { - return lockBytes((long)length); - } - - - /** - Places a lock on the file at the current position for the specified - number of bytes. - Note: This method is not supported for files under QSYS. - @param length The number of bytes to lock. - @return The key for undoing this lock. - - @exception IOException If an error occurs while communicating with the system. - @see #unlockBytes - **/ - public IFSKey lockBytes(long length) - throws IOException - { - return inputStream_.lock(length); - } - - /** - Undoes a lock on the file. - Note: This method is not supported for files under QSYS. - @param key The key for the lock. - - @exception IOException If an error occurs while communicating with the system. - - @see #lockBytes(long) - **/ - public void unlockBytes(IFSKey key) - throws IOException - { - inputStream_.unlock(key); - } - - - // Utility method. - private static final void throwException(String path) - throws ExtendedIOException - { - Trace.log(Trace.ERROR, "File does not exist or is not readable."); - throw new ExtendedIOException(path, ExtendedIOException.FILE_NOT_FOUND); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSFileWriter.java b/cvsroot/src/com/ibm/as400/access/IFSFileWriter.java deleted file mode 100644 index 79a2509f7..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFileWriter.java +++ /dev/null @@ -1,354 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileWriter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approvsed by the Open Source Initiative. -// Copyright (C) 2004-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.Writer; - -/** -Convenience class for writing character files in the integrated file system. -The behavior of this class is comparable to java.io.FileWriter. -
    -IFSFileWriter is meant for writing streams of characters. -For writing streams of raw bytes, use {@link IFSFileOutputStream IFSFileOutputStream}. -If an OutputStream is required, use {@link IFSTextFileOutputStream IFSTextFileOutputStream}. -

    -The following example illustrates the use of IFSFileWriter: -

    -import java.io.PrintWriter;
    -import java.io.BufferedWriter;
    -// Work with /File1 on the system eniac.
    -AS400 as400 = new AS400("eniac");
    -IFSFile file = new IFSFile(system, "/File1");
    -PrintWriter writer = new PrintWriter(new BufferedWriter(new IFSFileWriter(file)));
    -// Write a line of text to the file, converting characters.
    -writer.println(text);
    -// Close the file.
    -writer.close();
    -
    - **/ -public class IFSFileWriter extends Writer -{ - static final long serialVersionUID = 4L; - - - /** - Share option that allows read and write access by other users. - **/ - public final static int SHARE_ALL = IFSFileOutputStream.SHARE_ALL; - /** - Share option that does not allow read or write access by other users. - **/ - public final static int SHARE_NONE = IFSFileOutputStream.SHARE_NONE; - /** - Share option that allows only read access by other users. - **/ - public final static int SHARE_READERS = IFSFileOutputStream.SHARE_READERS; - /** - Share option that allows only write access by other users. - **/ - public final static int SHARE_WRITERS = IFSFileOutputStream.SHARE_WRITERS; - - - transient private ConvTableWriter writer_; - - private IFSFileOutputStream outputStream_; - - - /** - Constructs an IFSFileWriter object. - Other readers and writers are allowed to access the file. - The file is opened if it exists; otherwise an exception is thrown. - The file's CCSID is obtained by referencing the file's "coded character set ID" tag on the system. - Any data currently in the file will be overwritten. - Other readers and writers are allowed to access the file. - @param file The file to be opened for writing. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @see IFSFile#createNewFile - **/ - public IFSFileWriter(IFSFile file) - throws AS400SecurityException, IOException - { - if (file == null) throw new NullPointerException("file"); - int ccsid = file.getCCSID(); // do this before opening stream - if (ccsid == -1) throwException(file.getPath()); - outputStream_ = new IFSFileOutputStream(file); - writer_ = new ConvTableWriter(outputStream_, ccsid); - } - - /** - Constructs an IFSFileWriter object. - The file is opened if it exists; otherwise an exception is thrown. - Any data currently in the file will be overwritten. - Other readers and writers are allowed to access the file. - @param file The file to be opened for writing. - @param ccsid The CCSID to convert the data to when writing to the file. - The file's "data CCSID" tag on the system is not changed. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @see IFSFile#createNewFile - **/ - public IFSFileWriter(IFSFile file, int ccsid) - throws AS400SecurityException, IOException - { - if (file == null) throw new NullPointerException("file"); - outputStream_ = new IFSFileOutputStream(file); - writer_ = new ConvTableWriter(outputStream_, ccsid); - } - - - /** - Constructs an IFSFileWriter object. - The file is opened if it exists; otherwise an exception is thrown. - The file's CCSID is obtained by referencing the file's "coded character set ID" tag on the system. - Other readers and writers are allowed to access the file. - @param file The file to be opened for writing. - @param append If true, output is appended to the file; otherwise, any data currently in the file will be overwritten. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @see IFSFile#createNewFile - **/ - public IFSFileWriter(IFSFile file, boolean append) - throws AS400SecurityException, IOException - { - if (file == null) throw new NullPointerException("file"); - int ccsid = file.getCCSID(); // do this before opening stream - if (ccsid == -1) throwException(file.getPath()); - outputStream_ = new IFSFileOutputStream(file, IFSFileOutputStream.SHARE_ALL, append); - writer_ = new ConvTableWriter(outputStream_, ccsid); - } - - /** - Constructs an IFSFileWriter object. - The file is opened if it exists; otherwise an exception is thrown. - The file's CCSID is obtained by referencing the file's "coded character set ID" tag on the system. - @param file The file to be opened for writing. - @param append If true, output is appended to the file; otherwise, any data currently in the file will be overwritten. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @see IFSFile#createNewFile - **/ - public IFSFileWriter(IFSFile file, boolean append, int shareOption) - throws AS400SecurityException, IOException - { - if (file == null) throw new NullPointerException("file"); - int ccsid = file.getCCSID(); // do this before opening stream - if (ccsid == -1) throwException(file.getPath()); - outputStream_ = new IFSFileOutputStream(file, shareOption, append); - writer_ = new ConvTableWriter(outputStream_, ccsid); - } - - - /** - Constructs an IFSFileWriter object. - The file is opened if it exists; otherwise an exception may be thrown. - @param file The file to be opened for writing. - @param append If true, output is appended to the file; otherwise, any data currently in the file will be overwritten. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param ccsid The CCSID to convert the data to when writing to the file. - The file's "data CCSID" tag on the system is not changed. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @see IFSFile#createNewFile - **/ - public IFSFileWriter(IFSFile file, boolean append, int shareOption, int ccsid) - throws AS400SecurityException, IOException - { - if (file == null) throw new NullPointerException("file"); - outputStream_ = new IFSFileOutputStream(file, shareOption, append); - writer_ = new ConvTableWriter(outputStream_, ccsid); - } - - /** - Constructs an IFSFileWriter object. - The file is opened if it exists; otherwise an exception is thrown. - @param fd The file descriptor to be opened for writing. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @see IFSFile#createNewFile - **/ - public IFSFileWriter(IFSFileDescriptor fd) - throws AS400SecurityException, IOException - { - int ccsid = fd.getCCSID(); // do this before opening stream - if (ccsid == -1) throwException(fd.getPath()); - outputStream_ = new IFSFileOutputStream(fd); - writer_ = new ConvTableWriter(outputStream_, ccsid); - // Note: IFSFileDescriptor has a shareOption data member. - } - - - - - /** - Closes the stream, flushing it first. Once a stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. Closing a previously-closed stream, however, has no effect. - @exception IOException If an error occurs while communicating with the system. - **/ - public void close() - throws IOException - { - writer_.close(); // let the Writer close the IFSFileOutputStream - } - - - /** - Flushes the underlying output stream. - @exception IOException If an error occurs while communicating with the system. - **/ - public void flush() throws IOException - { - writer_.flush(); - } - - - /** - Returns the CCSID used by this IFSFileWriter. - @return The CCSID, or -1 if the CCSID is not known. - **/ - public int getCCSID() - { - return writer_.getCcsid(); - } - - /** - Returns the encoding used by this IFSFileWriter. - @return The encoding, or null if the encoding is not known. - **/ - public String getEncoding() - { - return writer_.getEncoding(); - } - - - /** - Places a lock on the file at the current position for the specified - number of bytes. - Note: This method is not supported for files under QSYS. - @param length The number of bytes to lock. - @return The key for undoing this lock. - - @exception IOException If an error occurs while communicating with the system. - @see #unlockBytes - @deprecated Replaced by {@link #lockBytes(long) lock(long)} - **/ - public IFSKey lockBytes(int length) - throws IOException - { - return lockBytes((long)length); - } - - - /** - Places a lock on the file at the current position for the specified - number of bytes. - Note: This method is not supported for files under QSYS. - @param length The number of bytes to lock. - @return The key for undoing this lock. - - @exception IOException If an error occurs while communicating with the system. - @see #unlockBytes - **/ - public IFSKey lockBytes(long length) - throws IOException - { - return outputStream_.lock(length); - } - - /** - Undoes a lock on the file. - Note: This method is not supported for files under QSYS. - @param key The key for the lock. - - @exception IOException If an error occurs while communicating with the system. - - @see #lockBytes(long) - **/ - public void unlockBytes(IFSKey key) - throws IOException - { - outputStream_.unlock(key); - } - - /** - Writes a single character. - @param c int specifying a character to be written. - @exception IOException If an error occurs while communicating with the system. - **/ - public void write(int c) throws IOException - { - writer_.write(c); - } - - /** - Writes the specified array of characters. - @param buffer The characters to be written. - @exception IOException If an error occurs while communicating with the system. - **/ - public void write(char[] buffer) throws IOException - { - writer_.write(buffer); - } - - /** - Writes a portion of an array of characters. - @param buffer The characters to be written. - @param offset The offset into the array from which to begin extracting characters to write. - @param length The number of characters to write. - @exception IOException If an error occurs while communicating with the system. - **/ - public void write(char[] buffer, int offset, int length) throws IOException - { - writer_.write(buffer, offset, length); - } - - /** - Writes a String. - @param data The String to write. - @exception IOException If an error occurs while communicating with the system. - **/ - public void write(String data) throws IOException - { - writer_.write(data); - } - - /** - Writes a portion of a String. - @param data The String to write. - @param offset The offset into the String from which to begin extracting characters to write. - @param length The number of characters to write. - @exception IOException If an error occurs while communicating with the system. - **/ - public void write(String data, int offset, int length) throws IOException - { - writer_.write(data, offset, length); - } - - - // Utility method. - private static final void throwException(String path) - throws ExtendedIOException - { - Trace.log(Trace.ERROR, "File does not exist or is not writable."); - throw new ExtendedIOException(path, ExtendedIOException.FILE_NOT_FOUND); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSFreeHandleReq.java b/cvsroot/src/com/ibm/as400/access/IFSFreeHandleReq.java deleted file mode 100644 index 2a0b1e806..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSFreeHandleReq.java +++ /dev/null @@ -1,37 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFreeHandleReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class IFSFreeHandleReq extends IFSDataStreamReq -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final int OBJECT_HANDLE_OFFSET = 22; - private static final int TEMPLATE_LENGTH = 6; - - IFSFreeHandleReq(int objectHandle) - { - super(20 + TEMPLATE_LENGTH); - setLength(data_.length); - setTemplateLen(TEMPLATE_LENGTH); - setReqRepID(0x001d); - set32bit(objectHandle, OBJECT_HANDLE_OFFSET); - } - -} - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSIoctlRep.java b/cvsroot/src/com/ibm/as400/access/IFSIoctlRep.java deleted file mode 100644 index 25123297b..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSIoctlRep.java +++ /dev/null @@ -1,34 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSIoctlRep.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class IFSIoctlRep extends IFSDataStream -{ - public Object getNewDataStream() - { - return new IFSIoctlRep(); - } - - byte[] getReplyData() - { - byte[] replyData = new byte[data_.length - 22]; - System.arraycopy(data_, 22, replyData, 0, replyData.length); - return replyData; - } - - public int hashCode() - { - return 0x8015; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSIoctlReq.java b/cvsroot/src/com/ibm/as400/access/IFSIoctlReq.java deleted file mode 100644 index 786e67c6e..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSIoctlReq.java +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSIoctlReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class IFSIoctlReq extends IFSDataStreamReq -{ - IFSIoctlReq(int id, byte[] pathName) - { - super(26 + pathName.length); - setLength(data_.length); - setTemplateLen(6); - setReqRepID(0x002A); - set32bit(id, 22); - System.arraycopy(pathName, 0, data_, 26, pathName.length); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSJavaFile.java b/cvsroot/src/com/ibm/as400/access/IFSJavaFile.java deleted file mode 100644 index f173be539..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSJavaFile.java +++ /dev/null @@ -1,2161 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSJavaFile.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @B1 - 2008-04-10 - Update length() for handling of symbolic link objects. -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; - -import java.io.FileFilter; -import java.io.FilenameFilter; -import java.io.IOException; -import java.io.File; -import java.util.Vector; -import java.net.URL; -import java.net.MalformedURLException; - -/** - * Represents an object in the IBM i integrated file system. - *
    - * - * IFSJavaFile extends the java.io.File class and allows programs - * to be written for the java.io.File interface and still access - * the IBM i integrated file system. - * - * IFSFile should be considered as an alternate to java.io.File class. - *

    - * When should IFSJavaFile be used? - *

      - *
    • - * IFSJavaFile should be used when a portable interface, compatible with - * java.io.File, is needed. For example, you have written code - * that accesses the native file system. Now you want to move - * the design to a networked file system. More particularly, - * you need to move the code to the IBM i integrated file system. - * When a program is being ported and needs to use the IBM i - * integrated file system, IFSJavaFile is a good choice. - * IFSJavaFile also provides SecurityManager features defined in - * java.io.File. - *

      - *

    • - * If you need to take full advantage of the IBM i integrated file - * system, {@link IFSFile IFSFile} is more useful. IFSFile is written to - * handle more of the specific IBM i integrated file system details. - *

      - *

    • - * java.io.File can be used to access the IBM i file system - * if you use a product like IBM i Access for Windows to map a local drive - * to the IBM i integrated file system. - *

      - *

    - * - *

    - * Notes: - *

      - *
    1. IFSJavaFile is designed to be used with - * {@link IFSFileInputStream IFSFileInputStream} and - * {@link IFSFileOutputStream IFSFileOutputStream}. - * It does not support java.io.FileInputStream - * and java.io.FileOutputStream. - *
    2. IFSJavaFile cannot override createTempFile because - * java.io.File defines createTempFile as a static method. - *
    3. IFSJavaFile cannot override deleteOnExit because the - * Java Virtual Machine does nothing to indicate when it - * is preparing to exit. - *
    4. IFSJavaFile is designed to look more like - * java.io.File than IFSFile. It is designed to enable - * a plug-in fit for previously written java.io.File code. - *
    5. IFSJavaFile always implements a SecurityManager using - * IBM i security. The SecurityManager provides authority - * checks. It throws security exceptions when illegal access - * attempts are made. - *
    - * - *

    - * The following example demonstrates the use of IFSJavaFile. It shows how a few lines - * of platform specific code enable the creation of a file on either the IBM i system or - * the local client. - *

    - *     int location            = ON_THE_SERVER;  // on the IBM i system
    - *     java.io.File file       = null;
    - *     java.io.OutputStream os = null;
    - *
    - * if (location == ON_THE_SERVER) - * file = new IFSJavaFile(new AS400("enterprise"), path); // Work with the file on the system "enterprise". - * else - * file = new java.io.File(path); // Work with the file on the local file system. - *
    - * if (file.exists()) - * System.out.println("Length: " + file.length()); // Determine the file size. - * else - * System.out.println("File " + file.getName() + " not found"); - *
    - * // Delete the file. This should be done before creating an output stream. - * if (file.delete() == false) - * System.err.println("Unable to delete file."); // Display the error message. - *
    - * if (location == ON_THE_SERVER) - * os = (OutputStream)new IFSFileOutputStream((IFSJavaFile)file); - * else - * os = new FileOutputStream(file); - *
    - * writeData(file, os); - * os.close(); - *
    - * void writeData(java.io.File file, java.io.OutputStream os) - * throws IOException - * { - * // Determine the parent directory of the file. - * System.out.println("Directory: " + file.getParent()); - *
    - * // Determine the name of the file. - * System.out.println("Name: " + file.getName()); - *
    - * // Determine when the file was last modified. - * System.out.println("Date: " + new Date(file.lastModified())); - *
    - * System.out.println("Writing Data"); - * for (int i = 0; i < 256; i++) - * os.write((byte)i); - * } - *
    - * - * @see com.ibm.as400.access.IFSFile - * @see com.ibm.as400.access.IFSFileInputStream - * @see com.ibm.as400.access.IFSFileOutputStream -**/ -public class IFSJavaFile extends java.io.File implements java.io.Serializable -{ - static final long serialVersionUID = 4L; - - private IFSFile ifsFile_ = new IFSFile(); - private static final char AS400_SEPARATOR = '/'; - private static final String URL_PROTOCOL = "file"; - - private static final boolean replace_ = (AS400_SEPARATOR != separatorChar); //@P2A - -// Because pathSeparator, pathSeparatorChar, separator and separatorChar are declared final in java.io.File, we cannot override them. - - private boolean absolute_; - -/** - * Creates a default IFSJavaFile instance. -**/ - public IFSJavaFile() - { - this(separator); // Default to the root directory. @A2C - absolute_ = false; // No path, so it can't be absolute. - } - -/** - * Creates a new IFSJavaFile instance whose path name is given by path. - * - * @param path The file path name where the IFSJavaFile is or will be stored. -**/ - private IFSJavaFile(String path) - { - super(path); - - try - { - ifsFile_.setPath(replace_ ? path.replace(separatorChar, AS400_SEPARATOR) : path); //@P2C - absolute_ = isAbsolutePath(path); - } - catch (PropertyVetoException e) {} // will never happen - } - - -/** - * Creates a new IFSJavaFile instance from a parent pathname string and a child pathname string. - * - * @param path The file path name where the IFSJavaFile is or will be stored. - * @param name The name of the IFSJavaFile object. -**/ - private IFSJavaFile(String path, String name) - { - super(path, name); - - try - { - String canon = canonicalizeDirectory(path) + name; //@P2A - ifsFile_.setPath(replace_ ? canon.replace(separatorChar, AS400_SEPARATOR) : canon); //@P2C - absolute_ = isAbsolutePath(canon); - } - catch (PropertyVetoException e) {} // will never happen - } - -/** - * Creates a new IFSJavaFile instance for the specified system, using a file pathname string. - * - * @param system The system that contains the IFSJavaFile. - * @param path The file path name where the IFSJavaFile is or will be stored. -**/ - public IFSJavaFile(AS400 system, String path) - { - this(path); - if (system == null) - throw new NullPointerException("system"); - - setSystem(system); - absolute_ = isAbsolutePath(path); - } - -/** - * Creates a new IFSJavaFile instance for the specified system, from a parent pathname string and a child pathname string. - * - * @param system The system that contains the IFSJavaFile. - * @param path The file path name where the IFSJavaFile is or will be stored. - * @param name The name of the IFSJavaFile object. -**/ - public IFSJavaFile(AS400 system, String path, String name) - { - this(path, name); - if (system == null) - throw new NullPointerException("system"); - - setSystem(system); - absolute_ = isAbsolutePath(path); - } - -/** - * Creates a new IFSJavaFile instance from a parent abstract pathname and a child pathname string. - *

    - * The directory argument cannot be null. The constructed - * IFSJavaFile instance uses the following settings taken from - * directory: - *

      - *
    • system - *
    • path - *
    - * The resulting file name is taken from the path name of directory, - * followed by the separator character, followed by name. - * - * @param directory The directory where the IFSJavaFile is or will be stored. - * @param name The name of the IFSJavaFile object. -**/ - public IFSJavaFile(IFSJavaFile directory, String name) - { - this(); - - if (directory == null) - throw new NullPointerException("directory"); - - if (name == null) - throw new NullPointerException("name"); - - String directoryPath = directory.getPath(); - try - { - String canon = canonicalizeDirectory(directoryPath) + name; //@P2A - ifsFile_.setPath(replace_ ? canon.replace(separatorChar, AS400_SEPARATOR) : canon); //@P2C - } - catch (PropertyVetoException e) {} // will never happen - - AS400 localSystem = directory.getSystem(); - if (localSystem != null) - { - setSystem(localSystem); - } - absolute_ = directory.isAbsolute(); - } - -/** - * Creates a new IFSJavaFile instance for the specified system, from a parent abstract pathname and a child pathname string. - * - * @param system The system that contains the IFSJavaFile. - * @param directory The directory where the IFSJavaFile is or will be stored. - * @param name The name of the IFSJavaFile object. -**/ - public IFSJavaFile(AS400 system, IFSJavaFile directory, String name) - { - this(directory, name); - if (system == null) - throw new NullPointerException("system"); - - setSystem(system); - absolute_ = directory.isAbsolute(); - } - - -/** - * Creates a new IFSJavaFile instance from an IFSFile object. - * - * @param file An IFSFile object. -**/ - public IFSJavaFile(IFSFile file) - { - super(file.getPath(), file.getName()); - ifsFile_ = file; - absolute_ = true; // all IFSFile objects have absolute paths - } - - /* if the directory doesn't end in a file separator, add one */ - private String canonicalizeDirectory(String directory) - { - // Assume the argument has been validated as non-null. //@A1C - int separatorIndex = directory.length() - separator.length(); - if (!directory.substring(separatorIndex).equals(separator)) - { - directory += separator; - } - return directory; - } - - - /** - Tests whether the application can execute the file denoted by this abstract pathname. - This method is supported for IBM i V5R1 and higher. For older releases, it simply returns false. - If the user profile has *ALLOBJ special authority (and system is V5R1 or higher), this method always returns true. - - @return true if and only if the abstract pathname exists and the application is allowed to execute the file. - For consistency with the behavior of java.io.File on IBM i JVM's: If a security error occurs simply because the user profile isn't allowed to access the file, the error is traced and false is returned. - @exception SecurityException If an unanticipated security error occurs. - **/ - public boolean canExecute() - throws SecurityException - { - try - { - return ifsFile_.canExecute(); - } - catch (IOException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - } - - -/** - * Indicates if the program can read from the file denoted by this abstract pathname. - * - * @return true if and only if the abstract pathname exists and the application is allowed to read the file. - * For consistency with the behavior of java.io.File on IBM i JVM's: If a security error occurs simply because the user profile isn't allowed to access the file, the error is traced and false is returned. - * @exception SecurityException If an unanticipated security error occurs. -**/ - public boolean canRead() - throws SecurityException - { - try - { - return ifsFile_.canRead(); - } - catch (IOException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - } - -/** - * Indicates if the program can write to the file denoted by this abstract pathname. - * - * @return true if and only if the abstract pathname exists and the application is allowed to write the file. - * For consistency with the behavior of java.io.File on IBM i JVM's: If a security error occurs simply because the user profile isn't allowed to access the file, the error is traced and false is returned. - * @exception SecurityException If an unanticipated security error occurs. -**/ - public boolean canWrite() - throws SecurityException - { - try - { - return ifsFile_.canWrite(); - } - catch (IOException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - } - -/** - * Compares the paths of two IFSJavaFiles. - *

    - * The following examples demonstrate the use of this method: - * - *

    - * In this example, returnCode would be less than 0 because the - * path of file is less than the path of file2. - *

    - *  IFSJavaFile file  = new IFSJavaFile(new AS400("enterprise"), path);
    - *  IFSJavaFile file2 = new IFSJavaFile(new AS400("enterprise"), path + "\\extra");
    - * 
    - * int returnCode = file.compareTo(file2); - *
    - * - *

    - * In this example, returnCode would be greater than 0 because the - * path of file is greater than the path of file2. - *

    - *  IFSJavaFile file  = new IFSJavaFile(new AS400("enterprise"), path + "\\extra");
    - *  IFSJavaFile file2 = new IFSJavaFile(new AS400("enterprise"), path);
    - * 
    - * int returnCode = file.compareTo(file2); - *
    - * - *

    - * In this example, returnCode would be less than 0 because the - * path of file is less than the path of file2. - *

    - *  IFSJavaFile file  = new IFSJavaFile(new AS400("enterprise"), "\\QSYS.LIB\\herlib");
    - *  IFSJavaFile file2 = new IFSJavaFile(new AS400("enterprise"), "\\QSYS.LIB\\hislib");
    - * 
    - * int returnCode = file.compareTo(file2); - *
    - * - *

    Note:
    The comparison is case sensitive. - * - * @param file The IFSJavaFile to be compared. - * - * @return 0 if this IFSJavaFile path equals file's path; - * a value less than 0 if this IFSJavaFile path is less than the file's - * path; and a value greater than 0 if this IFSJavaFile path is greater - * than the file's path. - * - * @since JDK1.2 -**/ - public int compareTo(IFSJavaFile file) - { - return getPath().compareTo(file.getPath()); - } - -// @A7a -/** - * Compares the path of IFSJavaFile with a File's path. - * - *

    Note:
    The comparison is case sensitive. - * - * @param file The File to be compared. - * - * @return 0 if this IFSJavaFile path equals the argument's path; - * a value less than 0 if this IFSJavaFile path is less than the argument's - * path; and a value greater than 0 if this IFSJavaFile path is greater - * than the argument's path. - * - * @since JDK1.2 -**/ - public int compareTo(File file) - { - return getPath().compareTo(file.getPath()); - } - -// @A8a -/** - * Compares the path of IFSJavaFile with a IFSFile's path. - * - *

    Note:
    The comparison is case sensitive. - * - * @param file The IFSFile to be compared. - * - * @return 0 if this IFSJavaFile path equals the argument's path; - * a value less than 0 if this IFSJavaFile path is less than the argument's - * path; and a value greater than 0 if this IFSJavaFile path is greater - * than the argument's path. - * - * @since JDK1.2 -**/ - public int compareTo(IFSFile file) - { - return getPath().compareTo(file.getPath()); - } - - -// Note: The JDK 6.0 compiler doesn't like the following method signature. -// It causes the following error: -// "name clash: compareTo(java.lang.Object) in IFSJavaFile and compareTo(T) in Comparable have the same erasure, yet neither overrides the other" - -// /** -// * Compares this object with another object. -// * -// * @param obj The object to be compared. -// * -// * @return 0 if this IFSJavaFile path equals the argument's path; -// * a value less than 0 if this IFSJavaFile path is less than the argument's -// * path; and a value greater than 0 if this IFSJavaFile path is greater -// * than the argument's path. -// * -// * @exception ClassCastException if the specified object's type prevents it from being compared to this Object. -// * @since JDK1.2 -//**/ -// public int compareTo(Object obj) -// { -// if (obj instanceof IFSJavaFile) return compareTo((IFSJavaFile)obj); -// else if (obj instanceof File) return compareTo((File)obj); -// else if (obj instanceof IFSFile) return compareTo((IFSFile)obj); -// else { -// String classname = (obj == null ? "null" : obj.getClass().getName()); -// throw new ClassCastException(classname); -// } -// } - - - /** - * Atomically create a new, empty file. The file is - * created if and only if the file does not yet exist. The - * check for existence and the file creation is a - * single atomic operation. - * @return true if the file is created, false otherwise. - * @exception IOException If an I/O error occurs while communicating with the IBM i system. - **/ - public boolean createNewFile() - throws IOException - { - return ifsFile_.createNewFile(); - } - - - - -/** - * Deletes the IFSJavaFile. If the target is - * a directory, it must be empty for deletion to succeed. - * - * @return true if the file is successfully deleted; - * false otherwise. - * @exception SecurityException If the user is denied access to the file. -**/ - public boolean delete() - throws SecurityException - { - try - { - int returnCode = ifsFile_.delete0(); - if ((returnCode == IFSReturnCodeRep.ACCESS_DENIED_TO_DIR_ENTRY) - || (returnCode == IFSReturnCodeRep.ACCESS_DENIED_TO_REQUEST)) - { - throw new SecurityException(ResourceBundleLoader.getText(mapRC(returnCode))); - } - return (returnCode == IFSReturnCodeRep.SUCCESS); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return false; - } - } - -/** - * Compares this IFSJavaFile against the specified object. - * Returns true if and only if the argument is - * not null and is an IFSJavaFile - * object whose path name is equal to the path name of - * this IFSJavaFile, - * and system names of the objects are equal. - * - * @param obj The object to compare with. - * - * @return true if the objects are the same; - * false otherwise. -**/ - public boolean equals(Object obj) - { - if (obj == null || !(obj instanceof IFSJavaFile)) - return false; - - // return getPath().equals(((IFSJavaFile)obj).getPath()); // @A4D - - // @A4A: - IFSFile otherIfsFile = ((IFSJavaFile)obj).getIfsFile(); - return (ifsFile_.equals(otherIfsFile)); - } - -/** - * Indicates if the IFSJavaFile exists. - * - * @return true if the file specified by this object - * exists; false otherwise. - * @exception SecurityException If the user is denied read access to the file. - * @exception SecurityException If the user is denied access to the file. -**/ - public boolean exists() - throws SecurityException - { - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - try - { - returnCode = ifsFile_.exists0(); //@A5c - if (returnCode == IFSReturnCodeRep.ACCESS_DENIED_TO_DIR_ENTRY - || returnCode == IFSReturnCodeRep.ACCESS_DENIED_TO_REQUEST) - { - throw new SecurityException(ResourceBundleLoader.getText(mapRC(returnCode))); - } - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return false; - } - return (returnCode == IFSReturnCodeRep.SUCCESS); - } - -/** - * Returns An IFSJavaFile object based on the absolute path name of the - * current object. If the system property is set, it is copied to - * the returned object. - * - * @return an IFSJavaFile object based on the absolute path name - * of the current object. - * - * @see #getAbsolutePath() -**/ - public File getAbsoluteFile() - { - if (getSystem() != null) - return new IFSJavaFile(getSystem(), this.getAbsolutePath()); - else - return new IFSJavaFile(this.getAbsolutePath()); - } - - -/** - * Returns the absolute path name of the IFSJavaFile. - * This is the full path starting at the root directory. - * - * @return The absolute path name for this IFSJavaFile. - * All paths are absolute paths in the integrated file system. - * - * @see #isAbsolute() -**/ - public String getAbsolutePath() - { - String pathString = ifsFile_.getAbsolutePath(); - if (pathString != null && replace_) //@P2C - { - return pathString.replace(AS400_SEPARATOR, separatorChar); - } - return pathString; - } - - -/** - * Returns An IFSJavaFile object based on the canonical path name of the - * current object. If the system property is set, it is - * copied to the returned object. - * - * @return an IFSJavaFile object based on the canonical path name - * of the current object. - * - * @exception IOException If an I/O error occurs while communicating with the IBM i system. - * @see #getCanonicalPath -**/ - public File getCanonicalFile() throws IOException - { - if (getSystem() != null) - return new IFSJavaFile(getSystem(), this.getCanonicalPath()); - else - return new IFSJavaFile(this.getCanonicalPath()); - } - -/** - * Returns the path name in canonical form of IFSJavaFile path. - * This is the full path starting at the root directory. - * - * @return The canonical path name for this IFSJavaFile. - * - * @exception IOException If an I/O error occurs while communicating with the IBM i system. -**/ - public String getCanonicalPath() throws IOException - { - String pathString = ifsFile_.getCanonicalPath(); - if (pathString != null && replace_) //@P2C - { - return pathString.replace(AS400_SEPARATOR, separatorChar); - } - return pathString; - } - - - /** - Returns the number of unallocated bytes in the partition named by this abstract path name. -

    - The returned number of unallocated bytes is a hint, but not a guarantee, that it is possible to use most or any of these bytes. The number of unallocated bytes is most likely to be accurate immediately after this call. It is likely to be made inaccurate by any external I/O operations including those made on the system outside of this virtual machine. This method makes no guarantee that write operations to this file system will succeed. - - @return The number of unallocated bytes on the partition; or 0L if the abstract pathname does not name a partition. This value will be less than or equal to the total file system size returned by getTotalSpace(). - @exception SecurityException If the user is denied access to the file. - **/ - public long getFreeSpace() - throws SecurityException - { - try - { - return ifsFile_.getAvailableSpace(false); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return 0L; - } - } - - - /** - Returns the size of the partition named by this abstract pathname. - - @return The size, in bytes, of the partition; or 0L if this abstract pathname does not name a partition. - @exception SecurityException If the user is denied access to the file. - **/ - public long getTotalSpace() - throws SecurityException - { - try - { - return ifsFile_.getTotalSpace(false); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return 0L; - } - } - - - /** - Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname. When possible, this method checks for write permissions and other operating system restrictions and will therefore usually provide a more accurate estimate of how much new data can actually be written than getFreeSpace(). -

    - The returned number of available bytes is a hint, but not a guarantee, that it is possible to use most or any of these bytes. The number of unallocated bytes is most likely to be accurate immediately after this call. It is likely to be made inaccurate by any external I/O operations including those made on the system outside of this virtual machine. This method makes no guarantee that write operations to this file system will succeed. -

    - Note: If the user profile has a "maximum storage allowed" setting of *NOMAX, then getUsableSpace() returns the same value as {@link #getFreeSpace getFreeSpace()}. - - @return The number of available bytes on the partition; or 0L if the abstract pathname does not name a partition. - @exception SecurityException If the user is denied access to the file. - **/ - public long getUsableSpace() - throws SecurityException - { - try - { - return ifsFile_.getAvailableSpace(true); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return 0L; - } - } - - -/** - * Returns the IFSFile object contained within this IFSJavaFile. - * - * @return The IFSFile object contained within this IFSJavaFile. -**/ - IFSFile getIfsFile() - { - return ifsFile_; - } - - -/** - * Returns the name of the IFSJavaFile. The name - * is everything in the path name after the last occurrence of the - * separator character. - *

    - * The following example demonstrates the use of this method: - *

    - * In this example, fileName would equal "file.dat". - *

    - *  String path = "\\path\\file.dat";
    - *  IFSJavaFile file  = new IFSJavaFile(new AS400("enterprise"), path);
    - * 
    - * String fileName = file.getName(); - *
    - * - * @return The name (without any directory components) of this IFSJavaFile. -**/ - public String getName() - { - return ifsFile_.getName(); - } - -/** - * Returns the parent directory of the IFSJavaFile. The parent directory is everything in - * the path name before the last occurrence of the separator - * character, or null if the separator character does not appear in - * the path name. - *

    - * The following example demonstrates the use of this method: - *

    - * In this example, parentPath would equal "\test". - *

    - *  String path = "\\test\\path";
    - *  IFSJavaFile file  = new IFSJavaFile(new AS400("enterprise"), path);
    - * 
    - * String parentPath = file.getParent(); - *
    - * - * @return The parent directory if one exists; null otherwise. - * @see #getParentFile() -**/ - public String getParent() - { - String parentString = ifsFile_.getParent(); - if (parentString != null && replace_) //@P2C - { - return parentString.replace(AS400_SEPARATOR, separatorChar); - } - return parentString; - } - -/** - * Returns an IFSJavaFile object that represents the parent of - * the current object. The parent is the path name before the - * last occurrence of the separator character. Null is returned - * if the separator character does not appear in the path - * or the current object is the file system root. - * If the system property is set, it is also copied to the returned object. - * - * @return an IFSJavaFile object representing the - * parent directory if one exists; null otherwise. - * - * @see #getParent() -**/ - public File getParentFile() - { - if (getParent() == null) - return null; - if (getSystem() != null) - return new IFSJavaFile(getSystem(), this.getParent()); - else - return new IFSJavaFile(this.getParent()); - } - - - -/** - * Returns the path name of the IFSJavaFile. - *

    - * The following example demonstrates the use of this method: - *

    - * In this example, thePath would equal "\test\path" the same value as path. - *

    - *  String path = "\\test\\path";
    - *  IFSJavaFile file  = new IFSJavaFile(new AS400("enterprise"), path);
    - * 
    - * String thePath = file.getPath(); - *
    - * - * @return The file path name. -**/ - public String getPath() - { - String pathString = ifsFile_.getPath(); - if (pathString != null && replace_) //@P2C - { - return pathString.replace(AS400_SEPARATOR, separatorChar); - } - return pathString; - } - - - /** - Returns the pattern-matching behavior used when files are listed by any of the list() or listFiles() methods. The default is PATTERN_POSIX. - @return Either {@link IFSFile#PATTERN_POSIX PATTERN_POSIX}, {@link IFSFile#PATTERN_POSIX_ALL PATTERN_POSIX_ALL}, or {@link IFSFile#PATTERN_OS2 PATTERN_OS2} - **/ - public int getPatternMatching() - throws IOException - { - return ifsFile_.getPatternMatching(); - } - -/** - * Returns the system that this object references. - * - * @return The system object. -**/ - public AS400 getSystem() - { - return ifsFile_.getSystem(); - } - -/** - * Computes a hashcode for this object. - * - * @return A hash code value for this object. -**/ - public int hashCode() - { - return ifsFile_.hashCode(); - } - -/** - * Indicates if the path name of this IFSJavaFile is an - * absolute path name. - * - * @return true if the path name specification is absolute; false otherwise. -**/ - public boolean isAbsolute() - { - // Formerly, this method always reported true, since IFSFile.isAbsolute always reports true. - // In order for JFileChooser to work properly (when used in combination with IFSFileSystemView), instances of IFSJavaFile must remember whether they were created with an absolute path. The underlying IFSFile instance assumes it was created with an absolute path, so we can't rely on the IFSFile to keep track of that for us. - // More details: There is logic in javax.swing.plaf.basic.BasicFileChooserUI#ApproveSelectionAction.actionPerformed() that calls File.isAbsolute(). If not absolute, BasicFileChooserUI prepends the directory path and creates a new (absolute) File object. For that reason, each instance of IFSJavaFile needs to remember whether it was created with an absolute path or not. - - //return ifsFile_.isAbsolute(); - return absolute_; - } - - - // Utility method for determining whether a path is absolute. - static boolean isAbsolutePath(String path) { - if (path != null && path.length() != 0 && path.charAt(0) == separatorChar) { - return true; - } - else return false; - } - -/** - * Indicates if the IFSJavaFile is a directory. - * - * @return true if the IFSJavaFile exists and is a directory; false otherwise. - * @exception SecurityException If the user is denied access to the file. -**/ - public boolean isDirectory() - throws SecurityException - { - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - try - { - returnCode = ifsFile_.isDirectory0(); - if (returnCode == IFSReturnCodeRep.ACCESS_DENIED_TO_DIR_ENTRY - || returnCode == IFSReturnCodeRep.ACCESS_DENIED_TO_REQUEST) - { - throw new SecurityException(ResourceBundleLoader.getText(mapRC(returnCode))); - } - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return false; - } - return (returnCode == IFSReturnCodeRep.SUCCESS); - } - -/** - * Indicates if the IFSJavaFile is a "normal" file.
    - * A file is "normal" if it is not a directory or a container of other objects. - * - * @return true if the specified file exists and is a "normal" file; false otherwise. - * @exception SecurityException If the user is denied access to the file. -**/ - public boolean isFile() - throws SecurityException - { - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - try - { - returnCode = ifsFile_.isFile0(); - if (returnCode == IFSReturnCodeRep.ACCESS_DENIED_TO_DIR_ENTRY - || returnCode == IFSReturnCodeRep.ACCESS_DENIED_TO_REQUEST) - { - throw new SecurityException(ResourceBundleLoader.getText(mapRC(returnCode))); - } - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return false; - } - return (returnCode == IFSReturnCodeRep.SUCCESS); - } - - -/** - * Indicates if the IFSJavaFile is hidden. On the IBM i system, a file is - * hidden if its hidden attribute is set. - * - * @return true if the file is hidden; false otherwise. - * @exception SecurityException If the user is denied access to the file. -**/ - public boolean isHidden() - throws SecurityException - { - try - { - return ifsFile_.isHidden(); - } - catch (AS400SecurityException e) - { - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return false; - } - } - - -/** - * Indicates the time that the IFSJavaFile was last modified. - * - * @return The time (measured in milliseconds since - * 01/01/1970 00:00:00 GMT) that the IFSJavaFile was - * last modified, or 0 if it does not exist. - * @exception SecurityException If the user is denied access to the file. -**/ - public long lastModified() - throws SecurityException - { - try - { - return ifsFile_.lastModified0(); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return 0L; - } - } - -/** - * Indicates the length of this IFSJavaFile. - * - * @return The length, in bytes, of the IFSJavaFile, - * or 0((IFSJavaFile) if it does not exist. - * @exception SecurityException If the user is denied access to the file. -**/ - public long length() - throws SecurityException - { - try - { - // For the listFiles() methods, the IFS File Server reports the length of - // a symbolic link rather than the length of the target object. Circumvention - // is to clear the ifsFile cache and re-retrieve the attributes from the IFS - // File Server. When not using wild-cards the IFS File Server always follows - // symlnk objects and returns the attributes of the target object. - if (ifsFile_.isSymbolicLink()) //@B1A - ifsFile_.clearCachedAttributes(); //@B1A - return ifsFile_.length0(); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return 0L; - } - } - -/** - * Lists the files in this IFSJavaFile directory. - * - * @return An array of object names in the directory. - * This list does not include the current directory - * or the parent directory. If this IFSJavaFile is not - * a directory, null is returned. - * If this IFSJavaFile is an empty directory, - * an empty string array is returned. - * @see #listFiles() - * @exception SecurityException If the user is denied access to the file. -**/ - public String[] list() - throws SecurityException - { - try - { - return ifsFile_.list0(null, "*"); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return new String[0]; - } - } - -/** - * Lists the files in this IFSJavaFile directory that satisfy filter. - * - * @param filter The file name filter. - * - * @return An array of object names in the directory that satisfy - * the file name filter. This list does not include the current - * directory or the parent directory. If this IFSJavaFile is not - * a directory, null is returned. If this IFSJavaFile is an empty - * directory, or the file name filter does - * not match any files, an empty string array is returned. - * The IFSJavaFile object passed to the file name filter object have cached - * file attribute information. Maintaining references to these - * IFSJavaFile objects after the list operation increases the - * chances that their file attribute information will not be valid. - *

    - * The following example demonstrates the use of this method: - *

    - *  class AcceptClass implements java.io.FilenameFilter
    - *  {
    - *    public boolean accept(java.io.File dir, java.lang.String name)
    - *    {
    - *      if (name.startsWith("IFS"))
    - *        return true;
    - *      return false;
    - *    }
    - *  }
    - * 
    - * IFSJavaFile file = new IFSJavaFile(new AS400("enterprise"), path); - * AcceptClass ac = new AcceptClass(); - * file.list(ac); - *
    - * @exception SecurityException If the user is denied access to the file. - * @see #listFiles(FilenameFilter) -**/ - public String[] list(FilenameFilter filter) - throws SecurityException - { - String names[] = null; - - try - { - names = ifsFile_.list0(null, "*"); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return null; - } - - if (names == null) - { - return null; - } - - // Fill in the Vector - Vector v = new Vector(); - for (int i = 0 ; i < names.length ; i++) - { - if ((filter == null) || filter.accept(this, names[i])) - { - v.addElement(names[i]); - } - } - - // Create the array - String files[] = new String[v.size()]; - v.copyInto(files); - - return files; - } - -/** - * Lists the files in the IFSJavaFile directory that satisfy file name filter. - * - * @param filter The file name filter. - * - * @return An array of object names in the directory that - * satisfy the file name filter. This list does not include the current - * directory or the parent directory. - * If this IFSJavaFile is not a directory, null is - * returned. If this IFSJavaFile is an empty directory, or - * the file name filter does not match any files, an empty string array - * is returned. The IFSFile object passed to the file name filter object - * have cached file attribute information. Maintaining - * references to these IFSFile objects after the list operation - * increases the chances that their file attribute information - * will not be valid. - *

    - * The following example demonstrates the use of this method: - *

    - *  class AcceptClass implements IFSFileFilter
    - *  {
    - *    public boolean accept(IFSFile file)
    - *    {
    - *      if (file.getName().startsWith("IFS"))
    - *        return true;
    - *      return false;
    - *    }
    - *  }
    - * 
    - * IFSJavaFile file = new IFSJavaFile(new AS400("enterprise"), path); - * AcceptClass ac = new AcceptClass(); - * file.list(ac); - * - *
    - * @exception SecurityException If the user is denied access to the file. - * @see #listFiles(IFSFileFilter) -**/ - public String[] list(IFSFileFilter filter) - throws SecurityException - { - try - { - return ifsFile_.list0(filter,"*"); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return new String[0]; - } - } - -/** - * Lists the files in this IFSJavaFile directory that satisfy filter and pattern. - * - *

    Note:
    If the file does not match pattern, it will not be processed by filter. - * - * @param filter The file name filter. - * @param pattern The pattern that all filenames must match. Acceptable characters are - * wildcards (* - matches multiple characters) and question marks (? - matches - * one character). Pattern must not be null. - * - * @return An array of object names in the directory that satisfy the file name filter - * and pattern. This list does not include the current directory or the parent - * directory. If this IFSJavaFile is not a directory, null is returned. If this - * IFSJavaFile is an empty directory, or the file name filter or pattern does not - * match any files, an empty string array is returned. The IFSFile object passed - * to the file name filter object have cached file attribute information. - * Maintaining references to these IFSFile objects after the list operation - * increases the chances that their file attribute information will not be valid. - * @exception SecurityException If the user is denied access to the file. - * @see #listFiles(IFSFileFilter,String) -**/ - public String[] list(IFSFileFilter filter, String pattern) - throws SecurityException - { - if (pattern == null) - throw new NullPointerException("pattern"); - - try - { - return ifsFile_.list0(filter, pattern); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return new String[0]; - } - } - -/** - * Lists the files in this IFSJavaFile directory that match pattern. - * - * @param pattern The pattern that all filenames must match. - * Acceptable characters are wildcards (* - matches - * multiple characters) and question marks (? - matches - * one character). - * - * @return An array of object names in the directory that match - * the pattern. This list does not include the current - * directory or the parent directory. If this IFSJavaFile - * is not a directory, null is returned. If this IFSJavaFile - * is an empty directory, or the pattern does not match any - * files, an empty string array is returned. - * @exception SecurityException If the user is denied access to the file. - * @see #listFiles(String) -**/ - public String[] list(String pattern) - throws SecurityException - { - if (pattern == null) - throw new NullPointerException("pattern"); - - try - { - return ifsFile_.list0(null,pattern); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return new String[0]; - } - } - - -//@A3A Added support for IFSFile.listFiles(). -/** - * Lists the files in this IFSJavaFile directory. - * With the use of this function, attribute information is cached and - * will not be refreshed from the IBM i system. This means attribute information may - * become inconsistent with the IBM i system. - * @return An array of objects in the directory. - * This list does not include the current directory - * or the parent directory. If this IFSJavaFile is not - * a directory, null is returned. - * If this IFSJavaFile is an empty directory, - * an empty object array is returned. - * @exception SecurityException If the user is denied access to the file. - * @see #list() -**/ - public File[] listFiles() - throws SecurityException - { - return listFiles(null,"*"); - } - -//@A3A Added support for IFSFile.listFiles(). -/** - * Lists the files in this IFSJavaFile directory that satisfy filter. - * With the use of this function, attribute information is cached and - * will not be refreshed from the IBM i system. This means attribute information may - * become inconsistent with the IBM i system. - * - * @param filter The file name filter. - * - * @return An array of objects in the directory that satisfy - * the file name filter. This list does not include the current - * directory or the parent directory. If this IFSJavaFile is not - * a directory, null is returned. If this IFSJavaFile is an empty - * directory, or the file name filter does - * not match any files, an empty object array is returned. - * The IFSJavaFile object passed to the file name filter object has cached - * file attribute information. Maintaining references to these - * IFSJavaFile objects after the list operation increases the - * chances that their file attribute information will not be valid. - *

    - * The following example demonstrates the use of this method: - *

    - *  class AcceptClass implements java.io.FilenameFilter
    - *  {
    - *    public boolean accept(java.io.File dir, java.lang.String name)
    - *    {
    - *      if (name.startsWith("IFS"))
    - *        return true;
    - *      return false;
    - *    }
    - *  }
    - * 
    - * IFSJavaFile file = new IFSJavaFile(new AS400("enterprise"), path); - * AcceptClass ac = new AcceptClass(); - * file.listFiles(ac); - *
    - * @exception SecurityException If the user is denied access to the file. - * @see #list(FilenameFilter) -**/ - public File[] listFiles(FilenameFilter filter) - throws SecurityException - { - IFSFile[] files = null; - try - { - files = ifsFile_.listFiles0(null, "*"); // @D2C @C3C - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return null; - } - - if (files == null) - { - return null; - } - - // Fill in the Vector - Vector v = new Vector(); - for (int i = 0 ; i < files.length ; i++) - { - if ((filter == null) || filter.accept(this, files[i].getName())) - { - //v.addElement(files[i]); // @A6d - v.addElement(new IFSJavaFile(files[i])); // @A6a - } - } - - // Create the array - IFSJavaFile newFiles[] = new IFSJavaFile[v.size()]; // @A6c -/* @A6d - for (int i = 0; i < files.length; i++) - { - newFiles[i] = new IFSJavaFile(files[i]); - } -*/ - v.copyInto(newFiles); // @A6a - - return newFiles; - } - -// @A7a -/** - * Lists the files in this IFSJavaFile directory that satisfy filter. - * With the use of this function, attribute information is cached and - * will not be refreshed from the IBM i system. This means attribute information may - * become inconsistent with the IBM i system. - * - * @param filter The file filter. - * - * @return An array of objects in the directory that satisfy - * the file filter. This list does not include the current - * directory or the parent directory. If this IFSJavaFile is not - * a directory, null is returned. If this IFSJavaFile is an empty - * directory, or the file filter does - * not match any files, an empty object array is returned. - * The IFSJavaFile object passed to the file filter object has cached - * file attribute information. Maintaining references to these - * IFSJavaFile objects after the list operation increases the - * chances that their file attribute information will not be valid. - *

    - * The following example demonstrates the use of this method: - *

    - *  class AcceptClass implements java.io.FileFilter
    - *  {
    - *    public boolean accept(java.io.File file)
    - *    {
    - *      if (file.getName().startsWith("IFS"))
    - *        return true;
    - *      return false;
    - *    }
    - *  }
    - * 
    - * IFSJavaFile file = new IFSJavaFile(new AS400("enterprise"), path); - * AcceptClass ac = new AcceptClass(); - * file.listFiles(ac); - *
    - * @exception SecurityException If the user is denied access to the file. -**/ - public File[] listFiles(FileFilter filter) - throws SecurityException - { - IFSFile[] files = null; - try - { - files = ifsFile_.listFiles0(null, "*"); // @C3C - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return null; - } - - if (files == null) - { - return null; - } - - // Fill in the Vector - Vector v = new Vector(); - for (int i = 0 ; i < files.length ; i++) - { - IFSJavaFile file = new IFSJavaFile(files[i]); - if ((filter == null) || filter.accept(file)) - { - v.addElement(file); - } - } - - // Create the array - IFSJavaFile newFiles[] = new IFSJavaFile[v.size()]; - v.copyInto(newFiles); - - return newFiles; - } - -//@A3A Added support for IFSFile.listFiles(). -/** - * Lists the files in the IFSJavaFile directory that satisfy file name filter. - * With the use of this function, attribute information is cached and - * will not be refreshed from the IBM i system. This means attribute information may - * become inconsistent with the IBM i system. - * @param filter The file name filter. - * - * @return An array of objects in the directory that - * satisfy the file name filter. This list does not include the current - * directory or the parent directory. - * If this IFSJavaFile is not a directory, null is - * returned. If this IFSJavaFile is an empty directory, or - * the file name filter does not match any files, an empty object array - * is returned. The IFSFile object passed to the file name filter object - * has cached file attribute information. Maintaining - * references to these IFSFile objects after the list operation - * increases the chances that their file attribute information - * will not be valid. - *

    - * The following example demonstrates the use of this method: - *

    - *  class AcceptClass implements IFSFileFilter
    - *  {
    - *    public boolean accept(IFSFile file)
    - *    {
    - *      if (file.getName().startsWith("IFS"))
    - *        return true;
    - *      return false;
    - *    }
    - *  }
    - * 
    - * IFSJavaFile file = new IFSJavaFile(new AS400("enterprise"), path); - * AcceptClass ac = new AcceptClass(); - * file.listFiles(ac); - * - *
    - * @exception SecurityException If the user is denied access to the file. - * @see #list(IFSFileFilter) -**/ - public File[] listFiles(IFSFileFilter filter) - throws SecurityException - { - return listFiles(filter,"*"); - } - -//@A3A Added support for IFSFile.listFiles(). -/** - * Lists the files in this IFSJavaFile directory that satisfy filter and - * pattern. With the use of this function, attribute information is cached and - * will not be refreshed from the IBM i system. This means attribute information may - * become inconsistent with the IBM i system. - * - *

    Note:
    If the file does not match pattern, it will not be processed by filter. - * - * @param filter The file name filter. - * @param pattern The pattern that all filenames must match. Acceptable characters are - * wildcards (* - matches multiple characters) and question marks (? - matches - * one character). Pattern must not be null. - * - * @return An array of objects in the directory that satisfy the file name filter - * and pattern. This list does not include the current directory or the parent - * directory. If this IFSJavaFile is not a directory, null is returned. If this - * IFSJavaFile is an empty directory, or the file name filter or pattern does not - * match any files, an empty object array is returned. The IFSFile object passed - * to the file name filter object has cached file attribute information. - * Maintaining references to these IFSFile objects after the list operation - * increases the chances that their file attribute information will not be valid. - * @exception SecurityException If the user is denied access to the file. - * @see #list(IFSFileFilter,String) -**/ - public File[] listFiles(IFSFileFilter filter, String pattern) - throws SecurityException - { - if (pattern == null) - throw new NullPointerException("pattern"); - - try - { - IFSFile files[] = ifsFile_.listFiles0(filter,pattern); // @D2C @C3C - IFSJavaFile newFiles[] = new IFSJavaFile[files.length]; - for (int i = 0; i < files.length; i++) - { - newFiles[i] = new IFSJavaFile(files[i]); - } - return newFiles; - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return new IFSJavaFile[0]; - } - } - -//@A3A Added support for IFSFile.listFiles(). -/** - * Lists the files in this IFSJavaFile directory that match pattern. - * With the use of this function, attribute information is cached and - * will not be refreshed from the IBM i system. This means attribute information may - * become inconsistent with the IBM i system. - * - * @param pattern The pattern that all filenames must match. - * Acceptable characters are wildcards (* - matches - * multiple characters) and question marks (? - matches - * one character). - * - * @return An array of object names in the directory that match - * the pattern. This list does not include the current - * directory or the parent directory. If this IFSJavaFile - * is not a directory, null is returned. If this IFSJavaFile - * is an empty directory, or the pattern does not match any - * files, an empty string array is returned. - * @exception SecurityException If the user is denied access to the file. - * @see #list(String) -**/ - public File[] listFiles(String pattern) - throws SecurityException - { - if (pattern == null) - throw new NullPointerException("pattern"); - - return listFiles(null, pattern); - } - - -/** - * Lists the file system roots for the integrated file system - * of the IBM i system. The IBM i integrated file system has - * only one root -- "/". - * - * @return An array of IFSJavaFile objects that represent the - * file system roots of the integrated file system - * of the IBM i system. Since the IBM i integrated file system - * has only one root, the returned - * array contains only one element. -**/ - public static File[] listRoots() - { - IFSJavaFile[] roots = new IFSJavaFile[1]; - //roots[0] = new IFSJavaFile(IFSFile.separator); // @A6d - roots[0] = new IFSJavaFile(File.separator); // @A6c - return roots; - } - - - -// convert return code to string for mri file - private String mapRC(int returnCode) - { - if (returnCode== IFSReturnCodeRep.ACCESS_DENIED_TO_DIR_ENTRY) - { - return "EXC_ACCESS_DENIED"; - } else - if (returnCode == IFSReturnCodeRep.ACCESS_DENIED_TO_REQUEST) - { - return "EXC_REQUEST_DENIED"; - } - return "EXC_UNKNOWN"; // Bad return code was provided. - } - -/** - * Creates a directory whose path name - * is specified by this IFSJavaFile. - - * - * @return true if the directory could be created; - * false otherwise. - * @exception SecurityException If the user is denied access to the file. -**/ - public boolean mkdir() - throws SecurityException - { - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - try - { - returnCode = ifsFile_.mkdir0(ifsFile_.getAbsolutePath()); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return false; - } - return (returnCode == IFSReturnCodeRep.SUCCESS); - } - -/** - * Creates a directory whose path name is - * specified by this IFSJavaFile, including any necessary - * parent directories. - * - * @return true if the directory (or directories) could be - * created; false otherwise. - * @exception SecurityException If the user is denied access to the file. -**/ - public boolean mkdirs() - throws SecurityException - { - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - try - { - returnCode = ifsFile_.mkdirs0(); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return false; - } - return (returnCode == IFSReturnCodeRep.SUCCESS); - } - -/** - * Renames the IFSJavaFile to have the path name of dest. - * Wildcards are not permitted in this file name. - * - * @param dest The new filename. - * - * @return true if the renaming succeeds; - * false otherwise. - * @exception SecurityException If the user is denied access to the file. -**/ - public boolean renameTo(IFSJavaFile dest) - throws SecurityException - { - if (dest == null) - throw new NullPointerException("dest"); - - int returnCode = IFSReturnCodeRep.FILE_NOT_FOUND; - IFSFile lFile = new IFSFile(); - - try - { - lFile.setSystem(dest.getSystem()); - String destPath = dest.getPath(); //@P2A - lFile.setPath(replace_ ? destPath.replace(separatorChar, AS400_SEPARATOR) : destPath); //@P2C - returnCode = ifsFile_.renameTo0(lFile); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (PropertyVetoException e) {} // will never happen - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return false; - } - return (returnCode == IFSReturnCodeRep.SUCCESS); - } - -// @A7a -/** - * Renames the IFSJavaFile to have the path name of dest. - * Wildcards are not permitted in this file name. - * - * @param dest An object specifying the new filename. - * If this object is not an IFSJavaFile, the rename will fail. - * - * @return true if the renaming succeeds; - * false otherwise. - * @exception SecurityException If the user is denied access to the file. -**/ - public boolean renameTo(File dest) - throws SecurityException - { - try { - return renameTo((IFSJavaFile)dest); - } - catch (ClassCastException e) { - Trace.log(Trace.ERROR, e); - return false; - } - } - - -/** - * Sets the last modified time of the file named by this - * IFSJavaFile object. - * - * @param time The new last modified time, measured in milliseconds since - * 00:00:00 GMT, January 1, 1970. - * If -1, sets the last modified time to the current system time. - * @return true if the time is set; false otherwise. - * @exception SecurityException If the user is denied access to the file. -**/ - public boolean setLastModified(long time) - throws SecurityException - { - try - { - return ifsFile_.setLastModified0(time); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return false; - } - } - - // @B8a - /** - * Sets the length of the file named by this - * IFSJavaFile object. The file can be made larger or smaller. - * If the file is made larger, the contents of the new bytes - * of the file are undetermined. - * @param length The new length, in bytes. - * @return true if successful; false otherwise. - * @exception SecurityException If the user is denied access to the file. - **/ - public boolean setLength(int length) - throws SecurityException - { - try - { - return ifsFile_.setLength0(length); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return false; - } - } - - -/** - * Sets the path for this IFSJavaFile. - * - * @param path The absolute file path. - * - * @return true if the path was set; - * false otherwise. -**/ - public boolean setPath(String path) - { - if (path == null) - { - throw new NullPointerException("path"); - } - - try - { - ifsFile_.setPath(replace_ ? path.replace(separatorChar, AS400_SEPARATOR) : path); //@P2C - absolute_ = isAbsolutePath(path); - } - catch (PropertyVetoException e) {} // will never happen - return true; - } - - - /** - Sets the pattern-matching behavior used when files are listed by any of the list() or listFiles() methods. The default is PATTERN_POSIX. - @param patternMatching Either {@link IFSFile#PATTERN_POSIX PATTERN_POSIX}, {@link IFSFile#PATTERN_POSIX_ALL PATTERN_POSIX_ALL}, or {@link IFSFile#PATTERN_OS2 PATTERN_OS2} - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the system. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - **/ - public void setPatternMatching(int patternMatching) - throws IOException - { - ifsFile_.setPatternMatching(patternMatching); - } - - -/** - * Marks the file named by this IFSJavaFile object so that only - * read operations are allowed. On the IBM i system, a file is marked - * read only by setting the read only attribute of the file. - * - * @return true if the read only attribute is set; false otherwise. - * @exception SecurityException If the user is denied access to the file. -**/ - public boolean setReadOnly() - throws SecurityException - { - try - { - return ifsFile_.setReadOnly0(true); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return false; - } - } - - - -/** - * Sets the system. - * - * @param system The system object. - * - * @return true if the system was set; - * false otherwise. -**/ - public boolean setSystem(AS400 system) - { - if (system == null) - { - throw new NullPointerException("system"); - } - - try - { - ifsFile_.setSystem(system); - } - catch (PropertyVetoException e) {} // will never happen - return true; - } - - - /** - A convenience method to set the owner's execute permission for this abstract pathname. - This method is supported for IBM i V5R1 and higher. For older releases, it simply returns false. -

    - An invocation of this method of the form file.setExcutable(arg) behaves in exactly the same way as the invocation file.setExecutable(arg, true) - - @param executable If true, sets the access permission to allow execute operations; if false, to disallow execute operations. - @return true if and only if the operation succeeded. The operation will fail if the user does not have permission to change the access permissions of this abstract pathname. - @exception SecurityException If the user is denied access to the file. - **/ - public boolean setExecutable(boolean executable) - throws SecurityException - { - return setExecutable(executable, true); - } - - - /** - Sets the owner's or everybody's execute permission for this abstract pathname. - This method is supported for IBM i V5R1 and higher. For older releases, it simply returns false. - - @param executable If true, sets the access permission to allow execute operations; if false, to disallow execute operations. - @param ownerOnly If true, the execute permission applies only to the owner's execute permission; otherwise, it applies to everybody. - @return true if and only if the operation succeeded. The operation will fail if the user does not have permission to change the access permissions of this abstract pathname. - @exception SecurityException If the user is denied access to the file. - **/ - public boolean setExecutable(boolean executable, - boolean ownerOnly) - throws SecurityException - { - try - { - return ifsFile_.setAccess(IFSFile.ACCESS_EXECUTE, executable, ownerOnly); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return false; - } - } - - - /** - A convenience method to set the owner's read permission for this abstract pathname. - This method is supported for IBM i V5R1 and higher. For older releases, it simply returns false. -

    - An invocation of this method of the form file.setReadable(arg) behaves in exactly the same way as the invocation file.setReadable(arg, true) - - @param readable If true, sets the access permission to allow read operations; if false, to disallow read operations. - @return true if and only if the operation succeeded. The operation will fail if the user does not have permission to change the access permissions of this abstract pathname. - @exception SecurityException If the user is denied access to the file. - **/ - public boolean setReadable(boolean readable) - throws SecurityException - { - return setReadable(readable, true); - } - - - /** - Sets the owner's or everybody's read permission for this abstract pathname. - This method is supported for IBM i V5R1 and higher. For older releases, it simply returns false. - - @param readable If true, sets the access permission to allow read operations; if false, to disallow read operations. - @param ownerOnly If true, the read permission applies only to the owner's read permission; otherwise, it applies to everybody. - @return true if and only if the operation succeeded. The operation will fail if the user does not have permission to change the access permissions of this abstract pathname. - @exception SecurityException If the user is denied access to the file. - **/ - public boolean setReadable(boolean readable, - boolean ownerOnly) - throws SecurityException - { - try - { - return ifsFile_.setAccess(IFSFile.ACCESS_READ, readable, ownerOnly); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return false; - } - } - - - /** - A convenience method to set the owner's write permission for this abstract pathname. - This method is supported for IBM i V5R1 and higher. For older releases, it simply returns false. -

    - An invocation of this method of the form file.setWritable(arg) behaves in exactly the same way as the invocation file.setWritable(arg, true) - - @param writable If true, sets the access permission to allow write operations; if false to disallow write operations - @return true if and only if the operation succeeded. The operation will fail if the user does not have permission to change the access permissions of this abstract pathname. - @exception SecurityException If the user is denied access to the file. - **/ - public boolean setWritable(boolean writable) - throws SecurityException - { - return setWritable(writable, true); - } - - - /** - Sets the owner's or everybody's write permission for this abstract pathname. - This method is supported for IBM i V5R1 and higher. For older releases, it simply returns false. - - @param writable If true, sets the access permission to allow write operations; if false, to disallow write operations. - @param ownerOnly If true, the write permission applies only to the owner's write permission; otherwise, it applies to everybody. - @return true if and only if the operation succeeded. The operation will fail if the user does not have permission to change the access permissions of this abstract pathname. - @exception SecurityException If the user is denied access to the file. - **/ - public boolean setWritable(boolean writable, - boolean ownerOnly) - throws SecurityException - { - try - { - return ifsFile_.setAccess(IFSFile.ACCESS_WRITE, writable, ownerOnly); - } - catch (AS400SecurityException e) - { - Trace.log(Trace.ERROR, e); - throw new SecurityException(e.getMessage()); - } - catch (IOException e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, e); - return false; - } - } - - - -/** - * Returns a string representation of this object. - * - * @return A string giving the path name of this object. -**/ - public String toString() - { - if (replace_) - { - return ifsFile_.toString().replace(AS400_SEPARATOR, separatorChar); - } - else { - return ifsFile_.toString(); - } - -// return replace_ ? ifsFile_.toString().replace(AS400_SEPARATOR, separatorChar) : ifsFile_.toString(); //@P2C - } - - -/** - * Converts the abstract path name into a file: URL. - * The IBM i file/directory will be accessed and if it is a directory the - * resulting URL will end with the IBM i separator character - * (forward slash). The system name will be obtained from - * the AS400 object. If the path name or AS400 object has - * not been set, a NullPointerException will be thrown. - * - * @return The URL form of the abstract path name of this object. - * - * @exception MalformedURLException If the URL cannot be formed. - * -**/ - public URL toURL() throws MalformedURLException - { - String objectName = null; - - if (isDirectory()) - objectName = getAbsolutePath() + separatorChar; - else - objectName = getAbsolutePath(); - - return new URL(URL_PROTOCOL, getSystem().getSystemName(), objectName); - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/IFSKey.java b/cvsroot/src/com/ibm/as400/access/IFSKey.java deleted file mode 100644 index f62b7e25a..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSKey.java +++ /dev/null @@ -1,75 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSKey.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** -The IFSKey class represents an opaque handle to a byte lock on an integrated file system object. IFSKey objects are constructed by the lock methods of various IFS classes. -@see IFSFileInputStream#lock -@see IFSFileInputStream#unlock -@see IFSFileOutputStream#lock -@see IFSFileOutputStream#unlock -@see IFSRandomAccessFile#lock -@see IFSRandomAccessFile#unlock -**/ -public class IFSKey - implements java.io.Serializable //@A1A -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - - int fileHandle_; // the file - long offset_; // the start offset in the file - long length_; // the number of bytes locked - boolean isMandatory_; // true if mandatory, otherwise advisory - -/** -Constructs as IFSKey object. -@param fileHandle The file handle of the file to which this key belongs. -@param offset The byte offset of the start of the lock. -@param length The number of bytes that are locked. -**/ - IFSKey(int fileHandle, - long offset, - long length, - boolean isMandatory) - { - fileHandle_ = fileHandle; - offset_ = offset; - length_ = length; - isMandatory_ = isMandatory; - } - - //@A1A - /** - Restores the state of this object from an object input stream. - @param ois The stream of state information. - @exception IOException If an error occurs while communicating with the server. - @exception ClassNotFoundException - **/ - private void readObject(java.io.ObjectInputStream ois) - throws java.io.IOException, ClassNotFoundException - { - // Restore the non-static and non-transient fields. - ois.defaultReadObject(); - } - -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSListAttrsRep.java b/cvsroot/src/com/ibm/as400/access/IFSListAttrsRep.java deleted file mode 100644 index 465910dd5..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSListAttrsRep.java +++ /dev/null @@ -1,437 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSListAttrsRep.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; -import java.util.Hashtable; - - -/** -List file attributes reply. -**/ -class IFSListAttrsRep extends IFSDataStream -{ - // Used for debugging only. This should always be false for production. - // When this is false, all debug code will theoretically compile out. @A3a - private static final boolean DEBUG = false; - - static final int FILE = 1; - static final int DIRECTORY = 2; - static final int SYMBOLIC_LINK = 3; - static final int AS400_OBJECT = 4; - static final int DEVICE_FIFO = 5; - static final int DEVICE_CHAR = 6; - static final int DEVICE_BLOCK = 7; - static final int SOCKET = 8; - - static final int FA_READONLY = 0x01; //@D1a - static final int FA_HIDDEN = 0x02; //@D1a - static final int FA_SYSTEM = 0x04; //@D1a - static final int FA_DIRECTORY = 0x10; - static final int FA_ARCHIVE = 0x20; //@D1a - - static final int OA_NONE = IFSListAttrsReq.OA_NONE; - static final int OA1 = IFSListAttrsReq.OA1; - static final int OA2 = IFSListAttrsReq.OA2; - - private static final int TEMPLATE_LENGTH_OFFSET = 16; - - private static final int HEADER_LENGTH = 20; - private static final int LLCP_LENGTH = 6; - - // Note: The following offsets are valid only if template length >= 61. - private static final int CREATE_DATE_OFFSET = 22; - private static final int MODIFY_DATE_OFFSET = 30; - private static final int ACCESS_DATE_OFFSET = 38; - private static final int FILE_SIZE_OFFSET = 46; - private static final int FIXED_ATTRS_OFFSET = 50; - private static final int OBJECT_TYPE_OFFSET = 54; - private static final int NUM_EXT_ATTRS_OFFSET = 56; - private static final int BYTES_EA_NAMES_OFFSET = 58; - private static final int BYTES_EA_VALUES_OFFSET = 62; - private static final int VERSION_NUMBER_OFFSET = 66; - private static final int AMOUNT_ACCESSED_OFFSET = 70; - private static final int ACCESS_HISTORY_OFFSET = 72; - private static final int NAME_CCSID_OFFSET = 73; // CCSID of the file/path name - private static final int CHECKOUT_CCSID_OFFSET = 75; - private static final int RESTART_ID_OFFSET = 77; - - // Additional fields if datastreamLevel >= 8: - private static final int LARGE_FILE_SIZE_OFFSET = 81; - private static final int SYMBOLIC_LINK_OFFSET = 91; - - -/** -Construct a list file attributes reply. -**/ - IFSListAttrsRep() - { - } - -/** -Generate a new instance of this type. -@return a reference to the new instance -**/ - public Object getNewDataStream() - { - return new IFSListAttrsRep(); - } - -/** -Get the date/time that the file was last accessed. -@return the date/time (measured as milliseconds since midnight January 1, 1970) of the last access -**/ - long getAccessDate() - { - return getDate(ACCESS_DATE_OFFSET); - } - - - /** - Get the CCSID value for the IFS file on the server. - @return the CCSID value for the IFS file on the server - **/ - int getCCSID(int datastreamLevel) // @A1A - { - // Get the 'CCSID of the object' field from the OA2 structure in the reply. - return getObjAttrs2().getCCSID(datastreamLevel); - } - -/** -Get the date/time that the file was created. -@return the date/time (measured as milliseconds since midnight January 1, 1970) of creation -**/ - long getCreationDate() - { - return getDate(CREATE_DATE_OFFSET); - } - - -/** -Get the extended attribute values, as a hashtable. -@return The extended attribute values. -**/ - Hashtable getExtendedAttributeValues() - { - Hashtable results = new Hashtable(); - - // The offset to the start of the "optional/variable section" depends on the datastream level. - int optionalSectionOffset = HEADER_LENGTH + get16bit(TEMPLATE_LENGTH_OFFSET); - - // Step through the optional fields, looking for the "EA list" field (code point 0x0009). - - int curLL_offset = optionalSectionOffset; - int curLL = get32bit(curLL_offset); // list length - int curCP = get16bit(curLL_offset+4); // code point - int eaListOffset; // offset to start of Extended Attr list - while (curCP != 0x0009 && (curLL_offset+curLL+6 <= data_.length)) - { - curLL_offset += curLL; - curLL = get32bit(curLL_offset); - curCP = get16bit(curLL_offset+4); - } - - if (curCP == 0x0009) - { - // We found the start of the Extended Attributes list. - eaListOffset = curLL_offset; // offset to "EA List Length" field - } - else - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "No Extended Attributes were returned."); - return results; // empty hashtable - } - - byte[] eaVal = null; - int eaCount = get16bit(eaListOffset+6); // number of EA structures returned - if (DEBUG) System.out.println("DEBUG Number of EA structures returned: " + eaCount); - - // Advance the offset, to point to the start of first repeating EA struct. - int offset = eaListOffset+8; - - for (int i=0; i (long)Integer.MAX_VALUE) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Specified offset value ("+offset+") exceeds maximum file length supported by system."); - offset = (long)Integer.MAX_VALUE; // set to maximum possible 'int' value - } - if (length > (long)Integer.MAX_VALUE) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Specified length value ("+length+") exceeds maximum file length supported by system."); - length = (long)Integer.MAX_VALUE; // set to maximum possible 'int' value - } - set32bit(20, LOCK_LIST_LL_OFFSET); - set32bit(0, LOCK_BASE_OFFSET_OFFSET); - set32bit((int)offset, RELATIVE_OFFSET_OFFSET); - set32bit((int)length, LENGTH_OFFSET); - } - else - { // 8-byte lengths and offsets - set32bit(32, LOCK_LIST_LL_OFFSET); - set64bit(0L, LOCK_BASE_OFFSET_OFFSET); - set64bit(offset, LARGE_RELATIVE_OFFSET_OFFSET); - set64bit(length, LARGE_LENGTH_OFFSET); - } - } - - private final static int getVariableSectionLength(int datastreamLevel) - { - return (datastreamLevel < 16 ? 20 : 32); - } - -} - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSObjAttrs1.java b/cvsroot/src/com/ibm/as400/access/IFSObjAttrs1.java deleted file mode 100644 index 162b4a7d0..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSObjAttrs1.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSObjAttrs1.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; - - -/** - Encapsulates a File Server "Object Attributes 1" structure (OA1, OA1a, or OA1b). - OA1* structures are used in several File Server requests and replies. - **/ -final class IFSObjAttrs1 implements Serializable -{ - // Design note: The File Server team has an include file named "sysattr.h", which contains the full details for the OA1 structure, including the details of the "Flags(1)" and "Flags(2)" fields. - - static final long serialVersionUID = 4L; - - // Location of the "Owner name flag" in the "Flags(1)" field of the OA1* structure. - // To retrieve the Owner name, this flag must be set in the 'list attributes' request. - static final int OWNER_NAME_FLAG = 0x00000800; - - - - private byte[] data_; - - - IFSObjAttrs1(byte[] data) - { - data_ = data; - } - - // Returns the value of the "Name of the owner of the object" field (at offset 224). - final String getOwnerName(int systemCcsid) throws UnsupportedEncodingException - { - ConvTable conv = ConvTable.getTable(systemCcsid, null); - String owner = conv.byteArrayToString(data_, 224, 10).trim(); - return owner; - } - - - final int length() - { - return data_.length; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSObjAttrs2.java b/cvsroot/src/com/ibm/as400/access/IFSObjAttrs2.java deleted file mode 100644 index 05b00d5b4..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSObjAttrs2.java +++ /dev/null @@ -1,151 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSObjAttrs2.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; - -/** - Encapsulates a File Server "Object Attributes 2" structure (OA2, OA2s, OA2b, or OA2c). - OA2* structures are used in several File Server requests and replies. - Note: This object does not include the 6 leading LL/CP bytes. - **/ -final class IFSObjAttrs2 implements Serializable -{ - // Design note: The File Server team has an include file named "vattr.h", which contains the full details for the OA2 structure. - static final long serialVersionUID = 4L; - private byte[] data_; - - - IFSObjAttrs2(byte[] data) - { - data_ = data; - } - - // Returns the value of the "CCSID of the object" field. - final int getCCSID(int datastreamLevel) - { - // Determine the offset into the OA* structure of the CCSID (or codepage) field. - int offsetToField = determineCCSIDOffset(datastreamLevel); - return (int)BinaryConverter.byteArrayToShort(data_, offsetToField) & 0x0000ffff; - } - - // Sets the value of the "CCSID of the object" field. - final void setCCSID(int ccsid, int datastreamLevel) - { - int offsetToField = determineCCSIDOffset(datastreamLevel); - byte[] ccsidBytes = BinaryConverter.shortToByteArray((short)ccsid); - System.arraycopy(ccsidBytes, 0, data_, offsetToField, 2); - } - - // Returns the contents of this OA2 structure. - // Does not include the 6 leading LL/CP bytes. - final byte[] getData() - { - return data_; - } - - // Returns the number of bytes contained in this OA2 structure. - // Does not include the 6 leading LL/CP bytes. - final int getLength() - { - return data_.length; - } - - // Returns the value of the "Owner user ID" field. (Offset 64) - final long getOwnerUID() - { - return (long)BinaryConverter.byteArrayToInt(data_, 64) & 0x0FFFFFFFFL; - } - - - /** - Get offset of the the 2-byte CCSID (or codepage) field in the OA2x structure. - @return the CCSID offset - **/ - static final int determineCCSIDOffset(int datastreamLevel) - { - // Note: Only if the server is reporting Datastream Level 2 (or later) will the reply have a CCSID field. - // If prior to Level 2, we must make do with the codepage value. - - /* - - Note: To figure out the format of the returned information, we need to - consider both the requested and reported Datastream Levels (DSLs): - - DSL requested DSL reported OA format sent - by client by server by server - _____________ ____________ _______________ - - 0 any OA2 - - 2 0 OA2 - - 2 F4F4 OA2a - - 2 2 OA2b - - 2 3 OA2b - - 8 0 OA2 - - 8 F4F4 OA2a - - 8 2 OA2b - - 8 3 OA2b - - 8 8 OA2c - - 16 0 OA2 - - 16 F4F4 OA2a - - 16 2 OA2b - - 16 3 OA2b - - 16 8 OA2c - - 16 12 OA2c - - 16 16 OA2c - - Note: Since the Toolbox will only request levels 0, 2, 8, or 16, - the server will never report level 1. - */ - int offset_into_OA; // offset into OA* structure for CCSID or codepage field - switch (datastreamLevel) - { - case 0: // OA2 - offset_into_OA = 126; // offset of the 'codepage' field in the OA2 structure - break; - case 0xF4F4: // OA2a - offset_into_OA = 142; // offset of the 'codepage' field in the OA2a structure - break; - default: // OA2b or OA2c - offset_into_OA = 134; // offset of the 'CCSID of object' field in the OA2b/OA2c structure - break; - } - return offset_into_OA; - } - - - final int length() - { - return data_.length; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSOpenRep.java b/cvsroot/src/com/ibm/as400/access/IFSOpenRep.java deleted file mode 100644 index 72e2db47d..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSOpenRep.java +++ /dev/null @@ -1,119 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSOpenRep.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** -Open file reply. -**/ -class IFSOpenRep extends IFSDataStream -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final int FILE_HANDLE_OFFSET = 22; - private static final int FILE_ID_OFFSET = 26; - private static final int FILE_DATA_CCSID_OFFSET = 34; - private static final int ACTION_TAKEN_OFFSET = 36; - private static final int CREATE_DATE_OFFSET = 38; - private static final int MODIFY_DATE_OFFSET = 46; - private static final int ACCESS_DATE_OFFSET = 54; - private static final int FILE_SIZE_OFFSET = 62; // field is zero if DSL >= 16 - private static final int FIXED_ATTRS_OFFSET = 66; - private static final int NEED_EXT_ATTRS_OFFSET = 70; - private static final int NUM_EXT_ATTRS_OFFSET = 72; - private static final int CHARS_EA_NAMES_OFFSET = 74; - private static final int BYTES_EA_VALUES_OFFSET = 78; - private static final int VERSION_OFFSET = 82; - private static final int AMOUNT_ACCESSED_OFFSET = 86; - private static final int ACCESS_HISTORY_OFFSET = 88; - - // Additional field if datastreamLevel >= 16: - private static final int LARGE_FILE_SIZE_OFFSET = 89; - -/** -Get the date/time that the file was last accessed. -@return the date/time (measured as milliseconds since midnight January 1, 1970) of the last access -**/ - long getAccessDate() - { - return getDate(ACCESS_DATE_OFFSET); - } - -/** -Get the date/time that the file was created. -@return the date/time (measured as milliseconds since midnight January 1, 1970) of creation -**/ - long getCreationDate() - { - return getDate(CREATE_DATE_OFFSET); - } - -/** -Get the file handle. -@return the file handle. -**/ - int getFileHandle() - { - return get32bit( FILE_HANDLE_OFFSET); - } - -/** -Get the file size. -@return the number of bytes in the file -**/ - long getFileSize(int datastreamLevel) // @A1c - { - if (datastreamLevel < 16) - { - // We need to suppress sign-extension if the leftmost bit is on. - int size = get32bit( FILE_SIZE_OFFSET); // @A1c - return ((long)size) & 0xffffffffL; // @A1c - } - else - { - return get64bit(LARGE_FILE_SIZE_OFFSET); - } - } - -/** -Get the date/time that the file was last modified. -@return the date/time (measured as milliseconds since midnight January 1, 1970) of the last modification -**/ - long getModificationDate() - { - return getDate(MODIFY_DATE_OFFSET); - } - -/** -Generate a new instance of this type. -@return a reference to the new instance -**/ - public Object getNewDataStream() - { - return new IFSOpenRep(); - } - -/** -Generates a hash code for this data stream. -@return the hash code -**/ - public int hashCode() - { - return 0x8002; - } -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSOpenReq.java b/cvsroot/src/com/ibm/as400/access/IFSOpenReq.java deleted file mode 100644 index 055816553..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSOpenReq.java +++ /dev/null @@ -1,154 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSOpenReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** -"Open file" request. -**/ -class IFSOpenReq extends IFSDataStreamReq -{ - // "access intent" values: - static final int PROGRAM_LOAD_ACCESS = 4; // "program load" access - static final int READ_ACCESS = 1; // "read" access - static final int WRITE_ACCESS = 2; // "write" access - // "share option" values: - static final int DENY_NONE = 0; // deny neither readers nor writers - static final int DENY_READERS = 1; // deny readers - static final int DENY_WRITERS = 2; // deny writers - // "data conversion" values: - static final int NO_CONVERSION = 0; // no conversion (binary forced) - static final int CONVERT_TO_CLIENT_CCSID = 1; // text forced, client CCSID - static final int CONVERT_TO_SERVER_CCSID = 2; // text forced, server CCSID - - // @D1a: add the following open options. - // IF FILE DOES NOT EXIST | IF FILE DOES EXIST - // ----------------------------- | --------------------- - static final int OPEN_OPTION_CREATE_OPEN = 1; // create if file does not exist | open existing file - static final int OPEN_OPTION_CREATE_REPLACE = 2; // create if file does not exist | replace existing file - static final int OPEN_OPTION_CREATE_FAIL = 4; // create if file does not exist | fail if file exists - static final int OPEN_OPTION_FAIL_OPEN = 8; // fail if file does not exist | open if file exists - static final int OPEN_OPTION_FAIL_REPLACE = 16; // fail if file does not exist | replace if file exists - - private static final int HEADER_LENGTH = 20; - - private static final int FILE_NAME_CCSID_OFFSET = 22; - private static final int WORKING_DIR_HANDLE_OFFSET = 24; - private static final int FILE_DATA_CCSID_OFFSET = 28; - private static final int ACCESS_OFFSET = 30; - private static final int FILE_SHARING_OFFSET = 32; - private static final int DATA_CONVERSION_OFFSET = 34; - private static final int DUPLICATE_FILE_OPT_OFFSET = 36; - private static final int CREATE_SIZE_OFFSET = 38; // field must be 0 if DSL >= 16 - private static final int FIXED_ATTRS_OFFSET = 42; - private static final int ATTRS_LIST_LEVEL_OFFSET = 46; - private static final int PRE_READ_OFFSET_OFFSET = 48; - private static final int PRE_READ_LENGTH_OFFSET = 52; - - // Additional field if datastreamLevel >= 16: - private static final int LARGE_CREATE_SIZE_OFFSET = 56; - - -/** -Construct an open file request. -@param fileName the name of the file to open -@param fileDataCCSID CCSID of the file data -@param accessIntent the intended access -@param fileSharing how the file can be shared with other users -@param dataConversionOption indicates the type of conversion the server performs -@param duplicateFileOption - bit 4: on = fail the open if the file doesn't exist, replace the file if it does; - bit 3: on = fail the open if the file doesn't exist, open the file if it does; - bit 2: on = create then open the file if it doesn't exist, fail the open if it does; - bit 1: on = create then open the file if it doesn't exist, replace the file if it does; - bit 0: on = create then open the file if it doesn't exist, open the file if it does -@param datastreamLevel the datastream level of the server -**/ - IFSOpenReq(byte[] fileName, - int fileNameCCSID, - int fileDataCCSID, - int accessIntent, - int fileSharing, - int dataConversionOption, - int duplicateFileOption, - int datastreamLevel) - { - super(HEADER_LENGTH + getTemplateLength(datastreamLevel) + 6 + fileName.length); - setLength(data_.length); - setTemplateLen(getTemplateLength(datastreamLevel)); - setReqRepID(0x0002); - set16bit(fileNameCCSID, FILE_NAME_CCSID_OFFSET); - set32bit(1, WORKING_DIR_HANDLE_OFFSET); - set16bit(fileDataCCSID, FILE_DATA_CCSID_OFFSET); - set16bit(accessIntent, ACCESS_OFFSET); - set16bit(fileSharing, FILE_SHARING_OFFSET); - set16bit(dataConversionOption, DATA_CONVERSION_OFFSET); - set16bit(duplicateFileOption, DUPLICATE_FILE_OPT_OFFSET); - set32bit(0, FIXED_ATTRS_OFFSET); - set16bit(1, ATTRS_LIST_LEVEL_OFFSET); - set32bit(0, PRE_READ_OFFSET_OFFSET); - set32bit(0, PRE_READ_LENGTH_OFFSET); - - if (datastreamLevel < 16) - { // Just set the old fields (4-byte length). - set32bit(0, CREATE_SIZE_OFFSET); - } - else - { - // Set old field to zero. - set32bit(0, CREATE_SIZE_OFFSET); - - // Set new field (8-byte length). - set64bit(0L, LARGE_CREATE_SIZE_OFFSET); - } - - // Set the LL. - set32bit(fileName.length + 6, getFilenameLLOffset(datastreamLevel)); - - // Set the code point. - set16bit(0x0002, getFilenameCPOffset(datastreamLevel)); - - // Set the file name characters. - System.arraycopy(fileName, 0, data_, getFilenameOffset(datastreamLevel), fileName.length); - } - - - // Determine offset (from beginning of request) to the 4-byte File Name "LL" field. - private final static int getFilenameLLOffset(int datastreamLevel) - { - return (datastreamLevel < 16 ? 56 : 64); - } - - // Determine offset (from beginning of request) to the 2-byte File Name "CP" field. - private final static int getFilenameCPOffset(int datastreamLevel) - { - return (datastreamLevel < 16 ? 60 : 68); - } - - // Determine offset (from beginning of request) to the File Name value field (follows LL/CP). - private final static int getFilenameOffset(int datastreamLevel) - { - return (datastreamLevel < 16 ? 62 : 70); - } - - private final static int getTemplateLength(int datastreamLevel) - { - return (datastreamLevel < 16 ? 36 : 44); - } - -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSPingReq.java b/cvsroot/src/com/ibm/as400/access/IFSPingReq.java deleted file mode 100644 index 552f99ce6..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSPingReq.java +++ /dev/null @@ -1,40 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSPingReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2008-2008 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -/** - Note: The File Server doesn't yet support or recognize a "ping" request. - This class simply provides a dummy request that we can send to the File Server, to elicit a reply. - We expect the File Server to reject this request with a reply (class IFSReturnCodeRep) indicating "request not supported". - That's fine, because when we receive the reply, we've verified that the connection is still alive. - **/ -class IFSPingReq extends IFSDataStreamReq -{ - private static final int TEMPLATE_LENGTH = 6; - - IFSPingReq() - { - super(20 + TEMPLATE_LENGTH); - - setLength(data_.length); - setTemplateLen(TEMPLATE_LENGTH); - // For consistencey, we set the request ID to that of the Signon Server's "Ping Request with Echo" (class SignonPingReq). - // Note that this request ID isn't recognized by the File Server. - setReqRepID(0x7FFE); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSQuerySpaceRep.java b/cvsroot/src/com/ibm/as400/access/IFSQuerySpaceRep.java deleted file mode 100644 index c634a4de0..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSQuerySpaceRep.java +++ /dev/null @@ -1,99 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSQuerySpaceRep.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -/** -Query available file system space reply. -**/ -class IFSQuerySpaceRep extends IFSDataStream -{ - // Special value that is returned by the system the Total Space field, indicating "no maximum". - private static final long NO_MAX = 0x7FFFFFFFL; - - private static final int UNIT_SIZE_OFFSET = 22; - private static final int TOTAL_SPACE_OFFSET = 26; - private static final int SPACE_AVAILABLE_OFFSET = 30; - -/** -Construct a query available file system space reply. -**/ - IFSQuerySpaceRep() - { - } - -/** -Generate a new instance of this type. -@return a reference to the new instance -**/ - public Object getNewDataStream() - { - return new IFSQuerySpaceRep(); - } - -/** -Return the space available (in bytes). -@return the available space (in bytes) -Returns special value Long.MAX_VALUE if the system reports "no maximum size". -(The File Server returns a bogus value in the Space Available field in that case.) -**/ - long getSpaceAvailable() - { - // Previously used get32bit(), but get32bit() incorrectly treated the 4 byte field - // as a 4-byte signed value. On large systems, where the most significant bit was - // set (in the IFSQuerySpaceRep response), we were returning a negative value. - // BinaryConverter.byteArrayToUnsignedInt() treats the data as unsigned. - - long totalSpace = BinaryConverter.byteArrayToUnsignedInt(data_, TOTAL_SPACE_OFFSET); - long spaceAvail = BinaryConverter.byteArrayToUnsignedInt(data_, SPACE_AVAILABLE_OFFSET); - long unitSize = BinaryConverter.byteArrayToUnsignedInt(data_, UNIT_SIZE_OFFSET); - - // Note: According to the PWSI Datastream Spec: - // "The value 0x7FFFFFFF is returned to indicate there is no maximum size for the Total Space and Space Available fields." - if (totalSpace == NO_MAX) return Long.MAX_VALUE; // no maximum storage limit - else return (unitSize * spaceAvail); - } - -/** -Return the total space (in bytes). -@return the total space (in bytes) -Returns special value Long.MAX_VALUE if the system reports "no maximum size". -**/ - long getTotalSpace() - { - long totalSpace = BinaryConverter.byteArrayToUnsignedInt(data_, TOTAL_SPACE_OFFSET); - long unitSize = BinaryConverter.byteArrayToUnsignedInt(data_, UNIT_SIZE_OFFSET); - - // Note: According to the PWSI Datastream Spec: - // "The value 0x7FFFFFFF is returned to indicate there is no maximum size for the Total Space and Space Available fields." - if (totalSpace == NO_MAX) return Long.MAX_VALUE; // no maximum storage limit - else return (unitSize * totalSpace); - } - -/** -Generates a hash code for this data stream. -@return the hash code -**/ - public int hashCode() - { - return 0x8007; - } -} - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSQuerySpaceReq.java b/cvsroot/src/com/ibm/as400/access/IFSQuerySpaceReq.java deleted file mode 100644 index f906e4d7e..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSQuerySpaceReq.java +++ /dev/null @@ -1,48 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSQuerySpaceReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - - - -/** -Query available file system space request. -**/ -class IFSQuerySpaceReq extends IFSDataStreamReq -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final int WORKING_DIR_HANDLE_OFFSET = 22; - private static final int TEMPLATE_LENGTH = 6; - - -/** -Construct a query file system space request. -@parm handle The working directory handle. -**/ - IFSQuerySpaceReq(int handle) - { - super(20 + TEMPLATE_LENGTH); - setLength(data_.length); - setTemplateLen(TEMPLATE_LENGTH); - setReqRepID(0x0015); - set32bit(handle, WORKING_DIR_HANDLE_OFFSET); - } - -} - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFile.java b/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFile.java deleted file mode 100644 index 4783b2edf..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFile.java +++ /dev/null @@ -1,1808 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSRandomAccessFile.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @A1 2008-02-22 Change seek() method to remove (int) cast when calling -// setFileOffset() which accepts a long parameter. -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.io.EOFException; -import java.io.IOException; -import java.util.Vector; - -/** - Supports read and write access to integrated file system objects. The position at which the next access occurs can be modified. This class offers methods that allow specified mode access of read-only, write-only, or read-write.
    IFSRandomAccessFile objects are capable of generating file events that call the following FileListener methods: fileClosed, fileModified, and fileOpened.
    - The following example illustrates the use of IFSRandomAccessFile: -

    - // Work with /Dir/File on the system eniac.
    - AS400 as400 = new AS400("eniac");
    - IFSRandomAccessFile file = new IFSRandomAccessFile(as400, "/Dir/File", "rw");
    - // Determine the file length.
    - long length = file.length();
    - // Lock the first 11 bytes.
    - IFSKey key = file.lock(0, 11);
    - // Write a string to the file.
    - file.writeChars("Hello world");
    - // Read the string we just wrote.
    - file.seek(0);
    - String s = file.readLine();
    - // Close the file.
    - file.close();
    - 
    - @see com.ibm.as400.access.FileEvent - @see #addFileListener - @see #removeFileListener - **/ -public class IFSRandomAccessFile -implements java.io.DataInput, java.io.DataOutput, java.io.Serializable -{ - static final long serialVersionUID = 4L; - - /** - Share option that allows read and write access by other users. - **/ - public final static int SHARE_ALL = 0xffffffff; - /** - Share option that does not allow read or write access by other users. - **/ - public final static int SHARE_NONE = 0xfffffffc; - /** - Share option that allows only read access by other users. - **/ - public final static int SHARE_READERS = 0xfffffffd; - /** - Share option that allows only write access by other users. - **/ - public final static int SHARE_WRITERS = 0xfffffffe; - - /** - File existence option that indicates that the request is either to fail if the file exists or is to create the file if it does not exist. - **/ - public final static int FAIL_OR_CREATE = 2; - /** - File existence option that indicates that the file is either to be opened if it exists or is to be created if it does not exist. - **/ - public final static int OPEN_OR_CREATE = 0; - /** - File existence option that indicates that the file is either to be opened if it exists or that the request is to fail if the file does not exist. - **/ - public final static int OPEN_OR_FAIL = 3; - /** - File existence option that indicates that the file is either to be replaced if it exists or is to be created if it does not exist. - **/ - public final static int REPLACE_OR_CREATE = 1; - /** - File existence option that indicates that the file is either to be replaced if it exists or that the request is to fail if the file does not exist. - **/ - public final static int REPLACE_OR_FAIL = 4; - - - - - transient private PropertyChangeSupport changes_; - transient private VetoableChangeSupport vetos_; - private int existenceOption_; - private IFSFileDescriptor fd_; // file info - never allowed to be null - transient private Vector fileListeners_; - private String mode_ = ""; - private boolean forceToStorage_ = false; - transient private byte[] bytes1; - transient private byte[] bytes2; - transient private byte[] bytes4; - transient private byte[] bytes8; - transient private IFSRandomAccessFileImpl impl_; - - - /** - Constructs an IFSRandomAccessFile object. It is a default random access file. - Other readers and writers are allowed to access the file. - **/ - public IFSRandomAccessFile() - { - // Instantiate a file descriptor. - fd_ = new IFSFileDescriptor(SHARE_ALL, this); - initializeTransient(); - } - - /** - Constructs an IFSRandomAccessFile object. It uses the specified system name, file - name, and mode. - If the mode is r, the file is opened if it - exists; otherwise, an IOException is thrown. If the mode is rw or - w, the file is opened if it exists; otherwise, the file is created. - Other readers and writers are allowed to access the file. - @param system The AS400 that contains the file. - @param name The file name. - @param mode The access mode
    • "r" read only
    • "w" write only
    • "rw" read/write
    - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSRandomAccessFile(AS400 system, - String name, - String mode) - throws AS400SecurityException, IOException - { - // Validate arguments. - if (system == null) - throw new NullPointerException("system"); - if (name == null) - throw new NullPointerException("name"); - - initializeTransient(); - - // Set the mode and existence option. - validateMode(mode); - mode_ = mode; - existenceOption_ = (mode.equals("r") ? OPEN_OR_FAIL : OPEN_OR_CREATE); - - // Instantiate a file descriptor. - fd_ = new IFSFileDescriptor(system, name, SHARE_ALL, this); - - // Connect to the AS400 byte stream server, and - // open the file. - connectAndOpen(); - } - - - /** - Constructs an IFSRandomAccessFile object. - It uses the specified system name, file - name, mode, share option, and existence option. - @param system The AS400 that contains the file. - @param name The file name. - @param mode The acess mode
    • "r" read only
    • "w" write only
    • "rw" read/write
    - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param existenceOption Indicates if the file should be created, opened or - if the request should fail based on the existence of the file. -
    • FAIL_OR_CREATE Fail if exists; create if not
    • OPEN_OR_CREATE - Open if exists; create if not
    • OPEN_OR_FAIL Open if exists; fail if - not
    • REPLACE_OR_CREATE Replace if exists; create if not
    • REPLACE_OR_FAIL - Replace if exists; fail if not
    - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSRandomAccessFile(AS400 system, - String name, - String mode, - int shareOption, - int existenceOption) - throws AS400SecurityException, IOException - { - // Validate arguments. - if (system == null) - throw new NullPointerException("system"); - if (name == null) - throw new NullPointerException("name"); - - initializeTransient(); - - // Set the mode, share option, and existence option. - validateMode(mode); - mode_ = mode; - - validateShareOption(shareOption); - - validateExistenceOption(existenceOption); - existenceOption_ = existenceOption; - - // Instantiate a file descriptor. - fd_ = new IFSFileDescriptor(system, name, shareOption, this); - - // Connect to the AS400 byte stream server, and - // open the file. - connectAndOpen(); - } - - - /** - Constructs an IFSRandomAccessFile object. - It uses the specified system name, file - name, mode, share option, and existence option. - - @param system The AS400 that contains the file. - @param file The file to access. - @param mode The access mode
    • "r" read only
    • "w" write only
    • "rw" read/write
    - @param shareOption Indicates how other user's can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param existenceOption Indicates if the file should be created, opened or if the request should fail based on the existence of the file.
    • FAIL_OR_CREATE Fail if exists; create if not
    • OPEN_OR_CREATE Open if exists; create if not
    • OPEN_OR_FAIL Open if exists; fail if not
    • REPLACE_OR_CREATE Replace if exists; create if not
    • REPLACE_OR_FAIL Replace if exists; fail if not
    - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @deprecated Use IFSRandomAccessFile(IFSFile,String,int,int) instead. - **/ - public IFSRandomAccessFile(AS400 system, - IFSFile file, - String mode, - int shareOption, - int existenceOption) - throws AS400SecurityException, IOException - { - // Validate arguments. - if (system == null) - throw new NullPointerException("system"); - if (file == null) - throw new NullPointerException("file"); - - initializeTransient(); - - // Set the mode, share option, and existence option. - validateMode(mode); - mode_ = mode; - - validateShareOption(shareOption); - - validateExistenceOption(existenceOption); - existenceOption_ = existenceOption; - - // Instantiate a file descriptor. - fd_ = new IFSFileDescriptor(system, file.getAbsolutePath(), shareOption, this); - - // Connect to the AS400 byte stream server, and - // open the file. - connectAndOpen(); - } - - - /** - Constructs an IFSRandomAccessFile object. - It uses the specified file, mode, share option, and existence option. - - @param file The file to access. - @param mode The access mode
    • "r" read only
    • "w" write only
    • "rw" read/write
    - @param shareOption Indicates how other user's can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param existenceOption Indicates if the file should be created, opened or if the request should fail based on the existence of the file.
    • FAIL_OR_CREATE Fail if exists; create if not
    • OPEN_OR_CREATE Open if exists; create if not
    • OPEN_OR_FAIL Open if exists; fail if not
    • REPLACE_OR_CREATE Replace if exists; create if not
    • REPLACE_OR_FAIL Replace if exists; fail if not
    - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSRandomAccessFile(IFSFile file, - String mode, - int shareOption, - int existenceOption) - throws AS400SecurityException, IOException - { - // Validate arguments. - if (file == null) - throw new NullPointerException("file"); - - initializeTransient(); - - // Set the mode, share option, and existence option. - validateMode(mode); - mode_ = mode; - - validateShareOption(shareOption); - - validateExistenceOption(existenceOption); - existenceOption_ = existenceOption; - - // Instantiate a file descriptor. - fd_ = new IFSFileDescriptor(file.getSystem(), file.getAbsolutePath(), shareOption, this); - - // Connect to the AS400 byte stream server, and - // open the file. - connectAndOpen(); - } - - - /** - Adds a file listener to receive file events from this IFSRandomAccessFile. - @param listener The file listener. - **/ - public void addFileListener(FileListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - synchronized(fileListeners_) - { - fileListeners_.addElement(listener); - } - } - - /** - Adds a property change listener. - @param listener The property change listener to add. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - changes_.addPropertyChangeListener(listener); - } - - /** - Adds a vetoable change listener. - @param listener The vetoable change listener to add. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - vetos_.addVetoableChangeListener(listener); - } - - /** - Chooses the appropriate implementation. - **/ - void chooseImpl () - { - if (impl_ == null) - { - // Ensure that the system has been set. - AS400 system = fd_.getSystem(); - if (system == null) - { - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - impl_ = (IFSRandomAccessFileImpl) system.loadImpl2 - ("com.ibm.as400.access.IFSRandomAccessFileImplRemote", - "com.ibm.as400.access.IFSRandomAccessFileImplProxy"); - impl_.setFD(fd_.getImpl()); - impl_.setExistenceOption(existenceOption_); - impl_.setForceToStorage(forceToStorage_); - impl_.setMode(mode_); - } - } - - /** - Closes this random access file stream and releases any system resources - associated with the stream. - @exception IOException If an error occurs while communicating with the system. - **/ - public void close() - throws IOException - { - if (fd_.isOpen()) - { - if (impl_ != null) - impl_.close(); - else - fd_.close(); - - // Fire the file close event. - if (fileListeners_.size() != 0) - { - IFSFileDescriptor.fireClosedEvents(this, fileListeners_); - } - } - } - - /** - Establishes communications with the AS400, and opens the file. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - private void connectAndOpen() - throws AS400SecurityException, IOException - { - if (impl_ == null) - { - chooseImpl(); - fd_.getSystem().connectService(AS400.FILE); - } - - impl_.connectAndOpen(); - - // Fire the file opened event. - if (fileListeners_.size() != 0) - IFSFileDescriptor.fireOpenedEvents(this, fileListeners_); - } - - - /** - Ensures that the stream is closed when there are no more references to it. - @exception IOException If an error occurs while communicating with the system. - **/ - protected void finalize() - throws IOException - { - if (fd_ != null && fd_.isOpen()) - { - // Close the file. Send a close request to the server. - if (impl_ != null) - impl_.close(); - else - fd_.close(); - } - - try - { - super.finalize(); - } - catch(Throwable e) - { - throw new IOException(e.toString()); - } - } - - /** - Forces any buffered output bytes to be written. - - @exception IOException If an error occurs while communicating with the system. - **/ - public void flush() - throws IOException - { - // Ensure that the file is open. - open(); - - impl_.flush(); - } - - /** - Returns the existence option for this object. - @return The existence option. - **/ - public int getExistenceOption() - { - return existenceOption_; - } - - - /** - Returns a file descriptor associated with this stream. - @return The file descriptor associated with this stream - @exception IOException If an error occurs while communicating with the system. - **/ - public final IFSFileDescriptor getFD() - throws IOException - { - return fd_; - } - - - /** - Returns the current offset in this file. - @return The offset from the beginning of the file, in bytes, at which the - next read or write occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public long getFilePointer() - throws IOException - { - // Ensure that the file is open. - open(); - - return (long) fd_.getFileOffset(); - } - - - /** - Returns the implementation object. - @return The implementation object associated with this object. - **/ - IFSRandomAccessFileImpl getImpl() - { - return impl_; // Note: This may be null. - } - - - /** - Returns the integrated file system path name of the object represented by - this IFSRandomAccessFile. - @return The absolute path name of the object. - **/ - public String getPath() - { - return fd_.getPath(); - } - - - /** - Returns the share option for this object. - @return The share option. - **/ - public int getShareOption() - { - return fd_.getShareOption(); - } - - - /** - Returns the AS400 system object for this stream. - @return The AS400 system object. - **/ - public AS400 getSystem() - { - return fd_.getSystem(); - } - - - /** - Provided to initialize transient data if this object is de-serialized. - **/ - private void initializeTransient() - { - changes_ = new PropertyChangeSupport(this); - vetos_ = new VetoableChangeSupport(this); - fileListeners_ = new Vector(); - bytes1 = new byte[1]; - bytes2 = new byte[2]; - bytes4 = new byte[4]; - bytes8 = new byte[8]; - impl_ = null; - } - - - /** - Returns the file length. - @return The file length, in bytes. - @exception IOException If an error occurs while communicating with the system. - **/ - public long length() - throws IOException - { - // Ensure that the file is open. - open(); - - return impl_.length(); - } - - - /** - Places a lock on the file at the specified bytes. - Note: This method is not supported for files under QSYS. - @param offset The first byte of the file to lock (zero is the first byte). - @param length The number of bytes to lock. - @return A key for undoing this lock. - - @exception IOException If an error occurs while communicating with the system. - - @see IFSKey - @see #unlock - @deprecated Replaced by {@link #lock(long,long) lock(long,long)} - **/ - public IFSKey lock(int offset, - int length) - throws IOException - { - // Validate the arguments. - if (offset < 0) - { - throw new ExtendedIllegalArgumentException("offset (" + - Integer.toString(offset) + - ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (length <= 0) - { - throw new ExtendedIllegalArgumentException("length (" + - Integer.toString(length) + - ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Ensure that the file is open. - open(); - - return impl_.lock(offset, length); - } - - - /** - Places a lock on the file at the specified bytes. - Note: This method is not supported for files under QSYS. - @param offset The first byte of the file to lock (zero is the first byte). - @param length The number of bytes to lock. - @return A key for undoing this lock. - - @exception IOException If an error occurs while communicating with the system. - - @see IFSKey - @see #unlock - **/ - public IFSKey lock(long offset, - long length) - throws IOException - { - // Validate the arguments. - if (offset < 0L) - { - throw new ExtendedIllegalArgumentException("offset (" + - Long.toString(offset) + - ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (length <= 0L) - { - throw new ExtendedIllegalArgumentException("length (" + - Long.toString(length) + - ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Ensure that the file is open. - open(); - - return impl_.lock(offset, length); - } - - - /** - Opens the specified file. - - @exception IOException If an error occurs while communicating with the system. - **/ - private void open() - throws IOException - { - if (impl_ == null) - { - chooseImpl(); - try { fd_.getSystem().connectService(AS400.FILE); } - catch(AS400SecurityException e) - { - Trace.log(Trace.ERROR, "Access to byte stream server on '" + - fd_.getSystem().getSystemName() + "' denied.", e); - throw new ExtendedIOException(ExtendedIOException.ACCESS_DENIED); - } - } - - // If the file is already open, do nothing. - if (fd_.isOpen()) - { - return; - } - else - { - impl_.open(); // Note: This also does a connect() if necessary. - - // Fire the file opened event. - if (fileListeners_.size() != 0) - IFSFileDescriptor.fireOpenedEvents(this, fileListeners_); - } - } - - - /** - Reads the next byte of data from this file. - @return The next byte of data, or -1 if the end of file is reached. - - @exception IOException If an error occurs while communicating with the system. - **/ - public int read() - throws IOException - { - int rc = read(bytes1, 0, 1); - int value; - - if (rc == 1) - { - value = (int) bytes1[0]; - value = value & 0xff; - } - else - { - value = -1; - } - - return value; - } - - - /** - Reads up to data.length bytes of data from this input stream into - data. - @param data The buffer into which data is read. - @return The total number of bytes read into the buffer, or -1 if there is no more data because the end of file has been reached. - - @exception IOException If an error occurs while communicating with the system. - **/ - public int read(byte[] data) - throws IOException - { - // Validate arguments. - if (data == null) - throw new NullPointerException("data"); - - return read(data, 0, data.length); - } - - - /** - Reads up to length bytes of data from this input stream into - data, starting at the array offset dataOffset. - @param data The buffer into which the data is read. - @param dataOffset The start offset of the data in the buffer. - @param length The maximum number of bytes to read. - @return The total number of bytes read into the buffer, or -1 if there is no more data because the end of file has been reached. - - @exception IOException If an error occurs while communicating with the system. - **/ - public int read(byte[] data, - int dataOffset, - int length) - throws IOException - { - // Validate arguments. - if (data == null) - throw new NullPointerException("data"); - if (dataOffset < 0) - throw new ExtendedIllegalArgumentException("dataOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if (length < 0) - throw new ExtendedIllegalArgumentException("length", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - // If length is zero then return zero. - if (length == 0) - { - return 0; - } - - // Ensure that the file is open. - open(); - - return impl_.read(data, dataOffset, length, false); - } - - - - /** - Reads a boolean from this file. This method reads a single byte from the - file. A value of 0 represents false. Any other value represents true. - @return The boolean value read. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final boolean readBoolean() - throws IOException - { - return (readByte() == 0 ? false : true); - } - - - /** - Reads a signed 8-bit value from this file. This method reads a single byte - from the file. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final byte readByte() - throws IOException - { - int bytesRead = read(bytes1, 0, 1); - if (bytesRead != 1) - { - throw new EOFException(); - } - - return bytes1[0]; - } - - - /** - Reads a Unicode character from this file. Two bytes are read from the file. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final char readChar() - throws IOException - { - return (char) readShort(); - } - - - /** - Reads a double from this file. This method reads a long value as if by the - readLong method and then converts that long to a double using the - longBitsToDouble method in class Double. - @return The next eight bytes of this file, interpreted as a double. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final double readDouble() - throws IOException - { - long value = readLong(); - - return Double.longBitsToDouble(value); - } - - - /** - Reads a float from this file. This method reads an int value as if by the - readInt method and then converts that int to a float using the intBitsToFloat - method in class Float. - @return The next four bytes of this file, interpreted as a float. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final float readFloat() - throws IOException - { - int value = readInt(); - - return Float.intBitsToFloat(value); - } - - - /** - Reads data.length bytes from this file into the byte array. This - method reads repeatedly from the file until all the bytes are read or an - exception is thrown. - @param data The buffer into which data is read. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final void readFully(byte[] data) - throws IOException - { - // Validate arguments. - if (data == null) - throw new NullPointerException("data"); - - readFully(data, 0, data.length); - } - - - /** - Reads exactly length bytes from this file into the byte array. This - method reads repeatedly from the file until all the bytes are read or - an exception is thrown. - @param data The buffer into which data is read. - @param dataOffset The start offset in the data buffer. - @param length The number of bytes to read. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final void readFully(byte[] data, - int dataOffset, - int length) - throws IOException - { - // Validate arguments. - if (data == null) - throw new NullPointerException("data"); - if (dataOffset < 0) - { - throw new ExtendedIllegalArgumentException("dataOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (length < 0) - { - throw new ExtendedIllegalArgumentException("length", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Ensure that the file is open. - open(); - - impl_.read(data, dataOffset, length, true); - } - - - /** - Reads a signed 32-bit integer from this file. - - @return The next four bytes of this file, interpreted as an integer. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final int readInt() - throws IOException - { - int bytesRead = read(bytes4, 0, 4); - if (bytesRead != 4) - { - throw new EOFException(); - } - - return (((bytes4[0] & 0xff) << 24) | ((bytes4[1] & 0xff) << 16) | - ((bytes4[2] & 0xff) << 8) | (bytes4[3] & 0xff)); - } - - /** - Reads the next line of text from this file. This method successively reads - bytes from the file until it reaches the end of a line of text. A line of - text is terminated by a carriage return character (\r), a newline character - (\n), a carriage return character immediately followed by a newline - character, or the end of the input stream. The line-terminating characters, - if any, are included as part of the string returned. - - @return The next line of text from this file. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final String readLine() - throws IOException - { - // Ensure that the file is open. - open(); - - return impl_.readLine(); - } - - - /** - Reads a signed 64-bit integer from this file. - - @return The next eight bytes of the file, interpreted as a long. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final long readLong() - throws IOException - { - int bytesRead = read(bytes8, 0, 8); - if (bytesRead != 8) - { - throw new EOFException(); - } - - return (((bytes8[0] & 0xffL) << 56L) | ((bytes8[1] & 0xffL) << 48L) | - ((bytes8[2] & 0xffL) << 40L) | ((bytes8[3] & 0xffL) << 32L) | - ((bytes8[4] & 0xffL) << 24L) | ((bytes8[5] & 0xffL) << 16L) | - ((bytes8[6] & 0xffL) << 8L) | (bytes8[7] & 0xffL)); - } - - /** - Restores the state of this object from an object input stream. - @param ois The stream of state information. - @exception IOException - @exception ClassNotFoundException - **/ - private void readObject(java.io.ObjectInputStream ois) - throws IOException, ClassNotFoundException - { - // Restore the non-static and non-transient fields. - ois.defaultReadObject(); - - // Initialize the transient fields. - initializeTransient(); - } - - /** - Reads a signed 16-bit integer from this file. - - @return The next two bytes of this file, interpreted as a short. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final short readShort() - throws IOException - { - int bytesRead = read(bytes2, 0, 2); - if (bytesRead != 2) - { - throw new EOFException(); - } - - return (short) (((bytes2[0] & 0xff) << 8) | (bytes2[1] & 0xff)); - } - - - /** - Reads an unsigned 8-bit number from this file. This method reads a byte from - this file and returns that byte. - @return The next byte of this file, interpreted as an unsigned 8-bit number. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final int readUnsignedByte() - throws IOException - { - int bytesRead = read(bytes1, 0, 1); - if (bytesRead != 1) - { - throw new EOFException(); - } - - int i = (int) bytes1[0]; - i = i & 0xff; - - return i; - } - - - /** - Reads an unsigned 16-bit number from this file. - @return The next two bytes of this file, interpreted as an unsigned 16-bit - number. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final int readUnsignedShort() - throws IOException - { - int bytesRead = read(bytes2, 0, 2); - if (bytesRead != 2) - { - throw new EOFException(); - } - - int i = ((bytes2[0] & 0xff) << 8) | (bytes2[1] & 0xff); - if (i < 0) - { - i += 65536; - } - - return i; - } - - - /** - Reads in a string from this file. The string has been encoded using a - modified UTF-8 format.
    The first two bytes are read as if by - readUnsignedShort. This values gives the number of following bytes - that are in the encoded string (note, not the length of the - resulting string). The following bytes are then interpreted as bytes - encoding characters in the UTF-8 format and are converted into characters. - @return A Unicode string. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final String readUTF() - throws IOException - { - // Ensure that the file is open. - open(); - - return impl_.readUTF(); - } - - - /** - Removes a file listener so that it no longer receives file events from - this IFSRandomAccessFile. - @param listener The file listener. - **/ - public void removeFileListener(FileListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - synchronized(fileListeners_) - { - fileListeners_.removeElement(listener); - } - } - - /** - Removes a property change listener. - @param listener The property change listener to remove. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - changes_.removePropertyChangeListener(listener); - } - - /** - Removes a vetoable change listener. - @param listener The vetoable change listener to remove. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - vetos_.removeVetoableChangeListener(listener); - } - - /** - Sets the offset, from the beginning of this file, at which the next read - or write occurs. - @param position The absolute position of the file pointer. - - @exception IOException If an error occurs while communicating with the system. - **/ - public void seek(long position) - throws IOException - { - // Validate the argument. - if (position < 0L) - { - throw new ExtendedIllegalArgumentException("position (" + - Long.toString(position) + - ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Ensure that the file is open. - open(); - - fd_.setFileOffset(position); // @A1C - Remove (int) cast to pass long parameter - } - - - /** - Sets the existence option. - @param existenceOption Indicates if the file should be created, opened or if the request should fail based on the existence of the file.
    • FAIL_OR_CREATE Fail if exists; create if not
    • OPEN_OR_CREATE Open if exists; create if not
    • OPEN_OR_FAIL Open if exists; fail if not
    • REPLACE_OR_CREATE Replace if exists; create if not
    • REPLACE_OR_FAIL Replace if exists; fail if not
    - @exception PropertyVetoException If the change is vetoed. - **/ - public void setExistenceOption(int existenceOption) - throws PropertyVetoException - { - validateExistenceOption(existenceOption); - - // Ensure that existenceOption is not changed after a connection - // is established. - if (fd_.valid()) - { - throw new ExtendedIllegalStateException("existenceOption", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // Remember the current existenceOption. - Integer oldExistenceOption = new Integer(existenceOption_); - Integer newExistenceOption = new Integer(existenceOption); - - // Fire the vetoable change event. - vetos_.fireVetoableChange("existenceOption", oldExistenceOption, - newExistenceOption); - - existenceOption_ = existenceOption; - - // Fire the property change event. - changes_.firePropertyChange("existenceOption", oldExistenceOption, - newExistenceOption); - } - - /** - A package-level method that sets the forceToStorage option. When forceToStorage - is turned on, data must be written before the system replies. Otherwise, the - system may asynchronously write the data. - - @param forceToStorage If data must be written before the system replies - **/ - // Note: This method is needed by UserSpaceImplRemote. - void setForceToStorage(boolean forceToStorage) - { - forceToStorage_ = forceToStorage; - if (impl_ != null) - impl_.setForceToStorage(forceToStorage); - } - - // @A2a - /** - Sets the length of the file represented by this object. The file can be made larger or smaller. If the file is made larger, the contents of the new bytes of the file are undetermined. - @param length The new length, in bytes. - - @exception IOException If an error occurs while communicating with the system. - @deprecated Replaced by {@link #setLength(long) setLength(long)} - **/ - public void setLength(int length) - throws IOException - { - setLength((long)length); - } - - - /** - Sets the length of the file represented by this object. The file can be made larger or smaller. If the file is made larger, the contents of the new bytes of the file are undetermined. - @param length The new length, in bytes. - - @exception IOException If an error occurs while communicating with the system. - **/ - public void setLength(long length) - throws IOException - { - // Validate arguments. - if (length < 0L) - { - throw new ExtendedIllegalArgumentException("length + (" + - Long.toString(length) + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (impl_ == null) chooseImpl(); - - impl_.setLength(length); - - // Fire the events. - if (fileListeners_.size() != 0) { - IFSFileDescriptor.fireModifiedEvents(this, fileListeners_); - } - } - - - /** - Sets the access mode. - @param mode The access mode.
    • "r" read only
    • "w" write only
    • "rw" read/write
    . - @exception PropertyVetoException If the change is vetoed. - **/ - public void setMode(String mode) - throws PropertyVetoException - { - validateMode(mode); - - // Ensure that mode is not changed after the connection is - // established. - if (fd_.valid()) - { - throw new ExtendedIllegalStateException("mode", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // Remember the current mode value. - String oldMode = mode_; - - // Fire the property veto event. - vetos_.fireVetoableChange("mode", oldMode, mode); - - mode_ = mode; - - // Fire the property change event. - changes_.firePropertyChange("mode", oldMode, mode); - } - - - /** - Sets the file path. - Sets the integrated file system path name. - @param path The absolute integrated file system path name. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setPath(String path) - throws PropertyVetoException - { - if (path == null) - { - throw new NullPointerException("path"); - } - - // Ensure that the path is not altered after a connection is - // established. - if (fd_.valid()) - { - throw new ExtendedIllegalStateException("path", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // Remember the current path value. - String oldPath = fd_.getPath(); - - String newPath; - if (path.length() == 0 || path.charAt(0) != IFSFile.separatorChar) - { - newPath = IFSFile.separator + path; - } - else - { - newPath = path; - } - - // Fire a vetoable change event for the path. - vetos_.fireVetoableChange("path", oldPath, newPath); - - // Update the path value. - fd_.setPath(newPath); - - // Fire the property change event. - changes_.firePropertyChange("path", oldPath, newPath); - } - - - /** - Sets the share option. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    . - @exception PropertyVetoException If the change is vetoed. - **/ - public void setShareOption(int shareOption) - throws PropertyVetoException - { - validateShareOption(shareOption); - - // Ensure that shareOption is not altered after a connection - // is established. - if (fd_.valid()) - { - throw new ExtendedIllegalStateException("shareOption", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - Integer oldShareOption = new Integer(fd_.getShareOption()); - Integer newShareOption = new Integer(shareOption); - - // Fire a vetoable change event for shareOption. - vetos_.fireVetoableChange("shareOption", oldShareOption, - newShareOption); - - fd_.setShareOption(shareOption); - - // Fire the property change event. - changes_.firePropertyChange("shareOption", oldShareOption, - newShareOption); - } - - - /** - Sets the system. - The system cannot be changed once a connection is made to the system. - @param system The system object. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem(AS400 system) - throws PropertyVetoException - { - if (system == null) - { - throw new NullPointerException("system"); - } - - // Ensure that system is not altered after the connection is - // established. - if (fd_.valid()) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - // Remember the old system value. - AS400 oldSystem = fd_.getSystem(); - - // Fire a vetoable change event for system. - vetos_.fireVetoableChange("system", oldSystem, system); - - fd_.setSystem(system); - - // Fire the property change event. - changes_.firePropertyChange("system", oldSystem, system); - } - - - /** - Skips over the next bytesToSkip bytes in the stream. - @param bytesToSkip The number of bytes to skip. - @return The number of bytes skipped. - - @exception IOException If an error occurs while communicating with the system. - @deprecated Replaced by {@link #skipBytes(long) skipBytes(long)} - **/ - public int skipBytes(int bytesToSkip) - throws IOException - { - long bytesSkipped = skipBytes((long)bytesToSkip); - - if (bytesSkipped > bytesToSkip) { // will never happen - Trace.log(Trace.ERROR, "Returned bytesSkipped value ("+bytesSkipped+") exceeds requested number of bytes to skip ("+bytesToSkip+")."); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - - return (int)bytesSkipped; - } - - - /** - Skips over the next bytesToSkip bytes in the stream. - @param bytesToSkip The number of bytes to skip. - @return The number of bytes skipped. - - @exception IOException If an error occurs while communicating with the system. - **/ - public long skipBytes(long bytesToSkip) - throws IOException - { - // Validate the agument. - if (bytesToSkip < 0L) - { - throw new ExtendedIllegalArgumentException("bytesToSkip (" + - Long.toString(bytesToSkip) + - ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Ensure that the file is open. - open(); - - fd_.incrementFileOffset(bytesToSkip); - - return bytesToSkip; - } - - - /** - Undoes a lock on this file. - Note: This method is not supported for files under QSYS. - @param key The key for the lock. - - @exception IOException If an error occurs while communicating with the system. - - @see IFSKey - @see #lock - **/ - public void unlock(IFSKey key) - throws IOException - { - // Validate the argument. - if (key == null) - throw new NullPointerException("key"); - - // Ensure that the file is open. - open(); - - impl_.unlock(key); - } - - private static final void validateExistenceOption(int existenceOption) - { - if ((existenceOption < OPEN_OR_CREATE) || (existenceOption > REPLACE_OR_FAIL)) - { - throw new ExtendedIllegalArgumentException("existenceOption (" + - Integer.toString(existenceOption) + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - private static final void validateMode(String mode) - { - if (mode == null) - { - throw new NullPointerException("mode"); - } - if (!(mode.equals("r") || mode.equals("w") || mode.equals("rw"))) - { - throw new ExtendedIllegalArgumentException("mode (" + mode + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - private static final void validateShareOption(int shareOption) - { - if ((shareOption < SHARE_NONE) || (shareOption > SHARE_ALL)) - { - throw new ExtendedIllegalArgumentException("shareOption (" + - Integer.toString(shareOption) + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - - /** - Writes the specified byte to this file. - @param b The byte to write. - - @exception IOException If an error occurs while communicating with the system. - **/ - public void write(int b) - throws IOException - { - bytes1[0] = (byte) b; - writeBytes(bytes1, 0, 1/*, true*/); - } - - - /** - Writes data.length bytes of data from the byte array data - to this file output stream. - @param data The data to write. - - @exception IOException If an error occurs while communicating with the system. - **/ - public void write(byte[] data) - throws IOException - { - // Validate arguments. - if (data == null) - throw new NullPointerException("data"); - - writeBytes(data, 0, data.length/*, true*/); - } - - - /** - Writes length bytes from the byte array data, starting at dataOffset, to this file. - @param data The data. - @param dataOffset The start offset in the data. - @param length The number of bytes to write. - - @exception IOException If an error occurs while communicating with the system. - **/ - public void write(byte[] data, - int dataOffset, - int length) - throws IOException - { - // Validate arguments. - if (data == null) - throw new NullPointerException("data"); - if (dataOffset < 0) - { - throw new ExtendedIllegalArgumentException("dataOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (length < 0) - { - throw new ExtendedIllegalArgumentException("length", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - writeBytes(data, dataOffset, length/*, true*/); - } - - - /** - Writes a boolean to the file as a one-byte value. The value true is written - out as the value (byte)1. The value false is written out as the value - (byte)0. - @param value The value to be written. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final void writeBoolean(boolean value) - throws IOException - { - write(value ? (byte) 1 : (byte) 0); - } - - - /** - Writes a byte to the file as a one-byte value. - @param value The value to be written as a byte. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final void writeByte(int value) - throws IOException - { - bytes1[0] = (byte) value; - writeBytes(bytes1, 0, 1/*, true*/); - } - - - /** - Writes length bytes from the byte array data, starting at dataOffset, to this File. - @param data The data. - @param dataOffset The start offset in the data. - @param length The number of bytes to write. - - @exception IOException If an error occurs while communicating with the system. - **/ - private void writeBytes(byte[] data, - int dataOffset, - int length) - throws IOException - { - // Validate arguments. - if (data == null) - throw new NullPointerException("data"); - if (dataOffset < 0) - { - throw new ExtendedIllegalArgumentException("dataOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (length < 0) - { - throw new ExtendedIllegalArgumentException("length", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Ensure that the file is open. - open(); - - impl_.writeBytes(data, dataOffset, length); - - // Fire the events. - if (fileListeners_.size() != 0) - IFSFileDescriptor.fireModifiedEvents(this, fileListeners_); - } - - - /** - Writes out the string to the file as a sequence of bytes. Each character - in the string is written out, in sequence, by discarding its high eight - bits. Because this method discards eight bits of data, it should not be - used to write double-byte characters. Use writeChars(String) instead. - @param s The bytes to write. - - @exception IOException If an error occurs while communicating with the system. - - @see #writeChars(String) - **/ - public final void writeBytes(String s) - throws IOException - { - // Validate the argument. - if (s == null) - throw new NullPointerException("s"); - - // Convert the String to bytes. - byte[] data = new byte[s.length()]; - for (int i = 0; i < s.length(); i++) - { - char c = s.charAt(i); - data[i] = (byte) (c & 0xff); - } - - // Write the bytes. - writeBytes(data, 0, data.length); - } - - /** - Writes a char to the file as a two-byte value, high byte first. - @param value A character value to write. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final void writeChar(int value) - throws IOException - { - // Convert value to two bytes. - char c = (char) value; - bytes2[0] = (byte) (c >>> 8); - bytes2[1] = (byte) (c & 0xff); - - // Write the bytes. - writeBytes(bytes2, 0, 2/*, true*/); - } - - - /** - Writes a string to the file as a sequence of characters. Each character is - written to the file as if by the writeChar method. - @param s A String to write. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final void writeChars(String s) - throws IOException - { - // Validate the argument. - if (s == null) - throw new NullPointerException("s"); - - // Convert the string to bytes. - byte[] data = new byte[s.length() * 2]; - for (int i = 0, j = 0; i < s.length(); i++, j += 2) - { - char character = s.charAt(i); - data[j + 1] = (byte) (character & 0xff); - data[j] = (byte) (character >>> 8); - } - - // Write the bytes. - writeBytes(data, 0, data.length/*, true*/); - } - - - /** - Converts the double argument to a long using the doubleToLongBits method in - class Double, and then writes that long value to the file as an eight-byte - quantity, high-byte first. - - @param value The value to write. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final void writeDouble(double value) - throws IOException - { - writeLong(Double.doubleToLongBits(value)); - } - - - /** - Converts the float argument to an int using the floatToIntBits method in - class Float, and then writes that int value to the file as a four-byte - quantity, high-byte first. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final void writeFloat(float value) - throws IOException - { - writeInt(Float.floatToIntBits(value)); - } - - - /** - Writes an int to the file as four bytes, high-byte first. - - @param value The int to write. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final void writeInt(int value) - throws IOException - { - // Convert the int to bytes. - int v = value; - for (int i = 0; i < 4; i++, v >>>= 8) - { - bytes4[3 - i] = (byte) v; - } - - // Write the bytes. - writeBytes(bytes4, 0, 4/*, true*/); - } - - - /** - Writes a long to the file as eight bytes, high-byte first. - - @param value The value to write. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final void writeLong(long value) - throws IOException - { - // Convert the long to bytes. - long v = value; - for (int i = 0; i < 8; i++, v >>>= 8) - { - bytes8[7 - i] = (byte) v; - } - - // Write the bytes. - writeBytes(bytes8, 0, 8/*, true*/); - } - - - /** - Writes a short to the file as two bytes, high-byte first. - - @param value The value to write. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final void writeShort(int value) - throws IOException - { - // Convert the int to two bytes. - bytes2[1] = (byte) value; - bytes2[0] = (byte) (value >>> 8); - - // Write the bytes. - writeBytes(bytes2, 0, 2/*, true*/); - } - - - /** - Writes out a string to the file using UTF-8 encoding in a - machine-independent manner.
    First, two bytes are written to the file as - if by the writeShort method giving the number of bytes to follow. This - value is the number of bytes actually written out, not the length of the - string. Following the length, each character of the string is output, in - sequence, using the UTF-8 encoding for each character. - - @param s The string to write. - - @exception IOException If an error occurs while communicating with the system. - **/ - public final void writeUTF(String s) - throws IOException - { - // Validate the argument. - if (s == null) - throw new NullPointerException("s"); - - // Ensure that the file is open. - open(); - - impl_.writeUTF(s); - - if (fileListeners_.size() != 0) - IFSFileDescriptor.fireModifiedEvents(this, fileListeners_); - } - -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFile16.gif b/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFile16.gif deleted file mode 100644 index e32336281..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFile16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFile32.gif b/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFile32.gif deleted file mode 100644 index 3dec59b7a..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFile32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFileBeanInfo.java b/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFileBeanInfo.java deleted file mode 100644 index fdc061466..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFileBeanInfo.java +++ /dev/null @@ -1,196 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSRandomAccessFileBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.VetoableChangeListener; - -/** - The IFSRandomAccessFileBeanInfo class provides bean information for - the IFSRandonAccessFile class. -**/ - -public class IFSRandomAccessFileBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private final static Class beanClass = IFSRandomAccessFile.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - private static ResourceBundleLoader rbl_; - - static - { - try - { - // Define the property descriptors. - PropertyDescriptor property1 = - new PropertyDescriptor("existenceOption", beanClass, - "getExistenceOption", "setExistenceOption"); - property1.setBound(true); - property1.setConstrained(true); - property1.setDisplayName(rbl_.getText("PROP_NAME_EXISTENCE_OPTION")); - property1.setPropertyEditorClass(IFSExistenceOptionEditor.class); - property1.setShortDescription(rbl_.getText("PROP_DESC_EXISTENCE_OPTION")); - PropertyDescriptor property2 = - new PropertyDescriptor("mode", beanClass, null, "setMode"); - property2.setBound(true); - property2.setConstrained(true); - property2.setDisplayName(rbl_.getText("PROP_NAME_MODE")); - property2.setShortDescription(rbl_.getText("PROP_DESC_MODE")); - PropertyDescriptor property3 = - new PropertyDescriptor("path", beanClass, "getPath", "setPath"); - property3.setBound(true); - property3.setConstrained(true); - property3.setDisplayName(rbl_.getText("PROP_NAME_PATH")); - property3.setShortDescription(rbl_.getText("PROP_DESC_PATH")); - PropertyDescriptor property4 = - new PropertyDescriptor("shareOption", beanClass, "getShareOption", - "setShareOption"); - property4.setBound(true); - property4.setConstrained(true); - property4.setDisplayName(rbl_.getText("PROP_NAME_SHARE_OPTION")); - property4.setPropertyEditorClass(IFSShareOptionEditor.class); - property4.setShortDescription(rbl_.getText("PROP_DESC_SHARE_OPTION")); - PropertyDescriptor property5 = - new PropertyDescriptor("system", beanClass, "getSystem", "setSystem"); - property5.setBound(true); - property5.setConstrained(true); - property5.setDisplayName(rbl_.getText("PROP_NAME_SYSTEM")); - property5.setShortDescription(rbl_.getText("PROP_DESC_SYSTEM")); - - // The introspecition process will reveal features that aren't - // really properties. We must declare them and mark as hidden. - PropertyDescriptor property6 = - new PropertyDescriptor("filePointer", beanClass, "getFilePointer", - null); - property6.setHidden(true); - - PropertyDescriptor[] properties = - { - property1, property2, property3, property4, property5, property6 - }; - properties_ = properties; - - // Define the event descriptors. - EventSetDescriptor event1 = - new EventSetDescriptor(beanClass, "propertyChange", - PropertyChangeListener.class, - "propertyChange"); - event1.setDisplayName(rbl_.getText("EVT_NAME_PROPERTY_CHANGE")); - event1.setShortDescription(rbl_.getText("EVT_DESC_PROPERTY_CHANGE")); - String[] listenerMethods = { "fileClosed", "fileModified", - "fileOpened" }; - EventSetDescriptor event2 = - new EventSetDescriptor(beanClass, "file", FileListener.class, - listenerMethods, "addFileListener", - "removeFileListener"); - event2.setDisplayName(rbl_.getText("EVT_NAME_FILE_EVENT")); - event2.setShortDescription(rbl_.getText("EVT_DESC_FILE_EVENT")); - EventSetDescriptor event3 = - new EventSetDescriptor(beanClass, "propertyChange", - VetoableChangeListener.class, - "vetoableChange"); - event3.setDisplayName(rbl_.getText("EVT_NAME_PROPERTY_VETO")); - event3.setShortDescription(rbl_.getText("EVT_DESC_PROPERTY_VETO")); - EventSetDescriptor[] events = { event1, event2, event3 }; - events_ = events; - } - catch(Exception e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - /** - Returns the default event index. - @return The default event index (always 1). - **/ - public int getDefaultEventIndex() - { - return 1; - } - - /** - Returns the default property index. - @return The default property index (always 1). - **/ - public int getDefaultPropertyIndex() - { - return 1; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("IFSRandomAccessFile16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("IFSRandomAccessFile32.gif"); - break; - } - - return image; - } - -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFileImpl.java b/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFileImpl.java deleted file mode 100644 index d71c8bd12..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFileImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSRandomAccessFileImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - Specifies the methods which the implementation objects for the IFSRandomAccessFile class - need to support. - **/ -interface IFSRandomAccessFileImpl -{ - void close() throws IOException; - void connectAndOpen() throws AS400SecurityException, IOException; - void flush() throws IOException; - long length() throws IOException; - IFSKey lock(long offset, - long length) throws IOException; - void open() throws IOException; - int read(byte[] data, - int dataOffset, - int length, - boolean readFully) throws IOException; - String readLine() throws IOException; - String readUTF() throws IOException; - void setExistenceOption(int existenceOption); - - // Note: This must be the first method called on a new object: - void setFD(IFSFileDescriptorImpl fd); - - void setForceToStorage(boolean forceToStorage); - void setLength(long length) throws IOException; - void setMode(String mode); - void unlock(IFSKey key) throws IOException; - void writeBytes(byte[] data, - int dataOffset, - int length) throws IOException; - void writeUTF(String s) throws IOException; -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFileImplProxy.java b/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFileImplProxy.java deleted file mode 100644 index ee63e5eca..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSRandomAccessFileImplProxy.java +++ /dev/null @@ -1,278 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSRandomAccessFileImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - -/** - Provides a local proxy implementation for the IFSRandomAccessFile class. - **/ -class IFSRandomAccessFileImplProxy -extends AbstractProxyImpl -implements IFSRandomAccessFileImpl -{ - IFSRandomAccessFileImplProxy () - { - super ("IFSRandomAccessFile"); - } - - public void close() - throws IOException - { - try { - connection_.callMethod (pxId_, "close"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - public void connectAndOpen() - throws AS400SecurityException, IOException - { - try { - connection_.callMethod (pxId_, "connectAndOpen"); - } - catch (InvocationTargetException e) { - Throwable e1 = e.getTargetException (); - if (e1 instanceof AS400SecurityException) - throw (AS400SecurityException) e1; - else - throw ProxyClientConnection.rethrow1 (e); - } - } - - public void flush() - throws IOException - { - try { - connection_.callMethod (pxId_, "flush"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - public long length() - throws IOException - { - try { - return connection_.callMethod (pxId_, "length").getReturnValueLong(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - public IFSKey lock(long offset, - long length) - throws IOException - { - try { - return (IFSKey) connection_.callMethod (pxId_, "lock", - new Class[] { Long.TYPE, Long.TYPE }, - new Object[] { new Long(offset), new Long(length) }) - .getReturnValue(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - - public void open() - throws IOException - { - try { - connection_.callMethod (pxId_, "open"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - private static final boolean[] ARGS_TO_RETURN = - new boolean[] {true, false, false, false}; - - public int read(byte[] data, - int dataOffset, - int length, - boolean readFully) - throws IOException - { - try { - ProxyReturnValue rv = connection_.callMethod (pxId_, "read", - new Class[] { byte[].class, - Integer.TYPE, - Integer.TYPE, - Boolean.TYPE}, - new Object[] { data, - new Integer (dataOffset), - new Integer (length), - new Boolean (readFully) }, - ARGS_TO_RETURN, readFully ); - // Note: The 6th arg says whether to call the method asynchronously. - // In the case of readFully, we want asynchronous, since the read - // will wait for the requested number of bytes to become available. - - byte [] returnDataBuffer = (byte[])rv.getArgument(0); - for (int i=0; ilength bytes of data from this input stream into - data, starting at the array offset dataOffset. - @param data The buffer into which the data is read. - @param offset The start offset of the data in the buffer. - @param length The maximum number of bytes to read. - @return The total number of bytes read into the buffer, or -1 if there is no more data because the end of file has been reached. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the server. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the server cannot be started. - @exception UnknownHostException If the server cannot be located. - - **/ - private int read(byte[] data, - int dataOffset, - int length) - throws IOException, AS400SecurityException - { - // Assume the arguments have been validated by the public class. - - // Ensure that the file is open. - open(); - - int bytesRead = fd_.read(data, dataOffset, length); // @B2C - return bytesRead; - } - - - /** - Reads up to length bytes of data from this input stream into - data, starting at the array offset dataOffset. -
    If readFully is true: Reads exactly length bytes from this - file into the byte array; this method reads repeatedly from the file - until all the bytes are read or an exception is thrown. - @param data The buffer into which the data is read. - @param offset The start offset of the data in the buffer. - @param length The maximum number of bytes to read. - @param readFully Whether or not to read fully. - @return The total number of bytes read into the buffer, or -1 if there is no more data because the end of file has been reached. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the server. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the server cannot be started. - @exception UnknownHostException If the server cannot be located. - - **/ - public int read(byte[] data, - int dataOffset, - int length, - boolean readFully) - throws IOException - { - // Assume the arguments have been validated by the public class. - try - { - if (!readFully) - return read(data, dataOffset, length); - else - { // Read fully. - int totalBytesRead = 0; - while (totalBytesRead < length) - { - // Try to read all data requested. - int bytesRead = read(data, dataOffset + totalBytesRead, - length - totalBytesRead); - if (bytesRead > 0) - { - totalBytesRead += bytesRead; - } - - // Verify that all requested data was read. - if (totalBytesRead != data.length) - { - try - { - // Pause for 64 milliseconds before trying again. - Thread.sleep(64); - } - catch(Exception e) - {} - } - } - return totalBytesRead; - } - } - catch (AS400SecurityException e) { - throw new IOException(e.getMessage()); - } - } - - /** - Reads the cached data. - @return The next byte of cached data. - **/ - private int readFromCache() - throws IOException - { - int value = -1; - - // If the cache is empty, refill it. - int bytesInCache = readCacheLength_ - readCacheIndex_; - if (bytesInCache == 0) - { - // Refill the cache - try { - readCacheLength_ = read(readCache_, 0, readCache_.length); - } - catch (AS400SecurityException e) { - throw new IOException(e.getMessage()); - } - if (readCacheLength_ == -1) - { - // End of file. - return -1; - } - readCacheIndex_ = 0; - } - - return (int) readCache_[readCacheIndex_++]; - } - - /** - Reads the next line of text from this file. This method successively reads - bytes from the file until it reaches the end of a line of text. A line of - text is terminated by a carriage return character (\r), a newline character - (\n), a carriage return character immediately followed by a newline - character, or the end of the input stream. The line-terminating characters, - if any, are included as part of the string returned. - - @return The next line of text from this file. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the server. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the server cannot be started. - @exception UnknownHostException If the server cannot be located. - - **/ - public final synchronized String readLine() - throws IOException - { - StringBuffer line = new StringBuffer(); - - // Initialize the cache. - readCacheLength_ = 0; - readCacheIndex_ = 0; - - // Read bytes until end of line is reached. - boolean done = false; - while(!done) - { - // Read the next byte from the file. - int nextByte = readFromCache(); - if (nextByte == -1) - { - break; - } - - // Append the next byte to the line. - line.append((char) nextByte); - - // Determine if the line is terminated. - if (nextByte == (int) '\n') - { - done = true; - } - else if (nextByte == (int) '\r') - { - // Check for a line feed following. - int i = readFromCache(); - if (i == (int) '\n') - { - // Include the line feed too. - line.append((char) i); - } - else - { - // No line feed so back up the cache by one. - readCacheIndex_--; - } - done = true; - } - } - - // 'Put back' any bytes that weren't used. - int bytesInCache = readCacheLength_ - readCacheIndex_; - if (bytesInCache > 0) - { - fd_.setFileOffset((int) getFilePointer() - bytesInCache); - } - - return (line.length() == 0 ? null : line.toString()); - } - - - /** - Reads in a string from this file. The string has been encoded using a - modified UTF-8 format.
    The first two bytes are read as if by - readUnsignedShort. This values gives the number of following bytes - that are in the encoded string (note, not the length of the - resulting string). The following bytes are then interpreted as bytes - encoding characters in the UTF-8 format and are converted into characters. - @return A Unicode string. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception EOFException If the end of file has been reached. - @exception ExtendedIOException If an error occurs while communicating with the server. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the server cannot be started. - @exception UnknownHostException If the server cannot be located. - @exception UTFDataFormatException If the bytes do not represent a valid UTF-8 encoding of a Unicode string. - **/ - public final String readUTF() - throws IOException - { - try - { - // Determine the length. - byte[] bytes2 = new byte[2]; - int bytesRead = read(bytes2, 0, 2); - if (bytesRead != 2) - { - throw new EOFException(); - } - - int length = ((bytes2[0] & 0xff) << 8) | (bytes2[1] & 0xff); - if (length < 0) - { - length += 65536; - } - - // Read the modified UTF-8 data. - byte[] data = new byte[length]; - if (read(data, 0, length) != length) - { - throw new EOFException(); - } - - // Convert the modified UTF-8 data to a String. UTF-8 format goes as follows: - // All characters in the range '\u0001' to '\u007f' are represented by a single byte: - // ________________ - // | 0 | bits 0-7 | - // - // The null character '\u0000' and characters in the range '\u0080' to - // '\u07FF' are represented by a pair of bytes: - // ____________________________________________ - // | 1 | 1 | 0 | bits 6-10 | 1 | 0 | bits 0-5 | - // - // Characters in the range '\u0800' to '\uFFFF' are represented by three bytes: - // _____________________________________________________________________ - // | 1 | 1 | 1 | 0 | bits 12-15 | 1 | 0 | bits 6-11 | 1 | 0 | bits 0-5 | - // - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < length;) - { - // Determine if the next character is in 1, 2, or 3 byte format. - if ((data[i] & 0x80) == 0) - { - // One byte format. - sb.append((char) data[i]); - i++; - } - else if ((data[i] & 0xe0) == 0xc0) - { - // Two byte format. Ensure that we have one more byte. - if (i + 1 < length) - { - char c = (char) (((data[i] & 0x1f) << 6) | (data[i + 1] & 0x3f)); - sb.append(c); - i += 2; - } - else - { - throw new UTFDataFormatException(); - } - } - else if ((data[i] & 0xe0) == 0xe0) - { - // Three byte format. Ensure that we have two more bytes. - if (i + 2 < length) - { - char c = (char) (((data[i] & 0xf) << 12) | - ((data[i + 1] & 0x3f) << 6) | (data[i + 2] & 0x3f)); - sb.append(c); - i += 3; - } - else - { - throw new UTFDataFormatException(); - } - } - else - { - throw new UTFDataFormatException(); - } - } - - return sb.toString(); - } - catch (AS400SecurityException e) { - throw new IOException(e.getMessage()); - } - } - - /** - Sets the offset, from the beginning of this file, at which the next read - or write occurs. - @param position The absolute position of the file pointer. - - @exception IOException If an error occurs while communicating with the server. - **/ - // Note: This method is provided for use by UserSpaceImplRemote. - public void seek(long position) - throws IOException - { - // Assume the argument has been validated. - - // Ensure that the file is open. - open(); - - fd_.setFileOffset((int) position); - } - - - /** - Sets the existence option. - @param existenceOption Indicates if the file should be created, opened or if the request should fail based on the existence of the file.
    • FAIL_OR_CREATE Fail if exists; create if not
    • OPEN_OR_CREATE Open if exists; create if not
    • OPEN_OR_FAIL Open if exists; fail if not
    • REPLACE_OR_CREATE Replace if exists; create if not
    • REPLACE_OR_FAIL Replace if exists; fail if not
    - **/ - public void setExistenceOption(int existenceOption) - { - // Assume the argument has been validated by the public class. - - // Ensure that existenceOption is not changed after a connection - // is established. - if (fd_.isOpen_) - { - throw new ExtendedIllegalStateException("existenceOption", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - existenceOption_ = existenceOption; - } - - - public void setFD(IFSFileDescriptorImpl fd) - { - // Assume the argument has been validated by the public class. - - fd_ = IFSFileDescriptorImplRemote.castImplToImplRemote(fd); // @B2C - } - - - /** - A package-level method that sets the forceToStorage option. When forceToStorage - is turned on, data must be written before the server replies. Otherwise, the - server may asynchronously write the data. - - @param forceToStorage If data must be written before the server replies - **/ - public void setForceToStorage(boolean forceToStorage) - { - forceToStorage_ = forceToStorage; - } - - // @A2a - /** - Sets the length of the file represented by this object. The file can be made larger or smaller. If the file is made larger, the contents of the new bytes of the file are undetermined. - @param length The new length, in bytes. - - @exception IOException If an error occurs while communicating with the server. - **/ - public void setLength(long length) - throws IOException - { - // Assume the argument has been validated by the public class. - - try { - fd_.setLength(length); - } - catch (AS400SecurityException e) { - throw new IOException(e.getMessage()); - } - } - - - /** - Sets the access mode. - @param mode The access mode.
    • "r" read only
    • "w" write only
    • "rw" read/write
    . - **/ - public void setMode(String mode) - { - // Assume the argument has been validated by the public class. - - // Ensure that mode is not changed after the connection is established. - if (fd_.isOpen_) - { - throw new ExtendedIllegalStateException("mode", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - mode_ = mode; - } - - - /** - Undoes a lock on this file. - @param key The key for the lock. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the server. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the server cannot be started. - @exception UnknownHostException If the server cannot be located. - - @see IFSKey - @see #lock - **/ - public void unlock(IFSKey key) - throws IOException - { - // Assume the argument has been validated by the public class. - - // Ensure that the file is open. - open(); - - try { - fd_.unlock(key); // @B2C - } - catch (AS400SecurityException e) { - throw new IOException(e.getMessage()); - } - } - - - /** - Writes length bytes from the byte array data, starting at dataOffset, to this File. - @param data The data. - @param dataOffset The start offset in the data. - @param length The number of bytes to write. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the server. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the server cannot be started. - @exception UnknownHostException If the server cannot be located. - - **/ - public void writeBytes(byte[] data, - int dataOffset, - int length) - throws IOException - { - // Assume the arguments have been validated by the public class. - - // Ensure that the file is open. - open(); - - try { - fd_.writeBytes(data, dataOffset, length, forceToStorage_); // @B2C - } - catch (AS400SecurityException e) { - throw new IOException(e.getMessage()); - } - } - - - /** - Writes out a string to the file using UTF-8 encoding in a - machine-independent manner.
    First, two bytes are written to the file as - if by the writeShort method giving the number of bytes to follow. This - value is the number of bytes actually written out, not the length of the - string. Following the length, each character of the string is output, in - sequence, using the UTF-8 encoding for each character. - - @param s The string to write. - - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ExtendedIOException If an error occurs while communicating with the server. - @exception InterruptedIOException If this thread is interrupted. - @exception ServerStartupException If the server cannot be started. - @exception UnknownHostException If the server cannot be located. - - **/ - public final void writeUTF(String s) - throws IOException - { - // Assume the argument has been validated by the public class. - - // Convert the character of the String to modified UTF-8 data. - byte[] data = new byte[s.length() * 3]; - int j = 0; - for (int i = 0; i < s.length(); i++) - { - char c = s.charAt(i); - if (c == '\u0000') - { - data[j] = (byte) 0xc0; - data[j + 1] =(byte) 0x80; - j += 2; - } - else if ((c >= '\u0001') && (c <= '\u007f')) - { - data[j] = (byte) c; - j++; - } - else if ((c >= '\u0080') && (c <= '\u07ff')) - { - data[j] = (byte) (0xc0 | ((c & 0x7c0) >>> 6)); - data[j + 1] = (byte) (0x80 | (c & 0x3f)); - j += 2; - } - else - { - data[j] = (byte) (0xe0 | ((c & 0xf000) >>> 4)); - data[j + 1] = (byte) (0x80 | ((c & 0xfc0) >>> 6)); - data[j + 2] = (byte) (0x80 | (c & 0x3f)); - j += 3; - } - } - - // Write the length. - byte[] bytes2 = new byte[2]; - bytes2[1] = (byte) j; - bytes2[0] = (byte) (j >>> 8); - writeBytes(bytes2, 0, 2); - - // Write the bytes. - writeBytes(data, 0, j); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSReadRep.java b/cvsroot/src/com/ibm/as400/access/IFSReadRep.java deleted file mode 100644 index 0e3a826fe..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSReadRep.java +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSReadRep.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** -Read data reply. -**/ -class IFSReadRep extends IFSDataStream -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final int CCSID_OFFSET = 22; - private static final int FILE_DATA_LL_OFFSET = 24; - private static final int FILE_DATA_OFFSET = 30; - -/** -Construct a read reply. -**/ - IFSReadRep() - { - } - -/** -Generate a new instance of this type. -@return a reference to the new instance -**/ - public Object getNewDataStream() - { - return new IFSReadRep(); - } - -/** -Get the data. -@return the bytes read -**/ - public byte[] getData() - { - int bytesRead = get32bit( FILE_DATA_LL_OFFSET) - 6; - byte[] dataRead = new byte[bytesRead]; - for (int i = 0; i < bytesRead; i++) - { - dataRead[i] = data_[FILE_DATA_OFFSET + i]; - } - - return dataRead; - } - -/** -Generates a hash code for this data stream. -@return the hash code -**/ - public int hashCode() - { - return 0x8003; - } - -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSReadReq.java b/cvsroot/src/com/ibm/as400/access/IFSReadReq.java deleted file mode 100644 index ca1bea5a3..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSReadReq.java +++ /dev/null @@ -1,86 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSReadReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** -Read data request. -**/ -class IFSReadReq extends IFSDataStreamReq -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final int HEADER_LENGTH = 20; - - private static final int FILE_HANDLE_OFFSET = 22; - private static final int BASE_OFFSET_OFFSET = 26; - private static final int RELATIVE_OFFSET_OFFSET = 30; - private static final int READ_LENGTH_OFFSET = 34; - private static final int PREREAD_LENGTH_OFFSET = 38; - - // Additional fields if datastreamLevel >= 16: - private static final int LARGE_BASE_OFFSET_OFFSET = 42; - private static final int LARGE_RELATIVE_OFFSET_OFFSET = 50; - - -/** -Construct a read request. -@param fileHandle the file handle -@param offset the offset (in bytes) of the file data -@param length the number of bytes to read -@param datastreamLevel the datastream level of the server -**/ - IFSReadReq(int fileHandle, - long offset, - int length, - int datastreamLevel) - { - super(HEADER_LENGTH + getTemplateLength(datastreamLevel)); - setLength(data_.length); - setTemplateLen(getTemplateLength(datastreamLevel)); - setReqRepID(0x0003); - set32bit(fileHandle, FILE_HANDLE_OFFSET); - - // Set the offset fields. - if (datastreamLevel < 16) - { // Just set the old fields. - set32bit(0, BASE_OFFSET_OFFSET); - set32bit((int)offset, RELATIVE_OFFSET_OFFSET); - } - else - { - // The old fields must be zero. - set32bit(0, BASE_OFFSET_OFFSET); - set32bit(0, RELATIVE_OFFSET_OFFSET); - - // Also set the new "large" fields. - set64bit(0L, LARGE_BASE_OFFSET_OFFSET); // must be zero, even for DSL 16 - set64bit(offset, LARGE_RELATIVE_OFFSET_OFFSET); - } - - set32bit(length, READ_LENGTH_OFFSET); - set32bit(0, PREREAD_LENGTH_OFFSET); - } - - private final static int getTemplateLength(int datastreamLevel) - { - return (datastreamLevel < 16 ? 22 : 38); - } - -} - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSRenameReq.java b/cvsroot/src/com/ibm/as400/access/IFSRenameReq.java deleted file mode 100644 index d6ef1509e..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSRenameReq.java +++ /dev/null @@ -1,86 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSRenameReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - - -/** -Rename file/directory request. -**/ -class IFSRenameReq extends IFSDataStreamReq -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final int SOURCE_CCSID_OFFSET = 22; - private static final int TARGET_CCSID_OFFSET = 24; - private static final int SOURCE_WORKING_DIR_HANDLE_OFFSET = 26; - private static final int TARGET_WORKING_DIR_HANDLE_OFFSET = 30; - private static final int RENAME_FLAGS_OFFSET = 34; - private static final int SOURCE_NAME_LL_OFFSET = 36; - private static final int SOURCE_NAME_CP_OFFSET = 40; - private static final int SOURCE_NAME_OFFSET = 42; - private static final int TEMPLATE_LENGTH = 16; - -/** -Construct a file rename request. -@param sourceName the current file name -@param targetName the new file name -@param fileNameCCSID file name CCSID -@param replaceTarget determines what to do if the new file name is already in use -**/ - IFSRenameReq(byte[] sourceName, - byte[] targetName, - int fileNameCCSID, - boolean replaceTarget) - { - super(20 + TEMPLATE_LENGTH + 6 + sourceName.length + 6 + - targetName.length); - setLength(data_.length); - setTemplateLen(TEMPLATE_LENGTH); - setReqRepID(0x000F); - set16bit(fileNameCCSID, SOURCE_CCSID_OFFSET); - set16bit(fileNameCCSID, TARGET_CCSID_OFFSET); - set32bit(1, SOURCE_WORKING_DIR_HANDLE_OFFSET); - set32bit(1, TARGET_WORKING_DIR_HANDLE_OFFSET); - set16bit((replaceTarget ? 1 : 0), RENAME_FLAGS_OFFSET); - - // Set the source LL. - set32bit(sourceName.length + 6, SOURCE_NAME_LL_OFFSET); - - // Set the source code point. - set16bit(0x0003, SOURCE_NAME_CP_OFFSET); - - // Set the source file name characters. - System.arraycopy(sourceName, 0, data_, SOURCE_NAME_OFFSET, - sourceName.length); - - // Set the target LL. - int targetNameLLOffset = SOURCE_NAME_OFFSET + sourceName.length; - set32bit(targetName.length + 6, targetNameLLOffset); - - // Set the target code point. - set16bit(0x0004, targetNameLLOffset + 4); - - // Set the target file name characters. - System.arraycopy(targetName, 0, data_, targetNameLLOffset + 6, - targetName.length); - } - -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSReturnCodeRep.java b/cvsroot/src/com/ibm/as400/access/IFSReturnCodeRep.java deleted file mode 100644 index 867cbd543..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSReturnCodeRep.java +++ /dev/null @@ -1,98 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSReturnCodeRep.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - - -/** -Return code reply. -**/ -class IFSReturnCodeRep extends IFSDataStream -{ - - static final int FALSE = 0; - static final int SUCCESS = 0; - static final int TRUE = 1; - - static final int FILE_IN_USE = /* 1 */ ExtendedIOException.FILE_IN_USE; - static final int FILE_NOT_FOUND = /* 2 */ ExtendedIOException.FILE_NOT_FOUND; - static final int PATH_NOT_FOUND = /* 3 */ ExtendedIOException.PATH_NOT_FOUND; - static final int DUPLICATE_DIR_ENTRY_NAME = /* 4 */ ExtendedIOException.DIR_ENTRY_EXISTS; - static final int ACCESS_DENIED_TO_DIR_ENTRY = /* 5 */ ExtendedIOException.ACCESS_DENIED; - static final int INVALID_HANDLE = /* 6 */ ExtendedIOException.INVALID_HANDLE; - static final int INVALID_DIR_ENTRY_NAME = /* 7 */ ExtendedIOException.INVALID_DIR_ENTRY_NAME; - static final int INVALID_ATTRIBUTE_NAME = /* 8 */ ExtendedIOException.INVALID_ATTRIBUTE_NAME; - static final int DIR_IS_NOT_EMPTY = /* 9 */ ExtendedIOException.DIR_NOT_EMPTY; - static final int FILE_SUBSTREAM_IN_USE = /* 10 */ ExtendedIOException.FILE_SUBSTREAM_IN_USE; - static final int RESOURCE_LIMIT_EXCEEDED = /* 11 */ ExtendedIOException.RESOURCE_LIMIT_EXCEEDED; - static final int RESOURCE_NOT_AVAILABLE = /* 12 */ ExtendedIOException.RESOURCE_NOT_AVAILABLE; - static final int ACCESS_DENIED_TO_REQUEST = /* 13 */ ExtendedIOException.REQUEST_DENIED; - static final int DIRECTORY_ENTRY_DAMAGED = /* 14 */ ExtendedIOException.DIR_ENTRY_DAMAGED; - static final int INVALID_CONNECTION = /* 15 */ ExtendedIOException.INVALID_CONNECTION; - static final int INVALID_REQUEST = /* 16 */ ExtendedIOException.INVALID_REQUEST; - static final int DATA_STREAM_SYNTAX_ERROR = /* 17 */ ExtendedIOException.DATA_STREAM_SYNTAX_ERROR; - static final int NO_MORE_FILES = /* 18 */ ExtendedIOException.NO_MORE_FILES; - static final int PARM_NOT_SUPPORTED = /* 19 */ ExtendedIOException.PARM_NOT_SUPPORTED; - static final int PARM_VALUE_NOT_SUPPORTED = /* 20 */ ExtendedIOException.PARM_VALUE_NOT_SUPPORTED; - static final int CANNOT_CONVERT_VALUE = /* 21 */ ExtendedIOException.CANNOT_CONVERT_VALUE; - static final int NO_MORE_DATA = /* 22 */ ExtendedIOException.END_OF_FILE; - static final int REQUEST_NOT_SUPPORTED = /* 23 */ ExtendedIOException.REQUEST_NOT_SUPPORTED; - static final int INVALID_USER = /* 24 */ ExtendedIOException.INVALID_USER; - static final int UNKNOWN_ERROR = /* 25 */ ExtendedIOException.UNKNOWN_ERROR; - static final int SHARING_VIOLATION = /* 32 */ ExtendedIOException.SHARING_VIOLATION; - static final int LOCK_VIOLATION = /* 33 */ ExtendedIOException.LOCK_VIOLATION; - static final int STALE_HANDLE = /* 34 */ ExtendedIOException.STALE_HANDLE; - - private static final int RETURN_CODE_OFFSET = 22; - -/** -Construct a return code reply. -**/ - IFSReturnCodeRep() - { - } - -/** -Generate a new instance of this type. -@return a reference to the new instance -**/ - public Object getNewDataStream() - { - return new IFSReturnCodeRep(); - } - -/** -Get the return code. -@return the return code -**/ - int getReturnCode() - { - return get16bit( RETURN_CODE_OFFSET); - } - -/** -Generates a hash code for this data stream. -@return the hash code -**/ - public int hashCode() - { - return 0x8001; - } -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSShareOptionEditor.java b/cvsroot/src/com/ibm/as400/access/IFSShareOptionEditor.java deleted file mode 100644 index 56bdd8a52..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSShareOptionEditor.java +++ /dev/null @@ -1,131 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSShareOptionEditor.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Hashtable; - -/** - The IFSShareOptionEditor class provides - integrated file system share option editor support. -**/ -public class IFSShareOptionEditor extends java.beans.PropertyEditorSupport -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private Integer value_ = new Integer(0); - private static Hashtable javaInitializationString_ = new Hashtable(); - private static Hashtable optionAsText_ = new Hashtable(); - private static ResourceBundleLoader rbl_; - private static Hashtable textAsOption_ = new Hashtable(); - private static String[] tags_ = new String[4]; - - static - { - javaInitializationString_.put(new Integer(IFSFileInputStream.SHARE_ALL), - "IFSFileInputStream.SHARE_ALL"); - javaInitializationString_.put(new Integer(IFSFileInputStream.SHARE_READERS), - "IFSFileInputStream.SHARE_READERS"); - javaInitializationString_.put(new Integer(IFSFileInputStream.SHARE_WRITERS), - "IFSFileInputStream.SHARE_WRITERS"); - javaInitializationString_.put(new Integer(IFSFileInputStream.SHARE_NONE), - "IFSFileInputStream.SHARE_NONE"); - - optionAsText_.put(new Integer(IFSFileInputStream.SHARE_ALL), - rbl_.getText("EDIT_SHARE_ALL")); - optionAsText_.put(new Integer(IFSFileInputStream.SHARE_READERS), - rbl_.getText("EDIT_SHARE_READERS")); - optionAsText_.put(new Integer(IFSFileInputStream.SHARE_WRITERS), - rbl_.getText("EDIT_SHARE_WRITERS")); - optionAsText_.put(new Integer(IFSFileInputStream.SHARE_NONE), - rbl_.getText("EDIT_SHARE_NONE")); - - textAsOption_.put(rbl_.getText("EDIT_SHARE_ALL"), - new Integer(IFSFileInputStream.SHARE_ALL)); - textAsOption_.put(rbl_.getText("EDIT_SHARE_READERS"), - new Integer(IFSFileInputStream.SHARE_READERS)); - textAsOption_.put(rbl_.getText("EDIT_SHARE_WRITERS"), - new Integer(IFSFileInputStream.SHARE_WRITERS)); - textAsOption_.put(rbl_.getText("EDIT_SHARE_NONE"), - new Integer(IFSFileInputStream.SHARE_NONE)); - - tags_[0] = rbl_.getText("EDIT_SHARE_ALL"); - tags_[1] = rbl_.getText("EDIT_SHARE_READERS"); - tags_[2] = rbl_.getText("EDIT_SHARE_WRITERS"); - tags_[3] = rbl_.getText("EDIT_SHARE_NONE"); - } - - /** - Returns the property value in a form suitable for editing. - @return The property value in a form suitable for editing. - **/ - public String getAsText() - { - return (String) optionAsText_.get(value_); - } - - /** - Returns a code fragment representing an initializer for the current value. - This method is intended for use when generating Java code to set the - property value. - @return A code fragment representing an initializer for the current value. - **/ - public String getJavaInitializationString() - { - return (String) javaInitializationString_.get(value_); - } - - /** - Returns the set of possible values for the property. - @return The set of possible values for the property. - **/ - public String[] getTags() - { - return tags_; - } - - /** - Returns the value of the property. - @return The value of the property. - **/ - public Object getValue() - { - return value_; - } - - /** - Sets the property value from the specified String. - @param text The property value. - **/ - public void setAsText(String text) - { - value_ = (Integer) textAsOption_.get(text); - firePropertyChange(); - } - - /** - Sets the value of the object that is to be edited. - @param value The new target object to be edited. - **/ - public void setValue(Object value) - { - if (value instanceof Integer) - { - value_ = (Integer) value; - firePropertyChange(); - } - } -} - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSSystemView.java b/cvsroot/src/com/ibm/as400/access/IFSSystemView.java deleted file mode 100644 index 4f89010fc..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSSystemView.java +++ /dev/null @@ -1,437 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSSystemView.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.File; -import java.io.IOException; -import java.text.MessageFormat; -import javax.swing.filechooser.FileSystemView; -import javax.swing.UIManager; -import javax.swing.Icon; - - -/** - * Provides a gateway to the IBM i integrated file system, - * for use when constructing javax.swing.JFileChooser objects. - *

    JFileChooser is a standard Java way to build dialogs for navigating - * and choosing files. - *

    - * The following example demonstrates the use of IFSSystemView. - * - *

    -  * 
    -  * import com.ibm.as400.access.AS400;
    -  * import com.ibm.as400.access.IFSJavaFile;
    -  * import com.ibm.as400.access.IFSSystemView;
    -  * import javax.swing.JFileChooser;
    -  * import java.awt.Frame;
    -  * 
    -  * // Work with directory /Dir on the system myAS400.
    -  * AS400 system = new AS400("myAS400");
    -  * IFSJavaFile dir = new IFSJavaFile(system, "/Dir");
    -  * JFileChooser chooser = new JFileChooser(dir, new IFSSystemView(system));
    -  * Frame parent = new Frame();
    -  * int returnVal = chooser.showOpenDialog(parent);
    -  * if (returnVal == JFileChooser.APPROVE_OPTION) {
    -  *    IFSJavaFile chosenFile = (IFSJavaFile)(chooser.getSelectedFile());
    -  *    System.out.println("You selected the file named " +
    -  *                        chosenFile.getName());
    -  * }
    -  * 
    - * - * @see com.ibm.as400.access.IFSJavaFile - **/ - -public class IFSSystemView extends FileSystemView -{ - private static final boolean DEBUG = false; - private AS400 system_; - private static final String ROOT_PATH = IFSJavaFile.separator; - - private static final String DEFAULT_FOLDER_NAME = "NewFolder"; - - private static final String NEW_FOLDER_STRING0 = - UIManager.getString("FileChooser.other.newFolder"); - private static final String NEW_FOLDER_NEXT_STRING0 = - UIManager.getString("FileChooser.other.newFolder.subsequent"); - private static final String NEW_FOLDER_STRING = ((NEW_FOLDER_STRING0 == null || NEW_FOLDER_STRING0.length() == 0) ? DEFAULT_FOLDER_NAME : NEW_FOLDER_STRING0); - private static final String NEW_FOLDER_NEXT_STRING = ((NEW_FOLDER_NEXT_STRING0 == null || NEW_FOLDER_NEXT_STRING0.length() == 0) ? DEFAULT_FOLDER_NAME+".{0}" : NEW_FOLDER_NEXT_STRING0); - - private static Icon serverIcon32_ = ResourceBundleLoader.getIcon ("AS40032.gif"); - - - /** - Constructs an IFSSystemView object. - @param system The system that contains the file. - **/ - public IFSSystemView(AS400 system) - { - if (system == null) throw new NullPointerException("system"); - - system_ = system; - } - - /** - Returns a File object constructed in directory from the given filename. -
    Note: This method does not create an actual file in the file system. - @param containingDir The directory in which to create the file. -
    containingDir is assumed to represent an existing directory on the system. If null, it is ignored. - @param name The file name. - @return a File object representing the new file. - **/ - public File createFileObject(File containingDir, String name) - { - if (name == null) throw new NullPointerException("name"); - - IFSJavaFile file; - - if (containingDir != null) { - IFSJavaFile ifsDir; - if (DEBUG) { - ifsDir = convertToIFSJavaFile(containingDir, "createFileObject"); - } - else { - ifsDir = convertToIFSJavaFile(containingDir); - } - file = new IFSJavaFile(ifsDir, name); - } - else { - file = new IFSJavaFile(system_, name); - } - - if (isFileSystemRoot(file)) return createFileSystemRoot(file); - else return file; - } - - /** - Returns a File object constructed from the given path string. -
    Note: This method does not create an actual file in the file system. - @param path The file path name. - @return the File object. - **/ - public File createFileObject(String path) - { - if (path == null) throw new NullPointerException("path"); - IFSJavaFile file = new IFSJavaFile(system_, path); - // Note: There is logic in javax.swing.plaf.basic.BasicFileChooserUI#ApproveSelectionAction.actionPerformed() that queries if the file is "absolute". If not absolute, the logic prepends the directory path. For that reason, each instance of IFSJavaFile needs to retain an awareness of whether it was created with an absolute path or not. - if (isFileSystemRoot(file)) { - return createFileSystemRoot(file); - } - else return file; - } - - - // Note: The method createFileSystemRoot() was added to the FileSystemView class in JDK 1.4. - // We provide an implementation here to swallow the NoSuchMethodError if running on an older JDK. - protected File createFileSystemRoot(File f) { - try { - return super.createFileSystemRoot(f); - } - catch (NoSuchMethodError e) { // method added in JDK 1.4 - if (Trace.isTraceOn()) { - Trace.log(Trace.DIAGNOSTIC, e); - } - return f; - } - } - - /** - Creates a new folder with a default name. -
    Note: In the context of this class, "folder" is synonymous with "directory". - @param containingDir The parent directory in which to create the folder. -
    containingDir is assumed to represent an existing directory on the system. - @return a File object representing the new folder. - **/ - public File createNewFolder(File containingDir) - throws IOException - { - if (containingDir == null) throw new IOException("Containing directory is null:"); // This is what javax.swing.filechooser.FileSystemView does. - - IFSJavaFile ifsDir; - if (DEBUG) { - ifsDir = convertToIFSJavaFile(containingDir, "createNewFolder"); - } - else { - ifsDir = convertToIFSJavaFile(containingDir); - } - IFSJavaFile newFolder = new IFSJavaFile(ifsDir, NEW_FOLDER_STRING); - int i=1; - while (newFolder.exists() && (i<100)) - { - newFolder = new IFSJavaFile(ifsDir, - MessageFormat.format( - NEW_FOLDER_NEXT_STRING, new Object[] { new Integer(i++)})); - } - - if (newFolder.exists()) - { - throw new IOException("Directory already exists:" + newFolder.getAbsolutePath()); - } - else - { - newFolder.mkdirs(); - return newFolder; - } - } - - - // The parent's implementation works for us. If not, here's what we'd do: - // public File getChild(File parent, - // String fileName) - // { - // if (parent == null) throw new NullPointerException("parent"); - // if (fileName == null) throw new NullPointerException("fileName"); - // - // return createFileObject(parent, fileName); - // } - - - /** - * Returns the user's default starting directory for the file chooser. - * This will represent the 'root' directory on the system. - * @return A File object representing the default - * starting folder. - **/ - public File getDefaultDirectory() - { - return createFileSystemRoot(new IFSJavaFile(system_, ROOT_PATH)); - } - - - /** - Gets the list of shown (that is, not hidden) files in the directory. - @param directory The directory to search. - @param useFileHiding This parameter is ignored. - @return The list of files. - **/ - public File[] getFiles(File directory, boolean useFileHiding) - { - if (directory == null) throw new NullPointerException("directory"); - - IFSJavaFile ifsDir; - if (DEBUG) { - ifsDir = convertToIFSJavaFile(directory, "getFiles"); - } - else { - ifsDir = convertToIFSJavaFile(directory); - } - return ifsDir.listFiles(); - } - - /** - Returns the home directory. -
    The IBM i integrated file system has one home directory, the "/" directory. - @return the home directory. - **/ - public File getHomeDirectory() - { - return (new IFSJavaFile(system_, ROOT_PATH)); - } - - /** - Returns the parent directory of dir. - @param dir The directory being queried. -
    dir is assumed to represent an existing directory on the system. - @return the parent directory of dir, or null if dir is null. - **/ - public File getParentDirectory(File dir) - { - if (dir == null) return null; - - IFSJavaFile ifsDir; - if (DEBUG) { - ifsDir = convertToIFSJavaFile(dir, "getParentDirectory"); - } - else { - ifsDir = convertToIFSJavaFile(dir); - } - IFSJavaFile parent = (IFSJavaFile)ifsDir.getParentFile(); - if (isFileSystemRoot(parent)) { - return createFileSystemRoot(parent); - } - else return parent; - } - - /** - Returns all root partitions on this system. -
    The IBM i integrated file system has one root partition, the "/" directory. - @return all root partitions on this system. - **/ - public File[] getRoots() - { - return new File[] { createFileSystemRoot(new IFSJavaFile(system_, ROOT_PATH)) }; - } - - /** - * Returns the name of a file, directory, or folder as it would be displayed in - * a system file browser. - * - * @param f A File object. - * @return The file name as it would be displayed by a native file chooser. - **/ - public String getSystemDisplayName(File f) - { - if (f == null) return null; - - return f.getName(); - } - - /** - * Always returns an icon representing an IBM i system. - **/ - public Icon getSystemIcon(File f) - { - return serverIcon32_; - } - - /** - * Returns a type description for a file, directory, or folder as it would be displayed in - * a system file browser. - * @param f A File object. - * @return The file type description as it would be displayed by a native file chooser - * or null if no native information is available. - **/ - public String getSystemTypeDescription(File f) - { - return system_.getSystemName(); - } - - /** - Always returns false. - **/ - public boolean isComputerNode(File dir) - { - return false; // no "computer nodes" in IFS - } - - /** - Always returns false. - **/ - public boolean isDrive(File dir) - { - return false; // no "drives" in IFS - } - - /** - Always returns false. - **/ - public boolean isFloppyDrive(File dir) - { - return false; // no "floppy drives" in IFS - } - - // The parent's implementation works for us. If not, here's what we'd do: - // public boolean isFileSystem(File file) - // { - // if (file == null) throw new NullPointerException("file"); - // - // return (!file.getPath().startsWith("ShellFolder")); - // } - - - /** - * Returns true if f represents the root directory on the system ("/"), - * and false otherwise. - * - * @param f A File object representing a directory. - * @return true if f is a root of a filesystem - **/ - public boolean isFileSystemRoot(File f) - { - if (f == null) return false; - - return (f.getAbsolutePath().equals(ROOT_PATH)); - } - - - // The parent's implementation works for us. If not, here's what we'd do: - // public boolean isHiddenFile(File file) - // { - // if (file == null) throw new NullPointerException("file"); - // - // return file.isHidden(); - // } - - - // The parent's implementation works for us. If not, here's what we'd do: - // public boolean isParent(File folder, File file) - // { - // if (folder == null || file == null) return false; - // - // return folder.equals(file.getParentFile()); - // } - - - /** - Determines if the given file is a root in the navigatable tree(s). -
    The IBM i integrated file system has one root, the "/" directory. - @param file A File object representing a directory. - @return true if file is a root in the navigatable tree. - **/ - public boolean isRoot(File file) - { - // Note: Normally we'd just use the parent's method, but older JDK's (pre-1.4) seem to have difficulty unless we provide our own. - if (file == null || !file.isAbsolute()) { - return false; - } - - return (file.getAbsolutePath().equals(ROOT_PATH)); - } - - - // The parent's implementation works for us. If not, here's what we'd do: - // public Boolean isTraversable(File file) - // { - // if (file == null) throw new NullPointerException("file"); - // - // return Boolean.valueOf(file.isDirectory()); - // - // } - - - // Utility method. - private IFSJavaFile convertToIFSJavaFile(File file) - { - if (file instanceof IFSJavaFile) { - return (IFSJavaFile)file; - } - - if (Trace.isTraceOn()) { - Trace.log(Trace.DIAGNOSTIC, - "File is not an IFSJavaFile. File is of type " + file.getClass().getName()); - } - // Create an IFSJavaFile using the path contained in the File object. - return new IFSJavaFile(system_, file.getPath()); - } - - - // Utility method. Additionally accepts a methodName, for more-descriptive tracing. - private IFSJavaFile convertToIFSJavaFile(File file, String methodName) - { - if (DEBUG) { - if (file instanceof IFSJavaFile) { - return (IFSJavaFile)file; - } - - if (Trace.isTraceOn()) { - Trace.log(Trace.DIAGNOSTIC, - "File is not an IFSJavaFile. File is of type " + file.getClass().getName() + ". Caller was " + methodName + "."); - } - // Create an IFSJavaFile using the path contained in the File object. - return new IFSJavaFile(system_, file.getPath()); - } - else return convertToIFSJavaFile(file); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSTextFileInputStream.java b/cvsroot/src/com/ibm/as400/access/IFSTextFileInputStream.java deleted file mode 100644 index c8a14429c..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSTextFileInputStream.java +++ /dev/null @@ -1,221 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSTextFileInputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStreamReader; - - -/** -Represents an integrated file system input stream for character data. -
    -IFSTextFileInputStream objects are capable of generating file events -which call the following FileListener methods: fileClosed and fileOpened. -
    Note: This class is provided for situations where an InputStream is required. The preferred method of reading a text file is via {@link IFSFileReader IFSFileReader}. -

    -The following example illustrates the use of IFSTextFileInputStream: -

    -// Work with /File on the system eniac.
    -AS400 as400 = new AS400("eniac");
    -IFSTextFileInputStream file = new IFSTextFileInputStream(as400, "/File");
    -// Read the first four characters of the file. -String s = file.read(4); -// Display the characters read. -System.out.println(s); -// Close the file. -file.close(); -
    -@see com.ibm.as400.access.FileEvent -@see com.ibm.as400.access.IFSFileInputStream#addFileListener -@see com.ibm.as400.access.IFSFileInputStream#removeFileListener - **/ -public class IFSTextFileInputStream extends IFSFileInputStream - implements java.io.Serializable -{ - static final long serialVersionUID = 4L; - - /** - Constructs an IFSTextFileInputStream object. - **/ - public IFSTextFileInputStream() - { - super(); - } - - /** - Constructs an IFSTextFileInputStream object. - It creates a file input stream to read from the text file name. - Other readers and writers are allowed to access the file. The file is - opened if it exists; otherwise an exception is thrown. - @param system The AS400 that contains the file. - @param name The integrated file system name. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSTextFileInputStream(AS400 system, - String name) - throws AS400SecurityException, IOException - { - super(system, name); - } - - - /** - Constructs an IFSTextFileInputStream object. - It creates a file input stream to read from the text file name. - @param system The AS400 that contains the file. - @param name The integrated file system name. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSTextFileInputStream(AS400 system, - String name, - int shareOption) - throws AS400SecurityException, IOException - { - super(system, name, shareOption); - } - - // @A5a - /** - Constructs an IFSTextFileInputStream object. - It creates a file input stream to read from the text file specified by file. - Other readers and writers are allowed to access the file. The file is - opened if it exists; otherwise an exception is thrown. - @param file The file to be opened for reading. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSTextFileInputStream(IFSFile file) - throws AS400SecurityException, IOException - { - super(file); - } - - /** - Constructs an IFSTextFileInputStream object. - It creates a file input stream to read from the text file specified by file. - @param system The AS400 that contains the file. - @param file The file to be opened for reading. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSTextFileInputStream(AS400 system, - IFSFile file, - int shareOption) - throws AS400SecurityException, IOException - { - super(system, file, shareOption); - } - - // @A5a - /** - Constructs an IFSTextFileInputStream object. - It creates a file input stream to read from the text file specified by file. - Other readers and writers are allowed to access the file. The file is - opened if it exists; otherwise an exception is thrown. - @param file The file to be opened for reading. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSTextFileInputStream(IFSJavaFile file) - throws AS400SecurityException, IOException - { - super(file); - } - - // @A2A - /** - Constructs an IFSTextFileInputStream object. - It creates a file input stream to read from the text file specified by file. - @param system The AS400 that contains the file. - @param file The file to be opened for reading. - @param shareOption Indicates how users can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSTextFileInputStream(AS400 system, - IFSJavaFile file, - int shareOption) - throws AS400SecurityException, IOException - { - super(system, file, shareOption); - } - - /** - Constructs an IFSTextFileInputStream object. - It creates a text file input stream to read from file descriptor fd. - @param fd The file descriptor to be opened for reading. - **/ - public IFSTextFileInputStream(IFSFileDescriptor fd) - { - super(fd); - } - - - /** - Returns the implementation object. - @return The implementation object associated with this stream. - **/ - IFSFileInputStreamImpl getImpl() - { - return super.getImpl(); // Note: This may be null. - } - - - /** - Reads up to length characters from this text file input stream. - The file contents are converted from the file data CCSID to Unicode if - the encoding is supported. - @param length The number of characters to read from the stream. - @return The characters read from the stream. If the end of file has been - reached an empty String is returned. - - @exception IOException If an error occurs while communicating with the system. - **/ - public String read(int length) - throws IOException - { - String data = ""; - - // Validate length. - if (length < 0) - { - throw new ExtendedIllegalArgumentException("length (" + - Integer.toString(length) + - ")", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - else if (length == 0) - { - return ""; - } - else - { - // Ensure that the file is open. - open(); - - return impl_.readText(length); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSTextFileInputStream16.gif b/cvsroot/src/com/ibm/as400/access/IFSTextFileInputStream16.gif deleted file mode 100644 index a7709a992..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/IFSTextFileInputStream16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/IFSTextFileInputStream32.gif b/cvsroot/src/com/ibm/as400/access/IFSTextFileInputStream32.gif deleted file mode 100644 index fcc295d41..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/IFSTextFileInputStream32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/IFSTextFileInputStreamBeanInfo.java b/cvsroot/src/com/ibm/as400/access/IFSTextFileInputStreamBeanInfo.java deleted file mode 100644 index b124b4cee..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSTextFileInputStreamBeanInfo.java +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSTextFileInputStreamBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.BeanInfo; -import java.beans.BeanDescriptor; -import java.awt.Image; - - -/** - The IFSTextFileInputStreamBeanInfo class provides bean information for - the IFSTextFileInputStream class. - **/ - -public class IFSTextFileInputStreamBeanInfo extends IFSFileInputStreamBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(IFSTextFileInputStream.class); - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("IFSTextFileInputStream16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("IFSTextFileInputStream32.gif"); - break; - } - - return image; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/IFSTextFileOutputStream.java b/cvsroot/src/com/ibm/as400/access/IFSTextFileOutputStream.java deleted file mode 100644 index b27cbab04..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSTextFileOutputStream.java +++ /dev/null @@ -1,378 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSTextFileOutputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.beans.PropertyVetoException; - - -/** -The IFSTextFileOutputStream class represents an integrated file system output stream for character data. -
    -IFSTextFileOutputStream object is capable of generating file events which call the following FileListener methods: fileClosed, fileModified, and fileOpened. -
    - Note: By default, Unicode data is written to the file. To use another CCSID when writing to the file, use one of the constructors that has a ccsid parameter. -
    Note: This class is provided for situations where an OutputStream is required. The preferred method of writing to a text file is via {@link IFSFileWriter IFSFileWriter}. -

    -The following example illustrates the use of IFSTextFileOutputStream: -

    -// Work with /File on the system eniac.
    -AS400 as400 = new AS400("eniac");
    -IFSTextFileOutputStream file = new IFSTextFileOutputStream(as400, "/File");
    -// Write a String to the file (don't convert characters). -file.write("Hello world"); -// Close the file. -file.close(); -
    -@see com.ibm.as400.access.FileEvent -@see com.ibm.as400.access.IFSFileOutputStream#addFileListener -@see com.ibm.as400.access.IFSFileOutputStream#removeFileListener - **/ - -public class IFSTextFileOutputStream extends IFSFileOutputStream - implements java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - /** - Constructs an IFSTextFileOutputStream object. - **/ - public IFSTextFileOutputStream() - { - super(); - } - - /** - Constructs an IFSTextFileOutputStream object. - It creates a file output stream to write to the text file with the specified name. - Other readers and writers are allowed to access the file. The file is - replaced if it exists; otherwise the file is created. - By default, Unicode data is written to the file. - @param system The AS400 that contains the file. - @param name The file to be opened for writing. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSTextFileOutputStream(AS400 system, - String name) - throws AS400SecurityException, IOException - { - super(system, name); - } - - - // @A1A - /** - Constructs an IFSTextFileOutputStream object. - It creates a file output stream to write to the text file with the specified name and CCSID. - Other readers and writers are allowed to access the file. The file is - replaced if it exists; otherwise the file is created. - @param system The AS400 that contains the file. - @param name The file to be opened for writing. - @param ccsid The CCSID of the data being written to the file. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSTextFileOutputStream(AS400 system, - String name, - int ccsid) - throws AS400SecurityException, IOException - { - super(system, name, ccsid); - } - - - /** - Constructs an IFSTextFileOutputStream object. - It creates a file output stream to write to the text file with the specified name. - By default, Unicode data is written to the file. - @param system The AS400 that contains the file. - @param name The file to be opened for writing. - @param shareOption Indicates how other user's can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param append Controls the behavior when the file exists. If true, output - is appended to the file; - otherwise, the current contents of the file are erased, - and output replaces the file contents. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSTextFileOutputStream(AS400 system, - String name, - int shareOption, - boolean append) - throws AS400SecurityException, IOException - { - super(system, name, shareOption, append); - } - - - // @A1A - /** - Constructs an IFSTextFileOutputStream object. - It creates a file output stream to write to the text file with the specified name and CCSID. - @param system The AS400 that contains the file. - @param name The file to be opened for writing. - @param shareOption Indicates how other user's can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param append Controls the behavior when the file exists. If true, output - is appended to the file; - otherwise, the current contents of the file are erased, - and output replaces the file contents. - @param ccsid The CCSID of the data being written to the file. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSTextFileOutputStream(AS400 system, - String name, - int shareOption, - boolean append, - int ccsid) - throws AS400SecurityException, IOException - { - super(system, name, shareOption, append, ccsid); - } - - - // @A5a - /** - Constructs an IFSTextFileOutputStream object. - It creates a file output stream to write to the text file specified by file. - Other readers and writers are allowed to access the file. The file is - replaced if it exists; otherwise the file is created. - By default, Unicode data is written to the file. - @param file The file to be opened for writing. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSTextFileOutputStream(IFSFile file) - throws AS400SecurityException, IOException - { - super(file); - } - - - /** - Constructs an IFSTextFileOutputStream object. - It creates a file output stream to write to the text file specified by file. - By default, Unicode data is written to the file. - @param system The AS400 that contains the file. - @param file The file to be opened for writing. - @param shareOption Indicates how other user's can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param append Controls the behavior when the file exists. If true, output - is appended to the file; - otherwise, the current contents of the file are erased, - and output replaces the file contents. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSTextFileOutputStream(AS400 system, - IFSFile file, - int shareOption, - boolean append) - throws AS400SecurityException, IOException - { - super(system, file, shareOption, append); - } - - - // @A1A - /** - Constructs an IFSTextFileOutputStream object. - It creates a file output stream to write to the text file specified by file using the - CCSID specified by ccsid. - @param system The AS400 that contains the file. - @param file The file to be opened for writing. - @param shareOption Indicates how other user's can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param append Controls the behavior when the file exists. If true, output - is appended to the file; - otherwise, the current contents of the file are erased, - and output replaces the file contents. - @param ccsid The CCSID of the data being written to the file. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSTextFileOutputStream(AS400 system, - IFSFile file, - int shareOption, - boolean append, - int ccsid) - throws AS400SecurityException, IOException - { - super(system, file, shareOption, append, ccsid); - } - - - // @A5a - /** - Constructs an IFSTextFileOutputStream object. - It creates a file output stream to write to the text file specified by file. - Other readers and writers are allowed to access the file. The file is - replaced if it exists; otherwise the file is created. - @param file The file to be opened for writing. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSTextFileOutputStream(IFSJavaFile file) - throws AS400SecurityException, IOException - { - super(file); - } - - - // @A2A - /** - Constructs an IFSTextFileOutputStream object. - It creates a file output stream to write to the text file specified by file. - @param system The AS400 that contains the file. - @param file The file to be opened for writing. - @param shareOption Indicates how other user's can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param append Controls the behavior when the file exists. If true, output - is appended to the file; - otherwise, the current contents of the file are erased, - and output replaces the file contents. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSTextFileOutputStream(AS400 system, - IFSJavaFile file, - int shareOption, - boolean append) - throws AS400SecurityException, IOException - { - super(system, file, shareOption, append); - } - - - // @A2A - /** - Constructs an IFSTextFileOutputStream object. - It creates a file output stream to write to the text file specified by file using the - CCSID specified by ccsid. - @param system The AS400 that contains the file. - @param file The file to be opened for writing. - @param shareOption Indicates how other user's can access the file.
    • SHARE_ALL Share access with readers and writers
    • SHARE_NONE Share access with none
    • SHARE_READERS Share access with readers
    • SHARE_WRITERS Share access with writers
    - @param append Controls the behavior when the file exists. If true, output - is appended to the file; - otherwise, the current contents of the file are erased, - and output replaces the file contents. - @param ccsid The CCSID of the data being written to the file. - - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public IFSTextFileOutputStream(AS400 system, - IFSJavaFile file, - int shareOption, - boolean append, - int ccsid) - throws AS400SecurityException, IOException - { - super(system, file, shareOption, append, ccsid); - } - - - /** - Constructs an IFSTextFileOutputStream object. - It creates a file output stream to write to file descriptor fd. - @param fd The file descriptor to be opened for writing. - **/ - public IFSTextFileOutputStream(IFSFileDescriptor fd) - { - super(fd); - } - - /** - Returns the CCSID. This is just the bean property, and does not - necessarily represent the file's actual original CCSID on the system. - @return The CCSID. - @see com.ibm.as400.access.IFSFile#getCCSID - **/ - public int getCCSID() - { - return super.getCCSID(); - } - - - /** - Returns the implementation object. - @return The implementation object associated with this stream. - **/ - IFSFileOutputStreamImpl getImpl() - { - return super.getImpl(); // Note: This may be null. - } - - - /** - Sets the CCSID for the data written to the file. -
    Note: This method is of limited usefulness, since it is invalid after - a connection has been opened to the file on the system, and most of the - constructors for this class open a connection. The preferred way to set - the CCSID of the file is via a constructor that has a "ccsid" argument. - @param ccsid The target CCSID. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setCCSID(int ccsid) - throws PropertyVetoException - { - super.setCCSID(ccsid); - } - - - /** - Writes characters to this text file input stream. - The characters that are written to the file are converted to the - specified CCSID. - @param data The characters to write to the stream. - - @exception IOException If an error occurs while communicating with the system. - - @see #getCCSID - @see #setCCSID - **/ - public void write(String data) - throws IOException - { - // Validate length. - if (data == null) - { - throw new NullPointerException("data"); - } - - if (data.length() != 0) - { - // Ensure that the file is open. - open(getCCSID()); - - impl_.writeText(data, getCCSID()); - - // Notify any listeners that a "modify" event has occurred. - if (fileListeners_.size() != 0) - IFSFileDescriptor.fireModifiedEvents(this, fileListeners_); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IFSTextFileOutputStream16.gif b/cvsroot/src/com/ibm/as400/access/IFSTextFileOutputStream16.gif deleted file mode 100644 index 1b6633842..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/IFSTextFileOutputStream16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/IFSTextFileOutputStream32.gif b/cvsroot/src/com/ibm/as400/access/IFSTextFileOutputStream32.gif deleted file mode 100644 index 0b35ae264..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/IFSTextFileOutputStream32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/IFSTextFileOutputStreamBeanInfo.java b/cvsroot/src/com/ibm/as400/access/IFSTextFileOutputStreamBeanInfo.java deleted file mode 100644 index 5c0c9c427..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSTextFileOutputStreamBeanInfo.java +++ /dev/null @@ -1,80 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSTextFileOutputStreamBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.BeanInfo; -import java.beans.BeanDescriptor; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.awt.Image; - - -/** - The IFSTextFileOutputStreamBeanInfo class provides bean information for - the IFSTextFileOutputStream class. - **/ - -public class IFSTextFileOutputStreamBeanInfo extends IFSFileOutputStreamBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(IFSTextFileOutputStream.class); - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("IFSTextFileOutputStream16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("IFSTextFileOutputStream32.gif"); - break; - } - - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return IFSFileOutputStreamBeanInfo.ifsTextFileOutputStreamProperties_; - } - -} - - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSUnlockBytesReq.java b/cvsroot/src/com/ibm/as400/access/IFSUnlockBytesReq.java deleted file mode 100644 index 814523872..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSUnlockBytesReq.java +++ /dev/null @@ -1,92 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSUnlockBytesReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** -"Unlock file bytes" request. -**/ -class IFSUnlockBytesReq extends IFSDataStreamReq -{ - private static final int HEADER_LENGTH = 20; - - private static final int FILE_HANDLE_OFFSET = 22; - private static final int BASE_OFFSET_OFFSET = 26; // field must be 0 if DSL<16 - private static final int RELATIVE_OFFSET_OFFSET = 30; // field must be 0 if DSL<16 - private static final int UNLOCK_LENGTH_OFFSET = 34; // field must be 0 if DSL<16 - private static final int UNLOCK_FLAGS_OFFSET = 38; - - // Additional fields if datastreamLevel >= 16: - private static final int LARGE_BASE_OFFSET_OFFSET = 40; - private static final int LARGE_RELATIVE_OFFSET_OFFSET = 48; - private static final int LARGE_UNLOCK_LENGTH_OFFSET = 56; - -/** -Construct an unlock bytes request. -@param fileHandle the file handle -@param offset the byte offset of the start of the lock in the file -@param length the number of bytes that are locked -@param isMandatory if True the lock is mandatory, otherwise it is advisory -**/ - IFSUnlockBytesReq(int fileHandle, - long offset, - long length, - boolean isMandatory, - int datastreamLevel) - { - super(HEADER_LENGTH + getTemplateLength(datastreamLevel)); // no optional/variable section - setLength(data_.length); - setTemplateLen(getTemplateLength(datastreamLevel)); - setReqRepID(0x0008); - set32bit(fileHandle, FILE_HANDLE_OFFSET); - set16bit((isMandatory ? 0 : 1), UNLOCK_FLAGS_OFFSET); - - if (datastreamLevel < 16) - { // set old fields - if (offset > (long)Integer.MAX_VALUE) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Specified offset value ("+offset+") exceeds maximum file length supported by system."); - offset = (long)Integer.MAX_VALUE; // set to maximum possible 'int' value - } - if (length > (long)Integer.MAX_VALUE) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Specified length value ("+length+") exceeds maximum file length supported by system."); - length = (long)Integer.MAX_VALUE; // set to maximum possible 'int' value - } - set32bit(0, BASE_OFFSET_OFFSET); - set32bit((int)offset, RELATIVE_OFFSET_OFFSET); - set32bit((int)length, UNLOCK_LENGTH_OFFSET); - } - else - { // old fields must be zero - set32bit(0, BASE_OFFSET_OFFSET); - set32bit(0, RELATIVE_OFFSET_OFFSET); - set32bit(0, UNLOCK_LENGTH_OFFSET); - - // new "large" fields - set64bit(0L, LARGE_BASE_OFFSET_OFFSET); - set64bit(offset, LARGE_RELATIVE_OFFSET_OFFSET); - set64bit(length, LARGE_UNLOCK_LENGTH_OFFSET); - } - } - - private final static int getTemplateLength(int datastreamLevel) - { - return (datastreamLevel < 16 ? 20 : 44); - } - -} - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSWriteRep.java b/cvsroot/src/com/ibm/as400/access/IFSWriteRep.java deleted file mode 100644 index 7f74c7d1b..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSWriteRep.java +++ /dev/null @@ -1,74 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSWriteRep.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** -Write data reply. -**/ -class IFSWriteRep extends IFSDataStream -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private static final int RETURN_CODE_OFFSET = 22; - private static final int PREVIOUS_FILE_SIZE_OFFSET = 24; - private static final int BYTES_NOT_WRITTEN_OFFSET = 28; - -/** -Construct a write reply. -**/ - IFSWriteRep() - { - } - -/** -Generate a new instance of this type. -@return a reference to the new instance -**/ - public Object getNewDataStream() - { - return new IFSWriteRep(); - } - -/** -Determine the amount that couldn't be written. -@return the number of bytes that were not written -**/ - int getLengthNotWritten() - { - return get32bit( BYTES_NOT_WRITTEN_OFFSET); - } - -/** -Get the return code -@return the return code -**/ - int getReturnCode() - { - return get16bit( RETURN_CODE_OFFSET); - } - -/** -Generates a hash code for this data stream. -@return the hash code -**/ - public int hashCode() - { - return 0x800b; - } -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/IFSWriteReq.java b/cvsroot/src/com/ibm/as400/access/IFSWriteReq.java deleted file mode 100644 index 1c2541a8b..000000000 --- a/cvsroot/src/com/ibm/as400/access/IFSWriteReq.java +++ /dev/null @@ -1,134 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSWriteReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** -"Write data" request. -**/ -class IFSWriteReq extends IFSDataStreamReq -{ - private static final int HEADER_LENGTH = 20; - - private static final int FILE_HANDLE_OFFSET = 22; - private static final int BASE_OFFSET_OFFSET = 26; - private static final int RELATIVE_OFFSET_OFFSET = 30; - private static final int DATA_FLAGS_OFFSET = 34; - private static final int CCSID_OFFSET = 36; - - // Additional fields if datastreamLevel >= 16: - private static final int LARGE_BASE_OFFSET_OFFSET = 38; - private static final int LARGE_RELATIVE_OFFSET_OFFSET = 46; - - -/** -Construct a write request. -@param fileHandle the file handle -@param fileOffset the offset (in bytes) in the file -@param data the data to write -@param dataOffset the offset (in bytes) in the data to write -@param dataLength the number of bytes to write -@param dataCCSID the code page and character set of data (0xffff if unknown) -@param forceToStorage if the data must be written to disk before the server replies -@param datastreamLevel the datastream level of the server -**/ - IFSWriteReq(int fileHandle, - long fileOffset, - byte[] data, - int dataOffset, - int dataLength, - int dataCCSID, - boolean forceToStorage, - int datastreamLevel) - { - super(HEADER_LENGTH + getTemplateLength(datastreamLevel) + 6 + dataLength); - setLength(data_.length); - setTemplateLen(getTemplateLength(datastreamLevel)); - setReqRepID(0x0004); - set32bit(fileHandle, FILE_HANDLE_OFFSET); - - // Set the beginning data offset. Use a base offset of zero. - setOffsetFields(fileOffset, datastreamLevel); - - // Request a reply. - // If forceToStorage is true, need a sync write, thus both bits - // need to be turned on. Otherwise, only bit 1 needs to be on. - set16bit( (forceToStorage) ? 3 : 2 , DATA_FLAGS_OFFSET); - - // Set data CCSID - set16bit(dataCCSID, CCSID_OFFSET); - - // Set the data LL. - set32bit(dataLength + 6, getFileDataLLOffset(datastreamLevel)); - - // Set the code point. - set16bit(0x0020, getFileDataCPOffset(datastreamLevel)); - - // Copy the data to be written, into the "file data" field of the request. - System.arraycopy(data, dataOffset, data_, getFileDataOffset(datastreamLevel), dataLength); - - } - - private final static int getTemplateLength(int datastreamLevel) - { - return (datastreamLevel < 16 ? 18 : 34); - } - - - // Determine offset (from beginning of request) to the 4-byte File Data "LL" field. - private final static int getFileDataLLOffset(int datastreamLevel) - { - return (datastreamLevel < 16 ? 38 : 54); - } - - // Determine offset (from beginning of request) to the 2-byte File Data "CP" field. - private final static int getFileDataCPOffset(int datastreamLevel) - { - return (datastreamLevel < 16 ? 42 : 58); - } - - // Determine offset (from beginning of request) to the File Data value field (follows LL/CP). - private final static int getFileDataOffset(int datastreamLevel) - { - return (datastreamLevel < 16 ? 44 : 60); - } - - // Sets the values of the fields relating to data offset. - private final void setOffsetFields(long fileOffset, int datastreamLevel) - { - if (datastreamLevel < 16) - { // Just set the old fields. - if (fileOffset > (long)Integer.MAX_VALUE) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Specified fileOffset value ("+fileOffset+") exceeds maximum file length supported by system."); - fileOffset = (long)Integer.MAX_VALUE; // set to maximum possible 'int' value - } - set32bit(0, BASE_OFFSET_OFFSET); - set32bit((int)fileOffset, RELATIVE_OFFSET_OFFSET); - } - else - { - // Old fields must be zero. - set32bit(0, BASE_OFFSET_OFFSET); - set32bit(0, RELATIVE_OFFSET_OFFSET); - - // Also set the new "large" fields. - set64bit(0L, LARGE_BASE_OFFSET_OFFSET); - set64bit(fileOffset, LARGE_RELATIVE_OFFSET_OFFSET); - } - } - -} - - diff --git a/cvsroot/src/com/ibm/as400/access/ISeriesNetServer.java b/cvsroot/src/com/ibm/as400/access/ISeriesNetServer.java deleted file mode 100644 index 7e62a7113..000000000 --- a/cvsroot/src/com/ibm/as400/access/ISeriesNetServer.java +++ /dev/null @@ -1,3170 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ISeriesNetServer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @A1 2008-02-12 Change to userHasSpecialAuthority() method. This method -// determines if a user has *IOSYSCFG authority. This change will expand -// the determination to include if any groups that the user belongs to has -// *IOSYSCFG authority. -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.Serializable; -import java.io.ObjectInputStream; -import java.beans.PropertyVetoException; - -/** - Represents the NetServer service on a system. - This class allows the user to query and modify the state and configuration - of the NetServer. -

    - If the NetServer job on the IBM i system is not started, the "list" methods may return incomplete results. To determine if the NetServer job is started, use the {@link #isStarted() isStarted} method. To start the NetServer, use the {@link #start() start} method. -

    -Note: The first call to one of the attribute "getter" methods will cause an implicit call to -{@link #refresh() refresh}, if refresh() hasn't yet been explicitly called. -If any exceptions are thrown by refresh() during the implicit call, -they will be logged to {@link com.ibm.as400.access.Trace#ERROR Trace.ERROR} and -ignored. However, should an exception occur during an explicit call to -refresh(), it will be thrown to the caller. -

    - Note: Typically, methods which change the state or attributes of the NetServer require that the system user profile have *IOSYSCFG special authority. For example, starting or ending the NetServer requires *IOSYSCFG authority. -

    - Note: This class uses some API fields that are available only when connecting to systems at release V5R1 or higher. - -

    -
    -* import com.ibm.as400.access.*;
    -*
    -* // Create a NetServer object for a specific system.
    -* AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -* ISeriesNetServer ns = new ISeriesNetServer(system);
    -*
    -* try
    -* {
    -*
    -*   // Get the name of the NetServer.
    -*   System.out.println("Name: " + ns.getName());
    -*
    -*   // Get the CCSID of the NetServer.
    -*   System.out.println("CCSID: " + ns.getCCSID());
    -*
    -*   // Get the "allow system name" value of the NetServer.
    -*   System.out.println("'Allow system name': " +  ns.isAllowSystemName());
    -*
    -*   // Set the description of the NetServer.
    -*   // Note: Changes will take effect after next start of NetServer.
    -*   ns.setDescription("The NetServer");
    -*   ns.commitChanges();
    -*
    -*   // Set the CCSID of the NetServer to 13488.
    -*   ns.setCCSID(13488);
    -*
    -*   // Set the "allow system name" value of the NetServer to true.
    -*   ns.setAllowSystemName(true);
    -*
    -*   // Commit the attribute changes (send them to the system).
    -*   ns.commitChanges();
    -*
    -* }
    -* catch (AS400Exception e) {
    -*   AS400Message[] messageList = e.getAS400MessageList();
    -*   for (int i=0; i<messageList.length; i++) {
    -*     System.out.println(messageList[i].getText());
    -*   }
    -* }
    -* catch (Exception e) {
    -*   e.printStackTrace();
    -* }
    -* finally {
    -*   if (system != null) system.disconnectAllServices();
    -* }
    -
    -
    - -@see com.ibm.as400.access.ISeriesNetServerFileShare -@see com.ibm.as400.access.ISeriesNetServerPrintShare -@see com.ibm.as400.access.ISeriesNetServerConnection -@see com.ibm.as400.access.ISeriesNetServerSession -**/ - -public class ISeriesNetServer -implements Serializable -{ - static final long serialVersionUID = 1L; - - /** - Value of the NetServer "authentication method" attribute, indicating that the system authenticates with encrypted passwords only. - **/ - public final static int ENCRYPTED_PASSWORDS = 0; - - /** - Value of the NetServer "authentication method" attribute, indicating that the system authenticates with Network authentication only. - **/ - public final static int NETWORK_AUTHENTICATION = 1; - - /** - Value of the NetServer "authentication method" attribute, indicating that the system authenticates with Network authentication only. - @deprecated Renamed to NETWORK_AUTHENTICATION - **/ - public final static int KERBEROS_V5_TOKENS = NETWORK_AUTHENTICATION; - - /** - Value of the NetServer "authentication method" attribute, indicating that the system authenticates with Network authentication when possible, but it allows clients to use encrypted passwords when needed. -
    Note: This value is valid only for IBM i release V5R3 and higher. - **/ - public final static int NETWORK_AUTHENTICATION_OR_PASSWORDS = 2; - - /** - Value of the NetServer "authentication method" attribute, indicating that the system authenticates with Network authentication when possible, but it allows clients to use encrypted passwords when needed. -
    Note: This value is valid only for IBM i release V5R3 and higher. - @deprecated Renamed to NETWORK_AUTHENTICATION_OR_PASSWORDS - **/ - public final static int KERBEROS_OR_PASSWORDS = NETWORK_AUTHENTICATION_OR_PASSWORDS; - - /** - Value of the "idle timeout" attribute, indicating "no autodisconnect". - **/ - public final static int NO_AUTO_DISCONNECT = -1; - - /** - Value of the "opportunistic lock timeout" attribute, indicating that opportunistic locking is disabled. - **/ - public final static int OPP_LOCK_DISABLED = -1; - - /** - Value of the "message authentication" attribute, indicating that the system does not support message authentication. - **/ - public final static int MSG_AUTH_NOT_SUPPORTED = 0; - - /** - Value of the "message authentication" attribute, indicating that the system supports message authentication, and message authentication is negotiated between the client and the system. - **/ - public final static int MSG_AUTH_NEGOTIATED = 1; - - /** - Value of the "message authentication" attribute, indicating that the system requires message authentication for all connections. - **/ - public final static int MSG_AUTH_REQUIRED = 2; - - /** - Value of the "minimum message severity" attribute, indicating that administrative alert messages are not sent. - **/ - public final static int NO_ADMIN_ALERTS = -1; - - /** - Value of the "LAN Manager authentication" attribute, indicating that the LANMAN password hash is ignored if a stronger password hash is provided by the client. - **/ - public final static int PASSWORD_STRONGER = 0; - - /** - Value of the "LAN Manager authentication" attribute, indicating that the LANMAN password hash is used only if a stronger password hash provided by the client does not match, or if a stronger password hash is not provided. - **/ - public final static int PASSWORD_STRONGER_OR_MISMATCH = 1; - - - - // Constants for identifying a share's "device type". - private final static int BOTH = 2; - private final static int FILE = 0; - private final static int PRINT = 1; - - private AS400 system_; - private int systemVRM_; - private boolean gotSystemVRM_; - - - // Constants for identifying attributes that are specified as strings in the API's. - - private final static int ALLOW_SYSTEM_NAME = 0; // CHAR(1) - private final static int AUTHENTICATION_METHOD = 1; // CHAR(1) - private final static int AUTOSTART = 2; // CHAR(4) - private final static int DESCRIPTION = 3; // CHAR(50) a.k.a. "text description" - private final static int DOMAIN_NAME = 4; // CHAR(15) - private final static int GUEST_USER_PROFILE = 5; // CHAR(10) - private final static int SERVER_NAME = 6; // CHAR(15) - private final static int WINS_PRIMARY_ADDRESS = 7; // CHAR(15) - private final static int WINS_SCOPE_ID = 8; // CHAR(224) a.k.a. "scope ID" - private final static int WINS_SECONDARY_ADDRESS = 9; // CHAR(15) - - // Constants for identifying attributes that are specified as integers in the API's. - - private final static int BROWSING_INTERVAL = 20; // BINARY(4) - private final static int CCSID = 21; // BINARY(4) - private final static int IDLE_TIMEOUT = 22; // BINARY(4) - private final static int LOGON_SUPPORT = 23; // BINARY(4) a.k.a. "server role" - private final static int OPP_LOCK_TIMEOUT = 24; // BINARY(4) Not surfaced to user. - private final static int WINS_ENABLEMENT = 25; // BINARY(4) or CHAR(1), a.k.a. "WINS proxy" - // Note: In the getter (QZLSOLST API), the "WINS enablement" field is BINARY(4). - // In the setter (QZLSCHSI API), the "WINS proxy" field is CHAR(1). - - private final static int MESSAGE_AUTHENTICATION = 26; // BINARY(4) V5R4+ - private final static int MIN_MESSAGE_SEVERITY = 27; // BINARY(4) V5R4+ - private final static int LAN_MGR_AUTHENTICATION = 28; // BINARY(4) V5R4+ - - private final static int MAX_ATTR = 28; // Increment this as new attr's are added. - - private final static int ZLSL0101_MAX_RECORD_LENGTH = 1221; // Max path length is 1024 bytes. - - // Tables of "in effect" and "pending" attribute values. - - private String[] effectiveValueStr_ = new String[MAX_ATTR+1]; // in-effect String attr values - private String[] pendingValueStr_ = new String[MAX_ATTR+1]; // pending String attr values - private int[] effectiveValueInt_ = new int[MAX_ATTR+1]; // in-effect Integer attr values - private int[] pendingValueInt_ = new int[MAX_ATTR+1]; // pending Integer attr values - // Implementation note: We only partially populate the above arrays, to simplify tracking of changes. - // That is, in the *ValueStr_ arrays, only offsets 0-9 are occupied, - // and in the *ValueInt_ arrays, only offsets 20-28 are occupied. - - - private boolean[] userChangedAttribute_ = new boolean[MAX_ATTR+1]; // which attrs the user has changed - private boolean[] userCommittedChange_ = new boolean[MAX_ATTR+1]; // which attrs the user has committed - - // Have we done a refresh() since the last start(). - private transient boolean refreshedSinceStart_ = false; - - // Have we done a setAutoStart() since the last refresh(). - // Note that the autostart attribute is unique in that changes take effect upon commitChanges(). - private boolean changedAutoStartSinceRefresh_ = false; - - // These flags track whether the user has *IOSYSCFG special authority. - private transient boolean determinedSpecialAuthority_ = false; - private transient boolean userHasSpecialAuthority_ = false; - - private static final boolean DEBUG = false; - - - // Note: If required, we'll make this class into a Bean later. - // Until then, we don't provide a zero-argument "default" constructor. - // That way we can enforce that system_ is never null. - - - /** - Constructs a NetServer object. - @param system The system with which the NetServer is associated. - **/ - public ISeriesNetServer(AS400 system) - { - if (system == null) { throw new NullPointerException(); } - - system_ = system; - } - - - /** - Creates a file share. - @param shareName The name of the share. - @param path The path of the share. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void createFileShare(String shareName, String path) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - createFileShare(shareName, path, "", ISeriesNetServerFileShare.READ_ONLY, ISeriesNetServerFileShare.NO_MAX); - } - - - /** - Creates a file share. - @param shareName The name of the share. - @param path The path of the share. - @param desc The description of the share. - @param permission The permission of the share. - Valid values are: -
      -
    • {@link com.ibm.as400.access.ISeriesNetServerFileShare#READ_ONLY ISeriesNetServerFileShare.READ_ONLY} -
    • {@link com.ibm.as400.access.ISeriesNetServerFileShare#READ_WRITE ISeriesNetServerFileShare.READ_WRITE} -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void createFileShare(String shareName, String path, String desc, int permission) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - createFileShare(shareName, path, desc, permission, ISeriesNetServerFileShare.NO_MAX); - } - - - /** - Creates a file share. - @param shareName The name of the share. - @param path The path of the share. - @param desc The description of the share. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void createFileShare(String shareName, String path, String desc) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - createFileShare(shareName, path, desc, ISeriesNetServerFileShare.READ_ONLY, ISeriesNetServerFileShare.NO_MAX); - } - - - /** - Creates a file share. - @param shareName The name of the share. - @param path The path of the share. - @param desc The description of the share. - @param permission The permission of the share. - Valid values are: -
      -
    • {@link com.ibm.as400.access.ISeriesNetServerFileShare#READ_ONLY ISeriesNetServerFileShare.READ_ONLY} -
    • {@link com.ibm.as400.access.ISeriesNetServerFileShare#READ_WRITE ISeriesNetServerFileShare.READ_WRITE} -
    - The default is READ_ONLY. - @param maxUsers The maximum number of users of the share. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void createFileShare(String shareName, String path, String desc, int permission, int maxUsers) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (shareName == null) { throw new NullPointerException("shareName"); } - if (path == null) { throw new NullPointerException("path"); } - if (desc == null) { desc = ""; } - - final int ccsid = system_.getCcsid(); - final AS400Text text12 = new AS400Text(12, ccsid); - final AS400Text text50 = new AS400Text(50, ccsid); - - byte[] pathBytes = path.trim().getBytes("UnicodeBigUnmarked"); - ProgramParameter[] parms = new ProgramParameter[8]; - - parms[0] = new ProgramParameter(text12.toBytes(shareName.trim())); - parms[1] = new ProgramParameter(pathBytes); - parms[2] = new ProgramParameter(BinaryConverter.intToByteArray(pathBytes.length)); - parms[3] = new ProgramParameter(BinaryConverter.intToByteArray(13488)); - parms[4] = new ProgramParameter(text50.toBytes(desc)); - parms[5] = new ProgramParameter(BinaryConverter.intToByteArray(permission)); - parms[6] = new ProgramParameter(BinaryConverter.intToByteArray(maxUsers)); - parms[7] = new ErrorCodeParameter(); - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSADFS.PGM", parms); - - if (!pc.run()) { - throw new AS400Exception(pc.getMessageList()); - } - } - - /** - Creates a print share. - The spooled file type is set to {@link com.ibm.as400.access.ISeriesNetServerPrintShare#AUTO_DETECT ISeriesNetServerPrintShare.AUTO_DETECT}. - @param shareName The name of the share. - @param outqLib The library that contains the output queue for the share. - @param outqName The name of the output queue for the share. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void createPrintShare(String shareName, String outqLib, String outqName) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - createPrintShare(shareName, outqLib, outqName, "", ISeriesNetServerPrintShare.AUTO_DETECT, null, null, null, false); - } - - - /** - Creates a print share. - @param shareName The name of the share. - @param outqLib The library that contains the output queue for the share. - @param outqName The name of the output queue for the share. - @param desc The description of the share. - @param splfType The type of spooled files that are created using this share. - Valid values are: -
      -
    • {@link com.ibm.as400.access.ISeriesNetServerPrintShare#AFP ISeriesNetServerPrintShare.AFP} -
    • {@link com.ibm.as400.access.ISeriesNetServerPrintShare#AUTO_DETECT ISeriesNetServerPrintShare.AUTO_DETECT} -
    • {@link com.ibm.as400.access.ISeriesNetServerPrintShare#SCS ISeriesNetServerPrintShare.SCS} -
    • {@link com.ibm.as400.access.ISeriesNetServerPrintShare#USER_ASCII ISeriesNetServerPrintShare.USER_ASCII} -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void createPrintShare(String shareName, String outqLib, String outqName, String desc, int splfType) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - createPrintShare(shareName, outqLib, outqName, desc, splfType, null, null, null, false); - } - - - /** - Creates a print share. - @param shareName The name of the share. - @param outqLib The library that contains the output queue for the share. - @param outqName The name of the output queue for the share. - @param desc The description of the share. - @param splfType The type of spooled files that are created using this share. - Valid values are: -
      -
    • {@link com.ibm.as400.access.ISeriesNetServerPrintShare#AFP ISeriesNetServerPrintShare.AFP} -
    • {@link com.ibm.as400.access.ISeriesNetServerPrintShare#AUTO_DETECT ISeriesNetServerPrintShare.AUTO_DETECT} -
    • {@link com.ibm.as400.access.ISeriesNetServerPrintShare#SCS ISeriesNetServerPrintShare.SCS} -
    • {@link com.ibm.as400.access.ISeriesNetServerPrintShare#USER_ASCII ISeriesNetServerPrintShare.USER_ASCII} -
    - @param prtDriver The print driver that is appropriate for this share. - @param prtFileLib The library that contains the printer file. - @param prtFileName The name of the printer file. This is a template containing attributes used to create spooled files. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void createPrintShare(String shareName, String outqLib, String outqName, String desc, int splfType, String prtDriver, String prtFileLib, String prtFileName) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - createPrintShare(shareName, outqLib, outqName, desc, splfType, prtDriver, prtFileLib, prtFileName, false); - } - - - /** - Creates a print share. - @param shareName The name of the share. - @param outqLib The library that contains the output queue for the share. - @param outqName The name of the output queue for the share. - @param desc The description of the share. - @param splfType The type of spooled files that are created using this share. - Valid values are: -
      -
    • {@link com.ibm.as400.access.ISeriesNetServerPrintShare#AFP ISeriesNetServerPrintShare.AFP} -
    • {@link com.ibm.as400.access.ISeriesNetServerPrintShare#AUTO_DETECT ISeriesNetServerPrintShare.AUTO_DETECT} -
    • {@link com.ibm.as400.access.ISeriesNetServerPrintShare#SCS ISeriesNetServerPrintShare.SCS} -
    • {@link com.ibm.as400.access.ISeriesNetServerPrintShare#USER_ASCII ISeriesNetServerPrintShare.USER_ASCII} -
    - @param prtDriver The print driver that is appropriate for this share. - @param prtFileLib The library that contains the printer file. - @param prtFileName The name of the printer file. This is a template containing attributes used to create spooled files. - @param publish Whether to publish this print share. Default is false. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void createPrintShare(String shareName, String outqLib, String outqName, String desc, int splfType, String prtDriver, String prtFileLib, String prtFileName, boolean publish) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (shareName == null) { throw new NullPointerException("shareName"); } - if (outqLib == null) { throw new NullPointerException("outqLib"); } - if (outqName == null) { throw new NullPointerException("outqName"); } - if (desc == null) { - desc = ""; - } - if (splfType < ISeriesNetServerPrintShare.USER_ASCII || - splfType > ISeriesNetServerPrintShare.AUTO_DETECT) { - throw new ExtendedIllegalArgumentException(Integer.toString(splfType), ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (prtDriver == null) { - prtDriver = ""; - } - if (prtFileLib == null) { - prtFileLib = ""; - } - if (prtFileName == null) { - prtFileName = ""; - } - - final int ccsid = system_.getCcsid(); - final AS400Text text12 = new AS400Text(12, ccsid); - final AS400Text text10 = new AS400Text(10, ccsid); - final AS400Text text50 = new AS400Text(50, ccsid); - - byte[] outqBytes = new byte[20]; - byte[] prtFileBytes = new byte[20]; - byte[] pubBytes = new byte[1]; - - text10.toBytes(outqLib, outqBytes, 10); - text10.toBytes(outqName, outqBytes, 0); - text10.toBytes(prtFileLib, prtFileBytes, 10); - text10.toBytes(prtFileName, prtFileBytes, 0); - if (publish) { - pubBytes[0] = (byte)0xF1; - } - else { - pubBytes[0] = (byte)0xF0; - } - - ProgramParameter[] parms = new ProgramParameter[8]; - - parms[0] = new ProgramParameter(text12.toBytes(shareName.trim())); - parms[1] = new ProgramParameter(outqBytes); - parms[2] = new ProgramParameter(text50.toBytes(desc)); - parms[3] = new ProgramParameter(BinaryConverter.intToByteArray(splfType)); - parms[4] = new ProgramParameter(text50.toBytes(prtDriver)); - parms[5] = new ErrorCodeParameter(); - parms[6] = new ProgramParameter(prtFileBytes); - parms[7] = new ProgramParameter(pubBytes); - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSADPS.PGM", parms); - - if (!pc.run()) { - throw new AS400Exception(pc.getMessageList()); - } - } - - - /** - Returns the system. - @return The system. - **/ - public AS400 getSystem() - { - return system_; - } - - - /** - Returns the system VRM. - @return The system VRM. - **/ - private final int getSystemVRM() - throws AS400SecurityException, IOException - { - if (!gotSystemVRM_) { systemVRM_ = system_.getVRM(); gotSystemVRM_ = true; } - return systemVRM_; - } - - - /** - Lists all file shares. - @return The file shares. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public ISeriesNetServerFileShare[] listFileShares() - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return (ISeriesNetServerFileShare[])listShares(FILE, null); - } - - - /** - Lists the file shares. - @param shareName The name of the share to list. - @return The file shares. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public ISeriesNetServerFileShare[] listFileShares(String shareName) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (shareName == null) { throw new NullPointerException(); } - - return (ISeriesNetServerFileShare[])listShares(FILE, shareName); - } - - - /** - Lists all print shares. - @return The print shares. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public ISeriesNetServerPrintShare[] listPrintShares() - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return (ISeriesNetServerPrintShare[])listShares(PRINT, null); - } - - - /** - Lists the print shares. - @param shareName The name of the share to list. - @return The print shares. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public ISeriesNetServerPrintShare[] listPrintShares(String shareName) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (shareName == null) { throw new NullPointerException(); } - - return (ISeriesNetServerPrintShare[])listShares(PRINT, shareName); - } - - - /** - Lists the shares (both file shares and print shares). - @return The shares. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public ISeriesNetServerShare[] listShares() - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return (ISeriesNetServerShare[])listShares(BOTH, "*ALL"); - } - - // 3 options for "desired type": FILE, PRINT, and BOTH. - private Object listShares(int desiredType, String shareName) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (shareName == null) { shareName = "*ALL"; } - - final int ccsid = system_.getCcsid(); - final CharConverter conv = new CharConverter(ccsid); - final AS400Text text15 = new AS400Text(15, ccsid); - - int len = 8192; - ProgramParameter[] parms = new ProgramParameter[6]; - - parms[0] = new ProgramParameter(len); // receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(len));// length of receiver variable - parms[2] = new ProgramParameter(64); // list information - parms[3] = new ProgramParameter(conv.stringToByteArray("ZLSL0101")); - parms[4] = new ProgramParameter(text15.toBytes(shareName.trim())); - parms[5] = new ErrorCodeParameter(); - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSOLST.PGM", parms); - - int numRecords = callListProgram(pc, parms, len); - - byte[] data = parms[0].getOutputData(); - - return parseZLSL0101(data, conv, numRecords, desiredType, null); - } - - - /** - Calls a NetServer listing API. The API is expected to return a list of records. This method checks for overrun of the receiverVariable, and re-invokes the API, specifying a larger receiverVariable, if an overrun is detected. - - @return Number of records listed. - **/ - private static int callListProgram(ProgramCall pc, ProgramParameter[] parms, int totalBytesExpected) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!pc.run()) { - throw new AS400Exception(pc.getMessageList()); - } - - // See if we overflowed the receiver variable; if so, re-issue the API. - // Examine the "information complete indicator" field in the "list information" output parm. - byte[] listInfo = parms[2].getOutputData(); - int totalRecordsAvail = BinaryConverter.byteArrayToInt(listInfo, 0); - int numRecordsReturned = BinaryConverter.byteArrayToInt(listInfo, 4); - if (Trace.isTraceOn() && numRecordsReturned < totalRecordsAvail) { - Trace.log(Trace.DIAGNOSTIC, "Returned info is incomplete on first API call."); - } - - while (numRecordsReturned < totalRecordsAvail) - { - // Bump up the "length of receiver variable" value, to accommodate more returned data. - int recLength = BinaryConverter.byteArrayToInt(listInfo, 8); - if (recLength > 0) { - totalBytesExpected += recLength * totalRecordsAvail; - } - else { - totalBytesExpected *= 1 + (totalRecordsAvail / numRecordsReturned); - } - if (DEBUG) { - System.out.println("DEBUG ISeriesNetServer.callListProgram("+pc.getProgram()+"): totalRecordsAvail/numRecordsReturned/recLength/totalBytesExpected == " + totalRecordsAvail+"/"+numRecordsReturned+"/"+recLength+"/"+totalBytesExpected); - } - try - { - parms[0].setOutputDataLength(totalBytesExpected); - parms[1].setInputData(BinaryConverter.intToByteArray(totalBytesExpected)); - } - catch (PropertyVetoException e) {Trace.log(Trace.ERROR, e);} // this will never happen - - // Call the program again. - if (!pc.run()) { - throw new AS400Exception(pc.getMessageList()); - } - listInfo = parms[2].getOutputData(); - totalRecordsAvail = BinaryConverter.byteArrayToInt(listInfo, 0); - numRecordsReturned = BinaryConverter.byteArrayToInt(listInfo, 4); - } - return numRecordsReturned; - } - - - /** - Lists all NetServer sessions. - @return The current sessions. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public ISeriesNetServerSession[] listSessions() - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return listSessionsForWorkstation("*ALL"); - } - - - /** - Lists all NetServer sessions for the specified workstation. - @param name The name of the workstation. - @return The current sessions for the workstation. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public ISeriesNetServerSession[] listSessionsForWorkstation(String name) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - final int ccsid = system_.getCcsid(); - final CharConverter conv = new CharConverter(ccsid); - final AS400Text text15 = new AS400Text(15, ccsid); - - - int vrm = getSystemVRM(); // @IPv6 - int recordLength = (vrm < 0x00060100) ? 64 : 192; // @IPv6 - int len = 20*recordLength; // Expect about 20 records, each one 64 bytes in length if V5R4 or earlier, else 192 bytes in length. @IPv6C - - ProgramParameter[] parms = new ProgramParameter[(vrm < 0x00060100) ? 6 : 8]; // @IPv6 two addional possible parameters for expanded workstation name info - - parms[0] = new ProgramParameter(len); // receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(len));// length of receiver variable - parms[2] = new ProgramParameter(64); // list information - parms[3] = new ProgramParameter(conv.stringToByteArray("ZLSL0300")); - if(vrm < 0x00060100) // @IPv6 - parms[4] = new ProgramParameter(text15.toBytes(name)); // information qualifier - else // @IPv6 - { // @IPv6 - AS400Text text10 = new AS400Text(10, ccsid); // @IPv6 Session User - AS400Text text50 = new AS400Text(50, ccsid); // @IPv6 Expanded Information Qualifier - parms[4] = new ProgramParameter(text15.toBytes("*EXPANDED")); // @IPv6 - parms[6] = new ProgramParameter(text10.toBytes("*ALL")); // @IPv6 - parms[7] = new ProgramParameter(text50.toBytes(name)); // @IPv6 - } // @IPv6 - parms[5] = new ErrorCodeParameter(); - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSOLST.PGM", parms); - int numRecords = callListProgram(pc, parms, len); - - byte[] data = parms[0].getOutputData(); - ISeriesNetServerSession[] sessions = new ISeriesNetServerSession[numRecords]; - int offset = 0; - - for (int i = 0; i < numRecords; ++i) - { - ISeriesNetServerSession sess = parseZLSL0300(data, offset, conv, null); - sessions[i] = sess; - if(getSystemVRM() < 0x00060100) // @IPv6 - offset += 64; // increment by length of a ZLSL0300 entry - else // @IPv6 increment by length of a ZLSL0300 entry, - offset += 192; // @IPv6 Binary(4) for expanded workstation type and a Char(124) for expanded workstation name - } - return sessions; - } - - - /** - Lists all connections for the specified NetServer session. - @param sessionID The session ID. - Note: The "session identifier" was added to the NetServer API's in V5R1. - @return The current connections for the specified session. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public ISeriesNetServerConnection[] listConnectionsForSession(long sessionID) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - final int ccsid = system_.getCcsid(); - final CharConverter conv = new CharConverter(ccsid); - final AS400Text text10 = new AS400Text(10, ccsid); - final AS400Text text15 = new AS400Text(15, ccsid); - - int len = 20*64; // Expect about 20 records, each one 64 bytes in length. - - ProgramParameter[] parms = new ProgramParameter[8]; - - parms[0] = new ProgramParameter(len); // receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(len));// length of receiver variable - parms[2] = new ProgramParameter(64); // list information - parms[3] = new ProgramParameter(conv.stringToByteArray("ZLSL0600")); - parms[4] = new ProgramParameter(text15.toBytes("*SESSID")); // information qualifier - parms[5] = new ErrorCodeParameter(); - parms[6] = new ProgramParameter(text10.toBytes("*SESSID")); // session user - parms[7] = new ProgramParameter(BinaryConverter.longToByteArray(sessionID)); // session identifier - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSOLST.PGM", parms); - int numRecords = callListProgram(pc, parms, len); - - ISeriesNetServerConnection[] connections = new ISeriesNetServerConnection[numRecords]; - int offset = 0; - byte[] data = parms[0].getOutputData(); - for (int i = 0; i < numRecords; ++i) - { - ISeriesNetServerConnection conn = parseZLSL0600or0700(data, offset, conv, true, null); - connections[i] = conn; - offset += 64; // increment by length of a ZLSL0600 entry - } - return connections; - } - - - /** - Lists all connections for the specified NetServer workstation. - @param workstationName The name of the workstation. - @return The current connections for the specified session. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public ISeriesNetServerConnection[] listConnectionsForSession(String workstationName) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (workstationName == null) { throw new NullPointerException(); } - - final int ccsid = system_.getCcsid(); - final CharConverter conv = new CharConverter(ccsid); - final AS400Text text15 = new AS400Text(15, ccsid); - - int len = 20*64; // Expect about 20 records, each one 64 bytes in length. - - int vrm = getSystemVRM(); // @IPv6 - ProgramParameter[] parms = new ProgramParameter[(vrm < 0x00060100) ? 6 : 8]; // @IPv6 two additional parameters for expanded workstation name - - parms[0] = new ProgramParameter(len); // receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(len));// length of receiver variable - parms[2] = new ProgramParameter(64); // list information - parms[3] = new ProgramParameter(conv.stringToByteArray("ZLSL0600")); - if(vrm < 0x00060100) // @IPv6 - parms[4] = new ProgramParameter(text15.toBytes(workstationName)); // information qualifier - else // @IPv6 - { // @IPv6 - AS400Text text50 = new AS400Text(50, ccsid); // @IPv6 for Expanded Information Qualifier - AS400Text text10 = new AS400Text(10, ccsid); // @IPv6 for Session User - parms[4] = new ProgramParameter(text15.toBytes("*EXPANDED")); // @IPv6 - parms[6] = new ProgramParameter(text10.toBytes("*ALL")); // @IPv6 - parms[7] = new ProgramParameter(text50.toBytes(workstationName)); // @IPv6 - } // @IPv6 - parms[5] = new ErrorCodeParameter(); - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSOLST.PGM", parms); - int numRecords = callListProgram(pc, parms, len); - - ISeriesNetServerConnection[] connections = new ISeriesNetServerConnection[numRecords]; - int offset = 0; - byte[] data = parms[0].getOutputData(); - for (int i = 0; i < numRecords; ++i) - { - ISeriesNetServerConnection conn = parseZLSL0600or0700(data, offset, conv, true, null); - connections[i] = conn; - offset += 64; // increment by length of a ZLSL0600 entry - } - return connections; - } - - - /** - Parses one or more ZLSL0101 structures. - This is the "share information" returned by the QZLSOLST API. - **/ - // Note: If oldShare is non-null, then this method ignores numRecords. - // In that case, this method simply updates the attributes of the specified Share, - // and returns null. - private static ISeriesNetServerShare[] parseZLSL0101(byte[] data, CharConverter conv, int numRecords, int desiredType, ISeriesNetServerShare oldShare) - { - ISeriesNetServerFileShare[] fileShares = (desiredType == FILE ? new ISeriesNetServerFileShare[numRecords] : null); - ISeriesNetServerPrintShare[] printShares = (desiredType == PRINT ? new ISeriesNetServerPrintShare[numRecords] : null); - ISeriesNetServerShare[] allShares = (desiredType == BOTH ? new ISeriesNetServerShare[numRecords] : null); - - int counter = 0; // index into whichever Share array we are building - int offsetInData = 0; // offset into the data buffer - - for (int recordNum=0; recordNum 20) - System.out.println("DEBUG ISeriesNetServer.parseZLSL0101: Questionable extension length: " + extensionLength); - } - extensions[extNum] = conv.byteArrayToString(data, offsetToTableEntry + 4, extensionLength).trim(); - offsetToTableEntry += 50; // Each table entry is exactly 50 bytes long. - } - - if (oldShare == null) { // The caller wants a new object created. - ISeriesNetServerFileShare share = - new ISeriesNetServerFileShare(shareName, permissions, maxUsers, - currentUsers, description, pathName, - ccsidForTextConv, enableTextConv, - extensions); - if (desiredType == FILE) fileShares[counter++] = share; - else allShares[counter++] = share; - } - else { // The caller specified an existing Share object. Just update it. - ((ISeriesNetServerFileShare)oldShare).setAttributeValues(shareName, - permissions, - maxUsers, - currentUsers, - description, - pathName, - ccsidForTextConv, - enableTextConv, - extensions); - return null; // Don't bother creating an array to return. - } - } - } - else // It's a print share. - { - if (desiredType == PRINT || desiredType == BOTH) // Do we care about it - { - String shareName = conv.byteArrayToString(data, offsetInData + 4, 12).trim(); - String description = conv.byteArrayToString(data, offsetInData + 114, 50).trim(); - int spooledFileType = BinaryConverter.byteArrayToInt(data, offsetInData + 32); - - String outQueue = conv.byteArrayToString(data, offsetInData + 44, 20); // don't trim - - String printDriverType = conv.byteArrayToString(data, offsetInData + 64, 50).trim(); - - // New fields added in ZLSL0101: - String printerFile = conv.byteArrayToString(data, offsetInData + 164, 20); // don't trim - String publish = conv.byteArrayToString(data, offsetInData + 197, 1).trim(); - boolean isPublished = (publish.equals("1") ? true : false); - - if (oldShare == null) { // The caller wants a new object created. - ISeriesNetServerPrintShare share = - new ISeriesNetServerPrintShare(shareName, spooledFileType, - outQueue, printDriverType, description, - printerFile, isPublished); - if (desiredType == PRINT) printShares[counter++] = share; - else allShares[counter++] = share; - } - else { // The caller specified an existing Share object. Just update it. - ((ISeriesNetServerPrintShare)oldShare).setAttributeValues(shareName, - spooledFileType, - outQueue, - printDriverType, - description, - printerFile, - isPublished); - return null; // Don't bother creating an array to return. - } - } - } - offsetInData += entryLength; - } - - if (desiredType == BOTH) - { - return allShares; - } - - // If we didn't fill our array, truncate it to length. - - Object source = (desiredType == FILE ? (Object)fileShares : (Object)printShares); - if (counter < numRecords) - { - Object temp = (desiredType == FILE ? (Object)(new ISeriesNetServerFileShare[counter]) : - (Object)(new ISeriesNetServerPrintShare[counter])); - - System.arraycopy(source, 0, temp, 0, counter); - return (ISeriesNetServerShare[])temp; - } - else return (ISeriesNetServerShare[])source; - } - - - /** - * Parses a single ZLSL0300 structure. - * This is the "session information" returned by the QZLSOLST API. - * @throws IOException - * @throws AS400SecurityException - **/ - private ISeriesNetServerSession parseZLSL0300(byte[] data, int offset, CharConverter conv, ISeriesNetServerSession sess) throws AS400SecurityException, IOException // @IPv6 added throws declaration, removed static qualifier - { - String workstationName = (getSystemVRM() < 0x00060100) ? conv.byteArrayToString(data,offset+0,15).trim() : conv.byteArrayToString(data, offset+68, 124).trim(); // @IPv6 - String userProfileName = conv.byteArrayToString(data,offset+15,10).trim(); - int numberOfConnections = BinaryConverter.byteArrayToInt(data, offset+28); - int numberOfFilesOpen = BinaryConverter.byteArrayToInt(data, offset+32); - //int numberOfSessions = BinaryConverter.byteArrayToInt(data, offset+36); - int sessionTime = BinaryConverter.byteArrayToInt(data, offset+40); - int sessionIdleTime = BinaryConverter.byteArrayToInt(data, offset+44); - String logonType = conv.byteArrayToString(data,offset+48,1).trim(); - String encryptedPassword = conv.byteArrayToString(data,offset+49,1).trim(); - long sessionID = BinaryConverter.byteArrayToLong(data, offset+56); - - boolean isPasswordEncrypted = (encryptedPassword.equals("1") ? true : false); - boolean isGuest = (logonType.equals("0") ? true : false); - - if (sess == null) { - sess = new ISeriesNetServerSession(workstationName, - sessionID, numberOfConnections, - sessionTime, numberOfFilesOpen, - sessionIdleTime, - isPasswordEncrypted, - isGuest, userProfileName); - } - else { - sess.setAttributeValues(workstationName, - sessionID, numberOfConnections, - sessionTime, numberOfFilesOpen, - sessionIdleTime, - isPasswordEncrypted, - isGuest, userProfileName); - } - return sess; - } - - - /** - Parses a single ZLSL0600 or ZLSL0700 structure. - This is the "session connection information" and "share connection information" returned by the QZLSOLST API. - **/ - private ISeriesNetServerConnection parseZLSL0600or0700(byte[] data, int offset, CharConverter conv, boolean is0600, ISeriesNetServerConnection conn) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - int connectionID = BinaryConverter.byteArrayToInt(data, offset+0); - int connectionType = BinaryConverter.byteArrayToInt(data, offset+4); - int numberOfFilesOpen = BinaryConverter.byteArrayToInt(data, offset+8); - int numberOfConnectionUsers = BinaryConverter.byteArrayToInt(data, offset+12); - int connectionTime = BinaryConverter.byteArrayToInt(data, offset+16); - String userName = conv.byteArrayToString(data,offset+20,10).trim(); - String resourceName; - int resourceType; - if (is0600) { - resourceName = conv.byteArrayToString(data,offset+30,12).trim(); // share name - resourceType = ISeriesNetServerConnection.SHARE; - } - else { - resourceName = (getSystemVRM() < 0x00060100) ? conv.byteArrayToString(data,offset+30,15).trim() : conv.byteArrayToString(data, offset+68, 124).trim(); // workstation name @IPv6 - resourceType = ISeriesNetServerConnection.WORKSTATION; - } - - long sessionID; - if (getSystemVRM() >= 0x00050100) { // new field added to API in V5R1 - sessionID = BinaryConverter.byteArrayToLong(data, offset+48); - } - else sessionID = 0L; - - if (conn == null) { - conn = new ISeriesNetServerConnection(connectionID, - connectionTime, numberOfFilesOpen, connectionType, resourceName, resourceType, userName, numberOfConnectionUsers, sessionID); - } - else { - conn.setAttributeValues(connectionID, - connectionTime, numberOfFilesOpen, connectionType, resourceName, resourceType, userName, numberOfConnectionUsers, sessionID); - } - return conn; - } - - - /** - Returns the connections associated with a specific share. - @param shareName The name of the share. - @return The connections for the specified share. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public ISeriesNetServerConnection[] listConnectionsForShare(String shareName) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (shareName == null) { throw new NullPointerException(); } - - final int ccsid = system_.getCcsid(); - final CharConverter conv = new CharConverter(ccsid); - final AS400Text text15 = new AS400Text(15, ccsid); - - - int recordLength = (getSystemVRM() < 0x00060100) ? 64 : 192; // @IPv6 - int len = 20*recordLength; // Expect about 20 records, each one 64 bytes in length if V5R4 and earlier, else 192 bytes - - ProgramParameter[] parms = new ProgramParameter[6]; - - parms[0] = new ProgramParameter(len); // receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(len));// length of receiver variable - parms[2] = new ProgramParameter(64); // list information - parms[3] = new ProgramParameter(conv.stringToByteArray("ZLSL0700")); - parms[4] = new ProgramParameter(text15.toBytes(shareName)); // information qualifier - parms[5] = new ErrorCodeParameter(); - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSOLST.PGM", parms); - int numRecords = callListProgram(pc, parms, len); - - ISeriesNetServerConnection[] connections = new ISeriesNetServerConnection[numRecords]; - int offset = 0; - byte[] data = parms[0].getOutputData(); - for (int i = 0; i < numRecords; ++i) - { - ISeriesNetServerConnection conn = parseZLSL0600or0700(data, offset, conv, false, null); - connections[i] = conn; - if(getSystemVRM() < 0x00060100) // @IPv6 - offset += 64; // increment by length of a ZLSL0700 entry - else // @IPv6 increment by length of ZLSL0700 entry - offset += 192; // @IPv6 additional Binary(4) for expanded workstation name type and a Char(45) for expanded workstation name - } - return connections; - } - - - /** - Removes the specified share. - @param shareName The name of the share. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void removeShare(String shareName) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (shareName == null) { throw new NullPointerException(); } - - final int ccsid = system_.getCcsid(); - final AS400Text text12 = new AS400Text(12, ccsid); - ProgramParameter[] parms = new ProgramParameter[2]; - - parms[0] = new ProgramParameter(text12.toBytes(shareName.trim())); - parms[1] = new ErrorCodeParameter(); - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSRMS.PGM", parms); - - if (!pc.run()) { - throw new AS400Exception(pc.getMessageList()); - } - - } - - /** - Returns the value of the "allow system name" attribute. - This attribute indicates whether access is allowed to the system using the system's TCP/IP system name. - @return The value of the "allow system name" attribute. - **/ - public boolean isAllowSystemName() - { - if (!refreshedSinceStart_) refreshWithoutException(); - if (DEBUG) System.out.println("ISeriesNetServer.isAllowSystemName(): effectiveValueStr_[ALLOW_SYSTEM_NAME] == |" + effectiveValueStr_[ALLOW_SYSTEM_NAME] + "|"); - return (effectiveValueStr_[ALLOW_SYSTEM_NAME].equals("1") ? true : false); - } - - /** - Returns the pending value of the "allow system name" attribute. - @return The pending value of the "allow system name" attribute. - @see #isAllowSystemName() - **/ - public boolean isAllowSystemNamePending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - if (DEBUG) System.out.println("ISeriesNetServer.getAllowSystemNamePending(): pendingValueStr_[ALLOW_SYSTEM_NAME] == |" + pendingValueStr_[ALLOW_SYSTEM_NAME] + "|"); - return (pendingValueStr_[ALLOW_SYSTEM_NAME].equals("1") ? true : false); - } - - /** - Sets the value of the "allow system name" attribute. - This attribute indicates whether access is allowed to the system using the system's TCP/IP system name. - @param value The value of the "allow system name" attribute. - **/ - public void setAllowSystemName(boolean value) - { - pendingValueStr_[ALLOW_SYSTEM_NAME] = (value==true ? "1" : "0"); - userChangedAttribute_[ALLOW_SYSTEM_NAME] = true; - userCommittedChange_[ALLOW_SYSTEM_NAME] = false; - } - - - /** - Returns the value of the "authentication method" attribute. - This attribute indicates the method used to authenticate users. - Note: This attribute is available only if the system is at release V5R2 or higher. - @return The value of the "authentication method" attribute. - Valid values are {@link #ENCRYPTED_PASSWORDS ENCRYPTED_PASSWORDS}, {@link #NETWORK_AUTHENTICATION NETWORK_AUTHENTICATION}, and {@link #NETWORK_AUTHENTICATION_OR_PASSWORDS NETWORK_AUTHENTICATION_OR_PASSWORDS}. - **/ - public int getAuthenticationMethod() - { - if (!refreshedSinceStart_) refreshWithoutException(); - if (DEBUG) { - System.out.println("DEBUG getAuthenticationMethod(): effectiveValueStr_[AUTHENTICATION_METHOD] == |" + effectiveValueStr_[AUTHENTICATION_METHOD] + "|"); - } - switch (effectiveValueStr_[AUTHENTICATION_METHOD].charAt(0)) { - case '0': return ENCRYPTED_PASSWORDS; - case '1': return NETWORK_AUTHENTICATION; - default: return NETWORK_AUTHENTICATION_OR_PASSWORDS; - } - } - - - /** - Returns the pending value of the "authentication method" attribute. - @return The pending value of the "authentication method" attribute. - @see #getAuthenticationMethod() - **/ - public int getAuthenticationMethodPending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - if (DEBUG) { - System.out.println("DEBUG getAuthenticationMethod(): pendingValueStr_[AUTHENTICATION_METHOD] == |" + pendingValueStr_[AUTHENTICATION_METHOD] + "|"); - } - switch (pendingValueStr_[AUTHENTICATION_METHOD].charAt(0)) { - case '0': return ENCRYPTED_PASSWORDS; - case '1': return NETWORK_AUTHENTICATION; - default: return NETWORK_AUTHENTICATION_OR_PASSWORDS; - } - } - - /** - Sets the value of the "authentication method" attribute. - This attribute indicates the authentication method used to authenticate users. - Note: This attribute is available only if the system is at release V5R2 or higher. - @param value The value of the "authentication method" attribute. - Valid values are {@link #ENCRYPTED_PASSWORDS ENCRYPTED_PASSWORDS}, {@link #NETWORK_AUTHENTICATION NETWORK_AUTHENTICATION}, and {@link #NETWORK_AUTHENTICATION_OR_PASSWORDS NETWORK_AUTHENTICATION_OR_PASSWORDS}. - **/ - public void setAuthenticationMethod(int value) - { - char[] charArray = new char[1]; - switch (value) { - case ENCRYPTED_PASSWORDS: charArray[0] = '0'; break; - case NETWORK_AUTHENTICATION: charArray[0] = '1'; break; - case NETWORK_AUTHENTICATION_OR_PASSWORDS: charArray[0] = '2'; break; - default: - throw new ExtendedIllegalArgumentException(Integer.toString(value), ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - pendingValueStr_[AUTHENTICATION_METHOD] = new String(charArray); - userChangedAttribute_[AUTHENTICATION_METHOD] = true; - userCommittedChange_[AUTHENTICATION_METHOD] = false; - } - - /** - Returns the value of the "autostart" attribute. - This attribute indicates whether or not the NetServer is to be started automatically when TCP is started. -
    Note: This method requires that the user have *IOSYSCFG authority on the system. If the user doesn't have that authority, this method throws AS400SecurityException. - @return The value of the "autostart" attribute. - @exception AS400SecurityException If a security or authority error occurs. - **/ - public boolean isAutoStart() - throws AS400SecurityException - { - if (!userHasSpecialAuthority()) { - Trace.log(Trace.ERROR, "*IOSYSCFG authority is required in order to query the AutoStart attribute."); - throw new AS400SecurityException(AS400SecurityException.SPECIAL_AUTHORITY_INSUFFICIENT); - } - if (!refreshedSinceStart_ || changedAutoStartSinceRefresh_) { - refreshWithoutException(); - } - return (effectiveValueStr_[AUTOSTART].equals("*YES") ? true : false); - } - - /** - Returns the pending value of the "autostart" attribute. - @return The pending value of the "autostart" attribute. - @exception AS400SecurityException If a security or authority error occurs. - @see #isAutoStart() - **/ - public boolean isAutoStartPending() - throws AS400SecurityException - { - if (!userHasSpecialAuthority()) { - Trace.log(Trace.ERROR, "*IOSYSCFG authority is required in order to query the AutoStart attribute."); - throw new AS400SecurityException(AS400SecurityException.SPECIAL_AUTHORITY_INSUFFICIENT); - } - if (!refreshedSinceStart_ || changedAutoStartSinceRefresh_) { - refreshWithoutException(); - } - return (pendingValueStr_[AUTOSTART].equals("*YES") ? true : false); - } - - /** - Sets the value of the "autostart" attribute. - This attribute indicates whether or not the NetServer is to be started automatically when TCP is started. - Note: This is the only NetServer attribute for which changes take effect immediately upon {@link #commitChanges() commitChanges}. That is, a NetServer restart is not necessary. - @param value The pending value of the "autostart" attribute. - **/ - public void setAutoStart(boolean value) - { - pendingValueStr_[AUTOSTART] = (value==true ? "*YES" : "*NO"); - userChangedAttribute_[AUTOSTART] = true; - userCommittedChange_[AUTOSTART] = false; - } - - - /** - Returns the value of the "browsing interval" attribute. - This attribute represents the amount of time, in milliseconds, between each system announcement that is used for browsing. A value of zero indicates that there will be no system announcements. - @return The value of the "browsing interval" attribute. - **/ - public int getBrowsingInterval() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return effectiveValueInt_[BROWSING_INTERVAL]; - } - - - /** - Returns the pending value of the "browsing interval" attribute. - @return The pending value of the "browsing interval" attribute. - @see #getBrowsingInterval() - **/ - public int getBrowsingIntervalPending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return pendingValueInt_[BROWSING_INTERVAL]; - } - - /** - Sets the value of the "browsing interval" attribute. - This attribute represents the amount of time, in milliseconds, between each system announcement that is used for browsing. A value of zero indicates that there will be no system announcements. - @param value The value of the "browsing interval" attribute. - **/ - public void setBrowsingInterval(int value) - { - pendingValueInt_[BROWSING_INTERVAL] = value; - userChangedAttribute_[BROWSING_INTERVAL] = true; - userCommittedChange_[BROWSING_INTERVAL] = false; - } - - - /** - Returns the value of the "system CCSID" attribute. - This attribute represents the coded character set identifier for the NetServer. - This is the CCSID that is used for all clients connected to the system. -
    A value of 0 indicates that the user would like to use the associated ASCII CCSID for the CCSID of the job used to start the system. - @return The value of the "system CCSID" attribute. - **/ - public int getCCSID() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return effectiveValueInt_[CCSID]; - } - - - /** - Returns the pending value of the "system CCSID" attribute. - @return The pending value of the "system CCSID" attribute. - @see #getCCSID() - **/ - public int getCCSIDPending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return pendingValueInt_[CCSID]; - } - - /** - Sets the value of the "system CCSID" attribute. - This attribute represents the coded character set identifier for the NetServer. - This is the CCSID that is used for all clients connected to the system. - The default value is the associated ASCII CCSID for the CCSID of the job - used to start the system. -
    A value of 0 indicates that the user would like to use the associated ASCII CCSID for the CCSID of the job used to start the system. - @param value The value of the "system CCSID" attribute. - **/ - public void setCCSID(int value) - { - pendingValueInt_[CCSID] = value; - userChangedAttribute_[CCSID] = true; - userCommittedChange_[CCSID] = false; - } - - - /** - Returns the value of the "description" attribute. - This attribute represents the text description of the NetServer. - @return The value of the "description" attribute. - **/ - public String getDescription() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return effectiveValueStr_[DESCRIPTION]; - } - - - /** - Returns the pending value of the "description" attribute. - @return The pending value of the "description" attribute. - @see #getDescription() - **/ - public String getDescriptionPending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return pendingValueStr_[DESCRIPTION]; - } - - - /** - Sets the value of the "description" attribute. - This attribute represents the text description of the NetServer - @param value The value of the "description" attribute. - Maximum length is 50 characters. - **/ - public void setDescription(String value) - { - if (value == null) { throw new NullPointerException(); } - - pendingValueStr_[DESCRIPTION] = value.trim(); - userChangedAttribute_[DESCRIPTION] = true; - userCommittedChange_[DESCRIPTION] = false; - } - - - /** - Returns the value of the "domain name" attribute. - This attribute represents the domain name of the NetServer. - @return The value of the "domain name" attribute. - **/ - public String getDomainName() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return effectiveValueStr_[DOMAIN_NAME]; - } - - - /** - Returns the pending value of the "domain name" attribute. - @return The pending value of the "domain name" attribute. - @see #getDomainName() - **/ - public String getDomainNamePending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return pendingValueStr_[DOMAIN_NAME]; - } - - /** - Sets the value of the "domain name" attribute. - This attribute represents the domain name of the NetServer. - @param value The value of the "domain name" attribute. - **/ - public void setDomainName(String value) - { - if (value == null) { throw new NullPointerException(); } - - pendingValueStr_[DOMAIN_NAME] = value.trim(); - userChangedAttribute_[DOMAIN_NAME] = true; - userCommittedChange_[DOMAIN_NAME] = false; - } - - - // Implementation note: The NetServer team doesn't use the Guest Support fields. - // Apparently those fields are used internally by the Host. - // There is currently no need for us to surface them. - // "Guest support" indicates whether a guest user profile may be used - // in the event an unknown user attempts to access resources on the system. - - - /** - Returns the value of the "guest user profile" attribute. - This attribute represents the guest user profile for the NetServer. - If no guest user profile is currently configured on the system, the value of this attribute is "" (an empty String). - @return The value of the "guest user profile" attribute. - **/ - public String getGuestUserProfile() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return effectiveValueStr_[GUEST_USER_PROFILE]; - } - - /** - Returns the pending value of the "guest user profile" attribute. - @return The pending value of the "guest user profile" attribute. - @see #getGuestUserProfile() - **/ - public String getGuestUserProfilePending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return pendingValueStr_[GUEST_USER_PROFILE]; - } - - /** - Sets the value of the "guest user profile" attribute. - This attribute represents the guest user profile for the NetServer. - If no guest user profile is currently configured on the system, the value of this attribute is "" (an empty String). -

    - Note: Guest support allows customers to have users accessing files and printers on the system, without the requirement of a user profile on the system. It limits access to data and allows customers to support a set of users who may only need print support but do not otherwise need system access. - @param value The value of the "guest user profile" attribute. - **/ - public void setGuestUserProfile(String value) - { - if (value == null) { throw new NullPointerException(); } - - pendingValueStr_[GUEST_USER_PROFILE] = value.trim(); - userChangedAttribute_[GUEST_USER_PROFILE] = true; - userCommittedChange_[GUEST_USER_PROFILE] = false; - } - - - /** - Returns the value of the "idle timeout" attribute. - This attribute represents the amount of time, in seconds, that a connection to the NetServer will remain active once activity has ceased on that connection. - An idle time-out value of ({@link #NO_AUTO_DISCONNECT NO_AUTO_DISCONNECT}) indicates no autodisconnect. - @return The value of the "idle timeout" attribute. - **/ - public int getIdleTimeout() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return effectiveValueInt_[IDLE_TIMEOUT]; - } - - /** - Returns the pending value of the "idle timeout" attribute. - @return The pending value of the "idle timeout" attribute. - @see #getIdleTimeout() - **/ - public int getIdleTimeoutPending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return pendingValueInt_[IDLE_TIMEOUT]; - } - - /** - Sets the value of the "idle timeout" attribute. - This attribute represents the amount of time, in seconds, that a connection to the NetServer will remain active once activity has ceased on that connection. - An idle time-out value of ({@link #NO_AUTO_DISCONNECT NO_AUTO_DISCONNECT}) indicates no autodisconnect. - @param value The value of the "idle timeout" attribute. - **/ - public void setIdleTimeout(int value) - { - pendingValueInt_[IDLE_TIMEOUT] = value; - userChangedAttribute_[IDLE_TIMEOUT] = true; - userCommittedChange_[IDLE_TIMEOUT] = false; - } - - /** - Returns the value of the "LAN Manager authentication" attribute. - This attribute represents the level of restriction on the use of the LANMAN password hash for authentication. - Possible values are {@link #PASSWORD_STRONGER PASSWORD_STRONGER} and {@link #PASSWORD_STRONGER_OR_MISMATCH PASSWORD_STRONGER_OR_MISMATCH}. -
    Note: This attribute is not supported prior to IBM i release V5R4. - @return The value of the "LAN Manager authentication" attribute. - **/ - public int getLANManagerAuthentication() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return effectiveValueInt_[LAN_MGR_AUTHENTICATION]; - } - - /** - Returns the pending value of the "LAN Manager authentication" attribute. -
    Note: This attribute is not supported prior to IBM i release V5R4. - @return The pending value of the "LAN Manager authentication" attribute. - @see #getLANManagerAuthentication() - **/ - public int getLANManagerAuthenticationPending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return pendingValueInt_[LAN_MGR_AUTHENTICATION]; - } - - /** - Sets the value of the "LAN Manager authentication" attribute. - This attribute represents the level of restriction on the use of the LANMAN password hash for authentication. - Possible values are {@link #PASSWORD_STRONGER PASSWORD_STRONGER} and {@link #PASSWORD_STRONGER_OR_MISMATCH PASSWORD_STRONGER_OR_MISMATCH}. -
    Note: This attribute is not supported prior to IBM i release V5R4. - @param value The value of the "LAN Manager authentication" attribute. - **/ - public void setLANManagerAuthentication(int value) - { - pendingValueInt_[LAN_MGR_AUTHENTICATION] = value; - userChangedAttribute_[LAN_MGR_AUTHENTICATION] = true; - userCommittedChange_[LAN_MGR_AUTHENTICATION] = false; - } - - - /** - Returns the value of the "logon support" attribute. - This attribute indicates the logon system role for the system. - If true, then the server is a logon server; if false, the server is not a logon server. -
    Note: This attribute corresponds to the "server role" field specified - in the NetServer API's. - @return The value of the "logon support" attribute. - **/ - public boolean isLogonServer() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return (effectiveValueInt_[LOGON_SUPPORT] == 1 ? true : false); - } - - /** - Returns the pending value of the "logon support" attribute. - @return The pending value of the "logon support" attribute. - @see #isLogonServer() - **/ - public boolean isLogonServerPending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return (pendingValueInt_[LOGON_SUPPORT] == 1 ? true : false); - } - - /** - Sets the value of the "logon support" attribute. - This attribute indicates the logon server role for the server. - If true, then the server is a logon server; if false, the server is not a logon server. -
    Note: This attribute corresponds to the "server role" field specified - in the NetServer API's. - @param value The value of the "logon support" attribute. - **/ - public void setLogonServer(boolean value) - { - pendingValueInt_[LOGON_SUPPORT] = (value==true ? 1 : 0); - userChangedAttribute_[LOGON_SUPPORT] = true; - userCommittedChange_[LOGON_SUPPORT] = false; - } - - - /** - Returns the value of the "message authentication" attribute. - This attribute represents the status of message authentication. - Possible values are {@link #MSG_AUTH_NOT_SUPPORTED MSG_AUTH_NOT_SUPPORTED}, {@link #MSG_AUTH_NEGOTIATED MSG_AUTH_NEGOTIATED}, and {@link #MSG_AUTH_REQUIRED MSG_AUTH_REQUIRED}. -
    Note: This attribute is not supported prior to IBM i release V5R4. - @return The value of the "message authentication" attribute. - **/ - public int getMessageAuthentication() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return effectiveValueInt_[MESSAGE_AUTHENTICATION]; - } - - /** - Returns the pending value of the "message authentication" attribute. -
    Note: This attribute is not supported prior to IBM i release V5R4. - @return The pending value of the "message authentication" attribute. - @see #getMessageAuthentication() - **/ - public int getMessageAuthenticationPending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return pendingValueInt_[MESSAGE_AUTHENTICATION]; - } - - /** - Sets the value of the "message authentication" attribute. - This attribute represents the status of message authentication. - Possible values are {@link #MSG_AUTH_NOT_SUPPORTED MSG_AUTH_NOT_SUPPORTED}, {@link #MSG_AUTH_NEGOTIATED MSG_AUTH_NEGOTIATED}, and {@link #MSG_AUTH_REQUIRED MSG_AUTH_REQUIRED}. -
    Note: This attribute is not supported prior to IBM i release V5R4. - @param value The value of the "message authentication" attribute. - **/ - public void setMessageAuthentication(int value) - { - pendingValueInt_[MESSAGE_AUTHENTICATION] = value; - userChangedAttribute_[MESSAGE_AUTHENTICATION] = true; - userCommittedChange_[MESSAGE_AUTHENTICATION] = false; - } - - /** - Returns the value of the "minimum message severity" attribute. - This attribute represents the minimum message severity of administrative alerts to send to users of the system. - A value of ({@link #NO_ADMIN_ALERTS NO_ADMIN_ALERTS}) indicates that administrative alert messages are not sent. -
    Note: This attribute is not supported prior to IBM i release V5R4. - @return The value of the "minimum message severity" attribute. - **/ - public int getMinimumMessageSeverity() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return effectiveValueInt_[MIN_MESSAGE_SEVERITY]; - } - - /** - Returns the pending value of the "minimum message severity" attribute. -
    Note: This attribute is not supported prior to IBM i release V5R4. - @return The pending value of the "minimum message severity" attribute. - @see #getMinimumMessageSeverity() - **/ - public int getMinimumMessageSeverityPending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return pendingValueInt_[MIN_MESSAGE_SEVERITY]; - } - - /** - Sets the value of the "minimum message severity" attribute. - This attribute represents the minimum message severity of administrative alerts to send to users of the system. - A value of ({@link #NO_ADMIN_ALERTS NO_ADMIN_ALERTS}) indicates that administrative alert messages are not sent. -
    Note: This attribute is not supported prior to IBM i release V5R4. - @param value The value of the "minimum message severity" attribute. - **/ - public void setMinimumMessageSeverity(int value) - { - pendingValueInt_[MIN_MESSAGE_SEVERITY] = value; - userChangedAttribute_[MIN_MESSAGE_SEVERITY] = true; - userCommittedChange_[MIN_MESSAGE_SEVERITY] = false; - } - - - /** - Returns the value of the "NetServer name" attribute. - This attribute represents the name of the NetServer. -
    Note: The NetServer name is always uppercase on the system. - @return The value of the "NetServer name" attribute. - **/ - public String getName() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return effectiveValueStr_[SERVER_NAME]; - } - - /** - Returns the pending value of the "NetServer name" attribute. - @return The pending value of the "NetServer name" attribute. - @see #getName() - **/ - public String getNamePending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return pendingValueStr_[SERVER_NAME]; - } - - /** - Sets the value of the "NetServer name" attribute. - This attribute represents the name of the NetServer. -
    Note: The NetServer name is always uppercase on the system. - @param value The value of the "NetServer name" attribute. - **/ - public void setName(String value) - { - if (value == null) { throw new NullPointerException(); } - - pendingValueStr_[SERVER_NAME] = value.trim(); - userChangedAttribute_[SERVER_NAME] = true; - userCommittedChange_[SERVER_NAME] = false; - } - - - /** - Returns the value of the "opportunistic lock timeout" attribute. - This attribute represents the amount of time, in seconds, that the system will wait for a response to a break lock request sent to a lock holder, before forcefully removing the lock. - A value of ({@link #OPP_LOCK_DISABLED OPP_LOCK_DISABLED}) indicates that opportunistic locking is disabled. - The default value is 30 seconds. -
    Note: This attribute is not supported prior to IBM i release V5R4. - @return The value of the "opportunistic lock timeout" attribute. - **/ - public int getOpportunisticLockTimeout() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return effectiveValueInt_[OPP_LOCK_TIMEOUT]; - } - - /** - Returns the pending value of the "opportunistic lock timeout" attribute. -
    Note: This attribute is not supported prior to IBM i release V5R4. - @return The pending value of the "opportunistic lock timeout" attribute. - @see #getOpportunisticLockTimeout() - **/ - public int getOpportunisticLockTimeoutPending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return pendingValueInt_[OPP_LOCK_TIMEOUT]; - } - - /** - Sets the value of the "opportunistic lock timeout" attribute. - This attribute represents the amount of time, in seconds, that the system will wait for a response to a break lock request sent to a lock holder, before forcefully removing the lock. - A value of ({@link #OPP_LOCK_DISABLED OPP_LOCK_DISABLED}) indicates that opportunistic locking is disabled. - The default value is 30 seconds. -
    Note: This attribute is not supported prior to IBM i release V5R4. - @param value The value of the "opportunistic lock timeout" attribute. - **/ - public void setOpportunisticLockTimeout(int value) - { - pendingValueInt_[OPP_LOCK_TIMEOUT] = value; - userChangedAttribute_[OPP_LOCK_TIMEOUT] = true; - userCommittedChange_[OPP_LOCK_TIMEOUT] = false; - } - - - /** - Returns the value of the "WINS enablement" attribute. - This attribute indicates whether the system uses a WINS server. - Note: This attribute is also referred to as the "server role". - @return The value of the "WINS enablement" attribute. - **/ - public boolean isWINSServer() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return (effectiveValueInt_[WINS_ENABLEMENT] == 1 ? true : false); - } - - - /** - Returns the pending value of the "WINS enablement" attribute. - @return The pending value of the "WINS enablement" attribute. - @see #isWINSServer() - **/ - public boolean isWINSServerPending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return (pendingValueInt_[WINS_ENABLEMENT] == 1 ? true : false); - } - - /** - Sets the value of the "WINS enablement" attribute. - This attribute indicates whether the system uses a WINS server. - Note: This attribute is also referred to as the "server role". - @param value The value of the "WINS enablement" attribute. - **/ - public void setWINSServer(boolean value) - { - pendingValueInt_[WINS_ENABLEMENT] = (value==true ? 1 : 0); - userChangedAttribute_[WINS_ENABLEMENT] = true; - userCommittedChange_[WINS_ENABLEMENT] = false; - } - - - /** - Returns the value of the "WINS primary address" attribute. - This attribute represents the IP address of the primary WINS server. - @return The value of the "WINS primary address" attribute. - **/ - public String getWINSPrimaryAddress() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return effectiveValueStr_[WINS_PRIMARY_ADDRESS]; - } - - /** - Returns the pending value of the "WINS primary address" attribute. - @return The pending value of the "WINS primary address" attribute. - @see #getWINSPrimaryAddress() - **/ - public String getWINSPrimaryAddressPending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return pendingValueStr_[WINS_PRIMARY_ADDRESS]; - } - - /** - Sets the value of the "WINS primary address" attribute. - This attribute represents the IP address of the primary WINS server. - @param value The value of the "WINS primary address" attribute. - **/ - public void setWINSPrimaryAddress(String value) - { - if (value == null) { throw new NullPointerException(); } - - pendingValueStr_[WINS_PRIMARY_ADDRESS] = value.trim(); - userChangedAttribute_[WINS_PRIMARY_ADDRESS] = true; - userCommittedChange_[WINS_PRIMARY_ADDRESS] = false; - } - - - /** - Returns the value of the "WINS scope ID" attribute. - This attribute represents the network scope used by the WINS server. - If no scope ID is currently configured on the system, the value of this attribute is "" (an empty String). - @return The value of the "WINS scope ID" attribute. - **/ - public String getWINSScopeID() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return effectiveValueStr_[WINS_SCOPE_ID]; - } - - /** - Returns the pending value of the "WINS scope ID" attribute. - @return The pending value of the "WINS scope ID" attribute. - @see #getWINSScopeID() - **/ - public String getWINSScopeIDPending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return pendingValueStr_[WINS_SCOPE_ID]; - } - - /** - Sets the value of the "WINS scope ID" attribute. - This attribute represents the network scope used by the WINS server. - If no scope ID is currently configured on the system, the value of this attribute is "" (an empty String). - @param value The value of the "WINS scope ID" attribute. - **/ - public void setWINSScopeID(String value) - { - if (value == null) { throw new NullPointerException(); } - - pendingValueStr_[WINS_SCOPE_ID] = value.trim(); - userChangedAttribute_[WINS_SCOPE_ID] = true; - userCommittedChange_[WINS_SCOPE_ID] = false; - } - - - /** - Returns the value of the "WINS secondary address" attribute. - This attribute represents the IP address of the secondary WINS server. - @return The value of the "WINS secondary address" attribute. - **/ - public String getWINSSecondaryAddress() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return effectiveValueStr_[WINS_SECONDARY_ADDRESS]; - } - - /** - Returns the pending value of the "WINS secondary address" attribute. - @return The pending value of the "WINS secondary address" attribute. - @see #getWINSSecondaryAddress() - **/ - public String getWINSSecondaryAddressPending() - { - if (!refreshedSinceStart_) refreshWithoutException(); - return pendingValueStr_[WINS_SECONDARY_ADDRESS]; - } - - /** - Sets the value of the "WINS secondary address" attribute. - This attribute represents the IP address of the secondary WINS server. - @param value The value of the "WINS secondary address" attribute. - **/ - public void setWINSSecondaryAddress(String value) - { - if (value == null) { throw new NullPointerException(); } - - pendingValueStr_[WINS_SECONDARY_ADDRESS] = value.trim(); - userChangedAttribute_[WINS_SECONDARY_ADDRESS] = true; - userCommittedChange_[WINS_SECONDARY_ADDRESS] = false; - } - - /** - Refreshes the attribute values of this ISeriesNetServer object, from the current in-effect values on the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void refresh() - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Refresh the "autostart" attribute value. - retrieveAutostart(); - changedAutoStartSinceRefresh_ = false; - - // Refresh most of the attribute values (all except "autostart"). - openListOfServerInfo(); - - // Remember that we've done at least one refresh since the last start. - refreshedSinceStart_ = true; - } - - // Helper method. This calls refresh() and swallows all exceptions, - // so that all of the getters can use it. - private void refreshWithoutException() - { - try { - refresh(); - } - catch (Exception e) - { - if (Trace.traceOn_) { - Trace.log(Trace.ERROR, "Exception swallowed by refresh(): ", e); - } - } - } - - - /** - Commits all attribute value changes to the system. - Note that for most attributes, changes do not take effect - until the NetServer process on the system is stopped ({@link #end() end}) and restarted ({@link #start() start}). - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void commitChanges() - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!userHasSpecialAuthority()) { - Trace.log(Trace.ERROR, "*IOSYSCFG authority is required in order to change NetServer attributes."); - throw new AS400SecurityException(AS400SecurityException.SPECIAL_AUTHORITY_INSUFFICIENT); - } - - // Make sure we have the currently in-effect values. - if (!refreshedSinceStart_) refresh(); - - // The API's we call will depend on which attributes have been changed. - - // These attributes are committed via QZLSCHSI ("Change Server Info"): - // authenticationMethod, browsingInterval, ccsid, idleTimeout, - // logonSupport, oppLockTimeout, winsEnablement, winsPrimaryAddress, winsScopeId, - // winsSecondaryAddress. - // - // These attributes are committed via QZLSCHSN ("Change Server Name"): - // allowSystemName, description, domainName, serverName. - // - // This attribute is committed via QZLSCHSG ("Change Server Guest"): - // guestUserProfile - // - // This attribute is committed via QTOCAUTO ("Change Autostart"): - // autostart - - // Determine which API's we need to call to commit the changed attributes. - - boolean needToChangeServerInfo = false; - boolean needToChangeServerName = false; - boolean needToChangeServerGuest = false; - boolean needToChangeAutostart = false; - - if (userChangedAttribute_[ALLOW_SYSTEM_NAME] && - !userCommittedChange_[ALLOW_SYSTEM_NAME]) { - needToChangeServerName = true; - } - if (userChangedAttribute_[AUTHENTICATION_METHOD] && - !userCommittedChange_[AUTHENTICATION_METHOD]) { - needToChangeServerInfo = true; - } - if (userChangedAttribute_[AUTOSTART] && - !userCommittedChange_[AUTOSTART]) { - needToChangeAutostart = true; - } - if (userChangedAttribute_[BROWSING_INTERVAL] && - !userCommittedChange_[BROWSING_INTERVAL]) { - needToChangeServerInfo = true; - } - if (userChangedAttribute_[CCSID] && - !userCommittedChange_[CCSID]) { - needToChangeServerInfo = true; - } - if (userChangedAttribute_[DESCRIPTION] && - !userCommittedChange_[DESCRIPTION]) { - needToChangeServerName = true; - } - if (userChangedAttribute_[DOMAIN_NAME] && - !userCommittedChange_[DOMAIN_NAME]) { - needToChangeServerName = true; - } - if (userChangedAttribute_[GUEST_USER_PROFILE] && - !userCommittedChange_[GUEST_USER_PROFILE]) { - needToChangeServerGuest = true; - } - if (userChangedAttribute_[IDLE_TIMEOUT] && - !userCommittedChange_[IDLE_TIMEOUT]) { - needToChangeServerInfo = true; - } - if (userChangedAttribute_[OPP_LOCK_TIMEOUT] && - !userCommittedChange_[OPP_LOCK_TIMEOUT]) { - needToChangeServerInfo = true; - } - if (userChangedAttribute_[LOGON_SUPPORT] && - !userCommittedChange_[LOGON_SUPPORT]) { - needToChangeServerInfo = true; - } - if (userChangedAttribute_[SERVER_NAME] && - !userCommittedChange_[SERVER_NAME]) { - needToChangeServerName = true; - } - if (userChangedAttribute_[WINS_ENABLEMENT] && - !userCommittedChange_[WINS_ENABLEMENT]) { - needToChangeServerInfo = true; - } - if (userChangedAttribute_[WINS_PRIMARY_ADDRESS] && - !userCommittedChange_[WINS_PRIMARY_ADDRESS]) { - needToChangeServerInfo = true; - } - if (userChangedAttribute_[WINS_SCOPE_ID] && - !userCommittedChange_[WINS_SCOPE_ID]) { - needToChangeServerInfo = true; - } - if (userChangedAttribute_[WINS_SECONDARY_ADDRESS] && - !userCommittedChange_[WINS_SECONDARY_ADDRESS]) { - needToChangeServerInfo = true; - } - if (getSystemVRM() >= 0x00050400) - { // new fields added to API in V5R4 - if (userChangedAttribute_[MESSAGE_AUTHENTICATION] && - !userCommittedChange_[MESSAGE_AUTHENTICATION]) { - needToChangeServerInfo = true; - } - if (userChangedAttribute_[MIN_MESSAGE_SEVERITY] && - !userCommittedChange_[MIN_MESSAGE_SEVERITY]) { - needToChangeServerInfo = true; - } - if (userChangedAttribute_[LAN_MGR_AUTHENTICATION] && - !userCommittedChange_[LAN_MGR_AUTHENTICATION]) { - needToChangeServerInfo = true; - } - } - - if (needToChangeServerInfo) { changeServerInfo(); } - - if (needToChangeServerName) { changeServerName(); } - - if (needToChangeServerGuest) { changeServerGuest(); } - - if (needToChangeAutostart) { changeAutostart(); } - - // If we made it this far, mark all changes as "committed". - for (int i=0; i= 0x00050200) { // new field added to API in V5R2 - if (getSystemVRM() >= 0x00050400 || - userChangedAttribute_[AUTHENTICATION_METHOD]) - { - switch (pendingValueStr_[AUTHENTICATION_METHOD].charAt(0)) { - case '0': stream.write(0xF0); break; - case '1': stream.write(0xF1); break; - default: stream.write(0xF2); - } - } - } - - if (getSystemVRM() >= 0x00050400) - { // new fields added to API in V5R4 - byte[] reserved3 = {(byte)0x00, (byte)0x00, (byte)0x00}; - stream.write(reserved3); // reserved field - CHAR(3) - stream.write(BinaryConverter.intToByteArray(pendingValueInt_[MESSAGE_AUTHENTICATION])); - stream.write(BinaryConverter.intToByteArray(pendingValueInt_[MIN_MESSAGE_SEVERITY])); - stream.write(BinaryConverter.intToByteArray(pendingValueInt_[LAN_MGR_AUTHENTICATION])); - } - - - stream.flush(); - byte[] requestVariable = stream.toByteArray(); - - parms[0] = new ProgramParameter(requestVariable); - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(requestVariable.length)); - parms[2] = new ProgramParameter(conv.stringToByteArray("ZLSS0100")); - parms[3] = new ErrorCodeParameter(); - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSCHSI.PGM", parms); - - if (!pc.run()) { - throw new AS400Exception(pc.getMessageList()); - } - } - - - // Invokes the "Change Server Name" (QZLSCHSN) API. - private void changeServerName() - throws IOException, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, ObjectDoesNotExistException - { - // Compose the arguments for the API. - - final int ccsid = system_.getCcsid(); - final AS400Text text15 = new AS400Text(15, ccsid); - final AS400Text text50 = new AS400Text(50, ccsid); - - ProgramParameter[] parms = new ProgramParameter[5]; - - parms[0] = new ProgramParameter(text15.toBytes(pendingValueStr_[SERVER_NAME].trim())); - parms[1] = new ProgramParameter(text15.toBytes(pendingValueStr_[DOMAIN_NAME].trim())); - parms[2] = new ProgramParameter(text50.toBytes(pendingValueStr_[DESCRIPTION].trim())); - parms[3] = new ErrorCodeParameter(); - - byte[] allowSysName = new byte[1]; - if (pendingValueStr_[ALLOW_SYSTEM_NAME].equals("1")) { - allowSysName[0] = (byte)0xF1; - } - else { - allowSysName[0] = (byte)0xF0; - } - parms[4] = new ProgramParameter(allowSysName); - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSCHSN.PGM", parms); - - if (!pc.run()) { - throw new AS400Exception(pc.getMessageList()); - } - } - - - - // Invokes the "Open List of Server Information" (QZLSOLST) API, and parses the returned data. - private void openListOfServerInfo() - throws IOException, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, ObjectDoesNotExistException - { - // Compose the arguments for the API. - - final int ccsid = system_.getCcsid(); - final CharConverter conv = new CharConverter(ccsid); - final AS400Text text15 = new AS400Text(15, ccsid); - - int len = 772; // length of receiver variable - ProgramParameter[] parms = new ProgramParameter[6]; - - parms[0] = new ProgramParameter(len); // receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(len));// length of receiver variable - parms[2] = new ProgramParameter(64); // list information - parms[3] = new ProgramParameter(conv.stringToByteArray("ZLSL0201")); - parms[4] = new ProgramParameter(text15.toBytes("*ALL")); // ignored for format ZLSL0201 - parms[5] = new ErrorCodeParameter(); - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSOLST.PGM", parms); - - if (!pc.run()) { - throw new AS400Exception(pc.getMessageList()); - } - - if (DEBUG) - { - byte[] listInfo = parms[2].getOutputData(); - int totalRecords = BinaryConverter.byteArrayToInt(listInfo, 0); - int numRecords = BinaryConverter.byteArrayToInt(listInfo, 4); - int recLen = BinaryConverter.byteArrayToInt(listInfo, 8); - int lengthOfInfoReturned = BinaryConverter.byteArrayToInt(listInfo, 12); - System.out.println("totalRecords=="+totalRecords+" ; numRecords=="+numRecords+" ; recLen=="+recLen+" ; lengthOfInfoReturned=="+lengthOfInfoReturned); - } - - // Parse the returned data. - - byte[] data = parms[0].getOutputData(); - - effectiveValueInt_[CCSID] = BinaryConverter.byteArrayToInt(data, 0); - if (!userChangedAttribute_[CCSID]) { - pendingValueInt_[CCSID] = BinaryConverter.byteArrayToInt(data, 4); - } - effectiveValueInt_[IDLE_TIMEOUT] = BinaryConverter.byteArrayToInt(data, 8); - if (!userChangedAttribute_[IDLE_TIMEOUT]) { - pendingValueInt_[IDLE_TIMEOUT] = BinaryConverter.byteArrayToInt(data, 12); - } - effectiveValueInt_[OPP_LOCK_TIMEOUT] = BinaryConverter.byteArrayToInt(data, 16); - if (!userChangedAttribute_[OPP_LOCK_TIMEOUT]) { - pendingValueInt_[OPP_LOCK_TIMEOUT] = BinaryConverter.byteArrayToInt(data, 20); - } - effectiveValueInt_[BROWSING_INTERVAL] = BinaryConverter.byteArrayToInt(data, 24); - if (!userChangedAttribute_[BROWSING_INTERVAL]) { - pendingValueInt_[BROWSING_INTERVAL] = BinaryConverter.byteArrayToInt(data, 28); - } - effectiveValueInt_[WINS_ENABLEMENT] = BinaryConverter.byteArrayToInt(data, 32); - if (!userChangedAttribute_[WINS_ENABLEMENT]) { - pendingValueInt_[WINS_ENABLEMENT] = BinaryConverter.byteArrayToInt(data, 36); - } - effectiveValueStr_[GUEST_USER_PROFILE] = conv.byteArrayToString(data,48,10).trim(); - if (!userChangedAttribute_[GUEST_USER_PROFILE]) { - pendingValueStr_[GUEST_USER_PROFILE] = conv.byteArrayToString(data,58,10).trim(); - } - effectiveValueStr_[SERVER_NAME] = conv.byteArrayToString(data,68,15).trim(); - if (!userChangedAttribute_[SERVER_NAME]) { - pendingValueStr_[SERVER_NAME] = conv.byteArrayToString(data,83,15).trim(); - } - effectiveValueStr_[DOMAIN_NAME] = conv.byteArrayToString(data,98,15).trim(); - if (!userChangedAttribute_[DOMAIN_NAME]) { - pendingValueStr_[DOMAIN_NAME] = conv.byteArrayToString(data,113,15).trim(); - } - effectiveValueStr_[DESCRIPTION] = conv.byteArrayToString(data,128,50).trim(); - if (!userChangedAttribute_[DESCRIPTION]) { - pendingValueStr_[DESCRIPTION] = conv.byteArrayToString(data,178,50).trim(); - } - effectiveValueStr_[WINS_PRIMARY_ADDRESS] = conv.byteArrayToString(data,228,15).trim(); - if (!userChangedAttribute_[WINS_PRIMARY_ADDRESS]) { - pendingValueStr_[WINS_PRIMARY_ADDRESS] = conv.byteArrayToString(data,243,15).trim(); - } - effectiveValueStr_[WINS_SECONDARY_ADDRESS] = conv.byteArrayToString(data,258,15).trim(); - if (!userChangedAttribute_[WINS_SECONDARY_ADDRESS]) { - pendingValueStr_[WINS_SECONDARY_ADDRESS] = conv.byteArrayToString(data,273,15).trim(); - } - effectiveValueStr_[WINS_SCOPE_ID] = conv.byteArrayToString(data,288,224).trim(); - if (!userChangedAttribute_[WINS_SCOPE_ID]) { - pendingValueStr_[WINS_SCOPE_ID] = conv.byteArrayToString(data,512,224).trim(); - } - effectiveValueStr_[ALLOW_SYSTEM_NAME] = conv.byteArrayToString(data,736,1); - if (!userChangedAttribute_[ALLOW_SYSTEM_NAME]) { - pendingValueStr_[ALLOW_SYSTEM_NAME] = conv.byteArrayToString(data,737,1); - } - effectiveValueStr_[AUTHENTICATION_METHOD] = conv.byteArrayToString(data,738,1); - if (!userChangedAttribute_[AUTHENTICATION_METHOD]) { - pendingValueStr_[AUTHENTICATION_METHOD] = conv.byteArrayToString(data,739,1); - } - effectiveValueInt_[LOGON_SUPPORT] = BinaryConverter.byteArrayToInt(data, 740); // a.k.a. "server role" - if (!userChangedAttribute_[LOGON_SUPPORT]) { - pendingValueInt_[LOGON_SUPPORT] = BinaryConverter.byteArrayToInt(data, 744); - } - if (DEBUG) System.out.println("DEBUG: data.length == " + data.length); - if (getSystemVRM() >= 0x00050400) - { // new fields added to API in V5R4 - effectiveValueInt_[MESSAGE_AUTHENTICATION] = BinaryConverter.byteArrayToInt(data, 748); - if (!userChangedAttribute_[MESSAGE_AUTHENTICATION]) { - pendingValueInt_[MESSAGE_AUTHENTICATION] = BinaryConverter.byteArrayToInt(data, 752); - } - effectiveValueInt_[MIN_MESSAGE_SEVERITY] = BinaryConverter.byteArrayToInt(data, 756); - if (!userChangedAttribute_[MIN_MESSAGE_SEVERITY]) { - pendingValueInt_[MIN_MESSAGE_SEVERITY] = BinaryConverter.byteArrayToInt(data, 760); - } - effectiveValueInt_[LAN_MGR_AUTHENTICATION] = BinaryConverter.byteArrayToInt(data, 764); - if (!userChangedAttribute_[LAN_MGR_AUTHENTICATION]) { - pendingValueInt_[LAN_MGR_AUTHENTICATION] = BinaryConverter.byteArrayToInt(data, 768); - } - } - - } - - - /** - Reports whether the user has *IOSYSCFG authority. - This authority is required in order to invoke the following API's: - QTOCAUTO, QZLSCHSG, QZLSCHSI, QZLSCHSN - **/ - private boolean userHasSpecialAuthority() - { - if (!determinedSpecialAuthority_) - { - boolean foundAuth = false; - try - { - User user = new User(system_, system_.getUserId()); - - // Call User.hasSpecialAuthority() to determine whether the User, or any groups that the - // User belongs to, has SPECIAL_AUTHORITY_IO_SYSTEM_CONFIGURATION authority - foundAuth = user.hasSpecialAuthority(User.SPECIAL_AUTHORITY_IO_SYSTEM_CONFIGURATION);//@A1A - } - catch (Exception e) { // This will never happen. The User constructor doesn't actually throw any exceptions anymore. - Trace.log(Trace.ERROR, e); - } - if (!foundAuth) { - Trace.log(Trace.WARNING, "User " + system_.getUserId() + " does not have *IOSYSCFG authority."); - } - userHasSpecialAuthority_ = foundAuth; - determinedSpecialAuthority_ = true; - } - return userHasSpecialAuthority_; - } - - - /** - Ends the NetServer job on the IBM i system. -
    This method requires *IOSYSCFG special authority on the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void end() - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!userHasSpecialAuthority()) { - Trace.log(Trace.ERROR, "*IOSYSCFG authority is required in order to end the NetServer process."); - throw new AS400SecurityException(AS400SecurityException.SPECIAL_AUTHORITY_INSUFFICIENT); - } - - // Compose the arguments for the API. - ProgramParameter[] parms = new ProgramParameter[1]; - parms[0] = new ErrorCodeParameter(); - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSENDS.PGM", parms); - - if (!pc.run()) { - throw new AS400Exception(pc.getMessageList()); - } - } - - - /** - Ends a specific NetServer session. -
    This method requires *IOSYSCFG special authority on the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void endSession(long sessionID) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - endSessions(null, sessionID); - } - - - /** - Ends all the sessions that were established from the specified workstation. -
    This method requires *IOSYSCFG special authority on the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void endSessionsForWorkstation(String workstationName) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (workstationName == null) { throw new NullPointerException(); } - - endSessions(workstationName, 0L); - } - - - /** - Ends session(s) specified by the args. - Note: If workstationName is non-null, sessionID is ignored. - If workstationName is null, sessionID is required. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - private void endSessions(String workstationName, long sessionID) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!userHasSpecialAuthority()) { - Trace.log(Trace.ERROR, "*IOSYSCFG authority is required in order to end a NetServer session."); - throw new AS400SecurityException(AS400SecurityException.SPECIAL_AUTHORITY_INSUFFICIENT); - } - - // Compose the arguments for the API. - - ProgramParameter[] parms = new ProgramParameter[3]; - final AS400Text text15 = new AS400Text(15, system_.getCcsid()); - final AS400Text text50 = new AS400Text(50, system_.getCcsid()); //@IPv6 - if (workstationName == null) { - parms[0] = new ProgramParameter(text15.toBytes("*SESSID")); - parms[2] = new ProgramParameter(BinaryConverter.longToByteArray(sessionID)); - } - else { - if(getSystemVRM() < 0x00060100) // @IPv6 - specify to end all sessions for the specified workstation like we always have - { - parms[0] = new ProgramParameter(text15.toBytes(workstationName)); - parms[2] = new ProgramParameter(BinaryConverter.longToByteArray(0L)); - } - else{ // @IPv6 - // Utilize the expanded workstation name parameter. // @IPv6 - parms[0] = new ProgramParameter(text15.toBytes("*EXPANDED")); // @IPv6 - parms[2] = new ProgramParameter(text50.toBytes(workstationName)); // @IPv6 - } - } - parms[1] = new ErrorCodeParameter(); - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSENSS.PGM", parms); - - if (!pc.run()) { - throw new AS400Exception(pc.getMessageList()); - } - } - - - /** - Indicates whether or not the NetServer job on the system is started. - @return true if the NetServer job is started; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public boolean isStarted() - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Note: If the NetServer job has been successfully started, there will be at least one QZLSSERVER job in ACTIVE status. - // Set the selection so that only jobs with the name "QZLSSERVER", in ACTIVE status, are included in the list. - JobList list = new JobList(getSystem()); - try { - list.addJobSelectionCriteria(JobList.SELECTION_JOB_NAME, "QZLSSERVER"); - list.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_ACTIVE, Boolean.TRUE); - list.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_JOBQ, Boolean.FALSE); - list.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_OUTQ, Boolean.FALSE); - } catch (PropertyVetoException e) {Trace.log(Trace.ERROR, e);} // this will never happen - list.load(); - boolean foundActiveJob; - if (list.getLength() != 0) { - foundActiveJob = true; - } - else foundActiveJob = false; - - list.close(); - return foundActiveJob; - } - - - /** - Indicates whether or not the QSERVER subsystem is started. - If QSERVER isn't running, we can't start the NetServer job. - @return true if the QSERVER subsystem is started; false otherwise. - **/ - private boolean isQserverStarted() - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Note: If the QSERVER subsystem is running, there will be at least one QSERVER job in ACTIVE status. - // Set the selection so that only jobs with the name "QSERVER", user QSYS, in ACTIVE status, are included in the list. - JobList jobList = new JobList(getSystem()); - try { - jobList.addJobSelectionCriteria(JobList.SELECTION_JOB_NAME, "QSERVER"); - jobList.addJobSelectionCriteria(JobList.SELECTION_USER_NAME, "QSYS"); - jobList.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_ACTIVE, Boolean.TRUE); - } catch (PropertyVetoException e) {Trace.log(Trace.ERROR, e);} // this will never happen - jobList.load(); - boolean foundActiveJob; - if (jobList.getLength() != 0) foundActiveJob = true; - else foundActiveJob = false; - - jobList.close(); - return foundActiveJob; - } - - - /** - Starts the NetServer job on the system. - If the NetServer is already started, this method does nothing. - This method requires *IOSYSCFG special authority on the system. - If the QSERVER subsystem is not running, this method will attempt to start the subsystem. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void start() - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - start(false); - } - - /** - Starts the NetServer job on the system, and (optionally) resets it. - If the NetServer is already started, this method does nothing. - This method requires *IOSYSCFG special authority on the system. - If the QSERVER subsystem is not running, this method will attempt to start it. -

    Note: Reset is used when the NetServer fails to start normally on the system. It is on the NetServer context menu so an administrator can use it. The reset does some under-the-covers cleanup, and is used infrequently. The times it would be used is if the system ended abnormally and there may be jobs or objects hanging around that need to be cleaned up before the system can start again. The reset does that. - - @param reset Whether or not the system is to be reset when started. Default is no reset. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void start(boolean reset) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!userHasSpecialAuthority()) { - Trace.log(Trace.ERROR, "*IOSYSCFG authority is required in order to start the NetServer process."); - throw new AS400SecurityException(AS400SecurityException.SPECIAL_AUTHORITY_INSUFFICIENT); - } - - if (isStarted()) { - if (DEBUG) System.out.println("DEBUG ISeriesNetServer.start("+reset+"): NetServer is already started."); - return; - } - - // See if the QSERVER subsystem is running. If it's not running, start it. - if (!isQserverStarted()) { - // Attempt to start the QSERVER subsystem. - CommandCall cmd = new CommandCall(getSystem(), "STRSBS SBSD(QSERVER)"); - if (!cmd.run()) { - Trace.log(Trace.ERROR, "Error when starting QSERVER subsystem."); - throw new AS400Exception(cmd.getMessageList()); - } - } - - // Note: Stopping and (re)starting the NetServer causes all "pending" attribute values - // to take effect, replacing the (former) "current" attribute values. - refreshedSinceStart_ = false; - - // Start the NetServer job (QZLSSERVER) on the system. - - // Compose the arguments for the API. - - ProgramParameter[] parms = new ProgramParameter[2]; - - byte[] resetBytes = new byte[1]; - if (reset) { - resetBytes[0] = (byte)0xF1; - } - else { - resetBytes[0] = (byte)0xF0; - } - - parms[0] = new ProgramParameter(resetBytes); - parms[1] = new ErrorCodeParameter(); - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSSTRS.PGM", parms); - - if (!pc.run()) { - throw new AS400Exception(pc.getMessageList()); - } - } - - - /** - Refreshes the attribute values of the connection object, from the current values on the system. - @param connection The connection. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void refresh(ISeriesNetServerConnection connection) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (connection == null) { throw new NullPointerException(); } - - final int ccsid = system_.getCcsid(); - final CharConverter conv = new CharConverter(ccsid); - final AS400Text text15 = new AS400Text(15, ccsid); - - int len = 64; // Expect 1 record, 64 bytes in length. - int vrm = getSystemVRM(); - - String format; - boolean is0600; - if (connection.getResourceType() == ISeriesNetServerConnection.WORKSTATION) { - format = "ZLSL0600"; - is0600 = true; - } - else { // SHARE - format = "ZLSL0700"; - is0600 = false; - if(vrm >= 0x00060100) // @IPv6 - we can have two additional fields returned with an extra length of 128 - len = 192; - } - - ProgramParameter[] parms = new ProgramParameter[(is0600 && vrm >= 0x00060100) ? 8 : 6]; // @IPv6 if we are requesting format 600 than we can have 2 additional parameters - - parms[0] = new ProgramParameter(len); // receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(len));// length of receiver variable - parms[2] = new ProgramParameter(64); // list information - parms[3] = new ProgramParameter(conv.stringToByteArray(format)); - if((is0600) && (vrm >= 0x00060100)) // @IPv6 - { // @IPv6 - AS400Text text10 = new AS400Text(10, ccsid); // @IPv6 Session user - AS400Text text50 = new AS400Text(50, ccsid); // @IPv6 Expanded Information Qualifier - parms[4] = new ProgramParameter(text15.toBytes("*EXPANDED")); // @IPv6 - parms[6] = new ProgramParameter(text10.toBytes("*ALL")); // @IPv6 - parms[7] = new ProgramParameter(text50.toBytes(connection.getName())); // @IPv6 - } // @IPv6 - else // @IPv6 - parms[4] = new ProgramParameter(text15.toBytes(connection.getName())); // information qualifier - parms[5] = new ErrorCodeParameter(); - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSOLST.PGM", parms); - int numRecords = callListProgram(pc, parms, len); - - // We expect exactly one record to come back. - if (numRecords == 0) { - Trace.log(Trace.ERROR, "refresh() failed: Connection not found."); - } - else if (numRecords > 1) { - Trace.log(Trace.ERROR, "refresh() failed: More than one connection returned from QZLSOLST."); - } - else // Exactly 1 record was returned in list. - { - byte[] data = parms[0].getOutputData(); - parseZLSL0600or0700(data, 0, conv, is0600, connection); - } - } - - - /** - Refreshes the attribute values of the session object, from the current values on the system. - @param session The session. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void refresh(ISeriesNetServerSession session) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (session == null) { throw new NullPointerException(); } - - final int ccsid = system_.getCcsid(); - final CharConverter conv = new CharConverter(ccsid); - final AS400Text text10 = new AS400Text(10, ccsid); - final AS400Text text15 = new AS400Text(15, ccsid); - - int len = (getSystemVRM() < 0x00060100) ? 64 : 113; // Expect 1 record, 64 bytes in length if V5R4 or earlier, else 113 bytes - - ProgramParameter[] parms = new ProgramParameter[8]; - - parms[0] = new ProgramParameter(len); // receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(len));// length of receiver variable - parms[2] = new ProgramParameter(64); // list information - parms[3] = new ProgramParameter(conv.stringToByteArray("ZLSL0300")); - parms[4] = new ProgramParameter(text15.toBytes("*SESSID")); // information qualifier - parms[5] = new ErrorCodeParameter(); - parms[6] = new ProgramParameter(text10.toBytes("*SESSID")); // session user - parms[7] = new ProgramParameter(BinaryConverter.longToByteArray(session.getID())); // session identifier - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSOLST.PGM", parms); - int numRecords = callListProgram(pc, parms, len); - - // We expect exactly one record to come back. - if (numRecords == 0) { - Trace.log(Trace.ERROR, "refresh() failed: Session not found."); - } - else if (numRecords > 1) { - Trace.log(Trace.ERROR, "refresh() failed: More than one session returned from QZLSOLST."); - } - else // Exactly 1 record was returned in list. - { - byte[] data = parms[0].getOutputData(); - parseZLSL0300(data, 0, conv, session); - } - } - - - /** - Refreshes the attribute values of the share object, from the currently in-effect values on the system. - Note: This overwrites any attribute changes that have been made but not yet committed. - @param share The share. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void refresh(ISeriesNetServerShare share) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (share == null) { throw new NullPointerException(); } - - final int ccsid = system_.getCcsid(); - final CharConverter conv = new CharConverter(ccsid); - final AS400Text text15 = new AS400Text(15, ccsid); - - int len = ZLSL0101_MAX_RECORD_LENGTH; // We expect a single ZLSL0101 record back. - ProgramParameter[] parms = new ProgramParameter[6]; - - parms[0] = new ProgramParameter(len); // receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(len));// length of receiver variable - parms[2] = new ProgramParameter(64); // list information - parms[3] = new ProgramParameter(conv.stringToByteArray("ZLSL0101")); - parms[4] = new ProgramParameter(text15.toBytes(share.getName().trim())); - parms[5] = new ErrorCodeParameter(); - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSOLST.PGM", parms); - int numRecords = callListProgram(pc, parms, len); - - // We expect exactly one record to come back. - if (numRecords == 0) { - Trace.log(Trace.ERROR, "refresh() failed: Share not found."); - } - else if (numRecords > 1) { - Trace.log(Trace.ERROR, "refresh() failed: More than one share returned from QZLSOLST."); - } - else // Exactly 1 record was returned in list. - { - byte[] data = parms[0].getOutputData(); - int desiredType = (share.isFile_ == true ? FILE : PRINT); - parseZLSL0101(data, conv, 1, desiredType, share); - } - } - - - // Deserializes and initializes transient data. - private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "De-serializing ISeriesNetServer object."); - in.defaultReadObject(); - - refreshedSinceStart_ = false; - determinedSpecialAuthority_ = false; - userHasSpecialAuthority_ = false; - } - - /** - Returns the String representation of this ISeriesNetServer object. - @return The String representation of this ISeriesNetServer object. - **/ - public String toString() - { - String name; - if (refreshedSinceStart_) { name = effectiveValueStr_[SERVER_NAME]; } - else { name = "unknown"; } - - return "ISeriesNetServer (system: " + system_.getSystemName() + "; name: "+ name + "): " + super.toString(); - } - - - /** - Commits attribute value changes to the system, for the specified share. - @param share The share. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void commitChanges(ISeriesNetServerFileShare share) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!userHasSpecialAuthority()) { - Trace.log(Trace.ERROR, "*IOSYSCFG authority is required in order to change share attributes."); - throw new AS400SecurityException(AS400SecurityException.SPECIAL_AUTHORITY_INSUFFICIENT); - } - - // How many of the API's "optional parameters" do we need to set: - int numberOfOptionalParms = share.numOptionalParmsToSet_; - - if (DEBUG) System.out.println("DEBUG: ISeriesNetServer.commitChanges("+share.getName()+", " + numberOfOptionalParms +")"); - - // Compose the arguments for the API. - - final int ccsid = system_.getCcsid(); - final CharConverter conv = new CharConverter(ccsid); - final AS400Text text12 = new AS400Text(12, ccsid); - final AS400Text text50 = new AS400Text(50, ccsid); - - // The API has 8 required parameters, plus up to 4 optional parameters. - ProgramParameter[] parms = new ProgramParameter[8+numberOfOptionalParms]; - - // Required parameters: - - // parameter 1 - share name: - parms[0] = new ProgramParameter(text12.toBytes(share.name_)); - // parameter 2 - path name: - byte[] pathAsBytes = conv.stringToByteArray(share.path_); - parms[1] = new ProgramParameter(pathAsBytes); - // parameter 3 - length of path name: - parms[2] = new ProgramParameter(BinaryConverter.intToByteArray(pathAsBytes.length)); - // parameter 4 - CCSID encoding of path name - parms[3] = new ProgramParameter(BinaryConverter.intToByteArray(ccsid)); - // parameter 5 - text description - parms[4] = new ProgramParameter(text50.toBytes(share.description_)); - // parameter 6 - permissions - parms[5] = new ProgramParameter(BinaryConverter.intToByteArray(share.permissions_)); - // parameter 7 - maximum users - parms[6] = new ProgramParameter(BinaryConverter.intToByteArray(share.maxNumberOfUsers_)); - // parameter 8 - error code - parms[7] = new ErrorCodeParameter(); - - // Optional parameters: - - if (numberOfOptionalParms >= 1) - { - // parameter 9 - CCSID used for text conversion - parms[8] = new ProgramParameter(BinaryConverter.intToByteArray(share.ccsidForTextConversion_)); - } - - if (numberOfOptionalParms >= 2) - { - // parameter 10 - enable text conversion - byte[] enableTxtConv = new byte[1]; - if (share.textConversionEnablement_.equals("0")) { - enableTxtConv[0] = (byte)0xF0; - } - else if (share.textConversionEnablement_.equals("1")) { - enableTxtConv[0] = (byte)0xF1; - } - else { - enableTxtConv[0] = (byte)0xF2; - } - parms[9] = new ProgramParameter(enableTxtConv); - } - - if (numberOfOptionalParms >= 4) - { - // parameter 11 - file extension table - int numFileExtensions = share.fileExtensions_.length; - if (numFileExtensions == 0) { // No file extensions. - parms[10] = new ProgramParameter(conv.stringToByteArray("")); // empty list - } - else // Compose a byte array representing the file extension table. - { - // Block out a byte array: 50 bytes per table entry. - ByteArrayOutputStream stream = new ByteArrayOutputStream(numFileExtensions * 50); - for (int i=0; i= 1) { - parms[6] = new ProgramParameter(text20.toBytes(share.printerFile_)); - } - - if (numberOfOptionalParms >= 2) { - byte[] publishPrintShare = new byte[1]; - if (share.isPublished_ == true) { - publishPrintShare[0] = (byte)0xF1; - } - else { - publishPrintShare[0] = (byte)0xF0; - } - parms[7] = new ProgramParameter(publishPrintShare); - } - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QZLSCHPS.PGM", parms); - - if (!pc.run()) { - throw new AS400Exception(pc.getMessageList()); - } - - share.numOptionalParmsToSet_ = 0; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/ISeriesNetServerConnection.java b/cvsroot/src/com/ibm/as400/access/ISeriesNetServerConnection.java deleted file mode 100644 index 189c03aa2..000000000 --- a/cvsroot/src/com/ibm/as400/access/ISeriesNetServerConnection.java +++ /dev/null @@ -1,233 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ISeriesNetServerConnection.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -/** - The ISeriesNetServerConnection class represents a NetServer share connection. -

    - Note: A session (represented by class {@link ISeriesNetServerSession ISeriesNetServerSession}) corresponds to a workstation. A workstation could be a Windows Terminal Server or it could be a single PC on someone's desktop. A connection (represented by this class) corresponds to a specific user who has mapped a drive and has files opened or spooled output on a print queue. Since a session can have multiple users, a connection shows a particular user's statistics on that session. -

    - ISeriesNetServerConnection objects are created and returned by the following methods: -

      -
    • {@link ISeriesNetServer#listConnectionsForSession(long) listConnectionsForSession} -
    • {@link ISeriesNetServer#listConnectionsForSession(String) listConnectionsForSession} -
    • {@link ISeriesNetServer#listConnectionsForShare(String) listConnectionsForShare} -
    - -
    -
    -* import com.ibm.as400.access.*;
    -*
    -* // Create a ISeriesNetServer object for a specific system.
    -* AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -* ISeriesNetServer ns = new ISeriesNetServer(system);
    -*
    -* try
    -* {
    -*   // List all current session connections.
    -*   System.out.println("Session connections:");
    -*   ISeriesNetServerSession[] sessionList = ns.listSessions();
    -*   ISeriesNetServerConnection[] connectionList =
    -*                 ns.listConnectionsForSession(sessionList[0].getID());
    -*   for (int i=0; i<connectionList.length; i++)
    -*   {
    -*     ISeriesNetServerConnection connection = connectionList[i];
    -*     System.out.println(connection.getID() + ": " +
    -*       connection.getName() + "; " +
    -*       connection.getUserName() + "; " +
    -*       connection.getAge());
    -*   }
    -* }
    -* catch (AS400Exception e) {
    -*   AS400Message[] messageList = e.getAS400MessageList();
    -*   for (int i=0; i<messageList.length; i++) {
    -*     System.out.println(messageList[i].getText());
    -*   }
    -* }
    -* catch (Exception e) {
    -*   e.printStackTrace();
    -* }
    -* finally {
    -*   if (system != null) system.disconnectAllServices();
    -* }
    -
    -
    - - @see ISeriesNetServer#listConnectionsForSession(long) - @see ISeriesNetServer#listConnectionsForSession(String) -**/ - -public class ISeriesNetServerConnection implements java.io.Serializable -{ - static final long serialVersionUID = 1L; - - /** - Value of the ISeriesNetServerConnection "resource type" attribute, indicating that the connection is from a specific workstation. - **/ - public static final int WORKSTATION = 0; - - /** - Value of the ISeriesNetServerConnection "resource type" attribute, indicating that the connection is to a specific share. - **/ - public static final int SHARE = 1; - - /** - Value of the ISeriesNetServerConnection "connection type" attribute, indicating that the connection is to a disk drive, that is, a file share. - **/ - public static final int DISK_DRIVE = 0; - - /** - Value of the ISeriesNetServerConnection "connection type" attribute, indicating that the connection is to a spooled output queue, that is, a print share. - **/ - public static final int SPOOLED_OUTPUT_QUEUE = 1; - - //---------------------------------------------------------------------- - // Private data. - //---------------------------------------------------------------------- - - private ISeriesNetServer netServer_; - - private int connectTime_; - private int numberOfFilesOpen_; - private String resourceName_; // either "share name" or "workstation name" - private int connectionType_; - private String userName_; - private int numberOfUsers_; - private int connectionID_; - private long sessionID_; - private int resourceType_; // SHARE or WORKSTATION - - - // Note: This constructor is reserved for use by the ISeriesNetServer class. - ISeriesNetServerConnection(int connectionID, int connectTime, int filesOpen, int connType, String resourceName, int resourceType, String userName, int userCount, long sessionID) - { - // Assume the caller has already validated the arguments (non-null, etc). - setAttributeValues(connectionID, connectTime, filesOpen, connType, resourceName, resourceType, userName, userCount, sessionID); - } - - - // Note: This method is reserved for use by the ISeriesNetServer class. - void setAttributeValues(int connectionID, int connectTime, int filesOpen, int connType, String resourceName, int resourceType, String userName, int userCount, long sessionID) - { - // Assume the caller has already validated the arguments (non-null, etc). - resourceName_ = resourceName; - connectionID_ = connectionID; - connectTime_ = connectTime; - numberOfFilesOpen_ = filesOpen; - connectionType_ = connType; - userName_ = userName; - numberOfUsers_ = userCount; - sessionID_ = sessionID; - - resourceType_ = resourceType; - } - - - /** - Returns the connection ID. - @return The connection ID. - **/ - public int getID() - { - return connectionID_; - } - - /** - Returns the session ID for connection. - @return The session ID. - **/ - public long getSessionID() - { - return sessionID_; - } - - - /** - Returns the number of seconds elapsed since the connection was established. - @return The connect time. - **/ - public int getAge() - { - return connectTime_; - } - - - /** - Returns the number of files that are open currently (on the connection). - @return The number of files open. - **/ - public int getNumberOfFilesOpen() - { - return numberOfFilesOpen_; - } - - - /** - Returns the network name of the resource. - If the resource type is {@link #SHARE SHARE}, this is the name of a share. - If the resource type is {@link #WORKSTATION WORKSTATION}, this is the name of a workstation. - @return The name of the share or workstation. - **/ - public String getName() - { - return resourceName_; - } - - - /** - Returns the type of resource for this connection. - Possible values are {@link #WORKSTATION WORKSTATION} and {@link #SHARE SHARE}. - @return The resource type. - **/ - public int getResourceType() - { - return resourceType_; - } - - - - /** - Returns the type of the connection made from the workstation to the shared resource. - Possible values are {@link #DISK_DRIVE DISK_DRIVE} and {@link #SPOOLED_OUTPUT_QUEUE SPOOLED_OUTPUT_QUEUE}. - @return The connection type. - **/ - public int getConnectionType() - { - return connectionType_; - } - - - /** - Returns the name of the user that is associated with the connection. - @return The user name. - **/ - public String getUserName() - { - return userName_; - } - - - /** - Returns the number of current users on the connection. - @return The number of users. - **/ - public int getNumberOfUsers() - { - return numberOfUsers_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/ISeriesNetServerFileShare.java b/cvsroot/src/com/ibm/as400/access/ISeriesNetServerFileShare.java deleted file mode 100644 index d495ada3e..000000000 --- a/cvsroot/src/com/ibm/as400/access/ISeriesNetServerFileShare.java +++ /dev/null @@ -1,270 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ISeriesNetServerFileShare.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -/** - The ISeriesNetServerFileShare class represents a NetServer file share. - **/ -public class ISeriesNetServerFileShare extends ISeriesNetServerShare -{ - static final long serialVersionUID = 1L; - - /** - Value of the "maximum number of users" attribute, indicating "no maximum". - **/ - public final static int NO_MAX = -1; - - - /** - Value of the "current number of users" attribute, indicating that the system was unable to retrieve the actual value. - **/ - public final static int UNKNOWN = -1; - - /** - Value of the "permission" attribute, indicating read-only permission. - **/ - public final static int READ_ONLY = 1; - - /** - Value of the "permission" attribute, indicating read-write permission. - **/ - public final static int READ_WRITE = 2; - - /** - Value of the "text conversion enablement" attribute, indicating "text conversion not enabled". - **/ - public final static int NOT_ENABLED = 0; - - /** - Value of the "text conversion enablement" attribute, indicating "text conversion is enabled". - **/ - public final static int ENABLED = 1; - - /** - Value of the "text conversion enablement" attribute, indicating "text conversion is enabled, and mixed data is allowed". - **/ - public final static int ENABLED_AND_MIXED = 2; - - // Note: For efficiency, these attributes are not private, so they are directly accessible by the ISeriesNetServer class when composing and refreshing share objects. - String path_; - int permissions_; - int maxNumberOfUsers_; - int curNumberOfUsers_; // Note: This attribute has a getter but no setter. - - // The following attributes use optional parameters of the "Change File Server Share" API. - int ccsidForTextConversion_; - String textConversionEnablement_; // "0", "1", or "2" - String[] fileExtensions_; - - - - ISeriesNetServerFileShare(String shareName, int permissions, int maxUsers, int currentUsers, String description, String path, int ccsid, String enableConversion, String[] fileExtensions) - { - setAttributeValues(shareName, permissions, maxUsers, currentUsers, description, path, ccsid, enableConversion, fileExtensions); - } - - - // This method does no argument validity checking, nor does it update attributes on server. - // For use by ISeriesNetServer class when composing lists of shares. - void setAttributeValues(String shareName, int permissions, int maxUsers, int currentUsers, String description, String path, int ccsid, String enableConversion, String[] fileExtensions) - { - super.setAttributeValues(shareName, description, true); - path_ = path; - permissions_ = permissions; - maxNumberOfUsers_ = maxUsers; - curNumberOfUsers_ = currentUsers; - ccsidForTextConversion_ = ccsid; - textConversionEnablement_ = enableConversion; - fileExtensions_ = fileExtensions; - } - - - /** - Gets the path in the integrated file system to be shared with the network. - @return The path. - **/ - public String getPath() - { - return path_; - } - - - /** - Sets the path in the integrated file system to be shared with the network. A forward slash, '/', is required as the first character. - @param path The path. - **/ - public void setPath(String path) - { - if (path == null) throw new NullPointerException("path"); - path_ = path.trim(); - } - - /** - Gets the access available from the network for this share. - Possible values are {@link #READ_ONLY READ_ONLY} and {@link #READ_WRITE READ_WRITE}. - @return The permission for the share. - **/ - public int getPermissions() - { - return permissions_; - } - - /** - Sets the access available from the network for this share. - Valid values are {@link #READ_ONLY READ_ONLY} and {@link #READ_WRITE READ_WRITE}. - **/ - public void setPermissions(int permissions) - { - if (permissions != READ_ONLY && permissions != READ_WRITE) { - throw new ExtendedIllegalArgumentException(Integer.toString(permissions), ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - permissions_ = permissions; - } - - /** - Gets the maximum number of concurrent connections that the share can accommodate. - A value of {@link #NO_MAX NO_MAX} indicates that there is no limit. - A value of 0 indicates that the share is unavailable for use. - @return The maximum number of users. - **/ - public int getMaximumNumberOfUsers() - { - return maxNumberOfUsers_; - } - - /** - Sets the maximum number of concurrent connections that the share can accommodate. - A value of {@link #NO_MAX NO_MAX} indicates that there is no limit. - A value of 0 indicates that the share is unavailable for use. - @param maximumUsers The maximum number of users. - **/ - public void setMaximumNumberOfUsers(int maximumUsers) - { - if (maximumUsers < NO_MAX) { - throw new ExtendedIllegalArgumentException(Integer.toString(maximumUsers), ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - maxNumberOfUsers_ = maximumUsers; - } - - - /** - Gets the number of connections that are currently made to the share. - A value of {@link #UNKNOWN UNKNOWN} means that the system was unable to retrieve the value. - @return The current number of users. - **/ - public int getCurrentNumberOfUsers() - { - return curNumberOfUsers_; - } - // Note: There is no setter for the "current number of users" attribute. - - - - /** - Gets the value of the "enable text conversion" attribute. - Possible values are {@link #ENABLED ENABLED}, {@link #NOT_ENABLED NOT_ENABLED}, and {@link #ENABLED_AND_MIXED ENABLED_AND_MIXED}. - @return The text conversion enablement. - **/ - public int getTextConversionEnablement() - { - switch (textConversionEnablement_.charAt(0)) { - case '0' : return NOT_ENABLED; // text conversion is not enabled - case '1' : return ENABLED; // text conversion is enabled - default : return ENABLED_AND_MIXED; // text conversion is enabled, and mixed data is allowed - } - } - - - /** - Sets the value of the "enable text conversion" attribute. - Valid values are {@link #ENABLED ENABLED}, {@link #NOT_ENABLED NOT_ENABLED}, and {@link #ENABLED_AND_MIXED ENABLED_AND_MIXED}. - @param enablement The text conversion enablement. - **/ - public void setTextConversionEnablement(int enablement) - { - if (enablement < NOT_ENABLED || enablement > ENABLED_AND_MIXED) { - throw new ExtendedIllegalArgumentException(Integer.toString(enablement), ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - char[] charArray = new char[1]; - switch (enablement) { - case NOT_ENABLED : charArray[0] = '0'; break; - case ENABLED : charArray[0] = '1'; break; - default : charArray[0] = '2'; - } - textConversionEnablement_ = new String(charArray); - // We'll need to use the 2nd optional parm on the API. - numOptionalParmsToSet_ = Math.max(numOptionalParmsToSet_, 2); - } - - - /** - Gets the client CCSID that is used for text file data conversion. Text file data conversion is performed using this CCSID and the current CCSID of the system file. - @return The CCSID that is used for text file data conversion. - **/ - public int getCcsidForTextConversion() - { - return ccsidForTextConversion_; - } - - - /** - Sets the client CCSID that is used for text file data conversion. Text file data conversion is performed using this CCSID and the current CCSID of the system file. - A value of 0 indicates that the user would like to use the currently configured CCSID for the system. - @param ccsid The CCSID that is used for text file data conversion. - **/ - public void setCcsidForTextConversion(int ccsid) - { - if (ccsid < 0) { - throw new ExtendedIllegalArgumentException(Integer.toString(ccsid), ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - ccsidForTextConversion_ = ccsid; - // We'll need to use the 1st optional parm on the API. - numOptionalParmsToSet_ = Math.max(numOptionalParmsToSet_, 1); - } - - - /** - Gets the list of file extensions for the share. The file extensions list determines which files are converted by the system. - @return The file extensions list. - **/ - public String[] getFileExtensions() - { - String[] copyOfList = new String[fileExtensions_.length]; - System.arraycopy(fileExtensions_, 0, copyOfList, 0, fileExtensions_.length); - return copyOfList; - } - - - /** - Sets the list of file extensions for the share. The file extensions list determines which files are converted by the system. - @param extensions The file extensions list. - **/ - public void setFileExtensions(String[] extensions) - { - if (extensions == null) throw new NullPointerException("extensions"); - - fileExtensions_ = new String[extensions.length]; - for (int i=0; i 10) { - throw new ExtendedIllegalArgumentException(name, ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - // Set the queue name in the first 10 chars of qualified queue name. - StringBuffer buff = new StringBuffer(outputQueue_); - buff.replace(0,10," "); - buff.replace(0,name.length(),name); - - outputQueue_ = buff.toString(); - } - - /** - Sets the name of the library containing the output queue associated with the share. - @param name The library containing the output queue. - **/ - public void setOutputQueueLibrary(String name) - { - if (name == null) throw new NullPointerException("name"); - name = name.trim(); - if (name.length() > 10) { - throw new ExtendedIllegalArgumentException(name, ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - // Set the queue library in the second 10 chars of qualified queue name. - StringBuffer buff = new StringBuffer(outputQueue_); - buff.replace(10,20," "); - buff.replace(10,10+name.length(),name); - - outputQueue_ = buff.toString(); - } - - - /** - Returns the text string that identifies the print driver appropriate for this share. - When personal computers connect to this shared printer, this identifies the print driver they should use. - @return The print driver. - **/ - public String getPrintDriver() - { - return printDriver_; - } - - - /** - Sets the text string that identifies the print driver appropriate for this share. - When personal computers connect to this shared printer, this identifies the print driver they should use. This text should match the name of a print driver known to the personal computer operating system. - @param printDriver The print driver. - **/ - public void setPrintDriver(String printDriver) - { - if (printDriver == null) throw new NullPointerException("printDriver"); - - printDriver_ = printDriver; - } - - - /** - Returns the name of the printer file associated with the share. - @return The name of the printer file. - **/ - public String getPrinterFileName() - { - // Extract printer file name from first 10 chars of qualified printer file name. - return printerFile_.substring(0,10).trim(); - } - - - /** - Returns the name of the library containing the printer file associated with the share. - @return The library containing the printer file. - **/ - public String getPrinterFileLibrary() - { - // Extract printer file library from second 10 chars of qualified printer file name. - return printerFile_.substring(10,20).trim(); - } - - /** - Sets the name of the printer file associated with the share. - @param name The name of the printer file. - **/ - public void setPrinterFileName(String name) - { - if (name == null) throw new NullPointerException("name"); - name = name.trim(); - if (name.length() > 10) { - throw new ExtendedIllegalArgumentException(name, ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - // Set the printer file name in the first 10 chars of qualified printer file name. - StringBuffer buff = new StringBuffer(printerFile_); - buff.replace(0,10," "); - buff.replace(0,name.length(),name); - - printerFile_ = buff.toString(); - // We'll need to use the 1st optional parm on the API. - numOptionalParmsToSet_ = Math.max(numOptionalParmsToSet_, 1); - } - - /** - Sets the name of the library containing the printer file associated with the share. - @param name The library containing the printer file. - **/ - public void setPrinterFileLibrary(String name) - { - if (name == null) throw new NullPointerException("name"); - name = name.trim(); - if (name.length() > 10) { - throw new ExtendedIllegalArgumentException(name, ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - // Set the printer file library in the second 10 chars of qualified printer file name. - StringBuffer buff = new StringBuffer(printerFile_); - buff.replace(10,20," "); - buff.replace(10,10+name.length(),name); - - printerFile_ = buff.toString(); - // We'll need to use the 1st optional parm on the API. - numOptionalParmsToSet_ = Math.max(numOptionalParmsToSet_, 1); - } - - - /** - Returns the value of the "publish print share" attribute. - This attribute indicates whether the print share is to be published. - true indicates that the print share is published. - @return The "publish print share" attribute. - **/ - public boolean isPublished() - { - return isPublished_; - } - - - /** - Sets the value of the "publish print share" attribute. - This attribute indicates whether the print share is to be published. - true indicates that the print share is published. - @param isPublished The "publish print share" attribute. - **/ - public void setPublished(boolean isPublished) - { - isPublished_ = isPublished; - // We'll need to use the 2nd optional parm on the API. - numOptionalParmsToSet_ = Math.max(numOptionalParmsToSet_, 2); - } - - - /** - Returns the spooled file type for the share. - This specifies the type of spooled files that are created by using this share. - Possible values are {@link #AFP AFP}, {@link #AUTO_DETECT AUTO_DETECT}, {@link #SCS SCS}, and {@link #USER_ASCII USER_ASCII}. - - @return The spooled file type. - **/ - public int getSpooledFileType() - { - return spooledFileType_; - } - - /** - Sets the spooled file type for the share. - This specifies the type of spooled files that are created by using this share. - Valid values are {@link #AFP AFP}, {@link #AUTO_DETECT AUTO_DETECT}, {@link #SCS SCS}, and {@link #USER_ASCII USER_ASCII}. - - @param spooledFileType The spooled file type. - **/ - public void setSpooledFileType(int spooledFileType) - { - if (spooledFileType < USER_ASCII || spooledFileType > AUTO_DETECT) { - throw new ExtendedIllegalArgumentException(Integer.toString(spooledFileType), ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - spooledFileType_ = spooledFileType; - } - -} - - diff --git a/cvsroot/src/com/ibm/as400/access/ISeriesNetServerSession.java b/cvsroot/src/com/ibm/as400/access/ISeriesNetServerSession.java deleted file mode 100644 index 20d28c81b..000000000 --- a/cvsroot/src/com/ibm/as400/access/ISeriesNetServerSession.java +++ /dev/null @@ -1,200 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ISeriesNetServerSession.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -/** - The ISeriesNetServerSession class represents a NetServer session. -

    - Note: A session (represented by this class) corresponds to a workstation. A workstation could be a Windows Terminal Server or it could be a single PC on someone's desktop. A connection (represented by class {@link NetServerConnection NetServerConnection}) corresponds to a specific user who has mapped a drive and has files opened or spooled output on a print queue. Since a session can have multiple users, a connection shows a particular user's statistics on that session. -

    - ISeriesNetServerSession objects are created and returned by {@link ISeriesNetServer#listSessions() listSessions()} and {@link ISeriesNetServer#listSessionsForWorkstation(String) listSessionsForWorkstation()}. - -

    -
    -* import com.ibm.as400.access.*;
    -*
    -* // Create an ISeriesNetServer object for a specific system.
    -* AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -* ISeriesNetServer ns = new ISeriesNetServer(system);
    -*
    -* try
    -* {
    -*   // List all current sessions.
    -*   System.out.println("Sessions:");
    -*   ISeriesNetServerSession[] sessionList = ns.listSessions();
    -*   for (int i=0; i<sessionList.length; i++)
    -*   {
    -*     ISeriesNetServerSession session = sessionList[i];
    -*     System.out.println(session.getName() + ": " +
    -*       session.getUserName() + "; " +
    -*       session.getAge() + "; " +
    -*       session.isGuest() );
    -*   }
    -* }
    -* catch (AS400Exception e) {
    -*   AS400Message[] messageList = e.getAS400MessageList();
    -*   for (int i=0; i<messageList.length; i++) {
    -*     System.out.println(messageList[i].getText());
    -*   }
    -* }
    -* catch (Exception e) {
    -*   e.printStackTrace();
    -* }
    -* finally {
    -*   if (system != null) system.disconnectAllServices();
    -* }
    -
    -
    - -**/ - - -public class ISeriesNetServerSession implements java.io.Serializable -{ - static final long serialVersionUID = 1L; - - // Private data. - - private String workstationName_; // Uniquely identifies a session on the system. - private long sessionID_; // This also uniquely identifies a session on the system. - private int numberOfConnections_; - private int sessionAge_; - private int numberOfFilesOpen_; - private int idleTime_; - private boolean isPasswordEncrypted_; - private boolean isGuestSession_; - private String userName_; - - - // This method is reserved for use by the ISeriesNetServer class. - ISeriesNetServerSession(String workstation, long sessionID, int numConnections, int sessionAge, int numFilesOpen, int idleTime, boolean isEncryptedPwd, boolean isGuest, String user) - { - setAttributeValues(workstation, sessionID, numConnections, sessionAge, numFilesOpen, idleTime, isEncryptedPwd, isGuest, user); - } - - - // This method is reserved for use by the ISeriesNetServer class. - void setAttributeValues(String workstation, long sessionID, int numConnections, int sessionAge, int numFilesOpen, int idleTime, boolean isEncryptedPwd, boolean isGuest, String user) - { - workstationName_ = workstation; - sessionID_ = sessionID; - numberOfConnections_ = numConnections; - sessionAge_ = sessionAge; - numberOfFilesOpen_ = numFilesOpen; - idleTime_ = idleTime; - isPasswordEncrypted_ = isEncryptedPwd; - isGuestSession_ = isGuest; - userName_ = user; - } - - - /** - Returns the name of the workstation from which the session to the system was established. - @return The workstation name. - **/ - public String getName() - { - return workstationName_; - } - - - /** - Returns the unique identifier for the system session. - Note: The session identifier was added to the NetServer API's in V5R1. - @return The session identifier. - **/ - public long getID() - { - return sessionID_; - } - - - /** - Returns the number of connections made during the session. - @return The number of connections. - **/ - public int getNumberOfConnections() - { - return numberOfConnections_; - } - - - /** - Returns the number of seconds that the session has been active. - @return The session time. - **/ - public int getAge() - { - return sessionAge_; - } - - - /** - Returns the number of files that are currently open for the session. - @return The files open count. - **/ - public int getNumberOfFilesOpen() - { - return numberOfFilesOpen_; - } - - - /** - Returns the number of seconds the session has been idle. - @return The session idle time. - **/ - public int getIdleTime() - { - return idleTime_; - } - - - /** - Indicates whether or not the encrypted password was used to establish the session. - @return true if the encrypted password was used. - **/ - public boolean isPasswordEncrypted() - { - return isPasswordEncrypted_; - } - - - /** - Indicates whether or not the session is a guest session. - @return true if the session is a guest session. - **/ - public boolean isGuest() - { - return isGuestSession_; - } - - - /** - Returns the name of the user that is associated with the session. - @return The user name. - **/ - public String getUserName() - { - return userName_; - } - - - // Implementation note: The API's also define a "session count" attribute. - // This attribute represents the number of sessions that are established between the server and the requester. This value is always 0 or 1. - // Since this attribute seems to be of very limited value, we won't surface it unless someone says they need it. - -} diff --git a/cvsroot/src/com/ibm/as400/access/ISeriesNetServerShare.java b/cvsroot/src/com/ibm/as400/access/ISeriesNetServerShare.java deleted file mode 100644 index ff6f07ba6..000000000 --- a/cvsroot/src/com/ibm/as400/access/ISeriesNetServerShare.java +++ /dev/null @@ -1,78 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ISeriesNetServerShare.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -/** - The ISeriesNetServerShare class represents a NetServer share (either a file share or a print share). - **/ -public abstract class ISeriesNetServerShare implements java.io.Serializable -{ - - static final long serialVersionUID = 469818009548069269L; - - // Note: For efficiency, these attributes are not private, so they are directly accessible by the ISeriesNetServer class when composing and refreshing share objects. - String name_; // Note: This attribute has a getter but no setter. - String description_; - - // Provided for use by the ISeriesNetServer class: - boolean isFile_; // If it's not a file, then it's a printer. - - int numOptionalParmsToSet_ = 0; - - - // This method does no argument validity checking, nor does it update attributes on server. - void setAttributeValues(String shareName, String description, boolean isFile) - { - name_ = shareName; - description_ = description; - isFile_ = isFile; - } - - - /** - Returns the name of the share. - @return The name of the share. - **/ - public String getName() - { - return name_; - } - - // Note: We provide no setter for the "name" attribute, since the NetServer API's don't support changing the name of a share after it's created. - - - /** - Returns the text description of the share. - @return The description of the share. - **/ - public String getDescription() - { - return description_; - } - - - /** - Sets the text description of the share. - @param description The description of the share. - **/ - public void setDescription(String description) - { - if (description == null) throw new NullPointerException("path"); - description_ = description.trim(); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/ISeriesPrinter.java b/cvsroot/src/com/ibm/as400/access/ISeriesPrinter.java deleted file mode 100644 index 3fae2a480..000000000 --- a/cvsroot/src/com/ibm/as400/access/ISeriesPrinter.java +++ /dev/null @@ -1,1748 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ISeriesPrinter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.Serializable; -import java.util.Calendar; -import java.util.Date; - -/** - Represents a printer attached to an IBM i system. This class provides access to the specified printer's attributes via the QGYRPRTA system API. -

    This class uses the remote command host server to obtain printer information. Use the {@link com.ibm.as400.access.Printer Printer} class to retrieve similer information using the network print host server. -

    Example: -

    -     AS400 system = new AS400("mySystem", "myUserID", "myPassword");
    -     ISeriesPrinter printer = new ISeriesPrinter(system, "myPrinter");
    -     String type = printer.getPrinterDeviceType();
    -     if (type == ISeriesPrinter.PRINTER_DEVICE_TYPE_SCS)
    -     {
    -         System.out.println(printer.getCopiesLeft());
    -     }
    - 
    - @see com.ibm.as400.access.Printer - **/ -// TBD: Add the following javadoc when ConfigurationDescriptionList class is created: -//

    To determine a list of printer device descriptions on the IBM i system, use the {@link com.ibm.as400.access.config.ConfigurationDescriptionList ConfigurationDescriptionList} class. -// TBD: Add the following javadoc when config classes are created: -// @see com.ibm.as400.access.config.ConfigurationDescriptionList -// @see com.ibm.as400.access.config.PrinterDeviceDescription -public class ISeriesPrinter implements Serializable -{ - static final long serialVersionUID = -609299009457592116L; - - /** - Device status constant indicating the device is in the varied off status. Constant has a value of 0. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_VARIED_OFF = 0; - - /** - Device status constant indicating the device is in the AS/36 disabled status. Constant has a value of 5. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_AS36_DISABLED = 5; - - /** - Device status constant indicating the device is in the vary off pending status. Constant has a value of 10. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_VARY_OFF_PENDING = 10; - - /** - Device status constant indicating the device is in the vary on pending status. Constant has a value of 20. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_VARY_ON_PENDING = 20; - - /** - Device status constant indicating the device is in the varied on status. Constant has a value of 30. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_VARIED_ON = 30; - - /** - Device status constant indicating the device is in the connect pending status. Constant has a value of 40. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_CONNECT_PENDING = 40; - - /** - Device status constant indicating the device is in the signon display status. Constant has a value of 50. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_SIGNON_DISPLAY = 50; - - /** - Device status constant indicating the device is in the active status. Constant has a value of 60. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_ACTIVE = 60; - - /** - Device status constant indicating the device is in the AS/36 enabled status. Constant has a value of 62. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_AS36_ENABLED = 62; - - /** - Device status constant indicating the device is in the active reader status. Constant has a value of 63. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_ACTIVE_READER = 63; - - /** - Device status constant indicating the device is in the active writer status. Constant has a value of 66. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_ACTIVE_WRITER = 66; - - /** - Device status constant indicating the device is in the held status. Constant has a value of 70. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_HELD = 70; - - /** - Device status constant indicating the device is in the powered off status. Constant has a value of 75. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_POWERED_OFF = 75; - - /** - Device status constant indicating the device is in the RCYPND status. Constant has a value of 80. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_RCYPND = 80; - - /** - Device status constant indicating the device is in the RCYCNL status. Constant has a value of 90. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_RCYCNL = 90; - - /** - Device status constant indicating the device is in the system request status. Constant has a value of 95. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_SYSTEM_REQUEST = 95; - - /** - Device status constant indicating the device is in the failed status. Constant has a value of 100. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_FAILED = 100; - - /** - Device status constant indicating the device is in the failed reader status. Constant has a value of 103. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_FAILED_READER = 103; - - /** - Device status constant indicating the device is in the failed writer status. Constant has a value of 106. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_FAILED_WRITER = 106; - - /** - Device status constant indicating the device is in the diagnostic mode status. Constant has a value of 110. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_DIAGNOSTIC_MODE = 110; - - /** - Device status constant indicating the device is in the damaged status. Constant has a value of 111. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_DAMAGED = 111; - - /** - Device status constant indicating the device is in the locked status. Constant has a value of 112. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_LOCKED = 112; - - /** - Device status constant indicating the device is in the unknown status. Constant has a value of 113. - @see #getDeviceStatus - **/ - public static final int DEVICE_STATUS_UNKNOWN = 113; - - - /** - Form alignment constant indicating that the writer determines when the message is sent. Constant has a value of "*WTR". - @see #getFormAlignmentMessageTime - **/ - public static final String FORM_ALIGNMENT_WRITER = "*WTR"; - - /** - Form alignment constant indicating that control of the page alignment is specified by each file. Constant has a value of "*FILE". - @see #getFormAlignmentMessageTime - **/ - public static final String FORM_ALIGNMENT_FILE = "*FILE"; - - - /** - Form type constant indicating that the writer is started with the option to print all spooled files of any form type. Constant has a value of "*ALL". - @see #getFormType - **/ - public static final String FORM_TYPE_ALL = "*ALL"; - - /** - Form type constant indicating that the writer is started with the option to print all the spooled files with the same form type before using a different form type. Constant has a value of "*FORMS". - @see #getFormType - **/ - public static final String FORM_TYPE_FORMS = "*FORMS"; - - /** - Form type constant indicating that the writer is started with the option to print all the spooled files with a form type of *STD. Constant has a value of "*STD". - @see #getFormType - **/ - public static final String FORM_TYPE_STANDARD = "*STD"; - - - /** - Message option constant indicating that a message is sent to the message queue. Constant has a value of "*MSG". - @see #getMessageOption - **/ - public static final String MESSAGE_OPTION_STANDARD = "*MSG"; - - /** - Message option constant indicating that no message is sent to the message queue. Constant has a value of "*NOMSG". - @see #getMessageOption - **/ - public static final String MESSAGE_OPTION_NONE = "*NOMSG"; - - /** - Message option constant indicating that an informational message is sent to the message queue. Constant has a value of "*INFOMSG". - @see #getMessageOption - **/ - public static final String MESSAGE_OPTION_INFO = "*INFOMSG"; - - /** - Message option constant indicating that an inquiry message is sent to the message queue. Constant has a value of "*INQMSG". - @see #getMessageOption - **/ - public static final String MESSAGE_OPTION_INQUIRY = "*INQMSG"; - - - /** - Output queue status constant indicating that the output queue is held. Constant has an EBCDIC value of "H". - @see #getOutputQueueStatus - **/ - public static final int OUTPUT_QUEUE_STATUS_HELD = 0x00C8; // 'H' - - /** - Output queue status constant indicating that the output queue is released. Constant has an EBCDIC value of "R". - @see #getOutputQueueStatus - **/ - public static final int OUTPUT_QUEUE_STATUS_RELEASED = 0x00D9; // 'R' - - - /** - Overall status constant indicating that overall status of the logical printer is unavailable. Constant has a value of 1. - @see #getOverallStatus - **/ - public static final int OVERALL_STATUS_UNAVAILABLE = 1; - - /** - Overall status constant indicating that overall status of the logical printer is powered off or not yet available. Constant has a value of 2. - @see #getOverallStatus - **/ - public static final int OVERALL_STATUS_NOT_YET_AVAILABLE = 2; - - /** - Overall status constant indicating that overall status of the logical printer is stopped. Constant has a value of 3. - @see #getOverallStatus - **/ - public static final int OVERALL_STATUS_STOPPED = 3; - - /** - Overall status constant indicating that overall status of the logical printer is message waiting. Constant has a value of 4. - @see #getOverallStatus - **/ - public static final int OVERALL_STATUS_MESSAGE_WAITING = 4; - - /** - Overall status constant indicating that overall status of the logical printer is held. Constant has a value of 5. - @see #getOverallStatus - **/ - public static final int OVERALL_STATUS_HELD = 5; - - /** - Overall status constant indicating that overall status of the logical printer is stop (pending). Constant has a value of 6. - @see #getOverallStatus - **/ - public static final int OVERALL_STATUS_STOP_PENDING = 6; - - /** - Overall status constant indicating that overall status of the logical printer is hold (pending). Constant has a value of 7. - @see #getOverallStatus - **/ - public static final int OVERALL_STATUS_HOLD_PENDING = 7; - - /** - Overall status constant indicating that overall status of the logical printer is waiting for printer. Constant has a value of 8. - @see #getOverallStatus - **/ - public static final int OVERALL_STATUS_WAITING_FOR_PRINTER = 8; - - /** - Overall status constant indicating that overall status of the logical printer is waiting to start. Constant has a value of 9. - @see #getOverallStatus - **/ - public static final int OVERALL_STATUS_WAITING_TO_START = 9; - - /** - Overall status constant indicating that overall status of the logical printer is printing. Constant has a value of 10. - @see #getOverallStatus - **/ - public static final int OVERALL_STATUS_PRINTING = 10; - - /** - Overall status constant indicating that overall status of the logical printer is waiting for printer output. Constant has a value of 11. - @see #getOverallStatus - **/ - public static final int OVERALL_STATUS_WAITING_FOR_PRINTER_OUTPUT = 11; - - /** - Overall status constant indicating that overall status of the logical printer is connect pending. Constant has a value of 12. - @see #getOverallStatus - **/ - public static final int OVERALL_STATUS_CONNECT_PENDING = 12; - - /** - Overall status constant indicating that overall status of the logical printer is powered off. Constant has a value of 13. - @see #getOverallStatus - **/ - public static final int OVERALL_STATUS_POWERED_OFF = 13; - - /** - Overall status constant indicating that overall status of the logical printer is unusable. Constant has a value of 14. - @see #getOverallStatus - **/ - public static final int OVERALL_STATUS_UNUSABLE = 14; - - /** - Overall status constant indicating that overall status of the logical printer is being serviced. Constant has a value of 15. - @see #getOverallStatus - **/ - public static final int OVERALL_STATUS_BEING_SERVICED = 15; - - /** - Overall status constant indicating that overall status of the logical printer is unknown. Constant has a value of 999. - @see #getOverallStatus - **/ - public static final int OVERALL_STATUS_UNKNOWN = 999; - - - /** - Pending status constant indicating that no command was issued. Constant has an EBCDIC value of "N". - @see #getEndPendingStatus - @see #getHoldPendingStatus - **/ - public static final int PENDING_STATUS_NONE = 0x00D5; // 'N' - - /** - Pending status constant indicating that the writer ends as soon as its output buffers are empty (*IMMED). Constant has an EBCDIC value of "I". - @see #getEndPendingStatus - @see #getHoldPendingStatus - **/ - public static final int PENDING_STATUS_IMMEDIATE = 0x00C9; // 'I' - - /** - Pending status constant indicating that the writer ends after the current copy of the spooled file has been printed (*CNTRLD). Constant has an EBCDIC value of "C". - @see #getEndPendingStatus - @see #getHoldPendingStatus - **/ - public static final int PENDING_STATUS_CONTROLLED = 0x00C3; // 'C' - - /** - Pending status constant indicating that the writer ends at the end of the page (*PAGEEND). Constant has an EBCDIC value of "P". - @see #getEndPendingStatus - @see #getHoldPendingStatus - **/ - public static final int PENDING_STATUS_PAGE_END = 0x00D7; // 'P' - - - /** - Printer device type constant indicating that the type of the printer is SNA (Systems Network Architecture) character string. Constant has a value of "*SCS". - @see #getPrinterDeviceType - **/ - public static final String PRINTER_DEVICE_TYPE_SCS = "*SCS"; - - /** - Printer device type constant indicating that the type of the printer is Intelligent Printer Data Stream. Constant has a value of "*IPDS". - @see #getPrinterDeviceType - **/ - public static final String PRINTER_DEVICE_TYPE_IPDS = "*IPDS"; - - - /** - Writer status constant indicating that the status of the writer is started. Constant has a value of 1. - @see #getWriterStatus - **/ - public static final int WRITER_STATUS_STARTED = 0x01; - - /** - Writer status constant indicating that the status of the writer is ended. Constant has a value of 2. - @see #getWriterStatus - **/ - public static final int WRITER_STATUS_ENDED = 0x02; - - /** - Writer status constant indicating that the status of the writer is on job queue. Constant has a value of 3. - @see #getWriterStatus - **/ - public static final int WRITER_STATUS_ON_JOB_QUEUE = 0x03; - - /** - Writer status constant indicating that the status of the writer is held. Constant has a value of 4. - @see #getWriterStatus - **/ - public static final int WRITER_STATUS_HELD = 0x04; - - /** - Writer status constant indicating that the status of the writer is message waiting. Constant has a value of 5. - @see #getWriterStatus - **/ - public static final int WRITER_STATUS_MESSAGE_WAITING = 0x05; - - - /** - Writer time constant indicating that the action will occur when there are no ready spooled files. Constant has a value of "*NORDYF". - @see #getWriterChangeTime - @see #getWriterEndTime - **/ - public static final String WRITER_TIME_ALL_DONE = "*NORDYF"; - - /** - Writer time constant indicating that the action will occur when the current spooled file has been printed. Constant has a value of "*FILEEND". - @see #getWriterChangeTime - @see #getWriterEndTime - **/ - public static final String WRITER_TIME_CURRENT_DONE = "*FILEEND"; - - /** - Writer time constant indicating that the action will not occur, it will wait for more spooled files. Constant has a value of "*NO". - @see #getWriterChangeTime - @see #getWriterEndTime - **/ - public static final String WRITER_TIME_WAIT = "*NO"; - - /** - Writer time constant indicating that there are no pending changes to the writer. Constant has a value of "". - @see #getWriterChangeTime - @see #getWriterEndTime - **/ - public static final String WRITER_TIME_NONE = ""; - - - /** - Writing status constant indicating that the writer is in writing status. Constant has an EBCDIC value of "Y". - @see #getWritingStatus - **/ - public static final int WRITING_STATUS_WRITING = 0x00E8; // 'Y' - - /** - Writing status constant indicating that the writer is not in writing status. Constant has an EBCDIC value of "N". - @see #getWritingStatus - **/ - public static final int WRITING_STATUS_NOT_WRITING = 0x00D5; // 'N' - - /** - Writing status constant indicating that the writer is writing the file separators. Constant has an EBCDIC value of "S". - @see #getWritingStatus - **/ - public static final int WRITING_STATUS_FILE_SEPARATORS = 0x00E2; // 'S' - - - // The server where the printer is located. - private AS400 system_; - // Printer name. - private String name_; - // Flag that indicates that all properties were set by refresh(). - private boolean refreshed_ = false; - - private boolean writerStarted_; - private int writerStatus_; - private int deviceStatus_; - private int overallStatus_; - private String description_; // Text description. - private String starterUser_; // Started by user. - private int writingStatus_; - private boolean waitingForMessage_; // Waiting for message status. - private boolean held_; // Held status. - private int endPendingStatus_; - private int holdPendingStatus_; - private boolean betweenFiles_; // Between files status. - private boolean betweenCopies_; // Between copies status. - private boolean waitingForData_; // Waiting for data status. - private boolean waitingForDevice_; // Waiting for device status. - private boolean onJobQueue_; // On job queue status. - private String writerJobName_; - private String writerJobUser_; // Writer job user name. - private String writerJobNumber_; - private String printerDeviceType_; - private int numberOfSeparators_; - private int separatorDrawer_; // Drawer for separators. - private String formAlignmentMessageTime_; // Align forms. - private String outputQueueName_; - private String outputQueueLibraryName_; - private int outputQueueStatus_; - private boolean publishedInNetworkDirectory_; // Network directory publishing status. - private String formType_; - private String messageOption_; - private String writerEndTime_; // Automatically end writer. - private boolean allowsDirectPrinting_; // Allow direct printing. - private String messageQueueName_; - private String messageQueueLibraryName_; - private String writerChangeTime_; // Changes take effect. - private String pendingOutputQueueName_; // Next output queue name. - private String pendingOutputQueueLibraryName_; // Next output queue library name. - private String pendingFormType_; // Next form type. - private String pendingMessageOption_; // Next message option. - private int pendingNumberOfSeparators_; // Next file separators. - private int pendingSeparatorDrawer_; // Next separator drawer. - private String spooledFileName_; - private String spooledFileJobName_; // Job name. - private String spooledFileJobUser_; // User name. - private String spooledFileJobNumber_; // Job number. - private int spooledFileNumber_; - private int pageBeingWritten_; - private int totalPages_; - private int copiesLeft_; // Copies left to produce. - private int totalCopies_; - private boolean supportsAFP_; // Advanced function printing. - private byte[] writerMessageKey_; // Message key. - private String spooledFileJobSystem_; // Job system name. - private String spooledFileCreationDate_; // Spooled file create date. - private String spooledFileCreationTime_; // Spooled file create time. - - /** - Constructs an ISeriesPrinter object with the specified name. If a printer with the specified name does not exist on the specified system, an exception will be thrown when {@link #refresh refresh()} is called, either implicitly or explicitly. - @param system The system object representing the system on which the printer exists. - @param name The name of the printer. - **/ - public ISeriesPrinter(AS400 system, String name) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing ISeriesPrinter object, system: " + system + ", name: " + name); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (name == null) - { - Trace.log(Trace.ERROR, "Parameter 'name' is null."); - throw new NullPointerException("name"); - } - if (name.length() > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'name' is not valid: '" + name + "'"); - throw new ExtendedIllegalArgumentException("name (" + name + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - system_ = system; - name_ = name.toUpperCase().trim(); - } - - /** - Returns whether or not the printer writer allows the printer to be allocated to a job that prints directly to the printer. - @return true if direct printing is allowed; false if it is not allowed. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean allowsDirectPrinting() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return allowsDirectPrinting_; - } - - /** - Returns whether or not the specified object is equal to this object. - @return true if the specified object is an ISeriesPrinter and the following contract is true: -

    -         obj.getSystem().equals(this.getSystem()) && obj.getName().equals(this.getName())
    -     
    - Otherwise, false is returned. - **/ - public boolean equals(Object obj) - { - if (obj instanceof ISeriesPrinter) - { - ISeriesPrinter p = (ISeriesPrinter)obj; - return p.system_.equals(system_) && p.name_.equals(name_); - } - return false; - } - - /** - Returns the number of copies left to be printed. - @return The number of copies left, or 0 if no file is printing. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getCopiesLeft() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return copiesLeft_; - } - - /** - Returns the text description of the printer device. - @return The text description. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getDescription() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return description_; - } - - /** - Returns the status of the printer device. - Possible values are: -
      -
    • {@link #DEVICE_STATUS_VARIED_OFF DEVICE_STATUS_VARIED_OFF} -
    • {@link #DEVICE_STATUS_AS36_DISABLED DEVICE_STATUS_AS36_DISABLED} -
    • {@link #DEVICE_STATUS_VARY_OFF_PENDING DEVICE_STATUS_VARY_OFF_PENDING} -
    • {@link #DEVICE_STATUS_VARY_ON_PENDING DEVICE_STATUS_VARY_ON_PENDING} -
    • {@link #DEVICE_STATUS_VARIED_ON DEVICE_STATUS_VARIED_ON} -
    • {@link #DEVICE_STATUS_CONNECT_PENDING DEVICE_STATUS_CONNECT_PENDING} -
    • {@link #DEVICE_STATUS_SIGNON_DISPLAY DEVICE_STATUS_SIGNON_DISPLAY} -
    • {@link #DEVICE_STATUS_ACTIVE DEVICE_STATUS_ACTIVE} -
    • {@link #DEVICE_STATUS_AS36_ENABLED DEVICE_STATUS_AS36_ENABLED} -
    • {@link #DEVICE_STATUS_ACTIVE_READER DEVICE_STATUS_ACTIVE_READER} -
    • {@link #DEVICE_STATUS_ACTIVE_WRITER DEVICE_STATUS_ACTIVE_WRITER} -
    • {@link #DEVICE_STATUS_HELD DEVICE_STATUS_HELD} -
    • {@link #DEVICE_STATUS_POWERED_OFF DEVICE_STATUS_POWERED_OFF} -
    • {@link #DEVICE_STATUS_RCYPND DEVICE_STATUS_RCYPND} -
    • {@link #DEVICE_STATUS_RCYCNL DEVICE_STATUS_RCYCNL} -
    • {@link #DEVICE_STATUS_SYSTEM_REQUEST DEVICE_STATUS_SYSTEM_REQUEST} -
    • {@link #DEVICE_STATUS_FAILED DEVICE_STATUS_FAILED} -
    • {@link #DEVICE_STATUS_FAILED_READER DEVICE_STATUS_FAILED_READER} -
    • {@link #DEVICE_STATUS_FAILED_WRITER DEVICE_STATUS_FAILED_WRITER} -
    • {@link #DEVICE_STATUS_DIAGNOSTIC_MODE DEVICE_STATUS_DIAGNOSTIC_MODE} -
    • {@link #DEVICE_STATUS_DAMAGED DEVICE_STATUS_DAMAGED} -
    • {@link #DEVICE_STATUS_LOCKED DEVICE_STATUS_LOCKED} -
    • {@link #DEVICE_STATUS_UNKNOWN DEVICE_STATUS_UNKNOWN} -
    - @return The printer device status. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getDeviceStatus() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return deviceStatus_; - } - - /** - Returns whether an End Writer (ENDWTR) command has been issued for this writer. - Possible values are: -
      -
    • {@link #PENDING_STATUS_NONE PENDING_STATUS_NONE} - No ENDWTR command was issued. -
    • {@link #PENDING_STATUS_IMMEDIATE PENDING_STATUS_IMMEDIATE} - The writer ends as soon as its output buffers are empty. -
    • {@link #PENDING_STATUS_CONTROLLED PENDING_STATUS_CONTROLLED} - The writer ends after the current copy of the spooled file has been printed. -
    • {@link #PENDING_STATUS_PAGE_END PENDING_STATUS_PAGE_END} - The writer ends at the end of the page. -
    - @return The pending status. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getEndPendingStatus() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return endPendingStatus_; - } - - /** - Returns the time at which the forms alignment message will be sent. - Possible values are: -
      -
    • {@link #FORM_ALIGNMENT_WRITER FORM_ALIGNMENT_WRITER} -
    • {@link #FORM_ALIGNMENT_FILE FORM_ALIGNMENT_FILE} -
    - @return The form alignment message setting. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getFormAlignmentMessageTime() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return formAlignmentMessageTime_; - } - - /** - Returns the type of form being used to print the spooled file. - Possible values are: -
      -
    • {@link #FORM_TYPE_ALL FORM_TYPE_ALL} -
    • {@link #FORM_TYPE_FORMS FORM_TYPE_FORMS} -
    • {@link #FORM_TYPE_STANDARD FORM_TYPE_STANDARD} -
    • A user-specified form type. -
    - @return The form type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getFormType() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return formType_; - } - - /** - Returns whether a Hold Writer (HLDWTR) command has been issued for this writer. - Possible values are: -
      -
    • {@link #PENDING_STATUS_NONE PENDING_STATUS_NONE} - No HLDWTR command was issued. -
    • {@link #PENDING_STATUS_IMMEDIATE PENDING_STATUS_IMMEDIATE} - The writer is held as soon as its output buffers are empty. -
    • {@link #PENDING_STATUS_CONTROLLED PENDING_STATUS_CONTROLLED} - The writer is held after the current copy of the file has been printed. -
    • {@link #PENDING_STATUS_PAGE_END PENDING_STATUS_PAGE_END} - The writer is held at the end of the page. -
    - @return The pending status. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getHoldPendingStatus() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return holdPendingStatus_; - } - - /** - Returns the message option for sending a message to the message queue when this form is finished. - Possible values are: -
      -
    • {@link #MESSAGE_OPTION_STANDARD MESSAGE_OPTION_STANDARD} - A message is sent to the message queue. -
    • {@link #MESSAGE_OPTION_NONE MESSAGE_OPTION_NONE} - No message is sent to the message queue. -
    • {@link #MESSAGE_OPTION_INFO MESSAGE_OPTION_INFO} - An informational message is sent to the message queue. -
    • {@link #MESSAGE_OPTION_INQUIRY MESSAGE_OPTION_INQUIRY} - An inquiry message is sent to the message queue. -
    - @return The message option. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getMessageOption() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return messageOption_; - } - - /** - Returns the fully qualified integrated file system pathname of the message queue associated with this printer. - @return The message queue path, or "" if there is no associated message queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see com.ibm.as400.access.MessageQueue - **/ - public String getMessageQueue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - if (messageQueueLibraryName_.length() == 0) return ""; - return QSYSObjectPathName.toPath(messageQueueLibraryName_, messageQueueName_, "MSGQ"); - } - - /** - Returns the printer name. - @return The printer name. - @see #ISeriesPrinter - **/ - public String getName() - { - return name_; - } - - /** - Returns the number of separator pages to be printed. - @return The number of separators, or -1 if the number of separator pages is specified by each file. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getNumberOfSeparators() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return numberOfSeparators_; - } - - /** - Returns the fully qualified integrated file system pathname of the output queue associated with this printer from which spooled files are selected for printing. - @return The output queue path, or "" if there is no associated output queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see com.ibm.as400.access.OutputQueue - **/ - public String getOutputQueue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - if (outputQueueLibraryName_.length() == 0) return ""; - return QSYSObjectPathName.toPath(outputQueueLibraryName_, outputQueueName_, "OUTQ"); - } - - /** - Returns the status of the output queue from which spooled files are being selected for printing. - Possible values are: -
      -
    • {@link #OUTPUT_QUEUE_STATUS_HELD OUTPUT_QUEUE_STATUS_HELD} - The output queue is held. -
    • {@link #OUTPUT_QUEUE_STATUS_RELEASED OUTPUT_QUEUE_STATUS_RELEASED} - The output queue is released. -
    - @return The output queue status. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getOutputQueueStatus() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return outputQueueStatus_; - } - - /** - Returns the overall status of the logical printer. - Possible values are: -
      -
    • {@link #OVERALL_STATUS_UNAVAILABLE OVERALL_STATUS_UNAVAILABLE} -
    • {@link #OVERALL_STATUS_NOT_YET_AVAILABLE OVERALL_STATUS_NOT_YET_AVAILABLE} -
    • {@link #OVERALL_STATUS_STOPPED OVERALL_STATUS_STOPPED} -
    • {@link #OVERALL_STATUS_MESSAGE_WAITING OVERALL_STATUS_MESSAGE_WAITING} -
    • {@link #OVERALL_STATUS_HELD OVERALL_STATUS_HELD} -
    • {@link #OVERALL_STATUS_STOP_PENDING OVERALL_STATUS_STOP_PENDING} -
    • {@link #OVERALL_STATUS_HOLD_PENDING OVERALL_STATUS_HOLD_PENDING} -
    • {@link #OVERALL_STATUS_WAITING_FOR_PRINTER OVERALL_STATUS_WAITING_FOR_PRINTER} -
    • {@link #OVERALL_STATUS_WAITING_TO_START OVERALL_STATUS_WAITING_TO_START} -
    • {@link #OVERALL_STATUS_PRINTING OVERALL_STATUS_PRINTING} -
    • {@link #OVERALL_STATUS_WAITING_FOR_PRINTER_OUTPUT OVERALL_STATUS_WAITING_FOR_PRINTER_OUTPUT} -
    • {@link #OVERALL_STATUS_CONNECT_PENDING OVERALL_STATUS_CONNECT_PENDING} -
    • {@link #OVERALL_STATUS_POWERED_OFF OVERALL_STATUS_POWERED_OFF} -
    • {@link #OVERALL_STATUS_UNUSABLE OVERALL_STATUS_UNUSABLE} -
    • {@link #OVERALL_STATUS_BEING_SERVICED OVERALL_STATUS_BEING_SERVICED} -
    • {@link #OVERALL_STATUS_UNKNOWN OVERALL_STATUS_UNKNOWN} -
    - @return The overall status. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getOverallStatus() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return overallStatus_; - } - - /** - Returns the page number in the spooled file that is currently being processed by the writer. - The page number returned may be lower or higher than the actual page number being printed - because of buffering done by the system. - @return The page number being written, or 0 if no spooled file is printing. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getPageBeingWritten() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return pageBeingWritten_; - } - - /** - Returns the name of the next form type to be printed. - Possible values are: -
      -
    • {@link #FORM_TYPE_ALL FORM_TYPE_ALL} - The writer is changed with the option to print all spooled files of any form type. -
    • {@link #FORM_TYPE_FORMS FORM_TYPE_FORMS} - The writer is changed with the option to print all the spooled files with the same form type before using a different form type. -
    • {@link #FORM_TYPE_STANDARD FORM_TYPE_STANDARD} - The writer is changed with the option to print all the spooled files with a form type of *STD. -
    • A user-specified form type - The writer is changed with the option to print all the spooled files with the form type name that was specified. -
    • "" - No change has been made to this writer. -
    - @return The form type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #getFormType - **/ - public String getPendingFormType() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return pendingFormType_; - } - - /** - Returns the message option for sending a message to the message queue when the next form type is finished. - Possible values are: -
      -
    • {@link #MESSAGE_OPTION_STANDARD MESSAGE_OPTION_STANDARD} - A message is sent to the message queue. -
    • {@link #MESSAGE_OPTION_NONE MESSAGE_OPTION_NONE} - No message is sent to the message queue. -
    • {@link #MESSAGE_OPTION_INFO MESSAGE_OPTION_INFO} - An informational message is sent to the message queue. -
    • {@link #MESSAGE_OPTION_INQUIRY MESSAGE_OPTION_INQUIRY} - An inquiry message is sent to the message queue. -
    • "" - No change is pending. -
    - @return The message option. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #getMessageOption - **/ - public String getPendingMessageOption() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return pendingMessageOption_; - } - - /** - Returns the next number of separator pages to be printed when the change to the writer takes place. - @return The number of separators, or -1 if the number of separator pages is specified by each file, or -10 if there is no pending change to the writer. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #getNumberOfSeparators - **/ - public int getPendingNumberOfSeparators() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return pendingNumberOfSeparators_; - } - - /** - Returns the fully qualified integrated file system pathname of the next output queue. - @return The output queue path, or "" if no changes have been made to the writer. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #getOutputQueue - @see com.ibm.as400.access.OutputQueue - **/ - public String getPendingOutputQueue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - if (pendingOutputQueueLibraryName_.length() == 0) return ""; - return QSYSObjectPathName.toPath(pendingOutputQueueLibraryName_, pendingOutputQueueName_, "OUTQ"); - } - - /** - Returns the drawer from which to take the separator pages if there is a change to the writer. Possible values are: -
      -
    • 1 - The first drawer. -
    • 2 - The second drawer. -
    • 3 - The third drawer. -
    • -1 - Separator pages print from the same drawer that the spooled file prints from. If you specify a drawer different from the spooled file that contains colored or different type paper, the page separator is more identifiable. -
    • -2 - Separator pages print from the separator drawer specified in the printer device description. -
    • -10 - There is no pending change to the writer. -
    - @return The separator drawer. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #getSeparatorDrawer - **/ - // TBD: Add when PrinterDeviceDescription class is created: - // @see com.ibm.as400.access.config.PrinterDeviceDescription - public int getPendingSeparatorDrawer() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return pendingSeparatorDrawer_; - } - - /** - Returns the type of printer being used to print the spooled file. - Possible values are: -
      -
    • {@link #PRINTER_DEVICE_TYPE_SCS DEVICE_TYPE_SCS} - SNA (Systems Network Architecture) character string. -
    • {@link #PRINTER_DEVICE_TYPE_IPDS DEVICE_TYPE_IPDS} - Intelligent Printer Data Stream (tm). -
    - @return The printer device type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getPrinterDeviceType() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return printerDeviceType_; - } - - /** - Returns the drawer from which the job and file separator pages are to be taken. - Possible values are: -
      -
    • 1 - The first drawer. -
    • 2 - The second drawer. -
    • 3 - The third drawer. -
    • -1 - Separator pages print from the same drawer that the spooled file prints from. If you specify a drawer different from the spooled file that contains colored or different type paper, the page separator is more identifiable. -
    • -2 - Separator pages print from the separator drawer specified in the printer device description. -
    - @return The separator drawer. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - // TBD: Add when PrinterDeviceDescription class is added: - // @see com.ibm.as400.access.config.PrinterDeviceDescription - public int getSeparatorDrawer() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return separatorDrawer_; - } - - /** - Returns the date and time the spooled file was created on the system. - @return The spooled file creation date, or null if no spooled file is printing. If the system is not running system operating system release V5R2M0 or higher, null is returned. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Date getSpooledFileCreationDate() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - if (spooledFileCreationDate_ == null || spooledFileCreationDate_.length() == 0) return null; - Calendar cal = Calendar.getInstance(); - cal.clear(); - cal.set(Integer.parseInt(spooledFileCreationDate_.substring(0, 3)) + 1900, // Year. - Integer.parseInt(spooledFileCreationDate_.substring(3, 5)) - 1, // Month is zero based. - Integer.parseInt(spooledFileCreationDate_.substring(5, 7)), // Day. - Integer.parseInt(spooledFileCreationTime_.substring(0, 2)), // Hour. - Integer.parseInt(spooledFileCreationTime_.substring(2, 4)), // Minute. - Integer.parseInt(spooledFileCreationTime_.substring(4, 6))); // Second. - return cal.getTime(); - } - - /** - Returns the name of the job that created the spooled file currently being processed by the writer. - @return The job name, or "" if no spooled file is printing. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see com.ibm.as400.access.Job - **/ - public String getSpooledFileJobName() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return spooledFileJobName_; - } - - /** - Returns the number of the job that created the spooled file currently being processed by the writer. - @return The job number, or "" if no spooled file is printing. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see com.ibm.as400.access.Job - **/ - public String getSpooledFileJobNumber() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return spooledFileJobNumber_; - } - - /** - Returns the name of the system where the job that created the spooled file ran. - @return The system name, or "" if no spooled file is printing, or null if the system is not running system operating system release V5R2M0 or higher. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getSpooledFileJobSystem() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return spooledFileJobSystem_; - } - - /** - Returns the user of the job that created the spooled file currently being processed by the writer. - @return The user name, or "" if no spooled file is printing. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see com.ibm.as400.access.Job - @see com.ibm.as400.access.User - **/ - public String getSpooledFileJobUser() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return spooledFileJobUser_; - } - - /** - Returns the name of the spooled file currently being processed by the writer. - @return The spooled file name, or "" if no spooled file is printing. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getSpooledFileName() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return spooledFileName_; - } - - /** - Returns the number of the spooled file currently being processed by the writer. - @return The spooled file number, or 0 if no spooled file is printing. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getSpooledFileNumber() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return spooledFileNumber_; - } - - /** - Returns the name of the user that started the writer. - @return The user name. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see com.ibm.as400.access.User - **/ - public String getStarterUser() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return starterUser_; - } - - /** - Returns the system object representing the system on which the printer exists. - @return The system object representing the system on which the printer exists. - @see #ISeriesPrinter - **/ - public AS400 getSystem() - { - return system_; - } - - /** - Returns the total number of copies to be printed. - @return The number of copies. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getTotalCopies() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return totalCopies_; - } - - /** - Returns the total number of pages in the spooled file. - @return The number of pages, or 0 if no spooled file is printing. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getTotalPages() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return totalPages_; - } - - /** - Returns the time at which the pending changes to the writer take effect. - Possible values are: -
      -
    • {@link #WRITER_TIME_ALL_DONE WRITER_TIME_ALL_DONE} -
    • {@link #WRITER_TIME_CURRENT_DONE WRITER_TIME_CURRENT_DONE} -
    • {@link #WRITER_TIME_NONE WRITER_TIME_NONE} -
    - @return The writer change setting. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getWriterChangeTime() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return writerChangeTime_; - } - - /** - Returns when to end the writer if it is to end automatically. - Possible values are: -
      -
    • {@link #WRITER_TIME_ALL_DONE WRITER_TIME_ALL_DONE} -
    • {@link #WRITER_TIME_CURRENT_DONE WRITER_TIME_CURRENT_DONE} -
    • {@link #WRITER_TIME_WAIT WRITER_TIME_WAIT} -
    - @return The writer end time setting. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getWriterEndTime() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return writerEndTime_; - } - - /** - Returns the job name of the printer writer. - @return The job name. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #getWriterJobNumber - @see #getWriterJobUser - @see com.ibm.as400.access.Job - **/ - public String getWriterJobName() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return writerJobName_; - } - - /** - Returns the job number of the printer writer. - @return The job number. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #getWriterJobName - @see #getWriterJobUser - @see com.ibm.as400.access.Job - **/ - public String getWriterJobNumber() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return writerJobNumber_; - } - - /** - Returns the name of the system user. - @return The user name. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #getWriterJobName - @see #getWriterJobNumber - @see com.ibm.as400.access.Job - @see com.ibm.as400.access.User - **/ - public String getWriterJobUser() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return writerJobUser_; - } - - /** - Returns the key to the message that the writer is waiting for a reply. - @return The 4-byte message key, which will consist of all 0x40's if the writer is not waiting for a reply to an inquiry message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public byte[] getWriterMessageKey() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return writerMessageKey_; - } - - /** - Returns the status of the writer for this printer. - Possible values are: -
      -
    • {@link #WRITER_STATUS_STARTED WRITER_STATUS_STARTED} -
    • {@link #WRITER_STATUS_ENDED WRITER_STATUS_ENDED} -
    • {@link #WRITER_STATUS_ON_JOB_QUEUE WRITER_STATUS_ON_JOB_QUEUE} -
    • {@link #WRITER_STATUS_HELD WRITER_STATUS_HELD} -
    • {@link #WRITER_STATUS_MESSAGE_WAITING WRITER_STATUS_MESSAGE_WAITING} -
    - @return The writer status. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getWriterStatus() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return writerStatus_; - } - - /** - Returns whether the printer writer is in writing status. - Possible values are: -
      -
    • {@link #WRITING_STATUS_WRITING WRITING_STATUS_WRITING} - The writer is in writing status. -
    • {@link #WRITING_STATUS_NOT_WRITING WRITING_STATUS_NOT_WRITING} - The writer is not in writing status. -
    • {@link #WRITING_STATUS_FILE_SEPARATORS WRITING_STATUS_FILE_SEPARATORS} - The writer is writing the file separators. -
    - @return The writing status. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getWritingStatus() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return writingStatus_; - } - - /** - Returns the hash code value for the name of this ISeriesPrinter object. - @return The hash code. - **/ - public int hashCode() - { - return name_.hashCode(); - } - - /** - Returns whether the writer is between copies of a multiple copy spooled file. - @return true if the writer is between copies, false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isBetweenCopies() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return betweenCopies_; - } - - /** - Returns whether the writer is between spooled files. - @return true if the writer is between spooled files, false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isBetweenFiles() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return betweenFiles_; - } - - /** - Returns whether the writer is held. - @return true if the writer is held, false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isHeld() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return held_; - } - - /** - Returns whether the writer is on a job queue and is not currently running. - @return true if the writer is on a job queue, false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isOnJobQueue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return onJobQueue_; - } - - /** - Returns whether the printer is published in the network directory. - @return true if the printer is published, false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isPublishedInNetworkDirectory() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return publishedInNetworkDirectory_; - } - - /** - Returns whether the writer has written all the data currently in the spooled file and is waiting for more data. - @return true if the writer is waiting for more data when the writer is producing an open spooled file with SCHEDULE(*IMMED) specified; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isWaitingForData() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return waitingForData_; - } - - /** - Returns whether the writer is waiting to get the device from a job that is printing directly to the printer. - @return true if the writer is waiting for the device, false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isWaitingForDevice() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return waitingForDevice_; - } - - /** - Returns whether the writer is waiting for a reply to an inquiry message. - @return true if the writer is waiting for a reply, false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isWaitingForMessage() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return waitingForMessage_; - } - - /** - Returns whether the writer is started for this printer. - @return true if the writer is started, false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isWriterStarted() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return writerStarted_; - } - - /** - Refreshes the information about this printer object from the system. This method is implicitly called by the getXXX() methods on this class the first time. Call this method explicitly to refresh the information returned by the various getXXX() methods. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void refresh() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Refreshing printer information."); - // Retrieve server operating system VRM. - int vrm = system_.getVRM(); - // Convert based on server job CCSID. - CharConverter conv = new CharConverter(system_.getCcsid(), system_); - - byte[] deviceName = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - conv.stringToByteArray(name_, deviceName, 0, 10); - - // Setup program parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Receiver variable, output, char(*). - new ProgramParameter(402), - // Length of receiver variable, input, binary(4). - new ProgramParameter(new byte[] { 0x00, 0x00, 0x01, (byte)0x92 } ), - // Format name, input, char(8), EBCDIC 'RPTA0100'. - new ProgramParameter(new byte[] { (byte)0xD9, (byte)0xD7, (byte)0xE3, (byte)0xC1, (byte)0xF0, (byte)0xF1, (byte)0xF0, (byte)0xF0 } ), - // Device name, input, char(10). - new ProgramParameter(deviceName), - // Error code, I/0, char(*). - new ProgramParameter(new byte[8]) - }; - - // Note this is not an open list API, even though it starts with QGY. - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QGY.LIB/QGYRPRTA.PGM", parameters); - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - - byte[] data = parameters[0].getOutputData(); - - //int bytesReturned = BinaryConverter.byteArrayToInt(data, 0); - //int bytesAvailable = BinaryConverter.byteArrayToInt(data, 4); - //name_ = conv.byteArrayToString(data, 8, 10).trim(); - writerStarted_ = data[18] == (byte)0xF1; // '1' means started. - writerStatus_ = data[19] & 0xFF; - deviceStatus_ = BinaryConverter.byteArrayToInt(data, 20); - overallStatus_ = BinaryConverter.byteArrayToInt(data, 24); - description_ = conv.byteArrayToString(data, 28, 50).trim(); - starterUser_ = conv.byteArrayToString(data, 80, 10).trim(); - writingStatus_ = data[90] & 0xFF; - waitingForMessage_ = data[91] == (byte)0xE8; // 'Y' or 'N' - held_ = data[92] == (byte)0xE8; // 'Y' or 'N' - endPendingStatus_ = data[93] & 0xFF; - holdPendingStatus_ = data[94] & 0xFF; - betweenFiles_ = data[95] == (byte)0xE8; // 'Y' or 'N' - betweenCopies_ = data[96] == (byte)0xE8; // 'Y' or 'N' - waitingForData_ = data[97] == (byte)0xE8; // 'Y' or 'N' - waitingForDevice_ = data[98] == (byte)0xE8; // 'Y' or 'N' - onJobQueue_ = data[99] == (byte)0xE8; // 'Y' or 'N' - writerJobName_ = conv.byteArrayToString(data, 104, 10).trim(); - writerJobUser_ = conv.byteArrayToString(data, 114, 10).trim(); - writerJobNumber_ = conv.byteArrayToString(data, 124, 6).trim(); - printerDeviceType_ = conv.byteArrayToString(data, 130, 10).trim(); - if (printerDeviceType_.equals(PRINTER_DEVICE_TYPE_SCS)) - { - printerDeviceType_ = PRINTER_DEVICE_TYPE_SCS; - } - else if (printerDeviceType_.equals(PRINTER_DEVICE_TYPE_IPDS)) - { - printerDeviceType_ = PRINTER_DEVICE_TYPE_IPDS; - } - numberOfSeparators_ = BinaryConverter.byteArrayToInt(data, 140); - separatorDrawer_ = BinaryConverter.byteArrayToInt(data, 144); - formAlignmentMessageTime_ = conv.byteArrayToString(data, 148, 10).trim(); - if (formAlignmentMessageTime_.equals(FORM_ALIGNMENT_WRITER)) - { - formAlignmentMessageTime_ = FORM_ALIGNMENT_WRITER; - } - else if (formAlignmentMessageTime_.equals(FORM_ALIGNMENT_FILE)) - { - formAlignmentMessageTime_ = FORM_ALIGNMENT_FILE; - } - outputQueueName_ = conv.byteArrayToString(data, 158, 10).trim(); - outputQueueLibraryName_ = conv.byteArrayToString(data, 168, 10).trim(); - outputQueueStatus_ = data[178] & 0xFF; - publishedInNetworkDirectory_ = data[179] == (byte)0xF1; // '0' or '1' - formType_ = conv.byteArrayToString(data, 180, 10).trim(); - if (formType_.equals(FORM_TYPE_ALL)) - { - formType_ = FORM_TYPE_ALL; - } - else if (formType_.equals(FORM_TYPE_FORMS)) - { - formType_ = FORM_TYPE_FORMS; - } - else if (formType_.equals(FORM_TYPE_STANDARD)) - { - formType_ = FORM_TYPE_STANDARD; - } - messageOption_ = conv.byteArrayToString(data, 190, 10).trim(); - if (messageOption_.equals(MESSAGE_OPTION_STANDARD)) - { - messageOption_ = MESSAGE_OPTION_STANDARD; - } - else if (messageOption_.equals(MESSAGE_OPTION_NONE)) - { - messageOption_ = MESSAGE_OPTION_NONE; - } - else if (messageOption_.equals(MESSAGE_OPTION_INFO)) - { - messageOption_ = MESSAGE_OPTION_INFO; - } - else if (messageOption_.equals(MESSAGE_OPTION_INQUIRY)) - { - messageOption_ = MESSAGE_OPTION_INQUIRY; - } - writerEndTime_ = conv.byteArrayToString(data, 200, 10).trim(); - if (writerEndTime_.equals(WRITER_TIME_ALL_DONE)) - { - writerEndTime_ = WRITER_TIME_ALL_DONE; - } - else if (writerEndTime_.equals(WRITER_TIME_CURRENT_DONE)) - { - writerEndTime_ = WRITER_TIME_CURRENT_DONE; - } - else if (writerEndTime_.equals(WRITER_TIME_NONE)) - { - writerEndTime_ = WRITER_TIME_NONE; - } - allowsDirectPrinting_ = conv.byteArrayToString(data, 210, 10).trim().equals("*YES"); // "*YES" or "*NO" - messageQueueName_ = conv.byteArrayToString(data, 220, 10).trim(); - messageQueueLibraryName_ = conv.byteArrayToString(data, 230, 10).trim(); - writerChangeTime_ = conv.byteArrayToString(data, 242, 10).trim(); - if (writerChangeTime_.equals(WRITER_TIME_ALL_DONE)) - { - writerChangeTime_ = WRITER_TIME_ALL_DONE; - } - else if (writerChangeTime_.equals(WRITER_TIME_CURRENT_DONE)) - { - writerChangeTime_ = WRITER_TIME_CURRENT_DONE; - } - else if (writerChangeTime_.equals(WRITER_TIME_NONE)) - { - writerChangeTime_ = WRITER_TIME_NONE; - } - pendingOutputQueueName_ = conv.byteArrayToString(data, 252, 10).trim(); - pendingOutputQueueLibraryName_ = conv.byteArrayToString(data, 262, 10).trim(); - pendingFormType_ = conv.byteArrayToString(data, 272, 10).trim(); - if (pendingFormType_.equals(FORM_TYPE_ALL)) - { - pendingFormType_ = FORM_TYPE_ALL; - } - else if (pendingFormType_.equals(FORM_TYPE_FORMS)) - { - pendingFormType_ = FORM_TYPE_FORMS; - } - else if (pendingFormType_.equals(FORM_TYPE_STANDARD)) - { - pendingFormType_ = FORM_TYPE_STANDARD; - } - pendingMessageOption_ = conv.byteArrayToString(data, 282, 10).trim(); - if (pendingMessageOption_.equals(MESSAGE_OPTION_STANDARD)) - { - pendingMessageOption_ = MESSAGE_OPTION_STANDARD; - } - else if (pendingMessageOption_.equals(MESSAGE_OPTION_NONE)) - { - pendingMessageOption_ = MESSAGE_OPTION_NONE; - } - else if (pendingMessageOption_.equals(MESSAGE_OPTION_INFO)) - { - pendingMessageOption_ = MESSAGE_OPTION_INFO; - } - else if (pendingMessageOption_.equals(MESSAGE_OPTION_INQUIRY)) - { - pendingMessageOption_ = MESSAGE_OPTION_INQUIRY; - } - pendingNumberOfSeparators_ = BinaryConverter.byteArrayToInt(data, 292); - pendingSeparatorDrawer_ = BinaryConverter.byteArrayToInt(data, 296); - spooledFileName_ = conv.byteArrayToString(data, 300, 10).trim(); - spooledFileJobName_ = conv.byteArrayToString(data, 310, 10).trim(); - spooledFileJobUser_ = conv.byteArrayToString(data, 320, 10).trim(); - spooledFileJobNumber_ = conv.byteArrayToString(data, 330, 6).trim(); - spooledFileNumber_ = BinaryConverter.byteArrayToInt(data, 336); - pageBeingWritten_ = BinaryConverter.byteArrayToInt(data, 340); - totalPages_ = BinaryConverter.byteArrayToInt(data, 344); - copiesLeft_ = BinaryConverter.byteArrayToInt(data, 348); - totalCopies_ = BinaryConverter.byteArrayToInt(data, 352); - supportsAFP_ = conv.byteArrayToString(data, 356, 10).trim().equals("*YES"); // '*YES' or '*NO' - writerMessageKey_ = new byte[4]; - System.arraycopy(data, 366, writerMessageKey_, 0, 4); - if (vrm >= 0x00050200) - { - spooledFileJobSystem_ = conv.byteArrayToString(data, 381, 8).trim(); - spooledFileCreationDate_ = conv.byteArrayToString(data, 389, 7).trim(); - spooledFileCreationTime_ = conv.byteArrayToString(data, 396, 6).trim(); - } - refreshed_ = true; - } - - /** - Returns whether the printer supports Advanced Function Printing. - @return true if Advanced Function Printing is supported, false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean supportsAFP() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!refreshed_) refresh(); - return supportsAFP_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/IdentityTokenVault.java b/cvsroot/src/com/ibm/as400/access/IdentityTokenVault.java deleted file mode 100644 index 6b186c606..000000000 --- a/cvsroot/src/com/ibm/as400/access/IdentityTokenVault.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IdentityTokenVault.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2009-2009 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; - -/** - * A vault which holds an identity token. The identity token can be used for - * authenticating to one or more IBM i host servers. - */ -class IdentityTokenVault extends CredentialVault implements Cloneable, Serializable -{ - /** - * Constructs an IdentityTokenVault object that does not contain a credential. - */ - protected IdentityTokenVault() { - super(); - } - - /** - * Constructs an IdentityTokenVault object that contains the provided identity token credential. - * - * @param existingToken The identity token bytes - */ - protected IdentityTokenVault(byte[] existingToken) { - super(existingToken); - } - - /** - * Returns a copy of this IdentityTokenVault. The new copy will be - * an exact copy of this vault, which means the new copy will - * contain the same identity token credential as this vault. - * - * @return A newly created IdentityTokenVault that is a copy of this one - */ - public Object clone() { - IdentityTokenVault vaultClone = (IdentityTokenVault)super.clone(); - return vaultClone; - } - - /** - * {@inheritDoc} - */ - protected int getType() { - return AS400.AUTHENTICATION_SCHEME_IDENTITY_TOKEN; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/IllegalObjectTypeException.java b/cvsroot/src/com/ibm/as400/access/IllegalObjectTypeException.java deleted file mode 100644 index eb51e1ee1..000000000 --- a/cvsroot/src/com/ibm/as400/access/IllegalObjectTypeException.java +++ /dev/null @@ -1,100 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IllegalObjectTypeException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - The IllegalObjectTypeException class represents an exception that indicates that the IBM i system object is not the required type. - **/ -public class IllegalObjectTypeException extends Exception implements ReturnCodeException -{ - static final long serialVersionUID = 4L; - - // Return code associated with this exception. - private int returnCode_; - - // Return code values used by this class. - // If a value is added here, it must also be added to MRI.java. - - /** - The return code indicating that an attempt was made to use a keyed queue with a non-keyed data queue object. - **/ - public static final int DATA_QUEUE_KEYED = 1; - /** - The return code indicating that an attempt was made to use a non-keyed data queue with a keyed data queue object. - **/ - public static final int DATA_QUEUE_NOT_KEYED = 2; - /** - The return code indicating that an attempt was made to use a character data area with a non-character data area object. - **/ - public static final int DATA_AREA_CHARACTER = 3; - /** - The return code indicating that an attempt was made to use a decimal data area with a non-decimal data area object. - **/ - public static final int DATA_AREA_DECIMAL = 4; - /** - The return code indicating that an attempt was made to use a logical data area with a non-logical data area object. - **/ - public static final int DATA_AREA_LOGICAL = 5; - - // Constructs an IllegalObjectTypeException object. It indicates that an object is not the required type. Exception message will look like this: Object type is not valid. - // @param returnCode The return code which identifies the message to be returned. - IllegalObjectTypeException(int returnCode) - { - // Create the message. - super(ResourceBundleLoader.getText(getMRIKey(returnCode))); - returnCode_ = returnCode; - } - - // Constructs an IllegalObjectTypeException object. It indicates that an object is not the required type. Exception message will look like this: /QSYS.LIB/MYLIB.LIB/MYQUEUE.DTAQ: Object type is not valid. - // @param objectName The object that is the wrong type. - // @param returnCode The return code which identifies the message to be returned. - IllegalObjectTypeException(String objectName, int returnCode) - { - // Create the message. - super(objectName + ": " + ResourceBundleLoader.getText(getMRIKey(returnCode))); - returnCode_ = returnCode; - } - - // Returns the text associated with the return code. - // @param returnCode The return code associated with this exception. - // @return The text string which describes the error. - // This method is required so the message can be created and sent in super(). - static String getMRIKey(int returnCode) - { - switch (returnCode) - { - case DATA_QUEUE_KEYED: - return "EXC_DATA_QUEUE_KEYED"; - case DATA_QUEUE_NOT_KEYED: - return "EXC_DATA_QUEUE_NOT_KEYED"; - case DATA_AREA_CHARACTER: - return "EXC_DATA_AREA_CHARACTER"; - case DATA_AREA_DECIMAL: - return "EXC_DATA_AREA_DECIMAL"; - case DATA_AREA_LOGICAL: - return "EXC_DATA_AREA_LOGICAL"; - default: - return "EXC_UNKNOWN"; // Bad return code was provided. - } - } - - /** - Returns the return code associated with this exception. - @return The return code. - **/ - public int getReturnCode() - { - return returnCode_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/IllegalPathNameException.java b/cvsroot/src/com/ibm/as400/access/IllegalPathNameException.java deleted file mode 100644 index a2fcb97b0..000000000 --- a/cvsroot/src/com/ibm/as400/access/IllegalPathNameException.java +++ /dev/null @@ -1,124 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IllegalPathNameException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - The IllegalPathNameException class represents an exception that indicates that the integrated file system path name is not valid. - **/ -// This exception should be used when a problem occurs while using the IFS classes. -public class IllegalPathNameException extends RuntimeException implements ReturnCodeException -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - // Return code associated with this exception. - private int returnCode_; - - /** - The return code indicating that the object type is not valid. - **/ - public static final int OBJECT_TYPE_NOT_VALID = 1; - /** - The return code indicating that the length of the library name is not valid. - **/ - public static final int LIBRARY_LENGTH_NOT_VALID = 2; - /** - The return code indicating that the length of the object name is not valid. - **/ - public static final int OBJECT_LENGTH_NOT_VALID = 3; - /** - The return code indicating that the length of the member name is not valid. - **/ - public static final int MEMBER_LENGTH_NOT_VALID = 4; - /** - The return code indicating that the length of the object type is not valid. - **/ - public static final int TYPE_LENGTH_NOT_VALID = 5; - /** - The return code indicating that the object is required to be in the QSYS file system, but the integrated file system name does not begin with /QSYS.LIB/. - **/ - public static final int QSYS_PREFIX_MISSING = 6; - /** - The return code indicating that the path starts with /QSYS.LIB/QSYS.LIB. Objects in library QSYS should not repeat the library specification. - **/ - public static final int QSYS_SYNTAX_NOT_VALID = 7; - /** - The return code indicating that the path name represents an object of type .MBR, but does not contain a valid .FILE specification. - **/ - public static final int MEMBER_WITHOUT_FILE = 8; - /** - The return code indicating that the path is not specified correctly, and the most likely cause is a library specification that does not have the .LIB extension. - **/ - public static final int LIBRARY_SPECIFICATION_NOT_VALID = 9; - - // Constructs an IllegalPathNameException object. It indicates that the path name is not valid. Exception message will look like this: Path name was not found. - // @param returnCode the return code which identifies the message to be returned. - IllegalPathNameException(int returnCode) - { - // Create the message. - super(ResourceBundleLoader.getText(getMRIKey(returnCode))); - returnCode_ = returnCode; - } - - // Constructs an IncorrectPathNameException object. It indicates that the path name is not valid. Exception message will look like this: /QSYS.LIB/mylib.LIB/myfile.FILE: Path name is not valid. - // @param pathName The path name. - // @param returnCode The return code which identifies the message to be returned. - IllegalPathNameException(String pathName, int returnCode) - { - // Create the message. - super(pathName + ": " + ResourceBundleLoader.getText(getMRIKey(returnCode))); - returnCode_ = returnCode; - } - - // Returns the text associated with the return code. - // @param returnCode The return code associated with this exception. - // @return The text string which describes the error. - // This method is required so the message can be created and sent in super(). - static String getMRIKey(int returnCode) - { - switch(returnCode) - { - case OBJECT_TYPE_NOT_VALID: - return "EXC_OBJECT_TYPE_NOT_VALID"; - case LIBRARY_LENGTH_NOT_VALID: - return "EXC_LIBRARY_LENGTH_NOT_VALID"; - case OBJECT_LENGTH_NOT_VALID: - return "EXC_OBJECT_LENGTH_NOT_VALID"; - case MEMBER_LENGTH_NOT_VALID: - return "EXC_MEMBER_LENGTH_NOT_VALID"; - case TYPE_LENGTH_NOT_VALID: - return "EXC_TYPE_LENGTH_NOT_VALID"; - case QSYS_PREFIX_MISSING: - return "EXC_QSYS_PREFIX_MISSING"; - case QSYS_SYNTAX_NOT_VALID: - return "EXC_QSYS_SYNTAX_NOT_VALID"; - case MEMBER_WITHOUT_FILE: - return "EXC_MEMBER_WITHOUT_FILE"; - case LIBRARY_SPECIFICATION_NOT_VALID: - return "EXC_LIBRARY_SPECIFICATION_NOT_VALID"; - default: - return "EXC_UNKNOWN"; // Bad return code was provided. - } - } - - /** - Returns the return code associated with this exception. - @return The return code. - **/ - public int getReturnCode() - { - return returnCode_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/IntegerHashtable.java b/cvsroot/src/com/ibm/as400/access/IntegerHashtable.java deleted file mode 100644 index a6f55dc5f..000000000 --- a/cvsroot/src/com/ibm/as400/access/IntegerHashtable.java +++ /dev/null @@ -1,97 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IntegerHashtable.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * This class represents a hashtable that uses primitive ints for both keys and values. - * It is much smaller and faster than using a java.util.Hashtable since you do not - * have to wrap the primitive type in an Integer object. The current hash is hardcoded as 4 - * (to keep the memory usage low) but could conceivably be adjusted in a constructor if needed. - * A valid key is any non-zero integer that can be used as an array index in Java. - * A valid value is any integer. - * This class is appropriately synchronized and can be considered threadsafe. -**/ -final class IntegerHashtable implements java.io.Serializable -{ - static final long serialVersionUID = 5L; - private static final int HASH = 4; - final int[][] values_ = new int[HASH][]; - final int[][] keys_ = new int[HASH][]; - - final int get(int key) - { - if (key == 0) return -1; - int hash = key % HASH; - synchronized(keys_) - { - int[] keyChain = keys_[hash]; - if (keyChain == null) return -1; - for (int i=0; i 0 && - parameterIndex < registeredTypes_.size() ) - { - Integer typeInt = (Integer)registeredTypes_.elementAt(parameterIndex); - if (typeInt != null) - { - int type = typeInt.intValue(); - ProxyFactoryImpl proxyObject = null; - if (type == Types.BLOB) { - proxyObject = new JDBlobProxy (); - } - else if (type == Types.CLOB) { - proxyObject = new JDClobProxy (); - } - if (proxyObject != null) { - return connection_.callFactoryMethod (pxId_, "getObject", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (parameterIndex) }, - proxyObject); - } - } - } - return connection_.callMethod (pxId_, "getObject", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (parameterIndex) }) - .getReturnValue(); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 2.0 - public Object getObject (int parameterIndex, Map typeMap) - throws SQLException - { - try - { - if (parameterIndex > 0 && - parameterIndex < registeredTypes_.size() ) - { - Integer typeInt = (Integer)registeredTypes_.elementAt(parameterIndex); - if (typeInt != null) - { - int type = typeInt.intValue(); - ProxyFactoryImpl proxyObject = null; - if (type == Types.BLOB) { - proxyObject = new JDBlobProxy (); - } - else if (type == Types.CLOB) { - proxyObject = new JDClobProxy (); - } - if (proxyObject != null) { - return connection_.callFactoryMethod (pxId_, "getObject", - new Class[] { Integer.TYPE, Map.class }, - new Object[] { new Integer (parameterIndex), - typeMap }, - proxyObject); - } - } - } - return connection_.callMethod (pxId_, "getObject", - new Class[] { Integer.TYPE, Map.class }, - new Object[] { new Integer (parameterIndex), - typeMap }) - .getReturnValue(); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 3.0 - public Object getObject (String parameterName) - throws SQLException - { - return getObject (findParameterIndex(parameterName)); - } - - - -// JDBC 3.0 - public Object getObject (String parameterName, Map typeMap) - throws SQLException - { - return getObject(findParameterIndex(parameterName), typeMap); - } - - - - -// JDBC 2.0 - public Ref getRef (int parameterIndex) - throws SQLException - { - return (Ref) callMethodRtnRaw ("getRef", parameterIndex) - .getReturnValue (); - } - - - -// JDBC 3.0 - public Ref getRef (String parameterName) - throws SQLException - { - return(Ref) callMethodRtnRaw ("getRef", parameterName) - .getReturnValue (); - } - - - - public short getShort (int parameterIndex) - throws SQLException - { - return callMethodRtnRaw ("getShort", parameterIndex) - .getReturnValueShort (); - } - - -// JDBC 3.0 - public short getShort (String parameterName) - throws SQLException - { - return callMethodRtnRaw ("getShort", parameterName) - .getReturnValueShort (); - } - - - - public String getString (int parameterIndex) - throws SQLException - { - return (String) callMethodRtnRaw ("getString", parameterIndex) - .getReturnValue (); - } - - - -// JDBC 3.0 - public String getString (String parameterName) - throws SQLException - { - return(String) callMethodRtnRaw ("getString", parameterName) - .getReturnValue (); - } - - - - public Time getTime (int parameterIndex) - throws SQLException - { - return (Time) callMethodRtnRaw ("getTime", parameterIndex) - .getReturnValue (); - } - - - -// JDBC 3.0 - public Time getTime (String parameterName) - throws SQLException - { - return(Time) callMethodRtnRaw ("getTime", parameterName) - .getReturnValue (); - } - - - -// JDBC 2.0 - public Time getTime (int parameterIndex, Calendar calendar) - throws SQLException - { - return (Time) callMethodRtnRaw ("getTime", - new Class[] { Integer.TYPE, Calendar.class }, - new Object[] { new Integer (parameterIndex), - calendar }) - .getReturnValue (); - } - - - -// JDBC 3.0 - public Time getTime (String parameterName, Calendar calendar) - throws SQLException - { - return(Time) callMethodRtnRaw ("getTime", - new Class[] { String.class, Calendar.class}, - new Object[] { parameterName, - calendar}) - .getReturnValue (); - } - - - - public Timestamp getTimestamp (int parameterIndex) - throws SQLException - { - return (Timestamp) callMethodRtnRaw ("getTimestamp", parameterIndex) - .getReturnValue (); - } - - - -// JDBC 3.0 - public Timestamp getTimestamp (String parameterName) - throws SQLException - { - return(Timestamp) callMethodRtnRaw ("getTimestamp", parameterName) - .getReturnValue (); - } - - - -// JDBC 2.0 - public Timestamp getTimestamp (int parameterIndex, Calendar calendar) - throws SQLException - { - return (Timestamp) callMethodRtnRaw ("getTimestamp", - new Class[] { Integer.TYPE, Calendar.class }, - new Object[] { new Integer (parameterIndex), - calendar }) - .getReturnValue (); - } - - - -// JDBC 3.0 - public Timestamp getTimestamp (String parameterName, Calendar calendar) - throws SQLException - { - return(Timestamp) callMethodRtnRaw ("getTimestamp", - new Class[] { String.class, Calendar.class}, - new Object[] { parameterName, - calendar}) - .getReturnValue (); - } - - - -// JDBC 3.0 - public URL getURL (int parameterIndex) - throws SQLException - { - return(URL) callMethodRtnRaw ("getURL", - new Class[] { Integer.TYPE}, - new Object[] { new Integer (parameterIndex)}) - .getReturnValue (); - } - - - -// JDBC 3.0 - public URL getURL (String parameterName) - throws SQLException - { - return(URL) callMethodRtnRaw ("getURL", - new Class[] { String.class}, - new Object[] { parameterName}) - .getReturnValue (); - } - - - - private void registerLocally (int parameterIndex, int sqlType) - { - for (int i=registeredTypes_.size(); i<=parameterIndex; i++) - registeredTypes_.addElement (null); - registeredTypes_.setElementAt (new Integer(sqlType), parameterIndex); - } - - - - public void registerOutParameter (int parameterIndex, - int sqlType, - int scale) - throws SQLException - { - callMethod ("registerOutParameter", - new Class[] { Integer.TYPE, Integer.TYPE, - Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - new Integer (sqlType), - new Integer (scale) }); - - registerLocally (parameterIndex, sqlType); //@A1C - } - - - public void registerOutParameter (int parameterIndex, int sqlType) - throws SQLException - { - callMethod ("registerOutParameter", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - new Integer (sqlType) }); - - registerLocally (parameterIndex, sqlType); //@A1C - } - - - public void registerOutParameter (int parameterIndex, int sqlType, String typeName) - throws SQLException - { - - callMethod ("registerOutParameter", - new Class[] { Integer.TYPE, Integer.TYPE, - String.class }, - new Object[] { new Integer (parameterIndex), - new Integer (sqlType), - new Integer (typeName) }); - - registerLocally (parameterIndex, sqlType); //@A1C - } - - - -// JDBC 3.0 - public void registerOutParameter (String parameterName, int sqlType) - throws SQLException - { - registerOutParameter(findParameterIndex(parameterName), sqlType); - } - - - -// JDBC 3.0 - public void registerOutParameter (String parameterName, int sqlType, int scale) - throws SQLException - { - registerOutParameter(findParameterIndex(parameterName), sqlType, scale); - } - - - -// JDBC 3.0 - public void registerOutParameter (String parameterName, int sqlType, String typeName) - throws SQLException - { - registerOutParameter(findParameterIndex(parameterName), sqlType, typeName); - } - - - -// JDBC 3.0 - public void setAsciiStream (String parameterName, InputStream parameterValue, int length) - throws SQLException - { - InputStream iStream; - if (parameterValue == null || - parameterValue instanceof Serializable) - iStream = parameterValue; - else { - try { - iStream = new SerializableInputStream (parameterValue); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setAsciiStream", - new Class[] { String.class, InputStream.class, - Integer.TYPE}, - new Object[] { parameterName, - iStream, - new Integer (length)}); - } - - - -// JDBC 3.0 - public void setBigDecimal (String parameterName, BigDecimal parameterValue) - throws SQLException - { - callMethod ("setBigDecimal", - new Class[] { String.class, BigDecimal.class}, - new Object[] { parameterName, - parameterValue}); - } - - - - -// JDBC 3.0 - public void setBinaryStream (String parameterName, - InputStream parameterValue, - int length) - throws SQLException - { - InputStream iStream; - if (parameterValue == null || - parameterValue instanceof Serializable) - iStream = parameterValue; - else { - try { - iStream = new SerializableInputStream (parameterValue); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBinaryStream", - new Class[] { String.class, InputStream.class, - Integer.TYPE}, - new Object[] { parameterName, - iStream, - new Integer (length)}); - } - - - - -// JDBC 3.0 - public void setBoolean (String parameterName, boolean parameterValue) - throws SQLException - { - callMethod ("setBoolean", - new Class[] { String.class, Boolean.TYPE}, - new Object[] { parameterName, - new Boolean(parameterValue)}); - } - - - -// JDBC 3.0 - public void setByte (String parameterName, byte parameterValue) - throws SQLException - { - callMethod ("setByte", - new Class[] { String.class, Byte.TYPE}, - new Object[] { parameterName, - new Byte(parameterValue)}); - } - - - -// JDBC 3.0 - public void setBytes (String parameterName, byte[] parameterValue) - throws SQLException - { - callMethod ("setBytes", - new Class[] { String.class, byte[].class}, //@K1C Changed from Byte.class to byte[].class - new Object[] { parameterName, - parameterValue}); - } - - - -//JDBC 3.0 - public void setCharacterStream (String parameterName, - Reader parameterValue, - int length) - throws SQLException - { - try { - SerializableReader reader; - if (parameterValue == null) - reader = null; - else - reader = new SerializableReader (parameterValue, Math.max(0,length)); - callMethod ("setCharacterStream", - new Class[] { String.class, Reader.class, - Integer.TYPE}, - new Object[] { parameterName, - reader, - new Integer (length)}); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - -// JDBC 3.0 - public void setDate (String parameterName, Date parameterValue) - throws SQLException - { - callMethod ("setDate", - new Class[] { String.class, Date.class}, - new Object[] { parameterName, - parameterValue}); - } - - - -// JDBC 3.0 - public void setDate (String parameterName, Date parameterValue, Calendar cal) - throws SQLException - { - callMethod ("setDate", - new Class[] { String.class, Date.class, Calendar.class}, - new Object[] { parameterName, - parameterValue, cal}); - } - - - -// JDBC 3.0 - public void setDouble (String parameterName, double parameterValue) - throws SQLException - { - callMethod ("setDouble", - new Class[] { String.class, Double.TYPE}, - new Object[] { parameterName, - new Double(parameterValue)}); - } - - - -// JDBC 3.0 - public void setFloat (String parameterName, float parameterValue) - throws SQLException - { - callMethod ("setFloat", - new Class[] { String.class, Float.TYPE}, - new Object[] { parameterName, - new Float(parameterValue)}); - } - - - -// JDBC 3.0 - public void setInt (String parameterName, int parameterValue) - throws SQLException - { - callMethod ("setInt", - new Class[] { String.class, Integer.TYPE}, - new Object[] { parameterName, - new Integer(parameterValue)}); - } - - - -// JDBC 3.0 - public void setLong (String parameterName, long parameterValue) - throws SQLException - { - callMethod ("setLong", - new Class[] { String.class, Long.TYPE}, - new Object[] { parameterName, - new Long(parameterValue)}); - } - - - -// JDBC 3.0 - public void setNull (String parameterName, int sqlType) - throws SQLException - { - callMethod ("setNull", - new Class[] { String.class, Integer.TYPE}, - new Object[] { parameterName, - new Integer(sqlType)}); - } - - - -// JDBC 3.0 - public void setNull (String parameterName, int sqlType, String typeName) - throws SQLException - { - callMethod ("setNull", - new Class[] { String.class, Integer.TYPE, String.class}, - new Object[] { parameterName, - new Integer(sqlType), typeName}); - } - - - -// JDBC 3.0 - public void setObject (String parameterName, Object parameterValue) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setObject", - new Class[] { String.class, Object.class}, - new Object[] { parameterName, - parameterValue}); - } - - - -// JDBC 3.0 - public void setObject (String parameterName, - Object parameterValue, - int sqlType) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setObject", - new Class[] { String.class, Object.class, - Integer.TYPE}, - new Object[] { parameterName, - parameterValue, - new Integer (sqlType)}); - } - - - -// JDBC 3.0 - public void setObject (String parameterName, - Object parameterValue, - int sqlType, - int scale) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setObject", - new Class[] { String.class, Object.class, - Integer.TYPE, Integer.TYPE}, - new Object[] { parameterName, - parameterValue, - new Integer (sqlType), - new Integer (scale)}); - } - - - - -// JDBC 3.0 - public void setShort (String parameterName, short parameterValue) - throws SQLException - { - callMethod ("setShort", - new Class[] { String.class, Short.TYPE}, - new Object[] { parameterName, - new Short(parameterValue)}); - } - - - -// JDBC 3.0 - public void setString (String parameterName, String sqlType) - throws SQLException - { - callMethod ("setString", - new Class[] { String.class, String.class}, - new Object[] { parameterName, - sqlType}); - } - - - -// JDBC 3.0 - public void setTime (String parameterName, Time parameterValue) - throws SQLException - { - callMethod ("setTime", - new Class[] { String.class, Time.class}, - new Object[] { parameterName, - parameterValue}); - } - - - -// JDBC 3.0 - public void setTime (String parameterName, Time parameterValue, Calendar cal) - throws SQLException - { - callMethod ("setTime", - new Class[] { String.class, Time.class, Calendar.class}, - new Object[] { parameterName, - parameterValue, cal}); - } - - - -// JDBC 3.0 - public void setTimestamp (String parameterName, Timestamp parameterValue) - throws SQLException - { - callMethod ("setTimestamp", - new Class[] { String.class, Timestamp.class}, - new Object[] { parameterName, - parameterValue}); - } - - - -// JDBC 3.0 - public void setTimestamp (String parameterName, Timestamp parameterValue, Calendar cal) - throws SQLException - { - callMethod ("setTimestamp", - new Class[] { String.class, Timestamp.class, Calendar.class}, - new Object[] { parameterName, - parameterValue, cal}); - } - - - -// JDBC 3.0 - public void setURL (String parameterName, URL parameterValue) - throws SQLException - { - callMethod ("setURL", - new Class[] { String.class, URL.class}, - new Object[] { parameterName, - parameterValue}); - } - - - - public boolean wasNull () - throws SQLException - { - return callMethodRtnBool ("wasNull"); - } - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.CallableStatement" }; - } - - - - //@PDA jdbc40 - public Reader getCharacterStream(int parameterIndex) throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getCharacterStream", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (parameterIndex) }, - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - public Reader getCharacterStream(String parameterName) throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getCharacterStream", - new Class[] { String.class }, - new Object[] { new Integer (parameterName) }, - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream(int parameterIndex) throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getNCharacterStream", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (parameterIndex) }, - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream(String parameterName) throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getNCharacterStream", - new Class[] { String.class }, - new Object[] { new Integer (parameterName) }, - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - /* ifdef JDBC40 - public NClob getNClob(int parameterIndex) throws SQLException - { - try { - JDNClobProxy newClob = new JDNClobProxy (); - return (JDNClobProxy) connection_.callFactoryMethod (pxId_, - "getNClob", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(parameterIndex) }, - newClob); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - public NClob getNClob(String parameterName) throws SQLException - { - try { - JDNClobProxy newClob = new JDNClobProxy (); - return (JDNClobProxy) connection_.callFactoryMethod (pxId_, - "getNClob", - new Class[] { String.class }, - new Object[] { new Integer(parameterName) }, - newClob); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - endif */ - - //@PDA jdbc40 - public String getNString(int parameterIndex) throws SQLException - { - return (String) callMethodRtnRaw ("getNString", parameterIndex).getReturnValue (); - } - - //@PDA jdbc40 - public String getNString(String parameterName) throws SQLException - { - return (String) callMethodRtnRaw ("getNString", parameterName).getReturnValue (); - } - - //@PDA jdbc40 - /* ifdef JDBC40 - public RowId getRowId(int parameterIndex) throws SQLException - { - try { - JDRowIdProxy newRowId = new JDRowIdProxy (); - return (JDRowIdProxy) connection_.callFactoryMethod (pxId_, - "getRowId", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(parameterIndex) }, - newRowId); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - public RowId getRowId(String parameterName) throws SQLException - { - try { - JDRowIdProxy newRowId = new JDRowIdProxy (); - return (JDRowIdProxy) connection_.callFactoryMethod (pxId_, - "getRowId", - new Class[] { String.class }, - new Object[] { new Integer(parameterName) }, - newRowId); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - endif */ - - //@PDA jdbc40 - /* ifdef JDBC40 - public SQLXML getSQLXML(int parameterIndex) throws SQLException - { - try { - JDSQLXMLProxy newXML = new JDSQLXMLProxy (); - return (JDSQLXMLProxy) connection_.callFactoryMethod (pxId_, - "getSQLXML", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(parameterIndex) }, - newXML); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - public SQLXML getSQLXML(String parameterName) throws SQLException - { - try { - JDSQLXMLProxy newXML = new JDSQLXMLProxy (); - return (JDSQLXMLProxy) connection_.callFactoryMethod (pxId_, - "getSQLXML", - new Class[] { String.class }, - new Object[] { new Integer(parameterName) }, - newXML); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - endif */ - //@PDA jdbc40 - public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException - { - InputStream iStream; - if (x == null || - x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setAsciiStream", - new Class[] { String.class, InputStream.class, - Long.TYPE }, - new Object[] { parameterName, - iStream, - new Long (length) }); - } - - //@PDA jdbc40 - public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException - { - InputStream iStream; - if (x == null || - x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBinaryStream", - new Class[] { String.class, InputStream.class, - Long.TYPE }, - new Object[] { parameterName, - iStream, - new Long (length) }); - } - - //@PDA jdbc40 - public void setBlob(String parameterName, Blob x) throws SQLException - { - if (x != null && - !(x instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setBlob", - new Class[] { String.class, Blob.class }, - new Object[] { parameterName, - x }); - } - - //@PDA jdbc40 - public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException - { - InputStream iStream; - if (inputStream == null || - inputStream instanceof Serializable) - iStream = inputStream; - else { - try { - iStream = new SerializableInputStream (inputStream); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBlob", - new Class[] { String.class, InputStream.class, - Long.TYPE }, - new Object[] { parameterName, - iStream, - new Long (length) }); - } - - //@PDA jdbc40 - public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException - { - try { - SerializableReader serialReader; - if (reader == null) - serialReader = null; - else - serialReader = new SerializableReader (reader, (int)Math.max(0,length)); - callMethod ("setCharacterStream", - new Class[] { String.class, Reader.class, - Long.TYPE }, - new Object[] { parameterName, - serialReader, - new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - public void setClob(String parameterName, Clob x) throws SQLException - { - if (x != null && - !(x instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setClob", - new Class[] { String.class, Clob.class }, - new Object[] { parameterName, - x }); - } - - //@PDA jdbc40 - public void setClob(String parameterName, Reader reader, long length) throws SQLException - { - try { - SerializableReader serialRreader; - if (reader == null) - serialRreader = null; - else - serialRreader = new SerializableReader (reader, (int) Math.max(0,length)); - callMethod ("setClob", - new Class[] { String.class, Reader.class, - Long.TYPE }, - new Object[] { parameterName, - serialRreader, - new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException - { - try { - SerializableReader reader; - if (value == null) - reader = null; - else - reader = new SerializableReader (value, (int) Math.max(0,length)); - callMethod ("setNCharacterStream", - new Class[] { String.class, Reader.class, - Long.TYPE }, - new Object[] { parameterName, - reader, - new Long(length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - /* ifdef JDBC40 - public void setNClob(String parameterName, NClob value) throws SQLException - { - if (value != null && - !(value instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setNClob", - new Class[] { String.class, NClob.class }, - new Object[] { parameterName, - value }); - } - - endif */ - - //@PDA jdbc40 - public void setNClob(String parameterName, Reader reader, long length) throws SQLException - { - try { - SerializableReader serialRreader; - if (reader == null) - serialRreader = null; - else - serialRreader = new SerializableReader (reader, (int) Math.max(0,length)); - callMethod ("setNClob", - new Class[] { String.class, Reader.class, - Long.TYPE }, - new Object[] { parameterName, - serialRreader, - new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - public void setNString(String parameterName, String value) throws SQLException - { - callMethod ("setNString", - new Class[] { String.class, String.class }, - new Object[] { parameterName, value }); - } - - //@PDA jdbc40 - /* ifdef JDBC40 - public void setRowId(String parameterName, RowId x) throws SQLException - { - callMethod ("setRowId", - new Class[] { String.class, RowId.class}, - new Object[] { parameterName, x }); - } - - //@PDA jdbc40 - public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException - { - if (xmlObject != null && - !(xmlObject instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setSQLXML", - new Class[] { String.class, SQLXML.class }, - new Object[] { parameterName, - xmlObject }); - } - - endif */ - - public void setAsciiStream(String parameterName, InputStream x) throws SQLException - { - InputStream iStream; - if (x == null || - x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setAsciiStream", - new Class[] { String.class, InputStream.class }, - new Object[] { parameterName, - iStream }); - } - - - public void setBinaryStream(String parameterName, InputStream x) throws SQLException - { - InputStream iStream; - if (x == null || - x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBinaryStream", - new Class[] { String.class, InputStream.class }, - new Object[] { parameterName, - iStream }); - } - - - public void setBlob(String parameterName, InputStream inputStream) throws SQLException - { - InputStream iStream; - if (inputStream == null || - inputStream instanceof Serializable) - iStream = inputStream; - else { - try { - iStream = new SerializableInputStream (inputStream); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBlob", - new Class[] { String.class, InputStream.class }, - new Object[] { parameterName, - iStream }); - } - - - public void setCharacterStream(String parameterName, Reader reader) throws SQLException - { - try { - SerializableReader serialRreader; - if (reader == null) - serialRreader = null; - else - serialRreader = new SerializableReader (reader); - callMethod ("setCharacterStream", - new Class[] { String.class, Reader.class }, - new Object[] { parameterName, - serialRreader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - public void setClob(String parameterName, Reader reader) throws SQLException - { - try { - SerializableReader serialRreader; - if (reader == null) - serialRreader = null; - else - serialRreader = new SerializableReader (reader); - callMethod ("setClob", - new Class[] { String.class, Reader.class }, - new Object[] { parameterName, - serialRreader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - public void setNCharacterStream(String parameterName, Reader value) throws SQLException - { - try { - SerializableReader serialRreader; - if (value == null) - serialRreader = null; - else - serialRreader = new SerializableReader (value); - callMethod ("setNCharacterStream", - new Class[] { String.class, Reader.class }, - new Object[] { parameterName, - serialRreader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - public void setNClob(String parameterName, Reader reader) throws SQLException - { - try { - SerializableReader serialRreader; - if (reader == null) - serialRreader = null; - else - serialRreader = new SerializableReader (reader); - callMethod ("setNClob", - new Class[] { String.class, Reader.class }, - new Object[] { parameterName, - serialRreader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDCharOctetLengthFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDCharOctetLengthFieldMap.java deleted file mode 100644 index 390a7c00c..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDCharOctetLengthFieldMap.java +++ /dev/null @@ -1,67 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDCharOctetLengthFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - -class JDCharOctetLengthFieldMap -extends JDTypeInfoFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - private int typeIndex_; //@A1A - int lengthIndex_; //@A1A - JDCharOctetLengthFieldMap(int typeIndex, int lengthIndex, int precisionIndex, - int scaleIndex, int ccsidIndex, int vrm, JDProperties properties) // @M0C - added vrm and properties //@KKB - { - super(typeIndex, lengthIndex, precisionIndex, scaleIndex, ccsidIndex, vrm, properties); // @M0C //@KKB - typeIndex_ = typeIndex; //@A1A - lengthIndex_ = lengthIndex; //@A1A - } - - /** - Returns the data type in JDBC format. - **/ - public Object getValue(JDRow row) - throws SQLException - { - String typeName = row.getSQLData(typeIndex_).getString().trim(); //@A1A retrieve the type name - if(typeName.equals("DISTINCT")) //@A1A We do not have a SQLData class for DISTINCTs - return new Integer(-1); //@A1A - SQLData data = (SQLData)super.getValue(row); - if(data.isText()) - return new Integer(data.getPrecision()); - else - return new Integer(-1); - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return false; - } - - /** - Indicates if the value is null. - **/ - public boolean isNull(JDRow row) - throws SQLException - { - return false; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JDCharToShortFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDCharToShortFieldMap.java deleted file mode 100644 index b362f97ca..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDCharToShortFieldMap.java +++ /dev/null @@ -1,76 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDCharToShortFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - - - -/** -The JDCharToShortFieldMap class converts a 2 character field to -the short value required by JDBC. It handles the situation where -the system sends back data of type char, but it actually contains -an integer. For example, instead of having the expected "00F1" -for 1, it has "0001". -**/ -class JDCharToShortFieldMap -extends JDSimpleFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - JDCharToShortFieldMap (int fromIndex) - { - super (fromIndex); - } - - - - public Object getValue (JDRow row) - throws SQLException - { - Object serverData = super.getValue (row); - - if (serverData instanceof String) { // @C1A - // In V4R3 and before: // @C1A - // The system returns a smallint tagged as a char(2), so we need - // to convert it ourselves. - byte[] asBytes = ((String) serverData).getBytes (); - short asShort = BinaryConverter.byteArrayToShort (asBytes, 0); - return new Short (asShort); - } // @C1A - else { // @C1A - // In V4R4, this started coming back as a Short. // @C1A - return serverData; // @C1A - } // @C1A - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return false; - } - - public boolean isNull (JDRow row) - throws SQLException - { - return false; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDClassNameFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDClassNameFieldMap.java deleted file mode 100644 index cf18a2e35..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDClassNameFieldMap.java +++ /dev/null @@ -1,66 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDClassNameFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - -/** -The JDClassNameFieldMap class converts an 8 character -description of the data type name to the Java class name. -**/ -class JDClassNameFieldMap -extends JDSimpleFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; // @A1A - private JDProperties properties_; // @M0A - added JDProperties so we can get the decimal scale & precision - private int vrm_; // @M0A - added vrm so we can pass it to the newData method - - - JDClassNameFieldMap (int fromIndex, SQLConversionSettings settings, int vrm, JDProperties properties) // @A1C // @M0C - { - super (fromIndex); - settings_ = settings; // @A1A - properties_ = properties; // @M0A - vrm_ = vrm; // @M0A - } - - public Object getValue (JDRow row) - throws SQLException - { - String sourceType = super.getValue (row).toString (); - if(sourceType != null) - return SQLDataFactory.newData(sourceType, 2, 1, 1, 0, settings_, vrm_, properties_).getObject ().getClass ().getName (); // @A1C // @M0C - pass more parms //@KKB pass 0 for ccsid - else - return ""; - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return false; - } - - public boolean isNull (JDRow row) - throws SQLException - { - return false; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JDClobProxy.java b/cvsroot/src/com/ibm/as400/access/JDClobProxy.java deleted file mode 100644 index 92b60105e..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDClobProxy.java +++ /dev/null @@ -1,247 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDClobProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Writer; -import java.io.Reader; -import java.lang.reflect.InvocationTargetException; -import java.sql.Clob; -import java.sql.SQLException; - - - -// JDBC 2.0 -/** -The JDClobProxy class provides access to character large -objects. The data is valid only within the current -transaction. -**/ -class JDClobProxy -extends AbstractProxyImpl -implements Clob -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Copied from JDError: - static final String EXC_FUNCTION_NOT_SUPPORTED = "IM001"; - - - - public InputStream getAsciiStream () - throws SQLException - { - try { - JDInputStreamProxy newStream = new JDInputStreamProxy (); - return (JDInputStreamProxy) connection_.callFactoryMethod ( - pxId_, "getAsciiStream", newStream); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public Reader getCharacterStream () - throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getCharacterStream", - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public String getSubString (long start, int length) - throws SQLException - { - try { - return (String) connection_.callMethod (pxId_, "getSubString", - new Class[] { Long.TYPE, Integer.TYPE }, - new Object[] { new Long (start), - new Integer (length) }) - .getReturnValue(); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public long length () - throws SQLException - { - try { - return connection_.callMethod (pxId_, "length") - .getReturnValueLong (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public long position (String pattern, long start) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "position", - new Class[] { String.class, Long.TYPE }, - new Object[] { pattern, new Long (start) }) - .getReturnValueLong (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public long position (Clob pattern, long start) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "position", - new Class[] { Clob.class, Long.TYPE }, - new Object[] { pattern, new Long (start) }) - .getReturnValueLong (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 3.0 - public OutputStream setAsciiStream (long pos) - throws SQLException - { - // Avoid dragging in JDError - //@K1D throw new SQLException ( - //@K1D AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - //@K1D EXC_FUNCTION_NOT_SUPPORTED, -99999); - try //@K1A - { - JDOutputStreamProxy newStream = new JDOutputStreamProxy (); - return (JDOutputStreamProxy) connection_.callFactoryMethod (pxId_, "setAsciiStream", - new Class[] { Long.TYPE}, - new Object[] { new Long(pos)}, - newStream); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 3.0 - public Writer setCharacterStream (long pos) - throws SQLException - { - // Avoid dragging in JDError - //@K1D throw new SQLException ( - //@K1D AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - //@K1D EXC_FUNCTION_NOT_SUPPORTED, -99999); - try //@K1A - { - JDWriterProxy newWriter = new JDWriterProxy (); - return (JDWriterProxy) connection_.callFactoryMethod (pxId_, "setCharacterStream", - new Class[] { Long.TYPE}, - new Object[] { new Long(pos)}, - newWriter); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 3.0 - public int setString (long pos, String str) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "setString", - new Class[] { Long.TYPE, String.class}, - new Object[] { new Long(pos), str}) - .getReturnValueInt (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 3.0 - public int setString (long pos, String str, int offset, int len) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "setString", - new Class[] { Long.TYPE, String.class, Integer.TYPE, Integer.TYPE}, - new Object[] { new Long(pos), str, new Integer(offset), new Integer(len)}) - .getReturnValueInt (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - -// JDBC 3.0 - public void truncate (long len) - throws SQLException - { - try { - connection_.callMethod (pxId_, "truncate", - new Class[] { Long.TYPE,}, - new Object[] { new Long(len)} ); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - //@PDA jdbc40 - public void free() throws SQLException - { - try { - connection_.callMethod (pxId_, "free"); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - public Reader getCharacterStream(long pos, long length) throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getCharacterStream", - new Class[] { Long.TYPE, Long.TYPE}, - new Object[] { new Long(pos), new Long(length)}, - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDConnectionPoolKey.java b/cvsroot/src/com/ibm/as400/access/JDConnectionPoolKey.java deleted file mode 100644 index 72d25abac..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDConnectionPoolKey.java +++ /dev/null @@ -1,76 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDConnectionPoolKey.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2005-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** - Helper class for storing connection pool hashkeys, used by AS400JDBCManagedDataSource and JDConnectionPoolManager. - It encapsulates the parameters that define a unique database connection: - user, password. - **/ -final class JDConnectionPoolKey -{ - private String user_; // userID - private int pwHashcode_; // password hash - private int hashCode_; - - - JDConnectionPoolKey(String userName, int pwHashcode) - { - user_ = userName; - pwHashcode_ = pwHashcode; - hashCode_ = user_.hashCode() + pwHashcode; - } - - - // Need this for key comparisons. - public boolean equals(Object obj) - { - try - { - if (obj == null) return false; - JDConnectionPoolKey key = (JDConnectionPoolKey)obj; - return (user_.equals(key.user_) && pwHashcode_ == key.pwHashcode_); - } - catch (Throwable e) { - return false; - } - } - - String getUser() - { - return user_; - } - - // Needed for good hashing. - public int hashCode() - { - return hashCode_; - } - - // Only used for logging purposes, that's why we build the String here every time - // instead of in the constructor. We don't mind taking a performance hit when we are tracing. - public String toString() - { - return "["+ user_ + "]"; - } - - void update(String userName, int pwHashcode) - { - user_ = userName; - pwHashcode_ = pwHashcode; - hashCode_ = user_.hashCode() + pwHashcode; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDConnectionPoolManager.java b/cvsroot/src/com/ibm/as400/access/JDConnectionPoolManager.java deleted file mode 100644 index 6c36a356e..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDConnectionPoolManager.java +++ /dev/null @@ -1,2348 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDConnectionPoolManager.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2005-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; -import javax.sql.ConnectionEventListener; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.Stack; -import java.util.TreeSet; - -/** - This is the Toolbox's built-in connection pooling manager. - Each instance of AS400JDBCManagedDataSource creates and uses an instance of this class to manage its pooled connections. - -

    - Note that the Toolbox's original (older) data source classes are not automatically managed: -

      -
    • AS400JDBCDataSource -
    • AS400JDBCConnectionPoolDataSource -
    • AS400JDBCXADataSource -
    - - **/ -final class JDConnectionPoolManager -implements ConnectionEventListener -{ - private static final boolean DEBUG = false; // turn on if debugging - private static final boolean GATHER_STATS = false; // turn on to gather/print additional statistics (useful when debugging and performance-tuning) - static final boolean TESTING_ERROR_EVENTS = false; - - - // Terminology for connections: - // 'active' == in-use == allocated - // 'available' == not-in-use == unallocated - // 'condemned' == neither of the above; selected for removal from pool - - // Note to maintenance developer: Be _very_ careful about synchronizing methods. They are likely to cause deadlocks. - - // All of the following lists (activeConnections_, availableConnections_, and condemnedConnections_) are ultimately just lists of AS400JDBCPooledConnection objects. They're just organized in different ways. - // Note: When obtaining multiple simultaneous locks, the order of synchronization must never deviate from: active, available1, available2, condemned - - - // Connections that are currently active (allocated). - // This is a sorted list containing AS400JDBCPooledConnection objects. - // Connections are added to this list when they are allocated to an application. - // Connections are removed from this list when they are returned to the pool, - // or when they are identified as "expired" by the reaper daemon. - // The connections in this list are sorted by creation date (in ascending order). - // Since the list is maintained in order of creation time, the reaper daemon can quickly - // identify any "expired" connections, without having to examine the entire list. - // The set contains AS400JDBCPooledConnection objects. - // The Comparator compares connection creation dates; for identical creation dates, hashcodes are also compared. - private final TreeSet activeConnections_ = new TreeSet(new JDAgeComparator()); - - - // Companion list for the activeConnections_ list. - // Active connections that have incurred connection errors, and therefore must not be reused. - // This is a sorted list containing AS400JDBCPooledConnection objects. - // Connections are added to this list when they fire a connectionErrorOccurred event. - // Connections are removed from this list when they are returned to the pool, - // or when they are identified as "expired" by the reaper daemon. - // The set contains AS400JDBCPooledConnection objects. - // The Comparator simply compares connection hashcodes. - private final HashSet activeConnectionsInError_ = new HashSet(); - - - // Connections that are available to be handed out. - // Connections are added to this list when they are created by the pool manager, - // and when they are returned to the pool after being allocated. - // Connections are removed from this list when they are allocated to an application, - // or when they are identified as "stale" by the maintainer daemon. - // This array contains two HashMaps (plus a placeholder for swapping). - // Each HashMap maps JDConnectionPoolKeys to Stacks. - // Each Stack contains AS400JDBCPooledConnection objects. - // The connectionKey gets you to the Stack that contains connections for that key. - private final HashMap[] availableConnections_ = {new HashMap(100), new HashMap(100), null}; - - - // Companion list for the availableConnections_ list. - // Connections are added to and removed from this list, whenever they are added to / removed from - // the availableConnections_ list. - // This array contains two LinkedHashSets (plus a placeholder for swapping). - // Each LinkedHashSet contains AS400JDBCPooledConnection objects, in the order in which they were (most recently) added to the associated availableConnections_ list. - // Note: The availableConnections_ and idledConnectionsSequence_ lists must always be swapped simultaneously. The availableConnectionsIdledSequence_ list is "metadata" for the availableConnections_ list. - // Access to an availableConnectionsIdledSequence_ list must only be done within a sync block for the associated availableConnections_ list. - private final LinkedHashSet[] availableConnectionsIdledSequence_ = {new LinkedHashSet(), new LinkedHashSet(), null}; - - - - // Connections that are no longer in use, which are staged to be removed from the pool. - // Connections are added to this list when it is determined that they should be physically closed. - // Connections are removed from this list when they are physically closed. - // This list contains AS400JDBCPooledConnection objects. - private final ArrayList condemnedConnections_ = new ArrayList(100); - - - - - // Connection keys that have been invalidated via the invalidate() method. - // This list contains JDConnectionPoolKey objects. - private final HashSet invalidatedKeys_ = new HashSet(); - - // The datasource being used for logging and tracing. - private AS400JDBCManagedDataSource logger_; - - // The datasource that creates new connections, and specifies pool properties. - private AS400JDBCManagedConnectionPoolDataSource cpds_; - - - // Standard JDBC connection pool properties. (See JDBC Tutorial p. 442, table 14.1) - - // For consistency, all time-related properties in this class are in units of milliseconds. - // Note that all "PoolSize_" variables refer to the total number of connections ('active', 'available', and 'condemned'), not just available connections. - - private int initialPoolSize_;// The # of physical connections the pool should contain - // when it is created. - private int minPoolSize_; // The minimum # of physical connections in the pool. - private int maxPoolSize_; // The maximum # of physical connections the pool should contain. - // 0 (zero) indicates no maximum size. - private long maxIdleTime_; // The # of milliseconds that a physical connection should - // remain unused in the pool before it is closed; that is, when the - // connection is considered "stale". - // 0 (zero) indicates no time limit. - // See JDBC Tutorial, p. 643, 2nd paragraph. - private long propertyCycle_; // The interval, in milliseconds, that the pool should wait before - // enforcing the policy defined by the values currently assigned - // to these connection pool properties. - // maxStatements_; // The total # of statements the pool should keep open. - // 0 (zero) indicates that the caching of statements is disabled. - // Note: The Toolbox JDBC driver doesn't cache prepared statements. - - - // Additional connection pool properties. - - private long maxLifetime_; // The # of milliseconds that a physical connection should - // remain in the pool before it is closed; that is, when the - // connection is considered "expired". - // 0 (zero) indicates no time limit. - - private long maintainerInterval_; // Max # of milliseconds between maintainer daemon cycles. - private long reaperInterval_; // Max # of milliseconds between reaper daemon cycles. - private long scavengerInterval_; // Max # of milliseconds between scavenger daemon cycles. - - private int condemnedListLengthThreshold_; // When the 'condemned' list reaches this length, we wake up the scavenger daemon to close all connections on 'condemned' list. - private long minSwapInterval_; // Min # of milliseconds between list swaps. - - - // The total (cumulative) number of physical connections that have ever been created by this pool manager. - private int numConnectionsCreated_; - - // The total (cumulative) number of physical connections that have ever been closed (and removed from the pool) by this pool manager. - private int numConnectionsDestroyed_; - - // Note: At any given moment, the total number of connections in the pool is the difference of the above two values. - - - private final Object connectionsCreatedLock_ = new Object(); - private final Object connectionsDestroyedLock_ = new Object(); - - - - private boolean poolSizeLimited_; // Total pool size (number of open connections) is limited. - private boolean enforceMaxPoolSize_; // Pool size limitation is enforced. - private boolean connectionLifetimeLimited_; // Connections have maximum lifetime; i.e. they can expire. - private boolean pretestConnections_; // Pretest connections before allocating them to requesters. - private boolean reuseConnections_; // Re-use connections that have been returned to pool. - private int minDefaultStackSize_; // Desired minimum size of 'available' stack for the default key. - - - private JDPoolMaintainer poolMaintainer_; // Manages the 'available' lists. - private Thread maintainerDaemon_; - - private JDPoolReaper poolReaper_; // Removes expired connections from 'active' list. - private Thread reaperDaemon_; // Only started if connectionLifetimeLimited_ == true. - - private JDPoolScavenger poolScavenger_; // Closes physical connections in 'condemned' list. - private Thread scavengerDaemon_; - - private boolean keepDaemonsAlive_ = true; // When this is false, the daemons shut down. - private final Object maintainerSnoozeLock_ = new Object(); - private final Object maintainerSleepLock_ = new Object(); - private final Object reaperSleepLock_ = new Object(); - private final Object scavengerSleepLock_ = new Object(); - - private boolean poolPaused_ = false; - private final Object poolPauseLock_ = new Object(); - - private boolean fillingPool_; // gets set to 'true' while fillPool() is running - private boolean poolClosed_; // gets set to 'true' (and stays true) when closePool() starts - private boolean poolClosedCompletely_; // gets set to 'true' when closePool() completes - private boolean needMoreConnections_; // informs the maintainerDaemon_ that the foreground 'available' list is running low on default-key connections, and needs to be swapped-out - - // Time at which the foreground and background 'available' lists were last compared (and possibly swapped). - private long timeLastSwapAttempted_ = 0L; - private boolean swapInProgress_; - private final Object swapLock_ = new Object(); - - private boolean healthCheckInProgress_; - private final Object healthCheckLock_ = new Object(); - - // 'Sides' of the availableConnections_ list: "foreground" list and "background" list. - private static final int FOREGROUND = 0; // specifies list accessed by the foreground process - private static final int BACKGROUND = 1; // specifies list updated by the daemons - private static final int HOLD = 2; // dummy value; used when swapping the above 2 lists - - private static final int SYNC_NONE = 10; - private static final int SYNC_ALL = 11; - - // Used for debugging only: - - private int maintainerDaemonCycles_ = 0; - private int reaperDaemonCycles_ = 0; - private int scavengerDaemonCycles_ = 0; - - private int numGetConnectionCalls_received_ = 0; - private int numGetConnectionCalls_succeeded_ = 0; - private int numGetConnectionCalls_returnedNull_ = 0; - private int numGetConnectionCalls_whileClosing_ = 0; - - private int connectionsReturnedToPool_ = 0; - private int connectionErrorsOccurred_ = 0; - - private int staleConnectionsIdentified_ = 0; - private int expiredConnectionsIdentifiedByReaper_ = 0; - private int expiredConnectionsIdentifiedWhenReturned_ = 0; - private int surplusPrecreatedConnectionsRemoved_ = 0; - private int survivingConnectionsRemoved_ = 0; - private int condemnedConnectionsRemoved_ = 0; - - private int swapsAttempted_ = 0; - private int swapsSucceeded_ = 0; - private int swapsFailed_ = 0; - private int swapsFailed_notWorthIt_ = 0; - private int swapsSucceeded_foreground_ = 0; - private int swapsSucceeded_background_ = 0; - private int swapsFailed_foreground_ = 0; - private int swapsFailed_background_ = 0; - private int swapsFailed_premature_ = 0; - private int swapsFailed_foreground_inProgress_ = 0; - private int swapsFailed_background_inProgress_ = 0; - private int swapsFailed_foreground_daemonAwake_ = 0; - - /** - **/ - JDConnectionPoolManager(AS400JDBCManagedDataSource logger, AS400JDBCManagedConnectionPoolDataSource cpds) - { - // We assume that the caller will never give us null args. - logger_ = logger; - cpds_ = cpds; - - initialPoolSize_ = cpds_.getInitialPoolSize(); - minPoolSize_ = cpds_.getMinPoolSize(); - maxPoolSize_ = cpds_.getMaxPoolSize(); - enforceMaxPoolSize_ = cpds_.isEnforceMaxPoolSize(); - pretestConnections_ = cpds_.isPretestConnections(); - reuseConnections_ = cpds_.isReuseConnections(); - maxIdleTime_ = cpds_.getMaxIdleTime()*1000; // convert to milliseconds - maxLifetime_ = cpds_.getMaxLifetime()*1000; // convert to milliseconds - propertyCycle_ = cpds_.getPropertyCycle()*1000; // convert to milliseconds - if (DEBUG) - { - logInformation("initialPoolSize_: " + initialPoolSize_); - logInformation("minPoolSize_: " + minPoolSize_); - logInformation("maxPoolSize_: " + maxPoolSize_); - logInformation("enforceMaxPoolSize_: " + enforceMaxPoolSize_); - logInformation("pretestConnections_: " + pretestConnections_); - logInformation("reuseConnections_: " + reuseConnections_); - logInformation("maxIdleTime_: " + maxIdleTime_ + " msecs"); - logInformation("maxLifetime_: " + maxLifetime_ + " msecs"); - logInformation("propertyCycle_: " + propertyCycle_ + " msecs"); - logInformation("server name: |" + cpds_.getServerName() + "|"); - logInformation("default user: |" + cpds_.getUser() + "|"); - } - if (GATHER_STATS) - { - System.out.println("initialPoolSize_: " + initialPoolSize_); - System.out.println("minPoolSize_: " + minPoolSize_); - System.out.println("maxPoolSize_: " + maxPoolSize_); - System.out.println("enforceMaxPoolSize_: " + enforceMaxPoolSize_); - System.out.println("pretestConnections_: " + pretestConnections_); - System.out.println("reuseConnections_: " + reuseConnections_); - System.out.println("maxIdleTime_: " + maxIdleTime_ + " msecs"); - System.out.println("maxLifetime_: " + maxLifetime_ + " msecs"); - System.out.println("propertyCycle_: " + propertyCycle_ + " msecs"); - System.out.println("server name: |" + cpds_.getServerName() + "|"); - System.out.println("default user: |" + cpds_.getUser() + "|"); - } - - maintainerInterval_ = propertyCycle_; - reaperInterval_ = 1800*1000; // at least once every 30 minutes (reasonable value) - scavengerInterval_ = maintainerInterval_ * 20; // at least once every 20 maint cycles - - if (maxLifetime_ == 0) connectionLifetimeLimited_ = false; - else { - connectionLifetimeLimited_ = true; - reaperInterval_ = maxLifetime_ / 3; // reasonable value - } - - minSwapInterval_ = 50; // no more often than once every 50 msecs (reasonable value) - - if (maxPoolSize_ == 0) { - poolSizeLimited_ = false; - } - else - { - poolSizeLimited_ = true; - if (maxPoolSize_ < minPoolSize_) - { - if (JDTrace.isTraceOn()) - logWarning("minPoolSize ("+minPoolSize_+") exceeds maxPoolSize ("+maxPoolSize_+")"); - maxPoolSize_ = minPoolSize_ + 5; // a reasonable value - } - - // Handle the initPoolSize being out of range. - if (initialPoolSize_ > maxPoolSize_) - { - if (JDTrace.isTraceOn()) { - logWarning("initialPoolSize ("+initialPoolSize_+") exceeds maxPoolSize ("+maxPoolSize_+")"); - } - initialPoolSize_ = minPoolSize_; - } - } - - // Note: Tolerate initialPoolSize_ < minPoolSize_. - - condemnedListLengthThreshold_ = Math.max(3, minPoolSize_/50); // # of 'condemned' connections that triggers an immediate cleanup - - minDefaultStackSize_ = (reuseConnections_ ? 4 : 1); - - // Fill the pool with the number of connections specified for initial pool size. - // We distribute the new connections evenly between the two 'sides'. - fillPool(Math.max(1,initialPoolSize_/2), FOREGROUND); // at least 1 connection - fillPool(initialPoolSize_/2, BACKGROUND); - - // Create and start the maintainer daemon. - poolMaintainer_ = new JDPoolMaintainer(); - maintainerDaemon_ = new Thread(poolMaintainer_, "PoolMaintainerDaemon"); - maintainerDaemon_.setDaemon(true); - maintainerDaemon_.start(); - - // Create and start the scavenger daemon. - poolScavenger_ = new JDPoolScavenger(); - scavengerDaemon_ = new Thread(poolScavenger_, "PoolScavengerDaemon"); - scavengerDaemon_.setDaemon(true); - scavengerDaemon_.start(); - - // If connections have a maximum lifetime, create and start the reaper daemon. - if (connectionLifetimeLimited_) - { - poolReaper_ = new JDPoolReaper(); - reaperDaemon_ = new Thread(poolReaper_, "PoolReaperDaemon"); - reaperDaemon_.setDaemon(true); - reaperDaemon_.start(); - } - - } - - // Verifies that all the daemons are still running. - private final boolean areDaemonsAlive() - { - boolean ok = true; - if (!maintainerDaemon_.isAlive()) { - ok = false; - logError("The maintainerDaemon_ is no longer running"); - } - if (!scavengerDaemon_.isAlive()) { - ok = false; - logError("The scavengerDaemon_ is no longer running"); - } - if (connectionLifetimeLimited_ && !reaperDaemon_.isAlive()) { - ok = false; - logError("The reaperDaemon_ is no longer running"); - } - return ok; - } - - // Checks the health of the connection pool: That all the connection count is consistent with the list lengths, and that all the daemons are still running. - // Future enhancement: Call this method periodically from one of the daemons. - final boolean checkHealth(boolean logStatistics) - { - boolean ok = true; - - // First see if another thread is already running this method; and if so, just return true. - boolean alreadyChecking = healthCheckInProgress_; - if (!alreadyChecking) { - synchronized (healthCheckLock_) { - if (healthCheckInProgress_) alreadyChecking = true; - else healthCheckInProgress_ = true; - } - } - - if (alreadyChecking) { - if (DEBUG) logDiagnostic("checkHealth is already in progress"); - return true; - } - - try - { - // First pause everything. - pausePool(); - try { - Thread.sleep(1500); // Let everything reach a pause point. - } - catch (InterruptedException ie) {} // ignore - - if (swapInProgress_) // swaps ignore pause requests - { - try { - Thread.sleep(20); // Let the swap finish. - } - catch (InterruptedException ie) {} // ignore - } - if (swapInProgress_ && DEBUG) { - logError("checkHealth(): swapInProgress_ flag is still on after 50 msec wait."); - } - - // Lock all the lists and counts. - // Then check that everything looks reasonable and consistent. - synchronized (activeConnections_) - { - synchronized (availableConnections_[FOREGROUND]) - { - synchronized (availableConnections_[BACKGROUND]) - { - synchronized (condemnedConnections_) - { - synchronized (connectionsCreatedLock_) - { - synchronized (connectionsDestroyedLock_) - { - // Count all connections on the 'available' list. - int totalAvailConnCount = 0; - for (int side = FOREGROUND; side <= BACKGROUND; side++) - { - int availConnCount = 0; - // Get list of all connection keys in the 'available' HashMap. - JDConnectionPoolKey[] poolKeys = (JDConnectionPoolKey[])availableConnections_[side].keySet().toArray(new JDConnectionPoolKey[0]); - for (int i=0; i maxPoolSize_)) - { - if (DEBUG) - logDiagnostic("The requested number of connections ("+numConnectionsToAdd+") would cause the connection pool to exceed its maximum size"); - numConnectionsToAdd = maxPoolSize_ - getConnectionCount(SYNC_NONE); - } - - if (numConnectionsToAdd < 1) { - if (DEBUG) logDiagnostic("fillPool() is returning because pool is already full"); - return; - } - - // Prepare to add connections to the pool. Pre-create some new connections, outside of the sync block. - - JDConnectionPoolKey poolKey = cpds_.getConnectionPoolKey(); // default key - AS400JDBCPooledConnection[] newConnections = null; - int numberOfConnsCreatedForThisRequest = 0; - int numConnectionsAddedToPool = 0; - - // Implementation note: The creation of new physical connections can be a slow process. - // We don't want checkHealth() to run while we're filling the pool, since the connection counts may temporarily appear to be inconsistent. - pauseIfPoolPaused(0); // if pool is paused, wait until unpause() is called - fillingPool_ = true; - try - { - newConnections = new AS400JDBCPooledConnection[numConnectionsToAdd]; - try - { - for (int i=0; i numConnectionsAddedToPool) - { - if (DEBUG) { - logDiagnostic("newConnections.length=="+newConnections.length+"; numConnectionsAddedToPool=="+numConnectionsAddedToPool+"; need to close " + (numberOfConnsCreatedForThisRequest - numConnectionsAddedToPool) + " connections"); - } - - for (int i=numConnectionsAddedToPool; i= maxPoolSize_) { - if (DEBUG || GATHER_STATS) { - System.out.println("\nPOOL IS FULL: " + - 100*getConnectionCount(SYNC_NONE)/maxPoolSize_ + "% ALLOCATED"); - } - return true; - } - else return false; - } - - // Returns true if pool contains more than maxPoolSize_ connections. - private final boolean isPoolOverFull() - { - if (poolSizeLimited_ && (getConnectionCount(SYNC_NONE) > maxPoolSize_)) { - return true; - } - else return false; - } - - // Logs a diagnostic message. - private final void logDiagnostic(String text) - { - logger_.logDiagnostic(text); - } - - // Logs an error message. - private final void logError(String text) - { - logger_.logError(text); - } - - // Logs an exception. - private final void logException(String text, Exception e) - { - logger_.logException(text, e); - } - - // Logs an informational message. - private final void logInformation(String text) - { - logger_.logInformation(text); - } - - // Logs a warning message. - private final void logWarning(String text) - { - logger_.logWarning(text); - } - - - // Pause if the pool's "pause" flag is up. - // Note: Never call this method while inside a sync block, otherwise you're likely to hang. - private final void pauseIfPoolPaused(long maxTimeToPause) - { - while (poolPaused_) { - if (DEBUG) logDiagnostic("Pool is paused"); - try { - synchronized (poolPauseLock_) { - if (poolPaused_) poolPauseLock_.wait(maxTimeToPause); - } - } - catch (InterruptedException ie) {} // ignore - } - } - - - // Pauses all threads manipulating the connection lists. - // Caution: If the pool is paused but not subsequently unpaused, all threads using the pool will hang, and the PoolReaper would eventually clean up connections in the pool as their lifetimes expire. - //
    Note: Never call this method while inside a sync block, otherwise a hang is likely to result. - private final void pausePool() - { - poolPaused_ = true; - synchronized (poolPauseLock_) { - poolPaused_ = true; // ensure that it ends up 'on' - } - } - - - // A quick-and-dirty precheck to see if the background 'available' list is longer than the foreground list. - private final boolean isBackgroundListLongerThanForegroundList(JDConnectionPoolKey poolKey) - { - // It only makes sense to swap lists if there are more available connections (for desired key) in background list than in foreground list. - - // Design note: For performance, we do _not_ necessarily synchronize access to lists here. - // If running unsynchronized, we may occasionally get a false positive or negative (for example if the lists get modified or swapped underneath us), but that won't cause any real damage. - - Stack backgroundStack = (Stack)availableConnections_[BACKGROUND].get(poolKey); - if (backgroundStack != null && backgroundStack.size() != 0) - { - Stack foregroundStack = (Stack)availableConnections_[FOREGROUND].get(poolKey); - if (foregroundStack == null || (foregroundStack.size() < backgroundStack.size())) - { - return true; - } - } - return false; - } - - // Utility method. Assumes that the caller has locked the lists. - private final void swapAvailLists() - { - // Swap the foreground and background 'available' lists. - availableConnections_[HOLD] = availableConnections_[FOREGROUND]; - availableConnections_[FOREGROUND] = availableConnections_[BACKGROUND]; - availableConnections_[BACKGROUND] = availableConnections_[HOLD]; - availableConnections_[HOLD] = null; - - // Swap the foreground and background 'idled sequence' lists. - availableConnectionsIdledSequence_[HOLD] = availableConnectionsIdledSequence_[FOREGROUND]; - availableConnectionsIdledSequence_[FOREGROUND] = availableConnectionsIdledSequence_[BACKGROUND]; - availableConnectionsIdledSequence_[BACKGROUND] = availableConnectionsIdledSequence_[HOLD]; - availableConnectionsIdledSequence_[HOLD] = null; - } - - - // Utility method. - // Swaps the foreground and background 'available' connection lists. - // Returns true if the swap succeeded; false if the swap wasn't performed. - // The swap may fail, for example, if: - // (1) a swap is already in progress; or - // (2) the background list (for specified key) isn't longer than the foreground list; or - // (3) the request is from the foreground process, and the poolMaintainer daemon currently has the background list locked; or - // (4) the previous swap happened too recently. - // If the swap fails, this method exits and returns false. - // If the foreground process is requesting the swap, we ensure that the swap either succeeds quickly or fails quickly. - private final boolean swapConnectionLists(int sideRequestingSwap, JDConnectionPoolKey poolKey) - { - if (GATHER_STATS) swapsAttempted_++; - boolean swapped = false; - boolean alreadySwapping = swapInProgress_; - try - { - if (!alreadySwapping) - { - // If we recently performed a swap attempt, reject this request. - if (System.currentTimeMillis() - timeLastSwapAttempted_ < minSwapInterval_) { - if (DEBUG || GATHER_STATS) swapsFailed_premature_++; - if (DEBUG) logDiagnostic("Premature swap request rejected"); - return false; // Bail out now. - } - - // Precheck the foreground/background lists, to see if it's worth even trying to swap. - if (!isBackgroundListLongerThanForegroundList(poolKey)) - { - if (DEBUG) logDiagnostic("Swap request rejected because background list is not longer than foreground list"); - if (GATHER_STATS) swapsFailed_notWorthIt_++; - return false; // Bail out now. - } - - synchronized (swapLock_) { // Grab lock, and check again. - if (swapInProgress_) alreadySwapping = true; - else swapInProgress_ = true; - } - } - - if (alreadySwapping) - { - if (DEBUG) logDiagnostic("Swap request rejected because swap already in progress"); - if (GATHER_STATS) { - if (sideRequestingSwap == FOREGROUND) swapsFailed_foreground_inProgress_++; - else swapsFailed_background_inProgress_++; - } - return false; // Bail out now. - } - - // If we got this far, we've determined that a swap isn't already in progress, - // and we've turned on the swapInProgress_ flag ourselves. - try - { - // Note: Never pause during a list swap. - - switch (sideRequestingSwap) - { - case BACKGROUND: // The maintainer daemon is requesting the swap. - { // Just grab the necessary locks and do the swap. - synchronized (availableConnections_[FOREGROUND]) - { - if (poolClosed_) return false; - synchronized (availableConnections_[BACKGROUND]) - { - // If we got this far, proceed with the swap (don't check poolClosed_). - timeLastSwapAttempted_ = System.currentTimeMillis(); - - // It only makes sense to swap if there are more available connections (for desired key) in background list than in foreground list. - if (isBackgroundListLongerThanForegroundList(poolKey)) - { - swapAvailLists(); - - swapped = true; - if (DEBUG || GATHER_STATS) { - swapsSucceeded_background_++; - } - } - else { // Background list isn't longer than foreground list. - if (DEBUG || GATHER_STATS) { - swapsFailed_background_++; - } - if (DEBUG) logDiagnostic("Swap requested by daemon rejected because background list is not longer than foreground list"); - } - } - } // outermost sync block - } - break; - - case FOREGROUND: // The foreground process is requesting the swap. - { - // Fail-fast if maintainer daemon is currently awake, so we don't wait for locks. - if (poolMaintainer_.isAwake_) - { - if (DEBUG || GATHER_STATS) swapsFailed_foreground_daemonAwake_++; - if (DEBUG) logDiagnostic("Foreground swap request rejected because daemon is awake"); - return false; - } - - synchronized (maintainerSnoozeLock_) { - poolMaintainer_.snooze_ = true; // Instruct daemon to go dormant if it wakes up. - // We must prevent the maintainer thread from waking up, locking the background list, then attempting a swap, since that could cause a deadlock. - } - try - { - if (poolMaintainer_.isAwake_) { - if (DEBUG || GATHER_STATS) swapsFailed_foreground_daemonAwake_++; - if (DEBUG) logDiagnostic("Foreground swap request rejected because daemon is awake"); - return false; - } - // Daemon is still sleeping, so it's safe to grab locks. - synchronized (availableConnections_[FOREGROUND]) - { - if (poolClosed_) return false; - synchronized (availableConnections_[BACKGROUND]) - { - // If we got this far, go ahead and do the swap (don't check poolClosed_). - timeLastSwapAttempted_ = System.currentTimeMillis(); - - // It only makes sense to swap if there are more available connections (for desired key) in background list than in foreground list. - if (isBackgroundListLongerThanForegroundList(poolKey)) - { - swapAvailLists(); - - swapped = true; - if (DEBUG || GATHER_STATS) swapsSucceeded_foreground_++; - } - else { // Background list isn't longer than foreground list. - if (DEBUG || GATHER_STATS) swapsFailed_foreground_++; - if (DEBUG) logDiagnostic("Swap request rejected because background list is not longer than foreground list"); - } - } - } // outermost sync block - } - finally - { // Tell the maintainer daemon to stop snoozing. - poolMaintainer_.snooze_ = false; - synchronized (maintainerSnoozeLock_) { - poolMaintainer_.snooze_ = false; // just to be sure - maintainerSnoozeLock_.notify(); - } - } - } - break; - - default: // neither FOREGROUND nor BACKGROUND - { - // Internal design error. - // Rather than crashing, attempt a fail-fast swap. - logError("Internal error: JDConnectionPoolManager.swapConnectionLists("+sideRequestingSwap+")" + sideRequestingSwap); - swapConnectionLists(FOREGROUND, poolKey); - } - break; - - } // switch - } // inner try - finally - { - if (swapped) { - needMoreConnections_ = false; - } - swapInProgress_ = false; // we turned the flag on, so now we need to turn it off - } - } // outer try - finally - { - if (GATHER_STATS) { - if (swapped) swapsSucceeded_++; - else swapsFailed_++; - } - } - - return swapped; - } - - - - /** - Unpauses all threads manipulating the connection lists. - Cancels the effects of a prior call to pausePool(). - @see #pausePool() - **/ - private final void unpausePool() - { - poolPaused_ = false; - synchronized (poolPauseLock_) { - poolPaused_ = false; // ensure that it stays off - poolPauseLock_.notifyAll(); - } - } - - private final void wakeMaintainerDaemon() - { - synchronized (maintainerSleepLock_) { - maintainerSleepLock_.notify(); - } - } - - private final void wakeReaperDaemon() - { - synchronized (reaperSleepLock_) { - reaperSleepLock_.notify(); - } - } - - private final void wakeScavengerDaemon() - { - synchronized (scavengerSleepLock_) { - scavengerSleepLock_.notify(); - } - } - - - - - // JDAgeComparator -------------------------------------------------------------------- - - /** - Helper class. This comparator compares two AS400JDBCPooledConnection objects based on their - age (creation dates). - **/ - private final class JDAgeComparator implements java.util.Comparator - { - /** - Compares two AS400JDBCPooledConnection objects, based on their creation dates. - @return -1, 0, or +1 if the first argument is less than, equal to, or greater than the second. - @throws IllegalArgumentException if the arguments aren't instances of AS400JDBCPooledConnection. - **/ - public int compare(Object o1, - Object o2) - { - try - { - long creationTime1 = ((AS400JDBCPooledConnection)o1).timeWhenCreated_; - long creationTime2 = ((AS400JDBCPooledConnection)o2).timeWhenCreated_; - if (creationTime1 < creationTime2) return -1; - else if (creationTime1 > creationTime2) return 1; - else // the two objects were created at the same time - { - // We must not report "equal" if they are different objects, otherwise the TreeSet will overlay one of them with the other. - if (o1.hashCode() < o2.hashCode()) return -1; - else if (o1.hashCode() > o2.hashCode()) return 1; - else return 0; // If hashcodes match, and created at same time, assume the objects are identical. - } - } - catch (ClassCastException e) { - logException("Exception when comparing connections", e); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - } // internal class JDAgeComparator - - - - // JDPoolMaintainer -------------------------------------------------------------------- - - /** - Helper class. This daemon wakes up every maintainerInterval_ msecs and performs maintainenance on the current backup 'available connection' list. It performs a list swap if needed. - It also identifies any stale connections in the avail list and moves them the 'condemned' list. - **/ - private final class JDPoolMaintainer implements Runnable - { - private final static String DAEMON_NAME = "Maintainer daemon"; - boolean isAwake_ = true; // false if this daemon is sleeping, true otherwise - boolean snooze_ = false; // tells this daemon to "sleep late" if it wakes up - - - /** - The main job of this daemon is to renew/replenish the 'available' lists as needed. - **/ - public void run() - { - final JDConnectionPoolKey[] dummyKeyArray_ = new JDConnectionPoolKey[0]; // for toArray() - logInformation(DAEMON_NAME + " started with maintainerInterval_ = "+maintainerInterval_+" msecs and maxIdleTime_ = "+maxIdleTime_+" msecs"); - - ArrayList candidatesForRemoval = new ArrayList(minPoolSize_); // reasonable initial size - int numCondemnedConnections = 0; - long previousRunTime = 0; // duration of the previous cycle's maintenance activity - long runStartTime = 0; - - try - { - while (keepDaemonsAlive_) - { - if (GATHER_STATS) System.out.print("(m)"); - isAwake_ = true; - try - { - long timeToSleep = maintainerInterval_ - previousRunTime; - if (timeToSleep > 0) - { - isAwake_ = false; - try { - synchronized (maintainerSleepLock_) { - maintainerSleepLock_.wait(timeToSleep); - isAwake_ = true; - } - } - catch (InterruptedException ie) {} // ignore - finally { isAwake_ = true; } // just to be sure - } - else { - if (JDTrace.isTraceOn()) logWarning(DAEMON_NAME + " did not sleep"); - } - while (snooze_) - { - isAwake_ = false; - try { - synchronized (maintainerSnoozeLock_) { - if (snooze_) maintainerSnoozeLock_.wait(); - isAwake_ = true; - } - } - catch (InterruptedException ie) {} // ignore - finally { isAwake_ = true; } // just to be sure - } - if (!keepDaemonsAlive_) break; - if (DEBUG) logInformation(DAEMON_NAME + " woke up"); - if (DEBUG || GATHER_STATS) maintainerDaemonCycles_++; - - pauseIfPoolPaused(0); // if pool is paused, wait until unpause() is called - runStartTime = System.currentTimeMillis(); - if (GATHER_STATS) System.out.print("(M)"); - - // Perform sequence of tasks, in separate try blocks. That way, if an exception occurs in an early task, the final tasks in the loop don't get skipped. - - // Warn if there are 'active but in error' connections. - if (isPoolFull() || activeConnectionsInError_.size() > 5) { - if (activeConnectionsInError_.size() > 1) - logWarning(activeConnectionsInError_.size() + " connections have experienced fatal connection errors, but are still held by the application."); - } - - // Identify and remove any stale connections in the 'available' list. - try - { - // Figure out our high water mark. If lastUsed_ - // on a pooled connection is before this value, that - // means the connection has not been touched in - // a longer time than is allowed and we need to close - // it down and remove it. - long cutoffTime = System.currentTimeMillis() - maxIdleTime_; - candidatesForRemoval.clear(); - - // Identify any stale connections, and move them from the 'available' list to the candidatesForRemoval list. - synchronized (availableConnections_[BACKGROUND]) - { - if (!keepDaemonsAlive_) break; - // Get list of all connection keys in the 'available' HashMap. - JDConnectionPoolKey[] poolKeys = (JDConnectionPoolKey[])availableConnections_[BACKGROUND].keySet().toArray(dummyKeyArray_); - for (int i=0; i 0) { - fillPool(numToAdd, BACKGROUND); - } - - // See if the foreground process has indicated that we need to do a list swap. - if (needMoreConnections_) - { - // Request a swap. This may take awhile, but the daemon is not in a hurry. - // Note that the swap may fail if background list is not longer than foreground list. - if (DEBUG) logInformation(DAEMON_NAME + " is requesting a swap; needMoreConnections_ =="+needMoreConnections_); - JDConnectionPoolKey defaultPoolKey = cpds_.getConnectionPoolKey(); - swapConnectionLists(BACKGROUND, defaultPoolKey); - } - } - catch (Exception e) - { - if (JDTrace.isTraceOn()) logException("Exception caught by " + DAEMON_NAME, e); - // Keep running. - } - - - // If needed, wake up the other daemons to close condemned or expired connections. - if (numCondemnedConnections > condemnedListLengthThreshold_) - { - wakeScavengerDaemon(); - } - else if (isPoolOverFull()) - { - wakeReaperDaemon(); - } - - } // inner try - catch (Exception e) - { - if (JDTrace.isTraceOn()) logException ("Exception caught by " + DAEMON_NAME, e); - // Keep running. - } - finally { - isAwake_ = true; - previousRunTime = System.currentTimeMillis() - runStartTime; - minSwapInterval_ = Math.max(50, previousRunTime / 2); - } - } // while keepDaemonsAlive_ - } // outermost try - finally - { - logInformation(DAEMON_NAME + " has stopped"); - isAwake_ = false; - } - } - - } // internal class JDPoolMaintainer - - - - - // JDPoolReaper -------------------------------------------------------------------- - - /** - Helper class. This daemon wakes up every reaperInterval_ milliseconds - and scans the list of active connections. If a connection is expired, - PoolReaper moves it from the 'active' list to the 'condemned' list. - Note: This daemon is _not_ started if connections have "unlimited lifetime". - **/ - private final class JDPoolReaper implements Runnable - { - private final static String DAEMON_NAME = "Reaper daemon"; - - public void run() - { - logInformation(DAEMON_NAME + " started with reaperInterval_ = "+reaperInterval_+" msecs and maxLifetime_ = "+maxLifetime_+" msecs"); - - ArrayList candidatesForRemoval = new ArrayList(minPoolSize_); // reasonable initial size - long previousRunTime = 0; // duration of the previous cycle's maintenance activity - long runStartTime = 0; - - try - { - while (keepDaemonsAlive_) - { - if (GATHER_STATS) System.out.print("(r)"); - try - { - long timeToSleep = reaperInterval_ - previousRunTime; - if (timeToSleep > 0) - { - try { - synchronized (reaperSleepLock_) { - reaperSleepLock_.wait(timeToSleep); - } - } - catch (InterruptedException ie) {} // ignore - if (DEBUG) logInformation(DAEMON_NAME + " emerged from wait()"); - } - else { - if (JDTrace.isTraceOn()) logWarning(DAEMON_NAME + " did not sleep"); - } - if (!keepDaemonsAlive_) break; - if (DEBUG) logInformation(DAEMON_NAME + " woke up"); - if (DEBUG || GATHER_STATS) reaperDaemonCycles_++; - - pauseIfPoolPaused(reaperInterval_); // don't risk pausing forever - - runStartTime = System.currentTimeMillis(); - if (GATHER_STATS) System.out.print("(R)"); - - // Identify any expired connections in the 'active' list, and move them to 'condemned' list. - - long cutoffTime = runStartTime - maxLifetime_; // Any connections allocated prior to this moment in time are considered expired, and are subject to forced disconnection. - candidatesForRemoval.clear(); - - synchronized (activeConnections_) - { - if (!keepDaemonsAlive_) break; - Iterator activeIter = activeConnections_.iterator(); - while (activeIter.hasNext()) - { - AS400JDBCPooledConnection conn = (AS400JDBCPooledConnection)activeIter.next(); - if (isExpired(conn, cutoffTime)) - { - if (isStale(conn, runStartTime - maxIdleTime_)) // Don't reap connections that were recently allocated. - { - if (DEBUG || GATHER_STATS) expiredConnectionsIdentifiedByReaper_++; - activeIter.remove(); // Remove connection from the 'active' list. - if (conn.fatalConnectionErrorOccurred_) { - activeConnectionsInError_.remove(conn); // ... and also from 'error' list - } - candidatesForRemoval.add(conn); // ... and add it to the 'condemned' list. - } - } - else break; // This list is sorted in ascending order of connection creation time. As we move forward in the list: once we find a non-expired connection, we're done with the list. - } // while - } // sync - - if (DEBUG || GATHER_STATS) { - if (candidatesForRemoval.size() != 0) { - System.out.println("\n(CLEANUP)"+DAEMON_NAME+" has added " + candidatesForRemoval.size() + " expired connections to condemned list."); - } - } - - // Move any staged expired connections to the 'condemned' list. - Iterator candidatesIter = candidatesForRemoval.iterator(); - int numCondemnedConnections; - synchronized (condemnedConnections_) - { // Don't leave connections in limbo. - while (candidatesIter.hasNext()) { - AS400JDBCPooledConnection conn = (AS400JDBCPooledConnection)candidatesIter.next(); - if (JDTrace.isTraceOn()) logDiagnostic(DAEMON_NAME+" is closing an active connection that has exceeded the maximum lifetime: " + conn.toString()); - condemnedConnections_.add(conn); - candidatesIter.remove(); // remove connection from candidatesIter list - } - numCondemnedConnections = condemnedConnections_.size(); - } - - // If needed, wake up the scavenger daemon to close condemned physical connections. - if (numCondemnedConnections > condemnedListLengthThreshold_) - { - wakeScavengerDaemon(); - } - - } // inner try - catch (Exception e) - { - if (JDTrace.isTraceOn()) logException("Exception caught by " + DAEMON_NAME, e); - } - finally { - previousRunTime = System.currentTimeMillis() - runStartTime; - } - } // while keepDaemonsAlive_ - } // outermost try - finally - { - logInformation(DAEMON_NAME + " has stopped"); - } - } - - } // internal class JDPoolReaper - - - - - // JDPoolScavenger -------------------------------------------------------------------- - - /** - Helper class. This daemon wakes up every 'scavengerInterval_' milliseconds and - closes all the connections in the 'condemned' list. - **/ - private final class JDPoolScavenger implements Runnable - { - private final static String DAEMON_NAME = "Scavenger daemon"; - - public void run() - { - logInformation(DAEMON_NAME + " started with scavengerInterval_ = "+scavengerInterval_+" msecs"); - ArrayList candidatesForRemoval = new ArrayList(minPoolSize_); // reasonable initial size - long previousRunTime = 0; // duration of the previous cycle's maintenance activity - long runStartTime = 0; - - try - { - while (keepDaemonsAlive_) - { - if (GATHER_STATS) System.out.print("(s)"); - try - { - long timeToSleep = scavengerInterval_ - previousRunTime; - if (timeToSleep > 0) - { - try { - synchronized (scavengerSleepLock_) { - scavengerSleepLock_.wait(timeToSleep); - } - } - catch (InterruptedException ie) {} // ignore - if (DEBUG) logInformation(DAEMON_NAME + " emerged from wait()"); - } - else { - if (JDTrace.isTraceOn()) logWarning(DAEMON_NAME + " did not sleep"); - } - if (!keepDaemonsAlive_) break; - if (DEBUG) logInformation(DAEMON_NAME + " woke up"); - if (DEBUG || GATHER_STATS) scavengerDaemonCycles_++; - - pauseIfPoolPaused(0); // if pool is paused, wait until unpause() is called - runStartTime = System.currentTimeMillis(); - if (GATHER_STATS) System.out.print("(+S)"); - - // Close all connections in the 'condemned' list. - - synchronized (condemnedConnections_) - { - if (!keepDaemonsAlive_) break; - Iterator condemnedIter = condemnedConnections_.iterator(); - while (condemnedIter.hasNext()) - { - AS400JDBCPooledConnection conn = (AS400JDBCPooledConnection)condemnedIter.next(); - condemnedIter.remove(); - candidatesForRemoval.add(conn); - } - } - - if (DEBUG || GATHER_STATS) { - if (candidatesForRemoval.size() != 0) { - System.out.println("\n(CLEANUP)"+DAEMON_NAME+" is closing " + candidatesForRemoval.size() + " condemned connections."); - } - } - - // Don't leave connections in limbo. - Iterator candidatesIter = candidatesForRemoval.iterator(); - while (candidatesIter.hasNext()) { - closePhysicalConnection((AS400JDBCPooledConnection)candidatesIter.next()); - if (DEBUG || GATHER_STATS) condemnedConnectionsRemoved_++; - candidatesIter.remove(); // remove connection from candidatesForRemoval list - } - - if (DEBUG && getConnectionCount(SYNC_ALL) < 0) { - logError(DAEMON_NAME + ": Total connection count is negative"); // This would indicate a design flaw. - } - - } // inner try - catch (Exception e) - { - if (JDTrace.isTraceOn()) logException("Exception caught by " + DAEMON_NAME, e); - } - finally { - previousRunTime = System.currentTimeMillis() - runStartTime; - - // If needed, wake up the reaper daemon to close any expired connections. - if (isPoolOverFull()) - { - wakeReaperDaemon(); - } - } - } // while keepDaemonsAlive_ - } // outermost try - finally - { - logInformation(DAEMON_NAME + " has stopped"); - } - } - - } // internal class JDPoolScavenger - -} // class JDConnectionPoolManager diff --git a/cvsroot/src/com/ibm/as400/access/JDConnectionProxy.java b/cvsroot/src/com/ibm/as400/access/JDConnectionProxy.java deleted file mode 100644 index 2099a2cdf..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDConnectionProxy.java +++ /dev/null @@ -1,1173 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDConnectionProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -/* ifdef JDBC40 -import java.sql.ClientInfoStatus; -endif */ -import java.sql.Clob; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.DriverManager; -/* ifdef JDBC40 -import java.sql.NClob; -endif */ -import java.sql.PreparedStatement; -/* ifdef JDBC40 -import java.sql.SQLClientInfoException; -import java.sql.SQLXML; -endif */ -import java.sql.Savepoint; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.Statement; -import java.sql.Struct; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - - -class JDConnectionProxy -extends AbstractProxyImpl -implements Connection -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - - // Private data. - - private JDDatabaseMetaDataProxy metaData_; - AS400 as400PublicClassObj_; // Prevents garbage collection. - - - // Copied from JDError: - private static final String EXC_FUNCTION_NOT_SUPPORTED = "IM001"; - - - private Object callFactoryMethod (String methodName, - Class[] argClasses, - Object[] argValues, - ProxyFactoryImpl proxyObject) - throws SQLException - { - try { - if (argClasses == null) - return connection_.callFactoryMethod ( - pxId_, - methodName, - proxyObject); - else - return connection_.callFactoryMethod ( - pxId_, - methodName, - argClasses, - argValues, - proxyObject); - } - catch (InvocationTargetException e) { - throw rethrow1 (e); - } - } - - private void callMethod (String methodName) - throws SQLException - { - try { - connection_.callMethod (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw rethrow1 (e); - } - } - - private void callMethod (String methodName, - Class[] argClasses, - Object[] argValues) - throws SQLException - { - try { - connection_.callMethod (pxId_, methodName, argClasses, argValues); - } - catch (InvocationTargetException e) { - throw rethrow1 (e); - } - } - - private boolean callMethodRtnBool (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsBoolean (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw rethrow1 (e); - } - } - - private Object callMethodRtnObj (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsObject (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw rethrow1 (e); - } - } - - - //@PDA 550 - private Object callMethodRtnObj(String methodName, Class[] argClasses, Object[] argValues) throws SQLException - { - try - { - return connection_.callMethod(pxId_, methodName, argClasses, argValues).getReturnValue(); - } catch (InvocationTargetException e) - { - throw rethrow1(e); - } - } - - - public void clearWarnings () - throws SQLException - { - callMethod ("clearWarnings"); - } - - - public void close () - throws SQLException - { - callMethod ("close"); - } - - - public void commit () - throws SQLException - { - callMethod ("commit"); - } - - - // This implements the ProxyImpl interface. - public void construct (ProxyClientConnection connection) - { - connection_ = connection; - // Note: We need to check for a secondary URL (in setProperties) - // before we know what kind of remote object to create, - // therefore we simply capture the 'connection' value here. - } - - - - public Statement createStatement () - throws SQLException - { - JDStatementProxy newStatement = new JDStatementProxy (this); - return (JDStatementProxy) callFactoryMethod ( - "createStatement", null, null, - newStatement); - } - - - - // JDBC 2.0 - public Statement createStatement (int resultSetType, - int resultSetConcurrency) - throws SQLException - { - JDStatementProxy newStatement = new JDStatementProxy (this); - return (JDStatementProxy) callFactoryMethod ( - "createStatement", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer(resultSetType), - new Integer(resultSetConcurrency) }, - newStatement); - } - - - -// JDBC 3.0 - public Statement createStatement (int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - JDStatementProxy newStatement = new JDStatementProxy (this); - return(JDStatementProxy) callFactoryMethod ( - "createStatement", - new Class[] { Integer.TYPE, Integer.TYPE, - Integer.TYPE}, - new Object[] { new Integer(resultSetType), - new Integer(resultSetConcurrency), - new Integer(resultSetHoldability)}, - newStatement); - } - - - - public boolean getAutoCommit () - throws SQLException - { - return callMethodRtnBool ("getAutoCommit"); - } - - - - public String getCatalog () - throws SQLException - { - return (String) callMethodRtnObj ("getCatalog"); - } - - - //@cc1 - /** - * This method returns the concurrent access resolution setting. - * This method has no effect on IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @return The concurrent access resolution setting. Possible return valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public int getConcurrentAccessResolution () throws SQLException - { - return ((Integer)callMethodRtnObj ("getConcurrentAccessResolution")).intValue(); - } - -// JDBC 3.0 - public int getHoldability () - throws SQLException - { - return ((Integer)callMethodRtnObj ("getHoldability")).intValue(); - } - - - - public DatabaseMetaData getMetaData () - throws SQLException - { - if (metaData_ == null) - { - JDDatabaseMetaDataProxy newMetaData = new JDDatabaseMetaDataProxy (this); - metaData_ = (JDDatabaseMetaDataProxy) callFactoryMethod ( - "getMetaData", null, null, - newMetaData); - } - return metaData_; - } - - - - public int getTransactionIsolation () - throws SQLException - { - try { - return connection_.callMethodReturnsInt (pxId_, "getTransactionIsolation"); - } - catch (InvocationTargetException e) { - throw rethrow1 (e); - } - } - - - - // JDBC 2.0 - public Map getTypeMap () - throws SQLException - { - return (Map) callMethodRtnObj ("getTypeMap"); - } - - - - public SQLWarning getWarnings () - throws SQLException - { - return (SQLWarning) callMethodRtnObj ("getWarnings"); - } - - - - public boolean isClosed () - throws SQLException - { - return callMethodRtnBool ("isClosed"); - } - - - - public boolean isReadOnly () - throws SQLException - { - return callMethodRtnBool ("isReadOnly"); - } - - - - public String nativeSQL (String sql) - throws SQLException - { - try { - return (String) connection_.callMethod (pxId_, "nativeSQL", - new Class[] { String.class }, - new Object[] { sql }) - .getReturnValue (); - } - catch (InvocationTargetException e) { - throw rethrow1 (e); - } - } - - - - public CallableStatement prepareCall (String sql) - throws SQLException - { - JDCallableStatementProxy newStatement = new JDCallableStatementProxy (this); - return (JDCallableStatementProxy) callFactoryMethod ( - "prepareCall", - new Class[] { String.class }, - new Object[] { sql }, - newStatement); - } - - - - // JDBC 2.0 - public CallableStatement prepareCall (String sql, - int resultSetType, - int resultSetConcurrency) - throws SQLException - { - JDCallableStatementProxy newStatement = new JDCallableStatementProxy (this); - return (JDCallableStatementProxy) callFactoryMethod ( - "prepareCall", - new Class[] { String.class, Integer.TYPE, - Integer.TYPE }, - new Object[] { sql, - new Integer(resultSetType), - new Integer(resultSetConcurrency) }, - newStatement); - } - - - -// JDBC 3.0 - public CallableStatement prepareCall (String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - JDCallableStatementProxy newStatement = new JDCallableStatementProxy (this); - return(JDCallableStatementProxy) callFactoryMethod ( - "prepareCall", - new Class[] { String.class, Integer.TYPE, - Integer.TYPE, Integer.TYPE}, - new Object[] { sql, - new Integer(resultSetType), - new Integer(resultSetConcurrency), - new Integer(resultSetHoldability)}, - newStatement); - } - - - - - public PreparedStatement prepareStatement (String sql) - throws SQLException - { - JDPreparedStatementProxy newStatement = new JDPreparedStatementProxy (this); - return (JDPreparedStatementProxy) callFactoryMethod ( - "prepareStatement", - new Class[] { String.class }, - new Object[] { sql }, - newStatement); - } - - - -// JDBC 3.0 - public PreparedStatement prepareStatement (String sql, int autoGeneratedKeys) - throws SQLException - { - JDPreparedStatementProxy newStatement = new JDPreparedStatementProxy (this); - return(JDPreparedStatementProxy) callFactoryMethod ( - "prepareStatement", - new Class[] { String.class, Integer.TYPE}, - new Object[] { sql, - new Integer(autoGeneratedKeys)}, - newStatement); - } - - - -// JDBC 3.0 - public PreparedStatement prepareStatement (String sql, int[] columnIndexes) - throws SQLException - { - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - -// JDBC 3.0 - public PreparedStatement prepareStatement (String sql, String[] columnNames) - throws SQLException - { - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - - // JDBC 2.0 - public PreparedStatement prepareStatement (String sql, - int resultSetType, - int resultSetConcurrency) - throws SQLException - { - JDPreparedStatementProxy newStatement = new JDPreparedStatementProxy (this); - return (JDPreparedStatementProxy) callFactoryMethod ( - "prepareStatement", - new Class[] { String.class, Integer.TYPE, - Integer.TYPE }, - new Object[] { sql, - new Integer(resultSetType), - new Integer(resultSetConcurrency) }, - newStatement); - } - - - -// JDBC 3.0 - public PreparedStatement prepareStatement (String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) - throws SQLException - { - JDPreparedStatementProxy newStatement = new JDPreparedStatementProxy (this); - return(JDPreparedStatementProxy) callFactoryMethod ( - "prepareStatement", - new Class[] { String.class, Integer.TYPE, - Integer.TYPE, Integer.TYPE}, - new Object[] { sql, - new Integer(resultSetType), - new Integer(resultSetConcurrency), - new Integer(resultSetHoldability)}, - newStatement); - } - - - -// JDBC 3.0 - public void releaseSavepoint (Savepoint savepoint) - throws SQLException - { - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - - static InternalErrorException rethrow1 (InvocationTargetException e) - throws SQLException - { - Throwable e2 = e.getTargetException (); - if (e2 instanceof SQLException) - throw (SQLException) e2; - else - return ProxyClientConnection.rethrow (e); - } - - - - public void rollback () - throws SQLException - { - callMethod ("rollback"); - } - - - -// JDBC 3.0 - public void rollback (Savepoint savepoint) - throws SQLException - { - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - - public void setAutoCommit (boolean autoCommit) - throws SQLException - { - callMethod ("setAutoCommit", - new Class[] { Boolean.TYPE }, - new Object[] { new Boolean(autoCommit) }); - } - - - - public void setCatalog (String catalog) - throws SQLException - { - callMethod ("setCatalog", - new Class[] { String.class }, - new Object[] { catalog }); - } - - - //@cc1 - /** - * This method sets concurrent access resolution. This method overrides the setting of ConcurrentAccessResolution on the datasource or connection - * URL properties. This changes the setting for this connection only. This method has no effect on - * IBM i V6R1 or earlier. - * The possible values for this property are {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} and - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS}, - * with the property defaulting to {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}. - * Setting this property to default exhibits the default behavior on the servers - * i.e., the semantic applied for read - * transactions to avoid locks will be determined by the server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED} specifies that driver will flow USE CURRENTLY COMMITTED - * to server. Whether CURRENTLY COMMITTED will actually be in effect is - * ultimately determined by server. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME} specifies that driver will flow WAIT FOR OUTCOME - * to server. This will disable the CURRENTLY COMMITTED behavior at the server, - * if enabled, and the server will wait for the commit or rollback of data in the process of - * being updated. - * - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} specifies that driver will flow SKIP LOCKS - * to server. This directs the database manager to skip records in the case of record lock conflicts. - * - * @param concurrentAccessResolution The current access resolution setting. Possible valuse: - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_NOT_SET}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_USE_CURRENTLY_COMMITTED}, - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_WAIT_FOR_OUTCOME}, or - * {@link com.ibm.as400.access.AS400JDBCDataSource#CONCURRENTACCESS_SKIP_LOCKS} - */ - public void setConcurrentAccessResolution (int concurrentAccessResolution) throws SQLException - { - callMethod ("setConcurrentAccessResolution", - new Class[] { Integer.TYPE}, - new Object[] { new Integer(concurrentAccessResolution)}); - } - -// JDBC 3.0 - public void setHoldability (int holdability) - throws SQLException - { - callMethod ("setHoldability", - new Class[] { Integer.TYPE}, - new Object[] { new Integer(holdability)}); - } - - - - // Copied from JDError: - private static final String EXC_CONNECTION_REJECTED = "08004"; - private static final String EXC_CONNECTION_UNABLE = "08001"; - - // Note: This method is used by AS400JDBCDriver. - void setProperties (JDDataSourceURL dataSourceUrl, JDProperties properties, - AS400 as400) - throws SQLException - { - String remoteClassName; - Class[] argClasses; - Object[] argValues; - String secondaryUrl = dataSourceUrl.getSecondaryURL (); - if (secondaryUrl.length() == 0) { - remoteClassName = "AS400JDBCConnection"; - argClasses = new Class[] { JDDataSourceURL.class, - JDProperties.class, - AS400Impl.class }; - argValues = new Object[] { dataSourceUrl, properties, as400.getImpl() }; - - try { - as400.connectService (AS400.DATABASE); - } - catch (AS400SecurityException e) { //@A0C - // Avoid dragging in JDError: - if (JDTrace.isTraceOn ()) { - synchronized (DriverManager.class) { - e.printStackTrace (DriverManager.getLogWriter ()); - } - } - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_CONNECTION_REJECTED), - EXC_CONNECTION_REJECTED, -99999); - } - catch (java.io.IOException e) { //@A0C - // Avoid dragging in JDError: - if (JDTrace.isTraceOn ()) { - synchronized (DriverManager.class) { - e.printStackTrace (DriverManager.getLogWriter ()); - } - } - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_CONNECTION_UNABLE), - EXC_CONNECTION_UNABLE, -99999); - } - } - else - { // A secondary URL was specified, so get a generic connection. - remoteClassName = "JDGenericConnection"; - argClasses = new Class[] { String.class, Properties.class }; - argValues = new Object[] { secondaryUrl, properties.getOriginalInfo() }; - } - try { - pxId_ = connection_.callConstructor (remoteClassName, false); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - callMethod ("setProperties", argClasses, argValues); - } - - - - public void setReadOnly (boolean readOnly) - throws SQLException - { - callMethod ("setReadOnly", - new Class[] { Boolean.TYPE }, - new Object[] { new Boolean(readOnly) }); - } - - - -// JDBC 3.0 - public Savepoint setSavepoint () - throws SQLException - { - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - -// JDBC 3.0 - public Savepoint setSavepoint (String name) - throws SQLException - { - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - - void setSystem (AS400 as400) - { - as400PublicClassObj_ = as400; - } - - - - public void setTransactionIsolation (int level) - throws SQLException - { - callMethod ("setTransactionIsolation", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(level) }); - } - - - - // JDBC 2.0 - public void setTypeMap (Map typeMap) - throws SQLException - { - callMethod ("setTypeMap", - new Class[] { Map.class }, - new Object[] { typeMap }); - } - - - - // This method is not required by java.sql.Connection, - // but it is used by the JDBC testcases, and is implemented - // in the public class. - public String toString () - { - try { - return (String) connection_.callMethodReturnsObject (pxId_, "toString"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.Connection" }; - } - - - - //@PDA jdbc40 - /** - * Returns true if the connection has not been closed and is still valid. - * The driver shall submit a query on the connection or use some other - * mechanism that positively verifies the connection is still valid when - * this method is called. - *

    - * The query submitted by the driver to validate the connection shall be - * executed in the context of the current transaction. - * - * @param timeout - The time in seconds to wait for the database operation - * used to validate the connection to complete. If - * the timeout period expires before the operation - * completes, this method returns false. A value of - * 0 indicates a timeout is not applied to the - * database operation. Note that currently the timeout - * value is not used. - *

    - * @return true if the connection is valid, false otherwise - * @exception SQLException if a database access error occurs. - */ - public boolean isValid(int timeout) throws SQLException - { - Object[] oa = new Object[] {new Integer(timeout)}; - return ((Boolean)callMethodRtnObj("isValid", new Class[] {Integer.TYPE}, oa)).booleanValue(); - } - - //@PDA jdbc40 - /** - * Sets the value of the client info property specified by name to the - * value specified by value. - *

    - * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver - * and the maximum length that may be specified for each property. - *

    - * The driver stores the value specified in a suitable location in the - * database. For example in a special register, session parameter, or - * system table column. For efficiency the driver may defer setting the - * value in the database until the next time a statement is executed or - * prepared. Other than storing the client information in the appropriate - * place in the database, these methods shall not alter the behavior of - * the connection in anyway. The values supplied to these methods are - * used for accounting, diagnostics and debugging purposes only. - *

    - * The driver shall generate a warning if the client info name specified - * is not recognized by the driver. - *

    - * If the value specified to this method is greater than the maximum - * length for the property the driver may either truncate the value and - * generate a warning or generate a SQLException. If the driver - * generates a SQLException, the value specified was not set on the - * connection. - *

    - * The following client info properties are supported in Toobox for Java. - *

    - *

      - *
    • ApplicationName - The name of the application currently utilizing - * the connection
    • - *
    • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
    • - *
    • ClientHostname - The hostname of the computer the application - * using the connection is running on.
    • - *
    • ClientAccounting - Client accounting information.
    • - *
    • ClientProgramID - The client program identification.
    • - *
    - *

    - * @param name The name of the client info property to set - * @param value The value to set the client info property to. If the - * value is null, the current value of the specified - * property is cleared. - *

    - * @throws SQLException if the database server returns an error while - * setting the client info value on the database server. - *

    - */ - public void setClientInfo(String name, String value) -/* ifdef JDBC40 - throws SQLClientInfoException -endif */ -/* ifndef JDBC40 */ - throws SQLException -/* endif */ - { - try - { - callMethod("setClientInfo", - new Class[] { String.class, String.class }, - new Object[] { name, value }); - } catch (SQLException e) - { - /* ifdef JDBC40 - //may be SQLException or SQLClientInfoException - if(e instanceof SQLClientInfoException) - throw (SQLClientInfoException)e; - else - { - //HashMap m = new HashMap(); //@pdd jdbc40 merge - //@PDC jdbc40 merge. code hashmap without generic references for pre-jdk1.6 - HashMap m = new HashMap(); - m.put(name, ClientInfoStatus.REASON_UNKNOWN); - SQLClientInfoException clientIE = new SQLClientInfoException(e.getMessage(), e.getSQLState(), m); - throw clientIE; - } -endif */ -/* ifndef JDBC40 */ - throw e; -/* endif */ - } - } - - // @PDA 550 client info - /** - * Sets the value of the connection's client info properties. The - * Properties object contains the names and values of the - * client info properties to be set. The set of client info properties - * contained in the properties list replaces the current set of client info - * properties on the connection. If a property that is currently set on the - * connection is not present in the properties list, that property is - * cleared. Specifying an empty properties list will clear all of the - * properties on the connection. See - * setClientInfo (String, String) for more information. - *

    - * If an error occurs in setting any of the client info properties, a - * ClientInfoException is thrown. The - * ClientInfoException contains information indicating which - * client info properties were not set. The state of the client information - * is unknown because some databases do not allow multiple client info - * properties to be set atomically. For those databases, one or more - * properties may have been set before the error occurred. - *

    - * The following client info properties are supported in Toobox for Java. - *

    - *

      - *
    • ApplicationName - The name of the application currently utilizing - * the connection
    • - *
    • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
    • - *
    • ClientHostname - The hostname of the computer the application - * using the connection is running on.
    • - *
    • ClientAccounting - Client accounting information.
    • - *
    • ClientProgramID - The client program identification.
    • - *
    - *

    - * @param properties - * the list of client info properties to set - *

    - * @throws SQLException - * if the database server returns an error while setting the - * clientInfo values on the database server - *

    - * @see java.sql.Connection#setClientInfo(String, String) - * setClientInfo(String, String) - */ - public void setClientInfo(Properties properties) - /* ifdef JDBC40 - throws SQLClientInfoException -endif */ -/* ifndef JDBC40 */ - throws SQLException -/* endif */ - { - try - { - callMethod ("setClientInfo", - new Class[] { Properties.class }, - new Object[] { properties }); - }catch(SQLException e) - { - /* ifdef JDBC40 - //may be SQLException or SQLClientInfoException - if(e instanceof SQLClientInfoException) - throw (SQLClientInfoException)e; - else - { - //create Map for exception constructor - //HashMap m = new HashMap(); //@pdd jdbc40 merge - //@PDC jdbc40 merge. code hashmap without generic references for pre-jdk1.6 - HashMap m = new HashMap(); - Enumeration clientInfoNames = properties.keys(); - while( clientInfoNames.hasMoreElements()) - { - String clientInfoName = (String)clientInfoNames.nextElement(); - m.put(clientInfoName, ClientInfoStatus.REASON_UNKNOWN); - } - SQLClientInfoException clientIE = new SQLClientInfoException(e.getMessage(), e.getSQLState(), m); - throw clientIE; - } - endif */ - /* ifndef JDBC40 */ - throw e; - /* endif */ - } - } - - //@PDA 550 client info - /** - * Returns the value of the client info property specified by name. This - * method may return null if the specified client info property has not - * been set and does not have a default value. This method will also - * return null if the specified client info property name is not supported - * by the driver. - *

    - * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver. - *

    - * The following client info properties are supported in Toobox for Java. - *

    - *

      - *
    • ApplicationName - The name of the application currently utilizing - * the connection
    • - *
    • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
    • - *
    • ClientHostname - The hostname of the computer the application - * using the connection is running on.
    • - *
    • ClientAccounting - Client accounting information.
    • - *
    • ClientProgramID - The client program identification.
    • - *
    - *

    - * @param name The name of the client info property to retrieve - *

    - * @return The value of the client info property specified - *

    - * @throws SQLException if the database server returns an error when - * fetching the client info value from the database. - *

    - * @see java.sql.DatabaseMetaData#getClientInfoProperties - */ - public String getClientInfo(String name) throws SQLException - { - return (String) callMethodRtnObj("getClientInfo", - new Class[] { String.class }, - new Object[] { name }); - } - - //@PDA 550 client info - /** - * Returns a list containing the name and current value of each client info - * property supported by the driver. The value of a client info property - * may be null if the property has not been set and does not have a - * default value. - *

    - * The following client info properties are supported in Toobox for Java. - *

    - *

      - *
    • ApplicationName - The name of the application currently utilizing - * the connection
    • - *
    • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
    • - *
    • ClientHostname - The hostname of the computer the application - * using the connection is running on.
    • - *
    • ClientAccounting - Client accounting information.
    • - *
    • ClientProgramID - The client program identification.
    • - *
    - *

    - * @return A Properties object that contains the name and current value of - * each of the client info properties supported by the driver. - *

    - * @throws SQLException if the database server returns an error when - * fetching the client info values from the database - */ - public Properties getClientInfo() throws SQLException - { - return (Properties) callMethodRtnObj("getClientInfo"); - } - - //@PDA jdbc40 - /** - * Constructs an object that implements the Clob interface. The object - * returned initially contains no data. The setAsciiStream, - * setCharacterStream and setString methods of - * the Clob interface may be used to add data to the Clob. - * @return An object that implements the Clob interface - * @throws SQLException if an object that implements the - * Clob interface can not be constructed. - * - */ - public Clob createClob() throws SQLException - { - return (Clob) callMethodRtnObj("createClob"); - } - - //@PDA jdbc40 - /** - * Constructs an object that implements the Blob interface. The object - * returned initially contains no data. The setBinaryStream and - * setBytes methods of the Blob interface may be used to add data to - * the Blob. - * @return An object that implements the Blob interface - * @throws SQLException if an object that implements the - * Blob interface can not be constructed - * - */ - public Blob createBlob() throws SQLException - { - return (Blob) callMethodRtnObj("createBlob"); - } - - //@PDA jdbc40 -//JDBC40DOC /** -//JDBC40DOC * Constructs an object that implements the NClob interface. The object -//JDBC40DOC * returned initially contains no data. The setAsciiStream, -//JDBC40DOC * setCharacterStream and setString methods of the NClob interface may -//JDBC40DOC * be used to add data to the NClob. -//JDBC40DOC * @return An object that implements the NClob interface -//JDBC40DOC * @throws SQLException if an object that implements the -//JDBC40DOC * NClob interface can not be constructed. -//JDBC40DOC * -//JDBC40DOC */ - /* ifdef JDBC40 - public NClob createNClob() throws SQLException - { - return (NClob) callMethodRtnObj("createNClob"); - } -endif */ - //@PDA jdbc40 -//JDBC40DOC /** -//JDBC40DOC * Constructs an object that implements the SQLXML interface. The object -//JDBC40DOC * returned initially contains no data. The createXmlStreamWriter object and -//JDBC40DOC * setString method of the SQLXML interface may be used to add data to the SQLXML -//JDBC40DOC * object. -//JDBC40DOC * @return An object that implements the SQLXML interface -//JDBC40DOC * @throws SQLException if an object that implements the SQLXML interface can not -//JDBC40DOC * be constructed -//JDBC40DOC */ - /* ifdef JDBC40 - public SQLXML createSQLXML() throws SQLException - { - return (SQLXML) callMethodRtnObj("createSQLXML"); - } - endif */ - //@PDA jdbc40 - /** - * Factory method for creating Array objects. - * - * @param typeName the SQL name of the type the elements of the array map to. The typeName is a - * database-specific name which may be the name of a built-in type, a user-defined type or a standard SQL type supported by this database. This - * is the value returned by Array.getBaseTypeName - * @param elements the elements that populate the returned object - * @return an Array object whose elements map to the specified SQL type - * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - */ - public Array createArrayOf(String typeName, Object[] elements) throws SQLException - { - return (Array) callMethodRtnObj("createArrayOf", - new Class[] { String.class, Object[].class }, - new Object[] { typeName, elements }); - } - - //@PDA jdbc40 - /** - * Factory method for creating Struct objects. - * - * @param typeName the SQL type name of the SQL structured type that this Struct - * object maps to. The typeName is the name of a user-defined type that - * has been defined for this database. It is the value returned by - * Struct.getSQLTypeName. - * @param attributes the attributes that populate the returned object - * @return a Struct object that maps to the given SQL type and is populated with the given attributes - * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - */ - public Struct createStruct(String typeName, Object[] attributes) throws SQLException - { - return (Struct) callMethodRtnObj("createStruct", - new Class[] { String.class, Object[].class }, - new Object[] { typeName, attributes }); - } - - //@pd2 add missing proxy method. This is needed for various testcases that use jobid. - /** - Returns the job identifier of the host server job corresponding to this connection. - Every JDBC connection is associated with a host server job on the IBM i system. The - format is: -

      -
    • 10 character job name -
    • 10 character user name -
    • 6 character job number -
    - -

    Note: Since this method is not defined in the JDBC Connection interface, - you typically need to cast a Connection object to JDConnectionProxy in order - to call this method: -

    -  String serverJobIdentifier = ((JDConnectionProxy)connection).getServerJobIdentifier();
    -  
    - - @return The server job identifier, or null if not known. - **/ - public String getServerJobIdentifier() throws SQLException // @pd2 - { // @pd2 - return (String) callMethodRtnObj("getServerJobIdentifier"); // @pd2 - } // @pd2 - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDCursor.java b/cvsroot/src/com/ibm/as400/access/JDCursor.java deleted file mode 100644 index 137fbf97f..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDCursor.java +++ /dev/null @@ -1,532 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDCursor.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.ResultSet; -import java.sql.SQLException; - - - -/** -This class implements a cursor on the IBM i system. NOTE: Creating this -object does not explicitly create the cursor on the system. -**/ -class JDCursor -{ - // Open attributes. - private static final int OPEN_READONLY_ = 0x80; - private static final int OPEN_ALL_ = 0xF0; - private static final int FULL_OPEN_ = 0x01; // @W1a - - - - // Reuse flags. These describe how to close a cursor. - static final int REUSE_NO = 0xF0; - static final int REUSE_YES = 0xF1; - static final int REUSE_RESULT_SET = 0xF2; - - - - private boolean closed_; - private AS400JDBCConnection connection_; - private int id_; - private boolean lazyClose_; // @E2A - private String name_; - private int concurrency_; // @E4A - private int holdable_ = -1; //@cur - private int scrollable_ = -1; //@cur - private int updatable_ = -1; //@cur (if on 550 hostserver, can use this instead of concurrency_) - private int sensitive_ = -1; //@cur - private int isolationLevel_ = -1; //@isol - - private DBReplyRequestedDS openReply = null; - -/** -Constructs a JDCursor object. - -@param connection Connection to the system. -@param id The id. -@param name Cursor name. -@param concurrency The concurrency -**/ - JDCursor (AS400JDBCConnection connection, - int id, - String name, - // @E3D boolean lazyClose, - int concurrency) // @E4A - throws SQLException // @E6A - { - closed_ = true; - concurrency_ = concurrency; // @E4A - connection_ = connection; - id_ = id; - name_ = name; - - lazyClose_ = connection_.getProperties().getBoolean(JDProperties.LAZY_CLOSE); // @E2A - // @E3D lazyClose_ = lazyClose; // @E3A - } - - - -/** -Closes the cursor. - -@param reuseFlag One of REUSE_*. - -@exception SQLException If an error occurs. -**/ -// -// Implementation note: -// -// It is a requirement to not get replies during a finalize() -// method. Since Statement.finalize() calls this method, -// this requirement applies here, too. -// - void close (int reuseFlag) - throws SQLException - { - // Close the cursor for good. This makes sure that - // the cursor is not left around. - DBSQLRequestDS request = null; //@P0A - boolean keepDS = false; //@P1A - try - { - request = DBDSPool.getDBSQLRequestDS (DBSQLRequestDS.FUNCTIONID_CLOSE, id_, 0, 0); //@P0C - request.setReuseIndicator (reuseFlag); - - - if (lazyClose_) // @E2A - { - keepDS = true; //@P1A - connection_.sendAndHold(request, id_); // @E2A - } - else - { // @E2A - connection_.send (request, id_); - } - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); // @E5C - } - finally - { - if (request != null && !keepDS) { request.returnToPool(); request = null; } //@P1C - } - - if (openReply != null) { - openReply.returnToPool(); openReply = null; - } - - closed_ = true; - - if (JDTrace.isTraceOn()) - { - JDTrace.logInformation (this, "Closing with reuse flag = " + reuseFlag); - JDTrace.logClose (this); - } - } - - - -/** -Returns the cursor name. - -@return The cursor name. -**/ - String getName () - { - return name_; - } - - - -/** -Returns the open attributes appropriate for the the -SQL statement. - -@param sqlStatement a SQL statement. -@param blockCriteria block criteria. - -@return the open attributes. - -@exception SQLException If an error occurrs. -**/ -// -// Implementation note: Cursors perform better on -// the system when read only, so set the open -// attributes to read only in as many cases as -// possible. (Of course, not when the user needs -// to update using the cursor.) -// - int getOpenAttributes (JDSQLStatement sqlStatement, - String blockCriteria) - throws SQLException - { - int returnValue = OPEN_ALL_; // @W1a - - // If we are opening a cursor on a subsequent - // result set returned by a stored procedure, - // then it is read only. - if (sqlStatement == null) - returnValue = OPEN_READONLY_; // @W1c - - // If we are opening a cursor on a result set - // returned by a stored procedure, then it is - // read only. - else if (sqlStatement.isProcedureCall ()) // @W1c - returnValue = OPEN_READONLY_; // @W1c - - // For SELECTs, the cursor is read only when - // the cursor or connection is read only and - // when we are record blocking. Note that record - // blocking implies a read only cursor. - - // Change for J3 -- a system change in mod 5 allows updatable cursors - // even when the select statement does not specific "for update". The - // J3 change takes this into consideration. The J3 change is to add - // !(concurrency_ == ResultSet.CONCUR_UPDATABLE)) to the check. - else if ( - sqlStatement.isSelect () // @W1c - && (! blockCriteria.equalsIgnoreCase (JDProperties.BLOCK_CRITERIA_NONE)) - && ((connection_.isReadOnly()) || ((! sqlStatement.isForUpdate ()) && (!(concurrency_ == ResultSet.CONCUR_UPDATABLE)))) // @J3C - ) - returnValue = OPEN_READONLY_; // @W1c - - // the "ServerLevel > 9" in the following check makes sure we are running - // to a v5r1 or later version of the AS/400. - if ((connection_.getProperties().getBoolean(JDProperties.FULL_OPEN)) && // @W1a - (connection_.getServerFunctionalLevel() >= 9)) // @W1a - returnValue = returnValue | FULL_OPEN_; // @W1a - - // return OPEN_ALL_; // @W1d - return returnValue; // @W1a - } - - - -// @E1A @E4C -/** -Returns the cursor concurrency. - -@return The cursor concurrency. -**/ - int getConcurrency() - { - return concurrency_; - } - - - -/** -Indicates if the cursor is closed. - -@return true if the cursor is closed; false otherwise. -**/ - boolean isClosed () - { - return closed_; - } - - - -/** -Opens the cursor and describes the data format. - -@param openAttributes The open attributes. -@param scrollable true if the cursor should be - scrollable, false otherwise. -@return The data format. - -@exception SQLException If an error occurs. -**/ - DBDataFormat openDescribe (int openAttributes, - int resultSetType) //@KBC - throws SQLException - { - DBDataFormat dataFormat = null; - - try - { - DBSQLRequestDS request = null; //@P0A - try - { - request = DBDSPool.getDBSQLRequestDS ( //@P0C - DBSQLRequestDS.FUNCTIONID_OPEN_DESCRIBE, - id_, DBSQLRequestDS.ORS_BITMAP_RETURN_DATA - + DBSQLRequestDS.ORS_BITMAP_DATA_FORMAT - + DBSQLRequestDS.ORS_BITMAP_SQLCA, // @E1A - 0); //@isol Note: ORS_BITMAP_CURSOR_ATTRIBUTES not needed here since it is specified by callers before this point - - request.setOpenAttributes (openAttributes); - //@F1 Even though multiple cases were required in AS400JDBCStatement, scrollable is - //@F1 always false when openDescribe is called, so the cursor is always forward-only - //@F1 and we need less cases here. More cases would need to be added if the value - //@F1 of scrollable was not always false (between sensitive and insensitive - //@F1 resultSetType). Right now, the value of false for scrollable always indicates - //@F1 forward-only (not scrollable). If this changed, instead of a boolean, we'd need - //@F1 an int with sensitive/insensitive/forward-only passed in as the choices to this - //@F1 method. - //@F1 If we are pre-V5R2, send what we always have. - /* @KBD if (connection_.getVRM() < JDUtilities.vrm520) //@F1A - { - request.setScrollableCursorFlag (scrollable ? 1 : 0); - } - else - { //else check value of "cursor sensitivity" property - if (!scrollable) - { - // If the property is set to the default value, send same value we always have. - String cursorSensitivity = connection_.getProperties().getString(JDProperties.CURSOR_SENSITIVITY); //@F1A - if (cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_ASENSITIVE)) //@F1A - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_ASENSITIVE); //@F1A - else if (cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_INSENSITIVE)) //@F1A - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_INSENSITIVE); //@F1A - else //@F1A - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_SENSITIVE); //@F1A - } //@F1A - else //add more cases if this method starts being called with scrollable not always equal to false //@F1A - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_ASENSITIVE); //@F1A - } - */ - String cursorSensitivity = connection_.getProperties().getString(JDProperties.CURSOR_SENSITIVITY); //@F8A - if(connection_.getVRM() <= JDUtilities.vrm520) //@KBA - { - //@KBA IF pre-V5R3 always set to NOT SCROLLABLE ASENSITIVE - //if(resultSetType == ResultSet.TYPE_FORWARD_ONLY) //@KBA - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_ASENSITIVE); //@KBA Option 0 - //else //@KBA - // request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_ASENSITIVE); //@KBA Option 1 - } //@KBA - else if(resultSetType == ResultSet.TYPE_FORWARD_ONLY) //@KBA - { - //@KBA - //Determine if user set cursor sensitivity property //@KBA - if(cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_INSENSITIVE)) //@KBA - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_INSENSITIVE); //@KBA Option 5 - else //@KBA - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_NOT_SCROLLABLE_ASENSITIVE); //@KBA Option 0 - } //@KBA - else if(resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE) //@KBA - { - //@KBA - //Determine if user set cursor sensitivity property //@KBA - if(cursorSensitivity.equalsIgnoreCase(JDProperties.CURSOR_SENSITIVITY_ASENSITIVE)) //@KBA - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_ASENSITIVE); //@KBA Option 1 - else //@KBA - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_SENSITIVE); //@KBA Option 3 - } //@KBA - else //ResultSet.TYPE_SCROLL_INSENSITIVE //@KBA - { - request.setScrollableCursorFlag (DBSQLRequestDS.CURSOR_SCROLLABLE_INSENSITIVE); //@KBA Option 2 - } //@KBA - - if (openReply != null) { openReply.returnToPool(); openReply =null; } - openReply = connection_.sendAndReceive (request, id_); //@P0C - - int errorClass = openReply.getErrorClass(); - int returnCode = openReply.getReturnCode(); - - if (errorClass != 0) - JDError.throwSQLException (connection_, id_, errorClass, returnCode); - - processConcurrencyOverride(openAttributes, openReply); // @E1A @E4C - dataFormat = openReply.getDataFormat (); - // @550A NOTE: openDescribe() currently is only called for a result set returned from a CallableStatement - // if that were to change, this method needs to be modified so that it correctly indicates to the data format - // when the data is from a stored procedure result set. - dataFormat.setCSRSData(true); // @550A indicate to the data format that this data is associated with a stored procedure result set - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // if (openReply != null) { openReply.returnToPool(); openReply = null; } - } - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); // @E5C - } - - closed_ = false; - - if (JDTrace.isTraceOn()) - JDTrace.logOpen (this, null); // @J33a - - return dataFormat; - } - - - -// @E1A @E4C -/** -Processes a potential cursor concurrency override from a reply. -It is assumed that the reply contains a SQLCA. This means -that you have to include the SQLCA bit as part of the ORS -bitmap in the request. - -@param openAttributes The requested open attributes. -@param reply The reply. -**/ - void processConcurrencyOverride(int openAttributes, DBBaseReplyDS reply) - throws DBDataStreamException - { - // If the system overrides our open attributes, reflect that fact. - DBReplySQLCA sqlca = reply.getSQLCA (); - switch (sqlca.getWarn5()) - { - case (byte)0xF1: // EBCDIC'1' Read only - case (byte)0xF2: // EBCDIC'2' Read and deleteable - concurrency_ = ResultSet.CONCUR_READ_ONLY; - break; - case (byte)0xF4: // EBCDIC'4' Read, deleteable, and updateable - concurrency_ = ResultSet.CONCUR_UPDATABLE; - break; - /* @E7D - We should not do an override if this is an old system. - default: // Old system (without override indication) - switch(openAttributes) { - case OPEN_READONLY_: - concurrency_ = ResultSet.CONCUR_READ_ONLY; - break; - case OPEN_ALL_: - default: - concurrency_ = ResultSet.CONCUR_UPDATABLE; - break; - } - break; - */ - } - } - - - -//@cur new method -/** -Processes a cursor attributes from a reply. - -@param reply The reply. -**/ - void processCursorAttributes(DBBaseReplyDS reply) - throws SQLException - { - holdable_ = reply.getCursorAttributeHoldable(); - scrollable_ = reply.getCursorAttributeScrollable(); - updatable_ = reply.getCursorAttributeUpdatable(); - sensitive_ = reply.getCursorAttributeSensitive(); - isolationLevel_ = reply.getCursorIsolationLevel(); //@isol - } - - - //@cur new method - /** - Returns the cursor attribute holdable. - @return The server attribute holdable. (1 is holdable, 0 is not holdable) - **/ - public int getCursorAttributeHoldable() - { - return holdable_; - } - - //@cur new method - /** - Returns the cursor attribute Scrollable. - @return The server attribute Scrollable. (1 is Scrollable, 0 is not Scrollable) - **/ - public int getCursorAttributeScrollable() - { - return scrollable_; - } - - //@cur new method - /** - Returns the cursor attribute Updatable. - @return The server attribute Updatable. (1 is Updatable, 0 is not Updatable) - **/ - public int getCursorAttributeUpdatable() - { - return updatable_; - } - - //@cur new method - /** - Returns the cursor attribute Sensitive. - @return The server attribute Sensitive. (1 is Sensitive, 0 is not Sensitive) - **/ - public int getCursorAttributeSensitive() - { - return sensitive_; - } - - - //@isol new method - /** - Returns the cursor isolation level. - @return The cursor isolation level. - **/ - public int getCursorIsolationLevel() - { - return isolationLevel_; - } - - -/** -Set the cursor name. - -@param name The cursor name. -**/ - void setName (String name) - { - name_ = name; - - if (JDTrace.isTraceOn()) - JDTrace.logProperty (this, "Name", name_); - } - - - -/** -Sets the state of the cursor. This is useful when a -request implicitly opens or closes the cursor. - -@param closed true for close, or false for open -**/ - void setState (boolean closed) - { - closed_ = closed; - - if (JDTrace.isTraceOn()) - { - if (closed_) - JDTrace.logClose (this); - else - JDTrace.logOpen (this, null); // @J33a - } - } - - - -/** -Returns the cursor name. - -@return the cursor name. -**/ - public String toString () - { - return name_; - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/JDDataSourceURL.java b/cvsroot/src/com/ibm/as400/access/JDDataSourceURL.java deleted file mode 100644 index 3752778ac..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDDataSourceURL.java +++ /dev/null @@ -1,403 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDDataSourceURL.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.sql.SQLException; -import java.util.Enumeration; -import java.util.Properties; - - - -/** -

    A class representing a URL specifying an IBM i system data source. -This is needed to connect before accessing data. The supported -syntaxes for the DB2 for IBM i database URL are documented -in the comments for AS400JDBCDriver. -**/ -class JDDataSourceURL implements Serializable -{ - static final long serialVersionUID = 4L; - - - private static final String PROTOCOL_ = "jdbc"; - - // This subprotocol was registered with JavaSoft on 03/10/97. - private static final String SUB_PROTOCOL_ = "as400"; - - private static final String NATIVE_SUB_PROTOCOL_= "db2"; // @B1A - - - - private boolean extraPathSpecified_; - private boolean portSpecified_; - private Properties properties_; - private String schema_; - private String serverName_; - private String url_; - private boolean valid_; - private String secondaryUrl_; - - - -/** -Constructor. - -@param url The URL to parse. -**/ -// -// @A1C -// - JDDataSourceURL (String url) - { - // Initialize. - extraPathSpecified_ = false; - portSpecified_ = false; - properties_ = new Properties (); - schema_ = ""; - secondaryUrl_ = ""; - serverName_ = ""; - url_ = url; - valid_ = false; - - // Check for null. - if (url != null) { - - // Parse the URL. @A2C - parseURL (url); - - // If valid, then if a secondary URL was specified, clean it up. @A2A - if (valid_) { - if (properties_.containsKey (JDProperties.SECONDARY_URL_)) - secondaryUrl_ = - (String) properties_.get (JDProperties.SECONDARY_URL_); - // Collapse any "\;" into ";", by backing through the URL. - if (secondaryUrl_.indexOf ("\\;") != -1) { - StringBuffer buf = new StringBuffer (secondaryUrl_.length()); - char subsequentChar = ' '; - for (int i=secondaryUrl_.length()-1; i > -1; i--) { - char thisChar = secondaryUrl_.charAt (i); - if (thisChar == '\\' && subsequentChar == ';') { - } // Do not copy the backslash if it precedes a semicolon. - else - buf.insert (0, thisChar); - subsequentChar = thisChar; - } - secondaryUrl_ = buf.toString (); - properties_.put (JDProperties.SECONDARY_URL_, secondaryUrl_); - } - } - } - } - - - -// @B1A - String getNativeURL() - { - StringBuffer buffer = new StringBuffer(); - buffer.append(PROTOCOL_); - buffer.append(':'); - buffer.append(NATIVE_SUB_PROTOCOL_); - buffer.append(':'); - // @B3D if (url_.length() >= 11) // @B2A - // @B3D buffer.append(url_.substring(11)); - buffer.append("LOCALHOST"); // @B3A - String user = (String) properties_.getProperty(JDProperties.USER_); //@native - String pass = (String) properties_.getProperty(JDProperties.PASSWORD_); //@native - if(user!=null) //@native - buffer.append(";user=" + user); //@native - if(pass!=null) //@native - buffer.append(";password=" + pass); //@native - - Enumeration en = properties_.keys(); //@natprops - while(en.hasMoreElements()) //@natprops - { //@natprops - String key= (String)en.nextElement(); //@natprops - buffer.append(";" + key + "=" + (String)properties_.getProperty(key)); //@natprops - } //@natprops - - - - return buffer.toString(); - } - - - -/** -Get the properties that were specified as part of the URL. -**/ - Properties getProperties () - { - return properties_; - } - - - -/** -Validate and return the schema as it was parsed -from the URL. We do validation here since the system -does not do any - which results in errors happening later -that are difficult to debug. - -@return URL schema, or null if it is invalid. -**/ - String getSchema () - throws SQLException - { - int length = schema_.length (); - - // Check the length. - if (length > 128) //@128sch - return null; - - //@C1D Check that every character is alphanumeric. - //@C1D for (int i = 0; i < length; ++i) - //@C1D if ((! Character.isDigit (schema_.charAt (i))) - //@C1D && (! Character.isUpperCase (schema_.charAt (i))) - //@C1D && (! Character.isLowerCase (schema_.charAt (i)))) - //@C1D return null; - - return schema_; - } - - -//@A2A -/** -Get the secondary URL, as it was parsed from the URL. - -@return Secondary URL. "" if none was specified. -**/ - String getSecondaryURL () - { - return secondaryUrl_; - } - - - -/** -Get the system name as it was parsed from the URL. - -@return System name. -**/ - String getServerName () - { - return serverName_; - } - - - -/** -Returns the index of the first occurrence of either -string. - -@param s The string in which to search. -@param a The first string to search for. -@param b The second string to search for. -@param fromIndex Starting at index. -@return The index, or -1 if neither string is found. -**/ -// -// @A1A -// - static private int indexOfEither (String s, String a, String b, int fromIndex) - { - int ia = s.indexOf (a, fromIndex); - int ib = s.indexOf (b, fromIndex); - if (ia == -1) - return ib; - else if (ib == -1) - return ia; - else - return Math.min (ia, ib); - } - - - -/** -Was any extra path specified in the URL (i.e., anything -that we will ignore)? - -@return true if extra path was specified. -**/ - boolean isExtraPathSpecified () - { - return extraPathSpecified_; - } - - - -/** -Was a port specified in the URL? - -@return true if a port was specified. -**/ - boolean isPortSpecified () - { - return portSpecified_; - } - - - -/** -Is the URL valid for access by this JDBC driver? - -@return true if valid. -**/ - boolean isValid () - { - return valid_; - } - - - -/** -Parse a URL. -**/ - private void parseURL (String url) - { - int urlLength = url.length (); - - // Parse and verify the protocol. - int mark1 = url.indexOf (":"); - if (mark1 == -1) - return; - if (! url.substring (0, mark1).equalsIgnoreCase (PROTOCOL_)) - return; - - // Parse and verify the subprotocol. - int mark2 = indexOfEither (url, ":", ";", mark1+1); - if (mark2 == -1) - mark2 = urlLength; - if (! url.substring (mark1+1, mark2).equalsIgnoreCase (SUB_PROTOCOL_)) - return; - valid_ = true; - - // Parse the subname. - String subname; - if (mark2 == urlLength) - subname = ""; - else if (url.charAt (mark2) == ':') - subname = url.substring (mark2+1); - else - subname = url.substring (mark2); - - String token; - int tokenCount = 0; - int nextSemicolonPos = 0; - int priorSemicolonPos = -1; - int searchPos = 0; //@A2A - while (nextSemicolonPos != -1) { - nextSemicolonPos = subname.indexOf (';', searchPos); //@A2C - if (nextSemicolonPos == -1) - token = subname.substring (priorSemicolonPos+1); - else if (nextSemicolonPos>0 && //@A2A - subname.charAt (nextSemicolonPos-1) == '\\') //@A2A - { // Ignore the semicolon if preceded by backslash. //@A2A - searchPos = nextSemicolonPos+1; //@A2A - continue; //@A2A - } - else - token = subname.substring (priorSemicolonPos+1, - nextSemicolonPos); - //@delim3 allow quoted default SQL schema in url - int nextQuote = -1; //@delim3 - //Check if schema is quoted. Parsing could have split schema if it contains ';'. //@delim3 - if(token.indexOf ('"') != -1 ) //@delim3 - { //@delim3 - if (token.endsWith("\"")) //@delim3 - { //@delim3 - nextQuote = nextSemicolonPos-1; //@delim3 - }else //@delim3 - { //@delim3 - nextQuote = subname.indexOf('"', nextSemicolonPos); //@delim3 - token += subname.substring(nextSemicolonPos, nextQuote + 1); //@delim3 - nextSemicolonPos = subname.indexOf (';', nextQuote );//@delim4 - //nextSemicolonPos = nextQuote + 1; //@delim3 - } //@delim3 - } //@delim3 - - ++tokenCount; - - // Parse the first token. This is the system name and - // default SQL schema. - if (tokenCount == 1) { - - // Strip off // if it is there. - //boolean doubleSlash = false; - if (token.length () >= 2) - if (token.substring (0, 2).equals ("//")) - token = token.substring (2); - - // Split it into system name and schema. - int slash = token.indexOf ('/'); - if (slash == -1) - serverName_ = token; - else { - serverName_ = token.substring (0, slash); - schema_ = token.substring (slash+1); - } - - // Validate the system name. - int colon = serverName_.indexOf (':'); - if (colon != -1) { - serverName_ = serverName_.substring (0, colon); - portSpecified_ = true; - } - - // Validate the schema. - int slash2 = schema_.indexOf ('/'); - if (slash2 != -1 && nextQuote == -1) { //@delim3 - schema_ = schema_.substring (0, slash2); - extraPathSpecified_ = true; - } - } - - // Parse other tokens. These specify properties. - else { - int equalSignPos = token.indexOf ('='); - String key; - String value; - if (equalSignPos == -1) { - key = token.trim(); - value = ""; - } - else { - key = token.substring (0, equalSignPos).trim(); - value = token.substring (equalSignPos + 1).trim(); - } - properties_.put (key, value); - } - - // End of while loop. - priorSemicolonPos = nextSemicolonPos; - searchPos = priorSemicolonPos+1; //@A2A - } - } - - - -/** -Return the URL as a String. - -@return The URL as a String. -**/ - public String toString () - { - return url_; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDDataTypeFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDDataTypeFieldMap.java deleted file mode 100644 index 397dceb97..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDDataTypeFieldMap.java +++ /dev/null @@ -1,66 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDDataTypeFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - -/** - The JDDataTypeFieldMap class converts an 8 character - description of the data type name - to the short value required by JDBC. -**/ -class JDDataTypeFieldMap -extends JDTypeInfoFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - private int typeIndex_; //@A1A - JDDataTypeFieldMap(int typeIndex, int lengthIndex, int precisionIndex, - int scaleIndex, int ccsidIndex, int vrm, JDProperties properties) // @M0C - added vrm and properties //@KKB added ccsid - { - super(typeIndex, lengthIndex, precisionIndex, scaleIndex, ccsidIndex, vrm, properties); // @M0C //@KKB - typeIndex_ = typeIndex; //@A1A - } - - /** - Returns the data type in JDBC format. - **/ - public Object getValue(JDRow row) - throws SQLException - { - String typeName = row.getSQLData(typeIndex_).getString().trim(); //@A1A - if(typeName.equals("DISTINCT")) //@A1A We do not have a SQLData class for DISTINCTs - return new Short((short)2001); //@A1A - return new Short((short)((SQLData)super.getValue(row)).getType()); - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return false; - } - - /** - Indicates if the value is null. - **/ - public boolean isNull(JDRow row) - throws SQLException - { - return false; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JDDatabaseMetaDataProxy.java b/cvsroot/src/com/ibm/as400/access/JDDatabaseMetaDataProxy.java deleted file mode 100644 index 1bed1f201..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDDatabaseMetaDataProxy.java +++ /dev/null @@ -1,1574 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDDatabaseMetaDataProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.sql.ResultSet; -/* ifdef JDBC40 -import java.sql.RowIdLifetime; -endif */ -import java.sql.SQLException; - - - -class JDDatabaseMetaDataProxy -extends AbstractProxyImpl -implements java.sql.DatabaseMetaData -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Private data. - - private JDConnectionProxy jdConnection_; - // The object that caused this object to be created. - - - /** - Constructs a JDDatabaseMetaDataProxy object. - - @param connectionProxy The Connection object that caused this object to be created. - **/ - public JDDatabaseMetaDataProxy (JDConnectionProxy jdConnection) - { - jdConnection_ = jdConnection; - } - - - public boolean allProceduresAreCallable () - throws SQLException - { - return callMethodRtnBool ("allProceduresAreCallable"); - } - - public boolean allTablesAreSelectable () - throws SQLException - { - return callMethodRtnBool ("allTablesAreSelectable"); - } - - private boolean callMethodRtnBool (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsBoolean (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a boolean. - private boolean callMethodRtnBool (String methodName, int arg) - throws SQLException - { - try { - return connection_.callMethod (pxId_, methodName, - new Class[] { Integer.TYPE }, - new Object[] { new Integer (arg) }) - .getReturnValueBoolean (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - private boolean callMethodRtnBool (String methodName, - Class[] argClasses, - Object[] argValues) - throws SQLException - { - try { - return connection_.callMethod (pxId_, methodName, - argClasses, argValues) - .getReturnValueBoolean (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return an int. - private int callMethodRtnInt (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsInt (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a ResultSet. - private JDResultSetProxy callMethodRtnRSet (String methodName) - throws SQLException - { - try { - JDResultSetProxy newResultSet = new JDResultSetProxy (jdConnection_); - return (JDResultSetProxy) connection_.callFactoryMethod ( - pxId_, methodName, newResultSet); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - private JDResultSetProxy callMethodRtnRSet (String methodName, - Class[] argClasses, - Object[] argValues) - throws SQLException - { - try { - JDResultSetProxy newResultSet = new JDResultSetProxy (jdConnection_); - return (JDResultSetProxy) connection_.callFactoryMethod ( - pxId_, methodName, - argClasses, argValues, - newResultSet); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a String. - private String callMethodRtnStr (String methodName) - throws SQLException - { - try { - return (String) connection_.callMethodReturnsObject (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - private Object callMethodRtnObj (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsObject (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@PDA jdbc40 - Object callMethodRtnObj(String methodName, Class[] argClasses, Object[] argValues) throws SQLException - { - try - { - return connection_.callMethod(pxId_, methodName, argClasses, argValues).getReturnValue(); - } catch (InvocationTargetException e) - { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public boolean dataDefinitionCausesTransactionCommit () - throws SQLException - { - return callMethodRtnBool ("dataDefinitionCausesTransactionCommit"); - } - - - public boolean dataDefinitionIgnoredInTransactions () - throws SQLException - { - return callMethodRtnBool ("dataDefinitionIgnoredInTransactions"); - } - - - -// JDBC 2.0 - public boolean deletesAreDetected (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("deletesAreDetected", resultSetType); - } - - - public boolean doesMaxRowSizeIncludeBlobs () - throws SQLException - { - return callMethodRtnBool ("doesMaxRowSizeIncludeBlobs"); - } - - -// JDBC 3.0 - public ResultSet getAttributes (String catalog, - String schemaPattern, - String typeNamePattern, - String attributeNamePattern) - throws SQLException - { - return callMethodRtnRSet ("getAttributes", - new Class[] { String.class, String.class, - String.class, - String.class}, - new Object[] { catalog, schemaPattern, typeNamePattern, - attributeNamePattern}); - } - - - public ResultSet getBestRowIdentifier (String catalog, - String schema, - String table, - int scope, - boolean nullable) - throws SQLException - { - return callMethodRtnRSet ("getBestRowIdentifier", - new Class[] { String.class, String.class, - String.class, - Integer.TYPE, Boolean.TYPE }, - new Object[] { catalog, schema, table, - new Integer (scope), - new Boolean (nullable) }); - } - - - public ResultSet getCatalogs () - throws SQLException - { - return callMethodRtnRSet ("getCatalogs"); - } - - public String getCatalogSeparator () - throws SQLException - { - return callMethodRtnStr ("getCatalogSeparator"); - } - - - public String getCatalogTerm () - throws SQLException - { - return callMethodRtnStr ("getCatalogTerm"); - } - - public ResultSet getColumnPrivileges (String catalog, - String schema, - String table, - String columnPattern) - throws SQLException - { - return callMethodRtnRSet ("getColumnPrivileges", - new Class[] { String.class, String.class, - String.class, String.class }, - new Object[] { catalog, schema, - table, columnPattern }); - } - - public ResultSet getColumns (String catalog, - String schemaPattern, - String tablePattern, - String columnPattern) - throws SQLException - { - return callMethodRtnRSet ("getColumns", - new Class[] { String.class, String.class, - String.class, String.class }, - new Object[] { catalog, schemaPattern, - tablePattern, columnPattern }); - } - - -// JDBC 2.0 - public java.sql.Connection getConnection () - throws SQLException - { - return jdConnection_; - } - - - public ResultSet getCrossReference (String primaryCatalog, - String primarySchema, - String primaryTable, - String foreignCatalog, - String foreignSchema, - String foreignTable) - throws SQLException - { - return callMethodRtnRSet ("getCrossReference", - new Class[] { String.class, String.class, - String.class, String.class, - String.class, String.class }, - new Object[] { primaryCatalog, primarySchema, - primaryTable, foreignCatalog, - foreignSchema, foreignTable }); - } - - -// JDBC 3.0 - public int getDatabaseMajorVersion () - throws SQLException - { - return callMethodRtnInt ("getDatabaseMajorVersion"); - } - - -// JDBC 3.0 - public int getDatabaseMinorVersion () - throws SQLException - { - return callMethodRtnInt ("getDatabaseMinorVersion"); - } - - - public String getDatabaseProductName () - throws SQLException - { - return callMethodRtnStr ("getDatabaseProductName"); - } - - - public String getDatabaseProductVersion () - throws SQLException - { - return callMethodRtnStr ("getDatabaseProductVersion"); - } - - - public int getDefaultTransactionIsolation () - throws SQLException - { - return callMethodRtnInt ("getDefaultTransactionIsolation"); - } - - - public int getDriverMajorVersion () - { - try { - return callMethodRtnInt ("getDriverMajorVersion"); - } - catch (SQLException e) - { - throw new InternalErrorException (e.getMessage (), InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - - public int getDriverMinorVersion () - { - try { - return callMethodRtnInt ("getDriverMinorVersion"); - } - catch (SQLException e) - { - throw new InternalErrorException (e.getMessage (), InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - - public String getDriverName () - throws SQLException - { - return callMethodRtnStr ("getDriverName"); - } - - - public String getDriverVersion () - throws SQLException - { - return callMethodRtnStr ("getDriverVersion"); - } - - - public ResultSet getExportedKeys (String catalog, - String schema, - String table) - throws SQLException - { - return callMethodRtnRSet ("getExportedKeys", - new Class[] { String.class, String.class, - String.class }, - new Object[] { catalog, schema, table }); - } - - - public String getExtraNameCharacters () - throws SQLException - { - return callMethodRtnStr ("getExtraNameCharacters"); - } - - - public String getIdentifierQuoteString () - throws SQLException - { - return callMethodRtnStr ("getIdentifierQuoteString"); - } - - - public ResultSet getImportedKeys (String catalog, - String schema, - String table) - throws SQLException - { - return callMethodRtnRSet ("getImportedKeys", - new Class[] { String.class, String.class, - String.class }, - new Object[] { catalog, schema, table }); - } - - - public ResultSet getIndexInfo (String catalog, - String schema, - String table, - boolean unique, - boolean approximate) - throws SQLException - { - return callMethodRtnRSet ("getIndexInfo", - new Class[] { String.class, String.class, - String.class, Boolean.TYPE, - Boolean.TYPE }, - new Object[] { catalog, schema, - table, new Boolean (unique), - new Boolean (approximate) }); - } - - -// JDBC 3.0 - public int getJDBCMajorVersion () - throws SQLException - { - return callMethodRtnInt ("getJDBCMajorVersion"); - } - - -// JDBC 3.0 - public int getJDBCMinorVersion () - throws SQLException - { - return callMethodRtnInt ("getJDBCMinorVersion"); - } - - - public int getMaxBinaryLiteralLength () - throws SQLException - { - return callMethodRtnInt ("getMaxBinaryLiteralLength"); - } - - - public int getMaxCatalogNameLength () - throws SQLException - { - return callMethodRtnInt ("getMaxCatalogNameLength"); - } - - - public int getMaxCharLiteralLength () - throws SQLException - { - return callMethodRtnInt ("getMaxCharLiteralLength"); - } - - - public int getMaxColumnNameLength () - throws SQLException - { - return callMethodRtnInt ("getMaxColumnNameLength"); - } - - - public int getMaxColumnsInGroupBy () - throws SQLException - { - return callMethodRtnInt ("getMaxColumnsInGroupBy"); - } - - - public int getMaxColumnsInIndex () - throws SQLException - { - return callMethodRtnInt ("getMaxColumnsInIndex"); - } - - - public int getMaxColumnsInOrderBy () - throws SQLException - { - return callMethodRtnInt ("getMaxColumnsInOrderBy"); - } - - - public int getMaxColumnsInSelect () - throws SQLException - { - return callMethodRtnInt ("getMaxColumnsInSelect"); - } - - - public int getMaxColumnsInTable () - throws SQLException - { - return callMethodRtnInt ("getMaxColumnsInTable"); - } - - - public int getMaxConnections () - throws SQLException - { - return callMethodRtnInt ("getMaxConnections"); - } - - - public int getMaxCursorNameLength () - throws SQLException - { - return callMethodRtnInt ("getMaxCursorNameLength"); - } - - - public int getMaxIndexLength () - throws SQLException - { - return callMethodRtnInt ("getMaxIndexLength"); - } - - - public int getMaxProcedureNameLength () - throws SQLException - { - return callMethodRtnInt ("getMaxProcedureNameLength"); - } - - - public int getMaxRowSize () - throws SQLException - { - return callMethodRtnInt ("getMaxRowSize"); - } - - - public int getMaxSchemaNameLength () - throws SQLException - { - return callMethodRtnInt ("getMaxSchemaNameLength"); - } - - - public int getMaxStatementLength () - throws SQLException - { - return callMethodRtnInt ("getMaxStatementLength"); - } - - - public int getMaxStatements () - throws SQLException - { - return callMethodRtnInt ("getMaxStatements"); - } - - - public int getMaxTableNameLength () - throws SQLException - { - return callMethodRtnInt ("getMaxTableNameLength"); - } - - - public int getMaxTablesInSelect () - throws SQLException - { - return callMethodRtnInt ("getMaxTablesInSelect"); - } - - - public int getMaxUserNameLength () - throws SQLException - { - return callMethodRtnInt ("getMaxUserNameLength"); - } - - - public String getNumericFunctions () - throws SQLException - { - return callMethodRtnStr ("getNumericFunctions"); - } - - - public ResultSet getPrimaryKeys (String catalog, - String schema, - String table) - throws SQLException - { - return callMethodRtnRSet ("getPrimaryKeys", - new Class[] { String.class, String.class, - String.class }, - new Object[] { catalog, schema, table }); - } - - - public ResultSet getProcedureColumns (String catalog, - String schemaPattern, - String procedurePattern, - String columnPattern) - throws SQLException - { - return callMethodRtnRSet ("getProcedureColumns", - new Class[] { String.class, String.class, - String.class, String.class }, - new Object[] { catalog, schemaPattern, - procedurePattern, columnPattern }); - } - - - public ResultSet getProcedures (String catalog, - String schemaPattern, - String procedurePattern) - throws SQLException - { - return callMethodRtnRSet ("getProcedures", - new Class[] { String.class, String.class, - String.class }, - new Object[] { catalog, schemaPattern, - procedurePattern }); - } - - - public String getProcedureTerm () - throws SQLException - { - return callMethodRtnStr ("getProcedureTerm"); - } - - -// JDBC 3.0 - public int getResultSetHoldability () - throws SQLException - { - return callMethodRtnInt ("getResultSetHoldability"); - } - - - public ResultSet getSchemas () - throws SQLException - { - return callMethodRtnRSet ("getSchemas"); - } - - - public String getSchemaTerm () - throws SQLException - { - return callMethodRtnStr ("getSchemaTerm"); - } - - - public String getSearchStringEscape () - throws SQLException - { - return callMethodRtnStr ("getSearchStringEscape"); - } - - - public String getSQLKeywords () - throws SQLException - { - return callMethodRtnStr ("getSQLKeywords"); - } - - -// JDBC 3.0 - public int getSQLStateType () - throws SQLException - { - return callMethodRtnInt ("getSQLStateType"); - } - - - public String getStringFunctions () - throws SQLException - { - return callMethodRtnStr ("getStringFunctions"); - } - - -// JDBC 3.0 - public ResultSet getSuperTables (String catalog, - String schemaPattern, - String tableNamePattern) - throws SQLException - { - return callMethodRtnRSet ("getSuperTables", - new Class[] { String.class, String.class, - String.class}, - new Object[] { catalog, schemaPattern, - tableNamePattern}); - } - - -// JDBC 3.0 - public ResultSet getSuperTypes (String catalog, - String schemaPattern, - String typeNamePattern) - throws SQLException - { - return callMethodRtnRSet ("getSuperTypes", - new Class[] { String.class, String.class, - String.class}, - new Object[] { catalog, schemaPattern, - typeNamePattern}); - } - - - - public String getSystemFunctions () - throws SQLException - { - return callMethodRtnStr ("getSystemFunctions"); - } - - - public ResultSet getTablePrivileges (String catalog, - String schemaPattern, - String tablePattern) - throws SQLException - { - return callMethodRtnRSet ("getTablePrivileges", - new Class[] { String.class, String.class, - String.class }, - new Object[] { catalog, schemaPattern, - tablePattern }); - } - - - public ResultSet getTables (String catalog, - String schemaPattern, - String tablePattern, - String tableTypes[]) - throws SQLException - { - return callMethodRtnRSet ("getTables", - new Class[] { String.class, String.class, - String.class, String[].class }, - new Object[] { catalog, schemaPattern, - tablePattern, tableTypes }); - } - - - public ResultSet getTableTypes () - throws SQLException - { - return callMethodRtnRSet ("getTableTypes"); - } - - - public String getTimeDateFunctions () - throws SQLException - { - return callMethodRtnStr ("getTimeDateFunctions"); - } - - - public ResultSet getTypeInfo () - throws SQLException - { - return callMethodRtnRSet ("getTypeInfo"); - } - - -// JDBC 2.0 - public ResultSet getUDTs (String catalog, - String schemaPattern, - String typeNamePattern, - int[] types) - throws SQLException - { - return callMethodRtnRSet ("getUDTs", - new Class[] { String.class, String.class, - String.class, int[].class }, - new Object[] { catalog, schemaPattern, - typeNamePattern, types }); - } - - - public String getURL () - throws SQLException - { - return callMethodRtnStr ("getURL"); - } - - - public String getUserName () - throws SQLException - { - return callMethodRtnStr ("getUserName"); - } - - - public ResultSet getVersionColumns (String catalog, - String schema, - String table) - throws SQLException - { - return callMethodRtnRSet ("getVersionColumns", - new Class[] { String.class, String.class, - String.class }, - new Object[] { catalog, schema, table }); - } - - -// JDBC 2.0 - public boolean insertsAreDetected (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("insertsAreDetected", resultSetType); - } - - - public boolean isCatalogAtStart () - throws SQLException - { - return callMethodRtnBool ("isCatalogAtStart"); - } - - - boolean isCatalogValid (String catalog) - throws SQLException - { - return callMethodRtnBool ("isCatalogValid", - new Class[] { String.class }, - new Object[] { catalog }); - } - - - public boolean isReadOnly () - throws SQLException - { - return callMethodRtnBool ("isReadOnly"); - } - - -// JDBC 3.0 - public boolean locatorsUpdateCopy () - throws SQLException - { - return callMethodRtnBool ("locatorsUpdateCopy"); - } - - - public boolean nullPlusNonNullIsNull () - throws SQLException - { - return callMethodRtnBool ("nullPlusNonNullIsNull"); - } - - - public boolean nullsAreSortedAtEnd () - throws SQLException - { - return callMethodRtnBool ("nullsAreSortedAtEnd"); - } - - - public boolean nullsAreSortedAtStart () - throws SQLException - { - return callMethodRtnBool ("nullsAreSortedAtStart"); - } - - - public boolean nullsAreSortedHigh () - throws SQLException - { - return callMethodRtnBool ("nullsAreSortedHigh"); - } - - - public boolean nullsAreSortedLow () - throws SQLException - { - return callMethodRtnBool ("nullsAreSortedLow"); - } - - -// JDBC 2.0 - public boolean othersDeletesAreVisible (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("othersDeletesAreVisible", resultSetType); - } - - -// JDBC 2.0 - public boolean othersInsertsAreVisible (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("othersInsertsAreVisible", resultSetType); - } - - -// JDBC 2.0 - public boolean othersUpdatesAreVisible (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("othersUpdatesAreVisible", resultSetType); - } - - -// JDBC 2.0 - public boolean ownDeletesAreVisible (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("ownDeletesAreVisible", resultSetType); - } - - -// JDBC 2.0 - public boolean ownInsertsAreVisible (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("ownInsertsAreVisible", resultSetType); - } - - -// JDBC 2.0 - public boolean ownUpdatesAreVisible (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("ownUpdatesAreVisible", resultSetType); - } - - - public boolean storesLowerCaseIdentifiers () - throws SQLException - { - return callMethodRtnBool ("storesLowerCaseIdentifiers"); - } - - - public boolean storesLowerCaseQuotedIdentifiers () - throws SQLException - { - return callMethodRtnBool ("storesLowerCaseQuotedIdentifiers"); - } - - - public boolean storesMixedCaseIdentifiers () - throws SQLException - { - return callMethodRtnBool ("storesMixedCaseIdentifiers"); - } - - - public boolean storesMixedCaseQuotedIdentifiers () - throws SQLException - { - return callMethodRtnBool ("storesMixedCaseQuotedIdentifiers"); - } - - - public boolean storesUpperCaseIdentifiers () - throws SQLException - { - return callMethodRtnBool ("storesUpperCaseIdentifiers"); - } - - - public boolean storesUpperCaseQuotedIdentifiers () - throws SQLException - { - return callMethodRtnBool ("storesUpperCaseQuotedIdentifiers"); - } - - - public boolean supportsAlterTableWithAddColumn () - throws SQLException - { - return callMethodRtnBool ("supportsAlterTableWithAddColumn"); - } - - - public boolean supportsAlterTableWithDropColumn () - throws SQLException - { - return callMethodRtnBool ("supportsAlterTableWithDropColumn"); - } - - - public boolean supportsANSI92EntryLevelSQL () - throws SQLException - { - return callMethodRtnBool ("supportsANSI92EntryLevelSQL"); - } - - - public boolean supportsANSI92FullSQL () - throws SQLException - { - return callMethodRtnBool ("supportsANSI92FullSQL"); - } - - - public boolean supportsANSI92IntermediateSQL () - throws SQLException - { - return callMethodRtnBool ("supportsANSI92IntermediateSQL"); - } - - -// JDBC 2.0 - public boolean supportsBatchUpdates () - throws SQLException - { - return callMethodRtnBool ("supportsBatchUpdates"); - } - - - public boolean supportsCatalogsInDataManipulation () - throws SQLException - { - return callMethodRtnBool ("supportsCatalogsInDataManipulation"); - } - - - public boolean supportsCatalogsInIndexDefinitions () - throws SQLException - { - return callMethodRtnBool ("supportsCatalogsInIndexDefinitions"); - } - - - public boolean supportsCatalogsInPrivilegeDefinitions () - throws SQLException - { - return callMethodRtnBool ("supportsCatalogsInPrivilegeDefinitions"); - } - - - public boolean supportsCatalogsInProcedureCalls () - throws SQLException - { - return callMethodRtnBool ("supportsCatalogsInProcedureCalls"); - } - - - public boolean supportsCatalogsInTableDefinitions () - throws SQLException - { - return callMethodRtnBool ("supportsCatalogsInTableDefinitions"); - } - - - public boolean supportsColumnAliasing () - throws SQLException - { - return callMethodRtnBool ("supportsColumnAliasing"); - } - - - public boolean supportsConvert () - throws SQLException - { - return callMethodRtnBool ("supportsConvert"); - } - - - public boolean supportsConvert (int fromType, int toType) - throws SQLException - { - return callMethodRtnBool ("supportsConvert", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer (fromType), - new Integer (toType) }); - } - - - public boolean supportsCoreSQLGrammar () - throws SQLException - { - return callMethodRtnBool ("supportsCoreSQLGrammar"); - } - - - public boolean supportsCorrelatedSubqueries () - throws SQLException - { - return callMethodRtnBool ("supportsCorrelatedSubqueries"); - } - - - public boolean supportsDataDefinitionAndDataManipulationTransactions () - throws SQLException - { - return callMethodRtnBool ("supportsDataDefinitionAndDataManipulationTransactions"); - } - - - public boolean supportsDataManipulationTransactionsOnly () - throws SQLException - { - return callMethodRtnBool ("supportsDataManipulationTransactionsOnly"); - } - - - public boolean supportsDifferentTableCorrelationNames () - throws SQLException - { - return callMethodRtnBool ("supportsDifferentTableCorrelationNames"); - } - - - public boolean supportsExpressionsInOrderBy () - throws SQLException - { - return callMethodRtnBool ("supportsExpressionsInOrderBy"); - } - - - public boolean supportsExtendedSQLGrammar () - throws SQLException - { - return callMethodRtnBool ("supportsExtendedSQLGrammar"); - } - - - public boolean supportsFullOuterJoins () - throws SQLException - { - return callMethodRtnBool ("supportsFullOuterJoins"); - } - - -// JDBC 3.0 - public boolean supportsGetGeneratedKeys () - throws SQLException - { - return callMethodRtnBool ("supportsGetGeneratedKeys"); - } - - - public boolean supportsGroupBy () - throws SQLException - { - return callMethodRtnBool ("supportsGroupBy"); - } - - - public boolean supportsGroupByBeyondSelect () - throws SQLException - { - return callMethodRtnBool ("supportsGroupByBeyondSelect"); - } - - - public boolean supportsGroupByUnrelated () - throws SQLException - { - return callMethodRtnBool ("supportsGroupByUnrelated"); - } - - - public boolean supportsIntegrityEnhancementFacility () - throws SQLException - { - return callMethodRtnBool ("supportsIntegrityEnhancementFacility"); - } - - - public boolean supportsLikeEscapeClause () - throws SQLException - { - return callMethodRtnBool ("supportsLikeEscapeClause"); - } - - - public boolean supportsLimitedOuterJoins () - throws SQLException - { - return callMethodRtnBool ("supportsLimitedOuterJoins"); - } - - - public boolean supportsMinimumSQLGrammar () - throws SQLException - { - return callMethodRtnBool ("supportsMinimumSQLGrammar"); - } - - - public boolean supportsMixedCaseIdentifiers () - throws SQLException - { - return callMethodRtnBool ("supportsMixedCaseIdentifiers"); - } - - - public boolean supportsMixedCaseQuotedIdentifiers () - throws SQLException - { - return callMethodRtnBool ("supportsMixedCaseQuotedIdentifiers"); - } - - -// JDBC 3.0 - public boolean supportsMultipleOpenResults () - throws SQLException - { - return callMethodRtnBool ("supportsMultipleOpenResults"); - } - - - public boolean supportsMultipleResultSets () - throws SQLException - { - return callMethodRtnBool ("supportsMultipleResultSets"); - } - - - public boolean supportsMultipleTransactions () - throws SQLException - { - return callMethodRtnBool ("supportsMultipleTransactions"); - } - - -// JDBC 3.0 - public boolean supportsNamedParameters () - throws SQLException - { - return callMethodRtnBool ("supportsNamedParameters"); - } - - - public boolean supportsNonNullableColumns () - throws SQLException - { - return callMethodRtnBool ("supportsNonNullableColumns"); - } - - - public boolean supportsOpenCursorsAcrossCommit () - throws SQLException - { - return callMethodRtnBool ("supportsOpenCursorsAcrossCommit"); - } - - - public boolean supportsOpenCursorsAcrossRollback () - throws SQLException - { - return callMethodRtnBool ("supportsOpenCursorsAcrossRollback"); - } - - - public boolean supportsOpenStatementsAcrossCommit () - throws SQLException - { - return callMethodRtnBool ("supportsOpenStatementsAcrossCommit"); - } - - - public boolean supportsOpenStatementsAcrossRollback () - throws SQLException - { - return callMethodRtnBool ("supportsOpenStatementsAcrossRollback"); - } - - - public boolean supportsOrderByUnrelated () - throws SQLException - { - return callMethodRtnBool ("supportsOrderByUnrelated"); - } - - - public boolean supportsOuterJoins () - throws SQLException - { - return callMethodRtnBool ("supportsOuterJoins"); - } - - - public boolean supportsPositionedDelete () - throws SQLException - { - return callMethodRtnBool ("supportsPositionedDelete"); - } - - - public boolean supportsPositionedUpdate () - throws SQLException - { - return callMethodRtnBool ("supportsPositionedUpdate"); - } - - -// JDBC 2.0 - public boolean supportsResultSetConcurrency (int resultSetType, int resultSetConcurrency) - throws SQLException - { - return callMethodRtnBool ("supportsResultSetConcurrency", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer (resultSetType), - new Integer (resultSetConcurrency) }); - } - - -// JDBC 3.0 - public boolean supportsResultSetHoldability (int resultSetHoldability) - throws SQLException - { - return callMethodRtnBool ("supportsResultSetHoldability", - new Class[] { Integer.TYPE}, - new Object[] { new Integer (resultSetHoldability)}); - } - - -// JDBC 2.0 - public boolean supportsResultSetType (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("supportsResultSetType", resultSetType); - } - - -// JDBC 3.0 - public boolean supportsSavepoints () - throws SQLException - { - return callMethodRtnBool ("supportsSavepoints"); - } - - - public boolean supportsSchemasInDataManipulation () - throws SQLException - { - return callMethodRtnBool ("supportsSchemasInDataManipulation"); - } - - - public boolean supportsSchemasInIndexDefinitions () - throws SQLException - { - return callMethodRtnBool ("supportsSchemasInIndexDefinitions"); - } - - - public boolean supportsSchemasInPrivilegeDefinitions () - throws SQLException - { - return callMethodRtnBool ("supportsSchemasInPrivilegeDefinitions"); - } - - - public boolean supportsSchemasInProcedureCalls () - throws SQLException - { - return callMethodRtnBool ("supportsSchemasInProcedureCalls"); - } - - - public boolean supportsSchemasInTableDefinitions () - throws SQLException - { - return callMethodRtnBool ("supportsSchemasInTableDefinitions"); - } - - - public boolean supportsSelectForUpdate () - throws SQLException - { - return callMethodRtnBool ("supportsSelectForUpdate"); - } - - - public boolean supportsStatementPooling() - throws SQLException - { - return callMethodRtnBool ("supportsStatementPooling"); - } - - - public boolean supportsStoredProcedures () - throws SQLException - { - return callMethodRtnBool ("supportsStoredProcedures"); - } - - - public boolean supportsSubqueriesInComparisons () - throws SQLException - { - return callMethodRtnBool ("supportsSubqueriesInComparisons"); - } - - - public boolean supportsSubqueriesInExists () - throws SQLException - { - return callMethodRtnBool ("supportsSubqueriesInExists"); - } - - - public boolean supportsSubqueriesInIns () - throws SQLException - { - return callMethodRtnBool ("supportsSubqueriesInIns"); - } - - - public boolean supportsSubqueriesInQuantifieds () - throws SQLException - { - return callMethodRtnBool ("supportsSubqueriesInQuantifieds"); - } - - - public boolean supportsTableCorrelationNames () - throws SQLException - { - return callMethodRtnBool ("supportsTableCorrelationNames"); - } - - - public boolean supportsTransactionIsolationLevel (int transactionIsolationLevel) - throws SQLException - { - return callMethodRtnBool ("supportsTransactionIsolationLevel", transactionIsolationLevel); - } - - - public boolean supportsTransactions () - throws SQLException - { - return callMethodRtnBool ("supportsTransactions"); - } - - - public boolean supportsUnion () - throws SQLException - { - return callMethodRtnBool ("supportsUnion"); - } - - - public boolean supportsUnionAll () - throws SQLException - { - return callMethodRtnBool ("supportsUnionAll"); - } - - - // This method is not required by java.sql.DatabaseMetaData, - // but it is used by the JDBC testcases, and is implemented - // in the public class. - public String toString () - { - try { - return (String) connection_.callMethodReturnsObject (pxId_, "toString"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - -// JDBC 2.0 - public boolean updatesAreDetected (int resultSetType) - throws SQLException - { - return callMethodRtnBool ("updatesAreDetected", resultSetType); - } - - - public boolean usesLocalFilePerTable () - throws SQLException - { - return callMethodRtnBool ("usesLocalFilePerTable"); - } - - - public boolean usesLocalFiles () - throws SQLException - { - return callMethodRtnBool ("usesLocalFiles"); - } - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.DatabaseMetaData" }; - } - - - //@PDA jdbc40 - public boolean autoCommitFailureClosesAllResultSets() throws SQLException - { - return callMethodRtnBool("autoCommitFailureClosesAllResultSets"); - } - - - //@PDA 550 - public ResultSet getClientInfoProperties() throws SQLException - { - return callMethodRtnRSet("getClientInfoProperties"); - } - - /* ifdef JDBC40 - - //@PDA jdbc40 - public RowIdLifetime getRowIdLifetime() throws SQLException - { - return (RowIdLifetime) callMethodRtnObj("getRowIdLifetime"); - } - endif */ - - //@PDA jdbc40 - public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException - { - return callMethodRtnRSet("getSchemas", new Class[] {String.class, String.class}, new Object[] {catalog, schemaPattern}); - } - - // @PDA jdbc40 - public boolean providesQueryObjectGenerator() throws SQLException - { - return callMethodRtnBool("providesQueryObjectGenerator"); - } - - //@PDA jdbc40 - public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException - { - return callMethodRtnBool("supportsStoredFunctionsUsingCallSyntax"); - } - - //@pdd removde getFunctionParameters. It was renamed to getFunctionColumns() - - //@PDA jdbc40 - public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException - { - return callMethodRtnRSet ("getFunctions", - new Class[] { String.class, String.class, String.class }, - new Object[] { catalog, schemaPattern, functionNamePattern }); - } - - //@pda 550 - public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException - { - return callMethodRtnRSet ("getFunctionColumns", - new Class[] { String.class, String.class, String.class, String.class }, - new Object[] { catalog, schemaPattern, functionNamePattern, columnNamePattern }); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDError.java b/cvsroot/src/com/ibm/as400/access/JDError.java deleted file mode 100644 index cbfd4f683..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDError.java +++ /dev/null @@ -1,860 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDError.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/* ifdef JDBC40 -import java.sql.ClientInfoStatus; -import java.sql.SQLClientInfoException; -import java.sql.SQLDataException; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLFeatureNotSupportedException; -import java.sql.SQLIntegrityConstraintViolationException; -import java.sql.SQLInvalidAuthorizationSpecException; -import java.sql.SQLNonTransientConnectionException; -import java.sql.SQLSyntaxErrorException; -import java.sql.SQLTimeoutException; -import java.sql.SQLTransactionRollbackException; -import java.util.Map; -endif */ - -import java.sql.SQLWarning; - - - -/** -The JDError class provides access to all of the error and -warning SQL states and message string resources. -**/ -// -// Implementation note: -// -// When adding or changing an error message or SQL state, there -// are places that you need to add or change: -// -// 1. A String constant defined to be equal to the SQL state. -// 2. A resource in JDMRI.properties, named JD + SQL state. -// -final class JDError -{ - // Constants for SQL states. - static final String EXC_ACCESS_MISMATCH = "42505"; - static final String EXC_ATTRIBUTE_VALUE_INVALID = "HY024"; - static final String EXC_BUFFER_LENGTH_INVALID = "HY090"; - static final String EXC_CHAR_CONVERSION_INVALID = "22524"; - static final String EXC_CCSID_INVALID = "22522"; - static final String EXC_COLUMN_NOT_FOUND = "42703"; - static final String EXC_CONCURRENCY_INVALID = "HY108"; - static final String EXC_CONNECTION_NONE = "08003"; - static final String EXC_CONNECTION_REJECTED = "08004"; - static final String EXC_CONNECTION_UNABLE = "08001"; - static final String EXC_COMMUNICATION_LINK_FAILURE = "08S01"; // @F2A - static final String EXC_CURSOR_NAME_AMBIGUOUS = "3C000"; - static final String EXC_CURSOR_NAME_INVALID = "34000"; - static final String EXC_CURSOR_POSITION_INVALID = "HY109"; - static final String EXC_CURSOR_STATE_INVALID = "24000"; - static final String EXC_DATA_TYPE_INVALID = "HY004"; - static final String EXC_DATA_TYPE_MISMATCH = "07006"; - static final String EXC_DESCRIPTOR_INDEX_INVALID = "07009"; - static final String EXC_FUNCTION_NOT_SUPPORTED = "IM001"; - static final String EXC_FUNCTION_SEQUENCE = "HY010"; - static final String EXC_INTERNAL = "HY000"; - static final String EXC_MAX_STATEMENTS_EXCEEDED = "HY014"; - static final String EXC_OPERATION_CANCELLED = "HY008"; - static final String EXC_PARAMETER_COUNT_MISMATCH = "07001"; - static final String EXC_PARAMETER_TYPE_INVALID = "HY105"; - static final String EXC_SCALE_INVALID = "HY094"; - static final String EXC_SERVER_ERROR = "HY001"; - static final String EXC_SYNTAX_BLANK = "43617"; - static final String EXC_SYNTAX_ERROR = "42601"; - static final String EXC_TXN_STATE_INVALID = "25000"; // @E1C - static final String EXC_SQL_STATEMENT_TOO_LONG = "54001"; // @E9A - static final String EXC_SAVEPOINT_INVALID_IN_CONTEXT = "3B001"; // @E10a - static final String EXC_SAVEPOINT_ALREADY_EXISTS = "3B501"; // @E10a - static final String EXC_SAVEPOINT_DOES_NOT_EXIST = "3B502"; // @E10a - static final String EXC_RDB_DOES_NOT_EXIST = "42705"; // @J2a - static final String EXC_XML_PARSING_ERROR = "2200M"; // @xml2 - - static final String WARN_ATTRIBUTE_VALUE_CHANGED = "01608"; - static final String WARN_EXTENDED_DYNAMIC_DISABLED = "01H11"; - static final String WARN_OPTION_VALUE_CHANGED = "01S02"; - static final String WARN_PACKAGE_CACHE_DISABLED = "01H12"; - static final String WARN_PROPERTY_EXTRA_IGNORED = "01H20"; - static final String WARN_TXN_COMMITTED = "01H30"; - static final String WARN_URL_EXTRA_IGNORED = "01H10"; - static final String WARN_URL_SCHEMA_INVALID = "01H13"; - static final String WARN_1000_OPEN_STATEMENTS = "01G00"; //@K1A - - - - static String lastServerSQLState_ = null; - - static boolean jdk14 = false; - static { - String javaVersion = System.getProperty("java.version"); - javaVersion=javaVersion.substring(0,3); - if ("1.0".equals(javaVersion) || "1.1".equals(javaVersion) || "1.2".equals(javaVersion) || "1.3".equals(javaVersion)) { - jdk14=false; - } else { - jdk14=true; - } - - } - -/** -Private constructor to prevent instantiation. All methods in -this class are static. -**/ - private JDError () - { - } - - - -/** -Returns the reason text based on a SQL state. - -@param sqlState the SQL State. -@return Reason - error description. -**/ - static final String getReason (String sqlState) - { - return AS400JDBCDriver.getResource ("JD" + sqlState); - } - - - -// @E2C -/** -Returns the message text for the last operation on the IBM i system. - -@param connection Connection to the system. -@param id Id for the last operation. -@param returnCode The return code from the last operation. -@return Reason - error description. -**/ - private static String getReason (AS400JDBCConnection connection, - int id, - int returnCode) // @E2A - { - try - { - // Check to see if the caller wants second level text, too. - boolean secondLevelText = connection.getProperties().equals (JDProperties.ERRORS, JDProperties.ERRORS_FULL); - - // Get the message text from the system. We also retrieve - // the SQL state at this time to save a trip to the system. - int orsBitmap = DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_SQLCA - + DBBaseRequestDS.ORS_BITMAP_MESSAGE_ID - + DBBaseRequestDS.ORS_BITMAP_FIRST_LEVEL_TEXT; - if (secondLevelText) - orsBitmap += DBBaseRequestDS.ORS_BITMAP_SECOND_LEVEL_TEXT; - - DBSQLResultSetDS request = null; //@P0A - DBReplyRequestedDS reply = null; //@P0A - try //@P0A - { - request = DBDSPool.getDBSQLResultSetDS ( //@P0C - DBSQLResultSetDS.FUNCTIONID_SEND_RESULTS_SET, - id, orsBitmap, 0); - - reply = connection.sendAndReceive (request, id); //@P0C - DBReplySQLCA sqlca = reply.getSQLCA(); // @E2A - - // Build up the error description. - StringBuffer errorDescription = new StringBuffer (); - errorDescription.append ("["); - errorDescription.append (reply.getMessageId()); - errorDescription.append ("] "); - - // If pre-V5R4: - // If the return code is +-438 (from an SQL stored procedure) or @E4A - // +-443 (from an external stored procedure) AND errd[3] is 0, then @E4A @E6C - // an error was signalled by the stored procedure itself. @E4A - boolean textAppended = false; // @E6A - int absReturnCode = Math.abs(returnCode); // @E4A - - if ((absReturnCode == 438) || (absReturnCode == 443) && // @E2A @E4C @E5C @E6C - (connection.getVRM() < JDUtilities.vrm540)) //@25955a - { - try //@25955a - { - if (sqlca.getErrd (4) == 0) //@F1C // @E6A - { - if (absReturnCode == 438) // @E2A @E4C @E5C - { - errorDescription.append(sqlca.getErrmc(connection.converter_)); // @E2A @P0C - textAppended = true; // @E8A - } - else if (absReturnCode == 443) // @E5A - { - errorDescription.append(sqlca.getErrmc(6, connection.converter_)); // @E5A @P0C - textAppended = true; // @E8A - } - } // @E6A - } - catch(Exception e) { // In some circumstances the getErrmc() can throw a NegativeArraySizeException or ArrayIndexOutOfBoundsException. @25955a - JDTrace.logException(null, e.getMessage(), e); // just trace it - } - } - - // Otherwise, get the text directly from the reply. // @E6A - if (textAppended == false) // @E2A @E6C - { - errorDescription.append (reply.getFirstLevelMessageText()); - if (secondLevelText) - { - errorDescription.append (" "); - errorDescription.append (reply.getSecondLevelMessageText ()); - } - } // @E2A - - // Get the SQL state and remember it for the next - // call to getSQLState(). - lastServerSQLState_ = sqlca.getSQLState (connection.converter_); // @E2C @P0C - if (lastServerSQLState_ == null) - lastServerSQLState_ = EXC_SERVER_ERROR; - - return errorDescription.toString (); - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - if (reply != null) { reply.returnToPool(); reply = null; } - } - } - catch (DBDataStreamException e) - { - return getReason (EXC_INTERNAL); - } - catch (SQLException e) - { - return getReason (EXC_INTERNAL); - } - } - - - -/** -Returns the SQL state for the last operation on the IBM i system. - -@param connection Connection to the system. -@param id Id for the last operation. -@return The SQL state. -**/ - private static String getSQLState (AS400JDBCConnection connection, - int id) - { - // If the SQL state was retrieved by a previous call to - // getReason(), then use that. - if (lastServerSQLState_ != null) - { - String sqlState = lastServerSQLState_; - lastServerSQLState_ = null; - return sqlState; - } - - // Otherwise, go to the system to get it. - try - { - int orsBitmap = DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + DBBaseRequestDS.ORS_BITMAP_SQLCA; - - DBSQLResultSetDS request = null; //@P0A - DBReplyRequestedDS reply = null; //@P0A - try //@P0A - { - request = DBDSPool.getDBSQLResultSetDS (DBSQLResultSetDS.FUNCTIONID_SEND_RESULTS_SET, id, orsBitmap, 0); //@P0C - - reply = connection.sendAndReceive (request, id); //@P0C - - String sqlState = reply.getSQLCA ().getSQLState (connection.converter_); //@P0C - - if (sqlState == null) - sqlState = EXC_SERVER_ERROR; - - return sqlState; - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - if (reply != null) { reply.returnToPool(); reply = null; } - } - } - catch (DBDataStreamException e) - { - return getReason (EXC_INTERNAL); - } - catch (SQLException e) - { - return getReason (EXC_INTERNAL); - } - } - - - -/** -Returns an SQL warning based on an error in the -error table. - -@param sqlState The SQL State. -**/ - public static SQLWarning getSQLWarning (String sqlState) - { - // The DB2 for IBM i SQL CLI manual says that - // we should set the native error code to -99999 - // when the driver generates the warning. - // - String reason = getReason(sqlState); - SQLWarning warning = new SQLWarning (reason, sqlState, -99999); - - if (JDTrace.isTraceOn ()) // @J3a - { - // @J3a - String message = "Posting warning, sqlState: " + sqlState // @J3a - + " reason: " + reason // @J3a - + " vendor code -99999"; // @J3a - JDTrace.logException(null, message, warning); // @J3a - } // @J3a - - return warning; - } - - - -/** -Returns an SQL warning based on information -retrieved from the IBM i system. - -@param connection connection to the system. -@param id id for the last operation. -@param errorClass error class from the system reply. -@param returnCode return code from the system reply. -**/ - public static SQLWarning getSQLWarning (AS400JDBCConnection connection, - int id, - int errorClass, - int returnCode) - { - String reason = getReason (connection, id, returnCode); - String state = getSQLState (connection, id); - - SQLWarning warning = new SQLWarning (reason, state, returnCode); // @E2C - - if (JDTrace.isTraceOn ()) // @J3a - { - // @J3a - String message = "Posting warning, id: " + id // @J3a - + " error class: " + errorClass // @J3a - + " return code: " + returnCode // @J3a - + " reason: " + reason // @J3a - + " state: " + state; // @J3a - JDTrace.logException(connection, message, warning); // @J3a - } // @J3a - - return warning; - } - - - - -/** -Throws an SQL exception based on an error in the -error table. - -@param sqlState The SQL State. - -@exception SQLException Always. -**/ - public static void throwSQLException (String sqlState) - throws SQLException - { - // @J4 - changed this method to call the method that takes an object ID. Don't - // know why the same code was in two places. A null object ID is handled - // by both this class and JDTrace. - JDError.throwSQLException((Object)null, sqlState); - } - - -// @J3 new method -/** -Throws an SQL exception based on an error in the -error table. - -@param Object The object throwing the exception. This can be null. -@param sqlState The SQL State. - - -@exception SQLException Always. -**/ - public static void throwSQLException (Object thrower, String sqlState) - throws SQLException - { - // The DB2 for IBM i SQL CLI manual says that - // we should set the native error code to -99999 - // when the driver generates the error. - // - String reason = getReason(sqlState); - /* ifdef JDBC40 - SQLException e = createSQLExceptionSubClass(reason, sqlState, -99999); //@PDA jdbc40 - - endif */ - /* ifndef JDBC40 */ - SQLException e = new SQLException (reason, sqlState, -99999); - /* endif */ - if (JDTrace.isTraceOn ()) - { - String message = "Throwing exception, sqlState: " + sqlState - + " reason: " + reason - + " vendor code -99999"; - JDTrace.logException(thrower, message, e); - } - - throw e; - } - - - -/** -Throws an SQL exception based on an error in the -error table and dumps an internal exception stack -trace for debugging purposes. - -@param sqlState The SQL State. -@param e The internal exception. - -@exception SQLException Always. -**/ - public static void throwSQLException (String sqlState, Exception e) - throws SQLException - { - // @J4 - changed this method to call the method that takes an object ID. - // This method can be removed once all code that uses is has been updated - // to call the method that takes a reference to the thrower. That is, once - // all jdbc classes have been changed from - // JDError.throwSQLException(state, e); - // to - // JDError.throwSQLException(this, state, e); - - JDError.throwSQLException(null, sqlState, e); - } - - -/** -Throws an SQL exception based on an error in the -error table and dumps an internal exception stack -trace for debugging purposes. - -@param sqlState The SQL State. -@param message The message text. - -@exception SQLException Always. -**/ - public static void throwSQLException (String sqlState, String message) - throws SQLException - { - JDError.throwSQLException(null, sqlState, message); - } - - -/** -Throws an SQL exception based on an error in the -error table and dumps an internal exception stack -trace for debugging purposes. - -@param sqlState The SQL State. -@param message The message text. - -@exception SQLException Always. -**/ - public static void throwSQLException (Object thrower, String sqlState, String message) - throws SQLException - { - String reason = getReason(sqlState); - StringBuffer buffer = new StringBuffer(reason); - if (message != null) - { - buffer.append(" ("); - buffer.append(message); - buffer.append(')'); - } - - // The DB2 for IBM i SQL CLI manual says that - // we should set the native error code to -99999 - // when the driver generates the error. - // - - /* ifdef JDBC40 - SQLException e2 = createSQLExceptionSubClass(buffer.toString(), sqlState, -99999); //@PDA jdbc40 - - endif */ - /* ifndef JDBC40 */ - SQLException e2 = new SQLException (buffer.toString(), sqlState, -99999); - /* endif */ - if (JDTrace.isTraceOn ()) - { - String m2 = "Throwing exception. Message text: "+message; - JDTrace.logInformation(thrower, m2); - - m2 = "Throwing exception. Actual exception: " - + buffer.toString() - + " sqlState: " + sqlState - + " vendor code -99999"; - JDTrace.logException(thrower, m2, e2); - } - - throw e2; - } - - -// @J4 new method. It has all the code from the method that takes a state and an -// exception. What is added is a reference to the thrower so we know -// who is throwing the exception. -/** -Throws an SQL exception based on an error in the -error table and dumps an internal exception stack -trace for debugging purposes. - -@param sqlState The SQL State. -@param e The internal exception. - -@exception SQLException Always. -**/ - public static void throwSQLException (Object thrower, String sqlState, Exception e) - throws SQLException - { - // Dump the internal exception stack trace if - // trace is on. - // @J3d if (JDTrace.isTraceOn ()) { // @D0A - // @J3d synchronized (DriverManager.class) { // @D0A - // @J3d e.printStackTrace (DriverManager.getLogWriter()); - // @J3d } // @D0A - // @J3d } // @D0A - - String reason = getReason(sqlState); - StringBuffer buffer = new StringBuffer(reason); // @E3A - buffer.append(" ("); // @E3A - String message = e.getMessage(); // @E3A - if (message != null) // @E3A - buffer.append(message); // @E3A - else // @E3A - buffer.append(e.getClass()); // @E3A - buffer.append(')'); // @E7A - - // The DB2 for IBM i SQL CLI manual says that - // we should set the native error code to -99999 - // when the driver generates the error. - // - /* ifdef JDBC40 - SQLException e2 = createSQLExceptionSubClass(buffer.toString(), sqlState, -99999); //@PDA jdbc40 - - endif */ - /* ifndef JDBC40 */ - SQLException e2 = new SQLException (buffer.toString(), sqlState, -99999); // @E3C - /* endif */ - if (JDTrace.isTraceOn ()) // @J3a - { // @J3a - String m2 = "Throwing exception. Original exception: "; // @J3a - JDTrace.logException(thrower, m2, e); // @J3a - // @J3a - m2 = "Throwing exception. Actual exception: " // @J3a - + buffer.toString() // @J3a - + " sqlState: " + sqlState // @J3a - + " vendor code -99999"; // @J3a - JDTrace.logException(thrower, m2, e2); // @J3a - } // @J3a - - // - // Set the cause for JDK 1.4 and later - // - if (jdk14) { - e2.initCause(e); - } - throw e2; - } - -/** -Throws an SQL exception based on an error in the -error table and dumps an internal exception stack -trace for debugging purposes. - -@param thrower The object that threw the exception. -@param sqlState The SQL State. -@param e The internal exception. -@param m A message for the exception - -@exception SQLException Always. -**/ - public static void throwSQLException (Object thrower, String sqlState, Exception e, String m) - throws SQLException - { - - String reason = getReason(sqlState); - StringBuffer buffer = new StringBuffer(reason); - buffer.append(" ("); - String message = e.getMessage(); - if (message != null) - buffer.append(message); - else - buffer.append(e.getClass()); - buffer.append(", "); - buffer.append(m); - buffer.append(')'); - - // The DB2 for IBM i SQL CLI manual says that - // we should set the native error code to -99999 - // when the driver generates the error. - // - /* ifdef JDBC40 - SQLException e2 = createSQLExceptionSubClass(buffer.toString(), sqlState, -99999); //@PDA jdbc40 - - endif */ - /* ifndef JDBC40 */ - SQLException e2 = new SQLException (buffer.toString(), sqlState, -99999); - /* endif */ - if (JDTrace.isTraceOn ()) - { - String m2 = "Throwing exception. Original exception: "; - JDTrace.logException(thrower, m2, e); - - m2 = "Throwing exception. Actual exception: " - + buffer.toString() - + " sqlState: " + sqlState - + " vendor code -99999"; - JDTrace.logException(thrower, m2, e2); - } - - throw e2; - } - - -/** -Throws an SQL exception based on information -retrieved from the IBM i system. - -@param connection connection to the system. -@param id id for the last operation. -@param errorClass error class from the system reply. -@param returnCode return code from the system reply. - -@exception SQLException Always. -**/ - public static void throwSQLException (AS400JDBCConnection connection, - int id, - int errorClass, - int returnCode) - throws SQLException - { - // @J4 code moved to the method that takes a reference to the object - // that is throwing the exception. This method can be removed - // once all code that uses is has been updated to call the - // method that takes a reference to the thrower. That is, once - // all jdbc classes have been changed from - // JDError.throwSQLException(connection, id, errorClass, returnCode); - // to - // JDError.throwSQLException(this, connection, id, errorClass, returnCode); - - JDError.throwSQLException(null, connection, id, errorClass, returnCode); - } - - - -// @J4 new method. It has all the code from the method that takes a connection, -// and the error stuff. What is added is a reference to the thrower so we know -// who is throwing the exception. -/** -Throws an SQL exception based on information -retrieved from the system. - -@param connection connection to the system. -@param id id for the last operation. -@param errorClass error class from the system reply. -@param returnCode return code from the system reply. - -@exception SQLException Always. -**/ - public static void throwSQLException (Object thrower, - AS400JDBCConnection connection, - int id, - int errorClass, - int returnCode) - throws SQLException - { - String reason = getReason(connection, id, returnCode); - String state = getSQLState(connection, id); - - /* ifdef JDBC40 - SQLException e = createSQLExceptionSubClass(reason, state, returnCode); //@PDA jdbc40 - - endif */ - /* ifndef JDBC40 */ - SQLException e = new SQLException (reason, state, returnCode); // @E2C - /* endif */ - if (JDTrace.isTraceOn ()) // @J3a - { // @J3a - String message = "Throwing exception, id: " + id // @J3a - + " error class: " + errorClass // @J3a - + " return code: " + returnCode // @J3a - + " reason: " + reason // @J3a - + " state: " + state; // @J3a - JDTrace.logException(thrower, connection, message, e); // @J3a - } // @J3a - - throw e; - } - - - - //@PDA jdbc40 -//JDBC40DOC /** -//JDBC40DOC Throws an SQLClientInfoException exception based on an error in the -//JDBC40DOC error table and dumps an internal exception stack -//JDBC40DOC trace for debugging purposes. -//JDBC40DOC -//JDBC40DOC @param thrower The object that is throwing the exception. -//JDBC40DOC @param sqlState The SQL State. -//JDBC40DOC @param e The internal exception. -//JDBC40DOC -//JDBC40DOC @exception SQLClientInfoException Always. -//JDBC40DOC **/ - // - //@pdc jdbc40 merge public static void throwSQLClientInfoException (Object thrower, String sqlState, Exception e, Map m) - /* ifdef JDBC40 - public static void throwSQLClientInfoException (Object thrower, String sqlState, Exception e, Map m) - throws SQLClientInfoException - { - String reason = getReason(sqlState); - StringBuffer buffer = new StringBuffer(reason); - buffer.append(" ("); - String message = e.getMessage(); - if (message != null) - buffer.append(message); - else - buffer.append(e.getClass()); - buffer.append(')'); - - // The DB2 for IBM i SQL CLI manual says that - // we should set the native error code to -99999 - // when the driver generates the error. - - SQLClientInfoException e2 = new SQLClientInfoException (buffer.toString(), sqlState, -99999, m); - - if (JDTrace.isTraceOn ()) - { - String m2 = "Throwing exception. Original exception: "; - JDTrace.logException(thrower, m2, e); - // @J3a - m2 = "Throwing exception. Actual exception: " - + buffer.toString() - + " sqlState: " + sqlState - + " vendor code -99999"; - JDTrace.logException(thrower, m2, e2); - } - - throw e2; - } - endif */ - //@PDA jdbc40 -//JDBC40DOC /** -//JDBC40DOC Helper class that creates a new sub-class object of SQLException for new jdbc 4.0 SQLException sub-classes. -//JDBC40DOC Sub-class is determined based upon sqlState. -//JDBC40DOC Modeled after Native driver SQLException factory. -//JDBC40DOC -//JDBC40DOC @param sqlState The SQL State. -//JDBC40DOC **/ - - /* ifdef JDBC40 - - public static SQLException createSQLExceptionSubClass ( String message, String sqlState, int vendorCode ) - { - - // - // Check the first two digits of the SQL state and create the appropriate - // exception - // - - char digit0 = sqlState.charAt(0); - char digit1 = sqlState.charAt(1); - - switch (digit0) { - case '0': { - switch (digit1) { - case 'A': - return new SQLFeatureNotSupportedException(message, sqlState, vendorCode); - - case '8': - if (vendorCode == -30082) { - return new SQLInvalidAuthorizationSpecException(message, sqlState, vendorCode); - } else { - // All connection exceptions on IBM i are NonTransient - return new SQLNonTransientConnectionException(message, sqlState, vendorCode); - } - default: - return new SQLException(message, sqlState, vendorCode); - - } - } - case '2': { - switch (digit1) { - case '2': - return new SQLDataException(message, sqlState, vendorCode); - case '3': - return new SQLIntegrityConstraintViolationException(message, sqlState, vendorCode); - case '8': - return new SQLInvalidAuthorizationSpecException(message, sqlState, vendorCode); - - default : - return new SQLException(message, sqlState, vendorCode); - - } - } - case '4': - switch (digit1) { - case '0': - return new SQLTransactionRollbackException(message, sqlState, vendorCode); - case '2': - return new SQLSyntaxErrorException(message, sqlState, vendorCode); - default : - return new SQLException(message, sqlState, vendorCode); - } - case '5': - if ( vendorCode == -952) { - return new SQLTimeoutException(message, sqlState, vendorCode); - } else { - return new SQLException(message, sqlState, vendorCode); - } - case 'I': - if ("IM001".equals(sqlState)) { - return new SQLFeatureNotSupportedException(message, sqlState, vendorCode); - } else { - return new SQLException(message, sqlState, vendorCode); - } - - case 'H' : - if ("HY017".equals(sqlState)) { - return new SQLNonTransientConnectionException(message, sqlState, vendorCode); - } else { - return new SQLException(message, sqlState, vendorCode); - } - - default: - return new SQLException(message, sqlState, vendorCode); - } - - } - endif */ -} - - diff --git a/cvsroot/src/com/ibm/as400/access/JDEscapeClause.java b/cvsroot/src/com/ibm/as400/access/JDEscapeClause.java deleted file mode 100644 index 367243a07..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDEscapeClause.java +++ /dev/null @@ -1,729 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDEscapeClause.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; -import java.util.StringTokenizer; -import java.util.Vector; - - - -/** -

    This class represents an escape clause in a SQL statement. -It is used to translate SQL statements with JDBC escape -syntax to DB2 for IBM i format. -**/ -class JDEscapeClause -{ - // String constants. These will hopefully help performance - // slightly - assuming a similar optimization does not - // already take place. - private static final String CALL_ = "CALL"; - private static final String CALL1_ = "?="; - private static final String CALL2_ = "?=CALL"; - private static final String CALL3_ = "?"; - private static final String DATE_ = "D"; - private static final String ESCAPE_ = "ESCAPE"; - private static final String FN_ = "FN"; - private static final String OJ_ = "OJ"; - private static final String TIME_ = "T"; - private static final String TIMESTAMP_ = "TS"; - - // Scalar function parsing table. - private static JDScalarTable scalarFunctionTable_; - - /** - Static initializer. Initialize the scalar function table - and the supported function lists. - **/ - // @C1M Changed the static initializer to use the new JDScalarTable and provide earliest supported versions - static { - // create a new table - scalarFunctionTable_ = new JDScalarTable(); - - // Numeric functions. - // - // Supported by system: - // V4R5: - // abs,acos,asin,atan,atan2,ceiling,cos,cot,degrees,exp,floor,log10,mod,power,round,sin,sign,sqrt,tan,truncate - // >=V5R1: - // abs,acos,asin,atan,atan2,ceiling,cos,cot,degrees,exp,floor,log10,mod,power,radians,rand,round,sin,sign,sqrt,tan,truncate - // - // Supported by mapping: - // log,pi - // - - scalarFunctionTable_.put("pi", "3%d1415926E00", JDUtilities.vrm510); - scalarFunctionTable_.put("log", "LN(%1)", JDScalarTable.NOT_SUPPORTED); - - // String functions. - // - // Supported by system: - // V4R5: - // concat,left,locate,ltrim,rtrim,substring,ucase - // V5R1: - // concat,difference,left,locate,ltrim,rtrim,soundex,space,substring,ucase - // >=V5R2: - // concat,difference,insert,lcase,left,locate,ltrim,repeat,replace,right,rtrim,soundex,space,substring,ucase - // - // Supported by mapping: - // <=V5R2: - // insert,length,right - // V5R3: - // length - // - // Not supported: - // ascii,char - // - scalarFunctionTable_.put("insert", "SUBSTR(%1, 1, %2 - 1) || %4 || SUBSTR(%1, %2 + %3)", JDUtilities.vrm530); - scalarFunctionTable_.put("right", "SUBSTR(%1, LENGTH(%1) - %2 + 1)", JDUtilities.vrm530); - scalarFunctionTable_.put("length", "LENGTH(STRIP(%1,T))", JDScalarTable.NOT_SUPPORTED); - - // System functions. - // - // Supported by system: - // ifnull,user - // - // Supported by mapping: - // database - // - scalarFunctionTable_.put("database", "CURRENT SERVER", JDUtilities.vrm530); - // we map the below function because if it is simply passed through it will end up USER() - // instead of USER - scalarFunctionTable_.put("user", "USER", JDScalarTable.NOT_SUPPORTED); - - // Time and date functions. - // - // Supported by system: - // curdate,curtime,dayname,dayofmonth,dayofweek,dayofyear,hour,minute,month,monthname,now,quarter,second,timestampdiff,week,year - // - // Not supported: - // timestampadd - // - } - - - -/** -Parses an escape clause, and substitute it with native SQL. -This will recursively parse all nested escape clauses. - -@param escapeSyntax SQL escape syntax. -@param decimalSeparator The decimal separator. -@return The parsed string. - -@exception SQLException If there is a syntax error or - a reference to an unsupported - scalar function. -**/ - static String parse (String escapeSyntax, - String decimalSeparator, - int vrm) // @C1M accept vrm - throws SQLException - { - // Tokenize the string and pass it to the other - // parse method (which may end up being called - // recursively. - // @C4D StringTokenizer tokenizer = new StringTokenizer (escapeSyntax, - // @C4D "{}'\"", true); - JDSQLTokenizer tokenizer = new JDSQLTokenizer(escapeSyntax, "{}'\""); // @C4A - return parse (tokenizer, decimalSeparator, true, vrm); // @C1M pass vrm - } - - - -/** -Parses an escape clause, and substitute it with native SQL. -This will recursively parse all nested escape clauses. - -

    When the flag is true, the tokenized string is considered -to be the entire SQL statement and will end at the end of -the string. - -

    When the flag is false, the tokenized string is considered -to be just a single escape clause, starting 1 token after -its left brace. It will end at the matching right brace. - -@param tokenizer The tokenized string. -@param decimalSeparator The decimal separator. -@param flag The flag. - -@exception SQLException If there is a syntax error or - a reference to an unsupported - scalar function. -**/ - // @C4D private static String parse (StringTokenizer tokenizer, - private static String parse (JDSQLTokenizer tokenizer, - String decimalSeparator, - boolean flag, int vrm) // @C1M accept vrm - throws SQLException - { - // Initialize. - StringBuffer buffer = new StringBuffer (); - boolean quotes = false; - char quoteType = ' '; - - // Iterate through the tokens... - while (tokenizer.hasMoreTokens ()) { - String token = tokenizer.nextToken(); - // If the token is a left brace (and we are not in - // quotes), then recursively parse the escape clause. - if (token.equals ("{")) { - if (quotes) - buffer.append (token); - else - buffer.append (parse (tokenizer, decimalSeparator, false, vrm)); // @C1M pass vrm - } - - // If the token is a right brace (and we are not in - // quotes), then this is the end of a clause. - // - // If we are parsing the whole string, then this does - // not have a matching left brace. - // - else if (token.equals ("}")) { - if (quotes) - buffer.append (token); - else if (flag) - JDError.throwSQLException (JDError.EXC_SYNTAX_ERROR); - else - return convert (buffer.toString (), decimalSeparator, vrm); // @C1M pass vrm - } - - // If the token is a quote, then toggle the quote - // information. - else if ((token.equals ("'")) || (token.equals ("\""))) { - if (quotes) { - if (quoteType == token.charAt (0)) - quotes = false; - } - else { - quotes = true; - quoteType = token.charAt (0); - } - buffer.append(token); - } - - // Anything else, just add it to the buffer. - else - buffer.append(token); - } - - // If we have gotten this far and we are just parsing - // a clause, then there is no closing right brace. - if (! flag) - JDError.throwSQLException (JDError.EXC_SYNTAX_ERROR); - - return buffer.toString (); - } - - -/** -Convert the escape syntax to native SQL. - -@param escapeSyntax The escape syntax to convert. - It is assumed that all leading - and trailing blanks are - already trimmed. -@param decimalSeparator The decimal separator. -@return Native SQL. - -@exception SQLException If there is a syntax error or - a reference to an unsupported - scalar function. -**/ - private static String convert (String escapeSyntax, - String decimalSeparator, int vrm) // @C1M accept vrm - throws SQLException - { - StringBuffer buffer = new StringBuffer (); - - // Parse out the keyword and the value. The value - // is just the rest of the escape syntax. - String trimmed = escapeSyntax.trim (); - int i = trimmed.indexOf (' '); - String keyword = null; - String value = null; - if (i == -1) { - keyword = trimmed; // @C3M - value = ""; - } - else { - keyword = trimmed.substring (0, i); // @C3M - value = trimmed.substring (i+1); - } - - // Handle stored procedures. - if ((keyword.equalsIgnoreCase (CALL_)) // @C3M - || (keyword.equalsIgnoreCase (CALL1_)) // @C3M - || (keyword.equalsIgnoreCase (CALL2_)) // @C3M - || (keyword.equalsIgnoreCase (CALL3_))) { // @C3M - buffer.append (keyword); - buffer.append (' '); - buffer.append (value); - } - - // Handle date literal. - // - // This works because the JDBC escape syntax is the same - // as ISO format, which works no matter what the server - // job has for its date format and separator. - // - else if (keyword.equalsIgnoreCase (DATE_)) - buffer.append (value); - - // Handle time literal. - // - // This works because the JDBC escape syntax is the same - // as ISO format, which works no matter what the server - // job has for its date format and separator. - // - else if (keyword.equalsIgnoreCase (TIME_)) - buffer.append (value); - - // Handle timestamp literal. - else if (keyword.equalsIgnoreCase (TIMESTAMP_)) { - StringTokenizer tokenizer = new StringTokenizer (value); - if (tokenizer.countTokens() != 2) - JDError.throwSQLException (JDError.EXC_SYNTAX_ERROR); - buffer.append (tokenizer.nextToken()); - buffer.append ('-'); - buffer.append (tokenizer.nextToken().replace(':', '.')); - /* @B1D - This will never happen, since we already counted tokens. - while (tokenizer.hasMoreTokens ()) { - buffer.append (' '); - buffer.append (tokenizer.nextToken()); - } */ - } - - // Handle scalar functions. - else if (keyword.equalsIgnoreCase (FN_)) - buffer.append (convertScalarFunctionCall (value, decimalSeparator, vrm)); // @C1M pass vrm - - // Handle LIKE escape characters. - else if (keyword.equalsIgnoreCase (ESCAPE_)) { - if (value.trim ().length () == 0) - JDError.throwSQLException (JDError.EXC_SYNTAX_ERROR); - buffer.append (keyword); - buffer.append (' '); - buffer.append (value); - } - - // Handle outer joins. - else if (keyword.equalsIgnoreCase (OJ_)) { - buffer.append (value); - } - - // If none of the keywords matched any that we recognize, - // then call it a syntax error. - if (buffer.length() == 0) - JDError.throwSQLException (JDError.EXC_SYNTAX_ERROR); - - return buffer.toString(); - } - - - -/** -Convert a scalar function call to native SQL. - -@param functionCall Function call. -@param decimalSeparator The decimal separator. -@return Native SQL. - -@exception SQLException If there is a syntax error or - a reference to an unsupported - scalar function. -**/ - // @C1M changed parsing to support nested scalars and changed function mapping - private static String convertScalarFunctionCall (String functionCall, String decimalSeparator, int vrm) - throws SQLException { - // Parse the function call into its pieces. - int i = functionCall.indexOf('('); - // find the last index of the closing parenthesis to make // @C0A - // sure we get the whole function call including nested calls // @C0A - int j = functionCall.lastIndexOf(')'); // @C0M - - String functionName = null; - String argumentString = null; - - // get the function name and arg string - //if ((i == -1) && (j == -1)) { // @C2D - // functionName = functionCall.trim().toLowerCase(); // @C2D - // argumentString = ""; // @C2D - //} else if ((i < j) && (i != -1) && (j != -1)) { // @C2D - if ((i < j) && (i != -1) && (j != -1)) { // @C2A - functionName = functionCall.substring (0, i).trim().toLowerCase(); - argumentString = functionCall.substring (i+1, j).trim(); - } else - JDError.throwSQLException (JDError.EXC_SYNTAX_ERROR); - - // get the mapped function or just pass it through - if (!scalarFunctionTable_.contains(functionName, vrm)){ // @C1A - // we dont map this function so just pass it through // @C1A - return functionCall; // @C1A - } else { // @C1A - // Check for text after the right parenthesis. // @C1A - if (j != -1 && j+1 < functionCall.length() && functionCall.substring(j+1).trim().length() > 0) // @C1A - JDError.throwSQLException (JDError.EXC_SYNTAX_ERROR); // @C1A - // @C1A - // Parse the argument string into arguments. // @C1A - Vector arguments = new Vector(); // @C1A - if (argumentString.length() > 0) { // @C1A - StringTokenizer atok = new StringTokenizer(argumentString, "(),", true); // @C1A - StringBuffer tokbuf = new StringBuffer(); // @C1A - int nestlevel = 0; // @C1A - while (atok.hasMoreTokens()) { // @C1A - String token = atok.nextToken(); // @C1A - // check if the argument has parenthesis, meaning it could be a nested fcn // @C1A - if (token.equals("(")) { // @C1A - ++nestlevel; // @C1A - tokbuf.append("("); // @C1A - } else if (token.equals(")")) { // @C1A - // find a closing paren and decrement the nest count // @C1A - --nestlevel; // @C1A - tokbuf.append(")"); // @C1A - // if we have no more tokens after this one we add the argument to the list // @C1A - if (!atok.hasMoreTokens()) { // @C1A - arguments.add(tokbuf.toString()); // @C1A - } // @C1A - } else if (token.equals(",")) { // @C1A - // find a comma // @C1A - if (nestlevel == 0) { // @C1A - // if the nest count is zero we add the argument to the list because it is actually a delimeter - arguments.add(tokbuf.toString()); // @C1A - tokbuf = new StringBuffer(); // @C1A - } else { // @C1A - // if the nest count is not zero the comma is not a delimeter so just append to the buffer - tokbuf.append(","); // @C1A - } // @C1A - } else { // @C1A - // token is a special case so just add it to the buffer // @C1A - tokbuf.append(token); // @C1A - // there are no more tokens left so add the argument to the list // @C1A - if (!atok.hasMoreTokens()) { // @C1A - arguments.add(tokbuf.toString()); // @C1A - } // @C1A - } // @C1A - } // @C1A - } // @C1A - // @C1A - // Get the native SQL from the scalar function table. // @C1A - StringBuffer buffer = new StringBuffer (); - String nativeSQL = scalarFunctionTable_.get(functionName, vrm).toString(); // @C1M - - // Handle the substitution variables. - int marker = 0; - int nextPercent = 0; - int highestArgumentNumber = 0; - while (true) { - - // Find the next % and substitution code (the digit - // after the %. - nextPercent = nativeSQL.indexOf ('%', marker); - if ((nextPercent == -1) || (nextPercent == nativeSQL.length() - 1)) { - buffer.append (nativeSQL.substring (marker)); - break; - } - buffer.append (nativeSQL.substring (marker, nextPercent)); - char substitutionCode = nativeSQL.charAt (nextPercent + 1); - - // If an invalid substitution code, then it is a - // syntax error. Otherwise, do the substitution. - if (Character.isDigit (substitutionCode)) { - int argumentNumber = Character.digit (substitutionCode, 10); - if (argumentNumber > arguments.size()) - JDError.throwSQLException (JDError.EXC_SYNTAX_ERROR); - if (argumentNumber > highestArgumentNumber) - highestArgumentNumber = argumentNumber; - buffer.append (arguments.elementAt(argumentNumber-1)); - } - else if (substitutionCode == 'd') { - buffer.append (decimalSeparator); - } - - // Increment the marker past the substitution code. - marker = nextPercent + 2; - } - - // Check that the number of arguments is what we expected. - if (highestArgumentNumber != arguments.size()) - JDError.throwSQLException (JDError.EXC_SYNTAX_ERROR); - - return buffer.toString(); - } - } - - - -/** -Get a list of supported math functions. - -@param vrm The version of the host OS. -@return A list of function names, separated by commas. -**/ - static String getNumericFunctions(int vrm) { - // @C1A the below if/else block was added to report the correct functions through DatabaseMetaData - if (vrm < JDUtilities.vrm510) { - // we are running to a V4R5 or older host - return "abs,acos,asin,atan,atan2,ceiling,cos,cot,degrees,exp,floor,log,log10,mod,pi,power,round,sin,sign,sqrt,tan,truncate"; - } else { - // we are running to a V5R1 or newer host - return "abs,acos,asin,atan,atan2,ceiling,cos,cot,degrees,exp,floor,log,log10,mod,pi,power,radians,rand,round,sin,sign,sqrt,tan,truncate"; - } - } - - -/** -Get a list of supported string functions. - -@param vrm The version of the host OS. -@return A list of function names, separated by commas. -**/ - static String getStringFunctions(int vrm) { - // @C1A the below if/else block was added to report the correct functions through DatabaseMetaData - if (vrm < JDUtilities.vrm510) { - // we are running to a V4R5M0 or older host - return "concat,insert,left,length,locate,ltrim,right,rtrim,substring,ucase"; - } else if (vrm < JDUtilities.vrm520) { - // we are running to a V5R1 host - return "concat,difference,insert,left,length,locate,ltrim,right,rtrim,soundex,space,substring,ucase"; - } else if (vrm < JDUtilities.vrm530) { - // we are running to a V5R2 host - return "char,concat,difference,insert,lcase,left,length,locate,ltrim,right,rtrim,soundex,space,substring,ucase"; - } else { - // we are running to a V5R3 or newer host - return "char,concat,difference,insert,lcase,left,length,locate,ltrim,repeat,replace,right,rtrim,soundex,space,substring,ucase"; - } - } - - -/** -Get a list of supported system functions. - -@param vrm The version of the host OS. -@return A list of function names, separated by commas. -**/ - static String getSystemFunctions(int vrm) { - return "database,ifnull,user"; // @C1A added to report the correct functions through DatabaseMetaData - } - - -/** -Get a list of supported time and date functions. - -@param vrm The version of the host OS. -@return A list of function names, separated by commas. -**/ - static String getTimeDateFunctions(int vrm) { - // @C1A the below if/else block was added to report the correct functions through DatabaseMetaData - if (vrm < JDUtilities.vrm510) { - // we are running to a V4R5 or older host - return "curdate,curtime,dayofmonth,dayofweek,dayofyear,hour,minute,month,now,quarter,second,week,year"; - } else if (vrm < JDUtilities.vrm530) { - // we are running to a V5R1 or V5R2 host - return "curdate,curtime,dayofmonth,dayofweek,dayofyear,hour,minute,month,now,quarter,second,timestampdiff,week,year"; - } else { - // we are running to a V5R3 or newer host - return "curdate,curtime,dayname,dayofmonth,dayofweek,dayofyear,hour,minute,month,monthname,now,quarter,second,timestampdiff,week,year"; - } - } - - -/** -Add the specified scalar function and native SQL to -the scalar function table and the specified function -list. - -@param functionName Name of scalar function -@param nativeSQL Native SQL to translate function call - into. This string can contain - substitution variables, which are - % followed by a substitution code. - A numeric substitution code (e.g. %1, - %2, %3) marks where argument - will be copied to during translation. - %d marks where the decimal separator - should appear. -@param functionList Function list to which to append - this supported scalar function. -**/ -// @C1D removed this method because it is no longer needed -// private static void initializeScalarFunction (String functionName, String nativeSql, int vrmSupported, StringBuffer functionList) -// { -// // Add to scalar function table. -// scalarFunctionTable_.put (functionName, nativeSql, vrmSupported); -// -// // Add to the function list. -// if (functionList.length() > 0) -// functionList.append (','); -// functionList.append (functionName); -// } - - - - -/** -Is the CONVERT function between SQL types supported? - -@return false -**/ - static boolean supportsConvert () - { - // We do not support this. - return false; - } - - - -/** -Is CONVERT between the given SQL types supported? - -@param fromType SQL type code defined in java.sql.Types. -@param toType SQL type code defined in java.sql.Types. -@return false (We currently do not support CONVERT - at all. -**/ - static boolean supportsConvert (int fromType, int toType) - { - // We do not support this. - return false; - } - - - /** -

    This class is a hashtable-like container for mapping JDBC to - native scalar functions. - **/ - // @C1A Added this inner class to store mappings - private static final class JDScalarTable { - - public static final int NOT_SUPPORTED = 0; - private static final int HASH = 10; - - private String[][] keys = new String[HASH][]; - private String[][] data = new String[HASH][]; - private int[][] vrms = new int[HASH][]; - - /** - Returns true if the function corresponding to key should - be mapped for this VRM of the host. - - @param key The function key - @param vrm The VRM of the host - @return true if we should get the mapped function from the table - **/ - final boolean contains(String key, int vrm) { - if (key == null) throw new NullPointerException("key"); - int hash = (key.hashCode()<0?key.hashCode()*-1:key.hashCode()) % HASH; - String[] keyChain = keys[hash]; - int[] vrmChain = vrms[hash]; - if (keyChain == null) return false; - if (vrmChain == null) return false; - for (int i=0; i vrm || vrmChain[i] == NOT_SUPPORTED)) { - return true; - } - } - return false; - } - - /** - Returns the function corresponding to the key and VRM. - - @param key The function key - @param vrm The VRM of the host - @return null if the key/vrm combination is not mapped - **/ - final String get(String key, int vrm) { - if (key == null) throw new NullPointerException("key"); - int hash = (key.hashCode()<0?key.hashCode()*-1:key.hashCode()) % HASH; - synchronized(keys) { - String[] keyChain = keys[hash]; - int[] vrmChain = vrms[hash]; - if (keyChain == null) return null; - if (vrmChain == null) return null; - for (int i=0; i vrm || vrmChain[i] == NOT_SUPPORTED)) { - return data[hash][i]; - } - } - } - return null; - } - - /** - Sets the JDBC to native function mapping. The VRM indicates the earliest - version of host to support the function. - - @param key The function key - @param value The map for the key - @param vrm The VRM of the host - **/ - final void put(String key, String value, int vrm) { - if (key == null) throw new NullPointerException("key"); - if (vrm < 0) throw new IllegalArgumentException("vrm"); - int hash = (key.hashCode()<0?key.hashCode()*-1:key.hashCode()) % HASH; - synchronized(keys) - { - String[] valueChain = data[hash]; - String[] keyChain = keys[hash]; - int[] vrmChain = vrms[hash]; - if (keyChain == null) { // there are currently no keys in this chain of the hashtable so create a new chain - keyChain = new String[] { key }; // create a new key chain - valueChain = new String[] { value }; // create a new value chain - vrmChain = new int[] { vrm }; // create a new vrm chain - keys[hash] = keyChain; // set the key, value, and vrm - data[hash] = valueChain; - vrms[hash] = vrmChain; - return; - } else { // keys exist in this chain of the hashtable so add this one to the chain - int len = keyChain.length; - for (int i=0; i -//JDBC40DOC * The query submitted by the driver to validate the connection shall be -//JDBC40DOC * executed in the context of the current transaction. -//JDBC40DOC * -//JDBC40DOC * @param timeout - The time in seconds to wait for the database operation -//JDBC40DOC * used to validate the connection to complete. If -//JDBC40DOC * the timeout period expires before the operation -//JDBC40DOC * completes, this method returns false. A value of -//JDBC40DOC * 0 indicates a timeout is not applied to the -//JDBC40DOC * database operation. Note that currently the timeout -//JDBC40DOC * value is not used. -//JDBC40DOC *

    -//JDBC40DOC * @return true if the connection is valid, false otherwise -//JDBC40DOC * @exception SQLException if a database access error occurs. -//JDBC40DOC */ - /* ifdef JDBC40 - public boolean isValid(int timeout) throws SQLException - { - return actualConnection_.isValid(timeout); - } - endif */ - - //@PDA jdbc40 - /** - * Sets the value of the client info property specified by name to the - * value specified by value. - *

    - * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver - * and the maximum length that may be specified for each property. - *

    - * The driver stores the value specified in a suitable location in the - * database. For example in a special register, session parameter, or - * system table column. For efficiency the driver may defer setting the - * value in the database until the next time a statement is executed or - * prepared. Other than storing the client information in the appropriate - * place in the database, these methods shall not alter the behavior of - * the connection in anyway. The values supplied to these methods are - * used for accounting, diagnostics and debugging purposes only. - *

    - * The driver shall generate a warning if the client info name specified - * is not recognized by the driver. - *

    - * If the value specified to this method is greater than the maximum - * length for the property the driver may either truncate the value and - * generate a warning or generate a SQLException. If the driver - * generates a SQLException, the value specified was not set on the - * connection. - *

    - * - * The following client info properties are supported in Toobox for Java. - *

    - *

      - *
    • ApplicationName - The name of the application currently utilizing - * the connection
    • - *
    • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
    • - *
    • ClientHostname - The hostname of the computer the application - * using the connection is running on.
    • - *
    • ClientAccounting - Client accounting information.
    • - *
    • ClientProgramID - The client program identification.
    • - *
    - *

    - * @param name The name of the client info property to set - * @param value The value to set the client info property to. If the - * value is null, the current value of the specified - * property is cleared. - *

    - * @throws SQLException if the database server returns an error while - * setting the client info value on the database server. - *

    - */ - public void setClientInfo(String name, String value) - /* ifdef JDBC40 - throws SQLClientInfoException - endif */ - /* ifndef JDBC40 */ - throws SQLException - /* endif */ - { - ((AS400JDBCConnection)actualConnection_).setClientInfo(name, value); - } - - // @PDA jdbc40 - /** - * Sets the value of the connection's client info properties. The - * Properties object contains the names and values of the - * client info properties to be set. The set of client info properties - * contained in the properties list replaces the current set of client info - * properties on the connection. If a property that is currently set on the - * connection is not present in the properties list, that property is - * cleared. Specifying an empty properties list will clear all of the - * properties on the connection. See - * setClientInfo (String, String) for more information. - *

    - * If an error occurs in setting any of the client info properties, a - * ClientInfoException is thrown. The - * ClientInfoException contains information indicating which - * client info properties were not set. The state of the client information - * is unknown because some databases do not allow multiple client info - * properties to be set atomically. For those databases, one or more - * properties may have been set before the error occurred. - *

    - * - * The following client info properties are supported in Toobox for Java. - *

    - *

      - *
    • ApplicationName - The name of the application currently utilizing - * the connection
    • - *
    • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
    • - *
    • ClientHostname - The hostname of the computer the application - * using the connection is running on.
    • - *
    • ClientAccounting - Client accounting information.
    • - *
    • ClientProgramID - The client program identification.
    • - *
    - *

    - * - * @param properties - * the list of client info properties to set - *

    - * @throws ClientInfoException - * if the database server returns an error while setting the - * clientInfo values on the database server - *

    - * @see java.sql.Connection#setClientInfo(String, String) - * setClientInfo(String, String) - */ - public void setClientInfo(Properties properties) - /* ifdef JDBC40 - throws SQLClientInfoException - endif */ - /* ifndef JDBC40 */ - throws SQLException - /* endif */ - { - ((AS400JDBCConnection)actualConnection_).setClientInfo(properties); - } - - //@PDA jdbc40 - /** - * Returns the value of the client info property specified by name. This - * method may return null if the specified client info property has not - * been set and does not have a default value. This method will also - * return null if the specified client info property name is not supported - * by the driver. - *

    - * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver. - *

    - * - * The following client info properties are supported in Toobox for Java. - *

    - *

      - *
    • ApplicationName - The name of the application currently utilizing - * the connection
    • - *
    • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
    • - *
    • ClientHostname - The hostname of the computer the application - * using the connection is running on.
    • - *
    • ClientAccounting - Client accounting information.
    • - *
    • ClientProgramID - The client program identification.
    • - *
    - *

    - * @param name The name of the client info property to retrieve - *

    - * @return The value of the client info property specified - *

    - * @throws SQLException if the database server returns an error when - * fetching the client info value from the database. - *

    - * @see java.sql.DatabaseMetaData#getClientInfoProperties - */ - public String getClientInfo(String name) throws SQLException - { - return ((AS400JDBCConnection)actualConnection_).getClientInfo(name); - } - - //@PDA jdbc40 - /** - * Returns a list containing the name and current value of each client info - * property supported by the driver. The value of a client info property - * may be null if the property has not been set and does not have a - * default value. - *

    - * - * The following client info properties are supported in Toobox for Java. - *

    - *

      - *
    • ApplicationName - The name of the application currently utilizing - * the connection
    • - *
    • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
    • - *
    • ClientHostname - The hostname of the computer the application - * using the connection is running on.
    • - *
    • ClientAccounting - Client accounting information.
    • - *
    • ClientProgramID - The client program identification.
    • - *
    - *

    - * @return A Properties object that contains the name and current value of - * each of the client info properties supported by the driver. - *

    - * @throws SQLException if the database server returns an error when - * fetching the client info values from the database - */ - public Properties getClientInfo() throws SQLException - { - return ((AS400JDBCConnection)actualConnection_).getClientInfo(); - } - - //@PDA jdbc40 - /** - * Constructs an object that implements the Clob interface. The object - * returned initially contains no data. The setAsciiStream, - * setCharacterStream and setString methods of - * the Clob interface may be used to add data to the Clob. - * @return An object that implements the Clob interface - * @throws SQLException if an object that implements the - * Clob interface can not be constructed. - * - */ - public Clob createClob() throws SQLException - { - return ((AS400JDBCConnection)actualConnection_).createClob(); - } - - //@PDA jdbc40 - /** - * Constructs an object that implements the Blob interface. The object - * returned initially contains no data. The setBinaryStream and - * setBytes methods of the Blob interface may be used to add data to - * the Blob. - * @return An object that implements the Blob interface - * @throws SQLException if an object that implements the - * Blob interface can not be constructed - * - */ - public Blob createBlob() throws SQLException - { - return ((AS400JDBCConnection)actualConnection_).createBlob(); - } - - //@PDA jdbc40 -//JDBC40DOC /** -//JDBC40DOC * Constructs an object that implements the NClob interface. The object -//JDBC40DOC * returned initially contains no data. The setAsciiStream, -//JDBC40DOC * setCharacterStream and setString methods of the NClob interface may -//JDBC40DOC * be used to add data to the NClob. -//JDBC40DOC * @return An object that implements the NClob interface -//JDBC40DOC * @throws SQLException if an object that implements the -//JDBC40DOC * NClob interface can not be constructed. -//JDBC40DOC * -//JDBC40DOC */ - /* ifdef JDBC40 - public NClob createNClob() throws SQLException - { - return actualConnection_.createNClob(); - } - endif */ - //@PDA jdbc40 -//JDBC40DOC /** -//JDBC40DOC * Constructs an object that implements the SQLXML interface. The object -//JDBC40DOC * returned initially contains no data. The createXmlStreamWriter object and -//JDBC40DOC * setString method of the SQLXML interface may be used to add data to the SQLXML -//JDBC40DOC * object. -//JDBC40DOC * @return An object that implements the SQLXML interface -//JDBC40DOC * @throws SQLException if an object that implements the SQLXML interface can not -//JDBC40DOC * be constructed -//JDBC40DOC */ - /* ifdef JDBC40 - public SQLXML createSQLXML() throws SQLException - { - return actualConnection_.createSQLXML(); - } - endif */ - - - //@PDA jdbc40 - /** - * Factory method for creating Array objects. - * - * @param typeName the SQL name of the type the elements of the array map to. The typeName is a - * database-specific name which may be the name of a built-in type, a user-defined type or a standard SQL type supported by this database. This - * is the value returned by Array.getBaseTypeName - * @param elements the elements that populate the returned object - * @return an Array object whose elements map to the specified SQL type - * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - */ - public Array createArrayOf(String typeName, Object[] elements) throws SQLException - { - return ((AS400JDBCConnection)actualConnection_).createArrayOf(typeName, elements); - } - - //@PDA jdbc40 - /** - * Factory method for creating Struct objects. - * - * @param typeName the SQL type name of the SQL structured type that this Struct - * object maps to. The typeName is the name of a user-defined type that - * has been defined for this database. It is the value returned by - * Struct.getSQLTypeName. - * @param attributes the attributes that populate the returned object - * @return a Struct object that maps to the given SQL type and is populated with the given attributes - * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - */ - public Struct createStruct(String typeName, Object[] attributes) throws SQLException - { - return ((AS400JDBCConnection)actualConnection_).createStruct(typeName, attributes); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDHandleNullFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDHandleNullFieldMap.java deleted file mode 100644 index e6b0adabd..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDHandleNullFieldMap.java +++ /dev/null @@ -1,68 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDHandleNullFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - - - -/** -The JDHandleNullFieldMap class returns the value sent from -the system when not null, or a hardcoded value if null. -This will always report the field as non-null then. -**/ -class JDHandleNullFieldMap -extends JDSimpleFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - private Object valueIfNull_; - - - - JDHandleNullFieldMap (int fromIndex, Object valueIfNull) - { - super (fromIndex); - valueIfNull_ = valueIfNull; - } - - public Object getValue (JDRow row) - throws SQLException - { - if (super.isNull (row)) - return valueIfNull_; - else - return super.getValue (row); - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return false; - } - - public boolean isNull (JDRow row) - throws SQLException - { - return false; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDHardcodedFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDHardcodedFieldMap.java deleted file mode 100644 index ca975a63d..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDHardcodedFieldMap.java +++ /dev/null @@ -1,74 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDHardcodedFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - -/** -A class that defines how the client sees the data for a -hardcoded field, i.e., a field that always has a constant -value. -**/ -class JDHardcodedFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - private Object hardcodedValue_; - private boolean hardcodedNull_; - private boolean hardcodedDataMappingError_; - - - - JDHardcodedFieldMap (Object hardcodedValue) - { - hardcodedValue_ = hardcodedValue; - hardcodedNull_ = false; - hardcodedDataMappingError_ = false; - } - - - // Use this to hard code null - JDHardcodedFieldMap (Object hardcodedValue, boolean hardcodedNull, boolean hardcodedDataMappingError) - { - hardcodedValue_ = hardcodedValue; - hardcodedNull_ = hardcodedNull; - hardcodedDataMappingError_ = hardcodedDataMappingError; - } - - public Object getValue (JDRow row) - throws SQLException - { - return hardcodedValue_; - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return hardcodedDataMappingError_; - } - - public boolean isNull (JDRow row) - throws SQLException - { - return hardcodedNull_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDInputStreamProxy.java b/cvsroot/src/com/ibm/as400/access/JDInputStreamProxy.java deleted file mode 100644 index 850f1440a..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDInputStreamProxy.java +++ /dev/null @@ -1,177 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDInputStreamProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - - - -// JDBC 2.0 -/** -

    The JDInputStreamProxy class provides access to binary data -using an input stream. The data is valid only within the current -transaction. -**/ -class JDInputStreamProxy -extends InputStream -implements ProxyFactoryImpl -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Private data. - - private long pxId_; - private ProxyClientConnection connection_; - - - - public int available () - throws IOException - { - try { - return connection_.callMethodReturnsInt (pxId_, "available"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - public void close () - throws IOException - { - try { - connection_.callMethod (pxId_, "close"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - - protected void finalize() throws Throwable - { - connection_.callFinalize (pxId_); - super.finalize(); - } - - - // Implementation of ProxyFactoryImpl interface. - // This method gets called by ProxyClientConnection.callFactoryMethod(). - public void initialize (long proxyId, ProxyClientConnection connection) - { - pxId_ = proxyId; - connection_ = connection; - } - - - public void mark (int readLimit) - { - try { - connection_.callMethod (pxId_, "mark", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (readLimit) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - - public boolean markSupported () - { - try { - return connection_.callMethodReturnsBoolean (pxId_, "markSupported"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - - public int read () - throws IOException - { - try { - return connection_.callMethodReturnsInt (pxId_, "read"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - - public int read (byte[] data) - throws IOException - { - return read (data, 0, data.length); - } - - - private static final boolean[] ARGS_TO_RETURN = new boolean[] {true, false, false}; - - public int read (byte[] data, int start, int length) - throws IOException - { - try { - ProxyReturnValue rv = connection_.callMethod (pxId_, "read", - new Class[] { byte[].class, - Integer.TYPE, - Integer.TYPE }, - new Object[] { data, - new Integer (start), - new Integer (length) }, - ARGS_TO_RETURN, false ); - byte [] returnDataBuffer = (byte[])rv.getArgument(0); - for (int i=0; iThis class represents a system library list for database access. -**/ -class JDLibraryList -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - private static final String LIBL_ = "*LIBL"; - - private char[] indicators_; - private String defaultSchema_; - private String[] list_; - - - -/** -Constructor. - -@param list The list of libraries. -@param defaultSchema The default SQL schema. -@param naming The naming convention. -**/ - JDLibraryList (String list, String defaultSchema, String naming) // @C1C - { - boolean startsWithComma = false; // @E2a - String incomingList = list; - - // Initialize. - defaultSchema_ = null; - if (!"".equals(defaultSchema) || defaultSchema != null) - { - if(defaultSchema.length() > 0) - { - if (defaultSchema.startsWith("\"")) //@delim3 - defaultSchema_ = defaultSchema; //@delim3 - else //@delim3 - defaultSchema_ = defaultSchema.toUpperCase (); - } - } - - // @F1: through v4r5 the system automatically added the default SQL schema - // to the front of the library list. In v5r1 they stopped adding it. - // ODBC Customers complained their apps no longer worked so ODBC changed - // to add the default SQL schema to the library list. We will do the same - // here because we will eventually have broken customers as well. The - // rules are add the default SQL schema to the front of the library list - // (1) for both SQL and system naming, (2) if it isn't already in the - // list, (3) only if a default is specified (don't add the userid if SQL - // naming). Note we won't break the comma started list (@E2) since - // that applies only if no default SQL schema is specified. If no default - // is specified we don't change the list given to us by the user. - if (defaultSchema_ != null) //@F1a - { //@F1a - if ((list != null) && (list.length() > 0)) //@F1a - { //@F1a - // assume the deafult schema is not in the list //@F1a - boolean alreadyInList = false; //@F1a - //@F1a - // does something in the list start with the default SQL schema? //@F1a - if (list.toUpperCase().indexOf(defaultSchema_) >= 0) //@F1a - { //@F1a - // Since something close is already in the list //@F1a - // look at each token for an exact match. The //@F1a - // .indexOf() check will return a false positive if //@F1a - // the default SQL schema is DAW and a library in the //@F1a - // list is DAWJDBC. We do this extra processing //@F1a - // only if there is a close match for performance //@F1a - StringTokenizer tokenizer = new StringTokenizer (list, " ,:;"); //@F1a - while (tokenizer.hasMoreTokens ()) //@F1a - { //@F1a - if (tokenizer.nextToken().toUpperCase().equals(defaultSchema_)) //@F1a - alreadyInList = true; //@F1a - } //@F1a - } //@F1a - if (! alreadyInList) //@F1a - list = defaultSchema_ + "," + list; //@F1a - } //@F1a - else //@F1a - list = defaultSchema_; //@F1a - } //@F1a - - list_ = null; - int liblPosition = -1; - - // If a list is specified, then construct the - // internal list array. - if (list.length() != 0) - { - - // OpNav asked that there be a way to specify a library list without - // getting a default SQL schema. We agreed that if the library list starts - // with a comma we would not set a default SQL schema. We do this - // only if no schema is in the url. A schema on the url - // will be sent as the default SQL schema no matter what is listed - // in the library list. - if (defaultSchema_ == null) // @E2a - { // @E2a - String newList = list.trim(); // @E2a - if (newList.length() > 0) // @E2a - { // @E2a - if (newList.startsWith(",")) // @E2a - startsWithComma = true; // @E2a - } // @E2a - } - - // Determine if the *LIBL token is included. - boolean includesLibl = (list.toUpperCase().indexOf (LIBL_) != -1); - - // Parse the list into tokens. - StringTokenizer tokenizer = new StringTokenizer (list, " ,:;", true); //@delim2 - String token; - int count = tokenizer.countTokens (); - if (includesLibl) - --count; - indicators_ = new char[count]; - list_ = new String[count]; - int i = 0; - while (tokenizer.hasMoreTokens ()) - { - token = tokenizer.nextToken(); //.toUpperCase(); //@delim2 - - if((token.compareTo(" ") == 0) || (token.compareTo(",") == 0) || (token.compareTo(":") == 0) || (token.compareTo(";") == 0)) //@delim2 - continue; //@delim2 - - if(token.startsWith("\"")) //@delim2 - { //@delim2 - - //check if ending quote is in current token - int nextQuote = token.indexOf("\"", 1); //@delim2 - - //get next token and search for ending quote - while(tokenizer.hasMoreTokens() && (nextQuote == -1)) //@delim2 - { //@delim2 - token += tokenizer.nextToken(); //@delim2 - nextQuote = token.indexOf("\"", 1); //@delim2 - } //@delim2 - } //@delim2 - else //@delim2 - { //@delim2 - token = token.toUpperCase(); //@delim2 - } //@delim2 - - - // Mark the position of *LIBL. Only mark - // the first occurence. The system will - // return an error later if it occurs - // more than once. - if (token.equalsIgnoreCase (LIBL_)) - { - if (liblPosition == -1) - liblPosition = i; - } - else - { - if (includesLibl) //IF *LIBL was in the libraries connection property - indicators_[i] = (liblPosition == -1) ? 'F' : 'L'; - else if(incomingList.equals("") && defaultSchema != null && !defaultSchema.equals("")) //if libraries connection property was not specified and a default collection was put on the URL //@K1A - indicators_[i] = (i == 0) ? 'F' : 'L'; //@K1A - else - indicators_[i] = (i == 0) ? 'C' : 'L'; - list_[i] = token; - ++i; - } - } - - if(i != count) //@delim2 - { //@delim2 - String[] tmpList = list_; //@delim2 - list_ = new String[i]; //@delim2 - System.arraycopy(tmpList, 0, list_, 0, i); //@delim2 - } //@delim2 - - // If no default SQL schema was specified, then - // derive it from the list. - // @E1 do this only for SQL naming! If we tell the system to use a default SQL schema - // then the library list is ignored. That would break some apps using system naming. - // For example, suppose the libraries property is "libraries=lib1,lib2,lib3", and the - // file is in lib3. If we take the first one off the list and set it to be the default - // (remember the others will be ignored when a default is set) the apps that - // used to find a file in lib3 no longer work. The behavior as now coded - // consistent through v5r1. In v5r2 we changed to make the first - // item the default. The user can override this behavior by starting the - // list with a comma. - if ((defaultSchema_ == null) - && (! startsWithComma) // @E2a don't set default SQL schema if first char is a comma - && (naming.equals (JDProperties.NAMING_SQL))) // @E1c @C1C - { - //@KBA Fix for JTOpen Bug 4025 - *LIBL is not added to the list_ array. Therefore, the first thing in the - // list_ array should become the default SQL schema, provided that there was a libraries list. - //@KBD if (liblPosition != 0) - //@KBD defaultSchema_ = list_[0]; - //@KBD else if (list_.length > 1) - //@KBD defaultSchema_ = list_[1]; - if(list_.length > 0) //@KBA - defaultSchema_ = list_[0]; //@KBA - } - - //if default SQL schema is longer than 10, then it cannot be in the library list - //users must use SET PATH - if((list_.length > 0 ) && (list_[0].length() > 10) && (list_[0].equals(defaultSchema_)))//@128sch - { //@128sch - String[] tmpList = list_; //@128sch - list_ = new String[tmpList.length-1]; //@128sch - if(list_.length > 0) - System.arraycopy(tmpList, 1, list_, 0, list_.length); //@128sch - - if (JDTrace.isTraceOn()) //@128sch - JDTrace.logInformation (this, "Schema " + defaultSchema_ + " is too long to be in library list by Toolbox (Hostserver will add it), but will still be set as default SQL schema"); //@128sch - }//@128sch - - // Reverse the order of the 'F' libraries, so that - // they get added to the library in the right order. - if (liblPosition > 1) - { - int halfPoint = ((int) (liblPosition / 2)) - 1; - String temp; - for (int j = 0; j <= halfPoint ; ++j) - { - int j2 = liblPosition - j - 1; - temp = list_[j]; - list_[j] = list_[j2]; - list_[j2] = temp; - } - - } - } - - // Otherwise, no list was specified. - else - { - list_ = new String[0]; - } - - } - - - -/** -Add the libraries in this list to the server job's library -list for the specified connection. If the caller specified -*LIBL in the list, then add libraries listed before -*LIBL to the front of the server job's library list. -Likewise, add any libraries listed after *LIBL to the -back of the server job's library list. If *LIBL is not -specified in the list, then all libraries are replaced -in the server job's library list. - -@param connection Connection to the system. -@param id The id. - -@exception SQLException If an error occurs. -**/ - void addOnServer (AS400JDBCConnection connection, int id) - throws SQLException - { - if (list_.length > 0) - { - - DBNativeDatabaseRequestDS request = null; //@P0A - DBReplyRequestedDS reply = null; //@P0A - try - { - request = DBDSPool.getDBNativeDatabaseRequestDS(DBNativeDatabaseRequestDS.FUNCTIONID_ADD_LIBRARY_LIST, id, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); //@P0C - request.setListOfLibraries (indicators_, list_, connection.converter_); //@P0C - - reply = connection.sendAndReceive (request); //@P0C - - int errorClass = reply.getErrorClass(); - int returnCode = reply.getReturnCode(); - - if (errorClass != 0) // @D1C - { - if ((errorClass == 5) && (returnCode == 1301)) // @D1A - { - // if the error class is NDB and ret code is library not added @D1A - // continue because library being added is already in *LIBL @D1A - // or library does not exist and either case is OK to continue @D1A - connection.postWarning(JDError.getSQLWarning(connection, id, errorClass, returnCode)); // @D1A - } // @D1A - else - { - JDError.throwSQLException (connection, id, errorClass, returnCode); - } // @D1A - } // @D1A - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - finally //@P0A - { - if (request != null) { request.returnToPool(); request = null; } //@P0A - if (reply != null) { reply.returnToPool(); reply = null; } //@P0A // Only getErrorCode used - } - } - } - - - -/** -Get the default SQL schema. - -@return The default SQL schema, or null if none specified. -**/ - String getDefaultSchema () - { - return defaultSchema_; - } - - /** - * Returns the string representation of the object. - * @return The string representation. - **/ - public String toString() - { - /* - * Implementation note: Used only for tracing information. - */ - - return ""; - } -} - - diff --git a/cvsroot/src/com/ibm/as400/access/JDLobLocator.java b/cvsroot/src/com/ibm/as400/access/JDLobLocator.java deleted file mode 100644 index 69cd8097a..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDLobLocator.java +++ /dev/null @@ -1,419 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDLobLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - - - -/** - * The JDLobLocator class provides access to large objects via a locator. -**/ -// -// Implementation note: -// -// LOBs were 15MB max until an OS/400 V5R2 PTF, when they became -// 2GB max. This is OK, since the size can still be stored in a Java int -// without worrying about the sign. -// -// Note: A "LOB-character" refers to a one-byte value in the case of a BLOB or CLOB, -// and a two-byte value in the case of a DBCLOB. -// -class JDLobLocator -{ - private AS400JDBCConnection connection_; - private boolean dataCompression_; - private int id_; - private int handle_ = -1; - private long length_ = -1; // The current length in LOB-characters. - private int maxLength_; // The max length in LOB-characters. - private int columnIndex_ = -1; - private boolean graphic_; - DBReplyRequestedDS retrieveDataReply = null; - - - /** - * Constructs an JDLobLocator object. - * @param connection The connection to the system. - * @param id The correlation ID used for any subsequent LOB datastreams (@CRS - why is this here?). - * @param maxLength The max length in bytes on the system. - **/ - JDLobLocator(AS400JDBCConnection connection, int id, int maxLength, boolean graphic) - { - connection_ = connection; - id_ = id; - maxLength_ = maxLength; - dataCompression_ = connection_.getDataCompression() == AS400JDBCConnection.DATA_COMPRESSION_OLD_; - graphic_ = graphic; - } - - - // This is used by the SQLLocator classes to clone the locator so that the internal - // copy of the locator (that gets reused) does not get handed to the user. If that - // were to happen, the next time a statement went to update the locator object with - // a new handle id, the user's locator would all of a sudden be pointing to the - // wrong data on the system. - JDLobLocator(JDLobLocator loc) - { - connection_ = loc.connection_; - id_ = loc.id_; - maxLength_ = loc.maxLength_; - dataCompression_ = loc.dataCompression_; - graphic_ = loc.graphic_; - handle_ = loc.handle_; - length_ = loc.length_; - columnIndex_ = loc.columnIndex_; - } - - - /** - * Returns the locator handle. - * @return The locator handle, or -1 if not set. - **/ - int getHandle() - { - return handle_; - } - - - /** - * Returns the length of this LOB in LOB-characters (the length returned from the system). - * For BLOBs and CLOBs (single/mixed) this is the same as the number of bytes. - * For DBCLOBs, this is half the number of bytes. - **/ - synchronized long getLength() throws SQLException - { - if (length_ < 0) // Re-retrieve it. - { - try - { - DBSQLRequestDS request = null; - DBReplyRequestedDS getLengthReply = null; - try - { - request = DBDSPool.getDBSQLRequestDS(DBSQLRequestDS.FUNCTIONID_RETRIEVE_LOB_DATA, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - request.setLOBLocatorHandle(handle_); - request.setRequestedSize(0); - request.setStartOffset(0); - request.setCompressionIndicator(dataCompression_ ? 0xF1 : 0xF0); - request.setReturnCurrentLengthIndicator(0xF1); - if (columnIndex_ != -1) - { - request.setColumnIndex(columnIndex_); - } - getLengthReply = connection_.sendAndReceive(request, id_); //@CRS: Why are we reusing the correlation ID here? - int errorClass = getLengthReply.getErrorClass(); - int returnCode = getLengthReply.getReturnCode(); - - if (errorClass != 0) - JDError.throwSQLException(this, connection_, id_, errorClass, returnCode); - - length_ = getLengthReply.getCurrentLOBLength(); - } - finally - { - if (request != null) { request.returnToPool(); request =null; } - if (getLengthReply != null) { getLengthReply.returnToPool(); getLengthReply=null; } // Note: No portion of this reply is cached, so it can be returned to the pool - - } - } - catch (DBDataStreamException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - } - } - return length_; - } - - - /** - * Returns the max size of this locator column in LOB-characters. - **/ - int getMaxLength() - { - return maxLength_; - } - - -/** -Retrieves part of the contents of the lob. - -@param offset The offset within the LOB, in LOB-characters. -@param length The number of LOB-characters to read from the LOB. -@return The contents. - -@exception SQLException If the position is not valid, - if the length is not valid, - or an error occurs. -**/ - synchronized DBLobData retrieveData(long offset, int length) throws SQLException - { - if (offset < 0 || length < 0) JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - if (offset >= getMaxLength()) JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - // The DB host server currently only supports 4-byte integers for length and offset on the request. - if (offset > 0x7FFFFFFF) offset = 0x7FFFFFFF; - - try - { - DBSQLRequestDS request = null; - try - { - request = DBDSPool.getDBSQLRequestDS(DBSQLRequestDS.FUNCTIONID_RETRIEVE_LOB_DATA, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - request.setLOBLocatorHandle(handle_); - request.setRequestedSize(length); - request.setStartOffset((int)offset); // Some day the IBM i will support 8-byte offsets. - request.setCompressionIndicator(dataCompression_ ? 0xF1 : 0xF0); - request.setReturnCurrentLengthIndicator(0xF1); - // If a column index has not been set for this locator, then do not pass - // the optional column index parameter to the system. - if (columnIndex_ != -1) - { - request.setColumnIndex(columnIndex_); - } - - if (JDTrace.isTraceOn()) - { - JDTrace.logInformation(connection_, "Retrieving lob data from handle: " + handle_ + - " bytesToRead: " + length + " startingOffset: " + offset + - " dataCompression: " + dataCompression_ + " columnIndex: " + columnIndex_); - } - - if (retrieveDataReply != null) { retrieveDataReply.returnToPool(); retrieveDataReply=null; } - retrieveDataReply = connection_.sendAndReceive(request, id_); - int errorClass = retrieveDataReply.getErrorClass(); - int returnCode = retrieveDataReply.getReturnCode(); - - if (errorClass != 0) JDError.throwSQLException(this, connection_, id_, errorClass, returnCode); - - length_ = retrieveDataReply.getCurrentLOBLength(); - - DBLobData lobData = retrieveDataReply.getLOBData(); - - if (graphic_) - { - lobData.adjustForGraphic(); - } - - return lobData; - } - finally - { - if (request != null) { request.returnToPool(); request =null; } - // Cannot return this to the pool because the data_ array is now part of lobData - // if (retrieveDataReply != null) { retrieveDataReply.returnToPool(); retrieveDataReply = null; } - } - } - catch (DBDataStreamException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - -/** -Sets the column index. - -@param handle The column index. -**/ - void setColumnIndex(int columnIndex) - { - columnIndex_ = columnIndex; - } - - - -/** -Sets the locator handle. - -@param handle The locator handle. -**/ - synchronized void setHandle(int handle) - { - handle_ = handle; - length_ = -1; - } - - - int writeData(long offset, byte data, boolean truncate) throws SQLException //@K1C - { - return writeData(offset, new byte[] { data}, 0, 1, truncate); //@K1C - } - - - int writeData(long offset, byte[] data, boolean truncate) throws SQLException //@K1C - { - return writeData(offset, data, 0, data.length, truncate); //@k1C - } - - -/** -Writes part of the contents of the lob. - -@param lobOffset The offset (in LOB-characters) within the lob. -@param data The data to write. -@param offset The offset into the byte array from which to copy data. -@param length The number of bytes out of the byte array to write. - -@exception SQLException If the position is not valid, - if the length is not valid, - or an error occurs. -**/ - synchronized int writeData(long lobOffset, byte[] data, int offset, int length, boolean truncate) throws SQLException //@K1C - { - if (data == null) throw new NullPointerException("data"); - - if ((lobOffset < 0) || (length < 0)) JDError.throwSQLException(this, JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - // The DB host server currently only supports 4-byte integers for the offset on the request. - // Note that we can keep the length as a 4-byte integer because Java does not support - // using a long as a byte[] index, so the most data we could ever send at a time would - // be 2 GB. - if (lobOffset > 0x7FFFFFFF) lobOffset = 0x7FFFFFFF; - - // If we are a DBCLOB, the data in the byte array is already double-byte data, - // but we need to tell the system that the number of characters we're writing is - // half of that (that is, we need to tell it the number of LOB-characters). - // The lobOffset is still the right offset, in terms of LOB-characters. - int lengthToUse = graphic_ ? length / 2 : length; - - try - { - DBSQLRequestDS request = null; - DBReplyRequestedDS writeDataReply = null; - try - { - request = DBDSPool.getDBSQLRequestDS(DBSQLRequestDS.FUNCTIONID_WRITE_LOB_DATA, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - request.setLobTruncation(truncate); //Do not truncate @K1A - request.setLOBLocatorHandle(handle_); - request.setRequestedSize(lengthToUse); - request.setStartOffset((int)lobOffset); // Some day the IBM i will support 8-byte offsets. - request.setCompressionIndicator(0xF0); // No compression for now. - request.setLOBData(data, offset, length); - if (JDTrace.isTraceOn()) - { - JDTrace.logInformation(connection_, "Writing lob data to handle: " + handle_ + " offset: " + lobOffset + " length: " + length); - } - - writeDataReply = connection_.sendAndReceive(request, id_); - int errorClass = writeDataReply.getErrorClass(); - int returnCode = writeDataReply.getReturnCode(); - - if (errorClass != 0) - { - JDError.throwSQLException(this, connection_, id_, errorClass, returnCode); - } - length_ = -1; //@CRS - We could probably re-calculate it, but for now, we force another call to the system. - return length; - } - finally - { - if (request != null) { request.returnToPool(); request =null; } - // Can be returned immediately - if (writeDataReply != null) { writeDataReply.returnToPool(); writeDataReply= null; } - } - } - catch (DBDataStreamException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - } - return -1; - } - - - boolean isGraphic() - { - return graphic_; - } - - //@xmlgraphic - void setGraphic(boolean isGraphic) - { - graphic_ = isGraphic; - } - - //@pda 550 - /** - * Free up resource for this lob locator on host server. - **/ - synchronized void free() throws SQLException - { - if(connection_.getVRM() < JDUtilities.vrm610 ) //@ns1 - { //@ns1 - JDError.throwSQLException (this, JDError.EXC_FUNCTION_NOT_SUPPORTED); //@ns1 - return; //@ns1 - } //@ns1 - - DBSQLRequestDS request = null; - DBReplyRequestedDS freeReply = null; - try - { - request = DBDSPool.getDBSQLRequestDS(DBSQLRequestDS.FUNCTIONID_FREE_LOB, id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); - request.setLOBLocatorHandle(handle_); - // request.setRequestedSize(0); //@pdd - // request.setStartOffset(0); //@pdd - // request.setCompressionIndicator(dataCompression_ ? 0xF1 : 0xF0); //@pdd - //if (columnIndex_ != -1) //@pdd - // { //@pdd - // request.setColumnIndex(columnIndex_); //@pdd - // } //@pdd - freeReply = connection_.sendAndReceive(request, id_); - int errorClass = freeReply.getErrorClass(); - int returnCode = freeReply.getReturnCode(); - - //7,-401 signals already free - //if (errorClass != 0 && !(errorClass == 7 && returnCode == -401)) - //JDError.throwSQLException(this, connection_, id_, errorClass, returnCode); //@free2 hostnow has various errors if locator is already freed. - - - // In free, if the retrieveDataReply is set, then return it to the pool - if (retrieveDataReply != null) { - retrieveDataReply.returnToPool();retrieveDataReply = null; - } - - - - } catch (DBDataStreamException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - }finally - { - if (request != null) { - request.returnToPool(); request =null; - } - if (freeReply != null) { freeReply.returnToPool(); freeReply = null; } - } - } - - - protected void finalize() throws Throwable { - super.finalize(); - if (retrieveDataReply != null) { - retrieveDataReply.returnToPool();retrieveDataReply = null; - } - - - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDLocalNameFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDLocalNameFieldMap.java deleted file mode 100644 index cc4fc1238..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDLocalNameFieldMap.java +++ /dev/null @@ -1,61 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDLocalNameFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - -class JDLocalNameFieldMap -extends JDTypeInfoFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - private int typeIndex_; //A1A - JDLocalNameFieldMap(int typeIndex, int lengthIndex, int precisionIndex, - int scaleIndex, int ccsidIndex, int vrm, JDProperties properties) // @MOC - added vrm and properties //@KKB - { - super(typeIndex, lengthIndex, precisionIndex, scaleIndex, ccsidIndex, vrm, properties); // @M0C //@KKB - typeIndex_ = typeIndex; //@A1A - } - - /** - Returns the data type in JDBC format. - **/ - public Object getValue(JDRow row) - throws SQLException - { - String typeName = row.getSQLData(typeIndex_).getString().trim(); //@A1A - if(typeName.equals("DISTINCT")) //@A1A We do not have a SQLData class for Distincts - return "DISTINCT"; //@A1A - return((SQLData)super.getValue(row)).getLocalName(); - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return false; - } - - /** - Indicates if the value is null. - **/ - public boolean isNull(JDRow row) - throws SQLException - { - return false; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JDMRI.java b/cvsroot/src/com/ibm/as400/access/JDMRI.java deleted file mode 100644 index 354b65941..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDMRI.java +++ /dev/null @@ -1,264 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDMRI.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.*; - -/** -Locale-specific objects for the IBM Toolbox for Java. -**/ - -public class JDMRI extends ListResourceBundle -{ - // NLS_MESSAGEFORMAT_NONE - // Each string is assumed NOT to be processed by the MessageFormat class. - // This means that a single quote must be coded as 1 single quote. - - // NLS_ENCODING=UTF-8 - // Instructs the translation tools to interpret the text as UTF-8. - - public Object[][] getContents() - { - return resources; - } - - private final static Object[][] resources= { - // #TRANNOTE NOTE TO TRANSLATORS: The format of a line of MRI - // #TRANNOTE is { "KEY", "value" }, - // #TRANNOTE - // #TRANNOTE The key must be left alone so translate only the value. - // #TRANNOTE - - // #TRANNOTE JDBC property names. // @E2 - { "PROP_NAME_ACCESS", "access" }, - { "PROP_NAME_BEHAVIOR_OVERRIDE", "behaviorOverride" }, // @J5A - { "PROP_NAME_BIDI_STRING_TYPE", "bidiStringType" }, //@E6A - { "PROP_NAME_BIG_DECIMAL", "bigDecimal" }, - { "PROP_NAME_BLOCK_CRITERIA", "blockCriteria" }, - { "PROP_NAME_BLOCK_SIZE", "blockSize" }, - { "PROP_NAME_CURSOR_HOLD", "cursorHold"}, - { "PROP_NAME_CURSOR_SENSITIVITY", "cursorSensitivity" }, // @J4A - { "PROP_NAME_DATABASE_NAME", "databaseName" }, - { "PROP_NAME_DATA_COMPRESSION", "dataCompression" }, - { "PROP_NAME_DATASOURCE_NAME", "dataSourceName" }, - { "PROP_NAME_DATA_TRUNCATION", "dataTruncation" }, - { "PROP_NAME_DATE_FORMAT", "dateFormat" }, - { "PROP_NAME_DATE_SEPARATOR", "dateSeparator" }, - { "PROP_NAME_DECIMAL_SEPARATOR", "decimalSeparator" }, - { "PROP_NAME_DESCRIPTION", "description" }, - { "PROP_NAME_DRIVER", "driver" }, // @E4A - { "PROP_NAME_ERRORS", "errors" }, - { "PROP_NAME_EXTENDED_DYNAMIC", "extendedDynamic" }, - { "PROP_NAME_EXTENDED_METADATA", "extendedMetaData" }, // @J2A - { "PROP_NAME_FULL_OPEN", "fullOpen" }, // @W1a - { "PROP_NAME_KEY_RING_NAME", "keyRingName" }, // @E7A - { "PROP_NAME_KEY_RING_PASSWORD", "keyRingPassword" }, // @E7A - { "PROP_NAME_LAZY_CLOSE", "lazyClose" }, // @E3A - { "PROP_NAME_LIBRARIES", "libraries" }, - { "PROP_NAME_LOB_THRESHOLD", "lobThreshold" }, - { "PROP_NAME_NAMING", "naming" }, - { "PROP_NAME_PACKAGE", "package" }, - { "PROP_NAME_PACKAGE_ADD", "packageAdd" }, - { "PROP_NAME_PACKAGE_CACHE", "packageCache" }, - { "PROP_NAME_PACKAGE_CLEAR", "packageClear" }, - { "PROP_NAME_PACKAGE_CRITERIA", "packageCriteria" }, - { "PROP_NAME_PACKAGE_ERROR", "packageError" }, - { "PROP_NAME_PACKAGE_LIBRARY", "packageLibrary" }, - { "PROP_NAME_PASSWORD", "password" }, - { "PROP_NAME_PREFETCH", "prefetch" }, - { "PROP_NAME_PROMPT", "prompt" }, - { "PROP_NAME_PROXY_SERVER", "proxyServer" }, - { "PROP_NAME_REMARKS", "remarks" }, - { "PROP_NAME_SAVE_PASSWORD_WHEN_SERIALIZED", "savePasswordWhenSerialized" }, //@J3a - { "PROP_NAME_SECONDARY_URL", "secondaryUrl" }, - { "PROP_NAME_SECURE", "secure" }, - { "PROP_NAME_SERVER_NAME", "serverName" }, - { "PROP_NAME_SORT", "sort" }, - { "PROP_NAME_SORT_LANGUAGE", "sortLanguage" }, - { "PROP_NAME_SORT_TABLE", "sortTable" }, - { "PROP_NAME_SORT_WEIGHT", "sortWeight" }, - { "PROP_NAME_THREAD_USED", "threadUsed" }, - { "PROP_NAME_TIME_FORMAT", "timeFormat" }, - { "PROP_NAME_TIME_SEPARATOR", "timeSeparator" }, - { "PROP_NAME_TRACE", "trace" }, - { "PROP_NAME_TRACE_SERVER", "serverTrace" }, // @J1a - { "PROP_NAME_TRACE_TOOLBOX", "toolboxTrace" }, // @K1A - { "PROP_NAME_TRANSACTION_ISOLATION", "transactionIsolation" }, - { "PROP_NAME_TRANSLATE_BINARY", "translateBinary" }, - { "PROP_NAME_USER", "user" }, - { "PROP_NAME_KEEP_ALIVE", "keepAlive" }, - { "PROP_NAME_RECEIVE_BUFFER_SIZE", "receiveBufferSize" }, - { "PROP_NAME_SEND_BUFFER_SIZE", "sendBufferSize" }, - { "PROP_NAME_SO_LINGER", "soLinger" }, - { "PROP_NAME_SO_TIMEOUT", "soTimeout" }, - { "PROP_NAME_TCP_NO_DELAY", "tcpNoDelay" }, - { "PROP_NAME_PACKAGE_CCSID", "packageCCSID" }, // @M0A - { "PROP_NAME_MINIMUM_DIVIDE_SCALE", "minimumDivideScale" }, // @M0A - { "PROP_NAME_MAXIMUM_PRECISION", "maximumPrecision" }, // @M0A - { "PROP_NAME_MAXIMUM_SCALE", "maximumScale" }, // @M0A - { "PROP_NAME_TRANSLATE_HEX", "translateHex" }, // @M0A - { "PROP_NAME_QAQQINILIB", "qaqqiniLibrary" }, // @K2A - { "PROP_NAME_LOGIN_TIMEOUT", "loginTimeout" }, // @K4A - { "PROP_NAME_TRUE_AUTO_COMMIT", "trueAutoCommit"}, // @KBA //@true - { "PROP_NAME_HOLD_LOCATORS", "holdInputLocators"}, // @KBL - { "PROP_NAME_BIDI_IMPLICIT_REORDERING", "bidiImplicitReordering"}, //@K24 - { "PROP_NAME_BIDI_NUMERIC_ORDERING", "bidiNumericOrdering"}, //@K24 - { "PROP_NAME_HOLD_STATEMENTS", "holdStatements"}, //@KBL - { "PROP_NAME_ROLLBACK_CURSOR_HOLD", "rollbackCursorHold"}, //@K94 - { "PROP_NAME_VARIABLE_FIELD_COMPRESSION", "variableFieldCompression"}, //@K54 - { "PROP_NAME_QUERY_OPTIMIZE_GOAL", "queryOptimizeGoal"}, //@540 - { "PROP_NAME_XA_LOOSELY_COUPLED_SUPPORT", "xaLooselyCoupledSupport"}, //@540 - { "PROP_NAME_TRANSLATE_BOOLEAN", "translateBoolean"}, //@PDA - { "PROP_NAME_METADATA_SOURCE", "metaDataSource"}, //@PDA - { "PROP_NAME_QUERY_STORAGE_LIMIT", "queryStorageLimit"}, //@550 - { "PROP_NAME_DECFLOAT_ROUNDING_MODE", "decfloatRoundingMode"}, //@DFA //@550 - { "PROP_NAME_AUTOCOMMIT_EXCEPTION", "autocommitException"}, //@CE1 - { "PROP_NAME_AUTO_COMMIT", "autoCommit"}, //@AC1 - { "PROP_NAME_IGNORE_WARNINGS", "ignoreWarnings"}, //@igwrn - { "PROP_NAME_SECURE_CURRENT_USER", "secureCurrentUser"}, //@pw3 - { "PROP_NAME_CONCURRENT_ACCESS_RESOLUTION", "concurrentAccessResolution"}, //@cc1 - { "PROP_NAME_JVM16_SYNCHRONIZE", "jvm16Synchronize"}, //@dmy - { "PROP_NAME_SOCKET_TIMEOUT", "socketTimeout"}, //@STIMEOUT - { "PROP_NAME_MAXIMUM_BLOCKED_INPUT_ROWS", "maximumBlockedInputRows"}, - - // #TRANNOTE JDBC property descriptions. - { "ACCESS_DESC", "Specifies the level of database access for the connection." }, - { "BEHAVIOR_OVERRIDE_DESC", "Specifies the Toolbox JDBC driver behavior to override." }, //@J5A - { "BIDI_STRING_TYPE_DESC", "Specifies the output string type of bidi data."}, //@E6A - { "BIG_DECIMAL_DESC", "Specifies whether an intermediate java.math.BigDecimal object is used for packed and zoned decimal conversions." }, // @E0A - { "BLOCK_CRITERIA_DESC", "Specifies the criteria for retrieving data from the system in blocks of records." }, //@550 - { "BLOCK_SIZE_DESC", "Specifies the block size (in kilobytes) to retrieve from the system and cache on the client." }, //@550 - { "CURSOR_HOLD_DESC", "Specifies whether to hold the cursor across transactions." }, // @E2 - { "CURSOR_SENSITIVITY_DESC", "Specifies the cursor sensitivity to request from the database." }, //@J4A - { "DATABASE_NAME_DESC", "Specifies the name of the database." }, // @E2 - { "DATA_COMPRESSION_DESC", "Specifies whether result set data is compressed." }, // @D2A - { "DATASOURCE_NAME_DESC", "Specifies the name of the data source." }, // @E2 - { "DATA_TRUNCATION_DESC", "Specifies whether data truncation exceptions are thrown." }, // @D1A - { "DATE_FORMAT_DESC", "Specifies the date format used in date literals within SQL statements." }, - { "DATE_SEPARATOR_DESC", "Specifies the date separator used in date literals within SQL statements." }, - { "DECIMAL_SEPARATOR_DESC", "Specifies the decimal separator used in numeric constants within SQL statements." }, - { "DESCRIPTION_DESC", "Specifies the description of the data source." }, // @E2 - { "DRIVER_DESC", "Specifies the JDBC driver implementation." }, // @E4A - { "ERRORS_DESC", "Specifies the amount of detail to be returned in the message for errors that occur on the system." },//@550 - { "EXTENDED_DYNAMIC_DESC", "Specifies whether to use extended dynamic support." }, - { "EXTENDED_METADATA_DESC", "Specifies whether to request extended metadata from the system." }, //@J2A @550 - { "FULL_OPEN_DESC", "Specifies whether to use an optimized query." }, // @W1 - { "KEY_RING_NAME_DESC", "Specifies the key ring class name used for SSL communications with the system." }, //@E7A @550 - { "KEY_RING_PASSWORD_DESC", "Specifies the password for the key ring class used for SSL communications with the system." }, //@E7A @550 - { "LAZY_CLOSE_DESC", "Specifies whether to delay closing cursors until subsequent requests." }, // @E3A - { "LIBRARIES_DESC", "Specifies the libraries to add to the server job's library list." }, - { "LOB_THRESHOLD_DESC", "Specifies the maximum LOB (large object) size (in kilobytes) that can be retrieved as part of a result set." }, - { "NAMING_DESC", "Specifies the naming convention used when referring to tables." }, - { "PACKAGE_DESC", "Specifies the name of the SQL package." }, - { "PACKAGE_ADD_DESC", "Specifies whether to add statements to an existing SQL package." }, - { "PACKAGE_CACHE_DESC", "Specifies whether to cache SQL packages in memory." }, - { "PACKAGE_CLEAR_DESC", "Specifies whether to clear SQL packages when they become full." }, - { "PACKAGE_CRITERIA_DESC", "Specifies the type of SQL statements to be stored in the SQL package" }, - { "PACKAGE_ERROR_DESC", "Specifies the action to take when SQL package errors occur." }, - { "PACKAGE_LIBRARY_DESC", "Specifies the library for the SQL package." }, - { "PASSWORD_DESC", "Specifies the password for connecting to the system." }, //@550 - { "PREFETCH_DESC", "Specifies whether to prefetch data when running a SELECT statement." }, - { "PROMPT_DESC", "Specifies whether the user should be prompted if a user name or password is needed to connect to the system." }, //@550 - { "PROXY_SERVER_DESC", "Specifies the host name and (optionally) port number of the middle-tier machine where the proxy server is running." }, //@A2A - { "REMARKS_DESC", "Specifies the source of the text for REMARKS columns in ResultSet objects returned by DatabaseMetaData methods." }, - { "SAVE_PASSWORD_WHEN_SERIALIZED", "Specifies whether to save the password when the data source object is serialized." }, //@J3a - { "SECONDARY_URL_DESC", "Specifies the URL that the proxy server should use when establishing a JDBC connection." }, //@A2A - { "SECURE_DESC", "Specifies whether a Secure Sockets Layer (SSL) connection is used to communicate with the system." }, //@550 - { "SERVER_NAME_DESC", "Specifies the name of the system."}, // @E2 @550 - { "SORT_DESC", "Specifies how the system sorts records before sending them to the client." }, //@550 - { "SORT_LANGUAGE_DESC", "Specifies a 3-character language ID to use for selection of a sort sequence." }, - { "SORT_TABLE_DESC", "Specifies the library and file name of a sort sequence table stored on the system." }, //@550 - { "SORT_WEIGHT_DESC", "Specifies how the system treats case while sorting records." }, //@550 - { "THREAD_USED_DESC", "Specifies whether to use threads in communication with the host servers." }, //@E1A - { "TIME_FORMAT_DESC", "Specifies the time format used in time literals within SQL statements." }, - { "TIME_SEPARATOR_DESC", "Specifies the time separator used in time literals within SQL statements." }, - { "TRACE_DESC", "Specifies whether trace messages should be logged." }, - { "TRACE_SERVER_DESC", "Specifies whether the job on the system should be traced." }, //@J1a @550 - { "TRACE_TOOLBOX_DESC", "Specifies what category of a toolbox trace to log." }, //@K1A - { "TRANSACTION_ISOLATION_DESC", "Specifies the default transaction isolation." }, - { "TRANSLATE_BINARY_DESC", "Specifies whether binary data is translated." }, - { "USER_DESC", "Specifies the user name for connecting to the system." }, //@550 - { "KEEP_ALIVE_DESC", "Specifies the socket keep alive value to use when connecting to the system." }, //@550 - { "RECEIVE_BUFFER_SIZE_DESC", "Specifies the socket receive buffer size to use when connecting to the system." }, //@550 - { "SEND_BUFFER_SIZE_DESC", "Specifies the socket send buffer size to use when connecting to the system." }, //@550 - { "SO_LINGER_DESC", "Specifies the socket linger value to use when connecting to the system." }, //@550 - { "SO_TIMEOUT_DESC", "Specifies the socket timeout value to use when connecting to the system." }, //@550 - { "TCP_NO_DELAY_DESC", "Specifies the socket TCP no delay value to use when connecting to the system." }, //@550 - { "PACKAGE_CCSID_DESC", "Specifies the character encoding to use for the SQL package and any statements sent to the system." }, // @M0A @550 - { "MINIMUM_DIVIDE_SCALE_DESC", "Specifies the minimum scale value for the result of decimal division." }, // @M0A - { "MAXIMUM_PRECISION_DESC", "Specifies the maximum decimal precision the database should use." }, // @M0A - { "MAXIMUM_SCALE_DESC", "Specifies the maximum scale the database should use." }, // @M0A - { "TRANSLATE_HEX_DESC", "Specifies how hexadecimal constants are interpreted." }, // @M0A - { "QAQQINILIB_DESC", "Specifies a QAQQINI library name." }, //@K2A - { "LOGIN_TIMEOUT_DESC", "Specifies the maximum time in seconds that this data source can wait while attempting to connect to a database." }, //@K4A - { "TRUE_AUTO_COMMIT_DESC", "Specifies whether the connection should use true auto commit support."}, //@KBA //@true - { "HOLD_LOCATORS_DESC", "Specifies if input locators should be of type \"hold\" or \"no hold\"."}, //@KBL - { "BIDI_IMPLICIT_REORDERING_DESC", "Specifies if bidi implicit LTR-RTL reordering should be used."}, //@K24 - { "BIDI_NUMERIC_ORDERING_DESC", "Specifies if the numeric ordering round trip feature should be used."}, //@K24 - { "HOLD_STATEMENTS_DESC", "Specifies if statements should remain open until a transaction boundary."}, //@KBL - { "ROLLBACK_CURSOR_HOLD_DESC", "Specifies whether to hold cursors across a rollback."}, //@K94 - { "VARIABLE_FIELD_COMPRESSION_DESC", "Specifies whether variable-length fields should be compressed."}, //@K54 - { "QUERY_OPTIMIZE_GOAL_DESC", "Specifies the goal the system should use with optimization of queries."}, //@540 @550 - { "XA_LOOSELY_COUPLED_SUPPORT_DESC", "Specifies whether lock sharing is allowed for loosely coupled transaction branches."}, //@540 - { "TRANSLATE_BOOLEAN_DESC", "Specifies how Boolean objects are interpreted when setting the value for a character field/parameter."}, //@PDA - { "METADATA_SOURCE_DESC", "Specifies how to retrieve DatabaseMetaData."}, //@PDA - { "QUERY_STORAGE_LIMIT_DESC", "Specifies the query storage limit to be used when statements in a connection are executed."}, //@550 - { "DECFLOAT_ROUNDING_MODE_DESC", "Specifies the rounding mode to use when working with decfloat data type."}, //@DFA @550 - { "AUTOCOMMIT_EXCEPTION_DESC", "Specifies whether to throw an SQLException when Connection.commit() or Connection.rollback() is called if autocommit is enabled."}, //@CE1 - { "AUTO_COMMIT_DESC", "Specifies whether auto-commit mode is the default connection mode for new connections."}, //@AC1 - { "IGNORE_WARNINGS_DESC", "Specifies a list of SQL states for which the driver should not create warning objects."}, //@igwrn - { "SECURE_CURRENT_USER_DESC", "Specifies whether to disallow \"\" and *current as user name and password."}, //@pw3 - { "CONCURRENT_ACCESS_RESOLUTION_DESC", "Specifies whether \"currently committed\" access is used on the connection."}, //@cc1 - { "JVM16_SYNCHRONIZE_DESC", "Specifies whether to enable temporary workaround fix for JVM 1.6."}, //@dmy - { "SOCKET_TIMEOUT_DESC", "Specifies the socket timeout value in milliseconds."}, //@STIMEOUT - { "MAXIMUM_BLOCKED_INPUT_ROWS_DESC", "Specifies the maximum number of rows to be sent to the database engine when using a blocked insert or update operation." }, - - // JDBC 2 - Optional Package support - RowSet @E5 - { "PROP_NAME_RS_COMMAND", "command" }, - { "PROP_NAME_RS_CONCURRENCY", "concurrency" }, - { "PROP_NAME_RS_ESCAPE_PROCESSING", "escapeProcessing" }, - { "PROP_NAME_RS_FETCH_DIRECTION", "fetchDirection" }, - { "PROP_NAME_RS_FETCH_SIZE", "fetchSize" }, - { "PROP_NAME_RS_MAX_FIELD_SIZE", "maxFieldSize" }, - { "PROP_NAME_RS_MAX_ROWS", "maxRows" }, - { "PROP_NAME_RS_QUERY_TIMEOUT", "queryTimeout" }, - { "PROP_NAME_RS_READ_ONLY", "readOnly" }, - { "PROP_NAME_RS_TYPE", "type" }, - { "PROP_NAME_RS_URL", "url" }, - { "PROP_NAME_RS_USE_DATA_SOURCE", "useDataSource" }, - { "PROP_NAME_RS_USERNAME", "username" }, - - { "PROP_DESC_RS_COMMAND", "Specifies the command used to populate the rowset."}, - { "PROP_DESC_RS_CONCURRENCY", "Specifies the result set concurrency type."}, - { "PROP_DESC_RS_ESCAPE_PROCESSING", "Specifies whether the escape scanning is enabled for escape substitution processing."}, - { "PROP_DESC_RS_FETCH_DIRECTION", "Specifies the direction in which the rows in a result set are processed."}, - { "PROP_DESC_RS_FETCH_SIZE", "Specifies the number of rows to be fetched from the database."}, - { "PROP_DESC_RS_MAX_FIELD_SIZE", "Specifies the maximum column size for the database field."}, - { "PROP_DESC_RS_MAX_ROWS", "Specifies the maximum row limit for the rowset."}, - { "PROP_DESC_RS_QUERY_TIMEOUT", "Specifies the maximum wait time in seconds for the statement to execute."}, - { "PROP_DESC_RS_READ_ONLY", "Specifies whether the rowset is read-only."}, - { "PROP_DESC_RS_TYPE", "Specifies the result set type."}, - { "PROP_DESC_RS_URL", "Specifies the URL used for getting a connection."}, - { "PROP_DESC_RS_USE_DATA_SOURCE", "Specifies whether the data source is used to make a connection to the database."}, - - // #TRANNOTE JDBC exception and warning messages. - { "JD08001", "The application requester cannot establish the connection." }, //@D3A - { "JD08004", "The application server rejected the connection." }, //@D3A - - - }; - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/JDMRI2.java b/cvsroot/src/com/ibm/as400/access/JDMRI2.java deleted file mode 100644 index af15e26fe..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDMRI2.java +++ /dev/null @@ -1,124 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDMRI2.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.*; - -/** -Locale-specific objects for IBM Toolbox for Java. -**/ -// -// Implementation note: -// This MRI contains ONLY resources that are NOT needed -// in the proxy jar file. Resources needed in the proxy jar -// file belong in the JDMRI class. -// - -public class JDMRI2 extends ListResourceBundle -{ - // NLS_MESSAGEFORMAT_NONE - // Each string is assumed NOT to be processed by the MessageFormat class. - // This means that a single quote must be coded as 1 single quote. - - // NLS_ENCODING=UTF-8 - // Instructs the translation tools to interpret the text as UTF-8. - - public Object[][] getContents() - { - return resources; - } - - private final static Object[][] resources= { - // #TRANNOTE NOTE TO TRANSLATORS: The format of a line of MRI - // #TRANNOTE is { "KEY", "value" }, - // #TRANNOTE - // #TRANNOTE The key must be left alone so translate only the value. - // #TRANNOTE - - - - // #TRANNOTE JDBC exception and warning messages. - { "JD01608", "An unsupported value was replaced." }, - { "JD01H10", "Extra URL elements are ignored." }, - { "JD01H11", "Extended dynamic support is not being used." }, - { "JD01H12", "Package caching is not being used." }, - { "JD01H13", "The URL default library is not valid." }, - { "JD01H20", "Extra connection property is ignored." }, - { "JD01H30", "The active transaction was committed." }, - { "JD01S02", "Option value changed." }, - { "JD07001", "The number of parameter values set or registered does not match the number of parameters." }, // @C1C - { "JD07006", "Data type mismatch." }, - { "JD07009", "Descriptor index not valid." }, - //@A4D These messages are needed by proxy classes. -// { "JD08001", "The application requester cannot establish the connection." }, -// { "JD08004", "The application server rejected the connection." }, - { "JD08003", "The connection does not exist." }, - { "JD08S01", "Communication link failure." }, // @F1A - { "JD22522", "CCSID value is not valid." }, - { "JD22524", "Character conversion resulted in truncation." }, - { "JD24000", "Cursor state not valid." }, - { "JD25000", "Transaction state not valid." }, - { "JD34000", "Cursor name not valid." }, - { "JD3C000", "Cursor name is ambiguous." }, - { "JD42505", "Connection authorization failure occurred." }, - { "JD42601", "A character, token, or clause is not valid or is missing." }, - { "JD42703", "An undefined column name was detected." }, - { "JD42705", "Relational database not in relational database directory." }, // @J2a - { "JD43617", "A string parameter value with zero length was detected." }, // @A3A - { "JDHY000", "Internal driver error." }, - { "JDHY001", "Internal server error." }, - { "JDHY004", "Data type not valid." }, - { "JDHY008", "Operation cancelled." }, - { "JDHY010", "Function sequence error." }, - { "JDHY014", "Limit on number of statements exceeded." }, - { "JDHY024", "Attribute value not valid." }, - { "JDHY090", "String or buffer length not valid." }, - { "JDHY094", "Scale not valid." }, - { "JDHY105", "Parameter type not valid." }, - { "JDHY108", "Concurrency or type option not valid." }, - { "JDHY109", "Cursor position not valid." }, - { "JDIM001", "The driver does not support this function." }, - { "JD54001", "SQL statement too long or complex." }, // @E9a - { "JD3B001", "Savepoint does not exist or is invalid in this context." }, // @E10a - { "JD3B501", "Savepoint already exists." }, // @E10a - { "JD3B502", "Savepoint does not exist." }, // @E10a - { "JD01G00", "1000 open statements on this connection."}, //@K1A - { "JD2200M", "XML parsing error."}, //@xml2 - - - - // #TRANNOTE Field attributes. - { "MAXLENGTH", "MAX LENGTH" }, - { "PRECISION", "PRECISION" }, - { "SCALE", "SCALE" }, - - - // #TRANNOTE Text for the various terms returned by DatabaseMetaData.getXXXTerm(). - { "CATALOG_TERM", "System" }, - { "PROCEDURE_TERM", "Procedure" }, - { "SCHEMA_TERM", "Library" }, - - // #TRANNOTE Text for the various descriptions returned by DatabaseMetaData.getClientInfoProperties(). - { "CLIENT_INFO_DESC_APPLICATIONNAME", "The name of the application currently utilizing the connection." }, //@PDA jdbc40 - { "CLIENT_INFO_DESC_CLIENTUSER", "The name of the user that the application using the connection is performing work for. This may not be the same as the user name that was used in establishing the connection." }, //@PDA jdbc40 - { "CLIENT_INFO_DESC_CLIENTHOSTNAME", "The hostname of the system the application using the connection is running on." }, //@PDA jdbc40 - { "CLIENT_INFO_DESC_CLIENTACCOUNTING", "Accounting information." }, //@PDA jdbc40 - { "CLIENT_INFO_DESC_CLIENTPROGRAMID", "Program identification information." }, //@PDA 550 - - - }; - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/JDMappedRow.java b/cvsroot/src/com/ibm/as400/access/JDMappedRow.java deleted file mode 100644 index 38c7c34dd..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDMappedRow.java +++ /dev/null @@ -1,201 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDMappedRow.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; -import java.util.Calendar; - - - -/** -

    The JDMappedRow class implements a row of data that -must be mapped according to maps. -**/ -class JDMappedRow -implements JDRow -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - // Private data. - private JDFieldMap[] fieldMaps_; - private JDRow fromRow_; - private JDSimpleRow toRow_; - - - - /** - Constructs a JDMappedRow object with field names and - types generated on the client, and maps to map other - formats into this one. - - @param formatRow The row describing the format. - @param fromRow The row to map. - **/ - JDMappedRow (JDSimpleRow formatRow, - JDFieldMap[] fieldMaps) - { - fieldMaps_ = fieldMaps; - fromRow_ = null; - toRow_ = formatRow; - } - - - - /** - Constructs a JDMappedRow object with field names and - types generated on the client, and maps to map other - formats into this one. - - @param fieldNames Field names. - @param sqlData Initial contents of SQL data. This is - needed immediately just to describe the - format. - @param fieldNullables Field nullables (either DatabaseMetaData. - columnNoNulls, columnNullable or - columnNullableUnknown). - @param fromRow The row to map. - **/ - JDMappedRow (String[] fieldNames, - SQLData[] sqlData, - int[] fieldNullables, - JDFieldMap[] fieldMaps) - { - fieldMaps_ = fieldMaps; - fromRow_ = null; - toRow_ = new JDSimpleRow (fieldNames, sqlData, - fieldNullables); - } - - - - /** - Sets the row to map from. - - @param fromRow The row to map from. - **/ - void setRow (JDRow fromRow) - { - fromRow_ = fromRow; - } - - - - //-------------------------------------------------------------// - // // - // INTERFACE IMPLEMENTATIONS // - // // - //-------------------------------------------------------------// - - - - public int findField (String name) - throws SQLException - { - return toRow_.findField (name); - } - - - - public int getFieldCount () - { - return toRow_.getFieldCount (); - } - - - - public String getFieldName (int index) - throws SQLException - { - return toRow_.getFieldName (index); - } - - - - /* @C1D - public int getFieldPrecision (int index) - throws SQLException - { - return toRow_.getFieldPrecision (index); - } - - - - public int getFieldScale (int index) - throws SQLException - { - return toRow_.getFieldScale (index); - } - */ - - - - public SQLData getSQLData (int index) - throws SQLException - { - SQLData toData = toRow_.getSQLData (index); - toData.set (fieldMaps_[index-1].getValue (fromRow_), - Calendar.getInstance (), -1); - - // @A0A - // Added code to trim the data if it is of SQLChar - // or SQLVarchar type. - if(toData.getSQLType() == SQLData.VARCHAR) // @A0A - ((SQLVarchar)toData).trim(); // @A0A - else if(toData.getSQLType() == SQLData.CHAR) // @A0A - ((SQLChar) toData).trim(); // @A0A - else if(toData.getSQLType() == SQLData.GRAPHIC) - ((SQLGraphic)toData).trim(); - else if(toData.getSQLType() == SQLData.VARGRAPHIC) - ((SQLVargraphic)toData).trim(); - else if(toData.getSQLType() == SQLData.LONG_VARCHAR) - ((SQLLongVarchar)toData).trim(); - else if(toData.getSQLType() == SQLData.LONG_VARGRAPHIC) - ((SQLLongVargraphic)toData).trim(); - - return toData; - } - - - - public SQLData getSQLType (int index) - throws SQLException - { - return toRow_.getSQLData (index); - } - - public boolean isDataMappingError(int index) - throws SQLException - { - return fieldMaps_[index-1].isDataMappingError(fromRow_); - } - - public boolean isNull (int index) - throws SQLException - { - return fieldMaps_[index-1].isNull (fromRow_); - } - - - - public int isNullable (int index) - throws SQLException - { - return toRow_.isNullable (index); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDMappedRowCache.java b/cvsroot/src/com/ibm/as400/access/JDMappedRowCache.java deleted file mode 100644 index 2dba41a7e..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDMappedRowCache.java +++ /dev/null @@ -1,202 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDMappedRowCache.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - - - -/** -The JDMappedRowCache class implements a set of rows that are -mapped from one row cache to a new format. This comes in handy -for DatabaseMetaData catalog methods, where the format that comes -back from the system is different from the format that the JDBC -specification says we must return. -**/ -class JDMappedRowCache -implements JDRowCache -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - // Private data. - private JDMappedRow row_; - private JDRowCache fromCache_; - - - - -/** -Constructs a JDMappedRowCache object. - -@param formatRow The row describing the format. -@param fromCache The row cache from which to map. -**/ - JDMappedRowCache (JDMappedRow formatRow, - JDRowCache fromCache) - { - row_ = formatRow; - fromCache_ = fromCache; - - row_.setRow (fromCache_.getRow ()); - } - - - -//------------------------------------------------------------// -// // -// OPEN AND CLOSE // -// // -//------------------------------------------------------------// - - - - public void open () - throws SQLException - { - fromCache_.open (); - } - - - - public void close () - throws SQLException - { - fromCache_.close (); - } - - - - public void flush () - throws SQLException - { - fromCache_.flush (); - } - - - - public void refreshRow () - throws SQLException - { - fromCache_.refreshRow (); - } - - - -//------------------------------------------------------------// -// // -// CURSOR INFORMATION // -// // -//------------------------------------------------------------// - - - - public JDRow getRow () - { - return row_; - } - - - - public boolean isEmpty () - throws SQLException - { - return fromCache_.isEmpty (); - } - - - - public boolean isValid () - { - return fromCache_.isValid (); - } - - - -//------------------------------------------------------------// -// // -// CURSOR POSITIONING // -// // -//------------------------------------------------------------// - - - - public void absolute (int rowNumber) - throws SQLException - { - fromCache_.absolute (rowNumber); - } - - - - public void afterLast () - throws SQLException - { - fromCache_.afterLast (); - } - - - - public void beforeFirst () - throws SQLException - { - fromCache_.beforeFirst (); - } - - - - public void first () - throws SQLException - { - fromCache_.first (); - } - - - - public void last () - throws SQLException - { - fromCache_.last (); - } - - - - public void next () - throws SQLException - { - fromCache_.next (); - } - - - - public void previous () - throws SQLException - { - fromCache_.previous (); - } - - - - public void relative (int rowIndex) - throws SQLException - { - fromCache_.relative (rowIndex); - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/JDNClobProxy.java b/cvsroot/src/com/ibm/as400/access/JDNClobProxy.java deleted file mode 100644 index 7bd2cc662..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDNClobProxy.java +++ /dev/null @@ -1,244 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDNClobProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Writer; -import java.io.Reader; -import java.lang.reflect.InvocationTargetException; -import java.sql.Clob; -/* ifdef JDBC40 -import java.sql.NClob; -endif */ -import java.sql.SQLException; - - -//@PDA jdbc40 new class - -/** -The JDNClobProxy class provides access to character large -objects. The data is valid only within the current -transaction. -**/ -class JDNClobProxy -extends AbstractProxyImpl -/* ifdef JDBC40 -implements NClob -endif */ -{ - - - // Copied from JDError: - private static final String EXC_FUNCTION_NOT_SUPPORTED = "IM001"; - - - - public InputStream getAsciiStream () - throws SQLException - { - try { - JDInputStreamProxy newStream = new JDInputStreamProxy (); - return (JDInputStreamProxy) connection_.callFactoryMethod ( - pxId_, "getAsciiStream", newStream); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public Reader getCharacterStream () - throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getCharacterStream", - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public String getSubString (long start, int length) - throws SQLException - { - try { - return (String) connection_.callMethod (pxId_, "getSubString", - new Class[] { Long.TYPE, Integer.TYPE }, - new Object[] { new Long (start), - new Integer (length) }) - .getReturnValue(); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public long length () - throws SQLException - { - try { - return connection_.callMethod (pxId_, "length") - .getReturnValueLong (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public long position (String pattern, long start) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "position", - new Class[] { String.class, Long.TYPE }, - new Object[] { pattern, new Long (start) }) - .getReturnValueLong (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public long position (Clob pattern, long start) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "position", - new Class[] { Clob.class, Long.TYPE }, - new Object[] { pattern, new Long (start) }) - .getReturnValueLong (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public OutputStream setAsciiStream (long pos) - throws SQLException - { - try - { - JDOutputStreamProxy newStream = new JDOutputStreamProxy (); - return (JDOutputStreamProxy) connection_.callFactoryMethod (pxId_, "setAsciiStream", - new Class[] { Long.TYPE}, - new Object[] { new Long(pos)}, - newStream); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public Writer setCharacterStream (long pos) - throws SQLException - { - - try - { - JDWriterProxy newWriter = new JDWriterProxy (); - return (JDWriterProxy) connection_.callFactoryMethod (pxId_, "setCharacterStream", - new Class[] { Long.TYPE}, - new Object[] { new Long(pos)}, - newWriter); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public int setString (long pos, String str) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "setString", - new Class[] { Long.TYPE, String.class}, - new Object[] { new Long(pos), str}) - .getReturnValueInt (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public int setString (long pos, String str, int offset, int len) - throws SQLException - { - try { - return connection_.callMethod (pxId_, "setString", - new Class[] { Long.TYPE, String.class, Integer.TYPE, Integer.TYPE}, - new Object[] { new Long(pos), str, new Integer(offset), new Integer(len)}) - .getReturnValueInt (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public void truncate (long len) - throws SQLException - { - try { - connection_.callMethod (pxId_, "truncate", - new Class[] { Long.TYPE,}, - new Object[] { new Long(len)} ); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public void free() throws SQLException - { - try { - connection_.callMethod (pxId_, "free"); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public Reader getCharacterStream(long pos, long length) throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getCharacterStream", - new Class[] { Long.TYPE, Long.TYPE}, - new Object[] { new Long(pos), new Long(length)}, - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDNonUniqueFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDNonUniqueFieldMap.java deleted file mode 100644 index b18d65259..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDNonUniqueFieldMap.java +++ /dev/null @@ -1,72 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDNonUniqueFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - - -/** - The JDNonUniqueFieldMap class converts a - non-unique character value - to the short value required by JDBC. -**/ -class JDNonUniqueFieldMap -extends JDSimpleFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - // fromIndex is the index of the data received from the system. - // Need to specify the index to the non-unique information - // returned from the system. - JDNonUniqueFieldMap (int fromIndex) - { - super (fromIndex); - } - - /** - Returns the non-unique value in JDBC format. - **/ - public Object getValue (JDRow row) - throws SQLException - { - Object serverData = super.getValue (row); // gets data from correct column - // using fromIndex - - - // if serverData == "D", allows duplicate values (set to true) - // == "U", must be unique (set to false) - if(serverData.toString ().charAt (0) == 'D') - return new Boolean (true); - else - return new Boolean (false); - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return false; - } - - public boolean isNull (JDRow row) - throws SQLException - { - return false; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDNullableIntegerFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDNullableIntegerFieldMap.java deleted file mode 100644 index 8de05fe49..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDNullableIntegerFieldMap.java +++ /dev/null @@ -1,87 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDNullableIntegerFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.DatabaseMetaData; -import java.sql.SQLException; - - - -/** - The JDNullableIntgerFieldMap class converts - a character value for null capable - to the integer value required by JDBC. -**/ -class JDNullableIntegerFieldMap -extends JDSimpleFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - // fromIndex is the index of the data received from the system. - JDNullableIntegerFieldMap (int fromIndex) - { - super (fromIndex); - } - - /** - Returns the nullable indicator in JDBC format. - **/ - public Object getValue (JDRow row) - throws SQLException - { - Object serverData = super.getValue (row); // gets data from correct column - // using fromIndex - - // if serverData == "Y", return columnNullable - // == "N", return columnNoNulls - // else return columnNullableUnknown - - String serverDataAsString = serverData.toString(); - if(serverDataAsString.length () > 0) - { - switch(serverDataAsString.charAt (0)) - { - case 'N': - return new Integer (DatabaseMetaData.columnNoNulls); - case 'Y': - return new Integer (DatabaseMetaData.columnNullable); - default: - return new Integer (DatabaseMetaData.columnNullableUnknown); - } - } - else - return new Integer (DatabaseMetaData.columnNullableUnknown); - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return false; - } - - /** - Indicates if value is null. - **/ - public boolean isNull (JDRow row) - throws SQLException - { - return false; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDNullableSmallintFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDNullableSmallintFieldMap.java deleted file mode 100644 index 7749b262a..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDNullableSmallintFieldMap.java +++ /dev/null @@ -1,83 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDNullableSmallintFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; -import java.sql.DatabaseMetaData; - - - -/** - The JDNullableSmallintFieldMap class converts - a character (3) value for is nullable - to the short value required for JDBC. -**/ -class JDNullableSmallintFieldMap -extends JDSimpleFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - // fromIndex is the index of the data received from the system. - JDNullableSmallintFieldMap (int fromIndex) - { - super (fromIndex); - } - - /** - Returns the nullable indicator in JDBC format. - **/ - public Object getValue (JDRow row) - throws SQLException - { - Object serverData = super.getValue (row); // gets data from correct column - // using fromIndex - - // if serverData == "NO", return procedureNoNulls - // == "YES", return procedureNullable - // else return procedureNullableUnknown - - String serverDataAsString = serverData.toString (); - - if(serverDataAsString.equalsIgnoreCase("NO")) - return new Short ((short) DatabaseMetaData.procedureNoNulls); - else if(serverDataAsString.equalsIgnoreCase("YES")) - return new Short ((short) DatabaseMetaData.procedureNullable); - else - return new Short ((short) DatabaseMetaData.procedureNullableUnknown); - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return false; - } - - /** - Indicates if value is null. - **/ - public boolean isNull (JDRow row) - throws SQLException - { - return false; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDNullableStringFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDNullableStringFieldMap.java deleted file mode 100644 index 03de1c906..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDNullableStringFieldMap.java +++ /dev/null @@ -1,88 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDNullableStringFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - - -/** - The JDNullableStringFieldMap class converts - a single character value for null capable - to the string value required by JDBC. -**/ -class JDNullableStringFieldMap -extends JDSimpleFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - // fromIndex is the index of the data received from the system. - JDNullableStringFieldMap (int fromIndex) - { - super (fromIndex); - } - - /** - Returns the nullable indicator in JDBC format. - **/ - public Object getValue (JDRow row) - throws SQLException - { - Object serverData = super.getValue (row); // gets data from correct column - // using fromIndex - - // if serverData == "Y", return YES - // == "N", return NO - // else return empty string indicating we don't know - String serverDataAsString = serverData.toString (); - - if(serverDataAsString.length() > 0) - { - switch(serverDataAsString.charAt (0)) - { - case 'N': - return "NO"; - case 'Y': - return "YES"; - default: - return ""; - } - } - else - return ""; - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return false; - } - - /** - Indicates if value is null. - **/ - public boolean isNull (JDRow row) - throws SQLException - { - return false; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDOutputStreamProxy.java b/cvsroot/src/com/ibm/as400/access/JDOutputStreamProxy.java deleted file mode 100644 index ea32bd403..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDOutputStreamProxy.java +++ /dev/null @@ -1,114 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDOutputStreamProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.OutputStream; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - - - -// JDBC 2.0 -class JDOutputStreamProxy -extends OutputStream -implements ProxyFactoryImpl -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - - // Private data. - - private long pxId_; - private ProxyClientConnection connection_; - - - - public void close () - throws IOException - { - try { - connection_.callMethod (pxId_, "close"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - - protected void finalize() throws Throwable - { - connection_.callFinalize (pxId_); - super.finalize(); - } - - - // Implementation of ProxyFactoryImpl interface. - // This method gets called by ProxyClientConnection.callFactoryMethod(). - public void initialize (long proxyId, ProxyClientConnection connection) - { - pxId_ = proxyId; - connection_ = connection; - } - - - public void write (int b) - { - try { - connection_.callMethod (pxId_, "write", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (b) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - public void write (byte[] b) - { - try { - connection_.callMethod (pxId_, "write", - new Class[] { byte[].class }, - new Object[] { b }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - public void write (byte[] b, int off, int len) - { - try { - connection_.callMethod (pxId_, "write", - new Class[] { byte[].class, Integer.TYPE, Integer.TYPE }, - new Object[] { b, new Integer(off), new Integer(len) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - - public void flush () - throws IOException - { - try { - connection_.callMethod (pxId_, "flush"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDPackageManager.java b/cvsroot/src/com/ibm/as400/access/JDPackageManager.java deleted file mode 100644 index 08d7ce7df..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDPackageManager.java +++ /dev/null @@ -1,630 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDPackageManager.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - - - -/** -

    This class manages a SQL packages. -**/ -class JDPackageManager -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - //private static final String SUFFIX_INVARIANT_ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; //@G0D - // because we only send unicode to the system anyway we don't check if the system //@G0A - // supports unicode first like ODBC does //@G0A - private static final String SUFFIX_INVARIANT_ = "9876543210ZYXWVUTSRQPONMLKJIHGFEDCBA"; //@G0A - - private boolean cache_; - private DBReplyPackageInfo cachedPackage_; - private ConvTable cachedPackageConverter_; //@P0C - private int cachedStatementCount_; - private boolean clear_; - private AS400JDBCConnection connection_; - private boolean created_; - private boolean enabled_; - private String error_; - private int id_; - private String libraryName_; - private String name_; - private int threshold_; - - - - /** - Constructs a JDPackageManager object. - - @param connection the connection to the system. - @param id the id. - @param properties the connection properties. - @param commitMode the current commit mode for connection. - - @exception SQLException If an error occurs. - **/ - JDPackageManager (AS400JDBCConnection connection, - int id, - JDProperties properties, - int commitMode) - throws SQLException - { - // Determine if extended support is enabled. - enabled_ = properties.getBoolean (JDProperties.EXTENDED_DYNAMIC); - - if (enabled_) - { - - // Initialization. - cache_ = properties.getBoolean (JDProperties.PACKAGE_CACHE); - clear_ = properties.getBoolean (JDProperties.PACKAGE_CLEAR); - connection_ = connection; - created_ = false; - error_ = properties.getString (JDProperties.PACKAGE_ERROR); - id_ = id; - threshold_ = clear_ ? 512 : 0; - - // Determine the library name. - String packageLibrary = properties.getString (JDProperties.PACKAGE_LIBRARY); - if (packageLibrary.length () > 0) - libraryName_ = packageLibrary.toUpperCase (); - else - libraryName_ = "QGPL"; - - // Make sure a package was specified. - String packageName = properties.getString (JDProperties.PACKAGE); - if (packageName.length() > 0) - { - - // Normalize the package name to 6 characters and tack - // on the appropriate 4 character suffix. - StringBuffer buffer = new StringBuffer (10); - String normalizedName; - if (packageName.length() >= 6) //@hex - normalizedName = packageName.substring (0, 6); //@hex - else - normalizedName = packageName; - buffer.append (normalizedName.toUpperCase().replace (' ', '_')); - buffer.append (getSuffix (properties, commitMode)); - name_ = buffer.toString (); - } - else - { - enabled_ = false; - postError (JDError.WARN_EXTENDED_DYNAMIC_DISABLED); - } - } - } - - - - /** - Downloads the package from the system and caches it in memory. - - @exception SQLException If an error occurs. - **/ - private void cache () - throws SQLException - { - if (enabled_) - { - try - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (connection_, - "Caching package [" + name_ + "]"); - - DBSQLRequestDS request = null; //@P0A - DBReplyRequestedDS reply = null; //@P0A - try - { - request = DBDSPool.getDBSQLRequestDS ( //@P0C - DBSQLRequestDS.FUNCTIONID_RETURN_PACKAGE, id_, - DBSQLRequestDS.ORS_BITMAP_RETURN_DATA - + DBSQLRequestDS.ORS_BITMAP_PACKAGE_INFO, 0); - - request.setPackageName (name_, connection_.converter_); //@P0C - request.setLibraryName (libraryName_, connection_.converter_); //@P0C - request.setReturnSize (0); - - reply = connection_.sendAndReceive (request, id_); //@P0C - - int errorClass = reply.getErrorClass(); - // int returnCode = reply.getReturnCode(); - - if (errorClass != 0) - { - cache_ = false; - postError (JDError.WARN_PACKAGE_CACHE_DISABLED); - } - - else - { - cachedPackage_ = reply.getPackageInfo (); - cachedPackageConverter_ = connection_.getConverter (cachedPackage_.getCCSID()); - cachedStatementCount_ = cachedPackage_.getStatementCount (); - } - } - finally - { - if (request != null) { request.returnToPool(); request =null; } - if (reply != null) { reply.returnToPool(); reply =null; } // only ErrorClass used from reply - } - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - } - } - - - - /** - Creates the package on the system, if extended dynamic support is - enabled. If the package already existed on the system, and the - user has enabled package caching, then this downloads and caches - the package. - - @exception SQLException If an error occurs. - **/ - void create () - throws SQLException - { - if (enabled_) - { - - try - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (connection_, - "Creating package [" + name_ + "]"); - - DBSQLRequestDS request = null; //@P0A - DBReplyRequestedDS reply = null; //@P0A - try - { - request = DBDSPool.getDBSQLRequestDS ( //@P0C - DBSQLRequestDS.FUNCTIONID_CREATE_PACKAGE, id_, - DBSQLRequestDS.ORS_BITMAP_RETURN_DATA, 0); - - request.setPackageName (name_, connection_.converter_); //@P0C - request.setLibraryName (libraryName_, connection_.converter_); //@P0C - - // $F1 This parameter no longer needs to be passed on a data stream. Package clearing - // $F1 and the decision for the threshold where package clearing is needed is now handled - // $F1 automatically by the database. Passing this code point results in a no-op. - // @F1D request.setPackageThresholdValue (threshold_); - - reply = connection_.sendAndReceive (request, id_); //@P0C - - int errorClass = reply.getErrorClass(); - int returnCode = reply.getReturnCode(); - - // If the package already exists, then download and - // cache it if needed. - if ((errorClass == 1) && (returnCode == -601)) - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (connection_, - "Package [" + name_ + "] already exists"); - - if (cache_) - cache (); - } - - // If the default collection in the package is - // different than the one for this connection, then - // we can not use the package because strange and - // unexpected things may happen to data. - else if (returnCode == -999999) - { - enabled_ = false; - postError (JDError.WARN_EXTENDED_DYNAMIC_DISABLED); - } - - else if (errorClass != 0) - { - enabled_ = false; - postError (connection_, id_, errorClass, returnCode); - } - } - finally - { - if (request != null) { request.returnToPool(); request =null; } - if (reply != null) { reply.returnToPool(); reply = null; } // only errorClass used in reply - } - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - } - - created_ = true; - } - - - - /** - Returns a cached data format. - - @param statementIndex the cached statement index. - @return the data format, or null if not cached - - @exception SQLException If the statement index - is not valid. - **/ - DBDataFormat getCachedDataFormat (int statementIndex) - throws SQLException - { - try - { - if (isCached ()) - return(cachedPackage_.getDataFormat (statementIndex)); - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - - return null; - } - - - - /** - Returns a cached parameter marker format. - - @param statementIndex the cached statement index. - @return the parameter marker format. - - @exception SQLException If the statement index - is not valid. - **/ - DBDataFormat getCachedParameterMarkerFormat (int statementIndex) - throws SQLException - { - try - { - if (isCached ()) - return(cachedPackage_.getParameterMarkerFormat (statementIndex)); - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - - return null; - } - - - - /** - Returns an index identifying the cached statement. - - @param sqlStatement the SQL statement. - @return the index, or -1 if not cached. - - @exception SQLException If the data stream is problematic. - **/ - int getCachedStatementIndex (JDSQLStatement sqlStatement) - throws SQLException - { - if (! isCached()) - return -1; - - String statementText = sqlStatement.toString (); - int statementTextLength = statementText.length (); - - //@G1M Moved this if statement. It should not have been in the for loop. - //@F2A If we are running to a v5r1 or higher system, the cached - //@F2A package is now in unicode. - if (connection_.getVRM() >= JDUtilities.vrm510) //@F2A - { - //@F2A - statementTextLength = statementTextLength * 2; //@F2A - } //@F2A - - for (int i = 0; i < cachedStatementCount_; ++i) - { - - try - { - // Compare lengths first, before going to the - // expense of a full String comparison. - if (statementTextLength == cachedPackage_.getStatementTextLength (i)) - { - - // The lengths match, so now do the String - // comparison. - if (statementText.equals (cachedPackage_.getStatementText (i, - cachedPackageConverter_))) - return i; - } - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - - } - - return -1; - } - - - - /** - Returns a cached statement name. - - @param statementIndex the cached statement index. - @return the statement name, or null if not cached. - - @exception SQLException If the statement index - is not valid. - **/ - String getCachedStatementName (int statementIndex) - throws SQLException - { - try - { - if (isCached ()) - return(cachedPackage_.getStatementName (statementIndex, - null)); //@F2C - //@F2D return(cachedPackage_.getStatementName (statementIndex, cachedPackageConverter_)); - //@F2D Statement name is in jobCCSID_, not unicode which is what - //@F2D cachedPackageConverter_ converts. - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - - return null; - } - - - - /** - Returns the library name for the package. - - @return the library name. - **/ - String getLibraryName () - { - return libraryName_; - } - - - - /** - Returns the name of the package. - - @return the package name. - **/ - String getName () - { - return name_; - } - - - - /** - Returns the suffix (the last 4 characters) of the package name. - These are generated based on various property values, which - influence the effectiveness of the package. This is necessary - because the properties in question affect the contents of the - packages in a way that if the property value changes, we want - to use a different package. This mechanism is exactly the same - as is used in Client Access/ODBC. - - @param properties the connection properties. - @param commitMode the current commit mode for the connection. - @return the suffix of the package name. - **/ - private String getSuffix (JDProperties properties, - int commitMode) - { - // The last four characters of the package name (the - // suffix) are generated based on various property - // values. This is necessary because the properties - // in question affect the contents of the packages - // in a way that if the property value changes, we - // want to use a different package. - // - // This mechanism is exactly the same as is used in - // Client Access/ODBC. - // - StringBuffer suffix = new StringBuffer (4); //@hex - int index; - - //@hex adding additional char at front of (now 4 length) suffix. - // Base the 1st suffix character on: - // - // translate hex (h) - values 0-1 (0 is char, 1 is binary) - // - // The index into the invariant is formed as 0000000h. - index = (properties.getIndex (JDProperties.TRANSLATE_HEX)); //@hex - suffix.append (SUFFIX_INVARIANT_.charAt (index)); //@hex - - - // Base the 2nd suffix character on: - // - // commit mode (c) - values 0-3 - // date format (f) - values 0-7 - // - // The index into the invariant is formed as 000ccfff. - // - - int dateSep = properties.getIndex(JDProperties.DATE_SEPARATOR); //@G0A - - // if commitMode is 4 (*RR), it won't fit in 2 bits, use part of DateSep to store the commitMode //@G0A - // and use commitMode to store part of DateSep. This takes advantage of the fact that DateSep //@G0A - // values only range from 0-4. We still have a DateSep of 5 available for future expansion. //@G0A - if (commitMode == 4) { // we dont use a constant for the RR commit mode because there isnt one available //@G0A - // the different DateSep are: 0=/, 1=-, 2=., 3=comma, 4=blank //@G0A - switch(dateSep) { //@G0A - case 0: case 1: case 2: //@G0A - commitMode = dateSep; //@G0A - dateSep = 6; //@G0A - break; //@G0A - case 3: case 4: //@G0A - commitMode = dateSep - 2; //@G0A - dateSep = 7; //@G0A - break; //@G0A - } //@G0A - } //@G0A - - index = (commitMode << 3) - | (properties.getIndex (JDProperties.DATE_FORMAT)); - suffix.append (SUFFIX_INVARIANT_.charAt (index)); - - // Base the 3rd suffix character on: - // - // decimal separator (d) - values 0-1 - // naming (n) - values 0-1 - // date separator (s) - values 0-4 - // - // The index into the invariant is formed as 000dnsss. - index = (properties.getIndex (JDProperties.DECIMAL_SEPARATOR) << 4) - | (properties.getIndex (JDProperties.NAMING) << 3) - | (dateSep); //@G0A - suffix.append (SUFFIX_INVARIANT_.charAt (index)); - - // Base the 4th suffix character on: - // - // time format (f) - values 0-4 - // time separator (s) - values 0-3 - // - // The index into the invariant is formed as 000fffss. - index = (properties.getIndex (JDProperties.TIME_FORMAT) << 2) - | (properties.getIndex (JDProperties.TIME_SEPARATOR)); - suffix.append (SUFFIX_INVARIANT_.charAt (index)); - - return suffix.toString (); - } - - - - /** - Returns the package threshold. This is the total number - of statements that the package can contain before being - cleared. - - @return the package threshold; or 0 for unlimited number - of statements. - **/ - int getThreshold () - { - return threshold_; - } - - - - /** - Indicates if the package is cached. - - @return true if the package is cached; false - otherwise. - **/ - boolean isCached () - { - return(cachedPackage_ != null); - } - - - - /** - Indicates if the package was created. - - @return true if the package was created; false otherwise. - **/ - boolean isCreated () - { - return created_; - } - - - - /** - Indicates if extended dynamic support is enabled. - - @return true if extended dynamic support is enabled; false - otherwise. - **/ - boolean isEnabled () - { - return enabled_; - } - - - - /** - Posts an error for the connection. This will post the error - as a warning or exception as specified in the properties. - - @param sqlState the SQL state. - - @exception SQLException The generated exception, if - the error is to be an exception. - **/ - private void postError (String sqlState) - throws SQLException - { - if (error_.equalsIgnoreCase (JDProperties.PACKAGE_ERROR_EXCEPTION)) - { - JDError.throwSQLException (sqlState); - } - - else if (error_.equalsIgnoreCase (JDProperties.PACKAGE_ERROR_WARNING)) - connection_.postWarning (JDError.getSQLWarning (sqlState)); - } - - - - /** - Posts an error for the connection. This will post the error - as a warning or exception as specified in the properties. - - @param connection connection to the system. - @param id id for the last operation. - @param errorClass error class from the system reply. - @param returnCode return code from the system reply. - - @exception SQLException The generated exception, if - the error is to be an exception. - **/ - private void postError (AS400JDBCConnection connection, - int id, - int errorClass, - int returnCode) - throws SQLException - { - if (error_.equalsIgnoreCase (JDProperties.PACKAGE_ERROR_EXCEPTION)) - { - JDError.throwSQLException (connection, id, errorClass, returnCode); - } - - else if (error_.equalsIgnoreCase (JDProperties.PACKAGE_ERROR_WARNING)) - connection_.postWarning (JDError.getSQLWarning (connection, id, errorClass, returnCode)); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDParameterMetaDataProxy.java b/cvsroot/src/com/ibm/as400/access/JDParameterMetaDataProxy.java deleted file mode 100644 index fbfde7cae..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDParameterMetaDataProxy.java +++ /dev/null @@ -1,147 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDParameterMetaDataProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.sql.ParameterMetaData; -import java.sql.SQLException; - - - -/** -

    The JDParameterMetaDataProxy class gets information about the types and properties of the parameters -in a PreparedStatement object. -**/ -class JDParameterMetaDataProxy -extends AbstractProxyImpl -implements ParameterMetaData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - - // Private data. - - JDConnectionProxy jdConnection_; - // The associated JDBC Connection object. - - - - public JDParameterMetaDataProxy (JDConnectionProxy jdConnection) - { - jdConnection_ = jdConnection; - } - - // Call a method, and return a 'raw' ProxyReturnValue. - private ProxyReturnValue callMethodRtnRaw (String methodName, - int argValue) - throws SQLException - { - try { - return connection_.callMethod (pxId_, methodName, - new Class[] { Integer.TYPE }, - new Object[] { new Integer (argValue) }); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a String. - private String callMethodRtnStr (String methodName, int argValue) - throws SQLException - { - try { - return (String) connection_.callMethod (pxId_, methodName, - new Class[] { Integer.TYPE }, - new Object[] { new Integer (argValue) }) - .getReturnValue (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return an int. - private int callMethodRtnInt (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsInt (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - public int getParameterCount() - throws SQLException - { - return callMethodRtnInt("getParameterCount"); - } - - public int isNullable(int param) - throws SQLException - { - return callMethodRtnRaw ("isNullable", param).getReturnValueInt(); - } - - public boolean isSigned(int param) - throws SQLException - { - return callMethodRtnRaw ("isSigned", param).getReturnValueBoolean(); - } - - public int getPrecision(int param) - throws SQLException - { - return callMethodRtnRaw ("getPrecision", param).getReturnValueInt(); - } - - public int getScale(int param) - throws SQLException - { - return callMethodRtnRaw ("getScale", param).getReturnValueInt(); - } - - public int getParameterType(int param) - throws SQLException - { - return callMethodRtnRaw ("getParameterType", param).getReturnValueInt(); - } - - public String getParameterTypeName(int param) - throws SQLException - { - return callMethodRtnStr ("getParameterTypeName", param); - } - - public String getParameterClassName(int param) - throws SQLException - { - return callMethodRtnStr ("getParameterClassName", param); - } - - public int getParameterMode(int param) - throws SQLException - { - return callMethodRtnRaw ("getParameterMode", param).getReturnValueInt(); - } - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.ParameterMetaData" }; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDParameterModeFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDParameterModeFieldMap.java deleted file mode 100644 index 9b27d4f91..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDParameterModeFieldMap.java +++ /dev/null @@ -1,89 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDParameterModeFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; -import java.sql.DatabaseMetaData; - -/** - The JDParameterModeFieldMap converts a - 5 character value for parameter mode - to the short value required by JDBC. -**/ -class JDParameterModeFieldMap -extends JDSimpleFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // fromIndex is the index of the data received from the system. - JDParameterModeFieldMap (int fromIndex) - { - super (fromIndex); - } - - /** - Returns the parameter mode in JDBC format. - **/ - public Object getValue (JDRow row) - throws SQLException - { - Object serverData = super.getValue (row); // gets data from correct column - // using fromIndex - - // if serverData == "IN", set to procedureColumnIn - // == "OUT", set to procedureColumnOut - // == "INOUT", set to procedureColumnInOut - // else set to procedureColumnUnknown - - // We will never need to return procedureColumnResult because - // DB2/400 does not support return values in the procedure - // columns catalog method. - - // We will never need to return procedureColumnReturn because - // DB2/400 does not support return values from stored procedures. - - String serverDataAsString = serverData.toString (); - - if(serverDataAsString.equalsIgnoreCase("IN")) - return new Short ((short) DatabaseMetaData.procedureColumnIn); - else if(serverDataAsString.equalsIgnoreCase("OUT")) - return new Short ((short) DatabaseMetaData.procedureColumnOut); - else if(serverDataAsString.equalsIgnoreCase("INOUT")) - return new Short ((short) DatabaseMetaData.procedureColumnInOut); - else - return new Short ((short) DatabaseMetaData.procedureColumnUnknown); - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return false; - } - - /** - Indicates if value is null. - **/ - public boolean isNull (JDRow row) - throws SQLException - { - return false; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDPrecisionFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDPrecisionFieldMap.java deleted file mode 100644 index dc72c9ebc..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDPrecisionFieldMap.java +++ /dev/null @@ -1,64 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDPrecisionFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - -class JDPrecisionFieldMap -extends JDTypeInfoFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - private int precisionIndex_; //@A1A - private int typeIndex_; //@A1A - - JDPrecisionFieldMap(int typeIndex, int lengthIndex, int precisionIndex, - int scaleIndex, int ccsidIndex, int vrm, JDProperties properties) // @M0C - added vrm and properties //@KKB - { - super(typeIndex, lengthIndex, precisionIndex, scaleIndex, ccsidIndex, vrm, properties); // @M0C //@KKB - typeIndex_ = typeIndex; //@A1A - precisionIndex_ = precisionIndex; //@A1A - } - - /** - Returns the data type in JDBC format. - **/ - public Object getValue(JDRow row) - throws SQLException - { - String typeName = row.getSQLData(typeIndex_).getString().trim(); //@A1A - if(typeName.equals("DISTINCT")) //@A1A - return new Integer(row.getSQLData(precisionIndex_).getInt()); //@A1A - return new Integer(((SQLData)super.getValue(row)).getPrecision()); - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return false; - } - - /** - Indicates if the value is null. - **/ - public boolean isNull(JDRow row) - throws SQLException - { - return false; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JDPreparedStatementProxy.java b/cvsroot/src/com/ibm/as400/access/JDPreparedStatementProxy.java deleted file mode 100644 index d0a92f63f..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDPreparedStatementProxy.java +++ /dev/null @@ -1,983 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDPreparedStatementProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.io.InputStream; -import java.io.Reader; -import java.io.Serializable; -import java.math.BigDecimal; -import java.net.URL; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -endif */ -import java.sql.ParameterMetaData; -import java.sql.PreparedStatement; -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -/* ifdef JDBC40 -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - - - -class JDPreparedStatementProxy -extends JDStatementProxy -implements PreparedStatement -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Copied from JDError: - - - private final static String NOT_SERIALIZABLE = "Parameter is not serializable."; - - - public JDPreparedStatementProxy (JDConnectionProxy jdConnection) - { - super (jdConnection); - } - - -// JDBC 2.0 - public void addBatch () - throws SQLException - { - callMethod ("addBatch"); - } - - - - public void clearParameters () - throws SQLException - { - callMethod ("clearParameters"); - } - - - public boolean execute () - throws SQLException - { - cachedResultSet_ = null; - return callMethodRtnBool ("execute"); - } - - - public ResultSet executeQuery () - throws SQLException - { - cachedResultSet_ = null; - try { - JDResultSetProxy newResultSet = new JDResultSetProxy (jdConnection_, this); - cachedResultSet_ = (JDResultSetProxy) connection_.callFactoryMethod ( - pxId_, "executeQuery", newResultSet); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - return cachedResultSet_; - } - - - - public int executeUpdate () - throws SQLException - { - cachedResultSet_ = null; - return callMethodRtnInt ("executeUpdate"); - } - - - -// JDBC 2.0 - public ResultSetMetaData getMetaData () - throws SQLException - { - try { - JDResultSetMetaDataProxy newMetaData = new JDResultSetMetaDataProxy (jdConnection_); - return (JDResultSetMetaDataProxy) connection_.callFactoryMethod ( - pxId_, "getMetaData", newMetaData); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - -// JDBC 3.0 - public ParameterMetaData getParameterMetaData () - throws SQLException - { - // Avoid dragging in JDError - //@K1D throw new SQLException ( - //@K1D AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - //@K1D EXC_FUNCTION_NOT_SUPPORTED, -99999); - try { //@K1A - JDParameterMetaDataProxy newMetaData = new JDParameterMetaDataProxy (jdConnection_); - return (JDParameterMetaDataProxy) connection_.callFactoryMethod (pxId_, "getParameterMetaData", newMetaData); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - -// JDBC 2.0 - public void setArray (int parameterIndex, Array parameterValue) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setArray", - new Class[] { Integer.TYPE, Array.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - - public void setAsciiStream (int parameterIndex, - InputStream parameterValue, - int length) - throws SQLException - { - InputStream iStream; - if (parameterValue == null || - parameterValue instanceof Serializable) - iStream = parameterValue; - else { - try { - iStream = new SerializableInputStream (parameterValue); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setAsciiStream", - new Class[] { Integer.TYPE, InputStream.class, - Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - iStream, - new Integer (length) }); - } - - - - public void setBigDecimal (int parameterIndex, BigDecimal parameterValue) - throws SQLException - { - callMethod ("setBigDecimal", - new Class[] { Integer.TYPE, BigDecimal.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - - public void setBinaryStream (int parameterIndex, - InputStream parameterValue, - int length) - throws SQLException - { - InputStream iStream; - if (parameterValue == null || - parameterValue instanceof Serializable) - iStream = parameterValue; - else { - try { - iStream = new SerializableInputStream (parameterValue); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBinaryStream", - new Class[] { Integer.TYPE, InputStream.class, - Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - iStream, - new Integer (length) }); - } - - - -// JDBC 2.0 - public void setBlob (int parameterIndex, Blob parameterValue) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setBlob", - new Class[] { Integer.TYPE, Blob.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - - public void setBoolean (int parameterIndex, boolean parameterValue) - throws SQLException - { - callMethod ("setBoolean", - new Class[] { Integer.TYPE, Boolean.TYPE }, - new Object[] { new Integer (parameterIndex), - new Boolean (parameterValue) }); - } - - - - public void setByte (int parameterIndex, byte parameterValue) - throws SQLException - { - callMethod ("setByte", - new Class[] { Integer.TYPE, Byte.TYPE }, - new Object[] { new Integer (parameterIndex), - new Byte (parameterValue) }); - } - - - - public void setBytes (int parameterIndex, byte[] parameterValue) - throws SQLException - { - callMethod ("setBytes", - new Class[] { Integer.TYPE, byte[].class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - -// JDBC 2.0 - public void setCharacterStream (int parameterIndex, - Reader parameterValue, - int length) - throws SQLException - { - try { - SerializableReader reader; - if (parameterValue == null) - reader = null; - else - reader = new SerializableReader (parameterValue, Math.max(0,length)); - callMethod ("setCharacterStream", - new Class[] { Integer.TYPE, Reader.class, - Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - reader, - new Integer (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - -// JDBC 2.0 - public void setClob (int parameterIndex, Clob parameterValue) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setClob", - new Class[] { Integer.TYPE, Clob.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - - public void setDate (int parameterIndex, Date parameterValue) - throws SQLException - { - callMethod ("setDate", - new Class[] { Integer.TYPE, Date.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - -// JDBC 2.0 - public void setDate (int parameterIndex, - Date parameterValue, - Calendar calendar) - throws SQLException - { - callMethod ("setDate", - new Class[] { Integer.TYPE, Date.class, - Calendar.class }, - new Object[] { new Integer (parameterIndex), - parameterValue, - calendar }); - } - - - - public void setDouble (int parameterIndex, double parameterValue) - throws SQLException - { - callMethod ("setDouble", - new Class[] { Integer.TYPE, Double.TYPE }, - new Object[] { new Integer (parameterIndex), - new Double (parameterValue) }); - } - - - - public void setFloat (int parameterIndex, float parameterValue) - throws SQLException - { - callMethod ("setFloat", - new Class[] { Integer.TYPE, Float.TYPE }, - new Object[] { new Integer (parameterIndex), - new Float (parameterValue) }); - } - - - - public void setInt (int parameterIndex, int parameterValue) - throws SQLException - { - callMethod ("setInt", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - new Integer (parameterValue) }); - } - - - - public void setLong (int parameterIndex, long parameterValue) - throws SQLException - { - callMethod ("setLong", - new Class[] { Integer.TYPE, Long.TYPE }, - new Object[] { new Integer (parameterIndex), - new Long (parameterValue) }); - } - - - - public void setNull (int parameterIndex, int sqlType) - throws SQLException - { - callMethod ("setNull", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - new Integer (sqlType) }); - } - - - public void setNull (int parameterIndex, int sqlType, String typeName) - throws SQLException - { - callMethod ("setNull", - new Class[] { Integer.TYPE, Integer.TYPE, - String.class }, - new Object[] { new Integer (parameterIndex), - new Integer (sqlType), - typeName}); - } - - public void setObject (int parameterIndex, Object parameterValue) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setObject", - new Class[] { Integer.TYPE, Object.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - - public void setObject (int parameterIndex, - Object parameterValue, - int sqlType) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setObject", - new Class[] { Integer.TYPE, Object.class, - Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - parameterValue, - new Integer (sqlType) }); - } - - - - public void setObject (int parameterIndex, - Object parameterValue, - int sqlType, - int scale) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setObject", - new Class[] { Integer.TYPE, Object.class, - Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - parameterValue, - new Integer (sqlType), - new Integer (scale) }); - } - - - -// JDBC 2.0 - public void setRef (int parameterIndex, Ref parameterValue) - throws SQLException - { - if (parameterValue != null && - !(parameterValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setRef", - new Class[] { Integer.TYPE, Ref.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - - public void setShort (int parameterIndex, short parameterValue) - throws SQLException - { - callMethod ("setShort", - new Class[] { Integer.TYPE, Short.TYPE }, - new Object[] { new Integer (parameterIndex), - new Short (parameterValue) }); - } - - - - public void setString (int parameterIndex, String parameterValue) - throws SQLException - { - callMethod ("setString", - new Class[] { Integer.TYPE, String.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - - public void setTime (int parameterIndex, Time parameterValue) - throws SQLException - { - callMethod ("setTime", - new Class[] { Integer.TYPE, Time.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - -// JDBC 2.0 - public void setTime (int parameterIndex, - Time parameterValue, - Calendar calendar) - throws SQLException - { - callMethod ("setTime", - new Class[] { Integer.TYPE, Time.class, - Calendar.class }, - new Object[] { new Integer (parameterIndex), - parameterValue, calendar }); - } - - - - public void setTimestamp (int parameterIndex, Timestamp parameterValue) - throws SQLException - { - callMethod ("setTimestamp", - new Class[] { Integer.TYPE, Timestamp.class }, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - -// JDBC 2.0 - public void setTimestamp (int parameterIndex, - Timestamp parameterValue, - Calendar calendar) - throws SQLException - { - callMethod ("setTimestamp", - new Class[] { Integer.TYPE, Timestamp.class, - Calendar.class }, - new Object[] { new Integer (parameterIndex), - parameterValue, calendar }); - } - - - -/** -@exception SQLException If a SQL error occurs. -@deprecated Use setCharacterStream(int, Reader, int) instead. -@see #setCharacterStream -**/ - public void setUnicodeStream (int parameterIndex, - InputStream parameterValue, - int length) - throws SQLException - { - InputStream iStream; - if (parameterValue == null || - parameterValue instanceof Serializable) - iStream = parameterValue; - else { - try { - iStream = new SerializableInputStream (parameterValue); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setUnicodeStream", - new Class[] { Integer.TYPE, InputStream.class, - Integer.TYPE }, - new Object[] { new Integer (parameterIndex), - iStream, - new Integer (length) }); - } - - -// JDBC 3.0 - public void setURL (int parameterIndex, - URL parameterValue) - throws SQLException - { - callMethod ("setURL", - new Class[] { Integer.TYPE, URL.class}, - new Object[] { new Integer (parameterIndex), - parameterValue }); - } - - - /* ifdef JDBC40 - //@PDA jdbc40 - public void setRowId(int parameterIndex, RowId x) throws SQLException - { - callMethod ("setRowId", - new Class[] { Integer.TYPE, RowId.class}, - new Object[] { new Integer (parameterIndex), x }); - } - endif */ - - //@PDA jdbc40 - public void setNString(int parameterIndex, String value) throws SQLException - { - callMethod ("setNString", - new Class[] { Integer.TYPE, String.class }, - new Object[] { new Integer (parameterIndex), value }); - } - - //@PDA jdbc40 - public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException - { - try { - SerializableReader reader; - if (value == null) - reader = null; - else - reader = new SerializableReader (value, (int) Math.max(0,length)); - callMethod ("setNCharacterStream", - new Class[] { Integer.TYPE, Reader.class, - Long.TYPE }, - new Object[] { new Integer (parameterIndex), - reader, - new Long(length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - /* ifdef JDBC40 - public void setNClob(int parameterIndex, NClob value) throws SQLException - { - if (value != null && - !(value instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setNClob", - new Class[] { Integer.TYPE, NClob.class }, - new Object[] { new Integer (parameterIndex), - value }); - } - endif */ - - //@PDA jdbc40 - public void setClob(int parameterIndex, Reader reader, long length) throws SQLException - { - try { - SerializableReader serialRreader; - if (reader == null) - serialRreader = null; - else - serialRreader = new SerializableReader (reader, (int) Math.max(0,length)); - callMethod ("setClob", - new Class[] { Integer.TYPE, Reader.class, - Long.TYPE }, - new Object[] { new Integer (parameterIndex), - serialRreader, - new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException - { - InputStream iStream; - if (inputStream == null || - inputStream instanceof Serializable) - iStream = inputStream; - else { - try { - iStream = new SerializableInputStream (inputStream); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBlob", - new Class[] { Integer.TYPE, InputStream.class, - Long.TYPE }, - new Object[] { new Integer (parameterIndex), - iStream, - new Long (length) }); - } - - //@PDA jdbc40 - public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException - { - try { - SerializableReader serialRreader; - if (reader == null) - serialRreader = null; - else - serialRreader = new SerializableReader (reader, (int) Math.max(0,length)); - callMethod ("setNClob", - new Class[] { Integer.TYPE, Reader.class, - Long.TYPE }, - new Object[] { new Integer (parameterIndex), - serialRreader, - new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - /* ifdef JDBC40 - public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException - { - if (xmlObject != null && - !(xmlObject instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("setSQLXML", - new Class[] { Integer.TYPE, SQLXML.class }, - new Object[] { new Integer (parameterIndex), - xmlObject }); - } - endif */ - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.PreparedStatement" }; - } - - - //@PDA jdbc40 - public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException - { - InputStream iStream; - if (x == null || - x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setAsciiStream", - new Class[] { Integer.TYPE, InputStream.class, - Long.TYPE }, - new Object[] { new Integer (parameterIndex), - iStream, - new Long (length) }); - } - - //@PDA jdbc40 - public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException - { - InputStream iStream; - if (x == null || - x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBinaryStream", - new Class[] { Integer.TYPE, InputStream.class, - Long.TYPE }, - new Object[] { new Integer (parameterIndex), - iStream, - new Long (length) }); - } - - //@PDA jdbc40 - public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException - { - try { - SerializableReader serialReader; - if (reader == null) - serialReader = null; - else - serialReader = new SerializableReader (reader, (int)Math.max(0,length)); - callMethod ("setCharacterStream", - new Class[] { Integer.TYPE, Reader.class, - Long.TYPE }, - new Object[] { new Integer (parameterIndex), - serialReader, - new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException - { - InputStream iStream; - if (x == null || - x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setAsciiStream", - new Class[] { Integer.TYPE, InputStream.class }, - new Object[] { new Integer (parameterIndex), - iStream }); - } - - - //@PDA jdbc40 - public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException - { - InputStream iStream; - if (x == null || - x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBinaryStream", - new Class[] { Integer.TYPE, InputStream.class }, - new Object[] { new Integer (parameterIndex), - iStream }); - } - - - //@PDA jdbc40 - public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException - { - InputStream iStream; - if (inputStream == null || - inputStream instanceof Serializable) - iStream = inputStream; - else { - try { - iStream = new SerializableInputStream (inputStream); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("setBlob", - new Class[] { Integer.TYPE, InputStream.class }, - new Object[] { new Integer (parameterIndex), - iStream }); - } - - - //@PDA jdbc40 - public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException - { - try { - SerializableReader serialReader; - if (reader == null) - serialReader = null; - else - serialReader = new SerializableReader (reader); - callMethod ("setCharacterStream", - new Class[] { Integer.TYPE, Reader.class }, - new Object[] { new Integer (parameterIndex), - serialReader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - //@PDA jdbc40 - public void setClob(int parameterIndex, Reader reader) throws SQLException - { - try { - SerializableReader serialReader; - if (reader == null) - serialReader = null; - else - serialReader = new SerializableReader (reader); - callMethod ("setClob", - new Class[] { Integer.TYPE, Reader.class }, - new Object[] { new Integer (parameterIndex), - serialReader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - //@PDA jdbc40 - public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException - { - try { - SerializableReader serialReader; - if (value == null) - serialReader = null; - else - serialReader = new SerializableReader (value); - callMethod ("setNCharacterStream", - new Class[] { Integer.TYPE, Reader.class }, - new Object[] { new Integer (parameterIndex), - serialReader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - //@PDA jdbc40 - public void setNClob(int parameterIndex, Reader reader) throws SQLException - { - try { - SerializableReader serialReader; - if (reader == null) - serialReader = null; - else - serialReader = new SerializableReader (reader); - callMethod ("setNClob", - new Class[] { Integer.TYPE, Reader.class }, - new Object[] { new Integer (parameterIndex), - serialReader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JDPrivilegeFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDPrivilegeFieldMap.java deleted file mode 100644 index c0f4498fc..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDPrivilegeFieldMap.java +++ /dev/null @@ -1,107 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDPrivilegeFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - - -/** - The JDPrivilegeFieldMap converts the authority - information returned from the system to the string - value required by JDBC. - The system returns a char(2) which - contains the following information: -

      -
    • AUTHORITY CHAR(2) -
    • BIT 0 - OBJECT EXISTENCE -
    • BIT 1 - OBJECT MANAGEMENT -
    • BIT 2 - POINTER AUTHORITY -
    • BIT 3 - SPACE AUTHORITY -
    • BIT 4 - READ -
    • BIT 5 - ADD -
    • BIT 6 - DELETE -
    • BIT 7 - UPDATE -
    • BIT 8 - OWNERSHIP -
    • BIT 9 - EXCLUDE -
    • BIT 10 - AUTHORIZATION LIST MGT -
    • BIT 11 - EXECUTE -
    • BIT 12 - OBJECT ALTER -
    • BIT 13 - OBJECT REFERENCE -
    • BIT 14-15- RESERVED -
    - - The only values returned are: "READ", "ADD", - "DELETE", or "UPDATE". More than one value may be - returned. -**/ -class JDPrivilegeFieldMap -extends JDSimpleFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - JDPrivilegeFieldMap (int fromIndex) - { - super (fromIndex); - } - - - /** - Returns the privileges in JDBC format. - **/ - public Object getValue (JDRow row) - throws SQLException - { - Object serverData = super.getValue (row); // gets it from correct column - // using fromIndex - - StringBuffer privileges = new StringBuffer (""); - - byte[] privilegeBytes = (byte[]) serverData; - - // Send back the appropriate String for authority - // we now have 2 bytes - // I only care about bytes 4-7 of byte 1 - if((privilegeBytes[0] & 0x08) != 0) // Read authority - privileges.append ("READ "); - if((privilegeBytes[0] & 0x04) != 0) // Add authority - privileges.append ("ADD "); - if((privilegeBytes[0] & 0x02) != 0) // Delete authority - privileges.append ("DELETE "); - if((privilegeBytes[0] & 0x01) != 0) // Update authority - privileges.append ("UPDATE "); - - return privileges.toString(); - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return false; - } - - /** - Indicates if value is null. - **/ - public boolean isNull (JDRow row) - throws SQLException - { - return false; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDProcTypeFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDProcTypeFieldMap.java deleted file mode 100644 index 054ec2714..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDProcTypeFieldMap.java +++ /dev/null @@ -1,70 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDProcTypeFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; -import java.sql.DatabaseMetaData; - - -/** - The JDProcTypeFieldMap class converts the - update and delete rule values - received from the system to the values - required for JDBC. -**/ - -//-------------------------------------------------// -// JDBC supports: -// procedureResultUnknown -// procedureNoResult -// procedureReturnsResult -// -// -// if 0 from system = procedureNoResult -// if >0 from system = procedureReturnsResult -// if any other value = procedureResultUnknown -// -//-------------------------------------------------// - -class JDProcTypeFieldMap -extends JDSimpleFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - // fromIndex is the index of the data received from the system. - JDProcTypeFieldMap (int fromIndex) - { - super (fromIndex); - } - - /** - Returns the procedure type in JDBC format. - **/ - public Object getValue (JDRow row) - throws SQLException - { - Object serverData = super.getValue (row); // gets data from correct column - // using fromIndex - - int serverDataAsInt = ((Number) serverData).intValue (); - - if(serverDataAsInt == 0) - return new Short ((short) DatabaseMetaData.procedureNoResult); - else if(serverDataAsInt >= 0) - return new Short ((short) DatabaseMetaData.procedureReturnsResult); - else - return new Short ((short) DatabaseMetaData.procedureResultUnknown); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JDProperties.java b/cvsroot/src/com/ibm/as400/access/JDProperties.java deleted file mode 100644 index b3cceeba5..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDProperties.java +++ /dev/null @@ -1,1929 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDProperties.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.io.IOException; // @W2a -import java.sql.DriverPropertyInfo; -import java.util.Enumeration; -import java.util.Properties; - - - -/** -Represents the properties passed as connection -attributes for the driver. -**/ -// -// Implementation notes: -// -// 1. If adding or changing any properties, please update the -// following: -// -// __ Update JDProperties.java (this source file). NEW PROPERTIES -// MUST BE ADDED TO THE END OF THE ARRAY (see @W2) -// -// __ Add an entry to JDBCProperties.html. Contact Information Development to -// change this file. -// -// __ Add an entry to JDBCProperties.html in micro package also. -// -// __ Add entries to JDMRI.java. The description entry should -// match the first sentence in the description in -// JDBCProperties.html. -// -// __ Add getXXX/setXXX methods to AS400JDBCDataSource.java. -// -// __ Add getXXX/setXXX methods to AS400JDBCManagedDataSource.java -// -// __ Add a property to AS400JDBCDataSourceBeanInfo.java. -// -// __ Update testcases JDDriverGetPropertyInfo.java, -// AS400JDBCConnectionPoolDataSourceBeanInfoTestcase.java, -// AS400JDBCDataSourceBeanInfoTestcase.java, -// JDConnectionCommit.java, -// JDDriverGetPropertyInfo.java. -// -// __ Test serialization -// -// 2. We only store the key to the descriptions. We only -// load the actual descriptions when the caller asks -// for them. This saves the descriptions from being -// loaded in all cases. -// -class JDProperties implements Serializable, Cloneable //@PDC 550 -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - // Callers should access the properties using one of the - // following indicies. - // - // @W2 New properties must be added to the end of the list!!! - // - static final int ACCESS = 0; - static final int BLOCK_SIZE = 1; - static final int BLOCK_CRITERIA = 2; - static final int DATE_FORMAT = 3; - static final int DATE_SEPARATOR = 4; - static final int DECIMAL_SEPARATOR = 5; - static final int ERRORS = 6; - static final int EXTENDED_DYNAMIC = 7; - static final int LIBRARIES = 8; - static final int NAMING = 9; - static final int PACKAGE = 10; - static final int PACKAGE_ADD = 11; - static final int PACKAGE_CACHE = 12; - static final int PACKAGE_CLEAR = 13; - static final int PACKAGE_ERROR = 14; - static final int PACKAGE_LIBRARY = 15; - static final int PASSWORD = 16; - static final int PREFETCH = 17; - static final int PROMPT = 18; - static final int REMARKS = 19; - static final int SORT = 20; - static final int SORT_LANGUAGE = 21; - static final int SORT_TABLE = 22; - static final int SORT_WEIGHT = 23; - static final int TIME_FORMAT = 24; - static final int TIME_SEPARATOR = 25; - static final int TRACE = 26; - static final int TRANSACTION_ISOLATION = 27; - static final int TRANSLATE_BINARY = 28; - static final int USER = 29; - static final int PACKAGE_CRITERIA = 30; // @A0A - static final int LOB_THRESHOLD = 31; - static final int SECURE = 32; - static final int DATA_TRUNCATION = 33; // @C1A - static final int PROXY_SERVER = 34; // @A3A - //static final int PROXY_SERVER_SECURE = 35; // @A3A - static final int SECONDARY_URL = 35; // @A3A - static final int DATA_COMPRESSION = 36; // @D0A - static final int BIG_DECIMAL = 37; // @E0A - static final int THREAD_USED = 38; // @E1A - static final int CURSOR_HOLD = 39; // @D1A - static final int LAZY_CLOSE = 40; // @E2A - static final int DRIVER = 41; // @E3A - static final int BIDI_STRING_TYPE = 42; // @E9A - static final int KEY_RING_NAME = 43; // @F1A - static final int KEY_RING_PASSWORD = 44; // @F1A - static final int FULL_OPEN = 45; // @W1a - static final int TRACE_SERVER = 46; // @j1a - static final int DATABASE_NAME = 47; // @j2a - static final int EXTENDED_METADATA = 48; // @F5A - static final int CURSOR_SENSITIVITY = 49; // @F6A - static final int BEHAVIOR_OVERRIDE = 50; // @F7A - static final int PACKAGE_CCSID = 51; // @M0A - support sending SQL to system in UTF-16 and storing it in a UTF-16 package - static final int MINIMUM_DIVIDE_SCALE = 52; // @M0A - support 63 digit decimal precision - static final int MAXIMUM_PRECISION = 53; - static final int MAXIMUM_SCALE = 54; - static final int TRANSLATE_HEX = 55; // @M0A - support hex constant parser option - static final int TRACE_TOOLBOX = 56; // @K1A - support to allow a toolbox trace - static final int QAQQINILIB = 57; // @K2A - support to specify a QAQQINI library name - static final int LOGIN_TIMEOUT = 58; // @K5A - static final int TRUE_AUTO_COMMIT = 59; // @KBA //@true - static final int BIDI_IMPLICIT_REORDERING = 60; //@K24 - static final int BIDI_NUMERIC_ORDERING = 61; //@K24 - static final int HOLD_LOCATORS = 62; // @KBL - static final int HOLD_STATEMENTS = 63; //@KBL - static final int ROLLBACK_CURSOR_HOLD = 64; //@K94 - static final int VARIABLE_FIELD_COMPRESSION = 65; //@K54 - static final int QUERY_OPTIMIZE_GOAL = 66; //@540 - static final int KEEP_ALIVE = 67; // @PDA - keep_alive, receive_buffer_size, send_buffer_size - static final int RECEIVE_BUFFER_SIZE = 68; // also exist in SocketProperties and their values - static final int SEND_BUFFER_SIZE = 69; // get propagated to SocketProperties - static final int XA_LOOSELY_COUPLED_SUPPORT = 70; //@540 - static final int TRANSLATE_BOOLEAN = 71; //@PDA - static final int METADATA_SOURCE = 72; //@PDA - static final int QUERY_STORAGE_LIMIT = 73; //@550 - static final int DECFLOAT_ROUNDING_MODE = 74; //@DFA - static final int AUTOCOMMIT_EXCEPTION = 75; //@CE1 - static final int AUTO_COMMIT = 76; //@AC1 (matching Native's naming) - static final int IGNORE_WARNINGS = 77; //@igwrn - static final int SECURE_CURRENT_USER = 78; //@pw3 - static final int CONCURRENT_ACCESS_RESOLUTION = 79; //@cc1 - static final int JVM16_SYNCHRONIZE = 80; //@dmy - static final int SOCKET_TIMEOUT = 81; //@STIMEOUT - static final int DO_UPDATE_DELETE_BLOCKING = 82; //@A2A - static final int MAXIMUM_BLOCKED_INPUT_ROWS = 83; //@A6A - - // @W2 always add to the end of the array! - - private static final int NUMBER_OF_ATTRIBUTES_ = 84; // @A0C @C1C @A3A @D0C @E0C - // @E1C @D1c @E2C @E3C @E9C @F1C - // @W1c @j1c @J2c @F5C @F6C @F7c @M0C @K1C @K2C @K5C @KBC @K24 @KBL @K94 @K54 @540 @PDC - // @PDC @550 @DFA @CE1 @AC1 @igwrn @pw3 @cc1 @DMY @STIMEOUT - // @A2C @A6C - - - // Property names. - private static final String ACCESS_ = "access"; - private static final String BEHAVIOR_OVERRIDE_ = "behavior override"; // @F7A - private static final String BIDI_STRING_TYPE_ = "bidi string type"; // @E9A - private static final String BIG_DECIMAL_ = "big decimal"; // @E0A - private static final String BLOCK_SIZE_ = "block size"; - private static final String BLOCK_CRITERIA_ = "block criteria"; - private static final String CURSOR_HOLD_ = "cursor hold"; // @D1 - private static final String CURSORHOLD_ = "CURSORHOLD"; // @D1 - private static final String CURSOR_SENSITIVITY_ = "cursor sensitivity"; // @F6A - private static final String DATA_COMPRESSION_ = "data compression"; // @D0A - private static final String DATA_TRUNCATION_ = "data truncation"; // @C1A - private static final String DATABASE_NAME_ = "database name"; // @J2A - private static final String DATE_FORMAT_ = "date format"; - private static final String DATE_SEPARATOR_ = "date separator"; - private static final String DECIMAL_SEPARATOR_ = "decimal separator"; - private static final String DRIVER_ = "driver"; // @E3A - private static final String ERRORS_ = "errors"; - private static final String EXTENDED_DYNAMIC_ = "extended dynamic"; - private static final String EXTENDED_METADATA_ = "extended metadata"; // @F5A - private static final String FULL_OPEN_ = "full open"; // @W1a - private static final String HOLD_LOCATORS_ = "hold input locators"; // @KBL - private static final String KEY_RING_NAME_ = "key ring name"; // @F1A - private static final String KEY_RING_PASSWORD_ = "key ring password"; // @F1A - private static final String LAZY_CLOSE_ = "lazy close"; // @E2A - private static final String LIBRARIES_ = "libraries"; - private static final String LOB_THRESHOLD_ = "lob threshold"; - private static final String MAXIMUM_PRECISION_ = "maximum precision"; // @M0A - private static final String MAXIMUM_SCALE_ = "maximum scale"; // @M0A - private static final String MINIMUM_DIVIDE_SCALE_ = "minimum divide scale"; // @M0A - private static final String NAMING_ = "naming"; - private static final String PACKAGE_ = "package"; - private static final String PACKAGE_ADD_ = "package add"; - private static final String PACKAGE_CACHE_ = "package cache"; - private static final String PACKAGE_CCSID_ = "package ccsid"; // @M0A - private static final String PACKAGE_CLEAR_ = "package clear"; - private static final String PACKAGE_CRITERIA_ = "package criteria"; // @A0A - private static final String PACKAGE_ERROR_ = "package error"; - private static final String PACKAGE_LIBRARY_ = "package library"; - static final String PASSWORD_ = "password"; //@native - private static final String PREFETCH_ = "prefetch"; - private static final String PROMPT_ = "prompt"; - private static final String PROXY_SERVER_ = "proxy server"; // @A3A - //private static final String PROXY_SERVER_SECURE_ = "proxy server secure"; // @A3A - private static final String REMARKS_ = "remarks"; - static final String SECONDARY_URL_ = "secondary URL"; // @A3A - private static final String SECURE_ = "secure"; - private static final String SORT_ = "sort"; - private static final String SORT_LANGUAGE_ = "sort language"; - private static final String SORT_TABLE_ = "sort table"; - private static final String SORT_WEIGHT_ = "sort weight"; - private static final String THREAD_USED_ = "thread used"; // @E1A - private static final String TIME_FORMAT_ = "time format"; - private static final String TIME_SEPARATOR_ = "time separator"; - private static final String TRACE_ = "trace"; - private static final String TRACE_SERVER_ = "server trace"; // @j1a - private static final String TRACE_TOOLBOX_ = "toolbox trace"; // @K1A - private static final String TRANSACTION_ISOLATION_ = "transaction isolation"; - private static final String TRANSLATE_BINARY_ = "translate binary"; - private static final String TRANSLATE_HEX_ = "translate hex"; // @M0A - static final String USER_ = "user"; //@native - private static final String QAQQINILIB_ = "qaqqinilib"; // @K2A - private static final String LOGIN_TIMEOUT_ = "login timeout"; //@K5A - private static final String TRUE_AUTO_COMMIT_ = "true autocommit"; //@KBA //@true - private static final String BIDI_IMPLICIT_REORDERING_ = "bidi implicit reordering"; //@K24 - private static final String BIDI_NUMERIC_ORDERING_ = "bidi numeric ordering"; //@K24 - private static final String HOLD_STATEMENTS_ = "hold statements"; //@KBL - private static final String ROLLBACK_CURSOR_HOLD_ = "rollback cursor hold"; //@K94 - private static final String VARIABLE_FIELD_COMPRESSION_ = "variable field compression"; //@K54 - private static final String QUERY_OPTIMIZE_GOAL_ = "query optimize goal"; //@540 - private static final String KEEP_ALIVE_ = "keep alive"; //@540 - private static final String RECEIVE_BUFFER_SIZE_ = "receive buffer size"; //@540 - private static final String SEND_BUFFER_SIZE_ = "send buffer size"; //@540 - private static final String XA_LOOSELY_COUPLED_SUPPORT_ = "XA loosely coupled support"; //@540 - private static final String TRANSLATE_BOOLEAN_ = "translate boolean"; //@PDA - private static final String METADATA_SOURCE_ = "metadata source"; //@PDA - private static final String QUERY_STORAGE_LIMIT_ = "query storage limit"; //@550 - private static final String DECFLOAT_ROUNDING_MODE_ = "decfloat rounding mode"; //@DFA - private static final String AUTOCOMMIT_EXCEPTION_ = "autocommit exception"; //@CE1 - private static final String AUTO_COMMIT_ = "auto commit"; //@AC1 (match Native driver property spelling) - private static final String IGNORE_WARNINGS_ = "ignore warnings"; //@igwrn - private static final String SECURE_CURRENT_USER_ = "secure current user"; //@pw3 (switch to turn on/off old code. see @pw1) - private static final String CONCURRENT_ACCESS_RESOLUTION_ = "concurrent access resolution"; //@cc1 - private static final String JVM16_SYNCHRONIZE_ = "jvm16 synchronize"; //@dmy - private static final String SOCKET_TIMEOUT_ = "socket timeout"; //@STIMEOUT - static final String DO_UPDATE_DELETE_BLOCKING_ = "use block update"; // @A2 Property must be visible in package - static final String MAXIMUM_BLOCKED_INPUT_ROWS_ = "maximum blocked input rows"; // @A6A - - // Common String objects. Using these will theoretically - // cut down on the number of String allocations. - // - private static final String COMMA_ = ","; - static final String EMPTY_ = ""; //@pw1 provide way to know if property was set here or by application via (Str == JDProperties.EMPTY) - private static final String EUR_ = "eur"; - private static final String FALSE_ = "false"; - private static final String ISO_ = "iso"; - private static final String JIS_ = "jis"; - private static final String NONE_ = "none"; - private static final String PERIOD_ = "."; - private static final String SPACE_ = "b"; - private static final String SQL_ = "sql"; - private static final String SYSTEM_ = "system"; - private static final String TRUE_ = "true"; - private static final String USA_ = "usa"; - - - - // Callers compare property values against valid choices - // using the following constants. - // - static final String ACCESS_ALL = "all"; - static final String ACCESS_READ_CALL = "read call"; - static final String ACCESS_READ_ONLY = "read only"; - - static final String BLOCK_CRITERIA_NONE = "0"; - static final String BLOCK_CRITERIA_IF_FETCH = "1"; - static final String BLOCK_CRITERIA_UNLESS_UPDATE = "2"; - - static final String BLOCK_SIZE_0 = "0"; - static final String BLOCK_SIZE_8 = "8"; - static final String BLOCK_SIZE_16 = "16"; - static final String BLOCK_SIZE_32 = "32"; - static final String BLOCK_SIZE_64 = "64"; - static final String BLOCK_SIZE_128 = "128"; - static final String BLOCK_SIZE_256 = "256"; - static final String BLOCK_SIZE_512 = "512"; - - static final String CURSOR_SENSITIVITY_ASENSITIVE = "asensitive"; //@F6A - static final String CURSOR_SENSITIVITY_INSENSITIVE = "insensitive"; //@F6A - static final String CURSOR_SENSITIVITY_SENSITIVE = "sensitive"; //@F6A - //@K6D static final String CURSOR_SENSITIVITY_NOT_SET = EMPTY_; //@K3A - - static final String DATE_FORMAT_JULIAN = "julian"; - static final String DATE_FORMAT_MDY = "mdy"; - static final String DATE_FORMAT_DMY = "dmy"; - static final String DATE_FORMAT_YMD = "ymd"; - static final String DATE_FORMAT_USA = "usa"; - static final String DATE_FORMAT_ISO = ISO_; - static final String DATE_FORMAT_EUR = EUR_; - static final String DATE_FORMAT_JIS = JIS_; - static final String DATE_FORMAT_NOTSET = EMPTY_; - - static final String DATE_SEPARATOR_SLASH = "/"; - static final String DATE_SEPARATOR_DASH = "-"; - static final String DATE_SEPARATOR_PERIOD = PERIOD_; - static final String DATE_SEPARATOR_COMMA = COMMA_; - static final String DATE_SEPARATOR_SPACE = SPACE_; - static final String DATE_SEPARATOR_NOTSET = EMPTY_; - - static final String DECIMAL_SEPARATOR_COMMA = COMMA_; - static final String DECIMAL_SEPARATOR_PERIOD = PERIOD_; - static final String DECIMAL_SEPARATOR_NOTSET = EMPTY_; - - //@F4D static final String DRIVER_DEFAULT = "default"; // @E3A - static final String DRIVER_NATIVE = "native"; // @E3A - static final String DRIVER_TOOLBOX = "toolbox"; // @E3A - - static final String ERRORS_BASIC = "basic"; - static final String ERRORS_FULL = "full"; - - static final String NAMING_SQL = SQL_; - static final String NAMING_SYSTEM = SYSTEM_; - - static final String PACKAGE_ERROR_EXCEPTION = "exception"; - static final String PACKAGE_ERROR_NONE = NONE_; - static final String PACKAGE_ERROR_WARNING = "warning"; - - static final String REMARKS_SQL = SQL_; - static final String REMARKS_SYSTEM = SYSTEM_; - - static final String SORT_HEX = "hex"; - //@PDD static final String SORT_JOB = "job"; - static final String SORT_LANGUAGE1 = "language"; - static final String SORT_TABLE1 = "table"; - - static final String SORT_LANGUAGE_ENGLISH_UNITED_STATES = "ENU"; // @E4A - - static final String SORT_WEIGHT_SHARED = "shared"; - static final String SORT_WEIGHT_UNIQUE = "unique"; - - static final String TIME_FORMAT_HMS = "hms"; - static final String TIME_FORMAT_USA = USA_; - static final String TIME_FORMAT_ISO = ISO_; - static final String TIME_FORMAT_EUR = EUR_; - static final String TIME_FORMAT_JIS = JIS_; - static final String TIME_FORMAT_NOTSET = EMPTY_; - - static final String TIME_SEPARATOR_COLON = ":"; - static final String TIME_SEPARATOR_PERIOD = PERIOD_; - static final String TIME_SEPARATOR_COMMA = COMMA_; - static final String TIME_SEPARATOR_SPACE = SPACE_; - static final String TIME_SEPARATOR_NOTSET = EMPTY_; - - static final String TRANSACTION_ISOLATION_NONE = NONE_; - static final String TRANSACTION_ISOLATION_READ_COMMITTED = "read committed"; - static final String TRANSACTION_ISOLATION_READ_UNCOMMITTED = "read uncommitted"; - static final String TRANSACTION_ISOLATION_REPEATABLE_READ = "repeatable read"; - static final String TRANSACTION_ISOLATION_SERIALIZABLE = "serializable"; - - static final String PACKAGE_CRITERIA_DEFAULT = "default"; // @A0A - static final String PACKAGE_CRITERIA_SELECT = "select"; // @A0A - - static final String CURSORHOLD_FALSE = "FALSE"; // @D1 - static final String CURSORHOLD_TRUE = "TRUE"; // @D1 - private static final String CURSORHOLD_NO = "0"; // @D1 - private static final String CURSORHOLD_YES = "1"; // @D1 - - static final String TRACE_SET_ON = "TRUE"; // @E7 - static final String TRACE_SET_OFF = "FALSE"; // @E7 - static final String TRACE_NOT_SPECIFIED = "NOT SPECIFIED"; // @E7 - - static final String NOT_SPECIFIED = ""; // @E8A - - static final String BIDI_STRING_TYPE_NOTSET = EMPTY_; // @E9A - static final String BIDI_STRING_TYPE_DEFAULT = "0"; // @E9A - static final String BIDI_STRING_TYPE_ST4 = "4"; // @E9A - static final String BIDI_STRING_TYPE_ST5 = "5"; // @E9A - static final String BIDI_STRING_TYPE_ST6 = "6"; // @E9A - static final String BIDI_STRING_TYPE_ST7 = "7"; // @E9A - static final String BIDI_STRING_TYPE_ST8 = "8"; // @E9A - static final String BIDI_STRING_TYPE_ST9 = "9"; // @E9A - static final String BIDI_STRING_TYPE_ST10 = "10"; // @E9A - static final String BIDI_STRING_TYPE_ST11 = "11"; // @E9A - static final String BIDI_STRING_TYPE_NONE = "-1"; //Bidi-HCG1 - - static final String PACKAGE_CCSID_UCS2 = "13488"; // @M0A - support sending SQL statements in UTF-16 - static final String PACKAGE_CCSID_UTF16 = "1200"; // and consequently storing them in package in that CCSID - - - static final String MINIMUM_DIVIDE_SCALE_0 = "0"; // @M0A - support 63 digit decimal precision - static final String MINIMUM_DIVIDE_SCALE_1 = "1"; - static final String MINIMUM_DIVIDE_SCALE_2 = "2"; - static final String MINIMUM_DIVIDE_SCALE_3 = "3"; - static final String MINIMUM_DIVIDE_SCALE_4 = "4"; - static final String MINIMUM_DIVIDE_SCALE_5 = "5"; - static final String MINIMUM_DIVIDE_SCALE_6 = "6"; - static final String MINIMUM_DIVIDE_SCALE_7 = "7"; - static final String MINIMUM_DIVIDE_SCALE_8 = "8"; - static final String MINIMUM_DIVIDE_SCALE_9 = "9"; - - static final String MAXIMUM_PRECISION_31 = "31"; - static final String MAXIMUM_PRECISION_63 = "63"; - - static final String MAXIMUM_SCALE_0 = "0"; - static final String MAXIMUM_SCALE_31 = "31"; - static final String MAXIMUM_SCALE_63 = "63"; - - static final String TRANSLATE_HEX_BINARY = "binary"; // @M0A - support hex constant parser option - static final String TRANSLATE_HEX_CHARACTER = "character"; - - static final String TRACE_TOOLBOX_DATASTREAM = "datastream"; // @K1A - static final String TRACE_TOOLBOX_DIAGNOSTIC = "diagnostic"; // @K1A - static final String TRACE_TOOLBOX_ERROR = "error"; // @K1A - static final String TRACE_TOOLBOX_INFORMATION = "information"; // @K1A - static final String TRACE_TOOLBOX_WARNING = "warning"; // @K1A - static final String TRACE_TOOLBOX_CONVERSION = "conversion"; // @K1A - static final String TRACE_TOOLBOX_PROXY = "proxy"; // @K1A - static final String TRACE_TOOLBOX_PCML = "pcml"; // @K1A - static final String TRACE_TOOLBOX_JDBC = "jdbc"; // @K1A - static final String TRACE_TOOLBOX_ALL = "all"; // @K1A - static final String TRACE_TOOLBOX_THREAD = "thread"; // @K1A - static final String TRACE_TOOLBOX_NONE = NONE_; // @K1A - static final String TRACE_TOOLBOX_NOT_SET = EMPTY_; - - static final String QUERY_OPTIMIZE_GOAL_DEFAULT = "0"; //@540 - static final String QUERY_OPTIMIZE_GOAL_FIRSTIO = "1"; //@540 - static final String QUERY_OPTIMIZE_GOAL_ALLIO = "2"; //@540 - - static final String XA_LOOSELY_COUPLED_SUPPORT_NOT_SHARED = "0"; //@540 - static final String XA_LOOSELY_COUPLED_SUPPORT_SHARED = "1"; //@540 - - static final String METADATA_SOURCE_ROI = "0"; //@PDA - static final String METADATA_SOURCE_STORED_PROCEDURE = "1"; //@PDA - static final String METADATA_SOURCE_HOST_VERSION_DEFAULT = "-1"; //@mdsp //not yet set, so default depends on i5 version (post-v6r1 default is SP) - - static final String QUERY_STORAGE_LIMIT_NOMAX = "-1"; //@550 - - static final String DECFLOAT_ROUNDING_MODE_HALF_EVEN = "half even"; //@DFA - static final String DECFLOAT_ROUNDING_MODE_HALF_UP = "half up"; //@DFA - static final String DECFLOAT_ROUNDING_MODE_DOWN = "down"; //@DFA - static final String DECFLOAT_ROUNDING_MODE_CEILING = "ceiling"; //@DFA - static final String DECFLOAT_ROUNDING_MODE_FLOOR = "floor"; //@DFA - static final String DECFLOAT_ROUNDING_MODE_HALF_DOWN = "half down"; //@DFA - static final String DECFLOAT_ROUNDING_MODE_UP = "up"; //@DFA - - static final String CONCURRENTACCESS_NOT_SET = "0"; //@cc1 default - static final String CONCURRENTACCESS_USE_CURRENTLY_COMMITTED = "1"; //@cc1 - static final String CONCURRENTACCESS_WAIT_FOR_OUTCOME = "2"; //@cc1 - static final String CONCURRENTACCESS_SKIP_LOCKS = "3"; //@cc1 - - - - // Static data. - private static DriverPropertyInfo[] dpi_; - private static String[] defaults_; - - - - // Private data. - private boolean extra_; - private String[] values_; - private Properties info_; // @A3A - - - - /** - Static initializer. - **/ - static - { - // Initialize. - dpi_ = new DriverPropertyInfo[NUMBER_OF_ATTRIBUTES_]; - defaults_ = new String[NUMBER_OF_ATTRIBUTES_]; - int i; - - // Access. - i = ACCESS; - dpi_[i] = new DriverPropertyInfo (ACCESS_, ""); - dpi_[i].description = "ACCESS_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[3]; - dpi_[i].choices[0] = ACCESS_ALL; - dpi_[i].choices[1] = ACCESS_READ_CALL; - dpi_[i].choices[2] = ACCESS_READ_ONLY; - defaults_[i] = ACCESS_ALL; - - // @f7a - // Behavior Override. This property is a bit mask. The following have - // been defined: - // 1 - (v5r2f) Don't throw exception of executeQuery() does not return a result set - // Native Driver has reserved the following bits: - // 0x02 to turn on these additional warnings in V5R2 (DATA TRUNCATION and DATA MAPPING) - // 0x04 to turn off the additional warnings when they become the default in V5R3 - i = BEHAVIOR_OVERRIDE; - dpi_[i] = new DriverPropertyInfo (BEHAVIOR_OVERRIDE_, ""); - dpi_[i].description = "BEHAVIOR_OVERRIDE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = "0"; - - // Bidi string type. @E9A - i = BIDI_STRING_TYPE; - dpi_[i] = new DriverPropertyInfo (BIDI_STRING_TYPE_, ""); - dpi_[i].description = "BIDI_STRING_TYPE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[11]; - dpi_[i].choices[0] = BIDI_STRING_TYPE_NOTSET; - dpi_[i].choices[1] = BIDI_STRING_TYPE_DEFAULT; - dpi_[i].choices[2] = BIDI_STRING_TYPE_ST4; - dpi_[i].choices[3] = BIDI_STRING_TYPE_ST5; - dpi_[i].choices[4] = BIDI_STRING_TYPE_ST6; - dpi_[i].choices[5] = BIDI_STRING_TYPE_ST7; - dpi_[i].choices[6] = BIDI_STRING_TYPE_ST8; - dpi_[i].choices[7] = BIDI_STRING_TYPE_ST9; - dpi_[i].choices[8] = BIDI_STRING_TYPE_ST10; - dpi_[i].choices[9] = BIDI_STRING_TYPE_ST11; - dpi_[i].choices[10] = BIDI_STRING_TYPE_NONE;//Bidi-HCG1 - defaults_[i] = BIDI_STRING_TYPE_ST5; //Bidi-HCG - //BIDI_STRING_TYPE_NOTSET; - - // Big decimal. @E0A - i = BIG_DECIMAL; - dpi_[i] = new DriverPropertyInfo (BIG_DECIMAL_, ""); - dpi_[i].description = "BIG_DECIMAL_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = FALSE_; - dpi_[i].choices[1] = TRUE_; - defaults_[i] = TRUE_; - - // Block criteria. - i = BLOCK_CRITERIA; - dpi_[i] = new DriverPropertyInfo (BLOCK_CRITERIA_, ""); - dpi_[i].description = "BLOCK_CRITERIA_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[3]; - dpi_[i].choices[0] = BLOCK_CRITERIA_NONE; - dpi_[i].choices[1] = BLOCK_CRITERIA_IF_FETCH; - dpi_[i].choices[2] = BLOCK_CRITERIA_UNLESS_UPDATE; - defaults_[i] = BLOCK_CRITERIA_UNLESS_UPDATE; - - // Block size. - i = BLOCK_SIZE; - dpi_[i] = new DriverPropertyInfo (BLOCK_SIZE_, ""); - dpi_[i].description = "BLOCK_SIZE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[8]; - dpi_[i].choices[0] = BLOCK_SIZE_0; - dpi_[i].choices[1] = BLOCK_SIZE_8; - dpi_[i].choices[2] = BLOCK_SIZE_16; - dpi_[i].choices[3] = BLOCK_SIZE_32; - dpi_[i].choices[4] = BLOCK_SIZE_64; - dpi_[i].choices[5] = BLOCK_SIZE_128; - dpi_[i].choices[6] = BLOCK_SIZE_256; - dpi_[i].choices[7] = BLOCK_SIZE_512; - defaults_[i] = BLOCK_SIZE_32; - - // Cursor Hold. @D1 - i = CURSOR_HOLD; - dpi_[i] = new DriverPropertyInfo (CURSOR_HOLD_, ""); - dpi_[i].description = "CURSOR_HOLD_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = TRUE_; - - // Cursor sensitivity @F6 - i = CURSOR_SENSITIVITY; - dpi_[i] = new DriverPropertyInfo (CURSOR_SENSITIVITY_, ""); - dpi_[i].description = "CURSOR_SENSITIVITY_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[3]; - dpi_[i].choices[0] = CURSOR_SENSITIVITY_ASENSITIVE; - dpi_[i].choices[1] = CURSOR_SENSITIVITY_INSENSITIVE; - dpi_[i].choices[2] = CURSOR_SENSITIVITY_SENSITIVE; - defaults_[i] = CURSOR_SENSITIVITY_ASENSITIVE; //@K6C - - // Data compression. @D0A - i = DATA_COMPRESSION; - dpi_[i] = new DriverPropertyInfo (DATA_COMPRESSION_, ""); - dpi_[i].description = "DATA_COMPRESSION_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = FALSE_; - dpi_[i].choices[1] = TRUE_; - defaults_[i] = TRUE_; // @F3C - - // Data truncation. @C1A - i = DATA_TRUNCATION; - dpi_[i] = new DriverPropertyInfo (DATA_TRUNCATION_, ""); - dpi_[i].description = "DATA_TRUNCATION_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = TRUE_; // @F2C - - - // Database Name. //@J2A - i = DATABASE_NAME; - dpi_[i] = new DriverPropertyInfo (DATABASE_NAME_, ""); - dpi_[i].description = "DATABASE_NAME_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = EMPTY_; - - - // Date format. The order that the choices are listed - // is significant - the index matches the system value. - // These also correspond to the constants defined in - // SQLConversionSettings. - i = DATE_FORMAT; - dpi_[i] = new DriverPropertyInfo (DATE_FORMAT_, ""); - dpi_[i].description = "DATE_FORMAT_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[8]; - dpi_[i].choices[0] = DATE_FORMAT_JULIAN; - dpi_[i].choices[1] = DATE_FORMAT_MDY; - dpi_[i].choices[2] = DATE_FORMAT_DMY; - dpi_[i].choices[3] = DATE_FORMAT_YMD; - dpi_[i].choices[4] = DATE_FORMAT_USA; - dpi_[i].choices[5] = DATE_FORMAT_ISO; - dpi_[i].choices[6] = DATE_FORMAT_EUR; - dpi_[i].choices[7] = DATE_FORMAT_JIS; - defaults_[i] = DATE_FORMAT_NOTSET; - - // Date separator. The order that the choices are listed - // is significant - the index matches the system value. - i = DATE_SEPARATOR; - dpi_[i] = new DriverPropertyInfo (DATE_SEPARATOR_, ""); - dpi_[i].description = "DATE_SEPARATOR_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[5]; - dpi_[i].choices[0] = DATE_SEPARATOR_SLASH; - dpi_[i].choices[1] = DATE_SEPARATOR_DASH; - dpi_[i].choices[2] = DATE_SEPARATOR_PERIOD; - dpi_[i].choices[3] = DATE_SEPARATOR_COMMA; - dpi_[i].choices[4] = DATE_SEPARATOR_SPACE; - defaults_[i] = DATE_SEPARATOR_NOTSET; - - // Decimal separator. The order that the choices are listed - // is significant - the index matches the system value. - i = DECIMAL_SEPARATOR; - dpi_[i] = new DriverPropertyInfo (DECIMAL_SEPARATOR_, ""); - dpi_[i].description = "DECIMAL_SEPARATOR_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = DECIMAL_SEPARATOR_PERIOD; - dpi_[i].choices[1] = DECIMAL_SEPARATOR_COMMA; - defaults_[i] = DECIMAL_SEPARATOR_NOTSET; - - // Driver. @E3A - i = DRIVER; - dpi_[i] = new DriverPropertyInfo(DRIVER_, ""); - dpi_[i].description = "DRIVER_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - //@F4D dpi_[i].choices[0] = DRIVER_DEFAULT; - dpi_[i].choices[0] = DRIVER_TOOLBOX; - dpi_[i].choices[1] = DRIVER_NATIVE; - defaults_[i] = DRIVER_TOOLBOX; //@F4C - - // Extended dynamic. - i = EXTENDED_DYNAMIC; - dpi_[i] = new DriverPropertyInfo (EXTENDED_DYNAMIC_, ""); - dpi_[i].description = "EXTENDED_DYNAMIC_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = FALSE_; - - - // Extended metadata. @F5A - i = EXTENDED_METADATA; - dpi_[i] = new DriverPropertyInfo (EXTENDED_METADATA_, ""); - dpi_[i].description = "EXTENDED_METADATA_DESC"; //@K7C changed to match the name in JDMRI.java - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = FALSE_; - dpi_[i].choices[1] = TRUE_; - defaults_[i] = FALSE_; - - - // Errors. - i = ERRORS; - dpi_[i] = new DriverPropertyInfo (ERRORS_, ""); - dpi_[i].description = "ERRORS_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[1] = ERRORS_BASIC; - dpi_[i].choices[0] = ERRORS_FULL; - defaults_[i] = ERRORS_BASIC; - - // KeyRingName. //@F1A - i = KEY_RING_NAME; - dpi_[i] = new DriverPropertyInfo (KEY_RING_NAME_, ""); - dpi_[i].description = "KEY_RING_NAME_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = EMPTY_; - - - // KeyRingPassword. //@F1A - i = KEY_RING_PASSWORD; - dpi_[i] = new DriverPropertyInfo (KEY_RING_PASSWORD_, ""); - dpi_[i].description = "KEY_RING_PASSWORD_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = EMPTY_; - - // login timeout. //@K5A - i = LOGIN_TIMEOUT; - dpi_[i] = new DriverPropertyInfo (LOGIN_TIMEOUT_, ""); - dpi_[i].description = "LOGIN_TIMEOUT_DESC"; //@K7C changed to match the description name in JDMRI.java - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = EMPTY_; - - // Full Open. @W1a - i = FULL_OPEN; - dpi_[i] = new DriverPropertyInfo (FULL_OPEN_, ""); - dpi_[i].description = "FULL_OPEN_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = FALSE_; - dpi_[i].choices[1] = TRUE_; - defaults_[i] = FALSE_; - - - // Lazy close. @E2A - i = LAZY_CLOSE; - dpi_[i] = new DriverPropertyInfo (LAZY_CLOSE_, ""); - dpi_[i].description = "LAZY_CLOSE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = FALSE_; - dpi_[i].choices[1] = TRUE_; - defaults_[i] = FALSE_; //@E6C - - // Libraries. - i = LIBRARIES; - dpi_[i] = new DriverPropertyInfo (LIBRARIES_, ""); - dpi_[i].description = "LIBRARIES_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = EMPTY_; - - // LOB threshold. - i = LOB_THRESHOLD; - dpi_[i] = new DriverPropertyInfo (LOB_THRESHOLD_, ""); - dpi_[i].description = "LOB_THRESHOLD_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = "32768"; - - // Naming. The order that the choices are listed - // is significant - the index matches the system value. - i = NAMING; - dpi_[i] = new DriverPropertyInfo (NAMING_, ""); - dpi_[i].description = "NAMING_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = NAMING_SQL; - dpi_[i].choices[1] = NAMING_SYSTEM; - defaults_[i] = NAMING_SQL; - - // Package. - i = PACKAGE; - dpi_[i] = new DriverPropertyInfo (PACKAGE_, ""); - dpi_[i].description = "PACKAGE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = EMPTY_; - - // Package add. - i = PACKAGE_ADD; - dpi_[i] = new DriverPropertyInfo (PACKAGE_ADD_, ""); - dpi_[i].description = "PACKAGE_ADD_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = TRUE_; - - // Package cache. - i = PACKAGE_CACHE; - dpi_[i] = new DriverPropertyInfo (PACKAGE_CACHE_, ""); - dpi_[i].description = "PACKAGE_CACHE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = FALSE_; - - // Package clear. - i = PACKAGE_CLEAR; - dpi_[i] = new DriverPropertyInfo (PACKAGE_CLEAR_, ""); - dpi_[i].description = "PACKAGE_CLEAR_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = FALSE_; - - // @A0A - // Package criteria. - i = PACKAGE_CRITERIA; - dpi_[i] = new DriverPropertyInfo (PACKAGE_CRITERIA_, ""); - dpi_[i].description = "PACKAGE_CRITERIA_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = PACKAGE_CRITERIA_DEFAULT; - dpi_[i].choices[1] = PACKAGE_CRITERIA_SELECT; - defaults_[i] = PACKAGE_CRITERIA_DEFAULT; - // End of @A0A - - // Package error. - i = PACKAGE_ERROR; - dpi_[i] = new DriverPropertyInfo (PACKAGE_ERROR_, ""); - dpi_[i].description = "PACKAGE_ERROR_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[3]; - dpi_[i].choices[0] = PACKAGE_ERROR_NONE; - dpi_[i].choices[1] = PACKAGE_ERROR_WARNING; - dpi_[i].choices[2] = PACKAGE_ERROR_EXCEPTION; - defaults_[i] = PACKAGE_ERROR_WARNING; - - // Package library. - i = PACKAGE_LIBRARY; - dpi_[i] = new DriverPropertyInfo (PACKAGE_LIBRARY_, ""); - dpi_[i].description = "PACKAGE_LIBRARY_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = EMPTY_; - - // Password. - i = PASSWORD; - dpi_[i] = new DriverPropertyInfo (PASSWORD_, ""); - dpi_[i].description = "PASSWORD_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = EMPTY_; - - // Prefetch. - i = PREFETCH; - dpi_[i] = new DriverPropertyInfo (PREFETCH_, ""); - dpi_[i].description = "PREFETCH_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = TRUE_; - - // Prompt. - i = PROMPT; - dpi_[i] = new DriverPropertyInfo (PROMPT_, ""); - dpi_[i].description = "PROMPT_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = NOT_SPECIFIED; // @E8C - - // Proxy server. //@A3A - i = PROXY_SERVER; - dpi_[i] = new DriverPropertyInfo (PROXY_SERVER_, ""); - dpi_[i].description = "PROXY_SERVER_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = EMPTY_; - - // Proxy server secure. //@A3A - //i = PROXY_SERVER_SECURE; - //dpi_[i] = new DriverPropertyInfo (PROXY_SERVER_SECURE_, ""); - //dpi_[i].description = "PROXY_SERVER_SECURE_DESC"; - //dpi_[i].required = false; - //dpi_[i].choices = new String[2]; - //dpi_[i].choices[0] = TRUE_; - //dpi_[i].choices[1] = FALSE_; - //defaults_[i] = FALSE_; - - // Remarks. - i = REMARKS; - dpi_[i] = new DriverPropertyInfo (REMARKS_, ""); - dpi_[i].description = "REMARKS_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = REMARKS_SQL; - dpi_[i].choices[1] = REMARKS_SYSTEM; - defaults_[i] = REMARKS_SYSTEM; - - // Secondary URL. //@A3A - i = SECONDARY_URL; - dpi_[i] = new DriverPropertyInfo (SECONDARY_URL_, ""); - dpi_[i].description = "SECONDARY_URL_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = EMPTY_; - - // Secure. - i = SECURE; - dpi_[i] = new DriverPropertyInfo (SECURE_, ""); - dpi_[i].description = "SECURE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = FALSE_; - - // Sort. - i = SORT; - dpi_[i] = new DriverPropertyInfo (SORT_, ""); - dpi_[i].description = "SORT_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[3]; //@PDC - dpi_[i].choices[0] = SORT_HEX; - //@PDD dpi_[i].choices[1] = SORT_JOB; - dpi_[i].choices[1] = SORT_LANGUAGE1; //@PDC - dpi_[i].choices[2] = SORT_TABLE1; //@PDC - defaults_[i] = SORT_HEX; //@PDC - - // Sort language. - // - // We set the default to Engligh United States. At first, we set @E4A - // it to " " (3 spaces), but that causes a host server error. @E4A - // It would probably be better to choose a default based on the client @E4A - // locale, but that may prove to be a high-maintenance mapping, @E4A - // as locales are added to Java and languages are added to the system. @E4A - i = SORT_LANGUAGE; - dpi_[i] = new DriverPropertyInfo (SORT_LANGUAGE_, ""); - dpi_[i].description = "SORT_LANGUAGE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = SORT_LANGUAGE_ENGLISH_UNITED_STATES; // @E4C - - // Sort table. - i = SORT_TABLE; - dpi_[i] = new DriverPropertyInfo (SORT_TABLE_, ""); - dpi_[i].description = "SORT_TABLE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = EMPTY_; - - // Sort weight. - i = SORT_WEIGHT; - dpi_[i] = new DriverPropertyInfo (SORT_WEIGHT_, ""); - dpi_[i].description = "SORT_WEIGHT_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = SORT_WEIGHT_SHARED; - dpi_[i].choices[1] = SORT_WEIGHT_UNIQUE; - defaults_[i] = SORT_WEIGHT_SHARED; - - // Thread used. // @E1C - i = THREAD_USED; - dpi_[i] = new DriverPropertyInfo (THREAD_USED_, ""); - dpi_[i].description = "THREAD_USED_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = TRUE_; - - // Time format. The order that the choices are listed - // is significant - the index matches the system value. - // These also correspond to the constants defined in - // SQLConversionSettings. - i = TIME_FORMAT; - dpi_[i] = new DriverPropertyInfo (TIME_FORMAT_, ""); - dpi_[i].description = "TIME_FORMAT_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[5]; - dpi_[i].choices[0] = TIME_FORMAT_HMS; - dpi_[i].choices[1] = TIME_FORMAT_USA; - dpi_[i].choices[2] = TIME_FORMAT_ISO; - dpi_[i].choices[3] = TIME_FORMAT_EUR; - dpi_[i].choices[4] = TIME_FORMAT_JIS; - defaults_[i] = TIME_FORMAT_NOTSET; - - // Time separator. The order that the choices are listed - // is significant - the index matches the system value. - i = TIME_SEPARATOR; - dpi_[i] = new DriverPropertyInfo (TIME_SEPARATOR_, ""); - dpi_[i].description = "TIME_SEPARATOR_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[4]; - dpi_[i].choices[0] = TIME_SEPARATOR_COLON; - dpi_[i].choices[1] = TIME_SEPARATOR_PERIOD; - dpi_[i].choices[2] = TIME_SEPARATOR_COMMA; - dpi_[i].choices[3] = TIME_SEPARATOR_SPACE; - defaults_[i] = TIME_SEPARATOR_NOTSET; - - // Trace. - i = TRACE; - dpi_[i] = new DriverPropertyInfo (TRACE_, ""); - dpi_[i].description = "TRACE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = FALSE_; - - // @j1a - // Trace Server - i = TRACE_SERVER; - dpi_[i] = new DriverPropertyInfo (TRACE_SERVER_, ""); - dpi_[i].description = "TRACE_SERVER_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = "0"; - - // @K1A - // Trace Toolbox - i = TRACE_TOOLBOX; - dpi_[i] = new DriverPropertyInfo (TRACE_TOOLBOX_, ""); - dpi_[i].description = "TRACE_TOOLBOX_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[12]; - dpi_[i].choices[0] = TRACE_TOOLBOX_NONE; - dpi_[i].choices[1] = TRACE_TOOLBOX_DATASTREAM; - dpi_[i].choices[2] = TRACE_TOOLBOX_DIAGNOSTIC; - dpi_[i].choices[3] = TRACE_TOOLBOX_ERROR; - dpi_[i].choices[4] = TRACE_TOOLBOX_INFORMATION; - dpi_[i].choices[5] = TRACE_TOOLBOX_WARNING; - dpi_[i].choices[6] = TRACE_TOOLBOX_CONVERSION; - dpi_[i].choices[7] = TRACE_TOOLBOX_PROXY; - dpi_[i].choices[8] = TRACE_TOOLBOX_PCML; - dpi_[i].choices[9] = TRACE_TOOLBOX_JDBC; - dpi_[i].choices[10] = TRACE_TOOLBOX_ALL; - dpi_[i].choices[11] = TRACE_TOOLBOX_THREAD; - defaults_[i] = TRACE_TOOLBOX_NOT_SET; - - // Transaction isolation. - i = TRANSACTION_ISOLATION; - dpi_[i] = new DriverPropertyInfo (TRANSACTION_ISOLATION_, ""); - dpi_[i].description = "TRANSACTION_ISOLATION_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[5]; - dpi_[i].choices[0] = TRANSACTION_ISOLATION_NONE; - dpi_[i].choices[1] = TRANSACTION_ISOLATION_READ_COMMITTED; - dpi_[i].choices[2] = TRANSACTION_ISOLATION_READ_UNCOMMITTED; - dpi_[i].choices[3] = TRANSACTION_ISOLATION_REPEATABLE_READ; - dpi_[i].choices[4] = TRANSACTION_ISOLATION_SERIALIZABLE; - defaults_[i] = TRANSACTION_ISOLATION_READ_UNCOMMITTED; - - // Translate binary. - i = TRANSLATE_BINARY; - dpi_[i] = new DriverPropertyInfo (TRANSLATE_BINARY_, ""); - dpi_[i].description = "TRANSLATE_BINARY_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = FALSE_; - - // User. - i = USER; - dpi_[i] = new DriverPropertyInfo (USER_, ""); - dpi_[i].description = "USER_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = EMPTY_; - - // @M0A - Support sending statements in UTF-16 and storing them in a UTF-16 package - i = PACKAGE_CCSID; - dpi_[i] = new DriverPropertyInfo(PACKAGE_CCSID_, ""); - dpi_[i].description = "PACKAGE_CCSID_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[3];//Bidi-HCG - dpi_[i].choices[0] = PACKAGE_CCSID_UCS2; - dpi_[i].choices[1] = PACKAGE_CCSID_UTF16; - dpi_[i].choices[2] = "system"; //Bidi-HCG - defaults_[i] = PACKAGE_CCSID_UCS2; - - // @M0A - 63 digit decimal precision - i = MINIMUM_DIVIDE_SCALE; - dpi_[i] = new DriverPropertyInfo(MINIMUM_DIVIDE_SCALE_, ""); - dpi_[i].description = "MINIMUM_DIVIDE_SCALE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[10]; - dpi_[i].choices[0] = MINIMUM_DIVIDE_SCALE_0; - dpi_[i].choices[1] = MINIMUM_DIVIDE_SCALE_1; - dpi_[i].choices[2] = MINIMUM_DIVIDE_SCALE_2; - dpi_[i].choices[3] = MINIMUM_DIVIDE_SCALE_3; - dpi_[i].choices[4] = MINIMUM_DIVIDE_SCALE_4; - dpi_[i].choices[5] = MINIMUM_DIVIDE_SCALE_5; - dpi_[i].choices[6] = MINIMUM_DIVIDE_SCALE_6; - dpi_[i].choices[7] = MINIMUM_DIVIDE_SCALE_7; - dpi_[i].choices[8] = MINIMUM_DIVIDE_SCALE_8; - dpi_[i].choices[9] = MINIMUM_DIVIDE_SCALE_9; //@K2C changed choices[8] to choices[9] - defaults_[i] = MINIMUM_DIVIDE_SCALE_0; - - i = MAXIMUM_PRECISION; - dpi_[i] = new DriverPropertyInfo(MAXIMUM_PRECISION_, ""); - dpi_[i].description = "MAXIMUM_PRECISION_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = MAXIMUM_PRECISION_31; - dpi_[i].choices[1] = MAXIMUM_PRECISION_63; - defaults_[i] = MAXIMUM_PRECISION_31; - - i = MAXIMUM_SCALE; - dpi_[i] = new DriverPropertyInfo(MAXIMUM_SCALE_, ""); - dpi_[i].description = "MAXIMUM_SCALE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[64]; - for(int j=0; j<64; ++j) dpi_[i].choices[j] = Integer.toString(j); - defaults_[i] = MAXIMUM_SCALE_31; - - // @M0A - support hex constant parser option - i = TRANSLATE_HEX; - dpi_[i] = new DriverPropertyInfo(TRANSLATE_HEX_, ""); - dpi_[i].description = "TRANSLATE_HEX_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRANSLATE_HEX_CHARACTER; - dpi_[i].choices[1] = TRANSLATE_HEX_BINARY; - defaults_[i] = TRANSLATE_HEX_CHARACTER; - - // @K2A - support to specify a QAQQINI library name - i = QAQQINILIB; - dpi_[i] = new DriverPropertyInfo(QAQQINILIB_, ""); - dpi_[i].description = "QAQQINILIB_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = EMPTY_; - - // True Auto Commit. @KBA - i = TRUE_AUTO_COMMIT; //@true - dpi_[i] = new DriverPropertyInfo (TRUE_AUTO_COMMIT_, ""); //@true - dpi_[i].description = "TRUE_AUTO_COMMIT_DESC"; //@true - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = FALSE_; - dpi_[i].choices[1] = TRUE_; - defaults_[i] = FALSE_; - - // Hold Locators. @KBL - i = HOLD_LOCATORS; - dpi_[i] = new DriverPropertyInfo (HOLD_LOCATORS_, ""); - dpi_[i].description = "HOLD_LOCATORS_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = FALSE_; - dpi_[i].choices[1] = TRUE_; - defaults_[i] = TRUE_; - - // Bidi implicit reordering @K24 - i = BIDI_IMPLICIT_REORDERING; - dpi_[i] = new DriverPropertyInfo (BIDI_IMPLICIT_REORDERING_, ""); - dpi_[i].description = "BIDI_IMPLICIT_REORDERING_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = FALSE_; - dpi_[i].choices[1] = TRUE_; - defaults_[i] = TRUE_; - - // Bidi Numeric Ordering. @K24 - i = BIDI_NUMERIC_ORDERING; - dpi_[i] = new DriverPropertyInfo (BIDI_NUMERIC_ORDERING_, ""); - dpi_[i].description = "BIDI_NUMERIC_ORDERING_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = FALSE_; - dpi_[i].choices[1] = TRUE_; - defaults_[i] = FALSE_; - - // Hold Statements. @KBL - i = HOLD_STATEMENTS; - dpi_[i] = new DriverPropertyInfo (HOLD_STATEMENTS_, ""); - dpi_[i].description = "HOLD_STATEMENTS_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = FALSE_; - dpi_[i].choices[1] = TRUE_; - defaults_[i] = FALSE_; - - // Rollback Cursor Hold. @K94 - i = ROLLBACK_CURSOR_HOLD; - dpi_[i] = new DriverPropertyInfo (ROLLBACK_CURSOR_HOLD_, ""); - dpi_[i].description = "ROLLBACK_CURSOR_HOLD_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = FALSE_; - - // Variable-Length Field Compression @K54 - i = VARIABLE_FIELD_COMPRESSION; - dpi_[i] = new DriverPropertyInfo (VARIABLE_FIELD_COMPRESSION_, ""); - dpi_[i].description = "VARIABLE_FIELD_COMPRESSION_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = FALSE_; - dpi_[i].choices[1] = TRUE_; - defaults_[i] = TRUE_; - - // Query Optimize Goal //@540 - i = QUERY_OPTIMIZE_GOAL; - dpi_[i] = new DriverPropertyInfo (QUERY_OPTIMIZE_GOAL_, ""); - dpi_[i].description = "QUERY_OPTIMIZE_GOAL_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[3]; - dpi_[i].choices[0] = QUERY_OPTIMIZE_GOAL_DEFAULT; - dpi_[i].choices[1] = QUERY_OPTIMIZE_GOAL_FIRSTIO; - dpi_[i].choices[2] = QUERY_OPTIMIZE_GOAL_ALLIO; - defaults_[i] = QUERY_OPTIMIZE_GOAL_DEFAULT; - - // Keep alive. - i = KEEP_ALIVE; - dpi_[i] = new DriverPropertyInfo (KEEP_ALIVE_, ""); - dpi_[i].description = "KEEP_ALIVE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = FALSE_; - dpi_[i].choices[1] = TRUE_; - defaults_[i] = EMPTY_; //default set by platform - - // Receive buffer size. - i = RECEIVE_BUFFER_SIZE; - dpi_[i] = new DriverPropertyInfo (RECEIVE_BUFFER_SIZE_, ""); - dpi_[i].description = "RECEIVE_BUFFER_SIZE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = EMPTY_; //default set by platform - - // Send buffer size. - i = SEND_BUFFER_SIZE; - dpi_[i] = new DriverPropertyInfo (SEND_BUFFER_SIZE_, ""); - dpi_[i].description = "SEND_BUFFER_SIZE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = EMPTY_; //default set by platform - - // XA Loosely Coupled Support //@540 - i = XA_LOOSELY_COUPLED_SUPPORT; - dpi_[i] = new DriverPropertyInfo (XA_LOOSELY_COUPLED_SUPPORT_, ""); - dpi_[i].description = "XA_LOOSELY_COUPLED_SUPPORT_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = XA_LOOSELY_COUPLED_SUPPORT_NOT_SHARED; - dpi_[i].choices[1] = XA_LOOSELY_COUPLED_SUPPORT_SHARED; - defaults_[i] = XA_LOOSELY_COUPLED_SUPPORT_NOT_SHARED; - - // Translate Boolean //@PDA - i = TRANSLATE_BOOLEAN; - dpi_[i] = new DriverPropertyInfo (TRANSLATE_BOOLEAN_, ""); - dpi_[i].description = "TRANSLATE_BOOLEAN_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = FALSE_; - dpi_[i].choices[1] = TRUE_; - defaults_[i] = TRUE_; - - // Database Metadata //@PDA - i = METADATA_SOURCE; - dpi_[i] = new DriverPropertyInfo (METADATA_SOURCE_, ""); - dpi_[i].description = "METADATA_SOURCE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[3]; //@mdsp - dpi_[i].choices[0] = METADATA_SOURCE_ROI; - dpi_[i].choices[1] = METADATA_SOURCE_STORED_PROCEDURE; - dpi_[i].choices[2] = METADATA_SOURCE_HOST_VERSION_DEFAULT; //@mdsp - defaults_[i] = METADATA_SOURCE_HOST_VERSION_DEFAULT; //@mdsp - - // Query Storage Limit //@550 - i = QUERY_STORAGE_LIMIT; - dpi_[i] = new DriverPropertyInfo (QUERY_STORAGE_LIMIT_, ""); - dpi_[i].description = "QUERY_STORAGE_LIMIT_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = QUERY_STORAGE_LIMIT_NOMAX; - - // Decfloat Rounding Mode //@DFA - i = DECFLOAT_ROUNDING_MODE; - dpi_[i] = new DriverPropertyInfo (DECFLOAT_ROUNDING_MODE_, ""); - dpi_[i].description = "DECFLOAT_ROUNDING_MODE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[7]; - dpi_[i].choices[0] = DECFLOAT_ROUNDING_MODE_HALF_EVEN; - dpi_[i].choices[1] = DECFLOAT_ROUNDING_MODE_HALF_UP; - dpi_[i].choices[2] = DECFLOAT_ROUNDING_MODE_DOWN; - dpi_[i].choices[3] = DECFLOAT_ROUNDING_MODE_CEILING; - dpi_[i].choices[4] = DECFLOAT_ROUNDING_MODE_FLOOR; - dpi_[i].choices[5] = DECFLOAT_ROUNDING_MODE_HALF_DOWN; - dpi_[i].choices[6] = DECFLOAT_ROUNDING_MODE_UP; - defaults_[i] = DECFLOAT_ROUNDING_MODE_HALF_EVEN; - - // Autocommit Exception //@CE1 - i = AUTOCOMMIT_EXCEPTION; - dpi_[i] = new DriverPropertyInfo (AUTOCOMMIT_EXCEPTION_, ""); - dpi_[i].description = "AUTOCOMMIT_EXCEPTION_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = FALSE_; - - // Auto Commit //@AC1 - i = AUTO_COMMIT; - dpi_[i] = new DriverPropertyInfo (AUTO_COMMIT_, ""); - dpi_[i].description = "AUTO_COMMIT_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = TRUE_; - - // Ignore Warnings //@igwrn - i = IGNORE_WARNINGS; - dpi_[i] = new DriverPropertyInfo (IGNORE_WARNINGS_, ""); - dpi_[i].description = "IGNORE_WARNINGS_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = EMPTY_; - - // Secure Current User //@pw3 - i = SECURE_CURRENT_USER; - dpi_[i] = new DriverPropertyInfo (SECURE_CURRENT_USER_, ""); - dpi_[i].description = "SECURE_CURRENT_USER_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = TRUE_; - - // Concurrent Access Resolution //@cc1 - i = CONCURRENT_ACCESS_RESOLUTION; - dpi_[i] = new DriverPropertyInfo (CONCURRENT_ACCESS_RESOLUTION_, ""); - dpi_[i].description = "CONCURRENT_ACCESS_RESOLUTION_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[4]; - dpi_[i].choices[0] = CONCURRENTACCESS_NOT_SET; - dpi_[i].choices[1] = CONCURRENTACCESS_USE_CURRENTLY_COMMITTED; - dpi_[i].choices[2] = CONCURRENTACCESS_WAIT_FOR_OUTCOME; - dpi_[i].choices[3] = CONCURRENTACCESS_SKIP_LOCKS; - defaults_[i] = CONCURRENTACCESS_NOT_SET; - - // Jvm16 Synchronize //@dmy - i = JVM16_SYNCHRONIZE; - dpi_[i] = new DriverPropertyInfo (JVM16_SYNCHRONIZE_, ""); - dpi_[i].description = "JVM16_SYNCHRONIZE_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = FALSE_; /* @C6A*/ - - // Socket timeout //@STIMEOUT - i = SOCKET_TIMEOUT; - dpi_[i] = new DriverPropertyInfo (SOCKET_TIMEOUT_, ""); - dpi_[i].description = "SOCKET_TIMEOUT_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[0]; - defaults_[i] = EMPTY_; //default set by platform - - - // Socket timeout //@STIMEOUT - i = DO_UPDATE_DELETE_BLOCKING; - dpi_[i] = new DriverPropertyInfo (DO_UPDATE_DELETE_BLOCKING_, ""); - dpi_[i].description = "DO_UPDATE_DELETE_BLOCKING_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[2]; - dpi_[i].choices[0] = TRUE_; - dpi_[i].choices[1] = FALSE_; - defaults_[i] = FALSE_; - - - - i = MAXIMUM_BLOCKED_INPUT_ROWS; - dpi_[i] = new DriverPropertyInfo (MAXIMUM_BLOCKED_INPUT_ROWS_, ""); - dpi_[i].description = "MAXIMUM_BLOCKED_INPUT_ROWS_DESC"; - dpi_[i].required = false; - dpi_[i].choices = new String[6]; - dpi_[i].choices[0] = "1000"; - dpi_[i].choices[1] = "2000"; - dpi_[i].choices[2] = "4000"; - dpi_[i].choices[3] = "8000"; - dpi_[i].choices[4] = "16000"; - dpi_[i].choices[5] = "32000"; - defaults_[i] = "32000"; - - - - } - - - /** - Constructor. - **/ - JDProperties () - { - this(null, null); - } - - /** - Constructor. - - @param urlProperties The URL properties. - @param info The info properties. - **/ - JDProperties (Properties urlProperties, Properties info) - { - // Initialize the values. - info_ = info; - values_ = new String[NUMBER_OF_ATTRIBUTES_]; - for(int i = 0; i < NUMBER_OF_ATTRIBUTES_; ++i) - setString (i, getProperty (urlProperties, info, dpi_[i].name)); - - // Check both sets of properties for any extra - // properties. - extra_ = false; - - Enumeration propertyNames; - boolean found; - String propertyName; - - if(urlProperties != null) - { - propertyNames = urlProperties.propertyNames (); - while((propertyNames.hasMoreElements ()) /* @C4D && (extra_ == false) */) - { - propertyName = (String) propertyNames.nextElement (); - if(propertyName.length () > 0) - { - found = false; - for(int j = 0; (j < NUMBER_OF_ATTRIBUTES_) && (! found); ++j) - if(propertyName.equalsIgnoreCase (dpi_[j].name)) - found = true; - - if(! found) // @D1 - Websphere uses "CURSORHOLD" - { - if(propertyName.equalsIgnoreCase(CURSORHOLD_)) - { - String value = getProperty (urlProperties, info, CURSORHOLD_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, propertyName + ": " + value); - - if(value.equalsIgnoreCase(CURSORHOLD_YES)) - setString(CURSOR_HOLD, TRUE_); - else if(value.equalsIgnoreCase(CURSORHOLD_NO)) - setString(CURSOR_HOLD, FALSE_); - } - else - { - extra_ = true; - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Extra property: \"" - + propertyName + "\""); - } - } - //if (! found) { // @D1 - // extra_ = true; - // if (JDTrace.isTraceOn()) - // JDTrace.logInformation (this, "Extra property: \"" - // + propertyName + "\""); - //} - } - } - } - - if(info != null) - { - propertyNames = info.propertyNames (); - while((propertyNames.hasMoreElements ()) /* @C4D && (extra_ == false) */) - { - propertyName = (String) propertyNames.nextElement (); - if(propertyName.length () > 0) - { - found = false; - for(int j = 0; (j < NUMBER_OF_ATTRIBUTES_) && (! found); ++j) - if(propertyName.equalsIgnoreCase (dpi_[j].name)) - found = true; - - if(! found) // @D1 - Websphere uses "CURSORHOLD" - { - if(propertyName.equalsIgnoreCase(CURSORHOLD_)) - { - String value = getProperty (urlProperties, info, CURSORHOLD_); - - if(JDTrace.isTraceOn()) - JDTrace.logInformation(this, propertyName + ": " + value); - - if(value.equalsIgnoreCase(CURSORHOLD_YES)) - setString(CURSOR_HOLD, TRUE_); - else if(value.equalsIgnoreCase(CURSORHOLD_NO)) - setString(CURSOR_HOLD, FALSE_); - } - else - { - extra_ = true; - if(JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Extra property: \"" - + propertyName + "\""); - } - } - //if (! found) { // @D1 - // extra_ = true; - // if (JDTrace.isTraceOn()) - // JDTrace.logInformation (this, "Extra property: \"" - // + propertyName + "\""); - //} - } - } - } - } - - //@PDA 550 - clone - /** - * Method to create a clone of JDProperties. - * This makes a semi-deep copy of values_ array, so both values_ array references point to separate array objects. - */ - public Object clone() - { - try - { - JDProperties clone = (JDProperties) super.clone(); - clone.values_ = (String[]) this.values_.clone(); - //since Strings are immutable, no need to clone String objects that both arrays refer to. - return clone; - } catch (CloneNotSupportedException e) - { // This should never happen. - Trace.log(Trace.ERROR, e); - throw new UnsupportedOperationException("clone()"); - } - } - - /** - Is the value of the specified property set to the specified - value? The comparison is case insensitive. - - @param index Property index. - @param value Value to compare to. - @return true or false. - **/ - boolean equals (int index, String value) - { - return getString (index).equalsIgnoreCase (value); - } - - - - - /** - Get the driver property info. - - @return The info. - **/ - DriverPropertyInfo[] getInfo () - { - // Make a complete copy of the table so that if the - // caller modifies it, it will not affect the connection. - // - DriverPropertyInfo[] dpi = new DriverPropertyInfo[NUMBER_OF_ATTRIBUTES_]; - - for(int i = 0; i < NUMBER_OF_ATTRIBUTES_; ++i) - { - - if(i != PASSWORD && i != KEY_RING_PASSWORD) //@F1C - dpi[i] = new DriverPropertyInfo (dpi_[i].name, values_[i]); - else - dpi[i] = new DriverPropertyInfo (dpi_[i].name, ""); - - dpi[i].required = dpi_[i].required; - dpi[i].choices = new String[dpi_[i].choices.length]; - for(int j = 0; j < dpi_[i].choices.length; ++j) - dpi[i].choices[j] = dpi_[i].choices[j]; - - // Load the actual description from the resource bundle. - dpi[i].description = AS400JDBCDriver.getResource (dpi_[i].description); - } - - return dpi; - } - - - - /** - Get the value of the specified property as a boolean. This - is intended for properties that take "true" and "false" as - values. - - @param index Property index. - @return The value. - **/ - boolean getBoolean (int index) - { - return Boolean.valueOf (values_[index]).booleanValue(); - } - - - - /** - Get the index of the value of the specified property. This - is the index within the list of choices. If the property is - not specified, then the index of the default value will be - returned. If the value does not match a choice, then return -1. - - @param index Property index. - @return The index of the value, or -1. - **/ - int getIndex (int index) - { - for(int i = 0; i < dpi_[index].choices.length; ++i) - if(values_[index].equalsIgnoreCase (dpi_[index].choices[i])) - return i; - return -1; - } - - - - /** - Get the value of the specified property as an int. This - is intended for properties that take integers as values. - - @param index Property index. - @return The value. - **/ - int getInt (int index) - { - try - { // @C2A - return Integer.parseInt (values_[index]); - } // @C2A - catch(NumberFormatException e) - { // @C2A - return 0; // @C2A - } // @C2A - } - - - - // @A3A - /** - Get the original "info" Properties object, that was passed in as the - second argument to the constructor of this object. - - @return The original "info" Properties object. - **/ - Properties getOriginalInfo () - { - return info_; - } - - - //@PDA - /** - Gets index of the property name as indexed in array. - This method is used by AS400JDBCDataSource so that it can - update properties based on property name string. - @param propertyName - @return index of property in array. returns -1 if not found. - **/ - static int getPropertyIndex (String propertyName) - { - for(int i = 0; i < NUMBER_OF_ATTRIBUTES_; i++) - { - if(propertyName.equals(dpi_[i].name)) - { - return i; - } - } - return -1; - } - - - /** - Returns the value of the specified property. The - URL properties are searched first, then the info - properties. - - @param urlProperties The URL properties. - @param info The info properties. - @param propertyName The property name. - **/ - private static String getProperty (Properties urlProperties, - Properties info, - String propertyName) - { - String value = null; - if(urlProperties != null) - value = urlProperties.getProperty (propertyName); - if((value == null) && (info != null)) - value = info.getProperty (propertyName); - - return value; - } - - - - /** - Get the value of the specified property. If the property is - not specified, then the default value will be returned. If - choices are allowed, then the value will be compared against - the choices, and if none match, the default value will be - returned. - - @param index Property index. - @return The value. - **/ - String getString (int index) - { - String value = values_[index]; - - if(index == PASSWORD || index == KEY_RING_PASSWORD) //@F1C - values_[index] = ""; - - return value.trim(); - } - - - - /** - Indicates if any extra properties are specified. - - @param properties The properties. - @return true or false - **/ - boolean isExtraPropertySpecified () - { - return extra_; - } - - - - /** - Indicates if the trace property is set. This needs to be - detected before an object of this class is even instantiated, - which is why it is static. - - @param urlProperties The URL properties. - @param info The info properties. - @return Whether the trace property was set to true, false, or not specified when constructed. - **/ - static String isTraceSet (Properties urlProperties, Properties info) //@E7C - { - if(getProperty (urlProperties, info, TRACE_) == null) - return TRACE_NOT_SPECIFIED; - else if(Boolean.valueOf(getProperty (urlProperties, info, TRACE_)).booleanValue()) - return TRACE_SET_ON; - else - return TRACE_SET_OFF; - //@E7D return Boolean.valueOf (getProperty (urlProperties, info, TRACE_)).booleanValue(); - } - - //@K1A - /** - Indicates if a toolbox trace category is set. - - @param urlProperties The URL properties. - @param info The info properties. - @return The category the toolbox trace was set to when constructed. - **/ - static String isToolboxTraceSet (Properties urlProperties, Properties info) - { - if(getProperty (urlProperties, info, TRACE_TOOLBOX_) == null) - return TRACE_TOOLBOX_NOT_SET; - else if(getProperty (urlProperties, info, TRACE_TOOLBOX_).equalsIgnoreCase(TRACE_TOOLBOX_DATASTREAM)) - return TRACE_TOOLBOX_DATASTREAM; - else if(getProperty (urlProperties, info, TRACE_TOOLBOX_).equalsIgnoreCase(TRACE_TOOLBOX_DIAGNOSTIC)) - return TRACE_TOOLBOX_DIAGNOSTIC; - else if(getProperty (urlProperties, info, TRACE_TOOLBOX_).equalsIgnoreCase(TRACE_TOOLBOX_ERROR)) - return TRACE_TOOLBOX_ERROR; - else if(getProperty (urlProperties, info, TRACE_TOOLBOX_).equalsIgnoreCase(TRACE_TOOLBOX_INFORMATION)) - return TRACE_TOOLBOX_INFORMATION; - else if(getProperty (urlProperties, info, TRACE_TOOLBOX_).equalsIgnoreCase(TRACE_TOOLBOX_WARNING)) - return TRACE_TOOLBOX_WARNING; - else if(getProperty (urlProperties, info, TRACE_TOOLBOX_).equalsIgnoreCase(TRACE_TOOLBOX_CONVERSION)) - return TRACE_TOOLBOX_CONVERSION; - else if(getProperty (urlProperties, info, TRACE_TOOLBOX_).equalsIgnoreCase(TRACE_TOOLBOX_PROXY)) - return TRACE_TOOLBOX_PROXY; - else if(getProperty (urlProperties, info, TRACE_TOOLBOX_).equalsIgnoreCase(TRACE_TOOLBOX_PCML)) - return TRACE_TOOLBOX_PCML; - else if(getProperty (urlProperties, info, TRACE_TOOLBOX_).equalsIgnoreCase(TRACE_TOOLBOX_JDBC)) - return TRACE_TOOLBOX_JDBC; - else if(getProperty (urlProperties, info, TRACE_TOOLBOX_).equalsIgnoreCase(TRACE_TOOLBOX_ALL)) - return TRACE_TOOLBOX_ALL; - else if(getProperty (urlProperties, info, TRACE_TOOLBOX_).equalsIgnoreCase(TRACE_TOOLBOX_THREAD)) - return TRACE_TOOLBOX_THREAD; - else if(getProperty (urlProperties, info, TRACE_TOOLBOX_).equalsIgnoreCase(TRACE_TOOLBOX_NONE)) - return TRACE_TOOLBOX_NONE; - else - return TRACE_TOOLBOX_NOT_SET; - } - - - // - // Fix up the properties array when the object is re-inflated. Choices: - // 1) Objects match (the number of properties in the array is the same) -- - // don't do anything. - // 2) Old data into a new object -- fix up the array. In this case the - // array (values_) created during re-serialization is too small. Take - // the fullOpen case. If a v4r5 object is serialized then the values_ - // array contains only 44 elements. When that array is put in a v5r1 object - // the object has the ability to give out fullOpen (element 45). This - // results in a indexOutOfBounds exception since we try to pull the 45th - // element out of an array of size 44. To fix this condition a new array - // will be built. The first N element will come from the old array. The - // last element(s) will be filled in with defaults. - // 3) Data into an older object -- don't do anything. In this case the array - // will be too big but that won't hurt anything. Take again the full open - // case. Suppose a v5r1 object (45 elements) is serialized then de-serialized - // into a v4r5 object. Now values_ has one too many elements. That doesn't - // hurt anything since the code cannot get to the last element. - // - // This scheme works ONLY IF NEW ELEMENTS ARE ALWAYS ADDED TO THE END OF THE ARRAY!!!! - // - // @param in The input stream from which to deserialize the object. - // @exception ClassNotFoundException If the class being deserialized is not found. - // @exception IOException If an error occurs while communicating with the system. - // - private void readObject(java.io.ObjectInputStream in) - throws ClassNotFoundException, - IOException - { - in.defaultReadObject(); - - if(values_.length < NUMBER_OF_ATTRIBUTES_) - { - String[] temp = new String[NUMBER_OF_ATTRIBUTES_]; - - for(int i = 0; i < values_.length; i++) - temp[i] = values_[i]; - - for(int i = values_.length; i < NUMBER_OF_ATTRIBUTES_; i++) - temp[i] = defaults_[i]; - - values_ = temp; - } - } - - - - - - - /** - Set the value of the specified property. - If choices are allowed, then the value will be compared against - the choices, and if none match, the property will be set to - the default value. - - @param index Property index. - @param value The value. - **/ - void setString (int index, String value) - { - // If no property was provided, then set the choice - // to the default. - if((value == null) || ((value.length() == 0) && (index != USER)&& (index != PASSWORD))) // @E5C //@pw1 - values_[index] = defaults_[index]; - else - values_[index] = value; - - //Bidi-HCG start - //exception for "package ccsid" - it can accept any integer - if(index == PACKAGE_CCSID){ - try{ - int sendCCSIDInt = Integer.valueOf(value).intValue(); - if(sendCCSIDInt > 0) - values_[index] = value; - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, dpi_[index].name, value); - return; - }catch(NumberFormatException e){ - //do nothing, will be handled by code below - } - } - //Bidi-HCG end - - // If choices are provided, for a specified index, - // then validate the current choice. - if(dpi_[index].choices.length > 0) - { - boolean valid = false; - for(int i = 0; i < dpi_[index].choices.length; ++i) - { - if(values_[index].equalsIgnoreCase (dpi_[index].choices[i])) - { - valid = true; - break; - } - } - - // If not valid, then set the current choice to - // the default. - if(! valid) - values_[index] = defaults_[index]; - } - - if(JDTrace.isTraceOn()) - JDTrace.logProperty (this, dpi_[index].name, - ((index != PASSWORD && index != KEY_RING_PASSWORD) ? values_[index] : "")); //@F1C - } - - - - /** - Returns the string representation of the object. - - @return The string representation. - **/ - // - // Implementatation note: This is necessary only for tracing. - // - public String toString () - { - return ""; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDReaderProxy.java b/cvsroot/src/com/ibm/as400/access/JDReaderProxy.java deleted file mode 100644 index fcf002b7e..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDReaderProxy.java +++ /dev/null @@ -1,163 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDReaderProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Reader; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - - - -/** -

    The JDReaderProxy class provides access to Reader objects -which are returned from Toolbox method calls. -**/ -class JDReaderProxy -extends Reader -implements ProxyFactoryImpl -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Private data. - - private long pxId_; - private ProxyClientConnection connection_; - - - public void close() throws IOException - { - try { - connection_.callMethod (pxId_, "close"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - - protected void finalize() throws Throwable - { - connection_.callFinalize (pxId_); - super.finalize(); - } - - - // Implementation of ProxyFactoryImpl interface. - // This method gets called by ProxyClientConnection.callFactoryMethod(). - public void initialize (long proxyId, ProxyClientConnection connection) - { - pxId_ = proxyId; - connection_ = connection; - } - - public void mark(int readAheadLimit) throws IOException - { - try { - connection_.callMethod (pxId_, "mark", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (readAheadLimit) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - public boolean markSupported() - { - try { - return connection_.callMethodReturnsBoolean (pxId_, "markSupported"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - - public int read() throws IOException - { - try { - return connection_.callMethodReturnsInt (pxId_, "read"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - public int read(char cbuf[]) throws IOException - { - return read (cbuf, 0, cbuf.length); - } - - private static final boolean[] ARGS_TO_RETURN = new boolean[] {true, false, false}; - - public int read(char cbuf[], - int off, - int len) throws IOException - { - try { - ProxyReturnValue rv = connection_.callMethod (pxId_, "read", - new Class[] { char[].class, - Integer.TYPE, - Integer.TYPE }, - new Object[] { cbuf, - new Integer (off), - new Integer (len) }, - ARGS_TO_RETURN, false ); - char[] returnDataBuffer = (char[])rv.getArgument(0); - for (int i=0; iThe JDResultSetMetaDataProxy class describes the -columns in a result set. -**/ -class JDResultSetMetaDataProxy -extends AbstractProxyImpl -implements ResultSetMetaData -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Private data. - - JDConnectionProxy jdConnection_; - // The associated JDBC Connection object. - - - - public JDResultSetMetaDataProxy (JDConnectionProxy jdConnection) - { - jdConnection_ = jdConnection; - } - - // Call a method, and return a 'raw' ProxyReturnValue. - private ProxyReturnValue callMethodRtnRaw (String methodName, - int argValue) - throws SQLException - { - try { - return connection_.callMethod (pxId_, methodName, - new Class[] { Integer.TYPE }, - new Object[] { new Integer (argValue) }); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a String. - private String callMethodRtnStr (String methodName, int argValue) - throws SQLException - { - try { - return (String) connection_.callMethod (pxId_, methodName, - new Class[] { Integer.TYPE }, - new Object[] { new Integer (argValue) }) - .getReturnValue (); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public String getCatalogName (int columnIndex) - throws SQLException - { - return callMethodRtnStr ("getCatalogName", columnIndex); - } - - -// JDBC 2.0 - public String getColumnClassName (int columnIndex) - throws SQLException - { - return callMethodRtnStr ("getColumnClassName", columnIndex); - } - - - public int getColumnCount () - throws SQLException - { - try { - return connection_.callMethodReturnsInt (pxId_, "getColumnCount"); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public int getColumnDisplaySize (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getColumnDisplaySize", columnIndex) - .getReturnValueInt (); - } - - public String getColumnLabel (int columnIndex) - throws SQLException - { - return callMethodRtnStr ("getColumnLabel", columnIndex); - } - - - public String getColumnName (int columnIndex) - throws SQLException - { - return callMethodRtnStr ("getColumnName", columnIndex); - } - - - public int getColumnType (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getColumnType", columnIndex) - .getReturnValueInt (); - } - - - public String getColumnTypeName (int columnIndex) - throws SQLException - { - return callMethodRtnStr ("getColumnTypeName", columnIndex); - } - - - public int getPrecision (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getPrecision", columnIndex) - .getReturnValueInt (); - } - - - public int getScale (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getScale", columnIndex) - .getReturnValueInt (); - } - - - public String getSchemaName (int columnIndex) - throws SQLException - { - return callMethodRtnStr ("getSchemaName", columnIndex); - } - - - public String getTableName (int columnIndex) - throws SQLException - { - return callMethodRtnStr ("getTableName", columnIndex); - } - - - public boolean isAutoIncrement (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isAutoIncrement", columnIndex) - .getReturnValueBoolean (); - } - - - public boolean isCaseSensitive (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isCaseSensitive", columnIndex) - .getReturnValueBoolean (); - } - - - public boolean isCurrency (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isCurrency", columnIndex) - .getReturnValueBoolean (); - } - - - public boolean isDefinitelyWritable (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isDefinitelyWritable", columnIndex) - .getReturnValueBoolean (); - } - - - public int isNullable (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isNullable", columnIndex) - .getReturnValueInt (); - } - - - public boolean isReadOnly (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isReadOnly", columnIndex) - .getReturnValueBoolean (); - } - - - public boolean isSearchable (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isSearchable", columnIndex) - .getReturnValueBoolean (); - } - - - public boolean isSigned (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isSigned", columnIndex) - .getReturnValueBoolean (); - } - - - public boolean isWritable (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("isWritable", columnIndex) - .getReturnValueBoolean (); - } - - - // This method is not required by java.sql.ResultSetMetaData, - // but it is used by the JDBC testcases, and is implemented - // in the public class. - public String toString () - { - try { - return (String) connection_.callMethodReturnsObject (pxId_, - "toString"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.ResultSetMetaData" }; //@pdc user cannot cast to AS400JDBCResultSetMetaData - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDResultSetProxy.java b/cvsroot/src/com/ibm/as400/access/JDResultSetProxy.java deleted file mode 100644 index 13d79c6c7..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDResultSetProxy.java +++ /dev/null @@ -1,2441 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDResultSetProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.io.Serializable; -import java.lang.reflect.InvocationTargetException; -import java.math.BigDecimal; -import java.net.URL; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -endif */ -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -/* ifdef JDBC40 -import java.sql.RowId; -endif */ -import java.sql.SQLException; -import java.sql.SQLWarning; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Statement; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.util.Map; - - -class JDResultSetProxy -extends AbstractProxyImpl -implements ResultSet -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Private data. - - private JDConnectionProxy jdConnection_; - // The object that caused this object to be created. - - private JDStatementProxy cachedStatement_; - - private final static String NOT_SERIALIZABLE = "Parameter is not serializable."; - - -/*---------------------------------------------------------*/ -/* */ -/* MISCELLANEOUS METHODS. */ -/* */ -/*---------------------------------------------------------*/ - - - public JDResultSetProxy (JDConnectionProxy jdConnection) - { - jdConnection_ = jdConnection; - } - - - public JDResultSetProxy (JDConnectionProxy jdConnection, - JDStatementProxy statement) - { - jdConnection_ = jdConnection; - cachedStatement_ = statement; - } - - - // Call a method. No return value is expected. - private void callMethod (String methodName) - throws SQLException - { - try { - connection_.callMethod (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - private void callMethod (String methodName, - Class[] argClasses, - Object[] argValues) - throws SQLException - { - try { - connection_.callMethod (pxId_, methodName, argClasses, argValues); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a boolean. - private boolean callMethodRtnBool (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsBoolean (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - private JDInputStreamProxy callMethodRtnInpStrm (String methodName, - int argValue) - throws SQLException - { - try { - JDInputStreamProxy newStream = new JDInputStreamProxy (); - return (JDInputStreamProxy) connection_.callFactoryMethod ( - pxId_, methodName, - new Class[] { Integer.TYPE }, - new Object[] { new Integer (argValue) }, - newStream); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return an int. - private int callMethodRtnInt (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsInt (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return an Object. - private Object callMethodRtnObj (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsObject (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - private Object callMethodRtnObj (String methodName, - Class[] argClasses, - Object[] argValues) - throws SQLException - { - try { - return connection_.callMethod (pxId_, methodName, - argClasses, argValues) - .getReturnValue(); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a 'raw' ProxyReturnValue. - private ProxyReturnValue callMethodRtnRaw (String methodName, - Class[] argClasses, - Object[] argValues) - throws SQLException - { - try { - return connection_.callMethod (pxId_, methodName, - argClasses, argValues); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public void clearWarnings () - throws SQLException - { - callMethod ("clearWarnings"); - } - - - - public void close () - throws SQLException - { - callMethod ("close"); - } - - - - public int findColumn (String columnName) - throws SQLException - { - return callMethodRtnRaw ("findColumn", - new Class[] { String.class }, - new Object[] { columnName }) - .getReturnValueInt(); - } - - - -// JDBC 2.0 - public int getConcurrency () - throws SQLException - { - return callMethodRtnInt ("getConcurrency"); - } - - - public String getCursorName () - throws SQLException - { - return (String) callMethodRtnObj ("getCursorName"); - } - - - -// JDBC 2.0 - public int getFetchDirection () - throws SQLException - { - return callMethodRtnInt ("getFetchDirection"); - } - - - -// JDBC 2.0 - public int getFetchSize () - throws SQLException - { - return callMethodRtnInt ("getFetchSize"); - } - - - -// JDBC 2.0 - public Statement getStatement () - throws SQLException - { - if (cachedStatement_ == null) - { - try { - JDStatementProxy newStatement = new JDStatementProxy (jdConnection_); - cachedStatement_ = (JDStatementProxy) connection_.callFactoryMethod ( - pxId_, "getStatement", newStatement); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - return cachedStatement_; - } - - - -// JDBC 2.0 - public int getType () - throws SQLException - { - return callMethodRtnInt ("getType"); - } - - - - public SQLWarning getWarnings () - throws SQLException - { - return (SQLWarning) callMethodRtnObj ("getWarnings"); - } - - - -// JDBC 2.0 - public void setFetchDirection (int fetchDirection) - throws SQLException - { - callMethod ("setFetchDirection", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (fetchDirection) }); - } - - - -// JDBC 2.0 - public void setFetchSize (int fetchSize) - throws SQLException - { - callMethod ("setFetchSize", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (fetchSize) }); - } - - - // This method is not required by java.sql.ResultSet, - // but it is used by the JDBC testcases, and is implemented - // in the public class. - public String toString () - { - try { - return (String) connection_.callMethodReturnsObject (pxId_, "toString"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - - -/*---------------------------------------------------------*/ -/* */ -/* CURSOR POSITIONING. */ -/* */ -/*---------------------------------------------------------*/ - - - -// JDBC 2.0 - public boolean absolute (int rowNumber) - throws SQLException - { - return callMethodRtnRaw ("absolute", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (rowNumber) }) - .getReturnValueBoolean(); - } - - - -// JDBC 2.0 - public void afterLast () - throws SQLException - { - callMethod ("afterLast"); - } - - - -// JDBC 2.0 - public void beforeFirst () - throws SQLException - { - callMethod ("beforeFirst"); - } - - - -// JDBC 2.0 - public boolean first () - throws SQLException - { - return callMethodRtnBool ("first"); - } - - - -// JDBC 2.0 - public int getRow () - throws SQLException - { - return callMethodRtnInt ("getRow"); - } - - - -// JDBC 2.0 - public boolean isAfterLast () - throws SQLException - { - return callMethodRtnBool ("isAfterLast"); - } - - - -// JDBC 2.0 - public boolean isBeforeFirst () - throws SQLException - { - return callMethodRtnBool ("isBeforeFirst"); - } - - - -// JDBC 2.0 - public boolean isFirst () - throws SQLException - { - return callMethodRtnBool ("isFirst"); - } - - - -// JDBC 2.0 - public boolean isLast () - throws SQLException - { - return callMethodRtnBool ("isLast"); - } - - - -// JDBC 2.0 - public boolean last () - throws SQLException - { - return callMethodRtnBool ("last"); - } - - - -// JDBC 2.0 - public void moveToCurrentRow () - throws SQLException - { - callMethod ("moveToCurrentRow"); - } - - - -// JDBC 2.0 - public void moveToInsertRow () - throws SQLException - { - callMethod ("moveToInsertRow"); - } - - - - public boolean next () - throws SQLException - { - return callMethodRtnBool ("next"); - } - - - -// JDBC 2.0 - public boolean previous () - throws SQLException - { - return callMethodRtnBool ("previous"); - } - - -// JDBC 2.0 - public void refreshRow () - throws SQLException - { - callMethod ("refreshRow"); - } - - - -// JDBC 2.0 - public boolean relative (int rowNumber) - throws SQLException - { - return callMethodRtnRaw ("relative", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (rowNumber) }) - .getReturnValueBoolean(); - } - - - -/*---------------------------------------------------------*/ -/* */ -/* GET DATA METHODS. */ -/* */ -/*---------------------------------------------------------*/ - - - -// JDBC 2.0 - public Array getArray (int columnIndex) - throws SQLException - { - return (Array) callMethodRtnObj ("getArray", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }); - } - - - -// JDBC 2.0 - public Array getArray (String columnName) - throws SQLException - { - return getArray (findColumn (columnName)); - } - - - - public InputStream getAsciiStream (int columnIndex) - throws SQLException - { - return callMethodRtnInpStrm ("getAsciiStream", columnIndex); - } - - - - public InputStream getAsciiStream (String columnName) - throws SQLException - { - return getAsciiStream (findColumn (columnName)); - } - - - -// JDBC 2.0 - public BigDecimal getBigDecimal (int columnIndex) - throws SQLException - { - return (BigDecimal) callMethodRtnObj ("getBigDecimal", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }); - } - - - -// JDBC 2.0 - public BigDecimal getBigDecimal (String columnName) - throws SQLException - { - return getBigDecimal (findColumn (columnName)); - } - - - -/** -@exception SQLException If a SQL error occurs. -@deprecated Use getBigDecimal(int) instead. -@see #getBigDecimal(int) -**/ - public BigDecimal getBigDecimal (int columnIndex, int scale) - throws SQLException - { - return (BigDecimal) callMethodRtnObj ("getBigDecimal", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer (columnIndex), - new Integer (scale) }); - } - - - -/** -@exception SQLException If a SQL error occurs. -@deprecated Use getBigDecimal(String) instead. -@see #getBigDecimal(String) -**/ - public BigDecimal getBigDecimal (String columnName, int scale) - throws SQLException - { - return getBigDecimal (findColumn (columnName), scale); - } - - - - public InputStream getBinaryStream (int columnIndex) - throws SQLException - { - return callMethodRtnInpStrm ("getBinaryStream", columnIndex); - } - - - - public InputStream getBinaryStream (String columnName) - throws SQLException - { - return getBinaryStream (findColumn (columnName)); - } - - - -// JDBC 2.0 - public Blob getBlob (int columnIndex) - throws SQLException - { - try { - JDBlobProxy newBlob = new JDBlobProxy (); - return (JDBlobProxy) connection_.callFactoryMethod (pxId_, - "getBlob", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(columnIndex) }, - newBlob); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - -// JDBC 2.0 - public Blob getBlob (String columnName) - throws SQLException - { - return getBlob (findColumn (columnName)); - } - - - - public boolean getBoolean (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getBoolean", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }) - .getReturnValueBoolean(); - } - - - - public boolean getBoolean (String columnName) - throws SQLException - { - return getBoolean (findColumn (columnName)); - } - - - - public byte getByte (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getByte", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }) - .getReturnValueByte(); - } - - - - public byte getByte (String columnName) - throws SQLException - { - return getByte (findColumn (columnName)); - } - - - - public byte[] getBytes (int columnIndex) - throws SQLException - { - return (byte[]) callMethodRtnObj ("getBytes", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }); - } - - - - public byte[] getBytes (String columnName) - throws SQLException - { - return getBytes (findColumn (columnName)); - } - - - -// JDBC 2.0 - public Reader getCharacterStream (int columnIndex) - throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getCharacterStream", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }, - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - -// JDBC 2.0 - public Reader getCharacterStream (String columnName) - throws SQLException - { - return getCharacterStream (findColumn (columnName)); - } - - - -// JDBC 2.0 - public Clob getClob (int columnIndex) - throws SQLException - { - try { - JDClobProxy newClob = new JDClobProxy (); - return (JDClobProxy) connection_.callFactoryMethod (pxId_, - "getClob", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(columnIndex) }, - newClob); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - -// JDBC 2.0 - public Clob getClob (String columnName) - throws SQLException - { - return getClob (findColumn (columnName)); - } - - - - public Date getDate (int columnIndex) - throws SQLException - { - return (Date) callMethodRtnObj ("getDate", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }); - } - - - - public Date getDate (String columnName) - throws SQLException - { - return (Date) callMethodRtnObj ("getDate", - new Class[] { String.class }, - new Object[] { columnName }); - } - - - -// JDBC 2.0 - public Date getDate (int columnIndex, Calendar calendar) - throws SQLException - { - return (Date) callMethodRtnObj ("getDate", - new Class[] { Integer.TYPE, Calendar.class }, - new Object[] { new Integer (columnIndex), - calendar }); - } - - - -// JDBC 2.0 - public Date getDate (String columnName, Calendar calendar) - throws SQLException - { - return getDate (findColumn (columnName), calendar); - } - - - - public double getDouble (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getDouble", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }) - .getReturnValueDouble(); - } - - - - public double getDouble (String columnName) - throws SQLException - { - return getDouble (findColumn (columnName)); - } - - - - public float getFloat (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getFloat", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }) - .getReturnValueFloat(); - } - - - - public float getFloat (String columnName) - throws SQLException - { - return getFloat (findColumn (columnName)); - } - - - - public int getInt (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getInt", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }) - .getReturnValueInt(); - } - - - - public int getInt (String columnName) - throws SQLException - { - return getInt (findColumn (columnName)); - } - - - - public long getLong (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getLong", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }) - .getReturnValueLong(); - } - - - - public long getLong (String columnName) - throws SQLException - { - return getLong (findColumn (columnName)); - } - - - - public ResultSetMetaData getMetaData () - throws SQLException - { - try { - JDResultSetMetaDataProxy newMetaData = new JDResultSetMetaDataProxy (jdConnection_); - return (JDResultSetMetaDataProxy) connection_.callFactoryMethod ( - pxId_, "getMetaData", newMetaData); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public Object getObject (int columnIndex) - throws SQLException - { - String typeName = getMetaData().getColumnTypeName(columnIndex); - ProxyFactoryImpl proxyObject = null; - try - { - if (typeName.equalsIgnoreCase("BLOB")) { - proxyObject = new JDBlobProxy (); - } - else if (typeName.equalsIgnoreCase("CLOB")) { - proxyObject = new JDClobProxy (); - } - else - return callMethodRtnObj ("getObject", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }); - - return connection_.callFactoryMethod (pxId_, "getObject", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }, - proxyObject); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public Object getObject (String columnName) - throws SQLException - { - return getObject (findColumn (columnName)); - } - - - -// JDBC 2.0 - public Object getObject (int columnIndex, Map typeMap) - throws SQLException - { - String typeName = getMetaData().getColumnTypeName(columnIndex); - ProxyFactoryImpl proxyObject = null; - try - { - if (typeName.equalsIgnoreCase("BLOB")) { - proxyObject = new JDBlobProxy (); - } - else if (typeName.equalsIgnoreCase("CLOB")) { - proxyObject = new JDClobProxy (); - } - else - return callMethodRtnObj ("getObject", - new Class[] { Integer.TYPE, Map.class }, - new Object[] { new Integer (columnIndex), - typeMap }); - - return connection_.callFactoryMethod (pxId_, "getObject", - new Class[] { Integer.TYPE, Map.class }, - new Object[] { new Integer (columnIndex), - typeMap }, - proxyObject); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - -// JDBC 2.0 - public Object getObject (String columnName, Map typeMap) - throws SQLException - { - return getObject (findColumn (columnName), typeMap); - } - - - -// JDBC 2.0 - public Ref getRef (int columnIndex) - throws SQLException - { - return (Ref) callMethodRtnObj ("getRef", - new Class[] { Integer.TYPE}, - new Object[] { new Integer (columnIndex) }); - } - - - -// JDBC 2.0 - public Ref getRef (String columnName) - throws SQLException - { - return getRef (findColumn (columnName)); - } - - - - public short getShort (int columnIndex) - throws SQLException - { - return callMethodRtnRaw ("getShort", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }) - .getReturnValueShort(); - } - - - - public short getShort (String columnName) - throws SQLException - { - return getShort (findColumn (columnName)); - } - - - - public String getString (int columnIndex) - throws SQLException - { - return (String) callMethodRtnObj ("getString", - new Class[] { Integer.TYPE}, - new Object[] { new Integer (columnIndex) }); - } - - - - public String getString (String columnName) - throws SQLException - { - return getString (findColumn (columnName)); - } - - - - public Time getTime (int columnIndex) - throws SQLException - { - return (Time) callMethodRtnObj ("getTime", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }); - } - - - - public Time getTime (String columnName) - throws SQLException - { - return getTime (findColumn (columnName)); - } - - - -// JDBC 2.0 - public Time getTime (int columnIndex, Calendar calendar) - throws SQLException - { - return (Time) callMethodRtnObj ("getTime", - new Class[] { Integer.TYPE, Calendar.class }, - new Object[] { new Integer (columnIndex), - calendar }); - } - - - -// JDBC 2.0 - public Time getTime (String columnName, Calendar calendar) - throws SQLException - { - return getTime (findColumn (columnName), calendar); - } - - - - public Timestamp getTimestamp (int columnIndex) - throws SQLException - { - return (Timestamp) callMethodRtnObj ("getTimestamp", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }); - } - - - - public Timestamp getTimestamp (String columnName) - throws SQLException - { - return getTimestamp (findColumn (columnName)); - } - - - -// JDBC 2.0 - public Timestamp getTimestamp (int columnIndex, Calendar calendar) - throws SQLException - { - return (Timestamp) callMethodRtnObj ("getTimestamp", - new Class[] { Integer.TYPE, Calendar.class }, - new Object[] { new Integer (columnIndex), - calendar }); - } - - - -// JDBC 2.0 - public Timestamp getTimestamp (String columnName, Calendar calendar) - throws SQLException - { - return getTimestamp (findColumn (columnName), calendar); - } - - - -/** -@exception SQLException If a SQL error occurs. -@deprecated Use getCharacterStream(int) instead. -@see #getCharacterStream(int) -**/ - public InputStream getUnicodeStream (int columnIndex) - throws SQLException - { - return callMethodRtnInpStrm ("getUnicodeStream", columnIndex); - } - - - -/** -@exception SQLException If a SQL error occurs. -@deprecated Use getCharacterStream(String) instead. -@see #getCharacterStream(String) -**/ - public InputStream getUnicodeStream (String columnName) - throws SQLException - { - return getUnicodeStream (findColumn (columnName)); - } - - - -// JDBC 3.0 - public URL getURL (int columnIndex) - throws SQLException - { - return(URL) callMethodRtnObj ("getURL", - new Class[] { Integer.TYPE}, - new Object[] { new Integer(columnIndex)}); - } - - - -// JDBC 3.0 - public URL getURL (String columnName) - throws SQLException - { - return(URL) callMethodRtnObj ("getURL", - new Class[] { String.class}, - new Object[] { columnName}); - } - - - - public boolean wasNull () - throws SQLException - { - return callMethodRtnBool ("wasNull"); - } - - - -/*---------------------------------------------------------*/ -/* */ -/* UPDATE DATA METHODS. */ -/* */ -/*---------------------------------------------------------*/ - - - -// JDBC 2.0 - public void cancelRowUpdates () - throws SQLException - { - callMethod ("cancelRowUpdates"); - } - - - -// JDBC 2.0 - public void deleteRow () - throws SQLException - { - callMethod ("deleteRow"); - } - - - -// JDBC 2.0 - public void insertRow () - throws SQLException - { - callMethod ("insertRow"); - } - - - -// JDBC 2.0 - public boolean rowDeleted () - throws SQLException - { - return callMethodRtnBool ("rowDeleted"); - } - - - -// JDBC 2.0 - public boolean rowInserted () - throws SQLException - { - return callMethodRtnBool ("rowInserted"); - } - - - -// JDBC 2.0 - public boolean rowUpdated () - throws SQLException - { - return callMethodRtnBool ("rowUpdated"); - } - - - -// JDBC 3.0 - public void updateArray (int columnIndex, Array columnValue) - throws SQLException - { - if (columnValue != null && - !(columnValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("updateArray", - new Class[] { Integer.TYPE, Array.class }, - new Object[] { new Integer(columnIndex), - columnValue }); - } - - - -// JDBC 3.0 - public void updateArray (String columnName, Array columnValue) - throws SQLException - { - if (columnValue != null && - !(columnValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("updateArray", - new Class[] { String.class, Array.class }, - new Object[] { columnName, - columnValue }); - } - - - - - -// JDBC 2.0 - public void updateAsciiStream (int columnIndex, - InputStream columnValue, - int length) - throws SQLException - { - InputStream iStream; - if (columnValue == null || - columnValue instanceof Serializable) - iStream = columnValue; - else { - try { - iStream = new SerializableInputStream (columnValue); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("updateAsciiStream", - new Class[] { Integer.TYPE, InputStream.class, - Integer.TYPE }, - new Object[] { new Integer (columnIndex), - iStream, - new Integer (length) }); - } - - - -// JDBC 2.0 - public void updateAsciiStream (String columnName, - InputStream columnValue, - int length) - throws SQLException - { - updateAsciiStream (findColumn (columnName), columnValue, length); - } - - - -// JDBC 2.0 - public void updateBigDecimal (int columnIndex, BigDecimal columnValue) - throws SQLException - { - callMethod ("updateBigDecimal", - new Class[] { Integer.TYPE, BigDecimal.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 2.0 - public void updateBigDecimal (String columnName, BigDecimal columnValue) - throws SQLException - { - updateBigDecimal (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateBinaryStream (int columnIndex, - InputStream columnValue, - int length) - throws SQLException - { - InputStream iStream; - if (columnValue == null || - columnValue instanceof Serializable) - iStream = columnValue; - else { - try { - iStream = new SerializableInputStream (columnValue); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("updateBinaryStream", - new Class[] { Integer.TYPE, InputStream.class, - Integer.TYPE }, - new Object[] { new Integer (columnIndex), - iStream, - new Integer (length) }); - } - - - -// JDBC 2.0 - public void updateBinaryStream (String columnName, - InputStream columnValue, - int length) - throws SQLException - { - updateBinaryStream (findColumn (columnName), columnValue, length); - } - - - -// JDBC 3.0 - public void updateBlob (int columnIndex, Blob columnValue) - throws SQLException - { - callMethod ("updateBlob", - new Class[] { Integer.TYPE, Blob.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 3.0 - public void updateBlob (String columnName, Blob columnValue) - throws SQLException - { - callMethod ("updateBlob", - new Class[] { String.class, Blob.class }, - new Object[] { columnName, - columnValue }); - } - - - -// JDBC 2.0 - public void updateBoolean (int columnIndex, boolean columnValue) - throws SQLException - { - callMethod ("updateBoolean", - new Class[] { Integer.TYPE, Boolean.TYPE }, - new Object[] { new Integer (columnIndex), - new Boolean (columnValue) }); - } - - - -// JDBC 2.0 - public void updateBoolean (String columnName, boolean columnValue) - throws SQLException - { - updateBoolean (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateByte (int columnIndex, byte columnValue) - throws SQLException - { - callMethod ("updateByte", - new Class[] { Integer.TYPE, Byte.TYPE }, - new Object[] { new Integer (columnIndex), - new Byte (columnValue) }); - } - - - -// JDBC 2.0 - public void updateByte (String columnName, byte columnValue) - throws SQLException - { - updateByte (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateBytes (int columnIndex, byte[] columnValue) - throws SQLException - { - callMethod ("updateBytes", - new Class[] { Integer.TYPE, byte[].class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 2.0 - public void updateBytes (String columnName, byte[] columnValue) - throws SQLException - { - updateBytes (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateCharacterStream (int columnIndex, - Reader columnValue, - int length) - throws SQLException - { - try { - SerializableReader reader; - if (columnValue == null) - reader = null; - else - reader = new SerializableReader (columnValue, Math.max(0,length)); - callMethod ("updateCharacterStream", - new Class[] { Integer.TYPE, Reader.class, Integer.TYPE }, - new Object[] { new Integer (columnIndex), - reader, new Integer (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - -// JDBC 2.0 - public void updateCharacterStream (String columnName, - Reader columnValue, - int length) - throws SQLException - { - updateCharacterStream (findColumn (columnName), columnValue, length); - } - - - -// JDBC 3.0 - public void updateClob (int columnIndex, Clob columnValue) - throws SQLException - { - callMethod ("updateClob", - new Class[] { String.class, Clob.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 3.0 - public void updateClob (String columnName, Clob columnValue) - throws SQLException - { - callMethod ("updateClob", - new Class[] { String.class, Clob.class }, - new Object[] { columnName, - columnValue }); - } - - - -// JDBC 2.0 - public void updateDate (int columnIndex, Date columnValue) - throws SQLException - { - callMethod ("updateDate", - new Class[] { Integer.TYPE, Date.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 2.0 - public void updateDate (String columnName, Date columnValue) - throws SQLException - { - updateDate (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateDouble (int columnIndex, double columnValue) - throws SQLException - { - callMethod ("updateDouble", - new Class[] { Integer.TYPE, Double.TYPE }, - new Object[] { new Integer (columnIndex), - new Double (columnValue) }); - } - - - -// JDBC 2.0 - public void updateDouble (String columnName, double columnValue) - throws SQLException - { - updateDouble (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateFloat (int columnIndex, float columnValue) - throws SQLException - { - callMethod ("updateFloat", - new Class[] { Integer.TYPE, Float.TYPE }, - new Object[] { new Integer (columnIndex), - new Float (columnValue) }); - } - - - -// JDBC 2.0 - public void updateFloat (String columnName, float columnValue) - throws SQLException - { - updateFloat (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateInt (int columnIndex, int columnValue) - throws SQLException - { - callMethod ("updateInt", - new Class[] { Integer.TYPE, Integer.TYPE }, - new Object[] { new Integer (columnIndex), - new Integer (columnValue) }); - } - - - -// JDBC 2.0 - public void updateInt (String columnName, int columnValue) - throws SQLException - { - updateInt (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateLong (int columnIndex, long columnValue) - throws SQLException - { - callMethod ("updateLong", - new Class[] { Integer.TYPE, Long.TYPE }, - new Object[] { new Integer (columnIndex), - new Long (columnValue) }); - } - - - -// JDBC 2.0 - public void updateLong (String columnName, long columnValue) - throws SQLException - { - updateLong (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateNull (int columnIndex) - throws SQLException - { - callMethod ("updateNull", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }); - } - - - -// JDBC 2.0 - public void updateNull (String columnName) - throws SQLException - { - updateNull (findColumn (columnName)); - } - - - -// JDBC 2.0 - public void updateObject (int columnIndex, Object columnValue) - throws SQLException - { - if (columnValue != null && - !(columnValue instanceof Serializable)) { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("updateObject", - new Class[] { Integer.TYPE, Object.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 2.0 - public void updateObject (String columnName, Object columnValue) - throws SQLException - { - updateObject (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateObject (int columnIndex, - Object columnValue, - int scale) - throws SQLException - { - if (columnValue != null && - !(columnValue instanceof Serializable)) { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("updateObject", - new Class[] { Integer.TYPE, Object.class, Integer.TYPE }, - new Object[] { new Integer (columnIndex), - columnValue, - new Integer (scale) }); - } - - - -// JDBC 2.0 - public void updateObject (String columnName, - Object columnValue, - int scale) - throws SQLException - { - updateObject (findColumn (columnName), columnValue, scale); - } - - - -// JDBC 3.0 - public void updateRef (int columnIndex, Ref columnValue) - throws SQLException - { - if (columnValue != null && - !(columnValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("updateRef", - new Class[] { Integer.TYPE, Ref.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 3.0 - public void updateRef (String columnName, Ref columnValue) - throws SQLException - { - if (columnValue != null && - !(columnValue instanceof Serializable) ){ - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, NOT_SERIALIZABLE); - throw new SQLException (); - } - - callMethod ("updateRef", - new Class[] { String.class, Ref.class }, - new Object[] { columnName, - columnValue }); - } - - - -// JDBC 2.0 - public void updateRow () - throws SQLException - { - callMethod ("updateRow"); - } - - - -// JDBC 2.0 - public void updateShort (int columnIndex, short columnValue) - throws SQLException - { - callMethod ("updateShort", - new Class[] { Integer.TYPE, Short.TYPE }, - new Object[] { new Integer (columnIndex), - new Short (columnValue) }); - } - - - -// JDBC 2.0 - public void updateShort (String columnName, short columnValue) - throws SQLException - { - updateShort (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateString (int columnIndex, String columnValue) - throws SQLException - { - callMethod ("updateString", - new Class[] { Integer.TYPE, String.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 2.0 - public void updateString (String columnName, String columnValue) - throws SQLException - { - updateString (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateTime (int columnIndex, Time columnValue) - throws SQLException - { - callMethod ("updateTime", - new Class[] { Integer.TYPE, Time.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 2.0 - public void updateTime (String columnName, Time columnValue) - throws SQLException - { - updateTime (findColumn (columnName), columnValue); - } - - - -// JDBC 2.0 - public void updateTimestamp (int columnIndex, Timestamp columnValue) - throws SQLException - { - callMethod ("updateTimestamp", - new Class[] { Integer.TYPE, Timestamp.class }, - new Object[] { new Integer (columnIndex), - columnValue }); - } - - - -// JDBC 2.0 - public void updateTimestamp (String columnName, Timestamp columnValue) - throws SQLException - { - updateTimestamp (findColumn (columnName), columnValue); - } - - - //@PDA jdbc40 - public int getHoldability() throws SQLException - { - return callMethodRtnInt ("getHoldability"); - } - - - //@pda jdbc40 - public Reader getNCharacterStream(int columnIndex) throws SQLException - { - try { - JDReaderProxy newReader = new JDReaderProxy (); - return (JDReaderProxy) connection_.callFactoryMethod ( - pxId_, "getNCharacterStream", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (columnIndex) }, - newReader); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnName the name of the column - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language - * @exception SQLException if a database access error occurs - */ - public Reader getNCharacterStream(String columnName) throws SQLException - { - return getNCharacterStream (findColumn (columnName)); - } - - - //@pda jdbc40 - //JDBC40DOC /** - //JDBC40DOC * Retrieves the value of the designated column in the current row - //JDBC40DOC * of this ResultSet object as a NClob object - //JDBC40DOC * in the Java programming language. - //JDBC40DOC * - //JDBC40DOC * @param columnIndex the first column is 1, the second is 2, ... - //JDBC40DOC * @return a NClob object representing the SQL - //JDBC40DOC * NCLOB value in the specified column - //JDBC40DOC * @exception SQLException if the driver does not support national - //JDBC40DOC * character sets; if the driver can detect that a data conversion - //JDBC40DOC * error could occur; or if a database access error occurss - //JDBC40DOC */ - /* ifdef JDBC40 - public NClob getNClob(int columnIndex) throws SQLException - { - try { - JDNClobProxy newClob = new JDNClobProxy (); - return (JDNClobProxy) connection_.callFactoryMethod (pxId_, - "getNClob", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(columnIndex) }, - newClob); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - endif */ - - - //@pda jdbc40 - //JDBC40DOC /** - //JDBC40DOC * Retrieves the value of the designated column in the current row - //JDBC40DOC * of this ResultSet object as a NClob object - //JDBC40DOC * in the Java programming language. - //JDBC40DOC * - //JDBC40DOC * @param columnName the name of the column from which to retrieve the value - //JDBC40DOC * @return a NClob object representing the SQL NCLOB - //JDBC40DOC * value in the specified column - //JDBC40DOC * @exception SQLException if the driver does not support national - //JDBC40DOC * character sets; if the driver can detect that a data conversion - //JDBC40DOC * error could occur; or if a database access error occurs - //JDBC40DOC */ - /* ifdef JDBC40 - public NClob getNClob(String columnName) throws SQLException - { - return getNClob (findColumn (columnName)); - } - endif */ - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - */ - public String getNString(int columnIndex) throws SQLException - { - return (String) callMethodRtnObj ("getNString", - new Class[] { Integer.TYPE}, - new Object[] { new Integer (columnIndex) }); - } - - - //@pda jdbc40 - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnName the SQL name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - */ - public String getNString(String columnName) throws SQLException - { - return getNString (findColumn (columnName)); - } - - - //@pda jdbc40 - /* ifdef JDBC40 - public RowId getRowId(int columnIndex) throws SQLException - { - try { - JDRowIdProxy newClob = new JDRowIdProxy (); - return (JDRowIdProxy) connection_.callFactoryMethod (pxId_, - "getRowId", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(columnIndex) }, - newClob); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - //@pda jdbc40 - public RowId getRowId(String columnName) throws SQLException - { - return getRowId(findColumn (columnName)); - } - - //@pda jdbc40 - public SQLXML getSQLXML(int columnIndex) throws SQLException - { - try { - JDSQLXMLProxy newXML = new JDSQLXMLProxy (); - return (JDSQLXMLProxy) connection_.callFactoryMethod (pxId_, - "getSQLXML", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(columnIndex) }, - newXML); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - //@pda jdbc40 - public SQLXML getSQLXML(String columnName) throws SQLException - { - return getSQLXML(findColumn (columnName)); - } - endif */ - - //@pda jdbc40 - public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException - { - try { - SerializableReader reader; - if (x == null) - reader = null; - else - reader = new SerializableReader (x, Math.max(0,(int)length)); - callMethod ("updateNCharacterStream", - new Class[] { Integer.TYPE, Reader.class, Long.TYPE }, - new Object[] { new Integer (columnIndex), - reader, new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - - } - - //@PDA jdbc40 - public void updateNCharacterStream(String columnName, Reader x, long length) throws SQLException - { - updateNCharacterStream (findColumn (columnName), x, length); - } - - //@PDA jdbc40 - /* ifdef JDBC40 - public void updateNClob(int columnIndex, NClob nClob) throws SQLException - { - callMethod ("updateNClob", - new Class[] { String.class, NClob.class }, - new Object[] { new Integer (columnIndex), - nClob }); - } - - //@PDA jdbc40 - public void updateNClob(String columnName, NClob nClob) throws SQLException - { - updateNClob (findColumn (columnName), nClob); - - } - endif */ - - //@pda jdbc40 - public void updateNString(int columnIndex, String nString) throws SQLException - { - callMethod ("updateNString", - new Class[] { Integer.TYPE, String.class }, - new Object[] { new Integer (columnIndex), - nString }); - } - - //@PDA jdbc40 - public void updateNString(String columnName, String nString) throws SQLException - { - updateNString (findColumn (columnName), nString); - } - - /* ifdef JDBC40 - //@PDA jdbc40 - public void updateRowId(int columnIndex, RowId x) throws SQLException - { - callMethod ("updateRowId", - new Class[] { String.class, RowId.class }, - new Object[] { new Integer (columnIndex), - x }); - } - - //@pda jdbc40 - public void updateRowId(String columnName, RowId x) throws SQLException - { - updateRowId (findColumn (columnName), x); - } - - - //@pda jdbc40 - public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException - { - callMethod ("updateSQLXML", - new Class[] { String.class, SQLXML.class }, - new Object[] { new Integer (columnIndex), - xmlObject }); - } - - //@pda jdbc40 - public void updateSQLXML(String columnName, SQLXML xmlObject) throws SQLException - { - updateSQLXML(findColumn(columnName), xmlObject); - } - - endif */ - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.ResultSet" }; //@pdc user cannot cast to AS400JDBCResultSet - } - - //@PDA jdbc40 - public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException - { - InputStream iStream; - if (x == null || x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("updateAsciiStream", - new Class[] { Integer.TYPE, InputStream.class, - Long.TYPE }, - new Object[] { new Integer (columnIndex), - iStream, - new Long (length) }); - } - - - //@PDA jdbc40 - public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException - { - updateAsciiStream (findColumn (columnLabel), x, length); - } - - - //@PDA jdbc40 - public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException - { - InputStream iStream; - if (x == null || x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("updateBinaryStream", - new Class[] { Integer.TYPE, InputStream.class, - Long.TYPE }, - new Object[] { new Integer (columnIndex), - iStream, - new Long (length) }); - } - - //@PDA jdbc40 - public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException - { - updateBinaryStream (findColumn (columnLabel), x, length); - } - - //@PDA jdbc40 - public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException - { - InputStream iStream; - if (inputStream == null || inputStream instanceof Serializable) - iStream = inputStream; - else { - try { - iStream = new SerializableInputStream (inputStream); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("updateBlob", - new Class[] { Integer.TYPE, InputStream.class, - Long.TYPE }, - new Object[] { new Integer (columnIndex), - iStream, - new Long (length) }); - } - - //@PDA jdbc40 - public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException - { - updateBlob (findColumn (columnLabel), inputStream, length); - } - - //@PDA jdbc40 - public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException - { - try { - SerializableReader reader; - if (x == null) - reader = null; - else - reader = new SerializableReader (x, Math.max(0,(int)length)); - callMethod ("updateCharacterStream", - new Class[] { Integer.TYPE, Reader.class, Long.TYPE }, - new Object[] { new Integer (columnIndex), - reader, new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException - { - updateCharacterStream (findColumn (columnLabel), reader, length); - } - - //@PDA jdbc40 - public void updateClob(int columnIndex, Reader reader, long length) throws SQLException - { - try { - SerializableReader sReader; - if (reader == null) - sReader = null; - else - sReader = new SerializableReader (reader, Math.max(0,(int)length)); - callMethod ("updateClob", - new Class[] { Integer.TYPE, Reader.class, Long.TYPE }, - new Object[] { new Integer (columnIndex), - sReader, new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - public void updateClob(String columnLabel, Reader reader, long length) throws SQLException - { - updateClob (findColumn (columnLabel), reader, length); - } - - - - //@PDA jdbc40 - public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException - { - try { - SerializableReader sReader; - if (reader == null) - sReader = null; - else - sReader = new SerializableReader (reader, Math.max(0,(int)length)); - callMethod ("updateNClob", - new Class[] { Integer.TYPE, Reader.class, Long.TYPE }, - new Object[] { new Integer (columnIndex), - sReader, new Long (length) }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - //@PDA jdbc40 - public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException - { - updateNClob (findColumn (columnLabel), reader, length); - } - - //@PDA jdbc40 - public boolean isClosed () throws SQLException - { - return callMethodRtnBool ("isClosed"); - } - - - //@pda jdbc40 - public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException - { - InputStream iStream; - if (x == null || x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("updateAsciiStream", - new Class[] { Integer.TYPE, InputStream.class }, - new Object[] { new Integer (columnIndex), - iStream }); - } - - - //@PDA jdbc40 - public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException - { - updateAsciiStream (findColumn (columnLabel), x); - } - - - //@PDA jdbc40 - public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException - { - InputStream iStream; - if (x == null || x instanceof Serializable) - iStream = x; - else { - try { - iStream = new SerializableInputStream (x); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("updateBinaryStream", - new Class[] { Integer.TYPE, InputStream.class }, - new Object[] { new Integer (columnIndex), - iStream }); - } - - - //@PDA jdbc40 - public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException - { - updateBinaryStream (findColumn (columnLabel), x); - - } - - - //@PDA jdbc40 - public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException - { - InputStream iStream; - if ( inputStream== null || inputStream instanceof Serializable) - iStream = inputStream; - else { - try { - iStream = new SerializableInputStream (inputStream); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - callMethod ("updateBlob", - new Class[] { Integer.TYPE, InputStream.class }, - new Object[] { new Integer (columnIndex), - iStream }); - } - - - //@PDA jdbc40 - public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException - { - updateBlob (findColumn (columnLabel), inputStream); - } - - - //@PDA jdbc40 - public void updateCharacterStream(int columnIndex, Reader x) throws SQLException - { - try { - SerializableReader sReader; - if (x == null) - sReader = null; - else - sReader = new SerializableReader (x); - callMethod ("updateCharacterStream", - new Class[] { Integer.TYPE, Reader.class }, - new Object[] { new Integer (columnIndex), sReader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - //@PDA jdbc40 - public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException - { - updateCharacterStream(findColumn (columnLabel), reader); - } - - - //@PDA jdbc40 - public void updateClob(int columnIndex, Reader reader) throws SQLException - { - try { - SerializableReader sReader; - if (reader == null) - sReader = null; - else - sReader = new SerializableReader (reader); - callMethod ("updateClob", - new Class[] { Integer.TYPE, Reader.class }, - new Object[] { new Integer (columnIndex), sReader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - - //@PDA jdbc40 - public void updateClob(String columnLabel, Reader reader) throws SQLException - { - updateClob(findColumn (columnLabel), reader); - } - - //@PDA jdbc40 - public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException - { - try { - SerializableReader sReader; - if (x == null) - sReader = null; - else - sReader = new SerializableReader (x); - callMethod ("updateNCharacterStream", - new Class[] { Integer.TYPE, Reader.class }, - new Object[] { new Integer (columnIndex), sReader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - - } - - //@PDA jdbc40 - public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException - { - updateNCharacterStream(findColumn (columnLabel), reader); - } - - //@PDA jdbc40 - public void updateNClob(int columnIndex, Reader reader) throws SQLException - { - try { - SerializableReader sReader; - if (reader == null) - sReader = null; - else - sReader = new SerializableReader (reader); - callMethod ("updateNClob", - new Class[] { Integer.TYPE, Reader.class }, - new Object[] { new Integer (columnIndex), sReader }); - } - catch (java.io.IOException e) { - throw new SQLException (e.getMessage ()); - } - } - - //@PDA jdbc40 - public void updateNClob(String columnLabel, Reader reader) throws SQLException - { - updateNClob(findColumn (columnLabel), reader); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDRow.java b/cvsroot/src/com/ibm/as400/access/JDRow.java deleted file mode 100644 index e5af7b0bf..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDRow.java +++ /dev/null @@ -1,170 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDRow.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - - - -/** -

    The JDRow interface represents a row of data with access to -all fields. It is intended that the row will be reused for -entire result set, prepared statement, etc., so as to minimize -object creation. -**/ -interface JDRow -{ - - - - /** - Return the index for the specified field name. - - - @param name The field name. - @return The field index (1-based). - - @exception SQLException If the name is not - found or an error occurs. - **/ - public abstract int findField (String name) - throws SQLException; - - - - /** - Return the number of fields. - - @return The number of fields. - - @exception SQLException If an error occurs. - **/ - public abstract int getFieldCount (); - - - - /** - Return the name of a field. - - @param index The field index (1-based). - @return The field name. - - @exception SQLException If the index is invalid - or an error occurs. - **/ - public abstract String getFieldName (int index) - throws SQLException; - - - - /** - Return the precision for a field. This is the number - of decimal digits the field may hold. - - @param index The field index (1-based). - @return The precision. - - @exception SQLException If the index is invalid - or an error occurs. - **/ - // @C1D public abstract int getFieldPrecision (int index) - // @C1D throws SQLException; - - - - /** - Return the scale for a field. This is number of digits - to the right of the decimal point. - - @param index The field index (1-based). - @return The scale. - - @exception SQLException If the index is invalid - or an error occurs. - **/ - // @C1D public abstract int getFieldScale (int index) - // @C1D throws SQLException; - - - - /** - Return the SQL data object a field. - - @param index The field index (1-based). - @return The SQL data object. - - @exception SQLException If the index is invalid - or an error occurs. - **/ - public abstract SQLData getSQLData (int index) - throws SQLException; - - - - /** - Return the SQL data object a field intended for type - information only. This method does not perform any - data copying or converion, it just returns a representative - useful only for gathering type information. - - @param index The field index (1-based). - @return The SQL data object. - - @exception SQLException If the index is invalid - or an error occurs. - **/ - public abstract SQLData getSQLType (int index) - throws SQLException; - - /** - Is there a data mapping error for the field? - - @param index The field index (1-based). - @return true or false - - @exception SQLException If an error occurs. - **/ - public boolean isDataMappingError(int index) - throws SQLException; - - /** - Is the field value SQL NULL? - - @param index The field index (1-based). - @return true or false - - @exception SQLException If the index is invalid or an - error occurs. - **/ - public abstract boolean isNull (int index) - throws SQLException; - - - - /** - Can the field contain a SQL NULL value? - - @param index The field index (1-based). - @return true if nullable. - - @exception SQLException If the index is invalid - or an error occurs. - **/ - public abstract int isNullable (int index) - throws SQLException; - - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/JDRowCache.java b/cvsroot/src/com/ibm/as400/access/JDRowCache.java deleted file mode 100644 index 338be6622..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDRowCache.java +++ /dev/null @@ -1,232 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDRowCache.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - - - -/** -The JDRowCache interface represents a set of rows with the -ability to move among them. -**/ -// -// Implementation notes: -// -// There is always exactly 1 JDRow object associated with -// the row cache. Its contents will change to reflect the -// new cursor position. This implementation allows us to reduce -// the number of JDRow objects that get created, which will -// ultimately improve performace. -// -// However, this design decision is based on the assumption -// that the user will never access more than one row at a time, -// which is in line with the JDBC model. However, if JDBC ever -// adds something like ODBC's extended fetch and blocked inserts, -// then this design will need to be reworked slightly. -// -// Having a one-to-one correspondence between JDRowCache objects -// and JDRow objects kind of implies that they could be combined -// into 1 object. I am choosing at this point to leave them -// separated, however, just to make the code separate, since -// each deals with 2 different issues of result set management. -// -interface JDRowCache -{ - - - -//------------------------------------------------------------// -// // -// OPEN AND CLOSE // -// // -//------------------------------------------------------------// - - - -/** -Opens the cache. No rows are available until after the -cache has been opened. - -@exception SQLException If an error occurs. -**/ - public abstract void open () - throws SQLException; - - - -/** -Closes the cache. No more rows are available after the -cache has been closed. - -@exception SQLException If an error occurs. -**/ - public abstract void close () - throws SQLException; - - - -/** -Flushes the cache. This forces the next positioning to -fetch. - -@exception SQLException If an error occurs. -**/ - public abstract void flush () - throws SQLException; - - - -/** -Refreshes the row, i.e., re-reads it from the database. - -@exception SQLException If an error occurs. -**/ - public abstract void refreshRow () - throws SQLException; - - - -//------------------------------------------------------------// -// // -// CURSOR INFORMATION // -// // -//------------------------------------------------------------// - - - -/** -Returns the row object associated with this cache. - -@return The row object. -**/ - public abstract JDRow getRow (); - - - -/** -Indicates if the cache represents an empty result set. - -@return true if the cache represents an empty result set, - false otherwise. - -@exception SQLException If an error occurs. -**/ - public abstract boolean isEmpty () - throws SQLException; - - - -/** -Indicates if the cursor is positioned on a valid row. - -@return The row object. -**/ - public abstract boolean isValid (); - - - - -//------------------------------------------------------------// -// // -// CURSOR POSITIONING // -// // -//------------------------------------------------------------// - - - -/** -Positions the cursor to an absolute row number. - -@param rowNumber The row number. - -@exception SQLException If an error occurs. -*/ - public abstract void absolute (int rowNumber) - throws SQLException; - - - -/** -Positions the cursor after the last row. - -@exception SQLException If an error occurs. -**/ - public abstract void afterLast () - throws SQLException; - - - -/** -Positions the cursor before the first row. - -@exception SQLException If an error occurs. -**/ - public abstract void beforeFirst () - throws SQLException; - - - -/** -Positions the cursor to the first row. - -@exception SQLException If an error occurs. -**/ - public abstract void first () - throws SQLException; - - - -/** -Positions the cursor to the last row. - -@exception SQLException If an error occurs. -**/ - public abstract void last () - throws SQLException; - - - -/** -Positions the cursor to the next row. - -@exception SQLException If an error occurs. -**/ - public abstract void next () - throws SQLException; - - - -/** -Positions the cursor to the previous row. - -@exception SQLException If an error occurs. -**/ - public abstract void previous () - throws SQLException; - - - -/** -Positions the cursor to a relative row number. -@return The current row, or null if none. - -@exception SQLException If an error occurs. -*/ - public abstract void relative (int rowIndex) - throws SQLException; - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDRowIdProxy.java b/cvsroot/src/com/ibm/as400/access/JDRowIdProxy.java deleted file mode 100644 index 2c71a8736..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDRowIdProxy.java +++ /dev/null @@ -1,86 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDRowIdProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -/* ifdef JDBC40 -import java.sql.RowId; -endif */ - -//@PDA jdbc40 new class - -/** -The JDRowIdProxy class provides access to binary large -objects. The data is valid only within the current -transaction. -**/ -class JDRowIdProxy -extends AbstractProxyImpl -/* ifdef JDBC40 -implements RowId -endif */ - -{ - - // Copied from JDError: - private static final String EXC_FUNCTION_NOT_SUPPORTED = "IM001"; - - - public byte[] getBytes ( ) - { - try { - return (byte[]) connection_.callMethod (pxId_, "getBytes").getReturnValue(); - } - catch (InvocationTargetException e) { - - return null; //interface does not throw SQLException as of current version - } - } - - - public String toString() - { - try { - return (String) connection_.callMethod (pxId_, "toString").getReturnValue(); - } - catch (InvocationTargetException e) { - - return null; //interface does not throw SQLException as of current version - } - } - - public boolean equals(Object obj) - { - try { - return connection_.callMethod(pxId_, "equals", - new Class[] { Object.class }, - new Object[] { obj }, false).getReturnValueBoolean(); - } - catch (InvocationTargetException e) { - - return false; //interface does not throw SQLException as of current version - } - } - - public int hashCode() - { - try { - return connection_.callMethod(pxId_, "hashCode").getReturnValueInt(); - } - catch (InvocationTargetException e) { - - return 0; //interface does not throw SQLException as of current version - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JDSQLStatement.java b/cvsroot/src/com/ibm/as400/access/JDSQLStatement.java deleted file mode 100644 index 670826228..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDSQLStatement.java +++ /dev/null @@ -1,1260 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDSQLStatement.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.Connection; // @G4A -import java.sql.SQLException; -import java.util.StringTokenizer; -import java.util.Vector; - - - - -/** - Represents a parsed SQL statement. -**/ -// -// Implementation note: -// -// Originally, the statement was parsed as information -// was needed. For example, it did not parse to see -// if "FOR UPDATE" appeared until isForUpdate() was -// called. This strategy caused a lot of extraneous -// parsing, and most of the information is needed for -// most statements, so now all parsing is done at object -// construction time. -// -class JDSQLStatement -{ - // Native statement types. - // - static final int TYPE_UNDETERMINED = 0; - static final int TYPE_OTHER = 1; - static final int TYPE_SELECT = 2; - static final int TYPE_CALL = 3; - static final int TYPE_COMMIT = 4; - static final int TYPE_ROLLBACK = 5; - static final int TYPE_CONNECT = 6; - static final int TYPE_BLOCK_INSERT = 7; - - - - // String constants. These will hopefully help performance - // slightly - assuming a similar optimization does not - // already take place. - private static final String AS_ = "AS"; - private static final String CALL_ = "CALL"; - private static final String CALL0_ = "?"; // @E1A - private static final String CALL1_ = "?="; - private static final String CALL2_ = "?=CALL"; - static final String COMMA_ = ","; - private static final String CONNECT_ = "CONNECT"; - private static final String CONNECTION_ = "CONNECTION"; // @F1A - static final String CROSS_ = "CROSS"; - private static final String CURRENT_ = "CURRENT"; - private static final String DECLARE_ = "DECLARE"; - private static final String DELETE_ = "DELETE"; - private static final String DISCONNECT_ = "DISCONNECT"; - static final String EXCEPTION_ = "EXCEPTION"; - private static final String FETCH_ = "FETCH"; - private static final String FOR_ = "FOR"; - private static final String FROM_ = "FROM"; - static final String INNER_ = "INNER"; - private static final String INSERT_ = "INSERT"; - static final String JOIN_ = "JOIN"; - static final String LEFT_ = "LEFT"; - private static final String LPAREN_ = "("; - private static final String OF_ = "OF"; - private static final String ONLY_ = "ONLY"; - private static final String READ_ = "READ"; - private static final String RELEASE_ = "RELEASE"; - private static final String ROWS_ = "ROWS"; - private static final String SELECT_ = "SELECT"; - private static final String SET_ = "SET"; - private static final String UPDATE_ = "UPDATE"; - private static final String VALUES_ = "VALUES"; - private static final String WITH_ = "WITH"; // @B3A - private static final String MERGE_ = "MERGE"; //@blksql - - - - private boolean canBeBatched_ = false; // @H2A - private String correlationName_ = null; - private String csProcedure_ = null; // @G4A - private String csSchema_ = null; // @G4A - private boolean hasReturnValueParameter_ = false; // @E1A - private boolean isCall_ = false; - private boolean isDeclare_ = false; - private boolean isCurrentOf_ = false; - private boolean isDRDAConnect_ = false; // @B1A - private boolean isDRDADisconnect_ = false; // @B1A - private boolean isForFetchOrReadOnly_ = false; - private boolean isForUpdate_ = false; - private boolean isImmediatelyExecutable_ = false; - boolean isInsert_ = false; // @H2C Made not private. - private boolean isSelect_ = false; - private boolean isSet_ = false; // @F4A - private boolean isSubSelect_ = false; - private boolean isPackaged_ = false; - private boolean isUpdateOrDelete_ = false; - private int nativeType_ = TYPE_OTHER; - private int numberOfParameters_; - private String selectTable_ = null; - // @C3D private StringTokenizer tokenizer_ = null; - private JDSQLTokenizer tokenizer_ = null; // @C3A - private String value_; - // private String valueForServer_ = null; // @E1A - private boolean selectTableNotSet_ = true; //@K1A boolean to determine if selectTable_ has been set, if so, then selectTableNotSet_ is false - private boolean selectFromInsert_ = false; // @GKA - - - // Contains a list of AS400JDBCStatementListener objects to be invoked when events occur - // related to a JDSQLStatement. - private static final Vector statementListeners_ = new Vector(); - - // Load any statement listeners that are specified in a runtime property. - static - { - String classNames = SystemProperties.getProperty(SystemProperties.JDBC_STATEMENT_LISTENERS); - if (classNames != null) - { - StringTokenizer st = new StringTokenizer(classNames, ","); - while (st.hasMoreTokens()) - { - try - { - String clazz = st.nextToken(); - addStatementListener((AS400JDBCStatementListener)Class.forName(clazz).newInstance()); - Trace.log(Trace.INFORMATION, "Successfully loaded JDBC statement listener "+clazz); - } - catch (Throwable t) - { - Trace.log(Trace.WARNING, "Error instantiating JDBC statement listener: ", t); - } - } - } - } - - - /** - * Adds an AS400JDBCStatementListener. - **/ - static void addStatementListener(AS400JDBCStatementListener listener) - { - if (listener != null) statementListeners_.add(listener); - } - - /** - * Removes an AS400JDBCStatementListener. - **/ - static void removeStatementListener(AS400JDBCStatementListener listener) - { - if (listener != null) statementListeners_.remove(listener); - } - - /** - Constructs a JDSQLStatement object. Use this constructor - if you know you do not need to do any conversion to native - SQL. - - @param sql A SQL statement. - - @exception SQLException If there is a syntax error or - a reference to an unsupported - scalar function. - **/ - JDSQLStatement(String sql) throws SQLException - { - // decimalSeparator is "" because we only need it if convert is true - // this constructor is only used for SET TRANSACTION ISOLATION LEVEL called - // internally, so the last two parms can be null -- this code would need to - // be changed if this constructor were used for a CALL statement with named - // parameters - this(sql, "", false, JDProperties.PACKAGE_CRITERIA_DEFAULT, null); // @A1C //@G1C - - } - - - - /** - Constructs a JDSQLStatement object. - - @param sql A SQL statement. - @param decimalSeparator The decimal separator. - @param convert Convert to native SQL? - @param packageCriteria The package criteria. - @param connection A connection object to get properties off. - - @exception SQLException If there is a syntax error or - a reference to an unsupported - scalar function. - **/ - JDSQLStatement(String sql, String decimalSeparator, boolean convert, String packageCriteria, - Connection connection) // @A1C //@G1C - throws SQLException - { - if(sql == null) - { - JDError.throwSQLException(JDError.EXC_SYNTAX_ERROR); - } - - // Ensure that the string always contains at least one - // character, since some methods depend on that fact. - if(sql.trim().length() == 0) - { - JDError.throwSQLException(JDError.EXC_SYNTAX_BLANK); - } - - //@F6D // Count the number of parameters. Do not count parameter - //@F6D // markers that appear within quotes or after a comment - //@F6D // delimiter (two dashes). - //@F6D numberOfParameters_ = 0; - //@F6D int commentIndex = -1; - //@F6D int length = sql.length(); - //@F6D for (int i = 0; i < length; ++i) - //@F6D { - //@F6D char ch = sql.charAt(i); - //@F6D if (ch == '\'') - //@F6D { - //@F6D while ((i < length - 1) && (sql.charAt(++i) != '\'')); - //@F6D } - //@F6D else if (ch == '\"') - //@F6D { - //@F6D while ((i < length - 1) && (sql.charAt (++i) != '\"')); - //@F6D } - //@F6D else if (ch == '-') - //@F6D { - //@F6D if (i < length - 1) - //@F6D { - //@F6D if (sql.charAt(++i) == '-') - //@F6D { - //@F6D commentIndex = i; - //@F6D i = length; // break out of for loop @F2C - //@F6D } - //@F6D } - //@F6D } - //@F6D else if (ch == '?') - //@F6D { - //@F6D ++numberOfParameters_; - //@F6D } - //@F6D } - - //@F6A Start new code - // Strip off comments. Don't strip comment characters in literals. - int length = sql.length(); - - //char[] sqlArray = sql.toCharArray(); - //char[] outArray = new char[length]; - // @C3D int out = -1; // We are always pre-incrementing... so start before the first char here. - - // Perf Note: numberOfParameters_ will default to 0. Don't set it here. - - //@G8D boolean inComment = false; - - //@G7 Skip removing comments if it is a CREATE statement smaller than 32KB - //@G7 (Greater than 32KB would overflow the buffer, so we have to remove - //@G7 the comments in that case.) - //@C3D if (length > 32767 || //@G7A - //@C3D !sql.trim().toUpperCase().startsWith("CREATE")) //@G7A - //@C3D{ - //@G7 If this is not a normal CREATE or the length is too big, - //@G7 we must strip out the comments! - // @C3D for (int i = 0; i < length; ++i) { - // @C3D switch (sqlArray[i]) { - // @C3D case '\'': - // @C3D outArray[++out] = sqlArray[i]; - - // Consume everything while looking for the ending quote character. - // @C3D while (i < length - 1) { - // @C3D outArray[++out] = sqlArray[++i]; - // @C3D if (sqlArray[i] == '\'') { - // @C3D break; - // @C3D } - // @C3D } - - // @C3D break; - // @C3D case '\"': - // @C3D outArray[++out] = sqlArray[i]; - - // Consume everything while looking for the ending quote character. - // @C3D while (i < length - 1) { - // @C3D outArray[++out] = sqlArray[++i]; - - // @C3D if (sqlArray[i] == '\"') { - // @C3D break; - // @C3D } - // @C3D } - - // @C3D break; - // @C3D case '-': - // @C3D if (i < length - 1) { - // @C3D if (sqlArray[++i] == '-') { - // It's a single line commment (--). We are going to eat the comment until - // a new line character or the end of the string, but first output a space - // to the output buffer. - // @C3D outArray[++out] = ' '; - // @C3D while ((i < length - 1) && (sqlArray[++i] != '\n')) - // @C3D ; // do nothing but spin. - - // If we didn't break the loop because we were at the end of the string... - // we broke because of a newline character. Put it into the output. - // @C3D if (i < length - 1) - // @C3D outArray[++out] = '\n'; - - // @C3D } - // @C3D else { - // This was not a comment. Output the characters we read. - // @C3D outArray[++out] = sqlArray[i-1]; - // @C3D outArray[++out] = sqlArray[i]; - // @C3D } - // @C3D } - // @C3D else { - // Last character - must write the '-' - // @C3D outArray[++out] = sqlArray[i]; - // @C3D } - // @C3D break; - // @C3D case '/': - - // If we are not on the last character.... - // @C3D if (i < length - 1) { - // Check to see if we are starting a comment. - // @C3D if (sqlArray[++i] == '*') { - // It is a multi-line commment - write over the '/*' characters - // and set the inComment flag. - // @C3D outArray[++out] = ' '; - //@G8D inComment = true; - // @C3D int numComments = 1; //@G8A - keep track of the nesting level - - //@G8C - // Need to handle nested comments. - // If we see a */, we've closed a comment block. - // If we see another /*, we've started a new block. - // @C3D while (i < length - 1 && numComments > 0) //@G8C - // @C3D { - // @C3D char cur = sqlArray[++i]; //@G8A - // @C3D if (i < length-1) - // @C3D { - // @C3D char next = sqlArray[i+1]; - // @C3D if (cur == '*' && next == '/') - // @C3D { - // @C3D --numComments; - // @C3D ++i; - // @C3D } - // @C3D else if (cur == '/' && next == '*') - // @C3D { - // @C3D ++numComments; - // @C3D ++i; - // @C3D } - // @C3D } - // @C3D } - // @C3D } - // @C3D else { - // This was not a comment. Output the characters we read. - // @C3D outArray[++out] = sqlArray[i-1]; - // @C3D outArray[++out] = sqlArray[i]; - // @C3D } - // @C3D } - // @C3D else { - // Last character - must write the '/' - // @C3D outArray[++out] = sqlArray[i]; - // @C3D } - // @C3D break; - // @C3D case '?': - // Write the character. - // @C3D outArray[++out] = sqlArray[i]; - // @C3D ++numberOfParameters_; - // @C3D break; - // @C3D default: - // Write the character. - // @C3D outArray[++out] = sqlArray[i]; - // @C3D break; - // @C3D } - // @C3D } - - for (int i=0; i= JDUtilities.vrm540) ? 2097151 : 32767; //@PDC 2M for commentStrip in v5r4 - if(length > commentStripLength)//@PDC 2M for commentStrip - { // @C3A - String old = sql; - JDSQLTokenizer commentStripper = new JDSQLTokenizer(sql, JDSQLTokenizer.DEFAULT_DELIMITERS, true, false); // @C3A - sql = commentStripper.toString(); // @C3M - // Notify our listeners that we stripped comments. - if (old.length() != sql.length()) - { - for (int i=0; i= 0) - //@F6D { - //@F6D value_ = JDEscapeClause.parse(sql.substring(0, commentIndex), decimalSeparator) + sql.substring(commentIndex); - //@F6D } - //@F6D else - //@F6D { - value_ = JDEscapeClause.parse(sql, decimalSeparator, ((AS400JDBCConnection)connection).getVRM()); // @C1M - //@F6D } - } - else - { - value_ = sql; - } - - value_ = AS400BidiTransform.convertSQLToHostCCSID(value_, (AS400JDBCConnection)connection); //Bidi-HCG end - - tokenizer_ = new JDSQLTokenizer(value_, JDSQLTokenizer.DEFAULT_DELIMITERS, false, false); // @C3A moved this line up from below - numberOfParameters_ = tokenizer_.getNumberOfParameters(); // @C3A the tokenizer counts the number of parameter markers now - - // Determine the first word. - // @F2 - We need to skip any leading parentheses and whitespace and combinations thereof. - // e.g. SELECT - // (SELECT - // ( SELECT - // ((SELECT - // ( ( SELECT - String firstWord = ""; //@F2C - // @C3D tokenizer_ = new StringTokenizer(value_); - //@KBD while(firstWord == "" && tokenizer_.hasMoreTokens()) //@F2A - while(firstWord.length() == 0 && tokenizer_.hasMoreTokens()) //@KBA - { - String word = tokenizer_.nextToken(); - // Our StringTokenizer ensures that word.length() > 0 - int i=0; - int len = word.length(); - while(i < len && word.charAt(i) == '(') - { - ++i; - } - if(i < len) - { - firstWord = word.substring(i).toUpperCase(); - } - } - //@F2D if (tokenizer_.countTokens() > 0) - //@F2D { // @E2C - //@F2D firstWord = tokenizer_.nextToken().toUpperCase(); - //@F2D boolean flag = true; // @E2A - //@F2D while (flag) - //@F2D { // @E2A - //@F2D if (firstWord.length() == 0) // @E2A - //@F2D { - //@F2D flag = false; // @E2A - //@F2D } - //@F2D else if (firstWord.charAt(0) == '(') // @E2A - //@F2D { - //@F2D firstWord = firstWord.substring(1); // @E2A - //@F2D } - //@F2D else // @E2A - //@F2D { - //@F2D flag = false; // @E2A - //@F2D } - //@F2D } // @E2A - //@F2D } // @E2A - //@F2D else - //@F2D { - //@F2D firstWord = ""; - //@F2D } - - // Handle the statement based on the first word - if((firstWord.startsWith(SELECT_)) || (firstWord.equals(WITH_)) || (firstWord.startsWith(VALUES_))) // @F5C //@VALc //@val2 - { - // @B3C - isSelect_ = true; - nativeType_ = TYPE_SELECT; - } - else if((firstWord.equals(CALL_))) - { // @E1A - isCall_ = true; - nativeType_ = TYPE_CALL; - } - else if((firstWord.equals(CALL0_)) || (firstWord.equals(CALL1_)) || (firstWord.equals(CALL2_))) //@E1A - { - // @E1A - isCall_ = true; // @E1A - nativeType_ = TYPE_CALL; // @E1A - hasReturnValueParameter_ = true; // @E1A - --numberOfParameters_; // We will "fake" the first one. // @E1A - } // @E1A - // @E10 moved Release to its own block - else if(firstWord.equals(CONNECT_) || firstWord.equals(CONNECTION_) || firstWord.equals(DISCONNECT_)) //@F1C @E10c - { - nativeType_ = TYPE_CONNECT; - - if(firstWord.equals(CONNECT_)) // @B1A - { - isDRDAConnect_ = true; // @B1A - } - else if(firstWord.equals(DISCONNECT_)) // @B1A - { - isDRDADisconnect_ = true; // @B1A - } - } - // @E10 now release can be both a DRDC connection release or a savepoint release - else if(firstWord.equals(RELEASE_)) //@E10a - { - //@E10a - String upperCaseSql = value_.toUpperCase(); //@E10a - int k = upperCaseSql.indexOf("SAVEPOINT"); //@E10a - if(k >= 0) //@E10a - { - } // no need to do anything //@E10a - else //@E10a - nativeType_ = TYPE_CONNECT; //@E10a - } //@E10a - else if(firstWord.equals(INSERT_)) - { - isInsert_ = true; - - // Look for the string ROWS VALUES in the string. - String upperCaseSql = value_.toUpperCase(); - int k = upperCaseSql.indexOf(ROWS_); - int len = upperCaseSql.length(); //@F2A @H2M - if(k != -1) - { - k += 4; - while(k < len && Character.isWhitespace(upperCaseSql.charAt(k))) //@F2C - { - ++k; - } - if(upperCaseSql.regionMatches(k, VALUES_, 0, 6)) - { - nativeType_ = TYPE_BLOCK_INSERT; - } - } - - //@H2A Look for VALUES clause to determine whether this statement can be block inserted. - //@H2A The database will throw out block insert statements that have values other than - //@H2A parameter markers, like "INSERT INTO TABLE VALUES (NULL, ?)". - int m = upperCaseSql.indexOf(VALUES_); //@H2A - if(m != -1) //@H2A - { - //@H2A - m += 6; //@H2A - while(m < len && Character.isWhitespace(upperCaseSql.charAt(m))) //@H2A - { - //@H2A - ++m; //@H2A - } //@H2A - //@H2A - int lastParen = upperCaseSql.lastIndexOf(")"); //@H2A - //@J1 - According to the DB2 SQL Reference, paranthesis are optional around a single value - //@J1D if(lastParen < m) - //@J1D { - //@J1D JDError.throwSQLException(this, JDError.EXC_SYNTAX_ERROR); - //@J1D } - - if(lastParen >= 1 && lastParen > m) //@J1A make sure last parenthesis is after the VALUES keyword - { //@J1A - String valuesString = upperCaseSql.substring(m+1, lastParen); //@H2A - StringTokenizer tokenizer = new StringTokenizer (valuesString, ", ?\n\r\t"); //@H2A - if(!tokenizer.hasMoreTokens()) //@H2A - { - //@H2A - canBeBatched_ = true; //@H2A - } //@H2A - } //@J1A - else //@J1A Check to see if only one value or one parameter marker exists, if more than one value, then it is a syntax error - { //@J1A - String valuesString = upperCaseSql.substring(m); //@J1A - get everything after the VALUES clause - if(valuesString.trim().equals("?")) //@J1A - there is only one parameter marker, therefore, we can batch - canBeBatched_ = true; //@J1A - else //@J1A - make sure there is only one literal, otherwise a syntax error occured. - { //@J1A - // @A1D - // If a syntax error can occur, leave it to the engine to throw the exception. - // This code to throw an exception was removed because after V6R1 the syntax - // "insert into x values 1,2,3" is valid - //StringTokenizer tokenizer = new StringTokenizer(valuesString, ","); //@J1A - //if(tokenizer.countTokens() > 1) //@J1A - // JDError.throwSQLException(this, JDError.EXC_SYNTAX_ERROR); //@J1A - } //@J1A - } //@J1A - } - } - else if((firstWord.equals(UPDATE_)) || (firstWord.equals(DELETE_))) - { - if(((AS400JDBCConnection)connection).getVRM() >= JDUtilities.vrm710) { //@blksql - - if (((AS400JDBCConnection)connection).doUpdateDeleteBlocking()) { - canBeBatched_ = true; //@blksql - } - - } - isUpdateOrDelete_ = true; - } - else if(firstWord.equals(MERGE_)) //@blksql - { - if(((AS400JDBCConnection)connection).getVRM() >= JDUtilities.vrm710) { //@blksql - canBeBatched_ = true; //@blksql - } - } - else if(firstWord.equals(DECLARE_)) - { - isDeclare_ = true; - } - else if(firstWord.equals(SET_)) // @F4A - This entire block. - { - isSet_ = true; - nativeType_ = TYPE_UNDETERMINED; - // Note: See loop below for SET CONNECTION. - } - - //@G4A New code starts - if(isCall_) - { - // Strip off extra '?'s or '='s - while(tokenizer_.hasMoreTokens() && !firstWord.endsWith(CALL_)) - { - firstWord = tokenizer_.nextToken ().toUpperCase (); - } - String token = tokenizer_.nextToken(); - - int index = token.indexOf('('); - // Strip off the beginning of the parameters. - if(index != -1) - token = token.substring(0, index); - - String namingSeparator; - if(((AS400JDBCConnection)connection).getProperties(). - getString(JDProperties.NAMING).equalsIgnoreCase("sql")) - { - namingSeparator = "."; - } - else { - namingSeparator = "/"; - } - - //@DELIMa Added the following block to handle case sensitive procedure names and collection names - String qualifiedProcedure = null; // + procedure - StringBuffer buf = null; // for appending additional tokens - int schemaDelimEndIndex = -1; //@PDA flag used to preserve index inside qualifiedProcedure if schema is delim - - // If no quotes, and there's a separator in the middle, no need to peekToken(). - int separatorPos = token.indexOf(namingSeparator); - if(token.indexOf('\"') == -1 && separatorPos > 0 && separatorPos < token.length()-1) - { - qualifiedProcedure = token; - } - else if(token.endsWith(namingSeparator)) // schema not quoted, procedure is quoted - { - if(tokenizer_.hasMoreTokens()) { - buf = new StringBuffer(token); - buf.append(tokenizer_.nextToken()); - } - } - else if(tokenizer_.hasMoreTokens() && tokenizer_.peekToken().equals(namingSeparator)) // both schema and procedure are quoted - { - schemaDelimEndIndex = token.length(); - buf = new StringBuffer(token); - buf.append(tokenizer_.nextToken()); - if(tokenizer_.hasMoreTokens()) { - buf.append(tokenizer_.nextToken()); - } - } - else if(tokenizer_.hasMoreTokens() && tokenizer_.peekToken().startsWith(namingSeparator)) // schema is quoted (and maybe procedure too) - { - schemaDelimEndIndex = token.length(); - buf = new StringBuffer(token); - buf.append(tokenizer_.nextToken()); - } - else - { - qualifiedProcedure = token; // neither schema nor procedure is quoted - } - - if(buf != null) - { - qualifiedProcedure = buf.toString(); - int parenPos = qualifiedProcedure.indexOf('('); - // Strip off the beginning of the parameters. - if(parenPos != -1) - qualifiedProcedure = qualifiedProcedure.substring(0, parenPos); - } - buf = null; // we're done with the buffer - - // @PDC preserve index if schema is quoted, since it may contain a namingSeparator (ie. "De.lim"."My.Proc" ) - if(schemaDelimEndIndex == -1) - { - index = qualifiedProcedure.indexOf(namingSeparator); - } else - { - index = schemaDelimEndIndex; - } - - if(index == -1) - { - csProcedure_ = JDUtilities.upperCaseIfNotQuoted(qualifiedProcedure); - // Currently don't handle correctly if more than one library in list. - csSchema_ = ""; - } - else - { - csProcedure_ = JDUtilities.upperCaseIfNotQuoted(qualifiedProcedure.substring(index+1)); - csSchema_ = JDUtilities.upperCaseIfNotQuoted(qualifiedProcedure.substring(0,index)); - } - } - //@G4A New code ends - - // Now we need to do some parsing based on the - // rest of the words. These are tests for the - // following certain phrases: - // - // CURRENT OF - // FOR FETCH ONLY - // FOR READ ONLY - // FOR UPDATE - // FROM (select from-clause) - // - boolean isSecondToken = true; // @F4A - while(tokenizer_.hasMoreTokens()) - { - String token = tokenizer_.nextToken().toUpperCase(); - - if(isInsert_ && token.equals(SELECT_)) - { - isSubSelect_ = true; - } - else if(token.equals(CURRENT_) && tokenizer_.hasMoreTokens() && - tokenizer_.nextToken().equalsIgnoreCase(OF_)) - { - isCurrentOf_ = true; - } - else if(token.equals(FOR_)) - { - parseFor(); - } - else if(isSelect_ && token.equals(FROM_) && selectTableNotSet_) //@K1C Added not set to check for subqueries - { - selectTableNotSet_ = false; //@K1A - if(tokenizer_.hasMoreTokens()) - { - token = tokenizer_.nextToken(); //@F3C - - if(!token.startsWith(LPAREN_)) - { - // The "@G6A" code is trying to fix our parsing of the - // table-name in statements like - // SELECT * FROM collection."table with space" WHERE .... - // The tokenizer will break this up into tokens - // SELECT - // * - // FROM - // collection."table - // with - // space - // A customer reported a bug where we incorrectly re-formed - // the table name when doing an update row. The string we - // ended up with was. - // UPDATE collection."table SET column = value WHERE CURRENT OF cursor - // Note the fix is not to just slam tokens together, separating them by a space, - // until we find a token that ends with a quote. That won't fix the case - // where multiple spaces are between characters such as collection."a b". - // "a b" and "a b" are different tables. The fix is to go back to the - // original SQL statement, find the beginning of the collection/table name, - // then copy characters until finding the ending quote. - //if (token.indexOf('\"') >= 0) //@G6A - //{ //@G6A - // // find out if we already have the whole name by counting the quotes //@G6A - // int cnt = 0; //@G6A - // int ind = -1; //@G6A - // while ((ind = token.indexOf('\"', ind+1)) >= 0) { //@G6A - // cnt++; //@G6A - // } //@G6A - // // if there is an even number of quotes we already have an open //@G6A - // // and close so there is no need to look for another close //@G6A - // if (cnt % 2 == 0) { //@G6A - // selectTable_ = token; //@G6A - // } else { //@G6A - // // grab the rest of the token to the closing quote //@G6A - // String quotetok = ""; //@G6A - // if (tokenizer_.hasMoreTokens()) { //@G6A - // quotetok = tokenizer_.nextToken("\"") + "\""; //@G6A - // // grab the quote token from the end //@G6A - // tokenizer_.nextToken(" \t\n\r\f"); //@G6A - // } //@G6A - // selectTable_ = token + quotetok; //@G6A - // } //@G6A - //} //@G6A - //else //@G6A - - // @C3A put the code to determine the naming separator down here too - String namingSeparator; - if(((AS400JDBCConnection)connection).getProperties(). - getString(JDProperties.NAMING).equalsIgnoreCase("sql")) - { - namingSeparator = "."; - } - else - namingSeparator = "/"; - - // @C3A added the following block to handle case sensitive table and collection names - if(token.endsWith(namingSeparator)) - { - StringBuffer table = new StringBuffer(token); - if(tokenizer_.hasMoreTokens()) - table.append(tokenizer_.nextToken()); - selectTable_ = table.toString(); - } - else if(tokenizer_.hasMoreTokens() && tokenizer_.peekToken().equals(namingSeparator)) - { - StringBuffer table = new StringBuffer(token); - table.append(tokenizer_.nextToken()); - if(tokenizer_.hasMoreTokens()) - table.append(tokenizer_.nextToken()); - selectTable_ = table.toString(); - } - else if(tokenizer_.hasMoreTokens() && tokenizer_.peekToken().startsWith(namingSeparator)) - { - StringBuffer table = new StringBuffer(token); - table.append(tokenizer_.nextToken()); - selectTable_ = table.toString(); - } - else - { - selectTable_ = token; //@G6M - } - // @C3A end case sensitive table and collection name block - - if(tokenizer_.hasMoreTokens()) - { - token = tokenizer_.nextToken().toUpperCase(); - - if(token.equals(AS_) && tokenizer_.hasMoreTokens()) - { - correlationName_ = tokenizer_.nextToken().toUpperCase(); - } - else if(token.equals(FOR_)) - { - parseFor(); - } - } - } - } - } - else if(isSet_ && isSecondToken && token.equals(CONNECTION_)) // @F4A - This entire block. - { - nativeType_ = TYPE_CONNECT; - } - - isSecondToken = false; // @F4A - } - - // Based on all of the information that we - // have gathered up to this point, determine - // a few more tidbits. - boolean intermediate = (numberOfParameters_ > 0) - || (isInsert_ && isSubSelect_) - || (isCurrentOf_ && isUpdateOrDelete_); - - isImmediatelyExecutable_ = ! (intermediate || isSelect_); - - // @F8a Update package caching criteria to match ODBC and what is stated in - // @F8a our properties page. - // @F8a - // @F8d // @A1C - // @F8d // Changed the logic to determine isPackaged_ from the - // @F8d // "package criteria" property. - // @F8d if (packageCriteria.equalsIgnoreCase(JDProperties.PACKAGE_CRITERIA_DEFAULT)) - // @F8d { // @A1A - // @F8d isPackaged_ = intermediate - // @F8d || (isSelect_ && ! isForFetchOrReadOnly_) - // @F8d || (isDeclare_); - // @F8d } // @A1A - // @F8d else - // @F8d { // @A1A - // @F8d isPackaged_ = (isInsert_ && isSubSelect_) // @A1A - // @F8d || (isCurrentOf_ && isUpdateOrDelete_) // @A1A - // @F8d || (isSelect_ && ! isForFetchOrReadOnly_) // @A1A - // @F8d || (isDeclare_); // @A1A - // @F8d } // @A1A - - - isPackaged_ = ((numberOfParameters_ > 0) && !isCurrentOf_ && !isUpdateOrDelete_) // @F8a - || (isInsert_ && isSubSelect_) // @F8a - || (isSelect_ && isForUpdate_) // @F8a - || (isDeclare_); // @F8a - // @F8a - if(packageCriteria.equalsIgnoreCase(JDProperties.PACKAGE_CRITERIA_SELECT)) // @F8a - { - // @F8a - isPackaged_ = isPackaged_ || isSelect_; // @F8a - } // @F8a - - - - // If there is a return value parameter, strip if off now. @E1A - // The database does not understand these. @E1A - if(hasReturnValueParameter_) - { // @E1A - int call = value_.toUpperCase().indexOf(CALL_); // @E1A - if(call != -1) // @E1A - { - value_ = value_.substring(call); // @E1A - } - } // @E1A - - // Trim once and for all. @E1A - value_ = value_.trim(); // @E1A - tokenizer_ = null; //@mem make avail for GC now - } - - - - //@H2A - /** - Indicates if the statement can be batched. - - @return true if the statement can be batched; - false otherwise. - **/ - boolean canBatch() - { - return canBeBatched_; - } - - - /** - Returns the number of parameters in the SQL statement. - - @return Number of parameters. - **/ - int countParameters() - { - return numberOfParameters_; - } - - - - /** - Returns the correlation name for a SELECT statement. - - @return The correlation name, or null if no correlation name - is specified, or this is not a SELECT statement. - **/ - String getCorrelationName() - { - return correlationName_; - } - - - - /** - Returns the native statement type. - - @return Native type. - **/ - int getNativeType() - { - return nativeType_; - } - - - - //@G4A - /** - Returns the number of parameters for a statement. - - @return The number of parameters parsed in this class, or 0 - if no parameters were parsed. - **/ - int getNumOfParameters() - { - return numberOfParameters_; - } - - - - //@G4A - /** - Returns the procedure name name for a CALL stored procedure statement. - - @return The procedure name, or null if no stored procedure name - is specified, or this is not a CALL statement. - **/ - String getProcedure() - { - return csProcedure_; - } - - - - //@G4A - /** - Returns the schema name for a CALL stored procedure statement. - - @return The schema name, or null if no stored procedure name - is specified, or this is not a CALL statement. - **/ - String getSchema() - { - return csSchema_; - } - - - - /** - Returns the single table name for a SELECT statement. - - @return The single table name, or null if multiple tables - were specified, or this is not a SELECT statement. - **/ - String getSelectTable() - { - return selectTable_; - } - - - - // @E1A - /** - Indicates if the SQL statement has a return value parameter. - - @return true if the SQL statement has a return value parameter, - false otherwise. - **/ - boolean hasReturnValueParameter() // @E1A - { // @E1A - return hasReturnValueParameter_; // @E1A - } // @E1A - - - - // @B1A - /** - Indicates if the statement initiates a - DRDA connection. - - @return true if the statement initiates a - DRDA connection; false otherwise. - **/ - boolean isDRDAConnect() - { - return isDRDAConnect_; - } - - - - // @B1A - /** - Indicates if the statement closes a - DRDA connection. - - @return true if the statement closes a - DRDA connection; false otherwise. - **/ - boolean isDRDADisconnect() - { - return isDRDADisconnect_; - } - - - - /** - Indicates if the statement contains a FOR FETCH - ONLY or FOR READ ONLY clause. - - @return true if the statement contains a - FOR FETCH ONLY or FOR READ ONLY clause; - false otherwise. - **/ - boolean isForFetchOnly() - { - return isForFetchOrReadOnly_; - } - - - - /** - Indicates if the statement contains a FOR UPDATE - clause. - - @return true if the statement contains a - FOR UPDATE clause; false otherwise. - **/ - boolean isForUpdate() - { - return isForUpdate_; - } - - - - /** - Indicates if the statement can be executed immediately - without doing a separate prepare and execute. - - @return true if the statement can be executed - immediately executable; false otherwise. - **/ - boolean isImmediatelyExecutable() - { - return isImmediatelyExecutable_; - } - - - - /** - Indicates if this statement should be stored in - a package. This decision is based on characteristics - that make statements good candidates for being - stored in packages (those that will likely benefit - overall performance by being stored in a package). - This helps to reduce clutter in packages. - - @return true if the statement should be stored - in a package; false otherwise. - **/ - boolean isPackaged() - { - return isPackaged_; - } - - - - /** - Indicates if the statement is a stored procedure call. - - @return true if the statement is a stored - procedure call; false otherwise. - **/ - boolean isProcedureCall() - { - return isCall_; - } - - - - /** - Indicates if the statement a SELECT. - - @return true if the statement is a SELECT; - false otherwise. - **/ - boolean isSelect() - { - return isSelect_; - } - - - - /** - Parses the token after FOR. - **/ - private void parseFor() - { - if(tokenizer_.hasMoreTokens()) - { - String token = tokenizer_.nextToken().toUpperCase(); - - if((token.equals(FETCH_)) || (token.equals(READ_))) - { - if(tokenizer_.hasMoreTokens() && tokenizer_.nextToken().equalsIgnoreCase(ONLY_)) - { - isForFetchOrReadOnly_ = true; - } - } - else if(token.equals(UPDATE_)) - { - isForUpdate_ = true; - } - } - } - - - // @G5 new method - /** - Sets the native statement type to one of the valid types. - If an invalid type is specified, no change will occur. - Valid types are: -

      -
    • TYPE_UNDETERMINED -
    • TYPE_OTHER -
    • TYPE_UNDETERMINED -
    • TYPE_OTHER -
    • TYPE_SELECT -
    • TYPE_CALL -
    • TYPE_COMMIT -
    • TYPE_ROLLBACK -
    • TYPE_CONNECT -
    • TYPE_BLOCK_INSERT -
    - @param type Native statement type. - **/ - public void setNativeType (int type) // @G5A - { // @G5A - nativeType_ = type; // @G5A - return; // @G5A - } // @G5A - - - // @GKA - public void setSelectFromInsert(boolean selectFromInsert){ - selectFromInsert_ = selectFromInsert; - } - - // @GKA - public boolean isSelectFromInsert() - { - return selectFromInsert_; - } - - - /** - Returns the SQL statement as a String. This will be - native SQL if conversion was requested. - - @return The string, optionally native SQL. - **/ - public String toString() - { - return value_; // @E1C - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDSQLToken.java b/cvsroot/src/com/ibm/as400/access/JDSQLToken.java deleted file mode 100644 index 8fd3eb48c..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDSQLToken.java +++ /dev/null @@ -1,49 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDSQLToken.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * JDSQLToken stores information about - * the location of tokens inside of the SQL - * statement for a JDSQLTokenizer object. -**/ -final class JDSQLToken -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - char[] data_; - int offset_; - int length_; - int type_; - int parms_; - - JDSQLToken(char[] data, int offset, int length, int type) - { - data_ = data; - offset_ = offset; - length_ = length; - type_ = type; - } - - JDSQLToken(char[] data, int offset, int length, int type, int parms) - { - this(data, offset, length, type); - parms_ = parms; - } - - public String getToken() - { - return new String(data_, offset_, length_); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JDSQLTokenList.java b/cvsroot/src/com/ibm/as400/access/JDSQLTokenList.java deleted file mode 100644 index 83b69c918..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDSQLTokenList.java +++ /dev/null @@ -1,34 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDSQLTokenList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// This is more efficient than a Vector, and doesn't need to be synchronized. -final class JDSQLTokenList -{ - static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - JDSQLToken[] tokens_ = new JDSQLToken[32]; // Even a space is a token, so there will be lots! - int count_; - - final void addToken(final JDSQLToken t) - { - if (count_ >= tokens_.length) - { - JDSQLToken[] temp = tokens_; - tokens_ = new JDSQLToken[temp.length*2]; - System.arraycopy(temp, 0, tokens_, 0, temp.length); - } - tokens_[count_++] = t; - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/access/JDSQLTokenizer.java b/cvsroot/src/com/ibm/as400/access/JDSQLTokenizer.java deleted file mode 100644 index c5c191559..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDSQLTokenizer.java +++ /dev/null @@ -1,335 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDSQLTokenizer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.*; - -/** - * This class allows SQL statements to be tokenized without having - * to worry about delimiters appearing in comments. The tokenizer will - * check to make sure the delimiter is not inside a comment before using - * it to separate tokens. This tokenizer behaves much like StringTokenizer. -**/ -class JDSQLTokenizer implements Enumeration -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - /** - Constant containing the default delimiters for SQLTokenizers. - **/ - public static final String DEFAULT_DELIMITERS = " \t\n\r\f"; - - // Performance improvement when using default delimiters. - private static final char[] INTERNAL_DELIMITERS = DEFAULT_DELIMITERS.toCharArray(); - - /** - Constant indicating the token is a delimiter. - **/ - private static final int TOKEN_TYPE_DELIMITER = 1; - - /** - Constant indicating the token is a comment. - **/ - private static final int TOKEN_TYPE_COMMENT = 2; - - /** - Constant indicating the token is a literal. - **/ - private static final int TOKEN_TYPE_LITERAL = 4; - - /** - Constant indicating the token is part of the SQL statement. - **/ - private static final int TOKEN_TYPE_SQL = 8; - - private JDSQLToken[] tokens_; - private int numberOfParameters_; - - private int currentTokenIndex_; - - /** - Constructs a JDSQLTokenizer with the default delimiter - String of " \t\n\r\f". - - @param statement SQL statement to tokenize. - **/ - public JDSQLTokenizer(String statement) - { - this(statement, DEFAULT_DELIMITERS, true, true); - } - - /** - Constructs a JDSQLTokenizer with the specified delimiter - String. - - @param statement SQL statement to tokenize. - @param delimiters Set of delimiters to use. - **/ - public JDSQLTokenizer(String statement, String delimiters) - { - this(statement, delimiters, true, true); - } - - /** - Constructs a JDSQLTokenizer with the specified delimiter String - and the specified delimiter/comment behavior. - - @param statement SQL statement to tokenize. - @param delimiters Set of delimiters to use. - @param returnDelimiters true if we should return delimiters as tokens - @param returnComments true if we should return comments as tokens - **/ - public JDSQLTokenizer(String statement, String delimiters, boolean returnDelimiters, boolean returnComments) - { - final char[] delims = (DEFAULT_DELIMITERS.equals(delimiters) ? INTERNAL_DELIMITERS : delimiters.toCharArray()); - tokens_ = scanForTokens(statement, delims, returnComments, returnDelimiters); - numberOfParameters_ = 0; - for (int i=0; i 0) - { - final int p2 = offset+1; - if (p2 < bufferLen) - { - if (buffer[offset] == '/' && buffer[p2] == '*') - { - ++commentDepth; - ++offset; - } - else if (buffer[offset] == '*' && buffer[p2] == '/') - { - --commentDepth; - ++offset; - } - } - ++offset; - } - if (returnComments) token = new JDSQLToken(buffer, start, offset-start, TOKEN_TYPE_COMMENT); - } - else if (p < bufferLen && buffer[offset] == '-' && buffer[p] == '-') - { - // Scan for newline that ends the single-line comment. - int start = offset; - offset = p+1; - while (offset < bufferLen && buffer[offset++] != '\n'){ - //loop - } - if (returnComments) token = new JDSQLToken(buffer, start, offset-start, TOKEN_TYPE_COMMENT); - } - else if (buffer[offset] == '\'') - { - // entering single quote - int start = offset; - ++offset; - while (offset < bufferLen && buffer[offset++] != '\'') {} - token = new JDSQLToken(buffer, start, offset-start, TOKEN_TYPE_LITERAL); - } - else if (buffer[offset] == '"') - { - // entering double quote - int start = offset; - ++offset; - while (offset < bufferLen && buffer[offset++] != '\"') {} - token = new JDSQLToken(buffer, start, offset-start, TOKEN_TYPE_LITERAL); - } - else if (buffer[offset] == '(') - { //@PDA - // Need to check for case like "insert into x (select ...)" where there is no space after ( - // Since no select token was found, the "extended dynamic" package was not being generated. - // So force a token if '(' is matched. Should be ok in all cases that are not delimited since - // they can have a space after '(' anyway. - int start = offset; - ++offset; - token = new JDSQLToken(buffer, start, offset-start, TOKEN_TYPE_SQL); - } - else if (isDelimiter(buffer[offset], delimiters)) - { - // character at pos is a delimiter - if (returnDelimiters) token = new JDSQLToken(buffer, offset, 1, TOKEN_TYPE_DELIMITER); - ++offset; - } - else - { - // character is not any of the above - // scan up to the next delimiter - int numberOfParms = 0; - final int start = offset; - while (offset < bufferLen && - !isDelimiter(buffer[offset], delimiters) && - buffer[offset] != '\'' && - buffer[offset] != '\"') - { - final int p2 = offset+1; - if (p2 < bufferLen && - ((buffer[offset] == '/' && buffer[p2] == '*') || - (buffer[offset] == '-' && buffer[p2] == '-'))) - { - break; - } - else if (buffer[offset] == '?') - { - ++numberOfParms; - } - ++offset; - } - token = new JDSQLToken(buffer, start, offset-start, TOKEN_TYPE_SQL, numberOfParms); - } - - if (token != null) tokens.addToken(token); - } - final JDSQLToken[] jdTokens = new JDSQLToken[tokens.count_]; - System.arraycopy(tokens.tokens_, 0, jdTokens, 0, tokens.count_); - return jdTokens; - } - - /** - Returns a list of the tokens after scanning the String, with no separators. - - @return The String representation of this tokenizer. - **/ - public String toString() - { - StringBuffer contents = new StringBuffer(); - for (int i=0; i T getSource(Class sourceClass) throws SQLException - { - try - { - //not currently supported. get exception from proxy server - JDWriterProxy newWriter = new JDWriterProxy (); - return (T) connection_.callFactoryMethod (pxId_, "getSource", - new Class[] { Class.class}, - new Object[] { sourceClass }, - newWriter); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - endif */ - - public String getString() throws SQLException - { - try { - return (String) connection_.callMethod (pxId_, "getString").getReturnValue(); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - public OutputStream setBinaryStream() throws SQLException - { - try { - JDOutputStreamProxy newStream = new JDOutputStreamProxy (); - return (JDOutputStreamProxy) connection_.callFactoryMethod ( - pxId_, "setBinaryStream", - newStream); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - /* ifdef JDBC40 - public T setResult(Class resultClass) throws SQLException - { - try - { - //not currently supported. get exception from proxy server - JDWriterProxy newWriter = new JDWriterProxy (); - return (T) connection_.callFactoryMethod (pxId_, "setResult", - new Class[] { Class.class}, - new Object[] { resultClass }, - newWriter); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - endif */ - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDScaleFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDScaleFieldMap.java deleted file mode 100644 index 3689b9ba4..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDScaleFieldMap.java +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDScaleFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - -class JDScaleFieldMap -extends JDTypeInfoFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - private int scaleIndex_; //@A1A - private int typeIndex_; //@A1A - JDScaleFieldMap(int typeIndex, int lengthIndex, int precisionIndex, - int scaleIndex, int ccsidIndex, int vrm, JDProperties properties) // @M0C - added vrm and properties //@KKB - { - super(typeIndex, lengthIndex, precisionIndex, scaleIndex, ccsidIndex, vrm, properties); // @M0C //@KKB - scaleIndex_ = scaleIndex; //@A1A - typeIndex_ = typeIndex; //@A1A - } - - /** - Returns the data type in JDBC format. - **/ - public Object getValue(JDRow row) - throws SQLException - { - String typeName = row.getSQLData(typeIndex_).getString().trim(); //@A1A - if(typeName.equals("DISTINCT")) //@A1A - return new Integer(row.getSQLData(scaleIndex_).getInt()); //@A1A - return new Integer(((SQLData)super.getValue(row)).getScale()); - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return false; - } - - /** - Indicates if the value is null. - **/ - public boolean isNull(JDRow row) - throws SQLException - { - return false; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JDSearchPattern.java b/cvsroot/src/com/ibm/as400/access/JDSearchPattern.java deleted file mode 100644 index fb0d6121c..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDSearchPattern.java +++ /dev/null @@ -1,190 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDSearchPattern.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** - The JDSearchPattern class represents a search pattern based on a - pattern string used as input to many functions. -**/ -// -// Note that there is a difference between a null and empty pattern -// string. -// -final class JDSearchPattern -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - private static final String ESCAPE_CHAR_ = "\\"; // same as \ - - private String patternString_; - - - -/** - Constructs a JDSearchPattern object. - - @param patternString The pattern string. -**/ - JDSearchPattern (String patternString) - { - patternString_ = (patternString != null) ? patternString.trim() - : null; - } - - - -/** - Indicates if the search pattern contains an escape character. - - @return true if it contains an escape character; false otherwise. -**/ - final boolean containsEscape () - { - return (patternString_ != null) - ? (patternString_.indexOf (ESCAPE_CHAR_) != -1) - : false; - } - - - -/** - Indicates if the search pattern contains any wildcard - characters. - - @return true if it contains a wildcard; false otherwise. -**/ - final boolean containsSearchPattern () - { - return (patternString_ != null) ? ((patternString_.indexOf ('%') != -1) - || (patternString_.indexOf ('_') != -1)) : false; - } - - - -/** - Returns the escape character. - - @return The escape character. -**/ - static final String getEscape () - { - return ESCAPE_CHAR_; - } - - - -/** - Returns the appropriate search pattern indicator. This - is used in ROI server requests. - - @return The search pattern indicator. -**/ - final int getIndicator () - { - int indicator; - if (containsSearchPattern () || containsEscape ()) - { - indicator = 0xF1; - } - else - { - indicator = 0xF0; - } - return indicator; - } - - - - -/** - Returns the pattern string. - - @return The pattern string. -**/ - final String getPatternString () - { - return patternString_; - } - - - -/** - Returns the appropriate SQL WHERE clause for inclusion in - a SELECT statement in order to query for this search pattern. - - @param columnName The name of the column associated with - this search pattern. - @return The SQL WHERE clause. -**/ - final String getSQLWhereClause (String columnName) - { - StringBuffer clause = new StringBuffer (); - if (isSpecified()) - { - clause.append (columnName); // ie SCHEMA_NAME - clause.append (" "); - if (containsSearchPattern ()) - { - clause.append ("LIKE '"); - clause.append (unquote(patternString_)); //@DELIMc - clause.append ("' "); - if (containsEscape ()) - { - clause.append ("ESCAPE '"); - clause.append (ESCAPE_CHAR_); - clause.append ("' "); - } - } - else // Does not contain a search pattern, don't use LIKE - { - clause.append ("= '"); - clause.append (unquote(patternString_)); //@DELIMc - clause.append ("' "); - } - - } // if not specified, will return empty string - - return clause.toString(); - } - - - -/** - Indicates if the search pattern is specified. - - @return true if specified; false otherwise. -**/ - final boolean isSpecified () - { - return (patternString_ != null); - } - - -//@DELIMa -/** - Prepares a name to be single-quoted. - - @return The quote-ready name. -**/ - private static final String unquote(String name) - { - return JDUtilities.prepareForSingleQuotes(name, false); - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/JDServerRow.java b/cvsroot/src/com/ibm/as400/access/JDServerRow.java deleted file mode 100644 index adc54133b..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDServerRow.java +++ /dev/null @@ -1,844 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDServerRow.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.util.Hashtable; - - - -/** -The JDServerRow class implements a row of data that is loaded -directly from a datastream to or from the system. -**/ -class JDServerRow -implements JDRow -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - private int[] parameterTypes_; - - - // Private data. - private AS400JDBCConnection connection_; - private int[] ccsids_; - private int[] dataLength_; - private int[] dataOffset_; - private String[] fieldNames_; - private int[] lobLocatorHandles_; // @C2A - private int[] precisions_; - private byte[] rawBytes_; - private int rowDataOffset_; - private int rowIndex_; - private int[] scales_; - private DBData serverData_; - private DBDataFormat serverFormat_; - private SQLData[] sqlData_; - private int[] sqlTypes_; - private boolean[] translated_; - private boolean wasCompressed = false; // set to true if variable length field compression is used - private Hashtable insensitiveColumnNames_; // @PDA maps strings to column indexes - boolean containsLob_; //@re-prep - boolean containsArray_; //@array - - /** - Constructs a JDServerRow object. Use this constructor - when the format information has already been retrieved - from the system. - - @param connection The connection to the system. - @param id The id. - @param serverFormat The server format information. - @param settings The conversion settings. - - @exception SQLException If an error occurs. - **/ - JDServerRow (AS400JDBCConnection connection, - int id, - DBDataFormat serverFormat, - SQLConversionSettings settings) - throws SQLException - { - initialize (connection, id, serverFormat, settings); - } - - - - /** - Constructs a JDServerRow object. Use this constructor when format - information has not yet been retrieved from the system. - - @param connection The connection to the system. - @param id The id. - @param settings The conversion settings. - - @exception SQLException If an error occurs. - **/ - /* @C1D - JDServerRow (AS400JDBCConnection connection, - int id, - SQLConversionSettings settings) - throws SQLException - { - DBDataFormat serverFormat = null; - - DBSQLRequestDS request = new DBSQLRequestDS ( - DBSQLRequestDS.FUNCTIONID_DESCRIBE, - id, DBSQLRequestDS.ORS_BITMAP_RETURN_DATA - + DBSQLRequestDS.ORS_BITMAP_DATA_FORMAT, 0); - - DBReplyRequestedDS reply = connection.sendAndReceive (request, id); - - int errorClass = reply.getErrorClass(); - int returnCode = reply.getReturnCode(); - - if (errorClass != 0) - JDError.throwSQLException (connection, id, errorClass, returnCode); - - serverFormat = reply.getDataFormat (); - - initialize (connection, id, serverFormat, settings); - } - */ - - - - // @D1A - /** - Returns the raw bytes. - - @param index The field index (1-based). - @return A copy of the bytes. - **/ - byte[] getRawBytes(int index) - { - int index0 = index - 1; - byte[] copy = new byte[dataLength_[index0]]; - System.arraycopy(rawBytes_, rowDataOffset_ + dataOffset_[index0], copy, 0, dataLength_[index0]); - return copy; - } - - - - /** - Initializes the state of the object. - - @param connection The connection to the system. - @param id The id. - @param serverFormat The server format information. - @param settings The conversion settings. - - @exception SQLException If an error occurs. - **/ - private void initialize (AS400JDBCConnection connection, - int id, - DBDataFormat serverFormat, - SQLConversionSettings settings) - throws SQLException - { - // Initialization. - connection_ = connection; - rawBytes_ = null; - rowDataOffset_ = -1; - rowIndex_ = -1; - serverData_ = null; - serverFormat_ = serverFormat; - int dateFormat = -1; // @550A - int timeFormat = -1; // @550A - - try - { - int count; - if(serverFormat_ == null) - count = 0; - else - count = serverFormat_.getNumberOfFields (); - - ccsids_ = new int[count]; - dataLength_ = new int[count]; - dataOffset_ = new int[count]; - fieldNames_ = new String[count]; - lobLocatorHandles_= new int[count]; // @C2A - precisions_ = new int[count]; - scales_ = new int[count]; - sqlData_ = new SQLData[count]; - sqlTypes_ = new int[count]; - translated_ = new boolean[count]; - insensitiveColumnNames_ = null; //@PDA - containsLob_ = false; //@re-prep - containsArray_ = false; //@array - - // Compute the offsets, lengths, and SQL data for - // each field. - if(count > 0) - { - int offset = 0; - boolean translateBinary = connection.getProperties().getBoolean (JDProperties.TRANSLATE_BINARY); - if(connection_.getVRM() >= JDUtilities.vrm610 && serverFormat_.getCSRSData()) // @550A retrieve date/time formats if the data is from a stored procedure result set - { - dateFormat = serverFormat_.getDateFormat(); - timeFormat = serverFormat_.getTimeFormat(); - } - for(int i = 0; i < count; ++i) - { - ccsids_[i] = serverFormat_.getFieldCCSID (i); - dataOffset_[i] = offset; - dataLength_[i] = serverFormat_.getFieldLength (i); - //@array (if array type) here we do not know the array length, just the element length, but that is okay since the elem length is fed into the sqlDataTemplate in SQLArray. (for reply result, setRowIndex() will later re-populate the dataLength_ and dataOffset_ arrays anyways.) - lobLocatorHandles_[i] = serverFormat_.getFieldLOBLocator (i); // @C2C - offset += dataLength_[i]; - scales_[i] = serverFormat_.getFieldScale (i); - precisions_[i] = serverFormat_.getFieldPrecision (i); - sqlTypes_[i] = serverFormat_.getFieldSQLType (i); - int compositeContentType = -1; - if( serverFormat_.getArrayType (i) == 1) //@array - { - compositeContentType = sqlTypes_[i] & 0xFFFE; //@array - sqlTypes_[i] = SQLData.NATIVE_ARRAY; //@array not a hostserver number, since we only get a 1 bit array flag for the type - } - //@array comment: we are assuming here that all of the metadata above (except sqlType) is for the array content type - - //@re-prep check if lob or locator type here - //hostserver cannot know beforehand if type will be a lob or a locator. This is on a per-connection basis. - int fieldType = sqlTypes_[i] & 0xFFFE; //@re-prep - if(fieldType == 404 || fieldType == 960 || fieldType == 408 || fieldType == 964 || fieldType == 412 || fieldType == 968) //@re-prep - containsLob_ = true; //@re-prep - else if(fieldType == SQLData.NATIVE_ARRAY) //@array - containsArray_ = true; //@array - - int maxLobSize = serverFormat_.getFieldLOBMaxSize (i); // @C2C - int xmlCharType = serverFormat_.getXMLCharType(i); //@xml3 sb=0 or db=1 - sqlData_[i] = SQLDataFactory.newData (connection, id, - fieldType, dataLength_[i], precisions_[i], - scales_[i], ccsids_[i], translateBinary, settings, - maxLobSize, (i+1), dateFormat, timeFormat, compositeContentType, xmlCharType); //@F1C // @C2C @550C @array //@xml3 - // @E2D // SQLDataFactory never returns null. - // @E2D if (sqlData_[i] == null) - // @E2D JDError.throwSQLException (JDError.EXC_INTERNAL); - } - } - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - } - - // If varying length field compression was used, and it was not used on a subsequent request, we need to set the - // data offsets and data lengths based on the server format - void setOriginalData() throws SQLException{ - try{ - int count = 0; - if(serverFormat_ != null) - count = serverFormat_.getNumberOfFields (); - - if(count>0){ - int offset = 0; - for(int i = 0; i < count; ++i) - { - dataOffset_[i] = offset; - dataLength_[i] = serverFormat_.getFieldLength (i); - offset += dataLength_[i]; - } - } - } - catch(DBDataStreamException e){ - JDError.throwSQLException(JDError.EXC_INTERNAL, e); - } - - } - - - - /** - Sets the server data. Use this when new data has been retrieved - from the system. - - @param serverData The server data. - - @exception SQLException If an error occurs. - **/ - void setServerData (DBData serverData) - throws SQLException - { - serverData_ = serverData; - - try - { - rawBytes_ = serverData_.getRawBytes (); - //@array all parsed variable array data from host is inside of DBVariableData (serverData_) - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - } - - - - /** - Sets the row index within the server data. - - @param rowIndex The row index (0-based). - - @exception SQLException If an error occurs. - **/ - void setRowIndex (int rowIndex) - throws SQLException - { - rowIndex_ = rowIndex; - - try - { - if(serverData_ != null) - { - rowDataOffset_ = serverData_.getRowDataOffset (rowIndex_); - //@array calculate data offsets for arrays (result data from host) - if(this.containsArray_ && rowDataOffset_ != -1) //@array array data not VLC but variable in length - { - //Here if reply is VariableData needed for Arrays. //@array - //@array set input array lengths of data - int offset = 0; //@array - int numOfFields = serverFormat_.getNumberOfFields(); //@array - int[] dataLengths = ((DBVariableData)serverData_).getDataLengthsFromHost(); //@array - int outCount = 0; //@arrayout - for(int j=0; j= 1; i--)//@pdc 776N6J (int i = 1; i <= sqlData_.length; i++) - { - String cName = getFieldName(i); - - // Never uppercase the name from the database. If the name is - // supposed to be uppercase, it will already be. If it isn't, it will be - // lowercase and its double quotes will be missing. - insensitiveColumnNames_.put(cName, new Integer(i)); - } - } - - // Look up the mapping in our cache. First look up using the user's casing - Integer x = (Integer) insensitiveColumnNames_.get(name); - if (x != null) - return (x.intValue()); - else - { - String upperCaseName = name.toUpperCase(); - x = (Integer) insensitiveColumnNames_.get(upperCaseName); - - if (x != null) - { - // Add the user's casing - insensitiveColumnNames_.put(name, x); - return (x.intValue()); - } - } - } - JDError.throwSQLException (JDError.EXC_COLUMN_NOT_FOUND); - return -1; - } - - - - public int getFieldCount () - { - return sqlData_.length; - } - - - - public int getFieldLOBLocatorHandle (int index) // @C2A - throws SQLException // @C2A - { // @C2A - return lobLocatorHandles_[index-1]; // @C2A - } // @C2A - - - - public String getFieldName (int index) - throws SQLException - { - try - { - // We need to trim() the field name before - // returning it, since in some cases (e.g. - // stored procedure written in RPG) the - // field names have spaces at end of the name. - // - // Cache the field names so we only translate them once. - // - int index0 = index-1; - if(fieldNames_[index0] == null) - fieldNames_[index0] = serverFormat_.getFieldName (index0, - connection_.getConverter (serverFormat_.getFieldNameCCSID (index0))).trim(); - - //Bidi-HCG - add converion from serverFormat_.getFieldNameCCSID (index0) to "bidi string type" here - //Bidi-HCG start - boolean reorder = connection_.getProperties().getBoolean(JDProperties.BIDI_IMPLICIT_REORDERING); - if(reorder){ - String value_ = fieldNames_[index0]; - value_ = AS400BidiTransform.convertDataFromHostCCSID(value_, connection_, serverFormat_.getFieldNameCCSID (index0)); - return value_; - } - //Bidi-HCG end - return fieldNames_[index0]; - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_DESCRIPTOR_INDEX_INVALID, e); - return null; - } - } - - - /* @C1D - public int getFieldPrecision (int index) - throws SQLException - { - return precisions_[index-1]; - } - - - - public int getFieldScale (int index) - throws SQLException - { - return scales_[index-1]; - } - */ - - - - public SQLData getSQLData (int index) - throws SQLException - { - try - { - int index0 = index - 1; - - // Translate the first time only, and only when there - // is a current row. - // (There is a chance that there are not when - // this gets called, specifically in the case - // where result set meta data methods get called - // before fetching data.) - if((rowIndex_ >= 0) && (translated_[index0] == false)) - { - - // @E1D // The CCSID returned in the data format is not - // @E1D // necessarily correct (says the database host server - // @E1D // documentation), so we should always use the server - // @E1D // job CCSID or its graphic equivalent. - // @E1D ConverterImplRemote ccsidConverter = null; - // @E1D if (sqlData_[index0].isText ()) { - // @E1D if (sqlData_[index0].isGraphic ()) { - // @E1D // @A0A - // @E1D // Code added here to check for the 13488 Unicode ccsid. - // @E1D // If there's one, set 'ccsidConverter' to null so that - // @E1D // hand conversion is done in SQLChar.set(). - // @E1D if (ccsids_[index0] == 13488) // @A0A - // @E1D ccsidConverter = null; // @A0A - // @E1D else // @A0A - // @E1D ccsidConverter = connection_.getGraphicConverter (); - // @E1D } - // @E1D else - // @E1D ccsidConverter = connection_.getConverter (); - // @E1D } - - // Use the CCSID returned in the data format. // @E1A - ConvTable ccsidConverter = connection_.getConverter(ccsids_[index0]); // @E1A @P0C - - // If there are bytes, then do a translation. - if(rawBytes_ != null) - { - //set array length so convertFromRawBytes knows how many to convert - if(sqlData_[index0].getType() == java.sql.Types.ARRAY) //@array - { //@array - int outputIndex0 = getVariableOutputIndex(index0); //@arrayout (arrays in DBVariableData only contain output parms here, so need to skip any input parms in other JDServer arrays) - int arrayCount = ((DBVariableData)serverData_).getIndicatorCountsFromHost()[outputIndex0] ; //@arrayout - ((SQLArray)sqlData_[index0]).setArrayCount( arrayCount ); //@array indicatorCountsFromHost will be array count if array type - //SQLArray.convertFromRawBytes will create array elements and iterate calling convertFromRayBytes and it knows array length from above call - sqlData_[index0].convertFromRawBytes (rawBytes_, - rowDataOffset_ + dataOffset_[index0], - ccsidConverter); //@array - //We need to set null values into the array elements here since there is not JDBC wasNull method like there is for ResultSet. - //For an array elements, a null value is just a null array element. - for(int i = 0; i < arrayCount; i++) //@array - { //@array - if((serverData_ != null) && (serverData_.getIndicator(rowIndex_, outputIndex0, i) == -1)) //@array //@arrayout - ((SQLArray)sqlData_[index0]).setElementNull(i); //@array //@nullelem - } //@array - } //@array - else - { - sqlData_[index0].convertFromRawBytes (rawBytes_, - rowDataOffset_ + dataOffset_[index0], - ccsidConverter); - } - translated_[index0] = true; - } - - } - - return sqlData_[index0]; - } - catch(ArrayIndexOutOfBoundsException e) - { - JDError.throwSQLException (JDError.EXC_DESCRIPTOR_INDEX_INVALID, e); - return null; - } - } - - //@arrayout - /** - Calculates the index by skipping any non output parms (inout parms are output) - - @param index The field index (0-based). - @return new index into an output-only parm list (-1 if non are output parms) - - @exception SQLException If an error occurs. - **/ - int getVariableOutputIndex(int index) throws SQLException - { - int newIndex = 0; - for(int x = 0; x <= index; x++) //@index - { - if(isOutput(x+1)) //isOutput is 1 based //@index - newIndex++; - } - return newIndex-1; - } - - public SQLData getSQLType (int index) - throws SQLException - { - return sqlData_[index - 1]; - } - - /** - Is there a data mapping error for the field? - - @param index The field index (1-based). - @return true or false - - @exception SQLException If an error occurs. - **/ - public boolean isDataMappingError(int index) - throws SQLException - { - try - { - int outputIndex = index; //@arrayout - if(serverData_ instanceof DBVariableData) //@arrayout - outputIndex = getVariableOutputIndex(index-1) + 1; //@arrayout (arrays in DBVariableData only contain output parms here, so need to skip any input parms in other JDServer arrays) - - if((serverData_ != null) && (serverData_.getIndicator(rowIndex_, outputIndex - 1) == -2)) //@arrayout - return true; - else - return false; - } - catch(DBDataStreamException e) - { - JDError.throwSQLException(JDError.EXC_DESCRIPTOR_INDEX_INVALID, e); - return false; - } - } - - /** - Is the field value SQL NULL? - - @param index The field index (1-based). - @return true or false - - @exception SQLException If an error occurs. - **/ - public boolean isNull(int index) - throws SQLException - { - try - { - int outputIndex = index; //@arrayout - if(serverData_ instanceof DBVariableData) //@arrayout - outputIndex = getVariableOutputIndex(index-1) + 1; //@arrayout (arrays in DBVariableData only contain output parms here, so need to skip any input parms in other JDServer arrays) - - if((serverData_ != null) && (serverData_.getIndicator(rowIndex_, outputIndex - 1) == -1)) //@arrayout - return true; - else - return false; - } - catch(DBDataStreamException e) - { - JDError.throwSQLException(JDError.EXC_DESCRIPTOR_INDEX_INVALID, e); - return false; - } - } - - - - /** - Can the field contain a SQL NULL value? - - @param index The field index (1-based). - @return true if nullable. - - @exception SQLException If an error occurs. - **/ - public int isNullable (int index) - throws SQLException - { - //@F2 Add try/catch block to this method. - try - { //@F2A - return(((sqlTypes_[index-1] & 0x0001) != 0) - ? ResultSetMetaData.columnNullable - : ResultSetMetaData.columnNoNulls); - } - catch(ArrayIndexOutOfBoundsException e) //@F2A - { - //@F2A - JDError.throwSQLException (JDError.EXC_DESCRIPTOR_INDEX_INVALID, e); //@F2A - return 0; //@F2A - } //@F2A - } - - - - /** - Return the CCSID for a field. - - @param index The field index (1-based). - @return The CCSID. - - @exception SQLException If an error occurs. - **/ - public int getCCSID (int index) - throws SQLException - { - return ccsids_[index-1]; - } - - - - /** - Return the length of a field's data within server - data. - - @param index The field index (1-based). - @return The data length. - - @exception SQLException If an error occurs. - **/ - public int getLength (int index) - throws SQLException - { - return dataLength_[index-1]; - } - - - - - /** - Return the length of the row's data. - - @return The row length. - - @exception SQLException If an error occurs. - **/ - int getRowLength () - throws SQLException - { - try - { - return serverFormat_.getRecordSize(); - } - catch(DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_DESCRIPTOR_INDEX_INVALID, e); - return -1; - } - } - - - //@CRS - performance - private synchronized void initParmTypes() - { - int count = getFieldCount(); - parameterTypes_ = new int[count]; - for (int i=0; iThe JDServerRowCache class implements a set of rows that -are generated on the system. -**/ -class JDServerRowCache -implements JDRowCache -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - // Private data. - private int blockingFactor_; - private AS400JDBCConnection connection_; - private boolean empty_; //empty_ is not cache empty but resultset returning 0 rows "empty"; thats why it is only set once - private boolean emptyChecked_; - private boolean firstBlock_; - private JDServerRow row_; - private int id_; - private boolean lastBlock_; - private DBData serverData_; - private boolean variableFieldCompressionSupported_ = false; //@K54 - private int bufferSize_; //@K54 - private JDCursor cursor_ = null; //@pda perf2 - fetch/close - private DBReplyRequestedDS fetchReply = null; //@P0A - - - // Index always points to the row within the cache. - // It is not the row number within the result set. - // - // Cached is the number of rows in the cached block. - // - // When the result set is updatable, it should pass - // in a blocking factor of 1, so that cached_ is - // always equal to 1. - // - private int cached_; - private int index_; //(array index), not row number - - // Keep track of the cursor position of the first - // row in the row cache from the front of the - // result. We need to know this to keep the system's - // cursor in sync with the client's cursor. Remember we - // don't know the number of records in the result set so - // moving the cursor based on the end of the rs makes - // us put our local variable back to NOT_KNOWN. We could - // write some messy code to keep track based on end and beginning - // of the RS, but at this time we don't have a requirement - // to do that. - private static int NOT_KNOWN = -9999; // @G1a - private int cursorPositionOfFirstRowInCache_ = NOT_KNOWN; // @G1a //0 means empty cache, 1 means cache is at the beginning (cache 1st row matches host 1st row) - - -/** -Constructs a row cache assuming that no data has been -prefetched. - -@param row The row describing the format. -@param connection The connection to the system. -@param id The id. -@param blockingFactor The blocking factor (in rows). -@param lastBlock Has the last block been fetched? -@param resultSetType The type of result set. - -@exception SQLException If an error occurs. -**/ - JDServerRowCache (JDServerRow row, - AS400JDBCConnection connection, - int id, - int blockingFactor, - boolean lastBlock, //@PDA perf - int resultSetType) - throws SQLException - { - blockingFactor_ = blockingFactor; - connection_ = connection; - lastBlock_ = lastBlock; //@PDC perf - emptyChecked_ = lastBlock_; //@PDC perf - false unless we are at lastBlock, then true - empty_ = lastBlock_; //@PDA perf - firstBlock_ = true; - id_ = id; - row_ = row; - serverData_ = null; - - cached_ = 0; - index_ = -1; - - if(connection_.getServerFunctionalLevel() >=14 && - connection_.getProperties().getBoolean(JDProperties.VARIABLE_FIELD_COMPRESSION) && - //blockingFactor_ != 1) //@K54 If blocking factor is one, than the result set is scrollable. - resultSetType == java.sql.ResultSet.TYPE_FORWARD_ONLY) - variableFieldCompressionSupported_ = true; //@K54 - - bufferSize_ = connection_.getProperties().getInt(JDProperties.BLOCK_SIZE); //@K54 - - // We are before the first row. Actually there is no data in the cache - // when this c'tor is used so it shouldn't make any difference, but - // we will set it to 0 just to be consistent. When an RS is opened - // the cursor is positioned to before the first row, which is what - // 0 means. - cursorPositionOfFirstRowInCache_ = 0; // @G1a - - row_.setRowIndex (index_); - } - - - - //@pda perf2 - /** - Constructs a row cache assuming that no data has been - prefetched. - - @param row The row describing the format. - @param connection The connection to the system. - @param id The id. - @param blockingFactor The blocking factor (in rows). - @param lastBlock Has the last block been fetched? - @param resultSetType The type of result set. - @param JDCursor Cursor associated with rows. - - @exception SQLException If an error occurs. - **/ - JDServerRowCache (JDServerRow row, - AS400JDBCConnection connection, - int id, - int blockingFactor, - boolean lastBlock, - int resultSetType, - JDCursor cursor) - throws SQLException - { - this(row, connection, id, blockingFactor, lastBlock, resultSetType); - cursor_ = cursor; - } - - - -/** -Constructs a row cache including data that has been -prefetched. - -@param row The row describing the format. -@param connection The connection to the system. -@param id The id. -@param blockingFactor Blocking factor (in rows). -@param serverData Prefetched data. -@param lastBlock Has the last block been fetched? -@param resultSetType The type of result set. - -@exception SQLException If an error occurs. -**/ - JDServerRowCache (JDServerRow row, - AS400JDBCConnection connection, - int id, - int blockingFactor, - DBData serverData, - boolean lastBlock, - int resultSetType) - throws SQLException - { - blockingFactor_ = blockingFactor; - connection_ = connection; - firstBlock_ = true; - id_ = id; - lastBlock_ = lastBlock; - row_ = row; - serverData_ = serverData; - - if(connection_.getServerFunctionalLevel() >=14 && - connection_.getProperties().getBoolean(JDProperties.VARIABLE_FIELD_COMPRESSION) && - //blockingFactor_ != 1) //@K54 If blocking factor is one, than the result set is scrollable - resultSetType == java.sql.ResultSet.TYPE_FORWARD_ONLY) - variableFieldCompressionSupported_ = true; //@K54 - - bufferSize_ = connection_.getProperties().getInt(JDProperties.BLOCK_SIZE); //@K54 - - try - { - cached_ = serverData.getRowCount (); - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - - emptyChecked_ = true; - empty_ = (cached_ == 0); - - // If we were able to pre-fetch data then the cache starts with the first - // row of data. If we were not able to pre-fetch data then the cache - // is empty. - if (cached_ > 0) // @G1a - cursorPositionOfFirstRowInCache_ = 1; // @G1a - else // @G1a - cursorPositionOfFirstRowInCache_ = 0; // @G1a - - - index_ = -1; - - row_.setRowIndex (index_); - row_.setServerData (serverData_); - } - - - //@pda perf2 - /** - Constructs a row cache including data that has been - prefetched. - - @param row The row describing the format. - @param connection The connection to the system. - @param id The id. - @param blockingFactor Blocking factor (in rows). - @param serverData Prefetched data. - @param lastBlock Has the last block been fetched? - @param resultSetType The type of result set. - @param JDCursor Cursor associated with rows. - - @exception SQLException If an error occurs. - **/ - JDServerRowCache (JDServerRow row, - AS400JDBCConnection connection, - int id, - int blockingFactor, - DBData serverData, - boolean lastBlock, - int resultSetType, - JDCursor cursor) - throws SQLException - { - this(row, connection, id, blockingFactor, serverData, lastBlock, resultSetType); - cursor_ = cursor; - } - - -/** -Fetches a block of data from the system. - -@param fetchScrollOption The fetch scroll option. -@return true if the first or last block (in - the appropriate direction) was fetched, - false otherwise. - -@exception SQLException If an error occurs. -**/ - private boolean fetch (int fetchScrollOption) - throws SQLException - { - return fetch (fetchScrollOption, 0); - } - - - -/** -Fetches a block of data from the system. - -@param fetchScrollOption The fetch scroll option. -@param rows The number of rows when - fetchScrollOption is - DBSQLRequestDS.FETCH_RELATIVE. -@return true if the first or last block (in - the appropriate direction) was fetched, - false otherwise. - -@exception SQLException If an error occurs. -**/ - private boolean fetch (int fetchScrollOption, int rows) - throws SQLException - { - boolean endBlock = false; - - try - { - DBSQLRequestDS request = null; //@P0A - try - { - request = DBDSPool.getDBSQLRequestDS ( //@P0C - DBSQLRequestDS.FUNCTIONID_FETCH, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - request.setFetchScrollOption (fetchScrollOption, rows); - - // If fetching next, then fetch a block. Otherwise, - // just fetch a single row. The check was altered under @G1 - // to fetch a block of rows only when we know the cursor - // location. If we don't know the cursor location when we - // get only one row just in case the next request is to - // go backward or relative to the current location. This - // will be slower but it is the only way to assure accurate - // information is returned to the app. - if ((fetchScrollOption == DBSQLRequestDS.FETCH_NEXT) && - (blockingFactor_ > 0) && - (cursorPositionOfFirstRowInCache_ >= 0)) // @G1a - { - if(variableFieldCompressionSupported_) //@K54 - { - //Do not need to set the blocking factor if using variable-length field compression - //If both the buffer size and blocking factor were set, the buffer size will override - //the blocking factor and the number of rows that will fit in the buffer size will be returned - //regardless of the blocking factor value //@K54 - request.setVariableFieldCompression(true); //@K54 - request.setBufferSize(bufferSize_ * 1024); //@K54 - } //@K54 - else //@K54 - request.setBlockingFactor (blockingFactor_); - } - else - { - request.setBlockingFactor (1); - } - - if (JDTrace.isTraceOn ()) - JDTrace.logInformation (connection_, "Fetching a block of data from the system"); - - if (fetchReply != null) { fetchReply.returnToPool(); fetchReply = null; } - fetchReply = connection_.sendAndReceive (request, id_); //@P0C - - int errorClass = fetchReply.getErrorClass(); - int returnCode = fetchReply.getReturnCode(); - - if (((errorClass == 1) && (returnCode == 100)) - || ((errorClass == 2) && (returnCode == 701))) - endBlock = true; - else if((errorClass == 2) && (returnCode == 700)) //@pda perf2 - fetch/close - { - endBlock = true; - if(cursor_ != null) - cursor_.setState(true); //closed cursor already on system - - } - // As in AS400JDBCStatement, post a warning if the system gives us a warning, - // otherwise throw an exception - else if (errorClass != 0) - { // @D1a - // JDError.throwSQLException (connection_, id_, errorClass, returnCode); // @D1d - if (returnCode < 0) // @D1a - JDError.throwSQLException (connection_, id_, errorClass, returnCode); // @D1a - else // @D1a - connection_.postWarning (JDError.getSQLWarning (connection_, id_, errorClass, returnCode)); // @D1a - } // @D1a - - // Extract data from the row. - serverData_ = fetchReply.getResultData (); - - if (serverData_ == null) - { - endBlock = true; //@rel4 last block was not returned if null???? //@rel9backtotrue and deal with it after called - cached_ = 0; - } - else - { - row_.setServerData (serverData_); - cached_ = serverData_.getRowCount (); - } - - if (emptyChecked_ == false) //empty_ is refering to empty resultset, not empty cache_ - { - emptyChecked_ = true; - empty_ = (cached_ == 0); - } - } - finally - { - if (request != null) { request.returnToPool(); request =null; } - // if (fetchReply != null) { fetchReply.returnToPool(); fetchReply = null; } - } - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - - return endBlock; - } - - - -/** -Sets the fetch size. - -@param fetchSize The fetch size. - -@exception SQLException If an error occurs. -**/ - public void setFetchSize (int fetchSize) - throws SQLException - { - // The fetch size is only used if the "block size" property - // is set to "0". - if (connection_.getProperties ().getInt (JDProperties.BLOCK_SIZE) == 0) - blockingFactor_ = fetchSize; - } - - - -//-------------------------------------------------------------// -// // -// INTERFACE IMPLEMENTATIONS // -// // -//-------------------------------------------------------------// - - - - public void open () - throws SQLException - { - // No-op. It is assumed here that the cursor is - // already open. - } - - - - public void close () - throws SQLException - { - // No-op. It is assumed that the cursor will be closed - // elsewhere. - - // Make sure reply is returned to pool - if (fetchReply != null) { - fetchReply.returnToPool(); fetchReply = null; - } - } - - - - public void flush () - throws SQLException - { - cached_ = 0; - emptyChecked_ = false; - } - - - - public void refreshRow () - throws SQLException - { - fetch (DBSQLRequestDS.FETCH_CURRENT); - index_ = 0; - row_.setRowIndex (index_); - } - - - - public JDRow getRow () - { - return row_; - } - - - /** - isEmpty is not cache empty but resultset returning 0 rows "empty"; thats why it is only set once - */ - public boolean isEmpty () - throws SQLException - { - // If empty has not been checked yet, then no data has - // been fetched. Force the first fetch. - // The change for @G1 makes the code block work (I don't - // think it worked before). For emptyChecked_ to be false - // prefetch must be off. If block size is 0 the beforeFirst() - // call will return 0 rows. The empty flag is set based on how - // many rows are returned so since no rows were returned empty_ - // was set to true. The change it to call first to get a row, - // then set the empty_ flag there, if rows are found. - if (emptyChecked_ == false) - { - firstBlock_ = false; - first(true); // @G1a - beforeFirst (); - } - - return empty_; - } - - - - public boolean isValid () - { - return((serverData_ != null) - && (index_ >= 0) - && (index_ < cached_)); - } - - - - - //@abs2 re-design method - /* absolute may or maynot go to server */ - public void absolute (int rowNumber) - throws SQLException - { - // If the row is in the cache, then move the index - // withing the cache. - - // int newIndex = index_; - - //int serverRowIndexFromBeg = cursorPositionOfFirstRowInCache_ + index_; //1 is on first row - //int numberOfServerRows = cursorPositionOfFirstRowInCache_ + cached_ - 1;//!!when lastBlock_==true - - if ( (rowNumber >= cursorPositionOfFirstRowInCache_) && (rowNumber < cursorPositionOfFirstRowInCache_+ cached_ )&& (rowNumber >= 0) && (cursorPositionOfFirstRowInCache_ != NOT_KNOWN)) - { - //rowNumber is positive and row is in cache_ - index_ = rowNumber - cursorPositionOfFirstRowInCache_; - } - else if((rowNumber<0) && lastBlock_ && (cached_ >= -rowNumber) && (cursorPositionOfFirstRowInCache_ != NOT_KNOWN)) - { - //rowNumber is negative and row is in cache_ - //if lastBlock_ then we know we can just count backwards to the offset in cache_ - //(ie if rowNumber is in cache and last row in cache_ is last row on server) - index_ = cached_ + rowNumber; - } - // Otherwise, fetch data from the system. If the - // last block is flagged, then this means the - // request was not valid. - else - { - // Since we could not find the row in the cache we have to find - // it on the system. - - absolute(rowNumber, true); - return; - } - - row_.setRowIndex (index_); - } - - - //@abs2 - void absolute (int rowNumber, boolean mustAccessServer) - throws SQLException - { - - if(mustAccessServer == false) - { - absolute(rowNumber); - return; - } - - //int newIndex = rowNumber; - boolean endBlock = false; - if(rowNumber > 0) - { - if(cursor_.isClosed() )//&& !firstBlock_) - { //@max1 - return; //@max1 //can't go and refetch since cursor is closed. - } //@max1 - else - { - if(cursor_.getCursorAttributeSensitive() == 0 && cursor_.getCursorAttributeUpdatable() == 0) //@abs3 fix: only use fetch-direct with insensitive read-only cursors - { - endBlock = fetch (DBSQLRequestDS.FETCH_DIRECT, rowNumber); - } - else //@abs3 - { //@abs3 - first (true); //@abs3 - relative (rowNumber - 1); //@abs3 - } //@abs3 - } - } - else if(rowNumber == 0) - { - //fetch(direct,0) followed by fetch(relative,-x) does not work - beforeFirst(true); - } - else - { - //hostserver fetch(direct) does not support negative directions - //have to do last() and then reletive(-x) - last (true); - relative (rowNumber + 1); - } - firstBlock_ = false; - - if (endBlock == false) - { - index_ = 0; - // @E1D firstBlock_ = false; - lastBlock_ = endBlock; - } - - cursorPositionOfFirstRowInCache_ = rowNumber; - - row_.setRowIndex (index_); - } - - - - - public void afterLast () - throws SQLException - { - // If the last block is cached, then - // move the index within the cache. - if (lastBlock_) - index_ = cached_; - - // Otherwise, change the cursor on the system. - else - { - fetch (DBSQLRequestDS.FETCH_AFTER_LAST); - firstBlock_ = false; - lastBlock_ = true; - index_ = 0; - - // We just fetched based on the end of the result set so we no longer - // know the row number of the first row in the cache - cursorPositionOfFirstRowInCache_ = NOT_KNOWN; // @G1a - } - - row_.setRowIndex (index_); - } - - public void beforeFirst (boolean mustAccessServer) - throws SQLException - { - if(mustAccessServer == false) - { - beforeFirst(); - return; - } - else - { - fetch (DBSQLRequestDS.FETCH_BEFORE_FIRST); - firstBlock_ = true; - lastBlock_ = false; - index_ = -1; - - // BeforeFirst will not return any rows. Set the - // variable to 0 to indicate we are before the first row. - cursorPositionOfFirstRowInCache_ = 0; - - row_.setRowIndex (index_); - } - } - - public void beforeFirst () - throws SQLException - { - // If first block is cached, then move the index - // within the cache. - if (firstBlock_) - index_ = -1; - - // Otherwise, change the cursor on the system. - else - { - fetch (DBSQLRequestDS.FETCH_BEFORE_FIRST); - firstBlock_ = true; - lastBlock_ = false; - index_ = -1; - - // BeforeFirst will not return any rows. Set the - // variable to 0 to indicate we are before the first row. - cursorPositionOfFirstRowInCache_ = 0; // @G1a - } - - row_.setRowIndex (index_); - } - - - // @G1c - // The logic of this routine was moved to first(boolean). Call the new - // routine saying there is no need to go to the system if the data - // is in the local cache. - public void first () - throws SQLException - { - first(false); - } - - - // @G1 new method - void first (boolean mustAccessServer) - throws SQLException - { - // If first block is cached, then move the index - // within the cache (if we are not forced to go to the system). - // @G1 change -- do this only if we attempted to go to the system - // at least once. If we just opened the rs, go to the - // system to see if there are rows in the rs. - boolean done = false; //@rel4 - if ((emptyChecked_) && // @G1c - (! mustAccessServer) && - (firstBlock_)) - { //@rel4 - index_ = 0; - done = true; //@rel4 - } //@rel4 - - // Otherwise, change the cursor on the system. - //else //@rel4 - if(!done || !isValid()) //@rel4 go to system also if not valid - { - fetch (DBSQLRequestDS.FETCH_FIRST); - firstBlock_ = true; - lastBlock_ = false; - index_ = 0; - - // We just fetched based on the beginning of the result set so we - // know the first row in the rs is row 1. - cursorPositionOfFirstRowInCache_ = 1; // @G1a - } - - row_.setRowIndex (index_); - } - - - - // @G1 - // The logic in this method was moved to last(boolean). Call that - // method saying use data in the cache if the cache has the row - // we need. - public void last () - throws SQLException - { - last(false); - } - - - // @G1 new method - void last (boolean mustGoToServer) - throws SQLException - { - // If the last block is cached and contains data, then - // move the index within the cache (if we are not forced to - // go to the system). - if ((lastBlock_) && - (cached_ > 0) && - (!mustGoToServer)) - index_ = cached_ - 1; - - // Otherwise, change the cursor on the system. - else - { - fetch (DBSQLRequestDS.FETCH_LAST); - firstBlock_ = false; - lastBlock_ = true; - index_ = 0; - - // We just fetched based on the end of the result set so we no longer - // know the row number of the first row in the cache - cursorPositionOfFirstRowInCache_ = NOT_KNOWN; // @G1a - } - - row_.setRowIndex (index_); - } - - - - - public void next () - throws SQLException - { - // If the next row is cached, then move the index - // within the cache. - if (index_ < (cached_ - 1)) - ++index_; - - // If the last block has been fetched, - // then there are no more. - else if (lastBlock_) - index_ = cached_; - - // Otherwise, fetch data from the system. - else - { - boolean wasBeforeFirst = (index_== -1) ? true : false; //@rel4 - int oldCached = cached_; // @G1a - lastBlock_ = fetch (DBSQLRequestDS.FETCH_NEXT); - firstBlock_ = false; - index_ = 0; - - // We get a block of records only when we know the cursor position - // of the first row in the cache. When we know the position, update our - // variable by the number of rows in the cache. (This works - // even when we are getting one row at a time because oldCached will be 1). - - if (cursorPositionOfFirstRowInCache_ > 0) // @G1a - cursorPositionOfFirstRowInCache_ = // @G1a - cursorPositionOfFirstRowInCache_ + oldCached; // @G1a - else if(wasBeforeFirst) // @G1a //@rel4 (only set to 1 if wasBeforeFirst) - cursorPositionOfFirstRowInCache_ = 1; // @G1a - else //@rel4 - cursorPositionOfFirstRowInCache_ = NOT_KNOWN;//@rel4 - } - - row_.setRowIndex (index_); - } - - - - public void previous () - throws SQLException - { - // If the previous row is cached, then move the index - // within the cache. - if (index_ >= 1 && cached_ > 0) //@rel4 - --index_; - - // If the first block has not been fetched, - // then fetch data from the system. - else if (! firstBlock_) - { - // We did not find the record in the cache so we must be - // on the first record in the cache trying to back up one. - // First move the system's cursor so it is in the correct - // place, then back up one. Having a block of records in - // the cache but not knowing where they came from is a - // "should not occur" error so throw an internal exception. - if (cached_ > 1) // @G1a - { - // @G1a - if (cursorPositionOfFirstRowInCache_ > 0) // @G1a - absolute(cursorPositionOfFirstRowInCache_, true); // @G1a //@abs2 - else // @G1a - JDError.throwSQLException (JDError.EXC_INTERNAL); // @G1a - } // @G1a - - firstBlock_ = fetch (DBSQLRequestDS.FETCH_PREVIOUS); - lastBlock_ = false; - index_ = cached_ - 1; - - if (firstBlock_) // @G1a - cursorPositionOfFirstRowInCache_ = 1; // @G1a - else // @G1a - cursorPositionOfFirstRowInCache_ --; // @G1a - } - - // Else we have moved before the first row. - else - index_ = -1; - - if(index_ == -1 && cached_ == 0) //@rel4 cache is empty - cursorPositionOfFirstRowInCache_ = 0; //@rel4 - - row_.setRowIndex (index_); - } - - - - public void relative (int rowNumber) - throws SQLException - { - //boolean wasBeforeFirst = (index_==-1) ? true : false;//@rel4 - //boolean wasAfterLast = (wasBeforeFirst == false && lastBlock_ == true && index_ == cached_) ? true : false;//@rel4 - // If row number is 0, then don't change the cursor. - if (rowNumber != 0) - { - - // If the row is in the cache, then move the index - // withing the cache. - int newIndex = index_ + rowNumber; - if ((newIndex >= 0) && (newIndex < cached_)) //@rel2 allow for before first row //@rel4 -1->0 - index_ = newIndex; - else if ((newIndex >= 0) && (newIndex == cached_) && (cursor_.isClosed())) //@max1 - index_ = newIndex; //@max1 - - // Otherwise, fetch data from the system. If the - // last block is flagged, then this means the - // request was not valid. - else - { - // Since we could not find the row in the cache we have to find - // it on the system. First call the system to resync the - // cursor position with what we think it is on the client - // (the local cursor will move if we have a cache hit), then - // the call the system to get data. Note if we have a block - // of records in the cache but do not know where they came - // from, flag an error. That should not happen. We have to - // move the system cursor only if we cached a block of records. - // If only one record is in the cache then the two cursors - // are already in sync. - //Note: relative and absolute call each other, but will not endless-loop since first() always fetches only one row and so cached_=1! - if (cached_ > 1) // @G1a - { - // @G1a - if (cursorPositionOfFirstRowInCache_ > 0) // @G1a - absolute(cursorPositionOfFirstRowInCache_ + index_, true); // @G1a //@abs2 - else // @G1a - JDError.throwSQLException (JDError.EXC_INTERNAL); // @G1a - } // @G1a - - if(index_ == -1 && cached_ > 0) //@rel2 (if index_ is positioned before any rows, subtract 1 from rowNumber to account that index_ is not on a current row) //@rel4 already set to -1 and added - rowNumber--; //@rel2 - else if(index_ == cached_) //@rel3 (if index_ is past the cache_ content, add 1 to rowNumber to account that index_ is not on a current row) //@rel4 - rowNumber += index_; //@rel3 //@rel4 even if after last, cursor on host may not know it and may be off by count in cache_ - boolean endBlock = fetch (DBSQLRequestDS.FETCH_RELATIVE, rowNumber); //@abs2 comment: why not combine absolutesynchwithserver and fetch using something like fetch(-cache_ + index_ + rowNumber) - firstBlock_ = false; // @E1A - - if (endBlock == false) - { - index_ = 0; - // @E1D firstBlock_ = false; - lastBlock_ = endBlock; - }else //@rel4 - { //@rel4 - if(rowNumber < 0)//@rel4 - { //@rel4 - index_ = -1; //empty //@rel4 - cursorPositionOfFirstRowInCache_ = 0; //not aligned - } //@rel4 - else //@rel4 - cursorPositionOfFirstRowInCache_ = NOT_KNOWN; //@rel4 - } - - //if ((rowNumber > 0) && (cursorPositionOfFirstRowInCache_ > 0)) // @G1a - if(cursorPositionOfFirstRowInCache_ >=0) //@rel4 if beforefirst also - - cursorPositionOfFirstRowInCache_ = // @G1a - cursorPositionOfFirstRowInCache_ + rowNumber; // @G1a - else // @G1a - cursorPositionOfFirstRowInCache_ = NOT_KNOWN; // @G1a - } - } - - row_.setRowIndex (index_); - } - - protected void finalize() throws Throwable { - super.finalize(); - if (fetchReply != null) { fetchReply.returnToPool(); fetchReply=null; } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JDSimpleDelimitedFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDSimpleDelimitedFieldMap.java deleted file mode 100644 index d9b930396..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDSimpleDelimitedFieldMap.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -//JTOpen (IBM Toolbox for Java - OSS version) -// -//Filename: JDSimpleDelimitedFieldMap.java -// -//The source code contained herein is licensed under the IBM Public License -//Version 1.0, which has been approved by the Open Source Initiative. -//Copyright (C) 1997-2001 International Business Machines Corporation and -//others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - -/** - *

    - * A class that defines how the client sees the data for a mapped field, i.e., a - * field that simply gets copied from an actual field in the row data, as is with - * start and end delimiters trimmed. This is needed because the db returns - * schema, pk, and fk names with delimiter chars. - * Note that this FieldMap is designed only for strings. - * Note that the field index may be different than the field that this is - * representing. - * - *

    - * For example, a field comes as the 3rd column, but we need to map it to the - * 5th column. - */ -class JDSimpleDelimitedFieldMap implements JDFieldMap { - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private int fromIndex_; - - JDSimpleDelimitedFieldMap(int fromIndex) { - fromIndex_ = fromIndex; - } - - public Object getValue(JDRow row) throws SQLException { - SQLChar charData = (SQLChar)row.getSQLData(fromIndex_); - String value = charData.getString().trim(); - value = JDUtilities.stripOutDoubleEmbededQuotes(value); - return value; - } - - /** - * Indicates if the value was a data mapping error. - */ - public boolean isDataMappingError(JDRow row) throws SQLException { - return row.isDataMappingError(fromIndex_); - } - - public boolean isNull(JDRow row) throws SQLException { - return row.isNull(fromIndex_); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JDSimpleFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDSimpleFieldMap.java deleted file mode 100644 index 1ac7a510a..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDSimpleFieldMap.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDSimpleFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - - - -/** -

    A class that defines how the client sees the data for a -mapped field, i.e., a field that simply gets copied from -an actual field in the row data, as is. Note that the -field index may be different than the field that this is -representing. - -

    For example, a field comes as the 3rd column, but we -need to map it to the 5th column. -**/ -class JDSimpleFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - private int fromIndex_; - - JDSimpleFieldMap (int fromIndex) - { - fromIndex_ = fromIndex; - } - - public Object getValue (JDRow row) - throws SQLException - { - return row.getSQLData (fromIndex_).getObject (); - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return row.isDataMappingError(fromIndex_); - } - - public boolean isNull (JDRow row) - throws SQLException - { - return row.isNull (fromIndex_); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JDSimpleRow.java b/cvsroot/src/com/ibm/as400/access/JDSimpleRow.java deleted file mode 100644 index c5c0a6840..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDSimpleRow.java +++ /dev/null @@ -1,311 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDSimpleRow.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; -import java.util.Calendar; - - - -/** -

    The JDSimpleRow class implements a row of data generated -on the client. -**/ -class JDSimpleRow -implements JDRow -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - // Private data. - private String[] fieldNames_; - private int[] fieldNullables_; - private SQLData[] sqlData_; - private boolean[] sqlNulls_; - private boolean[] sqlDataMappingErrors_; - - - - /** - Constructs a JDSimpleRow object. - - @param fieldNames Field names. - @param sqlData Initial contents of SQL data. This is - needed immediately just to describe the - format. - @param fieldNullables Field nullables (either DatabaseMetaData. - columnNoNulls, columnNullable or - columnNullableUnknown). - **/ - JDSimpleRow (String[] fieldNames, - SQLData[] sqlData, - int[] fieldNullables) - { - fieldNames_ = fieldNames; - fieldNullables_ = fieldNullables; - sqlData_ = sqlData; - sqlNulls_ = new boolean[sqlData_.length]; - sqlDataMappingErrors_ = new boolean[sqlData_.length]; - } - - - - /** - Constructs a JDSimpleRow object. The format is determined - based on another JDRow object. - - @param other The other row. - @param clone true if a full clone should be made, or - false if just references. - **/ - JDSimpleRow (JDRow otherRow, boolean clone) - throws SQLException - { - int fieldCount = otherRow.getFieldCount (); - - fieldNames_ = new String[fieldCount]; - fieldNullables_ = new int[fieldCount]; - sqlData_ = new SQLData[fieldCount]; - sqlNulls_ = new boolean[fieldCount]; - sqlDataMappingErrors_ = new boolean[fieldCount]; - - for(int i = 0; i < fieldCount; ++i) - { - fieldNames_[i] = otherRow.getFieldName (i+1); - fieldNullables_[i] = otherRow.isNullable (i+1); - - if(clone) - { // @E1C - sqlData_[i] = (SQLData) otherRow.getSQLData (i+1).clone (); - sqlNulls_[i] = false; // @E1A - sqlDataMappingErrors_[i] = false; - } // @E1A - else - { // @E1C - sqlData_[i] = otherRow.getSQLData (i+1); - sqlNulls_[i] = otherRow.isNull (i+1); // @E1C - sqlDataMappingErrors_[i] = otherRow.isDataMappingError(i+1); - } // @E1A - } - } - - - - /** - Sets the data. - - @param data The data. - **/ - void setData (Object[] data) - throws SQLException - { - Calendar calendar = Calendar.getInstance (); - for(int i = 0; i < sqlData_.length; ++i) - sqlData_[i].set (data[i], calendar, -1); - } - - /** - Sets the SQL data mapping errors. - - @param dataMappingErrors The data mapping errors. - **/ - void setDataMappingErrors(boolean[] dataMappingErrors) - { - sqlDataMappingErrors_ = dataMappingErrors; - } - - /** - Sets the nulls. - - @param nulls The nulls. - **/ - void setNulls (boolean[] nulls) - { - sqlNulls_ = nulls; - } - - - - //-------------------------------------------------------------// - // // - // INTERFACE IMPLEMENTATIONS // - // // - //-------------------------------------------------------------// - - - - public int findField(String name) throws SQLException { - if (name.startsWith("\"") && name.endsWith("\"")) - { - name = JDUtilities.stripOuterDoubleQuotes(name); - for (int i = 1; i <= sqlData_.length; ++i) - if (name.equals(getFieldName(i))) - return i; - } else - { - name = name.toUpperCase(); //@PDA - //X.equalsIgnoreCase(Y) converts both X and Y to uppercase. - //column names that are non-delim are returned uppercase, - //so just one call to name.UpperCase() is sufficient for - // comparisons. - for (int i = 0; i < fieldNames_.length; ++i) - if (name.equals(fieldNames_[i])) //@PDC - return i + 1; - } - JDError.throwSQLException(JDError.EXC_COLUMN_NOT_FOUND); - return -1; - } - - - - public int getFieldCount () - { - return fieldNames_.length; - } - - - - public String getFieldName (int index) - throws SQLException - { - try - { - return fieldNames_[index-1]; - } - catch(ArrayIndexOutOfBoundsException e) - { - JDError.throwSQLException (JDError.EXC_DESCRIPTOR_INDEX_INVALID, e); - return null; - } - } - - - - /* @C1D - public int getFieldPrecision (int index) - throws SQLException - { - try { - return sqlData_[index-1].getPrecision (); - } - catch (ArrayIndexOutOfBoundsException e) { - JDError.throwSQLException (JDError.EXC_DESCRIPTOR_INDEX_INVALID, e); - return -1; - } - } - - - - public int getFieldScale (int index) - throws SQLException - { - try { - return sqlData_[index-1].getMaximumScale (); - } - catch (ArrayIndexOutOfBoundsException e) { - JDError.throwSQLException (JDError.EXC_DESCRIPTOR_INDEX_INVALID, e); - return -1; - } - } - */ - - - - public SQLData getSQLData (int index) - throws SQLException - { - try - { - return sqlData_[index-1]; - } - catch(ArrayIndexOutOfBoundsException e) - { - JDError.throwSQLException (JDError.EXC_DESCRIPTOR_INDEX_INVALID, e); - return null; - } - } - - - - public SQLData getSQLType (int index) - throws SQLException - { - try - { - return sqlData_[index-1]; - } - catch(ArrayIndexOutOfBoundsException e) - { - JDError.throwSQLException (JDError.EXC_DESCRIPTOR_INDEX_INVALID, e); - return null; - } - } - - /** - Is there a data mapping error for the field? - - @param index The field index (1-based). - @return true or false - - @exception SQLException If an error occurs. - **/ - public boolean isDataMappingError(int index) - throws SQLException - { - try - { - return sqlDataMappingErrors_[index-1]; - } - catch(ArrayIndexOutOfBoundsException e) - { - JDError.throwSQLException(JDError.EXC_DESCRIPTOR_INDEX_INVALID, e); - return false; - } - } - - public boolean isNull (int index) - throws SQLException - { - try - { - return sqlNulls_[index-1]; - } - catch(ArrayIndexOutOfBoundsException e) - { - JDError.throwSQLException (JDError.EXC_DESCRIPTOR_INDEX_INVALID, e); - return false; - } - } - - - - public int isNullable (int index) - throws SQLException - { - try - { - return fieldNullables_[index-1]; - } - catch(ArrayIndexOutOfBoundsException e) - { - JDError.throwSQLException (JDError.EXC_DESCRIPTOR_INDEX_INVALID, e); - return -1; - } - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDSimpleRowCache.java b/cvsroot/src/com/ibm/as400/access/JDSimpleRowCache.java deleted file mode 100644 index ed3a7b301..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDSimpleRowCache.java +++ /dev/null @@ -1,329 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDSimpleRowCache.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; -import java.util.Vector; - -/** -The JDSimpleRowCache class implements a set of rows that -is contained completely on the client, without regard to -where they were generated. -**/ -class JDSimpleRowCache -implements JDRowCache -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - // Private data. - private int index_; - private JDSimpleRow row_; - private Object[][] data_; - private boolean[][] nulls_; - private boolean[][] dataMappingErrors_; - private boolean valid_; - - /** - Constructs a JDSimpleRowCache object. This is intended for - empty results, i.e., a cache with no data. - - @param formatRow The row describing the format. - **/ - JDSimpleRowCache(JDSimpleRow formatRow) - { - index_ = -1; - valid_ = false; - row_ = formatRow; - - int fieldCount = row_.getFieldCount(); - - data_ = new Object[0][fieldCount]; - nulls_ = new boolean[0][fieldCount]; - dataMappingErrors_ = new boolean[0][fieldCount]; - } - - /** - Constructs a JDSimpleRowCache object. This is intended for - SQL data generated entirely on the client. - - @param formatRow The row describing the format. - @param data The data generated on the client. - @param nulls The nulls corresponding to the data. - @param dataMappingErrors The data mapping errors corresponding to the data. - **/ - JDSimpleRowCache(JDSimpleRow formatRow, - Object[][] data, - boolean[][] nulls, - boolean[][] dataMappingErrors) - { - index_ = -1; - valid_ = false; - row_ = formatRow; - - data_ = data; - nulls_ = nulls; - dataMappingErrors_ = dataMappingErrors; - } - - /** - Constructs a JDSimpleRowCache object. This is intended for - SQL data generated entirely on the client. - - @param formatRow The row describing the format. - @param data The data generated on the client. - **/ - JDSimpleRowCache(JDSimpleRow formatRow, Object[][] data) - { - index_ = -1; - valid_ = false; - row_ = formatRow; - - data_ = data; - nulls_ = new boolean[data.length][data[0].length]; - dataMappingErrors_ = new boolean[data.length][data[0].length]; - } - - /** - Constructs a JDSimpleRowCache object. This is intended for - data to be fully cached based on another row cache (most likely - one from the system). - - @param otherRowCache The other row cache. - - @exception SQLException If an error occurs. - **/ - JDSimpleRowCache(JDRowCache otherRowCache) - throws SQLException - { - Vector tempData = new Vector(); - Vector tempNulls = new Vector(); - Vector tempDataMappingErrors = new Vector(); - - JDRow otherRow = otherRowCache.getRow(); - int fieldCount = otherRow.getFieldCount(); - int rowCount = 0; - - row_ = new JDSimpleRow(otherRow, false); - - otherRowCache.open(); - otherRowCache.next(); - while(otherRowCache.isValid()) - { - Object[] rowOfData = new Object[fieldCount]; - boolean[] rowOfNulls = new boolean[fieldCount]; - boolean[] rowOfDataMappingErrors = new boolean[fieldCount]; - - for(int i = 1; i <= fieldCount; ++i) - { - rowOfData[i-1] = otherRow.getSQLData(i).getObject(); - rowOfNulls[i-1] = otherRow.isNull(i); - rowOfDataMappingErrors[i-1] = otherRow.isDataMappingError(i); - } - - tempData.addElement(rowOfData); - tempNulls.addElement(rowOfNulls); - tempDataMappingErrors.addElement(rowOfDataMappingErrors); - - ++rowCount; - otherRowCache.next(); - } - - index_ = -1; - data_ = new Object[rowCount][fieldCount]; - nulls_ = new boolean[rowCount][fieldCount]; - dataMappingErrors_ = new boolean[rowCount][fieldCount]; - valid_ = false; - - for(int i = 0; i < rowCount; ++i) - { - data_[i] = (Object[])tempData.elementAt(i); - nulls_[i] = (boolean[])tempNulls.elementAt(i); - dataMappingErrors_[i] = (boolean[])tempDataMappingErrors.elementAt(i); - } - } - - /** - Repositions the cursor so that the row reflects the appropriate - data. - - @param valid Indicates if the current position is valid. - **/ - private void reposition(boolean valid) - throws SQLException - { - valid_ = valid; - if(valid_) - { - row_.setData(data_[index_]); - row_.setNulls(nulls_[index_]); - row_.setDataMappingErrors(dataMappingErrors_[index_]); - } - } - - //-------------------------------------------------------------// - // // - // INTERFACE IMPLEMENTATIONS // - // // - //-------------------------------------------------------------// - - public void open() - throws SQLException - { - // No-op. - } - - public void close() - throws SQLException - { - // No-op. - } - - public void flush() - throws SQLException - { - // No-op. - } - - public JDRow getRow() - { - return row_; - } - - public boolean isEmpty() - throws SQLException - { - return data_.length == 0; - } - - public boolean isValid() - { - return valid_; - } - - public void absolute(int rowNumber) - throws SQLException - { - if(rowNumber > 0) - { - if(rowNumber <= data_.length) - { - index_ = rowNumber - 1; - reposition(true); - } - else - { - index_ = data_.length; - reposition(false); - } - } - else if(rowNumber < 0) - { - if(-rowNumber <= data_.length) - { - index_ = data_.length + rowNumber; - reposition(true); - } - else - { - index_ = -1; - reposition(false); - } - } - /* @C1D - AS400JDBCResultSet will check for this - case (rowNumber == 0), and throw an exception. - Therefore, this code never gets called. - else { - index_ = 0; - reposition (false); - } - */ - } - - public void afterLast() - throws SQLException - { - index_ = data_.length; - reposition(false); - } - - public void beforeFirst() - throws SQLException - { - index_ = -1; - reposition(false); - } - - public void first() - throws SQLException - { - index_ = 0; - reposition(data_.length > 0); - } - - public void last() - throws SQLException - { - index_ = data_.length - 1; - reposition(data_.length > 0); - } - - public void next() - throws SQLException - { - if(index_ < data_.length - 1) - { - ++index_; - reposition(true); - } - else - { - index_ = data_.length; - reposition(false); - } - } - - public void previous() - throws SQLException - { - if(index_ > 0) - { - --index_; - reposition(true); - } - else - { - index_ = -1; - reposition(false); - } - } - - public void refreshRow() - throws SQLException - { - reposition(valid_); - } - - public void relative(int rowIndex) - throws SQLException - { - int newIndex = index_ + rowIndex; - if((newIndex >= 0) && (newIndex < data_.length)) - { - index_ = newIndex; - reposition(true); - } - else - reposition(false); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JDSortSequence.java b/cvsroot/src/com/ibm/as400/access/JDSortSequence.java deleted file mode 100644 index 0489d43c6..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDSortSequence.java +++ /dev/null @@ -1,131 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDSortSequence.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.StringTokenizer; - - - -/** -

    A National Language Support sort sequence. -**/ -class JDSortSequence -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - private static final int TYPE_HEX_ = 0; - private static final int TYPE_LANGUAGE_ID_SHARED_ = 1; - private static final int TYPE_LANGUAGE_ID_UNIQUE_ = 2; - private static final int TYPE_USER_SPECIFIED_ = 3; - - private String languageId_; - private String tableFile_; - private String tableLibrary_; - private int type_; - - - /** - Constructor. - @param sort The caller specified sort value. - @param language The caller specified sort language. - @param table The caller specified sort table. - @param weight The caller specified sort weight. - **/ - JDSortSequence(String sort, String language, String table, String weight) - { - // Initialize. - languageId_ = " "; - tableFile_ = ""; - tableLibrary_ = ""; - type_ = TYPE_HEX_; - - // Handle sort == "language". - if (sort.equalsIgnoreCase(JDProperties.SORT_LANGUAGE1)) - { - if (weight.equalsIgnoreCase(JDProperties.SORT_WEIGHT_UNIQUE)) - type_ = TYPE_LANGUAGE_ID_UNIQUE_; - else - type_ = TYPE_LANGUAGE_ID_SHARED_; - - if (language.length() >= 3) - languageId_ = language.substring(0, 3).toUpperCase(); - else - languageId_ = language.toUpperCase(); - } - - // Handle sort == "table". - else if (sort.equalsIgnoreCase(JDProperties.SORT_TABLE1)) - { - type_ = TYPE_USER_SPECIFIED_; - - StringTokenizer tokenizer = new StringTokenizer(table, "./"); - if (tokenizer.countTokens() == 2) - { - tableLibrary_ = tokenizer.nextToken().toUpperCase(); //@A1C - tableFile_ = tokenizer.nextToken().toUpperCase(); //@A1C - } - else - { - tableFile_ = table.toUpperCase(); //@A1C - } - } - } - - - /** - Return the language id. - @return The language id. - **/ - String getLanguageId() - { - return languageId_; - } - - - - /** - Return the table file. - @return The table file. - **/ - String getTableFile() - { - return tableFile_; - } - - - - /** - Return the table library. - @return The table library. - **/ - String getTableLibrary() - { - return tableLibrary_; - } - - - - /** - Return the type of sort sequence. - @return The type. - **/ - int getType() - { - return type_; - } -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/JDStatementProxy.java b/cvsroot/src/com/ibm/as400/access/JDStatementProxy.java deleted file mode 100644 index f4d2adf95..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDStatementProxy.java +++ /dev/null @@ -1,566 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDStatementProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.SQLWarning; - - -class JDStatementProxy -extends AbstractProxyImpl -implements java.sql.Statement -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Protected data. - protected JDConnectionProxy jdConnection_; - // The object that caused this object to be created. - - protected JDResultSetProxy cachedResultSet_; - - // Copied from JDError: - private static final String EXC_FUNCTION_NOT_SUPPORTED = "IM001"; - - - - - public JDStatementProxy (JDConnectionProxy jdConnection) - { - jdConnection_ = jdConnection; - } - - -// JDBC 2.0 - public void addBatch (String sql) - throws SQLException - { - callMethod ("addBatch", - new Class[] { String.class }, - new Object[] { sql }); - } - - - // Call a method. No return value is expected. - protected void callMethod (String methodName) - throws SQLException - { - try { - connection_.callMethod (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - protected void callMethod (String methodName, - Class[] argClasses, - Object[] argValues) - throws SQLException - { - try { - connection_.callMethod (pxId_, methodName, argClasses, argValues); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a boolean. - protected boolean callMethodRtnBool (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsBoolean (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return an int. - protected int callMethodRtnInt (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsInt (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return an Object. - protected Object callMethodRtnObj (String methodName) - throws SQLException - { - try { - return connection_.callMethodReturnsObject (pxId_, methodName); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - // Call a method, and return a 'raw' ProxyReturnValue. - protected ProxyReturnValue callMethodRtnRaw (String methodName, - Class[] argClasses, - Object[] argValues) - throws SQLException - { - try { - return connection_.callMethod (pxId_, methodName, - argClasses, argValues); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public void cancel () - throws SQLException - { - cachedResultSet_ = null; - callMethod ("cancel"); - } - - - -// JDBC 2.0 - public void clearBatch () - throws SQLException - { - callMethod ("clearBatch"); - } - - - - public void clearWarnings () - throws SQLException - { - callMethod ("clearWarnings"); - } - - - - public void close () - throws SQLException - { - cachedResultSet_ = null; - callMethod ("close"); - } - - - public boolean execute (String sql) - throws SQLException - { - cachedResultSet_ = null; - return callMethodRtnRaw ("execute", - new Class[] { String.class }, - new Object[] { sql }) - .getReturnValueBoolean (); - } - - - - // JDBC 3.0 - public boolean execute (String sql, int autoGeneratedKeys) - throws SQLException - { - cachedResultSet_ = null; - return callMethodRtnRaw ("execute", - new Class[] { String.class, Integer.TYPE}, - new Object[] { sql, new Integer(autoGeneratedKeys)}) - .getReturnValueBoolean (); - } - - - - // JDBC 3.0 - public boolean execute (String sql, int[] columnIndexes) - throws SQLException - { - cachedResultSet_ = null; - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - - // JDBC 3.0 - public boolean execute (String sql, String[] columnNames) - throws SQLException - { - cachedResultSet_ = null; - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - -// JDBC 2.0 - public int[] executeBatch () - throws SQLException - { - cachedResultSet_ = null; - return (int[]) callMethodRtnObj ("executeBatch"); - } - - - - public ResultSet executeQuery (String sql) - throws SQLException - { - cachedResultSet_ = null; - try { - JDResultSetProxy newResultSet = new JDResultSetProxy (jdConnection_, this); - cachedResultSet_ = (JDResultSetProxy) connection_.callFactoryMethod ( - pxId_, - "executeQuery", - new Class[] { String.class }, - new Object[] { sql }, - newResultSet); - return cachedResultSet_; - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public int executeUpdate (String sql) - throws SQLException - { - cachedResultSet_ = null; - return callMethodRtnRaw ("executeUpdate", - new Class[] { String.class }, - new Object[] { sql }) - .getReturnValueInt (); - } - - - - // JDBC 3.0 - public int executeUpdate (String sql, int autoGeneratedKeys) - throws SQLException - { - cachedResultSet_ = null; - return callMethodRtnRaw ("executeUpdate", - new Class[] { String.class, Integer.TYPE}, - new Object[] { sql, new Integer(autoGeneratedKeys)}) - .getReturnValueInt (); - } - - - - // JDBC 3.0 - public int executeUpdate (String sql, int[] columnIndexes) - throws SQLException - { - cachedResultSet_ = null; - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - - // JDBC 3.0 - public int executeUpdate (String sql, String[] columnNames) - throws SQLException - { - cachedResultSet_ = null; - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - -// JDBC 2.0 - public Connection getConnection () - { - return jdConnection_; - } - - -// JDBC 2.0 - public int getFetchDirection () - throws SQLException - { - return callMethodRtnInt ("getFetchDirection"); - } - - - -// JDBC 2.0 - public int getFetchSize () - throws SQLException - { - return callMethodRtnInt ("getFetchSize"); - } - - - - // JDBC 3.0 - public ResultSet getGeneratedKeys () - throws SQLException - { - cachedResultSet_ = null; - try { - JDResultSetProxy newResultSet = new JDResultSetProxy (jdConnection_, this); - cachedResultSet_ = (JDResultSetProxy) connection_.callFactoryMethod ( - pxId_, - "getGeneratedKeys", - newResultSet); - return cachedResultSet_; - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - - - - public int getMaxFieldSize () - throws SQLException - { - return callMethodRtnInt ("getMaxFieldSize"); - } - - - - public int getMaxRows () - throws SQLException - { - return callMethodRtnInt ("getMaxRows"); - } - - - - public boolean getMoreResults () - throws SQLException - { - cachedResultSet_ = null; - return callMethodRtnBool ("getMoreResults"); - } - - - - // JDBC 3.0 - public boolean getMoreResults (int current) - throws SQLException - { - cachedResultSet_ = null; - // Avoid dragging in JDError - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_FUNCTION_NOT_SUPPORTED), - EXC_FUNCTION_NOT_SUPPORTED, -99999); - } - - - - public int getQueryTimeout () - throws SQLException - { - return callMethodRtnInt ("getQueryTimeout"); - } - - - - public ResultSet getResultSet () - throws SQLException - { - if (cachedResultSet_ == null) - { - try { - JDResultSetProxy newResultSet = new JDResultSetProxy (jdConnection_, this); - cachedResultSet_ = (JDResultSetProxy) connection_.callFactoryMethod ( - pxId_, "getResultSet", newResultSet); - } - catch (InvocationTargetException e) { - throw JDConnectionProxy.rethrow1 (e); - } - } - return cachedResultSet_; - } - - - -// JDBC 2.0 - public int getResultSetConcurrency () - throws SQLException - { - return callMethodRtnInt ("getResultSetConcurrency"); - } - - - - // JDBC 3.0 - public int getResultSetHoldability () - throws SQLException - { - return callMethodRtnInt ("getResultSetHoldability"); - } - - - - -// JDBC 2.0 - public int getResultSetType () - throws SQLException - { - return callMethodRtnInt ("getResultSetType"); - } - - - - public int getUpdateCount () - throws SQLException - { - return callMethodRtnInt ("getUpdateCount"); - } - - - - public SQLWarning getWarnings () - throws SQLException - { - return (SQLWarning) callMethodRtnObj ("getWarnings"); - } - - - public void setCursorName (String cursorName) - throws SQLException - { - cachedResultSet_ = null; - callMethod ("setCursorName", - new Class[] { String.class }, - new Object[] { cursorName }); - } - - - - public void setEscapeProcessing (boolean escapeProcessing) - throws SQLException - { - callMethod ("setEscapeProcessing", - new Class[] { Boolean.TYPE }, - new Object[] { new Boolean (escapeProcessing) }); - } - - - -// JDBC 2.0 - public void setFetchDirection (int fetchDirection) - throws SQLException - { - callMethod ("setFetchDirection", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (fetchDirection) }); - } - - - -// JDBC 2.0 - public void setFetchSize (int fetchSize) - throws SQLException - { - callMethod ("setFetchSize", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (fetchSize) }); - } - - - - public void setMaxFieldSize (int maxFieldSize) - throws SQLException - { - callMethod ("setMaxFieldSize", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (maxFieldSize) }); - } - - - public void setMaxRows (int maxRows) - throws SQLException - { - callMethod ("setMaxRows", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (maxRows) }); - } - - - - public void setQueryTimeout (int queryTimeout) - throws SQLException - { - callMethod ("setQueryTimeout", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (queryTimeout) }); - } - - - // This method is not required by java.sql.Statement, - // but it is used by the JDBC testcases, and is implemented - // in the public class. - public String toString () - { - try { - return (String) connection_.callMethodReturnsObject (pxId_, "toString"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - //@pda jdbc40 - protected String[] getValidWrappedList() - { - return new String[] { "java.sql.Statement" }; - } - - //@PDA jdbc40 - public boolean isClosed () throws SQLException - { - return callMethodRtnBool ("isClosed"); - } - - //@PDA jdbc40 - public void setPoolable(boolean poolable) throws SQLException - { - callMethod ("setPoolable", - new Class[] { Boolean.TYPE }, - new Object[] { new Boolean (poolable) }); - } - - //@PDA jdbc40 - public boolean isPoolable() throws SQLException - { - return callMethodRtnBool ("isPoolable"); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JDTableTypeFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDTableTypeFieldMap.java deleted file mode 100644 index 822113ab8..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDTableTypeFieldMap.java +++ /dev/null @@ -1,95 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDTableTypeFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - - -/** - The JDTableTypeFieldMap class converts - the table type values received from the - system to the values required by JDBC. -**/ -class JDTableTypeFieldMap -extends JDSimpleFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - static final String TABLE_TYPE_SYSTEM_TABLE = "SYSTEM TABLE"; - static final String TABLE_TYPE_TABLE = "TABLE"; - static final String TABLE_TYPE_VIEW = "VIEW"; - static final String TABLE_TYPE_MATERIALIZED_QUERY_TABLE = "MATERIALIZED QUERY TABLE"; //@K1A - static final String TABLE_TYPE_ALIAS = "ALIAS"; //@K3A - - - JDTableTypeFieldMap (int fromIndex) - { - super (fromIndex); - } - - /** - Returns the table type in JDBC format. - **/ - public Object getValue (JDRow row) - throws SQLException - { - Object serverData = super.getValue (row); - String serverDataAsString = serverData.toString (); - - if(serverDataAsString.length () > 0) - { - switch(serverData.toString ().charAt (0)) - { - case 'T': - default: - return TABLE_TYPE_TABLE; - case 'V': - return TABLE_TYPE_VIEW; - case 'S': - return TABLE_TYPE_SYSTEM_TABLE; - case 'M': //@K1A - return TABLE_TYPE_MATERIALIZED_QUERY_TABLE; //@K1A - case 'A': //@K3A - return TABLE_TYPE_ALIAS; //@K3A - - } - } - else - return TABLE_TYPE_TABLE; - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return false; - } - - /** - Indicates if the value is null. - **/ - public boolean isNull (JDRow row) - throws SQLException - { - return false; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDTrace.java b/cvsroot/src/com/ibm/as400/access/JDTrace.java deleted file mode 100644 index b50e1fcc3..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDTrace.java +++ /dev/null @@ -1,463 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDTrace.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.sql.DriverManager; - - - -/** -

    Manage tracing for the driver. This class provides a -consistent way for classes to log trace messages. - -

    Note that tracing is turned on or off on a DriverManager -basis, not on a driver or connection basis. -**/ -// -// Implementation notes: -// -// 1. The tracing strategy for the driver is that when -// tracing is turned on at the DriverManager level, -// the driver will put out various messages to the -// specified PrintStream. -// -// Within the driver, all tracing should only be done -// after checking isTraceOn(). This will -// help to relieve much in the way of String construction -// and concatenation when tracing is turned off. -// -// Note that not all requests and replies need to be -// documented, since this information is available via -// an AS/400 comm trace. -// -// 2. We used to trace every public API call, but it was -// determined that a check for tracing on every API -// call was slowing performance and not necessarily -// helpful for debugging. -// -// @D0A: 3. We now synchronize all calls to -// DriverManager.println(), since we had some garbled -// traces for multiple-threaded applications. Now -// there is yet another reason to make sure and call -// isTraceOn() before any of the logXXX() methods, -// since we have a synchronized block - and synchronized -// blocks are slow. We only want to incur that -// performance penalty when tracing is on. -// -// @CRS: 4. To provide compatibility between JDK 1.1 and JDK 1.2+, -// we now handle both DriverManager.GetLogStream() and DriverManager.getLogWriter(). -// In JDK 1.4.1, if a log writer is set, getLogStream() returns null, but if a -// log stream is set, getLogWriter() still returns a writer. This is confusing. -// We attempt to treat the log writer and the log stream separately, and we log -// to both of them if they are available. This is to maintain backwards-compatibility -// with apps that are still using the deprecated log stream methods. -// Note that we also treat Toolbox JDBC tracing separately now. -// -// @JWE: In March 2010, removed support for depreciated GetLogStream() -// - -final class JDTrace -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // This code copied from JDUtilities so we don't reference that class, - // in case we are running with the proxy jar file. - private static int JDBCLevel_ = 10; - static - { - try - { - Class.forName("java.sql.Blob"); - JDBCLevel_ = 20; - - Class.forName("java.sql.Savepoint"); - JDBCLevel_ = 30; - } - catch (Throwable e) { } - } - - -/** -Private constructor to prevent instantiation. All methods in -this class are static. -**/ - private JDTrace() - { - } - - - - -/** -Indicates if tracing is turned on? - -@return true or false -**/ - static boolean isTraceOn() - { - // If there is a log writer or log stream in the DriverManager, then - // according to the DriverManager javadoc, all JDBC drivers should be - // logging. If there is not one set (e.g. set to null), all drivers - // should not be logging. However, since we have our own Toolbox tracing, we are - // nicer than that. We let the user turn off Toolbox JDBC tracing without - // turning off DriverManager tracing. And vice-versa: If Toolbox JDBC tracing is - // turned on via the Trace class, we will log our JDBC traces there... we don't - // muck with the DriverManager logging until someone sets a log writer or log - // stream into it. - - // Is Toolbox tracing on? - if (Trace.traceOn_ && Trace.traceJDBC_) return true; - - // Is DriverManager tracing on? - if (JDBCLevel_ > 10) // We don't reference JDUtilities here in case we are running proxified. - { - if (DriverManager.getLogWriter() != null) return true; - } - return (DriverManager.getLogWriter() != null); - } - - - -// @j1a new method -/** -Logs information about tracing. - -@param object The object -@param information The information. -**/ - static void logDataEvenIfTracingIsOff(Object object, String information) - { - // We will force tracing on for this information. If we turned - // tracing just to log this debug info we will turn it back off - // at the end of the routine. - - //@CRS - Not sure why we have this method. The whole point of turning trace - // on or off is whether or not you want data logged. I've changed this method - // to just call logInformation(). - - logInformation(object, information); - } - - - - - -// @J2 new method -/** -Logs an information trace message. - -@param information The information. -**/ - static void logInformation(String information) - { - if (isTraceOn()) - { - String data = "as400: " + information; - - log(data); - } - } - - -// @J3 new method. -/** -Logs an information trace message. - -@param object The object -@param information The information. -@param exception The exception. -**/ - static void logException(Object object, String information, Exception e) - { - if (isTraceOn()) - { - StringWriter sw = new StringWriter(); - PrintWriter buffer = new PrintWriter(sw); - buffer.write("as400: "); - - if (object != null) - { - buffer.write(objectToString(object)); - } - else - { - buffer.write("static method"); - } - - buffer.write(": "); - buffer.write(information); - buffer.write("."); - - e.printStackTrace(buffer); - - log(sw.toString()); - } - } - -// @J4 new method. -/** -Logs an information trace message. - -@param object The object throwing the exception -@param object2 Additional object information (probably the connection object) -@param information The information. -@param exception The exception. -**/ - static void logException(Object object, - Object object2, - String information, - Exception e) - { - if (isTraceOn()) - { - StringWriter sw = new StringWriter(); - PrintWriter buffer = new PrintWriter(sw); - buffer.write("as400: "); - - if (object != null) - { - buffer.write(objectToString(object)); - } - else - { - buffer.write("static method "); - } - - if (object2 != null) - { - buffer.write(objectToString(object2)); - } - - buffer.write(": "); - buffer.write(information); - buffer.write("."); - - e.printStackTrace(buffer); - - log(sw.toString()); - } - } - - - - -/** -Logs an information trace message. - -@param object The object -@param information The information. -**/ - static void logInformation(Object object, String information) - { - if (isTraceOn()) - { - StringBuffer buffer = new StringBuffer(); - buffer.append("as400: "); - buffer.append(objectToString(object)); - buffer.append(": "); - buffer.append(information); - buffer.append("."); - - log(buffer.toString()); - } - } - - - -/** -Logs a property trace message. - -@param object The object -@param propertyName The property name. -@param propertyValue The property value. -**/ - static void logProperty(Object object, String propertyName, String propertyValue) - { - if (isTraceOn()) - { - StringBuffer buffer = new StringBuffer(); - buffer.append("as400: "); - buffer.append(objectToString(object)); - buffer.append(": "); - buffer.append(propertyName); - buffer.append(" = \""); - buffer.append(propertyValue); - buffer.append("\"."); - - log(buffer.toString()); - } - } - - - -/** -Logs a property trace message. - -@param object The object -@param propertyName The property name. -@param propertyValue The property value. -**/ - static void logProperty(Object object, String propertyName, boolean propertyValue) - { - if (isTraceOn()) - { - Boolean b = new Boolean(propertyValue); - logProperty(object, propertyName, b.toString()); - } - } - - - -/** -Logs a property trace message. - -@param object The object -@param propertyName The property name. -@param propertyValue The property value. -**/ - static void logProperty(Object object, String propertyName, int propertyValue) - { - if (isTraceOn()) - { - logProperty(object, propertyName, Integer.toString(propertyValue)); - } - } - - - -/** -Logs an open trace message. - -@param object The object -**/ - static void logOpen(Object object, Object parent) - { - if (isTraceOn()) - { - StringBuffer buffer = new StringBuffer(); - buffer.append("as400: "); - buffer.append(objectToString(object)); - buffer.append(" open."); - - if (parent != null) // @J3a - { - // @J3a - buffer.append(" Parent: "); // @J3a - buffer.append(objectToString(parent)); // @J3a - buffer.append("."); // @J3a - } // @J3a - - log(buffer.toString()); - } - } - - - // Logs the data to the DriverManager and/or Toolbox trace. - private static void log(String data) - { - // No need to synchronize, as our operations are atomic... one call to each stream/writer. - // The streams/writers themselves are synchronized internally. - if (JDBCLevel_ > 10) // We don't reference JDUtilities here in case we are running proxified. - { - // Log to the DriverManager writer. - PrintWriter pw = DriverManager.getLogWriter(); - if (pw != null) - { - pw.println(data); - } - } - // Log to the DriverManager stream. - Writer ps = DriverManager.getLogWriter(); - if (ps != null) - { - try { - ps.write(data+"\n"); - } catch (IOException e) { - // ignore any warning - } - - } - // Log to Toolbox trace. - Trace.log(Trace.JDBC, data); - } - - -/** -Logs a close trace message. - -@param object The object -**/ - static void logClose(Object object) - { - if (isTraceOn()) - { - StringBuffer buffer = new StringBuffer(); - buffer.append("as400: "); - buffer.append(objectToString(object)); - buffer.append(" closed."); - log(buffer.toString()); - } - } - - - -/** -Maps an object to a string. - -@param object The object. -@return The string. -**/ - static String objectToString(Object object) // @J3c (no longer private) - { - if(object == null) - object = ""; //@pda dummy to "" so don't get incorrect null pointer exception while trace is on. - // Determine the class name. - String clazz = object.getClass().getName(); // @D3C - String className; - if (clazz.startsWith("com.ibm.as400.access.AS400JDBC")) // @D3A - className = clazz.substring(30); // @D3A - else if (clazz.startsWith("com.ibm.as400.access.JD")) // @D3A - className = clazz.substring(23); // @D3A - else if (clazz.startsWith("java.lang.Class")) - className = ""; //@static callers of JDTrace - else - className = "Unknown"; - - StringBuffer buffer = new StringBuffer(); - buffer.append(className); - buffer.append(" "); - buffer.append(object.toString()); - buffer.append(" ("); // @J3a - buffer.append(object.hashCode()); // @J3a - buffer.append(") "); // @J3a - - return buffer.toString(); - } - - - -/** -Turns trace on, to System.out or what it was previously set to if it was turned off -by this method. This method will not initialize trace again if trace is already set -on by another method. -**/ - static void setTraceOn(boolean traceOn) - { - Trace.setTraceJDBCOn(traceOn); - if(traceOn) - Trace.setTraceOn(traceOn); - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/JDTransactionManager.java b/cvsroot/src/com/ibm/as400/access/JDTransactionManager.java deleted file mode 100644 index 1f82efaab..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDTransactionManager.java +++ /dev/null @@ -1,989 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDTransactionManager.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.Connection; -import java.sql.SQLException; - - - -/** -

    This class manages transaction operations. - -

    In addition to issuing commits and rollbacks to the database, -it manages auto-commit and the transaction isolation level. -Auto-commit and the transaction isolation level interact in the -following ways: - -

      - -
    • Auto-commit is on by default. - -
    • The transaction isolation level has no effect when auto- -commit is on. (Auto-commit on is essentially the same thing -as a transaction isolation level of Connection.TRANSACTION_NONE.) -However, even when auto-commit is on, the current transaction -isolation level is stored and returned upon request via -getIsolation. - -
    -**/ -// -// Implementation notes: -// -// In the code and documentation, "transaction isolation level" -// and "level" refer to the JDBC transaction isolation level (i.e. -// Connection.TRANSACTION_* constants) and "commit mode" refers -// to the value as set on the system. -// -// External to this class, only the transaction isolation level -// is used. Internal to this class, the transaction isolation -// level is mapped to the appropriate commit mode. Note that -// not all transaction isolation levels are supported. -// -class JDTransactionManager -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // @C6A Server commit mode constants - // @C6A *CS and *CHG are different numbers on the system than in the client; these are the - // @C6A numbers we need to send to the system in an AS400JDBCConnection.setServerAttributes(). - private static final int COMMIT_SERVER_MODE_CS_ = 1; // TRANSACTION_READ_COMMITTED //@C6A - private static final int COMMIT_SERVER_MODE_CHG_ = 2; // TRANSACTION_READ_UNCOMMITTED //@C6A - - // Client commit mode constants - static final int COMMIT_MODE_NOT_SET_ = -1; - private static final int COMMIT_MODE_NONE_ = 0; // TRANSACTION_NONE - private static final int COMMIT_MODE_CHG_ = 1; // TRANSACTION_READ_UNCOMMITTED - private static final int COMMIT_MODE_CS_ = 2; // TRANSACTION_READ_COMMITTED - private static final int COMMIT_MODE_ALL_ = 3; // TRANSACTION_REPEATABLE_READ - private static final int COMMIT_MODE_RR_ = 4; // TRANSACTION_SERIALIZABLE - - private static final String[] COMMIT_MODE_ = { "NONE", - "CHG", - "CS", - "ALL", - "RR"}; - - static final int CURSOR_HOLD_FALSE = 0; // @C1 @B1C - static final int CURSOR_HOLD_TRUE = 1; // @C1 @B1C - - private boolean activeLocal_; // Is a local transaction active? @C4C - private boolean activeGlobal_; // Is a global transaction active? @C4A - private boolean autoCommit_; // Is auto-commit on? - private AS400JDBCConnection connection_; - private int holdIndicator_; // Current cursor hold indicator. @C1 - private int currentCommitMode_; // Current commit mode. - private int currentIsolationLevel_; // Current isolation level. - private int id_; - private int initialCommitMode_; // Initial commit mode. - private boolean localAutoCommit_ = true; // @C4A - private boolean localTransaction_ = true; // @C4A - // @C5D private boolean newAutoCommitSupport_ = false; // @C5A - private int serverCommitMode_; // Commit mode on the system. Always base off of JDBC transaction isolation level (currentCommitMode_) - private int currentLocatorPersistence_=-1; /*@ABA*/ - private int requestedLocatorPersistence_ = -1; /*@ABA*/ - private boolean serverAllowsLocatorPersistenceChange_ = true; - - -/** -Constructor. The transaction isolation level should -be initialized independently of this class. However, since -commits and rollbacks always cause the database to revert -back to the initial commit mode, we need to remember what -this initial commit mode is, so we can predict how the -system is behaving. - -@param connection Connection to the system. -@param id The id. -@param initialLevel One of the Connection.TRANSACTION_* - values. - -@exception SQLException If an invalid or unsupported - level is input. -**/ - JDTransactionManager (AS400JDBCConnection connection, - int id, - String initialLevel, - boolean autoCommit) //@AC1 - throws SQLException - { - activeLocal_ = false; // @C4C - activeGlobal_ = false; // @C4A - autoCommit_ = autoCommit; //@AC1 - connection_ = connection; - holdIndicator_ = CURSOR_HOLD_TRUE; // @C1 - id_ = id; - - currentIsolationLevel_ = mapStringToLevel (initialLevel); - currentCommitMode_ = mapLevelToCommitMode (currentIsolationLevel_); - initialCommitMode_ = currentCommitMode_; - //@AC1 (only set to *NONE if autocommit is on) - if((connection_.newAutoCommitSupport_ == 1) && (autoCommit)) //@K64 If running under new auto commit support (V5R3 and higher), by default, auto commit is run under the *NONE isolation level - serverCommitMode_ = COMMIT_MODE_NONE_; //@K64 - else //@K64 - serverCommitMode_ = currentCommitMode_; - } - - - -/** -Commit the current transaction. - -@exception SQLException If an error occurs. -**/ - void commit () - throws SQLException - { - try - { - DBSQLRequestDS request = null; //@P0A - DBReplyRequestedDS reply = null; //@P0A - try - { - request = DBDSPool.getDBSQLRequestDS ( //@P0C - DBSQLRequestDS.FUNCTIONID_COMMIT, id_, - DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); - - // Set cursor hold. - //request.setHoldIndicator (1); // @C1 - request.setHoldIndicator(getHoldIndicator()); // @C1 - - reply = connection_.sendAndReceive (request); //@P0C - - int errorClass = reply.getErrorClass(); - - if (errorClass != 0) { - int returnCode = reply.getReturnCode(); - JDError.throwSQLException (connection_, id_, errorClass, returnCode); - } - } - finally - { - if (request != null) { request.returnToPool(); request =null; } - if (reply != null) { reply.returnToPool(); reply = null; } // Only errorClass used from reply - } - - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - - resetServer (); - activeLocal_ = false; // @C4C - } - - - -/** -Is auto-commit mode enabled?. - -@return true if auto-commit mode is enabled. -**/ - boolean getAutoCommit () - { - return autoCommit_; - } - - - -/** -Return the current commit mode. - -@return The commit mode. -**/ -// -// Note: This is the only place where the commit mode is -// externalized outside of this class. This is -// necessary for other data streams that need to -// pass a commit mode (e.g. set server attributes). -// - int getCommitMode () - { - if (serverCommitMode_ == COMMIT_MODE_CHG_) //@C6A - return COMMIT_SERVER_MODE_CHG_; //@C6A - else if (serverCommitMode_ == COMMIT_MODE_CS_) //@C6A - return COMMIT_SERVER_MODE_CS_; //@C6A - else //@C6A - return serverCommitMode_; - } - - - -/** -* Returns the hold indicator. -* @return The hold indicator. -**/ - int getHoldIndicator() // @C1 - { - return holdIndicator_; - } - -/** -Return the current transaction isolation level. - -@return One of the Connection.TRANSACTION_* values. -**/ - int getIsolation () - { - return currentIsolationLevel_; - } - - - - boolean isGlobalActive () // @C4A - { // @C4A - return activeGlobal_; // @C4A - } // @C4A - - - -// @C4C -/** -Is a local transaction active? - -@return true if a local transaction is active. -**/ - boolean isLocalActive () - { - return activeLocal_; - } - - - -// @C4A - boolean isLocalTransaction() - { - return localTransaction_; - } - - - // @C5D boolean isNewAutoCommitSupport() // @C5A - // @C5D { // @C5A - // @C5D return newAutoCommitSupport_; // @C5A - // @C5D } // @C5A - - -/** -Map a transaction isolation level to its corresponding -commit mode. - -@param level One of the java.sql.Connection.TRANSACTION_* - values. -@return The commit mode. - -@exception SQLException If the level does not map - to any commit mode. -**/ - private static int mapLevelToCommitMode (int level) - throws SQLException - { - int result; - switch (level) - { - case Connection.TRANSACTION_NONE: - result = COMMIT_MODE_NONE_; - break; - case Connection.TRANSACTION_READ_UNCOMMITTED: - result = COMMIT_MODE_CHG_; - break; - case Connection.TRANSACTION_READ_COMMITTED: - result = COMMIT_MODE_CS_; - break; - case Connection.TRANSACTION_REPEATABLE_READ: - result = COMMIT_MODE_ALL_; - break; - case Connection.TRANSACTION_SERIALIZABLE: - result = COMMIT_MODE_RR_; - break; - default: - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - result = -1; - } - return result; - } - - - -/** -Map a transaction isolation level specified as a String -to its corresponding int value. - -@param levelAsString A transaction isolation level - specified as a String. -@return The int value. - -@exception SQLException If the String level does not map - to an int value. -**/ - static int mapStringToLevel (String levelAsString) - throws SQLException - { - int result; - if (levelAsString.equalsIgnoreCase (JDProperties.TRANSACTION_ISOLATION_NONE)) - result = Connection.TRANSACTION_NONE; - else if (levelAsString.equalsIgnoreCase (JDProperties.TRANSACTION_ISOLATION_READ_COMMITTED)) - result = Connection.TRANSACTION_READ_COMMITTED; - else if (levelAsString.equalsIgnoreCase (JDProperties.TRANSACTION_ISOLATION_READ_UNCOMMITTED)) - result = Connection.TRANSACTION_READ_UNCOMMITTED; - else if (levelAsString.equalsIgnoreCase (JDProperties.TRANSACTION_ISOLATION_REPEATABLE_READ)) - result = Connection.TRANSACTION_REPEATABLE_READ; - else if (levelAsString.equalsIgnoreCase (JDProperties.TRANSACTION_ISOLATION_SERIALIZABLE)) - result = Connection.TRANSACTION_SERIALIZABLE; - else - { - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - result = -1; - } - return result; - } - - - -// @C4A -/** -Marks a global transaction boundary. -**/ - void markGlobalTransactionBoundary() - { - activeGlobal_ = false; - } - - - - -// @C2A -/** -Processes a commit on return indicator from a reply. -If this indicator is set, it means that the transaction -was committed or rolled back on the system and we should -mark the transaction as not being active. - -@param reply The reply. -**/ - void processCommitOnReturn(DBBaseReplyDS reply) - throws DBDataStreamException - { - // If the system indicates commit-on-, reflect that fact. - DBReplySQLCA sqlca = reply.getSQLCA (); - if (sqlca.getEyecatcherBit54()) - activeLocal_ = false; // @C4C - } - - - -/** -Reset the system to the current commit mode. This is useful -since after commits and rollbacks, the database automatically -reverts back to its initial commit mode. - -@exception SQLException In an error occurs. -**/ - private void resetServer () - throws SQLException - { - if(connection_.newAutoCommitSupport_ == 0) //@KBA If V5R2 or earlier do what we always have - { - // Model the database automatically reverting back to - // its initial commit mode. - serverCommitMode_ = initialCommitMode_; - - // Reset the server's commit mode. - setCommitMode (currentCommitMode_); - } - } - - - void resetXAServer() - throws SQLException - { - resetServer(); - } - - -/** -Rollback the current transaction. If auto-commit mode is -enabled, then do nothing. - -@exception SQLException If an error occurs. -**/ - void rollback () - throws SQLException - { - try - { - DBSQLRequestDS request = null; //@P0A - DBReplyRequestedDS reply = null; //@P0A - try - { - request = DBDSPool.getDBSQLRequestDS ( //@P0C - DBSQLRequestDS.FUNCTIONID_ROLLBACK, id_, - DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0); - - // Set cursor hold. - //request.setHoldIndicator (1); // @C1 - request.setHoldIndicator(getHoldIndicator()); // @C1 - - reply = connection_.sendAndReceive (request); //@P0C - - int errorClass = reply.getErrorClass(); - - if (errorClass != 0) { - int returnCode = reply.getReturnCode(); - JDError.throwSQLException (connection_, id_, errorClass, returnCode); - } - } - finally - { - if (request != null) { request.returnToPool(); request =null; } - if (reply != null) { reply.returnToPool(); reply = null; } // Only errorClass used from reply - } - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - - resetServer (); - activeLocal_ = false; // @C4C - } - - - -/** -Set the auto-commit mode. - -@param autoCommit true to turn on auto-commit mode, false to - turn it off. - -@exception SQLException If an error occurs. -**/ - void setAutoCommit (boolean autoCommit) - throws SQLException - { - // If we are in a distributed transaction, then reject a request @C4A - // to turn on auto-commit. If we are supposed to turn it off, @C4A - // then just remember for when we are out of the distributed @C4A - // transaction, since the database won't let us do any transaction @C4A - // stuff during the distributed transaction. @C4A - if (!localTransaction_) - { // @C4A - if (autoCommit == true) // @C4A - JDError.throwSQLException (JDError.EXC_TXN_STATE_INVALID); // @C4A - else // @C4A - localAutoCommit_ = false; // @C4A - } // @C4A - - // If we are in the local transaction, just go ahead and set it. @C4A - else - { // @C4A - - // If going from false to true, then commit any outstanding - // transaction. - if (!autoCommit_ && autoCommit && activeLocal_) - { // @C4C - commit (); - connection_.postWarning (JDError.getSQLWarning (JDError.WARN_TXN_COMMITTED)); - } - - // Save the auto commit state. - autoCommit_ = autoCommit; - - // @C5D if (newAutoCommitSupport_) { // @C5A - // @C5D try { // @C5A - // @C5D DBSQLAttributesDS request = new DBSQLAttributesDS( // @C5A - // @C5D DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, // @C5A - // @C5D id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA, 0, 0); // @C5A - // @C5D request.setAutoCommit(autoCommit ? 1 : 0); // @C5A - // @C5D DBReplyRequestedDS reply = connection_.sendAndReceive(request); // @C5A - // @C5D int errorClass = reply.getErrorClass(); // @C5A - // @C5D int returnCode = reply.getReturnCode(); // @C5A - // @C5D if (errorClass != 0) // @C5A - // @C5D JDError.throwSQLException(connection_, id_, errorClass, returnCode);// @C5A - // @C5D } // @C5A - // @C5D catch (DBDataStreamException e) { // @C5A - // @C5D JDError.throwSQLException (JDError.EXC_INTERNAL, e); // @C5A - // @C5D } // @C5A - // @C5D } // @C5A - // @C5D else // @C5A - - if(connection_.newAutoCommitSupport_ == 0) //@KBA OS/400 V5R2 or earlier do what we always have - setCommitMode (currentCommitMode_); - else //@KBA use new auto commit support - { //@KBA - DBSQLAttributesDS request = null; //@KBA - DBReplyRequestedDS reply = null; //@KBA - try //@KBA - { //@KBA - request = DBDSPool.getDBSQLAttributesDS (DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); //@KBA - request.setAutoCommit(autoCommit ? 0xE8 : 0xD5); //@KBA Set auto commit to on or off - request.setCommitmentControlLevelParserOption(getIsolationLevel()); //@KBA Set isolation level - if(autoCommit_ && connection_.newAutoCommitSupport_ == 1) - serverCommitMode_ = COMMIT_MODE_NONE_; - else - serverCommitMode_ = currentCommitMode_; - - boolean changed = setRequestLocatorPersistence(request, getIsolationLevel()); /*@ABA*/ - reply = connection_.sendAndReceive(request); //@KBA - int errorClass = reply.getErrorClass(); //@KBA - int returnCode = reply.getReturnCode(); //@KBA - if(errorClass != 0 && changed) { - // Try again for the case where the server does not support the change - serverAllowsLocatorPersistenceChange_ = false; - request.returnToPool(); request =null; - reply.returnToPool(); reply = null; - request = DBDSPool.getDBSQLAttributesDS (DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); //@KBA - request.setAutoCommit(autoCommit ? 0xE8 : 0xD5); //@KBA Set auto commit to on or off - request.setCommitmentControlLevelParserOption(getIsolationLevel()); //@KBA Set isolation level - if(autoCommit_ && connection_.newAutoCommitSupport_ == 1) - serverCommitMode_ = COMMIT_MODE_NONE_; - else - serverCommitMode_ = currentCommitMode_; - reply = connection_.sendAndReceive(request); //@KBA - errorClass = reply.getErrorClass(); //@KBA - returnCode = reply.getReturnCode(); //@KBA - - } - - if (errorClass != 0) // @KBA - JDError.throwSQLException(connection_, id_, - errorClass, returnCode); // @KBA - persistenceUpdated(); - - } //@KBA - catch(DBDataStreamException e) //@KBA - { //@KBA - JDError.throwSQLException(JDError.EXC_INTERNAL, e); //@KBA - } //@KBA - finally //@KBA - { //@KBA - if (request != null) { request.returnToPool(); request =null;} //@KBA - if (reply != null) { reply.returnToPool(); reply = null; } //@KBA - } //@KBA - } //@KBA - } // @C4A - } - - /* - * Sets the locator persistence for a request. The persistence is typically - * set to 1 (Scoped to transaction) but must be set to 0 (scoped to cursor) - * if Auto commit is off and transaction isolation level isNONE. - * - * Should be called whenever autocommit level or isolation level is changed. - * - * @ABA - * - * This should be followed by a call to persistenceUpdated() after the - * request returns successfully. This returns true if the request was - * changed - */ - private boolean setRequestLocatorPersistence(DBSQLAttributesDS request, - int commitMode) throws DBDataStreamException { - - // transaction isolation is none, make sure locator persistence is - // scoped to the cursor - requestedLocatorPersistence_ = -1; - if (serverAllowsLocatorPersistenceChange_) { - if (commitMode == COMMIT_MODE_NONE_) { - if (currentLocatorPersistence_ != 0) { - request.setLocatorPersistence(0); - requestedLocatorPersistence_ = 0; - return true; - } - } else { - if (currentLocatorPersistence_ != 1) { - request.setLocatorPersistence(1); - requestedLocatorPersistence_ = 1; - return true; - } - } - } - return false; - } - - /* Indicate that the request to update the persistence was successful - * - */ - private void persistenceUpdated() { - if (serverAllowsLocatorPersistenceChange_ && (requestedLocatorPersistence_ != -1)) { - currentLocatorPersistence_ = requestedLocatorPersistence_; - } - } - -/** -Set the commit mode on the system. - -@param commitMode The commit mode. - -@exception SQLException If an error occurs. -**/ - private void setCommitMode (int commitMode) - throws SQLException - { - // If auto-commit is on, then override the commit mode - // to "NONE". - if (autoCommit_) //@C5D && (!newAutoCommitSupport_)) // @C5C - commitMode = COMMIT_MODE_NONE_; - - // Act only if the server commit mode is something other - // then the what was requested. - if (commitMode != serverCommitMode_) - { - - JDSQLStatement sqlStatement = new JDSQLStatement ( - "SET TRANSACTION ISOLATION LEVEL " + COMMIT_MODE_[commitMode]); - - // Send the execute immediate data stream. - try - { - DBSQLRequestDS request = null; //@P0A - DBReplyRequestedDS reply = null; //@P0A - try - { - request = DBDSPool.getDBSQLRequestDS ( //@P0C - DBSQLRequestDS.FUNCTIONID_EXECUTE_IMMEDIATE, id_, - DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_SQLCA, 0); - - boolean extended = false; //@540 - if(connection_.getVRM() >= JDUtilities.vrm540) extended = true; //@540 - //Bidi-HCG request.setStatementText (sqlStatement.toString (), connection_.unicodeConverter_, extended); // @C3C @P0C @540C - request.setStatementText (sqlStatement.toString (), connection_.packageCCSID_Converter, extended); //Bidi-HCG - request.setStatementType (sqlStatement.getNativeType ()); - - // This statement certainly does not need a cursor, but some - // versions of the system choke when none is specified. - request.setCursorName ("MURCH", connection_.converter_); //@P0C - - reply = connection_.sendAndReceive (request); //@P0C - - int errorClass = reply.getErrorClass(); - int returnCode = reply.getReturnCode(); - - if (errorClass != 0) - JDError.throwSQLException (connection_, id_, errorClass, returnCode); - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - if (reply != null) { reply.returnToPool(); reply = null; } // Only errorClass Used from reply - } - } - catch (DBDataStreamException e) - { - JDError.throwSQLException (JDError.EXC_INTERNAL, e); - } - - serverCommitMode_ = commitMode; - } - - } - -/** -* Sets the cursor hold indicator. -* @param hold The cursor hold value. -* @exception SQLException If a database error occurs. -**/ - void setHoldIndicator(String hold) throws SQLException // @C1 - { - if (hold.equalsIgnoreCase (JDProperties.CURSORHOLD_TRUE)) - holdIndicator_ = CURSOR_HOLD_TRUE; - else if (hold.equalsIgnoreCase (JDProperties.CURSORHOLD_FALSE)) - holdIndicator_ = CURSOR_HOLD_FALSE; - else - { - JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - holdIndicator_ = -1; - } - } - -/** -Change the transaction isolation level using one of the -java.sql.Connection.TRANSACTION_* values. - -@param level One of the java.sql.Connection.TRANSACTION_* - values with the exception of TRANSACTION_NONE. - -@exception SQLException If an error occurs, an - invalid or unsupported level - is input, or a transaction is - active. -**/ - void setIsolation (int level) - throws SQLException - { - // This is invalid if a transaction is active. - if (activeLocal_ && connection_.newAutoCommitSupport_ == 0) // @C4C //@KBC - JDError.throwSQLException (JDError.EXC_TXN_STATE_INVALID); // @C4C - - // @C7D We do not allow TRANSACTION_NONE at this time. - // @C7D if (level == Connection.TRANSACTION_NONE) - // @C7D JDError.throwSQLException (JDError.EXC_ATTRIBUTE_VALUE_INVALID); - - // Save the isolation level. - currentCommitMode_ = mapLevelToCommitMode (level); - currentIsolationLevel_ = level; - - // Set the commit mode on the system. - if(connection_.newAutoCommitSupport_ == 0) //@KBA OS/400 V5R2 or earlier do what we always have - setCommitMode (currentCommitMode_); - else //@KBA use new auto commit and commit level support - { //@KBA - DBSQLAttributesDS request = null; //@KBA - DBReplyRequestedDS reply = null; //@KBA - int commitMode = currentCommitMode_; - try //@KBA - { //@KBA - if(autoCommit_ && connection_.newAutoCommitSupport_ == 1) - commitMode = COMMIT_MODE_NONE_; - if(serverCommitMode_ != commitMode) //@KBA - { //@KBA - request = DBDSPool.getDBSQLAttributesDS (DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); //@KBA - request.setCommitmentControlLevelParserOption(getIsolationLevel()); //@KBA - boolean changed = setRequestLocatorPersistence(request, getIsolationLevel()); /*@ABA*/ - - reply = connection_.sendAndReceive(request); //@KBA - int errorClass = reply.getErrorClass(); //@KBA - int returnCode = reply.getReturnCode(); //@KBA - if (errorClass != 0 && changed) { - // Retry request if this fails. - serverAllowsLocatorPersistenceChange_ = false; - request.returnToPool(); request =null; - reply.returnToPool(); reply =null; - request = DBDSPool.getDBSQLAttributesDS (DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); //@KBA - request.setCommitmentControlLevelParserOption(getIsolationLevel()); //@KBA - - reply = connection_.sendAndReceive(request); //@KBA - errorClass = reply.getErrorClass(); //@KBA - returnCode = reply.getReturnCode(); //@KBA - } - if(errorClass != 0) //@KBA - JDError.throwSQLException(connection_, id_, errorClass, returnCode); //@KBA - persistenceUpdated(); - } //@KBA - } //@KBA - catch(DBDataStreamException e) //@KBA - { //@KBA - JDError.throwSQLException(JDError.EXC_INTERNAL, e); //@KBA - } //@KBA - finally //@KBA - { //@KBA - if (request != null) { request.returnToPool(); request = null; } //@KBA - if (reply != null) { reply.returnToPool(); reply = null; } //@KBA - } //@KBA - serverCommitMode_ = commitMode; //@KBA Note: This may not be what the user set it to, if the user want to always run auto commit with the *NONE isolation level - } //@KBA - } - - - -// @C4A -/** -Sets whether to enable the local transaction. -XA support needs this to be false so that commit(), rollback(), etc. -can not be called directly on this object. - -@param enableLocalTransaction true to enable the local transaction, false otherwise. - -@exception SQLException If the connection is not open - or an error occurs. -**/ - void setLocalTransaction(boolean enableLocalTransaction) - throws SQLException - { - localTransaction_ = enableLocalTransaction; - - // Auto commit is disabled while in a distributed transaction. - if (localTransaction_) - { - autoCommit_ = localAutoCommit_; //prior to XA_START autocommit setting - if(connection_.newAutoCommitSupport_ == 0) - setCommitMode(currentCommitMode_); // turn back on auto-commit - else{ - DBSQLAttributesDS request = null; - DBReplyRequestedDS reply = null; - try - { - request = DBDSPool.getDBSQLAttributesDS (DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); - - request.setAutoCommit( autoCommit_ ? 0xE8 : 0xD5); //@PDC change autocommit setting to prior setting before XA_START - - boolean changed = false; - if(connection_.newAutoCommitSupport_ == 1 && autoCommit_ == true) //@PDC - { - request.setCommitmentControlLevelParserOption(COMMIT_MODE_NONE_); - changed = setRequestLocatorPersistence(request, COMMIT_MODE_NONE_); /*@ABA*/ - - serverCommitMode_ = COMMIT_MODE_NONE_; - } - - reply = connection_.sendAndReceive(request); - int errorClass = reply.getErrorClass(); - int returnCode = reply.getReturnCode(); - if (errorClass != 0 && changed) { - // Retry request if this fails. - serverAllowsLocatorPersistenceChange_ = false; - request.returnToPool(); request = null; - reply.returnToPool(); reply =null; - - request = DBDSPool.getDBSQLAttributesDS (DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); - - request.setAutoCommit( autoCommit_ ? 0xE8 : 0xD5); //@PDC change autocommit setting to prior setting before XA_START - - if(connection_.newAutoCommitSupport_ == 1 && autoCommit_ == true) //@PDC - { - request.setCommitmentControlLevelParserOption(COMMIT_MODE_NONE_); - serverCommitMode_ = COMMIT_MODE_NONE_; - } - reply = connection_.sendAndReceive(request); - errorClass = reply.getErrorClass(); - returnCode = reply.getReturnCode(); - } - if(errorClass != 0) - JDError.throwSQLException(connection_, id_, errorClass, returnCode); - persistenceUpdated(); - } - catch(DBDataStreamException e) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - if (reply != null) { reply.returnToPool(); reply = null; } // Only errorClass used from reply - } - } - - } - else - { - localAutoCommit_ = autoCommit_; - autoCommit_ = false; - if(connection_.newAutoCommitSupport_ == 0) //@KBA System is v5r2 or less, do what we always have - setCommitMode(currentCommitMode_); - else //@KBA - { - DBSQLAttributesDS request = null; //@KBA - DBReplyRequestedDS reply = null; //@KBA - try //@KBA - { //@KBA - //auto commit is always false when we are in here so we will run under default or specified isolation level - request = DBDSPool.getDBSQLAttributesDS (DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); //@KBA - request.setAutoCommit(0xD5); //@KBA turn off auto commit - if(serverCommitMode_ != currentCommitMode_) //@KBA - request.setCommitmentControlLevelParserOption(getIsolationLevel()); //@KBA - boolean changed = setRequestLocatorPersistence(request, getIsolationLevel()); /*@ABA*/ - - reply = connection_.sendAndReceive(request); //@KBA - int errorClass = reply.getErrorClass(); //@KBA - int returnCode = reply.getReturnCode(); //@KBA - if (errorClass != 0 && changed) { - // Retry request if this fails. - serverAllowsLocatorPersistenceChange_ = false; - request.returnToPool(); request = null; - reply.returnToPool(); reply = null; - request = DBDSPool.getDBSQLAttributesDS (DBSQLAttributesDS.FUNCTIONID_SET_ATTRIBUTES, - id_, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA - + DBBaseRequestDS.ORS_BITMAP_SERVER_ATTRIBUTES, 0); //@KBA - request.setAutoCommit(0xD5); //@KBA turn off auto commit - if(serverCommitMode_ != currentCommitMode_) //@KBA - request.setCommitmentControlLevelParserOption(getIsolationLevel()); //@KBA - - reply = connection_.sendAndReceive(request); //@KBA - errorClass = reply.getErrorClass(); //@KBA - returnCode = reply.getReturnCode(); //@KBA - } - if(errorClass != 0) //@KBA - JDError.throwSQLException(connection_, id_, errorClass, returnCode); //@KBA - persistenceUpdated(); - } //@KBA - catch(DBDataStreamException e) //@KBA - { //@KBA - JDError.throwSQLException(JDError.EXC_INTERNAL, e); //@KBA - } //@KBA - finally //@KBA - { //@KBA - if (request != null) { request.returnToPool(); request = null; } //@KBA - if (reply != null) { reply.returnToPool(); reply = null; } //@KBA - } //@KBA - serverCommitMode_ = currentCommitMode_; //@KBA - } - } - } - - - - // @C5D void setNewAutoCommitSupport(boolean newAutoCommitSupport) // @C5A - // @C5D throws SQLException // @C5A - // @C5D { // @C5A - // @C5D newAutoCommitSupport_ = newAutoCommitSupport; // @C5A - // @C5D // @C5A - // @C5D if (newAutoCommitSupport) // @C5A - // @C5D setAutoCommit (true); // @C5A - // @C5D // The default - but we have to send it now // @C5A - // @C5D // so that the system nows we want to use // @C5A - // @C5D // the new support. // @C5A - // @C5D } // @C5A - - - -/** -Take note that a statement has been executed. -**/ - void statementExecuted () - { - if (localTransaction_) // @C4A - activeLocal_ = ! autoCommit_; - else // @C4A - activeGlobal_ = true; // @C4A - } - - - //@KBA - /** - Returns the isolation/commit level to send to the system. - **/ - private int getIsolationLevel() - { - int isolationLevel = currentCommitMode_; - //Server commit mode level is different than clients so map client commit level to appropriate server commit level - if(isolationLevel == COMMIT_MODE_CHG_) - isolationLevel = COMMIT_SERVER_MODE_CHG_; - else if(isolationLevel == COMMIT_MODE_CS_) - isolationLevel = COMMIT_SERVER_MODE_CS_; - - //if auto commit is on and user specified false for 'true autocommit property' or by default run under *NONE isolation level - if(autoCommit_ && connection_.newAutoCommitSupport_ == 1) - isolationLevel = COMMIT_MODE_NONE_; - - return isolationLevel; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDTypeInfoFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDTypeInfoFieldMap.java deleted file mode 100644 index 7ee311078..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDTypeInfoFieldMap.java +++ /dev/null @@ -1,72 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDTypeInfoFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - - - -class JDTypeInfoFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - private int lengthIndex_; - private int precisionIndex_; - private int scaleIndex_; - private int typeIndex_; - private JDProperties properties_; // @M0A - added JDProperties so we can get the decimal scale & precision - private int vrm_; // @M0A - added vrm so we can pass it to the newData method - private int ccsidIndex_; //@KKB added ccsid - - JDTypeInfoFieldMap(int typeIndex, int lengthIndex, int precisionIndex, - int scaleIndex, int ccsidIndex, int vrm, JDProperties properties) // @M0C - added vrm and properties //@KKB - { - typeIndex_ = typeIndex; - lengthIndex_ = lengthIndex; - precisionIndex_ = precisionIndex; - scaleIndex_ = scaleIndex; - properties_ = properties; // @M0A - vrm_ = vrm; // @M0A - ccsidIndex_ = ccsidIndex; //@KKB - } - - public Object getValue(JDRow row) - throws SQLException - { - String typeName = row.getSQLData(typeIndex_).getString().trim(); - int length = row.getSQLData(lengthIndex_).getInt(); - int precision = row.getSQLData(precisionIndex_).getInt(); - int scale = row.getSQLData(scaleIndex_).getInt(); - int ccsid = 0; //@KKB - if(ccsidIndex_ != 0) //@KKB - ccsid = row.getSQLData(ccsidIndex_).getInt(); //@KKB - return SQLDataFactory.newData(typeName, length, precision, scale, ccsid, null, vrm_, properties_); // @M0C - added vrm and properties //@KKB - } - - /** - Indicates if the value was a data mapping error. - **/ - public boolean isDataMappingError(JDRow row) - throws SQLException - { - return false; - } - - public boolean isNull(JDRow row) - throws SQLException - { - return false; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JDUpdateDeleteRuleFieldMap.java b/cvsroot/src/com/ibm/as400/access/JDUpdateDeleteRuleFieldMap.java deleted file mode 100644 index 20e56ad59..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDUpdateDeleteRuleFieldMap.java +++ /dev/null @@ -1,95 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDUpdateDeleteRuleFieldMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; -import java.sql.DatabaseMetaData; - -/** - The JDUpdateDeleteRuleFieldMap class converts - the update and delete rule values - received from the system to the values - required by JDBC. -**/ - -//-------------------------------------------------// -// The system returns the following: -// 0 = cascade -// 1 = No action or restrict -// 2 = set null or set default -// -// JDBC has 5 possible values: -// importedKeyNoAction -// importedKeyCascade -// importedKeySetNull -// importedKeySetDefault -// importedKeyRestrict -// -// Since the system groups together -// some of the values, all of the -// possible JDBC values can not be returned. -// -// For Update Rule, the only values -// supported by the system are -// no action and restrict. Since -// the value of 1 is returned for -// both no action and restrict, -// the value of importKeyRestrict -// will always be returned for the -// update rule. -// -// For Delete Rule -// the following will be returned. It is -// consistent with the ODBC implementation. -// if 0 from system = importedKeyCascade -// if 1 from system = importedKeyRestrict -// if 2 from system = importedKeySetNull -// -// -// importedKeyNoAction and importedKeySetDefault -// will not be returned. -//-------------------------------------------------// - -class JDUpdateDeleteRuleFieldMap -extends JDSimpleFieldMap -implements JDFieldMap -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - // fromIndex is the index of the data received from the system. - JDUpdateDeleteRuleFieldMap (int fromIndex) - { - super (fromIndex); - } - - /** - Returns the table type in JDBC format - **/ - public Object getValue (JDRow row) - throws SQLException - { - Object serverData = super.getValue (row); // gets data from correct column - // using fromIndex - - switch(((Number) serverData).intValue ()) - { - case 0: - return new Short ((short) DatabaseMetaData.importedKeyCascade); - case 1: - return new Short ((short) DatabaseMetaData.importedKeyRestrict); - default: - return new Short ((short) DatabaseMetaData.importedKeySetNull); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JDUtilities.java b/cvsroot/src/com/ibm/as400/access/JDUtilities.java deleted file mode 100644 index e8eb2dc2a..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDUtilities.java +++ /dev/null @@ -1,835 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDUtilities.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.*; // @J1c - - - -/** -The JDUtilities class provides utilities for use in the implementation -of the JDBC driver. -**/ -class JDUtilities -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - private static final byte escape = (byte)0x1B; // @D0A - - // @j4 the following two constants are now final - static final int vrm710 = AS400.generateVRM(7, 1, 0); // @710 //@128sch - static final int vrm610 = AS400.generateVRM(6, 1, 0); // @610 - static final int vrm540 = AS400.generateVRM(5, 4, 0); // @540 - static final int vrm530 = AS400.generateVRM(5, 3, 0); // @G0A - static final int vrm520 = AS400.generateVRM(5, 2, 0); // @J2a @J3a - static final int vrm510 = AS400.generateVRM(5, 1, 0); // @J31a - static final int vrm450 = AS400.generateVRM(4, 5, 0); // @G0A - static final int vrm440 = AS400.generateVRM(4, 4, 0); - static final int vrm430 = AS400.generateVRM(4, 3, 0); - - static int JDBCLevel_ = 10; // @J4a - static int JVMLevel_ = 120; //1.2.0 //@big - private final static Object bigDecimalLock_ = new Object(); //@big - - // @J4a - static - { - try - { - Class.forName("java.sql.Blob"); - JDBCLevel_ = 20; - - Class.forName("java.sql.Savepoint"); - JDBCLevel_ = 30; - - Class.forName("java.util.concurrent.Semaphore"); //@big - JVMLevel_ = 150; //jre 5.0 //@big - - Class.forName("java.sql.SQLXML"); //@big - JDBCLevel_ = 40; //@big - JVMLevel_ = 160; //jre 6.0 //@big - } - catch (Throwable e) { } - } - - - -// @D0A -/** -Decompresses data from one byte array to another. - -@param source The source (compressed) bytes. -@param sourceOffset The offset in the source bytes to start decompressing. -@param sourceLength The length (compressed) of the bytes to decompress. -@param destination The destination (uncompressed) bytes. It is assumed - that this byte array is already created. -@param destinationOffset The offset in the destination bytes. -**/ - static final void decompress (byte[] source, - int sourceOffset, - int sourceLength, - byte[] destination, - int destinationOffset) - { - int i = sourceOffset; // Index into source. - int j = destinationOffset; // Index into destination. - - int sourceEnd = sourceOffset + sourceLength; - while(i < sourceEnd) { - if (source[i] == escape) { - if (source[i+1] == escape) { - destination[j++] = escape; - i += 2; - } - else { - int repetitions = BinaryConverter.byteArrayToInt(source, i+2); - for(int k = 1; k <= repetitions; ++k) - destination[j++] = source[i+1]; - i += 6; - } - } - else - destination[j++] = source[i++]; - } - } - - -/** -Pads a numeric value on the left with zeros. This is a utility -for use in implementing various pieces of the JDBC driver. - -@param value The numeric value. -@param digits The number of digits. -@return The padded string. -**/ - static final String padZeros (int value, int digits) - { - String temp = "000000000" + Integer.toString (value); // @A1C - return temp.substring (temp.length () - digits); - } - - - //@DELIMa - /** - Returns the names of the libraries on the system. - This will return a ResultSet with a list of all the libraries. - - @param caller The calling object. - @param connection The connection to the database. - @param setting The conversion settings (optional). - @param libraryListOnly If true, returns only the libraries on the library list. - Otherwise returns all libraries on the system. - @return A ResultSet containing the list of the libraries. - - @exception SQLException If the connection is not open - or an error occurs. - **/ - static final ResultSet getLibraries (Object caller, AS400JDBCConnection connection, SQLConversionSettings settings, boolean libraryListOnly) - throws SQLException - { - // Schema = library - connection.checkOpen (); - - JDRowCache rowCache = null; // Creates a set of rows that - // are readable one at a time - - if (settings == null) { - settings = new SQLConversionSettings (connection); - } - int id = connection.getID(); - DBReplyRequestedDS reply = null; - - try - { - // Create a request - //@P0C - DBReturnObjectInformationRequestDS request = null; - try - { - request = DBDSPool.getDBReturnObjectInformationRequestDS ( - DBReturnObjectInformationRequestDS.FUNCTIONID_RETRIEVE_LIBRARY_INFO, - id, DBBaseRequestDS.ORS_BITMAP_RETURN_DATA + - DBBaseRequestDS.ORS_BITMAP_DATA_FORMAT + - DBBaseRequestDS.ORS_BITMAP_RESULT_DATA, 0); - - - if (!libraryListOnly) // Return list of all libraries on the system - { - - request.setLibraryName("%", connection.converter_); - request.setLibraryNameSearchPatternIndicator(0xF1); - } - else - { - request.setLibraryName("*LIBL", connection.converter_); //@libl - request.setLibraryNameSearchPatternIndicator(0xF0); //@libl - } - - - // Set the Library Information to Return Bitmap - // Return only the library name - request.setLibraryReturnInfoBitmap(0x80000000); - - // Send the request and cache all results from the system - reply = connection.sendAndReceive(request); - - - // Check for errors - throw exception if errors were - // returned - int errorClass = reply.getErrorClass(); - if (errorClass !=0) - { - int returnCode = reply.getReturnCode(); - JDError.throwSQLException (caller, connection, id, errorClass, returnCode); - } - - // Get the data format and result data - DBDataFormat dataFormat = reply.getDataFormat(); - DBData resultData = reply.getResultData(); - - // Put the result data into a row cache - JDServerRow row = new JDServerRow (connection, id, dataFormat, settings); - - // Put the data format into a row format object - JDRowCache serverRowCache = new JDSimpleRowCache(new JDServerRowCache(row, connection, id, 1, resultData, true, ResultSet.TYPE_SCROLL_INSENSITIVE)); - boolean isJDBC3 = JDUtilities.JDBCLevel_ >= 30; //@F2A @j4a - - JDFieldMap[] maps = null; //@F2C - String[] fieldNames = null; //@F2C - SQLData[] sqlData = null; //@F2C - int[] fieldNullables = null; //@F2C - // Set up the result set in the format required by JDBC - if (!isJDBC3) - { - fieldNames = new String[] {"TABLE_SCHEM"}; - - sqlData = new SQLData[] {new SQLVarchar (128, settings)}; //schema name - - fieldNullables = new int[] {AS400JDBCDatabaseMetaData.columnNoNulls}; - maps = new JDFieldMap[1]; - } - else - { - fieldNames = new String[] {"TABLE_SCHEM", - "TABLE_CATALOG"}; //@G4A - - sqlData = new SQLData[] {new SQLVarchar (128, settings), //schema name - new SQLVarchar (128, settings)}; //table catalog //@G4A - - fieldNullables = new int[] {AS400JDBCDatabaseMetaData.columnNoNulls, - AS400JDBCDatabaseMetaData.columnNullable}; //@G4A - maps = new JDFieldMap[2]; //@G4C - } - - // Create the mapped row format that is returned in the - // result set. - // This does not actual move the data, it just sets up - // the mapping - maps[0] = new JDSimpleFieldMap (1); // table schema // @A3C @E4C - if (isJDBC3) //@F2A - { - maps[1] = new JDHardcodedFieldMap (connection.getCatalog ()); // table catalog //@G4A - } - - // Create the mapped row cache that is returned in the - // result set - JDMappedRow mappedRow = new JDMappedRow (fieldNames, sqlData, - fieldNullables, maps); - rowCache = new JDMappedRowCache (mappedRow, - serverRowCache); - } - finally - { - if (request != null) { request.returnToPool(); request = null; } - // Cannot close this reply. Pass to AS400JDBCResultSet to close - // if (reply != null) { reply.returnToPool(); reply = null; } - } - - } // End of try block - - catch (DBDataStreamException e) - { - JDError.throwSQLException (caller, JDError.EXC_INTERNAL, e); - } - - // Return the results - return new AS400JDBCResultSet (rowCache, - connection.getCatalog(), "Schemas", connection, reply); //@in2 - - } - - - /** - Strips outer double-quotes from name (if present). - **/ - static final String stripOuterDoubleQuotes(String name/*, boolean uppercase*/) - { - if(name.startsWith("\"") && name.endsWith("\"")) { - name = name.substring(1, name.length()-1); - } - return name; - } - - - /** - Prepares the name to be enclosed in double-quotes, for example for use as column-name values in an INSERT INTO statement. - 1. Strip outer double-quotes (if present). - 2. Double-up any embedded double-quotes. - **/ - static final String prepareForDoubleQuotes(String name) - { - // Strip outer double-quotes. - name = stripOuterDoubleQuotes(name); - - // Double-up any embedded double-quotes. - if(name.indexOf('\"') == -1) - { - return name; // name has no embedded double-quotes, so nothing more to do - } - else - { - StringBuffer buf = new StringBuffer(name); - for (int i=name.length()-1; i >= 0; i--) // examine char-by-char, from end - { - if(buf.charAt(i) == '\"') - { - buf.insert(i, '\"'); // double the embedded double-quote - } - } - return buf.toString(); - } - } - - - /** - Prepares the name to be enclosed in single-quotes, for example for use in the WHERE clause of a SELECT statement. - 1. Unless name is delimited by outer double-quotes, uppercase the name. - 2. Strip outer double-quotes (if present). - 3. Collapse any doubled embedded double-quotes, to single double-quotes. - 4. Double-up any embedded single-quotes. - **/ - static final String prepareForSingleQuotes(String name, boolean uppercase) - { - // 1. Unless name is delimited by outer double-quotes, uppercase the name. - if(name.startsWith("\"") && name.endsWith("\"")) - { - // 2. Strip outer double-quotes. - name = name.substring(1, name.length()-1); - } - else - { - // Don't uppercase if any embedded quotes. - if (uppercase && name.indexOf('\'') == -1) { - name = name.toUpperCase(); - } - } - - // 3. Collapse any doubled embedded double-quotes, to single double-quotes. - // 4. Double-up any embedded single-quotes. - if(name.indexOf('\"') == -1 && name.indexOf('\'') == -1) - { - return name; // name has no embedded double-quotes, so nothing more to do - } - else - { - StringBuffer buf = new StringBuffer(name); - for (int i=name.length()-1; i >= 0; i--) // examine char-by-char, from end - { - char thisChar = buf.charAt(i); - if(thisChar == '\"') - { - if(i>0 && buf.charAt(i-1) == '\"') - { - buf.deleteCharAt(i); - i--; // don't re-examine the prior double-quote - } - } - else if(thisChar == '\'') - { - buf.insert(i, '\''); // double the single-quote - } - } - return buf.toString(); - } - } - - - /** - Strips out beginning/ending matching double-quotes, and internal double - embedded double-quotes get collapsed to one double-quote. - 1. Strip outer double-quotes (if present). - 2. Collapse any doubled embedded double-quotes, to single double-quotes. - **/ - static final String stripOutDoubleEmbededQuotes(String name) - { - if(name.startsWith("\"") && name.endsWith("\"")) - { - // 1. Strip outer double-quotes. - name = name.substring(1, name.length()-1); - } - - // 2. Collapse any doubled embedded double-quotes, to single double-quotes. - if(name.indexOf('\"') == -1 ) - { - return name; // name has no embedded double-quotes, so nothing more to do - } - else - { - StringBuffer buf = new StringBuffer(name); - for (int i=name.length()-1; i >= 0; i--) // examine char-by-char, from end - { - char thisChar = buf.charAt(i); - if(thisChar == '\"') - { - if(i>0 && buf.charAt(i-1) == '\"') - { - buf.deleteCharAt(i); - i--; // don't re-examine the prior double-quote - } - } - } - return buf.toString(); - } - } - - - -/** -Reads a reader and returns its data as a String. - -@param input The reader. -@param length The length. -@return The string. - -@exception SQLException If the length is not valid or the - conversion is not possible. -**/ - static final String readerToString (Reader input, - int length) - throws SQLException - { - StringBuffer buffer = new StringBuffer (); - try { - char[] rawChars = new char[(length == 0) ? 1 : length]; - int actualLength = 0; - while (input.ready ()) { - int length2 = input.read (rawChars); - if (length2 < 0) - break; - //buffer.append (new String (rawChars, 0, length2)); //@pdd jdbc40 - buffer.append (rawChars, 0, length2); //@pda jdbc40 performance - actualLength += length2; - } - - // The spec says to throw an exception when the - // actual length does not match the specified length. - // I think this is strange since this means the length - // parameter is essentially not needed. I.e., we always - // read the exact number of bytes in the stream. - if (actualLength != length) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - } - catch (IOException e) { - JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - } - - return buffer.toString (); - } - - - //@pda jdbc40 new method for unknown length - /** - Reads a reader and returns its data as a String. - Reads until reader returns -1 for eof. - - @param input The reader. - @return The string. - - **/ - static final String readerToString (Reader input) - throws SQLException - { - StringBuffer buffer = new StringBuffer (); - try { - - char[] rawChars = new char[32000]; - int actualLength = 0; - while (input.ready ()) { - int length2 = input.read (rawChars); - if (length2 < 0) - break; - //buffer.append (new String (rawChars, 0, length2)); //@pdd jdbc40 - buffer.append (rawChars, 0, length2); //@pda jdbc40 performance - actualLength += length2; - } - - } - catch (IOException e) { - JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - } - - - return buffer.toString (); - } - - - - -//@j1 new method -/** -Runs a CL command via the database host server. It uses the QCMDEXC -stored procedure to run the command - -@param connection Connection to the system -@param command The CL command to run - -@exception SQLException If the command failed. -**/ - static final void runCommand(Connection connection, String command, boolean SQLNaming) - throws SQLException - { - Statement statement = null; //@scan1 - try - { - statement = connection.createStatement(); - - // We run commands via the QCMDEXC stored procedure. That procedure - // requires the length of the command be included with the command - // specified in precision 15, scale 5 format. That is, - // "CALL QSYS.QCMDEXC('command-to-run', 000000nnnn.00000)" - String commandLength = "0000000000" + command.length(); - commandLength = commandLength.substring(commandLength.length() - 10) + - ".00000"; - - String commandPreface; - - if (SQLNaming) - commandPreface = "CALL QSYS.QCMDEXC('"; - else - commandPreface = "CALL QSYS/QCMDEXC('"; - - String SQLCommand = commandPreface + command + "', " + commandLength + ")"; - - statement.executeUpdate(SQLCommand); - }finally //@scan1 - { - if(statement != null) - statement.close(); - } - - } - - - - - - -/** -Reads an input stream and returns its data as a byte array. - -@param input The input stream. -@param length The length. -@return The string. - -@exception SQLException If the length is not valid or the - conversion is not possible. -**/ - static final byte[] streamToBytes (InputStream input, - int length) - throws SQLException - { - byte[] buffer = new byte[length]; - try { - byte[] rawBytes = new byte[(length == 0) ? 1 : length]; - int actualLength = 0; - // - // Restructured logic to not use available .. - // @A5C - int length2 = input.read (rawBytes); /*@A5A*/ - - while (length2 >= 0 && actualLength < length ) { /*@A5C*/ - if (length2 > 0) { /*@A5A*/ - if (actualLength + length2 <= length) { - System.arraycopy (rawBytes, 0, buffer, actualLength, length2); - } else { - // copy part (if needed). - System.arraycopy (rawBytes, 0, buffer, actualLength, length - actualLength); - } - actualLength += length2; - } /*@A5A*/ - length2 = input.read (rawBytes); /*@A5A*/ - } - - - // The spec says to throw an exception when the - // actual length does not match the specified length. - // I think this is strange since this means the length - // parameter is essentially not needed. I.e., we always - // read the exact number of bytes in the stream. - //@KKC if (actualLength != length) - //@KKC JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - - //@KKC throw an exception if length is greater than the actual length - if(actualLength < length) //@KKC - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); //@KKC - } - catch (IOException e) { - JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - } - - return buffer; - } - - - - //@PDA jdbc40 - /** - Reads an input stream and returns its data as a byte array. - - @param input The input stream. - @return The string. - - @exception SQLException If the length is not valid or the - conversion is not possible. - **/ - static final byte[] streamToBytes (InputStream input) - throws SQLException - { - //@pda copy code from native since ByteBuffer is not available on ibm java - ByteArrayOutputStream outBuffer = new ByteArrayOutputStream(); - - - int blocksize = 4096; - byte[] buffer = new byte[blocksize]; - try { - int length2 = input.read (buffer); - - while (length2 >= 0) { - outBuffer.write(buffer, 0, length2); - length2 = input.read (buffer); - } - } catch (IOException e) { - JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - } - - return outBuffer.toByteArray(); - } - - - - - //@pda method from native - /** - Reads an input stream and returns its data as a String. - - @param input The input stream. - @param encoding The encoding. - @return The string. - - @exception SQLException If the length is not valid or the - conversion is not possible. - **/ - static String streamToString (InputStream input, - String encoding) - throws SQLException - { - byte[] rawBytes = streamToBytes(input); - - try { - return new String (rawBytes, 0, rawBytes.length, encoding); - } catch (IOException e) { - JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - return null; - } - } - -/** -Reads an input stream and returns its data as a String. - -@param input The input stream. -@param length The length. -@param encoding The encoding. -@return The string. - -@exception SQLException If the length is not valid or the - conversion is not possible. -**/ - static final String streamToString (InputStream input, - int length, - String encoding) - throws SQLException - { - StringBuffer buffer = new StringBuffer (); - try { - byte[] rawBytes = new byte[(length == 0) ? 1 : length]; - int actualLength = 0; - while (input.available () > 0) { - int length2 = input.read (rawBytes); - buffer.append (new String (rawBytes, 0, length2, encoding)); - actualLength += length2; - } - - // The spec says to throw an exception when the - // actual length does not match the specified length. - // I think this is strange since this means the length - // parameter is essentially not needed. I.e., we always - // read the exact number of bytes in the stream. - if (actualLength != length) - JDError.throwSQLException (JDError.EXC_BUFFER_LENGTH_INVALID); - } - catch (IOException e) { - JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - } - - return buffer.toString (); - } - - - //@DELIMa - /** - Uppercases the name if it's not enclosed in double-quotes. - **/ - static final String upperCaseIfNotQuoted(String name) - { - // 1. Unless name is delimited by outer double-quotes, uppercase the name. - if(name.startsWith("\"")) - return name; - else - return name.toUpperCase(); - } - - - //@big For 1.4 backlevel support of Decimal and Numeric types - /** - * bigDecimalToPlainString takes a big decimal and converts it into a plain string, without an - * exponent. This was the default behavior of toString before JDK 1.5. - * bigDecimalToPlainString was taken from Native driver for java 1.5 support and changed a bit for toolbox - * Coded so it will compile on java 1.4 also - */ - static java.lang.reflect.Method toPlainStringMethod = null; - static Object[] emptyArgs; - - public static String bigDecimalToPlainString(BigDecimal bigDecimal) { - if (JVMLevel_ >= 150) { - // We compile using JDK 1.4, so we have to get to the new method via - // reflection - - if (toPlainStringMethod == null) { - synchronized(bigDecimalLock_) { - if (toPlainStringMethod == null) { - try { - Class bigDecimalClass = Class.forName("java.math.BigDecimal"); - Class[] parameterTypes = new Class[0]; - toPlainStringMethod = bigDecimalClass.getMethod("toPlainString", parameterTypes); - emptyArgs = new Object[0]; - } catch (Exception e) { - if (JDTrace.isTraceOn ()) - { - JDTrace.logException(null, "Exception while calling BigDecimal.toPlainString.", e); - } - toPlainStringMethod = null; - - return bigDecimal.toString(); - } - } /* if */ - } /* synchronized */ - } /* toPlainStringMethod == null */ - String returnString; - try { - returnString = - (String) toPlainStringMethod.invoke((Object) bigDecimal, emptyArgs); - } catch (Exception e) { - if (JDTrace.isTraceOn ()) - { - JDTrace.logException(null, "Exception while calling BigDecimal.toPlainString.", e); - } - - returnString = bigDecimal.toString(); - } - - return returnString; - - } else { /* not JDK15 */ - - return bigDecimal.toString(); - } - } - - - //@xml3 - //removes declaration (header) - //returns input string if there is no xml declaration - //@xmlNat changed to be same as native driver - static final String stripXMLDeclaration(String s) throws SQLException - { - int i = 0; - int len = s.length(); - while (i < len && ( s.charAt(i) == '\ufeff' || Character.isWhitespace(s.charAt(i)))) { - i++; - } - if ((i+1)') { - return s.substring(i + 2); - } - - } - return s; - - } - - //@xmlutf8 - static final boolean hasXMLDeclaration(String xml) - { - if(xml.length() < 6) //@BE1 - return false; //@BE1 - if(xml.substring(0, 7).indexOf("") ; - int encStart = xml.indexOf("encoding="); - if(end != -1 && encStart != -1) - { - int encEnd = xml.indexOf(" ",encStart); - if(encEnd == -1 || encEnd > end) - encEnd = end; //end of declaration with no space after encoding - - return xml.substring(0, encStart) + xml.substring(encEnd); - } - } - return xml; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/JDWriterProxy.java b/cvsroot/src/com/ibm/as400/access/JDWriterProxy.java deleted file mode 100644 index 5e56f6488..000000000 --- a/cvsroot/src/com/ibm/as400/access/JDWriterProxy.java +++ /dev/null @@ -1,137 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JDWriterProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Writer; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - - - -// JDBC 2.0 -class JDWriterProxy -extends Writer -implements ProxyFactoryImpl -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - - // Private data. - - private long pxId_; - private ProxyClientConnection connection_; - - - public void close () - throws IOException - { - try { - connection_.callMethod (pxId_, "close"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - - protected void finalize() throws Throwable - { - connection_.callFinalize (pxId_); - super.finalize(); - } - - - // Implementation of ProxyFactoryImpl interface. - // This method gets called by ProxyClientConnection.callFactoryMethod(). - public void initialize (long proxyId, ProxyClientConnection connection) - { - pxId_ = proxyId; - connection_ = connection; - } - - - public void write (int c) - { - try { - connection_.callMethod (pxId_, "write", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (c) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - public void write (String str) - { - try { - connection_.callMethod (pxId_, "write", - new Class[] { String.class }, - new Object[] { str }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - public void write (char[] cbuff) - { - try { - connection_.callMethod (pxId_, "write", - new Class[] { char[].class }, - new Object[] { cbuff }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - public void write (char[] cbuff, int off, int len) - { - try { - connection_.callMethod (pxId_, "write", - new Class[] { char[].class, Integer.TYPE, Integer.TYPE }, - new Object[] { cbuff, new Integer(off), new Integer(len) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - public void write (String str, int off, int len) - { - try { - connection_.callMethod (pxId_, "write", - new Class[] { String.class, Integer.TYPE, Integer.TYPE }, - new Object[] { str, new Integer(off), new Integer(len) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow (e); - } - } - - - public void flush () - throws IOException - { - try { - connection_.callMethod (pxId_, "flush"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow1 (e); - } - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/JPingDS.java b/cvsroot/src/com/ibm/as400/access/JPingDS.java deleted file mode 100644 index 46a8efbc0..000000000 --- a/cvsroot/src/com/ibm/as400/access/JPingDS.java +++ /dev/null @@ -1,48 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: JPingDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The JPingDS is the datastream sent to the AS/400 server - * during a ping to determine if the server is running. - * - **/ -class JPingDS extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - /** - * Constructs a JPingDS object. - * - * @param serverId The AS/400 service. - * @param buffer The datastream. - * @param i The request correlation for this datastream. - * - **/ - JPingDS(int serverId, byte[] buffer) - { - super(); - // Add 20, which is the datastream header size, to the buffer length. - data_ = new byte[buffer.length + 20]; - setLength(buffer.length + 20); - setHeaderID(0); - setServerID(serverId); - setCSInstance(0xFFFFFFFF); //The CS ID of the Ping datastream (no particular reason for having 0xffffffff). - //setCorrelation(i); - setTemplateLen(buffer.length); - setReqRepID(0x7FFF); //The ID of the Ping datastream (no particular reason for having 0x7fff). - - System.arraycopy(buffer, 0, data_, 20, buffer.length); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JPingEchoDS.java b/cvsroot/src/com/ibm/as400/access/JPingEchoDS.java deleted file mode 100644 index eb65fb302..000000000 --- a/cvsroot/src/com/ibm/as400/access/JPingEchoDS.java +++ /dev/null @@ -1,47 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: JPingEchoDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The JPingEchoDS is the datastream sent to the server - * and the server sends back a reply. - * - **/ -class JPingEchoDS extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - /** - * Constructs a JPingEchoDS object. - * - * @param serverId The AS/400 service. - * @param buffer The datastream. - * @param i The request correlation for this datastream. - * - **/ - JPingEchoDS(int serverId, byte[] buffer) - { - super(); - data_ = new byte[buffer.length + 20]; - setLength(buffer.length + 20); - setHeaderID(0); - setServerID(serverId); - setCSInstance(0xEEEEEEEE); // The CS ID of the Ping Echo datastream (no particular reason for having 0xEEEEEEEE). - //setCorrelation(i); - setTemplateLen(buffer.length); - setReqRepID(0x7FFE); // The ID of the Ping Echo datastream (no particular reason for having 0x7FFE). - - System.arraycopy(buffer, 0, data_, 20, buffer.length); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JPingEchoReplyDS.java b/cvsroot/src/com/ibm/as400/access/JPingEchoReplyDS.java deleted file mode 100644 index 3a0c47fdd..000000000 --- a/cvsroot/src/com/ibm/as400/access/JPingEchoReplyDS.java +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: JPingEchoReplyDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.IOException; - -/** - * The JPingEchoReplyDS is the reply datastream for a ping - * which involves the server echoing back the datastream sent. - * - **/ -class JPingEchoReplyDS extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - /** - * Constructs a JPingEchoReplyDS object. - * - * @param length The length of the datastream. - * - **/ - JPingEchoReplyDS(int length) - { - super(); - data_ = new byte[length + 20]; - } - - int read(InputStream in) throws IOException - { - // Receive the header. - byte[] header = new byte[20]; - if (readFromStream(in, header, 0, 20) < 20) - { - Trace.log(Trace.ERROR, "Failed to read all of the Retrieve Signon Information Reply header."); - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - - // Allocate bytes for datastream - data_ = new byte[BinaryConverter.byteArrayToInt(header, 0)]; - System.arraycopy(header, 0, data_, 0, 20); - - // read in the rest of the data - return readAfterHeader(in); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JavaApplicationCall.java b/cvsroot/src/com/ibm/as400/access/JavaApplicationCall.java deleted file mode 100644 index 7f5df6ad5..000000000 --- a/cvsroot/src/com/ibm/as400/access/JavaApplicationCall.java +++ /dev/null @@ -1,1680 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JavaApplicationCall.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.net.ServerSocket; -import java.net.Socket; -import java.net.UnknownHostException; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.Serializable; -import java.util.Enumeration; -import java.util.Properties; -import java.util.StringTokenizer; -import java.util.Vector; - -/** - *

    - * Provides an easy way to run Java - * applications on the IBM i system's Java Virtual Machine from a client. - * The client Java program specifies the environment, the program to run, - * and the program parameters. The program then runs on the IBM i system's - * Java Virtual Machine. Text-based input/output is provided by - * JavaApplicationCall. Input can be sent to the Java program which - * will receive the input via standard input (stdin). - * Standard output (stdout) and - * standard error (stderr) text generated by the Java program are received - * by JavaApplicationCall and made available to the calling program. - * JavaApplicationCall does not support displaying the graphical user - * interface of the IBM i system's Java program on the client. Other Java - * facilities, such as remote AWT must be used to display graphical - * interfaces on the client. - * - *

    - * Sockets are used to send stdin, stdout and stderr between - * client and IBM i system. The port used can be set via setPort(). The - * default port sequence is 2850, 2851 and 2852. If the port is in use, - * this class searches for available ports if findPort is true. - * stdin, stdout and stderr are not transported - * across a secure connection even when the rest of the Toolbox - * is using SSL. - * - *

    - * Note: The presence of a firewall, in either direction between the IBM i system - * and the client, may prevent JavaApplicationCall from - * opening the necessary additional ports (for stdin, stdout, and stderr). - * The administrator may need to authenticate the application through - * the firewall in both directions: - * From client to IBM i system; and from IBM i system to client. - * - *

    - * For example, suppose the Java class HelloWorld resides in directory - * /javatest on the system. The following calls this program and - * receives program output written to stdout and stderr. - * - * - *

    - * import com.ibm.as400.access.*;
    - *
    - * public class test implements Runnable
    - * {
    - *    JavaApplicationCall jaCall;
    - *
    - *    public static void main(String[] args)
    - *    {
    - *       test me = new test();
    - *       me.Main(args);
    - *    }
    - *
    - *
    - *    void Main(String[] args)
    - *    {
    - *
    - *       try
    - *       {
    - *           // The IBM i system where the Java program to run, is located.
    - *           AS400 as400 = new AS400();
    - *
    - *           // Construct a JavaApplicationCall object.
    - *           jaCall = new JavaApplicationCall(as400);
    - *
    - *           // Set the name of the Java application to be run.
    - *           jaCall.setJavaApplication("HelloWorld");
    - *
    - *           // Set the classpath environment variable used by the IBM i system's
    - *           // JVM so it can find the class to run.
    - *           jaCall.setClassPath("/javatest");
    - *
    - *           // Start the thread that will receive stdout
    - *           Thread outputThread = new Thread(this);
    - *           outputThread.start();
    - *
    - *           // Start the program.  The call to run() will not return
    - *           // until the IBM i system Java program completes.  If the Toolbox
    - *           // cannot start the Java program, false is returned with
    - *           // a list of AS400Message objects indicating why the program
    - *           // could not start.
    - *           if (jaCall.run() != true)
    - *           {
    - *                AS400Message[] messageList = jaCall.getMessageList();
    - *                for (int msg = 0; msg < messageList.length; msg++)
    - *                    System.out.println(messageList[msg].toString());
    - *           }
    - *       }
    - *       catch (Exception e) { e.printStackTrace(); }
    - *
    - *       System.exit(0);
    - *    }
    - *
    - *    // This thread will get the output from the IBM i system Java program,
    - *    // and print it.  Note the call to sleep().
    - *    // The getXxxString() methods return immediately even if there is no data.
    - *    public void run()
    - *    {
    - *        while (true)
    - *        {
    - *           String stdOut = jaCall.getStandardOutString();
    - *           if (stdOut != null)
    - *             System.out.println(stdOut);
    - *
    - *           String stdErr = jaCall.getStandardErrorString();
    - *           if (stdErr != null)
    - *             System.out.println(stdErr);
    - *
    - *           try { Thread.sleep(100); } catch (Exception e) {}
    - *        }
    - *    }
    - * }
    - *
    - *
    - * 
    - * -**/ - -public class JavaApplicationCall implements Serializable -{ - static final long serialVersionUID = 4L; - - // The variables represent the default stdin, stdout, and stderr port. - private static int DEFAULT_STANDARD_ERROR_PORT = 2852; - private static int DEFAULT_STANDARD_IN_PORT = 2850; - private static int DEFAULT_STANDARD_OUT_PORT = 2851; - private static int PORT_SEARCH_TIMES = 1000; - - private AS400 as400_ = null; - private CommandCall command_ = null; - private AS400Message[] messageList_ = null; - - // lists of listeners and event catchers - private transient PropertyChangeSupport propertyChange_ = new PropertyChangeSupport(this); - private transient VetoableChangeSupport vetoableChange_ = new VetoableChangeSupport(this); - private transient Vector completedListeners_ = new Vector(); - - private transient JavaApplicationCallThread openSocketsThread_ = null; - - // The variables represent connections built in the subsidiary threads. - private transient ServerSocket error_ = null; - private transient ServerSocket read_ = null; - private transient ServerSocket write_ = null; - - // The variables represent the properties of JavaApplicationCall. - private String classPath_ = ""; - private int defaultPort_ = DEFAULT_STANDARD_IN_PORT; - private boolean findPort_ = true; - private int garbageCollectionInitialSize_ = 2048; - private String garbageCollectionMaximumSize_ = "*NOMAX"; - private int garbageCollectionFrequency_ = 50; - private int garbageCollectionPriority_ = 20; - private String interpret_ = "*OPTIMIZE"; - private String jobname_ = "QJVACMDSRV"; // @F0A - private String javaApplication_ = null; - private String optimization_ = "10"; - private String[] options_ = {"*NONE"}; - private String[] parameters_ = {}; - private Properties properties_ = null; - private String securityCheckLevel_ = "*WARN"; - private int standardErrorPort_ = DEFAULT_STANDARD_ERROR_PORT; - private int standardInPort_ = DEFAULT_STANDARD_IN_PORT; - private int standardOutPort_ = DEFAULT_STANDARD_OUT_PORT; - - - /** - * Constructs a JavaApplicationCall object. - **/ - public JavaApplicationCall() - { - } - - - - /** - * Constructs a JavaApplicationCall object. The Java program - * is on an IBM i system. - * - * @param system The system on which contains the Java program. - **/ - public JavaApplicationCall(AS400 system) - { - if (system == null) - throw new NullPointerException("system"); - - as400_ = system; - } - - - - /** - * Constructs a JavaApplicationCall object. The Java program is namee - * application and runs on system system. - * - * @param system The system on which contains the Java program. - * @param application The name of Java program. - **/ - public JavaApplicationCall(AS400 system, String application) - { - this(system); - - if (application == null) - throw new NullPointerException("application"); - - javaApplication_ = application; - } - - - - /** - * Constructs a JavaApplicationCall object. The Java program is named - * application and runs on system system. - * classPath is passed to the system as the value of the - * CLASSPATH environment variable. - * - * @param system The system on which contains the Java program. - * @param application The name of Java program. - * @param classPath The value of the environment variable CLASSPATH. - **/ - public JavaApplicationCall(AS400 system, String application, String classPath) - { - this(system, application); - - if (classPath == null) - throw new NullPointerException("classPath"); - - this.classPath_ = classPath; - } - - - - /** - * Adds an ActionCompletedListener to be notified when the Java application ends. - * The specified ActionCompletedListeners actionCompleted method will - * be called each time an application runs. - * - * @see #removeActionCompletedListener - * @param listener The ActionCompletedListener. - */ - public void addActionCompletedListener(ActionCompletedListener listener) - { - if (listener != null) - completedListeners_.addElement(listener); - else - throw new NullPointerException("addActionCompletedListener"); - } - - - - /** - * Adds a listener to be notified when the value of any bound property - * changes. - * - * @see #removePropertyChangeListener - * @param listener The listener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener ) - { - if (listener != null) - propertyChange_.addPropertyChangeListener(listener); - else - throw new NullPointerException("addPropertyChangeListener"); - } - - - - /** - * Adds a listener to be notified when the value of any constrained - * property changes. - * - * @see #removeVetoableChangeListener - * @param listener The listener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener ) - { - if (listener != null) - vetoableChange_.addVetoableChangeListener(listener); - else - throw new NullPointerException("addVetoableChangeListener"); - } - - - - /** - * Returns the value of the CLASSPATH environment variable when running - * the Java program. Use the forward slash to separate path elements - * and a colon to separate the elements of CLASSPATH. For example, - * /dir1:/dir1/dir2/myClasses.jar. - *

    Valid values are: - *

      - *
    • *ENVVAR No setting is sent from the client to the IBM i system so the - * IBM i system's default value of CLASSPATH is used. - *
    • string The value that is set before the program is run. - *
    - * - * @return The value of CLASSPATH. - **/ - public String getClassPath() - { - return classPath_; - } - - - - /** - Returns the CommandCall object that was used in the most recent invocation of {@link #run() run()}. - @return The CommandCall object; null if run() has not been called. - **/ - public CommandCall getCommandCall() - { - return command_; - } - - - - - /** - * Returns the default port used to transfer stdin, stdout, - * and stderr between the client and the IBM i system. Three - * ports are used. The port returned by this method is used for - * stdin; (port + 1) is used for stdout; and (port + 2) - * is used for stderr. If not otherwise specified, the default port is 2850. - * - * @return The default port. - **/ - public int getDefaultPort() - { - return defaultPort_; - } - - - - - /** - Gets stdin, stdout and stderr port. - Also creates serversockets for stdin, stdout and stderr. - **/ - private void getFreePort() - { - read_ = null; - write_ = null; - error_ = null; - - if (!isFindPort()) - { - standardInPort_ = defaultPort_; - standardOutPort_ = defaultPort_ + 1; - standardErrorPort_ = defaultPort_ + 2; - try - { - read_ = new ServerSocket(standardInPort_); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, e.toString(), e); - } - try - { - write_ = new ServerSocket(standardOutPort_); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, e.toString(), e); - } - try - { - error_ = new ServerSocket(standardErrorPort_); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, e.toString(), e); - } - } - else - { - standardInPort_ = searchPort(defaultPort_ , DEFAULT_STANDARD_IN_PORT); - standardOutPort_ = searchPort(standardInPort_+1, DEFAULT_STANDARD_OUT_PORT); - standardErrorPort_ = searchPort(standardOutPort_+1, DEFAULT_STANDARD_ERROR_PORT); - } - - if (read_ == null || write_ == null || error_ == null) - { - try - { - if (read_ != null) read_.close(); - read_ = null; - } - catch(Exception e){} - try - { - if (write_ != null) write_.close(); - write_ = null; - } - catch(Exception e){} - try - { - if (error_ != null) error_.close(); - error_ = null; - } - catch(Exception e){} - - String msg = "Setup of connection with IBM i system failed."; - Trace.log(Trace.ERROR, msg); - throw new RuntimeException(msg); - } - } - - /** - * Returns the relative frequency that garbage collection runs. This - * value applies only to OS/400 V4R2 and V4R3. It is - * ignored in V4R4 and later versions. - * - * @return The relative frequency. - **/ - public int getGarbageCollectionFrequency() - { - return garbageCollectionFrequency_; - } - - - - /** - * Returns the initial size, in kilobytes, of the garbage collection heap. - * A large size can keep the garbage collector from starting when - * the Java program is small, improving performance. - * - *

    Possible values are: - *

      - *
    • 2048 The default initial size is 2048 kilobytes. - * - *
    • heapSize The initial value of the garbage collection heap in - * kilobytes. We recommend the initial heap size be - * 2048 kilobytes (the default) or larger. - *
    - * @return The initial size of the garbage collection heap. - **/ - public int getGarbageCollectionInitialSize() - { - return garbageCollectionInitialSize_; - } - - - - - /** - * Returns the maximum size, in kilobytes, that the garbage - * collection heap can grow to. This value is used to - * prevent runaway programs from consuming all available - * storage. - * - *

    Possible values are: - *

      - *
    • *NOMAX The default maximum size is not specified by the user. The - * maximum is determined by the system. The heap will grow until - * all system resources are depleted. Then a synchronous garbage - * collection is started to reclaim resources no longer in use. - * - *
    • heapSize The value in kilobytes that the garbage collection - * heap can grow to. - *
    - * @return The maximum size that the garbage collection heap can grow to. - **/ - public String getGarbageCollectionMaximumSize() - { - return garbageCollectionMaximumSize_; - } - - - - /** - * Returns the priority of the tasks running garbage collection. This - * value applies only to OS/400 V4R2 and V4R3. It is - * ignored in V4R4 and later versions. - * - * @return The priority of the tasks. - **/ - public int getGarbageCollectionPriority() - { - return garbageCollectionPriority_; - } - - - - - - /** - * Returns whether all Java class files should be run interpretively. - * - *

    Possible values are: - *

      - *
    • *OPTIMIZE Whether all Java classes are run interpretively depends on the - * value of the optimize property. If optimize is - * *INTERPRET, all Java classes will be run - * interpretively. If any other value was specified for - * optimize, only Java classes with Java programs created - * using CRTJVAPGM command and specifying OPTIMIZE(*INTERPRET) will - * be run interpretively. - * - *
    • *NO Only Java classes with Java programs created using CRTJVAPGM - * command and specifying OPTIMIZE(*INTERPRET) will be run - * interpretively. Java classes that need a Java program created - * will be created with the optimization level specified in the - * optimize property. - * - *
    • *YES All Java classes will be run interpretively regardless of the - * OPTIMIZE value associated Java program. Java classes that need - * a Java program created will use the optimization level specified - * in the optimize property. - *
    - * - * @return Whether all Java class files should be run interpretively. - **/ - public String getInterpret() - { - return interpret_; - } - - - - /** - * Returns the name of Java application to be run. - * If the Java application is not be set, null is returned. - * - * @return The name of Java application. - **/ - public String getJavaApplication() - { - return javaApplication_; - } - - - - /** - * Returns the name that this job will run under. - * The maximum length returned is 10 characters. - * - *

    Possible values are: - *

      - *
    • QJVACMDSRV - The default job name. - * - *
    • *GEN - The job name will be generated from the class name. - * - *
    • string - Any generic string value. - *
    - * - * @return The value of the job name. - * @since i5/OS V5R3M0 - **/ - public String getJobName() // @F0A - { - return jobname_; - } - - - - /** - *Returns the list of IBM i system messages generated if the Java program - *cannot be started. Before run() is called and if the Java program - *can be started, an empty list is returned. - * - *@return The array of AS400Message objects. - */ - public AS400Message[] getMessageList() - { - return messageList_; - } - - - - /** - * Returns the optimization level of IBM i system Java programs that - * will be created if no Java program is associated with the Java - * class. - * - * *INTERPRET means the resulting Java program interprets the - * class byte codes when invoked. For other optimization levels, the - * Java program contains machine instruction sequences that are run - * when the Java program is invoked. - * - * *INTERPRET Java programs are smaller but run slower than - * Java programs created with higher optimization levels. As you - * increase the optimization level beyond 10, the Java program - * performance generally improves, but the time required to create the - * Java program increases, and debugging is more difficult. - * - *

    Possible values are: - *

      - *
    • 10 The Java program contains a compiled version of the class file - * byte codes and has only minimal additional compiler - * optimization. Variables can be displayed and modified while - * debugging. - * - *
    • *INTERPRET The Java program created does not contain machine specific - * instructions. It will be interpreted when the program is - * started. Variables can be displayed and modified while - * debugging. - * - * If the INTERPRET property has a value of *OPTIMIZE, all of the - * classes that run will be run interpreted even if there is an - * optimized Java program associated with the class. - * - *
    • 20 The Java program contains a compiled version of the class file - * byte codes and has some additional compiler optimization. - * Variables can be displayed but not modified while debugging. - * - *
    • 30 The Java program contains a compiled version of the class file - * byte codes and has more compiler optimization than optimization - * level 20. During a debug session, user variables cannot be - * changed, but can be displayed. The presented values may not be - * the current values of the variables. - * - *
    • 40 The Java program contains a compiled version of the class file - * byte codes and has more compiler optimization than optimization - * level 30. All call and instruction tracing is disabled. - *
    - * @return The optimization level of the IBM i system Java application. - **/ - public String getOptimization() - { - return optimization_; - } - - /** - * Returns a list of special options used when running the Java class. - * - *

    The possible values are: - *

      - *
    • *NONE No special options are used when running the Java class. - * - *
    • *VERBOSE A message is displayed each time a class file is loaded. - * - *
    • *DEBUG Allows the system debugger to be used for this Java program. - * - *
    • *VERBOSEGC A message is displayed for each garbage collection sweep. - * - *
    • *NOCLASSGC Unused classes are not reclaimed when garbage collection is run. - *
    - * - * @return The options used when running the Java class. - **/ - public String[] getOptions() - { - return options_; - } - - - /** - * Returns parameter values that are passed to the Java - * application. A maximum of 200 parameter values can be passed. - * - * @return The parameters when running the Java application. - **/ - public String[] getParameters() - { - return parameters_; - } - - /** - * Returns the properties set on the IBM i system's JVM before running - * the Java program. - * - * @return The properties. - **/ - public Properties getProperties() - { - return properties_; - } - - /** - * Returns the level of warnings given for directories in the - * CLASSPATH that have public write authority. A directory in the - * CLASSPATH that has public write authority is a security exposure - * because it may contain a class file with the same name as the one - * you want to run. Whichever class file is found first is run. - * - *

    The possible values are: - *

      - *
    • *WARN Warning message is sent for each directory in the CLASSPATH - * that has public write authority. - * - *
    • *SECURE A warning message is sent for each directory in the CLASSPATH - * that has public write authority. If one or more warning - * messages are sent, an escape message is sent and the Java - * program is not run. - * - *
    • *IGNORE Ignore the fact that directories in the CLASSPATH may have - * public write authority. No warnings messages are sent. - *
    - * @return The level of warnings given for directories in the - * CLASSPATH that have public write authority. - **/ - public String getSecurityCheckLevel() - { - return securityCheckLevel_; - } - - /** - * Returns the stderr port. - * If not changed, the default port 2852 is returned. - * - * @return The stderr port. - **/ - private int getStandardErrorPort() - { - return standardErrorPort_; - } - - /** - * Returns the next string written to stderr by the program - * running on the system. - * - * @return the next stderr string from the system. - **/ - public String getStandardErrorString() - { - if (openSocketsThread_ != null) - return openSocketsThread_.getStandardErrorString(); - else - return null; - } - - /** - * Returns the stdin port. - * If not set, the default port 2850 is returned. - * - * @return The stdin port. - **/ - private int getStandardInPort() - { - return standardInPort_; - } - - /** - * Returns the stdout port. - * If not set, the default port 2851 is returned. - * - * @return The stdout port. - **/ - private int getStandardOutPort() - { - return standardOutPort_; - } - - /** - * Returns the next string written to stdout by the application. - * - * @return the string written to stdout. - **/ - public String getStandardOutString() - { - if (openSocketsThread_ != null) - return openSocketsThread_.getStandardOutString(); - else - return null; - } - - /** - Returns the system which contains the Java program. - - @return The system. - **/ - public AS400 getSystem() - { - return as400_; - } - - /** - Indicates if this class should search for a free port. - - @return true if this class will search for a free port; false otherwise. - The default value is true. - **/ - public boolean isFindPort() - { - return findPort_; - } - - /** - Deserializes and initializes the transient data. - **/ - private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - - propertyChange_ = new PropertyChangeSupport(this); - vetoableChange_ = new VetoableChangeSupport(this); - completedListeners_ = new Vector(); - openSocketsThread_ = null; - read_ = null; - write_ = null; - error_ = null; - } - - /** - * Removes this ActionCompletedListener from the list of listeners. - * If the ActionCompletedListener is not on the list, nothing is done. - * - * @see #addActionCompletedListener - * @param listener The ActionCompletedListener. - */ - public synchronized void removeActionCompletedListener(ActionCompletedListener listener) - { - if (listener != null) - completedListeners_.removeElement(listener); - else - throw new NullPointerException("removeActionCompletedListener"); - } - - /** - * Removes a property change listener from the list of listeners. - * - * @see #addPropertyChangeListener - * @param listener The listener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener ) - { - if (listener != null) - propertyChange_.removePropertyChangeListener(listener); - else - throw new NullPointerException("removePropertyChangeListener"); - } - - /** - * Removes a vetoable change listener from the list of listeners. - * - * @see #addVetoableChangeListener - * @param listener The listener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener ) - { - if (listener != null) - vetoableChange_.removeVetoableChangeListener(listener ); - else - throw new NullPointerException("removeVetoableChangeListener"); - } - - /** - Run the Java application. Control will not be returned to the - calling application until the program completes. If the program - does not start, a list of AS400Message object containing information - about is failure is available. - - @return true if the program can be started, false otherwise. - - @exception AS400SecurityException If a security or authority error occurs. - @exception ConnectionDroppedException If the connection is dropped unexpectedly. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ServerStartupException If the host server cannot be started. - @exception UnknownHostException If the system cannot be located. - - **/ - public boolean run() throws AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException - { - if (getSystem() == null) - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - - if (getJavaApplication() == null) - throw new ExtendedIllegalStateException("javaApplication", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - - // force signon so sign-on dialog up before - // we create more threads. - getSystem().getVRM(); // @D1A - - getFreePort(); - openSocketsThread_ = new JavaApplicationCallThread(read_, write_, error_); - openSocketsThread_.start(); - - command_ = new CommandCall(getSystem()); - command_.suggestThreadsafe(false); // JAVA cmd isn't threadsafe. @A1A - - // Construct commandstring - // 1. CLASS - // 2. PARM - // 3. CLASSPATH - // 4. CHKPATH - // 5. OPTIMIZE - // 6. INTERPRET - // 7. PROP - // 8. GCHINL - // 9. GCHMAX - // 10. GCFRQ - // 11. GCPTY - // 12. OPTION - - // 1.CLASS - StringBuffer commandString = new StringBuffer("JAVA CLASS(" + getJavaApplication() + ") "); - // 2.PARM - String[] parm = getParameters(); - if (parm.length > 0) - { - commandString.append("PARM("); - for (int i = 0 ; i < parm.length; i++) { - commandString.append("'" + parm[i] + "' "); - } - // delete last space - commandString.delete(commandString.length()-1, commandString.length()); - commandString.append(") "); - } - // 3.CLASSPATH - if (getClassPath().length() > 0) - commandString.append("CLASSPATH('" + getClassPath() + "') "); - // 4.CHKPATH - commandString.append("CHKPATH(" + getSecurityCheckLevel() +") "); - // 5.OPTIMIZE - commandString.append("OPTIMIZE(" + getOptimization() + ") "); - // 6.INTERPRET - commandString.append("INTERPRET(" + getInterpret() + ") "); - // 7.PROP - - String localAddress = null; // @E1c - // @E1a - // Because of bugs in Java, cannot get the local // @E1a - // address until a socket (not a server socket) // @E1a - // is connected. // @E1a - try // @E1a - { // @E1a - Socket pmSocket = new Socket(getSystem().getSystemName(), 449); // @E1a - localAddress = pmSocket.getLocalAddress().getHostAddress(); // @E1a - pmSocket.close(); // @E1a - } // @E1a - catch (Exception e) { localAddress = null; } // @E1a - // @E1a - // if new method didn't work, try the old technique. // @E1a - if (localAddress == null) // @E1a - { - localAddress = "localhost"; - - try - { - localAddress = java.net.InetAddress.getLocalHost().getHostAddress(); - } - catch (java.net.UnknownHostException e) - { - Trace.log(Trace.ERROR , e.toString()); - } - } // @E1a - - commandString.append("PROP(" - +"(os400.stdin 'port:"+localAddress+":"+new Integer(getStandardInPort()).toString()+"') " - +"(os400.stdout 'port:"+localAddress+":"+new Integer(getStandardOutPort()).toString()+"') " - +"(os400.stderr 'port:"+localAddress+":"+new Integer(getStandardErrorPort()).toString()+"') "); - commandString.append("(os400.stdio.convert N)"); - - if (getProperties() != null) - { - Enumeration e = properties_.keys(); - //add all other properties here - while (e.hasMoreElements()) { - String key = (String) e.nextElement(); - String value = (String)properties_.get(key); - commandString.append(" (" + key + " " + value + ")"); - } - } - - commandString.append(") "); - // 8.GCHINL - commandString.append("GCHINL(" + getGarbageCollectionInitialSize() + ") "); - // 9.GCHMAX - commandString.append("GCHMAX(" + getGarbageCollectionMaximumSize() + ") "); - // 10.GCFRQ - commandString.append("GCFRQ(" + getGarbageCollectionFrequency() + ") "); - // 11.GCPTY - commandString.append("GCPTY(" + getGarbageCollectionPriority() + ") "); - // 12.OPTION - String[] opt = getOptions(); - if (opt.length > 0) - { - commandString.append("OPTION("); - for (int i = 0 ; i < opt.length; i++) { - commandString.append(opt[i] + " "); - } - // delete last space - commandString.delete(commandString.length()-1, commandString.length()); - commandString.append(") "); - } - // 13.JOB @F0A - if (as400_.getVRM() >= 0x00050300) // New in V5R3M0 @F0A - commandString.append("JOB(" + getJobName() +") "); // @F0A - //run the command - boolean success = false; - - // System.out.println(commandString); - - try - { - success = command_.run(commandString.toString()); - } - catch (PropertyVetoException e) {} - finally - { - openSocketsThread_.closeSockets(); - openSocketsThread_ = null; - parameters_ = new String[0]; - properties_ = null; - read_ = null; - write_ = null; - error_ = null; - } - - if (success) - { - // fire ActionCompletedEvent - Vector targets; - targets = (Vector) completedListeners_.clone(); - ActionCompletedEvent actionEvt = new ActionCompletedEvent(this); - - for (int i = 0; i < targets.size(); i++) - { - ActionCompletedListener target = (ActionCompletedListener)targets.elementAt(i); - target.actionCompleted(actionEvt); - } - } - - messageList_ = command_.getMessageList(); - - return success; - } - - - /** - Find a free port. If the port passed as a parameter is in use, try port+=3. - If that is busy keep trying for up to 1000 times. - If we cannot find a free port, return the original port. - **/ - private int searchPort(int port, int whichPort) - { - ServerSocket test = null; - int curport = port; - boolean found = false; - int times = 0; - - while (times <= PORT_SEARCH_TIMES) - { - try - { - test = new ServerSocket(curport); - } - catch (Exception e) - { - curport += 3; - times++; - continue; - } - found = true; - break; - } - if (found) - { - if (whichPort == DEFAULT_STANDARD_IN_PORT) - read_ = test; - else if (whichPort == DEFAULT_STANDARD_OUT_PORT) - write_ = test; - else - error_ = test; - } - else - curport = port; - - return curport; - } - - /** - Sends the stdin to the application running on the system. - - @param data The stdin to the system. - **/ - public void sendStandardInString(String data) - { - if (openSocketsThread_ != null) - openSocketsThread_.sendStandardInString(data); - } - - /** Sets the value of the CLASSPATH environment variable when running - * the Java program. Use the forward slash to separate path elements - * and a colon to separate the elements of CLASSPATH. For example, - * /dir1:/dir1/dir2/myClasses.jar. - *

    Valid values are: - *

      - *
    • *ENVVAR No setting is sent from the client to the IBM i system so the - * IBM i system's default value of CLASSPATH is used. - *
    • string The value that is set before the program is run. - *
    - * - * @param classPath The value of the classpath. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setClassPath(String classPath) throws PropertyVetoException - { - if (classPath != null) - { - String old = this.classPath_; - vetoableChange_.fireVetoableChange("classPath",old,classPath); - this.classPath_ = classPath; - propertyChange_.firePropertyChange("classPath",old,classPath); - } - else - throw new NullPointerException("classPath"); - } - - /** - Sets the default port. This is the port for stdin. - stdout is (port + 1) and stderr is (port + 2). {@link #setFindPort setFindPort()} - can be used to tell this class to search for a free port if these - ports are in use. - - @param port The default port. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setDefaultPort(int port) throws PropertyVetoException - { - if (port > 0) - { - Integer old = new Integer(this.defaultPort_); - vetoableChange_.fireVetoableChange("defaultPort", old, new Integer(port)); - this.defaultPort_ = port; - propertyChange_.firePropertyChange("defaultPort", old, new Integer(port)); - } - else - throw new IllegalArgumentException("defaultPort"); - } - - /** - Sets searching for a free port. - - @param search true to search for a port that is not in use; false to not search. - The default value is true. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setFindPort(boolean search) throws PropertyVetoException - { - Boolean old = new Boolean(findPort_); - vetoableChange_.fireVetoableChange("findPort",old,new Boolean(search)); - findPort_ = search; - propertyChange_.firePropertyChange("findPort",old,new Boolean(search)); - } - - /** - Sets the relative frequency that garbage collection runs. - - This parameter is valid only for OS/400 V4R2 and V4R3 versions. - It is ignored for V4R4 and later versions. - - @param frequency The relative frequency that garbage collection runs. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setGarbageCollectionFrequency(int frequency) throws PropertyVetoException - { - if ((frequency >= 0) && (frequency <= 100)) - { - int old = this.garbageCollectionFrequency_; - vetoableChange_.fireVetoableChange("garbageCollectionFrequency",new Integer(old),new Integer(frequency)); - this.garbageCollectionFrequency_ = frequency; - propertyChange_.firePropertyChange("garbageCollectionFrequency",new Integer(old),new Integer(frequency)); - } - else - throw new IllegalArgumentException("garbageCollectionFrequency"); - } - - /** - Sets the initial size, in kilobytes, of the garbage collection - heap. This is used to prevent garbage collection from starting on - small programs. - -

    The possible values are: -

      -
    • 2048 The default initial size is 2048 kilobytes. - -
    • heap-initial-size The initial value of the garbage collection heap, in - kilobytes. We recommend that the initial heap size be - set to 2048 kilobytes (the default) or larger. - -
    - - @param size The initial size of the garbage collection heap. - @exception PropertyVetoException If the change is vetoed. - **/ - - public void setGarbageCollectionInitialSize(int size) throws PropertyVetoException - { - if (size > 0) - { - if (Trace.traceOn_) - { - int sizeValue = -1; - boolean nomax = false; - try - { - sizeValue = Integer.parseInt(getGarbageCollectionMaximumSize()); - } - catch(NumberFormatException e) - { - nomax = true; - } - - if (!nomax && size > sizeValue) - { - Trace.log(Trace.WARNING , "Initial size ("+size+") exceeds specified maximum size (" + sizeValue + ")"); - } - } - - int old = this.garbageCollectionInitialSize_; - vetoableChange_.fireVetoableChange("garbageCollectionInitialSize",new Integer(old),new Integer(size)); - this.garbageCollectionInitialSize_ = size; - propertyChange_.firePropertyChange("garbageCollectionInitialSize",new Integer(old),new Integer(size)); - } - else - throw new IllegalArgumentException("garbageCollectionInitialSize"); - } - - /** - Sets the maximum size, in kilobytes, that the garbage - collection heap can grow to. This is used to prevent runaway - programs that consume all of the available storage. Normally, - garbage collection runs as an asynchronous thread in parallel with - other threads. If the maximum size is reached, all other threads - are stopped while garbage collection takes place. This may - adversely affect performance. - -

    The possible values are: -

      -
    • *NOMAX The default maximum size is not specified by the user. The - maximum is determined by the system. The heap will grow until - all system resources are depleted. Then a synchronous garbage - collection is started to reclaim resources no longer in use. - -
    • heap-maximum-size The value in kilobytes that the garbage collection - heap can grow to. -
    - - @param size The maximum size that the garbage collection heap can grow to. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setGarbageCollectionMaximumSize(String size) throws PropertyVetoException - { - if (size != null) - { - if (!size.toUpperCase().equalsIgnoreCase("*NOMAX")) - { - try - { - Integer.parseInt(size); - } - catch(NumberFormatException e) - { - throw new IllegalArgumentException("garbageCollectionMaximumSize"); - } - } - - String old = this.garbageCollectionMaximumSize_; - vetoableChange_.fireVetoableChange("garbageCollectionMaximumSize",old,size); - this.garbageCollectionMaximumSize_ = size; - propertyChange_.firePropertyChange("garbageCollectionMaximumSize",old,size); - } - else - throw new NullPointerException("garbageCollectionMaximumSize"); - } - - /** - Sets the priority of the tasks running garbage collection. - This parameter is valid only for OS/400 V4R3 and V4R2 versions. - It is ignored for V4R4 and later versions. - - @param priority The priority of the tasks running garbage collection. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setGarbageCollectionPriority(int priority) throws PropertyVetoException - { - if (priority == 10 || priority == 20 || priority == 30) - { - int old = this.garbageCollectionPriority_; - vetoableChange_.fireVetoableChange("garbageCollectionPriority",new Integer(old),new Integer(priority)); - this.garbageCollectionPriority_ = priority; - propertyChange_.firePropertyChange("garbageCollectionPriority",new Integer(old),new Integer(priority)); - } - else - throw new IllegalArgumentException("garbageCollectionPriority"); - } - - - - - - /** - Sets whether all Java class files should be run interpretively. - -

    The possible values are: -

      -
    • *OPTIMIZE Whether all Java classes are run interpretively depends on the - value specified for the OPTIMIZE property. If - *INTERPRET, all Java classes will be run - interpretively. If any other value was specified for the - OPTIMIZE property, only Java classes with Java programs created - using CRTJVAPGM command and specifying OPTIMIZE(*INTERPRET) will - be run interpretively. - -
    • *NO Only Java classes with Java programs created using CRTJVAPGM - command and specifying OPTIMIZE(*INTERPRET) will be run - interpretively. Java classes that need a Java program created - will be created with the optimization level specified in the - OPTIMIZE parameter. - -
    • *YES All Java classes will be run interpretively regardless of the - OPTIMIZE value associated Java program. Java classes that need - a Java program created will use the optimization level specified - in the OPTIMIZE parameter. - -
    • *JIT All Java class files will be run using the just in time - compiler (JIT) regardless of the OPTIMIZE value - used when the associated Java program was created. - - @param interpret How all Java class files should be run interpretively. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setInterpret(String interpret) throws PropertyVetoException - { - if (interpret != null) - { - if (interpret.equalsIgnoreCase("*OPTIMIZE") || - interpret.equalsIgnoreCase("*NO") || - interpret.equalsIgnoreCase("*YES") || - interpret.equalsIgnoreCase("*JIT")) // @D2a - { - String old = this.interpret_; - vetoableChange_.fireVetoableChange("interpret",old,interpret); - this.interpret_ = interpret; - propertyChange_.firePropertyChange("interpret",old,interpret); - } - else - throw new IllegalArgumentException("interpret"); - } - else - throw new NullPointerException("interpret"); - } - - /** - Sets the Java application to be run. - - @param application The Java application to be run. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setJavaApplication(String application) throws PropertyVetoException - { - if ((application != null) && (application.length() > 0)) - { - String old = this.javaApplication_; - vetoableChange_.fireVetoableChange("application", old, application); - this.javaApplication_ = application; - propertyChange_.firePropertyChange("application", old, application); - } - else - throw new NullPointerException("application"); - } - - /** - Sets the name that this job will run under. - The maximum length allowed is 10 characters. - -

      The possible values are: -

        -
      • QJVACMDSRV - The default job name. - -
      • *GEN - The job name will be generated from the class name. - -
      • string - Any generic string value. -
      - - @param jobname The value of the job name. - @since i5/OS V5R3M0 - **/ - public void setJobName(String jobname) // @F0A - { - if (jobname != null) - { - if (jobname.length() <= 10 && - jobname.length() > 0) - { - String old = this.jobname_; - this.jobname_ = jobname; - propertyChange_.firePropertyChange("jobname",old,jobname); - } - else - throw new IllegalArgumentException("jobname"); - } - else - throw new NullPointerException("jobname"); - } - - /** - Sets the optimization level of the IBM i system Java program that - will be created if no Java program is associated with the Java - class. For Java classes that are in a class file, the created Java - program remains associated with the class file after the Java - program is run. If the class is a part of a JAR or ZIP file, a - temporary Java program is created to run from and then discarded. - This can result in slow performance. For best performance, - explicitly create a Java program for JAR and ZIP files with the - Create Java Program (CRTJVAPGM) command. - - For *INTERPRET, the resulting Java program interprets the - class byte codes when invoked. For other optimization levels, the - Java program contains machine instruction sequences that are run - when the Java program is invoked. - - *INTERPRET Java programs are smaller but run slower than - Java programs created with higher optimization levels. As you - increase the optimization level beyond 10, the Java program - performance generally improves, but the time required to create the - Java program increases and debugging is more difficult. - -

      The possible values are: -

        -
      • 10 The Java program contains a compiled version of the class file - byte codes and has only minimal additional compiler - optimization. Variables can be displayed and modified while - debugging. - -
      • *INTERPRET The Java program created does not contain machine specific - instructions. It will be interpreted when the program is - started. Variables can be displayed and modified while - debugging. - - If the INTERPRET keyword has a value of *OPTIMIZE, all of the - classes that run will be run interpreted even if there is an - optimized Java program associated with the class. - -
      • *JIT No Java program containing machine instruction sequences - is created. The class is run using the just in time - compiler (JIT). - -
      • 20 The Java program contains a compiled version of the class file - byte codes and has some additional compiler optimization. - Variables can be displayed but not modified while debugging. - -
      • 30 The Java program contains a compiled version of the class file - byte codes and has more compiler optimization than optimization - level 20. During a debug session, user variables cannot be - changed, but can be displayed. The presented values may not be - the current values of the variables. - -
      • 40 The Java program contains a compiled version of the class file - byte codes and has more compiler optimization than optimization - level 30. All call and instruction tracing is disabled. -
      - - @param opt The optimization level of the IBM i system Java program that - will be created if no Java program is associated with - the Java class. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setOptimization(String opt) throws PropertyVetoException - { - if (opt != null) - { - if (opt.equalsIgnoreCase("10") || - opt.equalsIgnoreCase("*INTERPRET") || - opt.equalsIgnoreCase("*JIT") || // @D2a - opt.equalsIgnoreCase("20") || - opt.equalsIgnoreCase("30") || - opt.equalsIgnoreCase("40")) - { - String old = this.optimization_; - vetoableChange_.fireVetoableChange("optimization",old,opt); - this.optimization_ = opt; - propertyChange_.firePropertyChange("optimization",old,opt); - } - else - throw new IllegalArgumentException("optimization"); - } - else - throw new NullPointerException("optimization"); - } - - /** - Sets special options used when running the Java class. This - method is not additive. The list of values is replaced - every time this method is called. - -

      The possible values are: -

        -
      • *NONE No special options are used when running the Java class. - -
      • *VERBOSE A message is displayed each time a class file is loaded. - -
      • *DEBUG Allows the system debugger to be used for this Java program. - -
      • *VERBOSEGC A message is displayed for each garbage collection sweep. - -
      • *NOCLASSGC Unused classes are not reclaimed when garbage collection is run. -
      - - @param option The special options used when running the Java class. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setOptions(String[] option) throws PropertyVetoException - { - if (option != null) - { - boolean valid = false; - for (int i = 0 ; i < option.length ; i++) - { - valid = true; - String s = option[i]; - if (!(s.equalsIgnoreCase("*NONE") || s.equalsIgnoreCase("*VERBOSE") || s.equalsIgnoreCase("*DEBUG") - || s.equalsIgnoreCase("*VERBOSEGC") || s.equalsIgnoreCase("*NOCLASSGC"))) - { - valid = false; - break; - } - } - if (valid) - { - String[] old = this.options_; - vetoableChange_.fireVetoableChange("options",old,option); - this.options_ = option; - propertyChange_.firePropertyChange("options",old,option); - } - else - throw new IllegalArgumentException("option"); - } - else - throw new NullPointerException("option"); - } - - - /** - Sets one or more parameter values that are passed to the Java - application. A maximum of 200 parameter values can be passed. - - @param parameters The parameters for the Java application. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setParameters(String[] parameters) throws PropertyVetoException - { - if (parameters != null) - { - String[] old = this.parameters_; - vetoableChange_.fireVetoableChange("parameters", old, parameters); - this.parameters_ = parameters; - propertyChange_.firePropertyChange("parameters", old, parameters); - } - else - throw new NullPointerException("parameters"); - } - - /** - Sets the Java Virtual Machine properties when running the Java Application. - - @param property The JVM properties. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setProperties(Properties property) throws PropertyVetoException - { - if (property != null) { - Properties properties = property; - - if (properties.containsKey("os400.stdin")) - properties.remove("os400.stdin"); - if (properties.containsKey("os400.stdout")) - properties.remove("os400.stdout"); - if (properties.containsKey("os400.stderr")) - properties.remove("os400.stderr"); - if (properties.containsKey("os400.stdio.convert")) - properties.remove("os400.stdio.convert"); - - //save properties - Properties old = this.properties_; - vetoableChange_.fireVetoableChange("properties", old, properties); - this.properties_ = (Properties)properties.clone(); - propertyChange_.firePropertyChange("properties", old, properties); - - }else - throw new NullPointerException("properties"); - } - - /** - Sets the level of warnings given for directories in - CLASSPATH that have public write authority. A directory in - CLASSPATH that has public write authority is a security exposure - because it may contain a class file with the same name as the one - you want to run. Whichever class file is found first is run. - -

      The possible values are: -

        -
      • *WARN Warning message is sent for each directory in the CLASSPATH - that has public write authority. - -
      • *SECURE A warning message is sent for each directory in the CLASSPATH - that has public write authority. If one or more warning - messages are sent, an escape message is sent and the Java - program is not run. - -
      • *IGNORE Ignore the fact that directories in the CLASSPATH may have - public write authority. No warnings messages are sent. -
      - - @param chklvl The level of warnings given for directories in the - CLASSPATH that have public write authority. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setSecurityCheckLevel(String chklvl) throws PropertyVetoException - { - if (chklvl != null) - { - if (chklvl.equalsIgnoreCase("*WARN") || chklvl.equalsIgnoreCase("*SECURE") || chklvl.equalsIgnoreCase("*IGNORE")) - { - String old = this.securityCheckLevel_; - vetoableChange_.fireVetoableChange("securityCheckLevel",old,chklvl); - this.securityCheckLevel_ = chklvl; - propertyChange_.firePropertyChange("securityCheckLevel",old,chklvl); - } - else - throw new IllegalArgumentException("securityCheckLevel"); - } - else - throw new NullPointerException("securityCheckLevel"); - } - - /** - Sets the system. - - @param system The system. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem(AS400 system) throws PropertyVetoException - { - if (system != null) - { - AS400 old = this.as400_; - vetoableChange_.fireVetoableChange("as400", old, system); - this.as400_ = system; - propertyChange_.firePropertyChange("as400", old, system); - } - else - throw new NullPointerException("as400"); - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/JavaApplicationCall16.gif b/cvsroot/src/com/ibm/as400/access/JavaApplicationCall16.gif deleted file mode 100644 index 98e18cc2b..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/JavaApplicationCall16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/JavaApplicationCall32.gif b/cvsroot/src/com/ibm/as400/access/JavaApplicationCall32.gif deleted file mode 100644 index e1fc5df46..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/JavaApplicationCall32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/JavaApplicationCallBeanInfo.java b/cvsroot/src/com/ibm/as400/access/JavaApplicationCallBeanInfo.java deleted file mode 100644 index 58bfdceb4..000000000 --- a/cvsroot/src/com/ibm/as400/access/JavaApplicationCallBeanInfo.java +++ /dev/null @@ -1,278 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JavaApplicationCallBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.lang.reflect.Method; -import java.beans.*; -import com.ibm.as400.access.*; - -/** - * The JavaApplicationCallBeanInfo class provides bean information for the - * JavaApplicationCall class. -**/ -public class JavaApplicationCallBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private final static Class beanClass_ = JavaApplicationCall.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - private static ResourceBundleLoader rbl_; - - // Static initializer. - static - { - try - { - // Events. - EventSetDescriptor event1 = - new EventSetDescriptor(beanClass_, "propertyChange", - PropertyChangeListener.class, - "propertyChange"); - event1.setDisplayName(rbl_.getText("EVT_NAME_PROPERTY_CHANGE")); - event1.setShortDescription(rbl_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor event2 = new EventSetDescriptor(beanClass_, - "actionCompleted", - ActionCompletedListener.class, - "actionCompleted"); - event2.setDisplayName(rbl_.getText("EVT_NAME_ACTION_COMPLETED")); - event2.setShortDescription(rbl_.getText("EVT_DESC_ACTION_COMPLETED")); - - EventSetDescriptor event3 = - new EventSetDescriptor(beanClass_, "propertyChange", - VetoableChangeListener.class, - "vetoableChange"); - event3.setDisplayName(rbl_.getText("EVT_NAME_PROPERTY_VETO")); - event3.setShortDescription(rbl_.getText("EVT_DESC_PROPERTY_VETO")); - - - events_ = new EventSetDescriptor[] {event1, event2, event3}; - - - // Properties. - PropertyDescriptor classPath = - new PropertyDescriptor("classPath", beanClass_, - "getClassPath", "setClassPath"); - classPath.setBound(true); - classPath.setConstrained(true); - classPath.setDisplayName(rbl_.getText("PROP_NAME_JAC_CLASSPATH")); - classPath.setShortDescription(rbl_.getText("PROP_DESC_JAC_CLASSPATH")); - - - - PropertyDescriptor classPathSecurityChkLvl = - new PropertyDescriptor("securityCheckLevel", beanClass_, - "getSecurityCheckLevel", "setSecurityCheckLevel"); - classPathSecurityChkLvl.setBound(true); - classPathSecurityChkLvl.setConstrained(true); - classPathSecurityChkLvl.setDisplayName(rbl_.getText("PROP_NAME_JAC_SECCHKLVL")); - classPathSecurityChkLvl.setShortDescription(rbl_.getText("PROP_DESC_JAC_SECCHKLVL")); - - - - PropertyDescriptor garbageCollectInitialSize = - new PropertyDescriptor("garbageCollectionInitialSize", beanClass_, - "getGarbageCollectionInitialSize", "setGarbageCollectionInitialSize"); - garbageCollectInitialSize.setBound(true); - garbageCollectInitialSize.setConstrained(true); - garbageCollectInitialSize.setDisplayName(rbl_.getText("PROP_NAME_JAC_GCINIT")); - garbageCollectInitialSize.setShortDescription(rbl_.getText("PROP_DESC_JAC_GCINIT")); - - - - PropertyDescriptor garbageCollectMaximumSize = - new PropertyDescriptor("garbageCollectionMaximumSize", beanClass_, - "getGarbageCollectionMaximumSize", "setGarbageCollectionMaximumSize"); - garbageCollectMaximumSize.setBound(true); - garbageCollectMaximumSize.setConstrained(true); - garbageCollectMaximumSize.setDisplayName(rbl_.getText("PROP_NAME_JAC_GCMAX")); - garbageCollectMaximumSize.setShortDescription(rbl_.getText("PROP_DESC_JAC_GCMAX")); - - - - PropertyDescriptor garbageCollectionFrequency = - new PropertyDescriptor("garbageCollectionFrequency", beanClass_, - "getGarbageCollectionFrequency", "setGarbageCollectionFrequency"); - garbageCollectionFrequency.setBound(true); - garbageCollectionFrequency.setConstrained(true); - garbageCollectionFrequency.setDisplayName(rbl_.getText("PROP_NAME_JAC_GCFREQ")); - garbageCollectionFrequency.setShortDescription(rbl_.getText("PROP_DESC_JAC_GCFREQ")); - - - - PropertyDescriptor garbageCollectionPriority = - new PropertyDescriptor("garbageCollectionPriority", beanClass_, - "getGarbageCollectionPriority", "setGarbageCollectionPriority"); - garbageCollectionPriority.setBound(true); - garbageCollectionPriority.setConstrained(true); - garbageCollectionPriority.setDisplayName(rbl_.getText("PROP_NAME_JAC_GCPRIORITY")); - garbageCollectionPriority.setShortDescription(rbl_.getText("PROP_DESC_JAC_GCPRIORITY")); - - - - PropertyDescriptor interpret = - new PropertyDescriptor("interpret", beanClass_, - "getInterpret", "setInterpret"); - interpret.setBound(true); - interpret.setConstrained(true); - interpret.setDisplayName(rbl_.getText("PROP_NAME_JAC_INTERPRET")); - interpret.setShortDescription(rbl_.getText("PROP_DESC_JAC_INTERPRET")); - - - - PropertyDescriptor javaApplication = - new PropertyDescriptor("javaApplication", beanClass_, - "getJavaApplication", "setJavaApplication"); - javaApplication.setBound(true); - javaApplication.setConstrained(true); - javaApplication.setDisplayName(rbl_.getText("PROP_NAME_JAC_JAVAAPP")); - javaApplication.setShortDescription(rbl_.getText("PROP_DESC_JAC_JAVAAPP")); - - - - PropertyDescriptor optimization = - new PropertyDescriptor("optimization", beanClass_, - "getOptimization", "setOptimization"); - optimization.setBound(true); - optimization.setConstrained(true); - optimization.setDisplayName(rbl_.getText("PROP_NAME_JAC_OPTIMIZE")); - optimization.setShortDescription(rbl_.getText("PROP_DESC_JAC_OPTIMIZE")); - - - - PropertyDescriptor option = - new PropertyDescriptor("option", beanClass_, - "getOptions", "setOptions"); - option.setBound(true); - option.setConstrained(true); - option.setDisplayName(rbl_.getText("PROP_NAME_JAC_OPTION")); - option.setShortDescription(rbl_.getText("PROP_DESC_JAC_OPTION")); - - - - PropertyDescriptor parameters = - new PropertyDescriptor("parameters", beanClass_, - "getParameters","setParameters"); - parameters.setBound(true); - parameters.setConstrained(true); - parameters.setDisplayName(rbl_.getText("PROP_NAME_JAC_PARAMETERS")); - parameters.setShortDescription(rbl_.getText("PROP_DESC_JAC_PARAMETERS")); - - - - PropertyDescriptor portSearch = - new PropertyDescriptor("findPort", beanClass_, - "isFindPort", "setFindPort"); - portSearch.setBound(true); - portSearch.setConstrained(true); - portSearch.setDisplayName(rbl_.getText("PROP_NAME_JAC_PORTSEARCH")); - portSearch.setShortDescription(rbl_.getText("PROP_DESC_JAC_PORTSEARCH")); - - properties_ = new PropertyDescriptor[]{ - classPath, - classPathSecurityChkLvl, - garbageCollectInitialSize, - garbageCollectMaximumSize, - garbageCollectionFrequency, - garbageCollectionPriority, - interpret, - javaApplication, - parameters, - optimization, - option, - portSearch, - }; - } - catch(IntrospectionException e) - { - throw new Error(e.toString()); - } - } - /** - * Returns the bean descriptor. - * - * @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - /** - * Returns the default event index. - * @return The default event index (always 1). - **/ - public int getDefaultEventIndex() - { - return 1; - } - - /** - * Returns the default property index. - * @return The default property index (always 0). - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - * Returns the descriptors for all events. - * @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - */ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("JavaApplicationCall16.gif"); - break; - - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("JavaApplicationCall32.gif"); - break; - } - - return image; - } - - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/JavaApplicationCallThread.java b/cvsroot/src/com/ibm/as400/access/JavaApplicationCallThread.java deleted file mode 100644 index 989e52dd6..000000000 --- a/cvsroot/src/com/ibm/as400/access/JavaApplicationCallThread.java +++ /dev/null @@ -1,248 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JavaApplicationCallThread.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.net.ServerSocket; -import java.net.Socket; -import java.util.ResourceBundle; - -/** - This class is only used by class JavaApplicationCall. -**/ -class JavaApplicationCallThread extends Thread -{ - Socket errorSocket_ = null; - Socket readSocket_ = null; - Socket writeSocket_ = null; - - ServerSocket error_ = null; - ServerSocket read_ = null; - ServerSocket write_ = null; - - BufferedReader err_ = null; - BufferedReader in_ = null; - PrintWriter out_ = null; - - // This counter is used to make sure we don't close the sockets - // before all output is out of the pipe. The main thread (the - // one just returned from the the program call) will wait to - // close sockets until all data is out of the sockets. - long readCounter_ = 0; - - /** - Constructor. - **/ - JavaApplicationCallThread(ServerSocket write, ServerSocket read, ServerSocket error) - { - read_ = read; - write_ = write; - error_ = error; - } - - - /** - Closes sockets communicating with server. - **/ - void closeSockets() - { - // The following will wait until all data is out of the - // stderr and stdout pipe before closing - // them. The sterr/stdout code will increment the - // counter every time they get data from the socket. - // This code will keeping looping until all data - // is out of the sockets. This code will not wait - // forever. This thread is the one that called - // the Java API. Since it has control again, the - // Java program on the server is done. We just have - // to get all the data out of the sockets. - long localCounter = readCounter_; - - try { Thread.sleep(500); } catch (Exception e) {} - - while (localCounter < readCounter_) - { - localCounter = readCounter_; - try { Thread.sleep(500); } catch (Exception e) {} - } - - try - { - if (in_ != null) - in_.close(); - - if (read_ != null) - read_.close(); - - if (readSocket_ != null) - readSocket_.close(); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, e.toString(), e); - } - finally - { - in_ = null; - read_ = null; - readSocket_ = null; - } - - try - { - if (out_ != null) - out_.close(); - - if (write_ != null) - write_.close(); - - if (writeSocket_ != null) - writeSocket_.close(); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, e.toString(), e); - } - finally - { - out_ = null; - write_ = null; - writeSocket_ = null; - } - - try - { - if (err_ != null) - err_.close(); - - if (error_ != null) - error_.close(); - - if (errorSocket_ != null) - errorSocket_.close(); - - } - catch (Exception e) - { - Trace.log(Trace.ERROR, e.toString(), e); - } - finally - { - err_ = null; - error_ = null; - errorSocket_ = null; - } - } - - /** - Returns the stderr come from the application running on the server. - **/ - String getStandardErrorString() - { - String ret = null; - - if (err_ != null) - { - try - { - ret = err_.readLine(); - - if (ret != null) - readCounter_++; - } - catch(Exception e) - { - Trace.log(Trace.ERROR, e.toString(), e); - } - } - - return ret; - } - - /** - Returns the stdout come from the application running on the server. - **/ - String getStandardOutString() - { - String ret = null; - - if (in_ != null) - { - try - { - ret = in_.readLine(); - if (ret != null) - readCounter_++; - } - catch(Exception e) - { - Trace.log(Trace.ERROR, e.toString(), e); - } - } - - return ret; - } - - /** - Starts a thread to get the sockets before the call to Java application is executed. - **/ - public void run() - { - try - { - readSocket_ = read_.accept(); - in_ = new BufferedReader(new InputStreamReader(readSocket_.getInputStream())); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, e.toString() + " (Suggestion: Verify that a firewall is not blocking communication from the IBM i server to the client.)", e); - } - try - { - writeSocket_ = write_.accept(); - out_ = new PrintWriter(writeSocket_.getOutputStream(), true); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, e.toString(), e); - } - try - { - errorSocket_ = error_.accept(); - err_ = new BufferedReader(new InputStreamReader(errorSocket_.getInputStream())); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, e.toString(), e); - } - } - - - /** - Sends the stdin to the application running on the server. - **/ - void sendStandardInString(String s) - { - if ((s!=null) && (out_ !=null)) - { - out_.println(s); - } - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/JavaProgram.java b/cvsroot/src/com/ibm/as400/access/JavaProgram.java deleted file mode 100644 index eaa917007..000000000 --- a/cvsroot/src/com/ibm/as400/access/JavaProgram.java +++ /dev/null @@ -1,667 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JavaProgram.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.util.Calendar; -import java.util.Date; - -/** -Represents an IBM i Java program. This class is supported -only when connecting to systems running IBM i V5R1 or higher, and is not supported beyond IBM i 7.1. -

      -In the context of this discussion, a "Java program" is the IBM i executable object that is created when the CRTJVAPGM (Create Java Program) CL command is run against a class, JAR, or ZIP file. -
      -Using the JavaProgram class, you can obtain the following information about an IBM i Java program: -

        -
      • Adopted authority profile
      • -
      • File change date
      • -
      • File owner
      • -
      • Java program creation date
      • -
      • Release program was created for
      • -
      • Licensed Internal Code options
      • -
      • Number of attached java programs
      • -
      • Number of classes
      • -
      • Number of classes with current java programs
      • -
      • Number of classes without current java programs
      • -
      • Number of classes with errors
      • -
      • Optimization level
      • -
      • Path used
      • -
      • Performance Collection Enabled flag
      • -
      • Performance Collection type
      • -
      • Profiling data status
      • -
      • Size of attached java programs
      • -
      • Use adopted authority
      • -
      -
      - -
      -An Example using the JavaProgram class: -
      -
      -// Create a JavaProgram object to refer to a specific Java program.
      -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
      -JavaProgram javaProgram = new JavaProgram(system, "/home/mydir/HelloWorld.class");
      -
      -// Get the optimization. -int optimization = javaProgram.getOptimizationLevel(); -
      -// Get the file owner. -String owner = javaProgram.getFileOwner(); -
      -**/ - -public class JavaProgram implements Serializable -{ - static final long serialVersionUID = -209990140140936884L; - - private boolean loaded_ = false; // Have we retrieved values from the system yet? - - private AS400 system_; - private String path_; - - private String fileOwner_; - private Date fileChangeDate_; - private Date javaProgramCreationDate_; - private int numberOfAttachedPrograms_; - private int numberOfClassesWithJavaPrograms_; - private int numberOfClassesWithoutPrograms_; - private int numberOfClassesWithErrors_; - private int numberOfClasses_; - private int optimizationLevel_; - private String performanceCollectionEnabledFlag_; - private String performanceCollectionType_; - private boolean useAdoptedAuthority_; - private String adoptedAuthorityProfile_; - private int sizeOfAttachedPrograms_; - private String javaProgramVersion_; - private String profilingDataStatus_; - private String LICoptions_; - - /** - Constant indicating that the profile to use when the use adopted authority field is set is *USER. - **/ - public static final String ADOPTED_AUTHORITY_PROFILE_USER = "*USER"; - - /** - Constant indicating that the profile to use when the use adopted authority field is set is *OWNER. - **/ - public static final String ADOPTED_AUTHORITY_PROFILE_OWNER = "*OWNER"; - - /** - Constant indicating the type of performance collection is *ENTRYEXIT. - **/ - public static final String PERFORMANCE_COLLECTION_TYPE_ENTRYEXIT = "*ENTRYEXIT"; - - /** - Constant indicating the type of performance collection is *FULL. - **/ - public static final String PERFORMANCE_COLLECTION_TYPE_FULL = "*FULL"; - - /** - Constant indicating that profile data collection is not enabled for the the Java program(s). - **/ - public static final String PROFILING_DATA_STATUS_NOCOL = "*NOCOL"; - - /** - Constant indicating that profile data collection is enabled for the attached Java program(s). - **/ - public static final String PROFILING_DATA_STATUS_COL = "*COL"; - - /** - Constant indicating that profile data has been applied to the attached Java program(s). - **/ - public static final String PROFILING_DATA_STATUS_APY = "*APY"; - - - /** - Creates a JavaProgram - **/ - public JavaProgram() - { - } - - /** - Creates a JavaProgram - - @param system The system. - @param path The path. This can specify any class, jar, or zip file. - **/ - public JavaProgram(AS400 system, String path) - { - setSystem(system); - setPath(path); - } - - - private void checkVRM() - throws UnsupportedOperationException - { - try - { - // See if the system VRM is higher than IBM i 7.1. - if (getSystem() != null && getSystem().getVRM() > 0x00070100) { - Trace.log(Trace.ERROR, "JavaProgram is not supported beyond IBM i 7.1."); - throw new UnsupportedOperationException("JavaProgram"); - } - } - catch (UnsupportedOperationException e) { throw e; } - catch (Exception e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error when checking system VRM.", e); - throw new UnsupportedOperationException(e.getMessage()); - } - } - - /** - Returns the name of the system. - @return system name - **/ - public AS400 getSystem() - { - return system_; - } - - /** - Returns the path to a class, jar, or zip file used to create the Java program. - @return path - **/ - public String getPath() - { - return path_; - } - - /** - Returns the profile to use when the "Use Adopted Authority" field is set. - - @return the profile to use. Possible values are: -
        -
      • {@link #ADOPTED_AUTHORITY_PROFILE_USER ADOPTED_AUTHORITY_PROFILE_USER} -
      • {@link #ADOPTED_AUTHORITY_PROFILE_OWNER ADOPTED_AUTHORITY_PROFILE_OWNER} -
      - **/ - public String getAdoptedAuthorityProfile() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_) refresh(); - if(adoptedAuthorityProfile_.equals("0")) - return ADOPTED_AUTHORITY_PROFILE_USER; - else - return ADOPTED_AUTHORITY_PROFILE_OWNER; - } - - /** - Returns the date and time the file was last modified or changed. - - @return the last-changed date and time - **/ - public Date getFileChangeDate() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if(!loaded_) refresh(); - return (Date)fileChangeDate_.clone(); - } - - /** - Returns the name of the owner of the file. - - The string is in job CCSID - @return the file owner - **/ - public String getFileOwner() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if(!loaded_) refresh(); - return fileOwner_; - } - - /** - Returns the date and time the Java program was created for the file. - - @return the creation date - **/ - public Date getJavaProgramCreationDate() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if(!loaded_) refresh(); - return (Date)javaProgramCreationDate_.clone(); - } - - /** - Returns the IBM i version the Java program was created for. - - @return the version - **/ - public String getJavaProgramVersion() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if(!loaded_) refresh(); - return javaProgramVersion_; - } - - /** - Returns the number of classes. - - @return the number of classes. - **/ - public int getNumberOfClasses() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if(!loaded_) refresh(); - return numberOfClasses_; - } - - /** - Returns the number of classes with representations up-to-date in the attached Java programs. - - @return the number of classes with current java programs. - **/ - public int getNumberOfClassesWithCurrentJavaPrograms() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if(!loaded_) refresh(); - return numberOfClassesWithJavaPrograms_; - } - - /** - Returns the number of classes containing errors. - - @return the number of classes with errors. - **/ - public int getNumberOfClassesWithErrors() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if(!loaded_) refresh(); - return numberOfClassesWithErrors_; - } - - /** - Returns the number of classes with representations out-of-date. - - @return the number of classes without current java programs. - **/ - public int getNumberOfClassesWithoutCurrentJavaPrograms() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if(!loaded_) refresh(); - return numberOfClassesWithoutPrograms_; - } - - /** - Returns the number of Java prgroams attached to the .class or .jar/sip file. - - @return the number of programs - **/ - public int getNumberOfAttachedPrograms() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if(!loaded_) refresh(); - return numberOfAttachedPrograms_; - } - - /** - Returns the optimization level used to create the java program. - - @return the optimization level. Possible values are: -
        -
      • 0
      • -
      • 10
      • -
      • 20
      • -
      • 30
      • -
      • 40
      • -
      - **/ - public int getOptimizationLevel() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if(!loaded_) refresh(); - return optimizationLevel_; - } - - /** - Returns whether or not performance collection is enabled. - - @return the performance collection enabled flag. Possible values are: -
        -
      • 0 - "NONE
      • -
      • 1 - on
      • -
      - **/ - public String getPerformanceCollectionEnabledFlag() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if(!loaded_) refresh(); - return performanceCollectionEnabledFlag_; - } - - /** - Returns the type of performance collection if the performance collection flag is set. - - @return the type of performance collection. Possible values are: -
        -
      • {@link #PERFORMANCE_COLLECTION_TYPE_ENTRYEXIT PERFORMANCE_COLLECTION_TYPE_ENTRYEXIT}
      • -
      • {@link #PERFORMANCE_COLLECTION_TYPE_FULL PERFORMANCE_COLLECTION_TYPE_FULL}
      • -
      - **/ - public String getPerformanceCollectionType() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if(!loaded_) refresh(); - if(performanceCollectionType_.equals("0")) - return PERFORMANCE_COLLECTION_TYPE_ENTRYEXIT; - else - return PERFORMANCE_COLLECTION_TYPE_FULL; - } - - /** - Returns whether or not the used adopted authority is set. - - @return true if the use adopted authority is set, false otherwise - **/ - public boolean isUseAdoptedAuthority() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if(!loaded_) refresh(); - return useAdoptedAuthority_; - } - - /** - Returns the size in kilobytes of all the attached java programs. - - @return the size - **/ - public int getSizeOfAttachedJavaPrograms() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if(!loaded_) refresh(); - return sizeOfAttachedPrograms_; - } - - /** - Returns whether profiling data is enabled or applied. - - @return whether profiling data is enabled or applied. Possible values are: -
        -
      • {@link #PROFILING_DATA_STATUS_NOCOL PROFILING_DATA_STATUS_NOCOL}
      • -
      • {@link #PROFILING_DATA_STATUS_COL PROFILING_DATA_STATUS_COL}
      • -
      • {@link #PROFILING_DATA_STATUS_APY PROFILING_DATA_STATUS_APY}
      • -
      - **/ - public String getProfilingDataStatus() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if(!loaded_) refresh(); - if(profilingDataStatus_.equals("0")) - return PROFILING_DATA_STATUS_NOCOL; - else if(profilingDataStatus_.equals("1")) - return PROFILING_DATA_STATUS_COL; - else - return PROFILING_DATA_STATUS_APY; - } - - /** - Returns the LIC options string specified when the java program was last modified. - - @return the LIC options. - **/ - public String getLICOptions() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if(!loaded_) refresh(); - return LICoptions_; - } - - /** - Refreshes all the values for this PTF by retrieving them from the system. - **/ - public void refresh() - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException, - UnsupportedEncodingException - { - checkVRM(); - - int ccsid = system_.getCcsid(); - ConvTable conv = ConvTable.getTable(ccsid, null); - int len=4096; - ProgramParameter[] parms = new ProgramParameter[15]; - parms[0] = new ProgramParameter(len); // receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(len)); // length of receiver variable - parms[2] = new ProgramParameter(conv.stringToByteArray("RJPI0100")); // format name - parms[3] = new ProgramParameter(0); //Class list receiver variable - parms[4] = new ProgramParameter(BinaryConverter.intToByteArray(0)); //Length of class list receiver variable - parms[5] = new ProgramParameter(conv.stringToByteArray("RJPC0100")); //format of class list receiver variable - parms[6] = new ProgramParameter(conv.stringToByteArray(path_)); //path name - parms[7] = new ProgramParameter(BinaryConverter.intToByteArray(path_.length())); //length of path name - parms[8] = new ProgramParameter(conv.stringToByteArray(" ")); //classpath - parms[9] = new ProgramParameter(BinaryConverter.intToByteArray(0)); //length of classpath - parms[10] = new ProgramParameter(0); //classpath used receiver variable - parms[11] = new ProgramParameter(BinaryConverter.intToByteArray(0)); //length of classpath used receiver variable - parms[12] = new ProgramParameter(BinaryConverter.intToByteArray(1)); //status of calsses to return in the class list - parms[13] = new ProgramParameter(conv.stringToByteArray("*PGM")); //JDK version - parms[14] = new ProgramParameter(BinaryConverter.intToByteArray(0)); // error code - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QJVAMAT.PGM", parms); - // Assumption of thread-safety defaults to false, or to the value of the "threadSafe" system property (if it has been set). - //pc.setThreadSafe(false); - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - - byte[] output = parms[0].getOutputData(); - //int bytesReturned = BinaryConverter.byteArrayToInt(output, 0); - //int bytesAvailable = BinaryConverter.byteArrayToInt(output, 4); - fileOwner_ = conv.byteArrayToString(output, 8, 10); - String d = conv.byteArrayToString(output, 18, 13); - // Parse the "file change" date - if (d.trim().length() == 13) - { - Calendar cal = Calendar.getInstance(); - cal.clear(); - cal.set(Integer.parseInt(d.substring(0,3)) + 1900, // year - Integer.parseInt(d.substring(3,5))-1, // month is zero-based - Integer.parseInt(d.substring(5,7)), // day - Integer.parseInt(d.substring(7,9)), // hour - Integer.parseInt(d.substring(9,11)), // minute - Integer.parseInt(d.substring(11,13))); // second - fileChangeDate_ = cal.getTime(); - } - else - { - fileChangeDate_ = null; - } - d = conv.byteArrayToString(output, 31, 13); - //Parse the "Java program creation" date - if (d.trim().length() == 13) - { - Calendar cal = Calendar.getInstance(); - cal.clear(); - cal.set(Integer.parseInt(d.substring(0,3)) + 1900, // year - Integer.parseInt(d.substring(3,5))-1, // month is zero-based - Integer.parseInt(d.substring(5,7)), // day - Integer.parseInt(d.substring(7,9)), // hour - Integer.parseInt(d.substring(9,11)), // minute - Integer.parseInt(d.substring(11,13))); // second - javaProgramCreationDate_ = cal.getTime(); - } - else - { - javaProgramCreationDate_ = null; - } - numberOfAttachedPrograms_ = BinaryConverter.byteArrayToInt(output, 44); - numberOfClassesWithJavaPrograms_ = BinaryConverter.byteArrayToInt(output, 48); - numberOfClassesWithoutPrograms_ = BinaryConverter.byteArrayToInt(output, 52); - numberOfClassesWithErrors_ = BinaryConverter.byteArrayToInt(output, 56); - numberOfClasses_ = BinaryConverter.byteArrayToInt(output, 60); - optimizationLevel_ = BinaryConverter.byteArrayToInt(output, 64); - performanceCollectionEnabledFlag_ = conv.byteArrayToString(output, 68, 1); - performanceCollectionType_ = conv.byteArrayToString(output, 69, 1); - String useAdopAuthority = conv.byteArrayToString(output, 70, 1); - adoptedAuthorityProfile_ = conv.byteArrayToString(output, 71, 1); - sizeOfAttachedPrograms_ = BinaryConverter.byteArrayToInt(output, 72); - String version = Integer.toString( (output[76] & 0xff ) + 0x100, 16 /* radix */ ) .substring( 1 ); //get version - String release = Integer.toString( (output[77] & 0xff ) + 0x100, 16 /* radix */ ) .substring( 1 ); //get release and modification - javaProgramVersion_ = getVersion((version + release).toCharArray()); - profilingDataStatus_ = Byte.toString(output[78]); - int offsetToLICOptions = BinaryConverter.byteArrayToInt(output, 80); - int lengthOfLIC = BinaryConverter.byteArrayToInt(output, 84); - int lengthOfAvailableLIC = BinaryConverter.byteArrayToInt(output, 88); - LICoptions_ = conv.byteArrayToString(output, offsetToLICOptions, lengthOfLIC); - if(useAdopAuthority.equals("0")) - useAdoptedAuthority_ = false; - else - useAdoptedAuthority_ = true; - loaded_= true; - } - - /** - Gets the IBM i version. - **/ - private String getVersion(char[] version) - { - String v = "V"; - String r = "R"; - String m = "M"; - if(version[0] != '0') - v += version[0]; - v += version[1]; - r += version[2]; - m += version[3]; - - return v+r+m; - } - - /** - Sets the name of the system to search for a Java Program. - - @param system The system - **/ - public void setSystem(AS400 system) - { - if(loaded_) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - if(system == null) - throw new NullPointerException("system"); - - system_ = system; - } - - /** - Sets the qualified path name to use. - - @param path - the qualified path name. - **/ - public void setPath(String path) - { - if(loaded_) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - if (path == null) - throw new NullPointerException("path"); - - path_ = path; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/Job.java b/cvsroot/src/com/ibm/as400/access/Job.java deleted file mode 100644 index 745ce9c92..000000000 --- a/cvsroot/src/com/ibm/as400/access/Job.java +++ /dev/null @@ -1,7442 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Job.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.text.DateFormat; -import java.text.ParseException; -import java.util.Calendar; -import java.util.Date; -import java.util.StringTokenizer; -import java.util.Vector; - -/** - Represents a job on the IBM i server. In order to access a job, the system and either the job name, user name, and job number or internal job identifier need to be set. A valid and sufficient combination of these must be set before getting or setting any of the job's attributes. -

      Some of the attributes have associated 'get' and 'set' methods defined in this class. These are provided for backwards compatibility with previous versions of the IBM Toolbox for Java. The complete set of attribute values can be accessed using the public constants. -

      Note: Most of the 'get' methods will either go to the system to retrieve the job attribute value, or will return a cached value if the attribute was previously retrieved or previously set by {@link #setValue setValue()} or one of the other 'set' methods. Use {@link #loadInformation loadInformation()} to refresh the attribute values from the system. -
      For example: -

      - *  Job job = new Job(system, jobName, userName, jobNumber);
      - *  while (job.getStatus().equals(Job.JOB_STATUS_ACTIVE))
      - *  {
      - *      // Wait a while.
      - *      Thread.sleep(1000);
      - *      // Refresh the attribute values.
      - *      job.loadInformation();
      - *  }
      - *  System.out.println("Job status is: " + job.getStatus());
      - 
      -

      Note: Jobs created by SBMJOB tend to get cleaned-up immediately upon job completion (if no spooled files were created); whereupon getStatus(), getCompletionStatus(), and most other 'get' methods will throw an AS400Exception containing an AS400Message indicating "Internal job identifier no longer valid" (message ID CPF3C52). That exception should be interpreted as an indication that the job has completed. -

      Note: To obtain information about the job in which a program or command runs, do something like the following: -

      - *  AS400 system = new AS400();
      - *  ProgramCall pgm = new ProgramCall(system);
      - *  pgm.setThreadSafe(true);  // Indicates that the program is to be run on-thread.
      - *  String jobNumber = pgm.getServerJob().getNumber();
      - 
      - (If the program or command is not to be run on-thread, omit the setThreadSafe() call.) - @see com.ibm.as400.access.JobList - @see com.ibm.as400.access.CommandCall#getServerJob - @see com.ibm.as400.access.ProgramCall#getServerJob - **/ -public class Job implements Serializable -{ - static final long serialVersionUID = 6L; - - private static final byte[] BLANKS16_ = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - - private static final Boolean ON_THREAD = ProgramCall.THREADSAFE_TRUE; - private static final Boolean OFF_THREAD = ProgramCall.THREADSAFE_FALSE; - - private boolean cacheChanges_ = true; - - private boolean isConnected_ = false; - - private final JobHashtable values_ = new JobHashtable(); - private JobHashtable cachedChanges_ = null; - - private String name_, user_, number_, status_, type_, subtype_; - private AS400 system_; - private String internalJobID_; - private byte[] realInternalJobID_; - - private transient PropertyChangeSupport propertyChangeListeners_; - private transient VetoableChangeSupport vetoableChangeListeners_; - - private transient CommandCall cmdCall_; - private transient ProgramCall pgmCall_; - private transient ProgramCall pgmCall_onThread_; - private transient ProgramCall pgmCall_offThread_; - private transient Object remoteCommandLock_ = new Object(); - private transient AS400Timestamp timestampConverter_; - - /** - Job attribute representing an identifier assigned to the job by the system to collect resource use information for the job when job accounting is active. The user who is changing this field must have authority to the CHGACGCDE CL command. If the user does not have the proper authority, this field is ignored and processing continues. Possible values are: -
        -
      • {@link #ACCOUNTING_CODE_BLANK ACCOUNTING_CODE_BLANK} -
      • An accounting code - The 15 character accounting code used for the next accounting segment. The accounting code may contain alphabetic or numeric characters. -
      -

      Type: String - @see #getJobAccountingCode - @see #setJobAccountingCode - **/ - public static final int ACCOUNTING_CODE = 1001; - - /** - Constant indicating the accounting code is changed to all blanks. - @see #ACCOUNTING_CODE - **/ - public static final String ACCOUNTING_CODE_BLANK = "*BLANK"; - - /** - Job attribute representing the active status of the initial thread of a job. Only one status is returned. Possible values are: -

        -
      • {@link #ACTIVE_JOB_STATUS_NONE ACTIVE_JOB_STATUS_NONE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_BIN_SYNCH_DEVICE_AND_ACTIVE ACTIVE_JOB_STATUS_WAIT_BIN_SYNCH_DEVICE_AND_ACTIVE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_BIN_SYNCH_DEVICE ACTIVE_JOB_STATUS_WAIT_BIN_SYNCH_DEVICE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_COMM_DEVICE_AND_ACTIVE ACTIVE_JOB_STATUS_WAIT_COMM_DEVICE_AND_ACTIVE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_COMM_DEVICE ACTIVE_JOB_STATUS_WAIT_COMM_DEVICE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_CHECKPOINT ACTIVE_JOB_STATUS_WAIT_CHECKPOINT} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_CONDITION ACTIVE_JOB_STATUS_WAIT_CONDITION} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_CPI_COMM ACTIVE_JOB_STATUS_WAIT_CPI_COMM} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_DEQUEUE_AND_ACTIVE ACTIVE_JOB_STATUS_WAIT_DEQUEUE_AND_ACTIVE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_DEQUEUE ACTIVE_JOB_STATUS_WAIT_DEQUEUE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_DISKETTE_AND_ACTIVE ACTIVE_JOB_STATUS_WAIT_DISKETTE_AND_ACTIVE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_DISKETTE ACTIVE_JOB_STATUS_WAIT_DISKETTE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_DELAYED ACTIVE_JOB_STATUS_WAIT_DELAYED} -
      • {@link #ACTIVE_JOB_STATUS_DISCONNECTED ACTIVE_JOB_STATUS_DISCONNECTED} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_DISPLAY_AND_ACTIVE ACTIVE_JOB_STATUS_WAIT_DISPLAY_AND_ACTIVE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_DISPLAY ACTIVE_JOB_STATUS_WAIT_DISPLAY} -
      • {@link #ACTIVE_JOB_STATUS_ENDED ACTIVE_JOB_STATUS_ENDED} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_DATABASE_EOF_AND_ACTIVE ACTIVE_JOB_STATUS_WAIT_DATABASE_EOF_AND_ACTIVE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_DATABASE_EOF ACTIVE_JOB_STATUS_WAIT_DATABASE_EOF} -
      • {@link #ACTIVE_JOB_STATUS_ENDING ACTIVE_JOB_STATUS_ENDING} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_EVENT ACTIVE_JOB_STATUS_WAIT_EVENT} -
      • {@link #ACTIVE_JOB_STATUS_SUSPENDED ACTIVE_JOB_STATUS_SUSPENDED} -
      • {@link #ACTIVE_JOB_STATUS_HELD ACTIVE_JOB_STATUS_HELD} -
      • {@link #ACTIVE_JOB_STATUS_HELD_THREAD ACTIVE_JOB_STATUS_HELD_THREAD} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_ICF_FILE_AND_ACTIVE ACTIVE_JOB_STATUS_WAIT_ICF_FILE_AND_ACTIVE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_ICF_FILE ACTIVE_JOB_STATUS_WAIT_ICF_FILE} -
      • {@link #ACTIVE_JOB_STATUS_INELIGIBLE ACTIVE_JOB_STATUS_INELIGIBLE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_JAVA_AND_ACTIVE ACTIVE_JOB_STATUS_WAIT_JAVA_AND_ACTIVE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_JAVA ACTIVE_JOB_STATUS_WAIT_JAVA} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_LOCK ACTIVE_JOB_STATUS_WAIT_LOCK} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_LOCK_SPACE_AND_ACTIVE ACTIVE_JOB_STATUS_WAIT_LOCK_SPACE_AND_ACTIVE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_LOCK_SPACE ACTIVE_JOB_STATUS_WAIT_LOCK_SPACE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_MULTIPLE_FILES_AND_ACTIVE ACTIVE_JOB_STATUS_WAIT_MULTIPLE_FILES_AND_ACTIVE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_MULTIPLE_FILES ACTIVE_JOB_STATUS_WAIT_MULTIPLE_FILES} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_MESSAGE ACTIVE_JOB_STATUS_WAIT_MESSAGE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_MUTEX ACTIVE_JOB_STATUS_WAIT_MUTEX} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_MIXED_DEVICE_FILE ACTIVE_JOB_STATUS_WAIT_MIXED_DEVICE_FILE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_OPTICAL_DEVICE_AND_ACTIVE ACTIVE_JOB_STATUS_WAIT_OPTICAL_DEVICE_AND_ACTIVE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_OPTICAL_DEVICE ACTIVE_JOB_STATUS_WAIT_OPTICAL_DEVICE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_OSI ACTIVE_JOB_STATUS_WAIT_OSI} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_PRINT_AND_ACTIVE ACTIVE_JOB_STATUS_WAIT_PRINT_AND_ACTIVE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_PRINT ACTIVE_JOB_STATUS_WAIT_PRINT} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_PRESTART ACTIVE_JOB_STATUS_WAIT_PRESTART} -
      • {@link #ACTIVE_JOB_STATUS_RUNNING ACTIVE_JOB_STATUS_RUNNING} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_SELECTION ACTIVE_JOB_STATUS_WAIT_SELECTION} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_SEMAPHORE ACTIVE_JOB_STATUS_WAIT_SEMAPHORE} -
      • {@link #ACTIVE_JOB_STATUS_STOPPED ACTIVE_JOB_STATUS_STOPPED} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_SIGNAL ACTIVE_JOB_STATUS_WAIT_SIGNAL} -
      • {@link #ACTIVE_JOB_STATUS_SUSPENDED_SYSTEM_REQUEST ACTIVE_JOB_STATUS_SUSPENDED_SYSTEM_REQUEST} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_SAVE_FILE_AND_ACTIVE ACTIVE_JOB_STATUS_WAIT_SAVE_FILE_AND_ACTIVE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_SAVE_FILE ACTIVE_JOB_STATUS_WAIT_SAVE_FILE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_TAPE_DEVICE_AND_ACTIVE ACTIVE_JOB_STATUS_WAIT_TAPE_DEVICE_AND_ACTIVE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_TAPE_DEVICE ACTIVE_JOB_STATUS_WAIT_TAPE_DEVICE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_THREAD ACTIVE_JOB_STATUS_WAIT_THREAD} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_TIME_INTERVAL_AND_ACTIVE ACTIVE_JOB_STATUS_WAIT_TIME_INTERVAL_AND_ACTIVE} -
      • {@link #ACTIVE_JOB_STATUS_WAIT_TIME_INTERVAL ACTIVE_JOB_STATUS_WAIT_TIME_INTERVAL} -
      -

      Read-only: true -

      Type: String - **/ - public static final int ACTIVE_JOB_STATUS = 101; - - /** - Constant indicating that a job is in transition or is not active. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_NONE = " "; - - /** - Constant indicating that a job is waiting in a pool activity level for the completion of an I/O operation to a binary synchronous device. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_BIN_SYNCH_DEVICE_AND_ACTIVE = "BSCA"; - - /** - Constant indicating that a job is waiting for the completion of an I/O operation to a binary synchronous device. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_BIN_SYNCH_DEVICE = "BSCW"; - - /** - Constant indicating that a job is waiting in a pool activity level for the completion of an I/O operation to a communications device. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_COMM_DEVICE_AND_ACTIVE = "CMNA"; - - /** - Constant indicating that a job is waiting for the completion of an I/O operation to a communications device. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_COMM_DEVICE = "CMNW"; - - /** - Constant indicating that a job is waiting for the completion of save-while-active checkpoint processing in another job. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_CHECKPOINT = "CMTW"; - - /** - Constant indicating that a job is waiting on a handle-based condition. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_CONDITION = "CNDW"; - - /** - Constant indicating that a job is waiting for the completion of a CPI communications call. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_CPI_COMM = "CPCW"; - - /** - Constant indicating that a job is waiting in the pool activity level for completion of a dequeue operation. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_DEQUEUE_AND_ACTIVE = "DEQA"; - - /** - Constant indicating that a job is waiting for completion of a dequeue operation. For example, QSYSARB and subsystem monitors generally wait for work by waiting for a dequeue operation. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_DEQUEUE = "DEQW"; - - /** - Constant indicating that a job is waiting in a pool activity level for the completion of an I/O operation to a diskette unit. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_DISKETTE_AND_ACTIVE = "DKTA"; - - /** - Constant indicating that a job is waiting for the completion of an I/O operation to a diskette unit. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_DISKETTE = "DKTW"; - - /** - Constant indicating that a job is waiting for a specified time interval to end, or for a specific delay end time, as specified on the Delay Job (DLYJOB) command. The FUNCTION_NAME attribute shows either the number of seconds the job is to delay (999999), or the specific time when the job is to resume running. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_DELAYED = "DLYW"; - - /** - Constant indicating that a job is waiting for a specified time interval to end, or for a specific delay end time, as specified on the Delay Job (DLYJOB) command. The FUNCTION_NAME attribute shows either the number of seconds the job is to delay (999999), or the specific time when the job is to resume running. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_DELAY = "DLYW"; - - /** - Constant indicating that a job was disconnected from a work station display. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_DISCONNECTED = "DSC "; - - /** - Constant indicating that a job is waiting in a pool activity level for input from a work station display. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_DISPLAY_AND_ACTIVE = "DSPA"; - - /** - Constant indicating that a job is waiting for input from a work station display. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_DISPLAY = "DSPW"; - - /** - Constant indicating that a job has been ended with the *IMMED option, or its delay time has ended with the *CNTRLD option. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_ENDED = "END "; - - /** - Constant indicating that a job is waiting in a pool activity level to try a read operation again on a database file after the end-of-file (EOF) has been reached. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_DATABASE_EOF_AND_ACTIVE = "EOFA"; - - /** - Constant indicating that a job is waiting to try a read operation again on a database file after the end-of-file (EOF) has been reached. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_DATABASE_EOF = "EOFW"; - - /** - Constant indicating that a job is ending for a reason other than running the End Job (ENDJOB) or End Subsystem (ENDSBS) commands, such as a SIGNOFF command, an End Group Job (ENDGRPJOB) command, or an exception that is not handled. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_ENDING = "EOJ "; - - /** - Constant indicating that a job is waiting for an event. For example, QLUS and SCPF generally wait for work by waiting for an event. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_EVENT = "EVTW"; - - /** - Constant indicating that a job is suspended by a Transfer Group Job (TFRGRPJOB) command. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_SUSPENDED = "GRP "; - - /** - Constant indicating that a job is held. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_HELD = "HLD "; - - /** - Constant indicating that a job is held due to a suspended thread. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_HELD_THREAD = "HLDT"; - - /** - Constant indicating that a job is waiting in a pool activity level for the completion of an I/O operation to an intersystem communications function (ICF) file. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_ICF_FILE_AND_ACTIVE = "ICFA"; - - /** - Constant indicating that a job is waiting for the completion of an I/O operation to an intersystem communications function (ICF) file. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_ICF_FILE = "ICFW"; - - /** - Constant indicating that a job is ineligible and not currently in a pool activity level. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_INELIGIBLE = "INEL"; - - /** - Constant indicating that a job is waiting in a pool activity level for a Java program operation to complete. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_JAVA_AND_ACTIVE = "JVAA"; - - /** - Constant indicating that a job is waiting for a Java program operation to complete. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_JAVA = "JVAW"; - - /** - Constant indicating that a job is waiting for a lock. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_LOCK = "LCKW"; - - /** - Constant indicating that a job is waiting in a pool activity level for for a lock space to be attached. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_LOCK_SPACE_AND_ACTIVE = "LSPA"; - - /** - Constant indicating that a job is waiting for a lock space to be attached. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_LOCK_SPACE = "LSPW"; - - /** - Constant indicating that a job is waiting in a pool activity level for the completion of an I/O operation to multiple files. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_MULTIPLE_FILES_AND_ACTIVE = "MLTA"; - - /** - Constant indicating that a job is waiting for the completion of an I/O operation to multiple files. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_MULTIPLE_FILES = "MLTW"; - - /** - Constant indicating that a job is waiting for a message from a message queue. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_MESSAGE = "MSGW"; - - /** - Constant indicating that a job is waiting for a mutex. A mutex is a synchronization function that is used to allow multiple jobs or threads to serialize their access to shared data. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_MUTEX = "MTXW"; - - /** - Constant indicating that a job is waiting for the completion of an I/O operation to a mixed device file. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_MIXED_DEVICE_FILE = "MXDW"; - - /** - Constant indicating that a job is waiting in a pool activity level for the completion of an I/O operation to an optical device. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_OPTICAL_DEVICE_AND_ACTIVE = "OPTA"; - - /** - Constant indicating that a job is waiting for the completion of an I/O operation to an optical device. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_OPTICAL_DEVICE = "OPTW"; - - /** - Constant indicating that a job is waiting for the completion of an OSI Communications Subsystem operation. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_OSI = "OSIW"; - - /** - Constant indicating that a job is waiting in a pool activity level for output to a printer to complete. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_PRINT_AND_ACTIVE = "PRTA"; - - /** - Constant indicating that a job is waiting for output to a printer to complete. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_PRINT = "PRTW"; - - /** - Constant indicating that a prestart job is waiting for a program start request. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_PRESTART = "PSRW"; - - /** - Constant indicating that a job is currently running in a pool activity level. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_RUNNING = "RUN "; - - /** - Constant indicating that a job is waiting for a selection to complete. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_SELECTION = "SELW"; - - /** - Constant indicating that a job is waiting for a semaphore. A semaphore is a synchronization function that is used to allow multiple jobs or threads to serialize their access to shared data. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_SEMAPHORE = "SEMW"; - - /** - Constant indicating that a job has stopped as the result of a signal. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_STOPPED = "SIGS"; - - /** - Constant indicating that a job is waiting for a signal. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_SIGNAL = "SIGW"; - - /** - Constant indicating that a job is the suspended half of a system request job pair. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_SUSPENDED_SYSTEM_REQUEST = "SRQ "; - - /** - Constant indicating that a job is waiting in a pool activity level for the completion of a save file operation. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_SAVE_FILE_AND_ACTIVE = "SVFA"; - - /** - Constant indicating that a job is waiting for the completion of a save file operation. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_SAVE_FILE = "SVFW"; - - /** - Constant indicating that a job is waiting in a pool activity level for the completion of an I/O operation to a tape device. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_TAPE_DEVICE_AND_ACTIVE = "TAPA"; - - /** - Constant indicating that a job is waiting for the completion of an I/O operation to a tape device. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_TAPE_DEVICE = "TAPW"; - - /** - Constant indicating that a job is waiting for another thread to complete an operation. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_THREAD = "THDW"; - - /** - Constant indicating that a job is waiting in a pool activity level for a time interval to end. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_TIME_INTERVAL_AND_ACTIVE = "TIMA"; - - /** - Constant indicating that a job is waiting for a time interval to end. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ACTIVE_JOB_STATUS_WAIT_TIME_INTERVAL = "TIMW"; - - /** - Job attribute representing the status of what the initial thread of a job is currently doing, when the active job status is ACTIVE_JOB_STATUS_ENDED or ACTIVE_JOB_STATUS_ENDING. This field is blank if the job is not ending currently. See {@link #ACTIVE_JOB_STATUS ACTIVE_JOB_STATUS} for a list of the possible values. For example, the active job status would be ACTIVE_JOB_STATUS_ENDING, but the job could be waiting on a lock that could keep the job from ending. This field would then be ACTIVE_JOB_STATUS_WAIT_LOCK. -

      Read-only: true -

      Type: String -

      Only valid on V5R1 systems and higher. - @see #ACTIVE_JOB_STATUS - **/ - public static final int ACTIVE_JOB_STATUS_FOR_JOBS_ENDING = 103; - - /** - Job attribute representing whether a job allows multiple user threads. This attribute - does not prevent the operating system from creating system threads in the job. Possible values are: -

        -
      • {@link #ALLOW_MULTIPLE_THREADS_NO ALLOW_MULTIPLE_THREADS_NO} -
      • {@link #ALLOW_MULTIPLE_THREADS_YES ALLOW_MULTIPLE_THREADS_YES} -
      -

      Read-only: true -

      Type: String -

      Only valid on V5R1 systems and higher. - **/ - public static final int ALLOW_MULTIPLE_THREADS = 102; - - /** - Constant indicating that a job does not allow multiple user threads. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ALLOW_MULTIPLE_THREADS_NO = "0"; - - /** - Constant indicating that a job allows multiple user threads. - @see #ACTIVE_JOB_STATUS - **/ - public static final String ALLOW_MULTIPLE_THREADS_YES = "1"; - - /** - Job attribute representing the number of auxiliary I/O requests performed by the job across all routing steps. This includes both database and nondatabase paging. If the number of auxiliary I/O requests is greater than or equal to 2,147,483,647, a value of -1 is returned. Use the AUXILIARY_IO_REQUESTS_LARGE attribute to retrieve values that are greater than or equal to 2,147,483,647. -

      Read-only: true -

      Type: Integer - @see #getAuxiliaryIORequests - **/ - public static final int AUXILIARY_IO_REQUESTS = 1401; - - /** - Job attribute representing the number of auxiliary I/O requests performed by the job across all routing steps. This includes both database and nondatabase paging. -

      Read-only: true -

      Type: Long -

      Only valid on V5R1 systems and higher. - @see #getAuxiliaryIORequests - **/ - public static final int AUXILIARY_IO_REQUESTS_LARGE = 1406; - - /** - Job attribute representing how a job handles break messages. Possible values are: -

        -
      • {@link #BREAK_MESSAGE_HANDLING_NORMAL BREAK_MESSAGE_HANDLING_NORMAL} -
      • {@link #BREAK_MESSAGE_HANDLING_HOLD BREAK_MESSAGE_HANDLING_HOLD} -
      • {@link #BREAK_MESSAGE_HANDLING_NOTIFY BREAK_MESSAGE_HANDLING_NOTIFY} -
      -

      Type: String - @see #getBreakMessageHandling - @see #setBreakMessageHandling - **/ - public static final int BREAK_MESSAGE_HANDLING = 201; - - /** - Constant indicating that the message queue status determines break message handling. - @see #BREAK_MESSAGE_HANDLING - **/ - public static final String BREAK_MESSAGE_HANDLING_NORMAL = "*NORMAL"; - - /** - Constant indicating that the message queue holds break messages until a user or program requests them. The work station user uses the Display Message (DPSMSG) command to display the messages; a program must issue a Receive Message (RCVMSG) command to receive a message and handle it. - @see #BREAK_MESSAGE_HANDLING - **/ - public static final String BREAK_MESSAGE_HANDLING_HOLD = "*HOLD"; - - /** - Constant indicating that the system notifies the job's message queue when a message arrives. For interactive jobs, the audible alarm sounds if there is one, and the message-waiting light comes on. - @see #BREAK_MESSAGE_HANDLING - **/ - public static final String BREAK_MESSAGE_HANDLING_NOTIFY = "*NOTIFY"; - - /** - Job attribute representing the coded character set identifier used for this job. Possible values are: -

        -
      • {@link #CCSID_SYSTEM_VALUE CCSID_SYSTEM_VALUE} -
      • {@link #CCSID_INITIAL_USER CCSID_INITIAL_USER} -
      • A coded character set identifier. -
      -

      Type: Integer - @see #getCodedCharacterSetID - @see #setCodedCharacterSetID - **/ - public static final int CCSID = 302; - - /** - Constant indicating that the CCSID specified in the system value QCCSID is used. - @see #CCSID - **/ - public static final int CCSID_SYSTEM_VALUE = -1; - - /** - Constant indicating that the CCSID specified in the user profile under which this thread was initially running is used. - @see #CCSID - **/ - public static final int CCSID_INITIAL_USER = -2; - - /** - Job attribute representing the character identifier control for a job. This attribute controls the type of CCSID conversion that occurs for display files, printer files, and panel groups. The *CHRIDCTL special value must be specified on the CHRID command parameter on the create, change, or override command for display files, printer files, and panel groups before this attribute will be used. Possible values are: -

        -
      • {@link #CHARACTER_ID_CONTROL_DEVICE CHARACTER_ID_CONTROL_DEVICE} -
      • {@link #CHARACTER_ID_CONTROL_JOB CHARACTER_ID_CONTROL_JOB} -
      • {@link #CHARACTER_ID_CONTROL_SYSTEM_VALUE CHARACTER_ID_CONTROL_SYSTEM_VALUE} -
      • {@link #CHARACTER_ID_CONTROL_INITIAL_USER CHARACTER_ID_CONTROL_INITIAL_USER} -
      -

      Type: String - **/ - public static final int CHARACTER_ID_CONTROL = 311; - - /** - Constant indicating to perform the same function for *DEVD as on the CHRID command parameter for display files, printer files, and panel groups. - @see #CHARACTER_ID_CONTROL - **/ - public static final String CHARACTER_ID_CONTROL_DEVICE = "*DEVD"; - - /** - Constant indicating to perform the same function for *JOBCCSID as on the CHRID command parameter for display files, printer files, and panel groups. - @see #CHARACTER_ID_CONTROL - **/ - public static final String CHARACTER_ID_CONTROL_JOB = "*JOBCCSID"; - - /** - Constant indicating the value in the QCHRIDCTL system value will be used. - @see #CHARACTER_ID_CONTROL - **/ - public static final String CHARACTER_ID_CONTROL_SYSTEM_VALUE = "*SYSVAL"; - - /** - Constant indicating the CHRIDCTL specified in the user profile under which this thread was initially running will be used. - @see #CHARACTER_ID_CONTROL - **/ - public static final String CHARACTER_ID_CONTROL_INITIAL_USER = "*USRPRF"; - - /** - Job attribute representing the IPv4 address of the client for which this system is doing work. An address is expressed in standard IPv4 dotted-decimal form www.xxx.yyy.zzz (for example, 130.99.128.1). This field is not guaranteed to be an IP address. This field will be blank if the address is not explicitly set to a value by the Change Job (QWTCHGJB) API. -

      Read-only: true -

      Type: String - **/ - public static final int CLIENT_IP_ADDRESS = 318; - - /** - Job attribute representing the completion status for a job. Possible values are: -

        -
      • {@link #COMPLETION_STATUS_NOT_COMPLETED COMPLETION_STATUS_NOT_COMPLETED} -
      • {@link #COMPLETION_STATUS_COMPLETED_NORMALLY COMPLETION_STATUS_COMPLETED_NORMALLY} -
      • {@link #COMPLETION_STATUS_COMPLETED_ABNORMALLY COMPLETION_STATUS_COMPLETED_ABNORMALLY} -
      -

      Read-only: true -

      Type: String - @see #getCompletionStatus - **/ - public static final int COMPLETION_STATUS = 306; - - /** - Constant indicating that the job has not completed. - @see #COMPLETION_STATUS - **/ - public static final String COMPLETION_STATUS_NOT_COMPLETED = " "; - - /** - Constant indicating that the job completed normally. - @see #COMPLETION_STATUS - **/ - public static final String COMPLETION_STATUS_COMPLETED_NORMALLY = "0"; - - /** - Constant indicating that the job completed abnormally. - @see #COMPLETION_STATUS - **/ - public static final String COMPLETION_STATUS_COMPLETED_ABNORMALLY = "1"; - - /** - Job attribute representing whether or not the system issued a controlled cancellation. Possible values are: -

        -
      • {@link #END_STATUS_CANCELLED END_STATUS_CANCELLED} -
      • {@link #END_STATUS_NOT_CANCELLED END_STATUS_NOT_CANCELLED} -
      • {@link #END_STATUS_JOB_NOT_RUNNING END_STATUS_JOB_NOT_RUNNING} -
      -

      Read-only: true -

      Type: String - **/ - public static final int CONTROLLED_END_REQUESTED = 502; // End status. - - /** - Constant indicating that the system, the subsystem in which a job is running, or the job itself is cancelled. - @see #CONTROLLED_END_REQUESTED - **/ - public static final String END_STATUS_CANCELLED = "1"; - - /** - Constant indicating that the system, the subsystem in which a job is running, or the job itself is not cancelled. - @see #CONTROLLED_END_REQUESTED - **/ - public static final String END_STATUS_NOT_CANCELLED = "0"; - - /** - Constant indicating that the job is not running. - @see #CONTROLLED_END_REQUESTED - **/ - public static final String END_STATUS_JOB_NOT_RUNNING = " "; - - // Job attribute representing the total number of disk I/O operations performed by the job across all routing steps. This is the sum of the asynchronous and synchronous disk I/O. - //

      Note: This field is only valid for Job objects created from a JobList. - //

      Read-only: true - //

      Type: Long - // public static final int DISK_IO = 415; - // This attribute should be enabled when JobList is updated to handle the OLJB0300 format for the QGYOLJOB API. - - /** - Job attribute representing the percentage of processing time used during the elapsed time. For multiple-processor systems, this is the average across processors. -

      Read-only: true -

      Type: Integer - @see #resetStatistics - **/ - public static final int ELAPSED_CPU_PERCENT_USED = 314; - - /** - Job attribute representing the percentage of processing unit used for database processing during the elapsed time. For multiple-processor systems, this is the average across processors. -

      Read-only: true -

      Type: Integer - @see #resetStatistics - **/ - public static final int ELAPSED_CPU_PERCENT_USED_FOR_DATABASE = 316; - - /** - Job attribute representing the amount of processing unit time (in milliseconds) used during the elapsed time. -

      Read-only: true -

      Type: Long - @see #resetStatistics - **/ - public static final int ELAPSED_CPU_TIME_USED = 315; - - /** - Job attribute representing the amount of processing unit time (in milliseconds) used for database processing during the elapsed time. -

      Read-only: true -

      Type: Long - @see #resetStatistics - **/ - public static final int ELAPSED_CPU_TIME_USED_FOR_DATABASE = 317; - - /** - Job attribute representing the number of disk I/O operations performed by the job during the elapsed time. This is the sum of the {@link #ELAPSED_DISK_IO_ASYNCH asynchronous} and {@link #ELAPSED_DISK_IO_SYNCH synchronous} disk I/O. -

      Read-only: true -

      Type: Long - @see #resetStatistics - **/ - public static final int ELAPSED_DISK_IO = 414; - - /** - Job attribute representing the number of asynchronous (physical) disk I/O operations performed by the job during the elapsed time. This is the sum of the asynchronous database and nondatabase reads and writes. -

      Read-only: true -

      Type: Long - @see #resetStatistics - **/ - public static final int ELAPSED_DISK_IO_ASYNCH = 416; - - /** - Job attribute representing the number of synchronous (physical) disk I/O operations performed by the job during the elapsed time. This is the sum of the synchronous database and nondatabase reads and writes. -

      Read-only: true -

      Type: Long - @see #resetStatistics - **/ - public static final int ELAPSED_DISK_IO_SYNCH = 417; - - /** - Job attribute representing the total interactive response time for the initial thread (in hundredths of seconds) for the job during the elapsed time. This does not include the time used by the machine, by the attached input/output (I/O) hardware, and by the transmission lines for sending and receiving data. This field is 0 for noninteractive jobs. -

      Read-only: true -

      Type: Integer - @see #resetStatistics - **/ - public static final int ELAPSED_INTERACTIVE_RESPONSE_TIME = 904; - - /** - Job attribute representing the number of user interactions, such as pressing the Enter key or a function key, for the job during the elapsed time for the initial thread. This field is 0 for noninteractive jobs. -

      Read-only: true -

      Type: Integer - @see #resetStatistics - **/ - public static final int ELAPSED_INTERACTIVE_TRANSACTIONS = 905; - - /** - Job attribute representing the amount of time (in milliseconds) that the initial thread has to wait to obtain database, nondatabase, and internal machine locks during the elapsed time. -

      Read-only: true -

      Type: Long -

      Can be loaded by JobList: false - @see #resetStatistics - **/ - public static final int ELAPSED_LOCK_WAIT_TIME = 10008; // Cannot pre-load. - - /** - Job attribute representing the number of times an active program referenced an address that is not in main storage for the current routing step during the elapsed time. -

      Read-only: true -

      Type: Long - @see #resetStatistics - **/ - public static final int ELAPSED_PAGE_FAULTS = 1609; - - /** - Job attribute representing the time (in milliseconds) that has elapsed between the measurement start time and the current system time. The measurement start time is reset when the {@link #resetStatistics resetStatistics()} method is called. -

      Read-only: true -

      Type: Long -

      Can be loaded by JobList: false - @see #resetStatistics - **/ - public static final int ELAPSED_TIME = 10007; // Cannot pre-load as a key. - - /** - Job attribute representing the country or region identifier associated with this job. Possible values are: -

        -
      • {@link #COUNTRY_ID_SYSTEM_VALUE COUNTRY_ID_SYSTEM_VALUE} -
      • {@link #COUNTRY_ID_INITIAL_USER COUNTRY_ID_INITIAL_USER} -
      • A country or region identifier. -
      -

      Type: String - @see #getCountryID - @see #setCountryID - **/ - public static final int COUNTRY_ID = 303; - - /** - Constant indicating the system value QCNTRYID is used. - @see #COUNTRY_ID - **/ - public static final String COUNTRY_ID_SYSTEM_VALUE = "*SYSVAL"; - - /** - Constant indicating the country or region ID specified in the user profile under which this thread was initially running is used. - @see #COUNTRY_ID - **/ - public static final String COUNTRY_ID_INITIAL_USER = "*USRPRF"; - - /** - Job attribute representing the amount of processing unit time (in milliseconds) that the job used. If the processing unit time used is greater than or equal to 2,147,483,647 milliseconds, a value of -1 is returned. Use the CPU_TIME_USED_LARGE attribute to retrieve values that are greater than or equal to 2,147,483,647. -

      Read-only: true -

      Type: Integer - @see #getCPUUsed - **/ - public static final int CPU_TIME_USED = 304; - - /** - Job attribute representing the amount of processing unit time (in milliseconds) that the job used across all routing steps. -

      Read-only: true -

      Type: Long - @see #getCPUUsed - **/ - public static final int CPU_TIME_USED_LARGE = 312; - - /** - Job attribute representing the amount of processing unit time (in milliseconds) that the job used for processing data base requests across all routing steps. -

      Read-only: true -

      Type: Long -

      Only valid on V5R1 systems and higher. - **/ - public static final int CPU_TIME_USED_FOR_DATABASE = 313; - - /** - Job attribute representing the name of the current library for the initial thread of the job. If no current library exists, the CURRENT_LIBRARY_EXISTENCE attribute returns 0 and this attribute returns an empty string (""). -

      Read-only: true -

      Type: String -

      Can be loaded by JobList: false - @see #getCurrentLibrary - **/ - public static final int CURRENT_LIBRARY = 10000; // Cannot preload. - - /** - Job attribute representing whether or not a current library exists for the job. Returns 0 if no current library exists; 1 if a current library exists. -

      Read-only: true -

      Type: Integer -

      Can be loaded by JobList: false - @see #getCurrentLibraryExistence - **/ - public static final int CURRENT_LIBRARY_EXISTENCE = 10001; // Cannot preload. - - /** - Job attribute representing the identifier of the system-related pool from which main storage is currently being allocated for the job's initial thread. These identifiers are not the same as those specified in the subsystem description, but are the same as the system pool identifiers shown on the system status display. If a thread reaches its time-slice end, the pool the thread is running in can be swiched based on the job's time-slice end pool value. The current system pool identifier returned will be the actual pool in which the initial thread of the job is running. -

      Read-only: true -

      Type: Integer - **/ - public static final int CURRENT_SYSTEM_POOL_ID = 307; - - /** - Job attribute representing the user profile that the initial thread of the job for which information is being retrieved is currently running under. This name may differ from the user portion of the job name. -

      Read-only: true -

      Type: String - **/ - public static final int CURRENT_USER = 305; - - /** - Job attribute representing the date and time when the job completed running on the system. -

      Read-only: true -

      Type: String in the format CYYMMDDHHMMSS - **/ - public static final int DATE_ENDED = 418; - - /** - Job attribute representing the date and time when the job was placed on the system. -

      Read-only: true -

      Type: String in the format CYYMMDDHHMMSS - @see #getDate - @see #getJobEnterSystemDate - **/ - public static final int DATE_ENTERED_SYSTEM = 402; - - /** - Job attribute representing the format in which dates are presented. Possible values are: -

        -
      • {@link #DATE_FORMAT_SYSTEM_VALUE DATE_FORMAT_SYSTEM_VALUE} -
      • {@link #DATE_FORMAT_YMD DATE_FORMAT_YMD} -
      • {@link #DATE_FORMAT_MDY DATE_FORMAT_MDY} -
      • {@link #DATE_FORMAT_DMY DATE_FORMAT_DMY} -
      • {@link #DATE_FORMAT_JULIAN DATE_FORMAT_JULIAN} -
      -

      Type: String - @see #getDateFormat - @see #setDateFormat - **/ - public static final int DATE_FORMAT = 405; - - /** - Constant indicating the system value QDATFMT is used. - @see #DATE_FORMAT - **/ - public static final String DATE_FORMAT_SYSTEM_VALUE = "*SYS"; - - /** - Constant indicating a date format of year, month, and day. - @see #DATE_FORMAT - **/ - public static final String DATE_FORMAT_YMD = "*YMD"; - - /** - Constant indicating a date format of month, day, and year. - @see #DATE_FORMAT - **/ - public static final String DATE_FORMAT_MDY = "*MDY"; - - /** - Constant indicating a date format of day, month, and year. - @see #DATE_FORMAT - **/ - public static final String DATE_FORMAT_DMY = "*DMY"; - - /** - Constant indicating a Julian date format (year and day). - @see #DATE_FORMAT - **/ - public static final String DATE_FORMAT_JULIAN = "*JUL"; - - /** - Job attribute representing the value used to separate days, months, and years when presenting a date. Possible values are: -

        -
      • {@link #DATE_SEPARATOR_SYSTEM_VALUE DATE_SEPARATOR_SYSTEM_VALUE} -
      • {@link #DATE_SEPARATOR_SLASH DATE_SEPARATOR_SLASH} -
      • {@link #DATE_SEPARATOR_DASH DATE_SEPARATOR_DASH} -
      • {@link #DATE_SEPARATOR_PERIOD DATE_SEPARATOR_PERIOD} -
      • {@link #DATE_SEPARATOR_BLANK DATE_SEPARATOR_BLANK} -
      • {@link #DATE_SEPARATOR_COMMA DATE_SEPARATOR_COMMA} -
      -

      Type: String - @see #getDateSeparator - @see #setDateSeparator - **/ - public static final int DATE_SEPARATOR = 406; - - /** - Constant indicating the system value QDATSEP is used for the date separator. - @see #DATE_SEPARATOR - **/ - public static final String DATE_SEPARATOR_SYSTEM_VALUE = "S"; - - /** - Constant indicating a slash (/) is used for the date separator. - @see #DATE_SEPARATOR - **/ - public static final String DATE_SEPARATOR_SLASH = "/"; - - /** - Constant indicating a dash (-) is used for the date separator. - @see #DATE_SEPARATOR - **/ - public static final String DATE_SEPARATOR_DASH = "-"; - - /** - Constant indicating a period (.) is used for the date separator. - @see #DATE_SEPARATOR - **/ - public static final String DATE_SEPARATOR_PERIOD = "."; - - /** - Constant indicating a blank is used for the date separator. - @see #DATE_SEPARATOR - **/ - public static final String DATE_SEPARATOR_BLANK = " "; - - /** - Constant indicating a comma (,) is used for the date separator. - @see #DATE_SEPARATOR - **/ - public static final String DATE_SEPARATOR_COMMA = ","; - - /** - Job attribute representing the date and time when the job began to run on the system. This is blank if the job did not become active. -

      Read-only: true -

      Type: String in the format CYYMMDDHHMMSS - @see #getJobActiveDate - **/ - public static final int DATE_STARTED = 401; - - /** - Job attribute representing whether the job is DBCS-capable or not. Possible values are: -

        -
      • {@link #DBCS_CAPABLE_NO DBCS_CAPABLE_NO} -
      • {@link #DBCS_CAPABLE_YES DBCS_CAPABLE_YES} -
      -

      Read-only: true -

      Type: String - **/ - public static final int DBCS_CAPABLE = 407; - - /** - Constant indicating that the job is not DBCS-capable. - @see #DBCS_CAPABLE - **/ - public static final String DBCS_CAPABLE_NO = "0"; - - /** - Constant indicating that the job is DBCS-capable. - @see #DBCS_CAPABLE - **/ - public static final String DBCS_CAPABLE_YES = "1"; - - /** - Job attribute representing the decimal format used for this job. Possible values are: -

        -
      • {@link #DECIMAL_FORMAT_SYSTEM_VALUE DECIMAL_FORMAT_SYSTEM_VALUE} -
      • {@link #DECIMAL_FORMAT_PERIOD DECIMAL_FORMAT_PERIOD} -
      • {@link #DECIMAL_FORMAT_COMMA_J DECIMAL_FORMAT_COMMA_J} -
      • {@link #DECIMAL_FORMAT_COMMA_I DECIMAL_FORMAT_COMMA_I} -
      -

      Type: String - @see #getDecimalFormat - @see #setDecimalFormat - **/ - public static final int DECIMAL_FORMAT = 413; - - /** - Constant indicating the value in the system value QDECFMT is used as the decimal format for this job. - @see #DECIMAL_FORMAT - **/ - public static final String DECIMAL_FORMAT_SYSTEM_VALUE = "*SYSVAL"; - - /** - Constant indicating a decimal format that uses a period for a decimal point, a comma for a 3-digit grouping character, and zero-suppresses to the left of the decimal point. - @see #DECIMAL_FORMAT - **/ - public static final String DECIMAL_FORMAT_PERIOD = ""; - - /** - Constant indicating a decimal format that uses a comma for a decimal point and a period for a 3-digit grouping character. The zero-suppression character is in the second position (rather than the first) to the left of the decimal notation. Balances with zero values to the left of the comma are written with one leading zero (0,04). This constant also overrides any edit codes that might suppress the leading zero. - @see #DECIMAL_FORMAT - **/ - public static final String DECIMAL_FORMAT_COMMA_J = "J"; - - /** - Constant indicating a decimal format that uses a comma for a decimal point, a period for a 3-digit grouping character, and zero-suppresses to the left of the decimal point. - @see #DECIMAL_FORMAT - **/ - public static final String DECIMAL_FORMAT_COMMA_I = "I"; - - /** - Job attribute representing the default coded character set identifier (CCSID) used for this job. This attribute returns zero if the job is not an active job. -

      Read-only: true -

      Type: Integer - @see #getDefaultCodedCharacterSetIdentifier - **/ - public static final int DEFAULT_CCSID = 412; - - /** - Job attribute representing the default maximum time (in seconds) that a thread in the job waits for a system instruction, such as a LOCK machine interface (MI) instruction, to acquire a resource. This default wait time is used when a wait time is not otherwise specified for a given situation. Normally, this is the amount of time the user is willing to wait for the system before the request is ended. If the job consists of multiple routing steps, a change to this attribute during a routing step does not appy to subsequent routing steps. The valid range is 1 through 9999999. A value of -1 represents no maximum wait time (*NOMAX). -

      Type: Integer - @see #getDefaultWait - @see #setDefaultWait - **/ - public static final int DEFAULT_WAIT_TIME = 409; - - /** - Job attribute representing the action taken for interactive jobs when an I/O error occurs for the job's requesting program device. Possible values are: -

        -
      • {@link #DEVICE_RECOVERY_ACTION_SYSTEM_VALUE DEVICE_RECOVERY_ACTION_SYSTEM_VALUE} -
      • {@link #DEVICE_RECOVERY_ACTION_MESSAGE DEVICE_RECOVERY_ACTION_MESSAGE} -
      • {@link #DEVICE_RECOVERY_ACTION_DISCONNECT_MESSAGE DEVICE_RECOVERY_ACTION_DISCONNECT_MESSAGE} -
      • {@link #DEVICE_RECOVERY_ACTION_DISCONNECT_END_REQUEST DEVICE_RECOVERY_ACTION_DISCONNECT_END_REQUEST} -
      • {@link #DEVICE_RECOVERY_ACTION_END_JOB DEVICE_RECOVERY_ACTION_END_JOB} -
      • {@link #DEVICE_RECOVERY_ACTION_END_JOB_NO_LIST DEVICE_RECOVERY_ACTION_END_JOB_NO_LIST} -
      -

      Type: String - @see #getDeviceRecoveryAction - @see #setDeviceRecoveryAction - **/ - public static final int DEVICE_RECOVERY_ACTION = 410; - - /** - Constant indicating the value in the system value QDEVRCYACN is used as the device recovery action for this job. - @see #DEVICE_RECOVERY_ACTION - **/ - public static final String DEVICE_RECOVERY_ACTION_SYSTEM_VALUE = "*SYSVAL"; - - /** - Constant indicating a device recovery action that signals the I/O error message to the application and lets the application program perform error recovery. - @see #DEVICE_RECOVERY_ACTION - **/ - public static final String DEVICE_RECOVERY_ACTION_MESSAGE = "*MSG"; - - /** - Constant indicating a device recovery action that disconnects the job when an I/O error occurs. When the job reconnects, the system sends an error message to the application program, indicating the job has reconnected and that the work station device has recovered. - @see #DEVICE_RECOVERY_ACTION - **/ - public static final String DEVICE_RECOVERY_ACTION_DISCONNECT_MESSAGE = "*DSCMSG"; - - /** - Constant indicating a device recovery action that disconnects the job when an I/O error occurs. When the job reconnects, the system sends the End Request (ENDRQS) command to return control to the previous request level. - @see #DEVICE_RECOVERY_ACTION - **/ - public static final String DEVICE_RECOVERY_ACTION_DISCONNECT_END_REQUEST = "*DSCENDRQS"; - - /** - Constant indicating a device recovery action that ends the job when an I/O error occurs. A message is sent to the job's log and to the history log (QHST) indicating the job ended because of a device error. - @see #DEVICE_RECOVERY_ACTION - **/ - public static final String DEVICE_RECOVERY_ACTION_END_JOB = "*ENDJOB"; - - /** - Constant indicating a device recovery action that ends the job when an I/O error occurs. There is no job log produced for the job. The system sends a message to the QHST log indicating the job ended because of a device error. - @see #DEVICE_RECOVERY_ACTION - **/ - public static final String DEVICE_RECOVERY_ACTION_END_JOB_NO_LIST = "*ENDJOBNOLIST"; - - /** - Job attribute representing whether or not the job is eligible to be moved out of main storage and put into auxiliary storage at the end of a time slice or when entering a long wait (such as waiting for a work station user's response). This attribute is ignored when more than one thread is active within the job. If the job consists of multiple routing steps, a change to this attribute during a routing step does not apply to subsequent routing steps. Possible values are: -

        -
      • {@link #ELIGIBLE_FOR_PURGE_YES ELIGIBLE_FOR_PURGE_YES} -
      • {@link #ELIGIBLE_FOR_PURGE_NO ELIGIBLE_FOR_PURGE_NO} -
      • {@link #ELIGIBLE_FOR_PURGE_IGNORED ELIGIBLE_FOR_PURGE_IGNORED} -
      -

      Type: String - @see #getPurge - @see #setPurge - **/ - public static final int ELIGIBLE_FOR_PURGE = 1604; - - /** - Constant indicating that the job is eligible to be moved out of main storage and put into auxiliary storage. A job with multiple threads, however, is never purged from main storage. - @see #ELIGIBLE_FOR_PURGE - **/ - public static final String ELIGIBLE_FOR_PURGE_YES = "*YES"; - - /** - Constant indicating that a job is not eligible to be moved out of main storage and put into auxiliary storage. When main storage is needed, however, pages belonging to a thread in the job may be moved to auxiliary storage. Then, when a thread in the job runs again, its pages are returned to main storage as they are needed. - @see #ELIGIBLE_FOR_PURGE - **/ - public static final String ELIGIBLE_FOR_PURGE_NO = "*NO"; - - /** - Constant indicating that whether a job is eligible for purge or not is ignored because the job type is either *JOBQ or *OUTQ, or the job is not valid. - @see #ELIGIBLE_FOR_PURGE - **/ - public static final String ELIGIBLE_FOR_PURGE_IGNORED = ""; - - /** - Job attribute representing the message severity level of escape messages that can cause a batch job to end. The batch job ends when a request in the batch input stream sends an escape message, whose severity is equal to or greater than this value, to the request processing program. -

      Read-only: true -

      Type: Integer - @see #getEndSeverity - **/ - public static final int END_SEVERITY = 501; - - /** - Job attribute representing additional information (as described by the FUNCTION_TYPE attribute) about the last high-level function initiated by the initial thread. -

      Read-only: true -

      Type: String - @see #getFunctionName - **/ - public static final int FUNCTION_NAME = 601; - - /** - Job attribute representing the last high-level function initiated by the initial thread. This field may not be cleared when a function is completed. Possible values are: -

        -
      • {@link #FUNCTION_TYPE_BLANK FUNCTION_TYPE_BLANK} -
      • {@link #FUNCTION_TYPE_COMMAND FUNCTION_TYPE_COMMAND} -
      • {@link #FUNCTION_TYPE_DELAY FUNCTION_TYPE_DELAY} -
      • {@link #FUNCTION_TYPE_GROUP FUNCTION_TYPE_GROUP} -
      • {@link #FUNCTION_TYPE_INDEX FUNCTION_TYPE_INDEX} -
      • {@link #FUNCTION_TYPE_JAVA FUNCTION_TYPE_JAVA} -
      • {@link #FUNCTION_TYPE_LOG FUNCTION_TYPE_LOG} -
      • {@link #FUNCTION_TYPE_MRT FUNCTION_TYPE_MRT} -
      • {@link #FUNCTION_TYPE_MENU FUNCTION_TYPE_MENU} -
      • {@link #FUNCTION_TYPE_IO FUNCTION_TYPE_IO} -
      • {@link #FUNCTION_TYPE_PROCEDURE FUNCTION_TYPE_PROCEDURE} -
      • {@link #FUNCTION_TYPE_PROGRAM FUNCTION_TYPE_PROGRAM} -
      • {@link #FUNCTION_TYPE_SPECIAL FUNCTION_TYPE_SPECIAL} -
      -

      Read-only: true -

      Type: String - @see #getFunctionType - **/ - public static final int FUNCTION_TYPE = 602; - - /** - Constant indicating that the system is not performing a logged function. - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_BLANK = ""; - - /** - Constant indicating that a command is running interactively, or it is in a batch input stream, or it was requested from a system menu. Commands in CL programs or REXX procedures are not logged. The FUNCTION_NAME attribute contains the name of the command and is only updated when a command is processed. - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_COMMAND = "C"; - - /** - Constant indicating that the initial thread of the job is processing a Delay Job (DLYJOB) command. The FUNCTION_NAME attribute contains the number of seconds the job is delayed (up to 999999 seconds), or the time when the job is to resume processing (HH:MM:SS), depending on how you specified the command. - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_DELAY = "D"; - - /** - Constant indicating that the Transfer Group Job (TFRGRPJOB) command suspended the job. The FUNCTION_NAME attribute contains the group job name for that job. - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_GROUP = "G"; - - /** - Constant indicating that the initial thread of the job is rebuilding an index (access path). The FUNCTION_NAME attribute contains the name of the logical file whose index is rebuilt. - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_INDEX = "I"; - - /** - Constant indicating that the initial thread of the job is running a Java Vertual Machine (JVM). The FUNCTION_NAME attribute contains the name of the java class. - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_JAVA = "J"; - - /** - Constant indicating that the system logs history information in a database file. The FUNCTION_NAME attribute contains the name of the log (QHST is the only log currently supported). - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_LOG = "L"; - - /** - Constant indicating that the job is a multiple requester terminal (MRT) job if the {@link #JOB_TYPE JOB_TYPE} is {@link #JOB_TYPE_BATCH JOB_TYPE_BATCH} and the {@link #JOB_SUBTYPE JOB_SUBTYPE} is {@link #JOB_SUBTYPE_MRT JOB_SUBTYPE_MRT}, or it is an interactive job attached to an MRT job if the {@link #JOB_TYPE JOB_TYPE} is {@link #JOB_TYPE_INTERACTIVE JOB_TYPE_INTERACTIVE}. -

      For MRT jobs, the FUNCTION_NAME attribute contains information in the following format: -

        -
      • CHAR(2): The number of requesters currently attached to the MRT job. -
      • CHAR(1): The field is reserved for a / (slash). -
      • CHAR(2): The maximum number (MRTMAX) of requesters. -
      • CHAR(1): Reserved. -
      • CHAR(3): The never-ending program (NEP) indicator. If an MRT is also an NEP, the MRT stays active even if there are no requesters of the MRT. A value of NEP indicates a never-ending program. A value of blanks indicates that it is not a never-ending program. -
      • CHAR(1): Reserved. -
      -

      For interactive jobs attached to an MRT, the FUNCTION_NAME attribute contains the name of the MRT procedure. - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_MRT = "M"; - - /** - Constant indicating that the initial thread of the job is currently at a system menu. The FUNCTION_NAME field contains the name of the menu. - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_MENU = "N"; - - /** - Constant indicating that the job is a subsystem monitor that is performing input/output (I/O) operations to a work station. The FUNCTION_NAME attribute contains the name of the work station device to which the subsystem is performing an input/output operation. - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_IO = "O"; - - /** - Constant indicating that the initial thread of the job is running a procedure. The FUNCTION_NAME attribute contains the name of the procedure. - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_PROCEDURE = "R"; - - /** - Constant indicating that the initial thread of the job is running a program. The FUNCTION_NAME attribute contains the name of the program. - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_PROGRAM = "P"; - - /** - Constant indicating that the function type is a special function. For this value, the FUNCTION_NAME attribute contains one of the following values: -

        -
      • ADLACTJOB: Auxiliary storage is being allocated for the number of active jobs specified in the QADLACTJ system value. This may indicate that the system value for the initial number of active jobs is too low. -
      • ADLTOTJOB: Auxiliary storage is being allocated for the number of jobs specified in the QADLTOTJ system value. -
      • CMDENT: The Command Entry display is being used. -
      • COMMIT: A commit operation is being performed. -
      • DIRSHD: Directory shadowing. -
      • DLTSPLF: The system is deleting a spooled file. -
      • DUMP: A dump is in process. -
      • JOBIDXRCY: A damaged job index is being recovered. -
      • JOBLOG: The system is producing a job log. -
      • PASSTHRU: The job is a pass-through job. -
      • RCLSPLSTG: Empty spooled database members are being deleted. -
      • ROLLBACK: A rollback operation is being performed. -
      • SPLCLNUP: Spool cleanup is in process. -
      - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_SPECIAL = "*"; - - /** - Constant indicating that the initial thread of the job should be used when retrieving the call stack. - @see #getCallStack - **/ - public static final long INITIAL_THREAD = -1; - - /** - Job attribute representing how the job answers inquiry messages. Possible values are: -
        -
      • {@link #INQUIRY_MESSAGE_REPLY_REQUIRED INQUIRY_MESSAGE_REPLY_REQUIRED} -
      • {@link #INQUIRY_MESSAGE_REPLY_DEFAULT INQUIRY_MESSAGE_REPLY_DEFAULT} -
      • {@link #INQUIRY_MESSAGE_REPLY_SYSTEM_REPLY_LIST INQUIRY_MESSAGE_REPLY_SYSTEM_REPLY_LIST} -
      -

      Type: String - @see #getInquiryMessageReply - @see #setInquiryMessageReply - **/ - public static final int INQUIRY_MESSAGE_REPLY = 901; - - /** - Constant indicating that the job requires an answer for any inquiry messages that occur while this job is running. - @see #INQUIRY_MESSAGE_REPLY - **/ - public static final String INQUIRY_MESSAGE_REPLY_REQUIRED = "*RQD"; - - /** - Constant indicating that the system uses the default message reply to answer any inquiry messages issued while this job is running. The default reply is either defined in the message description or is the default system reply. - @see #INQUIRY_MESSAGE_REPLY - **/ - public static final String INQUIRY_MESSAGE_REPLY_DEFAULT = "*DFT"; - - /** - Constant indicating that the system reply list is checked to see if there is an entry for an inquiry message issued while this job is running. If a match occurs, the system uses the reply value for that entry. If no entry exists for that message, the system uses an inquiry message. - @see #INQUIRY_MESSAGE_REPLY - **/ - public static final String INQUIRY_MESSAGE_REPLY_SYSTEM_REPLY_LIST = "*SYSRPYL"; - - /** - Job attribute representing the count of operator interactions, such as pressing the Enter key or a function key. This field is zero for jobs that have no interactions. -

      Read-only: true -

      Type: Integer - @see #getInteractiveTransactions - **/ - public static final int INTERACTIVE_TRANSACTIONS = 1402; - - /** - Job attribute representing the value input to other APIs to increase the speed of locating the job on the system. The identifier is not valid following an initial program load (IPL). If you attempt to use it after an IPL, an exception occurs. -

      Read-only: true -

      Type: String -

      Can be loaded by JobList: false - @see #getInternalJobID - @deprecated Use {@link #INTERNAL_JOB_IDENTIFIER INTERNAL_JOB_IDENTIFIER} instead. The internal job identifier should be treated as a byte array of 16 bytes. - **/ - public static final int INTERNAL_JOB_ID = 11000; // Always gets loaded. - - /** - Job attribute representing the value input to other APIs to increase the speed of locating the job on the system. The identifier is not valid following an initial program load (IPL). If you attempt to use it after an IPL, an exception occurs. -

      Read-only: true -

      Type: byte array -

      Can be loaded by JobList: false - @see #getInternalJobIdentifier - **/ - public static final int INTERNAL_JOB_IDENTIFIER = 11007; // Always gets loaded. - - /** - Job attribute representing the date used for the job. This value is for jobs whose status is *JOBQ or *ACTIVE. For jobs with a status of *OUTQ, the value for this field is blank. -

      Type: String in the format CYYMMDD - @see #getJobDate - @see #setJobDate - **/ - public static final int JOB_DATE = 1002; - - /** - Job attribute representing a set of job-related attributes used for one or more jobs on the system. These attributes determine how the job is run on the system. Multiple jobs can also use the same job description. -

      Read-only: true -

      Type: String - @see #getJobDescription - **/ - public static final int JOB_DESCRIPTION = 1003; - - /** - Job attribute representing the most recent action that caused the job to end. Possible values are: -

        -
      • 0: Job not ending. -
      • 1: Job ending in a normal manner. -
      • 2: Job ended while it was still on a job queue. -
      • 3: System ended abnormally. -
      • 4: Job ending normally after a controlled end was requested. -
      • 5: Job ending immediately. -
      • 6: Job ending abnormally. -
      • 7: Job ended due to the CPU limit being exceeded. -
      • 8: Job ended due to the storage limit being exceeded. -
      • 9: Job ended due to the message severity level bein exceeded. -
      • 10: Job ended due to the disconnect time interval being exceeded. -
      • 11: Job ended due to the inactivity time interval being exceeded. -
      • 12: Job ended due to a device error. -
      • 13: Job ended due to a signal. -
      • 14: Job ended due to an unhandled error. -
      -

      Read-only: true -

      Type: Integer -

      Only valid on V5R1 systems and higher. - **/ - public static final int JOB_END_REASON = 1014; - - /** - Job attribute representing how a job log will be produced when the job completes. This does not affect job logs produced when the message queue is full and the job message queue full action specifies *PRTWRAP. Messages in the job messages queue are written to a spooled file, from which the job log can be printed, unless the Control Job Log Output (QMHCTLJL) API was used in the job to specify that the messages in the job log are to be written to a database file. -

      The job log output value can be changed at any time until the job log has been produced or removed. To change the job log output value for a job, use the Change Job (QWTCHGJB) API or the Change Job (CHGJOB) command. -

      The job log can be displayed at any time until the job log has been produced or removed. To display a job's job log, use the Display Job Log (DSPJOBLOG) command. -

      The job log can be removed when the job has completed and the job log has not yet been produced or removed. To remove the job log, use the Remove Pending Job Log (QWTRMVJL) API or the End Job (ENDJOB) command. -

      Possible values are: -

        -
      • {@link #JOB_LOG_OUTPUT_SYSTEM_VALUE JOB_LOG_OUTPUT_SYSTEM_VALUE} -
      • {@link #JOB_LOG_OUTPUT_JOB_LOG_SERVER JOB_LOG_OUTPUT_JOB_LOG_SERVER} -
      • {@link #JOB_LOG_OUTPUT_JOB_END JOB_LOG_OUTPUT_JOB_END} -
      • {@link #JOB_LOG_OUTPUT_PENDING JOB_LOG_OUTPUT_PENDING} -
      -

      Type: String -

      Only valid on V5R4 systems and higher. - **/ - public static final int JOB_LOG_OUTPUT = 1018; - - /** - Constant indicating that the value is specifed by the QLOGOUTPUT system value. - @see #JOB_LOG_OUTPUT - **/ - public static final String JOB_LOG_OUTPUT_SYSTEM_VALUE = "*SYSVAL"; - - /** - Constant indicating that the job log will be produced by a job log server. For more information about job log servers, refer to the Start Job Log Server (STRLOGSVR) command. - @see #JOB_LOG_OUTPUT - **/ - public static final String JOB_LOG_OUTPUT_JOB_LOG_SERVER = "*JOBLOGSVR"; - - /** - Constant indicating that the job log will be produced by the job itself. If the job cannot produce its own job log, the job log will be produced by a job log server. For example, a job does not produce its own job log when the system is processing a Power Down System (PWRDWNSYS) command. - @see #JOB_LOG_OUTPUT - **/ - public static final String JOB_LOG_OUTPUT_JOB_END = "*JOBEND"; - - /** - Constant indicating that the job log will not be produced. The job log remains pending until removed. - @see #JOB_LOG_OUTPUT - **/ - public static final String JOB_LOG_OUTPUT_PENDING = "*PND"; - - /** - Job attribute representing whether a job's log has been written or not. If the system fails while the job was active or the job ends abnormally, the job log may not be written yet. This flag remains on until the job log has been written. Possible values are: -

        -
      • {@link #JOB_LOG_PENDING_NO JOB_LOG_PENDING_NO} -
      • {@link #JOB_LOG_PENDING_YES JOB_LOG_PENDING_YES} -
      -

      Read-only: true -

      Type: String -

      Only valid on V5R1 systems and higher. - **/ - public static final int JOB_LOG_PENDING = 1015; - - /** - Constant indicating that the job log is not pending. - @see #JOB_LOG_PENDING - **/ - public static final String JOB_LOG_PENDING_NO = "0"; - - /** - Constant indicating that the job log is pending and waiting to be written. - @see #JOB_LOG_PENDING - **/ - public static final String JOB_LOG_PENDING_YES = "1"; - - /** - Job attribute representing the name of the job as identified to the system. For an interactive job, the system assigns the job name of the work station where the job started; for a batch job, you specify the name in the command when you submit the job. Possible values are: -

        -
      • A specific job name. -
      • {@link #JOB_NAME_INTERNAL JOB_NAME_INTERNAL} -
      • {@link #JOB_NAME_CURRENT JOB_NAME_CURRENT} -
      -

      Type: String - @see #getName - @see #setName - **/ - public static final int JOB_NAME = 11001; // Always gets loaded. - - /** - Constant indicating that the INTERNAL_JOB_ID locates the job. The user name and job number must be blank. - @see #JOB_NAME - **/ - public static final String JOB_NAME_INTERNAL = "*INT"; - - /** - Constant indicating the job that this program is running in. The user name and job number must be blank. - @see #JOB_NAME - **/ - public static final String JOB_NAME_CURRENT = "*"; - - /** - Job attribute representing the system-generated job number. Possible values are: -

        -
      • A specific job number. -
      • {@link #JOB_NUMBER_BLANK JOB_NUMBER_BLANK} -
      -

      Type: String - @see #getNumber - @see #setNumber - **/ - public static final int JOB_NUMBER = 11002; // Always gets loaded. - - /** - Constant indicating a blank job number. This must be used if JOB_NAME_INTERNAL or JOB_NAME_CURRENT is specified for the JOB_NAME. - @see #JOB_NUMBER - **/ - public static final String JOB_NUMBER_BLANK = ""; - - /** - Job attribute representing the name of the job queue that the job is currently on, or that the job was on if it is currently active. This attribute is valid to be set for jobs whose status is *JOBQ. Attempting to set this attribute for jobs with a status of *OUTQ or *ACTIVE will cause an error to be signaled. This attribute is valid to be retrieved for jobs whose status is *JOBQ or *ACTIVE. Retrieving this attribute for jobs with a status of *OUTQ will return a value of blanks. -

      Type: String - @see #getQueue - @see #setQueue - **/ - public static final int JOB_QUEUE = 1004; - - /** - Job attribute representing the date and time this job was put on this job queue. This field will contain blanks if the job was not on a job queue. -

      Read-only: true -

      Type: String in the system timestamp format - @see #getJobPutOnJobQueueDate - **/ - public static final int JOB_QUEUE_DATE = 404; - - /** - Job attribute representing the scheduling priority of the job compared to other jobs on the same job queue. The highest priority is 0 and the lowest is 9. This value is valid for jobs whose status is *JOBQ or *ACTIVE. For jobs with a status of *OUTQ, attempting to set this attribute will cause an error to be signaled and Retrieving this attribute will return a value of blanks. -

      Type: String - @see #getQueuePriority - @see #setQueuePriority - **/ - public static final int JOB_QUEUE_PRIORITY = 1005; - - /** - Job attribute representing the status of this job on the job queue. Possible values are: -

        -
      • {@link #JOB_QUEUE_STATUS_BLANK JOB_QUEUE_STATUS_BLANK} -
      • {@link #JOB_QUEUE_STATUS_SCHEDULED JOB_QUEUE_STATUS_SCHEDULED} -
      • {@link #JOB_QUEUE_STATUS_HELD JOB_QUEUE_STATUS_HELD} -
      • {@link #JOB_QUEUE_STATUS_READY JOB_QUEUE_STATUS_READY} -
      -

      Read-only: true -

      Type: String - @see #getJobStatusInJobQueue - **/ - public static final int JOB_QUEUE_STATUS = 1903; - - /** - Constant indicating that this job was not on a job queue. - @see #JOB_QUEUE_STATUS - **/ - public static final String JOB_QUEUE_STATUS_BLANK = ""; - - /** - Constant indicating that this job will run as scheduled. - @see #JOB_QUEUE_STATUS - **/ - public static final String JOB_QUEUE_STATUS_SCHEDULED = "SCD"; - - /** - Constant indicating that this job is being held on the job queue. - @see #JOB_QUEUE_STATUS - **/ - public static final String JOB_QUEUE_STATUS_HELD = "HLD"; - - /** - Constant indicating that this job is ready to be selected. - @see #JOB_QUEUE_STATUS - **/ - public static final String JOB_QUEUE_STATUS_READY = "RLS"; - - /** - Job attribute representing the status of this job. Possible values are: -

        -
      • {@link #JOB_STATUS_ACTIVE JOB_STATUS_ACTIVE} -
      • {@link #JOB_STATUS_JOBQ JOB_STATUS_JOBQ} -
      • {@link #JOB_STATUS_OUTQ JOB_STATUS_OUTQ} -
      -

      Read-only: true -

      Type: String - @see #getStatus - **/ - public static final int JOB_STATUS = 11003; // Always gets loaded. - - /** - Constant indicating this job is an active job. This includes group jobs, system request jobs, and disconnected jobs. - @see #JOB_STATUS - **/ - public static final String JOB_STATUS_ACTIVE = "*ACTIVE"; - - /** - Constant indicating this job is currently on a job queue. - @see #JOB_STATUS - **/ - public static final String JOB_STATUS_JOBQ = "*JOBQ"; - - /** - Constant indicating this job has completed running, but still has output on an output queue. - @see #JOB_STATUS - **/ - public static final String JOB_STATUS_OUTQ = "*OUTQ"; - - /** - Job attribute representing additional information about the job type (if any exists). Possible values are: -

        -
      • {@link #JOB_SUBTYPE_BLANK JOB_SUBTYPE_BLANK} -
      • {@link #JOB_SUBTYPE_IMMEDIATE JOB_SUBTYPE_IMMEDIATE} -
      • {@link #JOB_SUBTYPE_PROCEDURE_START_REQUEST JOB_SUBTYPE_PROCEDURE_START_REQUEST} -
      • {@link #JOB_SUBTYPE_MACHINE_SERVER_JOB JOB_SUBTYPE_MACHINE_SERVER_JOB} -
      • {@link #JOB_SUBTYPE_PRESTART JOB_SUBTYPE_PRESTART} -
      • {@link #JOB_SUBTYPE_PRINT_DRIVER JOB_SUBTYPE_PRINT_DRIVER} -
      • {@link #JOB_SUBTYPE_MRT JOB_SUBTYPE_MRT} -
      • {@link #JOB_SUBTYPE_ALTERNATE_SPOOL_USER JOB_SUBTYPE_ALTERNATE_SPOOL_USER} -
      -

      Read-only: true -

      Type: String - @see #getSubtype - **/ - public static final int JOB_SUBTYPE = 11004; // Always gets loaded. - - /** - Constant indicating that the job has no special subtype or is not a valid job. - @see #JOB_SUBTYPE - **/ - public static final String JOB_SUBTYPE_BLANK = ""; - - /** - Constant indicating that the job is an immediate job. - @see #JOB_SUBTYPE - **/ - public static final String JOB_SUBTYPE_IMMEDIATE = "D"; - - /** - Constant indicating that the job started with a procedure start request. - @see #JOB_SUBTYPE - **/ - public static final String JOB_SUBTYPE_PROCEDURE_START_REQUEST = "E"; - - /** - Constant indicating that the job is an AS/400 Advanced 36 machine server job. - @see #JOB_SUBTYPE - **/ - public static final String JOB_SUBTYPE_MACHINE_SERVER_JOB = "F"; - - /** - Constant indicating that the job is a prestart job. - @see #JOB_SUBTYPE - **/ - public static final String JOB_SUBTYPE_PRESTART = "J"; - - /** - Constant indicating that the job is a print driver job. - @see #JOB_SUBTYPE - **/ - public static final String JOB_SUBTYPE_PRINT_DRIVER = "P"; - - /** - Constant indicating that the job is a System/36 multiple requester terminal (MRT) job. - @see #JOB_SUBTYPE - **/ - public static final String JOB_SUBTYPE_MRT = "T"; - - /** - Constant indicating that the job is an alternate spool user job. - @see #JOB_SUBTYPE - **/ - public static final String JOB_SUBTYPE_ALTERNATE_SPOOL_USER = "U"; - - /** - Job attribute representing the current setting of the job switches used by this job. This value is valid for all job types. -

      Type: String - @see #getJobSwitches - @see #setJobSwitches - **/ - public static final int JOB_SWITCHES = 1006; - - /** - Job attribute representing the type of job. Possible values are: -

        -
      • {@link #JOB_TYPE_NOT_VALID JOB_TYPE_NOT_VALID} -
      • {@link #JOB_TYPE_AUTOSTART JOB_TYPE_AUTOSTART} -
      • {@link #JOB_TYPE_BATCH JOB_TYPE_BATCH} -
      • {@link #JOB_TYPE_INTERACTIVE JOB_TYPE_INTERACTIVE} -
      • {@link #JOB_TYPE_SUBSYSTEM_MONITOR JOB_TYPE_SUBSYSTEM_MONITOR} -
      • {@link #JOB_TYPE_SPOOLED_READER JOB_TYPE_SPOOLED_READER} -
      • {@link #JOB_TYPE_SYSTEM JOB_TYPE_SYSTEM} -
      • {@link #JOB_TYPE_SPOOLED_WRITER JOB_TYPE_SPOOLED_WRITER} -
      • {@link #JOB_TYPE_SCPF_SYSTEM JOB_TYPE_SCPF_SYSTEM} -
      -

      Read-only: true -

      Type: String - @see #getType - **/ - public static final int JOB_TYPE = 11005; // Always gets loaded. - - /** - Constant indicating that the job is not a valid job. - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_NOT_VALID = ""; - - /** - Constant indicating that the job is an autostart job. - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_AUTOSTART = "A"; - - /** - Constant indicating that the job is a batch job. - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_BATCH = "B"; - - /** - Constant indicating that the job is an interactive job. - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_INTERACTIVE = "I"; - - /** - Constant indicating that the job is a subsystem monitor job. - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_SUBSYSTEM_MONITOR = "M"; - - /** - Constant indicating that the job is a spooled reader job. - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_SPOOLED_READER = "R"; - - /** - Constant indicating that the job is a system job. - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_SYSTEM = "S"; - - /** - Constant indicating that the job is a spooled writer job. - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_SPOOLED_WRITER = "W"; - - /** - Constant indicating that the job is the SCPF system job. - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_SCPF_SYSTEM = "X"; - - /** - Job attribute representing the type of job. This attribute combines the JOB_TYPE and JOB_SUBTYPE attributes. Possible values are: -

        -
      • {@link #JOB_TYPE_ENHANCED_AUTOSTART JOB_TYPE_ENHANCED_AUTOSTART} -
      • {@link #JOB_TYPE_ENHANCED_BATCH JOB_TYPE_ENHANCED_BATCH} -
      • {@link #JOB_TYPE_ENHANCED_BATCH_IMMEDIATE JOB_TYPE_ENHANCED_BATCH_IMMEDIATE} -
      • {@link #JOB_TYPE_ENHANCED_BATCH_MRT JOB_TYPE_ENHANCED_BATCH_MRT} -
      • {@link #JOB_TYPE_ENHANCED_BATCH_ALTERNATE_SPOOL_USER JOB_TYPE_ENHANCED_BATCH_ALTERNATE_SPOOL_USER} -
      • {@link #JOB_TYPE_ENHANCED_COMM_PROCEDURE_START_REQUEST JOB_TYPE_ENHANCED_COMM_PROCEDURE_START_REQUEST} -
      • {@link #JOB_TYPE_ENHANCED_INTERACTIVE JOB_TYPE_ENHANCED_INTERACTIVE} -
      • {@link #JOB_TYPE_ENHANCED_INTERACTIVE_GROUP JOB_TYPE_ENHANCED_INTERACTIVE_GROUP} -
      • {@link #JOB_TYPE_ENHANCED_INTERACTIVE_SYSREQ JOB_TYPE_ENHANCED_SYSREQ} -
      • {@link #JOB_TYPE_ENHANCED_INTERACTIVE_SYSREQ_AND_GROUP JOB_TYPE_ENHANCED_INTERACTIVE_SYSREQ_AND_GROUP} -
      • {@link #JOB_TYPE_ENHANCED_PRESTART JOB_TYPE_ENHANCED_PRESTART} -
      • {@link #JOB_TYPE_ENHANCED_PRESTART_BATCH JOB_TYPE_ENHANCED_PRESTART_BATCH} -
      • {@link #JOB_TYPE_ENHANCED_PRESTART_COMM JOB_TYPE_ENHANCED_PRESTART_COMM} -
      • {@link #JOB_TYPE_ENHANCED_READER JOB_TYPE_ENHANCED_READER} -
      • {@link #JOB_TYPE_ENHANCED_SUBSYSTEM JOB_TYPE_ENHANCED_SUBSYSTEM} -
      • {@link #JOB_TYPE_ENHANCED_SYSTEM JOB_TYPE_ENHANCED_SYSTEM} -
      • {@link #JOB_TYPE_ENHANCED_WRITER JOB_TYPE_ENHANCED_WRITER} -
      -

      Read-only: true -

      Type: Integer -

      Only valid on V5R1 systems and higher. - **/ - public static final int JOB_TYPE_ENHANCED = 1016; - - /** - Constant indicating that the job is an autostart job. - @see #JOB_TYPE_ENHANCED - **/ - public static final Integer JOB_TYPE_ENHANCED_AUTOSTART = new Integer(110); - - /** - Constant indicating that the job is a batch job. - @see #JOB_TYPE_ENHANCED - **/ - public static final Integer JOB_TYPE_ENHANCED_BATCH = new Integer(210); - - /** - Constant indicating that the job is a batch immediate job. - @see #JOB_TYPE_ENHANCED - **/ - public static final Integer JOB_TYPE_ENHANCED_BATCH_IMMEDIATE = new Integer(220); - - /** - Constant indicating that the job is a batch System/36 multiple requester terminal (MRT) job. - @see #JOB_TYPE_ENHANCED - **/ - public static final Integer JOB_TYPE_ENHANCED_BATCH_MRT = new Integer(230); - - /** - Constant indicating that the job is a batch alternate spool user job. - @see #JOB_TYPE_ENHANCED - **/ - public static final Integer JOB_TYPE_ENHANCED_BATCH_ALTERNATE_SPOOL_USER = new Integer(240); - - /** - Constant indicating that the job is a communications procedure start request job. - @see #JOB_TYPE_ENHANCED - **/ - public static final Integer JOB_TYPE_ENHANCED_COMM_PROCEDURE_START_REQUEST = new Integer(310); - - /** - Constant indicating that the job is an interactive job. - @see #JOB_TYPE_ENHANCED - **/ - public static final Integer JOB_TYPE_ENHANCED_INTERACTIVE = new Integer(910); - - /** - Constant indicating that the job is an interactive job that is part of a group. - @see #JOB_TYPE_ENHANCED - **/ - public static final Integer JOB_TYPE_ENHANCED_INTERACTIVE_GROUP = new Integer(920); - - /** - Constant indicating that the job is an interactive job that is part of a system request pair. - @see #JOB_TYPE_ENHANCED - **/ - public static final Integer JOB_TYPE_ENHANCED_INTERACTIVE_SYSREQ = new Integer(930); - - /** - Constant indicating that the job is an interactive job that is part of a system request pair and part of a group. - @see #JOB_TYPE_ENHANCED - **/ - public static final Integer JOB_TYPE_ENHANCED_INTERACTIVE_SYSREQ_AND_GROUP = new Integer(940); - - /** - Constant indicating that the job is a prestart job. - @see #JOB_TYPE_ENHANCED - **/ - public static final Integer JOB_TYPE_ENHANCED_PRESTART = new Integer(1610); - - /** - Constant indicating that the job is a prestart batch job. - @see #JOB_TYPE_ENHANCED - **/ - public static final Integer JOB_TYPE_ENHANCED_PRESTART_BATCH = new Integer(1620); - - /** - Constant indicating that the job is a prestart communications job. - @see #JOB_TYPE_ENHANCED - **/ - public static final Integer JOB_TYPE_ENHANCED_PRESTART_COMM = new Integer(1630); - - /** - Constant indicating that the job is a reader job. - @see #JOB_TYPE_ENHANCED - **/ - public static final Integer JOB_TYPE_ENHANCED_READER = new Integer(1810); - - /** - Constant indicating that the job is a subsystem job. - @see #JOB_TYPE_ENHANCED - **/ - public static final Integer JOB_TYPE_ENHANCED_SUBSYSTEM = new Integer(1910); - - /** - Constant indicating that the job is a system job (all system jobs including SCPF). - @see #JOB_TYPE_ENHANCED - **/ - public static final Integer JOB_TYPE_ENHANCED_SYSTEM = new Integer(1920); - - /** - Constant indicating that the job is a writer job (including both spool writers and print drivers). - @see #JOB_TYPE_ENHANCED - **/ - public static final Integer JOB_TYPE_ENHANCED_WRITER = new Integer(2310); - - /** - Job attribute representing the user profile name by which the job is known to other jobs on the system. The job user identity is used for authorization checks when other jobs on the system attempt to operate against the job. For more detail on how the job user identity is set and used, refer to the Set Job User Identity (QWTSJUID) API. For jobs that are on a job queue or have completed running, the job user identity is same as the user name from the qualified job name. This attribute will return blanks for these jobs. A value of *N is returned if the job user identity is set, but the user profile to which it is set no longer exists. -

      Read-only: true -

      Type: String - **/ - public static final int JOB_USER_IDENTITY = 1012; - - /** - Job attribute representing the method by which the job user identity was set. Possible values are: -

        -
      • {@link #JOB_USER_IDENTITY_SETTING_DEFAULT JOB_USER_IDENTITY_SETTING_DEFAULT} -
      • {@link #JOB_USER_IDENTITY_SETTING_APPLICATION JOB_USER_IDENTITY_SETTING_APPLICATION} -
      • {@link #JOB_USER_IDENTITY_SETTING_SYSTEM JOB_USER_IDENTITY_SETTING_SYSTEM} -
      -

      Read-only: true -

      Type: String - **/ - public static final int JOB_USER_IDENTITY_SETTING = 1013; - - /** - Constant indicating that the job is currently running single threaded and the job user identity is the name of the user profile under which the job is currently running. This value is also returned for jobs that are on a job queue or have completed running. This has the same meaning as a value of *DEFAULT on the Display Job Status Attributes display. - @see #JOB_USER_IDENTITY_SETTING - **/ - public static final String JOB_USER_IDENTITY_SETTING_DEFAULT = "0"; - - /** - Constant indicating that the job user identity was explicitly set by an application using one of the Set Job User Identity APIs, QWTSJUID or QwtSetJuid(). The job may be running either single threaded or multithreaded. This has the same meaning as a value of *APPLICATION on the Display Job Status Attributes display. - @see #JOB_USER_IDENTITY_SETTING - **/ - public static final String JOB_USER_IDENTITY_SETTING_APPLICATION = "1"; - - /** - Constant indicating that the job is currently running multithreaded and the job user identity was implicitly set by the system when the job became multithreaded. It was set to the name of the user profile that the job was running under when it became multithreaded. This has the same meaning as a value of *SYSTEM on the Display Job Status Attributes display. - @see #JOB_USER_IDENTITY_SETTING - **/ - public static final String JOB_USER_IDENTITY_SETTING_SYSTEM = "2"; - - /** - Job attribute representing whether connections using distributed data management (DDM) protocols remain active when they are not being used. The connections include APPC conversations, active TCP/IP connections, or Opti-Connect connections. The DDM protocols are used in Distributed Relational Database Architecture (DRDA) applications, DDM applications, or DB2 Multisystem applications. Possible values are: -

        -
      • {@link #KEEP_DDM_CONNECTIONS_ACTIVE_KEEP KEEP_DDM_CONNECTIONS_ACTIVE_KEEP} -
      • {@link #KEEP_DDM_CONNECTIONS_ACTIVE_DROP KEEP_DDM_CONNECTIONS_ACTIVE_DROP} -
      -

      Type: String - @see #getDDMConversationHandling - @see #setDDMConversationHandling - **/ - public static final int KEEP_DDM_CONNECTIONS_ACTIVE = 408; // DDM conversation handling. - - /** - Constant indicating that the system keeps DDM connections active when there are no users, except for the following: -

        -
      • The routing step ends on the source system. The routing step ends when the job ends or when the job is rerouted to another routing step. -
      • The Reclaim Distributed Data Management Conversation (RCLDDMCNV) command or the Reclaim Resources (RCLRSC) command runs. -
      • A communications failure or an internal failure occurs. -
      • A DRDA connection to an application server not running on an IBM i system ends. -
      - @see #KEEP_DDM_CONNECTIONS_ACTIVE - **/ - public static final String KEEP_DDM_CONNECTIONS_ACTIVE_KEEP = "*KEEP"; - - /** - Constant indicating that the system ends a DDM connection when there are no users. Examples include when an application closes a DDM file, or when a DRDA application runs an SQL DISCONNECT statement. - @see #KEEP_DDM_CONNECTIONS_ACTIVE - **/ - public static final String KEEP_DDM_CONNECTIONS_ACTIVE_DROP = "*DROP"; - - /** - Job attribute representing the language identifier associated with this job. The language identifier is used when *LANGIDUNQ or *LANGIDSHR is specified on the sort sequence parameter. If the job CCSID is 65535, this parameter is also used to determine the value of the job default CCSID. Possible values are: -
        -
      • {@link #LANGUAGE_ID_SYSTEM_VALUE LANGUAGE_ID_SYSTEM_VALUE} -
      • {@link #LANGUAGE_ID_INITIAL_USER LANGUAGE_ID_INITIAL_USER} -
      • The language identifier. -
      -

      Type: String - @see #getLanguageID - @see #setLanguageID - **/ - public static final int LANGUAGE_ID = 1201; - - /** - Constant indicating the system value QLANGID is used. - @see #LANGUAGE_ID - **/ - public static final String LANGUAGE_ID_SYSTEM_VALUE = "*SYSVAL"; - - /** - Constant indicating the language ID specified in the user profile under which this thread was initially running is used. - @see #LANGUAGE_ID - **/ - public static final String LANGUAGE_ID_INITIAL_USER = "*USRPRF"; - - /** - Job attribute representing whether or not commands are logged for CL programs that are run. Possible values are: -

        -
      • {@link #LOG_CL_PROGRAMS_YES LOG_CL_PROGRAMS_YES} -
      • {@link #LOG_CL_PROGRAMS_NO LOG_CL_PROGRAMS_NO} -
      -

      Type: String - @see #getLoggingCLPrograms - @see #setLoggingCLPrograms - **/ - public static final int LOG_CL_PROGRAMS = 1203; - - /** - Constant indicating that commands are logged for CL programs that are run. - @see #LOG_CL_PROGRAMS - **/ - public static final String LOG_CL_PROGRAMS_YES = "*YES"; - - /** - Constant indicating that commands are not logged for CL programs that are run. - @see #LOG_CL_PROGRAMS - **/ - public static final String LOG_CL_PROGRAMS_NO = "*NO"; - - /** - Job attribute representing what type of information is logged. Possible values are: -

        -
      • {@link #LOGGING_LEVEL_NONE LOGGING_LEVEL_NONE} -
      • {@link #LOGGING_LEVEL_MESSAGES_BY_SEVERITY LOGGING_LEVEL_MESSAGES_BY_SEVERITY} -
      • {@link #LOGGING_LEVEL_REQUESTS_BY_SEVERITY_AND_ASSOCIATED_MESSAGES LOGGING_LEVEL_REQUESTS_BY_SEVERITY_AND_ASSOCIATED_MESSAGES} -
      • {@link #LOGGING_LEVEL_ALL_REQUESTS_AND_ASSOCIATED_MESSAGES LOGGING_LEVEL_ALL_REQUESTS_AND_ASSOCIATED_MESSAGES} -
      • {@link #LOGGING_LEVEL_ALL_REQUESTS_AND_MESSAGES LOGGING_LEVEL_ALL_REQUESTS_AND_MESSAGES} -
      -

      Type: String - @see #getLoggingLevel - @see #setLoggingLevel - **/ - public static final int LOGGING_LEVEL = 1202; - - /** - Constant indicating that no messages are logged. - @see #LOGGING_LEVEL - **/ - public static final String LOGGING_LEVEL_NONE = "0"; - - /** - Constant indicating that all messages sent to the job's external message queue with a severity greater than or equal to the message logging severity are logged. This includes the indication of job start, job end, and job completion status. - @see #LOGGING_LEVEL - **/ - public static final String LOGGING_LEVEL_MESSAGES_BY_SEVERITY = "1"; - - /** - Constant indicating that the following information is logged: -

        -
      • Logging level 1 information. -
      • Request messages that result in a high-level message with a severity code greater than or equal to the logging severity cause the request message and all associated messages to be logged. A high-level message is one that is sent to the program message queue of the program that receives the request message. For example, QCMD is an IBM-supplied request processing program that receives request messages. -
      - @see #LOGGING_LEVEL - **/ - public static final String LOGGING_LEVEL_REQUESTS_BY_SEVERITY_AND_ASSOCIATED_MESSAGES = "2"; - - /** - Constant indicating that the following information is logged: -
        -
      • Logging level 1 and 2 information is logged. -
      • All request messages are logged. -
      • Commands run by a CL program are logged if it is allowed by the LOG_CL_PROGRAMS attribute and the log attribute of the CL program. -
      - @see #LOGGING_LEVEL - **/ - public static final String LOGGING_LEVEL_ALL_REQUESTS_AND_ASSOCIATED_MESSAGES = "3"; - - /** - Constant indicating that the following information is logged: -
        -
      • All request messages and all messages with a severity greater than or equal to the message logging severity, including trace messages. -
      • Commands run by a CL program are logged if it is allowed by the LOG_CL_PROGRAMS attribute and the log attribute of the CL program. -
      - @see #LOGGING_LEVEL - **/ - public static final String LOGGING_LEVEL_ALL_REQUESTS_AND_MESSAGES = "4"; - - /** - Job attribute representing the severity level that is used in conjunction with the logging level to determine which error messages are logged in the job log. The values range from 00 through 99. -

      Type: Integer - @see #getLoggingSeverity - @see #setLoggingSeverity - **/ - public static final int LOGGING_SEVERITY = 1204; - - /** - Job attribute representing the level of message text that is written in the job log when a message is logged according to the LOGGING_LEVEL and LOGGING_SEVERITY. Possible values are: -

        -
      • {@link #LOGGING_TEXT_MESSAGE LOGGING_TEXT_MESSAGE} -
      • {@link #LOGGING_TEXT_SECLVL LOGGING_TEXT_SECLVL} -
      • {@link #LOGGING_TEXT_NO_LIST LOGGING_TEXT_NO_LIST} -
      -

      Type: String - @see #getLoggingText - @see #setLoggingText - **/ - public static final int LOGGING_TEXT = 1205; - - /** - Constant indicating that only the message text is written to the job log. - @see #LOGGING_TEXT - **/ - public static final String LOGGING_TEXT_MESSAGE = "*MSG"; - - /** - Constant indicating that both the message text and the message help (cause and recovery) of the error message are written to the job log. - @see #LOGGING_TEXT - **/ - public static final String LOGGING_TEXT_SECLVL = "*SECLVL"; - - /** - Constant indicating that if the job ends normally, no job log is produced. If the job ends abnormally (the job end code is 20 or higher), a job log is produced. The messages that appear in the job log contain both the message text and the message. help. - @see #LOGGING_TEXT - **/ - public static final String LOGGING_TEXT_NO_LIST = "*NOLIST"; - - /** - Job attribute representing the maximum processing unit time (in milliseconds) that the job can use. If the job consists of multiple routing steps, this is the maximum processing unit time that the current routing step can use. If the maximum time is exceeded, the job is ended. A value of -1 is returned if there is no maximum (*NOMAX). A value of zero is returned if the job is not active. -

      Read-only: true -

      Type: Integer - **/ - public static final int MAX_CPU_TIME = 1302; - - /** - Job attribute representing the maximum amount of auxiliary storage (in kilobytes) that the job can use. If the job consists of multiple routing steps, this is the maximum temporary storage that the routing step can use. This temporary storage is used for storage required by the program itself and by implicitly created internal system objects used to support the routing step. (It does not include storage in the QTEMP library.) If the maximum temporary storage is exceeded, the job is ended. This does not apply to the use of permanent storage, which is controlled through the user profile. A value of -1 is returned if there is no maximum (*NOMAX). -

      Read-only: true -

      Type: Integer - **/ - public static final int MAX_TEMP_STORAGE = 1303; - - /** - Job attribute representing the maximum amount of auxiliary storage (in megabytes) that the job can use. If the job consists of multiple routing steps, this is the maximum temporary storage that the routing step can use. This temporary storage is used for storage required by the program itself and by implicitly created internal system objects used to support the routing step. (It does not include storage in the QTEMP library.) If the maximum temporary storage is exceeded, the job is ended. This does not apply to the use of permanent storage, which is controlled through the user profile. A value of -1 is returned if there is no maximum (*NOMAX). -

      Read-only: true -

      Type: Long - **/ - public static final int MAX_TEMP_STORAGE_LARGE = 1305; - - /** - Job attribute representing the maximum number of threads that a job can run with at any time. If multiple threads are initiated simultaneously, this value may be exceeded. If this maximum value is exceeded, the excess threads will be allowed to run to their normal completion. Initiation of additional threads will be inhibited until the maximum number of threads in the job drops below this maximum value. A value of -1 is returned if there is no maximum (*NOMAX). Depending upon the resources used by the threads and the resources available to the system, the initiation of additional threads may be inhibited before this maximum value is reached. -

      Read-only: true -

      Type: Integer - **/ - public static final int MAX_THREADS = 1304; - - /** - Job attribute representing the name of the memory pool in which the job started running. The name may be a number, in which case it is a private pool associated with a subsystem. Possible values are: -

        -
      • {@link #MEMORY_POOL_MACHINE MEMORY_POOL_MACHINE} -
      • {@link #MEMORY_POOL_BASE MEMORY_POOL_BASE} -
      • {@link #MEMORY_POOL_INTERACTIVE MEMORY_POOL_INTERACTIVE} -
      • {@link #MEMORY_POOL_SPOOL MEMORY_POOL_SPOOL} -
      • *SHRPOOL1 - *SHRPOOL60: This job is running in the identified shared pool. -
      • 01 - 99: This job is running in the identified private pool. -
      -

      Read-only: true -

      Type: String -

      Only valid on V5R1 systems and higher. - **/ - public static final int MEMORY_POOL = 1306; - - /** - Constant indicating that this job is running in the machine pool. - @see #MEMORY_POOL - **/ - public static final String MEMORY_POOL_MACHINE = "*MACHINE"; - - /** - Constant indicating that this job is running in the base system pool, which can be shared with other subsystems. - @see #MEMORY_POOL - **/ - public static final String MEMORY_POOL_BASE = "*BASE"; - - /** - Constant indicating that this job is running in the shared pool used for interactive work. - @see #MEMORY_POOL - **/ - public static final String MEMORY_POOL_INTERACTIVE = "*INTERACT"; - - /** - Constant indicating that this job is running in the shared pool for spooled writers. - @see #MEMORY_POOL - **/ - public static final String MEMORY_POOL_SPOOL = "*SPOOL"; - - /** - Job attribute representing whether the job is waiting for a reply to a specific message. This value applies only when either the ACTIVE_JOB_STATUS or ACTIVE_JOB_STATUS_FOR_JOBS_ENDING attributes are set to ACTIVE_JOB_STATUS_WAIT_MESSAGE. Possible values are: -

        -
      • {@link #MESSAGE_REPLY_NOT_IN_MESSAGE_WAIT MESSAGE_REPLY_NOT_IN_MESSAGE_WAIT} -
      • {@link #MESSAGE_REPLY_WAITING MESSAGE_REPLY_WAITING} -
      • {@link #MESSAGE_REPLY_NOT_WAITING MESSAGE_REPLY_NOT_WAITING} -
      -

      Read-only: true -

      Type: String -

      Only valid on V5R1 systems and higher. - **/ - public static final int MESSAGE_REPLY = 1307; - - /** - Constant indicating that the job currently is not in message wait status. - @see #MESSAGE_REPLY - **/ - public static final String MESSAGE_REPLY_NOT_IN_MESSAGE_WAIT = "0"; - - /** - Constant indicating that the job is waiting for a reply to a message. - @see #MESSAGE_REPLY - **/ - public static final String MESSAGE_REPLY_WAITING = "1"; - - /** - Constant indicating that the job is not waiting for a reply to a message. - @see #MESSAGE_REPLY - **/ - public static final String MESSAGE_REPLY_NOT_WAITING = "2"; - - /** - Job attribute representing the action to take when the message queue is full. Possible values are: -

        -
      • {@link #MESSAGE_QUEUE_ACTION_SYSTEM_VALUE MESSAGE_QUEUE_ACTION_SYSTEM_VALUE} -
      • {@link #MESSAGE_QUEUE_ACTION_NO_WRAP MESSAGE_QUEUE_ACTION_NO_WRAP} -
      • {@link #MESSAGE_QUEUE_ACTION_WRAP MESSAGE_QUEUE_ACTION_WRAP} -
      • {@link #MESSAGE_QUEUE_ACTION_PRINT_WRAP MESSAGE_QUEUE_ACTION_PRINT_WRAP} -
      -

      Type: String - @see #getJobMessageQueueFullAction - @see #setJobMessageQueueFullAction - **/ - public static final int MESSAGE_QUEUE_ACTION = 1007; // Job message queue full action. - - /** - Constant indicating the value specified for the QJOBMSGQFL system value is used. - @see #MESSAGE_QUEUE_ACTION - **/ - public static final String MESSAGE_QUEUE_ACTION_SYSTEM_VALUE = "*SYSVAL"; - - /** - Constant indicating that when the job message queue is full, do not wrap. This action causes the job to end. - @see #MESSAGE_QUEUE_ACTION - **/ - public static final String MESSAGE_QUEUE_ACTION_NO_WRAP = "*NOWRAP"; - - /** - Constant indicating that when the job message queue is full, wrap to the beginning and start filling again. - @see #MESSAGE_QUEUE_ACTION - **/ - public static final String MESSAGE_QUEUE_ACTION_WRAP = "*WRAP"; - - /** - Constant indicating that when the job message queue is full, wrap the message queue and print the messages that are being overlaid because of the wrapping. - @see #MESSAGE_QUEUE_ACTION - **/ - public static final String MESSAGE_QUEUE_ACTION_PRINT_WRAP = "*PRTWRAP"; - - /** - Job attribute representing the maximum size (in megabytes) that the job message queue can become. The range is 2 to 64. -

      Read-only: true -

      Type: Integer - @see #getJobMessageQueueMaximumSize - **/ - public static final int MESSAGE_QUEUE_MAX_SIZE = 1008; - - /** - Job attribute representing the mode name of the advanced program-to-program communications (APPC) device that started the job. Possible values are: -

        -
      • The mode name is *BLANK. -
      • The mode name is blanks. -
      • The name of the mode. -
      -

      Read-only: true -

      Type: String - **/ - public static final int MODE = 1301; - - /** - Job attribute representing the name of the default output queue that is used for spooled output produced by this job. The default output queue is only for spooled printer files that specify *JOB for the output queue. Possible values are: -

        -
      • {@link #OUTPUT_QUEUE_DEVICE OUTPUT_QUEUE_DEVICE} -
      • {@link #OUTPUT_QUEUE_WORK_STATION OUTPUT_QUEUE_WORK_STATION} -
      • {@link #OUTPUT_QUEUE_INITIAL_USER OUTPUT_QUEUE_INITIAL_USER} -
      • Output queue name. -
      -

      Type: String - @see #getOutputQueue - @see #setOutputQueue - **/ - public static final int OUTPUT_QUEUE = 1501; - - /** - Constant indicating the device specified on the Create Printer File (CRTPRTF), Change Printer File (CHGPRTF), or Override with Printer File (OVRPRTF) commands is used. - @see #OUTPUT_QUEUE - **/ - public static final String OUTPUT_QUEUE_DEVICE = "*DEV"; - - /** - Constant indicating the default output queue that is used with this job is the output queue that is assigned to the work station associated with the job at the time the job is started. - @see #OUTPUT_QUEUE - **/ - public static final String OUTPUT_QUEUE_WORK_STATION = "*WRKSTN"; - - /** - Constant indicating the output queue name specified in the user profile under which this thread was initially running is used. - @see #OUTPUT_QUEUE - **/ - public static final String OUTPUT_QUEUE_INITIAL_USER = "*USRPRF"; - - /** - Job attribute representing the output priority for spooled output files that this job produces. The highest priority is 0, and the lowest is 9. -

      Type: String - @see #getOutputQueuePriority - @see #setOutputQueuePriority - **/ - public static final int OUTPUT_QUEUE_PRIORITY = 1502; - - /** - Job attribute representing whether border and header information is provided when the Print key is pressed. Possible values are: -

        -
      • {@link #PRINT_KEY_FORMAT_SYSTEM_VALUE PRINT_KEY_FORMAT_SYSTEM_VALUE} -
      • {@link #PRINT_KEY_FORMAT_NONE PRINT_KEY_FORMAT_NONE} -
      • {@link #PRINT_KEY_FORMAT_BORDER PRINT_KEY_FORMAT_BORDER} -
      • {@link #PRINT_KEY_FORMAT_HEADER PRINT_KEY_FORMAT_HEADER} -
      • {@link #PRINT_KEY_FORMAT_ALL PRINT_KEY_FORMAT_ALL} -
      -

      Type: String - @see #getPrintKeyFormat - @see #setPrintKeyFormat - **/ - public static final int PRINT_KEY_FORMAT = 1601; - - /** - Constant indicating that the value specified on the system value QPRTKEYFMT determines whether header or border information is printed. - @see #PRINT_KEY_FORMAT - **/ - public static final String PRINT_KEY_FORMAT_SYSTEM_VALUE = "*SYSVAL"; - - /** - Constant indicating that the border and header information is not included with output from the Print key. - @see #PRINT_KEY_FORMAT - **/ - public static final String PRINT_KEY_FORMAT_NONE = "*NONE"; - - /** - Constant indicating that the border information is included with output from the Print key. - @see #PRINT_KEY_FORMAT - **/ - public static final String PRINT_KEY_FORMAT_BORDER = "*PRTBDR"; - - /** - Constant indicating that the header information is included with output from the Print key. - @see #PRINT_KEY_FORMAT - **/ - public static final String PRINT_KEY_FORMAT_HEADER = "*PRTHDR"; - - /** - Constant indicating that the border and header information is included with output from the Print key. - @see #PRINT_KEY_FORMAT - **/ - public static final String PRINT_KEY_FORMAT_ALL = "*PRTALL"; - - /** - Job attribute representing the line of text (if any) that is printed at the bottom of each page of printed output for the job. Possible values are: -

        -
      • {@link #PRINT_TEXT_SYSTEM_VALUE PRINT_TEXT_SYSTEM_VALUE} -
      • {@link #PRINT_TEXT_BLANK PRINT_TEXT_BLANK} -
      • The character string that is printed at the bottom of each page. A maximum of 30 characters can be entered. -
      -

      Type: String - @see #getPrintText - @see #setPrintText - **/ - public static final int PRINT_TEXT = 1602; - - /** - Constant indicating the system value QPRTTXT is used. - @see #PRINT_TEXT - **/ - public static final String PRINT_TEXT_SYSTEM_VALUE = "*SYSVAL"; - - /** - Constant indicating that no text is printed on printed output. - @see #PRINT_TEXT - **/ - public static final String PRINT_TEXT_BLANK = "*BLANK"; - - /** - Job attribute representing the printer device used for printing output from this job. Possible values are: -

        -
      • {@link #PRINTER_DEVICE_NAME_SYSTEM_VALUE PRINTER_DEVICE_NAME_SYSTEM_VALUE} -
      • {@link #PRINTER_DEVICE_NAME_WORK_STATION PRINTER_DEVICE_NAME_WORK_STATION} -
      • {@link #PRINTER_DEVICE_NAME_INITIAL_USER PRINTER_DEVICE_NAME_INITIAL_USER} -
      • The name of the printer device that is used with this job. -
      -

      Type: String - @see #getPrinterDeviceName - @see #setPrinterDeviceName - **/ - public static final int PRINTER_DEVICE_NAME = 1603; - - /** - Constant indicating the value in the system value QPRTDEV is used as the printer device. - @see #PRINTER_DEVICE_NAME - **/ - public static final String PRINTER_DEVICE_NAME_SYSTEM_VALUE = "*SYSVAL"; - - /** - Constant indicating that the default printer device used with this job is the printer device assigned to the work station that is associated with the job. - @see #PRINTER_DEVICE_NAME - **/ - public static final String PRINTER_DEVICE_NAME_WORK_STATION = "*WRKSTN"; - - /** - Constant indicating that the printer device name specified in the user profile under which this thread was initially running is used. - @see #PRINTER_DEVICE_NAME - **/ - public static final String PRINTER_DEVICE_NAME_INITIAL_USER = "*USRPRF"; - - /** - Job attribute representing the libraries that contain product information for the initial thread of the job. -

      Read-only: true -

      Type: String -

      Can be loaded by JobList: false - @see #getNumberOfProductLibraries - @see #getProductLibraries - **/ - public static final int PRODUCT_LIBRARIES = 10002; // Cannot preload. - - /** - Job attribute representing the return code set by the compiler for Integrated Language Environment (ILE) languages. Refer to the appropriate ILE-conforming language manual for possible values. This attribute is scoped to the job and represents the most recent return code set by any thread within the job. -

      Read-only: true -

      Type: Integer - **/ - public static final int PRODUCT_RETURN_CODE = 1605; - - /** - Job attribute representing the completion status of the last program that has finished running, if the job contains any RPG, COBOL, data file utility (DFU), or sort utility programs. If not, a value of 0 is returned. -

      Read-only: true -

      Type: Integer - **/ - public static final int PROGRAM_RETURN_CODE = 1606; - - /** - Job attribute representing the routing data that is used to determine the routing entry that identifies the program to start for the routing step. -

      Read-only: true -

      Type: String - @see #getRoutingData - **/ - public static final int ROUTING_DATA = 1803; - - /** - Job attribute representing the priority at which the job is currently running, relative to other jobs on the system. The run priority ranges from 0 (highest priority) to 99 (lowest priority). -

      Type: Integer - @see #getRunPriority - @see #setRunPriority - **/ - public static final int RUN_PRIORITY = 1802; - - /** - Job attribute representing the date on which the submitted job becomes eligible to run. If your system or your job is configured to use the Julian date format, *MONTHSTR and *MONTHEND are calculated as if the system or job did not use the Julian date format. Possible values that can be used on {@link #setValue setValue()} are: -

        -
      • {@link #SCHEDULE_DATE_CURRENT SCHEDULE_DATE_CURRENT} -
      • {@link #SCHEDULE_DATE_MONTH_START SCHEDULE_DATE_MONTH_START} -
      • {@link #SCHEDULE_DATE_MONTH_END SCHEDULE_DATE_MONTH_END} -
      • {@link #SCHEDULE_DATE_MONDAY SCHEDULE_DATE_MONDAY} -
      • {@link #SCHEDULE_DATE_TUESDAY SCHEDULE_DATE_TUESDAY} -
      • {@link #SCHEDULE_DATE_WEDNESDAY SCHEDULE_DATE_WEDNESDAY} -
      • {@link #SCHEDULE_DATE_THURSDAY SCHEDULE_DATE_THURSDAY} -
      • {@link #SCHEDULE_DATE_FRIDAY SCHEDULE_DATE_FRIDAY} -
      • {@link #SCHEDULE_DATE_SATURDAY SCHEDULE_DATE_SATURDAY} -
      • {@link #SCHEDULE_DATE_SUNDAY SCHEDULE_DATE_SUNDAY} -
      • A date String in the format CYYMMDD. -
      -

      Type: String on setValue(); java.util.Date on getValue(). - @see #getScheduleDate - @see #setScheduleDate - **/ - public static final int SCHEDULE_DATE = 1920; - - /** - Constant indicating the submitted job becomes eligible to run on the current date. - @see #SCHEDULE_DATE - **/ - public static final String SCHEDULE_DATE_CURRENT = "*CURRENT"; - - /** - Constant indicating the submitted job becomes eligible to run on the first day of the month. If you specify this value and if today is the first day of the month and the time you specify on the SCHEDULE_TIME attribute has not passed, the job becomes eligible to run today. Otherwise, the job becomes eligible on the first day of the next month. - @see #SCHEDULE_DATE - **/ - public static final String SCHEDULE_DATE_MONTH_START = "*MONTHSTR"; - - /** - Constant indicating the submitted job becomes eligible to run on the last day of the month. If you specify this value and if today is the last day of the month and the time you specify on the SCHEDULE_TIME attribute has not passed, the job becomes eligible to run today. Otherwise, the job becomes eligible on the last day of the next month. - @see #SCHEDULE_DATE - **/ - public static final String SCHEDULE_DATE_MONTH_END = "*MONTHEND"; - - /** - Constant indicating the job becomes eligible to run on Monday. - @see #SCHEDULE_DATE - **/ - public static final String SCHEDULE_DATE_MONDAY = "*MON"; - - /** - Constant indicating the job becomes eligible to run on Tuesday. - @see #SCHEDULE_DATE - **/ - public static final String SCHEDULE_DATE_TUESDAY = "*TUE"; - - /** - Constant indicating the job becomes eligible to run on Wednesday. - @see #SCHEDULE_DATE - **/ - public static final String SCHEDULE_DATE_WEDNESDAY = "*WED"; - - /** - Constant indicating the job becomes eligible to run on Thursday. - @see #SCHEDULE_DATE - **/ - public static final String SCHEDULE_DATE_THURSDAY = "*THU"; - - /** - Constant indicating the job becomes eligible to run on Friday. - @see #SCHEDULE_DATE - **/ - public static final String SCHEDULE_DATE_FRIDAY = "*FRI"; - - /** - Constant indicating the job becomes eligible to run on Saturday. - @see #SCHEDULE_DATE - **/ - public static final String SCHEDULE_DATE_SATURDAY = "*SAT"; - - /** - Constant indicating the job becomes eligible to run on Sunday. - @see #SCHEDULE_DATE - **/ - public static final String SCHEDULE_DATE_SUNDAY = "*SUN"; - - /** - Job attribute representing the time on the scheduled date at which the job becomes eligible to run. Although the time can be specified to the second, the load on the system may affect the exact time at which the job becomes eligible to run. Possible values that can be used on {@link #setValue setValue()} are: -

        -
      • {@link #SCHEDULE_TIME_CURRENT SCHEDULE_TIME_CURRENT} -
      • A time you want to start the job, specified in a 24-hour format String as HHMMSS. -
      -

      Type: String on setValue(); java.util.Date on getValue(). - @see #getScheduleDate - @see #setScheduleTime - **/ - public static final int SCHEDULE_TIME = 1921; - - /** - Constant indicating the job is submitted on the current time. - @see #SCHEDULE_TIME - **/ - public static final String SCHEDULE_TIME_CURRENT = "*CURRENT"; - - // This is used internally. It is the key value used to get the schedule date, which is a combination of the schedule date and schedule time that were set. - static final int SCHEDULE_DATE_GETTER = 403; - - /** - Job attribute representing the type of server represented by the job. A value of blanks indicates that the job is not part of a server. -

      Read-only: true -

      Type: String - **/ - public static final int SERVER_TYPE = 1911; - - /** - Job attribute representing whether the job is to be treated like a signed-on user on the system. Possible values are: -

        -
      • {@link #SIGNED_ON_JOB_TRUE SIGNED_ON_JOB_TRUE} -
      • {@link #SIGNED_ON_JOB_FALSE SIGNED_ON_JOB_FALSE} -
      -

      Read-only: true -

      Type: String - @see #getSignedOnJob - **/ - public static final int SIGNED_ON_JOB = 701; - - /** - Constant indicating that the job should be treated like a signed-on user. - @see #SIGNED_ON_JOB - **/ - public static final String SIGNED_ON_JOB_TRUE = "0"; - - /** - Constant indicating that the job should not be treated like a signed-on user. - @see #SIGNED_ON_JOB - **/ - public static final String SIGNED_ON_JOB_FALSE = "1"; - - /** - Job attribute representing the sort sequence table associated with this job. Possible values are: -

        -
      • {@link #SORT_SEQUENCE_TABLE_SYSTEM_VALUE SORT_SEQUENCE_TABLE_SYSTEM_VALUE} -
      • {@link #SORT_SEQUENCE_TABLE_INITIAL_USER SORT_SEQUENCE_TABLE_INITIAL_USER} -
      • {@link #SORT_SEQUENCE_TABLE_NONE SORT_SEQUENCE_TABLE_NONE} -
      • {@link #SORT_SEQUENCE_TABLE_LANGUAGE_SHARED_WEIGHT SORT_SEQUENCE_TABLE_LANGUAGE_SHARED_WEIGHT} -
      • {@link #SORT_SEQUENCE_TABLE_LANGUAGE_UNIQUE_WEIGHT SORT_SEQUENCE_TABLE_LANGUAGE_UNIQUE_WEIGHT} -
      • A sort sequence table and library. -
      -

      Type: String - @see #getSortSequenceTable - @see #setSortSequenceTable - **/ - public static final int SORT_SEQUENCE_TABLE = 1901; - - /** - Constant indicating the system value QSRTSEQ is used. - @see #SORT_SEQUENCE_TABLE - **/ - public static final String SORT_SEQUENCE_TABLE_SYSTEM_VALUE = "*SYSVAL"; - - /** - Constant indicating the sort sequence table specified in the user profile under which this thread was initially running is used. - @see #SORT_SEQUENCE_TABLE - **/ - public static final String SORT_SEQUENCE_TABLE_INITIAL_USER = "*USRPRF"; - - /** - Constant indicating that no sort sequence table is used. The hexadecimal values of the characters are used to determine the sort sequence. - @see #SORT_SEQUENCE_TABLE - **/ - public static final String SORT_SEQUENCE_TABLE_NONE = "*HEX"; - - /** - Constant indicating that the sort sequence table used can contain the same weight for multiple characters, and it is the shared weight sort table associated with the language specified in the LANGUAGE_ID attribute. - @see #SORT_SEQUENCE_TABLE - **/ - public static final String SORT_SEQUENCE_TABLE_LANGUAGE_SHARED_WEIGHT = "*LANGIDSHR"; - - /** - Constant indicating that the sort sequence table used must contain a unique weight for each character in the code page, and it is the unique weight sort table associated with the language specified in the LANGUAGE_ID parameter. - @see #SORT_SEQUENCE_TABLE - **/ - public static final String SORT_SEQUENCE_TABLE_LANGUAGE_UNIQUE_WEIGHT = "*LANGIDUNQ"; - - /** - Job attribute representing whether a job is running in a particular environment. Possible values are: -

        -
      • {@link #SPECIAL_ENVIRONMENT_NONE SPECIAL_ENVIRONMENT_NONE} -
      • {@link #SPECIAL_ENVIRONMENT_SYSTEM_36 SPECIAL_ENVIRONMENT_SYSTEM_36} -
      • {@link #SPECIAL_ENVIRONMENT_NOT_ACTIVE SPECIAL_ENVIRONMENT_NOT_ACTIVE} -
      -

      Read-only: true -

      Type: String - **/ - public static final int SPECIAL_ENVIRONMENT = 1908; - - /** - Constant indicating that the job is not running in any special environment. - @see #SPECIAL_ENVIRONMENT - **/ - public static final String SPECIAL_ENVIRONMENT_NONE = "*NONE"; - - /** - Constant indicating that the job is running in the System/36 environment. - @see #SPECIAL_ENVIRONMENT - **/ - public static final String SPECIAL_ENVIRONMENT_SYSTEM_36 = "*S36"; - - /** - Constant indicating that the special environment is ignored because the job is not currently active. - @see #SPECIAL_ENVIRONMENT - **/ - public static final String SPECIAL_ENVIRONMENT_NOT_ACTIVE = ""; - - /** - Job attribute representing whether spooled files can be accessed through job interfaces once a job has completed its normal activity. Possible values are: -

        -
      • {@link #SPOOLED_FILE_ACTION_KEEP SPOOLED_FILE_ACTION_KEEP} -
      • {@link #SPOOLED_FILE_ACTION_DETACH SPOOLED_FILE_ACTION_DETACH} -
      • {@link #SPOOLED_FILE_ACTION_SYSTEM_VALUE SPOOLED_FILE_ACTION_SYSTEM_VALUE} -
      -

      Type: String - **/ - // Key: 1982 - // Type: char(10) - // Description: Spooled file action - public static final int SPOOLED_FILE_ACTION = 1982; - - /** - Constant indicating that when the job completes its activity, as long as at least one spooled file for the job exists in the system auxiliary storage pool (ASP 1) or in a basic user ASP (ASPs 2-32), the spooled files are kept with the job and the status of the job is updated to indicate that the job has completed. If all remaining spooled files for the job are in independent ASPs (ASPs 33-255), the spooled files will be detached from the job and the job will be removed from the system. - @see #SPOOLED_FILE_ACTION - **/ - public static final String SPOOLED_FILE_ACTION_KEEP = "*KEEP"; - - /** - Constant indicating that spooled files are detached from the job when the job completes its activity. - @see #SPOOLED_FILE_ACTION - **/ - public static final String SPOOLED_FILE_ACTION_DETACH = "*DETACH"; - - /** - Constant indicating the job will take the spooled file action specified by the QSPLFACN system value. - @see #SPOOLED_FILE_ACTION - **/ - public static final String SPOOLED_FILE_ACTION_SYSTEM_VALUE = "*SYSVAL"; - - /** - Job attribute representing whether status messages are displayed for this job. Possible values are: -

        -
      • {@link #STATUS_MESSAGE_HANDLING_SYSTEM_VALUE STATUS_MESSAGE_HANDLING_SYSTEM_VALUE} -
      • {@link #STATUS_MESSAGE_HANDLING_INITIAL_USER STATUS_MESSAGE_HANDLING_INITIAL_USER} -
      • {@link #STATUS_MESSAGE_HANDLING_NONE STATUS_MESSAGE_HANDLING_NONE} -
      • {@link #STATUS_MESSAGE_HANDLING_NORMAL STATUS_MESSAGE_HANDLING_NORMAL} -
      -

      Type: String - @see #getStatusMessageHandling - @see #setStatusMessageHandling - **/ - public static final int STATUS_MESSAGE_HANDLING = 1902; - - /** - Constant indicating the system value QSTSMSG is used. - @see #STATUS_MESSAGE_HANDLING - **/ - public static final String STATUS_MESSAGE_HANDLING_SYSTEM_VALUE = "*SYSVAL"; - - /** - Constant indicating the status message handling that is specified in the user profile under which this thread was initially running is used. - @see #STATUS_MESSAGE_HANDLING - **/ - public static final String STATUS_MESSAGE_HANDLING_INITIAL_USER = "*USRPRF"; - - /** - Constant indicating that this job does not display status messages. - @see #STATUS_MESSAGE_HANDLING - **/ - public static final String STATUS_MESSAGE_HANDLING_NONE = "*NONE"; - - /** - Constant indicating that this job displays status messages. - @see #STATUS_MESSAGE_HANDLING - **/ - public static final String STATUS_MESSAGE_HANDLING_NORMAL = "*NORMAL"; - - /** - Job attribute representing the job name of the submitter's job. If the job has no submitter, this value is blank. -

      Read-only: true -

      Type: String - **/ - public static final int SUBMITTED_BY_JOB_NAME = 1904; - - - /** - Job attribute representing the user name of the submitter. If the job has no submitter, this value is blank. -

      Read-only: true -

      Type: String -

      Can be loaded by JobList: false - **/ - public static final int SUBMITTED_BY_USER = 10006; // Cannot preload. - /** - Job attribute representing the job number of the submitter's job. If the job has no submitter, this value is blank. -

      Read-only: true -

      Type: String -

      Can be loaded by JobList: false - **/ - public static final int SUBMITTED_BY_JOB_NUMBER = 10005; // Cannot preload. - - /** - Job attribute representing the subsystem description in which an active job is running. This value is only for jobs whose status is *ACTIVE. For jobs with status of *OUTQ or *JOBQ, this value is blank. -

      Read-only: true -

      Type: String - @see #getSubsystem - **/ - public static final int SUBSYSTEM = 1906; - - /** - Job attribute representing the identifier of the system-related pool from which the job's main storage is allocated. These identifiers are not the same as those specified in the subsystem description, but are the same as the system pool identifiers shown on the system status display. This is the pool that the threads in the job start in. Also see the CURRENT_SYSTEM_POOL_ID for more information. -

      Read-only: true -

      Type: Integer - @see #CURRENT_SYSTEM_POOL_ID - @see #getPoolIdentifier - **/ - public static final int SYSTEM_POOL_ID = 1907; - - /** - Job attribute representing the system portion of the library list of the initial thread of the job. -

      Read-only: true -

      Type: String -

      Can be loaded by JobList: false - @see #getNumberOfLibrariesInSYSLIBL - @see #getSystemLibraryList - **/ - public static final int SYSTEM_LIBRARY_LIST = 10003; // Cannot preload. - - /** - Job attribute representing the amount of auxiliary storage (in kilobytes) that is currently allocated to this job. This value will reach a maximum of 2,147,483,647 kilobytes. If the actual temporary storage used is larger than that value, this attribute will return 2,147,483,647 kilobytes. It is recomended that the TEMP_STORAGE_USED_LARGE attribute be used to get over the limit. -

      Read-only: true -

      Type: Integer - **/ - public static final int TEMP_STORAGE_USED = 2004; - - /** - Job attribute representing the amount of auxiliary storage (in megabytes) that is currently allocated to this job. -

      Read-only: true -

      Type: Long - **/ - public static final int TEMP_STORAGE_USED_LARGE = 2009; - - /** - Job attribute representing the count of the current number of active threads in the process at the time of the materialization. An active thread may be either actively running, suspended, or waiting for a resource. -

      Read-only: true -

      Type: Integer - **/ - public static final int THREAD_COUNT = 2008; - - /** - Job attribute representing the value used to separate hours, minutes, and seconds when presenting a time. Possible values are: -

        -
      • {@link #TIME_SEPARATOR_SYSTEM_VALUE TIME_SEPARATOR_SYSTEM_VALUE} -
      • {@link #TIME_SEPARATOR_COLON TIME_SEPARATOR_COLON} -
      • {@link #TIME_SEPARATOR_PERIOD TIME_SEPARATOR_PERIOD} -
      • {@link #TIME_SEPARATOR_BLANK TIME_SEPARATOR_BLANK} -
      • {@link #TIME_SEPARATOR_COMMA TIME_SEPARATOR_COMMA} -
      -

      Type: String - @see #getTimeSeparator - @see #setTimeSeparator - **/ - public static final int TIME_SEPARATOR = 2001; - - /** - Constant indicating the time separator specified in the system value QTIMSEP is used. - @see #TIME_SEPARATOR - **/ - public static final String TIME_SEPARATOR_SYSTEM_VALUE = "S"; - - /** - Constant indicating a colon (:) is used for the time separator. - @see #TIME_SEPARATOR - **/ - public static final String TIME_SEPARATOR_COLON = ":"; - - /** - Constant indicating a period (.) is used for the time separator. - @see #TIME_SEPARATOR - **/ - public static final String TIME_SEPARATOR_PERIOD = "."; - - /** - Constant indicating a blank is used for the time separator. - @see #TIME_SEPARATOR - **/ - public static final String TIME_SEPARATOR_BLANK = " "; - - /** - Constant indicating a comma (,) is used for the time separator. - @see #TIME_SEPARATOR - **/ - public static final String TIME_SEPARATOR_COMMA = ","; - - /** - Job attribute representing the maximum amount of processor time (in milliseconds) given to each thread in this job before other threads in this job and in other jobs are given the opportunity to run. The time slice establishes the amount of time needed by a thread in this job to accomplish a meaningful amount of processing. At the end of the time slice, the thread might be put in an inactive state so that other threads can become active in the storage pool. If the job consists of multiple routing steps, a change to this attribute during a routing step does not apply to subsequent routing steps. Values retrieved range from 8 through 9,999,999 milliseconds (that is, 9999.999 seconds). Although you can specify a value of less than 8, the system takes a minimum of 8 milliseconds to run a process. -

      Type: Integer - @see #getTimeSlice - @see #setTimeSlice - **/ - public static final int TIME_SLICE = 2002; - - /** - Job attribute representing whether a thread in an interactive job moves to another main storage pool at the end of its time slice. Possible values are: -

        -
      • {@link #TIME_SLICE_END_POOL_SYSTEM_VALUE TIME_SLICE_END_POOL_SYSTEM_VALUE} -
      • {@link #TIME_SLICE_END_POOL_NONE TIME_SLICE_END_POOL_NONE} -
      • {@link #TIME_SLICE_END_POOL_BASE TIME_SLICE_END_POOL_BASE} -
      -

      Type: String - @see #getTimeSliceEndPool - @see #setTimeSliceEndPool - **/ - public static final int TIME_SLICE_END_POOL = 2003; - - /** - Constant indicating the value in the system value QTSEPPOOL is used. - @see #TIME_SLICE_END_POOL - **/ - public static final String TIME_SLICE_END_POOL_SYSTEM_VALUE = "*SYSVAL"; - - /** - Constant indicating that a thread in the job does not move to another main storage pool when it reaches the end of its time slice. - @see #TIME_SLICE_END_POOL - **/ - public static final String TIME_SLICE_END_POOL_NONE = "*NONE"; - - /** - Constant indicating that a thread in the job moves to the base pool when it reaches the end of its time slice. - @see #TIME_SLICE_END_POOL - **/ - public static final String TIME_SLICE_END_POOL_BASE = "*BASE"; - - /** - Job attribute representing the total amount of response time for the initial thread, in milliseconds. This value does not include the time used by the machine, by the attached input/output (I/O) hardware, and by the transmission lines for sending and receiving data. This value is zero for jobs that have no interactions. A value of -1 is returned if this field is not large enough to hold the actual result. -

      Read-only: true -

      Type: Integer - @see #getTotalResponseTime - **/ - public static final int TOTAL_RESPONSE_TIME = 1801; - - /** - Job attribute representing the unit of work ID used to track jobs across multiple systems. If a job is not associated with a source or target system using advanced program-to-program communications (APPC), this information is not used. Every job on the system is assigned a unit of work ID. The unit-of-work identifier is made up of: -

        -
      1. {@link #LOCATION_NAME LOCATION_NAME} -
      2. {@link #NETWORK_ID NETWORK_ID} -
      3. {@link #INSTANCE INSTANCE} -
      4. {@link #SEQUENCE_NUMBER SEQUENCE_NUMBER} -
      -

      Read-only: true -

      Type: String - @see #getWorkIDUnit - **/ - public static final int UNIT_OF_WORK_ID = 2101; // This is the real key. - - /** - Job attribute representing the location name portion of the unit of work ID. This portion of the unit-of-work identifier is the name of the source system that originated the APPC job. -

      Read-only: true -

      Type: String - @see #UNIT_OF_WORK_ID - @see #getWorkIDUnit - **/ - public static final int LOCATION_NAME = 21012; // Unit of work ID. - - /** - Job attribute representing the network ID portion of the unit of work ID. This portion of the unit-of-work identifier is the network name associated with the unit of work. -

      Read-only: true -

      Type: String - @see #UNIT_OF_WORK_ID - @see #getWorkIDUnit - **/ - public static final int NETWORK_ID = 21013; // Unit of work ID. - - /** - Job attribute representing the instance portion of the unit of work ID. This portion of the unit-of-work identifier is the value that further identifies the source of the job. This is shown as hexadecimal data. -

      Read-only: true -

      Type: String - @see #UNIT_OF_WORK_ID - @see #getWorkIDUnit - **/ - public static final int INSTANCE = 21011; // Unit of work ID. - - /** - Job attribute representing the sequence number portion of the unit of work ID. This portion of the unit-of-work identifier is a value that identifies a checkpoint within the application program. -

      Read-only: true -

      Type: String - @see #UNIT_OF_WORK_ID - @see #getWorkIDUnit - **/ - public static final int SEQUENCE_NUMBER = 21014; // Unit of work ID. - - /** - Job attribute representing the user portion of the library list for the initial thread of the job. -

      Read-only: true -

      Type: String -

      Can be loaded by JobList: false - @see #getNumberOfLibrariesInUSRLIBL - @see #getUserLibraryList - **/ - public static final int USER_LIBRARY_LIST = 10004; // Cannot preload. - - /** - Job attribute representing the user name of the job, which is the same as the name of the user profile under which the job was started. It can come from several different sources, depending on the type of job. This may be different than the user profile under which the job is currently running. See the CURRENT_USER attribute for more information. Possible values are: -

        -
      • A specific user profile name. -
      • {@link #USER_NAME_BLANK USER_NAME_BLANK} -
      -

      Type: String - @see #CURRENT_USER - @see #getUser - @see #setUser - **/ - public static final int USER_NAME = 11006; // Always gets loaded. - - /** - Constant indicating a blank user name. This must be used when JOB_NAME_INTERNAL or JOB_NAME_CURRENT is specified for the JOB_NAME. - @see #USER_NAME - **/ - public static final String USER_NAME_BLANK = ""; - - /** - Job attribute representing the user-defined return code set by ILE high-level language constructs. An example is the program return code in the C language. This field is scoped to the job and represents the most recent return code set by any thread within the job. -

      Read-only: true -

      Type: Integer - **/ - public static final int USER_RETURN_CODE = 2102; - - // Holds the lengths for all of the setter keys. - static final IntegerHashtable setterKeys_ = new IntegerHashtable(); - static - { - setterKeys_.put(BREAK_MESSAGE_HANDLING, 10); - setterKeys_.put(CCSID, 4); // Binary - setterKeys_.put(COUNTRY_ID, 8); - setterKeys_.put(CHARACTER_ID_CONTROL, 10); - setterKeys_.put(DATE_FORMAT, 4); - setterKeys_.put(DATE_SEPARATOR, 1); - setterKeys_.put(KEEP_DDM_CONNECTIONS_ACTIVE, 5); - setterKeys_.put(DEFAULT_WAIT_TIME, 4); // Binary - setterKeys_.put(DEVICE_RECOVERY_ACTION, 13); - setterKeys_.put(DECIMAL_FORMAT, 8); - setterKeys_.put(INQUIRY_MESSAGE_REPLY, 10); - setterKeys_.put(ACCOUNTING_CODE, 15); - setterKeys_.put(JOB_DATE, 7); - setterKeys_.put(JOB_LOG_OUTPUT, 10); - setterKeys_.put(JOB_QUEUE, 20); - setterKeys_.put(JOB_QUEUE_PRIORITY, 2); - setterKeys_.put(JOB_SWITCHES, 8); - setterKeys_.put(MESSAGE_QUEUE_ACTION, 10); - setterKeys_.put(LANGUAGE_ID, 8); - setterKeys_.put(LOGGING_LEVEL, 1); - setterKeys_.put(LOG_CL_PROGRAMS, 10); - setterKeys_.put(LOGGING_SEVERITY, 4); // Binary - setterKeys_.put(LOGGING_TEXT, 7); - setterKeys_.put(OUTPUT_QUEUE, 20); - setterKeys_.put(OUTPUT_QUEUE_PRIORITY, 2); - setterKeys_.put(PRINT_KEY_FORMAT, 10); - setterKeys_.put(PRINT_TEXT, 30); - setterKeys_.put(PRINTER_DEVICE_NAME, 10); - setterKeys_.put(ELIGIBLE_FOR_PURGE, 4); - setterKeys_.put(RUN_PRIORITY, 4); // Binary - setterKeys_.put(SORT_SEQUENCE_TABLE, 20); - setterKeys_.put(STATUS_MESSAGE_HANDLING, 10); - setterKeys_.put(SCHEDULE_DATE, 10); - setterKeys_.put(SCHEDULE_TIME, 8); - setterKeys_.put(SPOOLED_FILE_ACTION, 10); - setterKeys_.put(TIME_SEPARATOR, 1); - setterKeys_.put(TIME_SLICE, 4); // Binary - setterKeys_.put(TIME_SLICE_END_POOL, 10); - } - - // Keep a list of which of the changeable attributes is binary. - private static boolean isTypeBinary(int key) - { - switch (key) - { - case CCSID: - case DEFAULT_WAIT_TIME: - case LOGGING_SEVERITY: - case RUN_PRIORITY: - case TIME_SLICE: - return true; - } - return false; - } - - /** - Constructs a Job object. The system and basic job information must be set before connecting to the system. - @see #setName - @see #setNumber - @see #setSystem - @see #setUser - **/ - public Job() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing Job object."); - } - - /** - Constructs a Job object. The job name, user name, and job number of the job that this program is running in will be used. Typically, that will be the job information for the remote command host server job associated with the specified system object. - @param system The system object representing the system on which the job exists. - @see #setName - @see #setNumber - @see #setUser - **/ - public Job(AS400 system) - { - this(system, JOB_NAME_CURRENT, USER_NAME_BLANK, JOB_NUMBER_BLANK); - } - - /** - Constructs a Job object. - @param system The system object representing the system on which the job exists. - @param jobName The job name. Specify JOB_NAME_CURRENT to indicate the job that this program is running in. - @param userName The user name. This must be USER_NAME_BLANK if the job name is JOB_NAME_CURRENT. - @param jobNumber The job number. This must be JOB_NUMBER_BLANK if job name is JOB_NAME_CURRENT. - **/ - public Job(AS400 system, String jobName, String userName, String jobNumber) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing Job object, system: " + system + ", job name: " + jobName + ", user name: " + userName + ", job number: " + jobNumber); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (jobName == null) - { - Trace.log(Trace.ERROR, "Parameter 'jobName' is null."); - throw new NullPointerException("jobName"); - } - if (jobName.length() > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'jobName' is not valid: '" + jobName + "'"); - throw new ExtendedIllegalArgumentException("jobName (" + jobName + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (userName == null) - { - Trace.log(Trace.ERROR, "Parameter 'userName' is null."); - throw new NullPointerException("userName"); - } - if (userName.length() > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'userName' is not valid: '" + userName + "'"); - throw new ExtendedIllegalArgumentException("userName (" + userName + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (jobNumber == null) - { - Trace.log(Trace.ERROR, "Parameter 'jobNumber' is null."); - throw new NullPointerException("jobNumber"); - } - if (jobNumber.length() > 6) - { - Trace.log(Trace.ERROR, "Length of parameter 'jobNumber' is not valid: '" + jobNumber + "'"); - throw new ExtendedIllegalArgumentException("jobNumber (" + jobNumber + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (jobName.equals(JOB_NAME_CURRENT)) - { - if (userName.trim().length() != 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'userName' is not valid: " + userName); - throw new ExtendedIllegalArgumentException("userName (" + userName + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (jobNumber.trim().length() != 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'jobNumber' is not valid: " + jobNumber); - throw new ExtendedIllegalArgumentException("jobNumber (" + jobNumber + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - system_ = system; - name_ = jobName; - setValueInternal(JOB_NAME, jobName); - user_ = userName; - setValueInternal(USER_NAME, userName); - number_ = jobNumber; - setValueInternal(JOB_NUMBER, jobNumber); - internalJobID_ = ""; - realInternalJobID_ = null; - setValueInternal(INTERNAL_JOB_ID, ""); - } - - /** - Constructs a Job object. This sets the job name to JOB_NAME_INTERNAL, the user name to USER_NAME_BLANK, and the job number to JOB_NUMBER_BLANK. - @param system The system object representing the system on which the job exists. - @param internalJobID The internal job identifier. - @deprecated Use {@link #Job(AS400,byte[]) Job(AS400,byte[])} instead. The internal job ID should be treated as a byte array of 16 bytes. - **/ - public Job(AS400 system, String internalJobID) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing Job object, system: " + system + ", job identifier: '" + internalJobID + "'"); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (internalJobID == null) - { - Trace.log(Trace.ERROR, "Parameter 'internalJobID' is null."); - throw new NullPointerException("internalJobID"); - } - if (internalJobID.length() != 16) - { - Trace.log(Trace.ERROR, "Length of parameter 'internalJobID' is not valid: '" + internalJobID + "'"); - throw new ExtendedIllegalArgumentException("internalJobID (" + internalJobID + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - system_ = system; - internalJobID_ = internalJobID; - realInternalJobID_ = new byte[16]; - for (int i = 0; i < 16; ++i) - { - realInternalJobID_[i] = (byte)internalJobID.charAt(i); - } - setValueInternal(INTERNAL_JOB_ID, internalJobID); - setValueInternal(INTERNAL_JOB_IDENTIFIER, realInternalJobID_); - name_ = JOB_NAME_INTERNAL; - setValueInternal(JOB_NAME, null); - user_ = USER_NAME_BLANK; - setValueInternal(USER_NAME, null); - number_ = JOB_NUMBER_BLANK; - setValueInternal(JOB_NUMBER, null); - } - - /** - Constructs a Job object. This sets the job name to JOB_NAME_INTERNAL, the user name to USER_NAME_BLANK, and the job number to JOB_NUMBER_BLANK. - @param system The system. - @param internalJobID The 16-byte internal job identifier. - **/ - public Job(AS400 system, byte[] internalJobID) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing Job object, system: " + system + ", job identifier:", internalJobID); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (internalJobID == null) - { - Trace.log(Trace.ERROR, "Parameter 'internalJobID' is null."); - throw new NullPointerException("internalJobID"); - } - if (internalJobID.length != 16) - { - Trace.log(Trace.ERROR, "Length of parameter 'internalJobID' is not valid: " + internalJobID.length); - throw new ExtendedIllegalArgumentException("internalJobID.length {" + internalJobID.length + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - system_ = system; - realInternalJobID_ = internalJobID; - char[] oldID = new char[16]; - for (int i = 0; i < 16; ++i) - { - oldID[i] = (char)(internalJobID[i] & 0x00FF); - } - internalJobID_ = new String(oldID); - setValueInternal(INTERNAL_JOB_ID, internalJobID); - setValueInternal(INTERNAL_JOB_IDENTIFIER, realInternalJobID_); - name_ = JOB_NAME_INTERNAL; - setValueInternal(JOB_NAME, null); - user_ = USER_NAME_BLANK; - setValueInternal(USER_NAME, null); - number_ = JOB_NUMBER_BLANK; - setValueInternal(JOB_NUMBER, null); - } - - // Constructs a Job object. Package scope constructor. - Job(AS400 system, String name, String user, String number, String status, String type, String subtype) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing Job object, system: " + system + ", job name: " + name + ", user name: " + user + ", job number: " + number + ", status: " + status + ", type: " + type + ", subtype: " + subtype); - system_ = system; - name_ = name; - setValueInternal(JOB_NAME, name); - user_ = user; - setValueInternal(USER_NAME, user); - number_ = number; - setValueInternal(JOB_NUMBER, number); - status_ = status; // Note: 'status' is NOT part of the job's identification. - setValueInternal(JOB_STATUS, status); - type_ = type; - setValueInternal(JOB_TYPE, type); - subtype_ = subtype; - setValueInternal(JOB_SUBTYPE, subtype); - } - - /** - Adds a PropertyChangeListener. The specified PropertyChangeListener's {@link java.beans.PropertyChangeListener#propertyChange propertyChange()} method will be called each time the value of any bound property is changed. - @param listener The listener. - @see #removePropertyChangeListener - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Adds a VetoableChangeListener. The specified VetoableChangeListener's {@link java.beans.VetoableChangeListener#vetoableChange vetoableChange()} method will be called each time the value of any constrained property is changed. - @param listener The listener. - @see #removeVetoableChangeListener - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - } - - // Convenience method to check state before a connect and set the connected flag. - private void connect() - { - if (!isConnected_) - { - // Already validated if we are connected. - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (name_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting name."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (user_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting user."); - throw new ExtendedIllegalStateException("user", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (number_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting number."); - throw new ExtendedIllegalStateException("number", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - isConnected_ = true; - } - } - - // Convenience method to create the qualified job name. - private byte[] createQualifiedJobName() throws IOException - { - if (realInternalJobID_ != null) - { - // Return EBCDIC value "*INT" blank padded to 26 bytes. - return new byte[] { 0x5C, (byte)0xC9, (byte)0xD5, (byte)0xE3, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - } - byte[] qualifiedJobName = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - Converter conv = new Converter(system_.getCcsid(), system_); - conv.stringToByteArray(name_, qualifiedJobName); - conv.stringToByteArray(user_, qualifiedJobName, 10); - conv.stringToByteArray(number_, qualifiedJobName, 20); - return qualifiedJobName; - } - - /** - Commits all uncommitted attribute changes. Calling this method will set all uncommitted attribute changes to the job on the system. -
      Note: To commit the changes, the Toolbox by default calls system API (QWTCHGJB) - off-thread, that is, via the Remote Command Host Server. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #commitChanges(boolean) - **/ - public void commitChanges() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - commitChanges(false); - } - - /** - Commits all uncommitted attribute changes. Calling this method will set all uncommitted attribute changes to the job on the system. -
      When running on an IBM i system: If callOnThread is true, - then the system API (QWTCHGJB) will be called on-thread, that is, in the same thread - as the JVM. If callOnThread is false, - then the system API will be called off-thread, that is, in the thread - of the Remote Command Host Server job. -
      Caution: The QWTCHGJB API is specified as "conditionally - threadsafe". Please refer to the IBM i Programmer's Guide for details on - the threadsafety of specific attribute changes. Note that this method - specifies format name JOBC0100 when calling QWTCHGJB. -
      Note: This method behaves identically to {@link #commitChanges commitChanges()} if the Java application is running remotely, that is, is not running "natively" on an IBM i system. When running remotely, the Toolbox submits all program calls through the Remote Command Host Server. - @param callOnThread Whether to call the system API on-thread or off-thread. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void commitChanges(boolean callOnThread) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Changing job."); - connect(); - - if (cachedChanges_ == null || cachedChanges_.size_ == 0) return; - - int numChanges = cachedChanges_.size_; - int totalLength = 0; - int[][] keyTable = cachedChanges_.keys_; - - for (int i = 0; i < keyTable.length; ++i) - { - int[] keys = keyTable[i]; - if (keys != null) - { - for (int j = 0; j < keys.length; ++j) - { - int dataLength = setterKeys_.get(keys[j]); - int pad = (4 - (dataLength % 4)) % 4; - totalLength += 16 + dataLength + pad; - } - } - } - - byte[] jobChangeInformation = new byte[4 + totalLength]; - - BinaryConverter.intToByteArray(numChanges, jobChangeInformation, 0); - int ccsid = system_.getCcsid(); - Converter conv = new Converter(ccsid, system_); - - int offset = 4; - for (int i = 0; i < keyTable.length; ++i) - { - int[] keys = keyTable[i]; - if (keys != null) - { - for (int j = 0; j < keys.length; ++j) - { - int dataLength = setterKeys_.get(keys[j]); - int pad = (4 - (dataLength % 4)) % 4; - BinaryConverter.intToByteArray(16 + dataLength + pad, jobChangeInformation, offset); - offset += 4; - BinaryConverter.intToByteArray(keys[j], jobChangeInformation, offset); - offset += 4; - - boolean isBin = isTypeBinary(keys[j]); - jobChangeInformation[offset++] = (isBin) ? (byte)0xC2 : (byte)0xC3; - jobChangeInformation[offset++] = 0x40; - jobChangeInformation[offset++] = 0x40; - jobChangeInformation[offset++] = 0x40; - - BinaryConverter.intToByteArray(dataLength, jobChangeInformation, offset); - offset += 4; - Object data = cachedChanges_.get(keys[j]); - if (isBin) - { - BinaryConverter.intToByteArray(((Integer)data).intValue(), jobChangeInformation, offset); - } - else - { - try - { - String stringValue = (String)data; - int endPosition = offset + dataLength + pad; - for (int pos = offset; pos < endPosition; ++pos) - { - jobChangeInformation[pos] = 0x40; - } - conv.stringToByteArray(stringValue, jobChangeInformation, offset, dataLength); - } - catch (ClassCastException cce) - { - // Used for system timestamp values like SCHEDULE_DATE. - System.arraycopy((byte[])data, 0, jobChangeInformation, offset, 8); - } - } - offset += dataLength + pad; - } - } - } - - ProgramParameter[] parmList = new ProgramParameter[] - { - new ProgramParameter(createQualifiedJobName()), - new ProgramParameter(realInternalJobID_ == null ? BLANKS16_ : realInternalJobID_), - // Format name, input, char(8), EBCDIC 'JOBC0100'. - new ProgramParameter(new byte[] { (byte)0xD1, (byte)0xD6, (byte)0xC2, (byte)0xC3, (byte)0xF0, (byte)0xF1, (byte)0xF0, (byte)0xF0 } ), - new ProgramParameter(jobChangeInformation), - new ProgramParameter(new byte[8]) // Error code. - }; - - // Note: QWTCHGJB is specified to be "conditionally threadsafe". - // If we call QWTCHGJB on-thread when changing certain attributes, - // the API call will fail and an AS400Exception will be returned. - // Therefore, we will disregard the setting of system property - // "ProgramCall.threadSafe" when calling this particular API. - ProgramCall program; - Boolean threadMode; - if (callOnThread) threadMode = ON_THREAD; - else threadMode = OFF_THREAD; - program = getProgramCall("/QSYS.LIB/QWTCHGJB.PGM", parmList, threadMode); // conditionally threadsafe - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting job information for job: " + toString()); - if (!program.run()) - { - AS400Message[] msgList = program.getMessageList(); - throw new AS400Exception(msgList); - } - cachedChanges_ = null; - } - - /** - Ends this job. To end the job controlled, specify -1 for the delay. To end the job immediately, specify 0 for the delay. Specify any other amount of delay time (in seconds) allowed for the job to cleanup. - @param delay The delay time in seconds. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #hold - @see #release - **/ - public void end(int delay) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Ending job."); - if (delay < -1) - { - Trace.log(Trace.ERROR, "Value of parameter 'delay' is not valid:", delay); - throw new ExtendedIllegalArgumentException("delay (" + delay + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - StringBuffer buf = new StringBuffer(); - buf.append("QSYS/ENDJOB JOB("); // conditionally threadsafe - buf.append(number_); - buf.append('/'); - buf.append(user_); - buf.append('/'); - buf.append(name_); - buf.append(") OPTION("); - if (delay == 0) - { - buf.append("*IMMED)"); - } - else - { - buf.append("*CNTRLD)"); - if (delay > 0) - { - buf.append(" DELAY("); - buf.append(delay); - buf.append(")"); - } - } - String toRun = buf.toString(); - // If the user wants to end the remote command server job that is servicing our connection, they are welcome to "shoot themselves in the foot". - CommandCall cmd = getCommandCall(toRun); - if (!cmd.run()) - { - throw new AS400Exception(cmd.getMessageList()); - } - } - - private final CommandCall getCommandCall(String cmd) - { - if (cmdCall_ == null) { - synchronized (remoteCommandLock_) { - if (cmdCall_ == null) { - cmdCall_ = new CommandCall(system_); - } - } - } - try { cmdCall_.setCommand(cmd); } catch (PropertyVetoException e) {} - return cmdCall_; - } - - private final ProgramCall getProgramCall(String pgm, ProgramParameter[] parms) - { - return getProgramCall(pgm, parms, null); - } - - private final ProgramCall getProgramCall(String pgm, ProgramParameter[] parms, Boolean callOnThread) - { - if (ON_THREAD.equals(callOnThread)) - { - if (pgmCall_onThread_ == null) { - synchronized (remoteCommandLock_) { - if (pgmCall_onThread_ == null) { - pgmCall_onThread_ = new ProgramCall(system_); - pgmCall_onThread_.setThreadSafe(true); // force call to be on-thread - } - } - } - try { pgmCall_onThread_.setProgram(pgm, parms); } catch (PropertyVetoException e) {} - return pgmCall_onThread_; - } - else if (OFF_THREAD.equals(callOnThread)) - { - if (pgmCall_offThread_ == null) { - synchronized (remoteCommandLock_) { - if (pgmCall_offThread_ == null) { - pgmCall_offThread_ = new ProgramCall(system_); - pgmCall_offThread_.setThreadSafe(false); // force call to be off-thread - } - } - } - try { pgmCall_offThread_.setProgram(pgm, parms); } catch (PropertyVetoException e) {} - return pgmCall_offThread_; - } - else // don't specify threadsafety - { - if (pgmCall_ == null) { - synchronized (remoteCommandLock_) { - if (pgmCall_ == null) { - pgmCall_ = new ProgramCall(system_); - } - } - } - try { pgmCall_.setProgram(pgm, parms); } catch (PropertyVetoException e) {} - return pgmCall_; - } - } - - - // Helper method. Used to format some of the attributes that are date Strings into actual Date objects. - private Date getAsDate(int key) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - String str = (String)getValue(key); - - Calendar dateTime = Calendar.getInstance(); - dateTime.clear(); - - Date date = null; - switch (str.trim().length()) - { - case 7: // CYYMMDD format. - dateTime.set(Integer.parseInt(str.substring(0, 3)) + 1900, Integer.parseInt(str.substring(3, 5)) - 1, Integer.parseInt(str.substring(5, 7))); - date = dateTime.getTime(); - break; - case 13: // CYYMMDDHHMMSS format. - dateTime.set(Integer.parseInt(str.substring(0, 3)) + 1900, Integer.parseInt(str.substring(3, 5)) - 1, Integer.parseInt(str.substring(5, 7)), Integer.parseInt(str.substring(7, 9)), Integer.parseInt(str.substring(9, 11)), Integer.parseInt(str.substring(11, 13))); - date = dateTime.getTime(); - break; - } - return date; - } - - // Helper method. Used to retrieve an Integer value out of our internal table. - private int getAsInt(int key) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return Integer.parseInt(getValue(key).toString().trim()); - } - - // Helper method. Used to convert a system timestamp value into a Date object. - private Date getAsSystemDate(int key) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - AS400Timestamp conv = getTimestampConverter(FORMAT_DTS); // field is in *DTS format - return conv.toDate(conv.toTimestamp((byte[])getValue(key)), system_.getTimeZone()); - } - - /** - Returns the number of auxiliary I/O requests performed by the job across all routing steps. This includes both database and nondatabase paging. If the number of auxiliary I/O requests is greater than or equal to 2,147,483,647, a value of -1 is returned. Use the AUXILIARY_IO_REQUESTS_LARGE attribute to retrieve values that are greater than or equal to 2,147,483,647. - @return The number of auxiliary I/O requests performed by the job across all routing steps. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #AUXILIARY_IO_REQUESTS - **/ - public int getAuxiliaryIORequests() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsInt(AUXILIARY_IO_REQUESTS); - } - - /** - Returns a value which represents how this job handles break messages. - @return How this job handles break messages. Possible values are: -

        -
      • {@link #BREAK_MESSAGE_HANDLING_NORMAL BREAK_MESSAGE_HANDLING_NORMAL} - The message queue status determines break message handling. -
      • {@link #BREAK_MESSAGE_HANDLING_HOLD BREAK_MESSAGE_HANDLING_HOLD} - The message queue holds break messages until a user or program requests them. The work station user uses the Display Message (DPSMSG) command to display the messages; a program must issue a Receive Message (RCVMSG) command to receive a message and handle it. -
      • {@link #BREAK_MESSAGE_HANDLING_NOTIFY BREAK_MESSAGE_HANDLING_NOTIFY} - The system notifies the job's message queue when a message arrives. For interactive jobs, the audible alarm sounds if there is one, and the message-waiting light comes on. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #BREAK_MESSAGE_HANDLING - **/ - public String getBreakMessageHandling() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(BREAK_MESSAGE_HANDLING)).trim(); - } - - /** - Indicates if the attribute value changes are cached. - @return true if attribute value changes are cached, false if attribute value changes are committed immediatly. The default is true. - @see #commitChanges - @see #getValue - @see #setCacheChanges - @see #setValue - **/ - public boolean getCacheChanges() - { - return cacheChanges_; - } - - /** - Returns the call stack for the specified thread in this job. This method does not cache any information and always retrieves its data from the system every time it is called. - @param threadID The thread identifier, or {@link #INITIAL_THREAD Job.INITIAL_THREAD} for the initial thread of this job. - @return The array of call stack entries in this job's call stack. The element at index 0 is the oldest entry in the stack, and the last element in the array is the newest, or highest, entry in the stack. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public CallStackEntry[] getCallStack(long threadID) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (threadID < 0 && threadID != INITIAL_THREAD) - { - throw new ExtendedIllegalArgumentException("threadID", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (!isConnected_) - { - if (system_ == null) - { - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (name_ == null) - { - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (user_ == null) - { - throw new ExtendedIllegalStateException("user", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (number_ == null) - { - throw new ExtendedIllegalStateException("number", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - - ProgramParameter[] parms = new ProgramParameter[6]; - int ccsid = system_.getCcsid(); - CharConverter conv = new CharConverter(ccsid); - int len = 2000; - parms[0] = new ProgramParameter(len); - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(len)); - parms[2] = new ProgramParameter(conv.stringToByteArray("CSTK0100")); - byte[] threadJobId = new byte[56]; - AS400Text text10 = new AS400Text(10, ccsid); - AS400Text text6 = new AS400Text(6, ccsid); - byte[] internal = getInternalJobIdentifier(); - if (!name_.equals(JOB_NAME_INTERNAL)) - { - internal = new byte[16]; - for (int i = 0; i < 16; ++i) internal[i] = 0x40; // Blanks. - } - text10.toBytes(name_, threadJobId, 0); - text10.toBytes(user_, threadJobId, 10); - text6.toBytes(number_, threadJobId, 20); - System.arraycopy(internal, 0, threadJobId, 26, 16); - int threadType = (threadID == INITIAL_THREAD ? 2 : 0); // 0 = Specified, 1 = Current, 2 = Initial. - long specifiedThread = (threadID == INITIAL_THREAD ? 0 : threadID); - BinaryConverter.intToByteArray(threadType, threadJobId, 44); - BinaryConverter.longToByteArray(specifiedThread, threadJobId, 48); - parms[3] = new ProgramParameter(threadJobId); - parms[4] = new ProgramParameter(conv.stringToByteArray("JIDF0100")); - parms[5] = new ProgramParameter(new byte[4]); - - ProgramCall pc = getProgramCall("/QSYS.LIB/QWVRCSTK.PGM", parms); // threadsafe - // Note: Even though this API is threadsafe, we won't suggest that it be called on-thread, since all other API's and CL's called by this class are either conditionally threadsafe or non-threadsafe, and we should stay consistent. - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - byte[] data = parms[0].getOutputData(); - int bytesReturned = BinaryConverter.byteArrayToInt(data, 0); - int bytesAvailable = BinaryConverter.byteArrayToInt(data, 4); - while (bytesAvailable > bytesReturned) - { - try - { - len = bytesAvailable * 2; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Calling QWVRCSTK again with receiver size of " + len); - parms[0].setOutputDataLength(len); - parms[1].setInputData(BinaryConverter.intToByteArray(len)); - } - catch (PropertyVetoException pve) - { - } - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - data = parms[0].getOutputData(); - bytesReturned = BinaryConverter.byteArrayToInt(data, 0); - bytesAvailable = BinaryConverter.byteArrayToInt(data, 4); - } - int numEntriesAll = BinaryConverter.byteArrayToInt(data, 8); - int offset = BinaryConverter.byteArrayToInt(data, 12); - int numEntriesReturned = BinaryConverter.byteArrayToInt(data, 16); - if (numEntriesReturned != numEntriesAll) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Not all call stack entries were returned: total: " + numEntriesAll + ", returned: " + numEntriesReturned); - } - threadID = BinaryConverter.byteArrayToLong(data, 20); - if (data[28] != 0x40) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Call stack entry information incomplete due to status: " + Integer.toHexString(0x00FF & data[28])); - } - CallStackEntry[] entries = new CallStackEntry[numEntriesReturned]; - final int vrm530 = AS400.generateVRM(5,3,0); - boolean isV5R3 = system_.getVRM() >= vrm530; - for (int i = 0; i < numEntriesReturned; ++i) - { - int entryLength = BinaryConverter.byteArrayToInt(data, offset); - int stmtIDDisp = BinaryConverter.byteArrayToInt(data, offset + 4); - int numStmtID = BinaryConverter.byteArrayToInt(data, offset + 8); - int procNameDisp = BinaryConverter.byteArrayToInt(data, offset + 12); - int procNameLen = BinaryConverter.byteArrayToInt(data, offset + 16); - int reqLevel = BinaryConverter.byteArrayToInt(data, offset + 20); - String progName = conv.byteArrayToString(data, offset + 24, 10).trim(); - String progLib = conv.byteArrayToString(data, offset + 34, 10).trim(); - int miInstrNum = BinaryConverter.byteArrayToInt(data, offset + 44); - String modName = conv.byteArrayToString(data, offset + 48, 10).trim(); - String modLib = conv.byteArrayToString(data, offset + 58, 10).trim(); - byte controlBound = data[offset + 68]; - long actGroupNum = BinaryConverter.byteArrayToUnsignedInt(data, offset + 72); - String actGroupName = conv.byteArrayToString(data, offset + 76, 10).trim(); - String progASPName = conv.byteArrayToString(data, offset + 88, 10).trim(); - String progLibASP = conv.byteArrayToString(data, offset + 98, 10).trim(); - int progASPNum = BinaryConverter.byteArrayToInt(data, offset + 108); - int progLibASPNum = BinaryConverter.byteArrayToInt(data, offset + 112); - long actGroupNumLong = (isV5R3 ? BinaryConverter.byteArrayToLong(data, offset + 116) : 0); - String[] statementIdentifiers = new String[numStmtID]; - for (int c = 0; c < numStmtID; ++c) - { - statementIdentifiers[c] = conv.byteArrayToString(data, offset + stmtIDDisp + (c * 10), 10).trim(); - } - String procName = (procNameDisp > 0 ? conv.byteArrayToString(data, offset + procNameDisp, procNameLen).trim() : null); - entries[i] = new CallStackEntry(this, threadID, reqLevel, progName, progLib, miInstrNum, modName, modLib, controlBound, actGroupNum, actGroupName, progASPName, progLibASP, progASPNum, progLibASPNum, actGroupNumLong, statementIdentifiers, procName); - offset += entryLength; - } - return entries; - } - - /** - Returns the coded character set identifier (CCSID) used for this job. - @return The coded character set identifier (CCSID) used for this job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #CCSID - **/ - public int getCodedCharacterSetID() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsInt(CCSID); - } - - /** - Returns the completion status of the job. - @return The completion status of the job. Possible values are: -
        -
      • {@link #COMPLETION_STATUS_NOT_COMPLETED COMPLETION_STATUS_NOT_COMPLETED} - The job has not completed. -
      • {@link #COMPLETION_STATUS_COMPLETED_NORMALLY COMPLETION_STATUS_COMPLETED_NORMALLY} - The job completed normally. -
      • {@link #COMPLETION_STATUS_COMPLETED_ABNORMALLY COMPLETION_STATUS_COMPLETED_ABNORMALLY} - The job completed abnormally. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed, or if the job can no longer be found (AS400Exception).. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #COMPLETION_STATUS - **/ - public String getCompletionStatus() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return (String)getValue(COMPLETION_STATUS); - // See note under getStatus(), regarding SBMJOB. - } - - /** - Returns the country or region identifier associated with this job. - @return The country or region identifier associated with this job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #COUNTRY_ID - **/ - public String getCountryID() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(COUNTRY_ID)).trim(); - } - - /** - Returns the amount of processing unit time (in milliseconds) that the job used. If the processing unit time used is greater than or equal to 2,147,483,647 milliseconds, a value of -1 is returned. Use the CPU_TIME_USED_LARGE attribute to retrieve values that are greater than or equal to 2,147,483,647. - @return The amount of processing unit time (in milliseconds) that the job used. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #CPU_TIME_USED - **/ - public int getCPUUsed() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsInt(CPU_TIME_USED); - } - - /** - Returns the name of the current library for the initial thread of the job. If no current library exists, the CURRENT_LIBRARY_EXISTENCE attribute returns 0 and this attribute returns an empty string (""). - @return The name of the current library for the initial thread of the job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #CURRENT_LIBRARY - **/ - public String getCurrentLibrary() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(CURRENT_LIBRARY)).trim(); - } - - /** - Indicates if a current library exists. - @return true if a current library exists, false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #CURRENT_LIBRARY_EXISTENCE - **/ - public boolean getCurrentLibraryExistence() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsInt(CURRENT_LIBRARY_EXISTENCE) == 1; - } - - /** - Returns the date and time when the job was placed on the system. - @return The date and time when the job was placed on the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #DATE_ENTERED_SYSTEM - **/ - public Date getDate() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsDate(DATE_ENTERED_SYSTEM); - } - - /** - Returns the format in which dates are presented. - @return The format in which dates are presented. Possible values are: -
        -
      • {@link #DATE_FORMAT_YMD DATE_FORMAT_YMD} - Year, month, and day format. -
      • {@link #DATE_FORMAT_MDY DATE_FORMAT_MDY} - Month, day, and year format. -
      • {@link #DATE_FORMAT_DMY DATE_FORMAT_DMY} - Day, month, and year format. -
      • {@link #DATE_FORMAT_JULIAN DATE_FORMAT_JULIAN} - Julian format (year and day). -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #DATE_FORMAT - **/ - public String getDateFormat() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(DATE_FORMAT)).trim(); - } - - /** - Returns the value used to separate days, months, and years when presenting a date. - @return The value used to separate days, months, and years when presenting a date. Possible values are: -
        -
      • {@link #DATE_SEPARATOR_SLASH DATE_SEPARATOR_SLASH} - A slash (/) is used for the date separator. -
      • {@link #DATE_SEPARATOR_DASH DATE_SEPARATOR_DASH} - A dash (-) is used for the date separator. -
      • {@link #DATE_SEPARATOR_PERIOD DATE_SEPARATOR_PERIOD} - A period (.) is used for the date separator. -
      • {@link #DATE_SEPARATOR_BLANK DATE_SEPARATOR_BLANK} - A blank is used for the date separator. -
      • {@link #DATE_SEPARATOR_COMMA DATE_SEPARATOR_COMMA} - A comma (,) is used for the date separator. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #DATE_SEPARATOR - **/ - public String getDateSeparator() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return (String)getValue(DATE_SEPARATOR); // Don't trim. - } - - /** - Returns whether connections using distributed data management (DDM) protocols remain active when they are not being used. The connections include APPC conversations, active TCP/IP connections, or Opti-Connect connections. The DDM protocols are used in Distributed Relational Database Architecture (DRDA) applications, DDM applications, or DB2 Multisystem applications. - @return Whether connections using distributed data management (DDM) protocols remain active when they are not being used. Possible values are: -
        -
      • {@link #KEEP_DDM_CONNECTIONS_ACTIVE_KEEP KEEP_DDM_CONNECTIONS_ACTIVE_KEEP} - The system keeps DDM connections active when there are no users, except for the following: -
          -
        • The routing step ends on the source system. The routing step ends when the job ends or when the job is rerouted to another routing step. -
        • The Reclaim Distributed Data Management Conversation (RCLDDMCNV) command or the Reclaim Resources (RCLRSC) command runs. -
        • A communications failure or an internal failure occurs. -
        • A DRDA connection to an application server not running on an IBM i system ends. -
        -
      • {@link #KEEP_DDM_CONNECTIONS_ACTIVE_DROP KEEP_DDM_CONNECTIONS_ACTIVE_DROP} - The system ends a DDM connection when there are no users. Examples include when an application closes a DDM file, or when a DRDA application runs an SQL DISCONNECT statement. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #KEEP_DDM_CONNECTIONS_ACTIVE - **/ - public String getDDMConversationHandling() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(KEEP_DDM_CONNECTIONS_ACTIVE)).trim(); - } - - /** - Returns the decimal format used for this job. - @return The decimal format used for this job. Possible values are: -
        -
      • {@link #DECIMAL_FORMAT_PERIOD DECIMAL_FORMAT_PERIOD} - Uses a period for a decimal point, a comma for a 3-digit grouping character, and zero-suppresses to the left of the decimal point. -
      • {@link #DECIMAL_FORMAT_COMMA_J DECIMAL_FORMAT_COMMA_J} - Uses a comma for a decimal point, a period for a 3-digit grouping character, and zero-suppresses to the left of the decimal point. -
      • {@link #DECIMAL_FORMAT_COMMA_I DECIMAL_FORMAT_COMMA_I} - Uses a comma for a decimal point and a period for a 3-digit grouping character. The zero-suppression character is in the second position (rather than the first) to the left of the decimal notation. Balances with zero values to the left of the comma are written with one leading zero (0,04). This constant also overrides any edit codes that might suppress the leading zero. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #DECIMAL_FORMAT - **/ - public String getDecimalFormat() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(DECIMAL_FORMAT)).trim(); - } - - /** - Returns the default coded character set identifier (CCSID) used for this job. - @return The default coded character set identifier (CCSID) used for this job. The value will be 0 if the job is not active. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #DEFAULT_CCSID - **/ - public int getDefaultCodedCharacterSetIdentifier() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsInt(DEFAULT_CCSID); - } - - /** - Returns the default maximum time (in seconds) that a thread in the job waits for a system instruction, such as a LOCK machine interface (MI) instruction, to acquire a resource. This default wait time is used when a wait time is not otherwise specified for a given situation. Normally, this is the amount of time the user is willing to wait for the system before the request is ended. If the job consists of multiple routing steps, a change to this attribute during a routing step does not appy to subsequent routing steps. The valid range is 1 through 9999999. A value of -1 represents no maximum wait time (*NOMAX). - @return The default maximum time (in seconds) that a thread in the job waits for a system instruction to acquire a resource. The value -1 means there is no maximum (*NOMAX). - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #DEFAULT_WAIT_TIME - **/ - public int getDefaultWait() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsInt(DEFAULT_WAIT_TIME); - } - - /** - Returns the action taken for interactive jobs when an I/O error occurs for the job's requesting program device. - @return The action taken for interactive jobs when an I/O error occurs for the job's requesting program device. Possible values are: -
        -
      • {@link #DEVICE_RECOVERY_ACTION_MESSAGE DEVICE_RECOVERY_ACTION_MESSAGE} - Signals the I/O error message to the application and lets the application program perform error recovery. -
      • {@link #DEVICE_RECOVERY_ACTION_DISCONNECT_MESSAGE DEVICE_RECOVERY_ACTION_DISCONNECT_MESSAGE} - Disconnects the job when an I/O error occurs. When the job reconnects, the system sends an error message to the application program, indicating the job has reconnected and that the work station device has recovered. -
      • {@link #DEVICE_RECOVERY_ACTION_DISCONNECT_END_REQUEST DEVICE_RECOVERY_ACTION_DISCONNECT_END_REQUEST} - Disconnects the job when an I/O error occurs. When the job reconnects, the system sends the End Request (ENDRQS) command to return control to the previous request level. -
      • {@link #DEVICE_RECOVERY_ACTION_END_JOB DEVICE_RECOVERY_ACTION_END_JOB} - Ends the job when an I/O error occurs. A message is sent to the job's log and to the history log (QHST) indicating the job ended because of a device error. -
      • {@link #DEVICE_RECOVERY_ACTION_END_JOB_NO_LIST DEVICE_RECOVERY_ACTION_END_JOB_NO_LIST} - Ends the job when an I/O error occurs. There is no job log produced for the job. The system sends a message to the QHST log indicating the job ended because of a device error. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #DEVICE_RECOVERY_ACTION - **/ - public String getDeviceRecoveryAction() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(DEVICE_RECOVERY_ACTION)).trim(); - } - - /** - Returns the message severity level of escape messages that can cause a batch job to end. The batch job ends when a request in the batch input stream sends an escape message, whose severity is equal to or greater than this value, to the request processing program. - @return The message severity level of escape messages that can cause a batch job to end. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #END_SEVERITY - **/ - public int getEndSeverity() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsInt(END_SEVERITY); - } - - /** - Returns additional information (as described by the FUNCTION_TYPE attribute) about the last high-level function initiated by the initial thread. - @return The additional information (as described by the FUNCTION_TYPE attribute) about the last high-level function initiated by the initial thread. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #FUNCTION_NAME - **/ - public String getFunctionName() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(FUNCTION_NAME)).trim(); - } - - /** - Returns the last high-level function initiated by the initial thread. This field may not be cleared when a function is completed. - @return The last high-level function initiated by the initial thread. Possible values are: -
        -
      • {@link #FUNCTION_TYPE_BLANK FUNCTION_TYPE_BLANK} - The system is not performing a logged function. -
      • {@link #FUNCTION_TYPE_COMMAND FUNCTION_TYPE_COMMAND} - A command is running interactively, or it is in a batch input stream, or it was requested from a system menu. Commands in CL programs or REXX procedures are not logged. The FUNCTION_NAME attribute contains the name of the command and is only updated when a command is processed. -
      • {@link #FUNCTION_TYPE_DELAY FUNCTION_TYPE_DELAY} - The initial thread of the job is processing a Delay Job (DLYJOB) command. The FUNCTION_NAME attribute contains the number of seconds the job is delayed (up to 999999 seconds), or the time when the job is to resume processing (HH:MM:SS), depending on how you specified the command. -
      • {@link #FUNCTION_TYPE_GROUP FUNCTION_TYPE_GROUP} - The Transfer Group Job (TFRGRPJOB) command suspended the job. The FUNCTION_NAME attribute contains the group job name for that job. -
      • {@link #FUNCTION_TYPE_INDEX FUNCTION_TYPE_INDEX} - The initial thread of the job is rebuilding an index (access path). The FUNCTION_NAME attribute contains the name of the logical file whose index is rebuilt. -
      • {@link #FUNCTION_TYPE_JAVA FUNCTION_TYPE_JAVA} - The initial thread of the job is running a Java Vertual Machine (JVM). The FUNCTION_NAME attribute contains the name of the java class. -
      • {@link #FUNCTION_TYPE_LOG FUNCTION_TYPE_LOG} - The system logs history information in a database file. The FUNCTION_NAME attribute contains the name of the log (QHST is the only log currently supported). -
      • {@link #FUNCTION_TYPE_MRT FUNCTION_TYPE_MRT} - The job is a multiple requester terminal (MRT) job if the {@link #JOB_TYPE JOB_TYPE} is {@link #JOB_TYPE_BATCH JOB_TYPE_BATCH} and the {@link #JOB_SUBTYPE JOB_SUBTYPE} is {@link #JOB_SUBTYPE_MRT JOB_SUBTYPE_MRT}, or it is an interactive job attached to an MRT job if the {@link #JOB_TYPE JOB_TYPE} is {@link #JOB_TYPE_INTERACTIVE JOB_TYPE_INTERACTIVE}. -

        For MRT jobs, the FUNCTION_NAME attribute contains information in the following format: -

          -
        • CHAR(2): The number of requesters currently attached to the MRT job. -
        • CHAR(1): The field is reserved for a / (slash). -
        • CHAR(2): The maximum number (MRTMAX) of requesters. -
        • CHAR(1): Reserved. -
        • CHAR(3): The never-ending program (NEP) indicator. If an MRT is also an NEP, the MRT stays active even if there are no requesters of the MRT. A value of NEP indicates a never-ending program. A value of blanks indicates that it is not a never-ending program. -
        • CHAR(1): Reserved. -
        -

        For interactive jobs attached to an MRT, the FUNCTION_NAME attribute contains the name of the MRT procedure. -

      • {@link #FUNCTION_TYPE_MENU FUNCTION_TYPE_MENU} - The initial thread of the job is currently at a system menu. The FUNCTION_NAME field contains the name of the menu. -
      • {@link #FUNCTION_TYPE_IO FUNCTION_TYPE_IO} - The job is a subsystem monitor that is performing input/output (I/O) operations to a work station. The FUNCTION_NAME attribute contains the name of the work station device to which the subsystem is performing an input/output operation. -
      • {@link #FUNCTION_TYPE_PROCEDURE FUNCTION_TYPE_PROCEDURE} - The initial thread of the job is running a procedure. The FUNCTION_NAME attribute contains the name of the procedure. -
      • {@link #FUNCTION_TYPE_PROGRAM FUNCTION_TYPE_PROGRAM} - The initial thread of the job is running a program. The FUNCTION_NAME attribute contains the name of the program. -
      • {@link #FUNCTION_TYPE_SPECIAL FUNCTION_TYPE_SPECIAL} - The function type is a special function. For this value, the FUNCTION_NAME attribute contains one of the following values: -
          -
        • ADLACTJOB: Auxiliary storage is being allocated for the number of active jobs specified in the QADLACTJ system value. This may indicate that the system value for the initial number of active jobs is too low. -
        • ADLTOTJOB: Auxiliary storage is being allocated for the number of jobs specified in the QADLTOTJ system value. -
        • CMDENT: The Command Entry display is being used. -
        • COMMIT: A commit operation is being performed. -
        • DIRSHD: Directory shadowing. -
        • DLTSPLF: The system is deleting a spooled file. -
        • DUMP: A dump is in process. -
        • JOBIDXRCY: A damaged job index is being recovered. -
        • JOBLOG: The system is producing a job log. -
        • PASSTHRU: The job is a pass-through job. -
        • RCLSPLSTG: Empty spooled database members are being deleted. -
        • ROLLBACK: A rollback operation is being performed. -
        • SPLCLNUP: Spool cleanup is in process. -
        -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #FUNCTION_TYPE - **/ - public String getFunctionType() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return (String)getValue(FUNCTION_TYPE); // Don't trim. - } - - /** - Returns how the job answers inquiry messages. - @return How the job answers inquiry messages. Possible values are: -
        -
      • {@link #INQUIRY_MESSAGE_REPLY_REQUIRED INQUIRY_MESSAGE_REPLY_REQUIRED} - The job requires an answer for any inquiry messages that occur while this job is running. -
      • {@link #INQUIRY_MESSAGE_REPLY_DEFAULT INQUIRY_MESSAGE_REPLY_DEFAULT} - The system uses the default message reply to answer any inquiry messages issued while this job is running. The default reply is either defined in the message description or is the default system reply. -
      • {@link #INQUIRY_MESSAGE_REPLY_SYSTEM_REPLY_LIST INQUIRY_MESSAGE_REPLY_SYSTEM_REPLY_LIST} - The system reply list is checked to see if there is an entry for an inquiry message issued while this job is running. If a match occurs, the system uses the reply value for that entry. If no entry exists for that message, the system uses an inquiry message. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #INQUIRY_MESSAGE_REPLY - **/ - public String getInquiryMessageReply() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(INQUIRY_MESSAGE_REPLY)).trim(); - } - - /** - Returns the count of operator interactions, such as pressing the Enter key or a function key. This field is zero for jobs that have no interactions. - @return The count of operator interactions, such as pressing the Enter key or a function key. This field is zero for jobs that have no interactions. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #INTERACTIVE_TRANSACTIONS - **/ - public int getInteractiveTransactions() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsInt(INTERACTIVE_TRANSACTIONS); - } - - /** - Returns the internal job identifier. The internal job identifier is a value input to other APIs to increase the speed of locating the job on the system. The identifier is not valid following an initial program load (IPL). If you attempt to use it after an IPL, an exception occurs. - @return The internal job identifier. - @deprecated Use {@link #getInternalJobIdentifier() getInternalJobIdentifier()} instead. The internal job identifier should be treated as a byte array of 16 bytes. - **/ - public String getInternalJobID() - { - return internalJobID_; - } - - /** - Returns the internal job identifier. The internal job identifier is a value input to other APIs to increase the speed of locating the job on the system. The identifier is not valid following an initial program load (IPL). If you attempt to use it after an IPL, an exception occurs. - @return The 16-byte internal job identifier, or null if one has not been set or retrieved from the system. - @see #setInternalJobIdentifier - **/ - public byte[] getInternalJobIdentifier() - { - return realInternalJobID_; - } - - /** - Returns an identifier assigned to the job by the system to collect resource use information for the job when job accounting is active. - @return An identifier assigned to the job by the system to collect resource use information for the job when job accounting is active. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #ACCOUNTING_CODE - **/ - public String getJobAccountingCode() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(ACCOUNTING_CODE)).trim(); - } - - /** - Returns the date and time when the job began to run on the system. - @return The date and time when the job began to run on the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #DATE_STARTED - **/ - public Date getJobActiveDate() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsDate(DATE_STARTED); - } - - /** - Returns the date to be used for the job. This value is for jobs whose status is *JOBQ or *ACTIVE. For jobs with a status of *OUTQ, the value for this field is blank. - @return The date to be used for the job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #JOB_DATE - **/ - public Date getJobDate() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsDate(JOB_DATE); - } - - /** - Returns the fully qualified integrated file system path name for the job description. The job description is a set of job-related attributes used for one or more jobs on the system. These attributes determine how the job is run on the system. Multiple jobs can also use the same job description. - @return The fully qualified integrated file system path name for the job description. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #JOB_DESCRIPTION - @see QSYSObjectPathName - **/ - public String getJobDescription() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - String jobd = ((String)getValue(JOB_DESCRIPTION)).trim(); - if (jobd.length() > 0 && !jobd.startsWith("*")) - { - String name = jobd.substring(0, 10).trim(); - String lib = jobd.substring(10, jobd.length()); - String path = QSYSObjectPathName.toPath(lib, name, "JOBD"); - return path; - } - return jobd; - } - - /** - Returns the date and time when the job completed running on the system. - @return The date and time when the job completed running on the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #DATE_ENDED - **/ - public Date getJobEndedDate() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsDate(DATE_ENDED); - } - - /** - Returns the date and time when the job was placed on the system. - @return The date and time when the job was placed on the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #DATE_ENTERED_SYSTEM - **/ - public Date getJobEnterSystemDate() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsDate(DATE_ENTERED_SYSTEM); - } - - /** - Returns the job log. - @return The job log. - **/ - public JobLog getJobLog() - { - // Rather than using name_, user_, and number_, I will get their attribute values. This will work when CURRENT or an internal job id is specified. - try - { - return new JobLog(system_, (String)getValue(JOB_NAME), (String)getValue(USER_NAME), (String)getValue(JOB_NUMBER)); - } - catch (Exception e) - { - if (Trace.traceOn_) - { - Trace.log(Trace.ERROR, "Error retrieving values to create job log: "+e); - } - } - return null; - } - - /** - Returns the action to take when the message queue is full. - @return The action to take when the message queue is full. Possible values are: -
        -
      • {@link #MESSAGE_QUEUE_ACTION_NO_WRAP MESSAGE_QUEUE_ACTION_NO_WRAP} - When the job message queue is full, do not wrap. This action causes the job to end. -
      • {@link #MESSAGE_QUEUE_ACTION_WRAP MESSAGE_QUEUE_ACTION_WRAP} - When the job message queue is full, wrap to the beginning and start filling again. -
      • {@link #MESSAGE_QUEUE_ACTION_PRINT_WRAP MESSAGE_QUEUE_ACTION_PRINT_WRAP} - When the job message queue is full, wrap the message queue and print the messages that are being overlaid because of the wrapping. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #MESSAGE_QUEUE_ACTION - **/ - public String getJobMessageQueueFullAction() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(MESSAGE_QUEUE_ACTION)).trim(); - } - - /** - Returns the maximum size (in megabytes) that the job message queue can become. - @return The maximum size (in megabytes) that the job message queue can become. The range is 2 to 64. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #MESSAGE_QUEUE_MAX_SIZE - **/ - public int getJobMessageQueueMaximumSize() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsInt(MESSAGE_QUEUE_MAX_SIZE); - } - - /** - Returns the date and time this job was put on this job queue. This field will contain blanks if the job was not on a job queue. - @return The date and time this job was put on this job queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #JOB_QUEUE_DATE - **/ - public Date getJobPutOnJobQueueDate() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsSystemDate(JOB_QUEUE_DATE); - } - - /** - Returns the date and time the job is scheduled to become active. - @return The date and time the job is scheduled to become active. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #SCHEDULE_DATE - **/ - public Date getScheduleDate() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (cachedChanges_ != null && (cachedChanges_.contains(SCHEDULE_DATE) || cachedChanges_.contains(SCHEDULE_TIME))) - { - Calendar calendar = Calendar.getInstance(); - calendar.clear(); - String scheduleDate = (String)cachedChanges_.get(SCHEDULE_DATE); - if (scheduleDate != null) - { - int century = Integer.parseInt(scheduleDate.substring(0, 1)); - int year = Integer.parseInt(scheduleDate.substring(1, 3)); - int month = Integer.parseInt(scheduleDate.substring(3, 5)); - int day = Integer.parseInt(scheduleDate.substring(5, 7)); - - calendar.set(Calendar.YEAR, year + ((century == 0) ? 1900 : 2000)); - calendar.set(Calendar.MONTH, month - 1); - calendar.set(Calendar.DAY_OF_MONTH, day); - } - else - { - calendar.set(Calendar.HOUR_OF_DAY, 0); - calendar.set(Calendar.MINUTE, 0); - calendar.set(Calendar.SECOND, 0); - } - - String scheduleTime = (String)cachedChanges_.get(SCHEDULE_TIME); - if (scheduleTime != null) - { - int hours = Integer.parseInt(scheduleTime.substring(0, 2)); - int minutes = Integer.parseInt(scheduleTime.substring(2, 4)); - int seconds = Integer.parseInt(scheduleTime.substring(4, 6)); - - calendar.set(Calendar.HOUR_OF_DAY, hours); - calendar.set(Calendar.MINUTE, minutes); - calendar.set(Calendar.SECOND, seconds); - } - else - { - calendar.set(Calendar.YEAR, 0); - calendar.set(Calendar.MONTH, 0); - calendar.set(Calendar.DAY_OF_MONTH, 0); - } - return calendar.getTime(); - } - return getAsSystemDate(SCHEDULE_DATE_GETTER); // System timestamp format again. - } - - /** - Returns the status of this job on the job queue. - @return The status of this job on the job queue. Possible values are: -
        -
      • {@link #JOB_QUEUE_STATUS_BLANK JOB_QUEUE_STATUS_BLANK} - This job was not on a job queue. -
      • {@link #JOB_QUEUE_STATUS_SCHEDULED JOB_QUEUE_STATUS_SCHEDULED} - This job will run as scheduled. -
      • {@link #JOB_QUEUE_STATUS_HELD JOB_QUEUE_STATUS_HELD} - This job is being held on the job queue. -
      • {@link #JOB_QUEUE_STATUS_READY JOB_QUEUE_STATUS_READY} - This job is ready to be selected. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #JOB_QUEUE_STATUS - **/ - public String getJobStatusInJobQueue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(JOB_QUEUE_STATUS)).trim(); - } - - /** - Returns the current setting of the job switches used by this job. This value is returned for all job types. - @return The current setting of the job switches used by this job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #JOB_SWITCHES - **/ - public String getJobSwitches() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return (String)getValue(JOB_SWITCHES); - } - - /** - Returns the language identifier associated with this job. The language identifier is used when *LANGIDUNQ or *LANGIDSHR is specified on the sort sequence parameter. If the job CCSID is 65535, this parameter is also used to determine the value of the job default CCSID. - @return The language identifier associated with this job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #LANGUAGE_ID - **/ - public String getLanguageID() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return (String)getValue(LANGUAGE_ID); - } - - /** - Returns a value indicating whether or not commands are logged for CL programs that are run. - @return The value indicating whether or not commands are logged for CL programs that are run. Possible values are: -
        -
      • {@link #LOG_CL_PROGRAMS_YES LOG_CL_PROGRAMS_YES} - Commands are logged for CL programs that are run. -
      • {@link #LOG_CL_PROGRAMS_NO LOG_CL_PROGRAMS_NO} - Commands are not logged for CL programs that are run. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #LOG_CL_PROGRAMS - **/ - public String getLoggingCLPrograms() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(LOG_CL_PROGRAMS)).trim(); - } - - /** - Returns what type of information is logged. - @return A value indicating what type of information is logged. Possible values are: -
        -
      • 0 - No messages are logged. -
      • 1 - All messages sent to the job's external message queue with a severity greater than or equal to the message logging severity are logged. This includes the indication of job start, job end, and job completion status. -
      • 2 - The following information is logged: -
          -
        • Logging level 1 information. -
        • Request messages that result in a high-level message with a severity code greater than or equal to the logging severity cause the request message and all associated messages to be logged. A high-level message is one that is sent to the program message queue of the program that receives the request message. For example, QCMD is an IBM-supplied request processing program that receives request messages. -
        -
      • 3 - The following information is logged: -
          -
        • Logging level 1 and 2 information is logged. -
        • All request messages are logged. -
        • Commands run by a CL program are logged if it is allowed by the LOG_CL_PROGRAMS attribute and the log attribute of the CL program. -
        -
      • 4 - The following information is logged: -
          -
        • All request messages and all messages with a severity greater than or equal to the message logging severity, including trace messages. -
        • Commands run by a CL program are logged if it is allowed by the LOG_CL_PROGRAMS attribute and the log attribute of the CL program. -
        -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #LOGGING_LEVEL - **/ - public int getLoggingLevel() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return Integer.parseInt((String)getValue(LOGGING_LEVEL)); - } - - /** - Returns the severity level that is used in conjunction with the logging level to determine which error messages are logged in the job log. The values range from 00 through 99. - @return The severity level that is used in conjunction with the logging level to determine which error messages are logged in the job log. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #LOGGING_SEVERITY - **/ - public int getLoggingSeverity() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsInt(LOGGING_SEVERITY); - } - - /** - Returns the level of message text that is written in the job log when a message is logged according to the LOGGING_LEVEL and LOGGING_SEVERITY. - @return The level of message text that is written in the job log when a message is logged according to the LOGGING_LEVEL and LOGGING_SEVERITY. Possible values are: -
        -
      • {@link #LOGGING_TEXT_MESSAGE LOGGING_TEXT_MESSAGE} - Only the message text is written to the job log. -
      • {@link #LOGGING_TEXT_SECLVL LOGGING_TEXT_SECLVL} - Both the message text and the message help (cause and recovery) of the error message are written to the job log. -
      • {@link #LOGGING_TEXT_NO_LIST LOGGING_TEXT_NO_LIST} - If the job ends normally, no job log is produced. If the job ends abnormally (the job end code is 20 or higher), a job log is produced. The messages that appear in the job log contain both the message text and the message. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #LOGGING_TEXT - **/ - public String getLoggingText() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(LOGGING_TEXT)).trim(); - } - - /** - Returns the mode name of the advanced program-to-program communications (APPC) device that started the job. - @return The mode name of the advanced program-to-program communications (APPC) device that started the job. Possible values are: -
        -
      • The mode name is *BLANK. -
      • The mode name is blanks. -
      • The name of the mode. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #MODE - **/ - public String getModeName() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(MODE)).trim(); - } - - /** - Returns the job name. - @return The job name. - **/ - public String getName() - { - return name_; - } - - /** - Returns the job number. - @return The job number. - **/ - public String getNumber() - { - return number_; - } - - /** - Returns the number of libraries in the system portion of the library list of the initial thread of the job. - @return The number of libraries in the system portion of the library list of the initial thread of the job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #SYSTEM_LIBRARY_LIST - **/ - public int getNumberOfLibrariesInSYSLIBL() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getSystemLibraryList().length; - } - - /** - Returns the number of libraries in the user portion of the library list for the initial thread of the job. - @return The number of libraries in the user portion of the library list for the initial thread of the job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #USER_LIBRARY_LIST - **/ - public int getNumberOfLibrariesInUSRLIBL() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getUserLibraryList().length; - } - - /** - Returns the number of libraries that contain product information for the initial thread of the job. - @return The number of libraries that contain product information for the initial thread of the job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #PRODUCT_LIBRARIES - **/ - public int getNumberOfProductLibraries() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getProductLibraries().length; - } - - /** - Returns the fully qualified integrated file system path name of the default output queue that is used for spooled output produced by this job. The default output queue is only for spooled printer files that specify *JOB for the output queue. - @return The fully qualified integrated file system path name of the default output queue that is used for spooled output produced by this job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #OUTPUT_QUEUE - @see QSYSObjectPathName - **/ - public String getOutputQueue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - String queue = ((String)getValue(OUTPUT_QUEUE)).trim(); - if (queue.length() > 0 && !queue.startsWith("*")) - { - String name = queue.substring(0, 10).trim(); - String lib = queue.substring(10, queue.length()); - String path = QSYSObjectPathName.toPath(lib, name, "OUTQ"); - return path; - } - return queue; - } - - /** - Returns the output priority for spooled output files that this job produces. The highest priority is 0, and the lowest is 9. - @return The output priority for spooled output files that this job produces. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #OUTPUT_QUEUE_PRIORITY - **/ - public int getOutputQueuePriority() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsInt(OUTPUT_QUEUE_PRIORITY); - } - - /** - Returns the identifier of the system-related pool from which the job's main storage is allocated. These identifiers are not the same as those specified in the subsystem description, but are the same as the system pool identifiers shown on the system status display. This is the pool that the threads in the job start in. Also see the CURRENT_SYSTEM_POOL_ID for more information. - @return The identifier of the system-related pool from which the job's main storage is allocated. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #SYSTEM_POOL_ID - **/ - public int getPoolIdentifier() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsInt(SYSTEM_POOL_ID); - } - - /** - Returns the printer device used for printing output from this job. - @return The printer device used for printing output from this job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #PRINTER_DEVICE_NAME - **/ - public String getPrinterDeviceName() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(PRINTER_DEVICE_NAME)).trim(); - } - - /** - Returns a value indicating whether border and header information is provided when the Print key is pressed. - @return The value indicating whether border and header information is provided when the Print key is pressed. Possible values are: -
        -
      • {@link #PRINT_KEY_FORMAT_NONE PRINT_KEY_FORMAT_NONE} - The border and header information is not included with output from the Print key. -
      • {@link #PRINT_KEY_FORMAT_BORDER PRINT_KEY_FORMAT_BORDER} - The border information is included with output from the Print key. -
      • {@link #PRINT_KEY_FORMAT_HEADER PRINT_KEY_FORMAT_HEADER} - The header information is included with output from the Print key. -
      • {@link #PRINT_KEY_FORMAT_ALL PRINT_KEY_FORMAT_ALL} - The border and header information is included with output from the Print key. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #PRINT_KEY_FORMAT - **/ - public String getPrintKeyFormat() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(PRINT_KEY_FORMAT)).trim(); - } - - /** - Returns the line of text (if any) that is printed at the bottom of each page of printed output for the job. - @return The line of text (if any) that is printed at the bottom of each page of printed output for the job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #PRINT_TEXT - **/ - public String getPrintText() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(PRINT_TEXT)).trim(); - } - - /** - Returns the libraries that contain product information for the initial thread of the job. - @return The libraries that contain product information for the initial thread of the job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #PRODUCT_LIBRARIES - **/ - public String[] getProductLibraries() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - String val = (String)getValue(PRODUCT_LIBRARIES); - StringTokenizer st = new StringTokenizer(val, " "); - String[] libraries = new String[st.countTokens()]; - int i = 0; - while (st.hasMoreTokens()) - { - libraries[i++] = st.nextToken(); - } - return libraries; - } - - /** - Indicates whether or not the job is eligible to be moved out of main storage and put into auxiliary storage at the end of a time slice or when entering a long wait (such as waiting for a work station user's response). This attribute is ignored when more than one thread is active within the job. If the job consists of multiple routing steps, a change to this attribute during a routing step does not apply to subsequent routing steps. - @return true if the job is eligible to be moved out of main storage and put into auxiliary storage at the end of a time slice or when entering a long wait; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #ELIGIBLE_FOR_PURGE - **/ - public boolean getPurge() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(ELIGIBLE_FOR_PURGE)).trim().equals(ELIGIBLE_FOR_PURGE_YES); - } - - /** - Returns the fully qualified integrated file system path name of the job queue that the job is currently on, or that the job was on if it is currently active. This value is for jobs whose status is *JOBQ or *ACTIVE. For jobs with a status of *OUTQ, the value for this field is blank. - @return The fully qualified integrated file system path name of the job queue that the job is currently on, or that the job was on if it is currently active. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #JOB_QUEUE - @see QSYSObjectPathName - **/ - public String getQueue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - String queue = ((String)getValue(JOB_QUEUE)).trim(); - if (queue.length() > 0 && !queue.startsWith("*")) - { - String name = queue.substring(0, 10).trim(); - String lib = queue.substring(10, queue.length()); - String path = QSYSObjectPathName.toPath(lib, name, "JOBQ"); - return path; - } - return queue; - } - - /** - Returns the scheduling priority of the job compared to other jobs on the same job queue. The highest priority is 0 and the lowest is 9. This value is valid for jobs whose status is *JOBQ or *ACTIVE. For jobs with a status of *OUTQ, then the priority returned is -1. - @return The scheduling priority of the job compared to other jobs on the same job queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #JOB_QUEUE_PRIORITY - **/ - public int getQueuePriority() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - String p = ((String)getValue(JOB_QUEUE_PRIORITY)).trim(); - if (p.length() == 0) return -1; - return (new Integer(p)).intValue(); - } - - /** - Returns the routing data that is used to determine the routing entry that identifies the program to start for the routing step. - @return The routing data that is used to determine the routing entry that identifies the program to start for the routing step. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #ROUTING_DATA - **/ - public String getRoutingData() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(ROUTING_DATA)).trim(); - } - - /** - Returns the priority at which the job is currently running, relative to other jobs on the system. The run priority ranges from 0 (highest priority) to 99 (lowest priority). - @return The priority at which the job is currently running, relative to other jobs on the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #RUN_PRIORITY - **/ - public int getRunPriority() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsInt(RUN_PRIORITY); - } - - /** - Indicates whether the job is to be treated like a signed-on user on the system. - @return true if the job should be treateded like a signed-on user; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #SIGNED_ON_JOB - **/ - public boolean getSignedOnJob() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(SIGNED_ON_JOB)).trim().equals("0"); - } - - /** - Returns the name of the sort sequence table associated with this job. - @return The name of the sort sequence table associated with this job. Possible values are: -
        -
      • {@link #SORT_SEQUENCE_TABLE_NONE SORT_SEQUENCE_TABLE_NONE} - No sort sequence table is used. The hexadecimal values of the characters are used to determine the sort sequence. -
      • {@link #SORT_SEQUENCE_TABLE_LANGUAGE_SHARED_WEIGHT SORT_SEQUENCE_TABLE_LANGUAGE_SHARED_WEIGHT} - The sort sequence table used can contain the same weight for multiple characters, and it is the shared weight sort table associated with the language specified in the LANGUAGE_ID attribute. -
      • {@link #SORT_SEQUENCE_TABLE_LANGUAGE_UNIQUE_WEIGHT SORT_SEQUENCE_TABLE_LANGUAGE_UNIQUE_WEIGHT} - The sort sequence table used must contain a unique weight for each character in the code page, and it is the unique weight sort table associated with the language specified in the LANGUAGE_ID parameter. -
      • The fully qualified integrated file system path name of the sort sequence table associated with this job. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #SORT_SEQUENCE_TABLE - @see QSYSObjectPathName - **/ - public String getSortSequenceTable() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - String table = ((String)getValue(SORT_SEQUENCE_TABLE)).trim(); - if (table.length() > 0 && !table.startsWith("*")) - { - String name = table.substring(0, 10).trim(); - String lib = table.substring(10, table.length()); - String path = QSYSObjectPathName.toPath(lib, name, "FILE"); - return path; - } - return table; - } - - /** - Returns the status of this job. - @return The status of this job. Possible values are: -
        -
      • {@link #JOB_STATUS_ACTIVE JOB_STATUS_ACTIVE} - This job is an active job. This includes group jobs, system request jobs, and disconnected jobs. -
      • {@link #JOB_STATUS_JOBQ JOB_STATUS_JOBQ} - This job is currently on a job queue. -
      • {@link #JOB_STATUS_OUTQ JOB_STATUS_OUTQ} - This job has completed running, but still has output on an output queue. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed, or if the job can no longer be found (AS400Exception). - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #JOB_STATUS - **/ - public String getStatus() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(JOB_STATUS)).trim(); - // Note: For jobs created by SBMJOB: If the completed job still has spooled files attached to it, it will be found with *OUTQ status. But if there are no spooled files (i.e. a joblog or other output spooled by the job), or if they have SPLFACN set to *DETACH, then upon job completion the permanent job structure will be cleaned up immediately, and you will not find the job with DSPJOB, QUSRJOBI or any other means. In that case, this method (and most other 'get' methods) will throw an AS400Exception containing an AS400Message indicating "Internal job identifier no longer valid" (message ID CPF3C52). That exception should be interpreted as an indication that the job has completed. - } - - /** - Returns whether status messages are displayed for this job. - @return A value indicating whether status messages are displayed for this job. Possible values are: -
        -
      • {@link #STATUS_MESSAGE_HANDLING_NONE STATUS_MESSAGE_HANDLING_NONE} - This job does not display status messages. -
      • {@link #STATUS_MESSAGE_HANDLING_NORMAL STATUS_MESSAGE_HANDLING_NORMAL} - This job displays status messages. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #STATUS_MESSAGE_HANDLING - **/ - public String getStatusMessageHandling() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(STATUS_MESSAGE_HANDLING)).trim(); - } - - /** - Returns the value for the specified job attribute, as a String. This is a generic way of retrieving string-valued job attributes, rather than using the specific getter methods. This method will either go to the system to retrieve the job attribute, or it will return a cached value if the attribute was previously retrieved or previously set by setValue() or one of the other setter methods. Use {@link #loadInformation loadInformation()} to refresh the attributes from the system. - @param attribute The job attribute. - @return The current value of the attribute, as a blank-trimmed String. This method may return null in the rare case that the specified attribute could not be retrieved using the QUSRJOBI system API. If the attribute value is not of type String, then the result of toString() on the value object is returned. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #loadInformation - @see #getValue - @see #setValue - **/ - public String getStringValue(int attribute) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - Object obj = getValue(attribute); - - if (obj == null) return null; - else if (obj instanceof String) { - return ((String)obj).trim(); - } - else { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Returning a string representation of the value of a non-String attribute:", attribute); - return obj.toString(); - } - } - - /** - Returns the fully qualified integrated file system path name of the subsystem description for the subsystem in which the job is running. - @return The fully qualified integrated file system path name of the subsystem description for the subsystem in which the job is running. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #SUBSYSTEM - @see QSYSObjectPathName - **/ - public String getSubsystem() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - String subsystem = ((String)getValue(SUBSYSTEM)).trim(); - if (subsystem.length() > 10) - { - String name = subsystem.substring(0, 10).trim(); - String lib = subsystem.substring(10, subsystem.length()); - String path = QSYSObjectPathName.toPath(lib, name, "SBSD"); - return path; - } - return subsystem; - } - - /** - Returns additional information about the job type (if any exists). - @return Additional information about the job type (if any exists). Possible values are: -
        -
      • {@link #JOB_SUBTYPE_BLANK JOB_SUBTYPE_BLANK} - The job has no special subtype or is not a valid job. -
      • {@link #JOB_SUBTYPE_IMMEDIATE JOB_SUBTYPE_IMMEDIATE} - The job is an immediate job. -
      • {@link #JOB_SUBTYPE_PROCEDURE_START_REQUEST JOB_SUBTYPE_PROCEDURE_START_REQUEST} - The job started with a procedure start request. -
      • {@link #JOB_SUBTYPE_MACHINE_SERVER_JOB JOB_SUBTYPE_MACHINE_SERVER_JOB} - The job is an AS/400 Advanced 36 machine server job. -
      • {@link #JOB_SUBTYPE_PRESTART JOB_SUBTYPE_PRESTART} - The job is a prestart job. -
      • {@link #JOB_SUBTYPE_PRINT_DRIVER JOB_SUBTYPE_PRINT_DRIVER} - The job is a print driver job. -
      • {@link #JOB_SUBTYPE_MRT JOB_SUBTYPE_MRT} - The job is a System/36 multiple requester terminal (MRT) job. -
      • {@link #JOB_SUBTYPE_ALTERNATE_SPOOL_USER JOB_SUBTYPE_ALTERNATE_SPOOL_USER} - The job is an alternate spool user job. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #JOB_SUBTYPE - **/ - public String getSubtype() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - - { - return (String)getValue(JOB_SUBTYPE); // Don't trim. - } - - /** - Returns the system. - @return The system. - **/ - public AS400 getSystem() - { - return system_; - } - - /** - Returns the system portion of the library list of the initial thread of the job. - @return The system portion of the library list of the initial thread of the job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #SYSTEM_LIBRARY_LIST - **/ - public String[] getSystemLibraryList() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - String val = (String)getValue(SYSTEM_LIBRARY_LIST); - StringTokenizer st = new StringTokenizer(val, " "); - String[] libraries = new String[st.countTokens()]; - int i = 0; - while (st.hasMoreTokens()) - { - libraries[i++] = st.nextToken(); - } - return libraries; - } - - /** - Returns the value used to separate hours, minutes, and seconds when presenting a time. - @return The value used to separate hours, minutes, and seconds when presenting a time. Possible values are: -
        -
      • {@link #TIME_SEPARATOR_COLON TIME_SEPARATOR_COLON} - A colon (:) is used for the time separator. -
      • {@link #TIME_SEPARATOR_PERIOD TIME_SEPARATOR_PERIOD} - A period (.) is used for the time separator. -
      • {@link #TIME_SEPARATOR_BLANK TIME_SEPARATOR_BLANK} - A blank is used for the time separator. -
      • {@link #TIME_SEPARATOR_COMMA TIME_SEPARATOR_COMMA} - A comma (,) is used for the time separator. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #TIME_SEPARATOR - **/ - public String getTimeSeparator() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return (String)getValue(TIME_SEPARATOR); // Don't trim. - } - - /** - Returns the maximum amount of processor time (in milliseconds) given to each thread in this job before other threads in this job and in other jobs are given the opportunity to run. The time slice establishes the amount of time needed by a thread in this job to accomplish a meaningful amount of processing. At the end of the time slice, the thread might be put in an inactive state so that other threads can become active in the storage pool. Values retrieved range from 8 through 9,999,999 milliseconds (that is, 9999.999 seconds). Although you can specify a value of less than 8, the system takes a minimum of 8 milliseconds to run a process. - @return The maximum amount of processor time (in milliseconds) given to each thread in this job before other threads in this job and in other jobs are given the opportunity to run. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #TIME_SLICE - **/ - public int getTimeSlice() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsInt(TIME_SLICE); - } - - - private static final int FORMAT_DTS = AS400Timestamp.FORMAT_DTS; // *DTS format - private synchronized AS400Timestamp getTimestampConverter(int format) - { - if (timestampConverter_ == null) { - timestampConverter_ = new AS400Timestamp(); - timestampConverter_.setFormat(format); - } - else if (format != timestampConverter_.getFormat()) { - timestampConverter_.setFormat(format); - } - return timestampConverter_; - } - - /** - Returns a value indicating whether a thread in an interactive job moves to another main storage pool at the end of its time slice. - @return The value indicating whether a thread in an interactive job moves to another main storage pool at the end of its time slice. Possible values are: -
        -
      • {@link #TIME_SLICE_END_POOL_NONE TIME_SLICE_END_POOL_NONE} - A thread in the job does not move to another main storage pool when it reaches the end of its time slice. -
      • {@link #TIME_SLICE_END_POOL_BASE TIME_SLICE_END_POOL_BASE} - A thread in the job moves to the base pool when it reaches the end of its time slice. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #TIME_SLICE_END_POOL - **/ - public String getTimeSliceEndPool() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(TIME_SLICE_END_POOL)).trim(); - } - - /** - Returns the total amount of response time for the initial thread, in milliseconds. This value does not include the time used by the machine, by the attached input/output (I/O) hardware, and by the transmission lines for sending and receiving data. This value is zero for jobs that have no interactions. A value of -1 is returned if this field is not large enough to hold the actual result. - @return The total amount of response time for the initial thread, in milliseconds. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #TOTAL_RESPONSE_TIME - **/ - public int getTotalResponseTime() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return getAsInt(TOTAL_RESPONSE_TIME); - } - - /** - Returns the type of job. - @return The type of job. Possible values are: -
        -
      • {@link #JOB_TYPE_NOT_VALID JOB_TYPE_NOT_VALID} - The job is not a valid job. -
      • {@link #JOB_TYPE_AUTOSTART JOB_TYPE_AUTOSTART} - The job is an autostart job. -
      • {@link #JOB_TYPE_BATCH JOB_TYPE_BATCH} - The job is a batch job. -
      • {@link #JOB_TYPE_INTERACTIVE JOB_TYPE_INTERACTIVE} - The job is an interactive job. -
      • {@link #JOB_TYPE_SUBSYSTEM_MONITOR JOB_TYPE_SUBSYSTEM_MONITOR} - The job is a subsystem monitor job. -
      • {@link #JOB_TYPE_SPOOLED_READER JOB_TYPE_SPOOLED_READER} - The job is a spooled reader job. -
      • {@link #JOB_TYPE_SYSTEM JOB_TYPE_SYSTEM} - The job is a system job. -
      • {@link #JOB_TYPE_SPOOLED_WRITER JOB_TYPE_SPOOLED_WRITER} - The job is a spooled writer job. -
      • {@link #JOB_TYPE_SCPF_SYSTEM JOB_TYPE_SCPF_SYSTEM} - The job is the SCPF system job. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #JOB_TYPE - **/ - public String getType() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return (String)getValue(JOB_TYPE); // Don't trim. - } - - /** - Returns the user name. - This method will either return a cached value if the {@link #USER_NAME USER_NAME} attribute was previously retrieved; or if attributes values have not yet been retrieved, the value previously by either a constructor, {@link #setUser setUser()}, or one of the other setter methods. -

      Note: To get the actual current user name for this job (for example, after swapping profiles), call {@link #getStringValue getStringValue(CURRENT_USER)} - @return The user name. - @see #setUser - **/ - public String getUser() - { - return user_; - } - - /** - Returns the user portion of the library list for the initial thread of the job. - @return The user portion of the library list for the initial thread of the job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #USER_LIBRARY_LIST - **/ - public String[] getUserLibraryList() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - String val = (String)getValue(USER_LIBRARY_LIST); - StringTokenizer st = new StringTokenizer(val, " "); - String[] libraries = new String[st.countTokens()]; - int i = 0; - while (st.hasMoreTokens()) - { - libraries[i++] = st.nextToken(); - } - return libraries; - } - - /** - Returns the value for the specified job attribute. This is a generic way of retrieving job attributes, rather than using the specific getter methods. This method will either go to the system to retrieve the job attribute, or it will return a cached value if the attribute was previously retrieved or previously set by setValue() or one of the other setter methods. Use {@link #loadInformation loadInformation()} to refresh the attributes from the system. - @param attribute The job attribute. - @return The current value of the attribute. This method may return null in the rare case that the specified attribute could not be retrieved using the QUSRJOBI system API. String values are not trimmed. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #loadInformation - @see #getStringValue - @see #setValue - **/ - public Object getValue(int attribute) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - Object obj = values_.get(attribute); - if (obj == null) - { - retrieve(attribute); // Need to retrieve it using QUSRJOBI. - obj = values_.get(attribute); - if (obj == null && (attribute == SCHEDULE_DATE || attribute == SCHEDULE_TIME)) // These are only setters. - { - Date d = getAsSystemDate(SCHEDULE_DATE_GETTER); - setValueInternal(SCHEDULE_DATE, d); - setValueInternal(SCHEDULE_TIME, d); - return d; - } - } - return obj; - } - - /** - Returns the unit of work identifier. The unit of work identifier is used to track jobs across multiple systems. If a job is not associated with a source or target system using advanced program-to-program communications (APPC), this information is not used. Every job on the system is assigned a unit of work identifier. - @return The unit of work identifier, which is made up of: -

        -
      • Location name - 8 Characters. The name of the source system that originated the APPC job. -
      • Network ID - 8 Characters. The network name associated with the unit of work. -
      • Instance - 6 Characters. The value that further identifies the source of the job. This is shown as hexadecimal data. -
      • Sequence Number - 2 Character. A value that identifies a check-point within the application program. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #LOCATION_NAME - @see #NETWORK_ID - @see #INSTANCE - @see #SEQUENCE_NUMBER - **/ - public String getWorkIDUnit() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return ((String)getValue(UNIT_OF_WORK_ID)).trim(); - } - - /** - Holds this job. - @param holdSpooledFiles true to hold this job's spooled files; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @see #end - @see #release - **/ - public void hold(boolean holdSpooledFiles) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - StringBuffer buf = new StringBuffer(); - buf.append("QSYS/HLDJOB JOB("); // not threadsafe - buf.append(number_); - buf.append('/'); - buf.append(user_); - buf.append('/'); - buf.append(name_); - buf.append(") SPLFILE("); - buf.append(holdSpooledFiles ? "*YES)" : "*NO)"); - buf.append(" DUPJOBOPT(*MSG)"); - String toRun = buf.toString(); - // If the user wants to end the remote command server job that is servicing our connection, they are welcome to "shoot themselves in the foot". - CommandCall cmd = getCommandCall(toRun); - if (!cmd.run()) - { - throw new AS400Exception(cmd.getMessageList()); - } - } - - // Helper method. Used to determine if an attribute that is being set is read-only and should not be allowed to be changed. - private static boolean isReadOnly(int attribute) - { - return setterKeys_.get(attribute) == -1; - } - - /** - Refreshes the values for all attributes. This does not cancel uncommitted changes. To refresh just the elapsed statistics, use {@link #loadStatistics loadStatistics()}. - @see #loadInformation(int[]) - @see #commitChanges - @see #loadStatistics - **/ - public void loadInformation() - { - // Need to load an attribute from each format. - try - { - // Clear all cached attribute values. - values_.clear(); - - // For those attributes that never change, retain the original value. - - //setValueInternal(INTERNAL_JOB_ID, null); - //setValueInternal(INTERNAL_JOB_IDENTIFIER, null); - setValueInternal(JOB_NAME, name_); - setValueInternal(USER_NAME, user_); - setValueInternal(JOB_NUMBER, number_); - //setValueInternal(JOB_STATUS, null); - setValueInternal(JOB_TYPE, type_); - setValueInternal(JOB_SUBTYPE, subtype_); - - // Retrieve all values. - retrieve(THREAD_COUNT); // 150 - retrieve(CURRENT_SYSTEM_POOL_ID); // 200 - retrieve(JOB_DATE); // 300 - retrieve(SERVER_TYPE); // 400 - retrieve(LOGGING_TEXT); // 500 - retrieve(SPECIAL_ENVIRONMENT); // 600 - retrieve(USER_LIBRARY_LIST); // 700 - retrieve(ELAPSED_CPU_TIME_USED); // 1000 - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Error loading job information:", e); - } - } - - /** - Refreshes the values for specific attributes. This does not cancel uncommitted changes. -
      Note: The specified attributes will be refreshed, along with other attributes in their "format group". For more information about attribute format groups, refer to the specification of the QUSRJOBI API. - @param attributes The attributes to refresh. - @see #loadInformation() - @see #commitChanges - @see #loadStatistics - **/ - public void loadInformation(int[] attributes) - { - // Load only the formats needed for the specified attributes. - try - { - // Determine which formats we need to specify. - boolean[] formats = new boolean[8]; - for (int i = 0; i < attributes.length; ++i) - { - int attr = attributes[i]; - byte[] format = lookupFormatName(attr); - formats[format[5] & 0x0F] = true; - - // Clear the value for that attribute. - values_.remove(attr); - - // For those attributes that never change, retain the original value. - switch (attr) - { - //case INTERNAL_JOB_ID: - // setValueInternal(INTERNAL_JOB_ID, null); break; - //case INTERNAL_JOB_IDENTIFIER: - // setValueInternal(INTERNAL_JOB_IDENTIFIER, null); break; - case JOB_NAME: - setValueInternal(JOB_NAME, name_); break; - case USER_NAME: - setValueInternal(USER_NAME, user_); break; - case JOB_NUMBER: - setValueInternal(JOB_NUMBER, number_); break; - //case JOB_STATUS: - // setValueInternal(JOB_STATUS, null); break; - case JOB_TYPE: - setValueInternal(JOB_TYPE, type_); break; - case JOB_SUBTYPE: - setValueInternal(JOB_SUBTYPE, subtype_); break; - default: // Do nothing. - } - } - - // Retrieve values. For each needed format, just specify any attribute associated with that format. - if (formats[1]) retrieve(THREAD_COUNT); // Format JOBI0150. - if (formats[2]) retrieve(CURRENT_SYSTEM_POOL_ID); // Format JOBI0200. - if (formats[3]) retrieve(JOB_DATE); // Format JOBI0300. - if (formats[4]) retrieve(SERVER_TYPE); // Format JOBI0400. - if (formats[5]) retrieve(LOGGING_TEXT); // Format JOBI0500. - if (formats[6]) retrieve(SPECIAL_ENVIRONMENT); // Format JOBI0600. - if (formats[7]) retrieve(USER_LIBRARY_LIST); // Format JOBI0700. - if (formats[0]) retrieve(ELAPSED_CPU_TIME_USED); // Format JOBI1000. - } - catch (Exception e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Error loading job information: ", e); - } - } - - /** - Refreshes just the values for the elapsed statistics. Internally, this calls the QUSRJOBI API using the JOBI1000 format. - @see #resetStatistics - @see #loadInformation - @see #ELAPSED_TIME - @see #ELAPSED_DISK_IO - @see #ELAPSED_DISK_IO_ASYNCH - @see #ELAPSED_DISK_IO_SYNCH - @see #ELAPSED_INTERACTIVE_RESPONSE_TIME - @see #ELAPSED_INTERACTIVE_TRANSACTIONS - @see #ELAPSED_CPU_PERCENT_USED - @see #ELAPSED_CPU_PERCENT_USED_FOR_DATABASE - @see #ELAPSED_CPU_TIME_USED - @see #ELAPSED_CPU_TIME_USED_FOR_DATABASE - @see #ELAPSED_LOCK_WAIT_TIME - @see #ELAPSED_PAGE_FAULTS - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void loadStatistics() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(ELAPSED_CPU_TIME_USED); // 1000 - } - - // Helper method. Used to determine the length of the output parameter for a given format. - private static int lookupFormatLength(byte[] format) - { - switch (format[5] & 0x0F) - { - case 1: // Format JOBI0150. - return 144; - case 2: // Format JOBI0200. - return 191; - case 3: // Format JOBI0300. - return 187; - case 4: // Format JOBI0400. - return 564; - case 5: // Format JOBI0500. - return 83; - case 6: // Format JOBI0600. - return 322; - case 7: // Format JOBI0700. - return 3028; // Max length: 80 + (268 libraries * 11). - case 0: // Format JOBI1000. - return 144; - default: - return -1; - } - } - - // Helper method used to determine the format name based on which job attribute we want to retrieve. - private static byte[] lookupFormatName(int key) - { - switch (key) - { - case JOB_NAME: - case USER_NAME: - case JOB_NUMBER: - case INTERNAL_JOB_ID: - case INTERNAL_JOB_IDENTIFIER: - case JOB_STATUS: - case JOB_TYPE: - case JOB_SUBTYPE: - case RUN_PRIORITY: - case TIME_SLICE: - case DEFAULT_WAIT_TIME: - case ELIGIBLE_FOR_PURGE: - case TIME_SLICE_END_POOL: - case CPU_TIME_USED: - case SYSTEM_POOL_ID: - case MAX_CPU_TIME: - case TEMP_STORAGE_USED: - case MAX_TEMP_STORAGE: - case THREAD_COUNT: - case MAX_THREADS: - case TEMP_STORAGE_USED_LARGE: - case MAX_TEMP_STORAGE_LARGE: - case CPU_TIME_USED_LARGE: - // Format name, EBCDIC 'JOBI0150'. - return new byte[] { (byte)0xD1, (byte)0xD6, (byte)0xC2, (byte)0xC9, (byte)0xF0, (byte)0xF1, (byte)0xF5, (byte)0xF0 }; - - case AUXILIARY_IO_REQUESTS: - case INTERACTIVE_TRANSACTIONS: - case TOTAL_RESPONSE_TIME: - case FUNCTION_TYPE: - case FUNCTION_NAME: - case ACTIVE_JOB_STATUS: - case CURRENT_SYSTEM_POOL_ID: - case AUXILIARY_IO_REQUESTS_LARGE: - case CPU_TIME_USED_FOR_DATABASE: - case ACTIVE_JOB_STATUS_FOR_JOBS_ENDING: - case MEMORY_POOL: - case MESSAGE_REPLY: - // Format name, EBCDIC 'JOBI0200'. - return new byte[] { (byte)0xD1, (byte)0xD6, (byte)0xC2, (byte)0xC9, (byte)0xF0, (byte)0xF2, (byte)0xF0, (byte)0xF0 }; - - case JOB_QUEUE: - case JOB_QUEUE_PRIORITY: - case OUTPUT_QUEUE: - case OUTPUT_QUEUE_PRIORITY: - case PRINTER_DEVICE_NAME: - case JOB_QUEUE_STATUS: - case JOB_QUEUE_DATE: - case JOB_DATE: - // Format name, EBCDIC 'JOBI0300'. - return new byte[] { (byte)0xD1, (byte)0xD6, (byte)0xC2, (byte)0xC9, (byte)0xF0, (byte)0xF3, (byte)0xF0, (byte)0xF0 }; - - case DATE_ENTERED_SYSTEM: - case DATE_STARTED: - case ACCOUNTING_CODE: - case JOB_DESCRIPTION: - case UNIT_OF_WORK_ID: - case LOCATION_NAME: - case NETWORK_ID: - case INSTANCE: - case SEQUENCE_NUMBER: - case MODE: - case INQUIRY_MESSAGE_REPLY: - case LOG_CL_PROGRAMS: - case BREAK_MESSAGE_HANDLING: - case STATUS_MESSAGE_HANDLING: - case DEVICE_RECOVERY_ACTION: - case KEEP_DDM_CONNECTIONS_ACTIVE: - case DATE_SEPARATOR: - case DATE_FORMAT: - case PRINT_TEXT: - case SUBMITTED_BY_JOB_NAME: - case SUBMITTED_BY_USER: - case SUBMITTED_BY_JOB_NUMBER: - case TIME_SEPARATOR: - case CCSID: - case SCHEDULE_DATE: // In case someone asks for it. - case SCHEDULE_TIME: // In case someone asks for it. - case SCHEDULE_DATE_GETTER: - case PRINT_KEY_FORMAT: - case SORT_SEQUENCE_TABLE: - case LANGUAGE_ID: - case COUNTRY_ID: - case COMPLETION_STATUS: - case SIGNED_ON_JOB: - case JOB_SWITCHES: - case MESSAGE_QUEUE_ACTION: - case MESSAGE_QUEUE_MAX_SIZE: - case DEFAULT_CCSID: - case ROUTING_DATA: - case DECIMAL_FORMAT: - case CHARACTER_ID_CONTROL: - case SERVER_TYPE: - case ALLOW_MULTIPLE_THREADS: - case JOB_LOG_OUTPUT: - case JOB_LOG_PENDING: - case JOB_END_REASON: - case JOB_TYPE_ENHANCED: - case DATE_ENDED: - case SPOOLED_FILE_ACTION: - // Format name, EBCDIC 'JOBI0400'. - return new byte[] { (byte)0xD1, (byte)0xD6, (byte)0xC2, (byte)0xC9, (byte)0xF0, (byte)0xF4, (byte)0xF0, (byte)0xF0 }; - - case END_SEVERITY: - case LOGGING_SEVERITY: - case LOGGING_LEVEL: - case LOGGING_TEXT: - // Format name, EBCDIC 'JOBI0500'. - return new byte[] { (byte)0xD1, (byte)0xD6, (byte)0xC2, (byte)0xC9, (byte)0xF0, (byte)0xF5, (byte)0xF0, (byte)0xF0 }; - - case CONTROLLED_END_REQUESTED: - case SUBSYSTEM: - case CURRENT_USER: - case DBCS_CAPABLE: - case PRODUCT_RETURN_CODE: - case USER_RETURN_CODE: - case PROGRAM_RETURN_CODE: - case SPECIAL_ENVIRONMENT: - case JOB_USER_IDENTITY: - case JOB_USER_IDENTITY_SETTING: - case CLIENT_IP_ADDRESS: - // Format name, EBCDIC 'JOBI0600'. - return new byte[] { (byte)0xD1, (byte)0xD6, (byte)0xC2, (byte)0xC9, (byte)0xF0, (byte)0xF6, (byte)0xF0, (byte)0xF0 }; - - case CURRENT_LIBRARY_EXISTENCE: - case SYSTEM_LIBRARY_LIST: - case PRODUCT_LIBRARIES: - case CURRENT_LIBRARY: - case USER_LIBRARY_LIST: - // Format name, EBCDIC 'JOBI0700'. - return new byte[] { (byte)0xD1, (byte)0xD6, (byte)0xC2, (byte)0xC9, (byte)0xF0, (byte)0xF7, (byte)0xF0, (byte)0xF0 }; - - case -1: - case ELAPSED_TIME: - case ELAPSED_DISK_IO: - case ELAPSED_DISK_IO_ASYNCH: - case ELAPSED_DISK_IO_SYNCH: - case ELAPSED_INTERACTIVE_RESPONSE_TIME: - case ELAPSED_INTERACTIVE_TRANSACTIONS: - case ELAPSED_CPU_PERCENT_USED: - case ELAPSED_CPU_PERCENT_USED_FOR_DATABASE: - case ELAPSED_CPU_TIME_USED: - case ELAPSED_CPU_TIME_USED_FOR_DATABASE: - case ELAPSED_LOCK_WAIT_TIME: - case ELAPSED_PAGE_FAULTS: - // Format name, EBCDIC 'JOBI1000'. - return new byte[] { (byte)0xD1, (byte)0xD6, (byte)0xC2, (byte)0xC9, (byte)0xF1, (byte)0xF0, (byte)0xF0, (byte)0xF0 }; - - default: - return null; - } - } - - // Helper method. Used to walk through the output parameter after an API call and set all of the job attribute data into our internal table. - private void parseData(byte[] format, byte[] data) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - Converter conv = new Converter(system_.getCcsid(), system_); - - // All the formats return these. - name_ = conv.byteArrayToString(data, 8, 10).trim(); - user_ = conv.byteArrayToString(data, 18, 10).trim(); - number_ = conv.byteArrayToString(data, 28, 6); - - realInternalJobID_ = new byte[16]; - System.arraycopy(data, 34, realInternalJobID_, 0, 16); - char[] oldID = new char[16]; - for (int i = 0; i < 16; ++i) - { - oldID[i] = (char)(realInternalJobID_[i] & 0x00FF); - } - internalJobID_ = new String(oldID); - - status_ = conv.byteArrayToString(data, 50, 10).trim(); - type_ = conv.byteArrayToString(data, 60, 1); - subtype_ = conv.byteArrayToString(data, 61, 1); - - setValueInternal(JOB_NAME, name_); - setValueInternal(USER_NAME, user_); - setValueInternal(JOB_NUMBER, number_); - - setValueInternal(INTERNAL_JOB_ID, internalJobID_); - setValueInternal(INTERNAL_JOB_IDENTIFIER, realInternalJobID_); - - setValueInternal(JOB_STATUS, status_); - setValueInternal(JOB_TYPE, type_); - setValueInternal(JOB_SUBTYPE, subtype_); - - byte[] val = new byte[8]; - switch (format[5] & 0x0F) - { - case 1: // Format JOBI0150. - setAsInt(RUN_PRIORITY, BinaryConverter.byteArrayToInt(data, 64)); - setAsInt(TIME_SLICE, BinaryConverter.byteArrayToInt(data, 68)); - setAsInt(DEFAULT_WAIT_TIME, BinaryConverter.byteArrayToInt(data, 72)); - setValueInternal(ELIGIBLE_FOR_PURGE, conv.byteArrayToString(data, 76, 10)); - setValueInternal(TIME_SLICE_END_POOL, conv.byteArrayToString(data, 86, 10)); - setAsInt(CPU_TIME_USED, BinaryConverter.byteArrayToInt(data, 96)); - setAsInt(SYSTEM_POOL_ID, BinaryConverter.byteArrayToInt(data, 100)); - setAsInt(MAX_CPU_TIME, BinaryConverter.byteArrayToInt(data, 104)); - setAsInt(TEMP_STORAGE_USED, BinaryConverter.byteArrayToInt(data, 108)); - setAsInt(MAX_TEMP_STORAGE, BinaryConverter.byteArrayToInt(data, 112)); - setAsInt(THREAD_COUNT, BinaryConverter.byteArrayToInt(data, 116)); - setAsInt(MAX_THREADS, BinaryConverter.byteArrayToInt(data, 120)); - setAsLong(TEMP_STORAGE_USED_LARGE, BinaryConverter.byteArrayToUnsignedInt(data, 124)); - setAsLong(MAX_TEMP_STORAGE_LARGE, BinaryConverter.byteArrayToUnsignedInt(data, 128)); - setAsLong(CPU_TIME_USED_LARGE, BinaryConverter.byteArrayToLong(data, 136)); - break; - case 2: // Format JOBI0200. - setAsInt(RUN_PRIORITY, BinaryConverter.byteArrayToInt(data, 72)); - setAsInt(SYSTEM_POOL_ID, BinaryConverter.byteArrayToInt(data, 76)); - setAsInt(CPU_TIME_USED, BinaryConverter.byteArrayToInt(data, 80)); - setAsInt(AUXILIARY_IO_REQUESTS, BinaryConverter.byteArrayToInt(data, 84)); - setAsInt(INTERACTIVE_TRANSACTIONS, BinaryConverter.byteArrayToInt(data, 88)); - setAsInt(TOTAL_RESPONSE_TIME, BinaryConverter.byteArrayToInt(data, 92)); - setValueInternal(FUNCTION_TYPE, conv.byteArrayToString(data, 96, 1)); - setValueInternal(FUNCTION_NAME, conv.byteArrayToString(data, 97, 10)); - setValueInternal(ACTIVE_JOB_STATUS, conv.byteArrayToString(data, 107, 4)); - setAsInt(CURRENT_SYSTEM_POOL_ID, BinaryConverter.byteArrayToInt(data, 136)); - setAsInt(THREAD_COUNT, BinaryConverter.byteArrayToInt(data, 140)); - setAsLong(AUXILIARY_IO_REQUESTS_LARGE, BinaryConverter.byteArrayToLong(data, 152)); - setAsLong(CPU_TIME_USED_FOR_DATABASE, BinaryConverter.byteArrayToLong(data, 160)); - setValueInternal(ACTIVE_JOB_STATUS_FOR_JOBS_ENDING, conv.byteArrayToString(data, 176, 4)); - setValueInternal(MEMORY_POOL, conv.byteArrayToString(data, 180, 10)); - setValueInternal(MESSAGE_REPLY, conv.byteArrayToString(data, 190, 1)); - break; - case 3: // Format JOBI0300. - setValueInternal(JOB_QUEUE, conv.byteArrayToString(data, 62, 20)); - setValueInternal(JOB_QUEUE_PRIORITY, conv.byteArrayToString(data, 82, 2)); - setValueInternal(OUTPUT_QUEUE, conv.byteArrayToString(data, 84, 20)); - setValueInternal(OUTPUT_QUEUE_PRIORITY, conv.byteArrayToString(data, 104, 2)); - setValueInternal(PRINTER_DEVICE_NAME, conv.byteArrayToString(data, 106, 10)); - setValueInternal(SUBMITTED_BY_JOB_NAME, conv.byteArrayToString(data, 116, 10)); - setValueInternal(SUBMITTED_BY_USER, conv.byteArrayToString(data, 126, 10)); - setValueInternal(SUBMITTED_BY_JOB_NUMBER, conv.byteArrayToString(data, 136, 6)); - setValueInternal(JOB_QUEUE_STATUS, conv.byteArrayToString(data, 162, 10)); - System.arraycopy(data, 172, val, 0, 8); - setValueInternal(JOB_QUEUE_DATE, val); - setValueInternal(JOB_DATE, conv.byteArrayToString(data, 180, 7)); - break; - case 4: // Format JOBI0400. - setValueInternal(DATE_ENTERED_SYSTEM, conv.byteArrayToString(data, 62, 13)); - setValueInternal(DATE_STARTED, conv.byteArrayToString(data, 75, 13)); - setValueInternal(ACCOUNTING_CODE, conv.byteArrayToString(data, 88, 15)); - setValueInternal(JOB_DESCRIPTION, conv.byteArrayToString(data, 103, 20)); - - // Unit of work ID. - setValueInternal(UNIT_OF_WORK_ID, conv.byteArrayToString(data, 123, 24)); - setValueInternal(LOCATION_NAME, conv.byteArrayToString(data, 123, 8)); - setValueInternal(NETWORK_ID, conv.byteArrayToString(data, 131, 8)); - setValueInternal(INSTANCE, conv.byteArrayToString(data, 139, 6)); - setValueInternal(SEQUENCE_NUMBER, conv.byteArrayToString(data, 145, 2)); - - setValueInternal(MODE, conv.byteArrayToString(data, 147, 8)); - setValueInternal(INQUIRY_MESSAGE_REPLY, conv.byteArrayToString(data, 155, 10)); - setValueInternal(LOG_CL_PROGRAMS, conv.byteArrayToString(data, 165, 10)); - setValueInternal(BREAK_MESSAGE_HANDLING, conv.byteArrayToString(data, 175, 10)); - setValueInternal(STATUS_MESSAGE_HANDLING, conv.byteArrayToString(data, 185, 10)); - setValueInternal(DEVICE_RECOVERY_ACTION, conv.byteArrayToString(data, 195, 13)); - setValueInternal(KEEP_DDM_CONNECTIONS_ACTIVE, conv.byteArrayToString(data, 208, 10)); - setValueInternal(DATE_SEPARATOR, conv.byteArrayToString(data, 218, 1)); - setValueInternal(DATE_FORMAT, conv.byteArrayToString(data, 219, 4)); - setValueInternal(PRINT_TEXT, conv.byteArrayToString(data, 223, 30)); - setValueInternal(SUBMITTED_BY_JOB_NAME, conv.byteArrayToString(data, 253, 10)); - setValueInternal(SUBMITTED_BY_USER, conv.byteArrayToString(data, 263, 10)); - setValueInternal(SUBMITTED_BY_JOB_NUMBER, conv.byteArrayToString(data, 273, 6)); - setValueInternal(TIME_SEPARATOR, conv.byteArrayToString(data, 299, 1)); - setAsInt(CCSID, BinaryConverter.byteArrayToInt(data, 300)); - System.arraycopy(data, 304, val, 0, 8); - setValueInternal(SCHEDULE_DATE_GETTER, val); - setValueInternal(PRINT_KEY_FORMAT, conv.byteArrayToString(data, 312, 10)); - setValueInternal(SORT_SEQUENCE_TABLE, conv.byteArrayToString(data, 322, 20)); - setValueInternal(LANGUAGE_ID, conv.byteArrayToString(data, 342, 3)); - setValueInternal(COUNTRY_ID, conv.byteArrayToString(data, 345, 2)); - setValueInternal(COMPLETION_STATUS, conv.byteArrayToString(data, 347, 1)); - setValueInternal(SIGNED_ON_JOB, conv.byteArrayToString(data, 348, 1)); - setValueInternal(JOB_SWITCHES, conv.byteArrayToString(data, 349, 8)); - setValueInternal(MESSAGE_QUEUE_ACTION, conv.byteArrayToString(data, 357, 10)); - setAsInt(MESSAGE_QUEUE_MAX_SIZE, BinaryConverter.byteArrayToInt(data, 368)); - setAsInt(DEFAULT_CCSID, BinaryConverter.byteArrayToInt(data, 372)); - setValueInternal(ROUTING_DATA, conv.byteArrayToString(data, 376, 80)); - setValueInternal(DECIMAL_FORMAT, conv.byteArrayToString(data, 456, 1)); - setValueInternal(CHARACTER_ID_CONTROL, conv.byteArrayToString(data, 457, 10)); - setValueInternal(SERVER_TYPE, conv.byteArrayToString(data, 467, 30)); - setValueInternal(ALLOW_MULTIPLE_THREADS, conv.byteArrayToString(data, 497, 1)); - setValueInternal(JOB_LOG_PENDING, conv.byteArrayToString(data, 498, 1)); - setAsInt(JOB_END_REASON, BinaryConverter.byteArrayToInt(data, 500)); - setAsInt(JOB_TYPE_ENHANCED, BinaryConverter.byteArrayToInt(data, 504)); - setValueInternal(DATE_ENDED, conv.byteArrayToString(data, 508, 13)); - setValueInternal(SPOOLED_FILE_ACTION, conv.byteArrayToString(data, 522, 10)); - setValueInternal(JOB_LOG_OUTPUT, conv.byteArrayToString(data, 554, 10)); - break; - case 5: // Format JOBI0500. - setAsInt(END_SEVERITY, BinaryConverter.byteArrayToInt(data, 64)); - setAsInt(LOGGING_SEVERITY, BinaryConverter.byteArrayToInt(data, 68)); - setValueInternal(LOGGING_LEVEL, conv.byteArrayToString(data, 72, 1)); - setValueInternal(LOGGING_TEXT, conv.byteArrayToString(data, 73, 10)); - break; - case 6: // Format JOBI0600. - setValueInternal(JOB_SWITCHES, conv.byteArrayToString(data, 62, 8)); - setValueInternal(CONTROLLED_END_REQUESTED, conv.byteArrayToString(data, 70, 1)); - setValueInternal(SUBSYSTEM, conv.byteArrayToString(data, 71, 20)); - setValueInternal(CURRENT_USER, conv.byteArrayToString(data, 91, 10)); - setValueInternal(DBCS_CAPABLE, conv.byteArrayToString(data, 101, 1)); - setAsInt(PRODUCT_RETURN_CODE, BinaryConverter.byteArrayToInt(data, 104)); - setAsInt(USER_RETURN_CODE, BinaryConverter.byteArrayToInt(data, 108)); - setAsInt(PROGRAM_RETURN_CODE, BinaryConverter.byteArrayToInt(data, 112)); - setValueInternal(SPECIAL_ENVIRONMENT, conv.byteArrayToString(data, 116, 10)); - setValueInternal(JOB_USER_IDENTITY, conv.byteArrayToString(data, 296, 10)); - setValueInternal(JOB_USER_IDENTITY_SETTING, conv.byteArrayToString(data, 306, 1)); - setValueInternal(CLIENT_IP_ADDRESS, conv.byteArrayToString(data, 307, 15)); - break; - case 7: // Format JOBI0700. - int currentLibraryExistence = BinaryConverter.byteArrayToInt(data, 72); - setAsInt(CURRENT_LIBRARY_EXISTENCE, currentLibraryExistence); - int numberOfSystemLibraries = BinaryConverter.byteArrayToInt(data, 64); - setValueInternal(SYSTEM_LIBRARY_LIST, conv.byteArrayToString(data, 80, 11 * numberOfSystemLibraries)); - int offset = 80 + 11 * numberOfSystemLibraries; - int numberOfProductLibraries = BinaryConverter.byteArrayToInt(data, 68); - setValueInternal(PRODUCT_LIBRARIES, conv.byteArrayToString(data, offset, 11 * numberOfProductLibraries)); - offset += 11 * numberOfProductLibraries; - if (currentLibraryExistence == 1) - { - setValueInternal(CURRENT_LIBRARY, conv.byteArrayToString(data, offset, 11)); - offset += 11; - } - else - { - setValueInternal(CURRENT_LIBRARY, ""); // Set something so a call to get won't re-retrieve from the system. - } - int numberOfUserLibraries = BinaryConverter.byteArrayToInt(data, 76); - setValueInternal(USER_LIBRARY_LIST, conv.byteArrayToString(data, offset, 11 * numberOfUserLibraries)); - break; - case 0: // Format JOBI1000. - setAsLong(ELAPSED_TIME, BinaryConverter.byteArrayToLong(data, 64)); - setAsLong(ELAPSED_DISK_IO, BinaryConverter.byteArrayToLong(data, 72)); - setAsLong(ELAPSED_DISK_IO_ASYNCH, BinaryConverter.byteArrayToLong(data, 80)); - setAsLong(ELAPSED_DISK_IO_SYNCH, BinaryConverter.byteArrayToLong(data, 88)); - setAsInt(ELAPSED_INTERACTIVE_RESPONSE_TIME, BinaryConverter.byteArrayToInt(data, 96)); - setAsInt(ELAPSED_INTERACTIVE_TRANSACTIONS, BinaryConverter.byteArrayToInt(data, 100)); - setAsInt(ELAPSED_CPU_PERCENT_USED, BinaryConverter.byteArrayToInt(data, 104)); - setAsInt(ELAPSED_CPU_PERCENT_USED_FOR_DATABASE, BinaryConverter.byteArrayToInt(data, 108)); - setAsLong(ELAPSED_CPU_TIME_USED, BinaryConverter.byteArrayToLong(data, 112)); - setAsLong(ELAPSED_CPU_TIME_USED_FOR_DATABASE, BinaryConverter.byteArrayToLong(data, 120)); - setAsLong(ELAPSED_LOCK_WAIT_TIME, BinaryConverter.byteArrayToLong(data, 128)); - setAsLong(ELAPSED_PAGE_FAULTS, BinaryConverter.byteArrayToLong(data, 136)); - break; - } - } - - // Called when this object is de-serialized - private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "De-serializing Job object."); - in.defaultReadObject(); - - // Re-initialize transient variables. - remoteCommandLock_ = new Object(); - } - - /** - Releases this job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @see #end - @see #hold - **/ - public void release() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - StringBuffer buf = new StringBuffer(); - buf.append("QSYS/RLSJOB JOB("); // not threadsafe - buf.append(number_); - buf.append('/'); - buf.append(user_); - buf.append('/'); - buf.append(name_); - buf.append(") DUPJOBOPT(*MSG)"); - String toRun = buf.toString(); - CommandCall cmd = getCommandCall(toRun); - if (!cmd.run()) - { - throw new AS400Exception(cmd.getMessageList()); - } - } - - /** - Removes a PropertyChangeListener. - @param listener The listener. - @see #addPropertyChangeListener - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes a VetoableChangeListener. - @param listener The listener. - @see #addVetoableChangeListener - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - /** - Resets the measurement start time used for computing elapsed statistics. - @see #loadStatistics - @see #ELAPSED_TIME - @see #ELAPSED_DISK_IO - @see #ELAPSED_DISK_IO_ASYNCH - @see #ELAPSED_DISK_IO_SYNCH - @see #ELAPSED_INTERACTIVE_RESPONSE_TIME - @see #ELAPSED_INTERACTIVE_TRANSACTIONS - @see #ELAPSED_CPU_PERCENT_USED - @see #ELAPSED_CPU_PERCENT_USED_FOR_DATABASE - @see #ELAPSED_CPU_TIME_USED - @see #ELAPSED_CPU_TIME_USED_FOR_DATABASE - @see #ELAPSED_LOCK_WAIT_TIME - @see #ELAPSED_PAGE_FAULTS - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void resetStatistics() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(-1); - } - - // Helper method. Used to make the QUSRJOBI API call using the correct format based on the specified attribute. - private void retrieve(int key) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - connect(); - - // First lookup the format to use for this key. - byte[] format = lookupFormatName(key); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "QUSRJOBI format:", format); - int receiverLength = lookupFormatLength(format); - - ProgramParameter[] parmList = (key == -1) ? new ProgramParameter[7] : new ProgramParameter[5]; - parmList[0] = new ProgramParameter(receiverLength); - parmList[1] = new ProgramParameter(BinaryConverter.intToByteArray(receiverLength)); - parmList[2] = new ProgramParameter(format); - parmList[3] = new ProgramParameter(createQualifiedJobName()); - parmList[4] = new ProgramParameter(realInternalJobID_ == null ? BLANKS16_ : realInternalJobID_); - if (key == -1) - { - parmList[5] = new ProgramParameter(new byte[8]); // Error code. - parmList[6] = new ProgramParameter(new byte[] { (byte)0xF1 } ); // '1' to reset performance statistics. - } - - ProgramCall pc = getProgramCall("/QSYS.LIB/QUSRJOBI.PGM", parmList); // conditionally threadsafe - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving job information for job: " + toString()); - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - - parseData(format, parmList[0].getOutputData()); - } - - // Helper method. Used to convert a user-specified Date object into a String for our internal table. - private void setAsDate(int key, Date val) - { - Calendar dateTime = Calendar.getInstance(); - dateTime.setTime(val); - - StringBuffer buf = new StringBuffer(); - switch (setterKeys_.get(key)) - { - case 7: - int year = dateTime.get(Calendar.YEAR) - 1900; - if (year >= 100) - { - buf.append('1'); - year -= 100; - } - else - { - buf.append('0'); - } - if (year < 10) buf.append('0'); - buf.append(year); - - int month = dateTime.get(Calendar.MONTH) + 1; - if (month < 10) buf.append('0'); - buf.append(month); - - int day = dateTime.get(Calendar.DATE); - if (day < 10) buf.append('0'); - buf.append(day); - - break; - case 6: - int hour = dateTime.get(Calendar.HOUR_OF_DAY); - if (hour < 10) buf.append('0'); - buf.append(hour); - - int minute = dateTime.get(Calendar.MINUTE); - if (minute < 10) buf.append('0'); - buf.append(minute); - - int second = dateTime.get(Calendar.SECOND); - if (second < 10) buf.append('0'); - buf.append(second); - - break; - } - setValueInternal(key, buf.toString()); - } - - // Helper method. Used to convert a user-specified Date object into a String for our internal table and the table of uncommitted changes. - private void setAsDateToChange(int key, Date val) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAsDate(key, val); - if (cachedChanges_ == null) cachedChanges_ = new JobHashtable(); - cachedChanges_.put(key, getValue(key)); - if (!cacheChanges_) commitChanges(); - } - - // Helper method. Used after an API call to set the attribute values into our internal table. - final void setAsInt(int key, int val) - { - setValueInternal(key, new Integer(val)); - } - - // Helper method. Used when the user calls a setter to set the attribute value into our internal table as well as the table of uncommitted changes. - private void setAsIntToChange(int key, int val) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAsInt(key, val); - // Update values to set upon commit. - if (cachedChanges_ == null) cachedChanges_ = new JobHashtable(); - cachedChanges_.put(key, getValue(key)); - if (!cacheChanges_) commitChanges(); - } - - // Helper method. Used after an API call to set the attribute values into our internal table. - final void setAsLong(int key, long val) - { - setValueInternal(key, new Long(val)); - } - - /** - Sets how this job handles break messages. - @param breakMessageHandling How this job handles break messages. Possible values are: -
        -
      • {@link #BREAK_MESSAGE_HANDLING_NORMAL BREAK_MESSAGE_HANDLING_NORMAL} - The message queue status determines break message handling. -
      • {@link #BREAK_MESSAGE_HANDLING_HOLD BREAK_MESSAGE_HANDLING_HOLD} - The message queue holds break messages until a user or program requests them. The work station user uses the Display Message (DPSMSG) command to display the messages; a program must issue a Receive Message (RCVMSG) command to receive a message and handle it. -
      • {@link #BREAK_MESSAGE_HANDLING_NOTIFY BREAK_MESSAGE_HANDLING_NOTIFY} - The system notifies the job's message queue when a message arrives. For interactive jobs, the audible alarm sounds if there is one, and the message-waiting light comes on. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #BREAK_MESSAGE_HANDLING - **/ - public void setBreakMessageHandling(String breakMessageHandling) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (breakMessageHandling == null) - { - Trace.log(Trace.ERROR, "Parameter 'breakMessageHandling' is null."); - throw new NullPointerException("breakMessageHandling"); - } - - if (!breakMessageHandling.equals(BREAK_MESSAGE_HANDLING_NORMAL) && !breakMessageHandling.equals(BREAK_MESSAGE_HANDLING_HOLD) && !breakMessageHandling.equals(BREAK_MESSAGE_HANDLING_NOTIFY)) - { - Trace.log(Trace.ERROR, "Value of parameter 'breakMessageHandling' is not valid: " + breakMessageHandling); - throw new ExtendedIllegalArgumentException("breakMessageHandling (" + breakMessageHandling + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - setValue(BREAK_MESSAGE_HANDLING, breakMessageHandling); - } - - /** - Sets the value indicating whether attribute value changes are committed immediately. The default is true. If any cached changes are not committed before this method is called with a value of false, those changes are lost. - @param cacheChanges true to cache attribute value changes, false to commit all attribute value changes immediately. - @see #commitChanges - @see #getCacheChanges - @see #getValue - @see #setValue - **/ - public void setCacheChanges(boolean cacheChanges) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting cache changes:", cacheChanges); - if (!cacheChanges) - { - cachedChanges_ = null; - } - cacheChanges_ = cacheChanges; - } - - /** - Sets the coded character set identifier (CCSID) used for this job. - @param codedCharacterSetID The coded character set identifier (CCSID) used for this job. Possible values are: -
        -
      • {@link #CCSID_SYSTEM_VALUE CCSID_SYSTEM_VALUE} - The CCSID specified in the system value QCCSID is used. -
      • {@link #CCSID_INITIAL_USER CCSID_INITIAL_USER} - The CCSID specified in the user profile under which this thread was initially running is used. -
      • A coded character set identifier. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #CCSID - **/ - public void setCodedCharacterSetID(int codedCharacterSetID) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAsIntToChange(CCSID, codedCharacterSetID); - } - - /** - Sets the country or region identifier associated with this job. - @param countryID The country or region identifier associated with this job. Possible values are: -
        -
      • {@link #COUNTRY_ID_SYSTEM_VALUE COUNTRY_ID_SYSTEM_VALUE} - The system value QCNTRYID is used. -
      • {@link #COUNTRY_ID_INITIAL_USER COUNTRY_ID_INITIAL_USER} - The country or region ID specified in the user profile under which this thread was initially running is used. -
      • A country or region identifier to be used by the job. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #COUNTRY_ID - **/ - public void setCountryID(String countryID) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (countryID == null) - { - Trace.log(Trace.ERROR, "Parameter 'countryID' is null."); - throw new NullPointerException("countryID"); - } - setValue(COUNTRY_ID, countryID); - } - - /** - Sets the format in which dates are presented. - @param dateFormat The format in which dates are presented. Possible values are: -
        -
      • {@link #DATE_FORMAT_SYSTEM_VALUE DATE_FORMAT_SYSTEM_VALUE} - The system value QDATFMT is used. -
      • {@link #DATE_FORMAT_YMD DATE_FORMAT_YMD} - Year, month, and day format. -
      • {@link #DATE_FORMAT_MDY DATE_FORMAT_MDY} - Month, day, and year format. -
      • {@link #DATE_FORMAT_DMY DATE_FORMAT_DMY} - Day, month, and year format. -
      • {@link #DATE_FORMAT_JULIAN DATE_FORMAT_JULIAN} - Julian format (year and day). -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #DATE_FORMAT - **/ - public void setDateFormat(String dateFormat) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (dateFormat == null) - { - Trace.log(Trace.ERROR, "Parameter 'dateFormat' is null."); - throw new NullPointerException("dateFormat"); - } - - if (!dateFormat.equals(DATE_FORMAT_SYSTEM_VALUE) && !dateFormat.equals(DATE_FORMAT_YMD) && !dateFormat.equals(DATE_FORMAT_MDY) && !dateFormat.equals(DATE_FORMAT_DMY) && !dateFormat.equals(DATE_FORMAT_JULIAN)) - { - Trace.log(Trace.ERROR, "Value of parameter 'dateFormat' is not valid: " + dateFormat); - throw new ExtendedIllegalArgumentException("dateFormat (" + dateFormat + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - setValue(DATE_FORMAT, dateFormat); - } - - /** - Sets the value used to separate days, months, and years when presenting a date. - @param dateSeparator The value used to separate days, months, and years when presenting a date. Possible values are: -
        -
      • {@link #DATE_SEPARATOR_SYSTEM_VALUE DATE_SEPARATOR_SYSTEM_VALUE} - The system value QDATSEP is used. -
      • {@link #DATE_SEPARATOR_SLASH DATE_SEPARATOR_SLASH} - A slash (/) is used for the date separator. -
      • {@link #DATE_SEPARATOR_DASH DATE_SEPARATOR_DASH} - A dash (-) is used for the date separator. -
      • {@link #DATE_SEPARATOR_PERIOD DATE_SEPARATOR_PERIOD} - A period (.) is used for the date separator. -
      • {@link #DATE_SEPARATOR_BLANK DATE_SEPARATOR_BLANK} - A blank is used for the date separator. -
      • {@link #DATE_SEPARATOR_COMMA DATE_SEPARATOR_COMMA} - A comma (,) is used for the date separator. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #DATE_SEPARATOR - **/ - public void setDateSeparator(String dateSeparator) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (dateSeparator == null) - { - Trace.log(Trace.ERROR, "Parameter 'dateSeparator' is null."); - throw new NullPointerException("dateSeparator"); - } - - int len = setterKeys_.get(DATE_SEPARATOR); - if (dateSeparator.length() > len) - { - dateSeparator = dateSeparator.substring(0, len); - } - - setValue(DATE_SEPARATOR, dateSeparator); - } - - /** - Sets whether connections using distributed data management (DDM) protocols remain active when they are not being used. The connections include APPC conversations, active TCP/IP connections, or Opti-Connect connections. The DDM protocols are used in Distributed Relational Database Architecture (DRDA) applications, DDM applications, or DB2 Multisystem applications. - @param ddmConversationHandling Whether connections using distributed data management (DDM) protocols remain active when they are not being used. Possible values are: -
        -
      • {@link #KEEP_DDM_CONNECTIONS_ACTIVE_KEEP KEEP_DDM_CONNECTIONS_ACTIVE_KEEP} - The system keeps DDM connections active when there are no users, except for the following: -
          -
        • The routing step ends on the source system. The routing step ends when the job ends or when the job is rerouted to another routing step. -
        • The Reclaim Distributed Data Management Conversation (RCLDDMCNV) command or the Reclaim Resources (RCLRSC) command runs. -
        • A communications failure or an internal failure occurs. -
        • A DRDA connection to an application server not running on an IBM i system ends. -
        -
      • {@link #KEEP_DDM_CONNECTIONS_ACTIVE_DROP KEEP_DDM_CONNECTIONS_ACTIVE_DROP} - The system ends a DDM connection when there are no users. Examples include when an application closes a DDM file, or when a DRDA application runs an SQL DISCONNECT statement. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #KEEP_DDM_CONNECTIONS_ACTIVE - **/ - public void setDDMConversationHandling(String ddmConversationHandling) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (ddmConversationHandling == null) - { - Trace.log(Trace.ERROR, "Parameter 'ddmConversationHandling' is null."); - throw new NullPointerException("ddmConversationHandling"); - } - - if (!ddmConversationHandling.equals(KEEP_DDM_CONNECTIONS_ACTIVE_KEEP) && !ddmConversationHandling.equals(KEEP_DDM_CONNECTIONS_ACTIVE_DROP)) - { - Trace.log(Trace.ERROR, "Value of parameter 'ddmConversationHandling' is not valid: " + ddmConversationHandling); - throw new ExtendedIllegalArgumentException("ddmConversationHandling (" + ddmConversationHandling + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - setValue(KEEP_DDM_CONNECTIONS_ACTIVE, ddmConversationHandling); - } - - /** - Sets the decimal format used for this job. - @param decimalFormat The decimal format used for this job. Possible values are: -
        -
      • {@link #DECIMAL_FORMAT_SYSTEM_VALUE DECIMAL_FORMAT_SYSTEM_VALUE} - The system value QDECFMT is used as the decimal format for this job. -
      • {@link #DECIMAL_FORMAT_PERIOD DECIMAL_FORMAT_PERIOD} - Uses a period for a decimal point, a comma for a 3-digit grouping character, and zero-suppresses to the left of the decimal point. -
      • {@link #DECIMAL_FORMAT_COMMA_J DECIMAL_FORMAT_COMMA_J} - Uses a comma for a decimal point, a period for a 3-digit grouping character, and zero-suppresses to the left of the decimal point. -
      • {@link #DECIMAL_FORMAT_COMMA_I DECIMAL_FORMAT_COMMA_I} - Uses a comma for a decimal point and a period for a 3-digit grouping character. The zero-suppression character is in the second position (rather than the first) to the left of the decimal notation. Balances with zero values to the left of the comma are written with one leading zero (0,04). This constant also overrides any edit codes that might suppress the leading zero. -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #DECIMAL_FORMAT - **/ - public void setDecimalFormat(String decimalFormat) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (decimalFormat == null) - { - Trace.log(Trace.ERROR, "Parameter 'decimalFormat' is null."); - throw new NullPointerException("decimalFormat"); - } - - if (!decimalFormat.equals(DECIMAL_FORMAT_PERIOD) && !decimalFormat.equals(DECIMAL_FORMAT_COMMA_I) && !decimalFormat.equals(DECIMAL_FORMAT_COMMA_J) && !decimalFormat.equals(DECIMAL_FORMAT_SYSTEM_VALUE)) - { - Trace.log(Trace.ERROR, "Value of parameter 'decimalFormat' is not valid: " + decimalFormat); - throw new ExtendedIllegalArgumentException("decimalFormat (" + decimalFormat + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - setValue(DECIMAL_FORMAT, decimalFormat); - } - - /** - Sets the default maximum time (in seconds) that a thread in the job waits for a system instruction, such as a LOCK machine interface (MI) instruction, to acquire a resource. This default wait time is used when a wait time is not otherwise specified for a given situation. Normally, this is the amount of time the user is willing to wait for the system before the request is ended. If the job consists of multiple routing steps, a change to this attribute during a routing step does not appy to subsequent routing steps. The valid range is 1 through 9999999. A value of -1 represents no maximum wait time (*NOMAX). - @param defaultWait The default maximum time (in seconds) that a thread in the job waits for a system instruction to acquire a resource. The value -1 means there is no maximum (*NOMAX). The valid range is 1 through 9999999. The value 0 is not valid. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #DEFAULT_WAIT_TIME - **/ - public void setDefaultWait(int defaultWait) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAsIntToChange(DEFAULT_WAIT_TIME, defaultWait); - } - - /** - Sets the action taken for interactive jobs when an I/O error occurs for the job's requesting program device. - @param deviceRecoveryAction The action taken for interactive jobs when an I/O error occurs for the job's requesting program device. Possible values are: -
    • {@link #DEVICE_RECOVERY_ACTION_SYSTEM_VALUE DEVICE_RECOVERY_ACTION_SYSTEM_VALUE} - The value in the system value QDEVRCYACN is used as the device recovery action for this job. -
    • {@link #DEVICE_RECOVERY_ACTION_MESSAGE DEVICE_RECOVERY_ACTION_MESSAGE} - Signals the I/O error message to the application and lets the application program perform error recovery. -
    • {@link #DEVICE_RECOVERY_ACTION_DISCONNECT_MESSAGE DEVICE_RECOVERY_ACTION_DISCONNECT_MESSAGE} - Disconnects the job when an I/O error occurs. When the job reconnects, the system sends an error message to the application program, indicating the job has reconnected and that the work station device has recovered. -
    • {@link #DEVICE_RECOVERY_ACTION_DISCONNECT_END_REQUEST DEVICE_RECOVERY_ACTION_DISCONNECT_END_REQUEST} - Disconnects the job when an I/O error occurs. When the job reconnects, the system sends the End Request (ENDRQS) command to return control to the previous request level. -
    • {@link #DEVICE_RECOVERY_ACTION_END_JOB DEVICE_RECOVERY_ACTION_END_JOB} - Ends the job when an I/O error occurs. A message is sent to the job's log and to the history log (QHST) indicating the job ended because of a device error. -
    • {@link #DEVICE_RECOVERY_ACTION_END_JOB_NO_LIST DEVICE_RECOVERY_ACTION_END_JOB_NO_LIST} - Ends the job when an I/O error occurs. There is no job log produced for the job. The system sends a message to the QHST log indicating the job ended because of a device error. -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #DEVICE_RECOVERY_ACTION - **/ - public void setDeviceRecoveryAction(String deviceRecoveryAction) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (deviceRecoveryAction == null) - { - Trace.log(Trace.ERROR, "Parameter 'deviceRecoveryAction' is null."); - throw new NullPointerException("deviceRecoveryAction"); - } - - if (!deviceRecoveryAction.equals(DEVICE_RECOVERY_ACTION_MESSAGE) && !deviceRecoveryAction.equals(DEVICE_RECOVERY_ACTION_DISCONNECT_MESSAGE) && !deviceRecoveryAction.equals(DEVICE_RECOVERY_ACTION_DISCONNECT_END_REQUEST) && !deviceRecoveryAction.equals(DEVICE_RECOVERY_ACTION_END_JOB) && !deviceRecoveryAction.equals(DEVICE_RECOVERY_ACTION_END_JOB_NO_LIST) && !deviceRecoveryAction.equals(DEVICE_RECOVERY_ACTION_SYSTEM_VALUE)) - { - Trace.log(Trace.ERROR, "Value of parameter 'deviceRecoveryAction' is not valid: " + deviceRecoveryAction); - throw new ExtendedIllegalArgumentException("deviceRecoveryAction (" + deviceRecoveryAction + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - setValue(DEVICE_RECOVERY_ACTION, deviceRecoveryAction); - } - - /** - Sets how the job answers inquiry messages. - @param inquiryMessageReply How the job answers inquiry messages. Possible values are: -
      -
    • {@link #INQUIRY_MESSAGE_REPLY_REQUIRED INQUIRY_MESSAGE_REPLY_REQUIRED} - The job requires an answer for any inquiry messages that occur while this job is running. -
    • {@link #INQUIRY_MESSAGE_REPLY_DEFAULT INQUIRY_MESSAGE_REPLY_DEFAULT} - The system uses the default message reply to answer any inquiry messages issued while this job is running. The default reply is either defined in the message description or is the default system reply. -
    • {@link #INQUIRY_MESSAGE_REPLY_SYSTEM_REPLY_LIST INQUIRY_MESSAGE_REPLY_SYSTEM_REPLY_LIST} - The system reply list is checked to see if there is an entry for an inquiry message issued while this job is running. If a match occurs, the system uses the reply value for that entry. If no entry exists for that message, the system uses an inquiry message. -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #INQUIRY_MESSAGE_REPLY - **/ - public void setInquiryMessageReply(String inquiryMessageReply) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (inquiryMessageReply == null) - { - Trace.log(Trace.ERROR, "Parameter 'inquiryMessageReply' is null."); - throw new NullPointerException("inquiryMessageReply"); - } - - if (!inquiryMessageReply.equals(INQUIRY_MESSAGE_REPLY_REQUIRED) && !inquiryMessageReply.equals(INQUIRY_MESSAGE_REPLY_DEFAULT) && !inquiryMessageReply.equals(INQUIRY_MESSAGE_REPLY_SYSTEM_REPLY_LIST)) - { - Trace.log(Trace.ERROR, "Value of parameter 'inquiryMessageReply' is not valid: " + inquiryMessageReply); - throw new ExtendedIllegalArgumentException("inquiryMessageReply (" + inquiryMessageReply + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - setValue(INQUIRY_MESSAGE_REPLY, inquiryMessageReply); - } - - /** - Sets the internal job identifier. This does not change the job on the system. Instead, it changes the job this Job object references. The job name must be set to "*INT" for this to be recognized. This cannot be changed if the object has established a connection to the system. - @param internalJobID The internal job identifier. - @exception PropertyVetoException If the property change is vetoed. - @deprecated Use {@link #setInternalJobIdentifier(byte[]) setInternalJobIdentifier(byte[])} instead. The internal job identifier should be treated as a byte array of 16 bytes. - **/ - public void setInternalJobID(String internalJobID) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting internal job ID: " + internalJobID); - if (internalJobID == null) - { - Trace.log(Trace.ERROR, "Parameter 'internalJobID' is null."); - throw new NullPointerException("internalJobID"); - } - if (internalJobID.length() != 16) - { - Trace.log(Trace.ERROR, "Length of parameter 'internalJobID' is not valid: '" + internalJobID + "'"); - throw new ExtendedIllegalArgumentException("internalJobID (" + internalJobID + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - if (isConnected_) - { - Trace.log(Trace.ERROR, "Cannot set property 'internalJobID' after connect."); - throw new ExtendedIllegalStateException("internalJobID", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - internalJobID_ = internalJobID; - realInternalJobID_ = new byte[16]; - for (int i = 0; i < 16; ++i) - { - realInternalJobID_[i] = (byte)internalJobID.charAt(i); - } - } - else - { - String oldValue = internalJobID_; - String newValue = internalJobID; - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("internalJobID", oldValue, newValue); - } - internalJobID_ = internalJobID; - realInternalJobID_ = new byte[16]; - for (int i = 0; i < 16; ++i) - { - realInternalJobID_[i] = (byte)internalJobID.charAt(i); - } - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("internalJobID", oldValue, newValue); - } - } - } - - /** - Sets the internal job identifier. This does not change the job on the system. Instead, it changes the job this Job object references. The job name must be set to "*INT" for this to be recognized. This cannot be changed if the object has established a connection to the system. - @param internalJobID The 16-byte internal job identifier. - **/ - public void setInternalJobIdentifier(byte[] internalJobID) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting internal job identifier:", internalJobID); - if (internalJobID == null) - { - Trace.log(Trace.ERROR, "Parameter 'internalJobID' is null."); - throw new NullPointerException("internalJobID"); - } - if (internalJobID.length != 16) - { - Trace.log(Trace.ERROR, "Length of parameter 'internalJobID' is not valid: " + internalJobID.length); - throw new ExtendedIllegalArgumentException("internalJobID.length {" + internalJobID.length + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - if (isConnected_) - { - Trace.log(Trace.ERROR, "Cannot set property 'internalJobID' after connect."); - throw new ExtendedIllegalStateException("internalJobID", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - realInternalJobID_ = internalJobID; - char[] oldID = new char[16]; - for (int i = 0; i < 16; ++i) - { - oldID[i] = (char)(internalJobID[i] & 0x00FF); - } - internalJobID_ = new String(oldID); - } - - /** - Sets an identifier assigned to the job by the system to collect resource use information for the job when job accounting is active. The user who is changing this field must have authority to the CHGACGCDE CL command. If the user does not have the proper authority, this field is ignored and processing continues. - @param jobAccountingCode An identifier assigned to the job by the system to collect resource use information for the job when job accounting is active. Possible values are: -
      -
    • {@link #ACCOUNTING_CODE_BLANK ACCOUNTING_CODE_BLANK} - The accounting code is changed to all blanks. -
    • Accounting code - The 15 character accounting code used for the next accounting segment. The accounting code may contain alphabetic or numeric characters. -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #ACCOUNTING_CODE - **/ - public void setJobAccountingCode(String jobAccountingCode) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (jobAccountingCode == null) - { - Trace.log(Trace.ERROR, "Parameter 'jobAccountingCode' is null."); - throw new NullPointerException("jobAccountingCode"); - } - - setValue(ACCOUNTING_CODE, jobAccountingCode); - } - - /** - Sets the date that is assigned to the job. This value will only be changed for jobs whose status is *JOBQ or *ACTIVE. - @param jobDate The date that is assigned to the job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #JOB_DATE - **/ - public void setJobDate(Date jobDate) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (jobDate == null) - { - Trace.log(Trace.ERROR, "Parameter 'jobAccountingCode' is null."); - throw new NullPointerException("jobDate"); - } - setAsDateToChange(JOB_DATE, jobDate); - } - - /** - Sets the action to take when the message queue is full. - @param jobMessageQueueFullAction The action to take when the message queue is full. Possible values are: -
      -
    • {@link #MESSAGE_QUEUE_ACTION_SYSTEM_VALUE MESSAGE_QUEUE_ACTION_SYSTEM_VALUE} - The value specified for the QJOBMSGQFL system value is used. -
    • {@link #MESSAGE_QUEUE_ACTION_NO_WRAP MESSAGE_QUEUE_ACTION_NO_WRAP} - When the job message queue is full, do not wrap. This action causes the job to end. -
    • {@link #MESSAGE_QUEUE_ACTION_WRAP MESSAGE_QUEUE_ACTION_WRAP} - When the job message queue is full, wrap to the beginning and start filling again. -
    • {@link #MESSAGE_QUEUE_ACTION_PRINT_WRAP MESSAGE_QUEUE_ACTION_PRINT_WRAP} - When the job message queue is full, wrap the message queue and print the messages that are being overlaid because of the wrapping. -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #MESSAGE_QUEUE_ACTION - **/ - public void setJobMessageQueueFullAction(String jobMessageQueueFullAction) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (jobMessageQueueFullAction == null) - { - Trace.log(Trace.ERROR, "Parameter 'jobMessageQueueFullAction' is null."); - throw new NullPointerException("jobMessageQueueFullAction"); - } - - if (!jobMessageQueueFullAction.equals(MESSAGE_QUEUE_ACTION_NO_WRAP) && !jobMessageQueueFullAction.equals(MESSAGE_QUEUE_ACTION_WRAP) && !jobMessageQueueFullAction.equals(MESSAGE_QUEUE_ACTION_PRINT_WRAP) && !jobMessageQueueFullAction.equals(MESSAGE_QUEUE_ACTION_SYSTEM_VALUE)) - { - Trace.log(Trace.ERROR, "Value of parameter 'jobMessageQueueFullAction' is not valid: " + jobMessageQueueFullAction); - throw new ExtendedIllegalArgumentException("jobMessageQueueFullAction (" + jobMessageQueueFullAction + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - setValue(MESSAGE_QUEUE_ACTION, jobMessageQueueFullAction); - } - - /** - Sets the current setting of the job switches that are used by this job. Specify any combination of eight 0's, 1's, or X's to change the job switch settings. If a switch is not being changed, enter an X in the position that represents that switch. - @param jobSwitches The current setting of the job switches that are used by this job. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #JOB_SWITCHES - **/ - public void setJobSwitches(String jobSwitches) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (jobSwitches == null) - { - Trace.log(Trace.ERROR, "Parameter 'jobSwitches' is null."); - throw new NullPointerException("jobSwitches"); - } - - int len = setterKeys_.get(JOB_SWITCHES); - if (jobSwitches.length() > len) - { - jobSwitches = jobSwitches.substring(0, len); - } - - setValue(JOB_SWITCHES, jobSwitches); - } - - /** - Sets the language identifier associated with this job. The language identifier is used when *LANGIDUNQ or *LANGIDSHR is specified on the sort sequence parameter. If the job CCSID is 65535, this parameter is also used to determine the value of the job default CCSID. - @param languageID The language identifier associated with this job. Possible values are: -
      -
    • {@link #LANGUAGE_ID_SYSTEM_VALUE LANGUAGE_ID_SYSTEM_VALUE} - The system value QLANGID is used. -
    • {@link #LANGUAGE_ID_INITIAL_USER LANGUAGE_ID_INITIAL_USER} - The language ID specified in the user profile under which this thread was initially running is used. -
    • The language identifier. -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #LANGUAGE_ID - **/ - public void setLanguageID(String languageID) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (languageID == null) - { - Trace.log(Trace.ERROR, "Parameter 'languageID' is null."); - throw new NullPointerException("languageID"); - } - setValue(LANGUAGE_ID, languageID); - } - - /** - Sets whether or not commands are logged for CL programs that are run. - @param loggingCLPrograms The value indicating whether or not commands are logged for CL programs that are run. Possible values are: -
      -
    • {@link #LOG_CL_PROGRAMS_YES LOG_CL_PROGRAMS_YES} - Commands are logged for CL programs that are run. -
    • {@link #LOG_CL_PROGRAMS_NO LOG_CL_PROGRAMS_NO} - Commands are not logged for CL programs that are run. -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #LOG_CL_PROGRAMS - **/ - public void setLoggingCLPrograms(String loggingCLPrograms) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (loggingCLPrograms == null) - { - Trace.log(Trace.ERROR, "Parameter 'loggingCLPrograms' is null."); - throw new NullPointerException("loggingCLPrograms"); - } - if (!loggingCLPrograms.equals(LOG_CL_PROGRAMS_YES) && !loggingCLPrograms.equals(LOG_CL_PROGRAMS_NO)) - { - Trace.log(Trace.ERROR, "Value of parameter 'loggingCLPrograms' is not valid: " + loggingCLPrograms); - throw new ExtendedIllegalArgumentException("loggingCLPrograms (" + loggingCLPrograms + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - setValue(LOG_CL_PROGRAMS, loggingCLPrograms); - } - - /** - Sets what type of information is logged. - @param loggingLevel A value indicating what type of information is logged. Possible values are: -
      -
    • 0 - No messages are logged. -
    • 1 - All messages sent to the job's external message queue with a severity greater than or equal to the message logging severity are logged. This includes the indication of job start, job end, and job completion status. -
    • 2 - The following information is logged: -
        -
      • Logging level 1 information. -
      • Request messages that result in a high-level message with a severity code greater than or equal to the logging severity cause the request message and all associated messages to be logged. A high-level message is one that is sent to the program message queue of the program that receives the request message. For example, QCMD is an IBM-supplied request processing program that receives request messages. -
      -
    • 3 - The following information is logged: -
        -
      • Logging level 1 and 2 information is logged. -
      • All request messages are logged. -
      • Commands run by a CL program are logged if it is allowed by the LOG_CL_PROGRAMS attribute and the log attribute of the CL program. -
      -
    • 4 - The following information is logged: -
        -
      • All request messages and all messages with a severity greater than or equal to the message logging severity, including trace messages. -
      • Commands run by a CL program are logged if it is allowed by the LOG_CL_PROGRAMS attribute and the log attribute of the CL program. -
      -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #LOGGING_LEVEL - **/ - public void setLoggingLevel(int loggingLevel) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (loggingLevel < 0 || loggingLevel > 4) - { - Trace.log(Trace.ERROR, "Value of parameter 'loggingLevel' is not valid:", loggingLevel); - throw new ExtendedIllegalArgumentException("loggingLevel " + loggingLevel + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - setValue(LOGGING_LEVEL, Integer.toString(loggingLevel)); - } - - /** - Sets the severity level that is used in conjunction with the logging level to determine which error messages are logged in the job log. The values range from 00 through 99. - @param loggingSeverity The severity level that is used in conjunction with the logging level to determine which error messages are logged in the job log. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #LOGGING_SEVERITY - **/ - public void setLoggingSeverity(int loggingSeverity) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAsIntToChange(LOGGING_SEVERITY, loggingSeverity); - } - - /** - Sets the level of message text that is written in the job log when a message is logged according to the LOGGING_LEVEL and LOGGING_SEVERITY. - @param loggingText The level of message text that is written in the job log when a message is logged according to the LOGGING_LEVEL and LOGGING_SEVERITY. Possible values are: -
      -
    • {@link #LOGGING_TEXT_MESSAGE LOGGING_TEXT_MESSAGE} - Only the message text is written to the job log. -
    • {@link #LOGGING_TEXT_SECLVL LOGGING_TEXT_SECLVL} - Both the message text and the message help (cause and recovery) of the error message are written to the job log. -
    • {@link #LOGGING_TEXT_NO_LIST LOGGING_TEXT_NO_LIST} - If the job ends normally, no job log is produced. If the job ends abnormally (the job end code is 20 or higher), a job log is produced. The messages that appear in the job log contain both the message text and the message. -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #LOGGING_TEXT - **/ - public void setLoggingText(String loggingText) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (loggingText == null) - { - Trace.log(Trace.ERROR, "Parameter 'loggingText' is null."); - throw new NullPointerException("loggingText"); - } - - if (!loggingText.equals(LOGGING_TEXT_MESSAGE) && !loggingText.equals(LOGGING_TEXT_SECLVL) && !loggingText.equals(LOGGING_TEXT_NO_LIST)) - { - Trace.log(Trace.ERROR, "Value of parameter 'loggingText' is not valid: " + loggingText); - throw new ExtendedIllegalArgumentException("loggingText (" + loggingText + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - setValue(LOGGING_TEXT, loggingText); - } - - /** - Sets the job name. This does not change the name of the actual server job. Instead, it changes the job this Job object references. This cannot be changed if the object has already established a connection to the system. - @param name The job name. Specify JOB_NAME_CURRENT to indicate the job this program running in, or JOB_NAME_INTERNAL to indicate that the job is specified using the internal job identifier. - @exception PropertyVetoException If the property change is vetoed. - **/ - public void setName(String name) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting name: " + name); - if (name == null) - { - Trace.log(Trace.ERROR, "Parameter 'name' is null."); - throw new NullPointerException("name"); - } - if (name.length() > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'name' is not valid: '" + name + "'"); - throw new ExtendedIllegalArgumentException("name (" + name + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - if (isConnected_) - { - Trace.log(Trace.ERROR, "Cannot set property 'name' after connect."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - name_ = name; - setValueInternal(JOB_NAME, name); - } - else - { - String oldValue = name_; - String newValue = name; - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("name", oldValue, newValue); - } - name_ = newValue; - setValueInternal(JOB_NAME, name); - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("name", oldValue, newValue); - } - } - } - - /** - Sets the job number. This does not change the name of the actual server job. Instead, it changes the job this Job object references. This cannot be changed if the object has already established a connection to the system. - @param number The job number. This must be JOB_NUMBER_BLANK if the job name is JOB_NAME_CURRENT. - @exception PropertyVetoException If the property change is vetoed. - **/ - public void setNumber(String number) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting number: " + number); - if (number == null) - { - Trace.log(Trace.ERROR, "Parameter 'number' is null."); - throw new NullPointerException("number"); - } - if (number.length() > 6) - { - Trace.log(Trace.ERROR, "Length of parameter 'number' is not valid: '" + number + "'"); - throw new ExtendedIllegalArgumentException("number (" + number + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - if (isConnected_) - { - Trace.log(Trace.ERROR, "Cannot set property 'number' after connect."); - throw new ExtendedIllegalStateException("number", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - number_ = number; - setValueInternal(JOB_NUMBER, number); - } - else - { - String oldValue = number_; - String newValue = number; - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("number", oldValue, newValue); - } - number_ = number; - setValueInternal(JOB_NUMBER, number); - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("number", oldValue, newValue); - } - } - } - - /** - Sets the fully qualified integrated file system path name of the default output queue that is used for spooled output produced by this job. The default output queue is only for spooled printer files that specify *JOB for the output queue. - @param outputQueue The fully qualified integrated file system path name of the default output queue that is used for spooled output produced by this job. Possible values are: -
      -
    • {@link #OUTPUT_QUEUE_DEVICE OUTPUT_QUEUE_DEVICE} - The device specified on the Create Printer File (CRTPRTF), Change Printer File (CHGPRTF), or Override with Printer File (OVRPRTF) commands is used. -
    • {@link #OUTPUT_QUEUE_WORK_STATION OUTPUT_QUEUE_WORK_STATION} - The default output queue that is used with this job is the output queue that is assigned to the work station associated with the job at the time the job is started. -
    • {@link #OUTPUT_QUEUE_INITIAL_USER OUTPUT_QUEUE_INITIAL_USER} - The output queue name specified in the user profile under which this thread was initially running is used. -
    • The fully qualified integrated file system path name of the output queue. -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #OUTPUT_QUEUE - @see QSYSObjectPathName - **/ - public void setOutputQueue(String outputQueue) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (outputQueue == null) - { - Trace.log(Trace.ERROR, "Parameter 'outputQueue' is null."); - throw new NullPointerException("outputQueue"); - } - - if (!outputQueue.startsWith("*")) - { - QSYSObjectPathName path = new QSYSObjectPathName(outputQueue, "OUTQ"); - StringBuffer buf = new StringBuffer(); - String name = path.getObjectName(); - buf.append(name); - for (int i = name.length(); i < 10; ++i) - { - buf.append(' '); - } - buf.append(path.getLibraryName()); - setValue(OUTPUT_QUEUE, buf.toString()); - } - else - { - setValue(OUTPUT_QUEUE, outputQueue); - } - } - - /** - Sets the output priority for spooled output files that this job produces. The highest priority is 0, and the lowest is 9. - @param outputQueuePriority The output priority for spooled output files that this job produces. The valid values are a range from 1 to 9. The output priority specified cannot be higher than the priority specified in the user profile under which the job is running. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #OUTPUT_QUEUE_PRIORITY - **/ - public void setOutputQueuePriority(int outputQueuePriority) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setValue(OUTPUT_QUEUE_PRIORITY, Integer.toString(outputQueuePriority)); - } - - /** - Sets the printer device used for printing output from this job. - @param printerDeviceName The printer device used for printing output from this job. ssible values are: -
      -
    • {@link #PRINTER_DEVICE_NAME_SYSTEM_VALUE PRINTER_DEVICE_NAME_SYSTEM_VALUE} - The value in the system value QPRTDEV is used as the printer device. -
    • {@link #PRINTER_DEVICE_NAME_WORK_STATION PRINTER_DEVICE_NAME_WORK_STATION} - The default printer device used with this job is the printer device assigned to the work station that is associated with the job. -
    • {@link #PRINTER_DEVICE_NAME_INITIAL_USER PRINTER_DEVICE_NAME_INITIAL_USER} - The printer device name specified in the user profile under which this thread was initially running is used. -
    • The name of the printer device that is used with this job. -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #PRINTER_DEVICE_NAME - **/ - public void setPrinterDeviceName (String printerDeviceName) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (printerDeviceName == null) - { - Trace.log(Trace.ERROR, "Parameter 'printerDeviceName' is null."); - throw new NullPointerException("printerDeviceName"); - } - - int len = setterKeys_.get(PRINTER_DEVICE_NAME); - if (printerDeviceName.length() > len) - { - printerDeviceName = printerDeviceName.substring(0, len); - } - - setValue(PRINTER_DEVICE_NAME, printerDeviceName); - } - - /** - Sets whether border and header information is provided when the Print key is pressed. - @param printKeyFormat Whether border and header information is provided when the Print key is pressed. Possible values are: -
      -
    • {@link #PRINT_KEY_FORMAT_SYSTEM_VALUE PRINT_KEY_FORMAT_SYSTEM_VALUE} - The value specified on the system value QPRTKEYFMT determines whether header or border information is printed. -
    • {@link #PRINT_KEY_FORMAT_NONE PRINT_KEY_FORMAT_NONE} - The border and header information is not included with output from the Print key. -
    • {@link #PRINT_KEY_FORMAT_BORDER PRINT_KEY_FORMAT_BORDER} - The border information is included with output from the Print key. -
    • {@link #PRINT_KEY_FORMAT_HEADER PRINT_KEY_FORMAT_HEADER} - The header information is included with output from the Print key. -
    • {@link #PRINT_KEY_FORMAT_ALL PRINT_KEY_FORMAT_ALL} - The border and header information is included with output from the Print key. -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #PRINT_KEY_FORMAT - **/ - public void setPrintKeyFormat(String printKeyFormat) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (printKeyFormat == null) - { - Trace.log(Trace.ERROR, "Parameter 'printKeyFormat' is null."); - throw new NullPointerException("printKeyFormat"); - } - - if (!printKeyFormat.equals(PRINT_KEY_FORMAT_NONE) && !printKeyFormat.equals(PRINT_KEY_FORMAT_BORDER) && !printKeyFormat.equals(PRINT_KEY_FORMAT_HEADER) && !printKeyFormat.equals(PRINT_KEY_FORMAT_ALL) && !printKeyFormat.equals(PRINT_KEY_FORMAT_SYSTEM_VALUE)) - { - Trace.log(Trace.ERROR, "Value of parameter 'printKeyFormat' is not valid: " + printKeyFormat); - throw new ExtendedIllegalArgumentException("printKeyFormat (" + printKeyFormat + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - setValue(PRINT_KEY_FORMAT, printKeyFormat); - } - - /** - Sets the line of text (if any) that is printed at the bottom of each page of printed output for the job. - @param printText The line of text (if any) that is printed at the bottom of each page of printed output for the job. Possible values are: -
      -
    • {@link #PRINT_TEXT_SYSTEM_VALUE PRINT_TEXT_SYSTEM_VALUE} - The system value QPRTTXT is used. -
    • {@link #PRINT_TEXT_BLANK PRINT_TEXT_BLANK} - No text is printed on printed output. -
    • The character string that is printed at the bottom of each page. A maximum of 30 characters can be entered. -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #PRINT_TEXT - **/ - public void setPrintText (String printText) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (printText == null) - { - Trace.log(Trace.ERROR, "Parameter 'printText' is null."); - throw new NullPointerException("printText"); - } - setValue(PRINT_TEXT, printText); - } - - /** - Sets the value indicating whether or not the job is eligible to be moved out of main storage and put into auxiliary storage at the end of a time slice or when entering a long wait (such as waiting for a work station user's response). This attribute is ignored when more than one thread is active within the job. If the job consists of multiple routing steps, a change to this attribute during a routing step does not apply to subsequent routing steps. - @param purge true to indicate that the job is eligible to be moved out of main storage and put into auxiliary storage at the end of a time slice or when entering a long wait; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #ELIGIBLE_FOR_PURGE - **/ - public void setPurge(boolean purge) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setValueInternal(ELIGIBLE_FOR_PURGE, purge ? ELIGIBLE_FOR_PURGE_YES : ELIGIBLE_FOR_PURGE_NO); - } - - /** - Sets the fully qualified integrated file system path name of the job queue that the job is to be on. This value is valid for jobs whose status is *JOBQ. For jobs with a status of *OUTQ or *ACTIVE, an error will be signaled. - @param jobQueue The fully qualified integrated file system path name of the job queue that the job is to be on. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #JOB_QUEUE - @see QSYSObjectPathName - **/ - public void setQueue(String jobQueue) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (jobQueue == null) - { - Trace.log(Trace.ERROR, "Parameter 'jobQueue' is null."); - throw new NullPointerException("jobQueue"); - } - - if (!jobQueue.startsWith("*")) - { - QSYSObjectPathName path = new QSYSObjectPathName(jobQueue, "JOBQ"); - StringBuffer buf = new StringBuffer(); - String name = path.getObjectName(); - buf.append(name); - for (int i = name.length(); i < 10; ++i) - { - buf.append(' '); - } - buf.append(path.getLibraryName()); - setValue(JOB_QUEUE, buf.toString()); - } - else - { - setValue(JOB_QUEUE, jobQueue); - } - } - - /** - Sets the scheduling priority of the job compared to other jobs on the same job queue. The highest priority is 0 and the lowest is 9. This value is valid for jobs whose status is *JOBQ or *ACTIVE. For jobs with a status of *OUTQ, an error will be signaled. - @param queuePriority The scheduling priority of the job compared to other jobs on the same job queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #JOB_QUEUE_PRIORITY - **/ - public void setQueuePriority(int queuePriority) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setValue(JOB_QUEUE_PRIORITY, Integer.toString(queuePriority)); - } - - /** - Sets the priority at which the job competes for the processing unit relative to the other jobs that are active at the same time. The run priority ranges from 1 (highest priority) to 99 (lowest priority). This value represents the relative (not absolute) importance of the job or thread. For example, a run priority of 25 is not twice as important as a run priority of 50. If the job consists of multiple routing steps, a change to this attribute during a routing step does not apply to subsequent routing steps. - @param runPriority The run priority of the job is changed. The range of values is 1 (highest priority) to 99 (lowest priority). The value may never be higher than the run priority for the job in which the thread is running. If a priority higher than the job's is entered, an error is returned. Changing the run priority of the job affects the run priorities of all threads within the job. For example, the job is running at priority 10, thread A within the job is running at priority 10, and thread B within the job is running at priority 15. The priority of the job is changed to 20. The priority of thread A would then be adjusted to 20 and the priority of thread B would be adjusted to 25. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #RUN_PRIORITY - **/ - public void setRunPriority(int runPriority) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAsIntToChange(RUN_PRIORITY, runPriority); - } - - /** - Sets the date and time the job is scheduled to become active. - @param scheduleDate The date and time the job is scheduled to become active. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #SCHEDULE_DATE - **/ - public void setScheduleDate(Date scheduleDate) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (scheduleDate == null) - { - Trace.log(Trace.ERROR, "Parameter 'scheduleDate' is null."); - throw new NullPointerException("scheduleDate"); - } - - // The schedule date is weird. - // Use SCHEDULE_DATE and SCHEDULE_TIME to set it. - // Use SCHEDULE_DATE_GETTER to retrieve it. - - Calendar dateTime = Calendar.getInstance(); - dateTime.clear(); - dateTime.setTime(scheduleDate); - - StringBuffer buf = new StringBuffer(); - - int year = dateTime.get(Calendar.YEAR) - 1900; - if (year >= 100) - { - buf.append('1'); - year -= 100; - } - else - { - buf.append('0'); - } - if (year < 10) buf.append('0'); - buf.append(year); - - int month = dateTime.get(Calendar.MONTH) + 1; - if (month < 10) buf.append('0'); - buf.append(month); - - int day = dateTime.get(Calendar.DATE); - if (day < 10) buf.append('0'); - buf.append(day); - - String dateToSet = buf.toString(); - - buf = new StringBuffer(); - int hour = dateTime.get(Calendar.HOUR_OF_DAY); - if (hour < 10) buf.append('0'); - buf.append(hour); - - int minute = dateTime.get(Calendar.MINUTE); - if (minute < 10) buf.append('0'); - buf.append(minute); - - int second = dateTime.get(Calendar.SECOND); - if (second < 10) buf.append('0'); - buf.append(second); - - String timeToSet = buf.toString(); - - setValue(SCHEDULE_DATE, dateToSet); - setValue(SCHEDULE_TIME, timeToSet); - setValueInternal(SCHEDULE_DATE_GETTER, null); - } - - /** - Sets the date the job is scheduled to become active. - @param scheduleDate The date the job is scheduled to become active, in the format CYYMMDD, where C is the century, YY is the year, MM is the month, and DD is the day. A 0 for the century flag indicates years 19xx and a 1 indicates years 20xx. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #SCHEDULE_DATE - **/ - public void setScheduleDate(String scheduleDate) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (scheduleDate == null) - { - Trace.log(Trace.ERROR, "Parameter 'scheduleDate' is null."); - throw new NullPointerException("scheduleDate"); - } - if (scheduleDate.length() != 7) - { - Trace.log(Trace.ERROR, "Value of parameter 'scheduleDate' is not valid: " + scheduleDate); - throw new ExtendedIllegalArgumentException("scheduleDate (" + scheduleDate + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - setValue(SCHEDULE_DATE, scheduleDate); - setValueInternal(SCHEDULE_DATE_GETTER, null); - } - - /** - Sets the date and time the job is scheduled to become active. - @param scheduleTime The date and time the job is scheduled to become active. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #SCHEDULE_DATE - **/ - public void setScheduleTime(Date scheduleTime) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (scheduleTime == null) - { - Trace.log(Trace.ERROR, "Parameter 'scheduleTime' is null."); - throw new NullPointerException("scheduleTime"); - } - setScheduleDate(scheduleTime); - } - - /** - Sets the time the job is scheduled to become active. - @param scheduleTime The time the job is scheduled to become active, in the format HHMMSS, where HH are the hours, MM are the minutes, and SS are the seconds. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #SCHEDULE_DATE - **/ - public void setScheduleTime(String scheduleTime) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (scheduleTime == null) - { - Trace.log(Trace.ERROR, "Parameter 'scheduleTime' is null."); - throw new NullPointerException("scheduleTime"); - } - if (scheduleTime.length() != 6) - { - Trace.log(Trace.ERROR, "Value of parameter 'scheduleTime' is not valid: " + scheduleTime); - throw new ExtendedIllegalArgumentException("scheduleTime (" + scheduleTime + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - setValue(SCHEDULE_TIME, scheduleTime); - setValueInternal(SCHEDULE_DATE_GETTER, null); - } - - /** - Sets the name of the sort sequence table associated with this job.. - @param sortSequenceTable The name of the sort sequence table associated with this job. Possible values are: -
      -
    • {@link #SORT_SEQUENCE_TABLE_SYSTEM_VALUE SORT_SEQUENCE_TABLE_SYSTEM_VALUE} - The system value QSRTSEQ is used. -
    • {@link #SORT_SEQUENCE_TABLE_INITIAL_USER SORT_SEQUENCE_TABLE_INITIAL_USER} - The sort sequence table specified in the user profile under which this thread was initially running is used. -
    • {@link #SORT_SEQUENCE_TABLE_NONE SORT_SEQUENCE_TABLE_NONE} - No sort sequence table is used. The hexadecimal values of the characters are used to determine the sort sequence. -
    • {@link #SORT_SEQUENCE_TABLE_LANGUAGE_SHARED_WEIGHT SORT_SEQUENCE_TABLE_LANGUAGE_SHARED_WEIGHT} - The sort sequence table used can contain the same weight for multiple characters, and it is the shared weight sort table associated with the language specified in the LANGUAGE_ID attribute. -
    • {@link #SORT_SEQUENCE_TABLE_LANGUAGE_UNIQUE_WEIGHT SORT_SEQUENCE_TABLE_LANGUAGE_UNIQUE_WEIGHT} - The sort sequence table used must contain a unique weight for each character in the code page, and it is the unique weight sort table associated with the language specified in the LANGUAGE_ID parameter. -
    • The fully qualified integrated file system path name of the sort sequence table associated with this job. -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #SORT_SEQUENCE_TABLE - @see QSYSObjectPathName - **/ - public void setSortSequenceTable(String sortSequenceTable) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (sortSequenceTable == null) - { - Trace.log(Trace.ERROR, "Parameter 'scheduleTime' is null."); - throw new NullPointerException("sortSequenceTable"); - } - - if (!sortSequenceTable.startsWith("*")) - { - QSYSObjectPathName path = new QSYSObjectPathName(sortSequenceTable, "FILE"); - StringBuffer buf = new StringBuffer(); - String name = path.getObjectName(); - buf.append(name); - for (int i = name.length(); i < 10; ++i) - { - buf.append(' '); - } - buf.append(path.getLibraryName()); - setValue(SORT_SEQUENCE_TABLE, buf.toString()); - } - else - { - setValue(SORT_SEQUENCE_TABLE, sortSequenceTable); - } - } - - /** - Sets the value which indicates whether status messages are displayed for this job. - @param statusMessageHandling The value which indicates whether status messages are displayed for this job. Possible values are: -
      -
    • {@link #STATUS_MESSAGE_HANDLING_SYSTEM_VALUE STATUS_MESSAGE_HANDLING_SYSTEM_VALUE} - The system value QSTSMSG is used. -
    • {@link #STATUS_MESSAGE_HANDLING_INITIAL_USER STATUS_MESSAGE_HANDLING_INITIAL_USER} - The status message handling that is specified in the user profile under which this thread was initially running is used. -
    • {@link #STATUS_MESSAGE_HANDLING_NONE STATUS_MESSAGE_HANDLING_NONE} - This job does not display status messages. -
    • {@link #STATUS_MESSAGE_HANDLING_NORMAL STATUS_MESSAGE_HANDLING_NORMAL} - This job displays status messages. -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #STATUS_MESSAGE_HANDLING - **/ - public void setStatusMessageHandling(String statusMessageHandling) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (statusMessageHandling == null) - { - Trace.log(Trace.ERROR, "Parameter 'statusMessageHandling' is null."); - throw new NullPointerException("statusMessageHandling"); - } - setValue(STATUS_MESSAGE_HANDLING, statusMessageHandling); - } - - /** - Sets the system. This cannot be changed if the object has established a connection to the system. - @param system The system. - @exception PropertyVetoException If the property change is vetoed. - **/ - public void setSystem(AS400 system) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (isConnected_) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - system_ = system; - } - else - { - AS400 oldValue = system_; - AS400 newValue = system; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("system", oldValue, newValue); - } - system_ = system; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("system", oldValue, newValue); - } - } - } - - /** - Sets the value used to separate hours, minutes, and seconds when presenting a time. - @param timeSeparator The value used to separate hours, minutes, and seconds when presenting a time. Possible values are: -
      -
    • {@link #TIME_SEPARATOR_SYSTEM_VALUE TIME_SEPARATOR_SYSTEM_VALUE} - The time separator specified in the system value QTIMSEP is used. -
    • {@link #TIME_SEPARATOR_COLON TIME_SEPARATOR_COLON} - A colon (:) is used for the time separator. -
    • {@link #TIME_SEPARATOR_PERIOD TIME_SEPARATOR_PERIOD} - A period (.) is used for the time separator. -
    • {@link #TIME_SEPARATOR_BLANK TIME_SEPARATOR_BLANK} - A blank is used for the time separator. -
    • {@link #TIME_SEPARATOR_COMMA TIME_SEPARATOR_COMMA} - A comma (,) is used for the time separator. -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #TIME_SEPARATOR - **/ - public void setTimeSeparator(String timeSeparator) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (timeSeparator == null) - { - Trace.log(Trace.ERROR, "Parameter 'timeSeparator' is null."); - throw new NullPointerException("timeSeparator"); - } - - int len = setterKeys_.get(TIME_SEPARATOR); - if (timeSeparator.length() > len) - { - timeSeparator = timeSeparator.substring(0, len); - } - setValue(TIME_SEPARATOR, timeSeparator); - } - - /** - Sets the maximum amount of processor time (in milliseconds) given to each thread in this job before other threads in this job and in other jobs are given the opportunity to run. The time slice establishes the amount of time needed by a thread in this job to accomplish a meaningful amount of processing. At the end of the time slice, the thread might be put in an inactive state so that other threads can become active in the storage pool. If the job consists of multiple routing steps, a change to this attribute during a routing step does not apply to subsequent routing steps. Valid values range from 1 through 9,999,999 milliseconds (that is, 9999.999 seconds). Although you can specify a value of less than 8, the system takes a minimum of 8 milliseconds to run a process. If you display a job's run attributes, the time slice value is never less than 8. - @param timeSlice The maximum amount of processor time (in milliseconds) given to each thread in this job before other threads in this job and in other jobs are given the opportunity to run. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #TIME_SLICE - **/ - public void setTimeSlice(int timeSlice) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - setAsIntToChange(TIME_SLICE, timeSlice); - } - - /** - Sets the value which indicates whether a thread in an interactive job moves to another main storage pool at the end of its time slice. - @param timeSliceEndPool The value which indicates whether a thread in an interactive job moves to another main storage pool at the end of its time slice. Possible values are: -
      -
    • {@link #TIME_SLICE_END_POOL_SYSTEM_VALUE TIME_SLICE_END_POOL_SYSTEM_VALUE} - The value in the system value QTSEPPOOL is used. -
    • {@link #TIME_SLICE_END_POOL_NONE TIME_SLICE_END_POOL_NONE} - A thread in the job does not move to another main storage pool when it reaches the end of its time slice. -
    • {@link #TIME_SLICE_END_POOL_BASE TIME_SLICE_END_POOL_BASE} - A thread in the job moves to the base pool when it reaches the end of its time slice. -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #TIME_SLICE_END_POOL - **/ - public void setTimeSliceEndPool(String timeSliceEndPool) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (timeSliceEndPool == null) - { - Trace.log(Trace.ERROR, "Parameter 'timeSliceEndPool' is null."); - throw new NullPointerException("timeSliceEndPool"); - } - setValue(TIME_SLICE_END_POOL, timeSliceEndPool); - } - - /** - Sets the user name. This does not change the name of the actual server job. Instead, it changes the job this Job object references. This cannot be changed if the object has already established a connection to the system. - @param user The user name. This must be USER_NAME_BLANK if the job name is JOB_NAME_CURRENT. - @exception PropertyVetoException If the property change is vetoed. - @see #getUser - **/ - public void setUser(String user) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting user: " + user); - if (user == null) - { - Trace.log(Trace.ERROR, "Parameter 'user' is null."); - throw new NullPointerException("user"); - } - if (user.length() > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'user' is not valid: '" + user + "'"); - throw new ExtendedIllegalArgumentException("user (" + user + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - if (isConnected_) - { - Trace.log(Trace.ERROR, "Cannot set property 'user' after connect."); - throw new ExtendedIllegalStateException("user", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - user_ = user; - setValueInternal(USER_NAME, user); - } - else - { - String oldValue = user_; - String newValue = user; - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("user", oldValue, newValue); - } - user_ = user; - setValueInternal(USER_NAME, user); - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("user", oldValue, newValue); - } - } - } - - /** - Sets a value for a job attribute. If caching is off, the value is immediately sent to the system. If caching is on, call {@link #commitChanges commitChanges()} to send the uncommitted values to the system. - @param attribute The job attribute to change. - @param value The new value of the attribute. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #commitChanges - @see #getValue - **/ - public void setValue(int attribute, Object value) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting value, attribute: " + attribute + ", value: " + value); - if (attribute < 0 || isReadOnly(attribute)) - { - Trace.log(Trace.ERROR, "Value of parameter 'attribute' is not valid:", attribute); - throw new ExtendedIllegalArgumentException("attribute (" + attribute + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (attribute == SCHEDULE_DATE || attribute == SCHEDULE_TIME) - { - setValueInternal(SCHEDULE_DATE_GETTER, null); - } - - // Update values to set upon commit. - if (cachedChanges_ == null) cachedChanges_ = new JobHashtable(); - cachedChanges_.put(attribute, value); - if (!cacheChanges_) commitChanges(); - - values_.put(attribute, value); // Update getter values. - } - - // Helper method. Used to set a value into our internal table. - // We technically don't need a method for this, but in case in the future we need to do anything besides just putting the value into the hashtable, we can add that logic here. - final void setValueInternal(int key, Object value) - { - values_.put(key, value); - } - - /** - Returns the string representation of this Job in the format "number/user/name", or "" if any of these attributes is null. - @return The string representation. - **/ - public String toString() - { - if (number_ == null || user_ == null || name_ == null) - { - return ""; - } - StringBuffer buf = new StringBuffer(); - buf.append(number_); - buf.append('/'); - buf.append(user_); - buf.append('/'); - buf.append(name_); - return buf.toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/Job16.gif b/cvsroot/src/com/ibm/as400/access/Job16.gif deleted file mode 100644 index c47621035..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/Job16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/Job32.gif b/cvsroot/src/com/ibm/as400/access/Job32.gif deleted file mode 100644 index a3b4854fc..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/Job32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/JobBeanInfo.java b/cvsroot/src/com/ibm/as400/access/JobBeanInfo.java deleted file mode 100644 index fcc738be8..000000000 --- a/cvsroot/src/com/ibm/as400/access/JobBeanInfo.java +++ /dev/null @@ -1,158 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JobBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - The JobBeanInfo class represents the bean information for the Job class. - **/ -public class JobBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private static final Class BEAN_CLASS = Job.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - // Set up the event set descriptors. - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - - eventSetDescriptors = new EventSetDescriptor[] { propertyChange, vetoableChange }; - - // Set up the property descriptors. - PropertyDescriptor system = new PropertyDescriptor("system", BEAN_CLASS); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - - PropertyDescriptor name = new PropertyDescriptor("name", BEAN_CLASS); - name.setBound(true); - name.setConstrained(true); - name.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_NAME")); - name.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_NAME")); - - PropertyDescriptor number = new PropertyDescriptor("number", BEAN_CLASS); - number.setBound(true); - number.setConstrained(true); - number.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_JOB_NUMBER")); - number.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_JOB_NUMBER")); - - PropertyDescriptor user = new PropertyDescriptor("user", BEAN_CLASS); - user.setBound(true); - user.setConstrained(true); - user.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_JOB_USER")); - user.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_JOB_USER")); - - propertyDescriptors = new PropertyDescriptor[] { system, name, number, user }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the additional bean information. - @return The additional bean information. - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return null; - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return Zero (0), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "propertyChange" event. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. Possible values are: -
      -
    • BeanInfo.ICON_MONO_16x16 -
    • BeanInfo.ICON_MONO_32x32 -
    • BeanInfo.ICON_COLOR_16x16 -
    • BeanInfo.ICON_COLOR_32x32 -
    - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("Job16.gif"); - - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("Job32.gif"); - } - Trace.log(Trace.ERROR, "Value of parameter 'icon' is not valid:", icon); - throw new ExtendedIllegalArgumentException("icon (" + icon + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JobCCSID.java b/cvsroot/src/com/ibm/as400/access/JobCCSID.java deleted file mode 100644 index 06dd9d3d9..000000000 --- a/cvsroot/src/com/ibm/as400/access/JobCCSID.java +++ /dev/null @@ -1,109 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JobCCSID.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - The JobCCSID class represents an IBM i Job CCSID. - **/ -public class JobCCSID -{ - private static final String CLASSNAME = "com.ibm.as400.access.JobCCSID"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - // The system where the job is located. - private AS400 system_ = null; - private int ccsid_ = -1; - - /** - Constructs a JobCCSID object. - **/ - public JobCCSID() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing JobCCSID object."); - } - - /** - Constructs a JobCCSID object. It uses the specified system. - @param system The system on which to retrieve the CCSID. - **/ - public JobCCSID(AS400 system) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing JobCCSID object, system: " + system); - system_ = system; - } - - /** - Returns the system on which the Job CCSID is to be retrieved. - @return The system on which the Job CCSID is to be retrieved. If the system has not been set, null is returned. - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - /** - Retrieves the CCSID for this object. - @return The Job CCSID of the corresponding job. - **/ - public int retrieveCcsid() throws AS400SecurityException, ErrorCompletingRequestException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving CCSID."); - if (ccsid_ == -1) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving CCSID from server..."); - if (system_ == null) - { - try - { - ccsid_ = JobCCSIDNative.retrieveCcsid(); - } - catch (Throwable e) - { - Trace.log(Trace.ERROR, "Attempt to connect to server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - else - { - ccsid_ = system_.getJobCcsid(); - } - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "CCSID:", ccsid_); - return ccsid_; - } - - /** - Sets the system on which to retrieve the Job CCSID. The system cannot be changed once a connection is made to the system. - @param system The system on which to retrieve the Job CCSID. - **/ - public void setSystem(AS400 system) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system: " + system); - if (ccsid_ != -1) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - system_ = system; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JobCCSIDNative.java b/cvsroot/src/com/ibm/as400/access/JobCCSIDNative.java deleted file mode 100644 index 4a7500cd4..000000000 --- a/cvsroot/src/com/ibm/as400/access/JobCCSIDNative.java +++ /dev/null @@ -1,50 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JobCCSIDNative.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class JobCCSIDNative -{ - private static final String CLASSNAME = "com.ibm.as400.access.JobCCSIDNative"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - static - { - NativeMethods.loadNativeLibraryQyjspart(); - } - - static int retrieveCcsid() throws ErrorCompletingRequestException - { - try - { - if (AS400.nativeVRM.vrm_ < 0x00050300) - { - return new NLSImplNative().ccsidNative(); - } - else - { - return retrieveCcsidNative(); - } - } - catch (NativeException e) - { - // Exception detected in C code. - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.AS400_ERROR); - } - } - - private static native int retrieveCcsidNative() throws NativeException; -} diff --git a/cvsroot/src/com/ibm/as400/access/JobDescription.java b/cvsroot/src/com/ibm/as400/access/JobDescription.java deleted file mode 100644 index 00910e618..000000000 --- a/cvsroot/src/com/ibm/as400/access/JobDescription.java +++ /dev/null @@ -1,890 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JobDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2005-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; - -/** - * - * Represents an IBM i job description. - *

    - * Note that calling any of the attribute getters for the first time will - * result in an implicit call to {@link #refresh()}. - * If any exception is thrown by an implicit call to refresh(), - * it will be logged to {@link com.ibm.as400.access.Trace#ERROR - * Trace.ERROR} and rethrown as a java.lang.RuntimeException. - * However, should an exception occur during an - * explicit call to refresh(), the exception will be thrown as-is to the caller. - *

    - * Implementation note: - * This class internally calls the Retrieve Job Description (QWDRJOBD) API. - * - *

    This class was inspired by a prototype submitted by Kendall Coolidge. - * - **/ - -public class JobDescription implements Serializable -{ - static final long serialVersionUID = 4L; - - private static final int VRM520 = AS400.generateVRM(5, 2, 0); - private static final int VRM530 = AS400.generateVRM(5, 3, 0); - private static final int VRM540 = AS400.generateVRM(5, 4, 0); - private int vrm_; // system version - - private AS400 system_; - private String name_; - private String library_; - - private transient boolean loaded_; - - private static final ProgramParameter errorCode_ = new ProgramParameter(new byte[4]); - - private String jobDescriptionName_; - private String jobDescriptionLibraryName_; - private String userName_; - private String[] initialLibraryList_; - private String jobDate_; - private String jobSwitches_; - private String jobQueueName_; - private String jobQueueLibraryName_; - private String jobQueuePriority_; - private String holdOnJobQueue_; - private String outputQueueName_; - private String outputQueueLibraryName_; - private String outputQueuePriority_; - private String printerDeviceName_; - private String printText_; - private int syntaxCheckSeverity_; - private int endSeverity_; - private int messageLoggingSeverity_; - private String messageLoggingLevel_; - private String messageLoggingText_; - private String loggingOfCLPrograms_; - private String inquiryMessageReply_; - private String deviceRecoveryAction_; - private String timeSliceEndPool_; - private String accountingCode_; - private String routingData_; - private String textDescription_; - private int jobMessageQueueMaximumSize_; - private String jobMessageQueueFullAction_; - private String CYMDJobDate_; - private String allowMultipleThreads_; - private String spooledFileAction_; // added in V5R2 - private String[] iaspNames_; // added in V5R2 - private String ddmConversation_; // added in V5R3 - private String jobLogOutput_; // added in V5R4 - - - /** - * Constructs a JobDescription. - * @param system The system where the job description resides. - * @param name The name of the job description to retrieve. - * @param library The library containing the job description. - **/ - public JobDescription(AS400 system, String library, String name) - { - if (system == null) throw new NullPointerException("system"); - if (library == null) throw new NullPointerException("library"); - if (name == null) throw new NullPointerException("name"); - - system_ = system; - name_ = name; - library_ = library; - } - - /** - * Constructs a JobDescription. - * @param system The system where the job description resides. - * @param path The fully qualified IFS path to the job description. - **/ - public JobDescription(AS400 system, QSYSObjectPathName path) - { - if (system == null) throw new NullPointerException("system"); - if (path == null) throw new NullPointerException("path"); - - system_ = system; - name_ = path.getObjectName(); - library_ = path.getLibraryName(); - } - - /** - * Refreshes the values for all attributes of the job description. - * - * @throws AS400Exception If the system returns an error message. - * @throws AS400SecurityException If a security or authority error occurs. - * @throws ErrorCompletingRequestException If an error occurs before the request is completed. - * @throws InterruptedException If this thread is interrupted. - * @throws ObjectDoesNotExistException If the object does not exist on the system. - * @throws IOException If an error occurs while communicating with the system. - **/ - public void refresh() - throws - AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, ObjectDoesNotExistException, IOException - { - - if (system_ == null) - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - if (name_ == null) - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - if (library_ == null) - throw new ExtendedIllegalStateException("library", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - final int ccsid = system_.getCcsid(); - ConvTable conv = ConvTable.getTable(ccsid, null); - AS400Text text20 = new AS400Text(20, ccsid); - - // concat jobdname + library for program parameter[3] - StringBuffer qualifiedJobDName = new StringBuffer(20); - qualifiedJobDName.append(name_); - for (int i = 0; i < (10 - name_.length()); i++) { - qualifiedJobDName.append(" "); - } - qualifiedJobDName.append(library_); - - ProgramParameter[] parms = new ProgramParameter[5]; - int len = 2048; - // receiver variable - parms[0] = new ProgramParameter(len); - // length of receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(len)); - // format name - parms[2] = new ProgramParameter(conv.stringToByteArray("JOBD0100")); - // job description name - parms[3] = new ProgramParameter(text20.toBytes(qualifiedJobDName.toString().trim().toUpperCase())); - - parms[4] = errorCode_; - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QWDRJOBD.PGM", parms); - - if (!pc.run()) { - throw new AS400Exception(pc.getMessageList()); - } - - byte[] data = parms[0].getOutputData(); - - int bytesReturned = BinaryConverter.byteArrayToInt(data, 0); - int bytesAvailable = BinaryConverter.byteArrayToInt(data, 4); - if (bytesReturned < bytesAvailable) - { - if (Trace.traceOn_) - { - Trace.log( - Trace.DIAGNOSTIC, - "JobDescription: Not enough bytes, trying again. Bytes returned = " - + bytesReturned - + "; bytes available = " - + bytesAvailable); - } - len = bytesAvailable; - try - { - parms[0].setOutputDataLength(len); - parms[1].setInputData(BinaryConverter.intToByteArray(len)); - } catch (java.beans.PropertyVetoException pve) {} // this will never happen - if (!pc.run()) { - throw new AS400Exception(pc.getMessageList()); - } - data = parms[0].getOutputData(); - } - - jobDescriptionName_ = conv.byteArrayToString(data, 8, 10).trim(); - jobDescriptionLibraryName_ = conv.byteArrayToString(data, 18, 10).trim(); - userName_ = conv.byteArrayToString(data, 28, 10).trim(); - jobDate_ = conv.byteArrayToString(data, 38, 8).trim(); - jobSwitches_ = conv.byteArrayToString(data, 46, 8).trim(); - jobQueueName_ = conv.byteArrayToString(data, 54, 10).trim(); - jobQueueLibraryName_ = conv.byteArrayToString(data, 64, 10).trim(); - jobQueuePriority_ = conv.byteArrayToString(data, 74, 2).trim(); - holdOnJobQueue_ = conv.byteArrayToString(data, 76, 10).trim(); - outputQueueName_ = conv.byteArrayToString(data, 86, 10).trim(); - outputQueueLibraryName_ = conv.byteArrayToString(data, 96, 10).trim(); - outputQueuePriority_ = conv.byteArrayToString(data, 106, 2).trim(); - printerDeviceName_ = conv.byteArrayToString(data, 108, 10).trim(); - printText_ = conv.byteArrayToString(data, 118, 30).trim(); - syntaxCheckSeverity_ = BinaryConverter.byteArrayToInt(data, 148); - endSeverity_ = BinaryConverter.byteArrayToInt(data, 152); - messageLoggingSeverity_ = BinaryConverter.byteArrayToInt(data, 156); - messageLoggingLevel_ = conv.byteArrayToString(data, 160, 1).trim(); - messageLoggingText_ = conv.byteArrayToString(data, 161, 10).trim(); - loggingOfCLPrograms_ = conv.byteArrayToString(data, 171, 10).trim(); - inquiryMessageReply_ = conv.byteArrayToString(data, 181, 10).trim(); - deviceRecoveryAction_ = conv.byteArrayToString(data, 191, 13).trim(); - timeSliceEndPool_ = conv.byteArrayToString(data, 204, 10).trim(); - accountingCode_ = conv.byteArrayToString(data, 214, 15).trim(); - routingData_ = conv.byteArrayToString(data, 229, 80).trim(); - textDescription_ = conv.byteArrayToString(data, 309, 50).trim(); - jobMessageQueueMaximumSize_ = BinaryConverter.byteArrayToInt(data, 376); - jobMessageQueueFullAction_ = conv.byteArrayToString(data, 380, 10).trim(); - CYMDJobDate_ = conv.byteArrayToString(data, 390, 10).trim(); - allowMultipleThreads_ = conv.byteArrayToString(data, 400, 10).trim(); - - int initialLibraryListCount = BinaryConverter.byteArrayToInt(data, 364); - initialLibraryList_ = new String[initialLibraryListCount]; - int initialLibraryListOffset = BinaryConverter.byteArrayToInt(data, 360); - for (int i = 0; i < initialLibraryListCount; ++i) - { - initialLibraryList_[i] = conv.byteArrayToString(data, initialLibraryListOffset + (i * 11), 10).trim(); - } - - if (vrm_ == 0) vrm_ = system_.getVRM(); - if (vrm_ >= VRM520) - { - spooledFileAction_ = conv.byteArrayToString(data, 410, 10).trim(); - - int iaspOffset = BinaryConverter.byteArrayToInt(data, 420); - int iaspCount = BinaryConverter.byteArrayToInt(data, 424); - int iaspLength = BinaryConverter.byteArrayToInt(data, 428); - iaspNames_ = new String[iaspCount]; - for (int i = 0; i < iaspCount; ++i) - { - int offset = iaspOffset + (i * iaspLength); - iaspNames_[i] = conv.byteArrayToString(data, offset, 10).trim(); - } - } - - if (vrm_ >= VRM530) - { - ddmConversation_ = conv.byteArrayToString(data, 432, 10).trim(); - } - - if (vrm_ >= VRM540) - { - jobLogOutput_ = conv.byteArrayToString(data, 442, 10).trim(); - } - - loaded_ = true; - } - - /** - Restores the state of this object from an object input stream. - @param ois The stream of state information. - @throws IOException - @throws ClassNotFoundException - **/ - private void readObject(java.io.ObjectInputStream ois) - throws IOException, ClassNotFoundException - { - // Restore the non-static and non-transient fields. - ois.defaultReadObject(); - - // Initialize the transient fields. - loaded_ = false; - } - - /** - * Helper method. Calls refresh and rethrows only RuntimeException's - * so that all of the getters can call it, without having long 'throws' lists. - **/ - private void loadInformation() throws RuntimeException - { - try { - refresh(); - } - catch (RuntimeException e) { throw e; } - catch (Exception e) { - Trace.log(Trace.ERROR, "Exception rethrown by loadInformation():", e); - throw new IllegalStateException(e.getMessage()); - } - } - - /** - * Returns the accounting code associated with this job description. - *

    An identifier assigned to jobs that use this job description. - * This code is used to collect system resource use information. - * If the special value *USRPRF is specified, the accounting code - * used for jobs using this job description is obtained from the job's user profile. - * @return The accounting code. - **/ - public String getAccountingCode() - { - if (!loaded_) loadInformation(); - return accountingCode_; - } - - /** - * Returns whether or not the job is allowed to run with - * multiple user threads. - *

    This attribute does not prevent the operating system from creating - * system threads in the job. This attribute is not allowed to be changed once a job starts. - * This attribute applies to autostart jobs, prestart jobs, batch jobs - * submitted from job schedule entries, and jobs started by using the - * Submit Job (SBMJOB) and Batch Job (BCHJOB) commands. This attribute is - * ignored when starting all other types of jobs. - * This attribute should be set to true only in job descriptions - * that are used exclusively with functions that create multiple user threads. - * @return Whether or not the job is allowed to run with - * multiple user threads. Possible values are: - *

      - *
    • true - Multiple threads allowed. - *
    • false - Multiple user threads not allowed. - *
    - **/ - public boolean isAllowMultipleThreads() - { - if (!loaded_) loadInformation(); - return (allowMultipleThreads_.equals("*YES") ? true : false); - } - - /** - * Returns the job date in CYMD format. - *

    The date that will be assigned to jobs using this job description - * when they are started. The possible values are: - *

      - *
    • "*SYSVAL" - The value in the QDATE system value is used at the time the job is started.
    • - *
    • job-date - The date to be used at the time the job is started. The format of - * the field returned in CYYMMDD where C is the century, YY is the year, MM is the month, - * and DD is the day. A 0 for the century indicates years 19xx and a 1 indicates - * years 20xx. The field is padded on the right with blanks. - *
    - * @return The job date in CYYMMDD format. - **/ - public String getCYMDJobDate() - { - if (!loaded_) loadInformation(); - return CYMDJobDate_; - } - - /** - * Returns the action to take when an I/O error occurs for the - * interactive job's requesting program device. - * The possible values are: - *
      - *
    • "*SYSVAL" - The value in the system value QDEVRCYACN at the time the job is started is used as the device recovery action for this job description. - *
    • "*DSCMSG" - Disconnects the job when an I/O error occurs. When the job reconnects, the system sends a message to the application program, indicating the job has reconnected and that the workstation device has recovered. - *
    • "*DSCENDRQS" - Disconnects the job when an I/O error occurs. When the job reconnects, the system sends the End Request (ENDRQS) command to return control to the previous request level. - *
    • "*ENDJOB" - Ends the job when an I/O error occurs. A message is sent to the job's log and to the history log (QHST). This message indicates that the job ended because of a device error. - *
    • "*ENDJOBNOLIST" - Ends the job when an I/O error occurs. There is no job log produced for the job. The system sends a message to the history log (QHST). This message indicates that the job ended because of a device error. - *
    - * @return The device recovery action. - **/ - public String getDeviceRecoveryAction() - { - if (!loaded_) loadInformation(); - return deviceRecoveryAction_; - } - - /** - * Returns whether Distributed Data Management conversations are kept or dropped when they are not being used. - * The possible values are: - *
      - *
    • *KEEP - The system keeps DDM conversation connections active when there are no users. - *
    • *DROP - The system ends a DDM-allocated conversation when there are no users. - *
    • null if system is pre-V5R3. - *
    - * @return Whether DDM conversations are kept or dropped. - **/ - public String getDDMConversation() - { - if (!loaded_) loadInformation(); - return ddmConversation_; - } - - /** - * Returns the message severity level of escape messages that can cause a batch job to end. - * The possible values are from 0 through 99. - * @return The message severity level of escape messages that can cause a batch job to end. - **/ - public int getEndSeverity() - { - if (!loaded_) loadInformation(); - return endSeverity_; - } - - /** - * Returns whether jobs using this job description are put on the job queue in the - * hold condition. - * @return Whether jobs using this job description are put on the job queue in the hold condition. - **/ - public boolean isHoldOnJobQueue() - { - if (!loaded_) loadInformation(); - return (holdOnJobQueue_.equals("*YES") ? true : false); - } - - /** - * Returns the initial library list that is used for jobs that use this job - * description. Only the libraries in the user portion of the library list are - * included. - * @return The initial library list as an array of type String - **/ - public String[] getInitialLibraryList() - { - if (!loaded_) loadInformation(); - return initialLibraryList_; - } - - /** - * Indicates how inquiry messages are answered for jobs that use this job description. - * The possible values are: - *
      - *
    • "*RQD" - The job requires an answer for any inquiry messages that occur - * while the job is running. - *
    • "*DFT" - The system uses the default message reply to answer any inquiry - * messages issued while the job is running. The default reply is either defined in - * the message description or is the default system reply. - *
    • "*SYSRPYL" - The system reply list is checked to see if there is an entry - * for an inquiry message issued while the job is running. If a match occurs, the - * system uses the reply value for that entry. If no entry exists for that message, - * the system uses an inquiry message. - *
    - * @return The inquiry message reply behavior. - **/ - public String getInquiryMessageReply() - { - if (!loaded_) loadInformation(); - return inquiryMessageReply_; - } - - /** - * Returns the list of initial ASP groups for jobs that use this job description. This does not include the system ASP or basic user ASPs. - * null if system is pre-V5R2. - * @return The list of initial ASP groups. null if system is pre-V5R2. - **/ - public String[] getInitialASPGroupNames() - { - return iaspNames_; - } - - /** - * Returns the date that will be assigned to jobs using this job description - * when they are started. The possible values are: - *
      - *
    • "*SYSVAL" - The value in the QDATE system value is used at the time the job is started. - *
    • job-date - The date to be used at the time the job is started. This date is in the format specified for the DATFMT job attribute. - *
    - * - * @return The date that will be assigned to jobs using this job description. - **/ - public String getJobDateString() - { - if (!loaded_) loadInformation(); - return jobDate_; - } - - /** - * Returns name of the library in which the job description resides. - * @return The name of the library in which the job description resides. - **/ - public String getLibraryName() - { - if (!loaded_) loadInformation(); - return jobDescriptionLibraryName_; - } - - /** - * Returns name of the job description about which information is being returned. - * @return The name of the job description about which information is being returned. - **/ - public String getName() - { - if (!loaded_) loadInformation(); - return jobDescriptionName_; - } - - /** - * Indicates how the job log will be produced when the job completes. - * The possible values are: - *
      - *
    • *SYSVAL - The value is specified by the QLOGOUTPUT system value. - *
    • *JOBLOGSVR - The job log will be produced by a job log server. For more information about job log servers, refer to the Start Job Log Server (STRLOGSVR) command. - *
    • *JOBEND - The job log will be produced by the job itself. If the job cannot produce its own job log, the job log will be produced by a job log server. For example, a job does not produce its own job log when the system is processing a Power Down System (PWRDWNSYS) command. - *
    • *PND - The job log will not be produced. The job log remains pending until removed. - *
    • null if system is pre-V5R4. - *
    - * @return The job log output behavior. - **/ - public String getJobLogOutput() - { - if (!loaded_) loadInformation(); - return jobLogOutput_; - } - - /** - * Returns the action to be taken when the job message queue becomes full. - *
    The possible values are: - *
      - *
    • "*SYSVAL" - The value is specified by the system value QJOBMSGQFL. - *
    • "*NOWRAP" - When the message queue becomes full, do not wrap. This action will cause the job to end. - *
    • "*WRAP" - When the message queue becomes full, wrap to the beginning and start filling again. - *
    • "*PRTWRAP" - When the message queue becomes full, wrap the job queue and print the messages that are being overlaid. - *
    - * @return The action to be taken when the job message queue becomes full. - **/ - public String getJobMessageQueueFullAction() - { - if (!loaded_) loadInformation(); - return jobMessageQueueFullAction_; - } - - /** - * Returns the maximum size (in megabytes) of the job message queue. - *
    The possible values are: - *
      - *
    • 0 - The maximum size set by system value QJOBMSGMX at the time the job is started. - *
    • 2-64 - The maximum size of the job message queue in megabytes. - *
    - * @return The maximum size (in megabytes) of the job message queue. - **/ - public int getJobMessageQueueMaximumSize() - { - if (!loaded_) loadInformation(); - return jobMessageQueueMaximumSize_; - } - - /** - * Returns the library of the job queue into which batch jobs using this job description are placed. - * @return The library of the job queue into which batch jobs using this job description are placed. - **/ - public String getJobQueueLibraryName() - { - if (!loaded_) loadInformation(); - return jobQueueLibraryName_; - } - - /** - * Returns the name of the job queue into which batch jobs using this job description are placed. - * @return The name of the job queue into which batch jobs using this job description are placed. - **/ - public String getJobQueueName() - { - if (!loaded_) loadInformation(); - return jobQueueName_; - } - - /** - * Returns the scheduling priority of each job that uses this job description. - *
    The highest priority is 1 and the lowest priority is 9. - * @return The scheduling priority of each job that uses this job description. - **/ - public int getJobQueuePriority() - { - if (!loaded_) loadInformation(); - try { return Integer.parseInt(jobQueuePriority_); } - catch (NumberFormatException e) { // this should never happen, but if it does... - Trace.log(Trace.ERROR, "Exception swallowed by getJobQueuePriority():", e); - return 9; - } - } - - /** - * Returns the initial settings for a group of eight job switches used by jobs that - * use this job description. These switches can be set or tested in a program and - * used to control a program's flow. - *
    For each bit position, the possible values are '0' (off) and '1' (on). - * @return A bit-map containing the initial settings for the eight job switches. - **/ - public byte getJobSwitches() - { - if (!loaded_) loadInformation(); - // Note: Byte.parseByte(string,2) interprets the byte as a signed value, therefore it won't accept a '1' at bit position 0 (the "sign bit"). - byte bitmap = (byte)0; - for (int i=0; i<8; i++) { - if (jobSwitches_.charAt(i) == '1') bitmap = (byte)(bitmap | (0x01 << 7-i)); - } - return bitmap; - } - - /** - * Returns whether or not commands are logged for CL programs that are run. - * @return Whether or not commands are logged for CL programs that are run. - **/ - public boolean isLoggingOfCLPrograms() - { - if (!loaded_) loadInformation(); - return (loggingOfCLPrograms_.equals("*YES") ? true : false); - } - - /** - * Returns the type of information logged. - * Possible types are: - *
      - *
    • 0 - No messages are logged. - *
    • 1 - All messages sent to the job's external message queue with a - * severity greater than or equal to the message logging severity are logged. - * This includes the indication of job start, job end and job completion status. - *
    • 2 - The following information is logged: - *
        - *
      • Level 1 information. - *
      • Request messages that result in a high-level message with a severity code - * greater than or equal to the logging severity cause the request message - * and all associated messages to be logged. - *
      - *
    • 3 - The following information is logged: - *
        - *
      • Level 1 and 2 information. - *
      • All request messages. - *
      • Commands run by a CL program are logged if it is allowed by the logging of CL programs job attribute and the log attribute of the CL program. - *
      - *
    • 4 - The following information is logged: - *
        - *
      • All request messages and all messages with a severity greater than or equal to the message logging severity, including trace messages. - *
      • Commands run by a CL program are logged if it is allowed by the logging of CL programs job attribute and the log attribute of the CL program. - *
      - *
    - * @return The type of information logged. - **/ - public int getMessageLoggingLevel() - { - if (!loaded_) loadInformation(); - try { return Integer.parseInt(messageLoggingLevel_); } - catch (NumberFormatException e) { // this should never happen, but if it does... - Trace.log(Trace.ERROR, "Exception swallowed by getMessageLoggingLevel():", e); - return 0; - } - } - - /** - * Returns the severity level that is used in conjunction with the logging level to determine which error messages are logged in the job log. - * The possible values are from 0 through 99. - * @return The message logging severity level. - **/ - public int getMessageLoggingSeverity() - { - if (!loaded_) loadInformation(); - return messageLoggingSeverity_; - } - - /** - * Returns the level of message text that is written in the job log when a message - * is logged according to the logging level and logging severity. - * The possible values are: - *
      - *
    • "*MSG" - Only the message text is written to the job log. - *
    • "*SECLVL" - Both the message text and the message help (cause and recovery) of the error message are written to the job log. - *
    • "*NOLIST" - If the job ends normally, no job log is produced. If the job ends abnormally (if the job end code is 20 or higher), a job log is produced. The messages that appear in the job log contain both the message text and the message help. - *
    - * @return The level of message text that is written in the job log. - **/ - public String getMessageLoggingText() - { - if (!loaded_) loadInformation(); - return messageLoggingText_; - } - - /** - * Returns the name of the library in which the output queue resides. - * @return The name of the library in which the output queue resides. - **/ - public String getOutputQueueLibraryName() - { - if (!loaded_) loadInformation(); - return outputQueueLibraryName_; - } - - /** - * Returns the name of the default output queue that is used for spooled - * output produced by jobs that use this job description. - * Possible values are: - *
      - *
    • "*USRPRF" - The output queue name for jobs using this job description is obtained from the user profile of the job at the time the job is started. - *
    • "*DEV" - The output queue with the same name as the printer device for this job description is used. - *
    • "*WRKSTN" - The output queue name is obtained from the device description from which this job is started. - *
    • output-queue-name The name of the output queue for this job description. - *
    - * @return The name of the default output queue. - **/ - public String getOutputQueueName() - { - if (!loaded_) loadInformation(); - return outputQueueName_; - } - - /** - * Returns the output priority for spooled files that are produced by jobs using this - * job description. - * The highest priority is 1, and the lowest priority is 9. - * @return The output priority. - **/ - public int getOutputQueuePriority() - { - if (!loaded_) loadInformation(); - try { return Integer.parseInt(outputQueuePriority_); } - catch (NumberFormatException e) { // this should never happen, but if it does... - Trace.log(Trace.ERROR, "Exception swallowed by getOutputQueuePriority():", e); - return 9; - } - } - - /** - * Returns the name of the printer device or the source for the name of the printer - * device that is used for all spooled files created by jobs that use this job description. - * Possible values are: - *
      - *
    • "*USRPRF" - The printer device name is obtained from the user profile of the job at the time the job is started. - *
    • "*SYSVAL" - The value in the system value QPRTDEV at the time the job is started is used as the printer device name. - *
    • "*WRKSTN" - The printer device name is obtained from the work station where the job was started. - *
    • printer-device-name - The name of the printer device that is used with this job description. - *
    - * @return The name of the printer device. - **/ - public String getPrinterDeviceName() - { - if (!loaded_) loadInformation(); - return printerDeviceName_; - } - - /** - * Returns the line of text (if any) that is printed at the bottom of each page of - * printed output for jobs using this job description. - * @return The print text. - **/ - public String getPrintText() - { - if (!loaded_) loadInformation(); - return printText_; - } - - /** - * Returns the routing data that is used with this job description to start jobs. - * The possible values are: - *
      - *
    • "QCMDI" - The default routing data QCMDI is used by the IBM-supplied interactive subsystem to route the job to the IBM-supplied control language processor QCMD in the QSYS library. - *
    • "*RQSDTA" - Up to the first 80 characters of the request data specified in the request data field are used as the routing data for the job. - *
    • routing-data - The routing data to use for jobs that use this job description. - *
    - * @return The routing data. - **/ - public String getRoutingData() - { - if (!loaded_) loadInformation(); - return routingData_; - } - - /** - * Returns the value that specifies whether spooled files can be accessed through - * job interfaces once a job has completed its normal activity. - * null if system is pre-V5R2. - * Possible values are: - *
      - *
    • "*KEEP" - Spooled files are kept with the job when the job completes its activity. - *
    • "*DETACH" - Spooled files are detached from the job when the job completes its activity. - *
    • "*SYSVAL" - The jobs using this job description will take the spooled file action specified by the QSPLFACN system value. - *
    - * @return Spooled file action. null if system is pre-V5R2. - **/ - public String getSpooledFileAction() - { - if (!loaded_) loadInformation(); - return spooledFileAction_; - } - - /** - * Returns whether requests placed on the job's message queue are checked for syntax - * as CL commands, and the message severity that causes a syntax error to end - * processing of a job. - * The possible values are: - *
      - *
    • -1 - The request data is not checked for syntax as CL commands. - *
    • 0-99 - Specifies the lowest message severity that causes a running job to end. The request data is checked for syntax as CL commands, and, if a syntax error occurs that is greater than or equal to the error message severity specified here, the running of the job that contains the erroneous command is suppressed. - *
    - * @return The syntax check severity. - **/ - public int getSyntaxCheckSeverity() - { - if (!loaded_) loadInformation(); - return syntaxCheckSeverity_; - } - - /** - * Returns the system where the job description is located. - * @return The system where the job description resides. - **/ - public AS400 getSystem() - { - return system_; - } - - /** - * Returns the user text, if any, used to briefly describe the job description. - * @return The text description. "" if no description. - **/ - public String getTextDescription() - { - if (!loaded_) loadInformation(); - return textDescription_; - } - - /** - * Returns whether interactive jobs using this job description should be moved to - * another main storage pool when they reach time-slice end. - * The possible values are: - *
      - *
    • "*SYSVAL" - The system value is used. - *
    • "*NONE" - The job is not moved when it reaches time-slice end. - *
    • "*BASE" - The job is moved to the base pool when it reaches time-slice end. - *
    - * @return Whether interactive jobs using this job description should be moved to another main storage pool when they reach time-slice end. - **/ - public String getTimeSliceEndPool() - { - if (!loaded_) loadInformation(); - return timeSliceEndPool_; - } - - /** - * Returns the name of the user profile associated with this job description. - * @return The name of the user profile associated with this job description. - **/ - public String getUserName() - { - if (!loaded_) loadInformation(); - return userName_; - } - - /** - * Sets the library where the job description is located. Cannot be changed if the object - * has established a connection to the system - * @param library The name of the library - **/ - public void setLibraryName(String library) - { - if (library == null) throw new NullPointerException("library"); - if (loaded_) - throw new ExtendedIllegalStateException("library", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - library_ = library; - } - - /** - * Sets the job description name. Cannot be changed after the object has established - * a connection to the system. - * @param name The job description name - **/ - public void setName(String name) - { - if (name == null) throw new NullPointerException("name"); - if (loaded_) - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - name_ = name; - } - - /** - * Sets the system. Cannot be changed after the object - * has established a connection to the system. - * - * @param system The system where the job description resides. - **/ - public void setSystem(AS400 system) - { - if (system == null) throw new NullPointerException("system"); - if (loaded_) - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - system_ = system; - vrm_ = 0; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/JobEnumeration.java b/cvsroot/src/com/ibm/as400/access/JobEnumeration.java deleted file mode 100644 index 1156809ca..000000000 --- a/cvsroot/src/com/ibm/as400/access/JobEnumeration.java +++ /dev/null @@ -1,92 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JobEnumeration.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Enumeration; -import java.util.NoSuchElementException; - -// Helper class. Used to wrap the Job[] with an Enumeration. -// This class is used by JobList. -class JobEnumeration implements Enumeration -{ - private Job[] jobCache_; - private JobList list_; - private int counter_; // number of objects returned so far by nextElement() - private int numJobs_; - private int listOffset_ = 0; - private int cacheOffset_ = 0; - - private Tracker tracker_; - - JobEnumeration(JobList list, int length, Tracker tracker) - { - list_ = list; - numJobs_ = length; - tracker_ = tracker; - } - - // Sets our tracker free if we are garbage collected, so that our parent JobList knows we are done without it having to actually maintain a hard reference to us. - protected void finalize() throws Throwable - { - tracker_.set(false); - super.finalize(); - } - - public final boolean hasMoreElements() - { - if (!tracker_.isSet()) return false; // JobList invalidated us. - - if (counter_ < numJobs_) - { - return true; - } - else - { - tracker_.set(false); - return false; - } - } - - public final Object nextElement() - { - if (counter_ >= numJobs_ || !tracker_.isSet()) - { - tracker_.set(false); - throw new NoSuchElementException(); - } - - if (jobCache_ == null || cacheOffset_ >= jobCache_.length) - { - try - { - jobCache_ = list_.getJobs(listOffset_, 1000); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loaded next block in JobEnumeration: " + jobCache_.length + " messages at list offset " + listOffset_ + " out of " + numJobs_ + " total."); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Exception while loading nextElement() in JobEnumeration:", e); - throw new NoSuchElementException(); - } - - // We have a freshly loaded cache, so reset to the beginning of the cache. - cacheOffset_ = 0; - - // Set starting offset for next call to getJobs(), - // in case another call is needed. - listOffset_ += jobCache_.length; - } - ++counter_; - return jobCache_[cacheOffset_++]; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JobHashtable.java b/cvsroot/src/com/ibm/as400/access/JobHashtable.java deleted file mode 100644 index 063b580bc..000000000 --- a/cvsroot/src/com/ibm/as400/access/JobHashtable.java +++ /dev/null @@ -1,157 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JobHashtable.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; - -// This class represents a hashtable that uses primitive ints for both keys and regular Objects for values. It is used primarily in the Job and JobList classes, but is general-purpose and can be used elsewhere if desired. It is much smaller and faster than using a java.util.Hashtable since you do not have to wrap the primitive type in an Integer object. The current hash is hardcoded as 4 (to keep the memory usage low) but could conceivably be adjusted in a constructor if needed. A valid key is any non-zero integer that can be used as an array index in Java. A valid value is any Object, including null. This class is appropriately synchronized and can be considered threadsafe. -final class JobHashtable implements Serializable -{ - static final long serialVersionUID = 5L; - private static final int HASH = 4; - final Object[][] values_ = new Object[HASH][]; - final int[][] keys_ = new int[HASH][]; - int size_ = 0; - - final void clear() - { - for (int i = 0; i < HASH; ++i) - { - values_[i] = null; - keys_[i] = null; - } - size_ = 0; - } - - final boolean contains(int key) - { - if (key == 0) return false; - int hash = key % HASH; - int[] keyChain = keys_[hash]; - if (keyChain == null) return false; - for (int i = 0; i < keyChain.length; ++i) - { - if (keyChain[i] == key) - { - return true; - } - } - return false; - } - - final Object get(int key) - { - if (key == 0) return null; - int hash = key % HASH; - synchronized (keys_) - { - int[] keyChain = keys_[hash]; - if (keyChain == null) return null; - for (int i = 0; i < keyChain.length; ++i) - { - if (keyChain[i] == key) - { - return values_[hash][i]; - } - } - } - return null; - } - - // Keys == 0 not allowed. - final void put(int key, Object value) - { - if (key == 0) return; - int hash = key % HASH; - synchronized (keys_) - { - Object[] valueChain = values_[hash]; - int[] keyChain = keys_[hash]; - if (keyChain == null) - { - keyChain = new int[] { key }; - valueChain = new Object[] { value }; - keys_[hash] = keyChain; - values_[hash] = valueChain; - ++size_; - return; - } - else - { - int len = keyChain.length; - for (int i = 0; i < len; ++i) - { - if (keyChain[i] == key) - { - valueChain[i] = value; - return; - } - if (keyChain[i] == 0) - { - keyChain[i] = key; - valueChain[i] = value; - ++size_; - return; - } - } - int[] newKeyChain = new int[len * 2]; - System.arraycopy(keyChain, 0, newKeyChain, 0, len); - Object[] newValueChain = new Object[len * 2]; - System.arraycopy(valueChain, 0, newValueChain, 0, len); - newKeyChain[len] = key; - newValueChain[len] = value; - keys_[hash] = newKeyChain; - values_[hash] = newValueChain; - ++size_; - } - } - } - - final Object remove(int key) - { - if (key == 0) return null; - int hash = key % HASH; - synchronized (keys_) - { - int[] keyChain = keys_[hash]; - if (keyChain == null) return null; - for (int i = 0; i < keyChain.length; ++i) - { - if (keyChain[i] == key) - { - // Remove the key and value, and collapse the chains. - Object value = values_[hash][i]; - int j; - for (j = i + 1; j < keyChain.length; ++j) - { - // Collapse chains. - keyChain[j - 1] = keyChain[j]; - values_[hash][j - 1] = values_[hash][j]; - if (keyChain[j] == 0) break; // Don't bother collapsing zeros. - } - // If key was in final or next-to-final slot, clean up final slot. - if (j == keyChain.length) - { - keyChain[j - 1] = 0; - values_[hash][j - 1] = null; - } - - --size_; - return value; - } - } - } - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JobList.java b/cvsroot/src/com/ibm/as400/access/JobList.java deleted file mode 100644 index 7d27892bc..000000000 --- a/cvsroot/src/com/ibm/as400/access/JobList.java +++ /dev/null @@ -1,1777 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JobList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.Serializable; -import java.util.Enumeration; -import java.util.Vector; - -/** - Represents a list of jobs on the system. By default, all jobs are selected. To filter the list, use the {@link #addJobSelectionCriteria addJobSelectionCriteria()} method. - @see com.ibm.as400.access.Job - **/ -public class JobList implements Serializable -{ - static final long serialVersionUID = 5L; - - /** - Constant indicating that all the jobs are returned. - @deprecated Use the selection constant that corresponds to the particular job selection criteria you are filtering. For example, to select jobs for all job names, do: - - JobList list = new JobList(system); - list.addJobSelectionCriteria(JobList.SELECTION_JOB_NAME, JobList.SELECTION_JOB_NAME_ALL); - - For backwards compatibility, this has the same effect: - - JobList list = new JobList(system); - list.setName(JobList.SELECTION_JOB_NAME_ALL); - - **/ - public static final String ALL = "*ALL"; - - /** - Selection type used for job selection based on job name. Only one selection value is allowed for this selection type. The selection value corresponding to this selection type is a String. Possible values are: -
      -
    • A specific job name. -
    • A generic name. -
    • {@link #SELECTION_JOB_NAME_ALL SELECTION_JOB_NAME_ALL} -
    • {@link #SELECTION_JOB_NAME_CURRENT SELECTION_JOB_NAME_CURRENT} -
    • {@link #SELECTION_JOB_NAME_ONLY SELECTION_JOB_NAME_ONLY} -
    - The default is {@link #SELECTION_JOB_NAME_ALL SELECTION_JOB_NAME_ALL}. - @see #setName - @see com.ibm.as400.access.Job#JOB_NAME - **/ - public static final int SELECTION_JOB_NAME = 1; - - /** - Selection value indicating all jobs will be selected regardless of the job name. The user name and job type fields must be specified. - @see #SELECTION_JOB_NAME - **/ - public static final String SELECTION_JOB_NAME_ALL = "*ALL"; - - /** - Selection value indicating all jobs with the current job's name will be selected. - @see #SELECTION_JOB_NAME - **/ - public static final String SELECTION_JOB_NAME_CURRENT = "*CURRENT"; - - /** - Selection value indicating only the job in which this program is running will be selected. The user name and job type fields must be blank. - @see #SELECTION_JOB_NAME - **/ - public static final String SELECTION_JOB_NAME_ONLY = "*"; - - /** - Selection type used for job selection based on user name. Only one selection value is allowed for this selection type. The selection value corresponding to this selection type is a String. Possible values are: -
      -
    • A specific user profile name. -
    • A generic name. -
    • {@link #SELECTION_USER_NAME_ALL SELECTION_USER_NAME_ALL} -
    • {@link #SELECTION_USER_NAME_CURRENT SELECTION_USER_NAME_CURRENT} -
    - The default is {@link #SELECTION_USER_NAME_ALL SELECTION_USER_NAME_ALL}. - @see #setUser - @see com.ibm.as400.access.Job#USER_NAME - **/ - public static final int SELECTION_USER_NAME = 2; - - /** - Selection value indicating all jobs that use the specified job name will be selected, regardless of the user name. The job name and job number fields must be specified. - @see #SELECTION_USER_NAME - **/ - public static final String SELECTION_USER_NAME_ALL = "*ALL"; - - /** - Selection value indicating all jobs that use the current job's user profile will be selected. - @see #SELECTION_USER_NAME - **/ - public static final String SELECTION_USER_NAME_CURRENT = "*CURRENT"; - - /** - Selection type used for job selection based on job number. Only one selection value is allowed for this selection type. The selection value corresponding to this selection type is a String. Possible values are: -
      -
    • A specific job number. -
    • {@link #SELECTION_JOB_NUMBER_ALL SELECTION_JOB_NUMBER_ALL} -
    - The default is {@link #SELECTION_JOB_NUMBER_ALL SELECTION_JOB_NUMBER_ALL}. - @see #setNumber - @see com.ibm.as400.access.Job#JOB_NUMBER - **/ - public static final int SELECTION_JOB_NUMBER = 3; - - /** - Selection value indicating all jobs with the specified job name and user name will be selected, regardless of the job number. The job name and user name fields must be specified. - @see #SELECTION_JOB_NUMBER - **/ - public static final String SELECTION_JOB_NUMBER_ALL = "*ALL"; - - /** - Selection type used for job selection based on job type. Only one selection value is allowed for this selection type. The selection value corresponding to this selection type is a String. Possible values are: -
      -
    • {@link #SELECTION_JOB_TYPE_ALL SELECTION_JOB_TYPE_ALL} -
    • One of the following job types: -
        -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_AUTOSTART Job.JOB_TYPE_AUTOSTART} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_BATCH Job.JOB_TYPE_BATCH} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_INTERACTIVE Job.JOB_TYPE_INTERACTIVE} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_SUBSYSTEM_MONITOR Job.JOB_TYPE_SUBSYSTEM_MONITOR} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_SPOOLED_READER Job.JOB_TYPE_SPOOLED_READER} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_SYSTEM Job.JOB_TYPE_SYSTEM} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_SPOOLED_WRITER Job.JOB_TYPE_SPOOLED_WRITER} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_SCPF_SYSTEM Job.JOB_TYPE_SCPF_SYSTEM} -
      -
    - The default is {@link #SELECTION_JOB_TYPE_ALL SELECTION_JOB_TYPE_ALL}. - @see com.ibm.as400.access.Job#JOB_TYPE - **/ - public static final int SELECTION_JOB_TYPE = 4; - - /** - Selection value indicating all job types will be selected. - @see #SELECTION_JOB_TYPE - **/ - public static final String SELECTION_JOB_TYPE_ALL = "*"; - - /** - Selection type used for job selection based on primary job status. Only one selection value is allowed for this selection type. The selection value corresponding to this selection type is a Boolean. The default is true. - @see com.ibm.as400.access.Job#JOB_STATUS - **/ - public static final int SELECTION_PRIMARY_JOB_STATUS_ACTIVE = 5; - - /** - Selection type used for job selection based on primary job status. Only one selection value is allowed for this selection type. The selection value corresponding to this selection type is a Boolean. The default is true. - @see com.ibm.as400.access.Job#JOB_STATUS - **/ - public static final int SELECTION_PRIMARY_JOB_STATUS_JOBQ = 6; - - /** - Selection type used for job selection based on primary job status. Only one selection value is allowed for this selection type. The selection value corresponding to this selection type is a Boolean. The default is true. - @see com.ibm.as400.access.Job#JOB_STATUS - **/ - public static final int SELECTION_PRIMARY_JOB_STATUS_OUTQ = 7; - - /** - Selection type used for job selection based on active job status. Multiple selection values are allowed for this selection type. The selection value corresponding to this selection type is a String. See {@link com.ibm.as400.access.Job#ACTIVE_JOB_STATUS Job.ACTIVE_JOB_STATUS} for allowed values. By default no selection values are specified for this selection type. This value is only used when the value for SELECTION_PRIMARY_JOB_STATUS_ACTIVE is true. - @see #SELECTION_PRIMARY_JOB_STATUS_ACTIVE - @see com.ibm.as400.access.Job#ACTIVE_JOB_STATUS - **/ - public static final int SELECTION_ACTIVE_JOB_STATUS = 8; - - /** - Selection type used for job selection based on a job's status on the job queue. Only one selection value is allowed for this selection type. The selection value corresponding to this selection type is a Boolean. The default is true. This value is only used when the value for SELECTION_PRIMARY_JOB_STATUS_JOBQ is true. - @see #SELECTION_PRIMARY_JOB_STATUS_JOBQ - @see com.ibm.as400.access.Job#JOB_QUEUE_STATUS - **/ - public static final int SELECTION_JOB_QUEUE_STATUS_SCHEDULE = 9; - - /** - Selection type used for job selection based on a job's status on the job queue. Only one selection value is allowed for this selection type. The selection value corresponding to this selection type is a Boolean. The default is true. This value is only used when the value for SELECTION_PRIMARY_JOB_STATUS_JOBQ is true. - @see #SELECTION_PRIMARY_JOB_STATUS_JOBQ - @see com.ibm.as400.access.Job#JOB_QUEUE_STATUS - **/ - public static final int SELECTION_JOB_QUEUE_STATUS_HELD = 10; - - /** - Selection type used for job selection based on a job's status on the job queue. Only one selection value is allowed for this selection type. The selection value corresponding to this selection type is a Boolean. The default is true. This value is only used when the value for SELECTION_PRIMARY_JOB_STATUS_JOBQ is true. - @see #SELECTION_PRIMARY_JOB_STATUS_JOBQ - @see com.ibm.as400.access.Job#JOB_QUEUE_STATUS - **/ - public static final int SELECTION_JOB_QUEUE_STATUS_READY = 11; - - /** - Selection type used for job selection based on job queue. Multiple selection values are allowed for this selection type. The selection value corresponding to this selection type is a String representing the fully-qualified integrated file system name for a server job queue. By default no selection values are specified for this selection type. This value is only used when the value for SELECTION_PRIMARY_JOB_STATUS_JOBQ is true. - @see #SELECTION_PRIMARY_JOB_STATUS_JOBQ - @see com.ibm.as400.access.QSYSObjectPathName - @see com.ibm.as400.access.Job#JOB_QUEUE - **/ - public static final int SELECTION_JOB_QUEUE = 12; - - /** - Selection type used for job selection based on the user name for a job's initial thread. Multiple selection values are allowed for this selection type. The selection value corresponding to this selection type is a String. By default no selection values are specified for this selection type. - **/ - public static final int SELECTION_INITIAL_USER = 13; - - /** - Selection type used for job selection based on the server type. Multiple selection values are allowed for this selection type. The selection value corresponding to this selection type is a String. By default no selection values are specified for this selection type. Possible values are: -
      -
    • A server type. See {@link com.ibm.as400.access.Job#SERVER_TYPE Job.SERVER_TYPE}. -
    • A generic value. -
    • {@link #SELECTION_SERVER_TYPE_ALL SELECTION_SERVER_TYPE_ALL} -
    • {@link #SELECTION_SERVER_TYPE_BLANK SELECTION_SERVER_TYPE_BLANK} -
    - @see com.ibm.as400.access.Job#SERVER_TYPE - **/ - public static final int SELECTION_SERVER_TYPE = 14; - - /** - Selection value indicating all jobs with a server type will be selected. - @see #SELECTION_SERVER_TYPE - **/ - public static final String SELECTION_SERVER_TYPE_ALL = "*ALL"; - - /** - Selection value indicating all jobs without a server type will be selected. - @see #SELECTION_SERVER_TYPE - **/ - public static final String SELECTION_SERVER_TYPE_BLANK = "*BLANK"; - - //public static final int ACTIVE_SUBSYSTEM = 15; - //public static final int MEMORY_POOL = 16; - - /** - Selection type used for job selection based on the enhanced job type. Multiple selection values are allowed for this selection type. The selection value corresponding to this selection type is an Integer. By default no selection values are specified for this selection type. Possible values are: -
      -
    • {@link #SELECTION_JOB_TYPE_ENHANCED_ALL_BATCH SELECTION_JOB_TYPE_ENHANCED_ALL_BATCH} -
    • {@link #SELECTION_JOB_TYPE_ENHANCED_ALL_INTERACTIVE SELECTION_JOB_TYPE_ENHANCED_ALL_INTERACTIVE} -
    • {@link #SELECTION_JOB_TYPE_ENHANCED_ALL_PRESTART SELECTION_JOB_TYPE_ENHANCED_ALL_PRESTART} -
    • Any of the enhanced job types: -
        -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_AUTOSTART Job.JOB_TYPE_ENHANCED_AUTOSTART} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_BATCH Job.JOB_TYPE_ENHANCED_BATCH} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_BATCH_IMMEDIATE Job.JOB_TYPE_ENHANCED_BATCH_IMMEDIATE} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_BATCH_MRT Job.JOB_TYPE_ENHANCED_BATCH_MRT} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_BATCH_ALTERNATE_SPOOL_USER Job.JOB_TYPE_ENHANCED_BATCH_ALTERNATE_SPOOL_USER} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_COMM_PROCEDURE_START_REQUEST Job.JOB_TYPE_ENHANCED_COMM_PROCEDURE_START_REQUEST} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_INTERACTIVE Job.JOB_TYPE_ENHANCED_INTERACTIVE} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_INTERACTIVE_GROUP Job.JOB_TYPE_ENHANCED_INTERACTIVE_GROUP} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_INTERACTIVE_SYSREQ Job.JOB_TYPE_ENHANCED_INTERACTIVE_SYSREQ} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_INTERACTIVE_SYSREQ_AND_GROUP Job.JOB_TYPE_ENHANCED_INTERACTIVE_SYSREQ_AND_GROUP} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_PRESTART Job.JOB_TYPE_ENHANCED_PRESTART} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_PRESTART_BATCH Job.JOB_TYPE_ENHANCED_PRESTART_BATCH} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_PRESTART_COMM Job.JOB_TYPE_ENHANCED_PRESTART_COMM} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_READER Job.JOB_TYPE_ENHANCED_READER} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_SUBSYSTEM Job.JOB_TYPE_ENHANCED_SUBSYSTEM} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_SYSTEM Job.JOB_TYPE_ENHANCED_SYSTEM} -
      • {@link com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_WRITER Job.JOB_TYPE_ENHANCED_WRITER} -
      -
    - @see com.ibm.as400.access.Job#JOB_TYPE_ENHANCED - **/ - public static final int SELECTION_JOB_TYPE_ENHANCED = 17; - - /** - Selection value indicating all the batch job types will be selected. - @see #SELECTION_JOB_TYPE_ENHANCED - @see com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_BATCH - @see com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_BATCH_IMMEDIATE - @see com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_BATCH_MRT - @see com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_BATCH_ALTERNATE_SPOOL_USER - **/ - public static final Integer SELECTION_JOB_TYPE_ENHANCED_ALL_BATCH = new Integer(200); - - /** - Selection value indicating all the interactive job types will be selected. - @see #SELECTION_JOB_TYPE_ENHANCED - @see com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_INTERACTIVE - @see com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_INTERACTIVE_GROUP - @see com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_INTERACTIVE_SYSREQ - @see com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_INTERACTIVE_SYSREQ_AND_GROUP - **/ - public static final Integer SELECTION_JOB_TYPE_ENHANCED_ALL_INTERACTIVE = new Integer(900); - - /** - Selection value indicating all the prestart job types will be selected. - @see #SELECTION_JOB_TYPE_ENHANCED - @see com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_PRESTART - @see com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_PRESTART_BATCH - @see com.ibm.as400.access.Job#JOB_TYPE_ENHANCED_PRESTART_COMM - **/ - public static final Integer SELECTION_JOB_TYPE_ENHANCED_ALL_PRESTART = new Integer(1600); - - // Holds the lengths for all of the valid sort keys. - static final IntegerHashtable sortableKeys_ = new IntegerHashtable(); - static - { - sortableKeys_.put(Job.ACTIVE_JOB_STATUS, 4); - sortableKeys_.put(Job.ALLOW_MULTIPLE_THREADS, 1); - sortableKeys_.put(Job.ACTIVE_JOB_STATUS_FOR_JOBS_ENDING, 4); - sortableKeys_.put(Job.BREAK_MESSAGE_HANDLING, 10); - sortableKeys_.put(Job.CCSID, 4); // Binary - sortableKeys_.put(Job.COUNTRY_ID, 2); - sortableKeys_.put(Job.CPU_TIME_USED, 4); // Binary - sortableKeys_.put(Job.CURRENT_USER, 10); - sortableKeys_.put(Job.COMPLETION_STATUS, 1); - sortableKeys_.put(Job.CURRENT_SYSTEM_POOL_ID, 4); // Binary - sortableKeys_.put(Job.CHARACTER_ID_CONTROL, 10); - sortableKeys_.put(Job.CPU_TIME_USED_LARGE, 8); // Binary - sortableKeys_.put(Job.CPU_TIME_USED_FOR_DATABASE, 8); // Binary - sortableKeys_.put(Job.DATE_STARTED, 13); - sortableKeys_.put(Job.DATE_ENTERED_SYSTEM, 13); - sortableKeys_.put(Job.SCHEDULE_DATE_GETTER, 8); - sortableKeys_.put(Job.JOB_QUEUE_DATE, 8); - sortableKeys_.put(Job.DATE_FORMAT, 4); - sortableKeys_.put(Job.DATE_SEPARATOR, 1); - sortableKeys_.put(Job.DBCS_CAPABLE, 1); - sortableKeys_.put(Job.KEEP_DDM_CONNECTIONS_ACTIVE, 10); - sortableKeys_.put(Job.DEFAULT_WAIT_TIME, 4); // Binary - sortableKeys_.put(Job.DEVICE_RECOVERY_ACTION, 13); - sortableKeys_.put(Job.DEFAULT_CCSID, 4); // Binary - sortableKeys_.put(Job.DECIMAL_FORMAT, 1); - sortableKeys_.put(Job.DATE_ENDED, 13); - sortableKeys_.put(Job.END_SEVERITY, 4); // Binary - sortableKeys_.put(Job.CONTROLLED_END_REQUESTED, 1); - sortableKeys_.put(Job.FUNCTION_NAME, 10); - sortableKeys_.put(Job.FUNCTION_TYPE, 1); - sortableKeys_.put(Job.SIGNED_ON_JOB, 1); - sortableKeys_.put(Job.INQUIRY_MESSAGE_REPLY, 10); - sortableKeys_.put(Job.ACCOUNTING_CODE, 15); - sortableKeys_.put(Job.JOB_DATE, 7); - sortableKeys_.put(Job.JOB_DESCRIPTION, 20); - sortableKeys_.put(Job.JOB_QUEUE, 20); - sortableKeys_.put(Job.JOB_QUEUE_PRIORITY, 2); - sortableKeys_.put(Job.JOB_SWITCHES, 8); - sortableKeys_.put(Job.MESSAGE_QUEUE_ACTION, 10); - sortableKeys_.put(Job.MESSAGE_QUEUE_MAX_SIZE, 4); // Binary - sortableKeys_.put(Job.JOB_USER_IDENTITY, 10); - sortableKeys_.put(Job.JOB_USER_IDENTITY_SETTING, 1); - sortableKeys_.put(Job.JOB_END_REASON, 4); // Binary - sortableKeys_.put(Job.JOB_LOG_PENDING, 1); - sortableKeys_.put(Job.JOB_TYPE_ENHANCED, 4); // Binary - sortableKeys_.put(Job.JOB_LOG_OUTPUT, 10); - sortableKeys_.put(Job.LANGUAGE_ID, 3); - sortableKeys_.put(Job.LOGGING_LEVEL, 1); - sortableKeys_.put(Job.LOG_CL_PROGRAMS, 10); - sortableKeys_.put(Job.LOGGING_SEVERITY, 4); // Binary - sortableKeys_.put(Job.LOGGING_TEXT, 10); - sortableKeys_.put(Job.MODE, 8); - sortableKeys_.put(Job.MAX_CPU_TIME, 4); // Binary - sortableKeys_.put(Job.MAX_TEMP_STORAGE, 4); // Binary - sortableKeys_.put(Job.MAX_THREADS, 4); // Binary - sortableKeys_.put(Job.MAX_TEMP_STORAGE_LARGE, 4); // Binary - sortableKeys_.put(Job.MEMORY_POOL, 10); - sortableKeys_.put(Job.MESSAGE_REPLY, 1); - sortableKeys_.put(Job.AUXILIARY_IO_REQUESTS, 4); // Binary - sortableKeys_.put(Job.INTERACTIVE_TRANSACTIONS, 4); // Binary - sortableKeys_.put(Job.AUXILIARY_IO_REQUESTS_LARGE, 8); // Binary - sortableKeys_.put(Job.OUTPUT_QUEUE, 20); - sortableKeys_.put(Job.OUTPUT_QUEUE_PRIORITY, 2); - sortableKeys_.put(Job.PRINT_KEY_FORMAT, 10); - sortableKeys_.put(Job.PRINT_TEXT, 30); - sortableKeys_.put(Job.PRINTER_DEVICE_NAME, 10); - sortableKeys_.put(Job.ELIGIBLE_FOR_PURGE, 10); - sortableKeys_.put(Job.PRODUCT_RETURN_CODE, 4); // Binary - sortableKeys_.put(Job.PROGRAM_RETURN_CODE, 4); // Binary - sortableKeys_.put(Job.TOTAL_RESPONSE_TIME, 4); // Binary - sortableKeys_.put(Job.RUN_PRIORITY, 4); // Binary - sortableKeys_.put(Job.ROUTING_DATA, 80); - sortableKeys_.put(Job.SORT_SEQUENCE_TABLE, 20); - sortableKeys_.put(Job.STATUS_MESSAGE_HANDLING, 10); - sortableKeys_.put(Job.JOB_QUEUE_STATUS, 10); - sortableKeys_.put(Job.SUBMITTED_BY_JOB_NAME, 26); - sortableKeys_.put(Job.SUBSYSTEM, 20); - sortableKeys_.put(Job.SYSTEM_POOL_ID, 4); // Binary - sortableKeys_.put(Job.SPECIAL_ENVIRONMENT, 10); - sortableKeys_.put(Job.SERVER_TYPE, 30); - sortableKeys_.put(Job.SPOOLED_FILE_ACTION, 10); - sortableKeys_.put(Job.TIME_SEPARATOR, 1); - sortableKeys_.put(Job.TIME_SLICE, 4); // Binary - sortableKeys_.put(Job.TIME_SLICE_END_POOL, 10); - sortableKeys_.put(Job.TEMP_STORAGE_USED, 4); // Binary - sortableKeys_.put(Job.THREAD_COUNT, 4); // Binary - sortableKeys_.put(Job.TEMP_STORAGE_USED_LARGE, 4); // Binary - sortableKeys_.put(Job.UNIT_OF_WORK_ID, 24); - sortableKeys_.put(Job.USER_RETURN_CODE, 4); // Binary - } - - // The system where the jobs are located. - private AS400 system_; - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_ = null; // Set on first add. - // List of vetoable change event bean listeners. - private transient VetoableChangeSupport vetoableChangeListeners_ = null; // Set on first add. - - // Selection variables. - private String selectionJobName_ = SELECTION_JOB_NAME_ALL; - private String selectionUserName_ = SELECTION_USER_NAME_ALL; - private String selectionJobNumber_ = SELECTION_JOB_NUMBER_ALL; - private String selectionJobType_ = SELECTION_JOB_TYPE_ALL; - private boolean selectActiveJobs_ = true; - private boolean selectJobQueueJobs_ = true; - private boolean selectOutQueueJobs_ = true; - private String[] activeStatuses_ = new String[1]; - private int currentActiveStatus_ = 0; - private boolean selectHeldJobs_ = true; - private boolean selectScheduledJobs_ = true; - private boolean selectReadyJobs_ = true; - private String[] jobQueues_ = new String[1]; - private int currentJobQueue_ = 0; - private String[] initialUsers_ = new String[1]; - private int currentInitialUser_ = 0; - private String[] serverTypes_ = new String[1]; - private int currentServerType_ = 0; - private int[] enhancedJobTypes_ = new int[1]; - private int currentEnhancedJobType_ = 0; - - // Length of the job list. - private int length_; - // Length of each record in job list. - private int recordLength_; - // Handle that references the user space used by the open list APIs. - private byte[] handle_; - // If the list info has changed, close the old handle before loading the new one. - private boolean closeHandle_ = false; - - // Info saved between calls to load() and getJobs(). - private int numKeysReturned_; - private int[] keyFieldsReturned_; - private char[] keyTypesReturned_; - private int[] keyLengthsReturned_; - private int[] keyOffsetsReturned_; - - // Keys to pre-load. - private int currentKey_ = 0; - private int[] keys_ = new int[1]; - - // Sort keys. - private int currentSortKey_ = 0; - private int[] sortKeys_ = new int[1]; - private boolean[] sortOrders_ = new boolean[1]; - - // Used to determine if there are open Enumerations still using us. - private Vector trackers_; - - /** - Constructs a JobList object. The system must be set before retrieving the list of jobs. - @see #setSystem - **/ - public JobList() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing JobList object."); - } - - /** - Constructs a JobList object. - @param system The system object representing the system on which the jobs exist. - **/ - public JobList(AS400 system) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing JobList object, system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - system_ = system; - } - - /** - Adds a job attribute that will be retrieved for each job in this job list. This method allows the Job objects that are retrieved from this JobList to have some of their attributes already filled in, so that a call to {@link com.ibm.as400.access.Job#getValue Job.getValue()} does not result in another API call back to the system for each job in the list. -

    The list of job attributes is maintained internally even when this JobList is closed and re-used. To start over with a new set of job attributes to retrieve, call {@link #clearJobAttributesToRetrieve clearJobAttributesToRetrieve()}. - @param attribute The job attribute to retrieve. Possible values are all job attributes contained in the {@link com.ibm.as400.access.Job Job} class, excluding the following: -

      -
    • Job.CLIENT_IP_ADDRESS -
    • Job.CURRENT_LIBRARY -
    • Job.CURRENT_LIBRARY_EXISTENCE -
    • Job.ELAPSED_CPU_PERCENT_USED -
    • Job.ELAPSED_CPU_PERCENT_USED_FOR_DATABASE -
    • Job.ELAPSED_CPU_TIME_USED -
    • Job.ELAPSED_CPU_TIME_USED_FOR_DATABASE -
    • Job.ELAPSED_DISK_IO -
    • Job.ELAPSED_DISK_IO_ASYNCH -
    • Job.ELAPSED_DISK_IO_SYNCH -
    • Job.ELAPSED_INTERACTIVE_RESPONSE_TIME -
    • Job.ELAPSED_INTERACTIVE_TRANSACTIONS -
    • Job.ELAPSED_LOCK_WAIT_TIME -
    • Job.ELAPSED_PAGE_FAULTS -
    • Job.ELAPSED_TIME -
    • Job.PRODUCT_LIBRARIES -
    • Job.SUBMITTED_BY_JOB_NUMBER -
    • Job.SUBMITTED_BY_USER -
    • Job.SYSTEM_LIBRARY_LIST -
    • Job.USER_LIBRARY_LIST -
    - To retrieve any of the ELAPSED statistics, use the {@link com.ibm.as400.access.Job#resetStatistics Job.resetStatistics()} and {@link com.ibm.as400.access.Job#loadStatistics Job.loadStatistics()} methods. - @see #clearJobAttributesToRetrieve - @see com.ibm.as400.access.Job - **/ - public void addJobAttributeToRetrieve(int attribute) - { - if (attribute < 101) - { - Trace.log(Trace.ERROR, "Value of parameter 'attribute' is not valid: " + attribute); - throw new ExtendedIllegalArgumentException("attribute", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - switch (attribute) - { - // These are always loaded, so it is unnecessary to try and preload them. - case Job.JOB_NAME: - case Job.USER_NAME: - case Job.JOB_NUMBER: - case Job.JOB_TYPE: - case Job.JOB_SUBTYPE: - case Job.JOB_STATUS: - case Job.INTERNAL_JOB_ID: - case Job.INTERNAL_JOB_IDENTIFIER: - return; - // These cannot be retrieved this way. You have to make another call to the QUSRJOBI API to get them. - case Job.CURRENT_LIBRARY: - case Job.CURRENT_LIBRARY_EXISTENCE: - case Job.ELAPSED_CPU_PERCENT_USED: - case Job.ELAPSED_CPU_PERCENT_USED_FOR_DATABASE: - case Job.ELAPSED_CPU_TIME_USED: - case Job.ELAPSED_CPU_TIME_USED_FOR_DATABASE: - case Job.ELAPSED_DISK_IO: - case Job.ELAPSED_DISK_IO_ASYNCH: - case Job.ELAPSED_DISK_IO_SYNCH: - case Job.ELAPSED_INTERACTIVE_RESPONSE_TIME: - case Job.ELAPSED_INTERACTIVE_TRANSACTIONS: - case Job.ELAPSED_LOCK_WAIT_TIME: - case Job.ELAPSED_PAGE_FAULTS: - case Job.ELAPSED_TIME: - case Job.PRODUCT_LIBRARIES: - case Job.SUBMITTED_BY_JOB_NUMBER: - case Job.SUBMITTED_BY_USER: - case Job.SYSTEM_LIBRARY_LIST: - case Job.USER_LIBRARY_LIST: - Trace.log(Trace.ERROR, "Value of parameter 'attribute' is not valid: " + attribute); - throw new ExtendedIllegalArgumentException("attribute", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // The date and time have different key values for getting and setting. - case Job.SCHEDULE_DATE: - case Job.SCHEDULE_TIME: - attribute = Job.SCHEDULE_DATE_GETTER; - break; - case Job.INSTANCE: - case Job.LOCATION_NAME: - case Job.NETWORK_ID: - case Job.SEQUENCE_NUMBER: - attribute = Job.UNIT_OF_WORK_ID; - break; - default: - break; - } - - if (currentKey_ >= keys_.length) - { - // Resize. - int[] temp = keys_; - keys_ = new int[temp.length * 2]; - System.arraycopy(temp, 0, keys_, 0, temp.length); - } - - keys_[currentKey_++] = attribute; - synchronized (this) - { - if (handle_ != null) closeHandle_ = true; - } - } - - /** - Adds a job attribute used to sort the list. -

    The list of job attributes to sort on is maintained internally even when this JobList is closed and re-used. To start over with a new set of job attributes to sort on, call {@link #clearJobAttributesToSortOn clearJobAttributesToSortOn()}. - @param attribute The job attribute on which to sort. Possible values are all job attributes contained in the {@link com.ibm.as400.access.Job Job} class, excluding the following: -

      -
    • Job.CLIENT_IP_ADDRESS -
    • Job.CURRENT_LIBRARY -
    • Job.CURRENT_LIBRARY_EXISTENCE -
    • Job.ELAPSED_CPU_PERCENT_USED -
    • Job.ELAPSED_CPU_PERCENT_USED_FOR_DATABASE -
    • Job.ELAPSED_CPU_TIME_USED -
    • Job.ELAPSED_CPU_TIME_USED_FOR_DATABASE -
    • Job.ELAPSED_DISK_IO -
    • Job.ELAPSED_DISK_IO_ASYNCH -
    • Job.ELAPSED_DISK_IO_SYNCH -
    • Job.ELAPSED_INTERACTIVE_RESPONSE_TIME -
    • Job.ELAPSED_INTERACTIVE_TRANSACTIONS -
    • Job.ELAPSED_LOCK_WAIT_TIME -
    • Job.ELAPSED_PAGE_FAULTS -
    • Job.ELAPSED_TIME -
    • Job.PRODUCT_LIBRARIES -
    • Job.SUBMITTED_BY_JOB_NUMBER -
    • Job.SUBMITTED_BY_USER -
    • Job.SYSTEM_LIBRARY_LIST -
    • Job.USER_LIBRARY_LIST -
    - @param sortOrder true to sort ascending; false to sort descending. - @see #clearJobAttributesToSortOn - @see com.ibm.as400.access.Job - **/ - public void addJobAttributeToSortOn(int attribute, boolean sortOrder) - { - if (attribute < 101) - { - Trace.log(Trace.ERROR, "Value of parameter 'attribute' is not valid: " + attribute); - throw new ExtendedIllegalArgumentException("attribute", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - switch (attribute) - { - // These cannot be retrieved this way. You have to make another call to the QUSRJOBI API to get them. - case Job.CURRENT_LIBRARY: - case Job.CURRENT_LIBRARY_EXISTENCE: - case Job.ELAPSED_CPU_PERCENT_USED: - case Job.ELAPSED_CPU_PERCENT_USED_FOR_DATABASE: - case Job.ELAPSED_CPU_TIME_USED: - case Job.ELAPSED_CPU_TIME_USED_FOR_DATABASE: - case Job.ELAPSED_DISK_IO: - case Job.ELAPSED_DISK_IO_ASYNCH: - case Job.ELAPSED_DISK_IO_SYNCH: - case Job.ELAPSED_INTERACTIVE_RESPONSE_TIME: - case Job.ELAPSED_INTERACTIVE_TRANSACTIONS: - case Job.ELAPSED_LOCK_WAIT_TIME: - case Job.ELAPSED_PAGE_FAULTS: - case Job.ELAPSED_TIME: - case Job.PRODUCT_LIBRARIES: - case Job.SUBMITTED_BY_JOB_NUMBER: - case Job.SUBMITTED_BY_USER: - case Job.SYSTEM_LIBRARY_LIST: - case Job.USER_LIBRARY_LIST: - Trace.log(Trace.ERROR, "Value of parameter 'attribute' is not valid: " + attribute); - throw new ExtendedIllegalArgumentException("attribute", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // The date and time have different key values for getting and setting. - // case Job.SCHEDULE_DATE: - // case Job.SCHEDULE_TIME: - // attribute = Job.SCHEDULE_DATE_GETTER; - // break; - default: - break; - } - - if (currentSortKey_ >= sortKeys_.length) - { - int[] temp = sortKeys_; - sortKeys_ = new int[temp.length * 2]; - System.arraycopy(temp, 0, sortKeys_, 0, temp.length); - boolean[] tempSort = sortOrders_; - sortOrders_ = new boolean[tempSort.length * 2]; - System.arraycopy(tempSort, 0, sortOrders_, 0, tempSort.length); - } - sortKeys_[currentSortKey_] = attribute; - sortOrders_[currentSortKey_++] = sortOrder; - synchronized (this) - { - if (handle_ != null) closeHandle_ = true; - } - } - - /** - Adds a selection type and value to be used to filter the list of jobs. If a selection type supports only one value, then the selection value used will be the one that was passed on the most recent call to this method for that selection type. -

    By default, all jobs are selected, because most of the filter criteria settings default to true. To filter the list further, the job selection criteria should be set to false. For example, to retrieve a list of only active jobs, you would do: -

    -     JobList list = new JobList(system);
    -     list.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_ACTIVE, Boolean.TRUE);
    -     list.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_JOBQ, Boolean.FALSE);
    -     list.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_OUTQ, Boolean.FALSE);
    -     Enumeration jobs = list.getJobs();
    -     
    -

    The list of job selection criteria is maintained internally even when this JobList is closed and re-used. To start over with a new set of job selection criteria, call {@link #clearJobSelectionCriteria clearJobSelectionCriteria()}. - @param selectionType The constant indicating which selection type used to filter the list. Possible values are: -

      -
    • {@link #SELECTION_JOB_NAME SELECTION_JOB_NAME} -
    • {@link #SELECTION_USER_NAME SELECTION_USER_NAME} -
    • {@link #SELECTION_JOB_NUMBER SELECTION_JOB_NUMBER} -
    • {@link #SELECTION_JOB_TYPE SELECTION_JOB_TYPE} -
    • {@link #SELECTION_PRIMARY_JOB_STATUS_ACTIVE SELECTION_PRIMARY_JOB_STATUS_ACTIVE} -
    • {@link #SELECTION_PRIMARY_JOB_STATUS_JOBQ SELECTION_PRIMARY_JOB_STATUS_JOBQ} -
    • {@link #SELECTION_PRIMARY_JOB_STATUS_OUTQ SELECTION_PRIMARY_JOB_STATUS_OUTQ} -
    • {@link #SELECTION_ACTIVE_JOB_STATUS SELECTION_ACTIVE_JOB_STATUS} -
    • {@link #SELECTION_JOB_QUEUE_STATUS_SCHEDULE SELECTION_JOB_QUEUE_STATUS_SCHEDULE} -
    • {@link #SELECTION_JOB_QUEUE_STATUS_READY SELECTION_JOB_QUEUE_STATUS_READY} -
    • {@link #SELECTION_JOB_QUEUE_STATUS_HELD SELECTION_JOB_QUEUE_STATUS_HELD} -
    • {@link #SELECTION_JOB_QUEUE SELECTION_JOB_QUEUE} -
    • {@link #SELECTION_INITIAL_USER SELECTION_INITIAL_USER} -
    • {@link #SELECTION_SERVER_TYPE SELECTION_SERVER_TYPE} -
    • {@link #SELECTION_JOB_TYPE_ENHANCED SELECTION_JOB_TYPE_ENHANCED} -
    - @param selectionValue The value for the selection type. See the individual selection type constants for the appropriate object or constant to use. Some selection types allow multiple selection values to be added. - @see #clearJobSelectionCriteria - @see com.ibm.as400.access.Job - **/ - public void addJobSelectionCriteria(int selectionType, Object selectionValue) throws PropertyVetoException - { - if (selectionValue == null) - { - Trace.log(Trace.ERROR, "Parameter 'selectionValue' is null."); - throw new NullPointerException("selectionValue"); - } - - switch (selectionType) - { - case SELECTION_JOB_NAME: - setName((String)selectionValue); - break; - case SELECTION_USER_NAME: - setUser((String)selectionValue); - break; - case SELECTION_JOB_NUMBER: - setNumber((String)selectionValue); - break; - case SELECTION_JOB_TYPE: - selectionJobType_ = ((String)selectionValue).toUpperCase(); - break; - case SELECTION_PRIMARY_JOB_STATUS_ACTIVE: - selectActiveJobs_ = ((Boolean)selectionValue).booleanValue(); - break; - case SELECTION_PRIMARY_JOB_STATUS_JOBQ: - selectJobQueueJobs_ = ((Boolean)selectionValue).booleanValue(); - break; - case SELECTION_PRIMARY_JOB_STATUS_OUTQ: - selectOutQueueJobs_ = ((Boolean)selectionValue).booleanValue(); - break; - case SELECTION_ACTIVE_JOB_STATUS: - String status = ((String)selectionValue).toUpperCase(); - if (currentActiveStatus_ >= activeStatuses_.length) //JTOpen Bug 1728765 - { - String[] temp = activeStatuses_; - activeStatuses_ = new String[temp.length * 2]; - System.arraycopy(temp, 0, activeStatuses_, 0, temp.length); - } - activeStatuses_[currentActiveStatus_++] = status; - break; - case SELECTION_JOB_QUEUE_STATUS_SCHEDULE: - selectScheduledJobs_ = ((Boolean)selectionValue).booleanValue(); - break; - case SELECTION_JOB_QUEUE_STATUS_HELD: - selectHeldJobs_ = ((Boolean)selectionValue).booleanValue(); - break; - case SELECTION_JOB_QUEUE_STATUS_READY: - selectReadyJobs_ = ((Boolean)selectionValue).booleanValue(); - break; - case SELECTION_JOB_QUEUE: - String queue = (String)selectionValue; - QSYSObjectPathName path = new QSYSObjectPathName(queue); - StringBuffer buf = new StringBuffer(); - String name = path.getObjectName(); - buf.append(name); - for (int i = name.length(); i < 10; ++i) - { - buf.append(' '); - } - String lib = path.getLibraryName(); - buf.append(lib); - - if (currentJobQueue_ >= jobQueues_.length) //JTOpen Bug 1728765 - { - String[] temp = jobQueues_; - jobQueues_ = new String[temp.length * 2]; - System.arraycopy(temp, 0, jobQueues_, 0, temp.length); - } - jobQueues_[currentJobQueue_++] = buf.toString(); - break; - case SELECTION_INITIAL_USER: - String profile = ((String)selectionValue).toUpperCase(); - if (currentInitialUser_ >= initialUsers_.length) //JTOpen Bug 1728765 - { - String[] temp = initialUsers_; - initialUsers_ = new String[temp.length * 2]; - System.arraycopy(temp, 0, initialUsers_, 0, temp.length); - } - initialUsers_[currentInitialUser_++] = profile; - break; - case SELECTION_SERVER_TYPE: - String type = ((String)selectionValue).toUpperCase(); - if (currentServerType_ >= serverTypes_.length) //JTOpen Bug 1728765 - { - String[] temp = serverTypes_; - serverTypes_ = new String[temp.length * 2]; - System.arraycopy(temp, 0, serverTypes_, 0, temp.length); - } - serverTypes_[currentServerType_++] = type; - break; - case SELECTION_JOB_TYPE_ENHANCED: - int val = ((Integer)selectionValue).intValue(); - if (currentEnhancedJobType_ >= enhancedJobTypes_.length) //JTOpen Bug 1728765 - { - int[] temp = enhancedJobTypes_; - enhancedJobTypes_ = new int[temp.length * 2]; - System.arraycopy(temp, 0, enhancedJobTypes_, 0, temp.length); - } - enhancedJobTypes_[currentEnhancedJobType_++] = val; - break; - default: - Trace.log(Trace.ERROR, "Value of parameter 'selectionType' is not valid: " + selectionType); - throw new ExtendedIllegalArgumentException("selectionType", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - synchronized (this) - { - if (handle_ != null) closeHandle_ = true; - } - } - - /** - Clears the job attributes to be retrieved. This removes all of the job attributes that would be retrieved. Some attributes are always retrieved, regardless if they are in this list or not, such as job name, job number, and user name. - @see #addJobAttributeToRetrieve - **/ - public void clearJobAttributesToRetrieve() - { - currentKey_ = 0; - keys_ = new int[1]; - synchronized (this) - { - if (handle_ != null) closeHandle_ = true; - } - } - - /** - Clears the job attributes used to sort the list. This resets all of the job sort parameters to their default values. - @see #addJobAttributeToSortOn - **/ - public void clearJobAttributesToSortOn() - { - currentSortKey_ = 0; - sortKeys_ = new int[1]; - sortOrders_ = new boolean[1]; - synchronized (this) - { - if (handle_ != null) closeHandle_ = true; - } - } - - /** - Clears the selection types and values used to filter the list of jobs. This resets all of the job selection parameters to their default values. - @see #addJobSelectionCriteria - **/ - public void clearJobSelectionCriteria() throws PropertyVetoException - { - // In case someone wants to veto us. - setName(SELECTION_JOB_NAME_ALL); - setUser(SELECTION_USER_NAME_ALL); - setNumber(SELECTION_JOB_NUMBER_ALL); - - selectionJobType_ = SELECTION_JOB_TYPE_ALL; - selectActiveJobs_ = true; - selectJobQueueJobs_ = true; - selectOutQueueJobs_ = true; - activeStatuses_ = new String[1]; - currentActiveStatus_ = 0; - selectHeldJobs_ = true; - selectScheduledJobs_ = true; - selectReadyJobs_ = true; - jobQueues_ = new String[1]; - currentJobQueue_ = 0; - initialUsers_ = new String[1]; - currentInitialUser_ = 0; - serverTypes_ = new String[1]; - currentServerType_ = 0; - enhancedJobTypes_ = new int[1]; - currentEnhancedJobType_ = 0; - synchronized (this) - { - if (handle_ != null) closeHandle_ = true; - } - } - - /** - Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange() method will be called each time the value of any bound property is changed. - @param listener The listener. - @see #removePropertyChangeListener - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Adds a VetoableChangeListener. The specified VetoableChangeListener's vetoableChange() method will be called each time the value of any constrained property is changed. - @param listener The listener. - @see #removeVetoableChangeListener - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - } - - /** - Closes the job list on the system. This releases any system resources previously in use by this job list. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #load - **/ - public synchronized void close() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Closing job list, handle: ", handle_); - if (handle_ == null) return; - if (Trace.traceOn_) - { - if (trackers_ != null) - { - try - { - int inUse = 0; - for (int i = 0; i < trackers_.size(); ++i) - { - Tracker tracker = (Tracker)trackers_.elementAt(i); - if (tracker.isSet()) ++inUse; - // Force the Enumeration to shut down since the JobList is being closed. - tracker.set(false); - } - if (inUse > 0) - { - Trace.log(Trace.WARNING, "The job list on the server is possibly in use by " + inUse + " or more enumerations as a result of a call to JobList.getJobs()."); - } - } - catch (Throwable t) {} // ignore - } - } - - try { - ListUtilities.closeList(system_, handle_); - } - finally { - handle_ = null; - closeHandle_ = false; - } - } - - /** - Closes the list on the system when this object is garbage collected. - **/ - protected void finalize() throws Throwable - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Finalize method for job list invoked."); - if (handle_ != null) try { close(); } catch (Throwable t) {} - super.finalize(); - } - - /** - Returns an Enumeration that wraps the list of jobs on the system. This method calls {@link #load load()} implicitly if needed. The Enumeration retrieves jobs from the system in blocks as needed when nextElement() is called. This JobList should not be closed until the program is done processing elements out of the Enumeration. That is, this method does not retrieve all of the jobs from the system up front -- it retrieves them as needed, which allows for a lower memory footprint versus more calls to the system. The block size used internally by the Enumeration is set to 1000 jobs. - @return An Enumeration of {@link com.ibm.as400.access.Job Job} objects. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see com.ibm.as400.access.Job - **/ - public synchronized Enumeration getJobs() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving job list."); - // Need to get the length. - if (handle_ == null || closeHandle_) load(); - - // Use a tracker so we know if someone tries to close us, whether or not they have open Enumerations. It's possible they do, and they are just done with them, but this is mostly for debugging purposes. - Tracker tracker = new Tracker(); - - if (trackers_ == null) trackers_ = new Vector(); - trackers_.addElement(tracker); - - // Remove dead trackers to prevent a memory leak. JobEnumerations whose hasMoreElements() return false, or those who have been garbage collected, will all have freed their trackers. - for (int i = trackers_.size() - 1; i >= 0; --i) - { - Tracker t = (Tracker)trackers_.elementAt(i); - if (!t.isSet()) trackers_.removeElementAt(i); - } - - return new JobEnumeration(this, length_, tracker); - } - - /** - Returns a subset of the list of jobs in the job list. This method allows the user to retrieve the job list from the system in pieces. If a call to {@link #load load()} is made (either implicitly or explicitly), then the jobs at a given list offset will change, so a subsequent call to getJobs() with the same listOffset and number will most likely not return the same Jobs as the previous call. - @param listOffset The offset in the list of jobs (0-based). This value must be greater than or equal to 0 and less than the list length; or specify -1 to retrieve all of the jobs. - Note: Prior to JTOpen 7.2, this parameter was incorrectly described. - @param number The number of jobs to retrieve out of the list, starting at the specified listOffset. This value must be greater than or equal to 0 and less than or equal to the list length. If the listOffset is -1, this parameter is ignored. - @return The array of retrieved {@link com.ibm.as400.access.Job Job} objects. The length of this array may not necessarily be equal to number, depending upon the size of the list on the system, and the specified listOffset. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see com.ibm.as400.access.Job - **/ - public Job[] getJobs(int listOffset, int number) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving job list, list offset: " + listOffset + ", number:", number); - if (listOffset < -1) - { - throw new ExtendedIllegalArgumentException("listOffset (" + listOffset + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (number < 0 && listOffset != -1) - { - throw new ExtendedIllegalArgumentException("number (" + number + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (handle_ == null || closeHandle_) load(); // this sets the length_ variable - - if (length_ == 0 || (number == 0 && listOffset != -1)) { - return new Job[0]; - } - - if (listOffset == -1) - { - number = length_; // request entire list - listOffset = 0; // ... starting at beginning of list - } - else if (listOffset >= length_) - { - if (Trace.traceOn_) - Trace.log(Trace.WARNING, "Value of parameter 'listOffset' is beyond end of list:", listOffset + " (list length: " + length_ + ")"); - - return new Job[0]; - } - else if (listOffset + number > length_) - { - number = length_ - listOffset; - } - - int lengthOfReceiverVariable = recordLength_ * number; - - // Retrieve the entries in the list that was built by the most recent load(). - byte[] data = ListUtilities.retrieveListEntries(system_, handle_, lengthOfReceiverVariable, number, listOffset, null); - - Converter conv = new Converter(system_.getCcsid(), system_); - - Job[] jobs = new Job[number]; - for (int i = 0, offset = 0; i < jobs.length; ++i, offset += recordLength_) - { - String jobName = conv.byteArrayToString(data, offset, 10); - String userName = conv.byteArrayToString(data, offset + 10, 10); - String jobNumber = conv.byteArrayToString(data, offset + 20, 6); - String status = conv.byteArrayToString(data, offset + 42, 10); - String jobType = conv.byteArrayToString(data, offset + 52, 1); - String jobSubtype = conv.byteArrayToString(data, offset + 53, 1); - - jobs[i] = new Job(system_, jobName.trim(), userName.trim(), jobNumber.trim(), status, jobType, jobSubtype); - - for (int j = 0; j < numKeysReturned_; ++j) - { - int keyOffset = keyOffsetsReturned_[j]; - - if (keyTypesReturned_[j] == 'C') - { - String value = conv.byteArrayToString(data, offset + keyOffset, keyLengthsReturned_[j]); - jobs[i].setValueInternal(keyFieldsReturned_[j], value); - } - else - { - if (keyLengthsReturned_[j] > 4) - { - jobs[i].setAsLong(keyFieldsReturned_[j], BinaryConverter.byteArrayToLong(data, offset + keyOffset)); - } - else - { - jobs[i].setAsInt(keyFieldsReturned_[j], BinaryConverter.byteArrayToInt(data, offset + keyOffset)); - } - } - } - } - - return jobs; - } - - /** - Returns the number of jobs in the list. This method implicitly calls {@link #load load()} if it has not already been called. - @return The number of jobs, or 0 if no list was retrieved. - @see #load - **/ - public int getLength() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting job list length."); - try - { - if (handle_ == null || closeHandle_) load(); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Exception caught getting length of job list:", e); - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Length:", length_); - return length_; - } - - /** - Returns the job name that describes which jobs are returned. - @return The job name. - @see #setName - **/ - public String getName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting name: " + selectionJobName_); - return selectionJobName_; - } - - /** - Returns the job number that describes which jobs are returned. - @return The job number. - @see #setNumber - **/ - public String getNumber() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting number: " + selectionJobNumber_); - return selectionJobNumber_; - } - - /** - Returns the system object representing the system on which the jobs exist. - @return The system object representing the system on which the jobs exist. If the system has not been set, null is returned. - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - /** - Returns the user name that describes which jobs are returned. - @return The user name. - @see #setUser - **/ - public String getUser() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting user: " + selectionUserName_); - return selectionUserName_; - } - - /** - Loads the list of jobs on the system. This method informs the system to build a list of jobs given the previously added job attributes to select, retrieve, and sort. This method blocks until the system returns the total number of jobs it has compiled. A subsequent call to {@link #getJobs getJobs()} will retrieve the actual job information and attributes for each job in the list from the system. -

    This method updates the list length. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #getLength - **/ - public synchronized void load() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loading job list."); - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Close the previous list. - if (closeHandle_) close(); - - byte[] sortInformation = new byte[4 + currentSortKey_ * 12]; - BinaryConverter.intToByteArray(currentSortKey_, sortInformation, 0); - for (int i = 0, offset = 4; i < currentSortKey_; ++i) - { - int fieldLength = sortableKeys_.get(sortKeys_[i]); - short dataType = (short)4; // Data type 4 = character data, NLS-sort supported, DBCS treated as single-byte. - // We'll use 0 (signed binary) for all of the int types: - switch (sortKeys_[i]) - { - case Job.CCSID: - case Job.CPU_TIME_USED: - case Job.DEFAULT_WAIT_TIME: - case Job.END_SEVERITY: - case Job.MESSAGE_QUEUE_MAX_SIZE: - case Job.JOB_END_REASON: - case Job.JOB_TYPE_ENHANCED: - case Job.LOGGING_SEVERITY: - case Job.MAX_CPU_TIME: - case Job.MAX_TEMP_STORAGE: - //case Job.MAX_THREADS: - case Job.AUXILIARY_IO_REQUESTS: - case Job.INTERACTIVE_TRANSACTIONS: - //case Job.NUM_DATABASE_LOCK_WAITS: - //case Job.NUM_INTERNAL_MACHINE_LOCK_WAITS: - //case Job.NUM_NONDATABASE_LOCK_WAITS: - case Job.PRODUCT_RETURN_CODE: - case Job.PROGRAM_RETURN_CODE: - //case Job.PROCESS_ID: - case Job.TOTAL_RESPONSE_TIME: - case Job.RUN_PRIORITY: - case Job.SYSTEM_POOL_ID: - //case Job.SIGNAL_STATUS: - case Job.TIME_SLICE: - case Job.TEMP_STORAGE_USED: - case Job.USER_RETURN_CODE: - dataType = (short)0; // Signed binary. - fieldLength = 4; - break; - case Job.TEMP_STORAGE_USED_LARGE: - case Job.MAX_TEMP_STORAGE_LARGE: - dataType = (short)9; // Unsigned binary. - fieldLength = 4; - break; - case Job.CPU_TIME_USED_LARGE: - case Job.CPU_TIME_USED_FOR_DATABASE: - case Job.AUXILIARY_IO_REQUESTS_LARGE: - dataType = (short)9; // Unsigned binary. - fieldLength = 8; - break; - default: - //dataType = (short)4; - break; - } - - int fieldStartingPosition = 0; - //Sort key field starting position is one based. - switch (sortKeys_[i]) - { - case Job.JOB_NAME: - fieldStartingPosition = 1; - fieldLength = 10; - break; - case Job.USER_NAME: - fieldStartingPosition = 11; - fieldLength = 10; - break; - case Job.JOB_NUMBER: - fieldStartingPosition = 21; - fieldLength = 6; - break; - case Job.INTERNAL_JOB_ID: - case Job.INTERNAL_JOB_IDENTIFIER: - fieldStartingPosition = 27; - fieldLength = 16; - break; - case Job.JOB_STATUS: - fieldStartingPosition = 43; - fieldLength = 10; - break; - case Job.JOB_TYPE: - fieldStartingPosition = 53; - fieldLength = 1; - break; - case Job.JOB_SUBTYPE: - fieldStartingPosition = 54; - fieldLength = 1; - break; - default: - fieldStartingPosition = 61; //OLJB0200 format. - for (int j = 0; keys_[j] != sortKeys_[i]; ++j) - { - fieldStartingPosition += sortableKeys_.get(keys_[j]); - } - break; - } - BinaryConverter.intToByteArray(fieldStartingPosition, sortInformation, 4 + i * 12); - BinaryConverter.intToByteArray(fieldLength, sortInformation, 8 + i * 12); - BinaryConverter.shortToByteArray(dataType, sortInformation, 12 + i * 12); - // 0xF1 = ascending, 0xF2 = descending. - sortInformation[14 + i * 12] = sortOrders_[i] ? (byte)0xF1 : (byte)0xF2; - } - - // Figure out our selection criteria. - int numberOfPrimaryJobStatusEntries = (selectActiveJobs_ ? 1 : 0) + (selectJobQueueJobs_ ? 1 : 0) + (selectOutQueueJobs_ ? 1 : 0); - int numberOfJobsOnJobQueueStatusEntries = selectJobQueueJobs_ ? (selectHeldJobs_ ? 1 : 0) + (selectScheduledJobs_ ? 1 : 0) + (selectReadyJobs_ ? 1 : 0) : 0; - - byte[] jobSelectionInformation = new byte[108 + numberOfPrimaryJobStatusEntries * 10 + currentActiveStatus_ * 4 + numberOfJobsOnJobQueueStatusEntries * 10 + currentJobQueue_ * 20 + currentInitialUser_ * 10 + currentServerType_ * 30 + currentEnhancedJobType_ * 4]; - - // Generate text objects based on system CCSID. - Converter conv = new Converter(system_.getCcsid(), system_); - - for (int i = 0; i < 26; ++i) jobSelectionInformation[i] = 0x40; - conv.stringToByteArray(selectionJobName_.toUpperCase(), jobSelectionInformation, 0); - conv.stringToByteArray(selectionUserName_.toUpperCase(), jobSelectionInformation, 10); - conv.stringToByteArray(selectionJobNumber_, jobSelectionInformation, 20); - conv.stringToByteArray(selectionJobType_, jobSelectionInformation, 26); - - int offset = 108; - if (numberOfPrimaryJobStatusEntries > 0) - { - BinaryConverter.intToByteArray(offset, jobSelectionInformation, 28); - BinaryConverter.intToByteArray(numberOfPrimaryJobStatusEntries, jobSelectionInformation, 32); - if (selectActiveJobs_) - { - // EBCDIC '*ACTIVE'. - System.arraycopy(new byte[] { 0x5C, (byte)0xC1, (byte)0xC3, (byte)0xE3, (byte)0xC9, (byte)0xE5, (byte)0xC5, (byte)0x40, (byte)0x40, (byte)0x40 }, 0, jobSelectionInformation, offset, 10); - offset += 10; - } - if (selectJobQueueJobs_) - { - // EBCDIC '*JOBQ'. - System.arraycopy(new byte[] { 0x5C, (byte)0xD1, (byte)0xD6, (byte)0xC2, (byte)0xD8, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40 }, 0, jobSelectionInformation, offset, 10); - offset += 10; - } - if (selectOutQueueJobs_) - { - // EBCDIC '*OUTQ'. - System.arraycopy(new byte[] { 0x5C, (byte)0xD6, (byte)0xE4, (byte)0xE3, (byte)0xD8, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40 }, 0, jobSelectionInformation, offset, 10); - offset += 10; - } - } - if (currentActiveStatus_ > 0) - { - // Make sure ACTIVE_JOB_STATUS key is specified. - boolean foundKey = false; - for (int i = 0; i < currentKey_ && !foundKey; ++i) - { - if (keys_[i] == Job.ACTIVE_JOB_STATUS) - { - foundKey = true; - } - } - if (!foundKey) - { - addJobAttributeToRetrieve(Job.ACTIVE_JOB_STATUS); - } - - BinaryConverter.intToByteArray(offset, jobSelectionInformation, 36); - BinaryConverter.intToByteArray(currentActiveStatus_, jobSelectionInformation, 40); - for (int i = 0; i < currentActiveStatus_; ++i) - { - conv.stringToByteArray(activeStatuses_[i], jobSelectionInformation, offset, 4); - offset += 4; - } - } - if (numberOfJobsOnJobQueueStatusEntries > 0) - { - // Make sure JOB_QUEUE_STATUS key is specified. - boolean foundKey = false; - for (int i = 0; i < currentKey_ && !foundKey; ++i) - { - if (keys_[i] == Job.JOB_QUEUE_STATUS) - { - foundKey = true; - } - } - if (!foundKey) - { - addJobAttributeToRetrieve(Job.JOB_QUEUE_STATUS); - } - - BinaryConverter.intToByteArray(offset, jobSelectionInformation, 44); - BinaryConverter.intToByteArray(numberOfJobsOnJobQueueStatusEntries, jobSelectionInformation, 48); - if (selectHeldJobs_) - { - // EBCDIC 'HLD'. - System.arraycopy(new byte[] { (byte)0xC8, (byte)0xD3, (byte)0xC4, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40 }, 0, jobSelectionInformation, offset, 10); - offset += 10; - } - if (selectScheduledJobs_) - { - // EBCDIC 'SCD'. - System.arraycopy(new byte[] { (byte)0xE2, (byte)0xC3, (byte)0xC4, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40 }, 0, jobSelectionInformation, offset, 10); - offset += 10; - } - if (selectReadyJobs_) - { - // EBCDIC 'RLS'. - System.arraycopy(new byte[] { (byte)0xD9, (byte)0xD3, (byte)0xE2, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40 }, 0, jobSelectionInformation, offset, 10); - offset += 10; - } - } - if (currentJobQueue_ > 0) - { - // Make sure JOB_QUEUE key is specified. - boolean foundKey = false; - for (int i = 0; i < currentKey_ && !foundKey; ++i) - { - if (keys_[i] == Job.JOB_QUEUE) - { - foundKey = true; - } - } - if (!foundKey) - { - addJobAttributeToRetrieve(Job.JOB_QUEUE); - } - - BinaryConverter.intToByteArray(offset, jobSelectionInformation, 52); - BinaryConverter.intToByteArray(currentJobQueue_, jobSelectionInformation, 56); - for (int i = 0; i < currentJobQueue_; ++i) - { - for (int ii = 0; ii < 20; ++ii) jobSelectionInformation[ii + offset] = 0x40; - conv.stringToByteArray(jobQueues_[i], jobSelectionInformation, offset, 20); - offset += 20; - } - } - if (currentInitialUser_ > 0) - { - // Make sure CURRENT_USER key is specified. - boolean foundKey = false; - for (int i = 0; i < currentKey_ && !foundKey; ++i) - { - if (keys_[i] == Job.CURRENT_USER) - { - foundKey = true; - } - } - if (!foundKey) - { - addJobAttributeToRetrieve(Job.CURRENT_USER); - } - - BinaryConverter.intToByteArray(offset, jobSelectionInformation, 60); - BinaryConverter.intToByteArray(currentInitialUser_, jobSelectionInformation, 64); - for (int i = 0; i < currentInitialUser_; ++i) - { - for (int ii = 0; ii < 10; ++ii) jobSelectionInformation[ii + offset] = 0x40; - conv.stringToByteArray(initialUsers_[i], jobSelectionInformation, offset, 10); - offset += 10; - } - } - if (currentServerType_ > 0) - { - // Make sure SERVER_TYPE key is specified. - boolean foundKey = false; - for (int i = 0; i < currentKey_ && !foundKey; ++i) - { - if (keys_[i] == Job.SERVER_TYPE) - { - foundKey = true; - } - } - if (!foundKey) - { - addJobAttributeToRetrieve(Job.SERVER_TYPE); - } - - BinaryConverter.intToByteArray(offset, jobSelectionInformation, 68); - BinaryConverter.intToByteArray(currentServerType_, jobSelectionInformation, 72); - for (int i = 0; i < currentServerType_; ++i) - { - for (int ii = 0; ii < 30; ++ii) jobSelectionInformation[ii + offset] = 0x40; - conv.stringToByteArray(serverTypes_[i], jobSelectionInformation, offset, 30); - offset += 30; - } - } - if (currentEnhancedJobType_ > 0) - { - // Make sure JOB_TYPE_ENHANCED key is specified. - boolean foundKey = false; - for (int i = 0; i < currentKey_ && !foundKey; ++i) - { - if (keys_[i] == Job.JOB_TYPE_ENHANCED) - { - foundKey = true; - } - } - if (!foundKey) - { - addJobAttributeToRetrieve(Job.JOB_TYPE_ENHANCED); - } - - BinaryConverter.intToByteArray(offset, jobSelectionInformation, 92); - BinaryConverter.intToByteArray(currentEnhancedJobType_, jobSelectionInformation, 96); - for (int i = 0; i < currentEnhancedJobType_; ++i) - { - BinaryConverter.intToByteArray(enhancedJobTypes_[i], jobSelectionInformation, offset); - offset += 4; - } - } - - int lengthOfReceiverVariableDefinitionInformation = 4 + 20 * currentKey_; - - byte[] keyOfFieldsToBeReturned = new byte[4 * currentKey_]; - for (int i = 0; i < currentKey_; ++i) - { - BinaryConverter.intToByteArray(keys_[i], keyOfFieldsToBeReturned, i * 4); - } - - // Setup program parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Receiver variable, output, char(*). - new ProgramParameter(0), - // Length of receiver variable, input, binary(4). - new ProgramParameter(new byte[] { 0x00, 0x00, 0x00, 0x00 } ), - // Format name, input, char(8), EBCDIC 'OLJB0200'. - new ProgramParameter(new byte[] { (byte)0xD6, (byte)0xD3, (byte)0xD1, (byte)0xC2, (byte)0xF0, (byte)0xF2, (byte)0xF0, (byte)0xF0 } ), - // Receiver variable definition information, output, char(*). - new ProgramParameter(lengthOfReceiverVariableDefinitionInformation), - // Length of receiver variable definition information, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(lengthOfReceiverVariableDefinitionInformation)), - // List information, output, char(80). - new ProgramParameter(ListUtilities.LIST_INFO_LENGTH), - // Number of records to return, input, binary(4). - // Special value '-1' indicates that "all records are built synchronously in the list". - new ProgramParameter(new byte[] { (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF } ), - // Sort information, input, char(*). - new ProgramParameter(sortInformation), - // Job selection information, input, char(*). - new ProgramParameter(jobSelectionInformation), - // Size of job selection information, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(jobSelectionInformation.length)), - // Number of fields to return, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(currentKey_)), - // Key of fields to be returned, input, array(*) of binary(4). - new ProgramParameter(keyOfFieldsToBeReturned), - // Error code, I/0, char(*). - new ErrorCodeParameter(), - // Job selection format name, input, char(8), EBCDIC 'OLJS0200'. - new ProgramParameter(new byte[] { (byte)0xD6, (byte)0xD3, (byte)0xD1, (byte)0xE2, (byte)0xF0, (byte)0xF2, (byte)0xF0, (byte)0xF0 } ) - }; - - // Call the program. - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QGY.LIB/QGYOLJOB.PGM", parameters); - - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - - // List information returned. - byte[] listInformation = parameters[5].getOutputData(); - handle_ = new byte[4]; - System.arraycopy(listInformation, 8, handle_, 0, 4); - - // Wait for the list-building to complete. - listInformation = ListUtilities.waitForListToComplete(system_, handle_, listInformation); - - length_ = BinaryConverter.byteArrayToInt(listInformation, 0); - recordLength_ = BinaryConverter.byteArrayToInt(listInformation, 12); - - // Key information returned. - byte[] defInfo = parameters[3].getOutputData(); - numKeysReturned_ = BinaryConverter.byteArrayToInt(defInfo, 0); - keyFieldsReturned_ = new int[numKeysReturned_]; - keyTypesReturned_ = new char[numKeysReturned_]; - keyLengthsReturned_ = new int[numKeysReturned_]; - keyOffsetsReturned_ = new int[numKeysReturned_]; - - offset = 4; - for (int i = 0; i < numKeysReturned_; ++i) - { - keyFieldsReturned_[i] = BinaryConverter.byteArrayToInt(defInfo, offset + 4); - keyTypesReturned_[i] = conv.byteArrayToString(defInfo, offset + 8, 1).charAt(0); // 'C' or 'B' - keyLengthsReturned_[i] = BinaryConverter.byteArrayToInt(defInfo, offset + 12); - keyOffsetsReturned_[i] = BinaryConverter.byteArrayToInt(defInfo, offset + 16); - offset += 20; - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loaded job list, length: " + length_ + ", record length: " + recordLength_ + ", handle:", handle_); - } - - /** - Removes the PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes the VetoableChangeListener. If the VetoableChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - /** - Sets the job name that describes which jobs are returned. The default is SELECTION_JOB_NAME_ALL. This takes effect the next time the list of jobs is retrieved or refreshed. - @param name The job name, or {@link #SELECTION_JOB_NAME_ALL SELECTION_JOB_NAME_ALL} for all job names. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - @see #addJobSelectionCriteria - @see #getName - **/ - public void setName(String name) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting name: " + name); - if (name == null) - { - Trace.log(Trace.ERROR, "Parameter 'name' is null."); - throw new NullPointerException("name"); - } - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - synchronized (this) - { - selectionJobName_ = name; - if (handle_ != null) closeHandle_ = true; - } - } - else - { - String oldValue = selectionJobName_; - String newValue = name; - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("name", oldValue, newValue); - } - synchronized (this) - { - selectionJobName_ = name; - if (handle_ != null) closeHandle_ = true; - } - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("name", oldValue, newValue); - } - } - } - - /** - Sets the job number that describes which jobs are returned. The default is SELECTION_JOB_NUMBER_ALL. This takes effect the next time the list of jobs is retrieved or refreshed. - @param number The job number, or {@link #SELECTION_JOB_NUMBER_ALL SELECTION_JOB_NUMBER_ALL} for all job numbers. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - @see #addJobSelectionCriteria - @see #getNumber - **/ - public void setNumber(String number) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting number: " + number); - if (number == null) - { - Trace.log(Trace.ERROR, "Parameter 'number' is null."); - throw new NullPointerException("number"); - } - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - synchronized (this) - { - selectionJobNumber_ = number; - if (handle_ != null) closeHandle_ = true; - } - } - else - { - String oldValue = selectionJobNumber_; - String newValue = number; - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("number", oldValue, newValue); - } - synchronized (this) - { - selectionJobNumber_ = number; - if (handle_ != null) closeHandle_ = true; - } - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("number", oldValue, newValue); - } - } - } - - /** - Sets the system object representing the system on which the jobs exist. The system cannot be changed once a connection to the system has been established. - @param system The system object representing the system on which the jobs exists. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setSystem(AS400 system) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system: " + system); - - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (handle_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - system_ = system; - } - else - { - AS400 oldValue = system_; - AS400 newValue = system; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("system", oldValue, newValue); - } - system_ = system; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("system", oldValue, newValue); - } - } - } - - /** - Sets the user name value that describes which jobs are returned. The default is SELECTION_USER_NAME_ALL. This takes effect the next time the list of jobs is retrieved or refreshed. - @param user The user name, or {@link #SELECTION_USER_NAME_ALL SELECTION_USER_NAME_ALL} for all user names. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - @see #addJobSelectionCriteria - @see #getUser - **/ - public void setUser(String user) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting user: " + user); - if (user == null) - { - Trace.log(Trace.ERROR, "Parameter 'user' is null."); - throw new NullPointerException("user"); - } - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - synchronized (this) - { - selectionUserName_ = user; - if (handle_ != null) closeHandle_ = true; - } - } - else - { - String oldValue = selectionUserName_; - String newValue = user; - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("user", oldValue, newValue); - } - synchronized (this) - { - selectionUserName_ = user; - if (handle_ != null) closeHandle_ = true; - } - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("user", oldValue, newValue); - } - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JobList16.gif b/cvsroot/src/com/ibm/as400/access/JobList16.gif deleted file mode 100644 index 37fa92633..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/JobList16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/JobList32.gif b/cvsroot/src/com/ibm/as400/access/JobList32.gif deleted file mode 100644 index 2765c4d95..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/JobList32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/JobListBeanInfo.java b/cvsroot/src/com/ibm/as400/access/JobListBeanInfo.java deleted file mode 100644 index 8ebffe643..000000000 --- a/cvsroot/src/com/ibm/as400/access/JobListBeanInfo.java +++ /dev/null @@ -1,140 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JobListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - The JobListBeanInfo class represents the bean information for the JobList class. - **/ -public class JobListBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private static final Class BEAN_CLASS = JobList.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - // Set up the event set descriptors. - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - - eventSetDescriptors = new EventSetDescriptor[] { propertyChange, vetoableChange }; - - // Set up the property descriptors. - PropertyDescriptor system = new PropertyDescriptor("system", BEAN_CLASS); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - - propertyDescriptors = new PropertyDescriptor[] { system }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the additional bean information. - @return The additional bean information. - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return null; - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return Zero (0), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "propertyChange" event. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. Possible values are: -

      -
    • BeanInfo.ICON_MONO_16x16 -
    • BeanInfo.ICON_MONO_32x32 -
    • BeanInfo.ICON_COLOR_16x16 -
    • BeanInfo.ICON_COLOR_32x32 -
    - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("JobList16.gif"); - - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("JobList32.gif"); - } - Trace.log(Trace.ERROR, "Value of parameter 'icon' is not valid:", icon); - throw new ExtendedIllegalArgumentException("icon (" + icon + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/JobLog.java b/cvsroot/src/com/ibm/as400/access/JobLog.java deleted file mode 100644 index 77136ed23..000000000 --- a/cvsroot/src/com/ibm/as400/access/JobLog.java +++ /dev/null @@ -1,1354 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JobLog.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.Serializable; -import java.util.Enumeration; -import java.util.Vector; -/** - Represents a job log on the system. This class is used to get a list of messages in a job log or to write messages to a job log. -

    QueuedMessage objects have many attributes. Only some of these attribute values are set, depending on how a QueuedMessage object is created. The following is a list of attributes whose values can be set on QueuedMessage objects returned in a list of job log messages: -

      -
    • 0101 Alert option -
    • 0201 Replacement data or impromptu message text -
    • 0301 Message -
    • 0302 Message with replacement data -
    • 0401 Message help -
    • 0402 Message help with replacement data -
    • 0403 Message help with formatting characters -
    • 0404 Message help with replacement data and formatting characters -
    • 0501 Default reply -
    • 0602 Sender type -
    • 0603 Sending program name -
    • 0604 Sending module name -
    • 0605 Sending procedure name -
    • 0606 Number of sending statement numbers -
    • 0607 Sending user profile -
    • 0702 Receiving type -
    • 0703 Receiving program name -
    • 0704 Receiving module name -
    • 0705 Receiving procedure name -
    • 0706 Number of receiving statement numbers -
    • 0801 Message file library used -
    • 1001 Reply status -
    • 1101 Request status -
    • 1201 Request level -
    • 1301 Coded character set identifier (CCSID) for text -
    • 1302 CCSID conversion status indicator for text -
    • 1303 Coded character set identifier (CCSID) for data -
    • 1304 CCSID conversion status indicator for data -
    - @see com.ibm.as400.access.QueuedMessage - **/ -public class JobLog implements Serializable -{ - static final long serialVersionUID = 4L; - - // We don't currently allow the user to specify a direction or any other attributes, so we just hardcode these. - private static final int maxMessageLength_ = 511; - private static final int maxMessageHelpLength_ = 3000; - - // Header size for the api qgygtle 80 bytes for Message Selection - // Information and 1 byte for the message queue name - private static final int qgygtleHeaderLength_ = 81; - - // The system where the job log is located. - private AS400 system_; - // The job name. - private String name_ = "*"; - // The job user name. - private String user_ = ""; - // The job number. - private String number_ = ""; - - // Length of the job log message list. - private int length_; - // Handle that references the user space used by the open list APIs. - private byte[] handle_; - // If the list info has changed, close the old handle before loading the new one. - private boolean closeHandle_ = false; - - // The direction of the list. - private boolean listDirection_ = true; - // The starting message key. - private byte[] startingMessageKey_; - - // The list of field identifiers that are received - private Vector numberOfFieldIdentifiers_ = new Vector(); - - // Valid Field Identifiers. Default identifiers are 101, 302, 404, 603, 501, and 1001. - // The default identifiers are set in the load() method. - //DEFAULT VALUE - public static final int ALERT_OPTION = 101; - public static final int REPLACEMENT_DATA = 201; - public static final int MESSAGE = 301; - //DEFAULT VALUE - public static final int MESSAGE_WITH_REPLACEMENT_DATA = 302; - public static final int MESSAGE_HELP = 401; - public static final int MESSAGE_HELP_WITH_REPLACEMENT_DATA = 402; - public static final int MESSAGE_HELP_WITH_FORMATTING_CHARACTERS = 403; - //DEFAULT VALUE - public static final int MESSAGE_HELP_WITH_REPLACEMENT_DATA_AND_FORMATTING_CHARACTERS = 404; - //DEFAULT VALUE - public static final int DEFAULT_REPLY = 501; - public static final int SENDER_TYPE = 602; - //DEFAULT VALUE - public static final int SENDING_PROGRAM_NAME = 603; - public static final int SENDING_MODULE_NAME = 604; - public static final int SENDING_PROCEDURE_NAME = 605; - public static final int SENDING_STATEMENT_NUMBERS= 606; - public static final int SENDING_USER_PROFILE = 607; - public static final int RECEIVING_TYPE = 702; - public static final int RECEIVING_PROGRAM_NAME = 703; - public static final int RECEIVING_MODULE_NAME = 704; - public static final int RECEIVING_PROCEDURE_NAME = 705; - public static final int RECEIVING_STATEMENT_NUMBERS = 706; - public static final int MESSAGE_FILE_LIBRARY_USED = 801; - //DEFAULT VALUE - public static final int REPLY_STATUS = 1001; - public static final int REQUEST_STATUS = 1101; - public static final int REQUEST_LEVEL = 1201; - public static final int CCSID_FOR_TEXT = 1301; - public static final int CCSID_CONVERSION_STATUS_TEXT = 1302; - public static final int CCSID_FOR_DATA = 1303; - public static final int CCSID_CONVERSION_STATUS_DATA = 1304; - - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_ = null; // Set on first add. - // List of vetoable change event bean listeners. - private transient VetoableChangeSupport vetoableChangeListeners_ = null; // Set on first add. - - /** - Constructs a JobLog object. The system must be provided later. The job information defaults to the server job in which the program is run. - **/ - public JobLog() - { - super(); - if (Trace.traceOn_) - Trace.log(Trace.DIAGNOSTIC, "Adding default list information: REPLY_STATUS, SENDING_PROGRAM_NAME, DEFAULT_REPLY, MESSAGE_HELP_WITH_REPLACEMENT_DATA_AND_FORMATTING_CHARACTERS, MESSAGE_WITH_REPLACEMENT_DATA, ALERT_OPTION "); - // Add the default list information - addDefaultListInformation(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing JobLog object."); - } - - /** - Constructs a JobLog object. The job information defaults to the server job in which the program is run. - @param system The system object representing the system on which the job log exists. - **/ - public JobLog(AS400 system) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing JobLog object, system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (Trace.traceOn_) - Trace.log(Trace.DIAGNOSTIC, "Adding default list information: REPLY_STATUS, SENDING_PROGRAM_NAME, DEFAULT_REPLY, MESSAGE_HELP_WITH_REPLACEMENT_DATA_AND_FORMATTING_CHARACTERS, MESSAGE_WITH_REPLACEMENT_DATA, ALERT_OPTION "); - // Add the default list information - addDefaultListInformation(); - system_ = system; - } - - /** - Constructs a JobLog object. - @param system The system object representing the system on which the job log exists. - @param name The job name. - @param user The job user name. - @param number The job number. - **/ - public JobLog(AS400 system, String name, String user, String number) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing JobLog object, system: " + system + ", name: " + name + ", user: " + user + ", number: " + number); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (name == null) - { - Trace.log(Trace.ERROR, "Parameter 'name' is null."); - throw new NullPointerException("name"); - } - if (user == null) - { - Trace.log(Trace.ERROR, "Parameter 'user' is null."); - throw new NullPointerException("user"); - } - if (number == null) - { - Trace.log(Trace.ERROR, "Parameter 'number' is null."); - throw new NullPointerException("number"); - } - - if (Trace.traceOn_) - Trace.log(Trace.DIAGNOSTIC, "Adding default list information: REPLY_STATUS, SENDING_PROGRAM_NAME, DEFAULT_REPLY, MESSAGE_HELP_WITH_REPLACEMENT_DATA_AND_FORMATTING_CHARACTERS, MESSAGE_WITH_REPLACEMENT_DATA, ALERT_OPTION "); - // Add the default list information - addDefaultListInformation(); - system_ = system; - name_ = name; - user_ = user; - number_ = number; - } - - - /** - Adds a message attribute that will be retrieved for each joblog. This method allows - the Joblog objects that are retrieved from this Joblog list to have some of their message attributes choosen by - the caller. -

    The list of message attributes is maintained internally even when this JobList is closed and re-used. - To start over with a new set of job attributes to retrieve, - call {@link #clearAttributesToRetrieve clearAttributesToRetrieve()}. This will set all attributes to null including the default attributes. - @param attribute The message attribute to retrieve. Possible values are all joblog attributes in the api document for the Open List of Job Log Messages (QGYOLJBL) API. - **/ - public void addAttributeToRetrieve(int attribute) throws IOException - { - if( !numberOfFieldIdentifiers_.contains(new Integer(attribute)) ) - { - switch (attribute) - { - case 1001: //REPLY_STATUS: - numberOfFieldIdentifiers_.add( new Integer(REPLY_STATUS)); - break; - case 603: //SENDING_PROGRAM_NAME: - numberOfFieldIdentifiers_.add( new Integer(SENDING_PROGRAM_NAME)); - break; - case 501: //DEFAULT_REPLY: - numberOfFieldIdentifiers_.add( new Integer(DEFAULT_REPLY)); - break; - case 404: //MESSAGE_HELP_WITH_REPLACEMENT_DATA_AND_FORMATTING_CHARACTERS: - numberOfFieldIdentifiers_.add( new Integer(MESSAGE_HELP_WITH_REPLACEMENT_DATA_AND_FORMATTING_CHARACTERS)); - break; - case 302: //MESSAGE_WITH_REPLACEMENT_DATA: - numberOfFieldIdentifiers_.add( new Integer(MESSAGE_WITH_REPLACEMENT_DATA)); - break; - case 101: //ALERT_OPTION: - numberOfFieldIdentifiers_.add( new Integer(ALERT_OPTION)); - break; - case 201: //REPLACEMENT_DATA: - numberOfFieldIdentifiers_.add( new Integer(REPLACEMENT_DATA)); - break; - case 301: //MESSAGE: - numberOfFieldIdentifiers_.add( new Integer(MESSAGE)); - break; - case 401: //MESSAGE_HELP: - numberOfFieldIdentifiers_.add( new Integer (MESSAGE_HELP)); - break; - case 402: //MESSAGE_HELP_WITH_REPLACEMENT_DATA: - numberOfFieldIdentifiers_.add( new Integer(MESSAGE_HELP_WITH_REPLACEMENT_DATA)); - break; - case 403: //MESSAGE_HELP_WITH_FORMATTING_CHARACTERS: - numberOfFieldIdentifiers_.add( new Integer(MESSAGE_HELP_WITH_FORMATTING_CHARACTERS)); - break; - case 602: //SENDER_TYPE: - numberOfFieldIdentifiers_.add( new Integer(SENDER_TYPE)); - break; - case 604: //SENDING_MODULE_NAME: - numberOfFieldIdentifiers_.add( new Integer(SENDING_MODULE_NAME)); - break; - case 605: //SENDING_PROCEDURE_NAME: - numberOfFieldIdentifiers_.add( new Integer(SENDING_PROCEDURE_NAME)); - break; - case 606: //SENDING_STATEMENT_NUMBERS: - numberOfFieldIdentifiers_.add( new Integer(SENDING_STATEMENT_NUMBERS)); - break; - case 607: //SENDING_USER_PROFILE: - numberOfFieldIdentifiers_.add( new Integer(SENDING_USER_PROFILE)); - break; - case 702: //RECEIVING_TYPE: - numberOfFieldIdentifiers_.add( new Integer(RECEIVING_TYPE)); - break; - case 703: //RECEIVING_PROGRAM_NAME: - numberOfFieldIdentifiers_.add( new Integer(RECEIVING_PROGRAM_NAME)); - break; - case 704: //RECEIVING_MODULE_NAME: - numberOfFieldIdentifiers_.add( new Integer(RECEIVING_MODULE_NAME)); - break; - case 705: //RECEIVING_PROCEDURE_NAME: - numberOfFieldIdentifiers_.add( new Integer(RECEIVING_PROCEDURE_NAME)); - break; - case 706: //RECEIVING_STATEMENT_NUMBERS: - numberOfFieldIdentifiers_.add( new Integer(RECEIVING_STATEMENT_NUMBERS)); - break; - case 801: //MESSAGE_FILE_LIBRARY_USED: - numberOfFieldIdentifiers_.add( new Integer(MESSAGE_FILE_LIBRARY_USED)); - break; - case 1101: //REQUEST_STATUS: - numberOfFieldIdentifiers_.add( new Integer(REQUEST_STATUS)); - break; - case 1201: //REQUEST_LEVEL: - numberOfFieldIdentifiers_.add( new Integer(REQUEST_LEVEL)); - break; - case 1301: //CCSID_FOR_TEXT: - numberOfFieldIdentifiers_.add( new Integer(CCSID_FOR_TEXT)); - break; - case 1302: //CCSID_CONVERSION_STATUS_TEXT: - numberOfFieldIdentifiers_.add( new Integer(CCSID_CONVERSION_STATUS_TEXT)); - break; - case 1303: //CCSID_FOR_DATA: - numberOfFieldIdentifiers_.add( new Integer(CCSID_FOR_DATA)); - break; - case 1304: //CCSID_CONVERSION_STATUS_DATA: - numberOfFieldIdentifiers_.add( new Integer(CCSID_CONVERSION_STATUS_DATA)); - break; - default: - Trace.log(Trace.ERROR, "Value of parameter 'attribute' is not valid: " + attribute); - throw new ExtendedIllegalArgumentException("attribute", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - } - - /** - Clears the message attributes to be retrieved for a given Joblog. This removes all of the joblog attributes that would be retrieved including the default message attributes. If all message attributes are cleared a call to addAttributeToRetrieve must be called or an exception will be thrown. - @see #addAttributeToRetrieve - **/ - public void clearAttributesToRetrieve() - { - numberOfFieldIdentifiers_.clear(); - } - - /** - Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange() method will be called each time the value of any bound property is changed. - @param listener The listener. - @see #removePropertyChangeListener - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Adds a VetoableChangeListener. The specified VetoableChangeListener's vetoableChange() method will be called each time the value of any constrained property is changed. - @param listener The listener. - @see #removeVetoableChangeListener - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - } - - /** - Closes the message list on the system. This releases any system resources previously in use by this message list. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public synchronized void close() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Closing job log message list, handle: ", handle_); - if (handle_ == null) return; - - try { - ListUtilities.closeList(system_, handle_); - } - finally { - handle_ = null; - closeHandle_ = false; - } - } - - /** - Returns the number of messages in the job log. This method implicitly calls {@link #load load()}. - @return The number of messages, or 0 if no list was retrieved. - @see #load - **/ - public int getLength() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting job log list length."); - try - { - if (handle_ == null || closeHandle_) load(); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Exception caught getting length of job log list:", e); - if (e instanceof ExtendedIllegalStateException) throw (ExtendedIllegalStateException)e; - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Length:", length_); - return length_; - } - - /** - Returns the list direction. - @return true if the messages will be sorted oldest to newest; false if they will be sorted newest to oldest. The default is true. - **/ - public boolean getListDirection() - { - return listDirection_; - } - - /** - Returns the list of messages in the job log. - @return An Enumeration of QueuedMessage objects. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Enumeration getMessages() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving job log message list."); - // Need to get the length. - if (handle_ == null || closeHandle_) load(); - return new QueuedMessageEnumeration(this, length_); - } - - /** - Returns a subset of the list of messages in the job log. This method allows the user to retrieve the message list from the system in pieces. If a call to {@link #load load()} is made (either implicitly or explicitly), then the messages at a given list offset will change, so a subsequent call to getMessages() with the same listOffset and number will most likely not return the same QueuedMessages as the previous call. - @param listOffset The offset in the list of messages (0-based). This value must be greater than or equal to 0 and less than the list length; or specify -1 to retrieve all of the messages. - Note: Prior to JTOpen 7.2, this parameter was incorrectly described. - @param number The number of messages to retrieve out of the list, starting at the specified listOffset. This value must be greater than or equal to 0 and less than or equal to the list length. If the listOffset is -1, this parameter is ignored. - @return The array of retrieved {@link com.ibm.as400.access.QueuedMessage QueuedMessage} objects. The length of this array may not necessarily be equal to number, depending upon the size of the list on the system, and the specified listOffset. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see com.ibm.as400.access.QueuedMessage - **/ - public QueuedMessage[] getMessages(int listOffset, int number) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving job log message list, list offset: " + listOffset + ", number:", number); - if (listOffset < -1) - { - throw new ExtendedIllegalArgumentException("listOffset (" + listOffset + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (number < 0 && listOffset != -1) - { - throw new ExtendedIllegalArgumentException("number (" + number + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (handle_ == null || closeHandle_) load(); // this sets the length_ variable - - if (length_ == 0 || (number == 0 && listOffset != -1)) { - return new QueuedMessage[0]; - } - - if (listOffset == -1) - { - number = length_; // request entire list - listOffset = 0; // ... starting at beginning of list - } - else if (listOffset >= length_) - { - if (Trace.traceOn_) - Trace.log(Trace.WARNING, "Value of parameter 'listOffset' is beyond end of list:", listOffset + " (list length: " + length_ + ")"); - - return new QueuedMessage[0]; - } - else if (listOffset + number > length_) - { - number = length_ - listOffset; - } - - int lengthOfReceiverVariable = 1024 * number; - - // Retrieve the entries in the list that was built by the most recent load(). - byte[] data = ListUtilities.retrieveListEntries(system_, handle_, lengthOfReceiverVariable, number, listOffset, null); - - Converter conv = new Converter(system_.getCcsid(), system_); - - QueuedMessage[] messages = new QueuedMessage[number]; - int offset = 0; - for (int i = 0; i < messages.length; ++i) // each message - { - int entryOffset = BinaryConverter.byteArrayToInt(data, offset); - int fieldOffset = BinaryConverter.byteArrayToInt(data, offset + 4); - int numFields = BinaryConverter.byteArrayToInt(data, offset + 8); - int messageSeverity = BinaryConverter.byteArrayToInt(data, offset + 12); - String messageIdentifier = conv.byteArrayToString(data, offset + 16, 7).trim(); - int messageType = (data[offset + 23] & 0x0F) * 10 + (data[offset + 24] & 0x0F); - if (messageType == 0) messageType = -1; - byte[] messageKey = new byte[4]; - System.arraycopy(data, offset + 25, messageKey, 0, 4); - String messageFileName = conv.byteArrayToString(data, offset + 29, 10).trim(); - String messageFileLibrarySpecified = conv.byteArrayToString(data, offset + 39, 10).trim(); - String dateSent = conv.byteArrayToString(data, offset + 49, 7); // CYYMMDD - String timeSent = conv.byteArrayToString(data, offset + 56, 6); // HHMMSS - - messages[i] = new QueuedMessage(system_, messageSeverity, messageIdentifier, messageType, messageKey, messageFileName, messageFileLibrarySpecified, dateSent, timeSent); - - for (int j = 0; j < numFields; ++j) - { - int offsetToNextField = BinaryConverter.byteArrayToInt(data, fieldOffset); - int fieldID = BinaryConverter.byteArrayToInt(data, fieldOffset + 8); - byte type = data[fieldOffset + 12]; - int dataLen = BinaryConverter.byteArrayToInt(data, fieldOffset + 28); - if (type == (byte)0xC3) // 'C' - { - if ( fieldID == 201 ) - { - byte[] substitutionData = new byte[dataLen]; - System.arraycopy(data, fieldOffset +32, substitutionData, 0, dataLen); - messages[i].setValueInternal(fieldID, substitutionData); - } - else - { - messages[i].setValueInternal(fieldID, conv.byteArrayToString(data, fieldOffset + 32, dataLen)); - } - } - else if (type == (byte)0xC2) // 'B' - { - if (dataLen > 4) - { - messages[i].setAsLong(fieldID, BinaryConverter.byteArrayToLong(data, fieldOffset + 32)); - } - else - { - messages[i].setAsInt(fieldID, BinaryConverter.byteArrayToInt(data, fieldOffset + 32)); - } - } - else - { - int numStatements = BinaryConverter.byteArrayToInt(data, fieldOffset + 32); - String[] statements = new String[numStatements]; - for (int k = 0; k < numStatements; ++k) - { - statements[k] = conv.byteArrayToString(data, fieldOffset + 36 + (k * 10), 10); - } - messages[i].setValueInternal(fieldID, statements); - } - fieldOffset = offsetToNextField; - } - - offset = entryOffset; - } - return messages; - } - - /** - Returns the job name. - @return The job name, or "*" if none has been set. - @see #setName - **/ - public String getName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting name: " + name_); - return name_; - } - - /** - Returns the job number. - @return The job number, or "" if none has been set. - @see #setNumber - **/ - public String getNumber() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting number: " + number_); - return number_; - } - - /** - Returns the starting message key. - @return The key. - @see #setStartingMessageKey - **/ - public byte[] getStartingMessageKey() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting starting message key:", startingMessageKey_); - return startingMessageKey_; - } - - /** - Returns the system object representing the system on which the job log exists. - @return The system object representing the system on which the job log exists. If the system has not been set, null is returned. - @see #setSystem - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - /** - Returns the job user name. - @return The job user name, or "" if none has been set. - @see #setUser - **/ - public String getUser() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting user: " + user_); - return user_; - } - - /** - Loads the list of messages on the system. This method informs the system to build a list of messages. This method blocks until the system returns the total number of messages it has compiled. A subsequent call to {@link #getMessages getMessages()} will retrieve the actual message information and attributes for each message in the list from the system. -

    This method updates the list length. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #getLength - **/ - public synchronized void load() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loading job log message list."); - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (!name_.equals("*")) - { - if (user_.equals("")) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting user."); - throw new ExtendedIllegalStateException("user", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (number_.equals("")) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting number."); - throw new ExtendedIllegalStateException("number", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - - // Close the previous list. - if (closeHandle_) close(); - - // Create the message selection information. - byte[] messageSelectionInformation = listInformationArray(); - - - // Setup program parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Receiver variable, output, char(*). - new ProgramParameter(0), - // Length of receiver variable, input, binary(4). - new ProgramParameter(new byte[] { 0x00, 0x00, 0x00, 0x00 } ), - // List information, output, char(80). - new ProgramParameter(ListUtilities.LIST_INFO_LENGTH), - // Number of records to return, input, binary(4). - // Special value '-1' indicates that "all records are built synchronously in the list". - new ProgramParameter(new byte[] { (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF } ), - // Message selection information, input, char(*). - new ProgramParameter(messageSelectionInformation), - // Size of message selection information, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(messageSelectionInformation.length)), - // Error code, I/O, char(*). - new ErrorCodeParameter(), - }; - - // Call the program. This API is not thread safe. - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QGY.LIB/QGYOLJBL.PGM", parameters); // not a threadsafe API - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - - // List information returned. - byte[] listInformation = parameters[2].getOutputData(); - handle_ = new byte[4]; - System.arraycopy(listInformation, 8, handle_, 0, 4); - - // Wait for the list-building to complete. - listInformation = ListUtilities.waitForListToComplete(system_, handle_, listInformation); - - length_ = BinaryConverter.byteArrayToInt(listInformation, 0); - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loaded job log message list, length: " + length_ + ", handle: ", handle_); - } - - /** - Removes the PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes the VetoableChangeListener. If the VetoableChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - /** - Sets the list direction. - @param listDirection true to sort the messages oldest to newest; false to sort them newest to oldest. The default is true. - **/ - public void setListDirection(boolean listDirection) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting list direction: " + listDirection); - synchronized (this) - { - listDirection_ = listDirection; - if (handle_ != null) closeHandle_ = true; - } - } - - /** - Sets the job name. This cannot be changed if the object has established a connection to the system. - @param name The job name. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setName(String name) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting name: " + name); - if (name == null) - { - Trace.log(Trace.ERROR, "Parameter 'name' is null."); - throw new NullPointerException("name"); - } - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - synchronized (this) - { - name_ = name; - if (handle_ != null) closeHandle_ = true; - } - } - else - { - String oldValue = name_; - String newValue = name; - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("name", oldValue, newValue); - } - synchronized (this) - { - name_ = name; - if (handle_ != null) closeHandle_ = true; - } - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("name", oldValue, newValue); - } - } - } - - /** - Sets the job number. This cannot be changed if the object has established a connection to the system. - @param number The job number. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setNumber(String number) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting number: " + number); - if (number == null) - { - Trace.log(Trace.ERROR, "Parameter 'number' is null."); - throw new NullPointerException("number"); - } - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - synchronized (this) - { - number_ = number; - if (handle_ != null) closeHandle_ = true; - } - } - else - { - String oldValue = number_; - String newValue = number; - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("number", oldValue, newValue); - } - synchronized (this) - { - number_ = number; - if (handle_ != null) closeHandle_ = true; - } - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("number", oldValue, newValue); - } - } - } - - /** - Sets the message key used to begin searching for messages to list from the corresponding entry in the job log. Any valid message key will work, including {@link com.ibm.as400.access.MessageQueue#OLDEST MessageQueue.OLDEST} and {@link com.ibm.as400.access.MessageQueue#NEWEST MessageQueue#NEWEST}. - @param startingMessageKey The key. Specify null to set it back to the default, which will be OLDEST or NEWEST based on the list direction. - **/ - public void setStartingMessageKey(byte[] startingMessageKey) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting starting message key:", startingMessageKey); - synchronized (this) - { - startingMessageKey_ = startingMessageKey; - if (handle_ != null) closeHandle_ = true; - } - } - - /** - Sets the system. This cannot be changed if the object has established a connection to the system. - @param system The system object representing the system on which the job log exists. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setSystem(AS400 system) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (handle_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - system_ = system; - } - else - { - AS400 oldValue = system_; - AS400 newValue = system; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("system", oldValue, newValue); - } - system_ = system; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("system", oldValue, newValue); - } - } - } - - /** - Sets the job user name. This cannot be changed if the object has established a connection to the system. - @param user The job user name. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setUser(String user) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting user: " + user); - if (user == null) - { - Trace.log(Trace.ERROR, "Parameter 'user' is null."); - throw new NullPointerException("user"); - } - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - synchronized (this) - { - user_ = user; - if (handle_ != null) closeHandle_ = true; - } - } - else - { - String oldValue = user_; - String newValue = user; - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("user", oldValue, newValue); - } - synchronized (this) - { - user_ = user; - if (handle_ != null) closeHandle_ = true; - } - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("user", oldValue, newValue); - } - } - } - - /** - Writes a program message to the job log for the job in which the program is running. -
    Note: The program runs in the job of the Remote Command Host Server (QZRCSRVS) unless it is invoked "on-thread" on the system. - @param system The system object representing the system on which the job log exists. If the system specifies localhost, the message is written to the job log of the process from which this method is called. Otherwise the message is written to the QZRCSRVS job. - @param messageID The message ID. The message must be in the default message file /QSYS.LIB/QCPFMSG.MSGF. - @param messageType The message type. Possible values are: -

      -
    • AS400Message.COMPLETION -
    • AS400Message.DIAGNOSTIC -
    • AS400Message.INFORMATIONAL -
    • AS400Message.ESCAPE -
    - The message type must be AS400Message.INFORMATIONAL for an immediate message. - @see com.ibm.as400.access.ProgramCall#isStayOnThread() - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public static void writeMessage(AS400 system, String messageID, int messageType) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Writing message to job log, system: " + system + ", message ID: " + messageID + ", message type:", messageType); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (messageID == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageID' is null."); - throw new NullPointerException("messageID"); - } - switch (messageType) - { - case AS400Message.COMPLETION: - case AS400Message.DIAGNOSTIC: - case AS400Message.INFORMATIONAL: - case AS400Message.ESCAPE: - break; - default: - Trace.log(Trace.ERROR, "Value of parameter 'messageType' is not valid: " + messageType); - throw new ExtendedIllegalArgumentException("messageType (" + messageType + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - sendProgramMessage(system, messageID, "/QSYS.LIB/QCPFMSG.MSGF", null, messageType, false); - } - - /** - Writes a program message to the job log for the job in which the program is running. -
    Note: The program runs in the job of the Remote Command Host Server (QZRCSRVS) unless it is invoked "on-thread" on the system. - @param system The system. If the system specifies localhost, the message is written to the job log of the process from which this method is called. Otherwise the message is written to the QZRCSRVS job. - @param messageID The message ID. The message must be in the default message file /QSYS.LIB/QCPFMSG.MSGF. - @param messageType The message type. Possible values are: -
      -
    • AS400Message.COMPLETION -
    • AS400Message.DIAGNOSTIC -
    • AS400Message.INFORMATIONAL -
    • AS400Message.ESCAPE -
    - The message type must be AS400Message.INFORMATIONAL for an immediate message. - @param substitutionData The substitution data. The substitution data can be from 0-32767 bytes for a conventional message and from 1-6000 bytes for an immediate message. - @see com.ibm.as400.access.ProgramCall#isStayOnThread() - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public static void writeMessage(AS400 system, String messageID, int messageType, byte[] substitutionData) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Writing message to job log, system: " + system + ", message ID: " + messageID + ", message type: " + messageType + ", substitution data:", substitutionData); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (messageID == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageID' is null."); - throw new NullPointerException("messageID"); - } - switch (messageType) - { - case AS400Message.COMPLETION: - case AS400Message.DIAGNOSTIC: - case AS400Message.INFORMATIONAL: - case AS400Message.ESCAPE: - break; - default: - Trace.log(Trace.ERROR, "Value of parameter 'messageType' is not valid: " + messageType); - throw new ExtendedIllegalArgumentException("messageType (" + messageType + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - sendProgramMessage(system, messageID, "/QSYS.LIB/QCPFMSG.MSGF", substitutionData, messageType, false); - } - - /** - Writes a program message to the job log for the job in which the program is running. -
    Note: The program runs in the job of the Remote Command Host Server (QZRCSRVS) unless it is invoked "on-thread" on the system. - @param system The system. If the system specifies localhost, the message is written to the job log of the process from which this method is called. Otherwise the message is written to the QZRCSRVS job. - @param messageID The message ID. - @param messageType The message type. Possible values are: -
      -
    • AS400Message.COMPLETION -
    • AS400Message.DIAGNOSTIC -
    • AS400Message.INFORMATIONAL -
    • AS400Message.ESCAPE -
    - The message type must be AS400Message.INFORMATIONAL for an immediate message. - @param messageFile The integrated file system path name of the message file. - @see com.ibm.as400.access.ProgramCall#isStayOnThread() - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public static void writeMessage(AS400 system, String messageID, int messageType, String messageFile) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (messageID == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageID' is null."); - throw new NullPointerException("messageID"); - } - switch (messageType) - { - case AS400Message.COMPLETION: - case AS400Message.DIAGNOSTIC: - case AS400Message.INFORMATIONAL: - case AS400Message.ESCAPE: - break; - default: - Trace.log(Trace.ERROR, "Value of parameter 'messageType' is not valid: " + messageType); - throw new ExtendedIllegalArgumentException("messageType (" + messageType + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (messageFile == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageFile' is null."); - throw new NullPointerException("messageFile"); - } - QSYSObjectPathName.validatePath(messageFile, "MSGF"); - sendProgramMessage(system, messageID, messageFile, null, messageType, false); - } - - /** - Writes a program message to the job log for the job in which the program is running. -
    Note: The program runs in the job of the Remote Command Host Server (QZRCSRVS) unless it is invoked "on-thread" on the system. - @param system The system. If the system specifies localhost, the message is written to the job log of the process from which this method is called. Otherwise the message is written to the QZRCSRVS job. - @param messageID The message ID. - @param messageType The message type. Possible values are: -
      -
    • AS400Message.COMPLETION -
    • AS400Message.DIAGNOSTIC -
    • AS400Message.INFORMATIONAL -
    • AS400Message.ESCAPE -
    - The message type must be AS400Message.INFORMATIONAL for an immediate message. - @param messageFile The integrated file system path name of the message file. - @param substitutionData The substitution data. The substitution data can be from 0-32767 bytes for a conventional message and from 1-6000 bytes for an immediate message. - @see com.ibm.as400.access.ProgramCall#isStayOnThread() - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public static void writeMessage(AS400 system, String messageID, int messageType, String messageFile, byte[] substitutionData) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (messageID == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageID' is null."); - throw new NullPointerException("messageID"); - } - switch (messageType) - { - case AS400Message.COMPLETION: - case AS400Message.DIAGNOSTIC: - case AS400Message.INFORMATIONAL: - case AS400Message.ESCAPE: - break; - default: - Trace.log(Trace.ERROR, "Value of parameter 'messageType' is not valid: " + messageType); - throw new ExtendedIllegalArgumentException("messageType (" + messageType + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (messageFile == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageFile' is null."); - throw new NullPointerException("messageFile"); - } - QSYSObjectPathName.validatePath(messageFile, "MSGF"); - sendProgramMessage(system, messageID, messageFile, substitutionData, messageType, false); - } - - /** - Writes a program message to the job log for the job in which the program is running. The message is sent to the Remote Command Host Server (QZRCSRVS) unless true is specified for the onThread parameter and is invoked while running on the system. - @param system The system. The system cannot be null. - @param messageID The message ID. The message ID cannot be null. - @param messageType The message type. Possible values are: -
      -
    • AS400Message.COMPLETION -
    • AS400Message.DIAGNOSTIC -
    • AS400Message.INFORMATIONAL -
    • AS400Message.ESCAPE -
    - The message type must be AS400Message.INFORMATIONAL for an immediate message. - @param messageFile The integrated file system path name of the message file. If null is specified, the message file used is /QSYS.LIB/QCPFMSG.MSGF. - @param substitutionData The substitution data. The substitution data can be from 0-32767 bytes for a conventional message and from 1-6000 bytes for an immediate message. If null is specified, no substitution data is used. - @param onThread Whether or not to stay on thread when calling the API to write the message to the job log. true to write the message to the current job's job log, false to write the message to the Remote Command Host Server job's job log. Note that this parameter is meaningless unless this Java program is running on the system and the system object is using native optimizations. - @see com.ibm.as400.access.ProgramCall#isStayOnThread() - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public static void writeMessage(AS400 system, String messageID, int messageType, String messageFile, byte[] substitutionData, boolean onThread) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (messageID == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageID' is null."); - throw new NullPointerException("messageID"); - } - switch (messageType) - { - case AS400Message.COMPLETION: - case AS400Message.DIAGNOSTIC: - case AS400Message.INFORMATIONAL: - case AS400Message.ESCAPE: - break; - default: - Trace.log(Trace.ERROR, "Value of parameter 'messageType' is not valid: " + messageType); - throw new ExtendedIllegalArgumentException("messageType (" + messageType + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (messageFile == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageFile' is null."); - throw new NullPointerException("messageFile"); - } - QSYSObjectPathName.validatePath(messageFile, "MSGF"); - sendProgramMessage(system, messageID, messageFile, substitutionData, messageType, onThread); - } - - private static final byte[] typeCompletion_ = new byte[] { 0x5C, (byte)0xC3, (byte)0xD6, (byte)0xD4, (byte)0xD7, 0x40, 0x40, 0x40, 0x40, 0x40 }; // "*COMP " - private static final byte[] typeDiagnostic_ = new byte[] { 0x5C, (byte)0xC4, (byte)0xC9, (byte)0xC1, (byte)0xC7, 0x40, 0x40, 0x40, 0x40, 0x40 }; // "*DIAG " - private static final byte[] typeEscape_ = new byte[] { 0x5C, (byte)0xC5, (byte)0xE2, (byte)0xC3, (byte)0xC1, (byte)0xD7, (byte)0xC5, 0x40, 0x40, 0x40 }; // "*ESCAPE " - private static final byte[] typeInformational_ = new byte[] { 0x5C, (byte)0xC9, (byte)0xD5, (byte)0xC6, (byte)0xD6, 0x40, 0x40, 0x40, 0x40, 0x40 }; // "*INFO " - - private static final byte[] callStackEntry_ = new byte[] { 0x5C, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; // "* " - - private void addDefaultListInformation() - { - numberOfFieldIdentifiers_.add(new Integer(REPLY_STATUS)); - numberOfFieldIdentifiers_.add(new Integer(SENDING_PROGRAM_NAME)); - numberOfFieldIdentifiers_.add(new Integer(DEFAULT_REPLY)); - numberOfFieldIdentifiers_.add(new Integer(MESSAGE_HELP_WITH_REPLACEMENT_DATA_AND_FORMATTING_CHARACTERS)); - numberOfFieldIdentifiers_.add(new Integer(MESSAGE_WITH_REPLACEMENT_DATA)); - numberOfFieldIdentifiers_.add(new Integer(ALERT_OPTION)); - } - - private byte[] listInformationArray() throws IOException - { - byte [] messageSelectionInformation = new byte[ qgygtleHeaderLength_ + (numberOfFieldIdentifiers_.size() * 4) ]; - - // Generate text objects based on system CCSID. - Converter conv = new Converter(system_.getCcsid(), system_); - - // List direction. The direction to list messages can be *NEXT or *PRV. - if (listDirection_) - System.arraycopy(new byte[] { 0x5C, (byte)0xD5, (byte)0xC5, (byte)0xE7, (byte)0xE3 }, 0, messageSelectionInformation, 0, 5); - else - System.arraycopy(new byte[] { 0x5C, (byte)0xD7, (byte)0xD9, (byte)0xE5, 0x40 }, 0, messageSelectionInformation, 0, 5); - - // Blank pad from end of List direction through Internal job identifier. - for (int i = 5; i < 52; ++i) messageSelectionInformation[i] = 0x40; - - // Job name, user, and number - conv.stringToByteArray(name_.toUpperCase().trim(), messageSelectionInformation, 10); - conv.stringToByteArray(user_.toUpperCase().trim(), messageSelectionInformation, 20); - conv.stringToByteArray(number_, messageSelectionInformation, 30); - - byte[] startingMessageKey = (startingMessageKey_ != null ? startingMessageKey_ : (listDirection_ ? MessageQueue.OLDEST : MessageQueue.NEWEST)); - - System.arraycopy(startingMessageKey, 0, messageSelectionInformation, 52, 4); - // Only used for fields 401, 402, 403, or 404. - BinaryConverter.intToByteArray(maxMessageLength_, messageSelectionInformation, 56); - // Only used for fields 301 or 302. - BinaryConverter.intToByteArray(maxMessageHelpLength_, messageSelectionInformation, 60); - // Offset of identifiers. - BinaryConverter.intToByteArray(80, messageSelectionInformation, 64); - - // Number of identifiers to return, which should be the amount of - // objects in the vector numberOfFieldIdentifiers_ - BinaryConverter.intToByteArray(numberOfFieldIdentifiers_.size(), messageSelectionInformation, 68); - - // Offset of call message queue name. The size of the header + number of - // fields * 4 bytes - 1, which puts us at the end of the byte array - 1 - BinaryConverter.intToByteArray((qgygtleHeaderLength_ + (numberOfFieldIdentifiers_.size() * 4) -1), messageSelectionInformation, 72); - - // Size of call message queue name. - BinaryConverter.intToByteArray(1, messageSelectionInformation, 76); - - // Add the fields to the byte array - Enumeration fields = numberOfFieldIdentifiers_.elements(); - int offset = qgygtleHeaderLength_ - 1; - while (fields.hasMoreElements()) - { - BinaryConverter.intToByteArray(((Integer)(fields.nextElement())).intValue(), messageSelectionInformation, offset); - offset += 4; - } - - // Call message queue name, EBCDIC '*', Messages from every call of the job are listed. - messageSelectionInformation[ (qgygtleHeaderLength_ - 1 )+ (numberOfFieldIdentifiers_.size() * 4) ] = 0x5C; - - return messageSelectionInformation; - } - - - private static void sendProgramMessage(AS400 system, String messageID, String messageFile, byte[] replacementData, int messageType, boolean onThread) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Assume all parameters have been validated. - Converter conv = new Converter(system.getCcsid(), system); - - byte[] messageIdentifier = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - conv.stringToByteArray(messageID, messageIdentifier, 0, 7); - - byte[] qualifiedMessageFileName = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - QSYSObjectPathName path = new QSYSObjectPathName(messageFile); - conv.stringToByteArray(path.getObjectName(), qualifiedMessageFileName, 0, 10); - conv.stringToByteArray(path.getLibraryName(), qualifiedMessageFileName, 10, 10); - - if (replacementData == null) replacementData = new byte[0]; - - byte[] type = null; - switch (messageType) - { - case AS400Message.COMPLETION: - type = typeCompletion_; - break; - case AS400Message.DIAGNOSTIC: - type = typeDiagnostic_; - break; - case AS400Message.ESCAPE: - type = typeEscape_; - break; - case AS400Message.INFORMATIONAL: - type = typeInformational_; - break; - default: - break; - } - - // Setup program parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Message identifier, input, char(7). - new ProgramParameter(messageIdentifier), - // Qualified message file name, input, char(20). - new ProgramParameter(qualifiedMessageFileName), - // Message data or immediate text, input, char(*). - new ProgramParameter(replacementData), - // Length of message data or immediate text, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(replacementData.length)), - // Message type, input, char(10). - new ProgramParameter(type), - // Call stack entry, input, char(*). - new ProgramParameter(callStackEntry_), - // Call stack counter, input, binary(4). - new ProgramParameter(new byte[] { 0x00, 0x00, 0x00, 0x00 } ), - // Message key, output, char(4). - new ProgramParameter(4), - // Error code, I/O, char(*). - new ErrorCodeParameter() - }; - - ProgramCall pc = new ProgramCall(system, "/QSYS.LIB/QMHSNDPM.PGM", parameters); - - // The QMHSNDPM is threadsafe, but we want to stay on-thread - // if (and only if) the user wants to write to the current job's log, - // rather than to the remote command server's job log. - if (onThread) pc.setThreadSafe(true); // force on-thread - if (!pc.run()) - { - // If one message came back and it is the one we sent, - // then we're OK. - AS400Message[] msgs = pc.getMessageList(); - if (msgs.length == 1 && msgs[0].getID().equals(messageID) && - msgs[0].getType() == messageType) - { - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "The expected escape message is ignored."); - return; - } - throw new AS400Exception(msgs); - } - } - - - /** - Closes the list on the system when this object is garbage collected. - **/ - protected void finalize() throws Throwable - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Finalize method for job log invoked."); - if (handle_ != null) try { close(); } catch (Throwable t) {} - super.finalize(); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/JobLog16.gif b/cvsroot/src/com/ibm/as400/access/JobLog16.gif deleted file mode 100644 index d32ef1038..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/JobLog16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/JobLog32.gif b/cvsroot/src/com/ibm/as400/access/JobLog32.gif deleted file mode 100644 index 7a0d00bc6..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/JobLog32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/JobLogBeanInfo.java b/cvsroot/src/com/ibm/as400/access/JobLogBeanInfo.java deleted file mode 100644 index 58fe0459b..000000000 --- a/cvsroot/src/com/ibm/as400/access/JobLogBeanInfo.java +++ /dev/null @@ -1,158 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JobLogBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - The JobLogBeanInfo class represents the bean information for the JobLog class. - **/ -public class JobLogBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private static final Class BEAN_CLASS = JobLog.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - // Set up the event set descriptors. - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - - eventSetDescriptors = new EventSetDescriptor[] { propertyChange, vetoableChange }; - - // Set up the property descriptors. - PropertyDescriptor system = new PropertyDescriptor("system", BEAN_CLASS); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - - PropertyDescriptor name = new PropertyDescriptor("name", BEAN_CLASS); - name.setBound(true); - name.setConstrained(true); - name.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_NAME")); - name.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_NAME")); - - PropertyDescriptor number = new PropertyDescriptor("number", BEAN_CLASS); - number.setBound(true); - number.setConstrained(true); - number.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_JOB_NUMBER")); - number.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_JOB_NUMBER")); - - PropertyDescriptor user = new PropertyDescriptor("user", BEAN_CLASS); - user.setBound(true); - user.setConstrained(true); - user.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_JOB_USER")); - user.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_JOB_USER")); - - propertyDescriptors = new PropertyDescriptor[] { system, name, number, user }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the additional bean information. - @return The additional bean information. - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return null; - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return Zero (0), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "propertyChange" event. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. Possible values are: -
      -
    • BeanInfo.ICON_MONO_16x16 -
    • BeanInfo.ICON_MONO_32x32 -
    • BeanInfo.ICON_COLOR_16x16 -
    • BeanInfo.ICON_COLOR_32x32 -
    - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("JobLog16.gif"); - - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("JobLog32.gif"); - } - Trace.log(Trace.ERROR, "Value of parameter 'icon' is not valid:", icon); - throw new ExtendedIllegalArgumentException("icon (" + icon + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/KeyedDataQueue.java b/cvsroot/src/com/ibm/as400/access/KeyedDataQueue.java deleted file mode 100644 index 9d46739ce..000000000 --- a/cvsroot/src/com/ibm/as400/access/KeyedDataQueue.java +++ /dev/null @@ -1,558 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: KeyedDataQueue.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - The KeyedDataQueue class represents a keyed data queue object. - **/ -public class KeyedDataQueue extends BaseDataQueue -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - //The length of the key for each entry in the queue. - int keyLength_ = 0; - - /** - Constructs a KeyedDataQueue object. The system and path properties must be set before using any method requiring a connection to the system. - **/ - public KeyedDataQueue() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing KeyedDataQueue object."); - } - - /** - Constructs a KeyedDataQueue object. - @param system The system object representing the system on which the data queue exists. - @param path The fully qualified integrated file system path name of the data queue. The library and queue name must each be 10 characters or less. - **/ - public KeyedDataQueue(AS400 system, String path) - { - super(system, path); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing KeyedDataQueue object."); - } - - // Convert a key to EBCDIC and pad to the correct length. - private byte[] convertKey(String key) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - int keyLength = getKeyLength(); // Potential connection to data queue server. - byte[] keyBytes = stringToByteArray(key); - if (keyBytes.length == keyLength) - { - return keyBytes; - } - else if (keyBytes.length < keyLength) - { - byte[] copy = new byte[keyLength]; - System.arraycopy(keyBytes, 0, copy, 0, keyBytes.length); - return copy; - } - else - { - Trace.log(Trace.ERROR, "Length of parameter 'key' is not valid: " + key); - throw new ExtendedIllegalArgumentException("key (" + key + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - } - - /** - Removes all entries that match the key from the data queue. - @param key The key with which data queue entries will be compared. All entries whose key is equal to this parameter will be removed from the queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void clear(byte[] key) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Clearing keyed data queue."); - - // Check parameters. - if (key == null) - { - Trace.log(Trace.ERROR, "Parameter 'key' is null."); - throw new NullPointerException("key"); - } - if (key.length > 256) - { - Trace.log(Trace.ERROR, "Length of parameter 'key' is not valid:", key.length); - throw new ExtendedIllegalArgumentException("key.length (" + key.length + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - open(); - // Send clear request. - impl_.clear(key); - if (dataQueueListeners_ != null) fireDataQueueEvent(DataQueueEvent.DQ_CLEARED); - } - - /** - Removes all entries that match the key from the data queue. - @param key The key with which data queue entries will be compared. All entries whose key is equal to this parameter will be removed from the queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void clear(String key) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - // Check parameters. - if (key == null) - { - Trace.log(Trace.ERROR, "Parameter 'key' is null."); - throw new NullPointerException("key"); - } - clear(convertKey(key)); - } - - /** - Creates a keyed data queue on the system. The queue will be created with the following attributes: authority = *LIBCRTAUT, saveSenderInformation = false, forceToAuxiliaryStorage = false, description = (50 blanks). - @param keyLength The number of bytes per data queue key. Valid values are 1-256. - @param maxEntryLength The maximum number of bytes per data queue entry. Valid values are 1-64512. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @exception ObjectAlreadyExistsException If the object already exists on the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void create(int keyLength, int maxEntryLength) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectAlreadyExistsException, ObjectDoesNotExistException - { - create(keyLength, maxEntryLength, "*LIBCRTAUT", false, false, ""); - } - - /** - Creates a keyed data queue on the system. - @param keyLength The number of bytes per data queue key. Valid values are 1-256. - @param maxEntryLength The maximum number of bytes per data queue entry. Valid values are 1-64512. - @param authority The public authority for the data queue. Valid values are *ALL, *CHANGE, *EXCLUDE, *USE, *LIBCRTAUT. - @param saveSenderInformation Determines if entry origin information will be saved. - @param forceToAuxiliaryStorage true if writes are forced to storage before return; false otherwise. - @param description The text description. This string must be 50 characters or less. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @exception ObjectAlreadyExistsException If the object already exists on the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void create(int keyLength, int maxEntryLength, String authority, boolean saveSenderInformation, boolean forceToAuxiliaryStorage, String description) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectAlreadyExistsException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Creating keyed data queue."); - - // Check parameters. - if (keyLength < 1 || keyLength > 256) - { - Trace.log(Trace.ERROR, "Value of parameter 'keyLength' is not valid:", keyLength); - throw new ExtendedIllegalArgumentException("keyLength (" + keyLength + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (maxEntryLength < 1 || maxEntryLength > 64512) - { - Trace.log(Trace.ERROR, "Value of parameter 'maxEntryLength' is not valid:", maxEntryLength); - throw new ExtendedIllegalArgumentException("maxEntryLength (" + maxEntryLength + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (authority == null) - { - Trace.log(Trace.ERROR, "Parameter 'authority' is null."); - throw new NullPointerException("authority"); - } - authority = authority.toUpperCase().trim(); - if (!authority.equals("*LIBCRTAUT") && !authority.equals("*ALL") && !authority.equals("*CHANGE") && !authority.equals("*EXCLUDE") && !authority.equals("*USE")) - { - Trace.log(Trace.ERROR, "Value of parameter 'authority' is not valid: " + authority); - throw new ExtendedIllegalArgumentException("authority (" + authority + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (description == null) - { - Trace.log(Trace.ERROR, "Parameter 'description' is null."); - throw new NullPointerException("description"); - } - if (description.length() > 50) - { - Trace.log(Trace.ERROR, "Length of parameter 'description' is not valid: " + description); - throw new ExtendedIllegalArgumentException("description (" + description + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - chooseImpl(); - - // Don't commit to the change in attributes till the create completes. - attributesRetrieved_ = false; - - // Save attribute values. - maxEntryLength_ = maxEntryLength; - saveSenderInformation_ = saveSenderInformation; - FIFO_ = true; // Keyed queues always FIFO. - forceToAuxiliaryStorage_ = forceToAuxiliaryStorage; - description_ = description; - - keyLength_ = keyLength; - - // Send create request. - impl_.create(maxEntryLength, authority, saveSenderInformation, true, keyLength, forceToAuxiliaryStorage, description); - - if (objectListeners_ != null) fireObjectEvent(ObjectEvent.OBJECT_CREATED); - // Attributes are complete and official. - attributesRetrieved_ = true; - } - - /** - Returns the length of the keys (in bytes) on this queue. - @return The length of the keys. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getKeyLength() throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting key length."); - open(); - if (!attributesRetrieved_) - { - retrieveAttributes(); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Key length:", keyLength_); - return keyLength_; - } - - /** - Reads an entry from the data queue without removing it from the queue. This method will not wait for entries if there are none on the queue. - @param key The array that contains the key used to search for an entry. An entry must have a key equal to this value to be read. - @return The entry read from the queue. If no entries were available, null is returned. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public KeyedDataQueueEntry peek(byte[] key) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - return peek(key, 0, "EQ"); - } - - /** - Reads an entry from the data queue without removing it from the queue. - @param key The array that contains the key used to search for an entry. - @param wait The number of seconds to wait if the queue contains no entries. Negative one (-1) indicates to wait until an entry is available. - @param searchType The type of comparison to use to determine if a key is a match. Valid values are EQ (equal), NE (not equal), LT (less than), LE (less than or equal), GT (greater than), and GE (greater than or equal). - @return The entry read from the queue. If no entries were available, null is returned. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public KeyedDataQueueEntry peek(byte[] key, int wait, String searchType) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Peeking keyed data queue."); - - // Check parameters. - if (key == null) - { - Trace.log(Trace.ERROR, "Parameter 'key' is null."); - throw new NullPointerException("key"); - } - if (key.length > 256) - { - Trace.log(Trace.ERROR, "Length of parameter 'key' is not valid:", key.length); - throw new ExtendedIllegalArgumentException("key.length (" + key.length + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (wait < -1) - { - Trace.log(Trace.ERROR, "Value of parameter 'wait' is not valid:", wait); - throw new ExtendedIllegalArgumentException("wait (" + wait + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (searchType == null) - { - Trace.log(Trace.ERROR, "Parameter 'searchType' is null."); - throw new NullPointerException("searchType"); - } - String search = searchType.toUpperCase(); - if (!search.equals("EQ") && !search.equals("NE") && !search.equals("LT") && !search.equals("LE") && !search.equals("GT") && !search.equals("GE")) - { - Trace.log(Trace.ERROR, "Value of parameter 'searchType' is not valid: " + searchType); - throw new ExtendedIllegalArgumentException("searchType (" + searchType + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - open(); - - // Send request. - DQReceiveRecord record = impl_.read(search, wait, true, key); - if (record == null) return null; - - KeyedDataQueueEntry entry = new KeyedDataQueueEntry(this, record.key_, record.data_, record.senderInformation_); - if (dataQueueListeners_ != null) fireDataQueueEvent(DataQueueEvent.DQ_PEEKED); - return entry; - } - - /** - Reads an entry from the data queue without removing it from the queue. This method will not wait for entries if there are none on the queue. - @param key The string that contains the key used to search for an entry. An entry must have a key equal to this value to be read. - @return The entry read from the queue. If no entries were available, null is returned. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public KeyedDataQueueEntry peek(String key) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - return peek(key, 0, "EQ"); - } - - /** - Reads an entry from the data queue without removing it from the queue. - @param key The string that contains the key used to search for an entry. - @param wait The number of seconds to wait if the queue contains no entries. Negative one (-1) means to wait until an entry is available. - @param searchType The type of comparison to use to determine if a key is a match. Valid values are EQ (equal), NE (not equal), LT (less than), LE (less than or equal), GT (greater than), and GE (greater than or equal). - @return The entry read from the queue. If no entries were available, null is returned. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public KeyedDataQueueEntry peek(String key, int wait, String searchType) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - // Check parameters. - if (key == null) - { - Trace.log(Trace.ERROR, "Parameter 'key' is null."); - throw new NullPointerException("key"); - } - - return peek(convertKey(key), wait, searchType); - } - - /** - Reads an entry from the data queue and removes it from the queue. This method will not wait for entries if there are none on the queue. - @param key The array that contains the key used to search for an entry. An entry must have a key equal to this value to be read. - @return The entry read from the queue. If no entries were available, null is returned. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public KeyedDataQueueEntry read(byte[] key) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - return read(key, 0, "EQ"); - } - - /** - Reads an entry from the data queue and removes it from the queue. - @param key The array that contains the key used to search for an entry. - @param wait The number of seconds to wait if the queue contains no entries. Negative one (-1) indicates to wait until an entry is available. - @param searchType The type of comparison to use to determine if a key is a match. Valid values are EQ (equal), NE (not equal), LT (less than), LE (less than or equal), GT (greater than), and GE (greater than or equal). - @return The entry read from the queue. If no entries were available, null is returned. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public KeyedDataQueueEntry read(byte[] key, int wait, String searchType) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Reading data queue."); - - // Check parameters. - if (key == null) - { - Trace.log(Trace.ERROR, "Parameter 'key' is null."); - throw new NullPointerException("key"); - } - if (key.length > 256) - { - Trace.log(Trace.ERROR, "Length of parameter 'key' is not valid:", key.length); - throw new ExtendedIllegalArgumentException("key.length (" + key.length + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (wait < -1) - { - Trace.log(Trace.ERROR, "Value of parameter 'wait' is not valid:", wait); - throw new ExtendedIllegalArgumentException("wait (" + wait + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (searchType == null) - { - Trace.log(Trace.ERROR, "Parameter 'searchType' is null."); - throw new NullPointerException("searchType"); - } - String search = searchType.toUpperCase(); - if (!search.equals("EQ") && !search.equals("NE") && !search.equals("LT") && !search.equals("LE") && !search.equals("GT") && !search.equals("GE")) - { - Trace.log(Trace.ERROR, "Value of parameter 'searchType' is not valid: " + searchType); - throw new ExtendedIllegalArgumentException("searchType (" + searchType + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - open(); - // Send request. - DQReceiveRecord record = impl_.read(search, wait, false, key); - if (record == null) return null; - - KeyedDataQueueEntry entry = new KeyedDataQueueEntry(this, record.key_, record.data_, record.senderInformation_); - if (dataQueueListeners_ != null) fireDataQueueEvent(DataQueueEvent.DQ_READ); - return entry; - } - - /** - Reads an entry from the data queue and removes it from the queue. This method will not wait for entries if there are none on the queue. - @param key The string that contains the key used to search for an entry. An entry must have a key equal to this value to be read. - @return The entry read from the queue. If no entries were available, null is returned. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public KeyedDataQueueEntry read(String key) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - return read(key, 0, "EQ"); - } - - /** - Reads an entry from the data queue and removes it from the queue. - @param key The string that contains the key used to search for an entry. - @param wait The number of seconds to wait if the queue contains no entries. Negative one (-1) indicates to wait until an entry is available. - @param searchType The type of comparison to use to determine if a key is a match. Valid values are EQ (equal), NE (not equal), LT (less than), LE (less than or equal), GT (greater than), and GE (greater than or equal). - @return The entry read from the queue. If no entries were available, null is returned. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public KeyedDataQueueEntry read(String key, int wait, String searchType) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - // Check parameters. - if (key == null) - { - Trace.log(Trace.ERROR, "Parameter 'key' is null."); - throw new NullPointerException("key"); - } - return read(convertKey(key), wait, searchType); - } - - // Retrieves the attributes of the data queue. This method assumes that the connection to the system has been started. It must only be called by open(). - void retrieveAttributes() throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving keyed data queue attributes."); - // Send attribute request. - DQQueryRecord record = impl_.retrieveAttributes(true); - - maxEntryLength_ = record.maxEntryLength_; - saveSenderInformation_ = record.saveSenderInformation_; - FIFO_ = true; // Keyed queues always FIFO. - forceToAuxiliaryStorage_ = record.forceToAuxiliaryStorage_; - description_ = record.description_; - - keyLength_ = record.keyLength_; - - attributesRetrieved_ = true; - } - - /** - Returns the String representation of this keyed data queue object. - @return The String representation of this keyed data queue object. - **/ - public String toString() - { - return "KeyedDataQueue " + super.toString(); - } - - /** - Writes an entry to the data queue. - @param key The array that contains the key for this entry. - @param data The array of bytes to write to the queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void write(byte[] key, byte[] data) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Writing keyed data queue."); - - // Check parameters. - if (key == null) - { - Trace.log(Trace.ERROR, "Parameter 'key' is null."); - throw new NullPointerException("key"); - } - if (key.length > 256) - { - Trace.log(Trace.ERROR, "Length of parameter 'key' is not valid:", key.length); - throw new ExtendedIllegalArgumentException("key.length (" + key.length + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (data == null) - { - Trace.log(Trace.ERROR, "Parameter 'data' is null."); - throw new NullPointerException("data"); - } - if (data.length > 64512) - { - Trace.log(Trace.ERROR, "Length of parameter 'data' is not valid:", data.length); - throw new ExtendedIllegalArgumentException("data.length (" + data.length + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - open(); - // Send write request. - impl_.write(key, data); - if (dataQueueListeners_ != null) fireDataQueueEvent(DataQueueEvent.DQ_WRITTEN); - } - - /** - Writes a string entry to the data queue. - @param key The string that contains the key for this entry. - @param data The string to write to the queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void write(String key, String data) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - // Check parameters. - if (key == null) - { - Trace.log(Trace.ERROR, "Parameter 'key' is null."); - throw new NullPointerException("key"); - } - if (data == null) - { - Trace.log(Trace.ERROR, "Parameter 'data' is null."); - throw new NullPointerException("data"); - } - - write(convertKey(key), stringToByteArray(data)); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/KeyedDataQueue16.gif b/cvsroot/src/com/ibm/as400/access/KeyedDataQueue16.gif deleted file mode 100644 index 34c361fcb..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/KeyedDataQueue16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/KeyedDataQueue32.gif b/cvsroot/src/com/ibm/as400/access/KeyedDataQueue32.gif deleted file mode 100644 index 668529b8a..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/KeyedDataQueue32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/KeyedDataQueueBeanInfo.java b/cvsroot/src/com/ibm/as400/access/KeyedDataQueueBeanInfo.java deleted file mode 100644 index 302cde567..000000000 --- a/cvsroot/src/com/ibm/as400/access/KeyedDataQueueBeanInfo.java +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: KeyedDataQueueBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; - -/** - The KeyedDataQueueBeanInfo class provides bean information for the KeyedDataQueue class. - **/ -public class KeyedDataQueueBeanInfo extends BaseDataQueueBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class BEAN_CLASS = KeyedDataQueue.class; - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("KeyedDataQueue16.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("KeyedDataQueue32.gif"); - } - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/KeyedDataQueueEntry.java b/cvsroot/src/com/ibm/as400/access/KeyedDataQueueEntry.java deleted file mode 100644 index 424e0d431..000000000 --- a/cvsroot/src/com/ibm/as400/access/KeyedDataQueueEntry.java +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: KeyedDataQueueEntry.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; - -/** - The KeyedDataQueueEntry class represents an entry on a keyed data queue. - **/ -public class KeyedDataQueueEntry extends DataQueueEntry -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // The key for this entry. - byte[] key_; - - // Constructs a KeyedDataQueueEntry object. - // @param key The key of the entry read. - // @param data The data of the entry read. - // @param senderInfo The sender information of the entry read. This may be null. - KeyedDataQueueEntry(BaseDataQueue dq, byte[] key, byte[] data, String senderInfo) - { - super(dq, data, senderInfo); - key_ = key; - } - - /** - Returns the key for this data queue entry. - @return The key for this data queue entry. - **/ - public byte[] getKey() - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Getting data queue key."); - return key_; - } - - /** - Returns the key for this data queue entry as a string. - @return The key for this data queue entry as a string. - @exception UnsupportedEncodingException If the ccsid is not supported. - **/ - public String getKeyString() throws UnsupportedEncodingException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Getting data queue key as String."); - - int length = key_.length; - while (length >= 1 && key_[length - 1] == 0) --length; - byte[] copy = new byte[length]; - System.arraycopy(key_, 0, copy, 0, length); - return dq_.byteArrayToString(copy); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/KeyedFile.java b/cvsroot/src/com/ibm/as400/access/KeyedFile.java deleted file mode 100644 index ac51de0ac..000000000 --- a/cvsroot/src/com/ibm/as400/access/KeyedFile.java +++ /dev/null @@ -1,1236 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: KeyedFile.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.net.UnknownHostException; -import java.util.Vector; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyVetoException; -import java.math.BigDecimal; - -/** - *The KeyedFile class represents a physical or logical file on the system. - *It allows the user to do the following: - *
      - *
    • Create a physical file by: - *
        - *
      • Specifying a record length. - *
      • Specifying an existing DDS source file. - *
      • Specifying a RecordFormat object that contains a description of the - * record format for the file. - *
      - *
    • Access the records in a file sequentially or by key. - * Note: The read...() methods of this class return records in key order. - *
    • Write records to a file sequentially or by key. - *
    • Update records in a file sequentially or by key. - *
    • Lock a file for different types of access. - *
    • Use commitment control when accessing a file. The user can: - *
        - *
      • Start commitment control for the connection. - *
      • Specify different commitment control lock levels for the individual - * files being accessed. - *
      • Commit and rollback transactions for the connection. - *
      - *
    • Delete a physical or logical file or member. - *
    - *KeyedFile objects generate the following events: - *
      - *
    • FileEvent - *
      The events fired are: - *
        - *
      • FILE_CLOSED - *
      • FILE_CREATED - *
      • FILE_DELETED - *
      • FILE_MODIFIED - *
      • FILE_OPENED - *
      - *
    • PropertyChangeEvent - *
    • VetoableChangeEvent - *
    - *@see MemberList -**/ -public class KeyedFile extends AS400File implements Serializable -{ - static final long serialVersionUID = 4L; - - - /** - *Constant indicating search type of equal. - **/ - static public final int KEY_EQ = 0; - - /** - *Constant indicating search type of greater than. - **/ - static public final int KEY_GT = 1; - - /** - *Constant indicating search type of greater than or equal. - **/ - static public final int KEY_GE = 2; - - /** - *Constant indicating search type of less than. - **/ - static public final int KEY_LT = 3; - - /** - *Constant indicating search type of less than or equal. - **/ - static public final int KEY_LE = 4; - - static protected final int[] TYPE_TABLE = {0x0B, 0x0D, 0x0C, 0x09, 0x0A}; - - /** - *Constructs a KeyedFile object. - **/ - public KeyedFile() - { - } - - /** - *Constructs a KeyedFile object. It uses the specified file. - *If the name for the file does not include a member, the - *first member of the file will be used. - *@param system The system to which to connect. The system cannot - *be null. - *@param name The integrated file system pathname of the file. The name - *cannot be null. - **/ - public KeyedFile(AS400 system, String name) - { - super(system, name); - } - - /** - *Deletes the record specified by key. The file must be open when invoking - *this method. - *@param key The values that make up the key with which to find the record. - *The key must contain at least one element. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. The number of elements in key cannot exceed the - *number of key fields in the record format for this file. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void deleteRecord(Object[] key) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameter(key); //@C0A - // Find the record to delete - impl_.doIt("positionCursorToKey", new Class[] { Object[].class, Integer.TYPE }, new Object[] { key, new Integer(TYPE_TABLE[KEY_EQ]) }); - deleteCurrentRecord(); - } - - - // @A2A - /** - *Deletes the record specified by key. The file must be open when invoking - *this method. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param numberOfKeyFields The number of key fields contained in the byte array key. This number cannot exceed the - *total number of key fields in the record format for this file. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void deleteRecord(byte[] key, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameters(key, numberOfKeyFields); //@C0A - // Find the record to delete - impl_.doIt("positionCursorToKey", new Class[] { byte[].class, Integer.TYPE, Integer.TYPE }, new Object[] { key, new Integer(TYPE_TABLE[KEY_EQ]), new Integer(numberOfKeyFields) }); - deleteCurrentRecord(); - } - - //@C0D - moved code to base class - /** - *Opens the file. The file must not be open when invoking this method. - *If commitment control is not started for the connection, - *commitLockLevel is ignored. The file cursor is positioned prior - *to the first record. If blockingFactor is greater than one (or - *if zero is specified and a blocking factor greater than one is determined - *by the object) and the file is opened for READ_ONLY, the record cache will - *be filled with an initial set of records.
    - *The record format for the file must be set prior to calling this method.
    - *The name of the file and the system to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@see AS400File#refreshRecordCache - *@see AS400File#setRecordFormat - *@param openType The manner in which to open the file. Valid values are: - *
      - *
    • READ_ONLY - *
    • READ_WRITE - *
    • WRITE_ONLY - *
    - *@param blockingFactor The number of records to retrieve or to write during a - *read or write operation.
    - *The AS400File object will attempt to anticipate the need for data by accessing - *blocks of records if the openType is READ_ONLY. If the openType - *is WRITE_ONLY, blockingFactor number of records will be written at one - *time when writing an array of records. - *If the open type is READ_WRITE, blockingFactor is ignored and a - *blocking factor of 1 will be used for data integrity reasons. - *Specify an appropriate blockingFactor for your performance needs.
    - *If 0 is specified for blockingFactor, a default value will be calculated - *by taking the integer result of dividing 2048 by the byte length of the record - *plus 16.
    - *If the user either specifies a blocking factor greater than 1, or specifies 0 - *which will cause a blocking factor to be calculated, there is the risk of - *obtaining stale data when doing multiple read operations. - *Invoke the refreshRecordCache() method prior to reading a record to cause the object - *to read from the system if this is a problem.
    - *@param commitLockLevel Used to control record locking during a transaction if - *commitment control has been started for the connection. - *Valid values are: - *
      - *
    • COMMIT_LOCK_LEVEL_ALL - *
    • COMMIT_LOCK_LEVEL_CHANGE - *
    • COMMIT_LOCK_LEVEL_CURSOR_STABILITY - *
    • COMMIT_LOCK_LEVEL_DEFAULT - *
    • COMMIT_LOCK_LEVEL_NONE - *
    - *The commitLockLevel is ignored if commitment control is not started for - *the connection. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ -/* @C0D public void open(int openType, int blockingFactor, int commitLockLevel) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify the object state - if (recordFormat_ == null) - { - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - // Verify the parameters - if (openType != READ_ONLY && - openType != READ_WRITE && - openType != WRITE_ONLY) - { - throw new ExtendedIllegalArgumentException("openType", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (blockingFactor < 0) - { - throw new ExtendedIllegalArgumentException("blockingFactor", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (commitLockLevel < 0 || commitLockLevel > 4) - { - throw new ExtendedIllegalArgumentException("commitLockLevel", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - // Open the file - openFile(openType, blockingFactor, commitLockLevel, "key"); - } -*/ // @C0D - - /** - *Positions the file cursor to the first record matching the specified - *key. The file must be open when invoking this method. - *@param key The values that make up the key with which to find the record. - *The key must contain at least one element. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void positionCursor(Object[] key) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - positionCursor(key, KEY_EQ); - } - - - - // @A2A - /** - *Positions the file cursor to the first record matching the specified - *key. The file must be open when invoking this method. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void positionCursor(byte[] key, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - positionCursor(key, KEY_EQ, numberOfKeyFields); - } - - - - - /** - *Positions the file cursor to the first record meeting the specified search criteria - *based on key. The searchType indicates that the cursor should be - *positioned to the record whose key first meets the search criteria when compared - *to key. The file must be open when invoking this method. - *@param key The values that make up the key with which to find the record. - *The key must contain at least one element. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param searchType Constant indicating the type of match required. Valid values are: - *
      - *
    • KEY_EQ
      - *First record whose key is equal to key. - *
    • KEY_LT
      - *First record whose key is less than key. - *
    • KEY_LE
      - *First record whose key is less than or equal to key. - *
    • KEY_GT
      - *First record whose key is greater than key. - *
    • KEY_GE
      - *First record whose key is greater than or equal to key. - *
    - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void positionCursor(Object[] key, int searchType) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameter(key); //@C0A - if (searchType < KEY_EQ || searchType > KEY_LE) - { - throw new ExtendedIllegalArgumentException("searchType", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - impl_.doIt("positionCursor", new Class[] { Object[].class, Integer.TYPE }, new Object[] { key, new Integer(TYPE_TABLE[searchType]) }); - } - - // @A2A - /** - *Positions the file cursor to the first record meeting the specified search criteria - *based on key. The searchType indicates that the cursor should be - *positioned to the record whose key first meets the search criteria when compared - *to key. The file must be open when invoking this method. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param searchType Constant indicating the type of match required. Valid values are: - *
      - *
    • KEY_EQ
      - *First record whose key is equal to key. - *
    • KEY_LT
      - *First record whose key is less than key. - *
    • KEY_LE
      - *First record whose key is less than or equal to key. - *
    • KEY_GT
      - *First record whose key is greater than key. - *
    • KEY_GE
      - *First record whose key is greater than or equal to key. - *
    - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void positionCursor(byte[] key, int searchType, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameters(key, numberOfKeyFields); //@C0A - if (searchType < KEY_EQ || searchType > KEY_LE) - { - throw new ExtendedIllegalArgumentException("searchType", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - impl_.doIt("positionCursor", new Class[] { byte[].class, Integer.TYPE, Integer.TYPE }, new Object[] { key, new Integer(TYPE_TABLE[searchType]), new Integer(numberOfKeyFields) }); - } - - - /** - *Positions the file cursor to the first record after the record specified - *by key. The file must be open when invoking this method. - *@param key The values which make up the key with which to find the record. - *The key must contain at least one element. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void positionCursorAfter(Object[] key) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameter(key); //@C0A - impl_.doIt("positionCursorAfter", new Class[] { Object[].class }, new Object[] { key }); - } - - - // @A2A - /** - *Positions the file cursor to the first record after the record specified - *by key. The file must be open when invoking this method. - *@param key The byte array that contains the byte values which make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void positionCursorAfter(byte[] key, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameters(key, numberOfKeyFields); //@C0A - impl_.doIt("positionCursorAfter", new Class[] { byte[].class, Integer.TYPE }, new Object[] { key, new Integer(numberOfKeyFields) }); - } - - - /** - *Positions the file cursor to the first record before the record specified - *by key. The file must be open when invoking this method. - *@param key The values which make up the key with which to find the record. - *The key must contain at least one element. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void positionCursorBefore(Object[] key) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameter(key); //@C0A - impl_.doIt("positionCursorBefore", new Class[] { Object[].class }, new Object[] { key }); - } - - - // @A2A - /** - *Positions the file cursor to the first record before the record specified - *by key. The file must be open when invoking this method. - *@param key The byte array that contains the byte values which make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void positionCursorBefore(byte[] key, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameters(key, numberOfKeyFields); //@C0A - impl_.doIt("positionCursorBefore", new Class[] { byte[].class, Integer.TYPE }, new Object[] { key, new Integer(numberOfKeyFields) }); - } - - - /** - *Reads the first record with the specified key. The file must be open when - *invoking this method. - *@param key The values that make up the key with which to find the record. - *The key must contain at least one element. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record read(Object[] key) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - return read(key, KEY_EQ); - } - - - // @A2A - /** - *Reads the first record with the specified key. The file must be open when - *invoking this method. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record read(byte[] key, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - return read(key, KEY_EQ, numberOfKeyFields); - } - - - - /** - *Reads the first record meeting the specified search criteria based on - *key. The searchType indicates that the record whose key first meets - *the search criteria when compared to key should be returned. The file must - *be open when invoking this method. - *@param key The values that make up the key with which to find the record. - *The key must contain at least one element. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param searchType Constant indicating the type of match required. Valid values are: - *
      - *
    • KEY_EQ
      - *First record whose key is equal to key. - *
    • KEY_LT
      - *First record whose key is less than key. - *
    • KEY_LE
      - *First record whose key is less than or equal to key. - *
    • KEY_GT
      - *First record whose key is greater than key. - *
    • KEY_GE
      - *First record whose key is greater than or equal to key. - *
    - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record read(Object[] key, int searchType) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameter(key); //@C0A - if (searchType < KEY_EQ || searchType > KEY_LE) - { - throw new ExtendedIllegalArgumentException("searchType", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - return fillInRecord(impl_.doItRecord("read", new Class[] { Object[].class, Integer.TYPE }, new Object[] { key, new Integer(TYPE_TABLE[searchType]) })); //@D0C - } - - - - // @A2A - /** - *Reads the first record meeting the specified search criteria based on - *key. The searchType indicates that the record whose key first meets - *the search criteria when compared to key should be returned. The file must - *be open when invoking this method. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param searchType Constant indicating the type of match required. Valid values are: - *
      - *
    • KEY_EQ
      - *First record whose key is equal to key. - *
    • KEY_LT
      - *First record whose key is less than key. - *
    • KEY_LE
      - *First record whose key is less than or equal to key. - *
    • KEY_GT
      - *First record whose key is greater than key. - *
    • KEY_GE
      - *First record whose key is greater than or equal to key. - *
    - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record read(byte[] key, int searchType, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameters(key, numberOfKeyFields); //@C0A - if (searchType < KEY_EQ || searchType > KEY_LE) - { - throw new ExtendedIllegalArgumentException("searchType", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - return fillInRecord(impl_.doItRecord("read", new Class[] { byte[].class, Integer.TYPE, Integer.TYPE }, new Object[] { key, new Integer(TYPE_TABLE[searchType]), new Integer(numberOfKeyFields) })); //@D0C - } - - - /** - *Reads the first record after the record with the specified key. The file must - *be open when invoking this method. - *@param key The values that make up the key with which to find the record. - *The key must contain at least one element. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record readAfter(Object[] key) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameter(key); //@C0A - return fillInRecord(impl_.doItRecord("readAfter", new Class[] { Object[].class }, new Object[] { key })); //@D0C - } - - - // @A2A - /** - *Reads the first record after the record with the specified key. The file must - *be open when invoking this method. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record readAfter(byte[] key, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameters(key, numberOfKeyFields); //@C0A - return fillInRecord(impl_.doItRecord("readAfter", new Class[] { byte[].class, Integer.TYPE }, new Object[] { key, new Integer(numberOfKeyFields) })); //@D0C - } - - - /** - *Reads all the records in the file. The file must be closed when invoking this method. - *The record format for the file must have been set prior to invoking this method. - *@return The records read. If no records are read, an array of size zero is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public Record[] readAll() - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException - { - if (isOpen_) - { - throw new ExtendedIllegalStateException(ExtendedIllegalStateException.OBJECT_CAN_NOT_BE_OPEN); - } - if (recordFormat_ == null) - { - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Read all records. - // Since readAll() now behaves under-the-covers like readNext(), - // need to open the file. Also synchronize on this, because - // the file isn't supposed to be open and this might mess up - // other references to this object, which expect it to be closed. - // See AS400FileImplRemote.readAll() for information regarding - // changes in the under-the-covers behavior. - chooseImpl(); - // Before we calculate, make sure the record format has had - // its text objects initialized. - recordFormat_.initializeTextObjects(system_); //@D0A - - // Use a calculated blocking factor, else use a large blocking factor - int bf = 2048/(recordFormat_.getNewRecord().getRecordLength() + 16); //@D0M - if (bf <= 1) bf = 100; //@D0M - - Record[] recs = impl_.doItRecordArray("readAll", new Class[] { String.class, Integer.TYPE }, new Object[] { "key", new Integer(bf) }); //@D0C - //@D0A - if (recs != null) - { - for (int i=0; ikey must contain at least one element. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record readBefore(Object[] key) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameter(key); //@C0A - return fillInRecord(impl_.doItRecord("readBefore", new Class[] { Object[].class }, new Object[] { key })); //@D0C - } - - - // @A2A - /** - *Reads the first record before the record with the specified key. The file must - *be open when invoking this method. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record readBefore(byte[] key, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameters(key, numberOfKeyFields); //@C0A - return fillInRecord(impl_.doItRecord("readBefore", new Class[] { byte[].class, Integer.TYPE }, new Object[] { key, new Integer(numberOfKeyFields) })); //@D0C - } - - - /** - *Reads the next record whose key matches the full key of the current record. - *The file must be open when invoking this method. The file must be - *positioned on an active record when invoking this method. - *
    Note: If the application has previously called setReadNoUpdate(false), - *then this method issues a request to the server which locks the record - *returned to the client. The key comparison occurs on the client side. - *Therefore, even though the record may not match the key (and null - *is returned by readNextEqual), the server side will lock the most - *recent record which may have been read from the file. - *A subsequent call to any of the positionCursor() methods will unlock - *the last (i.e. most recent) record locked. In addition, the close() - *method will also unlock the last (i.e. most recent) record locked. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record readNextEqual() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify object state - checkOpen(); - return fillInRecord(impl_.doItRecord("readNextEqual", new Class[0], new Object[0])); //@D0C - } - - - /** - *Reads the next record whose key matches the specified key. The search does - *not include the current record. The key may be a partial key. - *The file must be open when invoking this method. - *
    Note: If the application has previously called setReadNoUpdate(false), - *then this method issues a request to the server which locks the record - *returned to the client. The key comparison occurs on the client side. - *Therefore, even though the record may not match the key (and null - *is returned by readNextEqual), the server side will lock the most - *recent record which may have been read from the file. - *A subsequent call to any of the positionCursor() methods will unlock - *the last (i.e. most recent) record locked. In addition, the close() - *method will also unlock the last (i.e. most recent) record locked. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record readNextEqual(Object[] key) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameter(key); //@C0A - return fillInRecord(impl_.doItRecord("readNextEqual", new Class[] { Object[].class }, new Object[] { key })); //@D0C - } - - - // @A2A - /** - *Reads the next record whose key matches the specified key. The search does - *not include the current record. The key may be a partial key. - *The file must be open when invoking this method. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *
    Note: If the application has previously called setReadNoUpdate(false), - *then this method issues a request to the server which locks the record - *returned to the client. The key comparison occurs on the client side. - *Therefore, even though the record may not match the key (and null - *is returned by readNextEqual), the server side will lock the most - *recent record which may have been read from the file. - *A subsequent call to any of the positionCursor() methods will unlock - *the last (i.e. most recent) record locked. In addition, the close() - *method will also unlock the last (i.e. most recent) record locked. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record readNextEqual(byte[] key, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameters(key, numberOfKeyFields); //@C0A - return fillInRecord(impl_.doItRecord("readNextEqual", new Class[] { byte[].class, Integer.TYPE }, new Object[] { key, new Integer(numberOfKeyFields) })); //@D0C - } - - - /** - *Overrides the ObjectInputStream.readObject() method in order to return any - *transient parts of the object to there properly initialized state. We also - *generate a declared file name for the object. I.e we in effect - *call the null constructor. By calling ObjectInputStream.defaultReadObject() - *we restore the state of any non-static and non-transient variables. We - *then continue on to restore the state (as necessary) of the remaining variables. - *@param in The input stream from which to deserialize the object. - - *@exception ClassNotFoundException If the class being deserialized is not found. - *@exception IOException If an error occurs during deserialization. - **/ - private void readObject(java.io.ObjectInputStream in) - throws ClassNotFoundException, - IOException - { - in.defaultReadObject(); - initializeTransient(); //@C0C - } - - - /** - *Reads the previous record whose key matches the key of the current record. - * The file must be open when invoking this method. The file must be - *positioned on an active record when invoking this method. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record readPreviousEqual() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify object state - checkOpen(); - return fillInRecord(impl_.doItRecord("readPreviousEqual", new Class[0], new Object[0])); //@D0C - } - - - /** - *Reads the previous record whose key matches the specified key. The search does - *not include the current record. The key may be a partial key. - *The file must be open when invoking this method. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record readPreviousEqual(Object[] key) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameter(key); //@C0A - return fillInRecord(impl_.doItRecord("readPreviousEqual", new Class[] { Object[].class }, new Object[] { key })); //@D0C - } - - - // @A2A - /** - *Reads the previous record whose key matches the specified key. The search does - *not include the current record. The key may be a partial key. - *The file must be open when invoking this method. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record readPreviousEqual(byte[] key, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - checkParameters(key, numberOfKeyFields); //@C0A - return fillInRecord(impl_.doItRecord("readPreviousEqual", new Class[] { byte[].class, Integer.TYPE }, new Object[] { key, new Integer(numberOfKeyFields) })); //@D0C - } - - - /** - *Updates the record specified by key. The file must be open when invoking - *this method. - *@param key The values that make up the key with which to find the record. - *The key must contain at least one element. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param record The record with which to update the existing record. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void update(Object[] key, Record record) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify parameters - if (record == null) - { - throw new NullPointerException("record"); - } - positionCursor(key); - update(record); - } - - - // @A2A - /** - *Updates the record specified by key. The file must be open when invoking - *this method. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param record The record with which to update the existing record. - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void update(byte[] key, Record record, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify parameters - if (record == null) - { - throw new NullPointerException("record"); - } - - positionCursor(key, numberOfKeyFields); - update(record); - } - - - - /** - *Updates the first record meeting the specified search criteria based on - *key. The searchType indicates that the record whose key first meets - *the search criteria when compared to key should be returned. The file - *must be open when invoking this method. - *@param key The values that make up the key with which to find the record. - *The key must contain at least one element. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param record The record with which to update the existing record. - *@param searchType Constant indicating the type of match required. Valid values are: - *
      - *
    • KEY_EQ
      - *First record whose key is equal to key. - *
    • KEY_LT
      - *First record whose key is less than key. - *
    • KEY_LE
      - *First record whose key is less than or equal to key. - *
    • KEY_GT
      - *First record whose key is greater than key. - *
    • KEY_GE
      - *First record whose key is greater than or equal to key. - *
    - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void update(Object[] key, Record record, int searchType) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify parameters - if (record == null) - { - throw new NullPointerException("record"); - } - positionCursor(key, searchType); - update(record); - } - - - - // @A2A - /** - *Updates the first record meeting the specified search criteria based on - *key. The searchType indicates that the record whose key first meets - *the search criteria when compared to key should be returned. The file - *must be open when invoking this method. - *@param key The byte array that contains the byte values that make up the key with which to find the record. - *The byte array key must contain the byte values from at least one key field. The types and order of - *the elements that make up key must match the type and order of the - *key fields in the record format for this object. Null values for key fields - *are not supported. - *@param record The record with which to update the existing record. - *@param searchType Constant indicating the type of match required. Valid values are: - *
      - *
    • KEY_EQ
      - *First record whose key is equal to key. - *
    • KEY_LT
      - *First record whose key is less than key. - *
    • KEY_LE
      - *First record whose key is less than or equal to key. - *
    • KEY_GT
      - *First record whose key is greater than key. - *
    • KEY_GE
      - *First record whose key is greater than or equal to key. - *
    - *@param numberOfKeyFields The number of key fields contained in the byte array key. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void update(byte[] key, Record record, int searchType, int numberOfKeyFields) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify parameters - if (record == null) - { - throw new NullPointerException("record"); - } - positionCursor(key, searchType, numberOfKeyFields); - update(record); - } - - - //@C0A - /** - * Make sure the file is open and the key is valid. - **/ - private void checkParameter(Object[] key) - { - if (key == null) - { - throw new NullPointerException("key"); - } - if (key.length == 0) - { - throw new ExtendedIllegalArgumentException("key", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (key.length > recordFormat_.getNumberOfKeyFields()) - { - throw new ExtendedIllegalArgumentException("key", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - for (int i=0; i recordFormat_.getNumberOfKeyFields())) - { - throw new ExtendedIllegalArgumentException("numberOfKeyFields", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - checkOpen(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/KeyedFile16.gif b/cvsroot/src/com/ibm/as400/access/KeyedFile16.gif deleted file mode 100644 index 08f52ed25..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/KeyedFile16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/KeyedFile32.gif b/cvsroot/src/com/ibm/as400/access/KeyedFile32.gif deleted file mode 100644 index 30d14f417..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/KeyedFile32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/KeyedFileBeanInfo.java b/cvsroot/src/com/ibm/as400/access/KeyedFileBeanInfo.java deleted file mode 100644 index db526c3d0..000000000 --- a/cvsroot/src/com/ibm/as400/access/KeyedFileBeanInfo.java +++ /dev/null @@ -1,232 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: KeyedFileBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2008 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @A1 12/12/2007 Correct EventSet for VetoablePropertyChange -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.lang.reflect.Method; //@B0A - -/** - *The KeyedFileBeanInfo class provides - *BeanInfo for the KeyedFile class. -**/ -public class KeyedFileBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Bean class - private final static Class beanClass_ = KeyedFile.class; - - - // BeanDescriptor for this class - private static BeanDescriptor beanDescriptor_ = new BeanDescriptor(KeyedFile.class); - - - // Set of event descriptors for this class: - // PropertyChange, VetoableChange, RecordDescriptionEvent.FIELD_MODIFIED - private static EventSetDescriptor[] eventSet_ = new EventSetDescriptor[3]; - - - // Set of property descriptors for this class - // memberName, fileName, recordFormat, path, system - private static PropertyDescriptor[] propertySet_ = new PropertyDescriptor[5]; - - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - - -/** - * Constructs a KeyedFileBeanInfo object. - **/ - public KeyedFileBeanInfo() - { - try - { - // Populate the event descriptor set - // FileEvent - String[] listenerMethods = {"fileClosed", "fileCreated", "fileDeleted", - "fileModified", "fileOpened"}; - eventSet_[0] = new EventSetDescriptor(beanClass_, "file", - FileListener.class, - listenerMethods, "addFileListener", - "removeFileListener"); - eventSet_[0].setDisplayName(loader_.getText("EVT_NAME_FILE_EVENT")); - eventSet_[0].setShortDescription(loader_.getText("EVT_DESC_FILE_EVENT")); - - - // PropertyChangeEvent - eventSet_[1] = new EventSetDescriptor(beanClass_, "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - eventSet_[1].setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - eventSet_[1].setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - - // VetoablePropertyChange - eventSet_[2] = new EventSetDescriptor(beanClass_, "propertyChange", //@A1C - java.beans.VetoableChangeListener.class, - "vetoableChange"); - eventSet_[2].setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - eventSet_[2].setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - } - catch(IntrospectionException e) - { - throw new Error(e.toString()); - } - - try - { - // Populate the property descriptor set - // getFileName - propertySet_[0] = new PropertyDescriptor("fileName", beanClass_, - "getFileName", null); - propertySet_[0].setBound(true); - propertySet_[0].setConstrained(false); - propertySet_[0].setDisplayName(loader_.getText("PROP_NAME_FILE_NAME")); - propertySet_[0].setShortDescription(loader_.getText("PROP_DESC_FILE_NAME")); - - - // getKeyFields - propertySet_[1] = new PropertyDescriptor("memberName", beanClass_, - "getMemberName", null); - propertySet_[1].setBound(true); - propertySet_[1].setConstrained(false); - propertySet_[1].setDisplayName(loader_.getText("PROP_NAME_MEMBER")); - propertySet_[1].setShortDescription(loader_.getText("PROP_DESC_MEMBER")); - - - // get/setPath - propertySet_[2] = new PropertyDescriptor("path", beanClass_, - "getPath", - "setPath"); - propertySet_[2].setBound(true); - propertySet_[2].setConstrained(true); - propertySet_[2].setDisplayName(loader_.getText("PROP_NAME_PATH")); - propertySet_[2].setShortDescription(loader_.getText("PROP_DESC_PATH")); - - - // get/setRecordFormat -//@B0D propertySet_[3] = new PropertyDescriptor("recordFormat", beanClass_, -//@B0D "getRecordFormat", -//@B0D "setRecordFormat"); - Method getter = beanClass_.getMethod("getRecordFormat", (java.lang.Class []) null); //@B0A //@pdc cast for jdk1.5 - Method setter = beanClass_.getMethod("setRecordFormat", new Class[] { RecordFormat.class }); //@B0A - propertySet_[3] = new PropertyDescriptor("recordFormat", getter, setter); //@B0A - propertySet_[3].setBound(true); - propertySet_[3].setConstrained(true); - propertySet_[3].setDisplayName(loader_.getText("PROP_NAME_RECORD_FORMAT")); - propertySet_[3].setShortDescription(loader_.getText("PROP_DESC_RECORD_FORMAT")); - - - // get/setSystem - propertySet_[4] = new PropertyDescriptor("system", beanClass_, - "getSystem", - "setSystem"); - propertySet_[4].setBound(true); - propertySet_[4].setConstrained(true); - propertySet_[4].setDisplayName(loader_.getText("PROP_NAME_SYSTEM")); - propertySet_[4].setShortDescription(loader_.getText("PROP_DESC_SYSTEM")); - - - } - catch(Exception e) //@B0C - { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) //@B0A - { //@B0A - Trace.log(Trace.ERROR, "Failed to initialize KeyedFileBeanInfo.", e); //@B0A - } //@B0A - throw new Error(e.toString()); - } - } - - /** - *Returns the bean descriptor. - *@return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - /** - *Returns the index of the default event. - *@return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the property change event - return 0; - } - - - /** - *Returns the index of the default property. - *@return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the default property - return 0; - } - - - /** - *Returns the set of event descriptors. - *@return The event descriptor set. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSet_; - } - - /** - *Returns the property descriptors. - *@return The property descriptors. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertySet_; - } - - /** - *Returns the icon image for a KeyedFile bean. - *@return The icon image. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("KeyedFile16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("KeyedFile32.gif"); - break; - } - return image; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/License16.gif b/cvsroot/src/com/ibm/as400/access/License16.gif deleted file mode 100644 index bdbd92fc3..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/License16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/License32.gif b/cvsroot/src/com/ibm/as400/access/License32.gif deleted file mode 100644 index 6dbd056a2..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/License32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/LicenseBaseReply.java b/cvsroot/src/com/ibm/as400/access/LicenseBaseReply.java deleted file mode 100644 index 75731a4d9..000000000 --- a/cvsroot/src/com/ibm/as400/access/LicenseBaseReply.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: LicenseBaseReply.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/**

    This class is used to access certain information from the release license reply datastream.

    -**/ -class LicenseBaseReply extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - protected int primaryRC_=0; // return code returned by server - protected int secondaryRC_=0; // return code returned by server - - - /**

    REPLY_PRIMARY_RETURN_CODE_LOCATION - Location of the primary return code in the reply datastream.

    **/ - static final int REPLY_PRIMARY_RETURN_CODE_LOCATION = 22; - - /**

    REPLY_SECONDARY_RETURN_CODE_LOCATION - Location of the secondary return code in the reply datastream.

    **/ - static final int REPLY_SECONDARY_RETURN_CODE_LOCATION = 24; - - - - LicenseBaseReply() - { - super(); - } - - /**

    This method creates a new LicenseReleaseReply object.

    - **/ - public Object getNewDataStream() - { - return new LicenseBaseReply(); - } - - /**

    This method returns the primary retrun code for the license release datastream.

    - **/ - public int getPrimaryRC() - { - return get16bit(REPLY_PRIMARY_RETURN_CODE_LOCATION); - } - - /**

    This method returns the secondary retrun code for the license release datastream.

    - **/ - public int getSecondaryRC() - { - return get16bit(REPLY_SECONDARY_RETURN_CODE_LOCATION); - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/LicenseBaseRequest.java b/cvsroot/src/com/ibm/as400/access/LicenseBaseRequest.java deleted file mode 100644 index d119dec70..000000000 --- a/cvsroot/src/com/ibm/as400/access/LicenseBaseRequest.java +++ /dev/null @@ -1,173 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: LicenseBaseRequest.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// import java.net.* Don't seem to need this -import java.io.CharConversionException; -import java.io.IOException; -import java.io.UnsupportedEncodingException; - - -/** -*

    This class is the header and common information for the data streams -* that request information from the Central Server -*

    -**/ - -class LicenseBaseRequest extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - protected CharConverter conv_; - - /**

    PRODUCT_ID_CCSID_LOCATION - Location of the CCSID for productID in the datastream.

    **/ - static final int PRODUCT_ID_CCSID_LOCATION = 22; - - /**

    PRODUCT_ID_LOCATION - Location of the productID in the datastream.

    **/ - static final int PRODUCT_ID_LOCATION = 26; - - /**

    FEATURE_CCSID_LOCATION - Location of the CCSID for product feature code in the datastream.

    **/ - static final int FEATURE_CCSID_LOCATION = 33; - - /**

    FEATURE_LOCATION - Location of the product feature code in the datastream.

    **/ - static final int FEATURE_LOCATION = 37; - - /**

    RELEASE_CCSID_LOCATION - Location of the CCSID for product release in the datastream.

    **/ - static final int RELEASE_CCSID_LOCATION = 41; - - /**

    RELEASE_LOCATION - Location of the product release in the datastream.

    **/ - static final int RELEASE_LOCATION = 45; - - - /** - *

    The ctor sets the header and blanks out the common information.

    - **/ - LicenseBaseRequest(int size, AS400 system) - { - super(); - data_ = new byte [size]; - setLength(size); - setHeaderID(0); - setServerID(0xe000); - setCSInstance(0); - setCorrelation(0); - setTemplateLen(size - 20); - - set16bit(0, 20); // chain, not used - - int i; - - // blank fill product id - for (i=0; i<7; i++) - { - data_[PRODUCT_ID_LOCATION+i] = (byte)0x40; - } - - // blank fill feature - for (i=0; i<4; i++) - { - data_[FEATURE_LOCATION+i] = (byte)0x40; - } - - // blank fill release - for (i=0; i<6; i++) - { - data_[RELEASE_LOCATION+i] = (byte)0x40; - } - - set32bit(37, PRODUCT_ID_CCSID_LOCATION); // product ID ccsid - set32bit(37, FEATURE_CCSID_LOCATION); // feature ccsid - set32bit(37, RELEASE_CCSID_LOCATION); // release ccsid - - try - { - // Needed to switch to the public CharConverter class - // rather than the package converter class that was - // removed. The CharConverter class takes a AS400 object - // for its ctor. - conv_ = new CharConverter(37, system); - } - catch (UnsupportedEncodingException exc) - { - if(Trace.isTraceOn()) - { - Trace.log(Trace.ERROR, "Unsupported encoding exception - CCSID 37."); - } - - } - - set16bit(0, size-2); // optional parameter count - } - - /** - *

    The setProductID function converts the product ID passed in to the - * the EBCDIC CCSID and sets it into the data stream.

    - **/ - void setProductID(String productID) - { - try - { - conv_.stringToByteArray(productID, data_, PRODUCT_ID_LOCATION, 7); - } - catch (CharConversionException e) - { - if(Trace.isTraceOn()) - { - Trace.log(Trace.ERROR, "Character conversion exception - productID: " + productID); - } - } - } - - /** - *

    The setFeature function converts the product feature passed in to the - * the EBCDIC CCSID and sets it into the data stream.

    - **/ - void setFeature(String feature) - { - try - { - conv_.stringToByteArray(feature, data_, FEATURE_LOCATION, 4); - } - catch (CharConversionException e) - { - if(Trace.isTraceOn()) - { - Trace.log(Trace.ERROR, "Character conversion exception - feature: " + feature); - } - - } - } - - /** - *

    The setRelease function converts the product release passed in to the - * the EBCDIC CCSID and sets it into the data stream.

    - **/ - void setRelease(String release) - { - try - { - conv_.stringToByteArray(release, data_, RELEASE_LOCATION, 6); - } - catch (CharConversionException e) - { - if(Trace.isTraceOn()) - { - Trace.log(Trace.ERROR, "Character conversion exception - release: " + release); - } - - } - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/LicenseException.java b/cvsroot/src/com/ibm/as400/access/LicenseException.java deleted file mode 100644 index 938665115..000000000 --- a/cvsroot/src/com/ibm/as400/access/LicenseException.java +++ /dev/null @@ -1,224 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: LicenseException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** -* Indicates an error condition that occured while -* trying to retrieve a license. -**/ -public class LicenseException extends Exception - implements ReturnCodeException -{ - static final long serialVersionUID = 4L; - - - /** - *

    INVALID_REQUEST_CLIENT_NAME - Return code from the Central server when - * the client name is not valid.

    - **/ - // The primary return code is 0001, the secondary return code is 0002 - public static final int INVALID_REQUEST_CLIENT_NAME = 0x00010002; // 65538 - - /** - *

    REQUEST_NOT_VALID_LICENSE_USER_HANDLE - Return code from the Central - * server when the license user handle is not valid.

    - **/ - //The primary return code is 0001, the secondary return code is 0020 - public static final int REQUEST_NOT_VALID_LICENSE_USER_HANDLE = 0x00010020; // 65568 - - /** - *

    REQUEST_NOT_VALID_PRODUCT_ID - Return code from the Central server when - * the product ID is not valid.

    - **/ - // The primary return code is 0001, the secondary return code is 0021 - public static final int REQUEST_NOT_VALID_PRODUCT_ID = 0x00010021; // 65569 - - /** - *

    REQUEST_NOT_VALID_RELEASE - Return code from the Central server when - * the product release is not valid.

    - **/ - // The primary return code is 0001, the secondary return code is 0022 - public static final int REQUEST_NOT_VALID_RELEASE = 0x00010022; // 65570 - - /** - *

    REQUEST_NOT_VALID_FEATURE - Return code from the Central server when - * the product feature ID is not valid.

    - **/ - // The primary return code is 0001, the secondary return code is 0023 - public static final int REQUEST_NOT_VALID_FEATURE = 0x00010023; // 65571 - - /** - *

    REQUEST_NOT_VALID_TYPE_OF_LICENSE_INFO - Return code from the Central server when - * the type of license information requested is not valid.

    - **/ - // The primary return code is 0001, the secondary return code is 0024 - public static final int REQUEST_NOT_VALID_TYPE_OF_LICENSE_INFO = 0x00010024; // 65572 - - /** - *

    DATA_CONVERSION_CLIENT_NAME - Return code from the Central server when - * the client name can not be converted to the job CCSID.

    - **/ - // The primary return code is 0002, the secondary return code is 0002 - public static final int DATA_CONVERSION_CLIENT_NAME = 0x00020002; // 131074 - - /** - *

    DATA_CONVERSION_LICENSE_USER_HANDLE - Return code from the Central server when - * the license handle is not valid.

    - **/ - // The primary return code is 0002, the secondary return code is 0020 - public static final int DATA_CONVERSION_LICENSE_USER_HANDLE = 0x00020020; // 131104 - - /** - *

    DATA_CONVERSION_PRODUCT_ID - Return code from the Central server when the - * product ID can not be converted to the job CCSID.

    - **/ - // The primary return code is 0002, the secondary return code is 0021 - public static final int DATA_CONVERSION_PRODUCT_ID = 0x00020021; // 131105 - - /** - *

    DATA_CONVERSION_RELEASE - Return code from the Central server when the - * product release can not be converted to the job CCSID.

    - **/ - // The primary return code is 0002, the secondary return code is 0022 - public static final int DATA_CONVERSION_RELEASE = 0x00020022; // 131106 - - /** - *

    DATA_CONVERSION_FEATURE - Return code from the Central server when the - * product feature can not be converted to the job CCSID.

    - **/ - // The primary return code is 0002, the secondary return code is 0023 - public static final int DATA_CONVERSION_FEATURE = 0x00020023; // 131107 - - /** - *

    REQUEST_NOT_VALID - Return code from the Central server when the datastream does - * not match the expected datastream.

    - **/ - // The primary return code is 0003, the secondary return code is 0001 - public static final int REQUEST_NOT_VALID = 0x00030001; // 196609 - - /** - *

    ERROR_CALLING_EXIT_PROGRAM - Return code from the Central server when there was - * an error calling the regestered exit program. For example, does not exist.

    - **/ - // The primary return code is 0003, the secondary return code is 0003 - public static final int ERROR_CALLING_EXIT_PROGRAM = 0x00030003; // 196611 - - /** - *

    REJECTED_BY_EXIT_PROGRAM - Return code from the Central server when the - * regestered exit program rejects the request.

    - **/ - // The primary return code is 0003, the secondary return code is 0004 - public static final int REJECTED_BY_EXIT_PROGRAM = 0x00030004; // 196612 - - /** - *

    REQUEST_LICENSE_ERROR - Return code from the Central server when - * an unexpected error is encountered when requesting a license.

    - **/ - // The primary return code is 0003, the secondary return code is 0025 - public static final int REQUEST_LICENSE_ERROR = 0x00030025; // 196645 - - /** - *

    RELEASE_LICENSE_ERROR - Return code from the Central server when - * an unexpected error is encountered when releasing a license.

    - **/ - // The primary return code is 0003, the secondary return code is 0026 - public static final int RELEASE_LICENSE_ERROR = 0x00030026; // 196646 - - /** - *

    RETRIEVE_LICENSE_INFORMATION_ERROR - Return code from the Central server when - * an unexpected error is encountered when requesting information on a license.

    - **/ - // The primary return code is 0003, the secondary return code is 0027 - public static final int RETRIEVE_LICENSE_INFORMATION_ERROR = 0x00030027; // 196647 - - /** - *

    LICENSE_INFORMATION_NOT_FOUND - Return code from the Central server when - * the license information for the product is not available (for example, - * product for specified feature and release was not found.)

    - **/ - // The primary return code is 0003, the secondary return code is 0028 - public static final int LICENSE_INFORMATION_NOT_FOUND = 0x00030028; // 196648 - - /** - *

    LICENSE_INFORMATION_NOT_AVAILABLE - Return code from the Central server when - * an error occurred.

    - **/ - // The primary return code is 0003, the secondary return code is 0029 - public static final int LICENSE_INFORMATION_NOT_AVAILABLE = 0x00030029; // 196649 - - /** - *

    MISMATCH_RELEASE_REQUEST_HANDLE - Return code from the Central server when - * the handle used to attempt to release a license is not the handle that the - * under which the request license was issued.

    - **/ - // The primary return code is 0003, the secondary return code is 002A - public static final int MISMATCH_RELEASE_REQUEST_HANDLE = 0x0003002a; // 196650 - - /** - *

    USAGE_LIMIT_EXCEEDED - Return code from the Central server when the usage limit - * for the product license being requested is exceeded and a license was not granted.

    - **/ - // The primary return code is 0003, the secondary return code is 002D - public static final int USAGE_LIMIT_EXCEEDED = 0x0003002d; // 196653 - - /** - *

    GRACE_PERIOD_EXPIRED - Return code from the Central server when the grace period - * for the product license being requested is exceeded and a license was not granted.

    - **/ - // The primary return code is 0003, the secondary return code is 002F - public static final int GRACE_PERIOD_EXPIRED = 0x0003002f; // 196655 - - /** - *

    EXPIRATION_DATE_REACHED - Return code from the Central server when the expiration - * date for the product license being requested is reached and a license was not granted.

    - **/ - // The primary return code is 0003, the secondary return code is 0030 - public static final int EXPIRATION_DATE_REACHED = 0x00030030; // 196656 - - /** - *

    ERROR_CALLING_USER_EXIT_PROGRAM - Return code from the Central server when in incurred an error from a user exit program.

    - **/ - // The primary return code is 0003, the secondary return code is 0033 - public static final int ERROR_CALLING_USER_EXIT_PROGRAM = 0x00030033; // 196659 - - private int rc; - - /** - * Constructs a LicenseException object. - * @param primaryRC The primary return code returned by the server. - * @param secondaryRC The secondary return code returned by the server. - **/ - LicenseException(int primaryRC, int secondaryRC) - { - super(buildMessage(primaryRC, secondaryRC)); - rc = (primaryRC * 0x10000) + secondaryRC; - } - - private static String buildMessage(int primaryRC, int secondaryRC) - { - return ResourceBundleLoader.getText("LM_EXCEPTION", - new Integer(primaryRC), - new Integer(secondaryRC)); - } - - /** - * Returns the return code. - **/ - - public int getReturnCode() - { - return rc; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/LicenseGetInformationReply.java b/cvsroot/src/com/ibm/as400/access/LicenseGetInformationReply.java deleted file mode 100644 index 0277e887f..000000000 --- a/cvsroot/src/com/ibm/as400/access/LicenseGetInformationReply.java +++ /dev/null @@ -1,49 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: LicenseGetInformationReply.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** -*

    This class provides the interface to retrieve the various information returned in the -* get license information reply datastream. This class will need to be fleshed out more. -*

    -**/ - -class LicenseGetInformationReply extends LicenseBaseReply -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - LicenseGetInformationReply() - { - super(); - } - - /** - *

    This method returns a new LicenseGetInformationReply object - *

    - **/ - public Object getNewDataStream() - { - return new LicenseGetInformationReply(); - } - - /** - *

    This method returns the code point for the retrieve license information datastream. - *

    - **/ - public int hashCode() - { - return 0x1003; // returns the reply ID - } -} diff --git a/cvsroot/src/com/ibm/as400/access/LicenseGetInformationRequest.java b/cvsroot/src/com/ibm/as400/access/LicenseGetInformationRequest.java deleted file mode 100644 index 65c31e48c..000000000 --- a/cvsroot/src/com/ibm/as400/access/LicenseGetInformationRequest.java +++ /dev/null @@ -1,43 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: LicenseGetInformationRequest.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/**

    This class is used to set up the request license information datastream. -* This class needs to be beefed up.

    -**/ - -class LicenseGetInformationRequest extends LicenseBaseRequest -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - /**

    RETRIEVE_LICENSE_INFO_DATASTREAM_SIZE - size of the retrieve licnese information datastream. - * Includes the header and template (there currently are no optional parameters.

    - **/ - static final int RETRIEVE_LICENSE_INFO_DATASTREAM_SIZE = 22; - - /**

    PRODUCT_ID_LOCATION - Location of the type of information requested in the datastream.

    **/ - static final int INFORMATON_TYPE_LOCATION = 51; - - - LicenseGetInformationRequest(AS400 system) - { - super(RETRIEVE_LICENSE_INFO_DATASTREAM_SIZE, system); - setReqRepID(0x1003); // request id for retrieve license info. - - set16bit(1, INFORMATON_TYPE_LOCATION); // 1 = retrieve detailed information - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/LicenseGetReply.java b/cvsroot/src/com/ibm/as400/access/LicenseGetReply.java deleted file mode 100644 index 1a9f496f2..000000000 --- a/cvsroot/src/com/ibm/as400/access/LicenseGetReply.java +++ /dev/null @@ -1,122 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: LicenseGetReply.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; - -/** -*

    This class provides the interface to retrieve the various information returned in the -* request license reply datastream. -*

    -**/ - -class LicenseGetReply extends LicenseBaseReply -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - /**

    REPLY_USAGE_LIMIT_LOCATION - Location of the usage limit in the reply datastream.

    **/ - static final int REPLY_USAGE_LIMIT_LOCATION = 26; - - /**

    REPLY_USAGE_COUNT_LOCATION - Location of the usage count in the reply datastream.

    **/ - static final int REPLY_USAGE_COUNT_LOCATION = 30; - - /**

    REPLY_USAGE_TYPE_LOCATION - Location of the usage type in the reply datastream.

    **/ - static final int REPLY_USAGE_TYPE_LOCATION = 34; - - /**

    REPLY_COMPLIANCE_TYPE_LOCATION - Location of the compliance type in the reply datastream.

    **/ - static final int REPLY_COMPLIANCE_TYPE_LOCATION = 36; - - /**

    REPLY_LICENSE_TERM_CCSID_LOCATION - Location of the license term in the reply datastream.

    **/ - static final int REPLY_LICENSE_TERM_CCSID_LOCATION = 38; - - /**

    REPLY_LICENSE_TERM_LOCATION - Location of the license term in the reply datastream.

    **/ - static final int REPLY_LICENSE_TERM_LOCATION = 42; - - /**

    REPLY_RELEASE_LEVEL_CCSID_LOCATION - Location of the license release level in the reply datastream.

    **/ - static final int REPLY_RELEASE_LEVEL_CCSID_LOCATION = 48; - - /**

    REPLY_RELEASE_LEVEL_LOCATION - Location of the license release level in the reply datastream.

    **/ - static final int REPLY_RELEASE_LEVEL_LOCATION = 52; - - - LicenseGetReply() - { - super(); - } - - public Object getNewDataStream() - { - return new LicenseGetReply(); - } - - public int hashCode() - { - return 0x1001; // returns the reply ID - } - - public int getUsageLimit() - { - return get32bit(REPLY_USAGE_LIMIT_LOCATION); - } - - public int getUsageCount() - { - return get32bit(REPLY_USAGE_COUNT_LOCATION); - } - - public int getUsageType() - { - return get16bit(REPLY_USAGE_TYPE_LOCATION); - } - - public int getComplianceType() - { - return get16bit(REPLY_COMPLIANCE_TYPE_LOCATION); - } - - public String getLicenseTerm() - { - try - { - return ConvTable.getTable(get32bit(REPLY_LICENSE_TERM_CCSID_LOCATION), null).byteArrayToString(data_, REPLY_LICENSE_TERM_LOCATION, 6, 0); - } - catch (UnsupportedEncodingException e) - { - if(Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "Unable to convert the license term so return null."); - } - - return null; - } - } - - public String getReleaseLevel() - { - try - { - return ConvTable.getTable(get32bit(REPLY_RELEASE_LEVEL_CCSID_LOCATION), - null).byteArrayToString(data_, REPLY_RELEASE_LEVEL_LOCATION, 6, 0); - - } - catch (UnsupportedEncodingException e) - { - if(Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "Unable to convert the release level so return null."); - } - return null; - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/LicenseGetRequest.java b/cvsroot/src/com/ibm/as400/access/LicenseGetRequest.java deleted file mode 100644 index c9c531a07..000000000 --- a/cvsroot/src/com/ibm/as400/access/LicenseGetRequest.java +++ /dev/null @@ -1,111 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: LicenseGetRequest.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.net.UnknownHostException; -import java.net.InetAddress; -import java.io.CharConversionException; - - -/** -*

    This class is used to set up the request license datastream.

    -**/ - -class LicenseGetRequest extends LicenseBaseRequest -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - /**

    RETRIEVE_LICENSE_INFO_DATASTREAM_SIZE - size of the retrieve licnese information datastream. - * Includes the header and template (there currently are no optional parameters.

    - **/ - static final int REQUEST_LICENSE_DATASTREAM_SIZE = 324; - - /**

    CLIENT_UNIQUE_NAME_CCSID_LOCATION - Location of the CCSID for client workstation name in the datastream.

    **/ - static final int CLIENT_UNIQUE_NAME_CCSID_LOCATION = 51; - - /**

    PRODUCT_ID_LOCATION - Location of the client workstation name (unique to its domain) in the datastream.

    **/ - static final int CLIENT_UNIQUE_NAME_LOCATION = 55; - - /**

    USER_HANDLE_CCSID_LOCATION - Location of the CCSID for user handle in the datastream.

    **/ - static final int USER_HANDLE_CCSID_LOCATION = 310; - - /**

    FEATURE_LOCATION - Location of user handle in the datastream. It is used to ensure that the - * license requester and license releaser are the same

    **/ - static final int USER_HANDLE_LOCATION = 314; - - - - /**

    The constructor sets up the header for the license request datastream.

    **/ - LicenseGetRequest(AS400 system) - { - super(REQUEST_LICENSE_DATASTREAM_SIZE, system); - setReqRepID(0x1001); - - int i; - // blank fill unique name - for (i=CLIENT_UNIQUE_NAME_LOCATION; i<310; i++) - // 310 = CLIENT_UNIQUE_NAME_LOCATION + the unique name size of 255 - { - data_[i] = (byte)0x40; - } - - // blank fill license user handle - for (i=USER_HANDLE_LOCATION; i<322; i++) - // 322 = USER_HANDLE_LOCATION + the user handle size of 8 - { - data_[i] = (byte)0x40; - } - - set32bit(37, CLIENT_UNIQUE_NAME_CCSID_LOCATION); // unique name ccsid - set32bit(37, USER_HANDLE_CCSID_LOCATION); // user handle ccsid - - try - { - String localHostName = InetAddress.getLocalHost().getHostName(); - try - { - conv_.stringToByteArray(localHostName, data_, CLIENT_UNIQUE_NAME_LOCATION, 255); // unique name - } - catch (CharConversionException cce) - { - if(Trace.isTraceOn()) - { - Trace.log(Trace.ERROR, "Character conversion exception - localHostName: " + localHostName); - } - } - } - catch (UnknownHostException e) - { - if(Trace.isTraceOn()) - { - Trace.log(Trace.ERROR, "UnknownHostException."); - } - } - - try - { - conv_.stringToByteArray("JT400", data_, USER_HANDLE_LOCATION, 5); // license user handle - } - catch (CharConversionException e) - { - if(Trace.isTraceOn()) - { - Trace.log(Trace.ERROR, "Character conversion exception - userHandle: JT400"); - } - - } - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/LicenseManager16.gif b/cvsroot/src/com/ibm/as400/access/LicenseManager16.gif deleted file mode 100644 index d31e32698..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/LicenseManager16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/LicenseManager32.gif b/cvsroot/src/com/ibm/as400/access/LicenseManager32.gif deleted file mode 100644 index dfe6166b0..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/LicenseManager32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/LicenseReleaseReply.java b/cvsroot/src/com/ibm/as400/access/LicenseReleaseReply.java deleted file mode 100644 index f2e407afd..000000000 --- a/cvsroot/src/com/ibm/as400/access/LicenseReleaseReply.java +++ /dev/null @@ -1,44 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: LicenseReleaseReply.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/**

    This class is used to access certain information from the release license reply datastream.

    -**/ -class LicenseReleaseReply extends LicenseBaseReply -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - LicenseReleaseReply() - { - super(); - } - - /**

    This method creates a new LicenseReleaseReply object.

    - **/ - public Object getNewDataStream() - { - return new LicenseReleaseReply(); - } - - /**

    This method returns the reply ID for the license release datastream.

    - **/ - public int hashCode() - { - return 0x1002; // returns the reply ID - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/LicenseReleaseRequest.java b/cvsroot/src/com/ibm/as400/access/LicenseReleaseRequest.java deleted file mode 100644 index cdb90c3a5..000000000 --- a/cvsroot/src/com/ibm/as400/access/LicenseReleaseRequest.java +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: LicenseReleaseRequest.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -class LicenseReleaseRequest extends LicenseGetRequest -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - LicenseReleaseRequest(AS400 system) - { - super(system); - setReqRepID(0x1002); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/LineDataRecordWriter.java b/cvsroot/src/com/ibm/as400/access/LineDataRecordWriter.java deleted file mode 100644 index dc6dc74b0..000000000 --- a/cvsroot/src/com/ibm/as400/access/LineDataRecordWriter.java +++ /dev/null @@ -1,351 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: LineDataRecordWriter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -/** - * Writes a record in line data format (with - * the name of the record format inserted into positions 1-10 of the line data), - * translating characters into bytes of the specified CCSID. - * The line data is written to an OutputStream. - * - * @see OutputStream - * -**/ - - -public class LineDataRecordWriter extends Object -{ - private OutputStream outPut; - private Converter cvt; - private ByteArrayOutputStream buffer ; - - /** - * Constructs a LineDataRecordWriter. The target CCSID defaults to the CCSID - * of the system. - * - * @param out An OutputStream. - * @param system The system. - * - * @exception UnsupportedEncodingException If ccsid is not valid. - **/ - public LineDataRecordWriter(OutputStream out, - AS400 system) - throws UnsupportedEncodingException - { - outPut = out; - cvt = new Converter(system.getCcsid(), system); - buffer = new ByteArrayOutputStream(); - } - - - /** - * Constructs a LineDataRecordWriter. - * - * @param out An OutputStream. - * @param ccsid The name of the target CCSID to be used. - * @param system The system. - * - * @exception UnsupportedEncodingException If ccsid is not valid. - **/ - public LineDataRecordWriter(OutputStream out, - int ccsid, - AS400 system) - - throws UnsupportedEncodingException - { - outPut = out; - cvt = new Converter(ccsid, system); - buffer = new ByteArrayOutputStream(); - } - - - - // Adds the data to the buffer, which is a ByteArrayOutputStream - private void addToBuffer(byte [] data) - throws IOException - { - if (outPut == null) { - throw new IOException("Stream closed"); - } - - int len = data.length; - - buffer.write(data,0,len); - } - - - /** - * Gets the CCSID used for this writer. - * - * @return The CCSID used for this writer. - * - **/ - public int getCcsid() //@A1C - { - if (cvt == null) { - return 0; - } else { - return cvt.getCcsid(); - } - } - - - - /** Gets the name of the encoding being used by this LineDataRecordWriter. - * @return The name of the encoding being used by this LineDataRecordWriter. - * Null may be returned if the stream is closed. - **/ - public String getEncoding() - { - if (cvt == null) { - return(null); - } else { - return cvt.getEncoding(); - } - } - - /** Formats the record data in line data format, with the format id in - * in positions 1-10. The data is translated into bytes - * using the specified CCSID. The format of the data is determined by - * the record format associated with the record. The data is then placed - * in the outstream buffer. The following record - * format attributes are required to be set. - *
      - *
    • Record format ID - *
    • Record format type - *
    - * For a record created with record format type of VARIABLE_LAYOUT_LENGTH, - * the record format delimiter must be specified. - *
    For a record created - * with a format type of FIXED_LAYOUT_LENGTH, the field description layout - * attributes, length and alignment must be specified. If alignment is not - * specified, alignment will be defaulted to ALIGN_LEFT. - * - * @param record The record to be converted to line data. - * - **/ - private void retrieveRecord(Record record) - throws IOException, UnsupportedEncodingException, - ExtendedIllegalStateException - - { - int fldalign; - int fldlayoutl; - byte [] convertedBytes; - FieldDescription fd; - - String fvalue; - String str; - - int strlen; - int padlen; - - - // get the record format - RecordFormat recfmt = record.getRecordFormat(); - - // get the record format id from the record - String recfmtid = recfmt.getRecordFormatID(); - - // get record format type from the record - int recfmttype = recfmt.getRecordFormatType(); - - // get the all of the fields from the record - Object fields[] = record.getFields(); - - // get the delimiter from the record - char delimiter = recfmt.getDelimiter(); - - // validate parameters passed in - if (recfmtid == "") { //@A1C - throw new ExtendedIllegalStateException("recordFormatID", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (recfmttype == 0) { - - throw new ExtendedIllegalStateException("recordFormatType for record format "+recfmtid, - ExtendedIllegalStateException.PROPERTY_NOT_SET); //@A1C - } - - - - - // convert the format id to ebcdic and put into buffer - byte[] conBytes1 = cvt.stringToByteArray(recfmtid); - addToBuffer(conBytes1); - - // loop through all fields in record - for (int i =0; i < fields.length; i++) { - - // get field description from record - fd = recfmt.getFieldDescription(i); - - // get data from field - fvalue = fields[i].toString(); - - // set local variable with the length of data - strlen = fvalue.length(); - - // fixed length record logic - if (recfmttype == RecordFormat.FIXED_LAYOUT_LENGTH ) { - - //get alignment style and field length from field description - fldalign = fd.getLayoutAlignment(); - fldlayoutl = fd.getLayoutLength(); - - // validate alignment value - if (fldalign == 0) //@A1C - { - fldalign = FieldDescription.ALIGN_LEFT; //@A1C - } - - // field length greater than the data, so need to pad - if (fldlayoutl >= strlen) //@A1C - { - //calculate pad length - padlen = fldlayoutl - strlen; - - //create pad string - String padstring = pad(padlen); - - // align data right - if (fldalign == FieldDescription.ALIGN_RIGHT ) { - str = padstring + fvalue; - } - else - { - // align data left - str = fvalue + padstring; - } - } - else - { - //field length smaller than data - throw new ExtendedIllegalArgumentException("Field description " + fd.getFieldName(), - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); //@A1A - - //str = fvalue; //@A1D - } - } - else - { - // validate delimiter - if (delimiter == '\0') //@A1C - { - throw new ExtendedIllegalStateException("delimiter for record format "+recfmtid, - ExtendedIllegalStateException.PROPERTY_NOT_SET); //@A1C - } - - // Add the delimiter to the data - str = fvalue + delimiter; - } - - // convert data to ebcdic and place in outstream buffer - byte[] conBytes = cvt.stringToByteArray(str); - addToBuffer(conBytes); - - } - - } - /** Writes the record data, in line data format, to an OutputStream. - * The data is translated into bytes using the specified CCSID. The format - * of the data is determined by the record format associated with the record. - * The following record format attributes are required to be set. - *
      - *
    • Record format ID - *
    • Record format type - *
    - * For a record created with record format type of VARIABLE_LAYOUT_LENGTH, - * the record format delimiter must be specified. - *
    For a record created - * with a format type of FIXED_LAYOUT_LENGTH, the field description layout - * attributes, length and alignment must be specified. If alignment is not - * specified, alignment will be defaulted to ALIGN_LEFT. - *
    - * If the OutputStream is a SpooledFileOutputStream, the SpooledFileOutputStream - * must have the following parameters set: - * - * @param record The record to be converted to line data. - * @see Record - * - * @exception IOException If an error occurs while communicating - * with the AS/400. - * @exception UnsupportedEncodingException If in not valid. - **/ - - public void writeRecord(Record record) - throws IOException, UnsupportedEncodingException, - ExtendedIllegalStateException - - { - // intialize outstream buffer - buffer.reset(); - - // get data from record, pad as necessary, convert to ebcdic - // and write to outstream buffer - retrieveRecord(record); - - // verify that buffer contains data and the outstream is open - if (buffer.size() > 0) - { - if (outPut == null) - { - throw new IOException("Stream closed"); - } - - // write data from outstream buffer to outstream, flush the outstream - // and reset the buffer - buffer.writeTo(outPut); - outPut.flush(); - buffer.reset(); - } - } - - - private String pad( int slen) - { - StringBuffer buf = new StringBuffer(slen); - for (int i=0; i < slen; i++) { - buf.append(" "); - - } - return buf.toString(); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/ListUtilities.java b/cvsroot/src/com/ibm/as400/access/ListUtilities.java deleted file mode 100644 index c80656143..000000000 --- a/cvsroot/src/com/ibm/as400/access/ListUtilities.java +++ /dev/null @@ -1,376 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ListUtilities.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - - -/** -Provides utilities for retrieving lists of objects. -**/ -class ListUtilities -{ - // Default setting for listWaitTimeout property. - // This is the maximum amount of time to wait for a list to complete before giving up. - private static final int DEFAULT_MAX_WAIT_TIME = 60; // 60 seconds - - // The length of the "List information" structure parameter. - static final int LIST_INFO_LENGTH = 80; // 80 bytes - - - // - // Possible values for the "Information complete indicator" field: - // Whether all requested information has been returned. - // - - // Complete and accurate information. - // All of the requested records have been returned in the receiver variable. - static final char INFORMATION_COMPLETE = 'C'; - - // Incomplete information. - // An interruption causes the receiver variable to contain incomplete information. - static final char INFORMATION_INTERRUPTED = 'I'; - - // Partial and accurate information. - // Partial information is returned when the receiver variable is full and not all of the records requested are returned. - static final char INFORMATION_PARTIAL = 'P'; - - - - // - // Possible values for the "List status indicator" field: - // The status of building the list. - // - - // The building of the list is pending. - static final char LIST_PENDING = '0'; - // Note: For a synchronous request, we'd probably never get this status back. - - // The list is in the process of being built. - static final char LIST_BEING_BUILT = '1'; - // Note: Even though we wouldn't normally expect this status for synchronous requests, - // we've occasionally gotten it for requests that list massively large numbers of objects. - - // The list has been completely built. - static final char LIST_COMPLETE = '2'; - - // An error occurred when building the list. - // The next call to the Get List Entries (QGYGTLE) API will cause the error to be signaled - // to the caller of the QGYGTLE API. - static final char LIST_ERROR = '3'; - - // The list is primed and ready to be built. - // The list will be built asynchronously by a server job, - // but the server job has not necessarily started building the list yet. - static final char LIST_PRIMED = '4'; - - // Given the current selection criteria and information requested, - // there is too much data to be returned. - static final char LIST_TOO_MUCH_DATA = '5'; - - - /** - Returns the value of the "list status indicator" field returned by QGY* API's. - - @param listInformation The "list information" structure returned by a QGY* API (that requested the building of a list). - @return The converted value of the "list status information" field. Possible values are '0', '1', '2', '3', '4', or '5'. - @throws ErrorCompletingRequestException if the List Status Information is other than "complete", "being built", or "pending"; or if the Information Complete Indicator is "interrupted". - **/ - private static char checkListStatus(byte[] listInformation) - throws ErrorCompletingRequestException - { - char infoCompleteIndicator, listStatusIndicator; - try { - // Convert the two CHAR(1) fields from EBCDIC to Unicode. - byte[] arry = { listInformation[16] }; // ICI is at offset 16 - infoCompleteIndicator = new CharConverter(37).byteArrayToString(arry,0,1).charAt(0); - arry[0] = listInformation[30]; // LSI is at offset 30 - listStatusIndicator = new CharConverter(37).byteArrayToString(arry,0,1).charAt(0); - } - catch (java.io.UnsupportedEncodingException e) { // will never happen - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - - switch (listStatusIndicator) - { - case LIST_COMPLETE: - break; // This is the indicator that we normally expect. - - case LIST_BEING_BUILT: - case LIST_PENDING: - // These status values are unusual, but aren't necessarily error conditions - // (even if we indicated we wanted the list built synchronously). - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "List status indicator:", listStatusIndicator); - break; - - default: // any other status - - StringBuffer msg = new StringBuffer("Unable to synchronously build object list on server."); - - try { - msg.append("\n List status indicator: " + listStatusIndicator); - msg.append("\n Info complete indicator: " + infoCompleteIndicator); - msg.append("\n Total records: " + - BinaryConverter.byteArrayToInt(listInformation, 0)); - msg.append("\n Records returned: " + - BinaryConverter.byteArrayToInt(listInformation, 4)); - } - catch (Throwable t) {} // will never happen - finally { - Trace.log(Trace.ERROR, msg.toString()); - } - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.AS400_ERROR); - } - - if (infoCompleteIndicator == INFORMATION_INTERRUPTED) - { - Trace.log(Trace.ERROR, "Info complete indicator: " + infoCompleteIndicator); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.AS400_ERROR); - } - - return listStatusIndicator; - } - - - /** - Closes the list on the system. This releases any system resources previously in use by the list. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - static void closeList(AS400 system, byte[] listHandle) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (listHandle == null) return; - - ProgramParameter[] parameters = new ProgramParameter[] - { - new ProgramParameter(listHandle), - new ErrorCodeParameter() - }; - ProgramCall pc = new ProgramCall(system, "/QSYS.LIB/QGY.LIB/QGYCLST.PGM", parameters); // not a threadsafe API - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - } - - - // Calls QGYGTLE to get the current "list information" on the progress of list-building. - private static byte[] refreshListInformation(byte[] listHandle, ProgramCall pgmCall) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (pgmCall.getParameterList().length == 0) - { - ProgramParameter[] parameters = new ProgramParameter[] - { - // Receiver variable, output, char(*). - new ProgramParameter(8), // minimum length is 8 bytes - // Length of receiver variable, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(8)), - // Request handle, input, char(4). - new ProgramParameter(listHandle), - // List information, output, char(80). - new ProgramParameter(LIST_INFO_LENGTH), - // Number of records to return, input, binary(4). - // '0' indicates: "Only the list information is returned and no actual list entries are returned." - new ProgramParameter(new byte[] { 0x00, 0x00, 0x00, 0x00 } ), - // Starting record, input, binary(4). - // '0' indicates: "The list information should be returned to the caller immediately." - // '-1' indicates: "The whole list should be built before the list information is returned to the caller." - //new ProgramParameter(new byte[] { 0x00, 0x00, 0x00, 0x00} ), - new ProgramParameter(new byte[] { (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF} ), - // Error code, I/0, char(*). - new ErrorCodeParameter() - - }; - try { pgmCall.setProgram("/QSYS.LIB/QGY.LIB/QGYGTLE.PGM", parameters); } - catch (java.beans.PropertyVetoException pve) {} // will never happen - } - - if (!pgmCall.run()) { - throw new AS400Exception(pgmCall.getMessageList()); - } - - return pgmCall.getParameterList()[3].getOutputData(); // the "List Information" structure - } - - - /** - Calls QGYGTLE (repeatedly if necessary) until the specified list is completely built. - For use following calls to APIs that return an "Open list information format" structure. - @param system The system where the list is being built. - @param listHandle The list handle for the list. - @param listInformation The "list information" structure returned by a QGY* API (that requested the building of a list). - @return The final "list information" structure. - **/ - static byte[] waitForListToComplete(AS400 system, byte[] listHandle, byte[] listInformation) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - ProgramCall pgmCall = null; // for calling QGYGTLE - final int waitSecondsPerIteration = 1; // wait 1 second between retries - int accumulatedWaitSeconds = 0; // accumulated total wait time - int maxWaitSeconds = getMaxWaitTime(); - - char listStatus = checkListStatus(listInformation); - - while (listStatus != LIST_COMPLETE && - accumulatedWaitSeconds < maxWaitSeconds) - { - try { - Thread.sleep(waitSecondsPerIteration*1000); // wait for 1 second - accumulatedWaitSeconds += waitSecondsPerIteration; - } - catch (InterruptedException ie) {} // ignore - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Calling QGYGTLE.PGM to wait for list to be completely built."); - - // See if the building of the list (on the server) has completed yet. - - // Note: Even when we specify '-1' for the "number of records" parameter on the QGYOxxx request (to build the list synchronously), we can encounter a "list being built" status, if the request is building a massively large list of objects. - - if (pgmCall == null) pgmCall = new ProgramCall(system); - listInformation = refreshListInformation(listHandle, pgmCall); - listStatus = checkListStatus(listInformation); - } - - if (listStatus != LIST_COMPLETE) { - Trace.log(Trace.ERROR, "The building of the list did not complete within the specified time limit of " + maxWaitSeconds + " seconds."); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.AS400_ERROR); - } - return listInformation; - } - - - /** - Calls QGYGTLE, repeatedly if necessary, to retrieve the specified number of list entries. - This assumes that the list has previously been built on the system. - @param system The system where the list has been built. - @param listHandle The list handle for the list. - @param lengthOfReceiverVariable The value of the "Length of receiver variable" field. - @param number The number of list entries to return. - @param listOffset The offset into the list (0-based). - @param outputListInfoContainer Container in which to receive the generated "List information" structure. Ignored if null. - **/ - static byte[] retrieveListEntries(AS400 system, byte[] listHandle, int lengthOfReceiverVariable, int number, int listOffset, Object[] outputListInfoContainer) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - ProgramParameter[] parameters = new ProgramParameter[] - { - // Receiver variable, output, char(*). - new ProgramParameter(lengthOfReceiverVariable), - // Length of receiver variable, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(lengthOfReceiverVariable)), - // Request handle, input, char(4). - new ProgramParameter(listHandle), - // List information, output, char(80). - new ProgramParameter(LIST_INFO_LENGTH), - // Number of records to return, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(number)), - - // Starting record, input, binary(4). (1-based: The first record is record number '1') - // '0' indicates that the list information should be returned to the caller immediately. The special value 0 is only allowed when the number of records to return parameter is zero. - // '-1' indicates that the whole list should be built before the list information is returned to the caller. - new ProgramParameter(BinaryConverter.intToByteArray(listOffset == -1 ? -1 : listOffset+1)), - - // Error code, I/0, char(*). - new ErrorCodeParameter() - }; - - ProgramCall pc = new ProgramCall(system, "/QSYS.LIB/QGY.LIB/QGYGTLE.PGM", parameters); // not a threadsafe API - - byte[] listInformation; - int recordsReturned; - - // Call QGYGTLE, to retrieve the list entries. - // If we discover that the "receiver variable" was too small, try calling again, with progressively larger "receiver variable". - do - { - if (pc.run()) - { - listInformation = parameters[3].getOutputData(); - checkListStatus(listInformation); - recordsReturned = BinaryConverter.byteArrayToInt(listInformation, 4); - } - else // the call to QGYGTLE failed - { - listInformation = null; - recordsReturned = 0; - // See if the call failed because of a too-small receiver variable. - AS400Message[] messages = pc.getMessageList(); - // GUI0002 means that the receiver variable was too small to hold the list. - if (!messages[0].getID().equals("GUI0002")) { - throw new AS400Exception(messages); - } - } - - if (recordsReturned < number) // we didn't get as many records as we requested - { - if (listInformation != null) - { - // See if we've reached the end of the list. - int totalRecords = BinaryConverter.byteArrayToInt(listInformation, 0); // The total number of records available in the list. - int firstRecordInReceiverVariable = BinaryConverter.byteArrayToInt(listInformation, 36); - - // Note: The "First record in receiver variable" field is 1-based; that is, the first record is record number '1' (rather than '0'). - if ((firstRecordInReceiverVariable + recordsReturned) > totalRecords) { - // All the records in the list have been returned, so don't keep requesting more. - break; - } - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieved messages, records returned: " + recordsReturned + ", number:", number); - if (recordsReturned < 0) - { // This will never happen, but satisfy the static code analyzer. - throw new InternalErrorException(InternalErrorException.UNKNOWN, "Records returned: " + recordsReturned); - } - // Try again, with a larger "receiver variable". - lengthOfReceiverVariable *= 1 + number / (recordsReturned + 1); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Updated length: ", lengthOfReceiverVariable); - parameters[0] = new ProgramParameter(lengthOfReceiverVariable); - parameters[1] = new ProgramParameter(BinaryConverter.intToByteArray(lengthOfReceiverVariable)); - } - } while (recordsReturned < number); - - // If the caller specified a non-null 'outputListInfo' parameter, copy the "list information" structure into it, to pass it back to the caller. - if (outputListInfoContainer != null && listInformation != null) - { - outputListInfoContainer[0] = listInformation; - } - - return parameters[0].getOutputData(); // the contents of the "receiver variable" field - } - - - // Returns the maximum number of seconds to wait for a list to be built. - private static int getMaxWaitTime() - { - int listWaitTimeout = DEFAULT_MAX_WAIT_TIME; - String propVal = SystemProperties.getProperty(SystemProperties.LIST_WAIT_TIMEOUT); - if (propVal != null) - { - try { - listWaitTimeout = Integer.parseInt(propVal); - if (listWaitTimeout == 0) listWaitTimeout = Integer.MAX_VALUE; // '0' means "no limit" - } - catch (Exception e) { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Error retrieving listWaitTimeout property value:", e); - } - } - return listWaitTimeout; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/LocalDataArea.java b/cvsroot/src/com/ibm/as400/access/LocalDataArea.java deleted file mode 100644 index d549031b9..000000000 --- a/cvsroot/src/com/ibm/as400/access/LocalDataArea.java +++ /dev/null @@ -1,503 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: LocalDataArea.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.io.IOException; -import java.beans.PropertyVetoException; -import java.net.UnknownHostException; - -// There is always a local data area associated with the current IBM i job. -// It is 1024 bytes in length and is accessed using the name "*LDA". Its text -// description is "*LDA FOR JOB jobnumber/username/jobname". -// IBM i allows only read and write operations on a local data area. - -/** -The LocalDataArea class represents a local data area on the system. -

    -A local data area exists as a character data area on the system. It is -automatically associated with a job and cannot be accessed from another -job; hence, it cannot be directly created or deleted by the user. -

    -Care must be taken when using local data areas so that the IBM i job -is not ended prematurely. When the job ends, its local data area is -automatically deleted, at which point the LocalDataArea object that -is referencing it will no longer be valid. -

    -The following example demonstrates the use of LocalDataArea: -

    -// Prepare to work with the system named "My400".
    -AS400 system = new AS400("My400");
    -
    -// Create a LocalDataArea object to access
    -// the local data area associated with this connection.
    -LocalDataArea dataArea = new LocalDataArea(system);
    -
    -// Clear the data area
    -dataArea.clear();
    -
    -// Write to the data area
    -dataArea.write("Hello world");
    -
    -// Read from the data area
    -String data = dataArea.read();
    -
    - -

    -Note: Most of the read() and write() methods of this class automatically -convert characters between Unicode and the CCSID associated with the AS400 object. -See {@link AS400#getCcsid AS400.getCcsid()}. -**/ - -public class LocalDataArea extends DataArea implements Serializable -{ - static final long serialVersionUID = 4L; - - /** - Constants - **/ - - static final int DEFAULT_LENGTH = 1024; // bytes - static final String DEFAULT_PATH = "/QSYS.LIB/ .LIB/*LDA.DTAARA"; - - - /** - Variables - ***/ - - - /** - Constructs a LocalDataArea object. - It creates a default LocalDataArea object. The system property - must be set before attempting a connection. - **/ - public LocalDataArea() - { - super(); - - try { super.setPath(DEFAULT_PATH); } - catch (PropertyVetoException e) {} // Will never happen. - - length_ = DEFAULT_LENGTH; - dataAreaType_ = LOCAL_DATA_AREA; - } - - - /** - Constructs a LocalDataArea object. - It creates a LocalDataArea instance that represents the local data area - on system. - @param system The system that contains the data area. - **/ - public LocalDataArea(AS400 system) - { - // See if we can squeeze a local data area past QSYSObjectPathName: - // The library name must be 10 blanks. - // The data area name must be *LDA - super(system, DEFAULT_PATH); - length_ = DEFAULT_LENGTH; - dataAreaType_ = LOCAL_DATA_AREA; - } - - - /** - Resets the data area to contain all blanks. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void clear() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (impl_ == null) - chooseImpl(); - - impl_.clear(); - - // Fire the CLEARED event. - fireCleared(); - } - - - /** - Reads the data from the data area. - It retrieves the entire contents of the data area. Note that if the data - does not completely fill the data area, this method will return data - padded with trailing blanks up to the length of the data area. - @return The data read from the data area. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public String read() - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (impl_ == null) - chooseImpl(); - - // Do the read - String val = impl_.retrieve(-1,1); - - // Fire the READ event. - fireRead(); - - return val; - } - - - /** - Reads the data from the data area. - It retrieves the entire contents of the data area. Note that if the data - does not completely fill the data area, this method will return data - padded with trailing blanks up to the length of the data area. - @param type The Local Data Area bidi string type, as defined by the CDRA (Character - Data Representataion Architecture). See - BidiStringType for more information and valid values. - @return The data read from the data area. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public String read(int type) //$A2A - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (impl_ == null) - chooseImpl(); - - // Do the read - String val = impl_.retrieve(-1,1, type); //$A2C - - // Fire the READ event. - fireRead(); - - return val; - } - - - /** - Reads the data from the data area. - It retrieves dataLength characters (or fewer if multi-byte characters) beginning at - dataAreaOffset in the data area. The first character in - the data area is at offset 0. - @param dataAreaOffset The offset in the data area at which to start reading. - @param dataLength The number of bytes to read. Valid values are from - 1 through (data area size - dataAreaOffset). - @return The data read from the data area. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public String read(int dataAreaOffset, int dataLength) - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - // Validate the dataAreaOffset parameter. - if (dataAreaOffset < 0 || dataAreaOffset >= length_) - throw new ExtendedIllegalArgumentException("dataAreaOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the dataLength parameter. - if (dataLength < 1 || dataLength > length_) - throw new ExtendedIllegalArgumentException("dataLength", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the (dataAreaOffset, dataLength) combination. - if (dataAreaOffset+dataLength > length_) - throw new ExtendedIllegalArgumentException("dataLength", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - if (impl_ == null) - chooseImpl(); - - // Do the read - String val = impl_.retrieve(dataAreaOffset, dataLength); - - // Fire the READ event. - fireRead(); - - return val; - } - - - /** - Reads the data from the data area. - It retrieves dataLength characters (or fewer if multi-byte characters) beginning at - dataAreaOffset in the data area. The first character in - the data area is at offset 0. - @param dataAreaOffset The offset in the data area at which to start reading. - @param dataLength The number of bytes to read. Valid values are from - 1 through (data area size - dataAreaOffset). - @param type The Data Area bidi string type, as defined by the CDRA (Character - Data Representataion Architecture). See - BidiStringType for more information and valid values. - @return The data read from the data area. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public String read(int dataAreaOffset, int dataLength, int type) //$A2A - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - // Validate the dataAreaOffset parameter. - if (dataAreaOffset < 0 || dataAreaOffset >= length_) - throw new ExtendedIllegalArgumentException("dataAreaOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the dataLength parameter. - if (dataLength < 1 || dataLength > length_) - throw new ExtendedIllegalArgumentException("dataLength", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the (dataAreaOffset, dataLength) combination. - if (dataAreaOffset+dataLength > length_) - throw new ExtendedIllegalArgumentException("dataLength", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - if (impl_ == null) - chooseImpl(); - - // Do the read - String val = impl_.retrieve(dataAreaOffset, dataLength, type); //$A2C - - // Fire the READ event. - fireRead(); - - return val; - } - - - /** - Reads the data from the data area. - It retrieves up to dataLength bytes, without conversion, - beginning at offset dataAreaOffset in the data area. - Note that the first byte in the data area is at offset 0. - @param dataBuffer The buffer into which to read the data. Must be non-null. - @param dataBufferOffset The starting offset in dataBuffer. - @param dataAreaOffset The offset in the data area at which to start reading. - @param dataLength The number of bytes to read. Valid values are from - 1 through (data area size - dataAreaOffset). - @return The total number of bytes read into the buffer. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - @see #write(byte[],int,int,int) - **/ - public int read(byte[] dataBuffer, int dataBufferOffset, int dataAreaOffset, int dataLength) - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - return super.read(dataBuffer, dataBufferOffset, dataAreaOffset, dataLength); - } - - - /** - Writes the data to the data area. - It writes data to the beginning of the data area. The remaining - characters in the data area are blank padded. - @param data The data to be written. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void write(String data) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - // Validate the data parameter. - if (data == null) - throw new NullPointerException("data"); - if (data.length() < 1 || data.length() > length_) - throw new ExtendedIllegalArgumentException("data", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - if (impl_ == null) - chooseImpl(); - - // Do the write - impl_.write(data, 0); - - // Fire the WRITTEN event. - fireWritten(); - } - - - /** - Writes the data to the data area. - It writes data.length() characters from data to the - data area beginning at dataAreaOffset. The first character - in the data area is at offset 0. - @param data The data to be written. - @param dataAreaOffset The offset in the data area at which to start writing. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void write(String data, int dataAreaOffset) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - // Validate the data parameter. - if (data == null) - throw new NullPointerException("data"); - // Validate the data length. - if (data.length() < 1 || data.length() > length_) - throw new ExtendedIllegalArgumentException("data", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - // Validate the dataAreaOffset parameter. - if (dataAreaOffset < 0 || dataAreaOffset >= length_) - throw new ExtendedIllegalArgumentException("dataAreaOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the (dataAreaOffset, dataLength) combination. - if (dataAreaOffset+data.length() > length_) - throw new ExtendedIllegalArgumentException("data", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - if (impl_ == null) - chooseImpl(); - - // Do the write - impl_.write(data, dataAreaOffset); - - // Fire the WRITTEN event. - fireWritten(); - } - - - /** - Writes the data to the data area. - It writes data.length() characters from data to the - data area beginning at dataAreaOffset. The first character - in the data area is at offset 0. - @param data The data to be written. - @param dataAreaOffset The offset in the data area at which to start writing. - @param type The Data Area bidi string type, as defined by the CDRA (Character - Data Representataion Architecture). See - BidiStringType for more information and valid values. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void write(String data, int dataAreaOffset, int type) //$A2A - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - // Validate the data parameter. - if (data == null) - throw new NullPointerException("data"); - // Validate the data length. - if (data.length() < 1 || data.length() > length_) - throw new ExtendedIllegalArgumentException("data", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - // Validate the dataAreaOffset parameter. - if (dataAreaOffset < 0 || dataAreaOffset >= length_) - throw new ExtendedIllegalArgumentException("dataAreaOffset", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - // Validate the (dataAreaOffset, dataLength) combination. - if (dataAreaOffset+data.length() > length_) - throw new ExtendedIllegalArgumentException("data", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - if (impl_ == null) - chooseImpl(); - - // Do the write - impl_.write(data, dataAreaOffset, type); - - // Fire the WRITTEN event. - fireWritten(); - } - - - /** - Writes the data to the data area. - It writes the specified bytes, without conversion, to the data area, at offset dataAreaOffset. - Note that the first byte in the data area is at offset 0. - @param dataBuffer The data to be written. Must be non-null. - @param dataBufferOffset The starting offset in dataBuffer. - @param dataAreaOffset The offset in the data area at which to start writing. - @param dataLength The number of bytes to write. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - @see #read(byte[],int,int,int) - **/ - public void write(byte[] dataBuffer, int dataBufferOffset, int dataAreaOffset, int dataLength) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - super.write(dataBuffer, dataBufferOffset, dataAreaOffset, dataLength); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/LocalDataArea16.gif b/cvsroot/src/com/ibm/as400/access/LocalDataArea16.gif deleted file mode 100644 index 3805cad71..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/LocalDataArea16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/LocalDataArea32.gif b/cvsroot/src/com/ibm/as400/access/LocalDataArea32.gif deleted file mode 100644 index 0042b3afc..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/LocalDataArea32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/LocalDataAreaBeanInfo.java b/cvsroot/src/com/ibm/as400/access/LocalDataAreaBeanInfo.java deleted file mode 100644 index 464dada46..000000000 --- a/cvsroot/src/com/ibm/as400/access/LocalDataAreaBeanInfo.java +++ /dev/null @@ -1,72 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: LocalDataAreaBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; -import java.awt.Image; - - -/** -The LocalDataAreaBeanInfo class provides -bean information for the LocalDataArea class. -**/ -public class LocalDataAreaBeanInfo extends DataAreaBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class dbeanClass = LocalDataArea.class; - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(dbeanClass); - } - - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("LocalDataArea16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("LocalDataArea32.gif"); - break; - } - - return image; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/LocalIOFB.java b/cvsroot/src/com/ibm/as400/access/LocalIOFB.java deleted file mode 100644 index 25a1a37f7..000000000 --- a/cvsroot/src/com/ibm/as400/access/LocalIOFB.java +++ /dev/null @@ -1,77 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: LocalIOFB.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class LocalIOFB extends DDMS38IOFB -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private static final int NUMBER_OF_RECORDS = 4; // Offset to the number of records returned - private static final int RECORD_LEN = 0; // Offset to the record length (4 bytes) - private static final int RECORD_NUMBER = 6; // Offset to record number of the record read - private static final int ACTUAL_BYTES_RETURNED = 10; // Offset to total bytes returned (number of records returned * bytes for each record) - - - LocalIOFB(byte[] data, - int offset) - { - super(data, offset); - } - - /** - *Returns the actual bytes returned from the last I/O operation. - *@return number of bytes returned. - **/ - int getActualBytesReturned() - { - return BinaryConverter.byteArrayToInt(data_, offset_ + - ACTUAL_BYTES_RETURNED); - } - - - /** - *Returns the number of records returned from the i/o operation that this - *object provides feedback for. - *@return the number of records. - **/ - int getNumberOfRecordsReturned() - { - return BinaryConverter.byteArrayToUnsignedShort(data_, offset_ + NUMBER_OF_RECORDS); - } - - /** - *Returns the record length of the records for the i/o operation that this - *object provides feedback for. - *@return the record length. - **/ - int getRecordLength() - { - return BinaryConverter.byteArrayToInt(data_, offset_ + RECORD_LEN); - } - - /** - *Returns the record number of the record returned from the i/o operation that this - *object provides feedback for. - *@return the record number. - **/ - int getRecordNumber() - { - return BinaryConverter.byteArrayToInt(data_, offset_ + RECORD_NUMBER); - } -} - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/LocalOpenFeedback.java b/cvsroot/src/com/ibm/as400/access/LocalOpenFeedback.java deleted file mode 100644 index b73b88bdc..000000000 --- a/cvsroot/src/com/ibm/as400/access/LocalOpenFeedback.java +++ /dev/null @@ -1,165 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: LocalOpenFeedback.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - - -/** - Class representing an open feedback structure supplied by the QYSTRART - service program. -**/ -class LocalOpenFeedback extends DDMS38OpenFeedback -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // offsets and byte lengths of the various portions of the feedback structure - // that we are interested in - private static final int FILE_NAME = 0; - private static final int FILE_NAME_LENGTH = 10; - private static final int LIB_NAME = 10; - private static final int LIB_NAME_LENGTH = 10; - private static final int MBR_NAME = 20; - private static final int MBR_NAME_LENGTH = 10; - private static final int MAX_BLOCKED_RECORDS_TRANSFERRED = 48; - private static final int NULL_FIELD_BYTE_MAP = 64; - private static final int NUM_RECORDS = 40; - private static final int RECORD_LEN = 30; - private static final int RECORD_INCREMENT = 50; - private static final int OPEN_FLAGS_2 = 54; - - - /** - Constructs an open feedback area from data supplied by the QYSTRART - service program's cdmOpen function. - @param system the system - @param data the data from cdmOpen - @exception AS400SecurityException If a security or authority error occurs. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the AS/400. - **/ - - LocalOpenFeedback(AS400ImplRemote system, //@B5C - byte[] data, - int offset) - throws AS400SecurityException, InterruptedException, IOException - { - super(system, data, offset); - } - - - /** - *Returns the file name of the file. - *@return the file name of the file. - **/ - String getFileName() - throws AS400SecurityException, - InterruptedException, - IOException - { - return conv_.byteArrayToString(data_, offset_ + FILE_NAME, - FILE_NAME_LENGTH); - } - - /** - *Returns the library name of the file. - *@return the library name of the file. - **/ - String getLibraryName() - throws AS400SecurityException, - InterruptedException, - IOException - { - return conv_.byteArrayToString(data_, offset_ + LIB_NAME, - LIB_NAME_LENGTH); - } - - /** - *Returns the maximum number of records that can read or written at one time. - *@return the maximum number of records that can be transferred at one time. - **/ - int getMaxNumberOfRecordsTransferred() - { - return BinaryConverter.byteArrayToUnsignedShort(data_, offset_ + MAX_BLOCKED_RECORDS_TRANSFERRED); - } - - /** - *Returns the member name. - *@return the member name. - **/ - String getMemberName() - throws AS400SecurityException, - InterruptedException, - IOException - { - return conv_.byteArrayToString(data_, offset_ + MBR_NAME, MBR_NAME_LENGTH); - } - - /** - *Returns the offset to the null field byte map for a record. - *@return the offset to the null field byte map. - **/ - int getNullFieldByteMapOffset() - { - return BinaryConverter.byteArrayToUnsignedShort(data_, offset_ + NULL_FIELD_BYTE_MAP); - } - - /** - *Returns the number of records in the file at open time. - *@return the number of records in the file at open time. - **/ - int getNumberOfRecords() - { - return BinaryConverter.byteArrayToInt(data_, offset_ + NUM_RECORDS); - } - - /** - *Returns the record length of the records in the file. - *@return the record length of the records in the file. - **/ - int getRecordLength() - { - return BinaryConverter.byteArrayToUnsignedShort(data_, offset_ + RECORD_LEN); - } - - /** - *Returns the record increment for the records in the file. This is the number - *of bytes that will be returned or that need to be sent for a single record. - *It includes bytes for the record data, a gap of zero or more bytes and bytes - *for the null field byte map. - *@return the record increment. - **/ - int getRecordIncrement() - { - return BinaryConverter.byteArrayToUnsignedShort(data_, offset_ + RECORD_INCREMENT); - } - - /** - *Indicates if the file contains null capable fields. - *@return true if the file contains null capable fields; false otherwise. - **/ - boolean isNullCapable() - { - if ((data_[offset_ + OPEN_FLAGS_2 + 1] & 0x40) == 0x40) - { - return true; - } - return false; - } -} - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/Log.java b/cvsroot/src/com/ibm/as400/access/Log.java deleted file mode 100644 index 6a0ab1532..000000000 --- a/cvsroot/src/com/ibm/as400/access/Log.java +++ /dev/null @@ -1,46 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: Log.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The Log interface defines a mechanism for exception and message logging - * in a device-independent manner. - *

    - * Implementations of this interface can direct the logged - * information to the appropriate file or output device. Event logging - * is intended for end-user information. In contrast, - * {@link com.ibm.as400.access.Trace Trace} is intended for - * debugging information for developers. - * - **/ - -public interface Log -{ - /** - * Logs a message. - * - * @param msg The message to log. - **/ - public void log(String msg); - - - /** - * Logs an exception and message. - * - * @param msg The message to log. - * @param exception The exception to log. - */ - public void log(String msg, Throwable exception); -} - diff --git a/cvsroot/src/com/ibm/as400/access/LogicalDataArea.java b/cvsroot/src/com/ibm/as400/access/LogicalDataArea.java deleted file mode 100644 index 35abb3593..000000000 --- a/cvsroot/src/com/ibm/as400/access/LogicalDataArea.java +++ /dev/null @@ -1,310 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: LogicalDataArea.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.io.IOException; -import java.beans.PropertyVetoException; -import java.net.UnknownHostException; - -/** -The LogicalDataArea class represents a logical data area on the system. -

    -The following example demonstrates the use of LogicalDataArea: -

    -// Prepare to work with the system named "My400".
    -AS400 system = new AS400("My400");
    -
    -// Create a LogicalDataArea object.
    -QSYSObjectPathName path = new QSYSObjectPathName("MYLIB", "MYDATA", "DTAARA");
    -LogicalDataArea dataArea = new LogicalDataArea(system, path.getPath());
    -
    -// Create the logical data area on the system using default values.
    -dataArea.create();
    -
    -// Clear the data area.
    -dataArea.clear();
    -
    -// Write to the data area.
    -dataArea.write(true);
    -
    -// Read from the data area.
    -boolean data = dataArea.read();
    -
    -// Delete the data area from the system.
    -dataArea.delete();
    -
    -**/ - -public class LogicalDataArea extends DataArea implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - /** - Constants - **/ - - static final int DEFAULT_LENGTH = 1; - - - /** - Variables - ***/ - - private boolean initialValue_ = false; // The initial value written to the data area upon creation. - - - /** - Constructs a LogicalDataArea object. - It creates a default LogicalDataArea object. The system and path - properties must be set before attempting a connection. - **/ - public LogicalDataArea() - { - super(); - length_ = DEFAULT_LENGTH; - dataAreaType_ = LOGICAL_DATA_AREA; - } - - - /** - Constructs a LogicalDataArea object. - It creates a LogicalDataArea instance that represents the data area path - on system. - @param system The system that contains the data area. - @param path The fully qualified integrated file system path name. The - integrated file system file extension for a data area is DTAARA. An example of a - fully qualified integrated file system path to a data area "MYDATA" in library - "MYLIB" is: /QSYS.LIB/MYLIB.LIB/MYDATA.DTAARA - **/ - public LogicalDataArea(AS400 system, String path) - { - super(system, path); - length_ = DEFAULT_LENGTH; - dataAreaType_ = LOGICAL_DATA_AREA; - } - - - /** - Clears the data area. - This method resets the data area to contain the default value of false. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void clear() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (impl_ == null) - chooseImpl(); - - impl_.clear(); - - // Fire the CLEARED event. - fireCleared(); - } - - - /** - Creates a logical data area on the system. - This method uses the following default property values. -
      -
    • initialValue - A value of false. -
    • textDescription - A blank string. -
    • authority - A value of *LIBCRTAUT. -
    - Note the length of a LogicalDataArea is always 1. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectAlreadyExistsException If the system object already exists. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void create() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectAlreadyExistsException, - ObjectDoesNotExistException - { - if (impl_ == null) - chooseImpl(); - - impl_.create(initialValue_, textDescription_, authority_); - - // Fire the CREATED event. - fireCreated(); - } - - - /** - Creates a logical data area with the specified attributes. - @param initialValue The initial value for the data area. - @param textDescription The text description for the data area. The maximum length is 50 characters. - @param authority The public authority level for the data area. Valid - values are *ALL, *CHANGE, *EXCLUDE, *LIBCRTAUT, *USE, or the - name of an authorization list. The maximum length is 10 characters. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectAlreadyExistsException If the system object already exists. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void create(boolean initialValue, String textDescription, - String authority) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectAlreadyExistsException, - ObjectDoesNotExistException - { - // Validate the text description parameter - if (textDescription == null) - throw new NullPointerException("textDescription"); - if (textDescription.length() > 50) - throw new ExtendedIllegalArgumentException("textDescription", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - // Validate the authority parameter. - if (authority == null) - throw new NullPointerException("authority"); - if (authority.length() == 0 || authority.length() > 10) - throw new ExtendedIllegalArgumentException("authority", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - initialValue_ = initialValue; - textDescription_ = textDescription; - authority_ = authority; - - create(); - } - - - /** - Removes the data area from the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist. - **/ - public void delete() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - super.delete0(); - } - - - /** - Returns the integrated file system path name of the object represented by the data area. - @return The integrated file system path name of the object represented by the data area. - **/ - public String getPath() - { - return super.getPath(); - } - - - /** - Returns the value in the data area. - @return The data read from the data area. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IllegalObjectTypeException If the system object is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public boolean read() - throws AS400SecurityException, - ErrorCompletingRequestException, - IllegalObjectTypeException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (impl_ == null) - chooseImpl(); - - // Do the read - boolean data = impl_.readBoolean(); - - fireRead(); // Fire the READ event. - - return data; - } - - - /** - Sets the fully qualified data area name. - The following example demonstrates the use of setPath: -
    -   // Create a LogicalDataArea object.
    -   LogicalDataArea dataArea = new LogicalDataArea();
    -
    -   // Set its path to be the data area "MYDATA" in the library "MYLIB".
    -   dataArea.setPath("/QSYS.LIB/MYLIB.LIB/MYDATA.DTAARA");
    -   
    - @param path The fully qualified integrated file system path name of the data area. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setPath(String path) throws PropertyVetoException - { - super.setPath(path); - } - - - /** - Writes the value in data to the data area. - @param data The data to be written. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void write(boolean data) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (impl_ == null) - chooseImpl(); - - impl_.write(data); - - // Fire the WRITTEN event. - fireWritten(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/LogicalDataArea16.gif b/cvsroot/src/com/ibm/as400/access/LogicalDataArea16.gif deleted file mode 100644 index 05175e99e..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/LogicalDataArea16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/LogicalDataArea32.gif b/cvsroot/src/com/ibm/as400/access/LogicalDataArea32.gif deleted file mode 100644 index 61f8215a3..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/LogicalDataArea32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/LogicalDataAreaBeanInfo.java b/cvsroot/src/com/ibm/as400/access/LogicalDataAreaBeanInfo.java deleted file mode 100644 index ceb06cf16..000000000 --- a/cvsroot/src/com/ibm/as400/access/LogicalDataAreaBeanInfo.java +++ /dev/null @@ -1,124 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: LogicalDataAreaBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; -import java.awt.Image; - - -/** -The LogicalDataAreaBeanInfo class provides -bean information for the LogicalDataArea class. -**/ -public class LogicalDataAreaBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class dbeanClass = LogicalDataArea.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - - private static PropertyDescriptor[] properties_; //@D1A - - static - { - try - { - PropertyDescriptor path = new PropertyDescriptor("path", dbeanClass); - path.setBound(true); - path.setConstrained(true); - path.setDisplayName(loader_.getText("PROP_NAME_PATH")); - path.setShortDescription(loader_.getText("PROP_DESC_PATH")); - properties_ = new PropertyDescriptor[] {path}; //@D1A - } - catch(Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns additional bean information. - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new DataAreaBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(dbeanClass); - } - - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("LogicalDataArea16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("LogicalDataArea32.gif"); - break; - } - - return image; - } - - /** //D1A - Returns the index of the default property. //D1A - @return The index to the default property. //D1A - **/ //D1A - public int getDefaultPropertyIndex() //D1A - { //D1A - // the index for the "path" property //D1A - return 0; //D1A - } //D1A - //D1A - - /** - Returns the descriptors for all properties. //D1A - @return The descriptors for all properties. //D1A - **/ //D1A - public PropertyDescriptor[] getPropertyDescriptors() //D1A - { //D1A - return properties_; //D1A - } //D1A - -} - diff --git a/cvsroot/src/com/ibm/as400/access/MRI.java b/cvsroot/src/com/ibm/as400/access/MRI.java deleted file mode 100644 index 7a9beaff3..000000000 --- a/cvsroot/src/com/ibm/as400/access/MRI.java +++ /dev/null @@ -1,571 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MRI.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.ListResourceBundle; - -/** - Locale-specific objects for the IBM Toolbox for Java. - **/ -// -// @B0A - Implementation note: -// This MRI contains ONLY resources that are needed in the -// proxy jar file. Resources not needed in the proxy jar -// file belong in MRI2. -// -public class MRI extends ListResourceBundle -{ - // NLS_MESSAGEFORMAT_NONE - // Each string is assumed NOT to be processed by the MessageFormat class. - // This means that a single quote must be coded as 1 single quote. - - // NLS_ENCODING=UTF-8 - // Instructs the translation tools to interpret the text as UTF-8. - - public Object[][] getContents() - { - return resources; - } - - private final static Object[][] resources = - { - // #TRANNOTE Before you add a new resource, please make - // #TRANNOTE sure you are not duplicating another. The - // #TRANNOTE goal is to keep the amount of translatable - // #TRANNOTE text down. - // #TRANNOTE - // #TRANNOTE NOTE TO TRANSLATORS: The format of a line of MRI - // #TRANNOTE is { "KEY", "value" }, - // #TRANNOTE - // #TRANNOTE The key must be left alone so translate only the value. - // #TRANNOTE - - // #TRANNOTE ##################################################### - // #TRANNOTE Property values. - // #TRANNOTE Start with PROP_VALUE_ prefix. - // #TRANNOTE ##################################################### - - // #TRANNOTE ##################################################### - // #TRANNOTE Dialog MRI. - // #TRANNOTE ##################################################### - - { "DLG_CONFIRM_LABEL", "Confirm:" }, - { "DLG_PASSWORDS_LABEL", "Passwords" }, - { "DLG_NEW_LABEL", "New:" }, - { "DLG_OLD_LABEL", "Old:" }, - - { "DLG_ABORT_BUTTON", "Abort" }, - { "DLG_HELP_BUTTON", "Help" }, - { "DLG_IGNORE_BUTTON", "Ignore" }, - { "DLG_NO_BUTTON", "No" }, - { "DLG_RETRY_BUTTON", "Retry" }, - { "DLG_YES_BUTTON", "Yes" }, - - { "DLG_DEFAULT_USER_EXISTS", "A default user already exists for this system." }, //@550 - { "DLG_SET_DEFAULT_USER_FAILED", "Default user has not been changed." }, - { "DLG_SIGNON_TITLE", "Signon to the System" }, //@550 - { "DLG_CHANGE_PASSWORD_TITLE", "Change Password" }, - { "DLG_MISSING_USERID", "Missing system name, user ID, or password." }, // @F4C - { "DLG_MISSING_PASSWORD", "Missing user ID, old or new password." }, - { "DLG_INVALID_USERID", "User ID is not valid." }, - { "DLG_CHANGE_PASSWORD_PROMPT", "Would you like to change your password now?" }, - - - // #TRANNOTE - // #TRANNOTE Please place the &0 in the appropriate place in the message. - // #TRANNOTE It (&0) will be substituted with the days to password - // #TRANNOTE expiration at runtime. - // #TRANNOTE - { "DLG_PASSWORD_EXP_WARNING", "Password will expire in &0 days." }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE Short descriptions and display names for events. - // #TRANNOTE Descriptions start with EVT_DESC_ prefix, display - // #TRANNOTE names start with EVT_NAME. - // #TRANNOTE ##################################################### - - { "EVT_DESC_ACTION_COMPLETED", "The action has completed." }, - { "EVT_NAME_ACTION_COMPLETED", "actionCompleted" }, - { "EVT_DESC_AS400FILE_RECORD_DESCRIPTION", "An AS400FileRecordDescription event has occurred." }, - - // #TRANNOTE An AS400FileRecordDescription event has occurred. - { "EVT_NAME_AS400FILE_RECORD_DESCRIPTION", "AS400FileRecordDescription" }, - { "EVT_DESC_CONNECTION_CONNECTED", "Connected to the system." }, //@550 - { "EVT_NAME_CONNECTION_CONNECTED", "connected" }, - { "EVT_DESC_CONNECTION_EVENT", "A connection event has occurred." }, - { "EVT_NAME_CONNECTION_EVENT", "connection" }, - { "EVT_DESC_FIELD_MODIFIED", "A field has changed." }, - { "EVT_NAME_FIELD_MODIFIED", "fieldModified" }, - { "EVT_DESC_FILE_EVENT", "A file event has occurred." }, - - // #TRANNOTE A file event has occurred. - { "EVT_NAME_FILE_EVENT", "fileEvent" }, - { "EVT_DESC_OUTQ_EVENT", "An output queue event has occurred." }, - { "EVT_NAME_OUTQ_EVENT", "outputQueue" }, - - // #TRANNOTE The meaning of 'property' here is like 'attribute'. - { "EVT_DESC_PROPERTY_CHANGE", "A bound property has changed." }, - - // #TRANNOTE A bound property has changed. - // #TRANNOTE The meaning of 'property' here is like 'attribute'. - { "EVT_NAME_PROPERTY_CHANGE", "propertyChange" }, - - // #TRANNOTE The meaning of 'property' here is like 'attribute'. - { "EVT_DESC_PROPERTY_VETO", "A constrained property has changed." }, - - // #TRANNOTE A constrained property has changed. - // #TRANNOTE The meaning of 'property' here is like 'attribute'. - { "EVT_NAME_PROPERTY_VETO", "vetoableChange" }, - { "EVT_DESC_RECORD_DESCRIPTION_EVENT", "A field description was added." }, - - // #TRANNOTE A field description was added. - { "EVT_NAME_RECORD_DESCRIPTION_EVENT", "recordDescription" }, - { "EVT_DESC_DQ_DATA_EVENT", "A data queue data event has occurred." }, - { "EVT_NAME_DQ_DATA_EVENT", "dataQueueDataEvent" }, - { "EVT_DESC_DQ_OBJECT_EVENT", "A data queue object event has occurred." }, - { "EVT_NAME_DQ_OBJECT_EVENT", "dataQueueObjectEvent" }, - { "EVT_DESC_PRINT_OBJECT_EVENT", "A print object list event has occurred." }, - { "EVT_NAME_PRINT_OBJECT_EVENT", "printObjectList" }, - { "EVT_DESC_US_EVENT", "A user space event has occurred." }, - - // #TRANNOTE A user space event has occurred. - { "EVT_NAME_US_EVENT", "userSpaceEvent" }, - { "EVT_DESC_DA_EVENT", "A data area event has occurred." }, - - // #TRANNOTE A data area event has occurred. - { "EVT_NAME_DA_EVENT", "dataAreaEvent" }, - - // #TRANNOTE ##################################################### - // #TRANNOTE Common exception messages. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix EXC_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - { "EXC_ACCESS_DENIED", "Access to request was denied." }, - { "EXC_AS400_ERROR", "An error occurred on the system." }, //@550 - { "EXC_ATTRIBUTE_NOT_VALID", "Attribute name not valid." }, - - { "EXC_HIGH_NIBBLE_NOT_VALID", "High-order nibble of the byte at array offset &0 is not valid. Byte value: &1" }, - { "EXC_LOW_NIBBLE_NOT_VALID", "Low-order nibble of the byte at array offset &0 is not valid. Byte value: &1." }, - - { "EXC_COMMUNICATIONS_ERROR", "Error occurred in communications." }, - { "EXC_CONNECT_FAILED", "Failed to connect." }, - { "EXC_CONNECTION_DROPPED", "Connection was dropped unexpectedly." }, - { "EXC_CONNECTION_NOT_ACTIVE", "Connection is not active." }, - { "EXC_CONNECTION_NOT_ESTABLISHED", "Unable to establish a connection." }, - { "EXC_CONNECTION_NOT_PASSED_AUTHORITY", "Not able to pass connection to server job. User profile for server job does not have enough authority." }, // @F1A - { "EXC_CONNECTION_NOT_PASSED_LENGTH", "Not able to pass connection to server job. Program data length is incorrect." }, // @F1A - { "EXC_CONNECTION_NOT_PASSED_LIBRARY_AUTHORITY", "Not able to pass connection to server job. Daemon job is not authorized to server job library." }, // @F1A - { "EXC_CONNECTION_NOT_PASSED_PRESTART_NOT_STARTED", "Not able to pass connection to server job. Prestart job could not be started." }, // @F1A - { "EXC_CONNECTION_NOT_PASSED_PROFILE", "Not able to pass connection to server job. User profile for server job does not exist." }, // @F1A - { "EXC_CONNECTION_NOT_PASSED_PROGRAM_AUTHORITY", "Not able to pass connection to server job. Daemon job is not authorized to server job program." }, // @F1A - { "EXC_CONNECTION_NOT_PASSED_PROGRAM_NOT_FOUND", "Not able to pass connection to server job. Server job program was not found." }, // @F1A - { "EXC_CONNECTION_NOT_PASSED_RECEIVER_AREA", "Not able to pass connection to server job. Receiver area is too small." }, // @F1A - { "EXC_CONNECTION_NOT_PASSED_SERVER_ENDING", "Not able to pass connection to server job. Server job is ending." }, // @F1A - { "EXC_CONNECTION_NOT_PASSED_SERVER_NOT_STARTED", "Not able to pass connection to server job. Server job could not be started." }, // @F1A - { "EXC_CONNECTION_NOT_PASSED_SUBSYSTEM", "Not able to pass connection to server job. Subsystem problem detected." }, // @F1A - { "EXC_CONNECTION_NOT_PASSED_TIMEOUT", "Not able to pass connection to server job. Server job timed out." }, // @F1A - { "EXC_CONNECTION_NOT_PASSED_UNKNOWN", "Not able to pass connection to server job. Unknown or unrecoverable error occured." }, // @F1A - { "EXC_CONNECTION_NOT_VALID", "Connection is not valid." }, - { "EXC_CONNECTION_PORT_CANNOT_CONNECT_TO", "Unable to connect to the port." }, - - { "EXC_DATA_AREA_CHARACTER", "Attempted to use a character data area with a non-character data area object." }, //@A1A - { "EXC_DATA_AREA_DECIMAL", "Attempted to use a decimal data area with a non-decimal data area object." }, //@A1A - { "EXC_DATA_AREA_LOGICAL", "Attempted to use a logical data area with a non-logical data area object." }, //@A1A - { "EXC_DATA_NOT_VALID", "Data is not valid." }, //@A1A - { "EXC_DATA_QUEUE_KEYED", "Attempted to use keyed queue with a non-keyed data queue object." }, - { "EXC_DATA_QUEUE_NOT_KEYED", "Attempted to use a non-keyed data queue with a keyed data queue object." }, - { "EXC_DATA_STREAM_LEVEL_NOT_VALID", "Data stream level is not valid." }, - { "EXC_DATA_STREAM_SYNTAX_ERROR", "Syntax error in the data stream." }, - { "EXC_DATA_STREAM_UNKNOWN", "Data stream is not known." }, - - { "EXC_DIRECTORY_ENTRY_ACCESS_DENIED", "Directory entry access denied." }, - { "EXC_DIRECTORY_ENTRY_DAMAGED", "Directory entry is damaged." }, - { "EXC_DIRECTORY_ENTRY_EXISTS", "Directory entry exists." }, - { "EXC_DIRECTORY_NAME_NOT_VALID", "Directory name not valid." }, - { "EXC_DIRECTORY_NOT_EMPTY", "Directory is not empty." }, - { "EXC_DISCONNECT_RECEIVED", "Disconnect request received, connection terminated." }, - - { "EXC_EXIT_POINT_PROCESSING_ERROR", "Error occurred when processing exit point." }, - { "EXC_EXIT_PROGRAM_CALL_ERROR", "Error occurred when calling exit program." }, - { "EXC_EXIT_PROGRAM_DENIED_REQUEST", "Exit program denied request." }, - { "EXC_EXIT_PROGRAM_ERROR", "Error occurred in the exit program." }, - { "EXC_EXIT_PROGRAM_NOT_AUTHORIZED", "User is not authorized to exit program." }, - { "EXC_EXIT_PROGRAM_NOT_FOUND", "Exit program could not be found." }, - { "EXC_EXIT_PROGRAM_NUMBER_NOT_VALID", "Number of exit programs is not valid." }, - { "EXC_EXIT_PROGRAM_RESOLVE_ERROR", "Error occurred when resolving to exit program." }, - - { "EXC_FILE_END", "End of file reached." }, - { "EXC_FILE_IN_USE", "File in use." }, - { "EXC_FILE_NOT_FOUND", "File was not found." }, - { "EXC_FILES_NOT_AVAILABLE", "No more files are available." }, - { "EXC_FILE_SUBSTREAM_IN_USE", "Substream in use." }, - - { "EXC_GENERATE_TOKEN_AUTHORITY_INSUFFICIENT", "User is not authorized to generate a profile token for another user." }, // @F2A - { "EXC_GENERATE_TOKEN_CAN_NOT_CHANGE_CCSID", "Can not change the CCSID to use for EIM requests." }, // @F2A - { "EXC_GENERATE_TOKEN_CAN_NOT_CONNECT", "Can not connect to the system EIM domain." }, // @F2A - { "EXC_GENERATE_TOKEN_CAN_NOT_OBTAIN_NAME", "Can not obtain the EIM registry name." }, // @F2A - { "EXC_GENERATE_TOKEN_NO_MAPPING", "No mapping exists." }, // @F2A - { "EXC_GENERATE_TOKEN_REQUEST_NOT_VALID", "Generate token request is not valid." }, // @F1A - - { "EXC_HANDLE_NOT_VALID", "Handle is not valid." }, - - { "EXC_INTERNAL_ERROR", "Internal error occurred." }, - // @E5D { "EXC_IMPLEMENTATION_NOT_FOUND", "Implementation class not found." }, - - { "EXC_KERBEROS_TICKET_NOT_VALID_CONSISTENCY", "Authentication token is not valid. Consistency checks failed." }, // @F1A @F5C - { "EXC_KERBEROS_TICKET_NOT_VALID_CREDANTIAL_STRUCTURE", "Kerberos ticket is not valid." }, // @F1A - { "EXC_KERBEROS_TICKET_NOT_VALID_CREDENTIAL_NOT_VALID", "Kerberos ticket is not valid." }, // @F1A - { "EXC_KERBEROS_TICKET_NOT_VALID_CREDENTIAL_NO_LONGER_VALID", "Kerberos ticket is not valid." }, // @F1A - { "EXC_KERBEROS_TICKET_NOT_VALID_EIM", "Authentication token is not valid. EIM configuration error detected." }, // @F1A @F5C - { "EXC_KERBEROS_TICKET_NOT_VALID_MECHANISM", "Kerberos ticket is not valid." }, // @F1A - { "EXC_KERBEROS_TICKET_NOT_VALID_MULTIPLE_PROFILES", "Authentication token is not valid. Token maps to multiple user profile names." }, // @F1A @F5C - { "EXC_KERBEROS_TICKET_NOT_VALID_RETRIEVE", "Kerberos service ticket could not be retrieved." }, // @F1A @550 - { "EXC_KERBEROS_TICKET_NOT_VALID_SIGNATURE", "Kerberos token or identity token contains incorrect signature." }, // @F1A @F5C - { "EXC_KERBEROS_TICKET_NOT_VALID_SYSTEM_PROFILE", "Kerberos ticket is not valid." }, // @F1A - { "EXC_KERBEROS_TICKET_NOT_VALID_VERIFICATION", "Kerberos ticket is not valid." }, // @F1A - - { "EXC_LIBRARY_AUTHORITY_INSUFFICIENT", "User is not authorized to library." }, - { "EXC_LIBRARY_DOES_NOT_EXIST", "Library does not exist." }, - { "EXC_LIBRARY_LENGTH_NOT_VALID", "Length of the library name is not valid." }, - { "EXC_LIBRARY_SPECIFICATION_NOT_VALID", "Library not specified correctly." }, - { "EXC_LOCK_VIOLATION", "Lock violation occurred." }, - - { "EXC_MEMBER_LENGTH_NOT_VALID", "Length of the member name is not valid." }, - { "EXC_MEMBER_WITHOUT_FILE", "Member is not contained in a file." }, - - { "EXC_OBJECT_ALREADY_EXISTS", "Object already exists." }, - { "EXC_OBJECT_AUTHORITY_INSUFFICIENT", "User is not authorized to object." }, - { "EXC_OBJECT_DOES_NOT_EXIST", "Object does not exist." }, - { "EXC_OBJECT_LENGTH_NOT_VALID", "Length of the object name is not valid." }, - { "EXC_OBJECT_TYPE_NOT_VALID", "Object type is not valid." }, - { "EXC_OBJECT_TYPE_UNKNOWN", "Object type is unknown." }, //@A1A - - { "EXC_PARAMETER_NOT_SUPPORTED", "Parameter is not supported." }, - { "EXC_PARAMETER_VALUE_NOT_SUPPORTED", "Parameter value is not supported." }, - { "EXC_PASSWORD_CHANGE_NOT_ALLOWED", "Password change is not allowed at this time." }, // @G1A - { "EXC_PASSWORD_CHANGE_REQUEST_NOT_VALID", "Password change request is not valid." }, - { "EXC_PASSWORD_ERROR", "Password error." }, - { "EXC_PASSWORD_ENCRYPT_INVALID", "Password encryption indicator is not valid." }, - { "EXC_PASSWORD_EXPIRED", "Password is expired." }, - { "EXC_PASSWORD_IMPROPERLY_ENCRYPTED", "Password is improperly encrypted." }, - { "EXC_PASSWORD_INCORRECT", "Password is incorrect." }, - { "EXC_PASSWORD_INCORRECT_USERID_DISABLE", "Password is incorrect. User ID will be disabled after next incorrect sign-on." }, - { "EXC_PASSWORD_LENGTH_NOT_VALID", "Password length is not valid." }, - { "EXC_PASSWORD_NEW_ADJACENT_DIGITS", "New password has adjacent digits." }, - { "EXC_PASSWORD_NEW_CHARACTER_NOT_VALID", "New password contains a character that is not valid." }, // @F1A - { "EXC_PASSWORD_NEW_CONSECUTIVE_REPEAT_CHARACTER", "New password contains a character repeated consecutively." }, - { "EXC_PASSWORD_NEW_DISALLOWED", "New password is not allowed." }, - { "EXC_PASSWORD_NEW_NO_ALPHABETIC", "New password must contain at least one alphabetic character." }, - { "EXC_PASSWORD_NEW_NO_NUMERIC", "New password must contain at least one numeric character." }, - { "EXC_PASSWORD_NEW_NOT_VALID", "New password is not valid." }, - { "EXC_PASSWORD_NEW_PREVIOUSLY_USED", "New password was previously used." }, - { "EXC_PASSWORD_NEW_REPEAT_CHARACTER", "New password contains a character used more than once." }, - { "EXC_PASSWORD_NEW_SAME_POSITION", "New password contains the same character in the same position as the previous password." }, // @E2A - { "EXC_PASSWORD_NEW_TOO_LONG", "New password is too long." }, - { "EXC_PASSWORD_NEW_TOO_SHORT", "New password is too short." }, - { "EXC_PASSWORD_NEW_USERID", "New password contains user ID as part of the password." }, - { "EXC_PASSWORD_NEW_VALIDATION_PROGRAM", "Password validation program failed the request." }, // @F2A - { "EXC_PASSWORD_NONE", "Password is *NONE." }, // @F1A - { "EXC_PASSWORD_NOT_MATCH", "New password and confirm password are not the same." }, - { "EXC_PASSWORD_NOT_SET", "Password is not set." }, - { "EXC_PASSWORD_OLD_NOT_VALID", "Old password is not valid." }, - { "EXC_PASSWORD_PRE_V2R2", "Password has pre-V2R2 encryption." }, // @F1A - { "EXC_PASSWORD_VALUE_NOT_VALID", "Password value is not valid." }, // @G1A - { "EXC_PATH_NOT_FOUND", "Path name was not found." }, - { "EXC_PROFILE_TOKEN_NOT_VALID", "Profile token or identity token is not valid." }, // @F1A @F5C - { "EXC_PROFILE_TOKEN_NOT_VALID_MAXIMUM", "Profile token is not valid. Maximum number of profile tokens for the system already generated." }, // @F1A - { "EXC_PROFILE_TOKEN_NOT_VALID_NOT_REGENERABLE", "Profile token is not valid. Profile token is not regenerable." }, // @F1A - { "EXC_PROFILE_TOKEN_NOT_VALID_TIMEOUT_NOT_VALID", "Profile token is not valid. Timeout interval is not valid." }, // @F1A - { "EXC_PROFILE_TOKEN_NOT_VALID_TYPE_NOT_VALID", "Profile token is not valid. Type of profile token is not valid." }, // @F1A - { "EXC_PROTOCOL_ERROR", "Protocol error occurred." }, - - { "EXC_QSYS_PREFIX_MISSING", "Object not in QSYS file system." }, - { "EXC_QSYS_SYNTAX_NOT_VALID", "Object in library QSYS specified incorrectly." }, - - { "EXC_RANDOM_SEED_REQUIRED", "Random seed required when doing password substitute." }, - { "EXC_RANDOM_SEED_EXCHANGE_INVALID", "Invalid exchange random seed request." }, - { "EXC_RANDOM_SEED_INVALID", "Random seed is not valid." }, - { "EXC_REQUEST_DATA_ERROR", "Error in request data." }, - { "EXC_REQUEST_DENIED", "Request was denied." }, - { "EXC_REQUEST_ID_NOT_VALID", "Request ID is not valid." }, - { "EXC_REQUEST_NOT_SUPPORTED", "Request is not supported." }, - { "EXC_REQUEST_NOT_VALID", "Request is not valid." }, - { "EXC_RESOURCE_LIMIT_EXCEEDED", "Resource limit was exceeded." }, - { "EXC_RESOURCE_NOT_AVAILABLE", "Resource not available." }, - - { "EXC_SECURITY_GENERAL", "General security error." }, - { "EXC_SECURITY_INVALID_STATE", "Internal error in the security manager." }, - { "EXC_SEND_REPLY_INVALID", "Send reply indicator is not valid." }, - { "EXC_SERVER_CONVERSION_ERROR", "An error occurred on the system while converting data between code pages." }, // @F5A @550 - { "EXC_SERVER_CRYPTO_ERROR", "An error occurred on the system while using cryptographic interfaces." }, // @F5A @550 - { "EXC_SERVER_EIM_ERROR", "An error occurred on the system while using EIM interfaces." }, // @F5A @550 - { "EXC_SERVER_ID_NOT_VALID", "Server ID is not valid." }, // @F1A - { "EXC_SERVER_KEY_NOT_FOUND", "The system could not find the public key." }, // @F5A @550 - { "EXC_SERVER_NOT_STARTED", "Unable to start the host server." }, //@550 - { "EXC_SERVER_NO_MEMORY", "System was not able to allocate space needed for authorization." }, // @F5A @550 - { "EXC_SERVER_TOKEN_VERSION", "The system version does support the token version." }, // @F5A @550 - { "EXC_SHARE_VIOLATION", "Sharing violation occurred." }, - { "EXC_SIGNON_CANCELED", "Signon was canceled." }, - { "EXC_SIGNON_CONNECT_FAILED", "Failed to connect to signon server." }, - { "EXC_SIGNON_REQUEST_NOT_VALID", "Signon request is not valid." }, - { "EXC_SPECIAL_AUTHORITY_INSUFFICIENT", "User is not authorized for operation." }, // @E4A - { "EXC_SPOOLED_FILE_NO_MESSAGE_WAITING", "Spooled file does not have a message waiting." }, - { "EXC_START_SERVER_REQUEST_NOT_VALID", "Start server request is not valid. User ID or password may be missing." }, - { "EXC_START_SERVER_UNKNOWN_ERROR", "Unknown error starting host server." }, //@550 - { "EXC_SYNTAX_ERROR", "Syntax error occurred." }, - { "EXC_SYSTEM_LEVEL_NOT_CORRECT", "Correct system level is required." }, //@550 - { "EXC_SYSTEM_UNKNOWN", "System name is not known." }, // @F4A - - { "EXC_TOKEN_LENGTH_NOT_VALID", "Token length is not valid." }, // @F1A - { "EXC_TOKEN_TYPE_NOT_VALID", "Token type is not valid." }, // @F1A - { "EXC_TYPE_LENGTH_NOT_VALID", "Length of the object type is not valid." }, - - { "EXC_UNEXPECTED_RETURN_CODE", "Unexpected return code." }, - { "EXC_UNEXPECTED_EXCEPTION", "Unexpected exception." }, // @B0A - { "EXC_USERID_DISABLE", "User ID is disabled." }, - { "EXC_USERID_ERROR", "User ID error." }, - { "EXC_USERID_LENGTH_NOT_VALID", "User ID length is not valid." }, - { "EXC_USERID_MISMATCH", "User ID does not match authentication token." }, // @F2A - { "EXC_USERID_NOT_SET", "User ID is not set." }, - { "EXC_USERID_UNKNOWN", "User ID is not known." }, - - { "EXC_VALUE_CANNOT_CONVERT", "Value cannot be converted." }, - { "EXC_VRM_NOT_VALID", "Version Release Modification is not valid." }, - { "EXC_WRITER_JOB_ENDED", "Writer job has ended." }, - - - - // #TRANNOTE ##################################################### - // #TRANNOTE Short descriptions and display names for properties. - // #TRANNOTE Descriptions start with PROP_DESC_ prefix, display - // #TRANNOTE names start with PROP_NAME. - // #TRANNOTE ##################################################### - - { "PROP_DESC_AFPR_FONTPELDENSITY_FILTER", "The filter that selects font resources by their pel density." }, - { "PROP_NAME_AFPR_FONTPELDENSITY_FILTER", "fontPelDensityFilter" }, - { "PROP_DESC_AFPR_NAME_FILTER", "The filter that selects Advanced Function Print resources by their integrated file system name." }, - { "PROP_NAME_AFPR_NAME_FILTER", "resourceFilter" }, - { "PROP_DESC_AFPR_SPLF_FILTER", "The filter that selects Advanced Function Print resources for the specified spooled file." }, - { "PROP_NAME_AFPR_SPLF_FILTER", "spooledFileFilter" }, - { "PROP_DESC_APPEND", "Indicates if an existing file is appended or replaced." }, - - // #TRANNOTE Indicates if an existing file is appended or replaced. - { "PROP_NAME_APPEND_PROP", "append" }, - { "PROP_NAME_AS400_CCSID", "characterSetID" }, - { "PROP_DESC_AS400_CCSID", "Code character set identifier." }, - { "PROP_NAME_AS400_GUI", "guiAvailable" }, - { "PROP_DESC_AS400_GUI", "User interface available." }, - { "PROP_NAME_AS400_SYSTEM", "systemName" }, - { "PROP_DESC_AS400_SYSTEM", "The name of the system." }, //@550 - { "PROP_NAME_AS400_DEFUSER", "useDefaultUserID" }, - { "PROP_DESC_AS400_DEFUSER", "Use the default user ID for signon." }, - { "PROP_NAME_AS400_PWCACHE", "usePasswordCache" }, - { "PROP_DESC_AS400_PWCACHE", "Use the password cache." }, - { "PROP_NAME_AS400_USERID", "userID" }, - { "PROP_DESC_AS400_USERID", "User ID." }, - { "PROP_NAME_AS400_PASSWORD", "password" }, - { "PROP_DESC_AS400_PASSWORD", "Password." }, - { "PROP_NAME_AS400_PROFILETOKEN", "profileToken" }, // @F1A - { "PROP_DESC_AS400_PROFILETOKEN", "Profile token." }, // @F1A - { "PROP_NAME_AS400_PROXYSERVER", "proxyServer" }, // @E2A - { "PROP_DESC_AS400_PROXYSERVER", "Proxy server." }, // @E2A - { "PROP_NAME_AS400_MUSTUSESOCKETS", "mustUseSockets" }, // @E2A - { "PROP_DESC_AS400_MUSTUSESOCKETS", "Must use sockets." }, // @E2A - { "PROP_NAME_AS400_SHOWCHECKBOXES", "showCheckboxes" }, // @E2A - { "PROP_DESC_AS400_SHOWCHECKBOXES", "Show checkboxes." }, // @E2A - { "PROP_NAME_AS400_THREADUSED", "threadUsed" }, // @E2A - { "PROP_DESC_AS400_THREADUSED", "Thread used." }, // @E2A - { "PROP_NAME_SECUREAS400_KEYRINGNAME", "keyRingName" }, // @E2A - { "PROP_DESC_SECUREAS400_KEYRINGNAME", "Key ring name." }, // @E2A - { "PROP_NAME_SECUREAS400_KEYRINGPASSWORD", "keyRingPassword" }, // @E2A - { "PROP_DESC_SECUREAS400_KEYRINGPASSWORD", "Key ring password." }, // @E2A - { "PROP_NAME_SECUREAS400_PROXYENCRYPTIONMODE", "proxyEncryptionMode" }, // @E2A - { "PROP_DESC_SECUREAS400_PROXYENCRYPTIONMODE", "Proxy encryption mode." }, // @E2A - { "PROP_DESC_AS400ARRAY_SIZE", "The number of elements in the array." }, - { "PROP_NAME_AS400ARRAY_SIZE", "numberOfElements" }, - { "PROP_DESC_AS400ARRAY_TYPE", "The type of the array." }, - { "PROP_NAME_AS400ARRAY_TYPE", "type" }, - { "PROP_DESC_AS400STRUCTURE_MEMBERS", "The data types of the structure members." }, - { "PROP_NAME_AS400STRUCTURE_MEMBERS", "members" }, - { "PROP_DESC_EXISTENCE_OPTION", "Specifies what to do if the file exists." }, - - // #TRANNOTE Specifies what to do if the file exists. - { "PROP_NAME_EXISTENCE_OPTION", "existenceOption" }, - { "PROP_NAME_FD", "FD" }, - { "PROP_DESC_FIELD_DESCRIPTIONS", "The field descriptions for this record format." }, - - // #TRANNOTE The field descriptions for this record format. - { "PROP_NAME_FIELD_DESCRIPTIONS", "fieldDescriptions" }, - { "PROP_DESC_FIELD_NAMES", "The field names of the fields in this record format." }, - - // #TRANNOTE The field names of the fields in this record format. - { "PROP_NAME_FIELD_NAMES", "fieldNames" }, - { "PROP_DESC_FIELDS", "The field values for the fields in this record." }, - - // #TRANNOTE The field values for the fields in this record. - { "PROP_NAME_FIELDS", "fields" }, - { "PROP_DESC_FILE_DESCRIPTOR", "A file descriptor for an open file." }, - - // #TRANNOTE A file descriptor for an open file. - { "PROP_NAME_FILE_DESCRIPTOR", "FD" }, - { "PROP_DESC_FILE_NAME", "The name of the file." }, - { "PROP_NAME_FILE_NAME", "fileName" }, - { "PROP_DESC_KEY_FIELD_DESCRIPTIONS", "The key field descriptions for this record format." }, - - // #TRANNOTE The key field descriptions for this record format. - { "PROP_NAME_KEY_FIELD_DESCRIPTIONS", "keyFieldDescriptions" }, - { "PROP_DESC_KEY_FIELD_NAMES", "The field names of the key fields in this record format." }, - - // #TRANNOTE The field names of the key fields in this record format. - { "PROP_NAME_KEY_FIELD_NAMES", "keyFieldNames" }, - { "PROP_DESC_KEY_FIELDS", "The field values for the key fields in this record." }, - - // #TRANNOTE The field values for the key fields in this record. - { "PROP_NAME_KEY_FIELDS", "keyFields" }, - { "PROP_DESC_LIBRARY", "The name of the library in which this object resides." }, - - // #TRANNOTE The name of the library. - { "PROP_NAME_LIBRARY", "libraryName" }, - { "PROP_DESC_MEMBER", "The name of the file member." }, - - // #TRANNOTE The name of the file member. - { "PROP_NAME_MEMBER", "memberName" }, - { "PROP_DESC_MODE", "The access mode." }, - - // #TRANNOTE The access mode. - { "PROP_NAME_MODE", "mode" }, - { "PROP_DESC_OBJECT", "The name of the object." }, - - // #TRANNOTE The name of the object. - { "PROP_NAME_OBJECT", "objectName" }, - { "PROP_DESC_OUTQ_NAME_FILTER", "The filter that selects output queues by their integrated file system name." }, - { "PROP_NAME_OUTQ_NAME_FILTER", "queueFilter" }, - { "PROP_DESC_PATH", "The integrated file system name of the object." }, - - // #TRANNOTE The integrated file system name of the object. - { "PROP_NAME_PATH", "path" }, - { "PROP_DESC_PRTD_NAME_FILTER", "The filter that selects printers by their name." }, - { "PROP_NAME_PRTD_NAME_FILTER", "printerFilter" }, - { "PROP_NAME_PRTD_NAME", "printerName" }, - { "PROP_DESC_PRTD_NAME", "The name of the printer." }, - { "PROP_DESC_PRTF_NAME_FILTER", "The filter that selects printer files by their integrated file system name." }, - { "PROP_NAME_PRTF_NAME_FILTER", "printerFileFilter" }, - { "PROP_DESC_RECORD_FORMAT", "The record format for the object." }, - - // #TRANNOTE The record format for the object. - { "PROP_NAME_RECORD_FORMAT", "recordFormat" }, - { "PROP_DESC_RECORD_FORMAT_NAME", "The name of the record format." }, - - // #TRANNOTE The name of the record format. - { "PROP_NAME_RECORD_FORMAT_NAME", "name" }, - { "PROP_DESC_RECORD_NAME", "The name of the record." }, - - // #TRANNOTE The name of the record. - { "PROP_NAME_RECORD_NAME", "recordName" }, - { "PROP_DESC_RECORD_NUMBER", "The record number of the record." }, - - // #TRANNOTE The record number of the record. - { "PROP_NAME_RECORD_NUMBER", "recordNumber" }, - { "PROP_DESC_SHARE_OPTION", "Specifies how the file is shared." }, - - // #TRANNOTE Specifies how the file is shared. - { "PROP_NAME_SHARE_OPTION", "shareOption" }, - { "PROP_DESC_SPLF_FORMTYPE_FILTER", "The filter that selects spooled files by their form type." }, - { "PROP_NAME_SPLF_FORMTYPE_FILTER", "formTypeFilter" }, - { "PROP_DESC_SPLF_OUTQ_FILTER", "The filter that selects spooled files by the integrated file system name of the output queue containing them." }, - { "PROP_NAME_SPLF_OUTQ_FILTER", "queueFilter" }, - { "PROP_DESC_SPLF_USER_FILTER", "The filter that selects spooled files by the user that created them." }, - { "PROP_NAME_SPLF_USER_FILTER", "userFilter" }, - { "PROP_DESC_SPLF_USERDATA_FILTER", "The filter that selects spooled files by their user data." }, - { "PROP_NAME_SPLF_USERDATA_FILTER", "userDataFilter" }, - { "PROP_DESC_SYSTEM", "The system on which the object resides." }, - { "PROP_NAME_SYSTEM", "system" }, - { "PROP_DESC_TYPE", "The type of object." }, - - // #TRANNOTE The type of object. - { "PROP_NAME_TYPE", "objectType" }, - { "PROP_DESC_WRTJ_NAME_FILTER", "The filter that selects writer jobs by their name." }, - { "PROP_NAME_WRTJ_NAME_FILTER", "writerFilter" }, - { "PROP_DESC_WRTJ_OUTQ_FILTER", "The filter that selects writer jobs by the integrated file system name of the output queue being processed." }, - { "PROP_NAME_WRTJ_OUTQ_FILTER", "queueFilter" }, - { "PROP_DESC_COMMAND", "The command to run on the system." }, //@550 - { "PROP_NAME_COMMAND", "command" }, - { "PROP_DESC_PROGRAM", "The integrated file system name of the program to run." }, - { "PROP_NAME_PROGRAM", "program" }, - { "PROP_DESC_SUCCESSFUL", "Indicates if the requested action was successful." }, - { "PROP_NAME_SUCCESSFUL", "successful" }, - { "PROP_DESC_PARMLIST", "The list of parameters for the program." }, - { "PROP_NAME_PARMLIST", "parameterList" }, - { "PROP_DESC_PARMINPUT", "The input data for a parameter." }, - { "PROP_NAME_PARMINPUT", "inputData" }, - { "PROP_DESC_PARMOUTPUT", "The output data for a parameter." }, - { "PROP_NAME_PARMOUTPUT", "outputData" }, - { "PROP_DESC_PARMOUTPUTLEN", "The length of the output data returned for a parameter." }, - { "PROP_NAME_PARMOUTPUTLEN", "outputDataLength" }, - { "PROP_DESC_NAME", "The name of the object." }, - { "PROP_NAME_NAME", "name" }, - { "PROP_DESC_DQATTRIBUTES", "The attributes of the data queue." }, - { "PROP_NAME_DQATTRIBUTES", "attributes" }, - { "PROP_DESC_ENTRYLENGTH", "The maximum number of bytes per data queue entry." }, - { "PROP_NAME_ENTRYLENGTH", "maxEntryLength" }, - { "PROP_DESC_AUTHORITY", "The public authority for the data queue." }, - { "PROP_NAME_AUTHORITY", "authority" }, - { "PROP_DESC_SAVESENDERINFO", "Indicates if information about the origin of each entry is saved." }, - { "PROP_NAME_SAVESENDERINFO", "saveSenderInfo" }, - { "PROP_DESC_FIFO", "Indicates if entries on the queue are read in FIFO or LIFO order." }, - { "PROP_NAME_FIFO", "FIFO" }, - { "PROP_DESC_FORCETOAUX", "Indicates if data is forced to auxiliary storage before returning." }, - { "PROP_NAME_FORCETOAUX", "forceToAuxiliaryStorage" }, - { "PROP_DESC_DESCRIPTION", "The text description for the data queue." }, - { "PROP_NAME_DESCRIPTION", "description" }, - { "PROP_DESC_KEYLENGTH", "The number of bytes in the data queue key." }, - { "PROP_NAME_KEYLENGTH", "keyLength" }, - - { "PROP_DESC_PARMTYPE", "The program parameter type." }, //@C1A - { "PROP_NAME_PARMTYPE", "parameterType" }, //@C1A - { "PROP_DESC_PARMPROCEDURE", "The name of procedure." }, //@C1A - { "PROP_NAME_PARMPROCEDURE", "procedureName" }, //@C1A - { "PROP_DESC_PARMRETURNFORMAT", "The format of the returned value." }, //@C1A - { "PROP_NAME_PARMRETURNFORMAT", "returnValueFormat" }, //@C1A - - // @E1 new for user space - { "PROP_DESC_US_MUSTUSEPGMCALL", "Use ProgramCall to read and write user space data." }, //@E1a - { "PROP_NAME_US_MUSTUSEPGMCALL", "mustUseProgramCall" }, //@E1A - - // @F3 new for user list - { "PROP_NAME_GROUPINFO", "groupInfo" }, - { "PROP_DESC_GROUPINFO", "The group profile whose members are to be returned." }, - { "PROP_NAME_USERINFO", "userInfo" }, - { "PROP_DESC_USERINFO", "A description of which users are to be returned." }, - { "PROP_NAME_USERPROFILE", "userProfile" }, - { "PROP_DESC_USERPROFILE", "The profile names to include in the list." }, - - // Proxy support MRI. @B0A - // #TRANNOTE ################################################################ - // #TRANNOTE The following are error and informational (verbose) messages. - // #TRANNOTE ################################################################ - { "PROXY_CONNECTION_CLOSED", "Connection &0 closed."}, - { "PROXY_CONNECTION_ACCEPTED", "&0 accepted connection requested by &1 as connection &2." }, - { "PROXY_CONNECTION_REDIRECTED", "&0 rejected connection requested by &1 and redirected to peer &2." }, - { "PROXY_CONNECTION_REJECTED", "&0 rejected connection requested by &1. No peer was suggested." }, - - { "EXC_PROXY_CONNECTION_NOT_ESTABLISHED", "A connection to the proxy server cannot be established." }, - { "EXC_PROXY_CONNECTION_DROPPED", "The connection to the proxy server was dropped." }, - { "EXC_PROXY_CONNECTION_REJECTED", "The connection to the proxy server was not accepted by the proxy server." }, - { "EXC_PROXY_VERSION_MISMATCH", "The client and proxy server are running different versions of code." }, // @E6A - }; -} diff --git a/cvsroot/src/com/ibm/as400/access/MRI2.java b/cvsroot/src/com/ibm/as400/access/MRI2.java deleted file mode 100644 index 099f0b677..000000000 --- a/cvsroot/src/com/ibm/as400/access/MRI2.java +++ /dev/null @@ -1,1055 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MRI2.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.*; - -/** -Locale-specific objects for the IBM Toolbox for Java. -**/ -// -// Implementation note: -// This MRI contains ONLY resources that are NOT needed -// in the proxy jar file. Resources needed in the proxy jar -// file belong in MRI class. -// -public class MRI2 extends ListResourceBundle -{ - // NLS_MESSAGEFORMAT_NONE - // Each string is assumed NOT to be processed by the MessageFormat class. - // This means that a single quote must be coded as 1 single quote. - - // NLS_ENCODING=UTF-8 - // Instructs the translation tools to interpret the text as UTF-8. - - public Object[][] getContents() - { - return resources; - } - - private final static Object[][] resources= { - - // #TRANNOTE Before you add a new resource, please make - // #TRANNOTE sure you are not duplicating another. The - // #TRANNOTE goal is to keep the amount of translatable - // #TRANNOTE text down. - // #TRANNOTE - // #TRANNOTE NOTE TO TRANSLATORS: The format of a line of MRI - // #TRANNOTE is { "KEY", "value" }, - // #TRANNOTE - // #TRANNOTE The key must be left alone so translate only the value. - // #TRANNOTE - - - // #TRANNOTE ##################################################### - // #TRANNOTE Property values. - // #TRANNOTE Start with PROP_VALUE_ prefix. - // #TRANNOTE ##################################################### - - // #TRANNOTE Existence option and share option property values for - // #TRANNOTE existenceOption and shareOption properties. These are used by - // #TRANNOTE IFSExistenceOptionEditor and IFSShareOptionEditor. - // #TRANNOTE Fail if the file exists, create the file if it doesn't - { "EDIT_FAIL_CREATE", "fail or create" }, - - // #TRANNOTE Open the file if it exists, create the file if it doesn't - { "EDIT_OPEN_CREATE", "open or create" }, - - // #TRANNOTE Open the file if it exists, fail if it doesn't - { "EDIT_OPEN_FAIL", "open or fail" }, - - // #TRANNOTE Replace file if it exists, create the file if it doesn't - { "EDIT_REPLACE_CREATE", "replace or create" }, - - // #TRANNOTE Replace the file if it exists, fail if it doesn't - { "EDIT_REPLACE_FAIL", "replace or fail" }, - - // #TRANNOTE Allow read/write access by other users. - { "EDIT_SHARE_ALL", "share with all" }, - - // #TRANNOTE Allow read only access by other users. - { "EDIT_SHARE_READERS", "share with readers" }, - - // #TRANNOTE Allow write only access by other users. - { "EDIT_SHARE_WRITERS", "share with writers" }, - - // #TRANNOTE Don't allow any access to other users. - { "EDIT_SHARE_NONE", "share with none" }, - - - // #TRANNOTE Font Pel Density Filter property values for the - // #TRANNOTE fontPelDensityFilter property. - { "EDIT_FONTPELDENSITY_NONE", "No filter" }, - { "EDIT_FONTPELDENSITY_240", "240 dots per inch" }, - { "EDIT_FONTPELDENSITY_300", "300 dots per inch" }, - - - - // #TRANNOTE ##################################################### - // #TRANNOTE Short descriptions and display names for events. - // #TRANNOTE Descriptions start with EVT_DESC_ prefix, display - // #TRANNOTE names start with EVT_NAME. - // #TRANNOTE ##################################################### - - { "EVT_DESC_AS400CERTIFICATE_EVENT", "A certificate event has occurred." }, - { "EVT_NAME_AS400CERTIFICATE_EVENT", "AS400Certificate" }, - { "EVT_DESC_SV_EVENT", "A system value event has occurred." }, - - // #TRANNOTE A system value event has occurred. - { "EVT_NAME_SV_EVENT", "systemValueEvent" }, - - // #TRANNOTE ##################################################### - // #TRANNOTE Common exception messages. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix EXC_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - { "EXC_CERTIFICATE_ALREADY_ADDED", "Certificate association already exists." }, - { "EXC_CERTIFICATE_NOT_FOUND", "Certificate was not found." }, - { "EXC_CERTIFICATE_NOT_VALID", "Certificate or certificate type is not valid." }, - { "EXC_MAX_CONN_REACHED", "Maximum configured number of connections has been reached." }, //@F2A - { "EXC_CONFLICT_POOL_SIZES", "The minimum and maximum number of connections do not agree." }, //@B0A - { "EXC_CONN_POOL_CLOSED", "The connection pool is closed." }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE System Status MRI. - // #TRANNOTE ##################################################### - - { "PROP_NAME_SS_DTG", "dateAndTimeStatusGathered" }, - { "PROP_DESC_SS_DTG", "The date and time status gathered." }, - - { "PROP_NAME_SS_UCSO", "usersCurrentSignedOn" }, - { "PROP_DESC_SS_UCSO", "Number of users currently signed on the system." }, //@550 - - { "PROP_NAME_SS_UTSO", "usersTemporarilySignedOff" }, - { "PROP_DESC_SS_UTSO", "Number of users temporarily signed off the system." }, //@550 - - { "PROP_NAME_SS_USBS", "usersSuspendedBySystem" }, - { "PROP_DESC_SS_USBS", "Number of user jobs suspended by the system." }, //@550 - - { "PROP_NAME_SS_USOWP", "usersSignedOffWithPrinter" }, - { "PROP_DESC_SS_USOWP", "Number of users signed off with printer output waiting to print." }, - - { "PROP_NAME_SS_BJWM", "batchJobsWaitingForMessage" }, - { "PROP_DESC_SS_BJWM", "Number of batch job waiting for a message." }, - - { "PROP_NAME_SS_BJR", "batchJobsRunning" }, - { "PROP_DESC_SS_BJR", "Number of batch jobs running." }, - - { "PROP_NAME_SS_BJHR", "batchJobsHeldWhileRunning" }, - { "PROP_DESC_SS_BJHR", "Number of batch jobs held while running." }, - - { "PROP_NAME_SS_BJE", "batchJobsEnding" }, - { "PROP_DESC_SS_BJE", "Number of batch jobs ending." }, - - { "PROP_NAME_SS_BJWR", "batchJobsWaitingToRunOrAlreadyScheduled" }, - { "PROP_DESC_SS_BJWR", "Number of batch jobs waiting to run or already scheduled to run." }, - - { "PROP_NAME_SS_BJH", "batchJobsHeldOnJobQueue" }, - { "PROP_DESC_SS_BJH", "Number of batch jobs held on job queue." }, - - { "PROP_NAME_SS_BJU", "batchJobsOnUnassignedJobQueue" }, - { "PROP_DESC_SS_BJU", "Number batch jobs on unassigned job queue." }, - - { "PROP_NAME_SS_ET", "elapsedTime" }, - { "PROP_DESC_SS_ET", "The elapsed time." }, - - { "PROP_NAME_SS_MUS", "maximumUnprotectedStorageUsed" }, - { "PROP_DESC_SS_MUS", "Maximum unprotected storage used." }, - - { "PROP_NAME_SS_PPA", "percentPermanentAddresses" }, - { "PROP_DESC_SS_PPA", "Percent of permanent addresses used." }, - - { "PROP_NAME_SS_PPU", "percentProcessingUnitUsed" }, - { "PROP_DESC_SS_PPU", "Percent of processing units used." }, - - { "PROP_NAME_SS_SASP", "percentSystemASPUsed" }, - { "PROP_DESC_SS_SASP", "Percent of system ASP used." }, - - { "PROP_NAME_SS_PTA", "percentTemporaryAddresses" }, - { "PROP_DESC_SS_PTA", "Percent of temporary addresses used." }, - - { "PROP_NAME_SS_PN", "poolsNumber" }, - { "PROP_DESC_SS_PN", "Number of pools." }, - - { "PROP_NAME_SS_RSF", "restrictedStateFlag" }, - { "PROP_DESC_SS_RSF", "The restricted state flag." }, - - { "PROP_NAME_SS_SYSTEMASP", "systemASP" }, - { "PROP_DESC_SS_SYSTEMASP", "The system ASP." }, - - { "PROP_NAME_SS_SYSPOOL", "systemPools" }, - { "PROP_DESC_SS_SYSPOOL", "The system pools." }, - - { "PROP_NAME_SS_TAS", "totalAuxiliaryStorage" }, - { "PROP_DESC_SS_TAS", "The total auxiliary storage." }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE System Pool MRI. - // #TRANNOTE ##################################################### - - { "PROP_NAME_SP_POOLNAME", "poolName" }, - { "PROP_DESC_SP_POOLNAME", "The system pool name." }, - - { "PROP_NAME_SP_POOLID", "poolIdentifier" }, - { "PROP_DESC_SP_POOLID", "The system pool identifier." }, - - { "PROP_NAME_SP_ATE", "activeToIneligible" }, - { "PROP_DESC_SP_ATE", "Transition of threads from an active condition to a ineligible condition." }, - - { "PROP_NAME_SP_ATW", "activeToWait" }, - { "PROP_DESC_SP_ATW", "Transition of threads from an active condition to a waiting condition." }, - - { "PROP_NAME_SP_DBFAULTS", "databaseFaults" }, - { "PROP_DESC_SP_DBFAULTS", "Number of database page faults." }, - - { "PROP_NAME_SP_DBPAGES", "databasePages" }, - { "PROP_DESC_SP_DBPAGES", "Number of database pages." }, - - { "PROP_NAME_SP_MAXAT", "maximumActiveThreads" }, - { "PROP_DESC_SP_MAXAT", "Maximum number of active threads." }, - - { "PROP_NAME_SP_NONDBFLTS", "nonDatabaseFaults" }, - { "PROP_DESC_SP_NONDBFLTS", "Number of non database faults." }, - - { "PROP_NAME_SP_NONDBPGS", "nonDatabasePages" }, - { "PROP_DESC_SP_NONDBPGS", "Number of non database pages." }, - - { "PROP_NAME_SP_PAGINGOPTION", "pagingOption" }, - { "PROP_DESC_SP_PAGINGOPTION", "The paging option." }, - - { "PROP_NAME_SP_POOLSIZE", "poolSize" }, - { "PROP_DESC_SP_POOLSIZE", "Amount of main storage in the pool." }, - - { "PROP_NAME_SP_RSVDSIZE", "reservedSize" }, - { "PROP_DESC_SP_RSVDSIZE", "Amount of main storage in the pool reserved for system use." }, - - { "PROP_NAME_SP_SUBSYSNAME", "subsystemName" }, - { "PROP_DESC_SP_SUBSYSNAME", "Name of the subsystem that the storage pool is associated." }, - - { "PROP_NAME_SP_WTI", "waitToIneligible" }, - { "PROP_DESC_SP_WTI", "Transition of threads from a waiting condition to a ineligible condition." }, - - { "PROP_NAME_SP_MAXFAULTS", "maximumFaults" }, - { "PROP_DESC_SP_MAXFAULTS", "Maximum faults to use for the storage pool." }, - - { "PROP_NAME_SP_MAXPOOLSIZE", "maximumPoolSize" }, - { "PROP_DESC_SP_MAXPOOLSIZE", "Maximum amount of storage to allocate to a storage pool." }, - - { "PROP_NAME_SP_MSGLOGGING", "messageLogging" }, - { "PROP_DESC_SP_MSGLOGGING", "Messages are written to the job log for the current job and to the QHST message log." }, - - { "PROP_NAME_SP_MINFAULTS", "minimumFaults" }, - { "PROP_DESC_SP_MINFAULTS", "Minimum faults to use for the storage pool." }, - - { "PROP_NAME_SP_MINPOOLSIZE", "minimumPoolSize" }, - { "PROP_DESC_SP_MINPOOLSIZE", "Minimum amount of storage to allocate to a storage pool." }, - - { "PROP_NAME_SP_PERTHRDFLTS", "perThreadFaults" }, - { "PROP_DESC_SP_PERTHRDFLTS", "Faults for each active thread in the storage pool." }, - - { "PROP_NAME_SP_POOLACTLVL", "poolActivityLevel" }, - { "PROP_DESC_SP_POOLACTLVL", "Activity level for the pool." }, - - { "PROP_NAME_SP_PRIORITY", "priority" }, - { "PROP_DESC_SP_PRIORITY", "Priority of a pool relative to the priority of the other storage pools." }, - - - - - // Message File Bean MRI @D1A - { "PROP_NAME_MF_HELP_TEXT_FORMATTING", "helpTextFormatting" }, - { "PROP_DESC_MF_HELP_TEXT_FORMATTING", "The type of help text formatting." }, - - // Job MRI @D9a - { "PROP_NAME_JOB_NUMBER", "number" }, - { "PROP_DESC_JOB_NUMBER", "Job number." }, - { "PROP_NAME_JOB_USER", "user" }, - { "PROP_DESC_JOB_USER", "Job user." }, - - - - - // Proxy support MRI. - // #TRANNOTE ################################################################ - // #TRANNOTE The following are error and informational (verbose) messages. - // #TRANNOTE ################################################################ - { "PROXY_ALREADY_LISTENING", "An active server is already listening to port &0." }, // @M1C - { "PROXY_CONFIGURATION_UPDATED", "The configuration has been updated."}, - { "PROXY_CONFIGURATION_NOT_LOADED", "Configuration not loaded: &0"}, - { "PROXY_JDBC_DRIVER_NOT_REGISTERED", "JDBC driver not registered: &0"}, - { "PROXY_JDBC_DRIVER_REGISTERED", "Registered JDBC driver: &0."}, // @E2C - { "PROXY_OPTION_NOT_VALID", "Option not valid: &0" }, - { "PROXY_OPTION_VALUE_NOT_VALID", "Value for option &0 not valid: &1" }, - { "PROXY_PEER_NOT_RESPONDING", "Peer proxy server &0 is not responding." }, - { "PROXY_SERVER_CONTAINER", "Proxy server" }, - { "PROXY_SERVER_END", "Proxy server ended as requested by &0." }, - { "PROXY_SERVER_END_REJECTED", "Proxy server end request from &0 was rejected." }, - { "PROXY_SERVER_ENDED", "&0 ended." }, - { "PROXY_SERVER_LISTENING", "&0 listening to port &1." }, - { "PROXY_SERVER_OPTIONSLC", "options" }, - { "PROXY_SERVER_OPTIONSUC", "Options" }, - { "PROXY_SERVER_SHORTCUTS", "Shortcuts" }, // @D3A - { "PROXY_SERVER_SECURE_CONTAINER", "Secure proxy server" }, - { "PROXY_SERVER_STARTED", "Proxy server started." }, - { "PROXY_SERVER_USAGE", "Usage" }, - { "PROXY_VALUE_NO_OPTION", "Value with no option ignored: &0" }, // @D2A - { "PROXY_SERVER_NO_KEYRING", "The -keyringName or -keyringPassword option were not properly specified." }, //$E9A - { "PROXY_SERVER_KEYRING_EXPLAIN", "The CLASSPATH contains the SSLight classes. To use SSL with the proxy, the " + //$E9A - "-keyringName and -keyringPassword options must both be specified. "}, //$E9A - - - - // #TRANNOTE ##################################################### - // #TRANNOTE System pool MRI. - // #TRANNOTE Start with SYSTEM_POOL_ prefix. - // #TRANNOTE ##################################################### - - //@A3A - { "SYSTEM_POOL_MACHINE", "The machine pool." }, - { "SYSTEM_POOL_BASE", "The base system pool, which can be shared with other subsystems." }, - { "SYSTEM_POOL_INTERACT", "The shared pool used for interactive work." }, - { "SYSTEM_POOL_SPOOL", "The shared pool used for specified writers." }, - { "SYSTEM_POOL_OTHER", "A system pool." }, - - - - // #TRANNOTE ##################################################### - // #TRANNOTE MRI For JavaApplicationCall - // #TRANNOTE ##################################################### - //@D1D - { "PROP_NAME_JAC_CLASSPATH", "classpath" }, - { "PROP_DESC_JAC_CLASSPATH", "The CLASSPATH environment variable." }, - - { "PROP_NAME_JAC_SECCHKLVL", "classpathSecurityCheckLevel" }, - { "PROP_DESC_JAC_SECCHKLVL", "The CLASSPATH security check level." }, - - { "PROP_NAME_JAC_GCINIT", "garbageCollectionInitialSize" }, - { "PROP_DESC_JAC_GCINIT", "The initial size of the heap." }, - - { "PROP_NAME_JAC_GCMAX", "garbageCollectionMaximumSize" }, - { "PROP_DESC_JAC_GCMAX", "The maximum size of the heap." }, - - { "PROP_NAME_JAC_GCFREQ", "garbageCollectionFrequency" }, - { "PROP_DESC_JAC_GCFREQ", "The relative frequency in which garbage collection runs." }, - - { "PROP_NAME_JAC_GCPRIORITY", "garbageCollectionPriority" }, - { "PROP_DESC_JAC_GCPRIORITY", "The priority of the garbage collection thread." }, - - { "PROP_NAME_JAC_INTERPRET", "interpret" }, - { "PROP_DESC_JAC_INTERPRET", "Run classes in interpret mode." }, - - { "PROP_NAME_JAC_JAVAAPP", "javaApplication" }, - { "PROP_DESC_JAC_JAVAAPP", "The Java application to run." }, - - { "PROP_NAME_JAC_OPTIMIZE", "optimization" }, - { "PROP_DESC_JAC_OPTIMIZE", "Level of optimization of Java classes." }, - - { "PROP_NAME_JAC_OPTION", "option" }, - { "PROP_DESC_JAC_OPTION", "Java virtual machine options." }, - - { "PROP_NAME_JAC_PARAMETERS", "parameters" }, - { "PROP_DESC_JAC_PARAMETERS", "Parameters for the Java application" }, - - { "PROP_NAME_JAC_PORTSEARCH", "portSearch" }, - { "PROP_DESC_JAC_PORTSEARCH", "Perform a port search to find a free port." }, - - // #TRANNOTE ##################################################### - // #TRANNOTE MRI For ConnectionPoolProperties - // #TRANNOTE ##################################################### // @E3 - { "PROP_NAME_CPP_CLEANUP_INTERVAL", "cleanupInterval" }, - { "PROP_NAME_CPP_MAX_CONNECTIONS", "maxConnections" }, - { "PROP_NAME_CPP_MAX_INACTIVITY", "maxInactivity" }, - { "PROP_NAME_CPP_MAX_LIFETIME", "maxLifetime" }, - { "PROP_NAME_CPP_MAX_USE_COUNT", "maxUseCount" }, - { "PROP_NAME_CPP_MAX_USE_TIME", "maxUseTime" }, - { "PROP_NAME_CPP_PRETEST_CONNECTIONS", "pretestConnections" }, - - { "PROP_DESC_CPP_CLEANUP_INTERVAL", "The cleanup time interval for the connection pool." }, - { "PROP_DESC_CPP_MAX_CONNECTIONS", "The maximum number of connections a pool can have." }, - { "PROP_DESC_CPP_MAX_INACTIVITY", "The maximum amount of time a connection can be inactive." }, - { "PROP_DESC_CPP_MAX_LIFETIME", "The maximum amount of time a connection can exist." }, - { "PROP_DESC_CPP_MAX_USE_COUNT", "The maximum number of times a connection can be used." }, - { "PROP_DESC_CPP_MAX_USE_TIME", "The maximum amount of time a connection can be used." }, - { "PROP_DESC_CPP_PRETEST_CONNECTIONS", "Specifies whether connections are pretested." }, - - // #TRANNOTE ##################################################### - // #TRANNOTE MRI For ConnectionPool - // #TRANNOTE ##################################################### // @E3 - { "PROP_NAME_CP_DATA_SOURCE", "dataSource"}, - { "PROP_NAME_CP_PROPERTIES", "properties"}, - { "PROP_NAME_CP_RUN_MAINTENANCE", "runMaintenance"}, - { "PROP_NAME_CP_THREAD_USED", "threadUsed"}, // @E5 - - { "PROP_DESC_CP_DATA_SOURCE", "The data source used to make JDBC connections."}, - { "PROP_DESC_CP_PROPERTIES", "The connection pool properties."}, - { "PROP_DESC_CP_RUN_MAINTENANCE", "Specifies whether the maintenance daemon is used."}, - { "PROP_DESC_CP_THREAD_USED", "Specifies whether threads are used."}, // @E5 - - // #TRANNOTE The properties for ConnectionPoolDataSource. @B0A - { "PROP_NAME_CPDS_INIT_POOL_SIZE", "initialPoolSize"}, - { "PROP_DESC_CPDS_INIT_POOL_SIZE", "The initial number of connections in the pool."}, - { "PROP_NAME_CPDS_MAX_IDLE_TIME", "maxIdleTime"}, - { "PROP_DESC_CPDS_MAX_IDLE_TIME", "The maximum amount of time a connection can be idle."}, - { "PROP_NAME_CPDS_MAX_POOL_SIZE", "maxPoolSize"}, - { "PROP_DESC_CPDS_MAX_POOL_SIZE", "The maximum number of connections in the pool."}, - - // #TRANNOTE Statement caching is not supported this way (yet) - // so we don't need this MRI. - // { "PROP_NAME_CPDS_MAX_STATEMENTS", "maxStatements"}, - // { "PROP_DESC_CPDS_MAX_STATEMENTS", "The maximum number of statements any one pooled connection can have."}, - { "PROP_NAME_CPDS_MIN_POOL_SIZE", "minPoolSize"}, - { "PROP_DESC_CPDS_MIN_POOL_SIZE", "The minimum number of available connections in the pool."}, - { "PROP_NAME_CPDS_PROP_CYCLE", "propertyCycle"}, - { "PROP_DESC_CPDS_PROP_CYCLE", "The cleanup time interval for the connection pool."}, - - - { "PROP_NAME_SAVE_FILE_PUBLIC_AUTHORITY", "saveFilePublicAuthority" }, - { "PROP_DESC_SAVE_FILE_PUBLIC_AUTHORITY", "Authority value for *PUBLIC." }, - { "CREATE_SAVE_FILE_FAILED", "The CRTSAVFIL command failed: " }, - - // #TRANNOTE The properties of ProductLicense. // @C2A - { "PROP_DESC_LICENSE_PRODUCTID", "The product identifier." }, // @F7C - { "PROP_NAME_LICENSE_PRODUCTID", "productID" }, // @F7C - { "PROP_DESC_LICENSE_FEATUREID", "The product feature." }, // @C2A - { "PROP_NAME_LICENSE_FEATUREID", "feature" }, // @C2A - { "PROP_DESC_LICENSE_RELEASELEVEL", "The product release level." }, // @F7C - { "PROP_NAME_LICENSE_RELEASELEVEL", "releaseLevel" }, // @F7C - - // #TRANNOTE A license event has occurred. - { "EVT_DESC_LICENSE_EVENT", "A product license event has occurred." }, //@C2A - { "EVT_NAME_LICENSE_EVENT", "productLicenseEvent" }, //@C2A - - - - // #TRANNOTE ##################################################### - // #TRANNOTE MRI For CommandCall and ProgramCall - // #TRANNOTE ##################################################### - //@E4A - { "PROP_NAME_CMD_THREADSAFE", "threadSafe" }, - { "PROP_DESC_CMD_THREADSAFE", "The thread-safety of the command or program." }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE MRI For AS400ConnectionPool and ConnectionList - // #TRANNOTE ##################################################### //@E6A - - // #TRANNOTE creating connection list for system/userid - { "AS400CP_CONNLIST", "creating connection list for &0/&1" }, - - // #TRANNOTE returning connection to connection pool system/userid - { "AS400CP_RETCONN", "returning connection to connection pool &0/&1" }, - - { "AS400CP_SHUTDOWN", "the connection pool is shutting down" }, - - { "AS400CP_SHUTDOWNCOMP", "shutdown of connection pool completed" }, - - // #TRANNOTE cleaning up connections for system/userid - { "CL_CLEANUP", "cleaning up connections for &0/&1" }, - - { "CL_CLEANUPCOMP", "cleanup completed" }, - - { "CL_CLEANUPEXP", "connection limit reached, cleaning up expired connections" }, - - { "CL_CLEANUPOLD", "connection limit reached, cleaning up oldest connections" }, - - // #TRANNOTE connection created for system/userid - { "CL_CREATED", "connection created for &0/&1" }, - - // #TRANNOTE creating a new connection for system/userid - { "CL_CREATING", "creating a new connection for &0/&1" }, - - // #TRANNOTE removing oldest connection for system/userid - { "CL_REMOLD", "removing oldest connection for &0/&1" }, - - // #TRANNOTE completed removing oldest connection for system/userid - { "CL_REMOLDCOMP", "completed removing oldest connection for &0/&1" }, - - // #TRANNOTE removing connection that exceeded maximum inactivity time for system/userid // @E8C - { "CL_REMUNUSED", "removing connection that exceeded maximum inactivity time for &0/&1" }, // @E8C - - // #TRANNOTE replacing connection that exceeded maximum lifetime for system/userid - { "CL_REPLIFE", "replacing connection that exceeded maximum lifetime for &0/&1" }, - - // #TRANNOTE removing connection that exceeded maximum lifetime for system/userid - { "CL_REMLIFE", "removing connection that exceeded maximum lifetime for &0/&1" }, - - // #TRANNOTE replacing connection that exceeded maximum use count for system/userid - { "CL_REPUSE", "replacing connection that exceeded maximum use count for &0/&1" }, - - // #TRANNOTE removing connection that exceeded maximum use count for system/userid - { "CL_REMUSECOUNT", "removing connection that exceeded maximum use count for &0/&1" }, - - // #TRANNOTE removing connection that exceeded maximum use time for system/userid - { "CL_REMUSETIME", "removing connection that exceeded maximum use time for &0/&1" }, - - // #TRANNOTE removing connection that failed a connection pretest for system/userid - { "CL_REMPRETEST", "removing connection that failed a connection validation test for &0/&1" }, - - // #TRANNOTE filling numberOfConnections connections to system/userid // @E8A - { "AS400CP_FILLING", "filling &0 connections to &1/&2" }, // @E8A - - { "AS400CP_FILLEXC", "filling of connections failed with an exception" }, // @E8A - - { "AS400CP_MAXSIZE_FAILED", "Unable to allocate connection, because pool is full and no connection is available." }, - - // #TRANNOTE ##################################################### - // #TRANNOTE MRI For AS400JPing - // #TRANNOTE ##################################################### // @E7A - { "PROP_NAME_AJP_FAILED", "Failed to make connection to server application: &0&1"}, - { "PROP_NAME_AJP_SUCCESS", "Successfully connected to server application: &0&1"}, - - // #TRANNOTE ##################################################### - // #TRANNOTE MRI For AS400JDBCDataSource - // #TRANNOTE ##################################################### // @F1A - - { "AS400_JDBC_DS_CONN_CREATED", "connection created" }, - { "AS400_JDBC_DS_PASSWORD_SET", "password is set" }, - - - - // @F3A @F6C - // Localized object types - These are used in QSYSObjectTypeTable. - // - // #TRANNOTE ################################################################ - // #TRANNOTE IBM i object types. - // #TRANNOTE - // #TRANNOTE These are MRI for object types and subtypes. They will be - // #TRANNOTE concatenated with a hyphen in the form "Type - Subtype". - // #TRANNOTE Each type is an MRI string with the key TYPE_type. The - // #TRANNOTE subtype are listed separately with the key TYPE_type_subtype. - // #TRANNOTE - // #TRANNOTE ################################################################ - { "TYPE_ALRTBL", "Alert table" }, - { "TYPE_AUTL", "Authorization list" }, - { "TYPE_BLKSF", "Block special file" }, - { "TYPE_BNDDIR", "Binding directory" }, - { "TYPE_CFGL", "Configuration list" }, - { "TYPE_CFGL_APPNDIR", "APPN directory search filter" }, - { "TYPE_CFGL_APPNLCL", "APPN local location" }, - { "TYPE_CFGL_APPNRMT", "APPN remote location" }, - { "TYPE_CFGL_APPNSSN", "APPN session end point filter" }, - { "TYPE_CFGL_ASYNCADR", "Asynchronous network address" }, - { "TYPE_CFGL_ASYNCLOC", "Asynchronous remote location" }, - { "TYPE_CFGL_SNAPASTHR", "SNA pass-through" }, - { "TYPE_CHTFMT", "Chart format" }, - { "TYPE_CHRSF", "Character special file" }, - { "TYPE_CLD", "C/400 locale description" }, - { "TYPE_CLS", "Class" }, - { "TYPE_CMD", "Command" }, - { "TYPE_CNNL", "Connection list" }, - { "TYPE_COSD", "Class-of-service description" }, - { "TYPE_CRG", "Cluster resource group" }, - { "TYPE_CRQD", "Change request description" }, - { "TYPE_CSI", "Communications side information" }, - { "TYPE_CSPMAP", "Cross-system product map" }, - { "TYPE_CSPTBL", "Cross-system product table" }, - { "TYPE_CTLD", "Controller description" }, - { "TYPE_CTLD_APPC", "APPC" }, - { "TYPE_CTLD_ASC", "Asynchronous" }, - { "TYPE_CTLD_BSC", "Binary synchronous" }, - { "TYPE_CTLD_FNC", "Finance" }, - { "TYPE_CTLD_HOST", "SNA host" }, - { "TYPE_CTLD_LWS", "Local workstation" }, - { "TYPE_CTLD_NET", "Network" }, - { "TYPE_CTLD_RTL", "Retail" }, - { "TYPE_CTLD_RWS", "Remote workstation" }, - { "TYPE_CTLD_TAP", "Tape" }, - { "TYPE_CTLD_VNM", "Virtual network media" }, // @550A - { "TYPE_CTLD_VWS", "Virtual workstation" }, - { "TYPE_DDIR", "Distributed directory" }, - { "TYPE_DEVD", "Device description" }, - { "TYPE_DEVD_APPC", "APPC" }, - { "TYPE_DEVD_ASC", "Asynchronous" }, - { "TYPE_DEVD_ASP", "Disk pool" }, // @F6C - { "TYPE_DEVD_BSC", "Binary synchronous" }, - { "TYPE_DEVD_CRP", "Cryptographic" }, - { "TYPE_DEVD_DKT", "Diskette" }, - { "TYPE_DEVD_DSPLCL", "Local display" }, - { "TYPE_DEVD_DSPRMT", "Remote display" }, - { "TYPE_DEVD_DSPSNP", "SNA pass-through display" }, - { "TYPE_DEVD_DSPVRT", "Virtual display" }, // @F6C - { "TYPE_DEVD_FNC", "Finance" }, - { "TYPE_DEVD_HOST", "SNA host" }, - { "TYPE_DEVD_INTR", "Intrasystem" }, - { "TYPE_DEVD_MLB", "Media library" }, - { "TYPE_DEVD_NET", "Network" }, - { "TYPE_DEVD_OPT", "Optical" }, - { "TYPE_DEVD_PRTLCL", "Local printer" }, - { "TYPE_DEVD_PRTLAN", "LAN printer" }, - { "TYPE_DEVD_PRTRMT", "Remote printer" }, - { "TYPE_DEVD_PRTSNP", "SNA pass-through printer" }, - { "TYPE_DEVD_PRTVRT", "Virtual printer" }, - { "TYPE_DEVD_RTL", "Retail" }, - { "TYPE_DEVD_SNPTUP", "SNA pass-through upstream" }, - { "TYPE_DEVD_SNPTDN", "SNA pass-through downstream" }, - { "TYPE_DEVD_SNUF", "SNA upline facility" }, - { "TYPE_DEVD_TAP", "Tape" }, - { "TYPE_DIR", "Directory" }, - { "TYPE_DOC", "Document" }, - { "TYPE_DSTMF", "Distributed stream file" }, - { "TYPE_DTAARA", "Data area" }, - { "TYPE_DTADCT", "Data dictionary" }, - { "TYPE_DTAQ", "Data queue" }, - { "TYPE_DTAQ_DDMDTAQUE", "DDM" }, - { "TYPE_EDTD", "Edit description" }, - { "TYPE_EXITRG", "Exit registration" }, - { "TYPE_FCT", "Forms control table" }, - { "TYPE_FIFO", "First-in-first-out special file" }, - { "TYPE_FILE", "File" }, - { "TYPE_FILE_PF", "Physical" }, - { "TYPE_FILE_LF", "Logical" }, - { "TYPE_FILE_BSCF38", "Binary synchronous (S/38)" }, - { "TYPE_FILE_CMNF38", "Communications (S/38)" }, - { "TYPE_FILE_CRDF38", "Card (S/38)" }, - { "TYPE_FILE_DFU", "DFU" }, - { "TYPE_FILE_DFUEXC", "DFU (S/38)" }, - { "TYPE_FILE_DFUNOTEXC", "DFU (S/38)" }, - { "TYPE_FILE_DSPF", "Display" }, - { "TYPE_FILE_DSPF36", "Display (S/36)" }, - { "TYPE_FILE_DSPF38", "Display (S/38)" }, - { "TYPE_FILE_DDMF", "DDM" }, - { "TYPE_FILE_DKTF", "Diskette" }, - { "TYPE_FILE_ICFF", "Intersystem communication" }, - { "TYPE_FILE_LF38", "Logical (S/38)" }, - { "TYPE_FILE_MXDF38", "Mixed (S/38)" }, - { "TYPE_FILE_PF38", "Physical (S/38)" }, - { "TYPE_FILE_PRTF", "Printer" }, - { "TYPE_FILE_PRTF38", "Printer (S/38)" }, - { "TYPE_FILE_SAVF", "Save" }, - { "TYPE_FILE_TAPF", "Tape" }, - { "TYPE_FLR", "Folder" }, - { "TYPE_FNTRSC", "Font resource" }, // @F6C - { "TYPE_FNTRSC_CDEFNT", "Coded font" }, - { "TYPE_FNTRSC_FNTCHRSET", "Font character set" }, - { "TYPE_FNTRSC_CDEPAG", "Code page" }, - { "TYPE_FNTTBL", "Font mapping table" }, - { "TYPE_FORMDF", "Form definition" }, - { "TYPE_FTR", "Filter" }, - { "TYPE_FTR_ALR", "Alert" }, - { "TYPE_FTR_PRB", "Problem" }, - { "TYPE_GSS", "Symbol set" }, - { "TYPE_GSS_VSS", "Vector" }, - { "TYPE_GSS_ISS", "Image" }, - { "TYPE_IGCDCT", "DBCS conversion dictionary" }, - { "TYPE_IGCSRT", "DBCS sort table" }, - { "TYPE_IGCTBL", "DBCS font table" }, - { "TYPE_IMGCLG", "Optical image catalog" }, // @M2a - { "TYPE_IPXD", "Internetwork packet exchange description" }, - { "TYPE_JOBD", "Job description" }, - { "TYPE_JOBQ", "Job queue" }, - { "TYPE_JOBSCD", "Job schedule" }, - { "TYPE_JRN", "Journal" }, - { "TYPE_JRNRCV", "Journal receiver" }, - { "TYPE_LIB", "Library" }, - { "TYPE_LIB_PROD", "" }, // We don't want the text "Production" here. @F6C - { "TYPE_LIB_TEST", "Test" }, - { "TYPE_LIND", "Line description" }, - { "TYPE_LIND_ASC", "Asynchronous" }, - { "TYPE_LIND_BSC", "Binary synchronous" }, - { "TYPE_LIND_DDI", "Distributed data interface" }, - { "TYPE_LIND_ETH", "Ethernet" }, - { "TYPE_LIND_FAX", "Facsimile (fax)" }, - { "TYPE_LIND_FR", "Frame relay" }, - { "TYPE_LIND_IDLC", "ISDN data link control" }, - { "TYPE_LIND_NET", "Network" }, - { "TYPE_LIND_PPP", "Point-to-point protocol" }, - { "TYPE_LIND_SDLC", "Synchronous data link control" }, - { "TYPE_LIND_TDLC", "Twinaxial data link control" }, - { "TYPE_LIND_TRN", "Token-Ring" }, - { "TYPE_LIND_WLS", "Wireless" }, - { "TYPE_LIND_X25", "X.25" }, - { "TYPE_LOCALE", "Locale" }, - { "TYPE_MEDDFN", "Media definition" }, - { "TYPE_MENU", "Menu" }, - { "TYPE_MENU_UIM", "UIM" }, - { "TYPE_MENU_DSPF", "Display file" }, - { "TYPE_MENU_PGM", "Program" }, - { "TYPE_MGTCOL", "Management collection" }, - { "TYPE_MGTCOL_PFR", "Collection Services performance data" }, - { "TYPE_MGTCOL_PFRHST", "Archived performance data" }, - { "TYPE_MGTCOL_PFRDTL", "System Monitor performance data" }, - { "TYPE_MODD", "Mode description" }, - { "TYPE_MODULE", "Module" }, - { "TYPE_MODULE_CLE", "C" }, - { "TYPE_MODULE_CLLE", "CL" }, - { "TYPE_MODULE_RPGLE", "RPG" }, - { "TYPE_MODULE_CBLLE", "COBOL" }, - { "TYPE_MODULE_CPPLE", "C++" }, - { "TYPE_MSGF", "Message file" }, - { "TYPE_MSGQ", "Message queue" }, - { "TYPE_M36", "AS/400 Advanced 36 machine" }, - { "TYPE_M36CFG", "AS/400 Advanced 36 machine configuration" }, - { "TYPE_NODGRP", "Node group" }, - { "TYPE_NODL", "Node list" }, - { "TYPE_NTBD", "NetBIOS description" }, - { "TYPE_NWID", "Network interface description" }, - { "TYPE_NWID_ATM", "Asynchronous transfer mode" }, - { "TYPE_NWID_FR", "Frame relay" }, - { "TYPE_NWID_ISDN", "ISDN" }, - { "TYPE_NWSCFG", "Network server configuration" }, //@K2A - { "TYPE_NWSD", "Network server description" }, - { "TYPE_NWSD_GUEST", "Logical partition network server" }, // @550A - { "TYPE_NWSD_IXSVR", "Integrated network server" }, // @550A - { "TYPE_NWSD_WINDOWSNT", "Windows" }, - { "TYPE_OUTQ", "Output queue" }, - { "TYPE_OVL", "Overlay" }, - { "TYPE_PAGDFN", "Page definition" }, - { "TYPE_PAGSEG", "Page segment" }, - { "TYPE_PDFMAP", "PDF map" }, //@K1A - { "TYPE_PDG", "Print descriptor group" }, - { "TYPE_PGM", "Program" }, - { "TYPE_PGM_ASM38", "Assembler (S/38)" }, - { "TYPE_PGM_BAS", "BASIC (OPM)" }, - { "TYPE_PGM_BAS38", "BASIC (S/38)" }, - { "TYPE_PGM_C", "C (OPM)" }, - { "TYPE_PGM_CBL", "COBOL (OPM)" }, - { "TYPE_PGM_CBLLE", "COBOL (ILE)" }, - { "TYPE_PGM_CBL36", "COBOL (S/36)" }, - { "TYPE_PGM_CBL38", "COBOL (S/38)" }, - { "TYPE_PGM_CLE", "C (ILE)" }, - { "TYPE_PGM_CLLE", "CL (ILE)" }, - { "TYPE_PGM_CLP", "CL (OPM)" }, - { "TYPE_PGM_CLP38", "CL (S/38)" }, - { "TYPE_PGM_CPPLE", "C++ (ILE)" }, - { "TYPE_PGM_CSP", "CSP (OPM)" }, - { "TYPE_PGM_DFU", "DFU (OPM)" }, - { "TYPE_PGM_DFUEXC", "DFU (S/38)" }, - { "TYPE_PGM_DFUNOTEXC", "DFU (S/38)" }, - { "TYPE_PGM_FTN", "FORTRAN (OPM)" }, - { "TYPE_PGM_PAS", "Pascal (OPM)" }, - { "TYPE_PGM_PAS38", "Pascal (S/38)" }, - { "TYPE_PGM_PLI", "PL/I (OPM)" }, - { "TYPE_PGM_PLI38", "PL/I (S/38)" }, // @F6C - { "TYPE_PGM_RMC", "RM/COBOL (OPM)" }, - { "TYPE_PGM_RPG", "RPG (OPM)" }, - { "TYPE_PGM_RPGLE", "RPG (ILE)" }, - { "TYPE_PGM_RPG36", "RPG (S/36)" }, - { "TYPE_PGM_RPG38", "RPG (S/38)" }, - { "TYPE_PNLGRP", "Panel group" }, - { "TYPE_PRDAVL", "Product availability" }, - { "TYPE_PRDDFN", "Product definition" }, - { "TYPE_PRDLOD", "Product load" }, - { "TYPE_PSFCFG", "PSF configuration" }, - { "TYPE_QMFORM", "Query management report form" }, - { "TYPE_QMQRY", "Query" }, - { "TYPE_QMQRY_PROMPT", "Prompted" }, - { "TYPE_QMQRY_SQL", "SQL" }, - { "TYPE_QRYDFN", "Query definition" }, - { "TYPE_RCT", "Reference code translate table" }, - { "TYPE_SBSD", "Subsystem description" }, - // @F6D { "TYPE_SBSSTS", "Subsystem status" }, - { "TYPE_SCHIDX", "Search index" }, - { "TYPE_SOCKET", "Local socket" }, - { "TYPE_SPADCT", "Spelling aid dictionary" }, - { "TYPE_SPADCT_AFRIKAAN", "Afrikaans" }, - { "TYPE_SPADCT_AKTUEEL", "Obsolete (Pre-Reform) Dutch" }, - { "TYPE_SPADCT_BRASIL", "Brazilian Portuguese" }, - { "TYPE_SPADCT_CATALA", "Catalan" }, - { "TYPE_SPADCT_DANSK", "Danish" }, - { "TYPE_SPADCT_DEUTSCH", "German" }, - { "TYPE_SPADCT_DEUTSCH2", "German Reform" }, - { "TYPE_SPADCT_DSCHWEIZ", "Swiss-German" }, - { "TYPE_SPADCT_ESPANA", "Spanish" }, - { "TYPE_SPADCT_FRANCAIS", "French" }, - { "TYPE_SPADCT_FRA2", "French Canadian" }, - { "TYPE_SPADCT_GREEK", "Greek" }, - { "TYPE_SPADCT_ISLENSK", "Icelandic" }, - { "TYPE_SPADCT_ITALIANO", "Italian" }, - { "TYPE_SPADCT_LEGAL", "US Legal" }, - { "TYPE_SPADCT_MEDICAL", "US Medical" }, - { "TYPE_SPADCT_NEDERLND", "Dutch" }, - { "TYPE_SPADCT_NEDPLUS", "Dutch Reform Permissive" }, - { "TYPE_SPADCT_NORBOK", "Bokmal Norwegian" }, - { "TYPE_SPADCT_NORNYN", "Nynorsk Norwegian" }, - { "TYPE_SPADCT_PORTUGAL", "Portuguese" }, - { "TYPE_SPADCT_RUSSIAN", "Russian" }, - { "TYPE_SPADCT_SUOMI", "Finnish" }, - { "TYPE_SPADCT_SVENSK", "Swedish" }, - { "TYPE_SPADCT_UK", "UK English" }, - { "TYPE_SPADCT_US", "US English" }, - { "TYPE_SQLPKG", "SQL package" }, - { "TYPE_SQLXSR", "SQL XML schema repository" }, - { "TYPE_SQLUDT", "User-defined SQL type" }, - { "TYPE_SRVPGM", "Service program" }, - { "TYPE_SRVPGM_CLE", "C" }, - { "TYPE_SRVPGM_CLLE", "CL" }, - { "TYPE_SRVPGM_RPGLE", "RPG" }, - { "TYPE_SRVPGM_CBLLE", "COBOL" }, - { "TYPE_SRVPGM_CPPLE", "C++" }, - { "TYPE_SSND", "Session description" }, - { "TYPE_STMF", "Bytestream file" }, - { "TYPE_SVRSTG", "Server storage space" }, - { "TYPE_SYMLNK", "Symbolic link" }, - { "TYPE_S36", "S/36 environment configuration" }, // @F6C - { "TYPE_TBL", "Table" }, - { "TYPE_TIMZON", "Time zone description" }, //@K1A - { "TYPE_USRIDX", "User index" }, - { "TYPE_USRPRF", "User profile" }, - { "TYPE_USRQ", "User queue" }, - { "TYPE_USRSPC", "User space" }, - { "TYPE_VLDL", "Validation list" }, - { "TYPE_WSCST", "Workstation customizing object" }, - // @F3A - - - // @F4A - // #TRANNOTE ##################################################### - // #TRANNOTE NetServer component MRI. - // #TRANNOTE ##################################################### - - { "PROP_DESC_NAME", "The name of the object." }, - { "PROP_NAME_NAME", "name" }, - { "PROP_DESC_ID", "The ID of the object." }, - { "PROP_NAME_ID", "ID" }, - - { "NETSERVER_DESCRIPTION", "NetServer" }, - - // #TRANNOTE The properties of NetServer. - { "NETSERVER_ALLOW_SYSTEM_NAME_NAME", "Allow system name" }, - { "NETSERVER_ALLOW_SYSTEM_NAME_PENDING_NAME", "Allow system name (pending)" }, - { "NETSERVER_AUTHENTICATION_METHOD_NAME", "Authentication method" }, // @F8A - { "NETSERVER_AUTHENTICATION_METHOD_PENDING_NAME", "Authentication method (pending)" }, // @F8A - { "NETSERVER_AUTOSTART_NAME", "Autostart" }, - { "NETSERVER_BROWSING_INTERVAL_NAME", "Browsing interval" }, - { "NETSERVER_BROWSING_INTERVAL_PENDING_NAME", "Browsing interval (pending)" }, - { "NETSERVER_CCSID_NAME", "CCSID" }, - { "NETSERVER_CCSID_PENDING_NAME", "CCSID (pending)" }, - { "NETSERVER_DESCRIPTION_NAME", "Description" }, - { "NETSERVER_DESCRIPTION_PENDING_NAME", "Description (pending)" }, - { "NETSERVER_DOMAIN_NAME", "Domain name" }, - { "NETSERVER_DOMAIN_PENDING_NAME", "Domain name (pending)" }, - { "NETSERVER_GUEST_SUPPORT_NAME", "Guest support" }, - { "NETSERVER_GUEST_SUPPORT_PENDING_NAME", "Guest support (pending)" }, - { "NETSERVER_GUEST_USER_PROFILE_NAME", "Guest user profile" }, - { "NETSERVER_GUEST_USER_PROFILE_PENDING_NAME", "Guest user profile (pending)" }, - { "NETSERVER_IDLE_TIMEOUT_NAME", "Idle timeout" }, - { "NETSERVER_IDLE_TIMEOUT_PENDING_NAME", "Idle timeout (pending)" }, - { "NETSERVER_LOGON_SUPPORT_NAME", "Logon support" }, - { "NETSERVER_LOGON_SUPPORT_PENDING_NAME", "Logon support (pending)" }, - { "NETSERVER_NAME_NAME", "Name" }, - { "NETSERVER_NAME_PENDING_NAME", "Name (pending)" }, - { "NETSERVER_OPPORTUNISTIC_LOCK_TIMEOUT_NAME", "Opportunistic lock timeout" }, - { "NETSERVER_OPPORTUNISTIC_LOCK_TIMEOUT_PENDING_NAME", "Opportunistic lock timeout (pending)" }, - { "NETSERVER_WINS_ENABLEMENT_NAME", "WINS enablement" }, - { "NETSERVER_WINS_ENABLEMENT_PENDING_NAME", "WINS enablement (pending)" }, - { "NETSERVER_WINS_PRIMARY_ADDRESS_NAME", "Address of primary WINS server" }, - { "NETSERVER_WINS_PRIMARY_ADDRESS_PENDING_NAME", "Address of primary WINS server (pending)" }, - { "NETSERVER_WINS_SCOPE_ID_NAME", "WINS scope ID" }, - { "NETSERVER_WINS_SCOPE_ID_PENDING_NAME", "WINS scope ID (pending)" }, - { "NETSERVER_WINS_SECONDARY_ADDRESS_NAME", "Address of secondary WINS server" }, - { "NETSERVER_WINS_SECONDARY_ADDRESS_PENDING_NAME","Address of secondary WINS server (pending)" }, - - // #TRANNOTE The properties of NetServerConnection. - { "NETSERVER_CONNECTION_DESCRIPTION", "Connection" }, - { "NETSERVER_TYPE_NAME", "Connection type" }, - { "NETSERVER_TYPE_0_NAME", "Disk driver" }, - { "NETSERVER_TYPE_1_NAME", "Spooled output queue" }, - { "NETSERVER_FILES_OPEN_COUNT_NAME", "Number of files open" }, - { "NETSERVER_USER_COUNT_NAME", "Number of users" }, - { "NETSERVER_CONNECT_TIME_NAME", "Connection time" }, - { "NETSERVER_USER_NAME", "User name" }, - - // #TRANNOTE The properties of NetServerFileShare. - { "NETSERVER_FILESHARE_DESCRIPTION", "File share" }, - { "NETSERVER_PATH_NAME", "Path" }, - { "NETSERVER_PATH_LENGTH_NAME", "Path length" }, - { "NETSERVER_PERMISSION_NAME", "Permission" }, - { "NETSERVER_PERMISSION_1_NAME", "Read-only" }, - { "NETSERVER_PERMISSION_2_NAME", "Read/write" }, - { "NETSERVER_MAXIMUM_USERS_NAME", "Maximum number of users" }, - - // #TRANNOTE The properties of NetServerPrintShare. - { "NETSERVER_PRINTSHARE_DESCRIPTION", "Print share" }, - { "NETSERVER_OUTPUT_QUEUE_LIBRARY_NAME", "Output queue library" }, - { "NETSERVER_OUTPUT_QUEUE_NAME_NAME", "Output queue name" }, - { "NETSERVER_PRINT_DRIVER_TYPE_NAME", "Print driver type" }, - { "NETSERVER_SPOOLED_FILE_TYPE_NAME", "Spooled file type" }, - { "NETSERVER_SPOOLED_FILE_TYPE_1_NAME", "User ASCII" }, - { "NETSERVER_SPOOLED_FILE_TYPE_2_NAME", "Advanced function printing" }, - { "NETSERVER_SPOOLED_FILE_TYPE_3_NAME", "SNA character string" }, - { "NETSERVER_SPOOLED_FILE_TYPE_4_NAME", "Automatic type sensing" }, - - // #TRANNOTE The properties of NetServerSession. - { "NETSERVER_SESSION_DESCRIPTION", "Session" }, - { "NETSERVER_CONNECTION_COUNT_NAME", "Number of connections" }, - { "NETSERVER_FILES_OPEN_COUNT_NAME", "Number of files open" }, - { "NETSERVER_SESSION_COUNT_NAME", "Number of sessions" }, - { "NETSERVER_SESSION_TIME_NAME", "Session time" }, - { "NETSERVER_IDLE_TIME_NAME", "Idle time" }, - { "NETSERVER_IS_GUEST_NAME", "Is guest" }, - { "NETSERVER_IS_ENCRYPT_PASSWORD_NAME", "Is encrypted password used" }, - - // #TRANNOTE The properties of NetServerShare. - { "NETSERVER_SHARE_DESCRIPTION", "Share" }, - - - { "LM_EXCEPTION", "A license error occurred. The primary return code is &0. The secondary return code is &1." }, // @F5A - - // #TRANNOTE ##################################################### - // #TRANNOTE This is information about this product. - // #TRANNOTE ##################################################### - { "PRODUCT_TITLE", "Toolbox for Java" }, //@KBA - - // @M1A - // ME support MRI. - // #TRANNOTE ################################################################ - // #TRANNOTE The following are error and informational (verbose) messages. - // #TRANNOTE ################################################################ - { "ME_ALREADY_LISTENING", "An active server is already listening to port &0." }, - { "ME_CONNECTION_ACCEPTED", "&0 accepted connection requested by &1 as connection &2." }, - { "ME_JDBC_DRIVER_NOT_REGISTERED", "JDBC driver not registered: &0"}, - { "ME_JDBC_DRIVER_REGISTERED", "Registered JDBC driver: &0."}, - { "ME_OPTION_NOT_VALID", "Option not valid: &0" }, - { "ME_OPTION_VALUE_NOT_VALID", "Value for option &0 not valid: &1" }, - { "ME_SERVER_CONTAINER", "MEServer" }, - { "ME_SERVER_ENDED", "&0 ended." }, - { "ME_SERVER_LISTENING", "&0 listening to port &1." }, - { "ME_SERVER_OPTIONSLC", "options" }, - { "ME_SERVER_OPTIONSUC", "Options" }, - { "ME_SERVER_SHORTCUTS", "Shortcuts" }, - { "ME_SERVER_STARTED", "MEServer started." }, - { "ME_CONNECTION_CLOSED", "Connection &0 closed."}, - { "ME_SERVER_USAGE", "Usage" }, - { "ME_VALUE_NO_OPTION", "Value with no option ignored: &0" }, - - { "ME_PCML_LOADING", "Loading new PCML document: &0"}, - { "ME_PCML_ERROR", "Error loading PCML." }, - { "ME_PCML_CACHE", "Using previously cached PCML document: &0"}, - - // @M3A @N0A - // #TRANNOTE ################################################################ - // #TRANNOTE The following are MRI strings for the command documentation generator utility. - // #TRANNOTE ################################################################ - { "GENCMDDOC_ALLOW_ALL", "All environments (*ALL)" }, - { "GENCMDDOC_ALLOW_COMPILED_CL_OR_REXX1", "Compiled CL or interpreted REXX (*BPGM *IPGM *BMOD *IMOD *BREXX *IREXX)" }, - { "GENCMDDOC_ALLOW_COMPILED_CL_OR_REXX2", "Compiled CL program or interpreted REXX (*BPGM *IPGM *BREXX *IREXX)" }, - { "GENCMDDOC_ALLOW_INTERACTIVE1", "Interactive environments (*INTERACT *IPGM *IMOD *IREXX *EXEC)" }, - { "GENCMDDOC_ALLOW_INTERACTIVE2", "Interactive environments (*INTERACT *IPGM *IREXX *EXEC)" }, - { "GENCMDDOC_ALLOW_JOB_BATCH", "Batch job (*BATCH)" }, - { "GENCMDDOC_ALLOW_JOB_INTERACTIVE", "Interactive job (*INTERACT)" }, - { "GENCMDDOC_ALLOW_MODULE_BATCH", "Batch ILE CL module (*BMOD)" }, - { "GENCMDDOC_ALLOW_MODULE_INTERACTIVE", "Interactive ILE CL module (*IMOD)" }, - { "GENCMDDOC_ALLOW_PROGRAM_BATCH", "Batch program (*BPGM)" }, - { "GENCMDDOC_ALLOW_PROGRAM_INTERACTIVE", "Interactive program (*IPGM)" }, - { "GENCMDDOC_ALLOW_REXX_BATCH", "Batch REXX procedure (*BREXX)" }, - { "GENCMDDOC_ALLOW_REXX_INTERACTIVE", "Interactive REXX procedure (*IREXX)" }, - { "GENCMDDOC_ALLOW_USING_COMMAND_API", "Using QCMDEXEC, QCAEXEC, or QCAPCMD API (*EXEC)" }, - { "GENCMDDOC_CHOICES", "Choices" }, - { "GENCMDDOC_DESCRIBE_COMMAND", "Describe the function provided by the command." }, - { "GENCMDDOC_DESCRIBE_EXAMPLE_1", "Describe a simple invocation of the command." }, - { "GENCMDDOC_DESCRIBE_EXAMPLE_2", "Describe a more complex invocation of the command." }, - { "GENCMDDOC_DESCRIBE_OTHER_RESTRICTION", "Describe other command-level restrictions." }, - { "GENCMDDOC_DESCRIBE_PARAMETER", "Describe the function provided by the parameter." }, - { "GENCMDDOC_DESCRIBE_PARAMETER_DEFAULT", "Describe the function provided by the default parameter value." }, - { "GENCMDDOC_DESCRIBE_PARAMETER_VALUE_WITH_RANGE", "Describe the function provided by the range-limited parameter value." }, - { "GENCMDDOC_DESCRIBE_PREDEFINED_PARAMETER_VALUE", "Describe the function provided by the pre-defined parameter value." }, - { "GENCMDDOC_DESCRIBE_USERDEFINED_PARAMETER_VALUE", "Describe the function provided by the user-defined parameter value." }, - { "GENCMDDOC_ELEMENT", "Element" }, - { "GENCMDDOC_ERROR_MESSAGES_COMMENT_1", "List the *ESCAPE, *STATUS, and *NOTIFY messages signalled from the command." }, - { "GENCMDDOC_ERROR_MESSAGES_COMMENT_2", "The following are generic messages defined in message file QCPFMSG." }, - { "GENCMDDOC_ERROR_MESSAGES_COMMENT_3", "Modify this list to match the list of error messages for the command." }, - { "GENCMDDOC_ERROR_MESSAGES_HEADING", "Error messages for &1" }, - { "GENCMDDOC_ERRORS", "Error messages" }, - { "GENCMDDOC_EXAMPLE_1_TITLE", "Example 1: Simple Command Example" }, - { "GENCMDDOC_EXAMPLE_2_TITLE", "Example 2: More Complex Command Example" }, - { "GENCMDDOC_EXAMPLES", "Examples" }, - { "GENCMDDOC_EXAMPLES_HEADING", "Examples for &1" }, - { "GENCMDDOC_HELP", "Help" }, - { "GENCMDDOC_HELP_FOR_COMMAND", "Help for command" }, - { "GENCMDDOC_HELP_FOR_PARAMETER", "Help for parameter" }, - { "GENCMDDOC_INTRO_COMMAND_HELP", "The &1 command <...>" }, - { "GENCMDDOC_INTRO_PARAMETER_HELP", "Specifies <...>" }, - { "GENCMDDOC_INTRO_EXAMPLE_HELP", "This command <...>" }, - { "GENCMDDOC_KEY", "Key" }, - { "GENCMDDOC_KEYWORD", "Keyword" }, - { "GENCMDDOC_LIST_OTHER_AUT", "List object or data authorities required to run the command." }, - { "GENCMDDOC_LIST_SPECIAL_AUT", "List all special authorities required to run the command." }, - { "GENCMDDOC_LIST_THREADSAFE_RESTRICTIONS", "If conditionally threadsafe, list threadsafe conditions or restrictions." }, - { "GENCMDDOC_MULTIPLE_ELEMENT_VALUES_ALLOWED", "You can specify &1 values for this element." }, - { "GENCMDDOC_MULTIPLE_PARAMETER_VALUES_ALLOWED", "You can specify &1 values for this parameter." }, - { "GENCMDDOC_NAME_LOWERCASE", "name" }, - { "GENCMDDOC_NO_PARAMETERS", "There are no parameters for this command." }, { "GENCMDDOC_OPTIONAL", "Optional" }, - { "GENCMDDOC_NONE", "None" }, - { "GENCMDDOC_NOTES", "Notes" }, - { "GENCMDDOC_PARAMETERS", "Parameters" }, - { "GENCMDDOC_POSITIONAL", "Positional" }, - { "GENCMDDOC_QUALIFIER", "Qualifier" }, - { "GENCMDDOC_REQUIRED", "Required" }, - { "GENCMDDOC_REQUIRED_PARAMETER", "This is a required parameter." }, - { "GENCMDDOC_RESTRICTION_AUT", "You must have <...>" }, - { "GENCMDDOC_RESTRICTION_COMMENT", "Parameter-level restrictions belong in parameter help sections, not here." }, - { "GENCMDDOC_RESTRICTION_THREADSAFE", "This command is conditionally threadsafe, <...>" }, - { "GENCMDDOC_RESTRICTIONS_HEADING", "Restrictions" }, - { "GENCMDDOC_SPECIFY_CL_VARIABLE_NAME", "Specify the CL variable <...>" }, - { "GENCMDDOC_SPECIFY_COMMAND_STRING", "Specify the command <...>" }, - { "GENCMDDOC_SPECIFY_DATE", "Specify the date <...>" }, - { "GENCMDDOC_SPECIFY_GENERIC_NAME", "Specify the generic name of <...>" }, - { "GENCMDDOC_SPECIFY_NAME", "Specify the name of <...>" }, - { "GENCMDDOC_SPECIFY_NUMBER", "Specify the number of <...>" }, - { "GENCMDDOC_SPECIFY_PATH_NAME", "Specify the path name of <...>" }, - { "GENCMDDOC_SPECIFY_TIME", "Specify the time <...>" }, - { "GENCMDDOC_SPECIFY_VALUE", "Specify the <...>" }, - { "GENCMDDOC_THREADSAFE", "Threadsafe" }, - { "GENCMDDOC_THREADSAFE_CONDITIONAL", "Conditional" }, - { "GENCMDDOC_TOP_OF_PAGE", "Top" }, - { "GENCMDDOC_TYPE_CL_VARIABLE_NAME", "CL variable name" }, - { "GENCMDDOC_TYPE_COMMAND_STRING", "Command string" }, - { "GENCMDDOC_TYPE_COMMUNICATIONS_NAME", "Communications name" }, - { "GENCMDDOC_TYPE_DATE", "Date" }, - { "GENCMDDOC_TYPE_DECIMAL_NUMBER", "Decimal number" }, - { "GENCMDDOC_TYPE_ELEMENT_LIST", "Element list" }, - { "GENCMDDOC_TYPE_GENERIC_NAME", "Generic name" }, - { "GENCMDDOC_TYPE_INTEGER", "Integer" }, - { "GENCMDDOC_TYPE_NOT_RESTRICTED", "Not restricted" }, - { "GENCMDDOC_TYPE_PATH_NAME", "Path name" }, - { "GENCMDDOC_TYPE_QUALIFIED_JOB_NAME", "Qualified job name" }, - { "GENCMDDOC_TYPE_QUALIFIED_OBJECT_NAME", "Qualified object name" }, - { "GENCMDDOC_TYPE_QUALIFIER_LIST", "Qualifier list" }, - { "GENCMDDOC_TYPE_SIMPLE_NAME", "Simple name" }, - { "GENCMDDOC_TYPE_TIME", "Time" }, - { "GENCMDDOC_TYPE_VALUE_LOGICAL", "Logical value" }, - { "GENCMDDOC_TYPE_VALUE_CHARACTER", "Character value" }, - { "GENCMDDOC_TYPE_VALUE_HEX", "Hexadecimal value" }, - { "GENCMDDOC_TYPE_UNSIGNED_INTEGER", "Unsigned integer" }, - { "GENCMDDOC_UNKNOWN", "Unknown" }, - { "GENCMDDOC_VALUE_CHARACTER", "character-value" }, - { "GENCMDDOC_VALUE_CL_VARIABLE_NAME", "CL-variable-name" }, - { "GENCMDDOC_VALUE_COMMAND_STRING", "command-string" }, - { "GENCMDDOC_VALUE_COMMUNICATIONS_NAME", "communications-name" }, - { "GENCMDDOC_VALUE_DATE", "date" }, - { "GENCMDDOC_VALUE_DECIMAL_NUMBER", "decimal-number" }, - { "GENCMDDOC_VALUE_GENERIC_NAME", "generic-name" }, - { "GENCMDDOC_VALUE_HEX", "hexadecimal-value" }, - { "GENCMDDOC_VALUE_INTEGER", "integer" }, - { "GENCMDDOC_VALUE_LOGICAL", "logical-value" }, - { "GENCMDDOC_VALUE_NAME", "name" }, - { "GENCMDDOC_VALUE_NOT_RESTRICTED", "unrestricted-value" }, - { "GENCMDDOC_VALUE_PATH_NAME", "path-name" }, - { "GENCMDDOC_VALUE_SIMPLE_NAME", "simple-name" }, - { "GENCMDDOC_VALUE_TIME", "time" }, - { "GENCMDDOC_VALUE_UNSIGNED_INTEGER", "unsigned-integer" }, - { "GENCMDDOC_VALUES_OTHER", "Other values" }, - { "GENCMDDOC_VALUES_OTHER_REPEAT", "Other values (up to &1 repetitions)" }, - { "GENCMDDOC_VALUES_REPEAT", "Values (up to &1 repetitions)" }, - { "GENCMDDOC_VALUES_SINGLE", "Single values" }, - { "GENCMDDOC_WHERE_ALLOWED_TO_RUN", "Where allowed to run" } - - }; - -} - diff --git a/cvsroot/src/com/ibm/as400/access/ManagedProfileTokenVault.java b/cvsroot/src/com/ibm/as400/access/ManagedProfileTokenVault.java deleted file mode 100644 index d613e7d47..000000000 --- a/cvsroot/src/com/ibm/as400/access/ManagedProfileTokenVault.java +++ /dev/null @@ -1,429 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ManagedProfileTokenVault.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2009-2009 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import com.ibm.as400.security.auth.ProfileTokenCredential; -import com.ibm.as400.security.auth.ProfileTokenProvider; -import java.io.Serializable; - -/** - * A vault which contains a profile token credential. The primary purpose of this class is - * to offer a standardized way to keep a profile token credential valid, either by refreshing - * it or by generating a new one, for an indefinite period of time. - *

    - * This class differs from - * the {@link com.ibm.as400.access.ProfileTokenVault ProfileTokenVault} class in several important ways: - *

      - *
    • - * The vault contains a reference to a {@link com.ibm.as400.security.auth.ProfileTokenCredential ProfileTokenCredential} object. - * The ProfileTokenVault only contains a reference to the raw bytes contained within a - * provided ProfileToken object. - *
    • - *
    • - * The profile token contained in the vault is provided by an object that implements - * the {@link com.ibm.as400.security.auth.ProfileTokenProvider ProfileTokenProvider} interface. The profile token provider - * is responsible for constructing and returning a profile token with the desired credential characteristics. - * The {@link com.ibm.as400.security.auth.DefaultProfileTokenProvider DefaultProfileTokenProvider} provides a default implementation of - * the profile token provider interface. - *
    • - *
    • - * The life span of the profile token is managed by the vault. This means if the profile - * token is close to expiring, the vault will initiate a refresh of the token. If the profile - * token expires, a new profile token is generated using the profile token provider. - *
    • - *
    - *

    - * - *

    How the profile token is managed

    - * - * The general approach for managing the profile token is a lazy "check before returning" approach. - * This class does not perform any on-going polling or background checking on the status of the profile token. - * Instead, the currency of the profile token is only checked when the underlying token bytes are - * requested from the vault. When this currency check is made, there are three possible outcomes: - *
      - *
    1. - * The profile token is current, and its time to expiration is greater than the specified refresh - * threshold. This is the simplest case because nothing needs to be done. The underlying token - * bytes are simply returned and the request is satisfied. - *
    2. - *
    3. - * The profile token is current, but its time to expiration is less than the specified refresh - * threshold. In this case, the profile token is refreshed using the refresh() method on the - * ProfileTokenCredential object. Once the token has been refreshed, the underlying token bytes - * are returned and the request is satisfied. - *
    4. - *
    5. - * The profile token has expired. Once a profile token has expired, it cannot be refreshed. - * So in this scenario, the only option is to generate a new profile token. The new profile - * token is generated using the profile token provider supplied during the construction of the - * vault. Once the new profile token has been generated, the underlying token bytes are - * returned and the request is satisfied. - *
    6. - *
    - *

    - * - * Note: It is very important to fully understand the consequences of the third outcome listed above. - * Because many different classes, directly or indirectly, make use of the credential stored in - * this vault, it is not possible to predict exactly when the profile token provider may be asked - * to generate a new profile token. This is an important point, because generating a profile - * token on an IBM i system may require special authorities. Therefore, users of this class - * must make certain that the profile token provider specified on construction is capable of - * generating a new profile token in a wide variety of circumstances, including the possibility - * that the request will be made from a thread that is different from the thread that constructed - * the original credential vault. For more information about what authority is required to - * generate a profile token, please reference the {@link com.ibm.as400.security.auth.ProfileTokenCredential} - * class documentation. - * - *

    Refresh Threshold

    - * - * The vault will decide to refresh a profile token if its time to expiration is less than the - * refresh threshold. So the refresh threshold represents the minimum amount of time left for - * the currency of a profile token before the vault will refresh the token. This concept is - * easiest to explain and understand using an example. - *

    - * Let's say we have a vault with a profile token that was created with a timeout interval of - * 3600 seconds (1 hour), and the refresh threshold for the vault is set to 1200 seconds - * (20 minutes). When a request for the token's underlying bytes is made, the vault will query - * the profile token object to see how much longer the profile token is valid for. If the profile - * token is valid for longer than 20 minutes (i.e. the refresh threshold), the underlying bytes - * of the profile token are simply returned. If the profile token is valid for less than 20 - * minutes, the token will be refreshed. - *

    - * So why does the vault refresh the token instead of simply allowing it to expire and, at that - * time, generate a new profile token? There are several reasons. The primary reason is if - * we allowed the profile token to expire, we would leave open a timing window where the bytes - * returned by the vault may become invalid before they can be used by the class that requested - * them for use in authenticating with an IBM i system. The refresh threshold greatly reduces - * this timing window and, if the delta between the refresh threshold for the vault and the - * timeout interval for the profile token is set high enough, we can reduce this timing window - * to such a small degree of probability that it becomes a negligable concern. Another reason - * for refreshing an existing profile token is that the performance for a refresh operation - * should be slightly better than the performance for creating a new profile token from scratch. - *

    - * Because the refresh threshold is used to prevent the timing window where the profile token - * credential are given but expire before being used, the value for the refresh threshold should - * be set such that the profile token credential will be current for a generous amount of time - * after it is extracted from the vault. The default setting for the refresh threshold is half - * of the timeout interval for the profile token; so a profile token with a one hour timeout - * interval will be refreshed once it has less than 30 minutes of time remaining before it expires. - */ -class ManagedProfileTokenVault extends ProfileTokenVault implements Cloneable, Serializable -{ - /** - * Constant that indicates the profile token credential managed by the vault - * should be refreshed every time its raw bytes (i.e. the underlying - * credential) is requested. - */ - private static final int REFRESH_TOKEN_EVERY_TIME = -1; - - /** - * Constant representing the minimum amount of time, in seconds, allowed - * between a refresh of the profile token credential managed by the vault. - */ - private static final int MIN_TOKEN_REFRESH_TIME_INTERVAL = 30; - - /** - * Constant representing the maximum amount of time, in seconds, allowed - * between a refresh of the profile token credential managed by the vault. - */ - private static final int MAX_TOKEN_REFRESH_TIME_INTERVAL = (60 * 59); // 59 minutes - - /** The object that provides a new profile token credential for the vault. */ - private ProfileTokenProvider tokenProvider_; - - /** The profile token credential. */ - private ProfileTokenCredential profileToken_; - - /** - * The amount of time, in seconds, to wait before refreshing the - * existing profile token credential. The maximum value for this - * field is {@link #MAX_TOKEN_REFRESH_TIME_INTERVAL} - */ - private int refreshThreshold_; - - /** - * Constructs a ManagedProfileTokenVault object. A new profile token - * is generated during the construction of the vault using the specified - * token provider. If a new profile token is needed in the future, the - * same token provider will be used. The refresh threshold is set to - * a default value of half the profile token's timeout interval. - * - * @param tokenProvider The provider to use when a new profile token needs to be generated - */ - protected ManagedProfileTokenVault(ProfileTokenProvider tokenProvider) { - this(tokenProvider, REFRESH_TOKEN_EVERY_TIME); - } - - /** - * Constructs a ManagedProfileTokenVault object. A new profile token - * is generated during the construction of the vault using the specified - * token provider. If a new profile token is needed in the future, the - * same token provider will be used. The refresh threshold is set to - * the value specified by the refreshThreshold parameter. - * - * @param tokenProvider The provider to use when a new profile token needs to be generated - * @param refreshThreshold The refresh threshold, in seconds, for the profile token. Used - * by the vault to manage the currency of the profile token to - * help ensure it remains current for an indefinite period of time. - */ - protected ManagedProfileTokenVault(ProfileTokenProvider tokenProvider, int refreshThreshold) { - super(); - try { - profileToken_ = tokenProvider.create(); - encodedCredential_ = store(profileToken_.getToken()); - initRefreshThreshold(refreshThreshold == REFRESH_TOKEN_EVERY_TIME ? profileToken_.getTimeoutInterval() / 2 : refreshThreshold); - } - catch (AS400SecurityException e) { - Trace.log(Trace.ERROR, "Error while created ManagedProfileTokenVault.", e); - } - tokenProvider_ = tokenProvider; - } - - /** - * Internal use only. Used to construct an empty vault when we are - * creating a copy of an existing vault. - */ - private ManagedProfileTokenVault() { - super(); - } - - /** - * Returns a copy of this ManagedProfileTokenVault. The new copy will NOT - * be an exact copy of this vault. The characteristics (i.e. refresh - * threshold and token provider) will be exactly the same, but the profile - * token itself is not duplicated. Instead, the new vault copy generates - * its own profile token using the token provider. This non-copy of the - * profile token is required, because the vault must always maintain a 1-to-1 - * mapping between the vault and the profile token it is managing. - * - * @return A newly created ManagedProfileTokenVault with the same - * characteristics as this one, but with its own uniquely - * generated profile token. - */ - public Object clone() - { - ManagedProfileTokenVault vaultClone = (ManagedProfileTokenVault)super.clone(); - - synchronized(this) - { - // - // When we duplicate the fields from an existing managed profile token vault, - // we do NOT duplicate the profile token itself. - // By design, each managed profile token vault contains its very own - // profile token. In order to maintain this 1-to-1 correlation between - // vault and token, we must create a brand new profile token for - // the newly created vault. However, we do copy the refresh threshold - // and token provider from the existing vault, so both the new vault - // and the profile token in it will have the same characteristics - // as the vault we are making a copy of. - // - - vaultClone.refreshThreshold_ = refreshThreshold_; - vaultClone.tokenProvider_ = tokenProvider_; - - try { - ProfileTokenCredential newToken = tokenProvider_.create(); - vaultClone.profileToken_ = newToken; - vaultClone.encodedCredential_ = store(newToken.getToken()); - } - catch (AS400SecurityException e) { - Trace.log(Trace.ERROR, "Error while cloning ManagedProfileTokenVault.", e); - } - return vaultClone; - } - } - - /** - * Purges the contents of the vault. All resources consumed by the - * credential vault are freed, which means the profile token stored in - * the vault will be destroyed. If this method is invoked and the vault - * is already empty, the method simply returns and no exception is thrown. - */ - protected synchronized void empty() { - // Let the super class do any cleanup it needs to - super.empty(); - disposeOfToken(); - } - - /** - * Retrieves the raw profile token credential bytes stored in the vault. - * If the profile token time to expiration is less than the refresh threshold, - * the profile token will be refreshed before returning its bytes. If the - * profile token has expired, a new profile token will be generated using the - * token provider, and the bytes of the newly generated profile token will - * be returned. - * - * @return The credential bytes for the profile token stored in the vault - */ - protected synchronized byte[] getClearCredential() { - // If the vault is empty, build ourselves a new token - if (isEmpty()) { - buildToken(); - return resolve(encodedCredential_); - } - - // We have a profile token in the vault, so check if it is current. - // If it is not, then we have missed our opportunity to renew it - // and we will need to start over by creating a brand new token. - if (!profileToken_.isCurrent()) { - // The profile token has already expired. This means we need - // to start all over by creating a new one. - buildToken(); - return resolve(encodedCredential_); - } - - // Check to see how much time is left before the token expires. - // If there is less than 'refreshThreshold' time left, then - // renew the token before returning it. - try { - if ( (isTimeForRefresh()) && (profileToken_.isRenewable()) ) { - profileToken_.refresh(); - encodedCredential_ = store(profileToken_.getToken()); - } - } - catch (Exception e) { - // In case of exception, just try to build a brand new token. - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, "Error while refreshing profile token.", e); - } - buildToken(); - } - return resolve(encodedCredential_); - } - - /** - * Forces the profile token to be refreshed, regardless of how - * much time is left before it expires. - */ - protected synchronized void forceRefresh() { - // See if we have a profile token to refresh. - if ( (isEmpty()) || (!profileToken_.isRenewable()) ) { - // No, so just build a new one - buildToken(); - return; - } - - try { - profileToken_.refresh(); - encodedCredential_ = store(profileToken_.getToken()); - } - catch (Exception e) { - // In case of exception, just try to build a brand new token. - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, "Error while forcefully refreshing profile token.", e); - } - buildToken(); - } - } - - /** - * {@inheritDoc} - */ - protected synchronized boolean isEmpty() { - boolean empty = super.isEmpty(); - - if (empty) { - if (profileToken_ != null) { - throw new IllegalStateException("Credential vault is empty, but profile token is not null"); - } - } - return empty; - } - - /** - * Initializes the refresh threshold. - * - * @param threshold The refresh threshold, in seconds - */ - private void initRefreshThreshold(int threshold) { - // The minimum allowed refresh threshold is 30 seconds. - // The maximum allowed is 59 minutes. - if ( (threshold < MIN_TOKEN_REFRESH_TIME_INTERVAL) || (threshold > MAX_TOKEN_REFRESH_TIME_INTERVAL) ) { - throw new IllegalArgumentException("Refresh threshold must between " + - MIN_TOKEN_REFRESH_TIME_INTERVAL + " and " + - MAX_TOKEN_REFRESH_TIME_INTERVAL + " seconds"); - } - refreshThreshold_ = threshold; - } - - /** - * Unconditionally disposes of the existing profile token, - * and generates a new profile token using the token provider. - */ - private void buildToken() { - try { - // First dispose of the existing token, if it exists - disposeOfToken(); - - // Next create a new one - profileToken_ = tokenProvider_.create(); - - // Finally, store the bytes of the new token in an encoded form - encodedCredential_ = store(profileToken_.getToken()); - } - catch (Exception e) { - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, "Error while building profile token.", e); - } - - // If the build and store of the profile token did not both - // succeed, then get rid of everything. This prevents us from - // getting into a half baked state where the profile token is - // present but the encoded credential is null (not sure how that - // scenario would ever happen anyway, but this protects us from - // it nontheless). - disposeOfToken(); - } - } - - /** - * Unconditionally disposes of the existing profile token. - */ - private void disposeOfToken() { - try { - // Destroy our profile token - if (profileToken_ != null) { - profileToken_.destroy(); - } - } - catch (Exception e) { - Trace.log(Trace.ERROR, "Error while disposing of profile token.", e); - } - finally { - profileToken_ = null; - encodedCredential_ = null; - } - } - - /** - * Determines if it is time to refresh the profile token. This is decided - * by comparing the time left until the profile token expires, and the - * refresh threshold. - * - * @return true if the profile token needs to be refreshed, false if it does not. - * - * @throws AS400SecurityException If an IBM i system security or authentication error occurs - */ - private boolean isTimeForRefresh() throws AS400SecurityException { - if (refreshThreshold_ == REFRESH_TOKEN_EVERY_TIME) { - return true; - } - else if (profileToken_ == null) { - return true; - } - else { - return (profileToken_.getTimeToExpiration() < refreshThreshold_); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/MemberDescription.java b/cvsroot/src/com/ibm/as400/access/MemberDescription.java deleted file mode 100644 index de5adf957..000000000 --- a/cvsroot/src/com/ibm/as400/access/MemberDescription.java +++ /dev/null @@ -1,827 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MemberDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2009-2009 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -/** - * Represents a database file member and its attributes. - * MemberDescription objects can be constructed individually, or generated - * by {@link MemberList#getMemberDescriptions MemberList.getMemberDescriptions()}. - * A member's attributes can be retrieved by calling {@link #getValue getValue()} - * and passing one of the attribute identifier constants defined in this class. - *

    - * Note: String data is always stored and returned without trailing blanks. - *

    - * Performance hint: - * If you anticipate retrieving multiple attributes for a given member, - * first call {@link #refresh refresh()}, which will make a single API call - * to retrieve (and cache) all of the member's attribute values. - *

    - * Implementation note: - * This class internally calls the "Retrieve Member Description" (QUSRMBRD) API. - * Information from formats MBRD0100, MBRD0200, and MBRD0300 is retrieved. - * - *

    - * This class is mostly based on a prototype contributed by Mihael Schmidt. - * - * @see MemberList - * @see AS400File - * @see ObjectDescription -**/ -public class MemberDescription -{ - private static final SimpleDateFormat dateTimeFormat_ = new SimpleDateFormat("yyMMddHHmmss"); - private static final SimpleDateFormat dateFormat_ = new SimpleDateFormat("yyMMdd"); - - private static final String QUSRMBRD_FORMAT_100 = "MBRD0100"; - private static final String QUSRMBRD_FORMAT_200 = "MBRD0200"; - private static final String QUSRMBRD_FORMAT_300 = "MBRD0300"; - - - /** The name of the database file whose member names are placed in the list. Attribute type: java.lang.String.*/ - public static final int FILE_NAME = 1; - - /** The name of the library where the database file is located. Attribute type: java.lang.String. */ - public static final int LIBRARY_NAME = 2; - - /** The name of a member found in the database file. Attribute type: java.lang.String. */ - public static final int MEMBER_NAME = 3; - - /** The type of file found. Attribute type: java.lang.String. */ - public static final int FILE_ATTRIBUTE = 4; - - /** The type of source member if this is a source file. Attribute type: java.lang.String. */ - public static final int SOURCE_TYPE = 5; - - /** The date and time the member was created. Attribute type: java.util.Date.*/ - public static final int CREATION_DATE_TIME = 6; - - /** - * For source files, the date and time that this source member was last changed. - * For SQL materialized query tables, the date and time that the last SQL Refresh - * Table statement refreshed this member. Attribute type: java.util.Date (may be null). - */ - public static final int LAST_SOURCE_CHANGE_DATE = 7; - - /** Description of the member found in the database file. Attribute type: java.lang.String. */ - public static final int MEMBER_TEXT_DESCRIPTION = 8; - - /** Whether the database file is a source file or a data file. Attribute type: java.lang.Boolean. */ - public static final int SOURCE_FILE = 9; - - /** - * Whether the database file is a remote file (true = remote file, false = local file). - * Attribute type: java.lang.Boolean. - */ - public static final int REMOTE_FILE = 10; - - /** - * Whether the database file is a logical or physical file (true = logical file, false = - * physical file). Attribute type: java.lang.Boolean. - */ - public static final int LOGICAL_FILE = 11; - - /** - * Whether the open data path (ODP) allows sharing with other programs in the same job - * (true = ODP sharing is allowed, false = ODP sharing is not allowed). Attribute type: java.lang.Boolean. - */ - public static final int ODP_SHARING = 12; - - /** - * The number of records that currently exist in this member. - * A logical member returns the summarization of index entries. - * If the requested physical file member is suspended, the value 0 is returned. - * Attribute type: java.lang.Integer. - */ - public static final int CURRENT_NUMBER_OF_RECORDS = 13; - - /** - * The size of the space that contains the data of the file member, in bytes. - * A logical file returns a 0. Attribute type: java.lang.Integer. - */ - public static final int DATA_SPACE_SIZE = 14; - - /** - * The access path size in bytes for this file member. If the file member is not keyed, - * the value 0 is returned. DDM files, which are not from a System/38 or iSeries system, - * return value 0. Attribute type: java.lang.Integer. - */ - public static final int ACCESS_PATH_SIZE = 15; - - /** - * The number of database file members for the logical file member. If the member is a physical - * file member, the value is 0. Attribute type: java.lang.Integer. - */ - public static final int NUMBER_OF_BASED_ON_PHYICAL_FILE_MEMBERS = 16; - - /** - * The date and time this member was changed. The value contains null if the member was - * never changed. Attribute type: java.util.Date. - */ - public static final int CHANGE_DATE_AND_TIME = 17; - - /** - * The date and time that this member was last saved. The value contains null if the member - * was never saved. Attribute type: java.util.Date. - */ - public static final int SAVE_DATE_AND_TIME = 18; - - /** - * The date and time that the member was last restored. The value contains null if the member - * was never restored. Attribute type: java.util.Date. - */ - public static final int RESTORE_DATE_AND_TIME = 19; - - /** The date that this member expires. Attribute type: java.util.Date. */ - public static final int EXPIRATION_DATE = 20; - - /** - * The number of days the member has been used. If the member does not have a last-used date, - * the value 0 is returned. Attribute type: java.lang.Integer. - */ - public static final int NUMBER_OF_DAYS_USED = 21; - - /** - * The century and date this member was last used. The value contains null if the member was - * never used. Attribute type: java.util.Date. - */ - public static final int DATE_LAST_USED = 22; - - /** - * The century and date when the days-used count was last set to 0. If the date is not available - * the value contains null. Attribute type: java.util.Date. - */ - public static final int USE_RESET_DATE = 23; - - /** - * The value to multiply the data space size by to get its true size. Typically this is 1, but - * for large files, the value may be greater than 1. If the data space size multiplier is - * greater than 1, then the value in the data space size field is not the actual size of the file. - * Attribute type: java.lang.Integer. - */ - public static final int DATA_SPACE_SIZE_MULTIPLIER = 24; - - /** The value to multiply the access path size by to get its true size. Attribute type: java.lang.Integer. */ - public static final int ACCESS_PATH_SIZE_MULTIPLIER = 25; - - /** The CCSID for the member text description. Attribute type: java.lang.Integer. */ - public static final int MEMBER_TEXT_DESCRIPTION_CCSID = 26; - - /** - * The number of deleted records returned in the file member. Keyed logical files return a 0. - * DDM files that are not from a System/38 or iSeries system return a 0. If the requested - * physical file member is suspended, the value 0 is returned. Attribute type: java.lang.Integer. - */ - public static final int NUMBER_OF_DELETED_RECORDS = 27; - - /** - * Whether the member's logical file member combines (in one record format) fields from two or - * more physical file members (true = join member, false = not a join member). - * Attribute type: java.lang.Boolean. - */ - public static final int JOIN_MEMBER = 28; - - /** - * Specifies, for files with key fields or join logical files, the type of access path - * maintenance used for all members of the physical or logical file. Attribute type: java.lang.String. - */ - public static final int ACCESS_PATH_MAINTENANCE = 29; - - /** - * The kind of SQL file type the file is. If the file isn't an SQL file, blank is returned. - * Attribute type: java.lang.String. - */ - public static final int SQL_FILE_TYPE = 30; - - /** Whether records in the physical file can be read. Values: Y/N. Attribute type: java.lang.Boolean. */ - public static final int ALLOW_READ_OPERATION = 31; - - /** Whether records can be written to the file. Values: Y/N. Attribute type: java.lang.Boolean. */ - public static final int ALLOW_WRITE_OPERATION = 32; - - /** Whether records in this file can be updated. Values: Y/N. Attribute type: java.lang.Boolean. */ - public static final int ALLOW_UPDATE_OPERATION = 33; - - /** Whether records in this file can be deleted. Values: Y/N. Attribute type: java.lang.Boolean. */ - public static final int ALLOW_DELETE_OPERATION = 34; - - /** - * The number of inserted, updated, or deleted records that are processed before the records are - * forced into auxiliary storage. A 0 indicates that records are not forced into auxiliary storage. - * Attribute type: java.lang.Integer. - */ - public static final int RECORDS_TO_FORCE_A_WRITE = 35; - - /** - * The maximum allowed percentage of deleted records for each member in the physical file. The - * percentage check is made when the member is closed. If the percentage of deleted records is - * greater than the value shown, a message is sent to the history log. This field only applies - * to physical files and is 0 when either no deleted records are allowed or the file is a - * logical file. Attribute type: java.lang.Integer. - */ - public static final int MAXIMUM_PERCENT_DELETED_RECORDS_ALLOWED = 36; - - /** - * The number of records that can be written to each member of the file before the member size is - * automatically extended. This field applies only to physical files and is 0 for logical files. - * Attribute type: java.lang.Integer. - */ - public static final int INITIAL_NUMBER_OF_RECORDS = 37; - - /** - * The maximum number of records that are automatically added to the member when the number of - * records in the member is greater than the initial member size. This field applies only to - * physical files and is 0 for logical files. Attribute type: java.lang.Integer. - */ - public static final int INCREMENT_NUMBER_OF_RECORDS = 38; - - /** - * The maximum number of increments automatically added to the member size. This field only - * applies to physical files and is 0 for a logical file. Attribute type: java.lang.Integer. - */ - public static final int MAXIMUM_NUMBER_OF_INCREMENTS = 39; - - /** - * The number of increments that have been added to the member size (data space size). This - * field is 0 for logical files because the number of increments only applies to physical files. - * Attribute type: java.lang.Integer. - */ - public static final int CURRENT_NUMBER_OF_INCREMENTS = 40; - - /** - * The actual number of records this member can contain. The value is calculated by multiplying - * the increment number of records by the maximum number of increments, and adding the initial - * number of records. This field only applies to a physical file and is 0 for a logical file. - * Attribute type: java.lang.Integer. - */ - public static final int RECORD_CAPACITY = 41; - - /** - * The name of a record format selector program that is called when the logical file member - * contains more than one logical record format. Attribute type: java.lang.String. - */ - public static final int RECORD_FORMAT_SELECTOR_PROGRAM_NAME = 42; - - /** - * The library in which the record format selector program resides. This field is blank for - * physical files. Attribute type: java.lang.String. - */ - public static final int RECORD_FORMAT_SELECTOR_LIBRARY_NAME = 43; - - - private AS400 system_; - private QSYSObjectPathName pathName_; - private HashMap attributes_ = new HashMap(); - - private final AS400Bin4 intConverter_ = new AS400Bin4(); - - - /** - * Constructs an MemberDescription. - * @param system The system. - * @param path The fully-qualified integrated file system path to the database file member. - * Consider using {@link QSYSObjectPathName QSYSObjectPathName} to compose - * the fully-qualified path string, - * or using {@link #MemberDescription(AS400,QSYSObjectPathName) MemberDescription(AS400,QSYSObjectPathName)} instead. - **/ - public MemberDescription(AS400 system, String path) - { - this(system, new QSYSObjectPathName(path)); - } - - /** - * Constructs a MemberDescription object. - * @param system The system. - * @param path The fully-qualified integrated file system path to the database file member. - * Consider using {@link QSYSObjectPathName QSYSObjectPathName} to compose the fully-qualified path string. - */ - public MemberDescription(AS400 system, QSYSObjectPathName path) - { - if (system == null) throw new NullPointerException("system"); - if (path == null) throw new NullPointerException("path"); - - system_ = system; - pathName_ = path; - } - - /** - * Constructs a MemberDescription object. - * - * @param system AS400 system object - * @param libraryName Library where the database file is located. - * @param objectName The name of the database file. - * @param memberName The name of the member within the database file. - */ - public MemberDescription(AS400 system, String libraryName, String objectName, String memberName) - { - this(system, new QSYSObjectPathName(libraryName, objectName, memberName, "MBR")); - } - - /** - * Constructs a MemberDescription given the specified path to the member with some preloaded - * attributes. - * - * @param system The system. - * @param path The fully-qualified integrated file system path to the member. - * Consider using {@link QSYSObjectPathName QSYSObjectPathName} to compose the fully-qualified path string. - * @param attributes Map with preloaded attributes - * - * @see MemberList - */ - MemberDescription(AS400 system, QSYSObjectPathName path, Map attributes) - { - this(system, path); - attributes_.putAll(attributes); - } - - /** - * Determine the format to use on the API call depending on the attribute. - * - * @param attribute Attribute key - * @return Format name to be used for the API call. - */ - private String lookupFormat(int attribute) - { - String format; - - switch (attribute) - { - case FILE_NAME: - case LIBRARY_NAME: - case MEMBER_NAME: - case FILE_ATTRIBUTE: - case SOURCE_TYPE: - case CREATION_DATE_TIME: - case LAST_SOURCE_CHANGE_DATE: - case MEMBER_TEXT_DESCRIPTION: - case SOURCE_FILE: - format = QUSRMBRD_FORMAT_100; - break; - - case REMOTE_FILE: - case LOGICAL_FILE: - case ODP_SHARING: - case CURRENT_NUMBER_OF_RECORDS: - case DATA_SPACE_SIZE: - case ACCESS_PATH_SIZE: - case NUMBER_OF_BASED_ON_PHYICAL_FILE_MEMBERS: - case CHANGE_DATE_AND_TIME: - case SAVE_DATE_AND_TIME: - case RESTORE_DATE_AND_TIME: - case EXPIRATION_DATE: - case NUMBER_OF_DAYS_USED: - case DATE_LAST_USED: - case USE_RESET_DATE: - case DATA_SPACE_SIZE_MULTIPLIER: - case ACCESS_PATH_SIZE_MULTIPLIER: - case MEMBER_TEXT_DESCRIPTION_CCSID: - case NUMBER_OF_DELETED_RECORDS: - format = QUSRMBRD_FORMAT_200; - break; - - case JOIN_MEMBER: - case ACCESS_PATH_MAINTENANCE: - case SQL_FILE_TYPE: - case ALLOW_READ_OPERATION: - case ALLOW_WRITE_OPERATION: - case ALLOW_UPDATE_OPERATION: - case ALLOW_DELETE_OPERATION: - case RECORDS_TO_FORCE_A_WRITE: - case MAXIMUM_PERCENT_DELETED_RECORDS_ALLOWED: - case INITIAL_NUMBER_OF_RECORDS: - case INCREMENT_NUMBER_OF_RECORDS: - case MAXIMUM_NUMBER_OF_INCREMENTS: - case CURRENT_NUMBER_OF_INCREMENTS: - case RECORD_CAPACITY: - case RECORD_FORMAT_SELECTOR_PROGRAM_NAME: - case RECORD_FORMAT_SELECTOR_LIBRARY_NAME: - format = QUSRMBRD_FORMAT_300; - break; - - default: - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Unrecognized attribute key:", attribute); - format = QUSRMBRD_FORMAT_100; - } - - return format; - } - - /** - * Returns the requested member attribute information object. If the value is not in the cache - * it will be retrieved from the system. - * - * @param attribute Attribute to be retrieved (either from cache or from system) - * - * @return Requested member attribute - * - * @throws ObjectDoesNotExistException If a system object necessary for the call does not exist on the system. - * @throws InterruptedException If this thread is interrupted. - * @throws IOException If an error occurs while communicating with the system. - * @throws ErrorCompletingRequestException If an error occurs before the request is completed. - * @throws AS400SecurityException If a security or authority error occurs. - * @throws AS400Exception If the program on the server sends an escape message. - */ - public Object getValue(int attribute) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, - IOException, InterruptedException, ObjectDoesNotExistException - { - final Integer key = new Integer(attribute); - Object value = null; - - value = attributes_.get(key); - - // If the value has not yet been retrieved from the server, the value object is still null. - // Retrieve it from the server and set the value object at last. - if (value == null) - { - value = retrieve(attribute); - // add value to the cache - attributes_.put(key, value); - } - - return value; - } - - - /** - * Retrieves (and caches) all attributes of this member from the system. - * - * @throws ObjectDoesNotExistException If a system object necessary for the call does not exist on the system. - * @throws InterruptedException If this thread is interrupted. - * @throws IOException If an error occurs while communicating with the system. - * @throws ErrorCompletingRequestException If an error occurs before the request is completed. - * @throws AS400SecurityException If a security or authority error occurs. - * @throws AS400Exception If the program on the server sends an escape message. - **/ - public void refresh() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(RECORD_FORMAT_SELECTOR_LIBRARY_NAME); - } - - /** - * Sets the attribute of the member. Any previous information of the same attribute will be - * replaced. - * - * @param attribute Attribute key (Integer) - * @param value member information object to be set - */ - void setAttribute(int attribute, Object value) - { - attributes_.put(new Integer(attribute), value); - } - - /** - * This method makes the actual call to the server and gets the information about the member. - * All other member information which belong to the same format are also retrieved. - * - * @param attribute Attribute to be retrieved and returned - * - * @return The value of the attribute - * - * @throws ObjectDoesNotExistException If a system object necessary for the call does not exist on the system. - * @throws InterruptedException If this thread is interrupted. - * @throws IOException If an error occurs while communicating with the system. - * @throws ErrorCompletingRequestException If an error occurs before the request is completed. - * @throws AS400SecurityException If a security or authority error occurs. - * @throws AS400Exception If the program on the server sends an escape message. - */ - private Object retrieve(int attribute) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, - IOException, InterruptedException, ObjectDoesNotExistException - { - final String format = lookupFormat(attribute); - - ProgramParameter[] parameters = buildProgramParameters(format); - ProgramCall program = new ProgramCall(system_, "/QSYS.LIB/QUSRMBRD.PGM", parameters); // this API is not threadsafe - - if (program.run()) - { - readMemberInfo(parameters[0].getOutputData(), format); - return attributes_.get(new Integer(attribute)); - } - else - { - throw new AS400Exception(program.getMessageList()); - } - } - - /** - * Builds the program parameter list for a program call to QUSRMBRD (Retrieve Member Description). - * - * @return Program parameter list for QUSRMBRD - */ - private ProgramParameter[] buildProgramParameters(String format) - throws UnsupportedEncodingException - { - final CharConverter charConverter = new CharConverter(system_.getCcsid(), system_); - - ProgramParameter[] parameterList = new ProgramParameter[7]; - - // Receiver variable: - parameterList[0] = new ProgramParameter(332); - // Length of receiver variable: - parameterList[1] = new ProgramParameter(intConverter_.toBytes(332)); - // Format name: - parameterList[2] = new ProgramParameter(charConverter.stringToByteArray(system_, format)); - // Qualified database file name: - parameterList[3] = new ProgramParameter(charConverter.stringToByteArray(system_, pathName_.toQualifiedObjectName())); - // Database member name: - String memberName = pathName_.getMemberName(); - if (memberName.length() == 0) - { - memberName = "*FIRST"; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Defaulting to member *FIRST", pathName_.getPath()); - } - parameterList[4] = new ProgramParameter(new AS400Text(10).toBytes(memberName)); - // Override processing: (1 == "overrides are processed") - parameterList[5] = new ProgramParameter(charConverter.stringToByteArray(system_, "1")); - // Error code: - parameterList[6] = new ErrorCodeParameter(); - - return parameterList; - } - - - // Returns the offset of the specified field, in the MBRD* structures. - private static final int offsetOf(int attribute) - { - switch (attribute) - { - // Fields in format MBRD0100: - case FILE_NAME: return 8; - case LIBRARY_NAME: return 18; - case MEMBER_NAME: return 28; - case FILE_ATTRIBUTE: return 38; - case SOURCE_TYPE: return 48; - case CREATION_DATE_TIME: return 58; - case LAST_SOURCE_CHANGE_DATE: return 71; - case MEMBER_TEXT_DESCRIPTION: return 84; - case SOURCE_FILE: return 134; - - // Additional fields in format MBRD0200: - case REMOTE_FILE: return 135; - case LOGICAL_FILE: return 136; - case ODP_SHARING: return 137; - case CURRENT_NUMBER_OF_RECORDS: return 140; - // offset 144: number of deleted records - case DATA_SPACE_SIZE: return 148; - case ACCESS_PATH_SIZE: return 152; - case NUMBER_OF_BASED_ON_PHYICAL_FILE_MEMBERS: return 156; - case CHANGE_DATE_AND_TIME: return 160; - case SAVE_DATE_AND_TIME: return 173; - case RESTORE_DATE_AND_TIME: return 186; - case EXPIRATION_DATE: return 199; - // offset 206: reserved - case NUMBER_OF_DAYS_USED: return 212; - case DATE_LAST_USED: return 216; - case USE_RESET_DATE : return 223; - // offset 230: reserved - case DATA_SPACE_SIZE_MULTIPLIER: return 232; - case ACCESS_PATH_SIZE_MULTIPLIER: return 236; - case MEMBER_TEXT_DESCRIPTION_CCSID: return 240; - case NUMBER_OF_DELETED_RECORDS: return 256; - - // Additional fields in format MBRD0300: - case JOIN_MEMBER: return 266; - case ACCESS_PATH_MAINTENANCE: return 267; - case SQL_FILE_TYPE: return 268; - // offset 278: reserved - case ALLOW_READ_OPERATION: return 279; - case ALLOW_WRITE_OPERATION: return 280; - case ALLOW_UPDATE_OPERATION: return 281; - case ALLOW_DELETE_OPERATION: return 282; - // offset 283: reserved - case RECORDS_TO_FORCE_A_WRITE: return 284; - case MAXIMUM_PERCENT_DELETED_RECORDS_ALLOWED: return 288; - case INITIAL_NUMBER_OF_RECORDS: return 292; - case INCREMENT_NUMBER_OF_RECORDS: return 296; - case MAXIMUM_NUMBER_OF_INCREMENTS: return 300; - case CURRENT_NUMBER_OF_INCREMENTS: return 304; - case RECORD_CAPACITY: return 308; - case RECORD_FORMAT_SELECTOR_PROGRAM_NAME: return 312; - case RECORD_FORMAT_SELECTOR_LIBRARY_NAME: return 322; - - default: - Trace.log(Trace.ERROR, "Unrecognized attribute key:", attribute); - throw new InternalErrorException(InternalErrorException.UNKNOWN, attribute); - } - } - - - /** - * Reads all available information from the output (receiver) bytes regardless of the attribute to - * be retrieved. The attribute to be retrieved determines in which content and format the data is sent. - * - * @param entryBytes Raw bytes of the entry - * @param format Content and format name - * - * @throws UnsupportedEncodingException If the ccsid is not supported. - */ - private void readMemberInfo(byte[] entryBytes, String format) - throws UnsupportedEncodingException - { - final CharConverter charConverter = new CharConverter(system_.getCcsid(), system_); - - - // Fields returned in all formats: - - setAttribute(FILE_NAME, - charConverter.byteArrayToString(entryBytes, offsetOf(FILE_NAME), 10).trim()); - setAttribute(LIBRARY_NAME, - charConverter.byteArrayToString(entryBytes, offsetOf(LIBRARY_NAME), 10).trim()); - setAttribute(FILE_ATTRIBUTE, - charConverter.byteArrayToString(entryBytes, offsetOf(FILE_ATTRIBUTE), 10).trim()); - setAttribute(MEMBER_NAME, - charConverter.byteArrayToString(entryBytes, offsetOf(MEMBER_NAME), 10).trim()); - setAttribute(SOURCE_TYPE, - charConverter.byteArrayToString(entryBytes, offsetOf(SOURCE_TYPE), 10).trim()); - setAttribute(MEMBER_TEXT_DESCRIPTION, - charConverter.byteArrayToString(entryBytes, offsetOf(MEMBER_TEXT_DESCRIPTION), 50).trim()); - setAttribute(LAST_SOURCE_CHANGE_DATE, // Note: This field can contain hex zeros. - transformDate(charConverter.byteArrayToString(entryBytes, offsetOf(LAST_SOURCE_CHANGE_DATE), 13))); - setAttribute(CREATION_DATE_TIME, - transformDate(charConverter.byteArrayToString(entryBytes, offsetOf(CREATION_DATE_TIME), 13))); - setAttribute(SOURCE_FILE, - transformBoolean(charConverter.byteArrayToString(entryBytes, offsetOf(SOURCE_FILE), 1))); - - - // Fields returned in both formats 200 and 300: - if (format != QUSRMBRD_FORMAT_100) - { - setAttribute(REMOTE_FILE, - transformBoolean(charConverter.byteArrayToString(entryBytes, offsetOf(REMOTE_FILE), 1))); - setAttribute(LOGICAL_FILE, - transformBoolean(charConverter.byteArrayToString(entryBytes, offsetOf(LOGICAL_FILE), 1))); - setAttribute(CURRENT_NUMBER_OF_RECORDS, - new Integer(intConverter_.toInt(entryBytes, offsetOf(CURRENT_NUMBER_OF_RECORDS)))); - setAttribute(ODP_SHARING, - transformBoolean(charConverter.byteArrayToString(entryBytes, offsetOf(ODP_SHARING), 1))); - setAttribute(DATA_SPACE_SIZE, - new Integer(intConverter_.toInt(entryBytes, offsetOf(DATA_SPACE_SIZE)))); - setAttribute(ACCESS_PATH_SIZE, - new Integer(intConverter_.toInt(entryBytes, offsetOf(ACCESS_PATH_SIZE)))); - setAttribute(NUMBER_OF_BASED_ON_PHYICAL_FILE_MEMBERS, - new Integer(intConverter_.toInt(entryBytes, offsetOf(NUMBER_OF_BASED_ON_PHYICAL_FILE_MEMBERS)))); - setAttribute(CHANGE_DATE_AND_TIME, - transformDate(charConverter.byteArrayToString(entryBytes, offsetOf(CHANGE_DATE_AND_TIME), 13))); - setAttribute(RESTORE_DATE_AND_TIME, - transformDate(charConverter.byteArrayToString(entryBytes, offsetOf(RESTORE_DATE_AND_TIME), 13))); - setAttribute(SAVE_DATE_AND_TIME, - transformDate(charConverter.byteArrayToString(entryBytes, offsetOf(SAVE_DATE_AND_TIME), 13))); - setAttribute(EXPIRATION_DATE, - transformDate(charConverter.byteArrayToString(entryBytes, offsetOf(EXPIRATION_DATE), 13))); - setAttribute(NUMBER_OF_DAYS_USED, - new Integer(intConverter_.toInt(entryBytes, offsetOf(NUMBER_OF_DAYS_USED)))); - setAttribute(DATE_LAST_USED, - transformDate(charConverter.byteArrayToString(entryBytes, offsetOf(DATE_LAST_USED), 13))); - setAttribute(USE_RESET_DATE, - transformDate(charConverter.byteArrayToString(entryBytes, offsetOf(USE_RESET_DATE), 13))); - setAttribute(DATA_SPACE_SIZE_MULTIPLIER, - new Integer(intConverter_.toInt(entryBytes, offsetOf(DATA_SPACE_SIZE_MULTIPLIER)))); - setAttribute(ACCESS_PATH_SIZE_MULTIPLIER, - new Integer(intConverter_.toInt(entryBytes, offsetOf(ACCESS_PATH_SIZE_MULTIPLIER)))); - setAttribute(MEMBER_TEXT_DESCRIPTION_CCSID, - new Integer(intConverter_.toInt(entryBytes, offsetOf(MEMBER_TEXT_DESCRIPTION_CCSID)))); - setAttribute(NUMBER_OF_DELETED_RECORDS, - new Integer(intConverter_.toInt(entryBytes, offsetOf(NUMBER_OF_DELETED_RECORDS)))); - } - - // Fields returned only in format 300: - if (QUSRMBRD_FORMAT_300.equals(format)) - { - setAttribute(JOIN_MEMBER, - transformBoolean(charConverter.byteArrayToString(entryBytes, offsetOf(JOIN_MEMBER), 1))); - setAttribute(ACCESS_PATH_MAINTENANCE, - charConverter.byteArrayToString(entryBytes, offsetOf(ACCESS_PATH_MAINTENANCE), 1)); - setAttribute(SQL_FILE_TYPE, - charConverter.byteArrayToString(entryBytes, offsetOf(SQL_FILE_TYPE), 10).trim()); - setAttribute(ALLOW_READ_OPERATION, - transformBoolean(charConverter.byteArrayToString(entryBytes, offsetOf(ALLOW_READ_OPERATION), 1))); - setAttribute(ALLOW_WRITE_OPERATION, - transformBoolean(charConverter.byteArrayToString(entryBytes, offsetOf(ALLOW_WRITE_OPERATION), 1))); - setAttribute(ALLOW_UPDATE_OPERATION, - transformBoolean(charConverter.byteArrayToString(entryBytes, offsetOf(ALLOW_UPDATE_OPERATION), 1))); - setAttribute(ALLOW_DELETE_OPERATION, - transformBoolean(charConverter.byteArrayToString(entryBytes, offsetOf(ALLOW_DELETE_OPERATION), 1))); - setAttribute(RECORDS_TO_FORCE_A_WRITE, - new Integer(intConverter_.toInt(entryBytes, offsetOf(RECORDS_TO_FORCE_A_WRITE)))); - setAttribute(MAXIMUM_PERCENT_DELETED_RECORDS_ALLOWED, - new Integer(intConverter_.toInt(entryBytes, offsetOf(MAXIMUM_PERCENT_DELETED_RECORDS_ALLOWED)))); - setAttribute(INITIAL_NUMBER_OF_RECORDS, - new Integer(intConverter_.toInt(entryBytes, offsetOf(INITIAL_NUMBER_OF_RECORDS)))); - setAttribute(INCREMENT_NUMBER_OF_RECORDS, - new Integer(intConverter_.toInt(entryBytes, offsetOf(INCREMENT_NUMBER_OF_RECORDS)))); - setAttribute(MAXIMUM_NUMBER_OF_INCREMENTS, - new Integer(intConverter_.toInt(entryBytes, offsetOf(MAXIMUM_NUMBER_OF_INCREMENTS)))); - setAttribute(CURRENT_NUMBER_OF_INCREMENTS, - new Integer(intConverter_.toInt(entryBytes, offsetOf(CURRENT_NUMBER_OF_INCREMENTS)))); - setAttribute(RECORD_CAPACITY, - new Integer(intConverter_.toInt(entryBytes, offsetOf(RECORD_CAPACITY)))); - setAttribute(RECORD_FORMAT_SELECTOR_PROGRAM_NAME, - charConverter.byteArrayToString(entryBytes, offsetOf(RECORD_FORMAT_SELECTOR_PROGRAM_NAME), 10).trim()); - setAttribute(RECORD_FORMAT_SELECTOR_LIBRARY_NAME, - charConverter.byteArrayToString(entryBytes, offsetOf(RECORD_FORMAT_SELECTOR_LIBRARY_NAME), 10).trim()); - } - } - - /** - * Parses the date string which should be in the format CYYMMDDHHMMSS or CYYMMDD; - * - * @param dateString Date string - * - * @return Date object representing the passed date string or null if the - * date string is null, empty or not parseable. - */ - private Date transformDate(String dateString) - { - Date retVal = null; - - if (dateString == null) - { - // nothing => returns null - } - else - { - dateString = dateString.trim(); - if (dateString.length() == 0) - { - // nothing => returns null - } - else - { - try - { - if (dateString.length() == 13) - { - synchronized(dateTimeFormat_) - { - retVal = dateTimeFormat_.parse(dateString.substring(1)); // skip the century digit - } - } - else if (dateString.length() == 7) - { - synchronized(dateFormat_) - { - retVal = dateFormat_.parse(dateString.substring(1)); // skip the century digit - } - } - else - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Date string has unrecognized format:", dateString); - } - } - catch(ParseException pe) { // return null - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Ignored error while parsing date string: " + dateString, pe); - } - } - } - - return retVal; - } - - /** - * Transforms the value of 1 to true and everything else to false. - * - * @param value - * @return Boolean object representing 1 as true and everything else as false - */ - private Boolean transformBoolean(String value) - { - // Assume that the caller has verified that the argument is non-null. - if (value.equals("1")) { - return Boolean.TRUE; - } - else { - return Boolean.FALSE; - } - } - - /** - * Returns the IFS path of this member. - * - * @return IFS path to this member. - */ - public String getPath() - { - return pathName_.getPath(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/MemberList.java b/cvsroot/src/com/ibm/as400/access/MemberList.java deleted file mode 100644 index 9318e5873..000000000 --- a/cvsroot/src/com/ibm/as400/access/MemberList.java +++ /dev/null @@ -1,492 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MemberList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2009-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -/** - * Represents a list of database file members. - *

    - * Implementation note: This class internally calls the "List Database File Members" API (QUSLMBR). - * Information from formats MBRL0100 and MBRL0200 is retrieved. - * - *

    - * This class is mostly based on a prototype contributed by Mihael Schmidt. - * - * @see MemberDescription - * @see AS400File - */ -public class MemberList -{ - private static final SimpleDateFormat dateTimeFormat_ = new SimpleDateFormat("yyMMddHHmmss"); - - private static final String QUSLMBR_FORMAT_100 = "MBRL0100"; - private static final String QUSLMBR_FORMAT_200 = "MBRL0200"; - - private static final QSYSObjectPathName USERSPACE_PATH = new QSYSObjectPathName("QTEMP", "JT4QUSLMBR", "USRSPC"); // user space QTEMP/JT4QUSLMBR - - - private AS400 system_; - private QSYSObjectPathName path_; - private String memberSelection_ = "*ALL"; // default: all members - private final Map memberDescriptions_ = new HashMap(); - private final List attributes_ = new ArrayList(); - - // Offsets for format MBRL0200, "List Data Section", of API QUSLMBR. - private static final int OFFSET_MEMBER_NAME = 0; - private static final int OFFSET_SOURCE_TYPE = 10; - private static final int OFFSET_CREATION_DATE_TIME = 20; - private static final int OFFSET_LAST_SOURCE_CHANGE_DATE = 33; - private static final int OFFSET_MEMBER_TEXT_DESCRIPTION = 46; - private static final int OFFSET_MEMBER_TEXT_DESCRIPTION_CCSID = 96; - - private final AS400Bin4 intConverter_ = new AS400Bin4(); - - /** - * Constructs a MemberList object. - * - * @param file A database file. - */ - public MemberList(AS400File file) - { - if (file == null) throw new NullPointerException("file"); - - system_ = file.getSystem(); - path_ = new QSYSObjectPathName(file.getLibraryName(), file.getFileName(), "FILE"); - - String memberName = file.getMemberName(); - if (memberName == null || memberName.length() == 0) - { - // default to *ALL - } - else if (memberName.startsWith("*")) // *FIRST, *LAST, etc. - { - // The "member name" parameter of the QUSLMBR API must be either: - // - a specific member name; - // - a generic member name (a wildcarded name pattern); or - // - special value *ALL, indicating "all members". - memberSelection_ = "*ALL"; // force it to *ALL - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "Setting member selection to *ALL. Member name from AS400File object:", memberName); - } - } - else - { - memberSelection_ = memberName; - } - } - - /** - * Constructs a MemberList object. - * - * Note: Generic names are only supported for the 'member' part of the IFS path. - * To retrieve all members, the IFS path should point to the database file. - * - * @param system AS400 system object. - * @param path IFS path to the database file or member. - */ - public MemberList(AS400 system, QSYSObjectPathName path) - { - if (system == null) throw new NullPointerException("system"); - if (path == null) throw new NullPointerException("path"); - - system_ = system; - path_ = path; - - String memberName = path_.getMemberName(); - if (memberName == null || memberName.length() == 0) - { - memberSelection_ = "*ALL"; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting member selection to *ALL. Member name from QSYSObjectPathName object is: " + memberName); - } - else - { - memberSelection_ = memberName; - } - } - - /** - * Constructs a MemberList object. - * - * @param system AS400 system object - * @param libraryName Library where the physical file is located. - * @param objectName The name of the physical file. - */ - public MemberList(AS400 system, String libraryName, String objectName) - { - this(system, new QSYSObjectPathName(libraryName, objectName, "FILE")); - } - - - /** - * Determine the format to use on the API call, depending on the attribute. - * - * @param attribute Attribute to be retrieved - * @return format string - */ - private String lookupFormat(int attribute) - { - String format; - - switch (attribute) - { - case MemberDescription.MEMBER_NAME: - format = QUSLMBR_FORMAT_100; - break; - - case MemberDescription.SOURCE_TYPE: - case MemberDescription.CREATION_DATE_TIME: - case MemberDescription.LAST_SOURCE_CHANGE_DATE: - case MemberDescription.MEMBER_TEXT_DESCRIPTION: - case MemberDescription.MEMBER_TEXT_DESCRIPTION_CCSID: - format = QUSLMBR_FORMAT_200; - break; - - default: - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Unrecognized attribute key:", attribute); - format = QUSLMBR_FORMAT_200; - } - - return format; - } - - /** - * Removes all member descriptions from this object. - */ - public void clear() - { - memberDescriptions_.clear(); - } - - /** - * Clears the attribute list which specifies which attributes should be retrieved. - */ - public void clearAttributeList() - { - attributes_.clear(); - } - - /** - * Adds an attribute to the attribute list which specifies which attributes of the member - * are to be retrieved. Constants that specify attributes are available in class {@link MemberDescription MemberDescription}. - * - * @param attribute The attribute to be added. - */ - public void addAttribute(int attribute) - { - attributes_.add(new Integer(attribute)); - } - - /** - * Reloads all member descriptions that have been specified via {@link #addAttribute addAttribute()}. - * - * @throws ObjectDoesNotExistException If a system object necessary for the call does not exist on the system. - * @throws InterruptedException If this thread is interrupted. - * @throws IOException If an error occurs while communicating with the system. - * @throws ErrorCompletingRequestException If an error occurs before the request is completed. - * @throws AS400SecurityException If a security or authority error occurs. - */ - public void refresh() - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, - IOException, ObjectDoesNotExistException - { - clear(); - load(); - } - - /** - * Loads all members from the specified file(s). - * - * @throws ObjectDoesNotExistException If an object necessary for the call does not exist on the system. - * @throws InterruptedException If this thread is interrupted. - * @throws IOException If an error occurs while communicating with the system. - * @throws ErrorCompletingRequestException If an error occurs before the request is completed. - * @throws AS400SecurityException If a security or authority error occurs. - * @throws AS400Exception If the program on the server sends an escape message. - */ - public void load() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, - IOException, InterruptedException, ObjectDoesNotExistException - { - ProgramCall program = new ProgramCall(system_, "/QSYS.LIB/QUSLMBR.PGM", buildProgramParameters(getFormat())); // this API is not threadsafe - - // Determine the needed scope of synchronization. - Object lockObject; - boolean willRunProgramsOnThread = program.isStayOnThread(); - if (willRunProgramsOnThread) { - // The calls will run in the job of the JVM, so lock for entire JVM. - lockObject = USERSPACE_PATH; - } - else { - // The calls will run in the job of the Remote Command Host Server, so lock on the connection. - lockObject = system_; - } - - synchronized (lockObject) - { - // Create a user space in QTEMP to receive output from program call. - UserSpace us = new UserSpace(system_, USERSPACE_PATH.getPath()); - us.setMustUseProgramCall(true); - if (!willRunProgramsOnThread) - { - us.setMustUseSockets(true); - // Force the use of sockets when running natively but not on-thread. - // We have to do it this way since UserSpace will otherwise make a native ProgramCall, and will use a different QTEMP library than that used by the host server. - } - - try - { - us.create(65535, true, "JT400", (byte) 0x00, "Userspace for loading members","*ALL"); // set public authority to *ALL - - if (!program.run()) { - throw new AS400Exception(program.getMessageList()); - } - - byte[] usBuf = new byte[65535]; // local buffer to hold bytes read from user space - - // Read the "generic header" from the user space, into the local buffer. - // Note: For description of general layout of the "list API" headers, see: - // http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/apiref/listGeneral.htm - int numBytesRead = us.read(usBuf, 0, 0, 0x90); // just read the needed header fields - if (numBytesRead < 0x90) // verify that we at least got a header, up through "CCSID" field - { - Trace.log(Trace.ERROR, "Failed to read the generic header. Number of bytes read: " + numBytesRead); - throw new InternalErrorException(InternalErrorException.UNKNOWN, numBytesRead); - } - - // Parse the header, to get the offsets to the various sections. - - // (Generic header) Offset to header section: - int offsetToHeaderSection = BinaryConverter.byteArrayToInt(usBuf, 0x74); - - // (Generic header) Header section size: - int headerSectionSize = BinaryConverter.byteArrayToInt(usBuf, 0x78); - - // (Generic header) Offset to list data section: - int offsetToListDataSection = BinaryConverter.byteArrayToInt(usBuf, 0x7C); - - // (Generic header) List data section size: - int listDataSectionSize = BinaryConverter.byteArrayToInt(usBuf, 0x80); - - // (Generic header) Number of list entries: - int numberOfListEntries = BinaryConverter.byteArrayToInt(usBuf, 0x84); - - // (Generic header) Size of each entry: - int sizeOfEachEntry = BinaryConverter.byteArrayToInt(usBuf, 0x88); - - // (Generic header) CCSID of data in the user space - int entryCCSID = BinaryConverter.byteArrayToInt(usBuf, 0x8C); - - // (Generic header) Subsetted list indicator: - //String subsettedListIndicator = conv.byteArrayToString(usBuf, 0x95, 1); - - if (entryCCSID == 0) entryCCSID = system_.getCcsid(); - // From the API spec: "The coded character set ID for data in the list entries. If 0, then the data is not associated with a specific CCSID and should be treated as hexadecimal data." - - final CharConverter conv = new CharConverter(entryCCSID); - - // Read the "header section" into the local buffer. - numBytesRead = us.read(usBuf, offsetToHeaderSection, 0, headerSectionSize); - if (numBytesRead < headerSectionSize) - { - Trace.log(Trace.ERROR, "Failed to read the header section. Number of bytes read: " + numBytesRead); - throw new InternalErrorException(InternalErrorException.UNKNOWN, numBytesRead); - } - - // (Header section) File library name used: - final String libraryNameUsed = conv.byteArrayToString(usBuf, 10, 10).trim(); - - // Read the "list data section" into the local buffer. - if (listDataSectionSize > usBuf.length) { - usBuf = new byte[listDataSectionSize+1]; // allocate a larger buffer - } - numBytesRead = us.read(usBuf, offsetToListDataSection, 0, listDataSectionSize); - if (numBytesRead < listDataSectionSize) - { - Trace.log(Trace.ERROR, "Failed to read the list data section. Number of bytes read: " + numBytesRead); - throw new InternalErrorException(InternalErrorException.UNKNOWN, numBytesRead); - } - - // Parse the list data returned in the user space. - String format = getFormat(); - for (int i = 0; i < numberOfListEntries; i++) - { - byte[] entryBuf = new byte[sizeOfEachEntry]; - System.arraycopy(usBuf, i * sizeOfEachEntry, entryBuf, 0, sizeOfEachEntry); - readMemberInfoFromUserspaceEntry(entryBuf, format, conv, libraryNameUsed); - } - } - - finally { - // Delete the temporary user space, to allow other threads to re-create and use it. - try { us.delete(); } - catch (Exception e) { - Trace.log(Trace.ERROR, "Exception while deleting temporary user space", e); - } - } - } - - } - - /** - * Builds the program parameter list for a program call to QUSLMBR (List Database File Members). - * - * @return Program parameter list for QUSLMBR - */ - private ProgramParameter[] buildProgramParameters(String format) - throws UnsupportedEncodingException - { - final CharConverter conv = new CharConverter(system_.getCcsid(), system_); - - ProgramParameter[] parameterList = new ProgramParameter[6]; - - // Qualified user space name: - parameterList[0] = new ProgramParameter(conv.stringToByteArray(system_, USERSPACE_PATH.toQualifiedObjectName())); - // Format name: - parameterList[1] = new ProgramParameter(conv.stringToByteArray(system_, format)); - // Qualified database file name: - parameterList[2] = new ProgramParameter(conv.stringToByteArray(system_, path_.toQualifiedObjectName())); - // Member name: - parameterList[3] = new ProgramParameter(new AS400Text(10).toBytes(memberSelection_)); - // Override processing: (1 == "overrides are processed") - parameterList[4] = new ProgramParameter(conv.stringToByteArray(system_, "1")); - // Error code: - parameterList[5] = new ErrorCodeParameter(); - - return parameterList; - } - - /** - * Reads all available information from the userspace entry regardless of the attributes to - * be retrieved. The attributes to be retrieved determines in which format the entry is in the - * userspace. - * - * @param entryBuf Raw bytes of the entry - * @param format Content and format name (f. e. MBRL0100, see {@link #getFormat() getFormat()} - * @param charConverter CharConverter object used for translating bytes to String - * @param usedLibraryName The resolved library name used for the API call. - * - */ - private void readMemberInfoFromUserspaceEntry(byte[] entryBuf, String format, CharConverter charConverter, String usedLibraryName) - { - String memberName = charConverter.byteArrayToString(entryBuf, OFFSET_MEMBER_NAME, 10).trim(); - - // get existing member description or create a new one - MemberDescription memberDescription = (MemberDescription) memberDescriptions_.get(memberName); - if (memberDescription == null) - { - QSYSObjectPathName memberPath = new QSYSObjectPathName(path_.getPath()); - try { - memberPath.setMemberName(memberName); - memberPath.setLibraryName(usedLibraryName); - } - catch (java.beans.PropertyVetoException pve) { // will never happen - Trace.log(Trace.ERROR, "Error ignored.", pve); - } - memberDescription = new MemberDescription(system_, memberPath); - memberDescription.setAttribute(MemberDescription.MEMBER_NAME, memberName); - memberDescriptions_.put(memberName, memberDescription); - } - - if (QUSLMBR_FORMAT_200.equals(format) ) - { - memberDescription.setAttribute(MemberDescription.SOURCE_TYPE, - charConverter.byteArrayToString(entryBuf, OFFSET_SOURCE_TYPE, 10).trim()); - memberDescription.setAttribute(MemberDescription.MEMBER_TEXT_DESCRIPTION, - charConverter.byteArrayToString(entryBuf, OFFSET_MEMBER_TEXT_DESCRIPTION, 50).trim()); - memberDescription.setAttribute(MemberDescription.MEMBER_TEXT_DESCRIPTION_CCSID, - new Integer(intConverter_.toInt(entryBuf, OFFSET_MEMBER_TEXT_DESCRIPTION_CCSID))); - memberDescription.setAttribute(MemberDescription.LAST_SOURCE_CHANGE_DATE, - transformDate(charConverter.byteArrayToString(entryBuf, OFFSET_LAST_SOURCE_CHANGE_DATE, 13))); - memberDescription.setAttribute(MemberDescription.CREATION_DATE_TIME, - transformDate(charConverter.byteArrayToString(entryBuf, OFFSET_CREATION_DATE_TIME, 13))); - } - } - - /** - * Returns an array of retrieved member descriptions. If no member descriptions could be - * retrieved because there are no members or because of an error, an empty array is returned. - * If no members has been retrieved yet due to no call to load(), then an empty array is - * returned. - * - * @return Array of retrieved member descriptions - */ - public MemberDescription[] getMemberDescriptions() - { - return (MemberDescription[]) memberDescriptions_.values().toArray(new MemberDescription[memberDescriptions_.size()]); - } - - /** - * Returns the format for the call to QUSLMBR depending on the attributes to be retrieved. - * - * @return format name (either MBRL0100 or MBRL0200 for now) - */ - private String getFormat() - { - String format = QUSLMBR_FORMAT_100; - - for (Iterator iter = attributes_.iterator(); iter.hasNext(); ) - { - String tmpFormat = lookupFormat(((Integer) iter.next()).intValue()); - if (format.compareTo(tmpFormat) < 0) - { - format = tmpFormat; - } - } - - return format; - } - - /** - * Parses the date string, which should be in the format CYYMMDDHHMMSS. - * - * @param dateString Date string - * - * @return Date object representing the passed date string, or null if the - * date string is null, empty or not parseable. - */ - private Date transformDate(String dateString) - { - Date retVal = null; - - if (dateString == null || dateString.length() == 0) - { - // nothing => returns null - } - else - { - try { - synchronized (dateTimeFormat_) // date formats are not synchronized - { - retVal = dateTimeFormat_.parse(dateString.substring(1)); - } - } - catch(ParseException pe) { // return null - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Ignored error while parsing date string: " + dateString, pe); - } - } - - return retVal; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/MessageDialog.java b/cvsroot/src/com/ibm/as400/access/MessageDialog.java deleted file mode 100644 index ee30c896d..000000000 --- a/cvsroot/src/com/ibm/as400/access/MessageDialog.java +++ /dev/null @@ -1,143 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: MessageDialog.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Button; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dialog; -import java.awt.FlowLayout; -import java.awt.Frame; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import java.awt.Insets; -import java.awt.Label; -import java.awt.Panel; -import java.util.StringTokenizer; - -// This class represents a dialog window that is used to display a message and optionally allow a choice to be made by the user. -class MessageDialog extends Dialog -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - private Button positiveButton_ = null; // Push button for OK or Yes. - private Button negativeButton_ = null; // Push button for No. - private AS400SignonDialogAdapter listener_ = null; - - // Construct a message dialog that displays a message and one or two pushbuttons. - // @param parent The parent Window. - // @param messageText The message to display. - // @param titleText The window title text. - // @param allowChoice true for yes & no buttons, false for OK button. - MessageDialog(Frame parent, String messageText, String titleText, boolean allowChoice) - { - // Create a frame. - super(parent, titleText, true); - - listener_ = new AS400SignonDialogAdapter(this); - - // Create a GridBagLayout manager having three rows and four columns. - GridBagLayout layout = new GridBagLayout(); - GridBagConstraints constraints = new GridBagConstraints(); - constraints.fill = GridBagConstraints.BOTH; - constraints.insets = new Insets(8, 8, 0, 8); - setLayout(layout); - - setResizable(false); - - // Set the background color to light gray. - setBackground(Color.lightGray); - - // Note: Labels can't display multiple lines. This is we use a Panel. - Panel panel = new Panel(); - StringTokenizer tokenizer = new StringTokenizer(messageText, "\n"); - panel.setLayout(new GridLayout(tokenizer.countTokens(), 1)); - while(tokenizer.hasMoreTokens()) - { - panel.add(new Label(tokenizer.nextToken())); - } - add(panel, layout, constraints, 0, 0, 1, 1); - - // Create panels to hold the buttons of the specified button layout. - Panel centeringPanel = new Panel(); - centeringPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); - constraints.insets = new Insets(8, 8, 8, 8); - add(centeringPanel, layout, constraints, 0, 1, 1, 1); - Panel buttonPanel = new Panel(); - buttonPanel.setLayout(new GridLayout(1, 2, 8, 0)); - centeringPanel.add(buttonPanel); - - // Add the buttons to the panel. Add event listeners to the buttons. - if (allowChoice) - { - positiveButton_ = new Button(ResourceBundleLoader.getText("DLG_YES_BUTTON")); - positiveButton_.addActionListener(listener_); - positiveButton_.addFocusListener(listener_); - positiveButton_.addKeyListener(listener_); - buttonPanel.add(positiveButton_); - negativeButton_ = new Button(ResourceBundleLoader.getText("DLG_NO_BUTTON")); - negativeButton_.addActionListener(listener_); - negativeButton_.addFocusListener(listener_); - negativeButton_.addKeyListener(listener_); - buttonPanel.add(negativeButton_); - } - else - { - positiveButton_ = new Button(ResourceBundleLoader.getCoreText("DLG_OK_BUTTON")); - positiveButton_.addActionListener(listener_); - positiveButton_.addFocusListener(listener_); - positiveButton_.addKeyListener(listener_); - buttonPanel.add(positiveButton_); - } - - // Arrange the components in the dialog. - pack(); - - // Add a listener for window events. - addWindowListener(listener_); - } - - // Display the dialog and wait for user response. - // @return true if user pressed OK or Yes; false if user pressed No. - boolean display() - { - // Set focus on the default button. - listener_.setFocalPoint(positiveButton_); - - // Make the window visible. The call to show() will block the current thread until we hide or dispose of this dialog. - show(); - - return listener_.getFocalPoint() != negativeButton_; - } - - // This methods adds a user interface component to the specified GridBagLayout manager using the specified constraints. - // @param component The user interface component to add. - // @param layout The GridBagLayout manager. - // @param constraints The constraints for the component. - // @param x The x coordinate of the leftmost cell of the component. - // @param y The y coordinate of the topmost cell of the component. - // @param width The horizontal measurement of the component in cells. - // @param height The vertical measurement of the component in cells. - protected void add(Component component, GridBagLayout layout, GridBagConstraints constraints, int x, int y, int width, int height) - { - constraints.gridx = x; - constraints.gridy = y; - constraints.gridwidth = width; - constraints.gridheight = height; - layout.setConstraints(component, constraints); - add(component); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/MessageFBDataFormat.java b/cvsroot/src/com/ibm/as400/access/MessageFBDataFormat.java deleted file mode 100644 index b5236adf3..000000000 --- a/cvsroot/src/com/ibm/as400/access/MessageFBDataFormat.java +++ /dev/null @@ -1,44 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: MessageFBDataFormat.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; //@C1A -import java.util.Vector; //@C1A - - -// Class to handle the common message feedback data structure. -class MessageFBDataFormat extends RecordFormat -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - MessageFBDataFormat(int ccsid) - { - super(); - - addFieldDescription(new HexFieldDescription(new AS400ByteArray(8), "notUsed1")); - addFieldDescription(new BinaryFieldDescription(new AS400Bin4(), "severityCode")); - addFieldDescription(new CharacterFieldDescription(new AS400Text(7), "messageID")); - addFieldDescription(new CharacterFieldDescription(new AS400Text(2), "messageType")); - addFieldDescription(new HexFieldDescription(new AS400ByteArray(59), "notUsed2")); - addFieldDescription(new BinaryFieldDescription(new AS400Bin4(), "replacementTextLength")); - addFieldDescription(new HexFieldDescription(new AS400ByteArray(4), "notUsed3")); - addFieldDescription(new BinaryFieldDescription(new AS400Bin4(), "messageTextLength")); - addFieldDescription(new HexFieldDescription(new AS400ByteArray(20), "notUsed4")); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/MessageFBFormat.java b/cvsroot/src/com/ibm/as400/access/MessageFBFormat.java deleted file mode 100644 index cacbcca21..000000000 --- a/cvsroot/src/com/ibm/as400/access/MessageFBFormat.java +++ /dev/null @@ -1,47 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: MessageFBFormat.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; //@C1A -import java.util.Vector; //@C1A - - - - -// Class to handle the common message feedback 'header'. -class MessageFBFormat extends RecordFormat -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - MessageFBFormat() - { - super(); - - addFieldDescription(new BinaryFieldDescription(new AS400Bin2(), - "messagesOccurred")); - addFieldDescription(new BinaryFieldDescription(new AS400Bin2(), - "numberOfMessages")); - addFieldDescription(new BinaryFieldDescription(new AS400Bin2(), - "maximumMessages")); - addFieldDescription(new BinaryFieldDescription(new AS400Bin2(), - "exceptionOccurred")); - addFieldDescription(new ArrayFieldDescription(new AS400Array(new AS400ByteArray(10240), 1), "feedbackData")); - setLengthDependency("feedbackData", "numberOfMessages"); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/MessageFile.java b/cvsroot/src/com/ibm/as400/access/MessageFile.java deleted file mode 100644 index 83fadfe8c..000000000 --- a/cvsroot/src/com/ibm/as400/access/MessageFile.java +++ /dev/null @@ -1,862 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MessageFile.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.Serializable; -import java.text.DateFormat; //@C1A -import java.text.ParseException; //@C1A -import java.text.SimpleDateFormat; //@C1A -import java.util.Date; //@C1A - -/** - Represents a message file object on the system. This class allows a user to get a message from a message file, returning an AS400Message object which contains the message. The calling program can optionally supply substitution text for the message. -

    MessageFile will optionally format the message's associated help text. Three options are available for help text formatting: -

      -
    1. No formatting - the help text is returned as a string of characters. This is the default. -
    2. Include formatting characters - the help text contains formatting characters. The formatting characters are: -
        -
      • &N -- Force a new line. -
      • &P -- Force a new line and indent the new line six characters. -
      • &B -- Force a new line and indent the new line four characters. -
      -
    3. Substitute formatting characters - the MessageFile class replaces system formatting characters with newline and space characters. -
    - The difference between options 2 and 3 are with line wrapping. If the formatting characters remain the application can handle line wrapping and indentation. If the MessageFile class inserts newline and space characters, Java components will handle line wrapping. -

    Note: To return formatting characters, you must call {@link #setHelpTextFormatting setHelpTextFormatting} prior to calling any of the getMessage() methods. -

    For example, to retrieve and print a message: -

    - AS400 system = new AS400("mysystem.mycompany.com");
    - MessageFile messageFile = new MessageFile(system);
    - messageFile.setPath("/QSYS.LIB/QCPFMSG.MSGF");
    - AS400Message message = messageFile.getMessage("CPD0170");
    - System.out.println(message.getText());
    - 
    -

    You can also sequentially retrieve messages from a message file by using the {@link #FIRST FIRST} and {@link #NEXT NEXT} message id values. -

    - AS400Message msg = messageFile.getMessage(MessageFile.FIRST);
    -
    - while (msg != null) {
    -    System.out.println(msg.getID() + " = " + msg.getText());
    -    msg = messageFile.getMessage(MessageFile.NEXT);
    - }
    -
    - @see AS400Message - @see CommandCall - @see ProgramCall - @see QSYSObjectPathName - **/ -public class MessageFile implements Serializable -{ - static final long serialVersionUID = 4L; - - /** - * Date formatter to convert create & modification dates - */ - // @C1A - private static final DateFormat YYYYMMDD_FORMAT = new SimpleDateFormat("yyyyMMdd"); - - /** - Constant indicating help text should not be formatted. - **/ - public static final int NO_FORMATTING = 0; - - /** - Constant indicating formatting characters are left in the help text. - **/ - public static final int RETURN_FORMATTING_CHARACTERS = 1; - - /** - Constant indicating MessageFile should replace formatting characters with newline and space characters. - **/ - public static final int SUBSTITUTE_FORMATTING_CHARACTERS = 2; - - /** - Constant indicating "the CCSID of the job". - **/ - public static final int CCSID_OF_JOB = 0; - - // The type of help text formatting. - private int helpTextFormatting_ = NO_FORMATTING; - - // The system where the message file is located. - private AS400 system_ = null; - // The full IFS path name of the message file. - private String path_ = ""; - // The library that contains the message file. - private String library_ = null; - // The name of the message file. - private String name_ = null; - - // Track if a connection to the system has been made. - private transient boolean connected_ = false; - - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_ = null; // Set on first add. - // List of vetoable change event bean listeners. - private transient VetoableChangeSupport vetoableChangeListeners_ = null; // Set on first add. - - // The previously returned message ID. (For reference when specifying *NEXT) - private String previousMessageId_ = null; - - /** - * Constant indicating we are going to retrieve the next message - * (using the previous message as a starting point). - */ - public static final String NEXT = "*NEXT"; - - /** - * Constant indicating we are going to retrieve the first message - * in the message file. - */ - public static final String FIRST = "*FIRST"; - - // Special values for the "message option" parameter of the QMHRTVM API: - - // "*MSGID " (in EBCDIC) - private static final byte[] OPTION_MSGID = - new byte[] { (byte)0x5C, (byte)0xD4, (byte)0xE2, (byte)0xC7, (byte)0xC9, (byte)0xC4, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40 }; - - // "*NEXT " (in EBCDIC) - private static final byte[] OPTION_NEXT = - new byte[] { (byte)0x5C, (byte)0xD5, (byte)0xC5, (byte)0xE7, (byte)0xE3, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40 }; - - // "*FIRST " (in EBCDIC) - private static final byte[] OPTION_FIRST = - new byte[] { (byte)0x5C, (byte)0xC6, (byte)0xC9, (byte)0xD9, (byte)0xE2, (byte)0xE3, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40 }; - - /** - Constructs a MessageFile object. The system and message file name must be provided later. - **/ - public MessageFile() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing MessageFile object."); - } - - /** - Constructs a MessageFile object. It uses the specified system. The message file name must be provided later. - @param system The system object representing the system on which the message file exists. - **/ - public MessageFile(AS400 system) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing MessageFile object, system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - system_ = system; - } - - /** - Constructs a MessageFile object. It uses the specified system and message file name. - @param system The system object representing the system on which the message file exists. - @param path The integrated file system path name for the message file. That is, the message file name as a fully qualified path name in the library file system. The library and message file name must each be 10 characters or less. The extension for message files is .msgf. For example, /QSYS.LIB/MYLIB.LIB/MYFILE.MSGF. - **/ - public MessageFile(AS400 system, String path) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing MessageFile object, system: " + system + " path: " + path); - - // Check parameters. - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (path == null) - { - Trace.log(Trace.ERROR, "Parameter 'path' is null."); - throw new NullPointerException("path"); - } - QSYSObjectPathName ifs = new QSYSObjectPathName(path, "MSGF"); - - // Set instance variables. - library_ = ifs.getLibraryName(); - name_ = ifs.getObjectName(); - path_ = path; - system_ = system; - } - - /** - Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange() method will be called each time the value of any bound property is changed. - @param listener The listener. - @see #removePropertyChangeListener - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Adds a VetoableChangeListener. The specified VetoableChangeListener's vetoableChange() method will be called each time the value of any constrained property is changed. - @param listener The listener. - @see #removeVetoableChangeListener - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - } - - /** - Substitutes formatting characters with appropriate new line and indent characters. The formatting characters are: -
      -
    • &N -- Force a new line. -
    • &P -- Force a new line and indent the new line six characters. -
    • &B -- Force a new line and indent the new line four characters. -
    - @param sourceText The source text. - @return The formatted text. - **/ - public static String substituteFormattingCharacters(String sourceText) - { - // To preserve behavior, assume not BiDi. - return substituteFormattingCharacters(sourceText, false); - } - - private static String substituteFormattingCharacters(String sourceText, boolean bidi) - { - String targetText = sourceText; - targetText = replaceText(targetText, "&N", "\n"); - targetText = replaceText(targetText, "&P", "\n "); - targetText = replaceText(targetText, "&B", "\n "); - - if (bidi) - { - targetText = replaceText(targetText, "N&", "\n"); - targetText = replaceText(targetText, "P&", "\n "); - targetText = replaceText(targetText, "B&", "\n "); - } - return targetText; - } - - /** - Returns the status of help text formatting. Possible values are: -
      -
    • NO_FORMATTING - The help text is returned as a string of characters. This is the default. -
    • RETURN_FORMATTING_CHARACTERS - The help text contains formatting characters. The formatting characters are: -
        -
      • &N -- Force a new line. -
      • &P -- Force a new line and indent the new line six characters. -
      • &B -- Force a new line and indent the new line four characters. -
      -
    • SUBSTITUTE_FORMATTING_CHARACTERS - The MessageFile class replaces formatting characters with newline and space characters. -
    - @return The status of help text formatting. - **/ - public int getHelpTextFormatting() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting help text formatting:", helpTextFormatting_); - return helpTextFormatting_; - } - - /** - Returns the integrated file system path name of the message file. - @return The fully-qualified message file name, or an empty string ("") if not set. - **/ - public String getPath() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting path: " + path_); - return path_; - } - - /** - Returns an AS400Message object containing the object. The system and message file name must be set before calling this method. - @param ID The message identifier, {@link #FIRST FIRST}, or {@link #NEXT NEXT}. - @return An AS400Message object containing the message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - @see #setHelpTextFormatting - **/ - public AS400Message getMessage(String ID) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving message from message file, ID: " + ID); - return getMessage(ID, (byte[])null, BidiStringType.DEFAULT, CCSID_OF_JOB, CCSID_OF_JOB); - } - - /** - Returns an AS400Message object containing the object. The system and message file name must be set before calling this method. - @param ID The message identifier, {@link #FIRST FIRST}, or {@link #NEXT NEXT}. - @param type The bidi message string type, as defined by the CDRA (Character Data Representataion Architecture). See BidiStringType for more information and valid values. - @return An AS400Message object containing the message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - @see #setHelpTextFormatting - **/ - public AS400Message getMessage(String ID, int type) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving message from message file, ID: " + ID + ", type:", type); - return getMessage(ID, (byte[])null, type, CCSID_OF_JOB, CCSID_OF_JOB); - } - - /** - Returns an AS400Message object containing the message. The system and message file name must be set before calling this method. Up to 1024 bytes of substitution text can be supplied to this method. The calling program is responsible for correctly formatting the string containing the substitution text for the specified message. -

    For example, using CL command DSPMSGD, we see the format of the substitution text for message CPD0170 is char 4, char 10, char 10. Passing string

    "12  abcd      xyz"
    as the substitution text on this call means "12" will be substituted for &1, "abcd" will be substituted for &2, and "xyz" will be substituted for &3. - @param ID The message identifier, {@link #FIRST FIRST}, or {@link #NEXT NEXT}. - @param substitutionText The substitution text. - @return An AS400Message object containing the message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - @see #setHelpTextFormatting - **/ - public AS400Message getMessage(String ID, String substitutionText) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving message from message file, ID: " + ID + ", substitutionText: " + substitutionText); - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - if (AS400BidiTransform.isBidiCcsid(system_.getCcsid())) - { - return getMessage(ID, substitutionText, AS400BidiTransform.getStringType(system_.getCcsid())); - } - return getMessage(ID, substitutionText, BidiStringType.DEFAULT); - } - - /** - Returns an AS400Message object containing the message. The system and message file name must be set before calling this method. Up to 1024 bytes of substitution text can be supplied to this method. The calling program is responsible for correctly formatting the string containing the substitution text for the specified message. -

    For example, using CL command DSPMSGD, we see the format of the substitution text for message CPD0170 is char 4, char 10, char 10. Passing string

    "12  abcd      xyz"
    as the substitution text on this call means "12" will be substituted for &1, "abcd" will be substituted for &2, and "xyz" will be substituted for &3. - @param ID The message identifier, {@link #FIRST FIRST}, or {@link #NEXT NEXT}. - @param substitutionText The substitution text. - @param type The bidi message string type, as defined by the CDRA (Character Data Representataion Architecture). See BidiStringType for more information and valid values. - @return An AS400Message object containing the message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - @see #setHelpTextFormatting - **/ - public AS400Message getMessage(String ID, String substitutionText, int type) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving message from message file, ID: " + ID + ", substitutionText: " + substitutionText + ", type:", type); - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - return getMessage(ID, substitutionText != null ? new Converter(system_.getCcsid(), system_).stringToByteArray(substitutionText, type) : null, type, CCSID_OF_JOB, CCSID_OF_JOB); - } - - /** - Returns an AS400Message object containing the message. The system and message file name must be set before calling this method. Up to 1024 bytes of substitution text can be supplied to this method. The byte array is not changed or converted before being sent to the system. - @param ID The message identifier, {@link #FIRST FIRST}, or {@link #NEXT NEXT}. - @param substitutionText The substitution text. The bytes are assumed to be in the CCSID of the job. - @return An AS400Message object containing the message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - @see #setHelpTextFormatting - **/ - public AS400Message getMessage(String ID, byte[] substitutionText) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving message from message file, ID: " + ID + ", substitutionText:", substitutionText); - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - if (AS400BidiTransform.isBidiCcsid(system_.getCcsid())) - { - return getMessage(ID, substitutionText, AS400BidiTransform.getStringType(system_.getCcsid())); - } - return getMessage(ID, substitutionText, BidiStringType.DEFAULT, CCSID_OF_JOB, CCSID_OF_JOB); - } - - /** - Returns an AS400Message object containing the message. The system and message file name must be set before calling this method. Up to 1024 bytes of substitution text can be supplied to this method. The byte array is not changed or converted before being sent to the system. - @param ID The message identifier, {@link #FIRST FIRST}, or {@link #NEXT NEXT}. - @param substitutionText The substitution text. The bytes are assumed to be in the CCSID of the job. - @param type The bidi message string type, as defined by the CDRA (Character Data Representataion Architecture). See BidiStringType for more information and valid values. - @return An AS400Message object containing the message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - @see #setHelpTextFormatting - **/ - public AS400Message getMessage(String ID, byte[] substitutionText, int type) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving message from message file, ID: " + ID + ", type:" + type + ", substitutionText:", substitutionText); - return getMessage(ID, substitutionText, type, CCSID_OF_JOB, CCSID_OF_JOB); - } - - - /** - Returns an AS400Message object containing the message. The system and message file name must be set before calling this method. Up to 1024 bytes of substitution text can be supplied to this method. The byte array is not changed or converted before being sent to the system. - @param ID The message identifier, {@link #FIRST FIRST}, or {@link #NEXT NEXT}. - @param substitutionText The substitution text. - @param type The bidi message string type, as defined by the CDRA (Character Data Representataion Architecture). See BidiStringType for more information and valid values. - @param ccsidOfSubstitutionText The CCSID of the substitution text. The default value is {@link #CCSID_OF_JOB CCSID_OF_JOB}. - @param ccsidToConvertTo The CCSID in which the system should return the message text. The Toolbox then converts from that CCSID to Unicode when constructing the AS400Message. The default value is {@link #CCSID_OF_JOB CCSID_OF_JOB}. - @return An AS400Message object containing the message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - @see #setHelpTextFormatting - **/ - public AS400Message getMessage(String ID, byte[] substitutionText, int type, int ccsidOfSubstitutionText, int ccsidToConvertTo) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving message from message file, ID: " + ID + ", type:" + type+ ", ccsidOfSubstitutionText:" + ccsidOfSubstitutionText + ", substitutionText:", substitutionText); - if (ID == null) - { - Trace.log(Trace.ERROR, "Parameter 'ID' is null."); - throw new NullPointerException("ID"); - } - if (ID.length() > 7) - { - Trace.log(Trace.ERROR, "Length of parameter 'ID' is not valid: '" + ID + "'"); - throw new ExtendedIllegalArgumentException("ID (" + ID + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (path_.length() == 0) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting path."); - throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Prevent changing the system or path after retrieving a message. - connected_ = true; - - Converter conv = new Converter(system_.getCcsid(), system_); - - byte[] nameBytes = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; // 20 blanks (in EBCDIC) - conv.stringToByteArray(name_, nameBytes, 0, 10, type); - conv.stringToByteArray(library_, nameBytes, 10, 10, type); - - byte[] optionBytes = OPTION_MSGID; // "*MSGID" (in EBCDIC) - if (ID.equals(FIRST)) - { - optionBytes = OPTION_FIRST; - ID = ""; - } else if (ID.equals(NEXT)) - { - if (previousMessageId_ == null) - { - // No previous message, so assume they want the first message. - optionBytes = OPTION_FIRST; - ID = ""; - } - else - { - optionBytes = OPTION_NEXT; - ID = previousMessageId_; - } - } - - byte[] idBytes = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; // 7 blanks (in EBCDIC) - conv.stringToByteArray(ID, idBytes, 0, 7); - - if (substitutionText == null) substitutionText = new byte[0]; - - byte[] starNoBytes = new byte[] { 0x5C, (byte)0xD5, (byte)0xD6, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; // "*NO " (in EBCDIC) - byte[] starYesBytes = new byte[] { 0x5C, (byte)0xE8, (byte)0xC5, (byte)0xE2, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; // "*YES " (in EBCDIC) - - byte[] replace = (substitutionText.length == 0) ? starNoBytes : starYesBytes; // @C1A - byte[] format = (helpTextFormatting_ == 0) ? starNoBytes : starYesBytes; // @C1A - - // Setup program parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Message information, output, char(*). - new ProgramParameter(5120), - // Length of message information, input, binary(4). (0x1400 == 5120) - new ProgramParameter(new byte[] { 0x00, 0x00, 0x14, 0x00 } ), - // Format name, input, char(8), "RTVM0400" (in EBCDIC). @C1C - new ProgramParameter(new byte[] { (byte)0xD9, (byte)0xE3, (byte)0xE5, (byte)0xD4, (byte)0xF0, (byte)0xF4, (byte)0xF0, (byte)0xF0 } ), - // Message identifier, input, char(7). - new ProgramParameter(idBytes), - // Qualified message file name, input, char(20). - new ProgramParameter(nameBytes), - // Replacement data, input, char(*). - new ProgramParameter(substitutionText), - // Length of replacement data, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(substitutionText.length)), - // Replace substitution values, input, char(10). - new ProgramParameter(replace), - // Return format control characters, input, char(10). - new ProgramParameter(format), - // Error code, I/0, char(*). - new ProgramParameter(new byte[8]), - // Retrieve option, input, char(10) - new ProgramParameter(optionBytes), - // CCSID to convert to, input, binary(4). 0 == "ccsid of job". - new ProgramParameter(BinaryConverter.intToByteArray(ccsidToConvertTo)), - // CCSID of replacement data, input, binary(4). 0 == "ccsid of job". - new ProgramParameter(BinaryConverter.intToByteArray(ccsidOfSubstitutionText)) - }; - - // Design note: The 3 "optional parameters" existed in V5R1, and probably even earlier. - // In order to implement the *FIRST and *NEXT options, the three optional - // parameters are now always included. - - // Call the program. - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QMHRTVM.PGM", parameters); - pc.suggestThreadsafe(); - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()[0]); - } - - // Prepare to convert returned character bytes to Unicode. - int ccsidOfTextBytes; // CCSID of returned character fields - if (ccsidToConvertTo == CCSID_OF_JOB) { - ccsidOfTextBytes = system_.getCcsid(); - } - else { - ccsidOfTextBytes = ccsidToConvertTo; - conv = new Converter(ccsidOfTextBytes, system_); - } - - byte[] messageInformation = parameters[0].getOutputData(); - ID = conv.byteArrayToString(messageInformation, 26, 7, type).trim(); - - AS400Message msg = null; - - // If we got a message (assuming ID isn't blank), create and populate the - // message object. If we didn't get a message, leave the message null. - if (ID.length() > 0) - { - msg = new AS400Message(); - msg.setID(ID); - msg.setSeverity(BinaryConverter.byteArrayToInt(messageInformation, 8)); - - // extract, convert, & set the create and modification dates. @C1A - String _createDate = conv.byteArrayToString(messageInformation, - 200, 7, BidiStringType.DEFAULT); - String _modificationDate = conv.byteArrayToString(messageInformation, - 212, 7, BidiStringType.DEFAULT); - - Date createDate = convertDate(_createDate); - Date modificationDate = convertDate(_modificationDate); - - msg.setCreateDate(createDate); - msg.setModificationDate(modificationDate); - - int defaultReplyOffset = BinaryConverter.byteArrayToInt(messageInformation, 52); - int defaultReplyLength = BinaryConverter.byteArrayToInt(messageInformation, 56); - int messageOffset = BinaryConverter.byteArrayToInt(messageInformation, 64); - int messageLength = BinaryConverter.byteArrayToInt(messageInformation, 68); - int helpOffset = BinaryConverter.byteArrayToInt(messageInformation, 76); - int helpLength = BinaryConverter.byteArrayToInt(messageInformation, 80); - - msg.setDefaultReply(conv.byteArrayToString(messageInformation, defaultReplyOffset, defaultReplyLength, type)); - msg.setText(conv.byteArrayToString(messageInformation, messageOffset, messageLength, type)); - String helpText = conv.byteArrayToString(messageInformation, helpOffset, helpLength, type); - if (helpTextFormatting_ == SUBSTITUTE_FORMATTING_CHARACTERS) - { - helpText = substituteFormattingCharacters(helpText, AS400BidiTransform.isBidiCcsid(ccsidOfTextBytes)); - } - msg.setHelp(helpText); - previousMessageId_ = ID; - } - - return msg; - } - - /** - * Convert from CYYMMDD format to java date - * - * @param input date in CYYMMDD format - * @return converted date - */ - // @C1A - private Date convertDate(String input) { - Date output = null; - - String centuryAddedDate = (input.charAt(0) == '0' ? "19" : "20") + input.substring(1); - - try { - output = YYYYMMDD_FORMAT.parse(centuryAddedDate); - } catch (ParseException e) { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Invalid date " + input); - throw new IllegalArgumentException(e.toString()); - } - - return output; - } - /** - Returns the system object representing the system on which the message file exists. - @return The system object representing the system on which the message file exists. If the system has not been set, null is returned. - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - /** - Removes the PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes the VetoableChangeListener. If the VetoableChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - // Replace one phrase for another inside a string. - private static String replaceText(String s, String oldPhrase, String newPhrase) - { - int index = s.indexOf(oldPhrase); - - while (index >= 0) - { - if (index == 0) - { - s = newPhrase + s.substring(3); - } - else - { - // Copy from beginning of String to location of oldPhrase. - StringBuffer b = new StringBuffer(s.substring(0, index)); - b.append(newPhrase); - // Start at the 2nd position after where oldPhrase occurred. - b.append(s.substring(index + 2)); - s = b.toString(); - } - - index = s.indexOf(oldPhrase); - } - - return s; - } - - /** - Sets the help text formatting value. -

    Note: To return formatting characters, call this method prior to calling any of the getMessage() methods. - @param helpTextFormatting The help text formatting value. - Possible values are: -

      -
    • NO_FORMATTING - The help text is returned as a string of characters. This is the default. -
    • RETURN_FORMATTING_CHARACTERS - The help text contains formatting characters. The formatting characters are: -
        -
      • &N -- Force a new line. -
      • &P -- Force a new line and indent the new line six characters. -
      • &B -- Force a new line and indent the new line four characters. -
      -
    • SUBSTITUTE_FORMATTING_CHARACTERS - The MessageFile class replaces formatting characters with new line and space characters. -
    - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setHelpTextFormatting(int helpTextFormatting) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting help text formatting:", helpTextFormatting); - if (helpTextFormatting < NO_FORMATTING || helpTextFormatting > SUBSTITUTE_FORMATTING_CHARACTERS) - { - Trace.log(Trace.ERROR, "Value of parameter 'helpTextFormatting' is not valid: " + helpTextFormatting); - throw new ExtendedIllegalArgumentException("helpTextFormatting (" + helpTextFormatting + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - helpTextFormatting_ = helpTextFormatting; - } - else - { - Integer oldValue = new Integer(helpTextFormatting_); - Integer newValue = new Integer(helpTextFormatting); - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("helpTextFormatting", oldValue, newValue); - } - helpTextFormatting_ = helpTextFormatting; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("helpTextFormatting", oldValue, newValue); - } - } - } - - /** - Sets the message file name. The name cannot be changed after retrieving a message from the system. - @param path The integrated file system path name for the message file. That is, the message file name as a fully qualified path name in the library file system. The library and message file name must each be 10 characters or less. The extension for message files is .msgf. For example, /QSYS.LIB/MYLIB.LIB/MYFILE.MSGF. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setPath(String path) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting path: " + path); - if (path == null) - { - Trace.log(Trace.ERROR, "Parameter 'path' is null."); - throw new NullPointerException("path"); - } - // Cannot change the path once we retrieve the first message. - if (connected_) - { - Trace.log(Trace.ERROR, "Cannot set property 'path' after connect."); - throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - QSYSObjectPathName ifs = new QSYSObjectPathName(path, "MSGF"); - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - library_ = ifs.getLibraryName(); - name_ = ifs.getObjectName(); - path_ = path; - } - else - { - String oldValue = path_; - String newValue = path; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("path", oldValue, newValue); - } - library_ = ifs.getLibraryName(); - name_ = ifs.getObjectName(); - path_ = path; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("path", oldValue, newValue); - } - } - } - - /** - Sets the system object representing the system on which the message file exists. The system cannot be changed after retrieving a message from the system. - @param system The system object representing the system on which the message file exists. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setSystem(AS400 system) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - // Cannot change the system once we retrieve the first message. - if (connected_) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - system_ = system; - } - else - { - AS400 oldValue = system_; - AS400 newValue = system; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("system", oldValue, newValue); - } - system_ = system; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("system", oldValue, newValue); - } - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/MessageFile16.gif b/cvsroot/src/com/ibm/as400/access/MessageFile16.gif deleted file mode 100644 index 0dcc8c023..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/MessageFile16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/MessageFile32.gif b/cvsroot/src/com/ibm/as400/access/MessageFile32.gif deleted file mode 100644 index a1a4d0d8c..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/MessageFile32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/MessageFileBeanInfo.java b/cvsroot/src/com/ibm/as400/access/MessageFileBeanInfo.java deleted file mode 100644 index 5447590fd..000000000 --- a/cvsroot/src/com/ibm/as400/access/MessageFileBeanInfo.java +++ /dev/null @@ -1,152 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MessageFileBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - Provides bean information for the MessageFile class. - **/ -public class MessageFileBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private static final Class BEAN_CLASS = MessageFile.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - // Set up the event set descriptors. - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - - eventSetDescriptors = new EventSetDescriptor[] { propertyChange, vetoableChange }; - - // Set up the property descriptors. - PropertyDescriptor system = new PropertyDescriptor("system", BEAN_CLASS); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - - PropertyDescriptor path = new PropertyDescriptor("path", BEAN_CLASS); - path.setBound(true); - path.setConstrained(true); - path.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_PATH")); - path.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_PATH")); - - PropertyDescriptor helpTextFormatting = new PropertyDescriptor("helpTextFormatting", BEAN_CLASS); - helpTextFormatting.setBound(true); - helpTextFormatting.setConstrained(true); - helpTextFormatting.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_MF_HELP_TEXT_FORMATTING")); - helpTextFormatting.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_MF_HELP_TEXT_FORMATTING")); - - propertyDescriptors = new PropertyDescriptor[] { system, path, helpTextFormatting }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return One (1), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "vetoableChange" event. - return 1; - } - - /** - Returns the index of the default property. - @return One (1), the index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // The index for the "path" property. - return 1; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. Possible values are: -
      -
    • BeanInfo.ICON_MONO_16x16 -
    • BeanInfo.ICON_MONO_32x32 -
    • BeanInfo.ICON_COLOR_16x16 -
    • BeanInfo.ICON_COLOR_32x32 -
    - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("MessageFile16.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("MessageFile32.gif"); - } - Trace.log(Trace.ERROR, "Value of parameter 'icon' is not valid:", icon); - throw new ExtendedIllegalArgumentException("icon (" + icon + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/MessageQueue.java b/cvsroot/src/com/ibm/as400/access/MessageQueue.java deleted file mode 100644 index 2bba1fd5e..000000000 --- a/cvsroot/src/com/ibm/as400/access/MessageQueue.java +++ /dev/null @@ -1,1984 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MessageQueue.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.Serializable; -import java.util.Enumeration; - -/** - Represents a message queue object on the system. If no message queue path is set, then the default is {@link #CURRENT CURRENT}, which represents the current user's message queue. If necessary, the name of the message queue will be retrieved from the current user's user profile. -

    QueuedMessage objects have many attributes. Only some of these attribute values are set, depending on how a QueuedMessage object is created. The following is a list of attributes whose values are set on QueuedMessage objects returned in a list of messages: -

      -
    • alert option -
    • date sent -
    • default reply -
    • message file -
    • message help -
    • message ID -
    • message key -
    • message queue -
    • message severity -
    • message text -
    • message type -
    • reply status -
    • sender job name -
    • sender job number -
    • sender job user name -
    • if the system release is V5R3M0 or greater, sending current user -
    • sending program name -
    - -

    The following is a list of attributes whose values are set on objects returned by receive(): -

      -
    • alert option -
    • date sent -
    • message file -
    • message help -
    • message ID -
    • message key -
    • message queue -
    • message severity -
    • message text -
    • message type -
    • sender job name -
    • sender job number -
    • sender job user name -
    • sending program name -
    • substitution data -
    -
    - @see com.ibm.as400.access.QueuedMessage - **/ -public class MessageQueue implements Serializable -{ - static final long serialVersionUID = 5L; - - /** - Constant referring to all messages in the message queue. - **/ - public final static String ALL = "*ALL"; - - /** - Constant referring to any message in the message queue. - **/ - public final static String ANY = "*ANY"; - - /** - Constant referring to a message identified by a key. - **/ - public final static String BYKEY = "*BYKEY"; - - /** - Constant referring to completion messages. - **/ - public final static String COMPLETION = "*COMP"; - - /** - Constant referring to the sender's copy of a previously sent inquiry message. - **/ - public final static String COPY = "*COPY"; - - /** - Constant referring to the current user's message queue. - **/ - public final static String CURRENT = "*CURRENT"; - - /** - Constant referring to diagnostic messages. - **/ - public final static String DIAGNOSTIC = "*DIAG"; - - /** - Constant referring to the first message in the message queue. - **/ - public final static String FIRST = "*FIRST"; - - /** - Constant referring to informational messages. - **/ - public final static String INFORMATIONAL = "*INFO"; - - /** - Constant referring to inquiry messages. - **/ - public final static String INQUIRY = "*INQ"; - - /** - Constant referring to all messages in the message queue except unanswered inquiry and unanswered senders' copy messages. - **/ - public final static String KEEP_UNANSWERED = "*KEEPUNANS"; - - /** - Constant referring to the last message in the message queue. - **/ - public final static String LAST = "*LAST"; - - /** - Constant referring to messages that need a reply. - **/ - public final static String MESSAGES_NEED_REPLY = "*MNR"; - - /** - Constant referring to messages that do not need a reply. - **/ - public final static String MESSAGES_NO_NEED_REPLY = "*MNNR"; - - /** - Constant referring to all new messages in the message queue. New messages are those that have not been received. - **/ - public final static String NEW = "*NEW"; - - /** - Constant referring to the message key for the newest message in the queue. - **/ - public final static byte[] NEWEST = new byte[] { (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF}; // All FF's. - - /** - Constant referring to the next message in the message queue. - **/ - public final static String NEXT = "*NEXT"; - - /** - Constant referring to all old messages in the message queue. Old messages are those that have already been received. - **/ - public final static String OLD = "*OLD"; - - /** - Constant referring to the message key for the oldest message in the queue. - **/ - public final static byte[] OLDEST = new byte[4]; // All 0's. - - /** - Constant referring to the previous message in the message queue. - **/ - public final static String PREVIOUS = "*PRV"; - - /** - Constant indicating that the message should be removed from the message queue. - **/ - public final static String REMOVE = "*REMOVE"; - - /** - Constant referring to the reply to an inquiry message. - **/ - public final static String REPLY = "*RPY"; - - /** - Constant indicating that the message should remain in the message queue without changing its new or old designation. - **/ - public final static String SAME = "*SAME"; - - /** - Constant referring to the sender's copies of messages that need replies. - **/ - public final static String SENDERS_COPY_NEED_REPLY = "*SCNR"; - - // Shared blank key. - private static final byte[] BLANK_KEY = new byte[] { 0x40, 0x40, 0x40, 0x40 }; - - // The system where the message queue is located. - private AS400 system_; - // The full IFS path name of the message queue. - private String path_; - // The library that contains the message queue. - private String library_ = null; - // The name of the message queue. - private String name_ = null; - - // Length of the message queue message list. - private int length_; - // Length of the data in the message queue message list. - private int dataLength_; - // "Request handle" that can be used for subsequent requests for information via the open list APIs. - private byte[] handle_; - // If the list info has changed, close the old handle before loading the new one. - private boolean closeHandle_ = false; - - // Whether the list should be sorted. - private boolean sort_ = false; - - // Formatting option for the second level text. - private int helpTextFormatting_ = MessageFile.NO_FORMATTING; - // List direction oldest to newest or newest to oldest. - private boolean listDirection_ = true; - // Minimum severity selection criteria. - private int severity_ = 0; - // Starting user key for list. - private byte[] userStartingMessageKey_; - // starting workstation key for list. - private byte[] workstationStartingMessageKey_; - // Combined selection criteria for list. - private String selection_ = ALL; - // Selection criteria for messages needing reply. - private boolean selectMessagesNeedReply_ = true; - // Selection criteria for messages not needing reply. - private boolean selectMessagesNoNeedReply_ = true; - // Selection criteria for senders copy messages needing reply. - private boolean selectSendersCopyMessagesNeedReply_ = true; - - // Cached converter object, reset everytime system changes. - private transient Converter conv_ = null; - // Cached converted qualified message queue name, reset everytime system or path changes. - private transient byte[] qualifiedMessageQueueName_ = null; - - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_ = null; // Set on first add. - // List of vetoable change event bean listeners. - private transient VetoableChangeSupport vetoableChangeListeners_ = null; // Set on first add. - - - /** - Constructs a MessageQueue object. The system must be provided later. The message queue path defaults to {@link #CURRENT CURRENT}. - @see #setPath - @see #setSystem - **/ - public MessageQueue() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing MessageQueue object."); - path_ = CURRENT; - } - - /** - Constructs a MessageQueue object. The message queue path defaults to {@link #CURRENT CURRENT}. - @param system The system object representing the system on which the message queue exists. - @see #setPath - **/ - public MessageQueue(AS400 system) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing MessageQueue object, system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - system_ = system; - path_ = CURRENT; - } - - /** - Constructs a MessageQueue object. - @param system The system object representing the system on which the message queue exists. - @param path The fully qualified integrated file system path name of the message queue, or {@link #CURRENT CURRENT} to refer to the user's default message queue. - **/ - public MessageQueue(AS400 system, String path) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing MessageQueue object, system: " + system + " path: " + path); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (path == null) - { - Trace.log(Trace.ERROR, "Parameter 'path' is null."); - throw new NullPointerException("path"); - } - if (!path.equals(CURRENT)) - { - // Validate the path and save the name and library. - QSYSObjectPathName ifs = new QSYSObjectPathName(path, "MSGQ"); - library_ = ifs.getLibraryName(); - name_ = ifs.getObjectName(); - } - path_ = path; - system_ = system; - } - - /** - Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange() method will be called each time the value of any bound property is changed. - @param listener The listener. - @see #removePropertyChangeListener - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Adds a VetoableChangeListener. The specified VetoableChangeListener's vetoableChange() method will be called each time the value of any constrained property is changed. - @param listener The listener. - @see #removeVetoableChangeListener - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - } - - /** - Closes the message list on the system. This releases any system resources previously in use by this message list. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public synchronized void close() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Closing message queue message list, handle: ", handle_); - if (handle_ == null) return; - - try { - ListUtilities.closeList(system_, handle_); - } - finally { - handle_ = null; - closeHandle_ = false; - } - } - - /** - Closes the list on the system when this object is garbage collected. - **/ - protected void finalize() throws Throwable - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Finalize method for message queue invoked."); - if (handle_ != null) try { close(); } catch (Throwable t) {} - super.finalize(); - } - - /** - Returns the status of help text formatting. Possible values are: -
      -
    • {@link com.ibm.as400.access.MessageFile#NO_FORMATTING MessageFile.NO_FORMATTING} - The help text is returned as a string of characters. This is the default. -
    • {@link com.ibm.as400.access.MessageFile#RETURN_FORMATTING_CHARACTERS MessageFile.RETURN_FORMATTING_CHARACTERS} - The help text contains formatting characters. The formatting characters are: -
        -
      • &N -- Force a new line. -
      • &P -- Force a new line and indent the new line six characters. -
      • &B -- Force a new line and indent the new line four characters. -
      -
    • {@link com.ibm.as400.access.MessageFile#SUBSTITUTE_FORMATTING_CHARACTERS MessageFile.SUBSTITUTE_FORMATTING_CHARACTERS} - The MessageFile class replaces formatting characters with newline and space characters. -
    - @return The status of help text formatting. - @see #setHelpTextFormatting - **/ - public int getHelpTextFormatting() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting help text formatting:", helpTextFormatting_); - return helpTextFormatting_; - } - - /** - Returns the number of messages in the list. This method implicitly calls {@link #load load()}. - @return The number of messages, or 0 if no list was retrieved. - @see #load - **/ - public int getLength() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting message queue list length."); - try - { - if (handle_ == null || closeHandle_) load(); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Exception caught getting length of message queue list:", e); - if (e instanceof ExtendedIllegalStateException) throw (ExtendedIllegalStateException)e; - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Length:", length_); - return length_; - } - - /** - Returns the list direction. - @return true if the messages are listed in order from oldest to newest; false if the messages are listed in order from newest to oldest. - @see #setListDirection - **/ - public boolean getListDirection() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting list direction:", listDirection_); - return listDirection_; - } - - /** - Returns the list of messages in the message queue. The enumeration retrieves the messages in blocks of 1000. If this does not yield the desired performance or memory usage, please use the {@link #getMessages(int,int) getMessages()} that returns an array of QueuedMessage objects and accepts a list offset and length. If an error occurs while the Enumeration is loading the next block of messages, a NoSuchElementException will be thrown while the real error will be logged to {@link com.ibm.as400.access.Trace Trace.ERROR}. - @return An Enumeration of {@link com.ibm.as400.access.QueuedMessage QueuedMessage} objects. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Enumeration getMessages() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving message queue message list."); - // Need to get the length. - load(); - return new QueuedMessageEnumeration(this, length_); - } - - /** - Returns a subset of the list of messages in the message queue. This method allows the user to retrieve the message list from the system in pieces. If a call to {@link #load load()} is made (either implicitly or explicitly), then the messages at a given list offset will change, so a subsequent call to getMessages() with the same listOffset and number will most likely not return the same QueuedMessages as the previous call. - @param listOffset The offset in the list of messages (0-based). This value must be greater than or equal to 0 and less than the list length; or specify -1 to retrieve all of the messages. - @param number The number of messages to retrieve out of the list, starting at the specified listOffset. This value must be greater than or equal to 0 and less than or equal to the list length. If the listOffset is -1, this parameter is ignored. - @return The array of retrieved {@link com.ibm.as400.access.QueuedMessage QueuedMessage} objects. The length of this array may not necessarily be equal to number, depending upon the size of the list on the system, and the specified listOffset. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see com.ibm.as400.access.QueuedMessage - **/ - public QueuedMessage[] getMessages(int listOffset, int number) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving message queue message list, list offset: " + listOffset + ", number:", number); - if (listOffset < -1) - { - throw new ExtendedIllegalArgumentException("listOffset (" + listOffset + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (number < 0 && listOffset != -1) - { - throw new ExtendedIllegalArgumentException("number (" + number + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (handle_ == null || closeHandle_) load(); // this sets the length_ variable - - if (length_ == 0 || (number == 0 && listOffset != -1)) { - return new QueuedMessage[0]; - } - - if (listOffset == -1) - { - number = length_; // request entire list - listOffset = 0; // ... starting at beginning of list - } - else if (listOffset >= length_) - { - if (Trace.traceOn_) - Trace.log(Trace.WARNING, "Value of parameter 'listOffset' is beyond end of list:", listOffset + " (list length: " + length_ + ")"); - - return new QueuedMessage[0]; - } - else if (listOffset + number > length_) - { - number = length_ - listOffset; - } - - int lengthOfReceiverVariable = dataLength_ / length_ * number; - - // Retrieve the entries in the list that was built by the most recent load(). - byte[] data = ListUtilities.retrieveListEntries(system_, handle_, lengthOfReceiverVariable, number, listOffset, null); - - resolveConverter(); - - QueuedMessage[] messages = new QueuedMessage[number]; - int offset = 0; - for (int i = 0; i < messages.length; ++i) - { - int entryOffset = BinaryConverter.byteArrayToInt(data, offset); - int fieldOffset = BinaryConverter.byteArrayToInt(data, offset + 4); - int numFields = BinaryConverter.byteArrayToInt(data, offset + 8); - int messageSeverity = BinaryConverter.byteArrayToInt(data, offset + 12); - String messageIdentifier = conv_.byteArrayToString(data, offset + 16, 7).trim(); - int messageType = (data[offset + 23] & 0x0F) * 10 + (data[offset + 24] & 0x0F); - if (messageType == 0) messageType = -1; - byte[] messageKey = new byte[4]; - System.arraycopy(data, offset + 25, messageKey, 0, 4); - String messageFileName = conv_.byteArrayToString(data, offset + 29, 10).trim(); - String messageFileLibrarySpecified = conv_.byteArrayToString(data, offset + 39, 10).trim(); - String messageQueue = conv_.byteArrayToString(data, offset + 49, 10).trim(); - String messageQueueLibraryUsed = conv_.byteArrayToString(data, offset + 59, 10).trim(); - String dateSent = conv_.byteArrayToString(data, offset + 69, 7); // CYYMMDD. - String timeSent = conv_.byteArrayToString(data, offset + 76, 6); // HHMMSS. - MessageQueue mq = messageQueueLibraryUsed.length() > 0 && messageQueue.length() > 0 ? new MessageQueue(system_, QSYSObjectPathName.toPath(messageQueueLibraryUsed, messageQueue, "MSGQ")) : this; - messages[i] = new QueuedMessage(mq, messageSeverity, messageIdentifier, messageType, messageKey, messageFileName, messageFileLibrarySpecified, dateSent, timeSent); - - // Our 7 or 8 fields should've come back. - for (int j = 0; j < numFields; ++j) - { - int offsetToNextField = BinaryConverter.byteArrayToInt(data, fieldOffset); - int fieldID = BinaryConverter.byteArrayToInt(data, fieldOffset + 8); - byte type = data[fieldOffset + 12]; - int dataLen = BinaryConverter.byteArrayToInt(data, fieldOffset + 28); - if (type == (byte)0xC3) // EBCDIC 'C'. - { - messages[i].setValueInternal(fieldID, conv_.byteArrayToString(data, fieldOffset + 32, dataLen)); - } - else if (type == (byte)0xC2) // EBCDIC 'B'. - { - // We should never get here using our standard 8 keys. - if (dataLen > 4) - { - messages[i].setAsLong(fieldID, BinaryConverter.byteArrayToLong(data, fieldOffset + 32)); - } - else - { - messages[i].setAsInt(fieldID, BinaryConverter.byteArrayToInt(data, fieldOffset + 32)); - } - } - else - { - // We should never get here using our standard 8 keys. - // Type = 'M'. Used for fields 606 and 706. - int numStatements = BinaryConverter.byteArrayToInt(data, fieldOffset + 32); - String[] statements = new String[numStatements]; - for (int k = 0; k < numStatements; ++k) - { - statements[k] = conv_.byteArrayToString(data, fieldOffset + 36 + k * 10, 10); - } - messages[i].setValueInternal(fieldID, statements); - } - fieldOffset = offsetToNextField; - } - - offset = entryOffset; - } - - return messages; - } - - /** - Returns the fully qualified integrated file system path name of the message queue, or {@link #CURRENT CURRENT} to refer to the user's default message queue. - @return The fully qualified integrated file system path name of the message queue, or {@link #CURRENT CURRENT} to refer to the user's default message queue. - @see #setPath - **/ - public String getPath() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting path: " + path_); - return path_; - } - - /** - Returns the selection that describes which messages are returned. - @return The selection. Possible values are: -
      -
    • {@link #ALL ALL} -
    • {@link #MESSAGES_NEED_REPLY MESSAGES_NEED_REPLY} -
    • {@link #MESSAGES_NO_NEED_REPLY MESSAGES_NO_NEED_REPLY} -
    • {@link #SENDERS_COPY_NEED_REPLY SENDERS_COPY_NEED_REPLY} -
    - @see #setSelection - @deprecated Use {@link #isSelectMessagesNeedReply isSelectMessagesNeedReply()}, {@link #isSelectMessagesNoNeedReply isSelectMessagesNoNeedReply()}, and {@link #isSelectSendersCopyMessagesNeedReply isSelectSendersCopyMessagesNeedReply()} instead. The value returned by this method may not accurately reflect the actual selection criteria used to filter the list of messages. - **/ - public String getSelection() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting selection: " + selection_); - return selection_; - } - - /** - Returns the severity of the messages which are returned. - @return The severity of the messages which are returned. - @see #setSeverity - **/ - public int getSeverity() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting severity:", severity_); - return severity_; - } - - /** - Returns whether or not messages will be sorted when {@link #ALL ALL} is specified for the selection criteria. The default is false. - @return true if messages will be sorted by message type; false otherwise. - @see #setSort - **/ - public boolean getSort() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting sort:", sort_); - return sort_; - } - - /** - Returns the system object representing the system on which the message queue exists. - @return The system object representing the system on which the message queue exists. If the system has not been set, null is returned. - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - /** - Returns the user starting message key, if one has been set. - @return The key, or null if none has been set. - @see #setUserStartingMessageKey - **/ - public byte[] getUserStartingMessageKey() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting user starting message key:", userStartingMessageKey_); - - byte[] msgKey = null; - if (userStartingMessageKey_ != null) // return a copy - { - msgKey = new byte[userStartingMessageKey_.length]; - System.arraycopy(userStartingMessageKey_, 0, msgKey, 0, msgKey.length); - } - return msgKey; - } - - /** - Returns the workstation starting message key, if one has been set. - @return The key, or null if none has been set. - @see #setWorkstationStartingMessageKey - **/ - public byte[] getWorkstationStartingMessageKey() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting workstation starting message key:", workstationStartingMessageKey_); - - byte[] msgKey = null; - if (workstationStartingMessageKey_ != null) // return a copy - { - msgKey = new byte[workstationStartingMessageKey_.length]; - System.arraycopy(workstationStartingMessageKey_, 0, msgKey, 0, msgKey.length); - } - return msgKey; - } - - /** - Returns whether or not messages that need a reply are included in the list of returned messages. If all three message selection getters return true, it is the equivalent of all messages being included in the list of returned messages. By default, all messages are returned, so this method returns true. - @return true if messages that need a reply are included in the list of returned messages; false if messages that need a reply are excluded from the list of returned messages. - @see #isSelectMessagesNoNeedReply - @see #isSelectSendersCopyMessagesNeedReply - @see #setSelectMessagesNeedReply - **/ - public boolean isSelectMessagesNeedReply() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if messages that need a reply are selected:", selectMessagesNeedReply_); - return selectMessagesNeedReply_; - } - - /** - Returns whether or not messages that do not need a reply are included in the list of returned messages. If all three message selection getters return true, it is the equivalent of all messages being included in the list of returned messages. By default, all messages are returned, so this method returns true. - @return true if messages that do not need a reply are included in the list of returned messages; false if messages that do not need a reply are excluded from the list of returned messages. - @see #isSelectMessagesNeedReply - @see #isSelectSendersCopyMessagesNeedReply - @see #setSelectMessagesNoNeedReply - **/ - public boolean isSelectMessagesNoNeedReply() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if messages that do not need a reply are selected:", selectMessagesNoNeedReply_); - return selectMessagesNoNeedReply_; - } - - /** - Returns whether or not sender's copy messages that need a reply are included in the list of returned messages. If all three message selection getters return true, it is the equivalent of all messages being included in the list of returned messages. By default, all messages are returned, so this method returns true. - @return true if sender's copy messages that need a reply are included in the list of returned messages; false if sender's copy messages that need a reply are excluded from the list of returned messages. - @see #isSelectMessagesNeedReply - @see #isSelectMessagesNoNeedReply - @see #setSelectSendersCopyMessagesNeedReply - **/ - public boolean isSelectSendersCopyMessagesNeedReply() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if sender's copy messages that need a reply are selected:", selectSendersCopyMessagesNeedReply_); - return selectSendersCopyMessagesNeedReply_; - } - - /** - Loads the list of messages on the system. This method informs the system to build a list of messages given the previously added attributes to select, retrieve, and sort. This method blocks until the system returns the total number of messages it has compiled. A subsequent call to {@link #getMessages getMessages()} will retrieve the actual message information and attributes for each message in the list from the system. -

    This method updates the list length. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #getLength - **/ - public synchronized void load() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loading message queue message list."); - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Close the previous list. - if (closeHandle_) close(); - - boolean v5r3OrGreater = system_.getVRM() >= 0x00050300; - - // Create the message selection information. - boolean selectAll = (selectMessagesNeedReply_ && selectMessagesNoNeedReply_ && selectSendersCopyMessagesNeedReply_) || (!selectMessagesNeedReply_ && !selectMessagesNoNeedReply_ && !selectSendersCopyMessagesNeedReply_); - int numberOfSelectionCriteria = selectAll ? 1 : (selectMessagesNeedReply_ ? 1 : 0) + (selectMessagesNoNeedReply_ ? 1 : 0) + (selectSendersCopyMessagesNeedReply_ ? 1 : 0); - int numberOfFieldsToReturn = v5r3OrGreater ? 8 : 7; - byte[] messageSelectionInformation = new byte[52 + 10 * numberOfSelectionCriteria + 4 * numberOfFieldsToReturn]; - if (listDirection_) - { - // EBCDIC '*NEXT'. - System.arraycopy(new byte[] { 0x5C, (byte)0xD5, (byte)0xC5, (byte)0xE7, (byte)0xE3, 0x40, 0x40, 0x40, 0x40, 0x40 }, 0, messageSelectionInformation, 0, 10); - } - else - { - // EBCDIC '*PRV'. - System.arraycopy(new byte[] { 0x5C, (byte)0xD7, (byte)0xD9, (byte)0xE5, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }, 0, messageSelectionInformation, 0, 10); - } - BinaryConverter.intToByteArray(severity_, messageSelectionInformation, 12); - // Set -1 into Maximum message length and Maximum message help length. - for (int i = 16; i < 24; ++i) messageSelectionInformation[i] = (byte)0xFF; - // Offset of selection criteria is 44. - BinaryConverter.intToByteArray(44, messageSelectionInformation, 24); - BinaryConverter.intToByteArray(numberOfSelectionCriteria, messageSelectionInformation, 28); - int offset = 44 + numberOfSelectionCriteria * 10; - // Offset of starting message keys. - BinaryConverter.intToByteArray(offset, messageSelectionInformation, 32); - // Offset of identifiers of fields to return. - BinaryConverter.intToByteArray(offset + 8, messageSelectionInformation, 36); - // Number of fields to return. - BinaryConverter.intToByteArray(numberOfFieldsToReturn, messageSelectionInformation, 40); - if (selectAll) - { - // EBCDIC '*ALL'. - System.arraycopy(new byte[] { 0x5C, (byte)0xC1, (byte)0xD3, (byte)0xD3, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }, 0, messageSelectionInformation, 44, 10); - } - else - { - int selectionCriteriaOffset = 44; - if (selectMessagesNeedReply_) - { - // EBCDIC '*MNR'. - System.arraycopy(new byte[] { 0x5C, (byte)0xD4, (byte)0xD5, (byte)0xD9, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }, 0, messageSelectionInformation, selectionCriteriaOffset, 10); - selectionCriteriaOffset += 10; - } - if (selectMessagesNoNeedReply_) - { - // EBCDIC '*MNNR'. - System.arraycopy(new byte[] { 0x5C, (byte)0xD4, (byte)0xD5, (byte)0xD5, (byte)0xD9, 0x40, 0x40, 0x40, 0x40, 0x40 }, 0, messageSelectionInformation, selectionCriteriaOffset, 10); - selectionCriteriaOffset += 10; - } - if (selectSendersCopyMessagesNeedReply_) - { - // EBCDIC '*SCNR'. - System.arraycopy(new byte[] { 0x5C, (byte)0xE2, (byte)0xC3, (byte)0xD5, (byte)0xD9, 0x40, 0x40, 0x40, 0x40, 0x40 }, 0, messageSelectionInformation, selectionCriteriaOffset, 10); - } - } - byte[] userStartingMessageKey = (userStartingMessageKey_ != null ? userStartingMessageKey_ : (listDirection_ ? OLDEST : NEWEST)); - System.arraycopy(userStartingMessageKey, 0, messageSelectionInformation, offset, 4); - byte[] workstationStartingMessageKey = (workstationStartingMessageKey_ != null ? workstationStartingMessageKey_ : userStartingMessageKey); - System.arraycopy(workstationStartingMessageKey, 0, messageSelectionInformation, offset + 4, 4); - // Message with replacement data. - BinaryConverter.intToByteArray(302, messageSelectionInformation, offset + 8); - // Qualified sender job name. - BinaryConverter.intToByteArray(601, messageSelectionInformation, offset + 12); - // Sending program name. - BinaryConverter.intToByteArray(603, messageSelectionInformation, offset + 16); - // Reply status. - BinaryConverter.intToByteArray(1001, messageSelectionInformation, offset + 20); - // Default reply. - BinaryConverter.intToByteArray(501, messageSelectionInformation, offset + 24); - // Message help with replacement data and formattting characters. - BinaryConverter.intToByteArray(404, messageSelectionInformation, offset + 28); - // Alert option. - BinaryConverter.intToByteArray(101, messageSelectionInformation, offset + 32); - if (v5r3OrGreater) - { - // Sending user profile. - BinaryConverter.intToByteArray(607, messageSelectionInformation, offset + 36); - } - - // Create the user or queue information. - byte[] userOrQueueInformation; - if (path_.equals(CURRENT)) - { - // EBCDIC '0' followed by EBCDIC '*CURRENT'. - userOrQueueInformation = new byte[] { (byte)0xF0, 0x5C, (byte)0xC3, (byte)0xE4, (byte)0xD9, (byte)0xD9, (byte)0xC5, (byte)0xD5, (byte)0xE3, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - } - else - { - // The message queue name is used. - userOrQueueInformation = new byte[] { (byte)0xF1, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - resolveConverter(); - conv_.stringToByteArray(name_, userOrQueueInformation, 1); - conv_.stringToByteArray(library_, userOrQueueInformation, 11); - } - - // Setup program parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Receiver variable, output, char(*). - new ProgramParameter(0), - // Length of receiver variable, input, binary(4). - new ProgramParameter(new byte[] { 0x00, 0x00, 0x00, 0x00 } ), - // List information, output, char(80). - new ProgramParameter(ListUtilities.LIST_INFO_LENGTH), - // Number of records to return, input, binary(4). - // Special value '-1' indicates that "all records are built synchronously in the list". - new ProgramParameter(new byte[] { (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF } ), - // Sort information, input, char(1). - // Sort information, '0' = no sort, '1' = sort if *ALL is specified - new ProgramParameter(new byte[] { sort_ && selectAll ? (byte)0xF1 : (byte)0xF0 } ), - // Message selection information, input, char(*). - new ProgramParameter(messageSelectionInformation), - // Size of message selection information, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(messageSelectionInformation.length)), - // User or queue information, input, char(21). - new ProgramParameter(userOrQueueInformation), - // Message queues used, output, char(44). - new ProgramParameter(44), - // Error code, I/O, char(*). - new ErrorCodeParameter() - }; - - // Call the program. - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QGY.LIB/QGYOLMSG.PGM", parameters); // not a threadsafe API - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - - // List information returned. - byte[] listInformation = parameters[2].getOutputData(); - handle_ = new byte[4]; - System.arraycopy(listInformation, 8, handle_, 0, 4); - - // Wait for the list-building to complete. - listInformation = ListUtilities.waitForListToComplete(system_, handle_, listInformation); - - length_ = BinaryConverter.byteArrayToInt(listInformation, 0); - dataLength_ = BinaryConverter.byteArrayToInt(listInformation, 32); - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loaded message queue message list, length: " + length_ + ", data length: " + dataLength_ + ", handle: ", handle_); - } - - /** - Receives a message from the message queue by key. This method receives a message of any type except sender's copy. The message is removed from the message queue. See the list of QueuedMessage attribute values which are set on a received message. - @param messageKey The message key. - @return The queued message, or null if the message can not be received. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see com.ibm.as400.access.QueuedMessage#getKey - **/ - public QueuedMessage receive(byte[] messageKey) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving from message queue, message key:", messageKey); - return receive(messageKey, 0, REMOVE, ANY); - } - - /** - Receives a message from the message queue. See the list of QueuedMessage attribute values which are set on a received message. - @param messageKey The message key, or null if no message key is needed. - @param waitTime The number of seconds to wait for the message to arrive in the queue so it can be received. If the message is not received within the specified wait time, null is returned. Special values are: -

      -
    • 0 - Do not wait for the message. If the message is not in the queue and you specified a message key, null is returned. -
    • -1 - Wait until the message arrives in the queue and is received, no matter how long it takes. The system has no limit for the wait time. -
    - @param messageAction The action to take after the message is received. Valid values are: -
      -
    • OLD - Keep the message in the message queue and mark it as an old message. You can receive the message again only by using the message key or by specifying the message type NEXT, PREVIOUS, FIRST, or LAST. -
    • REMOVE - Remove the message from the message queue. The message key is no longer valid, so you cannot receive the message again. -
    • SAME - Keep the message in the message queue without changing its new or old designation. SAME lets you receive the message again later without using the message key. -
    - @param messageType The type of message to return. Valid values are: -
      -
    • ANY - Receives a message of any type except sender's copy. The message key is optional. -
    • COMPLETION - Receives a completion message. The message key is optional. -
    • COPY - Receives the sender's copy of a previously sent inquiry message. The message key is required. -
    • DIAGNOSTIC - Receives a diagnostic message. The message key is optional. -
    • FIRST - Receives the first new or old message in the queue. The message key is disallowed. -
    • INFORMATIONAL - Receives an informational message. The message key is optional. -
    • INQUIRY - Receives an inquiry message. If the action is REMOVE and a reply to the inquiry message has not been sent yet, the default reply is automatically sent when the inquiry message is received. The message key is optional. -
    • LAST - Receives the last new or old message in the queue. The message key is disallowed. -
    • NEXT - Receives the next new or old message after the message with the specified key. You can use the special value TOP for the message key. TOP designates the message at the top of the message queue. The message key is required. -
    • PREVIOUS - Receives the new or old message before the message with the specified key. The message key is required. -
    • REPLY - Receives the reply to an inquiry message. For the message key, you can use the key to the sender's copy of the inquiry or notify message. The message key is optional. -
    - @return The queued message, or null if the message can not be received. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see com.ibm.as400.access.QueuedMessage#getKey - **/ - public QueuedMessage receive(byte[] messageKey, int waitTime, String messageAction, String messageType) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving from message queue, waitTime: " + waitTime + ", messageAction: " + messageAction + ", messageType: " + messageType + ", message key:", messageKey); - if (messageAction == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageAction' is null."); - throw new NullPointerException("messageAction"); - } - if (messageType == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageType' is null."); - throw new NullPointerException("messageType"); - } - - byte[] messageActionBytes; - if (messageAction.equals(OLD)) - { - // EBCDIC '*OLD'. - messageActionBytes = new byte[] { 0x5C, (byte)0xD6, (byte)0xD3, (byte)0xC4, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - } - else if (messageAction.equals(REMOVE)) - { - // EBCDIC '*REMOVE'. - messageActionBytes = new byte[] { 0x5C, (byte)0xD9, (byte)0xC5, (byte)0xD4, (byte)0xD6, (byte)0xE5, (byte)0xC5, 0x40, 0x40, 0x40 }; - } - else if (messageAction.equals(SAME)) - { - // EBCDIC '*SAME'. - messageActionBytes = new byte[] { 0x5C, (byte)0xE2, (byte)0xC1, (byte)0xD4, (byte)0xC5, 0x40, 0x40, 0x40, 0x40, 0x40 }; - } - else - { - Trace.log(Trace.ERROR, "Value of parameter 'messageAction' is not valid: " + messageAction); - throw new ExtendedIllegalArgumentException("messageAction (" + messageAction + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - byte[] messageTypeBytes; - if (messageType.equals(ANY)) - { - // EBCDIC '*ANY'. - messageTypeBytes = new byte[] { 0x5C, (byte)0xC1, (byte)0xD5, (byte)0xE8, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - } - else if (messageType.equals(COMPLETION)) - { - // EBCDIC '*COMP'. - messageTypeBytes = new byte[] { 0x5C, (byte)0xC3, (byte)0xD6, (byte)0xD4, (byte)0xD7, 0x40, 0x40, 0x40, 0x40, 0x40 }; - } - else if (messageType.equals(COPY)) - { - // EBCDIC '*COPY'. - messageTypeBytes = new byte[] { 0x5C, (byte)0xC3, (byte)0xD6, (byte)0xD7, (byte)0xE8, 0x40, 0x40, 0x40, 0x40, 0x40 }; - } - else if (messageType.equals(DIAGNOSTIC)) - { - // EBCDIC '*DIAG'. - messageTypeBytes = new byte[] { 0x5C, (byte)0xC4, (byte)0xC9, (byte)0xC1, (byte)0xC7, 0x40, 0x40, 0x40, 0x40, 0x40 }; - } - else if (messageType.equals(FIRST)) - { - // EBCDIC '*FIRST'. - messageTypeBytes = new byte[] { 0x5C, (byte)0xC6, (byte)0xC9, (byte)0xD9, (byte)0xE2, (byte)0xE3, 0x40, 0x40, 0x40, 0x40 }; - } - else if (messageType.equals(INFORMATIONAL)) - { - // EBCDIC '*INFO'. - messageTypeBytes = new byte[] { 0x5C, (byte)0xC9, (byte)0xD5, (byte)0xC6, (byte)0xD6, 0x40, 0x40, 0x40, 0x40, 0x40 }; - } - else if (messageType.equals(INQUIRY)) - { - // EBCDIC '*INQ'. - messageTypeBytes = new byte[] { 0x5C, (byte)0xC9, (byte)0xD5, (byte)0xD8, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - } - else if (messageType.equals(LAST)) - { - // EBCDIC '*LAST'. - messageTypeBytes = new byte[] { 0x5C, (byte)0xD3, (byte)0xC1, (byte)0xE2, (byte)0xE3, 0x40, 0x40, 0x40, 0x40, 0x40 }; - } - else if (messageType.equals(NEXT)) - { - // EBCDIC '*NEXT'. - messageTypeBytes = new byte[] { 0x5C, (byte)0xD5, (byte)0xC5, (byte)0xE7, (byte)0xE3, 0x40, 0x40, 0x40, 0x40, 0x40 }; - } - else if (messageType.equals(PREVIOUS)) - { - // EBCDIC '*PRV'. - messageTypeBytes = new byte[] { 0x5C, (byte)0xD7, (byte)0xD9, (byte)0xE5, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - } - else if (messageType.equals(REPLY)) - { - // EBCDIC '*RPY'. - messageTypeBytes = new byte[] { 0x5C, (byte)0xD9, (byte)0xD7, (byte)0xE8, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - } - else - { - Trace.log(Trace.ERROR, "Value of parameter 'messageType' is not valid: " + messageType); - throw new ExtendedIllegalArgumentException("messageType (" + messageType + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (messageKey == null && - (messageType.equals(COPY) || - messageType.equals(NEXT) || - messageType.equals(PREVIOUS))) - { - Trace.log(Trace.ERROR, "Value of parameter 'messageType' is not valid when messageKey is not specified: " + messageType); - throw new ExtendedIllegalArgumentException("messageType (" + messageType + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Use all spaces for null key. - if (messageKey == null) messageKey = BLANK_KEY; - - resolveQualifiedMessageQueueName(); - - // Setup program parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Message information, output, char(*). - new ProgramParameter(5120), - // Length of message information, input, binary(4). - new ProgramParameter(new byte[] { 0x00, 0x00, 0x14, 0x00 } ), - // Format name, input, char(8), EBCDIC 'RCVM0200'. - new ProgramParameter(new byte[] { (byte)0xD9, (byte)0xC3, (byte)0xE5, (byte)0xD4, (byte)0xF0, (byte)0xF2, (byte)0xF0, (byte)0xF0 } ), - // Qualified message queue name, input, char(20). - new ProgramParameter(qualifiedMessageQueueName_), - // Message type, input, char(10). - new ProgramParameter(messageTypeBytes), - // Message key, input, char(4). - new ProgramParameter(messageKey), - // Wait time, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(waitTime)), - // Message action, input, char(10). - new ProgramParameter(messageActionBytes), - // Error code, I/O, char(*). - new ErrorCodeParameter() - }; - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QMHRCVM.PGM", parameters); // a threadsafe API - // Note: Even though this is a threadsafe API, some other API's called by this class aren't threadsafe. So to stay consistent, we won't indicate that it can be called on-thread. - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - - byte[] data = parameters[0].getOutputData(); - - int bytesReturned = BinaryConverter.byteArrayToInt(data, 0); - int bytesAvailable = BinaryConverter.byteArrayToInt(data, 4); - - if (bytesReturned == 8 && bytesAvailable == 0) return null; // No message found. - - if (Trace.traceOn_ && bytesReturned < bytesAvailable) Trace.log(Trace.WARNING, "Possible truncation receiving from message queue, bytes returned: " + bytesReturned + ", bytesAvailable:", bytesAvailable); - - resolveConverter(); - - int messageSeverity = BinaryConverter.byteArrayToInt(data, 8); - // Blank for impromptu message. - String messageIdentifier = conv_.byteArrayToString(data, 12, 7).trim(); - - int messageTypeReturned = (data[19] & 0x0F) * 10 + (data[20] & 0x0F); - byte[] messageKeyReturned = new byte[4]; - // Blank for a message action of *REMOVE. - System.arraycopy(data, 21, messageKeyReturned, 0, 4); - String messageFileName = conv_.byteArrayToString(data, 25, 10).trim(); - String messageFileLibraryUsed = conv_.byteArrayToString(data, 45, 10).trim(); - - String sendingJob = conv_.byteArrayToString(data, 55, 10).trim(); - String sendingJobsUserProfile = conv_.byteArrayToString(data, 65, 10).trim(); - String sendingJobNumber = conv_.byteArrayToString(data, 75, 6); - String sendingProgramName = conv_.byteArrayToString(data, 81, 12).trim(); - String dateSent = conv_.byteArrayToString(data, 97, 7); // CYYMMDD. - String timeSent = conv_.byteArrayToString(data, 104, 6); // HHMMSS. - String alertOption = conv_.byteArrayToString(data, 135, 9).trim(); - - int lengthDataReturned = BinaryConverter.byteArrayToInt(data, 152); - int lengthMessageReturned = BinaryConverter.byteArrayToInt(data, 160); - int lengthHelpReturned = BinaryConverter.byteArrayToInt(data, 168); - - byte[] replacementDataBytes = new byte[lengthDataReturned]; - System.arraycopy(data, 176, replacementDataBytes, 0, lengthDataReturned); - - String messageData = lengthMessageReturned != 0 ? conv_.byteArrayToString(data, 176 + lengthDataReturned, lengthMessageReturned) : conv_.byteArrayToString(replacementDataBytes, 0, lengthDataReturned, 0); - - String messageHelp = lengthHelpReturned != 0 ? conv_.byteArrayToString(data, 176 + lengthDataReturned + lengthMessageReturned, lengthHelpReturned) : null; - - QueuedMessage message = new QueuedMessage(this, messageSeverity, messageIdentifier, messageTypeReturned, messageKeyReturned, messageFileName, messageFileLibraryUsed, sendingJob, sendingJobsUserProfile, sendingJobNumber, sendingProgramName, dateSent, timeSent, replacementDataBytes, messageData, messageHelp, alertOption); - synchronized (this) - { - if (handle_ != null) closeHandle_ = true; - } - return message; - } - - /** - Remove all messages from the message queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void remove() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // EBCDIC '*ALL'. - removeMessages(new byte[] { 0x5C, (byte)0xC1, (byte)0xD3, (byte)0xD3, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }, BLANK_KEY); - } - - /** - Removes a message from the message queue. - @param messageKey The message key. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void remove(byte[] messageKey) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (messageKey == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageKey' is null."); - throw new NullPointerException("messageKey"); - } - // EBCDIC '*BYKEY'. - removeMessages(new byte[] { 0x5C, (byte)0xC2, (byte)0xE8, (byte)0xD2, (byte)0xC5, (byte)0xE8, 0x40, 0x40, 0x40, 0x40 }, messageKey); - } - - /** - Remove messages from the message queue. - @param messageType The type of message to remove. Valid values are: -
      -
    • ALL - All messages in the message queue. -
    • KEEP_UNANSWERED - All messages in the message queue except unanswered inquiry and unanswered senders' copy messages. -
    • NEW - All new messages in the message queue. New messages are those that have not been received. -
    • OLD - All old messages in the message queue. Old messages are those that have already been received. -
    - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void remove(String messageType) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (messageType == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageType' is null."); - throw new NullPointerException("messageType"); - } - byte[] messageTypeBytes; - if (messageType.equals(ALL)) - { - // EBCDIC '*ALL'. - messageTypeBytes = new byte[] { 0x5C, (byte)0xC1, (byte)0xD3, (byte)0xD3, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - } - else if (messageType.equals(KEEP_UNANSWERED)) - { - // EBCDIC '*KEEPUNANS'. - messageTypeBytes = new byte[] { 0x5C, (byte)0xD2, (byte)0xC5, (byte)0xC5, (byte)0xD7, (byte)0xE4, (byte)0xD5, (byte)0xC1, (byte)0xD5, (byte)0xE2 }; - } - else if (messageType.equals(NEW)) - { - // EBCDIC '*NEW'. - messageTypeBytes = new byte[] { 0x5C, (byte)0xD5, (byte)0xC5, (byte)0xE6, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - } - else if (messageType.equals(OLD)) - { - // EBCDIC '*OLD'. - messageTypeBytes = new byte[] { 0x5C, (byte)0xD6, (byte)0xD3, (byte)0xC4, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - } - else - { - Trace.log(Trace.ERROR, "Value of parameter 'messageType' is not valid: " + messageType); - throw new ExtendedIllegalArgumentException("messageType (" + messageType + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - removeMessages(messageTypeBytes, BLANK_KEY); - } - - // Helper method. - private void removeMessages(byte[] messageType, byte[] messageKey) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - resolveQualifiedMessageQueueName(); - - // Setup program parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Qualified message queue name, input, char(20). - new ProgramParameter(qualifiedMessageQueueName_), - // Message key, input, char(4). - new ProgramParameter(messageKey), - // Messages to remove, input, char(10). - new ProgramParameter(messageType), - // Error code, I/O, char(*). - new ErrorCodeParameter() - }; - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QMHRMVM.PGM", parameters); // a threadsafe API - // Note: Even though this is a threadsafe API, some other API's called by this class aren't threadsafe. So to stay consistent, we won't indicate that it can be called on-thread. - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - synchronized (this) - { - if (handle_ != null) closeHandle_ = true; - } - } - - /** - Removes the PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes the VetoableChangeListener. If the VetoableChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - // Cache the converter object for reuse. - private synchronized void resolveConverter() throws IOException - { - if (conv_ == null) conv_ = new Converter(system_.getCcsid(), system_); - } - - // Cache the converted qualified message queue name for reuse. - private synchronized void resolveQualifiedMessageQueueName() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (qualifiedMessageQueueName_ != null) return; - resolveConverter(); - qualifiedMessageQueueName_ = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - if (path_.equals(CURRENT)) - { - // Need to retrieve the message queue name from the user profile object. - User user = new User(system_, system_.getUserId()); - user.loadUserInformation(); - QSYSObjectPathName ifs = new QSYSObjectPathName(user.getMessageQueue()); - conv_.stringToByteArray(ifs.getObjectName(), qualifiedMessageQueueName_, 0); - conv_.stringToByteArray(ifs.getLibraryName(), qualifiedMessageQueueName_, 10); - } - else - { - conv_.stringToByteArray(name_, qualifiedMessageQueueName_, 0); - conv_.stringToByteArray(library_, qualifiedMessageQueueName_, 10); - } - } - - /** - Replies to and removes a message. - @param messageKey The message key. - @param replyText The reply. To send the default reply stored in the message description, use blanks for this parameter. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void reply(byte[] messageKey, String replyText) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - reply(messageKey, replyText, true); - } - - /** - Replies to and removes a message if requested. - @param messageKey The message key. - @param replyText The reply. To send the default reply stored in the message description, use blanks for this parameter. - @param remove true to remove the inquiry message and the reply from the message queue after the reply is sent, false to keep the inquiry message and the reply after the reply is sent. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void reply(byte[] messageKey, String replyText, boolean remove) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (messageKey == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageKey' is null."); - throw new NullPointerException("messageKey"); - } - if (replyText == null) - { - Trace.log(Trace.ERROR, "Parameter 'replyText' is null."); - throw new NullPointerException("replyText"); - } - - resolveConverter(); - byte[] replyBytes = conv_.stringToByteArray(replyText); - // Set remove to EBCDIC '*YES' or EBCDIC '*NO'. - byte[] removeBytes = remove ? new byte[] { 0x5C, (byte)0xE8, (byte)0xC5, (byte)0xE2, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 } : new byte[] { 0x5C, (byte)0xD5, (byte)0xD6, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - - resolveQualifiedMessageQueueName(); - - // Setup program parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Message key, input, char(4). - new ProgramParameter(messageKey), - // Qualified message queue name, input, char(20). - new ProgramParameter(qualifiedMessageQueueName_), - // Reply text, input, char(*). - new ProgramParameter(replyBytes), - // Length of reply text, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(replyBytes.length)), - // Remove message, input, char(10). - new ProgramParameter(removeBytes), - // Error code, I/O, char(*). - new ErrorCodeParameter() - }; - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QMHSNDRM.PGM", parameters); // a threadsafe API - // Note: Even though this is a threadsafe API, some other API's called by this class aren't threadsafe. So to stay consistent, we won't indicate that it can be called on-thread. - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - synchronized (this) - { - if (handle_ != null) closeHandle_ = true; - } - } - - // Helper method. - private byte[] send(String messageID, String messageFile, byte[] data, byte[] messageType, String replyQueue) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - resolveConverter(); - byte[] idBytes = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - if (messageID != null) - { - conv_.stringToByteArray(messageID, idBytes, 0, 7); - } - byte[] messageFileName = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - if (messageFile != null) - { - QSYSObjectPathName ifs = new QSYSObjectPathName(messageFile, "MSGF"); - conv_.stringToByteArray(ifs.getObjectName(), messageFileName, 0); - conv_.stringToByteArray(ifs.getLibraryName(), messageFileName, 10); - } - if (data == null) data = new byte[0]; - byte[] messageQueueName = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - if (path_.equals(CURRENT)) - { - conv_.stringToByteArray(system_.getUserId(), messageQueueName, 0); - // Library is EBCDIC '*USER'. - System.arraycopy(new byte[] { 0x5C, (byte)0xE4, (byte)0xE2, (byte)0xC5, (byte)0xD9 }, 0, messageQueueName, 10, 5); - } - else - { - QSYSObjectPathName ifs = new QSYSObjectPathName(path_); - conv_.stringToByteArray(ifs.getObjectName(), messageQueueName, 0); - conv_.stringToByteArray(ifs.getLibraryName(), messageQueueName, 10); - } - byte[] replyMessageQueueName = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - if (replyQueue != null) - { - QSYSObjectPathName ifs = new QSYSObjectPathName(replyQueue, "MSGQ"); - conv_.stringToByteArray(ifs.getObjectName(), replyMessageQueueName, 0); - conv_.stringToByteArray(ifs.getLibraryName(), replyMessageQueueName, 10); - } - - // Setup program parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Message identifier, input, char(7). - new ProgramParameter(idBytes), - // Qualified message file name, input, char(20). - new ProgramParameter(messageFileName), - // Message data or immediate text, input, char(*). - new ProgramParameter(data), - // Length of message data or immediate text, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(data.length)), - // Message type, input, char(10). - new ProgramParameter(messageType), - // List of qualified message queue names, input, array of char(20). - new ProgramParameter(messageQueueName), - // Number of message queues, input, binary(4). - new ProgramParameter(new byte[] { 0x00, 0x00, 0x00, 0x01 } ), - // Qualified name of the reply message queue, input, char(20). - new ProgramParameter(replyMessageQueueName), - // Message key, output, char(4). - new ProgramParameter(4), - // Error code, I/O, char(*). - new ErrorCodeParameter() - }; - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QMHSNDM.PGM", parameters); // a threadsafe API - // Note: Even though this is a threadsafe API, some other API's called by this class aren't threadsafe. So to stay consistent, we won't indicate that it can be called on-thread. - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - - synchronized (this) - { - if (handle_ != null) closeHandle_ = true; - } - // Return the message key. - return parameters[8].getOutputData(); - } - - /** - Sends an informational message to the message queue. - @param messageID The message ID. - @param messageFile The integrated file system path name of the message file. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void sendInformational(String messageID, String messageFile) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (messageID == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageID' is null."); - throw new NullPointerException("messageID"); - } - if (messageFile == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageFile' is null."); - throw new NullPointerException("messageFile"); - } - // EBCDIC '*INFO'. - send(messageID, messageFile, null, new byte[] { 0x5C, (byte)0xC9, (byte)0xD5, (byte)0xC6, (byte)0xD6, 0x40, 0x40, 0x40, 0x40, 0x40 }, null); - } - - /** - Sends an informational message to the message queue. - @param messageID The message ID. - @param messageFile The integrated file system path name of the message file. - @param substitutionData The substitution data for the message, or null if none. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void sendInformational(String messageID, String messageFile, byte[] substitutionData) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (messageID == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageID' is null."); - throw new NullPointerException("messageID"); - } - if (messageFile == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageFile' is null."); - throw new NullPointerException("messageFile"); - } - // EBCDIC '*INFO'. - send(messageID, messageFile, substitutionData, new byte[] { 0x5C, (byte)0xC9, (byte)0xD5, (byte)0xC6, (byte)0xD6, 0x40, 0x40, 0x40, 0x40, 0x40 }, null); - } - - /** - Sends an informational message to the message queue. - @param messageText The message text. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void sendInformational(String messageText) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (messageText == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageText' is null."); - throw new NullPointerException("messageText"); - } - resolveConverter(); - // EBCDIC '*INFO'. - send(null, null, conv_.stringToByteArray(messageText), new byte[] { 0x5C, (byte)0xC9, (byte)0xD5, (byte)0xC6, (byte)0xD6, 0x40, 0x40, 0x40, 0x40, 0x40 }, null); - } - - /** - Sends an inquiry message to the message queue. - @param messageID The message ID. - @param messageFile The integrated file system path name of the message file. - @param replyMessageQueue The integrated file system path name of the reply message queue. - @return The message key. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public byte[] sendInquiry(String messageID, String messageFile, String replyMessageQueue) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (messageID == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageID' is null."); - throw new NullPointerException("messageID"); - } - if (messageFile == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageFile' is null."); - throw new NullPointerException("messageFile"); - } - if (replyMessageQueue == null) - { - Trace.log(Trace.ERROR, "Parameter 'replyMessageQueue' is null."); - throw new NullPointerException("replyMessageQueue"); - } - // EBCDIC '*INQ'. - return send(messageID, messageFile, null, new byte[] { 0x5C, (byte)0xC9, (byte)0xD5, (byte)0xD8, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }, replyMessageQueue); - } - - /** - Sends an inquiry message to the message queue. - @param messageID The message ID. - @param messageFile The integrated file system path name of the message file. - @param substitutionData The substitution data for the message, or null if none. - @param replyMessageQueue The integrated file system path name of the reply message queue. - @return The message key. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public byte[] sendInquiry(String messageID, String messageFile, byte[] substitutionData, String replyMessageQueue) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (messageID == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageID' is null."); - throw new NullPointerException("messageID"); - } - if (messageFile == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageFile' is null."); - throw new NullPointerException("messageFile"); - } - if (replyMessageQueue == null) - { - Trace.log(Trace.ERROR, "Parameter 'replyMessageQueue' is null."); - throw new NullPointerException("replyMessageQueue"); - } - // EBCDIC '*INQ'. - return send(messageID, messageFile, substitutionData, new byte[] { 0x5C, (byte)0xC9, (byte)0xD5, (byte)0xD8, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }, replyMessageQueue); - } - - /** - Sends an inquiry message to the message queue. - @param messageText The message text. - @param replyMessageQueue The integrated file system path name of the reply message queue. - @return The message key. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public byte[] sendInquiry(String messageText, String replyMessageQueue) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (messageText == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageText' is null."); - throw new NullPointerException("messageText"); - } - if (replyMessageQueue == null) - { - Trace.log(Trace.ERROR, "Parameter 'replyMessageQueue' is null."); - throw new NullPointerException("replyMessageQueue"); - } - resolveConverter(); - // EBCDIC '*INQ'. - return send(null, null, conv_.stringToByteArray(messageText), new byte[] { 0x5C, (byte)0xC9, (byte)0xD5, (byte)0xD8, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }, replyMessageQueue); - } - - /** - Sets the help text formatting value. Possible values are: -
      -
    • {@link com.ibm.as400.access.MessageFile#NO_FORMATTING MessageFile.NO_FORMATTING} - The help text is returned as a string of characters. This is the default. -
    • {@link com.ibm.as400.access.MessageFile#RETURN_FORMATTING_CHARACTERS MessageFile.RETURN_FORMATTING_CHARACTERS} - The help text contains formatting characters. The formatting characters are: -
        -
      • &N -- Force a new line. -
      • &P -- Force a new line and indent the new line six characters. -
      • &B -- Force a new line and indent the new line four characters. -
      -
    • {@link com.ibm.as400.access.MessageFile#SUBSTITUTE_FORMATTING_CHARACTERS MessageFile.SUBSTITUTE_FORMATTING_CHARACTERS} - The MessageFile class replaces formatting characters with new line and space characters. -
    - @param helpTextFormatting The help text formatting value. - **/ - public void setHelpTextFormatting(int helpTextFormatting) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting help text formatting:", helpTextFormatting); - if (helpTextFormatting < MessageFile.NO_FORMATTING || helpTextFormatting > MessageFile.SUBSTITUTE_FORMATTING_CHARACTERS) - { - Trace.log(Trace.ERROR, "Value of parameter 'helpTextFormatting' is not valid: " + helpTextFormatting); - throw new ExtendedIllegalArgumentException("helpTextFormatting (" + helpTextFormatting + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - synchronized (this) - { - helpTextFormatting_ = helpTextFormatting; - if (handle_ != null) closeHandle_ = true; - } - } - - /** - Sets the list direction. - @param listDirection true to list the messages in order from oldest to newest; false to list the messages in order from newest to oldest. The default is true. - @see #getListDirection - **/ - public void setListDirection(boolean listDirection) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting list direction:", listDirection); - synchronized (this) - { - listDirection_ = listDirection; - if (handle_ != null) closeHandle_ = true; - } - } - - /** - Sets whether the list should be sorted by message type when {@link #ALL ALL} messages are selected for retrieval. If the selection criteria is set to something other than {@link #ALL ALL}, the sort setting is ignored. - @param sort true to indicate the messages should be sorted; false to indicate no sorting should be performed on the message list. - @see #getSort - **/ - public void setSort(boolean sort) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting sort:", sort); - synchronized (this) - { - sort_ = sort; - if (handle_ != null) closeHandle_ = true; - } - } - - /** - Sets the fully qualified integrated file system path name of the message queue. The default is CURRENT. The path cannot be changed if the MessageQueue object has established a connection to the system. - @param path The fully qualified integrated file system path name of the message queue, or CURRENT to refer to the user's default message queue. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setPath(String path) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting path: " + path); - if (path == null) - { - Trace.log(Trace.ERROR, "Parameter 'path' is null."); - throw new NullPointerException("path"); - } - if (handle_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property 'path' after connect."); - throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - synchronized (this) - { - if (!path.equals(CURRENT)) - { - // Validate the path and save the name and library. - QSYSObjectPathName ifs = new QSYSObjectPathName(path, "MSGQ"); - library_ = ifs.getLibraryName(); - name_ = ifs.getObjectName(); - } - path_ = path; - qualifiedMessageQueueName_ = null; - } - } - else - { - String oldValue = path_; - String newValue = path; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("path", oldValue, newValue); - } - synchronized (this) - { - if (!path.equals(CURRENT)) - { - // Validate the path and save the name and library. - QSYSObjectPathName ifs = new QSYSObjectPathName(path, "MSGQ"); - library_ = ifs.getLibraryName(); - name_ = ifs.getObjectName(); - } - path_ = path; - qualifiedMessageQueueName_ = null; - } - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("path", oldValue, newValue); - } - } - } - - /** - Sets whether or not to include messages that need a reply in the returned list of messages. Passing true to all three message selection setters is equivalent to retrieving all the messages. By default, all messages are retrieved. - @param selectMessagesNeedReply true to include messages that need a reply; false to exclude messages that need a reply. - @see #isSelectMessagesNeedReply - @see #setSelectMessagesNoNeedReply - @see #setSelectSendersCopyMessagesNeedReply - **/ - public void setSelectMessagesNeedReply(boolean selectMessagesNeedReply) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting messages that need a reply are selected:", selectMessagesNeedReply); - synchronized (this) - { - selectMessagesNeedReply_ = selectMessagesNeedReply; - if (handle_ != null) closeHandle_ = true; - } - } - - /** - Sets whether or not to include messages that do not need a reply in the returned list of messages. Passing true to all three message selection setters is equivalent to retrieving all the messages. By default, all messages are retrieved. - @param selectMessagesNoNeedReply true to include messages that do not need a reply; false to exclude messages that do not need a reply. - @see #isSelectMessagesNoNeedReply - @see #setSelectMessagesNeedReply - @see #setSelectSendersCopyMessagesNeedReply - **/ - public void setSelectMessagesNoNeedReply(boolean selectMessagesNoNeedReply) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting messages that do not need a reply are selected:", selectMessagesNoNeedReply); - synchronized (this) - { - selectMessagesNoNeedReply_ = selectMessagesNoNeedReply; - if (handle_ != null) closeHandle_ = true; - } - } - - /** - Sets whether or not to include sender's copy messages that need a reply in the returned list of messages. Passing true to all three message selection setters is equivalent to retrieving all the messages. By default, all messages are retrieved. - @param selectSendersCopyMessagesNeedReply true to include sender's copy messages that need a reply; false to exclude sender's copy messages that need a reply. - @see #isSelectSendersCopyMessagesNeedReply - @see #setSelectMessagesNeedReply - @see #setSelectMessagesNoNeedReply - **/ - public void setSelectSendersCopyMessagesNeedReply(boolean selectSendersCopyMessagesNeedReply) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting sender's copy messages that need a reply are selected:", selectSendersCopyMessagesNeedReply); - synchronized (this) - { - selectSendersCopyMessagesNeedReply_ = selectSendersCopyMessagesNeedReply; - if (handle_ != null) closeHandle_ = true; - } - } - - /** - Sets the selection that describes which messages are returned. The default is ALL. This takes effect the next time the list of queue messages is retrieved or refreshed. -

    Note: This method resets the selection criteria set by the {@link #setSelectMessagesNeedReply setSelectMessagesNeedReply()}, {@link #setSelectMessagesNoNeedReply setSelectMessagesNoNeedReply()}, and {@link #setSelectSendersCopyMessagesNeedReply setSelectSendersCopyMessagesNeedReply()}. Using this method will only set one of the above to true, unless {@link #ALL ALL} is specified, which will set all three of them to true. To include combinations of the three criteria, use the individual setters instead of this method. - @param selection The selection. Valid values are: -

      -
    • {@link #ALL ALL} -
    • {@link #MESSAGES_NEED_REPLY MESSAGES_NEED_REPLY} -
    • {@link #MESSAGES_NO_NEED_REPLY MESSAGES_NO_NEED_REPLY} -
    • {@link #SENDERS_COPY_NEED_REPLY SENDERS_COPY_NEED_REPLY} -
    - @exception PropertyVetoException If any of the registered listeners vetos the property change. - @deprecated Use {@link #setSelectMessagesNeedReply setSelectMessagesNeedReply(boolean)}, {@link #setSelectMessagesNoNeedReply setSelectMessagesNoNeedReply(boolean)}, and {@link #setSelectSendersCopyMessagesNeedReply setSelectSendersCopyMessagesNeedReply(boolean)} instead. - **/ - public void setSelection(String selection) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting selection: " + selection); - if (selection == null) - { - Trace.log(Trace.ERROR, "Parameter 'selection' is null."); - throw new NullPointerException("selection"); - } - if (!selection.equals(ALL) && !selection.equals(MESSAGES_NEED_REPLY) && !selection.equals(MESSAGES_NO_NEED_REPLY) && !selection.equals(SENDERS_COPY_NEED_REPLY)) - { - Trace.log(Trace.ERROR, "Value of parameter 'selection' is not valid: " + selection); - throw new ExtendedIllegalArgumentException("selection (" + selection + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - synchronized (this) - { - selection_ = selection; - boolean all = selection.equals(ALL); - selectMessagesNeedReply_ = all || selection.equals(MESSAGES_NEED_REPLY); - selectMessagesNoNeedReply_ = all || selection.equals(MESSAGES_NO_NEED_REPLY); - selectSendersCopyMessagesNeedReply_ = all || selection.equals(SENDERS_COPY_NEED_REPLY); - if (handle_ != null) closeHandle_ = true; - } - } - else - { - String oldValue = selection_; - String newValue = selection; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("selection", oldValue, newValue); - } - synchronized (this) - { - selection_ = selection; - boolean all = selection.equals(ALL); - selectMessagesNeedReply_ = all || selection.equals(MESSAGES_NEED_REPLY); - selectMessagesNoNeedReply_ = all || selection.equals(MESSAGES_NO_NEED_REPLY); - selectSendersCopyMessagesNeedReply_ = all || selection.equals(SENDERS_COPY_NEED_REPLY); - if (handle_ != null) closeHandle_ = true; - } - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("selection", oldValue, newValue); - } - } - } - - /** - Sets the severity of the messages which are returned. All messages of the specified severity and greater are returned. The default is 0. This takes effect the next time that the list of queued messages is retrieved or refreshed. - @param severity The severity of the messages to be returned. The value must be between 0 and 99, inclusive. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - @see com.ibm.as400.resource.RMessageQueue#SEVERITY_CRITERIA - **/ - public void setSeverity(int severity) throws PropertyVetoException - { - if ((severity < 0) || (severity > 99)) - { - Trace.log(Trace.ERROR, "Value of parameter 'severity' is not valid: " + severity); - throw new ExtendedIllegalArgumentException("severity (" + severity + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - severity_ = severity; - } - else - { - Integer oldValue = new Integer(severity_); - Integer newValue = new Integer(severity); - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("severity", oldValue, newValue); - } - severity_ = severity; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("severity", oldValue, newValue); - } - } - synchronized (this) - { - if (handle_ != null) closeHandle_ = true; - } - } - - /** - Sets the system. This cannot be changed if the object has established a connection to the system. - @param system The system object representing the system on which the message queue exists. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setSystem(AS400 system) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (handle_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - synchronized (this) - { - system_ = system; - conv_ = null; - qualifiedMessageQueueName_ = null; - } - } - else - { - AS400 oldValue = system_; - AS400 newValue = system; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("system", oldValue, newValue); - } - synchronized (this) - { - system_ = system; - conv_ = null; - qualifiedMessageQueueName_ = null; - } - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("system", oldValue, newValue); - } - } - } - - /** - Sets the starting message key used to begin searching for messages to list from the corresponding entry in the message queue. Any valid message key will work, including {@link #NEWEST NEWEST} and {@link #OLDEST OLDEST}. If the key of a reply message is specified, the message search begins with the inquiry or sender's copy message associated with that reply, not the reply message itself. -

    If the message queue is set to {@link #CURRENT CURRENT}, then the key represents the starting message key for the current user's user message queue. - @param userStartingMessageKey The key. Specify null to set it back to the default, which will be OLDEST or NEWEST based on the list direction. - **/ - public void setUserStartingMessageKey(byte[] userStartingMessageKey) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting user starting message key:", userStartingMessageKey); - synchronized (this) - { - userStartingMessageKey_ = userStartingMessageKey; - if (handle_ != null) closeHandle_ = true; - } - } - - /** - Sets the starting message key used to begin searching for messages to list from the corresponding entry in the message queue. Any valid message key will work, including {@link #NEWEST NEWEST} and {@link #OLDEST OLDEST}. If the key of a reply message is specified, the message search begins with the inquiry or sender's copy message associated with that reply, not the reply message itself. -

    If the message queue is set to {@link #CURRENT CURRENT}, then the key represents the starting message key for the current user's workstation message queue. - @param workstationStartingMessageKey The key. Specify null to set it back to the default. - **/ - public void setWorkstationStartingMessageKey(byte[] workstationStartingMessageKey) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting workstation starting message key:", workstationStartingMessageKey); - synchronized (this) - { - workstationStartingMessageKey_ = workstationStartingMessageKey; - if (handle_ != null) closeHandle_ = true; - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/MessageQueue16.gif b/cvsroot/src/com/ibm/as400/access/MessageQueue16.gif deleted file mode 100644 index 73d0723bd..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/MessageQueue16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/MessageQueue32.gif b/cvsroot/src/com/ibm/as400/access/MessageQueue32.gif deleted file mode 100644 index 447b5f9fe..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/MessageQueue32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/MessageQueueBeanInfo.java b/cvsroot/src/com/ibm/as400/access/MessageQueueBeanInfo.java deleted file mode 100644 index 6a62847a0..000000000 --- a/cvsroot/src/com/ibm/as400/access/MessageQueueBeanInfo.java +++ /dev/null @@ -1,145 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MessageQueueBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - Provides bean information for the MessageQueue class. - **/ -public class MessageQueueBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private static final Class BEAN_CLASS = MessageQueue.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - // Set up the event set descriptors. - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - - eventSetDescriptors = new EventSetDescriptor[] { propertyChange, vetoableChange }; - - // Set up the property descriptors. - PropertyDescriptor system = new PropertyDescriptor("system", BEAN_CLASS); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - - PropertyDescriptor path = new PropertyDescriptor("path", BEAN_CLASS); - path.setBound(true); - path.setConstrained(true); - path.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_PATH")); - path.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_PATH")); - - propertyDescriptors = new PropertyDescriptor[] { system, path }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the additional bean information. - @return The additional bean information. - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return null; - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return Zero (0), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "propertyChange" event. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. Possible values are: -

      -
    • BeanInfo.ICON_MONO_16x16 -
    • BeanInfo.ICON_MONO_32x32 -
    • BeanInfo.ICON_COLOR_16x16 -
    • BeanInfo.ICON_COLOR_32x32 -
    - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("MessageQueue16.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("MessageQueue32.gif"); - } - Trace.log(Trace.ERROR, "Value of parameter 'icon' is not valid:", icon); - throw new ExtendedIllegalArgumentException("icon (" + icon + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/Mlog.java b/cvsroot/src/com/ibm/as400/access/Mlog.java deleted file mode 100644 index 36c30bdbf..000000000 --- a/cvsroot/src/com/ibm/as400/access/Mlog.java +++ /dev/null @@ -1,193 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Mlog.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2005-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import sun.misc.MessageUtils; - -/** - * Mlog is a debugging tool. - * - *

    Multi-threading considerations: - * Probably not thread-safe if several threads have access to the same - * instance. - * - */ - -import java.nio.CharBuffer; - -/* * - * This class is used for tracing purposes - * - */ -class Mlog -{ - final static char[] hexa = new char[] {'0','1','2','3','4','5','6','7', - '8','9','a','b','c','d','e','f'}; - - static int loRange = 100; - static int hiRange = 100; - static int cnt = 1; - - static boolean logFlag; - - public static boolean logEnable( boolean newFlag ) - { - boolean oldFlag = logFlag; - logFlag = newFlag; - return oldFlag; - } - - public static void putLine( String s ) - { - if (!logFlag) return; - int len = s.length(); - if (len <= (loRange + hiRange)) - MessageUtils.out( cnt++ + ": " + s ); - else - { - MessageUtils.out( cnt++ + ": " + s.substring( 0, loRange ) ); - MessageUtils.out( ". . . " + (len - loRange - hiRange) + " chars omitted . . ." ); - MessageUtils.out( s.substring( len - hiRange, len ) ); - } - } - - public static String toHex( char[] chars, boolean compact ) - { - return toHex( chars, 0, chars.length, compact ); - } - - public static String toHex( char[] input, int offset, int limit, boolean compact ) - { - if (limit <= offset) return ""; - int len = limit - offset; - char[] chars = new char[len * 5]; - int k = 0; - int c; - for (int i = offset; i < limit; i++) - { - c = input[i]; - if (c < 0x100) - { - if (!compact) - { - chars[k++] = '0'; - chars[k++] = '0'; - } - } - else - { - chars[k++] = hexa[c >> 12]; - chars[k++] = hexa[(c & 0x0F00) >> 8]; - } - chars[k++] = hexa[(c & 0x00F0) >> 4]; - chars[k++] = hexa[c & 0x000F]; - chars[k++] = ' '; - } - return new String( chars, 0, k - 1 ); - } - - public static String toHex( String s, boolean compact ) - { - return toHex( s.toCharArray(), 0, s.length(), compact ); - } - - public static void putHexLine( char[] input, boolean compact ) - { - if (logFlag) putHexLine( input, 0, input.length, compact ); - } - - public static void putHexLine( char[] input, int offset, int limit, boolean compact ) - { - if (!logFlag) return; - int len = limit - offset; - if (len <= (loRange + hiRange)) - { - MessageUtils.out( cnt + ": " + toHex( input, offset, limit, compact ) ); - MessageUtils.out( cnt++ + ": " + new String( input, offset, limit - offset ) ); - } - else - { - MessageUtils.out( cnt + ": " + toHex( input, offset, offset + loRange, compact ) ); - MessageUtils.out( ". . . " + (len - loRange - hiRange) + " chars omitted . . ." ); - MessageUtils.out( toHex( input, limit - hiRange, limit, compact ) ); - MessageUtils.out( cnt++ + ": " + new String( input, offset, loRange ) ); - MessageUtils.out( ". . . " + (len - loRange - hiRange) + " chars omitted . . ." ); - MessageUtils.out( new String( input, limit - hiRange, hiRange ) ); - } - } - - public static void putHexLine( String s ) - { - if (logFlag) putHexLine( s.toCharArray(), false ); - } - - public static void putHexLine( String s, boolean compact ) - { - if (logFlag) putHexLine( s.toCharArray(), compact ); - } - - public static boolean logReturn( boolean flag ) - { - if (logFlag) putLine( "return flag = " + flag ); - return flag; - } - - public static char[] logReturn( char[] chars ) - { - if (logFlag) - { - putLine( "return chars = " + toHex( chars, true ) ); - cnt--; - putLine( "return chars = " + new String( chars ) ); - } - return chars; - } - - public static String logReturn( String s ) - { - if (logFlag) - { - putLine( "return string = " + toHex( s, true ) ); - cnt--; - putLine( "return string = " + s ); - } - return s; - } - - public static CharBuffer logReturn( CharBuffer cb ) - { - if (logFlag) - { - putLine( "return buffer = " + toHex( cb.toString(), true ) ); - cnt--; - putLine( "return buffer = " + cb.toString() ); - } - return cb; - } - - public static void printStackTrace( String s ) - { - if (!logFlag) return; - Exception e = new Exception(); - StackTraceElement[] stack = e.getStackTrace(); - putLine( "Entering: " + s ); - for (int i = 1; i < stack.length; i++) - { - cnt--; - putLine( " " + stack[i].toString() ); - } - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/NLS.java b/cvsroot/src/com/ibm/as400/access/NLS.java deleted file mode 100644 index 26860d543..000000000 --- a/cvsroot/src/com/ibm/as400/access/NLS.java +++ /dev/null @@ -1,336 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NLS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.util.*; - -/** - * The NLS class contains a set of static methods that can be used - * to access various pieces of National Language Support information - * (such as language and country descriptions) on a system. -**/ -public final class NLS -{ - private static final String CLASSNAME = "com.ibm.as400.access.NLS"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - private static int countryBytes_ = 11000; - private static int languageBytes_ = 3000; - private static final Hashtable languages_ = new Hashtable(); - private static final Hashtable countries_ = new Hashtable(); - - static boolean forceJavaTables_ = false; - - private NLS() - { - } - - - //@B0A - /** - * Returns a best-guess Java encoding given a CCSID. - * @param ccsid The coded character set identifier (CCSID), e.g. 37. - * @return The encoding that maps to the given CCSID, or null - * if one is not known. - * @see #encodingToCCSID - * @see #localeToCCSID - **/ - public static String ccsidToEncoding(int ccsid) - { - return (String)ConversionMaps.ccsidEncoding_.get(Integer.toString(ccsid)); - } - - - //@B0A - /** - * Returns a best-guess CCSID given a Java encoding. - * @param encoding The encoding, e.g. "Cp037". - * @return The CCSID that maps to the given encoding, or -1 - * if one is not known. - * @see #ccsidToEncoding - * @see #localeToCCSID - **/ - public static int encodingToCCSID(String encoding) - { - if (encoding == null) return -1; - String ccsid = (String)ConversionMaps.encodingCcsid_.get(encoding); - if (ccsid == null) return -1; - return Integer.parseInt(ccsid); - } - - - //@B0A - /** - * Returns a best-guess CCSID given a Java locale string. - * Note that the CCSID returned will be the preferred system CCSID, i.e. - * usually EBCDIC. So, the locale string representing English "en" will - * return the single-byte EBCDIC CCSID of 37. - * @param localeString The locale string, e.g. "de_CH". - * @return The CCSID that maps the given locale string, or -1 - * if one is not known. - **/ - public static int localeToCCSID(String localeString) - { - if (localeString == null) return -1; - String ls = localeString.trim(); - while (ls != null && ls.length() > 0) - { - String ccsidString = (String)ConversionMaps.localeCcsidMap_.get(ls); - if (ccsidString != null) - { - return Integer.parseInt(ccsidString); - } - ls = ls.substring(0, ls.lastIndexOf('_')); - } - return -1; - } - - - //@B0A - /** - * Returns a best-guess CCSID given a Java Locale object. - * Note that the CCSID returned will be the preferred system CCSID, i.e. - * usually EBCDIC. So, the Locale representing English ({@link java.util.Locale#ENGLISH Locale.ENGLISH}) - * will return the single-byte EBCDIC CCSID of 37. - * @param locale The Locale object. - * @return The CCSID that maps the given locale, or -1 - * if one is not known. - **/ - public static int localeToCCSID(Locale locale) - { - if (locale == null) return -1; - String ls = locale.toString(); - return localeToCCSID(ls); - } - - - /** - * Returns a best-guess National Language Version (NLV) string given a Java locale string. - * If there is no known mapping for the given Locale or one of its parents (e.g. "en" is a parent of "en_US"), - * then "" is returned. - * @param localeString The locale string, e.g. "de_CH". - * @return The NLV string (e.g. "2924") that maps the given locale, or "" if one is not known. - **/ - public static String localeToNLV(String localeString) - { - if (localeString == null) return ""; - String ls = localeString.trim(); - while (ls != null && ls.length() > 0) - { - String nlvString = (String)ConversionMaps.localeNlvMap_.get(ls); - if (nlvString != null) - { - return nlvString; - } - ls = ls.substring(0, ls.lastIndexOf('_')); - } - return ""; - } - - - /** - * Returns a best-guess National Language Version (NLV) string given a Java Locale object. - * If there is no known mapping for the given Locale or one of its parents (e.g. "en" is a parent of "en_US"), - * then "" is returned. - * @param locale The Locale object. - * @return The NLV string (e.g. "2924") that maps the given locale, or "" if one is not known. - **/ - public static String localeToNLV(Locale locale) - { - if (locale == null) return ""; - String ls = locale.toString(); - return localeToNLV(ls); - } - - - /** - * Retrieves the descriptive text for the specified country or region identifier. - * The list is cached, so that a subsequent call to this method will - * return immediately if the specified country or region identifier is in the list. - * If it is not in the list, the system will be queried. - * @param system The system. - * @param countryID The country or region identifier. - * @return The descriptive text. - * @see #getLanguageDescription - **/ - public static String getCountryDescription(AS400 system, String countryID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - countryID = countryID.trim().toUpperCase(); - String description = (String)countries_.get(countryID); - if (description == null) - { - // Retrieve it from the system. - int ccsid = system.getCcsid(); - ConvTable conv = ConvTable.getTable(ccsid, null); - ProgramParameter[] parms = new ProgramParameter[4]; - parms[0] = new ProgramParameter(countryBytes_); // receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(countryBytes_)); // length of receiver variable - parms[2] = new ProgramParameter(conv.stringToByteArray("RTVC0100")); // format name - parms[3] = new ProgramParameter(new byte[4]); // error code - - ProgramCall pc = new ProgramCall(system, "/QSYS.LIB/QLGRTVCI.PGM", parms); - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - // Note: The V5R1 API doc has the wrong offsets. - byte[] output = parms[0].getOutputData(); - int bytesReturned = BinaryConverter.byteArrayToInt(output, 0); - int bytesAvailable = BinaryConverter.byteArrayToInt(output, 4); - int offset = BinaryConverter.byteArrayToInt(output, 12); - if (bytesAvailable > bytesReturned) - { - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "Increasing RetrieveCountryID chunk size from "+countryBytes_+" to "+(bytesAvailable+offset)+" and re-retrieving."); - } - countryBytes_ = bytesAvailable+offset; - return getCountryDescription(system, countryID); - } - ccsid = BinaryConverter.byteArrayToInt(output, 8); - conv = ConvTable.getTable(ccsid, null); - int numberOfIDs = BinaryConverter.byteArrayToInt(output, 16); - for (int i=0; i bytesReturned) - { - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "Increasing RetrieveLanguageID chunk size from "+languageBytes_+" to "+(bytesAvailable+offset)+" and re-retrieving."); - } - languageBytes_ = bytesAvailable+offset; - return getLanguageDescription(system, languageID); - } - int numberOfIDs = BinaryConverter.byteArrayToInt(output, 8); - ccsid = BinaryConverter.byteArrayToInt(output, 12); - conv = ConvTable.getTable(ccsid, null); - for (int i=0; i - * The usefulness of this method is arbitrary. Typically, applications only need to - * force Java conversion if they are seeing inconsistent character conversion between - * an older release of the Toolbox and a newer one. Some problem characters include - * EBCDIC line feeds and a few characters in Katakana, such as the middle dot or bullet. - * @param forceJavaTables Specify true if the Java Runtime Environement converter tables are used; - * false if the Toolbox converter tables are used. The default is false. - * @see #isForceJavaConversion - **/ - public static void setForceJavaConversion(boolean forceJavaTables) - { - forceJavaTables_ = forceJavaTables; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/NLSExchangeAttrReply.java b/cvsroot/src/com/ibm/as400/access/NLSExchangeAttrReply.java deleted file mode 100644 index 981a60ec7..000000000 --- a/cvsroot/src/com/ibm/as400/access/NLSExchangeAttrReply.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NLSExchangeAttrReply.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.IOException; - -class NLSExchangeAttrReply extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - int primaryRC_=0; // return code returned by server - int secondaryRC_=0; // return code returned by server - int ccsid_=0; // host CCSCID - - NLSExchangeAttrReply() - { - super(); - } - - public int getCcsid() - { - return ccsid_; - } - - public Object getNewDataStream() - { - return new NLSExchangeAttrReply(); - } - - public int hashCode() - { - return 0x1301; // returns the reply ID - } - - public int readAfterHeader(InputStream in) throws IOException - { - // read in rest of data - int bytes=super.readAfterHeader(in); - // get return codes - primaryRC_ = get16bit(HEADER_LENGTH+2); - secondaryRC_ = get16bit(HEADER_LENGTH+4); - ccsid_ = get32bit(HEADER_LENGTH+8); - // Note: chain, datastream level, version, function levels - // not currently used. - return bytes; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/NLSExchangeAttrRequest.java b/cvsroot/src/com/ibm/as400/access/NLSExchangeAttrRequest.java deleted file mode 100644 index 2c358ac76..000000000 --- a/cvsroot/src/com/ibm/as400/access/NLSExchangeAttrRequest.java +++ /dev/null @@ -1,45 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NLSExchangeAttrRequest.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// ---------------------------------------------------- -// Exchange Attributes -// ---------------------------------------------------- -class NLSExchangeAttrRequest extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - NLSExchangeAttrRequest() - { - super(); - data_ = new byte [38]; - setLength(38); - setHeaderID(0); - setServerID(0xe000); - setCSInstance(0); - setCorrelation(0); - setTemplateLen(18); - setReqRepID(0x1301); - - set16bit(0, 20); // chain, not used - set16bit(0, 22); // datastream level - set32bit(13488, 24); // client CCSID - set32bit(0x0310, 28); // client version, not currently used - // by server, always set to v3r1m0 - set16bit(0, 32); // license management level - set16bit(0, 34); // system management level - set16bit(0, 36); // NLS level - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/NLSImpl.java b/cvsroot/src/com/ibm/as400/access/NLSImpl.java deleted file mode 100644 index 68148e96a..000000000 --- a/cvsroot/src/com/ibm/as400/access/NLSImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NLSImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.net.UnknownHostException; - -// Abstract base class that supports native and remote implementations of central server function -abstract class NLSImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - AS400ImplRemote system_; - - void setSystem(AS400ImplRemote system) - { - system_ = system; - } - - abstract void connect() throws ServerStartupException, UnknownHostException, AS400SecurityException, ConnectionDroppedException, InterruptedException, IOException; - abstract void disconnect(); - abstract int getCcsid() throws IOException; -//@B0D abstract char[] getTable(int fromCCSID, int toCCSID) throws ConnectionDroppedException, IOException, InterruptedException; -} diff --git a/cvsroot/src/com/ibm/as400/access/NLSImplNative.java b/cvsroot/src/com/ibm/as400/access/NLSImplNative.java deleted file mode 100644 index f2907a223..000000000 --- a/cvsroot/src/com/ibm/as400/access/NLSImplNative.java +++ /dev/null @@ -1,88 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NLSImplNative.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.net.UnknownHostException; - -// Native implementation of Central Server function -class NLSImplNative extends NLSImpl -{ - private static final String CLASSNAME = "com.ibm.as400.access.NLSImplNative"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - static - { - NativeMethods.loadNativeLibraryQyjspart(); - } - - - // connect to the central server of the server. - void connect() throws ServerStartupException, UnknownHostException, AS400SecurityException, ConnectionDroppedException, InterruptedException, IOException - { - } - - - // Disconnect from the central server. - void disconnect() - { - - } - - - // Get the job ccsid - int getCcsid() throws IOException - { - try - { - // Call native method - return ccsidNative(); - } - catch(NativeException e) // Exception detected in C code - { - // Map to IOException - throw new IOException(); - } - } - - // Download table - /*@B0D char[] getTable(int fromCCSID, int toCCSID) throws ConnectionDroppedException, IOException, InterruptedException - { - try - { - // call native method - byte[] byteData = tableNative(fromCCSID, toCCSID); - // convert byte array to char array - char[] table = new char[256]; - for (int i = 0, ii = 0; i < 256; ++i, ii+=2) - { - table[i] = (char)(((byteData[ii] & 0xFF) << 8) + - (byteData[ii+1] & 0xFF)); - } - return table; - } - catch (NativeException e) // Exception detected in C code - { - // Map to IOException - throw new IOException(); - } - } - @B0D*/ - - native int ccsidNative() throws NativeException; - //@B0D private native byte[] tableNative(int fromCCSID, int toCCSID) throws NativeException; -} diff --git a/cvsroot/src/com/ibm/as400/access/NLSImplRemote.java b/cvsroot/src/com/ibm/as400/access/NLSImplRemote.java deleted file mode 100644 index 4d5523a68..000000000 --- a/cvsroot/src/com/ibm/as400/access/NLSImplRemote.java +++ /dev/null @@ -1,133 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NLSImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.net.UnknownHostException; - -// Remote implementation of central server function -class NLSImplRemote extends NLSImpl -{ - static - { - AS400Server.addReplyStream(new NLSExchangeAttrReply(), AS400.CENTRAL); -//@B0D AS400Server.addReplyStream(new NLSGetTableReply(), AS400.CENTRAL); - } - - private AS400Server server_; - private int ccsid_; - - - // connect to the central server of the server. - void connect() throws ServerStartupException, UnknownHostException, AS400SecurityException, ConnectionDroppedException, InterruptedException, IOException - { - // Connect to server - if(server_ == null) - { - server_ = system_.getConnection(AS400.CENTRAL, false); - - // Exchange attributes with server job. (This must be first - // exchange with server job to complete initialization.) - // First check to see if server has already been initialized - // by another user. - synchronized (server_) - { - DataStream baseReply = server_.getExchangeAttrReply(); - if(baseReply == null) - { - try - { - baseReply = server_.sendExchangeAttrRequest(new NLSExchangeAttrRequest()); - } - catch(IOException e) - { - Trace.log(Trace.ERROR, "IOException After Exchange Attribute Request"); - disconnect(); - throw e; - } - if(baseReply instanceof NLSExchangeAttrReply) - { - // means request completed OK - NLSExchangeAttrReply NLSReply = (NLSExchangeAttrReply)baseReply; - if(NLSReply.primaryRC_ != 0) - { - Trace.log(Trace.WARNING, "Exchange attribute failed, primary return code =", NLSReply.primaryRC_); - Trace.log(Trace.ERROR, "Exchange attribute failed, secondary return code =", NLSReply.secondaryRC_ ); - disconnect(); - throw new IOException(); - } - else - { - ccsid_ = NLSReply.getCcsid(); - } - } - else // unknown data stream - { - Trace.log(Trace.ERROR, "Unknown instance returned from Exchange Attribute Reply"); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - } - } - } - - - // Disconnect from the central server. - void disconnect() - { - if(server_ != null) - { - try - { - system_.disconnectServer(server_); - server_ = null; - } - catch(Exception e) {} - } - } - - - int getCcsid() throws IOException - { - return ccsid_; - } - - - // Download table -/*@B0D char[] getTable(int fromCCSID, int toCCSID) throws ConnectionDroppedException, IOException, InterruptedException - { - NLSGetTableRequest reqDs = new NLSGetTableRequest(); - reqDs.setCCSIDs(fromCCSID, toCCSID); - DataStream repDs = this.server.sendAndReceive(reqDs); - if (repDs instanceof NLSGetTableReply) - { - NLSGetTableReply NLSReply = (NLSGetTableReply)repDs; - if (NLSReply.primaryRC_ != 0) - { - Trace.log(Trace.WARNING, "Exchange attribute failed, primary return code =", NLSReply.primaryRC_); - Trace.log(Trace.ERROR, "Exchange attribute failed, secondary return code =", NLSReply.secondaryRC_ ); - throw new IOException(); - } - return NLSReply.table_; - } - else // unknown data stream - { - Trace.log(Trace.ERROR, "Unknown instance returned from Exchange Attribute Reply"); - disconnect(); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - } -@B0D*/ - -} diff --git a/cvsroot/src/com/ibm/as400/access/NPAttrBin4.java b/cvsroot/src/com/ibm/as400/access/NPAttrBin4.java deleted file mode 100644 index 83ea1b648..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPAttrBin4.java +++ /dev/null @@ -1,87 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPAttrBin4.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * For a list of valid attribute IDs, see the NPObject class. - **/ - -class NPAttrBin4 extends NPAttribute implements Cloneable, - java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - - - private int attrValue_; // stored 4 byte value in PC terms - - NPAttrBin4(NPAttrBin4 attr) - { - super(attr); - attrValue_ = attr.attrValue_; - } - - NPAttrBin4(int ID) - { - super(ID, FOUR_BYTE); - } - - NPAttrBin4(int ID, int value) - { - super(ID, FOUR_BYTE); - set(value); - } - - NPAttrBin4(int ID, - byte[] hostDataStream, - int offset, - int length) - { - super(ID, FOUR_BYTE, hostDataStream, offset, length, null); - attrValue_ = BinaryConverter.byteArrayToInt(getHostData(null), 0); // @B1C - } - - protected Object clone() - { - NPAttrBin4 attr; - attr = new NPAttrBin4(this); - return attr; - } - - int get() - { - return attrValue_; - } - - - void set(int value) - { - byte[] hostValue = new byte[4]; - attrValue_ = value; - BinaryConverter.intToByteArray(attrValue_, hostValue, 0); // move int into byte array - super.setHostData(hostValue, null); // @B1C - } - - void setHostData(byte[] data, ConverterImpl converter) // @B1C - { - super.setHostData(data, converter); // @B1C - attrValue_ = BinaryConverter.byteArrayToInt(getHostData(converter), 0); // @B1C - } - -} // end of class NPAttrBin4 - - diff --git a/cvsroot/src/com/ibm/as400/access/NPAttrFloat.java b/cvsroot/src/com/ibm/as400/access/NPAttrFloat.java deleted file mode 100644 index c10eec3cd..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPAttrFloat.java +++ /dev/null @@ -1,227 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPAttrFloat.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * For a list of valid attribute IDs, see the NPObject class. - **/ - -class NPAttrFloat extends NPAttribute implements Cloneable, - java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - - // - // we are always dealing with packed 15,5 numbers so just make these - // static constants. If we ever have to deal with other types of packed - // numbers we can make these variables and change them on the constructor - // based on the attribute ID and the conversion code should still work. - // - private static final int DIGITS = 15; - private static final int DECIMALPT = 5; - - private float attrValue_; // stored float value in PC terms - - NPAttrFloat(NPAttrFloat attr) - { - super(attr); - attrValue_ = attr.attrValue_; - } - - NPAttrFloat(int ID) - { - super(ID, FLOAT); - } - - NPAttrFloat(int ID, float value) - { - super(ID, FLOAT); - set(value); - } - - NPAttrFloat(int ID, - byte[] hostDataStream, - int offset, - int length) - { - super(ID, FLOAT, hostDataStream, offset, length, null); - buildFloatFromHostData(); - } - - /** buildHostData - builds the PACKED 15,5 byte data from the float value - **/ - private void buildHostData() - { - byte[] hostValue; // array to hold our packed decimal number - int position; // position goes from -decimalPt to +(digits-decimalPt). - int digit; // value of the digit we are on - int needed; // number of bytes needed - - int byteIndex; // current byte - boolean fHighNibble; // current nibble (high or low) - double MyNumber; // working copy of the float number - double mult; - - // I have to add a fraction to the number because of rounding errors. If I don't do this - // then if you say - // double x = 12.657; (for example) - // unsigned y = (unsigned)x*1000; - // y will be 12656 - not what I want! So, I say y = (unsigned)((x+.0001)*1000) and that - // works. I think this is because 12.657 may really not be exactly that, internally - // it may be 12.656999999 is as close as the machine can get to 12.657. - MyNumber = Math.abs(attrValue_); // work with the positive number - MyNumber += 0.000001; // fix any rounding errors - - // find out how many bytes are need to hold this guy - // needed = (unsigned)((((float)digits+1)/2)+0.5); - needed = (int)((((float)DIGITS+1)/2)+0.5); // should be 8 - byteIndex = needed - 1; // start with the last byte - hostValue = new byte[needed]; // allocate host byte array - - // mult is the multplier you need to get the current digit (we start with the least - // significant one) into the 1's column of the number - we then use a cast to integer - // to drop the fractional part of the number and a %10 to drop the part of the number - // that is 10 or over (that's how we get this one digit). - // - // if you have a packed decimal(11,3), mult would start at 1000 and go to - // 1x10**(-8) when you finished the for loop. - mult = Math.pow(10, DECIMALPT); - - // First put the sign nibble in the lowest order nibble. - // 0x0F = positive - // 0x0D = negative - if (attrValue_ < 0) // if this number is negative - { - hostValue[byteIndex] = 0x0D; // negative sign - } else { - hostValue[byteIndex] = 0x0F; // positive sign - } /* endif */ - - // fHighNibble indicates which half-byte we're working on. - // We started with the low nibble and used it for the sign, - // now we're on the high nibble. - fHighNibble = true; // go to high order nibble - - for (position = -DECIMALPT; position < (DIGITS - DECIMALPT) ; position++ ) - { - digit = (int)(MyNumber*mult) % 10; - mult /= 10; - if (!fHighNibble) - { - hostValue[byteIndex] = (byte)digit; // put it in the low nibble (and zero the high) - } else { - hostValue[byteIndex] |= (byte)digit << 4; // mask it in on the high nibble. - byteIndex--; // go to next byte. - } /* endif */ - fHighNibble = !fHighNibble; - } /* endfor */ - - super.setHostData(hostValue, null); // @B1C - } - - // sets the value of attrValue_ based on the current super's host data array - private void buildFloatFromHostData() - { - int needed = (int)((((float)DIGITS+1)/2)+0.5); // should be 8 for us - int i, j; - double mult; - boolean fHighNibble; // current nibble (high or low) - byte[] hostData; // packed 15,5 number - int byteIndex; // index into hostData array - - attrValue_ = 0.0F; - - hostData = super.getHostData(null); // @B1C - - if (hostData != null) - { - byteIndex = 0; - mult = Math.pow(10.0,(double)DIGITS-(double)DECIMALPT-1); - - - // we should ALWAYS end the loop with fHighNibble == FALSE - // if digits is ODD - // start with high nibble of first byte - // else - // there is a wasted nibble, so start with low nibble of first byte - if ((DIGITS%2) != 0) - { - fHighNibble = true; - } else { - fHighNibble = false; - } /* endif */ - - for (i=0; i < DIGITS; i++) - { - if (fHighNibble) - { - j = (int)(hostData[byteIndex]) >> 4; // get high nibble - j = j & 0x0F; // mask hi order @B3 - // so int is signed correctly. - } else { - j = (int)(hostData[byteIndex]) & 0x0F; // get low nibble - byteIndex++; - } /* endif */ - fHighNibble = !fHighNibble; - - // should we check j to be >= 0 && <= 9 here? - attrValue_ += j*(float)mult; - mult /= 10.0; - - } /* endfor */ - - // put a sign on number - // if low order nibble of *pBuf is 0x0D - // number is negative - // else - // number is positive (low nibble should be 0x0F) - j = (int)(hostData[byteIndex]) & 0x0F; - if (j == 0x0D) - { - attrValue_ *= -1.0; - } /* endif */ - } /* endif - hostData == NULL */ - - } - - protected Object clone() - { - NPAttrFloat attr; - attr = new NPAttrFloat(this); - return attr; - } - - float get() - { - return attrValue_; - } - - - void set(float value) - { - attrValue_ = value; - buildHostData(); - } - - void setHostData(byte[] data, ConverterImpl converter) // @B1C - { - super.setHostData(data, converter); // @B1C - buildFloatFromHostData(); - } - -} // end of class NPAttrFloat diff --git a/cvsroot/src/com/ibm/as400/access/NPAttrString.java b/cvsroot/src/com/ibm/as400/access/NPAttrString.java deleted file mode 100644 index c79fd877a..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPAttrString.java +++ /dev/null @@ -1,173 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPAttrString.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * For a list of valid attribute IDs, see the NPObject class. - * - **/ - -class NPAttrString extends NPAttribute implements Cloneable, - java.io.Serializable -{ - static final long serialVersionUID = 4L; - - private String attrValue_; // stored string byte value in PC terms - - NPAttrString(NPAttrString attr) - { - super(attr); - attrValue_ = attr.attrValue_; - } - - NPAttrString(int ID) - { - super(ID, STRING); - } - - /** - * construct a new NPAttrString with the specified ID and value. - * the value will be copied (you can modify it later and it won't - * affect this attribute's value - **/ - NPAttrString(int ID, String value) - { - super(ID, STRING); - set(value); - } - - NPAttrString(int ID, - byte[] hostDataStream, - int offset, - int length, - ConverterImpl hostConverter) - { - super(ID, STRING, hostDataStream, offset, length, hostConverter); - buildStringFromHostData(hostConverter); - } - - private void buildHostString(ConverterImpl converter) - { - byte[] hostValue; - hostValue = new byte[attrValue_.length() + 1]; // EBCDIC string must be null-terminated - byte[] temp = converter.stringToByteArray(attrValue_); // move string into byte array - System.arraycopy(temp, 0, hostValue, 0, hostValue.length-1); - hostValue[hostValue.length-1] = 0; // null terminate - super.setHostData(hostValue, converter); - } - - private void buildStringFromHostData(ConverterImpl converter) - { - byte[] hostValue = super.getHostData(converter); - if ((hostValue == null) || (hostValue.length == 0)) - { - attrValue_ = ""; - } else { - attrValue_ = converter.byteArrayToString(hostValue, 0, hostValue.length-1); - attrValue_ = attrValue_.trim(); - } - - } - - protected Object clone() - { - NPAttrString attr; - attr = new NPAttrString(this); - return attr; - } - - String get() - { - return attrValue_; - } - - - - byte[] getHostData(ConverterImpl converter) - { - buildHostString(converter); // update host data with our string - return super.getHostData(converter); - } - - int getHostLength(ConverterImpl converter) - { - buildHostString(converter); // update host data with our string - return super.getHostLength(converter); - } - - void set(String value) - { - attrValue_ = value; - - ///////////////////////////////////////////////// - // We must upper case object names, but we can't - // uppercase everything. The specified attrs - // below shoudn't be uppercased - ///////////////////////////////////////////////// - if ( (getID() != PrintObject.ATTR_USERCMT) && - (getID() != PrintObject.ATTR_USERDATA) && - (getID() != PrintObject.ATTR_RMTPRTQ) && - (getID() != PrintObject.ATTR_IPP_ATTR_NL) && - (getID() != PrintObject.ATTR_IPP_PRINTER_NAME) && - (getID() != PrintObject.ATTR_IPP_JOB_NAME) && - (getID() != PrintObject.ATTR_IPP_JOB_NAME_NL) && - (getID() != PrintObject.ATTR_IPP_JOB_ORIGUSER) && - (getID() != PrintObject.ATTR_IPP_JOB_ORIGUSER_NL) && - (getID() != PrintObject.ATTR_RMTSYSTEM) && - (getID() != PrintObject.ATTR_FORMTYPE) && - (getID() != PrintObject.ATTR_USRDEFDATA) && - (getID() != PrintObject.ATTR_USRDEFOPT) && - (getID() != PrintObject.ATTR_DESCRIPTION) - ) - { - ///////////////////////////////////////////////// - // If the string is not zero length, - // upper case names that don't start with a - // quotation mark - ///////////////////////////////////////////////// - if (value.length() != 0) - { - if (!value.startsWith("\"")) - { - // only uppercase characters which are lower case alphabetic characters - String sAlphabet = "abcdefghijklmnopqrstuvwxyz"; - StringBuffer sbOutput = new StringBuffer(); - - for(int i = 0;i PrintObject.MAX_ATTR_ID)) - { - fRC = false; - } else { - if (ID < 0) - { - ID = java.lang.Math.abs(ID) - 1; - if (ID >= NPAttributeIFS.ifsAttrs.length) - { - fRC = false; - } - } - } - return fRC; - } - - - // @B1D void setConverter(Converter newConverter ) - // @B1D { - // @B1D converterObj_ = newConverter; - // @B1D } - - void setHostData(byte[] data, ConverterImpl converter) // @B1C - { - // make this a deep copy in case the caller wants to - // modify or reuse the param passed in later - hostData_ = new byte[data.length]; - System.arraycopy(data, 0, - hostData_, 0, - data.length); - } - - void setType(int newType) - { - attrType_ = newType; - } - - - - -} // end of class NPAttribute - diff --git a/cvsroot/src/com/ibm/as400/access/NPAttributeIFS.java b/cvsroot/src/com/ibm/as400/access/NPAttributeIFS.java deleted file mode 100644 index b2f72922c..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPAttributeIFS.java +++ /dev/null @@ -1,168 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPAttributeIFS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPAttributeIFS class - This class exists because we must expose all - * object names as IFS path names instead of their object name, library - * name and type but the underlying network print datastream uses - * seperate attribute IDs for object name, library and sometimes type. - * The easiest way to map back and forth between IFSpath and the object name, - * library, and type for us it to handle it at the lowest level. This is in - * the NPCPAttributeIDList.java and NPAttributeValue.java code for us. - * - * The design to handle the QSYSObjectPathName was to create new Attribute IDs that - * are negative for IFSPath attributes. Each QSYSObjectPathName Attribute ID corresponds - * to 2 attribute IDs (one for the object name and one for the library) and - * then either 1 attribute ID for the type or a string if the type is contant. - * - * Instances of this class contain 3 attribute IDs and a string. Two of the - * attributes IDs (for the object name and library) will always be valid. The - * third is used for the object type and may be 0 if the type is always a constant. - * The string is for the object type and will be a valid string if the object type - * attribute ID is 0 or it will be null if the type is dynamic. - * So, an instance of this class can be use to map between the IFSPath name - * and the individual components of that path name. - * - * This class contains a static array of instances of this class called 'ifsAttrs'. - * The IFS attributes IDs (the attribute IDs that are negative) can be used - * to index into this array by taking the absolute value of that negative ID and - * then subtracting 1 to make it 0 based. - * - **/ -class NPAttributeIFS -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - //@A1C - Now there are 14 IFS attributes - static final int NUM_IFS_ATTRS = 14; // there are 14 IFS attributes thus far - static final NPAttributeIFS[] ifsAttrs = new NPAttributeIFS[NUM_IFS_ATTRS]; - static - { - /* -1 is ATTR_BACK_OVERLAY */ - ifsAttrs[java.lang.Math.abs(PrintObject.ATTR_BACK_OVERLAY) - 1] = - new NPAttributeIFS(PrintObject.ATTR_BKOVRLAY, - PrintObject.ATTR_BKOVRLLIB, - 0, - "OVL"); - - /* -2 is ATTR_DATA_QUEUE */ - ifsAttrs[java.lang.Math.abs(PrintObject.ATTR_DATA_QUEUE) - 1] = - new NPAttributeIFS(PrintObject.ATTR_DATAQUE, - PrintObject.ATTR_DATAQUELIB, - 0, - "DTAQ"); - - /* -3 is ATTR_FORM_DEFINITION */ - ifsAttrs[java.lang.Math.abs(PrintObject.ATTR_FORM_DEFINITION) - 1] = - new NPAttributeIFS(PrintObject.ATTR_FORMDEF, - PrintObject.ATTR_FORMDEFLIB, - 0, - "FORMDF"); - - /* -4 is ATTR_FRONT_OVERLAY */ - ifsAttrs[java.lang.Math.abs(PrintObject.ATTR_FRONT_OVERLAY) - 1] = - new NPAttributeIFS(PrintObject.ATTR_FTOVRLAY, - PrintObject.ATTR_FTOVRLLIB, - 0, - "OVL"); - - /* -5 is ATTR_MESSAGE_QUEUE */ - ifsAttrs[java.lang.Math.abs(PrintObject.ATTR_MESSAGE_QUEUE) - 1] = - new NPAttributeIFS(PrintObject.ATTR_MSGQUE, - PrintObject.ATTR_MSGQUELIB, - 0, - "MSGQ"); - - /* -6 is ATTR_OUTPUT_QUEUE */ - ifsAttrs[java.lang.Math.abs(PrintObject.ATTR_OUTPUT_QUEUE) - 1] = - new NPAttributeIFS(PrintObject.ATTR_OUTQUE, - PrintObject.ATTR_OUTQUELIB, - 0, - "OUTQ"); - - /* -7 is ATTR_PRINTER_FILE */ - ifsAttrs[java.lang.Math.abs(PrintObject.ATTR_PRINTER_FILE) - 1] = - new NPAttributeIFS(PrintObject.ATTR_PRTFILE, - PrintObject.ATTR_PRTFLIB, - 0, - "FILE"); - - /* -8 is ATTR_WORKSTATION_CUST_OBJECT */ - ifsAttrs[java.lang.Math.abs(PrintObject.ATTR_WORKSTATION_CUST_OBJECT) - 1] = - new NPAttributeIFS(PrintObject.ATTR_WSCUSTMOBJ, - PrintObject.ATTR_WSCUSTMOBJL, - 0, - "WSCST"); - - /* -9 is ATTR_USER_DEFINED_OBJECT */ - ifsAttrs[java.lang.Math.abs(PrintObject.ATTR_USER_DEFINED_OBJECT) - 1] = - new NPAttributeIFS(PrintObject.ATTR_USRDEFOBJ, - PrintObject.ATTR_USRDEFOBJLIB, - PrintObject.ATTR_USRDEFOBJTYP, - null); - - /* -10 is ATTR_USER_TRANSFORM_PROG */ - ifsAttrs[java.lang.Math.abs(PrintObject.ATTR_USER_TRANSFORM_PROG) - 1] = - new NPAttributeIFS(PrintObject.ATTR_USRTFM, - PrintObject.ATTR_USRTFMLIB, - 0, - "PGM"); - - /* -11 is ATTR_USER_DRIVER_PROG */ - ifsAttrs[java.lang.Math.abs(PrintObject.ATTR_USER_DRIVER_PROG) - 1] = - new NPAttributeIFS(PrintObject.ATTR_USERDRV, - PrintObject.ATTR_USRDRVLIB, - 0, - "PGM"); - - /* -12 is ATTR_AFP_RESOURCE */ - ifsAttrs[java.lang.Math.abs(PrintObject.ATTR_AFP_RESOURCE) - 1] = - new NPAttributeIFS(PrintObject.ATTR_RSCNAME, - PrintObject.ATTR_RSCLIB, - PrintObject.ATTR_RSCTYPE, - null); - - /* -13 is ATTR_PAGE_DEFINITION */ - ifsAttrs[java.lang.Math.abs(PrintObject.ATTR_PAGE_DEFINITION) - 1] = - new NPAttributeIFS(PrintObject.ATTR_PAGDFN, - PrintObject.ATTR_PAGDFNLIB, - 0, - "PAGDFN"); - - /* -14 is ATTR_SAVE_FILE */ - ifsAttrs[java.lang.Math.abs(PrintObject.ATTR_SAVE_FILE) - 1] = - new NPAttributeIFS(PrintObject.ATTR_SAVEFILE, - PrintObject.ATTR_SAVEFILELIB, - 0, - "FILE"); - - } - - - int nameID_; - int libraryID_; - int typeID_; // if typeID_ is 0 use the typeString_ - String typeString_; - - NPAttributeIFS(int objID, int libID, int typeID, String type) - { - nameID_ = objID; - libraryID_ = libID; - typeID_ = typeID; - typeString_ = type; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/NPCPAttribute.java b/cvsroot/src/com/ibm/as400/access/NPCPAttribute.java deleted file mode 100644 index 9979d16ca..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPAttribute.java +++ /dev/null @@ -1,65 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPAttribute.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPCPAttribute class - class for an attribute value list code point used with - * the network print server's data stream. - * This class is derived from NPCPAttribute Value and will be used to build a code - * point that has as its data a list of any attributes. Each attribute consist of - * its ID, its length, its type and an offset to its data. - * -*/ - -class NPCPAttribute extends NPCPAttributeValue implements Cloneable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - - protected Object clone() - { - NPCPAttribute cp = new NPCPAttribute(this); - return cp; - } - - /** - * copy constructor - */ - NPCPAttribute(NPCPAttribute cp) - { - super(cp); - } - - /** - * basic constructor that takes the ID and no data - child class passes in correct ID - */ - NPCPAttribute() - { - super(NPCodePoint.ATTRIBUTE_VALUE); - } - - /** - * constructor that takes the ID and data - child class passes in correct ID - * data should have the form described at the top of the class (nn len ID1...) - */ - NPCPAttribute( byte[] data ) - { - super(NPCodePoint.ATTRIBUTE_VALUE, data); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/NPCPAttributeIDList.java b/cvsroot/src/com/ibm/as400/access/NPCPAttributeIDList.java deleted file mode 100644 index de1801990..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPAttributeIDList.java +++ /dev/null @@ -1,315 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPAttributeIDList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPAttributeIDList class - class for an attribute ID list code point used with - * the network print server's data stream. - * This class is derived from NPCodePoint and will be used to build a code - * point that has as its data a list of attribute IDs. Each ID is a 2 byte - * value defined by the network print server. - * - * The layout of an Attribute List codepoint in memory is: - * - * ------------------------------ - * | LLLL | CPID | data | - * ------------------------------ - * LLLL - four byte code point length - * CPID - code point ID (2 bytes) - * data - code point data as follows: - * --------------------------------------------------- - * |nn | LEN | ID1 | ID2 | ID3 | ID4 | ....... | IDnn| - * --------------------------------------------------- - * nn - two byte total # of attributes in code point - * LEN - two byte length of each attribute entry, right - * now this will be 2 (0x02). - * IDx - two byte attribute ID - * - * The base code point class takes care of the first 6 bytes (LLLL and CPID) - * and we handle the data part of it - * -*/ -class NPCPAttributeIDList extends NPCodePoint implements Cloneable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - - private final static int LEN_ATTRLIST_HEADER = 4; // size of header on this data - - private byte[] idList_; - private boolean fDataOutOfDate_; // is base codepoint raw data out of date? - private boolean fListOutOfDate_; // is our vector out of date? - - - protected Object clone() - { - NPCPAttributeIDList cp = new NPCPAttributeIDList(this); - return cp; - } - - /** - * copy constructor - */ - NPCPAttributeIDList(NPCPAttributeIDList cp) - { - super(cp); - fDataOutOfDate_ = cp.fDataOutOfDate_; - fListOutOfDate_ = cp.fListOutOfDate_; - idList_ = new byte[PrintObject.MAX_ATTR_ID + 1]; - System.arraycopy(cp.idList_, 0, - idList_, 0, - idList_.length); - } - - public NPCPAttributeIDList() - { - super(NPCodePoint.ATTRIBUTE_LIST); // construct codepoint with attribute list ID - fDataOutOfDate_ = false; - fListOutOfDate_ = false; - idList_ = new byte[PrintObject.MAX_ATTR_ID + 1]; - } - - NPCPAttributeIDList(byte[] data ) - { - super(NPCodePoint.ATTRIBUTE_LIST, data); // construct codepoint with attribute list ID - fDataOutOfDate_ = false; - fListOutOfDate_ = true; - idList_ = new byte[PrintObject.MAX_ATTR_ID + 1]; - } - - - // override getLength from NPCodePoint class - // returns total length of code point (data and header) - int getLength() - { - if (fDataOutOfDate_) - { - updateData(); - } - return super.getLength(); - } - - void setDataBuffer( byte[] dataBuffer, int datalen, int offset) - { - fListOutOfDate_ = true; - fDataOutOfDate_ = false; - super.setDataBuffer(dataBuffer, datalen, offset); - } - - // get current data buffer - byte[] getDataBuffer() - { - if (fDataOutOfDate_) - { - updateData(); - } - return super.getDataBuffer(); - } - - // get current data buffer and make it big enough to handle this many bytes - byte[] getDataBuffer(int dataLength) - { - if (fDataOutOfDate_) - { - updateData(); - } - fListOutOfDate_ = true; - return super.getDataBuffer(dataLength); - } - - // override reset() method to wipe out our data - void reset() - { - zeroIDList(); - fListOutOfDate_ = false; - fDataOutOfDate_ = false; - super.reset(); - } - - - - /** - * addAttrID will add the specified Attribute ID to the list if it's not - * there already (if it is there - no harm done). - **/ - void addAttrID(int ID) - { - if (!NPAttribute.idIsValid(ID)) - { - throw(new ExtendedIllegalArgumentException(PrintObject.getAttributeName(ID), - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID)); - } else { - - if (fListOutOfDate_) - { - updateList(); - } - if (ID < 0) - { - ID = java.lang.Math.abs(ID) - 1; - NPAttributeIFS ifsAttr = NPAttributeIFS.ifsAttrs[ID]; - idList_[ifsAttr.nameID_] = (byte)1; - idList_[ifsAttr.libraryID_] = (byte)1; - if (ifsAttr.typeID_ != 0) - { - idList_[ifsAttr.typeID_] = (byte)1; - } - - } else { - idList_[ID] = (byte)1; - } - fDataOutOfDate_ = true; - } - } - - /** - * checks if an ID is contained in the codepoint - * @return true if this ID is in the list - **/ - boolean containsID(int ID) - { - boolean fRC = false; - if (NPAttribute.idIsValid(ID)) - { - if (fListOutOfDate_) - { - updateList(); - } - if (ID < 0) - { - ID = java.lang.Math.abs(ID) - 1; - NPAttributeIFS ifsAttr = NPAttributeIFS.ifsAttrs[ID]; - if ( (idList_[ifsAttr.nameID_] != 0) && - (idList_[ifsAttr.libraryID_] != 0)) - { - if (ifsAttr.typeID_ != 0) - { - if (idList_[ifsAttr.typeID_] != 0) - { - fRC = true; - } - } else { - fRC = true; - } - } - } else { - if (idList_[ID] != 0) - { - fRC = true; - } - } - } - return fRC; - } - - - // private data members & methods - private void updateData() - { - int dataLength, index, elements, dataOffset; - byte[] data; - - elements = 0; - dataLength = LEN_ATTRLIST_HEADER; - for (index = 0; index < idList_.length; index++) - { - if (idList_[index] != 0) - { - elements++; - } - } - dataLength += 2 * elements; - data = super.getDataBuffer(dataLength); - - // set the number of IDs in the codepoint - dataOffset = super.getOffset(); - BinaryConverter.unsignedShortToByteArray(elements, data, dataOffset); - dataOffset += 2; - - // set the length (2) of each ID - BinaryConverter.unsignedShortToByteArray(2, data, dataOffset); - dataOffset += 2; - - // add each ID to the data - for (index = 0; (index < idList_.length) && (elements != 0); index++) - { - if (idList_[index] != 0) - { - BinaryConverter.unsignedShortToByteArray(index, data, dataOffset); - dataOffset += 2; - elements--; - } - } - fDataOutOfDate_ = false; - } // updateData() - - private void updateList() - { - byte[] data; - // zero out array and the rebuild based on data - zeroIDList(); - data = super.getDataBuffer(); - if ( (data != null) && (data.length >= LEN_ATTRLIST_HEADER) ) - { - long dataLength; - int elements, offset; - dataLength = (long)super.getDataLength(); - offset = super.getOffset(); - if (dataLength > LEN_ATTRLIST_HEADER) - { - elements = BinaryConverter.byteArrayToUnsignedShort(data, offset); - offset += 2; - if (elements != 0) - { - int size; - size = BinaryConverter.byteArrayToUnsignedShort(data, offset); - offset += 2; - if ( (size == 2) && (dataLength >= (offset+elements*2)) ) - { - int ID; - while (elements != 0) - { - ID = BinaryConverter.byteArrayToUnsignedShort(data, offset); - offset += 2; - elements--; - if ( (ID <0) || (ID >= idList_.length) ) - { - // ??? throw some sorta programmer error exception here - } else { - idList_[ID] = (byte)1; - } - - } - } - } - } - } - fListOutOfDate_ = false; - } - - private void zeroIDList() - { - int length, index; - length = idList_.length; - for (index=0; index < length; index++) - { - idList_[index] = 0; - } - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/NPCPAttributeValue.java b/cvsroot/src/com/ibm/as400/access/NPCPAttributeValue.java deleted file mode 100644 index 105897097..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPAttributeValue.java +++ /dev/null @@ -1,768 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPAttributeValue.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.UnsupportedEncodingException; -import java.util.Hashtable; -import java.util.Enumeration; - -/** - * NPCPAttributeValue class - class for an attribute value list code point used with - * the network print server's data stream. - * This class is derived from NPCodePoint and will be used to build a code - * point that has as its data a list of attribute. Each attribute consist of - * its ID, its length, its type and an offset to its data. - * - * The layout of an Attribute value codepoint in memory is: - * - * ------------------------------ - * | LLLL | CPID | data | - * ------------------------------ - * LLLL - four byte code point length - * CPID - code point ID (2 bytes) - * data - code point data as follows: - * - * ----------------------------------------------------------------------------------�� - * |nn | LEN | ID1 | tt | llll | ofof | ...... | IDnn| tt | llll | ofof | �values |�� - * ----------------------------------------------------------------------------------�� - * - * nn - two byte total # of attributes in code point - * LEN - two byte length of each attribute entry, right - * now this will be 12 (0x0C). - * IDx - two byte attribute ID - * tt - two byte type of attribute - * llll - four byte length of attribute value - * ofof - four byte offset from beginning of code point to - * attribute value. - * values - list of values for attributes. - * - * There are many codepoints that fall into this structure for their data. This - * class - NPCPAttributeValue - is an Abstract base class for these other classes. - * This class contains all the logic to build the raw data from a list of NPAttributes - * and to build a list of NPAttribute from the raw data. - * -*/ - -abstract class NPCPAttributeValue extends NPCodePoint -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - // private data members - private Hashtable attrTable_; - private boolean fDataOutOfDate_; // is base codepoint raw data out of date? - private boolean fListOutOfDate_; // is our list out of date? - - // package scope data members - final static String emptyString =""; - - // public methods and members - private final static int LEN_ATTR_HEADER = 4; // size of header on this data - private final static int LEN_ATTR_ENTRY = 12; // size of each entry - - NPCPAttributeValue(NPCPAttributeValue cp) - { - super(cp); // call parent's copy ctor - fDataOutOfDate_ = cp.fDataOutOfDate_; - fListOutOfDate_ = cp.fListOutOfDate_; - attrTable_ = new Hashtable(41); - if (fDataOutOfDate_) - { - int i; - NPAttribute attr; - // if the data is out of date, then the list must be up to date - // so we must copy the list over attribute by attribute - for (Enumeration list = cp.attrTable_.elements(); list.hasMoreElements();) - { - attr = (NPAttribute)list.nextElement(); - if (attr != null) - { - try - { - attrTable_.put(new Integer(attr.getID()), attr.clone()); - } - catch(java.lang.CloneNotSupportedException e ) - { - // should never happen unless a certain NPAttribute subclass - // didn't override the clone() method! We will throw a runtime error here - Trace.log(Trace.ERROR, " NPCPAttribributeValue: Error cloning new attribute" + e); - throw new InternalErrorException(e.toString(), InternalErrorException.UNKNOWN); - } - } - } - } else { - // the raw data is upto date we'll rebuild the list of attrs when we - // need to - fListOutOfDate_ = true; - } - } - /** - * basic constructor that takes the ID and no data - child class passes in correct ID - */ - NPCPAttributeValue(int ID) - { - super(ID); // construct codepoint with this ID - fDataOutOfDate_ = false; - fListOutOfDate_ = false; - attrTable_ = new Hashtable(41); - } - - /** - * constructor that takes the ID and data - child class passes in correct ID - * data should have the form described at the top of the class (nn len ID1...) - */ - NPCPAttributeValue( int ID, byte[] data ) - { - super(ID, data); // construct codepoint with this ID - fDataOutOfDate_ = false; - fListOutOfDate_ = true; - attrTable_ = new Hashtable(41); - } - - // override getLength from NPCodePoint class - // returns total length of code point (data and header) - int getLength() - { - if (fDataOutOfDate_) - { - updateData(); - } - return super.getLength(); - } - - // @B2A - Added method below to be package scope only! (for use by PrintObject.java) - boolean getfListOutOfDate() // @B2A - { // @B2A - return fListOutOfDate_; // @B2A - } // @B2A - - - void setDataBuffer( byte[] dataBuffer, int datalen, int offset) - { - fListOutOfDate_ = true; - fDataOutOfDate_ = false; - super.setDataBuffer(dataBuffer, datalen, offset); - } - - // get current data buffer - byte[] getDataBuffer() - { - if (fDataOutOfDate_) - { - updateData(); - } - return super.getDataBuffer(); - } - - // get current data buffer and make it big enough to handle this many bytes - byte[] getDataBuffer(int dataLength) - { - if (fDataOutOfDate_) - { - updateData(); - } - fListOutOfDate_ = true; - return super.getDataBuffer(dataLength); - } - - // override reset() method to wipe out our data - void reset() - { - zeroAttrTable(); - fListOutOfDate_ = false; - fDataOutOfDate_ = false; - super.reset(); - } - - /** - * setAttrValue - add or change the attribute associated with this ID to this - * string value - **/ - void setAttrValue(int attrID, String value) - { - if (!NPAttribute.idIsValid(attrID)) - { - throw(new ExtendedIllegalArgumentException(PrintObject.getAttributeName(attrID), - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID)); - } - - if (fListOutOfDate_) - { - updateList(); - } - - // if the attribute ID is less than 0 this is an IFS type attribute - // and must be broken down into its object name and library. - if (attrID < 0) - { - NPAttributeIFS ifsAttr = - NPAttributeIFS.ifsAttrs[java.lang.Math.abs(attrID) - 1]; - - // if the string starts with a "*" that means it is a special - // value and we should just set the name field to this - if (value.startsWith("*")) - { - attrTable_.put(new Integer(ifsAttr.nameID_), - new NPAttrString(ifsAttr.nameID_, value)); // @B1C - } else { - - QSYSObjectPathName ifsPath = null; - // if the type static, check it in QSYSObjectPathName ctor - if (ifsAttr.typeID_ != 0) - { - ifsPath = new QSYSObjectPathName(value); - } else { - ifsPath = new QSYSObjectPathName(value, ifsAttr.typeString_); - } - - attrTable_.put(new Integer(ifsAttr.nameID_), - new NPAttrString(ifsAttr.nameID_, - ifsPath.getObjectName())); // @B1C - - attrTable_.put(new Integer(ifsAttr.libraryID_), - new NPAttrString(ifsAttr.libraryID_, - ifsPath.getLibraryName()));// @B1C - - // if the type is dynamic, set this also - if (ifsAttr.typeID_ != 0) - { - // convert the type from "OVL" to "*OVL" first - String strType = "*"; - strType += ifsPath.getObjectType(); - attrTable_.put(new Integer(ifsAttr.typeID_), - new NPAttrString(ifsAttr.typeID_, - strType)); // @B1C - } - } - } else { - attrTable_.put(new Integer(attrID), new NPAttrString(attrID, value)); // @B1C - } - fDataOutOfDate_ = true; - - } - - /** - * getStringValue - get the attribute value associated with this ID. - * Throws an exception if the attribute ID is not a - * valid attribute ID. - * Throws an execption if the attribute is not a String - * type attribute. - * - * @param attrID attribute ID from 1 to NPAttribute.MAX_ATTR_ID or one of - * the special negative attribute IDs for IFS Path attributes. - * @return String reference if successful. If this reference is null - * the attribute wasn't found in this code point. - * represents an attribute that is not a String type attribute. - * @see NPObject class - **/ - String getStringValue(int attrID) - { - boolean fRC = false; - String rcString = null; - Object attr; - - if (!NPAttribute.idIsValid(attrID)) - { - throw(new ExtendedIllegalArgumentException(PrintObject.getAttributeName(attrID), - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID)); - } - - if (fListOutOfDate_) - { - updateList(); - } - - // if the attribute ID is less than 0 then it is an IFS type - // attribute ID and we must build the string up from its components - if (attrID < 0) - { - String name = null, lib = null, type = null; - // attribute is an IFS attribute, we must build the string here - NPAttributeIFS ifsAttr = - NPAttributeIFS.ifsAttrs[java.lang.Math.abs(attrID) - 1]; - - - // get the string for the object name - // if this is null we'll end up returning null for the IFS path - attr = attrTable_.get(new Integer(ifsAttr.nameID_)); - if (attr != null) - { - name = ((NPAttrString)attr).get(); - } - - // get the string for the object lib - if (name != null) - {/* check for default case when resource are *INLINE @B5A@B6C */ - // if (0 == name.compareTo("F1DFLT")) /* @B5A@B6C */ - // { - // lib = " "; /* Library will be blank in this case @B5A@B6D */ - //} else { /* @B5A@B6D */ - attr = attrTable_.get(new Integer(ifsAttr.libraryID_)); - if (attr != null) - { - lib = ((NPAttrString)attr).get(); - if ( 0 == lib.compareTo("")){ - lib = " "; - } - } - // } /* end Else @B5A@B6D */ - } - - // get the string for the object type - if (ifsAttr.typeID_ != 0) - { - attr = attrTable_.get(new Integer(ifsAttr.typeID_)); - if (attr != null) - { - // check that attr is a String type - // WHAT to do when it is not? Resource Type is an int! - type = ((NPAttrString)attr).get(); - if ( (type != null) && type.startsWith("*")) - { - type = type.substring(1, type.length());// @B2A correct subs - // type = type.substring(1, type.length()-1); @B3D - } - } - } else { - type = ifsAttr.typeString_; - } - - // if the name is a special value (like *NONE or *FRONTOVL) - // then don't return an IFS path name because the library - // would be blank and the type might not make sense. - if (name != null) - { - if (name.startsWith("*")) - { - rcString = name; - } else { - rcString = QSYSObjectPathName.toPath(lib, name, type); - } - } - - } else { - - attr = attrTable_.get(new Integer(attrID)); - if (attr != null) - { - // make sure this an NPAttrString class object - if (attr instanceof NPAttrString) - { - NPAttrString attrString = (NPAttrString)attr; - // rcString = new String(attrString.get()); - rcString = attrString.get(); - } else { - throw(new ExtendedIllegalArgumentException(PrintObject.getAttributeName(attrID), - ExtendedIllegalArgumentException.PARAMETER_VALUE_DATATYPE_NOT_VALID)); - } - } - } - return rcString; // may be null - } - - /** - * setAttrValue - add or change the attribute associated with this ID to this - * int value - **/ - void setAttrValue(int attrID, int value) - { - if (!NPAttribute.idIsValid(attrID)) - { - throw(new ExtendedIllegalArgumentException(PrintObject.getAttributeName(attrID), - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID)); - } - - if (fListOutOfDate_) - { - updateList(); - } - attrTable_.put(new Integer(attrID), new NPAttrBin4(attrID, value)); - fDataOutOfDate_ = true; - } - - /** - * getIntValue - get the attribute value associated with this ID. - * Throws an exception if the attribute ID is not a - * valid attribute ID. - * Throws an execption if the attribute is not a int - * type attribute. - * - * @param attrID attribute ID from 1 to NPAttribute.MAX_ATTR_ID - * @return Int reference if successful. If this reference is null - * the attribute wasn't found in this code point. - * represents an attribute that is not a Integer type attribute. - * @see NPObject class - **/ - Integer getIntValue(int attrID) - { - boolean fRC = false; - Integer rcInt = null; - Object attr; - - if (!NPAttribute.idIsValid(attrID)) - { - throw(new ExtendedIllegalArgumentException(PrintObject.getAttributeName(attrID), - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID)); - } - - if (fListOutOfDate_) - { - updateList(); - } - attr = attrTable_.get(new Integer(attrID)); - if (attr != null) - { - // make sure this an NPAttrBin4 class object - if (attr instanceof NPAttrBin4) - { - NPAttrBin4 attrBin4= (NPAttrBin4)attr; - rcInt = new Integer(attrBin4.get()); - } else { - throw(new ExtendedIllegalArgumentException(PrintObject.getAttributeName(attrID), - ExtendedIllegalArgumentException.PARAMETER_VALUE_DATATYPE_NOT_VALID)); - } - } - - return rcInt; - } - - /** - * setAttrValue - add or change the attribute associated with this ID to this - * float value - **/ - void setAttrValue(int attrID, float value) - { - if (!NPAttribute.idIsValid(attrID)) - { - throw(new ExtendedIllegalArgumentException(PrintObject.getAttributeName(attrID), - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID)); - } - - if (fListOutOfDate_) - { - updateList(); - } - attrTable_.put(new Integer(attrID), new NPAttrFloat(attrID, value)); - fDataOutOfDate_ = true; - } - - - /** - * getFloatValue - get the attribute value associated with this ID. - * Throws an exception if the attribute ID is not a - * valid attribute ID. - * Throws an execption if the attribute is not a float - * type attribute. - * - * @param attrID attribute ID from 1 to NPAttribute.MAX_ATTR_ID - * @return Float reference if successful. If this reference is null - * the attribute wasn't found in this code point. - * represents an attribute that is not a Float type attribute. - * @see NPObject class - **/ - Float getFloatValue(int attrID) - { - boolean fRC = false; - Float rcFloat = null; - Object attr; - - if (!NPAttribute.idIsValid(attrID)) - { - throw(new ExtendedIllegalArgumentException(PrintObject.getAttributeName(attrID), - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID)); - } - - if (fListOutOfDate_) - { - updateList(); - } - attr = attrTable_.get(new Integer(attrID)); - if (attr != null) - { - // make sure this an NPAttrFloat class object - if (attr instanceof NPAttrFloat) - { - NPAttrFloat attrFloat= (NPAttrFloat)attr; - rcFloat = new Float(attrFloat.get()); - } else { - throw(new ExtendedIllegalArgumentException(PrintObject.getAttributeName(attrID), - ExtendedIllegalArgumentException.PARAMETER_VALUE_DATATYPE_NOT_VALID)); - } - } - return rcFloat; - } - - /** - * addUpdateAttributes - merges the passed in AttributeValue codepoint with this one - * by adding any attributes that aren't already in this codepoint - * and replacing any that are with the ones from the parameter. - **/ - void addUpdateAttributes(NPCPAttributeValue cp) - { - if (fListOutOfDate_) - { - updateList(); - } - if (cp.fListOutOfDate_) - { - cp.updateList(); - } - NPAttribute attr; - for (Enumeration e = cp.attrTable_.elements(); e.hasMoreElements(); ) - { - attr = (NPAttribute)e.nextElement(); - if (attr != null) - { - attrTable_.put(new Integer(attr.getID()), attr); - } - } - - fDataOutOfDate_ = true; /* @A1A */ - - } - - /** - * removeAttribute - removes the attribute with the specified ID from the code point. - * Nothing happens if the attribute currently is not in the code point. - * runtime exception is thrown if the attribute ID is not valid - **/ - void removeAttribute(int attrID) - { - if (!NPAttribute.idIsValid(attrID)) - { - throw(new ExtendedIllegalArgumentException(PrintObject.getAttributeName(attrID), - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID)); - } - if (fListOutOfDate_) - { - updateList(); - } - // if the attribute ID is less than 0 then it is an IFS type - // attribute ID and we must remove all parts of the IFS name (name, lib and maybe type) - if (attrID < 0) - { - - // attribute is an IFS attribute, we must build the string here - NPAttributeIFS ifsAttr = - NPAttributeIFS.ifsAttrs[java.lang.Math.abs(attrID) - 1]; - - - // remove the string for the object name - attrTable_.remove(new Integer(ifsAttr.nameID_)); - // remove the string for the object library - attrTable_.remove(new Integer(ifsAttr.libraryID_)); - - // get the string for the object type - if (ifsAttr.typeID_ != 0) - { - attrTable_.remove(new Integer(ifsAttr.typeID_)); - } - } else { - // just a simple attribute, remove it from the table - attrTable_.remove(new Integer(attrID)); - } - } - - - // private methods - private void updateData() - { - int dataLength, elements, dataOffset, valueOffset; - byte[] data; - NPAttribute attr; - - elements = 0; - dataLength = LEN_ATTR_HEADER; - for (Enumeration e = attrTable_.elements(); e.hasMoreElements(); ) - { - attr = (NPAttribute)e.nextElement(); - - if (attr != null) - { - dataLength += LEN_ATTR_ENTRY; // add the 12 bytes needed to describe this attr - dataLength += attr.getHostLength(converter_); // add bytes for host length @B1C - elements++; // bump number of found elements - } - } - - - data = super.getDataBuffer(dataLength); // get buffer for the raw data - - // set the number of attributes in the codepoint - dataOffset = super.getOffset(); - BinaryConverter.unsignedShortToByteArray(elements, data, dataOffset); - dataOffset += 2; - - // set the length (12) of each attribute header - BinaryConverter.unsignedShortToByteArray(LEN_ATTR_ENTRY, data, dataOffset); - dataOffset += 2; - - // initialize where the first value will be placed in the buffer (after all - // of the attribute header entries) - valueOffset = dataOffset + LEN_ATTR_ENTRY * elements; - - // add each attribute to the data - for (Enumeration e = attrTable_.elements(); e.hasMoreElements() && (elements != 0);) - { - attr = (NPAttribute)e.nextElement(); - if (attr != null) - { - // set 2 byte attr ID - BinaryConverter.unsignedShortToByteArray(attr.getID(), data, dataOffset); - dataOffset += 2; - - // set 2 byte type - BinaryConverter.unsignedShortToByteArray(attr.getType(), data, dataOffset); - dataOffset += 2; - - // set 4 byte length - BinaryConverter.intToByteArray(attr.getHostLength(converter_), data, dataOffset); // @B1C - dataOffset += 4; - - // set 4 byte value offset - BinaryConverter.intToByteArray(valueOffset+NPCodePoint.LEN_HEADER, data, dataOffset); - dataOffset += 4; - - // set actual value - System.arraycopy(attr.getHostData(converter_), 0, // source // @B1C - data, valueOffset, // dest - attr.getHostLength(converter_)); // len // @B1C - valueOffset += attr.getHostLength(converter_); // @B1C - - elements--; - } - } - fDataOutOfDate_ = false; - } // updateData() - - private void updateList() - { - byte[] data; - int i; - byte nullbyte = (byte)'\0'; - - NPAttribute attr = null; - - // zero out table and the rebuild based on data - zeroAttrTable(); - data = super.getDataBuffer(); - if ( (data != null) && (data.length >= LEN_ATTR_HEADER) ) - { - long dataLength; - int elements, offset; - // @B1D Converter converterObj; - // @B1D try - // @B1D { - // @B1D // @A2C changed below from g.getConverter(hostCCSID_); - // @B1D converterObj = new Converter(hostCCSID_); - // @B1D } - // @B1D catch (java.io.UnsupportedEncodingException e) - // @B1D { - // @B1D Trace.log(Trace.ERROR, - // @B1D " UnsupportedEncodingException for ccsid = " + hostCCSID_ + - // @B1D ". Exception text = " + e); - // @B1D // @A2C changed below from Converter.getConverter() - // @B1D converterObj = new Converter(); - // @B1D } - dataLength = (long)super.getDataLength(); - offset = super.getOffset(); - if (dataLength > LEN_ATTR_HEADER) - { - elements = BinaryConverter.byteArrayToShort(data, offset); - offset += 2; - if (elements != 0) - { - int size; - size = BinaryConverter.byteArrayToShort(data, offset); - offset += 2; - if ( (size >= LEN_ATTR_ENTRY) && (dataLength >= (offset+elements*size)) ) - { - int ID, type, length, valueOffset; - while (elements != 0) - { - ID = BinaryConverter.byteArrayToShort(data, offset); - offset += 2; - - type = BinaryConverter.byteArrayToShort(data, offset); - offset += 2; - - length = BinaryConverter.byteArrayToInt(data, offset); - offset += 4; - - // valueOffset is from the beginning of the code point - // since we only have the codepoint data here, we have - // to adjust it - valueOffset = BinaryConverter.byteArrayToInt(data, offset); - offset += 4; - valueOffset -= NPCodePoint.LEN_HEADER; - - switch (type) - { - case NPAttribute.FOUR_BYTE: - case NPAttribute.FOUR_BYTE_ENU: - attr = new NPAttrBin4(ID, data, valueOffset, - length); - break; - case NPAttribute.STRING: - case NPAttribute.STRING_ENU: - attr = new NPAttrString(ID, data, valueOffset, - length, converter_); // @B1C - break; - case NPAttribute.FLOAT: - attr = new NPAttrFloat(ID, data, valueOffset, - length); - break; - case NPAttribute.LISTSTRING: // @B4A - // lists of strings will contain single null per field - // and double null to signify list end @B4A - - for ( i = 0; i < length; i++){ // @B4A - if ((data[i + valueOffset] == nullbyte)&& (i < length -1)){ - if (data[i + valueOffset + 1] != nullbyte){ - data[i + valueOffset] = (byte)'\u007A'; - // uses ':' as a delimiter between fields @B4A - } - } - } - attr = new NPAttrString(ID, data, valueOffset, - length, converter_); - break; - default: - // unknown attribute type - could be new? - // System.out.println(" unknown type = " + type); - } - attrTable_.put(new Integer(ID), attr); - - elements--; - offset += size - LEN_ATTR_ENTRY; // if the attribute entry was bigger than we know it - } - } - } - } - } - fListOutOfDate_ = false; - } // updateList() - - private void zeroAttrTable() - { - - attrTable_.clear(); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/NPCPData.java b/cvsroot/src/com/ibm/as400/access/NPCPData.java deleted file mode 100644 index 754a4324e..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPData.java +++ /dev/null @@ -1,35 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * Class NPCPData is an internal class (not public) that is used - * to get raw data to and from the server (things like reading and - * writing spooled files use it). - **/ -class NPCPData extends NPCodePoint -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - - - NPCPData() - { - super(NPCodePoint.DATA); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/NPCPID.java b/cvsroot/src/com/ibm/as400/access/NPCPID.java deleted file mode 100644 index 6df536d13..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPID.java +++ /dev/null @@ -1,61 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPID.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPCPID class - class for an attribute value list code point used with - * the network print server's data stream to identify server objects. - * This class is derived from NPCPAttributeValue and will be used to build a code - * point that has as its data a list of certain attributes that ID an object. - * This is an abstract class that will do the general enforcement of what can - * and cannot be set for this codepoint. - **/ - -abstract class NPCPID extends NPCPAttributeValue -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - - - /** - * copy constructor - */ - NPCPID(NPCPID cp) - { - super(cp); - } - - /** - * basic constructor that takes the ID and no data - child class passes in correct ID - */ - NPCPID(int ID) - { - super(ID); // construct codepoint with this ID - } - - /** - * constructor that takes the ID and data - child class passes in correct ID - * data should have the form described at the top of the class (nn len ID1...) - */ - NPCPID( int ID, byte[] data ) - { - super(ID, data); // construct codepoint with this ID - } - - -} // end NPCPID - diff --git a/cvsroot/src/com/ibm/as400/access/NPCPIDAFPResource.java b/cvsroot/src/com/ibm/as400/access/NPCPIDAFPResource.java deleted file mode 100644 index c1728488b..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPIDAFPResource.java +++ /dev/null @@ -1,127 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPIDAFPResource.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPCPIDAFPResource is used to contain an AFP resource ID code point. - * This code point has 3 values in it: - * ATTR_RSCNAME - resource name - * ATTR_RSCLIB - resource library - * ATTR_RSCTYPE - resource type - **/ - -class NPCPIDAFPResource extends NPCPID implements Cloneable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - - /** - * copy constructor - **/ - NPCPIDAFPResource(NPCPIDAFPResource cp) - { - super(cp); - } - - /** - * basic constructor that takes the ID and no data - child class passes in correct ID - **/ - NPCPIDAFPResource() - { - super(NPCodePoint.RESOURCE_ID); - } - - /** - * constructor that takes the ID and data - child class passes in correct ID - * data should have the form described at the top of the class (nn len ID1...) - **/ - NPCPIDAFPResource( byte[] data ) - { - super(NPCodePoint.RESOURCE_ID, data); - } - - /** - * constructor that takes the ID as seperate items - **/ - NPCPIDAFPResource(String resourceName, - String resourceLib, - String resourceType - ) - { - super(NPCodePoint.RESOURCE_ID); - int intResourceType = 0; - setAttrValue(PrintObject.ATTR_RSCNAME, resourceName); - setAttrValue(PrintObject.ATTR_RSCLIB, resourceLib); - // convert resource type from string to int - this conversion will - // throw an exception if it is invalid - // - // try to map the string type into an integer type - // if it fails it will throw ExtendedIllegalArgumentException which - // we will map to IllegalPathNameException with a rc of type not valid - // - try - { - intResourceType = NPCPSelRes.stringTypeToIntType(resourceType); - } - catch (ExtendedIllegalArgumentException e) - { - Trace.log(Trace.ERROR, "Parameter 'resource' has a invalid object type."); - throw new IllegalPathNameException(resourceType, - IllegalPathNameException.OBJECT_TYPE_NOT_VALID); - } - - setAttrValue(PrintObject.ATTR_RSCTYPE, intResourceType); - } - - - protected Object clone() - { - NPCPIDAFPResource cp = new NPCPIDAFPResource(this); - return cp; - } - - - - /** - * get the resource type as a string - **/ - String getResourceType() - { - int type = getIntValue(PrintObject.ATTR_RSCTYPE).intValue(); - return (NPCPSelRes.intTypeToStringType(type)); - } - - - - /** - * get the resource library - **/ - String library() - { - return getStringValue(PrintObject.ATTR_RSCLIB); - } - - /** - * get the resource name - **/ - String name() - { - return getStringValue(PrintObject.ATTR_RSCNAME); - } - -} // NPCPIDAFPResource - diff --git a/cvsroot/src/com/ibm/as400/access/NPCPIDLibrary.java b/cvsroot/src/com/ibm/as400/access/NPCPIDLibrary.java deleted file mode 100644 index 85e489374..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPIDLibrary.java +++ /dev/null @@ -1,82 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPIDLibrary.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPCPIDLibrary is used to contain a library ID code point. - * This code point has 1 value in it: - * NP_ATTR_LIBRARY - library name - **/ - -class NPCPIDLibrary extends NPCPID implements Cloneable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - - /** - * copy constructor - **/ - NPCPIDLibrary(NPCPIDLibrary cp) - { - super(cp); - } - - /** - * basic constructor that takes the ID and no data - child class passes in correct ID - **/ - NPCPIDLibrary() - { - super(NPCodePoint.LIBRARY_ID); - } - - /** - * constructor that takes the ID and data - child class passes in correct ID - * data should have the form described at the top of the class (nn len ID1...) - **/ - NPCPIDLibrary( byte[] data ) - { - super(NPCodePoint.LIBRARY_ID, data); - } - - /** - * constructor that takes the ID as seperate items - **/ - NPCPIDLibrary(String library) - { - super(NPCodePoint.LIBRARY_ID); - setAttrValue(PrintObject.ATTR_LIBRARY, library); - } - - - protected Object clone() - { - NPCPIDLibrary cp = new NPCPIDLibrary(this); - return cp; - } - - - - /** - * get the library name - **/ - String name() - { - return getStringValue(PrintObject.ATTR_LIBRARY); - } - -} // NPCPIDLibrary - diff --git a/cvsroot/src/com/ibm/as400/access/NPCPIDOutQ.java b/cvsroot/src/com/ibm/as400/access/NPCPIDOutQ.java deleted file mode 100644 index fff81c1f6..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPIDOutQ.java +++ /dev/null @@ -1,94 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPIDOutQ.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPCPIDOutQ is used to contain an output queue ID code point. - * This code point has 2 values in it: - * NP_ATTR_OUTQUE - output queue name - * NP_ATTR_OUTQUELIB - output queue library - **/ - -class NPCPIDOutQ extends NPCPID implements Cloneable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - /** - * copy constructor - **/ - NPCPIDOutQ(NPCPIDOutQ cp) - { - super(cp); - } - - /** - * basic constructor that takes the ID and no data - child class passes in correct ID - **/ - NPCPIDOutQ() - { - super(NPCodePoint.OUTPUT_QUEUE_ID); - } - - /** - * constructor that takes the ID and data - child class passes in correct ID - * data should have the form described at the top of the class (nn len ID1...) - **/ - NPCPIDOutQ( byte[] data ) - { - super(NPCodePoint.OUTPUT_QUEUE_ID, data); - } - - /** - * constructor that takes the ID as seperate items - **/ - NPCPIDOutQ(String queueName, - String queueLib) - { - super(NPCodePoint.OUTPUT_QUEUE_ID); - setAttrValue(PrintObject.ATTR_OUTQUE, queueName); - setAttrValue(PrintObject.ATTR_OUTQUELIB, queueLib); - } - - - protected Object clone() - { - NPCPIDOutQ cp = new NPCPIDOutQ(this); - return cp; - } - - - - /** - * get the queue library - */ - String library() - { - return getStringValue(PrintObject.ATTR_OUTQUELIB); - } - - /** - * get the queue name - */ - String name() - { - return getStringValue(PrintObject.ATTR_OUTQUE); - } - -} // NPCPIDOutQ - diff --git a/cvsroot/src/com/ibm/as400/access/NPCPIDPrinter.java b/cvsroot/src/com/ibm/as400/access/NPCPIDPrinter.java deleted file mode 100644 index c923d64ec..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPIDPrinter.java +++ /dev/null @@ -1,81 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPIDPrinter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPCPIDPrinter is used to contain a printer ID code point. - * This code point has 1 value in it: - * NP_ATTR_PRINTER - printer device name - **/ - -class NPCPIDPrinter extends NPCPID implements Cloneable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - - /** - * copy constructor - */ - NPCPIDPrinter(NPCPIDPrinter cp) - { - super(cp); - } - - /** - * basic constructor that takes the ID and no data - child class passes in correct ID - **/ - NPCPIDPrinter() - { - super(NPCodePoint.PRINTER_DEVICE_ID); - } - - /** - * constructor that takes the ID and data - child class passes in correct ID - * data should have the form described at the top of the class (nn len ID1...) - **/ - NPCPIDPrinter( byte[] data ) - { - super(NPCodePoint.PRINTER_DEVICE_ID, data); - } - - /** - * constructor that takes the ID as seperate items - **/ - NPCPIDPrinter(String printer) - { - super(NPCodePoint.PRINTER_DEVICE_ID); - setAttrValue(PrintObject.ATTR_PRINTER, printer); - } - - protected Object clone() - { - NPCPIDPrinter cp = new NPCPIDPrinter(this); - return cp; - } - - - - /** - * get the printer name - **/ - String name() - { - return getStringValue(PrintObject.ATTR_PRINTER); - } - -} // NPCPIDPrinter - diff --git a/cvsroot/src/com/ibm/as400/access/NPCPIDPrinterFile.java b/cvsroot/src/com/ibm/as400/access/NPCPIDPrinterFile.java deleted file mode 100644 index 3cd2f58b3..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPIDPrinterFile.java +++ /dev/null @@ -1,92 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPIDPrinterFile.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPCPIDPrinterFile is used to contain a printer file ID code point. - * This code point has 2 values in it: - * NP_ATTR_PFILE - printer file name - * NP_ATTR_PFLIB - printer file library - **/ - -class NPCPIDPrinterFile extends NPCPID implements Cloneable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - /** - * copy constructor - **/ - NPCPIDPrinterFile(NPCPIDPrinterFile cp) - { - super(cp); - } - - /** - * basic constructor that takes the ID and no data - child class passes in correct ID - **/ - NPCPIDPrinterFile() - { - super(NPCodePoint.PRINTER_FILE_ID); - } - - /** - * constructor that takes the ID and data - child class passes in correct ID - * data should have the form described at the top of the class (nn len ID1...) - **/ - NPCPIDPrinterFile( byte[] data ) - { - super(NPCodePoint.PRINTER_FILE_ID, data); - } - - /** - * constructor that takes the ID as seperate items - **/ - NPCPIDPrinterFile(String printerFileName, - String printerFileLib) - { - super(NPCodePoint.PRINTER_FILE_ID); - setAttrValue(PrintObject.ATTR_PRTFILE, printerFileName); - setAttrValue(PrintObject.ATTR_PRTFLIB, printerFileLib); - } - - protected Object clone() - { - NPCPIDPrinterFile cp = new NPCPIDPrinterFile(this); - return cp; - } - - - /** - * get the printer file library - **/ - String library() - { - return getStringValue(PrintObject.ATTR_PRTFLIB); - } - - /** - * get the printer file name - **/ - String name() - { - return getStringValue(PrintObject.ATTR_PRTFILE); - } - -} // NPCPIDPrinterFile - diff --git a/cvsroot/src/com/ibm/as400/access/NPCPIDSplF.java b/cvsroot/src/com/ibm/as400/access/NPCPIDSplF.java deleted file mode 100644 index ca89ebe47..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPIDSplF.java +++ /dev/null @@ -1,175 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPIDSplF.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPCPIDSplF is used to contain a spooled file ID code point. - * This code point has 5 or 8 (optionally at R520) values in it: @A1A - * NP_ATTR_SPOOLFILE - spooled file name - * NP_ATTR_SPLFNUM - spooled file number - * NP_ATTR_JOBNAME - job name - * NP_ATTR_JOBUSER - job user - * NP_ATTR_JOBNUMBER - job number - ** The following three attributes preserve uniqueness for splfs detached from jobs - * NP_ATTR_JOBSYSTEM - System job creating splf is from @A1A - * NP_ATTR_DATE - Create date of job splf is from @A1A - * NP_ATTR_TIME - Create time of job splf is from @A1A - **/ - -class NPCPIDSplF extends NPCPID implements Cloneable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - - /** - * copy constructor - */ - NPCPIDSplF(NPCPIDSplF cp) - { - super(cp); - } - - /** - * basic constructor that takes the ID and no data - child class passes in correct ID - */ - NPCPIDSplF() - { - super(NPCodePoint.SPOOLED_FILE_ID); - } - - /** - * constructor that takes the ID and data - child class passes in correct ID - * data should have the form described at the top of the class (nn len ID1...) - */ - NPCPIDSplF( byte[] data ) - { - super(NPCodePoint.SPOOLED_FILE_ID, data); - } - - /** - * constructor that takes the ID as seperate items - */ - NPCPIDSplF(String splFileName, - int splFileNumber, - String jobName, - String jobUser, - String jobNumber) - { - super(NPCodePoint.SPOOLED_FILE_ID); - setAttrValue(PrintObject.ATTR_SPOOLFILE, splFileName); - setAttrValue(PrintObject.ATTR_SPLFNUM, splFileNumber); - setAttrValue(PrintObject.ATTR_JOBNAME, jobName); - setAttrValue(PrintObject.ATTR_JOBUSER, jobUser); - setAttrValue(PrintObject.ATTR_JOBNUMBER, jobNumber); - } - - /** @A1A - * constructor that takes alternate ID values as seperate items - */ - NPCPIDSplF(String splFileName, - int splFileNumber, - String jobName, - String jobUser, - String jobNumber, - String jobSysName, - String createDate, - String createTime) - { - super(NPCodePoint.SPOOLED_FILE_ID); - setAttrValue(PrintObject.ATTR_SPOOLFILE, splFileName); - setAttrValue(PrintObject.ATTR_SPLFNUM, splFileNumber); - setAttrValue(PrintObject.ATTR_JOBNAME, jobName); - setAttrValue(PrintObject.ATTR_JOBUSER, jobUser); - setAttrValue(PrintObject.ATTR_JOBNUMBER, jobNumber); - setAttrValue(PrintObject.ATTR_JOBSYSTEM, jobSysName); - setAttrValue(PrintObject.ATTR_DATE, createDate); - setAttrValue(PrintObject.ATTR_TIME, createTime); - } -// end new constructor @A1A - protected Object clone() - { - NPCPIDSplF cp = new NPCPIDSplF(this); - return cp; - } - - - /** - * get the job name - */ - String jobName() - { - return getStringValue(PrintObject.ATTR_JOBNAME); - } - - /** - * get the job number - */ - String jobNumber() - { - return getStringValue(PrintObject.ATTR_JOBNUMBER); - } - - /** - * get the spooled file name - */ - String name() - { - return getStringValue(PrintObject.ATTR_SPOOLFILE); - } - - /** - * get the spooled file number - */ - Integer number() - { - return getIntValue(PrintObject.ATTR_SPLFNUM); - } - - /** - * get the job user - */ - String user() - { - return getStringValue(PrintObject.ATTR_JOBUSER); - } - - /** - * get the system job which created the splf - */ - String jobSysName() - { - return getStringValue(PrintObject.ATTR_JOBSYSTEM); - } - - /** @A1A - * get the creation date of splf - */ - String createDate() - { - return getStringValue(PrintObject.ATTR_DATE); - } - - /** @A1A - * get the creation time of the splf - */ - String createTime() - { - return getStringValue(PrintObject.ATTR_TIME); - } - -} // NPCPIDSplF - diff --git a/cvsroot/src/com/ibm/as400/access/NPCPIDTargetSplF.java b/cvsroot/src/com/ibm/as400/access/NPCPIDTargetSplF.java deleted file mode 100644 index 389b932a3..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPIDTargetSplF.java +++ /dev/null @@ -1,77 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPIDTargetSplF.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPCPIDTargetSplF is used to contain a target spooled file ID code point. - * This code point is just a spooled file ID with a different codepoint ID. - * It is used on a send splf action. - **/ - -class NPCPIDTargetSplF extends NPCPIDSplF implements Cloneable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - /** - * copy constructor - **/ - NPCPIDTargetSplF(NPCPIDTargetSplF cp) - { - super(cp); - } - - /** - * basic constructor that takes the ID and no data - child class passes in correct ID - **/ - NPCPIDTargetSplF() - { - super(); - setID(NPCodePoint.TARGET_SPOOLED_FILE_ID); - } - - /** - * constructor that takes the ID and data - child class passes in correct ID - * data should have the form described at the top of the class (nn len ID1...) - **/ - NPCPIDTargetSplF( byte[] data ) - { - super(data); - setID(NPCodePoint.TARGET_SPOOLED_FILE_ID); - } - - /** - * constructor that takes the ID as seperate items - **/ - NPCPIDTargetSplF(String splFileName, - int splFileNumber, - String jobName, - String jobUser, - String jobNumber) - { - super(splFileName, splFileNumber, - jobName, jobUser, jobNumber); - setID(NPCodePoint.TARGET_SPOOLED_FILE_ID); - } - - protected Object clone() - { - NPCPIDTargetSplF cp = new NPCPIDTargetSplF(this); - return cp; - } - -} // NPCPIDTargetSplF - diff --git a/cvsroot/src/com/ibm/as400/access/NPCPIDWriter.java b/cvsroot/src/com/ibm/as400/access/NPCPIDWriter.java deleted file mode 100644 index c403ae23a..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPIDWriter.java +++ /dev/null @@ -1,103 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPIDWriter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPCPIDWriter is used to contain a writer job ID code point. - * This code point has 3 values in it: - * NP_ATTR_WTRJOBNAME - writer job name - * NP_ATTR_WTRJOBNUM - writer job number - * NP_ATTR_WTRJOBUSER - writer job user - **/ - -class NPCPIDWriter extends NPCPID implements Cloneable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - /** - * copy constructor - **/ - NPCPIDWriter(NPCPIDWriter cp) - { - super(cp); - } - - /** - * basic constructor that takes the ID and no data - child class passes in correct ID - **/ - NPCPIDWriter() - { - super(NPCodePoint.WRITER_JOB_ID); - } - - /** - * constructor that takes the ID and data - child class passes in correct ID - * data should have the form described at the top of the class (nn len ID1...) - **/ - NPCPIDWriter( byte[] data ) - { - super(NPCodePoint.WRITER_JOB_ID, data); - } - - /** - * constructor that takes the ID as seperate items - **/ - NPCPIDWriter(String writerJobName, - String writerJobNumber, - String writerJobUser) - { - super(NPCodePoint.WRITER_JOB_ID); - setAttrValue(PrintObject.ATTR_WTRJOBNAME, writerJobName); - setAttrValue(PrintObject.ATTR_WTRJOBNUM, writerJobNumber); - setAttrValue(PrintObject.ATTR_WTRJOBUSER, writerJobUser); - } - - - protected Object clone() - { - NPCPIDWriter cp = new NPCPIDWriter(this); - return cp; - } - - - - /** - * get the writer's job number - **/ - String jobNumber() - { - return getStringValue(PrintObject.ATTR_WTRJOBNUM); - } - - /** - * get the writer's job name - **/ - String name() - { - return getStringValue(PrintObject.ATTR_WTRJOBNAME); - } - - /** - * get the writer's job user - **/ - String user() - { - return getStringValue(PrintObject.ATTR_WTRJOBUSER); - } - -} // NPCPIDWriter - diff --git a/cvsroot/src/com/ibm/as400/access/NPCPMsgHandle.java b/cvsroot/src/com/ibm/as400/access/NPCPMsgHandle.java deleted file mode 100644 index 922805b39..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPMsgHandle.java +++ /dev/null @@ -1,35 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPMsgHandle.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * Class NPCPMsgHandle is an internal class (not public) that is used - * to hold the handle given back to us on a reply to a message. - **/ -class NPCPMsgHandle extends NPCodePoint -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - - NPCPMsgHandle() - { - super(NPCodePoint.MESSAGE_HANDLE); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/NPCPResHandle.java b/cvsroot/src/com/ibm/as400/access/NPCPResHandle.java deleted file mode 100644 index 6216ee1b0..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPResHandle.java +++ /dev/null @@ -1,34 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPResHandle.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * Class NPCPResHandle is an internal class (not public) that is used - * to hold the handle given back to us on an open of an AFP resource. - **/ -class NPCPResHandle extends NPCodePoint -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - - - NPCPResHandle() - { - super(NPCodePoint.RESOURCE_HANDLE); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/NPCPSelOutQ.java b/cvsroot/src/com/ibm/as400/access/NPCPSelOutQ.java deleted file mode 100644 index 3ecbf1370..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPSelOutQ.java +++ /dev/null @@ -1,94 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPSelOutQ.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPCPSelOutQ class - class for an attribute value list code point used with - * the network print server's data stream. - * This class is derived from NPCPSelection and will be used to build a code - * point that has as its data a list of any attributes that can filter a outq list. -**/ - -class NPCPSelOutQ extends NPCPSelection implements Cloneable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - protected Object clone() - { - NPCPSelOutQ cp = new NPCPSelOutQ(this); - return cp; - } - - /** - * copy constructor - **/ - NPCPSelOutQ(NPCPSelOutQ cp) - { - super(cp); - } - - /** - * basic constructor that creates an empty outq selection codepoint - **/ - NPCPSelOutQ() - { - super(); - } - - - /** - * get output queue filter as an IFS path. - * @returns The IFS path of the output queue filter or - * an empty string if it isn't set. - **/ - String getQueue() - { - String ifsQueue = getStringValue(PrintObject.ATTR_OUTPUT_QUEUE); - if( ifsQueue == null ) - { - return emptyString; - } else { - return ifsQueue; - } - } - - /** - * set the output queue filter as an IFS path name. - * Removes the filter if ifsQueue is null or "". - **/ - void setQueue(String ifsQueue) - { - // if the ifs path has a length of 0 (emtpy string) then - // we will remove the filter completely. - // If it has something in it, it had better be - // a valid IFS path name. - - if( ifsQueue.length() == 0 ) - { - removeAttribute(PrintObject.ATTR_OUTPUT_QUEUE); - } else { - setAttrValue(PrintObject.ATTR_OUTPUT_QUEUE, ifsQueue); - } - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/NPCPSelPrtD.java b/cvsroot/src/com/ibm/as400/access/NPCPSelPrtD.java deleted file mode 100644 index 88880b466..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPSelPrtD.java +++ /dev/null @@ -1,87 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPSelPrtD.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPCPSelPrtD class - class for an attribute value list code point used with - * the network print server's data stream. - * This class is derived from NPCPSelection and will be used to build a code - * point that has as its data a list of any attributes that can filter a - * printer device list. -**/ - -class NPCPSelPrtD extends NPCPSelection implements Cloneable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - /** - * copy constructor - **/ - NPCPSelPrtD(NPCPSelPrtD cp) - { - super(cp); - } - - /** - * basic constructor that creates an empty printer selection codepoint - **/ - NPCPSelPrtD() - { - super(); - } - - protected Object clone() - { - NPCPSelPrtD cp = new NPCPSelPrtD(this); - return cp; - } - - - - /** - * gets the printer filter. - * @returns the printer filter or an empty string - * if it has not been set - **/ - String getPrinter() - { - String printer = getStringValue(PrintObject.ATTR_PRINTER); - if( printer == null ) - { - return emptyString; - } else { - return printer; - } - } - - /** - * set printer filter - * Removes the filter if printer is "". - **/ - void setPrinter(String printer) - { - if( printer.length() == 0 ) - { - removeAttribute(PrintObject.ATTR_PRINTER); - } else { - setAttrValue(PrintObject.ATTR_PRINTER, printer); - } - } - -} // NPCPSelPrtD class diff --git a/cvsroot/src/com/ibm/as400/access/NPCPSelPrtF.java b/cvsroot/src/com/ibm/as400/access/NPCPSelPrtF.java deleted file mode 100644 index 03267d31b..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPSelPrtF.java +++ /dev/null @@ -1,88 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPSelPrtF.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPCPSelPrtF class - class for an attribute value list code point used with - * the network print server's data stream. - * This class is derived from NPCPSelection and will be used to build a code - * point that has as its data a list of any attributes that can filter a - * printer file list. -**/ - -class NPCPSelPrtF extends NPCPSelection implements Cloneable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - - /** - * copy constructor - **/ - NPCPSelPrtF(NPCPSelPrtF cp) - { - super(cp); - } - - /** - * basic constructor that creates an empty printer selection codepoint - **/ - NPCPSelPrtF() - { - super(); - } - - protected Object clone() - { - NPCPSelPrtF cp = new NPCPSelPrtF(this); - return cp; - } - - - - /** - * gets the printer file filter - * @returns The printer file filter or an empty string if not set. - **/ - String getPrinterFile() - { - String printerFile = getStringValue(PrintObject.ATTR_PRINTER_FILE); - if( printerFile == null ) - { - return emptyString; - } else { - return printerFile; - } - } - - /** - * sets the printer file filter using an IFS path for the printer file. - * Removes the filter if ifsPrinterFile is "". - **/ - void setPrinterFile(String ifsPrinterFile) - { - if( ifsPrinterFile.length() == 0 ) - { - removeAttribute(PrintObject.ATTR_PRINTER_FILE); - } else { - setAttrValue(PrintObject.ATTR_PRINTER_FILE, ifsPrinterFile); - } - } - -} // NPCPSelPrtF class - diff --git a/cvsroot/src/com/ibm/as400/access/NPCPSelRes.java b/cvsroot/src/com/ibm/as400/access/NPCPSelRes.java deleted file mode 100644 index 34e06dfd5..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPSelRes.java +++ /dev/null @@ -1,253 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPSelRes.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPCPSelRes class - class for an attribute value list code point used with - * the network print server's data stream. - * This class is derived from NPCPSelection and will be used to build a code - * point that has as its data a list of any attributes that can filter a - * AFP resource list. These include the resource library name, the resource - * name, the resource object type and the pel density for font resources. - * - **/ - -class NPCPSelRes extends NPCPSelection implements Cloneable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - - static final int FNTRSC = 0x0001; - static final int FORMDF = 0x0002; - static final int OVL = 0x0004; - static final int PAGSEG = 0x0008; - static final int PAGDFN = 0x0010; - - static final int ALLRSC = 0x001F; // update this if you add any new resources! - - static final String STR_ALL = "%ALL%"; - static final String STR_UNKNOWN = "UNKNOWN"; - - static final String PEL240 = "1"; - static final String PEL300 = "2"; - - /** - * copy constructor - **/ - NPCPSelRes(NPCPSelRes cp) - { - super(cp); - } - - /** - * basic constructor that creates an empty printer selection codepoint - **/ - NPCPSelRes() - { - super(); - } - - protected Object clone() - { - NPCPSelRes cp = new NPCPSelRes(this); - return cp; - } - - - - /** - * Gets font pel density - * @returns pelDensity a string that maps which pel density of - * font you want. "1" for 240, "2" for 300, and "" if the filter - * has not been set. - **/ - String getPelDensity() - { - // if font pel density has not been set, return an empty string. - String pelDensity = getStringValue(PrintObject.ATTR_PELDENSITY); - if( pelDensity == null ) - { - return emptyString; - } else { - return pelDensity; - } - } - - /** gets the IFS path of the filter - * @returns the IFS path or an empty string if the filter - * has not been set. - **/ - String getResource() - { - // Note, we cannot use the simple getStringValue(PrintObject.ATTR_AFP_RESOURCE - // here because the type is an integer, not a string and it is cmplex to convert it - // back and forth, so we do it here, instead of in NPCPAttributeValue. - - // if both the name and library have not been set, - // return an empty string. - String rscName = getStringValue(PrintObject.ATTR_RSCNAME); - if (rscName == null) - { - return emptyString; - } - - String rscLib = getStringValue(PrintObject.ATTR_RSCLIB); - if (rscLib == null) - { - return emptyString; // could set it to *LIBL here too, I suppose - } - - String rscType = null; - Integer i = getIntValue(PrintObject.ATTR_RSCTYPE); - if (i == null) - { - rscType = STR_ALL; - } else { - rscType = intTypeToStringType(i.intValue()); - } - - return QSYSObjectPathName.toPath(rscLib, rscName, rscType); - } - - /** - * static utility function to convert a int resource type into its - * String value (ie. 0x0001 maps to "FNTRSC"). - **/ - static String intTypeToStringType(int resourceType) - { - switch (resourceType) - { - case PAGSEG: - return AFPResource.STR_PAGSEG; - case OVL: - return AFPResource.STR_OVL; - case FNTRSC: - return AFPResource.STR_FNTRSC; - case FORMDF: - return AFPResource.STR_FORMDF; - case PAGDFN: - return AFPResource.STR_PAGDFN; - default: // I do not throw an exception here because - return NPCPSelRes.STR_UNKNOWN; // the host may define new resource types in - // the future and I think we still want to work - } - } // intTypeToStringType() - - /** - * Sets the resource name, library and type using an IFS path - * Removes the filter if resource is "". - **/ - void setResource(String resource) - { - if( resource.length() == 0 ) - { - // this will remove all 3 attribute values - removeAttribute(PrintObject.ATTR_AFP_RESOURCE); - } else { - // construct a QSYSObjectPathName object - QSYSObjectPathName ifsPath = new QSYSObjectPathName(resource); - String strRes = ifsPath.getObjectName(); - String strLib = ifsPath.getLibraryName(); - String type = ifsPath.getObjectType(); - - if (type.equals(STR_ALL)) - { - setResourceType(NPCPSelRes.ALLRSC); - } else { - - // - // try to map the string type into an integer type - // if it fails it will throw ExtendedIllegalArgumentException which - // we will map to IllegalPathNameException with a rc of type not valid - // - try - { - setResourceType( stringTypeToIntType(type) ); - } - catch (ExtendedIllegalArgumentException e) - { - Trace.log(Trace.ERROR, "Parameter 'resource' has a invalid object type."); - throw new IllegalPathNameException(resource, - IllegalPathNameException.OBJECT_TYPE_NOT_VALID); - } - } - setAttrValue(PrintObject.ATTR_RSCLIB, strLib); - setAttrValue(PrintObject.ATTR_RSCNAME, strRes); - } - } - - /** - * Sets resource type filter - * @param resourceType an bitmasked int that can have any of these - * values turned on: - *

      - *
    • 0x0001 - *FNTRSC - *
    • 0x0002 - *FORMDF - *
    • 0x0004 - *OVL - *
    • 0x0008 - *PAGSEG - *
    • 0x0010 - *PAGDFN - *
    - **/ - void setResourceType(int resourceType) - { - setAttrValue(PrintObject.ATTR_RSCTYPE, resourceType); - } - - /** - * Sets font pel density - * @param pelDensity a string that maps which pel density of - * font you want. "1" for 240 and "2" for 300. Removes the - * filter if the pel density is "". - **/ - void setPelDensity(String pelDensity) - { - if( pelDensity.length() == 0 ) - { - removeAttribute(PrintObject.ATTR_PELDENSITY); - } else { - setAttrValue(PrintObject.ATTR_PELDENSITY, pelDensity); - } - } - - /** - * static utility function to convert a String resource type into its - * int value (ie. "FNTRSC" maps to 0x0001). - **/ - static int stringTypeToIntType(String resourceType) - { - int intResourceType = 0; - if (resourceType.equals(AFPResource.STR_PAGSEG)) - { - intResourceType = NPCPSelRes.PAGSEG; - } else if (resourceType.equals(AFPResource.STR_OVL)) { - intResourceType = NPCPSelRes.OVL; - } else if (resourceType.equals(AFPResource.STR_FNTRSC)) { - intResourceType = NPCPSelRes.FNTRSC; - } else if (resourceType.equals(AFPResource.STR_FORMDF)) { - intResourceType = NPCPSelRes.FORMDF; - } else if (resourceType.equals(AFPResource.STR_PAGDFN)) { - intResourceType = NPCPSelRes.PAGDFN; - } else { - Trace.log(Trace.ERROR, "Parameter 'resourceType' has a invalid object type."); - throw new ExtendedIllegalArgumentException("resourceType ("+resourceType+")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - return intResourceType; - } -} // NPCPSelRes class diff --git a/cvsroot/src/com/ibm/as400/access/NPCPSelSplF.java b/cvsroot/src/com/ibm/as400/access/NPCPSelSplF.java deleted file mode 100644 index 5670e49fa..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPSelSplF.java +++ /dev/null @@ -1,377 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPSelSplF.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPCPSelSplF class - class for an attribute value list code point used with - * the network print server's data stream. - * This class is derived from NPCPSelection and will be used to build a code - * point that has as its data a list of any attributes that can filter a splfile list. -**/ - -class NPCPSelSplF extends NPCPSelection implements Cloneable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - - // some strings we use for filtering output queues - // we accept *ALL for the output queue library and we'll convert it - // to "" for the host to use - static final String STR_ALLOUTQLIBS = "*ALL"; - static final String STR_BLANKOUTQLIB = ""; - - protected Object clone() - { - NPCPSelSplF cp = new NPCPSelSplF(this); - return cp; - } - - /** - * copy constructor - **/ - NPCPSelSplF(NPCPSelSplF cp) - { - super(cp); - } - - /** - * basic constructor that creates an empty splf selection codepoint - **/ - NPCPSelSplF() - { - super(); - } - - /** - * gets the formtype filter - * @returns the filter for the form type or an empty - * string if it isn't set. - **/ - String getFormType() - { - String formType = getStringValue(PrintObject.ATTR_FORMTYPE); - if( formType == null ) - { - return emptyString; - } else { - return formType; - } - - } - - /** - * gets the output queue filter as an IFS path. - * @returns The IFS path of the output queue filter or - * an empty string if it isn't set. - **/ - String getQueue() - { - // - // note: I cannot just call getStringValue(ATTR_OUTPUT_QUEUE) here because - // of the special case for libraries on spooled files lists where " " means - // *ALL. - // - String ifsQueue = emptyString; - String object = getStringValue(PrintObject.ATTR_OUTQUE); - String library = getStringValue(PrintObject.ATTR_OUTQUELIB); - if (object != null) - { - if (library != null) - { - // change the library name of "" (or any blanks " ") to *ALL here - library = library.trim(); // remove any whitespace - if (library.length() == 0) - { - library = STR_ALLOUTQLIBS; - } - ifsQueue = QSYSObjectPathName.toPath(library, object, "OUTQ"); - } - } - - return ifsQueue; - - } // get Queue - - /** - * gets the user filter - * @returns the filter for the user or an empty string if it isn't set. - **/ - String getUser() - { - String user = getStringValue(PrintObject.ATTR_JOBUSER); - if( user == null ) - { - return emptyString; - } else { - return user; - } - } - - /** @A1A - * gets the create job system - * @returns the filter for the user or an empty string if it isn't set. - **/ - String getJobSystem() - { - String jobSystem = getStringValue(PrintObject.ATTR_JOBSYSTEM); - if( jobSystem == null ) - { - return emptyString; - } else { - return jobSystem; - } - } - - /** @A1A - * @return the filter for start date or blanks - * if end date isn't set. - **/ - String getStartDate() - { - String startDate = getStringValue(PrintObject.ATTR_DATE); - if ( startDate == null ) - { - return emptyString; - } else { - return startDate; - } - } - - /** @A1A - * @return the filter for start time or blanks - * if end time isn't set. - **/ - String getStartTime() - { - String startTime = getStringValue(PrintObject.ATTR_TIME); - if ( startTime == null ) - { - return emptyString; - } else { - return startTime; - } - } - - /** - * gets the user data filter - * @returns the filter for the user data or - * an empty string if it isn't set. - **/ - String getUserData() - { - String userData = getStringValue(PrintObject.ATTR_USERDATA); - if( userData == null ) - { - return emptyString; - } else { - return userData; - } - } - - /** @A1A - * @return the filter for end date or blanks - * if end date isn't set. - **/ - String getEndDate() - { - String endDate = getStringValue(PrintObject.ATTR_DATE_END); - if ( endDate == null ) - { - return emptyString; - } else { - return endDate; - } - } - - /** @A1A - * @return the filter for end time or blanks - * if end time isn't set. - **/ - String getEndTime() - { - String endTime = getStringValue(PrintObject.ATTR_TIME_END); - if ( endTime == null ) - { - return emptyString; - } else { - return endTime; - } - } - - - /** - * set formtype filter. - * Removes the filter if formType is "". - **/ - void setFormType(String formType) - { - if( formType.length() == 0 ) - { - removeAttribute(PrintObject.ATTR_FORMTYPE); - } else { - setAttrValue(PrintObject.ATTR_FORMTYPE, formType); - } - } - - /** - * set the output queue filter using an IFS Path. - * Use %ALL% for all queue libraries and it will be converted to "" here for the - * host (which uses all blanks or "" to represent all libs on this one selection CP). - * Removes the filter if ifsQueue is "". - **/ - void setQueue(String ifsQueue) - { - // if the ifs path has a length of 0 (emtpy string) then - // we will remove the filter completely. - // If it has something in it, it had better be - // a valid IFS path name. - - if( ifsQueue.length() == 0 ) - { - removeAttribute(PrintObject.ATTR_OUTPUT_QUEUE); - } else { - // we must tear the IFS path apart here and convert the library name - // if necessary because the underlying code will not know to convert - // %ALL%.LIB to "" (special case for spooled file filters only). - QSYSObjectPathName ifsPath = new QSYSObjectPathName(ifsQueue, "OUTQ"); - setQueue(ifsPath.getLibraryName(), ifsPath.getObjectName()); - } - } - - /** - * set output queue filter - * Set the queuelib to *ALL if you want all libraries, it will be converted - * to " " here for the host (and converted back to *ALL on the getter) - **/ - void setQueue(String queueLib, String queue) - { - // The host uses " " to mean "*ALL" for queue lib - // on this filter. We can use "" and it'll work, but we - // have to convert *ALL to "" here. - // note: I do not uppercase here, so it must be uppercased by caller - - if ((queueLib.trim()).compareTo(STR_ALLOUTQLIBS) == 0) - { - queueLib = STR_BLANKOUTQLIB; - } - - setAttrValue(PrintObject.ATTR_OUTQUELIB, queueLib); - setAttrValue(PrintObject.ATTR_OUTQUE, queue); - } - - /** - * set user to get spooled files for. May be *USER, *CURRENT or a user id - * Removes the filter if user is "". - **/ - void setUser(String user) - { - if( user.length() == 0 ) - { - removeAttribute(PrintObject.ATTR_JOBUSER); - } else { - setAttrValue(PrintObject.ATTR_JOBUSER, user); - } - } - - /** - * set user data filter - * Removes the filter if userData is "". - **/ - void setUserData(String userData) - { - if( userData.length() == 0 ) - { - removeAttribute(PrintObject.ATTR_USERDATA); - } else { - setAttrValue(PrintObject.ATTR_USERDATA, userData); - } - } - - /** @A1A - * set create job system - * Removes the filter if userData is "". - **/ - void setJobSystem(String jobSystem) - { - if( jobSystem.length() == 0 ) - { - removeAttribute(PrintObject.ATTR_JOBSYSTEM); - } else { - setAttrValue(PrintObject.ATTR_JOBSYSTEM, jobSystem); - } - } - - /** @A1A - * set startTime and - * removes the filter if startTime is "". - **/ - void setStartTime(String startTime) - { - if( startTime.length() == 0 ) - { - removeAttribute(PrintObject.ATTR_TIME); - } else { - setAttrValue(PrintObject.ATTR_TIME, startTime); - } - } - - /** @A1A - * set startDate and - * removes the filter if startDate is "". - **/ - void setStartDate(String startDate) - { - if( startDate.length() == 0 ) - { - removeAttribute(PrintObject.ATTR_DATE); - } else { - setAttrValue(PrintObject.ATTR_DATE, startDate); - } - } - - /** @A1A - * set endTime and - * removes the filter if endTime is "". - **/ - void setEndTime(String endTime) - { - if( endTime.length() == 0 ) - { - removeAttribute(PrintObject.ATTR_TIME_END); - } else { - setAttrValue(PrintObject.ATTR_TIME_END, endTime); - } - } - - /** @A1A - * set endDate filter and - * removes the filter if userDate is "". - **/ - void setEndDate(String endDate) - { - if( endDate.length() == 0 ) - { - removeAttribute(PrintObject.ATTR_DATE_END); - } else { - setAttrValue(PrintObject.ATTR_DATE_END, endDate); - } - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/NPCPSelWrtJ.java b/cvsroot/src/com/ibm/as400/access/NPCPSelWrtJ.java deleted file mode 100644 index 755d1d697..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPSelWrtJ.java +++ /dev/null @@ -1,127 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPSelWrtJ.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPCPSelWrtJ class - class for an attribute value list code point used with - * the network print server's data stream. - * This class is derived from NPCPSelection and will be used to build a code - * point that has as its data a list of any attributes that can filter a - * writer list. -**/ - -class NPCPSelWrtJ extends NPCPSelection implements Cloneable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - // some strings we use for filtering output queues - // we accept *ALL for the output queue library and we'll convert it - // to "" for the host to use - static final String STR_ALLOUTQLIBS = "*ALL"; - static final String STR_BLANKOUTQLIB = ""; - - /** - * copy constructor - **/ - NPCPSelWrtJ(NPCPSelWrtJ cp) - { - super(cp); - } - - /** - * basic constructor that creates an empty WrtJ selection codepoint - **/ - NPCPSelWrtJ() - { - super(); - } - - protected Object clone() - { - NPCPSelWrtJ cp = new NPCPSelWrtJ(this); - return cp; - } - - - - /** - * get output queue filter as an IFS path. - * @returns The IFS path of the output queue filter or - * an empty string if it isn't set. - **/ - String getQueue() - { - String queue = getStringValue(PrintObject.ATTR_OUTPUT_QUEUE); - if( queue == null ) - { - return emptyString; - } else { - return queue; - } - } - - /** - * get writer filter. - * @returns The writer job filter or an empty string if it isn't set. - **/ - String getWriter() - { - String writer = getStringValue(PrintObject.ATTR_WTRJOBNAME); - if( writer == null ) - { - return emptyString; - } else { - return writer; - } - } - - /** - * set the output queue filter as an IFS path name. - * Removes the filter if ifsQueue is "". - **/ - void setQueue(String ifsQueue) - { - // if the ifs path has a length of 0 (emtpy string) then - // we will remove the filter completely. - // If it has something in it, it had better be - // a valid IFS path name. - - if( ifsQueue.length() == 0 ) - { - removeAttribute(PrintObject.ATTR_OUTPUT_QUEUE); - } else { - setAttrValue(PrintObject.ATTR_OUTPUT_QUEUE, ifsQueue); - } - } - - /** - * set writer filter. Removes the filter if writerName is "". - **/ - void setWriter(String writerName) - { - if( writerName.length() == 0 ) - { - removeAttribute(PrintObject.ATTR_WTRJOBNAME); - } else { - setAttrValue(PrintObject.ATTR_WTRJOBNAME, writerName); - } - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/NPCPSelection.java b/cvsroot/src/com/ibm/as400/access/NPCPSelection.java deleted file mode 100644 index 4dc2be0d9..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPSelection.java +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPSelection.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * NPCPSelection.class - abstract class for a selection code point used - * with the network print server's data stream. - * This class is derived from NPCPAttributeValue and will be used to build a code - * point that has as its data a list of attributes used to filter a list with. - * its ID, its length, its type and an offset to its data. -**/ - -class NPCPSelection extends NPCPAttributeValue -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - /** - * copy constructor - */ - NPCPSelection(NPCPSelection cp) - { - super(cp); - } - - /** - * basic constructor that takes the ID and no data - child class passes in correct ID - */ - NPCPSelection() - { - super(NPCodePoint.SELECTION); - } - - /** - * constructor that takes the ID and data - child class passes in correct ID - * data should have the form described at the top of the class (nn len ID1...) - */ - NPCPSelection( byte[] data ) - { - super(NPCodePoint.SELECTION, data); - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/NPCPSplFHandle.java b/cvsroot/src/com/ibm/as400/access/NPCPSplFHandle.java deleted file mode 100644 index d3b426af7..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCPSplFHandle.java +++ /dev/null @@ -1,32 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCPSplFHandle.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * Class NPCPSplFHandle is an internal class (not public) that is used - * to hold the handle given back to us on an open of a spooled file. - **/ -class NPCPSplFHandle extends NPCodePoint -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - NPCPSplFHandle() - { - super(NPCodePoint.SPOOLED_FILE_HANDLE); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/NPCodePoint.java b/cvsroot/src/com/ibm/as400/access/NPCodePoint.java deleted file mode 100644 index 81fb45c68..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPCodePoint.java +++ /dev/null @@ -1,225 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPCodePoint.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class NPCodePoint extends Object implements Cloneable, - java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Code Points defined in the Network Print data stream. - static final int SPOOLED_FILE_ID = 0x0001; - static final int WRITER_JOB_ID = 0x0002; - static final int OUTPUT_QUEUE_ID = 0x0003; - static final int PRINTER_FILE_ID = 0x0004; - static final int PRINTER_DEVICE_ID = 0x0005; - static final int SELECTION = 0x0006; - static final int ATTRIBUTE_LIST = 0x0007; - static final int ATTRIBUTE_VALUE = 0x0008; - static final int DATA = 0x0009; - static final int EXIT_PROGRAM_DATA = 0x000A; - static final int TARGET_SPOOLED_FILE_ID = 0x000B; - static final int SPOOLED_FILE_HANDLE = 0x000C; - static final int MESSAGE_HANDLE = 0x000D; - static final int LIBRARY_ID = 0x000E; - static final int RESOURCE_ID = 0x000F; - static final int RESOURCE_HANDLE = 0x0010; - - static final int MAX_CODEPOINT_ID = 0x0010; // keep this up to date! - - protected final static int LEN_HEADER = 6; // size of code point header struct (len + id) - - - private byte[] data_; // code point data buffer. - private int ID_; // code point ID. - private int length_; // length of code point data - private int offset_ = 0; // offset into data buffer where we can start - // putting our data at - // @B1D protected int hostCCSID_; // target ccsid - protected transient ConverterImpl converter_; // @B1A - - protected Object clone() - { - NPCodePoint cp = new NPCodePoint(this); - return cp; - } - - NPCodePoint(NPCodePoint cp) - { - - ID_ = cp.ID_; - length_ = cp.length_; - offset_ = cp.offset_; - // @B1C hostCCSID_ = cp.hostCCSID_; - converter_ = cp.converter_; // @B1A - if (cp.data_ != null) - { - data_ = new byte[cp.data_.length]; - System.arraycopy(cp.data_, offset_, - data_, offset_, - data_.length - offset_); - } - } - - NPCodePoint() - { - - } - - NPCodePoint( int ID ) - { - setID( ID ); - } - - NPCodePoint( int ID, byte[] data ) - { - setID( ID ); - this.data_ = data; - length_ = this.data_.length; - } - -/* - don't use this - instead create the codepoint or find it in the list of - prestored codepoints and then ask the codepoint for a databuffer of the - desired length or bigger. - NPCodePoint( int ID, int length, InputStream in ) - throws IOException - { - xlateObj = defaultXlateObj; - setID( ID ); - if( (data == null) || (data.length < length) ){ - data = new byte[length]; - } - in.read( data, 0, length ); - this.length = length; - } -*/ - - - - byte[] getDataBuffer() - { - return data_; - } - - /** - * getDataBuffer(int dataLength) - * Get access to current data buffer and make sure it is big enough - * to handle dataLength bytes. It is expected that the caller will set the - * code point data. - * The length parameter should be the length of the code point data - * (doesn't include the code point header). - * Caller must also use the getOffset() method to find out how far into the - * the databuffer they can begin writing the data to. - **/ - byte[] getDataBuffer(int dataLength) - { - if( (data_ == null) || ((data_.length + offset_) < dataLength) ) - { - data_ = new byte[dataLength]; - offset_ = 0; - } - length_ = dataLength; - return data_; - } - - /** - * returns the length of the code point data (does not include the - * code point header of a four byte length and 2 byte id). - **/ - int getDataLength() - { - // total length of code point, length field, id field, and data. - // we do it this way so that subclasses that have overridden getLength() - // will work without overridding getDataLength() - return( getLength() - LEN_HEADER ); - } - - int getID() - { - return( ID_ ); - } - - /** - * get offset to use in databuffer returned on getDataBuffer() - * - **/ - int getOffset() - { - return offset_; - } - - - /** - * method getLenth() returns the entire length of the code point including - * the header. If you just want the length of the data in the codepoint you - * can subtract off the LEN_HEADER value or use getDataLength() - **/ - int getLength() - { - // total length of code point, length field, id field, and data. - return( length_+LEN_HEADER ); - } - - - // set the data buffer this code point should use. - // current codepoint data is lost. - // databuffer should be big enough to hold any expected codepoint data in the - // future or it won't be used. - // datalen parameter gives the number of bytes of codepoint data currently - // in the databuffer. It should be between 0 and the dataBuffer.length. - // If the dataBuffer is empty, set this to 0; - void setDataBuffer( byte[] dataBuffer, int datalen, int offset) - { - data_ = dataBuffer; - length_ = datalen; - offset_ = offset; - } - - // @B1D // set the host ccsid for this codepoint for any text it has - // @B1D void setHostCCSID(int ccsid) - // @B1D { - // @B1D this.hostCCSID_ = ccsid; - // @B1D } - - - void setConverter(ConverterImpl converter) // @B1A - { // @B1A - this.converter_ = converter; // @B1A - } // @B1A - - - void setID( int ID ) - { - this.ID_ = ID; - } - - - /** - * reset - resets the code point to be empty - **/ - void reset() - { - length_ = 0; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/NPConstants.java b/cvsroot/src/com/ibm/as400/access/NPConstants.java deleted file mode 100644 index c69fb024f..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPConstants.java +++ /dev/null @@ -1,31 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPConstants.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class NPConstants -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Network Print Server "objects". - static final int SPOOLED_FILE = 0x0001; - static final int WRITER_JOB = 0x0002; - static final int PRINTER_DEVICE = 0x0003; - static final int OUTPUT_QUEUE = 0x0004; - static final int PRINTER_FILE = 0x0005; - static final int LIBRARY = 0x0006; - static final int RESOURCE = 0x0007; - static final int NP_SERVER = 0x0008; - -} // end of NPDataStream class diff --git a/cvsroot/src/com/ibm/as400/access/NPConversation.java b/cvsroot/src/com/ibm/as400/access/NPConversation.java deleted file mode 100644 index 26c477fca..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPConversation.java +++ /dev/null @@ -1,341 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPConversation.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.util.*; - -/** - * NPConversation class - this internal class is used to represent an network print - * conversation to a particular system. You can get one of these things from - * a NPServer object. - * It is a wrapper for the AS400Server object that takes care of initializing the - * conversation with the host (exchanging CCSIDs and Language IDs) and holding - * the attributes of the server job. - **/ -class NPConversation extends Object -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - // private members - // private int hostCCSID_ = 37; - private ConverterImplRemote converter_ = null; - private AS400ImplRemote system_ = null; - private AS400Server server_; - private NPCPAttribute serverAttributes_; - - - /** - * constructor - **/ - NPConversation(AS400ImplRemote aSystem, AS400Server aServer) - throws AS400Exception, - ErrorCompletingRequestException, - IOException, InterruptedException - { - serverAttributes_ = new NPCPAttribute(); - system_ = aSystem; - server_ = aServer; - try { - retrieveServerAttributes(); //xchange our attributes - } - catch (RequestNotSupportedException e) { - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.AS400_ERROR); - } - } - - - /** - * get reference to the AS400Server object for doing your own thing - **/ - AS400Server getServer() - { - return(server_); - } - - - /** - * get a server attribute - *@parameter attributeID which attribute to retrieve. Maybe - * and of ATTR_NPSLEVEL, - * ATTR_JOBUSER, ATTR_JOBNUMBER or - * ATTR_JOBNAME - *@see NPObject for the attribute ID defines - **/ - String getAttribute(int attributeID) - { - return(serverAttributes_.getStringValue(attributeID)); - } - - - //int getHostCCSID() - //{ - // return(hostCCSID_); - //} - - - ConverterImpl getConverter() - { - return(converter_); - } - - - /** - * make a request of this host server - * @return the NPDataStream return code - **/ - int makeRequest(NPDataStream request, NPDataStream reply) - throws AS400Exception, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - int rc = 0; - int correlation = server_.newCorrelationId(); - //request.setHostCCSID(hostCCSID_); - //reply.setHostCCSID(hostCCSID_); - request.setConverter(converter_); - reply.setConverter(converter_); - request.setCorrelation(correlation); - server_.clearInstanceReplyStreams(); - server_.addInstanceReplyStream(reply); - server_.send(request, correlation); - - reply = (NPDataStream)server_.receive(correlation); - if (reply == null) - { - Trace.log(Trace.ERROR, "Didn't get me datastream back!"); - throw new NullPointerException(); - } else { - rc = reply.getReturnCode(); - if (rc != 0) - { - // Do not log an ERROR here - some RCs are not hard ERRORs - // and the RC was already logged as INFORMATION in NPDataStream. - // Trace.log(Trace.ERROR, "DataStream RC = " + rc); - switch (rc) - { - - // For CPF_MESSAGEs we throw an AS400Exeption error - case NPDataStream.RET_CPF_MESSAGE: - - NPCPAttribute cpCPFMessage = (NPCPAttribute)reply.getCodePoint(NPCodePoint.ATTRIBUTE_VALUE); - if (cpCPFMessage != null) - { - String msgFileName = ""; - String msgLibraryName = ""; - String msgDate = cpCPFMessage.getStringValue(PrintObject.ATTR_DATE); - String msgTime = cpCPFMessage.getStringValue(PrintObject.ATTR_TIME); - String strCPFMessageID = cpCPFMessage.getStringValue(PrintObject.ATTR_MSGID); - String strCPFMessageText = cpCPFMessage.getStringValue(PrintObject.ATTR_MSGTEXT); - String strCPFMessageHelp = cpCPFMessage.getStringValue(PrintObject.ATTR_MSGHELP); - String strCPFMessageDefaultReply = cpCPFMessage.getStringValue(PrintObject.ATTR_MSGREPLY); - Integer intCPFMessageSeverity = cpCPFMessage.getIntValue(PrintObject.ATTR_MSGSEV); - String strCPFMessageType = cpCPFMessage.getStringValue(PrintObject.ATTR_MSGTYPE); - byte[] substitutionData = new byte[cpCPFMessage.getLength()]; - Integer intCPFMessageType = new Integer(strCPFMessageType); - - Trace.log(Trace.ERROR, "CPF Message("+strCPFMessageID+") = " + - strCPFMessageText + ", HelpText= " + strCPFMessageHelp); - - AS400Message msg; - if ((intCPFMessageSeverity!=null) && (intCPFMessageType!=null)) { - msg = new AS400Message(strCPFMessageID, strCPFMessageText, msgFileName , msgLibraryName, intCPFMessageSeverity.intValue(), intCPFMessageType.intValue(), substitutionData , strCPFMessageHelp, msgDate, msgTime, strCPFMessageDefaultReply); - } else { - // pre-v5r1 NPS response. - msg = new AS400Message(strCPFMessageID, strCPFMessageText); - msg.setHelp(strCPFMessageHelp); - } - - // throw an exception containing our CPF message - throw new AS400Exception(msg); - } - - // For READ_EOF we let the caller handle that one - // For empty list we just return the RC and that is OK. - // For return code 4 and 21 (INVALID request action combination - // and function not supported yet) we just return the RC to - // the caller and let them decide if they want to throw - // an exception or just consume it. Exchanging NLVs to older - // systems gives us RC of 21 and we just consume it. - // Opening AFP resources on pre-v3r7 systems gives us - // invalid request-action rc and we end up throwing a - // RequestNotSupportedException elsewhere. We do not throw - // RequestNotSupportedException here because we do not want - // to have it on every request - // For SPLF_NO_MESSAGE we let the caller handle that one - case NPDataStream.RET_READ_EOF: - case NPDataStream.RET_EMPTY_LIST: - case NPDataStream.RET_INV_REQ_ACT: - case NPDataStream.RET_FUNCTION_NOT_SUP: - case NPDataStream.RET_SPLF_NO_MESSAGE: - case NPDataStream.RET_READ_OUT_OF_RANGE: - case NPDataStream.RET_PAGE_OUT_OF_RANGE: - break; - - // NLV_NOT_AVAILABLE means that we requested the server change - // its attributes to use our NLV and it doesn't have our NLV - // installed. We'll just consume this RC and continue with the default - // host NLV. - case NPDataStream.RET_NLV_NOT_AVAILABLE: - Trace.log(Trace.WARNING, "NetPrint DataStream host cannot change to our NLV. RC = " + rc); - break; - - // fill in the rest of these RCs with appropriate - // exceptions - Can be ErrorCompletingRequestExceptions - // or internal errors/datastream errors. - case NPDataStream.RET_INV_ACT_ID: - Trace.log(Trace.ERROR, "NetPrint DataStream RC = " + rc); - throw new RequestNotSupportedException( - this.getAttribute(PrintObject.ATTR_NPSLEVEL), - RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - - default: - Trace.log(Trace.ERROR, "NetPrint DataStream RC = " + rc); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.AS400_ERROR); - } - } - } - return(rc); - } - - - private void retrieveServerAttributes() - throws AS400Exception, - ErrorCompletingRequestException, - IOException, InterruptedException, - RequestNotSupportedException - { - // first thing to do is to get the host CCSID - int rc; - NPDataStream req = new NPDataStream(NPConstants.NP_SERVER); - NPDataStream reply = new NPDataStream(NPConstants.NP_SERVER); - NPCPAttributeIDList attrsToRetrieve = new NPCPAttributeIDList(); - NPCPAttribute sendAttrs = new NPCPAttribute(); - NPCPAttribute recvAttrs = new NPCPAttribute(); // catches returned attributes or CPF message - //----------------------------------------------------------------------- - // 1. Exchange CCSIDs - //----------------------------------------------------------------------- - // Our ccsid is always new unicode (0x34b0). - - //sendAttrs.setAttrValue(PrintObject.ATTR_NPSCCSID, 0x34b0); // HARDCODE to client CCSID 0x34B0 - new unicode - sendAttrs.setAttrValue(PrintObject.ATTR_NPSCCSID, - ExecutionEnvironment.getCcsid()); // - attrsToRetrieve.addAttrID(PrintObject.ATTR_NPSCCSID); // this is what we want back - - req.setAction(NPDataStream.RETRIEVE_ATTRIBUTES); - req.addCodePoint(sendAttrs); - req.addCodePoint(attrsToRetrieve); - - reply.addCodePoint(recvAttrs); - - rc = makeRequest(req, reply); - - if (rc == NPDataStream.RET_OK) - { - Integer serverCCSID = recvAttrs.getIntValue(PrintObject.ATTR_NPSCCSID); - if (serverCCSID != null) - { - int hostCCSID = serverCCSID.intValue(); - serverAttributes_.setAttrValue(PrintObject.ATTR_NPSCCSID, hostCCSID); - converter_ = ConverterImplRemote.getConverter(hostCCSID, system_); - } - - //----------------------------------------------------------------------- - // 2. Exchange NLV ID (ie: "2924") - //----------------------------------------------------------------------- - // Call to change the server language attribute - // we send up a string (in the server's CCSID which is why we first - // had to get the server CCSID value) indicating our language (ie "2924"). - // The server will attempt to use that language for CFP messages that it - // sends back (changes its library list order) but it might not be able to - // if that language isn't on the 400 for the server's product. The server - // will send back the langauge that it is using on the reply. - - sendAttrs.reset(); - attrsToRetrieve.reset(); - - // - // we send up our NLV_ID (ie: "2924") and we ask the server - // to send back its NLV_ID - // - sendAttrs.setAttrValue(PrintObject.ATTR_NLV_ID, system_.getNLV()); - attrsToRetrieve.addAttrID(PrintObject.ATTR_NLV_ID); - - req.setAction(NPDataStream.CHANGE_ATTRIBUTES); - req.resetCodePoints(); - req.addCodePoint(sendAttrs); - req.addCodePoint(attrsToRetrieve); - - recvAttrs.reset(); - reply.resetCodePoints(); - reply.addCodePoint(recvAttrs); - - // make the change server request - // makeRequest() will throw an exception if it fails - makeRequest(req, reply); - - // put the attributes that we received back (should just be the - // the server's NLV_ID) into our serverAttributes_ codepoint - serverAttributes_.addUpdateAttributes(recvAttrs); - - //----------------------------------------------------------------------- - // 3. Get the other server attributes (job info and VRM) - //----------------------------------------------------------------------- - - // set which attribute we are interested in now from the server - // Job name, number, user, version - attrsToRetrieve.reset(); - attrsToRetrieve.addAttrID(PrintObject.ATTR_NPSLEVEL); - attrsToRetrieve.addAttrID(PrintObject.ATTR_JOBNAME); - attrsToRetrieve.addAttrID(PrintObject.ATTR_JOBUSER); - attrsToRetrieve.addAttrID(PrintObject.ATTR_JOBNUMBER); - - req.setAction(NPDataStream.RETRIEVE_ATTRIBUTES); - req.resetCodePoints(); - req.addCodePoint(attrsToRetrieve); - - recvAttrs.reset(); - reply.resetCodePoints(); - reply.addCodePoint(recvAttrs); - - rc = makeRequest(req, reply); - if (rc == NPDataStream.RET_OK) - { - serverAttributes_.addUpdateAttributes(recvAttrs); - // if information tracing is on, - // log the VRM of the system we are talking to - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) - { - Trace.log(Trace.INFORMATION, - " Network Print Server started "); - Trace.log(Trace.INFORMATION, - " NetPrint Server info (System/Job#/JobUser/JobName): " + - //server_.getSystem().getSystemName() + "/" + - serverAttributes_.getStringValue(PrintObject.ATTR_JOBNUMBER) + "/" + - serverAttributes_.getStringValue(PrintObject.ATTR_JOBUSER) + "/" + - serverAttributes_.getStringValue(PrintObject.ATTR_JOBNAME) - ); - - Trace.log(Trace.INFORMATION, - " NetPrint Server VRM = " + - serverAttributes_.getStringValue(PrintObject.ATTR_NPSLEVEL) - ); - } - } - } - } // retrieveServerAttributes -} -// NPConversation class diff --git a/cvsroot/src/com/ibm/as400/access/NPDataAnalyzer.java b/cvsroot/src/com/ibm/as400/access/NPDataAnalyzer.java deleted file mode 100644 index 777306ae8..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPDataAnalyzer.java +++ /dev/null @@ -1,706 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPDataAnalyzer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * Class NPDataAnalyzer is an internal class used to analyze print data - * streams. It can detect if they are SCS or AFP and if they are not - * one of those it will default to USERASCII. - * - **/ - -class NPDataAnalyzer extends Object -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private static final String DT_AFPDS = "*AFPDS"; - private static final String DT_USERASCII = "*USERASCII"; - private static final String DT_SCS = "*SCS"; - - private static boolean dataIsAFP(byte[] buf, int offset, int len) - { - boolean fRC = false, fDone = false; - int tempOffset = offset; - int tempLen; - while ((tempOffset < len) && !fDone) - { - if (buf[tempOffset] == 0x5A) - { - // we will say this is AFP if we see atleast 2 0x5As - if (tempOffset != offset) - { - fRC = true; // second or later 5A - } - // if we have atleast 3 bytes left - // jump ahead that many bytes - if ((len-tempOffset) >= 3) - { - // get the AFP structured field length from BigEndian - tempOffset++; // move to length field - // tempLen = xlate.getInt16(buf, tempOffset); - tempLen = BinaryConverter.byteArrayToUnsignedShort(buf, tempOffset); - tempOffset += tempLen; - if (tempLen < 5) - { - // can never be less than 5 for the - // length because the length itself is 2 bytes - // and then there is the 3 byte triplet. - fDone = true; // we are done here - fRC = false; // not AFP - } - } else { - fDone = true; // not enough data to process we are done - - } - } else { - // not a 5A, NOT AFP and we are done - fRC = false; - fDone = true; - } - } // end while() - - - return fRC; - } // dataIsAFP() - - private static boolean dataIsSCS(byte[] buf, int offset, int len) - { - boolean fRC = false; - boolean fDone = false; - - while ((len > 0) && - !fDone) - { - // cast next byte to an int and AND (&) it with 0xFF, - // because we want unsigned bytes and we do a less - // than operation with it (<) and don't want it to be - // negative ever. - int nextByte = (int)buf[offset] & 0x000000FF; - if (nextByte < (int)SPACE_CC) - { - switch(nextByte) - { - /********************************************************** - * Process all one byte SCS commands * - * I do not set the RC to YES here because one byte of these* - * doesnot make it SCS data. A case in point was where * - * the use sends 1K of 0x36 codepoints - should be a K of * - * ASCII "6" chars, but we say it is SCS and only contains * - * the 0x36 character, no writable data. * - * CASE backspace: * - * CASE expanded backspace: * - * CASE unitbackspace: * - * CASE bel: * - * CASE carriage return: * - * CASE form feed: * - * CASE required form feed: * - * CASE graphic escape: * - * CASE horizontal tab: * - * CASE indent tab: * - * CASE line feed: * - * CASE required new line: * - * CASE null: * - * CASE new line: * - * CASE interchange record separator: * - * CASE enable presentation: * - * CASE inhibit presentation: * - * CASE word underscore: * - * CASE vertical tab: * - * CASE switch: * - * Move the SCSDatapointer 1 byte ahead * - * subtract 1 from the length remaining * - * BREAK * - **********************************************************/ - case BACKSPACE_CC: - case EXPANDED_BACKSPACE_CC: - case UNITBACKSPACE_CC: - case BEL_CC: - case CARRIAGE_RETURN_CC: - case SUBSCRIPT_CC: - case SUPERSCRIPT_CC: - case FORM_FEED_CC: - case REQUIRED_FORM_FEED_CC: - case HORIZONTAL_TAB_CC: - case INDENT_TAB_CC: - case LINE_FEED_CC: - case INDEX_RETURN_CC: - case REQUIRED_NEW_LINE_CC: - case NEW_LINE_CC: - case INTERCHANGE_RECORD_SEPARATOR_CC: - case ENABLE_PRESENTATION_CC: - case INHIBIT_PRESENTATION_CC: - case WORD_UNDERSCORE_CC: - case VERTICAL_TAB_CC: - case SHIFT_OUT_CC: - case SHIFT_IN_CC: - case SUBSTITUTE_CC: - case SWITCH_CC: - case NULL_CC: - offset++; - len--; - break; - /********************************************************** - * CASE presentation position: * - * IF we have all the data for the command * - * THEN * - * CALL PRESENTATIONPOSITION(function code from * - * command, value from command) to move to the * - * presentations position specified * - * Subtract the size of the PP command from the * - * length field in the print message * - * Add the size of the PP command to the work * - * pointer so that it points to the next * - * command * - * ELSE * - * Flag that there is no more stuff to process * - * BREAK * - **********************************************************/ - - case PRESENTATION_POSITION_CC: - if(len >= PP_STRUCT_LEN) - { - switch(buf[offset+1]) - { - - /************************************************* - * CASE Absolute Horizontal Presentation Position * - * CASE Absolute Verital Presentation Position * - * CASE Relative Horizontal Presentation Position * - * CASE Relative Verital Presentation Position * - * BREAK * - *************************************************/ - case PPCODE_AHPP: - case PPCODE_AVPP: - case PPCODE_RHPP: - case PPCODE_RVPP: - offset += PP_STRUCT_LEN; - len -= PP_STRUCT_LEN; - fRC = true; - break; - default: - fRC = false; - fDone = true; // we are done here - } /* end switch */ - } else { - fDone = true; // not enough left to process - } - break; - /********************************************************** - * CASE set attribute: * - * IF we have all the data for the command * - * THEN * - * CALL SETATTRIBUTE(type from command, value from * - * command to set the attribute * - * Subtract the size of the SA command from the * - * length field in the print message * - * Add the size of the SA command to the work * - * pointer so that it points to the next * - * command * - * ELSE * - * Flag that there is no more stuff to process * - * BREAK * - **********************************************************/ - - case SET_ATTRIBUTE_CC: - if(len >= SA_STRUCT_LEN) - { - switch(buf[offset+1]) - { - - /************************************************* - * CASE ATTR_CHAR_SET * - * we don't support the other attributes on the * - * the server. * - * BREAK * - *************************************************/ - case ATTR_CHAR_SET: - offset += SA_STRUCT_LEN; - len -= SA_STRUCT_LEN; - fRC = true; - break; - default: - fRC = false; - fDone = true; - } /* end switch */ - } else { - fDone = true; - } - break; - /********************************************** - * case 2B is a multibyte command * - * 2BCCnntt.... * - * CC is the command class (D1, D2, etc) * - * nn is the number of bytes left in the * - * command including this nn byte. * - * tt is the type * - **********************************************/ - case CSP_CC: - if ( (len >= 3) && - (len >= (buf[offset + 2] + 2) ) ) - { - int count = buf[offset+2]; - switch(buf[offset+1]) - { - - /************************************************* - * CASE set graphic error action: * - * CASE set horizontal format: * - * CASE set line density: * - * CASE set vertical format: * - * BREAK * - *************************************************/ - - case GRAPHIC_ERROR_ACTION_CC: - case HORIZONTAL_FORMAT_CC: - case LINE_DENSITY_CC: - case VERTICAL_FORMAT_CC: - len -= (count + 2); - offset += (count + 2); - fRC = true; - - break; - /************************************************* - * CASE FontClass * - * a FONTCLASS is class 'D1'X. The commands * - * are SFG, SCG and SCGL, BES, EES * - * casentry type * - * CASE SFG * - * CASE BES * - * CASE EES * - * CASE SCG * - * CASE SFG * - * Set as SCS data and advance past command * - * BREAK * - * DEFAULT * - * Not SCS and we are done. * - * BREAK * - * BREAK * - *************************************************/ - - case FONTCLASS: - { - switch (buf[offset+3]) // switch on the type - { - case SFG_CC: - case BES_CC: - case EES_CC: - case SCG_CC: - case SCGL_CC: - { - len -= (count + 2); - offset += (count + 2); - fRC = true;; - break; - } /* endcase */ - default: - { - fRC = false; - fDone = true; - break; - } - } /* endswitch */ - break; - } /* end CASE D1 */ - /************************************************* - * CASE D2: * - * casentry type * - * CASE SetHorzTabs (STAB) * - * CASE SetPrintDensity * - * CASE SetLineSpacing * - * CASE SetSingleLineDistance * - * CASE SetHorizontalMargins * - * CASE SetVerticalMargins * - * CASE SJM command * - * CASE JTF command * - * CASE SetErrorAction * - * CASE SetInitialConditions * - * CASE SetIndentLevel * - * CASE SetPresentationColor * - * CASE SetPresentationPageMedia * - * CASE SetPrinterSetup * - * Set as SCS data * - * Advance past this command * - * BREAK * - * DEFAULT * - * Not SCS and we are done. * - * BREAK * - * ENDCASE * - * BREAK * - *************************************************/ - - case DOGTWO: - { - switch (buf[offset+3]) // switch on the type - { - case STAB_CC: - case PRINT_DENSITY_CC: - case SET_LINESPACE_CC: - case SET_LINEDISTANCE_CC: - case SET_HORZMARGINS_CC: - case SET_VERTMARGINS_CC: - case SET_ERROR_ACTION_CC: - case SET_INITCOND_CC: - case SET_INDENTLV_CC: - case SET_JUSTIFYMODE_CC: - case JUSTIFY_TEXTFIELD_CC: - case SET_PRESCOLOR_CC: - case SET_PRESPAGESIZE_CC: - case SET_PPAGEMEDIA_CC: - case SET_PRINTERSETUP_CC: - case RELEASE_LEFT_MARGIN_CC: - len -= (count+ 2); - offset += (count+ 2); - fRC = true; - break; - - default: - fRC = false; - fDone = true; - break; - - } /* endswitch */ - - break; - } /* end CASE D2 */ - /************************************************* - * CASE D3: * - * casentry type * - * CASE SetTextOrientataion * - * Set as SCS data * - * Advance past this command * - * DEFAULT * - * Not SCS data and we are done * - * BREAK * - * ENDCASE * - * BREAK * - *************************************************/ - - case DOGTHREE: - { - switch (buf[offset+3]) // switch on the type - { - case STO_CC: - { - len -= (count+ 2); - offset += (count+ 2); - fRC = true; - break; - } - - default: - { - fRC = false; - fDone = true; - } - } /* endswitch */ - break; - } /* end CASE D3 */ - /************************************************* - * CASE D4: * - * casentry type * - * CASE Begin Under Score * - * CASE End Under Score * - * CASE Begin Over Strike * - * CASE End Over Strike * - * Set as SCS data. * - * advance past this command * - * DEFAULT * - * NOT SCS and we are done * - * BREAK * - * ENDCASE * - * BREAK * - *************************************************/ - - case DOGFOUR: - { - switch (buf[offset+3]) // switch on the type - { - case BUS_CC: - case EUS_CC: - case BOS_CC: - case EOS_CC: - { - len -= (count+ 2); - offset += (count+ 2); - fRC = true; - break; - } - - default: - { - fRC = false; - fDone = true; - break; - } - } /* endswitch */ - break; - } /* end CASE D4 */ - - /************************************************* - * CASE FD: * - * casentry type * - * CASE Define Grid Lines * - * CASE Set IGC Type * - * CASE Set Font Size Scaling * - * CASE Set Presentation of Control Char * - * Set as SCS data. * - * advance past this command * - * DEFAULT * - * NOT SCS and we are done * - * BREAK * - * ENDCASE * - * BREAK * - *************************************************/ - - case FOXDOG: - { - switch (buf[offset+3]) // switch on the type - { - case DGL_CC: - case SIT_CC: - case SFSS_CC: - case SPCC_CC: - { - len -= (count+ 2); - offset += (count+ 2); - fRC = true; - break; - } - - default: - { - fRC = false; - fDone = true; - break; - } - } /* endswitch */ - break; - } /* end CASE FD */ - - - /************************************************* - * DEFAULT: * - * NOT SCS and we are done * - * BREAK * - *************************************************/ - - default: - fRC = false; - fDone = true; - break; - } /* end of switch */ - } else { - fDone = true; - } - break; - /********************************************************** - * CASE ASCII Transparency * - * CASE SCS transparent: * - **********************************************************/ - case ASCII_TRNSPRNT_CC: - case TRANSPARENT_CC: - if ((len >= 2) && - (len >= (buf[offset + 1] + 2) ) ) - - { - len -= buf[offset + 1] + 2; - offset += buf[offset + 1] + 2; - fRC = true; - } else { - fDone = true; - } /* endif */ - break; - - - /********************************************************** - * Any other control codes are unsupported. * - **********************************************************/ - - /********************************************************** - * DEFAULT: * - * Not SCS data, we are done. * - * BREAK * - **********************************************************/ - - default: - fRC = false; - fDone = true; - break; - } - - - } else { - /*************************************************************/ - /* byte is >= 0x40 and is just a regular character, so */ - /* goto next byte - we can't say it is SCS data unless we */ - /* have some SCS commands - EBCDIC text only will not show up*/ - /* as SCS data. */ - /*************************************************************/ - len--; - offset++; - } - } - - return fRC; - } // dataIsSCS() - - /** sniffs the data and tells you what it appears to be. - * @param buf The data buffer. - * @param offset Offset into the data buffer to start at. - * @param len The number of bytes to analyze. - * @return A string with the server Printer Device Type - * value of what this data is most likely (*SCS, - * *AFPDS or *USERASCII). - **/ - static String sniff(byte[] buf, int offset, int len) - { - String str = DT_USERASCII; - if (dataIsAFP(buf, offset, len)) - { - str = DT_AFPDS; - } else { - if (dataIsSCS(buf, offset, len)) - { - str = DT_SCS; - } - } - return str; - } - - // bunch of constants used for breaking SCS data stream - private static final byte ASCII_TRNSPRNT_CC = (byte)0x03; - private static final byte BACKSPACE_CC = (byte)0x16; - private static final byte UNITBACKSPACE_CC = (byte)0x1A; - private static final byte BEL_CC = (byte)0x2F; - private static final byte CARRIAGE_RETURN_CC = (byte)0x0D; - private static final byte ENABLE_PRESENTATION_CC = (byte)0x14; - private static final byte EXPANDED_BACKSPACE_CC = (byte)0x36; - private static final byte FORM_FEED_CC = (byte)0x0C; - private static final byte GRAPHIC_ESCAPE_CC = (byte)0x08; - private static final byte HORIZONTAL_TAB_CC = (byte)0x05; - private static final byte INDENT_TAB_CC = (byte)0x39; - private static final byte INDEX_RETURN_CC = (byte)0x33; - private static final byte INHIBIT_PRESENTATION_CC = (byte)0x24; - private static final byte INTERCHANGE_RECORD_SEPARATOR_CC = (byte)0x1E; - private static final byte LINE_FEED_CC = (byte)0x25; - private static final byte NEW_LINE_CC = (byte)0x15; - private static final byte NULL_CC = (byte)0x00; - private static final byte PRESENTATION_POSITION_CC = (byte)0x34; - private static final byte REQUIRED_FORM_FEED_CC = (byte)0x3A; - private static final byte REQUIRED_NEW_LINE_CC = (byte)0x06; - private static final byte SPACE_CC = (byte)0x40; - private static final byte REQUIRED_SPACE_CC = (byte)0x41; - private static final byte SET_ATTRIBUTE_CC = (byte)0x28; - private static final byte SHIFT_OUT_CC = (byte)0x0E; - private static final byte SHIFT_IN_CC = (byte)0x0F; - private static final byte SWITCH_CC = (byte)0x2A; - private static final byte CSP_CC = (byte)0x2B; - private static final byte SUBSTITUTE_CC = (byte)0x3F; - private static final byte GRAPHIC_ERROR_ACTION_CC = (byte)0xC8; - private static final byte HORIZONTAL_FORMAT_CC = (byte)0xC1; - private static final byte LINE_DENSITY_CC = (byte)0xC6; - private static final byte NUMERIC_SPACE_CC = (byte)0xE1; - private static final byte SUBSCRIPT_CC = (byte)0x38; - private static final byte SUPERSCRIPT_CC = (byte)0x09; - private static final byte SYLLABLE_HYPHEN_CC = (byte)0xCA; - private static final byte TRANSPARENT_CC = (byte)0x35; - private static final byte VERTICAL_CHANNEL_SELECT_CC = (byte)0x04; - private static final byte VERTICAL_TAB_CC = (byte)0x0B; - private static final byte WORD_UNDERSCORE_CC = (byte)0x23; - - /******************************************************************************/ - /* the following commands all begin with 2BD1 */ - /******************************************************************************/ - private static final byte FONTCLASS = (byte)0xD1; - private static final byte SCG_CC = (byte)0x01; - private static final byte SCGL_CC = (byte)0x81; - private static final byte SFG_CC = (byte)0x05; - private static final byte BES_CC = (byte)0x8A; - private static final byte EES_CC = (byte)0x8E; - - /******************************************************************************/ - /* the following set all begin with = (byte)0x2BD2 and here we define the type byte */ - /******************************************************************************/ - private static final byte DOGTWO = (byte)0xD2; - private static final byte STAB_CC = (byte)0x01; - private static final byte JUSTIFY_TEXTFIELD_CC = (byte)0x03; - private static final byte SET_INDENTLV_CC = (byte)0x07; - private static final byte SET_LINESPACE_CC = (byte)0x09; - private static final byte RELEASE_LEFT_MARGIN_CC = (byte)0x0B; - private static final byte SET_JUSTIFYMODE_CC = (byte)0x0D; - private static final byte SET_HORZMARGINS_CC = (byte)0x11; - private static final byte SET_LINEDISTANCE_CC = (byte)0x15; - private static final byte PRINT_DENSITY_CC = (byte)0x29; - private static final byte SET_PRESCOLOR_CC = (byte)0x2D; - private static final byte SET_PRESPAGESIZE_CC = (byte)0x40; - private static final byte SET_INITCOND_CC = (byte)0x45; - private static final byte SET_PPAGEMEDIA_CC = (byte)0x48; - private static final byte SET_VERTMARGINS_CC = (byte)0x49; - private static final byte SET_PRINTERSETUP_CC = (byte)0x4C; - private static final byte SET_ERROR_ACTION_CC = (byte)0x85; - private static final byte VERTICAL_FORMAT_CC = (byte)0xC2; - - - /******************************************************************************/ - /* the following set all begin with = (byte)0x2BD3 and here we define the type byte */ - /******************************************************************************/ - private static final byte DOGTHREE = (byte)0xD3; - private static final byte STO_CC = (byte)0xF6; - - /******************************************************************************/ - /* the following set all begin with 0x2BD4 and here we define the type byte */ - /******************************************************************************/ - private static final byte DOGFOUR = (byte)0xD4; - private static final byte BUS_CC = (byte)0x0A; - private static final byte EUS_CC = (byte)0x0E; - private static final byte BOS_CC = (byte)0x72; - private static final byte EOS_CC = (byte)0x76; - - /******************************************************************************/ - /* the following set all begin with 0x2BFD and here we define the type byte */ - /******************************************************************************/ - private static final byte FOXDOG = (byte)0xFD; - private static final byte DGL_CC = (byte)0x00; - private static final byte SIT_CC = (byte)0x01; - private static final byte SFSS_CC = (byte)0x02; - private static final byte SPCC_CC = (byte)0x03; - - /********************************************************************** - * Structure for Presentation Position * - * 0x34ccvv - cc = code; vv = value; * - ***********************************************************************/ - private static final byte PP_STRUCT_LEN = 0x03; // length of PP structure - /* defines for PPcode field */ - private static final byte PPCODE_AHPP = (byte)0xC0; /* Absolute Horizontal */ - private static final byte PPCODE_AVPP = (byte)0xC4; /* Absolute Veritcal */ - private static final byte PPCODE_RHPP = (byte)0xC8; /* Relative Horizontal */ - private static final byte PPCODE_RVPP = (byte)0x4C; /* Relative Veritcal */ - - /********************************************************************** - * Structure for Set Attribute * - * 0x28ttvv tt=type; vv = value * - **********************************************************************/ - private static final byte SA_STRUCT_LEN = 0x03; // length of SA structure - /* Defines for the type field */ - private static final byte ATTR_RESET = (byte)0x00; /* Reset */ - private static final byte ATTR_COLOR = (byte)0x42; /* Set color */ - private static final byte ATTR_HILITE = (byte)0x41; /* Set highlight */ - private static final byte ATTR_CHAR_SET = (byte)0x43; /* Set character set */ - - -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/NPDataStream.java b/cvsroot/src/com/ibm/as400/access/NPDataStream.java deleted file mode 100644 index 684d9fd88..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPDataStream.java +++ /dev/null @@ -1,469 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -/** - *Base class of Network Print data streams. This same class is used - *for both request and reply data streams. - **/ - -class NPDataStream extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final int NP_SERVER_ID = 0xE003; - - // Network Print Server Template. - static final int TEMPLATE_LENGTH = 12; - static final int ACTION_ID_OFFSET = HEADER_LENGTH + 0; - static final int FLAGS_OFFSET = HEADER_LENGTH + 2; - static final int RC_OFFSET = HEADER_LENGTH + 6; - static final int EO_OFFSET = HEADER_LENGTH + 8; - static final int LAST_REPLY_MASK = (int)0x80000000; - static final int CODE_POINT_OFFSET = HEADER_LENGTH + TEMPLATE_LENGTH; - -// @B1D // Network Print Server "objects". -// @B1D static final int SPOOLED_FILE = 0x0001; -// @B1D static final int WRITER_JOB = 0x0002; -// @B1D static final int PRINTER_DEVICE = 0x0003; -// @B1D static final int OUTPUT_QUEUE = 0x0004; -// @B1D static final int PRINTER_FILE = 0x0005; -// @B1D static final int LIBRARY = 0x0006; -// @B1D static final int RESOURCE = 0x0007; -// @B1D static final int NP_SERVER = 0x0008; - - // Network Print Server "actions". - static final int CREATE = 0x0001; - static final int OPEN = 0x0002; - static final int READ = 0x0003; - static final int WRITE = 0x0004; - static final int CLOSE = 0x0005; - static final int HOLD = 0x0006; - static final int RELEASE = 0x0007; - static final int START = 0x0008; - static final int END = 0x0009; - static final int DELETE = 0x000A; - static final int MOVE = 0x000B; - static final int SEND = 0x000C; - static final int CALL_EXIT_PROGRAM = 0x000D; - static final int CHANGE_ATTRIBUTES = 0x000E; - static final int RETRIEVE_ATTRIBUTES = 0x000F; - static final int RETRIEVE_ATTRIBUTE_INFO = 0x0010; - static final int RETRIEVE_MESSAGE = 0x0011; - static final int ANSWER_MESSAGE = 0x0012; - static final int WATCH = 0x0013; - static final int CHECK_AUTHORITY = 0x0014; - static final int PURGE = 0x0015; - static final int LIST = 0x0016; - static final int SEEK = 0x0017; - static final int TELL = 0x0018; - static final int SELECT_PAGE = 0x0019; /* @A1A */ - static final int OPEN_MODIFIED_SPLF = 0x001A; /* @A2A */ - static final int COPY = 0x001B; /* @C1A */ - - // Network Print Server return codes - static final int RET_OK = 0x0000; - static final int RET_INV_REQ_STRUCT = 0x0001; - static final int RET_INV_REQ_ID = 0x0002; - static final int RET_INV_ACT_ID = 0x0003; - static final int RET_INV_REQ_ACT = 0x0004; - static final int RET_INV_CODEPOINT = 0x0005; - static final int RET_INV_ATTR = 0x0006; - static final int RET_INV_ATTRVALUE = 0x0007; - static final int RET_NOT_AUTHORIZED = 0x0008; - static final int RET_CPF_MESSAGE = 0x0009; - static final int RET_INV_SPLF_HANDLE = 0x000A; - static final int RET_SPLF_CREATE_ERR = 0x000B; - static final int RET_CL_ERROR = 0x000C; - static final int RET_SPLF_NOT_OPEN = 0x000D; - static final int RET_SPLF_NO_MESSAGE = 0x000E; - static final int RET_SPLF_OPEN_FAILED= 0x000F; - static final int RET_SEEK_OFF_BAD = 0x0010; - static final int RET_SEEK_FAILED = 0x0011; - static final int RET_READ_INCOMPLETE = 0x0012; - static final int RET_READ_EOF = 0x0013; - static final int RET_EMPTY_LIST = 0x0014; - static final int RET_FUNCTION_NOT_SUP= 0x0015; - static final int RET_CANNOT_ACC_PRTF = 0x0016; - static final int RET_CANNOT_ACC_PRTF_ATTR = 0x0017; - static final int RET_WRITER_NOT_FOUND = 0x0018; - static final int RET_RETURN_CP_MISSING = 0x0019; - static final int RET_NO_EXIT_PGM = 0x001A; - static final int RET_EXIT_PGM_DENIED = 0x001B; - static final int RET_NLV_NOT_AVAILABLE = 0x001C; - static final int RET_INV_BYTE_COUNT = 0x001D; /* @A1A */ - static final int RET_SPLF_NOT_FOUND = 0x001E; /* @A1A */ - static final int RET_INV_DATA_TYPE = 0x001F; /* @A1A */ - static final int RET_READ_OUT_OF_RANGE = 0x0020; /* @A1A */ - static final int RET_PAGE_OUT_OF_RANGE = 0x0021; /* @A1A */ - - private int reqRepID_; - private int correlation_; - private int actionID_; - // @B1D private int hostCCSID_; - private ConverterImpl converter_; // @B1C - - // - // we could use a hashTable (dictionary) of codepoints using their ID as - // hashing keys but that is probably excessive since there are only 16 codepoints - // currently and all IDs are sequential starting at ID # 1, it will work to use - // a simple array of codepoints with their IDs as the index - // - // private Vector codePoints = new Vector(); - private NPCodePoint[] codePoints_ = new NPCodePoint[NPCodePoint.MAX_CODEPOINT_ID+1]; - - NPDataStream(NPDataStream ds) - { - super(); - data_ = new byte[ds.data_.length]; - System.arraycopy(ds.data_, 0, - data_, 0, - data_.length); - - int i; - reqRepID_ = ds.reqRepID_; - correlation_ = ds.correlation_; - actionID_ = ds.actionID_; - // @B1D hostCCSID_ = ds.hostCCSID_; - converter_ = ds.converter_; // @B1A - - for (i = 0; i< codePoints_.length; i++) - { - if (ds.codePoints_[i] != null) - { - codePoints_[i] = (NPCodePoint)ds.codePoints_[i].clone(); - } - } - } - - NPDataStream() - { - super(); - reqRepID_ = 0; - correlation_ = 0; - actionID_ = 0; - // @B1D hostCCSID_ = 0; - converter_ = null; // @B1A - } - - NPDataStream( int reqRepID ) - { - super(); - - correlation_ = 0; - actionID_ = 0; - // @B1D hostCCSID_ = 0; - converter_ = null; // @B1A - - setObject( reqRepID ); - } - - // This method is called when we need to copy this data stream into - // a new datastream. We (NP) have this method called when we are - // receiving a list of objects back from the server - each item in the - // the list has a new datastream created to catch it. - Object getNewDataStream() - { - return new NPDataStream(this); - } - - public int hashCode() - { - return (reqRepID_ | 0x8000); - } - - void setObject( int reqRepID ) - { - this.reqRepID_ = reqRepID; - } - - void setAction( int actionID ) - { - this.actionID_ = actionID; - } - - void setCorrelation( int correlation ) - { - this.correlation_ = correlation; - } - - // @B1D void setHostCCSID(int ccsid ) - // @B1D { - // @B1D hostCCSID_ = ccsid; - // @B1D // Look at any code points to determine how big this - // @B1D // data stream is. There does not have to be any code - // @B1D // points. The NP data stream always uses a fixed size - // @B1D // template, any variable data for the request/reply - // @B1D // is carried in code points. - // @B1D - // @B1D for( int i=0; i < codePoints_.length; i++ ) - // @B1D { - // @B1D NPCodePoint cp = codePoints_[i]; - // @B1D if (cp != null) - // @B1D { - // @B1D // Let the codepoint know the host ccsid encoding for any text data - // @B1D cp.setHostCCSID(hostCCSID_); - // @B1D } - // @B1D } - // @B1D - // @B1D - // @B1D } - - void setConverter(ConverterImpl converter) // @B1A - { // @B1A - converter_ = converter; // @B1A - // @B1A - // Look at any code points to determine how big this // @B1A - // data stream is. There does not have to be any code // @B1A - // points. The NP data stream always uses a fixed size // @B1A - // template, any variable data for the request/reply // @B1A - // is carried in code points. // @B1A - for( int i=0; i < codePoints_.length; i++ ) // @B1A - { // @B1A - NPCodePoint cp = codePoints_[i]; // @B1A - if (cp != null) // @B1A - { // @B1A - // Let the codepoint know the host ccsid encoding for any text data // @B1A - cp.setConverter(converter_); // @B1A - } // @B1A - } // @B1A - } // @B1A - - void addCodePoint( NPCodePoint codePoint ) - { - int ID = codePoint.getID(); - if (validCPID(ID)) - { - codePoints_[ID] = codePoint; - } - } - - NPCodePoint getCodePoint(int ID) - { - NPCodePoint cp = null; - if (validCPID(ID)) - { - cp = codePoints_[ID]; - } - return (cp); - } - - void resetCodePoints() - { - for (int i = 0; i 0x7FFF (negative number) - System.arraycopy(cpData, dataOffset, // source - data_, cpOffset, // dest - length); - - cpOffset += length; - } - } - } - - super.write(out); - } - - // Most of the work for a reply data stream happens here. - - int readAfterHeader( InputStream in ) - throws IOException - { - // The header has already been read by ClientAccessDataStream(). - int bytesAvailable = getLength() - HEADER_LENGTH; - - // Read the required template. - int bytesRead = readFromStream(in, data_, HEADER_LENGTH, getTemplateLen() ); - - // Check the return code - // don't log an ERROR here - just info; this dumps a stack trace and - // some non-0 return codes are OK (empty list and some others). - if( 0 != getReturnCode() ) - { - Trace.log(Trace.INFORMATION, " Netprint Datastream Return code was " + getReturnCode()); - } - - // Check for any code points in the data stream. Code points are optional. - // If there are codepoints coming back, they should be prestored in the the - // array of codepoints. - byte[] llcp = new byte[NPCodePoint.LEN_HEADER]; - byte[] cpData = null; - NPCodePoint cp = null; - int temp; - int dataOffset; - - while( bytesRead < bytesAvailable ) - { - temp = readFromStream(in, llcp, 0, llcp.length); - if (temp != llcp.length) - { - Trace.log(Trace.ERROR, "Didn't read 6 bytes that we needed to!"); - throw new IOException(Integer.toString(llcp.length)); - } - bytesRead += temp; - int cpDataLength = BinaryConverter.byteArrayToInt(llcp, 0)-llcp.length; //sms - int cpID = BinaryConverter.byteArrayToUnsignedShort(llcp,4); //sms - - // if the codepoint ID is not valid or is not prestored - // create a generic codepoint - if (!validCPID(cpID) || (codePoints_[cpID] == null)) - { - Trace.log(Trace.ERROR, "NPDataStream receiving orphan code point ID =" + cpID); - cp = new NPCodePoint(cpID); - if (!validCPID(cpID)) - { - codePoints_[0] = cp; - } else { - codePoints_[cpID] = cp; - } - } else { - cp = codePoints_[cpID]; - } - - // let the codepoint know the host ccsid encoding for any text data - // @B1D cp.setHostCCSID(hostCCSID_); - cp.setConverter(converter_); // @B1A - - cpData = cp.getDataBuffer(cpDataLength); // ask codepoint for a receive buffer - dataOffset = cp.getOffset(); // find out where to start writing - - temp = readFromStream(in, cpData, dataOffset, cpDataLength); - if (temp != cpDataLength) - { - Trace.log(Trace.ERROR, "Didn't read " + cpDataLength + " bytes that we needed!"); - throw new IOException(Integer.toString(cpDataLength)); - } - bytesRead += temp; - - - } - - return( bytesRead ); - } - - - private boolean validCPID(int ID) - { - - if ((ID > 0) && (ID < codePoints_.length)) - { - return true; - } - return false; - } - - - -} // end of NPDataStream class diff --git a/cvsroot/src/com/ibm/as400/access/NPSystem.java b/cvsroot/src/com/ibm/as400/access/NPSystem.java deleted file mode 100644 index 7cf499bce..000000000 --- a/cvsroot/src/com/ibm/as400/access/NPSystem.java +++ /dev/null @@ -1,400 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NPSystem.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Hashtable; -import java.util.Vector; -import java.util.Enumeration; -import java.io.IOException; - -/** - *NPSystem class - this class is used to represent systems from a network - * print perspective. There is ONE instance of this class for each system that - * you are interested in. There is a static method to get at the one instance - * of this class based on the system name. - * Use this instance to get AS400Server objects (these are the conversations to - * this system). - **/ - -class NPSystem extends Object implements Runnable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // static data members - private static final int CONVERSATION_TIMEOUT = 300000; // 5 minutes in milleseconds - private static Hashtable NPSystemTable_ = new Hashtable(); - - // private members - private AS400ImplRemote as400System_; - private Vector availConversations_, inuseConversations_, deadConversations_; - private Thread cleanupThread_; - - // The cleanup thread is only started if the AS400 object containing - // the AS400Server objects allows threads to be started. EJB does not - // allow objects to start threads. - - /** - * private constructor - use the static getSystem() method to create one of these - **/ - private NPSystem(AS400ImplRemote aSystem) - { - as400System_ = aSystem; - availConversations_ = new Vector(); - inuseConversations_ = new Vector(); - deadConversations_ = new Vector(); - } - - // protected members & methods - - // public members & methods - - - /** - * static method to look up THE NPSystem for this server - */ - static NPSystem getSystem(AS400ImplRemote aSystem) - { - NPSystem npSystem = null; - // look for this NPSystem in the static hash table using the system - // object as a hash key - // We used to hash by system name string(using getSystemName()) but - // that doesn't work quite right for 2 reasons: - // 1. The system name might be null (user gets to fill in when we - // connect for the first time - // 2. The user can create 2 AS400 objects to the same system name - // as a way to create more conversations to that system. - // So, we now use the base hashCode() for the AS400 system as the key... - // npSystem = (NPSystem)NPSystemTable.get(aSystem.getSystemName()); - npSystem = (NPSystem)NPSystemTable_.get(aSystem); - if (npSystem == null) - { - // first time we've used this system - create it - npSystem = new NPSystem(aSystem); - NPSystemTable_.put(aSystem, npSystem); - } - return npSystem; - } - - - /** - * Method to get an NPConversation (wrapper for AS400Server) for this system. - * If you use this method you must be sure to return the conversation when you - * are done with it by using returnConversation(). If you just want to make a - * simple request (1 datastream up and 1 for the reply) then use the makeRequest() - * method instead. - * - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If security violation occurs during connection. - * @exception ErrorCompletingRequestException If an error occurred on the server. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - **/ - synchronized NPConversation getConversation() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - - // note - this method needs to be syncrhonized to protect - // the 3 vectors of conversations. - - { - NPConversation conversation = null; - // The loop is here to check if the conversation is connected, - // if not we go back and get another one from our available or - // dead list. - do - { - if( availConversations_.isEmpty() ) - { - // there are no available conversations - see if there - // are any in the dead list that can be resurrected. - if( !deadConversations_.isEmpty() ) - { - conversation = (NPConversation)deadConversations_.firstElement(); - deadConversations_.removeElement(conversation); - } else { - // none in the dead list either -create a new one - AS400Server server; - //-------------------------------------------------------- - // no available conversations, create a new one - // If this is the first conversation we are getting we'll - // use the connect() method, if we are getting additional - // conversations on the same AS400 object we use the - // getNewConnection() method - //-------------------------------------------------------- - if (inuseConversations_.isEmpty()) - { - server = as400System_.getConnection(AS400.PRINT, false); - // server = as400System_.connect("as-netprt"); - } else { - server = as400System_.getConnection(AS400.PRINT, true); - // server = as400System_.getNewConnection("as-netprt"); - - // Only start the cleanup thread if more than - // one conversation has been started, -AND- - // the system object is configured to start - // threads. - - if( as400System_.isThreadUsed() ) - { - startCleanupThread(); - } - } - - conversation = new NPConversation(as400System_, server); - } - } else { - conversation = (NPConversation)availConversations_.firstElement(); - availConversations_.removeElement(conversation); - } - - if( !(conversation.getServer().isConnected()) ) - { - Trace.log(Trace.DIAGNOSTIC, "Conversation was not connected."); - } - - } - while( !(conversation.getServer().isConnected()) ); - - // add this conversation to the inuse vector. - inuseConversations_.addElement(conversation); - - return conversation; - } - - - /** - * method to return a NPConversation to the available list - **/ - synchronized void returnConversation(NPConversation conversation) - { - // remove conversation from inuse vector. - - // If the conversation is still connected, and the AS400 object - // allows starting threads, add the conversation to the inuse - // vector. Method cleanUpDeadConversations() will determine how - // long conversations are cached. - - // If the conversation is still connected, but the AS400 object - // does not allow starting threads, keep at least one conversation - // in the inuse or available vector. - - int index = inuseConversations_.indexOf(conversation); - if (index != -1) - { - // remove conversation from inuse vector. - inuseConversations_.removeElementAt(index); - - // if still connected - if( conversation.getServer().isConnected() ) - { - // does AS400 object allow starting threads? - if( as400System_.isThreadUsed() ) - { - // clean up thread is running, - // add conversation to available. - availConversations_.addElement(conversation); - } else { - // clean up thread can not be run, - // just keep one conversation available. - if( availConversations_.size() < 1 ) - { - availConversations_.addElement(conversation); - } else { - as400System_.disconnectServer(conversation.getServer()); - } - } - } - } - } - - - /** - * get a conversation, make the single request and return - * the conversation. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If security violation occurs during connection. - * @exception ErrorCompletingRequestException If an error occurred on the server. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - **/ - int makeRequest(NPDataStream request, NPDataStream reply) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - NPConversation conversation = getConversation(); - int rc; - try - { - rc = conversation.makeRequest(request, reply); - } - catch (RequestNotSupportedException e) { - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.AS400_ERROR); - } - finally - { - // if we succeed or not we must return the conversation always - returnConversation(conversation); - } - return rc; - } - - - // A2A New version of cleanUpDeadConversations (old version appears after) - /** - * private method called by background thread to remove any - * conversations that we haven't used for while (since the - * last time this function was called). - * at least one existing conversation (dead, available, or in use) is left - * @return true if there is more than 1 active conversations alive; - * false otherwise - **/ - private synchronized boolean cleanUpDeadConversations() - { - // temporarily leave a dead conversation around (if one exists)... - int numberOfConversationsToDestroy = deadConversations_.size() - 1; - - // determine the number of active conversations - int activeConversations = inuseConversations_.size() + availConversations_.size(); - - if (activeConversations > 0) { - // At least one conversation exists, so destroy ALL dead conversations - numberOfConversationsToDestroy++; - } - - // Cycle through the deadConversation_ vector, eliminating conversations - Enumeration e = deadConversations_.elements(); - for (int i = 0; i < (numberOfConversationsToDestroy); i++) { - NPConversation conv = (NPConversation)e.nextElement(); - if (conv != null) { - as400System_.disconnectServer(conv.getServer()); - } - } - - if (e.hasMoreElements()) { // we left one dead conversation around - availConversations_.addElement((NPConversation)e.nextElement()); - } - - // all available conversations become dead - deadConversations_ = availConversations_; - - // start a new vector for available conversations - availConversations_ = new Vector(); - - return (boolean) (activeConversations > 1); - } - - - /* A2D This version replaced 2/23/99 - /** - * private method called by background thread to remove any - * conversations that we haven't used for while (since the - * last time this function was called). - * @return true if there are more conversations alive - * false if all conversations are now gone - **/ - /* - private synchronized boolean cleanUpDeadConversations() - { - boolean fMoreConversations, fKillingConversations; - - // - // for all NPConversations in the deadConversations list - // drop the connection for each conversation (go through the - // AS400 object to do this) - // - for (Enumeration e = deadConversations_.elements(); e.hasMoreElements();) - { - NPConversation conv = (NPConversation)e.nextElement(); - if (conv != null) - { - as400System_.disconnectServer(conv.getServer()); - } - } - deadConversations_ = availConversations_; - availConversations_ = new Vector(); - fMoreConversations = !(deadConversations_.isEmpty()) || !(inuseConversations_.isEmpty()); - return fMoreConversations; - }*/ - - - /** - run() method for background thread - **/ - public void run() - { - try - { - boolean fMoreConversations; - do - { - java.lang.Thread.sleep(CONVERSATION_TIMEOUT); - fMoreConversations = cleanUpDeadConversations(); - } while (fMoreConversations); - - } - catch (InterruptedException e) - { - // someone interupted us, we'll just end here - } - finally - { - - } - - // return from the run() method to end the thread - } - - - /** - Starts the clean up thread (if not already started). There - is one and only one read daemon thread per instance of the - NPServer and it should be running while we have any AS400Servers - open (any conversations). - - @see NPServer#run - **/ - synchronized void startCleanupThread() - { - if (cleanupThread_ == null) - { - cleanupThread_ = new Thread(this); - cleanupThread_.setDaemon(true); - cleanupThread_.start(); - } - } - - - /** - Stops the cleanup thread (if it is running). - @see NPServer#run - @see NPServer#startReadDaemon - **/ - synchronized void stopCleanupThread() - { - if (cleanupThread_ != null) - { - cleanupThread_.stop(); - cleanupThread_ = null; - } - } - -} // NPSystem class - - diff --git a/cvsroot/src/com/ibm/as400/access/NativeException.java b/cvsroot/src/com/ibm/as400/access/NativeException.java deleted file mode 100644 index 446e0118a..000000000 --- a/cvsroot/src/com/ibm/as400/access/NativeException.java +++ /dev/null @@ -1,32 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NativeException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class NativeException extends Exception -{ - static final long serialVersionUID = 4L; - byte[] data = null; - int errno_ = 0; - - NativeException(byte[] data) - { - this.data = data; - } - - NativeException(int errno, byte[] data) - { - errno_ = errno; - this.data = data; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/NativeMethods.java b/cvsroot/src/com/ibm/as400/access/NativeMethods.java deleted file mode 100644 index ba7d88aa5..000000000 --- a/cvsroot/src/com/ibm/as400/access/NativeMethods.java +++ /dev/null @@ -1,118 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NativeMethods.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2005, 2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// The NativeMethods class is used to call the native methods for the IBM Toolbox for Java Native Classes. -public class NativeMethods -{ - static boolean paseLibLoaded = false; - static String nativeLibraryQyjspart = "/QSYS.LIB/QYJSPART.SRVPGM"; - static - { - // Check to see which version of native code to use //@pase1 - String osVersion = System.getProperty("os.version"); //"V5" or lower we do not try to load pase - if ((System.getProperty("java.vm.name").indexOf("Classic VM") < 0) - && (osVersion.indexOf("V5") == -1) ) //@pase1 - { //@pase1 - try{ //@pase1 - //we are in j9 jvm - if (System.getProperty("java.home").indexOf("64bit") > 0) //@pase1 - { //@pase1 - //load 64 bit version - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loading Native PASE methods for 64bit libs if available");//@pase1 - System.load("/QIBM/ProdData/OS400/jt400/lib/qyjspase64.so"); //@pase1 - paseLibLoaded = true; - - } else //@pase1 - { //@pase1 - //load 32 bit version - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loading Native PASE methods for 32bit libs if available");//@pase1 - System.load("/QIBM/ProdData/OS400/jt400/lib/qyjspase32.so"); - paseLibLoaded = true; - } //@pase1 - }catch(Throwable t) //@pase1 - { //@pase1 - //note that if pase version load of libs fail (ie do not exist), then then we just default to ile version below - if (Trace.traceOn_) Trace.log(Trace.ERROR, t); //@pase1 - } //@pase1 - - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loading Native non-PASE methods "); //@pase1 - - String alternateLibrary = System.getProperty("com.ibm.as400.access.native.library"); - if (alternateLibrary != null) { - nativeLibraryQyjspart = "/QSYS.LIB/"+alternateLibrary+".LIB/QYJSPART.SRVPGM"; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "QYJSPART as "+nativeLibraryQyjspart); - } - try{ - System.load(nativeLibraryQyjspart ); //if j9, then socket functions in this lib are overridden - } catch(Throwable e) - { - Trace.log(Trace.ERROR, "Error loading QYJSPART service program:", e); //may be that it is already loaded in multiple .war classloader - } - } - - // Assure that the native library is loaded. - static void loadNativeLibraryQyjspart() { - try{ - System.load(nativeLibraryQyjspart ); //if j9, then socket functions in this lib are overridden - } catch(Throwable e) - { - Trace.log(Trace.ERROR, "Error loading QYJSPART service program from "+nativeLibraryQyjspart+":", e); //may be that it is already loaded in multiple .war classloader - } - } - // Assure that the native library is loaded. - static void loadNativeLibraryQyjspartThrowsException() throws SecurityException, UnsatisfiedLinkError { - System.load(nativeLibraryQyjspart ); - } - - static void load() - { - } - - static boolean loadSCK() - { - try - { - System.load("/QSYS.LIB/QYJSPSCK.SRVPGM"); - return true; - } - catch (Throwable e) - { - Trace.log(Trace.ERROR, "Error loading QYJSPSCK service program:", e); - return false; - } - } - - // Note: The socketPaseXxx() methods deal with a 2-part descriptor. - static native int socketAvailable(int sd) throws NativeException; - static native int socketPaseAvailable(int sd, int sd2) throws NativeException; - - static native int socketCreate(int serverNumber) throws NativeException; - static native int[] socketPaseCreate(int serverNumber) throws NativeException; // returns 2 descriptors - - static native void socketClose(int sd) throws NativeException; - static native void socketPaseClose(int sd, int sd2) throws NativeException; - - static native int socketRead(int sd, byte b[], int off, int len) throws NativeException; - static native int socketPaseRead(int sd, int sd2, byte b[], int off, int len) throws NativeException; - - static native void socketWrite(int sd, byte b[], int off, int len) throws NativeException; - static native void socketPaseWrite(int sd, int sd2, byte b[], int off, int len) throws NativeException; - - static native byte[] getUserId() throws NativeException; - static native byte[] getUserInfo(byte[] cSeed, byte[] sSeed) throws NativeException; - static native byte[] runCommand(byte[] command, int ccsid, int messageOption) throws NativeException; - static native byte[] runProgram(byte[] name, byte[] library, int numberParameters, byte[] offsetArray, byte[] programParameters, int messageOption) throws NativeException; -} diff --git a/cvsroot/src/com/ibm/as400/access/NativeVersion.java b/cvsroot/src/com/ibm/as400/access/NativeVersion.java deleted file mode 100644 index 70f9aa5c4..000000000 --- a/cvsroot/src/com/ibm/as400/access/NativeVersion.java +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NativeVersion.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// The NativeVersion class is used to hold the version level for the IBM Toolbox for Java Native Classes. -class NativeVersion -{ - private static final int VERSION = 2; // Mod3 is version 1. - - // Hashcode returns the version of the native classes. - // @return The native version. - public int hashCode() - { - return VERSION; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/NetServer.java b/cvsroot/src/com/ibm/as400/access/NetServer.java deleted file mode 100644 index 7065b02e6..000000000 --- a/cvsroot/src/com/ibm/as400/access/NetServer.java +++ /dev/null @@ -1,1157 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NetServer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import com.ibm.as400.resource.*; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.beans.PropertyVetoException; -import java.util.Vector; - -/** - The NetServer class represents the NetServer service on a system. - This class allows the user to query and modify the state and configuration - of the NetServer. -

    - Note: Many of the attributes of NetServer are "pending". These attributes represent NetServer values that will take effect the next time the NetServer is (re)started. Wherever there is a pair of related attributes, where one is pending and one is non-pending, the "pending" attribute is read/write, while the non-pending attribute is read-only. -
    For example, to change the name of the NetServer, using a com.ibm.as400.access.NetServer object named "netServer": -

      -
    1. netServer.setAttributeValue(NetServer.NAME_PENDING, newName) -
    2. netServer.commitAttributeChanges() -
    3. netServer.end() -
    4. netServer.start() -
    -

    - If the NetServer job on the IBM i system is not started, the listXxx methods may return incomplete results. To determine if the NetServer job is started, use the {@link #isStarted() isStarted} method. To start the NetServer, use one of the {@link #start() start} methods. These methods will also attempt to start the QSERVER subsystem if it is not running. -

    - Note: Typically, methods which change the state or attributes of the NetServer require that the system user profile has *IOSYSCFG special authority. For example, starting or ending the NetServer requires *IOSYSCFG authority. -

    - Note: This class uses some API fields that are not available prior to OS/400 V5R1. -

    -The following attribute IDs are supported: -

    - -

    Use any of the above attribute IDs with -{@link com.ibm.as400.resource.ChangeableResource#getAttributeValue(java.lang.Object) getAttributeValue} -and -{@link com.ibm.as400.resource.ChangeableResource#setAttributeValue(java.lang.Object,java.lang.Object) setAttributeValue} to access the attribute values for a NetServer. -
    -Note: For the above attributes, getAttributeValue() should never return null. -For String-valued attributes, if the current actual value of the corresponding property on the system is blank, getAttributeValue() will return "" (an empty String). - -

    -
    -* import com.ibm.as400.access.*;
    -* import com.ibm.as400.resource.*;
    -*
    -* // Create a NetServer object for a specific system.
    -* AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -* NetServer ns = new NetServer(system);
    -*
    -* try
    -* {
    -*
    -*   // Get the name of the NetServer.
    -*   System.out.println("Name: " +
    -*               (String)ns.getAttributeValue(NetServer.NAME));
    -*
    -*   // Get the CCSID of the NetServer.
    -*   System.out.println("CCSID: " +
    -*    ((Integer)ns.getAttributeValue(NetServer.CCSID)).intValue());
    -*
    -*   // Get the pending CCSID of the NetServer.
    -*   System.out.println("Pending CCSID: " +
    -*    ((Integer)ns.getAttributeValue(NetServer.CCSID_PENDING)).intValue());
    -*
    -*   // Get the "allow system name" value of the NetServer.
    -*   System.out.println("'Allow system name': " +
    -*    ((Boolean)ns.getAttributeValue(NetServer.ALLOW_SYSTEM_NAME)).booleanValue());
    -*
    -*   // Set the (pending) description of the NetServer.
    -*   // Note: Changes to "pending" attributes take effect after the NetServer
    -*   // is ended and restarted.
    -*   ns.setAttributeValue(NetServer.DESCRIPTION_PENDING, "The NetServer");
    -*   ns.commitAttributeChanges();
    -*
    -*   // Set the (pending) CCSID of the NetServer to 13488.
    -*   ns.setAttributeValue(NetServer.CCSID_PENDING, new Integer(13488));
    -*
    -*   // Set the (pending) "allow system name" value of the NetServer to true.
    -*   ns.setAttributeValue(NetServer.ALLOW_SYSTEM_NAME_PENDING, new Boolean(true));
    -*
    -*   // Commit the attribute changes (send them to the system).
    -*   ns.commitAttributeChanges();
    -*
    -*   // Print all the attribute values of the NetServer object.
    -*   ResourceMetaData[] attributeMetaData = ns.getAttributeMetaData();
    -*   for(int i = 0; i<attributeMetaData.length; i++)
    -*   {
    -*     Object attributeID = attributeMetaData[i].getID();
    -*     Object value = resource.getAttributeValue(attributeID);
    -*     System.out.println("Attribute " + attributeID + " = " + value);
    -*   }
    -*
    -* }
    -* catch (ResourceException e) {
    -*   e.printStackTrace();
    -* }
    -* finally {
    -*   if (system != null) system.disconnectAllServices();
    -* }
    -
    -
    - -@deprecated This class has been replaced by - {@link com.ibm.as400.access.ISeriesNetServer ISeriesNetServer} - and may be removed in a future release. -@see NetServerShare -@see NetServerFileShare -@see NetServerPrintShare -@see NetServerConnection -@see NetServerSession -**/ - -public class NetServer -extends ChangeableResource -{ - static final long serialVersionUID = 4L; - - //------------------------------------------------------------------------- - // Presentation. - //------------------------------------------------------------------------- - - private static PresentationLoader presentationLoader_ = new PresentationLoader("com.ibm.as400.access.MRI2"); - private static final String ICON_BASE_NAME_ = "NetServer"; - private static final String PRESENTATION_KEY_ = "NETSERVER"; - - private static ResourceMetaDataTable attributes_ = new ResourceMetaDataTable(presentationLoader_, PRESENTATION_KEY_); - - // Attribute getter map and setter map. - private static ProgramMap getterMap_ = new ProgramMap(); - private static ProgramMap setterMap_ = new ProgramMap(); - - private static final String OLST0201_ = "qzlsolst_zlsl0201"; - - private static BooleanValueMap BV_MAP_0_1_ = new BooleanValueMap("0", "1"); - private static BooleanValueMap BV_MAP_0_1_INT_ = new BooleanValueMap(new Integer(0), new Integer(1)); - private static BooleanValueMap BV_MAP_NO_YES_ = new BooleanValueMap("*NO", "*YES"); - private static BooleanValueMap BV_MAP_NO_ERR_YES_ = new BooleanValueMap(new String[] {"*NO", "*ERR"}, new String[] { "*YES" }); - - private static IntegerValueMap INTV_MAP_ = new IntegerValueMap(); // @A1a - - //------------------------------------------------------------------------- - // Attribute IDs. - // - // * If you add an attribute here, make sure and add it to the class javadoc. - //------------------------------------------------------------------------- - - /** - Attribute ID for "allow system name". This identifies a read-only Boolean - attribute, which indicates whether to allow access to the system using the system's TCP/IP system name. - **/ - public static final String ALLOW_SYSTEM_NAME = "ALLOW_SYSTEM_NAME"; - static { - attributes_.add(ALLOW_SYSTEM_NAME, Boolean.class, true); - getterMap_.add (ALLOW_SYSTEM_NAME, OLST0201_, "receiverVariable.allowSystemName", BV_MAP_0_1_); - } - - /** - Attribute ID for "allow system name (pending)". This identifies a Boolean - attribute, which indicates whether to allow access to the system using the system's TCP/IP system name. - **/ - public static final String ALLOW_SYSTEM_NAME_PENDING = "ALLOW_SYSTEM_NAME_PENDING"; - static { - attributes_.add(ALLOW_SYSTEM_NAME_PENDING, Boolean.class); - getterMap_.add (ALLOW_SYSTEM_NAME_PENDING, OLST0201_, "receiverVariable.allowSystemNameP", BV_MAP_0_1_); - setterMap_.add (ALLOW_SYSTEM_NAME_PENDING, "qzlschsn", "allowSystemNameP", BV_MAP_0_1_); - } - - // @A1a - New attribute. - /** - Attribute ID for "authentication method". This identifies a read-only Integer - attribute, which indicates the authentication method used to authenticate users. - Note: This attribute is not supported prior to OS/400 release V5R2. - The value 0 indicates that the system authenticates with encrypted passwords. - The value 1 indicates the system authenticates with Kerberos v5 tokens. - - **/ - public static final String AUTHENTICATION_METHOD = "AUTHENTICATION_METHOD"; - static { - attributes_.add(AUTHENTICATION_METHOD, Integer.class, true); - getterMap_.add (AUTHENTICATION_METHOD, OLST0201_, "receiverVariable.authenticationMethod", INTV_MAP_); - } - - // @A1a - New attribute. - /** - Attribute ID for "authentication method (pending)". This identifies an Integer - attribute, which indicates the authentication method used to authenticate users. - Note: This attribute is not supported prior to OS/400 release V5R2. - The value 0 indicates that the system authenticates with encrypted passwords. - The value 1 indicates the system authenticates with Kerberos v5 tokens. - **/ - public static final String AUTHENTICATION_METHOD_PENDING = "AUTHENTICATION_METHOD_PENDING"; - static { - attributes_.add(AUTHENTICATION_METHOD_PENDING, Integer.class); - getterMap_.add (AUTHENTICATION_METHOD_PENDING, OLST0201_, "receiverVariable.authenticationMethodP", INTV_MAP_); - setterMap_.add (AUTHENTICATION_METHOD_PENDING, "qzlschsi", "requestVariable.authenticationMethodP", INTV_MAP_); - } - - /** - Attribute ID for "autostart". This identifies a Boolean - attribute, which indicates whether or not the NetServer is to be started automatically when TCP is started. -
    Note: Due to API restrictions, if the system user profile does not have *IOSYSCFG authority, the value of this attribute is reported as false, regardless of the actual setting on the system. - **/ - public static final String AUTOSTART = "AUTOSTART"; - static { - attributes_.add(AUTOSTART, Boolean.class); - getterMap_.add (AUTOSTART, "qtocauto_rtv", "autostart", BV_MAP_NO_ERR_YES_); - setterMap_.add (AUTOSTART, "qtocauto_chg", "autostart", BV_MAP_NO_YES_); - - // Format of the QTOCAUTO API: - // - // CALL PGM(QTOCAUTO) PARM('*RTV' *NETSVR variable X'00000000') - // - // parm 1 - CHAR(4) - - // *RTV - retrieves the NetServer autostart value in the - // variable which is parameter number 3. - // *CHG - changes the NetServer autostart value to the value - // in the variable which is parameter number 3. - // parm 2 - CHAR(30) - - // *NETSVR - indicates to retrieve or change the NetServer - // autostart value. - // parm 3 - CHAR(4) variable used to retrieve or change the NetServer autostart value. - // Allowed values *YES or *NO. - // parm 4 - The error code return variable. - - } - - /** - Attribute ID for "browsing interval". This identifies a read-only Integer attribute, which represents the amount of time, in milliseconds, between each system announcement that is used for browsing. - A value of zero indicates that there will be no system announcements. - **/ - public static final String BROWSING_INTERVAL = "BROWSING_INTERVAL"; - static { - attributes_.add(BROWSING_INTERVAL, Integer.class, true); - getterMap_.add (BROWSING_INTERVAL, OLST0201_, "receiverVariable.browsingInterval"); - } - - /** - Attribute ID for "browsing interval (pending)". This identifies an Integer attribute, which represents the amount of time, in milliseconds, between each system announcement that is used for browsing. - A value of zero indicates that there will be no system announcements. - **/ - public static final String BROWSING_INTERVAL_PENDING = "BROWSING_INTERVAL_PENDING"; - static { - attributes_.add(BROWSING_INTERVAL_PENDING, Integer.class); - getterMap_.add (BROWSING_INTERVAL_PENDING, OLST0201_, "receiverVariable.browsingIntervalP"); - setterMap_.add (BROWSING_INTERVAL_PENDING, "qzlschsi", "requestVariable.browsingIntervalP"); - } - - /** - Attribute ID for "server CCSID". This identifies a read-only Integer - attribute, which represents the coded character set identifier - for the NetServer. -

    This is the CCSID that is used for all - clients connected to the system. -
    - The default value for this field is the - associated ASCII CCSID for the CCSID of the job - used to start the system. -
    - Note: A value of 0 indicates that the user would - like to use the associated ASCII CCSID for the - CCSID of the job used to start the system. - **/ - public static final String CCSID = "CCSID"; - static { - attributes_.add(CCSID, Integer.class, true); - getterMap_.add (CCSID, OLST0201_, "receiverVariable.ccsid"); - } - - /** - Attribute ID for "server CCSID (pending)". This identifies an Integer - attribute, which represents the pending coded character set identifier - for the NetServer. - **/ - public static final String CCSID_PENDING = "CCSID_PENDING"; - static { - attributes_.add(CCSID_PENDING, Integer.class); - getterMap_.add (CCSID_PENDING, OLST0201_, "receiverVariable.ccsidP"); - setterMap_.add (CCSID_PENDING, "qzlschsi", "requestVariable.ccsidP"); - } - - /** - Attribute ID for "description". This identifies a read-only String - attribute, which represents the text description of the NetServer. - **/ - public static final String DESCRIPTION = "DESCRIPTION"; - static { - attributes_.add(DESCRIPTION, String.class, true); - getterMap_.add (DESCRIPTION, OLST0201_, "receiverVariable.description"); - } - - /** - Attribute ID for "description (pending)". This identifies a String - attribute, which represents the pending text description of the NetServer. - **/ - public static final String DESCRIPTION_PENDING = "DESCRIPTION_PENDING"; - static { - attributes_.add(DESCRIPTION_PENDING, String.class); - getterMap_.add (DESCRIPTION_PENDING, OLST0201_, "receiverVariable.descriptionP"); - setterMap_.add (DESCRIPTION_PENDING, "qzlschsn", "descriptionP"); - } - - /** - Attribute ID for "domain name". This identifies a read-only String - attribute, which represents the domain name of the NetServer. - **/ - public static final String DOMAIN = "DOMAIN"; - static { - attributes_.add(DOMAIN, String.class, true); - getterMap_.add (DOMAIN, OLST0201_, "receiverVariable.domainName"); - } - - /** - Attribute ID for "domain name (pending)". This identifies a String - attribute, which represents the pending domain name of the NetServer. - **/ - public static final String DOMAIN_PENDING = "DOMAIN_PENDING"; - static { - attributes_.add(DOMAIN_PENDING, String.class); - getterMap_.add (DOMAIN_PENDING, OLST0201_, "receiverVariable.domainNameP"); - setterMap_.add (DOMAIN_PENDING, "qzlschsn", "domainNameP"); - } - - // Note: The NetServer team says they don't use the Guest Support fields. - // Apparently these fields are used internally by the Host. There is currently no need for us to surface them. - /** - Attribute ID for "Guest support". This identifies a read-only Boolean - attribute, which indicates whether a guest user profile may be used in the event an unknown user attempts to access resources on the system. - **/ - /*public*/ static final String GUEST_SUPPORT = "GUEST_SUPPORT"; - static { - attributes_.add(GUEST_SUPPORT, Boolean.class, true); - getterMap_.add (GUEST_SUPPORT, OLST0201_, "receiverVariable.guestSupport", BV_MAP_0_1_INT_); - } - - // See above note. - /** - Attribute ID for "Guest support (pending)". This identifies a read-only Boolean - attribute, which indicates whether a guest user profile may be used in the event an unknown user attempts to access resources on the system. - **/ - /*public*/ static final String GUEST_SUPPORT_PENDING = "GUEST_SUPPORT_PENDING"; - static { - attributes_.add(GUEST_SUPPORT_PENDING, Boolean.class, true); // Note: No setter, so it's read-only for now. - getterMap_.add (GUEST_SUPPORT_PENDING, OLST0201_, "receiverVariable.guestSupportP", BV_MAP_0_1_INT_); - // Note: No setter, there is no API to set this attribute. - } - - /** - Attribute ID for "guest user profile". This identifies a read-only String - attribute, which represents the guest user profile for the NetServer. - If no guest user profile is currently configured on the system, the value of this attribute is "" (an empty String). -

    - Note: Guest support allows customers to have users accessing files and printers on the system, without the requirement of a user profile on the system. It limits access to data and allows customers to support a set of users who may only need print support but do not otherwise need system access. - **/ - public static final String GUEST_USER_PROFILE = "GUEST_USER_PROFILE"; - static { - attributes_.add(GUEST_USER_PROFILE, String.class, true); - getterMap_.add (GUEST_USER_PROFILE, OLST0201_, "receiverVariable.guestUserProfile"); - } - - /** - Attribute ID for "guest profile (pending)". This identifies a String - attribute, which represents the pending guest profile for the NetServer. - If no pending guest user profile is currently configured on the system, the value of this attribute is "" (an empty String). -
    Note: In order to change this attribute, the system user profile being used to access the NetServer must have *SECADM special authority. In addition, it requires *USE authority to the guest profile being set. - **/ - public static final String GUEST_USER_PROFILE_PENDING = "GUEST_USER_PROFILE_PENDING"; - static { - attributes_.add(GUEST_USER_PROFILE_PENDING, String.class); - getterMap_.add (GUEST_USER_PROFILE_PENDING, OLST0201_, "receiverVariable.guestUserProfileP"); - setterMap_.add (GUEST_USER_PROFILE_PENDING, "qzlschsg", "guestUserProfileP"); - } - - /** - Attribute ID for "idle timeout". This identifies a read-only Integer - attribute, which represents the amount of time, in seconds, that a connection to the NetServer will remain active once activity has ceased on that connection. - An idle time-out value of -1 indicates no autodisconnect. - **/ - public static final String IDLE_TIMEOUT = "IDLE_TIMEOUT"; - static { - attributes_.add(IDLE_TIMEOUT, Integer.class, true); - getterMap_.add (IDLE_TIMEOUT, OLST0201_, "receiverVariable.idleTimeOut"); - } - - /** - Attribute ID for "idle timeout (pending)". This identifies an Integer - attribute, which represents the amount of time, in seconds, that a connection to the NetServer will remain active once activity has ceased on that connection. - An idle time-out value of -1 indicates no autodisconnect. - **/ - public static final String IDLE_TIMEOUT_PENDING = "IDLE_TIMEOUT_PENDING"; - static { - attributes_.add(IDLE_TIMEOUT_PENDING, Integer.class); - getterMap_.add (IDLE_TIMEOUT_PENDING, OLST0201_, "receiverVariable.idleTimeOutP"); - setterMap_.add (IDLE_TIMEOUT_PENDING, "qzlschsi", "requestVariable.idleTimeOutP"); - } - - /** - Attribute ID for "logon support". This identifies a read-only Boolean - attribute, which indicates the logon server role for the system. - If true, then the server is a logon server; if false, the server is not a logon server. -
    Note: This attribute corresponds to the "server role" field specified - in the NetServer API's. - **/ - public static final String LOGON_SUPPORT = "LOGON_SUPPORT"; - static { - attributes_.add(LOGON_SUPPORT, Boolean.class, true); - getterMap_.add (LOGON_SUPPORT, OLST0201_, "receiverVariable.serverRole", BV_MAP_0_1_INT_); - } - - /** - Attribute ID for "logon support (pending)". This identifies a Boolean - attribute, which indicates the logon server role for the server. - If true, then the server is a logon server; if false, the server is not a logon server. - **/ - public static final String LOGON_SUPPORT_PENDING = "LOGON_SUPPORT_PENDING"; - static { - attributes_.add(LOGON_SUPPORT_PENDING, Boolean.class); - getterMap_.add (LOGON_SUPPORT_PENDING, OLST0201_, "receiverVariable.serverRoleP", BV_MAP_0_1_INT_); - setterMap_.add (LOGON_SUPPORT_PENDING, "qzlschsi", "requestVariable.serverRoleP", BV_MAP_0_1_INT_); - } - - /** - Attribute ID for "name". This identifies a read-only String - attribute, which represents the name of the NetServer. -
    Note: The NetServer name is uppercase on the system. - **/ - public static final String NAME = "NAME"; - static { - attributes_.add(NAME, String.class, true); - getterMap_.add (NAME, OLST0201_, "receiverVariable.serverName"); - } - - /** - Attribute ID for "name (pending)". This identifies a String - attribute, which represents the pending name of the NetServer. -
    Note: The pending NetServer name is uppercase on the system. - **/ - public static final String NAME_PENDING = "NAME_PENDING"; - static { - attributes_.add(NAME_PENDING, String.class); - getterMap_.add (NAME_PENDING, OLST0201_, "receiverVariable.serverNameP"); - setterMap_.add (NAME_PENDING, "qzlschsn", "serverNameP"); - } - - // Note: Hide this for now. The API spec says it is "currently not supported". - /** - Attribute ID for "opportunistic lock timeout". This identifies a read-only Integer attribute, which represents the amount of time, in seconds, that an opportunistic lock is enforced for a session or connection - **/ - /*public*/ static final String OPPORTUNISTIC_LOCK_TIMEOUT = "OPPORTUNISTIC_LOCK_TIMEOUT"; - static { - attributes_.add(OPPORTUNISTIC_LOCK_TIMEOUT, Integer.class, true); - getterMap_.add (OPPORTUNISTIC_LOCK_TIMEOUT, OLST0201_, "receiverVariable.oppLockTimeOut"); - } - - // Note: Hide this for now. The API spec says it is "currently not supported". - /** - Attribute ID for "opportunistic lock timeout (pending)". This identifies an Integer attribute, which represents the amount of time, in seconds, that an opportunistic lock is left enforced for a resource. - **/ - /*public*/ static final String OPPORTUNISTIC_LOCK_TIMEOUT_PENDING = "OPPORTUNISTIC_LOCK_TIMEOUT_PENDING"; - static { - attributes_.add(OPPORTUNISTIC_LOCK_TIMEOUT_PENDING, Integer.class); - getterMap_.add (OPPORTUNISTIC_LOCK_TIMEOUT_PENDING, OLST0201_, "receiverVariable.oppLockTimeOutP"); - setterMap_.add (OPPORTUNISTIC_LOCK_TIMEOUT_PENDING, "qzlschsi", "requestVariable.oppLockTimeOutP"); - } - - /** - Attribute ID for "WINS enablement". This identifies a read-only Boolean - attribute, which indicates whether the system uses a WINS server. - **/ - public static final String WINS_ENABLEMENT = "WINS_ENABLEMENT"; - static { - attributes_.add(WINS_ENABLEMENT, Boolean.class, true); - getterMap_.add (WINS_ENABLEMENT, OLST0201_, "receiverVariable.winsEnablement", BV_MAP_0_1_INT_); - } - - /** - Attribute ID for "WINS enabled (pending)". This identifies a Boolean - attribute, which indicates whether the system uses a WINS server. - **/ - public static final String WINS_ENABLEMENT_PENDING = "WINS_ENABLEMENT_PENDING"; - static { - attributes_.add(WINS_ENABLEMENT_PENDING, Boolean.class); - getterMap_.add (WINS_ENABLEMENT_PENDING, OLST0201_, "receiverVariable.winsEnablementP", BV_MAP_0_1_INT_); - setterMap_.add (WINS_ENABLEMENT_PENDING, "qzlschsi", "requestVariable.winsEnablementP", BV_MAP_0_1_); - } - - /** - Attribute ID for "WINS primary address". This identifies a read-only String - attribute, which represents the IP address of the primary WINS server. - **/ - public static final String WINS_PRIMARY_ADDRESS = "WINS_PRIMARY_ADDRESS"; - static { - attributes_.add(WINS_PRIMARY_ADDRESS, String.class, true); - getterMap_.add (WINS_PRIMARY_ADDRESS, OLST0201_, "receiverVariable.winsPrimaryAddress"); - } - - /** - Attribute ID for "WINS primary address (pending)". This identifies a String - attribute, which represents the pending IP address of the primary WINS server. - **/ - public static final String WINS_PRIMARY_ADDRESS_PENDING = "WINS_PRIMARY_ADDRESS_PENDING"; - static { - attributes_.add(WINS_PRIMARY_ADDRESS_PENDING, String.class); - getterMap_.add (WINS_PRIMARY_ADDRESS_PENDING, OLST0201_, "receiverVariable.winsPrimaryAddressP"); - setterMap_.add (WINS_PRIMARY_ADDRESS_PENDING, "qzlschsi", "requestVariable.winsPrimaryAddressP"); - } - - /** - Attribute ID for "WINS scope ID". This identifies a read-only String - attribute, which represents the network scope used by the WINS server. - If no scope ID is currently configured on the system, the value of this attribute is "" (an empty String). - **/ - public static final String WINS_SCOPE_ID = "WINS_SCOPE_ID"; - static { - attributes_.add(WINS_SCOPE_ID, String.class, true); - getterMap_.add (WINS_SCOPE_ID, OLST0201_, "receiverVariable.scopeId"); - } - - /** - Attribute ID for "WINS scope ID (pending)". This identifies a String - attribute, which represents the pending network scope used by the WINS server. - If no pending scope ID is currently configured on the system, the value of this attribute is "" (an empty String). - **/ - public static final String WINS_SCOPE_ID_PENDING = "WINS_SCOPE_ID_PENDING"; - static { - attributes_.add(WINS_SCOPE_ID_PENDING, String.class); - getterMap_.add (WINS_SCOPE_ID_PENDING, OLST0201_, "receiverVariable.scopeIdP"); - setterMap_.add (WINS_SCOPE_ID_PENDING, "qzlschsi", "requestVariable.scopeIdP"); - } - - /** - Attribute ID for "WINS secondary address". This identifies a read-only String - attribute, which represents the IP address of the secondary WINS server. - **/ - public static final String WINS_SECONDARY_ADDRESS = "WINS_SECONDARY_ADDRESS"; - static { - attributes_.add(WINS_SECONDARY_ADDRESS, String.class, true); - getterMap_.add (WINS_SECONDARY_ADDRESS, OLST0201_, "receiverVariable.winsSecondaryAddress"); - } - - /** - Attribute ID for "WINS secondary address (pending)". This identifies a String - attribute, which represents the pending IP address of the secondary WINS server. - **/ - public static final String WINS_SECONDARY_ADDRESS_PENDING = "WINS_SECONDARY_ADDRESS_PENDING"; - static { - attributes_.add(WINS_SECONDARY_ADDRESS_PENDING, String.class); - getterMap_.add (WINS_SECONDARY_ADDRESS_PENDING, OLST0201_, "receiverVariable.winsSecondaryAddressP"); - setterMap_.add (WINS_SECONDARY_ADDRESS_PENDING, "qzlschsi", "requestVariable.winsSecondaryAddressP"); - } - - - //---------------------------------------------------------------------- - // PCML document initialization. - //---------------------------------------------------------------------- - - private static final String DOCUMENT_NAME_ = "com.ibm.as400.access.NetServer"; - private static ProgramCallDocument staticDocument_ = null; - private ProgramCallDocument document_; - - static { - // Create a static version of the PCML document, then clone it for each document. - // This will improve performance, since we will only have to deserialize the PCML - // object once. - try { - staticDocument_ = new ProgramCallDocument(); - staticDocument_.setDocument(DOCUMENT_NAME_); - } - catch (PcmlException e) { - Trace.log(Trace.ERROR, "PcmlException when instantiating ProgramCallDocument.", e); - } - } - - - //---------------------------------------------------------------------- - // Private data. - //---------------------------------------------------------------------- - - private ProgramAttributeGetter attributeGetter_; - private ProgramAttributeSetter attributeSetter_; - - - - /** - Constructs a NetServer object. - The system must be set before the object is used. - **/ - public NetServer() - { - super(presentationLoader_.getPresentationWithIcon(PRESENTATION_KEY_, ICON_BASE_NAME_), null, attributes_); - - Presentation presentation = getPresentation(); - presentation.setName("NetServer"); - presentation.setFullName("NetServer"); - } - - /** - Constructs a NetServer object. - @param system The system with which the NetServer is associated. - **/ - public NetServer(AS400 system) - { - this(); - try { setSystem(system); } - catch (PropertyVetoException e) {} // This will never happen. - } - - - /** - Calls a program via a ProgramCallDocument. The program is expected to return a list of records. This method checks for overrun of the receiverVariable, and re-calls the program (specifying a larger receiverVariable) if an overrun is detected. - - @exception ResourceException If an error occurs. - **/ - static void callListProgram(ProgramCallDocument document, String programName, boolean recordsAreFixedLength) - throws ResourceException - { - try - { - if (document.callProgram(programName) == false) { - throw new ResourceException(document.getMessageList(programName)); - } - - // See if we overflowed the receiver variable; if so, re-issue the API. - String informationCompleteIndicator = (String)document.getValue(programName+".listInformation.informationCompleteIndicator"); - if (! informationCompleteIndicator.equals("C")) // C=complete, I=incomplete - { - if (Trace.isTraceOn()) { - Trace.log(Trace.DIAGNOSTIC, "Returned information incomplete on first API call."); - } - int totalRecords = document.getIntValue(programName+".listInformation.totalRecords"); - int recordsReturned = document.getIntValue(programName+".listInformation.recordsReturned"); - int recordLength = document.getIntValue(programName+".listInformation.recordLength"); - if (recordLength == 0) { - if (recordsAreFixedLength) { - Trace.log(Trace.ERROR, "System reported recordLength=0 for fixed-length format."); - } - recordLength = NetServerShare.ZLSL0100_MAX_RECORD_LENGTH_; // Make a generous guess. - } - document.setIntValue(programName+".lengthOfReceiverVariable", totalRecords*recordLength); - if (document.callProgram(programName) == false) { - throw new ResourceException(document.getMessageList(programName)); - } - - // Do one more check for overflowed receiver variable. - informationCompleteIndicator = (String)document.getValue(programName+".listInformation.informationCompleteIndicator"); - if (! informationCompleteIndicator.equals("C")) { // C=complete, I=incomplete - document.setIntValue(programName+".lengthOfReceiverVariable", (totalRecords+10)*recordLength); // Try allowing for 10 additional records. - if (document.callProgram(programName) == false) { - throw new ResourceException(document.getMessageList(programName)); - } - } - } - } - catch (PcmlException e) { - Trace.log(Trace.ERROR, "PcmlException when calling API.", e); - throw new ResourceException(e); - } - } - - - /** - Commits the specified attribute changes. - This method fires an attributeChangesCommitted() ResourceEvent. - - @exception ResourceException If an error occurs. - **/ - protected void commitAttributeChanges(Object[] attributeIDs, Object[] values) - throws ResourceException - { - super.commitAttributeChanges(attributeIDs, values); - - if (! isConnectionEstablished()) { - establishConnection(); - } - - attributeSetter_.setValues(attributeIDs, values); - } - - - /** - Computes the resource key. - - @param system The system. - **/ - static Object computeResourceKey(AS400 system) - { - StringBuffer buffer = new StringBuffer(); - buffer.append(NetServer.class); - buffer.append(':'); - buffer.append(system.getSystemName()); - return buffer.toString(); - } - - - /** - Ends the NetServer job on the IBM i system. -
    This method requires *IOSYSCFG special authority on the system. - - @exception ResourceException If an error occurs. - **/ - public void end() - throws ResourceException - { - if (! isConnectionEstablished()) { - establishConnection(); - } - - // Set the input parameters and call the API. - try { - ProgramCallDocument document = (ProgramCallDocument)staticDocument_.clone(); - document.setSystem(getSystem()); - - if (document.callProgram("qzlsends") == false) { - throw new ResourceException(document.getMessageList("qzlsends")); - } - - // Note: Here is where we would do a fireServerEnded(); - } - catch (PcmlException e) { - Trace.log(Trace.ERROR, "PcmlException when ending the NetServer.", e); - throw new ResourceException(e); - } - } - - - /** - Establishes the connection to the system. - -

    The method is called by the resource framework automatically - when the connection needs to be established. - - @exception ResourceException If an error occurs. - **/ - protected void establishConnection() - throws ResourceException - { - // Call the superclass. - super.establishConnection(); - - AS400 system = getSystem(); - String userId = system.getUserId(); - if (Trace.isTraceWarningOn()) verifyAuthority(system, userId); - - // Initialize the PCML document. - document_ = (ProgramCallDocument)staticDocument_.clone(); - document_.setSystem(system); - - // Initialize the attribute getter. - attributeGetter_ = new ProgramAttributeGetter(system, document_, getterMap_); - - // Initialize the attribute setter. - attributeSetter_ = new ProgramAttributeSetter(system, document_, setterMap_); - attributeSetter_.initializeAttributeValues(attributeGetter_); - } - - - - /** - Freezes any property changes. After this is called, property - changes should not be made. Properties are not the same thing - as attributes. Properties are basic pieces of information - which must be set to make the object usable, such as the system - and the name. - -

    The method is called by the resource framework automatically - when the properties need to be frozen. - - @exception ResourceException If an error occurs. - **/ - protected void freezeProperties() - throws ResourceException - { - // Verify that the system has been set. - if (getSystem() == null) { - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Note: We set the presentation in the constructors. - - // Update the resource key. - if (getResourceKey() == null) { - setResourceKey(computeResourceKey(getSystem())); - } - - // Call the superclass. - super.freezeProperties(); - } - - - // Returns the attribute metadata for the class. - static ResourceMetaData[] getAttributeMetaDataStatic() - { - return attributes_.getMetaData(); - } - - - /** - Returns the value of an attribute, disregarding any uncommitted - changes. - - @param attributeID Identifies the attribute. - @return The attribute value, or null if the attribute - value is not available. - - @exception ResourceException If an error occurs. - **/ - public Object getAttributeUnchangedValue(Object attributeID) - throws ResourceException - { - Object value = super.getAttributeUnchangedValue(attributeID); - - if (value == null) { - if (! isConnectionEstablished()) { // @A2M - establishConnection(); // @A2M - } - value = attributeGetter_.getValue(attributeID); - } - return value; - } - - - /** - Indicates whether or not the NetServer job on the IBM i system is started. - @return true if the NetServer job is started; false otherwise. - - @exception ResourceException If an error occurs. - **/ - public boolean isStarted() - throws ResourceException - { - if (! isConnectionEstablished()) - establishConnection(); - - RJobList jobList = new RJobList(getSystem()); - // Note: If the NetServer job has been successfully started, there will be at least one QZLSSERVER job in ACTIVE status. - // Set the selection so that only jobs with the name "QZLSSERVER", in ACTIVE status, are included in the list. - jobList.setSelectionValue(RJobList.JOB_NAME, "QZLSSERVER"); - jobList.setSelectionValue(RJobList.PRIMARY_JOB_STATUSES, new String[] { RJob.JOB_STATUS_ACTIVE } ); - jobList.open(); - jobList.waitForComplete(); - boolean foundActiveJob; - if (jobList.getListLength() > 0) foundActiveJob = true; - else foundActiveJob = false; - - // Close the list. - jobList.close(); - - return foundActiveJob; - } - - - /** - Indicates whether or not the QSERVER subsystem is started. - If QSERVER isn't running, we can't start the NetServer job. - @return true if the QSERVER subsystem is started; false otherwise. - - @exception ResourceException If an error occurs. - **/ - private boolean isQserverStarted() - throws ResourceException - { - if (! isConnectionEstablished()) - establishConnection(); - boolean foundActiveJob = false; - - RJobList jobList = new RJobList(getSystem()); - // Note: If the QSERVER subsystem is running, there will be at least one QSERVER job in ACTIVE status. - // Set the selection so that only jobs with the name "QSERVER", user QSYS, in ACTIVE status, are included in the list. - jobList.setSelectionValue(RJobList.JOB_NAME, "QSERVER"); - jobList.setSelectionValue(RJobList.USER_NAME, "QSYS"); - jobList.setSelectionValue(RJobList.PRIMARY_JOB_STATUSES, new String[] { RJob.JOB_STATUS_ACTIVE } ); - jobList.open(); - jobList.waitForComplete(); - if (jobList.getListLength() > 0) foundActiveJob = true; - else foundActiveJob = false; - - return foundActiveJob; - } - - /** - Lists all file server shares currently associated with the NetServer. - The returned ResourceList contains {@link NetServerFileShare NetServerFileShare} objects. - @return Information about all current file shares. - - @exception ResourceException If an error occurs. - **/ - public ResourceList listFileShares() - throws ResourceException - { - if (! isConnectionEstablished()) { - establishConnection(); - } - - return NetServerFileShare.list(getSystem()); - } - - /** - Lists file server shares currently associated with the NetServer. - The returned ResourceList contains {@link NetServerFileShare NetServerFileShare} objects. - @param shareName Name of shares to list. Can include wildcard ("*"). - @return Information about the specified file shares. - - @exception ResourceException If an error occurs. - **/ - public ResourceList listFileShares(String shareName) - throws ResourceException - { - if (! isConnectionEstablished()) { - establishConnection(); - } - - return NetServerFileShare.list(getSystem(), shareName); - } - - /** - Lists all print server shares currently associated with the NetServer. - The returned ResourceList contains {@link NetServerPrintShare NetServerPrintShare} objects. - @return Information about all current print shares. - - @exception ResourceException If an error occurs. - **/ - public ResourceList listPrintShares() - throws ResourceException - { - if (! isConnectionEstablished()) { - establishConnection(); - } - - return NetServerPrintShare.list(getSystem()); - } - - /** - Lists print server shares currently associated with the NetServer. - The returned ResourceList contains {@link NetServerPrintShare NetServerPrintShare} objects. - @param shareName Name of shares to list. Can include wildcard ("*"). - @return Information about the specified print shares. - - @exception ResourceException If an error occurs. - **/ - public ResourceList listPrintShares(String shareName) - throws ResourceException - { - if (! isConnectionEstablished()) { - establishConnection(); - } - - return NetServerPrintShare.list(getSystem(), shareName); - } - - /** - Lists all session connections currently associated with the NetServer. - The returned ResourceList contains {@link NetServerConnection NetServerConnection} objects. - @return Information about all current session connections. - - @exception ResourceException If an error occurs. - **/ - public ResourceList listSessionConnections() - throws ResourceException - { - if (! isConnectionEstablished()) { - establishConnection(); - } - - return NetServerConnection.list(getSystem(), NetServerConnection.SESSION); - } - - /** - Lists all sessions currently associated with the NetServer. - The returned ResourceList contains {@link NetServerSession NetServerSession} objects. - @return Information about all current sessions. - - @exception ResourceException If an error occurs. - **/ - public ResourceList listSessions() - throws ResourceException - { - if (! isConnectionEstablished()) { - establishConnection(); - } - - return NetServerSession.list(getSystem()); - } - - /** - Lists all share connections currently associated with the NetServer. - The returned ResourceList contains {@link NetServerConnection NetServerConnection} objects. - @return Information about all current share connections. - - @exception ResourceException If an error occurs. - **/ - public ResourceList listShareConnections() - throws ResourceException - { - if (! isConnectionEstablished()) { - establishConnection(); - } - - return NetServerConnection.list(getSystem(), NetServerConnection.SHARE); - } - - - /** - Refreshes the values for all attributes. This does not cancel - uncommitted changes. This method fires an attributeValuesRefreshed() - ResourceEvent. - - @exception ResourceException If an error occurs. - **/ - public void refreshAttributeValues() - throws ResourceException - { - if (! isConnectionEstablished()) { - establishConnection(); - } - - if (Trace.isTraceWarningOn()) verifyAuthority(getSystem(), getSystem().getUserId()); - - attributeGetter_.clearBuffer(); - attributeSetter_.initializeAttributeValues(attributeGetter_); - super.refreshAttributeValues(); - } - - - /** - Starts the NetServer job on the IBM i system. - If the NetServer is already started, this method does nothing. - This method requires *IOSYSCFG special authority on the system. - If the QSERVER subsystem is not running, this method will attempt to start it. -
    Note: This method does not reset the system. - - @exception ResourceException If an error occurs. - **/ - public void start() - throws ResourceException - { - start(false); - } - - /** - Starts the NetServer job on the IBM i system, and (optionally) resets it. - If the NetServer is already started, this method does nothing. - This method requires *IOSYSCFG special authority on the system. - If the QSERVER subsystem is not running, this method will attempt to start it. -

    Note: Reset is used when the NetServer fails to start normally on the system. It is on the NetServer context menu so an administrator can use it. The reset does some under-the-covers cleanup, and is used infrequently. The times it would be used is if the system ended abnormally and there may be jobs or objects hanging around that need to be cleaned up before the system can start again. The reset does that. - - @param reset Whether or not the system is to be reset when started. - - @exception ResourceException If an error occurs. - **/ - public void start(boolean reset) - throws ResourceException - { - if (! isConnectionEstablished()) { - establishConnection(); - } - if (isStarted()) return; - - // @A3a - // See if the QSERVER subsystem is running. If it's not running, start it. - if (!isQserverStarted()) { - // Attempt to start the QSERVER subsystem. - CommandCall cmd = new CommandCall(getSystem(), "STRSBS SBSD(QSERVER)"); - boolean started = false; - try { started = cmd.run(); } - catch (Exception e) { throw new ResourceException(e); } - if (!started) { - Trace.log(Trace.ERROR, "Error when starting QSERVER subsystem."); - throw new ResourceException(cmd.getMessageList()); - } - } - - - // Start the NetServer job (QZLSSERVER) on the IBM i system. - try { - ProgramCallDocument document = (ProgramCallDocument)staticDocument_.clone(); - document.setSystem(getSystem()); - document.setValue("qzlsstrs.resetQualifier", (reset ? "1" : "0")); - - if (document.callProgram("qzlsstrs") == false) { - throw new ResourceException(document.getMessageList("qzlsstrs")); - } - - // Note: Here is where we would do a fireServerStarted(); - } - catch (PcmlException e) { - Trace.log(Trace.ERROR, "PcmlException when starting the NetServer.", e); - throw new ResourceException(e); - } - } - - - /** - Verifies that the user has *IOSYSCFG authority, and logs a warning message if not. - This authority is required in order for the QTOCAUTO API to work. - - @exception ResourceException If an error occurs. - **/ - static void verifyAuthority(AS400 system, String userId) - throws ResourceException - { - RUser user = new RUser(system, userId); - String[] authorities = (String[])user.getAttributeValue(RUser.SPECIAL_AUTHORITIES); - boolean foundRequiredAuth = false; - for (int i=0; i - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/NetServer16.gif b/cvsroot/src/com/ibm/as400/access/NetServer16.gif deleted file mode 100644 index cd0fbfe78..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/NetServer16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/NetServer32.gif b/cvsroot/src/com/ibm/as400/access/NetServer32.gif deleted file mode 100644 index f6498c2f5..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/NetServer32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/NetServerBeanInfo.java b/cvsroot/src/com/ibm/as400/access/NetServerBeanInfo.java deleted file mode 100644 index 37d686bdd..000000000 --- a/cvsroot/src/com/ibm/as400/access/NetServerBeanInfo.java +++ /dev/null @@ -1,133 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NetServerBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import com.ibm.as400.resource.ResourceBeanInfo; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.util.ResourceBundle; - - - -/** -The NetServerBeanInfo class represents the bean information -for the NetServer class. - @deprecated This class may be removed in a future release. -**/ -public class NetServerBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Private data. - private static final Class beanClass_ = NetServer.class; - - private static BeanInfo[] additionalBeanInfo_; - private static BeanDescriptor beanDescriptor_; - private static Image icon16_; - private static Image icon32_; - private static ResourceBundle resourceBundle_; - - - - /** - Static initializer. - **/ - static - { - try - { - // Set up the resource bundle. - resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.access.MRI2"); - - // Set up the additional bean info. - additionalBeanInfo_ = new BeanInfo[] { new ResourceBeanInfo() }; - - // Set up the bean descriptor. - beanDescriptor_ = new BeanDescriptor(beanClass_); - - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error while loading bean info", e); - throw new Error(e.toString()); - } - } - - - - /** - Returns the additional bean information. - - @return The additional bean information. - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return additionalBeanInfo_; - } - - - /** - Returns the bean descriptor. - - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - - -/// TBD - No icons yet. Revisit this in the next release. -////** -///Returns the icon. -/// -///@param iconKind The icon kind. Possible values are: -///

      -///
    • BeanInfo.ICON_MONO_16x16 -///
    • BeanInfo.ICON_MONO_32x32 -///
    • BeanInfo.ICON_COLOR_16x16 -///
    • BeanInfo.ICON_COLOR_32x32 -///
    -///@return The icon. -///**/ -/// public Image getIcon(int icon) -/// { -/// switch(icon) -/// { -/// case BeanInfo.ICON_MONO_16x16: -/// case BeanInfo.ICON_COLOR_16x16: -/// if (icon16_ == null) -/// icon16_ = loadImage("NetServer16.gif"); -/// return icon16_; -/// -/// case BeanInfo.ICON_MONO_32x32: -/// case BeanInfo.ICON_COLOR_32x32: -/// if (icon32_ == null) -/// icon32_ = loadImage("NetServer32.gif"); -/// return icon32_; -/// -/// default: -/// throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); -/// } -/// } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/NetServerConnection.java b/cvsroot/src/com/ibm/as400/access/NetServerConnection.java deleted file mode 100644 index a85edc0c9..000000000 --- a/cvsroot/src/com/ibm/as400/access/NetServerConnection.java +++ /dev/null @@ -1,582 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NetServerConnection.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import com.ibm.as400.resource.*; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.beans.PropertyVetoException; -import java.util.Vector; - -/** - The NetServerConnection class represents a NetServer share connection. -

    - Note: A session (represented by class {@link NetServerSession NetServerSession}) corresponds to a workstation. A workstation could be a Windows Terminal Server or it could be a single PC on someone's desktop. A connection (represented by this class) corresponds to a specific user who has mapped a drive and has files opened or spooled output on a print queue. Since a session can have multiple users, a connection shows a particular user's statistics on that session. -

    - NetServerConnection objects are created and returned by the following methods: -

      -
    • {@link NetServer#listSessionConnections() NetServer.listSessionConnections} -
    • {@link NetServer#listShareConnections() NetServer.listShareConnections} -
    • {@link NetServerShare#listConnections() NetServerShare.listConnections} -
    • {@link NetServerSession#listConnections() NetServerSession.listConnections} -
    -

    -The following attribute IDs are supported: -

    - -

    Use any of the above attribute IDs with the -{@link com.ibm.as400.resource.ChangeableResource#getAttributeValue(java.lang.Object) getAttributeValue} -method to access the attribute values for a NetServerConnection. -
    -Note: For the above attributes, getAttributeValue() should never return null. -For String-valued attributes, if the current actual value of the corresponding property on the system is blank, getAttributeValue() will return "" (an empty String). - -

    -
    -* import com.ibm.as400.access.*;
    -* import com.ibm.as400.resource.*;
    -*
    -* // Create a NetServer object for a specific system.
    -* AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -* NetServer ns = new NetServer(system);
    -*
    -* try
    -* {
    -*
    -*   // List all current session connections.
    -*   System.out.println("Session connections:");
    -*   ResourceList connectionList = ns.listSessionConnections();
    -*   connectionList.waitForComplete();
    -*   for (int i=0; i<connectionList.getListLength(); i++)
    -*   {
    -*     NetServerConnection connection =
    -*       (NetServerConnection)connectionList.resourceAt(i);
    -*     System.out.println(connection.getID() + ": " +
    -*       (String)connection.getAttributeValue(NetServerConnection.NAME) + "; " +
    -*       (String)connection.getAttributeValue(NetServerConnection.USER) + "; " +
    -*       ((Integer)connection.getAttributeValue(NetServerConnection.CONNECT_TIME))
    -*                                                                 .intValue() );
    -*   }
    -* }
    -* catch (ResourceException e) {
    -*   e.printStackTrace();
    -* }
    -* finally {
    -*   if (system != null) system.disconnectAllServices();
    -* }
    -
    -
    - @deprecated This class has been replaced by the - {@link com.ibm.as400.access.ISeriesNetServerConnection ISeriesNetServerConnection} - class and may be removed in a future release. - @see NetServer#listSessionConnections() - @see NetServer#listShareConnections() - @see NetServerSession -**/ - -public class NetServerConnection -extends Resource -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - //------------------------------------------------------------------------- - // Presentation. - //------------------------------------------------------------------------- - - private static PresentationLoader presentationLoader_ = new PresentationLoader("com.ibm.as400.access.MRI2"); - private static final String ICON_BASE_NAME_ = "NetServerConnection"; - private static final String PRESENTATION_KEY_ = "NETSERVER"; - - private static ResourceMetaDataTable attributes_ = new ResourceMetaDataTable(presentationLoader_, PRESENTATION_KEY_); - - // Attribute getter map. - private static ProgramMap getterMap_ = new ProgramMap(); - private static ProgramMap openListAttributeMap_ = new ProgramMap(); - - - // Values for specifying "type of connection" when getting lists of connections. - static final int SHARE = 0; - static final int SESSION = 1; - - private static final String OLST0600_ = "qzlsolst_zlsl0600"; // session connection info - private static final String OLST0700_ = "qzlsolst_zlsl0700"; // share connection info - - private static final int[] INDICES_ = { 0 }; // For specifying first record in list. - - //------------------------------------------------------------------------- - // Attribute IDs. - // - // * If you add an attribute here, make sure and add it to the class javadoc. - //------------------------------------------------------------------------- - - /** - Attribute ID for "connect time". This identifies a read-only Integer - attribute, which represents the number of seconds that have elapsed since a connection was established. - **/ - public static final String CONNECT_TIME = "CONNECT_TIME"; - static { - attributes_.add(CONNECT_TIME, Integer.class, true); - getterMap_.add (CONNECT_TIME, OLST0600_, "receiverVariable.connectionTime", INDICES_); - getterMap_.add (CONNECT_TIME, OLST0700_, "receiverVariable.connectionTime", INDICES_); - openListAttributeMap_.add (CONNECT_TIME, null, "receiverVariable.connectionTime"); - } - - /** - Attribute ID for "number of files open". This identifies a read-only Integer - attribute, which represents the number of files that are currently open on a connection. - **/ - public static final String FILES_OPEN_COUNT = "FILES_OPEN_COUNT"; - static { - attributes_.add(FILES_OPEN_COUNT, Integer.class, true); - getterMap_.add (FILES_OPEN_COUNT, OLST0600_, "receiverVariable.numberOfFilesOpen", INDICES_); - getterMap_.add (FILES_OPEN_COUNT, OLST0700_, "receiverVariable.numberOfFilesOpen", INDICES_); - openListAttributeMap_.add (FILES_OPEN_COUNT, null, "receiverVariable.numberOfFilesOpen"); - } - - /** - Attribute ID for "connection name". This identifies a read-only String - attribute, which represents the name of the share or workstation that is associated with a connection. - **/ - public static final String NAME = "NAME"; - static { - attributes_.add(NAME, String.class, true); - getterMap_.add (NAME, OLST0600_, "receiverVariable.resourceName", INDICES_); - getterMap_.add (NAME, OLST0700_, "receiverVariable.resourceName", INDICES_); - openListAttributeMap_.add (NAME, null, "receiverVariable.resourceName"); - } - - /** - Attribute ID for "connection type". This identifies a read-only Integer - attribute, which represents the type of a connection. - Valid values are: -
      -
    • {@link #TYPE_DISK_DRIVE TYPE_DISK_DRIVE} - Disk drive. -
    • {@link #TYPE_SPOOLED_OUTPUT_QUEUE TYPE_SPOOLED_OUTPUT_QUEUE} - Spooled output queue. -
    - **/ - public static final String TYPE = "TYPE"; - /** - {@link #TYPE TYPE} attribute value indicating a connection type of "disk drive". - **/ - public static final Integer TYPE_DISK_DRIVE = new Integer(0); - /** - {@link #TYPE TYPE} attribute value indicating a connection type of "spooled output queue". - **/ - public static final Integer TYPE_SPOOLED_OUTPUT_QUEUE = new Integer(1); - static { - attributes_.add(TYPE, Integer.class, true, - new Object[] {TYPE_DISK_DRIVE, TYPE_SPOOLED_OUTPUT_QUEUE }, null, true); - getterMap_.add (TYPE, OLST0600_, "receiverVariable.connectionType", INDICES_); - getterMap_.add (TYPE, OLST0700_, "receiverVariable.connectionType", INDICES_); - openListAttributeMap_.add (TYPE, null, "receiverVariable.connectionType"); - } - - /** - Attribute ID for "user name". This identifies a read-only String - attribute, which represents the name of the user that opened the connection. - **/ - public static final String USER = "USER"; - static { - attributes_.add(USER, String.class, true); - getterMap_.add (USER, OLST0600_, "receiverVariable.userName", INDICES_); - getterMap_.add (USER, OLST0700_, "receiverVariable.userName", INDICES_); - openListAttributeMap_.add (USER, null, "receiverVariable.userName"); - } - - //@A1M - /** - Attribute ID for "number of connection users". This identifies a read-only Integer - attribute, which represents the number of users on a connection. -
    Note: If the NetServer has not been started, this attribute's reported value will be -1. - See {@link NetServer#isStarted() NetServer.isStarted()} and {@link NetServer#start() NetServer.start()}. - **/ - /*public*/ static final String USER_COUNT = "USER_COUNT"; - static { - attributes_.add(USER_COUNT, Integer.class, true); - getterMap_.add (USER_COUNT, OLST0600_, "receiverVariable.numberOfConnectionUsers", INDICES_); - getterMap_.add (USER_COUNT, OLST0700_, "receiverVariable.numberOfConnectionUsers", INDICES_); - openListAttributeMap_.add (USER_COUNT, null, "receiverVariable.numberOfConnectionUsers"); - } - - - - //---------------------------------------------------------------------- - // PCML document initialization. - //---------------------------------------------------------------------- - - private static final String DOCUMENT_NAME_ = "com.ibm.as400.access.NetServer"; - private static ProgramCallDocument staticDocument_ = null; - private ProgramCallDocument document_; - - static { - // Create a static version of the PCML document, then clone it for each document. - // This will improve performance, since we will only have to deserialize the PCML - // object once. - try { - staticDocument_ = new ProgramCallDocument(); - staticDocument_.setDocument(DOCUMENT_NAME_); - } - catch (PcmlException e) { - Trace.log(Trace.ERROR, "PcmlException when instantiating ProgramCallDocument.", e); - } - } - - - //---------------------------------------------------------------------- - // Private data. - //---------------------------------------------------------------------- - - private int id_; // Connection ID - private boolean idWasSet_ = false; // indicates whether id_ has been set. - - private ProgramAttributeGetter attributeGetter_; - - - - - // Note: This method is reserved for use by the NetServer class. - NetServerConnection() - { - super(presentationLoader_.getPresentationWithIcon(PRESENTATION_KEY_, ICON_BASE_NAME_), null, attributes_); - } - - - // Note: This method is reserved for use by the NetServer class. - NetServerConnection(AS400 system, int id) - { - this(); - try { setSystem(system); } catch (PropertyVetoException e) {} - setID(id); - } - - - /** - Computes the resource key. - - @param system The system. - **/ - static Object computeResourceKey(AS400 system, int id) - { - StringBuffer buffer = new StringBuffer(); - buffer.append(NetServerConnection.class); - buffer.append(':'); - buffer.append(system.getSystemName()); - buffer.append(':'); - buffer.append(id); - return buffer.toString(); - } - - - /** - Establishes the connection (of this object) to the system. - -

    The method is called by the resource framework automatically - when the object connection needs to be established. - - @exception ResourceException If an error occurs. - **/ - protected void establishConnection() - throws ResourceException - { - // Internal check: Verify that the ID has been set. - if (! idWasSet_) { - throw new ExtendedIllegalStateException("id", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Call the superclass. - super.establishConnection(); - - // Initialize the PCML document. - AS400 system = getSystem(); - document_ = (ProgramCallDocument)staticDocument_.clone(); - try { - document_.setSystem(system); - String connectionName = (String)getAttributeValue(NAME); - document_.setValue(OLST0600_+".informationQualifier", connectionName); - document_.setValue(OLST0700_+".informationQualifier", connectionName); - - // Initialize the attribute getter. - attributeGetter_ = new ProgramAttributeGetter(system, document_, getterMap_); - } - catch (PcmlException e) { - Trace.log(Trace.ERROR, "PcmlException when establishing connection.", e); - throw new ResourceException(e); - } - } - - - /** - Freezes any property changes. After this is called, property - changes should not be made. Properties are not the same thing - as attributes. Properties are basic pieces of information - which must be set to make the object usable, such as the system - and the name. - -

    The method is called by the resource framework automatically - when the properties need to be frozen. - - @exception ResourceException If an error occurs. - **/ - protected void freezeProperties() - throws ResourceException - { - // Internal check: Verify that the ID has been set. - if (! idWasSet_) { - throw new ExtendedIllegalStateException("id", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Update the presentation. - Presentation presentation = getPresentation(); - presentation.setName(Integer.toString(id_)); - presentation.setFullName(Integer.toString(id_)); - - // Update the resource key. - if (getResourceKey() == null) { - setResourceKey(computeResourceKey(getSystem(), id_)); - } - - // Call the superclass. - super.freezeProperties(); - } - - - // Returns the attribute metadata for the class. - static ResourceMetaData[] getAttributeMetaDataStatic() - { - return attributes_.getMetaData(); - } - - - /** - Returns the current value of an attribute. - - @param attributeID Identifies the attribute. - @return The attribute value, or null if the attribute - value is not available. - - @exception ResourceException If an error occurs. - **/ - public Object getAttributeValue(Object attributeID) - throws ResourceException - { - if (! isConnectionEstablished()) { - establishConnection(); - } - - Object value = super.getAttributeValue(attributeID); - - if (value == null) { - value = attributeGetter_.getValue(attributeID); - } - return value; - } - - - /** - Returns the connection ID for connection. - @return The connection ID. - **/ - public int getID() - { - return id_; - } - - - /** - Lists connections currently associated with the NetServer. - The returned ResourceList contains {@link NetServerConnection NetServerConnection} objects. - @param sys The system. - @param type Type of connections to list: SHARE or SESSION. - @return Information about current connections. - - @exception ResourceException If an error occurs. - **/ - static ResourceList list(AS400 sys, int type) - throws ResourceException - { - if (type != SHARE && type != SESSION) { - Trace.log(Trace.ERROR, "Invalid type of connection: " + type); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - // First get the list of the specified type of resource, and then for each resource get its list of connections. - ResourceList resources; - if (type == SHARE) resources = NetServerFileShare.list(sys); - else resources = NetServerSession.list(sys); - - resources.waitForComplete(); - Vector connList = new Vector(); - for (int i=0; i - Note: This class uses some API fields that are not available prior to OS/400 V5R1. -

    - Note: The methods that add or change NetServer File Shares are not supported prior to OS/400 V5R1. -

    -The following attribute IDs are supported: -

    - -

    Use any of the above attribute IDs with -{@link com.ibm.as400.resource.ChangeableResource#getAttributeValue(java.lang.Object) getAttributeValue} -and -{@link com.ibm.as400.resource.ChangeableResource#setAttributeValue(java.lang.Object,java.lang.Object) setAttributeValue} to access the attribute values for a NetServerFileShare. -
    -Note: For the above attributes, getAttributeValue() should never return null. -For String-valued attributes, if the current actual value of the corresponding property on the system is blank, getAttributeValue() will return "" (an empty String). - -

    Note: Typically, methods which add, change, or remove a NetServerFileShare require that the system user profile has *IOSYSCFG special authority, or that the user own the integrated file system directory. - -

    -
    -* import com.ibm.as400.access.*;
    -* import com.ibm.as400.resource.*;
    -*
    -* // Create a NetServer object for a specific system.
    -* AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -* NetServer ns = new NetServer(system);
    -*
    -* try
    -* {
    -*   // List all current file shares.
    -*   System.out.println("File shares:");
    -*   ResourceList shareList = ns.listFileShares();
    -*   shareList.waitForComplete();
    -*   for (int i=0; i<shareList.getListLength(); i++)
    -*   {
    -*     NetServerFileShare share = (NetServerFileShare)shareList.resourceAt(i);
    -*     System.out.println(share.getName() + ": " +
    -*       (String)share.getAttributeValue(NetServerFileShare.PATH) + ": " +
    -*       (String)share.getAttributeValue(NetServerFileShare.DESCRIPTION) + "; " +
    -*       ((Integer)share.getAttributeValue(NetServerFileShare.USER_COUNT))
    -*                                                             .intValue() );
    -*   }
    -* }
    -* catch (ResourceException e) {
    -*   e.printStackTrace();
    -* }
    -* finally {
    -*   if (system != null) system.disconnectAllServices();
    -* }
    -
    -
    - - @deprecated This class has been replaced by the - {@link com.ibm.as400.access.ISeriesNetServerFileShare ISeriesNetServerFileShare} - class and may be removed in a future release. -**/ - -public class NetServerFileShare -extends NetServerShare -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - - // Attribute setter map. - private static ProgramMap setterMap_ = new ProgramMap(); - private static ProgramMap openListAttributeMap_ = new ProgramMap(); - - // API names. - private static final String ADFS_ = "qzlsadfs"; - private static final String CHFS_ = "qzlschfs"; - - //------------------------------------------------------------------------- - // Attribute IDs. - // - // * If you add an attribute here, make sure and add it to the class javadoc. - //------------------------------------------------------------------------- - - // Common attributes for all NetServerShare subclasses: DESCRIPTION, USER_COUNT. - // Note: The subclasses have distinct setter maps for these attributes. - - // Add a setter map entry for the DESCRIPTION attribute (defined in the superclass). - static { - // First ensure that the superclass has been loaded, since we are referencing its static data here. - try { Class.forName("com.ibm.as400.access.NetServerShare"); } - catch (ClassNotFoundException e) {} // This will never happen. - setterMap_.add (NetServerShare.DESCRIPTION, CHFS_, "description"); - openListAttributeMap_.add (DESCRIPTION, OLST0100_, "receiverVariable.description"); - } - - // Add an open list map entry for the USER_COUNT attribute (defined in the superclass). - static { - openListAttributeMap_.add (USER_COUNT, OLST0100_, "receiverVariable.currentUsers"); - } - - - // Unique attributes for class NetServerFileShare: - - /** - Attribute ID for "maximum users". This identifies an Integer attribute, which represents the maximum number of users who can concurrently access this share. - The value must be greater than or equal to zero, or -1, - which means there is no limit to the number of users who can concurrently use this share. -
    The default is -1. - **/ - public static final String MAXIMUM_USERS = "MAXIMUM_USERS"; - static { - attributes_.add(MAXIMUM_USERS, Integer.class, new Integer(-1)); - getterMap_.add (MAXIMUM_USERS, OLST0100_, "receiverVariable.maximumUsers", INDICES_); - setterMap_.add (MAXIMUM_USERS, CHFS_, "maximumUsers"); - openListAttributeMap_.add (MAXIMUM_USERS, OLST0100_, "receiverVariable.maximumUsers"); - } - - /** - Attribute ID for "path". This identifies a String - attribute, which represents the path of a share. -
    The path name is the path in the integrated file system to be shared with the network. A forward slash, '/', is required as the first character. The maximum length is 512 characters. - **/ - public static final String PATH = "PATH"; - static { - attributes_.add(PATH, String.class); - getterMap_.add (PATH, OLST0100_, "receiverVariable.pathName", INDICES_); - setterMap_.add (PATH, CHFS_, "pathName"); - openListAttributeMap_.add (PATH, OLST0100_, "receiverVariable.pathName"); - } - - // Note: This is a package-scoped "attribute". - static final String PATH_LENGTH = "PATH_LENGTH"; - static { - attributes_.add(PATH_LENGTH, Integer.class); - getterMap_.add (PATH_LENGTH, OLST0100_, "receiverVariable.lengthOfPathName", INDICES_); - setterMap_.add (PATH_LENGTH, CHFS_, "lengthOfPathName"); - openListAttributeMap_.add (PATH_LENGTH, OLST0100_, "receiverVariable.lengthOfPathName"); - } - - /** - Attribute ID for "permission". This identifies an Integer - attribute, which represents the permission for a share. - Valid values are: -
      -
    • {@link #PERMISSION_READ_ONLY PERMISSION_READ_ONLY} - Read-only permission. -
    • {@link #PERMISSION_READ_WRITE PERMISSION_READ_WRITE} - Read/write permission. -
    - The default is PERMISSION_READ_WRITE. - **/ - public static final String PERMISSION = "PERMISSION"; - /** - {@link #PERMISSION PERMISSION} attribute value indicating "read only" permission to a share. - **/ - public static final Integer PERMISSION_READ_ONLY = new Integer(1); - /** - {@link #PERMISSION PERMISSION} attribute value indicating "read/write" permission to a share. - **/ - public static final Integer PERMISSION_READ_WRITE = new Integer(2); - static { - attributes_.add(PERMISSION, Integer.class, false, - new Object[] {PERMISSION_READ_ONLY, PERMISSION_READ_WRITE }, PERMISSION_READ_WRITE, true); - getterMap_.add (PERMISSION, OLST0100_, "receiverVariable.permissions", INDICES_); - setterMap_.add (PERMISSION, CHFS_, "permissions"); - openListAttributeMap_.add (PERMISSION, OLST0100_, "receiverVariable.permissions"); - } - - - /** - Constructs a NetServerFileShare object. - The system and share name must be set before the object is used. - **/ - public NetServerFileShare() - { - super(); - } - - - /** - Constructs a NetServerFileShare object. - @param name The name of the share. - **/ - public NetServerFileShare(AS400 system, String name) - { - super(system, name); - } - - - /** - Adds the file server share to the NetServer. - This method fires a resourceCreated() ResourceEvent. -
    The system and share name be set before this method is called. -
    The {@link #PATH PATH} attribute must be set before this method is called. -
    {@link com.ibm.as400.resource.ChangeableResource#commitAttributeChanges() commitAttributeChanges} must not be called prior to this method. -
    This method requires *IOSYSCFG special authority on the system, or that the user own the integrated file system directory. -
    Note: This method is not supported prior to OS/400 V5R1. - - - @exception ResourceException If an error occurs. - **/ - public void add() - throws ResourceException - { - // Set the input parameters and call the API. - try - { - freezeProperties(); - - if (document_ == null) { - document_ = (ProgramCallDocument)staticDocument_.clone(); - } - document_.setSystem(getSystem()); - - document_.setValue(ADFS_+".shareName", getName()); - document_.setValue(CHFS_+".shareName", getName()); - - if (hasUncommittedAttributeChanges(DESCRIPTION)) { // @A1a - document_.setValue(ADFS_+".description", (String)getAttributeValue(DESCRIPTION)); - document_.setValue(CHFS_+".description", (String)getAttributeValue(DESCRIPTION)); - } - - if (hasUncommittedAttributeChanges(PATH)) { // @A1a - String path = (String)getAttributeValue(PATH); - // Note: There are 2 bytes per Unicode character. By default the PCML document specifies Unicode for the pathname CCSID. - Integer pathLength = new Integer(path.length()*2); - document_.setValue(ADFS_+".lengthOfPathName", pathLength); - document_.setValue(ADFS_+".pathName", path); - document_.setValue(CHFS_+".lengthOfPathName", pathLength); - document_.setValue(CHFS_+".pathName", path); - } - else { - throw new ExtendedIllegalStateException("path", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - if (hasUncommittedAttributeChanges(PERMISSION)) { // @A1a - document_.setValue(ADFS_+".permissions", (Integer)getAttributeValue(PERMISSION)); - document_.setValue(CHFS_+".permissions", (Integer)getAttributeValue(PERMISSION)); - } - if (hasUncommittedAttributeChanges(MAXIMUM_USERS)) { // @A1a - document_.setValue(ADFS_+".maximumUsers", (Integer)getAttributeValue(MAXIMUM_USERS)); - document_.setValue(CHFS_+".maximumUsers", (Integer)getAttributeValue(MAXIMUM_USERS)); - } - - if (! isConnectionEstablished()) { - establishConnection(false); - } - - if (document_.callProgram(ADFS_) == false) { - throw new ResourceException(document_.getMessageList(ADFS_)); - } - - fireResourceCreated(); - } - catch (PcmlException e) { - Trace.log(Trace.ERROR, "PcmlException when adding a file share.", e); - throw new ResourceException(e); - } - } - - - /** - Commits the specified attribute changes. - This method fires an attributeChangesCommitted() ResourceEvent. -
    This method requires *IOSYSCFG special authority on the system. - - @exception ResourceException If an error occurs. - **/ - protected void commitAttributeChanges(Object[] attributeIDs, Object[] values) - throws ResourceException - { - // See if we are changing PATH. If so, also change PATH_LENGTH accordingly. - for (int i=0; iThe method is called by the resource framework automatically - when the connection needs to be established. - - @exception ResourceException If an error occurs. - **/ - protected void establishConnection() - throws ResourceException - { - establishConnection(true); - } - - - /** - Establishes the connection to the system. - - @param initializeSetterFromSystem Indicates whether or not the setter's values should be initialized from the system. For example, this would be the case when establishing a connection to an existing share, rather than adding a new share. - - @exception ResourceException If an error occurs. - **/ - /*protected*/ void establishConnection(boolean initializeSetterFromSystem) - throws ResourceException - { - Object[] attrsToSetFirst = new Object[] { PATH_LENGTH }; - super.establishConnection(setterMap_, attrsToSetFirst, initializeSetterFromSystem); - } - - - // Returns a list of NetServerFileShare objects. - static ResourceList list(AS400 sys) - throws ResourceException - { - return list(sys, "*ALL"); - } - - - // Returns a list of NetServerFileShare objects. - static ResourceList list(AS400 sys, String shareName) - throws ResourceException - { - return NetServerShare.list(sys, NetServerShare.FILE_SHARE, shareName, openListAttributeMap_); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/NetServerFileShare16.gif b/cvsroot/src/com/ibm/as400/access/NetServerFileShare16.gif deleted file mode 100644 index 216938328..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/NetServerFileShare16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/NetServerFileShare32.gif b/cvsroot/src/com/ibm/as400/access/NetServerFileShare32.gif deleted file mode 100644 index 0ed1769ee..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/NetServerFileShare32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/NetServerFileShareBeanInfo.java b/cvsroot/src/com/ibm/as400/access/NetServerFileShareBeanInfo.java deleted file mode 100644 index 88bfcbf8c..000000000 --- a/cvsroot/src/com/ibm/as400/access/NetServerFileShareBeanInfo.java +++ /dev/null @@ -1,166 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NetServerFileShareBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import com.ibm.as400.resource.ResourceBeanInfo; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.util.ResourceBundle; - - - -/** -The NetServerFileShareBeanInfo class represents the bean information -for the NetServerFileShare class. - @deprecated This class may be removed in a future release. -**/ -public class NetServerFileShareBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Private data. - private static final Class beanClass_ = NetServerFileShare.class; - - private static BeanInfo[] additionalBeanInfo_; - private static BeanDescriptor beanDescriptor_; - private static Image icon16_; - private static Image icon32_; - private static PropertyDescriptor[] propertyDescriptors_; - private static ResourceBundle resourceBundle_; - - - - /** - Static initializer. - **/ - static - { - try - { - // Set up the resource bundle. - resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.access.MRI2"); - - // Set up the additional bean info. - additionalBeanInfo_ = new BeanInfo[] { new ResourceBeanInfo() }; - - // Set up the bean descriptor. - beanDescriptor_ = new BeanDescriptor(beanClass_); - - // Set up the property descriptors. - PropertyDescriptor name = new PropertyDescriptor("name", beanClass_); - name.setBound(true); - name.setConstrained(false); // we do not allow veto's - name.setDisplayName(resourceBundle_.getString("PROP_NAME_NAME")); - name.setShortDescription(resourceBundle_.getString("PROP_DESC_NAME")); - - propertyDescriptors_ = new PropertyDescriptor[] { name }; - - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error while loading bean info", e); - throw new Error(e.toString()); - } - } - - - - /** - Returns the additional bean information. - - @return The additional bean information. - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return additionalBeanInfo_; - } - - - /** - Returns the bean descriptor. - - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - - - /** - Returns the property descriptors. - - @return The property descriptors. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors_; - } - - - -/// TBD - No icons yet. Revisit this in the next release. -////** -///Returns the icon. -/// -///@param iconKind The icon kind. Possible values are: -///
      -///
    • BeanInfo.ICON_MONO_16x16 -///
    • BeanInfo.ICON_MONO_32x32 -///
    • BeanInfo.ICON_COLOR_16x16 -///
    • BeanInfo.ICON_COLOR_32x32 -///
    -///@return The icon. -///**/ -/// public Image getIcon(int icon) -/// { -/// switch(icon) -/// { -/// case BeanInfo.ICON_MONO_16x16: -/// case BeanInfo.ICON_COLOR_16x16: -/// if (icon16_ == null) -/// icon16_ = loadImage("NetServerFileShare16.gif"); -/// return icon16_; -/// -/// case BeanInfo.ICON_MONO_32x32: -/// case BeanInfo.ICON_COLOR_32x32: -/// if (icon32_ == null) -/// icon32_ = loadImage("NetServerFileShare32.gif"); -/// return icon32_; -/// -/// default: -/// throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); -/// } -/// } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/NetServerPrintShare.java b/cvsroot/src/com/ibm/as400/access/NetServerPrintShare.java deleted file mode 100644 index 3ad7819f7..000000000 --- a/cvsroot/src/com/ibm/as400/access/NetServerPrintShare.java +++ /dev/null @@ -1,353 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NetServerPrintShare.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import com.ibm.as400.resource.*; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; - -/** - The NetServerPrintShare class represents a NetServer print server share. - NetServerPrintShare objects are created and returned by {@link NetServer#listPrintShares() NetServer.listPrintShares()}. -

    - Note: This class uses some API fields that are not available prior to OS/400 V5R1. -

    -The following attribute IDs are supported: -

    - -

    Use any of the above attribute IDs with -{@link com.ibm.as400.resource.ChangeableResource#getAttributeValue(java.lang.Object) getAttributeValue} -and -{@link com.ibm.as400.resource.ChangeableResource#setAttributeValue(java.lang.Object,java.lang.Object) setAttributeValue} to access the attribute values for a NetServerPrintShare. -
    -Note: For the above attributes, getAttributeValue() should never return null. -For String-valued attributes, if the current actual value of the corresponding property on the system is blank, getAttributeValue() will return "" (an empty String). - -

    Note: Typically, methods which add, change, or remove a NetServerPrintShare require that the system user profile has *IOSYSCFG special authority, or that the user owns the output queue on the system. - -

    -
    -* import com.ibm.as400.access.*;
    -* import com.ibm.as400.resource.*;
    -*
    -* // Create a NetServer object for a specific system.
    -* AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -* NetServer ns = new NetServer(system);
    -*
    -* try
    -* {
    -*   // List all current print shares.
    -*   System.out.println("Print shares:");
    -*   ResourceList shareList = ns.listPrintShares();
    -*   shareList.waitForComplete();
    -*   for (int i=0; i<shareList.getListLength(); i++)
    -*   {
    -*     NetServerPrintShare share = (NetServerPrintShare)shareList.resourceAt(i);
    -*     System.out.println(share.getName() + ": " +
    -*       (String)share.getAttributeValue(NetServerPrintShare.OUTPUT_QUEUE_NAME) + ": " +
    -*       (String)share.getAttributeValue(NetServerPrintShare.DESCRIPTION) + "; " +
    -*       ((Integer)share.getAttributeValue(NetServerFileShare.USER_COUNT))
    -*                                                             .intValue() );
    -*   }
    -* }
    -* catch (ResourceException e) {
    -*   e.printStackTrace();
    -* }
    -* finally {
    -*   if (system != null) system.disconnectAllServices();
    -* }
    -
    -
    NetServerPrintShare - - @deprecated This class has been replaced by the - {@link com.ibm.as400.access.ISeriesNetServerPrintShare ISeriesNetServerPrintShare} - class and may be removed in a future release. -**/ - -public class NetServerPrintShare -extends NetServerShare -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - static final long serialVersionUID = 4L; - - - // Attribute setter map. - private static ProgramMap setterMap_ = new ProgramMap(); - private static ProgramMap openListAttributeMap_ = new ProgramMap(); - - // API names. - private static final String ADPS_ = "qzlsadps"; - private static final String CHPS_ = "qzlschps"; - - - //------------------------------------------------------------------------- - // Attribute IDs. - // - // * If you add an attribute here, make sure and add it to the class javadoc. - //------------------------------------------------------------------------- - - // Common attributes for all NetServerShare subclasses: DESCRIPTION, USER_COUNT. - // Note: The subclasses have distinct setter maps for these attributes. - - // Add a setter map entry for the DESCRIPTION attribute (defined in the superclass). - static { - // First ensure that the superclass has been loaded, since we are referencing its static data here. - try { Class.forName("com.ibm.as400.access.NetServerShare"); } - catch (ClassNotFoundException e) {} // This will never happen. - setterMap_.add (NetServerShare.DESCRIPTION, CHPS_, "description"); - openListAttributeMap_.add (DESCRIPTION, OLST0100_, "receiverVariable.description"); - } - - // Add an open list map entry for the USER_COUNT attribute (defined in the superclass). - static { - openListAttributeMap_.add (USER_COUNT, OLST0100_, "receiverVariable.currentUsers"); - } - - - // Unique attributes for class NetServerPrintShare: - - /** - Attribute ID for "output queue library". This identifies a String - attribute, which represents the library that contains the output queue associated with a print share. - @see #OUTPUT_QUEUE_NAME - **/ - public static final String OUTPUT_QUEUE_LIBRARY = "OUTPUT_QUEUE_LIBRARY"; - static { - attributes_.add(OUTPUT_QUEUE_LIBRARY, String.class); - getterMap_.add (OUTPUT_QUEUE_LIBRARY, OLST0100_, "receiverVariable.qualifiedOutputQueueName.libraryName", INDICES_); - setterMap_.add (OUTPUT_QUEUE_LIBRARY, CHPS_, "qualifiedOutputQueueName.libraryName"); - openListAttributeMap_.add (OUTPUT_QUEUE_LIBRARY, OLST0100_, "receiverVariable.qualifiedOutputQueueName.libraryName"); - } - - /** - Attribute ID for "output queue name". This identifies a String - attribute, which represents the name of the output queue associated with a print share. - @see #OUTPUT_QUEUE_LIBRARY - **/ - public static final String OUTPUT_QUEUE_NAME = "OUTPUT_QUEUE_NAME"; - static { - attributes_.add(OUTPUT_QUEUE_NAME, String.class); - getterMap_.add (OUTPUT_QUEUE_NAME, OLST0100_, "receiverVariable.qualifiedOutputQueueName.queueName", INDICES_); - setterMap_.add (OUTPUT_QUEUE_NAME, CHPS_, "qualifiedOutputQueueName.queueName"); - openListAttributeMap_.add (OUTPUT_QUEUE_NAME, OLST0100_, "receiverVariable.qualifiedOutputQueueName.queueName"); - } - - /** - Attribute ID for "print driver type". This identifies a String - attribute, which represents the type of printer driver for a share. -
    - The print driver type is a text string that identifies the print driver appropriate for a share. When personal computers connect to this shared printer, this identifies the print driver that they should use. This text should match the name of a print driver known to the personal computer operating system. - **/ - public static final String PRINT_DRIVER_TYPE = "PRINT_DRIVER_TYPE"; - static { - attributes_.add(PRINT_DRIVER_TYPE, String.class, ""); - getterMap_.add (PRINT_DRIVER_TYPE, OLST0100_, "receiverVariable.printDriverType", INDICES_); - setterMap_.add (PRINT_DRIVER_TYPE, CHPS_, "printDriverType"); - openListAttributeMap_.add (PRINT_DRIVER_TYPE, OLST0100_, "receiverVariable.printDriverType"); - } - - - /** - Attribute ID for "spooled file type". This identifies an Integer - attribute, which represents the spooled file type for a share. -
    - The spooled file type specifies the type of spooled files that will be created using this share. -
    - Valid values are: -
      -
    • {@link #SPOOLED_FILE_TYPE_USER_ASCII SPOOLED_FILE_TYPE_USER_ASCII} - User ASCII. -
    • {@link #SPOOLED_FILE_TYPE_AFP SPOOLED_FILE_TYPE_AFP} - Advanced Function Printing. -
    • {@link #SPOOLED_FILE_TYPE_SCS SPOOLED_FILE_TYPE_SCS} - SNA character string. -
    • {@link #SPOOLED_FILE_TYPE_AUTO_DETECT SPOOLED_FILE_TYPE_AUTO_DETECT} - Automatic type sensing. -
    - The default is {@link #SPOOLED_FILE_TYPE_AUTO_DETECT SPOOLED_FILE_TYPE_AUTO_DETECT}. - **/ - public static final String SPOOLED_FILE_TYPE = "SPOOLED_FILE_TYPE"; - /** - {@link #SPOOLED_FILE_TYPE SPOOLED_FILE_TYPE} attribute value indicating spooled file type "User ASCII". - **/ - public static final Integer SPOOLED_FILE_TYPE_USER_ASCII = new Integer(1); - /** - {@link #SPOOLED_FILE_TYPE SPOOLED_FILE_TYPE} attribute value indicating spooled file type "Advanced Function Printing". - **/ - public static final Integer SPOOLED_FILE_TYPE_AFP = new Integer(2); - /** - {@link #SPOOLED_FILE_TYPE SPOOLED_FILE_TYPE} attribute value indicating spooled file type "SNA character string". - **/ - public static final Integer SPOOLED_FILE_TYPE_SCS = new Integer(3); - /** - {@link #SPOOLED_FILE_TYPE SPOOLED_FILE_TYPE} attribute value indicating "Automatic type sensing". - **/ - public static final Integer SPOOLED_FILE_TYPE_AUTO_DETECT = new Integer(4); - - static { - attributes_.add(SPOOLED_FILE_TYPE, Integer.class, false, - new Object[] {SPOOLED_FILE_TYPE_USER_ASCII, SPOOLED_FILE_TYPE_AFP, SPOOLED_FILE_TYPE_SCS, SPOOLED_FILE_TYPE_AUTO_DETECT }, SPOOLED_FILE_TYPE_AUTO_DETECT, true); - getterMap_.add (SPOOLED_FILE_TYPE, OLST0100_, "receiverVariable.spooledFileType", INDICES_); - setterMap_.add (SPOOLED_FILE_TYPE, CHPS_, "spooledFileType"); - openListAttributeMap_.add (SPOOLED_FILE_TYPE, OLST0100_, "receiverVariable.spooledFileType"); - } - - - - /** - Constructs a NetServerPrintShare object. - The system and share name must be set before the object is used. - **/ - public NetServerPrintShare() - { - super(); - } - - - /** - Constructs a NetServerPrintShare object. - @param system The system. - @param name The name of the share. - **/ - public NetServerPrintShare(AS400 system, String name) - { - super(system, name); - } - - - /** - Adds this print server share to the NetServer. - This method fires a resourceCreated() ResourceEvent. -
    The system and share name be set before this method is called. -
    The {@link #OUTPUT_QUEUE_NAME OUTPUT_QUEUE_NAME} and {@link #OUTPUT_QUEUE_LIBRARY OUTPUT_QUEUE_LIBRARY} attributes must be set before this method is called. -
    {@link com.ibm.as400.resource.ChangeableResource#commitAttributeChanges() commitAttributeChanges} must not be called prior to this method. -
    This method requires *IOSYSCFG special authority on the system, or that the user owns the output queue on the system. - - @exception ResourceException If an error occurs. - **/ - public void add() - throws ResourceException - { - // Set the input parameters and call the API. - try - { - freezeProperties(); - - if (document_ == null) { - document_ = (ProgramCallDocument)staticDocument_.clone(); - } - document_.setSystem(getSystem()); - - document_.setValue(ADPS_+".shareName", getName()); - document_.setValue(CHPS_+".shareName", getName()); - - if (hasUncommittedAttributeChanges(DESCRIPTION)) { // @A1a - document_.setValue(ADPS_+".description", (String)getAttributeValue(DESCRIPTION)); - document_.setValue(CHPS_+".description", (String)getAttributeValue(DESCRIPTION)); - } - - if (hasUncommittedAttributeChanges(OUTPUT_QUEUE_NAME)) { // @A1a - document_.setValue(ADPS_+".qualifiedOutputQueueName.queueName", (String)getAttributeValue(OUTPUT_QUEUE_NAME)); - document_.setValue(CHPS_+".qualifiedOutputQueueName.queueName", (String)getAttributeValue(OUTPUT_QUEUE_NAME)); - } - else { - throw new ExtendedIllegalStateException("queueName", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - if (hasUncommittedAttributeChanges(OUTPUT_QUEUE_LIBRARY)) { // @A1a - document_.setValue(ADPS_+".qualifiedOutputQueueName.libraryName", (String)getAttributeValue(OUTPUT_QUEUE_LIBRARY)); - document_.setValue(CHPS_+".qualifiedOutputQueueName.libraryName", (String)getAttributeValue(OUTPUT_QUEUE_LIBRARY)); - } - else { - throw new ExtendedIllegalStateException("libraryName", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - if (hasUncommittedAttributeChanges(SPOOLED_FILE_TYPE)) { // @A1a - document_.setValue(ADPS_+".spooledFileType", (Integer)getAttributeValue(SPOOLED_FILE_TYPE)); - document_.setValue(CHPS_+".spooledFileType", (Integer)getAttributeValue(SPOOLED_FILE_TYPE)); - } - - if (hasUncommittedAttributeChanges(PRINT_DRIVER_TYPE)) { // @A1a - document_.setValue(ADPS_+".printDriverType", (String)getAttributeValue(PRINT_DRIVER_TYPE)); - document_.setValue(CHPS_+".printDriverType", (String)getAttributeValue(PRINT_DRIVER_TYPE)); - } - - if (! isConnectionEstablished()) { - establishConnection(false); - } - - if (document_.callProgram(ADPS_) == false) { - throw new ResourceException(document_.getMessageList(ADPS_)); - } - - fireResourceCreated(); - } - catch (PcmlException e) { - Trace.log(Trace.ERROR, "PcmlException when adding a print share.", e); - throw new ResourceException(e); - } - } - - - /** - Establishes the connection to the system. - -

    The method is called by the resource framework automatically - when the connection needs to be established. - - @exception ResourceException If an error occurs. - **/ - protected void establishConnection() - throws ResourceException - { - establishConnection(false); - } - - /** - Establishes the connection to the system. - - @param initializeSetterFromSystem Indicates whether or not the setter's values should be initialized from the system. For example, this would be the case when establishing a connection to an existing share, rather than adding a new share. - - @exception ResourceException If an error occurs. - **/ - /*protected*/ void establishConnection(boolean initializeSetterFromSystem) - throws ResourceException - { - super.establishConnection(setterMap_, null, initializeSetterFromSystem); - } - - - // Returns a list of NetServerPrintShare objects. - static ResourceList list(AS400 sys) - throws ResourceException - { - return list(sys, "*ALL"); - } - - - // Returns a list of NetServerPrintShare objects. - static ResourceList list(AS400 sys, String shareName) - throws ResourceException - { - return NetServerShare.list(sys, NetServerShare.PRINT_SHARE, shareName, openListAttributeMap_); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/NetServerPrintShare16.gif b/cvsroot/src/com/ibm/as400/access/NetServerPrintShare16.gif deleted file mode 100644 index e99a16cd4..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/NetServerPrintShare16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/NetServerPrintShare32.gif b/cvsroot/src/com/ibm/as400/access/NetServerPrintShare32.gif deleted file mode 100644 index b321359b1..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/NetServerPrintShare32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/NetServerPrintShareBeanInfo.java b/cvsroot/src/com/ibm/as400/access/NetServerPrintShareBeanInfo.java deleted file mode 100644 index 0c971eea1..000000000 --- a/cvsroot/src/com/ibm/as400/access/NetServerPrintShareBeanInfo.java +++ /dev/null @@ -1,166 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NetServerPrintShareBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import com.ibm.as400.resource.ResourceBeanInfo; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.util.ResourceBundle; - - - -/** -The NetServerPrintShareBeanInfo class represents the bean information -for the NetServerPrintShare class. - @deprecated This class may be removed in a future release. -**/ -public class NetServerPrintShareBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - // Private data. - private static final Class beanClass_ = NetServerPrintShare.class; - - private static BeanInfo[] additionalBeanInfo_; - private static BeanDescriptor beanDescriptor_; - private static Image icon16_; - private static Image icon32_; - private static PropertyDescriptor[] propertyDescriptors_; - private static ResourceBundle resourceBundle_; - - - - /** - Static initializer. - **/ - static - { - try - { - // Set up the resource bundle. - resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.access.MRI2"); - - // Set up the additional bean info. - additionalBeanInfo_ = new BeanInfo[] { new ResourceBeanInfo() }; - - // Set up the bean descriptor. - beanDescriptor_ = new BeanDescriptor(beanClass_); - - // Set up the property descriptors. - PropertyDescriptor name = new PropertyDescriptor("name", beanClass_); - name.setBound(true); - name.setConstrained(false); // we do not allow veto's - name.setDisplayName(resourceBundle_.getString("PROP_NAME_NAME")); - name.setShortDescription(resourceBundle_.getString("PROP_DESC_NAME")); - - propertyDescriptors_ = new PropertyDescriptor[] { name }; - - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error while loading bean info", e); - throw new Error(e.toString()); - } - } - - - - /** - Returns the additional bean information. - - @return The additional bean information. - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return additionalBeanInfo_; - } - - - /** - Returns the bean descriptor. - - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - - - /** - Returns the property descriptors. - - @return The property descriptors. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors_; - } - - - -/// TBD - No icons yet. Revisit this in the next release. -////** -///Returns the icon. -/// -///@param iconKind The icon kind. Possible values are: -///

      -///
    • BeanInfo.ICON_MONO_16x16 -///
    • BeanInfo.ICON_MONO_32x32 -///
    • BeanInfo.ICON_COLOR_16x16 -///
    • BeanInfo.ICON_COLOR_32x32 -///
    -///@return The icon. -///**/ -/// public Image getIcon(int icon) -/// { -/// switch(icon) -/// { -/// case BeanInfo.ICON_MONO_16x16: -/// case BeanInfo.ICON_COLOR_16x16: -/// if (icon16_ == null) -/// icon16_ = loadImage("NetServerPrintShare16.gif"); -/// return icon16_; -/// -/// case BeanInfo.ICON_MONO_32x32: -/// case BeanInfo.ICON_COLOR_32x32: -/// if (icon32_ == null) -/// icon32_ = loadImage("NetServerPrintShare32.gif"); -/// return icon32_; -/// -/// default: -/// throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); -/// } -/// } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/NetServerSession.java b/cvsroot/src/com/ibm/as400/access/NetServerSession.java deleted file mode 100644 index 267d48b9a..000000000 --- a/cvsroot/src/com/ibm/as400/access/NetServerSession.java +++ /dev/null @@ -1,559 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NetServerSession.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import com.ibm.as400.resource.*; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.beans.PropertyVetoException; -import java.util.Vector; - -/** - Represents a NetServer session. -

    - Note: A session (represented by this class) corresponds to a workstation. A workstation could be a Windows Terminal Server or it could be a single PC on someone's desktop. A connection (represented by class {@link NetServerConnection NetServerConnection}) corresponds to a specific user who has mapped a drive and has files opened or spooled output on a print queue. Since a session can have multiple users, a connection shows a particular user's statistics on that session. -

    - NetServerSession objects are created and returned by {@link NetServer#listSessions() NetServer.listSessions()}. -

    -The following attribute IDs are supported: -

    - -

    Use any of the above attribute IDs with -{@link com.ibm.as400.resource.ChangeableResource#getAttributeValue(java.lang.Object) getAttributeValue} -to access the attribute values for a NetServerSession. -
    -Note: For the above attributes, getAttributeValue() should never return null. -For String-valued attributes, if the current actual value of the corresponding property on the system is blank, getAttributeValue() will return "" (an empty String). - -

    -
    -* import com.ibm.as400.access.*;
    -* import com.ibm.as400.resource.*;
    -*
    -* // Create a NetServer object for a specific system.
    -* AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -* NetServer ns = new NetServer(system);
    -*
    -* try
    -* {
    -*
    -*   // List all current sessions.
    -*   System.out.println("Sessions:");
    -*   ResourceList sessionList = ns.listSessions();
    -*   sessionList.waitForComplete();
    -*   for (int i=0; i<sessionList.getListLength(); i++)
    -*   {
    -*     NetServerSession session =
    -*       (NetServerSession)sessionList.resourceAt(i);
    -*     System.out.println(session.getName() + ": " +
    -*       (String)session.getAttributeValue(NetServerSession.USER) + "; " +
    -*       ((Integer)session.getAttributeValue(NetServerSession.SESSION_TIME))
    -*                                                           .intValue() + "; " +
    -*       ((Boolean)session.getAttributeValue(NetServerSession.IS_GUEST))
    -*                                                           .booleanValue() );
    -*   }
    -* }
    -* catch (ResourceException e) {
    -*   e.printStackTrace();
    -* }
    -* finally {
    -*   if (system != null) system.disconnectAllServices();
    -* }
    -
    -
    - - @deprecated This class has been replaced by the - {@link com.ibm.as400.access.ISeriesNetServerSession ISeriesNetServerSession} - class and may be removed in a future release. -**/ - - -public class NetServerSession -extends Resource -{ - static final long serialVersionUID = 4L; - - //------------------------------------------------------------------------- - // Presentation. - //------------------------------------------------------------------------- - - private static PresentationLoader presentationLoader_ = new PresentationLoader("com.ibm.as400.access.MRI2"); - private static final String ICON_BASE_NAME_ = "NetServerSession"; - private static final String PRESENTATION_KEY_ = "NETSERVER"; - - private static ResourceMetaDataTable attributes_ = new ResourceMetaDataTable(presentationLoader_, PRESENTATION_KEY_); - - // Attribute getter map. - private static ProgramMap getterMap_ = new ProgramMap(); - private static ProgramMap openListAttributeMap_ = new ProgramMap(); - - // API names. - private static final String ENSS_ = "qzlsenss"; - - private static final String OLST0300_ = "qzlsolst_zlsl0300"; - private static final int[] INDICES_ = { 0 }; // For specifying first record in list. - - - - //------------------------------------------------------------------------- - // Attribute IDs. - // - // * If you add an attribute here, make sure and add it to the class javadoc. - //------------------------------------------------------------------------- - - /** - Attribute ID for "connection count". This identifies a read-only Integer - attribute, which represents the number of connections made during a session. - **/ - public static final String CONNECTION_COUNT = "CONNECTION_COUNT"; - static { - attributes_.add(CONNECTION_COUNT, Integer.class, true); - getterMap_.add (CONNECTION_COUNT, OLST0300_, "receiverVariable.numberOfConnections", INDICES_); - openListAttributeMap_.add (CONNECTION_COUNT, OLST0300_, "receiverVariable.numberOfConnections"); - } - - /** - Attribute ID for "session time". This identifies a read-only Integer - attribute, which represents the number of seconds that a session has been active. - **/ - public static final String SESSION_TIME = "SESSION_TIME"; - static { - attributes_.add(SESSION_TIME, Integer.class, true); - getterMap_.add (SESSION_TIME, OLST0300_, "receiverVariable.sessionTime", INDICES_); - openListAttributeMap_.add (SESSION_TIME, OLST0300_, "receiverVariable.sessionTime"); - } - - /** - Attribute ID for "files open count". This identifies a read-only Integer - attribute, which represents the number of files that are currently open for a session. - **/ - public static final String FILES_OPEN_COUNT = "FILES_OPEN_COUNT"; - static { - attributes_.add(FILES_OPEN_COUNT, Integer.class, true); - getterMap_.add (FILES_OPEN_COUNT, OLST0300_, "receiverVariable.numberOfFilesOpen", INDICES_); - openListAttributeMap_.add (FILES_OPEN_COUNT, OLST0300_, "receiverVariable.numberOfFilesOpen"); - } - - /** - Attribute ID for "session idle time". This identifies a read-only Integer - attribute, which represents the number of seconds a session has been idle. - **/ - public static final String IDLE_TIME = "IDLE_TIME"; - static { - attributes_.add(IDLE_TIME, Integer.class, true); - getterMap_.add (IDLE_TIME, OLST0300_, "receiverVariable.idleTime", INDICES_); - openListAttributeMap_.add (IDLE_TIME, OLST0300_, "receiverVariable.idleTime"); - } - - /** - Attribute ID for "is encrypt password". This identifies a read-only Boolean - attribute, which indicates whether or not the encrypted password was used to establish a session. - **/ - public static final String IS_ENCRYPT_PASSWORD = "IS_ENCRYPT_PASSWORD"; - static { - attributes_.add(IS_ENCRYPT_PASSWORD, Boolean.class, true); - //ValueMap valueMap = new BooleanValueMap("0", "1"); - ValueMap valueMap = new BooleanValueMap(new String[] {"0", ""}, new String[] { "1" }); // Note: During testing, we occasionally see a blank returned. - getterMap_.add (IS_ENCRYPT_PASSWORD, OLST0300_, "receiverVariable.encryptedPassword", INDICES_, valueMap); - openListAttributeMap_.add (IS_ENCRYPT_PASSWORD, OLST0300_, "receiverVariable.encryptedPassword", valueMap); - } - - /** - Attribute ID for "is guest". This identifies a read-only Boolean - attribute, which indicates whether or not a session is a guest session. - **/ - public static final String IS_GUEST = "IS_GUEST"; - static { - attributes_.add(IS_GUEST, Boolean.class, true); - //ValueMap valueMap = new BooleanValueMap("1", "0"); - // Note the reverse logic: The API field is "logon type", which is 0 if guest, 1 if regular user. - ValueMap valueMap = new BooleanValueMap(new String[] {"1", ""}, new String[] { "0" }); // Note: During testing, we occasionally see a blank returned. - getterMap_.add (IS_GUEST, OLST0300_, "receiverVariable.logonType", INDICES_, valueMap); - openListAttributeMap_.add (IS_GUEST, OLST0300_, "receiverVariable.logonType", valueMap); - } - - /** - Attribute ID for "session count". This identifies a read-only Integer - attribute, which represents the number of sessions that are established between the system and the requester. This value is always 0 or 1. - **/ - // Note: We will not make this attribute public unless someone says they need it. - /*public*/ static final String SESSION_COUNT = "SESSION_COUNT"; - static { - attributes_.add(SESSION_COUNT, Integer.class, true); - getterMap_.add (SESSION_COUNT, OLST0300_, "receiverVariable.numberOfSessions", INDICES_); - openListAttributeMap_.add (SESSION_COUNT, OLST0300_, "receiverVariable.numberOfSessions"); - } - - /** - Attribute ID for "user name". This identifies a read-only String - attribute, which represents the name of the user that is associated with a session. - **/ - public static final String USER = "USER"; - static { - attributes_.add(USER, String.class, true); - getterMap_.add (USER, OLST0300_, "receiverVariable.userProfileName", INDICES_); - openListAttributeMap_.add (USER, OLST0300_, "receiverVariable.userProfileName"); - } - - - - //---------------------------------------------------------------------- - // PCML document initialization. - //---------------------------------------------------------------------- - - private static final String DOCUMENT_NAME_ = "com.ibm.as400.access.NetServer"; - private static ProgramCallDocument staticDocument_ = null; - private ProgramCallDocument document_; - - static { - // Create a static version of the PCML document, then clone it for each document. - // This will improve performance, since we will only have to deserialize the PCML - // object once. - try { - staticDocument_ = new ProgramCallDocument(); - staticDocument_.setDocument(DOCUMENT_NAME_); - } - catch (PcmlException e) { - Trace.log(Trace.ERROR, "PcmlException when instantiating ProgramCallDocument.", e); - } - } - - - - //---------------------------------------------------------------------- - // Private data. - //---------------------------------------------------------------------- - - // Workstation name. This uniquely identifies a session on the system. - private String name_; - - private ProgramAttributeGetter attributeGetter_; - - - - // Note: This method is reserved for use by the NetServer class. - NetServerSession() - { - super(presentationLoader_.getPresentationWithIcon(PRESENTATION_KEY_, ICON_BASE_NAME_), null, attributes_); - } - - - // Note: This method is reserved for use by the NetServer class. - NetServerSession(AS400 system, String name) - { - this(); - try { setSystem(system); } catch (PropertyVetoException e) {} - setName(name); - } - - - /** - Computes the resource key. - - @param system The system. - **/ - static Object computeResourceKey(AS400 system, String name) - { - StringBuffer buffer = new StringBuffer(); - buffer.append(NetServerSession.class); - buffer.append(':'); - buffer.append(system.getSystemName()); - buffer.append(':'); - buffer.append(name); - return buffer.toString(); - } - - /** - Ends the session. - This method fires a resourceDeleted() ResourceEvent. -
    This method requires *IOSYSCFG special authority on the system. - - @exception ResourceException If an error occurs. - **/ - public void end() - throws ResourceException - { - if (! isConnectionEstablished()) { - establishConnection(); - } - - endSession(getSystem(), name_); - // fireSessionEnded(); // future - } - - - /** - Ends a session. - @param sys The system. - @param sessionName The name of the session. - - @exception ResourceException If an error occurs. - **/ - static void endSession(AS400 system, String sessionName) - throws ResourceException - { - // Set the input parameters and call the API. - try - { - ProgramCallDocument document = (ProgramCallDocument)staticDocument_.clone(); - document.setSystem(system); - document.setValue(ENSS_+".workstationName", sessionName); - - if (document.callProgram(ENSS_) == false) { - throw new ResourceException(document.getMessageList(ENSS_)); - } - } - catch (PcmlException e) { - Trace.log(Trace.ERROR, "PcmlException when ending a session.", e); - throw new ResourceException(e); - } - } - - - /** - Establishes the connection to the system. - -

    The method is called by the resource framework automatically - when the connection needs to be established. - - @exception ResourceException If an error occurs. - **/ - protected void establishConnection() - throws ResourceException - { - if (name_ == null) { - throw new ExtendedIllegalStateException("name", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Call the superclass. - super.establishConnection(); - - // Initialize the PCML document. - AS400 system = getSystem(); - document_ = (ProgramCallDocument)staticDocument_.clone(); - try { - document_.setSystem(system); - document_.setValue("qzlsolst_zlsl0300.informationQualifier", name_); - - // Initialize the attribute getter. - attributeGetter_ = new ProgramAttributeGetter(system, document_, getterMap_); - } - catch (PcmlException e) { - Trace.log(Trace.ERROR, "PcmlException when establishing connection.", e); - throw new ResourceException(e); - } - } - - - /** - Freezes any property changes. After this is called, property - changes should not be made. Properties are not the same thing - as attributes. Properties are basic pieces of information - which must be set to make the object usable, such as the system - and the name. - -

    The method is called by the resource framework automatically - when the properties need to be frozen. - - @exception ResourceException If an error occurs. - **/ - protected void freezeProperties() - throws ResourceException - { - // Verify that the session name has been set. - if (name_ == null) { - throw new ExtendedIllegalStateException("name", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Update the presentation. - Presentation presentation = getPresentation(); - presentation.setName(name_); - presentation.setFullName(name_); - - // Update the resource key. - if (getResourceKey() == null) { - setResourceKey(computeResourceKey(getSystem(), name_)); - } - - // Call the superclass. - super.freezeProperties(); - } - - - // Returns the attribute metadata for the class. - static ResourceMetaData[] getAttributeMetaDataStatic() - { - return attributes_.getMetaData(); - } - - - /** - Returns the current value of an attribute. - - @param attributeID Identifies the attribute. - @return The attribute value, or null if the attribute - value is not available. - - @exception ResourceException If an error occurs. - **/ - public Object getAttributeValue(Object attributeID) - throws ResourceException - { - if (! isConnectionEstablished()) { - establishConnection(); - } - - Object value = super.getAttributeValue(attributeID); - - if (value == null) { - value = attributeGetter_.getValue(attributeID); - } - return value; - } - - - /** - Returns the name of the workstation from which the session to the system was established. - @return The workstation name. - **/ - public String getName() - { - return name_; - } - - - /** - Lists the current sessions. - The returned ResourceList contains {@link NetServerSession NetServerSession} objects. - @return Information about the current sessions. - - @exception ResourceException If an error occurs. - **/ - static ResourceList list(AS400 system) - throws ResourceException - { - // Note: The on-line spec says that the 0300 format requires a valid session name. This is not entirely correct. It will also accept *ALL. - - try - { - // Set the input parameters and call the API. - ProgramCallDocument document = (ProgramCallDocument)staticDocument_.clone(); - document.setSystem(system); - document.setValue(OLST0300_+".informationQualifier", "*ALL"); - - // Note: Formats ZLSL0300 returns a list of 64-byte fixed-length records. - int expectedInfoLength = 10*64; // Expect about 10 64-byte records. - document.setIntValue(OLST0300_+".lengthOfReceiverVariable", expectedInfoLength); - - NetServer.callListProgram(document, OLST0300_, true); - // Note: This method does a retry (with larger buffer) if receiverVariable is overflowed. - - int recCount = document.getIntValue(OLST0300_+".listInformation.recordsReturned"); - int recSize = document.getIntValue(OLST0300_+".listInformation.recordLength"); - - Vector sessions = new Vector(); - String prefix = OLST0300_+".receiverVariable."; - - int index = 0; - int[] indices = new int[1]; - Object[] attributeIDs = openListAttributeMap_.getIDs(); - - for (int i=0; iNote: If the NetServer has not been started, this attribute's reported value will be -1. - See {@link NetServer#isStarted() NetServer.isStarted()} and {@link NetServer#start() NetServer.start()}. - **/ - public static final String USER_COUNT = "USER_COUNT"; - static { - attributes_.add(USER_COUNT, Integer.class, true); - getterMap_.add (USER_COUNT, OLST0100_, "receiverVariable.currentUsers", INDICES_); - } - - - //---------------------------------------------------------------------- - // PCML document initialization. - //---------------------------------------------------------------------- - - /*protected*/ static final String DOCUMENT_NAME_ = "com.ibm.as400.access.NetServer"; - /*protected*/ static ProgramCallDocument staticDocument_ = null; - /*protected*/ ProgramCallDocument document_; - - static { - // Create a static version of the PCML document, then clone it for each document. - // This will improve performance, since we will only have to deserialize the PCML - // object once. - try { - staticDocument_ = new ProgramCallDocument(); - staticDocument_.setDocument(DOCUMENT_NAME_); - } - catch (PcmlException e) { - Trace.log(Trace.ERROR, "PcmlException when instantiating ProgramCallDocument.", e); - } - } - - // Values for "Device type" field for a share. - /*protected*/ static final int FILE_SHARE = 0; - /*protected*/ static final int PRINT_SHARE = 1; - /*protected*/ static final int ALL_SHARES = -1; // accommodate future enhancement - - - //---------------------------------------------------------------------- - // Private data. - //---------------------------------------------------------------------- - - // The name of the share. Note: Uppercased on the system. - private String name_; - - // The attributes that need to be set before other attributes are set. - // Leave it null if no specific attributes need to be set before others. - private Object[] attrsToSetFirst_; - - private ProgramAttributeGetter attributeGetter_; - private ProgramAttributeSetter attributeSetter_; - - - - /** - Constructs a NetServerShare object. - Note: This method is reserved for use by subclasses. - **/ - /*protected*/ NetServerShare() - { - super(presentationLoader_.getPresentationWithIcon(PRESENTATION_KEY_, ICON_BASE_NAME_), null, attributes_); - } - - - /** - Constructs a NetServerShare object. - Note: This method is reserved for use by subclasses. - @param system The system. - @param name The name of the share. - **/ - /*protected*/ NetServerShare(AS400 system, String name) - { - this(); - try { setSystem(system); } catch (PropertyVetoException e) {} - setName(name); - } - - /** - Adds the share to the NetServer. - This method fires a resourceCreated() ResourceEvent. - @exception ResourceException If an error occurs. - **/ - public abstract void add() throws ResourceException; - - - /** - Commits the specified attribute changes. -
    This method requires *IOSYSCFG special authority on the system. - This method fires an attributeChangesCommitted() ResourceEvent. - - @exception ResourceException If an error occurs. - **/ - protected void commitAttributeChanges(Object[] attributeIDs, Object[] values) - throws ResourceException - { - super.commitAttributeChanges(attributeIDs, values); - - if (! isConnectionEstablished()) { - establishConnection(); - } - - attributeSetter_.setValues(attributeIDs, values); - } - - - /** - Computes the resource key. - - @param system The system. - **/ - static Object computeResourceKey(AS400 system, String name) - { - StringBuffer buffer = new StringBuffer(); - buffer.append(NetServerShare.class); - buffer.append(':'); - buffer.append(system.getSystemName()); - buffer.append(':'); - buffer.append(name); // Note: The share name uniquely identifies the share on the system. - return buffer.toString(); - } - - - /** - Establishes the connection to the system. - -

    The method is called by the resource framework automatically - when the connection needs to be established. - - @exception ResourceException If an error occurs. - **/ - protected abstract void establishConnection() - throws ResourceException; - - /** - Establishes the connection to the system. - - @param initializeSetterFromSystem Indicates whether or not the setter's values should be initialized from the system. For example, this would be the case when establishing a connection to an existing share, rather than adding a new share. - - @exception ResourceException If an error occurs. - **/ - /*protected*/ abstract void establishConnection(boolean initializeSetterFromSystem) - throws ResourceException; - - - // Note: This method is reserved for use by the subclasses. - /** - Establishes the connection to the system. - -

    The method is called by the resource framework automatically - when the connection needs to be established. - - @param setterMap The setter map (defined by the subclass). - @param attributesToSetFirst The attributes that must be set first (for example, attributes that specify lengths of other attributes). - @param initializeSetterFromSystem Indicates whether or not the setter's values should be initialized from the system. For example, this would be the case when establishing a connection to an existing share, rather than adding a new share. - - @exception ResourceException If an error occurs. - **/ - /*protected*/ void establishConnection(ProgramMap setterMap, Object[] attributesToSetFirst, boolean initializeSetterFromSystem) - throws ResourceException - { - // Verify that the share name has been set. - if (name_ == null) { - throw new ExtendedIllegalStateException("name", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Call the superclass. - super.establishConnection(); - - attrsToSetFirst_ = attributesToSetFirst; - - // Initialize the PCML document. - AS400 system = getSystem(); - if (document_ == null) { - document_ = (ProgramCallDocument)staticDocument_.clone(); - } - try { - document_.setSystem(system); - document_.setValue("qzlsolst_zlsl0100.informationQualifier", name_); - - // Initialize the attribute getter. - attributeGetter_ = new ProgramAttributeGetter(system, document_, getterMap_); - - // Note: The attribute setter map is initialized in the subclasses. - - // Initialize the attribute setter. - attributeSetter_ = new ProgramAttributeSetter(getSystem(), document_, setterMap); - if (initializeSetterFromSystem) { - attributeSetter_.initializeAttributeValues(attributeGetter_, attrsToSetFirst_); - } - } - catch (PcmlException e) { - Trace.log(Trace.ERROR, "PcmlException when establishing connection to share.", e); - throw new ResourceException(e); - } - } - - - /** - Freezes any property changes. After this is called, property - changes should not be made. Properties are not the same thing - as attributes. Properties are basic pieces of information - which must be set to make the object usable, such as the system, - job name, job number, and user name. - -

    The method is called by the resource framework automatically - when the properties need to be frozen. - - @exception ResourceException If an error occurs. - **/ - protected void freezeProperties() - throws ResourceException - { - // Verify that the system has been set. - if (getSystem() == null) { - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Verify that the share name has been set. - if (name_ == null) { - throw new ExtendedIllegalStateException("name", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Update the presentation. - Presentation presentation = getPresentation(); - presentation.setName(name_); - presentation.setFullName(name_); - - // Update the resource key. - if (getResourceKey() == null) { - setResourceKey(computeResourceKey(getSystem(), name_)); - } - - // Call the superclass. - super.freezeProperties(); - } - - - // Returns the attribute metadata for the class. - static ResourceMetaData[] getAttributeMetaDataStatic() - { - return attributes_.getMetaData(); - } - - - /** - Returns the value of an attribute, disregarding any uncommitted - changes. - - @param attributeID Identifies the attribute. - @return The attribute value, or null if the attribute - value is not available. - - @exception ResourceException If an error occurs. - **/ - public Object getAttributeUnchangedValue(Object attributeID) - throws ResourceException - { - Object value = super.getAttributeUnchangedValue(attributeID); - - if (value == null) { - if (! isConnectionEstablished()) { // @A2M - establishConnection(); // @A2M - } - value = attributeGetter_.getValue(attributeID); - } - return value; - } - - /** - Returns the network name of the share. -
    Note: All share names are uppercase on the system. - @return The share name. - **/ - public String getName() - { - return name_; - } - - - // Returns a list of NetServerShare objects. - /*protected*/ static ResourceList list(AS400 system, int desiredShareType, String qualifier, ProgramMap openListAttributeMap) - throws ResourceException - { - try - { - // Set the input parameters and call the API. - ProgramCallDocument document = (ProgramCallDocument)staticDocument_.clone(); - document.setSystem(system); - String programName = OLST0100_; - document.setValue(programName+".informationQualifier", qualifier); // @A1c - - int expectedInfoLength = 10*ZLSL0100_MAX_RECORD_LENGTH_; // Expect about 10 records. - document.setIntValue(programName+".lengthOfReceiverVariable", expectedInfoLength); - - NetServer.callListProgram(document, programName, false); - // Note: This method does a retry (with larger buffer) if receiverVariable is overflowed. - - int recCount = document.getIntValue(programName+".listInformation.recordsReturned"); - // Note: Since records are variable-length, recSize will be returned as zero. - - Vector shares = new Vector(); - String prefix = programName+".receiverVariable."; - - int index = 0; - int[] indices = new int[1]; - Object[] attributeIDs = openListAttributeMap.getIDs(); - for (int i=0; iTo use this method, the user profile must either have *IOSYSCFG special authority, or own the integrated file system directory or output queue that the share references. -
    This method fires a resourceDeleted() ResourceEvent. - - @exception ResourceException If an error occurs. - **/ - public void remove() - throws ResourceException - { - if (! isConnectionEstablished()) { - establishConnection(false); - } - - remove(getSystem(), name_); - fireResourceDeleted(); - } - - - /** - Removes a share from the NetServer. - - @exception ResourceException If an error occurs. - **/ - static void remove(AS400 system, String shareName) - throws ResourceException - { - // Set the input parameters and call the API. - try - { - ProgramCallDocument document = (ProgramCallDocument)staticDocument_.clone(); - document.setSystem(system); - document.setValue("qzlsrms.shareName", shareName); - - if (document.callProgram("qzlsrms") == false) { - throw new ResourceException(document.getMessageList("qzlsrms")); - } - } - catch (PcmlException e) { - Trace.log(Trace.ERROR, "PcmlException when removing a share.", e); - throw new ResourceException(e); - } - } - - /** - Sets the network name of the share. -
    Note: All share names are uppercase on the system. - Share names are limited to 12 characters in length. - This method fires a PropertyChangeEvent. - - @param name The name of the share. - **/ - public void setName(String name) - { - if (name == null) { - throw new NullPointerException("name"); - } - if (arePropertiesFrozen()) { - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - String oldValue = name_; - name_ = name; - firePropertyChange("name", oldValue, name); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/ObjectAlreadyExistsException.java b/cvsroot/src/com/ibm/as400/access/ObjectAlreadyExistsException.java deleted file mode 100644 index 69aa1b4da..000000000 --- a/cvsroot/src/com/ibm/as400/access/ObjectAlreadyExistsException.java +++ /dev/null @@ -1,118 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ObjectAlreadyExistsException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - - -package com.ibm.as400.access; - - - -/** - The ObjectAlreadyExistsException class represents an exception - that indicates that a system object already exists. -**/ -public class ObjectAlreadyExistsException extends Exception - implements ReturnCodeException -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - - private int rc_; // Return code associated with this exception - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - - - // Return code values used by this class. - // If a value is added here, it must also be added to MRI.properties. - - /** - The return code indicating that the - object already exists. - **/ - public static final int OBJECT_ALREADY_EXISTS = 1; - - - - - - /** - Constructs an ObjectAlreadyExistsException object. - It indicates that a system object already exists. - Exception message will look like this: Object already exists. - @param returnCode The return code which identifies the message to be returned. - **/ - ObjectAlreadyExistsException(int returnCode) - { - // Create the message - super(loader_.getText(getMRIKey(returnCode))); - rc_ = returnCode; - } - - - - /** - Constructs an ObjectAlreadyExistsException object. - It indicates that a system object already exists. - Exception message will look like this: dataQueue (mydataqueue): Object already exists. - @param objectName The object that already exists. - It should be in the format: type (value). - For example: dataQueue (mydataqueue). - @param returnCode The return code which identifies the message to be returned. - **/ - ObjectAlreadyExistsException(String objectName, int returnCode) - { - // Create the message - super(objectName + ": " + loader_.getText(getMRIKey(returnCode))); - rc_ = returnCode; - } - - - - - - /** - Returns the text associated with the return code. - @param returnCode The return code associated with this exception. - @return The text string which describes the error. - **/ - // This method is required so the message can be created and sent in super() - static String getMRIKey (int returnCode) - { - switch(returnCode) - { - case OBJECT_ALREADY_EXISTS: - return "EXC_OBJECT_ALREADY_EXISTS"; - default: - return "EXC_UNKNOWN"; // Bad return code was provided. - } - } - - - - /** - Returns the return code associated with this exception. - @return The return code. - **/ - public int getReturnCode () - { - return rc_; - } - - - -} // End of ObjectAlreadyExistsException diff --git a/cvsroot/src/com/ibm/as400/access/ObjectDescription.java b/cvsroot/src/com/ibm/as400/access/ObjectDescription.java deleted file mode 100644 index aab9ec155..000000000 --- a/cvsroot/src/com/ibm/as400/access/ObjectDescription.java +++ /dev/null @@ -1,1969 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ObjectDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// Changes: -// @A1 - 07/09/2007 - Change exists() to handle CPF9811 -// -/////////////////////////////////////////////////////////////////////////////// - - -package com.ibm.as400.access; - -import java.beans.*; -import java.io.*; -import java.util.*; - -/** - * Represents a system QSYS object and its attributes. - * ObjectDescription objects can be constructed individually, or generated - * from an {@link ObjectList ObjectList}. An object's - * attributes can be retrieved by calling {@link #getValue getValue()} and - * passing one of the integer attribute constants defined in this class. - *

    - * Note: This class is not intended for use with database file members (type *MBR). - * To retrieve attributes of file members, use {@link MemberDescription MemberDescription}. - *

    - * Performance hint: - * If you anticipate retrieving multiple attributes for a given QSYS object, - * first call {@link #refresh refresh()}, which will make a single API call - * to retrieve (and cache) all of the object's attribute values. - *

    - * Implementation note: - * This class internally uses the Retrieve Object Description (QUSROBJD) and - * List Object Locks (QWCLOBJL) APIs. - * - * @see ObjectList - * @see MemberDescription -**/ -public class ObjectDescription -{ - private static final String USERSPACE_NAME = "JT4WCLOBJLQTEMP "; // New for QWCLOBJL API - private static final String USERSPACE_PATH = "/QSYS.LIB/QTEMP.LIB/JT4WCLOBJL.USRSPC"; // New for QWCLOBJL API - private static final String FORMAT_NAME = "OBJL0100"; // New for QWCLOBJL API - private final static ProgramParameter errorCode_ = new ProgramParameter(new byte[4]); // New for QWCLOBJL API - - - /** - * Object attribute representing whether the object can be - * changed by the Change Object Description (QLICOBJD) API. - *

    Type: {@link java.lang.Boolean Boolean} - **/ - public static final int ALLOW_CHANGE_BY_PROGRAM = 308; - - /** - * Object attribute representing the identifier of the - * authorized program analysis report (APAR) that caused - * this object to be replaced. This field is null if - * the object did not change because of an APAR. - *

    Type: {@link java.lang.String String} - **/ - public static final int APAR = 413; - - /** - * Constant indicating that the auxiliary storage pools that are currently - * part of the the thread's library name space will be searched to locate - * the library. This includes the system ASP (ASP 1), all defined basic - * user ASPs (ASPs 2-32), and, if the thread has an ASP group, the primary - * and secondary ASPs in the thread's ASP group. - */ - public static final String ASP_NAME_ALL = "*"; // @550A - - /** - * Constant indicating that the system ASP (ASP 1) and all defined basic user ASPs (ASPs 2-32) - * will be searched to locate the library. No primary or secondary ASPs will be - * searched, even if the thread has an ASP group. - */ - public static final String ASP_NAME_SYSBAS = "*SYSBAS"; // @550A - - /** - * Constant indicating that if the thread has an ASP group, the primary and secondary ASPs - * in the ASP group will be searched to locate the library. The system ASP (ASP 1) and - * defined basic user ASPs (ASPs 2-32) will not be searched. - */ - public static final String ASP_NAME_CURASPGRP = "*CURASPGRP"; // @550A - - /** - * Constant indicating that all available ASPs will be searched. This includes the system - * ASP (ASP 1), all defined basic user ASPs (ASPs 2-32), and all available primary and - * secondary ASPs (ASPs 33-255 with a status of 'Available'). The ASP groups are searched - * in alphabetical order by the primary ASP. The system ASP and all defined basic user - * ASPs are searched after the ASP groups. ASPs and libraries to which the user is not authorized - * are bypassed and no authority error messages are sent. The search ends when the first object - * is found of the specified object name, library name, and object type. If the user is - * not authorized to the object, an authority error message is sent. - */ - public static final String ASP_NAME_ALLAVL = "*ALLAVL"; // @550A - - /** - * Constant indicating that the name of the auxiliary storage pool - * device is not known. - * @see #LIBRARY_ASP_DEVICE_NAME - * @see #OBJECT_ASP_DEVICE_NAME - **/ - public static final String ASP_NAME_UNKNOWN = "*N"; - - /** - * Constant indicating that only the single ASP named in the auxiliary storage - * pool device name field will be searched. - */ - public static final String ASP_SEARCH_TYPE_ASP = "*ASP"; // @550A - - /** - * Constant indicating that all ASPs in the auxiliary storage pool group named - * in the auxiliary storage pool device name field will be searched. The device - * name must be the name of the primary auxiliary storage pool in the group. - */ - public static final String ASP_SEARCH_TYPE_ASPGRP = "*ASPGRP"; // @550A - - /** - * Object attribute representing the type of auditing for the object. - * Valid values are: - *

      - *
    • {@link #AUDITING_NONE AUDITING_NONE} - No auditing occurs for - * the object when it is read or changed, regardless of the user - * who is accessing the object. - *
    • {@link #AUDITING_USER_PROFILE AUDITING_USER_PROFILE} - Audit the - * object only if the user accessing the object is being audited. - *
    • {@link #AUDITING_CHANGE AUDITING_CHANGE} - Audit all - * change access to this object by all users on the system. - *
    • {@link #AUDITING_ALL AUDITING_ALL} - Audit all access to the object - * by all users on the system. All access is defined as a read or - * change operation. - *
    - *

    Type: {@link java.lang.String String} - **/ - public static final int AUDITING = 310; - - /** - * Constant representing the auditing value *ALL. - * @see #AUDITING - **/ - public static final String AUDITING_ALL = "*ALL"; - - /** - * Constant representing the auditing value *CHANGE. - * @see #AUDITING - **/ - public static final String AUDITING_CHANGE = "*CHANGE"; - - /** - * Constant representing the auditing value *NONE. - * @see #AUDITING - **/ - public static final String AUDITING_NONE = "*NONE"; - - /** - * Constant representing the auditing value *USRPRF. - * @see #AUDITING - **/ - public static final String AUDITING_USER_PROFILE = "*USRPRF"; - - /** - * Object attribute representing the time at which - * the object was last changed. - *

    Type: {@link java.util.Date java.util.Date} - **/ - public static final int CHANGE_DATE = 305; - - /** - * Object attribute representing whether the object has been - * changed by the Change Object Description (QLICOBJD) API. - *

    Type: {@link java.lang.Boolean Boolean} - **/ - public static final int CHANGED_BY_PROGRAM = 309; - - // We dont' use these, but there's nothing to prevent the user - // from manually entering an integer attribute equal to one of - // these values. - static final int COMBINATION_200 = 200; - static final int COMBINATION_300 = 300; - static final int COMBINATION_400 = 400; - static final int COMBINATION_500 = 500; - static final int COMBINATION_600 = 600; - static final int COMBINATION_700 = 700; - - - /** - * Object attribute representing the licensed program - * of the compiler used to generate this object. - * The field will be null if the program was not compiled. - *

    Type: {@link Product Product} - **/ - public static final int COMPILER = 408; - - /** - * Object attribute representing the compression status of - * the object. Valid values are: - *

      - *
    • {@link #COMPRESSION_YES COMPRESSION_YES} - Compressed. - *
    • {@link #COMPRESSION_NO COMPRESSION_NO} - Permanently decompressed - * and compressible. - *
    • {@link #COMPRESSION_INELIGIBLE COMPRESSION_INELIGIBLE} - Permanently - * decompressed and not compressible. - *
    • {@link #COMPRESSION_TEMPORARY COMPRESSION_TEMPORARY} - Temporarily - * decompressed. - *
    • {@link #COMPRESSION_STORAGE_FREED COMPRESSION_STORAGE_FREED} - Saved with - * storage freed. The compression status cannot be determined. - *
    - *

    Type: {@link java.lang.String String} - **/ - public static final int COMPRESSION = 307; - - /** - * Constant representing the compression status "X". - * @see #COMPRESSION - **/ - public static final String COMPRESSION_INELIGIBLE = "X"; - - /** - * Constant representing the compression status "N". - * @see #COMPRESSION - **/ - public static final String COMPRESSION_NO = "N"; - - /** - * Constant representing the compression status "F". - * @see #COMPRESSION - **/ - public static final String COMPRESSION_STORAGE_FREED = "F"; - - /** - * Constant representing the compression status "T". - * @see #COMPRESSION - **/ - public static final String COMPRESSION_TEMPORARY = "T"; - - /** - * Constant representing the compression status "Y". - * @see #COMPRESSION - **/ - public static final String COMPRESSION_YES = "Y"; - - /** - * Object attribute representing the time at which the - * object was created. - *

    Type: {@link java.util.Date java.util.Date} - **/ - public static final int CREATION_DATE = 304; - - /** - * Object attribute representing the name of the system on - * which the object was created. - *

    Type: {@link java.lang.String String} - **/ - public static final int CREATOR_SYSTEM = 406; - - /** - * Object attribute representing the name of the user - * that created the object. - *

    Type: {@link java.lang.String String} - **/ - public static final int CREATOR_USER_PROFILE = 405; - - /** - * Constant representing the value *CURLIB. - **/ - public static final String CURRENT_LIBRARY = "*CURLIB"; - - /** - * Object attribute representing the number of days the - * object was used, or 0 if the object does not have - * a last-used date. - *

    Type: {@link java.lang.Integer Integer} - * @see #LAST_USED_DATE - **/ - public static final int DAYS_USED = 603; - - /** - * Object attribute representing whether the object - * has a digital signature. - *

    Type: {@link java.lang.Boolean Boolean} - * @see #DIGITALLY_SIGNED_TRUSTED - * @see #DIGITALLY_SIGNED_MULTIPLE - **/ - public static final int DIGITALLY_SIGNED = 311; - - /** - * Object attribute representing whether the object has - * more than one digital signature. - *

    Type: {@link java.lang.Boolean Boolean} - * @see #DIGITALLY_SIGNED - * @see #DIGITALLY_SIGNED_TRUSTED - **/ - public static final int DIGITALLY_SIGNED_MULTIPLE = 313; - - /** - * Object attribute representing whether the object - * is signed by a source that is trusted by the system. - *

    Type: {@link java.lang.Boolean Boolean} - * @see #DIGITALLY_SIGNED - * @see #DIGITALLY_SIGNED_MULTIPLE - **/ - public static final int DIGITALLY_SIGNED_TRUSTED = 312; - - /** - * Object attribute representing the domain that contains - * the object. Valid values are: - *

      - *
    • {@link #DOMAIN_USER DOMAIN_USER} - The object is in the user domain. - *
    • {@link #DOMAIN_SYSTEM DOMAIN_SYSTEM} - The object is in the system domain. - *
    - *

    Type: {@link java.lang.String String} - **/ - public static final int DOMAIN = 303; - - /** - * Constant representing the object domain value of "*S". - * @see #DOMAIN - **/ - public static final String DOMAIN_SYSTEM = "*S"; - - /** - * Constant representing the object domain value of "*U". - * @see #DOMAIN - **/ - public static final String DOMAIN_USER = "*U"; - - /** - * Object attribute representing the extended attribute - * that further describes the object, such as a program or file type. - * For example, an object type of *PGM may have a value - * of RPG (RPG program) or CLP (CL program); an object type - * of *FILE may have a value of PF (physical file), LF - * (logical file), DSPF (display file), SAVF (save file), and - * so on. - *

    Type: {@link java.lang.String String} - **/ - public static final int EXTENDED_ATTRIBUTE = 202; - - - // We don't use this, as it is only valid when retrieving attributes - // via ObjectList. Use getStatus() instead. - static final int INFORMATION_STATUS = 201; - - - /** - * Object attribute representing whether the object is - * currently being journaled or not. - *

    Type: {@link java.lang.Boolean Boolean} - **/ - public static final int JOURNAL_STATUS = 513; - - /** - * Object attribute representing the fully-qualified integrated - * file system path name of the journal. This field is blank if the object - * has never been journaled. - *

    Type: {@link java.lang.String String} - **/ - public static final int JOURNAL = 514; - static final int JOURNAL_LIBRARY = 515; - - /** - * Object attribute representing the type of images that are - * written to the journal receiver for updates to the object. - * This field is true if both before and after images are - * generated for changes to the object. - * This field is false if only after images are generated - * for changes to the object, or, if the object has never - * been journaled. - *

    Type: {@link java.lang.Boolean Boolean} - **/ - public static final int JOURNAL_IMAGES = 516; - - /** - * Object attribute representing whether journal entries - * to be omitted are journaled. - * This field is true if no - * entries are omitted; that is, all entries are journaled - * including open and close entries that would normally be - * omitted. - * This field is false if - * open and close operations do not generate open and close - * journal entries, or, if this object has never been journaled. - *

    Type: {@link java.lang.Boolean Boolean} - **/ - public static final int JOURNAL_OMITTED_ENTRIES = 517; - - /** - * Object attribute representing the time at which journaling - * for the object was last started. This field will contain - * Date value of 0 ms if the object has never been journaled. - *

    Type: {@link java.util.Date java.util.Date} - **/ - public static final int JOURNAL_START_DATE = 518; - - /** - * Object attribute representing the time at which the - * object was last used. This field will contain a Date - * value of 0 ms if the object has no last-used date. - *

    Type: {@link java.util.Date java.util.Date} - **/ - public static final int LAST_USED_DATE = 601; - - /** - * Object attribute representing the library of the object. - *

    Type: {@link java.lang.String String} - * @see #getLibrary - **/ - public static final int LIBRARY = 10001; - - /** - * Object attribute representing the name of the auxiliary - * storage pool (ASP) device where storage is allocated - * for the library containing the object. Special values - * include: - *

      - *
    • {@link #SYSTEM_OR_BASIC_ASP SYSTEM_OR_BASIC_ASP} - System - * ASP (1) or defined basic user ASPs (2-32). - *
    • {@link #ASP_NAME_UNKNOWN ASP_NAME_UNKNOWN} - The name of - * the ASP device cannot be determined. - *
    - *

    Type: {@link java.lang.String String} - * @see #LIBRARY_ASP_NUMBER - * @see #OBJECT_ASP_NUMBER - * @see #OBJECT_ASP_DEVICE_NAME - **/ - public static final int LIBRARY_ASP_DEVICE_NAME = 606; - - /** - * Object attribute representing the number of the auxiliary - * storage pool (ASP) where storage is allocated for the library - * containing the object. Valid values are: - *

      - *
    • 1: System ASP - *
    • 2-32: Basic user ASP - *
    • 33-255: Primary or secondary ASP - *
    - *

    Type: {@link java.lang.Integer Integer} - * @see #LIBRARY_ASP_DEVICE_NAME - * @see #OBJECT_ASP_NUMBER - * @see #OBJECT_ASP_DEVICE_NAME - **/ - public static final int LIBRARY_ASP_NUMBER = 314; - - /** - * Constant representing the value *LIBL. - **/ - public static final String LIBRARY_LIST = "*LIBL"; - - /** - * Object attribute representing the licensed program of the object. - * This field is null if the object does not belong to a licensed - * program. - *

    Type: {@link Product Product} - **/ - public static final int LICENSED_PROGRAM = 411; - - /** - * Object attribute representing the name of the object. - *

    Type: {@link java.lang.String String} - * @see #getName - **/ - public static final int NAME = 10000; - - /** - * Object attribute representing the name of the auxiliary - * storage pool (ASP) device where storage is allocated - * for the object. Special values include: - *

      - *
    • {@link #SYSTEM_OR_BASIC_ASP SYSTEM_OR_BASIC_ASP} - System - * ASP (1) or defined basic user ASPs (2-32). - *
    • {@link #ASP_NAME_UNKNOWN ASP_NAME_UNKNOWN} - The name of - * the ASP device cannot be determined. - *
    - *

    Type: {@link java.lang.String String} - * @see #OBJECT_ASP_NUMBER - * @see #LIBRARY_ASP_DEVICE_NAME - * @see #LIBRARY_ASP_NUMBER - **/ - public static final int OBJECT_ASP_DEVICE_NAME = 605; - - /** - * Object attribute representing the number of the auxiliary - * storage pool (ASP) where storage is allocated for the object. - * Valid values are: - *

      - *
    • 1: System ASP - *
    • 2-32: Basic user ASP - *
    • 33-255: Primary or secondary ASP - *
    - *

    Type: {@link java.lang.Integer Integer} - * @see #OBJECT_ASP_DEVICE_NAME - * @see #LIBRARY_ASP_DEVICE_NAME - * @see #LIBRARY_ASP_NUMBER - **/ - public static final int OBJECT_ASP_NUMBER = 301; - - /** - * Object attribute representing the object control level - * for the created object. - *

    Type: {@link java.lang.String String} - **/ - public static final int OBJECT_LEVEL = 409; - - /** - * Object attribute representing the size of the object - * in bytes. - *

    Type: {@link java.lang.Long Long} - **/ - public static final int OBJECT_SIZE = 701; - static final int OBJECT_SIZE_MULTIPLIER = 702; - - /** - * Object attribute representing the order in which the library - * appears in the entire library list. If the library is in the - * list more than once, the order of the first occurrence of - * the library is returned. If the library is not in the library - * list, 0 is returned. - *

    Note that this field can only be retrieved via the ObjectList - * class. If {@link #getValue getValue()} is called and this field was not retrieved - * via an ObjectList, -1 is returned. - *

    Type: {@link java.lang.Integer Integer} - **/ - public static final int ORDER_IN_LIBRARY_LIST = 205; // ObjectList only - - /** - * Object attribute representing whether the object overflowed - * the auxiliary storage pool (ASP). - * Note that it is not possible for objects that reside in the system ASP, - * a primary ASP, or a secondary ASP to overflow the ASP. - *

    Type: {@link java.lang.Boolean Boolean} - **/ - public static final int OVERFLOWED_ASP = 703; - - /** - * Object attribute representing the name of the object - * owner's user profile. - *

    Type: {@link java.lang.String String} - **/ - public static final int OWNER = 302; - - /** - * Object attribute representing the name of the primary group profile - * for the object. Special values include: - *

      - *
    • {@link #PRIMARY_GROUP_NONE PRIMARY_GROUP_NONE} - No primary group - * exists for the object. - *
    - *

    Type: {@link java.lang.String String} - **/ - public static final int PRIMARY_GROUP = 414; - - /** - * Constant representing a primary group of *NONE. - * @see #PRIMARY_GROUP - **/ - public static final String PRIMARY_GROUP_NONE = "*NONE"; - - /** - * Object attribute representing the number of the program temporary - * fix (PTF) number that caused this object to be replaced. This field - * is blank if the object was not changed because of a PTF. - *

    Type: {@link java.lang.String String} - **/ - public static final int PTF = 412; - - /** - * Object attribute representing the time the days-used count - * was last reset to 0. If the days-used count has never been - * reset, this field contains a Date value of 0 ms. - *

    Type: {@link java.util.Date java.util.Date} - * @see #DAYS_USED - **/ - public static final int RESET_DATE = 602; - - /** - * Object attribute representing the time at which the - * object was restored. This field will contain a Date - * value of 0 ms if the object has never been restored. - *

    Type: {@link java.util.Date java.util.Date} - **/ - public static final int RESTORE_DATE = 502; - - /** - * Object attribute representing the time the object was last - * saved when the SAVACT(*LIB, *SYSDFN, or *YES) save - * operation was specified. If the object has never been saved, - * or if SAVACT(*NO) was specified on the last save operation for - * the object, this field contains a Date value of 0 ms. - *

    Type: {@link java.util.Date java.util.Date} - **/ - public static final int SAVE_ACTIVE_DATE = 512; - - /** - * Object attribute representing the command used to save - * the object. This field is blank if the object was not saved. - *

    Type: {@link java.lang.String String} - **/ - public static final int SAVE_COMMAND = 506; - - /** - * Object attribute representing the time at which the - * object was saved. This field will contain a Date - * value of 0 ms if the object has never been saved. - *

    Type: {@link java.util.Date java.util.Date} - **/ - public static final int SAVE_DATE = 501; - - /** - * Object attribute representing the type of device to which the - * object was last saved. Possible values are: - *

      - *
    • {@link #SAVE_DEVICE_SAVE_FILE SAVE_DEVICE_SAVE_FILE} - The last save - * operation was to a save file. - *
    • {@link #SAVE_DEVICE_DISKETTE SAVE_DEVICE_DISKETTE} - The last save - * operation was to diskette. - *
    • {@link #SAVE_DEVICE_TAPE SAVE_DEVICE_TAPE} - The last save - * operation was to tape. - *
    • {@link #SAVE_DEVICE_OPTICAL SAVE_DEVICE_OPTICAL} - The last save - * operation was to optical. - *
    • {@link #SAVE_DEVICE_NOT_SAVED SAVE_DEVICE_NOT_SAVED} - The object - * was not saved. - *
    - *

    Type: {@link java.lang.String String} - **/ - public static final int SAVE_DEVICE = 508; - - /** - * Constant representing a save device of *DKT. - * @see #SAVE_DEVICE - **/ - public static final String SAVE_DEVICE_DISKETTE = "*DKT"; - - /** - * Constant representing no save device (blank). - * @see #SAVE_DEVICE - **/ - public static final String SAVE_DEVICE_NOT_SAVED = ""; - - /** - * Constant representing a save device of *OPT. - * @see #SAVE_DEVICE - **/ - public static final String SAVE_DEVICE_OPTICAL = "*OPT"; - - /** - * Constant representing a save device of *SAVF. - * @see #SAVE_DEVICE - **/ - public static final String SAVE_DEVICE_SAVE_FILE = "*SAVF"; - - /** - * Constant representing a save device of *TAP. - * @see #SAVE_DEVICE - **/ - public static final String SAVE_DEVICE_TAPE = "*TAP"; - - /** - * Object attribute representing the fully-qualified integrated file - * system path name of the save file to which the object was saved. - * This field is blank if the object was not saved to a save file. - *

    Type: {@link java.lang.String String} - **/ - public static final int SAVE_FILE = 509; - static final int SAVE_FILE_LIBRARY = 510; - - /** - * Object attribute representing the file label used when the object - * was saved. This field is blank if the object was not saved to tape, - * diskette, or optical. This field corresponds to the LABEL parameter - * on the command used to save the object. - *

    Type: {@link java.lang.String String} - **/ - public static final int SAVE_LABEL = 511; - - /** - * Object attribute representing the tape sequence number - * assigned when the object was saved on tape, or 0 - * if the object was not saved. - *

    Type: {@link java.lang.Integer Integer} - **/ - public static final int SAVE_SEQUENCE_NUMBER = 505; - - /** - * Object attribute representing the size of the object in - * bytes of storage at the time of the last save operation, - * or 0 if the object was not saved. - *

    Type: {@link java.lang.Long Long} - **/ - public static final int SAVE_SIZE = 503; - static final int SAVE_SIZE_MULTIPLIER = 504; - - /** - * Object attribute representing the tape, diskette, or optical - * volumes that are used for saving the object. This field returns - * a maximum of ten 6-character volumes. Each volume is separated - * by a single character. - *

    - * If the object was saved in parallel format, the separator character - * contains a 2 before the first volume in the second media file, a 3 - * before the third media file, and so on, up to a 0 before the tenth - * media file. Otherwise, the separator characters are blank. If more - * than ten volumes are used and the object was saved in serial format, - * 1 is returned in the 71st character of this field. - *

    - * The field is blank if the object was last saved to a save file or - * if it was never saved. - *

    Type: {@link java.lang.String String} - **/ - public static final int SAVE_VOLUME_ID = 507; - - /** - * Object attribute representing the fully-qualified integrated - * file system path name of the source file that was used to - * create the object. This field is blank if no source file was - * used to create the object. - *

    Type: {@link java.lang.String String} - **/ - public static final int SOURCE_FILE = 401; - static final int SOURCE_FILE_LIBRARY = 402; - static final int SOURCE_FILE_MEMBER = 403; - - /** - * Object attribute representing the time the member in the source - * file was last updated. This field is null if no source file - * created the object. - *

    Type: {@link java.util.Date java.util.Date} - * @see #SOURCE_FILE - **/ - public static final int SOURCE_FILE_UPDATED_DATE = 404; - - /** - * Constant representing a status of 'D' for the information in this - * object when generated by an ObjectList. - * @see #getStatus - **/ - public static final byte STATUS_DAMAGED = (byte)0xC4; // EBCDIC 'D' - - /** - * Constant representing a status of 'L' for the information in this - * object when generated by an ObjectList. - * @see #getStatus - **/ - public static final byte STATUS_LOCKED = (byte)0xD3; // EBCDIC 'L' - - /** - * Constant representing a status of 'A' for the information in this - * object when generated by an ObjectList. - * @see #getStatus - **/ - public static final byte STATUS_NO_AUTHORITY = (byte)0xC1; // EBCDIC 'A' - - /** - * Constant representing a status of ' ' for the information in this - * object when generated by an ObjectList. - * @see #getStatus - **/ - public static final byte STATUS_NO_ERRORS = (byte)0x40; // EBCDIC ' ' - - /** - * Constant representing a status of 'P' for the information in this - * object when generated by an ObjectList. - * @see #getStatus - **/ - public static final byte STATUS_PARTIALLY_DAMAGED = (byte)0xD7; // EBCDIC 'P' - - /** - * Constant representing an unknown status for the information in this - * object. - * @see #getStatus - **/ - public static final byte STATUS_UNKNOWN = (byte)0x00; // We didn't retrieve any attributes. - - /** - * Object attribute representing the storage status of the object. - * Possible values are: - *

      - *
    • {@link #STORAGE_STATUS_FREE STORAGE_STATUS_FREE} - Indicates - * the object data is freed and the object is suspended. - *
    • {@link #STORAGE_STATUS_KEEP STORAGE_STATUS_KEEP} - Indicates - * the object data is not freed and the object is not suspended. - *
    - *

    Type: {@link java.lang.String String} - **/ - public static final int STORAGE_STATUS = 306; - - /** - * Constant representing a storage status of *FREE. - * @see #STORAGE_STATUS - **/ - public static final String STORAGE_STATUS_FREE = "*FREE"; - - /** - * Constant representing a storage status of *FREE. - * @see #STORAGE_STATUS - **/ - public static final String STORAGE_STATUS_KEEP = "*KEEP"; - - /** - * Object attribute representing the level of the operating system - * when the object was created. This field has the format VvvRrrMmm - * where: - *

      - *
    • Vvv - The character 'V' followed by a 2-character version number. - *
    • Rrr - The character 'R' followed by a 2-character release level. - *
    • Mmm - The character 'M' followed by a 2-character modification level. - *
    - *

    Type: {@link java.lang.String String} - **/ - public static final int SYSTEM_LEVEL = 407; - - /** - * Constant indicating that the auxiliary storage pool device - * is the system ASP or a defined basic user ASP. - * @see #LIBRARY_ASP_DEVICE_NAME - * @see #OBJECT_ASP_DEVICE_NAME - **/ - public static final String SYSTEM_OR_BASIC_ASP = "*SYSBAS"; - - /** - * Object attribute representing the text description of the object. - * This field is blank if no text description is specified. - *

    Type: {@link java.lang.String String} - **/ - public static final int TEXT_DESCRIPTION = 203; - - /** - * Object attribute representing the type of the object. - *

    Type: {@link java.lang.String String} - * @see #getType - **/ - public static final int TYPE = 10002; - - /** - * Object attribute representing whether the object usage - * information is updated for this object type. - *

    Type: {@link java.lang.Boolean Boolean} - **/ - public static final int USAGE_INFO_UPDATED = 604; - - /** - * Object attribute representing whether the user program was changed. - * This field is true if the user changed the object; false if the object - * was not changed by the user. - *

    Type: {@link java.lang.Boolean Boolean} - **/ - public static final int USER_CHANGED = 410; - - /** - * Object attribute representing the characteristic of the object - * type. This field is set by the user while using the Change Object - * Description (QLICOBJD) API. - *

    Type: {@link java.lang.String String} - **/ - public static final int USER_DEFINED_ATTRIBUTE = 204; - - - - - // Holds the lengths for all of the keys. - static final IntegerHashtable keyLengths_ = new IntegerHashtable(); - static - { - keyLengths_.put(COMBINATION_200, 80); - keyLengths_.put(INFORMATION_STATUS, 1); - keyLengths_.put(EXTENDED_ATTRIBUTE, 10); - keyLengths_.put(TEXT_DESCRIPTION, 50); - keyLengths_.put(USER_DEFINED_ATTRIBUTE, 10); - keyLengths_.put(ORDER_IN_LIBRARY_LIST, 4); - keyLengths_.put(COMBINATION_300, 144); - keyLengths_.put(OBJECT_ASP_NUMBER, 4); - keyLengths_.put(OWNER, 10); - keyLengths_.put(DOMAIN, 2); - keyLengths_.put(CREATION_DATE, 8); - keyLengths_.put(CHANGE_DATE, 8); - keyLengths_.put(STORAGE_STATUS, 10); - keyLengths_.put(COMPRESSION, 1); - keyLengths_.put(ALLOW_CHANGE_BY_PROGRAM, 1); - keyLengths_.put(CHANGED_BY_PROGRAM, 1); - keyLengths_.put(AUDITING, 10); - keyLengths_.put(DIGITALLY_SIGNED, 1); - keyLengths_.put(DIGITALLY_SIGNED_TRUSTED, 1); - keyLengths_.put(DIGITALLY_SIGNED_MULTIPLE, 1); - keyLengths_.put(LIBRARY_ASP_NUMBER, 4); - keyLengths_.put(COMBINATION_400, 296); - keyLengths_.put(SOURCE_FILE, 10); - keyLengths_.put(SOURCE_FILE_LIBRARY, 10); - keyLengths_.put(SOURCE_FILE_MEMBER, 10); - keyLengths_.put(SOURCE_FILE_UPDATED_DATE, 13); - keyLengths_.put(CREATOR_USER_PROFILE, 10); - keyLengths_.put(CREATOR_SYSTEM, 8); - keyLengths_.put(SYSTEM_LEVEL, 9); - keyLengths_.put(COMPILER, 16); - keyLengths_.put(OBJECT_LEVEL, 8); - keyLengths_.put(USER_CHANGED, 1); - keyLengths_.put(LICENSED_PROGRAM, 16); - keyLengths_.put(PTF, 10); - keyLengths_.put(APAR, 10); - keyLengths_.put(PRIMARY_GROUP, 10); - keyLengths_.put(COMBINATION_500, 504); - keyLengths_.put(SAVE_DATE, 8); - keyLengths_.put(RESTORE_DATE, 8); - keyLengths_.put(SAVE_SIZE, 4); - keyLengths_.put(SAVE_SIZE_MULTIPLIER, 4); - keyLengths_.put(SAVE_SEQUENCE_NUMBER, 4); - keyLengths_.put(SAVE_COMMAND, 10); - keyLengths_.put(SAVE_VOLUME_ID, 71); - keyLengths_.put(SAVE_DEVICE, 10); - keyLengths_.put(SAVE_FILE, 10); - keyLengths_.put(SAVE_FILE_LIBRARY, 10); - keyLengths_.put(SAVE_LABEL, 17); - keyLengths_.put(SAVE_ACTIVE_DATE, 8); - keyLengths_.put(JOURNAL_STATUS, 1); - keyLengths_.put(JOURNAL, 10); - keyLengths_.put(JOURNAL_LIBRARY, 10); - keyLengths_.put(JOURNAL_IMAGES, 1); - keyLengths_.put(JOURNAL_OMITTED_ENTRIES, 1); - keyLengths_.put(JOURNAL_START_DATE, 8); - keyLengths_.put(COMBINATION_600, 548); - keyLengths_.put(LAST_USED_DATE, 8); - keyLengths_.put(RESET_DATE, 8); - keyLengths_.put(DAYS_USED, 4); - keyLengths_.put(USAGE_INFO_UPDATED, 1); - keyLengths_.put(OBJECT_ASP_DEVICE_NAME, 10); - keyLengths_.put(LIBRARY_ASP_DEVICE_NAME, 10); - keyLengths_.put(COMBINATION_700, 560); - keyLengths_.put(OBJECT_SIZE, 4); - keyLengths_.put(OBJECT_SIZE_MULTIPLIER, 4); - keyLengths_.put(OVERFLOWED_ASP, 1); - } - - private AS400 system_; - private QSYSObjectPathName path_; - private String aspSearchType_ = ASP_SEARCH_TYPE_ASP; // @550A - private byte status_; - private transient AS400Timestamp timestampConverter_; - - private final JobHashtable values_ = new JobHashtable(); - - - /** - * Constructs an ObjectDescription given the specified path to the object. - * @param system The system. - * @param path The fully-qualified integrated file system path to the object. - * Special values for the library portion of the path include %CURLIB% and - * %LIBL%. Only external object types are allowed for the object type. - * Consider using {@link QSYSObjectPathName QSYSObjectPathName} to compose - * the fully-qualified path string, - * or using {@link #ObjectDescription(AS400,QSYSObjectPathName) ObjectDescription(AS400,QSYSObjectPathName)} instead. - **/ - public ObjectDescription(AS400 system, String path) - { - this(system, new QSYSObjectPathName(path)); - } - - - /** - * Constructs an ObjectDescription given the specified path to the object. - * @param system The system. - * @param path The fully-qualified integrated file system path to the object. - **/ - public ObjectDescription(AS400 system, QSYSObjectPathName path) - { - if (system == null) throw new NullPointerException("system"); - if (path == null) throw new NullPointerException("path"); - system_ = system; - path_ = path; - } - - /** - * Constructs an ObjectDescription given the object's library, name, and type. - * @param system The system. - * @param objectLibrary The library. Special values include: - *

      - *
    • {@link #CURRENT_LIBRARY CURRENT_LIBRARY} - The current library is searched for the object. - *
    • {@link #LIBRARY_LIST LIBRARY_LIST} - The library list is searched for the object. - *
    - * @param objectName The name of the object. Wildcards are not allowed. - * @param objectType The type of the object, e.g. "FILE". Only external object types are allowed. - **/ - public ObjectDescription(AS400 system, String objectLibrary, String objectName, String objectType) - { - if (system == null) throw new NullPointerException("system"); - if (objectLibrary == null) throw new NullPointerException("library"); - if (objectName == null) throw new NullPointerException("name"); - if (objectType == null) throw new NullPointerException("type"); - system_ = system; - path_ = new QSYSObjectPathName(objectLibrary, objectName, objectType); // Verify valid values. - } - - // @550A - /** - * Constructs an ObjectDescription given the object's library, name, and type. - * @param system The system. - * @param objectLibrary The library. Special values include: - *
      - *
    • {@link #CURRENT_LIBRARY CURRENT_LIBRARY} - The current library is searched for the object. - *
    • {@link #LIBRARY_LIST LIBRARY_LIST} - The library list is searched for the object. - *
    - * @param objectName The name of the object. Wildcards are not allowed. - * @param objectType The type of the object, e.g. "FILE". Only external object types are allowed. - * @param aspDeviceName The name of an auxiliary storage pool (ASP) device in which storage is - * allocated for the library that contains the object or one of the following special values: - *
      - *
    • {@link #ASP_NAME_ALL ASP_NAME_ALL} - The ASPs in the thread's library name space.
    • - *
    • {@link #ASP_NAME_ALLAVL ASP_NAME_ALLAVL} - The system ASP (ASP 1) and defined basic user ASPs (ASPs 2-32).
    • - *
    • {@link #ASP_NAME_CURASPGRP ASP_NAME_CURASPGRP} - The ASPs in the current thread's ASP group.
    • - *
    • {@link #ASP_NAME_SYSBAS ASP_NAME_SYSBAS} - All available ASPs.
    • - *
    - **/ - public ObjectDescription(AS400 system, String objectLibrary, String objectName, String objectType, String aspDeviceName) - { - if (system == null) throw new NullPointerException("system"); - if (objectLibrary == null) throw new NullPointerException("library"); - if (objectName == null) throw new NullPointerException("name"); - if (objectType == null) throw new NullPointerException("type"); - system_ = system; - path_ = new QSYSObjectPathName(objectLibrary, objectName, objectType); // Verify valid values. - if (aspDeviceName != null && aspDeviceName.length() != 0) { - try { path_.setAspName(aspDeviceName); } catch (PropertyVetoException e) {} // can't happen - } - } - - /** - * Package scope constructor used by ObjectList. - **/ - ObjectDescription(AS400 sys, String lib, String name, String type, byte status) - { - system_ = sys; - path_ = new QSYSObjectPathName(lib, name, type); // Verify valid values. - status_ = status; - } - - // @550A - /** - * Package scope constructor used by ObjectList. - **/ - ObjectDescription(AS400 sys, String lib, String name, String type, byte status, String aspDeviceName, String aspSearchType) - { - system_ = sys; - path_ = new QSYSObjectPathName(lib, name, type); // Verify valid values. - status_ = status; - if (aspDeviceName != null && aspDeviceName.length() != 0) { - try { path_.setAspName(aspDeviceName); } catch (PropertyVetoException e) {} // can't happen - } - aspSearchType_ = aspSearchType; - } - - /** - * Indicates whether some other object is "equal to" this one. - * @param obj The reference object with which to compare. - * @return true if this object is the same as the obj argument; false otherwise. - **/ - public boolean equals(Object obj) - { - try - { - if (obj == null) return false; - ObjectDescription otherObj = (ObjectDescription)obj; - if (!otherObj.getSystem().getSystemName().equals(system_.getSystemName())) return false; - if (!otherObj.getLibrary().equals(getLibrary())) return false; - if (!otherObj.getName().equals(getName())) return false; - if (!otherObj.getType().equals(getType())) return false; - return true; - } - catch (Exception e) { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, e); - return false; - } - } - - /** - Returns a hash code value for the object. - @return A hash code value for this object. - **/ - public int hashCode() - { - // We must conform to the invariant that equal objects must have equal hashcodes. - int hash = - system_.getSystemName().hashCode() + - getLibrary().hashCode() + - getName().hashCode() + - getType().hashCode(); - - return hash; - } - - /** - * Checks to see if this object currently exists on the system. - * @return true if the object exists; false if the object or library do not exist. - * @exception ObjectDoesNotExistException If the system API that retrieves object information is missing. - **/ - public boolean exists() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - try - { - // Retrieve an arbitrary attribute that's a field in the 0100 (smallest) format. - retrieve(DOMAIN); - } - catch(AS400Exception e) - { - String id = e.getAS400Message().getID().trim(); - if (id.equalsIgnoreCase("CPF9801") || // Object &2 in library &3 not found. - id.equalsIgnoreCase("CPF9810") || // Library &1 not found. - id.equalsIgnoreCase("CPF9811") || // Program &1 in library &2 not found. @A1A - id.equalsIgnoreCase("CPF9812") || // File &1 in library &2 not found. - id.equalsIgnoreCase("CPF9814")) // Device &1 not found. - { - return false; - } - throw e; - } - return true; - } - - /** - * Helper method used to parse one of the attributes that are dates. - **/ - private final Date getDate(Object o) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (o instanceof String) - { - String str = ((String)o).trim(); - switch (str.length()) - { - case 7: - Calendar c = Calendar.getInstance(); - c.clear(); - c.set(Integer.parseInt(str.substring(0,3)) + 1900,// year - Integer.parseInt(str.substring(3,5))-1, // month is zero based - Integer.parseInt(str.substring(5,7))); // day - return c.getTime(); - case 13: - c = Calendar.getInstance(); - c.clear(); - c.set(Integer.parseInt(str.substring(0,3)) + 1900,// year - Integer.parseInt(str.substring(3,5))-1, // month is zero based - Integer.parseInt(str.substring(5,7)), // day - Integer.parseInt(str.substring(7,9)), // hour - Integer.parseInt(str.substring(9,11)), // minute - Integer.parseInt(str.substring(11,13))); // second - return c.getTime(); - default: - return null; - } - } - else if (o instanceof byte[]) - { - byte[] b = (byte[])o; // system timestamp - AS400Timestamp conv = getTimestampConverter(FORMAT_DTS); // field is in *DTS format - return conv.toDate(conv.toTimestamp(b), system_.getTimeZone()); - } - return null; - } - - - /** - * Returns the library of this object. - * @return The object library. Never null. - **/ - public String getLibrary() - { - return path_.getLibraryName(); - } - - - /** - * Returns the name of this object. - * @return The object name. Never null. - **/ - public String getName() - { - return path_.getObjectName(); - } - - //@550A - /** - * Returns the name of an auxiliary storage pool (ASP) device in which storage is - * allocated for the library that contains the object. - * @return The auxiliary storage pool (ASP) device name or null if no ASP device name has been set. - */ - public String getAspDeviceName() - { - return path_.getAspName(); - } - - //@550A - /** - * Returns the type of search to be used withn a specific auxiliary storage pool - * device name is specified. - * @return The search type. - */ - public String getAspSearchType(){ - return aspSearchType_; - } - - /** - * Returns the fully-qualified integrated file system path name of this object. - * @return The object path name. Never null. - **/ - public String getPath() - { - return path_.getPath(); - } - - - /** - * Returns the status of the information returned in this object - * if it was generated by an {@link ObjectList ObjectList}. - * @return The status. - * Possible values are: - *
      - *
    • {@link #STATUS_NO_ERRORS STATUS_NO_ERRORS} - The requested - * attribute information was returned. No errors occurred. - *
    • {@link #STATUS_NO_AUTHORITY STATUS_NO_AUTHORITY} - No information - * was returned because the job did not have the authority specified - * in the object authorities field of the object. - *
    • {@link #STATUS_DAMAGED STATUS_DAMAGED} - The requested attribute - * information was returned, but the object is damaged and should be - * recreated as soon as possible. - *
    • {@link #STATUS_LOCKED STATUS_LOCKED} - No information was - * returned because the object is locked. - *
    • {@link #STATUS_PARTIALLY_DAMAGED STATUS_PARTIALLY_DAMAGED} - The - * requested information was returned, but the object is partially - * damaged. - *
    - * If two or more conditions occur that include STATUS_NO_AUTHORITY, - * the status is set to STATUS_NO_AUTHORITY. If the object is locked and either - * damaged or partially damaged, the status is set to STATUS_LOCKED. - *

    If the status returned is either STATUS_NO_AUTHORITY or - * STATUS_LOCKED, no attribute information will have been collected - * by ObjectList, so any call to {@link #getValue getValue()} will result in another - * call to the system, where an exception is likely to occur (because - * of the lack of authority, for example). Only the object name, library, - * and type are valid in this case. - **/ - public byte getStatus() - { - return status_; - } - - - /** - * Returns the system. - * @return The system. Never null. - **/ - public AS400 getSystem() - { - return system_; - } - - - private static final int FORMAT_DTS = AS400Timestamp.FORMAT_DTS; // *DTS format - private synchronized AS400Timestamp getTimestampConverter(int format) - { - if (timestampConverter_ == null) { - timestampConverter_ = new AS400Timestamp(); - timestampConverter_.setFormat(format); - } - else if (format != timestampConverter_.getFormat()) { - timestampConverter_.setFormat(format); - } - return timestampConverter_; - } - - - /** - * Returns the type of this object. - * @return The object type. Never null. - **/ - public String getType() - { - return path_.getObjectType(); - } - - - /** - * Returns the value of the given attribute of this ObjectDescription. If the value is not found, - * it is retrieved from the system. The values are cached. - *

    - * Performance hint: If multiple attribute values are to be retrieved for a - * single ObjectDescription, first call {@link #refresh refresh()} to retrieve - * (and cache) all of the known attributes of this object from the system. - * @param attribute One of the attribute constants. - * @return The value for the attribute, or null if one was not found. - * @exception ObjectDoesNotExistException If the system API that retrieves object information is missing. - **/ - public Object getValue(int attribute) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - switch (attribute) - { - case NAME: - return getName(); - case LIBRARY: - return getLibrary(); - case TYPE: - return getType(); - } - Object o = values_.get(attribute); - if (o == null) - { - if (attribute == ORDER_IN_LIBRARY_LIST) - { - // Can only retrieve this via ObjectList - return new Integer(-1); - } - - retrieve(attribute); - o = values_.get(attribute); - } - try { - switch (attribute) - { - case CREATION_DATE: - case CHANGE_DATE: - case SOURCE_FILE_UPDATED_DATE: - case SAVE_DATE: - case RESTORE_DATE: - case RESET_DATE: - case SAVE_ACTIVE_DATE: - case JOURNAL_START_DATE: - case LAST_USED_DATE: - return getDate(o); - case JOURNAL: - String name = (String)o; - if (name.length() > 0) - { - String lib = (String)getValue(JOURNAL_LIBRARY); - return QSYSObjectPathName.toPath(lib, name, "JRN"); - } - return name; - case SAVE_FILE: - String name2 = (String)o; - if (name2.length() > 0) - { - String lib2 = (String)getValue(SAVE_FILE_LIBRARY); - return QSYSObjectPathName.toPath(lib2, name2, "SAVF"); - } - return name2; - case SOURCE_FILE: - String name3 = (String)o; - if (name3.length() > 0) - { - String lib3 = (String)getValue(SOURCE_FILE_LIBRARY); - String member = (String)getValue(SOURCE_FILE_MEMBER); - return QSYSObjectPathName.toPath(lib3, name3, member, "MBR"); - } - return name3; - case OBJECT_SIZE: - long multi = ((Integer)getValue(OBJECT_SIZE_MULTIPLIER)).longValue(); - long size = ((Integer)o).longValue(); - return new Long(multi*size); - case SAVE_SIZE: - long multi2 = ((Integer)getValue(SAVE_SIZE_MULTIPLIER)).longValue(); - long size2 = ((Integer)o).longValue(); - return new Long(multi2*size2); - case LICENSED_PROGRAM: - case COMPILER: - // pppppppVvvRrrMmm -- For example: "5761SS1V06R01M00" - String lpp = (String)o; - if (lpp.length() == 0) return null; - else if (lpp.length() < 16) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Disregarding COMPILER attribute value in nonstandard format: " + lpp); - return null; - } - else - { - String prodID = lpp.substring(0,7); - StringBuffer release = new StringBuffer(6); - release.append('V'); - release.append(Integer.parseInt(lpp.substring(8,10))); - release.append('R'); - release.append(Integer.parseInt(lpp.substring(11,13))); - release.append('M'); - release.append(Integer.parseInt(lpp.substring(14,16))); - return new Product(system_, prodID, Product.PRODUCT_OPTION_BASE, release.toString(), Product.PRODUCT_FEATURE_CODE); - } - case USER_CHANGED: - case ALLOW_CHANGE_BY_PROGRAM: - case CHANGED_BY_PROGRAM: - case OVERFLOWED_ASP: - case JOURNAL_STATUS: - case JOURNAL_IMAGES: - case DIGITALLY_SIGNED: - case DIGITALLY_SIGNED_TRUSTED: - case DIGITALLY_SIGNED_MULTIPLE: - return new Boolean (((String)o).charAt(0) == '1'); - case USAGE_INFO_UPDATED: - return new Boolean (((String)o).charAt(0) == 'Y'); - case JOURNAL_OMITTED_ENTRIES: - return new Boolean(((String)o).charAt(0) == '0'); - - default: - return o; - } - } - catch (NumberFormatException e) - { - Trace.log(Trace.ERROR, "Invalid number conversion for attribute " + attribute, e); - throw new InternalErrorException(InternalErrorException.UNKNOWN, e.getMessage()); - } - } - - - /** - * Returns the value of the given attribute of this ObjectDescription, as a String. If the value is not found, - * it is retrieved from the system. The values are cached. - *

    - * Performance hint: If multiple attribute values are to be retrieved for a - * single ObjectDescription, first call {@link #refresh refresh()} to retrieve - * (and cache) all of the known attributes of this object from the system. - * @param attribute One of the attribute constants. - * @return The value for the attribute, or null if one was not found. - * @exception ObjectDoesNotExistException If the system API that retrieves object information is missing. - **/ - public String getValueAsString(int attribute) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (attribute == COMPILER) - { - // Either "", "pppppppVvvRrrMmm", or a 6- or 7-digit number in the format "wwmmdd" or "wwwmmdd", where ww = the week number (www = week# *10), mm = month and dd = day. - Object o = values_.get(attribute); - if (o == null) - { - if (attribute == ORDER_IN_LIBRARY_LIST) - { - // Can only retrieve this via ObjectList - return "-1"; - } - - retrieve(attribute); - o = values_.get(attribute); - } - String lpp = (String)o; - if (lpp.length() == 0) return null; - else return lpp; - } - else - { - Object value = getValue(attribute); - if (value == null) return null; - else if (value instanceof String) return (String)value; - else return value.toString(); - } - } - - - /** - Returns a list of all ObjectLockListEntry objects representing possible Object Locks on this ObjectDescription. -

    This method retrieves the list of locks from the system via a call to the List Object Locks (QWCLOBJL) API. - Note: The QWCLOBJL API is not thread safe. - @return An array of ObjectLockListEntry representing any Object Locks. If no locks are found, an empty array is returned. - @exception ObjectDoesNotExistException If the system API that retrieves object information is missing. - **/ - public ObjectLockListEntry[] getObjectLockList() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - final int systemCCSID = system_.getCcsid(); - CharConverter conv = new CharConverter(systemCCSID); - String aspDeviceName = getAspDeviceName(); - - ProgramParameter[] parms = new ProgramParameter[(aspDeviceName.length() == 0) ? 6 : 9]; // Allow optional parameters if ASP device name is set - - parms[0] = new ProgramParameter(conv.stringToByteArray(USERSPACE_NAME)); //Qualified user space name - parms[1] = new ProgramParameter(conv.stringToByteArray(FORMAT_NAME)); // Format Name - String objectNameBuff = path_.toQualifiedObjectName(); // [10-char objectName] + [10-char libraryName] - parms[2] = new ProgramParameter(conv.stringToByteArray(objectNameBuff)); // Qualified Object Name (10-ObjectName 10- Library) - - StringBuffer objTypeBuff = new StringBuffer("* "); // initialize to 10 blanks (with preceding asterisk) - objTypeBuff.replace(1, getType().length(), getType()); - parms[3] = new ProgramParameter(conv.stringToByteArray(objTypeBuff.toString())); // Object type - - parms[4] = new ProgramParameter(conv.stringToByteArray("*NONE ")); // Member Name - parms[5] = errorCode_; - - if(parms.length == 9) // Add Optional parameters - { - parms[6] = new ProgramParameter(conv.stringToByteArray("")); // Optional parm - pathName (Leave blank, so ignored) - parms[7] = new ProgramParameter(BinaryConverter.intToByteArray(0)); // Optional parm - pathNameLength - StringBuffer aspDeviceNameBuff = new StringBuffer(" "); // ASP name - initialize to 10 blanks - aspDeviceNameBuff.replace(0, aspDeviceName.length(), aspDeviceName); - parms[8] = new ProgramParameter(conv.stringToByteArray(aspDeviceNameBuff.toString())); // Optional parm - Qualified ASP Name - } - - // QWCLOBJL is the API used to get the list of object locks into a user space. - // Note: QWCLOBJL is not documented to be thread-safe. - // But if the user has indicated they want all programs to be called on-thread - // (by setting the ProgramCall.threadSafe property), we will do as they wish. - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QWCLOBJL.PGM", parms); - // Note: The called API is not thread-safe. - - // Determine the needed scope of synchronization. - Object lockObject; - boolean willRunProgramsOnThread = pc.isStayOnThread(); - if (willRunProgramsOnThread) { - // The calls will run in the job of the JVM, so lock for entire JVM. - lockObject = USERSPACE_PATH; - } - else { - // The calls will run in the job of the Remote Command Host Server, so lock on the connection. - lockObject = system_; - } - - byte[] buf = null; - - synchronized (lockObject) - { - // Create a user space in QTEMP to receive output. - UserSpace space = new UserSpace(system_, USERSPACE_PATH); - space.setMustUseProgramCall(true); // need to use same job as the ProgramCall object - if (!willRunProgramsOnThread) - { - space.setMustUseSockets(true); - // Force the use of sockets when running natively but not on-thread. - // We have to do it this way since UserSpace will otherwise make a native ProgramCall, and will use a different QTEMP library than that used by the host server. - } - - try - { - space.create(256*1024, true, "", (byte)0, "User space for UserObjectsOwnedList", "*EXCLUDE"); - // Note: User Spaces by default are auto-extendible (by QUSCRTUS API) - // So it will always have enough space available. - // Allocated 256K bytes as a reasonable initial size (1500+ entries) - - if (!pc.run()) { - throw new AS400Exception(pc.getMessageList()); - } - - // Get the results from the user space. - int size = space.getLength(); - if (size < 144) // Size of General header info that we are interested in - { - Trace.log(Trace.ERROR, "User Space size is too small (" + size + ")"); - throw new InternalErrorException(InternalErrorException.UNKNOWN, size); - } - buf = new byte[size]; - space.read(buf, 0); - } - - finally { - // Delete the temporary user space, to allow other threads to re-create and use it. - try { space.delete(); } - catch (Exception e) { - Trace.log(Trace.ERROR, "Exception while deleting temporary user space", e); - } - } - } - - // -------------------------------------------------------------------------------------------- - // QWCLOBJL (List Object Locks) is a "list" API. - // It puts the list of lock information in a user space. In addition, to the QWCLOBJL documentation, - // the developer must refer to additional documentation describing the data returned: - // - User spaces: List APIs return data to user spaces. To provide a consistent design and - // use of user space objects, the list APIs use a general data structure. - // - General data structure & Common data structure format (General header format 0100) - // - This format in info center describes the general header format (referenced in the - // code below). - // - This information is/was documented in info center under the following: - // - Programming -> API Concepts -> User spaces and receiver variables -> User spaces - // -------------------------------------------------------------------------------------------- - // Parse the list data returned in the user space. - - //int headerOffset = BinaryConverter.byteArrayToInt(buf, 116); // General header - Offset to header section - int startingOffset = BinaryConverter.byteArrayToInt(buf, 124); // General header - Offset to list data section - int numEntries = BinaryConverter.byteArrayToInt(buf, 132); // General header - Number of list entries - int entrySize = BinaryConverter.byteArrayToInt(buf, 136); // General header - Size of each entry - int entryCCSID = BinaryConverter.byteArrayToInt(buf, 140); // General header - CCSID of data in the list entries - //String subsettedListIndicator = conv.byteArrayToString(buf, 149, 1); // General header - Subsetted list indicator - String informationStatus = conv.byteArrayToString(buf, 103, 1); // General header - info status - // informationStatus - 'C'=Complete, 'I'=Incomplete, 'P'=Partial - - if (entryCCSID == 0) entryCCSID = systemCCSID; // From the API spec: "The coded character set ID for data in the list entries. If 0, then the data is not associated with a specific CCSID and should be treated as hexadecimal data." - conv = new CharConverter(entryCCSID); - - String jobName, jobUserName, jobNumber, lockState, memberName, share, lockScope; - int lockStatus, lockType; - long threadID; - - // ----------------------------------------------------------------------------------------- - // Extract fields from the QWCLOBJL Specific Header - // ----------------------------------------------------------------------------------------- - //String userSpaceNameUsed = conv.byteArrayToString(buf, headerOffset+0, 10).trim(); // QWCLOBJL Specific Header - UserSpaceName - //String userSpaceLibaryNameUsed= conv.byteArrayToString(buf, headerOffset+10, 10).trim(); // QWCLOBJL Specific Header - UserSpaceLibraryName - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "ObjectDescription.getObjectLockList() informationStatus='"+informationStatus+"' "+"' numEntries='"+numEntries+"'"); - - ObjectLockListEntry[] entries = new ObjectLockListEntry[numEntries]; - - try { - // Extract the fields from each entry in the list - int offset = startingOffset; - for (int i=0; i 2GB, we need the save size in units & multiplier. - case LAST_USED_DATE: - case USAGE_INFO_UPDATED: - case DAYS_USED: - case OBJECT_SIZE: - case OBJECT_SIZE_MULTIPLIER: - case COMPRESSION: - case ALLOW_CHANGE_BY_PROGRAM: - case CHANGED_BY_PROGRAM: - case USER_DEFINED_ATTRIBUTE: - case OVERFLOWED_ASP: - case SAVE_ACTIVE_DATE: - case AUDITING: - case PRIMARY_GROUP: - case JOURNAL_STATUS: - case JOURNAL: - case JOURNAL_LIBRARY: - case JOURNAL_IMAGES: - case JOURNAL_OMITTED_ENTRIES: - case JOURNAL_START_DATE: - case DIGITALLY_SIGNED: - //case SAVE_SIZE_UNITS: - case SAVE_SIZE_MULTIPLIER: - case LIBRARY_ASP_NUMBER: - case OBJECT_ASP_DEVICE_NAME: - case LIBRARY_ASP_DEVICE_NAME: - case DIGITALLY_SIGNED_TRUSTED: - case DIGITALLY_SIGNED_MULTIPLE: - return 400; - default: - throw new ExtendedIllegalArgumentException("attribute", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - - private static final int lookupSize(int format) - { - switch (format) - { - case 100: - return 90; - case 200: - return 180; - case 300: - return 460; - case 400: - return 598; - default: - return 0; - } - } - - - /** - * Retrieves all possible attributes of this object from the system. - * @exception ObjectDoesNotExistException If the system API that retrieves object information is missing. - **/ - public void refresh() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(DIGITALLY_SIGNED_MULTIPLE); - } - - - /** - * This method makes the actual program call to retrieve the attributes. - **/ - private void retrieve(int attribute) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (system_ == null) throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - int ccsid = system_.getCcsid(); - ConvTable conv = ConvTable.getTable(ccsid, null); - String aspDeviceName = getAspDeviceName(); - - int format = lookupFormat(attribute); - int size = lookupSize(format); - AS400Text text10 = new AS400Text(10, ccsid, system_); - ProgramParameter[] parms = new ProgramParameter[(aspDeviceName.length() == 0) ? 5 : 7]; // @550C changed to allow seven parameters if asp device name is specified - parms[0] = new ProgramParameter(size); // receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(size)); // length of receiver variable - parms[2] = new ProgramParameter(conv.stringToByteArray("OBJD0"+format)); - String objectNameAndLibrary = path_.toQualifiedObjectName(); // [10-char objectName] + [10-char libraryName] - parms[3] = new ProgramParameter(conv.stringToByteArray(objectNameAndLibrary)); // object and library name - parms[4] = new ProgramParameter(text10.toBytes("*"+getType())); // object type - if(parms.length == 7) // @550A add error code and asp control parameters - { // @550A - parms[5] = new ProgramParameter(new byte[8]); // @550A Error Code - // Construct the ASP Control Format - byte[] controlFormat = new byte[24]; // @550A - System.arraycopy(BinaryConverter.intToByteArray(24), 0, controlFormat, 0, 4); // @550A - for(int i=4; i= 200) - { - set(EXTENDED_ATTRIBUTE, conv.byteArrayToString(data, 90, 10).trim()); - set(TEXT_DESCRIPTION, conv.byteArrayToString(data, 100, 50).trim()); - set(SOURCE_FILE, conv.byteArrayToString(data, 150, 10).trim()); - set(SOURCE_FILE_LIBRARY, conv.byteArrayToString(data, 160, 10).trim()); - set(SOURCE_FILE_MEMBER, conv.byteArrayToString(data, 170, 10).trim()); - } - if (format >= 300) - { - set(SOURCE_FILE_UPDATED_DATE, conv.byteArrayToString(data, 180, 13)); // date - set(SAVE_DATE, conv.byteArrayToString(data, 193, 13)); // date - set(RESTORE_DATE, conv.byteArrayToString(data, 206, 13)); // date - set(CREATOR_USER_PROFILE, conv.byteArrayToString(data, 219, 10).trim()); - set(CREATOR_SYSTEM, conv.byteArrayToString(data, 229, 8).trim()); - set(RESET_DATE, conv.byteArrayToString(data, 237, 7)); // date-7 - //set(SAVE_SIZE, (long)BinaryConverter.byteArrayToInt(data, 244)); // See 400 format section for more on save size. - set(SAVE_SEQUENCE_NUMBER, BinaryConverter.byteArrayToInt(data, 248)); - set(STORAGE_STATUS, conv.byteArrayToString(data, 252, 10).trim()); - set(SAVE_COMMAND, conv.byteArrayToString(data, 262, 10).trim()); - set(SAVE_VOLUME_ID, conv.byteArrayToString(data, 272, 71)); - set(SAVE_DEVICE, conv.byteArrayToString(data, 343, 10).trim()); - set(SAVE_FILE, conv.byteArrayToString(data, 353, 10).trim()); - set(SAVE_FILE_LIBRARY, conv.byteArrayToString(data, 363, 10).trim()); - set(SAVE_LABEL, conv.byteArrayToString(data, 373, 17).trim()); - set(SYSTEM_LEVEL, conv.byteArrayToString(data, 390, 9)); - set(COMPILER, conv.byteArrayToString(data, 399, 16).trim()); - set(OBJECT_LEVEL, conv.byteArrayToString(data, 415, 8).trim()); - set(USER_CHANGED, conv.byteArrayToString(data, 423, 1)); // '1' if the user changed the object, '0' if not. - set(LICENSED_PROGRAM, conv.byteArrayToString(data, 424, 16).trim()); - set(PTF, conv.byteArrayToString(data, 440, 10).trim()); - set(APAR, conv.byteArrayToString(data, 450, 10).trim()); - } - if (format >= 400) - { - set(LAST_USED_DATE, conv.byteArrayToString(data, 460, 7).trim()); - set(USAGE_INFO_UPDATED, conv.byteArrayToString(data, 467, 1)); // 'Y' was changed, 'N' was not. - set(DAYS_USED, BinaryConverter.byteArrayToInt(data, 468)); - set(OBJECT_SIZE, BinaryConverter.byteArrayToInt(data, 472)); - set(OBJECT_SIZE_MULTIPLIER, BinaryConverter.byteArrayToInt(data, 476)); - set(COMPRESSION, conv.byteArrayToString(data, 480, 1)); - set(ALLOW_CHANGE_BY_PROGRAM, conv.byteArrayToString(data, 481, 1)); // '1' means it can be changed by QLICOBJD, '0' means not. - set(CHANGED_BY_PROGRAM, conv.byteArrayToString(data, 482, 1)); // '1' means it has been changed by QLICOBJD, '0' means not. - set(USER_DEFINED_ATTRIBUTE, conv.byteArrayToString(data, 483, 10).trim()); - set(OVERFLOWED_ASP, conv.byteArrayToString(data, 493, 1)); // '1' means it overflowed the ASP it's in, '0' means not. - set(SAVE_ACTIVE_DATE, conv.byteArrayToString(data, 494, 13)); // date - set(AUDITING, conv.byteArrayToString(data, 507, 10).trim()); - set(PRIMARY_GROUP, conv.byteArrayToString(data, 517, 10).trim()); - set(JOURNAL_STATUS, conv.byteArrayToString(data, 527, 1)); // '1' means it is currently being journaled, '0' means not. - set(JOURNAL, conv.byteArrayToString(data, 528, 10).trim()); - set(JOURNAL_LIBRARY, conv.byteArrayToString(data, 538, 10).trim()); - set(JOURNAL_IMAGES, conv.byteArrayToString(data, 548, 1)); // '1' means both before and after images are generated, '0' means just after images. - set(JOURNAL_OMITTED_ENTRIES, conv.byteArrayToString(data, 549, 1)); // '0' means no entries are omitted (i.e. all entries are journaled), '1' means open/close ops don't generate entries, ' ' means object isn't journaled. - set(JOURNAL_START_DATE, conv.byteArrayToString(data, 550, 13).trim()); // date; will be blank of not journaled - set(DIGITALLY_SIGNED, conv.byteArrayToString(data, 563, 1)); // '1' means it has a digital signature, '0' means not. - set(SAVE_SIZE, BinaryConverter.byteArrayToInt(data, 564)); - set(SAVE_SIZE_MULTIPLIER, BinaryConverter.byteArrayToInt(data, 568)); - set(LIBRARY_ASP_NUMBER, BinaryConverter.byteArrayToInt(data, 572)); - set(OBJECT_ASP_DEVICE_NAME, conv.byteArrayToString(data, 576, 10).trim()); - set(LIBRARY_ASP_DEVICE_NAME, conv.byteArrayToString(data, 586, 10).trim()); - set(DIGITALLY_SIGNED_TRUSTED, conv.byteArrayToString(data, 596, 1)); // '1' means at least one signature came from a trusted source, '0' means none did. - set(DIGITALLY_SIGNED_MULTIPLE, conv.byteArrayToString(data, 597, 1)); // '1' means there is more than one signature, '0' means there is only one or no signatures. - } - } - - - void set(int attribute, int value) - { - values_.put(attribute, new Integer(value)); - } - - void set(int attribute, long value) - { - values_.put(attribute, new Long(value)); - } - - void set(int attribute, boolean value) - { - values_.put(attribute, new Boolean(value)); - } - - void set(int attribute, Object value) - { - values_.put(attribute, value); - } - - // @550A - /** - * Specifies the type of the search when a specific auxiliary storage pool device name - * is specified for the ASP device name. - * @param aspSearchType The type of search to be used. One of the following values may be specified: - *

      - *
    • {@link #ASP_SEARCH_TYPE_ASP ASP_SEARCH_TYPE_ASP} - Only the single ASP named will be searched.
    • - *
    • {@link #ASP_SEARCH_TYPE_ASPGRP ASP_SEARCH_TYPE_ASPGRP} - All ASPs in the auxiliary storage pool - * group named will be searched.
    • - *
    - * The default value is {@link #ASP_SEARCH_TYPE_ASP ASP_SEARCH_TYPE_ASP}. - * @exception ExtendedIllegalArgumentExceptiion if an invalid search type is specified. - */ - public void setAspSearchType(String aspSearchType) throws ExtendedIllegalArgumentException{ - if (aspSearchType == null) throw new NullPointerException("aspSearchType"); - if (!aspSearchType.equals(ASP_SEARCH_TYPE_ASP) && - !aspSearchType.equals(ASP_SEARCH_TYPE_ASPGRP)) - { - throw new ExtendedIllegalArgumentException("aspSearchType", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - aspSearchType_ = aspSearchType; - } - - /** - * Returns a String representation of this ObjectDescription. - * @return The object path name. - **/ - public String toString() - { - return getPath(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ObjectDescriptionEnumeration.java b/cvsroot/src/com/ibm/as400/access/ObjectDescriptionEnumeration.java deleted file mode 100644 index 7a6813e45..000000000 --- a/cvsroot/src/com/ibm/as400/access/ObjectDescriptionEnumeration.java +++ /dev/null @@ -1,81 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ObjectDescriptionEnumeration.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.*; - -/** - * Helper class. Used to wrap the ObjectDescription[] with an Enumeration. - * This class is used by ObjectList. -**/ -class ObjectDescriptionEnumeration implements Enumeration -{ - private ObjectDescription[] objectCache_; - private ObjectList list_; - private int counter_; // number of objects returned so far by nextElement() - private int numObjects_; - private int listOffset_ = 0; - private int cacheOffset_ = 0; - - ObjectDescriptionEnumeration(ObjectList list, int length) - { - list_ = list; - numObjects_ = length; - } - - public final boolean hasMoreElements() - { - return counter_ < numObjects_; - } - - public final Object nextElement() - { - if (counter_ >= numObjects_) - { - throw new NoSuchElementException(); - } - - if (objectCache_ == null || cacheOffset_ >= objectCache_.length) - { - try - { - objectCache_ = list_.getObjects(listOffset_, 1000); - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "Loaded next block in ObjectDescriptionEnumeration: "+objectCache_.length+" messages at list offset "+listOffset_+" out of "+numObjects_+" total."); - } - } - catch (Exception e) - { - if (Trace.traceOn_) - { - Trace.log(Trace.ERROR, "Exception while loading nextElement() in ObjectDescriptionEnumeration:", e); - } - throw new NoSuchElementException(); - } - - // We have a freshly loaded cache, so reset to the beginning of the cache. - cacheOffset_ = 0; - - // Set starting offset for next call to getObjects(), - // in case another call is needed. - listOffset_ += objectCache_.length; - } - ++counter_; - return objectCache_[cacheOffset_++]; - } -} - - - diff --git a/cvsroot/src/com/ibm/as400/access/ObjectDoesNotExistException.java b/cvsroot/src/com/ibm/as400/access/ObjectDoesNotExistException.java deleted file mode 100644 index 6a4ff4a79..000000000 --- a/cvsroot/src/com/ibm/as400/access/ObjectDoesNotExistException.java +++ /dev/null @@ -1,126 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ObjectDoesNotExistException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - - -package com.ibm.as400.access; - - - -/** - The ObjectDoesNotExistException class represents an exception - that indicates that a system object does not exist. -**/ -public class ObjectDoesNotExistException extends Exception - implements ReturnCodeException -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - - private int rc_; // Return code associated with this exception - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - - // Return code values used by this class. - // If a value is added here, it must also be added to MRI.properties. - - /** - The return code indicating that the library does not exist. - **/ - public static final int LIBRARY_DOES_NOT_EXIST = 1; - - /** - The return code indicating that the object does not exist. - **/ - public static final int OBJECT_DOES_NOT_EXIST = 2; - - - - - - /** - Constructs an ObjectDoesNotExistException object. - It indicates that a system object does not exist. - Exception message will look like this: Object does not exist. - @param returnCode The return code which identifies the message to be returned. - **/ - - ObjectDoesNotExistException(int returnCode) - { - // Create the message - super(loader_.getText(getMRIKey(returnCode))); - rc_ = returnCode; - } - - - - /** - Constructs an ObjectDoesNotExistException object. - It indicates that a system object does not exist. - Exception message will look like this: - dataQueue (/QSYS.LIB/MYLIB.LIB/MYQUEUE.DTAQ): Object does not exist. - @param objectName The object that does not exist. - It should be in the format: argumentName (value). - For example: dataQueue (mydataqueue). - @param returnCode The return code which identifies the message to be returned. - **/ - - ObjectDoesNotExistException(String objectName, int returnCode) - { - // Create the message - super(objectName + ": " + loader_.getText(getMRIKey(returnCode))); - rc_ = returnCode; - } - - - - - /** - Returns the text associated with the return code. - @param returnCode The return code associated with this exception. - @return The text string which describes the error. - **/ - // This method is required so the message can be created and sent in super() - static String getMRIKey (int returnCode) - { - switch(returnCode) - { - case LIBRARY_DOES_NOT_EXIST: - return "EXC_LIBRARY_DOES_NOT_EXIST"; - case OBJECT_DOES_NOT_EXIST: - return "EXC_OBJECT_DOES_NOT_EXIST"; - default: - return "EXC_UNKNOWN"; // Bad return code was provided. - } - } - - - - /** - Returns the return code associated with this exception. - @return The return code. - **/ - public int getReturnCode () - { - return rc_; - } - - - - -} // End of ObjectDoesNotExistException class diff --git a/cvsroot/src/com/ibm/as400/access/ObjectEvent.java b/cvsroot/src/com/ibm/as400/access/ObjectEvent.java deleted file mode 100644 index 867cefb85..000000000 --- a/cvsroot/src/com/ibm/as400/access/ObjectEvent.java +++ /dev/null @@ -1,47 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ObjectEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.EventObject; - -/** - The ObjectEvent class represents an Object event. - **/ -public class ObjectEvent extends EventObject -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - // The object closed event ID. - static final int OBJECT_CLOSED = 0; - - // The object created event ID. - static final int OBJECT_CREATED = 1; - - // The object deleted event ID. - static final int OBJECT_DELETED = 2; - - // The object opened event ID. - static final int OBJECT_OPENED = 3; - - /** - Constructs an ObjectEvent object. It uses the specified source. - @param source The object where the event originated. - **/ - public ObjectEvent(Object source) - { - super(source); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ObjectList.java b/cvsroot/src/com/ibm/as400/access/ObjectList.java deleted file mode 100644 index 03ad51510..000000000 --- a/cvsroot/src/com/ibm/as400/access/ObjectList.java +++ /dev/null @@ -1,1491 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ObjectList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @A1 - 07/24/2007 - Changes to addObjectAuthorityCriteria() to enforce -// documented interface restriction related to AUTH_ANY -// @A2 - 07/25/2007 - Changes to load() and getObjects() to obtain and use -// the correct recordLength for the records returned. -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.*; -import java.io.*; -import java.util.*; - - - -/** -Represents a list of system objects in a -specific library, multiple libraries, or system-wide. -

    -Implementation note: -This class internally uses the Open List APIs (e.g. QGYOLOBJ). - -@see com.ibm.as400.access.ObjectDescription -**/ -public class ObjectList implements Serializable -{ - static final long serialVersionUID = 5L; - - /** - * Selection value representing *ALL. - **/ - public static final String ALL = "*ALL"; - - /** - * Selection value representing *ALLUSR. - **/ - public static final String ALL_USER = "*ALLUSR"; - - /** - * Constant indicating that the auxiliary storage pools that are currently - * part of the the thread's library name space will be searched to locate - * the library. This includes the system ASP (ASP 1), all defined basic - * user ASPs (ASPs 2-32), and, if the thread has an ASP group, the primary - * and secondary ASPs in the thread's ASP group. - */ - public static final String ASP_NAME_ALL = "*"; // @550A - - /** - * Constant indicating that the system ASP (ASP 1) and all defined basic user ASPs (ASPs 2-32) - * will be searched to locate the library. No primary or secondary ASPs will be - * searched, even if the thread has an ASP group. - */ - public static final String ASP_NAME_SYSBAS = "*SYSBAS"; // @550A - - /** - * Constant indicating if the thread has an ASP group, the primary and secondary ASPs - * in the ASP group will be searched to locate the library. The system ASP (ASP 1) and - * defined basic user ASPs (ASPs 2-32) will not be searched. - */ - public static final String ASP_NAME_CURASPGRP = "*CURASPGRP"; // @550A - - /** - * Constant indicating that all available ASPs will be searched. This includes the system - * ASP (ASP 1), all defined basic user ASPs (ASPs 2-32), and all available primary and - * secondary ASPs (ASPs 33-255 with a status of 'Available'). The ASP groups are searched - * in alphabetical order by the primary ASP. The system ASP and all defined basic user - * ASPs are searched after the ASP groups. ASPs and libraries to which the user is not authorized - * are bypassed and no authority error messages are sent. The search ends when the first object - * is found of the specified object name, library name, and object type. If the user is - * not authorized to the object, an authority error message is sent. - */ - public static final String ASP_NAME_ALLAVL = "*ALLAVL"; // @550A - - /** - * Constant indicating that only the single ASP named in the auxiliary storage - * pool device name field will be searched. - */ - public static final String ASP_SEARCH_TYPE_ASP = "*ASP"; // @550A - - /** - * Constant indicating that all ASPs in the auxiliary storage pool group named - * in the auxiliary storage pool device name field will be searched. The device - * name must be the name of the primary auxiliary storage pool in the group. - */ - public static final String ASP_SEARCH_TYPE_ASPGRP = "*ASPGRP"; // @550A - - /** - * Selection value representing an authority of *ALL. - **/ - public static final String AUTH_ALL = "*ALL"; - - /** - * Selection value representing an authority of *ANY. - **/ - public static final String AUTH_ANY = "*ANY"; - - /** - * Selection value representing an authority of *CHANGE. - **/ - public static final String AUTH_CHANGE = "*CHANGE"; - - /** - * Selection value representing a data authority of *ADD. - **/ - public static final String AUTH_DATA_ADD = "*ADD"; - - /** - * Selection value representing a data authority of *DLT. - **/ - public static final String AUTH_DATA_DELETE = "*DLT"; - - /** - * Selection value representing a data authority of *EXECUTE. - **/ - public static final String AUTH_DATA_EXECUTE = "*EXECUTE"; - - /** - * Selection value representing a data authority of *READ. - **/ - public static final String AUTH_DATA_READ = "*READ"; - - /** - * Selection value representing a data authority of *UPD. - **/ - public static final String AUTH_DATA_UPDATE = "*UPD"; - - /** - * Selection value representing an authority of *AUTLMGT. - **/ - public static final String AUTH_LIST_MANAGEMENT = "*AUTLMGT"; - - /** - * Selection value representing an object authority of *OBJALTER. - **/ - public static final String AUTH_OBJECT_ALTER = "*OBJALTER"; - - /** - * Selection value representing an object authority of *OBJEXIST. - **/ - public static final String AUTH_OBJECT_EXISTENCE = "*OBJEXIST"; - - /** - * Selection value representing an object authority of *OBJMGT. - **/ - public static final String AUTH_OBJECT_MANAGEMENT = "*OBJMGT"; - - /** - * Selection value representing an object authority of *OBJOPR. - **/ - public static final String AUTH_OBJECT_OPERATIONAL = "*OBJOPR"; - - /** - * Selection value representing an object authority of *OBJREF. - **/ - public static final String AUTH_OBJECT_REFERENCE = "*OBJREF"; - - /** - * Selection value representing an authority of *USE. - **/ - public static final String AUTH_USE = "*USE"; - - /** - * Selection value representing *CURLIB. - **/ - public static final String CURRENT_LIBRARY = "*CURLIB"; - - /** - * Selection value representing *IBM. - **/ - public static final String IBM = "*IBM"; - - /** - * Selection value representing *LIBL. - **/ - public static final String LIBRARY_LIST = "*LIBL"; - - /** - * Selection value representing any status. - * @see #addObjectSelectionCriteria - **/ - public static final byte STATUS_ANY = (byte)0x5C; // EBCDIC '*' - - /** - * Selection value representing *USRLIBL. - **/ - public static final String USER_LIBRARY_LIST = "*USRLIBL"; - - - - - private static final byte BINARY = (byte)0xC2; // EBCDIC 'B' - private static final byte CHAR = (byte)0xC3; // EBCDIC 'C' - private static final byte STRUCT = (byte)0xE2; // EBCDIC 'S' - - private AS400 system_; - - private int length_; - private int recLen_; // Length of a single record; should never be zero for this API @A2A - private byte[] handle_; // handle that references the user space used by the open list APIs - private byte[] handleToClose_; // used to close a previously opened list - private boolean isConnected_; - - // Library authority criteria - private int currentLibAuthKey_ = 0; - private String[] libAuthKeys_ = new String[10]; - - // Library authority criteria - private int currentObjectAuthKey_ = 0; - private String[] objectAuthKeys_ = new String[11]; - - // Information status selection criteria - private int currentStatusKey_ = 0; - private byte[] statusKeys_ = new byte[5]; - private boolean statusSelection_ = true; - - // Attributes to retrieve - private int currentKey_ = 0; - private int[] keys_ = new int[1]; - - // Sort keys - private int currentSortKey_ = 0; - private int[] sortKeys_ = new int[1]; - private boolean[] sortOrders_ = new boolean[1]; - - private String objectName_; - private String objectLibrary_; - private String objectType_; - private String aspDeviceName_; // @550A - private String aspSearchType_ = ASP_SEARCH_TYPE_ASP; // @550A - - - /** - * Constructs an ObjectList object. The selection values default to: - *

      - *
    • Object library - {@link #ALL ALL} - *
    • Object name - {@link #ALL ALL} - *
    • Object type - {@link #ALL ALL} - *
    - * @param system The system. - **/ - public ObjectList(AS400 system) - { - this(system, ALL, ALL, ALL); - } - - - /** - * Constructs an ObjectList with the specified selection criteria. - * @param system The system. - * @param objectLibrary The library or set of libraries that are searched for objects. - * Valid values are a specific name, a generic name, or one of the following - * special values: - *
      - *
    • {@link #ALL ALL} - All libraries are searched. - *
    • {@link #ALL_USER ALL_USER} - All user libraries are searched. - *
    • {@link #CURRENT_LIBRARY CURRENT_LIBRARY} - The current library is searched. - *
    • {@link #LIBRARY_LIST LIBRARY_LIST} - The library list is searched. - *
    • {@link #USER_LIBRARY_LIST USER_LIBRARY_LIST} - The user portion of the library list is searched. - *
    - * @param objectName The object name. Valid values are a specific name, a generic - * name, or one of the following special values: - *
      - *
    • {@link #ALL ALL} - All object names are searched. - *
    • {@link #ALL_USER ALL_USER} - All objects that are libraries in QSYS or the - * library list are searched. The object library - * must either be {@link #LIBRARY_LIST LIBRARY_LIST} or QSYS. The object type - * must be *LIB. A list of user libraries is returned. - *
    • {@link #IBM IBM} - All objects that are libraries in QSYS or the library - * list are searched. The object library must either be {@link #LIBRARY_LIST LIBRARY_LIST} - * or QSYS. The object type must be *LIB. A list of saved (SAVLIB) and restored (RSTLIB) - * libraries is returned. - *
    - * @param objectType The type of objects that are searched. Valid values include - * a specific object type (*LIB, *FILE, *OUTQ, etc) or {@link #ALL ALL}. - **/ - public ObjectList(AS400 system, String objectLibrary, String objectName, String objectType) - { - if (system == null) throw new NullPointerException("system"); - if (objectLibrary == null) throw new NullPointerException("objectLibrary"); - if (objectName == null) throw new NullPointerException("objectName"); - if (objectType == null) throw new NullPointerException("objectType"); - system_ = system; - objectLibrary_ = objectLibrary; - objectName_ = objectName; - objectType_ = objectType; - } - - //@550A - /** - * Constructs an ObjectList with the specified selection criteria. - * @param system The system. - * @param objectLibrary The library or set of libraries that are searched for objects. - * Valid values are a specific name, a generic name, or one of the following - * special values: - *
      - *
    • {@link #ALL ALL} - All libraries are searched. - *
    • {@link #ALL_USER ALL_USER} - All user libraries are searched. - *
    • {@link #CURRENT_LIBRARY CURRENT_LIBRARY} - The current library is searched. - *
    • {@link #LIBRARY_LIST LIBRARY_LIST} - The library list is searched. - *
    • {@link #USER_LIBRARY_LIST USER_LIBRARY_LIST} - The user portion of the library list is searched. - *
    - * @param objectName The object name. Valid values are a specific name, a generic - * name, or one of the following special values: - *
      - *
    • {@link #ALL ALL} - All object names are searched. - *
    • {@link #ALL_USER ALL_USER} - All objects that are libraries in QSYS or the - * library list are searched. The object library - * must either be {@link #LIBRARY_LIST LIBRARY_LIST} or QSYS. The object type - * must be *LIB. A list of user libraries is returned. - *
    • {@link #IBM IBM} - All objects that are libraries in QSYS or the library - * list are searched. The object library must either be {@link #LIBRARY_LIST LIBRARY_LIST} - * or QSYS. The object type must be *LIB. A list of saved (SAVLIB) and restored (RSTLIB) - * libraries is returned. - *
    - * @param objectType The type of objects that are searched. Valid values include - * a specific object type (*LIB, *FILE, *OUTQ, etc) or {@link #ALL ALL}. - * @param aspDeviceName The name of an auxiliary storage pool (ASP) device in which storage is - * allocated for the library that contains the object or one of the following special values: - *
      - *
    • {@link #ASP_NAME_ALL ASP_NAME_ALL} - The ASPs in the thread's library name space.
    • - *
    • {@link #ASP_NAME_ALLAVL ASP_NAME_ALLAVL} - The system ASP (ASP 1) and defined basic user ASPs (ASPs 2-32).
    • - *
    • {@link #ASP_NAME_CURASPGRP ASP_NAME_CURASPGRP} - The ASPs in the current thread's ASP group.
    • - *
    • {@link #ASP_NAME_SYSBAS ASP_NAME_SYSBAS} - All available ASPs.
    • - *
    - **/ - public ObjectList(AS400 system, String objectLibrary, String objectName, String objectType, String aspDeviceName) - { - if (system == null) throw new NullPointerException("system"); - if (objectLibrary == null) throw new NullPointerException("objectLibrary"); - if (objectName == null) throw new NullPointerException("objectName"); - if (objectType == null) throw new NullPointerException("objectType"); - system_ = system; - objectLibrary_ = objectLibrary; - objectName_ = objectName; - objectType_ = objectType; - aspDeviceName_ = aspDeviceName; - } - - - /** - * Adds a library authority as part of the selection criteria for generating - * the list of objects. Libraries for which the user has the specified authorities - * are searched. If no library authority criteria are added, the default is - * {@link #AUTH_DATA_EXECUTE AUTH_DATA_EXECUTE}. A maximum of 10 authorities - * can be added. - * @param authority The authority to search. Valid values are: - *
      - *
    • {@link #AUTH_ALL AUTH_ALL} - All authority. This consists of all 5 object - * authorities and all 5 data authorities. - *
    • {@link #AUTH_CHANGE AUTH_CHANGE} - Change authority. This consists of all 5 - * data authorities and object operational authority. - *
    • {@link #AUTH_USE AUTH_USE} - Use authority. This consists of the read and - * execute data authorities and object operational authority. - *
    • {@link #AUTH_OBJECT_OPERATIONAL AUTH_OBJECT_OPERATIONAL} - Object operational authority. - *
    • {@link #AUTH_OBJECT_MANAGEMENT AUTH_OBJECT_MANAGEMENT} - Object management authority. - *
    • {@link #AUTH_OBJECT_EXISTENCE AUTH_OBJECT_EXISTENCE} - Object existence authority. - *
    • {@link #AUTH_OBJECT_ALTER AUTH_OBJECT_ALTER} - Alter authority. - *
    • {@link #AUTH_OBJECT_REFERENCE AUTH_OBJECT_REFERENCE} - Reference authority. - *
    • {@link #AUTH_DATA_READ AUTH_DATA_READ} - Read authority. - *
    • {@link #AUTH_DATA_ADD AUTH_DATA_ADD} - Add authority. - *
    • {@link #AUTH_DATA_UPDATE AUTH_DATA_UPDATE} - Update authority. - *
    • {@link #AUTH_DATA_DELETE AUTH_DATA_DELETE} - Delete authority. - *
    • {@link #AUTH_DATA_EXECUTE AUTH_DATA_EXECUTE} - Execute authority. - *
    - * @see #clearLibraryAuthorityCriteria - **/ - public void addLibraryAuthorityCriteria(String authority) - { - if (authority == null) throw new NullPointerException("authority"); - if (!authority.equals(AUTH_ALL) && - !authority.equals(AUTH_CHANGE) && - !authority.equals(AUTH_USE) && - !authority.equals(AUTH_OBJECT_OPERATIONAL) && - !authority.equals(AUTH_OBJECT_MANAGEMENT) && - !authority.equals(AUTH_OBJECT_EXISTENCE) && - !authority.equals(AUTH_OBJECT_ALTER) && - !authority.equals(AUTH_OBJECT_REFERENCE) && - !authority.equals(AUTH_DATA_READ) && - !authority.equals(AUTH_DATA_ADD) && - !authority.equals(AUTH_DATA_UPDATE) && - !authority.equals(AUTH_DATA_DELETE) && - !authority.equals(AUTH_DATA_EXECUTE)) - { - throw new ExtendedIllegalArgumentException("authority", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (currentLibAuthKey_ >= 10) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Too many authorities added to ObjectList."); - throw new ExtendedIllegalArgumentException("authority", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - libAuthKeys_[currentLibAuthKey_++] = authority; - resetHandle(); - } - - - /** - * Adds an object attribute to retrieve when this list is built. - * The attribute is cached as part of the ObjectDescription objects - * that are returned by this list, so that another call to the system - * is not necessary. Adding attributes to retrieve may increase list - * build time on the system, as well as increasing the amount of - * storage used to hold the list on the system. - *

    - * The object NAME, LIBRARY, and TYPE are always retrieved. By - * default, these are the only attributes that are retrieved. - * If no other attributes are added, the statuses of the objects (returned - * by {@link com.ibm.as400.access.ObjectDescription#getStatus ObjectDescription.getStatus()}) - * are unknown. Any attributes that are not retrieved via this interface - * will require another call to the system to retrieve them when - * {@link com.ibm.as400.access.ObjectDescription#getValue ObjectDescription.getValue()} - * is called. - * The exceptions to this are the various attributes that represent Date objects, - * as they need to be converted from system timestamp format, which always requires - * another call to the system. - * @param attribute The attribute to retrieve. Valid values include - * any of the attributes on the {@link com.ibm.as400.access.ObjectDescription ObjectDescription} class. - * @see #clearObjectAttributesToRetrieve - **/ - public void addObjectAttributeToRetrieve(int attribute) - { - if (attribute < 200) - { - throw new ExtendedIllegalArgumentException("attribute", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (attribute == ObjectDescription.NAME || - attribute == ObjectDescription.LIBRARY || - attribute == ObjectDescription.TYPE) - { - return; - } - for (int i=0; i= keys_.length) - { - int[] temp = keys_; - keys_ = new int[temp.length*2]; - System.arraycopy(temp, 0, keys_, 0, temp.length); - } - keys_[currentKey_++] = attribute; - resetHandle(); - } - - /** - * Adds an object attribute used to sort the list. The attribute - * is automatically added as an attribute to retrieve. - *

    - * The list of object attributes to sort on is maintained internally even when this ObjectList is closed and re-used. - * To start over with a new set of object attributes to sort on, call {@link #clearObjectAttributesToSortOn clearObjectAttributesToSortOn()}. - * @param attribute The object attribute on which to sort. - * Possible values are all object attributes contained in the {@link com.ibm.as400.access.ObjectDescription ObjectDescription} class, - * excluding the following: - *

      - *
    • {@link com.ibm.as400.access.ObjectDescription#LIBRARY ObjectDescription.LIBRARY} - *
    • {@link com.ibm.as400.access.ObjectDescription#NAME ObjectDescription.NAME} - *
    • {@link com.ibm.as400.access.ObjectDescription#TYPE ObjectDescription.TYPE} - *
    - * @param sortOrder true to sort ascending; false to sort descending. - * @see #clearObjectAttributesToSortOn - * @see #addObjectAttributeToRetrieve - * @see com.ibm.as400.access.ObjectDescription - **/ - public void addObjectAttributeToSortOn(int attribute, boolean sortOrder) - { - if (attribute < 200 || attribute > 9999) - { - throw new ExtendedIllegalArgumentException("attribute", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - addObjectAttributeToRetrieve(attribute); - if (currentSortKey_ >= sortKeys_.length) - { - int[] temp = sortKeys_; - sortKeys_ = new int[temp.length*2]; - System.arraycopy(temp, 0, sortKeys_, 0, temp.length); - boolean[] tempSort = sortOrders_; - sortOrders_ = new boolean[tempSort.length*2]; - System.arraycopy(tempSort, 0, sortOrders_, 0, tempSort.length); - } - sortKeys_[currentSortKey_] = attribute; - sortOrders_[currentSortKey_++] = sortOrder; - resetHandle(); - } - - - /** - * Adds an object authority as part of the selection criteria for generating - * the list of objects. Objects for which the user has the specified authorities - * are searched. If no object authority criteria are added, the default is - * {@link #AUTH_ANY AUTH_ANY}. A maximum of 11 authorities - * can be added. - * @param authority The authority to search. Valid values are: - *
      - *
    • {@link #AUTH_ALL AUTH_ALL} - All authority. This consists of all 5 object - * authorities and all 5 data authorities. - *
    • {@link #AUTH_CHANGE AUTH_CHANGE} - Change authority. This consists of all 5 - * data authorities and object operational authority. - *
    • {@link #AUTH_USE AUTH_USE} - Use authority. This consists of the read and - * execute data authorities and object operational authority. - *
    • {@link #AUTH_LIST_MANAGEMENT AUTH_LIST_MANAGEMENT} - Authorization list management - * authority. This value is valid only for objects whose type is *AUTL. It is - * ignored for all other object types. - *
    • {@link #AUTH_OBJECT_OPERATIONAL AUTH_OBJECT_OPERATIONAL} - Object operational authority. - *
    • {@link #AUTH_OBJECT_MANAGEMENT AUTH_OBJECT_MANAGEMENT} - Object management authority. - *
    • {@link #AUTH_OBJECT_EXISTENCE AUTH_OBJECT_EXISTENCE} - Object existence authority. - *
    • {@link #AUTH_OBJECT_ALTER AUTH_OBJECT_ALTER} - Alter authority. - *
    • {@link #AUTH_OBJECT_REFERENCE AUTH_OBJECT_REFERENCE} - Reference authority. - *
    • {@link #AUTH_DATA_READ AUTH_DATA_READ} - Read authority. - *
    • {@link #AUTH_DATA_ADD AUTH_DATA_ADD} - Add authority. - *
    • {@link #AUTH_DATA_UPDATE AUTH_DATA_UPDATE} - Update authority. - *
    • {@link #AUTH_DATA_DELETE AUTH_DATA_DELETE} - Delete authority. - *
    • {@link #AUTH_DATA_EXECUTE AUTH_DATA_EXECUTE} - Execute authority. - *
    • {@link #AUTH_ANY AUTH_ANY} - Any authority other than *EXCLUDE. If this value - * is specified, no other values can be specified. - *
    - * @see #clearObjectAuthorityCriteria - **/ - public void addObjectAuthorityCriteria(String authority) - { - if (authority == null) throw new NullPointerException("authority"); - if (!authority.equals(AUTH_ALL) && - !authority.equals(AUTH_CHANGE) && - !authority.equals(AUTH_USE) && - !authority.equals(AUTH_LIST_MANAGEMENT) && - !authority.equals(AUTH_OBJECT_OPERATIONAL) && - !authority.equals(AUTH_OBJECT_MANAGEMENT) && - !authority.equals(AUTH_OBJECT_EXISTENCE) && - !authority.equals(AUTH_OBJECT_ALTER) && - !authority.equals(AUTH_OBJECT_REFERENCE) && - !authority.equals(AUTH_DATA_READ) && - !authority.equals(AUTH_DATA_ADD) && - !authority.equals(AUTH_DATA_UPDATE) && - !authority.equals(AUTH_DATA_DELETE) && - !authority.equals(AUTH_DATA_EXECUTE) && - !authority.equals(AUTH_ANY)) - { - throw new ExtendedIllegalArgumentException("authority", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (currentObjectAuthKey_ >= 11) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Too many authorities added to ObjectList."); - throw new ExtendedIllegalArgumentException("authority", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Start of changes for change flag --------------------------- @A1A - // Following code is to enforce Javadoc which states: - // If this value [AUTH_ANY] is specified, no other values can be specified. - if ((authority.equals(AUTH_ANY)) && (currentObjectAuthKey_ != 0)) - { - // If AUTH_ANY is specified, then it must be the first/only entry - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Attempt to add AUTH_ANY auth after other auth was added."); - throw new ExtendedIllegalArgumentException("authority", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if ((currentObjectAuthKey_ > 0) && // Adding auth beyond 1st auth in list -AND- - (objectAuthKeys_[0].equals(AUTH_ANY))) // first auth in list is AUTH_ANY - { - // If AUTH_ANY was already specified, cannot add another auth to the list. - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Attempt to add auth after AUTH_ANY auth was added."); - throw new ExtendedIllegalArgumentException("authority", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - // End of changes for change flag ----------------------------- @A1A - - objectAuthKeys_[currentObjectAuthKey_++] = authority; - resetHandle(); - } - - - /** - * Adds an object attribute used to filter the list. If no statuses are - * added as selection criteria, the default is to include objects with - * {@link #STATUS_ANY STATUS_ANY}. A maximum of 5 statuses can be added. - * @param status The object information status criteria. Possible values - * include: - *
      - *
    • {@link com.ibm.as400.access.ObjectDescription#STATUS_NO_AUTHORITY ObjectDescription.STATUS_NO_AUTHORITY} - Objects that - * do not meet the authorities specified in the object authority criteria - * for this user. See {@link #addObjectAuthorityCriteria addObjectAuthorityCriteria}. - *
    • {@link com.ibm.as400.access.ObjectDescription#STATUS_DAMAGED ObjectDescription.STATUS_DAMAGED} - Objects that are damaged. - *
    • {@link com.ibm.as400.access.ObjectDescription#STATUS_LOCKED ObjectDescription.STATUS_LOCKED} - Objects that are locked. - *
    • {@link com.ibm.as400.access.ObjectDescription#STATUS_PARTIALLY_DAMAGED ObjectDescription.STATUS_PARTIALLY_DAMAGED} - Objects - * that are partially damaged. - *
    • {@link #STATUS_ANY ObjectList.STATUS_ANY} - Objects with any status. - *
    - * @see #clearObjectSelectionCriteria - * @see #setObjectSelection - **/ - public void addObjectSelectionCriteria(byte status) - { - if (status != ObjectDescription.STATUS_NO_AUTHORITY && - status != ObjectDescription.STATUS_DAMAGED && - status != ObjectDescription.STATUS_LOCKED && - status != ObjectDescription.STATUS_PARTIALLY_DAMAGED && - status != STATUS_ANY) - { - throw new ExtendedIllegalArgumentException("status", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (currentStatusKey_ >= 5) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Too many statuses specified for ObjectList."); - throw new ExtendedIllegalArgumentException("status", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - statusKeys_[currentStatusKey_] = status; - resetHandle(); - } - - - /** - * Clears the library authority criteria used to filter the list. - * @see #addLibraryAuthorityCriteria - **/ - public void clearLibraryAuthorityCriteria() - { - currentLibAuthKey_ = 0; - libAuthKeys_ = new String[10]; - resetHandle(); - } - - - /** - * Clears the object attribtues to retrieve as part of this list. - * This resets the attributes to retrieve back to the default - * NAME, LIBRARY, and TYPE. - * @see #addObjectAttributeToRetrieve - **/ - public void clearObjectAttributesToRetrieve() - { - keys_ = new int[1]; - currentKey_ = 0; - resetHandle(); - } - - /** - * Clears the object attributes used to sort the list. This resets all of the - * object sort parameters to their default values. - * @see #addObjectAttributeToSortOn - **/ - public void clearObjectAttributesToSortOn() - { - currentSortKey_ = 0; - sortKeys_ = new int[1]; - sortOrders_ = new boolean[1]; - resetHandle(); - } - - - /** - * Clears the object authority criteria used to filter the list. - * @see #addObjectAuthorityCriteria - **/ - public void clearObjectAuthorityCriteria() - { - currentObjectAuthKey_ = 0; - objectAuthKeys_ = new String[11]; - resetHandle(); - } - - /** - * Clears the object statuses used to filter the list and resets the - * object selection to include objects in the list (true). - * @see #addObjectSelectionCriteria - * @see #setObjectSelection - **/ - public void clearObjectSelectionCriteria() - { - currentStatusKey_ = 0; - statusKeys_ = new byte[5]; - statusSelection_ = true; - resetHandle(); - } - - - /** - * Closes the object list on the system. - * This releases any system resources previously in use by this object list. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @see #load - **/ - public synchronized void close() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!isConnected_) - { - return; - } - if (handleToClose_ != null && (handle_ == null || handle_ == handleToClose_)) - { - handle_ = handleToClose_; - handleToClose_ = null; - } - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "Closing object list with handle: ", handle_); - } - - try { - ListUtilities.closeList(system_, handle_); - } - finally { - isConnected_ = false; - handle_ = null; - } - - - if (handleToClose_ != null) // Just in case. - { - handle_ = handleToClose_; - handleToClose_ = null; - close(); - } - } - - private void ensureSelectionKey(int key) - { - for (int i=0; i 0 && sortKeys_[found-1] == key) return; - int[] temp = sortKeys_; - boolean[] tempOrders = sortOrders_; - sortKeys_ = new int[temp.length+1]; - sortOrders_ = new boolean[temp.length+1]; - System.arraycopy(temp, 0, sortKeys_, 0, found); - System.arraycopy(tempOrders, 0, sortOrders_, 0, found); - sortKeys_[found] = key; - sortOrders_[found] = tempOrders[found]; - System.arraycopy(temp, found, sortKeys_, found+1, temp.length-found); - System.arraycopy(tempOrders, found, sortOrders_, found+1, temp.length-found); - ++currentSortKey_; - } - - - /** - * Helper method used to determine which extra keys, if any, need to be added for - * proper selection and sorting. - **/ - private void fixUpKeys() - { - for (int i=0; ilistOffset and number - * will most likely not return the same ObjectDescriptions as the previous call. - * @param listOffset The offset in the list of objects (0-based). This value must be greater than or equal to 0 and - * less than the list length; or specify -1 to retrieve all of the objects. - * @param number The number of objects to retrieve out of the list, starting at the specified - * listOffset. This value must be greater than or equal to 0 and less than or equal - * to the list length. If the listOffset is -1, this parameter is ignored. - * @return The array of retrieved {@link com.ibm.as400.access.ObjectDescription ObjectDescription} objects. - * The length of this array may not necessarily be equal to number, depending upon the size - * of the list on the system, and the specified listOffset. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @see com.ibm.as400.access.Job - * @see #close - * @see #load - **/ - public synchronized ObjectDescription[] getObjects(int listOffset, int number) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (listOffset < -1) - { - throw new ExtendedIllegalArgumentException("listOffset", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (number < 0 && listOffset != -1) - { - throw new ExtendedIllegalArgumentException("number", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (handle_ == null) load(); // this sets the length_ variable - - if (length_ == 0 || (number == 0 && listOffset != -1)) { - return new ObjectDescription[0]; - } - - if (listOffset == -1) - { - number = length_; // request entire list - listOffset = 0; // ... starting at beginning of list - } - else if (listOffset >= length_) - { - if (Trace.traceOn_) - Trace.log(Trace.WARNING, "Value of parameter 'listOffset' is beyond end of list:", listOffset + " (list length: " + length_ + ")"); - - return new ObjectDescription[0]; - } - else if (listOffset + number > length_) - { - number = length_ - listOffset; - } - - int ccsid = system_.getCcsid(); - ConvTable conv = ConvTable.getTable(ccsid, null); - - // Use recLen_ from load()'s list information to calculate receiver length needed @A2A - int len = number*recLen_; //@A2C - - // The 'List information' structure from call to QGYGTLE. - // This value will be set by retrieveListEntries(). - Object[] listInfoContainer = new Object[1]; // initialized to null - - // Retrieve the entries in the list that was built by the most recent load(). - byte[] data = ListUtilities.retrieveListEntries(system_, handle_, len, number, listOffset, listInfoContainer); - - byte[] listInfo = (byte[])listInfoContainer[0]; - if (listInfo == null || listInfo.length == 0) { - return new ObjectDescription[0]; - // Shouldn't have to do this, but this API doesn't like certain empty libraries for some reason. - } - //int totalRecords = BinaryConverter.byteArrayToInt(listInfo, 0); - int recordsReturned = BinaryConverter.byteArrayToInt(listInfo, 4); - int recordLength = BinaryConverter.byteArrayToInt(listInfo, 12); - - // Deleting following code, because there will not be a need to call a second @A2A - // time as we should always have enough room for the receiver now. @A2A - /* Start of deleted code which calls QGYGTLE a second time ----------------- @A2D - while (listOffset == -1 && totalRecords > recordsReturned) - { - len = len*(1+(totalRecords/(recordsReturned+1))); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Calling ObjectList QGYGTLE again with an updated length of "+len+"."); - try - { - parms2[0].setOutputDataLength(len); - parms2[1].setInputData(BinaryConverter.intToByteArray(len)); - } - catch (PropertyVetoException pve) - { - } - if (!pc2.run()) - { - throw new AS400Exception(pc2.getMessageList()); - } - listInfo = parms2[3].getOutputData(); - totalRecords = BinaryConverter.byteArrayToInt(listInfo, 0); - recordsReturned = BinaryConverter.byteArrayToInt(listInfo, 4); - recordLength = BinaryConverter.byteArrayToInt(listInfo, 12); - } - - End of deleted code which calls QGYGTLE a second time ----------------- @A2D */ - - ObjectDescription[] objects = new ObjectDescription[recordsReturned]; - int offset = 0; - for (int i=0; i= COMBINATION_200) - { - objects[i].set(ObjectDescription.INFORMATION_STATUS, conv.byteArrayToString(keyData, 0, 1)); - objects[i].set(ObjectDescription.EXTENDED_ATTRIBUTE, conv.byteArrayToString(keyData, 1, 10).trim()); - objects[i].set(ObjectDescription.TEXT_DESCRIPTION, conv.byteArrayToString(keyData, 11, 10).trim()); - objects[i].set(ObjectDescription.USER_DEFINED_ATTRIBUTE, conv.byteArrayToString(keyData, 61, 10).trim()); - objects[i].set(ObjectDescription.ORDER_IN_LIBRARY_LIST, BinaryConverter.byteArrayToInt(keyData, 71)); - } - if (key >= COMBINATION_300) - { - objects[i].set(ObjectDescription.OBJECT_ASP_NUMBER, BinaryConverter.byteArrayToInt(keyData, 80)); - objects[i].set(ObjectDescription.OWNER, conv.byteArrayToString(keyData, 84, 10).trim()); - objects[i].set(ObjectDescription.DOMAIN, conv.byteArrayToString(keyData, 94, 2)); - byte[] timestamp = new byte[8]; - System.arraycopy(keyData, 96, timestamp, 0, 8); - objects[i].set(ObjectDescription.CREATION_DATE, timestamp); - timestamp = new byte[8]; - System.arraycopy(keyData, 104, timestamp, 0, 8); - objects[i].set(ObjectDescription.CHANGE_DATE, timestamp); - objects[i].set(ObjectDescription.STORAGE_STATUS, conv.byteArrayToString(keyData, 112, 10).trim()); - objects[i].set(ObjectDescription.COMPRESSION, conv.byteArrayToString(keyData, 122, 1)); - objects[i].set(ObjectDescription.ALLOW_CHANGE_BY_PROGRAM, keyData[123] == (byte)0xF1); - objects[i].set(ObjectDescription.CHANGED_BY_PROGRAM, keyData[124] == (byte)0xF1); - objects[i].set(ObjectDescription.AUDITING, conv.byteArrayToString(keyData, 125, 10).trim()); - objects[i].set(ObjectDescription.DIGITALLY_SIGNED, keyData[135] == (byte)0xF1); - objects[i].set(ObjectDescription.DIGITALLY_SIGNED_TRUSTED, keyData[136] == (byte)0xF1); - objects[i].set(ObjectDescription.DIGITALLY_SIGNED_MULTIPLE, keyData[137] == (byte)0xF1); - objects[i].set(ObjectDescription.LIBRARY_ASP_NUMBER, BinaryConverter.byteArrayToInt(keyData, 140)); - } - if (key >= COMBINATION_400) - { - } - System.out.println("Struct not supported: "+key); - } -*/ - else - { - Trace.log(Trace.ERROR, "Unknown key type for key "+key+": "+type); - throw new InternalErrorException(InternalErrorException.SYNTAX_ERROR, key+": "+type); - } - fieldOffset += infoLength; - } - } - offset += recordLength; - } - - return objects; - } - - - /** - * Returns the system. - * @return The system. - **/ - public AS400 getSystem() - { - return system_; - } - - - /** - * Returns the object type used to filter this list. (For example: *LIB, *FILE, *OUTQ, etc) - * @return The object type. - **/ - public String getType() - { - return objectType_; - } - - - /** - * Loads the list of objects on the system. This method informs the - * system to build a list of objects. This method blocks until the system returns - * the total number of objects it has compiled. A subsequent call to - * {@link #getObjects getObjects()} will retrieve the actual object information - * and attributes for each object in the list from the system. - *

    This method updates the list length. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception ServerStartupException If the host server cannot be started. - * @exception UnknownHostException If the system cannot be located. - * @see #getLength - * @see #close - **/ - public synchronized void load() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (system_ == null) throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - // Close the previous list - if (handle_ != null || handleToClose_ != null) - { - close(); - } - - // Generate text objects based on system CCSID - final int ccsid = system_.getCcsid(); - ConvTable conv = ConvTable.getTable(ccsid, null); - AS400Text text10 = new AS400Text(10, ccsid, system_); - - // Setup program parameters - ProgramParameter[] parms = new ProgramParameter[(aspDeviceName_ == null) ? 12 : 15]; // @550C changed to allow asp control - parms[0] = new ProgramParameter(1); // receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(1)); // length of receiver variable - parms[2] = new ProgramParameter(ListUtilities.LIST_INFO_LENGTH); // list information - - // Number of records to return. - // Special value '-1' indicates that "all records are built synchronously in the list". - parms[3] = new ProgramParameter(BinaryConverter.intToByteArray(-1)); - - fixUpKeys(); - - byte[] sortInfo = null; - int numSortKeys = currentSortKey_; - if (numSortKeys > 0) - { - sortInfo = new byte[4+numSortKeys*12]; - BinaryConverter.intToByteArray(numSortKeys, sortInfo, 0); - int offset = 4; - for (int i=0; i - *

  • {@link #ASP_SEARCH_TYPE_ASP ASP_SEARCH_TYPE_ASP} - Only the single ASP named will be searched.
  • - *
  • {@link #ASP_SEARCH_TYPE_ASPGRP ASP_SEARCH_TYPE_ASPGRP} - All ASPs in the auxiliary storage pool - * group named will be searched.
  • - * - * The default value is {@link #ASP_SEARCH_TYPE_ASP ASP_SEARCH_TYPE_ASP}. - * @exception ExtendedIllegalArgumentExceptiion if an invalid search type is specified. - */ - public void setAspSearchType(String aspSearchType) throws ExtendedIllegalArgumentException{ - if (aspSearchType == null) throw new NullPointerException("aspSearchType"); - if (!aspSearchType.equals(ASP_SEARCH_TYPE_ASP) && - !aspSearchType.equals(ASP_SEARCH_TYPE_ASPGRP)) - { - throw new ExtendedIllegalArgumentException("aspSearchType", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - aspSearchType_ = aspSearchType; - } - - /** - * Sets whether or not the object selection criteria are used to include - * objects in the list or to omit them from the list. The default is - * true, which is to include objects in the list with the specified criteria - * as added by {@link #addObjectSelectionCriteria addObjectSelectionCriteria()}. - * @param select true to include objects in the list that have the - * specified statuses, false to omit objects from the list that have the - * specified statuses. - * @see #addObjectSelectionCriteria - * @see #clearObjectSelectionCriteria - **/ - public void setObjectSelection(boolean select) - { - statusSelection_ = select; - resetHandle(); - } - - - /** - Closes the list on the system when this object is garbage collected. - **/ - protected void finalize() throws Throwable - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Finalize method for object list invoked."); - if (handle_ != null) try { close(); } catch (Throwable t) {} - super.finalize(); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/ObjectListener.java b/cvsroot/src/com/ibm/as400/access/ObjectListener.java deleted file mode 100644 index 631d79e8c..000000000 --- a/cvsroot/src/com/ibm/as400/access/ObjectListener.java +++ /dev/null @@ -1,46 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ObjectListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.EventListener; - -/** - The ObjectListener interface provides a listener interface for receiving Object events. - **/ -public interface ObjectListener extends EventListener -{ - /** - Invoked when an object has been closed. - @param event The object event. - **/ - public void objectClosed(ObjectEvent event); - - /** - Invoked when an object has been created. - @param event The object event. - **/ - public void objectCreated(ObjectEvent event); - - /** - Invoked when an object has been deleted. - @param event The object event. - **/ - public void objectDeleted(ObjectEvent event); - - /** - Invoked when an object has been opened. - @param event The object event. - **/ - public void objectOpened(ObjectEvent event); -} diff --git a/cvsroot/src/com/ibm/as400/access/ObjectLockListEntry.java b/cvsroot/src/com/ibm/as400/access/ObjectLockListEntry.java deleted file mode 100644 index 5b9b28b65..000000000 --- a/cvsroot/src/com/ibm/as400/access/ObjectLockListEntry.java +++ /dev/null @@ -1,343 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ObjectLockListEntry.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2008 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** - Represents a single IBM i lock placed on an ObjectDescription. -

    Each entry corresponds to an entry from the List Object Locks (QWCLOBJL) API.
    - Instances of this class are created by the {@link ObjectDescription#getObjectLockList() ObjectDescription.getObjectLockList()} method. -**/ - -public class ObjectLockListEntry -{ - // -------------------------------- - /** - Lock scope - indicates lock has job scope. - **/ - public static final int LOCK_SCOPE_JOB = 0; - /** - Lock scope - indicates lock has thread scope. - **/ - public static final int LOCK_SCOPE_THREAD = 1; - /** - Lock scope - indicates lock has lock space scope. - **/ - public static final int LOCK_SCOPE_LOCK_SPACE = 2; - - // -------------------------------- - /** - Lock state for the lock request. Indicates no locks exist. - **/ - public static final String LOCK_STATE_NONE = "*NONE"; - /** - Lock state for the lock request. Indicates lock is shared for read. - **/ - public static final String LOCK_STATE_SHARED_READ = "*SHRRD"; - /** - Lock state for the lock request. Indicates lock is shared for update. - **/ - public static final String LOCK_STATE_SHARED_UPDATE = "*SHRUPD"; - /** - Lock state for the lock request. Indicates lock is shared for no update. - **/ - public static final String LOCK_STATE_SHARED_NO_UPDATE = "*SHRNUP"; - /** - Lock state for the lock request. Indicates exclusive lock which allows read. - **/ - public static final String LOCK_STATE_EXCLUSIVE_ALLOW_READ = "*EXCLRD"; - /** - Lock state for the lock request. Indicates exclusive lock with no read. - **/ - public static final String LOCK_STATE_EXCLUSIVE_NO_READ = "*EXCL"; - - // -------------------------------- - /** - Lock status - the lock is currently held by the job or thread. - **/ - public static final int LOCK_STATUS_LOCK_HELD = 1; - /** - Lock status - the job or thread is waiting for the lock (synchronous). - **/ - public static final int LOCK_STATUS_JOB_THREAD_WAITING_SYNC = 2; - /** - Lock status - the job or thread has a lock request outstanding for the object (asynchronous). - **/ - public static final int LOCK_STATUS_LOCK_REQUEST_OUTSTANDING_ASYNC = 3; - - // -------------------------------- - /** - Lock type - lock on the object - **/ - public static final int LOCK_TYPE_OBJECT = 1; - /** - Lock type - lock on the member control block. - **/ - public static final int LOCK_TYPE_MEMBER_CONTROL_BLOCK = 2; - /** - Lock type - lock on the access path used to access a member's data - **/ - public static final int LOCK_TYPE_ACCESS_PATH = 3; - /** - Lock type - lock on the actual data within the member. - **/ - public static final int LOCK_TYPE_DATA_WITHIN_MEMBER = 4; - - // -------------------------------- - /** - Lock share - the file is not shared, the file is a physical file, or the field is not applicable to object type. - **/ - public static final int LOCK_SHARE_FILE_NOT_SHARED = 0; - /** - Lock share - the file is shared. - **/ - public static final int LOCK_SHARE_FILE_SHARED = 1; - - // -------------------------------- - /** - Job name machine process. The job holding the lock is an internal machine process. - **/ - public static final String JOB_NAME_MACHINE = "MACHINE"; - /** - Job name lock space. The lock is attached to a lock space. - **/ - public static final String JOB_NAME_LOCK_SPACE = "*LCKSPC"; - /** - Special value indicating that the system was unable to determine a value. - **/ - public static final String VALUE_CANNOT_BE_DETERMINED = "*N"; - - - // private member data representing an entry from the QWCLOBJL() API - private String jobName_; - private String jobUsername_; - private String jobNumber_; - private String lockState_; - private int lockStatus_; - private int lockType_; - //private String memberName_; - private String share_; - private String lockScope_; - private long threadID_; - - - // Make constructors package scoped - only constructed by UserObjectsOwnedList.getObjectLockList() - // No verification of data is performed in the constructors, since - // the data for these parameters comes from the List Object Locks (QWCLOBJL) API. - ObjectLockListEntry(String jobName, String jobUserName, String jobNumber, String lockState, int lockStatus, int lockType, String memberName, String share, String lockScope, long threadID) - { - jobName_ = jobName; - jobUsername_ = jobUserName; - jobNumber_ = jobNumber; - lockState_ = lockState; - lockStatus_ = lockStatus; - lockType_ = lockType; - //memberName_ = memberName; - share_ = share; - lockScope_ = lockScope; - threadID_ = threadID; - } - - /** - Returns the simple job name of the job that issued the lock request. - @return the job name. The following special values may be returned: -

      -
    • {@link #JOB_NAME_MACHINE JOB_NAME_MACHINE} - The lock is held by an internal machine process. If this value is returned, the job number and job user name will be blank. -
    • {@link #JOB_NAME_LOCK_SPACE JOB_NAME_LOCK_SPACE} - The lock is attached to a lock space. If this value is returned, the job number and job user name will be blank. -
    • {@link #VALUE_CANNOT_BE_DETERMINED VALUE_CANNOT_BE_DETERMINED} - The job name cannot be determined. -
    - **/ - public String getJobName() - { - return jobName_; - } - - /** - The user name under which the job that issued the lock request is run. - The user name is the same as the user profile name and can come from several different sources depending on the type of job. - @return the job user name. The following special value may be returned: -
      -
    • {@link #VALUE_CANNOT_BE_DETERMINED VALUE_CANNOT_BE_DETERMINED} - The job user name cannot be determined. -
    - **/ - public String getJobUserName() - { - return jobUsername_; - } - - /** - The system-assigned job number of the job that issued the lock request. - @return the job number. The following special value may be returned: -
      -
    • {@link #VALUE_CANNOT_BE_DETERMINED VALUE_CANNOT_BE_DETERMINED} - The job number cannot be determined. -
    - **/ - public String getJobNumber() - { - return jobNumber_; - } - - /** - Returns the value indicating the lock state. - @return lock state. Possible values: -
      -
    • {@link #LOCK_STATE_NONE LOCK_STATE_NONE} - Indicates no locks exist. -
    • {@link #LOCK_STATE_SHARED_READ LOCK_STATE_SHARED_READ} - Indicates lock is shared for read. -
    • {@link #LOCK_STATE_SHARED_UPDATE LOCK_STATE_SHARED_UPDATE} - Indicates lock is shared for update. -
    • {@link #LOCK_STATE_SHARED_NO_UPDATE LOCK_STATE_SHARED_NO_UPDATE} - Indicates lock is shared for no update. -
    • {@link #LOCK_STATE_EXCLUSIVE_ALLOW_READ LOCK_STATE_EXCLUSIVE_ALLOW_READ} - Indicates exclusive lock which allows read. -
    • {@link #LOCK_STATE_EXCLUSIVE_NO_READ LOCK_STATE_EXCLUSIVE_NO_READ} - Indicates exclusive lock with no read. -
    - **/ - public String getLockState() - { - - if (!(lockState_.equals(LOCK_STATE_NONE)) && - !(lockState_.equals(LOCK_STATE_SHARED_READ)) && - !(lockState_.equals(LOCK_STATE_SHARED_UPDATE)) && - !(lockState_.equals(LOCK_STATE_SHARED_NO_UPDATE)) && - !(lockState_.equals(LOCK_STATE_EXCLUSIVE_ALLOW_READ)) && - !(lockState_.equals(LOCK_STATE_EXCLUSIVE_NO_READ))) - { - Trace.log(Trace.ERROR, "Invalid lock state: "+ lockState_); - throw new InternalErrorException(InternalErrorException.UNKNOWN, lockState_); - } - return lockState_; - } - - - /** - Returns the value indicating the lock status. - @return lock status. Possible values: -
      -
    • {@link #LOCK_STATUS_LOCK_HELD LOCK_STATUS_LOCK_HELD} - The lock is currently held by the job or thread. -
    • {@link #LOCK_STATUS_JOB_THREAD_WAITING_SYNC LOCK_STATUS_JOB_THREAD_WAITING_SYNC} - The job or thread is waiting for the lock (synchronous). -
    • {@link #LOCK_STATUS_LOCK_REQUEST_OUTSTANDING_ASYNC LOCK_STATUS_LOCK_REQUEST_OUTSTANDING_ASYNC} - The job or thread has a lock request outstanding for the object (asynchronous). -
    - **/ - public int getLockStatus() - { - if ((lockStatus_ != LOCK_STATUS_LOCK_HELD) && - (lockStatus_ != LOCK_STATUS_JOB_THREAD_WAITING_SYNC) && - (lockStatus_ != LOCK_STATUS_LOCK_REQUEST_OUTSTANDING_ASYNC)) - { - Trace.log(Trace.ERROR, "Invalid lock status:", lockStatus_); - throw new InternalErrorException(InternalErrorException.UNKNOWN, lockStatus_); - } - return lockStatus_; - } - - /** - Returns the value indicating the lock type. - @return lock type. Possible values: -
      -
    • {@link #LOCK_TYPE_OBJECT LOCK_TYPE_OBJECT} - Lock on the object -
    • {@link #LOCK_TYPE_MEMBER_CONTROL_BLOCK LOCK_TYPE_MEMBER_CONTROL_BLOCK} - Lock on the member control block. -
    • {@link #LOCK_TYPE_ACCESS_PATH LOCK_TYPE_ACCESS_PATH} - Lock on the access path used to access a member's data -
    • {@link #LOCK_TYPE_DATA_WITHIN_MEMBER LOCK_TYPE_DATA_WITHIN_MEMBER} - Lock on the actual data within the member. -
    - **/ - public int getLockType() - { - if ((lockType_ != LOCK_TYPE_OBJECT) && - (lockType_ != LOCK_TYPE_MEMBER_CONTROL_BLOCK) && - (lockType_ != LOCK_TYPE_ACCESS_PATH) && - (lockType_ != LOCK_TYPE_DATA_WITHIN_MEMBER)) - { - Trace.log(Trace.ERROR, "Invalid lock type:", lockType_); - throw new InternalErrorException(InternalErrorException.UNKNOWN, lockType_); - } - return lockType_; - } - - /** - Share. Whether shared file member locks are associated with the file member. - @return lock share. Possible values: -
      -
    • {@link #LOCK_SHARE_FILE_NOT_SHARED LOCK_SHARE_FILE_NOT_SHARED} - The file is not shared, the file is a physical file, or the field is not applicable to object type. -
    • {@link #LOCK_SHARE_FILE_SHARED LOCK_SHARE_FILE_SHARED} - The file is shared. -
    - **/ - public int getShare() - { - int intShare; - try { - intShare = Integer.parseInt(share_); - } - catch (NumberFormatException e) - { - Trace.log(Trace.ERROR, "Invalid number conversion for (" + share_ +")"); - throw new InternalErrorException(InternalErrorException.UNKNOWN, e.getMessage()); - } - - if ((intShare != LOCK_SHARE_FILE_NOT_SHARED) && - (intShare != LOCK_SHARE_FILE_SHARED)) - { - Trace.log(Trace.ERROR, "Invalid lock share:", intShare); - throw new InternalErrorException(InternalErrorException.UNKNOWN, intShare); - } - - return intShare; - } - - /** - Returns the value indicating the lock scope. - @return lock scope. Possible values: -
      -
    • {@link #LOCK_SCOPE_JOB LOCK_SCOPE_JOB} - Lock has job scope. -
    • {@link #LOCK_SCOPE_THREAD LOCK_SCOPE_THREAD} - Lock has thread scope. -
    • {@link #LOCK_SCOPE_LOCK_SPACE LOCK_SCOPE_LOCK_SPACE} - Lock has lock space scope -
    - **/ - public int getLockScope() - { - int intLockScope; - try { - intLockScope = Integer.parseInt(lockScope_); - } - catch (NumberFormatException e) - { - Trace.log(Trace.ERROR, "Invalid number conversion for (" + lockScope_ +")"); - throw new InternalErrorException(InternalErrorException.UNKNOWN, e.getMessage()); - } - - if ((intLockScope != LOCK_SCOPE_JOB) && - (intLockScope != LOCK_SCOPE_THREAD) && - (intLockScope != LOCK_SCOPE_LOCK_SPACE)) - { - Trace.log(Trace.ERROR, "Invalid lock scope:", intLockScope); - throw new InternalErrorException(InternalErrorException.UNKNOWN, intLockScope); - } - - return intLockScope; - } - - /** - The identifier of the thread that is holding a thread-scoped lock or waiting for a lock. - @return a long representing the thread identifier. For locks that do not have a lock scope of {@link #LOCK_SCOPE_THREAD LOCK_SCOPE_THREAD}, this value is not meaningful and will likely be zero. - **/ - public long getThreadID() - { - return threadID_; - } - - /** - Returns a string representation of this object lock - @return a string representing the lock by [job name/job user name/job number/thread ID] - **/ - public String toString() - { - return "["+getJobName()+"/"+getJobUserName()+"/"+getJobNumber()+"/0x"+Long.toHexString(getThreadID()).toUpperCase()+"]"; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ObjectReferences.java b/cvsroot/src/com/ibm/as400/access/ObjectReferences.java deleted file mode 100644 index c76baea2a..000000000 --- a/cvsroot/src/com/ibm/as400/access/ObjectReferences.java +++ /dev/null @@ -1,1427 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ObjectReferences.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - Represents the set of information about integrated file system references on an object that can be retrieved through the QP0LROR API. -

    A reference is an individual type of access or lock obtained on the object when using integrated file system interfaces. An object may have multiple references concurrently held, provided that the reference types do not conflict with one another. -

    This class will not return information about byte range locks that may currently be held on an object. -

    The user must have execute (*X) data authority to each directory preceding the object whose references are to be obtained. The user must have read (*R) data authority to the object whose references are to be obtained. - **/ -public class ObjectReferences -{ - // The system where object is located. - private AS400 system_; - // Path to the object. - private String path_; - - // Flag indicating if the attributes have been retrieved. - private boolean attributesRetrieved_ = false; - - // Reference Count. - private long referenceCount_; - // In-Use Indicator. - private boolean inUseIndicator_; - // Simple Reference Types Structure. - private SimpleObjectReferenceTypesStructure simple_; - // Extended Reference Types Structure. - private ExtendedObjectReferenceTypesStructure extended_; - // Referencing job list. - private JobUsingObjectStructure[] jobs_; - - /** - Constructs an ObjectReferences object. - @param system The system object representing the system on which the object exists. - @param path The path name of the object for which object reference information is retrieved. - **/ - public ObjectReferences(AS400 system, String path) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing ObjectReferences object, system: " + system + ", path: " + path); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (path == null) - { - Trace.log(Trace.ERROR, "Parameter 'path' is null."); - throw new NullPointerException("path"); - } - system_ = system; - path_ = path; - } - - // Utility method to convert String path into path name parameter used by API's. - private byte[] createPathName() throws IOException - { - Converter conv = new Converter(1200, system_); - - byte[] pathName = new byte[32 + path_.length() * 2]; - BinaryConverter.intToByteArray(1200, pathName, 0); - BinaryConverter.intToByteArray(2, pathName, 12); - BinaryConverter.intToByteArray(path_.length() * 2, pathName, 16); - conv.stringToByteArray("/", pathName, 20, 2); - conv.stringToByteArray(path_, pathName, 32); - return pathName; - } - - /** - Returns the number of references of the attribute lock type. The attribute lock type indicates that attribute changes are prevented. - @return The number of references of the attribute lock type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getAttributeLock() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return simple_.attributeLock_; - } - - /** - Returns an indication of whether the object is currently checked out. If it is checked out, then getCheckedOutUserName() returns the name of the user who has it checked out. - @return An indication of whether the object is currently checked out. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getCheckedOut() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return simple_.checkedOut_; - } - - /** - Returns the name of the user who has the object checked out. An empty string ("") is returned if the object is not checked out. - @return The name of the user who has the object checked out. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getCheckedOutUserName() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return simple_.checkedOutUserName_; - } - - /** - Returns the number of references of the current directory type. The current directory type indicates that object is a directory that is being used as the current directory of the job. - @return The number of references of the current directory type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getCurrentDirectory() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.currentDirectory_; - } - - /** - Returns the number of references of the execute type. The execute type indicates that the reference has execute only access. - @return The number of references of the execute type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getExecute() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return simple_.execute_; - } - - /** - Returns the number of references of the execute, share with readers only type. The execute, share with readers only type indicates that the reference has execute only access. The sharing mode allows sharing with read and execute access intents only. - @return The number of references of the execute, share with readers only type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getExecuteShareWithReadersOnly() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.executeShareWithReadersOnly_; - } - - /** - Returns the number of references of the execute, share with readers and writers type. The execute, share with readers and writers type indicates that the reference has execute only access. The sharing mode allows sharing with read, execute, and write access intents. - @return The number of references of the execute, share with readers and writers type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getExecuteShareWithReadersAndWriters() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.executeShareWithReadersAndWriters_; - } - - /** - Returns the number of references of the execute, share with writers only type. The execute, share with writers only type indicates that the reference has execute only access. The sharing mode allows sharing with write access intents only. - @return The number of references of the execute, share with writers only type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getExecuteShareWithWritersOnly() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.executeShareWithWritersOnly_; - } - - /** - Returns the number of references of the execute, share with neither readers nor writers type. The execute, share with neither readers nor writers type indicates that the reference has execute only access. The sharing mode allows sharing with no other access intents. - @return The number of references of the execute, share with neither readers nor writers type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getExecuteShareWithNeitherReadersNorWriters() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.executeShareWithNeitherReadersNorWriters_; - } - - /** - Returns the number of references of the execute/read, share with readers only type. The execute/read, share with readers only type indicates that the reference has execute and read access. The sharing mode allows sharing with read and execute access intents only. - @return The number of references of the execute/read, share with readers only type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getExecuteReadShareWithReadersOnly() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.executeReadShareWithReadersOnly_; - } - - /** - Returns the number of references of the execute/read, share with readers and writers type. The execute/read, share with readers and writers type indicates that the reference has execute and read access. The sharing mode allows sharing with read, execute, and write access intents. - @return The number of references of the execute/read, share with readers and writers type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getExecuteReadShareWithReadersAndWriters() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.executeReadShareWithReadersAndWriters_; - } - - /** - Returns the number of references of the execute/read, share with writers only type. The execute/read, share with writers only type indicates that the reference has execute and read access. The sharing mode allows sharing with write access intents only. - @return The number of references of the execute/read, share with writers only type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getExecuteReadShareWithWritersOnly() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.executeReadShareWithWritersOnly_; - } - - /** - Returns the number of references of the execute/read, share with neither readers nor writers type. The execute/read, share with neither readers nor writers type indicates that the reference has execute and read access. The sharing mode allows sharing with no other access intents. - @return The number of references of the execute/read, share with neither readers nor writers type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getExecuteReadShareWithNeitherReadersNorWriters() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.executeReadShareWithNeitherReadersNorWriters_; - } - - /** - Returns the number of references of the file server reference type. The file server reference type indicates that the File Server is holding a generic reference on the object on behalf of a client. If this field is not 0, then session information may have been returned. - @return The number of references of the file server reference type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getFileServerReference() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.fileServerReference_; - } - - /** - Returns the number of references of the file server working directory type. The file server working directory type indicates that the object is a directory, and the File Server is holding a working directory reference on it on behalf of a client. If this field is not 0, then session information may have been returned. - @return The number of references of the file server working directory type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getFileServerWorkingDirectory() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.fileServerWorkingDirectory_; - } - - /** - Returns whether the object is currently in-use. If the object is not in use, all of the reference type fields returned are 0. If the object is in use, at least one of the reference type fields is greater than 0. This condition may occur even if the getReferenceCount() value is 0. - @return true if the object is currently in-use; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isInUseIndicator() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return inUseIndicator_; - } - - /** - Returns the number of references of the internal save lock type. The internal save lock type indicates that object is being referenced internally during a save operation on a different object. - @return The number of references of the internal save lock type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getInternalSaveLock() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return simple_.internalSaveLock_; - } - - /** - Returns the number of references of the link changes lock type. The link changes lock type indicates that changes to links in the directory are prevented. - @return The number of references of the link changes lock type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getLinkChangesLock() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return simple_.linkChangesLock_; - } - - /** - Returns the number of references of the read only type. The read only type indicates that the reference has read only access. - @return The number of references of the read only type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getReadOnly() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return simple_.readOnly_; - } - - /** - Returns the number of references of the read only, share with readers only type. The read only, share with readers only type indicates that the reference has read only access. The sharing mode allows sharing with read and execute access intents only. - @return The number of references of the read only, share with readers only type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getReadOnlyShareWithReadersOnly() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.readOnlyShareWithReadersOnly_; - } - - /** - Returns the number of references of the read only, share with readers and writers type. The read only, share with readers and writers type indicates that the reference has read only access. The sharing mode allows sharing with read, execute, and write access intents. - @return The number of references of the read only, share with readers and writers type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getReadOnlyShareWithReadersAndWriters() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.readOnlyShareWithReadersAndWriters_; - } - - /** - Returns the number of references of the read only, share with writers only type. The read only, share with writers only type indicates that the reference has read only access. The sharing mode allows sharing with write access intents only. - @return The number of references of the read only, share with writers only type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getReadOnlyShareWithWritersOnly() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.readOnlyShareWithWritersOnly_; - } - - /** - Returns the number of references of the read only, share with neither readers nor writers type. The read only, share with neither readers nor writers type indicates that the reference has read only access. The sharing mode allows sharing with no other access intents. - @return The number of references of the read only, share with neither readers nor writers type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getReadOnlyShareWithNeitherReadersNorWriters() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.readOnlyShareWithNeitherReadersNorWriters_; - } - - /** - Returns the number of references of the read/write type. The read/write type indicates that the reference has read and write access. - @return The number of references of the read/write type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getReadWrite() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return simple_.readWrite_; - } - - /** - Returns the number of references of the read/write, share with readers only type. The read/write, share with readers only type indicates that the reference has read and write access. The sharing mode allows sharing with read and execute access intents only. - @return The number of references of the read/write, share with readers only type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getReadWriteShareWithReadersOnly() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.readWriteShareWithReadersOnly_; - } - - /** - Returns the number of references of the read/write, share with readers and writers type. The read/write, share with readers and writers type indicates that the reference has read and write access. The sharing mode allows sharing with read, execute, and write access intents. - @return The number of references of the read/write, share with readers and writers type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getReadWriteShareWithReadersAndWriters() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.readWriteShareWithReadersAndWriters_; - } - - /** - Returns the number of references of the read/write, share with writers only type. The read/write, share with writers only type indicates that the reference has read and write access. The sharing mode allows sharing with write access intents only. - @return The number of references of the read/write, share with writers only type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getReadWriteShareWithWritersOnly() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.readWriteShareWithWritersOnly_; - } - - /** - Returns the number of references of the read/write, share with neither readers nor writers type. The read/write, share with neither readers nor writers type indicates that the reference has read and write access. The sharing mode allows sharing with no other access intents. - @return The number of references of the read/write, share with neither readers nor writers type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getReadWriteShareWithNeitherReadersNorWriters() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.readWriteShareWithNeitherReadersNorWriters_; - } - - /** - Returns the current number of references on the object. NOTE: This may be 0 even though the isInUseIndicator() indicates that the object is in use. - @return The current number of references on the object. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getReferenceCount() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return referenceCount_; - } - - /** - Returns the number of references of the root directory type. The root directory type indicates that object is a directory that is being used as the root directory of the job. - @return The number of references of the root directory type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getRootDirectory() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.rootDirectory_; - } - - /** - Returns the number of references of the save lock type. The save lock type indicates that object is being referenced by an object save operation. - @return The number of references of the save lock type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getSaveLock() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return simple_.saveLock_; - } - - /** - Returns the number of references of the share with readers only type. The share with readers only type indicates that the sharing mode allows sharing with read and execute access intents only. - @return The number of references of the share with readers only type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getShareWithReadersOnly() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return simple_.shareWithReadersOnly_; - } - - /** - Returns the number of references of the share with readers and writers type. The share with readers and writers type indicates that the sharing mode allows sharing with read, execute, and write access intents. - @return The number of references of the share with readers and writers type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getShareWithReadersAndWriters() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return simple_.shareWithReadersAndWriters_; - } - - /** - Returns the number of references of the share with writers only type. The share with writers only type indicates that the sharing mode allows sharing with write access intents only. - @return The number of references of the share with writers only type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getShareWithWritersOnly() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return simple_.shareWithWritersOnly_; - } - - /** - Returns the number of references of the share with neither readers nor writers type. The share with neither readers nor writers type indicates that the sharing mode allows sharing with no other access intents. - @return The number of references of the share with neither readers nor writers type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getShareWithNeitherReadersNorWriters() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return simple_.shareWithNeitherReadersNorWriters_; - } - - /** - Returns the number of references of the write only type. The write only type indicates that the reference has write only access. - @return The number of references of the write only type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getWriteOnly() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return simple_.writeOnly_; - } - - /** - Returns the number of references of the write only, share with readers only type. The write only, share with readers only type indicates that the reference has write only access. The sharing mode allows sharing with read and execute access intents only. - @return The number of references of the write only, share with readers only type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getWriteOnlyShareWithReadersOnly() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.writeOnlyShareWithReadersOnly_; - } - - /** - Returns the number of references of the write only, share with readers and writers type. The write only, share with readers and writers type indicates that the reference has write only access. The sharing mode allows sharing with read, execute, and write access intents. - @return The number of references of the write only, share with readers and writers type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getWriteOnlyShareWithReadersAndWriters() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.writeOnlyShareWithReadersAndWriters_; - } - - /** - Returns the number of references of the write only, share with writers only type. The write only, share with writers only type indicates that the reference has write only access. The sharing mode allows sharing with write access intents only. - @return The number of references of the write only, share with writers only type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getWriteOnlyShareWithWritersOnly() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.writeOnlyShareWithWritersOnly_; - } - - /** - Returns the number of references of the write only, share with neither readers nor writers type. The write only, share with neither readers nor writers type indicates that the reference has write only access. The sharing mode allows sharing with no other access intents. - @return The number of references of the write only, share with neither readers nor writers type. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getWriteOnlyShareWithNeitherReadersNorWriters() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return extended_.writeOnlyShareWithNeitherReadersNorWriters_; - } - - /** - Returns information about the jobs that are known to be holding a reference on the object. - @return Information about the jobs that are known to be holding a reference on the object. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public JobUsingObjectStructure[] getJobUsingObjectStructures() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - retrieve(); - return jobs_; - } - - /** - Refreshes the attributes from the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void refresh() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - attributesRetrieved_ = false; - retrieve(); - } - - // Call the QP0LROR API if necessary. - private void retrieve() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (attributesRetrieved_) return; - - int vrm = system_.getVRM(); - - int bufferSizeProvided = 2048; - ProgramParameter[] parameters = new ProgramParameter[] - { - // void *Receiver_Ptr, output. - new ProgramParameter(bufferSizeProvided), - // unsigned int Receiver_Length, input. - new ProgramParameter(BinaryConverter.intToByteArray(bufferSizeProvided)), - // char *Format_Ptr, input, EBCDIC 'ROR00200'. - new ProgramParameter(new byte[] { (byte)0xD9, (byte)0xD6, (byte)0xD9, (byte)0xD6, (byte)0xF0, (byte)0xF2, (byte)0xF0, (byte)0xF0 } ), - // Qlg_Path_Name_T *Path_Ptr. - new ProgramParameter(createPathName()), - // void *Error_Code_Ptr. - new ProgramParameter(new byte[8]), - }; - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QP0LROR.PGM", parameters); - // QP0LROR is not thread safe. - boolean repeatRun; - byte[] receiverVariable; - do - { - repeatRun = false; - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - - receiverVariable = parameters[0].getOutputData(); - - int bytesReturned = BinaryConverter.byteArrayToInt(receiverVariable, 0); - int bytesAvailable = BinaryConverter.byteArrayToInt(receiverVariable, 4); - if (bytesReturned < bytesAvailable) - { - repeatRun = true; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieve object references receiver variable too small, bytes returned: " + bytesReturned + ", bytes available: " + bytesAvailable); - parameters[0] = new ProgramParameter(bytesAvailable); - parameters[1] = new ProgramParameter(BinaryConverter.intToByteArray(bytesAvailable)); - } - } - while (repeatRun); - attributesRetrieved_ = true; - - Converter conv = new Converter(system_.getJobCcsid(), system_); - - referenceCount_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, 8); - inUseIndicator_ = BinaryConverter.byteArrayToInt(receiverVariable, 12) == 0x01; - int offsetToSimpleReferenceTypes = BinaryConverter.byteArrayToInt(receiverVariable, 16); - //int lengthOfSimpleReferenceTypes = BinaryConverter.byteArrayToInt(receiverVariable, 20); - int offsetToExtendedReferenceTypes = BinaryConverter.byteArrayToInt(receiverVariable, 24); - //int lengthOfExtendedReferenceTypes = BinaryConverter.byteArrayToInt(receiverVariable, 28); - int offsetToJobList = BinaryConverter.byteArrayToInt(receiverVariable, 32); - int jobsReturned = BinaryConverter.byteArrayToInt(receiverVariable, 36); - if (Trace.traceOn_) - { - int jobsAvailable = BinaryConverter.byteArrayToInt(receiverVariable, 40); - if (jobsAvailable > jobsReturned) - { - Trace.log(Trace.WARNING, "Retrieve object references receiver variable too small, jobs returned: " + jobsReturned + ", jobs available: " + jobsAvailable); - } - } - - simple_ = new SimpleObjectReferenceTypesStructure(receiverVariable, offsetToSimpleReferenceTypes, conv); - extended_ = new ExtendedObjectReferenceTypesStructure(receiverVariable, offsetToExtendedReferenceTypes, conv); - jobs_ = new JobUsingObjectStructure[jobsReturned]; - for (int i = 0; i < jobsReturned; ++i) - { - jobs_[i] = new JobUsingObjectStructure(receiverVariable, offsetToJobList, conv, vrm); - offsetToJobList += jobs_[i].displacementToNextJobEntry_; - } - } - - private static final class SimpleObjectReferenceTypesStructure - { - // Read Only. - long readOnly_; - // Write Only. - long writeOnly_; - // Read/Write. - long readWrite_; - // Execute. - long execute_; - // Share with Readers Only. - long shareWithReadersOnly_; - // Share with Writers Only. - long shareWithWritersOnly_; - // Share with Readers and Writers. - long shareWithReadersAndWriters_; - // Share with neither Readers nor Writers. - long shareWithNeitherReadersNorWriters_; - // Attribute Lock. - long attributeLock_; - // Save Lock. - long saveLock_; - // Internal Save Lock. - long internalSaveLock_; - // Link Changes Lock. - long linkChangesLock_; - // Checked Out. - long checkedOut_; - // Checked Out User Name. - String checkedOutUserName_; - - SimpleObjectReferenceTypesStructure(byte[] receiverVariable, int offset, Converter conv) - { - readOnly_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset); - writeOnly_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 4); - readWrite_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 8); - execute_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 12); - shareWithReadersOnly_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 16); - shareWithWritersOnly_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 20); - shareWithReadersAndWriters_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 24); - shareWithNeitherReadersNorWriters_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 28); - attributeLock_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 32); - saveLock_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 36); - internalSaveLock_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 40); - linkChangesLock_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 44); - checkedOut_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 48); - checkedOutUserName_ = conv.byteArrayToString(receiverVariable, offset + 52, 10).trim(); - } - } - - private static final class ExtendedObjectReferenceTypesStructure - { - // Read Only, Share with Readers Only. - long readOnlyShareWithReadersOnly_; - // Read Only, Share with Writers Only. - long readOnlyShareWithWritersOnly_; - // Read Only, Share with Readers and Writers. - long readOnlyShareWithReadersAndWriters_; - // Read Only, Share with neither Readers nor Writers. - long readOnlyShareWithNeitherReadersNorWriters_; - // Write Only, Share with Readers Only. - long writeOnlyShareWithReadersOnly_; - // Write Only, Share with Writers Only. - long writeOnlyShareWithWritersOnly_; - // Write Only, Share with Readers and Writers. - long writeOnlyShareWithReadersAndWriters_; - // Write Only, Share with neither Readers nor Writers. - long writeOnlyShareWithNeitherReadersNorWriters_; - // Read/Write, Share with Readers Only. - long readWriteShareWithReadersOnly_; - // Read/Write, Share with Writers Only. - long readWriteShareWithWritersOnly_; - // Read/Write, Share with Readers and Writers. - long readWriteShareWithReadersAndWriters_; - // Read/Write, Share with neither Readers nor Writers. - long readWriteShareWithNeitherReadersNorWriters_; - // Execute, Share with Readers Only. - long executeShareWithReadersOnly_; - // Execute, Share with Writers Only. - long executeShareWithWritersOnly_; - // Execute, Share with Readers and Writers. - long executeShareWithReadersAndWriters_; - // Execute, Share with neither Readers nor Writers. - long executeShareWithNeitherReadersNorWriters_; - // Execute/Read, Share with Readers Only. - long executeReadShareWithReadersOnly_; - // Execute/Read, Share with Writers Only. - long executeReadShareWithWritersOnly_; - // Execute/Read, Share with Readers and Writers. - long executeReadShareWithReadersAndWriters_; - // Execute/Read, Share with neither Readers nor Writers. - long executeReadShareWithNeitherReadersNorWriters_; - // Attribute Lock. - //long attributeLock_; - // Save Lock. - //long saveLock_; - // Internal Save Lock. - //long internalSaveLock_; - // Link Changes Lock. - //long linkChangesLock_; - // Current Directory. - long currentDirectory_; - // Root Directory. - long rootDirectory_; - // File Server Reference. - long fileServerReference_; - // File Server Working Directory. - long fileServerWorkingDirectory_; - // Checked Out. - //long checkedOut_; - // Checked Out User Name. - //String checkedOutUserName_; - - ExtendedObjectReferenceTypesStructure(byte[] receiverVariable, int offset, Converter conv) - { - readOnlyShareWithReadersOnly_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset); - readOnlyShareWithWritersOnly_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 4); - readOnlyShareWithReadersAndWriters_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 8); - readOnlyShareWithNeitherReadersNorWriters_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 12); - writeOnlyShareWithReadersOnly_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 16); - writeOnlyShareWithWritersOnly_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 20); - writeOnlyShareWithReadersAndWriters_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 24); - writeOnlyShareWithNeitherReadersNorWriters_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 28); - readWriteShareWithReadersOnly_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 32); - readWriteShareWithWritersOnly_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 36); - readWriteShareWithReadersAndWriters_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 40); - readWriteShareWithNeitherReadersNorWriters_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 44); - executeShareWithReadersOnly_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 48); - executeShareWithWritersOnly_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 52); - executeShareWithReadersAndWriters_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 56); - executeShareWithNeitherReadersNorWriters_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 60); - executeReadShareWithReadersOnly_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 64); - executeReadShareWithWritersOnly_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 68); - executeReadShareWithReadersAndWriters_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 72); - executeReadShareWithNeitherReadersNorWriters_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 76); - // attributeLock_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 80); - // saveLock_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 84); - // internalSaveLock_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 88); - // linkChangesLock_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 92); - currentDirectory_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 96); - rootDirectory_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 100); - fileServerReference_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 104); - fileServerWorkingDirectory_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 108); - // checkedOut_ = BinaryConverter.byteArrayToUnsignedInt(receiverVariable, offset + 112); - // checkedOutUserName_ = conv.byteArrayToString(receiverVariable, offset + 116, 10).trim(); - } - } - - /** - Contains information about the jobs that are known to be holding a reference on the object. - **/ - public static class JobUsingObjectStructure - { - // Displacement to Next Job Entry. - private int displacementToNextJobEntry_; - // Job Name. - private String jobName_; - // Job User. - private String jobUser_; - // Job Number. - private String jobNumber_; - // Simple reference types structure. - private SimpleObjectReferenceTypesStructure jobSimple_; - // Extended reference types structure. - private ExtendedObjectReferenceTypesStructure jobExtended_; - // Session Using Object Structure. - private SessionUsingObjectStructure[] sessions_; - - /** - Returns the name of the job. - @return The name of the job. - **/ - public String getJobName() - { - return jobName_; - } - - /** - Returns the number associated with the job. - @return The number associated with the job. - **/ - public String getJobNumber() - { - return jobNumber_; - } - - /** - Returns the user profile associated with the job. - @return The user profile associated with the job. - **/ - public String getJobUser() - { - return jobUser_; - } - - /** - Returns the number of references within this specific job of the attribute lock type. The attribute lock type indicates that attribute changes are prevented. - @return The number of references within this specific job of the attribute lock type. - **/ - public long getAttributeLock() - { - return jobSimple_.attributeLock_; - } - - /** - Returns an indication of whether the object is currently checked out within this specific job. If it is checked out, then getCheckedOutUserName() returns the name of the user who has it checked out. - @return An indication of whether the object is currently checked out within this specific job. - **/ - public long getCheckedOut() - { - return jobSimple_.checkedOut_; - } - - /** - Returns the name of the user who has the object checked out within this specific job. An empty string ("") is returned if the object is not checked out. - @return The name of the user who has the object checked out within this specific job. - **/ - public String getCheckedOutUserName() - { - return jobSimple_.checkedOutUserName_; - } - - /** - Returns the number of references within this specific job of the current directory type. The current directory type indicates that object is a directory that is being used as the current directory of the job. - @return The number of references within this specific job of the current directory type. - **/ - public long getCurrentDirectory() - { - return jobExtended_.currentDirectory_; - } - - /** - Returns the number of references within this specific job of the execute type. The execute type indicates that the reference has execute only access. - @return The number of references within this specific job of the execute type. - **/ - public long getExecute() - { - return jobSimple_.execute_; - } - - /** - Returns the number of references within this specific job of the execute, share with readers only type. The execute, share with readers only type indicates that the reference has execute only access. The sharing mode allows sharing with read and execute access intents only. - @return The number of references within this specific job of the execute, share with readers only type. - **/ - public long getExecuteShareWithReadersOnly() - { - return jobExtended_.executeShareWithReadersOnly_; - } - - /** - Returns the number of references within this specific job of the execute, share with readers and writers type. The execute, share with readers and writers type indicates that the reference has execute only access. The sharing mode allows sharing with read, execute, and write access intents. - @return The number of references within this specific job of the execute, share with readers and writers type. - **/ - public long getExecuteShareWithReadersAndWriters() - { - return jobExtended_.executeShareWithReadersAndWriters_; - } - - /** - Returns the number of references within this specific job of the execute, share with writers only type. The execute, share with writers only type indicates that the reference has execute only access. The sharing mode allows sharing with write access intents only. - @return The number of references within this specific job of the execute, share with writers only type. - **/ - public long getExecuteShareWithWritersOnly() - { - return jobExtended_.executeShareWithWritersOnly_; - } - - /** - Returns the number of references within this specific job of the execute, share with neither readers nor writers type. The execute, share with neither readers nor writers type indicates that the reference has execute only access. The sharing mode allows sharing with no other access intents. - @return The number of references within this specific job of the execute, share with neither readers nor writers type. - **/ - public long getExecuteShareWithNeitherReadersNorWriters() - { - return jobExtended_.executeShareWithNeitherReadersNorWriters_; - } - - /** - Returns the number of references within this specific job of the execute/read, share with readers only type. The execute/read, share with readers only type indicates that the reference has execute and read access. The sharing mode allows sharing with read and execute access intents only. - @return The number of references within this specific job of the execute/read, share with readers only type. - **/ - public long getExecuteReadShareWithReadersOnly() - { - return jobExtended_.executeReadShareWithReadersOnly_; - } - - /** - Returns the number of references within this specific job of the execute/read, share with readers and writers type. The execute/read, share with readers and writers type indicates that the reference has execute and read access. The sharing mode allows sharing with read, execute, and write access intents. - @return The number of references within this specific job of the execute/read, share with readers and writers type. - **/ - public long getExecuteReadShareWithReadersAndWriters() - { - return jobExtended_.executeReadShareWithReadersAndWriters_; - } - - /** - Returns the number of references within this specific job of the execute/read, share with writers only type. The execute/read, share with writers only type indicates that the reference has execute and read access. The sharing mode allows sharing with write access intents only. - @return The number of references within this specific job of the execute/read, share with writers only type. - **/ - public long getExecuteReadShareWithWritersOnly() - { - return jobExtended_.executeReadShareWithWritersOnly_; - } - - /** - Returns the number of references within this specific job of the execute/read, share with neither readers nor writers type. The execute/read, share with neither readers nor writers type indicates that the reference has execute and read access. The sharing mode allows sharing with no other access intents. - @return The number of references within this specific job of the execute/read, share with neither readers nor writers type. - **/ - public long getExecuteReadShareWithNeitherReadersNorWriters() - { - return jobExtended_.executeReadShareWithNeitherReadersNorWriters_; - } - - /** - Returns the number of references within this specific job of the file server reference type. The file server reference type indicates that the File Server is holding a generic reference on the object on behalf of a client. If this field is not 0, then session information may have been returned. - @return The number of references within this specific job of the file server reference type. - **/ - public long getFileServerReference() - { - return jobExtended_.fileServerReference_; - } - - /** - Returns the number of references within this specific job of the file server working directory type. The file server working directory type indicates that the object is a directory, and the File Server is holding a working directory reference on it on behalf of a client. If this field is not 0, then session information may have been returned. - @return The number of references within this specific job of the file server working directory type. - **/ - public long getFileServerWorkingDirectory() - { - return jobExtended_.fileServerWorkingDirectory_; - } - - /** - Returns the number of references within this specific job of the internal save lock type. The internal save lock type indicates that object is being referenced internally during a save operation on a different object. - @return The number of references within this specific job of the internal save lock type. - **/ - public long getInternalSaveLock() - { - return jobSimple_.internalSaveLock_; - } - - /** - Returns the number of references within this specific job of the link changes lock type. The link changes lock type indicates that changes to links in the directory are prevented. - @return The number of references within this specific job of the link changes lock type. - **/ - public long getLinkChangesLock() - { - return jobSimple_.linkChangesLock_; - } - - /** - Returns the number of references within this specific job of the read only type. The read only type indicates that the reference has read only access. - @return The number of references within this specific job of the read only type. - **/ - public long getReadOnly() - { - return jobSimple_.readOnly_; - } - - /** - Returns the number of references within this specific job of the read only, share with readers only type. The read only, share with readers only type indicates that the reference has read only access. The sharing mode allows sharing with read and execute access intents only. - @return The number of references within this specific job of the read only, share with readers only type. - **/ - public long getReadOnlyShareWithReadersOnly() - { - return jobExtended_.readOnlyShareWithReadersOnly_; - } - - /** - Returns the number of references within this specific job of the read only, share with readers and writers type. The read only, share with readers and writers type indicates that the reference has read only access. The sharing mode allows sharing with read, execute, and write access intents. - @return The number of references within this specific job of the read only, share with readers and writers type. - **/ - public long getReadOnlyShareWithReadersAndWriters() - { - return jobExtended_.readOnlyShareWithReadersAndWriters_; - } - - /** - Returns the number of references within this specific job of the read only, share with writers only type. The read only, share with writers only type indicates that the reference has read only access. The sharing mode allows sharing with write access intents only. - @return The number of references within this specific job of the read only, share with writers only type. - **/ - public long getReadOnlyShareWithWritersOnly() - { - return jobExtended_.readOnlyShareWithWritersOnly_; - } - - /** - Returns the number of references within this specific job of the read only, share with neither readers nor writers type. The read only, share with neither readers nor writers type indicates that the reference has read only access. The sharing mode allows sharing with no other access intents. - @return The number of references within this specific job of the read only, share with neither readers nor writers type. - **/ - public long getReadOnlyShareWithNeitherReadersNorWriters() - { - return jobExtended_.readOnlyShareWithNeitherReadersNorWriters_; - } - - /** - Returns the number of references within this specific job of the read/write type. The read/write type indicates that the reference has read and write access. - @return The number of references within this specific job of the read/write type. - **/ - public long getReadWrite() - { - return jobSimple_.readWrite_; - } - - /** - Returns the number of references within this specific job of the read/write, share with readers only type. The read/write, share with readers only type indicates that the reference has read and write access. The sharing mode allows sharing with read and execute access intents only. - @return The number of references within this specific job of the read/write, share with readers only type. - **/ - public long getReadWriteShareWithReadersOnly() - { - return jobExtended_.readWriteShareWithReadersOnly_; - } - - /** - Returns the number of references within this specific job of the read/write, share with readers and writers type. The read/write, share with readers and writers type indicates that the reference has read and write access. The sharing mode allows sharing with read, execute, and write access intents. - @return The number of references within this specific job of the read/write, share with readers and writers type. - **/ - public long getReadWriteShareWithReadersAndWriters() - { - return jobExtended_.readWriteShareWithReadersAndWriters_; - } - - /** - Returns the number of references within this specific job of the read/write, share with writers only type. The read/write, share with writers only type indicates that the reference has read and write access. The sharing mode allows sharing with write access intents only. - @return The number of references within this specific job of the read/write, share with writers only type. - **/ - public long getReadWriteShareWithWritersOnly() - { - return jobExtended_.readWriteShareWithWritersOnly_; - } - - /** - Returns the number of references within this specific job of the read/write, share with neither readers nor writers type. The read/write, share with neither readers nor writers type indicates that the reference has read and write access. The sharing mode allows sharing with no other access intents. - @return The number of references within this specific job of the read/write, share with neither readers nor writers type. - **/ - public long getReadWriteShareWithNeitherReadersNorWriters() - { - return jobExtended_.readWriteShareWithNeitherReadersNorWriters_; - } - - /** - Returns the number of references within this specific job of the root directory type. The root directory type indicates that object is a directory that is being used as the root directory of the job. - @return The number of references within this specific job of the root directory type. - **/ - public long getRootDirectory() - { - return jobExtended_.rootDirectory_; - } - - /** - Returns the number of references within this specific job of the save lock type. The save lock type indicates that object is being referenced by an object save operation. - @return The number of references within this specific job of the save lock type. - **/ - public long getSaveLock() - { - return jobSimple_.saveLock_; - } - - /** - Returns the number of references within this specific job of the share with readers only type. The share with readers only type indicates that the sharing mode allows sharing with read and execute access intents only. - @return The number of references within this specific job of the share with readers only type. - **/ - public long getShareWithReadersOnly() - { - return jobSimple_.shareWithReadersOnly_; - } - - /** - Returns the number of references within this specific job of the share with readers and writers type. The share with readers and writers type indicates that the sharing mode allows sharing with read, execute, and write access intents. - @return The number of references within this specific job of the share with readers and writers type. - **/ - public long getShareWithReadersAndWriters() - { - return jobSimple_.shareWithReadersAndWriters_; - } - - /** - Returns the number of references within this specific job of the share with writers only type. The share with writers only type indicates that the sharing mode allows sharing with write access intents only. - @return The number of references within this specific job of the share with writers only type. - **/ - public long getShareWithWritersOnly() - { - return jobSimple_.shareWithWritersOnly_; - } - - /** - Returns the number of references within this specific job of the share with neither readers nor writers type. The share with neither readers nor writers type indicates that the sharing mode allows sharing with no other access intents. - @return The number of references within this specific job of the share with neither readers nor writers type. - **/ - public long getShareWithNeitherReadersNorWriters() - { - return jobSimple_.shareWithNeitherReadersNorWriters_; - } - - /** - Returns the number of references within this specific job of the write only type. The write only type indicates that the reference has write only access. - @return The number of references within this specific job of the write only type. - **/ - public long getWriteOnly() - { - return jobSimple_.writeOnly_; - } - - /** - Returns the number of references within this specific job of the write only, share with readers only type. The write only, share with readers only type indicates that the reference has write only access. The sharing mode allows sharing with read and execute access intents only. - @return The number of references within this specific job of the write only, share with readers only type. - **/ - public long getWriteOnlyShareWithReadersOnly() - { - return jobExtended_.writeOnlyShareWithReadersOnly_; - } - - /** - Returns the number of references within this specific job of the write only, share with readers and writers type. The write only, share with readers and writers type indicates that the reference has write only access. The sharing mode allows sharing with read, execute, and write access intents. - @return The number of references within this specific job of the write only, share with readers and writers type. - **/ - public long getWriteOnlyShareWithReadersAndWriters() - { - return jobExtended_.writeOnlyShareWithReadersAndWriters_; - } - - /** - Returns the number of references within this specific job of the write only, share with writers only type. The write only, share with writers only type indicates that the reference has write only access. The sharing mode allows sharing with write access intents only. - @return The number of references within this specific job of the write only, share with writers only type. - **/ - public long getWriteOnlyShareWithWritersOnly() - { - return jobExtended_.writeOnlyShareWithWritersOnly_; - } - - /** - Returns the number of references within this specific job of the write only, share with neither readers nor writers type. The write only, share with neither readers nor writers type indicates that the reference has write only access. The sharing mode allows sharing with no other access intents. - @return The number of references within this specific job of the write only, share with neither readers nor writers type. - **/ - public long getWriteOnlyShareWithNeitherReadersNorWriters() - { - return jobExtended_.writeOnlyShareWithNeitherReadersNorWriters_; - } - - /** - Returns information about the sessions that are known to be holding a reference on the object. - @return Information about the sessions that are known to be holding a reference on the object. - **/ - public SessionUsingObjectStructure[] getSessionUsingObjectStructures() - { - return sessions_; - } - - private JobUsingObjectStructure(byte[] receiverVariable, int offset, Converter conv, int vrm) - { - int displacementToSimpleReferenceTypes = BinaryConverter.byteArrayToInt(receiverVariable, offset); - //int lengthOfSimpleReferenceTypes = BinaryConverter.byteArrayToInt(receiverVariable, offset + 4); - int displacementToExtendedReferenceTypes = BinaryConverter.byteArrayToInt(receiverVariable, offset + 8); - int lengthOfExtendedReferenceTypes = BinaryConverter.byteArrayToInt(receiverVariable, offset + 12); - displacementToNextJobEntry_ = BinaryConverter.byteArrayToInt(receiverVariable, offset + 16); - jobName_ = conv.byteArrayToString(receiverVariable, offset + 20, 10).trim(); - jobUser_ = conv.byteArrayToString(receiverVariable, offset + 30, 10).trim(); - jobNumber_ = conv.byteArrayToString(receiverVariable, offset + 40, 6).trim(); - jobSimple_ = new SimpleObjectReferenceTypesStructure(receiverVariable, offset + displacementToSimpleReferenceTypes, conv); - jobExtended_ = new ExtendedObjectReferenceTypesStructure(receiverVariable, offset + displacementToExtendedReferenceTypes, conv); - if (vrm < 0x00050400) - { - sessions_ = new SessionUsingObjectStructure[0]; - } - else - { - int displacementToSessionList = BinaryConverter.byteArrayToInt(receiverVariable, offset + 48); - int sessionsReturned = BinaryConverter.byteArrayToInt(receiverVariable, offset + 52); - sessions_ = new SessionUsingObjectStructure[sessionsReturned]; - for (int i = 0; i < sessionsReturned; ++i) - { - sessions_[i] = new SessionUsingObjectStructure(receiverVariable, offset + displacementToSessionList, conv); - displacementToSessionList += sessions_[i].displacementToNextSessionEntry_; - } - } - } - } - - /** - Contains information about the sessions that are known to be holding a reference on the object. - **/ - public static class SessionUsingObjectStructure - { - // Session identifier. - private byte[] sessionIdentifier_; - // Displacement to Next Session Entry. - private int displacementToNextSessionEntry_; - // User Name. - private String userName_; - // Workstation Name. - private String workstationName_; - // Workstation Address. - private String workstationAddress_; - - /** - Returns the unique identifier for the session. - @return The unique identifier for the session. - **/ - public byte[] getSessionIdentifier() - { - return sessionIdentifier_; - } - - /** - Returns the name of the user that is associated with the session. - @return The name of the user that is associated with the session. - **/ - public String getUserName() - { - return userName_; - } - - /** - Returns the IP address of the workstation from which the session to the system was established. If this information is not available, an empty string ("") is returned. - @return The IP address of the workstation from which the session to the system was established. - **/ - public String getWorkstationAddress() - { - return workstationAddress_; - } - - /** - Returns the name of the workstation from which the session to the system was established. If this information is not available, an empty string ("") is returned. - @return The name of the workstation from which the session to the system was established. - **/ - public String getWorkstationName() - { - return workstationName_; - } - - private SessionUsingObjectStructure(byte[] receiverVariable, int offset, Converter conv) - { - sessionIdentifier_ = new byte[8]; - System.arraycopy(receiverVariable, offset, sessionIdentifier_, 0, 8); - displacementToNextSessionEntry_ = BinaryConverter.byteArrayToInt(receiverVariable, offset + 8); - userName_ = conv.byteArrayToString(receiverVariable, offset + 12, 10).trim(); - workstationName_ = conv.byteArrayToString(receiverVariable, offset + 22, 15).trim(); - workstationAddress_ = conv.byteArrayToString(receiverVariable, offset + 37, 45).trim(); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/OutputQueue.java b/cvsroot/src/com/ibm/as400/access/OutputQueue.java deleted file mode 100644 index aa1faaca1..000000000 --- a/cvsroot/src/com/ibm/as400/access/OutputQueue.java +++ /dev/null @@ -1,408 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputQueue.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.util.Vector; -import java.beans.PropertyVetoException; - -/** - * The OutputQueue class represents an output queue. - * An instance of this class can be used to manipulate an individual - * output queue (hold, release, clear, and so on). - * - * See Output Queue Attributes for - * valid attributes. - * - **/ - -public class OutputQueue extends PrintObject -implements java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - private static final String PATH = "path"; - transient private Vector outputQueueListeners_ = new Vector(); - - - // constructor used internally (not externalized since it takes - // an ID code point - OutputQueue(AS400 system, NPCPIDOutQ id, NPCPAttribute attrs) - { - super(system, id, attrs, NPConstants.OUTPUT_QUEUE); - } - - - - /** - * Constructs an OutputQueue object. The system and the - * integrated file system name of the output queue must be set - * later. This constructor is provided for visual application - * builders that support JavaBeans. It is not intended for use - * by application programmers. - * - * @see PrintObject#setSystem - * @see #setPath - **/ - public OutputQueue() - { - super(null, null, NPConstants.OUTPUT_QUEUE); - - // Because of this constructor we will need to check the - // run time state of OutputQueue objects. - } - - - - /** - * Constructs an OutputQueue object. It uses the specified system and - * output queue name that identifies it on that system. - * - * @param system The system on which this output queue exists. - * @param queueName The integrated file system name of the output queue. The format of - * the queue string must be in the format of /QSYS.LIB/libname.LIB/queuename.OUTQ. - * - **/ - public OutputQueue(AS400 system, - String queueName) - { - super(system, buildIDCodePoint(queueName), null, NPConstants.OUTPUT_QUEUE); - // base class constructor checks for null system. - // QSYSObjectPathName() checks for a null queueName. - } - - - - /** - *Adds the specified OutputQueue listener to receive - *OutputQueue events from this OutputQueue. - * - * @see #removeOutputQueueListener - * @param listener The OutputQueue listener. - **/ - public void addOutputQueueListener( OutputQueueListener listener ) - { - outputQueueListeners_.addElement(listener); - } - - - - private static NPCPIDOutQ buildIDCodePoint(String IFSQueueName) - { - QSYSObjectPathName ifsPath = new QSYSObjectPathName(IFSQueueName, "OUTQ"); - - return new NPCPIDOutQ(ifsPath.getObjectName(), ifsPath.getLibraryName()); - } - - - - // Check the run time state - void checkRunTimeState() - { - // check whatever the base class needs to check - super.checkRunTimeState(); - - // OutputQueue's need to additionally check the IFS pathname. - if( getIDCodePoint() == null ) - { - Trace.log(Trace.ERROR, "Parameter 'path' has not been set."); - throw new ExtendedIllegalStateException( - PATH, ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - - - - // A1A - Added function - /** - * Chooses the implementation - **/ - void chooseImpl() - throws IOException, AS400SecurityException - { - // We need to get the system to connect to... - AS400 system = getSystem(); - if (system == null) { - Trace.log( Trace.ERROR, "Attempt to use OutputQueue before setting system." ); - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - impl_ = (OutputQueueImpl) system.loadImpl2("com.ibm.as400.access.OutputQueueImplRemote", - "com.ibm.as400.access.OutputQueueImplProxy"); - super.setImpl(); - } - - - - /** - * Clears the output queue on the system. - * - * @param clearOptions A PrintParameterList object that may have any of the - * following attributes set: - *

      - *
    • - * ATTR_JOBUSER - Clear output queue by a user id. May be a specific userid, "*ALL" or - * "*CURRENT". "*CURRENT" is the default. - *
    • - * ATTR_FORMTYPE - Clear output queue by a form type. May be a specific form type, "*ALL" or - * "*STD". "*ALL" is the default. - *
    • - * ATTR_USERDATA - Clear output queue by user data. May be a specific user data or "*ALL". - * "*ALL" is the default. - *
    - * clearOptions may be null. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system operating system is not at the correct level. - **/ - public void clear(PrintParameterList clearOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - checkRunTimeState(); - - if (impl_ == null) - chooseImpl(); - ((OutputQueueImpl) impl_).clear(clearOptions); - // update the attrs, since updateAttrs was - // called on the remote side... - attrs = impl_.getAttrValue(); - - fireOutputQueueEvent(OutputQueueEvent.CLEARED); - - } // end clear - - - - // The JavaBeans 1.0 Specification strongly recommends to avoid - // using a synchronized method to fire an event. We use a - // synchronized block to locate the target listeners and then - // call the event listeners from unsynchronized code. - private void fireOutputQueueEvent( int id ) - { - // Return if no listeners are registered. - if( outputQueueListeners_.isEmpty() ) - { - return; - } - - Vector l; - OutputQueueEvent event = new OutputQueueEvent(this, id); - - synchronized(this) { l = (Vector)outputQueueListeners_.clone(); } - - for( int i=0; i < l.size(); i++ ) - { - switch(id) - { - case OutputQueueEvent.CLEARED: - ((OutputQueueListener)l.elementAt(i)).outputQueueCleared(event); - break; - - case OutputQueueEvent.HELD: - ((OutputQueueListener)l.elementAt(i)).outputQueueHeld(event); - break; - - case OutputQueueEvent.RELEASED: - ((OutputQueueListener)l.elementAt(i)).outputQueueReleased(event); - break; - } - } - } - - - - /** - * Returns the name of the output queue. - * - * @return The name of the output queue. - **/ - public String getName() - { - NPCPID IDCodePoint = getIDCodePoint(); - - if( IDCodePoint == null ) { - return EMPTY_STRING; // "" - } else { - return IDCodePoint.getStringValue(ATTR_OUTQUE); - } - } - - - - /** - * Returns the integrated file system pathname of the output queue. - * - * @return The integrated file system pathname of the output queue. - **/ - public String getPath() - { - NPCPID IDCodePoint = getIDCodePoint(); - - if( IDCodePoint == null ) { - return EMPTY_STRING; // "" - } else { - return QSYSObjectPathName.toPath( - IDCodePoint.getStringValue(ATTR_OUTQUELIB), // library name - IDCodePoint.getStringValue(ATTR_OUTQUE), // queue name - "OUTQ" ); // type - } - } - - - - /** - * Holds the output queue on the system. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system operating system is not at the correct level. - **/ - public void hold() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - checkRunTimeState(); - - if (impl_ == null) - chooseImpl(); - ((OutputQueueImpl) impl_).hold(); - // update the attrs, since updateAttrs was - // called on the remote side... - attrs = impl_.getAttrValue(); - - fireOutputQueueEvent(OutputQueueEvent.HELD); - - } // end hold - - - - // We need to initialize our transient and static data when - // the object is de-serialized. static final data is OK. - private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - outputQueueListeners_ = new Vector(); - } - - - - /** - * Releases a held output queue on the system. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system operating system is not at the correct level. - **/ - public void release() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - checkRunTimeState(); - - if (impl_ == null) - chooseImpl(); - ((OutputQueueImpl) impl_).release(); - // update the attrs, since updateAttrs was - // called on the remote side... - attrs = impl_.getAttrValue(); - - fireOutputQueueEvent(OutputQueueEvent.RELEASED); - - } // end release - - - - /** - *Removes the specified OutputQueue listener - *so that it no longer receives OutputQueue events - *from this OutputQueue. - * - * @see #addOutputQueueListener - * @param listener The OutputQueue listener. - **/ - public void removeOutputQueueListener( OutputQueueListener listener ) - { - outputQueueListeners_.removeElement(listener); - } - - - - /** - * Sets the integrated file system pathname of the output queue. - * - * @param path The integrated file system pathname of the output queue. The format of - * the queue string must be in the format of /QSYS.LIB/libname.LIB/queuename.OUTQ. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setPath(String path) - throws PropertyVetoException - { - if( path == null ) - { - Trace.log( Trace.ERROR, "Parameter 'path' is null" ); - throw new NullPointerException( PATH ); - } - - // check for connection... - if (impl_ != null) { - Trace.log(Trace.ERROR, "Cannot set property 'Path' after connect."); - throw new ExtendedIllegalStateException(PATH, ExtendedIllegalStateException.PROPERTY_NOT_CHANGED ); - } - - String oldPath = getPath(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( PATH, oldPath, path ); - - // No one vetoed, make the change. - setIDCodePoint(buildIDCodePoint(path)); - - // Notify any property change listeners. - changes.firePropertyChange( PATH, oldPath, path ); - } - -} // end OutputQueue class diff --git a/cvsroot/src/com/ibm/as400/access/OutputQueue16.gif b/cvsroot/src/com/ibm/as400/access/OutputQueue16.gif deleted file mode 100644 index b6e76ad5c..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/OutputQueue16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/OutputQueue32.gif b/cvsroot/src/com/ibm/as400/access/OutputQueue32.gif deleted file mode 100644 index c2dc6ee01..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/OutputQueue32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/OutputQueueBeanInfo.java b/cvsroot/src/com/ibm/as400/access/OutputQueueBeanInfo.java deleted file mode 100644 index 510aeafc0..000000000 --- a/cvsroot/src/com/ibm/as400/access/OutputQueueBeanInfo.java +++ /dev/null @@ -1,206 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputQueueBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; -import java.awt.Image; - -/** -BeanInfo for OutputQueue class. -**/ -public class OutputQueueBeanInfo extends PrintObjectBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Additional events defined for OutputQueue - private static EventSetDescriptor[] outQEvents_; - - // Additional properties defined for OutputQueue - private static PropertyDescriptor[] outQProperties_; - - // Class this bean info represents. - private final static Class beanClass = OutputQueue.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader rbl_; - - static - { - try - { - // "name" is not a property, hide it from introspection. - PropertyDescriptor name = - new PropertyDescriptor( "name", beanClass, "getName", null ); - name.setHidden(true); - - PropertyDescriptor path = - new PropertyDescriptor("path", beanClass); - path.setBound(true); - path.setConstrained(true); - path.setDisplayName(rbl_.getText("PROP_NAME_PATH")); - path.setShortDescription(rbl_.getText("PROP_DESC_PATH")); - - PropertyDescriptor[] properties = {name, path}; - outQProperties_ = properties; - - String[] listenerMethods = { "outputQueueCleared", - "outputQueueHeld", - "outputQueueReleased" }; - EventSetDescriptor outQ = - new EventSetDescriptor ( beanClass, - "outputQueue", - com.ibm.as400.access.OutputQueueListener.class, - listenerMethods, - "addOutputQueueListener", - "removeOutputQueueListener" ); - outQ.setDisplayName(rbl_.getText("EVT_NAME_OUTQ_EVENT")); - outQ.setShortDescription(rbl_.getText("EVT_DESC_OUTQ_EVENT")); - - EventSetDescriptor[] events = {outQ}; - outQEvents_ = events; - } - - catch (IntrospectionException e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the OutputQueue event - return super.getDefaultEventIndex() + 1; - } - - // We want "system" as the default property. PrintObject - // sets this so we don't have to override: - // public int getDefaultPropertyIndex() - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - // Per the JavaBean spec, events are a mechanism for propagating - // state change notifications between a source object and one or - // more target listener objects. - - EventSetDescriptor[] printObjectEvents; - EventSetDescriptor[] combinedEvents; - int combinedSize; - - // Get the events defined in PrintObjectBeanInfo - printObjectEvents = super.getEventSetDescriptors(); - - combinedSize = printObjectEvents.length + outQEvents_.length; - combinedEvents = new EventSetDescriptor[combinedSize]; - - // copy PrintObject events - System.arraycopy( printObjectEvents, // source - 0, // --offset - combinedEvents, // destination - 0, // --offset - printObjectEvents.length ); // length - - // copy OutputQueue events - System.arraycopy( outQEvents_, // source - 0, // --offset - combinedEvents, // destination - printObjectEvents.length, // --offset - outQEvents_.length ); // length - - return combinedEvents; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - // Per the JavaBean spec, properties are discrete, named attributes - // of a Java Bean that can affect its appearance or its behavior. - - PropertyDescriptor[] printObjectProperties; - PropertyDescriptor[] combinedProperties; - int combinedSize; - - // Get the properties defined in PrintObjectBeanInfo - printObjectProperties = super.getPropertyDescriptors(); - - combinedSize = printObjectProperties.length + outQProperties_.length; - combinedProperties = new PropertyDescriptor[combinedSize]; - - // copy PrintObject properties - System.arraycopy( printObjectProperties, // source - 0, // --offset - combinedProperties, // destination - 0, // --offset - printObjectProperties.length ); // length - - // copy OutputQueue properties - System.arraycopy( outQProperties_, // source - 0, // --offset - combinedProperties, // destination - printObjectProperties.length, // --offset - outQProperties_.length ); // length - - return combinedProperties; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("OutputQueue16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("OutputQueue32.gif"); - break; - } - - return image; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/OutputQueueEvent.java b/cvsroot/src/com/ibm/as400/access/OutputQueueEvent.java deleted file mode 100644 index 216329d42..000000000 --- a/cvsroot/src/com/ibm/as400/access/OutputQueueEvent.java +++ /dev/null @@ -1,77 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputQueueEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** - * The OutputQueueEvent class represents an OutputQueue event. - * - * @see OutputQueueListener - * - **/ -public class OutputQueueEvent extends java.util.EventObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - - /** - * The output queue cleared event ID. - **/ - public static final int CLEARED = 1; - - /** - * The output queue held event ID. - **/ - public static final int HELD = 2; - - /** - * The output queue released event ID. - **/ - public static final int RELEASED = 3; - - private int id_; - - /** - * Constructs an OutputQueueEvent object. It uses the specified - * source and ID. - * - * @param source The object sourcing the event. - * @param id The event identifier. - **/ - public OutputQueueEvent( Object source, int id ) - { - super( source ); - - if( (id < CLEARED) || (id > RELEASED) ) - { - throw new ExtendedIllegalArgumentException("id", - ExtendedIllegalArgumentException.RANGE_NOT_VALID ); - } - - id_ = id; - } - - - /** - * Returns the output queue event identifier. - * @return The event identifier. - * - **/ - public int getID() - { - return id_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/OutputQueueImpl.java b/cvsroot/src/com/ibm/as400/access/OutputQueueImpl.java deleted file mode 100644 index d2634ed3f..000000000 --- a/cvsroot/src/com/ibm/as400/access/OutputQueueImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputQueueImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - * The OutputQueueImpl interface defines a set of methods - * needed for a full implementation of the OutputQueue class. - **/ - -interface OutputQueueImpl extends PrintObjectImpl - -{ - public abstract void clear(PrintParameterList clearOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - - public abstract void hold() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - - public abstract void release() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - -} diff --git a/cvsroot/src/com/ibm/as400/access/OutputQueueImplProxy.java b/cvsroot/src/com/ibm/as400/access/OutputQueueImplProxy.java deleted file mode 100644 index 655c9cf2f..000000000 --- a/cvsroot/src/com/ibm/as400/access/OutputQueueImplProxy.java +++ /dev/null @@ -1,94 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputQueueImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - -/** - * The OutputQueueImplProxy class implements proxy versions of - * the public methods defined in the OutputQueueImpl class. - * Unless commented otherwise, the implementations of the methods below - * are merely proxy calls to the corresponding method in the remote - * implementation class (OutputQueueImplRemote). - **/ - -class OutputQueueImplProxy extends PrintObjectImplProxy -implements OutputQueueImpl, ProxyImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - OutputQueueImplProxy() - { - super("OutputQueue"); - } - - - - public void clear(PrintParameterList clearOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "clear", - new Class[] { PrintParameterList.class }, - new Object[] { clearOptions }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public void hold() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - - { - try { - connection_.callMethod(pxId_, "hold"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public void release() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "release"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/OutputQueueImplRemote.java b/cvsroot/src/com/ibm/as400/access/OutputQueueImplRemote.java deleted file mode 100644 index 15a121f2b..000000000 --- a/cvsroot/src/com/ibm/as400/access/OutputQueueImplRemote.java +++ /dev/null @@ -1,247 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputQueueImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - * The OutputQueue class represents a server output queue. - * An instance of this class can be used to manipulate an individual - * IBM i output queue (hold, release, clear, and so on). - * - * See Output Queue Attributes for - * valid attributes. - * - **/ - -class OutputQueueImplRemote extends PrintObjectImplRemote -implements OutputQueueImpl -{ - private static final NPCPAttributeIDList attrsToRetrieve_ = new NPCPAttributeIDList(); - private static boolean fAttrIDsToRtvBuilt_ = false; - - private synchronized void buildAttrIDsToRtv() - { - if (!fAttrIDsToRtvBuilt_) - { - fAttrIDsToRtvBuilt_ = true; - // 27 of these - attrsToRetrieve_.addAttrID(PrintObject.ATTR_AUTHCHCK); // Authority to check - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DATAQUELIB); // Data queue library name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DATAQUE); // Data queue name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DISPLAYANY); // Display any file - attrsToRetrieve_.addAttrID(PrintObject.ATTR_JOBSEPRATR); // Job separators - attrsToRetrieve_.addAttrID(PrintObject.ATTR_NUMFILES); // Number of files - attrsToRetrieve_.addAttrID(PrintObject.ATTR_NUMWRITERS); // Number of writers started to queue - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OPCNTRL); // Operator controlled - attrsToRetrieve_.addAttrID(PrintObject.ATTR_ORDER); // Order of files on queue - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OUTQUELIB); // Output queue library name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OUTQUE); // Output queue name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OUTQSTS); // Output queue status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PRINTER); // Printer - attrsToRetrieve_.addAttrID(PrintObject.ATTR_RMTSYSTEM); // Remote system name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SEPPAGE); // Separator page - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DESCRIPTION); // Text description - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFOPT); // user defined options - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFOBJ); // User defined object - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFOBJLIB); // User defined object library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFOBJTYP); // User defined object type - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRTFM); // User transform program name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRTFMLIB); // User transform program library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USERDRV); // User driver program name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDRVLIB); // User driver program library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WTRJOBNAME); // Writer job name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WTRJOBNUM); // Writer job number - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WTRJOBSTS); // Writer job status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WTRJOBUSER); // Writer job user name - } - } - - - - private static NPCPIDOutQ buildIDCodePoint(String IFSQueueName) - { - QSYSObjectPathName ifsPath = new QSYSObjectPathName(IFSQueueName, "OUTQ"); - - return new NPCPIDOutQ(ifsPath.getObjectName(), ifsPath.getLibraryName()); - } - - - - /** - * Clears the output queue on the server. - * - * @param clearOptions A PrintParameterList object that may have any of the - * following attributes set: - *
      - *
    • - * ATTR_JOBUSER - Clear output queue by a user id. May be a specific userid, "*ALL" or - * "*CURRENT". "*CURRENT" is the default. - *
    • - * ATTR_FORMTYPE - Clear output queue by a form type. May be a specific form type, "*ALL" or - * "*STD". "*ALL" is the default. - *
    • - * ATTR_USERDATA - Clear output queue by user data. May be a specific user data or "*ALL". - * "*ALL" is the default. - *
    - * clearOptions may be null. - * - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * server operating system is not at the correct level. - **/ - public void clear(PrintParameterList clearOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - /* checkRunTimeState(); */ // RunTime check done in OutputQueue - - NPDataStream sendDS = new NPDataStream(NPConstants.OUTPUT_QUEUE); - NPDataStream returnDS = new NPDataStream(NPConstants.OUTPUT_QUEUE); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - - NPCPAttribute cpCPFMessage = new NPCPAttribute(); - - sendDS.setAction(NPDataStream.PURGE); - sendDS.addCodePoint(getIDCodePoint()); - - if (clearOptions != null) - { - // create our own copy of the code point and change it into a selection code point - NPCPAttribute selectionCP = new NPCPAttribute(clearOptions.getAttrCodePoint()); - selectionCP.setID(NPCodePoint.SELECTION); - sendDS.addCodePoint(selectionCP); - } - - returnDS.addCodePoint(cpCPFMessage); - - npSystem.makeRequest(sendDS, returnDS); - - updateAttrs(getAttrIDsToRetrieve()); - - /* fireOutputQueueEvent(OutputQueueEvent.CLEARED); */ - - } // end clear - - - - // This method implements an abstract method of the superclass - NPCPAttributeIDList getAttrIDsToRetrieve() - { - if (!fAttrIDsToRtvBuilt_) { - buildAttrIDsToRtv(); - } - return attrsToRetrieve_; - } - - // retrieve only one attribute - NPCPAttributeIDList getAttrIDsToRetrieve(int attrToRtv) - { - if (!fAttrIDsToRtvBuilt_) { - attrsToRetrieve_.addAttrID(attrToRtv); - } - return attrsToRetrieve_; - } - - - /** - * Holds the output queue on the server. - * - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * server operating system is not at the correct level. - **/ - public void hold() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - /* checkRunTimeState(); */ // RunTime check done in OutputQueue - - NPDataStream sendDS = new NPDataStream(NPConstants.OUTPUT_QUEUE); - NPDataStream returnDS = new NPDataStream(NPConstants.OUTPUT_QUEUE); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - - NPCPAttribute cpCPFMessage = new NPCPAttribute(); - - sendDS.setAction(NPDataStream.HOLD); - sendDS.addCodePoint(getIDCodePoint()); - - returnDS.addCodePoint(cpCPFMessage); - - npSystem.makeRequest(sendDS, returnDS); - - updateAttrs(getAttrIDsToRetrieve()); - - /* fireOutputQueueEvent(OutputQueueEvent.HELD); */ - } // end hold - - - - /** - * Releases a held output queue on the server. - * - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * server operating system is not at the correct level. - **/ - public void release() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - /* checkRunTimeState(); */ // RunTime check done in OutputQueue - - NPDataStream sendDS = new NPDataStream(NPConstants.OUTPUT_QUEUE); - NPDataStream returnDS = new NPDataStream(NPConstants.OUTPUT_QUEUE); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - - NPCPAttribute cpCPFMessage = new NPCPAttribute(); - - sendDS.setAction(NPDataStream.RELEASE); - sendDS.addCodePoint(getIDCodePoint()); - - returnDS.addCodePoint(cpCPFMessage); - - npSystem.makeRequest(sendDS, returnDS); - - updateAttrs(getAttrIDsToRetrieve()); - - /* fireOutputQueueEvent(OutputQueueEvent.RELEASED); */ - - } // end release - -} diff --git a/cvsroot/src/com/ibm/as400/access/OutputQueueList.java b/cvsroot/src/com/ibm/as400/access/OutputQueueList.java deleted file mode 100644 index 0fe3383f3..000000000 --- a/cvsroot/src/com/ibm/as400/access/OutputQueueList.java +++ /dev/null @@ -1,155 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputQueueList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; - -/** - * The OutputQueueList class is used to build a list of system objects of type OutputQueue. - * The list can be filtered by library and queue name. - * - * @see OutputQueue - **/ - -public class OutputQueueList extends PrintObjectList -implements java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - private static final String QUEUE_FILTER = "queueFilter"; - - - /** - * Constructs an OutputQueueList object. The system must - * be set later. This constructor is provided for visual application - * builders that support JavaBeans. It is not intended for use - * by application programmers. - * - * @see PrintObjectList#setSystem - **/ - public OutputQueueList() - { - super(NPConstants.OUTPUT_QUEUE, new NPCPSelOutQ()); - // Because of this constructor we will need to check the - // system before trying to use it. - } - - - - /** - * Constructs an OutputQueueList object. It uses the specified system name. - * - * @param system The system on which the output queues exists. - * - **/ - public OutputQueueList(AS400 system) - { - super(NPConstants.OUTPUT_QUEUE, new NPCPSelOutQ(), system); - } - - - - /** - * Chooses the appropriate implementation. - **/ - void chooseImpl() - { - AS400 system = getSystem(); - if (system == null) { - Trace.log( Trace.ERROR, "Attempt to use OutputQueueList before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - impl_ = (PrintObjectListImpl) system.loadImpl2("com.ibm.as400.access.OutputQueueListImplRemote", - "com.ibm.as400.access.OutputQueueListImplProxy"); - super.setImpl(); - } - - - - /** - * Returns the output queue list filter. - * @return The output queue list filter. - **/ - public String getQueueFilter() - { - // The selection code point is always present, it may - // however be empty. If empty, getQueue() will return - // an empty string. - - NPCPSelOutQ selectionCP = (NPCPSelOutQ)getSelectionCP(); - return( selectionCP.getQueue() ); - } - - - PrintObject newNPObject(NPCPID cpid, NPCPAttribute cpattr) - { - return new OutputQueue(system_, (NPCPIDOutQ)cpid, cpattr); - } - - - /** - * Sets the output queue list filter. - * @param queueFilter The library and output queues to list. - * The format of the queueFilter string must be in the - * format of /QSYS.LIB/libname.LIB/queuename.OUTQ, where - *
    - * libname is the library name that contains the queues to search. - * It can be a specific name, a generic name, or one of these special values: - *
      - *
    • %ALL% - All libraries are searched. - *
    • %ALLUSR% - All user-defined libraries, plus libraries containing user data - * and having names starting with the letter Q. - *
    • %CURLIB% - The server job's current library. - *
    • %LIBL% - The server job's library list. - *
    • %USRLIBL% - The user portion of the server job's library list. - *
    - * queuename is the name of the output queues to list. - * It can be a specific name, a generic name, or the special value %ALL%. - * The default for the library is %LIBL% and for the queue name is %ALL%. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setQueueFilter(String queueFilter) - throws PropertyVetoException - { - if( queueFilter == null ) - { - Trace.log( Trace.ERROR, "Parameter 'queue' is null" ); - throw new NullPointerException( QUEUE_FILTER ); - } - - String oldQueueFilter = getQueueFilter(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( QUEUE_FILTER, oldQueueFilter, queueFilter ); - - // No one vetoed, make the change. - NPCPSelOutQ selectionCP = (NPCPSelOutQ)getSelectionCP(); - selectionCP.setQueue(queueFilter); - - // Propagate change to ImplRemote if necessary... - if (impl_ != null) - impl_.setFilter("queue", queueFilter); - - // Notify any property change listeners. - changes.firePropertyChange( QUEUE_FILTER, oldQueueFilter, queueFilter ); - } - -} // OutputQueueList class - diff --git a/cvsroot/src/com/ibm/as400/access/OutputQueueList16.gif b/cvsroot/src/com/ibm/as400/access/OutputQueueList16.gif deleted file mode 100644 index 699168a6d..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/OutputQueueList16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/OutputQueueList32.gif b/cvsroot/src/com/ibm/as400/access/OutputQueueList32.gif deleted file mode 100644 index 6d8b81134..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/OutputQueueList32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/OutputQueueListBeanInfo.java b/cvsroot/src/com/ibm/as400/access/OutputQueueListBeanInfo.java deleted file mode 100644 index f82120685..000000000 --- a/cvsroot/src/com/ibm/as400/access/OutputQueueListBeanInfo.java +++ /dev/null @@ -1,140 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputQueueListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; -import java.awt.Image; - -/** -BeanInfo for OutputQueueList class. -**/ -public class OutputQueueListBeanInfo extends PrintObjectListBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Additional properties defined for OutputQueueList - private static PropertyDescriptor[] outQListProperties_; - - // Class this bean info represents. - private final static Class beanClass = OutputQueueList.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader rbl_; - - static - { - try - { - PropertyDescriptor outQFilter = - new PropertyDescriptor("queueFilter", beanClass); - outQFilter.setBound(true); - outQFilter.setConstrained(true); - outQFilter.setDisplayName(rbl_.getText("PROP_NAME_OUTQ_NAME_FILTER")); - outQFilter.setShortDescription(rbl_.getText("PROP_DESC_OUTQ_NAME_FILTER")); - - PropertyDescriptor[] properties = {outQFilter}; - outQListProperties_ = properties; - } - - catch (IntrospectionException e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - // OutputQueueList does not define any additional events so we - // let the PrintObjectList provide: - // public int getDefaultEventIndex() - // public EventSetDescriptor[] getEventSetDescriptors() - - // We want "system" as the default property. PrintObjectList - // sets this so we don't have to override: - // public int getDefaultPropertyIndex() - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - // Per the JavaBean spec, properties are discrete, named attributes - // of a Java Bean that can affect its appearance or its behavior. - - PropertyDescriptor[] printObjectListProperties; - PropertyDescriptor[] combinedProperties; - int combinedSize; - - // Get the properties defined in PrintObjectListBeanInfo - printObjectListProperties = super.getPropertyDescriptors(); - - combinedSize = printObjectListProperties.length + outQListProperties_.length; - combinedProperties = new PropertyDescriptor[combinedSize]; - - // copy PrintObjectList properties - System.arraycopy( printObjectListProperties, // source - 0, // --offset - combinedProperties, // destination - 0, // --offset - printObjectListProperties.length ); // length - - // copy OutputQueueList properties - System.arraycopy( outQListProperties_, // source - 0, // --offset - combinedProperties, // destination - printObjectListProperties.length, // --offset - outQListProperties_.length ); // length - - return combinedProperties; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("OutputQueueList16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("OutputQueueList32.gif"); - break; - } - - return image; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/OutputQueueListImplProxy.java b/cvsroot/src/com/ibm/as400/access/OutputQueueListImplProxy.java deleted file mode 100644 index e37adc40c..000000000 --- a/cvsroot/src/com/ibm/as400/access/OutputQueueListImplProxy.java +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputQueueListImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; - -class OutputQueueListImplProxy extends PrintObjectListImplProxy -implements ProxyImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - OutputQueueListImplProxy() - { - super("OutputQueueList"); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/OutputQueueListImplRemote.java b/cvsroot/src/com/ibm/as400/access/OutputQueueListImplRemote.java deleted file mode 100644 index 79c682d92..000000000 --- a/cvsroot/src/com/ibm/as400/access/OutputQueueListImplRemote.java +++ /dev/null @@ -1,149 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputQueueListImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The OutputQueueList class is used to build a list of server objects of type OutputQueue. - * The list can be filtered by library and queue name. - * - * @see OutputQueue - **/ - -class OutputQueueListImplRemote extends PrintObjectListImplRemote -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // static private binary data for default attribute to - // retrieve on a output queue file when listing output queues - // format is: - // --------------------------------------------------- - // |nn | LEN | ID1 | ID2 | ID3 | ID4 | ....... | IDnn| - // --------------------------------------------------- - // nn - two byte total # of attributes in code point - // LEN - two byte length of each attribute entry, right - // now this will be 2 (0x02). - // IDx - two byte attribute ID - private static final byte[] attrIDToList_ = - { - 0x00, 0x1B, // big endian(BE), number of attrs - 0x00, 0x02, // BE - size in bytes of each ID - 0x00, 0x0E, // ATTR_AUTHCHCK - 0x00, 0x20, // ATTR_DATAQUELIB - 0x00, 0x21, // ATTR_DATAQUE - 0x00, 0x29, // ATTR_DISPLAYANY - 0x00, 0x3D, // ATTR_JOBSEPRATR - 0x00, 0x45, // ATTR_NUMFILES - 0x00, (byte)0x91, // ATTR_NUMWRITERS - 0x00, 0x46, // ATTR_OPCNTRL - 0x00, 0x47, // ATTR_ORDER - 0x00, 0x49, // ATTR_OUTQUELIB - 0x00, 0x4A, // ATTR_OUTQUE - 0x00, 0x4B, // ATTR_OUTQSTS - 0x00, 0x59, // ATTR_PRINTER - 0x00, (byte)0xA1, // ATTR_SEPPAGE - 0x00, 0x6D, // ATTR_DESCRIPTION - 0x00, (byte)0xA3, // ATTR_USRDEFOPT - 0x00, (byte)0xA4, // ATTR_USRDEFOBJLIB - 0x00, (byte)0xA5, // ATTR_USRDEFOBJ - 0x00, (byte)0xA6, // ATTR_USRDEFOBJTYP - 0x00, (byte)0xA7, // ATTR_USRTFMLIB - 0x00, (byte)0xA8, // ATTR_USRTFM - 0x00, (byte)0xAA, // ATTR_USRDRVLIB - 0x00, (byte)0xAB, // ATTR_USERDRV - 0x00, 0x79, // ATTR_WTRJOBNAME - 0x00, 0x7A, // ATTR_WTRJOBNUM - 0x00, 0x7B, // ATTR_WTRJOBSTS - 0x00, 0x7C // ATTR_WTRJOBUSER - }; - - private static final NPCPAttributeIDList defaultAttrIDsToList_ = new NPCPAttributeIDList(attrIDToList_); - - // register the output queue return datastream for listing output queues - static - { - NPDataStream ds; - NPCodePoint cp; - - ds = new NPDataStream(NPConstants.OUTPUT_QUEUE); // @B1C - cp = new NPCPIDOutQ(); - ds.addCodePoint(cp); - cp = new NPCPAttribute(); - ds.addCodePoint(cp); - AS400Server.addReplyStream(ds, "as-netprt"); - } - - - - /** - * Returns the default attributes to list. - **/ - NPCPAttributeIDList getDefaultAttrsToList() - { - return defaultAttrIDsToList_; - } - - - - /** - * Creates a new OutputQueue object. - **/ - /* @A5D - PrintObject newNPObject(AS400 system, NPDataStream reply) - { - OutputQueue npObj = null; - NPCPIDOutQ cpid; - NPCPAttribute cpAttrs; - cpid = (NPCPIDOutQ)reply.getCodePoint(NPCodePoint.OUTPUT_QUEUE_ID); // never should return null - cpAttrs = (NPCPAttribute)reply.getCodePoint(NPCodePoint.ATTRIBUTE_VALUE); // may return null - npObj = new OutputQueue(system, cpid, cpAttrs); - return npObj; - } - */ - - - NPCPID newNPCPID(NPDataStream reply) - { - return (NPCPIDOutQ)reply.getCodePoint(NPCodePoint.OUTPUT_QUEUE_ID); // never should return null - } - - - /** - * Sets the output queue list filter. - * @param queueFilter The library and output queues to list. - * The format of the queueFilter string must be in the - * format of /QSYS.LIB/libname.LIB/queuename.OUTQ, where - *
    - * libname is the library name that contains the queues to search. - * It can be a specific name, a generic name, or one of these special values: - *
      - *
    • %ALL% - All libraries are searched. - *
    • %ALLUSR% - All user-defined libraries, plus libraries containing user data - * and having names starting with the letter Q. - *
    • %CURLIB% - The server job's current library. - *
    • %LIBL% - The server job's library list. - *
    • %USRLIBL% - The user portion of the server job's library list. - *
    - * queuename is the name of the output queues to list. - * It can be a specific name, a generic name, or the special value %ALL%. - * The default for the library is %LIBL% and for the queue name is %ALL%. - * - **/ - public void setQueueFilter(String queueFilter) - { - NPCPSelOutQ selectionCP = (NPCPSelOutQ)getSelectionCP(); - selectionCP.setQueue(queueFilter); - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/OutputQueueListener.java b/cvsroot/src/com/ibm/as400/access/OutputQueueListener.java deleted file mode 100644 index d52bb7a54..000000000 --- a/cvsroot/src/com/ibm/as400/access/OutputQueueListener.java +++ /dev/null @@ -1,39 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputQueueListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** - * The OutputQueueListener interface provides a - * listener interface for receiving OutputQueue events. - * - **/ -public interface OutputQueueListener extends java.util.EventListener -{ - /** - * Invoked when the output queue has been cleared. - **/ - public abstract void outputQueueCleared(OutputQueueEvent evt); - - /** - * Invoked when the output queue has been held. - **/ - public abstract void outputQueueHeld(OutputQueueEvent evt); - - /** - * Invoked when the output queue has been released. - **/ - public abstract void outputQueueReleased(OutputQueueEvent evt); -} - diff --git a/cvsroot/src/com/ibm/as400/access/PSConfig.java b/cvsroot/src/com/ibm/as400/access/PSConfig.java deleted file mode 100644 index 09e27d9cf..000000000 --- a/cvsroot/src/com/ibm/as400/access/PSConfig.java +++ /dev/null @@ -1,412 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PSConfig.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.BufferedInputStream; -import java.io.FileInputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.sql.Driver; -import java.sql.DriverManager; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Properties; -import java.util.StringTokenizer; -import java.util.Vector; - - - -/** -Represents the configuration of a proxy server. -**/ -class PSConfig -{ - // Private data. - private static final String OPTION_BALANCE_THRESHOLD = "balanceThreshold"; - private static final String OPTION_CONFIGURATION = "configuration"; - private static final String OPTION_JDBC_DRIVERS = "jdbcDrivers"; - private static final String OPTION_MAX_CONNECTIONS = "maxConnections"; - private static final String OPTION_PEERS = "peers"; - private static final String OPTION_VERBOSE = "verbose"; - - static final Vector expectedOptions_ = new Vector (); - static final Hashtable shortcuts_ = new Hashtable (); - - - - private PSLoad load_; - private PSLoadBalancer loadBalancer_; - private String name_; - private Properties properties_; - - - -/** -Static initializer. -**/ - static - { - // Expected options for the ProxyServer application. - expectedOptions_.addElement ("-balanceThreshold"); - expectedOptions_.addElement ("-configuration"); - expectedOptions_.addElement ("-jdbcDrivers"); - expectedOptions_.addElement ("-maxConnections"); - expectedOptions_.addElement ("-peers"); - expectedOptions_.addElement ("-port"); - expectedOptions_.addElement ("-securePort"); - expectedOptions_.addElement ("-keyringName"); //$B1A - expectedOptions_.addElement ("-keyringPassword"); //$B1A - expectedOptions_.addElement ("-verbose"); - expectedOptions_.addElement ("-help"); - - // Shortcuts for the ProxyServer application. - // Note: These are also listed in usage(). // @A1A - shortcuts_.put ("-bt", "-balanceThreshold"); - shortcuts_.put ("-c", "-configuration"); - shortcuts_.put ("-jd", "-jdbcDrivers"); - shortcuts_.put ("-mc", "-maxConnections"); - shortcuts_.put ("-pe", "-peers"); - shortcuts_.put ("-po", "-port"); - shortcuts_.put ("-sp", "-securePort"); - shortcuts_.put ("-kn", "-keyringName"); //$B1A - shortcuts_.put ("-kp", "-keyringPassword"); //$B1A - shortcuts_.put ("-v", "-verbose"); - shortcuts_.put ("-h", "-help"); - shortcuts_.put ("-?", "-help"); - } - - - -/** -Constructs a PSConfig object. - -@param load The load. -@param loadBalancer The load balancer. -**/ - public PSConfig (PSLoad load, PSLoadBalancer loadBalancer) - { - load_ = load; - loadBalancer_ = loadBalancer; - - name_ = null; - properties_ = new Properties (); - } - - - -/** -Applies the command line arguments to the configuration. - -@param cla The command line arguments. -**/ - public void apply (CommandLineArguments cla) - throws IOException - { - Trace.loadTraceProperties (); - String optionValue; - - // Apply the verbose option first, so that - // we see messages. - optionValue = cla.getOptionValue (OPTION_VERBOSE); - if (optionValue != null) { - setVerbose (optionValue); - properties_.put (OPTION_VERBOSE, optionValue); - } - - // Load the configuration file first, so that command - // line arguments override any settings. - optionValue = cla.getOptionValue (OPTION_CONFIGURATION); - if (optionValue != null) { - setName (optionValue); - load (); - } - - // Re-apply the verbose option first, just in case - // the condiguration file overrode it. - optionValue = cla.getOptionValue (OPTION_VERBOSE); - if (optionValue != null) { - setVerbose (optionValue); - properties_.put (OPTION_VERBOSE, optionValue); - } - - // Other options. - optionValue = cla.getOptionValue (OPTION_BALANCE_THRESHOLD); - if (optionValue != null) { - load_.setBalanceThreshold (Integer.parseInt (optionValue)); - properties_.put (OPTION_BALANCE_THRESHOLD, optionValue); - } - - optionValue = cla.getOptionValue (OPTION_JDBC_DRIVERS); - if (optionValue != null) { - registerJDBCDrivers (optionValue); - properties_.put (OPTION_JDBC_DRIVERS, optionValue); - } - - optionValue = cla.getOptionValue (OPTION_MAX_CONNECTIONS); - if (optionValue != null) { - load_.setMaxConnections (Integer.parseInt (optionValue)); - properties_.put (OPTION_MAX_CONNECTIONS, optionValue); - } - - optionValue = cla.getOptionValue (OPTION_PEERS); - if (optionValue != null) { - loadBalancer_.setPeers (optionValue); - properties_.put (OPTION_PEERS, optionValue); - } - } - - - -/** -Applies a set of properties to the configuration. - -@param configurationProperties The configuration properties. -**/ - public void apply (Properties configurationProperties) - { - Trace.loadTraceProperties (); - - // Take note of the verbose state before changing it. - boolean verboseBefore = Verbose.isVerbose (); - - // Iterate through the changed configuration properties. - Enumeration list = configurationProperties.propertyNames (); - while (list.hasMoreElements ()) { - - String optionName = (String) list.nextElement (); - String optionValue = configurationProperties.getProperty (optionName); - if (Trace.isTraceProxyOn ()) - Trace.log (Trace.PROXY, "Changing option " + optionName + " to " + optionValue + "."); - - else if (optionName.equalsIgnoreCase (OPTION_BALANCE_THRESHOLD)) { - load_.setBalanceThreshold (Integer.parseInt (optionValue)); - properties_.put (OPTION_BALANCE_THRESHOLD, optionValue); - } - - else if (optionName.equalsIgnoreCase (OPTION_JDBC_DRIVERS)) { - registerJDBCDrivers (optionValue); - properties_.put (OPTION_JDBC_DRIVERS, optionValue); - } - - else if (optionName.equalsIgnoreCase (OPTION_MAX_CONNECTIONS)) { - load_.setMaxConnections (Integer.parseInt (optionValue)); - properties_.put (OPTION_MAX_CONNECTIONS, optionValue); - } - - else if (optionName.equalsIgnoreCase (OPTION_PEERS)) { - loadBalancer_.setPeers (optionValue); - properties_.put (OPTION_PEERS, optionValue); - } - - else if (optionName.equalsIgnoreCase (OPTION_VERBOSE)) { - setVerbose (optionValue); - properties_.put (OPTION_VERBOSE, optionValue); - } - - else if (optionName.trim().length() > 0) - throw new IllegalArgumentException (ResourceBundleLoader.getText ("PROXY_OPTION_NOT_VALID", optionName)); - } - - // Print this message if verbose used to be on or is on now. - boolean verboseAfter = Verbose.isVerbose (); - if (verboseBefore || verboseAfter) - Verbose.forcePrintln (ResourceBundleLoader.getText ("PROXY_CONFIGURATION_UPDATED")); - } - - - -/** -Returns the list of registered JDBC drivers. - -@return The list of registered JDBC drivers, delimited - by semicolons. -**/ - /* - public String getJDBCDrivers () - { - StringBuffer buffer = new StringBuffer (); - Enumeration list = DriverManager.getDrivers (); - while (list.hasMoreElements ()) { - buffer.append (((String) list.nextElement ()).getClass ().getName ()); - buffer.append (';'); - } - return buffer.toString (); - } - */ - - - -/** -Returns the name of configuration, if any. - -@return The name of configuration, or null if none. -**/ - public String getName () - { - return name_; - } - - - -/** -Returns the properties object used to store the -configuation. - -@return The properties object used to store the - configuation. -**/ - public Properties getProperties () - { - return properties_; - } - - - -/** -Loads the configuration from a file. -**/ - public void load () - throws IOException - { - Properties configurationProperties = new Properties (); - InputStream input = null; - try { - input = new BufferedInputStream (new FileInputStream (name_)); - configurationProperties.load (input); - apply (configurationProperties); - } - finally { - if (input != null) { input.close(); } - } - } - - - -/** -Registers the specified JDBC drivers. - -@param jdbcDrivers The semicolon delimited list of - JDBC drivers to register -**/ - private void registerJDBCDrivers (String jdbcDrivers) - { - StringTokenizer tokenizer = new StringTokenizer (jdbcDrivers, ";, "); - while (tokenizer.hasMoreTokens ()) { - String token = tokenizer.nextToken (); - try { - // Load the class. It will register itself the first time - // (when the class is loaded). We register it also to make - // sure, since the driver could have been deregistered. - Class driverClass = Class.forName (token); - //Driver driver = (Driver) driverClass.newInstance (); - boolean found = false; - Enumeration list = DriverManager.getDrivers (); - while ((list.hasMoreElements ()) && (found == false)) { - Driver enumDriver = (Driver) list.nextElement (); - if (enumDriver.getClass ().equals (driverClass)) - found = true; - } - if (! found) - DriverManager.registerDriver ((Driver) Class.forName (token).newInstance ()); - Verbose.println (ResourceBundleLoader.getText ("PROXY_JDBC_DRIVER_REGISTERED", token)); - } - catch (Exception e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "JDBC driver not found.", e); - Verbose.println (ResourceBundleLoader.getText ("PROXY_JDBC_DRIVER_NOT_REGISTERED", token)); - } - } - } - - - -/** -Sets the name of the configuration. - -@param name The configuration name. -**/ - public void setName (String name) - { - name_ = name; - } - - - -/** -Sets whether verbose output is printed. - -@param verbose "true" or "" if verbose output is printed; "false" otherwise. -**/ - private void setVerbose (String verbose) - { - if ((verbose.length () == 0) || (verbose.equalsIgnoreCase ("true"))) - Verbose.setVerbose (true); - else if (verbose.equalsIgnoreCase ("false")) - Verbose.setVerbose (false); - else - throw new IllegalArgumentException (ResourceBundleLoader.getText ("PROXY_OPTION_VALUE_NOT_VALID", new String[] { OPTION_VERBOSE, verbose })); - } - - - -/** -Prints the application usage information. - -@param out The print stream for usage information. -**/ - static void usage (PrintStream out) - { - final String usage = ResourceBundleLoader.getText ("PROXY_SERVER_USAGE"); - final String optionslc = ResourceBundleLoader.getText ("PROXY_SERVER_OPTIONSLC"); - final String optionsuc = ResourceBundleLoader.getText ("PROXY_SERVER_OPTIONSUC"); - final String shortcuts = ResourceBundleLoader.getText ("PROXY_SERVER_SHORTCUTS"); // @A1A - - out.println (usage + ":"); - out.println (); - out.println (" com.ibm.as400.access.ProxyServer [ " + optionslc + " ]"); - out.println (); - out.println (optionsuc + ":"); - out.println (); - out.println (" -balanceThreshold balanceThreshold"); - out.println (" -configuration configuration"); - out.println (" -jdbcDrivers jdbcDriver1[;jdbcDriver2;...]"); // @B2C - out.println (" -maxConnections maxConnections"); - out.println (" -peers hostname1[:port1][;hostname2[:port2];..."); - out.println (" -port port"); - out.println (" -securePort securePort"); //$B1C - out.println (" -keyringName ProxyServerKeyringName"); //$B1A - out.println (" -keyringPassword ProxyServerKeyringPassword"); //$B1A - out.println (" -verbose [true|false]"); - out.println (" -help"); - out.println (); // @A1A - out.println (shortcuts + ":"); // @A1A - out.println (); // @A1A - out.println (" -bt balanceThreshold"); // @A1A - out.println (" -c configuration"); // @A1A - out.println (" -jd jdbcDriver1[;jdbcDriver2;...]"); // @A1A @B2C - out.println (" -mc maxConnections"); // @A1A - out.println (" -pe hostname1[:port1][;hostname2[:port2];..."); // @A1A - out.println (" -po port"); // @A1A - out.println (" -sp securePort"); // @A1A $B1C - out.println (" -kn ProxyServerKeyringName"); //$B1A - out.println (" -kp ProxyServerKeyringPassword"); //$B1A - out.println (" -v [true|false]"); // @A1A - out.println (" -h"); // @A1A - out.println (" -?"); // @A1A - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PSConnection.java b/cvsroot/src/com/ibm/as400/access/PSConnection.java deleted file mode 100644 index f2fca02bf..000000000 --- a/cvsroot/src/com/ibm/as400/access/PSConnection.java +++ /dev/null @@ -1,274 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PSConnection.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.EOFException; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.net.Socket; -import java.net.SocketException; - - - -/** -The PSConnection class represents a connection -to a client of the proxy server. -**/ -class PSConnection -extends StoppableThread -{ - // Private data. - private boolean closed_ = false; - private long connectionId_; - private PxDSFactory factory_; - private InputStream input_; - private PSLoad load_; - private OutputStream output_; - private Socket socket_; - private PrintWriter trace_; - private PxTable proxyTable_; - - - -/** -Constructs a PSConnection object. - -@param connectionId The connection id. -@param socket The socket. -@param input The input stream. -@param output The output stream. -@param load The load. -**/ - public PSConnection (long connectionId, - Socket socket, - InputStream input, - OutputStream output, - PSLoad load) - { - super("PSConnection-" + connectionId); - - connectionId_ = connectionId; - socket_ = socket; - input_ = input; - load_ = load; - output_ = output; - proxyTable_ = new PxTable (); - - factory_ = new PxDSFactory (); - - factory_.register (new PxByteParm ()); - factory_.register (new PxShortParm ()); - factory_.register (new PxIntParm ()); - factory_.register (new PxLongParm ()); - factory_.register (new PxFloatParm ()); - factory_.register (new PxDoubleParm ()); - factory_.register (new PxBooleanParm ()); - factory_.register (new PxCharParm ()); - factory_.register (new PxStringParm ()); - factory_.register (new PxSerializedObjectParm ()); - factory_.register (new PxPxObjectParm (proxyTable_)); - factory_.register (new PxToolboxObjectParm ()); - factory_.register (new PxNullParm ()); - factory_.register (new PxClassParm ()); - - factory_.register (new PxConstructorReqSV (proxyTable_)); - factory_.register (new PxMethodReqSV (proxyTable_)); //@B2D, this)); - factory_.register (new PxFinalizeReqSV (proxyTable_)); - factory_.register (new PxListenerReqSV (this, proxyTable_)); - - if (Trace.isTraceProxyOn ()) { - trace_ = Trace.getPrintWriter(); - Trace.log (Trace.PROXY, "Px server connection " + this + " opened."); - } - } - - - - public void close () - { - super.stopSafely(); - closed_ = true; - - if (Trace.isTraceProxyOn ()) - Trace.log (Trace.PROXY, "Px server connection " + this + " closed."); - - // I am using separate try-catch blocks to make sure - // that everything gets closed. - // NOTE: When using SSL, trying to close the output stream, input stream, and //$B1A - // socket are more prone to throw an exception. This is most likely due - // to the SSL design, which we cannot control. - try { - if (output_ != null) - output_.close (); - } - catch (IOException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Exception closing proxy output stream.", e); //$B1C - } - - try { - if (input_ != null) - input_.close (); - } - catch (IOException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Exception closing proxy input stream.", e); //$B1C - } - - try { - if (socket_ != null) - socket_.close (); - } - catch (IOException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Exception closing proxy socket.", e); //$B1C - } - - // Clean up for the connection. Make sure and do this after closing - // the input stream. Otherwise I was seeing requests come across for - // objects no longer in the proxy table. That resulted in a NullPointerException. - if (proxyTable_ != null) { - proxyTable_.removeAll (); - proxyTable_ = null; - } - factory_ = null; - load_.connectionClosed (); - - Verbose.println (ResourceBundleLoader.getText ("PROXY_CONNECTION_CLOSED", Long.toString (connectionId_))); - } - - - - protected void finalize () - throws Throwable - { - if (! closed_) - close (); - super.finalize (); - } - - - -/** -Handles IOExceptions that are thrown while replying -to requests. -**/ - private void handleIOException (IOException e) - { - // This exception is thrown when the client application ends - // normally. It is also thrown on certain error conditions. - // We need to trace the error conditions, but weed out the - // normal ending. - if (Trace.isTraceErrorOn ()) - if (((!(e instanceof SocketException)) // Normal Windows end. - && (!(e instanceof EOFException))) // Normal AIX end. - || ((e.getMessage () != null) - && (e.getMessage ().indexOf ("JVM_recv") < 0))) - Trace.log (Trace.ERROR, "IOException in PSConnection", e); - - if (! closed_) - close (); - } - - - -/** -Processes a request and sends the reply, if any. -**/ - private void processReq (PxReqSV request) - { - PxRepSV reply = request.process (); - if (reply != null) { - reply.setCorrelationId(request.getCorrelationId()); - send (reply); - } - } - - -/** -Processes requests until the connection is closed. -**/ - public void run() - { - load_.connectionOpened (); - - // Loop, continuously replying to requests. - try { - while (canContinue ()) { - - // Get the next request. - PxReqSV request = (PxReqSV) factory_.getNextDS (input_); - if (Trace.isTraceProxyOn ()) { - trace_.print(getName() + " - "); - request.dump(trace_); - } - - // If the request is asychronous, then process it in another thread. - // Otherwise, run in in this thread. Synchronous requests save the - // overhead of creating a thread, but asynchronous requests are needed - // in some cases to preserve semantics. This will be most common - // for potentially long-running method calls. - if (request.isAsynchronous ()) { - final PxReqSV request2 = request; - (new Thread () { public void run () { processReq (request2); }}).start (); - } - else { - processReq (request); - } - } - } - catch (IOException e) { - handleIOException (e); - } - } - - - -/** -Sends a reply. -**/ - public void send (PxRepSV reply) - { - try { - if (reply != null) { - synchronized (output_) { - if (Trace.isTraceProxyOn ()) { - trace_.print(getName() + " - "); - reply.dump(trace_); - } - reply.writeTo(output_); - output_.flush(); - } - } - } - catch (IOException e) { - handleIOException (e); - } - } - - - -/** -Stops the thread safely. -**/ - public void stopSafely () - { - close (); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PSConnectionListener.java b/cvsroot/src/com/ibm/as400/access/PSConnectionListener.java deleted file mode 100644 index 57c08d910..000000000 --- a/cvsroot/src/com/ibm/as400/access/PSConnectionListener.java +++ /dev/null @@ -1,74 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PSConnectionListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The PSConnectionListener class dispatches -ConnectionEvents fired within the ProxyServer to the -client. -**/ -class PSConnectionListener -extends PSEventDispatcher -implements ConnectionListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private static final String listenerInterfaceName_ = "com.ibm.as400.access.ConnectionListener"; - - -/** -Constructs a PSConnectionListener object. - -@param connection The proxy server connection. -@param proxyTable The proxy table. -@param proxyId The proxy id. -**/ - public PSConnectionListener (PSConnection connection, PxTable proxyTable, long proxyId) - { - super (connection, proxyTable, proxyId); - } - - - -/** -Invoked when the connection is closed. - -@param event The event. -**/ - public void connected (ConnectionEvent event) - { - fireEvent (listenerInterfaceName_, "connected", event); - } - - - -/** -Invoked when the connection is opened. - -@param event The event. -**/ - public void disconnected (ConnectionEvent event) - { - fireEvent (listenerInterfaceName_, "disconnected", event); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PSController.java b/cvsroot/src/com/ibm/as400/access/PSController.java deleted file mode 100644 index 8faeff791..000000000 --- a/cvsroot/src/com/ibm/as400/access/PSController.java +++ /dev/null @@ -1,241 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PSController.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.net.InetAddress; -import java.net.Socket; -import java.util.Vector; - -// Represents a connection to a client of the proxy server. -class PSController extends StoppableThread -{ - // Private data. - private static long nextConnectionId_ = 1000; - private static Object nextConnectionIdLock_ = new Object(); - - private boolean closed_ = false; - //private PSConfig config_; - private Socket connectedSocket_; - private long connectionId_ = -1; - private PxDSFactory factory_; - private InputStream input_; - private boolean ownSocket_ = false; - private OutputStream output_; - private boolean running_ = false; - private PSServerSocketContainerAdapter serverSocket_; - //private Vector threadGroup_; - - // Constructs a PSController object. - // @param threadGroup The thread group. - // @param proxyServer The proxy server. - // @param load The load. - // @param loadBalancer The load balancer. - // @param config The configuration. - // @param serverSocket The server socket container. - public PSController(Vector threadGroup, ProxyServer proxyServer, PSLoad load, PSLoadBalancer loadBalancer, PSConfig config, PSServerSocketContainerAdapter serverSocket) - { - super("PSController-" + serverSocket); - - //threadGroup_ = threadGroup; - //config_ = config; - serverSocket_ = serverSocket; - - factory_ = new PxDSFactory(); - factory_.register(new PxBooleanParm()); - factory_.register(new PxIntParm()); - factory_.register(new PxStringParm()); - factory_.register(new PxSerializedObjectParm(null)); - factory_.register(new PxConnectReqSV(threadGroup, this, load, loadBalancer)); - factory_.register(new PxConfigReqSV(config, this)); - factory_.register(new PxEndReqSV(proxyServer, this)); - factory_.register(new PxLoadReqSV(load)); - - if (Trace.isTraceOn()) Trace.log(Trace.PROXY, "Px server controller " + this + " opened."); - } - - public void closeServerSocket() - { - if (Trace.isTraceOn()) Trace.log(Trace.PROXY, "Px server controller " + this + " closed."); - - closeSocket(); - - try - { - serverSocket_.close(); - } - catch (IOException e) - { - Trace.log(Trace.ERROR, e.getMessage(), e); - } - - closed_ = true; - } - - public void closeSocket() - { - if (ownSocket_) - { - try - { - if (connectedSocket_ != null) connectedSocket_.close(); - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Exception closing proxy socket:", e); - } - - ownSocket_ = false; - } - } - - protected void finalize() throws Throwable - { - if (closed_ == false) closeServerSocket(); - super.finalize(); - } - - // Returns the current requesting client's address. - // @return The current requesting client's address. - public InetAddress getClientAddress() - { - return connectedSocket_.getInetAddress(); - } - - // Returns the current requesting client's socket. - // @return The current requesting client's socket. - public Socket getConnectedSocket() - { - // Give up ownership of the socket. A connection owns it now. - ownSocket_ = false; - return connectedSocket_; - } - - // Returns the current requesting client's unique connection id. - // @return The current requesting client's unique connection id. - public long getConnectionId() - { - return connectionId_; - } - - // Returns the input stream used for receiving requests from the current client. - // @return The input stream used for receiving requests from the current client. - public InputStream getInputStream() - { - return input_; - } - - // Returns the output stream used for sending replies to the current client. - // @return The output stream used for sending replies to the current client. - public OutputStream getOutputStream() - { - return output_; - } - - // Runs the controller. - public void run() - { - running_ = true; - - // Loop forever, handling each connection that comes in. - while (canContinue()) - { - // If anything goes wrong here, stop the controller. - try - { - connectedSocket_ = serverSocket_.accept(); - // Test note: We see the phrase "Address in use: bind" on occasion when calling this method. My best guess is that the JDK is printing it! - } - catch(Exception e) - { - Verbose.println(e); - Trace.log(Trace.ERROR, "Exception accepting proxy socket:", e); - break; - } - - // From here on out, if anything goes wrong, we just loop and try again! - try - { - input_ = new BufferedInputStream(connectedSocket_.getInputStream()); - output_ = new BufferedOutputStream(connectedSocket_.getOutputStream()); - - // For now, this class "owns" the socket... at least until a connection gets it for its own use. - ownSocket_ = true; - - synchronized (nextConnectionIdLock_) - { - connectionId_ = ++nextConnectionId_; - } - - // Get the next request. - PxReqSV request = (PxReqSV)factory_.getNextDS(input_); - if (Trace.isTraceProxyOn()) request.dump(Trace.getPrintWriter()); - - // Process the request and return the reply, if any. - PxRepSV reply = (PxRepSV)request.process(); - if (reply != null) - { - reply.setCorrelationId(request.getCorrelationId()); - synchronized (output_) - { - if (Trace.isTraceProxyOn()) reply.dump(Trace.getPrintWriter()); - reply.writeTo(output_); - output_.flush(); - } - } - } - catch (Exception e) - { - Verbose.println(e); - Trace.log(Trace.ERROR, "Exception processing proxy request:", e); - } - finally - { - closeSocket(); - } - } - - running_ = false; - } - - // Stops the thread safely. - public void stopSafely() - { - super.stopSafely(); - - // Close the sockets, etc. - closeServerSocket(); - - // Wait for controller loop to finish. This verifies that the socket was finally closed. (On some platforms (e.g. Windows) it seems like the close does not take full effect until a few seconds after close() is called. - try - { - while (running_) Thread.sleep(500); - } - catch(InterruptedException e) - { - // Ignore. - } - - Verbose.println(ResourceBundleLoader.getText("PROXY_SERVER_ENDED", serverSocket_)); - } - - public String toString() - { - return serverSocket_.toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/PSEventDispatcher.java b/cvsroot/src/com/ibm/as400/access/PSEventDispatcher.java deleted file mode 100644 index c352cc90f..000000000 --- a/cvsroot/src/com/ibm/as400/access/PSEventDispatcher.java +++ /dev/null @@ -1,64 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PSEventDispatcher.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.EventObject; - - - -/** -The PxMethodEventDispatcher class dispatches -events fired within the ProxyServer to the -client. -**/ -class PSEventDispatcher -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private PSConnection connection_; - private PxTable proxyTable_; - private long proxyId_; - - - -/** -Constructs a PxMethodEventDispatcher object. - -@param connection The proxy server connection. -@param proxyId The proxy id. -**/ - public PSEventDispatcher (PSConnection connection, PxTable proxyTable, long proxyId) - { - connection_ = connection; - proxyTable_ = proxyTable; - proxyId_ = proxyId; - } - - - - public void fireEvent (String listenerInterfaceName, - String listenerMethodName, - EventObject event) - { - PxEventRepSV reply = new PxEventRepSV (proxyTable_, proxyId_, listenerInterfaceName, listenerMethodName, event); - connection_.send (reply); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PSLoad.java b/cvsroot/src/com/ibm/as400/access/PSLoad.java deleted file mode 100644 index 6ca49c261..000000000 --- a/cvsroot/src/com/ibm/as400/access/PSLoad.java +++ /dev/null @@ -1,252 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PSLoad.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The PSLoad class represents the current load -for a proxy server. -**/ -class PSLoad -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private int activeConnections_ = 0; - private int balanceThreshold_ = -1; - private int effectiveBalanceThreshold_ = -1; - private int effectiveMaxConnections_ = -1; - private int maxConnections_ = -1; - - - -/** -Constructs a PSLoad object. -**/ - public PSLoad () - { - computeEffective (); - } - - - -/** -Constructs a PSLoad object. - -@param activeConnections The number of active connections. -@param balanceThreshold The balance threshold. Specify 0 - to start load balancing - immediately or -1 to never start - load balancing. -@param maxConnections The maximum number of connections - which can be active at any particular - time. Specify 0 to not allow any - connections or -1 for unlimited - connections. -**/ - public PSLoad (int activeConnections, - int balanceThreshold, - int maxConnections) - { - activeConnections_ = activeConnections; - balanceThreshold_ = balanceThreshold; - maxConnections_ = maxConnections; - computeEffective (); - } - - - -/** -Marks all connections as closed. -**/ - public void allConnectionsClosed () - { - activeConnections_ = 0; - } - - - -/** -Computes the effective max connections and -balance threshold. These eliminate the possibility -of -1, which has special meaning in both cases. -**/ - private void computeEffective () - { - effectiveMaxConnections_ = (maxConnections_ < 0) ? Integer.MAX_VALUE : maxConnections_; - effectiveBalanceThreshold_ = (balanceThreshold_ < 0) ? effectiveMaxConnections_ : balanceThreshold_; - } - - - -/** -Marks a connection as closed. -**/ - public void connectionClosed () - { - if (activeConnections_ > 0) - --activeConnections_; - } - - - -/** -Marks a connection as opened. -**/ - public void connectionOpened () - { - ++activeConnections_; - } - - - -/** -Returns the number of active connections. - -@return The number of active connections. -**/ - public int getActiveConnections () - { - return activeConnections_; - } - - - -/** -Returns the balance threshold. This is the number of -connections that must be active before the peer server starts -load balancing by dispatching requests to peer proxy servers. -Specify 0 to start load balancing immediately or -1 to never -start load balancing. - -@return The balance threshold, or 0 to start load - balancing immediately or -1 to never start load - balancing. -**/ - public int getBalanceThreshold () - { - return balanceThreshold_; - } - - - -/** -Returns the quantification of how busy the proxy server is. - -@return The quantification of how busy the proxy server is. - This number is between 0 and 1. The higher the - number is, the busier the proxy server is. -**/ - public double getBusyFactor () - { - if (effectiveMaxConnections_ != 0) - return ((double) activeConnections_) / ((double) effectiveMaxConnections_); - else - return 1; - } - - - -/** -Returns the effective balance threshold. - -@return The effective balance threshold. This will - never be -1. -**/ - public int getEffectiveBalanceThreshold () - { - return effectiveBalanceThreshold_; - } - - - -/** -Returns the effective max connections. - -@return The effective max connections. This will - never be -1. -**/ - public int getEffectiveMaxConnections () - { - return effectiveMaxConnections_; - } - - - -/** -Returns the maximum number of connections which can be -active at any particular time. - -@return The maximum number of connections which can be - active at any particular time, or -1 for - unlimited connections. -**/ - public int getMaxConnections () - { - return maxConnections_; - } - - - -/** -Sets the balance threshold. This is the number of connections -that must be active before the peer server starts load balancing -by dispatching requests to peer proxy servers. - -@param balanceThreshold The balance threshold. - Specify 0 to start load balancing - immediately or -1 to never start - load balancing. - -**/ - public void setBalanceThreshold (int balanceThreshold) - { - if (balanceThreshold < -1) - throw new ExtendedIllegalArgumentException ("balanceThreshold", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - balanceThreshold_ = balanceThreshold; - computeEffective (); - } - - - -/** -Sets the maximum number of connections which can be active -at any particular time. If the maximum number of connections -are active, then any further connection requests will be -rejected. The default is to allow an unlimited number of -connections. - -@param maxConnections The maximum number of connections - which can be active at any particular - time. Specify 0 to not allow any - connections or -1 for unlimited - connections. -**/ - public void setMaxConnections (int maxConnections) - { - if (maxConnections < -1) - throw new ExtendedIllegalArgumentException ("maxConnections", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - maxConnections_ = maxConnections; - computeEffective (); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PSLoadBalancer.java b/cvsroot/src/com/ibm/as400/access/PSLoadBalancer.java deleted file mode 100644 index 2f8290d37..000000000 --- a/cvsroot/src/com/ibm/as400/access/PSLoadBalancer.java +++ /dev/null @@ -1,213 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: PSLoadBalancer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Enumeration; -import java.util.StringTokenizer; -import java.util.Vector; - - - -/** -The PSLoadBalancer class handles load balancing -for a proxy server. -**/ -class PSLoadBalancer -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - // Private data. - private PSLoad load_ = null; - private Vector peers_ = null; // @A1A - - - -/** -Constructs a PSLoadBalancer object. - -@param load The load. -@param peers The semicolon-delimied list of peers. -**/ - public PSLoadBalancer (PSLoad load) - { - load_ = load; - peers_ = new Vector(); // @A1A - } - - - -/** -Decides whether to accept a connection from a proxy -client. - -@param rejections The number of rejections that the - client has already had. -@return null if accepted, "" if rejected - with no peer available, and - the name of a peer if rejected. -**/ - public String accept (int rejections) - { - String peer = null; - - // If the number of active connections is less - // than the balance threshold, then accept the - // connection. - int activeConnections = load_.getActiveConnections (); - if (activeConnections < load_.getEffectiveBalanceThreshold ()) - peer = null; - - // If the number of active connections is between - // the balance threshold and the max connections, - // then: - // - // * If the request has already been rejected, then - // accept it, otherwise do load balancing including - // this server. - else if (activeConnections < load_.getEffectiveMaxConnections ()) { - if (rejections > 0) - peer = null; - else - peer = getLeastBusyPeer (true); - } - - // If the number of active connections is greater - // than or equal to the max connections, then do - // load balancing NOT including this server. - else - peer = getLeastBusyPeer (false); - - return peer; - } - - - -/** -Returns the name of the least busy peer. This asks each -peer how busy it is. - -@param includeThis true to include this proxy server, - or false otherwise. -@return The name of the least busy peer, null if this - is the least busy peer, or "" if no peers are - available. -**/ - private String getLeastBusyPeer (boolean includeThis) - { - double smallestBusyFactor = Double.MAX_VALUE; - String leastBusyPeer = ""; - - // Ask each peer about its current load. - Vector peersClone = (Vector)peers_.clone(); // @A1A - Enumeration list = peersClone.elements(); // @A1A - while(list.hasMoreElements()) { // @A1C - String peer = (String)list.nextElement(); // @A1A - - // Get the load from the peer. - PSLoad load; - try { - PxPeerConnection peerConnection = new PxPeerConnection (peer); // @A1A - load = peerConnection.load (); - peerConnection.close (); - } - catch(ProxyException e) { - Verbose.println (ResourceBundleLoader.getText("PROXY_PEER_NOT_RESPONDING", peer)); // @A1A - peers_.removeElement(peer); // @A1A - // @A1D if (Trace.isTraceErrorOn()) - // @A1D Trace.log(Trace.ERROR, "Peer proxy server not responding", e); - continue; - } - - // Determine if it is less busy than the previous. - double busyFactor = load.getBusyFactor (); - if (busyFactor < smallestBusyFactor) { - smallestBusyFactor = busyFactor; - leastBusyPeer = peer; // @A1A - } - } - - // Check this one if appropriate. - if (includeThis) { - if (load_.getBusyFactor () < smallestBusyFactor) - leastBusyPeer = null; - } - - return leastBusyPeer; - } - - - -/** -Returns a list of peer proxy servers for use in load balancing. - -@return A list of peer proxy servers for use in load balancing. -**/ - public String[] getPeers () - { - synchronized(peers_) { // @A1A - String[] peersAsArray = new String[peers_.size()]; // @A1A - peers_.copyInto(peersAsArray); // @A1A - return peersAsArray; // @A1C - } - } - - - -/** -Normalizes the list of peers from the String list -to an array. Also eliminates duplicates. - -@param peers The semicolon-delimied list of peers. -**/ - public void setPeers (String peers) - { - StringTokenizer tokenizer = new StringTokenizer (peers, ";, "); - int count = tokenizer.countTokens (); - Vector temp = new Vector (count); - while (tokenizer.hasMoreTokens ()) { - String nextPeer = tokenizer.nextToken (); - if (! temp.contains (nextPeer)) - temp.addElement (nextPeer); - } - peers_ = (Vector)temp.clone(); // @A1C - } - - - -/** -Sets the list of peer proxy servers for use in load -balancing. In some cases, connections to the proxy -server will be reassigned to a peer. The default is -not to do load balancing. - -@param peers The list of peer proxy servers for - use in load balancing, or null to - not do load balancing. -**/ - public void setPeers (String[] peers) - { - Vector temp = new Vector (peers.length); // @A1A - for(int i = 0; i < peers.length; ++i) { // @A1A - if (! temp.contains(peers[i])) // @A1A - temp.addElement(peers[i]); // @A1A - } // @A1A - peers_ = (Vector)temp.clone(); // @A1C - } - - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PSPrintObjectListListener.java b/cvsroot/src/com/ibm/as400/access/PSPrintObjectListListener.java deleted file mode 100644 index e3bc6bc57..000000000 --- a/cvsroot/src/com/ibm/as400/access/PSPrintObjectListListener.java +++ /dev/null @@ -1,111 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PSPrintObjectListListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The PSPrintObjectListListener class dispatches -PrintObjectListEvents fired within the ProxyServer to the -client. -**/ -class PSPrintObjectListListener -extends PSEventDispatcher -implements PrintObjectListListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private static final String listenerInterfaceName_ = "com.ibm.as400.access.PrintObjectListListener"; - - - -/** -Constructs a PSPrintObjectListListener object. - -@param connection The proxy server connection. -@param proxyTable The proxy table. -@param proxyId The proxy id. -**/ - public PSPrintObjectListListener (PSConnection connection, PxTable proxyTable, long proxyId) - { - super (connection, proxyTable, proxyId); - } - - - -/** -Invoked when the list is closed. - -@param event The event. -**/ - public void listClosed (PrintObjectListEvent event) - { - fireEvent (listenerInterfaceName_, "listClosed", event); - } - - - -/** -Invoked when the list has completed. - -@param event The event. -**/ - public void listCompleted (PrintObjectListEvent event) - { - fireEvent (listenerInterfaceName_, "listCompleted", event); - } - - - -/** -Invoked when an error occurs while retrieving the list. - -@param event The event. -**/ - public void listErrorOccurred (PrintObjectListEvent event) - { - fireEvent (listenerInterfaceName_, "listErrorOccurred", event); - } - - - -/** -Invoked when an object is added to the list. - -@param event The event. -**/ - public void listObjectAdded (PrintObjectListEvent event) - { - fireEvent (listenerInterfaceName_, "listObjectAdded", event); - } - - - -/** -Invoked when the list is opened. - -@param event The event. -**/ - public void listOpened (PrintObjectListEvent event) - { - fireEvent (listenerInterfaceName_, "listOpened", event); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PSServerSocketContainer.java b/cvsroot/src/com/ibm/as400/access/PSServerSocketContainer.java deleted file mode 100644 index 7d936f81b..000000000 --- a/cvsroot/src/com/ibm/as400/access/PSServerSocketContainer.java +++ /dev/null @@ -1,95 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PSServerSocketContainer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.net.ServerSocket; -import java.net.SocketException; - - - -/** -The PSServerSocketContainerAdapter class represents a wrapper -around a server socket. -**/ -class PSServerSocketContainer -extends PSServerSocketContainerAdapter -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - // MRI. - private static final String NAME_ = ResourceBundleLoader.getText ("PROXY_SERVER_CONTAINER"); - - - -/** -Constructs a PSServerSocketContainer object. - -@param port The port. -**/ - public PSServerSocketContainer (int port) - throws IOException - { - super (createServerSocket (port)); - } - - - -/** -Creates the server socket. -**/ -// -// Implementation note: This method is a workaround for an apparant -// Win32 bug (documented in Sun's bug parade). It happens when -// creating a ServerSocket on a port previously used, even when -// it was cleaned up properly. -// - private static ServerSocket createServerSocket(int port) - throws IOException - { - ServerSocket serverSocket = null; - try { - serverSocket = new ServerSocket(port); - } - catch(SocketException e) { - // Didn't work? Take a break and try again. - try { - Thread.sleep(500); - } - catch(InterruptedException e1) { - // Ignore. - } - serverSocket = new ServerSocket(port); - } - - return serverSocket; - } - - - -/** -Returns the name of this socket container. - -@return The name of this socket container. -**/ - public String toString () - { - return NAME_; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PSServerSocketContainerAdapter.java b/cvsroot/src/com/ibm/as400/access/PSServerSocketContainerAdapter.java deleted file mode 100644 index 991f79129..000000000 --- a/cvsroot/src/com/ibm/as400/access/PSServerSocketContainerAdapter.java +++ /dev/null @@ -1,100 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: PSServerSocketContainerAdapter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.net.ServerSocket; -import java.net.Socket; - - - -/** -The PSServerSocketContainerAdapter class represents a wrapper -around a server socket. The reason that we need to use a wrapper -is to avoid directly referring to a class that may or may not exist -in the user's environment (e.g. SSLServerSocket). This will avoid -class loader errors when such classes are not found and they are not -needed. -**/ -abstract class PSServerSocketContainerAdapter -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Server Socket. - ServerSocket serverSocket_; //$B1C - - - -/** -Constructs a PSServerSocketContainerAdapter object. - -@param serverSocket The server socket. -**/ - protected PSServerSocketContainerAdapter (ServerSocket serverSocket) - { - serverSocket_ = serverSocket; - } - - - -/** -Accepts a connection to the socket. - -@return The socket for the connection. - -@exception IOException If an error occurs. -**/ - public Socket accept () - throws IOException - { - return serverSocket_.accept (); - } - - - -/** -Closes the socket. - -@exception IOException If an error occurs. -**/ - public void close () - throws IOException - { - serverSocket_.close (); - } - - - -/** -Returns the port on which the socket is listening. - -@return The port on which the socket is listening. -**/ - public int getLocalPort () - { - return serverSocket_.getLocalPort (); - } - - -/** -Indicates if the socket is secure. -**/ - public boolean isSecure () - { - return false; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PSTunnelConnection.java b/cvsroot/src/com/ibm/as400/access/PSTunnelConnection.java deleted file mode 100644 index d1d893549..000000000 --- a/cvsroot/src/com/ibm/as400/access/PSTunnelConnection.java +++ /dev/null @@ -1,141 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: PSTunnelConnection.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.EOFException; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.net.Socket; -import java.net.SocketException; - - -/** -The PSTunnelConnection class represents a tunnel connection -to a client of the proxy server. -**/ -class PSTunnelConnection -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - // Private data. - private boolean closed_ = false; - private long connectionId_; - private PrintWriter trace_; - - - /** - Constructs a PSConnection object for tunneling. - - @param connectionId The connection id. - **/ - public PSTunnelConnection (long connectionId) - { - connectionId_ = connectionId; - - if (Trace.isTraceProxyOn ()) { - trace_ = Trace.getPrintWriter(); - Trace.log (Trace.PROXY, "Px server tunnel connection " + this + " opened."); - } - } - - - - public void close () - { - closed_ = true; - - if (Trace.isTraceProxyOn ()) - Trace.log (Trace.PROXY, "Px server tunnel connection " + this + " closed."); - - Verbose.println (ResourceBundleLoader.getText ("PROXY_CONNECTION_CLOSED", Long.toString (connectionId_))); - } - - - - protected void finalize () - throws Throwable - { - if (! closed_) - close (); - super.finalize (); - } - - - - /** - Handles IOExceptions that are thrown while replying - to requests. - **/ - private void handleIOException (IOException e) - { - // This exception is thrown when the client application ends - // normally. It is also thrown on certain error conditions. - // We need to trace the error conditions, but weed out the - // normal ending. - if (Trace.isTraceErrorOn ()) - if (((!(e instanceof SocketException)) // Normal Windows end. - && (!(e instanceof EOFException))) // Normal AIX end. - || ((e.getMessage () != null) - && (e.getMessage ().indexOf ("JVM_recv") < 0))) - Trace.log (Trace.ERROR, "IOException in PSConnection", e); - - if (! closed_) - close (); - } - - - /** - Processes a single request and sends the reply, if any, using tunneling. - **/ - public void runRequest (PxReqSV request, OutputStream outputStream) - { - PxRepSV reply = request.process (); - if (reply != null) - { - reply.setCorrelationId(request.getCorrelationId()); - reply.setClientId(request.getClientId()); - sendTunneling (reply, outputStream); - } - - } - - /** - Sends a reply. - **/ - public void sendTunneling (PxRepSV reply, OutputStream outputStream) - { - try - { - if (reply != null) - { - synchronized (outputStream) { - if (Trace.isTraceProxyOn ()) - { - reply.dump(trace_); - } - reply.writeTo(outputStream); - outputStream.flush(); - } - } - } - catch (IOException e) - { - handleIOException (e); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/PSTunnelController.java b/cvsroot/src/com/ibm/as400/access/PSTunnelController.java deleted file mode 100644 index 87fff3abb..000000000 --- a/cvsroot/src/com/ibm/as400/access/PSTunnelController.java +++ /dev/null @@ -1,324 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: PSTunnelController.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.net.InetAddress; -import java.util.Vector; -import java.util.Hashtable; -import java.util.Enumeration; - - - -/** -The PSTunnelController class represents a connection -to a client of the proxy server. -**/ -class PSTunnelController -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static long nextConnectionId_ = 1000; - private static Object nextConnectionIdLock_ = new Object (); - - private long connectionId_ = -1; - private PxDSFactory factory_; - private static Hashtable clientIds_; - private static long nextClientId_ = 1; - private static Object nextClientIdLock_ = new Object (); - private PxTable proxyTable_; - private static Hashtable useTimes_; //@A1A - - private transient long clientCleanupInterval_ = 7200000; //@A1A 2 hours - private transient long clientLifetime_ = 1800000; //@A1A 30 minutes - - transient TunnelProxyServerMaintenance maintenance_; - - /** - Constructs a PSController object. - - @param proxyServer The proxy server. - **/ - public PSTunnelController (ProxyServer proxyServer) - { - clientIds_ = new Hashtable(); - useTimes_ = new Hashtable(); //@A1A - - proxyTable_ = new PxTable (); - - factory_ = new PxDSFactory (); - factory_.register (new PxByteParm ()); - factory_.register (new PxShortParm ()); - factory_.register (new PxBooleanParm ()); - factory_.register (new PxIntParm ()); - factory_.register (new PxStringParm ()); - factory_.register (new PxSerializedObjectParm (null)); - factory_.register (new PxTunnelConnectReqSV (this, clientIds_)); - factory_.register (new PxLoadReqSV (new PSLoad())); - factory_.register (new PxLongParm ()); - factory_.register (new PxFloatParm ()); - factory_.register (new PxDoubleParm ()); - factory_.register (new PxCharParm ()); - factory_.register (new PxToolboxObjectParm ()); - factory_.register (new PxNullParm ()); - factory_.register (new PxClassParm ()); - factory_.register (new PxPxObjectParm (proxyTable_)); - - factory_.register (new PxConstructorReqSV (proxyTable_)); - factory_.register (new PxMethodReqSV (proxyTable_)); - factory_.register (new PxFinalizeReqSV (proxyTable_)); - - initializeTransient(); - if (Trace.isTraceProxyOn ()) - Trace.log (Trace.PROXY, "Px server controller " + this + " opened."); - } - - //@A1A - /** - * Remove any connections that have exceeded maximum lifetime. - **/ - void cleanupConnections() - { - synchronized (useTimes_) - { - Enumeration keys = useTimes_.keys(); - while (keys.hasMoreElements()) - { - Long key = (Long)keys.nextElement(); - long timeLastRun = ((Long)useTimes_.get(key)).longValue(); - if ((System.currentTimeMillis()-timeLastRun) > - clientLifetime_) - { - //Remove from table of clientId/PSTunnelConnection object - synchronized (clientIds_) - { - clientIds_.remove(key); - } - //Remove from table of last use times - useTimes_.remove(key); - //Remove all objects associated with clientId from table - proxyTable_.removeClientId(key.longValue()); - } - } - } - } - - - /** - Returns a new clientId. - - @return A new clientId that hasn't been used. - **/ - public static long getNextClientId () - { - synchronized (nextClientIdLock_) - { - nextClientId_ = ++nextClientId_; - return nextClientId_; - } - } - - /** - Returns the current requesting client's unique connection id. - - @return The current requesting client's unique connection id. - **/ - public long getConnectionId () - { - return connectionId_; - } - - /** - Initialize transient data. - **/ - private void initializeTransient () - { - try - { - String clientCleanupInterval = SystemProperties.getProperty(SystemProperties.TUNNELPROXYSERVER_CLIENTCLEANUPINTERVAL); - if (clientCleanupInterval != null) - { - clientCleanupInterval_ = Long.valueOf(clientCleanupInterval).longValue() * 1000; - } - String clientLifetime = SystemProperties.getProperty(SystemProperties.TUNNELPROXYSERVER_CLIENTLIFETIME); - if (clientLifetime != null) - { - clientLifetime_ = Long.valueOf(clientLifetime).longValue() * 1000; - } - } - catch (NumberFormatException ne) - { - } - if (clientCleanupInterval_ > 0) // do not do cleanup if <= 0 - { - maintenance_ = new TunnelProxyServerMaintenance(); - maintenance_.start(); - // Give thread a chance to start (similar to code in AS400ConnectionPool to fix - // Linux JVM behavior). - if (!maintenance_.isRunning()) //@A1A - { //@A1A - try //@A1A - { //@A1A - Thread.sleep(10); //@A1A - } //@A1A - catch (InterruptedException e) //@A1A - { /*Should not happen*/ } //@A1A - } //@A1A - // If thread has still not started, keep giving it chances for 5 minutes. - for (int i = 1; !maintenance_.isRunning() && i<6000; i++) //@A1A - { - try - { //@A1A - Thread.sleep(50); //@A1A - } //@A1A - catch (InterruptedException e) //@A1A - { /*Should not happen*/ } //@A1A - } //@A1A - if (!maintenance_.isRunning()) //@A1A - Trace.log(Trace.WARNING, "maintenance thread failed to start"); //@A1A - } - } - - /** - Runs the controller with an InputStream and an OutputStream. - **/ - public void runInputStream (InputStream inputStream, OutputStream outputStream) - throws IOException - { - try - { - // Get a request. - PxReqSV request = (PxReqSV) factory_.getNextDS (inputStream); - if (Trace.isTraceProxyOn ()) - request.dump (Trace.getPrintWriter ()); - - long clientId = request.getClientId(); - - // If the request is a connect request, process here. - if (request instanceof PxTunnelConnectReqSV) - { - synchronized (nextConnectionIdLock_) { - connectionId_ = ++nextConnectionId_; - } - - PxRepSV reply; - - // Process the request and return the reply, if any. - reply = (PxRepSV) request.process (); - if (reply != null) - { - if (clientCleanupInterval_ > 0) // do not do cleanup if <= 0 //@A1A - { //@A1A - useTimes_.put(new Long(reply.getClientId()), new Long(System.currentTimeMillis())); //@A1A - } //@A1A - reply.setCorrelationId(request.getCorrelationId()); - - synchronized (outputStream) { - if (Trace.isTraceProxyOn ()) - reply.dump (Trace.getPrintWriter ()); - reply.writeTo(outputStream); - outputStream.flush(); - } - } - } - // Else check to see if a valid clientId_ was specified in request. If no, return an - // exception. If yes, give the request to the connection object for this clientId_. - else - { - PSTunnelConnection connectionObject = (PSTunnelConnection)clientIds_.get(new Long(clientId)); - if (connectionObject == null) - { - PxRepSV reply = new PxExceptionRepSV(new ProxyException (ProxyException.CONNECTION_DROPPED)); - reply.setCorrelationId(request.getCorrelationId()); - synchronized (outputStream) { - if (Trace.isTraceProxyOn ()) - reply.dump (Trace.getPrintWriter ()); - reply.writeTo(outputStream); - outputStream.flush(); - } - } - else - { - connectionObject.runRequest(request, outputStream); - if (clientCleanupInterval_ > 0) // do not do cleanup if <= 0 //@A1A - { //@A1A - useTimes_.put(new Long(clientId), new Long(System.currentTimeMillis())); //@A1A - } //@A1A - } - } - } - catch (IOException e) - { - Trace.log (Trace.ERROR, "IOException in PSTunnelConnection::runInputStream", e); - throw e; - } - } - - //@A1A - //clean up client connections that have expired - class TunnelProxyServerMaintenance extends Thread - { - private boolean run_ = false; // Whether the maintenance is running. - /** - * Constructs a TunnelProxyServerMaintenance object. - **/ - public TunnelProxyServerMaintenance() - { - super(); - setDaemon(true); - } - - /** - * Indicates whether the maintenance thread is running. - * @return true if running; false otherwise. - * Default value is false. - **/ - public boolean isRunning() - { - return run_; - } - - /** - * Runs the TunnelProxyServer maintenance thread. - **/ - public synchronized void run() - { - run_ = true; - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "TunnelProxyServer maintenance daemon is started..."); - - while (true) - { - try - { - // sleep for cleanup interval. - sleep(clientCleanupInterval_); - cleanupConnections(); - } - catch (InterruptedException ie) - { - // Should not happen. - Trace.log(Trace.ERROR, "TunnelProxyServer maintenance daemon failed."); - } - } - } - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/PTF.java b/cvsroot/src/com/ibm/as400/access/PTF.java deleted file mode 100644 index 486c8824b..000000000 --- a/cvsroot/src/com/ibm/as400/access/PTF.java +++ /dev/null @@ -1,1792 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PTF.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.util.Calendar; -import java.util.TimeZone; -import java.util.Date; -import java.util.Locale; - -/** - * Represents a Program Temporary Fix (PTF) for a licensed program - * product. Call {@link #refresh refresh()} to reload all of the values from the system. - * Individual getters will only refresh their own necessary information. - * @see com.ibm.as400.access.Product#getPTFs -**/ -public class PTF -{ - private AS400 system_; - private String productID_; - private String returnedProductID_; // Product ID that comes back on the API call. - private boolean actionPending_; - private String actionRequired_; - private boolean hasCoverLetter_; - private int iplAction_; - private String iplRequired_; - private String loadedStatus_; - private String maximumLevel_; - private String minimumLevel_; - private boolean ptfOnOrder_; - private String ptfProductLoad_; - private String ptfProductOption_; - private String ptfID_; - private boolean isPTFReleased_; - private String ptfReleaseLevel_; - private String returnedReleaseLevel_; // Release level that comes back on the API call. - private boolean saveFileExists_; - private Date statusDate_; - - private String currentIPLSource_; - private String licGroup_; - private String saveFile_; - private String supersedingPTF_; - private String targetRelease_; - //private String supersededByPTFID_; // V5R2 - //private String currentServerIPLSource_; // V5R3 - private int serverIPLRequired_ = -1; // V5R3 - private String creationDateAndTime_; // V5R3 - - private boolean loaded_ = false; - private boolean partiallyLoaded_ = false; - private boolean partiallyLoadedGroup_ = false; //@K1A - private boolean loaded200_ = false; - private boolean loaded300_ = false; - private boolean loaded500_ = false; - private boolean loaded600_ = false; - private boolean loaded700_ = false; - private boolean loaded800_ = false; -// private boolean loaded900_ = false; - private int chunkSize_ = 8192; - - // PTFR0200 - private PTFCoverLetter[] coverLetters_; - - // PTFR0300 - private PTF[] requisites_; - private boolean isPreRequisite_; // type - private boolean isCoRequisite_; // type - private boolean isConditional_; - private boolean isRequired_; - - // PTFR0500 - private PTF[] dependents_; - private boolean isDependent_; // type - - private boolean loadedRequisites_ = false; - private boolean loadedDependents_ = false; - - // PTFR0600 - private String[] apars_; - - // PTFR0700 - private String[] symptoms_; - - // PTFR0800 - private PTFExitProgram[] exitPrograms_; - - // PTFR0900 -// private PTFPrecondition[] preconditions_; - - private String messageData_; // This is loaded from CPX3501 and contains the translated text. - - - - /** - * Constant indicating that no action is required. - **/ - public static final String ACTION_NOT_REQUIRED = "0"; - - /** - * Constant indicating that the PTF contains activation instructions - * in the cover letter. The PTF has an exit program to update the - * status of the PTF after the activation instructions have been - * performed. - **/ - public static final String ACTION_REQUIRED_EXIT_PROGRAM = "1"; - - /** - * Constant indicating that the PTF contains activation instructions - * in the cover letter, but no exit program exists to verify the - * activation instructions were performed. - **/ - public static final String ACTION_REQUIRED_CANNOT_VERIFY = "2"; - - - - /** - * Constant indicating no action will occur at the next IPL. - **/ - public static final int IPL_ACTION_NONE = 0; - - /** - * Constant indicating the PTF will be temporarily applied at the next IPL. - **/ - public static final int IPL_ACTION_APPLY_TEMPORARY = 1; - - /** - * Constant indicating the PTF will be temporarily removed at the next IPL. - **/ - public static final int IPL_ACTION_REMOVE_TEMPORARY = 2; - - /** - * Constant indicating the PTF will be permanently applied at the next IPL. - **/ - public static final int IPL_ACTION_APPLY_PERMANENT = 3; - - /** - * Constant indicating the PTF will be permanently removed at the next IPL. - **/ - public static final int IPL_ACTION_REMOVE_PERMANENT = 4; - - - - /** - * Constant indicating the system is currently operating on the A IPL source. - **/ - public static final String IPL_SOURCE_A = "A"; - - /** - * Constant indicating the system is currently operating on the B IPL source. - **/ - public static final String IPL_SOURCE_B = "B"; - - /** - * Constant indicating the current IPL source could not be determined. - **/ - public static final String IPL_SOURCE_UNKNOWN = " "; - - - - /** - * Constant representing a product ID of *ONLY. - **/ - public static final String PRODUCT_ID_ONLY = "*ONLY"; - - /** - * Constant representing a release level of *ONLY. - **/ - public static final String PRODUCT_RELEASE_ONLY = "*ONLY"; - - - - /** - * Constant indicating that the PTF is delayed and must be applied at IPL time. - **/ - public static final String PTF_TYPE_DELAYED = "0"; - - /** - * Constant indicating that the PTF is immediate and can be applied immediately. - * No IPL is needed. - **/ - public static final String PTF_TYPE_IMMEDIATE = "1"; - - /** - * Constant indicating that the PTF type is not known. - **/ - public static final String PTF_TYPE_UNKNOWN = " "; - - - - /** - * Constant indicating that there is a co-requisite relationship between two PTFs. - * @see #getRelationship - **/ - public static final String RELATIONSHIP_COREQ = "*COREQ"; - - /** - * Constant indicating that there is a dependent (pre-requisite) relationship between two PTFs. - * @see #getRelationship - **/ - public static final String RELATIONSHIP_DEPEND = "*DEPEND"; - - /** - * Constant indicating that there is no known relationship between two PTFs. - * @see #getRelationship - **/ - public static final String RELATIONSHIP_NONE = "*NONE"; - - /** - * Constant indicating that there is a pre-requisite relationship between two PTFs. - * @see #getRelationship - **/ - public static final String RELATIONSHIP_PREREQ = "*PREREQ"; - - /** - * Constant indicating that two PTFs are identical. - * @see #getRelationship - **/ - public static final String RELATIONSHIP_SAME = "*SAME"; - - - - /** - * Constant indicating that a PTF is not loaded. - **/ - public static final String STATUS_NOT_LOADED = "0"; - - /** - * Constant indicating that a PTF is loaded. - **/ - public static final String STATUS_LOADED = "1"; - - /** - * Constant indicating that a PTF is applied. - **/ - public static final String STATUS_APPLIED = "2"; - - /** - * Constant indicating that a PTF is permanently applied. - **/ - public static final String STATUS_APPLIED_PERMANENT = "3"; - - /** - * Constant indicating that a PTF is permanently removed. - **/ - public static final String STATUS_REMOVED_PERMANENT = "4"; - - /** - * Constant indicating that a PTF is damaged. - **/ - public static final String STATUS_DAMAGED = "5"; - - /** - * Constant indicating that a PTF is superseded. - **/ - public static final String STATUS_SUPERSEDED = "6"; - - - - /** - * Constructs a PTF object. The product ID defaults to PRODUCT_ID_ONLY - * and the release level defaults to PRODUCT_RELEASE_ONLY. - * @param system The system. - * @param ptfID The PTF ID. Example: "SF64578" - **/ - public PTF(AS400 system, String ptfID) - { - this(system, ptfID, PRODUCT_ID_ONLY, PRODUCT_RELEASE_ONLY); - } - - - /** - * Constructs a PTF object. - * @param system The system. - * @param ptfID The PTF ID. Example: "SF64578" - * @param productID The product ID (for example: "5722JC1"). This value must - * either be {@link #PRODUCT_ID_ONLY PRODUCT_ID_ONLY} or a valid product ID. - * @param releaseLevel The PTF release level (for example: "V5R1M0"). This value - * must either be {@link #PRODUCT_RELEASE_ONLY PRODUCT_RELEASE_ONLY} or a valid release level. - **/ - public PTF(AS400 system, String ptfID, String productID, String releaseLevel) - { - if (system == null) throw new NullPointerException("system"); - if (ptfID == null) throw new NullPointerException("ptfID"); - if (productID == null) throw new NullPointerException("productID"); - if (releaseLevel == null) throw new NullPointerException("releaseLevel"); - - system_ = system; - String id = ptfID.toUpperCase().trim(); - if (id.length() != 7) - { - throw new ExtendedIllegalArgumentException("ptfID (" + ptfID + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - String prod = productID.toUpperCase().trim(); - if (prod.length() != 7 && !prod.equals(PRODUCT_ID_ONLY)) - { - throw new ExtendedIllegalArgumentException("productID (" + productID + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - String release = releaseLevel.toUpperCase().trim(); - if (!prod.equals(PRODUCT_RELEASE_ONLY) && release.length() != 6) - { - throw new ExtendedIllegalArgumentException("releaseLevel (" + releaseLevel + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - ptfID_ = id; - productID_ = prod; - ptfReleaseLevel_ = release; - } - - - /** - * Package scope constructor called by the others. - **/ - PTF(AS400 system, String productID, String ptfID, String ptfReleaseLevel, String ptfOption, String ptfFeature) - { - system_ = system; - productID_ = productID; - ptfID_ = ptfID; - ptfReleaseLevel_ = ptfReleaseLevel; - ptfProductOption_ = ptfOption; - ptfProductLoad_ = ptfFeature; - } - - - /** - * Package scope constructor used for dependent PTFs. - **/ - PTF(AS400 system, String productID, String ptfID, String ptfReleaseLevel, String ptfProductOption, String ptfProductLoad, - String minLevel, String maxLevel, boolean type) - { - this(system, productID, ptfID, ptfReleaseLevel, ptfProductOption, ptfProductLoad); - minimumLevel_ = minLevel; - maximumLevel_ = maxLevel; - isDependent_ = type; - isCoRequisite_ = !type; - loadedDependents_ = true; - } - - - /** - * Package scope constructor used for requisite PTFs. - **/ - PTF(AS400 system, String productID, String ptfID, String ptfReleaseLevel, String ptfProductOption, String ptfProductLoad, - String minLevel, String maxLevel, boolean type, boolean cond, boolean reqRequired) - { - this(system, productID, ptfID, ptfReleaseLevel, ptfProductOption, ptfProductLoad); - minimumLevel_ = minLevel; - maximumLevel_ = maxLevel; - isPreRequisite_ = type; - isCoRequisite_ = !type; - isConditional_ = cond; - isRequired_ = reqRequired; - loadedRequisites_ = true; - } - - - /** - * Package scope constructor used by Product.getPTFs(). - **/ - PTF(AS400 system, String productID, String ptfID, String ptfReleaseLevel, String ptfProductOption, String ptfProductLoad, - String loadedStatus, boolean saveFileExists, boolean hasCoverLetter, boolean ptfOnOrder, - int iplAction, boolean actionPending, String actionRequired, String iplRequired, - boolean isPTFReleased, String minimumLevel, String maximumLevel, Date statusDate) - { - this(system, productID, ptfID, ptfReleaseLevel, ptfProductOption, ptfProductLoad); - loadedStatus_ = loadedStatus; - saveFileExists_ = saveFileExists; - hasCoverLetter_ = hasCoverLetter; - ptfOnOrder_ = ptfOnOrder; - iplAction_ = iplAction; - actionPending_ = actionPending; - actionRequired_ = actionRequired; - iplRequired_ = iplRequired; - isPTFReleased_ = isPTFReleased; - minimumLevel_ = minimumLevel; - maximumLevel_ = maximumLevel; - statusDate_ = statusDate; - partiallyLoaded_ = true; - } - - //@K1A - /** - * Package scope constructor used by PTFGroup.getPTFs(). - **/ - PTF(AS400 system, String ptfID, String productID, String ptfReleaseLevel, String ptfProductOption, String ptfProductLoad, - String minimumLevel, String maximumLevel, String loadedStatus, int iplAction, String actionPending, String actionRequired, - String coverLetterStatus, String onOrderStatus, String saveFileStatus, String saveFileName, String saveFileLibraryName, - String supersededByPTFId, String latestSupersedingPTFId, String productStatus) - { - this(system, productID, ptfID, ptfReleaseLevel, ptfProductOption, ptfProductLoad); - //currently no getters for 'Save file library name', 'latest superseding ptf', 'product status' - loadedStatus_ = loadedStatus; - saveFileExists_ = saveFileStatus.equals("0") ? false : true; - hasCoverLetter_ = coverLetterStatus.equals("0") ? false : true; - ptfOnOrder_ = onOrderStatus.equals("0") ? false : true; - iplAction_ = iplAction; - actionPending_ = actionPending.equals("0") ? false : true; - actionRequired_ = actionRequired; - minimumLevel_ = minimumLevel; - maximumLevel_ = maximumLevel; - saveFile_ = saveFileName; - supersedingPTF_ = supersededByPTFId; - partiallyLoadedGroup_ = true; - - } - - - /** - * Returns the action required to make this PTF active when it is applied. - * See the cover letter to determine what action needs to be taken. Possible - * return values are: - *
      - *
    • {@link #ACTION_NOT_REQUIRED ACTION_NOT_REQUIRED} - *
    • {@link #ACTION_REQUIRED_EXIT_PROGRAM ACTION_REQUIRED_EXIT_PROGRAM} - *
    • {@link #ACTION_REQUIRED_CANNOT_VERIFY ACTION_REQUIRED_CANNOT_VERIFY} - *
        - * @return The action required. - **/ - public String getActionRequired() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_ && !partiallyLoaded_ && !partiallyLoadedGroup_) refresh(100); //@K1C - return actionRequired_; - } - - - /** - * Retrieves the list of APAR numbers that were fixed by this PTF. - * @return The APAR numbers. - * @see #getSymptomStrings - **/ - public String[] getAPARNumbers() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded600_) refresh(600); - return apars_; - } - - - /** - * Retrieves the cover letter for this PTF from the system. - * The cover letter returned is for the default NLV for the system. - * If there are no cover letters, this method returns null. - * @return The cover letter. - **/ - public PTFCoverLetter getCoverLetter() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - return getCoverLetter(system_.getLocale()); - } - - - /** - * Retrieves the cover letter for this PTF from the system based on the given locale. - * The cover letter returned is for the NLV that corresponds to the given locale. - * If there is no cover letter that corresponds to the determined NLV, the first one - * retrieved from the system is returned. If there are no cover letters, null is returned. - * @param locale The locale. - * @return The cover letter. - **/ - public PTFCoverLetter getCoverLetter(Locale locale) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - PTFCoverLetter[] letters = getCoverLetters(); - if (letters.length > 0) - { - String nlv = ExecutionEnvironment.getNlv(locale); - for (int i=0; i - *
      • {@link #IPL_SOURCE_A IPL_SOURCE_A} - *
      • {@link #IPL_SOURCE_B IPL_SOURCE_B} - *
      • {@link #IPL_SOURCE_UNKNOWN IPL_SOURCE_UNKNOWN} - *
      - * @return The current IPL source. - **/ - public String getCurrentIPLSource() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_) refresh(100); - return currentIPLSource_; - } - - - /** - * Retrieves the list of PTFs that are dependent upon this PTF. - * If there are no dependent PTFs, an array of size 0 will be returned. - * @return The array of dependent PTFs. - * @see #getRequisitePTFs - * @see #getSupersedingPTF - **/ - public PTF[] getDependentPTFs() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded500_) refresh(500); - return dependents_; - } - - - /** - * Retrieves the list of exit programs for this PTF. - * @return The array of exit programs. - **/ - public PTFExitProgram[] getExitPrograms() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded800_) refresh(800); - return exitPrograms_; - } - - - /** - * Returns the ID number for this PTF. - * @return The PTF ID. Example: "SF64578" - **/ - public String getID() - { - return ptfID_; - } - - - /** - * Returns the action to be taken on this PTF during the next IPL. - * Possible values are: - *
        - *
      • {@link #IPL_ACTION_NONE IPL_ACTION_NONE} - *
      • {@link #IPL_ACTION_APPLY_TEMPORARY IPL_ACTION_APPLY_TEMPORARY} - *
      • {@link #IPL_ACTION_REMOVE_TEMPORARY IPL_ACTION_REMOVE_TEMPORARY} - *
      • {@link #IPL_ACTION_APPLY_PERMANENT IPL_ACTION_APPLY_PERMANENT} - *
      • {@link #IPL_ACTION_REMOVE_PERMANENT IPL_ACTION_REMOVE_PERMANENT} - *
      - * @return The IPL action. - **/ - public int getIPLAction() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_ && !partiallyLoaded_ && !partiallyLoadedGroup_) refresh(100); //@K1C - return iplAction_; - } - - - /** - * Returns the type of PTF (delayed or immediate). - * Possible values are: - *
        - *
      • {@link #PTF_TYPE_DELAYED PTF_TYPE_DELAYED} - *
      • {@link #PTF_TYPE_IMMEDIATE PTF_TYPE_IMMEDIATE} - *
      • {@link #PTF_TYPE_UNKNOWN PTF_TYPE_UNKNOWN} - *
      - * @return The type of PTF. This indicates if an IPL is required to apply the PTF. - **/ - public String getIPLRequired() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_ && !partiallyLoaded_) refresh(100); - return iplRequired_; - } - - - /** - * Returns the name of the Licensed Internal Code Group for this PTF. If the name - * of the group is not available or if the PTF is not a Licensed Internal Code - * fix, this method returns "". - * @return The Licensed Interanl Code Group name. - **/ - public String getLICGroup() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_) refresh(100); - return licGroup_; - } - - - /** - * Returns the current loaded status of this PTF. See the - * {@link #getLoadedStatusMessage getLoadedStatusMessage()} method - * for the translated description text of the loaded status. - * Possible values are: - *
        - *
      • {@link #STATUS_NOT_LOADED STATUS_NOT_LOADED} - *
      • {@link #STATUS_LOADED STATUS_LOADED} - *
      • {@link #STATUS_APPLIED STATUS_APPLIED} - *
      • {@link #STATUS_APPLIED_PERMANENT STATUS_APPLED_PERMANENT} - *
      • {@link #STATUS_REMOVED_PERMANENT STATUS_REMOVED_PERMANENT} - *
      • {@link #STATUS_DAMAGED STATUS_DAMAGED} - *
      • {@link #STATUS_SUPERSEDED STATUS_SUPERSEDED} - *
      - * @return The loaded status. - * @see #getLoadedStatusMessage - **/ - public String getLoadedStatus() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_ && !partiallyLoaded_ && !partiallyLoadedGroup_) refresh(100); //@K1C - return loadedStatus_; - } - - - /** - * Returns the translated description text for the specified status. - * The text is retrieved from the CPX3501 message on the system. - * @param loadedStatus The loaded status. See {@link #getLoadedStatus getLoadedStatus()} - * for the list of valid values. - * @return The status message, or "" if the loaded status was not valid. - **/ - public String getLoadedStatusMessage(String loadedStatus) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (messageData_ == null) - { - try - { - MessageFile mf = new MessageFile(system_, "/QSYS.LIB/QCPFMSG.MSGF"); - AS400Message msg = mf.getMessage("CPX3501"); - if (msg != null) messageData_ = msg.getHelp(); - } - catch (PropertyVetoException pve) {} // will never happen - } - // String, offset, length - // NONE, 0, 11 - // DAMAGED, 11, 16 - // SUPERSEDED, 27, 20 - // TEMPORARILY APPLIED, 47, 35 - // NOT APPLIED, 82, 22 - // PERMANENTLY APPLIED, 104, 35 - // ON ORDER ONLY, 139, 25 - // SAVE FILE ONLY, 164, 27 - // COVER LETTER ONLY, 191, 32 - // TEMPORARILY APPLIED - ACN, 223, 43 - // TEMPORARILY REMOVED - ACN, 266, 43 - // PERMANENTLY REMOVED - ACN, 309, 43 - // PERMANENTLY APPLIED - ACN, 352, 43 - // TEMPORARILY APPLIED - PND, 395, 43 - // TEMPORARILY REMOVED - PND, 438, 43 - // PERMANENTLY REMOVED - PND, 481, 43 - // PERMANENTLY APPLIED - PND, 524, 43 - // PERMANENTLY REMOVED, 567, 35 - if (loadedStatus.equals(STATUS_NOT_LOADED)) - { - return messageData_.substring(0, 11).trim(); - } - if (loadedStatus.equals(STATUS_DAMAGED)) - { - return messageData_.substring(11, 27).trim(); - } - else if (loadedStatus.equals(STATUS_SUPERSEDED)) - { - return messageData_.substring(27, 47).trim(); - } - else if (loadedStatus.equals(STATUS_APPLIED)) - { - return messageData_.substring(47, 82).trim(); // temporarily applied - } - else if (loadedStatus.equals(STATUS_APPLIED_PERMANENT)) - { - return messageData_.substring(104, 139).trim(); - } - else if (loadedStatus.equals(STATUS_LOADED)) - { - return messageData_.substring(82, 104).trim(); // not applied - } - else if (loadedStatus.equals(STATUS_REMOVED_PERMANENT)) - { - return messageData_.substring(567, 602).trim(); - } - return ""; - } - - - /** - * Returns the highest release level of the product on which this - * PTF can be installed. If the minimum and maximum levels are the - * same, this PTF can only be installed on one level of the product. - * The level can be "AA" through "99", or blank if the product has - * no level. - * @return The release level. - * @see #getMinimumLevel - **/ - public String getMaximumLevel() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_ && !partiallyLoaded_ && !partiallyLoadedGroup_) refresh(100); //@K1C - return maximumLevel_; - } - - - /** - * Returns the lowest release level of the product on which this - * PTF can be installed. If the minimum and maximum levels are the - * same, this PTF can only be installed on one level of the product. - * The level can be "AA" through "99", or blank if the product has - * no level. - * @return The release level. - * @see #getMaximumLevel - **/ - public String getMinimumLevel() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_ && !partiallyLoaded_ && !partiallyLoadedGroup_) refresh(100); //@K1C - return minimumLevel_; - } - - - // /** - // * Retrieves the list of preconditions for this PTF. - // * @return The array of preconditions. - // **/ - //public PTFPrecondition[] getPreconditions() - //throws AS400Exception, - // AS400SecurityException, - // ErrorCompletingRequestException, - // InterruptedException, - // IOException, - // ObjectDoesNotExistException - //{ - // if (!loaded900_) refresh(900); - // return preconditions_; - //} - - - /** - * Returns the product feature to which this PTF applies. This - * value will be blank if the feature cannot be determined (as in - * the case of a dependent or requisite PTF). - * @return The product feature. - **/ - public String getProductFeature() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_ && !partiallyLoaded_) refresh(100); - return ptfProductLoad_; - } - - - /** - * Returns the product ID of this PTF. For example: "5722JC1" - * If this value was initially set to PRODUCT_ID_ONLY, it - * will be overwritten with the value returned from the system - * after the values have been refreshed. - * @return The product ID. - **/ - public String getProductID() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (returnedProductID_ == null) refresh(100); - return returnedProductID_; - } - - - /** - * Returns the product option to which this PTF applies. This value - * will be blank if the option cannot be determined (as in the case - * of a dependent or requisite PTF). - * @return The product option. - **/ - public String getProductOption() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_ && !partiallyLoaded_ && !partiallyLoadedGroup_) refresh(100); //@K1C - return ptfProductOption_; - } - - - /** - * Returns the relationship between this PTF and another PTF. - * @param ptf The PTF to compare. - * @return The relationship between the two PTFs. Possible values are: - *
        - *
      • {@link #RELATIONSHIP_PREREQ RELATIONSHIP_PREREQ} - If this PTF is a pre-requisite of the specified PTF. - *
      • {@link #RELATIONSHIP_COREQ RELATIONSHIP_COREQ} - If this PTF is a co-requisite of the specified PTF. - *
      • {@link #RELATIONSHIP_DEPEND RELATIONSHIP_DEPEND} - If the specified PTF is a pre-requisite of this PTF. - *
      • {@link #RELATIONSHIP_SAME RELATIONSHIP_SAME} - If this PTF is identical to the specified PTF. - *
      • {@link #RELATIONSHIP_NONE RELATIONSHIP_NONE} - If there is no known relationship. - *
      - **/ - public String getRelationship(PTF ptf) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - // *
    • {@link #RELATIONSHIP_DIST RELATIONSHIP_DIST} - If this PTF is a distribution requisite of the specified PTF. - String id = getID(); - String id2 = ptf.getID(); - if (id.equals(id2)) return RELATIONSHIP_SAME; - - refresh(300); - refresh(500); - ptf.refresh(300); - ptf.refresh(500); - PTF[] requisites = getRequisitePTFs(); - PTF[] dependents = getDependentPTFs(); - PTF[] req2 = ptf.getRequisitePTFs(); - PTF[] dep2 = ptf.getDependentPTFs(); - for (int i=0; iNOTE: This method is not supported when running to OS/400 V5R2 or earlier releases. - * @return The date and time that the PTF was created, or null if not determined or system is pre-V5R3. - **/ - public Date getCreationDate() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_) refresh(100); - - TimeZone tz = DateTimeConverter.timeZoneForSystem(system_); - Calendar dateTime = Calendar.getInstance(tz); - dateTime.clear(); - - // CYYMMDDHHMMSS format. - String dattim = creationDateAndTime_; // abbreviate - if (dattim == null || dattim.length() == 0) return null; - else - { - dateTime.set(Integer.parseInt(dattim.substring(0, 3)) + 1900, - Integer.parseInt(dattim.substring(3, 5)) - 1, - Integer.parseInt(dattim.substring(5, 7)), - Integer.parseInt(dattim.substring(7, 9)), - Integer.parseInt(dattim.substring(9, 11)), - Integer.parseInt(dattim.substring(11, 13))); - - return dateTime.getTime(); - } - } - - /** - Indicates whether a server IPL must be performed in order to activate - the changes for the PTF. -

      NOTE: This method is not supported when running to OS/400 V5R2 or earlier releases. - @return Whether a server IPL must be performed. - The possible values are: -

        -
      • 0 No server IPL is required to activate the changes for the PTF. -
      • 1 A server IPL must be performed using the T server IPL source in order to activate the changes for the PTF. -
      • 2 A server IPL must be performed using the P server IPL source in order to activate the changes for the PTF. -
      • -1 The value of the "IPL required" property cannot be determined, or system is pre-V5R3. -
      - **/ - public int getServerIPLRequired() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - return serverIPLRequired_; - } - - /** - * This method is used internally by getCoverLetters(). - * getCoverLetters() just returns an array of size 0 - * if hasCoverLetter() is false. - **/ - boolean hasCoverLetter() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_ && !partiallyLoaded_ && !partiallyLoadedGroup_) refresh(100); //@K1C - return hasCoverLetter_; - } - - - /** - * This method is used internally by getSaveFile(). - * getSaveFile() just returns null if hasSaveFile() is false. - **/ - boolean hasSaveFile() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_ && !partiallyLoaded_ && !partiallyLoadedGroup_) refresh(100); //@K1C - return saveFileExists_; - } - - - /** - * Indicates if a required action has yet to be performed to make - * this PTF active. If true, check the activation instructions in - * the cover letter to determine what the action is. - * @return true if a required action needs to occur for this PTF - * to be active; false if no required actions are pending for this - * PTF. - * @see #getActionRequired - * @see #getCoverLetters - **/ - public boolean isActionPending() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_ && !partiallyLoaded_ && !partiallyLoadedGroup_) refresh(100); //@K1C - return actionPending_; - } - - - /** - * Indicates if this PTF has a conditional relationship - * with any of its dependents or requisites. This determines whether - * it is necessary to check the system for the presence of software - * that is described by this product ID, release level, option, - * and feature. - * @return true if the requisite PTF is required by this PTF only on - * systems that contain the software described in the other fields; - * false if the requisite PTF is required by this PTF on all systems - * that can use this PTF. - **/ - public boolean isConditional() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loadedRequisites_ && !loaded300_) refresh(300); - return isConditional_; - } - - - /** - * Indicates if this PTF has a co-requisite relationship with another PTF. - *

      - * If this PTF object was returned by a call to {@link #getRequisitePTFs getRequisitePTFs()} or - * {@link #getDependentPTFs getDependentPTFs()}, - * then this method indicates if this PTF has a co-requisite relationship with the - * PTF of which it is a requisite or dependent. - *

      - * If this PTF object was constructed otherwise, then this method indicates if this - * PTF has a known co-requisite relationship with at least one other PTF on the system. This - * is accomplished by checking the list of known dependent and requisite PTFs for this PTF. - * - * @return true if this PTF is a co-requisite, false otherwise. - * @see #getDependentPTFs - * @see #getRequisitePTFs - * @see #isDependent - * @see #isPreRequisite - **/ - public boolean isCoRequisite() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loadedRequisites_ && !loadedDependents_ && !loaded300_) - { - refresh(300); - refresh(500); - } - return isCoRequisite_; - } - - - /** - * Indicates if this PTF has a dependent relationship with another PTF. - *

      - * If this PTF object was returned by a call to {@link #getDependentPTFs getDependentPTFs()}, - * then this method indicates if the PTF that generated this PTF object is a - * pre-requisite of this PTF object. - *

      - * If this PTF object was constructed otherwise, then this method indicates if this - * PTF is a known dependent of at least one other PTF on the system. - * - * @return true if this PTF is dependent on another PTF (that is, another PTF is - * a pre-requisite of this PTF), false otherwise. - * @see #getDependentPTFs - * @see #getRequisitePTFs - * @see #isCoRequisite - * @see #isPreRequisite - **/ - public boolean isDependent() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loadedDependents_ && !loaded300_) refresh(300); - return isDependent_; - } - - - /** - * Indicates if this PTF has been ordered. - * @return true if the PTF has been ordered; false if it has not been ordered - * or has already been received. - **/ - public boolean isOnOrder() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_ && !partiallyLoaded_ && !partiallyLoadedGroup_) refresh(100); //@K1C - return ptfOnOrder_; - } - - - /** - * Indicates if this PTF has a pre-requisite relationship with another PTF. - *

      - * If this PTF object was returned by a call to {@link #getRequisitePTFs getRequisitePTFs()}, - * then this method indicates if this PTF is a pre-requisite for the PTF object - * that generated this PTF. - *

      - * If this PTF object was constructed otherwise, then this method indicates if this - * PTF is a known pre-requisite of at least one other PTF on the system. - * - * @return true if this PTF is a pre-requisite of another PTF, false otherwise. - * @see #getDependentPTFs - * @see #getRequisitePTFs - * @see #isCoRequisite - * @see #isDependent - **/ - public boolean isPreRequisite() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loadedRequisites_ && !loaded500_) refresh(500); - return isPreRequisite_; - } - - - /** - * Indicates if the PTF save file is available for distribution to other systems. - * This is true only when the System Manager licensed product is on the system and - * the product is supported. The save file status should also be checked. - * @return true if the PTF save file is released and can be distributed; false if - * the save file cannot be distributed. - * @see #getSaveFile - **/ - public boolean isReleased() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_ && !partiallyLoaded_) refresh(100); - return isPTFReleased_; - } - - - /** - * Indicates if this PTF is required on the system because it is a pre-requisite - * for another PTF. - * @return true if this PTF is required on the system, false if it is not required. - **/ - public boolean isRequired() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loadedRequisites_ && !loaded300_) refresh(300); - return isRequired_; - } - - - /** - * Refreshes all the values for this PTF by retrieving them from the system. - **/ - public void refresh() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - refresh(200); - refresh(300); - refresh(500); - refresh(600); - refresh(700); - refresh(800); - } - - - private static int baseSize_ = 115; // This was 108 for V5R1. - - /** - * This refresh method does all the work. - **/ - private void refresh(int whichFormat) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - String format = null; - int len = 0; - switch(whichFormat) - { - case 100: - format = "PTFR0100"; - len = 200; // Updated length to prevent recursive loop. Was 112. (Old comment: Why isn't this 108? Hmm.) - break; - case 200: - format = "PTFR0200"; - len = baseSize_+12+chunkSize_; // 108+12+(36*numberOfCoverLetters) - break; - case 300: - format = "PTFR0300"; - len = baseSize_+12+chunkSize_; // 108+12+(35*numberOfRequisites) - break; - case 500: - format = "PTFR0500"; - len = baseSize_+12+chunkSize_; // 108+12+(33*numberOfDependents) - break; - case 600: - format = "PTFR0600"; - len = baseSize_+12+chunkSize_; // 108+12+(7*numberOfAPARs) - break; - case 700: - format = "PTFR0700"; - len = baseSize_+12+chunkSize_; // 108+12+(symptomStringData) - break; - case 800: - format = "PTFR0800"; - len = baseSize_+12+chunkSize_; // 108+12+(29*numberOfExitPrograms) - break; -// case 900: -// format = "PTFR0900"; -// len = baseSize_+12+chunkSize_; // 108+12+(30*numberOfPreconditions) - default: - format = "PTFR0100"; - len = baseSize_+chunkSize_; - break; - } - int ccsid = system_.getCcsid(); - ConvTable conv = ConvTable.getTable(ccsid, null); - - ProgramParameter[] parms = new ProgramParameter[5]; - parms[0] = new ProgramParameter(len); // receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(len)); // length of receiver variable - byte[] ptfInfo = new byte[50]; - AS400Text text7 = new AS400Text(7, ccsid, system_); - AS400Text text6 = new AS400Text(6, ccsid, system_); - AS400Text text25 = new AS400Text(25, ccsid, system_); - text7.toBytes(ptfID_, ptfInfo, 0); - text7.toBytes(productID_, ptfInfo, 7); - text6.toBytes(ptfReleaseLevel_, ptfInfo, 14); - ptfInfo[24] = (byte)0xF0; // '0' means close the PTF database when query is done, '1' means leave it open. - text25.toBytes(" ", ptfInfo, 25); - parms[2] = new ProgramParameter(ptfInfo); // PTF information - parms[3] = new ProgramParameter(conv.stringToByteArray(format)); // format name - parms[4] = new ProgramParameter(BinaryConverter.intToByteArray(0)); // error code - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QPZRTVFX.PGM", parms); - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - - byte[] output = parms[0].getOutputData(); - int bytesReturned = BinaryConverter.byteArrayToInt(output, 0); - int bytesAvailable = BinaryConverter.byteArrayToInt(output, 4); - if (bytesReturned < bytesAvailable) - { - chunkSize_ = bytesAvailable; - refresh(whichFormat); - return; - } - returnedProductID_ = conv.byteArrayToString(output, 12, 7); - returnedReleaseLevel_ = conv.byteArrayToString(output, 26, 6); - ptfProductOption_ = conv.byteArrayToString(output, 32, 4); - ptfProductLoad_ = conv.byteArrayToString(output, 36, 4); - loadedStatus_ = conv.byteArrayToString(output, 40, 1); - hasCoverLetter_ = (output[41] == (byte)0xF1); - ptfOnOrder_ = (output[42] == (byte)0xF1); - saveFileExists_ = (output[43] == (byte)0xF1); - if (saveFileExists_) - { - String fileName = conv.byteArrayToString(output, 44, 10).trim(); - String fileLibrary = conv.byteArrayToString(output, 54, 10).trim(); - saveFile_ = QSYSObjectPathName.toPath(fileLibrary, fileName, "SAVF"); - } - else - { - saveFile_ = ""; - } - iplRequired_ = conv.byteArrayToString(output, 64, 1); // also known as PTF type - iplAction_ = (int)(output[65] & 0x000F); // EBCDIC 0xF0 = '0', 0xF1 = '1', etc. - actionPending_ = (output[66] == (byte)0xF1); - actionRequired_ = conv.byteArrayToString(output, 67, 1); - isPTFReleased_ = (output[68] == (byte)0xF1); - targetRelease_ = conv.byteArrayToString(output, 69, 6); - supersedingPTF_ = conv.byteArrayToString(output, 75, 7).trim(); - currentIPLSource_ = conv.byteArrayToString(output, 82, 1); - minimumLevel_ = conv.byteArrayToString(output, 83, 2); - maximumLevel_ = conv.byteArrayToString(output, 85, 2); - // formatInformationAvailable_; - String d = conv.byteArrayToString(output, 88, 13); - // Parse the date - if (d.trim().length() == 13) - { - Calendar cal = Calendar.getInstance(); - cal.clear(); - cal.set(Integer.parseInt(d.substring(0,3)) + 1900, // year - Integer.parseInt(d.substring(3,5))-1, // month is zero based - Integer.parseInt(d.substring(5,7)), // day - Integer.parseInt(d.substring(7,9)), // hour - Integer.parseInt(d.substring(9,11)), // minute - Integer.parseInt(d.substring(11,13))); // second - statusDate_ = cal.getTime(); - } - else - { - statusDate_ = null; - } - licGroup_ = conv.byteArrayToString(output, 101, 7).trim(); - if (output.length >= 115) - { - // V5R2 and higher - //supersededByPTFID_ = conv.byteArrayToString(output, 108, 7).trim(); - - if (output.length >= 130) - { - // V5R3 and higher - //currentServerIPLSource_ = conv.byteArrayToString(output, 115, 1).trim(); - serverIPLRequired_ = (int)(output[116] & 0x000F); // EBCDIC 0xF0 = '0', 0xF1 = '1', etc. - creationDateAndTime_ = conv.byteArrayToString(output, 117, 13).trim(); - } - } - loaded_ = true; - - if (whichFormat == 200) - { - int offset = BinaryConverter.byteArrayToInt(output, 8); - int entryOffset = BinaryConverter.byteArrayToInt(output, offset); - offset += 4; - int numberOfNLVs = BinaryConverter.byteArrayToInt(output, offset); - offset += 4; - int entryLength = BinaryConverter.byteArrayToInt(output, offset); - coverLetters_ = new PTFCoverLetter[numberOfNLVs]; - for (int i=0; i - *

    • {@link #SPECIAL_INSTRUCTIONS_NO SPECIAL_INSTRUCTIONS_NO} - *
    • {@link #SPECIAL_INSTRUCTIONS_YES SPECIAL_INSTRUCTIONS_YES} - *
    • {@link #SPECIAL_INSTRUCTIONS_UNKNOWN SPECIAL_INSTRUCTIONS_UNKNOWN} - *
    - * @return The type of post-apply or post-remove special instructions. - **/ - public int getPostSpecialInstructions() - { - return postInstructions_; - } - - - /** - * Returns whether the cover letter contains special instructions that should - * be followed prior to applying or removing the PTF. - * Possible values are: - *
      - *
    • {@link #SPECIAL_INSTRUCTIONS_NO SPECIAL_INSTRUCTIONS_NO} - *
    • {@link #SPECIAL_INSTRUCTIONS_YES SPECIAL_INSTRUCTIONS_YES} - *
    • {@link #SPECIAL_INSTRUCTIONS_IMMEDIATE SPECIAL_INSTRUCTIONS_IMMEDIATE} - *
    • {@link #SPECIAL_INSTRUCTIONS_IPL SPECIAL_INSTRUCTIONS_IPL} - *
    • {@link #SPECIAL_INSTRUCTIONS_UNKNOWN SPECIAL_INSTRUCTIONS_UNKNOWN} - *
    - * @return The type of pre-apply or pre-remove special instructions. - **/ - public int getPreSpecialInstructions() - { - return preInstructions_; - } - - - /** - * Returns the system. - * @return The system. - **/ - public AS400 getSystem() - { - return system_; - } - - - /** - * Returns a String representation of this cover letter. This is just the path to the cover letter. - * @return The String object. - **/ - public String toString() - { - return path_; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/PTFExitProgram.java b/cvsroot/src/com/ibm/as400/access/PTFExitProgram.java deleted file mode 100644 index fe9088d94..000000000 --- a/cvsroot/src/com/ibm/as400/access/PTFExitProgram.java +++ /dev/null @@ -1,125 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PTFExitProgram.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - * Represents an exit program for a Program Temporary Fix (PTF). - * Use {@link com.ibm.as400.access.PTF#getExitPrograms PTF.getExitPrograms()} - * to generate a PTFExitProgram object. -**/ -public class PTFExitProgram -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - private String path_; - private String runOption_; - private String userData_; - - /** - * Constant indicating that the exit program is called to determine if there - * is action necessary to make the PTF active or inactive. - **/ - public static final String STAGE_ACTION = "*ACTION"; - - /** - * Constant indicating that the exit program will be run at the end of apply - * and remove processing. - **/ - public static final String STAGE_BOTH = "*BOTH"; - - /** - * Constant indicating that the exit program will be run at the end of apply - * processing. - **/ - public static final String STAGE_APPLY = "*APPLY"; - - /** - * Constant indicating that the exit program will be run at the end of remove - * processing. - **/ - public static final String STAGE_REMOVE = "*REMOVE"; - - /** - * Constant indicating that the exit program will be run before the PTF is applied - * and at the end of apply processing. - **/ - public static final String STAGE_PRE_APPLY = "*PREAPY"; - - /** - * Constant indicating that the exit program will be run before the PTF is removed - * and at the end of remove processing. - **/ - public static final String STAGE_PRE_REMOVE = "*PRERMV"; - - /** - * Constant indicating that the exit program will be run before the PTF is removed - * and at the end of remove processing. It is also run before the PTF is applied and - * at the end of apply processing. - **/ - public static final String STAGE_PRE_BOTH = "*PREBTH"; - - - - /** - * Exit programs are only constructed by PTF.getExitPrograms(). - **/ - PTFExitProgram(String path, String runOption, String userData) - { - path_ = path; - runOption_ = runOption; - userData_ = userData; - } - - - /** - * Returns the full pathname of the exit program. - * @return The path. - **/ - public String getPath() - { - return path_; - } - - - /** - * Returns the stage of the PTF process in which the exit program - * will be run. Possible values are: - *
      - *
    • {@link #STAGE_ACTION STAGE_ACTION} - *
    • {@link #STAGE_BOTH STAGE_BOTH} - *
    • {@link #STAGE_APPLY STAGE_APPLY} - *
    • {@link #STAGE_REMOVE STAGE_REMOVE} - *
    • {@link #STAGE_PRE_APPLY STAGE_PRE_APPLY} - *
    • {@link #STAGE_PRE_REMOVE STAGE_PRE_REMOVE} - *
    • {@link #STAGE_PRE_BOTH STAGE_PRE_BOTH} - *
    - * @return The run stage. - **/ - public String getRunStage() - { - return runOption_; - } - - - /** - * Returns any user data associated with this exit program. - * @return The user data. - **/ - public String getUserData() - { - return userData_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/PTFGroup.java b/cvsroot/src/com/ibm/as400/access/PTFGroup.java deleted file mode 100644 index 00ce120fb..000000000 --- a/cvsroot/src/com/ibm/as400/access/PTFGroup.java +++ /dev/null @@ -1,468 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PTFGroup.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.util.Calendar; -import java.util.Date; - - -/** -* Lists information for a specific PTF group on a system. -* Specifically you can retrieve a list of the related PTF groups, and a list of PTFs. -**/ -public class PTFGroup -{ - // Also use this to synchronize access to the user space - static final String USERSPACE_NAME = "JT4PTF QTEMP "; - - static final String USERSPACE_PATH = "/QSYS.LIB/QTEMP.LIB/JT4PTF.USRSPC"; - - private AS400 system_; - private String PTFGroupName_; - private boolean includeRelatedPTFGroups_ = false; - - // GRPR0500 format - private String relatedPTFGroupName_; - private String PTFgroupDescription_; - private int PTFGroupLevel_; - private int PTFGroupStatus_; - - - /** - * Constant indicating the PTF group status is unknown. The PTF group status cannot be resolved because a related PTF group - * is either not found on the system or is in error. - **/ - public static final int PTF_GROUP_STATUS_UNKNOWN = 0; - - /** - * Constant indicating the PTF group status is "not applicable". All PTFs in the PTF group and related PTF groups are for products - * that are not installed or supported on this system. - **/ - public static final int PTF_GROUP_STATUS_NOT_APPLICABLE = 1; - - /** - * Constant indicating the PTF group status is "supported only". There are no PTFs in the PTF group or related PTF groups that are for installed - * products on this system. There is at least one PTF that is for a product, release, option, and load - * identifier that is supported on this system. - **/ - public static final int PTF_GROUP_STATUS_SUPPORTED_ONLY = 2; - - /** - * Constant indicating the PTF group is not installed. There is at least one PTF that is for an installed product on this system, and not - * all the PTFs or their superseding PTFs are temporarily or permanently applied. - **/ - public static final int PTF_GROUP_STATUS_NOT_INSTALLED = 3; - - /** - * Constant indicating the PTF group is installed. All PTFs for products that are installed on this system are temporarily or - * permanently applied. If a PTF is superseded, a superseding PTF is either temporarily or - * permanently applied. - **/ - public static final int PTF_GROUP_STATUS_INSTALLED = 4; - - /** - * Constant indicating the PTF group information is in error. Either delete the PTF group or replace - * the PTF group information that is currently on the system. - **/ - public static final int PTF_GROUP_STATUS_ERROR = 5; - - /** - * Constant indicating the PTF group is not found on the system. This status will only be returned - * when using format GRPR0500. - **/ - public static final int PTF_GROUP_STATUS_NOT_FOUND = 6; - - /** - * Constant indicating the PTF group will be applied at next IPL. All PTFs for the installed products on the system are either set to be applied at the next IPL or are already temporarily or permanently applied. - **/ - public static final int PTF_GROUP_STATUS_APPLY_AT_NEXT_IPL = 7; // added in V6R1 - - /** - * Constant indicating the PTF group is a related group. The PTF group does not have any PTFs for products installed or supported on the system. However, it is identified in another PTF group as a related PTF group. Deleting a PTF group in this status will cause the other PTF group to have a status of {@link #PTF_GROUP_STATUS_UNKNOWN PTF_GROUP_STATUS_UNKNOWN}. - **/ - public static final int PTF_GROUP_STATUS_RELATED_GROUP = 8; // added in V6R1 - - /** - * Constant indicating the PTF group is on order. There is at least one PTF in the group that is on order and has not yet been installed on the system. It will be delivered on either physical or virtual media. - **/ - public static final int PTF_GROUP_STATUS_ON_ORDER = 9; // added in V6R1 - - /** - * Constructs a PTFGroup object. - * @param system The AS400 system. - * @param ptfGroupName The name of the PTF group you wish to get details about. - **/ - PTFGroup(AS400 system, String ptfGroupName) - { - if (system == null) throw new NullPointerException("system"); - if (ptfGroupName == null) throw new NullPointerException("ptfGroupName"); - system_ = system; - PTFGroupName_ = ptfGroupName.trim(); - } - - /** - * This constructor is used by ListPTFGroups. - **/ - PTFGroup(AS400 system, String ptfGroupName, String ptfDescription, int ptfLevel, int ptfStatus) - { - this(system, ptfGroupName); - PTFGroupLevel_ = ptfLevel; - PTFgroupDescription_ = ptfDescription; - PTFGroupStatus_ = ptfStatus; - } - - /** - * Returns the system. - * @return The system. - **/ - public AS400 getSystem() - { - return system_; - } - - /** - * Returns a list of related PTF groups. - **/ - public PTFGroup[] getRelatedPTFGroups() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - - try - { - int len = 164; - int ccsid = system_.getCcsid(); - ConvTable conv = ConvTable.getTable(ccsid, null); - - ProgramParameter[] parms = new ProgramParameter[5]; - parms[0] = new ProgramParameter(conv.stringToByteArray(USERSPACE_NAME)); //qualified user space name - parms[0].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - byte[] groupInfo = new byte[69]; - AS400Text text60 = new AS400Text(60, ccsid, system_); - BinaryConverter.intToByteArray(69, groupInfo, 0); - text60.toBytes(PTFGroupName_, groupInfo, 4); - BinaryConverter.intToByteArray(ccsid, groupInfo, 64); - groupInfo[68] = includeRelatedPTFGroups_ ? (byte)0xF1 : (byte)0xF0; // '1' or '0' - parms[1] = new ProgramParameter(groupInfo); // PTF Group Information - parms[1].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - parms[2] = new ProgramParameter(conv.stringToByteArray("GRPR0500")); //FORMAT - parms[2].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - parms[3] = new ProgramParameter(BinaryConverter.intToByteArray(ccsid)); //CCSID - parms[3].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - parms[4] = new ProgramParameter(new byte[4]); // error code - parms[4].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - ServiceProgramCall pc = new ServiceProgramCall(system_, "/QSYS.LIB/QPZGROUP.SRVPGM", "QpzListPtfGroupDetails", ServiceProgramCall.NO_RETURN_VALUE, parms); - // Note: The called API is not thread-safe. - - // Determine the needed scope of synchronization. - Object lockObject; - boolean willRunProgramsOnThread = pc.isStayOnThread(); - if (willRunProgramsOnThread) { - // The calls will run in the job of the JVM, so lock for entire JVM. - lockObject = USERSPACE_PATH; - } - else { - // The calls will run in the job of the Remote Command Host Server, so lock on the connection. - lockObject = system_; - } - - byte[] buf = null; - - synchronized(lockObject) - { - UserSpace us = new UserSpace(system_, USERSPACE_PATH); - us.setMustUseProgramCall(true); - if (!willRunProgramsOnThread) - { - us.setMustUseSockets(true); - // Force the use of sockets when running natively but not on-thread. - // We have to do it this way since UserSpace will otherwise make a native ProgramCall, and will use a different QTEMP library than that used by the host server. - } - try - { - us.create(256*1024, true, "", (byte)0, "User space for PTF Group", "*EXCLUDE"); - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - int size = us.getLength(); - buf = new byte[size]; - us.read(buf, 0); - } - finally - { - // Delete the temporary user space, to allow other threads to re-create and use it. - try { us.delete(); } - catch (Exception e) { - Trace.log(Trace.ERROR, "Exception while deleting temporary user space", e); - } - } - } - int startingOffset = BinaryConverter.byteArrayToInt(buf, 124); - int numEntries = BinaryConverter.byteArrayToInt(buf, 132); - int entrySize = BinaryConverter.byteArrayToInt(buf, 136); - int entryCCSID = BinaryConverter.byteArrayToInt(buf, 140); - conv = ConvTable.getTable(entryCCSID, null); - PTFGroup[] ptfs = new PTFGroup[numEntries]; - int offset = 0; - for (int i=0; i - *
  • {@link #PTF_GROUP_STATUS_UNKNOWN PTF_GROUP_STATUS_UNKNOWN} - *
  • {@link #PTF_GROUP_STATUS_NOT_APPLICABLE PTF_GROUP_STATUS_NOT_APPLICABLE} - *
  • {@link #PTF_GROUP_STATUS_SUPPORTED_ONLY PTF_GROUP_STATUS_SUPPORTED_ONLY} - *
  • {@link #PTF_GROUP_STATUS_NOT_INSTALLED PTF_GROUP_STATUS_NOT_INSTALLED} - *
  • {@link #PTF_GROUP_STATUS_INSTALLED PTF_GROUP_STATUS_INSTALLED} - *
  • {@link #PTF_GROUP_STATUS_ERROR PTF_GROUP_STATUS_ERROR} - *
  • {@link #PTF_GROUP_STATUS_NOT_FOUND PTF_GROUP_STATUS_NOT_FOUND} - *
  • {@link #PTF_GROUP_STATUS_APPLY_AT_NEXT_IPL PTF_GROUP_STATUS_APPLY_AT_NEXT_IPL} - *
  • {@link #PTF_GROUP_STATUS_RELATED_GROUP PTF_GROUP_STATUS_RELATED_GROUP} - *
  • {@link #PTF_GROUP_STATUS_ON_ORDER PTF_GROUP_STATUS_ON_ORDER} - * - **/ - public int getPTFGroupStatus() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - return PTFGroupStatus_; - } - - /** - * Specifies whether information from all related PTF groups should be included when the list of - * PTFs or related PTF groups are returned. By default the information is not included. - * @param value true if information from all related PTF groups should be included, false otherwise. - **/ - public void includeRelatedPTFGroups(boolean value) - { - includeRelatedPTFGroups_ = value; - } - - /** - * Indicates if information from all related PTF groups are included when the list of - * PTFs or related PTF groups are returned. - * @return true if information from all related PTF groups is included, false otherwise. - **/ - public boolean areRelatedPTFGroupsIncluded() - { - return includeRelatedPTFGroups_; - } - - - public PTF[] getPTFs() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - try - { - int len = 73; - int ccsid = system_.getCcsid(); - ConvTable conv = ConvTable.getTable(ccsid, null); - - ProgramParameter[] parms = new ProgramParameter[5]; - parms[0] = new ProgramParameter(conv.stringToByteArray(USERSPACE_NAME)); //qualified user space name - parms[0].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - byte[] groupInfo = new byte[69]; - AS400Text text60 = new AS400Text(60, ccsid, system_); - BinaryConverter.intToByteArray(69, groupInfo, 0); - text60.toBytes(PTFGroupName_, groupInfo, 4); - BinaryConverter.intToByteArray(ccsid, groupInfo, 64); - groupInfo[68] = includeRelatedPTFGroups_ ? (byte)0xF1 : (byte)0xF0; // '1' or '0' - parms[1] = new ProgramParameter(groupInfo); // PTF group information - parms[1].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - parms[2] = new ProgramParameter(conv.stringToByteArray("GRPR0300")); //FORMAT - parms[2].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - parms[3] = new ProgramParameter(BinaryConverter.intToByteArray(ccsid)); //CCSID - parms[3].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - parms[4] = new ProgramParameter(new byte[4]); // error code - parms[4].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - ServiceProgramCall pc = new ServiceProgramCall(system_, "/QSYS.LIB/QPZGROUP.SRVPGM", "QpzListPtfGroupDetails", ServiceProgramCall.NO_RETURN_VALUE, parms); - // Note: The called API is not thread-safe. - - // Determine the needed scope of synchronization. - Object lockObject; - boolean willRunProgramsOnThread = pc.isStayOnThread(); - if (willRunProgramsOnThread) { - // The calls will run in the job of the JVM, so lock for entire JVM. - lockObject = USERSPACE_PATH; - } - else { - // The calls will run in the job of the Remote Command Host Server, so lock on the connection. - lockObject = system_; - } - - byte[] buf = null; - - synchronized(lockObject) - { - UserSpace us = new UserSpace(system_, USERSPACE_PATH); - us.setMustUseProgramCall(true); - if (!willRunProgramsOnThread) - { - us.setMustUseSockets(true); - // Force the use of sockets when running natively but not on-thread. - // We have to do it this way since UserSpace will otherwise make a native ProgramCall, and will use a different QTEMP library than that used by the host server. - } - try - { - us.create(256*1024, true, "", (byte)0, "User space for PTF Group", "*EXCLUDE"); - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - int size = us.getLength(); - buf = new byte[size]; - us.read(buf, 0); - } - finally - { - // Delete the temporary user space, to allow other threads to re-create and use it. - try { us.delete(); } - catch (Exception e) { - Trace.log(Trace.ERROR, "Exception while deleting temporary user space", e); - } - } - } - int startingOffset = BinaryConverter.byteArrayToInt(buf, 124); - int numEntries = BinaryConverter.byteArrayToInt(buf, 132); - int entrySize = BinaryConverter.byteArrayToInt(buf, 136); - int entryCCSID = BinaryConverter.byteArrayToInt(buf, 140); - conv = ConvTable.getTable(entryCCSID, null); - PTF[] ptfs = new PTF[numEntries]; - int offset = 0; - for (int i=0; i - *
  • The user to describe a packed decimal field to the RecordFormat object. - *
  • The RecordFormat object to describe a packed decimal field to the user. - * - *Click hereto see an example. -**/ -public class PackedDecimalFieldDescription extends FieldDescription implements Serializable -{ - static final long serialVersionUID = 4L; - - - // Number of digits to the right of the decimal point - private int decimalPositions_; - /** - *Constructs a PackedDecimalFieldDescription object. It uses the specified - *data type and name of the field. - *The number of digits and the number of decimal positions will be determined from - *dataType. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - * - **/ - public PackedDecimalFieldDescription(AS400PackedDecimal dataType, String name) - { - super(dataType, name); - length_ = dataType.getNumberOfDigits(); - decimalPositions_ = dataType.getNumberOfDecimalPositions(); - } - - /** - *Constructs a PackedDecimalFieldDescription object. - **/ - public PackedDecimalFieldDescription() - { - } - - /** - *Constructs a PackedDecimalFieldDescription object. It uses the specified - *data type, name, and DDS name of the field. - *The number of digits and the number of decimal positions will be determined from dataType. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - **/ - public PackedDecimalFieldDescription(AS400PackedDecimal dataType, String name, String ddsName) - { - super(dataType, name, ddsName); - length_ = dataType.getNumberOfDigits(); - decimalPositions_ = dataType.getNumberOfDecimalPositions(); - } - - - - /** - *Returns the DDS description for the field. This is a string containing - *the description of the field as it would be specified in a DDS source file. - *This method is used by AS400File.createDDSSourceFile to specify the field - *in the DDS source file which is used to create the file for the user who - *has passed in a RecordFormat object. - *@return The DDS description of this field properly formatted for entry - *into a DDS source file. - **/ - String[] getDDSDescription() - { - Vector v = new Vector(); - // Name columns (10) - StringBuffer desc = new StringBuffer(ddsName_); - // Blank pad the ddsName to 10 characters. - while(desc.length() < 10) - { - desc.append(" "); - } - // Reference column (1) - if (!refFld_.equals("")) - { - desc.append("R"); - } - else - { - desc.append(" "); - } - // Get length as 5 digit string, right justified -/* StringBuffer len = new StringBuffer(new Integer(length_).toString()); - if (len.length() < 5) - { - int blanksNeeded = 5 - len.length(); - for (short i = 0; i < blanksNeeded; ++i) - { - len.insert(0, " "); - } - } -*/ - String len = String.valueOf(length_); - int numSpaces = 5-len.length(); - for (int i=0; idataType - *cannot be null. - **/ - public void setDataType(AS400PackedDecimal dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - length_ = dataType.getNumberOfDigits(); - decimalPositions_ = dataType.getNumberOfDecimalPositions(); - } - - //@B0C - javadoc - /** - *Sets the value for the DFT keyword for this field. - *@param defaultValue The default value for this - * field. The defaultValue cannot be null. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(BigDecimal defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; //@B0A - isDFTCurrent_ = false; //@B0A - DFTCurrentValue_ = null; //@B0A - } - - //@B0A - /** - *Sets the value for the DFT keyword to be *NULL for this field. - *Calling this method will replace the DFT keyword that was previously - *set on a call to setDFT(). Note: This field - *must also have its ALWNULL keyword set to true to prevent DDS errors. - **/ - public void setDFTNull() - { - isDFTNull_ = true; - defaultValue_ = null; - isDFTCurrent_ = false; - DFTCurrentValue_ = null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/PanelGroup.java b/cvsroot/src/com/ibm/as400/access/PanelGroup.java deleted file mode 100644 index d35f5b2e8..000000000 --- a/cvsroot/src/com/ibm/as400/access/PanelGroup.java +++ /dev/null @@ -1,433 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PanelGroup.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; - -/** - * Represents an IBM i panel group (*PNLGRP) object. - * The help text for a given panel group and set of keywords can be retrieved - * using the {@link #getHelpText getHelpText} method. - *

    - * To generate HTML documentation from the panel groups of a given CL command, - * see the {@link com.ibm.as400.util.CommandHelpRetriever CommandHelpRetriever} utility. -**/ -public class PanelGroup implements Serializable -{ - /** - * This class uses the QUHRHLPT system API to retrieve the help text. - **/ - static final long serialVersionUID = 6L; - - private AS400 system_; - private String path_; - - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_ = new PropertyChangeSupport(this); - - - /** - * Constructs a PanelGroup object. - **/ - public PanelGroup() - { - initializeTransient(); - } - - /** - * Constructs a PanelGroup object. - * @param system The system on which the panel group resides. - * @param path The fully integrated file system path name of the panel group. - * @see com.ibm.as400.access.QSYSObjectPathName - **/ - public PanelGroup(AS400 system, String path) - { - if (system == null) - throw new NullPointerException("system"); - - if (path == null) - throw new NullPointerException("path"); - - QSYSObjectPathName.validatePath(path, "PNLGRP"); - - system_ = system; - path_ = path; - - initializeTransient(); - } - - /** - * Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method will be called each time the value of any bound property is changed. - * The PropertyChangeListener object is added to a list of PropertyChangeListeners managed by this PanelGroup. It can be removed with removePropertyChangeListener. - * - * @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - - - /** - * Returns the panel group help identifiers for the specified keywords. - * @param keywords An array of keywords for which to retrieve help. The panel group to which - * the keywords belong is assumed to be the path of this PanelGroup object. - * @return The help identifiers. - **/ - public synchronized PanelGroupHelpIdentifier[] getHelpIdentifiers(String[] keywords) throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException - - { - if (keywords == null) throw new NullPointerException("keywords"); - if (system_ == null) throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - if (path_ == null) throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "Retrieving help identifiers for "+keywords.length+" keywords: "); - for (int i=0; i - *

  • {@link #STATUS_NAME_NOT_CORRECT STATUS_NAME_NOT_CORRECT} - The system - * could not find the help identifier. - *
  • {@link #STATUS_FOUND STATUS_FOUND} - The system found the help identifier - * and retrieved its information. - *
  • {@link #STATUS_OBJECT_ACCESS_FAILURE} - The system could not retrieve - * the help identifier information for some reason. See the remote command host - * server job log for details. - *
  • {@link #STATUS_UNKNOWN STATUS_UNKNOWN} - The system returned a help - * identifier status that is not known. - * - * @return The status. - **/ - public int getStatus() - { - if (found_.equals("0")) return STATUS_NAME_NOT_CORRECT; - if (found_.equals("1")) return STATUS_FOUND; - if (found_.equals("2")) return STATUS_OBJECT_ACCESS_FAILURE; - return STATUS_UNKNOWN; - } - - /** - * Returns the name of the anchor within the help document - * for this help identifier. - * @return The anchor name. - **/ - public String getAnchor() - { - return anchor_; - } - - /** - * Returns a String representation of this help identifier. - * @return The string. - **/ - public String toString() - { - return super.toString()+"["+getStatus()+","+getName()+"]"; - } -} - - diff --git a/cvsroot/src/com/ibm/as400/access/PasswordDialog.java b/cvsroot/src/com/ibm/as400/access/PasswordDialog.java deleted file mode 100644 index f8bc4a493..000000000 --- a/cvsroot/src/com/ibm/as400/access/PasswordDialog.java +++ /dev/null @@ -1,288 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: PasswordDialog.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Button; -import java.awt.Checkbox; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dialog; -import java.awt.FlowLayout; -import java.awt.Frame; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import java.awt.Insets; -import java.awt.Label; -import java.awt.Panel; -import java.awt.TextField; - -/** - Provides a dialog for prompting end-users for a system name, a user ID, and/or a password. End-user programs will typically not need to use this class directly. Instead, such programs should allow the AS400 class to display the dialog when necessary. - @see SignonHandler - **/ -public class PasswordDialog extends Dialog -{ - static final long serialVersionUID = 4L; - // Implementation notes: - // * There is a concern that making this class public makes it too easy for external developers to display a Toolbox signon prompt and gather end-user passwords. The general consensus is that this would be easy enough for most Java developers to do, anyway (without this class)! - // * We are intentionally NOT exposing control over the checkboxes. No reason other than to minimize the public interface. - - // Private data. - private AS400SignonDialogAdapter listener_; - private TextField systemNameTextField_; - private TextField userIdTextField_; - private TextField passwordTextField_; - private Checkbox defaultUserCheckbox_; - private Checkbox cachePasswordCheckbox_; - private Button okButton_; - private Button cancelButton_; - - /** - Constructs a PasswordDialog object. - @param parent The parent frame. - @param titleText The title text. - **/ - public PasswordDialog(Frame parent, String titleText) - { - this(parent, titleText, false); - } - - PasswordDialog(Frame parent, String titleText, boolean showCheckbox) - { - super(parent, titleText, true); - - listener_ = new AS400SignonDialogAdapter(this); - - // Create a GridBagLayout manager. - GridBagLayout layout = new GridBagLayout(); - GridBagConstraints constraints = new GridBagConstraints(); - constraints.fill = GridBagConstraints.BOTH; - constraints.insets = new Insets(8, 8, 0, 8); - setLayout(layout); - - setResizable(false); - - // Set the background color to light gray. - setBackground(Color.lightGray); - - // Create the 'System:' Label and add to the panel. - Label label = new Label(ResourceBundleLoader.getCoreText("DLG_SYSTEM_LABEL"), Label.LEFT); - add(label, layout, constraints, 0, 0, 1, 1); - - // Create the system text field and add to the panel. - systemNameTextField_ = new TextField(10); - systemNameTextField_.addFocusListener(listener_); - systemNameTextField_.addKeyListener(listener_); - add(systemNameTextField_, layout, constraints, 1, 0, 1, 1); - - // Create the 'User ID:' Label and add to the panel. - label = new Label(ResourceBundleLoader.getCoreText("DLG_USER_ID_LABEL"), Label.LEFT); - add(label, layout, constraints, 0, 1, 1, 1); - - // Create the user id text field and add to the panel. - userIdTextField_ = new AS400SignonTextField(); - userIdTextField_.addFocusListener(listener_); - userIdTextField_.addKeyListener(listener_); - add(userIdTextField_, layout, constraints, 1, 1, 1, 1); - - // Create the 'Password:' Label and add to the panel. - label = new Label(ResourceBundleLoader.getCoreText("DLG_PASSWORD_LABEL"), Label.LEFT); - add(label, layout, constraints, 0, 2, 1, 1); - - // Create the password text field and add to the panel. - passwordTextField_ = new TextField(10); - passwordTextField_.setEchoChar('*'); - passwordTextField_.addFocusListener(listener_); - passwordTextField_.addKeyListener(listener_); - add(passwordTextField_, layout, constraints, 1, 2, 1, 1); - - // Create the default checkbox. - defaultUserCheckbox_ = new Checkbox(ResourceBundleLoader.getCoreText("DLG_DEFAULT_PASSWORD_CHECK_BOX")); - defaultUserCheckbox_.addFocusListener(listener_); - defaultUserCheckbox_.addKeyListener(listener_); - - cachePasswordCheckbox_ = new Checkbox(ResourceBundleLoader.getCoreText("DLG_CACHE_PASSWORD_CHECK_BOX")); - cachePasswordCheckbox_.addFocusListener(listener_); - cachePasswordCheckbox_.addKeyListener(listener_); - - if (showCheckbox) - { - // Create panels to hold the checkboxes. - Panel centeringPanel = new Panel(); - centeringPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); - add(centeringPanel, layout, constraints, 0, 3, 2, 2); - Panel checkboxPanel = new Panel(); - checkboxPanel.setLayout(new GridLayout(2, 1, 2, 2)); - centeringPanel.add(checkboxPanel); - - // Add the default checkbox. - checkboxPanel.add(defaultUserCheckbox_); - - // Add the cache password checkbox. - checkboxPanel.add(cachePasswordCheckbox_); - } - - // Create panels to hold the 'OK', and 'Cancel' buttons. - Panel centeringPanel = new Panel(); - centeringPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); - constraints.insets = new Insets(8, 8, 8, 8); - add(centeringPanel, layout, constraints, 0, 5, 2, 1); - Panel buttonPanel = new Panel(); - buttonPanel.setLayout(new GridLayout(1, 2, 8, 0)); - centeringPanel.add(buttonPanel); - - // Create the OK, cancel buttons. - okButton_ = new Button(ResourceBundleLoader.getCoreText("DLG_OK_BUTTON")); - okButton_.addActionListener(listener_); - okButton_.addFocusListener(listener_); - okButton_.addKeyListener(listener_); - buttonPanel.add(okButton_); - cancelButton_ = new Button(ResourceBundleLoader.getCoreText("DLG_CANCEL_BUTTON")); - cancelButton_.addActionListener(listener_); - cancelButton_.addFocusListener(listener_); - cancelButton_.addKeyListener(listener_); - buttonPanel.add(cancelButton_); - - // Arrange the components in the dialog. - pack(); - - // Add a listener for window events. - addWindowListener(listener_); - addFocusListener(listener_); - } - - private void add(Component component, GridBagLayout layout, GridBagConstraints constraints, int x, int y, int width, int height) - { - constraints.gridx = x; - constraints.gridy = y; - constraints.gridwidth = width; - constraints.gridheight = height; - layout.setConstraints(component, constraints); - add(component); - } - - void disableDefaultUserCheckbox() - { - defaultUserCheckbox_.setEnabled(false); - } - - void disablePasswordCacheCheckbox() - { - cachePasswordCheckbox_.setEnabled(false); - } - - void enableDefaultUserCheckbox() - { - defaultUserCheckbox_.setEnabled(true); - } - - void enablePasswordCacheCheckbox() - { - cachePasswordCheckbox_.setEnabled(true); - } - - void enableSystemNameField() - { - systemNameTextField_.setEnabled(true); - } - - boolean getDefaultState() - { - return defaultUserCheckbox_.getState(); - } - - /** - Returns the password. - @return The password. - **/ - String getPassword() - { - return passwordTextField_.getText(); - } - - boolean getPasswordCacheState() - { - return cachePasswordCheckbox_.getState(); - } - - /** - Returns the system name. - @return The system name. - **/ - public String getSystemName() - { - return systemNameTextField_.getText(); - } - - /** - Returns the user ID. - @return The user ID. - **/ - public String getUserId() - { - return userIdTextField_.getText(); - } - - void setDefaultUserState(boolean state) - { - defaultUserCheckbox_.setState(state); - } - - void setPasswordCacheState(boolean state) - { - cachePasswordCheckbox_.setState(state); - } - - /** - Sets the system name. - @param systemName The system name. - **/ - public void setSystemName(String systemName) - { - systemNameTextField_.setText(systemName); - systemNameTextField_.setEnabled(false); - } - - /** - Sets the user ID. - @param userId The user ID. - **/ - public void setUserId(String userId) - { - userIdTextField_.setText(userId); - } - - /** - Displays the password dialog. - @return true if the dialog was exited using the OK button, false otherwise. - **/ - boolean prompt() - { - passwordTextField_.setText(""); - - // Start the focus in the appropriate field. - if (getSystemName().length() == 0) - listener_.setFocalPoint(systemNameTextField_); - else if (getUserId().length() == 0) - listener_.setFocalPoint(userIdTextField_); - else - listener_.setFocalPoint(passwordTextField_); - - // Make the window visible. The call to show() will block the current thread until we hide or dispose of this dialog. - super.show(); - - return listener_.getFocalPoint() != cancelButton_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/PasswordVault.java b/cvsroot/src/com/ibm/as400/access/PasswordVault.java deleted file mode 100644 index 690bf075b..000000000 --- a/cvsroot/src/com/ibm/as400/access/PasswordVault.java +++ /dev/null @@ -1,100 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PasswordVault.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2009-2009 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import com.ibm.as400.access.AS400; -import java.io.Serializable; - -/** - * A vault which holds a password for a user profile on an IBM i system. The password - * can be used for authenticating to one or more IBM i host servers. - */ -class PasswordVault extends CredentialVault implements Cloneable, Serializable -{ - private static final boolean PASSWORD_TRACE = false; - - - /** - * Constructs a PasswordVault object that does not contain a credential. - */ - protected PasswordVault() { - super(); - } - - /** - * Constructs a PasswordVault object that contains the provided password - * credential. The password is stored internally as encoded raw bytes. - * - * @param thePassword The password - */ - protected PasswordVault(String thePassword) { - super(); - encodedCredential_ = store(thePassword); - } - - /** - * Constructs a PasswordVault object that contains the provided password - * credential. The password is stored internally as encoded raw bytes. - * - * @param rawBytes - */ - protected PasswordVault(byte[] rawBytes) { - super(); - encodedCredential_ = store(rawBytes); - } - - /** - * Returns a copy of this PasswordVault. The new copy will be - * an exact copy of this vault, which means the new copy will - * contain the same encoded password credential as this vault. - * - * @return A newly created PasswordVault that is a copy of this one - */ - public Object clone() { - PasswordVault vaultClone = (PasswordVault)super.clone(); - return vaultClone; - } - - /** - * {@inheritDoc} - */ - protected int getType() { - return AS400.AUTHENTICATION_SCHEME_PASSWORD; - } - - /** - * Encodes the String credential using the parent class encode method. - * The credential string is converted into an array of bytes - * and, using this representation, is encoded and stored internally. - * - * @param credential The credential to encode - * @return The encoded credential - */ - private byte[] store(String credential) - { - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "AS400 object store, password: '" + credential + "'"); - } - if (AS400.onAS400) { - if (credential.equalsIgnoreCase("*CURRENT") || - credential.equals("")) { - return null; - } - } - - return super.store(BinaryConverter.charArrayToByteArray(credential.toCharArray())); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/Permission.java b/cvsroot/src/com/ibm/as400/access/Permission.java deleted file mode 100644 index 2f2ab1292..000000000 --- a/cvsroot/src/com/ibm/as400/access/Permission.java +++ /dev/null @@ -1,1277 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Permission.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// -// @A1 - 10/04/2007 - Update commit() method to make two commit attempts for -// permission changes that are pending. This is necessary -// because some changes are order dependent. The commit() -// method allows for multiple changes to be pending at one -// time. The specific problem encountered was for a DLO -// object when going from Sensitivity/PublicAuth == None/*ALL -// to Sensitivity/PublicAuth == Private/*EXCLUDE. -// In this example, the PublicAuth must be changed before -// the Sensitivity. There are other examples where the -// Sensitivity would need to be changed first. A loop was -// added to the commit() method to accomodate either order. -// @A2 - 10/09/2007 - Update parseType() to process '/QSYS.LIB' correctly. Add -// check to account for missing ending delimiter. -// @A3 - 02/12/2008 - Updates to process QSYS IASP objects correctly. -// @A4 - 03/01/2008 - Additional iasp updates -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.util.Vector; -import java.util.Enumeration; - - -/** - * Retrieves a user's authority to an object.
    - * To improve performance, the Permission object caches authority changes - * until the commit() method is called. When commit()is called, - * all changes up to that point are sent to the system.
    - * The permission of an object is a collection of many users' authority to that object, - * and the UserPermission class is used to represent a user's authority to a object. - * Because there are three kinds of objects on the system, three subclasses of - * UserPermission are defined: - *
      - *
    • DLOPermission - Represents a user's authority to a Document Library Objects (DLO) - * stored in QDLS. - *
    • QSYSPermission - Represents a user's authority to the object which is contained in the system library - * structure and stored in QSYS.LIB. - *
    • RootPermission - Represents a user's authority to the object which is contained in the root directory - * structure. This includes everything that is not in QSYS.LIB or QDLS. - *
    - * Here is a simple example: - *

    - * AS400 as400 = new AS400();
    - * Permission permission = new Permission(as400,"/QSYS.LIB/QJAVA.LIB");
    - * permission.addAuthorizedUser("user1");
    - * QSYSPermission userPermission = (QSYSPermission)permission.getUserPermission("user1");
    - * userPermission.setObjectAuthority("*CHANGE");
    - * permission.commit();
    - * 

    - * @see UserPermission - * @see DLOPermission - * @see QSYSPermission - * @see RootPermission -**/ -public class Permission - implements Serializable -{ - static final long serialVersionUID = 4L; - - - /** - * Constant indicating the object is a Document Library Objects (DLO) - * stored in QDLS. - * - **/ - public static final int TYPE_DLO = 0; - - /** - * Constant indicating the object is contained in the system library - * structure and stored in QSYS.LIB. - * - **/ - public static final int TYPE_QSYS = 1; - - - /** - * Constant indicating that the object is contained in the root directory - * structure. This includes everything that is not in QSYS.LIB or QDLS. - * - **/ - public static final int TYPE_ROOT = 2; - - private AS400 as400_; - private String authorizationList_; - private String autListBackup_; - private boolean autListChanged_; - private String name_; - private String owner_; - private boolean ownerChanged_; // @B2a - private boolean revokeOldAuthority_; // @B2a - private boolean revokeOldGroupAuthority_; - private boolean followSymbolicLinks_ = true; - - // @B6 The name supplied by the application for QSYS objects on IASPs is - // "/aspName/QSYS.LIB/...". For QSYS objects the asp name will - // be stripped. path_ will start with /QSYS.LIB, asp_ will hold - // the asp name. Most pemission APIs dealing with QSYS objects - // need a traditional QSYS name so path_ will be used as before. - // One API and a couple commands, however, needs an IFS-style name. - // For them the name will be put back together. Note the extra - // processing is done only for QSYS objects. The extra - // processing is not needed for QDLS objects since they cannot be on - // ASPs. path_ will contain the entire path for root file system objects. - // - private String path_; - private String asp_ = null; // @B6a - - private String primaryGroup_; - private boolean primaryGroupChanged_; - private boolean sensitivityChanged_; - private int sensitivityLevel_; - private int type_; - - private transient Vector userPermissionsBuffer_; - private transient Vector userPermissions_; - private transient Object userPermissionsLock_ = new Object(); - - private transient PermissionAccess access_; - private transient PropertyChangeSupport changes_; - - - - /** - * Constructs a Permission object. - * @param file The IFSFile object. For example, The IFSFile object which represents the object "QSYS.LIB/FRED.LIB". - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the system object does not exist. - * - **/ - public Permission(IFSFile file) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - this(file.getSystem(),file.getPath(), false, true); // @B6c - } - - - - // @B6a new method - /** - * Constructs a Permission object. - *

    - * Use the independent auxiliary storage pool (IASP) parameter to indicate - * if the path name can contain an IASP name. - * If true, the name will be parsed as if the name starts with an IASP name. - * If false, the name is treated as an ordinary path. For example, suppose - * the path is "/myIASP/QSYS.LIB/MYLIB.LIB". If the IASP parameter is true - * the object is treated as library "MYLIB" on IASP "myIASP". If the IASP - * parameter is false the object is treated as object "MYLIB.LIB" in - * directory "/myIASP/QSYS.LIB" in the root file system. Note the IASP - * parameter is used only if the second component of the path is QSYS.LIB. - * If the second component of the path is not QSYS.LIB, the parameter is ignored. - * - * @param file The IFSFile object. For example, The IFSFile object which represents the object "QSYS.LIB/FRED.LIB". - * @param pathMayStartWithIASP True if the path may start with an - * independent auxiliary storage pool (IASP) name; false otherwise. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the system object does not exist. - * - **/ - public Permission(IFSFile file, boolean pathMayStartWithIASP) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - this(file.getSystem(),file.getPath(), pathMayStartWithIASP, true); - } - - - - /** - * Constructs a Permission object. - *

    - * Use the independent auxiliary storage pool (IASP) parameter to indicate - * if the path name can contain an IASP name. - * If true, the name will be parsed as if the name starts with an IASP name. - * If false, the name is treated as an ordinary path. For example, suppose - * the path is "/myIASP/QSYS.LIB/MYLIB.LIB". If the IASP parameter is true - * the object is treated as library "MYLIB" on IASP "myIASP". If the IASP - * parameter is false the object is treated as object "MYLIB.LIB" in - * directory "/myIASP/QSYS.LIB" in the root file system. Note the IASP - * parameter is used only if the second component of the path is QSYS.LIB. - * If the second component of the path is not QSYS.LIB, the parameter is ignored. - * - * @param file The IFSFile object. For example, The IFSFile object which represents the object "QSYS.LIB/FRED.LIB". - * @param pathMayStartWithIASP True if the path may start with an - * independent auxiliary storage pool (IASP) name; false otherwise. - * @param followLinks Whether symbolic links are resolved. - * The default value is true; that is, symbolic links are always resolved. - * By default, if the IBM i object is a symbolic link, then the requested action - * is performed on the object that is ultimately pointed to by the symbolic link, - * rather than on the symbolic link itself. - *
    Note: This parameter is effective only for IBM i release V5R4 and higher. - * For earlier releases, symbolic links are always resolved and this parameter is ignored. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the system object does not exist. - * - **/ - public Permission(IFSFile file, boolean pathMayStartWithIASP, boolean followLinks) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - this(file.getSystem(),file.getPath(), pathMayStartWithIASP, followLinks); - } - - - /** - * Constructs a Permission object. - * @param as400 The system. - * @param fileName The full path of the object. For example, "/QSYS.LIB/FRED.LIB". - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the system object does not exist. - * - **/ - public Permission(AS400 as400, String fileName) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - this(as400, fileName, false, true); // @B6c logic moved to next c'tor - } - - - /** - * Constructs a Permission object. - *

    - * Use the independent auxiliary storage pool (IASP) parameter to indicate - * if the path name can contain an IASP name. - * If true, the name will be parsed as if the name starts with an IASP name. - * If false, the name is treated as an ordinary path. For example, suppose - * the path is "/myIASP/QSYS.LIB/MYLIB.LIB". If the IASP parameter is true - * the object is treated as library "MYLIB" on IASP "myIASP". If the IASP - * parameter is false the object is treated as object "MYLIB.LIB" in - * directory "/myIASP/QSYS.LIB" in the root file system. Note the IASP - * parameter is used only if the second component of the path is QSYS.LIB. - * If the second component of the path is not QSYS.LIB, the parameter is ignored. - * - * - * @param as400 The system. - * @param fileName The full path of the object. For example, "/QSYS.LIB/FRED.LIB". - * @param pathMayStartWithIASP True if the path may start with an - * independent auxiliary storage pool (IASP) name; false otherwise. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the system object does not exist. - * - **/ - public Permission(AS400 as400, String fileName, boolean pathMayStartWithIASP) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - this(as400, fileName, pathMayStartWithIASP, true); - } - - - /** - * Constructs a Permission object. - *

    - * Use the independent auxiliary storage pool (IASP) parameter to indicate - * if the path name can contain an IASP name. - * If true, the name will be parsed as if the name starts with an IASP name. - * If false, the name is treated as an ordinary path. For example, suppose - * the path is "/myIASP/QSYS.LIB/MYLIB.LIB". If the IASP parameter is true - * the object is treated as library "MYLIB" on IASP "myIASP". If the IASP - * parameter is false the object is treated as object "MYLIB.LIB" in - * directory "/myIASP/QSYS.LIB" in the root file system. Note the IASP - * parameter is used only if the second component of the path is QSYS.LIB. - * If the second component of the path is not QSYS.LIB, the parameter is ignored. - * - * - * @param as400 The system. - * @param fileName The full path of the object. For example, "/QSYS.LIB/FRED.LIB". - * @param pathMayStartWithIASP True if the path may start with an - * independent auxiliary storage pool (IASP) name; false otherwise. - * @param followLinks Whether symbolic links are resolved. - * The default value is true; that is, symbolic links are always resolved. - * By default, if the IBM i object is a symbolic link, then the requested action - * is performed on the object that is ultimately pointed to by the symbolic link, - * rather than on the symbolic link itself. - *
    Note: This parameter is effective only for IBM i release V5R4 and higher. - * For earlier releases, symbolic links are always resolved and this parameter is ignored. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException If the system object does not exist. - * - **/ - public Permission(AS400 as400, String fileName, boolean pathMayStartWithIASP, boolean followLinks) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - if (as400 == null) throw new NullPointerException("system"); - if (fileName == null) throw new NullPointerException("fileName"); - - as400_ = as400; - int separator; - path_ = fileName; - separator = path_.lastIndexOf('/'); - name_ = path_.substring(separator+1); - type_ = parseType(path_, pathMayStartWithIASP); // @B6c - - // If 'followLinks' is false, check VRM, and if pre-V5R4 issue warning (and don't change flag). - if (!followLinks && (as400_.getVRM() < 0x050400)) - { - if (Trace.traceOn_) { - Trace.log(Trace.WARNING, "followLinks(false): Parameter is ignored because system is not V5R4 or higher."); - } - } - else followSymbolicLinks_ = followLinks; - - switch(type_) - { - case TYPE_QSYS : - access_ = new PermissionAccessQSYS(as400_); - break; - case TYPE_DLO : - access_ = new PermissionAccessDLO(as400_); - break; - case TYPE_ROOT : - default : - access_ = new PermissionAccessRoot(as400_); - break; - } - access_.setFollowSymbolicLinks(followSymbolicLinks_); - - Vector perms = null; - try - { - // @B6 If the QSYS object is on an ASP, prepend the ASP name - // to correctly fully qualify the path. - // @A3 The ASP is already part of the path. (e.g. /iasp123/QSYS.LIB/xyz.lib) - // String path = path_; // @B6a //@A3D - // if (asp_ != null) // @B6a //@A3D - // path = asp_ + path; // @B6a //@A3D - perms = access_.getAuthority(path_); // @B6c - changes_ = new PropertyChangeSupport(this); - - synchronized (userPermissionsLock_) - { - owner_ = (String)perms.elementAt(0); - primaryGroup_ = (String)perms.elementAt(1); - authorizationList_ = (String)perms.elementAt(2); - //autListChanged_ = false; // @B2d - sensitivityLevel_ = ((Integer)perms.elementAt(3)).intValue(); - //sensitivityChanged_ = false; // @B2d - - userPermissionsBuffer_ = new Vector (); - userPermissions_ = new Vector(); - int count = perms.size(); - for (int i=4;i=0;i--) - { - UserPermission userPermission = (UserPermission) - userPermissionsBuffer_.elementAt(i); - switch(userPermission.getCommitted()) - { - case UserPermission.COMMIT_FROM_AUTL : - access_.setFromAuthorizationList(path_,userPermission.isFromAuthorizationList()); - userPermission.setCommitted(UserPermission.COMMIT_NONE); - break; - case UserPermission.COMMIT_ADD : - access_.addUser(path_,userPermission); - userPermission.setCommitted(UserPermission.COMMIT_NONE); - break; - case UserPermission.COMMIT_CHANGE : - access_.setAuthority(path_,userPermission); - userPermission.setCommitted(UserPermission.COMMIT_NONE); - break; - case UserPermission.COMMIT_REMOVE : - // Removed code which prepended asp since the asp is already in the path_ @A4D - access_.removeUser(path_,userPermission.getUserID()); // @B6c //@A4C - userPermission.setCommitted(UserPermission.COMMIT_NONE); - userPermissionsBuffer_.removeElement(userPermission); - break; - case UserPermission.COMMIT_NONE : - default : - break; - } - } - } - } - catch (PropertyVetoException e) { // should never happen - Trace.log(Trace.ERROR, e); - } - } //end numberOfCommitAttempts loop @A1A - - changes_.firePropertyChange("permission",null,this); - } - - /** - * Returns the authorizations list of the object. - * @return The authorizations list of the object. - * @see #setAuthorizationList(String) - * - **/ - public String getAuthorizationList() - { - return authorizationList_; - } - - /** - * Returns an enumeration of authorized users. - * @return An enumeration of authorized users. - * - **/ - public Enumeration getAuthorizedUsers() - { - synchronized (userPermissionsLock_) - { - int count = userPermissions_.size(); - Vector names = new Vector(); - for (int i=0;i - *

  • 0 : This value does not apply to this object. - *
  • 1 : (*NONE) The document has no sensitivity restrictions. - *
  • 2 : (*PERSONAL) The document is intended for the user as an - * individual. - *
  • 3 : (*PRIVATE) The document contains information that should be - * accessed only by the owner. This value cannot be - * specified if the access code zero (0) is assigned to - * the object. - *
  • 4 : (*CONFIDENTIAL) The document contains information that should - * be handled according to company procedures. - * - * @see #setSensitivityLevel - * - **/ - public int getSensitivityLevel() - { - return sensitivityLevel_; - } - - /** - * Returns the system - * @return The system instance. - * - **/ - public AS400 getSystem() - { - return as400_; - } - - /** - * Returns the object type. - * @return The object type. The possible values are: - *
      - *
    • TYPE_DLO - Indicating the object is a Document Library Objects (DLO) - * stored in QDLS. - *
    • TYPE_QSYS - Indicating the object is contained in the system library - * structure and stored in QSYS.LIB. - *
    • TYPE_ROOT - Indicating the object is contained in the root directory - * structure. This includes everything that is not in QSYS.LIB or QDLS. - *
    - * - **/ - public int getType() - { - return type_; - } - - /* - Searches a user in specified vector. - */ - private int getUserIndex(String userProfileName,Vector vector) - { - int count = vector.size(); - for (int i=0;i= 0) // if QSYS.LIB is someplace in the name // @B6a - { // @B6a - if (locationOfQSYS > 0) // if the name starts with QSYS.LIB // @B6a - { // @B6a - // QSYS.LIB is not the first component of the path. First, // @B6a - // set "asp" to everything before /QSYS.LIB" except the // @B6a - // first and last slash. // @B6a - String asp = name.substring(1, locationOfQSYS); // @B6a - // @B6a - // does 'asp' contain a slash? If yes then it is not an ASP // @B6a - // name, just the name of an object in the root file system. // @B6a - // If asp does not contain a slash then it is an ASP name. // @B6a - // Set class variable asp_ to "/aspName". Set class variable // @B6a - // path_ to "/QSYS.LIB/...". // @B6a - if (asp.indexOf('/') < 0) // @B6a - { // @B6a - asp_ = objectName.substring(0, locationOfQSYS); // @B6a - // @A3 Leave the ASP in the path. (e.g. /iasp123/QSYS.LIB/xyz.lib) - // path_ = objectName.substring(locationOfQSYS); // @B6a //@A3D - return TYPE_QSYS; // @B6a - } // @B6a - else // @B6a - ; // Don't do anything. QSYS.LIB is not the second // @B6a - // component of the name so this object is not a QSYS // @B6a - // object on an ASP, it is a normal root file // @B6a - // system object. // @B6a - } // @B6a - else // The name starts with QSYS // @B6a - return TYPE_QSYS; // @B6a - } // @B6a - // @B6a - if (name.startsWith("/QDLS/")) // @B6a - { // @B6a - return TYPE_DLO; // @B6a - } // @B6a - // @B6a - return TYPE_ROOT; // @B6a - } // @B6a - else // @B6a - { // @B6a - String name = objectName.toUpperCase(); // @A2A - if(name.startsWith("/QSYS.LIB/") || name.equals("/QSYS.LIB")) // @A2C - { - return TYPE_QSYS; - } -// if(objectName.toUpperCase().startsWith("/QDLS/") || objectName.toUpperCase().equals("/QDLS")) // @1JUC check to see if it is the qdls root folder - if(name.startsWith("/QDLS/") || name.equals("/QDLS")) // @A2C @1JUC check to see if it is the qdls root folder - { - return TYPE_DLO; - } - return TYPE_ROOT; - } // @B6a - } - - - /** - * Serialization support. - * @exception Thrown when an application tries to load in a class through its string name, - * but no definition for the class with the specifed name could be found. - * @exception IOException If an error occurs while communicating with the system. - * - **/ - private void readObject(ObjectInputStream s) - throws ClassNotFoundException, IOException - { - int size; - s.defaultReadObject(); - switch(type_) - { - case TYPE_QSYS : - access_ = new PermissionAccessQSYS(as400_); - break; - case TYPE_DLO : - access_ = new PermissionAccessDLO(as400_); - break; - case TYPE_ROOT : - default : - access_ = new PermissionAccessRoot(as400_); - break; - } - access_.setFollowSymbolicLinks(followSymbolicLinks_); - - userPermissionsLock_ = new Object(); - userPermissionsBuffer_ = new Vector (); - userPermissions_ = new Vector(); - size = ((Integer)s.readObject()).intValue(); - for (int i=0;i
    -     * Permission permisson = new Permisson(new AS400(),"/QSYS.LIB/FRED.LIB";
    -     * permission.setAuthorizationList("testautl");
    -     * System.out.println("The authorization list of fred.lib is " + permissin.geAuthorizationList();
    -     * permission.setAuthorizationList("*NONE");
    -     * System.out.println("The authorization list of fred.lib is " + permissin.geAuthorizationList();
    -     * 

    - * @param autList The authorizations list of the object. - * - **/ - public synchronized void setAuthorizationList(String autList) - { - if (autList == null) throw new NullPointerException("autList"); - if (autList.trim().equalsIgnoreCase(authorizationList_)) - return; - if (autListChanged_== false) - autListBackup_ = authorizationList_; - authorizationList_ = autList.trim().toUpperCase(); - autListChanged_ = true; - } - - // @B2a - /** - * Sets the owner of the object. - * @param owner The owner of the object. - * @param revokeOldAuthority Specifies whether the authorities for the current - * owner are revoked when ownership is transferred to the new owner. - * - * @see #getOwner - **/ - public synchronized void setOwner(String owner, boolean revokeOldAuthority) - { - if (owner == null) throw new NullPointerException("owner"); - - owner_ = owner; - revokeOldAuthority_ = revokeOldAuthority; - ownerChanged_ = true; - } - - /** - * Sets the primary group of the object. - * @param primaryGroup The primary group of the object. - * @param revokeOldAuthority Specifies whether the authorities for the current - * primary group are revoked when the primary group is changed to the new value. - * - **/ - public void setPrimaryGroup(String primaryGroup, boolean revokeOldAuthority) - { - if (primaryGroup == null) throw new NullPointerException("primaryGroup"); - primaryGroup_ = primaryGroup; - revokeOldGroupAuthority_ = revokeOldAuthority; - primaryGroupChanged_ = true; - } - - - /** - * Sets the sensitivity level of the object. - * @param sensitivityLevel The sensitivity level of the object. The - * possible values : - *
      - *
    • 0 : This value does not apply to this object. - *
    • 1 : (*NONE) The document has no sensitivity restrictions. - *
    • 2 : (*PERSONAL) The document is intended for the user as an - * individual. - *
    • 3 : (*PRIVATE) The document contains information that should be - * accessed only by the owner. This value cannot be - * specified if the access code zero (0) is assigned to - * the object. - *
    • 4 : (*CONFIDENTIAL) The document contains information that should - * be handled according to company procedures. - *
    - * - * @see #getSensitivityLevel - **/ - public synchronized void setSensitivityLevel(int sensitivityLevel) - { - if (sensitivityLevel < 0 || sensitivityLevel > 4) - { - throw new ExtendedIllegalArgumentException("sensitivityLevel ("+sensitivityLevel+")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID ); - } - sensitivityLevel_ = sensitivityLevel; - sensitivityChanged_ = true; - } - - /** - * Sets the system where system value is retrieved. - * - * @param system The system object. - * @see #getSystem - * @deprecated This method is of little (or no) known usefulness. If you require this method, please notify the Toolbox support team. - **/ - public synchronized void setSystem(AS400 system) - { - if (system == null) throw new NullPointerException("system"); - - if (as400_ == null) //$B1C - as400_ = system; //$B1C - else //$B1C - { - if (as400_.isConnected()) - { - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - if (as400_.equals(system)==true) - return; - } - - switch(type_) - { - case TYPE_QSYS : - access_ = new PermissionAccessQSYS(as400_); - break; - case TYPE_DLO : - access_ = new PermissionAccessDLO(as400_); - break; - case TYPE_ROOT : - default : - access_ = new PermissionAccessRoot(as400_); - break; - } - access_.setFollowSymbolicLinks(followSymbolicLinks_); - // Assume that, since we're (re)connecting to the same system we were originally connected to, that none of the permissions information needs to be re-retrieved. - } - - /** - * Serialization support. - * @exception IOException If an error occurs while communicating with the system. - * - **/ - private void writeObject(ObjectOutputStream s) - throws IOException - { - s.defaultWriteObject(); - - synchronized (userPermissionsLock_) - { - s.writeObject(new Integer(userPermissionsBuffer_.size())); - for (int i=0;i= 0x050300); - - ProgramCall rtvUsersAUT=new ProgramCall(as400_); - rtvUsersAUT.setProgram(prgName.getPath(),parmList); -// rtvUsersAUT.setThreadSafe(false); // API isn't threadsafe as of V4R4. @A5A - - if (rtvUsersAUT.run()!=true) - { - // If any error message return. - AS400Message[] msgList = rtvUsersAUT.getMessageList(); - throw new AS400Exception(msgList); - } - else - { - // Gets returned data. - feedbackData=parmList[2].getOutputData(); - usersData = parmList[0].getOutputData(); - } - - // Gets format of returned records feedback information. - recordFormat=getFeedbackRecordFormat(); - - // Gets the record contains fields. - Record record0=new Record(recordFormat); - - // Sets the contents of this record from the specified byte array. - record0.setContents(feedbackData); - - Integer bytesAvailable=(Integer)record0.getField("BytesAvailable"); - Integer bytesReturn=(Integer)record0.getField("BytesReturn"); - int requiredLength=bytesAvailable.intValue(); - int receiverLength=bytesReturn.intValue(); - - if(requiredLength>receiverLength) - { - // If there is not enough space provided, retrieve data again. - parmList = getParameters(requiredLength+400, objName, vrm >= 0x050300); - rtvUsersAUT.setProgram(prgName.getPath(),parmList); - if (rtvUsersAUT.run()!=true) - { - AS400Message[] msgList = rtvUsersAUT.getMessageList(); - throw new AS400Exception(msgList); - } - else - { - // Gets returned data. - feedbackData=parmList[2].getOutputData(); - usersData = parmList[0].getOutputData(); - // Sets the contents of feedback record again. - record0.setContents(feedbackData); - } - } - - // Gets the values of the fields in the record. - String owner=((String)record0.getField("owner")).trim(); - String primaryGroup=((String)record0.getField("primaryGroup")).trim(); - String authorizationList=((String)record0.getField("authorizationList")).trim(); - String sensitivityLev=((String)record0.getField("sensitivityLevel")).trim(); - Integer sensitivityLevel=new Integer(getIntValue(sensitivityLev)); - - // Adds information to vector. - vector.addElement(owner); - vector.addElement(primaryGroup); - vector.addElement(authorizationList); - vector.addElement(sensitivityLevel); - - Integer usersNumber=(Integer)record0.getField("usersNumber"); - Integer userEntryLength=(Integer)record0.getField("userEntryLength"); - int totalUsers=usersNumber.intValue(); - int length=userEntryLength.intValue(); - - // Gets the information record format for each user. - userRecordFormat=getUserRecordFormat(); - - // Gets the information for each user. - for(int i=0;i> 8); - pathNameBytes[bc*2+1] = (byte)(pathChar); - } - } - - byte[] qlgPathNameTStructure = new byte[32 + pathNameBytes.length]; - BinaryConverter.intToByteArray(1200, qlgPathNameTStructure, 0); // CCSID - // 2-byte country or region ID... x0000 = use current job settings - // 3-byte language ID... 0x000000 = use current job settings - // 3 bytes reserved - BinaryConverter.intToByteArray(2, qlgPathNameTStructure, 12); // path type indicator: 2 means pathname is a character string and has a two-byte path delimiter - BinaryConverter.intToByteArray(pathNameBytes.length, qlgPathNameTStructure, 16); // length of path name - char delimiter = '/'; // path name delimiter - qlgPathNameTStructure[20] = (byte)(delimiter >> 8); // high-byte - qlgPathNameTStructure[21] = (byte)delimiter; // low-byte - // 10 bytes reserved - System.arraycopy(pathNameBytes, 0, qlgPathNameTStructure, 32, pathNameBytes.length); // path name - - parmList[5] = new ProgramParameter(qlgPathNameTStructure); - parmList[6] = new ProgramParameter(BinaryConverter.intToByteArray(-1)); - } - - byte[] errorInfo = new byte[32]; - parmList[7] = new ProgramParameter( errorInfo, 0 ); - - // If the caller wants to retrieve attributes for the link itself, - // specify optional parameter "Symbolic link" as "*YES". - if (!followSymbolicLinks_) - { - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, "Adding 'Symbolic link: *YES' parameter for QSYRTVUA."); - } - AS400Text text10 = new AS400Text(10, getCcsid(), as400_); - parmList[8]= new ProgramParameter(text10.toBytes("*YES")); // default is *NO - } - - return parmList; - } - - - /** - * Returns the record format of the user's permission. - * @return The record format of the user's permission. - * - **/ - RecordFormat getUserRecordFormat() - { - CharacterFieldDescription[] cfd; - cfd=new CharacterFieldDescription[16]; - AS400Text text1 = new AS400Text(1, getCcsid(), as400_); //@A2A - AS400Text text10 = new AS400Text(10, getCcsid(), as400_); //@A2A - cfd[0] =new CharacterFieldDescription(text10,"profileName"); //@A2C - cfd[1] =new CharacterFieldDescription(text1,"userOrGroup"); //@A2C - cfd[2] =new CharacterFieldDescription(text10,"dataAuthority"); //@A2C - cfd[3] =new CharacterFieldDescription(text1,"autListMgt"); //@A2C - cfd[4] =new CharacterFieldDescription(text1,"objMgt"); //@A2C - cfd[5] =new CharacterFieldDescription(text1,"objExistence"); //@A2C - cfd[6] =new CharacterFieldDescription(text1,"objAlter"); //@A2C - cfd[7] =new CharacterFieldDescription(text1,"objRef"); //@A2C - cfd[8] =new CharacterFieldDescription(text10,"reserved1"); //@A2C - cfd[9] =new CharacterFieldDescription(text1,"objOperational"); //@A2C - cfd[10] =new CharacterFieldDescription(text1,"dataRead"); //@A2C - cfd[11] =new CharacterFieldDescription(text1,"dataAdd"); //@A2C - cfd[12] =new CharacterFieldDescription(text1,"dataUpdate"); //@A2C - cfd[13] =new CharacterFieldDescription(text1,"dataDelete"); //@A2C - cfd[14] =new CharacterFieldDescription(text1,"dataExecute"); //@A2C - cfd[15] =new CharacterFieldDescription(text10,"reserved2"); //@A2C - RecordFormat userrf=new RecordFormat(); - for(int i=0;i<16;i++) - userrf.addFieldDescription(cfd[i]); - return userrf; - } - - /** - * Returns the user's permission retrieved from the system. - * @return The user's permission retrieved from the system. - * @exception UnsupportedEncodingException The Character Encoding is not supported. - * - **/ - abstract public UserPermission getUserPermission(Record userRecord) - throws UnsupportedEncodingException; - - - /** - * Returns whether symbolic links are resolved when changing or retrieving permissions. - * @return Whether symbolic links are resolved. - * @see #setFollowSymbolicLinks - * - **/ - public boolean isFollowSymbolicLinks() - { - return followSymbolicLinks_; - } - - - /** - * Removes the authorized user. - * @param objName The object the authorized user will be removed from. - * @param userName The profile name of the authorized user. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the host server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - abstract public void removeUser(String objName,String userName) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException; - - /** - * Sets authorized information. - * @param objName The object the authorized information will be set to. - * @param permission The permission will be set. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the host server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - abstract public void setAuthority(String objName,UserPermission permission) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException; - - /** - * Sets authorization list of the object. - * @param objName The object the authorized list will be set to. - * @param autList The authorization list will be set. - * @param oldValue The old authorization list will be replaced. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the host server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - abstract public void setAuthorizationList(String objName,String autList,String oldValue) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException; - - /** - * Sets from authorization list of the object. - * @param objName The object the authorized list will be set to. - * @param fromAutl true if the permission is from the authorization list; - * false otherwise. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the host server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - abstract public void setFromAuthorizationList(String objName,boolean fromAutl) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException; - - // @B2a - /** - * Sets the owner of the object. - * @param objName The object whose ownership is being reset. - * @param owner The owner of the object. - * @param revokeOldAuthority Specifies whether the authorities for the current - * owner are revoked when ownership is transferred to the new owner. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the host server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - public void setOwner(String objName, String owner, boolean revokeOldAuthority) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException - { - // @B6 Note -- objName is an IFS-style name which is what - // the CHGOWN command requires. For objects in QSYS, the name - // is "/QSYS.LIB/...". If the object is on an ASP, the asp name - // must be prepended to the path (/aspName/QSYS.LIB/...). Our - // caller must correctly build the name. - - if (objName == null) throw new NullPointerException("objName"); - if (owner == null) throw new NullPointerException("owner"); - - String upperCasePath = toUpperCasePath(objName).trim(); - // If this begins with /QOPENSYS, do use the uppercase version because - // QOPENSYS is case sensitive - if (upperCasePath.indexOf("/QOPENSYS/") == 0) { - // Don't uppercase the object name - } else { - objName = toUpperCasePath(objName); - } - CommandCall cmd = new CommandCall(as400_); - String revokeOldAut; - if (revokeOldAuthority) revokeOldAut = "*YES"; - else revokeOldAut = "*NO"; - String cmdString = "CHGOWN " + - "OBJ("+expandQuotes(objName)+") " + // @B3c @B4c - "NEWOWN("+owner+") " + - "RVKOLDAUT("+revokeOldAut+")"; - if (!followSymbolicLinks_) - { - cmdString += " SYMLNK(*YES)"; - } - cmd.setCommand(cmdString); -// cmd.setThreadSafe(false); // CHGOWN isn't threadsafe. - if(cmd.run()!=true) - { - AS400Message[] msgList=cmd.getMessageList(); - throw new AS400Exception(msgList); - } - } - - - /** - * Sets the primary group of the object. - * @param objName The object whose primary group is being reset. - * @param primaryGroup The primary group. - * @param revokeOldAuthority Specifies whether the authorities for the current - * primary group are revoked when the primary group is changed to the new value. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the host server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - public void setPrimaryGroup(String objName, String primaryGroup, boolean revokeOldAuthority) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException - { - // Note -- objName is an IFS-style name which is what - // the CHGPGP command requires. For objects in QSYS, the name - // is "/QSYS.LIB/...". If the object is on an ASP, the asp name - // must be prepended to the path (/aspName/QSYS.LIB/...). Our - // caller must correctly build the name. - - if (objName == null) throw new NullPointerException("objName"); - if (primaryGroup == null) throw new NullPointerException("primaryGroup"); - - String upperCasePath = toUpperCasePath(objName).trim(); - // If this begins with /QOPENSYS, do use the uppercase version because QOPENSYS is case sensitive - if (upperCasePath.indexOf("/QOPENSYS/") == 0) { - // Don't uppercase the object name - } else { - objName = toUpperCasePath(objName); - } - CommandCall cmd = new CommandCall(as400_); - String revokeOldAut; - if (revokeOldAuthority) revokeOldAut = "*YES"; - else revokeOldAut = "*NO"; - String cmdString = "CHGPGP " + - "OBJ("+expandQuotes(objName)+") " + - "NEWPGP("+primaryGroup+") " + - "RVKOLDAUT("+revokeOldAut+")"; - cmd.setCommand(cmdString); -// cmd.setThreadSafe(false); // CHGPGP isn't threadsafe. - if(cmd.run()!=true) - { - AS400Message[] msgList=cmd.getMessageList(); - throw new AS400Exception(msgList); - } - } - - - /** - * Sets whether to resolve symbolic links when changing or retrieving permissions. - * The default value is true; that is, symbolic links are always resolved. - * By default, if the IBM i object is a symbolic link, then the requested action - * is performed on the object ultimately pointed to by the symbolic link, - * rather than on the symbolic link itself. - *
    Note: This method is effective only for IBM i release V5R4 and higher. - * For earlier releases, symbolic links are always resolved, and this method is ignored. - * @param followLinks Whether symbolic links are resolved. - * @see #isFollowSymbolicLinks - * - **/ - public void setFollowSymbolicLinks(boolean followLinks) - { - // Assume that the caller has already verified that we're running to V5R4 or higher. - // Note to programmer: If this class ever becomes public, add a VRM check here, - // as in Permission.setFollowSymbolicLinks(). - followSymbolicLinks_ = followLinks; - } - - - /** - * Sets the sensitivity level of the object. - * @param objName The object the sensitivity level will be set to. - * @param sensitivityLevel The sensitivity level. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the host server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - abstract public void setSensitivity(String objName,int sensitivityLevel) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException; - - /** - * Sets the system where object authority information resides. - * - * @param system The server object. - * @see #getSystem - **/ - public void setSystem(AS400 system) - { - if (system == null) throw new NullPointerException("system"); - as400_ = system; - } - - // Uppercases the specified path string. Any characters enclosed in quotes are not changed. - static final String toUpperCasePath(String path) - { - if (path == null || path.length() == 0) return (String)path; - else return QSYSObjectPathName.toQSYSName(path); - } - -} - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/access/PermissionAccessDLO.java b/cvsroot/src/com/ibm/as400/access/PermissionAccessDLO.java deleted file mode 100644 index df8e96091..000000000 --- a/cvsroot/src/com/ibm/as400/access/PermissionAccessDLO.java +++ /dev/null @@ -1,604 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PermissionAccessDLO.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.UnknownHostException; - -/** - * the PermissionAccessDLO class is provided to retrieve the - * user's permission information. - * -**/ -class PermissionAccessDLO extends PermissionAccess -{ - /** - * Constructs a PermissionAccessDLO object. - * - **/ - public PermissionAccessDLO(AS400 system) - { - super(system); - } - - /** - * Adds the authorized user or user permission. - * @param objName The object the authorized user will be added to. - * @param permission The permission of the new authorized user. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - public void addUser(String objName,UserPermission permission) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException - { - objName = toUpperCasePath(objName); //@A2C: toUpperCase() - CommandCall addUser= getAddCommand(as400_,objName,permission); - - if (addUser.run()!=true) - { - AS400Message[] msgList = addUser.getMessageList(); - throw new AS400Exception(msgList); - } - return; - - } - - - // @B3a - New Method. - /** - * Prepares the object name for parsing by the IBM i Command Analyzer. - * @param objName The name of an object. - * @return A version of the name that is parsable by the Command Analyzer. - * - **/ - protected final String expandQuotes(String objName) - { - return expandQuotes0(objName); - } - - - // @B3a - New Method. - /** - * If the name contains single-quotes, doubles up the single-quotes. - * Regardless, encloses the entire name in single-quotes. - * This prepares the name for parsing by the IBM i Command Analyzer. - * @param objName The name of an object. - * @return A version of the name that is parsable by the Command Analyzer. - * - **/ - static String expandQuotes0(String objName) - { // @B4c - StringBuffer buf = new StringBuffer(objName); - // First, if the name contains single-quotes, double-up the quotes. - if (objName.indexOf('\'') != -1) { - for (int i=objName.length()-1; i>=0; i--) { - if (buf.charAt(i) == '\'') { buf.insert(i,'\''); } - } - } - // Finally, enclose the entire name in single-quotes. - buf.insert(0,'\''); - buf.append('\''); - - return buf.toString(); - } - - /** - * Returns the command to add a authorized user. - * @param objName The object the authorized user will be added to. - * @param permission The permission of the new authorized user. - * @return The command to add authorized user. - * - **/ - private static CommandCall getAddCommand(AS400 sys, String objName,UserPermission permission) - { - DLOPermission dloPermission = (DLOPermission)permission; - String userProfile=dloPermission.getUserID(); - String authorityLevel=dloPermission.getDataAuthority(); - try - { - objName = CharConverter.convertIFSQSYSPathnameToJobPathname(objName, sys.getCcsid()); - } - catch(Exception e) - { - Trace.log(Trace.WARNING, "Unable to convert QDLS pathname to correct job CCSID.", e); - } - int index1 = objName.indexOf('/',1); - int index2=objName.lastIndexOf('/'); - String name=objName.substring(index2+1); - String folder; - if (index1+1 - *
  • *NONE - The object has no sensitivity restrictions. - *
  • *PERSONAL - The object contains information intended for the user as an individual. - *
  • *PRIVATE - The object contains information that should be accessed only by the owner. - *
  • *CONFIDENTIAL - The object contains information that should be handled according to company procedures. - * - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the server cannot be started. - * @exception UnknownHostException If the server cannot be located. - **/ - public synchronized void setSensitivity(String objName,int sensitivityLevel) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException - { - objName = toUpperCasePath(objName); //@A2A - try - { - objName = CharConverter.convertIFSQSYSPathnameToJobPathname(objName, as400_.getCcsid()); - } - catch(Exception e) - { - Trace.log(Trace.WARNING, "Unable to convert QDLS pathname to correct job CCSID.", e); - } - String name,folder; - int index1 = objName.indexOf('/',1); - int index2=objName.lastIndexOf('/'); - name=objName.substring(index2+1); - if (index1+1 0) // if the name starts with an ASP // @B6a - { // @B6a - asp = objName.substring(0, locationOfQSYS); // @B6a - objName = objName.substring(locationOfQSYS); // @B6a - } // @B6a - - QSYSObjectPathName objectPathName = new QSYSObjectPathName(objName); - String objectType = objectPathName.getObjectType(); - String command,object; - if (objectType.equals("AUTL")) - { - object = objectPathName.getObjectName(); - try - { - object = CharConverter.convertIFSQSYSPathnameToJobPathname(object, sys.getCcsid()); - } - catch(Exception e) - { - if (Trace.traceOn_) { - Trace.log(Trace.WARNING, "Unable to convert CL command to correct job CCSID.", e); - } - } - - command = "RMVAUTLE" - +" AUTL("+object+")" - +" USER("+userName+")"; -// threadSafe = false; // RMVAUTLE isn't threadsafe. @A2A @A3C - } - else if (objectType.equals("MBR")) - { - if (asp != null) // @B6a - object = asp + "/QSYS.LIB/"; // @B6a - else // @B6a - { - // Starting slash must be there or this will be treated like @A4C - // a relative path of the users working directory @A4C - object = "/QSYS.LIB/"; //@A4C - } - - if (!objectPathName.getLibraryName().equals("")) - object += objectPathName.getLibraryName()+".LIB/"; - object += objectPathName.getObjectName()+".FILE"; - -// The CHGAUT command doesn't need the path converted either, for some reason. -/* try - { - object = CharConverter.convertIFSQSYSPathnameToJobPathname(object, sys.getCcsid()); - } - catch(Exception e) - { - Trace.log(Trace.WARNING, "Unable to convert CL command to correct job CCSID.", e); - } -*/ - command="CHGAUT" - +" OBJ("+expandQuotes0(object)+")" // @B4c - +" USER("+userName+")" - +" DTAAUT(*NONE)" - +" OBJAUT(*NONE)"; - if (!followSymbolicLinks) - { - command += " SYMLNK(*YES)"; - } -// threadSafe = true; //@A2A - } - else - { - String localName = objName; // @B6a - - if (asp != null) // @B6a - localName = asp + localName; // @B6a - -/* try - { - localName = CharConverter.convertIFSQSYSPathnameToJobPathname(localName, sys.getCcsid()); - } - catch(Exception e) - { - Trace.log(Trace.WARNING, "Unable to convert CL command to correct job CCSID.", e); - } -*/ - command="CHGAUT" - +" OBJ(" + expandQuotes0(localName) + ")" // @B4c @B6c - +" USER("+userName+")" - +" DTAAUT(*NONE)" - +" OBJAUT(*NONE)"; - if (!followSymbolicLinks) - { - command += " SYMLNK(*YES)"; - } -// threadSafe = true; //@A2A - } - - CommandCall cmd = new CommandCall(sys, command); //@A2C -// cmd.setThreadSafe(threadSafe); //@A2A - return cmd; //@A2C - } - - /** - * Returns the user's permission retrieved from the system. - * @return The user's permission retrieved from the system. - * @exception UnsupportedEncodingException The Character Encoding is not supported. - * - **/ - public UserPermission getUserPermission(Record userRecord) - throws UnsupportedEncodingException - { - String profileName=((String)userRecord.getField("profileName")).trim(); - String userOrGroup=((String)userRecord.getField("userOrGroup")).trim(); - String dataAuthority=((String)userRecord.getField("dataAuthority")).trim(); - String autListMgt=((String)userRecord.getField("autListMgt")).trim(); - String objMgt=((String)userRecord.getField("objMgt")).trim(); - String objExistence=((String)userRecord.getField("objExistence")).trim(); - String objAlter=((String)userRecord.getField("objAlter")).trim(); - String objRef=((String)userRecord.getField("objRef")).trim(); - //String reserved1=((String)userRecord.getField("reserved1")).trim(); - String objOperational=((String)userRecord.getField("objOperational")).trim(); - String dataRead=((String)userRecord.getField("dataRead")).trim(); - String dataAdd=((String)userRecord.getField("dataAdd")).trim(); - String dataUpdate=((String)userRecord.getField("dataUpdate")).trim(); - String dataDelete=((String)userRecord.getField("dataDelete")).trim(); - String dataExecute=((String)userRecord.getField("dataExecute")).trim(); - String reserved2=((String)userRecord.getField("reserved2")).trim(); - QSYSPermission permission; - permission =new QSYSPermission(profileName); - permission.setGroupIndicator(getIntValue(userOrGroup)); - - permission.setAuthorizationListManagement(getBooleanValue(autListMgt)); - permission.setManagement(getBooleanValue(objMgt)); - permission.setExistence(getBooleanValue(objExistence)); - permission.setAlter(getBooleanValue(objAlter)); - permission.setReference(getBooleanValue(objRef)); - permission.setOperational(getBooleanValue(objOperational)); - permission.setRead(getBooleanValue(dataRead)); - permission.setAdd(getBooleanValue(dataAdd)); - permission.setUpdate(getBooleanValue(dataUpdate)); - permission.setDelete(getBooleanValue(dataDelete)); - permission.setExecute(getBooleanValue(dataExecute)); - if (dataAuthority.equalsIgnoreCase("*AUTL")) - { - permission.setFromAuthorizationList(true); - } - return permission; - } - - /** - * Removes the authorized user. - * @param objName The object the authorized user will be removed from. - * @param userName The profile name of the authorized user. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - public void removeUser(String objName,String userName) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException - { - CommandCall removeUser = getRmvCommand(as400_,objName,userName,followSymbolicLinks_); - - if (removeUser.run()!=true) - { - AS400Message[] msgList = removeUser.getMessageList(); - throw new AS400Exception(msgList); - } - return; - } - - /** - * Sets the permission of a user for an object. - * @param objName The object that the user permission will be set to. - * @param permission The permission of the authorized user. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the server cannot be started. - * @exception UnknownHostException If the server cannot be located. - **/ - public synchronized void setAuthority(String objName,UserPermission permission) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException - { -// CommandCall setAuthority = getClrCommand(as400_,objName,permission); -// if (setAuthority.run()!=true) -// { -// AS400Message[] msgList = setAuthority.getMessageList(); -// throw new AS400Exception(msgList); -// } - - CommandCall setAuthority = getChgCommand(as400_,objName,permission); - if (setAuthority.run()!=true) - { - AS400Message[] msgList = setAuthority.getMessageList(); - throw new AS400Exception(msgList); - } - return; - } - - /** - * Sets authorization list of the object. - * @param objName The object that the authorization list will be set to. - * @param autList The authorization list that will be set. - * @param oldValue The old authorization list will be replaced. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - public synchronized void setAuthorizationList(String objName,String autList,String oldValue) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException - { - QSYSObjectPathName objectPathName = new QSYSObjectPathName(objName); - String object = objectPathName.getObjectName(); - - if (object.equals("")) //@A5A - object = "QSYS/"+objectPathName.getLibraryName(); //@A5A - else //@A5A - object = objectPathName.getLibraryName()+"/"+object; //@A5A - - String objectType = objectPathName.getObjectType(); - if (objectType.trim().equalsIgnoreCase("MBR")) - objectType = "FILE"; - - CommandCall setAUTL=new CommandCall(as400_); - String cmd; - try - { - object = CharConverter.convertIFSQSYSPathnameToJobPathname(object, as400_.getCcsid()); - } - catch(Exception e) - { - if (Trace.traceOn_) { - Trace.log(Trace.WARNING, "Unable to convert CL command to correct job CCSID.", e); - } - } - // Add the ASPDEV() parameter if object is on IASP //@A1A - String aspParm = ""; //@A1A - String aspName = objectPathName.getAspName(); //@A1A - if (!aspName.equals("")) //@A1A - aspParm = " ASPDEV("+aspName+")"; //@A1A - if (!oldValue.equalsIgnoreCase("*NONE")&& - autList.equalsIgnoreCase("*NONE")) - { - cmd = "RVKOBJAUT" - +" OBJ("+object+")" - +" OBJTYPE(*"+objectType+")" - +aspParm //@A1A - +" AUTL("+oldValue+")"; - } else - { - - cmd = "GRTOBJAUT" - +" OBJ("+object+")" - +" OBJTYPE(*"+objectType+")" - +aspParm //@A1A - +" AUTL("+autList+")"; - } - setAUTL.setCommand(cmd); -// setAUTL.setThreadSafe(false); // RVKOBJAUT,GRTOBJAUT not threadsafe. @A2A @A3C - if (setAUTL.run()!=true) - { - AS400Message[] msgList = setAUTL.getMessageList(); - throw new AS400Exception(msgList); - } - return; - } - - /** - * Sets from authorization list of the object. - * @param objName The object the authorized list will be set to. - * @param fromAutl true if the permission is from the authorization list; - * false otherwise. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - public synchronized void setFromAuthorizationList(String objName,boolean fromAutl) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException - { - QSYSObjectPathName objectPathName = new QSYSObjectPathName(objName); - String object = objectPathName.getObjectName(); - - if (object.equals("")) //@A5A - object = "QSYS/"+objectPathName.getLibraryName(); //@A5A - else //@A5A - object = objectPathName.getLibraryName()+"/"+object; //@A5A - - String objectType = objectPathName.getObjectType(); - if (objectType.equalsIgnoreCase("MBR")) - objectType = "FILE"; - - CommandCall fromAUTL=new CommandCall(as400_); - String cmd; - try - { - object = CharConverter.convertIFSQSYSPathnameToJobPathname(object, as400_.getCcsid()); - } - catch(Exception e) - { - if (Trace.traceOn_) { - Trace.log(Trace.WARNING, "Unable to convert CL command to correct job CCSID.", e); - } - } - // Add the ASPDEV() parameter if object is on IASP //@A1A - String aspParm = ""; //@A1A - String aspName = objectPathName.getAspName(); //@A1A - if (!aspName.equals("")) //@A1A - aspParm = " ASPDEV("+aspName+")"; //@A1A - if (fromAutl) - cmd = "GRTOBJAUT" - +" OBJ("+object+")" - +" OBJTYPE(*"+objectType+")" - +" USER(*PUBLIC)" - +aspParm //@A1A - +" AUT(*AUTL)"; - else - { - cmd = "GRTOBJAUT" - +" OBJ("+object+")" - +" OBJTYPE(*"+objectType+")" - +" USER(*PUBLIC)" - +aspParm //@A1A - +" AUT(*EXCLUDE)"; - } - fromAUTL.setCommand(cmd); -// fromAUTL.setThreadSafe(false); // GRTOBJAUT isn't threadsafe. @A2A @A3C - if (fromAUTL.run()!=true) - { - AS400Message[] msgList = fromAUTL.getMessageList(); - throw new AS400Exception(msgList); - } - return; - } - - -// For some reason, CHGOWN doesn't need the path name converted, but the other CL -// commands do. So we don't need to override this. -// -// /** -// * This is so we correctly convert variant QSYS characters. -// **/ -// public void setOwner(String objName, String owner, boolean revokeOldAuthority) -// throws AS400Exception, -// AS400SecurityException, -// ConnectionDroppedException, -// ErrorCompletingRequestException, -// InterruptedException, -// IOException, -// ServerStartupException, -// UnknownHostException, -// PropertyVetoException -// { -// try -// { -// objName = CharConverter.convertIFSQSYSPathnameToJobPathname(objName, as400_.getCcsid()); -// } -// catch(Exception e) -// { -// Trace.log(Trace.WARNING, "Unable to convert CL command to correct job CCSID.", e); -// } -// super.setOwner(objName, owner, revokeOldAuthority); -// } - - /** - * Sets the sensitivity level of the object. - * @param objName The object that the sensitivity level will be set to. - * @param sensitivityLevel The sensitivity level that will be set. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - public synchronized void setSensitivity(String objName,int sensitivityLevel) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException - { - return; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/PermissionAccessRoot.java b/cvsroot/src/com/ibm/as400/access/PermissionAccessRoot.java deleted file mode 100644 index c5fcf014e..000000000 --- a/cvsroot/src/com/ibm/as400/access/PermissionAccessRoot.java +++ /dev/null @@ -1,432 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PermissionAccessRoot.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.UnknownHostException; - -/** - * The PermissionAccessRoot class is provided to retrieve the user's permission - * information. - * -**/ -class PermissionAccessRoot extends PermissionAccess -{ - /** - * Constructs a PermissionAccessRoot object. - * - **/ - public PermissionAccessRoot(AS400 system) - { - super(system); - return; - } - - /** - * Adds the authorized user or user permission. - * @param objName The object the authorized user will be added to. - * @param permission The permission of the new authorized user. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - public void addUser(String objName,UserPermission permission) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException - { - CommandCall addUser= getChgCommand(as400_,objName,permission,followSymbolicLinks_); - - if (addUser.run()!=true) - { - AS400Message[] msgList = addUser.getMessageList(); - throw new AS400Exception(msgList); - } - return; - - } - - - // @B3a - New method. - /** - * Prepares the object name for parsing by the IBM i Command Analyzer. - * @param objName The name of an object. - * @return A version of the name that is parsable by the Command Analyzer. - * - **/ - protected final String expandQuotes(String objName) - { - return expandQuotes0(objName); - } - - // @B3a - New method. - /** - * If the name contains single- or double-quotes, doubles up the quotes and encloses the entire name in double-quotes. - * Regardless, encloses the entire name in single-quotes. - * This prepares the name for parsing by the IBM i Command Analyzer. - * @param objName The name of an object. - * @return A version of the name that is parsable by the Command Analyzer. - * - **/ - static String expandQuotes0(String objName) - { // @B4c - StringBuffer buf = new StringBuffer(objName); - // See if the name contains any single- or double-quotes. - if (objName.indexOf('\'') != -1 || - objName.indexOf('\"') != -1) { - // Double-up all single- and double-quotes. - for (int i=objName.length()-1; i>=0; i--) { - if (buf.charAt(i) == '\'') { buf.insert(i,'\''); } - else if (buf.charAt(i) == '\"') { buf.insert(i,'\"'); } - } - // Now enclose the entire name in double-quotes. - buf.insert(0,'\"'); - buf.append('\"'); - } - // Finally, enclose the entire name in single-quotes. - buf.insert(0,'\''); - buf.append('\''); - - return buf.toString(); - } - - /** - * Returns the command to change a authorized user's permission. - * @param objName The object that the authorized information will be set to. - * @param permission The permission will be changed. - * @return The command to remove a authorized user. - * - **/ - private static CommandCall getChgCommand(AS400 sys,String objName,UserPermission permission, boolean followSymbolicLinks) - { - RootPermission rootPermission = (RootPermission)permission; - String userProfile=rootPermission.getUserID(); - String dataAuthority=rootPermission.getDataAuthority(); - - boolean objMgt = rootPermission.isManagement(); - boolean objExist = rootPermission.isExistence(); - boolean objAlter = rootPermission.isAlter(); - boolean objRef = rootPermission.isReference(); - String objAuthority=""; - if(objMgt==true) - objAuthority=objAuthority+"*OBJMGT "; - if(objExist==true) - objAuthority=objAuthority+"*OBJEXIST "; - if(objAlter==true) - objAuthority=objAuthority+"*OBJALTER "; - if(objRef==true) - objAuthority=objAuthority+"*OBJREF"; - if((objMgt==false)&&(objExist==false)&&(objAlter==false)&&(objRef==false)) - { - objAuthority="*NONE"; - if (dataAuthority.equals("*NONE")) - dataAuthority = "*EXCLUDE"; - } - - String command = "CHGAUT" - +" OBJ("+expandQuotes0(objName)+")" // @B3c @B4c - +" USER("+userProfile+")" - +" DTAAUT("+dataAuthority+")" - +" OBJAUT("+objAuthority+")"; - if (!followSymbolicLinks) - { - command += " SYMLNK(*YES)"; - } - CommandCall cmd = new CommandCall(sys, command); //@A2C -// cmd.setThreadSafe(true); //@A2A - return cmd; //@A2C - } - - /** - * Returns the command to remove a authorized user. - * @param objName The object the authorized user will be removed from. - * @param userName The profile name of the authorized user. - * @return The command to remove a authorized user. - * - **/ - private static CommandCall getRmvCommand(AS400 sys,String objName,String userName, boolean followSymbolicLinks) - { - String dataAuthority="*NONE"; - String objAuthority="*NONE"; - String command = "CHGAUT" - +" OBJ("+expandQuotes0(objName)+")" // @B3c @B4c - +" USER("+userName+")" - +" DTAAUT("+dataAuthority+")" - +" OBJAUT("+objAuthority+")"; - if (!followSymbolicLinks) - { - command += " SYMLNK(*YES)"; - } - CommandCall cmd = new CommandCall(sys, command); //@A2C -// cmd.setThreadSafe(true); //@A2A - return cmd; //@A2C - } - - /** - * Returns the user's permission retrieve from the system. - * @return The user's permission retrieve from the system. - * @exception UnsupportedEncodingException The Character Encoding is not supported. - * - **/ - public UserPermission getUserPermission(Record userRecord) - throws UnsupportedEncodingException - { - String profileName=((String)userRecord.getField("profileName")).trim(); - String userOrGroup=((String)userRecord.getField("userOrGroup")).trim(); - String dataAuthority=((String)userRecord.getField("dataAuthority")).trim(); - String autListMgt=((String)userRecord.getField("autListMgt")).trim(); - String objMgt=((String)userRecord.getField("objMgt")).trim(); - String objExistence=((String)userRecord.getField("objExistence")).trim(); - String objAlter=((String)userRecord.getField("objAlter")).trim(); - String objRef=((String)userRecord.getField("objRef")).trim(); - RootPermission permission; - permission =new RootPermission(profileName); - permission.setGroupIndicator(getIntValue(userOrGroup)); - - permission.setAuthorizationListManagement(getBooleanValue(autListMgt)); - permission.setManagement(getBooleanValue(objMgt)); - permission.setExistence(getBooleanValue(objExistence)); - permission.setAlter(getBooleanValue(objAlter)); - permission.setReference(getBooleanValue(objRef)); - if (dataAuthority.equalsIgnoreCase("*AUTL")) - { - permission.setDataAuthority("*EXCLUDE"); - permission.setFromAuthorizationList(true); - } else - { - permission.setDataAuthority(dataAuthority); - } - return permission; - } - - /** - * Removes the authorized user. - * @param objName The object the authorized user will be removed from. - * @param userName The profile name of the authorized user. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - public void removeUser(String objName,String userName) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException - { - CommandCall removeUser = getRmvCommand(as400_,objName,userName,followSymbolicLinks_); - - if (removeUser.run()!=true) - { - AS400Message[] msgList = removeUser.getMessageList(); - throw new AS400Exception(msgList); - } - return; - } - - /** - * Returns authorized users' permissions. - * @return a vector of authorized users' permission. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - public synchronized void setAuthority(String objName,UserPermission permission) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException - { - CommandCall setAuthority = getChgCommand(as400_,objName,permission,followSymbolicLinks_); - - if (setAuthority.run()!=true) - { - AS400Message[] msgList = setAuthority.getMessageList(); - throw new AS400Exception(msgList); - } - return; - } - - /** - * Sets authorization list of the object. - * @param objName The object that the authorized list will be set to. - * @param autList The authorization list that will be set. - * @param oldValue The old authorization list will be replaced. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - public synchronized void setAuthorizationList(String objName,String autList,String oldValue) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException - { - CommandCall setAUTL=new CommandCall(as400_); - String cmd="CHGAUT" - +" OBJ("+expandQuotes0(objName)+")" // @B3c @B4c - +" AUTL("+autList+")"; - if (!followSymbolicLinks_) - { - cmd += " SYMLNK(*YES)"; - } - setAUTL.setCommand(cmd); -// setAUTL.setThreadSafe(true); //@A2A - if (setAUTL.run()!=true) - { - AS400Message[] msgList = setAUTL.getMessageList(); - throw new AS400Exception(msgList); - } - return; - } - - /** - * Sets from authorization list of the object. - * @param objName The object the authorized list will be set to. - * @param fromAutl true if the permission is from the authorization list; - * false otherwise. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - public synchronized void setFromAuthorizationList(String objName,boolean fromAutl) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException - { - CommandCall fromAUTL=new CommandCall(as400_); - String cmd; - if (fromAutl) - { - cmd = "CHGAUT" - +" OBJ("+expandQuotes0(objName)+")" // @B3c @B4c - +" USER(*PUBLIC)" - +" DTAAUT(*AUTL)" - +" OBJAUT(*NONE)"; - } - else - { - cmd = "CHGAUT" - +" OBJ("+expandQuotes0(objName)+")" // @B3c @B4c - +" USER(*PUBLIC)" - +" DTAAUT(*EXCLUDE)" - +" OBJAUT(*NONE)"; - } - if (!followSymbolicLinks_) - { - cmd += " SYMLNK(*YES)"; - } - fromAUTL.setCommand(cmd); -// fromAUTL.setThreadSafe(true); //@A2A - if (fromAUTL.run()!=true) - { - AS400Message[] msgList = fromAUTL.getMessageList(); - throw new AS400Exception(msgList); - } - return; - } - - /** - * Sets the sensitivity level of the object. - * @param objName The object that the sensitivity level will be set to. - * @param sensitivityLevel The Sensitivity level that will be set. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception PropertyVetoException If the change is vetoed. - * @exception ServerStartupException If the server cannot be started. - * @exception UnknownHostException If the server cannot be located. - * - **/ - public synchronized void setSensitivity(String objName,int sensitivityLevel) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ServerStartupException, - UnknownHostException, - PropertyVetoException - { - return; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/PoolConnectionEventListener.java b/cvsroot/src/com/ibm/as400/access/PoolConnectionEventListener.java deleted file mode 100644 index 6ab6549cf..000000000 --- a/cvsroot/src/com/ibm/as400/access/PoolConnectionEventListener.java +++ /dev/null @@ -1,119 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PoolConnectionEventListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.*; -import javax.sql.ConnectionEvent; // JDBC std-ext -import javax.sql.ConnectionEventListener; // JDBC std-ext - -/** -* PoolConnectionEventListener to manage the closing of pooled connections to return -* them to the pool for reuse. -**/ -class PoolConnectionEventListener implements ConnectionEventListener -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - private transient AS400JDBCConnectionPool pool_; - - /** - * Constructs a default PoolConnectionEventListener. - **/ - public PoolConnectionEventListener(AS400JDBCConnectionPool pool) - { - pool_ = pool; - } - - /** - * Removes the pooled connection from the pool in the event that a connection error occurs - * making the connection unusable. - * @param event The ConnectionEvent object. - **/ - public void connectionErrorOccurred(ConnectionEvent event) - { - JDTrace.logInformation (this, "PooledConnection is in error..."); // @B5C - pool_.closePooledConnection( (AS400JDBCPooledConnection)event.getSource() ); - } - - /** - * Returns the pooled connection to the available pool for reuse. - * Note: called from the ConnectionHandle.close(). - * @param event The ConnectionEvent object. - **/ - public void connectionClosed(ConnectionEvent event) - { - AS400JDBCPooledConnection connection = (AS400JDBCPooledConnection)event.getSource(); - - synchronized (pool_.activePool_) - { - pool_.activePool_.removeElement(connection); // Update the pools. - } - - // Determine if connection has expired. - if ((pool_.getMaxLifetime() != -1 && connection.getLifeSpan() > pool_.getMaxLifetime()) || // Max lifetime exceeded. - (pool_.getMaxUseCount() != -1 && connection.getUseCount() == pool_.getMaxUseCount()) || // Max Use Count. - (pool_.getMaxConnections() != -1 && pool_.activePool_.size() > pool_.getMaxConnections())) // MaxConnections reduced. - { - JDTrace.logInformation (this, "Connection has expired. Removed from the pool."); // @B5C - pool_.closePooledConnection(connection); - - // Notify listeners that the connection expired - if (pool_.poolListeners_ != null) - { - ConnectionPoolEvent poolEvent = new ConnectionPoolEvent(connection, ConnectionPoolEvent.CONNECTION_EXPIRED); //@A5C - pool_.poolListeners_.fireConnectionExpiredEvent(poolEvent); - } - } - else - { - if (JDTrace.isTraceOn()) // @B5C - JDTrace.logInformation (this, "Returning active connection to the pool."); // @B5C - - // Add a check to see if the connection is still good - AS400JDBCConnection jdbcConnection = connection.getInternalConnection(); //@B4A - try - { //@B4A - if (!jdbcConnection.isClosed()) //@B4A - { - synchronized (pool_.availablePool_) - { - pool_.availablePool_.addElement(connection); // connection still good, reuse. - } - - // Notify listeners that a connection was returned. - if (pool_.poolListeners_ != null) - { - ConnectionPoolEvent poolEvent = new ConnectionPoolEvent(connection, ConnectionPoolEvent.CONNECTION_RETURNED); //@A5C - pool_.poolListeners_.fireConnectionReturnedEvent(poolEvent); - } - } - else - { //@B4A - if (JDTrace.isTraceOn()) //@B4A @B5C - JDTrace.logInformation (this, "Removing closed connection from pool."); //@B4A @B5C - } - } - catch (SQLException sqe) - { - // Should not be thrown. isClosed() reports that it throws SQLExceptions, - // but it doesn't really. - } - } - - // periodic cleanup for single-threaded mode. - if (!pool_.isThreadUsed() && pool_.isRunMaintenance() && System.currentTimeMillis() - pool_.lastSingleThreadRun_ > pool_.getCleanupInterval()) - pool_.cleanupConnections(); - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/PoolInformationFormat.java b/cvsroot/src/com/ibm/as400/access/PoolInformationFormat.java deleted file mode 100644 index 76c357a0a..000000000 --- a/cvsroot/src/com/ibm/as400/access/PoolInformationFormat.java +++ /dev/null @@ -1,60 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PoolInformationFormat.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * This class defines the format for the repeated pool - * information portion of the SSTS0300 format on the - * QWCRSSTS API. -**/ -class PoolInformationFormat extends RecordFormat -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - protected AS400Bin4 bin4; - protected AS400Text text10; - - - PoolInformationFormat(AS400 sys) - { - super(); - bin4 = new AS400Bin4(); - text10 = new AS400Text(10, sys.getCcsid(), sys); - - addFieldDescription(new BinaryFieldDescription(bin4, "poolIdentifier")); // system-related pool ID - addFieldDescription(new BinaryFieldDescription(bin4, "poolSize")); - // The amount of main storage, in kilobytes, allocated to the pool. - // Note that this may be less than the requested ("defined") size. - addFieldDescription(new BinaryFieldDescription(bin4, "reservedSize")); - addFieldDescription(new BinaryFieldDescription(bin4, "activityLevel")); // maximum active threads - addFieldDescription(new BinaryFieldDescription(bin4, "databaseFaults")); - addFieldDescription(new BinaryFieldDescription(bin4, "databasePages")); - addFieldDescription(new BinaryFieldDescription(bin4, "nonDatabaseFaults")); - addFieldDescription(new BinaryFieldDescription(bin4, "nonDatabasePages")); - addFieldDescription(new BinaryFieldDescription(bin4, "activeToWait")); - addFieldDescription(new BinaryFieldDescription(bin4, "waitToIneligible")); - addFieldDescription(new BinaryFieldDescription(bin4, "activeToIneligible")); - addFieldDescription(new CharacterFieldDescription(text10, "poolName")); // in the case of private (subsystem) pools, this will be a number (1-10) - addFieldDescription(new CharacterFieldDescription(text10, "subsystemName")); - addFieldDescription(new CharacterFieldDescription(text10, "subsystemLibraryName")); - addFieldDescription(new CharacterFieldDescription(text10, "pagingOption")); - } -} - - diff --git a/cvsroot/src/com/ibm/as400/access/PoolInformationFormat0400.java b/cvsroot/src/com/ibm/as400/access/PoolInformationFormat0400.java deleted file mode 100644 index 97333dbda..000000000 --- a/cvsroot/src/com/ibm/as400/access/PoolInformationFormat0400.java +++ /dev/null @@ -1,61 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PoolInformationFormat0400.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * This class defines the format for the repeated pool - * information portion of the SSTS0400 format on the - * QWCRSSTS API. -**/ -class PoolInformationFormat0400 extends PoolInformationFormat -{ - private static final String copyright = "Copyright (C) 2007-2007 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - PoolInformationFormat0400(AS400 sys) - { - super(sys); - AS400Text text1 = new AS400Text( 1, sys.getCcsid(), sys); - AS400Text text50 = new AS400Text(50, sys.getCcsid(), sys); - - // Note that this class extends class PoolInformationFormat, which represents - // the SSTS0300 format. The SSTS0400 format contains the same fields as SSTS0300, - // in addition to the following fields. - - addFieldDescription(new BinaryFieldDescription(bin4, "definedSize")); - // The size of the pool, in kilobytes, as defined in the shared pool, subsystem description, or system value QMCHPOOL. -1 will be returned for pools without a defined size. - addFieldDescription(new BinaryFieldDescription(bin4, "currentThreads")); - addFieldDescription(new BinaryFieldDescription(bin4, "currentIneligibleThreads")); - addFieldDescription(new BinaryFieldDescription(bin4, "tuningPriority")); - addFieldDescription(new BinaryFieldDescription(bin4, "tuningMinimumPoolSizePercentage")); - addFieldDescription(new BinaryFieldDescription(bin4, "tuningMaximumPoolSizePercentage")); - addFieldDescription(new BinaryFieldDescription(bin4, "tuningMinimumFaults")); - addFieldDescription(new BinaryFieldDescription(bin4, "tuningPerThreadFaults")); - addFieldDescription(new BinaryFieldDescription(bin4, "tuningMaximumFaults")); - addFieldDescription(new CharacterFieldDescription(text50, "description")); - addFieldDescription(new CharacterFieldDescription(text1, "status")); - addFieldDescription(new CharacterFieldDescription(text1, "reserved")); - addFieldDescription(new BinaryFieldDescription(bin4, "tuningMinimumActivityLevel")); - addFieldDescription(new BinaryFieldDescription(bin4, "tuningMaximumActivityLevel")); - - } -} - - diff --git a/cvsroot/src/com/ibm/as400/access/PoolItem.java b/cvsroot/src/com/ibm/as400/access/PoolItem.java deleted file mode 100644 index 62df383f4..000000000 --- a/cvsroot/src/com/ibm/as400/access/PoolItem.java +++ /dev/null @@ -1,247 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PoolItem.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @C1 - 2008-06-06 - Added support for ProfileTokenCredential authentication -// by using AS400ConnectionPoolAuthentication class. -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import com.ibm.as400.security.auth.ProfileTokenCredential; -import com.ibm.as400.access.AS400SecurityException; //@B4A -import java.beans.PropertyVetoException; -import java.io.IOException; //@B4A -import java.util.Locale; //@B2A - -/** - * Manages a particular connection to a system. The pool item is used to - * keep track of how long a connection has existed, when it was last used, and how - * long it has been inactive. - **/ -class PoolItem -{ - private AS400 AS400object_; // never null after object is constructed - private PoolItemProperties properties_; - private Locale locale_ = null; //@C1C - //private String locale_ = ""; //@B2A what locale was used to create the AS400 object - - /** - * - * Construct a PoolItem object using a system name and a user ID passed as - * parameters. - * - * @param systemName The name of the system where the PoolItem should exist. - * @param userID The name of the user. - * @param password The password of the user. - * @param secure Whether the AS400 connection should be a secure connection. - * @param locale The locale of the AS400 object being created. - * @param service The service to connect to. - * @param connect Whether to connect to the service number. - * @param threadUse Whether threads should be used to connect to the server. - * @param socketProperties The socket properties to assign to the new AS400 object. - * If null, this parameter is ignored. - * @param ccsid The CCSID to use for the new connection. - * - **/ - PoolItem(String systemName, String userID, AS400ConnectionPoolAuthentication poolAuth, boolean secure, Locale locale, //@C1C - int service, boolean connect, boolean threadUse, SocketProperties socketProperties, int ccsid) //@B4C - throws AS400SecurityException, IOException //@B4A - { - String password = null; //@C1A - if (poolAuth.getAuthenticationScheme() == AS400.AUTHENTICATION_SCHEME_PROFILE_TOKEN) //@C1A - { - ProfileTokenCredential profileToken = poolAuth.getProfileToken(); //@C1A - if (secure) //@C1A - { - AS400object_ = new SecureAS400(systemName, profileToken); //@C1A - } - else - { - AS400object_ = new AS400(systemName, profileToken); //@C1A - } - } - else // AS400.AUTHENTICATION_SCHEME_PASSWORD - { - password = poolAuth.getPassword(); //@C1A - if (secure) - { - if (password==null) //Stevers - { - if (userID.equals("*CURRENT")) //Stevers - AS400object_ = new SecureAS400(systemName); //Stevers - else //Stevers - AS400object_ = new SecureAS400(systemName, userID); //Stevers - } - else //Stevers - AS400object_ = new SecureAS400(systemName, userID, password); //@B4C - } - else - { - if (password==null) //Stevers - { - if (userID.equals("*CURRENT")) //Stevers - AS400object_ = new AS400(systemName); //Stevers - else //Stevers - AS400object_ = new AS400(systemName, userID); //Stevers - } - else //Stevers - AS400object_ = new AS400(systemName, userID, password); //@B4C - } - } - - - if (locale != null) //@B2A - { - //@B2A - AS400object_.setLocale(locale); //@B2A - locale_ = locale; //@B2A @C1C - } //@B2A - else //@B2A - locale_ = null; //@B2A @C1C - - properties_ = new PoolItemProperties(); - try - { - if ((poolAuth.getAuthenticationScheme() == AS400.AUTHENTICATION_SCHEME_PASSWORD) && (password!=null)) //Stevers //@C1C - { - AS400object_.setGuiAvailable(false); - } - if (!threadUse) //@B4A - { - AS400object_.setThreadUsed(false); //@B4A - } //@B4A - if (socketProperties != null) - { - AS400object_.setSocketProperties(socketProperties); - } - if (ccsid != ConnectionPoolProperties.CCSID_DEFAULT) - { - AS400object_.setCcsid(ccsid); - } - if (connect) //@B4A - { - AS400object_.connectService(service); //@B4A - } //@B4A - else //@B4A - { // validate the connection - AS400object_.connectService(AS400.SIGNON); //@B4A - AS400object_.disconnectService(AS400.SIGNON); //@B4A - } //@B4A - } - catch (PropertyVetoException e) // this should never happen - { - Trace.log(Trace.ERROR, e); //Ignore - } - } - - - /** - * Returns the AS400 contained in the pool item. - * @return The AS400 object. Never returns null. - **/ - AS400 getAS400Object() - { - return AS400object_; - } - - /** - * Returns the elapsed time the connection has been idle waiting in the pool. - * @return The idle time (milliseconds). - * If the connection is currently in use, 0 is returned. - **/ - long getInactivityTime() - { - return properties_.getInactivityTime(); - } - - - /** - * Returns the elapsed time the connection has been in use - * since it was most recently allocated from the pool. - * @return The elapsed time (milliseconds). - * If the connection is not currently in use, 0 is returned. - **/ - long getInUseTime() - { - return properties_.getInUseTime(); - } - - - /** - * Returns the elapsed time the pooled connection has been alive. - * @return The elapsed time (milliseconds). - **/ - long getLifeSpan() - { - return properties_.getLifeSpan(); - } - - - //@B2A - /** - * Returns the locale of the AS400 object. - * @return The locale of the AS400 object, null if none was used at connection time. - **/ - Locale getLocale() //@C1C (Previously returned a String representation of Locale) - { - return locale_; - } - - - /** - * Returns the number of times the pooled connection has been used. - * @return The number of times used. - **/ - int getUseCount() - { - return properties_.getUseCount(); - } - - - /** - * Indicates if the connection has failed a pretest validity check. - * @return true if the connection has failed a pretest; false otherwise. - **/ - boolean isFailedPretest() - { - return properties_.isFailedPretest(); - } - - - /** - * Indicates if the pooled connection is in use. - * @return true if the pooled connection is in use; false otherwise. - **/ - boolean isInUse() - { - return properties_.isInUse(); - } - - - /** - * Records that the connection has failed a pretest validity check. - **/ - void setFailedPretest() - { - properties_.setFailedPretest(); - } - - - /** - * Sets the connection timer values based on the active usage state of the connection. - * @param inUse true if the connection is currently active; false otherwise. - **/ - void setInUse(boolean inUse) - { - properties_.setInUse(inUse); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/PoolItemProperties.java b/cvsroot/src/com/ibm/as400/access/PoolItemProperties.java deleted file mode 100644 index 0b1bfecb6..000000000 --- a/cvsroot/src/com/ibm/as400/access/PoolItemProperties.java +++ /dev/null @@ -1,152 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PoolItemProperties.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class PoolItemProperties -{ - private long creationTime_ = 0; // Time when this connection was created. - private long lastUseTime_ = 0; // Time when this connection became in-use. - private long timeIdleInPool_ = 0; // Time when this connection became available. - private int timesUsedCount_ = 0; // Number of times connection has been assigned. - private boolean isFailedPretest_ = false; // Whether the connection has failed a validity pretest. - - /** - * Constructs a default PoolItemProperties object. - **/ - public PoolItemProperties() - { - // Initialize the timers. - creationTime_ = System.currentTimeMillis(); - timeIdleInPool_ = creationTime_; - } - - /** - * Clears the timers and counters. Called by AS400JDBCPooledConnection.close(). - **/ - public void clear() - { - creationTime_ = 0; - timeIdleInPool_ = 0; - lastUseTime_ = 0; - timesUsedCount_ = 0; - } - - /** - * Returns the time elapsed. - * @param startTime The starting time. - * @return The time elapsed (milliseconds). - * If a value of 0 is specified for startTime, 0 is returned. - **/ - private long getElapsedTime(long startTime) - { - if (startTime == 0) - return 0; - else - return System.currentTimeMillis() - startTime; - } - - /** - * Returns the elapsed time that the connection has been idle waiting in the pool. - * @return The idle time (milliseconds). - * If the connection is currently in use, 0 is returned. - **/ - public long getInactivityTime() - { - return getElapsedTime(timeIdleInPool_); - } - - /** - * Returns the elapsed time since the connection was assigned. - * @return The elapsed time (milliseconds). - * If the connection is not currently in use, 0 is returned. - **/ - public long getInUseTime() - { - if (isInUse()) - return getElapsedTime(lastUseTime_); - else - return 0; - - } - - /** - * Returns the elapsed time that the pooled connection has been alive. - * @return The elapsed time (milliseconds). - **/ - public long getLifeSpan() - { - return getElapsedTime(creationTime_); - } - - /** - * Returns the number of times the pooled connection has been assigned. - * @return The number of times used. - **/ - public int getUseCount() - { - return timesUsedCount_; - } - - - /** - * Indicates if the connection has failed a pretest validity check. - * @return true if the connection has failed a pretest; false otherwise. - **/ - boolean isFailedPretest() - { - return isFailedPretest_; - } - - /** - * Indicates if the pooled connection is currently assigned. - * @return true if the pooled connection is in use; false otherwise. - **/ - synchronized public boolean isInUse() - { - if (lastUseTime_ == 0) - return false; - else - return true; - } - - - /** - * Records that the connection has failed a pretest validity check. - **/ - void setFailedPretest() - { - isFailedPretest_ = true; - } - - - /** - * Sets the connection timer values based on the active usage state of the connection. - * @param inUse true if the connection is currently active; false otherwise. - **/ - synchronized void setInUse(boolean inUse) - { - if (inUse) - { - timeIdleInPool_ = 0; //@B1A // reset the idle timer - lastUseTime_ = System.currentTimeMillis(); // set the active start time. - timesUsedCount_++; - } - else - { - timeIdleInPool_ = System.currentTimeMillis(); // start the idle timer. - lastUseTime_ = 0; // no longer being used. - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/PoolMaintenance.java b/cvsroot/src/com/ibm/as400/access/PoolMaintenance.java deleted file mode 100644 index d7959a867..000000000 --- a/cvsroot/src/com/ibm/as400/access/PoolMaintenance.java +++ /dev/null @@ -1,148 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PoolMaintenance.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** -* Periodically cleans up pooled connections that have expired. -**/ -class PoolMaintenance extends Thread -{ - private boolean run_ = false; // Whether the maintenance is running. - private boolean stayAlive_ = true; // Whether thread should stay alive. - private transient long lastRun_; // Last time maintenance was run. - private transient ConnectionPool pool_; - private final Object waitLock_ = new Object(); - - /** - * Constructs a AS400JDBCConnectionPoolMaintenance object. - * @param pool The AS400JDBCConnectionPool object. - **/ - public PoolMaintenance(ConnectionPool pool) - { - super("AS400ConnectionPoolMaintenanceThread"); - setDaemon(true); - pool_ = pool; - lastRun_ = System.currentTimeMillis(); // Set start time. - } - - /** - * Returns the last time the maintenance was run. - * @return The time in milliseconds. - **/ - public long getLastTime() - { - return lastRun_; - } - - /** - * Indicates whether the maintenance thread is running. - * @return true if running; false otherwise. - **/ - public boolean isRunning() - { - return run_; - } - - /** - * Runs the pool maintenance cleanup thread. - **/ - public void run() - { - if (Trace.traceOn_) - { - Trace.log(Trace.INFORMATION, "Connection pool maintenance daemon is started..."); - } - run_ = true; - - try - { - while (stayAlive_) - { - if (run_) - { - try - { - // sleep for cleanup interval. - synchronized(waitLock_) - { - waitLock_.wait(pool_.getCleanupInterval()); - } - } - catch (InterruptedException ie) - { - Trace.log(Trace.ERROR, "Connection pool maintenance daemon failed."); - } - pool_.cleanupConnections(); - - lastRun_ = System.currentTimeMillis(); // set the time of last run. - } - else - { - try - { - // sleep until someone notifies me to continue. - synchronized(waitLock_) - { - waitLock_.wait(); - } - } - catch (InterruptedException e) - { - Trace.log(Trace.ERROR, "Connection pool maintenance daemon failed."); - } - } - } - } - finally - { - if (Trace.traceOn_) - { - Trace.log(Trace.INFORMATION, "Connection pool maintenance daemon has ended."); - } - } - } - - /** - * Sets whether the maintenance thread is running. - * Note: Calling this method with 'false' does not terminate the maintenance thread. - * To terminate the thread, call shutdown(). - * @param running true if running; false otherwise. - **/ - public void setRunning(boolean running) - { - if (run_ != running) - { - synchronized(waitLock_) - { - run_ = running; - waitLock_.notify(); - } - } - } - - /** - * Informs the maintenance thread that it should terminate. - **/ - public void shutdown() - { - run_ = false; - stayAlive_ = false; - synchronized(waitLock_) - { - waitLock_.notify(); - } - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/PortMapper.java b/cvsroot/src/com/ibm/as400/access/PortMapper.java deleted file mode 100644 index 5b826d089..000000000 --- a/cvsroot/src/com/ibm/as400/access/PortMapper.java +++ /dev/null @@ -1,381 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PortMapper.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1998-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.InetAddress; -import java.net.NoRouteToHostException; -import java.net.Socket; -import java.net.SocketAddress; -import java.net.SocketException; -import java.util.Hashtable; -import java.net.InetSocketAddress; - -class PortMapper -{ - private PortMapper() - { - } - - private static Hashtable systemList = new Hashtable(); - - static void setServicePortsToDefault(String systemName) - { - int[] newPortList = - { - 8473, // 0 File. - 8474, // 1 Print. - 8475, // 2 Command. - 8472, // 3 Data Queue. - 8471, // 4 Database. - 446, // 5 Record Level Access. - 8470, // 6 Central. - 8476, // 7 Sign-on. - 9473, // 8 Secure File. - 9474, // 9 Secure Print. - 9475, // 10 Secure Command. - 9472, // 11 Secure Data Queue. - 9471, // 12 Secure Database. - 448, // 13 Secure Record Level Access. - 9470, // 14 Secure Central. - 9476 // 15 Secure Sign-on. - }; - systemList.put(systemName, newPortList); - } - - static void setServicePort(String systemName, int service, int port, SSLOptions useSSL) - { - if (useSSL != null && useSSL.proxyEncryptionMode_ != SecureAS400.CLIENT_TO_PROXY_SERVER) service += 8; - int[] portList = (int[])systemList.get(systemName); - if (portList == null) - { - int[] newPortList = - { - AS400.USE_PORT_MAPPER, // 0 File. - AS400.USE_PORT_MAPPER, // 1 Print. - AS400.USE_PORT_MAPPER, // 2 Command. - AS400.USE_PORT_MAPPER, // 3 Data Queue. - AS400.USE_PORT_MAPPER, // 4 Database. - 446, // 5 Record Level Access. - AS400.USE_PORT_MAPPER, // 6 Central. - AS400.USE_PORT_MAPPER, // 7 Sign-on. - AS400.USE_PORT_MAPPER, // 8 Secure File. - AS400.USE_PORT_MAPPER, // 9 Secure Print. - AS400.USE_PORT_MAPPER, // 10 Secure Command. - AS400.USE_PORT_MAPPER, // 11 Secure Data Queue. - AS400.USE_PORT_MAPPER, // 12 Secure Database. - 448, // 13 Secure Record Level Access. - AS400.USE_PORT_MAPPER, // 14 Secure Central. - AS400.USE_PORT_MAPPER // 15 Secure Sign-on. - }; - newPortList[service] = port; - systemList.put(systemName, newPortList); - } - else - { - portList[service] = port; - } - } - - static int getServicePort(String systemName, int service, SSLOptions useSSL) - { - if (useSSL != null && useSSL.proxyEncryptionMode_ != SecureAS400.CLIENT_TO_PROXY_SERVER) service += 8; - int[] portList = (int[])systemList.get(systemName); - if (portList == null) - { - if (service == AS400.RECORDACCESS) - { - return 446; - } - if (service == AS400.RECORDACCESS + 8) - { - return 448; - } - return AS400.USE_PORT_MAPPER; - } - return portList[service]; - } - - static boolean unixSocketAvailable = true; - - private static boolean canUseUnixSocket(String systemName, int service, boolean mustUseNetSockets) - { - if (AS400.onAS400 && unixSocketAvailable && !mustUseNetSockets && service != AS400.FILE && (systemName.equalsIgnoreCase("localhost") || systemName.equalsIgnoreCase("ipv6-localhost"))) - { - if (service == AS400.DATABASE && AS400.nativeVRM.vrm_ < 0x00060100) return false; - return true; - } - return false; - } - - static SocketContainer getServerSocket(String systemName, int service, SSLOptions useSSL, SocketProperties socketProperties, boolean mustUseNetSockets) throws IOException - { - SocketContainer sc = null; - String serviceName = AS400.getServerName(service); - // If we're running on a native vm, we're requesting a service that supports a unix domain socket connection, and the unix domain socket code is accessable. - if (canUseUnixSocket(systemName, service, mustUseNetSockets)) - { - try - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Starting a local socket to " + serviceName); - sc = AS400.nativeVRM.vrm_ < 0x00050400 ? (SocketContainer)AS400.loadImpl("com.ibm.as400.access.SocketContainerUnix") : (SocketContainer)AS400.loadImpl("com.ibm.as400.access.SocketContainerUnix2"); - if (sc != null) - { - sc.setProperties(null, serviceName, null, 0, null); - return sc; - } - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Error attempting to connect with Unix Socket:", e); - sc = null; - } - // Only try for Unix domain connection once. - unixSocketAvailable = false; - } - - int srvPort = PortMapper.getServicePort(systemName, service, useSSL); - if (srvPort == AS400.USE_PORT_MAPPER) - { - // Establish a socket connection to the "port mapper" through port 449... - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Connecting to port mapper..."); - - //Code to make use of new method java.net.Socket.connect(host, timeout) in jdk 1.4 - //only really needed on first socket connect so we do not hang when a system is down. - //Socket pmSocket = new Socket(systemName, 449); //@timeout - Socket pmSocket = getSocketConnection(systemName, 449, socketProperties); //@timeout2 - - InputStream pmInstream = pmSocket.getInputStream(); - OutputStream pmOutstream = pmSocket.getOutputStream(); - - // Now we construct and send a "port map" request to get the port number for the requested service... - String fullServiceName = (useSSL != null && useSSL.proxyEncryptionMode_ != SecureAS400.CLIENT_TO_PROXY_SERVER) ? serviceName + "-s" : serviceName; - AS400PortMapDS pmreq = new AS400PortMapDS(fullServiceName); - if (Trace.traceOn_) pmreq.setConnectionID(pmSocket.hashCode()); - pmreq.write(pmOutstream); - - // Now we get the response and close the socket connection to the port mapper... - AS400PortMapReplyDS pmresp = new AS400PortMapReplyDS(); - if (Trace.traceOn_) pmresp.setConnectionID(pmSocket.hashCode()); - pmresp.read(pmInstream); - pmSocket.close(); - - try - { - srvPort = pmresp.getPort(); - } - catch (ServerStartupException e) - { - Trace.log(Trace.ERROR, "Failed to map a port for " + fullServiceName, e); - throw e; - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding entry to Service Port table: system " + systemName + ", service " + fullServiceName + ", port " + srvPort); - PortMapper.setServicePort(systemName, service, srvPort, useSSL); - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Opening socket to system..."); - Socket socket = getSocketConnection(systemName, srvPort, socketProperties); //@timeout2 - PortMapper.setSocketProperties(socket, socketProperties); - - // We use the port returned in the previous reply to establish a new socket connection to the requested service... - if (useSSL != null && useSSL.proxyEncryptionMode_ != SecureAS400.CLIENT_TO_PROXY_SERVER) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Starting a secure socket to " + serviceName); - try - { - if (useSSL.useSslight_) throw new Exception(); - sc = (SocketContainer)AS400.loadImpl("com.ibm.as400.access.SocketContainerJSSE"); - sc.setProperties(socket, null, systemName, srvPort, null); - } - catch (Throwable e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Exception using JSSE; falling back to SSLight:", e); - sc = (SocketContainer)AS400.loadImpl("com.ibm.as400.access.SocketContainerSSL"); - try { sc.setProperties(socket, null, null, 0, useSSL); } - catch (NoClassDefFoundError e1) - { - Trace.log(Trace.ERROR, "SSLight classes are not found on classpath.", e1); - throw e1; - } - - } - } - else - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Starting an inet socket to " + serviceName); - sc = (SocketContainer)AS400.loadImpl("com.ibm.as400.access.SocketContainerInet"); - sc.setProperties(socket, null, null, 0, null); - } - return sc; - } - - /* Helper method to get connection using the timeout available in jmv 1.4+ - * If running in JVM 1.3 then it defaults to the old connection without a timeout - */ - static Socket getSocketConnection(String systemName, int port, SocketProperties socketProperties) throws IOException - { - //Code to make use of new method java.net.Socket.connect(host, timeout) in jdk 1.4 - //only really needed on first socket connect so we do not hang when a system is down. - //Socket pmSocket = new Socket(systemName, port); - Socket pmSocket = null; - try - { - /* Due to various jvm and compile issues, there are many possible types of exceptions that could - be thrown, depending on jvm version and implementation etc. Class.forName() seems to be the best - solution to finding the jvm version that does not degrade performance. */ - Class.forName("java.net.InetSocketAddress"); //throws ClassNotFoundException (common to all jvm implementations) - - pmSocket = new Socket(); - - int loginTimeout = 0; - if(socketProperties.isLoginTimeoutSet()) - { - loginTimeout = socketProperties.getLoginTimeout(); - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Connect to port mapper: system '"+systemName+"', port " +port+ ", login timeout " + loginTimeout + " ms."); - - InetSocketAddress hostAddr = systemName != null ? new InetSocketAddress(systemName, port) : - new InetSocketAddress(InetAddress.getByName(null), port); - - //pmSocket.connect(hostAddr, timeout); //fyi, PortMapper will not load and gets NoClassDefFoundError in jvm1.3 due to SocketAddress parameter type, must use reflection below - boolean done = false; - while (!done) // up to two tries - { - try - { - Class thisClass = pmSocket.getClass(); - Method method = thisClass.getMethod("connect", new Class[]{ SocketAddress.class, java.lang.Integer.TYPE}); - //method.setAccessible(true); //@CRS (applet gets exception when calling setAccessible()) - Object args[] = new Object[2]; - args[0] = hostAddr; - args[1] = new Integer(loginTimeout); - - method.invoke(pmSocket, args); - done = true; // if no exception thrown, then no need to try again - } - catch (InvocationTargetException e) { - Trace.log(Trace.ERROR, e); - Throwable e2 = e.getTargetException(); - if (e2 != null) Trace.log(Trace.ERROR, e2); - if(e2 instanceof IOException) - { - //Here is the actual timeout or network exceptions that we throw back to caller - throw (IOException) e2; - } - else - { - //Else this is some sort of issue related to reflection not being supported. Just throw ClassNotFoundException and catch it below. - throw new ClassNotFoundException(); - } - } - catch (IllegalAccessException e) { - //Else this is some sort of issue related to reflection not being supported. Just throw ClassNotFoundException and catch it below. - Trace.log(Trace.ERROR, e); - throw new ClassNotFoundException(); - } - catch (NoSuchMethodException e) { - //Else this is some sort of issue related to reflection not being supported. Just throw ClassNotFoundException and catch it below. - Trace.log(Trace.ERROR, e); - throw new ClassNotFoundException(); - } - catch (Exception e) { // compiler won't let us catch "IOException" - if (e instanceof NoRouteToHostException) - { - // If we previously specified "localhost", retry with "ipv6-localhost". - if ("localhost".equalsIgnoreCase(hostAddr.getHostName())) - { - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, e.getMessage()); - Trace.log(Trace.DIAGNOSTIC, "Retrying with hostname 'ipv6-localhost' instead of 'localhost'."); - } - hostAddr = new InetSocketAddress("ipv6-localhost", port); - done = false; // iterate the loop - } - else throw (NoRouteToHostException)e; // don't retry - } - else if (e instanceof IOException) throw (IOException)e; - else throw new RuntimeException(e); // should never happen - } - } // while - } // outer try - catch(ClassNotFoundException e){ - //Here we catch any exception related to running in jdk 1.3 or reflection exceptions - //Just create socket the way we did before without a timeout. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Connect to port mapper: system '"+systemName+"', port " +port+ ", no login timeout (JVM 1.3 or lower)."); - pmSocket = new Socket(systemName, port); //for pre jdk1.4 - } - return pmSocket; - } - - static void setSocketProperties(Socket socket, SocketProperties socketProperties) throws SocketException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting socket options..."); - if (socketProperties.keepAliveSet_) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting keep alive:", socketProperties.keepAlive_); - socket.setKeepAlive(socketProperties.keepAlive_); - } - - if (socketProperties.receiveBufferSizeSet_) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting receive buffer size:", socketProperties.receiveBufferSize_); - socket.setReceiveBufferSize(socketProperties.receiveBufferSize_); - } - - if (socketProperties.sendBufferSizeSet_) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting send buffer size:", socketProperties.sendBufferSize_); - socket.setSendBufferSize(socketProperties.sendBufferSize_); - } - - if (socketProperties.soLingerSet_) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting so linger:", socketProperties.soLinger_); - socket.setSoLinger(true, socketProperties.soLinger_); - } - - if (socketProperties.soTimeoutSet_) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting so timeout:", socketProperties.soTimeout_); - socket.setSoTimeout(socketProperties.soTimeout_); - } - - if (socketProperties.tcpNoDelaySet_) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting TCP no delay:", socketProperties.tcpNoDelay_); - socket.setTcpNoDelay(socketProperties.tcpNoDelay_); - } - - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "Socket properties:"); - try { Trace.log(Trace.DIAGNOSTIC, " Remote address: " + socket.getInetAddress()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " Remote port:", socket.getPort()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " Local address: " + socket.getLocalAddress()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " Local port:", socket.getLocalPort()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " Keep alive:", socket.getKeepAlive()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " Receive buffer size:", socket.getReceiveBufferSize()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " Send buffer size:", socket.getSendBufferSize()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " So linger:", socket.getSoLinger()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " So timeout:", socket.getSoTimeout()); } catch (Throwable t) {} - try { Trace.log(Trace.DIAGNOSTIC, " TCP no delay:", socket.getTcpNoDelay()); } catch (Throwable t) {} - } - } - } diff --git a/cvsroot/src/com/ibm/as400/access/PrintObject.java b/cvsroot/src/com/ibm/as400/access/PrintObject.java deleted file mode 100644 index 8d6b87a38..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintObject.java +++ /dev/null @@ -1,1589 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintObject.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.beans.PropertyVetoException; - -/** - * The PrintObject class is an - * abstract base class for the various types of network print objects. - **/ - -abstract public class PrintObject implements java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2005 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - // Attribute IDs used by network print objects - /** 3812 SCS (fonts). **/ - public static final int ATTR_3812SCS = 0x011F; // AT_3812SCS - /** Accounting code. **/ - public static final int ATTR_ACCOUNT_CODE = 0x0109; // AT_ACCOUNT_CODE - /** ACIF processing". **/ - static final int ATTR_ACIF = 0x013B; // AT_ACIF - /** Advanced function printing. **/ - public static final int ATTR_AFP = 0x000A; // AT_AFP - /** AFP resource integrated file system name. **/ - public static final int ATTR_AFP_RESOURCE = -12; - // NOTE: The above attribute is created by the toolbox code using the following 3 attributes - /** Resource library name. **/ - static final int ATTR_RSCLIB = 0x00AE; // Resource library - /** Resource name. **/ - static final int ATTR_RSCNAME = 0x00AF; // Resource name - /** Resource object type. **/ - static final int ATTR_RSCTYPE = 0x00B0; // Resource object type /** Advanced function printing (AFP) resource. **/ - // NOTE!!!: This attribute is the same as ATTR_AFP. It is being left for compatibility. - public static final int ATTR_AFPRESOURCE = 0x011A; // AT_AFP_RESOURCE - /** ASCII transparency. **/ - public static final int ATTR_ASCIITRANS = 0x0128; // AT_ASCII_TRANS - /** Auxilary storage pool. **/ - public static final int ATTR_AUX_POOL = 0x00FC; // AT_AUX_POOL - /** Character ID. **/ - public static final int ATTR_CHARID = 0x012C; // AT_CHAR_ID - /** DBCS character rotation commands. **/ - public static final int ATTR_CHR_RTT_CMDS = 0x013C; // AT_CHR_RTT_CMDS - /** Character set library name. **/ - public static final int ATTR_CHRSET_LIB = 0x0133; // AT_CHARSET_LIB_NAME - /** Character set name. **/ - public static final int ATTR_CHRSET = 0x0134; // AT_CHARSET_NAME - /** Character set point size. **/ - public static final int ATTR_CHRSET_SIZE = 0x0138; // AT_CHAR_POINT_SIZE - /** Coded font array. **/ - public static final int ATTR_CODFNT_ARRAY = 0x0132; // AT_CODED_FNT_ARRAY - /** OfficeVision. **/ - public static final int ATTR_OFFICEVISION = 0x0125; // AT_OFFICEVISION - /** Page groups. **/ - public static final int ATTR_PAGE_GROUPS = 0x0126; // AT_PAGE_GROUPS - /** Page level index tags. **/ - public static final int ATTR_PAGELVLIDXTAG= 0x0127; // AT_PAGE_LVL_IDX_TAG - /** Record format name present in data stream. **/ - public static final int ATTR_RCDFMT_DATA = 0x0129; // AT_RCD_FMT_IN_DATA - /** Align forms. **/ - public static final int ATTR_ALIGNFORMS = 0x00BE; // Align forms - /** Align page. **/ - public static final int ATTR_ALIGN = 0x000B; // AT_ALIGN - /** Allow direct print. **/ - public static final int ATTR_ALWDRTPRT = 0x000C; // Allow direct printing - /** Auxilliary storage pool device name. **/ - public static final int ATTR_ASPDEVICE = 0x010A; // AT_ASP_DEVICE - /** NPS Attribute default value. **/ - static final int ATTR_ATTRDEFAULT = 0x0083; // attribute default value - /** NPS Attribute high limit. **/ - static final int ATTR_ATTRMAX = 0x0084; // attribute maximum value - /** NPS Attribute ID. **/ - static final int ATTR_ATTRID = 0x0085; // attribute ID - /** NPS Attribute low limit. **/ - static final int ATTR_ATTRMIN = 0x0086; // attribute minimum value - /** NPS Attribute possible value. **/ - static final int ATTR_ATTRPOSSIBL = 0x0087; // possible value for attribute - /** NPS Attribute text description. **/ - static final int ATTR_ATTRDESCRIPT = 0x0088; // attribute description - /** NPS Attribute type. **/ - static final int ATTR_ATTRTYPE = 0x0089; // attribute type - /** Authority. **/ - public static final int ATTR_AUTHORITY = 0x000D; // Authority to users not on output queue - /** Authority to check. **/ - public static final int ATTR_AUTHCHCK = 0x000E; // AT_AUTHORITY_TO_CHECK - /** Automatically end writer. **/ - public static final int ATTR_AUTOEND = 0x0010; // automatically end writer *YES/*NO - /** Barcode. **/ - public static final int ATTR_BARCODE = 0x011B; // AT_BARCODE - /** Back overlay integrated file system name. **/ - public static final int ATTR_BACK_OVERLAY = -1; // Back overlay Integrated File System name - static final int ATTR_BKOVRLLIB = 0x0013; // AT_BACK_OVL_LIB - static final int ATTR_BKOVRLAY = 0x0014; // AT_BACK_OVL_NAME - /** Back margin offset across. **/ - public static final int ATTR_BKMGN_ACR = 0x0011; // AT_BACK_MGN_OFFSET_ACROSS - /** Back margin offset down. **/ - public static final int ATTR_BKMGN_DWN = 0x0012; // AT_BACK_MGN_OFFSET_DOWN - /** Back overlay offset across.**/ - public static final int ATTR_BKOVL_ACR = 0x0016; // AT_BACK_OVL_OFFSET_ACROSS - /** Back overlay offset down.**/ - public static final int ATTR_BKOVL_DWN = 0x0015; // AT_BACK_OVL_OFFSET_DOWN - /** Between copies status. **/ - public static final int ATTR_BTWNCPYSTS = 0x00CE; // Indicates whether the writer is between copies of multiple copy spooled file - /** Between files status. **/ - public static final int ATTR_BTWNFILESTS = 0x00CF; // Indicates whether the writer is between files - /** Changes take effect. **/ - public static final int ATTR_CHANGES = 0x00BF; // Changes take effect - /** Graphic character set. **/ - public static final int ATTR_CHAR_ID = 0x0037; // AT_CHARID_CHAR_SET (chrid) - /** Characters per inch. **/ - public static final int ATTR_CPI = 0x0017; // AT_CPI - /** Characters per inch changes. **/ - public static final int ATTR_CPI_CHANGES = 0x012D; // AT_CPI_CHANGES - /** Coded font name. **/ - public static final int ATTR_CODEDFNT = 0x001A; // AT_CODED_FONT_NAME - /** Coded font library name. **/ - public static final int ATTR_CODEDFNTLIB = 0x0018; // AT_CODED_FONT_LIB - /** Coded font point size. **/ - public static final int ATTR_CODEDFONT_SIZE = 0x0119; // AT_CODE_FONT_SIZE - /** Code page. **/ - public static final int ATTR_CODEPAGE = 0x0019; // AT_CHARID_CODE_PAGE - /** Code page name. **/ - public static final int ATTR_CODEPAGE_NAME= 0x0118; // AT_CODE_PAGE_NAME - /** Code page library name. **/ - public static final int ATTR_CODEPAGE_NAME_LIB = 0x0117; // AT_CODE_PAGE_LIB - /** Color. **/ - public static final int ATTR_COLOR = 0x011C; // AT_COLOR - /** Constant back overlay. **/ - public static final int ATTR_CONSTBCK_OVL = 0x010E; // AT_CONST_BACK_OVL - /** Control character. **/ - public static final int ATTR_CONTROLCHAR = 0x00C4; // AT_CONTROL_CHARACTER - /** Convert line data. **/ - public static final int ATTR_CONVERT_LINEDATA = 0x00F7; // AT_CONVERT_LINE_DATA - /** Copies. **/ - public static final int ATTR_COPIES = 0x001C; // AT_COPIES - /** Copies left to produce. **/ - public static final int ATTR_COPIESLEFT = 0x001D; // AT_COPIES_LEFT - /** Corner staple. **/ - public static final int ATTR_CORNER_STAPLE= 0x00F8; // AT_CORNER_STAPLE - /** Current page. **/ - public static final int ATTR_CURPAGE = 0x001E; // current page - /** Data queue integrated file system name. **/ - public static final int ATTR_DATA_QUEUE = -2; // Data queue IFS name - static final int ATTR_DATAQUELIB = 0x0020; // AT_DATA_QUEUE_LIB - static final int ATTR_DATAQUE = 0x0021; // AT_DATA_QUEUE - /** Data format.**/ - public static final int ATTR_DATAFORMAT = 0x001F; // data format - /** Date file opened (created). **/ - public static final int ATTR_DATE = 0x0022; // AT_DATE - /** Spooled file selection ending date . **/ - public static final int ATTR_DATE_END = 0x00FD; // - /** Date file last used. **/ - public static final int ATTR_DATE_USED = 0x010D; // AT_DATE_FILE_USED - /** Date writer began processing spooled file. **/ - public static final int ATTR_DATE_WTR_BEGAN_FILE = 0x00EA; // date writer began file - /** Date writer completed processing spooled filed. **/ - public static final int ATTR_DATE_WTR_CMPL_FILE = 0x00EB; // date writer finished file - /** Days until file expires. **/ - public static final int ATTR_DAYS_UNTIL_EXPIRE = 0x0140; // AT_DAYS_UNTIL_EXPIRE - /** User specified DBCS data. **/ - public static final int ATTR_DBCSDATA = 0x0099; // contains DBCS character set data - /** DBCS extension characters. **/ - public static final int ATTR_DBCSEXTENSN = 0x009A; // process DBCS extension characters - /** DBCS character rotation. **/ - public static final int ATTR_DBCSROTATE = 0x009B; // rotate DBCS characters - /** DBCS coded font name. **/ - public static final int ATTR_DBCS_FNT = 0x0113; // AT_DBCS_FONT - /** DBCS coded font library name. **/ - public static final int ATTR_DBCS_FNT_LIB = 0x0112; // AT_DBCS_FONT_LIB - /** DBCS coded font point size. **/ - public static final int ATTR_DBCS_FNT_SIZE= 0x0114; // AT_DBCS_FONT_SIZE - /** DBCS characters per inch. **/ - public static final int ATTR_DBCSCPI = 0x009C; // DBCS CPI - /** DBCS SO/SI spacing. **/ - public static final int ATTR_DBCSSISO = 0x009D; // DBCS SI/SO positioning - /** Data description specifications (DDS). **/ - public static final int ATTR_DDS = 0x011D; // AT_DDS - /** Decimal format used. **/ - public static final int ATTR_DECIMAL_FMT = 0x010C; // AT_DECIMAL_FORMAT - /** Delete file after sending. **/ - public static final int ATTR_DELETESPLF = 0x0097; // delete file after sending - /** Text description. **/ - public static final int ATTR_DESCRIPTION = 0x006D; // text description - /** Destination type. **/ - public static final int ATTR_DESTINATION = 0x0025; // destination type - /** Destination option. **/ - public static final int ATTR_DESTOPTION = 0x0098; // destinaton option sent - /** Device class. **/ - public static final int ATTR_DEVCLASS = 0x0026; // device class - /** Device model.**/ - public static final int ATTR_DEVMODEL = 0x0027; // device model - /** Device status.**/ - public static final int ATTR_DEVSTATUS = 0x00C7; // device status - /** Device type.**/ - public static final int ATTR_DEVTYPE = 0x0028; // device type - /** Display any file. **/ - public static final int ATTR_DISPLAYANY = 0x0029; // users can display any file on queue - /** Defer write. **/ - public static final int ATTR_DFR_WRITE = 0x0023; // defer write - /** Drawer for separators. **/ - public static final int ATTR_DRWRSEP = 0x002A; // drawer to use for separators - /** Double wide characters. **/ - public static final int ATTR_DOUBLEWIDE = 0x011E; // AT_DOUBLE_WIDE_CHAR - /** Drawer change. **/ - public static final int ATTR_DRAWERCHANGE = 0x012E; // AT_DRAWER_CHANGE - /** Print on both sides. **/ - public static final int ATTR_DUPLEX = 0x0055; // print on both sides of paper - /** Edge stitch reference edge. **/ - public static final int ATTR_EDGESTITCH_REF= 0x00EE; // edgestitch reference edge - /** Edge stitch number of staples. **/ - public static final int ATTR_EDGESTITCH_NUMSTAPLES= 0x00F0; // edgesticth number stapes - /** Offset from edge stitch reference edge. **/ - public static final int ATTR_EDGESTITCH_REFOFF = 0x00EF; // edgestitch reference offset - /** Edge stitch staple offset. **/ - static final int ATTR_EDGESTITCH_STPL_OFFSET_INFO = 0x00F1; // edgestitch staple offset - /** Ending page.**/ - public static final int ATTR_ENDPAGE = 0x002B; // ending page number to print - /** End pending status. **/ - public static final int ATTR_ENDPNDSTS = 0x00CC; // indicates whether an end writer command has been issued for this writer - /** Envelope source. **/ - public static final int ATTR_ENVLP_SOURCE = 0x00D3; // envelope source - /** Spooled file expiration date. **/ - public static final int ATTR_EXPIRATION_DATE= 0x0141; // Spooled file expiration date - /** Print fidelity. **/ - public static final int ATTR_FIDELITY = 0x0054; // the error handling when printing - /** Field outlining. **/ - public static final int ATTR_FIELD_OUTLIN = 0x0120; // AT_FIELD_OUTLIN - /** File separators. **/ - public static final int ATTR_FILESEP = 0x002C; // number of file separators - /** Fold records. **/ - public static final int ATTR_FOLDREC = 0x002D; // wrap text to next line - /** Font changes. **/ - public static final int ATTR_FONT_CHANGES = 0x012F; // AT_FONT_CHANGES - /** Font identifier. **/ - public static final int ATTR_FONTID = 0x002E; // Font identifier to use (default) - /** Font resolution for formatting. **/ - public static final int ATTR_FONTRESFMT = 0x010B; // AT_FONT_RES_FORMAT - /** Form definition integrated file system name. **/ - public static final int ATTR_FORM_DEFINITION = -3; // Form definition IFS name - static final int ATTR_FORMDEFLIB = 0x00B7; // Form definition library name - static final int ATTR_FORMDEF = 0x00B6; // Form definition name - /** Form feed. **/ - public static final int ATTR_FORMFEED = 0x002F; // type of paperfeed to be used - /** Form type. **/ - public static final int ATTR_FORMTYPE = 0x0030; // name of the form to be used - /** Form type message option. **/ - public static final int ATTR_FORMTYPEMSG = 0x0043; // form type message option - /** Front overlay integrated file system name. **/ - public static final int ATTR_FRONT_OVERLAY= -4; // Front overlay IFS name - static final int ATTR_FTOVRLLIB = 0x0033; // Front overlay library name - static final int ATTR_FTOVRLAY = 0x0034; // Front overlay name - /** Front margin offset across. **/ - public static final int ATTR_FTMGN_ACR = 0x0031; // front margin across - /** Front margin offset down. **/ - public static final int ATTR_FTMGN_DWN = 0x0032; // front margin down - /** Front overlay offset across. **/ - public static final int ATTR_FTOVL_ACR = 0x0036; // front overlay offset across - /** Front overlay offset down. **/ - public static final int ATTR_FTOVL_DWN = 0x0035; // front overlay offset down - /** Graphics in spooled file. **/ - public static final int ATTR_GRAPHICS = 0x0121; // AT_GRAPHICS - /** Graphics token. **/ - public static final int ATTR_GRAPHICS_TOK = 0x0122; // AT_GRAPHICS_TOK - /** Group level index tags. **/ - public static final int ATTR_GRPLVL_IDXTAG= 0x0123; // AT_GROUP_LVL_IDX_TAG - /** Held status. **/ - public static final int ATTR_HELDSTS = 0x00D0; // Indicates whether the writer is held - /** Highlight. **/ - public static final int ATTR_HIGHLIGHT = 0x0124; // AT_HIGHLIGHT - /** Hold spool file before written.**/ - public static final int ATTR_HOLD = 0x0039; // Hold file before written - /** Hold pending status. **/ - public static final int ATTR_HOLDPNDSTS = 0x00D1; // Indicates whether a hold writer command has been issued for this writer - /** When to hold file. **/ - public static final int ATTR_HOLDTYPE = 0x009E; // When to hold spooled file - /** Image configuration. **/ - public static final int ATTR_IMGCFG = 0x0100; // Image Configuration - /** Initialize printer. **/ - static final int ATTR_INITIALIZE_PRINTER = 0x00D2; // initialize the printer - /** Internet address. **/ - public static final int ATTR_INTERNETADDR = 0x0094; // internet address - /** IPDS pass-through. **/ - public static final int ATTR_IPDSPASSTHRU = 0x0116; // AT_IPDS_PASSTHRU - /** IPP attributes ccsid. **/ - public static final int ATTR_IPP_ATTR_CCSID= 0x00E1; // AT_IPP_ATTR_CCSID - /** IPP natural language. **/ - public static final int ATTR_IPP_ATTR_NL = 0x00FA; // IPP natural language - /** IPP job ID. **/ - public static final int ATTR_IPP_JOB_ID = 0x00E4; // IPP Job ID - /** IPP job name. **/ - public static final int ATTR_IPP_JOB_NAME = 0x00E6; // IPP Job Name - /** IPP job name natural language. **/ - public static final int ATTR_IPP_JOB_NAME_NL= 0x00E7; // IPP Job Name NL - /** IPP job originating user name. **/ - public static final int ATTR_IPP_JOB_ORIGUSER= 0x00E8; // IPP Job Originating usernam - /** IPP job originating user name natural language. **/ - public static final int ATTR_IPP_JOB_ORIGUSER_NL= 0x00E9; // Originating user NL - /** IPP printer name. **/ - public static final int ATTR_IPP_PRINTER_NAME= 0x00E5; // IPP Printer URI name - /** Job ccsid. **/ - public static final int ATTR_JOBCCSID = 0x014E; // ccsid of the job that created file - /** Job name. **/ - public static final int ATTR_JOBNAME = 0x003B; // name of the job that created file - /** Job number.**/ - public static final int ATTR_JOBNUMBER = 0x003C; // number of the job that created file - /** Job separators. **/ - public static final int ATTR_JOBSEPRATR = 0x003D; // number of job separators - /** Job system name. **/ - public static final int ATTR_JOBSYSTEM = 0x00FB; // name of the system where the job that created this spooled file ran - /** Job user. **/ - public static final int ATTR_JOBUSER = 0x003E; // name of the user that created file - /** Justification. **/ - public static final int ATTR_JUSTIFY = 0x0038; // justification - /** Last page printed. **/ - public static final int ATTR_LASTPAGE = 0x003F; // last page that printed - /** Library name. **/ - public static final int ATTR_LIBRARY = 0x000F; // library name - /** Line spacing. **/ - public static final int ATTR_LINESPACING = 0x00C3; // line spacing - /** Lines per inch. **/ - public static final int ATTR_LPI = 0x0040; // AT_LPI - /** Lines per inch changes. **/ - public static final int ATTR_LPI_CHANGES = 0x0130; // AT_LPI_CHANGES - /** Maximum jobs per client. **/ - public static final int ATTR_MAX_JOBS_PER_CLIENT = 0x00DE; // - /** Maximum records. **/ - public static final int ATTR_MAXRCDS = 0x0042; // Maximum records - /** Measurement method. **/ - public static final int ATTR_MEASMETHOD = 0x004F; // Measurement method (*ROWCOL or *UOM) - /** Message queue integrated file system name. **/ - public static final int ATTR_MESSAGE_QUEUE= -5; // Message Queue IFSPath - /** Message queue library name. **/ - static final int ATTR_MSGQUELIB = 0x0044; // Message queue library - /** Message queue name. **/ - static final int ATTR_MSGQUE = 0x005E; // Message queue - /** Manufacturer type and model. **/ - public static final int ATTR_MFGTYPE = 0x0041; // Manufacturer's type & model - /** Message help. **/ - public static final int ATTR_MSGHELP = 0x0081; // Message help text - /** Message ID. **/ - public static final int ATTR_MSGID = 0x0093; // Message ID - /** Message reply. **/ - public static final int ATTR_MSGREPLY = 0x0082; // Message reply - /** Message severity. **/ - public static final int ATTR_MSGSEV = 0x009F; // Message severity - /** Message text. **/ - public static final int ATTR_MSGTEXT = 0x0080; // message text - /** Message type. **/ - public static final int ATTR_MSGTYPE = 0x008E; // message type - /** Multi-item reply capability. **/ - public static final int ATTR_MULTI_ITEM_REPLY = 0x00DC; // multiple item reply capable - /** Pages per side. **/ - public static final int ATTR_MULTIUP = 0x0052; // logical pages per physical side - /** Net ID where file originated. **/ - public static final int ATTR_NETWORK = 0x00BD; // network ID where file originated - static final int ATTR_NLV_ID = 0x00B4; // NLV ID (ie: "2924"); - /** NPS object action. **/ - static final int ATTR_NPSACTION = 0x008C; // Action ID - /** NPS CCSID. **/ - public static final int ATTR_NPSCCSID = 0x008A; // server CCSID - /** NPS level. **/ - public static final int ATTR_NPSLEVEL = 0x008D; // server code level - /** NPS object. **/ - static final int ATTR_NPSOBJECT = 0x008B; // Object ID - /** Number of bytes to read/write. **/ - public static final int ATTR_NUMBYTES = 0x007D; // number of bytes to read/write - /** Number of bytes available in a stream or spooled file. **/ - public static final int ATTR_NUMBYTES_SPLF= 0x00D9; // number of bytes available in a stream/spooled file - /** Number of files. **/ - public static final int ATTR_NUMFILES = 0x0045; // total spooled files no output queue - /** Number of user resource library list entries. **/ - public static final int ATTR_NUMRSC_LIB_ENT= 0x0139; // AT_NUMRSC_LIB_ENT - /** Number of writers started to queue **/ - public static final int ATTR_NUMWRITERS = 0x0091; // number of writers started to queue - /** Object extended attribute. **/ - public static final int ATTR_OBJEXTATTR = 0x00B1; // Object extended attribute - /** On job queue status. **/ - public static final int ATTR_ONJOBQSTS = 0x00CD; // indicates whether the writer is on a job queue and therefore is not currently running - /** Open time commands. **/ - public static final int ATTR_OPENCMDS = 0x00A0; // Open time commands on read (for SCS) - /** Operator controlled. **/ - public static final int ATTR_OPCNTRL = 0x0046; // operator controlled - /** Order of files on queue. **/ - public static final int ATTR_ORDER = 0x0047; // order on queue (sequence) - *FIFO, *JOBNBR - /** OS/400-create AFPDS. **/ - public static final int ATTR_OS4_CRT_AFP = 0x0135; // AT_OS4_CRT_AFP - /** Output priority. **/ - public static final int ATTR_OUTPTY = 0x0048; // output priority - /** Output queue integrated file system name. **/ - public static final int ATTR_OUTPUT_QUEUE = -6; // Output queue IFS name - static final int ATTR_OUTQUELIB = 0x0049; // Output queue library name - static final int ATTR_OUTQUE = 0x004A; // Output queue name - /** Output bin. **/ - public static final int ATTR_OUTPUTBIN = 0x00C0; // output bin - /** Output queue status. **/ - public static final int ATTR_OUTQSTS = 0x004B; // output queue status - /** Overall status of printer. **/ - public static final int ATTR_OVERALLSTS = 0x00C8; // overall status of printer - /** Overflow line number. **/ - public static final int ATTR_OVERFLOW = 0x004C; // overflow line number - /** Page at a time. **/ - public static final int ATTR_PAGE_AT_A_TIME= 0x00D6; // page at a time - /* Lines Per Page is 0x004D and isn't used anymore. Use 0x004E instead. */ - /** Page definition integrated file system name. **/ - public static final int ATTR_PAGE_DEFINITION= -13; // Page definition IFS name - static final int ATTR_PAGDFNLIB = 0x00F5; // Page definition library name - static final int ATTR_PAGDFN = 0x00F6; // Page definition name - /** Page rotation used. **/ - public static final int ATTR_PAGE_ROTATE = 0x012A; // AT_PAGE_ROTATE - /** Length of page. **/ - public static final int ATTR_PAGELEN = 0x004E; // page length in Units of Measurement - /** Page number. **/ - public static final int ATTR_PAGENUMBER = 0x00D7; // page number - /** Total pages. **/ - public static final int ATTR_PAGES = 0x006F; // number of pages in spool file - /** Total pages estimated. **/ - public static final int ATTR_PAGES_EST = 0x00DA; // indicates if the number of pages is estimated - /** Width of page. **/ - public static final int ATTR_PAGEWIDTH = 0x0051; // width of page in Units of Measure - /** Page rotation. **/ - public static final int ATTR_PAGRTT = 0x0024; // Page rotation - // Chars per Line is 0x0050 and isn't used anymore - use 0x004E instead - /** Paper source 1. **/ - public static final int ATTR_PAPER_SOURCE_1= 0x00D4; // paper source 1 - /** Paper source 2. **/ - public static final int ATTR_PAPER_SOURCE_2= 0x00D5; // paper source 2 - /** Pel density. **/ - public static final int ATTR_PELDENSITY = 0x00B2; // Font Pel Density "1"=240;"2"=300; - /** Program that opened file library name. **/ - public static final int ATTR_PGM_OPN_LIB = 0x010F; // AT_PGM_OPN_LIB - /** Program that opened file name. **/ - public static final int ATTR_PGM_OPN_FILE = 0x0110; // AT_PGM_OPN_FILE - /** Point size. **/ - public static final int ATTR_POINTSIZE = 0x0053; // the default font's point size - static final int ATTR_PRECOMPUTE_NUMBYTES = 0x00B8; // Precompute Number of bytes on open - /** Printer (device name). **/ - public static final int ATTR_PRINTER = 0x0059; // Printer device name - /** Printer file integrated file system name. **/ - public static final int ATTR_PRINTER_FILE = -7; // Printer file IFS name - static final int ATTR_PRTFLIB = 0x005B; // Printer file library name - static final int ATTR_PRTFILE = 0x005C; // Printer file name - /** Print text. **/ - public static final int ATTR_PRTTEXT = 0x0058; // Text printed at bottom of each page - /** Printer assigned. **/ - public static final int ATTR_PRTASSIGNED = 0x00BA; // Printer assigned - /** Printer device type. **/ - public static final int ATTR_PRTDEVTYPE = 0x005A; // Printer dev type (data stream type (*SCS, *AFPDS, etc)) - /** Print quality. **/ - public static final int ATTR_PRTQUALITY = 0x0056; // Print quality - /** Print sequence. **/ - public static final int ATTR_PRTSEQUENCE = 0x0057; // Print sequence - /** Published printer. **/ - public static final int ATTR_PUBINF = 0x014F; //Published Printer - /** Color supported. **/ - public static final int ATTR_PUBINF_COLOR_SUP = 0x0101; //Color supported - /** Data stream supported. **/ - public static final int ATTR_PUBINF_DS = 0x0106; //Data Stream supported - /** Pages per minute (monochrome). **/ - public static final int ATTR_PUBINF_DUPLEX_SUP = 0x0104; //Duplex supported - /** Location description. **/ - public static final int ATTR_PUBINF_LOCATION = 0x0105; //Location description - /** Pages per minute (color). **/ - public static final int ATTR_PUBINF_PPM = 0x0103; //Pages per minute (monochrome) - /** Duplex supported. **/ - public static final int ATTR_PUBINF_PPM_COLOR = 0x0102; //Pages per minute (color) - /** Record length. **/ - public static final int ATTR_RECLENGTH = 0x005F; // record length - /** Reduce output. **/ - public static final int ATTR_REDUCE = 0x00C2; // Reduce output - static final int ATTR_RESOURCE_AVAIL= 0x00B3; // resource is available - /** Restart printing. **/ - public static final int ATTR_RESTART = 0x0063; // where to restart printing at - /** Remote system name. **/ - public static final int ATTR_RMTSYSTEM = 0x0060; // remote system name - /** Remote location name. **/ - public static final int ATTR_RMTLOCNAME = 0x00FF; // Remote location name - /** Printer queue. **/ - public static final int ATTR_RMTPRTQ = 0x005D; // Remote print queue used on SNDTCPSPLF - /** Replacement character. **/ - public static final int ATTR_RPLCHAR = 0x0062; // character to replace uNPrintables with - /** Replace unprintable characters. **/ - public static final int ATTR_RPLUNPRT = 0x0061; // replace uNPrintable characters - /** User resource library list. **/ - public static final int ATTR_RSC_LIB_LIST = 0x00F9; // User resource library list - /** Saddle stitch number of staples. **/ - public static final int ATTR_SADDLESTITCH_NUMSTAPLES = 0x00F3; // Saddle stitch number of staples - /** Saddle stitch reference edge. **/ - public static final int ATTR_SADDLESTITCH_REF= 0x00F2; // Saddle stitch reference edge - /** Saddle stitch staple offset. **/ - public static final int ATTR_SADDLESTITCH_STPL_OFFSEINFO = 0x00F4; // saddle stitch staple offset - /** Save spooled file after written. **/ - public static final int ATTR_SAVE = 0x0064; // Save spooled file after written - /** Save command. **/ - public static final int ATTR_SAVE_COMMAND = 0x0142; // Save command - /** Save device. **/ - public static final int ATTR_SAVE_DEVICE = 0x0143; // Save device - /** Save file integrated file system name. **/ - public static final int ATTR_SAVE_FILE = -14; // Save file IFSPath - static final int ATTR_SAVEFILE = 0x0145; // Save file name - static final int ATTR_SAVEFILELIB = 0x0144; // Save file library name - /** Save label. **/ - public static final int ATTR_SAVE_LABEL = 0x0146; // Save label - /** Save sequence number. **/ - public static final int ATTR_SAVE_SEQUENCE_NUMBER = 0x0147; // Save sequence number - /** Save volume format. **/ - public static final int ATTR_SAVE_VOLUME_FORMAT = 0x0148; // Save volume format - /** Save volume ID. **/ - public static final int ATTR_SAVE_VOLUME_ID = 0x0149; // Save volume ID - /** File available. **/ - public static final int ATTR_SCHEDULE = 0x006B; // when available to the writer - /** Transform SCS to ASCII. **/ - public static final int ATTR_SCS2ASCII = 0x0071; // transform SCS to ASCII - /** Seek offset. **/ - public static final int ATTR_SEEKOFF = 0x007E; // seek offset - /** Seek origin. **/ - public static final int ATTR_SEEKORG = 0x007F; // seek origin - /** Send priority. **/ - public static final int ATTR_SENDPTY = 0x0065; // send priority - /** Separator page. **/ - public static final int ATTR_SEPPAGE = 0x00A1; // Print banner page or not - static final int ATTR_SPLFSENDCMD = 0x0092; // spooled file send command - /** Source code page conversion. **/ - public static final int ATTR_SRC_CODEPAGE = 0x0107; // Source code page conversion - /** Source drawer. **/ - public static final int ATTR_SRCDRWR = 0x0066; // source drawer - /** Spooled file creation authentication method. **/ - public static final int ATTR_SPLF_AUTH_METHOD = 0x00E3; // Spooled file creation auth method - /** User Who Owned File. **/ - public static final int ATTR_SPLF_CREATOR = 0x013A; // User who owned file - /** Spooled file restored date. **/ - public static final int ATTR_SPLF_RESTORED_DATE = 0x014A; // Spooled file restored date - /** Spooled file restored time. **/ - public static final int ATTR_SPLF_RESTORED_TIME = 0x014B; // Spooled file restored time - /** Spooled file saved date. **/ - public static final int ATTR_SPLF_SAVED_DATE = 0x014C; // Spooled file saved date - /** Spooled file saved time. **/ - public static final int ATTR_SPLF_SAVED_TIME = 0x014D; // Spooled file saved time - /** Spooled file creation security method. **/ - public static final int ATTR_SPLF_SECURITY_METHOD= 0x00E2; // IPP Attributes-charset - /** Spooled file size. **/ - public static final int ATTR_SPLF_SIZE = 0x0136; // AT_SPLF_SIZE - /** Spooled file size multiplier. **/ - public static final int ATTR_SPLF_SIZE_MULT = 0x0137; // AT_SPLF_SIZE_MULT - /** Spooled file number. **/ - public static final int ATTR_SPLFNUM = 0x0069; // spool file number - /** Spooled file status. **/ - public static final int ATTR_SPLFSTATUS = 0x006A; // spool file status - /** Spool SCS. **/ - public static final int ATTR_SPLSCS = 0x00AD; // Spool SCS attr on splfile - /** Spool the data. **/ - public static final int ATTR_SPOOL = 0x0067; // spool the data - /** Spooled file name. **/ - public static final int ATTR_SPOOLFILE = 0x0068; // spool file name - /** Starting page. **/ - public static final int ATTR_STARTPAGE = 0x006C; // starting page to print - /** Started by. **/ - public static final int ATTR_STARTEDBY = 0x00C5; // started by user - /** System driver program name. **/ - public static final int ATTR_SYS_DRV_PGM = 0x0131; // System driver program name - /** System where file originated. **/ - public static final int ATTR_SYSTEM = 0x00BC; // system where file originated - /** Target code page conversion. **/ - public static final int ATTR_TGT_CODEPAGE = 0x0108; // Target code page converstion - /** Time file opened (created). **/ - public static final int ATTR_TIME = 0x006E; // time spooled file was opened (created) - /** Spooled file selection ending time.. **/ - public static final int ATTR_TIME_END = 0x00FE; - /** Time writer began procesing spooled file. **/ - public static final int ATTR_TIME_WTR_BEGAN_FILE = 0x00EC; // time writer began file - /** Time writer completed processing spooled file. **/ - public static final int ATTR_TIME_WTR_CMPL_FILE = 0x00ED; // time writer finished file - /** User ID address. **/ - public static final int ATTR_TOADDRESS = 0x0076; // address of user to send file to - /** User ID. **/ - public static final int ATTR_TOUSERID = 0x0075; // user id to send spool file to - /** TRC for 1403. **/ - public static final int ATTR_TRC1403 = 0x012B; // AT_TRC_1403 - /** Unit of measure. **/ - public static final int ATTR_UNITOFMEAS = 0x0072; // unit of measure - /** User defined object integrated file system name. **/ - public static final int ATTR_USER_DEFINED_OBJECT= -9; // User defined object IFS name - static final int ATTR_USRDEFOBJLIB = 0x00A4; // User defined object library - static final int ATTR_USRDEFOBJ = 0x00A5; // User defined object - static final int ATTR_USRDEFOBJTYP = 0x00A6; // User defined object type - /** User defined text. **/ - public static final int ATTR_USER_DFN_TXT = 0x0115; // AT_USER_DFN_TEXT - /** User driver program integrated file system name. **/ - public static final int ATTR_USER_DRIVER_PROG = -11; // user driver program IFSPath - static final int ATTR_USRDRVLIB = 0x00AA; // User driver program library - static final int ATTR_USERDRV = 0x00AB; // User driver program - /** User transform program integrated file system name. **/ - public static final int ATTR_USER_TRANSFORM_PROG = -10; // user transform program IFSPath - static final int ATTR_USRTFM = 0x00A8; // User transform program - static final int ATTR_USRTFMLIB = 0x00A7; // User transform program library - /** User comment. **/ - public static final int ATTR_USERCMT = 0x0073; // user comment - /** User data. **/ - public static final int ATTR_USERDATA = 0x0074; // user data - /** System Validated data stream. **/ - public static final int ATTR_USERGEN_DATA = 0x0111; // AT_USER_GEN_DATA - /** User defined data. **/ - public static final int ATTR_USRDEFDATA = 0x00A2; // User defined data - /** User defined file. **/ - public static final int ATTR_USRDEFFILE = 0x00C6; // User defined file - /** User defined option(s). **/ - public static final int ATTR_USRDEFOPT = 0x00A3; // User defined options - /** User driver program data. **/ - public static final int ATTR_USRDRVDATA = 0x00A9; // User driver program data - /** Viewing fidelity. **/ - public static final int ATTR_VIEWING_FIDELITY= 0x00D8; // viewing fidelity - /** VM/MVS Class. **/ - public static final int ATTR_VMMVSCLASS = 0x0077; // VM/MVS SYSOUT class - /** Workstation customization object integrated file system name. **/ - public static final int ATTR_WORKSTATION_CUST_OBJECT = -8; // Workstation Cust. obj IFSPath - /** Writing status. **/ - public static final int ATTR_WRTNGSTS = 0x00BB; // indicates whether the printer is in writing status - /** Workstation customizing object name. **/ - static final int ATTR_WSCUSTMOBJ = 0x0095; // workstation customizing object - /** Workstation customizing object library. **/ - static final int ATTR_WSCUSTMOBJL = 0x0096; // workstation customizing object library - /** Waiting for data status. **/ - public static final int ATTR_WTNGDATASTS = 0x00CB; // indicates whether the writer has written all the - // data currently in the spooled file and is waiting - // for more data - /** Waiting for device status. **/ - public static final int ATTR_WTNGDEVSTS = 0x00C9; // indicates whether the writer is waiting to get the - // device from a job that is printing directly to the printer - /** Waiting for message status. **/ - public static final int ATTR_WTNGMSGSTS = 0x00CA; // indicates whether the writer is wating for a reply - // to an inquiry message - /** When to automatically end writer. **/ - public static final int ATTR_WTRAUTOEND = 0x0078; // when to automatically end writer - /** When to end writer. **/ - public static final int ATTR_WTREND = 0x0090; // when to end the writer - /** Initialize the writer. **/ - public static final int ATTR_WTRINIT = 0x00AC; // When to initialize the writer - /** Writer job name. **/ - public static final int ATTR_WTRJOBNAME = 0x0079; // AT_WTR_JOB_NAME - /** Writer job number. **/ - public static final int ATTR_WTRJOBNUM = 0x007A; // AT_WTR_JOB_NUMBER - /** Writer job status. **/ - public static final int ATTR_WTRJOBSTS = 0x007B; // AT_WTR_JOB_STATUS - /** Writer job user name. **/ - public static final int ATTR_WTRJOBUSER = 0x007C; // AT_WTR_JOB_USER - /** Starting page. **/ - public static final int ATTR_WTRSTRPAGE = 0x008F; // AT_WTR_STARTING_PAGE - /** Writer started. **/ - public static final int ATTR_WTRSTRTD = 0x00C1; // indicates whether the writer is started - - - // KEEP THIS CURRENT ***** KEEP THIS CURRENT ***** KEEP THIS CURRENT - // KEEP THIS CURRENT ***** KEEP THIS CURRENT ***** KEEP THIS CURRENT - // KEEP THIS CURRENT ***** KEEP THIS CURRENT ***** KEEP THIS CURRENT - static final int MAX_ATTR_ID = 0x014F; // last attribute ID - - static final String EMPTY_STRING = ""; - private static final String SYSTEM = "system"; - - NPCPAttribute attrs; - private NPCPID cpID_; - private int objectType_; - private AS400 system_; - - transient PrintObjectImpl impl_; - - // These instance variables are not persistent. - transient PropertyChangeSupport changes; - transient VetoableChangeSupport vetos; - - - PrintObject(NPCPID idCodePoint, - NPCPAttribute cpAttrs, - int type) - { - - cpID_ = idCodePoint; - attrs = cpAttrs; - objectType_ = type; - system_ = null; - initializeTransient(); - } - - - PrintObject(AS400 system, - NPCPID idCodePoint, - NPCPAttribute cpAttrs, - int type) - { - this(idCodePoint, cpAttrs, type); - - if( system == null ) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null"); - throw new NullPointerException("system"); - } - system_ = system; - } - - - /** - * Adds the specified PropertyChange listener to receive - * PropertyChange events from this print object. - * - * @see #removePropertyChangeListener - * @param listener The PropertyChange listener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - changes.addPropertyChangeListener(listener); - } - - - /** - * Adds the specified VetoableChange listener to receive - * VetoableChange events from this print object. - * - * @see #removeVetoableChangeListener - * @param listener The VetoableChange listener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - vetos.addVetoableChangeListener(listener); - } - - - /** - * The sub classes have default constructors implemented - * for JavaBean support in visual builders. We need to - * check the run time state of the object. The sub classes - * will add additional checks by having their own - * checkRunTimeState(), but will call super.checkRunTimeState() - * to get this check. - **/ - void checkRunTimeState() - { - if( getSystem() == null ) - { - Trace.log(Trace.ERROR, "Parameter 'system' has not been set."); - throw new ExtendedIllegalStateException( - "system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - - - - // Chooses the appropriate implementation.(Proxy or Remote) - // Subclasses MUST supply the implementation to this method. - abstract void chooseImpl() - throws IOException, AS400SecurityException; - - - - // This method is avialable for use by other classes within the package. - final NPCPID getIDCodePoint() - { - // @B2A - no need for converter if the attribute list need not be built. - if ((cpID_ != null) && (cpID_.getfListOutOfDate())) { // @B2C - if (cpID_.converter_ == null) { // @B1A - try { // @B1A - cpID_.setConverter((new Converter(system_.getCcsid(), system_)).impl); // @B1A - } // @B1A - catch(UnsupportedEncodingException e) { // @B1A - if (Trace.isTraceErrorOn()) // @B1A - Trace.log(Trace.ERROR, "Unable to set converter ", e); // @B1A - } // @B1A - } // @B1A - } // @B1A - - return cpID_; - } - - - // Returns the impl_ ... required for passing XXXImpl parameters - PrintObjectImpl getImpl() - { - return impl_; - } - - - - /** - * Returns an attribute of the object that is a Integer type attribute. - * - * @param attributeID Identifies which attribute to retrieve. - * See the following links for the attribute IDs that are valid for each - * particular subclass. - * - * @return The value of the attribute. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * the system is not at the correct level. - **/ - public Integer getIntegerAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - Integer aValue = null; - if ((attrs != null) && (impl_ == null) - && (cpID_.converter_ != null)) { - aValue = attrs.getIntValue(attributeID); - } - if (aValue == null) { - if (impl_ == null) - chooseImpl(); - aValue = impl_.getIntegerAttribute(attributeID); - // update the attrs, since updateAttrs may have - // been called on the remote side... - attrs = impl_.getAttrValue(); - } - return aValue; - } - - - /** - * Returns an attribute of the object that is a Integer type attribute. - * - * @param attributeID Identifies which attribute to retrieve. - * See the following links for the attribute IDs that are valid for each - * particular subclass. - * - * @return The value of the attribute. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * the system is not at the correct level. - **/ - public Integer getSingleIntegerAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - Integer aValue = null; - if ((attrs != null) && (impl_ == null) - && (cpID_.converter_ != null)) { - aValue = attrs.getIntValue(attributeID); - } - if (aValue == null) { - if (impl_ == null) - chooseImpl(); - aValue = impl_.getSingleIntegerAttribute(attributeID); - // update the attrs, since updateAttrs may have - // been called on the remote side... - attrs = impl_.getAttrValue(); - } - return aValue; - } - - - /** - * Returns an attribute of the object that is a Float type attribute. - * - * @param attributeID Identifies which attribute to retrieve. - * See the following links for the attribute IDs that are valid for each - * particular subclass. - * - * @return The value of the attribute. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * the system is not at the correct level. - **/ - public Float getFloatAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - Float aValue = null; - if ((attrs != null) && (impl_ == null) - && (cpID_.converter_ != null)) { - aValue = attrs.getFloatValue(attributeID); - } - if (aValue == null) { - if (impl_ == null) - chooseImpl(); - aValue = impl_.getFloatAttribute(attributeID); - // update the attrs, since updateAttrs may have - // been called on the remote side... - attrs = impl_.getAttrValue(); - } - return aValue; - } - - - /** - * Returns an attribute of the object that is a Float type attribute. - * - * @param attributeID Identifies which attribute to retrieve. - * See the following links for the attribute IDs that are valid for each - * particular subclass. - * - * @return The value of the attribute. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * the system is not at the correct level. - **/ - public Float getSingleFloatAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - Float aValue = null; - if ((attrs != null) && (impl_ == null) - && (cpID_.converter_ != null)) { - aValue = attrs.getFloatValue(attributeID); - } - if (aValue == null) { - if (impl_ == null) - chooseImpl(); - aValue = impl_.getSingleFloatAttribute(attributeID); - // update the attrs, since updateAttrs may have - // been called on the remote side... - attrs = impl_.getAttrValue(); - } - return aValue; - } - - - /** - * Returns an attribute of the object that is a String type attribute. - * - * @param attributeID Identifies which attribute to retrieve. - * See the following links for the attribute IDs that are valid for each - * particular subclass. - * - * @return The value of the attribute. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * the system is not at the correct level. - **/ - public String getStringAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - String str = null; - if ((attrs != null) && (impl_ == null) - && (cpID_.converter_ != null)) { - str = attrs.getStringValue(attributeID); - } - if (str == null) { - if (impl_ == null) - chooseImpl(); - str = impl_.getStringAttribute(attributeID); - // update the attrs, since updateAttrs may have - // been called on the remote side... - attrs = impl_.getAttrValue(); - } - return str; - } - - - /** - * Returns an attribute of the object that is a String type attribute. - * - * @param attributeID Identifies which attribute to retrieve. - * See the following links for the attribute IDs that are valid for each - * particular subclass. - * - * @return The value of the attribute. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * the system is not at the correct level. - **/ - public String getSingleStringAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - String str = null; - if ((attrs != null) && (impl_ == null) - && (cpID_.converter_ != null)) { - str = attrs.getStringValue(attributeID); - } - if (str == null) { - if (impl_ == null) - chooseImpl(); - str = impl_.getSingleStringAttribute(attributeID); - // update the attrs, since updateAttrs may have - // been called on the remote side... - attrs = impl_.getAttrValue(); - } - return str; - } - - - /** - * Returns the system on which this object exists. - * @return The system on which this object exists. - **/ - final public AS400 getSystem() - { - return system_; - } - - - private void initializeTransient() - { - impl_ = null; - changes = new PropertyChangeSupport(this); - vetos = new VetoableChangeSupport(this); - - } - - - /** - * We need to initialize our transient and static data when - * the object is de-serialized. static final data is OK. - **/ - private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient(); - } - - - /** - * Removes the specified PropertyChange listener - * so that it no longer receives PropertyChange events - * from this print object. - * - * @see #addPropertyChangeListener - * @param listener The PropertyChange listener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - changes.removePropertyChangeListener(listener); - } - - - /** - * Removes the specified VetoableChange listener - * so that it no longer receives VetoableChange events - * from this print object. - * - * @see #addVetoableChangeListener - * @param listener The VetoableChange listener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - vetos.removeVetoableChangeListener(listener); - } - - - // This is left here for public subclasses to use... - // It is also located in PrintObjectImplRemote.java - final void setIDCodePoint(NPCPID cpID) - { - cpID_ = cpID; - if (impl_ != null) - impl_.setPrintObjectAttrs(cpID_, attrs, objectType_); - } - - - /** - * Set the system property of the PrintObject if necessary, as well - * as the codepoint, attributes, and object type. - **/ - void setImpl() - throws IOException, AS400SecurityException - { - system_.connectService(AS400.PRINT); - impl_.setSystem(system_.getImpl()); - impl_.setPrintObjectAttrs(cpID_, attrs, objectType_); - } - - - - /** - * Sets the system on which this object exists. This - * method is primarily provided for visual application builders - * that support JavaBeans. Application programmers should - * specify the system in the constructor for the - * specific print object. - * @param system The system on which this object exists. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - final public void setSystem(AS400 system) - throws PropertyVetoException - { - if( system == null ) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - - if (impl_ != null) { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException( "system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED ); - } - - AS400 oldSystem = getSystem(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( SYSTEM, oldSystem, system ); - - // No one vetoed, make the change. - system_ = system; - - // we may need to pass on system... - if (impl_ != null) - impl_.setSystem(system_.getImpl()); - - // When the system is changed, we need to "erase" any attributes - // of the object that we have cached locally. We will refresh the - // attributes from the new system the next time we need them. - attrs = null; - - // Notify any property change listeners. - changes.firePropertyChange( SYSTEM, oldSystem, system ); - } - - - - /** - * Updates the attributes of this object by going to the system and - * retrieving the latest attributes for the object. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * the system is not at the correct level. - **/ - public void update() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - - // We have chosen to do nothing here for JavaBeans. We don't - // think the Print Attributes are JavaBean properties and we - // have not provided separate getters/setters. - - checkRunTimeState(); - - if (impl_ == null) - chooseImpl(); - impl_.update(); - // propagate any changes to attrs - attrs = impl_.getAttrValue(); - } - - - - // this function returns the name of the ATTR corresponding to an integer id; - // it returns NULL if the ATTR is private, or if the id is invalid; - - // in those cases where the ATTR id is specified (in this file) as a negative decimal integer, - // this function does report the ATTR names of the private ATTRs immediately following the one - // with the negative id; in such cases it returns the name of the ATTR with the negative decimal id; - - static String getAttributeName(int id) - { - switch (id) - { - case 0x011F: return "ATTR_3812SCS"; - case 0x0109: return "ATTR_ACCOUNT_CODE"; - case 0x000A: return "ATTR_AFP"; - case -12: return "ATTR_AFP_RESOURCE"; // "negative decimal" - case 0x011A: return "ATTR_AFPRESOURCE"; - case 0x0128: return "ATTR_ASCIITRANS"; - case 0x00FC: return "ATTR_AUX_POOL"; - case 0x011B: return "ATTR_BARCODE"; - case 0x011C: return "ATTR_COLOR"; - case 0x0132: return "ATTR_CODFNT_ARRAY"; - case 0x012C: return "ATTR_CHARID"; - case 0x013C: return "ATTR_CHR_RTT_CMDS"; - case 0x0133: return "ATTR_CHRSET_LIB"; - case 0x0134: return "ATTR_CHRSET"; - case 0x0138: return "ATTR_CHRSET_SIZE"; - case 0x012D: return "ATTR_CPI_CHANGES"; - case 0x011D: return "ATTR_DDS"; - case 0x011E: return "ATTR_DOUBLEWIDE"; - case 0x012E: return "ATTR_DRAWERCHANGE"; - case 0x0120: return "ATTR_FIELD_OUTLIN"; - case 0x012F: return "ATTR_FONT_CHANGES"; - case 0x0121: return "ATTR_GRAPHICS"; - case 0x0122: return "ATTR_GRAPHICS_TOK"; - case 0x0123: return "ATTR_GRPLVL_IDXTAG"; - case 0x0124: return "ATTR_HIGHLIGHT"; - case 0x0125: return "ATTR_OFFICEVISION"; - case 0x0126: return "ATTR_PAGE_GROUPS"; - case 0x0127: return "ATTR_PAGELVLIDXTAG"; - case 0x0129: return "ATTR_RCDFMT_DATA"; - case 0x00BE: return "ATTR_ALIGNFORMS"; - case 0x012B: return "ATTR_TRC1403"; - case 0x000B: return "ATTR_ALIGN"; - case 0x000C: return "ATTR_ALWDRTPRT"; - case 0x010A: return "ATTR_ASPDEVICE"; - case 0x000D: return "ATTR_AUTHORITY"; - case 0x000E: return "ATTR_AUTHCHCK"; - case 0x0010: return "ATTR_AUTOEND"; - case 0x0011: return "ATTR_BKMGN_ACR"; - case 0x0012: return "ATTR_BKMGN_DWN"; - case -1: return "ATTR_BACK_OVERLAY"; // "negative decimal" - case 0x0013: return "ATTR_BACK_OVERLAY"; // declared as private (ATTR_BKOVRLLIB) - case 0x0014: return "ATTR_BACK_OVERLAY"; // declared as private (ATTR_BKOVRLAY) - case 0x0015: return "ATTR_BKOVL_DWN"; - case 0x0016: return "ATTR_BKOVL_ACR"; - case 0x00CE: return "ATTR_BTWNCPYSTS"; - case 0x00CF: return "ATTR_BTWNFILESTS"; - case 0x00BF: return "ATTR_CHANGES"; - case 0x0037: return "ATTR_CHAR_ID"; - case 0x0017: return "ATTR_CPI"; - case 0x0018: return "ATTR_CODEDFNTLIB"; - case 0x0019: return "ATTR_CODEPAGE"; - case 0x0117: return "ATTR_CODEPAGE_NAME_LIB"; - case 0x0118: return "ATTR_CODEPAGE_NAME"; - case 0x0119: return "ATTR_CODEDFONT_SIZE"; - case 0x001A: return "ATTR_CODEDFNT"; - case 0x010E: return "ATTR_CONSTBCK_OVL"; - case 0x00C4: return "ATTR_CONTROLCHAR"; - case 0x00F7: return "ATTR_CONVERT_LINEDATA"; - case 0x001C: return "ATTR_COPIES"; - case 0x001D: return "ATTR_COPIESLEFT"; - case 0x00F8: return "ATTR_CORNER_STAPLE"; - case 0x001E: return "ATTR_CURPAGE"; - case 0x001F: return "ATTR_DATAFORMAT"; - case -2: return "ATTR_DATA_QUEUE"; // "negative decimal" - case 0x0020: return "ATTR_DATA_QUEUE"; // declared as private (ATTR_DATAQUELIB) - case 0x0021: return "ATTR_DATA_QUEUE"; // declared as private (ATTR_DATAQUE) - case 0x0022: return "ATTR_DATE"; - case 0x00FD: return "ATTR_DATE_END"; - case 0x010D: return "ATTR_DATE_USED"; - case 0x00EA: return "ATTR_DATE_WTR_BEGAN_FILE"; - case 0x00EB: return "ATTR_DATE_WTR_CMPL_FILE"; - case 0x0140: return "ATTR_DAYS_UNTIL_EXPIRE"; - case 0x0099: return "ATTR_DBCSDATA"; - case 0x009A: return "ATTR_DBCSEXTENSN"; - case 0x009B: return "ATTR_DBCSROTATE"; - case 0x0112: return "ATTR_DBCS_FNT_LIB"; - case 0x0113: return "ATTR_DBCS_FNT"; - case 0x0114: return "ATTR_DBCS_FNT_SIZE"; - case 0x009C: return "ATTR_DBCSCPI"; - case 0x009D: return "ATTR_DBCSSISO"; - case 0x0023: return "ATTR_DFR_WRITE"; - case 0x010C: return "ATTR_DECIMAL_FMT"; - case 0x0097: return "ATTR_DELETESPLF"; - case 0x006D: return "ATTR_DESCRIPTION"; - case 0x0025: return "ATTR_DESTINATION"; - case 0x0098: return "ATTR_DESTOPTION"; - case 0x0026: return "ATTR_DEVCLASS"; - case 0x0027: return "ATTR_DEVMODEL"; - case 0x00C7: return "ATTR_DEVSTATUS"; - case 0x0028: return "ATTR_DEVTYPE"; - case 0x0029: return "ATTR_DISPLAYANY"; - case 0x002A: return "ATTR_DRWRSEP"; - case 0x0055: return "ATTR_DUPLEX"; - case 0x00EE: return "ATTR_EDGESTITCH_REF"; - case 0x00F0: return "ATTR_EDGESTITCH_NUMSTAPLES"; - case 0x00EF: return "ATTR_EDGESTITCH_REFOFF"; - case 0x002B: return "ATTR_ENDPAGE"; - case 0x00CC: return "ATTR_ENDPNDSTS"; - case 0x00D3: return "ATTR_ENVLP_SOURCE"; - case 0x0141: return "ATTR_EXPIRATION_DATE"; - case 0x0054: return "ATTR_FIDELITY"; - case 0x002C: return "ATTR_FILESEP"; - case 0x002D: return "ATTR_FOLDREC"; - case 0x002E: return "ATTR_FONTID"; - case 0x010B: return "ATTR_FONTRESFMT"; - case -3: return "ATTR_FORM_DEFINITION"; // "negative decimal" - case 0x00B7: return "ATTR_FORM_DEFINITION"; // declared as private (ATTR_FORMDEFLIB) - case 0x00B6: return "ATTR_FORM_DEFINITION"; // declared as private (ATTR_FORMDEF) - case 0x002F: return "ATTR_FORMFEED"; - case 0x0030: return "ATTR_FORMTYPE"; - case 0x0043: return "ATTR_FORMTYPEMSG"; - case 0x0031: return "ATTR_FTMGN_ACR"; - case 0x0032: return "ATTR_FTMGN_DWN"; - case -4: return "ATTR_FRONT_OVERLAY"; // "negative decimal" - case 0x0033: return "ATTR_FRONT_OVERLAY"; // declared as private (ATTR_FTOVRLLIB) - case 0x0034: return "ATTR_FRONT_OVERLAY"; // declared as private (ATTR_FTOVRLAY) - case 0x0036: return "ATTR_FTOVL_ACR"; - case 0x0035: return "ATTR_FTOVL_DWN"; - case 0x00D0: return "ATTR_HELDSTS"; - case 0x0039: return "ATTR_HOLD"; - case 0x00D1: return "ATTR_HOLDPNDSTS"; - case 0x009E: return "ATTR_HOLDTYPE"; - case 0x0100: return "ATTR_IMGCFG"; - case 0x0094: return "ATTR_INTERNETADDR"; - case 0x0116: return "ATTR_IPDSPASSTHRU"; - case 0x00E1: return "ATTR_IPP_ATTR_CCSID"; - case 0x00E4: return "ATTR_IPP_JOB_ID"; - case 0x00E6: return "ATTR_IPP_JOB_NAME"; - case 0x00E7: return "ATTR_IPP_JOB_NAME_NL"; - case 0x00E8: return "ATTR_IPP_JOB_ORIGUSER"; - case 0x00E9: return "ATTR_IPP_JOB_ORIGUSER_NL"; - case 0x00E5: return "ATTR_IPP_PRINTER_NAME"; - case 0x00FA: return "ATTR_IPP_ATTR_NL"; - case 0x014E: return "ATTR_JOBCCSID"; - case 0x003B: return "ATTR_JOBNAME"; - case 0x003C: return "ATTR_JOBNUMBER"; - case 0x003D: return "ATTR_JOBSEPRATR"; - case 0x00FB: return "ATTR_JOBSYSTEM"; - case 0x003E: return "ATTR_JOBUSER"; - case 0x0038: return "ATTR_JUSTIFY"; - case 0x003F: return "ATTR_LASTPAGE"; - case 0x000F: return "ATTR_LIBRARY"; - case 0x00C3: return "ATTR_LINESPACING"; - case 0x0040: return "ATTR_LPI"; - case 0x0130: return "ATTR_LPI_CHANGES"; - case 0x00DE: return "ATTR_MAX_JOBS_PER_CLIENT"; - case 0x0042: return "ATTR_MAXRCDS"; - case 0x004F: return "ATTR_MEASMETHOD"; - case 0x0041: return "ATTR_MFGTYPE"; - case -5: return "ATTR_MESSAGE_QUEUE"; // "negative decimal" - case 0x0044: return "ATTR_MESSAGE_QUEUE"; // declared as private (ATTR_MSGQUELIB) - case 0x005E: return "ATTR_MESSAGE_QUEUE"; // declared as private (ATTR_MSGQUE) - case 0x0081: return "ATTR_MSGHELP"; - case 0x0093: return "ATTR_MSGID"; - case 0x0082: return "ATTR_MSGREPLY"; - case 0x009F: return "ATTR_MSGSEV"; - case 0x0080: return "ATTR_MSGTEXT"; - case 0x008E: return "ATTR_MSGTYPE"; - case 0x00DC: return "ATTR_MULTI_ITEM_REPLY"; - case 0x0052: return "ATTR_MULTIUP"; - case 0x00BD: return "ATTR_NETWORK"; - case 0x008A: return "ATTR_NPSCCSID"; - case 0x008D: return "ATTR_NPSLEVEL"; - case 0x007D: return "ATTR_NUMBYTES"; - case 0x00D9: return "ATTR_NUMBYTES_SPLF"; - case 0x0045: return "ATTR_NUMFILES"; - case 0x0091: return "ATTR_NUMWRITERS"; - case 0x0139: return "ATTR_NUMRSC_LIB_ENT"; - case 0x00B1: return "ATTR_OBJEXTATTR"; - case 0x00CD: return "ATTR_ONJOBQSTS"; - case 0x00A0: return "ATTR_OPENCMDS"; - case 0x0046: return "ATTR_OPCNTRL"; - case 0x0047: return "ATTR_ORDER"; - case 0x0048: return "ATTR_OUTPTY"; - case 0x0135: return "ATTR_OS4_CRT_AFP"; - case 0x00C0: return "ATTR_OUTPUTBIN"; - case -6: return "ATTR_OUTPUT_QUEUE"; // "negative decimal" - case 0x0049: return "ATTR_OUTPUT_QUEUE"; // declared as private (ATTR_OUTQUELIB) - case 0x004A: return "ATTR_OUTPUT_QUEUE"; // declared as private (ATTR_OUTQUE) - case 0x004B: return "ATTR_OUTQSTS"; - case 0x00C8: return "ATTR_OVERALLSTS"; - case 0x004C: return "ATTR_OVERFLOW"; - case 0x00D6: return "ATTR_PAGE_AT_A_TIME"; - case -13: return "ATTR_PAGE_DEFINITION"; // "negative decimal" - case 0x00F5: return "ATTR_PAGE_DEFINITION"; // declared as private (ATTR_PAGDFNLIB) - case 0x00F6: return "ATTR_PAGE_DEFINITION"; // declared as private (ATTR_PAGDFN) - case 0x004E: return "ATTR_PAGELEN"; - case 0x00D7: return "ATTR_PAGENUMBER"; - case 0x006F: return "ATTR_PAGES"; - case 0x00DA: return "ATTR_PAGES_EST"; - case 0x0024: return "ATTR_PAGRTT"; - case 0x012A: return "ATTR_PAGE_ROTATE"; - case 0x0051: return "ATTR_PAGEWIDTH"; - case 0x00B2: return "ATTR_PELDENSITY"; - case 0x00D4: return "ATTR_PAPER_SOURCE_1"; - case 0x00D5: return "ATTR_PAPER_SOURCE_2"; - case 0x0053: return "ATTR_POINTSIZE"; - case 0x010F: return "ATTR_PGM_OPN_LIB"; - case 0x0110: return "ATTR_PGM_OPN_FILE"; - case 0x0056: return "ATTR_PRTQUALITY"; - case 0x0057: return "ATTR_PRTSEQUENCE"; - case 0x0058: return "ATTR_PRTTEXT"; - case 0x0059: return "ATTR_PRINTER"; - case 0x00BA: return "ATTR_PRTASSIGNED"; - case 0x005A: return "ATTR_PRTDEVTYPE"; - case -7: return "ATTR_PRINTER_FILE"; // "negative decimal" - case 0x005B: return "ATTR_PRINTER_FILE"; // declared as private (ATTR_PRTFLIB) - case 0x005C: return "ATTR_PRINTER_FILE"; // declared as private (ATTR_PRTFILE) - case 0x014F: return "ATTR_PUBINF"; - case 0x0101: return "ATTR_PUBINF_COLOR_SUP"; - case 0x0102: return "ATTR_PUBINF_PPM_COLOR"; - case 0x0106: return "ATTR_PUBINF_DS"; - case 0x0103: return "ATTR_PUBINF_PPM"; - case 0x0104: return "ATTR_PUBINF_DUPLEX_SUP"; - case 0x0105: return "ATTR_PUBINF_LOCATION"; - case 0x00FF: return "ATTR_RMTLOCNAME"; - case 0x005D: return "ATTR_RMTPRTQ"; - case 0x00DF: return "AT_READ_BUFFERS_SEQ"; - case 0x005F: return "ATTR_RECLENGTH"; - case 0x00C2: return "ATTR_REDUCE"; - case 0x0060: return "ATTR_RMTSYSTEM"; - case 0x0061: return "ATTR_RPLUNPRT"; - case 0x0062: return "ATTR_RPLCHAR"; - case 0x0063: return "ATTR_RESTART"; - case 0x00F3: return "ATTR_SADDLESTITCH_NUMSTAPLES"; - case 0x00F2: return "ATTR_SADDLESTITCH_REF"; - case 0x00F4: return "ATTR_SADDLESTITCH_STPL_OFFSEINFO"; - case 0x0064: return "ATTR_SAVE"; - case 0x0142: return "ATTR_SAVE_COMMAND"; - case 0x0143: return "ATTR_SAVE_DEVICE"; - case -14: return "ATTR_SAVE_FILE"; - case 0x0145: return "ATTR_SAVEFILE"; - case 0x0144: return "ATTR_SAVEFILELIB"; - case 0x0146: return "ATTR_SAVE_LABEL"; - case 0x0147: return "ATTR_SAVE_SEQUENCE_NUMBER"; - case 0x0148: return "ATTR_SAVE_VOLUME_FORMAT"; - case 0x0149: return "ATTR_SAVE_VOLUME_ID"; - case 0x006B: return "ATTR_SCHEDULE"; - case 0x0071: return "ATTR_SCS2ASCII"; - case 0x007E: return "ATTR_SEEKOFF"; - case 0x007F: return "ATTR_SEEKORG"; - case 0x0065: return "ATTR_SENDPTY"; - case 0x00A1: return "ATTR_SEPPAGE"; - case 0x0066: return "ATTR_SRCDRWR"; - case 0x0107: return "ATTR_SRC_CODEPAGE"; - case 0x0067: return "ATTR_SPOOL"; - case 0x0068: return "ATTR_SPOOLFILE"; - case 0x00E3: return "ATTR_SPLF_AUTH_METHOD"; - case 0x013A: return "ATTR_SPLF_CREATOR"; - case 0x014A: return "ATTR_SPLF_RESTORED_DATE"; - case 0x014B: return "ATTR_SPLF_RESTORED_TIME"; - case 0x014C: return "ATTR_SPLF_SAVED_DATE"; - case 0x014D: return "ATTR_SPLF_SAVED_TIME"; - case 0x0136: return "ATTR_SPLF_SIZE"; - case 0x0137: return "ATTR_SPLF_SIZE_MULT"; - case 0x00E2: return "ATTR_SPLF_SECURITY_METHOD"; - case 0x0069: return "ATTR_SPLFNUM"; - case 0x006A: return "ATTR_SPLFSTATUS"; - case 0x00AD: return "ATTR_SPLSCS"; - case 0x006C: return "ATTR_STARTPAGE"; - case 0x00C5: return "ATTR_STARTEDBY"; - case 0x00BC: return "ATTR_SYSTEM"; - case 0x0108: return "ATTR_TGT_CODEPAGE"; - case 0x0131: return "ATTR_SYS_DRV_PGM"; - case 0x006E: return "ATTR_TIME"; - case 0x00FE: return "ATTR_TIME_END"; - case 0x00EC: return "ATTR_TIME_WTR_BEGAN_FILE"; - case 0x00ED: return "ATTR_TIME_WTR_CMPL_FILE"; - case 0x0075: return "ATTR_TOUSERID"; - case 0x0076: return "ATTR_TOADDRESS"; - case 0x0072: return "ATTR_UNITOFMEAS"; - case 0x0073: return "ATTR_USERCMT"; - case 0x0074: return "ATTR_USERDATA"; - case 0x00A2: return "ATTR_USRDEFDATA"; - case 0x00C6: return "ATTR_USRDEFFILE"; - case 0x00A3: return "ATTR_USRDEFOPT"; - case -9: return "ATTR_USER_DEFINED_OBJECT"; // "negative decimal" - case 0x00A4: return "ATTR_USER_DEFINED_OBJECT"; // declared as private (ATTR_USRDEFOBJLIB) - case 0x00A5: return "ATTR_USER_DEFINED_OBJECT"; // declared as private (ATTR_USRDEFOBJ) - case 0x00A6: return "ATTR_USER_DEFINED_OBJECT"; // declared as private (ATTR_USRDEFOBJTYP) - case 0x0115: return "ATTR_USER_DFN_TXT"; - case 0x0111: return "ATTR_USERGEN_DATA"; - case -10: return "ATTR_USER_TRANSFORM_PROG"; // "negative decimal" - case 0x00A7: return "ATTR_USER_TRANSFORM_PROG"; // declared as private (ATTR_USRTFMLIB) - case 0x00A8: return "ATTR_USER_TRANSFORM_PROG"; // declared as private (ATTR_USRTFM) - case 0x00A9: return "ATTR_USRDRVDATA"; - case -11: return "ATTR_USER_DRIVER_PROG"; // "negative decimal" - case 0x00AA: return "ATTR_USER_DRIVER_PROG"; // declared as private (ATTR_USRDRVLIB) - case 0x00AB: return "ATTR_USER_DRIVER_PROG"; // declared as private (ATTR_USERDRV) - case 0x00D8: return "ATTR_VIEWING_FIDELITY"; - case 0x00F9: return "ATTR_RSC_LIB_LIST"; - case 0x0077: return "ATTR_VMMVSCLASS"; - case -8: return "ATTR_WORKSTATION_CUST_OBJECT"; // "negative decimal" - case 0x00BB: return "ATTR_WRTNGSTS"; - case 0x00CB: return "ATTR_WTNGDATASTS"; - case 0x00C9: return "ATTR_WTNGDEVSTS"; - case 0x00CA: return "ATTR_WTNGMSGSTS"; - case 0x0078: return "ATTR_WTRAUTOEND"; - case 0x0090: return "ATTR_WTREND"; - case 0x00AC: return "ATTR_WTRINIT"; - case 0x0079: return "ATTR_WTRJOBNAME"; - case 0x007A: return "ATTR_WTRJOBNUM"; - case 0x007B: return "ATTR_WTRJOBSTS"; - case 0x007C: return "ATTR_WTRJOBUSER"; - case 0x008F: return "ATTR_WTRSTRPAGE"; - case 0x00C1: return "ATTR_WTRSTRTD"; - default: return ""; - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/PrintObjectBeanInfo.java b/cvsroot/src/com/ibm/as400/access/PrintObjectBeanInfo.java deleted file mode 100644 index 2b9030cae..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintObjectBeanInfo.java +++ /dev/null @@ -1,137 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintObjectBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; - -/** -Base class for the various BeanInfo classes -describing print objects. -**/ -public class PrintObjectBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Events defined for PrintObject - private static EventSetDescriptor[] events_; - - // Properties defined for PrintObject - private static PropertyDescriptor[] properties_; - - // Class this bean info represents. - private final static Class beanClass = PrintObject.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader rbl_; - - static - { - try - { - PropertyDescriptor system = - new PropertyDescriptor("system", beanClass); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(rbl_.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(rbl_.getText("PROP_DESC_SYSTEM")); - - PropertyDescriptor properties[] = {system}; - properties_ = properties; - - EventSetDescriptor changed = - new EventSetDescriptor( beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange" ); - changed.setDisplayName(rbl_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(rbl_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = - new EventSetDescriptor( beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange" ); - veto.setDisplayName(rbl_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(rbl_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - events_ = events; - } - - catch (IntrospectionException e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the PropertyChange event - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the "system" property - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - // Per the JavaBean spec, events are a mechanism for propagating - // state change notifications between a source object and one or - // more target listener objects. - - return events_; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - // Per the JavaBean spec, properties are discrete, named attributes - // of a Java Bean that can affect its appearance or its behavior. - - return properties_; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/PrintObjectImpl.java b/cvsroot/src/com/ibm/as400/access/PrintObjectImpl.java deleted file mode 100644 index fedd565e4..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintObjectImpl.java +++ /dev/null @@ -1,114 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintObjectImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - * The PrintObjectImpl interface defines a set of methods - * needed for a full implementation of the PrintObject class. - **/ - -interface PrintObjectImpl -{ - - /** - * The getAttrValue (package scope) method is introduced to allow the - * propagation of any changes made to attrs (by updateAttrs) to the ImplRemote - * object. - **/ - public abstract NPCPAttribute getAttrValue(); - - - - public abstract Integer getIntegerAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - - public abstract Float getFloatAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - - public abstract String getStringAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - public abstract Integer getSingleIntegerAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - - public abstract Float getSingleFloatAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - - public abstract String getSingleStringAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - /** - * The setPrintObjectAttrs (package scope) method is introduced to allow - * the propagation of PrintObject property changes to the ImplRemote object. - **/ - public abstract void setPrintObjectAttrs(NPCPID idCodePoint, - NPCPAttribute cpAttrs, - int type); - - - - public abstract void setSystem(AS400Impl system); // @A1C - - - - public abstract void update() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - -} diff --git a/cvsroot/src/com/ibm/as400/access/PrintObjectImplProxy.java b/cvsroot/src/com/ibm/as400/access/PrintObjectImplProxy.java deleted file mode 100644 index 40576491a..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintObjectImplProxy.java +++ /dev/null @@ -1,220 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintObjectImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - -/** - * The PrintObjectImplProxy class implements proxy versions of - * the public methods defined in the PrintObjectImpl class. - * Unless commented otherwise, the implementations of the methods below - * are merely proxy calls to the corresponding method in the remote - * implementation class (PrintObjectImplRemote). - **/ - -abstract class PrintObjectImplProxy extends AbstractProxyImpl -implements PrintObjectImpl, ProxyImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - PrintObjectImplProxy(String className) - { - super(className); - } - - - - /** - * Invokes getAttrValue() on the server to retrieve the PrintObject - * attributes. - **/ - public NPCPAttribute getAttrValue() - { - try { - return (NPCPAttribute) connection_.callMethod(pxId_, - "getAttrValue").getReturnValue(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - public Integer getIntegerAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - return (Integer) connection_.callMethod(pxId_, "getIntegerAttribute", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (attributeID)}).getReturnValue(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public Float getFloatAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - return (Float) connection_.callMethod(pxId_, "getFloatAttribute", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (attributeID)}).getReturnValue(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public String getStringAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - return (String) connection_.callMethod(pxId_, "getStringAttribute", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (attributeID)}).getReturnValue(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - public Integer getSingleIntegerAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - return (Integer) connection_.callMethod(pxId_, "getIntegerAttribute", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (attributeID)}).getReturnValue(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public Float getSingleFloatAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - return (Float) connection_.callMethod(pxId_, "getFloatAttribute", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (attributeID)}).getReturnValue(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public String getSingleStringAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - return (String) connection_.callMethod(pxId_, "getStringAttribute", - new Class[] { Integer.TYPE }, - new Object[] { new Integer (attributeID)}).getReturnValue(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - public void setPrintObjectAttrs(NPCPID idCodePoint, - NPCPAttribute cpAttrs, - int type) - { - try { - connection_.callMethod (pxId_, "setPrintObjectAttrs", - new Class[] { NPCPID.class, NPCPAttribute.class, Integer.TYPE }, - new Object[] { idCodePoint, cpAttrs, new Integer (type)}); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - final public void setSystem(AS400Impl system) - { - try { - connection_.callMethod (pxId_, "setSystem", - new Class[] { AS400Impl.class }, - new Object[] { system }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - public void update() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "update"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/PrintObjectImplRemote.java b/cvsroot/src/com/ibm/as400/access/PrintObjectImplRemote.java deleted file mode 100644 index d2726b1bd..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintObjectImplRemote.java +++ /dev/null @@ -1,680 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintObjectImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -/** - * The PrintObjectImplRemote class implements the public methods defined in - * PrintObjectImpl. It also provides for the complete implementation of the - * PrintObject class, an abstract base class for the various types of - * network print objects. - **/ - -abstract class PrintObjectImplRemote -implements PrintObjectImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - NPCPAttribute attrs; - private AS400ImplRemote system_; - private NPCPID cpID_; - private int objectType_; - - - /** - * Check to see if the system has been set... - **/ - void checkRunTimeState() - { - if( getSystem() == null ) - { - Trace.log(Trace.ERROR, "Parameter 'system' has not been set."); - throw new ExtendedIllegalStateException( - "system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - - - - abstract NPCPAttributeIDList getAttrIDsToRetrieve(); - abstract NPCPAttributeIDList getAttrIDsToRetrieve(int AttrID); - - - /** - * Gets the print object attributes. - * This method is required so changes in the public class - * are propagated to this remote implementation of the class. - * - * @return NPCPAttribute - **/ - public NPCPAttribute getAttrValue() - { - return attrs; - } - - - - // This method is available for use by other classes within the package. - final NPCPID getIDCodePoint() - { - return cpID_; - } - - - - /** - * Returns an attribute of the object that is a Integer type attribute. - * - * @param attributeID Identifies which attribute to retrieve. - * See the following links for the attribute IDs that are valid for each - * particular subclass. - * - * @return The value of the attribute. - * - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * server operating system is not at the correct level. - **/ - public Integer getIntegerAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - Integer aValue = null; - if (attrs != null) - { - aValue = attrs.getIntValue(attributeID); - } - if (aValue == null) - { - aValue = getIDCodePoint().getIntValue(attributeID); - if (aValue == null) - { - NPCPAttributeIDList attrIDsToRetreive = getAttrIDsToRetrieve(); - - if (attrIDsToRetreive.containsID(attributeID)) - { - updateAttrs(attrIDsToRetreive); - if (attrs != null) - { - aValue = attrs.getIntValue(attributeID); - } - } - else - { - Trace.log(Trace.ERROR, "PrintObjectImplRemote.java - Attribute " + attributeID + " requested but not valid at this time."); - throw new ExtendedIllegalArgumentException(PrintObject.getAttributeName(attributeID), ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - } - - // if we haven't gotten a value and haven't already generated an exception it must mean that the server - // doesn't support the requested value - if (aValue == null) - { - NPSystem npSystem = NPSystem.getSystem(getSystem()); - NPConversation conversation = npSystem.getConversation(); - String curLevel = conversation.getAttribute(PrintObject.ATTR_NPSLEVEL); - npSystem.returnConversation(conversation); - throw new RequestNotSupportedException(curLevel, - RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - } - - return aValue; - } - - - /** - * Returns an attribute of the object that is a Integer type attribute. - * - * @param attributeID Identifies which attribute to retrieve. - * See the following links for the attribute IDs that are valid for each - * particular subclass. - * - * @return The value of the attribute. - * - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * server operating system is not at the correct level. - **/ - public Integer getSingleIntegerAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - Integer aValue = null; - if (attrs != null) - { - aValue = attrs.getIntValue(attributeID); - } - if (aValue == null) - { - aValue = getIDCodePoint().getIntValue(attributeID); - if (aValue == null) - { - NPCPAttributeIDList attrIDsToRetreive = getAttrIDsToRetrieve(attributeID); - - if (attrIDsToRetreive.containsID(attributeID)) - { - updateAttrs(attrIDsToRetreive); - if (attrs != null) - { - aValue = attrs.getIntValue(attributeID); - } - } - else - { - Trace.log(Trace.ERROR, "PrintObjectImplRemote.java - Attribute " + attributeID + " requested but not valid at this time."); - throw new ExtendedIllegalArgumentException(PrintObject.getAttributeName(attributeID), ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - } - - // if we haven't gotten a value and haven't already generated an exception it must mean that the server - // doesn't support the requested value - if (aValue == null) - { - NPSystem npSystem = NPSystem.getSystem(getSystem()); - NPConversation conversation = npSystem.getConversation(); - String curLevel = conversation.getAttribute(PrintObject.ATTR_NPSLEVEL); - npSystem.returnConversation(conversation); - throw new RequestNotSupportedException(curLevel, - RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - } - - return aValue; - } - - - /** - * Returns an attribute of the object that is a Float type attribute. - * - * @param attributeID Identifies which attribute to retrieve. - * See the following links for the attribute IDs that are valid for each - * particular subclass. - * - * @return The value of the attribute. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * server operating system is not at the correct level. - **/ - public Float getSingleFloatAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - Float aValue = null; - if (attrs != null) - { - aValue = attrs.getFloatValue(attributeID); - } - if (aValue == null) - { - aValue = getIDCodePoint().getFloatValue(attributeID); - if (aValue == null) - { - NPCPAttributeIDList attrIDsToRetreive = getAttrIDsToRetrieve(attributeID); - - if (attrIDsToRetreive.containsID(attributeID)) - { - updateAttrs(attrIDsToRetreive); - if (attrs != null) - { - aValue = attrs.getFloatValue(attributeID); - } - } - else - { - Trace.log(Trace.ERROR, "PrintObjectImplRemote.java - Attribute " + attributeID + " requested but not valid at this time."); - throw new ExtendedIllegalArgumentException(PrintObject.getAttributeName(attributeID), ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - } - - // if we haven't gotten a value and haven't already generated an exception it must mean that the server - // doesn't support the requested value - if (aValue == null) - { - NPSystem npSystem = NPSystem.getSystem(getSystem()); - NPConversation conversation = npSystem.getConversation(); - String curLevel = conversation.getAttribute(PrintObject.ATTR_NPSLEVEL); - npSystem.returnConversation(conversation); - throw new RequestNotSupportedException(curLevel, - RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - } - - return aValue; - } - - - /** - * Returns an attribute of the object that is a String type attribute. - * - * @param attributeID Identifies which attribute to retrieve. - * See the following links for the attribute IDs that are valid for each - * particular subclass. - * - * @return The value of the attribute. - * - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * server operating system is not at the correct level. - **/ - public String getSingleStringAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - String str = null; - if (attrs != null) - { - str = attrs.getStringValue(attributeID); - } - if (str == null) - { - str = getIDCodePoint().getStringValue(attributeID); - if (str == null) - { - NPCPAttributeIDList attrIDsToRetreive = getAttrIDsToRetrieve(attributeID); - - if (attrIDsToRetreive.containsID(attributeID)) - { - updateAttrs(attrIDsToRetreive); - if (attrs != null) { - str = attrs.getStringValue(attributeID); - } - } - else - { - Trace.log(Trace.ERROR, "PrintObjectImplRemote.java - Attribute " + attributeID + " requested but not valid at this time."); - throw new ExtendedIllegalArgumentException(PrintObject.getAttributeName(attributeID), ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - } - - // if we haven't gotten a value and haven't already generated an exception it must mean that the server - // doesn't support the requested value - if (str == null) - { - NPSystem npSystem = NPSystem.getSystem(getSystem()); - NPConversation conversation = npSystem.getConversation(); - String curLevel = conversation.getAttribute(PrintObject.ATTR_NPSLEVEL); - npSystem.returnConversation(conversation); - throw new RequestNotSupportedException(curLevel, - RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - } - - return str; - } - - - /** - * Returns an attribute of the object that is a Float type attribute. - * - * @param attributeID Identifies which attribute to retrieve. - * See the following links for the attribute IDs that are valid for each - * particular subclass. - * - * @return The value of the attribute. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * server operating system is not at the correct level. - **/ - public Float getFloatAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - Float aValue = null; - if (attrs != null) - { - aValue = attrs.getFloatValue(attributeID); - } - if (aValue == null) - { - aValue = getIDCodePoint().getFloatValue(attributeID); - if (aValue == null) - { - NPCPAttributeIDList attrIDsToRetreive = getAttrIDsToRetrieve(); - - if (attrIDsToRetreive.containsID(attributeID)) - { - updateAttrs(attrIDsToRetreive); - if (attrs != null) - { - aValue = attrs.getFloatValue(attributeID); - } - } - else - { - Trace.log(Trace.ERROR, "PrintObjectImplRemote.java - Attribute " + attributeID + " requested but not valid at this time."); - throw new ExtendedIllegalArgumentException(PrintObject.getAttributeName(attributeID), ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - } - - // if we haven't gotten a value and haven't already generated an exception it must mean that the server - // doesn't support the requested value - if (aValue == null) - { - NPSystem npSystem = NPSystem.getSystem(getSystem()); - NPConversation conversation = npSystem.getConversation(); - String curLevel = conversation.getAttribute(PrintObject.ATTR_NPSLEVEL); - npSystem.returnConversation(conversation); - throw new RequestNotSupportedException(curLevel, - RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - } - - return aValue; - } - - - - /** - * Returns an attribute of the object that is a String type attribute. - * - * @param attributeID Identifies which attribute to retrieve. - * See the following links for the attribute IDs that are valid for each - * particular subclass. - * - * @return The value of the attribute. - * - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * server operating system is not at the correct level. - **/ - public String getStringAttribute(int attributeID) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - String str = null; - if (attrs != null) - { - str = attrs.getStringValue(attributeID); - } - if (str == null) - { - str = getIDCodePoint().getStringValue(attributeID); - if (str == null) - { - NPCPAttributeIDList attrIDsToRetreive = getAttrIDsToRetrieve(); - - if (attrIDsToRetreive.containsID(attributeID)) - { - updateAttrs(attrIDsToRetreive); - if (attrs != null) - { - str = attrs.getStringValue(attributeID); - } - } - else - { - Trace.log(Trace.ERROR, "PrintObjectImplRemote.java - Attribute " + attributeID + " requested but not valid at this time."); - throw new ExtendedIllegalArgumentException(PrintObject.getAttributeName(attributeID), ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - } - - // if we haven't gotten a value and haven't already generated an exception it must mean that the server - // doesn't support the requested value - if (str == null) - { - NPSystem npSystem = NPSystem.getSystem(getSystem()); - NPConversation conversation = npSystem.getConversation(); - String curLevel = conversation.getAttribute(PrintObject.ATTR_NPSLEVEL); - npSystem.returnConversation(conversation); - throw new RequestNotSupportedException(curLevel, - RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - } - - return str; - } - - - - /** - * Returns the system on which this object exists. - * @return The server on which this object exists. - **/ - final public AS400ImplRemote getSystem() - { - return system_; - } - - - - // This method is available for use by other classes within the package. - final void setIDCodePoint(NPCPID cpID) - { - cpID_ = cpID; - } - - - - /** - * Sets the print object attributes. - * This method is required so changes in the public class - * are propogated to this remote implementation of the class. - * - * @param idCodePoint The ID code point - * @param cpAttrs The code point attributes - * @param type The type. - **/ - public void setPrintObjectAttrs(NPCPID idCodePoint, - NPCPAttribute cpAttrs, - int type) - { - cpID_ = idCodePoint; - attrs = cpAttrs; - objectType_ = type; - - try { - cpID_.setConverter(ConverterImplRemote.getConverter(system_.getCcsid(), system_)); - if (attrs != null) - attrs.setConverter(ConverterImplRemote.getConverter(system_.getCcsid(), system_)); - } - catch(UnsupportedEncodingException e) { - if (Trace.isTraceErrorOn()) - Trace.log(Trace.ERROR, "Error initializing converter for print object", e); - } - } - - - - /** - * Sets the system on which this object exists. This - * method is primarily provided for visual application builders - * that support JavaBeans. Application programmers should - * specify the system in the constructor for the - * specific print object. - * - * @param system The system on which this object exists. - **/ - final public void setSystem(AS400Impl system) - { - system_ = (AS400ImplRemote) system; - attrs = null; - } - - - - /** - * Updates the attributes of this object by going to the server and - * retrieving the latest attributes for the object. - * - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * server operating system is not at the correct level. - **/ - public void update() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - updateAttrs(getAttrIDsToRetrieve()); - } - - - - /** - * Go to the server and get the lastest attributes for this object - **/ - void updateAttrs(NPCPAttributeIDList attrIDs) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - checkRunTimeState(); - - NPDataStream req = new NPDataStream(objectType_); - NPDataStream reply = new NPDataStream(objectType_); - NPCPAttribute cpAttrs = new NPCPAttribute(); - - req.setAction(NPDataStream.RETRIEVE_ATTRIBUTES); - req.addCodePoint(getIDCodePoint()); - req.addCodePoint(attrIDs); - - reply.addCodePoint(cpAttrs); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - if (npSystem != null) { - int rc = npSystem.makeRequest(req, reply); - if (rc == 0) { - if (attrs != null) { - attrs.addUpdateAttributes(cpAttrs); - } - else { - attrs = cpAttrs; - } - } - else { - NPConversation conversation = npSystem.getConversation(); - String curLevel = conversation.getAttribute(PrintObject.ATTR_NPSLEVEL); - npSystem.returnConversation(conversation); - - switch(rc) { - // we get back RET_INV_REQ_ACT on pre-V3R7 systems if we try - // to open an AFP resource. The server must be at V3R7 with PTFs - // to work with AFP resources so throw a requestNotSupportedException - // here. - case NPDataStream.RET_INV_REQ_ACT: - throw new RequestNotSupportedException(curLevel, - RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - // any other error is either an unexpected error or an error - // completing request - default: - - break; - } - } // end else - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/PrintObjectInputStream.java b/cvsroot/src/com/ibm/as400/access/PrintObjectInputStream.java deleted file mode 100644 index 3eb5b9b17..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintObjectInputStream.java +++ /dev/null @@ -1,287 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintObjectInputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.IOException; - -/** -Reads data out of a system spooled file or AFP resource such as an overlay or page -segment. -

    -An instance of this class can be created either by using -the getInputStream method -from the AFPResource class or by using -the getInputStream method -from the SpooledFile class. -**/ - -public class PrintObjectInputStream extends InputStream -{ - transient private AS400 system_; - transient private PrintObjectInputStreamImpl impl_; - - - /** - * Constructs a PrintObjectInputStream object. It uses the - * specified SpooledFile object from which to read and the PrintParameterList. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the system - * operating system is not at the correct level. - **/ - PrintObjectInputStream(SpooledFile sf, - PrintParameterList openOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - system_ = sf.getSystem(); - chooseImpl(); - // Do connect here because it could throw Exceptions - system_.connectService(AS400.PRINT); - if (sf.getImpl() == null) { - sf.chooseImpl(); - } - impl_.createPrintObjectInputStream((SpooledFileImpl) sf.getImpl(), openOptions); - } - - - /** - * Constructs a PrintObjectInputStream object. It uses the - * specified SpooledFile object from which to read, the PrintParameterList. - * and the int value of PrintObject.ATTR_ACIF which indicates of the ACIF - * merged data is to be used. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the system - * operating system is not at the correct level. - **/ - PrintObjectInputStream(SpooledFile sf, - PrintParameterList openOptions, String acifProcess) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - system_ = sf.getSystem(); - chooseImpl(); - // Do connect here because it could throw Exceptions - system_.connectService(AS400.PRINT); - if (sf.getImpl() == null) { - sf.chooseImpl(); - } - impl_.createPrintObjectInputStream((SpooledFileImpl) sf.getImpl(), openOptions, acifProcess); - } - - - /** - * Contructs a PrintObjectInputStream object. - * It uses the specified AFP Resource object from which to read and - * the PrintParameterList. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the system - * operating system is not at the correct level. - **/ - PrintObjectInputStream(AFPResource resource, - PrintParameterList openOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - system_ = resource.getSystem(); - chooseImpl(); - // Do connect here because it could throw Exceptions - system_.connectService(AS400.PRINT); - if (resource.getImpl() == null) { - resource.chooseImpl(); - } - impl_.createPrintObjectInputStream((PrintObjectImpl)resource.getImpl(), openOptions); - } - - - - /** - * Returns the number of bytes that can be read without blocking. - * This class always returns the number of bytes remaining in the spooled - * file or AFP resource. - * @return The number of available bytes without blocking. - **/ - public int available() - throws IOException - { - return impl_.available(); - } - - - - // A1A - Added method - private void chooseImpl() - { - if (system_ == null) { - Trace.log( Trace.ERROR, "Attempt to use PrintObjectInputStream before setting system."); - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - impl_ = (PrintObjectInputStreamImpl) system_.loadImpl2("com.ibm.as400.access.PrintObjectInputStreamImplRemote", - "com.ibm.as400.access.PrintObjectInputStreamImplProxy"); - } - - - - /** - * Closes the input stream. - * It must be called to release any resources associated with the stream. - * @exception IOException If an error occurs while communicating with the system. - **/ - public void close() - throws IOException - { - impl_.close(); - } - - - - /** Marks the current position in the input stream. - * A subsequent call to reset() will reposition the stream at the - * last marked position, so that subsequent reads will reread the same bytes. - * The stream promises to allow readLimit bytes to be read before the - * mark position gets invalidated. - * - * @param readLimit The maximum limit of bytes allowed - * to be read before the mark position becomes invalid. - **/ - public void mark(int readLimit) - { - impl_.mark(readLimit); - } - - - - /** Returns a boolean indicating whether this stream type - * supports mark/reset. - * - * @return Always true. Objects of this class will support - * the mark/reset methods. - **/ - public boolean markSupported() - { - return true; - } - - - - /** Reads the next byte of data from this input stream. - * @return The byte read, or -1 if the end of the stream is reached. - * @exception IOException If an error occurs while communicating with the system. - **/ - public int read() - throws IOException - { - int iRC = -1; - - byte[] byteBuffer = new byte[1]; - int rc = read(byteBuffer); - if (rc == 1) { - iRC = (int)byteBuffer[0]; - } - return iRC; - - } - - - - /** Reads up to data.length bytes of data from this - * input stream into data. - * - * @param data The buffer into which the data is read. - * - * @return The total number of bytes read into the buffer, - * or -1 if there is no more data because the - * end of file has been reached. - * @exception IOException If an error occurs while communicating with the system. - **/ - public int read(byte[] data) - throws IOException - { - return read(data, 0, data.length); - } - - - - /** Reads up to length bytes of data from this input stream - * into data, starting at the array offset dataOffset. - * - * @param data The buffer into which the data is read. - * @param dataOffset The start offset of the data. - * @param length The maximum number of bytes to read. - * - * @return The total number of bytes read into the buffer, - * or -1 if there is no more data because the - * end of file has been reached. - * @exception IOException If an error occurs while communicating with the system. - **/ - public int read(byte data[], int dataOffset, int length) - throws IOException - { - return impl_.read(data, dataOffset, length); - } - - - - /** Repositions the stream to the last marked position. - * If the stream has not been marked or if the mark has been invalidated, - * an IOException is thrown. - * @exception IOException If an error occurs while communicating with the system. - **/ - public void reset() - throws IOException - { - impl_.reset(); - } - - - - /** Skips over the next bytesToSkip bytes in the stream. - * This method may skip less bytes than specified if the end of - * file is reached. The actual number of bytes skipped is returned. - * @param bytesToSkip The number of bytes to be skipped. - * @return The actual number of bytes skipped. - * @exception IOException If an error occurs while communicating with the system. - **/ - public long skip(long bytesToSkip) throws IOException - { - return (long) impl_.skip(bytesToSkip); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/PrintObjectInputStreamImpl.java b/cvsroot/src/com/ibm/as400/access/PrintObjectInputStreamImpl.java deleted file mode 100644 index 69de3d338..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintObjectInputStreamImpl.java +++ /dev/null @@ -1,80 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintObjectInputStreamImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -interface PrintObjectInputStreamImpl -{ - public abstract void createPrintObjectInputStream(SpooledFileImpl sf, - PrintParameterList openOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - public abstract void createPrintObjectInputStream(SpooledFileImpl sf, - PrintParameterList openOptions, - String acifImp) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - public abstract void createPrintObjectInputStream(PrintObjectImpl resource, - PrintParameterList openOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - - public abstract int available() - throws IOException; - - - - public abstract void close() - throws IOException; - - - - // NOTE: Interface methods cannot be synchronized... - public abstract void mark(int readLimit); - - - - public abstract int read(byte data[], int dataOffset, int length) - throws IOException; - - - - // NOTE: Interface methods cannot be synchronized... - public abstract void reset() - throws IOException; - - - - public abstract long skip(long bytesToSkip) - throws IOException; - -} diff --git a/cvsroot/src/com/ibm/as400/access/PrintObjectInputStreamImplProxy.java b/cvsroot/src/com/ibm/as400/access/PrintObjectInputStreamImplProxy.java deleted file mode 100644 index f905adc83..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintObjectInputStreamImplProxy.java +++ /dev/null @@ -1,210 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintObjectInputStreamImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.io.IOException; - -/** - * The PrintObjectInputStreamImplProxy class implements proxy versions of - * the public methods defined in the PrintObjectInputStreamImpl class. - * Unless commented otherwise, the implementations of the methods below - * are merely proxy calls to the corresponding method in the remote - * implementation class (PrintObjectInputStreamImplRemote). - **/ - -class PrintObjectInputStreamImplProxy extends AbstractProxyImpl -implements PrintObjectInputStreamImpl, ProxyImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // myArgs needed for ProxyCall...see ProxyClientConnection - private static final boolean[] myArgs = new boolean[] {true, false, false}; - - PrintObjectInputStreamImplProxy() - { - super("PrintObjectInputStream"); - } -//B1A - public void createPrintObjectInputStream(SpooledFileImpl sf, - PrintParameterList openOptions, String acifO) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "createPrintObjectInputStream", - new Class [] { SpooledFileImpl.class, PrintParameterList.class }, - new Object[] { sf, openOptions }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - public void createPrintObjectInputStream(SpooledFileImpl sf, - PrintParameterList openOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "createPrintObjectInputStream", - new Class [] { SpooledFileImpl.class, PrintParameterList.class }, - new Object[] { sf, openOptions }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public void createPrintObjectInputStream(PrintObjectImpl resource, - PrintParameterList openOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "createPrintObjectInputStream", - new Class [] { PrintObjectImpl.class, PrintParameterList.class }, - new Object[] { resource, openOptions }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public int available() - throws IOException - { - try { - return connection_.callMethod(pxId_, "available").getReturnValueInt(); - } - catch (InvocationTargetException e) { - Throwable error = e.getTargetException(); - if (error instanceof IOException) - throw (IOException) error; - else - throw ProxyClientConnection.rethrow(e); - } - } - - - - public void close() - throws IOException - { - try { - connection_.callMethod(pxId_, "close"); - } - catch (InvocationTargetException e) { - Throwable error = e.getTargetException(); - if (error instanceof IOException) - throw (IOException) error; - else - throw ProxyClientConnection.rethrow(e); - } - } - - - - public void mark(int readLimit) - { - try { - connection_.callMethod(pxId_, "mark", - new Class[] {Integer.TYPE}, - new Object[] { new Integer (readLimit) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - public int read(byte data[], int dataOffset, int length) - throws IOException - { - try { - ProxyReturnValue rv = connection_.callMethod(pxId_, "read", - new Class[] { byte[].class , Integer.TYPE, Integer.TYPE }, - new Object[] { data, new Integer(dataOffset), new Integer(length) }, - myArgs, false); - - byte [] returnDataBuffer = (byte[])rv.getArgument(0); - for (int i=0; idata.length bytes of data from this - * input stream into data. - * - * @param data The buffer into which the data is read. - * - * @return The total number of bytes read into the buffer, - * or -1 if there is no more data because the - * end of file has been reached. - * @exception IOException If an error occurs while communicating with the server. - **/ - /* public int read(byte[] data) - throws IOException - { - return read(data, 0, data.length); - } // read(byte[]) */ - - - - /** Reads up to length bytes of data from this input stream - * into data, starting at the array offset dataOffset. - * - * @param data The buffer into which the data is read. - * @param dataOffset The start offset of the data. - * @param length The maximum number of bytes to read. - * - * @return The total number of bytes read into the buffer, - * or -1 if there is no more data because the - * end of file has been reached. - * @exception IOException If an error occurs while communicating with the server. - **/ - public int read(byte data[], int dataOffset, int length) - throws IOException - { - int bytesRead = 0; - if (conversation_ == null) - { - Trace.log(Trace.ERROR, "Conversation is null."); - throw new IOException(); - } else { - - NPDataStream readReq = new NPDataStream(objectType_); - NPDataStream readRep = new NPDataStream(objectType_); - NPCPAttribute cpAttr = new NPCPAttribute(); - NPCPData cpData = new NPCPData(); - - // set the number of bytes to read - cpAttr.setAttrValue(PrintObject.ATTR_NUMBYTES, length); - readReq.setAction(NPDataStream.READ); - readReq.addCodePoint(cpObjHndl_); - readReq.addCodePoint(cpAttr); - - // Point the data codepoint to receive the data into our buffer. - // Our buffer better be big enough to hold the data or we''ll - // not get it at all - cpData.setDataBuffer(data, 0, dataOffset); - readRep.addCodePoint(cpData); - readRep.addCodePoint(cpCPFMsg_); - try - { - int iRC = conversation_.makeRequest(readReq, readRep); - switch (iRC) - { - case NPDataStream.RET_OK: - case NPDataStream.RET_READ_INCOMPLETE: // maybe read some bytes? - // see how many bytes we read - bytesRead = cpData.getDataLength(); - offsetFromMark_ += bytesRead; // update how far we went from the mark - offset_ += bytesRead; // update how far we are from the start of file - break; - case NPDataStream.RET_READ_EOF: - // this return code is only returned if there are no - // bytes read at all - bytesRead = -1; // set rc to end of file - break; - default: - // log an error throw appropriate exception - Trace.log(Trace.ERROR, "Error received on read : " + Integer.toString(iRC)); - throw new IOException(Integer.toString(iRC)); - } - } - - catch (Exception e) - { - Trace.log(Trace.ERROR, "PrintObjectInputStream::read() - caught an Exception." + e.toString()); - throw new IOException(e.toString()); - } - - - } - - return bytesRead; - } // read(byte[], int, int) - - - - /** Repositions the stream to the last marked position. - * If the stream has not been marked or if the mark has been invalidated, - * an IOException is thrown. - * @exception IOException If an error occurs while communicating with the server. - **/ - public synchronized void reset() - throws IOException - { - if (conversation_ == null) - { - Trace.log(Trace.ERROR, "Conversation is null."); - throw new IOException(); - } - if (!markSet_) - { - Trace.log(Trace.ERROR, "Mark not set."); - throw new IOException(); - } else { - if ((markLimit_ == 0) || (offsetFromMark_ > markLimit_)) - { - Trace.log(Trace.WARNING, "Stream has not been marked or mark has been invalidated."); - throw new IOException(); - } else { - // seek backwards from the current spot offsetFromMark_ bytes - // and reset offsetFromMark_ to 0 - if (offsetFromMark_ != 0) - { - seekFromCur(-offsetFromMark_); - } - } - } - - } // reset() - - - - private void retrieveNumberOfBytes() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - - { - NPDataStream sendDS = new NPDataStream(objectType_); - NPDataStream replyDS = new NPDataStream(objectType_); - NPCPAttribute cpAttrs = new NPCPAttribute(); - NPCPAttributeIDList cpAttrsToRetrieve = new NPCPAttributeIDList(); - cpAttrsToRetrieve.addAttrID(PrintObject.ATTR_NUMBYTES); - - sendDS.addCodePoint(cpObjID_); - sendDS.addCodePoint(cpAttrsToRetrieve); - sendDS.setAction(NPDataStream.RETRIEVE_ATTRIBUTES); - replyDS.addCodePoint(cpAttrs); - - int rc = conversation_.makeRequest(sendDS, replyDS); - if (rc == NPDataStream.RET_OK) - { - Integer numBytes = cpAttrs.getIntValue(PrintObject.ATTR_NUMBYTES); - if (numBytes != null) - { - numBytes_ = numBytes.intValue(); - } else { - Trace.log(Trace.ERROR, - " Network Print Server does not support retrieving splf/resource length"); - throw new RequestNotSupportedException( - conversation_.getAttribute(PrintObject.ATTR_NPSLEVEL), - RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - } - } else { - Trace.log(Trace.ERROR, - " Network Print Server error retrieving splf/resource length. RC =" + - rc); - throw new RequestNotSupportedException( - conversation_.getAttribute(PrintObject.ATTR_NPSLEVEL), - RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - } - - - } // retrieveNumBytes() - - - - /** Skips over the next bytesToSkip bytes in the stream. - * This method may skip less bytes than specified if the end of - * file is reached. The actual number of bytes skipped is returned. - * @param bytesToSkip The number of bytes to be skipped. - * @return The actual number of bytes skipped. - * @exception IOException If an error occurs while communicating with the server. - **/ - public long skip(long bytesToSkip) throws IOException - { - if ( (conversation_ == null)) - { - Trace.log(Trace.ERROR, "Conversation is null."); - throw new IOException(); - } else { - int maxSkip = numBytes_ - offset_; // maximum number of bytes you can skip - if (bytesToSkip > maxSkip) - { - bytesToSkip = maxSkip; - } - - seekFromCur((int)bytesToSkip); // seek ahead from current pointer n bytes - } - return bytesToSkip; - - } // skip(long n); - - - - private void seekFromCur(int offset) - throws IOException - { - NPDataStream seekReq = new NPDataStream(objectType_); - NPDataStream seekRep = new NPDataStream(objectType_); - NPCPAttribute cpAttr = new NPCPAttribute(); - - cpAttr.setAttrValue(PrintObject.ATTR_SEEKORG, 2); // current read pointer - cpAttr.setAttrValue(PrintObject.ATTR_SEEKOFF, offset); // offset - - seekReq.setAction(NPDataStream.SEEK); - seekReq.addCodePoint(cpObjHndl_); - seekReq.addCodePoint(cpAttr); - seekRep.addCodePoint(cpCPFMsg_); - try - { - int iRC = conversation_.makeRequest(seekReq, seekRep); - switch (iRC) - { - case NPDataStream.RET_OK: - offsetFromMark_ += offset; // update how far we went from the mark - offset_ += offset; // update how far we are from beginning of file - break; - case NPDataStream.RET_SEEK_OFF_BAD: - default: - // we should never get Seek offset bad because we - // always check in skip that we aren't going beyond the end of - // the file. The other place we seek is on a reset and that - // should work. - Trace.log(Trace.ERROR, "Seek from cur error " + Integer.toString(iRC)); - throw new IOException(Integer.toString(iRC)); - } - } - - catch (Exception e) - { - Trace.log(Trace.ERROR, "Caught an Exception." + e.toString()); - throw new IOException(e.toString()); - } - - - } // seekFromCur() - - - - /** - * returns the number of bytes from the beginning of the file. - * - * @return The number of bytes from the beginning of the file. - * @exception IOException If an error occurs while communicating with the server. - **/ - long tell() - throws IOException - { - if ( (conversation_ == null)) - { - Trace.log(Trace.ERROR, "Conversation is null."); - throw new IOException(); - } else { - NPDataStream tellReq = new NPDataStream(objectType_); - NPDataStream tellRep = new NPDataStream(objectType_); - NPCPAttributeIDList cpAttrIDs = new NPCPAttributeIDList(); - NPCPAttribute cpAttr = new NPCPAttribute(); - - cpAttrIDs.addAttrID(PrintObject.ATTR_SEEKOFF); - - - tellReq.setAction(NPDataStream.TELL); - tellReq.addCodePoint(cpObjHndl_); - // the cpAttr will catch either the offset attribute or the CPF message - tellRep.addCodePoint(cpAttr); - try - { - int iRC = conversation_.makeRequest(tellReq, tellRep); - switch (iRC) - { - case NPDataStream.RET_OK: - Integer curOffset = cpAttr.getIntValue(PrintObject.ATTR_SEEKOFF); - if (curOffset == null) - { - Trace.log(Trace.ERROR, " tell() returned null!"); - throw new InternalErrorException(InternalErrorException.PROTOCOL_ERROR); - } else { - return curOffset.intValue(); - } - - default: - // Anything else would be an error...The conversation should handle - // the basic CPF message error for us, so this would be some unexpected - // result - throw a runtime error. - - Trace.log(Trace.ERROR, " NPServer.Tell() returned " + iRC); - throw new InternalErrorException(InternalErrorException.PROTOCOL_ERROR); - - } - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Caught an Exception." + e.toString()); - throw new IOException(e.toString()); - } - - } - - } // tell() - -} // PrintObjectInputStream class - diff --git a/cvsroot/src/com/ibm/as400/access/PrintObjectList.java b/cvsroot/src/com/ibm/as400/access/PrintObjectList.java deleted file mode 100644 index 513976b48..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintObjectList.java +++ /dev/null @@ -1,881 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintObjectList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Enumeration; -import java.util.Vector; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.beans.PropertyVetoException; - - -/** - * Abstract base class for the various types of network print object lists. - * - **/ -public abstract class PrintObjectList -implements java.io.Serializable -{ - static final long serialVersionUID = 4L; - - private static final String SYSTEM = "system"; - - // These instance variable are persistent. - private NPCPAttributeIDList attrsToRetrieve_ = null; - private NPCPID idFilter_ = null; // for certain lists an idcodepoint may be used to filter - private NPCPSelection selection_ = null; // selection filter - AS400 system_ = null; // The system object - private int typeOfObject_ = 0; // The PrintObject object type - private boolean listOutOfSync_ = false; // Is the list out of sync with the impl list? - private boolean objectAddedEvent_= false; // Has an object been added and event fired? - - // These instance variables are not persistent, but private. - private transient boolean open_; - private transient Vector printObjectListListeners_; - private transient Vector theList_; - - // These instance variables are not persistent, but are package scope - // to allow subclasses access to them... - transient PrintObjectListImpl impl_; - transient PropertyChangeSupport changes; - transient VetoableChangeSupport vetos; - transient PrintObjectListListener dispatcher_; - - - boolean useCache_ = true; - - /** - * Sets whether or not to internally maintain a cache of objects returned by this list. - * By default, caching is on, so that the Enumeration returned by getObjects() is populated. - * Under normal circumstances, code should not need to call this method. - *

    - * However, if code wishes to open the list asynchronously and use a PrintObjectListListener to receive - * listObjectAdded() events, the objects in the list are returned on those events. So, in some - * cases, there is no need for this PrintObjectList to maintain a reference to all of the objects - * returned, since they can be processed individually by the listener. - * Calling this method with a value of true will save memory in these cases, but the getObjectList() - * method will return an empty Enumeration, so this method only becomes useful if code has - * registered a PrintObjectListListener with this PrintObjectList. - * @see #addPrintObjectListListener - * @see #getObjects - * @see com.ibm.as400.access.PrintObjectListEvent#getObject - * @see com.ibm.as400.access.PrintObjectListListener#listObjectAdded - **/ - public void setCache(boolean f) - { - if (impl_ == null) chooseImpl(); - useCache_ = f; - impl_.setCache(f); - } - - /** - * Constructs a PrintObjectList object. - * It is a non-externalized constructor for JavaBeans that allows null system. - * - * @param objectType One of the Network Print Server "objects" listed in - * the NPDataStream class such as NPDataStream.SPOOLED_FILE. - * @param selectionCP A selection codepoint that will be used whenever the - * the list is built. - **/ - PrintObjectList(int objectType, - NPCPSelection selectionCP) - { - typeOfObject_ = objectType; - selection_ = selectionCP; - initializeTransient(); - } - - - - /** - * Constructs a PrintObjectList object. - * It is a non-externalized constructor. - * - * @param objectType One of the Network Print Server "objects" listed in - * the NPDataStream class such as NPDataStream.SPOOLED_FILE. - * @param selectionCP A selection codepoint that will be used whenever the - * the list is built. - * @param system The system on which the object(s) exists. - **/ - PrintObjectList(int objectType, - NPCPSelection selectionCP, - AS400 system) - { - this(objectType, selectionCP); - - if( system == null ) { - Trace.log(Trace.ERROR, "printObjectList: Parameter 'system' is null."); - throw new NullPointerException(SYSTEM); - } - system_ = system; - } - - - - /** - *Adds the specified PrintObjectList listener to receive - *PrintObjectList events from this print object list. - * - * @see #removePrintObjectListListener - * @param listener The PrintObjectList listener. - **/ - public /* @A5D synchronized*/ void addPrintObjectListListener( PrintObjectListListener listener ) - { - printObjectListListeners_.addElement( listener ); - // Add the listener to the impl_ for events fired from - // PrintObjectListImplRemote - // @A5D if (impl_ != null) - // @A5D impl_.addPrintObjectListListener(listener); - } - - - - /** - *Adds the specified PropertyChange listener to receive - *PropertyChange events from this print object list. - * - * @see #removePropertyChangeListener - * @param listener The PropertyChange listener. - **/ - public void addPropertyChangeListener( PropertyChangeListener listener ) - { - changes.addPropertyChangeListener( listener ); - } - - - - /** - *Adds the specified VetoableChange listener to receive - *VetoableChange events from this print object list. - * - * @see #removeVetoableChangeListener - * @param listener The VetoableChange listener. - **/ - public void addVetoableChangeListener( VetoableChangeListener listener ) - { - vetos.addVetoableChangeListener( listener ); - } - - - - /* - * Chooses the appropriate implementation (Proxy or Remote). - * Subclasses MUST supply the implementation to this method. - **/ - abstract void chooseImpl(); - - - - /** - *Closes the list so that objects in the list can be garbage collected. - **/ - public void close() - { - synchronized(this) - { - if (open_) { - // ASSERT: if the list has been opened, impl_ has been assigned - impl_.close(); - open_ = false; - } else { - // if the list was not open, return to avoid firing closed. - theList_.removeAllElements(); - return; - } - } - } - - - private PrintObjectListEvent createPrintObjectListEvent(int id, - PrintObject printObject, - Exception exception) - { - PrintObjectListEvent event; - - // Now that we know we have listeners, we construct - // the event object. We could have passed an event - // object to firePrintObjectList() but that would be - // extra overhead if there were no listeners. - if( exception !=null ) - { - event = new PrintObjectListEvent(this, exception); - } - else if( printObject != null ) - { - event = new PrintObjectListEvent(this, printObject); - } - else - { - event = new PrintObjectListEvent(this, id); - } - - return event; - } - - - private void firePrintObjectList(PrintObjectListEvent event) - { - event.setSource(this); - - // Return if no listeners are registered. - if( printObjectListListeners_.isEmpty() ) - { - return; - } - - Vector l /* @A5D ; - synchronized(this) { l*/ = (Vector)printObjectListListeners_.clone(); //} - - for( int i=0; i < l.size(); i++ ) - { - switch( event.getID() ) - { - // OBJECT_ADDED is the most frequent case. - case PrintObjectListEvent.OBJECT_ADDED: - PrintObject printObject = event.getObject(); - if (useCache_) theList_.addElement(printObject); - objectAddedEvent_ = true; - ((PrintObjectListListener)l.elementAt(i)).listObjectAdded(event); - break; - - case PrintObjectListEvent.CLOSED: - ((PrintObjectListListener)l.elementAt(i)).listClosed(event); - break; - - case PrintObjectListEvent.COMPLETED: - ((PrintObjectListListener)l.elementAt(i)).listCompleted(event); - break; - - case PrintObjectListEvent.ERROR_OCCURRED: - ((PrintObjectListListener)l.elementAt(i)).listErrorOccurred(event); - break; - - case PrintObjectListEvent.OPENED: - ((PrintObjectListListener)l.elementAt(i)).listOpened(event); - break; - } - } - } - - - - // The JavaBeans 1.0 Specification strongly recommends to avoid - // using a synchronized method to fire an event. We use a - // synchronized block to locate the target listeners and then - // call the event listeners from unsynchronized code. - private void firePrintObjectList(int id, - PrintObject printObject, - Exception exception ) - { - firePrintObjectList(createPrintObjectListEvent(id, printObject, exception)); - } - - - - /** - * Returns one object from the list. - * - * @param index The index of the desired object. - * - * @exception ArrayIndexOutOfBoundsException If an invalid index is given. - **/ - public /* @A5D synchronized*/ PrintObject getObject(int index) - { - if (!open_) - { - Trace.log(Trace.ERROR, "getObject: List has not been opened."); - throw new ExtendedIllegalStateException( - ExtendedIllegalStateException.OBJECT_MUST_BE_OPEN); - } - - // ASSERT: if the list has been opened, impl_ has been assigned - // @A5D return impl_.getObject(index); - synchronized(theList_) { - if ((theList_.size() > index) && ((listOutOfSync_ == false) - || ((listOutOfSync_ == true) && (objectAddedEvent_ == true) - && (theList_.size() == impl_.size())))) { - objectAddedEvent_ = false; - return (PrintObject) theList_.elementAt(index); - } - else { - PrintObject npobject = null; - if (listOutOfSync_ == true) { - theList_.removeAllElements(); - listOutOfSync_ = false; - } - if (useCache_) //@CRS - { - for (int i = theList_.size(); i <= index; ++i) { - NPCPID cpid = impl_.getNPCPID(i); - NPCPAttribute cpattr = impl_.getNPCPAttribute(i); - try { - cpid.setConverter((new Converter(system_.getCcsid(), system_)).impl); - cpattr.setConverter((new Converter(system_.getCcsid(), system_)).impl); - } - catch(UnsupportedEncodingException e) { - if (Trace.isTraceErrorOn()) - Trace.log(Trace.ERROR, "Error initializing converter for print object", e); - } - npobject = newNPObject(cpid, cpattr); - theList_.addElement(npobject); - } - return npobject; - } - return null; - } - } - } - - - - /** - * Returns an enumeration of the PrintObjects in the list. - * - **/ - public /* @A5D synchronized */ Enumeration getObjects() - { - if (!open_) - { - Trace.log(Trace.ERROR, "getObjects: List has not been opened."); - throw new ExtendedIllegalStateException( - ExtendedIllegalStateException.OBJECT_MUST_BE_OPEN); - } - - // ASSERT: if the list has been opened, impl_ has been assigned - // @A5D Vector v = impl_.getObjects(); - // @A5D return v.elements(); - - // Force retrieval of all objects so far. - getObject(impl_.size() - 1); - return theList_.elements(); - } - - - - NPCPSelection getSelectionCP() - { - return selection_; - } - - - - /** - * Returns the system name. This method is primarily provided for visual - * application builders that support JavaBeans. - * - * @return The system on which the objects in the list exist. - **/ - final public AS400 getSystem() - { - return system_; - } - - - - private void initializeTransient() - { - impl_ = null; - printObjectListListeners_ = new Vector(); - changes = new PropertyChangeSupport(this); - vetos = new VetoableChangeSupport(this); - theList_ = new Vector(); - open_ = false; - - dispatcher_ = new PrintObjectListListener() { - public void listClosed(PrintObjectListEvent event) { firePrintObjectList(event); } - public void listCompleted(PrintObjectListEvent event) { firePrintObjectList(event); } - public void listErrorOccurred(PrintObjectListEvent event) { firePrintObjectList(event); } - public void listOpened(PrintObjectListEvent event) { firePrintObjectList(event); } - public void listObjectAdded(PrintObjectListEvent event) { firePrintObjectList(event); } - }; - } - - - - /** - * Checks if a list that was opened asynchronously has completed. - * If any exception occurred while the list was being retrieved, it will - * be thrown here. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception RequestNotSupportedException If the requested function is not supported because - * the system operating system is not at the correct level. - * @return true if the list is completely built; false otherwise. - **/ - public boolean isCompleted() - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - RequestNotSupportedException - { - if (!open_) { - Trace.log(Trace.ERROR, "isCompleted: List has not been opened."); - throw new ExtendedIllegalStateException( - ExtendedIllegalStateException.OBJECT_MUST_BE_OPEN); - } - // ASSERT: if the list has been opened, impl_ has been assigned - return impl_.isCompleted(); - } - - - - // Not public! - abstract PrintObject newNPObject(NPCPID cpid, NPCPAttribute cpattr); - - - - /** - * Builds the list asynchronously. This method starts a thread - * to build the list and then returns. The caller may register - * listeners to obtain status about the list, or call isCompleted(), - * waitForItem(), or waitForListToComplete(). - **/ - public void openAsynchronously() - { - synchronized (this) - { - if (open_) { - // list is already open. - Trace.log(Trace.ERROR, "open: List is already opened."); - throw new ExtendedIllegalStateException( - ExtendedIllegalStateException.OBJECT_CAN_NOT_BE_OPEN); - } - - if (impl_ == null) { - if (system_ == null) { - // forewarn any listeners an error occurs. - Exception e = new ExtendedIllegalStateException(SYSTEM, - ExtendedIllegalStateException.PROPERTY_NOT_SET); - firePrintObjectList(PrintObjectListEvent.ERROR_OCCURRED, null, e); - } - chooseImpl(); - } - - if (!getSystem().isThreadUsed()) { - // Our system object says do not start threads.The - // application should be using openSynchronously(). - Trace.log(Trace.ERROR, "open: Threads can not be started."); - throw new ExtendedIllegalStateException( - ExtendedIllegalStateException.OBJECT_CAN_NOT_START_THREADS); - } - - open_ = true; - listOutOfSync_ = true; - impl_.openAsynchronously(); - } - } - - - - /** - * Builds the list synchronously. This method will not - * return until the list has been built completely. - * The caller may then call the getObjects() method - * to get an enumeration of the list. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system operating system is not at the correct level. - **/ - public void openSynchronously() - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - RequestNotSupportedException - { - synchronized(this) - { - if( open_ ) { - // list is already open. - Trace.log(Trace.ERROR, "open: List is already opened."); - throw new ExtendedIllegalStateException( - ExtendedIllegalStateException.OBJECT_CAN_NOT_BE_OPEN); - } - - if (impl_ == null) { - if (system_ == null) { - // forewarn any listeners an error occurs. - Exception e = new ExtendedIllegalStateException(SYSTEM, - ExtendedIllegalStateException.PROPERTY_NOT_SET); - firePrintObjectList(PrintObjectListEvent.ERROR_OCCURRED, null, e); - } - chooseImpl(); - } // Bugfix 1551918 - open_ = true; - listOutOfSync_ = true; - impl_.openSynchronously(); - //} // Bugfix 1551918 - } - } - - - // We need to initialize our transient and static data when - // the object is de-serialized. static final data is OK. - private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient(); - } - - - - /** - *Removes the specified PrintObjectList listener - *so that it no longer receives PrintObjectList events - *from this print object list. - * - * @see #addPrintObjectListListener - * @param listener The PrintObjectList listener. - **/ - public /* @A5D synchronized */ void removePrintObjectListListener( PrintObjectListListener listener ) - { - printObjectListListeners_.removeElement(listener); - // Remove the listener from the impl_ - no longer monitoring for events - // fired from PrintObjectListImplRemote - // @A5D if (impl_ != null) - // @A5D impl_.removePrintObjectListListener(listener); - } - - - - /** - *Removes the specified PropertyChange listener - *so that it no longer receives PropertyChange events - *from this print object list. - * - * @see #addPropertyChangeListener - * @param listener The PropertyChange listener. - **/ - public void removePropertyChangeListener( PropertyChangeListener listener ) - { - changes.removePropertyChangeListener(listener); - } - - - - /** - *Removes the specified VetoableChange listener - *so that it no longer receives VetoableChange events - *from this print object list. - * - * @see #addVetoableChangeListener - * @param listener The VetoableChange listener. - **/ - public void removeVetoableChangeListener( VetoableChangeListener listener ) - { - vetos.removeVetoableChangeListener(listener); - } - - - - /** - * Resets the list of object attributes to retrieve. - **/ - public void resetAttributesToRetrieve() - { - if (open_) - { - Trace.log(Trace.ERROR, "resetAttributesToRetrieve: List is already opened."); - throw new ExtendedIllegalStateException( - ExtendedIllegalStateException.OBJECT_CAN_NOT_BE_OPEN); - } - else { - attrsToRetrieve_ = null; - if (impl_ != null) - impl_.resetAttributesToRetrieve(); - } - } - - - - /** - * Resets the list filter back to default values. - **/ - public void resetFilter() - { - if (open_) - { - Trace.log(Trace.ERROR, "resetFilter: List is already opened."); - throw new ExtendedIllegalStateException( - ExtendedIllegalStateException.OBJECT_CAN_NOT_BE_OPEN); - } - else { - selection_.reset(); - idFilter_ = null; // effectively resets the id Codepoint filter; - if (impl_ != null) - impl_.resetFilter(); - } - } - - - - /** - * Sets the attributes of the object that should be returned in the list. - * This method can be used to speed up the listing if - * only interested in a few attributes for each item in the list. - * - * @param attributes An array of attribute IDs that define which - * object attributes will be retrieved for each item in the list - * when the list is opened. - * - * @see PrintObject - **/ - public synchronized void setAttributesToRetrieve(int[] attributes) - { - // check params - if (attributes == null) - { - Trace.log(Trace.ERROR, "setAttributesToRetrieve: Parameter 'attributes' is null."); - throw new NullPointerException("attributes"); - } - - // check state of list - if (open_) - { - Trace.log(Trace.ERROR, "setAttributesToRetrieve: List is already opened."); - throw new ExtendedIllegalStateException( - ExtendedIllegalStateException.OBJECT_CAN_NOT_BE_OPEN); - } - - if (attrsToRetrieve_ != null) - { - attrsToRetrieve_.reset(); - } - else { - attrsToRetrieve_ = new NPCPAttributeIDList(); - } - - for (int i = 0; i OBJECT_ADDED) ) - { - throw new ExtendedIllegalArgumentException("id", - ExtendedIllegalArgumentException.RANGE_NOT_VALID ); - } - - id_ = id; - printObject_ = null; - exception_ = null; - } - - /** - * Constructs an PrintObjectListEvent object. It uses the specified - * source and exception. - * - * @param source The object sourcing the event. - * @param e The exception that occurred while retrieving the list. - **/ - public PrintObjectListEvent( Object source, Exception e ) - { - super( source ); - - id_ = PrintObjectListEvent.ERROR_OCCURRED; - printObject_ = null; - exception_ = e; - } - - /** - * Constructs an PrintObjectListEvent object. It uses the specified - * source and print object. - * - * @param source The object sourcing the event. - * @param printObject The print object that was added to the list. - **/ - public PrintObjectListEvent( Object source, PrintObject printObject) - { - super( source ); - - id_ = PrintObjectListEvent.OBJECT_ADDED; - printObject_ = printObject; - exception_ = null; - } - - - PrintObjectListEvent(Object source, NPCPID cpid, NPCPAttribute cpattr) - { - super(source); - id_ = PrintObjectListEvent.OBJECT_ADDED; - cpid_ = cpid; - cpattr_ = cpattr; - } - - - - /** - * Returns the exception that occurred while retrieving - * the list. If there was no exception, null is returned. - * @return The exception that occurred while retrieving the list. - **/ - public Exception getException() - { - return exception_; - } - - /** - * Returns the print object list event identifier. - * @return The event identifier. - * - **/ - public int getID() - { - return id_; - } - - /** - * Returns the print object added to the list. If an object - * was not added to the list for this event, null is returned. - * - * @return The print object added to the list. - */ - - public PrintObject getObject() - { - if (printObject_ == null) - printObject_ = ((PrintObjectList)source).newNPObject(cpid_, cpattr_); - return printObject_; - } - - - void setSource(Object s) - { - source = s; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/PrintObjectListImpl.java b/cvsroot/src/com/ibm/as400/access/PrintObjectListImpl.java deleted file mode 100644 index 079998285..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintObjectListImpl.java +++ /dev/null @@ -1,132 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintObjectListImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Vector; -import java.io.IOException; - -/** - * The PrintObjectListImpl interface defines a set of methods - * needed for a full implementation of the PrintObjectList class. - **/ - -interface PrintObjectListImpl -{ - - public abstract void setCache(boolean f); - - public abstract void addPrintObjectListListener(PrintObjectListListener listener); - - - - public abstract void close(); - - - - // @A5D public abstract PrintObject getObject(int index); - public abstract NPCPID getNPCPID(int index); - public abstract NPCPAttribute getNPCPAttribute(int index); - - - - // @A5D public abstract Vector getObjects(); - - - - public abstract boolean isCompleted() - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - RequestNotSupportedException; - - - - public abstract void openAsynchronously(); - - - - public abstract void openSynchronously() - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - RequestNotSupportedException; - - - - public abstract void removePrintObjectListListener(PrintObjectListListener listener); - - - - public abstract void resetAttributesToRetrieve(); - - - - public abstract void resetFilter(); - - - - public abstract void setAttributesToRetrieve(int[] attributes); - - - - public abstract void setIDCodePointFilter(NPCPID cpID); - - - - public abstract void setFilter(String filterType, String filter); - - - - public abstract void setPrintObjectListAttrs(NPCPAttributeIDList attrsToRetrieve, - NPCPID idFilter, - NPCPSelection selection, - int typeOfObject); - - - - public abstract void setSystem(AS400Impl system); - - - - public abstract int size(); - - - - public abstract void waitForItem(int itemNumber) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - RequestNotSupportedException; - - - - public abstract void waitForListToComplete() - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - RequestNotSupportedException; - -} diff --git a/cvsroot/src/com/ibm/as400/access/PrintObjectListImplProxy.java b/cvsroot/src/com/ibm/as400/access/PrintObjectListImplProxy.java deleted file mode 100644 index 4ae2c793c..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintObjectListImplProxy.java +++ /dev/null @@ -1,332 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintObjectListImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.util.Vector; -import java.io.IOException; - -/** - * The PrintObjectListImplProxy class implements proxy versions of - * the public methods defined in the PrintObjectListImpl class. - * Unless commented otherwise, the implementations of the methods below - * are merely proxy calls to the corresponding method in the remote - * implementation class (PrintObjectListImplRemote). - **/ - -abstract class PrintObjectListImplProxy -extends AbstractProxyImpl -implements PrintObjectListImpl, ProxyImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - PrintObjectListImplProxy(String className) - { - super(className); - } - - - - public void addPrintObjectListListener( PrintObjectListListener listener ) - { - connection_.addListener(pxId_, listener, "PrintObjectList"); - } - - - - public void close() - { - try { - connection_.callMethod(pxId_, "close"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - /* - public PrintObject getObject(int index) - { - try { - return (PrintObject) connection_.callMethod(pxId_, "getObject", - new Class[]{ Integer.TYPE }, - new Object[] { new Integer(index) }).getReturnValue(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - */ - - public void setCache(boolean b) - { - try - { - connection_.callMethod(pxId_, "setCache", new Class[] { Boolean.TYPE }, new Object[] { new Boolean(b) }); - } - catch(InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - public NPCPID getNPCPID(int index) - { - try { - return (NPCPID) connection_.callMethod(pxId_, "getNPCPID", - new Class[]{ Integer.TYPE }, - new Object[] { new Integer(index) }).getReturnValue(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - public NPCPAttribute getNPCPAttribute(int index) - { - try { - return (NPCPAttribute) connection_.callMethod(pxId_, "getNPCPAttribute", - new Class[]{ Integer.TYPE }, - new Object[] { new Integer(index) }).getReturnValue(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - /* - public Vector getObjects() - { - try { - return (Vector) connection_.callMethod(pxId_, "getObjects").getReturnValue(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - */ - - - - public boolean isCompleted() - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - RequestNotSupportedException - { - try { - return (boolean) connection_.callMethod(pxId_, "isCompleted").getReturnValueBoolean(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public void openAsynchronously() - { - try { - connection_.callMethod(pxId_, "openAsynchronously"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - public void openSynchronously() - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - RequestNotSupportedException - - { - try { - connection_.callMethod(pxId_, "openSynchronously"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public void removePrintObjectListListener( PrintObjectListListener listener ) - { - connection_.removeListener(pxId_, listener, "PrintObjectList"); - } - - - - public void resetAttributesToRetrieve() - { - try { - connection_.callMethod(pxId_, "resetAttributesToRetrieve"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - public void resetFilter() - { - try { - connection_.callMethod(pxId_, "resetFilter"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - public void setAttributesToRetrieve(int[] attributes) - { - try { - connection_.callMethod(pxId_, "setAttributesToRetrieve", - new Class[] { int[].class }, - new Object[] { attributes }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - public void setIDCodePointFilter(NPCPID cpID) - { - try { - connection_.callMethod(pxId_, "setIDCodePointFilter", - new Class[] { NPCPID.class }, - new Object[] { cpID }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - public void setFilter(String filterType, String filter) - { - try { - connection_.callMethod(pxId_, "setFilter", - new Class[] { String.class, String.class }, - new Object[] { filterType, filter }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - public void setPrintObjectListAttrs(NPCPAttributeIDList attrsToRetrieve, - NPCPID idFilter, - NPCPSelection selection, - int typeOfObject) - { - try { - connection_.callMethod(pxId_, "setPrintObjectListAttrs", - new Class[] { NPCPAttributeIDList.class, - NPCPID.class, NPCPSelection.class, - Integer.TYPE}, - new Object[] { attrsToRetrieve, idFilter, selection, new Integer(typeOfObject) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - public void setSystem(AS400Impl system) - { - try { - connection_.callMethod(pxId_, "setSystem", - new Class[] { AS400Impl.class }, - new Object[] { system }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - public int size() - { - try { - return connection_.callMethod(pxId_, "size").getReturnValueInt(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - public void waitForItem(int itemNumber) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "waitForItem", - new Class[] { Integer.TYPE }, - new Object[] { new Integer(itemNumber) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public void waitForListToComplete() - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "waitForListToComplete"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/PrintObjectListImplRemote.java b/cvsroot/src/com/ibm/as400/access/PrintObjectListImplRemote.java deleted file mode 100644 index 291e9a571..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintObjectListImplRemote.java +++ /dev/null @@ -1,890 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintObjectListImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Vector; -import java.io.IOException; - - -/** - * The PrintObjectList class is an abstract base class for the various types of network print object lists. -**/ -abstract class PrintObjectListImplRemote implements PrintObjectListImpl, Runnable -{ - private static final String copyright = "Copyright (C) 1997-2002 International Business Machines Corporation and others."; - - // These instance variable are persistent. - private NPCPAttributeIDList attrsToRetrieve_; - private NPCPID idFilter_; // for certain lists an idcodepoint may be used to filter - private NPCPSelection selection_; // selection filter - private AS400ImplRemote system_; // @A4 - changed from AS400 to AS400ImplRemote - private int typeOfObject_ = 0; // indicates object type - - // These instance variables are not persistent. - private transient boolean completed_ = false; - private transient boolean closed_ = false; - private final Object closeLock_ = new Object(); - private transient boolean waiting_ = false; - private final Object waitLock_ = new Object(); - private transient int waitingForItem_ = -1; - private transient Vector cpidList_ = null; // @A5A - private transient Vector cpattrList_ = null; // @A5A - private transient int numItems_ = 0; - - private transient Exception anyException_ = null; - private transient Vector printObjectListListeners_ = null; - - private boolean useCache_ = true; - - /** - *Adds the specified PrintObjectList listener to receive - *PrintObjectList events from this print object list. - * - * @see #removePrintObjectListListener - * @param listener The PrintObjectList listener. - **/ - public void addPrintObjectListListener(PrintObjectListListener listener) - { - if (printObjectListListeners_ == null) printObjectListListeners_ = new Vector(); - synchronized(printObjectListListeners_) - { - printObjectListListeners_.addElement(listener); - } - } - - - /** - * This method does all of the datastream work and object creations. - **/ - private void buildList() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - RequestNotSupportedException - { - - NPSystem npSystem = NPSystem.getSystem(getSystem()); - if (npSystem != null) - { - NPConversation conversation = npSystem.getConversation(); - try - { - if (conversation != null) - { - boolean fTossData = false; - boolean fMoreData = true; - int count = 0; - // @B1D int ccsid = conversation.getHostCCSID(); - ConverterImpl converter = conversation.getConverter(); // @B1A - AS400Server server = conversation.getServer(); - int correlation = server.newCorrelationId(); - NPDataStream request = new NPDataStream(typeOfObject_); - NPDataStream reply; - request.setCorrelation(correlation); - request.setAction(NPDataStream.LIST); - // @B1D request.setHostCCSID(ccsid); - request.setConverter(converter); // @B1A - if (selection_ != null) - { - request.addCodePoint(selection_); - } - if (idFilter_ != null) - { - request.addCodePoint(idFilter_); - } - if (attrsToRetrieve_ != null) - { - request.addCodePoint(attrsToRetrieve_); - } - else - { - request.addCodePoint(getDefaultAttrsToList()); - } - server.send(request, correlation); - do - { - reply = (NPDataStream)server.receive(correlation); - if (reply == null) - { - // throw execption - internal error. - fMoreData = false; - Trace.log(Trace.ERROR, "buildList: Null reply from AS400Server.receive()!"); - throw new InternalErrorException(InternalErrorException.PROTOCOL_ERROR); - } - else - { - count++; - fMoreData = !(reply.isLastReply()); - if (!fTossData) - { - // we are going to keep this reply so set the - // ccsid so it can tranlsate its text correctly - // @B1D reply.setHostCCSID(ccsid); - reply.setConverter(converter); // @B1A - int rc = reply.getReturnCode(); - if (rc == NPDataStream.RET_OK) - { - // @A5D PrintObject npObject = newNPObject(getSystem(), reply); - NPCPID cpid = newNPCPID(reply); // @A5A - NPCPAttribute cpattr = newNPCPAttribute(reply); // @A5A - if (cpid != null) // @A5C - { - synchronized(closeLock_) // In case someone tries to close us before we're finished. - { - if (closed_ || completed_) // Don't add the item if we've been closed already. - { - // the list has been closed before - // it completed, start tossing any - // incoming data... - fTossData = true; - } - else - { - if (useCache_) cpidList_.addElement(cpid); - if (useCache_) cpattrList_.addElement(cpattr); - ++numItems_; - // tell any listeners an object was added to the list. // @A2A - firePrintObjectList(PrintObjectListEvent.OBJECT_ADDED, cpid, cpattr, null); // @A5A - - if (waiting_ && waitingForItem_ <= numItems_ && waitingForItem_ > -1) - { - // Only notify if someone is waiting to be notified. - synchronized(waitLock_) - { - waitLock_.notifyAll(); - } - } - } - } - } - } - else - { - if (rc == NPDataStream.RET_CPF_MESSAGE) - { - NPCPAttribute cpCPFMessage = (NPCPAttribute)reply.getCodePoint(NPCodePoint.ATTRIBUTE_VALUE); - if (cpCPFMessage != null) - { - String strCPFMessageID = cpCPFMessage.getStringValue(PrintObject.ATTR_MSGID); - String strCPFMessageText = cpCPFMessage.getStringValue(PrintObject.ATTR_MSGTEXT); - String strCPFMessageHelp = cpCPFMessage.getStringValue(PrintObject.ATTR_MSGHELP); - if (Trace.traceOn_) Trace.log(Trace.ERROR, "buildList: CPF Message("+strCPFMessageID+") = " + strCPFMessageText + ", HelpText= " +strCPFMessageHelp); //@CRS - // Create an AS400Message object - AS400Message msg = new AS400Message(strCPFMessageID, strCPFMessageText); - msg.setHelp(strCPFMessageHelp); - AS400Exception e = new AS400Exception(msg); - // throw an exception containing our CPF message. - // our catcher will actually fire the error event. - throw e; - } - } - else - { - if (rc == NPDataStream.RET_EMPTY_LIST) - { - // the list is empty, that isn't an error. - } - else - { - // look at RC and throw appropriate exception - Trace.log(Trace.ERROR, "buildList: Host Return Code" + rc); - // we get back a 4 (INV_REQ_ACT) if we try to list - // AFP Resources on pre V3R7 systems.. - if (rc == NPDataStream.RET_INV_REQ_ACT) - { - throw new RequestNotSupportedException(conversation.getAttribute(PrintObject.ATTR_NPSLEVEL), - RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - } - else - { - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.AS400_ERROR, - "QNPSERVS RC = " + rc); - } - } - } - } - } - } - // every 15 datastreams that we get we'll call to the - // garbage collector to keep the VM from running out of - // of memory -//@C0 - This is a serious performance bottleneck and should no longer be -// necessary under today's "modern" JVMs. -//@C0D if ((count % 15) == 0) -//@C0D { -//@C0D System.gc(); -//@C0D } - } while (fMoreData); - } - } - finally - { - npSystem.returnConversation(conversation); - } - } - } - - - - // The sub classes have default constructors implemented - // for JavaBean support in visual builders. We need to - // check the run time state of the object. The sub classes - // may add additional checks by having their own - // checkRunTimeState(), but will call super.checkRunTimeState() - // to get this check. - void checkRunTimeState() - { - if (getSystem() == null) - { - Trace.log(Trace.ERROR, "checkRunTimeState: Parameter 'system' has not been set."); - throw new ExtendedIllegalStateException( - "system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - - - - /** - * Closes the list so that objects in the list can be garbage collected. - **/ - public void close() - { - synchronized(closeLock_) - { - closed_ = true; - cpidList_ = null; // @A5A - cpattrList_ = null; // @A5A - numItems_ = 0; //@CRS - anyException_ = null; - } - - // tell any listeners the list was closed. - firePrintObjectList(PrintObjectListEvent.CLOSED, null, null, null); // @A5C - - // At this point, all other threads that are using us should not be - // firing events. - } - - - - // The JavaBeans 1.0 Specification strongly recommends to avoid - // using a synchronized method to fire an event. We use a - // synchronized block to locate the target listeners and then - // call the event listeners from unsynchronized code. - private void firePrintObjectList(int id, - NPCPID cpid, // @A5A - NPCPAttribute cpattr, // @A5A - Exception exception ) - { - // Return if no listeners are registered. - if (printObjectListListeners_ == null) //@CRS - { - return; - } - - PrintObjectListEvent event; - - // Now that we know we have listeners, we construct - // the event object. We could have passed an event - // oject to firePrintObjectList() but that would be - // extra overhead if there were no listeners. - if (exception !=null) - { - event = new PrintObjectListEvent(this, exception); - } - else if (cpid != null) // @A5D - { - event = new PrintObjectListEvent(this, cpid, cpattr); // @A5D - } - else - { - event = new PrintObjectListEvent(this, id); - } - - synchronized(printObjectListListeners_) // We don't want listeners being added/removed while we're firing an event. - { - int size = printObjectListListeners_.size(); - - for (int i=0; i < size; i++) - { - switch (id) - { - // OBJECT_ADDED is the most frequent case. - case PrintObjectListEvent.OBJECT_ADDED: - ((PrintObjectListListener)printObjectListListeners_.elementAt(i)).listObjectAdded(event); - break; - - case PrintObjectListEvent.CLOSED: - ((PrintObjectListListener)printObjectListListeners_.elementAt(i)).listClosed(event); - break; - - case PrintObjectListEvent.COMPLETED: - ((PrintObjectListListener)printObjectListListeners_.elementAt(i)).listCompleted(event); - break; - - case PrintObjectListEvent.ERROR_OCCURRED: - ((PrintObjectListListener)printObjectListListeners_.elementAt(i)).listErrorOccurred(event); - break; - - case PrintObjectListEvent.OPENED: - ((PrintObjectListListener)printObjectListListeners_.elementAt(i)).listOpened(event); - break; - } - } - } - } - - - - /** - * Non-externalized abstract method that the child-classes implement to - * set the default attributes to retrieve on the list - **/ - abstract NPCPAttributeIDList getDefaultAttrsToList(); - - - // @A5A - public synchronized NPCPID getNPCPID(int index) - { - return(NPCPID)cpidList_.elementAt(index); - } - - // @A5A - public synchronized NPCPAttribute getNPCPAttribute(int index) - { - return(NPCPAttribute)cpattrList_.elementAt(index); - } - - - // This method is called by subclassed ImplRemotes - NPCPSelection getSelectionCP() - { - return selection_; - } - - - /** - * Returns the system name. This method is primarily provided for visual - * application builders that support JavaBeans. - * - * @return The system on which the objects in the list exist. - **/ - final public AS400ImplRemote getSystem() - { - return system_; - } - - - - /** - * Checks if a list that was opened asynchronously has completed. - * If any exception occurred while the list was being retrieved, it will - * be thrown here. - * - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception RequestNotSupportedException If the requested function is not supported because - * the server operating system is not at the correct level. - * @return true if the list is completely built; false otherwise. - **/ - public boolean isCompleted() - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - RequestNotSupportedException - { - if (anyException_ != null) - { - rethrowException(); - } - - return completed_; - } - - - - /** - * Non-externalized abstract method that child-classes implement to - * create the correct type of object from the reply datastream - **/ - abstract NPCPID newNPCPID(NPDataStream reply); // @A5A - - - - // @A5A - NPCPAttribute newNPCPAttribute(NPDataStream reply) - { - return(NPCPAttribute)reply.getCodePoint(NPCodePoint.ATTRIBUTE_VALUE); // may return null - } - - - /** - * Builds the list asynchronously. This method starts a thread - * to build the list and then returns. The caller may register - * listeners to obtain status about the list, or call isCompleted(), - * waitForItem(), or waitForListToComplete(). - **/ - public void openAsynchronously() - { - checkRunTimeState(); - - // Start thread to build the list. We are runnable, and - // so our run() method just calls openSynchronously(). - Thread t = new Thread(this); - t.start(); - } - - - /** - * Builds the list synchronously. This method will not - * return until the list has been built completely. - * The caller may then call the getObjects() method - * to get an enumeration of the list. - * - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ConnectionDroppedException If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the server. - * @exception RequestNotSupportedException If the requested function is not supported because the - * server operating system is not at the correct level. - **/ - public void openSynchronously() - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - RequestNotSupportedException - { - // check the run time state of the object. To support JavaBeans - // the sub-classes provide null constructors. - checkRunTimeState(); - - AS400ImplRemote theSystem = getSystem(); - if (theSystem != null) - { // @A1A - NPSystem npSystem = NPSystem.getSystem(theSystem); // @A1A - if (npSystem != null) // @A1A - { - // @A1A - NPConversation conversation = npSystem.getConversation(); // @A1A - npSystem.returnConversation(conversation); // @A1A - } // @A1A - } // @A1A - - cpidList_ = new Vector(); // @A5A - cpattrList_ = new Vector(); // @A5A - numItems_ = 0; - completed_ = false; // @A2A - closed_ = false; // @A6A - anyException_ = null; // @A2A - - // tell any listeners the list was opened. // @A2A - firePrintObjectList(PrintObjectListEvent.OPENED, null, null, null); // @A2A @A5C - - try // @A2A - { - buildList(); - } // @A2A - catch (Exception e) // @A2A - { - anyException_ = e; // @A2A - - // tell any listeners an error occurred. // @A2A - firePrintObjectList(PrintObjectListEvent.ERROR_OCCURRED, null, null, e); // @A2A @A5C - } // @A2A - finally // @A2A - { - // tell any listeners the list completed. // @A2A - firePrintObjectList(PrintObjectListEvent.COMPLETED, null, null, null); // @A2A @A5C - synchronized(waitLock_) // Notify anyone who is waiting for an item or the list to complete. - { - completed_ = true; - waitLock_.notifyAll(); - } - } // @A2A - - // we caught the exception above so that we could notify any // @A2A - // listeners. Now, rethrow the exception for applications // @A2A - // that may not be using listeners. // @A2A - if (anyException_ != null) // @A2A - { - // @A2A - rethrowException(); // @A2A - } // @A2A - } - - - - /** - *Removes the specified PrintObjectList listener - *so that it no longer receives PrintObjectList events - *from this print object list. - * - * @see #addPrintObjectListListener - * @param listener The PrintObjectList listener. - **/ - public void removePrintObjectListListener( PrintObjectListListener listener ) - { - if (printObjectListListeners_ != null) - { - synchronized(printObjectListListeners_) - { - printObjectListListeners_.removeElement(listener); - } - } - } - - - - /** - * Resets the list of object attributes to retrieve. - **/ - public void resetAttributesToRetrieve() - { - attrsToRetrieve_ = null; - } - - - - /** - * Resets the list filter back to default values. - **/ - public void resetFilter() - { - selection_.reset(); - idFilter_ = null; // effectively resets the id Codepoint filter; - } - - - - // Rethrow any exception. - private void rethrowException() - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - RequestNotSupportedException - { - if (anyException_ instanceof AS400Exception) - throw (AS400Exception)anyException_; - if (anyException_ instanceof AS400SecurityException) - throw (AS400SecurityException)anyException_; - if (anyException_ instanceof ConnectionDroppedException) - throw (ConnectionDroppedException)anyException_; - if (anyException_ instanceof ErrorCompletingRequestException) - throw (ErrorCompletingRequestException)anyException_; - if (anyException_ instanceof InterruptedException) - throw (InterruptedException)anyException_; - if (anyException_ instanceof IOException) - throw (IOException)anyException_; - if (anyException_ instanceof RequestNotSupportedException) - throw (RequestNotSupportedException)anyException_; - - // runtime exceptions - - if (anyException_ instanceof ExtendedIllegalStateException) - throw (ExtendedIllegalStateException)anyException_; - if (anyException_ instanceof NullPointerException) - throw (NullPointerException)anyException_; - - // If we get here we are getting an exception we overlooked, - // trace it for debugging. - - Trace.log(Trace.ERROR, "rethrowException: Exception was not rethrown."); - } - - - - /** - * This is called automatically when Thread.start() is called by openAsynchronously(). - **/ - public void run() - { - try - { - openSynchronously(); - } - catch (Exception e) - { - anyException_ = e; - } - } - - - - /** - * Sets the attributes of the object that should be returned in the list. - * This method can be used to speed up the listing if - * only interested in a few attributes for each item in the list. - * - * @param attributes An array of attribute IDs that define which - * object attributes will be retrieved for each item in the list - * when the list is opened. - * - * @see PrintObject - **/ - public void setAttributesToRetrieve(int[] attributes) - { - // check params - if (attributes == null) - { - Trace.log(Trace.ERROR, "setAttributesToRetrieve: Parameter 'attributes' is null."); - throw new NullPointerException("attributes"); - } - - if (attrsToRetrieve_ != null) - { - attrsToRetrieve_.reset(); - } - else - { - attrsToRetrieve_ = new NPCPAttributeIDList(); - } - - for (int i = 0; iPrintParameterList -used to create an instance of the class. -

    -The number of pages in the spooled file may be estimated. To help process -spooled files with estimated page counts, methods nextPage, previousPage, and -selectPage will return false if the requested page is not available. -

    -An instance of this class is created -using the getPageInputStream method -from the class SpooledFile. -

    -NOTE: This class is supported on OS/400 V4R4 or later. -Not all spooled file formats are supported for transform. -**/ - -public class PrintObjectPageInputStream extends InputStream -{ - // Private data - - transient private AS400 system_; - transient private PrintObjectPageInputStreamImpl impl_; - -/** -Constructs a PrintObjectPageInputStream object. - -@param spooledFile The SpooledFile. -@param openOptions The PrintParameterList options to be used when opening the SpooledFile. - -@exception AS400Exception If the system returns an error message. -@exception AS400SecurityException If a security or authority error occurs. -@exception ErrorCompletingRequestException If an error occurs before the request is completed. -@exception IOException If an error occurs while communicating with the system. -@exception InterruptedException If this thread is interrupted. -@exception RequestNotSupportedException If the requested function is not supported because the - system operating system is not at the correct level. -**/ - PrintObjectPageInputStream(SpooledFile spooledFile, - PrintParameterList openOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - system_ = spooledFile.getSystem(); - chooseImpl(); - // do connect here because it could throw Exceptions - system_.connectService(AS400.PRINT); - if (spooledFile.getImpl() == null) { - spooledFile.chooseImpl(); - } - impl_.createPrintObjectPageInputStream((SpooledFileImpl) spooledFile.getImpl(), openOptions); - } - - - -/** -Returns the number of bytes remaining in the current page. - -@return The number of available bytes (without blocking) in the current page. -**/ - public int available() throws IOException - { - return impl_.available(); - } - - - - // A2A - Added method - private void chooseImpl() - { - if (system_ == null) { - Trace.log( Trace.ERROR, "Attempt to use PrintObjectPageInputStream before setting system."); - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - impl_ = (PrintObjectPageInputStreamImpl) system_.loadImpl2("com.ibm.as400.access.PrintObjectPageInputStreamImplRemote", - "com.ibm.as400.access.PrintObjectPageInputStreamImplProxy"); - } - - - -/** -Closes the input stream and releases any resources associated with it. - -@exception IOException If an error occurs while communicating with the system. -**/ - public void close() throws IOException - { - impl_.close(); - } - - - -/** -Returns the number of the current page of the input stream. - -@return The number of the current page. -**/ - public int getCurrentPageNumber() - { - return impl_.getCurrentPageNumber(); - } - - - -/** -Returns the number of pages in the stream. - -@return The number of pages in the stream. -**/ - public int getNumberOfPages() - { - return impl_.getNumberOfPages(); - } - - - -/** -Indicates if the number of pages is estimated. - -@return True if the number of pages is estimated; false otherwise. -**/ - public boolean isPagesEstimated() - { - return impl_.isPagesEstimated(); - } - - - -/** -Marks the current position of the current page of the input stream. - -A subsequent call to reset() will reposition the stream at the -last marked position, so that subsequent reads will reread the same bytes. -The stream promises to allow readLimit bytes to be read before the -mark position gets invalidated, provided readLimit does not exceed amount -of page data available, in which case the readLimit is set to a value -equal to the amount of data available until the end of the page is reached. - - -@param readLimit The maximum limit of bytes allowed to be read before -the mark position is no longer valid. -**/ - public void mark(int readLimit) - { - impl_.mark(readLimit); - } - - - -/** -Returns a boolean indicating whether this stream type supports mark and reset. - -@return Always true. Objects of this class will support the mark and reset methods. -**/ - public boolean markSupported() - { - return true; - } - - - -/** -Repositions the stream to the next page. - -@return True if the stream is positioned to the next page; false otherwise. - -@exception IOException If an error occurs while communicating with the system. -**/ - public boolean nextPage() throws IOException - { - return impl_.nextPage(); - } - - - -/** -Repositions the stream to the previous page. - -@return True if the stream is positioned to the previous page; -false otherwise. - -@exception IOException If an error occurs while communicating with the system. -**/ - public boolean previousPage() throws IOException - { - return impl_.previousPage(); - } - - - -/** -Reads the next byte of data from this input stream. - -@return The byte read, or -1 if the end of the page stream is reached. - -@exception IOException If an error occurs while communicating with the system. -**/ - public int read() throws IOException - { - int readchar = -1; - - byte oneByte[] = new byte[1]; - int rc = read(oneByte, 0, 1); - if (rc == 1) { - readchar = (int)oneByte[0]; - } - return readchar; - } - - - -/** -Reads up to data.length bytes of data from the page input -stream into data. - -@param data The buffer into which the data is read. - -@return The total number of bytes read into the buffer or -1 if there is no more -data because the end of the page stream has been reached. - -@exception IOException If an error occurs while communicating with the system. -**/ - public int read(byte[] data) throws IOException - { - return read(data, 0, data.length); - } - - - -/** -Reads up to length bytes of data from this input stream into data, -starting at the array offset dataOffset. - -@param data The buffer into which the data is read. -@param dataOffset The start offset of the data. -@param length The maximum number of bytes to read. - -@return The total number of bytes read into the buffer, or -1 if there is -no more data because the end of the page stream has been reached. - -@exception IOException If an error occurs while communicating with the system. -**/ - public int read(byte data[], int dataOffset, int length) throws IOException - { - return impl_.read(data, dataOffset, length); - } - - - -/** -Repositions the stream to the last marked position. -If the stream has not been marked or if the mark has been invalidated, -an IOException is thrown. - -@exception IOException If an error occurs while communicating with the system. -**/ - public void reset() throws IOException - { - impl_.reset(); - } - - - -/** -Repositions the stream to page page. - -@param page The page at which to reposition the input stream. - -@return True if the stream is positioned to the specified page; false otherwise. - -@exception IOException If an error occurs while communicating with the system, -or an error occurs selecting the specified page. -@exception IllegalArgumentException If page is negative. -**/ - public boolean selectPage(int page) throws IOException, IllegalArgumentException - { - return impl_.selectPage(page); - } - - - -/** -Skips over the next bytesToSkip bytes in the stream. -This method may skip less bytes than specified if the end of -the page is reached. The actual number of bytes skipped is returned. -No action is taken if the number of bytes to skip is not positive. - -@param bytesToSkip The number of bytes to be skipped. - -@return The actual number of bytes skipped. - -@exception IOException If an error occurs while communicating with the system. -**/ - public long skip(long bytesToSkip) throws IOException - { - if (bytesToSkip <= 0) { - return 0; - } - return impl_.skip(bytesToSkip); - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/PrintObjectPageInputStreamImpl.java b/cvsroot/src/com/ibm/as400/access/PrintObjectPageInputStreamImpl.java deleted file mode 100644 index 5a85b38e9..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintObjectPageInputStreamImpl.java +++ /dev/null @@ -1,87 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintObjectPageInputStreamImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -interface PrintObjectPageInputStreamImpl -{ - public abstract void createPrintObjectPageInputStream(SpooledFileImpl sf, - PrintParameterList openOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - - public abstract int available() - throws IOException; - - - - public abstract void close() - throws IOException; - - - - public abstract int getCurrentPageNumber(); - - - - public abstract int getNumberOfPages(); - - - - public abstract boolean isPagesEstimated(); - - - - // NOTE: Interface methods cannot be synchronized... - public abstract /* synchronized */ void mark(int readLimit); - - - - public boolean nextPage() - throws IOException; - - - - public boolean previousPage() - throws IOException; - - - - public abstract int read(byte data[], int dataOffset, int length) - throws IOException; - - - - // NOTE: Interface methods cannot be synchronized... - public abstract /* synchronized */ void reset() - throws IOException; - - - - public abstract boolean selectPage(int page) - throws IOException, IllegalArgumentException; - - - - public abstract long skip(long bytesToSkip) - throws IOException; - -} diff --git a/cvsroot/src/com/ibm/as400/access/PrintObjectPageInputStreamImplProxy.java b/cvsroot/src/com/ibm/as400/access/PrintObjectPageInputStreamImplProxy.java deleted file mode 100644 index 7a377cc3a..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintObjectPageInputStreamImplProxy.java +++ /dev/null @@ -1,260 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintObjectPageInputStreamImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.io.IOException; - -/** - * The PrintObjectPageInputStreamImplProxy class implements proxy versions of - * the public methods defined in the PrintObjectPageInputStreamImpl class. - * Unless commented otherwise, the implementations of the methods below - * are merely proxy calls to the corresponding method in the remote - * implementation class (PrintObjectPageInputStreamImplRemote). - **/ - -class PrintObjectPageInputStreamImplProxy extends AbstractProxyImpl -implements PrintObjectPageInputStreamImpl, ProxyImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private static final boolean[] myArgs = new boolean[] {true, false, false}; - - PrintObjectPageInputStreamImplProxy() - { - super("PrintObjectPageInputStream"); - } - - - - public void createPrintObjectPageInputStream(SpooledFileImpl sf, - PrintParameterList openOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "createPrintObjectPageInputStream", - new Class [] { SpooledFileImpl.class, PrintParameterList.class }, - new Object[] { sf, openOptions }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public int available() - throws IOException - { - try { - return connection_.callMethod(pxId_, "available").getReturnValueInt(); - } - catch (InvocationTargetException e) { - Throwable error = e.getTargetException(); - if (error instanceof IOException) - throw (IOException) error; - else - throw ProxyClientConnection.rethrow(e); - } - } - - - - public void close() - throws IOException - { - try { - connection_.callMethod(pxId_, "close"); - } - catch (InvocationTargetException e) { - Throwable error = e.getTargetException(); - if (error instanceof IOException) - throw (IOException) error; - else - throw ProxyClientConnection.rethrow(e); - } - } - - - - public int getCurrentPageNumber() - { - try { - return connection_.callMethod(pxId_, "getCurrentPageNumber").getReturnValueInt(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - public int getNumberOfPages() - { - try { - return connection_.callMethod(pxId_, "getNumberOfPages").getReturnValueInt(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - public boolean isPagesEstimated() - { - try { - return connection_.callMethod(pxId_, "isPagesEstimated").getReturnValueBoolean(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - public void mark(int readLimit) - { - try { - connection_.callMethod(pxId_, "mark", - new Class[] {Integer.TYPE}, - new Object[] { new Integer (readLimit) }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - public boolean nextPage() - throws IOException - { - try { - return connection_.callMethod(pxId_, "nextPage").getReturnValueBoolean(); - } - catch (InvocationTargetException e) { - Throwable error = e.getTargetException(); - if (error instanceof IOException) - throw (IOException) error; - else - throw ProxyClientConnection.rethrow(e); - } - } - - - - public boolean previousPage() - throws IOException - { - try { - return connection_.callMethod(pxId_, "previousPage").getReturnValueBoolean(); - } - catch (InvocationTargetException e) { - Throwable error = e.getTargetException(); - if (error instanceof IOException) - throw (IOException) error; - else - throw ProxyClientConnection.rethrow(e); - } - } - - - - public int read(byte data[], int dataOffset, int length) - throws IOException - { - try { - ProxyReturnValue rv = connection_.callMethod(pxId_, "read", - new Class[] { byte[].class , Integer.TYPE, Integer.TYPE }, - new Object[] { data, new Integer(dataOffset), new Integer(length) }, - myArgs, false); - - byte [] returnDataBuffer = (byte[])rv.getArgument(0); - for (int i=0; iPrintParameterList -used to create an instance of the class. -

    -The number of pages in the spooled file may be estimated. To help process -spooled files with estimated page counts, methods nextPage, previousPage, and -selectPage will return false if the requested page is not available. -

    -An instance of this class is created -using the getPageInputStream method -from the class SpooledFile. -

    -NOTE: This class is supported on OS/400 V4R4 or later. -Not all spooled file formats are supported for transform. -**/ - -class PrintObjectPageInputStreamImplRemote -implements PrintObjectPageInputStreamImpl -{ - // Private data - private NPConversation conversation_; // conversation with Network Print Server - private NPCPAttribute cpCPFMsg_; // CPF message code point - private NPCodePoint cpObjHndl_; // page input stream handle code point - private NPCPID cpObjID_; // page input stream ID codepoint - private int currentPage_ = 0; // current page of input stream - private int markLimit_ = 0; // limit of mark/reset - private boolean markSet_= false; // has a mark been set? - private int numberOfPages_ = 0; // total number of pages - private boolean pagesEst_ = false; // indicates if the total number of pages is estimated - private int numBytes_ = 0; // total size of data in page - private NPSystem npSystem_; // system where input stream resides - private int objectType_ ; // object type (always SpooledFile) - private int offset_ = 0; // offset from beginning of page (in bytes) - private int offsetFromMark_ = 0; // offset from mark (in bytes) - - -/** -Constructs a PrintObjectPageInputStream object. - -@param spooledFile The SpooledFile. -@param openOptions The PrintParameterList options to be used when opening the SpooledFile. - -@exception AS400Exception If the system returns an error message. -@exception AS400SecurityException If a security or authority error occurs. -@exception ErrorCompletingRequestException If an error occurs before the request is completed. -@exception IOException If an error occurs while communicating with the server. -@exception InterruptedException If this thread is interrupted. -@exception RequestNotSupportedException If the requested function is not supported because the server - operating system is not at the correct level. -**/ - public synchronized void createPrintObjectPageInputStream(SpooledFileImpl spooledFile, - PrintParameterList openOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - objectType_ = NPConstants.SPOOLED_FILE; - npSystem_ = NPSystem.getSystem(((SpooledFileImplRemote) spooledFile).getSystem()); - cpObjID_ = ((SpooledFileImplRemote)spooledFile).getIDCodePoint(); - cpCPFMsg_ = new NPCPAttribute(); - cpObjHndl_ = new NPCPSplFHandle(); - - // set up OPEN request datastream - NPDataStream openReq = new NPDataStream(objectType_); - openReq.setAction(NPDataStream.OPEN_MODIFIED_SPLF); - openReq.addCodePoint(cpObjID_); - - // create the Selection Code Point - NPCPSelection selectionCP = new NPCPSelection(); - - // set any options the user passed in - if (openOptions != null) { - selectionCP.addUpdateAttributes(openOptions.getAttrCodePoint()); - } - - // set the PAGE_AT_A_TIME attribute to *YES - selectionCP.setAttrValue(PrintObject.ATTR_PAGE_AT_A_TIME, "*YES"); - - // add the selection codepoint to the open request datastream - openReq.addCodePoint(selectionCP); - - // setup OPEN reply datastream - NPDataStream openRep = new NPDataStream(objectType_); - openRep.addCodePoint(cpObjHndl_); - openRep.addCodePoint(cpCPFMsg_); - - // retrieve the conversation for opening the spooled file - conversation_ = npSystem_.getConversation(); - boolean fOpenOK = false; - - try { - // make the OPEN request - int rc = conversation_.makeRequest(openReq, openRep); - if (rc != NPDataStream.RET_OK) { // failed - Trace.log(Trace.ERROR, "Error opening SpooledFile; rc = " + rc); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.AS400_ERROR); - } - else { - // retrieve the total number of pages, whether the number - // of pages is estimated, and the number of bytes in the first page - retrievePageInformation(); - currentPage_ = 1; - fOpenOK = true; - } - } - finally { - if (!fOpenOK) { // if an exception was thrown, return conversation - if (npSystem_ != null) { - npSystem_.returnConversation(conversation_); - } - conversation_ = null; - } - } - } - - - -/** -Returns the number of bytes remaining in the current page. - -@return The number of available bytes (without blocking) in the current page. -**/ - public int available() throws IOException - { - return numBytes_ - offset_; - } - - - -/** -Closes the input stream and releases any resources associated with it. - -@exception IOException If an error occurs while communicating with the server. -**/ - public void close() throws IOException - { - if (conversation_ == null) { - Trace.log(Trace.ERROR, "Conversation is null."); - throw new IOException(); - } - else { - // set up CLOSE request datastream - NPDataStream closeReq = new NPDataStream(objectType_); - closeReq.setAction(NPDataStream.CLOSE); - closeReq.addCodePoint(cpObjHndl_); - - // set up CLOSE reply datastream - NPDataStream closeRep = new NPDataStream(objectType_); - closeRep.addCodePoint(cpCPFMsg_); - - try { - // make the CLOSE request - int rc = conversation_.makeRequest(closeReq, closeRep); - - if (rc != NPDataStream.RET_OK) { // failed - Trace.log(Trace.ERROR, "Error closing SpooledFile; rc = " + rc); - npSystem_.returnConversation(conversation_); - } - } - catch (Exception e) { - Trace.log(Trace.ERROR, "Caught an Exception." + e.toString()); - throw new IOException(e.toString()); - } - - finally { - if (npSystem_ != null) { - npSystem_.returnConversation(conversation_); - npSystem_ = null; - } - conversation_ = null; - } - } - } - - - -/** -Closes the input stream when garbage is collected. - -@exception Throwable If an error occurs. -**/ - protected void finalize() throws Throwable - { - if (conversation_ != null) { - // attempt to send the close() request and then - // return the conversation to the pool... - // Ignore any replies here to avoid a deadlock - // if we are called on the AS400Server's background thread. - NPDataStream closeReq = new NPDataStream(objectType_); - closeReq.setAction(NPDataStream.CLOSE); - closeReq.addCodePoint(cpObjHndl_); - - AS400Server server= conversation_.getServer(); - if (server != null) { - // close the page input stream - // @B1D closeReq.setHostCCSID(conversation_.getHostCCSID()); - closeReq.setConverter(conversation_.getConverter()); - server.sendAndDiscardReply(closeReq); - } - - if (npSystem_ != null) { - npSystem_.returnConversation(conversation_); - npSystem_ = null; - } - conversation_ = null; - } - super.finalize(); // always call super.finalize()! - } - - - -/** -Returns the number of the current page of the input stream. - -@return The number of the current page. -**/ - public int getCurrentPageNumber() - { - return currentPage_; - } - - - -/** -Returns the number of pages in the stream. - -@return The number of pages in the stream. -**/ - public int getNumberOfPages() - { - return numberOfPages_; - } - - - -/** -Indicates if the number of pages is estimated. - -@return True if the number of pages is estimated; false otherwise. -**/ - public boolean isPagesEstimated() - { - return pagesEst_; - } - - - -/** -Marks the current position of the current page of the input stream. - -A subsequent call to reset() will reposition the stream at the -last marked position, so that subsequent reads will reread the same bytes. -The stream promises to allow readLimit bytes to be read before the -mark position gets invalidated, provided readLimit does not exceed amount -of page data available, in which case the readLimit is set to a value -equal to the amount of data available until the end of the page is reached. - - -@param readLimit The maximum limit of bytes allowed to be read before -the mark position is no longer valid. -**/ - public synchronized void mark(int readLimit) - { - offsetFromMark_ = 0; - int maxReadLimit = numBytes_ - offset_; - if (readLimit > maxReadLimit) { - readLimit = maxReadLimit; - } - markLimit_ = readLimit; - markSet_ = true; - } - - - -/** -Repositions the stream to the next page. - -@return True if the stream is positioned to the next page; false otherwise. - -@exception IOException If an error occurs while communicating with the server. -**/ - public boolean nextPage() throws IOException - { - return selectPage(currentPage_ + 1); - } - - - -/** -Repositions the stream to the previous page. - -@return True if the stream is positioned to the previous page; -false otherwise. - -@exception IOException If an error occurs while communicating with the server. -**/ - public boolean previousPage() throws IOException - { - return selectPage(currentPage_ - 1); - } - - - -/** -Reads up to length bytes of data from this input stream into data, -starting at the array offset dataOffset. - -@param data The buffer into which the data is read. -@param dataOffset The start offset of the data. -@param length The maximum number of bytes to read. - -@return The total number of bytes read into the buffer, or -1 if there is -no more data because the end of the page stream has been reached. - -@exception IOException If an error occurs while communicating with the server. -**/ - public int read(byte data[], int dataOffset, int length) throws IOException - { - int bytesRead = 0; - if (conversation_ == null) { - Trace.log(Trace.ERROR, "Conversation is null."); - throw new IOException(); - } - else { - // set the number of bytes to read - NPCPAttribute cpAttr = new NPCPAttribute(); - cpAttr.setAttrValue(PrintObject.ATTR_NUMBYTES, length); - - // set up READ request datastream - NPDataStream readReq = new NPDataStream(objectType_); - readReq.setAction(NPDataStream.READ); - readReq.addCodePoint(cpObjHndl_); - readReq.addCodePoint(cpAttr); - - // Point the data codepoint to receive the data into our buffer. - // Our buffer better be big enough to hold the data or we''ll - // not get it at all - NPCPData cpData = new NPCPData(); - cpData.setDataBuffer(data, 0, dataOffset); - - // set up READ reply datastream - NPDataStream readRep = new NPDataStream(objectType_); - readRep.addCodePoint(cpData); - readRep.addCodePoint(cpCPFMsg_); - - try { - // make the READ request - int iRC = conversation_.makeRequest(readReq, readRep); - - switch (iRC) { - case NPDataStream.RET_OK: - case NPDataStream.RET_READ_INCOMPLETE: // maybe read some bytes? - // see how many bytes we read - bytesRead = cpData.getDataLength(); - offsetFromMark_ += bytesRead; - offset_ += bytesRead; // update distance from the start of the page - break; - case NPDataStream.RET_READ_OUT_OF_RANGE: - // this return code is returned if there are no more - // bytes to be read from the current page - bytesRead = -1; - break; - case NPDataStream.RET_READ_EOF: - // this return code is returned if there are no - // bytes read at all and EOF is reached - bytesRead = -1; // set rc to end of file - break; - default: - // log an error throw appropriate exception - Trace.log(Trace.ERROR, "Error received on read : " + Integer.toString(iRC)); - throw new IOException(Integer.toString(iRC)); - } - } - - catch (Exception e) { - Trace.log(Trace.ERROR, "Caught an Exception." + e.toString()); - throw new IOException(e.toString()); - } - } - return bytesRead; - } - - - -/** -Repositions the stream to the last marked position. -If the stream has not been marked or if the mark has been invalidated, -an IOException is thrown. - -@exception IOException If an error occurs while communicating with the server. -**/ - public synchronized void reset() throws IOException - { - if (conversation_ == null) { - Trace.log(Trace.ERROR, "Conversation is null."); - throw new IOException(); - } - else if (!markSet_) { - Trace.log(Trace.ERROR, "Mark not set."); - throw new IOException(); - } - else if ((markLimit_ == 0) || (offsetFromMark_ > markLimit_)) { - Trace.log(Trace.WARNING, "Stream has not been marked or mark has been invalidated."); - throw new IOException(); - } - else { - // seek backwards from the current spot offsetFromMark_ bytes - // and reset offsetFromMark_ to 0 - if (offsetFromMark_ != 0) - seekFromCur(-offsetFromMark_); - } - } - - - -/** -Retrieves the number of bytes in the current page. -**/ - private void retrieveNumberOfPageBytes() - throws IOException, - RequestNotSupportedException - - { - // set up attributes to retrieve ID list - NPCPAttributeIDList cpAttrsToRetrieve = new NPCPAttributeIDList(); - cpAttrsToRetrieve.addAttrID(PrintObject.ATTR_NUMBYTES); - - // set up TELL request datastream - NPDataStream tellReq = new NPDataStream(objectType_); - tellReq.addCodePoint(cpObjHndl_); - tellReq.addCodePoint(cpAttrsToRetrieve); - tellReq.setAction(NPDataStream.TELL); - - // set up TELL reply datastream - NPDataStream tellRep = new NPDataStream(objectType_); - NPCPAttribute cpAttrs = new NPCPAttribute(); - tellRep.addCodePoint(cpAttrs); - - try { - // make TELL request - int rc = conversation_.makeRequest(tellReq, tellRep); - if (rc == NPDataStream.RET_OK) { - Integer numBytes = cpAttrs.getIntValue(PrintObject.ATTR_NUMBYTES); - if (numBytes != null) { - numBytes_ = numBytes.intValue(); - } - else { - Trace.log(Trace.ERROR, - "Network Print Server does not support retrieving spooled file page length."); - throw new RequestNotSupportedException( - conversation_.getAttribute(PrintObject.ATTR_NPSLEVEL), - RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - } - } - else { - Trace.log(Trace.ERROR, - "Network Print Server error retrieving spooled file page length. RC ="+ rc); - throw new RequestNotSupportedException( - conversation_.getAttribute(PrintObject.ATTR_NPSLEVEL), - RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - } - } - catch (Exception e) { - Trace.log(Trace.ERROR, "Caught an Exception." + e.toString()); - throw new IOException(e.toString()); - } - } - - -/** -Retrieves the number of pages in the stream, whether the number of pages -is estimated or an accurate value, and the number of bytes in the first page. -These values are then stored in the appropriate instance variables. - -@exception IOException If an error occurs while communicating with the server. -**/ - private void retrievePageInformation() throws IOException - { - if (conversation_ == null) { - Trace.log(Trace.ERROR, "Conversation is null."); - throw new IOException(); - } - else { - // set up attributes to retrieve ID list - NPCPAttributeIDList cpAttrIDs = new NPCPAttributeIDList(); - cpAttrIDs.addAttrID(PrintObject.ATTR_PAGES); // number of pages - cpAttrIDs.addAttrID(PrintObject.ATTR_PAGES_EST); // pages estimated? - cpAttrIDs.addAttrID(PrintObject.ATTR_NUMBYTES); // available page bytes - - // set up TELL request datastream - NPDataStream tellReq = new NPDataStream(objectType_); - tellReq.setAction(NPDataStream.TELL); - tellReq.addCodePoint(cpObjHndl_); - tellReq.addCodePoint(cpAttrIDs); - - // set up TELL reply datastream - NPDataStream tellRep = new NPDataStream(objectType_); - NPCPAttribute cpAttr = new NPCPAttribute(); - tellRep.addCodePoint(cpAttr); - - try { - int rc = conversation_.makeRequest(tellReq, tellRep); - - if (rc == NPDataStream.RET_OK) { - // assign temp variables - Integer pages = cpAttr.getIntValue(PrintObject.ATTR_PAGES); - String estimated = cpAttr.getStringValue(PrintObject.ATTR_PAGES_EST); - Integer bytes = cpAttr.getIntValue(PrintObject.ATTR_NUMBYTES); - - // check for null returns; signal error if necessary - if ((pages == null) || (estimated == null) || (bytes == null)) { - Trace.log(Trace.ERROR, "NPServer.TELL returned null page information!"); - throw new RequestNotSupportedException( - conversation_.getAttribute(PrintObject.ATTR_NPSLEVEL), - RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - } - else { - // assign instance variables - numberOfPages_ = pages.intValue(); - numBytes_ = bytes.intValue(); - if (estimated.equals("*YES")) - pagesEst_ = true; - else - pagesEst_ = false; - } - } - else { - // Anything else would be an error...The conversation should handle - // the basic CPF message error for us, so this would be some unexpected - // result. We'll throw a runtime error. - Trace.log(Trace.ERROR, "Error received retrieving page information : " + Integer.toString(rc)); - throw new IOException(Integer.toString(rc)); - } - } - catch (Exception e) { - Trace.log(Trace.ERROR, "Caught an Exception." + e.toString()); - throw new IOException(e.toString()); - } - } - } - - - -/** -Repositions the stream to page page. - -@param page The page at which to reposition the input stream. - -@return True if the stream is positioned to the specified page; false otherwise. - -@exception IOException If an error occurs while communicating with the server, -or an error occurs selecting the specified page. -@exception IllegalArgumentException If page is negative. -**/ - public boolean selectPage(int page) throws IOException, IllegalArgumentException - { - if (conversation_ == null) { - Trace.log(Trace.ERROR, "Conversation is null."); - throw new IOException(); - } - else if ((currentPage_ == page) && (offset_ == 0)) { - // do nothing, page is already loaded. - return true; - } - else if (page < 0) { - Trace.log(Trace.ERROR, "NPServer.SELECT_PAGE error: Page number negative"); - throw new IllegalArgumentException(); - } - else { - // set the page number to go to in the input stream - NPCPAttribute cpAttr = new NPCPAttribute(); - cpAttr.setAttrValue(PrintObject.ATTR_PAGENUMBER, page); - - // set up SELECT_PAGE request datastream - NPDataStream pageReq = new NPDataStream(objectType_); - pageReq.setAction(NPDataStream.SELECT_PAGE); - pageReq.addCodePoint(cpObjHndl_); - pageReq.addCodePoint(cpAttr); - - // set up SELECT_PAGE reply datastream - NPDataStream pageRep = new NPDataStream(objectType_); - pageRep.addCodePoint(cpCPFMsg_); - - try { - // make the SELECT_PAGE request - int iRC = conversation_.makeRequest(pageReq, pageRep); - - switch (iRC) { - case NPDataStream.RET_OK: - // assign current page - currentPage_ = page; - - // reset mark information - markSet_ = false; - markLimit_ = 0; - offset_ = 0; - offsetFromMark_ = 0; - - // retrieve the number of bytes in the page - retrieveNumberOfPageBytes(); - return true; - // break; - case NPDataStream.RET_PAGE_OUT_OF_RANGE: - Trace.log(Trace.ERROR, "NPServer.SELECT_PAGE error: Page out of range"); - return false; - // break; - // throw new IOException(Integer.toString(iRC)); - default: - // The conversation should handle the basic CPF - // message error for us, so this would be some unexpected - // result. - Trace.log(Trace.ERROR, "NPServer.SELECT_PAGE error: " + Integer.toString(iRC)); - throw new IOException(Integer.toString(iRC)); - } - } - catch (Exception e) { - Trace.log(Trace.ERROR, "Caught an Exception." + e.toString()); - throw new IOException(e.toString()); - } - } - } - - - -/** -Seeks to location offset within the stream. - -@param offset The number of bytes to seek from current mark. - -@exception IOException If an error occurs while communicating with the server. -**/ - private void seekFromCur(int offset) - throws IOException - { - // create the attribute code point for the seek data - NPCPAttribute cpAttr = new NPCPAttribute(); - cpAttr.setAttrValue(PrintObject.ATTR_SEEKORG, 2); // current read pointer - cpAttr.setAttrValue(PrintObject.ATTR_SEEKOFF, offset); // offset - - // set up the SEEK request datastream - NPDataStream seekReq = new NPDataStream(objectType_); - seekReq.setAction(NPDataStream.SEEK); - seekReq.addCodePoint(cpObjHndl_); - seekReq.addCodePoint(cpAttr); - - // set up the SEEK reply datastream - NPDataStream seekRep = new NPDataStream(objectType_); - seekRep.addCodePoint(cpCPFMsg_); - - try { - // make SEEK request - int iRC = conversation_.makeRequest(seekReq, seekRep); - - switch (iRC) { - case NPDataStream.RET_OK: - offsetFromMark_ += offset; // update how far we went from the mark - offset_ += offset; // update distance from beginning of page - break; - case NPDataStream.RET_SEEK_OFF_BAD: - default: - // we should never get Seek offset bad because we - // always check in skip that we aren't going beyond the end of - // the page/file. The other place we seek is on a reset and that - // should work. - Trace.log(Trace.ERROR, "Seek from cur error " + Integer.toString(iRC)); - throw new IOException(Integer.toString(iRC)); - } - } - catch (Exception e) { - Trace.log(Trace.ERROR, "Caught an Exception." + e.toString()); - throw new IOException(e.toString()); - } - } - - - -/** -Skips over the next bytesToSkip bytes in the stream. -This method may skip less bytes than specified if the end of -the page is reached. The actual number of bytes skipped is returned. -No action is taken if the number of bytes to skip is not positive. - -@param bytesToSkip The number of bytes to be skipped. - -@return The actual number of bytes skipped. - -@exception IOException If an error occurs while communicating with the server. -**/ - public long skip(long bytesToSkip) throws IOException - { - /* - if (bytesToSkip <= 0) { - return 0; - } - */ // @A2D - check is in public class - - if (conversation_ == null) { - Trace.log(Trace.ERROR, "Conversation is null."); - throw new IOException(); - } - else { - int maxSkip = numBytes_ - offset_; // maximum number of bytes you can skip - if (bytesToSkip > maxSkip) { - bytesToSkip = maxSkip; - } - seekFromCur((int)bytesToSkip); // seek ahead from current pointer n bytes - } - return bytesToSkip; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/PrintObjectTransformedInputStream.java b/cvsroot/src/com/ibm/as400/access/PrintObjectTransformedInputStream.java deleted file mode 100644 index 3052eab0b..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintObjectTransformedInputStream.java +++ /dev/null @@ -1,209 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintObjectTransformedInputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.IOException; - - -// NOTE: This class is derived directly from PrintObjectPageInputStream. - -/** -Reads transformed data from a system spooled file. -The type of transform to be performed on the data is dependent on the -PrintParameterList -used to create an instance of the class. -

    -An instance of this class is created using -the getTransformedInputStream method -from the class SpooledFile. -

    -NOTE: This class is supported on OS/400 V4R4 or later. -Not all spooled file formats are supported for transform. -**/ - -public class PrintObjectTransformedInputStream extends InputStream -{ - // Private data - - transient private AS400 system_; - transient private PrintObjectTransformedInputStreamImpl impl_; - -/** -Constructs a PrintObjectTransformedInputStream object. The PrintParameterList attribute -ATTR_MFGTYPE must be specified to indicate the type of data transform. - -@param spooledFile The SpooledFile. -@param transformOptions The PrintParameterList options to be used when opening the SpooledFile. - -@exception AS400Exception If the system returns an error message. -@exception AS400SecurityException If a security or authority error occurs. -@exception ErrorCompletingRequestException If an error occurs before the request is completed. -@exception IOException If an error occurs while communicating with the system. -@exception InterruptedException If this thread is interrupted. -@exception RequestNotSupportedException If the requested function is not supported because the system - operating system is not at the correct level. -**/ - PrintObjectTransformedInputStream(SpooledFile spooledFile, - PrintParameterList transformOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - system_ = spooledFile.getSystem(); - chooseImpl(); - // do connect here because it could throw Exceptions - system_.connectService(AS400.PRINT); - if (spooledFile.getImpl() == null) { - spooledFile.chooseImpl(); - } - impl_.createPrintObjectTransformedInputStream((SpooledFileImpl) spooledFile.getImpl(), transformOptions); // @A3A - } - - - -/** -Returns the number of bytes available (with blocking). - -@return The number of available bytes (with blocking). -**/ - public int available() throws IOException - { - return impl_.available(); - } - - - - // A2A - Added method - private void chooseImpl() - { - if (system_ == null) { - Trace.log( Trace.ERROR, "Attempt to use PrintObjectTransformedInputStream before setting system."); - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - impl_ = (PrintObjectTransformedInputStreamImpl) system_.loadImpl2("com.ibm.as400.access.PrintObjectTransformedInputStreamImplRemote", - "com.ibm.as400.access.PrintObjectTransformedInputStreamImplProxy"); - } - - - -/** -Closes the input stream and releases any resources associated with it. - -@exception IOException If an error occurs while communicating with the system. -**/ - public void close() throws IOException - { - impl_.close(); - } - - - -/** -Returns a boolean indicating whether this stream type supports mark and reset. - -@return Always false. Objects of this class will not support the mark and reset methods. -**/ - public boolean markSupported() - { - return false; - } - - - -/** -Reads the next byte of data from this input stream. - -@return The byte read, or -1 if the end of the stream is reached. - -@exception IOException If an error occurs while communicating with the system. -**/ - public int read() throws IOException - { - int readchar = -1; - - byte oneByte[] = new byte[1]; - int rc = read(oneByte, 0, 1); - if (rc == 1) { - readchar = (int)oneByte[0]; - } - return readchar; - } - - - -/** -Reads up to data.length bytes of data from the input -stream into data. - -@param data The buffer into which the data is read. - -@return The total number of bytes read into the buffer or -1 if there is no more -data because the end of file has been reached. - -@exception IOException If an error occurs while communicating with the system. -**/ - public int read(byte[] data) throws IOException - { - return read(data, 0, data.length); - } - - - -/** -Reads up to length bytes of data from this input stream into data, -starting at the array offset dataOffset. - -@param data The buffer into which the data is read. -@param dataOffset The start offset of the data. -@param length The maximum number of bytes to read. - -@return The total number of bytes read into the buffer, or -1 if there is -no more data because the end of file has been reached. - -@exception IOException If an error occurs while communicating with the system. -**/ - public int read(byte data[], int dataOffset, int length) throws IOException - { - return impl_.read(data, dataOffset, length); - } - - - -/** -Skips over the next bytesToSkip bytes in the stream. -This method may skip less bytes than specified if the end of -the data block is reached. The actual number of bytes skipped is returned. -No action is taken if the number of bytes to skip is not positive. - -@param bytesToSkip The number of bytes to be skipped. - -@return The actual number of bytes skipped. - -@exception IOException If an error occurs while communicating with the system. -**/ - public long skip(long bytesToSkip) throws IOException - { - if (bytesToSkip <= 0) { - return 0; - } - return impl_.skip(bytesToSkip); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/PrintObjectTransformedInputStreamImpl.java b/cvsroot/src/com/ibm/as400/access/PrintObjectTransformedInputStreamImpl.java deleted file mode 100644 index 2b7b9e18d..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintObjectTransformedInputStreamImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintObjectTransformedInputStreamImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -interface PrintObjectTransformedInputStreamImpl -{ - public abstract void createPrintObjectTransformedInputStream(SpooledFileImpl sf, - PrintParameterList openOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - - public abstract int available() - throws IOException; - - - - public abstract void close() - throws IOException; - - - - public abstract int read(byte data[], int dataOffset, int length) - throws IOException; - - - - public abstract long skip(long bytesToSkip) - throws IOException; - -} diff --git a/cvsroot/src/com/ibm/as400/access/PrintObjectTransformedInputStreamImplProxy.java b/cvsroot/src/com/ibm/as400/access/PrintObjectTransformedInputStreamImplProxy.java deleted file mode 100644 index 14db33ee4..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintObjectTransformedInputStreamImplProxy.java +++ /dev/null @@ -1,138 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintObjectTransformedInputStreamImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.io.IOException; - -/** - * The PrintObjectTransformedInputStreamImplProxy class implements proxy versions of - * the public methods defined in the PrintObjectTransformedInputStreamImpl class. - * Unless commented otherwise, the implementations of the methods below - * are merely proxy calls to the corresponding method in the remote - * implementation class (PrintObjectTransformedInputStreamImplRemote). - **/ - -class PrintObjectTransformedInputStreamImplProxy extends AbstractProxyImpl -implements PrintObjectTransformedInputStreamImpl, ProxyImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private static final boolean[] myArgs = new boolean[] {true, false, false}; - - PrintObjectTransformedInputStreamImplProxy() - { - super("PrintObjectTransformedInputStream"); - } - - - - public void createPrintObjectTransformedInputStream(SpooledFileImpl spooledFile, - PrintParameterList transformOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "createPrintObjectTransformedInputStream", - new Class [] { SpooledFileImpl.class, PrintParameterList.class }, - new Object[] { spooledFile, transformOptions }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public int available() - throws IOException - { - try { - return connection_.callMethod(pxId_, "available").getReturnValueInt(); - } - catch (InvocationTargetException e) { - Throwable error = e.getTargetException(); - if (error instanceof IOException) - throw (IOException) error; - else - throw ProxyClientConnection.rethrow(e); - } - } - - - - public void close() - throws IOException - { - try { - connection_.callMethod(pxId_, "close"); - } - catch (InvocationTargetException e) { - Throwable error = e.getTargetException(); - if (error instanceof IOException) - throw (IOException) error; - else - throw ProxyClientConnection.rethrow(e); - } - } - - - - public int read(byte data[], int dataOffset, int length) - throws IOException - { - try { - ProxyReturnValue rv = connection_.callMethod(pxId_, "read", - new Class[] { byte[].class , Integer.TYPE, Integer.TYPE }, - new Object[] { data, new Integer(dataOffset), new Integer(length) }, - myArgs, false); - - byte [] returnDataBuffer = (byte[])rv.getArgument(0); - for (int i=0; iPrintParameterList -used to create an instance of the class. -

    -An instance of this class is created using -the getTransformedInputStream method -from the class SpooledFile. -

    -NOTE: This class is supported on OS/400 V4R4 or later. -Not all spooled file formats are supported for transform. -**/ - -class PrintObjectTransformedInputStreamImplRemote -implements PrintObjectTransformedInputStreamImpl -{ - // Private data - private NPConversation conversation_; // conversation with Network Print Server - private NPCPAttribute cpCPFMsg_; // CPF message code point - private NPCodePoint cpObjHndl_; // input stream handle code point - private NPCPID cpObjID_; // input stream ID codepoint - private NPSystem npSystem_; // AS400 system where input stream resides - private int numBytes_ = 0; // total size of data in inputstream - private int objectType_ ; // object type (SpooledFile) - private int offset_ = 0; // offset from beginning of file (in bytes) - private boolean cidConv = false; // add second level ASCII conversion - private String convSource = null; // holds conversion table source values - private String convTarget = null; // holds conversion target values - - -/** -Constructs a PrintObjectTransformedInputStream object. The PrintParameterList attribute -ATTR_MFGTYPE must be specified to indicate the type of data transform. - -@param spooledFile The SpooledFile. -@param transformOptions The PrintParameterList options to be used when opening the SpooledFile. - -@exception AS400Exception If the system returns an error message. -@exception AS400SecurityException If a security or authority error occurs. -@exception ErrorCompletingRequestException If an error occurs before the request is completed. -@exception IOException If an error occurs while communicating with the server. -@exception InterruptedException If this thread is interrupted. -@exception RequestNotSupportedException If the requested function is not supported because the server - operating system is not at the correct level. -**/ - public synchronized void createPrintObjectTransformedInputStream(SpooledFileImpl spooledFile, - PrintParameterList transformOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - AS400ImplRemote system = ((SpooledFileImplRemote)spooledFile).getSystem(); - int ccsid = system.getCcsid(); - - objectType_ = NPConstants.SPOOLED_FILE; - npSystem_ = NPSystem.getSystem(((SpooledFileImplRemote)spooledFile).getSystem()); - cpObjID_ = ((SpooledFileImplRemote)spooledFile).getIDCodePoint(); - cpCPFMsg_ = new NPCPAttribute(); - cpObjHndl_ = new NPCPSplFHandle(); - - // set up OPEN request datastream - NPDataStream openReq = new NPDataStream(objectType_); - openReq.setAction(NPDataStream.OPEN_MODIFIED_SPLF); - openReq.addCodePoint(cpObjID_); - - // create the Selection Code Point - NPCPSelection selectionCP = new NPCPSelection(); - - // set any options the user passed in, - // (The transformOptions is supposed to contain manufacture type and - // model, and/or a workstation customizing object necessary for - // specifying the type of transform to perform; otherwise, - // why create an instance of this class?) - if (transformOptions != null) { - selectionCP.addUpdateAttributes(transformOptions.getAttrCodePoint()); - // Get the value of the target code page attribute - String tempTarget = transformOptions.getStringParameter(PrintObject.ATTR_TGT_CODEPAGE); - // Check for the setting of the client/target code page attribute. - // If it exist then the source ASCII code page can be determined. - if (tempTarget != null){ - cidConv = true; - // prepare the 'CPxxxx' (where xxxx is the actual code page) to be 'Cpxxx' - convTarget = tempTarget.replace('P', 'p'); - /* table of target ASCII CCSIDs can be found in the "IBM i Workstation - Customization Reference" that can be found on the IBM i Information Center. */ - switch (ccsid) // @B2A "Euro Phase 2 = EP2 " - { - case 37: /* US @B2A */ - case 836: /* Simplified @B2A */ - convSource = "Cp437"; /* 8bit ASCII US PC @B2A */ - break; - case 420: /* Arabic @B2A */ - convSource = "Cp864"; /* 8bit ASCII Arabic@B2A */ - break; - case 423: /* Greece (old) @B2A */ - convSource = "Cp1253"; /* MS-Win Greek @B2A */ - break; - case 424: /* Hebrew @B2A */ - convSource = "Cp856"; /* 8bit ASCII Hebrew@B2A */ - break; - case 838: /* Thai @B2A */ - case 1130: /* Vietnamese @B2A */ - case 1132: /* Lao @B2A */ - case 1164: /* Viet Nam EP2 @B2A */ - convSource = "Cp874";/* 8bit ASCII Thailand@B2A */ - break; - case 870: /* Latin 2 @B2A */ - convSource = "Cp852"; /* 8bit Latin-2 @B2A */ - break; - case 875: /* Greece (new) @B2A */ - convSource = "Cp869";/* 8bit ASCII Greek @B2A */ - break; - case 905: /* Turkey (old) @B2A */ - case 1026: /* Turkey (new) @B2A */ - convSource = "Cp857";/* 8bit ASCII Latin-5 @B2A */ - break; - case 1097: /* Farsi (new) @B2A */ - convSource = "Cp1097";/*IBM EBCDIC Farsi @B2A */ - break; - case 1112: /* Latvian, Lith@B2A */ - convSource = "Cp921";/* 8bit ASCII Baltic @B2A */ - break; - case 1122: /* Estonia @B2A */ - convSource = "Cp922"; /* 8bit Estonia @B2A */ - break; - case 1153: /* Czech, Poland, EP2 @B2A */ - convSource = "Cp1250"; /* MS-Win Latin-2@B@A */ - break; - case 1154: /* Bulgarian EP2@B2A */ - case 1158: /* Ukraine EP2@B2A */ - convSource = "Cp1251";/* MS-Win Cyrillic @B2A */ - break; - case 1155: /* Turkey EP2 @B2A */ - convSource = "Cp1254";/* MS-Win Turkish @B2A */ - break; - case 1156: /* Latvia EP2 @B2A */ - case 1157: /* Estonia EP2 @B2A */ - convSource = "Cp1257";/* MS-Win Balic @B2A */ - break; - case 1160: /* Thailand EP2 @B2A */ - convSource = "Cp874";/* 8bit ASCII Thailand@B2A */ - break; - case 5026: /* Japanese Ext Katakana @B2A */ - case 1390: /* Japanese new Ext Katakana @B2A */ - case 5035: /* Japanese Ext Latin @B2A */ - case 1399: /* Japanese new Ext Latin @B2A */ - convSource = "Cp942";/* 8bit ASCII Japanese@B2A */ - break; - case 933: /* Korean @B2A */ - case 1364: /* Korean (new) @B2A */ - convSource = "Cp949";/* 8bit ASCII Korean @B2A */ - break; - case 937: /* T-Chinese @B2A */ - case 1371: /* T-Chinese (new) @B2A */ - case 1388: /* S-Chinese (new) @B2A */ - convSource = "Cp950";/* 8bit ASCII T-Chinese@B2A*/ - break; - case 935: /* S-Chinese @B2A */ - convSource = "Cp1381";/* 8bit ASCII S-Chinese@B2A*/ - break; - - default: convSource = "Cp850"; - } - - transformOptions.setParameter(PrintObject.ATTR_SRC_CODEPAGE, convSource); - }// @B2A - } - - // add the selection codepoint to the open request datastream - openReq.addCodePoint(selectionCP); - - // setup OPEN reply datastream - NPDataStream openRep = new NPDataStream(objectType_); - openRep.addCodePoint(cpObjHndl_); - openRep.addCodePoint(cpCPFMsg_); - - // try to open the spooled file - conversation_ = npSystem_.getConversation(); - boolean fOpenOK = false; - try { - // make the OPEN request - int rc = conversation_.makeRequest(openReq, openRep); - - if (rc != NPDataStream.RET_OK) { // failed - Trace.log(Trace.ERROR, "Error opening SpooledFile; rc = " + rc); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.AS400_ERROR); - } - else { - // try to get the number of bytes in the spooled file - // it will throw an exception if there is any error - retrieveNumberOfBytes(); - fOpenOK = true; - } - } - finally { - // if we got here because an exception was thrown - if (!fOpenOK) { - if (npSystem_ != null) { - npSystem_.returnConversation(conversation_); - } - conversation_ = null; - } - } - } - - - -/** -Returns the number of bytes available (with blocking). - -@return The number of available bytes (with blocking). -**/ - public int available() throws IOException - { - return numBytes_ - offset_; - } - - - -/** -Closes the input stream and releases any resources associated with it. - -@exception IOException If an error occurs while communicating with the server. -**/ - public void close() throws IOException - { - if (conversation_ == null) { - Trace.log(Trace.ERROR, "Conversation is null."); - throw new IOException(); - } - else { - // set up CLOSE request datastream - NPDataStream closeReq = new NPDataStream(objectType_); - closeReq.setAction(NPDataStream.CLOSE); - closeReq.addCodePoint(cpObjHndl_); - - // set up CLOSE reply datastream - NPDataStream closeRep = new NPDataStream(objectType_); - closeRep.addCodePoint(cpCPFMsg_); - - try { - // make the CLOSE request - int rc = conversation_.makeRequest(closeReq, closeRep); - - if (rc != NPDataStream.RET_OK) { // failed - Trace.log(Trace.ERROR, "Error closing SpooledFile; rc = " + rc); - npSystem_.returnConversation(conversation_); - } - } - catch (Exception e) { - Trace.log(Trace.ERROR, "Caught an Exception." + e.toString()); - throw new IOException(e.toString()); - } - - finally { - if (npSystem_ != null) { - npSystem_.returnConversation(conversation_); - npSystem_ = null; - } - conversation_ = null; - } - } - } - - - -/** -Closes the stream when garbage is collected. - -@exception Throwable If an error occurs. -**/ - protected void finalize() throws Throwable - { - if (conversation_ != null) { - // attempt to send the close() request and then - // return the conversation to the pool... - // Ignore any replies here to avoid a deadlock - // if we are called on the AS400Server's background thread. - NPDataStream closeReq = new NPDataStream(objectType_); - closeReq.setAction(NPDataStream.CLOSE); - closeReq.addCodePoint(cpObjHndl_); - - AS400Server server= conversation_.getServer(); - if (server != null) { - // close the input stream - // @B1D closeReq.setHostCCSID(conversation_.getHostCCSID()); - closeReq.setConverter(conversation_.getConverter()); - server.sendAndDiscardReply(closeReq); - } - - if (npSystem_ != null) { - npSystem_.returnConversation(conversation_); - npSystem_ = null; - } - conversation_ = null; - } - super.finalize(); // always call super.finalize()! - } - - - -/** -Reads up to length bytes of data from this input stream into data, -starting at the array offset dataOffset. - -@param data The buffer into which the data is read. -@param dataOffset The start offset of the data. -@param length The maximum number of bytes to read. - -@return The total number of bytes read into the buffer, or -1 if there is -no more data because the end of file has been reached. - -@exception IOException If an error occurs while communicating with the server. -**/ - public int read(byte data[], int dataOffset, int length) throws IOException - { - int bytesRead = 0; - int bytesToRead = 0; - Integer sizeTarget = new Integer(data.length); - - byte dataSource[] = new byte[length]; - if (conversation_ == null) { - Trace.log(Trace.ERROR, "Conversation is null."); - throw new IOException(); - } - else { - // set the number of bytes to read - NPCPAttribute cpAttr = new NPCPAttribute(); - cpAttr.setAttrValue(PrintObject.ATTR_NUMBYTES, length); - - // set up READ request datastream - NPDataStream readReq = new NPDataStream(objectType_); - readReq.setAction(NPDataStream.READ); - readReq.addCodePoint(cpObjHndl_); - readReq.addCodePoint(cpAttr); - - // Point the data codepoint to receive the data into our buffer. - // Our buffer better be big enough to hold the data or we''ll - // not get it at all - NPCPData cpData = new NPCPData(); - cpData.setDataBuffer(data, 0, dataOffset); - - // set up READ reply datastream - NPDataStream readRep = new NPDataStream(objectType_); - readRep.addCodePoint(cpData); - readRep.addCodePoint(cpCPFMsg_); - - try { - // make the READ request - int iRC = conversation_.makeRequest(readReq, readRep); - // cidConv and convTarget are checked/initialized w/in - // createPrintObjectTransformedInputStream and indicate - // A second ASCII conversion required - if (cidConv){ // begin - String convString = new String(data, dataOffset, length, convSource); - dataSource = convString.getBytes(convTarget); - Integer sizeSource = new Integer(dataSource.length); - if (sizeSource.compareTo(sizeTarget) >= 0){ - bytesToRead = sizeTarget.intValue(); - } - else { - bytesToRead = sizeSource.intValue(); - } - System.arraycopy(dataSource, 0, data, 0, bytesToRead); - } // end - - switch (iRC) { - case NPDataStream.RET_OK: - case NPDataStream.RET_READ_INCOMPLETE: // maybe read some bytes? - // see how many bytes we read - bytesRead = cpData.getDataLength(); - offset_ += bytesRead; // update how far we are from the start of block - if (readRep.get32bit(NPDataStream.FLAGS_OFFSET) == 0x20000000) { - retrieveNumberOfBytes(); - offset_ = 0; - } - break; - case NPDataStream.RET_READ_EOF: - // this return code is only returned if there are no - // bytes read at all - bytesRead = -1; // set rc to end of file - break; - default: - // log an error throw appropriate exception - Trace.log(Trace.ERROR, "Error received on read : " + Integer.toString(iRC)); - throw new IOException(Integer.toString(iRC)); - } - } - - catch (Exception e) { - Trace.log(Trace.ERROR, "Caught an Exception." + e.toString()); - throw new IOException(e.toString()); - } - } - return bytesRead; - } - - - -/** -Retrieves the number of bytes of transformed data available in the stream. - -@return The number of bytes of transformed data available in the stream. -**/ - private void retrieveNumberOfBytes() - throws IOException, - RequestNotSupportedException - - { - // set up attributes to retrieve ID list - NPCPAttributeIDList cpAttrsToRetrieve = new NPCPAttributeIDList(); - cpAttrsToRetrieve.addAttrID(PrintObject.ATTR_NUMBYTES); - - // set up TELL request datastream - NPDataStream tellReq = new NPDataStream(objectType_); - tellReq.addCodePoint(cpObjHndl_); - tellReq.addCodePoint(cpAttrsToRetrieve); - tellReq.setAction(NPDataStream.TELL); - - // set up TELL reply datastream - NPDataStream tellRep = new NPDataStream(objectType_); - NPCPAttribute cpAttrs = new NPCPAttribute(); - tellRep.addCodePoint(cpAttrs); - - try { - // make TELL request - int rc = conversation_.makeRequest(tellReq, tellRep); - if (rc == NPDataStream.RET_OK) { - Integer numBytes = cpAttrs.getIntValue(PrintObject.ATTR_NUMBYTES); - if (numBytes != null) { - numBytes_ = numBytes.intValue(); - } - else { - Trace.log(Trace.ERROR, - "Network Print Server does not support retrieving data block length."); - throw new RequestNotSupportedException( - conversation_.getAttribute(PrintObject.ATTR_NPSLEVEL), - RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - } - } - else { - Trace.log(Trace.ERROR, - "Network Print Server error retrieving data block length. RC ="+ rc); - throw new RequestNotSupportedException( - conversation_.getAttribute(PrintObject.ATTR_NPSLEVEL), - RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - } - } - catch (Exception e) { - Trace.log(Trace.ERROR, "Caught an Exception." + e.toString()); - throw new IOException(e.toString()); - } - } - - - -/** -Seeks to location offset within the stream. - -@param offset The number of bytes to seek from current mark. - -@exception IOException If an error occurs while communicating with the server. -**/ - private void seekFromCur(int offset) - throws IOException - { - // create the attribute code point for the seek data - NPCPAttribute cpAttr = new NPCPAttribute(); - cpAttr.setAttrValue(PrintObject.ATTR_SEEKORG, 2); // current read pointer - cpAttr.setAttrValue(PrintObject.ATTR_SEEKOFF, offset); // offset - - // set up the SEEK request datastream - NPDataStream seekReq = new NPDataStream(objectType_); - seekReq.setAction(NPDataStream.SEEK); - seekReq.addCodePoint(cpObjHndl_); - seekReq.addCodePoint(cpAttr); - - // set up the SEEK reply datastream - NPDataStream seekRep = new NPDataStream(objectType_); - seekRep.addCodePoint(cpCPFMsg_); - - try { - // make SEEK request - int iRC = conversation_.makeRequest(seekReq, seekRep); - - switch (iRC) { - case NPDataStream.RET_OK: - offset_ += offset; // update distance from beginning of block - break; - case NPDataStream.RET_SEEK_OFF_BAD: - default: - // we should never get Seek offset bad because we - // always check in skip that we aren't going beyond the end of - // the file. The other place we seek is on a reset and that - // should work. - Trace.log(Trace.ERROR, "Seek from cur error " + Integer.toString(iRC)); - throw new IOException(Integer.toString(iRC)); - } - } - catch (Exception e) { - Trace.log(Trace.ERROR, "Caught an Exception." + e.toString()); - throw new IOException(e.toString()); - } - } - - - -/** -Skips over the next bytesToSkip bytes in the stream. -This method may skip less bytes than specified if the end of -the data block is reached. The actual number of bytes skipped is returned. -No action is taken if the number of bytes to skip is not positive. - -@param bytesToSkip The number of bytes to be skipped. - -@return The actual number of bytes skipped. - -@exception IOException If an error occurs while communicating with the server. -**/ - public long skip(long bytesToSkip) throws IOException - { - /* - if (bytesToSkip <= 0) { - return 0; - } - */ // @A2D - check is in public class - - if (conversation_ == null) { - Trace.log(Trace.ERROR, "Conversation is null."); - throw new IOException(); - } - else { - int maxSkip = numBytes_ - offset_; // maximum number of bytes you can skip - if (bytesToSkip > maxSkip) { - bytesToSkip = maxSkip; - } - seekFromCur((int)bytesToSkip); // seek ahead from current pointer n bytes - } - return bytesToSkip; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/PrintParameterList.java b/cvsroot/src/com/ibm/as400/access/PrintParameterList.java deleted file mode 100644 index cb5299d4e..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrintParameterList.java +++ /dev/null @@ -1,152 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintParameterList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - * The PrintParameterList class is used to group a set of attributes or - * parameters for use on other network print class methods. - * If a parameter has not been previously set, it is appended to the list; - * otherwise, the parameter is overridden. - * - * - *@see PrintObject - **/ - -// public class that we'll use to "wrap" the NPCPAttribute class in -// exposing what is needed to set a list of parameters -public class PrintParameterList -implements java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - private NPCPAttribute attrCP_; - - - /** - * Constructs a PrintParameterList object. - * - **/ - public PrintParameterList() - { - attrCP_ = new NPCPAttribute(); - } - - // - // get access to attribute code point - // used internally when we are ready to send this code point - // - NPCPAttribute getAttrCodePoint() - { - return attrCP_; - } - - - /** - * Returns a float parameter. - * - * @param attributeID Identifies which attribute to retrieve. - * See the documentation of the specific network print classes for the attribute IDs - * that are valid for each particular class. - * - * @return The value of the attribute. Returns null if the attribute has not been set. - **/ - public Float getFloatParameter(int attributeID) - { - return attrCP_.getFloatValue(attributeID); - - } - - /** - * Returns an integer parameter. - * - * @param attributeID Identifies which attribute to retrieve. - * See the documentation of network print classes for what attribute IDs - * are valid for each particular class. - * - * @return The value of the attribute. Returns null if the attribute has not been set. - **/ - public Integer getIntegerParameter(int attributeID) - { - return attrCP_.getIntValue(attributeID); - } - - /** - * Returns a string parameter. - * - * @param attributeID Identifies which attribute to retrieve. - * See the documentation of network print classes for what attribute IDs - * are valid for each particular class. - * - * @return The value of the attribute. Returns null if the attribute has not been set. - **/ - public String getStringParameter(int attributeID) - { - return attrCP_.getStringValue(attributeID); - } - - /* Allows object to be deserialized */ - private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - } - - /** - * Sets a string parameter. - * - * @param attributeID Identifies which attribute to set. - * See the documentation of network print classes for what attribute IDs - * are valid for each particular class. - * @param value The new value for the attribute. - * - **/ - public void setParameter(int attributeID, String value) - { - attrCP_.setAttrValue(attributeID, value); - } - - /** - * Sets an integer parameter. - * - * @param attributeID Identifies which attribute to set. - * See the documentation of network print classes for what attribute IDs - * are valid for each particular class. - * @param value The new value for the attribute. - * - **/ - public void setParameter(int attributeID, int value) - { - attrCP_.setAttrValue(attributeID, value); - } - - /** - * Sets a float parameter. - * - * @param attributeID Identifies which attribute to set. - * See the documentation of network print classes for what attribute IDs - * are valid for each particular class. - * @param value The new value for the attribute. - * - **/ - public void setParameter(int attributeID, float value) - { - attrCP_.setAttrValue(attributeID, value); - } - -} // Print Parameter List class - diff --git a/cvsroot/src/com/ibm/as400/access/Printer.java b/cvsroot/src/com/ibm/as400/access/Printer.java deleted file mode 100644 index de169ef25..000000000 --- a/cvsroot/src/com/ibm/as400/access/Printer.java +++ /dev/null @@ -1,237 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Printer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.IOException; - -/** - * The Printer class represents a printer. - * An instance of this class can be used to manipulate an individual - * printer. - * - * See Printer Attributes for - * valid attributes. - * - **/ - -public class Printer extends PrintObject -implements java.io.Serializable -{ - static final long serialVersionUID = 4L; - - private static boolean fAttrIDsToRtvBuilt_ = false; - private static final String NAME = "name"; - - - // constructor used internally (not externalized since it takes - // an ID code point - Printer(AS400 system, NPCPIDPrinter id, NPCPAttribute attrs) - { - super(system, id, attrs, NPConstants.PRINTER_DEVICE); - } - - - - /** - * Constructs a Printer object. The system and the - * name of the printer must be set later. This constructor - * is provided for visual application builders that support - * JavaBeans. It is not intended for use by application - * programmers. - * - * @see PrintObject#setSystem - * @see #setName - **/ - public Printer() - { - super(null, null, NPConstants.PRINTER_DEVICE); - - // Because of this constructor we will need to check the - // system and printer name before trying to use them. - } - - - - /** - * Constructs a Printer object. It uses the specified system name and - * the printer name that identifies it on that system. - * - * @param system The system on which this printer device exists. - * @param printerName The name of the printer. It cannot be greater - * than 10 characters or less than 1 character - * in length. - * - **/ - public Printer(AS400 system, - String printerName) - { - super(system, new NPCPIDPrinter(printerName), null, NPConstants.PRINTER_DEVICE); - - // base class constructor checks for a null system. - checkPrinterName(printerName); - } - - - - // check the printer name to see if valid - void checkPrinterName( String printerName ) - { - if (printerName == null) { - Trace.log(Trace.ERROR, "Parameter 'printerName' is null."); - throw new NullPointerException("printerName"); - } - - if ((printerName.length() > 10) || (printerName.length() < 1)) { - Trace.log(Trace.ERROR, "Parameter 'printerName' is greater than 10 or less than 1 characters in length " + printerName); - throw new ExtendedIllegalArgumentException( - "printerName("+printerName+")", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - } - - - // Check the run time state - void checkRunTimeState() - { - // check whatever the base class needs to check - super.checkRunTimeState(); - - // Printers need to additionally check the printer name. - // In this context, getIDCodePoint() returns the printer name. - if( getIDCodePoint() == null ) - { - Trace.log(Trace.ERROR, "Printer name has not been set."); - throw new ExtendedIllegalStateException( - "name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - - - - // A4A - Added chooseImpl() method - /** - * Chooses the implementation - **/ - void chooseImpl() - throws IOException, AS400SecurityException - { - AS400 system = getSystem(); - if (system == null) { - Trace.log( Trace.ERROR, "Attempt to use Printer before setting system." ); - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - impl_ = (PrinterImpl) system.loadImpl2("com.ibm.as400.access.PrinterImplRemote", - "com.ibm.as400.access.PrinterImplProxy"); - super.setImpl(); - } - - - - /** - * Returns the name of the printer. - * - * @return The name of the printer. If name is not set, "" is returned. - **/ - public String getName() - { - NPCPID IDCodePoint = getIDCodePoint(); - - if( IDCodePoint == null ) { - return EMPTY_STRING; // "" - } else { - return IDCodePoint.getStringValue(ATTR_PRINTER); - } - } - - - /** - * Sets one or more attributes of the object. See - * Printer Attributes for - * a list of valid attributes that can be changed. - *
    Note that only the following attributes can be changed: - *

      - *
    • {@link PrintObject#ATTR_CHANGES ATTR_CHANGES} - *
    • {@link PrintObject#ATTR_DRWRSEP ATTR_DRWRSEP} - *
    • {@link PrintObject#ATTR_FILESEP ATTR_FILESEP} - *
    • {@link PrintObject#ATTR_FORMTYPE ATTR_FORMTYPE} - *
    • {@link PrintObject#ATTR_OUTPUT_QUEUE ATTR_OUTPUT_QUEUE} - *
    • {@link PrintObject#ATTR_DESCRIPTION ATTR_DESCRIPTION} - *
    - * Any other attributes will be ignored by this method. - * - * @param attributes A print parameter list that contains the - * attributes to be changed. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - **/ - public void setAttributes(PrintParameterList attributes) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - if (attributes == null) { - Trace.log(Trace.ERROR, "Parameter 'attributes' is null."); - throw new NullPointerException("attributes"); - } - - checkRunTimeState(); - - if (impl_ == null) chooseImpl(); - - ((PrinterImpl) impl_).setAttributes(attributes); - - // propagate any changes to attrs - attrs = impl_.getAttrValue(); - } - - - - /** - * Sets the name of the printer. - * - * @param name The name of the printer. It cannot be greater - * than 10 characters. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setName(String name) - throws PropertyVetoException - { - checkPrinterName(name); - - String oldName = getName(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange(NAME, oldName, name ); - - // No one vetoed, make the change. - setIDCodePoint(new NPCPIDPrinter(name)); - - // Notify any property change listeners. - changes.firePropertyChange( NAME, oldName, name ); - } - -} // end Printer class diff --git a/cvsroot/src/com/ibm/as400/access/Printer16.gif b/cvsroot/src/com/ibm/as400/access/Printer16.gif deleted file mode 100644 index 30d95b254..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/Printer16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/Printer32.gif b/cvsroot/src/com/ibm/as400/access/Printer32.gif deleted file mode 100644 index adb8aaec1..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/Printer32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/PrinterBeanInfo.java b/cvsroot/src/com/ibm/as400/access/PrinterBeanInfo.java deleted file mode 100644 index ace83bf07..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrinterBeanInfo.java +++ /dev/null @@ -1,140 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; -import java.awt.Image; - -/** -BeanInfo for Printer class. -**/ -public class PrinterBeanInfo extends PrintObjectBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Additional properties defined for Printer - private static PropertyDescriptor[] prtDProperties_; - - // Class this bean info represents. - private final static Class beanClass = Printer.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader rbl_; - - static - { - try - { - PropertyDescriptor name = - new PropertyDescriptor("name", beanClass); - name.setBound(true); - name.setConstrained(true); - name.setDisplayName(rbl_.getText("PROP_NAME_PRTD_NAME")); - name.setShortDescription(rbl_.getText("PROP_DESC_PRTD_NAME")); - - PropertyDescriptor[] properties = {name}; - prtDProperties_ = properties; - } - - catch (IntrospectionException e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - // Printer does not define any additional events so we - // let the PrintObject provide: - // public int getDefaultEventIndex() - // public EventSetDescriptor[] getEventSetDescriptors() - - // We want "system" as the default property. PrintObject - // sets this so we don't have to override: - // public int getDefaultPropertyIndex() - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - // Per the JavaBean spec, properties are discrete, named attributes - // of a Java Bean that can affect its appearance or its behavior. - - PropertyDescriptor[] printObjectProperties; - PropertyDescriptor[] combinedProperties; - int combinedSize; - - // Get the properties defined in PrintObjectBeanInfo - printObjectProperties = super.getPropertyDescriptors(); - - combinedSize = printObjectProperties.length + prtDProperties_.length; - combinedProperties = new PropertyDescriptor[combinedSize]; - - // copy PrintObject properties - System.arraycopy( printObjectProperties, // source - 0, // --offset - combinedProperties, // destination - 0, // --offset - printObjectProperties.length ); // length - - // copy Printer properties - System.arraycopy( prtDProperties_, // source - 0, // --offset - combinedProperties, // destination - printObjectProperties.length, // --offset - prtDProperties_.length ); // length - - return combinedProperties; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("Printer16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("Printer32.gif"); - break; - } - - return image; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/PrinterFile.java b/cvsroot/src/com/ibm/as400/access/PrinterFile.java deleted file mode 100644 index 8ec939832..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrinterFile.java +++ /dev/null @@ -1,249 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterFile.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.beans.PropertyVetoException; - -/** - * The PrinterFile class represents a printer file. - * An instance of this class can be used to manipulate an individual - * printer file. - * - * See Printer File Attributes for - * valid attributes. - * - **/ - -public class PrinterFile extends PrintObject -implements java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - private static final String PATH = "path"; - - // constructor used internally (not externalized since it takes - // an ID code point - PrinterFile(AS400 system, NPCPIDPrinterFile id, NPCPAttribute attrs) - { - super(system, id, attrs, NPConstants.PRINTER_FILE); - } - - - - /** - * Constructs a PrinterFile object. The system and the - * integrated file system name of the printer file must be set - * later. This constructor is provided for visual application - * builders that support JavaBeans. It is not intended for use - * by application programmers. - * - * @see PrintObject#setSystem - * @see #setPath - **/ - public PrinterFile() - { - super(null, null, NPConstants.PRINTER_FILE); - - // Because of this constructor we will need to check the - // run time state of PrinterFile objects. - } - - - - /** - * Constructs a PrinterFile object. It uses the specified system name and - * printer file that identify it on the system. - * - * @param system The system on which this printer file exists. - * @param printerFileName The integrated file system name of the printer file. The format of - * the printer file string must be in the format of \QSYS.LIB\libname.LIB\printerfilename.FILE. - **/ - public PrinterFile(AS400 system, - String printerFileName) - { - super(system, buildIDCodePoint(printerFileName), null, NPConstants.PRINTER_FILE); - - // Base class constructor checks for a null system. - // QSYSObjectPathName() checks for a null printerFileName. - } - - - - // builds the ID CodePoint - private static NPCPIDPrinterFile buildIDCodePoint(String IFSPrinterFileName) - { - QSYSObjectPathName ifsPath = new QSYSObjectPathName(IFSPrinterFileName, "FILE"); - - return new NPCPIDPrinterFile(ifsPath.getObjectName(), ifsPath.getLibraryName()); - } - - - - // Check the run time state - void checkRunTimeState() - { - // check whatever the base class needs to check - super.checkRunTimeState(); - - // PrinterFile's need to additionally check the IFS pathname. - if( getIDCodePoint() == null ) - { - Trace.log(Trace.ERROR, "Parameter 'path' has not been set."); - throw new ExtendedIllegalStateException( - PATH, ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - - - - // A1A - Added chooseImpl() method - /** - * Chooses the appropriate implementation. - **/ - void chooseImpl() - throws IOException, AS400SecurityException - { - // We need to get the system to connect to... - AS400 system = getSystem(); - if (system == null) { - Trace.log( Trace.ERROR, "Attempt to use PrinterFile before setting system." ); - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - impl_ = (PrinterFileImpl) system.loadImpl2("com.ibm.as400.access.PrinterFileImplRemote", - "com.ibm.as400.access.PrinterFileImplProxy"); - super.setImpl(); - } - - - - /** - * Returns the name of the printer file. - * - * @return The name of the printer file. - **/ - public String getName() - { - NPCPID IDCodePoint = getIDCodePoint(); - - if( IDCodePoint == null ) { - return EMPTY_STRING; // "" - } else { - return IDCodePoint.getStringValue(ATTR_PRTFILE); - } - } - - - - /** - * Returns the integrated file system pathname of the printer file. - * - * @return The integrated file system pathname of the printer file. - **/ - public String getPath() - { - NPCPID IDCodePoint = getIDCodePoint(); - - if( IDCodePoint == null ) { - return EMPTY_STRING; // "" - } else { - return QSYSObjectPathName.toPath( - IDCodePoint.getStringValue(ATTR_PRTFLIB), // library name - IDCodePoint.getStringValue(ATTR_PRTFILE), // printer file name - "FILE"); // type - } - } - - - - /** - * Sets one or more attributes of the object. See - * Printer File Attributes for - * a list of valid attributes that can be changed. - * - * @param attributes A print parameter list that contains the - * attributes to be changed. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - **/ - public void setAttributes(PrintParameterList attributes) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - if (attributes == null) { - Trace.log(Trace.ERROR, "Parameter 'attributes' is null."); - throw new NullPointerException("attributes"); - } - - checkRunTimeState(); - - if (impl_ == null) - chooseImpl(); - ((PrinterFileImpl) impl_).setAttributes(attributes); - // propagate any changes to attrs - attrs = impl_.getAttrValue(); - } - - - - /** - * Sets the integrated file system pathname of the printer file. - * - * @param path The integrated file system name of the printer file. The format of - * the printer file string must be in the format of \QSYS.LIB\libname.LIB\printerfilename.FILE. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setPath(String path) - throws PropertyVetoException - { - if( path == null ) - { - Trace.log( Trace.ERROR, "Parameter 'path' is null" ); - throw new NullPointerException( PATH ); - } - - // check for connection... - if (impl_ != null) { - Trace.log(Trace.ERROR, "Cannot set property 'path' after connect."); - throw new ExtendedIllegalStateException(PATH, ExtendedIllegalStateException.PROPERTY_NOT_CHANGED ); - } - - String oldPath = getPath(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( PATH, oldPath, path ); - - // No one vetoed, make the change. - setIDCodePoint(buildIDCodePoint(path)); - - // Notify any property change listeners. - changes.firePropertyChange( PATH, oldPath, path ); - } - -} // end PrinterFile class diff --git a/cvsroot/src/com/ibm/as400/access/PrinterFile16.gif b/cvsroot/src/com/ibm/as400/access/PrinterFile16.gif deleted file mode 100644 index 44d057887..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/PrinterFile16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/PrinterFile32.gif b/cvsroot/src/com/ibm/as400/access/PrinterFile32.gif deleted file mode 100644 index ea3fe6bea..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/PrinterFile32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/PrinterFileBeanInfo.java b/cvsroot/src/com/ibm/as400/access/PrinterFileBeanInfo.java deleted file mode 100644 index 59db24c54..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrinterFileBeanInfo.java +++ /dev/null @@ -1,150 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterFileBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; -import java.awt.Image; - -/** -BeanInfo for PrinterFile class. -**/ -public class PrinterFileBeanInfo extends PrintObjectBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Additional properties defined for PrinterFile - private static PropertyDescriptor[] prtFProperties_; - - // Class this bean info represents. - private final static Class beanClass = PrinterFile.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader rbl_; - - static - { - try - { - // "attributes" is not a property, hide it from introspection. - PropertyDescriptor attributes = - new PropertyDescriptor( "attributes", beanClass, null, "setAttributes" ); - attributes.setHidden(true); - - // "name" is not a property, hide it from introspection. - PropertyDescriptor name = - new PropertyDescriptor( "name", beanClass, "getName", null ); - name.setHidden(true); - - PropertyDescriptor path = - new PropertyDescriptor("path", beanClass); - path.setBound(true); - path.setConstrained(true); - path.setDisplayName(rbl_.getText("PROP_NAME_PATH")); - path.setShortDescription(rbl_.getText("PROP_DESC_PATH")); - - PropertyDescriptor properties[] = {attributes, name, path}; - prtFProperties_ = properties; - } - - catch (IntrospectionException e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - // PrinterFile does not define any additional events so we - // let the PrintObject provide: - // public int getDefaultEventIndex() - // public EventSetDescriptor[] getEventSetDescriptors() - - // We want "system" as the default property. PrintObject - // sets this so we don't have to override: - // public int getDefaultPropertyIndex() - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - // Per the JavaBean spec, properties are discrete, named attributes - // of a Java Bean that can affect its appearance or its behavior. - - PropertyDescriptor[] printObjectProperties; - PropertyDescriptor[] combinedProperties; - int combinedSize; - - // Get the properties defined in PrintObjectBeanInfo - printObjectProperties = super.getPropertyDescriptors(); - - combinedSize = printObjectProperties.length + prtFProperties_.length; - combinedProperties = new PropertyDescriptor[combinedSize]; - - // copy PrintObject properties - System.arraycopy( printObjectProperties, // source - 0, // --offset - combinedProperties, // destination - 0, // --offset - printObjectProperties.length ); // length - - // copy PrinterFile properties - System.arraycopy( prtFProperties_, // source - 0, // --offset - combinedProperties, // destination - printObjectProperties.length, // --offset - prtFProperties_.length ); // length - - return combinedProperties; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("PrinterFile16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("PrinterFile32.gif"); - break; - } - - return image; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/PrinterFileImpl.java b/cvsroot/src/com/ibm/as400/access/PrinterFileImpl.java deleted file mode 100644 index b491ba0ee..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrinterFileImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterFileImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - * The PrinterFileImpl interface defines a set of methods - * needed for a full implementation of the PrinterFile class. - **/ - -interface PrinterFileImpl extends PrintObjectImpl -{ - public abstract void setAttributes(PrintParameterList attributes) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException; -} diff --git a/cvsroot/src/com/ibm/as400/access/PrinterFileImplProxy.java b/cvsroot/src/com/ibm/as400/access/PrinterFileImplProxy.java deleted file mode 100644 index 42e3f9ab6..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrinterFileImplProxy.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterFileImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - -/** - * The PrinterFileImplProxy class implements proxy versions of - * the public methods defined in the PrinterFileImpl class. - * Unless commented otherwise, the implementations of the methods below - * are merely proxy calls to the corresponding method in the remote - * implementation class (PrinterFileImplRemote). - **/ - -class PrinterFileImplProxy extends PrintObjectImplProxy -implements PrinterFileImpl, ProxyImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - PrinterFileImplProxy() - { - super("PrinterFile"); - } - - - public void setAttributes(PrintParameterList attributes) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - try { - connection_.callMethod(pxId_, "setAttributes", - new Class[] { PrintParameterList.class }, - new Object[] { attributes }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow4(e); - } - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/PrinterFileImplRemote.java b/cvsroot/src/com/ibm/as400/access/PrinterFileImplRemote.java deleted file mode 100644 index 3b66ca4e1..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrinterFileImplRemote.java +++ /dev/null @@ -1,204 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterFileImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - * The PrinterFile class represents a server printer file. - * An instance of this class can be used to manipulate an individual - * printer file. - * - * See Printer File Attributes for - * valid attributes. - * - **/ - -class PrinterFileImplRemote extends PrintObjectImplRemote -implements PrinterFileImpl -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - private static final NPCPAttributeIDList attrsToRetrieve_ = new NPCPAttributeIDList(); - private static boolean fAttrIDsToRtvBuilt_ = false; - - - private synchronized void buildAttrIDsToRtv() - { - if (!fAttrIDsToRtvBuilt_) - { - attrsToRetrieve_.addAttrID(PrintObject.ATTR_ALIGN); // align page - attrsToRetrieve_.addAttrID(PrintObject.ATTR_BKMGN_ACR); // back margin across - attrsToRetrieve_.addAttrID(PrintObject.ATTR_BKMGN_DWN); // back margin down - attrsToRetrieve_.addAttrID(PrintObject.ATTR_BKOVRLLIB); // back side overlay library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_BKOVRLAY); // back side overlay name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_BKOVL_DWN); // back overlay offset down - attrsToRetrieve_.addAttrID(PrintObject.ATTR_BKOVL_ACR); // back overlay offset across - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CHAR_ID); // set of graphic characters f - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CPI); // characters per inch - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CODEDFNTLIB); // coded font library name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CODEPAGE); // code page - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CODEDFNT); // coded font - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CONTROLCHAR); // control character - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CONVERT_LINEDATA); // convert line data - attrsToRetrieve_.addAttrID(PrintObject.ATTR_COPIES); // copies (total) - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CORNER_STAPLE); // corner staple - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DAYS_UNTIL_EXPIRE); // days until file expires - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DBCSDATA); // contains DBCS character set - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DBCSEXTENSN); // process DBCS extension char - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DBCSROTATE); // rotate DBCS characters - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DBCSCPI); // DBCS CPI - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DBCSSISO); // DBCS SI/SO positioning - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DESCRIPTION); // text description - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DFR_WRITE); // defer write - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DUPLEX); // print on both sides of pape - attrsToRetrieve_.addAttrID(PrintObject.ATTR_EDGESTITCH_NUMSTAPLES); // edgestich number of staples - attrsToRetrieve_.addAttrID(PrintObject.ATTR_EDGESTITCH_STPL_OFFSET_INFO);// edgestitch info offset - attrsToRetrieve_.addAttrID(PrintObject.ATTR_EDGESTITCH_REF); // edgestitch reference - attrsToRetrieve_.addAttrID(PrintObject.ATTR_EDGESTITCH_REFOFF); // edgestitch reference offset - attrsToRetrieve_.addAttrID(PrintObject.ATTR_ENDPAGE); // ending page number to print - attrsToRetrieve_.addAttrID(PrintObject.ATTR_EXPIRATION_DATE); // Spool file expiration date - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FIDELITY); // the error handling when pri - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FILESEP); // number of file separators - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FOLDREC); // wrap text to next line - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FONTID); // Font identifier to use (def - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FORMDEFLIB); // Form definition library name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FORMDEF); // Form definition name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FORMFEED); // type of paperfeed to be use - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FORMTYPE); // name of the form to be used - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FTMGN_ACR); // front margin across - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FTMGN_DWN); // front margin down - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FTOVRLLIB); // front side overlay library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FTOVRLAY); // front side overlay name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FTOVL_ACR); // front overlay offset across - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FTOVL_DWN); // front overlay offset down - attrsToRetrieve_.addAttrID(PrintObject.ATTR_HOLD); // hold the spool file - attrsToRetrieve_.addAttrID(PrintObject.ATTR_JUSTIFY); // hardware justification - attrsToRetrieve_.addAttrID(PrintObject.ATTR_LPI); // lines per inch - attrsToRetrieve_.addAttrID(PrintObject.ATTR_MAXRCDS); // *maximum number of records - attrsToRetrieve_.addAttrID(PrintObject.ATTR_MEASMETHOD); // measurement method (*ROWCOL - attrsToRetrieve_.addAttrID(PrintObject.ATTR_MULTIUP); // logical pages per physical - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OUTPTY); // output priority - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OUTQUELIB); // output queue library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OUTQUE); // output queue - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OVERFLOW); // overflow line number - // attrsToRetrieve_.addAttrID(PrintObject.ATTR_PAGE_DEFINITION); page definition - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PAGDFNLIB); // page definition library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PAGDFN); // page definition - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PAGRTT); // degree of page rotation - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PAGELEN); // page length in Units of Mea - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PAGEWIDTH); // width of page in Units of M - attrsToRetrieve_.addAttrID(PrintObject.ATTR_POINTSIZE); // the default font's point si - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PRINTER); // printer device name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PRTQUALITY); // print quality - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PRTTEXT); // text printed at bottom of e - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PRTDEVTYPE); // printer dev type (data stre - attrsToRetrieve_.addAttrID(PrintObject.ATTR_RPLUNPRT); // replace unprintable charact - attrsToRetrieve_.addAttrID(PrintObject.ATTR_RPLCHAR); // character to replace unprin - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SADDLESTITCH_NUMSTAPLES); // saddle stitch number of staple - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SADDLESTITCH_REF); // saddle stitch reference - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SADDLESTITCH_STPL_OFFSEINFO);// saddle stitch offset - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SAVE); // whether to save after print - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SRCDRWR); // source drawer - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SPOOL); // spool the data - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SCHEDULE); // when available to the write - attrsToRetrieve_.addAttrID(PrintObject.ATTR_STARTPAGE); // starting page to print - attrsToRetrieve_.addAttrID(PrintObject.ATTR_UNITOFMEAS); // unit of measure - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USERDATA); // user data - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFDATA); // User defined data - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFOPT); // User defined options - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFOBJ); // User defined object - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFOBJLIB);// User defined object library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFOBJTYP);// User defined object type - fAttrIDsToRtvBuilt_ = true; - } - } - - - - private static NPCPIDPrinterFile buildIDCodePoint(String IFSPrinterFileName) - { - QSYSObjectPathName ifsPath = new QSYSObjectPathName(IFSPrinterFileName, "FILE"); - - return new NPCPIDPrinterFile(ifsPath.getObjectName(), ifsPath.getLibraryName()); - } - - - - // This method implements an abstract method of the superclass - NPCPAttributeIDList getAttrIDsToRetrieve() - { - if (!fAttrIDsToRtvBuilt_) { - buildAttrIDsToRtv(); - } - return attrsToRetrieve_; - } - - NPCPAttributeIDList getAttrIDsToRetrieve(int attrToRtv) - { - if (!fAttrIDsToRtvBuilt_) - { - attrsToRetrieve_.addAttrID(attrToRtv); - } - return attrsToRetrieve_; - } - - - /** - * Sets one or more attributes of the object. See - * Printer File Attributes for - * a list of valid attributes that can be changed. - * - * @param attributes A print parameter list that contains the - * attributes to be changed. - * - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - **/ - public void setAttributes(PrintParameterList attributes) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - NPDataStream sendDS = new NPDataStream(NPConstants.PRINTER_FILE); // @B1C - NPDataStream returnDS = new NPDataStream(NPConstants.PRINTER_FILE); // @B1C - NPSystem npSystem = NPSystem.getSystem(getSystem()); - - NPCPAttribute cpCPFMessage = new NPCPAttribute(); - NPCPAttribute cpNewAttrs = attributes.getAttrCodePoint(); - - sendDS.setAction(NPDataStream.CHANGE_ATTRIBUTES); - sendDS.addCodePoint(getIDCodePoint()); - sendDS.addCodePoint(cpNewAttrs); - - returnDS.addCodePoint(cpCPFMessage); - - npSystem.makeRequest(sendDS, returnDS); - - // we changed the printer file attributes on the server, - // merge those changed attributes into our current attributes - // here. - if (attrs == null) { - attrs = new NPCPAttribute(); - } - - attrs.addUpdateAttributes(cpNewAttrs); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/PrinterFileList.java b/cvsroot/src/com/ibm/as400/access/PrinterFileList.java deleted file mode 100644 index b881c7c40..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrinterFileList.java +++ /dev/null @@ -1,159 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterFileList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; - -/** - * The PrinterFileList class is used to build a list of objects of type PrinterFile. - * The list can be filtered by library and printer file name. - * - *@see PrinterFile - **/ - -public class PrinterFileList extends PrintObjectList -implements java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - - private static final String PRINTER_FILE_FILTER = "printerFileFilter"; - - /** - * Constructs a PrinterFileList object. The system must - * be set later. This constructor is provided for visual application - * builders that support JavaBeans. It is not intended for use - * by application programmers. - * - * @see PrintObjectList#setSystem - **/ - public PrinterFileList() - { - super(NPConstants.PRINTER_FILE, new NPCPSelPrtF()); - // Because of this constructor we will need to check the - // system before trying to use it. - } - - - - /** - * Constructs a PrinterFileList object. It uses the system name specified. - * - * @param system The system on which the printer files exists. - * - **/ - public PrinterFileList(AS400 system) - { - super(NPConstants.PRINTER_FILE, new NPCPSelPrtF(), system); - } - - - - /** - * Chooses the appropriate implementation. - **/ - void chooseImpl() - { - AS400 system = getSystem(); - if (system == null) { - Trace.log( Trace.ERROR, "Attempt to use PrinterFileList before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - impl_ = (PrintObjectListImpl) system.loadImpl2("com.ibm.as400.access.PrinterFileListImplRemote", - "com.ibm.as400.access.PrinterFileListImplProxy"); - super.setImpl(); - } - - - - /** - * Returns the printer file list filter. - * @return The printer file list filter. - * - **/ - public String getPrinterFileFilter() - { - // The selection code point is always present, it may - // however be empty. If empty, getPrinterFile() will - // return an empty string. - - NPCPSelPrtF selectionCP = (NPCPSelPrtF)getSelectionCP(); - return( selectionCP.getPrinterFile() ); - } - - - - PrintObject newNPObject(NPCPID cpid, NPCPAttribute cpattr) - { - return new PrinterFile(system_, (NPCPIDPrinterFile)cpid, cpattr); - } - - - /** - * Sets the printer file list filter. - * @param printerFileFilter The library and printer files to list. - * The format of the printerFileFilter string must be in the - * format of /QSYS.LIB/libname.LIB/printerfilename.FILE, where - *
    - * libname is the library name that contains the printer files to search. - * It can be a specific name or one of these special values: - *
      - *
    • %ALL% - All libraries are searched. - *
    • %ALLUSR% - All user-defined libraries, plus libraries containing user data - * and having names starting with the letter Q. - *
    • %CURLIB% - The server job's current library. - *
    • %LIBL% - The server job's library list. - *
    • %USRLIBL% - The user portion of the server job's library list. - *
    - * printerfilename is the name of the printer files to list. - * It can be a specific name, a generic name, or the special value %ALL%. - * The default for the library is %LIBL% and for the printer file name is %ALL%. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setPrinterFileFilter(String printerFileFilter) - throws PropertyVetoException - { - if( printerFileFilter == null ) - { - Trace.log( Trace.ERROR, "Parameter 'printerFileFilter' is null" ); - throw new NullPointerException( PRINTER_FILE_FILTER ); - } - - String oldPrinterFileFilter = getPrinterFileFilter(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( PRINTER_FILE_FILTER, - oldPrinterFileFilter, printerFileFilter ); - - // No one vetoed, make the change. - NPCPSelPrtF selectionCP = (NPCPSelPrtF)getSelectionCP(); - selectionCP.setPrinterFile(printerFileFilter); - - // Propagate change to ImplRemote if necessary... - if (impl_ != null) - impl_.setFilter("printerFile", printerFileFilter); - - // Notify any property change listeners. - changes.firePropertyChange( PRINTER_FILE_FILTER, - oldPrinterFileFilter, printerFileFilter ); - } - -} // PrinterFileList class - diff --git a/cvsroot/src/com/ibm/as400/access/PrinterFileList16.gif b/cvsroot/src/com/ibm/as400/access/PrinterFileList16.gif deleted file mode 100644 index 2e4299e5a..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/PrinterFileList16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/PrinterFileList32.gif b/cvsroot/src/com/ibm/as400/access/PrinterFileList32.gif deleted file mode 100644 index 282296939..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/PrinterFileList32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/PrinterFileListBeanInfo.java b/cvsroot/src/com/ibm/as400/access/PrinterFileListBeanInfo.java deleted file mode 100644 index acb6149b4..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrinterFileListBeanInfo.java +++ /dev/null @@ -1,140 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterFileListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; -import java.awt.Image; - -/** -BeanInfo for PrinterFileList class. -**/ -public class PrinterFileListBeanInfo extends PrintObjectListBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Additional properties for PrinterFileList - private static PropertyDescriptor[] prtFListProperties_; - - // Class this bean info represents. - private final static Class beanClass = PrinterFileList.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader rbl_; - - static - { - try - { - PropertyDescriptor prtFFilter = - new PropertyDescriptor("printerFileFilter", beanClass); - prtFFilter.setBound(true); - prtFFilter.setConstrained(true); - prtFFilter.setDisplayName(rbl_.getText("PROP_NAME_PRTF_NAME_FILTER")); - prtFFilter.setShortDescription(rbl_.getText("PROP_DESC_PRTF_NAME_FILTER")); - - PropertyDescriptor[] properties = {prtFFilter}; - prtFListProperties_ = properties; - } - - catch (IntrospectionException e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - // PrinterFileList does not define any additional events so we - // let the PrintObjectList provide: - // public int getDefaultEventIndex() - // public EventSetDescriptor[] getEventSetDescriptors() - - // We want "system" as the default property. PrintObjectList - // sets this so we don't have to override: - // public int getDefaultPropertyIndex() - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - // Per the JavaBean spec, properties are discrete, named attributes - // of a Java Bean that can affect its appearance or its behavior. - - PropertyDescriptor[] printObjectListProperties; - PropertyDescriptor[] combinedProperties; - int combinedSize; - - // Get the properties defined in PrintObjectListBeanInfo - printObjectListProperties = super.getPropertyDescriptors(); - - combinedSize = printObjectListProperties.length + prtFListProperties_.length; - combinedProperties = new PropertyDescriptor[combinedSize]; - - // copy PrintObjectList properties - System.arraycopy( printObjectListProperties, // source - 0, // --offset - combinedProperties, // destination - 0, // --offset - printObjectListProperties.length ); // length - - // copy PrinterFileList properties - System.arraycopy( prtFListProperties_, // source - 0, // --offset - combinedProperties, // destination - printObjectListProperties.length, // --offset - prtFListProperties_.length ); // length - - return combinedProperties; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("PrinterFileList16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("PrinterFileList32.gif"); - break; - } - - return image; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/PrinterFileListImplProxy.java b/cvsroot/src/com/ibm/as400/access/PrinterFileListImplProxy.java deleted file mode 100644 index 499889251..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrinterFileListImplProxy.java +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterFileListImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; - -class PrinterFileListImplProxy extends PrintObjectListImplProxy -implements ProxyImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - PrinterFileListImplProxy() - { - super("PrinterFileList"); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/PrinterFileListImplRemote.java b/cvsroot/src/com/ibm/as400/access/PrinterFileListImplRemote.java deleted file mode 100644 index af9f26006..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrinterFileListImplRemote.java +++ /dev/null @@ -1,127 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterFileListImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The PrinterFileList class is used to build a list of IBM i printer file objects of type PrinterFile. - * The list can be filtered by library and printer file name. - * - *@see PrinterFile - **/ - -class PrinterFileListImplRemote extends PrintObjectListImplRemote -{ - // static private binary data for default attribute to - // retrieve on a printer file when listing printer files - // format is: - // --------------------------------------------------- - // |nn | LEN | ID1 | ID2 | ID3 | ID4 | ....... | IDnn| - // --------------------------------------------------- - // nn - two byte total # of attributes in code point - // LEN - two byte length of each attribute entry, right - // now this will be 2 (0x02). - // IDx - two byte attribute ID - - private static final byte[] attrIDToList_ = - { - 0x00, 0x03, // big endian(BE), number of attrs - 0x00, 0x02, // BE - size in bytes of each ID - 0x00, 0x5B, // ATTR_PRTFLIB - 0x00, 0x5C, // ATTR_PRTFILE - 0x00, 0x6D // ATTR_DESCRIPTION - }; - - private static final NPCPAttributeIDList defaultAttrIDsToList_ = new NPCPAttributeIDList(attrIDToList_); - - // register the printer file return datastream for listing printer files - static - { - NPDataStream ds; - NPCodePoint cp; - - ds = new NPDataStream(NPConstants.PRINTER_FILE); - cp = new NPCPIDPrinterFile(); - ds.addCodePoint(cp); - cp = new NPCPAttribute(); - ds.addCodePoint(cp); - AS400Server.addReplyStream(ds, "as-netprt"); - } - - - - /** - * Returns the default attributes to list. - * @return The default attributes to list. - **/ - NPCPAttributeIDList getDefaultAttrsToList() - { - return defaultAttrIDsToList_; - } - - - - /** - * Create a new Printer File object. - **/ - /* - PrintObject newNPObject(AS400 system, NPDataStream reply) - { - PrinterFile npObj = null; - NPCPIDPrinterFile cpid; - NPCPAttribute cpAttrs; - cpid = (NPCPIDPrinterFile)reply.getCodePoint(NPCodePoint.PRINTER_FILE_ID); // never should return null - cpAttrs = (NPCPAttribute)reply.getCodePoint(NPCodePoint.ATTRIBUTE_VALUE); // may return null - npObj = new PrinterFile(system, cpid, cpAttrs); - return npObj; - } - */ - - - - NPCPID newNPCPID(NPDataStream reply) - { - return (NPCPIDPrinterFile)reply.getCodePoint(NPCodePoint.PRINTER_FILE_ID); // never should return null - } - - - - /** - * Sets the printer file list filter. - * @param printerFileFilter The library and printer files to list. - * The format of the printerFileFilter string must be in the - * format of /QSYS.LIB/libname.LIB/printerfilename.FILE, where - *
    - * libname is the library name that contains the printer files to search. - * It can be a specific name or one of these special values: - *
      - *
    • %ALL% - All libraries are searched. - *
    • %ALLUSR% - All user-defined libraries, plus libraries containing user data - * and having names starting with the letter Q. - *
    • %CURLIB% - The server job's current library. - *
    • %LIBL% - The server job's library list. - *
    • %USRLIBL% - The user portion of the server job's library list. - *
    - * printerfilename is the name of the printer files to list. - * It can be a specific name, a generic name, or the special value %ALL%. - * The default for the library is %LIBL% and for the printer file name is %ALL%. - * - **/ - public void setPrinterFileFilter(String printerFileFilter) - { - NPCPSelPrtF selectionCP = (NPCPSelPrtF)getSelectionCP(); - selectionCP.setPrinterFile(printerFileFilter); - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/PrinterImpl.java b/cvsroot/src/com/ibm/as400/access/PrinterImpl.java deleted file mode 100644 index 1b37eee34..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrinterImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2008-2008 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - * The PrinterImpl interface defines a set of methods - * needed for a full implementation of the Printer class. - **/ - -interface PrinterImpl extends PrintObjectImpl -{ - public abstract void setAttributes(PrintParameterList attributes) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException; -} diff --git a/cvsroot/src/com/ibm/as400/access/PrinterImplProxy.java b/cvsroot/src/com/ibm/as400/access/PrinterImplProxy.java deleted file mode 100644 index 849aa4117..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrinterImplProxy.java +++ /dev/null @@ -1,52 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.io.IOException; - -/** - * The PrinterImplProxy class implements proxy versions of - * the public methods defined in the PrinterImpl class. - * Unless commented otherwise, the implementations of the methods below - * are merely proxy calls to the corresponding method in the remote - * implementation class (PrinterImplRemote). - **/ - -class PrinterImplProxy extends PrintObjectImplProxy -implements ProxyImpl, PrinterImpl -{ - PrinterImplProxy() - { - super("Printer"); - } - - public void setAttributes(PrintParameterList attributes) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - try { - connection_.callMethod (pxId_, "setAttributes", - new Class[] { PrintParameterList.class }, - new Object[] { attributes }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/PrinterImplRemote.java b/cvsroot/src/com/ibm/as400/access/PrinterImplRemote.java deleted file mode 100644 index 86dfbc96a..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrinterImplRemote.java +++ /dev/null @@ -1,357 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - * The Printer class represents a server printer. - * An instance of this class can be used to manipulate an individual - * printer. - * - * See Printer Attributes for - * valid attributes. - * - **/ - -class PrinterImplRemote extends PrintObjectImplRemote -implements PrinterImpl -{ - - private static final NPCPAttributeIDList attrsToRetrieve_ = new NPCPAttributeIDList(); - private static boolean fAttrIDsToRtvBuilt_ = false; - private static final String NAME = "name"; - - // Impl object for remote command server requests. - private RemoteCommandImpl remoteCommand_; - - - private synchronized void buildAttrIDsToRtv() - { - if (!fAttrIDsToRtvBuilt_) - { - attrsToRetrieve_.addAttrID(PrintObject.ATTR_AFP); // advanced function printing - attrsToRetrieve_.addAttrID(PrintObject.ATTR_ALIGNFORMS); // align forms - attrsToRetrieve_.addAttrID(PrintObject.ATTR_ALWDRTPRT); // allow direct printing - attrsToRetrieve_.addAttrID(PrintObject.ATTR_AUTOEND); // automatically end writer? - attrsToRetrieve_.addAttrID(PrintObject.ATTR_BTWNCPYSTS); // between copies status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_BTWNFILESTS); // between files status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CHAR_ID); // set of graphic characters - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CHANGES); // changes take effect - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CODEPAGE); // code page - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DESCRIPTION); // text description - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DEVCLASS); // device class - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DEVMODEL); // device model - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DEVSTATUS); // device status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DEVTYPE); // device type - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DRWRSEP); // drawer for separators - attrsToRetrieve_.addAttrID(PrintObject.ATTR_ENDPNDSTS); // end pending status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FILESEP); // number of file separators - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FONTID); // Font identifier to use - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FORMDEFLIB); // Form definition library name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FORMDEF); // Form definition name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FORMFEED); // type of paperfeed to be use - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FORMTYPE); // name of the form to be used - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FORMTYPEMSG); // form type message option - attrsToRetrieve_.addAttrID(PrintObject.ATTR_HELDSTS); // held status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_HOLDPNDSTS); // hold pending status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_IMGCFG); // Image configuration - attrsToRetrieve_.addAttrID(PrintObject.ATTR_JOBUSER); // name of the user that created file - attrsToRetrieve_.addAttrID(PrintObject.ATTR_MFGTYPE); // manufacturer's type & model - attrsToRetrieve_.addAttrID(PrintObject.ATTR_MSGQUELIB); // message queue library name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_MSGQUE); // message queue name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_ONJOBQSTS); // on job queue status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OUTQUELIB); // output queue library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OUTQUE); // output queue - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OUTQSTS); // output queue status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OVERALLSTS); // printer overall status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_POINTSIZE); // the default font's point size - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PRINTER); // printer - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PRTDEVTYPE); // printer dev type - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PUBINF); // Published Printer? - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PUBINF_COLOR_SUP);// Color supported indicator - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PUBINF_DS); // Data Stream supported - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PUBINF_PPM_COLOR);// Pages per minute (color printing) - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PUBINF_PPM); // Papers per minute (monochrome printing) - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PUBINF_DUPLEX_SUP);// Duplex supported indicator - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PUBINF_LOCATION);// Published location description - attrsToRetrieve_.addAttrID(PrintObject.ATTR_RMTLOCNAME); // remote loc of the printer device - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SPOOLFILE); // spool file name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SPLFNUM); // spool file number - attrsToRetrieve_.addAttrID(PrintObject.ATTR_STARTEDBY); // started by - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SYS_DRV_PGM); // System driver program - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USERDATA); // user data - //attrsToRetrieve_.addAttrID(PrintObject.ATTR_USERDRV); // User driver program name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USER_DRIVER_PROG); // User driver program name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFOBJ); // User defined object - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFOBJLIB);// User defined object library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFOBJTYP);// User defined object type - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFOPT); // user defined options - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDRVLIB); // User driver program library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRTFM); // User transform program name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRTFMLIB); // User transform program library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SCS2ASCII); // transform SCS to ASCII - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WRTNGSTS); // writing status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WTNGDATASTS); // waiting for data status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WTNGDEVSTS); // waiting for device status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WTNGMSGSTS); // waiting for message status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WTRJOBNAME); // writer job name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WTRJOBNUM); // writer job number - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WTRJOBSTS); // writer job status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WTRJOBUSER); // writer job user name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WTRAUTOEND); // when to automatically end writer - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WTRSTRTD); // writer started - fAttrIDsToRtvBuilt_ = true; - } - } - - - // Check the run time state - void checkRunTimeState() - { - // check whatever the base class needs to check - super.checkRunTimeState(); - - // Printer's need to additionally check the name. - if( getIDCodePoint() == null ) - { - Trace.log(Trace.ERROR, "Parameter 'name' has not been set."); - throw new ExtendedIllegalStateException( - NAME, ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - - - // This method implements an abstract method of the superclass - NPCPAttributeIDList getAttrIDsToRetrieve() - { - if (!fAttrIDsToRtvBuilt_) { - buildAttrIDsToRtv(); - } - return attrsToRetrieve_; - } - - - NPCPAttributeIDList getAttrIDsToRetrieve(int attrToRtv) - { - if (!fAttrIDsToRtvBuilt_) - { - attrsToRetrieve_.addAttrID(attrToRtv); - } - return attrsToRetrieve_; - } - - - /** - * Sets one or more attributes of the object. See - * Printer Attributes for - * a list of valid attributes that can be changed. - * - * @param attributes A print parameter list that contains the - * attributes to be changed. - * - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - **/ - public void setAttributes(PrintParameterList attributes) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - checkRunTimeState(); - - // See if any changeable attributes were specified. - String changes = attributes.getStringParameter(PrintObject.ATTR_CHANGES); - String formType = attributes.getStringParameter(PrintObject.ATTR_FORMTYPE); - Integer fileSep = attributes.getIntegerParameter(PrintObject.ATTR_FILESEP); - String outQ = attributes.getStringParameter(PrintObject.ATTR_OUTPUT_QUEUE); - Integer drawerSep = attributes.getIntegerParameter(PrintObject.ATTR_DRWRSEP); - String desc = attributes.getStringParameter(PrintObject.ATTR_DESCRIPTION); - - String printerName = getIDCodePoint().getStringValue(PrintObject.ATTR_PRINTER); - - if (desc != null) - { - // Call CHGDEVPRT to change the printer's Text Description attribute. Note that this command is not designated to be threadsafe. - - desc = prepareForSingleQuotes(desc); // double any embedded single-quotes - String cmdText = "CHGDEVPRT DEVD(" + printerName + ") TEXT('" + desc + "')"; - - // Setup for remote program call. - if (remoteCommand_ == null) { - setupRemoteCommand(); - } - boolean result = remoteCommand_.runCommand(cmdText); - if (!result) { - Trace.log(Trace.ERROR, "Error when changing printer attributes."); - throw new AS400Exception(remoteCommand_.getMessageList()); - } - } - - if (changes != null || - formType != null || - fileSep != null || - outQ != null || - drawerSep != null) - { - // Call CHGWTR change the specified printer attributes. Note that this command is not designated to be threadsafe. - - StringBuffer cmdBuf = new StringBuffer("CHGWTR WTR(" + printerName + ")"); - - if (changes != null) { // When to change writer. - cmdBuf.append(" OPTION(" + changes + ")"); - } - - if (formType != null) { // Form type options. - cmdBuf.append(" FORMTYPE(" + formType + ")"); - } - - if (fileSep != null) { // File separators. - int intVal = fileSep.intValue(); - String stringVal = null; - switch (intVal) - { - case -1: stringVal = "*FILE"; break; - default: stringVal = fileSep.toString(); - } - cmdBuf.append(" FILESEP(" + stringVal + ")"); - } - - if (outQ != null) { // Output queue. - // Note that this parameter comes to us as a fully qualified IFS pathname. - QSYSObjectPathName path = new QSYSObjectPathName(outQ); - cmdBuf.append(" OUTQ(" + path.getLibraryName() + "/" + path.getObjectName() + ")"); - } - - if (drawerSep != null) { // Drawer for separators. - int intVal = drawerSep.intValue(); - String stringVal = null; - switch (intVal) - { - case -1: stringVal = "*FILE"; break; - case -2: stringVal = "*DEVD"; break; - default: stringVal = drawerSep.toString(); - } - cmdBuf.append(" SEPDRAWER(" + stringVal + ")"); - } - - // Setup for remote program call. - if (remoteCommand_ == null) { - setupRemoteCommand(); - } - boolean result = remoteCommand_.runCommand(cmdBuf.toString()); - if (!result) { - Trace.log(Trace.ERROR, "Error when changing printer attributes."); - throw new AS400Exception(remoteCommand_.getMessageList()); - } - - } - - NPCPAttribute cpNewAttrs = attributes.getAttrCodePoint(); - - // we changed the printer file attributes on the server, - // merge those changed attributes into our current attributes - // here. - if (attrs == null) { - attrs = new NPCPAttribute(); - } - - attrs.addUpdateAttributes(cpNewAttrs); - } - - // Setup remote command object on first touch. Synchronized to protect instance variables. This method can safely be called multiple times because it checks for a previous call before changing the instance variables. - protected synchronized void setupRemoteCommand() throws IOException - { - // If not already setup. - if (remoteCommand_ == null) - { - AS400ImplRemote system = getSystem(); - if (system.canUseNativeOptimizations()) - { - try - { - remoteCommand_ = (RemoteCommandImpl)Class.forName("com.ibm.as400.access.RemoteCommandImplNative").newInstance(); - // Avoid direct reference - it can cause NoClassDefFoundError at class loading time on Sun JVM's. - } - catch (Throwable e) { - // A ClassNotFoundException would be unexpected, since canUseNativeOptions() returned true. - Trace.log(Trace.WARNING, "Unable to instantiate class RemoteCommandImplNative.", e); - } - } - if (remoteCommand_ == null) - { - remoteCommand_ = new RemoteCommandImplRemote(); - } - remoteCommand_.setSystem(system); - } - } - - - /** - Prepares the text to be enclosed in single-quotes; for example, for use in the TEXT parameter of CHGDEVPRT. - 1. Collapse all sequences of single-quotes to a single single-quote. - 2. Strip outer single-quotes (if present). - 3. Double-up any embedded single-quotes (that aren't already doubled). - **/ - private static final String prepareForSingleQuotes(String text) - { - if (text.indexOf('\'') == -1) return text; // text contains no single-quotes - - // 1. Collapse each sequence of multiple single-quotes to a single single-quote. - StringBuffer buf = new StringBuffer(text.trim()); - if (buf.indexOf("''") != -1) - { - boolean followedByQuote = false; - for (int i=buf.length()-1; i >= 0; i--) // examine char-by-char, from end - { - char thisChar = buf.charAt(i); - if (thisChar == '\'') - { - if (followedByQuote) - { - buf.deleteCharAt(i); // collapse sequence of quotes - continue; - } - else followedByQuote = true; - } - else followedByQuote = false; - } - } - - // 2. Strip outer single-quotes (if present). - if (buf.charAt(0) == '\'' && - buf.charAt(buf.length()-1) == '\'') - { - buf.deleteCharAt(buf.length()-1); - buf.deleteCharAt(0); - } - - // 3. Double-up all embedded single-quotes. - for (int i=buf.length()-1; i >= 0; i--) // examine char-by-char - { - char thisChar = buf.charAt(i); - if (thisChar == '\'') - { - buf.insert(i, '\''); // double the single-quote - } - } - return buf.toString(); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/PrinterList.java b/cvsroot/src/com/ibm/as400/access/PrinterList.java deleted file mode 100644 index 3abff78ce..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrinterList.java +++ /dev/null @@ -1,154 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; - -/** - * The PrinterList class is used to build a list of objects of type Printer. - * The list can be filtered by printer name. - * - *@see Printer - **/ - -public class PrinterList extends PrintObjectList -implements java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - private static final String PRINTER_FILTER = "printerFilter"; - - /** - * Constructs a PrinterList object. The system must be - * set later. This constructor is provided for visual application - * builders that support JavaBeans. It is not intended for use - * by application programmers. - * - * @see PrintObjectList#setSystem - **/ - public PrinterList() - { - super(NPConstants.PRINTER_DEVICE, new NPCPSelPrtD()); - - // Because of this constructor we will need to check the - // system before trying to use it. - } - - - - /** - * Constructs a PrinterList object. It uses the system name specified. - * - * @param system The system on which the printer devices exist. - * - **/ - public PrinterList(AS400 system) - { - super(NPConstants.PRINTER_DEVICE, new NPCPSelPrtD(), system); - } - - - - /** - * Chooses the appropriate implementation. - **/ - void chooseImpl() - { - AS400 system = getSystem(); - if (system == null) { - Trace.log( Trace.ERROR, "Attempt to use PrinterList before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - impl_ = (PrintObjectListImpl) system.loadImpl2("com.ibm.as400.access.PrinterListImplRemote", - "com.ibm.as400.access.PrinterListImplProxy"); - super.setImpl(); - } - - - - /** - * Returns the printer list filter. - **/ - public String getPrinterFilter() - { - // The selection code point is always present, it may - // however be empty. If empty, getPrinter() will return - // an empty string. - - NPCPSelPrtD selectionCP = (NPCPSelPrtD)getSelectionCP(); - return( selectionCP.getPrinter() ); - } - - - - PrintObject newNPObject(NPCPID cpid, NPCPAttribute cpattr) - { - return new Printer(system_, (NPCPIDPrinter)cpid, cpattr); - } - - - /** - * Sets printer list filter. - * @param printerFilter The name of the printers to list. - * It cannot be greater than 10 characters in length. - * It can be a specific name, a generic name, or the special - * value *ALL. The default for the printerFilter is *ALL. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setPrinterFilter(String printerFilter) - throws PropertyVetoException - { - if( printerFilter == null ) - { - Trace.log( Trace.ERROR, "Parameter 'printerFilter' is null" ); - throw new NullPointerException( PRINTER_FILTER ); - } - - // Allow a length of 0 to remove the filter from the - // selection code point. printerFilter.length() == 0 is OK. - - if( printerFilter.length() > 10 ) - { - Trace.log(Trace.ERROR, "Parameter 'printerFilter' is greater than 10 characters in length."); - throw new ExtendedIllegalArgumentException( - "printerFilter("+printerFilter+")", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - String oldPrinterFilter = getPrinterFilter(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( PRINTER_FILTER, oldPrinterFilter, printerFilter ); - - // No one vetoed, make the change. - NPCPSelPrtD selectionCP = (NPCPSelPrtD)getSelectionCP(); - selectionCP.setPrinter(printerFilter); - - // Propagate change to ImplRemote if necessary... - if (impl_ != null) - impl_.setFilter("printer", printerFilter); - - // Notify any property change listeners. - changes.firePropertyChange( PRINTER_FILTER, oldPrinterFilter, printerFilter ); - - } // end setPrinterFilter - -} // PrinterList class - diff --git a/cvsroot/src/com/ibm/as400/access/PrinterList16.gif b/cvsroot/src/com/ibm/as400/access/PrinterList16.gif deleted file mode 100644 index f2be9ec36..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/PrinterList16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/PrinterList32.gif b/cvsroot/src/com/ibm/as400/access/PrinterList32.gif deleted file mode 100644 index 30f70886a..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/PrinterList32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/PrinterListBeanInfo.java b/cvsroot/src/com/ibm/as400/access/PrinterListBeanInfo.java deleted file mode 100644 index 19629dfd3..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrinterListBeanInfo.java +++ /dev/null @@ -1,140 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; -import java.awt.Image; - -/** -BeanInfo for PrinterList class. -**/ -public class PrinterListBeanInfo extends PrintObjectListBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Additional properties defined for PrinterList - private static PropertyDescriptor[] prtDListProperties_; - - // Class this bean info represents. - private final static Class beanClass = PrinterList.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader rbl_; - - static - { - try - { - PropertyDescriptor prtDFilter = - new PropertyDescriptor("printerFilter", beanClass); - prtDFilter.setBound(true); - prtDFilter.setConstrained(true); - prtDFilter.setDisplayName(rbl_.getText("PROP_NAME_PRTD_NAME_FILTER")); - prtDFilter.setShortDescription(rbl_.getText("PROP_DESC_PRTD_NAME_FILTER")); - - PropertyDescriptor[] properties = {prtDFilter}; - prtDListProperties_ = properties; - } - - catch (IntrospectionException e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - // PrinterList does not define any additional events so we - // let the PrintObjectList provide: - // public int getDefaultEventIndex() - // public EventSetDescriptor[] getEventSetDescriptors() - - // We want "system" as the default property. PrintObjectList - // sets this so we don't have to override: - // public int getDefaultPropertyIndex() - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - // Per the JavaBean spec, properties are discrete, named attributes - // of a Java Bean that can affect its appearance or its behavior. - - PropertyDescriptor[] printObjectListProperties; - PropertyDescriptor[] combinedProperties; - int combinedSize; - - // Get the properties defined in PrintObjectListBeanInfo - printObjectListProperties = super.getPropertyDescriptors(); - - combinedSize = printObjectListProperties.length + prtDListProperties_.length; - combinedProperties = new PropertyDescriptor[combinedSize]; - - // copy PrintObjectList properties - System.arraycopy( printObjectListProperties, // source - 0, // --offset - combinedProperties, // destination - 0, // --offset - printObjectListProperties.length ); // length - - // copy PrinterList properties - System.arraycopy( prtDListProperties_, // source - 0, // --offset - combinedProperties, // destination - printObjectListProperties.length, // --offset - prtDListProperties_.length ); // length - - return combinedProperties; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("PrinterList16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("PrinterList32.gif"); - break; - } - - return image; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/PrinterListImplProxy.java b/cvsroot/src/com/ibm/as400/access/PrinterListImplProxy.java deleted file mode 100644 index b889b6290..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrinterListImplProxy.java +++ /dev/null @@ -1,28 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterListImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; - -class PrinterListImplProxy extends PrintObjectListImplProxy -implements ProxyImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - PrinterListImplProxy() - { - super("PrinterList"); - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/PrinterListImplRemote.java b/cvsroot/src/com/ibm/as400/access/PrinterListImplRemote.java deleted file mode 100644 index ad9889fd1..000000000 --- a/cvsroot/src/com/ibm/as400/access/PrinterListImplRemote.java +++ /dev/null @@ -1,142 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterListImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The PrinterList class is used to build a list of IBM i printer objects of type Printer. - * The list can be filtered by printer name. - * - *@see Printer - **/ - -class PrinterListImplRemote extends PrintObjectListImplRemote -{ - // static private binary data for default attribute to - // retrieve on a printer when listing printer devices - // format is: - // --------------------------------------------------- - // |nn | LEN | ID1 | ID2 | ID3 | ID4 | ....... | IDnn| - // --------------------------------------------------- - // nn - two byte total # of attributes in code point - // LEN - two byte length of each attribute entry, right - // now this will be 2 (0x02). - // IDx - two byte attribute ID - - private static final byte[] attrIDToList_ = - { - 0x00, 0x1A, // big endian(BE), number of attrs - 0x00, 0x02, // BE - size in bytes of each ID - 0x00, 0x0A, // ATTR_AFP - 0x00, 0x19, // ATTR_CODEPAGE - 0x00, 0x26, // ATTR_DEVCLASS - 0x00, 0x07, // ATTR_DEVMODEL - 0x00, 0x08, // ATTR_DEVTYPE - 0x00, 0x2A, // ATTR_DRWRSEP - 0x00, 0x2E, // ATTR_FONTID - 0x00, (byte)0xB7, // ATTR_FORMDEFLIB - 0x00, (byte)0xB6, // ATTR_FORMDEF - 0x00, 0x2F, // ATTR_FORMFEED - 0x00, 0x37, // ATTR_CHAR_ID - 0x00, 0x41, // ATTR_MFGTYPE - 0x00, 0x44, // ATTR_MSGQUELIB - 0x00, 0x5E, // ATTR_MSGQUE - 0x00, 0x53, // ATTR_POINTSIZE - 0x00, 0x59, // ATTR_PRINTER - 0x00, 0x6D, // ATTR_DESCRIPTION - 0x00, (byte)0xA3, // ATTR_USRDEFOPT - 0x00, (byte)0xA5, // ATTR_USRDEFOBJ - 0x00, (byte)0xA4, // ATTR_USRDEFOBJLIB - 0x00, (byte)0xA6, // ATTR_USRDEFOBJTYP - 0x00, (byte)0xA7, // ATTR_USRTFMLIB - 0x00, (byte)0xA8, // ATTR_USRTFM - 0x00, (byte)0xAA, // ATTR_USRDRVLIB - 0x00, (byte)0xAB, // ATTR_USERDRV - 0x00, 0x71, // ATTR_SCS2ASCII - }; - - private static final NPCPAttributeIDList defaultAttrIDsToList_ = new NPCPAttributeIDList(attrIDToList_); - - // register the printer file return datastream for listing printers - static - { - NPDataStream ds; - NPCodePoint cp; - - ds = new NPDataStream(NPConstants.PRINTER_DEVICE); - cp = new NPCPIDPrinter(); - ds.addCodePoint(cp); - cp = new NPCPAttribute(); - ds.addCodePoint(cp); - AS400Server.addReplyStream(ds, "as-netprt"); - } - - - - /** - * Returns the default attributes to list. - * - * @return The default attribute ID list. - **/ - NPCPAttributeIDList getDefaultAttrsToList() - { - return defaultAttrIDsToList_; - } - - - - /** - * Creates a new Printer object. - * - * @param system The server on which the printer devices exist. - * @param reply The datastream with which to reply. - * - * @return The newly created Printer object. - **/ - /* - PrintObject newNPObject(AS400 system, NPDataStream reply) - { - Printer npObj = null; - NPCPIDPrinter cpid; - NPCPAttribute cpAttrs; - cpid = (NPCPIDPrinter)reply.getCodePoint(NPCodePoint.PRINTER_DEVICE_ID); // never should return null - cpAttrs = (NPCPAttribute)reply.getCodePoint(NPCodePoint.ATTRIBUTE_VALUE); // may return null - npObj = new Printer(system, cpid, cpAttrs); - return npObj; - } - */ - - - - NPCPID newNPCPID(NPDataStream reply) - { - return (NPCPIDPrinter)reply.getCodePoint(NPCodePoint.PRINTER_DEVICE_ID); // never should return null - } - - - - /** - * Sets printer list filter. - * @param printerFilter The name of the printers to list. - * It cannot be greater than 10 characters in length. - * It can be a specific name, a generic name, or the special - * value *ALL. The default for the printerFilter is *ALL. - **/ - public void setPrinterFilter(String printerFilter) - { - NPCPSelPrtD selectionCP = (NPCPSelPrtD)getSelectionCP(); - selectionCP.setPrinter(printerFilter); - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/Product.java b/cvsroot/src/com/ibm/as400/access/Product.java deleted file mode 100644 index 8529155a5..000000000 --- a/cvsroot/src/com/ibm/as400/access/Product.java +++ /dev/null @@ -1,1819 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Product.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.util.Calendar; -import java.util.Date; - - -/** - * Represents a licensed product on the system. - * The {@link #isInstalled isInstalled()} method should be called to verify that - * the product is installed on the system. If the product is not installed, other information - * returned by getters in this class might not be valid. -**/ -public class Product -{ - private static final String USERSPACE_NAME = "JT4PTF QTEMP "; - private static final String USERSPACE_PATH = "/QSYS.LIB/QTEMP.LIB/JT4PTF.USRSPC"; - - private boolean loaded_ = false; // Have we loaded the common (PRDR0100 format) values - private boolean loadedLoadID_ = false; // Have we loaded the load ID yet - private boolean partiallyLoaded_ = false; // Were we constructed from a ProductList - private boolean loadedOptions_ = false; // Have we loaded our option information - private boolean loadedDescriptionText_ = false; // Have we loaded the description yet - private boolean loaded500_ = false; // Have we loaded the PRDR0500 format values - private boolean loaded800_ = false; // Have we loaded the PRDR0500 format values - private boolean error100_ = false; // Did we get an error retrieving the PRDR0100 format values - private boolean error500_ = false; // Did we get an error retrieving the PRDR0500 format values - private boolean error800_ = false; // Did we get an error retrieving the PRDR0800 format values - - private AS400 system_; // never null - private String productID_; // never null - private String productOption_; // never null - private String releaseLevel_; // never null - private String descriptionID_; - private String descriptionText_; - private String messageFile_; - private boolean installed_ = true; // Default to true; if the API throws an exception, switch to false. - private String loadID_; - - // PRDR0100 format (fields that are meaningfully returned in all formats) - // Note: The loaded_ flag indicates that the following fields have been loaded. - // The loadID_ field gets its own separate flag: loadedLoadID_ - private String loadType_; - private String symbolicLoadState_; - private boolean loadErrorIndicator_; - private String loadState_; - private boolean supported_; - private String registrationType_; - private String registrationValue_; - private String primaryLanguageLoadID_; - private String minimumTargetRelease_; - private String minimumBaseVRM_; - private int requirementsMet_; - private String level_; - - // PRDR0500 format - private boolean allowsMultipleReleases_; - private Date releaseDate_; - private String firstCopyright_; - private String currentCopyright_; - // messageFile_; - // product options and their properties - private boolean allowsDynamicNaming_; - private String minimumVRM_; - - private boolean allowsMixedReleases_; - - // PRDR0800 format - private ProductDirectoryInformation[] directories_; - private Product[] options_; - private int chunkSize_ = 8192; - - - - /** - * Constant indicating that the product load is defined but - * the product load object for this load does not exist. When - * a product definition is created, a code load is defined for - * each product option, and language loads can be defined. - **/ - public static final String LOAD_STATE_DEFINED_NO_OBJECT = "10"; - - /** - * Constant indicating that the product load object exists, but - * before it can be saved using the Save Licensed Program (SAVLICPGM) - * command, it must be packaged with either the Package Product - * Option (PKGPRDOPT) command or the Package Product Option - * (QSZPKGPO) API. - **/ - public static final String LOAD_STATE_DEFINED_OBJECT_EXISTS = "20"; - - /** - * Constant indicating that a Restore Licensed Program (RSTLICPGM) - * command did not complete successfully. A preoperation exit program - * failed. The product being replaced had been packaged, but not installed. - **/ - public static final String LOAD_STATE_PACKAGED_RESTORE_FAILED_EXIT_PROGRAM_FAILED = "3E"; - - /** - * Constant indicating that a Restore Licensed Program (RSTLICPGM) - * command failed. A preoperation exit program did not fail. The product - * being replaced had been packaged, but not installed. - **/ - public static final String LOAD_STATE_PACKAGED_RESTORE_FAILED = "3F"; - - /** - * Constant indicating that the product load object for this load has - * been packaged with the Package Product Option (PKGPRDOPT) command - * or the Package Product Option (QSZPKGPO) API. - **/ - public static final String LOAD_STATE_PACKAGED = "30"; - - /** - * Constant indicating that the product load object for this load has - * been packaged with the Package Product Option (PKGPRDOPT) command - * or the Package Product Option (QSZPKGPO) API, but either a - * development library or folder was renamed when the product does - * not allow dynamic naming, or the product definition or product load - * for a packaged load was renamed or moved to another library. - **/ - public static final String LOAD_STATE_PACKAGED_RENAMED = "32"; - - /** - * Constant indicating that the product load object for this load has - * been packaged with the Package Product Option (PKGPRDOPT) command - * or the Package Product Option (QSZPKGPO) API, but an object was - * found to be damaged the last time that the Check Product Option - * (CHKPRDOPT) command or Save Licensed Program (SAVLICPGM) command - * was used for this load. - **/ - public static final String LOAD_STATE_PACKAGED_DAMAGED = "33"; - - /** - * Constant indicating that the product load object for this load has - * been packaged with the Package Product Option (PKGPRDOPT) command - * or the Package Product Option (QSZPKGPO) API, but either an attempt - * was made to delete the product load using the Delete Licensed Program - * (DLTLICPGM) command and the attempt failed, or a - * packaged object was missing the last time the Check Product Option - * (CHKPRDOPT) command or Save Licensed Program (SAVLICPGM) command was - * used for this load. - **/ - public static final String LOAD_STATE_PACKAGED_DELETED = "34"; - - /** - * Constant indicating that a Restore Licensed Program (RSTLICPGM) command - * is in progress. The product being replaced had been packaged, but - * not installed. - **/ - public static final String LOAD_STATE_PACKAGED_RESTORE_IN_PROGRESS = "35"; - - /** - * Constant indicating that a Delete Licensed Program (DLTLICPGM) command - * is in progress. The product being deleted had been packaged, but - * not installed. - **/ - public static final String LOAD_STATE_PACKAGED_DELETE_IN_PROGRESS = "38"; - - /** - * Constant indicating that a Restore Licensed Program (RSTLICPGM) command - * is in progress. The product being replaced had been installed. - **/ - public static final String LOAD_STATE_INSTALLED_RESTORE_IN_PROGRESS = "50"; - - /** - * Constant indicating that a Delete Licensed Program (DLTLICPGM) command - * is in progress. The product being deleted had been installed. - **/ - public static final String LOAD_STATE_INSTALLED_DELETE_IN_PROGRESS = "53"; - - /** - * Constant indicating that this product is an IBM-supplied product and - * it is not compatible with the currently installed release level of the System i operating system. - * An error occurred when the product was restored or when the operating system was installed. - * The IBM-supplied product is at a release level earlier than V2R2M0, which - * is not supported by the Save Licensed Program (SAVLICPGM) command. - **/ - public static final String LOAD_STATE_IBM_SUPPLIED_NOT_COMPATIBLE = "59"; - - /** - * Constant indicating that a Restore Licensed Program (RSTLICPGM) command - * did not complete successfully. A preoperation exit program failed. The - * product being replaced had been installed. - **/ - public static final String LOAD_STATE_INSTALLED_RESTORE_FAILED_EXIT_PROGRAM_FAILED = "6E"; - - /** - * Constant indicating that a Restore Licensed Program (RSTLICPGM) command - * failed. The failure was not a preoperation exit program or postoperation - * exit program. The product being replaced had been installed. - **/ - public static final String LOAD_STATE_INSTALLED_RESTORE_FAILED = "6F"; - - /** - * Constant indicating that the product load object for this load was loaded - * on to the system by the Restore Licensed Program (RSTLICPGM) command. - **/ - public static final String LOAD_STATE_RESTORED = "60"; - - /** - * Constant indicating that the product load object for this load was loaded - * on to the system by the Restore Licensed Program (RSTLICPGM) command but - * a postoperation exit program failed. - **/ - public static final String LOAD_STATE_RESTORED_EXIT_PROGRAM_FAILED = "61"; - - /** - * Constant indicating that an installed library or folder was renamed, but - * the product does not allow dynamic naming. - **/ - public static final String LOAD_STATE_RESTORED_RENAMED = "62"; - - /** - * Constant indicating that the product load object for this load was installed - * by the Restore Licensed Program (RSTLICPGM) command, but an object is - * damaged. - **/ - public static final String LOAD_STATE_RESTORED_DAMAGED = "63"; - - /** - * Constant indicating that the product load object for this load was installed - * by the Restore Licensed Program (RSTLICPGM) command, but either an object - * was found to be missing when the Check Product Option (CHKPRDOPT) command - * or the Save Licensed Program (SAVLICPGM) command was used, or an error - * occurred while the Delete Licensed Program (DLTLICPGM) command was being - * used. - **/ - public static final String LOAD_STATE_RESTORED_DELETED = "64"; - - /** - * Constant indicating that the Check Product Option (CHKPRDOPT) command was - * used for this product load, but the postoperation exit program failed or - * indicated that an error was found. - **/ - public static final String LOAD_STATE_CHECK_ERROR = "67"; - - /** - * Constant indicating that the product load was installed successfully. If an - * object was missing or was damaged, but the problem was corrected, using - * the Check Product Option (CHKPRDOPT) command sets the state back to this. - **/ - public static final String LOAD_STATE_INSTALLED = "90"; - - - - /** - * Constant indicating a product load type of *CODE. - **/ - public static final String LOAD_TYPE_CODE = "*CODE"; - - /** - * Constant indicating a product load type of *LNG. - **/ - public static final String LOAD_TYPE_LANGUAGE = "*LNG"; - - - - /** - * Constant indicating a product option of *BASE. - **/ - public static final String PRODUCT_OPTION_BASE = "*BASE"; - - /** - * Constant indicating a feature ID of *CODE. - **/ - public static final String PRODUCT_FEATURE_CODE = "*CODE"; - - /** - * Constant indicating a product ID of *OPSYS. - **/ - public static final String PRODUCT_ID_OPERATING_SYSTEM = "*OPSYS"; - - /** - * Constant indicating a release level of *CUR. - **/ - public static final String PRODUCT_RELEASE_CURRENT = "*CUR"; - - /** - * Constant indicating a release level of *ONLY. - **/ - public static final String PRODUCT_RELEASE_ONLY = "*ONLY"; - - /** - * Constant indicating a release level of *PRV. - **/ - public static final String PRODUCT_RELEASE_PREVIOUS = "*PRV"; - - /** - * Constant indicating that the release level of the product - * should be determined at runtime by the system. - **/ - public static final String PRODUCT_RELEASE_ANY = "ANY"; - - - - /** - * Constant indicating that the registration type *PHONE was - * specified when the product load or product definition was - * created. - **/ - public static final String REGISTRATION_TYPE_PHONE = "02"; - - /** - * Constant indicating that the registration type is the - * same as the registration type for the operating system. - **/ - public static final String REGISTRATION_TYPE_SYSTEM = "04"; - - /** - * Constant indicating that the registration type *CUSTOMER was - * specified when the product load or product definition was - * created. - **/ - public static final String REGISTRATION_TYPE_CUSTOMER = "08"; - - - - /** - * Constant indicating that there is not enough information - * available to determine if the release requirements have - * been met. This will be the value if the load type is - * LOAD_TYPE_LANGUAGE. - **/ - public static final int REQUIREMENTS_UNKNOWN = 0; - - /** - * Constant indicating that the releases of the *BASE and option - * meet all requirements. - **/ - public static final int REQUIREMENTS_MET = 1; - - /** - * Constant indicating that the release of the option is too - * old compared to the *BASE. - **/ - public static final int REQUIREMENTS_OPTION_TOO_OLD = 2; - - /** - * Constant indicating that the release of the *BASE is too - * old compared to the option. - **/ - public static final int REQUIREMENTS_BASE_TOO_OLD = 3; - - - - /** - * Constant indicating that the load is defined but the product load - * object for this load does not exist. - **/ - public static final String SYMBOLIC_LOAD_STATE_DEFINED = "*DEFINED"; - - /** - * Constant indicating that the product load object for this load - * exists. It must be packaged with the Package Product Option (PKGPRDOPT) - * command before it can be saved using the Save Licensed Program (SAVLICPGM) command. - **/ - public static final String SYMBOLIC_LOAD_STATE_CREATED = "*CREATED"; - - /** - * Constant indicating that the product load object for this load has - * been packaged with the Package Product Option (PKGPRDOPT) command. - **/ - public static final String SYMBOLIC_LOAD_STATE_PACKAGED = "*PACKAGED"; - - /** - * Constant indicating that either the product load object has been damaged - * (if this option is something other than the base option or the load type - * is a language load), or the product definition for this product ID and - * release level has been damaged or the product load object has been damaged - * (if this option is for the base option and code load type). - **/ - public static final String SYMBOLIC_LOAD_STATE_DAMAGED = "*DAMAGED"; - - /** - * Constant indicating that either a Restore Licensed Program (RSTLICPGM) - * function is in progress, a Delete Licensed Program (DLTLICPGM) function - * is in progress, or the product was created previous to V2R2M0 and there - * was an error during the process of converting product information. - **/ - public static final String SYMBOLIC_LOAD_STATE_LOADED = "*LOADED"; - - /** - * Constant indicating that the product load object for this load was loaded - * on to the system by the Restore Licensed Program (RSTLICPGM) command. - **/ - public static final String SYMBOLIC_LOAD_STATE_INSTALLED = "*INSTALLED"; - - - - /** - * Constructs a Product object. The following default values are used: - *
      - *
    • productOption - PRODUCT_OPTION_BASE - *
    • releaseLevel - PRODUCT_RELEASE_ANY - *
    • featureID - PRODUCT_FEATURE_CODE - *
    - * @param system The system. - * @param productID The product identifier. - **/ - public Product(AS400 system, String productID) - { - this(system, productID, PRODUCT_OPTION_BASE, PRODUCT_RELEASE_ANY, PRODUCT_FEATURE_CODE); - } - - - - /** - * Constructs a Product object. The following default values are used: - *
      - *
    • releaseLevel - PRODUCT_RELEASE_ANY - *
    • featureID - PRODUCT_FEATURE_CODE - *
    - * @param system The system. - * @param productID The product identifier. - * @param productOption The product option. - **/ - public Product(AS400 system, String productID, String productOption) - { - this(system, productID, productOption, PRODUCT_RELEASE_ANY, PRODUCT_FEATURE_CODE); - } - - - /** - * Constructs a Product object. - * @param system The system. - * @param productID The product identifier. - * @param productOption The product option. - * @param releaseLevel The release level of the product. - * @param featureID The product feature identifier. - **/ - public Product(AS400 system, String productID, String productOption, String releaseLevel, String featureID) - { - if (system == null) throw new NullPointerException("system"); - if (productID == null) throw new NullPointerException("productID"); - if (productOption == null) throw new NullPointerException("productOption"); - if (releaseLevel == null) throw new NullPointerException("releaseLevel"); - if (featureID == null) throw new NullPointerException("featureID"); - - String id = productID.toUpperCase().trim(); - if (id.length() != 7 && !id.equals(PRODUCT_ID_OPERATING_SYSTEM)) - { - throw new ExtendedIllegalArgumentException("productID", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - String option = productOption.toUpperCase().trim(); - if (option.equals(PRODUCT_OPTION_BASE)) - { - option = "0000"; - } - if (option.length() > 4) - { - throw new ExtendedIllegalArgumentException("productOption", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - while (option.length() < 4) - { - option = "0"+option; - } - - String level = releaseLevel.toUpperCase().trim(); - if (level.length() != 6 && level.length() != 0 && !level.equals(PRODUCT_RELEASE_CURRENT) && - !level.equals(PRODUCT_RELEASE_ONLY) && !level.equals(PRODUCT_RELEASE_PREVIOUS) && - !level.equals(PRODUCT_RELEASE_ANY)) - { - throw new ExtendedIllegalArgumentException("releaseLevel", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - String load = featureID.toUpperCase().trim(); - if (load.length() != 4 && !load.equals(PRODUCT_FEATURE_CODE)) - { - throw new ExtendedIllegalArgumentException("featureID", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - system_ = system; - productID_ = id; - productOption_ = option; - releaseLevel_ = level; - loadID_ = load; - } - - - /** - * Constructs a Product object. Sets featureID to PRODUCT_FEATURE_CODE. - * @param system The system. - * @param productID The product identifier. - * @param productOption The product option. - * @param releaseLevel The release level of the product. - * @param loadType The type of product load. - * @param languageID The language feature ID for the product. - **/ - public Product(AS400 system, String productID, String productOption, String releaseLevel, String loadType, String languageID) - { - this(system, productID, productOption, releaseLevel, PRODUCT_FEATURE_CODE); - - if (loadType == null) throw new NullPointerException("loadType"); - if (languageID == null) throw new NullPointerException("languageID"); - - loadType_ = loadType; - primaryLanguageLoadID_ = languageID; - } - - - /** - * This constructor is used by the 0500 format. - **/ - Product(AS400 system, String id, String option, String level, String feature, boolean allow, String msgID, String minVRM) - { - this(system, id, option, level, feature); - allowsDynamicNaming_ = allow; - descriptionID_ = msgID; - minimumVRM_ = minVRM; - loadedOptions_ = true; - } - - - /** - * This constructor is used by ProductList. - **/ - Product(AS400 system, String id, String option, String level, - String descriptionID, String descriptionText, - String messageFile, boolean installed, - boolean supported, String regType, String regValue) - { - system_ = system; - productID_ = id; - if (option.equals(PRODUCT_OPTION_BASE)) - { - option = "0000"; - } - else if (option.length() > 4) - { - option = option.substring(1, 5); // Chop off the first 0. - } - productOption_ = option; - releaseLevel_ = level; - descriptionID_ = descriptionID; - descriptionText_ = descriptionText; - messageFile_ = messageFile; - installed_ = installed; - supported_ = supported; - registrationType_ = regType; - registrationValue_ = regValue; - partiallyLoaded_ = true; - } - - - /** - * Indicates if the names of product libraries and root folders - * for this product option can be dynamically changed without - * causing a product error. - * @return true if the product can by dynamically named, false if it cannot. - **/ - public boolean allowsDynamicNaming() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loadedOptions_) fillInOptionInformation(); - return allowsDynamicNaming_; - } - - - /** - * Indicates if this product allows mixed releases between its *BASE - * and options. - * @return true if the *BASE option and other options of this product - * can be at different release levels, false if they must all be at - * the same release level. - **/ - public boolean allowsMixedReleases() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded500_) refresh(500); - return allowsMixedReleases_; - } - - - /** - * Indicates if this product can be installed at a release level different - * from the current release level without installing over a current release. - * @return true if the product can be installed at a different release level, - * false if it cannot be installed at a different release level without - * installing over the current release. - **/ - public boolean allowsMultipleReleases() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded500_) refresh(500); - return allowsMultipleReleases_; - } - - - /** - * Helper method. - **/ - private void fillInOptionInformation() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - Product[] products = getProductOptions(); - for (int i=0; i - *
  • {@link #LOAD_STATE_DEFINED_NO_OBJECT LOAD_STATE_DEFINED_NO_OBJECT} - *
  • {@link #LOAD_STATE_DEFINED_OBJECT_EXISTS LOAD_STATE_DEFINED_OBJECT_EXISTS} - *
  • {@link #LOAD_STATE_PACKAGED_RESTORE_FAILED_EXIT_PROGRAM_FAILED LOAD_STATE_PACKAGED_RESTORE_FAILED_EXIT_PROGRAM_FAILED} - *
  • {@link #LOAD_STATE_PACKAGED_RESTORE_FAILED LOAD_STATE_PACKAGED_RESTORE_FAILED} - *
  • {@link #LOAD_STATE_PACKAGED LOAD_STATE_PACKAGED} - *
  • {@link #LOAD_STATE_PACKAGED_RENAMED LOAD_STATE_PACKAGED_RENAMED} - *
  • {@link #LOAD_STATE_PACKAGED_DAMAGED LOAD_STATE_PACKAGED_DAMAGED} - *
  • {@link #LOAD_STATE_PACKAGED_DELETED LOAD_STATE_PACKAGED_DELETED} - *
  • {@link #LOAD_STATE_PACKAGED_RESTORE_IN_PROGRESS LOAD_STATE_PACKAGED_RESTORE_IN_PROGRESS} - *
  • {@link #LOAD_STATE_PACKAGED_DELETE_IN_PROGRESS LOAD_STATE_PACKAGED_DELETE_IN_PROGRESS} - *
  • {@link #LOAD_STATE_INSTALLED_RESTORE_IN_PROGRESS LOAD_STATE_INSTALLED_RESTORE_IN_PROGRESS} - *
  • {@link #LOAD_STATE_INSTALLED_DELETE_IN_PROGRESS LOAD_STATE_INSTALLED_DELETE_IN_PROGRESS} - *
  • {@link #LOAD_STATE_IBM_SUPPLIED_NOT_COMPATIBLE LOAD_STATE_IBM_SUPPLIED_NOT_COMPATIBLE} - *
  • {@link #LOAD_STATE_INSTALLED_RESTORE_FAILED_EXIT_PROGRAM_FAILED LOAD_STATE_INSTALLED_RESTORE_FAILED_EXIT_PROGRAM_FAILED} - *
  • {@link #LOAD_STATE_INSTALLED_RESTORE_FAILED LOAD_STATE_INSTALLED_RESTORE_FAILED} - *
  • {@link #LOAD_STATE_RESTORED LOAD_STATE_RESTORED} - *
  • {@link #LOAD_STATE_RESTORED_EXIT_PROGRAM_FAILED LOAD_STATE_RESTORED_EXIT_PROGRAM_FAILED} - *
  • {@link #LOAD_STATE_RESTORED_RENAMED LOAD_STATE_RESTORED_RENAMED} - *
  • {@link #LOAD_STATE_RESTORED_DAMAGED LOAD_STATE_RESTORED_DAMAGED} - *
  • {@link #LOAD_STATE_RESTORED_DELETED LOAD_STATE_RESTORED_DELETED} - *
  • {@link #LOAD_STATE_CHECK_ERROR LOAD_STATE_CHECK_ERROR} - *
  • {@link #LOAD_STATE_INSTALLED LOAD_STATE_INSTALLED} - * - * @return The load state. - * @see #getSymbolicLoadState - **/ - public String getLoadState() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_) refresh(100); - return loadState_; - } - - - /** - * Returns the type of product load for which information was retrieved. - * Possible values are: - *
      - *
    • {@link #LOAD_TYPE_CODE LOAD_TYPE_CODE} - *
    • {@link #LOAD_TYPE_LANGUAGE LOAD_TYPE_LANGUAGE} - *
    - * @return The load type. - **/ - public String getLoadType() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_) refresh(100); - return loadType_; - } - - - /** - * Returns the minimum release level that is allowed for the option - * that will run with the current level of the *BASE option for the product. - * This method is only applicable if mixed releases are allowed. - * Possible values are a release level (e.g. "V5R1M0") or "*MATCH" - * which indicates the release of the option matches that of *BASE. - * @return The minimum required release level of this product option. - * @see #allowsMixedReleases - * @see #getMinimumRequiredReleaseForBase - **/ - public String getMinimumRequiredRelease() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loadedOptions_) fillInOptionInformation(); - return minimumVRM_; - } - - - /** - * Returns the minimum release level that is allowed for the *BASE option - * that will run with the current level of the option for the product. This - * method is only applicable if mixed releases are allowed and if the - * load type is *CODE. Possible values are a release level (e.g. "V5R1M0") - * or "*MATCH" which indicates the release of the option matches that - * of *BASE. - * @return The minimum required release level of the base product option. - * @see #allowsMixedReleases - * @see #getMinimumRequiredRelease - **/ - public String getMinimumRequiredReleaseForBase() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_) refresh(100); - return minimumBaseVRM_; - } - - - /** - * Returns the minimum operating system release to which the Save Licensed Program - * (SAVLICPGM) command will allow the product to be saved. - * @return The minimum target release (e.g. "V5R1M0"). - **/ - public String getMinimumTargetRelease() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_) refresh(100); - return minimumTargetRelease_; - } - - - /** - * Returns the primary language feature ID for this product. - *

    - * For code loads, this is the primary language of the product option; - * that is, it is the National Language Version (NLV) of the language - * that is installed in the libraries. It is "" if no language is - * installed in the libraries for the code load. - *

    - * For language loads (e.g. "2938"), it is "". - * @return The primary language feature ID, or "" if no language is - * installed or this product is a language load. - * @see #getLoadType - **/ - public String getPrimaryLanguageFeatureID() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_) refresh(100); - return primaryLanguageLoadID_; - } - - - /** - * Returns the product ID for this product. - * @return The product ID (e.g. "5722JC1"). - **/ - public String getProductID() - { - return productID_; - } - - - /** - * Returns the product option for this product. - * @return The product option (e.g. "*BASE" or "0012"). - **/ - public String getProductOption() - { - return productOption_; - } - - - /** - * Returns the list of product options for this product ID. - * @return The array of products. - **/ - public Product[] getProductOptions() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded500_) refresh(500); - return options_; - } - - - /** - * Returns the list of Program Temporary Fixes (PTFs) on - * the system for this product. - * @param includeSupersededPTFs Specify true to include any - * superseded PTFs in the list; false otherwise. - * @return The array of PTFs. If there are no PTFs for the - * product, this method returns an array of size 0. - **/ - public PTF[] getPTFs(boolean includeSupersededPTFs) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!isInstalled()) return new PTF[0]; - int ccsid = system_.getCcsid(); - ConvTable conv = ConvTable.getTable(ccsid, null); - - ProgramParameter[] parms = new ProgramParameter[4]; - try - { - parms[0] = new ProgramParameter(conv.stringToByteArray(USERSPACE_NAME)); - parms[0].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - byte[] prodInfo = new byte[50]; - AS400Text text4 = new AS400Text(4, ccsid, system_); - AS400Text text6 = new AS400Text(6, ccsid, system_); - AS400Text text7 = new AS400Text(7, ccsid, system_); - AS400Text text10 = new AS400Text(10, ccsid, system_); - text7.toBytes(productID_, prodInfo, 0); - text6.toBytes(getReleaseLevel(), prodInfo, 7); - text4.toBytes(productOption_, prodInfo, 13); - if (loadID_ == null) refresh(100); - text10.toBytes((loadID_.equals(PRODUCT_FEATURE_CODE) ? "*ALL" : loadID_), prodInfo, 17); - //text10.toBytes("*ALL", prodInfo, 17); - prodInfo[27] = includeSupersededPTFs ? (byte)0xF1 : (byte)0xF0; // '1' or '0' - parms[1] = new ProgramParameter(prodInfo); - parms[1].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - parms[2] = new ProgramParameter(conv.stringToByteArray("PTFL0100")); - parms[2].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - parms[3] = new ProgramParameter(new byte[4]); // error code - parms[3].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - } - catch (PropertyVetoException pve) { // will never happen - if (Trace.traceOn_) Trace.log(Trace.ERROR, pve); - } - - ServiceProgramCall pc = new ServiceProgramCall(system_, "/QSYS.LIB/QPZLSTFX.SRVPGM", "QpzListPTF", ServiceProgramCall.NO_RETURN_VALUE, parms); - // Note: The called API is not thread-safe. - - // Determine the needed scope of synchronization. - Object lockObject; - boolean willRunProgramsOnThread = pc.isStayOnThread(); - if (willRunProgramsOnThread) { - // The calls will run in the job of the JVM, so lock for entire JVM. - lockObject = USERSPACE_PATH; - } - else { - // The calls will run in the job of the Remote Command Host Server, so lock on the connection. - lockObject = system_; - } - - byte[] buf = null; - - synchronized(lockObject) - { - UserSpace us = new UserSpace(system_, "/QSYS.LIB/QTEMP.LIB/JT4PTF.USRSPC"); - us.setMustUseProgramCall(true); - if (!willRunProgramsOnThread) - { - us.setMustUseSockets(true); - // Force the use of sockets when running natively but not on-thread. - // We have to do it this way since UserSpace will otherwise make a native ProgramCall, and will use a different QTEMP library than that used by the host server. - } - try - { - us.create(256*1024, true, "", (byte)0, "User space for PTF list", "*EXCLUDE"); - if (!pc.run()) - { - AS400Message[] messages = pc.getMessageList(); - if (messages.length == 1 && (messages[0].getID().equalsIgnoreCase("CPF6601") || // No PTF activity exists - messages[0].getID().equalsIgnoreCase("CPF35BE"))) // Product not supported or installed - { - return new PTF[0]; - } - throw new AS400Exception(pc.getMessageList()); - } - - int size = us.getLength(); - buf = new byte[size]; - us.read(buf, 0); - } - finally - { - // Delete the temporary user space, to allow other threads to re-create and use it. - try { us.delete(); } - catch (Exception e) { - Trace.log(Trace.ERROR, "Exception while deleting temporary user space", e); - } - } - } - int startingOffset = BinaryConverter.byteArrayToInt(buf, 124); - int numEntries = BinaryConverter.byteArrayToInt(buf, 132); - int entrySize = BinaryConverter.byteArrayToInt(buf, 136); - int entryCCSID = BinaryConverter.byteArrayToInt(buf, 140); - conv = ConvTable.getTable(entryCCSID, null); - int offset = 0; - PTF[] ptfs = new PTF[numEntries]; - for (int i=0; i - *

  • {@link #REGISTRATION_TYPE_PHONE REGISTRATION_TYPE_PHONE} - *
  • {@link #REGISTRATION_TYPE_SYSTEM REGISTRATION_TYPE_SYSTEM} - *
  • {@link #REGISTRATION_TYPE_CUSTOMER REGISTRATION_TYPE_CUSTOMER} - * - * @return The registration type. - * @see #getRegistrationValue - **/ - public String getRegistrationType() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_ && !partiallyLoaded_) refresh(100); - return registrationType_; - } - - - /** - * Returns the registration value associated with this product. The - * registration type and registration value together make up the - * registration ID for the product. - * @return The registration value. - * @see #getRegistrationType - **/ - public String getRegistrationValue() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_ && !partiallyLoaded_) refresh(100); - return registrationValue_; - } - - - /** - * Returns the value specified for the release date when the product - * definition for this product load was created. If no release date - * was specified for the product, then null is returned. - * @return The release date, or null if there is no release date. - **/ - public Date getReleaseDate() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded500_) refresh(500); - return releaseDate_; - } - - - /** - * Returns the release level for this product. For example: "V5R1M0". - * If any of the special values were specified when this object was constructed, - * the real release level will be retrieved from the system. - * @return The release level. - **/ - public String getReleaseLevel() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (releaseLevel_.equals(PRODUCT_RELEASE_CURRENT) || releaseLevel_.equals(PRODUCT_RELEASE_PREVIOUS) || - releaseLevel_.equals(PRODUCT_RELEASE_ONLY) || releaseLevel_.equals(PRODUCT_RELEASE_ANY)) - { - refresh(100); - } - return releaseLevel_; - } - - - /** - * Returns the reason why the release requirements between the base and - * option may or may not be in error. (When a product allows mixed releases - * between its base and option, certain requirements must be met). If the - * load type is LOAD_TYPE_LANGUAGE, then this method returns REQUIREMENTS_UNKNOWN. - * Possible values are: - *
      - *
    • {@link #REQUIREMENTS_UNKNOWN REQUIREMENTS_UNKNOWN} - *
    • {@link #REQUIREMENTS_MET REQUIREMENTS_MET} - *
    • {@link #REQUIREMENTS_OPTION_TOO_OLD REQUIREMENTS_OPTION_TOO_OLD} - *
    • {@link #REQUIREMENTS_BASE_TOO_OLD REQUIREMENTS_BASE_TOO_OLD} - *
    - * @return The reason why requirements are met or not. - * @see #getLoadType - **/ - public int getRequirementsMet() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_) refresh(100); - return requirementsMet_; - } - - - /** - * Returns the symbolic load state for which information was retrieved. - * This value, in conjunction with the load error, can be used to determine - * if the load is installed correctly. Possible values are: - *
      - *
    • {@link #SYMBOLIC_LOAD_STATE_DEFINED SYMBOLIC_LOAD_STATE_DEFINED} - *
    • {@link #SYMBOLIC_LOAD_STATE_CREATED SYMBOLIC_LOAD_STATE_CREATED} - *
    • {@link #SYMBOLIC_LOAD_STATE_PACKAGED SYMBOLIC_LOAD_STATE_PACKAGED} - *
    • {@link #SYMBOLIC_LOAD_STATE_DAMAGED SYMBOLIC_LOAD_STATE_DAMAGED} - *
    • {@link #SYMBOLIC_LOAD_STATE_LOADED SYMBOLIC_LOAD_STATE_LOADED} - *
    • {@link #SYMBOLIC_LOAD_STATE_INSTALLED SYMBOLIC_LOAD_STATE_INSTALLED} - *
    - * @return The symbolic load state. - * @see #getLoadState - * @see #isLoadInError - **/ - public String getSymbolicLoadState() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - return getSymbolicLoadState(true); // normal error processing - } - - - /** - Utility method to enable retrieval of product load state without cluttering the job log with "Product information not found" messages. - @param logErrorsInJobLog Whether errors are to be logged and reported normally. - If false, errors are to be returned in the 'error code' parameter (and not logged in the job log). - **/ - private String getSymbolicLoadState(boolean logErrorsInJobLog) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_) refresh(100, logErrorsInJobLog); - return symbolicLoadState_; - } - - - /** - * Returns the system. - * @return The system. - **/ - public AS400 getSystem() - { - return system_; - } - - - /** - * Indicates whether or not this product is installed on the system. - * @return true if the product is installed, false if it is not. - **/ - public boolean isInstalled() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (partiallyLoaded_) return installed_; - try - { - // First arg says: Don't clutter the job log with CPF0C1F "Product information not found" message (if the product isn't installed). - return getSymbolicLoadState(false).equals(SYMBOLIC_LOAD_STATE_INSTALLED); - } - catch(AS400Exception e) - { - AS400Message[] messages = e.getAS400MessageList(); - if (messages.length == 1 && messages[0].getID().equalsIgnoreCase("CPF0C1F")) // Product info not found - { - return false; - } - throw e; - } - } - - - /** - * Indicates if there is a known error for this product load. This does - * not mean that product is necessarily installed. Check the symbolic load - * state to determine if the product load is installed or not. - * @return true if an error was found the last time that the state of - * this load was checked or updated, false if no error was found. - * @see #getSymbolicLoadState - **/ - public boolean isLoadInError() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_) refresh(100); - return loadErrorIndicator_; - } - - - /** - * Indicates whether this product feature is currently supported. A feature - * can be supported by using the Work with Supported Products (WRKSPTPRD) - * command in the System Manager. - * @return true if the feature is supported, false if it is not. - **/ - public boolean isSupported() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (!loaded_ && !partiallyLoaded_) refresh(100); - return supported_; - } - - - /** - * Refreshes the current values and settings for this Product by retrieving all of them from the system. - * The getter methods implicitly refresh the necessary value if the value being sought has not been retrieved yet. - * @return true if some or all of the values were successfully refreshed; false if the system found no information - * for this product. - **/ - public boolean refresh() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - loadedLoadID_ = false; // disregard any previously-loaded value - - // If no previous error with formats 0500 or 0100, get the format 0500 values. - if (!error500_ && !error100_) refresh(500); - - // If no previous error with formats 0800 or 0100, get the format 0800 values. - if (!error800_ && !error100_) refresh(800); - - // If there were errors with formats 0500 and 0800, and no errors with format 0100, get the format 0100 values. - if (error500_ && error800_ && !error100_) refresh(100); - - - // If no previous error with format 0500, get description text. - if (!error500_) - { - loadedDescriptionText_ = false; - getDescriptionText(); - } - - fillInOptionInformation(); - return !error100_; - } - - - /** - * Does the real work based on the format requested. - * Formats currently supported are 100, 500, and 800. Note that - * all formats are supersets of the 100 format. - **/ - private void refresh(int whichFormat) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - refresh(whichFormat, true); - } - - - /** - * Does the real work based on the format requested. - * Formats currently supported are 100, 500, and 800. Note that - * all formats are supersets of the 100 format. - * @param logErrorsInJobLog Whether errors are to be logged and reported normally. - * If false, errors are to be returned in the 'error code' parameter (and not logged in the job log). - **/ - private void refresh(int whichFormat, boolean logErrorsInJobLog) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (releaseLevel_.equals(PRODUCT_RELEASE_ANY)) - { - // First try ONLY, then PREVIOUS, then CURRENT, since there will - // almost always be a product definition for CURRENT. - error100_ = false; - releaseLevel_ = PRODUCT_RELEASE_ONLY; - try - { - refresh(whichFormat); - return; - } - catch(AS400Exception x) {} - if (error100_) - { - error100_ = false; - releaseLevel_ = PRODUCT_RELEASE_PREVIOUS; - try - { - refresh(whichFormat); - return; - } - catch(AS400Exception x) {} - if (error100_) - { - error100_ = false; - releaseLevel_ = PRODUCT_RELEASE_CURRENT; - refresh(whichFormat); - return; - } - } - } - - String format = null; - int len = 0; - switch(whichFormat) - { - case 100: - if (error100_) return; // No point in trying again. - format = "PRDR0100"; - len = 108; - break; - case 500: - if (error500_) return; // No point in trying again. - format = "PRDR0500"; - len = 108+49+chunkSize_; // Don't need all the info. - break; - case 800: - if (error800_) return; // No point in trying again. - format = "PRDR0800"; - len = 108+17+chunkSize_; // In real life, len = 108+17 + (50+primaryPath+installPath+(10*numberOfObjectAuthorities)*numberOfEntries - break; - default: - format = "PRDR0100"; - whichFormat = 100; - len = 108; - break; - } - int ccsid = system_.getCcsid(); - ConvTable conv = ConvTable.getTable(ccsid, null); - - ProgramParameter[] parms = new ProgramParameter[6]; - parms[0] = new ProgramParameter(len); // receiver variable - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(len)); // length of receiver variable - parms[2] = new ProgramParameter(conv.stringToByteArray(format)); // format name - byte[] productInfo = new byte[36]; - AS400Text text4 = new AS400Text(4, ccsid, system_); - AS400Text text6 = new AS400Text(6, ccsid, system_); - AS400Text text7 = new AS400Text(7, ccsid, system_); - AS400Text text10 = new AS400Text(10, ccsid, system_); - text7.toBytes(productID_, productInfo, 0); - text6.toBytes(releaseLevel_, productInfo, 7); - String option = productOption_; - if (option.equals(PRODUCT_OPTION_BASE) || whichFormat == 500) // PRDR0500 needs 0000 - { - option = "0000"; - } - text4.toBytes(option, productInfo, 13); - text10.toBytes((loadID_ == null || whichFormat == 500) ? PRODUCT_FEATURE_CODE : loadID_, productInfo, 17); // PRDR0500 needs *CODE - BinaryConverter.intToByteArray(36, productInfo, 28); - BinaryConverter.intToByteArray(ccsid, productInfo, 32); - parms[3] = new ProgramParameter(productInfo); // product information - // 'error code' parameter - if (logErrorsInJobLog) { - parms[4] = new ErrorCodeParameter(); // normal error processing - } - else { - parms[4] = new ErrorCodeParameter(true,false); // return any errors via the 'error code' parameter; don't clutter the job log - } - parms[5] = new ProgramParameter(conv.stringToByteArray("PRDI0200")); // product information format name - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QSZRTVPR.PGM", parms); - // Note: The called API is not thread-safe. - - boolean pcSucceeded = pc.run(); - AS400Message[] messages = null; - - if (logErrorsInJobLog) // normal error processing - { - if (!pcSucceeded) { - messages = pc.getMessageList(); // get errors from message list - } - } - else - { - // If any errors occurred, they were returned in the 'error code' parm, rather than in the message list. - ErrorCodeParameter errParm = (ErrorCodeParameter)parms[4]; - String msgID = errParm.getMessageID(); - if (msgID != null) - { - pcSucceeded = false; - - // Compose a message list, as if we had called the program with a normal 'error code' parm. - try - { - String substData = errParm.getSubstitutionData(); - MessageFile mf = new MessageFile(system_, "/QSYS.LIB/QCPFMSG.MSGF"); - AS400Message msg = mf.getMessage(msgID, substData); - messages = new AS400Message[1]; - messages[0] = msg; - } - catch (Throwable t) { - Trace.log(Trace.ERROR, "Error when retrieving error messages.", t); - } - } - } - - if (!pcSucceeded) - { - if (messages.length == 1 && messages[0].getID().equalsIgnoreCase("CPF0C1F")) - { - // It's OK, there just wasn't a product definition. - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "No product definition found for "+toString()+" using format "+whichFormat+"."); - } - installed_ = false; - if (whichFormat != 100) - { - refresh(100); - if (whichFormat == 500) - { - releaseDate_ = null; - firstCopyright_ = null; - currentCopyright_ = null; - options_ = new Product[0]; - loaded500_ = true; - error500_ = true; - } - else if (whichFormat == 800) - { - directories_ = new ProductDirectoryInformation[0]; - loaded500_ = true; - error800_ = true; - } - return; - } - else - { - // The 0500 format may work since it uses a different product option than what we are set to. - // But the 0100 or 0800 formats may still fail since we switch back to use the option we were given. - error100_ = true; - } - } - throw new AS400Exception(messages); - } - - byte[] outputData = parms[0].getOutputData(); - int bytesReturned = BinaryConverter.byteArrayToInt(outputData, 0); - int bytesAvailable = BinaryConverter.byteArrayToInt(outputData, 4); - if (bytesReturned < bytesAvailable) - { - chunkSize_ = bytesAvailable; - refresh(whichFormat); - return; - } - releaseLevel_ = conv.byteArrayToString(outputData, 19, 6); - if (whichFormat != 500) { // Since 0500 uses *CODE, we don't want to reset it. - loadID_ = conv.byteArrayToString(outputData, 29, 4); - loadedLoadID_ = true; - } - loadType_ = conv.byteArrayToString(outputData, 33, 10).trim(); - symbolicLoadState_ = conv.byteArrayToString(outputData, 43, 10); - loadErrorIndicator_ = !conv.byteArrayToString(outputData, 53, 10).trim().equals("*NONE"); // *ERROR for error, *NONE for not. - loadState_ = conv.byteArrayToString(outputData, 63, 2); - supported_ = conv.byteArrayToString(outputData, 65, 1).equals("1"); - registrationType_ = conv.byteArrayToString(outputData, 66, 2); - registrationValue_ = conv.byteArrayToString(outputData, 68, 14); - primaryLanguageLoadID_ = conv.byteArrayToString(outputData, 88, 4); - minimumTargetRelease_ = conv.byteArrayToString(outputData, 92, 6); - minimumBaseVRM_ = conv.byteArrayToString(outputData, 98, 6); - requirementsMet_ = (int)(outputData[104] & 0x000F); // 0xF0 = 0, 0xF1 = 1, etc... - level_ = conv.byteArrayToString(outputData, 105, 3); - - loaded_ = true; // indicate that the above 0100 fields have been loaded - - if (whichFormat == 500) - { - int offset = BinaryConverter.byteArrayToInt(outputData, 84); - allowsMultipleReleases_ = (outputData[offset++] == (byte)0xF1); // '1' is yes, '0' is no. - boolean y2k = (outputData[offset++] == (byte)0xF1); // '1' is 20xx; '0' is 19xx - String d = conv.byteArrayToString(outputData, offset, 6); - Date releaseDate = null; - if (d.trim().length() == 6) - { - Calendar cal = Calendar.getInstance(); - cal.clear(); - cal.set(Integer.parseInt(d.substring(0,2)) + (y2k ? 2000 : 1900), // year - Integer.parseInt(d.substring(2,4))-1, // month is zero based - Integer.parseInt(d.substring(4,6))); // day - releaseDate = cal.getTime(); - } - releaseDate_ = releaseDate; - offset += 6; - firstCopyright_ = conv.byteArrayToString(outputData, offset, 4); - offset += 4; - currentCopyright_ = conv.byteArrayToString(outputData, offset, 4).trim(); - offset += 4; - String fileName = conv.byteArrayToString(outputData, offset, 10).trim(); - offset += 10; - String fileLibrary = conv.byteArrayToString(outputData, offset, 10).trim(); - offset += 10; - if (fileName.length() > 0) - { - messageFile_ = QSYSObjectPathName.toPath(fileLibrary, fileName, "MSGF"); - } - else - { - messageFile_ = ""; - } - int numOptions = BinaryConverter.byteArrayToInt(outputData, offset); - offset += 4; - int entryLength = BinaryConverter.byteArrayToInt(outputData, offset); - offset += 4; - int offsetToOptions = BinaryConverter.byteArrayToInt(outputData, offset); - offset += 4; - allowsMixedReleases_ = (outputData[offset] == (byte)0xF1); // '1' allows, '0' doesn't. - - options_ = new Product[numOptions]; - for (int i=0; i - *
  • *RWX - Read, write, and execute authorities. - *
  • *RW - Read and write authorities. - *
  • *RX - Read and execute authorities. - *
  • *WX - Write and execute authorities. - *
  • *R - Read authority. - *
  • *W - Write authority. - *
  • *X - Execute authority. - *
  • *EXCLUDE - Restricted authority. - *
  • *NONE - No specific authorities. - * - * @return The public data authority for this product directory. - * @see com.ibm.as400.access.UserPermission - **/ - public String getPublicDataAuthority() - { - return publicDataAuthority_; - } - - /** - * The public object authorities given to the directory by the Restore Licensed Program (RSTLICPGM) command when - * this product is installed if the directory does not exist. If the product load has not been successfully - * packaged, the number of public object authorities will be 0 and this method will return an empty String array. - * Possible public object authorities are: - *
      - *
    • *NONE - No authority. - *
    • *ALL - All authorities. - *
    • *OBJEXIST - Existence authority. - *
    • *OBJMGT - Management authority. - *
    • *OBJALTER - Alter authority. - *
    • *OBJREF - Reference authority. - *
    - * @return The public object authorities for this product directory. - * @see com.ibm.as400.access.UserPermission - **/ - public String[] getPublicObjectAuthorities() - { - return authorities_; - } - - /** - * Returns the string representation of this object. - * @return The primary full path name of this product directory. - **/ - public String toString() - { - return fullPath_; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/ProductLicense.java b/cvsroot/src/com/ibm/as400/access/ProductLicense.java deleted file mode 100644 index 32b8ab814..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProductLicense.java +++ /dev/null @@ -1,972 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProductLicense.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - - -package com.ibm.as400.access; - -import java.beans.PropertyChangeSupport; // @A2A -import java.beans.PropertyChangeListener; // @A2A -import java.io.IOException; -import java.io.ObjectInputStream; -import java.util.Vector; // @A2A - - - -/** -* Represents a license for a product on the IBM i system. To request -* a license, construct a ProductLicense object then invoke the request() method. -* The caller must keep a reference to the ProductLicense object until the -* license is no longer needed since the ProductLicense object will release -* the license when it is garbage collected. Licenses are managed on a -* per-connection basis. Each ProductLicense object has a separate connection to -* the system. If the connection ends unexpectedly the system -* releases the license. To maintain an accurate count, the application should -* call release() instead of relying on the license being released when the object -* is garbage collected or when the connection ends. Cleanup during garbage -* collection and/or system cleanup is not as reliable as calling release(). -* -*

    -* The ProductLicense class does not enforce the license policy. It is up to the -* application to enforce the policy based on information contained in the ProductLicense -* object after the license is requested. If a license is not granted, indicated by a -* LicenseException, it is up to the application to notify the user and not perform the -* behavior that requires a license. -* -*

    -* The ProductLicense object may successfully get a license even though there was an error -* retrieving the product license. These "soft" errors are usage limit exceeded, but license -* limit not strictly enforced (CONDITION_EXCEEDED_OK), usage limit exceeded, but within grace -* period (CONDITION_EXCEED_GRACE_PERIOD) and usage limit exceeded and grace period expired -* but not strictly enforced (CONDITION_GRACE_PERIOD_EXPIRED.) The application must decide -* to continue or end the application based on this information. -* -*

    -* The request() method will throw a LicenseException if no license is available. If a license -* is granted, the ProductLicense object contains information about the license such -* as the compliance type and license condition. -* -*

    Example

    -* -*
    -*
    -*        AS400 system = new AS400("myas400");
    -*        // request a license for "myproductID" and "myfeatureID" for "myrelease"
    -*        try
    -*        {
    -*            ProductLicense license = new ProductLicense(system,
    -*                                                        "myproductID",
    -*                                                        "myfeatureID",
    -*                                                        "myrelease");
    -*            license.request();
    -*            switch (license.getCondition())
    -*            {
    -*                case ProductLicense.CONDITION_OK:
    -*                    // license retrieved successfully
    -*                    break;
    -*                case ProductLicense.CONDITION_EXCEEDED_OK:
    -*                    // usage limit exceeded, but license limit not strictly enforced
    -*                    // issue message but allow to proceed.
    -*                    sendMessage("Usage limit exceeded, but license limit not strictly enforced");
    -*                    break;
    -*                case ProductLicense.CONDITION_EXCEEDED_GRACE_PERIOD:
    -*                    // usage limit exceeded, but within grace period
    -*                    // issue message but allow to proceed
    -*                    sendMessage("Usage limit exceeded, but within grace period");
    -*                    break;
    -*                case ProductLicense.CONDITION_GRACE_PERIOD_EXPIRED:
    -*                    // usage limit exceeded and grace period expired but not strictly enforced
    -*                    // issue message but allow to proceed
    -*                    sendMessage("Usage limit exceeded and grace period expired but not strictly enforced");
    -*                    break;
    -*                default:
    -*                    // Some other condition.
    -*                    // This should never happen, but if it does, display value.
    -*                    sendMessage("Unrecognized condition: " + license.getCondition());
    -*            }
    -*            ..
    -*            ..
    -*            // product code...
    -*            ..
    -*            ..
    -*            // release the license
    -*            license.release();
    -*        }
    -*        catch (LicenseException le)
    -*        {
    -*            // handle license failures such as license expired...
    -*        }
    -*        catch (Exception e)
    -*        {
    -*            // handle general failures (security error, communication error, etc.)
    -*        }
    -*
    -* 
    -**/ - - -public class ProductLicense implements java.io.Serializable -{ - /** - * Value for license usage type, concurrent usage license type. - **/ - public final static int USAGE_CONCURRENT = 1; - /** - * Value for license usage type, registered usage license type. - **/ - public final static int USAGE_REGISTERED = 2; - - /** - * Value for compliance type, operator action compliance indicates a form - * of soft compliance that will not allow a license in the usage limit exceeded - * case until the operator increases the maximum number of licenses on the system - * (this does not require a license key to increase.) - **/ - public final static int COMPLIANCE_OPERATOR_ACTION = 1; - /** - * Value for compliance type, warning compliance indicates that a - * warning message will be sent to the system operators message queue - * when a license violation, such as usage limit exceeded is encountered. - **/ - public final static int COMPLIANCE_WARNING = 2; - /** - * Value for compliance type, keyed compliance indicates a license - * that requires a license key to activate the license. - **/ - public final static int COMPLIANCE_KEYED = 3; - - /** - * Value for license condition, license granted. - **/ - public static final int CONDITION_OK = 0; - /** - * Value for license condition, usage limit exceeded, but not enforced. - **/ - public static final int CONDITION_EXCEEDED_OK = 0x002b; - /** - * Value for license condition, usage limit exceeded, but within grace period. - **/ - public static final int CONDITION_EXCEEDED_GRACE_PERIOD = 0x002c; - /** - * Value for license condition, usage limit exceeded and grace period expired, but not - * enforced. - **/ - public static final int CONDITION_GRACE_PERIOD_EXPIRED = 0x002e; - - static - { - AS400Server.addReplyStream(new NLSExchangeAttrReply(), "as-central"); - AS400Server.addReplyStream(new LicenseGetReply(), "as-central"); - AS400Server.addReplyStream(new LicenseReleaseReply(), "as-central"); - AS400Server.addReplyStream(new LicenseGetInformationReply(), "as-central"); - } - - transient private PropertyChangeSupport changes_; // @A2A - transient private Vector productLicenseListeners_; // @A2A - - static final long serialVersionUID = 4L; // @A2A - - transient private boolean released_; // @A2C - transient private int condition_; // @A2C - - transient private AS400 sys_; // @A2C - transient private AS400Server server_; // @A2C - transient private AS400ImplRemote sysImpl_; // @A2C - - private String productID_; - private String featureID_; - private String releaseLevel_; // @A1C - - transient private int usageLimit_; // @A2C - transient private int usageCount_; // @A2C - transient private int usageType_; // @A2C - transient private int complianceType_; // @A2C - transient private String licenseTerm_; // @A2C - - - - /** - * Constructs a default ProductLicense object. The system, - * product, feature and release must be set for requesting a license. - **/ - public ProductLicense() - { - initializeTransient(); // @A2A - - productID_ = null; - featureID_ = null; - - } - - /** - * Constructs a ProductLicense object for a system, product, feature, - * and release. - * @param system the system from which the license will be requested. - * @param productID the product identifier. For example, "5769JC1". - * @param featureID the product feature. For example, "5050". - * @param release the product release. For example, "V4R5M0". - **/ - public ProductLicense(AS400 system, String productID, String featureID, String release) - { - this(); - - // get a new AS400 object to make sure we get a separate connection - sys_ = new AS400(system); - if(sys_ == null) - { - throw new NullPointerException("system"); - } - - if(productID == null) - { - throw new NullPointerException("productID"); - } - else - { - productID_ = productID; - } - - if(featureID == null) - { - throw new NullPointerException("featureID"); - } - else - { - featureID_ = featureID; - } - - if(release == null) - { - releaseLevel_ = " "; // set correct release variable @A1C - } - else - { - releaseLevel_ = release; // set correct release variable @A1C - } - } - - - /** - Adds a file listener to receive file events from this IFSFile. - @param listener The file listener. - **/ - // This function added to enable beans @A2A - public void addProductLicenseListener(ProductLicenseListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - productLicenseListeners_.addElement(listener); - } - - /** - Adds a property change listener. - @param listener The property change listener to add. - **/ - // This function added to enable beans @A2A - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - changes_.addPropertyChangeListener(listener); - } - - - - - /** - * Disconnect from the host server. - **/ - void disconnect() - { - synchronized(sys_) - { - - if(server_ != null) - { - - if(Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "Disconnecting from server"); - } - try - { - sysImpl_.disconnectServer(server_); - server_ = null; - } - catch(Exception e) - { - if(Trace.traceOn_) - { - Trace.log(Trace.ERROR, "Exception encountered while disconnecting", e); - } - } - } // (server_ != null) - } // synchronized(sys_) - } // disconnect() - - /** - * The finalizer. - **/ - protected void finalize() - { - if(Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "finalize() - ProductLicense"); - } - - try - { - release(); - } - catch(Exception e) - { - if(Trace.traceOn_) - { - Trace.log(Trace.ERROR, "release license failed", e); - } - } - } - - // Fire connect events here so source is public object. - private void fireProductLicenseEvent(int status) - { - ProductLicenseEvent event = new ProductLicenseEvent(this, status); - - Vector targets = (Vector)productLicenseListeners_.clone(); - for (int i = 0; i < targets.size(); ++i) - { - ProductLicenseListener target = (ProductLicenseListener)targets.elementAt(i); - switch(status) - { - case ProductLicenseEvent.PRODUCT_LICENSE_RELEASED: - target.licenseReleased(event); - break; - case ProductLicenseEvent.PRODUCT_LICENSE_REQUESTED: - target.licenseRequested(event); - break; - default: - // This should never happen, but if it does, trace it. - Trace.log(Trace.ERROR, "Event status:", status); - } - } - } - - - /** - * Returns the compliance type for this license. Possible values are - * COMPLIANCE_OPERATOR_ACTION, COMPLIANCE_WARNING and COMPLIANCE_KEYED. - * A license must have been requested prior to calling this method. - * @return The compliance type. - **/ - public int getComplianceType() - { - if(released_) - { - throw new ExtendedIllegalStateException(ExtendedIllegalStateException.INFORMATION_NOT_AVAILABLE); - } - - return complianceType_; - } - - /** - * Returns the condition of the license. Possible values are CONDITION_OK, - * CONDITION_EXCEEDED_OK, CONDITION_EXCEEDED_GRACE_PERIOD, - * and CONDITION_GRACE_EXPIRED. A license must have been requested prior to - * calling this method. - * @return The license condition. - **/ - public int getCondition() - { - if(released_) - throw new ExtendedIllegalStateException(("Object= "+ sys_.getSystemName()), - ExtendedIllegalStateException.INFORMATION_NOT_AVAILABLE); - - return condition_; - } - - - /** - * Returns the feature identifier for this license. - * @return The feature identifier. - **/ - public String getFeature() - { - return featureID_; - } - - /** - * Returns the license term for this license. A license must - * have been requested prior to calling this method. - * @return The license term. - **/ - public String getLicenseTerm() - { - if(released_) - throw new ExtendedIllegalStateException(("Object= "+ sys_.getSystemName()), - ExtendedIllegalStateException.INFORMATION_NOT_AVAILABLE); - - return licenseTerm_; - } - - /** - * Returns the product identifier for this license. - * @return The product identifier. - **/ - public String getProductID() - { - return productID_; - } - - /** - * Returns the release level for this license. - * @return The release level. - **/ - public String getReleaseLevel() - { - return releaseLevel_; - } - - /** - * Return the name of the system for this license. A license must have been - * requested prior to calling this method. - * @return The name of the AS400. - **/ - /* String getSystemName() - { - if(released_) - throw new ExtendedIllegalStateException(ExtendedIllegalStateException.INFORMATION_NOT_AVAILABLE); - - return sys_.getSystemName(); - } */ - - /** - * Returns the system object for this license. - * @return The system. - **/ - public AS400 getSystem() - { - return sys_; - } - - /** - * Returns the usage count for this license. The count returned is the number - * of licenses that are in use on the system for that product ID, feature, and - * release when this license was requested. A license must have been requested - * prior to calling this method. - * @return The usage count when this license was retrieved. - **/ - public int getUsageCount() - { - if(released_) - throw new ExtendedIllegalStateException(ExtendedIllegalStateException.INFORMATION_NOT_AVAILABLE); - - return usageCount_; - } - - /** - * Returns the usage limit for this license.A license must have been requested prior to - * calling this method. - * @return The usage limit. - **/ - public int getUsageLimit() - { - if(released_) - throw new ExtendedIllegalStateException(("Object= "+ sys_.getSystemName()), - ExtendedIllegalStateException.INFORMATION_NOT_AVAILABLE); - - return usageLimit_; - } - - /** - * Returns the usage type for this license. Possible values are USAGE_CONCURRENT and - * USAGE_REGISTERED. A license must have been requested prior to calling this method. - * @return The usage type. - **/ - public int getUsageType() - { - if(released_) - throw new ExtendedIllegalStateException("UsageType", - ExtendedIllegalStateException.INFORMATION_NOT_AVAILABLE); - - return usageType_; - } - - /** - Provided to initialize transient data if this object is de-serialized. // @A2A - **/ - private void initializeTransient() - { - - changes_ = new PropertyChangeSupport(this); - productLicenseListeners_ = new Vector(); - - sys_ = null; - sysImpl_ = null; - - condition_ = CONDITION_OK; - released_ = true; - - usageLimit_ = 0; - usageCount_ = -1; - usageType_ = -1; - complianceType_ = -1; - licenseTerm_ = null; - releaseLevel_ = null; - - } - - /** - * Release this license. This method must be called to release the license. Failure - * to do so may result in incorrect license usage count. Calling this method will - * disconnect from the IBM i Optimized License Management server. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception LicenseException If a license error occurs. - **/ - public void release() - throws IOException, InterruptedException, LicenseException - { - - // Verify that the bean properties are set prior to attempting the release. - if (sys_ == null) - { - if(Trace.traceOn_) - { - Trace.log(Trace.ERROR, "System not set yet."); - } - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - if (productID_ == null) - { - if(Trace.traceOn_) - { - Trace.log(Trace.ERROR, "Product ID not set yet."); - } - throw new ExtendedIllegalStateException("productID", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - if (featureID_ == null) - { - if(Trace.traceOn_) - { - Trace.log(Trace.ERROR, "Feature ID not set yet."); - } - throw new ExtendedIllegalStateException("featureID", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - if (releaseLevel_ == null) - { - if(Trace.traceOn_) - { - Trace.log(Trace.ERROR, "Release not set yet."); - } - throw new ExtendedIllegalStateException("release", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - synchronized(sys_) - { - if(released_) return; - - - if(Trace.traceOn_) - { - // release license from server - Trace.log(Trace.DIAGNOSTIC, "Releasing license from server"); - } - - if(server_ != null) - { - LicenseReleaseRequest releaseRequest = new LicenseReleaseRequest(sys_); - releaseRequest.setProductID(productID_); - releaseRequest.setFeature(featureID_); - releaseRequest.setRelease(releaseLevel_); - DataStream baseReply = server_.sendAndReceive(releaseRequest); - if(baseReply instanceof LicenseReleaseReply) - { - LicenseReleaseReply releaseReply = (LicenseReleaseReply)baseReply; - released_ = true; - disconnect(); - if(releaseReply.getPrimaryRC() != 0) - { - Trace.log(Trace.DIAGNOSTIC, "Release license failed, primary return code = ", releaseReply.getPrimaryRC()); - Trace.log(Trace.DIAGNOSTIC, "Release license failed, secondary return code = ", releaseReply.getSecondaryRC()); - throw new LicenseException(releaseReply.getPrimaryRC(), releaseReply.getSecondaryRC()); - } - - // Fire the license released event. - fireProductLicenseEvent(ProductLicenseEvent.PRODUCT_LICENSE_RELEASED); - - } // baseReply instanceof LicenseReleaseReply - } // server_ != null - } // synchronized(sys_) - } // public void release() - - /** - * Request a license. - * @return The condition of the license. Possible values are CONDITION_OK, - * CONDITION_EXCEEDED_OK, CONDITION_EXCEEDED_GRACE_PERIOD, - * and CONDITION_GRACE_EXPIRED. - * @exception IOException If an error occurs while communicating with the system. - * @exception AS400SecurityException Unable to connect due to some problem with the user ID or password used to authenticate. - * @exception InterruptedException If this thread is interrupted. - * @exception LicenseException If a license error occurs. - * @exception ExtendedIllegalStateException If a license is requested a second time for the same ProductLicense object. - **/ - public int request() - throws IOException, AS400SecurityException, InterruptedException, LicenseException - { - // Verify that the bean properties are set prior to attempting the release. - if (sys_ == null) - { - if(Trace.traceOn_) - { - Trace.log(Trace.ERROR, "System not set yet."); - } - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - if (productID_ == null) - { - if(Trace.traceOn_) - { - Trace.log(Trace.ERROR, "Product ID not set yet."); - } - throw new ExtendedIllegalStateException("productID", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - if (featureID_ == null) - { - if(Trace.traceOn_) - { - Trace.log(Trace.ERROR, "Feature ID not set yet."); - } - throw new ExtendedIllegalStateException("featureID", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - if (releaseLevel_ == null) - { - if(Trace.traceOn_) - { - Trace.log(Trace.ERROR, "Release not set yet."); - } - throw new ExtendedIllegalStateException("release", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - synchronized(sys_) - { - - if(!released_) - throw new ExtendedIllegalStateException(("Object= "+ sys_.getSystemName()), - ExtendedIllegalStateException.LICENSE_CAN_NOT_BE_REQUESTED); - if(Trace.traceOn_) - { - // request license from server - Trace.log(Trace.DIAGNOSTIC, "retrieving license from server"); - } - - sys_.connectService(AS400.CENTRAL); - - sysImpl_= (AS400ImplRemote) sys_.getImpl(); - - server_ = sysImpl_.getConnection(AS400.CENTRAL, false); - - NLSExchangeAttrRequest request = new NLSExchangeAttrRequest(); - try - { - server_.sendExchangeAttrRequest(request); - } - catch(IOException e) - { - Trace.log(Trace.ERROR, "IOException After Exchange Attribute Request", e); - disconnect(); - throw e; - } - DataStream baseReply = server_.getExchangeAttrReply(); - - if(baseReply instanceof NLSExchangeAttrReply) - { - // means request completed CONDITION_OK - NLSExchangeAttrReply NLSReply = (NLSExchangeAttrReply)baseReply; - if(NLSReply.primaryRC_ != 0) - { - Trace.log(Trace.ERROR, ("Exchange attribute failed, primary return code =" + - NLSReply.primaryRC_ + - "secondary return code =" + - NLSReply.secondaryRC_) ); - disconnect(); - throw new IOException(); - } - } - else - { // unknown data stream - if(Trace.traceOn_) - { - Trace.log(Trace.ERROR, "Unknown instance returned from Exchange Attribute Reply"); - } - - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - - - - LicenseGetRequest getLicReq = new LicenseGetRequest(sys_); - getLicReq.setProductID(productID_); - getLicReq.setFeature(featureID_); - getLicReq.setRelease(releaseLevel_); - - try - { - baseReply = server_.sendAndReceive(getLicReq); - } - catch(IOException e) - { - Trace.log(Trace.ERROR, "IOException occured - Request license", e); - disconnect(); - throw e; - } - - if(baseReply instanceof LicenseGetReply) - { - LicenseGetReply getReply = (LicenseGetReply)baseReply; - - if(getReply.getPrimaryRC() == 0) - { - usageLimit_ = getReply.getUsageLimit(); - usageCount_ = getReply.getUsageCount(); - // bump usage count by one, because server gets usage count before retrieving - // license, so the count is off by 1. - usageCount_++; - usageType_ = getReply.getUsageType(); - complianceType_ = getReply.getComplianceType(); - licenseTerm_ = getReply.getLicenseTerm(); - releaseLevel_ = getReply.getReleaseLevel(); - - condition_ = getReply.getSecondaryRC(); - switch (condition_) // verify that it's a recognized value - { - case CONDITION_OK: - case CONDITION_EXCEEDED_OK: - case CONDITION_EXCEEDED_GRACE_PERIOD: - case CONDITION_GRACE_PERIOD_EXPIRED: - break; - default: // This should never happen; but if it does, trace it. - Trace.log(Trace.ERROR, "LicenseGetReply.getSecondaryRC():", condition_); - } - released_ = false; - - // Fire the license released event. - fireProductLicenseEvent(ProductLicenseEvent.PRODUCT_LICENSE_REQUESTED); - - } - else - { - if(Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, ("Request license failed, primary return code =" + - getReply.getPrimaryRC() + - "secondary return code =" + - getReply.getSecondaryRC()) ); - } - throw new LicenseException(getReply.getPrimaryRC(), getReply.getSecondaryRC()); - } - } - else - { - if(Trace.traceOn_) - { - Trace.log(Trace.ERROR, "Unknown instance returned from Get License Reply"); - } - - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - - return condition_; - - } // synchronized(sys_) - - } // public void request() - - - - - - /** - Removes this listener from being notified when a bound property changes. - - @param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - - changes_.removePropertyChangeListener(listener); - } - - /** - Removes a listener from the ProductLicense listeners list. - - @param listener The product license listener. - **/ - public void removeProductLicenseListener(ProductLicenseListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - - productLicenseListeners_.removeElement(listener); - } - - - - - - - - - /** - * Sets the feature identifier for this license. - * @param featureID the product feature. For example, "5050". - **/ - public void setFeature(String featureID) - { - if(featureID == null) // @A2C - { - throw new NullPointerException("featureID"); // @A2C - } - - // Ensure that the featureID is not altered after the connection is - // established. - if (sysImpl_ != null) - { - throw new ExtendedIllegalStateException("featureID", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); // @A2A - } - - String oldFeatureID = featureID_; // @A2A - featureID_ = featureID; - - // Fire the property change event having null as the name to - // indicate that the path, parent, etc. have changed. - changes_.firePropertyChange("featureID", - oldFeatureID, - featureID_); // @A2A - - - } - - /** - * Sets the product identifier for this license. - * @param productID the product identifier. For example, "5769JC1". - **/ - public void setProductID(String productID) - { - if(productID == null) - { - throw new NullPointerException("productID"); - } - - // Ensure that the productID is not altered after the connection is - // established. - if (sysImpl_ != null) - { - throw new ExtendedIllegalStateException("productID", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); // @A2A - } - - String oldProductID = productID_; // @A2A - productID_ = productID; - - // Fire the property change event having null as the name to - // indicate that the path, parent, etc. have changed. - changes_.firePropertyChange("productID", - oldProductID, - productID_); // @A2A - - } - - /** - * Sets the product release for this license. - * @param releaseLevel the product release. For example, "V4R5M0". - **/ - public void setReleaseLevel(String releaseLevel) - { - if(releaseLevel == null) - { - throw new NullPointerException("releaseLevel"); - } - - // Ensure that the releaseLevel is not altered after the connection is - // established. - if (sysImpl_ != null) - { - throw new ExtendedIllegalStateException("releaseLevel", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); // @A2A - } - - String oldReleaseLevel = releaseLevel_; // @A2A - releaseLevel_ = releaseLevel; - - // Fire the property change event having null as the name to - // indicate that the path, parent, etc. have changed. - changes_.firePropertyChange("releaseLevel", - oldReleaseLevel, - releaseLevel_); // @A2A - - } - - /** - * Sets the system object for this license. - * @param system the system from which the license will be requested. - **/ - public void setSystem(AS400 system) // @A2C - { - if(system == null) // @A2C - { - throw new NullPointerException("system"); // @A2C - } - - // Ensure that the system is not altered after the connection is - // established. - if (sysImpl_ != null) - { - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); // @A2A - } - - AS400 oldSystem = sys_; // @A2A - sys_ = system; // @A2C - - // Fire the property change event having null as the name to - // indicate that the path, parent, etc. have changed. - changes_.firePropertyChange("path", oldSystem, sys_); - - } - - - // Called when this object is de-serialized - private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException - { - in.defaultReadObject(); - initializeTransient(); - } - -} // public class ProductLicense - diff --git a/cvsroot/src/com/ibm/as400/access/ProductLicenseBeanInfo.java b/cvsroot/src/com/ibm/as400/access/ProductLicenseBeanInfo.java deleted file mode 100644 index 85fed47ff..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProductLicenseBeanInfo.java +++ /dev/null @@ -1,212 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProductLicenseBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; - -/** - The IFSFileBeanInfo class provides BeanInfo for IFSFile. -**/ -public class ProductLicenseBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private final static Class beanClass = ProductLicense.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - private static ResourceBundleLoader rbl_; - - static - { - try - { - // Define the property descriptors. - - // AS400 object - PropertyDescriptor property1 = - new PropertyDescriptor("system", beanClass, "getSystem", "setSystem"); - property1.setBound(true); - property1.setDisplayName(rbl_.getText("PROP_NAME_SYSTEM")); - property1.setShortDescription(rbl_.getText("PROP_DESC_SYSTEM")); - - // ProductID - PropertyDescriptor property2 = - new PropertyDescriptor("productID", beanClass, "getProductID", "setProductID"); - property2.setBound(true); - property2.setDisplayName(rbl_.getText("PROP_NAME_LICENSE_PRODUCTID")); - property2.setShortDescription(rbl_.getText("PROP_DESC_LICENSE_PRODUCTID")); - - // Feature - PropertyDescriptor property3 = - new PropertyDescriptor("feature", beanClass, "getFeature", "setFeature"); - property3.setBound(true); - property3.setDisplayName(rbl_.getText("PROP_NAME_LICENSE_FEATUREID")); - property3.setShortDescription(rbl_.getText("PROP_DESC_LICENSE_FEATUREID")); - - // Release - PropertyDescriptor property4 = - new PropertyDescriptor("releaseLevel", beanClass, "getReleaseLevel", "setReleaseLevel"); - property4.setBound(true); - property4.setDisplayName(rbl_.getText("PROP_NAME_LICENSE_RELEASELEVEL")); - property4.setShortDescription(rbl_.getText("PROP_DESC_LICENSE_RELEASELEVEL")); - - - /* - // The introspecition process will reveal features that aren't - // really properties. We must declare them and mark as hidden. - PropertyDescriptor property3 = - new PropertyDescriptor("absolutePath", beanClass, "getAbsolutePath", - null); - property3.setHidden(true); - PropertyDescriptor property4 = - new PropertyDescriptor("canonicalPath", beanClass, "getCanonicalPath", - null); - property4.setHidden(true); - PropertyDescriptor property5 = - new PropertyDescriptor("freeSpace", beanClass, "getFreeSpace", - null); - property5.setHidden(true); - PropertyDescriptor property6 = - new PropertyDescriptor("name", beanClass, "getName", - null); - property6.setHidden(true); - PropertyDescriptor property7 = - new PropertyDescriptor("parent", beanClass, "getParent", - null); - property7.setHidden(true); - PropertyDescriptor property8 = - new PropertyDescriptor("absolute", beanClass, "isAbsolute", - null); - property8.setHidden(true); - PropertyDescriptor property9 = - new PropertyDescriptor("directory", beanClass, "isDirectory", - null); - property9.setHidden(true); - PropertyDescriptor property10 = - new PropertyDescriptor("file", beanClass, "isFile", - null); - property10.setHidden(true); - PropertyDescriptor property11 = - new PropertyDescriptor("lastModified", beanClass, null, - "setLastModified"); - property11.setHidden(true); - - */ - - PropertyDescriptor[] properties = { property1, property2, property3, property4 }; - properties_ = properties; - - // Define the event descriptors. - EventSetDescriptor event1 = - new EventSetDescriptor(beanClass, "propertyChange", - PropertyChangeListener.class, - "propertyChange"); - event1.setShortDescription(rbl_.getText("EVT_DESC_PROPERTY_CHANGE")); - event1.setDisplayName(rbl_.getText("EVT_NAME_PROPERTY_CHANGE")); - String[] listenerMethods = { "licenseReleased", "licenseRequested" }; - - EventSetDescriptor event2 = - new EventSetDescriptor(beanClass, "productLicense", ProductLicenseListener.class, - listenerMethods, "addProductLicenseListener", - "removeProductLicenseListener"); - event2.setDisplayName(rbl_.getText("EVT_NAME_LICENSE_EVENT")); - event2.setShortDescription(rbl_.getText("EVT_DESC_LICENSE_EVENT")); - - EventSetDescriptor[] events = { event1, event2 }; - events_ = events; - } - catch(Exception e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the default event index. - @return The default event index (always 1). - **/ - public int getDefaultEventIndex() - { - return 1; - } - - /** - Returns the default property index. - @return The default property index (always 0). - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("License16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("LIcense32.gif"); - break; - } - - return image; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/ProductLicenseEvent.java b/cvsroot/src/com/ibm/as400/access/ProductLicenseEvent.java deleted file mode 100644 index e9e4abe51..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProductLicenseEvent.java +++ /dev/null @@ -1,74 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProductLicenseEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - The ProductLiceneEvent class represents a ProductLicense event. -**/ - -public class ProductLicenseEvent extends java.util.EventObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - /** - The product license released event ID. This event is delivered when a product license is released. - **/ - public static final int PRODUCT_LICENSE_RELEASED = 0; - - /** - The product license requested event ID. This event is delivered when a product license is requested. - **/ - public static final int PRODUCT_LICENSE_REQUESTED = 1; - - - private int id_; // event identifier - - - /** - Constructs a ProductLiceneEvent object. It uses the specified source and ID. - @param source The object where the event originated. - @param id The event identifier. - **/ - public ProductLicenseEvent(Object source, - int id) - { - super(source); - - if (id < PRODUCT_LICENSE_RELEASED || id > PRODUCT_LICENSE_REQUESTED) - { - throw new ExtendedIllegalArgumentException("id", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - id_ = id; - } - - - /** - Returns the identifier for this event. - @return The identifier for this event. - **/ - public int getID() - { - return id_; - } -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/ProductLicenseListener.java b/cvsroot/src/com/ibm/as400/access/ProductLicenseListener.java deleted file mode 100644 index 78f54168d..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProductLicenseListener.java +++ /dev/null @@ -1,38 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProductLicenseListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; -/** - The ProductLicenseListener interface provides an interface for receiving - ProductLicense events. -**/ - -public interface ProductLicenseListener extends java.util.EventListener -{ - /** - Invoked when a license has been released. - @param event The ProductLicense event. - **/ - public void licenseReleased(ProductLicenseEvent event); - - /** - Invoked when a license has been requested. - @param event The ProductLicense event. - **/ - public void licenseRequested(ProductLicenseEvent event); - -} - - - - diff --git a/cvsroot/src/com/ibm/as400/access/ProductList.java b/cvsroot/src/com/ibm/as400/access/ProductList.java deleted file mode 100644 index 49c47409e..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProductList.java +++ /dev/null @@ -1,373 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProductList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - * Represents a list of licensed products. - * @see com.ibm.as400.access.Product -**/ -public class ProductList -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - private AS400 system_; - private String[] productIDs_ = new String[1]; - private String[] productOptions_ = new String[1]; - private String[] releaseLevels_ = new String[1]; - private int currentProduct_ = 0; - - private String filter_ = PRODUCT_FILTER_ALL; - private String option_ = PRODUCT_OPTION_ALL; - - // Retrieve 1000 products at a time since we don't - // know how many are actually installed on the system - // until we make the first API call. - private int chunkSize_ = 1000; - - - - /** - * Constant representing a list of all products. - **/ - public static final String PRODUCT_FILTER_ALL = "*ALL"; - - /** - * Constant representing a list of all installed products. - **/ - public static final String PRODUCT_FILTER_INSTALLED = "*INSTLD"; - - /** - * Constant representing a list of all installed products and all supported products. - **/ - public static final String PRODUCT_FILTER_INSTALLED_OR_SUPPORTED = "*INSSPT"; - - /** - * Constant representing a list filtered by user-specified criteria. - **/ - public static final String PRODUCT_FILTER_LIST = "*LIST"; - - /** - * Constant representing a list of all supported products. - **/ - public static final String PRODUCT_FILTER_SUPPORTED = "*SUPPTD"; - - - - /** - * Constant representing a list of all product options. - **/ - public static final String PRODUCT_OPTION_ALL = "*ALL"; - - /** - * Constant representing the base product option. - **/ - public static final String PRODUCT_OPTION_BASE = "*BASE"; - - - - /** - * Constructs a ProductList. The system must be set before - * calling {@link #getProducts getProducts()}. - **/ - public ProductList() - { - } - - - /** - * Constructs a ProductList for the specified system. The default product filter is PRODUCT_FILTER_ALL. - * The default product option is PRODUCT_OPTION_ALL. - * @param system The system from which to retrieve the list of products. - **/ - public ProductList(AS400 system) - { - if (system == null) throw new NullPointerException("system"); - system_ = system; - } - - - /** - * Adds a product to the list of products to retrieve when the product - * filter is set to PRODUCT_FILTER_LIST. If the product filter is not set to - * PRODUCT_FILTER_LIST, then the products added via this method are ignored when - * the list of products is retrieved from the system. - * @param productID The product ID, for example: "5722SS1" or "5769JC1". The length must be 7 characters. - * @param productOption The product option. Valid values are: - *
      - *
    • Any valid product option, e.g. "30". - *
    • {@link #PRODUCT_OPTION_BASE PRODUCT_OPTION_BASE} - *
    • {@link #PRODUCT_OPTION_ALL PRODUCT_OPTION_ALL} - *
    - * @param releaseLevel The product release level, for example "V5R1M0" or "V4R5M0". The length must be 6 characters. - * @see #clearProductsToRetrieve - **/ - public void addProductToRetrieve(String productID, String productOption, String releaseLevel) - { - if (productID == null) throw new NullPointerException("productID"); - if (productOption == null) throw new NullPointerException("productOption"); - if (releaseLevel == null) throw new NullPointerException("releaseLevel"); - - String id = productID.toUpperCase().trim(); - if (id.length() != 7) - { - throw new ExtendedIllegalArgumentException("productID", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - String option = productOption.toUpperCase().trim(); - if (!option.equals(PRODUCT_OPTION_BASE) && - !option.equals(PRODUCT_OPTION_ALL)) - { - while (option.length() < 5) - { - option = "0"+option; - } - } - if (option.length() > 5) - { - throw new ExtendedIllegalArgumentException("productOption", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - String level = releaseLevel.toUpperCase().trim(); - if (level.length() != 6) - { - throw new ExtendedIllegalArgumentException("releaseLevel", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - if (currentProduct_ >= productIDs_.length) - { - String[] temp = productIDs_; - int len = temp.length; - int len2 = temp.length*2; - productIDs_ = new String[len2]; - System.arraycopy(temp, 0, productIDs_, 0, len); - temp = productOptions_; - productOptions_ = new String[len2]; - System.arraycopy(temp, 0, productOptions_, 0, len); - temp = releaseLevels_; - releaseLevels_ = new String[len2]; - System.arraycopy(temp, 0, releaseLevels_, 0, len); - } - productIDs_[currentProduct_] = id; - productOptions_[currentProduct_] = option; - releaseLevels_[currentProduct_++] = level; - } - - - /** - * Clears the list of products to retrieve and sets the product filter - * to {@link #PRODUCT_FILTER_ALL PRODUCT_FILTER_ALL}. - * @see #addProductToRetrieve - **/ - public void clearProductsToRetrieve() - { - productIDs_ = new String[1]; - productOptions_ = new String[1]; - releaseLevels_ = new String[1]; - currentProduct_ = 0; - filter_ = PRODUCT_FILTER_ALL; - } - - - /** - * Retrieves the list of products from the system. - * Use {@link #setProductFilter setProductFilter()} and - * {@link #setProductOption setProductOption()} to change the types of - * products that are returned. - * Use {@link #addProductToRetrieve addProductToRetrieve()} to add a - * specific product to retrieve and specify {@link #PRODUCT_FILTER_LIST PRODUCT_FILTER_LIST} - * for the product filter. - * @return The array of Product objects. - **/ - public Product[] getProducts() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (filter_.equals(PRODUCT_FILTER_LIST) && currentProduct_ == 0) - { - if (Trace.traceOn_) - { - Trace.log(Trace.ERROR, "ProductList filter is set to PRODUCT_FILTER_LIST but no products have been added."); - } - throw new ExtendedIllegalArgumentException("filter", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - int ccsid = system_.getCcsid(); - final ConvTable conv = ConvTable.getTable(ccsid, null); - - final ProgramParameter[] parms = new ProgramParameter[6]; - parms[0] = new ProgramParameter(197*chunkSize_); // output list - final byte[] inputInformation = new byte[40]; - BinaryConverter.intToByteArray(chunkSize_, inputInformation, 0); // number of records to return - AS400Text text10 = new AS400Text(10, ccsid, system_); - text10.toBytes("*ALL", inputInformation, 4); // number of products to select - inputInformation[14] = (byte)0xF1; // '1' but it doesn't matter - inputInformation[15] = (byte)0xF1; // '1' but it doesn't matter - text10.toBytes(option_, inputInformation, 16); // product options to display - text10.toBytes(filter_, inputInformation, 26); // product - if (currentProduct_ > 0 && filter_.equals(PRODUCT_FILTER_LIST)) - { - BinaryConverter.intToByteArray(currentProduct_, inputInformation, 36); // records in list - } - // records in list is 0 since we are not using *LIST for the product - - parms[1] = new ProgramParameter(inputInformation); // input information - parms[2] = new ProgramParameter(conv.stringToByteArray("PRDS0200")); // format name - - byte[] inputList = null; - if (currentProduct_ > 0 && filter_.equals(PRODUCT_FILTER_LIST)) - { - inputList = new byte[18*currentProduct_]; - AS400Text text5 = new AS400Text(5, ccsid, system_); - AS400Text text6 = new AS400Text(6, ccsid, system_); - AS400Text text7 = new AS400Text(7, ccsid, system_); - int offset = 0; - for (int i=0; i chunkSize_) - { - // Need to retrieve more. - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "Increasing ProductList chunk size from "+chunkSize_+" to "+numRecords+" and re-retrieving."); - } - chunkSize_ = numRecords; - return getProducts(); - } - - byte[] outputList = parms[0].getOutputData(); - int offset = 0; - Product[] products = new Product[numRecords]; - for (int i=0; i - *
  • {@link #PRODUCT_FILTER_INSTALLED PRODUCT_FILTER_INSTALLED} - *
  • {@link #PRODUCT_FILTER_SUPPORTED PRODUCT_FILTER_SUPPORTED} - *
  • {@link #PRODUCT_FILTER_INSTALLED_OR_SUPPORTED PRODUCT_FILTER_INSTALLED_OR_SUPPORTED} - *
  • {@link #PRODUCT_FILTER_ALL PRODUCT_FILTER_ALL} - *
  • {@link #PRODUCT_FILTER_LIST PRODUCT_FILTER_LIST} - * - * @param filter The product filter. - **/ - public void setProductFilter(String filter) - { - if (filter == null) throw new NullPointerException("filter"); - if (!filter.equals(PRODUCT_FILTER_INSTALLED) && - !filter.equals(PRODUCT_FILTER_SUPPORTED) && - !filter.equals(PRODUCT_FILTER_INSTALLED_OR_SUPPORTED) && - !filter.equals(PRODUCT_FILTER_ALL) && - !filter.equals(PRODUCT_FILTER_LIST)) - { - throw new ExtendedIllegalArgumentException("filter", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - filter_ = filter; - } - - - /** - * Sets the product option used to filter the list. - * Valid values are: - *
      - *
    • {@link #PRODUCT_OPTION_ALL PRODUCT_OPTION_ALL} - *
    • {@link #PRODUCT_OPTION_BASE PRODUCT_OPTION_BASE} - *
    - * @param option The product option. - **/ - public void setProductOption(String option) - { - if (option == null) throw new NullPointerException("option"); - if (!option.equals(PRODUCT_OPTION_ALL) && !option.equals(PRODUCT_OPTION_BASE)) - { - throw new ExtendedIllegalArgumentException("option", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - option_ = option; - } - - - /** - * Sets the system. - * @param system The system. - **/ - public void setSystem(AS400 system) - { - if (system == null) throw new NullPointerException("system"); - - system_ = system; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/ProfileHandleImplNative.java b/cvsroot/src/com/ibm/as400/access/ProfileHandleImplNative.java deleted file mode 100644 index fbd95b6f6..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProfileHandleImplNative.java +++ /dev/null @@ -1,152 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProfileHandleImplNative.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import com.ibm.as400.security.auth.*; - -/** - The ProfileHandleImplNative class provides an implementation for behavior delegated by a ProfileHandleCredential object. - **/ -public class ProfileHandleImplNative implements ProfileHandleImpl -{ - // Note: This class needs to be public, because it's referenced by class com.ibm.as400.security.auth.ProfileHandleCredential - private static final String CLASSNAME = "com.ibm.as400.access.ProfileHandleImplNative"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - private AS400Credential credential_ = null; - static - { - NativeMethods.loadNativeLibraryQyjspart(); - } - - /** - Destroy or clear sensitive information maintained by the credential implementation. -

    Subsequent requests may result in a NullPointerException. -

    Subclasses should override as necessary to destroy or clear class-specific data. - @exception DestroyFailedException If errors occur while destroying or clearing credential implementation data. - **/ - public void destroy() throws DestroyFailedException - { - releaseHandle(((ProfileHandleCredential)getCredential()).getHandle()); - credential_ = null; - if (Trace.isTraceOn()) Trace.log(Trace.INFORMATION, "Credential implementation destroyed >> " + toString()); - } - - // Returns the credential delegating behavior to the implementation object. - // @return The associated credential. - AS400Credential getCredential() - { - return credential_; - } - - /** - Generates and returns a profile handle based on the current thread identity. - @return The handle bytes. - @exception RetrieveFailedException If errors occur while generating the handle. - **/ - public native byte[] getCurrentHandle() throws RetrieveFailedException; - - /** - Returns the number of seconds before the credential is due to expire. -

    Subclasses implementing timed credentials must override. - @return The number of seconds before expiration; zero (0) if already expired or if the credential is not identified as expiring based on time. - @exception RetrieveFailedException If errors occur while retrieving timeout information. - **/ - public int getTimeToExpiration() throws RetrieveFailedException - { - // Profile handles do not expire based on time. - return 0; - } - - /** - Returns the version number for the implementation. -

    Used to ensure the implementation is valid for specific functions. - @return The version number. - **/ - public int getVersion() - { - return 1; // mod 3 - } - - /** - Indicates if the credential is still considered valid for authenticating to associated services or performing related actions. -

    An exception is not thrown on failure to remain consistent with the Refreshable interface (even though some credential classes currently avoid the dependency established by implementing the interface). - @return true if valid; false if not valid or if the operation fails. - **/ - public boolean isCurrent() - { - try - { - return (!getCredential().isTimed() || getTimeToExpiration() > 0); - } - catch (RetrieveFailedException e) - { - Trace.log(Trace.ERROR, "Unable to retrieve credential time to expiration", e); - return false; - } - } - - /** - Updates or extends the validity period for the credential. - @exception RefreshFailedException If the refresh attempt fails. - **/ - public void refresh() throws RefreshFailedException - { - // Never called; credential is not renewable - } - - /** - Releases OS resources for the given profile handle. - @param handle The handle bytes. - @exception DestroyFailedException If errors occur while releasing the handle. - **/ - public native void releaseHandle(byte[] handle) throws DestroyFailedException; - - /** - Sets the credential delegating behavior to the implementation object. - @param credential The associated credential. - **/ - public void setCredential(AS400Credential credential) - { - if (credential == null) - { - Trace.log(Trace.ERROR, "Parameter 'credential' is null."); - throw new NullPointerException("credential"); - } - credential_ = credential; - } - - /** - Sets the current thread identity based on the given profile handle. - @param handle The handle bytes. - @exception SwapFailedException If errors occur while generating the handle. - **/ - public native void setCurrentHandle(byte[] handle) throws SwapFailedException; - - /** - Attempts to swap the thread identity based on this credential. - @param genRtnCr Indicates whether a return credential should be generated, even if supported. When appropriate, not generating a return credential can improve performance and avoid potential problems in creating the credential. - @return A credential capable of swapping back to the original identity; classes not supporting this capability will return null. This value will also be null if genRtnCr is false. - @exception SwapFailedException If errors occur while swapping thread identity. - @exception SecurityException If the caller does not have permission to modify the OS thread identity. - **/ - public AS400Credential swap(boolean genRtnCr) throws SwapFailedException - { - setCurrentHandle(((ProfileHandleCredential)getCredential()).getHandle()); - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ProfileTokenImplNative.java b/cvsroot/src/com/ibm/as400/access/ProfileTokenImplNative.java deleted file mode 100644 index 053a70320..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProfileTokenImplNative.java +++ /dev/null @@ -1,483 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProfieTokenImplNative.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - - -package com.ibm.as400.access; - -import java.util.Random; -import com.ibm.as400.security.auth.*; - -/** - * The ProfileTokenImplNative class provides an implementation for behavior - * delegated by a ProfileTokenCredential object. - **/ -public class ProfileTokenImplNative implements ProfileTokenImpl -{ - // Note: This class needs to be public, because it's referenced by class com.ibm.as400.security.auth.ProfileTokenCredential - private static final String CLASSNAME = "com.ibm.as400.access.ProfileTokenImplNative"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - private AS400Credential credential_ = null; - - static - { - NativeMethods.loadNativeLibraryQyjspart(); - } - - /** - Destroy or clear sensitive information maintained by the credential - implementation. -

    Subsequent requests may result in a NullPointerException. -

    This class will also attempt to remove the associated profile token - from the system. - @exception DestroyFailedException If errors occur while destroying or - clearing credential data. - **/ - public void destroy() throws DestroyFailedException - { - nativeRemoveFromSystem( - ((ProfileTokenCredential)getCredential()).getToken()); - credential_ = null; - if (Trace.isTraceOn()) Trace.log(Trace.INFORMATION, - "Credential implementation destroyed >> " + toString()); - } - - /** - * Generates and returns a new profile token based on - * the provided information. - * - * @deprecated As of V5R3, replaced - * by {@link #generateTokenExtended(String,String,int,int)} - * for password strings - * and {@link #generateToken(String,int,int,int)} - * for password special values. - * - * @param uid - * The name of the user profile for which the token - * is to be generated. - * - * @param pwd - * The user profile password or special value. - * - * @param type - * The type of token. - * Possible types are defined as fields on the - * ProfileTokenCredential class: - *

      - *
    • TYPE_SINGLE_USE - *
    • TYPE_MULTIPLE_USE_NON_RENEWABLE - *
    • TYPE_MULTIPLE_USE_RENEWABLE - *
    - *

    - * - * @param timeoutInterval - * The number of seconds to expiration. - * - * @return - * The token bytes. - * - * @exception RetrieveFailedException - * If errors occur while generating the token. - * - */ - public byte[] generateToken(String uid, String pwd, int type, - int timeoutInterval) throws RetrieveFailedException { - - if (pwd.length() > 10) { - Trace.log(Trace.ERROR, "User profile password exceeds " + - "allowed length"); - throw new ExtendedIllegalArgumentException( - "password", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - return nativeCreateToken( - uid.toUpperCase(), pwd, type, timeoutInterval); - } - - /** - * Generates and returns a new profile token based on - * the provided information using a password special value. - * - * @param uid - * The name of the user profile for which the token - * is to be generated. - * - * @param pwdSpecialValue - * A password special value. - * Possible types are defined as fields on the - * ProfileTokenCredential class: - *

      - *
    • PW_NOPWD - *
    • PW_NOPWDCHK - *
    - *

    - * - * @param type - * The type of token. - * Possible types are defined as fields on the - * ProfileTokenCredential class: - *

      - *
    • TYPE_SINGLE_USE - *
    • TYPE_MULTIPLE_USE_NON_RENEWABLE - *
    • TYPE_MULTIPLE_USE_RENEWABLE - *
    - *

    - * - * @param timeoutInterval - * The number of seconds to expiration. - * - * @return - * The token bytes. - * - * @exception RetrieveFailedException - * If errors occur while generating the token. - * - */ - public byte[] generateToken(String uid, int pwdSpecialValue, int type, - int timeoutInterval) throws RetrieveFailedException { - - // Convert password special value from int to string - String pwdSpecialVal; - switch(pwdSpecialValue) { - case ProfileTokenCredential.PW_NOPWD: - pwdSpecialVal = ProfileTokenImpl.PW_STR_NOPWD; - break; - case ProfileTokenCredential.PW_NOPWDCHK: - pwdSpecialVal = ProfileTokenImpl.PW_STR_NOPWDCHK; - break; - default: - Trace.log(Trace.ERROR, "Password special value = " + - pwdSpecialValue + " is not valid."); - throw new ExtendedIllegalArgumentException( - "password special value", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Call native method and return token bytes - return nativeCreateToken( - uid.toUpperCase(), pwdSpecialVal, type, timeoutInterval); - } - - /** - * Generates and returns a new profile token based on - * the provided information using a password string. - * - * @param uid - * The name of the user profile for which the token - * is to be generated. - * - * @param pwd - * The user profile password (encoded). - * Special values are not supported by this method. - * - * @param type - * The type of token. - * Possible types are defined as fields on the - * ProfileTokenCredential class: - *

      - *
    • TYPE_SINGLE_USE - *
    • TYPE_MULTIPLE_USE_NON_RENEWABLE - *
    • TYPE_MULTIPLE_USE_RENEWABLE - *
    - *

    - * - * @param timeoutInterval - * The number of seconds to expiration. - * - * @return - * The token bytes. - * - * @exception RetrieveFailedException - * If errors occur while generating the token. - * - */ - public byte[] generateTokenExtended(String uid, String pwd, int type, - int timeoutInterval) throws RetrieveFailedException { - - AS400 sys = getCredential().getSystem(); - - ProgramParameter[] parmlist = new ProgramParameter[8]; - - // Output: Profile token. - parmlist[0] = new ProgramParameter( - ProfileTokenCredential.TOKEN_LENGTH); - - // Input: User profile name. Uppercase, get bytes (ccsid 37). - try { - parmlist[1] = new ProgramParameter( - SignonConverter.stringToByteArray(uid.toUpperCase())); - } - catch (AS400SecurityException se) { - throw new RetrieveFailedException(se.getReturnCode()); - } - - // Input: User password. String to char[], char[] to byte[] (unicode). - parmlist[2] = new ProgramParameter( - BinaryConverter.charArrayToByteArray(pwd.toCharArray())); - - // Input: Time out interval. Int to byte[]. - parmlist[3] = new ProgramParameter( - BinaryConverter.intToByteArray(timeoutInterval)); - - // Input: Profile token type. Int to string, get bytes. - parmlist[4] = new ProgramParameter( - CharConverter.stringToByteArray( - sys, new Integer(type).toString())); - - // Input/output: Error code. NULL. - parmlist[5] = new ProgramParameter( - BinaryConverter.intToByteArray(0)); - - // Input: Length of user password. Int to byte[]. - parmlist[6] = new ProgramParameter( - BinaryConverter.intToByteArray( - parmlist[2].getInputData().length)); - - // Input: CCSID of user password. Int to byte[]. Unicode = 13488. - parmlist[7] = new ProgramParameter( - BinaryConverter.intToByteArray(13488)); - - ProgramCall programCall = new ProgramCall(sys); - - try { - programCall.setProgram( - QSYSObjectPathName.toPath( - "QSYS", "QSYGENPT", "PGM"), parmlist); - programCall.suggestThreadsafe(); // Run on-thread if possible; allows app to use disabled profile. - if (!programCall.run()) { - Trace.log(Trace.ERROR, "Call to QSYGENPT failed."); - throw new RetrieveFailedException( - programCall.getMessageList()); - } - } - catch (RetrieveFailedException e) { - throw e; // just rethrow - } - catch (java.io.IOException ioe) { - Trace.log(Trace.ERROR, "Unexpected IOException: ", ioe); - throw new InternalErrorException( - InternalErrorException.UNEXPECTED_EXCEPTION); - } - catch (java.beans.PropertyVetoException pve) { - Trace.log(Trace.ERROR, "Unexpected PropertyVetoException: ", pve); - throw new InternalErrorException( - InternalErrorException.UNEXPECTED_EXCEPTION); - } - catch (InterruptedException ine) { - Trace.log(Trace.ERROR, "Unexpected InterruptedException: ", ine); - throw new InternalErrorException( - InternalErrorException.UNEXPECTED_EXCEPTION); - } - catch (Exception e) { - Trace.log(Trace.ERROR, "Unexpected Exception: ", e); - throw new RetrieveFailedException(); - } - - return parmlist[0].getOutputData(); - } - - // Returns the credential delegating behavior to the implementation - // object. - // @return The associated credential. - AS400Credential getCredential() { - return credential_; - } - - /** - Returns the number of seconds before the credential is due to expire. - @return The number of seconds before expiration; zero (0) if already - expired. - @exception RetrieveFailedException If errors occur while retrieving - timeout information. - **/ - public int getTimeToExpiration() throws RetrieveFailedException { - return nativeGetTimeToExpiration( - ((ProfileTokenCredential)getCredential()).getToken()); - } - - /** - Returns the version number for the implementation. -

    Used to ensure the implementation is valid for specific functions. - @return The version number. - **/ - public int getVersion() { - return 1; // mod 3. - } - - /** - Indicates if the credential is still considered valid for authenticating - to associated services or performing related actions. -

    An exception is not thrown on failure to remain consistent with the - Refreshable interface (even though some credential classes currently - avoid the dependency established by implementing the interface). - @return true if valid; false if not valid or if the operation fails. - **/ - public boolean isCurrent() { - try { - return (!getCredential().isTimed() || getTimeToExpiration()>0); - } - catch (RetrieveFailedException e) { - Trace.log(Trace.ERROR, "Unable to retrieve credential time to " + - "expiration", e); - return false; - } - } - - // Generates and returns a new profile token based on a user profile and - // password special value. - // @param name The name of the user profile for which the token is to - // be generated. - // @param passwordSpecialValue The special value for the user profile - // password. Possible values are: - //

      - //
    • ProfileTokenCredential.PW_NOPWD - //
    • ProfileTokenCredential.PW_NOPWDCHK - //
    - // @param type The type of token. Possible types are defined as fields - // on the ProfileTokenCredential class: - //
      - //
    • ProfileTokenCredential.TYPE_SINGLE_USE - //
    • ProfileTokenCredential.TYPE_MULTIPLE_USE_NON_RENEWABLE - //
    • ProfileTokenCredential.TYPE_MULTIPLE_USE_RENEWABLE - //
    - // @param timeoutInterval The number of seconds to expiration. - // @return The token bytes. - // @exception RetrieveFailedException If errors occur while generating - // the token. - native byte[] nativeCreateToken(String user, String password, int type, - int timeoutInterval) throws RetrieveFailedException; - - // Returns the number of seconds before the credential is due to expire. - // @param token The token bytes. - // @return The number of seconds before expiration. - // @exception RetrieveFailedException If errors occur while retrieving - // timeout information. - native int nativeGetTimeToExpiration(byte[] token) - throws RetrieveFailedException; - - // Updates or extends the validity period for the credential. - // Based on the given token, type and timeoutInterval. - //

    The updated token is stored back into the token parm. - // @param token The token bytes. - // @param type The type of token. Possible types are defined as fields - // on the ProfileTokenCredential class: - //

      - //
    • TYPE_SINGLE_USE - //
    • TYPE_MULTIPLE_USE_NON_RENEWABLE - //
    • TYPE_MULTIPLE_USE_RENEWABLE - //
    - // @param timeoutInterval The number of seconds before expiration. - // @exception RefreshFailedException If errors occur during refresh. - native void nativeRefreshToken(byte[] token, int type, - int timeoutInterval) throws RefreshFailedException; - - // Removes the token from the system. - // Note: The token is actually invalidated instead of being removed to - // improve performance of the operation. - // @param token The token bytes. - // @exception DestroyFailedException If errors occur while removing - // the credential. - native void nativeRemoveFromSystem(byte[] token) - throws DestroyFailedException; - - // Attempt to swap the thread identity based on the given - // profile token. - // @param token The token bytes. - // @exception SwapFailedException If errors occur while swapping - // thread identity. - native void nativeSwap(byte[] token) throws SwapFailedException; - - // Updates or extends the validity period for the credential. - // @exception RefreshFailedException If errors occur during refresh. - public void refresh() throws RefreshFailedException { - // Never called; ProfileTokenCredential relies exclusively on - // refresh(int, int). - } - - /** - Updates or extends the validity period for the credential. -

    Generates a new profile token based on the previously established - token with the given type and timeoutInterval. -

    This method is provided to handle cases where it is desirable to - allow for a more restrictive type of token or a different timeout - interval when a new token is generated during the refresh. - @param type The type of token. Possible types are defined as - fields on the ProfileTokenCredential class: -

      -
    • TYPE_SINGLE_USE -
    • TYPE_MULTIPLE_USE_NON_RENEWABLE -
    • TYPE_MULTIPLE_USE_RENEWABLE -
    - @param timeoutInterval The number of seconds before expiration. - @return The new token. - @exception RefreshFailedException If errors occur during refresh. - **/ - public byte[] refresh(int type, int timeoutInterval) - throws RefreshFailedException { - byte[] token = ((ProfileTokenCredential)getCredential()).getToken(); - // native method will overwrite bytes passed in; create a copy - // to manipulate. - byte[] bytes = new byte[ProfileTokenCredential.TOKEN_LENGTH]; - System.arraycopy(token, 0, bytes, 0, bytes.length); - nativeRefreshToken(bytes, type, timeoutInterval); - return bytes; - } - - /** - Sets the credential delegating behavior to the implementation object. - @param credential The associated credential. - **/ - public void setCredential(AS400Credential credential) { - if (credential == null) { - Trace.log(Trace.ERROR, "Parameter 'credential' is null."); - throw new NullPointerException("credential"); - } - credential_ = credential; - } - - /** - Attempts to swap the thread identity based on this credential. - @param genRtnCr Indicates whether a return credential should be - generated, even if supported. When appropriate, not generating a return - credential can improve performance and avoid potential problems in - creating the credential. - @return A credential capable of swapping back to the original identity; - classes not supporting this capability will return null. This value will - also be null if genRtnCr is false. - @exception SwapFailedException If errors occur while swapping - thread identity. - @exception SecurityException If the caller does not have permission - to modify the OS thread identity. - **/ - public AS400Credential swap(boolean genRtnCr) throws SwapFailedException { - ProfileHandleCredential ph = null; - if (genRtnCr) { - try { - ph = new ProfileHandleCredential(); - ph.setSystem( - ((ProfileTokenCredential)getCredential()).getSystem()); - ph.setHandle(); - } - catch (Exception e) { - Trace.log( - Trace.ERROR, "Unable to obtain current profile handle", e); - } - } - nativeSwap(((ProfileTokenCredential)getCredential()).getToken()); - return ph; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ProfileTokenVault.java b/cvsroot/src/com/ibm/as400/access/ProfileTokenVault.java deleted file mode 100644 index 322e4b1a0..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProfileTokenVault.java +++ /dev/null @@ -1,72 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProfileTokenVault.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2009-2009 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import com.ibm.as400.security.auth.ProfileTokenCredential; -import java.io.Serializable; - -/** - * A vault which holds a profile token. The profile token represents the credentials - * of an IBM i user profile for a system, and can be used for authenticating - * to one or more IBM i host servers on that system. - */ -class ProfileTokenVault extends CredentialVault implements Cloneable, Serializable -{ - /** - * Constructs an ProfileTokenVault object that does not contain a credential - */ - protected ProfileTokenVault() { - super(); - } - - /** - * Constructs an ProfileTokenVault object that contains the provided profile token credential. - * - * @param existingToken The profile token bytes - */ - protected ProfileTokenVault(byte[] existingToken) { - super(existingToken); - } - - /** - * Constructs an ProfileTokenVault object that contains the provided profile token credential. - * - * @param existingCredential The profile token credential. The raw bytes from the profile - * token object are extracted and stored in the vault. - */ - protected ProfileTokenVault(ProfileTokenCredential existingCredential) { - super(); - encodedCredential_ = store(existingCredential.getToken()); - } - - /** - * Returns a copy of this ProfileTokenVault. The new copy will be - * an exact copy of this vault, which means the new copy will - * contain the same profile token credential as this vault. - * - * @return A newly created ProfileTokenVault that is a copy of this one - */ - public Object clone() { - ProfileTokenVault vaultClone = (ProfileTokenVault)super.clone(); - return vaultClone; - } - - /** - * {@inheritDoc} - */ - protected int getType() { - return AS400.AUTHENTICATION_SCHEME_PROFILE_TOKEN; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/ProgramCall.java b/cvsroot/src/com/ibm/as400/access/ProgramCall.java deleted file mode 100644 index 7d9ba7612..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProgramCall.java +++ /dev/null @@ -1,855 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProgramCall.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.Vector; - -/** - The ProgramCall class allows a user to call an IBM i system program, pass parameters to it (input and output), and access data returned in the output parameters after the program runs. Use ProgramCall to call programs. To call service programs, use ServiceProgramCall. -

    The following example demonstrates the use of Program Call: -
    -

    - *    // Call programs on system named "Hal."
    - *    AS400 system = new AS400("Hal");
    - *    ProgramCall program = new ProgramCall(system);
    - *    try
    - *    {
    - *        // Initialize the name of the program to run.
    - *        String programName = "/QSYS.LIB/TESTLIB.LIB/TESTPROG.PGM";
    - *        // Set up the 3 parameters.
    - *        ProgramParameter[] parameterList = new ProgramParameter[3];
    - *        // First parameter is to input a name.
    - *        AS400Text nametext = new AS400Text(8);
    - *        parameterList[0] = new ProgramParameter(nametext.toBytes("John Doe"));
    - *        // Second parameter is to get the answer, up to 50 bytes long.
    - *        parameterList[1] = new ProgramParameter(50);
    - *        // Third parameter is to input a quantity and return a value up to 30 bytes long.
    - *        byte[] quantity = new byte[2];
    - *        quantity[0] = 1;  quantity[1] = 44;
    - *        parameterList[2] = new ProgramParameter(quantity, 30);
    - *        // Set the program name and parameter list.
    - *        program.setProgram(programName, parameterList);
    - *        // Run the program.
    - *        if (program.run() != true)
    - *        {
    - *            // Report failure.
    - *            System.out.println("Program failed!");
    - *            // Show the messages.
    - *            AS400Message[] messagelist = program.getMessageList();
    - *            for (int i = 0; i < messagelist.length; ++i)
    - *            {
    - *                // Show each message.
    - *                System.out.println(messagelist[i]);
    - *            }
    - *        }
    - *        // Else no error, get output data.
    - *        else
    - *        {
    - *            AS400Text text = new AS400Text(50);
    - *            System.out.println(text.toObject(parameterList[1].getOutputData()));
    - *            System.out.println(text.toObject(parameterList[2].getOutputData()));
    - *        }
    - *    }
    - *    catch (Exception e)
    - *    {
    - *        System.out.println("Program " + program.getProgram() + " issued an exception!");
    - *        e.printStackTrace();
    - *    }
    - *    // Done with the system.
    - *    system.disconnectAllServices();
    - 
    -

    NOTE: When getting the AS400Message list from programs, users no longer have to create a MessageFile to obtain the program help text. The load() method can be used to retrieve additional message information. Then the getHelp() method can be called directly on the AS400Message object returned from getMessageList(). Here is an example: -

    - *    if (program.run("myPgm", myParmList) != true)
    - *    {
    - *        // Show messages.
    - *        AS400Message[] messageList = program.getMessageList();
    - *        for (int i = 0; i < messageList.length; ++i)
    - *        {
    - *            // Show each message.
    - *            System.out.println(messageList[i].getText());
    - *            // Load additional message information.
    - *            messageList[i].load();
    - *            //Show help text.
    - *            System.out.println(messageList[i].getHelp());
    - *        }
    - *    }
    - 
    -

    NOTE: When the program runs within the host server job, the library list will be the initial library list specified in the job description in the user profile. - @see ProgramParameter - @see AS400Message - @see ServiceProgramCall - **/ -public class ProgramCall implements Serializable -{ - private static final String CLASSNAME = "com.ibm.as400.access.ProgramCall"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - static final long serialVersionUID = 4L; - - // Constants that indicate how thread safety is specified/determined. - private static final int UNSPECIFIED = 0; - // property not specified; setThreadSafe() not called - private static final int SPECIFIED_BY_PROPERTY = 1; - // property was set - private static final int SPECIFIED_BY_SETTER = 2; - // setThreadSafe() was called - - static final Boolean THREADSAFE_TRUE = CommandCall.THREADSAFE_TRUE; - static final Boolean THREADSAFE_FALSE = CommandCall.THREADSAFE_FALSE; - - // Note: The following fields are package-scoped, to allow access by subclass ServiceProgramCall. - - // The system where the program is located. - AS400 system_ = null; - // The full IFS path name of the program. - String program_ = ""; - // The library that contains the program. - String library_ = ""; - // The name of the program. - String name_ = ""; - // Program parameters. - ProgramParameter[] parameterList_ = new ProgramParameter[0]; - // The messages returned by the program. - AS400Message[] messageList_ = new AS400Message[0]; - - // Thread safety of program. - transient Boolean threadSafetyValue_ = THREADSAFE_FALSE; // never null; there is no "lookup" for API's - - // The following field is needed in order to preserve cross-release serializability between JTOpen 6.4 and later releases. - // Thread safety of program. - boolean threadSafety_ = false; // must be kept in sync with threadSafetyValue_ - - // How thread safety was determined. - private int threadSafetyDetermined_ = UNSPECIFIED; - - // The number of messages to retrieve. - int messageOption_ = AS400Message.MESSAGE_OPTION_UP_TO_10; // Default for compatibility. - - // Implementation object shared with command call, interacts with server or native methods. - transient RemoteCommandImpl impl_ = null; - - // List of action completed event bean listeners. - transient Vector actionCompletedListeners_ = null; // Set on first add. - // List of property change event bean listeners. - transient PropertyChangeSupport propertyChangeListeners_ = null; // Set on first add. - // List of vetoable change event bean listeners. - transient VetoableChangeSupport vetoableChangeListeners_ = null; // Set on first add. - - /** - Constructs a ProgramCall object. The system, program, and parameters must be set before using any method requiring a connection to the system. - **/ - public ProgramCall() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing ProgramCall object."); - checkThreadSafetyProperty(); - } - - /** - Constructs a ProgramCall object. It uses the specified system. The program and parameters must be provided later. - @param system The system on which to run the program. - **/ - public ProgramCall(AS400 system) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing ProgramCall object, system: " + system); - if (system == null) { - throw new NullPointerException("system"); - } - - system_ = system; - checkThreadSafetyProperty(); - } - - /** - Constructs a program call object. It uses the specified system, program name, and parameter list. - @param system The system on which to run the program. - @param program The program name as a fully qualified path name in the library file system. The library and program name must each be 10 characters or less. - @param parameterList A list of up to 35 parameters with which to run the program. - **/ - public ProgramCall(AS400 system, String program, ProgramParameter[] parameterList) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing ProgramCall object, system: " + system + " program: " + program); - if (system == null) { - throw new NullPointerException("system"); - } - - system_ = system; - checkThreadSafetyProperty(); - - try - { - setProgram(program, parameterList); - } - catch (PropertyVetoException e) - { - Trace.log(Trace.ERROR, "Unexpected PropertyVetoException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Adds an ActionCompletedListener. The specified ActionCompletedListener's actionCompleted method will be called each time a program has run. The ActionCompletedListener object is added to a list of ActionCompletedListeners managed by this ProgramCall. It can be removed with removeActionCompletedListener. - @param listener The listener object. - **/ - public void addActionCompletedListener(ActionCompletedListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding action completed listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (actionCompletedListeners_ == null) - { - actionCompletedListeners_ = new Vector(); - } - actionCompletedListeners_.addElement(listener); - } - } - - /** - Adds a ProgramParameter to the parameter list. - @param parameter The ProgramParameter. - @exception PropertyVetoException If the change is vetoed. - **/ - public void addParameter(ProgramParameter parameter) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding parameter to parameter list."); - if (parameter == null) { - throw new NullPointerException("parameter"); - } - - int oldLength = parameterList_.length; - ProgramParameter[] newParameterList = new ProgramParameter[oldLength + 1]; - System.arraycopy(parameterList_, 0, newParameterList, 0, oldLength); - newParameterList[oldLength] = parameter; - setParameterList(newParameterList); - } - - /** - Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method will be called each time the value of any bound property is changed. The PropertyChangeListener object is added to a list of PropertyChangeListeners managed by this ProgramCall. It can be removed with removePropertyChangeListener. - @param listener The listener object. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Adds a VetoableChangeListener. The specified VetoableChangeListener's vetoableChange method will be called each time the value of any constrained property is changed. - @param listener The listener object. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - } - - // Chooses the appropriate implementation, synchronize to protect impl_ object. - synchronized void chooseImpl() throws AS400SecurityException, IOException - { - if (system_ != null) system_.signon(false); - if (impl_ == null) - { - if (system_ == null) - { - /* - if (AS400.onAS400) - { - impl_ = (RemoteCommandImpl)AS400.loadImpl("com.ibm.as400.access.RemoteCommandImplNative"); - if (impl_ != null) return; - }*/ - Trace.log(Trace.ERROR, "Attempt to connect to command server before setting system." ); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - impl_ = (RemoteCommandImpl)system_.loadImpl3("com.ibm.as400.access.RemoteCommandImplNative", "com.ibm.as400.access.RemoteCommandImplRemote", "com.ibm.as400.access.RemoteCommandImplProxy"); - impl_.setSystem(system_.getImpl()); - } - } - - // Fires the action completed event. - void fireActionCompleted() - { - Vector targets = (Vector)actionCompletedListeners_.clone(); - ActionCompletedEvent event = new ActionCompletedEvent(this); - for (int i = 0; i < targets.size(); ++i) - { - ActionCompletedListener target = (ActionCompletedListener)targets.elementAt(i); - target.actionCompleted(event); - } - } - - // Removed this obsolete method. Deprecated on 2003-01-22. -// /** -// Returns an RJob object which represents the server job in which the program will be run. The information contained in the RJob object is invalidated by AS400.disconnectService() or AS400.disconnectAllServices(). -//
    Typical uses include: -//
    (1) before run() to identify the job before calling the program; -//
    (2) after run() to see what job the program ran under (to identify the job log, for example). -//

    Note: This method is not supported in the Toolbox proxy environment. -// @return The job in which the program will be run. -// @exception AS400SecurityException If a security or authority error occurs. -// @exception ErrorCompletingRequestException If an error occurs before the request is completed. -// @exception IOException If an error occurs while communicating with the system. -// @exception InterruptedException If this thread is interrupted. -// @deprecated Use getServerJob() instead. -// **/ -// public RJob getJob() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException -// { -// if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting job."); -// chooseImpl(); -// String jobInfo = impl_.getJobInfo(threadSafetyValue_); -// if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing RJob for job: " + jobInfo); -// // Contents of the "job information" string: The name of the user job that the thread is associated with. The format of the job name is a 10-character simple job name, a 10-character user name, and a 6-character job number. -// return new RJob(system_, jobInfo.substring(0, 10).trim(), jobInfo.substring(10, 20).trim(), jobInfo.substring(20, 26).trim()); -// } - - /** - Returns the list of messages returned from running the program. It will return an empty list if the program has not been run yet or if there are no messages. - @return The array of messages returned by the program. - **/ - public AS400Message[] getMessageList() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting message list."); - return messageList_; - } - - /** - Returns the option for how many messages will be retrieved. - @return A constant indicating how many messages will be retrieved. Valid values are: -

      -
    • {@link AS400Message#MESSAGE_OPTION_UP_TO_10 MESSAGE_OPTION_UP_TO_10} -
    • {@link AS400Message#MESSAGE_OPTION_NONE MESSAGE_OPTION_NONE} -
    • {@link AS400Message#MESSAGE_OPTION_ALL MESSAGE_OPTION_ALL} -
    - **/ - public int getMessageOption() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting message option:", messageOption_); - return messageOption_; - } - - /** - Returns the list of parameters. It will return an empty list if not previously set. - @return The list of parameters. - **/ - public ProgramParameter[] getParameterList() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting parameter list."); - return parameterList_; - } - - /** - Returns the integrated file system pathname for the program. It will return an empty string ("") if not previously set. - @return The integrated file system pathname for the program. - **/ - public String getProgram() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting program: " + program_); - return program_; - } - - /** - Returns a Job object which represents the server job in which the program will be run. - The information contained in the Job object is invalidated by AS400.disconnectService() or AS400.disconnectAllServices(). -
    Typical uses include: -
    (1) before run() to identify the job before calling the program; -
    (2) after run() to see what job the program ran under (to identify the job log, for example). -

    Note: This method is not supported in the Toolbox proxy environment. - @return The job in which the program will be run. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - **/ - public Job getServerJob() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting job."); - chooseImpl(); - String jobInfo = impl_.getJobInfo(threadSafetyValue_); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing Job for job: " + jobInfo); - // Contents of the "job information" string: The name of the user job that the thread is associated with. The format of the job name is a 10-character simple job name, a 10-character user name, and a 6-character job number. - return new Job(system_, jobInfo.substring(0, 10).trim(), jobInfo.substring(10, 20).trim(), jobInfo.substring(20, 26).trim()); - } - - /** - Returns the system on which the program is to be run. - @return The system on which the program is to be run. If the system has not been set, null is returned. - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - /** - Returns the thread on which the program would be run, if it were to be called on-thread. Returns null if either: -

      -
    • The client is communicating with the system through sockets. -
    • The program has not been marked as thread safe. -
    - @return The thread on which the program would be run. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public Thread getSystemThread() throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system thread."); - chooseImpl(); - Thread currentThread = impl_.isNative() ? Thread.currentThread() : null; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "System thread: " + currentThread); - return currentThread; - } - - static String getThreadSafetyProperty() - { - String val = SystemProperties.getProperty(SystemProperties.PROGRAMCALL_THREADSAFE); - return (val == null || val.length()==0 ? null : val.toLowerCase()); - } - - static Boolean getDefaultThreadSafety() - { - return new Boolean(getThreadSafetyProperty()); - } - - // Check thread safety system property. - private void checkThreadSafetyProperty() - { - String property = getThreadSafetyProperty(); - if (property == null) // Property not set. - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Thread safe system property not set, thread safety property remains unspecified."); - } - else - { - threadSafetyValue_ = (property.equals("true") ? THREADSAFE_TRUE : THREADSAFE_FALSE); - threadSafety_ = (THREADSAFE_TRUE.equals(threadSafetyValue_)); - threadSafetyDetermined_ = SPECIFIED_BY_PROPERTY; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Thread safe system property: " + property); - } - } - - /** - Indicates whether or not the program will actually get run on the current thread. -
    Note: If the program is run on-thread, it will run in a different job than if it were run off-thread. - @return true if the program will be run on the current thread; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - **/ - public boolean isStayOnThread() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if program will actually get run on the current thread."); - chooseImpl(); - boolean isStayOnThread = ((THREADSAFE_TRUE.equals(threadSafetyValue_)) && - impl_.isNative()); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Will program actually get run on the current thread:", isStayOnThread); - return isStayOnThread; - } - - /** - Indicates whether or not the program will be assumed thread-safe, according to the settings specified by setThreadSafe() or the com.ibm.as400.access.ProgramCall.threadSafe property. -
    Note: If the program is run on-thread, it will run in a different job than if it were run off-thread. - @return true if the program will be assumed thread-safe; false otherwise. - @deprecated The name of this method is misleading. Use {@link #isStayOnThread isStayOnThread()} instead. - **/ - public boolean isThreadSafe() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if program will be assumed thread-safe."); - return threadSafetyValue_.booleanValue(); - } - - // Deserializes and initializes the transient data. - private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "De-serializing ProgramCall object."); - in.defaultReadObject(); - - // impl_ remains null. - // actionCompletedListeners_ remains null. - // propertyChangeListeners_ remains null. - // vetoableChangeListeners_ remains null. - - // See how we determined this object's thread-safety before it was serialized. - if (threadSafetyDetermined_ == SPECIFIED_BY_SETTER) - { - threadSafetyValue_ = (threadSafety_ == true ? THREADSAFE_TRUE : THREADSAFE_FALSE); - } - else // Not specified by 'set' method. - { - // This object was serialized when its thread-safe behavior was determined by a system property (that is, not explicitly specified by setThreadSafe()). This property may have since changed, and we must honor the current local property value. - String property = getThreadSafetyProperty(); - if (property == null) // Property is not set. - { - threadSafetyValue_ = THREADSAFE_FALSE; - threadSafetyDetermined_ = UNSPECIFIED; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Thread safe system property not set, thread safety property changed to unspecified."); - } - else // Property is set. - { - threadSafetyValue_ = (property.equals("true") ? THREADSAFE_TRUE : THREADSAFE_FALSE); - threadSafetyDetermined_ = SPECIFIED_BY_PROPERTY; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Thread safe system property: " + property); - } - threadSafety_ = (THREADSAFE_TRUE.equals(threadSafetyValue_)); - } - } - - /** - Removes the ActionCompletedListener. If the ActionCompletedListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removeActionCompletedListener(ActionCompletedListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing action completed listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - // If we have listeners. - if (actionCompletedListeners_ != null) - { - actionCompletedListeners_.removeElement(listener); - } - } - - /** - Removes the PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes the VetoableChangeListener. If the VetoableChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - // If we have listeners. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - /** - Runs the program on the system. The program and parameter list need to be set prior to this call. - @return true if program ran successfully; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean run() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "Running program: " + program_); - if (program_.length() == 0) - { - Trace.log(Trace.ERROR, "Attempt to run before setting program."); - throw new ExtendedIllegalStateException("program", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Validate that all the program parameters have been set. - for (int i = 0; i < parameterList_.length; ++i) - { - if (parameterList_[i] == null) - { - throw new ExtendedIllegalArgumentException("parameterList[" + i + "] (" + parameterList_[i] + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - chooseImpl(); - - // Run the program. - try - { - boolean result = impl_.runProgram(library_, name_, parameterList_, threadSafetyValue_, messageOption_); - // Retrieve the messages. - messageList_ = impl_.getMessageList(); - // Set our system object into each of the messages. - if (system_ != null) - { - for (int i = 0; i < messageList_.length; ++i) - { - messageList_[i].setSystem(system_); - } - } - - // Fire action completed event. - if (actionCompletedListeners_ != null) fireActionCompleted(); - return result; - } - catch (ObjectDoesNotExistException e) - { - // Retrieve the messages. - messageList_ = impl_.getMessageList(); - // Set our system object into each of the messages. - if (system_ != null) - { - for (int i = 0; i < messageList_.length; ++i) - { - messageList_[i].setSystem(system_); - } - } - throw e; - } - } - - /** - Sets the program name and the parameter list and runs the program on the system. - @param program The fully qualified integrated file system path name to the program. The library and program name must each be 10 characters or less. - @param parameterList The list of parameters with which to run the program. - @return true if program ran successfully, false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @exception PropertyVetoException If a change is vetoed. - **/ - public boolean run(String program, ProgramParameter[] parameterList) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException, PropertyVetoException - { - setProgram(program, parameterList); - return run(); - } - - /** - Sets the list of parameters to pass to the program. - @param parameterList A list of up to 35 parameters with which to run the program. - @exception PropertyVetoException If a change is vetoed. - **/ - public void setParameterList(ProgramParameter[] parameterList) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting parameter list."); - if (parameterList == null) { - throw new NullPointerException("parameterList"); - } - else if (parameterList.length > 35) - { - Trace.log(Trace.ERROR, "Parameter list length exceeds limit of 35 parameters:", parameterList.length); - throw new ExtendedIllegalArgumentException("parameterList.length (" + parameterList.length + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - ProgramParameter[] oldValue = parameterList_; - ProgramParameter[] newValue = parameterList; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("parameterList", oldValue, newValue); - } - parameterList_ = newValue; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("parameterList", oldValue, newValue); - } - } - - /** - Sets the path name of the program and the parameter list. - @param program The fully qualified integrated file system path name to the program. The library and program name must each be 10 characters or less. - @param parameterList A list of up to 35 parameters with which to run the program. - @exception PropertyVetoException If a change is vetoed. - **/ - public void setProgram(String program, ProgramParameter[] parameterList) throws PropertyVetoException - { - // Validate and set program. - setProgram(program); - // Validate and set parmlist. - setParameterList(parameterList); - } - - /** - Sets the path name of the program. - @param program The fully qualified integrated file system path name to the program. The library and program name must each be 10 characters or less. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setProgram(String program) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting program: " + program); - if (program == null) { - throw new NullPointerException("program"); - } - if (Trace.traceOn_ && program.length() == 0) - { - Trace.log(Trace.WARNING, "Parameter 'program' is has length of 0."); - } - // Verify program is valid IFS path name. - QSYSObjectPathName ifs = new QSYSObjectPathName(program, "PGM"); - - String oldValue = program_; - String newValue = program; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("program", oldValue, newValue); - } - library_ = ifs.getLibraryName(); - name_ = ifs.getObjectName(); - program_ = newValue; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("program", oldValue, newValue); - } - } - - /** - Specifies the option for how many messages should be retrieved. By default, to preserve compatability, only the messages sent to the program caller and only up to ten messages are retrieved. This property will only take affect on systems that support the new option. - @param messageOption A constant indicating how many messages to retrieve. Valid values are: -
      -
    • AS400Message.MESSAGE_OPTION_UP_TO_10 -
    • AS400Message.MESSAGE_OPTION_NONE -
    • AS400Message.MESSAGE_OPTION_ALL -
    - **/ - public void setMessageOption(int messageOption) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting message option:", messageOption); - // Validate the messageOption parameter. - if (messageOption < 0 || messageOption > 2) - { - throw new ExtendedIllegalArgumentException("messageOption (" + messageOption + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - messageOption_ = messageOption; - } - - /** - Sets the system to run the program. The system cannot be changed once a connection is made to the system. - @param system The system on which to run the program. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem(AS400 system) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system: " + system); - if (system == null) { - throw new NullPointerException("system"); - } - if (impl_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - AS400 oldValue = system_; - AS400 newValue = system; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("system", oldValue, newValue); - } - system_ = newValue; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("system", oldValue, newValue); - } - } - - /** - Specifies whether or not the program should be assumed thread-safe. The default is false. -
    Note: This method has no effect if the Java application is running remotely, that is, is not running "natively" on an IBM i system. When running remotely, the Toolbox submits all program calls through the Remote Command Host Server, regardless of the value of the threadSafe attribute. -
    Note: This method does not modify the actual program object on the system. -
    Note: If the program is run on-thread, it will run in a different job than if it were run off-thread. - @param threadSafe true if the program should be assumed to be thread-safe; false otherwise. - **/ - public void setThreadSafe(boolean threadSafe) - { - // Note to maintenance programmer: - // Currently all host server jobs are single-threaded. If that ever changes, then we'll need to communicate the threadsafety of the called program to the host server. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting thread safe: " + threadSafe); - Boolean newValue = (threadSafe ? THREADSAFE_TRUE : THREADSAFE_FALSE); - - if (propertyChangeListeners_ != null) - { - Boolean oldValue = threadSafetyValue_; - propertyChangeListeners_.firePropertyChange ("threadSafe", oldValue, newValue); - } - - threadSafetyValue_ = newValue; - threadSafety_ = threadSafe; - threadSafetyDetermined_ = SPECIFIED_BY_SETTER; - } - - /** - Specifies that the called program should be assumed to be thread-safe. - If the system property com.ibm.as400.access.ProgramCall.threadSafe has been set, - this method does nothing. - **/ - public void suggestThreadsafe() - { - // Note: Unlike with CL commands, there's no way for us to lookup the threadsafety of an API. - if (getThreadSafetyProperty() == null) - { - setThreadSafe(true); - } - } - - /** - Returns the string representation of this program call object. - @return The string representing this program call object. - **/ - public String toString() - { - return "ProgramCall (system: " + system_ + " program: " + program_ + "):" + super.toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ProgramCall16.gif b/cvsroot/src/com/ibm/as400/access/ProgramCall16.gif deleted file mode 100644 index 71bf94d25..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/ProgramCall16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/ProgramCall32.gif b/cvsroot/src/com/ibm/as400/access/ProgramCall32.gif deleted file mode 100644 index f8581ce3e..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/ProgramCall32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/ProgramCallBeanInfo.java b/cvsroot/src/com/ibm/as400/access/ProgramCallBeanInfo.java deleted file mode 100644 index 115b1fc95..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProgramCallBeanInfo.java +++ /dev/null @@ -1,156 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: ProgramCallBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - The ProgramCallBeanInfo class provides bean information for the ProgramCall class. - **/ -public class ProgramCallBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Class this bean info represents. - private static final Class BEAN_CLASS = ProgramCall.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - EventSetDescriptor actionCompleted = new EventSetDescriptor(BEAN_CLASS, "actionCompleted", ActionCompletedListener.class, "actionCompleted"); - actionCompleted.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_ACTION_COMPLETED")); - actionCompleted.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_ACTION_COMPLETED")); - - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - - eventSetDescriptors = new EventSetDescriptor[] { actionCompleted, propertyChange, vetoableChange }; - - PropertyDescriptor program = new PropertyDescriptor("program", BEAN_CLASS); - program.setBound(true); - program.setConstrained(true); - program.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_PROGRAM")); - program.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_PROGRAM")); - - PropertyDescriptor parameterList = new PropertyDescriptor("parameterList", BEAN_CLASS); - parameterList.setBound(true); - parameterList.setConstrained(true); - parameterList.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_PARMLIST")); - parameterList.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_PARMLIST")); - - PropertyDescriptor system = new PropertyDescriptor("system", BEAN_CLASS); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - - PropertyDescriptor threadSafe = new PropertyDescriptor("threadSafe", BEAN_CLASS); - threadSafe.setBound(true); - threadSafe.setConstrained(false); - // Note: We share some names/descriptions with CommandCall. - threadSafe.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_CMD_THREADSAFE")); - threadSafe.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_CMD_THREADSAFE")); - - propertyDescriptors = new PropertyDescriptor[] { program, parameterList, system, threadSafe }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return Zero (0), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "actionCompleted" event. - return 0; - } - - /** - Returns the index of the default property. - @return Zero (0), the index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // The index for the "program" property. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("ProgramCall16.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("ProgramCall32.gif"); - } - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ProgramParameter.java b/cvsroot/src/com/ibm/as400/access/ProgramParameter.java deleted file mode 100644 index b57fb3108..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProgramParameter.java +++ /dev/null @@ -1,434 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProgramParameter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; - -/** - Used with {@link ProgramCall ProgramCall} and {@link ServiceProgramCall ServiceProgramCall} to pass parameter data, either to a program, from a program, or both. Input data is passed to a program as a byte array with {@link #setInputData setInputData()}. Output data is requested from a program by specifying the amount of data to return with {@link #setOutputDataLength setOutputDataLength()}. To get the output data once the program has run, use {@link #getOutputData getOutputData()}. These values may also be set on the constructor. - **/ -public class ProgramParameter implements Serializable -{ - static final long serialVersionUID = 4L; - - /** - Constant indicating parameter data is passed by value. (This is the default.) - **/ - public static final int PASS_BY_VALUE = 1; - - /** - Constant indicating parameter data is passed by reference. - **/ - public static final int PASS_BY_REFERENCE = 2; - - // Valid values for parameter usage. - static final int NULL = 0xFF; - static final int INPUT = 1; - static final int OUTPUT = 2; - static final int INOUT = 3; - - // Variable representing the type of the service program parameter. - private int parameterType_ = PASS_BY_VALUE; - - // Parameter data. - private boolean nullParameter_ = true; - private byte[] inputData_ = null; - private int outputDataLength_ = 0; - private byte[] outputData_ = null; - - // Temporary variables to hold information needed to put parameter on datastream. - // These are transient to prevent increasing serialized size. - // Values only valid during datastream construction. - transient int length_ = 0; // Byte length of parameter information. - transient int maxLength_ = 0; // Max length of input and output data. - transient int usage_ = 0; // Parameter usage: in, out, inout & 0-truncation, RLE. - transient byte[] compressedInputData_ = null; // Input data compressed. - - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_; - // List of vetoable change event bean listeners. - private transient VetoableChangeSupport vetoableChangeListeners_; - - /** - Constructs a ProgramParameter object. - **/ - public ProgramParameter() - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Constructing ProgramParameter object."); - } - - /** - Constructs a ProgramParameter object. An input parameter is created since a byte array containing parameter data is passed on this constructor. - @param inputData The parameter data to be used as input to the program. - **/ - public ProgramParameter(byte[] inputData) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Constructing ProgramParameter object, input data:", inputData); - nullParameter_ = false; - inputData_ = inputData; - } - - /** - Constructs a ProgramParameter object. An output parameter is created, since the size of the output data is passed on this constructor. - @param outputDataLength The amount of data to be returned from the program (number of bytes). - **/ - public ProgramParameter(int outputDataLength) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Constructing ProgramParameter object, output data length:", outputDataLength); - if (outputDataLength < 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'outputDataLength' is not valid:", outputDataLength); - throw new ExtendedIllegalArgumentException("outputDataLength (" + outputDataLength + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - nullParameter_ = false; - outputDataLength_ = outputDataLength; - } - - /** - Constructs ProgramParameter object. A parameter that is both an input and an output parameter is created, since both data passed to the program and the amount of data returned from the program are passed on this constructor. - @param inputData Parameter data passed to the program. - @param outputDataLength The amount of data to be returned from the program (number of bytes). - **/ - public ProgramParameter(byte[] inputData, int outputDataLength) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Constructing ProgramParameter object, output data length: " + outputDataLength + " input data:", inputData); - if (outputDataLength < 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'outputDataLength' is not valid:", outputDataLength); - throw new ExtendedIllegalArgumentException("outputDataLength (" + outputDataLength + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - nullParameter_ = false; - inputData_ = inputData; - outputDataLength_ = outputDataLength; - } - - /** - Constructs a ProgramParameter object. An input parameter is created, since a byte array containing parameter data is passed on this constructor. The type indicates if the data is pass by reference or pass by value. The type attribute is used by ServiceProgramCall. - @param parameterType The type of parameter. - Valid values are {@link #PASS_BY_VALUE PASS_BY_VALUE} and {@link #PASS_BY_REFERENCE PASS_BY_REFERENCE}. The default is PASS_BY_VALUE. - @param inputData The parameter data to be used as input to the program. - **/ - public ProgramParameter(int parameterType, byte[] inputData) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Constructing ProgramParameter object, service program parameter type: " + parameterType + " input data:", inputData); - if (parameterType < PASS_BY_VALUE || parameterType > PASS_BY_REFERENCE) - { - Trace.log(Trace.ERROR, "Value of parameter 'parameterType' is not valid:", parameterType); - throw new ExtendedIllegalArgumentException("parameterType (" + parameterType + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - parameterType_ = parameterType; - nullParameter_ = false; - inputData_ = inputData; - } - - /** - Constructs a ProgramParameter object. An output parameter is created, since the size of the output data is passed on this constructor. The type indicates if the data is pass by reference or pass by value. The type attribute is used by ServiceProgramCall. - @param parameterType The type of parameter. - Valid values are {@link #PASS_BY_VALUE PASS_BY_VALUE} and {@link #PASS_BY_REFERENCE PASS_BY_REFERENCE}. The default is PASS_BY_VALUE. - @param outputDataLength The amount of data to be returned from the program (number of bytes). - **/ - public ProgramParameter(int parameterType, int outputDataLength) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Constructing ProgramParameter object, service program parameter type: " + parameterType + " output data length:", outputDataLength); - if (parameterType < PASS_BY_VALUE || parameterType > PASS_BY_REFERENCE) - { - Trace.log(Trace.ERROR, "Value of parameter 'parameterType' is not valid:", parameterType); - throw new ExtendedIllegalArgumentException("parameterType (" + parameterType + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (outputDataLength < 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'outputDataLength' is not valid:", outputDataLength); - throw new ExtendedIllegalArgumentException("outputDataLength (" + outputDataLength + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - parameterType_ = parameterType; - nullParameter_ = false; - outputDataLength_ = outputDataLength; - } - - /** - Constructs ProgramParameter object. A parameter that is both an input and an output parameter is created, since both data passed to the program and the amount of data returned from the program are passed on this constructor. The type indicates if the data is pass by reference or pass by value. The type attribute is used by ServiceProgramCall. - @param parameterType The type of parameter. - Valid values are {@link #PASS_BY_VALUE PASS_BY_VALUE} and {@link #PASS_BY_REFERENCE PASS_BY_REFERENCE}. The default is PASS_BY_VALUE. - @param inputData The parameter data to be used as input to the program. - @param outputDataLength The amount of data to be returned from the program (number of bytes). - **/ - public ProgramParameter(int parameterType, byte[] inputData, int outputDataLength) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Constructing ProgramParameter object, service program parameter type: " + parameterType + " output data length: " + outputDataLength + " input data:", inputData); - if (parameterType < PASS_BY_VALUE || parameterType > PASS_BY_REFERENCE) - { - Trace.log(Trace.ERROR, "Value of parameter 'parameterType' is not valid:", parameterType); - throw new ExtendedIllegalArgumentException("parameterType (" + parameterType + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (outputDataLength < 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'outputDataLength' is not valid:", outputDataLength); - throw new ExtendedIllegalArgumentException("outputDataLength (" + outputDataLength + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - parameterType_ = parameterType; - nullParameter_ = false; - inputData_ = inputData; - outputDataLength_ = outputDataLength; - } - - /** - Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method will be called each time the value of any bound property is changed. The PropertyListener object is added to a list of PropertyChangeListeners managed by this ProgramParameter. It can be removed with removePropertyChangeListener. - @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - - /** - Adds a VetoableChangeListener. The specified VetoableChangeListeners vetoableChange method will be called each time the value of any constrained property is changed. - @param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - - // Returns the parameter max length. This is the maximum of the input data length and the output data length. - // @return The parameter max length (number of bytes). - int getMaxLength() - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Getting max length."); - int maxLength = (inputData_ == null) ? outputDataLength_ : Math.max(inputData_.length, outputDataLength_); - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Max length:", maxLength); - return maxLength; - } - - /** - Returns the parameter data that will be sent to the program. Null is returned if the input data has not been set. - @return The parameter data to be used as input to the program. - **/ - public byte[] getInputData() - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Getting input data:", inputData_); - return inputData_; - } - - /** - Returns the parameter data that has been received from the program. Null is returned if this parameter is an input parameter. Null is also returned before the program is called. - @return The output data returned from the program. - **/ - public byte[] getOutputData() - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Getting output data."); - return outputData_; - } - - /** - Returns the output parameter data length. - @return The amount of data to be returned from the program (number of bytes). - **/ - public int getOutputDataLength() - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Getting output data length:", outputDataLength_); - return outputDataLength_; - } - - /** - Returns the program parameter type. The type indicates if data is passed by reference or passed by value. The type attribute is used by ServiceProgramCall. - @return The program parameter type. The type is one of the following: -
      -
    • {@link #PASS_BY_VALUE PASS_BY_VALUE} - The parameter is passed as data. -
    • {@link #PASS_BY_REFERENCE PASS_BY_REFERENCE} - The parameter is passed as a reference. -
    - **/ - public int getParameterType() - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Getting parameter type:", parameterType_); - return parameterType_; - } - - // Returns the parameter usage. - int getUsage() - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Getting parameter usage."); - int usage = nullParameter_ ? NULL : outputDataLength_ == 0 ? INPUT : inputData_ == null ? OUTPUT : INOUT; - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Parameter usage:", usage); - return usage; - } - - /** - Indicates if this object represents a null parameter. - @return true if the parameter is null; false otherwise. - **/ - public boolean isNullParameter() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if null parameter:", nullParameter_); - return nullParameter_; - } - - // Deserialize and initialize transient data. - private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "De-serializing ProgramParameter object."); - in.defaultReadObject(); - -// propertyChangeListeners_ = new PropertyChangeSupport(this); -// vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - - /** - Removes this PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done. - @param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - if (propertyChangeListeners_ != null) propertyChangeListeners_.removePropertyChangeListener(listener); - } - - /** - Removes this VetoableChangeListener. If the VetoableChangeListener is not on the list, nothing is done. - @param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - if (vetoableChangeListeners_ != null) vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - - /** - Sets the parameter data that will be sent to the program. - @param inputData The parameter data to be used as input to the program. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setInputData(byte[] inputData) throws PropertyVetoException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Setting input data:", inputData); - byte[] oldValue = inputData_; - byte[] newValue = inputData; - if (vetoableChangeListeners_ != null) vetoableChangeListeners_.fireVetoableChange("inputData", oldValue, newValue); - nullParameter_ = false; - inputData_ = inputData; - if (propertyChangeListeners_ != null) propertyChangeListeners_.firePropertyChange("inputData", oldValue, newValue); - } - - /** - Sets the parameter to null. Calling this method will clear any set input data or output data length. Setting input data or an output data length will make the parameter not null. - @param nullParameter The parameter data to be used as input to the program. - **/ - public void setNullParameter(boolean nullParameter) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting null parameter:", nullParameter); - nullParameter_ = nullParameter; - inputData_ = null; - outputDataLength_ = 0; - } - - // Sets the parameter data that has been received from the program. - // @param outputData The data to be returned from the program. - void setOutputData(byte[] outputData) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Setting output data:", outputData); - outputData_ = outputData; - } - - /** - Sets the output parameter data length. - @param outputDataLength The amount of data to be returned from the program (number of bytes). - @exception PropertyVetoException If the change is vetoed. - **/ - public void setOutputDataLength(int outputDataLength) throws PropertyVetoException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Setting output data length:", outputDataLength); - if (outputDataLength < 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'outputDataLength' is not valid:", outputDataLength); - throw new ExtendedIllegalArgumentException("outputDataLength (" + outputDataLength + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - Integer oldValue = null; - Integer newValue = null; - if (vetoableChangeListeners_ != null || propertyChangeListeners_ != null) - { - oldValue = new Integer(outputDataLength_); - newValue = new Integer(outputDataLength); - } - if (vetoableChangeListeners_ != null) vetoableChangeListeners_.fireVetoableChange("outputDataLength", oldValue, newValue); - nullParameter_ = false; - outputDataLength_ = outputDataLength; - if (propertyChangeListeners_ != null) propertyChangeListeners_.firePropertyChange("outputDataLength", oldValue, newValue); - } - - /** - Sets the type of program parameter. The type indicates if the data is pass by reference or pass by value. The type attribute is used by ServiceProgramCall. - @param parameterType The type of the program parameter. The type must be one of the following: -
      -
    • {@link #PASS_BY_VALUE PASS_BY_VALUE} - The parameter is passed as data. -
    • {@link #PASS_BY_REFERENCE PASS_BY_REFERENCE} - The parameter is passed as a reference. -
    - The default is PASS_BY_VALUE. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setParameterType(int parameterType) throws PropertyVetoException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Setting parameter type:", parameterType); - if (parameterType < PASS_BY_VALUE || parameterType > PASS_BY_REFERENCE) - { - Trace.log(Trace.ERROR, "Value of parameter 'parameterType' is not valid:", parameterType); - throw new ExtendedIllegalArgumentException("parameterType (" + parameterType + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - Integer oldValue = null; - Integer newValue = null; - if (vetoableChangeListeners_ != null || propertyChangeListeners_ != null) - { - oldValue = new Integer(parameterType_); - newValue = new Integer(parameterType); - } - if (vetoableChangeListeners_ != null) vetoableChangeListeners_.fireVetoableChange("parameterType", oldValue, newValue); - parameterType_ = parameterType; - if (propertyChangeListeners_ != null) propertyChangeListeners_.firePropertyChange("parameterType", oldValue, newValue); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ProgramParameter16.gif b/cvsroot/src/com/ibm/as400/access/ProgramParameter16.gif deleted file mode 100644 index b11de42ae..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/ProgramParameter16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/ProgramParameter32.gif b/cvsroot/src/com/ibm/as400/access/ProgramParameter32.gif deleted file mode 100644 index e5a562da5..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/ProgramParameter32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/ProgramParameterBeanInfo.java b/cvsroot/src/com/ibm/as400/access/ProgramParameterBeanInfo.java deleted file mode 100644 index 2fb474477..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProgramParameterBeanInfo.java +++ /dev/null @@ -1,151 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: ProgramParameterBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - The ProgramParameterBeanInfo class provides bean information for the ProgramParameter class. - **/ -public class ProgramParameterBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Class this bean info represents. - private static final Class BEAN_CLASS = ProgramParameter.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - - eventSetDescriptors = new EventSetDescriptor[] { propertyChange, vetoableChange }; - - PropertyDescriptor inputData = new PropertyDescriptor("inputData", BEAN_CLASS); - inputData.setBound(true); - inputData.setConstrained(true); - inputData.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_PARMINPUT")); - inputData.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_PARMINPUT")); - - PropertyDescriptor outputDataLength = new PropertyDescriptor("outputDataLength", BEAN_CLASS); - outputDataLength.setBound(true); - outputDataLength.setConstrained(true); - outputDataLength.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_PARMOUTPUTLEN")); - outputDataLength.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_PARMOUTPUTLEN")); - - PropertyDescriptor outputData = new PropertyDescriptor("outputData", BEAN_CLASS, "getOutputData", null); - outputData.setBound(false); - outputData.setConstrained(false); - outputData.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_PARMOUTPUT")); - outputData.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_PARMOUTPUT")); - - PropertyDescriptor parameterType = new PropertyDescriptor("parameterType", BEAN_CLASS); - parameterType.setBound(true); - parameterType.setConstrained(true); - parameterType.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_PARMTYPE")); - parameterType.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_PARMTYPE")); - - propertyDescriptors = new PropertyDescriptor[] { inputData, outputDataLength, outputData, parameterType }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return Zero (0), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "propertyChange" event - return 0; - } - - /** - Returns the index of the default property. - @return Zero (0), the index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // The index for the "inputData" property. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("ProgramParameter16.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("ProgramParameter32.gif"); - } - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ProxyClientConnection.java b/cvsroot/src/com/ibm/as400/access/ProxyClientConnection.java deleted file mode 100644 index a82c16c8c..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProxyClientConnection.java +++ /dev/null @@ -1,523 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProxyClientConnection.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.util.Enumeration; -import java.util.EventListener; -import java.util.Locale; -import java.util.Vector; - -// The ProxyClientConnection class represents the connection to a proxy server. This acts as the interface between proxy implementation classes in each Toolbox component and the proxy datastream classes. -// -// Implementation notes: -// -// 1. We used to keep a PxTable on the client side to keep track of the objects we created. The problem is that the table keeps a reference to every object, which prevents them from being garbage collected. This is certainly a memory leak on the client, but since the objects never get finalized, their -// -class ProxyClientConnection extends PxClientConnectionAdapter -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private static final String locale_ = Locale.getDefault().toString(); - private static final Class[] noArgumentClasses_ = new Class[0]; - private static final Object[] noArguments_ = new Object[0]; - - private int connectAttempts_ = 0; - private PxEventSupport eventSupport_; - private Vector pxList_ = new Vector(); - private SecondaryFinalizerThread_ secondaryFinalizerThread_; - - // Constructs a ProxyClientConnection object. - // @param proxyServer The proxy server. - // @param secure Options for a SSL connection, null indicates non-SSL connection. - public ProxyClientConnection(String proxyServer, SSLOptions secure) - { - super(proxyServer, secure); - connect(); - } - - // Adds a listener. - // @param proxyId The proxy id. - // @param listener The listener. - // @param eventName The event name. - public void addListener(long proxyId, EventListener listener, String eventName) - { - // If this is the first listener of its kind, then add a listener down on the proxy server, so that events get reported back. - if (eventSupport_.addListener(proxyId, listener)) - { - PxListenerReqCV request = new PxListenerReqCV(proxyId, ProxyConstants.LISTENER_OPERATION_ADD, eventName); - send(request); - } - } - - // Calls a constructor on the proxy server. The constructor creates an object on the proxy server. - // @param className The class name. - // @return The proxy id. - // @exception InvocationTargetException If the constructor throws an exception. - public long callConstructor(String className) throws InvocationTargetException - { - return callConstructor(className, true); - } - - // Calls a constructor on the proxy server. The constructor creates an object on the proxy server. - // @param className The class name. - // @param flag true to tack on ImplRemote to the class name, false to use the class name, as-is. - // @return The proxy id. - // @exception InvocationTargetException If the constructor throws an exception. - public long callConstructor(String className, boolean flag) throws InvocationTargetException - { - PxConstructorReqCV request = new PxConstructorReqCV(className, flag); - long pxId = ((ProxyReturnValue)sendAndReceive(request)).getReturnValuePxId(); - pxList_.addElement(new Long(pxId)); - return pxId; - } - - // Calls a factory method on the proxy server. - // @param proxyId The proxy id. - // @param methodName The method name. - // @param proxyImpl The proxy object representing the created object. - // @return The proxy object representing the created object, or null if no object was returned. - // @exception InvocationTargetException If the method throws an exception. - public ProxyFactoryImpl callFactoryMethod(long proxyId, String methodName, ProxyFactoryImpl proxyImpl) throws InvocationTargetException - { - return callFactoryMethod(proxyId, methodName, noArgumentClasses_, noArguments_, proxyImpl); - } - - // Calls a factory method on the proxy server. - // @param proxyId The proxy id. - // @param methodName The method name. - // @param argumentClasses The argument classes. - // @param arguments The arguments. - // @param proxyImpl The proxy object representing the created object. - // @return The proxy object representing the created object, or null if no object was returned. - // @exception InvocationTargetException If the method throws an exception. - public ProxyFactoryImpl callFactoryMethod(long proxyId, String methodName, Class[] argumentClasses, Object[] arguments, ProxyFactoryImpl proxyImpl) throws InvocationTargetException - { - PxMethodReqCV request = new PxMethodReqCV(proxyId, methodName, argumentClasses, arguments, null, false, true); - long proxyId2 = ((ProxyReturnValue)sendAndReceive(request)).getReturnValuePxId(); - if (proxyId2 >= 0) - { - proxyImpl.initialize(proxyId2, this); - pxList_.addElement(new Long(proxyId2)); - return proxyImpl; - } - return null; - } - - // Calls a finalize method on the proxy server. The object will be garbage collected on the proxy server. - // @param proxyId The proxy id. - // @exception InvocationTargetException If the finalize method throws an exception. - public void callFinalize(long proxyId) throws InvocationTargetException - { - // This may have already been called (by this object's finalize() or the ProxyImpl's finalize). Account for that fact, so that it only runs once. - Long pxId2 = new Long(proxyId); - if (pxList_.contains(pxId2)) - { - eventSupport_.removeAll(proxyId); - PxFinalizeReqCV request = new PxFinalizeReqCV(proxyId); - secondaryFinalizerThread_.addRequest(request); - pxList_.removeElement(pxId2); - } - } - - // Calls a method on the proxy server. - // @param proxyId The proxy id. - // @param methodName The method name. - // @return The return value. - // @exception InvocationTargetException If the method throws an exception. - public ProxyReturnValue callMethod(long proxyId, String methodName) throws InvocationTargetException - { - return callMethod(proxyId, methodName, noArgumentClasses_, noArguments_, false); - } - - // Calls a method on the proxy server. - // @param proxyId The proxy id. - // @param methodName The method name. - // @param argumentClasses The argument classes. - // @param arguments The arguments. - // @return The return value. - // @exception InvocationTargetException If the method throws an exception. - public ProxyReturnValue callMethod(long proxyId, String methodName, Class[] argumentClasses, Object[] arguments) throws InvocationTargetException - { - return callMethod(proxyId, methodName, argumentClasses, arguments, false); - } - - // Calls a method on the proxy server. - // @param proxyId The proxy id. - // @param methodName The method name. - // @param argumentClasses The argument classes. - // @param arguments The arguments. - // @param asynchronous true if asynchronous, false otherwise. - // @return The return value. - // @exception InvocationTargetException If the method throws an exception. - public ProxyReturnValue callMethod(long proxyId, String methodName, Class[] argumentClasses, Object[] arguments, boolean asynchronous) throws InvocationTargetException - { - PxMethodReqCV request = new PxMethodReqCV(proxyId, methodName, argumentClasses, arguments, null, asynchronous, false); - return (ProxyReturnValue)sendAndReceive(request); - } - - // Calls a method on the proxy server. - // @param proxyId The proxy id. - // @param methodName The method name. - // @param argumentClasses The argument classes. - // @param arguments The arguments. - // @param returnArguments Whether return arguments are needed, or null if none are needed. - // @param asynchronous true if asynchronous, false otherwise. - // @return The return value. - // @exception InvocationTargetException If the method throws an exception. - public ProxyReturnValue callMethod(long proxyId, String methodName, Class[] argumentClasses, Object[] arguments, boolean[] returnArguments, boolean asynchronous) throws InvocationTargetException - { - PxMethodReqCV request = new PxMethodReqCV(proxyId, methodName, argumentClasses, arguments, returnArguments, asynchronous, false); - return (ProxyReturnValue)sendAndReceive(request); - } - - // Calls a method on the proxy server. - // @param proxyId The proxy id. - // @param methodName The method name. - // @return The return value as a boolean. - // @exception InvocationTargetException If the method throws an exception. - public boolean callMethodReturnsBoolean(long proxyId, String methodName) throws InvocationTargetException - { - return callMethod(proxyId, methodName, noArgumentClasses_, noArguments_, false).getReturnValueBoolean(); - } - - // Calls a method on the proxy server. - // @param proxyId The proxy id. - // @param methodName The method name. - // @return The return value as an int. - // @exception InvocationTargetException If the method throws an exception. - public int callMethodReturnsInt(long proxyId, String methodName) throws InvocationTargetException - { - return callMethod(proxyId, methodName, noArgumentClasses_, noArguments_, false).getReturnValueInt(); - } - - // Calls a method on the proxy server. - // @param proxyId The proxy id. - // @param methodName The method name. - // @return The return value as an Object. - // @exception InvocationTargetException If the method throws an exception. - public Object callMethodReturnsObject(long proxyId, String methodName) throws InvocationTargetException - { - return callMethod(proxyId, methodName, noArgumentClasses_, noArguments_, false).getReturnValue(); - } - - // Closes the connection to the proxy server. - public void close() - { - super.close(); - secondaryFinalizerThread_.stopSafely(); - } - - // Initiates the connection to the proxy server. - public void connect() - { - PxConnectReqCV request; - if (tunnel_) // @D1a - request = new PxConnectReqCV(ProxyConstants.CURRENT_MOD, connectAttempts_++, locale_, ProxyConstants.DS_CONNECT_TUNNEL_REQ); // @D1c - else // @D1a - request = new PxConnectReqCV(ProxyConstants.CURRENT_MOD, connectAttempts_++, locale_, ProxyConstants.DS_CONNECT_REQ); // @D1c - - try - { - sendAndReceive(request); - } - catch (InvocationTargetException e) - { - rethrow(e); - } - } - - - protected void finalize() throws Throwable - { - // We should tell all of our proxy objects to finalize themselves BEFORE the socket closes. - Long[] pxList = new Long[pxList_.size()]; - pxList_.copyInto(pxList); - for (int i = 0; i < pxList.length; ++i) - { - long pxId = pxList[i].longValue(); - callFinalize(pxId); - } - - // Call the superclass's finalize(), which will close the socket, etc. - super.finalize(); - } - - public void open(String proxyServer) - { - super.open(proxyServer); - - // We need to reinitialize the factory everytime the connection is opened. - PxDSFactory factory = getFactory(); - factory.register(new PxByteParm()); - factory.register(new PxShortParm()); - factory.register(new PxIntParm()); - factory.register(new PxLongParm()); - factory.register(new PxFloatParm()); - factory.register(new PxDoubleParm()); - factory.register(new PxBooleanParm()); - factory.register(new PxCharParm()); - factory.register(new PxStringParm()); - factory.register(new PxPxObjectParm()); - factory.register(new PxSerializedObjectParm()); - factory.register(new PxToolboxObjectParm()); - factory.register(new PxNullParm()); - factory.register(new PxClassParm()); - - factory.register(new PxAcceptRepCV()); - factory.register(new PxRejectRepCV(this)); - factory.register(new PxReturnRepCV()); - factory.register(new PxExceptionRepCV()); - factory.register(new PxEventRepCV(eventSupport_ = new PxEventSupport())); - - // Start the secondary finalizer thread. - secondaryFinalizerThread_ = new SecondaryFinalizerThread_(); - secondaryFinalizerThread_.start(); - } - - // Removes a listener. - // @param proxyId The proxy id. - // @param listener The listener. - // @param eventName The event name. - public void removeListener(long proxyId, EventListener listener, String eventName) - { - // If this is the last listener of its kind, then remove the listener down on the proxy server, so that events no longer get reported back. - if (eventSupport_.removeListener(proxyId, listener)) - { - PxListenerReqCV request = new PxListenerReqCV(proxyId, ProxyConstants.LISTENER_OPERATION_REMOVE, eventName); - send(request); - eventSupport_.removeAll(proxyId); - } - } - - // Rethrows exceptions returned as InvocationTargetExceptions. This provides some common exception handling. - // @param e The InvocationTargetException. - // @return An InternalErrorException if the exception is not known. - // @throws The exception. - public static InternalErrorException rethrow(InvocationTargetException e) - { - Throwable e2 = e.getTargetException(); - if (e2 instanceof RuntimeException) - { - throw (RuntimeException)e2; - } - if (e2 instanceof Error) - { - throw (Error)e2; - } - return new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - - // Rethrows exceptions returned as InvocationTargetExceptions. This provides some common exception handling. - // @param e The InvocationTargetException. - // @return An InternalErrorException if the exception is not known. - // @throws The exception. - // - // Implementation note: - // - // * Throws IOException. - // - public static InternalErrorException rethrow1(InvocationTargetException e) throws IOException - { - Throwable e2 = e.getTargetException(); - if (e2 instanceof IOException) - { - throw (IOException)e2; - } - return rethrow(e); - } - - // Rethrows exceptions returned as InvocationTargetExceptions. This provides some common exception handling. - // @param e The InvocationTargetException. - // @return An InternalErrorException if the exception is not known. - // @throws The exception. - // - // Implementation note: - // - // * Throws [rethrow] + AS400SecurityException. - // - public static InternalErrorException rethrow2(InvocationTargetException e) throws AS400SecurityException, IOException - { - Throwable e2 = e.getTargetException(); - if (e2 instanceof AS400SecurityException) - { - throw (AS400SecurityException)e2; - } - return rethrow1(e); - } - - // Rethrows exceptions returned as InvocationTargetExceptions. This provides some common exception handling. - // @param e The InvocationTargetException. - // @return An InternalErrorException if the exception is not known. - // @throws The exception. - // - // Implementation note: - // - // * Throws [rethrow2] + InterruptedException. - // - public static InternalErrorException rethrow3(InvocationTargetException e) throws AS400SecurityException, InterruptedException, IOException - { - Throwable e2 = e.getTargetException(); - if (e2 instanceof InterruptedException) - { - throw (InterruptedException)e2; - } - return rethrow2(e); - } - - // Rethrows exceptions returned as InvocationTargetExceptions. This provides some common exception handling. - // @param e The InvocationTargetException. - // @return An InternalErrorException if the exception is not known. - // @throws The exception. - // - // Implementation note: - // - // * Throws [rethrow3] + ErrorCompletingRequestException. - // - public static InternalErrorException rethrow4(InvocationTargetException e) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - Throwable e2 = e.getTargetException(); - if (e2 instanceof ErrorCompletingRequestException) - { - throw (ErrorCompletingRequestException)e2; - } - return rethrow3 (e); - } - - // Rethrows exceptions returned as InvocationTargetExceptions. This provides some common exception handling. - // @param e The InvocationTargetException. - // @return An InternalErrorException if the exception is not known. - // @throws The exception. - // - // Implementation note: - // - // * Throws [rethrow3] + AS400Exception. - // - public static InternalErrorException rethrow4a(InvocationTargetException e) throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - Throwable e2 = e.getTargetException(); - if (e2 instanceof AS400Exception) - { - throw (AS400Exception)e2; - } - return rethrow3(e); - } - - // Rethrows exceptions returned as InvocationTargetExceptions. This provides some common exception handling. - // @param e The InvocationTargetException. - // @return An InternalErrorException if the exception is not known. - // @throws The exception. - // - // Implementation note: - // - // * Throws [rethrow4] + ObjectDoesNotExistException. - // - public static InternalErrorException rethrow5(InvocationTargetException e) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - Throwable e2 = e.getTargetException(); - if (e2 instanceof ObjectDoesNotExistException) - { - throw (ObjectDoesNotExistException)e2; - } - return rethrow4(e); - } - - // Rethrows exceptions returned as InvocationTargetExceptions. This provides some common exception handling. - // @param e The InvocationTargetException. - // @return An InternalErrorException if the exception is not known. - // @throws The exception. - // - // Implementation note: - // - // * Throws [rethrow5] + ObjectAlreadyExistsException. - // - public static InternalErrorException rethrow6(InvocationTargetException e) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, ObjectAlreadyExistsException - { - Throwable e2 = e.getTargetException(); - if (e2 instanceof ObjectAlreadyExistsException) - { - throw (ObjectAlreadyExistsException)e2; - } - return rethrow5(e); - } - - // Rethrows exceptions returned as InvocationTargetExceptions. This provides some common exception handling. - // @param e The InvocationTargetException. - // @return An InternalErrorException if the exception is not known. - // @throws The exception. - // - // Implementation note: - // - // * Throws [rethrow5] + RequestNotSupportedException. - // - public static InternalErrorException rethrow6a(InvocationTargetException e) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, RequestNotSupportedException - { - Throwable e2 = e.getTargetException(); - if (e2 instanceof RequestNotSupportedException) - { - throw (RequestNotSupportedException)e2; - } - return rethrow4(e); - } - - private class SecondaryFinalizerThread_ extends StoppableThread - { - private Vector requests_ = new Vector(); - - public SecondaryFinalizerThread_() - { - super("Proxy client secondary finalizer thread-" + newId()); - - // Mark this as a daemon thread so that its running does not prevent the JVM from going away. - setDaemon(true); - } - - public void addRequest(PxReqCV request) - { - synchronized(requests_) - { - requests_.addElement(request); - requests_.notify(); - } - } - - public void run() - { - while (canContinue()) - { - synchronized(requests_) - { - try - { - requests_.wait(); - } - catch(InterruptedException ignore) - { - // Ignore. - } - - Enumeration list = requests_.elements(); - while(list.hasMoreElements()) - { - PxReqCV request = (PxReqCV)list.nextElement(); - send(request); - } - requests_.removeAllElements(); - } - } - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ProxyConstants.java b/cvsroot/src/com/ibm/as400/access/ProxyConstants.java deleted file mode 100644 index 0ae89d6fd..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProxyConstants.java +++ /dev/null @@ -1,107 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProxyConstants.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The ProxyConstants class defines global contants for the -proxy support. -**/ -class ProxyConstants -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // The modification identifiers. These are used as part of the - // connect request to notify the proxy server what modification - // the client is running with. - static final String MOD_3 = "mod3"; - static final String MOD_4 = "mod4"; - static final String CURRENT_MOD = MOD_4; - - - - // The default port numbers. These port numbers were registered - // by the Internet Assigned Numbers Authority (http://www.iana.org) - // on 01/29/1999. For a complete list of registered port numbers, - // or http://www.isi.edu/in-notes/iana/assignments/port-numbers - // for the complete list. - static final int PORT_NUMBER = 3470; - static final int SECURE_PORT_NUMBER = 3471; //$B1C - - - // Impl creation flags. - static final int IMPL_NONE = 0; - static final int IMPL_REMOTE_OR_PROXY = 2; - // static final int IMPL_NATIVE_REMOTE_OR_PROXY = 3; - - - - // Listener operations. - static final int LISTENER_OPERATION_ADD = 1; - static final int LISTENER_OPERATION_REMOVE = 2; - - - - // The parameter datastream types. - static final short DS_BYTE_PARM = 25010; - static final short DS_SHORT_PARM = 25020; - static final short DS_INT_PARM = 25030; - static final short DS_LONG_PARM = 25040; - static final short DS_FLOAT_PARM = 25050; - static final short DS_DOUBLE_PARM = 25060; - static final short DS_BOOLEAN_PARM = 25070; - static final short DS_CHAR_PARM = 25080; - static final short DS_STRING_PARM = 26010; - static final short DS_SERIALIZED_OBJECT_PARM = 26020; - static final short DS_PROXY_OBJECT_PARM = 26030; - static final short DS_NULL_PARM = 26040; - static final short DS_TOOLBOX_OBJECT_PARM = 26050; - - static final short DS_CLASS_PARM = 27010; - - - - // The request datastream types. - static final short DS_CONNECT_REQ = 11010; - static final short DS_CONNECT_TUNNEL_REQ = 11015; // @D1a - static final short DS_DISCONNECT_REQ = 11020; - static final short DS_CONFIGURE_REQ = 11030; - static final short DS_END_REQ = 11040; - static final short DS_LOAD_REQ = 11050; - - static final short DS_CONSTRUCTOR_REQ = 12010; - static final short DS_METHOD_REQ = 12020; - static final short DS_FINALIZE_REQ = 12040; - static final short DS_LISTENER_REQ = 12050; - - - - // The reply datastream types. - static final short DS_ACCEPT_REP = 18010; - static final short DS_REJECT_REP = 18020; - static final short DS_LOAD_REP = 18030; - - static final short DS_RETURN_REP = 19010; - static final short DS_EXCEPTION_REP = 20010; - static final short DS_EVENT_REP = 21010; - - - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/ProxyException.java b/cvsroot/src/com/ibm/as400/access/ProxyException.java deleted file mode 100644 index 2e1b72816..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProxyException.java +++ /dev/null @@ -1,143 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProxyException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - - -package com.ibm.as400.access; - - - -/** -The ProxyException class represents an exception that indicates -an error occurred while communicating with the proxy server. -**/ -public class ProxyException -extends RuntimeException -implements ReturnCodeException -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private int returnCode_; - - - - // Return code values used by this class. - // If a value is added here, it must also be added to MRI.properties. - -/** -The return code indicating that a connection to the proxy server -cannot be established. -**/ - public static final int CONNECTION_NOT_ESTABLISHED = 1; - -/** -The return code indicating that a connection to the proxy server -was dropped. If the connection is via HTTP tunneling -this return code indicates the client tried -to use a session that was previously cleaned up by the system. -The system cleaned up the session because it was idle long -enough to indicate the client is no longer active. If -the client was still active -increase the timeout property so the system -waits longer before cleaning up sessions. -**/ - public static final int CONNECTION_DROPPED = 2; - -/** -The return code indicating that a connection to the proxy server -was rejected. -**/ - public static final int CONNECTION_REJECTED = 3; - -/** -The return code indicating that communication failed to the proxy -server because of a mismatch between code levels. This usually -occurs if the client and proxy server are running with different -versions of the IBM Toolbox for Java or different versions -of the JVM. -**/ - public static final int VERSION_MISMATCH = 4; // @B1A - - - -/** -Constructs a ProxyException object. - -@param returnCode The return code associated with this exception. -@param message The detailed message describing this exception. -**/ - ProxyException (int returnCode, String message) - { - super(message); - returnCode_ = returnCode; - - } - - - -/** -Constructs a ProxyException object. - -@param returnCode The return code associated with this exception. -**/ - ProxyException (int returnCode) - { - super (ResourceBundleLoader.getText (getMRIKey (returnCode))); - returnCode_ = returnCode; - } - - - -/** -Returns the text associated with the return code. - -@param returnCode The return code associated with this exception. -@return The text string which describes the error. -**/ - private static String getMRIKey (int returnCode) - { - switch(returnCode) { - case CONNECTION_NOT_ESTABLISHED: - return "EXC_PROXY_CONNECTION_NOT_ESTABLISHED"; - case CONNECTION_DROPPED: - return "EXC_PROXY_CONNECTION_DROPPED"; - case CONNECTION_REJECTED: - return "EXC_PROXY_CONNECTION_REJECTED"; - case VERSION_MISMATCH: // @B1A - return "EXC_PROXY_VERSION_MISMATCH"; // @B1A - default: - return "EXC_UNKNOWN"; // Bad return code was provided. - } - } - - - -/** -Returns the return code associated with this exception. - -@return The return code. -**/ - public int getReturnCode () - { - return returnCode_; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/ProxyFactoryImpl.java b/cvsroot/src/com/ibm/as400/access/ProxyFactoryImpl.java deleted file mode 100644 index 0a3937333..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProxyFactoryImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProxyFactoryImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The ProxyFactoryImpl interface represents proxy implementation of -IBM Toolbox for Java classes that gets created on the server. -**/ -interface ProxyFactoryImpl -{ - - - -/** -Initializes an proxy object returned server. - -@param proxyId The proxy id. -@param connection The connection. -**/ - public abstract void initialize (long proxyId, ProxyClientConnection connection); - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/ProxyImpl.java b/cvsroot/src/com/ibm/as400/access/ProxyImpl.java deleted file mode 100644 index 3b30052b6..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProxyImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProxyImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; - - - -/** -The ProxyImpl interface represents proxy implementation of -IBM Toolbox for Java classes. -**/ -interface ProxyImpl -{ - - - - -/** -Constructs an object on the proxy server. - -@param connection The connection. -**/ - public abstract void construct (ProxyClientConnection connection); - - - - public long getPxId(); - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/ProxyReturnValue.java b/cvsroot/src/com/ibm/as400/access/ProxyReturnValue.java deleted file mode 100644 index c95d6e6ff..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProxyReturnValue.java +++ /dev/null @@ -1,196 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProxyReturnValue.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The ProxyReturnValue class encapsulates all of the -information which is returned from a method or constructor -call. -**/ -// -// Implementation note: -// -// The return value is stored in a PxParm object -// in order to avoid creating an extra object when the -// value is a primitive type. -// -class ProxyReturnValue -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private PxParm returnValue_; - private PxParm[] arguments_; - - - -/** -Constructs a ProxyReturnValue object. - -@param returnValue The return value. -@param arguments The arguments. -**/ - public ProxyReturnValue (PxParm returnValue, PxParm[] arguments) - { - returnValue_ = returnValue; - arguments_ = arguments; - - - } - - - -/** -Returns an argument. - -@param i The index. -@return The argument. -**/ - public Object getArgument (int i) - { - return arguments_[i].getObjectValue (); - } - - - -/** -Returns the return value. - -@return The return value. -**/ - public Object getReturnValue () - { - return returnValue_.getObjectValue (); - } - - - -/** -Returns the return value as a byte. - -@return The return value. -**/ - public byte getReturnValueByte () - { - return ((PxByteParm) returnValue_).getByteValue (); - } - - - -/** -Returns the return value as a short. - -@return The return value. -**/ - public short getReturnValueShort () - { - return ((PxShortParm) returnValue_).getShortValue (); - } - - - -/** -Returns the return value as a int. - -@return The return value. -**/ - public int getReturnValueInt () - { - return ((PxIntParm) returnValue_).getIntValue (); - } - - - -/** -Returns the return value as a long. - -@return The return value. -**/ - public long getReturnValueLong () - { - return ((PxLongParm) returnValue_).getLongValue (); - } - - - -/** -Returns the return value as a float. - -@return The return value. -**/ - public float getReturnValueFloat () - { - return ((PxFloatParm) returnValue_).getFloatValue (); - } - - - -/** -Returns the return value as a double. - -@return The return value. -**/ - public double getReturnValueDouble () - { - return ((PxDoubleParm) returnValue_).getDoubleValue (); - } - - - -/** -Returns the return value as a char. - -@return The return value. -**/ - public char getReturnValueChar () - { - return ((PxCharParm) returnValue_).getCharValue (); - } - - - -/** -Returns the return value as a boolean. - -@return The return value. -**/ - public boolean getReturnValueBoolean () - { - return ((PxBooleanParm) returnValue_).getBooleanValue (); - } - - - -/** -Returns the return value as a proxy id. - -@return The return value, or -1 if the return value was null. -**/ - public long getReturnValuePxId () - { - if (returnValue_ instanceof PxNullParm) - return -1; - else - return ((PxPxObjectParm) returnValue_).getPxId (); - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/ProxyServer.java b/cvsroot/src/com/ibm/as400/access/ProxyServer.java deleted file mode 100644 index ad5a2db3f..000000000 --- a/cvsroot/src/com/ibm/as400/access/ProxyServer.java +++ /dev/null @@ -1,849 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProxyServer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.PrintStream; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.BindException; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.Enumeration; -import java.util.Vector; - - - -/** -Fulfills requests from programs -using the proxy jar file. The proxy server is responsible for -creating and invoking methods on Toolbox objects on behalf of the -program. The proxy server is intended for use on a middle-tier in -a multiple tier environment. - -

    If there is already a proxy server active for the specified -port, then a new proxy server will not be started. Instead, -the existing proxy server's configuration will be updated. - -

    A ProxyServer object can be created and run directly from a -program. Alternately, the proxy server can be run as an -application, as follows: - -

    -
    -java com.ibm.as400.access.ProxyServer [ options ]
    -
    -
    - -

    Options: -

    - -
    -balanceThreshold balanceThreshold
    -
    -Specifies the number of connections that must be active before -the peer server starts load balancing by dispatching requests to -peer proxy servers. Specify 0 to start load balancing immediately or --1 to never start load balancing. This option may be abbreviated --bt. The default is -1. This has no effect unless peer -proxy servers are specified. -
    - -
    -configuration configuration
    -
    -Specifies a properties file which lists configuration -properties in the following format: -
    -balanceThreshold=balanceThreshold
    -jdbcDrivers=jdbcDriver1[;jdbcDriver2[;...]]
    -maxConnections=maxConnections
    -peers=hostname1[:port1][;hostname2[:port2][;...]]
    -verbose=true|false
    -
    -This option may be abbreviated -c. The default is -to not load a configuration. If a property is loaded in -a configuration and specified in a command line argument, -then the command line argument takes precedence. -
    - -
    -jdbcDrivers jdbcDriver1[;jdbcDriver2;...]
    -
    -Specifies a list of JDBC driver class names to register with -the JDBC DriverManager. Use this to register any JDBC drivers -to which clients might need to connect. This option may be abbreviated --jd. The default is to load only the IBM Toolbox -for Java JDBC driver. -
    - -
    -maxConnections maxConnections
    -
    -Specifies the maximum number of connections which can be active -at any particular time. This refers to connections to the proxy -server, that are initiated by clients. If the maximum number of -connections are active, then any further connection requests will -be rejected and an exception is thrown to the client program. -Specify 0 to not allow any connections, or -1 for no limit. -This option may be abbreviated -mc. The default is -to allow an unlimited number of connections. -
    - -
    -peers hostname1[:port1][;hostname2[:port2];...]
    -
    -Specifies a list of peer proxy servers for use in load balancing. -In some cases, connections to this proxy server will be -reassigned to a peer. This option may be abbreviated --pe. The default is not to do load balancing. -
    - -
    -port port
    -
    -Specifies the port to use for accepting connections from clients. -This option may be abbreviated -po. The default port is 3470. -
    - -
    -securePort securePort
    -
    -Specifies the port to use for accepting Secure Sockets Layer (SSL) -connections from clients. This option may be abbreviated -sp. -The proxy server will only accept SSL connections -when the com.ibm.sslight package is in the classpath. -The default port is 3471. -
    - -
    -keyringName keyringName
    -
    -Specifies the keyring to use for Secure Sockets Layer (SSL) -communications from clients. This option may be abbreviated -kn. -The keyring specified by this option must be in the classpath for SSL -communications to work properly between the proxy server and client. -If the com.ibm.sslight package is not the classpath, this option will -be ignored. -
    - -
    -keyringPassword keyringPassword
    -
    -Specifies the password to the keyring. This option may be -abbreviated -kp. This option msut be used in conjunction -with the -keyringName option. If the com.ibm.sslight package is not the -classpath, this option will be ignored. -
    - -
    -verbose [true|false]
    -
    -Specifies whether to print status and connection -information to System.out. This option may be abbreviated --v. The default is not to print status and -connection information. -
    - -
    -help
    -
    -Prints usage information to System.out. This option may be abbreviated --h or -?. The default is not to print usage -information. -
    - -
    - -

    Example usage: - -

    To start the proxy server from a program: -

    -ProxyServer proxyServer = new ProxyServer ();
    -proxyServer.setMaxConnections (25);
    -proxyServer.run ();
    -
    - -

    Alternatively, the above action can be performed directly -from the command line as follows: -

    -java com.ibm.as400.access.ProxyServer -maxconnections 25
    -
    -**/ -// -// Implementation notes: -// -// 1. It was suggested that we provide a property which defines -// whether we listen for non-secure connections, SSL connections, -// or both. A suggestion says that this is more of a firewall -// issue, and the specific ports can be turned on/off at the -// firewall. -// -public class ProxyServer -{ - // Private data. - private static final PrintStream errors_ = System.err; - - private PSConfig configuration_; - private PSLoad load_; - private PSLoadBalancer loadBalancer_; - private int port_; - private int securePort_; //$B1C - private String keyringName_; //$B1A - private String keyringPwd_; //$B1A - private Vector threadGroup_; - - - - static - { - // If the proxy server is running, it should ignore the proxy - // server system property! (Otherwise, it would make connections - // to itself.) - SystemProperties.ignoreProperty(SystemProperties.AS400_PROXY_SERVER); - } - - - -/** -Constructs a ProxyServer object. -**/ - public ProxyServer () - { - port_ = ProxyConstants.PORT_NUMBER; - securePort_ = ProxyConstants.SECURE_PORT_NUMBER; //$B1C - keyringName_ = null; //$B1A - keyringPwd_ = null; //$B1A - threadGroup_ = null; - - load_ = new PSLoad (); - loadBalancer_ = new PSLoadBalancer (load_); - configuration_ = new PSConfig (load_, loadBalancer_); - } - - - -/** -Returns the number of active connections. - -@return The number of active connections. -**/ - public int getActiveConnections () - { - return load_.getActiveConnections (); - } - - - -/** -Returns the balance threshold. This is the number of -connections that must be active before the peer server starts -load balancing by dispatching requests to peer proxy servers. -Specify 0 to start load balancing immediately or -1 to never -start load balancing. - -@return The balance threshold, or 0 to start load - balancing immediately or -1 to never start load - balancing. -**/ - public int getBalanceThreshold () - { - return load_.getBalanceThreshold (); - } - - - -/** -Returns the name of the configuration properties. - -@return The name of the configuration properties, or null - if not set. -**/ - public String getConfiguration() - { - return configuration_.getName (); - } - - -/** -Returns the keyring file that the proxy server will use during -SSL connections from clients. - -@return The proxy server keyring file name. -**/ - public String getKeyring () //$B1A - { - return keyringName_; - } - - - -/** -Returns the password to the proxy server keyring file. - -@return The proxy server keyring password. -**/ - String getKeyringPassword () //$B1A - { - return keyringPwd_; - } - - - -/** -Returns the maximum number of connections which can be -active at any particular time. - -@return The maximum number of connections which can be - active at any particular time, or -1 for - unlimited connections. -**/ - public int getMaxConnections () - { - return load_.getMaxConnections (); - } - - - -/** -Returns a list of peer proxy servers for use in load balancing. -Each peer proxy server is specified in the format -hostname[:port]. This returns an empty array if -there are no peer proxy servers. - -@return A list of peer proxy servers for use in load balancing. -**/ - public String[] getPeers () - { - return loadBalancer_.getPeers (); - } - - - -/** -Returns the port to use for accepting connections from clients. - -@return The port to use for accepting connections from clients. -**/ - public int getPort () - { - return port_; - } - - - -/** -Returns the port to use for accepting Secure Sockets Layer (SSL) -connections from clients. - -@return The port to use for accepting Secure Sockets Layer (SSL) - connections from clients. -**/ - public int getSecurePort () //$B1C - { - return securePort_; - } - - - -/** -Indicates if the proxy server has been started. - -@return true if the proxy server has been started, false otherwise. -**/ - public boolean isStarted () - { - return (threadGroup_ != null); - } - - - -/** -Indicates whether to print status and connection information -to System.out. - -@return true to print status and connection information to - System.out, false otherwise. -**/ - public boolean isVerbose () - { - return Verbose.isVerbose (); - } - - - -/** -Runs the proxy server as an application. - -@param args The command line arguments. -**/ - public static void main (String args[]) - { - ProxyServer proxyServer = new ProxyServer (); - if (proxyServer.parseArgs (args)) { - Verbose.forcePrintln (ResourceBundleLoader.getText ("PROXY_SERVER_STARTED")); - proxyServer.start (); - } - else { - PSConfig.usage (System.err); - } - } - - - -/** -Parses the command line arguments and sets the properties -accordingly. - -@param args The command line arguments. -@return true if the combination of command line - arguments is valid, false otherwise. -**/ - private boolean parseArgs (String[] args) - { - CommandLineArguments cla = new CommandLineArguments (args, - PSConfig.expectedOptions_, - PSConfig.shortcuts_); - - if (cla.getOptionValue ("-help") != null) - return false; - - try { - configuration_.apply (cla); - } - catch (Exception e) { - errors_.println (e.getMessage ()); - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Exception while parsing command line arguments", e); - return false; - } - - // Options that are not part of the configuration. - String portOptionValue = cla.getOptionValue ("-port"); - if (portOptionValue != null) - if (portOptionValue.length() > 0) - setPort (Integer.parseInt (portOptionValue)); - - String securePortOptionValue = cla.getOptionValue ("-securePort"); //$B1C - if (securePortOptionValue != null) //$B1C - if (securePortOptionValue.length() > 0) //$B1C - setSecurePort (Integer.parseInt (securePortOptionValue)); //$B1C - - String keyringNameOptionValue = cla.getOptionValue ("-keyringName"); //$B1A - String keyringPwdOptionValue = cla.getOptionValue ("-keyringPassword"); //$B1A - try //$B1A - { //$B1A - // Try to load the SSLight classes. If they are not found then we do not need to //$B1A - // check for the keyring command line parms. //$B1A - //$B1A - Class.forName("com.ibm.sslight.SSLContext"); //$B1A - if (keyringNameOptionValue != null && keyringPwdOptionValue != null) //$B1A - { //$B1A - if (keyringNameOptionValue.length() > 0 && keyringPwdOptionValue.length() > 0) //$B1A - { //$B1A - setKeyringName (keyringNameOptionValue); //$B1A - setKeyringPassword (keyringPwdOptionValue); //$B1A - } //$B1A - else //$B1A - { //$B1A - Verbose.forcePrintln ("\n" + //$B1A - ResourceBundleLoader.getText("PROXY_SERVER_NO_KEYRING") + //$B1A - "\n"); //$B1A - } //$B1A - } //$B1A - else //$B1A - { //$B1A - Verbose.forcePrintln ("\n" + //$B1A - ResourceBundleLoader.getText("PROXY_SERVER_KEYRING_EXPLAIN") + //$B1A - "\n"); //$B1A - } //$B1A - } //$B1A - catch (ClassNotFoundException e) //$B1A - { /* No need to parse the keyring options since the SSLight classes are not in the CLASSPATH. */ //$B1A - } //$B1A - - - // Extra options. - Enumeration list = cla.getExtraOptions (); - while (list.hasMoreElements ()) { - String extraOption = list.nextElement ().toString (); - errors_.println (ResourceBundleLoader.getText ("PROXY_OPTION_NOT_VALID", extraOption)); - } - - // Values without options. @A1A - String noOptionValues = cla.getOptionValue("-"); // @A1A - if (noOptionValues != null) // @A1A - if (noOptionValues.length() > 0) // @A1A - errors_.println(ResourceBundleLoader.getText("PROXY_VALUE_NO_OPTION", noOptionValues)); // @A1A - - return true; - } - - - -/** -Sets the number of connections that must be active before -the peer server starts load balancing by dispatching requests to -peer proxy servers. The default is -1. - -@param balanceThreshold The number of connections that must be - active before the peer server starts load - balancing by dispatching requests to peer - proxy servers. Specify 0 to start load - balancing immediately or -1 to never start - load balancing. -**/ - public void setBalanceThreshold (int balanceThreshold) - { - load_.setBalanceThreshold (balanceThreshold); - } - - -/** -Sets and loads the properties file which lists -configuration properties. The default is not to load -a configuration. - -@param configuration The properties file which list - configuration properties. - -@exception IOException If the configuration can not be loaded. -**/ - public void setConfiguration (String configuration) - throws IOException - { - if (configuration == null) - throw new NullPointerException ("configuration"); - if (configuration.length() == 0) - throw new ExtendedIllegalArgumentException ("configuration", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - configuration_.setName (configuration); - configuration_.load (); - } - - -/** -Sets the name of the keyring the proxy server -will use during SSL communications. The proxy -server keyring name can be set only if the proxy -server is not running. - -@param keyringName The proxy server keyring name. -**/ - public void setKeyringName(String keyringName) //$B1A - { - if (keyringName == null) - throw new NullPointerException ("keyringName"); - if (keyringName.length() == 0) - throw new ExtendedIllegalArgumentException ("keyringName", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - keyringName_ = keyringName; - } - - -/** -Sets the password to the keyring the proxy server -will use during SSL communications. The proxy -server keyring password can be set only if the proxy -server is not running. - -@param keyringPassword The proxy server keyring password. -**/ - public void setKeyringPassword(String keyringPassword) //$B1A - { - if (keyringPassword == null) - throw new NullPointerException ("keyringPassword"); - if (keyringPassword.length() == 0) - throw new ExtendedIllegalArgumentException ("keyringPassword", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - keyringPwd_ = keyringPassword; - } - - - -/** -Sets the maximum number of connections which can be active -at any particular time. If the maximum number of connections -are active, then any further connection requests will be -rejected. The default is to allow an unlimited number of -connections. - -

    Setting this to a number less than the number of active -connections will not drop any active connections. It will -simply prevent new connections from being accepted until the -number of active connections is less than the limit. - -@param maxConnections The maximum number of connections - which can be active at any particular - time. Specify 0 to not allow any - connections or -1 for unlimited - connections. -**/ - public void setMaxConnections (int maxConnections) - { - load_.setMaxConnections (maxConnections); - } - - - -/** -Sets the list of peer proxy servers for use in load -balancing. In some cases, connections to the proxy -server will be reassigned to a peer. The default is -not to do load balancing. Specify each peer proxy -server in the format hostname[:port]. - -@param peers The list of peer proxy servers for - use in load balancing, or an empty - array to not do load balancing. -**/ - public void setPeers (String[] peers) - { - if (peers == null) - throw new NullPointerException ("peers"); - for (int i = 0; i < peers.length; ++i) { - if (peers[i] == null) - throw new NullPointerException ("peers[" + i + "]"); - if (peers[i].length() == 0) - throw new ExtendedIllegalArgumentException ("peers[" + i + "]", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - loadBalancer_.setPeers (peers); - } - - - -/** -Sets the port to use for accepting connections from -clients. The default is 3470. Specify 0 to indicate -that any free port can be used. The port number can -be set only if the proxy server is not running. - -@param port The port to use for accepting connections - from clients. -**/ - public void setPort (int port) - { - if (isStarted ()) - throw new ExtendedIllegalStateException ("port", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - if ((port < 0) || (port > 65535)) - throw new ExtendedIllegalArgumentException ("port", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - port_ = port; - } - - -/** -Sets the port to use for accepting Secure Sockets -Layer (SSL) connections from clients. The default -is 3471. Specify 0 to indicate that any free port -can be used. The proxy server will only accept SSL -connections when the com.ibm.sslight package is in -the classpath. The secure port number can be set -only if the proxy server is not running. - -@param securePort The port to use for accepting Secure - Sockets Layer (SSL) connections from - clients. -**/ - public void setSecurePort (int securePort) //$B1C - { - if (isStarted ()) - throw new ExtendedIllegalStateException ("port", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - if ((securePort < 0) || (securePort > 65535)) - throw new ExtendedIllegalArgumentException ("port", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - securePort_ = securePort; - } - - - -/** -Sets whether to print status and connection information -to System.out. The default is false. - -@param verbose true to print status and connection - information to System.out, false otherwise. -**/ - public void setVerbose (boolean verbose) - { - Verbose.setVerbose (verbose); - } - - - -/** -Starts the proxy server. This starts several threads which process -client requests, and then return immediately. The proxy server is still -running after the return. Use stop() to stop all threads -for this proxy server. -**/ - public void start() - { - // Throw an exception if the proxy server is already started. - if (threadGroup_ != null) - throw new ExtendedIllegalStateException (ExtendedIllegalStateException.PROXY_SERVER_ALREADY_STARTED); - - // Initialize a thread group for this proxy server. This will make - // it much easier to stop all running threads. - threadGroup_ = new Vector (); - - // Initialize the server socket. If the port is in use, send the - // existing proxy server a configure request. - try { - PSServerSocketContainerAdapter serverSocket = new PSServerSocketContainer (port_); - port_ = serverSocket.getLocalPort (); - PSController controller = new PSController (threadGroup_, - this, - load_, - loadBalancer_, - configuration_, - serverSocket); - - controller.start (); - threadGroup_.addElement (controller); - Verbose.println (ResourceBundleLoader.getText ("PROXY_SERVER_LISTENING", serverSocket, Integer.toString (port_))); - } - catch (BindException e) { - Verbose.println (ResourceBundleLoader.getText ("PROXY_ALREADY_LISTENING", Integer.toString (port_))); - - try { - PxPeerConnection peerConnection = new PxPeerConnection (InetAddress.getLocalHost ().getHostName () + ":" + port_); - peerConnection.configure (configuration_); - peerConnection.close (); - return; - } - catch (UnknownHostException e1) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Peer host is unknown.", e); - errors_.println (e.getMessage ()); - } - } - catch (IOException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error opening server socket.", e); - errors_.println (e.getMessage ()); - } - - // Check to see if the sslight classes are in the classpath. - // If so, we can handle SSL, otherwise we can not. - // - // Note that we do not need to send a configure request in - // this case, since the server will already be reconfigured - // using the non-secure socket (and it is the same server, - // just listenening to 2 ports, not 2 servers). //$B1C - try - { - Class.forName ("com.ibm.sslight.SSLContext"); - - // The SSL Proxy port will only be started if the keyringName and keyringPwd are //$B1A - // correctly specified. If either command line option is bad, the Proxy Server - // will not do SSL, but will continue to handle regular Proxy communications. - if (keyringName_ != null && keyringPwd_ != null) //$B1A - { - // Since SSLight is no longer support, access this class (in include tree) via reflection - // int/String/String - Class classPSSecureServerSocketContainer = Class.forName("com.ibm.as400.access.PSSecureServerSocketContainer"); - Class[] parameterTypes = new Class[3]; - parameterTypes[0] = Integer.TYPE; - parameterTypes[1] = "".getClass(); - parameterTypes[2] = "".getClass(); - Constructor constructor = classPSSecureServerSocketContainer.getConstructor(parameterTypes); - Object[] args = new Object[3]; - args[0] = new Integer(securePort_); - args[1] = keyringName_; - args[2] = keyringPwd_; - - Object serverSocket = constructor.newInstance(args); - try //$B1A - { - parameterTypes = new Class[0]; - Method getLocalPortMethod = classPSSecureServerSocketContainer.getMethod("getLocalPort", parameterTypes); - args = new Object[0]; - securePort_ = ((Integer)getLocalPortMethod.invoke(serverSocket, args)).intValue(); - PSController controller = new PSController (threadGroup_, - this, - load_, - loadBalancer_, - configuration_, - (PSServerSocketContainerAdapter) serverSocket); - - controller.start (); - threadGroup_.addElement (controller); - Verbose.println (ResourceBundleLoader.getText ("PROXY_SERVER_LISTENING", serverSocket, Integer.toString (securePort_))); - } - catch (NullPointerException e) //$B1A - { //$B1A - // If the proxy server failed to load the proxy keyring, then we don't //$B1A - // want to display a message saying the secure proxy server was started. Instead display //$B1A - // a message saying it didn't start and the details can be seeing by turning ERROR tracing on. //$B1A - Verbose.println (ResourceBundleLoader.getText ("PROXY_SERVER_LISTENING", //$B1A - "Secure proxy server NOT", //$B1A - Integer.toString (securePort_))); //$B1A - } - } - } - catch (NoSuchMethodException e) { - if (Trace.isTraceDiagnosticOn ()) - Trace.log (Trace.DIAGNOSTIC, "NoSuchMethodException using SSLight classes SSL support is not enabled."); - errors_.println (e.getMessage ()); - - } - catch (InvocationTargetException e ) { - if (Trace.isTraceDiagnosticOn ()) - Trace.log (Trace.DIAGNOSTIC, "InvocationTargetException using SSLight classes SSL support is not enabled."); - errors_.println (e.getMessage ()); - Throwable e2 = e.getCause(); - if (e2 != null) { - errors_.println (e2.getMessage ()); - } - } - catch (InstantiationException e) { - if (Trace.isTraceDiagnosticOn ()) - Trace.log (Trace.DIAGNOSTIC, "InstantiationException using SSLight classes SSL support is not enabled."); - errors_.println (e.getMessage ()); - - } - catch (ClassNotFoundException e) - { - if (Trace.isTraceDiagnosticOn ()) - Trace.log (Trace.DIAGNOSTIC, "SSLight classes are not in the classpath, SSL support is not enabled."); - } catch (IllegalArgumentException e) { - if (Trace.isTraceDiagnosticOn ()) - Trace.log (Trace.DIAGNOSTIC, "IllegalArgumentException using SSLight classes SSL support is not enabled."); - errors_.println (e.getMessage ()); - } catch (IllegalAccessException e) { - if (Trace.isTraceDiagnosticOn ()) - Trace.log (Trace.DIAGNOSTIC, "IllegalAccessException using SSLight classes SSL support is not enabled."); - errors_.println (e.getMessage ()); - } - - } - - - -/** -Stops the proxy server. This stops all threads relating to this -proxy server. -**/ - public void stop() - { - // Throw an exception if the proxy server is not started. - if (threadGroup_ == null) - throw new ExtendedIllegalStateException (ExtendedIllegalStateException.PROXY_SERVER_NOT_STARTED); - - // Force the load's active connection count to be accurate. - load_.allConnectionsClosed (); - - // Stop all of the threads safely. - Enumeration list = threadGroup_.elements (); - while (list.hasMoreElements ()) - ((StoppableThread) list.nextElement ()).stopSafely (); - - // Clear the thread group. - threadGroup_ = null; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxAcceptRepCV.java b/cvsroot/src/com/ibm/as400/access/PxAcceptRepCV.java deleted file mode 100644 index 6b8db2c32..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxAcceptRepCV.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxAcceptRepCV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; - - - -/** -The PxAcceptRepCV class represents the client -view of an accept reply. -**/ -class PxAcceptRepCV -extends PxRepCV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a PxAcceptRepCV object. -**/ - public PxAcceptRepCV () - { - super (ProxyConstants.DS_ACCEPT_REP); - - } - - - -/** -Processes the reply. - -@return The returned object, or null if none. -**/ - public Object process () - throws InvocationTargetException - { - // No processing is needed. - return null; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxAcceptRepSV.java b/cvsroot/src/com/ibm/as400/access/PxAcceptRepSV.java deleted file mode 100644 index e6cad49ad..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxAcceptRepSV.java +++ /dev/null @@ -1,39 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxAcceptRepSV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The PxAcceptRepSV class represents the -server view of an accept reply. -**/ -class PxAcceptRepSV -extends PxRepSV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a PxAcceptRepSV object. -**/ - public PxAcceptRepSV () - { - super (ProxyConstants.DS_ACCEPT_REP); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxBooleanParm.java b/cvsroot/src/com/ibm/as400/access/PxBooleanParm.java deleted file mode 100644 index cae2935e4..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxBooleanParm.java +++ /dev/null @@ -1,150 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxBooleanParm.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; - - - -/** -The PxBooleanParm class represents a boolean -parameter in a proxy datastream. -**/ -class PxBooleanParm -extends PxDS -implements PxParm -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private boolean value_; - - - -/** -Constructs a PxBooleanParm object. -**/ - public PxBooleanParm () - { - super (ProxyConstants.DS_BOOLEAN_PARM); - } - - - -/** -Constructs a PxBooleanParm object. - -@param value The boolean value. -**/ - public PxBooleanParm (boolean value) - { - super (ProxyConstants.DS_BOOLEAN_PARM); - value_ = value; - } - - - -/** -Constructs a PxBooleanParm object. - -@param value The boolean value. -**/ - public PxBooleanParm (Boolean value) - { - this (value.booleanValue ()); - } - - - -/** -Returns the boolean value. - -@return The boolean value. -**/ - public boolean getBooleanValue () - { - return value_; - } - - - -/** -Returns the Object value. - -@return The Object value. -**/ - public Object getObjectValue () - { - return new Boolean (value_); - } - - - -/** -Loads this datastream by reading from an input stream. - -@param input The input stream. -@param factory The datastream factory. This is sometimes - needed when datastreams are nested. - -@exception IOException If an error occurs. -**/ - public void readFrom (InputStream input, PxDSFactory factory) - throws IOException - { - super.readFrom (input, factory); - DataInputStream dataInput = new DataInputStream (input); - value_ = dataInput.readBoolean (); - } - - - -/** -Returns the String representation of the datastream. - -@return The String representation of the datastream. -**/ - public String toString () - { - - return super.toString () + " (" + value_ + ")"; - } - - - -/** -Writes the contents of the datastream to an output stream. - -@param output The output stream. - -@exception IOException If an error occurs. -**/ - public void writeTo (OutputStream output) - throws IOException - { - super.writeTo (output); - DataOutputStream dataOutput = new DataOutputStream (output); - dataOutput.writeBoolean (value_); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxByteParm.java b/cvsroot/src/com/ibm/as400/access/PxByteParm.java deleted file mode 100644 index a04f7fcf9..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxByteParm.java +++ /dev/null @@ -1,150 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxByteParm.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; - - - -/** -The PxByteParm class represents a byte -parameter in a proxy datastream. -**/ -class PxByteParm -extends PxDS -implements PxParm -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private byte value_; - - - -/** -Constructs a PxByteParm object. -**/ - public PxByteParm () - { - super (ProxyConstants.DS_BYTE_PARM); - } - - - -/** -Constructs a PxByteParm object. - -@param value The byte value. -**/ - public PxByteParm (byte value) - { - super (ProxyConstants.DS_BYTE_PARM); - value_ = value; - } - - - -/** -Constructs a PxByteParm object. - -@param value The byte value. -**/ - public PxByteParm (Byte value) - { - this (value.byteValue ()); - } - - - -/** -Returns the byte value. - -@return The byte value. -**/ - public byte getByteValue () - { - return value_; - } - - - -/** -Returns the Object value. - -@return The Object value. -**/ - public Object getObjectValue () - { - return new Byte (value_); - } - - - -/** -Loads this datastream by reading from an input stream. - -@param input The input stream. -@param factory The datastream factory. This is sometimes - needed when datastreams are nested. - -@exception IOException If an error occurs. -**/ - public void readFrom (InputStream input, PxDSFactory factory) - throws IOException - { - super.readFrom (input, factory); - DataInputStream dataInput = new DataInputStream (input); - value_ = dataInput.readByte (); - } - - - -/** -Returns the String representation of the datastream. - -@return The String representation of the datastream. -**/ - public String toString () - { - - return super.toString () + " (" + value_ + ")"; - } - - - -/** -Writes the contents of the datastream to an output stream. - -@param output The output stream. - -@exception IOException If an error occurs. -**/ - public void writeTo (OutputStream output) - throws IOException - { - super.writeTo (output); - DataOutputStream dataOutput = new DataOutputStream (output); - dataOutput.writeByte (value_); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxCharParm.java b/cvsroot/src/com/ibm/as400/access/PxCharParm.java deleted file mode 100644 index 0c4e91af4..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxCharParm.java +++ /dev/null @@ -1,150 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxCharParm.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; - - - -/** -The PxCharParm class represents a char -parameter in a proxy datastream. -**/ -class PxCharParm -extends PxDS -implements PxParm -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private char value_; - - - -/** -Constructs a PxCharParm object. -**/ - public PxCharParm () - { - super (ProxyConstants.DS_CHAR_PARM); - } - - - -/** -Constructs a PxCharParm object. - -@param value The char value. -**/ - public PxCharParm (char value) - { - super (ProxyConstants.DS_CHAR_PARM); - value_ = value; - } - - - -/** -Constructs a PxCharParm object. - -@param value The char value. -**/ - public PxCharParm (Character value) - { - this (value.charValue ()); - } - - - -/** -Returns the char value. - -@return The char value. -**/ - public char getCharValue () - { - return value_; - } - - - -/** -Returns the Object value. - -@return The Object value. -**/ - public Object getObjectValue () - { - return new Character (value_); - } - - - -/** -Loads this datastream by reading from an input stream. - -@param input The input stream. -@param factory The datastream factory. This is sometimes - needed when datastreams are nested. - -@exception IOException If an error occurs. -**/ - public void readFrom (InputStream input, PxDSFactory factory) - throws IOException - { - super.readFrom (input, factory); - DataInputStream dataInput = new DataInputStream (input); - value_ = dataInput.readChar (); - } - - - -/** -Returns the String representation of the datastream. - -@return The String representation of the datastream. -**/ - public String toString () - { - - return super.toString () + " (" + value_ + ")"; - } - - - -/** -Writes the contents of the datastream to an output stream. - -@param output The output stream. - -@exception IOException If an error occurs. -**/ - public void writeTo (OutputStream output) - throws IOException - { - super.writeTo (output); - DataOutputStream dataOutput = new DataOutputStream (output); - dataOutput.writeChar (value_); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxClassParm.java b/cvsroot/src/com/ibm/as400/access/PxClassParm.java deleted file mode 100644 index 33f0fa0e1..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxClassParm.java +++ /dev/null @@ -1,99 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxClassParm.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Hashtable; - - - -/** -The PxClassParm class represents a Class -parameter in a proxy datastream. -**/ -class PxClassParm -extends PxStringParm -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private static Hashtable primitiveClasses_; - - - -/** -Static initializer. -**/ - static - { - primitiveClasses_ = new Hashtable (); - primitiveClasses_.put ("byte", Byte.TYPE); - primitiveClasses_.put ("short", Short.TYPE); - primitiveClasses_.put ("int", Integer.TYPE); - primitiveClasses_.put ("long", Long.TYPE); - primitiveClasses_.put ("float", Float.TYPE); - primitiveClasses_.put ("double", Double.TYPE); - primitiveClasses_.put ("char", Character.TYPE); - primitiveClasses_.put ("boolean", Boolean.TYPE); - - - } - - - -/** -Constructs a PxClassParm object. -**/ - public PxClassParm () - { - super (ProxyConstants.DS_CLASS_PARM); - } - - - -/** -Constructs a PxClassParm object. - -@param value The Class value. -**/ - public PxClassParm (Class value) - { - super (ProxyConstants.DS_CLASS_PARM, (value != null) ? value.getName () : ""); - } - - - -/** -Returns the Class value. - -@return The Class value. -**/ - public Class getClassValue () - throws ClassNotFoundException - { - String value = getStringValue (); - if (value.length () == 0) - return null; - - if (primitiveClasses_.containsKey (value)) - return (Class) primitiveClasses_.get (value); - else - return Class.forName (value); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxClientConnectionAdapter.java b/cvsroot/src/com/ibm/as400/access/PxClientConnectionAdapter.java deleted file mode 100644 index 3ad8a2ac9..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxClientConnectionAdapter.java +++ /dev/null @@ -1,444 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxClientConnectionAdapter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.net.*; - -// -// Tunneling is another mechanism to get to the server. This class now -// has two ways to get to the server: -// Traditional -- a socket connection is made to the server and a -// deamon thread is started to handly data coming back on the connection. -// Tunnel -- A URL connection is made for each data flow. The connection -// is made to our tunnel servelet running in the http server. -// - - -/** -The PxClientConnectionAdapter class represents the connection -to a proxy server. -**/ -abstract class PxClientConnectionAdapter -{ - private static final String copyright = "Copyrixght (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private boolean closed_ = false; - private InputStream input_ = null; - private OutputStream output_ = null; - private PxClientReadDaemon readDaemon_ = null; - private PxSocketContainerAdapter socket_ = null; - private SSLOptions sslOptions_ = null; - - // tunnel_ is used by the - // subclass ProxyClientConnection - // so it cannot be private - boolean tunnel_ = false; // @D1a - private long clientId_ = -1; // @D1a @D2C - private URL tunnelURL_ = null; // @D1a - - - protected PxClientConnectionAdapter (String proxyServer, SSLOptions secure) - { - // @D2D clientId_ = new byte[8]; - sslOptions_ = secure; - open (proxyServer); - } - - - -/** -Closes the connection to the proxy server. - // @D1a question -- should we do something in the tunneling case - // to clean up the server? -**/ - public void close () - { - if (!tunnel_) // @D1a - { - if (Trace.isTraceProxyOn ()) - Trace.log (Trace.PROXY, "Closing a connection to proxy server."); - - readDaemon_.stopSafely(); - - // I am using separate try-catch blocks to make sure - // that everything gets closed. - try { - input_.close (); - } - catch (IOException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, e.getMessage (), e); - throw new ProxyException (ProxyException.CONNECTION_DROPPED); - } - - try { - output_.close (); - } - catch (IOException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, e.getMessage (), e); - throw new ProxyException (ProxyException.CONNECTION_DROPPED); - } - - // $$ Question for Jim, his new class skipped the above - // two funtions -- input_.close() and output_.close(). - // If a good idea then remove from here as well. - try { - socket_.close (); - } - catch (IOException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, e.getMessage (), e); - throw new ProxyException (ProxyException.CONNECTION_DROPPED); - } - } - - closed_ = true; - } - - - - protected void finalize () - throws Throwable - { - if (closed_ == false) - close (); - super.finalize (); - } - - - - public PxDSFactory getFactory() - { - return readDaemon_.getFactory(); - } - - - public void open (String proxyServer) - { - boolean secure = (sslOptions_ != null && sslOptions_.proxyEncryptionMode_ != SecureAS400.PROXY_SERVER_TO_SERVER); - - if (Trace.isTraceOn()) Trace.log(Trace.PROXY, "Opening a connection to proxy server " - + proxyServer - + " (secure=" + secure + ")."); - - - // Parse the proxy server name, port number (and protocol if tunneling) - String localName = proxyServer; - String protocolName = null; - - int port = -1; - - // determine if we are going with traditional or tunnel proxy. - // Assume any string with a :// wants to use the tunnel. This would - // be http://, https://, etc. - if (proxyServer.indexOf("://") > 0) // @D1a - { - tunnel_ = true; - // the name of the server is everything beyond the :// - localName = proxyServer.substring(proxyServer.indexOf(":") + 3); - protocolName = proxyServer.substring(0, proxyServer.indexOf(":")); - } - - // now strip the port of the end of the server name (if one exists) - int colon = localName.indexOf(':'); - if (colon >= 0) - { - if (colon < localName.length() - 1) - port = Integer.parseInt(localName.substring (colon + 1)); - localName = localName.substring(0, colon); - } - - - if (! tunnel_) // @D1a - { - if (port < 0) - port = secure ? ProxyConstants.SECURE_PORT_NUMBER : ProxyConstants.PORT_NUMBER; //$B1C - openTraditional(localName, port, secure); - } - else - { - // when openTunnel comes back move creating tunnelURL_ to the try/catch. - openTunnel(protocolName, localName, port); // @D1a - } - } - - // this method used to be part of open. It was split out when - // tunneling was added. - void openTraditional(String name, int port, boolean secure) // @D1a - { - // Open the socket and streams. - try { - if (secure) { - // Call view reflection to remove dependency on sslight.zip - Class classPxSecureSocketContainer = Class.forName("com.ibm.as400.access.PxSecureSocketContainer"); - Class[] parameterTypes = new Class[3]; - parameterTypes[0] = "".getClass(); - parameterTypes[1] = Integer.TYPE; - parameterTypes[2] = Class.forName("com.ibm.as400.access.SSLOptions"); - Constructor constructor = classPxSecureSocketContainer.getConstructor(parameterTypes); - Object[] initargs = new Object[3]; - initargs[0] = name; - initargs[1] = new Integer(port); - initargs[2] = sslOptions_; - socket_ = (PxSocketContainerAdapter) constructor.newInstance(initargs); - } else - socket_ = new PxSocketContainer (name, port); - output_ = new BufferedOutputStream (socket_.getOutputStream()); - input_ = new BufferedInputStream(new RetryInputStream(socket_.getInputStream())); // @A2C - - readDaemon_ = new PxClientReadDaemon(input_); - readDaemon_.start(); - - if (Trace.isTraceProxyOn ()) - Trace.log (Trace.PROXY, "Connection established."); - } - catch (ClassNotFoundException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error when opening connection to proxy server (ClassNotFound", e); - throw new ProxyException (ProxyException.CONNECTION_NOT_ESTABLISHED); - } - catch (NoSuchMethodException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error when opening connection to proxy server (NoSuchMethodException", e); - throw new ProxyException (ProxyException.CONNECTION_NOT_ESTABLISHED); - } - catch (IllegalAccessException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error when opening connection to proxy server (IllegalAccessException", e); - throw new ProxyException (ProxyException.CONNECTION_NOT_ESTABLISHED); - } - catch (IOException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error when opening connection to proxy server (openio", e); - throw new ProxyException (ProxyException.CONNECTION_NOT_ESTABLISHED); - } catch (IllegalArgumentException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error when opening connection to proxy server (IllegalArgumentException", e); - throw new ProxyException (ProxyException.CONNECTION_NOT_ESTABLISHED); - } catch (InstantiationException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error when opening connection to proxy server (InstantiationException", e); - throw new ProxyException (ProxyException.CONNECTION_NOT_ESTABLISHED); - } catch (InvocationTargetException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error when opening connection to proxy server (InvocationTargetException", e); - throw new ProxyException (ProxyException.CONNECTION_NOT_ESTABLISHED); - } - } - - - // @D1a New method - void openTunnel(String protocol, String name, int port) - { - try - { - readDaemon_ = new PxClientReadDaemon(); - readDaemon_.register(new PxAcceptRepCV()); - - if (port < 0) - tunnelURL_ = new URL(protocol, name, "/servlet/com.ibm.as400.access.TunnelProxyServer"); - else - tunnelURL_ = new URL(protocol, name, port, "/servlet/com.ibm.as400.access.TunnelProxyServer"); - } - catch (IOException e) - { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error when opening connection to proxy server", e); - throw new ProxyException (ProxyException.CONNECTION_NOT_ESTABLISHED); - } - } - - - // @D1a New method - private URLConnection tunnelSend(PxReqCV request) - { - try - { - URLConnection connection_; - - // @D2D if (clientId_ == null) - // @D2D request.setClientId(new byte[8]); - // @D2D else - request.setClientId(clientId_); - - // connection_ = (HttpURLConnection) tunnelURL_.openConnection(); - connection_ = tunnelURL_.openConnection(); - - connection_.setUseCaches(false); - connection_.setDoOutput(true); - connection_.setDoInput(true); - - connection_.setRequestProperty("Content-type", "application/octet-stream"); - connection_.setRequestProperty("Connection", "Keep-Alive"); - // connection_.setRequestMethod("POST"); - // connection_.setFollowRedirects(false); - // connection.setRequestProperty("Content-length", " " + bytes.length) - - // connection_.connect(); - OutputStream connectionOut = connection_.getOutputStream(); - - if (Trace.isTraceProxyOn()) - request.dump (Trace.getPrintWriter ()); - - request.writeTo(connectionOut); - connectionOut.flush(); - // connectionOut.close(); - - return connection_; - } - catch (Exception e) - { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error when opening connection to proxy server", e); - throw new ProxyException (ProxyException.CONNECTION_NOT_ESTABLISHED); - } - } - - - - Object tunnelReceive(long correlationId, URLConnection connection_) - throws InvocationTargetException - { - try - { - InputStream connectionIn = connection_.getInputStream(); - - PxRepCV reply; - Object returnValue; - try - { - reply = (PxRepCV) readDaemon_.getReply(correlationId, connectionIn); - returnValue = reply.process (); - clientId_ = reply.getClientId(); - return returnValue; - } - catch (IOException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error when receiving reply from proxy server", e); - throw new ProxyException (ProxyException.CONNECTION_DROPPED); - } - } - catch (InvocationTargetException ite) - { - throw ite; - } - catch (Exception e) - { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error when opening connection to proxy server", e); - throw new ProxyException (ProxyException.CONNECTION_NOT_ESTABLISHED); - } - } - - - - // Note: This method should NOT be synchronized. If a thread is waiting to // @A1A - // receive a reply, it should not block other threads from sending requests. // @A1A - // (This is the point of the read daemon thread.) // @A1A - private Object receive (long correlationId) // @A1C - throws InvocationTargetException - { - Object returnValue = null; - - PxRepCV reply; - try { - reply = (PxRepCV) readDaemon_.getReply(correlationId); - returnValue = reply.process (); - } - catch (IOException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error when receiving reply from proxy server", e); - throw new ProxyException (ProxyException.CONNECTION_DROPPED); - } - - return returnValue; - } - - - -/** -Sends a request to the proxy server. No reply is expected. - -@param request The request. -**/ - protected synchronized void send (PxReqCV request) - { - - if (! tunnel_) // @D1a - { - if (Trace.isTraceProxyOn()) - request.dump (Trace.getPrintWriter ()); - - try { - request.writeTo (output_); - output_.flush (); - } - catch (IOException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, e.getMessage (), e); - throw new ProxyException (ProxyException.CONNECTION_DROPPED); - } - } - else - { - URLConnection connection_ = tunnelSend(request); // @D1a - // $$1 do something with the connection - } - } - - - -/** -Sends a request to the proxy server and receives and processes a reply. - -@param request The request. -@return The returned object, or null if none. -**/ - // Note: This method should NOT be synchronized. If a thread is waiting to // @A1A - // receive a reply, it should not block other threads from sending requests. // @A1A - // (This is the point of the read daemon thread.) // @A1A - protected Object sendAndReceive (PxReqCV request) // @A1C - throws InvocationTargetException - { - if (! tunnel_) // @D1a - { - send (request); - return receive (request.getCorrelationId()); - } - else // @D1a - { - // cannot use HttpURLConnection in IE or Netscape so use URLConnection instead - - URLConnection connection_ = tunnelSend(request); // @D1a - Object o = tunnelReceive(request.getCorrelationId(), connection_); // @D1a - // return tunnelReceive(request.getCorrelationId(), connection_); // @D1a - return o; - } // @D1a - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/PxClientReadDaemon.java b/cvsroot/src/com/ibm/as400/access/PxClientReadDaemon.java deleted file mode 100644 index 0ac67e60c..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxClientReadDaemon.java +++ /dev/null @@ -1,268 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxClientReadDaemon.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// -// Tunneling -- HTTP is stateless which means there is no persistent -// connection between the client and server. With tunneling, a connection -// is made, data sent and received, then disconnected. This class now -// has two personalities: -// 1) normal proxy -- start a background thread that sits on -// on the connection waiting for data. When -// data arrives, handle it (possible asnychronous processing). -// 2) tunnel proxy -- no additional thread is started. When it is time -// to read data a connection is passed to this class. -// - -import java.util.Hashtable; -import java.io.EOFException; -import java.io.InputStream; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -// @B1D import java.net.SocketException; // @A1A - - - -/** -The PxClientReadDaemon class represents a read daemon for reading -replies from the proxy server. -**/ -class PxClientReadDaemon -extends StoppableThread -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private PxDSFactory factory_ = new PxDSFactory(); - private InputStream input_; - private InvocationTargetException invocationTargetException_ = null; - private IOException ioException_ = null; - private Hashtable replies_ = new Hashtable(); - private boolean running_ = false; - private boolean started_ = false; - - - // @D1a new c'tor - // Use this c'tor when Tunneling - public PxClientReadDaemon () - { - super("Proxy client read daemon-" + newId()); - - // Mark this as a daemon thread so that its running does - // not prevent the JVM from going away. - setDaemon(true); - } - - - public PxClientReadDaemon (InputStream input) - { - super("Proxy client read daemon-" + newId()); - - // Mark this as a daemon thread so that its running does - // not prevent the JVM from going away. - setDaemon(true); - - input_ = input; - } - - - public PxDSFactory getFactory() - { - return factory_; - } - - - // Traditional proxy uses this method. - public PxRepCV getReply(long correlationId) - throws InvocationTargetException, IOException - { - Long key = new Long(correlationId); - - // Loop and poll, until the correct reply has been read by the - // read daemon thread. - while(true) { - - // If any relevant exceptions were caught by the read daemon - // thread, then throw them now. - if (ioException_ != null) - throw ioException_; - if (invocationTargetException_ != null) - throw invocationTargetException_; - - // Look in the hashtable to see if the correct reply has been - // read. - synchronized(this) { - if (replies_.containsKey(key)) { - PxRepCV reply = (PxRepCV)replies_.get(key); - replies_.remove(key); - return reply; - } - - // If not found, but the read daemon is still running, - // then wait patiently and efficiently. - if (running_ || !started_) { - try { - wait(); - } - catch(InterruptedException e) { - // Ignore. - } - } - - // If not found, but the read daemon has stopped, then - // give up hope, something strange has happened. - else { - if (Trace.isTraceErrorOn()) - Trace.log(Trace.ERROR, "Proxy read daemon stopped, but replies are expected."); - throw new InternalErrorException(InternalErrorException.PROTOCOL_ERROR); - } - } - } - } - - - - public void register(PxDSRV datastream) - { - factory_.register(datastream); - } - - - // A thread is created only when using traditional proxy. - public void run() - { - started_ = true; - running_ = true; - // @B1D int exceptionCounter = 0; // @A1A - - PxRepCV reply; - try { - while (canContinue()) { - // @B1D try { // @A1A - reply = (PxRepCV)factory_.getNextDS(input_); - if (Trace.isTraceProxyOn()) - reply.dump (Trace.getPrintWriter ()); - - // @B1D // We had a successful read, reset the exception counter. // @A1A - // @B1D exceptionCounter = 0; // @A1A - - // If the correlation id is set, just store the reply - // in the hashtable. This means that somebody is - // waiting for it and they will ask for it when the - // time is right. - long correlationId = reply.getCorrelationId(); - if (correlationId >= 0) { - synchronized(this) { - replies_.put(new Long(correlationId), reply); - notifyAll(); - } - } - - // Otherwise, process it and forget about it! - else - reply.process(); - // @B1D } // @A1A - // @B1D catch(SocketException e) { // @A1A - // @B1D // Ignore this. Netscape is throwing this in certain // @A1A - // @B1D // situations. Try again and it will go away! // @A1A - // @B1D // If we get it a few times in a row, then rethrow it. // @A1A - // @B1D if (++exceptionCounter >= 3) // @A1A - // @B1D throw e; // @A1A - // @B1D } // @A1A - } - } - catch(InvocationTargetException e) { - invocationTargetException_ = e; - } - catch(IOException e) { - - // If an exception is thrown AND the thread was stopped safely, - // then ignore the exception, i.e., assume the exception just - // resulted in the socket being closed. - if ((! wasStoppedSafely()) && (!(e instanceof EOFException))) { - ioException_ = e; - if (Trace.isTraceErrorOn ()) - Trace.log(Trace.ERROR, "Ending read daemon", e); - } - - // No need to throw exception (there is nobody to catch it!) - // Simply, end the thread. - synchronized(this) { - notifyAll(); - } - } - - running_ = false; - } - - // @D1a new method. - // This method is used when tunneling. The CID and stream to read are - // passed each time we retrieve data from the server. - public PxRepCV getReply(long CID, InputStream input_) - throws InvocationTargetException, IOException - { - // try - // { - Long key = new Long(CID); - - if (replies_.containsKey(key)) - { - PxRepCV reply = (PxRepCV)replies_.get(key); - replies_.remove(key); - return reply; - } - - while(true) - { - PxRepCV reply; - reply = (PxRepCV)factory_.getNextDS(input_); - - if (Trace.isTraceProxyOn()) - reply.dump (Trace.getPrintWriter ()); - - - // If the correlation id is set, just store the reply - // in the hashtable. This means that somebody is - // waiting for it and they will ask for it when the - // time is right. - long correlationId = reply.getCorrelationId(); - if (correlationId != CID) - replies_.put(new Long(correlationId), reply); - else - { - reply.process(); - return reply; - } - } - // } - // catch(InvocationTargetException e) - // { - // invocationTargetException_ = e; - // } - // catch(IOException e) - // { - // if (Trace.isTraceErrorOn ()) - // Trace.log(Trace.ERROR, "Ending read daemon", e); - // - // } - // running_ = false; - // return null; - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/PxCompDS.java b/cvsroot/src/com/ibm/as400/access/PxCompDS.java deleted file mode 100644 index 90e41ad46..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxCompDS.java +++ /dev/null @@ -1,252 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxCompDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.util.Vector; - - - -/** -The PxCompDS class represents a datastream -which contains 0 or more PxParms. -**/ -abstract class PxCompDS -extends PxDS -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private Vector parameters_ = new Vector (); - - - -/** -Constructs a PxCompDS object. - -@param type The datastream type. Valid values are listed in - the ProxyConstants class. -**/ - public PxCompDS (short type) - { - super (type); - } - - - - public void addObjectParm(Object object) - { - addObjectParm(null, object); - } - - - - public void addObjectParm(PxTable pxTable, Object object) - { - PxParm parameter; - - // If the object is null, add it as such. - if (object == null) - parameter = new PxNullParm (); - - // If the object is a primitive type, add it as such. - else if (object instanceof Byte) - parameter = new PxByteParm (((Byte) object)); - else if (object instanceof Short) - parameter = new PxShortParm (((Short) object)); - else if (object instanceof Integer) - parameter = new PxIntParm (((Integer) object)); - else if (object instanceof Long) - parameter = new PxLongParm (((Long) object)); - else if (object instanceof Float) - parameter = new PxFloatParm (((Float) object)); - else if (object instanceof Double) - parameter = new PxDoubleParm (((Double) object)); - else if (object instanceof Character) - parameter = new PxCharParm (((Character) object)); - else if (object instanceof Boolean) - parameter = new PxBooleanParm (((Boolean) object)); - - // If the object is a String, add it as such. - else if (object instanceof String) - parameter = new PxStringParm ((String) object); - - // If the object is a proxy object, then send only the proxy - // id. Otherwise, if it is a non-proxy Toolbox object, send - // it as a PxToolboxParm, since it may contain a proxy object, - // it can't be serialized simply. Anything else (non-Toolbox) - // gets to be serialized. - else { - long proxyId = -1; - if (object instanceof ProxyImpl) - proxyId = ((ProxyImpl) object).getPxId(); - else if (pxTable != null) - proxyId = pxTable.get (object); - - if (proxyId >= 0) - parameter = new PxPxObjectParm (proxyId); - else if (object.getClass().getName().startsWith("com.ibm.as400.access")) - parameter = new PxToolboxObjectParm(object); - else - parameter = new PxSerializedObjectParm (object); - } - - addParm (parameter); - } - - - -/** -Appends a parameter to the datastream. - -@param parameter The parameter. -**/ - public void addParm (PxParm parameter) - { - parameters_.addElement (parameter); - } - - - -/** -Clears the parameters. -**/ - public void clearParms () - { - parameters_.removeAllElements (); - } - - - -/** -Returns a new copy of this datastream. - -@return A new copy of this datastream. - -@exception CloneNotSupportedException If the object cannot be cloned. -**/ -// -// Implementation note: This method is necessary in order to do -// a deep copy of the internal Vector. Otherwise, -// we run into problems with multiple threads. - public Object clone () - throws CloneNotSupportedException - { - PxCompDS clone = (PxCompDS)super.clone(); - clone.parameters_ = (Vector)parameters_.clone(); - return clone; - } - - - -/** -Dumps the datastream for debugging and tracing. - -@param output The print writer. -**/ - public void dump (PrintWriter output) - { - synchronized (output) { - super.dump (output); - int numberOfParms = parameters_.size (); - for (int j = 0; j < numberOfParms; ++j) { - output.println (" " + parameters_.elementAt (j).toString ()); - } - } - - } - - - -/** -Returns a parameter. - -@param i The parameter index (0-based). -@return The parameter. -**/ - public PxParm getParm (int i) - { - return (PxParm) parameters_.elementAt (i); - } - - - -/** -Returns the parameter count. - -@return The parameter count. -**/ - public int getParmCount () - { - return parameters_.size (); - } - - - - -//@A1M -/** -Loads this datastream by reading from an input stream. - -@param input The input stream. -@param factory The datastream factory. This is sometimes - needed when datastreams are nested. - -@exception IOException If an error occurs. -**/ - public void readFrom (InputStream input, PxDSFactory factory) - throws IOException - { - super.readFrom (input, factory); - DataInputStream dataInput = new DataInputStream (input); - clearParms (); - int numberOfParms = dataInput.readInt (); - for (int i = 0; i < numberOfParms; ++i) { - PxParm parameter = (PxParm) factory.getNextDS (input); - addParm (parameter); - } - } - - - - -/** -Writes the contents of the datastream to an output stream. - -@param output The output stream. - -@exception IOException If an error occurs. -**/ - public void writeTo (OutputStream output) - throws IOException - { - super.writeTo (output); - DataOutputStream dataOutput = new DataOutputStream (output); - int numberOfParms = getParmCount (); - dataOutput.writeInt (numberOfParms); - for (int i = 0; i < numberOfParms; ++i) { - getParm (i).writeTo (output); - } - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxConfigReqCV.java b/cvsroot/src/com/ibm/as400/access/PxConfigReqCV.java deleted file mode 100644 index 05dc031d6..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxConfigReqCV.java +++ /dev/null @@ -1,45 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxConfigReqCV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The PxConfigReqCV class represents the -client view of a configure request. -**/ -class PxConfigReqCV -extends PxReqCV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a PxConfigReqCV object. - -@param config The configuration. -**/ - public PxConfigReqCV (PSConfig config) - { - super (ProxyConstants.DS_CONFIGURE_REQ); - addParm (new PxSerializedObjectParm (config.getProperties ())); - - - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxConfigReqSV.java b/cvsroot/src/com/ibm/as400/access/PxConfigReqSV.java deleted file mode 100644 index aea9309ec..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxConfigReqSV.java +++ /dev/null @@ -1,83 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxConfigReqSV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.Properties; - - - -/** -The PxConfigReqSV class represents the server -view of a configure request. -**/ -class PxConfigReqSV -extends PxReqSV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - // Private data. - private PSConfig config_; - private PSController controller_; - - - -/** -Constructs a PxConfigReqSV object. - -@param config The configuration. -@param controller The proxy server controller. -**/ - public PxConfigReqSV (PSConfig config, PSController controller) - { - super (ProxyConstants.DS_CONFIGURE_REQ); - config_ = config; - controller_ = controller; - } - - - -/** -Processes the request. - -@return The corresponding reply, or null if none. -**/ - public PxRepSV process () - { - InetAddress clientAddress = controller_.getClientAddress (); - try { - // Honor this request only if the client is running on the - // same system as the server. - if (InetAddress.getLocalHost ().equals (clientAddress)) { - - // Get the configuration properties from the parameter and apply - // it to the current configuration. - Properties configProperties = (Properties) ((PxParm) getParm (0)).getObjectValue (); - config_.apply (configProperties); - } - } - catch (UnknownHostException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error while chaning configuration", e); - } - - return null; - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/PxConnectReqCV.java b/cvsroot/src/com/ibm/as400/access/PxConnectReqCV.java deleted file mode 100644 index 2bc2e19e3..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxConnectReqCV.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxConnectReqCV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The PxConnectReqCV class represents the -client view of a connect request. -**/ -class PxConnectReqCV -extends PxReqCV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a PxConnectReqCV object. - -@param modification The modification level of the - IBM Toolbox for Java. -@param rejections The number of rejections. This is the - number of times the client has tried - to connect to a proxy server and been - rejected. -@param clientLocale The client locale. -**/ - public PxConnectReqCV (String modification, - int rejections, - String clientLocale, - short normalOrTunnel) // @D1a - { - super (normalOrTunnel); // @D1c - addParm (new PxStringParm (modification)); - addParm (new PxIntParm (rejections)); - addParm (new PxStringParm (clientLocale)); - - - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxConnectReqSV.java b/cvsroot/src/com/ibm/as400/access/PxConnectReqSV.java deleted file mode 100644 index d1034f5c9..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxConnectReqSV.java +++ /dev/null @@ -1,91 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxConnectReqSV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Vector; - -// The PxConnectReqSV class represents the server view of a connect request. -class PxConnectReqSV extends PxReqSV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // MRI. - private static final String PROXY_CONNECTION_ACCEPTED_ = ResourceBundleLoader.getText("PROXY_CONNECTION_ACCEPTED"); - private static final String PROXY_CONNECTION_REDIRECTED_ = ResourceBundleLoader.getText("PROXY_CONNECTION_REDIRECTED"); - private static final String PROXY_CONNECTION_REJECTED_ = ResourceBundleLoader.getText("PROXY_CONNECTION_REJECTED"); - - // Private data. - private PSController controller_; - private PSLoad load_; - private PSLoadBalancer loadBalancer_; - private Vector threadGroup_; - - // Constructs a PxConnectReqSV object. - // @param threadGroup The thread group. - // @param controller The controller. - // @param load The load. - // @param loadBalancer The load balancer. - // @param secure true if this is for a secure connection, false otherwise. - public PxConnectReqSV(Vector threadGroup, PSController controller, PSLoad load, PSLoadBalancer loadBalancer) - { - super(ProxyConstants.DS_CONNECT_REQ); - - controller_ = controller; - load_ = load; - loadBalancer_ = loadBalancer; - threadGroup_ = threadGroup; - } - - // Processes the request. - // @return The corresponding reply, or null if none. - public PxRepSV process() - { - // Read information from request. - String modification = ((PxStringParm)getParm(0)).getStringValue(); - int rejectionCount = ((PxIntParm)getParm(1)).getIntValue(); - String clientLocale = ((PxStringParm)getParm(2)).getStringValue(); - - // Decide whether to accept or reject. - PxRepSV reply; - String peer = loadBalancer_.accept(rejectionCount); - - // If accepted, then start up a thread for the connection. - if (peer == null) - { - reply = new PxAcceptRepSV(); - - PSConnection connection = new PSConnection(controller_.getConnectionId(), controller_.getConnectedSocket(), controller_.getInputStream(), controller_.getOutputStream(), load_); - connection.start(); - threadGroup_.addElement(connection); - - Verbose.println(ResourceBundleLoader.substitute(PROXY_CONNECTION_ACCEPTED_, new Object[] { controller_, controller_.getClientAddress(), Long.toString(controller_.getConnectionId()) } )); - } - - // If rejected, then do nothing. - else - { - reply = new PxRejectRepSV(peer); - if (peer.length() == 0) - { - Verbose.println(ResourceBundleLoader.substitute(PROXY_CONNECTION_REJECTED_, controller_, controller_.getClientAddress())); - } - else - { - Verbose.println(ResourceBundleLoader.substitute(PROXY_CONNECTION_REDIRECTED_, new Object[] { controller_, controller_.getClientAddress(), peer })); - } - } - - return reply; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/PxConnectTunnelReqCV.java b/cvsroot/src/com/ibm/as400/access/PxConnectTunnelReqCV.java deleted file mode 100644 index 010cceb55..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxConnectTunnelReqCV.java +++ /dev/null @@ -1,46 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxConnectTunnelReqCV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// -// Tunneling -- HTTP is stateless so a mechanism is required to identify an -// instance of the client to the server. The mechanism is the client ID. -// An eight byte ID is appended to the end of data stream if connected -// to the server via tunneling. The ID is generated by the server and returned -// to the client with the connect reply. This class is the connect via tunnel -// request. In addition to doing normal connect processing the server will -// create a client ID. -// - -/** -The PxConnectTunnelReqCV class represents the -client view of a connect via HTTP tunnel request. -**/ -class PxConnectTunnelReqCV -extends PxReqCV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a PxConnectTunnelReqCV object. -**/ - public PxConnectTunnelReqCV () - { - super (ProxyConstants.DS_CONNECT_TUNNEL_REQ); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxConstructorReqCV.java b/cvsroot/src/com/ibm/as400/access/PxConstructorReqCV.java deleted file mode 100644 index 428f06147..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxConstructorReqCV.java +++ /dev/null @@ -1,51 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxConstructorReqCV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.Constructor; - - - -/** -The PxConstructorReqCV class represents the -client view of a constructor request. -**/ -class PxConstructorReqCV -extends PxReqCV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a PxConstructorReqCV object. - -@param className The class name. -@param flag true to tack on ImplRemote to the class name, - false to use the class name, as-is. -**/ - public PxConstructorReqCV (String className, boolean flag) - { - super (ProxyConstants.DS_CONSTRUCTOR_REQ); - - addParm (new PxStringParm (className)); - addParm (new PxBooleanParm (flag)); - - - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxConstructorReqSV.java b/cvsroot/src/com/ibm/as400/access/PxConstructorReqSV.java deleted file mode 100644 index 81e4dbd66..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxConstructorReqSV.java +++ /dev/null @@ -1,67 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxConstructorReqSV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.lang.reflect.Constructor; - - - -/** -The PxConstructorReqSV class represents the -server view of a constructor request. -**/ -class PxConstructorReqSV -extends PxReqSV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private static final Object[] noArguments_ = new Object[0]; - private static final boolean[] noReturnArguments_ = new boolean[0]; - - private PxTable pxTable_; - - - - public PxConstructorReqSV(PxTable pxTable) - { - super (ProxyConstants.DS_CONSTRUCTOR_REQ); - pxTable_ = pxTable; - } - - - - public PxRepSV process() - { - // Get the information from the datastream parameters. - String className = ((PxStringParm) getParm (0)).getStringValue (); - boolean flag = ((PxBooleanParm)getParm(1)).getBooleanValue(); - - // Construct the object. - String classNameToLoad = (flag ? (className + "ImplRemote") : className); - Object object = AS400.loadImpl (classNameToLoad); - - // Add the object to the object table. - long proxyId = pxTable_.addClientId (getClientId(), object); //@A1C - - // Return the proxy id. - return new PxReturnRepSV (pxTable_, object, noArguments_, noReturnArguments_); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxDS.java b/cvsroot/src/com/ibm/as400/access/PxDS.java deleted file mode 100644 index f6441b665..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxDS.java +++ /dev/null @@ -1,137 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.DataOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintWriter; - - - -/** -The PxDS is the super class for all proxy datastreams. -**/ -abstract class PxDS -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private short type_ = -1; - - - -/** -Constructs a PxDS object. - -@param type The datastream type. Valid values are - in the ProxyConstants class. It is assumed that - the caller is passing a valid type. -**/ - public PxDS (short type) - { - type_ = type; - } - - - -/** -Returns a new copy of this datastream. - -@return A new copy of this datastream. - -@exception CloneNotSupportedException If the object cannot be cloned. -**/ - public Object clone () - throws CloneNotSupportedException - { - return super.clone (); - } - - - -/** -Dumps the datastream for debugging and tracing. - -@param output The print writer to which to dump the datastream. -**/ - public void dump (PrintWriter output) - { - output.println ("DS: " + this); - - } - - - -/** -Returns the datastream type. - -@return The datastream type. -**/ - public short getType () - { - return type_; - } - - - -/** -Loads this datastream by reading from an input stream. - -@param input The input stream. -@param factory The datastream factory. This is sometimes - needed when datastreams are nested. - -@exception IOException If an error occurs. -**/ - public void readFrom (InputStream input, PxDSFactory factory) - throws IOException - { - } - - - -/** -Returns the String representation of the datastream. - -@return The String representation of the datastream. -**/ - public String toString () - { - String fullyQualifiedClassName = getClass ().getName (); - return fullyQualifiedClassName.substring (fullyQualifiedClassName.lastIndexOf ('.') + 1); - } - - - -/** -Writes the contents of the datastream to an output stream. - -@param output The output stream. - -@exception IOException If an error occurs. -**/ - public void writeTo (OutputStream output) - throws IOException - { - DataOutputStream dataOutput = new DataOutputStream (output); - dataOutput.writeShort (getType ()); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxDSFactory.java b/cvsroot/src/com/ibm/as400/access/PxDSFactory.java deleted file mode 100644 index 5cb62f848..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxDSFactory.java +++ /dev/null @@ -1,112 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxDSFactory.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.DataInputStream; -import java.io.InputStream; -import java.io.IOException; -import java.util.Hashtable; - - - -/** -The PxDSFactory class manufactures new instances -of datastream objects as they are read from an input stream. -**/ -class PxDSFactory -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private Hashtable factory_ = new Hashtable (); - - - -/** -Returns the next datastream object from the input stream. - -@param input The input stream. -@return The next datastream object. - -@exception If an error occurs. -**/ - public PxDSRV getNextDS (InputStream input) - throws IOException - { - // Read the type of the next datastream. - DataInputStream dataInput = new DataInputStream (input); - Short type = new Short (dataInput.readShort()); - - // If we know how to deal with this type, then manufacture - // a new instance. - if (factory_.containsKey (type)) { - PxDSRV template = (PxDSRV) factory_.get (type); - if (Trace.isTraceProxyOn()) - Trace.log(Trace.PROXY, "Factory read ds type " + type + " (" + template + ")."); - - // We can not use the datastream template directly from the - // hashtable, since we may need more than one at a time. Instead, - // we make a copy of it. - PxDSRV datastream = null; - try { - datastream = (PxDSRV) template.clone (); - } - catch (CloneNotSupportedException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Clone error in ds factory", e); - } - - // Loads the datastream by reading data from the input stream. The - // actually datastream subclass implements the details. - datastream.readFrom (input, this); - return datastream; - } - - // Otherwise, this is an internal error. If this happens, - // make sure that all datastreams that you are expecting - // are registered with this factory. - else { - if (Trace.isTraceProxyOn()) - Trace.log(Trace.PROXY, "Factory read ds type " + type + "."); - if (Trace.isTraceOn ()) - Trace.log (Trace.ERROR, "Ds type " + type + " not registered in factory."); - throw new InternalErrorException (InternalErrorException.DATA_STREAM_UNKNOWN); - } - } - - - -/** -Registers a datastream with this factory. DSs must be -registered in order to be recognized when they are read. - -@param datastream The datastream. -**/ - public void register (PxDSRV datastream) - { - // Add the class to the factory. - Short key = new Short (datastream.getType ()); - if (factory_.contains (key)) - throw new InternalErrorException (InternalErrorException.PROTOCOL_ERROR); - factory_.put (key, datastream); - - - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxDSRV.java b/cvsroot/src/com/ibm/as400/access/PxDSRV.java deleted file mode 100644 index 9745040ff..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxDSRV.java +++ /dev/null @@ -1,65 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxDSRV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.IOException; - - - -/** -The PxDSRV interface represents the set of -methods that are needed by the reader of a datastream. -**/ -interface PxDSRV -extends Cloneable -{ - - - -/** -Returns a new copy of this datastream. - -@return A new copy of this datastream. - -@exception CloneNotSupportedException If the object cannot be cloned. -**/ - public abstract Object clone () - throws CloneNotSupportedException; - - - -/** -Returns the datastream type. - -@return The datastream type. -**/ - public abstract short getType (); - - - -/** -Loads this datastream by reading from an input stream. - -@param input The input stream. -@param factory The datastream factory. This is sometimes - needed when datastreams are nested. - -@exception IOException If an error occurs. -**/ - public abstract void readFrom (InputStream input, PxDSFactory factory) - throws IOException; - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxDSWV.java b/cvsroot/src/com/ibm/as400/access/PxDSWV.java deleted file mode 100644 index eeeb00d16..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxDSWV.java +++ /dev/null @@ -1,41 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxDSWV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - - - -/** -The PxDSWV interface represents the set of -methods that are needed by the writer of a datastream. -**/ -interface PxDSWV -{ - - - -/** -Writes the contents of the datastream to an output stream. - -@param output The output stream. - -@exception IOException If an error occurs. -**/ - public abstract void writeTo (OutputStream input) - throws IOException; - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxDoubleParm.java b/cvsroot/src/com/ibm/as400/access/PxDoubleParm.java deleted file mode 100644 index 996298a49..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxDoubleParm.java +++ /dev/null @@ -1,150 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxDoubleParm.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; - - - -/** -The PxDoubleParm class represents a double -parameter in a proxy datastream. -**/ -class PxDoubleParm -extends PxDS -implements PxParm -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private double value_; - - - -/** -Constructs a PxDoubleParm object. -**/ - public PxDoubleParm () - { - super (ProxyConstants.DS_DOUBLE_PARM); - } - - - -/** -Constructs a PxDoubleParm object. - -@param value The double value. -**/ - public PxDoubleParm (double value) - { - super (ProxyConstants.DS_DOUBLE_PARM); - value_ = value; - } - - - -/** -Constructs a PxDoubleParm object. - -@param value The double value. -**/ - public PxDoubleParm (Double value) - { - this (value.doubleValue ()); - } - - - -/** -Returns the double value. - -@return The double value. -**/ - public double getDoubleValue () - { - return value_; - } - - - -/** -Returns the Object value. - -@return The Object value. -**/ - public Object getObjectValue () - { - return new Double (value_); - } - - - -/** -Loads this datastream by reading from an input stream. - -@param input The input stream. -@param factory The datastream factory. This is sometimes - needed when datastreams are nested. - -@exception IOException If an error occurs. -**/ - public void readFrom (InputStream input, PxDSFactory factory) - throws IOException - { - super.readFrom (input, factory); - DataInputStream dataInput = new DataInputStream (input); - value_ = dataInput.readDouble (); - } - - - -/** -Returns the String representation of the datastream. - -@return The String representation of the datastream. -**/ - public String toString () - { - - return super.toString () + " (" + value_ + ")"; - } - - - -/** -Writes the contents of the datastream to an output stream. - -@param output The output stream. - -@exception IOException If an error occurs. -**/ - public void writeTo (OutputStream output) - throws IOException - { - super.writeTo (output); - DataOutputStream dataOutput = new DataOutputStream (output); - dataOutput.writeDouble (value_); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxEndReqSV.java b/cvsroot/src/com/ibm/as400/access/PxEndReqSV.java deleted file mode 100644 index fe4bc75e9..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxEndReqSV.java +++ /dev/null @@ -1,99 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxEndReqSV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.UnknownHostException; - - - -/** -The PxEndReqSV class represents the -server view of a end request. -**/ -class PxEndReqSV -extends PxReqSV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String PROXY_SERVER_END_ = ResourceBundleLoader.getText ("PROXY_SERVER_END"); - private static final String PROXY_SERVER_END_REJECTED_ = ResourceBundleLoader.getText ("PROXY_SERVER_END_REJECTED"); - - - - // Private data. - private PSController controller_; - private ProxyServer proxyServer_; - - - -/** -Constructs a PxEndReqSV object. - -@param proxyServer The proxy server. -@param controller The proxy server controller. -**/ - public PxEndReqSV (ProxyServer proxyServer, PSController controller) - { - super (ProxyConstants.DS_END_REQ); - - proxyServer_ = proxyServer; - controller_ = controller; - } - - - -/** -Processes the request. - -@return The corresponding reply, or null if none. -**/ - public PxRepSV process () - { - InetAddress clientAddress = controller_.getClientAddress (); - try { - // Honor this request only if the client is running on the - // same system as the server. - if (InetAddress.getLocalHost ().equals (clientAddress)) { - - // Get the information from the datastream parameters. - boolean endJVM = ((PxBooleanParm) getParm (0)).getBooleanValue (); - - Verbose.println (ResourceBundleLoader.substitute (PROXY_SERVER_END_, clientAddress)); - - if (endJVM) - System.exit (0); - else - proxyServer_.stop (); - } - else - Verbose.println (ResourceBundleLoader.substitute (PROXY_SERVER_END_REJECTED_, clientAddress)); - } - catch (UnknownHostException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error while ending proxy server", e); - Verbose.println (ResourceBundleLoader.substitute (PROXY_SERVER_END_REJECTED_, clientAddress)); - } - - return null; - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/PxEventRepCV.java b/cvsroot/src/com/ibm/as400/access/PxEventRepCV.java deleted file mode 100644 index fbc3268c2..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxEventRepCV.java +++ /dev/null @@ -1,87 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxEventRepCV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Enumeration; -import java.util.EventObject; -import java.util.Vector; - - - -/** -The PxEventRepCV class represents the client -view of an event reply. -**/ -class PxEventRepCV -extends PxRepCV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private PxEventSupport eventSupport_; - - - -/** -Constructs a PxEventRepCV object. - -@param eventSupport The event support. -**/ - public PxEventRepCV (PxEventSupport eventSupport) - { - super (ProxyConstants.DS_EVENT_REP); - - eventSupport_ = eventSupport; - - - } - - - -/** -Processes the reply. - -@return The returned object, or null if none. -**/ - public Object process () - throws InvocationTargetException - { - try { - // Gather the contents of the datastream. - PxPxObjectParm eventSourceParm = (PxPxObjectParm) getParm (0); - long pxId = eventSourceParm.getPxId (); - String listenerInterfaceName = ((PxStringParm) getParm (1)).getStringValue (); - String listenerMethodName = ((PxStringParm) getParm (2)).getStringValue (); - EventObject eventObject = (EventObject) ((PxParm) getParm (3)).getObjectValue (); - - // Note: The event source never gets set! - - // Fire the event. - eventSupport_.fireEvent (pxId, listenerInterfaceName, listenerMethodName, eventObject); - return null; - } - catch (Exception e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Exception occured while processing event reply", e); - throw new InternalErrorException (InternalErrorException.PROTOCOL_ERROR); - } - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxEventRepSV.java b/cvsroot/src/com/ibm/as400/access/PxEventRepSV.java deleted file mode 100644 index d58b1eef6..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxEventRepSV.java +++ /dev/null @@ -1,47 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxEventRepSV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.EventObject; - - - -/** -The PxEventRepSV class represents the -server view of an event reply. -**/ -class PxEventRepSV -extends PxRepSV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - public PxEventRepSV (PxTable proxyTable, - long proxyId, - String listenerInterfaceName, - String listenerMethodName, - EventObject event) - { - super (ProxyConstants.DS_EVENT_REP); - addParm (new PxPxObjectParm (proxyId)); - addParm (new PxStringParm (listenerInterfaceName)); - addParm (new PxStringParm (listenerMethodName)); - addParm (new PxSerializedObjectParm (event)); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxEventSupport.java b/cvsroot/src/com/ibm/as400/access/PxEventSupport.java deleted file mode 100644 index f9321c3cc..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxEventSupport.java +++ /dev/null @@ -1,208 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxEventSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Enumeration; -import java.util.EventListener; -import java.util.EventObject; -import java.util.Hashtable; -import java.util.Vector; - - - -/** -The PxEventSupport class maintains the listener lists -for all proxy objects associated with a single -ProxyClientConnection. -**/ -// -// Implementation note: -// -// * This is implemented using a Hashtable where the -// keys are proxy ids (as Longs) and the elements -// are Vectors. The Vectors contain the list of listeners -// associated with the proxy id. -// -class PxEventSupport -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private Hashtable idToListeners_ = new Hashtable(); - - - -/** -Adds a listener. - -@return true if this is the first listener of its type - to be added to the proxy object, false otherwise. -**/ - public boolean addListener (long proxyId, EventListener listener) - { - boolean first = true; - Object key = toKey (proxyId); - - // If the table already contains a list for this proxy object... - if (idToListeners_.containsKey (key)) { - Vector listeners = (Vector) idToListeners_.get (key); - - // Look through the list to see if this is the first of - // its kind. - Class listenerClass = listener.getClass (); - Enumeration list = listeners.elements (); - while (list.hasMoreElements () && first) { - if (list.nextElement ().getClass ().equals (listenerClass)) - first = false; - } - - // Add the listener to the list. - listeners.addElement (listener); - } - - // Otherwise, create a new list for this proxy object. - else { - Vector listeners = new Vector (); - listeners.addElement (listener); - idToListeners_.put (key, listeners); - } - - return first; - } - - - - public void fireEvent (long proxyId, - String listenerInterfaceName, - String listenerMethodName, - EventObject eventObject) - throws InvocationTargetException - { - Object key = toKey (proxyId); - if (idToListeners_.containsKey (key)) { - - // Enumerate the list of listeners. - Vector listeners = (Vector) idToListeners_.get (key); - Enumeration list = listeners.elements (); - while (list.hasMoreElements ()) { - Object listener = list.nextElement (); - - // The list may contain several types of listeners. If this - // is not the right kind, then an exception will be thrown. - // We can ignore this exception, and assume the event does - // not need to be fired. - try { - // We need to get a reference to the listener interface class object. - // If we use the listener's class object, it may not work due to access - // restrictions. - Class interfaze = Class.forName(listenerInterfaceName); - Method listenerMethod = interfaze.getMethod (listenerMethodName, new Class[] { eventObject.getClass () }); - listenerMethod.invoke (listener, new Object[] { eventObject }); - } - catch (ClassNotFoundException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "ClassNotFoundException while firing event", e); - throw new ExtendedIllegalStateException (ExtendedIllegalStateException.PROXY_SERVER_EVENT_NOT_FIRED); - } - catch (NoSuchMethodException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "NoSuchMethodException while firing event", e); - throw new ExtendedIllegalStateException (ExtendedIllegalStateException.PROXY_SERVER_EVENT_NOT_FIRED); - } - catch (IllegalAccessException e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "IllegalAccessException while firing event", e); - throw new ExtendedIllegalStateException (ExtendedIllegalStateException.PROXY_SERVER_EVENT_NOT_FIRED); - } - } - } - } - - - - public void removeAll(long proxyId) - { - Object key = toKey (proxyId); - - if (idToListeners_.containsKey (key)) { - Vector listeners = (Vector) idToListeners_.get (key); - listeners.removeAllElements(); - idToListeners_.remove(key); - } - } - - - -/** -Removes a listener. - -@param proxyId The proxy id. -@param listener The listener. -@return true if this is the last listener of its type - to be removed from the proxy object, false otherwise. -**/ - public boolean removeListener (long proxyId, EventListener listener) - { - boolean last = true; - Object key = toKey (proxyId); - - // If the table contains a list for this proxy object... - if (idToListeners_.containsKey (key)) { - Vector listeners = (Vector) idToListeners_.get (key); - - // Remove the listener from the list. - listeners.removeElement (listener); - - // Look through the list to see if this was the last of - // its kind. - Class listenerClass = listener.getClass (); - Enumeration list = listeners.elements (); - while (list.hasMoreElements () && last) { - if (list.nextElement ().getClass ().equals (listenerClass)) - last = false; - } - - } - - // Otherwise, essentially do nothing. - else { - last = false; - } - - return last; - } - - - -/** -Returns the key associated with the proxy id. -This is for use in the internal hashtable. - -@param proxyId The proxy id. -@return The key. -**/ - private static Object toKey (long proxyId) - { - return new Long (proxyId); - } - - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxExceptionRepCV.java b/cvsroot/src/com/ibm/as400/access/PxExceptionRepCV.java deleted file mode 100644 index b45163697..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxExceptionRepCV.java +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxExceptionRepCV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; - - - -/** -The PxExceptionRepCV class represents the client -view of an excpetion reply. -**/ -class PxExceptionRepCV -extends PxRepCV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a PxExceptionRepCV object. -**/ - public PxExceptionRepCV () - { - super (ProxyConstants.DS_EXCEPTION_REP); - - } - - - -/** -Processes the reply. This always throws an exception, -namely the exception contained in the reply. - -@return The returned object, or null if none. -**/ - public Object process () - throws InvocationTargetException - { - Throwable e = ((Throwable) (((PxParm) getParm (0)).getObjectValue ())).fillInStackTrace (); - - if (Trace.isTraceErrorOn ()) { - String stackTrace = ((PxStringParm) getParm (1)).getStringValue (); - Trace.log (Trace.ERROR, "Exception thrown on proxy server: " + stackTrace, e); - } - - throw new InvocationTargetException (e); - } -} - - diff --git a/cvsroot/src/com/ibm/as400/access/PxExceptionRepSV.java b/cvsroot/src/com/ibm/as400/access/PxExceptionRepSV.java deleted file mode 100644 index 1e4939658..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxExceptionRepSV.java +++ /dev/null @@ -1,52 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxExceptionRepSV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -import java.io.PrintWriter; -import java.io.StringWriter; - - - -/** -The PxExceptionRepSV class represents the -server view of an exception reply. -**/ -class PxExceptionRepSV -extends PxRepSV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a PxExceptionRepSV object. -**/ - public PxExceptionRepSV (Throwable e) - { - super (ProxyConstants.DS_EXCEPTION_REP); - - // Get the stack trace. - StringWriter stringWriter = new StringWriter (); - e.printStackTrace (new PrintWriter (stringWriter, true)); - String stackTrace = stringWriter.toString (); - - addParm (new PxSerializedObjectParm (e)); - addParm (new PxStringParm (stackTrace)); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxFinalizeReqCV.java b/cvsroot/src/com/ibm/as400/access/PxFinalizeReqCV.java deleted file mode 100644 index 1848fb681..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxFinalizeReqCV.java +++ /dev/null @@ -1,45 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxFinalizeReqCV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The PxFinalizeReqCV class represents the -client view of a finalize request. -**/ -class PxFinalizeReqCV -extends PxReqCV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a PxFinalizeReqCV object. - -@param proxyId The proxy id. -**/ - public PxFinalizeReqCV (long proxyId) - { - super (ProxyConstants.DS_FINALIZE_REQ); - addParm (new PxPxObjectParm (proxyId)); - - - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxFinalizeReqSV.java b/cvsroot/src/com/ibm/as400/access/PxFinalizeReqSV.java deleted file mode 100644 index 177f314b4..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxFinalizeReqSV.java +++ /dev/null @@ -1,66 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxFinalizeReqSV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The PxFinalizeReqSV class represents the -server view of a finalize request. -**/ -class PxFinalizeReqSV -extends PxReqSV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private PxTable proxyTable_; - - - -/** -Constructs a PxFinalizeReqSV object. - -@param proxyTable The proxy table. -**/ - public PxFinalizeReqSV (PxTable proxyTable) - { - super (ProxyConstants.DS_FINALIZE_REQ); - proxyTable_ = proxyTable; - } - - - -/** -Processes the request. - -@return The corresponding reply, or null if none. -**/ - public PxRepSV process () - { - // Get the information from the datastream parameters. - Object proxy = ((PxPxObjectParm) getParm (0)).getObjectValue (); - - // Remove the object from the table. - proxyTable_.remove (proxy); - - // Return null (no reply). - return null; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxFloatParm.java b/cvsroot/src/com/ibm/as400/access/PxFloatParm.java deleted file mode 100644 index 76167e7a7..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxFloatParm.java +++ /dev/null @@ -1,149 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxFloatParm.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; - - - -/** -The PxFloatParm class represents a float -parameter in a proxy datastream. -**/ -class PxFloatParm -extends PxDS -implements PxParm -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private float value_; - - - -/** -Constructs a PxFloatParm object. -**/ - public PxFloatParm () - { - super (ProxyConstants.DS_FLOAT_PARM); - } - - - -/** -Constructs a PxFloatParm object. - -@param value The float value. -**/ - public PxFloatParm (float value) - { - super (ProxyConstants.DS_FLOAT_PARM); - value_ = value; - } - - - -/** -Constructs a PxFloatParm object. - -@param value The float value. -**/ - public PxFloatParm (Float value) - { - this (value.floatValue ()); - } - - - -/** -Returns the float value. - -@return The float value. -**/ - public float getFloatValue () - { - return value_; - } - - - -/** -Returns the Object value. - -@return The Object value. -**/ - public Object getObjectValue () - { - return new Float (value_); - } - - - -/** -Loads this datastream by reading from an input stream. - -@param input The input stream. -@param factory The datastream factory. This is sometimes - needed when datastreams are nested. - -@exception IOException If an error occurs. -**/ - public void readFrom (InputStream input, PxDSFactory factory) - throws IOException - { - super.readFrom (input, factory); - DataInputStream dataInput = new DataInputStream (input); - value_ = dataInput.readFloat (); - } - - -/** -Returns the String representation of the datastream. - -@return The String representation of the datastream. -**/ - public String toString () - { - - return super.toString () + " (" + value_ + ")"; - } - - - -/** -Writes the contents of the datastream to an output stream. - -@param output The output stream. - -@exception IOException If an error occurs. -**/ - public void writeTo (OutputStream output) - throws IOException - { - super.writeTo (output); - DataOutputStream dataOutput = new DataOutputStream (output); - dataOutput.writeFloat (value_); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxIntParm.java b/cvsroot/src/com/ibm/as400/access/PxIntParm.java deleted file mode 100644 index 0122348d8..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxIntParm.java +++ /dev/null @@ -1,150 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxIntParm.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; - - - -/** -The PxIntParm class represents a int -parameter in a proxy datastream. -**/ -class PxIntParm -extends PxDS -implements PxParm -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private int value_; - - - -/** -Constructs a PxIntParm object. -**/ - public PxIntParm () - { - super (ProxyConstants.DS_INT_PARM); - } - - - -/** -Constructs a PxIntParm object. - -@param value The int value. -**/ - public PxIntParm (int value) - { - super (ProxyConstants.DS_INT_PARM); - value_ = value; - } - - - -/** -Constructs a PxIntParm object. - -@param value The int value. -**/ - public PxIntParm (Integer value) - { - this (value.intValue ()); - } - - - -/** -Returns the int value. - -@return The int value. -**/ - public int getIntValue () - { - return value_; - } - - - -/** -Returns the Object value. - -@return The Object value. -**/ - public Object getObjectValue () - { - return new Integer (value_); - } - - - -/** -Loads this datastream by reading from an input stream. - -@param input The input stream. -@param factory The datastream factory. This is sometimes - needed when datastreams are nested. - -@exception IOException If an error occurs. -**/ - public void readFrom (InputStream input, PxDSFactory factory) - throws IOException - { - super.readFrom (input, factory); - DataInputStream dataInput = new DataInputStream (input); - value_ = dataInput.readInt (); - } - - - -/** -Returns the String representation of the datastream. - -@return The String representation of the datastream. -**/ - public String toString () - { - - return super.toString () + " (" + value_ + ")"; - } - - - -/** -Writes the contents of the datastream to an output stream. - -@param output The output stream. - -@exception IOException If an error occurs. -**/ - public void writeTo (OutputStream output) - throws IOException - { - super.writeTo (output); - DataOutputStream dataOutput = new DataOutputStream (output); - dataOutput.writeInt (value_); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxListenerReqCV.java b/cvsroot/src/com/ibm/as400/access/PxListenerReqCV.java deleted file mode 100644 index 4de629acd..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxListenerReqCV.java +++ /dev/null @@ -1,52 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxListenerReqCV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The PxListenerReqCV class represents the -client view of a listener request. -**/ -class PxListenerReqCV -extends PxReqCV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a PxListenerReqCV object. - -@param proxyId The proxy id. -@param operation The operation. -@param eventName The event name. -**/ - public PxListenerReqCV (long proxyId, - int operation, - String eventName) - { - super (ProxyConstants.DS_LISTENER_REQ); - - addParm (new PxPxObjectParm (proxyId)); - addParm (new PxIntParm (operation)); - addParm (new PxStringParm (eventName)); - - - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxListenerReqSV.java b/cvsroot/src/com/ibm/as400/access/PxListenerReqSV.java deleted file mode 100644 index 579809d09..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxListenerReqSV.java +++ /dev/null @@ -1,105 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxListenerReqSV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; - - - -/** -The PxListenerReqSV class represents the -server view of a listener request. -**/ -class PxListenerReqSV -extends PxReqSV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private PSConnection connection_; - private PxTable proxyTable_; - - - -/** -Constructs a PxListenerReqSV object. -**/ - public PxListenerReqSV (PSConnection connection, PxTable proxyTable) - { - super (ProxyConstants.DS_LISTENER_REQ); - - connection_ = connection; - proxyTable_ = proxyTable; - } - - - - private static final String operationToString (int operation) - { - switch (operation) { - case ProxyConstants.LISTENER_OPERATION_ADD: - return "add"; - case ProxyConstants.LISTENER_OPERATION_REMOVE: - return "remove"; - default: - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Invalid listener operation: " + operation); - throw new InternalErrorException (InternalErrorException.PROTOCOL_ERROR); - } - } - - - -/** -Processes the request. - -@return The corresponding reply, or null if none. -**/ - public PxRepSV process () - { - try { - // Get the information from the datastream parameters. - Object proxy = ((PxPxObjectParm) getParm (0)).getObjectValue (); - int operation = ((PxIntParm) getParm (1)).getIntValue (); - String eventName = ((PxStringParm) getParm (2)).getStringValue (); - - // Create a PSXxxListener object. - String listenerName = eventName + "Listener"; - Class listenerInterface = Class.forName ("com.ibm.as400.access." + listenerName); - Class listenerClass = Class.forName ("com.ibm.as400.access.PS" + listenerName); - Constructor constructor = listenerClass.getConstructor (new Class[] { PSConnection.class, PxTable.class, Long.TYPE }); - long proxyId = proxyTable_.get (proxy); - Object listener = constructor.newInstance (new Object[] { connection_, proxyTable_, new Long (proxyId) }); - - // Add/remove a PSXxxListener to/from the object. - Class proxyClass = proxy.getClass (); - Method xxxListener = proxyClass.getMethod (operationToString (operation) + listenerName, new Class[] { listenerInterface }); - xxxListener.invoke (proxy, new Object[] { listener }); - - // No reply expected. - return null; - } - catch (Exception e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, e.toString (), e); - throw new InternalErrorException (InternalErrorException.PROTOCOL_ERROR); - } - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxLoadRepCV.java b/cvsroot/src/com/ibm/as400/access/PxLoadRepCV.java deleted file mode 100644 index 45ec94c02..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxLoadRepCV.java +++ /dev/null @@ -1,61 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxLoadRepCV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; - - - -/** -The PxLoadRepCV class represents the client -view of a load reply. -**/ -class PxLoadRepCV -extends PxRepCV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a PxLoadRepCV object. -**/ - public PxLoadRepCV () - { - super (ProxyConstants.DS_LOAD_REP); - - } - - - -/** -Processes the reply. - -@return The returned object, or null if none. -**/ - public Object process () - throws InvocationTargetException - { - int activeConnections = ((PxIntParm) getParm (0)).getIntValue (); - int balanceThreshold = ((PxIntParm) getParm (1)).getIntValue (); - int maxConnections = ((PxIntParm) getParm (2)).getIntValue (); - - // Return a load object representing the information returned - // in the reply. - return new PSLoad (activeConnections, balanceThreshold, maxConnections); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxLoadRepSV.java b/cvsroot/src/com/ibm/as400/access/PxLoadRepSV.java deleted file mode 100644 index db0c933aa..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxLoadRepSV.java +++ /dev/null @@ -1,45 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxLoadRepSV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The PxLoadRepSV class represents the -server view of a load reply. -**/ -class PxLoadRepSV -extends PxRepSV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a PxLoadRepSV object. - -@param load The load. -**/ - public PxLoadRepSV (PSLoad load) - { - super (ProxyConstants.DS_LOAD_REP); - addParm (new PxIntParm (load.getActiveConnections ())); - addParm (new PxIntParm (load.getBalanceThreshold ())); - addParm (new PxIntParm (load.getMaxConnections ())); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxLoadReqCV.java b/cvsroot/src/com/ibm/as400/access/PxLoadReqCV.java deleted file mode 100644 index e31966f59..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxLoadReqCV.java +++ /dev/null @@ -1,41 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxLoadReqCV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The PxLoadReqCV class represents the -client view of a load request. -**/ -class PxLoadReqCV -extends PxReqCV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a PxLoadReqCV object. -**/ - public PxLoadReqCV () - { - super (ProxyConstants.DS_LOAD_REQ); - - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxLoadReqSV.java b/cvsroot/src/com/ibm/as400/access/PxLoadReqSV.java deleted file mode 100644 index e4f92b012..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxLoadReqSV.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxLoadReqSV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The PxLoadReqSV class represents the -server view of a load request. -**/ -class PxLoadReqSV -extends PxReqSV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - // Private data. - private PSLoad load_; - - - -/** -Constructs a PxLoadReqSV object. - -@param load The load. -**/ - public PxLoadReqSV (PSLoad load) - { - super (ProxyConstants.DS_LOAD_REQ); - load_ = load; - } - - - -/** -Processes the request. - -@return The corresponding reply, or null if none. -**/ - public PxRepSV process () - { - return new PxLoadRepSV (load_); - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/PxLongParm.java b/cvsroot/src/com/ibm/as400/access/PxLongParm.java deleted file mode 100644 index bbcdcb629..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxLongParm.java +++ /dev/null @@ -1,150 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxLongParm.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; - - - -/** -The PxLongParm class represents a long -parameter in a proxy datastream. -**/ -class PxLongParm -extends PxDS -implements PxParm -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private long value_; - - - -/** -Constructs a PxLongParm object. -**/ - public PxLongParm () - { - super (ProxyConstants.DS_LONG_PARM); - } - - - -/** -Constructs a PxLongParm object. - -@param value The long value. -**/ - public PxLongParm (long value) - { - super (ProxyConstants.DS_LONG_PARM); - value_ = value; - } - - - -/** -Constructs a PxLongParm object. - -@param value The long value. -**/ - public PxLongParm (Long value) - { - this (value.longValue ()); - } - - - -/** -Returns the long value. - -@return The long value. -**/ - public long getLongValue () - { - return value_; - } - - - -/** -Returns the Object value. - -@return The Object value. -**/ - public Object getObjectValue () - { - return new Long (value_); - } - - - -/** -Loads this datastream by reading from an input stream. - -@param input The input stream. -@param factory The datastream factory. This is sometimes - needed when datastreams are nested. - -@exception IOException If an error occurs. -**/ - public void readFrom (InputStream input, PxDSFactory factory) - throws IOException - { - super.readFrom (input, factory); - DataInputStream dataInput = new DataInputStream (input); - value_ = dataInput.readLong (); - } - - - -/** -Returns the String representation of the datastream. - -@return The String representation of the datastream. -**/ - public String toString () - { - - return super.toString () + " (" + value_ + ")"; - } - - - -/** -Writes the contents of the datastream to an output stream. - -@param output The output stream. - -@exception IOException If an error occurs. -**/ - public void writeTo (OutputStream output) - throws IOException - { - super.writeTo (output); - DataOutputStream dataOutput = new DataOutputStream (output); - dataOutput.writeLong (value_); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxMethodReqCV.java b/cvsroot/src/com/ibm/as400/access/PxMethodReqCV.java deleted file mode 100644 index 1b41504a2..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxMethodReqCV.java +++ /dev/null @@ -1,74 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxMethodReqCV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.Method; - - - -/** -The PxMethodReqCV class represents the -client view of a method request. -**/ -class PxMethodReqCV -extends PxReqCV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a PxMethodReqCV object. - -@param proxyId The proxy id. -@param methodName The method name. -@param argumentClasses The argument classes. -@param arguments The arguments. -@param returnArguments Whether return arguments are needed, or - null if none are needed. -@param asynchronous true if asynchronous, false otherwise. -@param factory true if method creates a proxy object, false otherwise. -**/ - public PxMethodReqCV(long proxyId, - String methodName, - Class[] argumentClasses, - Object[] arguments, - boolean[] returnArguments, - boolean asynchronous, - boolean factory) - { - super (ProxyConstants.DS_METHOD_REQ, asynchronous); - addParm (new PxPxObjectParm (proxyId)); - addParm (new PxStringParm (methodName)); - addParm (new PxBooleanParm (factory)); - - int argumentCount = argumentClasses.length; - addParm (new PxIntParm (argumentCount)); - for (int i = 0; i < argumentCount; ++i) - addParm (new PxClassParm (argumentClasses[i])); - for (int i = 0; i < argumentCount; ++i) - addObjectParm (arguments[i]); - for (int i = 0; i < argumentCount; ++i) - if (returnArguments != null) - addParm(new PxBooleanParm(returnArguments[i])); - else - addParm(new PxBooleanParm(false)); - - - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxMethodReqSV.java b/cvsroot/src/com/ibm/as400/access/PxMethodReqSV.java deleted file mode 100644 index 551d19600..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxMethodReqSV.java +++ /dev/null @@ -1,141 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxMethodReqSV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - - - -/** -The PxMethodReqSV class represents the -server view of a method request. -**/ -class PxMethodReqSV -extends PxReqSV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private PxTable pxTable_; - //@B2D private PSConnection connection_; - - - - public PxMethodReqSV(PxTable pxTable) //@B2D, PSConnection connection) - { - super (ProxyConstants.DS_METHOD_REQ); - pxTable_ = pxTable; - //@B2Dconnection_ = connection; - } - - - - static Object invoke(Object object, - String methodName, - Class[] argumentClasses, - Object[] arguments) - throws ClassNotFoundException, - IllegalAccessException, - InvocationTargetException, - NoSuchMethodException - { - // Resolve the Method object. First, try Class.getMethod() which - // only looks for public methods. If that does not work, try - // Class.getDeclaredMethod(), which only looks for declared - // methods (not inherited methods). Do this up the superclass tree. - Method method = null; - Class clazz = object.getClass(); - NoSuchMethodException e = null; - while ((clazz != null) && (method == null)) { - try { - method = clazz.getMethod(methodName, argumentClasses); - } - catch (NoSuchMethodException e1) { - try { - method = clazz.getDeclaredMethod(methodName, argumentClasses); - } - catch (NoSuchMethodException e2) { - e = e2; - clazz = clazz.getSuperclass(); - } - } - } - if (method == null) - throw e; - - // Call the method. - return method.invoke (object, arguments); - } - - - public PxRepSV process() - { - try { - // Get the information from the datastream parameters. - int p = -1; - Object proxy = ((PxPxObjectParm) getParm (++p)).getObjectValue (); - String methodName = ((PxStringParm) getParm (++p)).getStringValue (); - boolean factory = ((PxBooleanParm) getParm (++p)).getBooleanValue (); - - int argumentCount = ((PxIntParm) getParm (++p)).getIntValue (); - Class[] argumentClasses = new Class[argumentCount]; - for (int i = 0; i < argumentCount; ++i) - argumentClasses[i] = ((PxClassParm) getParm (++p)).getClassValue (); - Object[] arguments = new Object[argumentCount]; - for (int i = 0; i < argumentCount; ++i) - arguments[i] = ((PxParm) getParm (++p)).getObjectValue (); - boolean[] returnArguments = new boolean[argumentCount]; - for (int i = 0; i < argumentCount; ++i) - returnArguments[i] = ((PxBooleanParm)getParm(++p)).getBooleanValue(); - - // There is a chance that the proxy object is null here. It is rare, - // but it can happen if the client called a method then finalized - // immediately following, and the proxy server gets a method call AFTER - // the finalize so the object is gone by that point. - Object returnValue = null; - if (proxy != null) { - - // Invoke the method and return the value. If the method - // creates a proxy object, we need to add it to the proxy - // table. - returnValue = invoke (proxy, methodName, argumentClasses, arguments); - if ((factory) && (returnValue != null)) - pxTable_.add (returnValue); - } - - return new PxReturnRepSV (pxTable_, returnValue, arguments, returnArguments); - } - catch (InvocationTargetException e) { - return new PxExceptionRepSV (e.getTargetException ()); - } - catch (Exception e) { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, e.toString (), e); - - // If a method can not be called, there is a good chance that a mod x+1 @A1A - // client is connecting to a mod x proxy server. This is bad, but we @A1A - // don't want to kill the whole proxy server as a result. Therefore, @A1A - // we will return the exception to the client. @A1A - return new PxExceptionRepSV(new ProxyException(ProxyException.VERSION_MISMATCH)); // @A1C @B1C - } - } - - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxNullParm.java b/cvsroot/src/com/ibm/as400/access/PxNullParm.java deleted file mode 100644 index 2fe87790a..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxNullParm.java +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxNullParm.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The PxNullParm class represents a null -parameter in a proxy datastream. -**/ -class PxNullParm -extends PxDS -implements PxParm -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a PxNullParm object. -**/ - public PxNullParm () - { - super (ProxyConstants.DS_NULL_PARM); - - } - - - -/** -Returns the Object value. - -@return The Object value. -**/ - public Object getObjectValue () - { - return null; - } - - - -} - - - diff --git a/cvsroot/src/com/ibm/as400/access/PxParm.java b/cvsroot/src/com/ibm/as400/access/PxParm.java deleted file mode 100644 index affdeac9c..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxParm.java +++ /dev/null @@ -1,33 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxParm.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The PxParm interface represents a parameter in a proxy datastream. -This DOES NOT refer to a parameter in a method call, but instead a -parameter that is part of some request or reply. -**/ -interface PxParm -extends PxDSRV, PxDSWV -{ - - - - public abstract Object getObjectValue (); - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxPeerConnection.java b/cvsroot/src/com/ibm/as400/access/PxPeerConnection.java deleted file mode 100644 index d066566e4..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxPeerConnection.java +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxPeerConnection.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; - -// The PxPeerConnection class represents the connection to a proxy server. This acts as the interface between multiple peer proxy servers. -class PxPeerConnection extends PxClientConnectionAdapter -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Constructs a PxPeerConnection object. - // @param proxyServer The proxy server. - public PxPeerConnection(String proxyServer) - { - super(proxyServer, null); - } - - // Configures the proxy server. - // @param config The configuration. - public void configure(PSConfig config) - { - PxConfigReqCV request = new PxConfigReqCV(config); - send(request); - } - - // Returns the load on the proxy server. - // @return The load. - public PSLoad load() - { - PxLoadReqCV request = new PxLoadReqCV(); - try - { - return (PSLoad)sendAndReceive(request); - } - catch (InvocationTargetException e) - { - Trace.log(Trace.ERROR, e.getMessage(), e); - throw new InternalErrorException(InternalErrorException.PROTOCOL_ERROR); - } - } - - public void open(String proxyServer) - { - super.open(proxyServer); - - // We need to reinitialize the factory everytime the connection is opened. - PxDSFactory factory = getFactory(); - factory.register(new PxIntParm()); - factory.register(new PxLoadRepCV()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/PxPxObjectParm.java b/cvsroot/src/com/ibm/as400/access/PxPxObjectParm.java deleted file mode 100644 index e5c2bf499..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxPxObjectParm.java +++ /dev/null @@ -1,157 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxPxObjectParm.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; - - - -/** -The PxPxObjectParm class represents a -proxy object parameter in a proxy datastream. -**/ -// -// Implementation note: -// -// On the client side, there is no proxy table. Therefore, the -// proxy table here will be null. This works as long as these -// parameters are only used to pass objects from the client -// to the proxy server, but not the reverse. -// -class PxPxObjectParm -extends PxDS -implements PxParm -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private long proxyId_ = -1; - private PxTable proxyTable_ = null; - - - - public PxPxObjectParm () - { - super (ProxyConstants.DS_PROXY_OBJECT_PARM); - } - - - -/** -Constructs a PxSerializedObjectParm object. - -@param proxyTable The proxy table. -**/ - public PxPxObjectParm (PxTable proxyTable) - { - super (ProxyConstants.DS_PROXY_OBJECT_PARM); - proxyTable_ = proxyTable; - } - - - -/** -Constructs a PxSerializedObjectParm object. - -@param proxyId The proxy id. -**/ - public PxPxObjectParm (long proxyId) - { - super (ProxyConstants.DS_PROXY_OBJECT_PARM); - proxyId_ = proxyId; - } - - - -/** -Returns the Object value. - -@return The Object value. -**/ - public Object getObjectValue () - { - return proxyTable_.get (proxyId_); - } - - - -/** -Returns the proxy id. - -@return The proxy id. -**/ - public long getPxId () - { - return proxyId_; - } - - - -/** -Loads this datastream by reading from an input stream. - -@param input The input stream. -@param factory The datastream factory. This is sometimes - needed when datastreams are nested. - -@exception IOException If an error occurs. -**/ - public void readFrom (InputStream input, PxDSFactory factory) - throws IOException - { - super.readFrom (input, factory); - DataInputStream dataInput = new DataInputStream (input); - proxyId_ = dataInput.readLong (); - } - - - -/** -Returns the String representation of the datastream. - -@return The String representation of the datastream. -**/ - public String toString () - { - - return super.toString () + " (" + proxyId_ + ")"; - } - - - -/** -Writes the contents of the datastream to an output stream. - -@param output The output stream. - -@exception IOException If an error occurs. -**/ - public void writeTo (OutputStream output) - throws IOException - { - super.writeTo (output); - DataOutputStream dataOutput = new DataOutputStream (output); - dataOutput.writeLong (proxyId_); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxRejectRepCV.java b/cvsroot/src/com/ibm/as400/access/PxRejectRepCV.java deleted file mode 100644 index 0a45c26f0..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxRejectRepCV.java +++ /dev/null @@ -1,49 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxRejectRepCV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; - -// The PxRejectRepCV class represents the client view of a reject reply. -class PxRejectRepCV extends PxRepCV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private ProxyClientConnection connection_; - - // Constructs a PxRejectRepCV object. - // @param connection The connection. - public PxRejectRepCV(ProxyClientConnection connection) - { - super(ProxyConstants.DS_REJECT_REP); - connection_ = connection; - } - - // Processes the reply. - // @return The returned object, or null if none. - public Object process() throws InvocationTargetException - { - String peer = ((PxStringParm)getParm(0)).getStringValue(); - - connection_.close(); - if (peer.length() > 0) - { - connection_.open(peer); - connection_.connect(); - return null; - } - throw new ProxyException(ProxyException.CONNECTION_REJECTED); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/PxRejectRepSV.java b/cvsroot/src/com/ibm/as400/access/PxRejectRepSV.java deleted file mode 100644 index b667ec476..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxRejectRepSV.java +++ /dev/null @@ -1,29 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxRejectRepSV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// The PxRejectRepSV class represents the server view of a reject reply. -class PxRejectRepSV extends PxRepSV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Constructs a PxRejectRepSV object. - // @param peer The suggested peer, or "" if none. - // @param secure true if this is rejecting a secure connection, false otherwise. - public PxRejectRepSV(String peer) - { - super(ProxyConstants.DS_REJECT_REP); - addParm(new PxStringParm(peer)); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/PxRepCV.java b/cvsroot/src/com/ibm/as400/access/PxRepCV.java deleted file mode 100644 index bed8c08ad..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxRepCV.java +++ /dev/null @@ -1,130 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxRepCV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.DataInputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.lang.reflect.InvocationTargetException; - - - -/** -The PxRepCV class represents the client -portion of a reply. -**/ -abstract class PxRepCV -extends PxCompDS -implements PxDSRV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private long correlationId_ = -1; - private long clientId_ = -1; // @D1A @D2A - - - -/** -Constructs a PxRepCV object. - -@param type The datastream type. Valid values are listed in - the ProxyConstants class. -**/ - public PxRepCV (short type) - { - super (type); - } - - - -/** -Dumps the datastream for debugging and tracing. - -@param output The print writer. -**/ - public void dump (PrintWriter output) - { - synchronized (output) { - super.dump (output); - output.println(" Correlation id = " + correlationId_); - - // @D2D if (clientId_ != null) // @D1a - // @D2D { - output.println (" Client id = " + clientId_); // @D2C - // @D2D for (int i=0; i 0) { - byte[] buffer = new byte[length]; - - // @A1D StringBuffer value = new StringBuffer(); - int leftToRead = length; - int bytesRead = 0; // @A1A - while (leftToRead > 0) { - int count = input.read(buffer, bytesRead, leftToRead); // @A1C - // @A1D value.append(new String(buffer, 0, count, ENCODING_)); - leftToRead -= count; - bytesRead += count; // @A1A - } - value_ = new String(buffer, 0, length, ENCODING_); // @A1C - } - else - value_ = ""; - } - - - -/** -Returns the String representation of the datastream. - -@return The String representation of the datastream. -**/ - public String toString () - { - - if (value_ != null) - return super.toString () + " (\"" + value_ + "\")"; - else - return super.toString (); - } - - - -/** -Writes the contents of the datastream to an output stream. - -@param output The output stream. - -@exception IOException If an error occurs. -**/ - public void writeTo (OutputStream output) - throws IOException - { - super.writeTo (output); - DataOutputStream dataOutput = new DataOutputStream (output); - if (value_ != null) { - byte[] buffer = value_.getBytes (ENCODING_); - dataOutput.writeInt (buffer.length); - output.write (buffer); - } - else - dataOutput.writeInt (0); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/PxTable.java b/cvsroot/src/com/ibm/as400/access/PxTable.java deleted file mode 100644 index 59c275314..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxTable.java +++ /dev/null @@ -1,296 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxTable.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - - - -/** -The PxTable class stores all proxy objects in a single -context. (The context may be a particular connection, -conversation, or session.) - -

    This class takes care of assigning proxy ids. Px -ids are numbered from 1000 to Long.MAX_VALUE and never -reused. Since this set only applies to a single connection, -this should not be a problem. -**/ -class PxTable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private static final boolean DEBUG_ = false; - private static int debugTableCounter_ = 0; - private static int debugObjectCounter_ = 0; - - - - private Hashtable idToObject_ = new Hashtable (); - private long currentId_ = 1000; - private Hashtable objectToId_ = new Hashtable (); - private Hashtable clientIdToProxyId_ = new Hashtable(); //@A1A - - - - public PxTable() - { - if (DEBUG_) - System.out.println("+Px table count = " + (++debugTableCounter_) + "."); - } - - - -/** -Adds an object to the proxy table, while assigning -a unique proxy id. - -@param object The object. -@return The proxy id. -**/ - public long add (Object object) - { - if (DEBUG_) { - if (objectToId_.containsKey (object)) - System.out.println ("Px table: Object " + object + " added multiple times."); - } - - long proxyId = currentId_++; - Object key = toKey (proxyId); - idToObject_.put (key, object); - objectToId_.put (object, key); - - if (DEBUG_) { - System.out.println("Px table: Added " + object + " (" + object.getClass() + ") as #" + proxyId + "."); - System.out.println("+Px object count = " + (++debugObjectCounter_) + "."); - } - - return proxyId; - } - - - - //@A1A - /** - Adds a proxy object to the proxy table, while assigning - a unique proxy id. In addition, it adds the object to the - hashtable of objects for each client id. - - @param clientId The client id. - @param object The object. - @return The proxy id. - **/ - public long addClientId (long clientId, Object object) - { - long proxyId = add (object); - // if object is tunneling object, add it to vector for its client Id - if (clientId > 0) - { - Vector objectsForClientId = (Vector)clientIdToProxyId_.get(new Long(clientId)); - if (objectsForClientId == null) - { - objectsForClientId = new Vector(); - } - objectsForClientId.addElement(new Long(proxyId)); - clientIdToProxyId_.put(new Long(clientId), objectsForClientId); - } - return proxyId; - } - - -/** -Adds an object to the proxy table when the proxy -id is already assigned. - -@param proxyId The proxy id. -@param object The object. -**/ - public void add (long proxyId, Object object) - { - Object key = toKey (proxyId); - - if (DEBUG_) { - if (objectToId_.containsKey (object)) - System.out.println ("Px table: Object " + object + " added multiple times."); - if (idToObject_.containsKey (key)) - System.out.println ("Px table: Px id " + proxyId + " added multiple times."); - } - - idToObject_.put (key, object); - objectToId_.put (object, key); - - if (DEBUG_) { - System.out.println("Px table: Added " + object + " (" + object.getClass() + ") as #" + proxyId + "."); - System.out.println("+Px object count = " + (++debugObjectCounter_) + "."); - } - } - - - - protected void finalize() throws Throwable - { - if (DEBUG_) - System.out.println("-Px table count = " + (--debugTableCounter_) + "."); - super.finalize (); - } - - - -/** -Returns the proxy id for an object. - -@param object The object. -@return The proxy id, or -1 if not found. -**/ - public long get (Object object) - { - if (objectToId_.containsKey (object)) - return ((Long) objectToId_.get (object)).longValue (); - else - return -1; - } - - - -/** -Returns the object associated with a proxy id. - -@param proxyId The proxy id. -@return The object. -**/ - public Object get (long proxyId) - { - Object key = toKey (proxyId); - if (idToObject_.containsKey (key)) - return idToObject_.get (key); - else - return null; - } - - - -/** -Returns the key associated with the proxy id. -This is for use in the internal hashtables. - -@param proxyId The proxy id. -@return The key. -**/ - private static Object toKey (long proxyId) - { - return new Long (proxyId); - } - - - -/** -Removes the object associated with the proxy id -from the proxy table. - -@param proxyId The proxy id. -**/ - public void remove (long proxyId) - { - Object key = toKey (proxyId); - if (idToObject_.containsKey (key)) { - Object object = idToObject_.get (key); - idToObject_.remove (key); - objectToId_.remove (object); - - if (DEBUG_) { - System.out.println("Px table: Removed " + object + " (" + object.getClass() + ") as #" + proxyId + "."); - System.out.println("-Px object count = " + (--debugObjectCounter_) + "."); - } - } - } - - - -/** -Removes the object from the proxy table. - -@param object The object. -**/ - public void remove (Object object) - { - if (objectToId_.containsKey (object)) { - Object key = objectToId_.get (object); - idToObject_.remove (key); - objectToId_.remove (object); - - if (DEBUG_) { - System.out.println("Px table: Removed " + object + " (" + object.getClass() + ") as #" + key + "."); - System.out.println("-Px object count = " + (--debugObjectCounter_) + "."); - } - } - } - - - //@A1A - /** -Removes objects associated with a clientId from the proxy table. - -@param clientId The client id. -**/ - public void removeClientId (long clientId) - { - Vector objectsForClientId = (Vector)clientIdToProxyId_.get(new Long(clientId)); - // If no objects, return - if (objectsForClientId == null) - return; - // Go through vector of items for client id, removing one at a time by proxyId - for (int i = 0; i < objectsForClientId.size(); i++) - { - //Remove object by proxyId from PxTable - remove(((Long)objectsForClientId.elementAt(i)).longValue()); - } - clientIdToProxyId_.remove(new Long(clientId)); - } - - -/** -Removes all objects from the proxy table. -**/ - public void removeAll () - { - if (DEBUG_) - debugObjectCounter_ -= idToObject_.size(); - - // Find any AS400ImplRemote's and disconnect them. Otherwise, - // they may sit around and run forever! - Enumeration list = objectToId_.keys(); - while(list.hasMoreElements()) { - Object object = list.nextElement(); - if (object instanceof AS400ImplRemote) - ((AS400ImplRemote)object).disconnectAllServices(); - } - - idToObject_.clear (); - objectToId_.clear (); - - if (DEBUG_) { - System.out.println("Px table: Removed all objects."); - System.out.println("--Px object count = " + (debugObjectCounter_) + "."); - } - - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxToolboxObjectParm.java b/cvsroot/src/com/ibm/as400/access/PxToolboxObjectParm.java deleted file mode 100644 index ecbaa2dc4..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxToolboxObjectParm.java +++ /dev/null @@ -1,261 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxToolboxObjectParm.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.IOException; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.StringTokenizer; -import java.util.Vector; - - - -/** -The PxToolboxObjectParm class represents a -serialized Toolbox object parameter in a proxy datastream. We can't -just serialize Toolbox objects, since they may contain proxy objects. -Otherwise, the contained proxy objects would be serialized along with -it, which is incorrect. -**/ -class PxToolboxObjectParm -extends PxCompDS -implements PxParm -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private static boolean DEBUG_ = false; - - private Object value_; - - - - public PxToolboxObjectParm () - { - super (ProxyConstants.DS_TOOLBOX_OBJECT_PARM); - } - - - - public PxToolboxObjectParm (Object value) - { - super (ProxyConstants.DS_TOOLBOX_OBJECT_PARM); - value_ = value; - - if (DEBUG_) - System.out.println("Creating toolbox object parm: " + value + " (" + value.getClass() + ")."); - - // First we can just serialize this object. - addParm(new PxSerializedObjectParm(value)); - - // Next we will pass along a list of all contained objects - // (no matter how deep) which are proxified objects. - Vector fieldNames = new Vector(); - Vector proxyImpls = new Vector(); - analyze(value, "", fieldNames, proxyImpls); - - // Send the number of contained proxy objects. - int proxyCount = proxyImpls.size(); - addParm(new PxIntParm(proxyCount)); - - // Send each proxy object, name then value. - for (int i = 0; i < proxyCount; ++i) { - addParm(new PxStringParm((String)fieldNames.elementAt(i))); - addParm(new PxPxObjectParm(((ProxyImpl)proxyImpls.elementAt(i)).getPxId())); - } - } - - - - private static void analyze(Object objectValue, String prefix, Vector fieldNames, Vector proxyImpls) - { - if (DEBUG_) { - System.out.println("Analyzing " + objectValue + " (" + objectValue.getClass() + ")."); - System.out.println("Prefix=" + prefix + "."); - } - - // getDeclaredFields() is not allowed in applets. If it throws // @A1A - // an exception, we will assume that there is nothing interesting // @A1A - // in the data. If there is, it will potentially be lost (i.e. // @A1A - // not everything that works for applications will work for applets. // @A1A - try { // @A1A - - // First, analyze all of our declared fields, then all of - // our superclass's, etc. - for (Class clazz = objectValue.getClass(); - ! clazz.equals(Object.class); - clazz = clazz.getSuperclass()) - { - Field[] declaredFields = clazz.getDeclaredFields(); - if (declaredFields != null) { - for (int i = 0; i < declaredFields.length; ++i) { - String fieldName = declaredFields[i].getName(); - - if (DEBUG_) - System.out.println("Field name=" + fieldName + "."); - - // If the field is transient, then do nothing. - if (! Modifier.isTransient(declaredFields[i].getModifiers())) { - - // Note that this check depends on the assumption that - // contained proxy objects be declared at least package - // scope (otherwise we will catch an IllegalAccessException). - // I know this is not a great assumption, but - // it makes the implementation easier. - try { - Object fieldValue = declaredFields[i].get(objectValue); - if (fieldValue != null) { - - if (DEBUG_) - System.out.println("Field value=" + fieldValue + " (" + fieldValue.getClass() + ")."); - - // Only be concerned with non-static Toolbox fields. - if (!Modifier.isStatic(declaredFields[i].getModifiers()) - && fieldValue.getClass().getName().startsWith("com.ibm.as400.access")) { - - // If the field value is a proxy object, then add it to the list. - // Otherwise, analyze recursively. - if (fieldValue instanceof ProxyImpl) { - fieldNames.addElement(prefix + fieldName); - proxyImpls.addElement((ProxyImpl)fieldValue); - } - else if (fieldValue.getClass().getName().startsWith("com.ibm.as400.access")) - analyze(fieldValue, fieldValue + ".", fieldNames, proxyImpls); - } - } - } - catch (IllegalAccessException e) { - // Ignore. - if (DEBUG_) - System.out.println("Ignored IllegalAccessException:" + e.getMessage()); - } - } - } - } - } - } // @A1A - catch (Exception e) { // @A1A - if (Trace.isTraceErrorOn()) // @A1A - Trace.log(Trace.ERROR, "Exception when analyzing Toolbox parm", e); // @A1A - } // @A1A - } - - - -/** -Returns a new copy of this datastream. - -@return A new copy of this datastream. - -@exception CloneNotSupportedException If the object cannot be cloned. -**/ -// -// Implementation note: This method is necessary in order to do -// a deep copy of the internal object. Otherwise, -// we run into problems with multiple threads. - public Object clone () - throws CloneNotSupportedException - { - value_ = null; - return super.clone(); - } - - - - public Object getObjectValue () - { - return value_; - } - - - public void readFrom(InputStream input, PxDSFactory factory) - throws IOException - { - super.readFrom(input, factory); - - // Deserialize the object. - value_ = getParm(0).getObjectValue(); - - // Number of contained objects ("corrections"). - int proxyCount = ((PxIntParm)getParm(1)).getIntValue(); - int parmIndex = 1; - for (int i = 1; i <= proxyCount; ++i) { - String fieldName = ((PxStringParm)getParm(++parmIndex)).getStringValue(); - Object impl = ((PxPxObjectParm)getParm(++parmIndex)).getObjectValue(); - - // Set the field. - Object fieldValue = value_; - Field field = null; - - // Navigate down the containment hierarchy to - // get the right field. - StringTokenizer tokenizer = new StringTokenizer(fieldName, "."); - while (tokenizer.hasMoreTokens()) { - - // Get the next field to navigate to. - String token = tokenizer.nextToken(); - Class clazz = fieldValue.getClass(); - - try { - field = clazz.getDeclaredField(token); - if (field == null) { - // This should never happen! - if (Trace.isTraceErrorOn()) - Trace.log(Trace.ERROR, "Error reading toolbox parm: field set to null"); - } - } - catch(NoSuchFieldException e) { - // This should never happen! - if (Trace.isTraceErrorOn()) - Trace.log(Trace.ERROR, "Error reading toolbox parm", e); - } - - // Get the value of that field. - try { - if (tokenizer.hasMoreTokens()) - if (field != null) fieldValue = field.get(fieldValue); - } - catch(IllegalAccessException e) { - // This should never happen! - if (Trace.isTraceErrorOn()) - Trace.log(Trace.ERROR, "Error reading toolbox parm", e); - } - } - - // At this point, field is set to the field that we need to set. - try { - if (field != null) field.set(fieldValue, impl); - } - catch(IllegalAccessException e) { - // This should never happen! - if (Trace.isTraceErrorOn()) - Trace.log(Trace.ERROR, "Error reading toolbox parm", e); - } - } - } - - - public String toString () - { - - return super.toString () + " (" + value_ + ")"; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/PxTunnelConnectReqSV.java b/cvsroot/src/com/ibm/as400/access/PxTunnelConnectReqSV.java deleted file mode 100644 index 539e3f12f..000000000 --- a/cvsroot/src/com/ibm/as400/access/PxTunnelConnectReqSV.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PxTunnelConnectReqSV.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Vector; -import java.util.Hashtable; - -// The PxTunnelConnectReqSV class represents the server view of a connect request for tunneling. -class PxTunnelConnectReqSV extends PxReqSV -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // MRI. - private static final String PROXY_CONNECTION_ACCEPTED_ = ResourceBundleLoader.getText("PROXY_CONNECTION_ACCEPTED"); - - // Private data. - private Hashtable clientIds_; - private PSTunnelController controller_; - - /** - Constructs a PxTunnelConnectReqSV object. - - @param controller The controller. - @param clientIds The list of client ids. - **/ - public PxTunnelConnectReqSV (PSTunnelController controller, - Hashtable clientIds) - { - super (ProxyConstants.DS_CONNECT_TUNNEL_REQ); - - controller_ = controller; - clientIds_ = clientIds; - } - - // Processes the request. - // @return The corresponding reply, or null if none. - public PxRepSV process() - { - PxRepSV reply; - PSTunnelConnection connection = new PSTunnelConnection (controller_.getConnectionId()); - long clientId = controller_.getNextClientId(); - clientIds_.put(new Long(clientId), connection); - reply = new PxAcceptRepSV(); - reply.setClientId(clientId); - - //Verbose.println(ResourceBundleLoader.substitute(PROXY_CONNECTION_ACCEPTED_, new Object[] { controller_, controller_.getClientAddress(), Long.toString(controller_.getConnectionId())} )); - return reply; - } -} - - diff --git a/cvsroot/src/com/ibm/as400/access/QSYSObjectPathName.java b/cvsroot/src/com/ibm/as400/access/QSYSObjectPathName.java deleted file mode 100644 index 89a586904..000000000 --- a/cvsroot/src/com/ibm/as400/access/QSYSObjectPathName.java +++ /dev/null @@ -1,1234 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: QSYSObjectPathName.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// -// Usage notes: -// -// For IBM Toolbox for Java developers, this class is generally used in one -// of the following ways: -// -// 1) QSYSObjectPathName ifs = new QSYSObjectPathName(myIFSString); -// if (!ifs.getObjectType().equals("MYTYPE1") && -// !ifs.getObjectType().equals("MYTYPE2")) -// throw new IllegalPathNameException(myIFSString, -// IllegalPathNameException.OBJECT_TYPE_NOT_VALID); -// -// 2) QSYSObjectPathName ifs -// = new QSYSObjectPathName(myIFSString, "MYTYPE"); -// -// For public usage, see the class prolog. -// -/////////////////////////////////////////////////////////////////////////////// -// @A1 - 12/04/2007 - Added code to better handle IASPs in QSYS paths. -// parse() - Code to handle /QSYS.LIB and /iasp/qsys.lib without any -// further object types. -// buildPathName() - -// QSYSObjectPathName - new constructor which takes IASP parameter -// toPath() - additional method which takes IASP parameter -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.Serializable; -import java.util.EventListener; - -/** - Provides an integrated file system path name that represents an object in the QSYS library file system. -

    QSYSObjectPathName objects generate the following events: -

      -
    • PropertyChangeEvent -
    • VetoableChangeEvent -
    -

    This object can be used in two ways: -

      -
    • To parse the integrated file system path name to ensure correct syntax and to extract the library, object, member, and object type. -
    • To build an integrated file system path name from a library, object, and member or object type. -
    - IllegalPathNameExceptions are thrown if errors are found. -

    Objects in the QSYS file system have integrated file system names with the following format for objects or members in a library other than QSYS: -

    - /QSYS.LIB/library.LIB/object.type
    - /QSYS.LIB/library.LIB/object.FILE/member.MBR
    - 
    - For objects or members that reside in QSYS, this format is used: -
    - /QSYS.LIB/object.type
    - /QSYS.LIB/object.FILE/member.MBR
    - 
    - For example: -
    - /QSYS.LIB/QGPL.LIB/CRTLIB.CMD
    - /QSYS.LIB/QGPL.LIB/ACCOUNTS.FILE/PAYABLE.MBR
    - /QSYS.LIB/CRTLIB.CMD
    - /QSYS.LIB/ACCOUNTS.FILE/PAYABLE.MBR
    - 
    -

    In an integrated file system path name, special values, such as *ALL, that begin with an asterisk are not depicted with an asterisk but with leading and trailing percent signs (%ALL%). In the integrated file system, an asterisk is a wildcard character. The following special values are recognized by this class: -

    - Library name: %ALL%(*ALL), %ALLUSR%(*ALLUSR), %CURLIB%(*CURLIB), %LIBL%(*LIBL), %USRLIBL%(*USRLIBL)
    - Object name:  %ALL%(*ALL)
    - Member name:  %ALL%(*ALL), %FILE%(*FILE), %FIRST%(*FIRST), %LAST%(*LAST) %NONE%(*NONE)
    - 
    -

    The path name will be in uppercase. If case needs to be preserved for a library, object, or member name, quotation marks should be used around the names. For example: -

    - QSYSObjectPathName path = new QSYSObjectPathName("/QSYS.LIB/\"MixedCase\".LIB/\"lowercase\".FILE");
    - 
    - Examples: -
      -
    • This code will extract the pieces of an integrated file system name that represents a file: -
      - QSYSObjectPathName path = new QSYSObjectPathName("/QSYS.LIB/QGPL.LIB/ACCOUNTS.FILE");
      - System.out.println(path.getLibraryName());  // Will print "QGPL"
      - System.out.println(path.getObjectName());   // Will print "ACCOUNTS"
      - System.out.println(path.getObjectType());   // Will print "FILE"
      - 
      -
    • This code will extract the pieces of an integrated file system name that represents a member: -
      - QSYSObjectPathName path = new QSYSObjectPathName("/QSYS.LIB/QGPL.LIB/ACCOUNTS.FILE/PAYABLE.MBR");
      - System.out.println(path.getLibraryName());  // Will print "QGPL"
      - System.out.println(path.getObjectName());   // Will print "ACCOUNTS"
      - System.out.println(path.getMemberName());   // Will print "PAYABLE"
      - System.out.println(path.getObjectType());   // Will print "MBR"
      - 
      -
    • This code will build an integrated file system name for a file: -
      - QSYSObjectPathName path = new QSYSObjectPathName("QGPL", "ACCOUNTS", "FILE");
      - // Will print "/QSYS.LIB/QGPL.LIB/ACCOUNTS.FILE"
      - System.out.println(path.getPath());
      - 
      -
    • This code will build an integrated file system name for a member: -
      - QSYSObjectPathName path = new QSYSObjectPathName("QGPL", "ACCOUNTS", "PAYABLE", "MBR");
      - // Will print "/QSYS.LIB/QGPL.LIB/ACCOUNTS.FILE/PAYABLE.MBR"
      - System.out.println(path.getPath());
      - 
      -
    - **/ -public class QSYSObjectPathName implements Serializable -{ - static final long serialVersionUID = 4L; - - // Full IFS path name. - private String path_ = ""; - // Library name. - private String libraryName_ = ""; - // Object name. - private String objectName_ = ""; - // Member name. - private String memberName_ = ""; - // Object type. - private String objectType_ = ""; - // Object ASP name - private String aspName_ = ""; //@A1A - private static QSYSObjectPathName verified_ = null; // to quiet the static analyzer - - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_ = null; // Set on first add. - // List of vetoable change event bean listeners. - private transient VetoableChangeSupport vetoableChangeListeners_ = null; // Set on first add. - - /** - Constructs a QSYSObjectPathName object. It creates an integrated file system path name for an object in the QSYS file system. - **/ - public QSYSObjectPathName() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing QSYSObjectPathName object."); - } - - /** - Constructs a QSYSObjectPathName object. It creates an integrated file system path name for an object in the QSYS file system. - @param path The fully qualified integrated file system name of an object in the QSYS file system. - **/ - public QSYSObjectPathName(String path) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing QSYSObjectPathName object, path: " + path); - if (path == null) - { - Trace.log(Trace.ERROR, "Parameter 'path' is null."); - throw new NullPointerException("path"); - } - parse(path); - } - - // Constructs a QSYSObjectPathName object. It creates an integrated file system path name for an object in the QSYS file system. - // @param path The fully qualified integrated file system name of an object in the QSYS file system. - // @param objectType The type of object path should represent. - QSYSObjectPathName(String path, String objectType) - { - this(path); - // Ensure that the type is correct. - if (!objectType_.equals(objectType.toUpperCase())) - { - Trace.log(Trace.ERROR, "Object type is not valid, path: '" + path + "'"); - throw new IllegalPathNameException(path, IllegalPathNameException.OBJECT_TYPE_NOT_VALID); - } - } - - /** - Constructs a QSYSObjectPathName object. It builds an integrated file system path name to represent the object. -
    -     QSYSObjectPathName ifsName = new QSYSObjectPathName("library", "name", "type");
    -     // This line will print "/QSYS.LIB/LIBRARY.LIB/NAME.TYPE".
    -     System.out.println(ifsName.getPath());
    -     
    - @param libraryName The library in which the object exists. It must be 1-10 characters. - @param objectName The name of the object. It must be 1-10 characters. - @param objectType The type of the object. It must be 1-6 characters. This is the IBM i system abbreviation for the type of object, for example, LIB for library, or CMD for command. Types can be found by prompting for the OBJTYPE parameter on commands such as WRKOBJ. - **/ - public QSYSObjectPathName(String libraryName, String objectName, String objectType) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing QSYSObjectPathName object, libraryName: " + libraryName + " objectName: " + objectName + " objectType: " + objectType); - // Verify arguments will make a valid QSYS IFS path name. - checkLibraryName(libraryName); - checkObjectName(objectName); - checkObjectType(objectType); - - // If quoted, store as mixed case, else store as uppercase. - libraryName_ = toQSYSName(libraryName); - // If quoted, store as mixed case, else store as uppercase. - objectName_ = toQSYSName(objectName); - objectType_ = objectType.toUpperCase(); - - path_ = buildPathName(libraryName_, objectName_, "", objectType_); - } - - /** - Constructs a QSYSObjectPathName object. It builds an integrated file system path name to represent the member. -
    -     QSYSObjectPathName ifsName = new QSYSObjectPathName("library", "name", "member", "MBR");
    -     // This line will print "/QSYS.LIB/LIBRARY.LIB/NAME.FILE/MEMBER.MBR".
    -     System.out.println(ifsName.getPath());
    -     
    - @param libraryName The library in which the object exists. It must be 1-10 characters. - @param objectName The name of the object. It must be 1-10 characters. - @param memberName The name of the member. It must be 1-10 characters. - @param objectType The type of the object. This must be "MBR". - **/ - public QSYSObjectPathName(String libraryName, String objectName, String memberName, String objectType) - { - // Note the code in this method is similar to that in the toPath method, and code changes here should most likely be reflected there as well. - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing QSYSObjectPathName object, libraryName: " + libraryName + " objectName: " + objectName + " memberName: " + memberName + " objectType: " + objectType); - - // Verify arguments will make a valid QSYS IFS path name. - checkLibraryName(libraryName); - checkObjectName(objectName); - checkMemberName(memberName); - checkObjectTypeIsMember(objectType); - - // If quoted, store as mixed case, else store as uppercase. - libraryName_ = toQSYSName(libraryName); - // If quoted, store as mixed case, else store as uppercase. - objectName_ = toQSYSName(objectName); - memberName_ = toQSYSName(memberName); - objectType_ = "MBR"; - - path_ = buildPathName(libraryName_, objectName_, memberName_, objectType_); - } - - /** - Constructs a QSYSObjectPathName object. It builds an integrated file system path name to represent the member. -
    -    QSYSObjectPathName ifsName = new QSYSObjectPathName("iasp1", "library", "name", "member", "MBR");
    -    // This line will print "/IASP1/QSYS.LIB/LIBRARY.LIB/NAME.FILE/MEMBER.MBR".
    -    System.out.println(ifsName.getPath());
    -    
    - @param aspName The IASP on which the object exists. It must be 1-10 characters. - @param libraryName The library in which the object exists. It must be 1-10 characters. - @param objectName The name of the object. It must be 1-10 characters. - @param memberName The name of the member. It must be 1-10 characters. - @param objectType The type of the object. This must be "MBR". - **/ - public QSYSObjectPathName(String aspName, String libraryName, String objectName, String memberName, String objectType) //@A1A - { - // Note the code in this method is similar to that in the toPath method, and code changes here should most likely be reflected there as well. - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing QSYSObjectPathName object, libraryName: " + libraryName + " objectName: " + objectName + " memberName: " + memberName + " objectType: " + objectType); - - // Verify arguments will make a valid QSYS IFS path name. - checkAspName(aspName); - checkLibraryName(libraryName); - checkObjectName(objectName); - checkMemberName(memberName); - checkObjectTypeIsMember(objectType); - - // If quoted, store as mixed case, else store as uppercase. - libraryName_ = toQSYSName(libraryName); - // If quoted, store as mixed case, else store as uppercase. - objectName_ = toQSYSName(objectName); - memberName_ = toQSYSName(memberName); - objectType_ = "MBR"; - aspName_ = aspName; - - path_ = buildPathName(aspName_, libraryName_, objectName_, memberName_, objectType_); - } - - - /** - Adds a listener to be notified when the value of any bound property is changed. The propertyChange method will be called. - @param listener The listener object. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - checkListener(listener); - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Adds a listener to be notified when the value of any constrained property is changed. The vetoableChange method will be called. - @param listener The listener object. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - checkListener(listener); - synchronized (this) - { - // If first add. - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - } - - // Builds the full path name from the pieces (ASP name, library name, object name, object type, member name), if enough data is available. Returns an empty string if not successful. - // @return The integrated file system path name. An empty String will be returned if the path cannot be created. - private static String buildPathName(String aspName, String libraryName, String objectName, String memberName, String objectType)//@A1A - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "QSYSObjectPathName buildPathName(asp): aspName: " + aspName + " libraryName: " + libraryName + " objectName: " + objectName + " memberName: " + memberName + " objectType: " + objectType); - // First build the path (without the ASP name), then prepend the asp name - String result1 = buildPathName(libraryName, objectName, memberName, objectType); - StringBuffer result2 = new StringBuffer(75); - - if (!result1.equals("")) - { - if (!aspName.equals("")) - { - result2.append("/"); - result2.append(aspName); // Prepend the ASP name - } - result2.append(result1); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "QSYSObjectPathName buildPathName(asp): result: " + result2.toString()); - return result2.toString(); - } - else - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "QSYSObjectPathName buildPathName(asp): result: EMPTY STRING"); - return ""; - } - } - // Builds the full path name from the pieces (library name, object name, object type, member name), if enough data is available. Returns an empty string if not successful. - // @return The integrated file system path name. An empty String will be returned if the path cannot be created. - private static String buildPathName(String libraryName, String objectName, String memberName, String objectType) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "QSYSObjectPathName buildPathName(): libraryName: " + libraryName + " objectName: " + objectName + " memberName: " + memberName + " objectType: " + objectType); - if (!libraryName.equals("") && !objectType.equals("") && (!memberName.equals("") || !objectType.equals("MBR"))) //@A1C - { - StringBuffer result = new StringBuffer(64); - result.append("/QSYS.LIB"); - if (!libraryName.equals("QSYS")) - { - // Add "/xyz.LIB" - result.append("/"); - result.append(convertLibraryName(libraryName)); - result.append(".LIB"); - } - - // For the special case of "/QSYS.LIB", the objectName is empty string - if (!objectName.equals("")) - { - result.append("/"); - result.append(convertObjectName(objectName)); - - if (!memberName.equals("")) - { - result.append(".FILE/"); - result.append(convertMemberName(memberName)); - result.append(".MBR"); - } - else - { - result.append("."); - result.append(objectType); - } - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "QSYSObjectPathName buildPathName(): result: " + result.toString()); - return result.toString(); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "QSYSObjectPathName buildPathName(): result: EMPTY STRING"); - return ""; - } - - static void checkObjectTypeIsMember(String objectType) - { - if (objectType == null) - { - Trace.log(Trace.ERROR, "Parameter 'objectType' is null."); - throw new NullPointerException("objectType"); - } - if (!objectType.toUpperCase().equals("MBR")) - { - Trace.log(Trace.ERROR, "Value of parameter 'objectType' is not valid: " + objectType); - throw new ExtendedIllegalArgumentException("objectType (" + objectType + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - static void checkMemberName(String memberName) - { - if (memberName == null) - { - Trace.log(Trace.ERROR, "Parameter 'memberName' is null."); - throw new NullPointerException("memberName"); - } - if (memberName.length() < 1 || memberName.length() > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'memberName' is not valid: '" + memberName + "'"); - throw new ExtendedIllegalArgumentException("memberName (" + memberName + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - } - static void checkListener(EventListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - } - // New Method to verify ASP name is valid @A1A - static void checkAspName(String aspName) //@A1A - { - if (aspName == null) - { - Trace.log(Trace.ERROR, "Parameter 'aspName' is null."); - throw new NullPointerException("aspName"); - } - if (aspName.length() < 1 || aspName.length() > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'aspName' is not valid: '" + aspName + "'"); - throw new ExtendedIllegalArgumentException("aspName (" + aspName + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - } - static void checkLibraryName(String libraryName) - { - if (libraryName == null) - { - Trace.log(Trace.ERROR, "Parameter 'libraryName' is null."); - throw new NullPointerException("libraryName"); - } - if (libraryName.length() < 1 || libraryName.length() > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'libraryName' is not valid: '" + libraryName + "'"); - throw new ExtendedIllegalArgumentException("libraryName (" + libraryName + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - } - static void checkObjectName(String objectName) - { - if (objectName == null) - { - Trace.log(Trace.ERROR, "Parameter 'objectName' is null."); - throw new NullPointerException("objectName"); - } - if (objectName.length() < 1 || objectName.length() > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'objectName' is not valid: '" + objectName + "'"); - throw new ExtendedIllegalArgumentException("objectName (" + objectName + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - } - static void checkObjectType(String objectType) - { - if (objectType == null) - { - Trace.log(Trace.ERROR, "Parameter 'objectType' is null."); - throw new NullPointerException("objectType"); - } - if (objectType.length() < 1 || objectType.length() > 6) - { - Trace.log(Trace.ERROR, "Length of parameter 'objectType' is not valid: '" + objectType + "'"); - throw new ExtendedIllegalArgumentException("objectType (" + objectType + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - } - - // Converts the library name to the integrated file system pathname value by handling special values. - // @param libraryName The library in which the object exists. - // @return The library name in integrated file system path name form. - private static String convertLibraryName(String libraryName) - { - // Check to see if we have a special value. - if (libraryName.equals("*LIBL")) return "%LIBL%"; - if (libraryName.equals("*CURLIB")) return "%CURLIB%"; - if (libraryName.equals("*USRLIBL")) return "%USRLIBL%"; - if (libraryName.equals("*ALL")) return "%ALL%"; - if (libraryName.equals("*ALLUSR")) return "%ALLUSR%"; - return libraryName; - } - - // Converts the member name to the integrated file system pathname value by handling special values. - // @param memberName The name of the member. - // @return The member name in integrated file system path name form. - private static String convertMemberName(String memberName) - { - // Check to see if we have a special value. - if (memberName.equals("*FIRST")) return "%FIRST%"; - if (memberName.equals("*LAST")) return "%LAST%"; - if (memberName.equals("*FILE")) return "%FILE%"; - if (memberName.equals("*ALL")) return "%ALL%"; - if (memberName.equals("*NONE")) return "%NONE%"; - return memberName; - } - - // Converts the object name to the integrated file system pathname value by handling special values. - // @param objectName The name of the object. - // @return The object name in the integrated file system path name form. - static private String convertObjectName(String objectName) - { - // Check for special value. - if (objectName.equals("*ALL")) return "%ALL%"; - return objectName; - } - - /** - Returns the ASP on which the object resides. - @return The name of the ASP. If the ASP name has not been set, an empty string is returned. - **/ - public String getAspName() //@A1A - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting ASP name: " + aspName_); - return aspName_; - } - - /** - Returns the library in which the object resides. - @return The name of the library. If the library name has not been set, an empty string is returned. - **/ - public String getLibraryName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting library name: " + libraryName_); - return libraryName_; - } - - /** - Returns the name of the member. If this object does not represent a member, an empty string is returned. - @return The name of the member. If the member name has not been set, an empty string is returned. - **/ - public String getMemberName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting member name: " + memberName_); - return memberName_; - } - - /** - Returns the name of the object this path name represents. If this object represents a member, the object name is the name of the file in which the member exists. - @return The name of the object. If the object name has not been set, an empty string is returned. - **/ - public String getObjectName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting object name: " + objectName_); - return objectName_; - } - - /** - Returns type of object this path name represents. Type is the IBM i system abbreviation for the type of object, for example, LIB for library, or CMD for command. Types can be found by prompting for the OBJTYPE parameter on commands such as WRKOBJ. - @return The type of the object. If the object type has not been set, an empty string is returned. - **/ - public String getObjectType() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting object type: " + objectType_); - return objectType_; - } - - /** - Returns the fully qualified integrated file system path name. - @return The fully qualified integrated file system path name. - If the path has not been set, an empty string is returned. - **/ - public String getPath() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting path: " + path_); - return path_; - } - - // Uppercase to simplify parsing. - // Extracts the library name, object name, object type, and member name from the full integrated file system path string. Verifies the full integrated file system path is in fact a valid integrated file system path name for an object in the QSYS file system. Fills in instance data. - // @param path The integrated file system path name to parse. - private void parse(String path) - { - String upperCasePath = toQSYSName(path); - - //------------------------------------------------------ - // Process the prefix. - //------------------------------------------------------ - // Take into account possible IASP prefix to QSYS path. @A1A - // So determine index of "/QSYS.LIB" @A1A - int indexOfQsysLib = upperCasePath.indexOf("/QSYS.LIB"); //@A1A - - // Required prefix. - if (indexOfQsysLib == -1) //@A1C - { - Trace.log(Trace.ERROR, "Specified path does not include '/QSYS.LIB':", path); - throw new IllegalPathNameException(path, IllegalPathNameException.QSYS_PREFIX_MISSING); - } - - // Extract the name of the IASP @A1A - if (indexOfQsysLib > 0) //@A1A - { - // Assume absolute path starts with delimiter - aspName_ = upperCasePath.substring(1, indexOfQsysLib); //@A1A - } - - - // Special case the "/QSYS.LIB" scenario (no other nested objects specified) //@A1A - if ((upperCasePath.substring(indexOfQsysLib).equals("/QSYS.LIB")) || (upperCasePath.substring(indexOfQsysLib).equals("/QSYS.LIB/"))) - { - libraryName_ = "QSYS"; //@A1A - objectType_ = "LIB"; //@A1A - path_ = buildPathName(aspName_, libraryName_, objectName_, memberName_, objectType_); //@A1A - return; //@A1A - } - //------------------------------------------------------ - // Process library. - //------------------------------------------------------ - - // Move to start of first nested object within "/QSYS.LIB/" - int currentOffset = 10; // Length of "/QSYS.LIB/" - if (!aspName_.equals("")) //@A1A - { - // Move past "/iaspname" - currentOffset = currentOffset + 1 + aspName_.length(); //@A1A - } - - // Find suffix after library name. - int nextOffset = upperCasePath.indexOf(".LIB/", currentOffset); - // If a qualifying library name was specified. - if (nextOffset > currentOffset) - { - // If quoted, store as mixed case, else store as uppercase. - libraryName_ = toQSYSName(path.substring(currentOffset, nextOffset)); - // Disallow /QSYS.LIB/QSYS.LIB. - if (libraryName_.equals("QSYS")) - { - Trace.log(Trace.ERROR, "Object in library QSYS specified incorrectly, path: '" + path + "'"); - throw new IllegalPathNameException(path, IllegalPathNameException.QSYS_SYNTAX_NOT_VALID); - } - if (libraryName_.charAt(0) == '%') - { - // Possibly a "special" library name. - if (libraryName_.equals("%LIBL%")) libraryName_ = "*LIBL"; - else if (libraryName_.equals("%CURLIB%")) libraryName_ = "*CURLIB"; - else if (libraryName_.equals("%USRLIBL%")) libraryName_ = "*USRLIBL"; - else if (libraryName_.equals("%ALL%")) libraryName_ = "*ALL"; - else if (libraryName_.equals("%ALLUSR%")) libraryName_ = "*ALLUSR"; - } - // Move past ".LIB/" to the first character of object name. - currentOffset = nextOffset + 5; - } - else if (nextOffset == -1) - { - // No qualifying library name was specified, set library name to QSYS. - libraryName_ = "QSYS"; - } - else - { - // A ".LIB" immediately followed "/QSYS.LIB/". - Trace.log(Trace.ERROR, "Length of the library name is not valid, path: '" + path + "'"); - throw new IllegalPathNameException(path, IllegalPathNameException.LIBRARY_LENGTH_NOT_VALID); - } - // If name is > 10 chars. - if (libraryName_.length() > 10) - { - Trace.log(Trace.ERROR, "Length of the library name is not valid, path: '" + path + "'"); - throw new IllegalPathNameException(path, IllegalPathNameException.LIBRARY_LENGTH_NOT_VALID); - } - - //------------------------------------------------------ - // Process object type. - //------------------------------------------------------ - // Find last period in path name (object.type delimiter). - nextOffset = upperCasePath.lastIndexOf('.'); - // If no type specified or type > 6 chars. - if (nextOffset < currentOffset || upperCasePath.length() - nextOffset - 1 > 6) - { - Trace.log(Trace.ERROR, "Length of the object type is not valid, path: '" + path + "'"); - throw new IllegalPathNameException(path, IllegalPathNameException.TYPE_LENGTH_NOT_VALID); - } - objectType_ = upperCasePath.substring(nextOffset + 1); - - //------------------------------------------------------ - // Process member name. - //------------------------------------------------------ - - // Only needs to be done if the type is MBR. - if (objectType_.equals("MBR")) - { - // Find end of the object (file) name. - int memberOffset = upperCasePath.lastIndexOf(".FILE/", nextOffset); - // If not found or not in object name portion of path. - if (memberOffset == -1 || memberOffset < currentOffset) - { - Trace.log(Trace.ERROR, "Member is not contained in a file, path: '" + path + "'"); - throw new IllegalPathNameException(path, IllegalPathNameException.MEMBER_WITHOUT_FILE); - } - // Move to first char of member name. - memberOffset += 6; - - // Check that member name is 1-10 chars - if (nextOffset < memberOffset || nextOffset - memberOffset > 10) - { - Trace.log(Trace.ERROR, "Length of the member name is not valid, path: '" + path + "'"); - throw new IllegalPathNameException(path, IllegalPathNameException.MEMBER_LENGTH_NOT_VALID); - } - // The member name is syntactically correct. - // If quoted, store as mixed case, else store as uppercase. - memberName_ = toQSYSName(path.substring(memberOffset, nextOffset)); - if (memberName_.charAt(0) == '%') - { - // Check for special member values. - if (memberName_.equals("%FIRST%")) memberName_ = "*FIRST"; - else if (memberName_.equals("%LAST%")) memberName_ = "*LAST"; - else if (memberName_.equals("%FILE%")) memberName_ = "*FILE"; - else if (memberName_.equals("%ALL%")) memberName_ = "*ALL"; - else if (memberName_.equals("%NONE%")) memberName_ = "*NONE"; - } - // Move to period after object name. - nextOffset = memberOffset - 6; - } - - //------------------------------------------------------ - // Process object name. - //------------------------------------------------------ - - // Try to catch the case where the library was specified incorrectly, by testing if the 'object name' has a slash in it but is not quoted, and the library was thought to be QSYS. - if (libraryName_.equals("QSYS") && upperCasePath.substring(currentOffset, nextOffset).indexOf('/') != -1 && upperCasePath.charAt(currentOffset) != '\"') - { - Trace.log(Trace.ERROR, "Library not specified correctly, path: '" + path + "'"); - throw new IllegalPathNameException(path, IllegalPathNameException.LIBRARY_SPECIFICATION_NOT_VALID); - } - // Check that object name is 1-10 chars. - if (nextOffset < currentOffset || nextOffset - currentOffset > 10) - { - Trace.log(Trace.ERROR, "Length of the object name is not valid, path: '" + path + "'"); - throw new IllegalPathNameException(path, IllegalPathNameException.OBJECT_LENGTH_NOT_VALID); - } - // The object name is syntactically correct. - // If quoted, store as mixed case, else store as uppercase. - objectName_ = toQSYSName(path.substring(currentOffset, nextOffset)); - // Check for special object values. - if (objectName_.equals("%ALL%")) objectName_ = "*ALL"; - - // Fill in path_ instance var (with correct case). - path_ = buildPathName(aspName_, libraryName_, objectName_, memberName_, objectType_); - } - - /** - Removes a listener from the change list. If the listener is not on the list, do nothing. - @param listener The listener object. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - checkListener(listener); - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes a listener from the veto list. If the listener is not on the list, do nothing. - @param listener The listener object. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - checkListener(listener); - // If we have listeners. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - /** - Sets the IASP in which the object resides. This is a bound and constrained property. Note that changes to this property also affect the pathName property. - @param aspName The IASP in which the object exists. It must be 1-10 characters. - @exception PropertyVetoException If the change was vetoed. - **/ - public void setAspName(String aspName) throws PropertyVetoException //@A1A - { - // Check for valid parameter. - checkAspName(aspName); - - // Process the asp name, if quoted, store as mixed case, else store as uppercase. - String newAspName = toQSYSName(aspName); - // Build new path. - String newPath = buildPathName(newAspName, libraryName_, objectName_, memberName_, objectType_); - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - // Make the changes. - aspName_ = newAspName; - path_ = newPath; - } - else - { - String oldAspName = aspName_; - String oldPath = path_; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("aspName", oldAspName, newAspName); - vetoableChangeListeners_.fireVetoableChange("path", oldPath, newPath); - } - - // Make the changes. - aspName_ = newAspName; - path_ = newPath; - - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("aspName", oldAspName, newAspName); - propertyChangeListeners_.firePropertyChange("path", oldPath, newPath); - } - } - } - - - /** - Sets the library in which the object resides. This is a bound and constrained property. Note that changes to this property also affect the pathName property. - @param libraryName The library in which the object exists. It must be 1-10 characters. - @exception PropertyVetoException If the change was vetoed. - **/ - public void setLibraryName(String libraryName) throws PropertyVetoException - { - // Check for valid parameter. - checkLibraryName(libraryName); - - // Process the library name, if quoted, store as mixed case, else store as uppercase. - String newLibraryName = toQSYSName(libraryName); - // Build new path. - String newPath = buildPathName(aspName_, newLibraryName, objectName_, memberName_, objectType_); - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - // Make the changes. - libraryName_ = newLibraryName; - path_ = newPath; - } - else - { - String oldLibraryName = libraryName_; - String oldPath = path_; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("libraryName", oldLibraryName, newLibraryName); - vetoableChangeListeners_.fireVetoableChange("path", oldPath, newPath); - } - - // Make the changes. - libraryName_ = newLibraryName; - path_ = newPath; - - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("libraryName", oldLibraryName, newLibraryName); - propertyChangeListeners_.firePropertyChange("path", oldPath, newPath); - } - } - } - - /** - Sets the name of the member. If a value other than an empty String ("") is specified, the object type is set to MBR. This is a bound and constrained property. Note that changes to this property also affect the objectType and pathName properties. - @param memberName The name of the member. It must be 10 characters or less. An empty String ("") can be passed to indicate this object does not represent a member. - @exception PropertyVetoException If the change was vetoed. - **/ - public void setMemberName(String memberName) throws PropertyVetoException - { - // Check for valid parameter. - if (memberName == null) - { - Trace.log(Trace.ERROR, "Parameter 'memberName' is null."); - throw new NullPointerException("memberName"); - } - if (memberName.length() > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'memberName' is not valid: '" + memberName + "'"); - throw new ExtendedIllegalArgumentException("memberName (" + memberName + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - // If quoted, store as mixed case, else store as uppercase. - String newMemberName = toQSYSName(memberName); - // The type of an object with a member is always MBR. - String newObjectType = memberName.length() != 0 ? "MBR" : objectType_; - // Build new path name. - String newPath = buildPathName(aspName_, libraryName_, objectName_, newMemberName, newObjectType); - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - // Make the changes. - memberName_ = newMemberName; - objectType_ = newObjectType; - path_ = newPath; - } - else - { - String oldMemberName = memberName_; - String oldObjectType = objectType_; - String oldPath = path_; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("memberName", oldMemberName, newMemberName); - vetoableChangeListeners_.fireVetoableChange("objectType", oldObjectType, newObjectType); - vetoableChangeListeners_.fireVetoableChange("path", oldPath, newPath); - } - - // Make the changes. - memberName_ = newMemberName; - objectType_ = newObjectType; - path_ = newPath; - - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("memberName", oldMemberName, newMemberName); - propertyChangeListeners_.firePropertyChange("objectType", oldObjectType, newObjectType); - propertyChangeListeners_.firePropertyChange("path", oldPath, newPath); - } - } - } - - /** - Sets the name of the object this path name represents. If this object represents a member, the object name is the name of the file that the member is in. This is a bound and constrained property. Note that changes to this property also affect the pathName property. - @param objectName The name of the object. It must be 1-10 characters. - @exception PropertyVetoException If the change was vetoed. - **/ - public void setObjectName(String objectName) throws PropertyVetoException - { - // Check for valid parameter. - checkObjectName(objectName); - - // Process object name. if quoted, store as mixed case else store as uppercase. - String newObjectName = toQSYSName(objectName); - // Build new path name. - String newPath = buildPathName(aspName_, libraryName_, newObjectName, memberName_, objectType_); - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - // Make the changes. - objectName_ = newObjectName; - path_ = newPath; - } - else - { - String oldObjectName = objectName_; - String oldPath = path_; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("objectName", oldObjectName, newObjectName); - vetoableChangeListeners_.fireVetoableChange("path", oldPath, newPath); - } - - // Make the changes. - objectName_ = newObjectName; - path_ = newPath; - - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("objectName", oldObjectName, newObjectName); - propertyChangeListeners_.firePropertyChange("path", oldPath, newPath); - } - } - } - - /** - Sets type of object this path name represents. If the type is not MBR, the member name property will be set to an empty string. The value will be uppercased. This is a bound and constrained property. Note that changes to this property also affect the memberName and pathName properties. - @param objectType The type of the object. It must be 1-6 characters. This is the IBM i system abbreviation for the type of object, for example, LIB for library, or CMD for command. Types can be found by prompting for the OBJTYPE parameter on commands such as WRKOBJ. - @exception PropertyVetoException If the change was vetoed. - **/ - public void setObjectType(String objectType) throws PropertyVetoException - { - // Check for valid parameter. - checkObjectType(objectType); - - // Process object type. - String newObjectType = objectType.toUpperCase(); - String newMemberName = newObjectType.equals("MBR") ? memberName_ : ""; - // Build new path name. - String newPath = buildPathName(aspName_, libraryName_, objectName_, newMemberName, newObjectType); - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - // Make the changes. - memberName_ = newMemberName; - objectType_ = newObjectType; - path_ = newPath; - } - else - { - String oldMemberName = memberName_; - String oldObjectType = objectType_; - String oldPath = path_; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("memberName", oldMemberName, newMemberName); - vetoableChangeListeners_.fireVetoableChange("objectType", oldObjectType, newObjectType); - vetoableChangeListeners_.fireVetoableChange("path", oldPath, newPath); - } - - // Make the changes. - objectType_ = newObjectType; - memberName_ = newMemberName; - path_ = newPath; - - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("memberName", oldMemberName, newMemberName); - propertyChangeListeners_.firePropertyChange("objectType", oldObjectType, newObjectType); - propertyChangeListeners_.firePropertyChange("path", oldPath, newPath); - } - } - } - - /** - Sets the integrated file system path name for this object. This is a bound and constrained property. Note that changes to this property also affect the libraryName, memberName, objectName, and objectType properties. - @param path The fully qualified integrated file system name of an object in the QSYS file system. - @exception PropertyVetoException If the change was vetoed. - **/ - public void setPath(String path) throws PropertyVetoException - { - // Verify path is valid IFS path name. - QSYSObjectPathName ifs = new QSYSObjectPathName(path); - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - // Make the changes. - path_ = ifs.path_; - libraryName_ = ifs.libraryName_; - objectName_ = ifs.objectName_; - memberName_ = ifs.memberName_; - objectType_ = ifs.objectType_; - } - else - { - String newPath = ifs.path_; - String newLibraryName = ifs.libraryName_; - String newObjectName = ifs.objectName_; - String newMemberName = ifs.memberName_; - String newObjectType = ifs.objectType_; - - String oldPath = path_; - String oldLibraryName = libraryName_; - String oldObjectName = objectName_; - String oldMemberName = memberName_; - String oldObjectType = objectType_; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("path", oldPath, newPath); - vetoableChangeListeners_.fireVetoableChange("libraryName", oldLibraryName, newLibraryName); - vetoableChangeListeners_.fireVetoableChange("objectName", oldObjectName, newObjectName); - vetoableChangeListeners_.fireVetoableChange("memberName", oldMemberName, newMemberName); - vetoableChangeListeners_.fireVetoableChange("objectType", oldObjectType, newObjectType); - } - - // Make the changes. - path_ = newPath; - libraryName_ = newLibraryName; - objectName_ = newObjectName; - memberName_ = newMemberName; - objectType_ = newObjectType; - - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("path", oldPath, newPath); - propertyChangeListeners_.firePropertyChange("libraryName", oldLibraryName, newLibraryName); - propertyChangeListeners_.firePropertyChange("objectName", oldObjectName, newObjectName); - propertyChangeListeners_.firePropertyChange("memberName", oldMemberName, newMemberName); - propertyChangeListeners_.firePropertyChange("objectType", oldObjectType, newObjectType); - } - } - } - - /** - Builds an integrated file system path name to represent the object. - @param libraryName The library the object is in. It must be 1-10 characters. - @param objectName The name of the object. It must be 1-10 characters. - @param objectType The type of the object. It must be 1-6 characters. This is the IBM i system abbreviation for the type of object, for example, LIB for library, or CMD for command. Types can be found by prompting for the OBJTYPE parameter on commands such as WRKOBJ. - @return The integrated file system name for the object. - **/ - public static String toPath(String libraryName, String objectName, String objectType) - { - // Note the code in this method is similar to that in the construct method, and code changes here should most likely be reflected there as well. - - // Verify arguments will make a valid QSYS IFS path name. - checkLibraryName(libraryName); - checkObjectName(objectName); - checkObjectType(objectType); - - libraryName = toQSYSName(libraryName); - objectName = toQSYSName(objectName); - objectType = objectType.toUpperCase(); - - return buildPathName(libraryName, objectName, "", objectType); - } - - /** - Builds an integrated file system path name to represent the member. - @param libraryName The library the object is in. It must be 1-10 characters. - @param objectName The name of the object. It must be 1-10 characters. - @param memberName The name of the member. It must be 1-10 characters. - @param objectType The type of the object. This must be "MBR". - @return The integrated file system name for the object. - **/ - public static String toPath(String libraryName, String objectName, String memberName, String objectType) - { - // Note the code in this method is similar to that in the 4-parm ctor, and code changes here should most likely be reflected there as well. - - // Verify arguments will make a valid QSYS IFS path name. - checkLibraryName(libraryName); - checkObjectName(objectName); - checkMemberName(memberName); - checkObjectTypeIsMember(objectType); - - libraryName = toQSYSName(libraryName); - objectName = toQSYSName(objectName); - memberName = toQSYSName(memberName); - objectType = objectType.toUpperCase(); - - return buildPathName(libraryName, objectName, memberName, objectType); - } - - /** - Builds an integrated file system path name to represent the member. - @param aspName The IASP on which the object exists. It must be 1-10 characters. - @param libraryName The library the object is in. It must be 1-10 characters. - @param objectName The name of the object. It must be 1-10 characters. - @param memberName The name of the member. It must be 1-10 characters. - @param objectType The type of the object. This must be "MBR". - @return The integrated file system name for the object. - **/ - // Similar to previous toPath() method but include aspName parameter - public static String toPath(String aspName, String libraryName, String objectName, String memberName, String objectType)//@A1A - { - // Note the code in this method is similar to that in the 4-parm ctor, and code changes here should most likely be reflected there as well. - - // Verify arguments will make a valid QSYS IFS path name. - checkAspName(aspName); - checkLibraryName(libraryName); - checkObjectName(objectName); - checkMemberName(memberName); - checkObjectTypeIsMember(objectType); - - libraryName = toQSYSName(libraryName); - objectName = toQSYSName(objectName); - memberName = toQSYSName(memberName); - objectType = objectType.toUpperCase(); - aspName = aspName.toUpperCase(); - - return buildPathName(aspName, libraryName, objectName, memberName, objectType); - } - - /** - Utility method for selectively uppercasing the characters in a string, for use as an IBM i *NAME value. This method is used, for example, when uppercasing object names, library names, and member names. Characters within double-quotes are left as-is. - @param name The name to be uppercased. - @return The *NAME value, selectively uppercased. - **/ - public static final String toQSYSName(String name) - { - // Uppercase all unquoted characters _except_ the "Latin small letter 'a' with grave" (\u00E0), which for CCSID 297 (French) gets converted to EBCDIC x7C, an invariant character that is allowed in *NAME strings. - - if (name.indexOf('\u00E0') == -1 && // no special characters - name.indexOf('\"') == -1) { // and no quotes - return name.toUpperCase(); - } - else { // selectively uppercase unquoted characters - StringBuffer result = new StringBuffer(); - int length = name.length(); - boolean inQuotes = false; - for (int i=0; i 10) { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Truncating object name to 10 characters:" , objectName_); - buffer.replace(0, 10, objectName_.substring(0,10)); - } - else - buffer.replace(0, objectName_.length(), objectName_); - - // Set the library name into the second 10 characters. - if (libraryName_.length() > 10) { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Truncating library name to 10 characters:" , libraryName_); - buffer.replace(10, 20, libraryName_.substring(0,10)); - } - else - buffer.replace(10, libraryName_.length()+10, libraryName_); - - return buffer.toString(); - } - - - // Validates a path. - // @param path The fully qualified integrated file system name of an object in the QSYS file system. - // @param objectType The type of object path should represent. - static final void validatePath(String path, String objectType) - { - // The constructor will throw an exception if the path is not valid. - verified_ = new QSYSObjectPathName(path, objectType); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/QSYSObjectPathName16.gif b/cvsroot/src/com/ibm/as400/access/QSYSObjectPathName16.gif deleted file mode 100644 index 99a6215b0..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/QSYSObjectPathName16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/QSYSObjectPathName32.gif b/cvsroot/src/com/ibm/as400/access/QSYSObjectPathName32.gif deleted file mode 100644 index 8c62ef7b0..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/QSYSObjectPathName32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/QSYSObjectPathNameBeanInfo.java b/cvsroot/src/com/ibm/as400/access/QSYSObjectPathNameBeanInfo.java deleted file mode 100644 index 696093493..000000000 --- a/cvsroot/src/com/ibm/as400/access/QSYSObjectPathNameBeanInfo.java +++ /dev/null @@ -1,160 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: QSYSObjectPathNameBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2008 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @A1 12/12/2007 Correct EventSet for VetoablePropertyChange -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - The QSYSObjectPathNameBeanInfo class provides BeanInfo for QSYSObjectPathName class. - **/ -public class QSYSObjectPathNameBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class BEAN_CLASS = QSYSObjectPathName.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", //@A1C - VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - - eventSetDescriptors = new EventSetDescriptor[] { propertyChange, vetoableChange }; - - PropertyDescriptor path = new PropertyDescriptor("path", BEAN_CLASS); - path.setBound(true); - path.setConstrained(true); - path.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_PATH")); - path.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_PATH")); - - PropertyDescriptor libraryName = new PropertyDescriptor("libraryName", BEAN_CLASS); - libraryName.setBound(true); - libraryName.setConstrained(true); - libraryName.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_LIBRARY")); - libraryName.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_LIBRARY")); - - PropertyDescriptor objectName = new PropertyDescriptor("objectName", BEAN_CLASS); - objectName.setBound(true); - objectName.setConstrained(true); - objectName.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_OBJECT")); - objectName.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_OBJECT")); - - PropertyDescriptor memberName = new PropertyDescriptor("memberName", BEAN_CLASS); - memberName.setBound(true); - memberName.setConstrained(true); - memberName.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_MEMBER")); - memberName.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_MEMBER")); - - PropertyDescriptor objectType = new PropertyDescriptor("objectType", BEAN_CLASS); - objectType.setBound(true); - objectType.setConstrained(true); - objectType.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_TYPE")); - objectType.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_TYPE")); - - propertyDescriptors = new PropertyDescriptor[] { path, libraryName, objectName, memberName, objectType }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return Zero (0), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "propertyChange" event. - return 0; - } - - /** - Returns the index of the default property. - @return Zero (0), the index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // The index for the "path" property. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("QSYSObjectPathName16.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("QSYSObjectPathName32.gif"); - } - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/QSYSObjectTypeTable.java b/cvsroot/src/com/ibm/as400/access/QSYSObjectTypeTable.java deleted file mode 100644 index 4003519c9..000000000 --- a/cvsroot/src/com/ibm/as400/access/QSYSObjectTypeTable.java +++ /dev/null @@ -1,349 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: QSYSObjectTypeTable.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Hashtable; -import java.util.MissingResourceException; -import java.util.Vector; - - - -/** -Maintains a list of object types -and extended attributes for objects on the system. - -

    For example, to list all possible extended attributes for -the "FILE" object type. -

    
    -String[] extendedAttributes = QSYSObjectTypeTable.getSupportedAttributes("FILE");
    -for(int i = 0; i < extendedAttributes.length; ++i)
    -{
    -System.out.println(QSYSObjectTypeTable.getLocalizedObjectType("FILE", extendedAttributes[i]));
    -}
    -
    -**/ -// -// Implementation notes: -// -// This is the master list and is used by Operations Navigator. -// It was generated by a DCG-approved list. -// For each type and attribute in this table, there needs to -// be a corresponding string in MRI.java. -// -public class QSYSObjectTypeTable -{ - private static final String[] noAttributes_ = new String[0]; - private static Hashtable table_ = new Hashtable(); - private static Vector typesAsVector_ = new Vector(); - private static String[] types_ = null; - private static Vector userDefinedAttributesAllowed_ = new Vector(); // @A1A - - // Note: The following types occur only in IFS, not in QSYS: - /* - BLKSF - CHRSF - DDIR - DIR - DSTMF - FIFO - NWSSTG - SOCKET - STMF - SYMLNK - */ - - - static - { - add("ALRTBL"); - add("AUTL"); - add("BLKSF"); // this type does not occur in QSYS - add("BNDDIR"); - add("CFGL", new String[] { "", "APPNDIR", "APPNLCL", "APPNRMT", "APPNSSN", "ASYNCADR", "ASYNCLOC", "SNAPASTHR" }); - add("CHTFMT"); - add("CHRSF"); // this type does not occur in QSYS - add("CLD"); - add("CLS"); - add("CMD"); - add("CNNL"); - add("COSD"); - add("CRG"); - add("CRQD"); - add("CSI"); - add("CSPMAP"); - add("CSPTBL"); - add("CTLD", new String[] { "", "APPC", "ASC", "BSC", "FNC", "HOST", "LWS", "NET", "RTL", "RWS", "TAP", "VNM", "VWS" }); //@550C - add("DDIR"); // this type does not occur in QSYS - add("DEVD", new String[] { "", "APPC", "ASC", "ASP", "BSC", "CRP", "DKT", "DSPLCL", "DSPRMT", "DSPSNP", "DSPVRT", "FNC", "HOST", "INTR", "MLB", "NET", "OPT", "PRTLCL", "PRTLAN", "PRTRMT", "PRTSNP", "PRTVRT", "RTL", "SNPTUP", "SNPTDN", "SNUF", "TAP" }); - add("DIR"); // this type does not occur in QSYS - add("DOC"); - add("DSTMF"); // this type does not occur in QSYS - add("DTAARA"); - add("DTADCT"); - add("DTAQ", new String[] { "", "DDMDTAQUE" }); - add("EDTD"); - add("EXITRG"); - add("FCT"); - add("FIFO"); // this type does not occur in QSYS - add("FILE", new String[] { "", "PF", "LF", "BSCF38", "CMNF38", "CRDF38", "DFU", "DFUEXC", "DFUNOTEXC", "DSPF", "DSPF36", "DSPF38", "DDMF", "DKTF", "ICFF", "LF38", "MXDF38", "PF38", "PRTF", "PRTF38", "SAVF", "TAPF" }); - add("FLR"); - add("FNTRSC", new String[] { "", "CDEFNT", "FNTCHRSET", "CDEPAG" }); - add("FNTTBL"); - add("FORMDF"); - add("FTR", new String[] { "", "ALR", "PRB" }); - add("GSS", new String[] { "", "VSS", "ISS" }); - add("IGCDCT"); - add("IGCSRT"); - add("IGCTBL"); - add("IMGCLG"); // @M2a - add("IPXD"); - add("JOBD"); - add("JOBQ"); - add("JOBSCD"); - add("JRN"); - add("JRNRCV"); - add("LIB", new String[] { "", "PROD", "TEST" }); - add("LIND", new String[] { "", "ASC", "BSC", "DDI", "ETH", "FAX", "FR", "IDLC", "NET", "PPP", "SDLC", "TDLC", "TRN", "WLS", "X25" }); - add("LOCALE"); - add("MEDDFN"); - add("MENU", new String[] { "", "UIM", "DSPF", "PGM" }); - add("MGTCOL", new String[] { "", "PFR", "PFRHST", "PFRDTL" }); - add("MODD"); - add("MODULE", new String[] { "", "CLE", "CLLE", "RPGLE", "CBLLE", "CPPLE" }); - add("MSGF"); - add("MSGQ"); - add("M36"); - add("M36CFG"); - add("NODGRP"); - add("NODL"); - add("NTBD"); - add("NWID", new String[] { "", "ATM", "FR", "ISDN" }); - add("NWSCFG"); - add("NWSD", new String[] { "", "GUEST", "IXSVR", "WINDOWSNT" }); //@550C - add("OUTQ"); - add("OVL"); - add("PAGDFN"); - add("PAGSEG"); - add("PDFMAP"); //@K1A - add("PDG"); - add("PGM", new String[] { "", "ASM38", "BAS", "BAS38", "C", "CBL", "CBLLE", "CBL36", "CBL38", - "CLE", "CLLE", "CLP", "CLP38", "CPPLE", "CSP", "DFU", "DFUEXC", - "DFUNOTEXC", "FTN", "PAS", "PAS38", "PLI", "PLI38", "RMC", "RPG", - "RPGLE", "RPG36", "RPG38" }); - add("PNLGRP"); - add("PRDAVL"); - add("PRDDFN"); - add("PRDLOD"); - add("PSFCFG"); - add("QMFORM", new String[] { "", "QUERYMGR" }); - add("QMQRY", new String[] { "PROMPT", "SQL" }); - add("QRYDFN", new String[] { "", "QRY" }); - add("RCT"); - add("SBSD"); // @D1c (was originally commended out under @A1d) - add("SCHIDX"); - add("SOCKET"); // this type does not occur in QSYS - add("SPADCT", new String[] { "", "AFRIKAAN", "AKTUEEL", "BRASIL", "CATALA", "DANSK", - "DEUTSCH", "DEUTSCH2", "DSCHWEIZ", "ESPANA", "FRANCAIS", - "FRA2", "GREEK", "ISLENSK", "ITALIANO", "LEGAL", "MEDICAL", - "NEDERLND", "NEDPLUS", "NORBOK", "NORNYN", "PORTUGAL", - "RUSSIAN", "SUOMI", "SVENSK", "UK", "US" }); - add("SQLPKG"); - add("SQLXSR"); // v7r1 - add("SQLUDT"); - add("SRVPGM", new String[] { "", "CLE", "CLLE", "RPGLE", "CBLLE", "CPPLE" }); - add("SSND"); - add("STMF"); // this type does not occur in QSYS - add("SVRSTG"); - add("SYMLNK"); // this type does not occur in QSYS - add("S36"); - add("TBL"); - add("TIMZON"); //@K1A - add("USRIDX"); - add("USRPRF"); - add("USRQ"); - add("USRSPC"); - add("VLDL"); - add("WSCST"); - - types_ = new String[typesAsVector_.size()]; - typesAsVector_.copyInto(types_); - - userDefinedAttributesAllowed_.addElement("USRIDX"); // @A1A - userDefinedAttributesAllowed_.addElement("USRQ"); // @A1A - userDefinedAttributesAllowed_.addElement("USRSPC"); // @A1A - } - - - - private static void add(String type) - { - add(type, noAttributes_); - } - - - - private static void add(String type, String[] attributes) - { - typesAsVector_.addElement(type); - table_.put(type, attributes); - } - - - - // No need to be able to instantiate this object. - private QSYSObjectTypeTable() { }; - - -/** -Returns a localized description of an object type. - -@param type The object type. -@return The localized description. -**/ - public static String getLocalizedObjectType(String type) - { - return getLocalizedObjectType(type, null); - } - - - -/** -Returns a localized description of an object type. - -@param type The object type. -@param attribute The extended attribute, or null if none. -@return The localized description, or the type name - if no localized desription can be determined. -**/ -// -// Design note: I thought about allowing attribute == "" to mean -// the same thing as null, but I decided against it, in case -// we ever need to differentiate between a type with no -// attribute and a type with an attribute not specified -// (i.e. ). -// - public static String getLocalizedObjectType(String type, String attribute) - { - if (type == null) - throw new NullPointerException("type"); - - // First let's get the string for the type, then tack on the attribute - // if needed. - StringBuffer localized = new StringBuffer(); - - // Concoct the MRI key. - StringBuffer buffer = new StringBuffer(); - buffer.append("TYPE_"); - - // Add the type. Uppercase it and remove a * if included in the first character. - type = type.trim().toUpperCase(); // @A1A - if (type.length() > 0) { - if (type.charAt(0) == '*') { - if (type.length() > 1) // @A1C - type = type.substring(1); // @A1C - else - throw new ExtendedIllegalArgumentException("type(" + type + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - buffer.append(type); // @A1C - } // @A1C - else // @A1A - throw new ExtendedIllegalArgumentException("type(" + type + ")", // @A1A - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); // @A1A - - // Get the MRI for the type. // @A1C - String mriKey = buffer.toString(); - try { - localized.append(ResourceBundleLoader.getText(mriKey)); - } - catch(MissingResourceException e) { - localized.append(type); - } - - // Add the attribute if included. - if (attribute != null) { - String attributeOriginalCase = attribute.trim(); // @A1A - attribute = attributeOriginalCase.toUpperCase(); // @A1A - if (attribute.length() > 0) { // @A1C - buffer.append('_'); - buffer.append(attribute.toUpperCase()); - mriKey = buffer.toString(); - try { - String attributeText = ResourceBundleLoader.getText(mriKey); - if (attributeText.length() > 0) { // @A1A - localized.append(" - "); - localized.append(attributeText); - } // @A1A - } - catch(MissingResourceException e) { - // The attribute was not found. For the types where @A1C - // is allowed, we will add the attribute as @A1A - // it is specified. For all others, we will just return the @A1A - // type with no hyphen. This accounts for . @A1A - if (userDefinedAttributesAllowed_.contains(type)) { // @A1A - localized.append(" - "); // @A1A - localized.append(attributeOriginalCase); // @A1A - } // @A1A - } - } // @A1A - } - - return localized.toString(); - } - - - - -/** -Returns a list of the supported extended attributes for an object type. - -@param type The object type. -@return The list of the supported extended attributes. -**/ - public static String[] getSupportedAttributes(String type) - { - if (!table_.containsKey(type)) - throw new ExtendedIllegalArgumentException("type(" + type + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - else - return (String[])table_.get(type); - } - - - -/** -Returns a list of the supported object types. - -@return The list of the supported object types. -**/ - public static String[] getSupportedObjectTypes() - { - String[] types = null; - if (types_ != null) - { - // Create a copy, so as not to expose internal representation. - types = new String[types_.length]; - for (int i=0; iThe QSYSPermission class represents the permissions for the specified user -of an object in the traditional IBM i library structure stored in QSYS.LIB. -

    A object stored in QSYS.LIB can set its authorities by setting a single - object authority value or by setting the individual object and data authorities. -

    Use getObjectAuthority() to display the current object authority or -setObjectAuthority() to set the current object authority using a single value. -Valid values are: *ALL, *AUTL, *CHANGE, *EXCLUDE, and *USE. - -

    The detailed object authority can be set to one or more of the following -values: alter, exist, management, operational, reference. Use the -appropriate set methods (setAlter(), setExistence(), -setManamagement(), setOperational(), or setReference()) -to set the value on or off. After all values are set, use the commit() -method from the Permission class to send the changes to the system. - - -

    The data authority can be set to one or more of the following values: -add, delete, execute, read, or update. Use the appropriate -set methods (setAdd(), setDelete(), setExecute(), -setRead(), or setUpdate()) to set the value on or off. After all -the values are set, use the commit() method from the Permission class -to send the changes to the system. - -

    The single authority actually represents a combination of the detailed object -authorities and the data authorities. Selecting a single authority will -automatically turn on the appropriate detailed authorities. Likewise, selecting - various detailed authorities will change the appropriate single authority values. - - -

    For more information on object authority commands, refer to IBM i CL -commands GRTOBJAUT (Grant object authority) and EDTOBJAUT (Edit object authority). -**/ - -public class QSYSPermission extends UserPermission -{ - static final long serialVersionUID = 4L; - - - /** - * Constructs a QSYSPermission object. This is the permission of the - * specified user. - * @param userProfileName The name of the user profile. - * - **/ - public QSYSPermission(String userProfileName) - { - super(userProfileName); - dataAuthority_ = "*EXCLUDE"; - objectAuthority_ = BASIC_EXCLUDE; - authorities_ = new boolean[10]; - for (int i=0;i<10;i++) - { - authorities_[i] = false; - } - return; - } - - - // @A2a - /** - * Pad or truncate the given string to the - * given length. If the given String is null, an empty String - * of the correct length will be returned. - * - * @param s The string to pad or truncate. - * @param desiredLength The length to pad or truncate the given string to. - * @return The padded or truncated string. - */ - static String adjustLength(String s, int desiredLength) - { - if (s == null) s = ""; - int sLength = s.length(); - if (sLength == desiredLength) return s; - else if (sLength < desiredLength) - { - StringBuffer buffer = new StringBuffer(s); - for(int i = sLength; i < desiredLength; i++) - buffer.append(' '); - return buffer.toString(); - } - else return s.substring(0, desiredLength); - } - - - - // @A3a - This logic was formerly in PermissionAccessQSYS.getChgCommand(). - /** - * Returns the current object authorities and data authorities. - * @param objectIsAuthList true if the object is an AUTL object; false otherwise. - * @return The current authorities, as a blank-separated list. - * - **/ - String getAuthorities(boolean objectIsAuthList) - { - String authority=""; - - if (isManagement()) - authority=authority+"*OBJMGT "; - if (isExistence()) - authority=authority+"*OBJEXIST "; - if (isAlter()) - authority=authority+"*OBJALTER "; - if (isReference()) - authority=authority+"*OBJREF "; - if (isOperational()) - authority=authority+"*OBJOPR "; - if (isAdd()) - authority=authority+"*ADD "; - if (isDelete()) - authority=authority+"*DLT "; - if (isRead()) - authority=authority+"*READ "; - if (isUpdate()) - authority=authority+"*UPD "; - if (isExecute()) - authority=authority+"*EXECUTE "; - if (objectIsAuthList && isAuthorizationListManagement()) - authority=authority+"*AUTLMGT"; - - if (authority.equals("")) - authority = "*EXCLUDE"; - - return authority; - } - - - /** - * Returns the object authority of the user specified as a single value. - * @return The object authority of the user specified as a single value. - * The possible values are: -

      -
    • *ALL The user can perform all operations on the object - except for those limited to the owner or controlled by - authorization list management authority. The user can control - the object's existence, specify the security for the object, change - the object, and perform basic functions on the object. The user - can also change ownership of the object. -
    • *AUTL The public authority of the authorization list securing the - object will be used. This is valid only if *PUBLIC is the user - specified. -
    • *CHANGE The user can perform all operations on the object - except those limited to the owner or controlled by object existence - authority and object management authority. -
    • *EXCLUDE The user cannot access the object. -
    • *USE The user has object operational authority, read authority, - and execute authority. -
    - * @see #setObjectAuthority(String) - **/ - public String getObjectAuthority() - { - parseBasic(); - if (isFromAuthorizationList()) - return "*AUTL"; - switch (objectAuthority_) - { - case BASIC_ALL : - return "*ALL"; - case BASIC_EXCLUDE : - return "*EXCLUDE"; - case BASIC_USE : - return "*USE"; - case BASIC_CHANGE : - return "*CHANGE"; - default : - return "USER DEFINED"; - } - } - - - // @A2a - /** - * Determines if the user has the given authorities to the object on the system. - * Returns true if the user has at least all of the specified authorities, - * and false otherwise. - * @param system The system. - * @param userProfileName The name of the user profile. - * @param objectPath The full path of the object. For example, "/QSYS.LIB/FRED.LIB". - * @param authorityList The list of authorities. At least one authority must be specified. - * Possible authorities include: - *
    -     * *EXCLUDE
    -     * *ALL
    -     * *CHANGE
    -     * *USE
    -     * *AUTLMGT
    -     * *OBJALTER
    -     * *OBJOPR
    -     * *OBJMGT
    -     * *OBJEXIST
    -     * *OBJREF
    -     * *READ
    -     * *ADD
    -     * *UPD
    -     * *DLT
    -     * *EXECUTE
    -     * 
    - * @return true if the user has all the specified authorities to the object. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with the system. - */ - public static boolean hasObjectAuthorities(AS400 system, String userProfileName, String objectPath, String[] authorityList) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - if (system == null) throw new NullPointerException("system"); - if (userProfileName == null) throw new NullPointerException("userProfileName"); - if (objectPath == null) throw new NullPointerException("objectPath"); - if (authorityList == null) throw new NullPointerException("authorityList"); - if (authorityList.length == 0) { - Trace.log (Trace.ERROR, "No authorities were specified."); - throw new ExtendedIllegalArgumentException("authorityList", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - boolean rcStatus = true; - - String program = "/QSYS.LIB/QSYCUSRA.PGM"; - String profile = adjustLength(userProfileName, 10); - QSYSObjectPathName qsysObjPath = new QSYSObjectPathName(objectPath); - String attribute = "*" + adjustLength(qsysObjPath.getObjectType(), 9); - String qualObj = adjustLength(qsysObjPath.getObjectName(), 10) + adjustLength(qsysObjPath.getLibraryName(), 10); - - StringBuffer authorities = new StringBuffer(); - for (int i=0; i< authorityList.length; i++) - authorities.append(adjustLength(authorityList[i], 10)); - - try - { - ProgramCall newCall = new ProgramCall(system); - ProgramParameter paramList[] = new ProgramParameter[8]; - - paramList[0] = new ProgramParameter(1); - paramList[0].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - paramList[1] = new ProgramParameter(CharConverter.stringToByteArray(system, profile)); - paramList[2] = new ProgramParameter(CharConverter.stringToByteArray(system, qualObj)); - paramList[3] = new ProgramParameter(CharConverter.stringToByteArray(system, attribute)); - paramList[4] = new ProgramParameter(CharConverter.stringToByteArray(system, authorities.toString())); - paramList[5] = new ProgramParameter(BinaryConverter.intToByteArray(authorityList.length)); // # of Authorities - paramList[6] = new ProgramParameter(BinaryConverter.intToByteArray(1)); // Call Level - - // Input/Output parameter. Returns information as follows : - // First four bytes = size of the error code structure. - // Next four bytes = bytes available - // Next seven bytes = message id - // Last byte = reserved / Never used. - byte [] parmByt7 = new byte[16]; - System.arraycopy(BinaryConverter.intToByteArray(16), 0, parmByt7, 0, 4); - - paramList[7] = new ProgramParameter(parmByt7, 16); - paramList[7].setParameterType(ProgramParameter.PASS_BY_REFERENCE); - - newCall.setProgram(program, paramList); - - if (newCall.run() != true) - { - // If any error message return. - AS400Message[] msgList = newCall.getMessageList(); - throw new AS400Exception(msgList); - } - - byte [] errCode = paramList[7].getOutputData(); - - // Get the available bytes from the input/output parameter (8th param). - // If the available bytes is greater than 0 there was an error. - if (BinaryConverter.byteArrayToInt(errCode, 4) > 0) - { - byte[] message = new byte[7]; - System.arraycopy(errCode, 8, message, 0, 7); - String msgId = CharConverter.byteArrayToString(system, message); - Trace.log(Trace.ERROR, "Error code from QSYCUSRA: " + msgId); - throw new AS400Exception(new AS400Message(msgId,"")); - } - - String output = CharConverter.byteArrayToString(system, paramList[0].getOutputData()); - - if (!output.startsWith("Y")) - rcStatus = false; - } - catch (java.beans.PropertyVetoException e) - { - // This should never happen. - Trace.log(Trace.ERROR, e.toString()); - } - - return rcStatus; - } - - - /** - * Indicates if the user has the data authority of add. - * @return true if the user has the data authority of add; - * false otherwise. - * - **/ - public boolean isAdd() - { - return authorities_[DATA_ADD]; - } - - - /** - * Indicates if the user has the object authority of alter. - * @return true if the user has the object authority of alter; - * false otherwise. - * - **/ - public boolean isAlter() - { - return authorities_[OBJECT_ALTER]; - } - - - /** - * Indicates if the user has the data authority of delete. - * @return true if the user has the data authority of delete; - * false otherwise. - * - **/ - public boolean isDelete() - { - return authorities_[DATA_DELETE]; - } - - /** - * Indicates if the user has the data authority of execute. - * @return true if the user has the data authority of execute; - * false otherwise. - * - **/ - public boolean isExecute() - { - return authorities_[DATA_EXECUTE]; - } - /** - * Indicates if the user has the object authority of existence. - * @return true if the user has the object authority of existence; - * false otherwise. - * - **/ - public boolean isExistence() - { - return authorities_[OBJECT_EXIST]; - } - - - /** - * Indicates if the user has the object authority of management. - * @return true if the user has the object authority of management; - * false otherwise. - * - **/ - - public boolean isManagement() - { - return authorities_[OBJECT_MANAGEMENT]; - } - - - /** - * Indicates if the user has the object authority of operational. - * @return true if the user has the object authority of operational; - * false otherwise. - * - **/ - - public boolean isOperational() - { - return authorities_[OBJECT_OPERATION]; - } - - /** - * Indicates if the user has the data authority of read. - * @return true if the user has the data authority of read; - * false otherwise. - * - **/ - public boolean isRead() - { - return authorities_[DATA_READ]; - } - - /** - * Indicates if the user has the object authority of reference. - * @return true if the user has the object authority of reference; - * false otherwise. - * - **/ - - public boolean isReference() - { - return authorities_[OBJECT_REFERENCE]; - } - - /** - * Indicates if the user has the data authority of update. - * @return true if the user has the data authority of update; - * false otherwise. - * - **/ - public boolean isUpdate() - { - return authorities_[DATA_UPDATE]; - } - - /** - * Parses the basic authority type. - **/ - private synchronized void parseBasic() - { - for (int j=0;j<4;j++) - { - boolean match = true; - for (int i=0;i<10;i++) - { - if (authorities_[i] != basicAutMapping[j][i]) - { - match = false; - break; - } - } - if (match == true) - { - objectAuthority_= j; - return; - } - } - objectAuthority_= -1; - return; - } - - /** - * Sets the add data authority. - * @param authority true to set the data authority of add on; - * false to set the data authority of add off. - * - **/ - public synchronized void setAdd(boolean authority) - { - changeAuthority(); - authorities_[DATA_ADD] = authority; - return; - } - - - /** - * Sets the alter object authority. - * @param authority true to set the object authority of alter on; - * false to set the object authority of alter off. - * - **/ - public synchronized void setAlter(boolean authority) - { - changeAuthority(); - authorities_[OBJECT_ALTER] = authority; - return; - } - - /** - * Sets the delete data authority. - * @param authority true to set the data authority of delete on; - * false to set the data authority of delete off. - * - **/ - public synchronized void setDelete(boolean authority) - { - changeAuthority(); - authorities_[DATA_DELETE] = authority; - return; - } - - - /** - * Sets the execute data authority. - * @param authority true to set the data authority of execute on; - * false to set the data authority of execute off. - * - **/ - public synchronized void setExecute(boolean authority) - { - changeAuthority(); - authorities_[DATA_EXECUTE] = authority; - return; - } - - - /** - * Sets the existence object authority. - * @param authority true to set the object authority of existence on; - * false to set the object authority of existence off. - * - **/ - - public synchronized void setExistence(boolean authority) - { - changeAuthority(); - authorities_[OBJECT_EXIST] = authority; - return; - } - - - /** - * Sets the management object authority. - * @param authority true to set the object authority of management on; - * false to set the object authority of management off. - * - **/ - - public synchronized void setManagement(boolean authority) - { - changeAuthority(); - authorities_[OBJECT_MANAGEMENT] = authority; - return; - } - - /** - * Sets the object authority of the user using a single value. - * @param authority The object authority of the user. -

    Valid values are: -

      -
    • *ALL The user can perform all operations on the object - except for those limited to the owner or controlled by - authorization list management authority. The user can control - the object's existence, specify the security for the object, change - the object, and perform basic functions on the object. The user - can also change ownership of the object. -
    • *AUTL The public authority of the authorization list securing the - object will be used. This is valid only if *PUBLIC is the user - specified. -
    • *CHANGE The user can perform all operations on the object - except those limited to the owner or controlled by object existence - authority and object management authority. -
    • *EXCLUDE The user cannot access the object. -
    • *USE The user has object operational authority, read authority, - and execute authority. -
    - -**/ - public synchronized void setObjectAuthority(String authority) - { - if (authority == null) - throw new NullPointerException("authority"); - String aut = authority.trim().toUpperCase(); - changeAuthority(); - if (getObjectAuthority().equals(aut) == true) - return; - if (aut.equals("*ALL")) - { - for (int i=0;i<10;i++) - { - authorities_[i] = basicAutMapping[BASIC_ALL][i]; - } - objectAuthority_ = BASIC_ALL; - } else if (aut.equals("*EXCLUDE")) - { - for (int i=0;i<10;i++) - { - authorities_[i] = basicAutMapping[BASIC_EXCLUDE][i]; - } - objectAuthority_ = BASIC_EXCLUDE; - } else if (aut.equals("*USE")) - { - for (int i=0;i<10;i++) - { - authorities_[i] = basicAutMapping[BASIC_USE][i]; - } - objectAuthority_ = BASIC_USE; - } else if (aut.equals("*CHANGE")) - { - for (int i=0;i<10;i++) - { - authorities_[i] = basicAutMapping[BASIC_CHANGE][i]; - } - objectAuthority_ = BASIC_CHANGE; - } else if (aut.equals("*AUTL")) // @A4a - { - setFromAuthorizationList(true); // @A4a - } else // @A4a - { - Trace.log (Trace.ERROR, "Invalid object authority was specified: " + authority); // @A4a - throw new ExtendedIllegalArgumentException("authority", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); // @A4a - } - - return; - } - - /** - * Sets the operational object authority. - * @param authority true to set the object authority of operational on; - * false to set the object authority of operational off. - * - **/ - - public synchronized void setOperational(boolean authority) - { - changeAuthority(); - authorities_[OBJECT_OPERATION] = authority; - return; - } - - /** - * Sets the read data authority. - * @param authority true to set the data authority of read on; - * false to set the data authority of read off. - * - **/ - public synchronized void setRead(boolean authority) - { - changeAuthority(); - authorities_[DATA_READ] = authority; - return; - } - - /** - * Sets the reference object authority. - * @param authority true to set the object authority of reference on; - * false to set the object authority of reference off. - * - **/ - public synchronized void setReference(boolean authority) - { - changeAuthority(); - authorities_[OBJECT_REFERENCE] = authority; - return; - } - - - /** - * Sets the update data authority. - * @param authority true to set the data authority of update on; - * false to set the data authority of update off. - * - **/ - public synchronized void setUpdate(boolean authority) - { - changeAuthority(); - authorities_[DATA_UPDATE] = authority; - return; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/QueuedMessage.java b/cvsroot/src/com/ibm/as400/access/QueuedMessage.java deleted file mode 100644 index c6fd53b50..000000000 --- a/cvsroot/src/com/ibm/as400/access/QueuedMessage.java +++ /dev/null @@ -1,600 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: QueuedMessage.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; - -/** - The QueuedMessage class represents a message on a message queue or job log. - @see com.ibm.as400.access.MessageQueue - @see com.ibm.as400.access.JobLog - **/ -// Implementation notes: -// * The constructor and set methods are not public, since it never makes sense for anyone other than MessageQueue or JobLog to call these. -// * Message keys are 4 bytes. -public class QueuedMessage extends AS400Message implements Serializable -{ - static final long serialVersionUID = 5L; - - private MessageQueue messageQueue_; - - private String sendingUser_ = ""; - private String sendingProgram_ = ""; - private String sendingJobName_ = ""; - private String sendingJobNumber_ = ""; - private String currentUser_ = ""; - private byte[] key_; - - private String replyStatus_ = ""; - private JobHashtable values_; - private String alertOption_ = ""; - private String message_ = ""; - private String messageHelp_ = ""; - private String messageHelpReplacement_ = ""; - private String messageHelpReplacementandFormat_ = ""; - private String senderType_ = ""; - private String sendingModuleName_ = ""; - private String sendingProcedureName_ = ""; - private String sendingUserProfile_ = ""; - private String receivingType_ = ""; - private String receivingProgramName_ = ""; - private String receivingModuleName_ = ""; - private String receivingProcedureName_ = ""; - private String requestStatus_ = ""; - private String[] number_of_sending_statements_; - private String[] number_of_receiver_statements_; - - - // Constructs a QueuedMessage object. - QueuedMessage() - { - } - - // Constructs a QueuedMessage object. - // @param messageQueue The message queue. - QueuedMessage(MessageQueue messageQueue) - { - if (messageQueue == null) - { - throw new NullPointerException("messageQueue"); - } - messageQueue_ = messageQueue; - setSystem(messageQueue_.getSystem()); - } - - // Constructs a QueuedMessage object. Used by MessageQueue.receive(). - // Called from MessageQueue.getMessages(). - QueuedMessage(MessageQueue messageQueue, int messageSeverity, String messageIdentifier, int messageType, byte[] messageKey, String messageFileName, String messageLibraryName, String dateSent, String timeSent) - { - super(messageIdentifier, null, messageFileName, messageLibraryName, messageSeverity, messageType, null, null, dateSent, timeSent, null); - messageQueue_ = messageQueue; - setSystem(messageQueue_.getSystem()); - key_ = messageKey; - } - - // Constructs a QueuedMessage object. Called from JobLog.getMessages(). - QueuedMessage(AS400 system, int messageSeverity, String messageIdentifier, int messageType, byte[] messageKey, String messageFileName, String messageLibraryName, String dateSent, String timeSent) - { - super(messageIdentifier, null, messageFileName, messageLibraryName, messageSeverity, messageType, null, null, dateSent, timeSent, null); - setSystem(system); - key_ = messageKey; - } - - //@HLA - // Constructs a QueuedMessage object. Called from HistoryLog.getMessages(). - QueuedMessage(AS400 system, int messageSeverity, String messageIdentifier, int messageType, String messageFileName, String messageLibraryName, String dateSent, String timeSent, String sendingJob, String sendingUserProfile, String sendingJobNumber, String currentUser, String messageData, byte[] replacementData) - { - super(messageIdentifier, messageData, messageFileName, messageLibraryName, messageSeverity, messageType, replacementData, null, dateSent, timeSent, null); - setSystem(system); - sendingJobName_ = sendingJob; - sendingJobNumber_ = sendingJobNumber; - sendingUser_ = sendingUserProfile; - currentUser_ = currentUser; - } - - // Constructs a QueuedMessage object. Used by MessageQueue.receive(). - QueuedMessage(MessageQueue messageQueue, int messageSeverity, String messageIdentifier, int messageType, byte[] messageKey, String messageFileName, String messageLibraryName, String sendingJob, String sendingUserProfile, String sendingJobNumber, String sendingProgramName, String dateSent, String timeSent, byte[] replacementData, String messageData, String messageHelp, String alertOption) - { - super(messageIdentifier, messageData, messageFileName, messageLibraryName, messageSeverity, messageType, replacementData, messageHelp, dateSent, timeSent, null); - messageQueue_ = messageQueue; - setSystem(messageQueue_.getSystem()); - key_ = messageKey; - sendingUser_ = sendingUserProfile; - sendingJobName_ = sendingJob; - sendingJobNumber_ = sendingJobNumber; - sendingProgram_ = sendingProgramName; - alertOption_ = alertOption; - } - - /** - Returns the alert option. - @return The alert option. Possible values are: -
      -
    • *DEFER - An alert is sent after local problem analysis. -
    • *IMMED - An alert is sent immediately when the message is sent to a message queue that has the allow alerts attribute set to *YES. -
    • *NO - No alert is sent. -
    • *UNATTEND - An alert is sent immediately when the system is running - in unattended mode. See the ALRSTS network attribute. -
    • "" - The alert option was not specified when the message was sent. -
    - **/ - public String getAlertOption() - { - return alertOption_.trim(); - } - - /** - Returns the text of a predefined message without replacement data substitution option.If an impromptu message is listed, this field contains the impromptu message text. - @return The message without replacement data or an empty string if not set. - **/ - public String getMessage() - { - return message_.trim(); - } - - /** - Returns the message help for the message listed without formatting characters and without replacement of data. If an impromptu message is listed, this field contains the impromptu message text. - @return The message help for the message listed without formatting characters and without replacement of data or an empty string if not set. - **/ - public String getMessageHelp() - { - return messageHelp_.trim(); - } - - /** - Returns the message help for the message listed, including the replacement data. If an impromptu message is listed, this field contains the impromptu message text. - @return The message help for the message listed, including the replacement data or an empty string if not set. - **/ - public String getMessageHelpReplacement() - { - return messageHelpReplacement_.trim(); - } - /** - Returns the message help for the message listed, including the replacement data and the formatting characters. If an impromptu message is listed, this field contains the impromptu message text. - @return The m7essage help for the message listed, including the replacement data and the formatting characters or an empty string if not set. - **/ - public String getMessageHelpReplacementandFormat() - { - return messageHelpReplacementandFormat_.trim(); - } - /** - Returns the type of the sender (whether it is a program or procedure). - @return The type of the sender or an empty string if not set. Possible values are: -
      -
    • 0 - Sender is an OPM or a System Licensed Internal Code (SLIC) program with a name that is 12 characters or less. -
    • 1 - Sender is a procedure within an ILE program and the procedure name is up to and including 256 characters in length. -
    • 2 - Sender is a procedure within an ILE program and the procedure name is from 257 characters up to and including 4096 characters in length. -
    • 3 - Sender is a SLIC program with a name that is from 13 characters up to and including 256 characters in length. -
    - **/ - public String getSenderType() - { - return senderType_.trim(); - } - /** - Returns the name of the module that contains the procedure sending the message. If the message was not sent by a procedure within an ILE program, this field is not set and the length of data field is 0. - @return The name of the module that contains the procedure sending the message or an empty string if not set. - **/ - public String getSendingModuleName() - { - return sendingModuleName_.trim(); - } - /** - Returns the name of the procedure sending the message. If the message was not sent by a procedure within an ILE program, this field is not set and the length of data field is 0. A nested procedure name has each procedure name separated by a colon. The outermost procedure name is identified first followed by the procedures it contains. The innermost procedure is identified last in the string. - @return The name of the procedure sending the message or an empty string if not set. - **/ - public String getSendingProcedureName() - { - return sendingProcedureName_.trim(); - } - - /** - Returns the name of the user profile that the thread was running under when the message was sent. - @return The name of the user profile that the thread was running under or an empty string if not set. - **/ - public String getSendingUserProfile() - { - return sendingUserProfile_.trim(); - } - /** - Returns the type of the receiver (whether it is a program or a procedure). - @return The type of the receiver or an empty string if not set. Possible values are: -
      -
    • 0 - Receiver is an original program model (OPM) program -
    • 1 - Receiver is a procedure within an ILE program and the procedure name is up to and including 256 characters in length -
    • 2 - Receiver is a procedure within an ILE program and the procedure name is 257 or more characters in length. -
    - **/ - public String getReceivingType() - { - return receivingType_.trim(); - } - /** - Returns the program name, or the ILE program name that contains the procedure that the message was sent to. - @return The program name or the ILE program name or an empty string if not set. - **/ - public String getReceivingProgramName() - { - return receivingProgramName_.trim(); - } - /** - Returns the name of the module that contains the procedure where the message was sent. If the message was not sent to a procedure within an Integrated Language Environment (ILE) program, this field is not set and the length of data field is 0. - @return The name of the module that contains the procedure where the message was sent or an empty string if not set. - **/ - public String getReceivingModuleName() - { - return receivingModuleName_.trim(); - } - /** - Returns the name of the procedure receiving the message. If the message was not sent to a procedure within an ILE program, this field is not set and the length of data field is 0. A nested procedure name has each procedure name separated by a colon. The outermost procedure name is identified first followed by the procedures it contains. The innermost procedure is identified last in the string. - @return The name of the procedure receiving the message or an empty string if not set. - **/ - public String getReceivingProcedureName() - { - return receivingProcedureName_.trim(); - } - - /** - Returns information regarding the processing status of the request message. - @return Information regarding the processing status of the request message or an empty string if not set. Possible values are: -
      -
    • O - This request message has been received and processed. -
    • C - This request message is currently being processed. -
    • N - This request message has not yet been processed. -
    - **/ - public String getRequestStatus() - { - return requestStatus_.trim(); - } - - /** - Returns the level of the request-processing program that received the request message. If the message being listed is not a request, this field is set to 0. - @return The level of the request-processing program that received the request message or an empty string if not set. - **/ - public Integer getRequestLevel() - { - if ( values_ != null) - { - return (Integer) values_.get(1201); - } - return null; - } - - /** - Returns the coded character set identifier (CCSID) that the message text is returned in. If a conversion error occurs or if the CCSID you requested in the message text to be converted to is 65535, the CCSID that the message text is stored in is returned. Otherwise, the CCSID you wanted your message text converted to is returned. If you do not want the text converted before it is returned to you but you do want to know the CCSID that the message text is stored in, specify 65535 on the coded character set identifier to return text and data in parameter. The CCSID that the message text is stored in is returned in the coded character set identifier for text field. - @return The coded character set identifier (CCSID) that the message text is returned in or null if not set. Possible values are: -
      -
    • This applies to the following fields only : -
    • * Message -
    • * Message with replacement data -
    • * Message help -
    • * Message help with replacement data -
    • * Message help with replacement data and formatting -
    • characters -
    • * Message help with formatting characters -
    • Note: This CCSID value does not apply to the replacement data that has been substituted into the text. See the coded character set identifier for data for this information. -
    - **/ - public Integer getCcsidCodedCharacterSetIdentifierForText() - { - if ( values_ != null) - { - return (Integer) values_.get(1301); - } - return null; - } - - /** - Returns the CCSID conversion status indicator for text. - @return The CCSID conversion status indicator for text or null if not set. Possible values_ are: -
      -
    • 0 - No conversion was needed because the CCSID of the text matched the CCSID you wanted the text converted to. -
    • 1 - No conversion occurred because either the text was 65535 or the CCSID you wanted the text converted to was 65535. -
    • 2 - No conversion occurred because you did not ask for any text to be returned. -
    • 3 - The text was converted to the CCSID specified using the best fit conversion tables. -
    • 4 - A conversion error occurred using the best fit conversion tables so a default conversion was attempted. This completed without error. -
    • -1 - An error occurred on both the best fit and default conversions. The data was not converted. -
    - **/ - public Integer getCcsidConversionStatusIndicatorForText() - { - if ( values_ != null) - { - return (Integer) values_.get(1302); - } - return null; - } - - /** - Returns the coded character set identifier (CCSID) that the replacement data is returned in. This only applies to the part of the replacement data that corresponds to a convertible character data type (*CCHAR). All other replacement data will not be converted before it is returned and can be considered to have a CCSID of 65535. If a conversion error occurs or if the CCSID you requested the data to be converted to is 65535, the CCSID of the data is returned. If there is no *CCHAR replacement data, 65535 is returned. Otherwise the CCSID you wanted the data converted to is returned. - @return The coded character set identifier that the replacement data is returned in or null if not set. - **/ - public Integer getCcsidCodedCharacterSetIdentifierForData() - { - if ( values_ != null) - { - return (Integer) values_.get(1303); - } - return null; - } - - /** - Returns the CCSID conversion status indicator for data. - @return The CCSID conversion status indicator for data or null if not set. Possible values are: -
      -
    • 0 - No conversion was needed because the CCSID of the data matched the CCSID that you wanted the data converted to. -
    • 1 - No conversion occurred because either the data was 65535, or the CCSID you wanted the data converted to was 65535. -
    • 2 - No conversion occurred because you did not ask for any message data to be returned or the data did not contain any *CCHAR type data. -
    • 3 - The data was converted to the CCSID specified using the best fit conversion tables. -
    • 4 - A conversion error occurred using the best fit conversion tables so a default conversion was attempted. This completed without error. -
    • -1 - An error occurred on both the best fit and default conversions. The data was not converted. -
    - **/ - public Integer getCcsidconversionStatusIndicatorForData() - { - if ( values_ != null) - { - return (Integer) values_.get(1304); - } - return null; - } - - - /** - Returns number of sending statement numbers or instruction numbers available followed by an array of the sending statement numbers or instruction numbers. The number of statement numbers or instruction numbers available for the sending program or procedure. For OPM programs and nonoptimized procedures, this count is 1. For optimized procedures, this count can be greater than 1. In this case, each statement number represents a potential point at which the message could have been sent. If the mapping table information has been removed from the program, this field returns a count of 0, and no statement numbers are available. The array of sending statement numbers or instruction numbers immediately follows this field in the returned data. - @return The number of sending statement numbers or instruction numbers available followed by an array of the sending statement numbers or instruction numbers or a null string array is not set. - **/ - public String[] getSendingStatementNumbers() - { - if( number_of_sending_statements_ != null ) - return number_of_sending_statements_; - return new String[0]; - } - - /** - Returns the number of statement numbers or instruction numbers available for the receiving program or procedure. For original program model (OPM) programs and nonoptimized procedures, this count is 1.For optimized procedures, this count can be greater than 1. In this case, each statement number represents a potential point at which the message could have been received. If the mapping table information has been removed from the program, this field returns a count of 0 and no statement numbers are available. The array of receiving statement numbers or instruction numbers immediately follows this field in the returned data. - return The number of statement numbers or instruction numbers available for the receiving program or procedure or a null string array if nothing is set. - **/ - public String[] getReceiverStatementNumbers() - { - if ( number_of_receiver_statements_ != null ) - return number_of_receiver_statements_; - return new String[0]; - } - - /** - Returns the sending program name. - @return The sending program name, or "" if it is not set. - **/ - public String getFromProgram() - { - if (sendingProgram_.length() == 0 && values_ != null) - { - String s = (String)values_.get(603); - if (s != null) - { - sendingProgram_ = s.trim(); - } - } - return sendingProgram_; - } - - /** - Returns the sender job name. - @return The sender job name, or "" if it is not set. - @see #getFromJobNumber - @see #getUser - **/ - public String getFromJobName() - { - if (sendingJobName_.length() == 0 && values_ != null) - { - String s = (String)values_.get(601); - if (s != null) - { - sendingJobName_ = s.substring(0,10).trim(); - } - } - return sendingJobName_; - } - - /** - Returns the sender job number. - @return The sender job number, or "" if it is not set. - @see #getFromJobName - @see #getUser - **/ - public String getFromJobNumber() - { - if (sendingJobNumber_.length() == 0 && values_ != null) - { - String s = (String)values_.get(601); - if (s != null) - { - sendingJobNumber_ = s.substring(20,26); - } - } - return sendingJobNumber_; - } - - /** - Returns the sender job's user. To get the current user of the message, call {@link #getCurrentUser getCurrentUser()} when accessing a system running V5R3 or higher. - @return The sender job's user, or "" if it is not set. - @see #getFromJobName - @see #getFromJobNumber - **/ - public String getUser() - { - if (sendingUser_.length() == 0 && values_ != null) - { - String s = (String)values_.get(601); - if (s != null) - { - sendingUser_ = s.substring(10,20).trim(); - } - } - return sendingUser_; - } - - /** - Returns the 4-byte message key. - @return The message key, or null if it is not set. - **/ - public byte[] getKey() - { - return key_; - } - - /** - Returns the message queue. - @return The message queue, or null if it is not set. - **/ - public MessageQueue getQueue() - { - return messageQueue_; - } - - /** - Returns the reply status. - @return The reply status, "" if it is not set, or null if it is not applicable. - **/ - public String getReplyStatus() - { - if (replyStatus_ == "" && values_ != null) - { - String s = (String)values_.get(1001); - if (s != null) - { - replyStatus_ = s.trim(); - } - } - return replyStatus_; - } - - /** - Returns the current user name. If the system being accessed is running V5R2 or earlier, then "" is returned. - @return The current user name, or "" if it is not set. - **/ - public String getCurrentUser() - { - if (currentUser_.length() == 0 && values_ != null) - { - String s = (String)values_.get(607); - if (s != null) - { - currentUser_ = s.trim(); - } - } - return currentUser_; - } - - // Helper method called by MessageQueue. - void setAsInt(int fieldID, int value) - { - setValueInternal(fieldID, new Integer(value)); - } - - // Helper method called by MessageQueue. - void setAsLong(int fieldID, long value) - { - setValueInternal(fieldID, new Long(value)); - } - - // Helper method called by MessageQueue. - void setValueInternal(int fieldID, Object value) - { - if (values_ == null) - values_ = new JobHashtable(); - - values_.put(fieldID, value); - switch (fieldID) - { - case 101: - alertOption_ = (String)value; - break; - case 201: - setSubstitutionData((byte[])value); - break; - case 301: - message_ = (String)value; - break; - case 302: - setText((String)value); - break; - case 401: - messageHelp_ = (String)value; - break; - case 402: - messageHelpReplacement_ = (String)value; - break; - case 403: - messageHelpReplacementandFormat_ = (String)value; - break; - case 404: - setHelp((String)value); - break; - case 501: - setDefaultReply((String)value); - break; - case 602: - senderType_ = (String)value; - break; - case 603: - // Nothing to be done. This is saved in the vector - break; - case 604: - sendingModuleName_ = (String)value; - break; - case 605: - sendingProcedureName_ = (String)value; - break; - case 606: - number_of_sending_statements_ = (String [])value; - break; - case 607: - sendingUserProfile_ = (String)value; - break; - case 702: - receivingType_ = (String)value; - break; - case 703: - receivingProgramName_ = (String)value; - break; - case 704: - receivingModuleName_ = (String)value; - break; - case 705: - receivingProcedureName_ = (String)value; - break; - case 706: - number_of_receiver_statements_ = (String [])value; - break; - case 1101: - requestStatus_ = (String)value; - break; - default: - break; - } - } - - /** - Returns the String representation of this QueuedMessage object. - @return The string. - **/ - public String toString() - { - return super.toStringM2(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/QueuedMessage16.gif b/cvsroot/src/com/ibm/as400/access/QueuedMessage16.gif deleted file mode 100644 index 2182f521a..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/QueuedMessage16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/QueuedMessage32.gif b/cvsroot/src/com/ibm/as400/access/QueuedMessage32.gif deleted file mode 100644 index 9174019ed..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/QueuedMessage32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/QueuedMessageEnumeration.java b/cvsroot/src/com/ibm/as400/access/QueuedMessageEnumeration.java deleted file mode 100644 index 1f27084dd..000000000 --- a/cvsroot/src/com/ibm/as400/access/QueuedMessageEnumeration.java +++ /dev/null @@ -1,100 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: QueuedMessageEnumeration.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Enumeration; -import java.util.NoSuchElementException; - -// Helper class. Used to wrap the QueuedMessage[] with an Enumeration. This class is used by MessageQueue and JobLog. -class QueuedMessageEnumeration implements Enumeration -{ - private QueuedMessage[] messageCache_; - - // Exactly one of the following three variables will be non-null - // (depending on which constructor was used). - private MessageQueue mq_; - private JobLog jl_; - private HistoryLog hl_; //@HLA - - private int counter_; // number of objects returned so far by nextElement() - private int numMessages_; - private int listOffset_ = 0; - private int cacheOffset_ = 0; - - QueuedMessageEnumeration(MessageQueue mq, int length) - { - mq_ = mq; - numMessages_ = length; - } - - QueuedMessageEnumeration(JobLog jl, int length) - { - jl_ = jl; - numMessages_ = length; - } - - //@HLA - QueuedMessageEnumeration(HistoryLog hl, int length) - { - hl_ = hl; - numMessages_ = length; - } - - public final boolean hasMoreElements() - { - return counter_ < numMessages_; - } - - public final Object nextElement() - { - if (counter_ >= numMessages_) - { - throw new NoSuchElementException(); - } - - if (messageCache_ == null || cacheOffset_ >= messageCache_.length) - { - try - { - if (mq_ != null) - { - messageCache_ = mq_.getMessages(listOffset_, 1000); - } - else if(hl_ != null) //@HLA - { //@HLA - messageCache_ = hl_.getMessages(listOffset_, 1000); //@HLA - } //@HLA - else - { - messageCache_ = jl_.getMessages(listOffset_, 1000); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loaded next block in QueuedMessageEnumeration: " + messageCache_.length + " messages at list offset " + listOffset_ + " out of " + numMessages_ + " total."); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Exception while loading nextElement() in QueuedMessageEnumeration:", e); - throw new NoSuchElementException(); - } - - // We have a freshly loaded cache, so reset to the beginning of the cache. - cacheOffset_ = 0; - - // Set starting offset for next call to getMessages(), - // in case another call is needed. - listOffset_ += messageCache_.length; - } - ++counter_; - return messageCache_[cacheOffset_++]; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/RCCallProgramFailureReplyDataStream.java b/cvsroot/src/com/ibm/as400/access/RCCallProgramFailureReplyDataStream.java deleted file mode 100644 index 1a2c114fd..000000000 --- a/cvsroot/src/com/ibm/as400/access/RCCallProgramFailureReplyDataStream.java +++ /dev/null @@ -1,30 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: RCCallProgramFailureReplyDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// Program failed, same datastream except for request ID. -class RCCallProgramFailureReplyDataStream extends RCCallProgramReplyDataStream -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - Object getNewDataStream() - { - return new RCCallProgramFailureReplyDataStream(); - } - - public int hashCode() - { - return 0x9003; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/RCCallProgramReplyDataStream.java b/cvsroot/src/com/ibm/as400/access/RCCallProgramReplyDataStream.java deleted file mode 100644 index cff486dc7..000000000 --- a/cvsroot/src/com/ibm/as400/access/RCCallProgramReplyDataStream.java +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RCCallProgramReplyDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -class RCCallProgramReplyDataStream extends ClientAccessDataStream -{ - Object getNewDataStream() - { - return new RCCallProgramReplyDataStream(); - } - - public int hashCode() - { - return 0x8003; - } - - int getRC() - { - return get16bit(20); - } - - AS400Message[] getMessageList(ConverterImplRemote converter) throws IOException - { - return RemoteCommandImplRemote.parseMessages(data_, converter); - } - - void getParameterList(ProgramParameter[] parameterList) - { - // For each output or inout parm, in order, set data returned. - for (int index = 24, i = 0; i < parameterList.length; ++i) - { - if (parameterList[i].getOutputDataLength() > 0) - { - int byteLength = BinaryConverter.byteArrayToInt(data_, index); - int parameterUsage = BinaryConverter.byteArrayToUnsignedShort(data_, index + 10); - // Copy output data into a new buffer. - int outputDataLength = BinaryConverter.byteArrayToInt(data_, index + 6); - byte[] outputData; - if (parameterUsage == 22 || parameterUsage == 23) - { - outputData = DataStreamCompression.decompressRLE(data_, index + 12, byteLength - 12, outputDataLength, DataStreamCompression.DEFAULT_ESCAPE); - } - else - { - outputData = new byte[outputDataLength]; - System.arraycopy(data_, index + 12, outputData, 0, byteLength - 12); - } - parameterList[i].setOutputData(outputData); - index += byteLength; - } - } - } - - int readAfterHeader(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving call program reply..."); - return super.readAfterHeader(in); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/RCCallProgramRequestDataStream.java b/cvsroot/src/com/ibm/as400/access/RCCallProgramRequestDataStream.java deleted file mode 100644 index c0f7971e1..000000000 --- a/cvsroot/src/com/ibm/as400/access/RCCallProgramRequestDataStream.java +++ /dev/null @@ -1,113 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RCCallProgramRequestDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1999-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; -import java.io.IOException; -import java.io.OutputStream; - -class RCCallProgramRequestDataStream extends ClientAccessDataStream -{ - RCCallProgramRequestDataStream(String library, String program, ProgramParameter[] parameterList, ConverterImplRemote converter, int dataStreamLevel, int messageCount) throws CharConversionException - { - int dataStreamLength = 43; // Data stream length is 43 + length of the parameters. - - // Compress parameters and calculate length of datastream. - for (int i = 0; i < parameterList.length; ++i) - { - byte[] inputData = parameterList[i].getInputData(); - if (inputData != null) - { - parameterList[i].length_ = inputData.length; - } - - dataStreamLength += 12 + parameterList[i].length_; - } - - // Initialize header. - data_ = new byte[dataStreamLength]; - setLength(dataStreamLength); - // setHeaderID(0x0000); - setServerID(0xE008); - // setCSInstance(0x00000000); - // setCorrelation(0x00000000); - setTemplateLen(23); - setReqRepID(0x1003); - - // Blank fill program name and library name. - for (int i = 0; i < 20; ++i) - { - data_[20 + i] = (byte)0x40; - } - - converter.stringToByteArray(program, data_, 20); - converter.stringToByteArray(library, data_, 30); - - // Return messages. - if (dataStreamLevel < 7 && messageCount == AS400Message.MESSAGE_OPTION_ALL) messageCount = AS400Message.MESSAGE_OPTION_UP_TO_10; - if (dataStreamLevel >= 10) - { - if (messageCount == AS400Message.MESSAGE_OPTION_UP_TO_10) messageCount = 3; - if (messageCount == AS400Message.MESSAGE_OPTION_ALL) messageCount = 4; - } - data_[40] = (byte)messageCount; - - // Set number of program parameters. - set16bit(parameterList.length, 41); - - // Now convert the parameter list into data stream. - for (int index = 43, i = 0; i < parameterList.length; ++i) // Start at 43 in data_ - { - int usage = parameterList[i].getUsage(); - int parameterLength = parameterList[i].length_; - // Set LL for this parameter. - set32bit(parameterLength + 12, index); - // Set CP for parameter. - set16bit(0x1103, index + 4); - // Set parameter data length. - set32bit(parameterList[i].getMaxLength(), index + 6); - // Set parameter usage. - if (usage == ProgramParameter.NULL) - { - if (dataStreamLevel < 6) - { - // Server does not allow null parameters. - set16bit(ProgramParameter.INPUT, index + 10); - } - else - { - set16bit(usage, index + 10); - } - } - else - { - set16bit(usage + 10, index + 10); - // Write the input data into the data stream. - if (parameterLength > 0) - { - System.arraycopy(parameterList[i].getInputData(), 0, data_, index + 12, parameterLength); - } - } - - // Advance 12 + parameter length in data stream. - index += 12 + parameterLength; - } - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending call program request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/RCExchangeAttributesReplyDataStream.java b/cvsroot/src/com/ibm/as400/access/RCExchangeAttributesReplyDataStream.java deleted file mode 100644 index 4aa33afe7..000000000 --- a/cvsroot/src/com/ibm/as400/access/RCExchangeAttributesReplyDataStream.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: RCExchangeAttributesReplyDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -class RCExchangeAttributesReplyDataStream extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - Object getNewDataStream() - { - return new RCExchangeAttributesReplyDataStream(); - } - - public int hashCode() - { - return 0x8001; - } - - // Get return code. - int getRC() - { - return get16bit(20); - } - - // Get server CCSID. - int getCCSID() - { - return get32bit(22); - } - - // Server NLV and server version are not currently used. - - // Server datastream level. - int getDSLevel() - { - return get16bit(34); - } - - int readAfterHeader(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving remote command exchange client/server attributes reply..."); - return super.readAfterHeader(in); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/RCExchangeAttributesRequestDataStream.java b/cvsroot/src/com/ibm/as400/access/RCExchangeAttributesRequestDataStream.java deleted file mode 100644 index 379841385..000000000 --- a/cvsroot/src/com/ibm/as400/access/RCExchangeAttributesRequestDataStream.java +++ /dev/null @@ -1,52 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RCExchangeAttributesRequestDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -// Datastream object for remote command server exchange client/server attributes request. -class RCExchangeAttributesRequestDataStream extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - RCExchangeAttributesRequestDataStream(String nlvString) - { - super(new byte[34]); - setLength(34); - // setHeaderID(0x0000); - setServerID(0xE008); - // setCSInstance(0x00000000); - // setCorrelation(0x00000000); - setTemplateLen(14); - setReqRepID(0x1001); - - set32bit(ExecutionEnvironment.getCcsid(), 20); // Set CCSID. - - char[] nlv = nlvString.toCharArray(); // Set NLV. - data_[24] = (byte)(nlv[0] | 0x00F0); // Make 0x00C. -> 0xF. - data_[25] = (byte)(nlv[1] | 0x00F0); - data_[26] = (byte)(nlv[2] | 0x00F0); - data_[27] = (byte)(nlv[3] | 0x00F0); - - set32bit(0x00000001, 28); // Set client version to one. - // set16bit(0x0000, 32); // Set client datastream level (leave at zero, so all server versions work). - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending remote command exchange client/server attributes request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/RCRunCommandReplyDataStream.java b/cvsroot/src/com/ibm/as400/access/RCRunCommandReplyDataStream.java deleted file mode 100644 index c3eb5293e..000000000 --- a/cvsroot/src/com/ibm/as400/access/RCRunCommandReplyDataStream.java +++ /dev/null @@ -1,47 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RCRunCommandReplyDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -// Run remote command reply data stream class. -class RCRunCommandReplyDataStream extends ClientAccessDataStream -{ - Object getNewDataStream() - { - return new RCRunCommandReplyDataStream(); - } - - public int hashCode() - { - return 0x8002; - } - - int getRC() - { - return get16bit(20); - } - - AS400Message[] getMessageList(ConverterImplRemote converter) throws IOException - { - return RemoteCommandImplRemote.parseMessages(data_, converter); - } - - int readAfterHeader(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving run command reply..."); - return super.readAfterHeader(in); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/RCRunCommandRequestDataStream.java b/cvsroot/src/com/ibm/as400/access/RCRunCommandRequestDataStream.java deleted file mode 100644 index 1af6ab5b9..000000000 --- a/cvsroot/src/com/ibm/as400/access/RCRunCommandRequestDataStream.java +++ /dev/null @@ -1,61 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RCRunCommandRequestDataStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1999-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -class RCRunCommandRequestDataStream extends ClientAccessDataStream -{ - RCRunCommandRequestDataStream(byte[] commandBytes, int dataStreamLevel, int messageCount, int ccsid) - { - super(new byte[dataStreamLevel >= 10 ? 31 + commandBytes.length : 27 + commandBytes.length]); - setLength(dataStreamLevel >= 10 ? 31 + commandBytes.length : 27 + commandBytes.length); - // setHeaderID(0x0000); - setServerID(0xE008); - // setCSInstance(0x00000000); - // setCorrelation(0x00000000); - setTemplateLen(0x0001); // Template length is one byte. - setReqRepID(0x1002); - - // Return messages. - if (dataStreamLevel < 7 && messageCount == AS400Message.MESSAGE_OPTION_ALL) messageCount = AS400Message.MESSAGE_OPTION_UP_TO_10; - if (dataStreamLevel >= 10) - { - if (messageCount == AS400Message.MESSAGE_OPTION_UP_TO_10) messageCount = 3; - if (messageCount == AS400Message.MESSAGE_OPTION_ALL) messageCount = 4; - } - data_[20] = (byte)messageCount; - - if (dataStreamLevel >= 10) - { - set32bit(10 + commandBytes.length, 21); // Set LL = 4 bytes LL, 2 bytes CP, 4 bytes CCSID + length of command. - set16bit(0x1104, 25); // Set CP. - set32bit(ccsid, 27); - System.arraycopy(commandBytes, 0, data_, 31, commandBytes.length); - } - else - { - set32bit(6 + commandBytes.length, 21); // Set LL = 4 bytes LL, 2 bytes CP + length of command. - set16bit(0x1101, 25); // Set CP. - System.arraycopy(commandBytes, 0, data_, 27, commandBytes.length); - } - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending run command request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ReaderInputStream.java b/cvsroot/src/com/ibm/as400/access/ReaderInputStream.java deleted file mode 100644 index 29c7e25ac..000000000 --- a/cvsroot/src/com/ibm/as400/access/ReaderInputStream.java +++ /dev/null @@ -1,451 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ReaderInputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.io.UnsupportedEncodingException; - -/** - A ReaderInputStream represents a Toolbox converter that uses stateful character conversion to convert characters into bytes. That is, it wraps an underlying Reader and reads/caches the appropriate number of characters to return the requested number of bytes. This is especially useful for mixed byte tables where the number of converted bytes is almost never the same as the number of underlying Unicode characters. This class exists primarily for use with JDBC CLOBs, but other components are free to use it as well. -

    For example, the following code shows two methods that perform essentially the same conversion, except one uses character converters that are part of the Java runtime, and the other uses character converters that are part of the Toolbox: -

    - *  public static InputStream getJavaConversionStream(String data, String encoding)
    - *  {
    - *    byte[] b = data.getBytes(encoding);
    - *    return new java.io.ByteArrayInputStream(b);
    - *  }
    - *
    - *  public static InputStream getToolboxConversionStream(String data, String encoding)
    - *  {
    - *    StringReader r = new StringReader(data);
    - *    return new com.ibm.as400.access.ReaderInputStream(r, encoding);
    - *  }
    - 
    - @see com.ibm.as400.access.ConvTableReader - @see java.io.InputStreamReader - **/ -public class ReaderInputStream extends InputStream -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - private Reader reader_; - private ConvTable table_; - - private int ccsid_ = -1; - private String encoding_ = null; - private BidiConversionProperties properties_ = new BidiConversionProperties(); - - private char[] cache_ = new char[1024]; - private byte[] b_cache_ = new byte[2562]; // ((1024*5)+3)/2 == worst case mixed-byte array size +1 for extra shift byte, just in case. - private int nextRead_ = 0; // Cache needs to be filled when nextRead_ >= nextWrite_. - private int nextWrite_ = 0; - - private int mode_ = ConvTableReader.SB_MODE; // Default to single-byte mode unless we receive a shift-out. - - - /** - Constructs a ReaderInputStream that will convert Unicode characters into bytes of the specified encoding. - @param reader The Reader from which to read characters. - @param encoding The name of a supported Java character encoding. - @exception UnsupportedEncodingException If the specified character encoding is not supported. - **/ - public ReaderInputStream(Reader reader, String encoding) throws UnsupportedEncodingException - { - if (reader == null) - { - Trace.log(Trace.ERROR, "Parameter 'reader' is null."); - throw new NullPointerException("reader"); - } - if (encoding == null) - { - Trace.log(Trace.ERROR, "Parameter 'reader' is null."); - throw new NullPointerException("encoding"); - } - - reader_ = reader; - encoding_ = encoding; - initializeTable(); - } - - /** - Constructs a ReaderInputStream that will convert Unicode characters into bytes of the specified CCSID. - @param reader The Reader from which to read characters. - @param ccsid The CCSID used to convert characters into bytes. - @exception UnsupportedEncodingException If the specified CCSID or its corresponding character encoding is not supported. - **/ - public ReaderInputStream(Reader reader, int ccsid) throws UnsupportedEncodingException - { - if (reader == null) - { - Trace.log(Trace.ERROR, "Parameter 'reader' is null."); - throw new NullPointerException("reader"); - } - if (ccsid < 0 || ccsid > 65535) - { - Trace.log(Trace.ERROR, "Value of parameter 'ccsid' is not valid:", ccsid); - throw new ExtendedIllegalArgumentException("ccsid", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - reader_ = reader; - ccsid_ = ccsid; - initializeTable(); - } - - /** - Constructs a ReaderInputStream that will convert Unicode characters into bytes of the specified CCSID and bi-directional string type. - @param reader The Reader from which to read characters. - @param ccsid The CCSID used to convert characters into bytes. - @param bidiStringType The {@link com.ibm.as400.access.BidiStringType bi-directional string type}. - @exception UnsupportedEncodingException If the specified CCSID or its corresponding character encoding is not supported. - **/ - public ReaderInputStream(Reader reader, int ccsid, int bidiStringType) throws UnsupportedEncodingException - { - this(reader, ccsid, new BidiConversionProperties(bidiStringType)); - } - - /** - Constructs a ReaderInputStream that will convert Unicode characters into bytes of the specified CCSID and bi-directional string type. - @param reader The Reader from which to read characters. - @param ccsid The CCSID used to convert characters into bytes. - @param properties The bidi conversion properties. - @exception UnsupportedEncodingException If the specified CCSID or its corresponding character encoding is not supported. - **/ - public ReaderInputStream(Reader reader, int ccsid, BidiConversionProperties properties) throws UnsupportedEncodingException - { - if (reader == null) - { - Trace.log(Trace.ERROR, "Parameter 'reader' is null."); - throw new NullPointerException("reader"); - } - if (ccsid < 0 || ccsid > 65535) - { - Trace.log(Trace.ERROR, "Value of parameter 'ccsid' is not valid:", ccsid); - throw new ExtendedIllegalArgumentException("ccsid", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - reader_ = reader; - ccsid_ = ccsid; - properties_ = properties; - initializeTable(); - } - - /** - Constructs a ReaderInputStream that will convert Unicode characters into bytes of the specified CCSID and bi-directional string type. - @param reader The Reader from which to read characters. - @param ccsid The CCSID used to convert characters into bytes. - @param bidiStringType The {@link com.ibm.as400.access.BidiStringType bi-directional string type}. - @param cacheSize The number of characters to store in the internal buffer. The default is 1024. This number must be greater than zero. - @exception UnsupportedEncodingException If the specified CCSID or its corresponding character encoding is not supported. - **/ - public ReaderInputStream(Reader reader, int ccsid, int bidiStringType, int cacheSize) throws UnsupportedEncodingException - { - this(reader, ccsid, new BidiConversionProperties(bidiStringType), cacheSize); - } - - /** - Constructs a ReaderInputStream that will convert Unicode characters into bytes of the specified CCSID and bi-directional string type. - @param reader The Reader from which to read characters. - @param ccsid The CCSID used to convert characters into bytes. - @param properties The bidi conversion properties. - @param cacheSize The number of characters to store in the internal buffer. The default is 1024. This number must be greater than zero. - @exception UnsupportedEncodingException If the specified CCSID or its corresponding character encoding is not supported. - **/ - public ReaderInputStream(Reader reader, int ccsid, BidiConversionProperties properties, int cacheSize) throws UnsupportedEncodingException - { - this(reader, ccsid, properties); - if (cacheSize < 1) - { - Trace.log(Trace.ERROR, "Value of parameter 'cacheSize' is not valid:", cacheSize); - throw new ExtendedIllegalArgumentException("cacheSize", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - cache_ = new char[cacheSize]; // The character cache. - b_cache_ = new byte[((cacheSize*5)+3)/2]; // ((1024*5)+3)/2 == worst case mixed-byte array size +1 for extra shift byte, just in case. - } - - /** - Returns the number of bytes stored in this ReaderInputStream's internal cache. - @return The number of bytes available to be read without calling the underlying Reader. - **/ - public synchronized int available() throws IOException - { - return nextWrite_ - nextRead_; - } - - /** - Closes this ReaderInputStream and its underlying Reader. Calling close() multiple times will not throw an exception. - @exception IOException If an I/O exception occurs. - **/ - public synchronized void close() throws IOException - { - if (table_ == null) return; - reader_.close(); - table_ = null; - } - - private synchronized boolean fillCache() throws IOException - { - if (nextRead_ >= nextWrite_) - { - int numRead = reader_.read(cache_, 0, cache_.length); - if (numRead == -1) - { - return false; - } - String s = new String(cache_, 0, numRead); - byte[] b = table_.stringToByteArray(s, properties_); - int firstByte = b[0] & 0x00FF; - int lastByte = b[b.length - 1] & 0x00FF; - if (mode_ == ConvTableReader.SB_MODE) - { - if (firstByte == ConvTableMixedMap.shiftOut_) - { - if (lastByte == ConvTableMixedMap.shiftIn_) - { - mode_ = ConvTableReader.DB_MODE; - System.arraycopy(b, 0, b_cache_, 0, b.length - 1); - nextRead_ = 0; - nextWrite_ = b.length - 1; - } - else - { - System.arraycopy(b, 0, b_cache_, 0, b.length); - nextRead_ = 0; - nextWrite_ = b.length; - } - } - else if (lastByte == ConvTableMixedMap.shiftIn_) - { - mode_ = ConvTableReader.DB_MODE; - System.arraycopy(b, 0, b_cache_, 0, b.length - 1); - nextRead_ = 0; - nextWrite_ = b.length - 1; - } - else - { - System.arraycopy(b, 0, b_cache_, 0, b.length); - nextRead_ = 0; - nextWrite_ = b.length; - } - } - else - { - if (firstByte == ConvTableMixedMap.shiftOut_) - { - if (lastByte == ConvTableMixedMap.shiftIn_) - { - System.arraycopy(b, 1, b_cache_, 0, b.length-2); - nextRead_ = 0; - nextWrite_ = b.length - 2; - } - else - { - mode_ = ConvTableReader.SB_MODE; - System.arraycopy(b, 1, b_cache_, 0, b.length - 1); - nextRead_ = 0; - nextWrite_ = b.length - 1; - } - } - else if (lastByte == ConvTableMixedMap.shiftIn_) - { - b_cache_[0] = ConvTableMixedMap.shiftIn_; - System.arraycopy(b, 0, b_cache_, 1, b.length - 1); - nextRead_ = 0; - nextWrite_ = b.length; - } - else - { - mode_ = ConvTableReader.SB_MODE; - b_cache_[0] = ConvTableMixedMap.shiftIn_; - System.arraycopy(b, 0, b_cache_, 1, b.length); - nextRead_ = 0; - nextWrite_ = b.length + 1; - } - } - } - if (nextRead_ >= nextWrite_) // Still didn't read enough, so try again. - { - // This should never happen, but just in case. - return fillCache(); - } - return true; - } - - /** - Returns the bi-directional string type in use by this ReaderInputStream. - @return The {@link com.ibm.as400.access.BidiStringType bi-directional string type}. - **/ - public int getBidiStringType() - { - return properties_.getBidiStringType(); - } - - /** - Returns the maximum number of characters that may be stored in the internal buffer. This number represents the number of characters that may be read out of the underlying Reader any time a read() method is called on this ReaderInputStream. - @return The size of the character cache in use by this ReaderInputStream. - **/ - public int getCacheSize() - { - return cache_.length; - } - - /** - Returns the CCSID used by this ReaderInputStream. - @return The CCSID, or -1 if the CCSID is not known. - **/ - public int getCcsid() - { - return ccsid_; - } - - /** - Returns the encoding used by this ReaderInputStream. If the CCSID is not known, the encoding provided on the constructor is returned. Otherwise, the corresponding encoding for the CCSID is returned, which may be null if no such mapping exists. - @return The encoding, or null if the encoding is not known. - **/ - public String getEncoding() - { - if (ccsid_ == -1 || encoding_ != null) - { - return encoding_; - } - else - { - return ConversionMaps.ccsidToEncoding(ccsid_); - } - } - - private void initializeTable() throws UnsupportedEncodingException - { - if (encoding_ != null) - { - String ccsidStr = ConversionMaps.encodingToCcsidString(encoding_); - if (ccsidStr != null) - { - ccsid_ = Integer.parseInt(ccsidStr); - } - } - if (ccsid_ == -1) - { - table_ = ConvTable.getTable(encoding_); - } - else - { - table_ = ConvTable.getTable(ccsid_, null); - } - } - - /** - Reads a single byte. If close() is called prior to calling this method, an exception will be thrown. - @return The byte read, or -1 if the end of the stream has been reached. - @exception IOException If an I/O exception occurs. - **/ - public synchronized int read() throws IOException - { - if (fillCache()) - { - return b_cache_[nextRead_++]; - } - return -1; - } - - /** - Reads bytes into the specified array. If close() is called prior to calling this method, an exception will be thrown. - @param buffer The destination buffer. - @return The number of bytes read, or -1 if the end of the stream has been reached. - @exception IOException If an I/O exception occurs. - **/ - public synchronized int read(byte[] buffer) throws IOException - { - if (buffer == null) - { - Trace.log(Trace.ERROR, "Parameter 'buffer' is null."); - throw new NullPointerException("buffer"); - } - if (buffer.length == 0) return 0; - - if (fillCache()) - { - int max = buffer.length > (nextWrite_-nextRead_) ? (nextWrite_-nextRead_) : buffer.length; - System.arraycopy(b_cache_, nextRead_, buffer, 0, max); - nextRead_ += max; - return max; - } - return -1; - } - - /** - Reads bytes into a portion of the specified array. If close() is called prior to calling this method, an exception will be thrown. - @param buffer The destination buffer. - @param offset The offset into the buffer at which to begin storing data. - @param length The maximum number of bytes to store. - @return The number of bytes read, or -1 if the end of the stream has been reached. - @exception IOException If an I/O exception occurs. - **/ - public synchronized int read(byte[] buffer, int offset, int length) throws IOException - { - if (buffer == null) - { - Trace.log(Trace.ERROR, "Parameter 'buffer' is null."); - throw new NullPointerException("buffer"); - } - - if (offset < 0 || offset > buffer.length) - { - Trace.log(Trace.ERROR, "Value of parameter 'offset' is not valid:", offset); - throw new ExtendedIllegalArgumentException("offset", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (length < 0 || length > (buffer.length - offset)) - { - Trace.log(Trace.ERROR, "Value of parameter 'length' is not valid:", length); - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (length == 0) return 0; - - if (fillCache()) - { - int max = length > (nextWrite_-nextRead_) ? (nextWrite_ - nextRead_) : length; - System.arraycopy(b_cache_, nextRead_, buffer, offset, max); - nextRead_ += max; - return max; - } - return -1; - } - - /** - Skips the specified number of bytes. If close() is called prior to calling this method, an exception will be thrown. - @param length The number of bytes to skip. - @return The number of bytes actually skipped. - @exception IOException If an I/O exception occurs. - **/ - public synchronized long skip(long length) throws IOException - { - if (length < 0) - { - Trace.log(Trace.ERROR, "Value of parameter 'length' is not valid: " + length); - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (length == 0) return 0; - long total = 0; - byte[] buf = new byte[length < b_cache_.length ? (int)length : b_cache_.length]; - int r = read(buf); - if (r < 0) return 0; - total += r; - while (r > 0 && total < length) - { - r = read(buf); - if (r > 0) total += r; - } - return total; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/Record.java b/cvsroot/src/com/ibm/as400/access/Record.java deleted file mode 100644 index aa0f16148..000000000 --- a/cvsroot/src/com/ibm/as400/access/Record.java +++ /dev/null @@ -1,1777 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Record.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @A2 11/21/2007 - Change to setField() method to calculation of the value for -// variableFieldLength. Shift-in/shift-out characters need to -// be included for some CCSIDs. -// Similar change in getField for VARGRAPHIC fields. The 2-byte -// length field (which preceeds the field data) indicates the -// number of "graphic characters" (NOT the number of "bytes"). -// Each graphic character is 2-bytes each. Therefore, the code -// must multiply the length by 2 to read the correct number of -// bytes. -// This is opposite from a VARCHAR field... where the 2-byte -// length field (which preceeds the field data) indicates the -// number of "bytes" of character data (NOT the number of -// characters). This is because some characters may be represented -// by a single byte or more than a single byte. -// Fix for CPS DB Item: 795LZ6 - DBCS issue with VARCHAR on JTOpen Record Level Access -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.OutputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.CharConversionException; -import java.io.UnsupportedEncodingException; -import java.io.Serializable; -import java.beans.PropertyChangeSupport; -import java.beans.VetoableChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyVetoException; -import java.util.Vector; - -/** - *The Record class represents the data described by a RecordFormat object. - *It can represent: - *
      - *
    • An entry in a data queue. - *
    • The parameter data provided to or returned by a program call. - *
    • A record to be written to or read from a file on the system. - *
    • Any data returned from the system that needs to be converted - *between IBM i format and Java format. - *
    - *Record objects generate the following events: - *
      - *
    • {@link com.ibm.as400.access.RecordDescriptionEvent RecordDescriptionEvent} - *
      The events fired are: - *
        - *
      • fieldModified() - *
      - *
    • PropertyChangeEvent - *
    • VetoableChangeEvent - *
    - *Examples - * -**/ -public class Record implements Serializable -{ - static final long serialVersionUID = 4L; - - - // The server data for this record. - private byte[] as400Data_; - // Array of the field descriptions that describe the fields in this record. - // We initialize from RecordFormat.getFieldDescriptions() during construction - // or setRecordFormat(). - private FieldDescription[] fieldDescriptions_; - // Array of the fields that make up this record. - private Object[] fields_; - // Array containing the offset in as400Data_ for each field. - // These values are only guaranteed to be valid if the record - // does not contain dependent fields. - private int[] fieldOffsets_; - // Indicates if the record has dependent fields - private boolean hasDependentFields_; - // Indicates which fields have been converted to Java objects - private boolean[] isConvertedToJava_; - // Indicates which fields have been converted to server data in the as400Data_ array - private boolean[] isConvertedToAS400_; - // Name of the record - private String name_ = ""; - // Array indicating if a field is null - private boolean[] nullFieldMap_; - // Use default property change support - private transient PropertyChangeSupport changes_; //@B5C - // The record format object with which this record is associated - private RecordFormat recordFormat_ = null; - // The length of the record, in bytes - int recordLength_; - // The record number of this record - int recordNumber_; - // Array to hold fields returned by getFields. This allows us to not - // instantiate a new array every time getFields is done, which allows - // us to cut down on garbage collection overhead. - Object[] returnFields_; - // The list of current veto listeners - transient private VetoableChangeSupport vetos_; //@B5A -//@B5D transient private Vector currentVetoListeners_ = new Vector(); - // The list of current RecordDescriptionEvent listeners -//@B5D transient private Vector currentRecordDescriptionListeners_ = new Vector(); - // The list of RecordDescriptionEvent listeners - transient private Vector recordDescriptionListeners_; //@B5C - // The list of veto listeners -//@B5D transient private Vector vetoListeners_ = new Vector(); - - /** - *Constructs a Record object. - **/ - public Record() - { - initializeTransient(); //@B5A - } - - /** - *Constructs a Record object. It uses the RecordFormat specified. - *The contents of the record will be initialized to their default values. The default - *values are determined as follows: - *
      - *
    1. Use the value specified for the DFT keyword on the FieldDescription object - *contained in the RecordFormat object for a particular field. - *
    2. If no value was specified for the DFT keyword, use the default value from the - *AS400DataType object specified when constructing the FieldDescription object for - *a particular field. - *
    - *@param recordFormat Describes the contents of this record. - *@see com.ibm.as400.access.RecordFormat - **/ - public Record(RecordFormat recordFormat) - { - initializeTransient(); //@B5A - initializeRecord(recordFormat); - } - - /** - *Constructs a Record object. It uses the record's name and RecordFormat specified. - *The contents of the record will be initialized to their default values. The default - *values are determined as follows: - *
      - *
    1. Use the value specified for the DFT keyword on the FieldDescription object for - *a particular field. - *
    2. If no value was specified for the DFT keyword, use the default value from the - *AS400DataType object specified when constructing the FieldDescription object for - *a particular field. - *
    - *@param recordFormat Describes the contents of this record. - *@param recordName The name to assign to the record. - **/ - public Record(RecordFormat recordFormat, String recordName) - { - this(recordFormat); - // Verify parameters - if (recordName == null) - { - throw new NullPointerException("recordName"); - } - // Set the name of the record - name_ = recordName; - } - - /** - *Constructs a Record object. It uses the specified RecordFormat and a byte array - *with which to initialize the contents of the record. - *@param recordFormat Describes the contents of this record. - *@param contents The contents to which to initialize the record. - *
    - *Note: When using this object for the record level access classes, if - *isVariableLength() - *returns true for a field, the first two bytes of the data provided for - *that field must contain the length of the valid data. However, the number of bytes - *provided for - *the data for the field must equal the maximum field length for the field. - *@exception UnsupportedEncodingException If an error occurs when converting - *the IBM i data to a Java Object. - **/ - public Record(RecordFormat recordFormat, byte[] contents) - throws UnsupportedEncodingException - { - this(recordFormat, contents, 0); - } - - /** - *Constructs a Record object. It uses the specified the RecordFormat, a byte array - *from which to initialize the contents of the record and the name of the record. - *@param recordFormat Describes the contents of this record. - *@param contents The contents to which to initialize the record. - *
    - *Note: When using this object for the record level access classes, if isVariableLength() - *returns true for a field, the first two bytes of the data provided for - *that field must contain the length of the valid data. However, the number of bytes provided for - *the data for the field must equal the maximum field length for the field. - *@param recordName The name to assign to the record. - *@exception UnsupportedEncodingException If an error occurs when converting - *the IBM i data to a Java Object. - **/ - public Record(RecordFormat recordFormat, byte[] contents, String recordName) - throws UnsupportedEncodingException - { - this(recordFormat, contents, 0, recordName); - } - - /** - *Constructs a Record object. It uses the specified RecordFormat and a byte array - *from which to initialize the contents of the record. - *@param recordFormat Describes the contents of this record. The recordFormat - *must contain at least one field description. - *@param contents The contents to which to initialize the record. - *
    - *Note: When using this object for the record level access classes, if isVariableLength() - *returns true for a field, the first two bytes of the data provided for - *that field must contain the length of the valid data. However, the number of bytes provided for - *the data for the field must equal the maximum field length for the field. - *@param offset The offset in contents at which to start. The offset cannot - *be less than zero. - *@exception UnsupportedEncodingException If an error occurs when converting - *the IBM i data to a Java Object. - **/ - public Record(RecordFormat recordFormat, byte[] contents, int offset) - throws UnsupportedEncodingException - { - initializeTransient(); //@B5A - // Verify parameters - if (recordFormat == null) - { - throw new NullPointerException("recordFormat"); - } - if (recordFormat.getNumberOfFields() == 0) - { - throw new ExtendedIllegalArgumentException("recordFormat", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (contents == null) - { - throw new NullPointerException("contents"); - } - if (contents.length == 0) - { - throw new ExtendedIllegalArgumentException("contents", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (offset < 0) - { - throw new ExtendedIllegalArgumentException("offset", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - // Set the instance data - recordFormat_ = recordFormat; - fieldDescriptions_ = recordFormat.getFieldDescriptions(); - hasDependentFields_ = recordFormat_.getHasDependentFields(); - fields_ = new Object[fieldDescriptions_.length]; - returnFields_ = new Object[fieldDescriptions_.length]; - fieldOffsets_ = new int[fieldDescriptions_.length]; - // Initialize the offset values - isConvertedToJava_ = new boolean[fieldDescriptions_.length]; - isConvertedToAS400_ = new boolean[fieldDescriptions_.length]; - nullFieldMap_ = new boolean[fields_.length]; - FieldDescription fd = null; - int fieldOffset = 0; - int length = 0; - // Reset the record length - recordLength_ = 0; - - // This loop sets the offsets for the fields and also determines the - // record length of the record. - for (int i = 0; i < fields_.length; ++i) - { - fd = fieldDescriptions_[i]; - fieldOffsets_[i] = fieldOffset; - if (fd instanceof VariableLengthFieldDescription) - { - if (((VariableLengthFieldDescription)fd).isVariableLength()) - { // Add two bytes for the length of the field - fieldOffset += 2; - recordLength_ += 2; - } - } - length = fd.getDataType().getByteLength(); - fieldOffset += length; - recordLength_ += length; - if (!hasDependentFields_) - { - isConvertedToAS400_[i] = true; - } - isConvertedToJava_[i] = false; - } - // Allocate the space for as400Data_ now that we know the record length - as400Data_ = new byte[recordLength_]; - if (!hasDependentFields_) - { // Go ahead and copy the contents to as400Data_ - try - { - System.arraycopy(contents, offset, as400Data_, 0, as400Data_.length); - } - catch(ArrayIndexOutOfBoundsException e) - { // Need to reset isConverted... state - for (int i = 0; i < isConvertedToAS400_.length; ++i) - { - isConvertedToAS400_[i] = false; - } - throw e; - } - } - else - { - // Initialize the contents of the record with the specified byte array - setContents(contents, offset); - } - } - - /** - *Constructs a Record object. It uses the specified RecordFormat, a byte array - *from which to initialize the record's contents and the record's name. - *@param recordFormat Describes the contents of this record. - *@param contents The contents to which to initialize the record. - *
    - *Note: When using this object for the record level access classes, if isVariableLength() - *returns true for a field, the first two bytes of the data provided for - *that field must contain the length of the valid data. However, the number of bytes provided for - *the data for the field must equal the maximum field length for the field. - *@param offset The offset in contents at which to start. The offset cannot - *be less than zero. - *@param recordName The name to assign to the record. - *@exception UnsupportedEncodingException If an error occurs when converting - *the IBM i data to a Java Object. - **/ - public Record(RecordFormat recordFormat, byte[] contents, int offset, String recordName) - throws UnsupportedEncodingException - { - this(recordFormat, contents, offset); - // Verify parameters - if (recordName == null) - { - throw new NullPointerException("recordName"); - } - - // Set the name - name_ = recordName; - } - - /** - *Adds a listener to be notified when the value of any bound - *property is changed. The propertyChange method will be - *be called. - *@see #removePropertyChangeListener - *@param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) //@B5C - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - if (changes_ == null) changes_ = new PropertyChangeSupport(this); - changes_.addPropertyChangeListener(listener); - } - - /** - *Adds a listener to be notified when a RecordDescriptionEvent is fired. - *@see #removeRecordDescriptionListener - *@param listener The RecordDescriptionListener. - **/ - public void addRecordDescriptionListener(RecordDescriptionListener listener) //@B5C - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - if (recordDescriptionListeners_ == null) recordDescriptionListeners_ = new Vector(); - recordDescriptionListeners_.addElement(listener); -//@B5D currentRecordDescriptionListeners_ = (Vector)recordDescriptionListeners_.clone(); - } - - /** - *Adds a listener to be notified when the value of any constrained - *property is changed. - *The vetoableChange method will be called. - *@see #removeVetoableChangeListener - *@param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) //@B5C - { - if (listener == null) - { - throw new NullPointerException("listener"); - } -//@B5D vetoListeners_.addElement(listener); -//@B5D currentVetoListeners_ = (Vector)vetoListeners_.clone(); - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); - vetos_.addVetoableChangeListener(listener); //@B5A - } - - //@G0A - /** - * Tests this Record object for equality with the given object. - * @param obj The Object to compare. - * @return true if obj is a Record object and its record length, record number, - * record name, dependent fields, field values, and key field values equal this Record's; - * false otherwise. Since there are so many pieces of data that determine whether - * or not one Record equals another, the programmer may also want to consider using - * Record.toString() and comparing the Strings for equality. - **/ - public boolean equals(Object obj) - { - if (obj == null) return false; - try - { - Record cmp = (Record)obj; - if (cmp.recordLength_ == recordLength_ && - cmp.recordNumber_ == recordNumber_ && - cmp.hasDependentFields_ == hasDependentFields_ && - (cmp.name_ == null ? (name_ == null) : cmp.name_.equals(name_))) - { - int n = getNumberOfFields(); - int cn = cmp.getNumberOfFields(); - if (n == cn) - { - int nk = getNumberOfKeyFields(); - int cnk = getNumberOfKeyFields(); - if (nk == cnk) - { - for (int i=0; i - *Note: If a field is a variable-length field, the first two bytes of data for the field - *contain the length of the valid data for the field. However, the number of bytes provided for the - *field is the maximum length of the field as specified by the FieldDescription object for the - *field in the record format for this object.
    - *The record format for the record must be set prior to invoking this method. - *@see Record#Record(com.ibm.as400.access.RecordFormat) - *@see Record#setRecordFormat - *@return The contents of this record. - *@exception CharConversionException If an error occurs when converting - *the contents of a field to IBM i data. - *@exception UnsupportedEncodingException If an error occurs when converting - *the contents of a field to IBM i data. - **/ - public byte[] getContents() - throws CharConversionException, - UnsupportedEncodingException - { - if (recordFormat_ == null) - { - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - if (hasDependentFields_) - { // If the record has dependent fields, we do the conversion now and return the contents. - - // For each field in fields_, use the recordFormat_ object to get the field - // description. Use the data type object associated with the field description to translate - // the Object representing the field into bytes to be placed in the byte array. - // Repeat this process for each field. - // If the field is a variable length field (i.e the VARLEN value is greater than 0), the first - // two bytes of the data is the length of the data. - - // Determine the number of bytes that make of the record - AS400DataType dType; - int offset = 0; - if (Trace.traceOn_) { - Trace.log(Trace.INFORMATION, "recordLength_: " + String.valueOf(recordLength_)); - } - byte[] toBytes = new byte[recordLength_]; - FieldDescription f; - int variableFieldLength; - for (int i = 0; i < fields_.length; ++i) - { // Convert each field to server data - f = fieldDescriptions_[i]; - // Check for possible variable length field - if (f instanceof VariableLengthFieldDescription) - { - if (((VariableLengthFieldDescription)f).isVariableLength()) - { // Set the two byte length portion of the contents - if (fields_[i] == null) - { - variableFieldLength = 0; - } - else - { - variableFieldLength = (f instanceof HexFieldDescription)? - ((byte[])fields_[i]).length : ((String)fields_[i]).length(); - } - BinaryConverter.unsignedShortToByteArray(variableFieldLength, toBytes, offset); - offset += 2; - } - } - // Whether the field is variable length or not we still write out the maximum number - // of bytes for the field. This is the required format for variable length data for record - // level access. - dType = f.getDataType(); - if (fields_[i] != null) - { // Field has a value; convert it to server data - offset += dType.toBytes(fields_[i], toBytes, offset); - } - else - { // Field is null; use the default value for the server data to serve as a place holder for - // the field. - offset += dType.toBytes(dType.getDefaultValue(), toBytes, offset); - } - } - return toBytes; - } - // No dependent fields. - return as400Data_; - } - - /** - *Writes the contents of this record to the specified output stream. - *Each field's contents will be written to out - *based on the field description for the - *field that is provided by the record format specified on construction of this object. - *The data type object for the field description will be used to do any necessary conversion - *of the contents of the field.
    - *Note: If a field is a variable-length field, the first two bytes of data for the field - *contain the length of the valid data for the field. However, the number of bytes provided for the - *field is the maximum length of the field as specified by the FieldDescription object for the - *field in the record format for this object. - *
    - *The record format for the record must be set prior to invoking this method. - *@see Record#Record(com.ibm.as400.access.RecordFormat) - *@see Record#setRecordFormat - *@param out The stream to which to write the contents of the record. - *@exception IOException If an I/O error occurs while communicating with the system. - **/ - public void getContents(OutputStream out) - throws IOException - { - if (out == null) - { - throw new NullPointerException("out"); - } - out.write(getContents()); - } - - /** - *Returns the value of the field by index. - *
    - *The record format for the record must be set prior to invoking this method. - *@see Record#Record(com.ibm.as400.access.RecordFormat) - *@see Record#setRecordFormat - *@param index The ordinal position of the field in the record. This value must - * be between 0 and getNumberOfFields() - 1 inclusive. - *@return The contents of the requested field. - *@exception UnsupportedEncodingException If an error occurs when converting - *the IBM i data to a Java Object. - **/ - public Object getField(int index) - throws UnsupportedEncodingException - { - if (recordFormat_ == null) - { - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (index < 0 || index > fields_.length - 1) - { - throw new ExtendedIllegalArgumentException("index", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (isConvertedToJava_[index]) - { // Field already converted; just return it - return fields_[index]; - } - // Field has not yet been converted. We will only get here if - // the record has no dependent fields so we can go ahead and count - // on the fieldOffsets_ array being valid. - FieldDescription f = fieldDescriptions_[index]; - AS400DataType dType = f.getDataType(); - int variableFieldLength; - int offset = fieldOffsets_[index]; - // Check for possible variable length field - if (f instanceof VariableLengthFieldDescription) - { - if (((VariableLengthFieldDescription)f).isVariableLength()) - { // Get the number of bytes returned for the field - variableFieldLength = BinaryConverter.byteArrayToUnsignedShort(as400Data_, offset); - if (f instanceof DBCSGraphicFieldDescription) //@A2A - { //@A2A - // NOTE: The 2-byte length field in a VARGRAPHIC field is the number of "characters" and - // is NOT the number of "bytes". Each VARGRAPHIC "character" is represented by - // two bytes. So, we need to multiply the variableFieldLength by two for VARGRAPHIC. - // Note: The 2-byte length field in a VARCHAR field is the number of "bytes", so the - // variableFieldLength is correct and should not be modified. - variableFieldLength *= 2; //@A2A - } //@A2A - - offset += 2; - // Convert the server data to a Java object - if ((f instanceof HexFieldDescription)) - { // Field is a hex field, no conversion is done on the data - byte[] b = new byte[variableFieldLength]; - System.arraycopy(as400Data_, offset, b, 0, variableFieldLength); - fields_[index] = b; - } - else - { // Field requires conversion based on ccsid - //@B5D Converter c = new Converter(((AS400Text)dType).getCcsid()); //@B5C - ConverterImpl c = ((AS400Text)dType).getConverter(); //@B5A @F0C - fields_[index] = c.byteArrayToString(as400Data_, offset, variableFieldLength); - } - } - else - { - // Field is not variable length - fields_[index] = dType.toObject(as400Data_, offset); - } - } - else - { - // Not a VariableLengthFieldDescription - fields_[index] = dType.toObject(as400Data_, offset); - } - if (recordDescriptionListeners_ != null) fireFieldModifiedEvent(); - isConvertedToJava_[index] = true; - return fields_[index]; - } - - /** - *Returns the value of the field by name. - *
    - *The record format for the record must be set prior to invoking this method. - *@see Record#Record(com.ibm.as400.access.RecordFormat) - *@see Record#setRecordFormat - *@param name The name of the field. - *@return The contents of the requested field. - *@exception UnsupportedEncodingException If an error occurs when converting - *the IBM i data to a Java Object. - **/ - public Object getField(String name) - throws UnsupportedEncodingException - { - if (recordFormat_ == null) - { - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - return getField(recordFormat_.getIndexOfFieldName(name)); - } - - /** - *Returns the value of the field by index, as an unconverted byte array. - *
    - *The record format for the record must be set prior to invoking this method. - *@see Record#Record(com.ibm.as400.access.RecordFormat) - *@see Record#setRecordFormat - *@param index The ordinal position of the field in the record. This value must - * be between 0 and getNumberOfFields() - 1 inclusive. - *@return The unconverted contents of the requested field. - **/ - public byte[] getFieldAsBytes(int index) - { - if (recordFormat_ == null) - { - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (index < 0 || index > fields_.length - 1) - { - throw new ExtendedIllegalArgumentException("index", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - byte[] fieldAsBytes = null; - int fieldOffset = 0; // offset to start of field in as400Data_ - int fieldByteLength = 0; // length of field, including length bytes if any - - if (hasDependentFields_) // The record has dependent fields, so fieldOffsets_ is unreliable. - { - // For each field description in the recordFormat_ object, until we reach the field of interest, determine the field offset and length. - // If a field is a variable length field, we must account for the two bytes worth of length data which precede the actual data for the field. - int offsetToNextField = 0; - for (int i = 0; i <= index; ++i) - { - fieldOffset = offsetToNextField; - FieldDescription f = fieldDescriptions_[i]; - AS400DataType dType = f.getDataType(); - fieldByteLength = dType.getByteLength(); - int lengthDependField = recordFormat_.getLengthDependency(i); - int offsetDependField = recordFormat_.getOffsetDependency(i); - - // Check for offset dependent field - if (offsetDependField != -1) - { // Set offset to value specified in the field this field depends on - fieldOffset = ((Number)fields_[offsetDependField]).intValue(); - } - if (lengthDependField != -1) - { - // The length of this field is contained in the field that this field depends on. - // Because the field depended on must exist prior to this field in the byte array, - // its value has already been determined. - fieldByteLength = ((Number)fields_[lengthDependField]).intValue(); - } - - // Check for possible variable length field - if (f instanceof VariableLengthFieldDescription && - ((VariableLengthFieldDescription)f).isVariableLength()) - { - fieldByteLength += 2; // allow for the 2 leading "length bytes" - } - - // Prepare to examine the next field. - offsetToNextField = fieldOffset + fieldByteLength; - } // for ... - } // if ... - - else // no dependent fields, so fieldOffsets_ is reliable - { - fieldOffset = fieldOffsets_[index]; - FieldDescription f = fieldDescriptions_[index]; - AS400DataType dType = f.getDataType(); - fieldByteLength = dType.getByteLength(); - // Check for possible variable length field. - if (f instanceof VariableLengthFieldDescription && - ((VariableLengthFieldDescription)f).isVariableLength()) - { // Get the number of bytes returned for the field. - // Whether the field is variable length or not we still write out the maximum number - // of bytes for the field. This is the required format for variable length data for record level access. - fieldByteLength += 2; // allow for the 2 leading "length bytes" - } - } - - fieldAsBytes = new byte[fieldByteLength]; - System.arraycopy(as400Data_, fieldOffset, fieldAsBytes, 0, fieldAsBytes.length); - - return fieldAsBytes; - } - - /** - *Returns the value of the field by name, as an unconverted byte array. - *
    - *The record format for the record must be set prior to invoking this method. - *@see Record#Record(com.ibm.as400.access.RecordFormat) - *@see Record#setRecordFormat - *@param name The name of the field. - *@return The unconverted contents of the requested field. - **/ - public byte[] getFieldAsBytes(String name) - { - if (recordFormat_ == null) - { - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - return getFieldAsBytes(recordFormat_.getIndexOfFieldName(name)); - } - - /** - *Returns the values of the fields in the record. - *@return The values of the fields in the record. An array of size zero is - *returned if the record format has not been set. - *@exception UnsupportedEncodingException If an error occurs when converting - *the IBM i data to a Java Object. - **/ - public Object[] getFields() - throws UnsupportedEncodingException - { - if (recordFormat_ == null) - { - return new Object[0]; - } - - // Get each field individually in the event that conversion has not yet been done. - for (int i = 0; i < fields_.length; ++i) - { - returnFields_[i] = getField(i); - } - return returnFields_; - } - - /** - *Returns the values of the key fields in the record. - *@return The values of the key fields in the record. - *An array of length 0 is returned if the record format has not been set - *or if no key fields exist. - *@exception UnsupportedEncodingException If an error occurs when converting - *the IBM i data to a Java Object. - **/ - public Object[] getKeyFields() - throws UnsupportedEncodingException - { - if (recordFormat_ == null) - { - return new Object[0]; - } - - Object[] keyFields = new Object[recordFormat_.getNumberOfKeyFields()]; - String[] keyFieldNames = recordFormat_.getKeyFieldNames(); - for (int i = 0; i < keyFields.length; ++i) - { - keyFields[i] = getField(keyFieldNames[i]); - } - return keyFields; - } - - - /** - *Returns the values of the key fields in a byte array. - *@return The values of the key fields in a byte array. - *A byte array of length 0 is returned if the record format has not been set - *or if no key fields exist. - **/ - public byte[] getKeyFieldsAsBytes() - { - if (recordFormat_ == null) - { - return new byte[0]; - } - - ByteArrayOutputStream keyAsBytes = new ByteArrayOutputStream(); - String[] keyFieldNames = recordFormat_.getKeyFieldNames(); - AS400DataType dt = null; - FieldDescription fd = null; - int length; - int index; - for (int i = 0; i < keyFieldNames.length; ++i) - { - index = recordFormat_.getIndexOfFieldName(keyFieldNames[i]); - fd = fieldDescriptions_[index]; - dt = fd.getDataType(); - length = dt.getByteLength(); - if (fd instanceof VariableLengthFieldDescription && ((VariableLengthFieldDescription)fd).isVariableLength()) - { - length += 2; - } - keyAsBytes.write(as400Data_, fieldOffsets_[index], length); - } - return keyAsBytes.toByteArray(); - } - - - - /** - *Returns the number of fields in this record. - *@return The number of fields in this record. Zero is returned if the record - *format has not been set. - **/ - public int getNumberOfFields() - { - return (recordFormat_ == null)? 0 : fields_.length; - } - - /** - *Returns the number of key fields in this record. - *@return The number of key fields in this record. Zero is returned if the record - *format has not been set. - **/ - public int getNumberOfKeyFields() - { - return (recordFormat_ == null)? 0 : recordFormat_.getNumberOfKeyFields(); - } - - /** - *Returns the record format for this record. - *@return The record format for this record. If the record format has - *not been set, null is returned. - **/ - public RecordFormat getRecordFormat() - { - return recordFormat_; - } - - /** - *Returns the record length of this record. - *@return The record length of this record. Zero is returned if the record format - *for this object has not been set. - **/ - public int getRecordLength() - { - return recordLength_; - } - - /** - *Returns the record name for this record. - *@return The name of this record. If the name has not been set, - *an empty string is returned. - **/ - public String getRecordName() - { - return name_; - } - - /** - *Returns the record number of this record. This method only pertains to the - *record level access classes. - *@return The record number of this record. Zero is returned if no record number has been set. - **/ - public int getRecordNumber() - { - return recordNumber_; - } - - //@G0A - /** - * Returns a hash code value for this Record. This is useful if Record objects - * need to be placed into Hashtables. - * @return The hash code. - **/ - public int hashCode() - { - return recordNumber_ == 0 ? recordLength_ : recordNumber_; - } - - /** - *Initializes this record to its default values based on the specified record format. - *@param recordFormat The record format for this record. - **/ - private void initializeRecord(RecordFormat recordFormat) - { - // Verify parameters - if (recordFormat == null) - { - throw new NullPointerException("recordFormat"); - } - if (recordFormat.getNumberOfFields() == 0) - { - throw new ExtendedIllegalArgumentException("recordFormat", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - // Set the instance data - recordFormat_ = recordFormat; - fieldDescriptions_ = recordFormat.getFieldDescriptions(); - hasDependentFields_ = recordFormat_.getHasDependentFields(); - fields_ = new Object[fieldDescriptions_.length]; - returnFields_ = new Object[fieldDescriptions_.length]; - fieldOffsets_ = new int[fieldDescriptions_.length]; - isConvertedToJava_ = new boolean[fieldDescriptions_.length]; - isConvertedToAS400_ = new boolean[fieldDescriptions_.length]; - nullFieldMap_ = new boolean[fieldDescriptions_.length]; - // Initialize the contents of the record to the fieldDescription's default value. - // Initialize the nullFieldMap_ to false values. Initialize the fieldOffsets_ array - // to the appropriate offset. - Object obj; - FieldDescription fd = null; - AS400DataType dType = null; - byte[] lenAsBytes = new byte[2]; - int offset = 0; - int variableFieldLength; - ByteArrayOutputStream b = new ByteArrayOutputStream(); - // Reset recordLength_ - recordLength_ = 0; - for (int i = 0; i < fields_.length; ++i) - { - // Get the default value for this field - fd = fieldDescriptions_[i]; - obj = fd.getDFT(); - // Set the offset of this field - fieldOffsets_[i] = offset; - // Set the Java value of the field - // @B0C: Check for DFT of current or null - if (obj == null) // DFT was not set, or was set to null or current - { - if (fd.isDFTNull()) // DFT was set to null => write 'null' to the field - { - fields_[i] = fd.getDataType().getDefaultValue(); - if (fieldDescriptions_[i].getALWNULL()) - nullFieldMap_[i] = true; - else - nullFieldMap_[i] = false; - } - else if (fd.isDFTCurrent()) // DFT was set to current => write the appropriate value - { - fields_[i] = fd.getDFTCurrentValue(); - } - else // DFT was not set => write 'null' to the field - { - fields_[i] = fd.getDataType().getDefaultValue(); - if (fieldDescriptions_[i].getALWNULL()) - { - nullFieldMap_[i] = true; - fields_[i] = null; //@B1A Set the field value to null as well. - } - else - nullFieldMap_[i] = false; - } - } - else - { - fields_[i] = obj; // DFT was set => write the default value - } - // Check for possible variable length field - if (fd instanceof VariableLengthFieldDescription) - { - if (((VariableLengthFieldDescription)fd).isVariableLength()) - { // Set the two byte length portion of the contents - if (obj == null) - { - variableFieldLength = 0; - } - else - { - variableFieldLength = (fd instanceof HexFieldDescription)? - ((byte[])obj).length : ((String)obj).length(); - } - BinaryConverter.unsignedShortToByteArray(variableFieldLength, lenAsBytes, 0); - b.write(lenAsBytes, 0, 2); - offset += 2; - recordLength_ += 2; - } - } - // Whether the field is variable length or not we still write out the maximum number - // of bytes for the field. This is the required format for variable length data for record - // level access. - dType = fd.getDataType(); - if (fields_[i] != null) //@B1A - { // Field has a value; convert it to server data - b.write(dType.toBytes(fields_[i]), 0, dType.getByteLength()); - } - else //@B1A - { // Field is null; use the default value for the server data to serve as a place holder for - // the field. - b.write(dType.toBytes(dType.getDefaultValue()), 0, dType.getByteLength()); //@B1A - } - - // Indicate the field is in a converted state - isConvertedToJava_[i] = true; - isConvertedToAS400_[i] = true; - - // Determine the next offset value and increment the record length appropriately - offset += fd.getDataType().getByteLength(); - recordLength_ += fd.getDataType().getByteLength(); - } - // Allocate the space for as400Data_ - as400Data_ = b.toByteArray(); - if (recordDescriptionListeners_ != null) fireFieldModifiedEvent(); - } - - //@D0A - void initializeTextObjects(AS400 system) - { - // First do our record format - if (recordFormat_ != null) recordFormat_.initializeTextObjects(system); - // Then do all of our internal fields - if (fieldDescriptions_ != null) - { - for (int i=0; i - *The record format for the record must be set prior to invoking this method. - *@see Record#Record(com.ibm.as400.access.RecordFormat) - *@see Record#setRecordFormat - *@param index The index of the field. The index must be between - *0 and getNumberOfFields() - 1. - *@return true if the field is null; false otherwise. - **/ - public boolean isNullField(int index) - { - if (recordFormat_ == null) - { - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (index < 0 || index > fields_.length - 1) - { - throw new ExtendedIllegalArgumentException("index", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - return nullFieldMap_[index]; - } - - /** - *Indicates if the field is null. - *
    - *The record format for the record must be set prior to invoking this method. - *@see Record#Record(com.ibm.as400.access.RecordFormat) - *@see Record#setRecordFormat - *@param name The name of the field. - *@return true if the field is null; false otherwise. - **/ - public boolean isNullField(String name) - { - if (recordFormat_ == null) - { - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - return nullFieldMap_[recordFormat_.getIndexOfFieldName(name)]; - } - - /** - *Reads the number of bytes requested. This method will loop until - *either length bytes have been read or until the end of file is reached. - *@param in The Inputstream from which to read. - *@param buf The buffer from which to read the data. - *@param offset The offset within buf array from which to start reading. - *@param length The number of bytes to read. - *@returns The number of bytes read. - *@exception IOException If an I/O error occurs while communicating with the system. - **/ - private int readFromStream(InputStream in, byte[] buf, int offset, int length) - throws IOException - { - boolean endOfFile = false; - int bytesRead = 0; - while ((bytesRead < length) && !endOfFile) - { - int temp = in.read(buf, offset+bytesRead, length - bytesRead); - if (temp == -1) - { - endOfFile = true; - } - else - { - bytesRead += temp; - } - } - return bytesRead; - } - - /** - *Overrides the ObjectInputStream.readObject() method in order to return any - *transient parts of the object to there properly initialized state. - * I.e we in effect - *call the null constructor. By calling ObjectInputStream.defaultReadObject() - *we restore the state of any non-static and non-transient variables. We - *then continue on to restore the state (as necessary) of the remaining varaibles. - *@param in The input stream from which to deserialize the object. - *@exception ClassNotFoundException If the class being deserialized is not found. - *@exception IOException If an error occurs while communicating with the system. - **/ - - private void readObject(java.io.ObjectInputStream in) - throws ClassNotFoundException, - IOException - { - in.defaultReadObject(); - initializeTransient(); //@B5A -//@B5D currentVetoListeners_ = new Vector(); -//@B5D currentRecordDescriptionListeners_ = new Vector(); -//@B5D recordDescriptionListeners_ = new Vector(); -//@B5D vetoListeners_ = new Vector(); - } - - /** - *Removes a listener from the change list. - *If the listener is not on the list, do nothing. - *@see #addPropertyChangeListener - *@param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) //@B5C - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - if (changes_ != null) changes_.removePropertyChangeListener(listener); - } - - /** - *Removes a listener from the record description listeners list. - *If the listener is not on the list, do nothing. - *@see #addRecordDescriptionListener - *@param listener The RecordDescriptionListener. - **/ - public void removeRecordDescriptionListener(RecordDescriptionListener listener) //@B5C - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - if (recordDescriptionListeners_ != null) recordDescriptionListeners_.removeElement(listener); -//@B5D currentRecordDescriptionListeners_ = (Vector)recordDescriptionListeners_.clone(); - } - - /** - *Removes a listener from the veto change listeners list. - *If the listener is not on the list, do nothing. - *@see #addVetoableChangeListener - *@param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) //@B5C - { - if (listener == null) - { - throw new NullPointerException("listener"); - } -//@B5D vetoListeners_.removeElement(listener); -//@B5D currentVetoListeners_ = (Vector)vetoListeners_.clone(); - if (vetos_ != null) vetos_.removeVetoableChangeListener(listener); //@B5A - } - - /** - *Sets the contents of this record from the specified byte array. - *The contents of each field will be set from contents - *based on the field description for the - *field that is provided by the record format specified on construction of this object. - *The data type object for the field description will be used to do any necessary conversion - *of the data from the byte array.
    - *Note: When using this object for the record level access classes, if isVariableLength() - *returns true for a field, the first two bytes of the data provided for - *that field must contain the length of the valid data. However, the number of bytes provided for - *the data for the field must equal the maximum field length for the field. - *
    - *The record format for the record must be set prior to invoking this method. - *@see Record#Record(com.ibm.as400.access.RecordFormat) - *@see Record#setRecordFormat - *@param contents The data with which to set the contents of this record. - *@exception UnsupportedEncodingException If an error occurs when converting - *the IBM i data to a Java Object. - **/ - public void setContents(byte[] contents) - throws UnsupportedEncodingException - { - setContents(contents, 0); - } - - /** - *Sets the contents of this record from the specified byte array. - *The contents of each field will be set from contents - *based on the field description for the - *field that is provided by the record format specified on construction of this object. - *The data type object for the field description will be used to do any necessary conversion - *of the data from the byte array.
    - *Note: When using this object for the record level access classes, if isVariableLength() - *returns true for a field, the first two bytes of the data provided for - *that field must contain the length of the valid data. However, the number of bytes provided for - *the data for the field must equal the maximum field length for the field. - *
    - *The record format for the record must be set prior to invoking this method. - *@see Record#Record(com.ibm.as400.access.RecordFormat) - *@see Record#setRecordFormat - *@param contents The data with which to set the contents of this record. - *@param offset The offset in contents at which to start. - *@exception UnsupportedEncodingException If an error occurs when converting - *the IBM i data to a Java Object. - **/ - public void setContents(byte[] contents, int offset) - throws UnsupportedEncodingException - { - if (recordFormat_ == null) - { - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - if (contents == null) - { - throw new NullPointerException("contents"); - } - if (contents.length == 0) - { - throw new ExtendedIllegalArgumentException("contents", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (offset < 0 || offset >= contents.length) - { - throw new ExtendedIllegalArgumentException("offset (" + offset + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (hasDependentFields_) - { // Record has dependent fields; convert now. - // For each field description in the recordFormat_ object, use the field description's - // data type object to translate the appropriate number of bytes in contents to an Object. - // Repeat this process for each field description in the record format. - // If the field is a variable length field, we must account for the two bytes worth of length - // data which precede the actual data for the field. - AS400DataType dType; - int numFields = recordFormat_.getNumberOfFields(); - FieldDescription f; - int lengthDependField; - int offsetDependField; - int variableFieldLength; - recordLength_ = 0; // Reset the record length - for (int i = 0; i < numFields; ++i) - { - f = fieldDescriptions_[i]; - lengthDependField = recordFormat_.getLengthDependency(i); - offsetDependField = recordFormat_.getOffsetDependency(i); - dType = f.getDataType(); - int length = dType.getByteLength(); - - // Check for offset dependent field - if (offsetDependField != -1) - { // Set offset to value specified in the field this field depends on - offset = ((Number)fields_[offsetDependField]).intValue(); - } - if (lengthDependField != -1) - { - AS400DataType newDataType = null; - // The length of this field is contained in the field that this field depends on - // Because the field depended on must exist prior to this field in the byte array, - // its value has already been determined. - length = ((Number)fields_[lengthDependField]).intValue(); - // @A1A: Check if f is variable length.. If so - // we need to bump the offset by two - // to get to the actual data and bump the record length by two. - boolean varLen = false; - if (f instanceof VariableLengthFieldDescription && ((VariableLengthFieldDescription)f).isVariableLength()) - { - offset += 2; - recordLength_ += 2; - varLen = true; - } - // End @A1A - - // Convert the server data to a Java object - if (f instanceof HexFieldDescription) - { // Field is a hex field, setDataType to indicate correct length - newDataType = new AS400ByteArray(length); - } - else if (f instanceof ArrayFieldDescription) - { - newDataType = new AS400Array(((AS400Array)dType).getType(), length); - } - else - { // character field - setDataType to indicate correct length - AS400Text dtText = (AS400Text)dType; //@B6A - //@B6D newDataType = new AS400Text(length, ((AS400Text)dType).getCcsid()); - newDataType = new AS400Text(length, dtText.getCcsid()); //@F0C - ((AS400Text)newDataType).setConverter(dtText.getConverter()); //@F0C - } - if (!varLen) //@A1A: If field is variable length need to preserve - { // maximum field length - f.setDataType(newDataType); - } - fields_[i] = newDataType.toObject(contents, offset); - recordLength_ += f.getDataType().getByteLength(); - } - // Check for possible variable length field - else if (f instanceof VariableLengthFieldDescription) - { - if (((VariableLengthFieldDescription)f).isVariableLength()) - { // Get the number of bytes returned for the field - variableFieldLength = BinaryConverter.byteArrayToUnsignedShort(contents, offset); - offset += 2; - recordLength_ += 2; - // Convert the server data to a Java object - if ((f instanceof HexFieldDescription)) - { // Field is a hex field, no conversion is done on the data - byte[] b = new byte[variableFieldLength]; - System.arraycopy(contents, offset, b, 0, variableFieldLength); - fields_[i] = b; - } - else - { // Field requires conversion based on ccsid - //@B5D Converter c = new Converter(((AS400Text)dType).getCcsid()); //@B5C - ConverterImpl c = ((AS400Text)dType).getConverter(); //@B5A @F0C - fields_[i] = c.byteArrayToString(contents, offset, variableFieldLength); - } - recordLength_ += dType.getByteLength(); - } - else - { // Field is not variable length - fields_[i] = dType.toObject(contents, offset); - recordLength_ += dType.getByteLength(); - } - } - else - { // Not a VariableLengthFieldDescription - fields_[i] = dType.toObject(contents, offset); - recordLength_ += dType.getByteLength(); - } - // Whether the field is variable length or not, we are always given the maximum - // number of bytes for the field in the byte array. - offset += length; - isConvertedToJava_[i] = true; - isConvertedToAS400_[i] = false; - } - if (recordDescriptionListeners_ != null) fireFieldModifiedEvent(); - } - else - { // No dependent fields; we can convert on the fly as necessary - if (contents.length - offset < as400Data_.length) - { - Trace.log(Trace.ERROR, "Byte array has insufficient length for record. contents length: " + contents.length + ", offset: " + offset + ", record length: " + as400Data_.length); - throw new ExtendedIllegalArgumentException("contents.length (" + contents.length + "), offset (" + offset + "), recordLength (" + as400Data_.length + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - System.arraycopy(contents, offset, as400Data_, 0, as400Data_.length); - // Indicate that no fields have been converted yet - for (int i = 0; i < isConvertedToJava_.length; ++i) - { - isConvertedToJava_[i] = false; - isConvertedToAS400_[i] = true; - } - } - } - - /** - *Sets the contents of this record from the specified input stream. - *The contents of each field will be set from in based on the field description for the - *field that is provided by the record format specified on construction of this object. - *The data type object for the field description will be used to do any necessary conversion - *of the data from the input stream.
    - *Note: When using this object for the record level access classes, if isVariableLength() - *returns true for a field, the first two bytes of the data provided for - *that field must contain the length of the data. - *
    - *The record format for the record must be set prior to invoking this method. - *@see Record#Record(com.ibm.as400.access.RecordFormat) - *@see Record#setRecordFormat - *@param in The stream from which to read the data. - *@exception IOException If an I/O error occurs while communicating with the system. - **/ - public void setContents(InputStream in) - throws IOException - { - if (recordFormat_ == null) - { - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - if (in == null) - { - throw new NullPointerException("in"); - } - - AS400DataType dType; - byte[] contents = new byte[recordLength_]; - if (readFromStream(in, contents, 0, recordLength_) != recordLength_) - { - throw new ExtendedIOException("Unable to read " + String.valueOf(recordLength_) + "bytes", ExtendedIOException.UNKNOWN_ERROR); - } - setContents(contents, 0); - } - - /** - *Sets the contents of the field at index to value. - *
    - *The record format for the record must be set prior to invoking this method. - *@see Record#Record(com.ibm.as400.access.RecordFormat) - *@see Record#setRecordFormat - *@param index The position in this record of the field whose contents are to be set. The index must be between 0 and getNumberOfFields() - 1. - *@param value The value to which to set the contents of the field. Specify null for - *value to indicate that the field is null. - * @throws UnsupportedEncodingException - **/ - public void setField(int index, Object value) - { - if (recordFormat_ == null) - { - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (index < 0 || index > fields_.length - 1) - { - throw new ExtendedIllegalArgumentException("index", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - fields_[index] = value; - if (recordDescriptionListeners_ != null) fireFieldModifiedEvent(); - if (value == null) - { - nullFieldMap_[index] = true; - } - //@B0A - else - { - nullFieldMap_[index] = false; - } - isConvertedToJava_[index] = true; - byte[] convertedFieldBytes = null; //@A2A - if (!hasDependentFields_) - { // Keep the contents of as400Data_ up to date so that - // getContents does not need to do any translation - int offset = fieldOffsets_[index]; - int variableFieldLength=0; //Initialize @A2C - FieldDescription f = fieldDescriptions_[index]; - // Check for possible variable length field - if (f instanceof VariableLengthFieldDescription) - { - if (((VariableLengthFieldDescription)f).isVariableLength()) - { - // Set the two byte length portion of the contents - if (fields_[index] == null) - { - // variableFieldLength = 0; Already set to zero, so no-op //@A2D - } - else - { - try { //@A2A - // For variable length fields there is a two-byte length field that - // needs to be calculated. Cannot simply use a String.length() method - // on the input parameter "value", because it may need to be converted - // to the ccsid of the target sytem which could result in a different - // length string (i.e. DBCS which could add shift-in and shift-out - // characters). Unicode "characters" may be represented by multiple - // "bytes", hence the need to carefully calculate the "number of bytes" - // for the variableFieldLength (not the number of characters). - // Therefore, extract the ccsid, convert the data, and save the length - // of the result in variableFieldLength. - - AS400DataType tmpDataType = f.getDataType(); //@A2A - if (tmpDataType instanceof AS400Text) //@A2A - { //@A2A - int tmpCcsid = ((AS400Text)tmpDataType).getCcsid(); //@A2A - convertedFieldBytes = CharConverter.stringToByteArray(tmpCcsid, (String)fields_[index]); //@A2A - variableFieldLength = convertedFieldBytes.length; //@A2A - } //@A2A - else //@A2A - { //@A2A - // Prior to the @A2 fix, the following line of code was used to - // calculate the string length. It is valid for non-AS400Text - // data types. Retain this behavior. - variableFieldLength = (f instanceof HexFieldDescription)? - ((byte[])fields_[index]).length : ((String)fields_[index]).length(); //@A2C - } //@A2A - - if (f instanceof DBCSGraphicFieldDescription) //@A2A - { //@A2A - // NOTE: The 2-byte length field in a VARGRAPHIC field is the number of "characters" and - // is NOT the number of "bytes". Each VARGRAPHIC "character" is represented by - // two bytes. So, we need to divide the variableFieldLength by two for VARGRAPHIC. - // Note: The 2-byte length field in a VARCHAR field is the number of "bytes", so the - // variableFieldLength is correct and should not be modified. - variableFieldLength /= 2; //@A2A - } //@A2A - } //@A2A - catch(UnsupportedEncodingException e) //@A2A - { - Trace.log(Trace.ERROR, "Record.setField received UnsupportedEncodingException", e); - throw new - InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION);//@A2A - } - } - BinaryConverter.unsignedShortToByteArray(variableFieldLength, as400Data_, offset); - offset += 2; - } - } - // Whether the field is variable length or not we still write out the maximum number - // of bytes for the field. This is the required format for variable length data for record - // level access. - AS400DataType dType = f.getDataType(); - if (fields_[index] != null) - { - if (convertedFieldBytes != null) //@A2A - { - // Use already converted data rather than re-converting the data - System.arraycopy(convertedFieldBytes, 0, as400Data_, offset, convertedFieldBytes.length);//@A2A - } - else - { - // Field has a value; convert it to server data - dType.toBytes(fields_[index], as400Data_, offset); - } - } - else - { // Field is null; use the default value for the server data to serve as a place holder for - // the field. - dType.toBytes(dType.getDefaultValue(), as400Data_, offset); - } - // Indicate the field is in a converted state - isConvertedToAS400_[index] = true; - } - else - { - isConvertedToAS400_[index] = false; - } - } - - /** - *Sets the contents of the field with the specified name to value. - *
    - *The record format for the record must be set prior to invoking this method. - *@see Record#Record(com.ibm.as400.access.RecordFormat) - *@see Record#setRecordFormat - *@param name The name of the field whose contents are to be set. - *@param value The value to which to set the contents of the field. Specify null for - *value to indicate that the field is null. - * @throws UnsupportedEncodingException - **/ - public void setField(String name, Object value) - { - if (recordFormat_ == null) - { - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - setField(recordFormat_.getIndexOfFieldName(name), value); - } - - /** - *Sets the record format for this record. - *@param recordFormat The record format for this record. - *@exception PropertyVetoException If a change is vetoed. - **/ - public void setRecordFormat(RecordFormat recordFormat) - throws PropertyVetoException - { - if (recordFormat == null) - { - throw new NullPointerException("recordFormat"); - } - //@B5C - fire events the "new" way - // Notify veto listeners of the change - if (vetos_ != null) vetos_.fireVetoableChange("recordFormat", recordFormat_, recordFormat); - RecordFormat old = recordFormat_; - initializeRecord(recordFormat); - if (changes_ != null) changes_.firePropertyChange("recordFormat", old, recordFormat_); - } - - /** - *Sets the name for this record. - *@param name The name for this record. - *@exception PropertyVetoException If a change is vetoed. - **/ - public void setRecordName(String name) - throws PropertyVetoException - { - if (name == null) - { - throw new NullPointerException("name"); - } - //@B5C - fire events the "new" way - // Notify veto listeners of the change - if (vetos_ != null) vetos_.fireVetoableChange("recordName", name_, name); - String old = name_; - name_ = name; - if (changes_ != null) changes_.firePropertyChange("recordName", old, name_); - } - - /** - *Sets the record number of this record. This method only pertains to the record - *level access class SequentialFile when a write or update by record number - *is being done. - *@param recordNumber The record number of this record. The - *recordNumber must be greater than 0. - *@exception PropertyVetoException If a change is vetoed. - **/ - public void setRecordNumber(int recordNumber) - throws PropertyVetoException - { - if (recordNumber < 0) - { - throw new ExtendedIllegalArgumentException("recordNumber", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - //@B5C - fire events the "new" way - // Notify veto listeners of the change - Integer old = null; - Integer newnum = null; - if (vetos_ != null || changes_ != null) - { - old = new Integer(recordNumber_); - newnum = new Integer(recordNumber); - } - if (vetos_ != null) vetos_.fireVetoableChange("recordNumber", old, newnum); - recordNumber_ = recordNumber; - if (changes_ != null) changes_.firePropertyChange("recordNumber", old, newnum); - } - - /** - *Returns the contents of this record formatted as a String. If a field is null, - *"null" is substituted for the contents of the field in the string representation - *of this record. - *@return The contents of this record. The empty string is returned if the - *record has not contents. - **/ - public String toString() - { - if (recordFormat_ == null) - { - return ""; - } - StringBuffer theRecord = new StringBuffer(0); - Object obj = null; - for (int i = 0; i < fields_.length; ++i) - { // Append each field as a String to theRecord. Separate each field's - // contents with a single space. - try - { - obj = getField(i); - } - catch(UnsupportedEncodingException e) - { - // Unable to convert field; set to null. We do this because - // we can't throw an exception from toString() - obj = null; - } - catch(Exception e) //@D0A - { - // Some other exception; probably due to the fact that - // this Record object hasn't had its AS400Text objects - // filled in. - obj = "???"; //@D0A - } - if (obj == null) - { - theRecord.append("null"); - } - else - { - if (obj instanceof byte[]) - { - theRecord.append(new String((byte[])obj)); - } - else - { - theRecord.append(obj.toString()); - } - } - theRecord.append(" "); - } - // We return all but the last character which is the last blank we added - return theRecord.toString().substring(0, theRecord.length() - 1); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/Record16.gif b/cvsroot/src/com/ibm/as400/access/Record16.gif deleted file mode 100644 index fb164abba..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/Record16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/Record32.gif b/cvsroot/src/com/ibm/as400/access/Record32.gif deleted file mode 100644 index 4c4b0c575..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/Record32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/RecordBeanInfo.java b/cvsroot/src/com/ibm/as400/access/RecordBeanInfo.java deleted file mode 100644 index fe8aead93..000000000 --- a/cvsroot/src/com/ibm/as400/access/RecordBeanInfo.java +++ /dev/null @@ -1,211 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2008 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @A1 12/12/2007 Correct EventSet for VetoablePropertyChange -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; - -/** - *The RecordBeanInfo class provides BeanInfo for the Record class. -**/ -public class RecordBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - // Bean class - private final static Class beanClass_ = Record.class; - // BeanDescriptor for this class - private static BeanDescriptor beanDescriptor_ = new BeanDescriptor(Record.class); - // Set of event descriptors for this class: - // PropertyChange, VetoableChange, RecordDescriptionEvent.FIELD_MODIFIED - private static EventSetDescriptor[] eventSet_ = new EventSetDescriptor[3]; - // Set of property descriptors for this class - // getFields, getKeyFields, recordFormat, recordName, recordNumber - private static PropertyDescriptor[] propertySet_ = new PropertyDescriptor[5]; - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - -/** - Constructs a RecordBeanInfo object. -**/ - public RecordBeanInfo() - { - try - { - // Populate the event descriptor set - // RecordDescriptionEvent.FIELD_MODIFIED - eventSet_[0] = new EventSetDescriptor(beanClass_, "recordDescription", - RecordDescriptionListener.class, - "fieldModified"); - eventSet_[0].setDisplayName(loader_.getText("EVT_NAME_FIELD_MODIFIED")); - eventSet_[0].setShortDescription(loader_.getText("EVT_DESC_FIELD_MODIFIED")); - - - // PropertyChangeEvent - eventSet_[1] = new EventSetDescriptor(beanClass_, "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - eventSet_[1].setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - eventSet_[1].setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - - // VetoablePropertyChange - eventSet_[2] = new EventSetDescriptor(beanClass_, "propertyChange", //@A1C - java.beans.VetoableChangeListener.class, - "vetoableChange"); - eventSet_[2].setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - eventSet_[2].setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - } - catch(IntrospectionException e) - { - throw new Error(e.toString()); - } - - try - { - // Populate the property descriptor set - // getFields - propertySet_[0] = new PropertyDescriptor("fields", beanClass_, - "getFields", null); - propertySet_[0].setBound(false); - propertySet_[0].setConstrained(false); - propertySet_[0].setDisplayName(loader_.getText("PROP_NAME_FIELDS")); - propertySet_[0].setShortDescription(loader_.getText("PROP_DESC_FIELDS")); - - - // getKeyFields - propertySet_[1] = new PropertyDescriptor("keyFields", beanClass_, - "getKeyFields", null); - propertySet_[1].setBound(false); - propertySet_[1].setConstrained(false); - propertySet_[1].setDisplayName(loader_.getText("PROP_NAME_KEY_FIELDS")); - propertySet_[1].setShortDescription(loader_.getText("PROP_DESC_KEY_FIELDS")); - - - // get/setRecordFormat - propertySet_[2] = new PropertyDescriptor("recordFormat", beanClass_, - "getRecordFormat", - "setRecordFormat"); - propertySet_[2].setBound(true); - propertySet_[2].setConstrained(true); - propertySet_[2].setDisplayName(loader_.getText("PROP_NAME_RECORD_FORMAT")); - propertySet_[2].setShortDescription(loader_.getText("PROP_DESC_RECORD_FORMAT")); - - - // get/setRecordName - propertySet_[3] = new PropertyDescriptor("recordName", beanClass_, - "getRecordName", - "setRecordName"); - propertySet_[3].setBound(true); - propertySet_[3].setConstrained(true); - propertySet_[3].setDisplayName(loader_.getText("PROP_NAME_RECORD_NAME")); - propertySet_[3].setShortDescription(loader_.getText("PROP_DESC_RECORD_NAME")); - - - // get/setRecordNumber - propertySet_[4] = new PropertyDescriptor("recordNumber", beanClass_, - "getRecordNumber", - "setRecordNumber"); - propertySet_[4].setBound(true); - propertySet_[4].setConstrained(true); - propertySet_[4].setDisplayName(loader_.getText("PROP_NAME_RECORD_NUMBER")); - propertySet_[4].setShortDescription(loader_.getText("PROP_DESC_RECORD_NUMBER")); - - - } - catch(IntrospectionException e) - { - throw new Error(e.toString()); - } - } - - /** - *Returns the bean descriptor. - *@return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - /** - *Returns the index of the default event. - *@return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the property change event - return 0; - } - - - /** - *Returns the index of the default property. - *@return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the default property - return 0; - } - - - /** - *Returns the set of event descriptors. - *@return The event descriptor set. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSet_; - } - - /** - *Returns the property descriptors. - *@return The property descriptors. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertySet_; - } - - /** - *Returns the icon image for a Record bean. - *@return The icon image. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("Record16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("Record32.gif"); - break; - } - return image; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/RecordDescriptionEvent.java b/cvsroot/src/com/ibm/as400/access/RecordDescriptionEvent.java deleted file mode 100644 index 4233f789e..000000000 --- a/cvsroot/src/com/ibm/as400/access/RecordDescriptionEvent.java +++ /dev/null @@ -1,84 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordDescriptionEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - *The RecordDescriptionEvent class represents a RecordDescriptionEvent. This class is used to - *fire events from the record description classes, - *{@link com.ibm.as400.access.RecordFormat RecordFormat} and - *{@link com.ibm.as400.access.Record Record} - *to listeners that have implemented the - *{@link com.ibm.as400.access.RecordDescriptionListener RecordDescriptionListener} - *interface. -**/ -public class RecordDescriptionEvent extends java.util.EventObject -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - /** - *Event id indicating that a field description has been added - *to a RecordFormat object. - *@see com.ibm.as400.access.RecordFormat#addFieldDescription - **/ - public static final int FIELD_DESCRIPTION_ADDED = 1; - /** - *Event id indicating that a key field description has been added - *to a RecordFormat object. - *@see com.ibm.as400.access.RecordFormat#addKeyFieldDescription - **/ - public static final int KEY_FIELD_DESCRIPTION_ADDED = 2; - /** - *Event id indicating that a field value has been modified - *in a Record object. - *@see com.ibm.as400.access.Record#setField - *@see com.ibm.as400.access.Record#setContents - **/ - public static final int FIELD_MODIFIED = 3; - - // Event identifier - private int id_; - - /** - *Constructs a RecordDescriptionEvent object. It uses the - *source and ID specified. - *@param source The object where the event originated. - *@param id The event identifier. The id must - *be a valid event id for this class. - **/ - public RecordDescriptionEvent(Object source, int id) - { - super(source); - if (id < FIELD_DESCRIPTION_ADDED || id > FIELD_MODIFIED) - { - throw new ExtendedIllegalArgumentException("id", - ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - id_ = id; - } - - - /** - *Returns the identifier for this event. - *@return The ID. - **/ - public int getID() - { - return id_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/RecordDescriptionListener.java b/cvsroot/src/com/ibm/as400/access/RecordDescriptionListener.java deleted file mode 100644 index e02e9dd43..000000000 --- a/cvsroot/src/com/ibm/as400/access/RecordDescriptionListener.java +++ /dev/null @@ -1,47 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordDescriptionListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - *The RecordDescriptionListener interface provides the interface that - *must be implemented to handle RecordDescriptionEvent objects that are - *fired by the record description classes, - *{@link com.ibm.as400.access.RecordFormat RecordFormat} and - *{@link com.ibm.as400.access.Record Record}. -**/ -public interface RecordDescriptionListener extends java.util.EventListener -{ - /** - *Invoked when a field description has been added to a RecordFormat object. - *@param event The event fired. - *@see com.ibm.as400.access.RecordFormat#addFieldDescription - **/ - public void fieldDescriptionAdded(RecordDescriptionEvent event); - - /** - *Invoked when a field value has been changed in a Record object. - *@param event The event fired. - *@see com.ibm.as400.access.Record#setField - *@see com.ibm.as400.access.Record#setContents - **/ - public void fieldModified(RecordDescriptionEvent event); - - /** - *Invoked when a key field description has been added to a RecordFormat - *object. - *@param event The event fired. - *@see com.ibm.as400.access.RecordFormat#addKeyFieldDescription - **/ - public void keyFieldDescriptionAdded(RecordDescriptionEvent event); -} diff --git a/cvsroot/src/com/ibm/as400/access/RecordFormat.java b/cvsroot/src/com/ibm/as400/access/RecordFormat.java deleted file mode 100644 index 632311c09..000000000 --- a/cvsroot/src/com/ibm/as400/access/RecordFormat.java +++ /dev/null @@ -1,1094 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordFormat.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// -// @A1 - 09/10/2007 - Change to ignore *NONE keys in addKeyFieldDescription() -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; -import java.util.Hashtable; -import java.util.Vector; -import java.util.Enumeration; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.io.Serializable; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeSupport; //@B0A -import java.beans.VetoableChangeListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyVetoException; - -/** - *The RecordFormat class represents the format of data returned from an IBM i system. - *It contains FieldDescription objects that describe the - *data returned from a system. The RecordFormat class is used to generate a Record - *object that can be used to access the data returned from the system as Java objects or - *as byte arrays of IBM i data. - *For instance, the entries on a data queue - *may have a specific format. This format could be represented by a - *RecordFormat object. The RecordFormat object could be used to generate a Record - *object containing the data read from the data queue. Based on the description of the - *data contained in the RecordFormat object, the Record object could be used by the Java - *program to handle the data as Java objects. As another example, a parameter for a program - *may be - *an array of bytes representing several different types of data. Such a parameter - *could be described by a RecordFormat object. - *

    - *The RecordFormat class is also used to describe the record format of a file when using - *the record-level database access classes. The record format of the file must be set prior - *to invoking the open() method on an AS400File object. - *

    - *The RecordFormat class is also used to describe the record format of a record when using - *the LineDataRecordWriter class. The following record format attributes are required to be - *set. - *

      - *
    • Record format ID - *
    • Record format type - *
    • Field descriptions that make up the record format - *
    • The delimiter, when the record format type is VARIABLE_LAYOUT_LENGTH - *
    • Field description layout attributes,length and alignment, when the record format - *is FIXED_LAYOUT_LENGTH - *
    - *

    - *The RecordFormat class allows the user to do the following: - *

      - *
    • Describe the data returned from a system. - *
    • Retrieve a Record object containing data that is described by the RecordFormat. - *
    - *RecordFormat objects generate the following events: - *
      - *
    • {@link com.ibm.as400.access.RecordDescriptionEvent RecordDescriptionEvent} - *
      The events fired are: - *
        - *
      • fieldDescriptionAdded() - *
      • keyFieldDescriptionAdded() - *
      - *
    • PropertyChangeEvent - *
    • VetoableChangeEvent - *
    - *Examples - * - *@see AS400FileRecordDescription -**/ -public class RecordFormat implements Serializable -{ - static final long serialVersionUID = 4L; - - - /** Constant indicating the layout length of all fields is fixed. **/ // @C1A - /** This constant is only used for record level writing. **/ // @C1A - public static final int FIXED_LAYOUT_LENGTH = 1; // @C1A - /** Constant indicating the layout length of all fields is variable. **/ //@C1A - /** This constant is only used for record level writing. **/ // @C1A - public static final int VARIABLE_LAYOUT_LENGTH = 2; // @C1A - // The delimiter used for printing variable length field records @C1A - private char delimiter_; // @C1A - - // The fieldDescriptions that make up this record format. - private Vector fieldDescriptions_ = new Vector(); - // Hashtable mapping the field names to their index in fieldDescriptions_ - private Hashtable fieldNameToIndexMap_ = new Hashtable(); - // Indicates if this format contains dependent fields - private boolean hasDependentFields_; - // The keyFieldDescriptions that make up this record format. - private Vector keyFieldDescriptions_ = new Vector(); - // Hashtable mapping the key field names to their index in keyFieldDescriptions_ - private Hashtable keyFieldNameToIndexMap_ = new Hashtable(); - // Contains the index of the field depended on for length by the field description specified by the - // the index into this Vector. - private Vector lengthDependentFields_ = new Vector(); - // Name of this record format - private String name_ = ""; - // Constant used to indicate that a field is not a dependent field - private static final Integer NOT_DEPENDENT_ = new Integer(-1); - // Contains the index of the field depended on for offset by the field description specified by the - // the index into this Vector. - private Vector offsetDependentFields_ = new Vector(); - // The record format type @C1A - private int recordFormatType_; // @C1A - // The record format ID @C1A - private String recordFormatID_ = ""; // @C1A - - // Transient data. - transient private PropertyChangeSupport changes_; //@B0C -//@B0D transient private Vector currentVetoListeners_ = new Vector(); //@B0C -//@B0D transient private Vector currentRecordDescriptionListeners_ = new Vector(); //@B0C - transient private Vector rdListeners_; //@B0C - transient private VetoableChangeSupport vetos_; //@B0C - - /** - *Constructs a RecordFormat object.
    - *Note: When using this object with the record level access classes, - *the version of the constructor that takes name must be used. - *@see RecordFormat#RecordFormat(java.lang.String) - **/ - public RecordFormat() - { - initializeTransient(); //@B0A - } - - /** - *Constructs a RecordFormat object. It uses the name specified.
    - *Note: Use this version of the constructor when the object is - *being used with the record level access classes. - *@param name The name of the record format. The name is converted - *to uppercase by this method. When using this object with the record level - *access classes, the name must be the name of the record format for - *the file that is being described. - **/ - public RecordFormat(String name) - { - if (name == null) - { - throw new NullPointerException("name"); - } - name_ = name.toUpperCase(); - initializeTransient(); //@B0A - } - - /** - *Adds a field description to this record format. The field description - *is added to the end of the field descriptions in this object. - *@param field The field description to be added. - **/ - public void addFieldDescription(FieldDescription field) - { - if (field == null) - { - throw new NullPointerException("field"); - } - // Map the name to the appropriate index - fieldNameToIndexMap_.put(field.getFieldName(), new Integer(fieldDescriptions_.size())); - // Add the field to the field descriptions - fieldDescriptions_.addElement(field); - // Indicate that this field is not a dependent field - lengthDependentFields_.addElement(NOT_DEPENDENT_); - // Indicate that this field is not a dependent field - offsetDependentFields_.addElement(NOT_DEPENDENT_); - - // Fire FIELD_DESCRIPTION_ADDED event - //@B0D - removed event firing code block - fireEvent(RecordDescriptionEvent.FIELD_DESCRIPTION_ADDED); //@B0A - } - - /** - *Adds a key field description to this record format. - *The key field description is determined by the index of a field description - *that was already added to this object. The key field description - *is added to the end of the key field descriptions in this object. - *The order in which the key field descriptions are added must match - *the order of the key fields in the files for which this record format - *is meant. - *@param index The index of a field description that was already - *added to this object via addFieldDescription(). The index must - *be in the range zero to getNumberOfFields() - 1. - **/ - public void addKeyFieldDescription(int index) - { - if (index < 0 || index > fieldDescriptions_.size() - 1) - { - throw new ExtendedIllegalArgumentException("index", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - FieldDescription f = (FieldDescription)fieldDescriptions_.elementAt(index); - // Map the name to the appropriate index - keyFieldNameToIndexMap_.put(f.getFieldName(), new Integer(keyFieldDescriptions_.size())); - // Add the field to the key field descriptions - keyFieldDescriptions_.addElement(f); - - // Fire KEY_FIELD_DESCRIPTION_ADDED event - //@B0D - removed event firing code block - fireEvent(RecordDescriptionEvent.KEY_FIELD_DESCRIPTION_ADDED); //@B0A - } - - - /** - *Adds a key field description to this record format. - *The key field description is determined by the name of a field description - *that was already added to this object. The key field description - *is added to the end of the key field descriptions in this object. - *The order in which the key field descriptions are added must match - *the order of the key fields in the files for which this record format - *is meant. - *@param name The name of a field description that was already - *added to this object via addFieldDescription(). The name is - *case sensitive. - **/ - public void addKeyFieldDescription(String name) - { - if (name == null) - { - throw new NullPointerException("name"); - } - // Do not add this key if the key is *NONE - if (!(name.equals("*NONE"))) //@A1A - { - // Key(s) of *NONE are just place holders for DB code for multi-format - // logical files. Key(s) of *NONE allows DB to build a search index - // for a multi-format logical file. The toolbox code does not use the - // *NONE key(s) in any way. - addKeyFieldDescription(getIndexOfFieldName(name)); - } - } - - /** - *Adds a listener to be notified when the value of any bound - *property is changed. The propertyChange method will be - *called. - *@see #removePropertyChangeListener - *@param listener The PropertyChangeListener. - **/ - public /*@B0D synchronized*/ void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - if (changes_ == null) changes_ = new PropertyChangeSupport(this); - changes_.addPropertyChangeListener(listener); - } - - /** - *Adds a listener to be notified when a RecordDescriptionEvent is fired. - *@see #removeRecordDescriptionListener - *@param listener The RecordDescriptionListener. - **/ - public /*@B0D synchronized*/ void addRecordDescriptionListener(RecordDescriptionListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - if (rdListeners_ == null) rdListeners_ = new Vector(); - rdListeners_.addElement(listener); //@B0C -//@B0D currentRecordDescriptionListeners_ = (Vector)recordDescriptionListeners_.clone(); - } - - /** - *Adds a listener to be notified when the value of any constrained - *property is changed. - *The vetoableChange method will be called. - *@see #removeVetoableChangeListener - *@param listener The VetoableChangeListener. - **/ - public /*@B0D synchronized*/ void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); - vetos_.addVetoableChangeListener(listener); //@B0C -//@B0D currentVetoListeners_ = (Vector)vetoListeners_.clone(); - } - - - //@B0A - /** - * Fire the appropriate event. - **/ - private void fireEvent(int index) - { - if (rdListeners_ == null) return; - Vector targets = (Vector)rdListeners_.clone(); - RecordDescriptionEvent event = new RecordDescriptionEvent(this, index); - for (int i=0; iindex must - *be in the range zero to getNumberOfFields() - 1. - *@return The field description. - **/ - public FieldDescription getFieldDescription(int index) - { - if (index < 0 || index > fieldDescriptions_.size() - 1) - { - throw new ExtendedIllegalArgumentException("index", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - return (FieldDescription)fieldDescriptions_.elementAt(index); - } - - /** - *Returns the field description with the specified name. - *@param name The name of the field description. The name is - *case sensitive. - *@return The field description. - **/ - public FieldDescription getFieldDescription(String name) - { - return (FieldDescription)fieldDescriptions_.elementAt(getIndexOfFieldName(name)); - } - - /** - *Returns the field descriptions that make up this object. - *@return The field descriptions. An array of size zero is returned if no - *fields have been added to this object. - **/ - public FieldDescription[] getFieldDescriptions() - { - FieldDescription[] fds = new FieldDescription[fieldDescriptions_.size()]; - fieldDescriptions_.copyInto(fds); - return fds; - } - - /** - *Returns the names of the field descriptions that make up this record format. - *@return The names of the field descriptions. An array of size zero is - *returned if no fields have been added to this object. - **/ - public String[] getFieldNames() - { - int size = fieldDescriptions_.size(); - String[] names = new String[size]; - for (int i = 0; i < size; ++i) - { - names[i] = ((FieldDescription)fieldDescriptions_.elementAt(i)).getFieldName(); - } - return names; - } - - /** - *Indicates if this record format contains dependent fields. - *@return true if this record format contains dependent fields; false otherwise - **/ - boolean getHasDependentFields() - { - return hasDependentFields_; - } - - /** - *Returns the index of the field description named name. - *@param name The name of the field description. The name - *is case sensitive. - *@return The index of the field description. - **/ - public int getIndexOfFieldName(String name) - { - if (name == null) - { - throw new NullPointerException("name"); - } - Integer i = (Integer)fieldNameToIndexMap_.get(name); - if (i == null) - { - throw new ExtendedIllegalArgumentException("name (" + name + ")", ExtendedIllegalArgumentException.FIELD_NOT_FOUND); - } - return i.intValue(); - } - - /** - *Returns the index of the field description of the key field named name. - *@param name The name of the key field description. The name is - *case sensitive. - *@return The index of the key field description. This is the index of the key field description - *in the key field descriptions for this object. It is not the index of the field description in the - *field descriptions for this object. - **/ - public int getIndexOfKeyFieldName(String name) - { - if (name == null) - { - throw new NullPointerException("name"); - } - Integer i = (Integer)keyFieldNameToIndexMap_.get(name); - if (i == null) - { - throw new ExtendedIllegalArgumentException("name (" + name + ")", ExtendedIllegalArgumentException.FIELD_NOT_FOUND); - } - return i.intValue(); - } - - /** - *Returns the field description of the key field at the specified index. - *@param index The index of the key field description in the key field descriptions for this object. - *@return The key field description. - **/ - public FieldDescription getKeyFieldDescription(int index) - { - if (index < 0 || index > fieldDescriptions_.size() - 1) - { - throw new ExtendedIllegalArgumentException("index", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - return (FieldDescription)keyFieldDescriptions_.elementAt(index); - } - - /** - *Returns the field description of the key field with the specified name. - *@param name The name of the key field description. The name is - *case sensitive. - *@return The key field description. - **/ - public FieldDescription getKeyFieldDescription(String name) - { - if (name == null) - { - throw new NullPointerException("name"); - } - return (FieldDescription)keyFieldDescriptions_.elementAt(getIndexOfKeyFieldName(name)); - } - - /** - *Returns the key field descriptions that make up this object. - *@return The key field descriptions. - **/ - public FieldDescription[] getKeyFieldDescriptions() - { - FieldDescription[] fds = new FieldDescription[keyFieldDescriptions_.size()]; - keyFieldDescriptions_.copyInto(fds); - return fds; - } - - /** - *Returns the names of the field descriptions of the keys that make up this record format. - *@return The names of the key field descriptions. If no key field descriptions exist, - *an array of size 0 is returned. - **/ - public String[] getKeyFieldNames() - { - int size = keyFieldDescriptions_.size(); - String[] names = new String[size]; - for (int i = 0; i < size; ++i) - { - names[i] = ((FieldDescription)keyFieldDescriptions_.elementAt(i)).getFieldName(); - } - return names; - } - - /** - *Returns the index of the field description on which the field description at the specified - *index depends. - *@param index The index of the field description. The index must be in the range 0 to - *getNumberOfFields() - 1. - *@return The index of the field description on which the field description at the specified - *index depends. - *If index is not the index of a dependent field, -1 is returned. - **/ - public int getLengthDependency(int index) - { - if (index < 0 || index > fieldDescriptions_.size() - 1) - { - throw new ExtendedIllegalArgumentException("index", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - return ((Integer)lengthDependentFields_.elementAt(index)).intValue(); - } - - /** - *Returns the index of the field description on which the field description with the specified - *name depends. - *@param name The name of the field description. The name is - *case sensitive. - *@return The index of the field description on which the field description with the specified - *name depends. - *If name is not the name of a dependent field, -1 is returned. - **/ - public int getLengthDependency(String name) - { - if (name == null) - { - throw new NullPointerException("name"); - } - return ((Integer)lengthDependentFields_.elementAt(getIndexOfFieldName(name))).intValue(); - } - - /** - *Returns the name of this record format. - *@return The name of this record format. If the name has not been - *set, an empty string is returned. - **/ - public String getName() - { - return name_; - } - - /** - *Returns a new record based on this record format, which contains default values for the - *contents of the fields. The default values are determined as follows: - *
      - *
    1. Use the value specified for the DFT keyword on the field description object for - *a particular field. - *
    2. If no value was specified for the DFT keyword, use the default value from the - *AS400DataType object specified when constructing the field description object for - *a particular field. - *
    - *@return A record based on this record format. If no field descriptions have been - *added to this object, null is returned. - **/ - public Record getNewRecord() - { - if (fieldDescriptions_.size() == 0) - { - return null; - } - return new Record(this); - } - - /** - *Returns a new record based on this record format, which contains default values for the - *contents of the fields. The default values are determined as follows: - *
      - *
    1. Use the value specified for the DFT keyword on the field description object for - *a particular field. - *
    2. If no value was specified for the DFT keyword, use the default value from the - *AS400DataType object specified when constructing the field description object for - *a particular field. - *
    - *@param recordName The name to assign to the Record object being returned. - *@return A record based on this record format. - *If no field descriptions have been added to this object, null is returned. - **/ - public Record getNewRecord(String recordName) - { - if (recordName == null) - { - throw new NullPointerException("recordName"); - } - if (fieldDescriptions_.size() == 0) - { - return null; - } - return new Record(this, recordName); - } - - /** - *Returns a new record based on this record format, which contains data from - *the specified byte array. - *@param contents The data with which to initialize the contents of the record. - *The length of contents must be greater than zero. - *@return A record based on this record format. - *If no field descriptions have been added to this object, null is returned. - *@exception UnsupportedEncodingException If an error occurs during conversion. - **/ - public Record getNewRecord(byte[] contents) - throws UnsupportedEncodingException - { - return getNewRecord(contents, 0); - } - - /** - *Returns a new record based on this record format, which contains data from - *the specified byte array. - *@param contents The data with which to initialize the contents of the record. - *The length of contents must be greater than zero. - *@param recordName The name to assign to the Record object being returned. - *@return A record based on this record format. - *If no field descriptions have been added to this object, null is returned. - *@exception UnsupportedEncodingException If an error occurs during conversion. - **/ - public Record getNewRecord(byte[] contents, String recordName) - throws UnsupportedEncodingException - { - return getNewRecord(contents, 0, recordName); - } - - /** - *Returns a new record based on this record format, which contains data from - *the specified byte array. - *@param contents The data with which to initialize the contents of the record. - *The length of contents must be greater than zero. - *@param offset The offset in contents at which to start. The offset - *cannot be less than zero. - *@return A record based on this record format. - *If no field descriptions have been added to this object, null is returned. - *@exception UnsupportedEncodingException If an error occurs during conversion. - **/ - public Record getNewRecord(byte[] contents, int offset) - throws UnsupportedEncodingException - { - if (contents == null) - { - throw new NullPointerException("contents"); - } - if (contents.length == 0) - { - throw new ExtendedIllegalArgumentException("contents", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (offset < 0) - { - throw new ExtendedIllegalArgumentException("offset", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (fieldDescriptions_.size() == 0) - { - return null; - } - return new Record(this, contents, offset); - } - - /** - *Returns a new record based on this record format, which contains data from - *the specified byte array. - *@param contents The data with which to initialize the contents of the record. - *The length of contents must be greater than zero. - *@param offset The offset in contents at which to start. The offset - *cannot be less than zero. - *@param recordName The name to assign to the Record object being returned. - *@return A record based on this record format. - *If no field descriptions have been added to this object, null is returned. - *@exception UnsupportedEncodingException If an error occurs during conversion. - **/ - public Record getNewRecord(byte[] contents, int offset, String recordName) - throws UnsupportedEncodingException - { - if (contents == null) - { - throw new NullPointerException("contents"); - } - if (contents.length == 0) - { - throw new ExtendedIllegalArgumentException("contents", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (offset < 0) - { - throw new ExtendedIllegalArgumentException("offset", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (recordName == null) - { - throw new NullPointerException("recordName"); - } - if (fieldDescriptions_.size() == 0) - { - return null; - } - return new Record(this, contents, offset, recordName); - } - - /** - *Returns the number of field descriptions in this record format. - *@return The number of field descriptions in this record format. - **/ - public int getNumberOfFields() - { - return fieldDescriptions_.size(); - } - - /** - *Returns the number of key field descriptions in this record format. - *@return The number of key field descriptions in this record format. - **/ - public int getNumberOfKeyFields() - { - return keyFieldDescriptions_.size(); - } - - /** - *Returns the index of the field description on which the field description at the specified - *index depends. - *@param index The index of the field description. The index must be in the range 0 to - *getNumberOfFields() - 1. - *@return The index of the field description on which the field description at the specified - *index depends. - *If index is not the index of a dependent field, -1 is returned. - **/ - public int getOffsetDependency(int index) - { - if (index < 0 || index > fieldDescriptions_.size() - 1) - { - throw new ExtendedIllegalArgumentException("index", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - return ((Integer)offsetDependentFields_.elementAt(index)).intValue(); - } - - /** - *Returns the index of the field description on which the field description with the specified - *name depends. - *@param name The name of the field description. The name is - *case sensitive. - *@return The index of the field description on which the field description with the specified - *name depends. - *If name is not the name of a dependent field, -1 is returned. - **/ - public int getOffsetDependency(String name) - { - if (name == null) - { - throw new NullPointerException("name"); - } - return ((Integer)offsetDependentFields_.elementAt(getIndexOfFieldName(name))).intValue(); - } - - // @C1A - added method - /** - * Returns the record format ID. - * The record format ID corresponds to a record format ID within a page definition - * defined on the system. - * - * @return The record format ID. - **/ - public String getRecordFormatID() - { - return recordFormatID_; - } - - // @C1A - added method - /** - * Returns the record format type. - * - * @return The record format type. - **/ - public int getRecordFormatType() - { - return recordFormatType_; - } - - //@D0A - /** - * This should be called by any class that is running proxified and retrieves - * a RecordFormat from the System i side. - **/ - void initializeTextObjects(AS400 system) - { - //@D0A - need to finish filling in the AS400Text objects - // now that we're back on the client - for (int i=0; ifieldDependedOn must have been added prior to adding the - *dependentField. - *@param dependentField The index of the dependent field. The - *dependentField must be in the range 1 to getNumberOfFields() - 1. - *@param fieldDependedOn The index of a field on which this field depends. The fieldDependedOn must - *be in the range 0 to dependentField. - **/ - public void setLengthDependency(int dependentField, int fieldDependedOn) - { - if (dependentField < 0) - { - throw new ExtendedIllegalArgumentException("dependentField", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (dependentField > fieldDescriptions_.size() - 1) - { - throw new ExtendedIllegalArgumentException("dependentField", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (fieldDependedOn < 0) - { - throw new ExtendedIllegalArgumentException("fieldDependedOn", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (dependentField > fieldDescriptions_.size() - 1) - { - throw new ExtendedIllegalArgumentException("dependentField", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (fieldDependedOn >= dependentField) - { - throw new ExtendedIllegalArgumentException("fieldDependedOn", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - lengthDependentFields_.setElementAt(new Integer(fieldDependedOn), dependentField); - hasDependentFields_ = true; - } - - /** - *Sets the field on which a dependent field depends. Both fields must have been added already - *to this RecordFormat. The fieldDependedOn must have been added prior to adding the - *dependentField. The names of the fields are - *case sensitive. - *@param dependentField The name of the dependent field. - *@param fieldDependedOn The name of a field on which this field depends. The index of - *fieldDependedOn in this RecordFormat must be less than the index of dependentField. - **/ - public void setLengthDependency(String dependentField, String fieldDependedOn) - { - if (dependentField == null) - { - throw new NullPointerException("dependentField"); - } - if (fieldDependedOn == null) - { - throw new NullPointerException("fieldDependedOn"); - } - int depOnIndex = getIndexOfFieldName(fieldDependedOn); - int depIndex = getIndexOfFieldName(dependentField); - setLengthDependency(depIndex, depOnIndex); - } - - /** - *Sets the name of this record format. - *@param name The name of this record format. - *The name is converted to uppercase by this method. - *@exception PropertyVetoException If a change is vetoed. - **/ - public void setName(String name) - throws PropertyVetoException - { - if (name == null) - { - throw new NullPointerException("name"); - } - - //@B0D: removed old veto-listener code block - - String old = name_; - if (vetos_ != null) vetos_.fireVetoableChange("name", old, name.toUpperCase()); //@B0A - name_ = name.toUpperCase(); - if (changes_ != null) changes_.firePropertyChange("name", old, name_); - } - - /** - *Sets the field on which a dependent field depends. Both fields must have been added already - *to this RecordFormat. The fieldDependedOn must have been added prior to adding the - *dependentField. - *@param dependentField The index of the dependent field. The - *dependentField must be in the range 1 to getNumberOfFields() - 1. - *@param fieldDependedOn The index of a field on which this field depends. The fieldDependedOn must - *be in the range 0 to dependentField. - **/ - public void setOffsetDependency(int dependentField, int fieldDependedOn) - { - if (dependentField < 0) - { - throw new ExtendedIllegalArgumentException("dependentField", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (fieldDependedOn < 0) - { - throw new ExtendedIllegalArgumentException("fieldDependedOn", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (dependentField > fieldDescriptions_.size() - 1) - { - throw new ExtendedIllegalArgumentException("dependentField", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (fieldDependedOn >= dependentField) - { - throw new ExtendedIllegalArgumentException("fieldDependedOn", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - offsetDependentFields_.setElementAt(new Integer(fieldDependedOn), dependentField); - hasDependentFields_ = true; - } - - /** - *Sets the field on which a dependent field depends. Both fields must have been added already - *to this RecordFormat. The fieldDependedOn must have been added prior to adding the - *dependentField. The names of the fields are - *case sensitive. - *@param dependentField The name of the dependent field. - *@param fieldDependedOn The name of a field on which this field depends. The index of - *fieldDependedOn in this RecordFormat must be less than the index of dependentField. - **/ - public void setOffsetDependency(String dependentField, String fieldDependedOn) - { - if (dependentField == null) - { - throw new NullPointerException("dependentField"); - } - if (fieldDependedOn == null) - { - throw new NullPointerException("fieldDependedOn"); - } - int depOnIndex = getIndexOfFieldName(fieldDependedOn); - int depIndex = getIndexOfFieldName(dependentField); - setOffsetDependency(depIndex, depOnIndex); - } - - // @C1A - added method - /** - * Sets the record format ID. The length of the record format ID must be 10 characters - * or less. The record format ID corresponds to a record format ID within a page - * definition on the system. If the record format ID is less than 10 characters, - * it is padded to 10 characters in length with spaces. - * - * @param id The record format ID. - **/ - public void setRecordFormatID(String id) - { - String pad = " " ; - if (id.length() > 10) { - throw new ExtendedIllegalArgumentException("id", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (id.length() < 10) { - int padl = 10 - id.length(); - recordFormatID_ = id + pad.substring(0,padl); - } - else - recordFormatID_ = id; - - - } - -// @C1A - added method - /** - * Sets the record format type. Valid values are FIXED_LAYOUT_LENGTH and - * VARIABLE_LAYOUT_LENGTH. This attribute is only valid when using the - * line record writer class. - * - * @param type The record format type. - **/ - - public void setRecordFormatType(int type) - { - if ((type != VARIABLE_LAYOUT_LENGTH) && (type != FIXED_LAYOUT_LENGTH)) { - throw new ExtendedIllegalArgumentException("type", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - recordFormatType_ = type; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/RecordFormat16.gif b/cvsroot/src/com/ibm/as400/access/RecordFormat16.gif deleted file mode 100644 index afa677c58..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/RecordFormat16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/RecordFormat32.gif b/cvsroot/src/com/ibm/as400/access/RecordFormat32.gif deleted file mode 100644 index a9999157e..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/RecordFormat32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/RecordFormatBeanInfo.java b/cvsroot/src/com/ibm/as400/access/RecordFormatBeanInfo.java deleted file mode 100644 index 017e33cd1..000000000 --- a/cvsroot/src/com/ibm/as400/access/RecordFormatBeanInfo.java +++ /dev/null @@ -1,211 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordFormatBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2008 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @A1 12/12/2007 Correct EventSet for VetoablePropertyChange -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; - -/** - *The RecordFormatBeanInfo class provides BeanInfo for the RecordFormat class. -**/ -public class RecordFormatBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - // Bean class - private final static Class beanClass_ = RecordFormat.class; - - // BeanDescriptor for this class - private static BeanDescriptor beanDescriptor_ = new BeanDescriptor(RecordFormat.class); - - // Set of event descriptors for this class: - // PropertyChange, VetoableChange, RecordDescriptionEvent - private static EventSetDescriptor[] eventSet_ = new EventSetDescriptor[3]; - - // Set of property descriptors for this class - // getFieldDescriptions, getKeyFieldDescriptions, getFieldNames, getKeyFieldNames, - // getName - private static PropertyDescriptor[] propertySet_ = new PropertyDescriptor[5]; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - -/** - Constructs a RecordFormatBeanInfo object. -**/ - public RecordFormatBeanInfo() - { - try - { - // Populate the event descriptor set - // RecordDescriptionEvent.FIELD_DESCRIPTION_ADDED and - // KEY_FIELD_DESCRIPTION_ADDED - String[] listenerMethods = {"fieldDescriptionAdded", "keyFieldDescriptionAdded"}; - eventSet_[0] = new EventSetDescriptor(beanClass_, "recordDescription", - RecordDescriptionListener.class, - listenerMethods, "addRecordDescriptionListener", "removeRecordDescriptionListener"); - eventSet_[0].setDisplayName(loader_.getText("EVT_NAME_RECORD_DESCRIPTION_EVENT")); - eventSet_[0].setShortDescription(loader_.getText("EVT_DESC_RECORD_DESCRIPTION_EVENT")); - - - // PropertyChangeEvent - eventSet_[1] = new EventSetDescriptor(beanClass_, "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - eventSet_[1].setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - eventSet_[1].setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - - // VetoablePropertyChange - eventSet_[2] = new EventSetDescriptor(beanClass_, "propertyChange", //@A1C - java.beans.VetoableChangeListener.class, - "vetoableChange"); - eventSet_[2].setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - eventSet_[2].setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - } - catch(IntrospectionException e) - { - throw new Error(e.toString()); - } - - try - { - // Populate the property descriptor set - // getFieldDescriptions - propertySet_[0] = new PropertyDescriptor("fieldDescriptions", beanClass_, - "getFieldDescriptions", null); - propertySet_[0].setBound(false); - propertySet_[0].setConstrained(false); - propertySet_[0].setDisplayName(loader_.getText("PROP_NAME_FIELD_DESCRIPTIONS")); - propertySet_[0].setShortDescription(loader_.getText("PROP_DESC_FIELD_DESCRIPTIONS")); - - // getKeyFieldDescriptions - propertySet_[1] = new PropertyDescriptor("keyFieldDescriptions", beanClass_, - "getKeyFieldDescriptions", null); - propertySet_[1].setBound(false); - propertySet_[1].setConstrained(false); - propertySet_[1].setDisplayName(loader_.getText("PROP_NAME_KEY_FIELD_DESCRIPTIONS")); - propertySet_[1].setShortDescription(loader_.getText("PROP_DESC_KEY_FIELD_DESCRIPTIONS")); - - // getFieldNames - propertySet_[2] = new PropertyDescriptor("fieldNames", beanClass_, - "getFieldNames", null); - propertySet_[2].setBound(false); - propertySet_[2].setConstrained(false); - propertySet_[2].setDisplayName(loader_.getText("PROP_NAME_FIELD_NAMES")); - propertySet_[2].setShortDescription(loader_.getText("PROP_DESC_FIELD_NAMES")); - - // getKeyFieldNames - propertySet_[3] = new PropertyDescriptor("keyFieldNames", beanClass_, - "getKeyFieldNames", null); - propertySet_[3].setBound(false); - propertySet_[3].setConstrained(false); - propertySet_[3].setDisplayName(loader_.getText("PROP_NAME_KEY_FIELD_NAMES")); - propertySet_[3].setShortDescription(loader_.getText("PROP_DESC_KEY_FIELD_NAMES")); - - // get/setName - propertySet_[4] = new PropertyDescriptor("name", beanClass_, - "getName", - "setName"); - propertySet_[4].setBound(true); - propertySet_[4].setConstrained(true); - propertySet_[4].setDisplayName(loader_.getText("PROP_NAME_RECORD_FORMAT_NAME")); - propertySet_[4].setShortDescription(loader_.getText("PROP_DESC_RECORD_FORMAT_NAME")); - - } - catch(IntrospectionException e) - { - throw new Error(e.toString()); - } - } - - /** - *Returns the bean descriptor. - *@return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - /** - *Returns the index of the default event. - *@return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the property change event - return 0; - } - - - /** - *Returns the index of the default property. - *@return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the default property - return 0; - } - - - /** - *Returns the set of event descriptors. - *@return The event descriptor set. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSet_; - } - - /** - *Returns the property descriptors. - *@return The property descriptors. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertySet_; - } - - /** - *Returns the icon image for a RecordFormat bean. - *@return The icon image. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("RecordFormat16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("RecordFormat32.gif"); - break; - } - return image; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/RemoteCommandImpl.java b/cvsroot/src/com/ibm/as400/access/RemoteCommandImpl.java deleted file mode 100644 index 1a65a7ca2..000000000 --- a/cvsroot/src/com/ibm/as400/access/RemoteCommandImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RemoteCommandImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1999-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -// RemoteCommandImpl defines the implementation interface for the CommandCall and ProgramCall objects. -interface RemoteCommandImpl -{ - static final Boolean ON_THREAD = CommandCall.THREADSAFE_TRUE; - static final Boolean OFF_THREAD = CommandCall.THREADSAFE_FALSE; - // Warning... LOOKUP_THREADSAFETY is defined to be NULL. Use only == for comparisions - static final Boolean LOOKUP_THREADSAFETY = CommandCall.THREADSAFE_LOOKUP; - - static final int MESSAGE_OPTION_DEFAULT = AS400Message.MESSAGE_OPTION_UP_TO_10; - - // Values returned by getThreadsafeIndicator. - static final int THREADSAFE_INDICATED_NO = 0; - static final int THREADSAFE_INDICATED_YES = 1; - static final int THREADSAFE_INDICATED_CONDITIONAL = 2; - - // Get job name, user, job number for the correct job. - public String getJobInfo(Boolean threadSafety) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException; - // Report whether the command is designated as threadsafe on the system. - public int getThreadsafeIndicator(String command) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException; - // Report whether the RemoteCommandImpl object is a native object. - public boolean isNative(); - // Get the message list from the implementation object. - public AS400Message[] getMessageList(); - // Run the command on the implementation object. - public boolean runCommand(String command) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException; - // Run the command on the implementation object. - public boolean runCommand(String command, Boolean threadSafety, int messageOption) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException; - - // Run the command on the implementation object. - public boolean runCommand(byte[] commandAsBytes, String commandAsString) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException; - - // Run the command on the implementation object. - public boolean runCommand(byte[] command, Boolean threadSafety, int messageOption) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException; - - // Run the program call on the implementation object. - public boolean runProgram(String library, String name, ProgramParameter[] parameterList) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException; - - // Run the program call on the implementation object. - public boolean runProgram(String library, String name, ProgramParameter[] parameterList, Boolean threadSafety) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException; - - // Run the program call on the implementation object. - public boolean runProgram(String library, String name, ProgramParameter[] parameterList, Boolean threadSafety, int messageOption) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException; - // Run the service program call on the implementation object. - public byte[] runServiceProgram(String library, String name, String procedureName, ProgramParameter[] serviceParameterList) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException; - // Run the service program call on the implementation object. - public byte[] runServiceProgram(String library, String name, String procedureName, int returnValueFormat, ProgramParameter[] serviceParameterList, Boolean threadSafety, int procedureNameCCSID, int messageOption, boolean alignOn16Bytes) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException; - // Set the AS400Impl into the implementation object. - public void setSystem(AS400Impl system) throws IOException; -} diff --git a/cvsroot/src/com/ibm/as400/access/RemoteCommandImplNative.java b/cvsroot/src/com/ibm/as400/access/RemoteCommandImplNative.java deleted file mode 100644 index b8dc2034d..000000000 --- a/cvsroot/src/com/ibm/as400/access/RemoteCommandImplNative.java +++ /dev/null @@ -1,709 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RemoteCommandImplNative.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1999-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// -// @A1 - 9/18/2007 - Changes to follow proxy command chain. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - - -// The RemoteCommandImplNative class is the native implementation of CommandCall and ProgramCall. -class RemoteCommandImplNative extends RemoteCommandImplRemote -{ - private static final String CLASSNAME = "com.ibm.as400.access.RemoteCommandImplNative"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - static - { - NativeMethods.loadNativeLibraryQyjspart(); - } - - // Report whether the RemoteCommandImpl object is a native object. - public boolean isNative() - { - return true; - } - - // Connects to the server. - // @param threadSafety The assumed thread safety of the command/program. - protected void open(Boolean threadSafety) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - // Note: LOOKUP_THREADSAFETY is null so == must be used - if ((LOOKUP_THREADSAFETY == threadSafety) || OFF_THREAD.equals(threadSafety)) { - openOffThread(); - } - else { - openOnThread(); - } - } - - protected void openOnThread() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Native implementation object open."); - - // If converter was not set with a user override ccsid, set converter to job ccsid. - if (!ccsidIsUserOveride_ && (converter_ == null)) - { - converter_ = ConverterImplRemote.getConverter(system_.getCcsid(), system_); - } - if (AS400.nativeVRM.vrm_ >= 0x00050300) - { - if (AS400.nativeVRM.vrm_ >= 0x00060100) - { - serverDataStreamLevel_ = 10; - if (unicodeConverter_ == null) { - unicodeConverter_ = ConverterImplRemote.getConverter(1200, system_); - } - } - else - { - serverDataStreamLevel_ = 7; - } - } - - // Set the secondary language library on the server. - if (system_.isMustAddLanguageLibrary() && - !system_.isSkipFurtherSettingOfLanguageLibrary()) // see if we should try - { - // Note: If we were going through the Remote Command Host Server, the host server would set the secondary language library for us. - // Since we're not using the host server, we need to handle this ourselves. - // We need to do this on every open, since several different threads may be using this RemoteCommandImpl object. - - // Retrieve the name of the secondary language library (if any). - String secLibName = retrieveSecondaryLanguageLibName(); // never returns null - // Set the NLV on server to match the client's locale. - if (secLibName.length() != 0) - { - setNlvOnServer(secLibName); - } - // Retain result, to avoid repeated library lookups for same system object. - system_.setLanguageLibrary(secLibName); - // Set to non-null, to indicate we already looked-up the value. - } - - } - - - // Retrieves the secondary language library (if any). - // If fail to retrieve library name, or name is blank, returns "". - private String retrieveSecondaryLanguageLibName() - { - String secLibName = system_.getLanguageLibrary(); - if (secLibName == null) // 'null' implies not already looked-up - { - String clientNLV = system_.getNLV(); // NLV of client (based on locale) - try - { - int ccsid = system_.getCcsid(); - ConvTable conv = ConvTable.getTable(ccsid, null); - - ProgramParameter[] parameterList = new ProgramParameter[6]; - int len = 108+10; // length of PRDR0100, plus first 10 bytes of PRDR0200 - parameterList[0] = new ProgramParameter(len); // receiver variable - PRDR0100 plus first 10 bytes of PRDR0200 - parameterList[1] = new ProgramParameter(BinaryConverter.intToByteArray(len)); // length of receiver variable - parameterList[2] = new ProgramParameter(conv.stringToByteArray("PRDR0200")); // format name - - byte[] productInfo = new byte[36]; // product information - AS400Text text4 = new AS400Text(4, ccsid, system_); - AS400Text text6 = new AS400Text(6, ccsid, system_); - AS400Text text7 = new AS400Text(7, ccsid, system_); - AS400Text text10 = new AS400Text(10, ccsid, system_); - text7.toBytes("*OPSYS", productInfo, 0); // product ID - text6.toBytes("*CUR", productInfo, 7); // release level - text4.toBytes("0000", productInfo, 13); // product option - text10.toBytes(clientNLV, productInfo, 17); // load ID (specifies desired NLV) - BinaryConverter.intToByteArray(36, productInfo, 28); // length of product information parm - BinaryConverter.intToByteArray(ccsid, productInfo, 32); // ccsid for returned directory - parameterList[3] = new ProgramParameter(productInfo); // product information - parameterList[4] = new ProgramParameter(new byte[4]); // error code - parameterList[5] = new ProgramParameter(conv.stringToByteArray("PRDI0200")); // product information format name - - // Call QSZRTVPR (Retrieve Product Information) to retrieve the library for the secondary language. - // Note: QSZRTVPR is documented as non-threadsafe. However, the API owner has indicated that this API will never alter the state of the system, and that it cannot damage the system; so it can safely be called on-thread. - boolean succeeded = runProgramOnThread("QSYS", "QSZRTVPR", parameterList, AS400Message.MESSAGE_OPTION_UP_TO_10, true); - // Note: This method is only called from within open(). - // The final parm indicates that the on-thread open() has already been done (on this thread). - - if (!succeeded) - { - Trace.log(Trace.WARNING, "Unable to retrieve secondary language library name for NLV " + clientNLV, new AS400Exception(messageList_)); - } - else - { - byte[] outputData = parameterList[0].getOutputData(); - int offsetToAddlInfo = BinaryConverter.byteArrayToInt(outputData, 84); - secLibName = conv.byteArrayToString(outputData, offsetToAddlInfo, 10).trim(); - if (secLibName.length() == 0) { - Trace.log(Trace.WARNING, "Unable to retrieve secondary language library name for NLV " + clientNLV + ": Blank library name returned."); - } - } - } - catch (Throwable t) { - Trace.log(Trace.WARNING, "Unable to retrieve secondary language library name for NLV " + clientNLV, t); - } - } - - return (secLibName == null ? "" : secLibName); - } - - // Sets the NLV (for the current thread) on the server, so that system msgs are returned in correct language. - private void setNlvOnServer(String secondaryLibraryName) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Native implementation object setting national language for messages."); - try - { - // Call CHGSYSLIBL (Change System Library List) to add the library for the secondary language. - // Note: According to the spec, CHGSYSLIBL "changes the system portion of the library list for the current thread". - // Prior to V6R1, CHGSYSLIBL is documented as non-threadsafe. However, the CL owner has indicated that this CL has actually been threadsafe all along, and that it cannot damage the system; so it can safely be called on-thread. - // At worst, if system value QMLTTHDACN == 3, the system will simply refuse to execute the command. In which case, the secondary language library won't get added. - String cmd = "QSYS/CHGSYSLIBL LIB("+secondaryLibraryName+") OPTION(*ADD)"; - boolean succeeded = runCommandOnThread(cmd, AS400Message.MESSAGE_OPTION_UP_TO_10, true); - // Note: This method is only called from within open(). - // The final parm indicates that the on-thread open() has already been done (on this thread). - - if (!succeeded) - { - if (messageList_.length !=0) - { - if (messageList_[0].getID().equals("CPF2103")) // lib is already in list - { - // Tolerate this error. It means that we're good to go. - // If this is the very first native open() for this system_, set flag to indicate that the lib is already in list by default. This will eliminate clutter in the job log, from subsequent attempts to set it. - if (system_.getLanguageLibrary() == null) { // null implies first native open - system_.setSkipFurtherSettingOfLanguageLibrary(); // don't keep trying on subsequent open's - } - } - else if (messageList_[0].getID().equals("CPD0032")) // not auth'd to call CHGSYSLIBL - { - system_.setSkipFurtherSettingOfLanguageLibrary(); // don't keep trying on subsequent open's - Trace.log(Trace.DIAGNOSTIC, "Profile " + system_.getUserId() + " not authorized to use CHGSYSLIBL to add secondary language library " + secondaryLibraryName + " to liblist."); - // Note: The Remote Command Host Server runs this command under greater authority. - } - else if (messageList_[0].getID().equals("CPF2110")) // library not found - { - system_.setSkipFurtherSettingOfLanguageLibrary(); // don't keep trying on subsequent open's - Trace.log(Trace.WARNING, "Secondary language library " + secondaryLibraryName + " was not found."); - } - else - { - Trace.log(Trace.ERROR, "Unable to add secondary language library " + secondaryLibraryName + " to library list.", new AS400Exception(messageList_)); - } - } - else // no system messages returned - { - Trace.log(Trace.WARNING, "Unable to add secondary language library " + secondaryLibraryName + " to library list."); - } - } - } - catch (Throwable t) - { - Trace.log(Trace.WARNING, "Failed to add secondary language library " + secondaryLibraryName + " to library list.", t); - } - } - - - // This method is reserved for use by other Impl classes in this package. - public boolean runCommand(String command) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - // The caller didn't specify whether to call the command on- or off-thread. - // Base the decision on the setting the "threadSafe" system property. - - if (shouldRunOnThread(command)) { - return runCommandOnThread(command, MESSAGE_OPTION_DEFAULT, false); - } - else { - return runCommandOffThread(command, MESSAGE_OPTION_DEFAULT); - } - } - - - // Runs the command. - // @param threadSafety The assumed thread safety of the command/program. - // @return true if command is successful; false otherwise. - public boolean runCommand(String command, Boolean threadSafety, int messageOption) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - boolean runOnThread; - - if (ON_THREAD.equals(threadSafety)) { - runOnThread = true; - } - else if (OFF_THREAD.equals(threadSafety)) { - runOnThread = false; - } - else // threadSafety == LOOKUP_THREADSAFETY - { - // Look up the command's indicated threadsafety on the system. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "LOOKING-UP thread safety of command: " + command); - runOnThread = (getThreadsafeIndicator(command) == THREADSAFE_INDICATED_YES); - } - - if (runOnThread) { - return runCommandOnThread(command, MESSAGE_OPTION_DEFAULT, false); - } - else { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Delegating runCommand() to super class."); - return runCommandOffThread(command, messageOption); - } - } - - // Runs the command. - // @return true if command is successful; false otherwise. - private boolean runCommandOnThread(String command, int messageOption, boolean currentlyOpeningOnThisThread) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - if (Trace.traceOn_) - { - Trace.log(Trace.INFORMATION, "Native implementation running command: " + command); - Trace.log(Trace.DIAGNOSTIC, "Running command ON-THREAD: " + command); - } - if (!currentlyOpeningOnThisThread) openOnThread(); - - if (AS400.nativeVRM.vrm_ >= 0x00060100) - { - return runCommandOnThread(unicodeConverter_.stringToByteArray(command), messageOption, 1200); - } - return runCommandOnThread(converter_.stringToByteArray(command), messageOption, 0); - } - - public boolean runCommand(byte[] commandAsBytes, String commandAsString) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - // The caller didn't specify whether to call the command on- or off-thread. - // Base the decision on the setting the "threadSafe" system property. - - if (shouldRunOnThread(commandAsString)) { - openOnThread(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Running command ON-THREAD: " + commandAsString); - return runCommandOnThread(commandAsBytes, MESSAGE_OPTION_DEFAULT, 0); - } - else { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Running command OFF-THREAD: " + commandAsString); - return runCommandOffThread(commandAsBytes, MESSAGE_OPTION_DEFAULT, 0); - } - } - - private boolean runCommandOnThread(byte[] commandBytes, int messageOption, int ccsid) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - if (OFF_THREAD.equals(priorCallWasOnThread_)) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Prior call was off-thread, but this call is on-thread, so different job."); - } - priorCallWasOnThread_ = ON_THREAD; - - try - { - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "Invoking native method."); - if (AS400.nativeVRM.vrm_ < 0x00050300) - { - try - { - byte[] replyBytes = runCommandNative(commandBytes); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Native reply bytes:", replyBytes); - - if (replyBytes == null) replyBytes = new byte[0]; - - // Get info from reply. - messageList_ = RemoteCommandImplNative.parseMessages(replyBytes, converter_); - return true; - } - catch (NativeException e) // Exception found by C code. - { - messageList_ = RemoteCommandImplNative.parseMessages(e.data, converter_); - return false; - } - } - else - { - try - { - byte[] replyBytes = AS400.nativeVRM.vrm_ < 0x00060100 ? runCommandNativeV5R3(commandBytes, messageOption) : NativeMethods.runCommand(commandBytes, ccsid, messageOption); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Native reply bytes:", replyBytes); - - // Get info from reply. - messageList_ = RemoteCommandImplNative.parseMessagesV5R3(replyBytes, converter_); - return true; - } - catch (NativeException e) // Exception found by C code. - { - messageList_ = RemoteCommandImplNative.parseMessagesV5R3(e.data, converter_); - return false; - } - } - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - } - - public boolean runProgram(String library, String name, ProgramParameter[] parameterList) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - // The caller didn't specify whether to call the command on- or off-thread. - // Base the decision on the setting the "threadSafe" system property. - - String property = ProgramCall.getThreadSafetyProperty(); - Boolean threadSafety; - if (property != null && property.equals("true")) { - threadSafety = ON_THREAD; - } - else threadSafety = OFF_THREAD; - - return runProgram(library, name, parameterList, threadSafety); - } - - public boolean runProgram(String library, String name, ProgramParameter[] parameterList, Boolean threadSafety) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - // Note: We don't have a way to look up the thread safety of programs. - if (ON_THREAD.equals(threadSafety)) { - return runProgramOnThread(library, name, parameterList, MESSAGE_OPTION_DEFAULT, false); - } - else { - return runProgramOffThread(library, name, parameterList, MESSAGE_OPTION_DEFAULT); - } - } - - public boolean runProgram(String library, String name, ProgramParameter[] parameterList, Boolean threadSafety, int messageOption) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - // Note: We don't have a way to look up the thread safety of programs. - if (ON_THREAD.equals(threadSafety)) { - return runProgramOnThread(library, name, parameterList, messageOption, false); - } - else { - return runProgramOffThread(library, name, parameterList, messageOption); - } - } - - // Run the program. - protected boolean runProgramOnThread(String library, String name, ProgramParameter[] parameterList, int messageOption, boolean currentlyOpeningOnThisThread) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) - { - Trace.log(Trace.INFORMATION, "Native implementation running program: " + library + "/" + name); - Trace.log(Trace.DIAGNOSTIC, "Running program ON-THREAD: " + library + "/" + name); - } - if (OFF_THREAD.equals(priorCallWasOnThread_)) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Prior call was off-thread, but this call is on-thread, so different job."); - } - priorCallWasOnThread_ = ON_THREAD; - - // Run the program on-thread. - if (!currentlyOpeningOnThisThread) openOnThread(); - - if (AS400.nativeVRM.vrm_ < 0x00050300) - { - // Create a "call program" request, and write it as raw bytes to a byte array. - // Set up the buffer that contains the program to call. The buffer contains three items: - // 10 characters - the program to call. - // 10 characters - the library that contains the program. - // 4 bytes - the number of parameters. - byte[] programNameBuffer = {(byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00}; - converter_.stringToByteArray(name, programNameBuffer); - converter_.stringToByteArray(library, programNameBuffer, 10); - BinaryConverter.intToByteArray(parameterList.length, programNameBuffer, 20); - - // Set up the parameter structure. There is one structure for each parameters. - // The structure contains: - // 4 bytes - the length of the parameter. - // 2 bytes - the parameters usage (input/output/inout). - // 4 bytes - the offset into the parameter buffer. - byte[] programParameterStructure = new byte[parameterList.length * 10]; - int totalParameterLength = 0; - for (int i = 0, offset = 0; i < parameterList.length; ++i) - { - int parameterMaxLength = parameterList[i].getMaxLength(); - int parameterUsage = parameterList[i].getUsage(); - if (parameterUsage == ProgramParameter.NULL) - { - // Server does not allow null parameters. - parameterUsage = ProgramParameter.INPUT; - } - BinaryConverter.intToByteArray(parameterMaxLength, programParameterStructure, i * 10); - BinaryConverter.unsignedShortToByteArray(parameterUsage, programParameterStructure, i * 10 + 4); - BinaryConverter.intToByteArray(offset, programParameterStructure, i * 10 + 6); - - offset += parameterMaxLength; - totalParameterLength += parameterMaxLength; - } - - // Set up the Parameter area. - byte[] programParameters = new byte[totalParameterLength]; - for (int i = 0, offset = 0; i < parameterList.length; ++i) - { - byte[] inputData = parameterList[i].getInputData(); - int parameterMaxLength = parameterList[i].getMaxLength(); - if (inputData != null) - { - System.arraycopy(inputData, 0, programParameters, offset, inputData.length); - } - offset += parameterMaxLength; - } - - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "Program name bytes:", programNameBuffer); - Trace.log(Trace.DIAGNOSTIC, "Program parameter bytes:", programParameterStructure); - Trace.log(Trace.DIAGNOSTIC, "Program parameters:", programParameters); - } - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - // Call native method. - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "Invoking native method."); - byte[] replyBytes = runProgramNative(programNameBuffer, programParameterStructure, programParameters); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Native reply bytes:", replyBytes); - - // Reset the message list. - messageList_ = new AS400Message[0]; - - // For each output/inout parm, in order, set data returned. - for (int index = 0, i = 0; i < parameterList.length; ++i) - { - int parameterMaxLength = parameterList[i].getMaxLength(); - int outputDataLength = parameterList[i].getOutputDataLength(); - if (outputDataLength > 0) - { - byte[] outputData = new byte[outputDataLength]; - System.arraycopy(replyBytes, index, outputData, 0, outputDataLength); - parameterList[i].setOutputData(outputData); - } - index += parameterMaxLength; - } - return true; - } - catch (NativeException e) // Exception found by C code. - { - messageList_ = RemoteCommandImplNative.parseMessages(e.data, converter_); - if (messageList_.length == 0) return false; - - // Parse information from byte array. - String id = messageList_[messageList_.length - 1].getID(); - - if (id.equals("MCH3401")) - { - byte[] substitutionBytes = messageList_[messageList_.length - 1].getSubstitutionData(); - if (substitutionBytes[0] == 0x02 && substitutionBytes[1] == 0x01 && name.equals(converter_.byteArrayToString(substitutionBytes, 2, 30).trim())) - { - throw new ObjectDoesNotExistException(QSYSObjectPathName.toPath(library, name, "PGM"), ObjectDoesNotExistException.OBJECT_DOES_NOT_EXIST); - } - if (substitutionBytes[0] == 0x04 && substitutionBytes[1] == 0x01 && library.equals(converter_.byteArrayToString(substitutionBytes, 2, 30).trim())) - { - throw new ObjectDoesNotExistException(QSYSObjectPathName.toPath(library, name, "PGM"), ObjectDoesNotExistException.LIBRARY_DOES_NOT_EXIST); - } - } - return false; - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - } - else - { - byte[] tempBytes = converter_.stringToByteArray(name); - byte[] nameBytes = new byte[tempBytes.length + 1]; - System.arraycopy(tempBytes, 0, nameBytes, 0, tempBytes.length); - tempBytes = converter_.stringToByteArray(library); - byte[] libraryBytes = new byte[tempBytes.length + 1]; - System.arraycopy(tempBytes, 0, libraryBytes, 0, tempBytes.length); - - byte[] offsetArray = new byte[parameterList.length * 4]; - int totalParameterLength = 0; - for (int i = 0; i < parameterList.length; ++i) - { - if (parameterList[i].getUsage() == ProgramParameter.NULL) - { - BinaryConverter.intToByteArray(-1, offsetArray, i * 4); - } - else - { - BinaryConverter.intToByteArray(totalParameterLength, offsetArray, i * 4); - } - totalParameterLength += parameterList[i].getMaxLength(); - } - - // Set up the Parameter area. - byte[] programParameters = new byte[totalParameterLength]; - for (int i = 0, offset = 0; i < parameterList.length; ++i) - { - byte[] inputData = parameterList[i].getInputData(); - if (inputData != null) - { - System.arraycopy(inputData, 0, programParameters, offset, inputData.length); - } - offset += parameterList[i].getMaxLength(); - } - - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "Program name bytes:", nameBytes); - Trace.log(Trace.DIAGNOSTIC, "Program library bytes:", libraryBytes); - Trace.log(Trace.DIAGNOSTIC, "Number of parameters:", parameterList.length); - Trace.log(Trace.DIAGNOSTIC, "Offset array:", offsetArray); - Trace.log(Trace.DIAGNOSTIC, "Program parameters:", programParameters); - } - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = system_.swapTo(swapToPH, swapFromPH); - try - { - // Call native method. - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "Invoking native method."); - byte[] replyBytes = AS400.nativeVRM.vrm_ < 0x00060100 ? runProgramNativeV5R3(nameBytes, libraryBytes, parameterList.length, offsetArray, programParameters, messageOption) : NativeMethods.runProgram(nameBytes, libraryBytes, parameterList.length, offsetArray, programParameters, messageOption); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Native reply bytes:", replyBytes); - - // Reset the message list. - messageList_ = new AS400Message[0]; - - // For each output/inout parm, in order, set data returned. - for (int index = 0, i = 0; i < parameterList.length; ++i) - { - int outputDataLength = parameterList[i].getOutputDataLength(); - if (outputDataLength > 0) - { - byte[] outputData = new byte[outputDataLength]; - System.arraycopy(replyBytes, index, outputData, 0, outputDataLength); - parameterList[i].setOutputData(outputData); - } - index += parameterList[i].getMaxLength(); - } - return true; - } - catch (NativeException e) // Exception found by C code. - { - messageList_ = RemoteCommandImplNative.parseMessagesV5R3(e.data, converter_); - if (messageList_.length == 0) return false; - - // Parse information from byte array. - String id = messageList_[messageList_.length - 1].getID(); - - if (id.equals("MCH3401")) - { - byte[] substitutionBytes = messageList_[messageList_.length - 1].getSubstitutionData(); - if (substitutionBytes[0] == 0x02 && substitutionBytes[1] == 0x01 && name.equals(converter_.byteArrayToString(substitutionBytes, 2, 30).trim())) - { - throw new ObjectDoesNotExistException(QSYSObjectPathName.toPath(library, name, "PGM"), ObjectDoesNotExistException.OBJECT_DOES_NOT_EXIST); - } - if (substitutionBytes[0] == 0x04 && substitutionBytes[1] == 0x01 && library.equals(converter_.byteArrayToString(substitutionBytes, 2, 30).trim())) - { - throw new ObjectDoesNotExistException(QSYSObjectPathName.toPath(library, name, "PGM"), ObjectDoesNotExistException.LIBRARY_DOES_NOT_EXIST); - } - } - return false; - } - finally - { - if (didSwap) system_.swapBack(swapToPH, swapFromPH); - } - } - } - - static AS400Message[] parseMessages(byte[] data, ConverterImplRemote converter) - { - int messageNumber = data.length / 10240; - AS400Message[] messageList = new AS400Message[messageNumber]; - - for (int offset = 0, i = 0; i < messageNumber; ++i) - { - messageList[i] = new AS400Message(); - messageList[i].setID(converter.byteArrayToString(data, offset + 12, 7)); - messageList[i].setType((data[offset + 19] & 0x0F) * 10 + (data[offset + 20] & 0x0F)); - messageList[i].setSeverity(BinaryConverter.byteArrayToInt(data, offset + 8)); - messageList[i].setFileName(converter.byteArrayToString(data, offset + 25, 10).trim()); - messageList[i].setLibraryName(converter.byteArrayToString(data, offset + 45, 10).trim()); - - int substitutionDataLength = BinaryConverter.byteArrayToInt(data, offset + 80); - int textLength = BinaryConverter.byteArrayToInt(data, offset + 88); - - byte[] substitutionData = new byte[substitutionDataLength]; - System.arraycopy(data, offset + 112, substitutionData, 0, substitutionDataLength); - messageList[i].setSubstitutionData(substitutionData); - - messageList[i].setText(converter.byteArrayToString(data, offset + 112 + substitutionDataLength, textLength)); - offset += 10240; - } - return messageList; - } - - static AS400Message[] parseMessagesV5R3(byte[] data, ConverterImplRemote converter) - { - int messageNumber = BinaryConverter.byteArrayToInt(data, 0); - AS400Message[] messageList = new AS400Message[messageNumber]; - - for (int offset = 4, i = 0; i < messageNumber; ++i) - { - messageList[i] = new AS400Message(); - messageList[i].setID(converter.byteArrayToString(data, offset + 12, 7)); - messageList[i].setType((data[offset + 19] & 0x0F) * 10 + (data[offset + 20] & 0x0F)); - messageList[i].setSeverity(BinaryConverter.byteArrayToInt(data, offset + 8)); - messageList[i].setFileName(converter.byteArrayToString(data, offset + 25, 10).trim()); - messageList[i].setLibraryName(converter.byteArrayToString(data, offset + 45, 10).trim()); - - int substitutionDataLength = BinaryConverter.byteArrayToInt(data, offset + 80); - int textLength = BinaryConverter.byteArrayToInt(data, offset + 88); - int helpLength = BinaryConverter.byteArrayToInt(data, offset + 96); - - byte[] substitutionData = new byte[substitutionDataLength]; - System.arraycopy(data, offset + 112, substitutionData, 0, substitutionDataLength); - messageList[i].setSubstitutionData(substitutionData); - - messageList[i].setText(converter.byteArrayToString(data, offset + 112 + substitutionDataLength, textLength)); - messageList[i].setHelp(converter.byteArrayToString(data, offset + 112 + substitutionDataLength + textLength, helpLength)); - - offset += BinaryConverter.byteArrayToInt(data, offset); - offset += BinaryConverter.byteArrayToInt(data, offset); - } - return messageList; - } - - - // Determines whether or not the command should be called on-thread. - private final boolean shouldRunOnThread(String command) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - boolean runOnThread; - - // Check the threadSafe property, and apply it if set. - String property = CommandCall.getThreadSafetyProperty(); - - if ((property == null) || (property.equals("false"))) { - runOnThread = false; - } - else if (property.equals("true")) { - runOnThread = true; - } - else if (property.equals("lookup")) { - // Look it up on the system. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "LOOKING-UP thread safety of command: " + command); - runOnThread = (getThreadsafeIndicator(command) == THREADSAFE_INDICATED_YES); - } - else { - runOnThread = false; - // Assume the utility method has logged a warning about unrecognized property value. - } - return runOnThread; - } - - private native byte[] runCommandNative(byte[] command) throws NativeException; - private static native byte[] runCommandNativeV5R3(byte[] command, int messageOption) throws NativeException; - private native byte[] runProgramNative(byte[] programNameBuffer, byte[] programParameterStructure, byte[] programParameters) throws NativeException; - private static native byte[] runProgramNativeV5R3(byte[] name, byte[] library, int numberParameters, byte[] offsetArray, byte[] programParameters, int messageOption) throws NativeException; -} diff --git a/cvsroot/src/com/ibm/as400/access/RemoteCommandImplProxy.java b/cvsroot/src/com/ibm/as400/access/RemoteCommandImplProxy.java deleted file mode 100644 index bb3e7be1a..000000000 --- a/cvsroot/src/com/ibm/as400/access/RemoteCommandImplProxy.java +++ /dev/null @@ -1,231 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RemoteCommandImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1999-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - -// The RemoteCommandImplProxy class is an implementation of the CommandCall and ProgramCall classes used on a client communicating with a proxy server. -class RemoteCommandImplProxy extends AbstractProxyImpl implements RemoteCommandImpl -{ - RemoteCommandImplProxy() - { - super("RemoteCommand"); - } - - // Get the job info from the proxy server. - public String getJobInfo(Boolean threadSafety) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - try - { - return (String)connection_.callMethod(pxId_, "getJobInfo", new Class[] { Boolean.class }, new Object[] { threadSafety }).getReturnValue (); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow4(e); - } - } - - // Report whether the RemoteCommandImpl object is a native object. - public boolean isNative() - { - return false; - } - - // Get the message list from the proxy server. - public AS400Message[] getMessageList() - { - try - { - return (AS400Message[])connection_.callMethod(pxId_, "getMessageList").getReturnValue(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - // Report whether the command is designated as threadsafe on the system. - public int getThreadsafeIndicator(String command) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - try - { - return connection_.callMethod(pxId_, "getThreadsafeIndicator", new Class[] { String.class }, new Object[] { command }).getReturnValueInt(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow4(e); - } - } - - // Run the command on the proxy server. - public boolean runCommand(String command) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - try - { - return connection_.callMethod(pxId_, "runCommand", new Class[] { String.class }, new Object[] { command }, true).getReturnValueBoolean(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow4(e); - } - } - - // Run the command on the proxy server. - public boolean runCommand(String command, Boolean threadSafety, int messageCount) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - try - { - return connection_.callMethod(pxId_, "runCommand", new Class[] { String.class, Boolean.class, Integer.TYPE }, new Object[] { command, threadSafety, new Integer(messageCount) }, true).getReturnValueBoolean(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow4(e); - } - } - - // Run the command on the proxy server. - public boolean runCommand(byte[] commandAsBytes, String commandAsString) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - try - { - return connection_.callMethod(pxId_, "runCommand", new Class[] { byte[].class, String.class }, new Object[] { commandAsBytes, commandAsString }, true).getReturnValueBoolean(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow4(e); - } - } - - // Run the command on the proxy server. - public boolean runCommand(byte[] command, Boolean threadSafety, int messageCount) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - try - { - return connection_.callMethod(pxId_, "runCommand", new Class[] { byte[].class, Boolean.class, Integer.TYPE }, new Object[] { command, threadSafety, new Integer(messageCount) }, true).getReturnValueBoolean(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow4(e); - } - } - - // Run the program on the proxy server. - public boolean runProgram(String library, String name, ProgramParameter[] parameterList) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - try - { - ProxyReturnValue rv = connection_.callMethod(pxId_, "runProgram", new Class[] { String.class, String.class, ProgramParameter[].class }, new Object[] { library, name, parameterList }, new boolean[] { false, false, true }, true); - ProgramParameter[] returnParmL = (ProgramParameter[])rv.getArgument(2); - for (int i = 0; i < parameterList.length; ++i) - { - parameterList[i].setOutputData(returnParmL[i].getOutputData()); - } - return rv.getReturnValueBoolean(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow5(e); - } - } - - // Run the program on the proxy server. - public boolean runProgram(String library, String name, ProgramParameter[] parameterList, Boolean threadSafety) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - try - { - ProxyReturnValue rv = connection_.callMethod(pxId_, "runProgram", new Class[] { String.class, String.class, ProgramParameter[].class, Boolean.class }, new Object[] { library, name, parameterList, threadSafety }, new boolean[] { false, false, true, false }, true); - ProgramParameter[] returnParmL = (ProgramParameter[])rv.getArgument(2); - for (int i = 0; i < parameterList.length; ++i) - { - parameterList[i].setOutputData(returnParmL[i].getOutputData()); - } - return rv.getReturnValueBoolean(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow5(e); - } - } - - // Run the program on the proxy server. - public boolean runProgram(String library, String name, ProgramParameter[] parameterList, Boolean threadSafety, int messageCount) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - try - { - ProxyReturnValue rv = connection_.callMethod(pxId_, "runProgram", new Class[] { String.class, String.class, ProgramParameter[].class, Boolean.class, Integer.TYPE }, new Object[] { library, name, parameterList, threadSafety, new Integer(messageCount) }, new boolean[] { false, false, true, false, false }, true); - ProgramParameter[] returnParmL = (ProgramParameter[])rv.getArgument(2); - for (int i = 0; i < parameterList.length; ++i) - { - parameterList[i].setOutputData(returnParmL[i].getOutputData()); - } - return rv.getReturnValueBoolean(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow5(e); - } - } - - // Run the service program on the proxy server. - public byte[] runServiceProgram(String library, String name, String procedureName, ProgramParameter[] parameterList) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - try - { - ProxyReturnValue rv = connection_.callMethod(pxId_, "runServiceProgram", new Class[] { String.class, String.class, String.class, ProgramParameter[].class }, new Object[] { library, name, procedureName, parameterList }, new boolean[] { false, false, false, true }, true); - ProgramParameter[] returnParmL = (ProgramParameter[])rv.getArgument(4); - for (int i = 0; i < parameterList.length; ++i) - { - parameterList[i].setOutputData(returnParmL[i].getOutputData()); - } - return (byte[])rv.getReturnValue(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow5(e); - } - } - - // Run the service program on the proxy server. - public byte[] runServiceProgram(String library, String name, String procedureName, int returnValueFormat, ProgramParameter[] parameterList, Boolean threadSafety, int procedureNameCCSID, int messageCount, boolean alignOn16Bytes) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - try - { - ProxyReturnValue rv = connection_.callMethod(pxId_, "runServiceProgram", new Class[] { String.class, String.class, String.class, Integer.TYPE, ProgramParameter[].class, Boolean.class, Integer.TYPE, Integer.TYPE, Boolean.TYPE }, new Object[] { library, name, procedureName, new Integer(returnValueFormat), parameterList, threadSafety, new Integer(procedureNameCCSID), new Integer(messageCount), new Boolean(alignOn16Bytes) }, new boolean[] { false, false, false, false, true, false, false, false, false }, true); - ProgramParameter[] returnParmL = (ProgramParameter[])rv.getArgument(4); - for (int i = 0; i < parameterList.length; ++i) - { - parameterList[i].setOutputData(returnParmL[i].getOutputData()); - } - return (byte[])rv.getReturnValue(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow5(e); - } - } - - // Set the AS400Impl into the proxy server. - public void setSystem(AS400Impl system) throws IOException - { - try - { - connection_.callMethod(pxId_, "setSystem", new Class[] { AS400Impl.class }, new Object[] { system }); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow1(e); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/RemoteCommandImplRemote.java b/cvsroot/src/com/ibm/as400/access/RemoteCommandImplRemote.java deleted file mode 100644 index b603c47dd..000000000 --- a/cvsroot/src/com/ibm/as400/access/RemoteCommandImplRemote.java +++ /dev/null @@ -1,842 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RemoteCommandImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2000-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.util.StringTokenizer; - -// The remote implementation of CommandCall and ProgramCall. -class RemoteCommandImplRemote implements RemoteCommandImpl -{ - private static final String CLASSNAME = "com.ibm.as400.access.RemoteCommandImplRemote"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - AS400ImplRemote system_; - ConverterImplRemote converter_; - ConverterImplRemote unicodeConverter_; - boolean ccsidIsUserOveride_ = false; // Flag to say don't override ccsid in open(). - private AS400Server server_; - AS400Message[] messageList_ = new AS400Message[0]; - int serverDataStreamLevel_ = 0; - // Flag for detecting when sequential calls switch between on-thread and off-thread. - protected Boolean priorCallWasOnThread_ = null; - - static - { - // Identify all remote command server reply data streams. - AS400Server.addReplyStream(new RCExchangeAttributesReplyDataStream(), AS400.COMMAND); - AS400Server.addReplyStream(new RCRunCommandReplyDataStream(), AS400.COMMAND); - AS400Server.addReplyStream(new RCCallProgramReplyDataStream(), AS400.COMMAND); - AS400Server.addReplyStream(new RCCallProgramFailureReplyDataStream(), AS400.COMMAND); - } - - // Report whether the RemoteCommandImpl object is a native object. - public boolean isNative() - { - return false; - } - - // Set needed impl properties. - public void setSystem(AS400Impl system) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting up remote command implementation object."); - system_ = (AS400ImplRemote)system; - // Check if user has set a ccsid we should use instead of the command server job CCSID. - int ccsid = system_.getUserOverrideCcsid(); - if (ccsid != 0) - { - // If the user override CCSID is 65535, disregard it, since that's not a "real" CCSID, and getConverter() will reject it. - if (ccsid == 65535) { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Disregarding specified user override CCSID: 65535"); - } - else { - converter_ = ConverterImplRemote.getConverter(ccsid, system_); - ccsidIsUserOveride_ = true; - } - } - } - - // Returns information about the job in which the command/program would be run. - // @param threadSafety The assumed thread safety of the command/program. - // @return Information about the job in which the command/program would be run. This is a String consisting of a 10-character simple job name, a 10-character user name, and a 6-character job number. - public String getJobInfo(Boolean threadSafety) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting job information from implementation object."); - - // Note: The runProgram() method that we call below, will call the appropriate open() method. - - // Set up the parameter list for the program that we will use to get the job information (QWCRTVCA). - ProgramParameter[] parameterList = new ProgramParameter[6]; - - // First parameter: receiver variable - output - char(*). - // RTVC0100's 20-byte header, plus 26 bytes for "job name" field. - byte[] dataReceived = new byte[46]; - parameterList[0] = new ProgramParameter(dataReceived.length); - - // Second parameter: length of receiver variable - input - binary(4). - byte[] receiverLength = BinaryConverter.intToByteArray(dataReceived.length); - parameterList[1] = new ProgramParameter(receiverLength); - - // Third parameter: format name - input - char(8). - // Set to EBCDIC "RTVC0100". - byte[] formatName = {(byte)0xD9, (byte)0xE3, (byte)0xE5, (byte)0xC3, (byte)0xF0, (byte)0xF1, (byte)0xF0, (byte)0xF0}; - parameterList[2] = new ProgramParameter(formatName); - - // Fourth parameter: number of attributes to return - input - binary(4). - byte[] numAttributes = BinaryConverter.intToByteArray(1); // 1 attribute. - parameterList[3] = new ProgramParameter(numAttributes); - - // Fifth parameter: key of attributes to be returned - input - array(*) of binary(4). - byte[] attributeKey = BinaryConverter.intToByteArray(1009); // "Job name." - parameterList[4] = new ProgramParameter(attributeKey); - - // Sixth parameter: error code - input/output - char(*). - // Eight bytes of zero's indicates to throw exceptions. - // Send as input because we are not interested in the output. - parameterList[5] = new ProgramParameter(new byte[8]); - - // Prepare to call the "Retrieve Current Attributes" API. - // Design note: QWCRTVCA is documented to be conditionally threadsafe. - - // Note: Depending upon whether the program represented by this ProgramCall object will be run on-thread or through the host servers (as indicated by the 'threadsafety' flag), we will issue the job info query accordingly, either on-thread or through the host servers, in order to get the appropriate Job. - - // Retrieve Current Attributes. Failure is returned as a message list. - try - { - boolean succeeded; - if (ON_THREAD.equals(threadSafety)) { - succeeded = runProgramOnThread("QSYS", "QWCRTVCA", parameterList, MESSAGE_OPTION_DEFAULT, false); - } - else { - succeeded = runProgramOffThread("QSYS", "QWCRTVCA", parameterList, MESSAGE_OPTION_DEFAULT); - } - if (!succeeded) - { - Trace.log(Trace.ERROR, "Unable to retrieve job information."); - throw new AS400Exception(messageList_); - } - } - catch (ObjectDoesNotExistException e) - { - Trace.log(Trace.ERROR, "Unexpected ObjectDoesNotExistException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - - // Get the data returned from the program. - dataReceived = parameterList[0].getOutputData(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Job information retrieved:", dataReceived); - - // Examine the "job name" field. 26 bytes starting at offset 20. The format of the job name is a 10-character simple job name, a 10-character user name, and a 6-character job number. - return converter_.byteArrayToString(dataReceived, 20, 26); - } - - // Return message list to public object. - public AS400Message[] getMessageList() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting message list from implementation object."); - return messageList_; - } - - // Return the value of the command's Threadsafe Indicator attribute, as designated on the system. - // @return Either THREADSAFE_INDICATED_YES, THREADSAFE_INDICATED_NO, or THREADSAFE_INDICATED_CONDITIONAL. - public int getThreadsafeIndicator(String command) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving command Threadsafe indicator."); - int threadsafeIndicator; - openOnThread(); // The QCDRCMDI API is itself threadsafe. - - // Isolate out the command name from the argument(s), as the first token. - StringTokenizer tokenizer = new StringTokenizer(command); - String cmdLibAndName = tokenizer.nextToken().toUpperCase(); - String libName; - String cmdName; - // If there's a slash, parse out the library/commandName. - int slashPos = cmdLibAndName.indexOf('/'); - if (slashPos == -1) // No slash. - { - libName = "*LIBL"; - cmdName = cmdLibAndName; - } - else - { - libName = cmdLibAndName.substring(0, slashPos); - cmdName = cmdLibAndName.substring(slashPos + 1); - } - - // Fill the commandname array with blanks. - byte[] commandName = {(byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40}; - // The first 10 characters contain the name of the command. - converter_.stringToByteArray(cmdName, commandName); - // The second 10 characters contain the name of the library where the command is located. - converter_.stringToByteArray(libName, commandName, 10); - - // Set up the parameter list for the program that we will use to retrieve the command information (QCDRCMDI). - - // First parameter: receiver variable - output - char(*). - // Second parameter: length of receiver variable - input - binary(4). - // Third parameter: format name - input - char(8). - // Set to EBCDIC "CMDI0100". - // Fourth parameter: qualified command name - input - char(20). - // Fifth parameter: error code - input/output - char(*). - // Eight bytes of zero's indicates to throw exceptions. - // Send as input because we are not interested in the output. - // Sixth parameter: optional - follow proxy chain - input - char(1) //@A1A - // Set to 1 - If the specified command is a proxy command, follow the proxy command //@A1A - // chain to the target non-proxy command and retrieve information for the target command. //@A1A - // If the command is not a proxy command, retrieve information for the specified command. //@A1A - - int numParms; - if ((AS400.nativeVRM.vrm_ >= 0x00060100) || - (AS400.nativeVRM.vrm_ >= 0x00050400 && !system_.isMissingPTF())) { - numParms = 6; // @A1C - added support for proxy commands - } - else numParms = 5; - - ProgramParameter[] parameterList = new ProgramParameter[numParms]; - parameterList[0] = new ProgramParameter(350); - parameterList[1] = new ProgramParameter(new byte[] { 0x00, 0x00, 0x01, 0x5e }); - parameterList[2] = new ProgramParameter(new byte[] { (byte) 0xC3, (byte) 0xD4, (byte) 0xC4, (byte) 0xC9, (byte) 0xF0, (byte) 0xF1, (byte) 0xF0, (byte) 0xF0 }); - parameterList[3] = new ProgramParameter(commandName); - parameterList[4] = new ProgramParameter(new byte[8]); - if (numParms > 5) //@A1A - parameterList[5] = new ProgramParameter(new byte[] { (byte) 0xF1 }); //@A1A - - try - { - // Retrieve command information. Failure is indicated as a message list. - boolean succeeded = runProgramOnThread("QSYS", "QCDRCMDI", parameterList, MESSAGE_OPTION_DEFAULT, true); - if (!succeeded) - { - // If the exception is "MCH0802: Total parameters passed does not match number required" and we're running to V5R4, that means that the user hasn't applied PTF SI29629. In that case, we will re-issue the program call, minus the new "follow proxy chain" parameter. - if (numParms > 5 && - AS400.nativeVRM.vrm_ < 0x00060100 && AS400.nativeVRM.vrm_ >= 0x00050400 && - messageList_[messageList_.length - 1].getID().equals("MCH0802")) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "PTF SI29629 is not installed: (MCH0802) " + messageList_[messageList_.length - 1].getText()); - // Retain result, to avoid repeated 6-parm attempts for same system object. - system_.setMissingPTF(); - ProgramParameter[] shorterParmList = new ProgramParameter[5]; - System.arraycopy(parameterList, 0, shorterParmList, 0, 5); - succeeded = runProgramOnThread("QSYS", "QCDRCMDI", shorterParmList, MESSAGE_OPTION_DEFAULT, true); - } - if (!succeeded) - { - Trace.log(Trace.ERROR, "Unable to retrieve command information."); - String id = messageList_[messageList_.length - 1].getID(); - byte[] substitutionBytes = messageList_[messageList_.length - 1].getSubstitutionData(); - - // CPF9801 - Object &2 in library &3 not found. - if (id.equals("CPF9801") && cmdName.equals(converter_.byteArrayToString(substitutionBytes, 0, 10).trim()) && libName.equals(converter_.byteArrayToString(substitutionBytes, 10, 10).trim()) && "CMD".equals(converter_.byteArrayToString(substitutionBytes, 20, 7).trim())) - { - Trace.log(Trace.WARNING, "Command not found."); - return THREADSAFE_INDICATED_NO; // If cmd doesn't exist, say it's not threadsafe. - } - // CPF9810 - Library &1 not found. - if (id.equals("CPF9810") && libName.equals(converter_.byteArrayToString(substitutionBytes).trim())) - { - Trace.log(Trace.WARNING, "Command library not found."); - return THREADSAFE_INDICATED_NO; // If cmd doesn't exist, say it's not threadsafe. - } - else throw new AS400Exception(messageList_); - } - } - } - catch (ObjectDoesNotExistException e) - { - Trace.log(Trace.ERROR, "Unexpected ObjectDoesNotExistException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - - // Get the output data from the program. - byte[] dataReceived = parameterList[0].getOutputData(); - if (Trace.traceOn_) - { - Trace.log(Trace.DIAGNOSTIC, "Command information retrieved:", dataReceived); - - // Examine the "multithreaded job action" field. - // The "multithreaded job action" field is a single byte at offset 334. - // Multithreaded job action. The action to take when a command that is not threadsafe is called in a multithreaded job. The possible values are: - // 0 Use the action specified in QMLTTHDACN system value. - // 1 Run the command. Do not send a message. - // 2 Send an informational message and run the command. - // 3 Send an escape message, and do not run the command. - // System value . . . . . : QMLTTHDACN - // Description . . . . . : Multithreaded job action - // Interpretation: - // 1 Perform the function that is not threadsafe without sending a message. - // 2 Perform the function that is not threadsafe and send an informational message. - // 3 Do not perform the function that is not threadsafe. - Trace.log(Trace.DIAGNOSTIC, "Multithreaded job action: " + (dataReceived[334] & 0x0F)); - } - - // Examine the "threadsafe indicator" field. - // The "threadsafe indicator" field is a single byte at offset 333. - // Threadsafe indicator: Whether the command can be used safely in a multithreaded job. - // The possible values are: - // 0 The command is not threadsafe and should not be used in a multithreaded job. - // 1 The command is threadsafe and can be used safely in a multithreaded job. - // 2 The command is threadsafe under certain conditions. See the documentation for the command to determine the conditions under which the command can be used safely in a multithreaded job. - - int fieldValue = dataReceived[333] & 0x0F; // the "threadsafe indicator" field - switch (fieldValue) - { - case 0: - threadsafeIndicator = THREADSAFE_INDICATED_NO; - break; - case 1: - threadsafeIndicator = THREADSAFE_INDICATED_YES; - break; - case 2: - threadsafeIndicator = THREADSAFE_INDICATED_CONDITIONAL; - break; - default: - threadsafeIndicator = THREADSAFE_INDICATED_NO; - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Unrecognized threadsafe indicator value reported by QCDRCMDI:", fieldValue); - } - if (Trace.traceOn_) { - Trace.log(Trace.DIAGNOSTIC, "Threadsafe indicator:", threadsafeIndicator); - } - return threadsafeIndicator; - } - - // Connects to the server. - // The ImplNative class overrides this method. - // @param threadSafety The assumed thread safety of the command/program. - protected void open(Boolean threadSafety) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - // The ImplRemote class only knows how to call commands/programs off-thread. - openOffThread(); - } - - // Connects to the server. - protected void openOffThread() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Remote implementation object open."); - // Connect to server. - // Note: We can't skip this block if (server_ != null), since the server may have become disconnected since we last used it; in which case it would need to be reconnected. - server_ = system_.getConnection(AS400.COMMAND, false); - - // Exchange attributes with server job. (This must be first exchange with server job to complete initialization.) First check to see if server has already been initialized by another user. - synchronized (server_) // Close the window between getting and checking if exchange has been done. - { - DataStream baseReply = server_.getExchangeAttrReply(); - if (baseReply == null) - { - try - { - baseReply = server_.sendExchangeAttrRequest(new RCExchangeAttributesRequestDataStream(system_.getNLV())); - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "IOException during exchange attributes:", e); - disconnectServer(); - throw e; - } - - if (!(baseReply instanceof RCExchangeAttributesReplyDataStream)) - { - // Unknown data stream. - Trace.log(Trace.ERROR, "Unknown exchange attributes reply datastream:", baseReply.data_); - disconnectServer(); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - - processReturnCode(((RCExchangeAttributesReplyDataStream)baseReply).getRC()); - } - - RCExchangeAttributesReplyDataStream reply = (RCExchangeAttributesReplyDataStream)baseReply; - // If converter was not set with an AS400 user override ccsid, set converter to command server job ccsid. - if (!ccsidIsUserOveride_) - { - converter_ = ConverterImplRemote.getConverter(reply.getCCSID(), system_); - } - serverDataStreamLevel_ = reply.getDSLevel(); - if (serverDataStreamLevel_ >= 10) - { - unicodeConverter_ = ConverterImplRemote.getConverter(1200, system_); - } - } - } - - // The ImplNative class overrides this method. - protected void openOnThread() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - // The ImplRemote class only knows how to call commands/programs off-thread. - openOffThread(); - } - - - // This method is reserved for use by other ImplRemote classes in this package. - // The ImplNative class overrides this method. - public boolean runCommand(String command) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - // The ImplRemote class only knows how to call commands/programs off-thread. - return runCommandOffThread(command, MESSAGE_OPTION_DEFAULT); // defaults - } - - - // @param threadSafety The assumed thread safety of the command/program. - // The "threadSafety" parameter is disregarded in the ImplRemote implementation of this method. - public boolean runCommand(String command, Boolean threadSafety, int messageOption) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - return runCommandOffThread(command, messageOption); - } - - - // @param threadSafety The assumed thread safety of the command/program. - // The "threadSafety" parameter is disregarded in the ImplRemote implementation of this method. - protected boolean runCommandOffThread(String command, int messageOption) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - if (Trace.traceOn_) - { - Trace.log(Trace.INFORMATION, "Remote implementation running command: " + command); - Trace.log(Trace.DIAGNOSTIC, "Running command OFF-THREAD: " + command); - } - - // Connect to server. - openOffThread(); - - if (serverDataStreamLevel_ >= 10) - { - return runCommandOffThread(unicodeConverter_.stringToByteArray(command), messageOption, 1200); - } - return runCommandOffThread(converter_.stringToByteArray(command), messageOption, 0); - } - - // @param commandAsBytes The command to be executed, as a sequence of EBCDIC bytes - // @param commandAsString The command to be executed, as a String. This parameter is used by the ImplNative if it needs to lookup the command's threadsafety. - public boolean runCommand(byte[] commandAsBytes, String commandAsString) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "Remote implementation running command: " + commandAsString); - - // Since we don't need to lookup threadsafety, we can ignore commandAsString. - return runCommandOffThread(commandAsBytes, MESSAGE_OPTION_DEFAULT, 0); - } - - - // @param threadSafety The assumed thread safety of the command/program. - // The "threadSafety" parameter is disregarded in the ImplRemote implementation of this method. - public boolean runCommand(byte[] command, Boolean threadSafety, int messageOption) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - return runCommandOffThread(command, messageOption, 0); - } - - protected boolean runCommandOffThread(byte[] command, int messageOption, int ccsid) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - if (ON_THREAD.equals(priorCallWasOnThread_)) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Prior call was on-thread, but this call is off-thread, so different job."); - } - priorCallWasOnThread_ = OFF_THREAD; - - // Connect to server. - openOffThread(); - - try - { - // Create and send request. - DataStream baseReply = server_.sendAndReceive(new RCRunCommandRequestDataStream(command, serverDataStreamLevel_, messageOption, ccsid)); - - // Punt if unknown data stream. - if (!(baseReply instanceof RCRunCommandReplyDataStream)) - { - Trace.log(Trace.ERROR, "Unknown run command reply datastream:", baseReply.data_); - disconnectServer(); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - - RCRunCommandReplyDataStream reply = (RCRunCommandReplyDataStream)baseReply; - - // Get info from reply. - messageList_ = reply.getMessageList(converter_); - int rc = reply.getRC(); - processReturnCode(rc); - - return rc == 0; - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Lost connection to remote command server:", e); - disconnectServer(); - throw e; - } - } - - // The ImplNative class overrides this method. - public boolean runProgram(String library, String name, ProgramParameter[] parameterList) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - // The ImplRemote class only knows how to call commands/programs off-thread. - return runProgramOffThread(library, name, parameterList, MESSAGE_OPTION_DEFAULT); - } - - // The ImplNative class overrides this method. - public boolean runProgram(String library, String name, ProgramParameter[] parameterList, Boolean threadSafety) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - // The ImplRemote class only knows how to call commands/programs off-thread. - return runProgramOffThread(library, name, parameterList, MESSAGE_OPTION_DEFAULT); - } - - // The ImplNative class overrides this method. - public boolean runProgram(String library, String name, ProgramParameter[] parameterList, Boolean threadSafety, int messageOption) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - // The ImplRemote class only knows how to call commands/programs off-thread. - return runProgramOffThread(library, name, parameterList, messageOption); - } - - // The ImplNative class overrides this method. - protected boolean runProgramOnThread(String library, String name, ProgramParameter[] parameterList, int messageOption, boolean currentlyOpeningOnThisThread) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - // The ImplRemote class only knows how to call commands/programs off-thread. - return runProgramOffThread(library, name, parameterList, messageOption); - } - - protected boolean runProgramOffThread(String library, String name, ProgramParameter[] parameterList, int messageOption) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) - { - Trace.log(Trace.INFORMATION, "Remote implementation running program: " + library + "/" + name); - Trace.log(Trace.DIAGNOSTIC, "Running program OFF-THREAD: " + library + "/" + name); - } - - if (ON_THREAD.equals(priorCallWasOnThread_)) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Prior call was on-thread, but this call is off-thread, so different job."); - } - priorCallWasOnThread_ = OFF_THREAD; - - // Connect to server. - openOffThread(); - - // Run program on server - try - { - // Create and send request. - DataStream baseReply = server_.sendAndReceive(new RCCallProgramRequestDataStream(library, name, parameterList, converter_, serverDataStreamLevel_, messageOption)); - - // Punt if unknown data stream. - if (!(baseReply instanceof RCCallProgramReplyDataStream)) - { - Trace.log(Trace.ERROR, "Unknown run program reply datastream ", baseReply.data_); - disconnectServer(); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - - RCCallProgramReplyDataStream reply = (RCCallProgramReplyDataStream)baseReply; - - // Check for error code returned. - int rc = reply.getRC(); - processReturnCode(rc); - if (rc == 0) - { - // Set the output data into parameter list. - reply.getParameterList(parameterList); - messageList_ = new AS400Message[0]; - return true; - } - messageList_ = reply.getMessageList(converter_); - if (rc == 0x0500 && messageList_.length != 0) - { - String id = messageList_[messageList_.length - 1].getID(); - - if (id.equals("MCH3401")) - { - byte[] substitutionBytes = messageList_[messageList_.length - 1].getSubstitutionData(); - if (substitutionBytes[0] == 0x02 && substitutionBytes[1] == 0x01 && name.equals(converter_.byteArrayToString(substitutionBytes, 2, 30).trim())) - { - throw new ObjectDoesNotExistException(QSYSObjectPathName.toPath(library, name, "PGM"), ObjectDoesNotExistException.OBJECT_DOES_NOT_EXIST); - } - if (substitutionBytes[0] == 0x04 && substitutionBytes[1] == 0x01 && library.equals(converter_.byteArrayToString(substitutionBytes, 2, 30).trim())) - { - throw new ObjectDoesNotExistException(QSYSObjectPathName.toPath(library, name, "PGM"), ObjectDoesNotExistException.LIBRARY_DOES_NOT_EXIST); - } - } - } - return false; - } - catch (IOException e) - { - Trace.log(Trace.ERROR, "Lost connection to remote command server:", e); - disconnectServer(); - throw e; - } - } - - public byte[] runServiceProgram(String library, String name, String procedureName, ProgramParameter[] serviceParameterList) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - return runServiceProgram(library, name, procedureName, ServiceProgramCall.RETURN_INTEGER_AND_ERRNO, serviceParameterList, ProgramCall.getDefaultThreadSafety(), 37, AS400Message.MESSAGE_OPTION_UP_TO_10, false); - } - - public byte[] runServiceProgram(String library, String name, String procedureName, int returnValueFormat, ProgramParameter[] serviceParameterList, Boolean threadSafety, int procedureNameCCSID, int messageOption, boolean alignOn16Bytes) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "Remote implementation running service program: " + library + "/" + name + " procedure name: " + procedureName); - - // Connect to server. - open(threadSafety); - - // Set up the parameter list for the program that we will use to call the service program (QZRUCLSP). - ProgramParameter[] programParameterList = new ProgramParameter[7 + serviceParameterList.length]; - - // First parameter: qualified service program name - input - char(20). - byte[] serviceProgramBytes = new byte[20]; - // Blank fill service program name and library name. - for (int i = 0; i < 20; ++i) - { - serviceProgramBytes[i] = (byte)0x40; - } - converter_.stringToByteArray(name, serviceProgramBytes, 0); - converter_.stringToByteArray(library, serviceProgramBytes, 10); - programParameterList[0] = new ProgramParameter(serviceProgramBytes); - - // Second parameter: export name - input - char(*). - ConverterImplRemote procedureNameConverter = ConverterImplRemote.getConverter(procedureNameCCSID, system_); - byte[] procedureNameBytesUnterminated = procedureNameConverter.stringToByteArray(procedureName); - // Add a null terminator to the end. - byte[] procedureNameBytes = new byte[procedureNameBytesUnterminated.length + 1]; - System.arraycopy(procedureNameBytesUnterminated, 0, procedureNameBytes, 0, procedureNameBytesUnterminated.length); - programParameterList[1] = new ProgramParameter(procedureNameBytes); - - // Third parameter: return value format - input - binary(4). - byte[] returnValueFormatBytes = new byte[4]; - BinaryConverter.intToByteArray(returnValueFormat, returnValueFormatBytes, 0); - programParameterList[2] = new ProgramParameter(returnValueFormatBytes); - - // Fourth parameter: parameter formats - input - array(*) of binary(4). - byte[] parameterFormatBytes = new byte[serviceParameterList.length * 4]; - for (int i = 0; i < serviceParameterList.length; ++i) - { - int parameterType = serviceParameterList[i].getParameterType(); - if (serverDataStreamLevel_ < 6 && serviceParameterList[i].getUsage() == ProgramParameter.NULL) - { - // Server does not allow null parameters. - parameterType = ProgramParameter.PASS_BY_VALUE; - } - BinaryConverter.intToByteArray(parameterType, parameterFormatBytes, i * 4); - } - programParameterList[3] = new ProgramParameter(parameterFormatBytes); - - // Fifth parameter: number of parameters - input - binary(4). - byte[] parameterNumberBytes = new byte[4]; - BinaryConverter.intToByteArray(serviceParameterList.length, parameterNumberBytes, 0); - programParameterList[4] = new ProgramParameter(parameterNumberBytes); - - // Sixth parameter: error code - input/output - char(*). - // Eight bytes of zero's indicates to throw exceptions. - // Send as input because we are not interested in the output. - - // Note: Some service programs (such as QjoRetrieveJournalEntries) - // require that the receiver variable be aligned on a 16-byte boundary. - // Therefore, if data will be returned, we may need to pad - // the "error code" parameter with extra bytes, so that the - // parameter after the "Return Value" parameter starts on - // a 16-byte boundary. - int errorCodeParmLength = 8; // length of Error Code parm - int returnValueParmLength = ((returnValueFormat == ServiceProgramCall.NO_RETURN_VALUE) ? 4 : 8); // length of Return Value parm - if (alignOn16Bytes && serviceParameterList.length != 0) - { - int parmsByteCount = 0; // total number of bytes occupied by parms - parmsByteCount += serviceProgramBytes.length; // 1: Svc Pgm Name - parmsByteCount += procedureNameBytes.length; // 2: Export Name - parmsByteCount += returnValueFormatBytes.length;// 3: Return Value Format - parmsByteCount += parameterFormatBytes.length; // 4: Parm Formats - parmsByteCount += parameterNumberBytes.length; // 5: Number of Parms - parmsByteCount += errorCodeParmLength; // 6: Error Code - parmsByteCount += returnValueParmLength; // 7: Return Value - // Calculate number of bytes we're beyond a 16-byte boundary. - int remainder = parmsByteCount % 16; - if (remainder != 0) - { - // Pad the "error code" parm so that we get to a 16-byte boundary. - errorCodeParmLength += (16 - remainder); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "To achieve 16-byte alignment, padding 'error code' parameter to length " + errorCodeParmLength); - } - } - programParameterList[5] = new ProgramParameter(errorCodeParmLength); - - // Seventh parameter: return value - output - char(*). - // Define the return value length. Even though the service program returns void, the API middle-man we call (QZRUCLSP) still returns four bytes. If we don't get this right the output buffers will be off by four bytes, corrupting data. - programParameterList[6] = new ProgramParameter(returnValueParmLength); - - // Combines the newly created programParameterList with the value of serviceParameterList input by user to form the perfect parameter list that will be needed in the method runProgram. - System.arraycopy(serviceParameterList, 0, programParameterList, 7, serviceParameterList.length); - - // Note: Depending upon whether the program represented by this ProgramCall object will be run on-thread or through the host servers, we will issue the service program call request accordingly, either on-thread or through the host servers. - // Design note: The QZRUCLSP API itself is not documented to be threadsafe. - boolean succeeded = runProgram("QSYS", "QZRUCLSP", programParameterList, threadSafety, messageOption); - if (!succeeded) - { - return null; - } - return programParameterList[6].getOutputData(); - } - - // Processes the return code received from the server and throws the appropriate exception. - // @param rc The server return code. - // @exception ErrorCompletingRequestException If an error occurs before the request is completed. - private void processReturnCode(int rc) throws ErrorCompletingRequestException - { - if (Trace.traceOn_) - { - byte[] rcBytes = new byte[2]; - BinaryConverter.unsignedShortToByteArray(rc, rcBytes, 0); - Trace.log(Trace.DIAGNOSTIC, "Remote command server return code:", rcBytes); - } - switch (rc) - { - // The following is the list of return codes the RMTCMD/RMTPGMCALL server sends to the client application in the request replies: - case 0x0000: // Request processed successfully. - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "Request processed successfully."); - return; - - // Initial allocate & exchange attribute return codes: - case 0x0100: // Limited user. - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Limited user."); - return; - case 0x0101: // Invalid exchange attributes request. - Trace.log(Trace.ERROR, "Exchange attributes request not valid."); - disconnectServer(); - throw new InternalErrorException(InternalErrorException.SYNTAX_ERROR); - case 0x0102: // Invalid datastream level. - Trace.log(Trace.ERROR, "Datastream level not valid."); - disconnectServer(); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_LEVEL_NOT_VALID); - case 0x0103: // Invalid version. - Trace.log(Trace.ERROR, "Version not valid."); - disconnectServer(); - throw new InternalErrorException(InternalErrorException.VRM_NOT_VALID); - - case 0x0104: // Invalid CCSID. - if (Trace.traceOn_) Trace.log(Trace.WARNING, "CCSID not valid."); - return; - case 0x0105: // Invalid NLV, default to primary NLV: NLV must consist of the characters 0-9. - if (Trace.traceOn_) Trace.log(Trace.WARNING, "NLV not valid"); - return; - case 0x0106: // NLV not installed, default to primary NLV: The NLV may not be supported or it may not be installed on the system. - if (Trace.traceOn_) Trace.log(Trace.WARNING, "NLV not installed."); - return; - case 0x0107: // Error retrieving product information. Can't validate NLV. - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Error retrieving product information, cannot validate NLV."); - return; - case 0x0108: // Error trying to add NLV library to system library list: One possible reason for failure is the user may not be authorized to CHGSYSLIBL command. - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Error adding NLV library to system library list."); - return; - - // Return codes for all requests: These are return codes that can result from processing any type of requests (exchange attributes, RMTCMD, RMTPGMCALL, & end). - case 0x0200: // Unable to process request. An error occured on the receive data. - case 0x0201: // Invalid LL. - case 0x0202: // Invalid server ID. - case 0x0203: // Incomplete data. - case 0x0205: // Invalid request ID. - Trace.log(Trace.ERROR, "Datastream not valid."); - disconnectServer(); - throw new InternalErrorException(InternalErrorException.SYNTAX_ERROR); - case 0x0204: // Host resource error. - Trace.log(Trace.ERROR, "Host Resource error."); - disconnectServer(); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.AS400_ERROR); - - // Return codes common to RMTCMD & RMTPGMCALL requests: - case 0x0300: // Process exit point error. Error occurred when trying to retrieve the exit point for user exit program processing. This can occur when the user exit program cannot be resolved. - Trace.log(Trace.ERROR, "Process exit point error."); - disconnectServer(); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.EXIT_POINT_PROCESSING_ERROR); - case 0x0301: // Invalid request. The request data stream did not match what was required for the specified request. - case 0x0302: // Invalid parameter. - Trace.log(Trace.ERROR, "Request not valid."); - disconnectServer(); - throw new InternalErrorException(InternalErrorException.SYNTAX_ERROR); - case 0x0303: // Maximum exceeded. For RMTCMD, the maximum command length was exceeded and for RMTPGMCALL, the maximum number of parameters was exceeded. - Trace.log(Trace.ERROR, "Maximum exceeded."); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.LENGTH_NOT_VALID); - case 0x0304: // An error occured when calling the user exit program. - Trace.log(Trace.ERROR, "Error calling exit program."); - disconnectServer(); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.EXIT_PROGRAM_CALL_ERROR); - case 0x0305: // User exit program denied the request. - Trace.log(Trace.ERROR, "Exit program denied request."); - disconnectServer(); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.EXIT_PROGRAM_DENIED_REQUEST); - - // RMTCMD specific return codes: - case 0x0400: // Command failed. Messages returned. - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "Error calling the command."); - return; - case 0x0401: // Invalid CCSID value. - Trace.log(Trace.ERROR, "CCSID not valid."); - throw new InternalErrorException(InternalErrorException.SYNTAX_ERROR); - - // RMTPGMCALL specific return codes: - case 0x0500: // An error occured when resolving to the program to call. - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Could not resolve program."); - return; - case 0x0501: // An error occured when calling the program. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Error calling the program."); - return; - - default: - Trace.log(Trace.ERROR, "Return code unknown."); - disconnectServer(); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_RETURN_CODE); - } - } - - // Disconnects the server, and swallows any exceptions. - private void disconnectServer() - { - try { system_.disconnectServer(server_); } - catch (Throwable e) { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Exception while attempting to disconnect the server:", e); - } - } - - // Parses the messages returned from the command call or program call. - static AS400Message[] parseMessages(byte[] data, ConverterImplRemote converter) throws IOException - { - int messageNumber = BinaryConverter.byteArrayToUnsignedShort(data, 22); - AS400Message[] messageList = new AS400Message[messageNumber]; - - for (int offset = 24, i = 0; i < messageNumber; ++i) - { - if (data[offset + 5] == 0x06) - { - messageList[i] = AS400ImplRemote.parseMessage(data, offset + 6, converter); - } - else - { - messageList[i] = new AS400Message(); - messageList[i].setID(converter.byteArrayToString(data, offset + 6, 7)); - messageList[i].setType((data[offset + 13] & 0x0F) * 10 + (data[offset + 14] & 0x0F)); - messageList[i].setSeverity(BinaryConverter.byteArrayToUnsignedShort(data, offset + 15)); - messageList[i].setFileName(converter.byteArrayToString(data, offset + 17, 10).trim()); - messageList[i].setLibraryName(converter.byteArrayToString(data, offset + 27, 10).trim()); - - int substitutionDataLength = BinaryConverter.byteArrayToUnsignedShort(data, offset + 37); - int textLength = BinaryConverter.byteArrayToUnsignedShort(data, offset + 39); - - byte[] substitutionData = new byte[substitutionDataLength]; - System.arraycopy(data, offset + 41, substitutionData, 0, substitutionDataLength); - messageList[i].setSubstitutionData(substitutionData); - messageList[i].setSubstitutionDataCcsid(converter.getCcsid()); - - messageList[i].setText(converter.byteArrayToString(data, offset + 41 + substitutionDataLength, textLength)); - messageList[i].setTextCcsid(converter.getCcsid()); - } - offset += BinaryConverter.byteArrayToInt(data, offset); - } - - return messageList; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/RequestNotSupportedException.java b/cvsroot/src/com/ibm/as400/access/RequestNotSupportedException.java deleted file mode 100644 index 86280ce99..000000000 --- a/cvsroot/src/com/ibm/as400/access/RequestNotSupportedException.java +++ /dev/null @@ -1,107 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RequestNotSupportedException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - - -package com.ibm.as400.access; - - -/** - The RequestNotSupportedException class represents an exception - that indicates that the requested function is not supported - because the system is not at the correct level. -**/ -public class RequestNotSupportedException extends Exception - implements ReturnCodeException -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - private int rc_; // Return code associated with this exception - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - - - // Return code values used by this class. - // If a value is added here, it must also be added to MRI.properties. - - - /** - The return code indicating that - the requested function is not supported due to the - system level not being correct. - **/ - public static final int SYSTEM_LEVEL_NOT_CORRECT = 1; - - - - - - /** - Constructs a RequestNotSupportedException object. It indicates - that the requested function is not supported due to the system - level not being correct. This constructor should be used when - the required system level is known. - Exception message will look like this: V2R1M0: Correct system level is required. - @param requiredLevel The required system level. This needs to be in the - format VvRrMm where v is the version, r is the release - and m is the modification. - @param returnCode The return code which identifies the message to be returned. - **/ - RequestNotSupportedException(String requiredLevel, int returnCode) - { - // Create the message - super(requiredLevel + ": " + loader_.getText(getMRIKey(returnCode))); - rc_ = returnCode; - } - - - - /** - Returns the text associated with the return code. - @param returnCode The return code associated with this exception. - @return The text string which describes the error. - **/ - // This method is required so the message can be created and sent in super() - static String getMRIKey (int returnCode) - { - switch(returnCode) - { - case SYSTEM_LEVEL_NOT_CORRECT : - return "EXC_SYSTEM_LEVEL_NOT_CORRECT"; - default: - return "EXC_UNKNOWN"; // Bad return code was provided. - } - } - - - - /** - Returns the return code associated with this exception. - @return The return code. - **/ - public int getReturnCode () - { - return rc_; - } - - - - - - - } // End of RequestNotSupportedException class diff --git a/cvsroot/src/com/ibm/as400/access/ResourceBundleLoader.java b/cvsroot/src/com/ibm/as400/access/ResourceBundleLoader.java deleted file mode 100644 index 574887eb9..000000000 --- a/cvsroot/src/com/ibm/as400/access/ResourceBundleLoader.java +++ /dev/null @@ -1,274 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: ResourceBundleLoader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import javax.swing.Icon; -import javax.swing.ImageIcon; -import java.io.File; -import java.net.URL; - - -// A class representing the ResourceBundleLoader object which is used to load the resource bundle. -class ResourceBundleLoader -{ - private static final boolean DEBUG = false; - - private static MissingResourceException resourceException_; // Set if there is an exception during the loading of the resource bundle - private static ResourceBundle coreResources_; // Core toolbox resources @B2A - private static ResourceBundle resources_; // Base toolbox resources needed in proxy jar file @B1C - private static ResourceBundle resources2_; // Base toolbox resources NOT needed in proxy jar file @B1A - private static ResourceBundle systemValueResource_; // resource bundle for system value. - private static String genericDescription_ = null; - - static - { - try { // @B2A - coreResources_ = ResourceBundle.getBundle("com.ibm.as400.access.CoreMRI"); // @B2A - } // @B2A - catch(MissingResourceException e) { // @B2A - resourceException_ = e; // @B2A - } // @B2A - - try { - resources_ = ResourceBundle.getBundle("com.ibm.as400.access.MRI"); - systemValueResource_ = ResourceBundle.getBundle("com.ibm.as400.access.SVMRI"); - } - catch (MissingResourceException e) { - // Save the exception and rethrow it later. This is because exceptions thrown from static initializers are hard to debug. - resourceException_ = e; - } - - try { // @B1A - resources2_ = ResourceBundle.getBundle ("com.ibm.as400.access.MRI2"); // @B1A - } // @B1A - catch (MissingResourceException e) { // @B1A - // This resource bundle may not be found if we are running with only // @B1A - // the proxy jar file. Do not flag an exception. // @B1A - if (Trace.isTraceOn ()) // @B1A - Trace.log (Trace.INFORMATION, "MRI2 not found. This is expected behavior when using the proxy jar file."); // @B1A - } // @B1A - - } - - // No need to create instances of this class, all methods are static - private ResourceBundleLoader() - { - } - - // Returns the text associated with the exception. // @B2A - // @param textId the id which identifies the message text to return. // @B2A - // @return the translatable text which describes the exception. // @B2A - static final String getCoreText(String textId) // @B2A - { // @B2A - if (coreResources_ == null) // @B2A - throw resourceException_; // @B2A - return coreResources_.getString(textId); // @B2A - } // @B2A - - - - /** - Returns an icon. - - @param fileName The icon file name. - @return The icon. - **/ - static final Icon getIcon (String fileName) - { - return getIcon (fileName, null); - } - - - - /** - Returns an icon. - - @param fileName The icon file name. - @param description The icon description. - @return The icon. - **/ - static final Icon getIcon (String fileName, String description) - { - Icon icon = null; - - if (DEBUG) - System.out.println ("ResourceBundleLoader: Loading icon " + fileName + "."); - - try { - - // The generic description is for loading icons. Aparantly, the - // description is used in cases like presenting an icon to blind - // users, etc. In some cases, we just don't have a description, - // so we will put up a canned description. - if (description == null) { - if (genericDescription_ == null) - genericDescription_ = getText ("PRODUCT_TITLE"); // TBD: copy MRI from VMRI to MRI2 - description = genericDescription_; - } - - URL url = ResourceBundleLoader.class.getResource (fileName); - if (url == null) - { - fileName = "com" + File.separator + "ibm" + File.separator + - "as400" + File.separator + "access" + File.separator + - fileName; - icon = new ImageIcon (fileName, description); - } - else - { - icon = new ImageIcon (url, description); - } - } - catch (Exception e) { - if (DEBUG) - System.out.println ("ResourceBundleLoader: Error: " + e + "."); - - Trace.log (Trace.ERROR, "Icon " + fileName + " not loaded: " + e.getMessage() + "."); - } - - return icon; - } - - // Returns the system value MRI text. - // @param textId the id which identifies the text to return. - // @return the translatable system value MRI text. - static final String getSystemValueText(String textId) - { - if (systemValueResource_ == null) { - throw resourceException_; - } - return systemValueResource_.getString(textId).trim(); - } - - // Returns the system value MRI text for the specified Locale. - // @param textId the id which identifies the text to return. - // @param locale The locale to use. - // @return the translatable system value MRI text. - static final String getSystemValueText(String textId, Locale locale) - { - ResourceBundle bundle = ResourceBundle.getBundle("com.ibm.as400.access.SVMRI", locale); - if (bundle != null) - { - return bundle.getString(textId); - } - if (systemValueResource_ == null) { - throw resourceException_; - } - return systemValueResource_.getString(textId).trim(); - } - - // Returns the text associated with the exception. - // @param textId the id which identifies the message text to return. - // @return the translatable text which describes the exception. - static final String getText(String textId) - { - if (resources_ == null) { - throw resourceException_; - } - - try { // @B1A - return resources_.getString(textId); - } // @B1A - catch (MissingResourceException e) { // @B1A - - try { // @B2A - return getCoreText(textId); // @B2A - } // @B2A - catch(MissingResourceException e2) { // @B2A - if (resources2_ == null) // @B1A - throw e; // @B1A - else // @B1A - return resources2_.getString (textId); // @B1A - } // @B2A - } // @B1A - } - - // @B0A - // Returns the text associated with an MRI key, with subsitution variables. - // @param textId the id which identifies the message text to return. - // @param value The replacement value. - // @return The text string with the substitution variable replaced. - static String getText (String textId, Object value) - { - String text = getText (textId); - return substitute (text, value); - } - - // @B0A - // Returns the text associated with an MRI key, with subsitution variables. - // @param textId the id which identifies the message text to return. - // @param value0 The first replacement value. - // @param value1 The second replacement value. - // @return The text string with the substitution variable replaced. - static String getText (String textId, Object value0, Object value1) - { - String text = getText (textId); - return substitute (text, new Object[] { value0, value1 }); - } - - // @B0A - // Returns the text associated with an MRI key, with subsitution variables. - // @param textId the id which identifies the message text to return. - // @param values The replacement values. - // @return The text string with all substitution variables replaced. - static String getText (String textId, Object[] values) - { - String text = getText (textId); - return substitute (text, values); - } - - // Replaces a single substitution variable in a string. - // @param text The text string, with a single substitution variable (e.g. "Error &0 has occurred.") - // @param value The replacement value. - // @return The text string with the substitution variable replaced. - static String substitute(String text, Object value) - { - return substitute(text, new Object[] { value}); - } - - // @B0A - // Replaces a single substitution variable in a string. - // @param text The text string, with a single substitution variable (e.g. "Error &0 has occurred.") - // @param value0 The first replacement value. - // @param value1 The second replacement value. - // @return The text string with the substitution variable replaced. - static String substitute(String text, Object value0, Object value1) - { - return substitute(text, new Object[] { value0, value1 }); - } - - // Replaces substitution variables in a string. - // @param text The text string, with substitution variables (e.g. "Error &0 in table &1.") - // @param values The replacement values. - // @return The text string with all substitution variables replaced. - static String substitute (String text, Object[] values) - { - String result = text; - for (int i = 0; i < values.length; ++i) { - String variable = "&" + i; - int j = result.indexOf (variable); - if (j >= 0) { - StringBuffer buffer = new StringBuffer(); - buffer.append(result.substring(0, j)); - buffer.append(values[i].toString ()); - buffer.append(result.substring(j + variable.length ())); - result = buffer.toString (); - } - } - return result; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/RetryInputStream.java b/cvsroot/src/com/ibm/as400/access/RetryInputStream.java deleted file mode 100644 index decf6195f..000000000 --- a/cvsroot/src/com/ibm/as400/access/RetryInputStream.java +++ /dev/null @@ -1,106 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: RetryInputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import com.ibm.as400.access.Trace; -import java.io.FilterInputStream; -import java.io.InputStream; -import java.io.IOException; -import java.net.SocketException; - - - -/** -The RetryInputStream class filters another input stream. If the -underlying input stream throws a SocketException, this automatically -retries the read. -**/ -// -// Implementation note: This class provides a workaround for -// a Netscape bug where the Netscape JVM throws sporadic SocketExceptions, -// even though the socket is not closed and successive reads still -// work. -// -class RetryInputStream -extends FilterInputStream -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - private static final int exceptionThreshold_ = 3; - - - - public RetryInputStream(InputStream in) - { - super(in); - } - - - - public int read() throws IOException - { - int exceptionCount = 0; - while(true) { - try { - return super.read(); - } - catch(SocketException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Socket closed prematurely, let's try again", e); - if ((++exceptionCount) >= exceptionThreshold_) - throw e; - } - } - } - - - - public int read(byte[] b) throws IOException - { - int exceptionCount = 0; - while(true) { - try { - return super.read(b); - } - catch(SocketException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Socket closed prematurely, let's try again", e); - if ((++exceptionCount) >= exceptionThreshold_) - throw e; - } - } - } - - - - public int read(byte[] b, int offset, int length) throws IOException - { - int exceptionCount = 0; - while(true) { - try { - return super.read(b, offset, length); - } - catch(SocketException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Socket closed prematurely, let's try again", e); - if ((++exceptionCount) >= exceptionThreshold_) - throw e; - } - } - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/ReturnCodeException.java b/cvsroot/src/com/ibm/as400/access/ReturnCodeException.java deleted file mode 100644 index e809d66d6..000000000 --- a/cvsroot/src/com/ibm/as400/access/ReturnCodeException.java +++ /dev/null @@ -1,35 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: ReturnCodeException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - The ReturnCodeException interface defines the methods - required for exceptions that contain a return code. A return - code is used to further identify the cause of an error when an - exception can be thrown for several reasons. - The return code values are defined in the class that implements - this interface. -**/ - -// The return code values must be defined as constants within -// the class that implements this interface. -public interface ReturnCodeException -{ - - /** - Returns the return code associated with this exception. - @return The return code associated with this exception. - **/ - public int getReturnCode(); -} diff --git a/cvsroot/src/com/ibm/as400/access/RootPermission.java b/cvsroot/src/com/ibm/as400/access/RootPermission.java deleted file mode 100644 index 6b5d1d3fd..000000000 --- a/cvsroot/src/com/ibm/as400/access/RootPermission.java +++ /dev/null @@ -1,261 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RootPermission.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** -

    The RootPermission class represents the permissions for the specified user of an -object contained in the root directory structure. -

    An object on the root directory structure can set the data authority or the object -authority. The data authority can be set to one of the following values: *none, *RWX, -*RW, *RX, *WX, *R, *W, *X, *EXCLUDE, or *AUTL. Use getDataAuthority() to display -the current values and the setDataAuthority() to set the data authority to one of -the valid values. Use commit() from the Permission class to send the changes -to the system. - -

    The object authority can be set to one or more of the following values: -alter, existence, management, or reference. Use the appropriate -set methods (setAlter(), setExistence(), setManagement(), -or setReference()) to turn the value on or off. After all the values -are set, use the commit() method from the Permissions class to send the changes -to the system. -**/ -public class RootPermission extends UserPermission -{ - static final long serialVersionUID = 4L; - - - /** - * Constructs a RootPermission object. This is the permission of the specified user. - * @param userProfileName The name of the user profile. - * - **/ - public RootPermission(String userProfileName) - { - super(userProfileName); - return; - } - - - /** - * Returns the data authority of the user. - * @return The data authority of the user. The possible values are: -

      -
    • *RWX The user has object - operational, read, add, update, delete, and execute authorities to the - object. - -
    • *RW The user has object operational, read, add, delete authorities to the object. - -
    • *RX - The user has object operational, read, and execute authorities to the object. - -
    • *WX The - user has object operational, add, update, delete, and execute authorities - to the object. - -
    • *R - The user has object operational and read authorities to the object. - -
    • *W - The user has object operational, add, update, delete authorities to the - object. - -
    • *X - The user has object operational and execute authorities to the object. - -
    • *EXCLUDE The user cannot access the object. - -
    • *AUTL The public authorities - to the object comes from the public authority on the authorization list - that secures the object. The value can be returned only if there an authorization - list that secures the object and the authorized user is *PUBLIC. - -
    • *NONE The user has no authority to the object. -
    - * @see #setDataAuthority(String) - * - **/ - public String getDataAuthority() - { - return dataAuthority_; - } - - - /** - * Indicates if the user has the object authority of alter. - * @return true if the user has the object authority of alter; - * false otherwise. - * - **/ - public boolean isAlter() - { - return authorities_[OBJECT_ALTER]; - } - - /** - * Indicates if the user has the object authority of existence. - * @return true if the user has the object authority of existence; - * false otherwise. - **/ - public boolean isExistence() - { - return authorities_[OBJECT_EXIST]; - } - - - /** - * Indicates if the user has the object authority of management. - * @return true if the user has the object authority of management; - * false otherwise. - **/ - public boolean isManagement() - { - return authorities_[OBJECT_MANAGEMENT]; - } - - /** - * Indicates if the user has the object authority of reference. - * @return true if the user has the object authority of reference; - * false otherwise. - * - **/ - public boolean isReference() - { - return authorities_[OBJECT_REFERENCE]; - } - - - /** - * Sets the alter object authority. - * @param authority true to set the object authority of alter on; - * false to set the object authority of alter off. - * @see #isAlter - * - **/ - public synchronized void setAlter(boolean authority) - { - changeAuthority(); - authorities_[OBJECT_ALTER] = authority; - if (dataAuthority_.equals("*EXCLUDE")&&authority==true) - dataAuthority_ = "*NONE"; - return; - } - - - /** - * Sets the data authority of the user. - * @param authority The data authority of the user. -

    Valid values are: -

      -
    • *RWX The user has object - operational, read, add, update, delete, and execute authorities to the - object. - -
    • *RW The user has object operational, read, add, delete authorities to the object. - -
    • *RX - The user has object operational, read, and execute authorities to the object. - -
    • *WX The - user has object operational, add, update, delete, and execute authorities - to the object. - -
    • *R - The user has object operational and read authorities to the object. - -
    • *W - The user has object operational, add, update, delete authorities to the - object. - -
    • *X - The user has object operational and execute authorities to the object. - -
    • *EXCLUDE The user cannot access the object. - -
    • *AUTL The public authorities - to the object comes from the public authority on the authorization list - that secures the object. The value can be returned only if there an authorization - list that secures the object and the authorized user is *PUBLIC. - -
    • *NONE The user has no authority to the object. -
    - **/ - public synchronized void setDataAuthority(String authority) - { - if (authority == null) - throw new NullPointerException("authority"); - changeAuthority(); - dataAuthority_ = authority.toUpperCase().trim(); - if (dataAuthority_.equals("*EXCLUDE")) - { - authorities_[OBJECT_ALTER] = false; - authorities_[OBJECT_EXIST] = false; - authorities_[OBJECT_MANAGEMENT] = false; - authorities_[OBJECT_REFERENCE] = false; - } - if(dataAuthority_.equals("*AUTL")) // @1JU - if *AUTL, then setFromAuthorizationList - setFromAuthorizationList(true); // @1JU - return; - } - - /** - * Sets the existence object authority. - * @param authority true to set the object authority of existence on; - * false to set the object authority of existence off. - * @see #isExistence - **/ - public synchronized void setExistence(boolean authority) - { - changeAuthority(); - authorities_[OBJECT_EXIST] = authority; - if (dataAuthority_.equals("*EXCLUDE")&&authority==true) - dataAuthority_ = "*NONE"; - return; - } - - - /** - * Sets the management object authority. - * @param authority true to set the object authority of management on; - * false to set the object authority of management off. - * @see #isManagement - **/ - public synchronized void setManagement(boolean authority) - { - changeAuthority(); - authorities_[OBJECT_MANAGEMENT] = authority; - if (dataAuthority_.equals("*EXCLUDE")&&authority==true) - dataAuthority_ = "*NONE"; - return; - } - - - /** - * Sets the reference object authority. - * @param authority true to set the object authority of reference on; - * false to set the object authority of reference off. - * @see #isReference - * - **/ - public synchronized void setReference(boolean authority) - { - changeAuthority(); - authorities_[OBJECT_REFERENCE] = authority; - if (dataAuthority_.equals("*EXCLUDE")&&authority==true) - dataAuthority_ = "*NONE"; - return; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/SCS3812Writer.java b/cvsroot/src/com/ibm/as400/access/SCS3812Writer.java deleted file mode 100644 index a04a4d66a..000000000 --- a/cvsroot/src/com/ibm/as400/access/SCS3812Writer.java +++ /dev/null @@ -1,382 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SCS3812Writer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.OutputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; - - -/** - * The SCS3812Writer class writes an SCS 3812 data stream to an output stream, - * translating characters into bytes of the specified CCSID. - * SCS3812Writer extends the SCS5219Writer and adds support for Bold (Emphasis), - * fonts, duplex printing and text orientation. - * - * @see SCS5219Writer - **/ - - /* @A1C - * Moved Bold support from 5219. - */ - -public class SCS3812Writer extends SCS5219Writer -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - /** Constant value for duplex printing. **/ - public static final int DUPLEX_DUPLEX = 2; - /** Constant value for simplex printing. **/ - public static final int DUPLEX_SIMPLEX = 1; - /** Constant value for tumble duplex printing. **/ - public static final int DUPLEX_TUMBLE = 3; - - - /** Constant value for a Courier, 10 pitch font. **/ - public static final int FONT_COURIER_10 = 0; - /** Constant value for a Courier, 12 pitch font. **/ - public static final int FONT_COURIER_12 = 1; - /** Constant value for a Courier, 15 pitch font. **/ - public static final int FONT_COURIER_15 = 2; - /** Constant value for a Courier, 17 pitch font. **/ - public static final int FONT_COURIER_17 = 3; - /** Constant value for a Courier, 5 pitch font. **/ - public static final int FONT_COURIER_5 = 4; - /** Constant value for a Courier, bold, 10 pitch font. **/ - public static final int FONT_COURIER_BOLD_10 = 5; - /** Constant value for a Courier, bold, 17 pitch font. **/ - public static final int FONT_COURIER_BOLD_17 = 6; - /** Constant value for a Courier, bold, 5 pitch font. **/ - public static final int FONT_COURIER_BOLD_5 = 7; - /** Constant value for a Courier, italic, 10 pitch font. **/ - public static final int FONT_COURIER_ITALIC_10 = 8; - /** Constant value for a Courier, italic, 12 pitch font. **/ - public static final int FONT_COURIER_ITALIC_12 = 9; - /** Constant value for a Gothic, 10 pitch font. **/ - public static final int FONT_GOTHIC_10 = 10; - /** Constant value for a Gothic, 12 pitch font. **/ - public static final int FONT_GOTHIC_12 = 11; - /** Constant value for a Gothic, 13 pitch font. **/ - public static final int FONT_GOTHIC_13 = 12; - /** Constant value for a Gothic, 15 pitch font. **/ - public static final int FONT_GOTHIC_15 = 13; - /** Constant value for a Gothic, 20 pitch font. **/ - public static final int FONT_GOTHIC_20 = 14; - /** Constant value for a Gothic, 27 pitch font. **/ - public static final int FONT_GOTHIC_27 = 15; - /** Constant value for a Gothic, bold, 10 pitch font. **/ - public static final int FONT_GOTHIC_BOLD_10 = 16; - /** Constant value for a Gothic, bold, 12 pitch font. **/ - public static final int FONT_GOTHIC_BOLD_12 = 17; - /** Constant value for a Gothic, italic, 12 pitch font. **/ - public static final int FONT_GOTHIC_ITALIC_12 = 18; - /** Constant value for a letter Gothic, 12 pitch font. **/ - public static final int FONT_LETTER_GOTHIC_12 = 19; - /** Constant value for a letter Gothic, bold, 12 pitch font. **/ - public static final int FONT_LETTER_GOTHIC_BOLD_12 = 20; - /** Constant value for an OCR A, 10 pitch font. **/ - public static final int FONT_OCR_A_10 = 21; - /** Constant value for an OCR B, 10 pitch font. **/ - public static final int FONT_OCR_B_10 = 22; - /** Constant value for an Oritor, 10 pitch font. **/ - public static final int FONT_ORATOR_10 = 23; - /** Constant value for an Oritor, bold, 10 pitch font. **/ - public static final int FONT_ORATOR_BOLD_10 = 24; - /** Constant value for a Prestige, 10 pitch font. **/ - public static final int FONT_PRESTIGE_10 = 25; - /** Constant value for a Prestige, 12 pitch font. **/ - public static final int FONT_PRESTIGE_12 = 26; - /** Constant value for a Prestige, 15 pitch font. **/ - public static final int FONT_PRESTIGE_15 = 27; - /** Constant value for a Prestige, bold, 12 pitch font. **/ - public static final int FONT_PRESTIGE_BOLD_12 = 28; - /** Constant value for a Prestige, italic, 12 pitch font. **/ - public static final int FONT_PRESTIGE_ITALIC_12 = 29; - /** Constant value for a Roman, 10 pitch font. **/ - public static final int FONT_ROMAN_10 = 30; - /** Constant value for a script, 12 pitch font. **/ - public static final int FONT_SCRIPT_12 = 31; - /** Constant value for a Serif, 10 pitch font. **/ - public static final int FONT_SERIF_10 = 32; - /** Constant value for a Serif, 12 pitch font. **/ - public static final int FONT_SERIF_12 = 33; - /** Constant value for a Serif, 15 pitch font **/ - public static final int FONT_SERIF_15 = 34; - /** Constant value for a Serif, bold, 12 pitch font. **/ - public static final int FONT_SERIF_BOLD_12 = 35; - /** Constant value for a Serif, italic, 10 pitch font. **/ - public static final int FONT_SERIF_ITALIC_10 = 36; - /** Constant value for a Serif, italic, 12 pitch font. **/ - public static final int FONT_SERIF_ITALIC_12 = 37; - - - private static final byte [] SCG = {0x2B, (byte)0xD1, 0x06, - 0x01, 0x00, 0x00, 0x00, 0x00}; - private static final byte [] SFID = {0x2B, (byte)0xD1, 0x07, - 0x05, 0x00, 0x00, 0x00, 0x00, - 0x01}; - private static final byte [] STO = {0x2B, (byte)0xD3, 0x06, - (byte)0xF6, 0x00, 0x00, 0, 0}; - private static final byte [] BES = {0x2B, (byte)0xD1, 0x03, //@A1M - from 5219 class - (byte)0x8A, 0x00}; - private static final byte [] EES = {0x2B, (byte)0xD1, 0x03, //@A1M - from 5219 class - (byte)0x8E, 0x00}; - - - private byte [] orientation_ = {(byte)0xFF, (byte)0xFF}; - private int font_ = 0; - private boolean bold_ = false; //@A1M - from 5219 class - - /** - * Constructs a SCS3812Writer. The default encoding will be used. - * - * @param out An OutputStream. - * - * @deprecated Replaced by SCS3812Writer(OutputStream, int, AS400). - Any SCS3812Writer object that is created without - specifying an AS400 system object on its constructor may - not behave as expected in certain environments. - **/ - public SCS3812Writer(OutputStream out) - { - super(out); - } - - - /** - * Constructs a SCS3812Writer. - * - * @param out An OutputStream. - * @param ccsid The name of the target CCSID to be used. - * - * @exception UnsupportedEncodingException If ccsid is invalid. - * @deprecated Replaced by SCS3812Writer(OutputStream, int, AS400). - Any SCS3812Writer object that is created without - specifying an AS400 system object on its constructor may - not behave as expected in certain environments. - **/ - public SCS3812Writer(OutputStream out, - int ccsid) - throws UnsupportedEncodingException - { - super(out, ccsid); - } - - - // @B1A - /** - * Constructs a SCS3812Writer. - * - * @param out An OutputStream. - * @param ccsid The name of the target CCSID to be used. - * @param system The system - * - * @exception UnsupportedEncodingException If ccsid is invalid. - **/ - public SCS3812Writer(OutputStream out, - int ccsid, - AS400 system) - throws UnsupportedEncodingException - { - super(out, ccsid, system); - } - - - /** - * Constructs a SCS3812Writer. - * - * @param out An OutputStream. - * @param encoding The name of the target encoding to be used. - * - * @exception UnsupportedEncodingException If encoding is invalid. - * @deprecated Replaced by SCS3812Writer(OutputStream, int, AS400). - Any SCS3812Writer object that is created without - specifying an AS400 system object on its constructor may - not behave as expected in certain environments. - **/ - public SCS3812Writer(OutputStream out, - String encoding) - throws UnsupportedEncodingException - { - super(out, encoding); - } - - - /** Ends current page. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void endPage() - throws IOException - { - /* Don't want to leave the printer in a bad state. If bold */ - /* is on, turn it off before ending the page. The superclass (5219)*/ - /* will handle the underline command. */ - if (bold_ == true) addToBuffer(EES); - - super.endPage(); - } - - /* Sends out controls to initialize the start of a page. - * - * @exception IOException If an error occurs while communicating with the - * system. - */ - void initPage() - throws IOException - { - super.initPage(); - setBold(bold_); //@A1M (from 5219 class) - sendSTO(); //@A1M (from first line of method) - - if (fontOrCPI == FONT_) setFont(font_); - } - - - /* Outputs the Set Text Orientation command. - * - */ - private void sendSTO() - throws IOException - { - byte [] cmd = STO; - - cmd[6] = orientation_[0]; - cmd[7] = orientation_[1]; - - addToBuffer(cmd); - } - - - /** Sets bold text on or off. - * - * @param bold If true, turns bold on; if false, turns bold off. - *4 - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void setBold(boolean bold) - throws IOException - { - bold_ = bold; - if (pageStarted_ == true) { - if (bold_ == true) { - addToBuffer(BES); - } else { - addToBuffer(EES); - } /* endif */ - } /* endif */ - } - - /** Sets duplex printing mode. This is set once at the start of each - * page. Changes in duplex print mode will not take effect until the - * next new page. - * - * @param duplex The duplex setting. Valid values are DUPLEX_DUPLEX, - * DUPLEX_SIMPLEX, or DUPLEX_TUMBLE. - * - **/ - public void setDuplex(int duplex) - { - switch (duplex) { - case DUPLEX_DUPLEX: - case DUPLEX_SIMPLEX: - case DUPLEX_TUMBLE: - plex_ = (byte)duplex; - break; - default: - String arg = "Duplex (" + String.valueOf(duplex) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } - } - - - /** Sets the current font. This method will override the setCPI function. - * - * @param font The current font. Constant values are defined for the - * valid values. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void setFont(int font) - throws IOException - { - byte [] cmd = SFID; - SCSFontData fd = new SCSFontData(); - - /* Make sure font value is valid */ - if ((font < 0) || (font > fd.fontIDs.length)) - { - String arg = "Font (" + String.valueOf(font) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } - - font_ = font; - fontOrCPI = FONT_; - - if (pageStarted_ == false) initPage(); //@A2C - was "true" - // { //@A2D - - /* Get font ID and width */ - int fgid = fd.fontIDs[font]; - int width = fd.fontWidths[font]; - - /* Update command string. */ - cmd[4] = (byte)(fgid >> 8); - cmd[5] = (byte)fgid; - cmd[6] = (byte)(width >> 8); - cmd[7] = (byte)width; - - addToBuffer(cmd); - // } //@A2D - } - - - /** Sets text orientation. This is set once at the start of each page. - * Changes in text orientation will not take effect until the next - * new page. - * - * @param orientation The text orientation on the paper. Valid values - * are 0, 90, 180 and 270. - * - **/ - public void setTextOrientation(int orientation) - { - switch (orientation) { - case 0: - orientation_[0] = 0x00; - orientation_[1] = 0x00; - break; - case 90: - orientation_[0] = 0x2D; - orientation_[1] = 0x00; - break; - case 180: - orientation_[0] = 0x5A; - orientation_[1] = 0x00; - break; - case 270: - orientation_[0] = (byte)0x87; - orientation_[1] = 0x00; - break; - default: - String arg = "Orientation (" + String.valueOf(orientation) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } /* endswitch */ - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/SCS5219Writer.java b/cvsroot/src/com/ibm/as400/access/SCS5219Writer.java deleted file mode 100644 index 6f67c3a3a..000000000 --- a/cvsroot/src/com/ibm/as400/access/SCS5219Writer.java +++ /dev/null @@ -1,484 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SCS5219Writer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.OutputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -/** - * The SCS5219Writer class writes an SCS 5219 data stream to an output stream, - * translating characters into bytes of the specified CCSID. - * SCS5219Writer extends SCS5224Writer and adds support for left margin, - * underline, form type (paper or envelope), form size, print quality, code page, - * character set, source drawer number, and destination drawer number. - * - * @see SCS5224Writer -**/ - - /* @A1C - * Moved AHPP/AVPP to 5256 class - * Moved setBold to 3812 class - * Added setCodePage method that uses SCG command - */ - -public class SCS5219Writer extends SCS5224Writer -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - /** Constant value for draft print quality. **/ - public static final int QUALITY_DRAFT = 1; - /** Constant value for near letter print quality. **/ - public static final int QUALITY_NEAR_LETTER = 2; - - private static final byte [] BUS = {0x2B, (byte)0xD4, 0x03, - 0x0A, 0x01}; - private static final byte [] EUS = {0x2B, (byte)0xD4, 0x02, - 0x0E}; - private static final byte [] SPPS = {0x2B, (byte)0xD2, 0x06, - 0x40, 0, 0, 0, 0}; - private static final byte [] SCD = {0x2B, (byte)0xD2, 0x04, 0x29, - 0x00, 0x00}; - private static final byte [] PPM = {0x2B, (byte)0xD2, 0x0A, - 0x48, 0x00, 0x00, 0, 0, - 0x00, 0, 0, 0}; - private static final byte [] SHM = {0x2B, (byte)0xD2, 0x04, 0x11, - 0, 0}; - private static final byte [] SCG = {0x2B, (byte)0xD1, 0x06, - 0x01, 0x00, 0x00, 0x00, 0x00}; //@A1A - - - private boolean underline_ = false; - private double paperWidth = 8.5; - private double paperLength = 11.0; - private byte paper = 0x01; - private byte sourceDrawer = 0x01; - private byte destinationDrawer = 0x01; - private byte quality_ = QUALITY_NEAR_LETTER; //@A2C - was 0 - private double leftMargin_ = 0.0; - private int codepage_ = 0; //@A1A - private int charset_ = 0; //@A1A - - /* Plex (simplex, duplex, tumble) is a parameter of the Set - * Presentation Media command that is ignored by the 5219. - * It is implemented in the 3812 printer. - */ - byte plex_ = 0; //@A2C - was 1 - - - /** - * Constructs a SCS5219Writer. The default encoding will be used. - * - * @param out An OutputStream. - * - * @deprecated Replaced by SCS5219Writer(OutputStream, int, AS400). - Any SCS5219Writer object that is created without - specifying an AS400 system object on its constructor may - not behave as expected in certain environments. - **/ - public SCS5219Writer(OutputStream out) - { - super(out); - } - - - /** - * Constructs a SCS5219Writer. - * - * @param out An OutputStream. - * @param ccsid The name of the target CCSID to be used. - * - * @exception UnsupportedEncodingException If ccsid is invalid. - * @deprecated Replaced by SCS5219Writer(OutputStream, int, AS400). - Any SCS5219Writer object that is created without - specifying an AS400 system object on its constructor may - not behave as expected in certain environments. - **/ - public SCS5219Writer(OutputStream out, - int ccsid) - throws UnsupportedEncodingException - { - super(out, ccsid); - } - - - // @B1A - /** - * Constructs a SCS5219Writer. - * - * @param out An OutputStream. - * @param ccsid The name of the target CCSID to be used. - * @param system The system. - * - * @exception UnsupportedEncodingException If ccsid is invalid. - **/ - public SCS5219Writer(OutputStream out, - int ccsid, - AS400 system) - throws UnsupportedEncodingException - { - super(out, ccsid, system); - } - - - /** - * Constructs a SCS5219Writer. - * - * @param out An OutputStream. - * @param encoding The name of the target encoding to be used. - * - * @exception UnsupportedEncodingException If encoding is invalid. - * @deprecated Replaced by SCS5219Writer(OutputStream, int, AS400). - Any SCS5219Writer object that is created without - specifying an AS400 system object on its constructor may - not behave as expected in certain environments. - **/ - public SCS5219Writer(OutputStream out, - String encoding) - throws UnsupportedEncodingException - { - super(out, encoding); - } - - - - - /** Ends current page. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void endPage() - throws IOException - { - /* Don't want to leave the printer in a bad state. If underline is on, - turn it off before ending the page. */ - if (underline_ == true) addToBuffer(EUS); - - super.endPage(); - } - - - - /* Sends out controls to initialize the start of a page. - * - * @exception IOException If an error occurs while communicating - * with the system. - */ - void initPage() - throws IOException - { - super.initPage(); - - sendSPPS(); - sendPPM(); - setLeftMargin(leftMargin_); - setUnderline(underline_); - - if(codepage_ != 0) - { - // The user has specified a new character set and/or codepage. - // This will override the SCGL command done by the superclass - // initPage() method. - setCodePage(codepage_, charset_); - } - } - - - /* Outputs the Page Presentation Media command. - * - */ - private void sendPPM() - throws IOException - { - byte [] cmd = PPM; - - cmd[6] = paper; - cmd[7] = sourceDrawer; - cmd[9] = destinationDrawer; - cmd[10] = quality_; - cmd[11] = plex_; - - addToBuffer(cmd); - - if(plex_ != 0) //@A2A - { - // This is to fix a duplex problem in IPDS and some newer SCS printers. Because - // the system always repeats page formatting commands at the top of each - // page the PPM command is repeated w/ the last specified value of plex_. - // If plex_ is non-zero, the duplex mode gets reset to agree w/ plex_ at - // the start of each page, thereby setting each page to the first of two - // duplexed pages. So, duplex never happens. To fix it, we send another - // PPM command w/ plex_ = zero which means "keep current duplex setting". - plex_ = 0; //@A2A - cmd[11] = 0; //@A2A - addToBuffer(cmd); //@A2A - } - } - - - /* Outputs the Set Presentation Page Size command. - * - */ - private void sendSPPS() - throws IOException - { - int width = (int)(paperWidth * 1440.0); - int length = (int)(paperLength * 1440.0); - byte [] cmd = SPPS; - - cmd[4] = (byte)(width >> 8); - cmd[5] = (byte)width; - cmd[6] = (byte)(length >> 8); - cmd[7] = (byte)length; - - addToBuffer(cmd); - } - - - /** Sends Set GCGID through GCID (SCG) command to set the code page - * and character set. This method must be called before the first - * character is printed. Invalid values of codepage and - * charset may cause a printer exception. - * - * @param codepage The code page to be set. - * - * @param charset The new character set. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void setCodePage(int codepage, int charset) //@A1A - throws IOException - { - byte [] cmd = SCG; - - if((codepage != 0) && (charset != 0)) - { - codepage_ = codepage; - charset_ = charset; - - cmd[4] = (byte)(charset >> 8); - cmd[5] = (byte)charset; - cmd[6] = (byte)(codepage >> 8); - cmd[7] = (byte)codepage; - addToBuffer(cmd); - } - } - - - /** Sets characters per inch. All following text will be - * in the set pitch. - * - * @param cpi The characters per inch. Valid values are 10, 12 - * and 15. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void setCPI(int cpi) - throws IOException - { - switch (cpi) { - case 10: - CPI = 10; - break; - case 12: - CPI = 12; - break; - case 15: - CPI = 15; - break; - default: - String arg = "CPI (" + String.valueOf(cpi) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } /* endswitch */ - - fontOrCPI = CPI_; - if (pageStarted_ == false) initPage(); //@A2C - was "true" - // added the initPage() call. - byte [] cmd = SCD; - cmd[cmd.length-1] = CPI; - addToBuffer(cmd); - } - - - /** Sets destination drawer number. This is set once at the start of each page. - * Changes in the destination drawer will not take effect until the next - * new page. - * - * @param drawer The number of the drawer to select. Valid values are 1 to - * 255. - * - **/ - public void setDestinationDrawer(int drawer) - { - if ((drawer < 1) || (drawer > 255)) { - String arg = "Drawer (" + String.valueOf(drawer) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } else { - destinationDrawer = (byte)drawer; - } /* endif */ - } - - - /** Sets envelope size. This is set once at the start of each page. - * Changes in the envelope size will not take effect until the next - * new page. - * - * @param width The envelope width in inches. Valid values are 0.1 to - * 14.0. - * @param length The envelope width in inches. Valid values are 0.1 to - * 14.0. - * - **/ - public void setEnvelopeSize(double width, - double length) - { - if ((width < 0.1) || (width > 14.0)) { - String arg = "Width (" + String.valueOf(width) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } - - if ((length < 0.1) || (length > 14.0)) { - String arg = "Length (" + String.valueOf(length) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } - - paper = 0x02; /* Set flag for envelope */ - paperWidth = width; - paperLength = length; - } - - - /** Sets the left margin. Call this method only while at a line boundary - * or a printer exception will occur. - * - * @param leftMargin The margin distance from the left paper edge in - * inches. Valid values are 0.0 to 14.0. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void setLeftMargin(double leftMargin) - throws IOException - { - if ((leftMargin < 0.0) || (leftMargin > 14.0)) { - String arg = "Left margin (" + String.valueOf(leftMargin) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } - - leftMargin_ = leftMargin; - if (pageStarted_ == false) initPage(); //@A2C - was "true", added initPage() - - byte [] cmd = SHM; - int margin1440 = (int)(leftMargin * 1440.0); - cmd[4] = (byte)(margin1440 >> 8); - cmd[5] = (byte)margin1440; - addToBuffer(cmd); - } - - - /** Sets paper size. This is set once at the start of each page. - * Changes in the paper size will not take effect until the next - * new page. - * - * @param width The paper width in inches. Valid values are 0.1 to - * 14.0. - * @param length The paper length in inches. Valid values are 0.1 to - * 14.0. - * - **/ - public void setPaperSize(double width, - double length) - { - if ((width < 0.1) || (width > 14.0)) { - String arg = "Width (" + String.valueOf(width) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } - - if ((length < 0.1) || (length > 14.0)) { - String arg = "Length (" + String.valueOf(length) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } - - paper = 0x01; /* Set flag for paper */ - paperWidth = width; - paperLength = length; - } - - - /** Sets quality printing. This is set once at the start of each page. - * Changes in quality will not take effect until the next - * new page. - * - * @param quality The type of quality printing. Valid values are - * QUALITY_DRAFT and QUALITY_NEAR_LETTER. - * - **/ - public void setQuality(int quality) - { - switch (quality) { - case QUALITY_DRAFT: - case QUALITY_NEAR_LETTER: - quality_ = (byte)quality; - break; - default: - String arg = "Quality (" + String.valueOf(quality) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } - } - - - /** Sets source drawer number. This is set once at the start of each page. - * Changes in the source drawer will not take effect until the next - * new page. - * - * @param drawer The number of the drawer to select. Valid values are 1 to - * 255. - * - **/ - public void setSourceDrawer(int drawer) - { - if ((drawer < 1) || (drawer > 255)) { - String arg = "Drawer (" + String.valueOf(drawer) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } else { - sourceDrawer = (byte)drawer; - } /* endif */ - } - - - /** Sets underline on or off. - * - * @param ul If true, turns underline on; if false, turns underline off. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void setUnderline(boolean ul) - throws IOException - { - underline_ = ul; - if (pageStarted_ == true) { - if (underline_ == true ) { - addToBuffer(BUS); - } else { - addToBuffer(EUS); - } /* endif */ - } /* endif */ - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/SCS5224Writer.java b/cvsroot/src/com/ibm/as400/access/SCS5224Writer.java deleted file mode 100644 index 27fc7f257..000000000 --- a/cvsroot/src/com/ibm/as400/access/SCS5224Writer.java +++ /dev/null @@ -1,262 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SCS5224Writer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.OutputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; - - - -/** - * The SCS5224Writer class writes an SCS 5224 data stream to an output stream, - * translating characters into bytes of the specified CCSID. - * SCS5224Writer extends the SCS5256Writer and adds support for - * setting the characters per inch (CPI) and lines per inch (LPI). - * - * @see SCS5256Writer -**/ - -/* @A1C - * Fix setCPI() and setLPI() so that they call initPage() if the page has not - * been started yet. - */ - -public class SCS5224Writer extends SCS5256Writer -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - private static final byte [] SCD = {0x2B, (byte)0xD2, 0x04, 0x29, - 0x00, 0x00}; - private static final byte [] SCGL = {0x2B, (byte)0xD1, 0x03, - (byte)0x81, (byte)0xFF}; - private static final byte [] SLD = {0x2B, (byte)0xC6, 0x02, 0x00}; - - private byte LPI = 0x06; - - /* Because a font can override the CPI, and vice versa, we need */ - /* to keep a flag indicating which command to use to initialize */ - /* the page. */ - static final boolean FONT_ = false; - static final boolean CPI_ = true; - boolean fontOrCPI = CPI_; - byte CPI = 0x0A; - - - /** - * Constructs a SCS5224Writer. The default encoding will be used. - * - * @param out An OutputStream. - * - * @deprecated Replaced by SCS5224Writer(OutputStream, int, AS400). - Any SCS5224Writer object that is created without - specifying an AS400 system object on its constructor may - not behave as expected in certain environments. - **/ - public SCS5224Writer(OutputStream out) - { - super(out); - } - - - /** - * Constructs a SCS5224Writer. - * - * @param out An OutputStream. - * @param ccsid The name of the target CCSID to be used. - * - * @exception UnsupportedEncodingException If ccsid is invalid. - * @deprecated Replaced by SCS5224Writer(OutputStream, int, AS400). - Any SCS5224Writer object that is created without - specifying an AS400 system object on its constructor may - not behave as expected in certain environments. - **/ - public SCS5224Writer(OutputStream out, - int ccsid) - throws UnsupportedEncodingException - { - super(out, ccsid); - } - - - // @B1A - /** - * Constructs a SCS5224Writer. - * - * @param out An OutputStream. - * @param ccsid The name of the target CCSID to be used. - * @param system The system. - * - * @exception UnsupportedEncodingException If ccsid is invalid. - **/ - public SCS5224Writer(OutputStream out, - int ccsid, - AS400 system) - throws UnsupportedEncodingException - { - super(out, ccsid, system); - } - - - /** - * Constructs a SCS5224Writer. - * - * @param out An OutputStream. - * @param encoding The name of the target encoding to be used. - * - * @exception UnsupportedEncodingException If encoding is invalid. - * @deprecated Replaced by SCS5224Writer(OutputStream, int, AS400). - Any SCS5224Writer object that is created without - specifying an AS400 system object on its constructor may - not behave as expected in certain environments. - **/ - public SCS5224Writer(OutputStream out, - String encoding) - throws UnsupportedEncodingException - { - super(out, encoding); - } - - - - /* Sends out controls to initialize the start of a page. - * - */ - void initPage() - throws IOException - { - super.initPage(); - - if (fontOrCPI == CPI_) setCPI(CPI); - setLPI(LPI); - setCodePage(); - } - - - /* Sends SCGL command to set the code page - * - */ - void setCodePage() - throws IOException - { - byte [] cmd = SCGL; - int ccsid = getCcsid(); - SCSFontData fd = new SCSFontData(); - int length = fd.codePage.length; - - /* Loop through the list of code pages looking for a match. */ - /* If one is found, add the corresponding ID to the command. */ - /* If no match is found, the default ID is sent. */ - for (int i = 0; i < length; i++) - { - if (ccsid == fd.codePage[i]) - { - cmd[cmd.length-1] = fd.codePageID[i]; - break; - } - } - - addToBuffer(cmd); - } - - - /** Sets characters per inch. All following text will be - * in the set pitch. - * - * @param cpi The characters per inch. Valid values are 10 and 15. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void setCPI(int cpi) - throws IOException - { - switch (cpi) { - case 10: - CPI = 10; - break; - case 15: - CPI = 15; - break; - default: - String arg = "CPI (" + String.valueOf(cpi) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } /* endswitch */ - - fontOrCPI = CPI_; - -// if (pageStarted_ == true) { @A1D - if (pageStarted_ == false) //@A1A - initPage(); //@A1A - else //@A1A - { - byte [] cmd = SCD; - cmd[cmd.length-1] = CPI; - addToBuffer(cmd); - } - } - - - /** Sets lines per inch. All following lines will be in the set - * lines per inch. - * - * @param lpi The lines per inch. Valid values are 4, 6, 8, 9, and - * 12. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void setLPI(int lpi) - throws IOException - { - byte LPI1440; - - switch (lpi) { - case 4: - LPI = 4; - LPI1440 = 0x12; - break; - case 6: - LPI = 6; - LPI1440 = 0x0C; - break; - case 8: - LPI = 8; - LPI1440 = 0x09; - break; - case 9: - LPI = 9; - LPI1440 = 0x08; - break; - case 12: - LPI = 12; - LPI1440 = 0x06; - break; - default: - String arg = "LPI (" + String.valueOf(lpi) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } /* endswitch */ - -// if (pageStarted_ == true) { @A1D - if (pageStarted_ == false) //@A1A - initPage(); //@A1A - else //@A1A - { - byte [] cmd = SLD; - cmd[cmd.length-1] = LPI1440; - addToBuffer(cmd); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SCS5256Writer.java b/cvsroot/src/com/ibm/as400/access/SCS5256Writer.java deleted file mode 100644 index e7eef1195..000000000 --- a/cvsroot/src/com/ibm/as400/access/SCS5256Writer.java +++ /dev/null @@ -1,588 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SCS5256Writer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -/** - * The SCS5256Writer class writes an SCS 5256 data stream to an output stream, - * translating characters into bytes of the specified CCSID. - * SCS5256Writer is the simplest SCS generator. It supports - * text, carriage return, line feed, new line, form feed, Absolute Horiz/Vert - * positioning, Relative Horiz/Vert positioning, and Set Vertical Format. - * - * @see OutputStreamWriter - * @version 1.1 -**/ -public class SCS5256Writer extends OutputStreamWriter -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - private static final byte [] CR = {0x0D}; - private static final byte [] LF = {0x25}; - private static final byte [] NL = {0x15}; - private static final byte [] FF = {0x0C}; - private static final byte [] SGEA = {0x2B, (byte)0xC8, 0x01}; - private static final byte [] SHF = {0x2B, (byte)0xC1, 0x02, 0x00}; - private static final byte [] SVF = {0x2B, (byte)0xC2, 0x02, 0x00}; - private static final byte [] AHPP = {0x34, (byte)0xC0, 0x00}; - private static final byte [] AVPP = {0x34, (byte)0xC4, 0x00}; - private static final byte [] RHPP = {0x34, (byte)0xC8, 0x00}; - private static final byte [] RVPP = {0x34, (byte)0x4C, 0x00}; - - private OutputStream outPut; - private Converter cvt; - private byte [] buffer = new byte [300]; - private int dataLength = 0; - - /* horizontalFormat retains the current # of characters per line. - * (-1) indicates not set. - */ - private int horizontalFormat_ = -1; - - /* verticalFormat retains the current # of lines per page. - * (-1) indicates not set. - */ - private int verticalFormat_ = -1; - - /* PageStarted is a flag to indicate data has been written to the - * page. Some print commands can only appear at the start of a - * page. - */ - boolean pageStarted_ = false; - - /** - * Constructs a SCS5256Writer. The default encoding will be used. - * - * @param out An OutputStream. - * - * @deprecated Replaced by SCS5256Writer(OutputStream, int, AS400). - Any SCS5256Writer object that is created without - specifying an AS400 system object on its constructor may - not behave as expected in certain environments. - **/ - public SCS5256Writer(OutputStream out) - { - super(out); - outPut = out; - // cvt = Converter.getConverter(); - cvt = new Converter(); - } - - - /** - * Constructs a SCS5256Writer. - * - * @param out An OutputStream. - * @param ccsid The name of the target CCSID to be used. - * - * @exception UnsupportedEncodingException If ccsid is invalid. - * @deprecated Replaced by SCS5256Writer(OutputStream, int, AS400). - Any SCS5256Writer object that is created without - specifying an AS400 system object on its constructor may - not behave as expected in certain environments. - **/ - public SCS5256Writer(OutputStream out, - int ccsid) - throws UnsupportedEncodingException - { - super(out); - outPut = out; - // cvt = Converter.getConverter(ccsid); - cvt = new Converter(ccsid); - } - - - /** - * Constructs a SCS5256Writer. - * - * @param out An OutputStream. - * @param ccsid The name of the target CCSID to be used. - * @param system The system. - * - * @exception UnsupportedEncodingException If ccsid is invalid. - **/ - public SCS5256Writer(OutputStream out, - int ccsid, - AS400 system) - throws UnsupportedEncodingException - { - super(out); - outPut = out; - cvt = new Converter(ccsid, system); - } - - - /** - * Constructs a SCS5256Writer. - * - * @param out An OutputStream. - * @param encoding The name of the target encoding to be used. - * - * @exception UnsupportedEncodingException If encoding is invalid. - * @deprecated Replaced by SCS5256Writer(OutputStream, int, AS400). - Any SCS5256Writer object that is created without - specifying an AS400 system object on its constructor may - not behave as expected in certain environments. - **/ - public SCS5256Writer(OutputStream out, - String encoding) - throws UnsupportedEncodingException - { - super(out); - outPut = out; - // cvt = Converter.getConverter(encoding); //@A1C - cvt = new Converter(encoding); // @A4A - } - - - - /** Moves the print position to the column specified. Moving - * beyond the right end of the page will cause an error on the - * printer. - * - * @param column The new horizontal print position. Valid values are - * 0 to the maximum print position as set in the SetHorizontalFormat - * method. A value of 0 causes a no-op. The number of columns on - * a line is dependent on the current character width (CPI) and the - * width of the page. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void absoluteHorizontalPosition(int column) - throws IOException - { - byte [] cmd = AHPP; - - if ((column < 0) || (column > 255)) { - String arg = "Column (" + String.valueOf(column) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } - if (pageStarted_ == false) initPage(); - cmd[cmd.length-1] = (byte)column; - addToBuffer(cmd); - } - - - /** Moves the print position to the line number specified. Moving - * above the current line causes a form feed and move to the specified - * line on the next page. - * - * @param line The new vertical print position. Valid values are - * 0 to the current forms length as specified by the SetVerticalFormat - * method. A value of 0 causes a no-op. If the value is less than - * the current line, the forms are moved to the specified line of the - * next logical page. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void absoluteVerticalPosition(int line) - throws IOException - { - byte [] cmd = AVPP; - - if ((line < 0) || (line > 255)) { - String arg = "Line (" + String.valueOf(line) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } - if (pageStarted_ == false) initPage(); - cmd[cmd.length-1] = (byte)line; - addToBuffer(cmd); - } - - /* Adds printer controls to the buffer. - * Bytes are not translated. - * - * @param data The bytes to add to the buffer. - * - * @exception IOException If an error occurs while communicating - * with the system. - */ - void addToBuffer(byte [] data) - throws IOException - { - if (outPut == null) { - throw new IOException("Stream closed"); - } - - int len = data.length; - - if ((dataLength + len) > buffer.length) flush(); - - for (int i = 0; i < len; i++ ) { - buffer[dataLength] = data[i]; - dataLength ++; - } /* endfor */ - } - - - /** Adds a carriage return control to the stream. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void carriageReturn() - throws IOException - { - addToBuffer(CR); - } - - - /** Closes the stream. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void close() - throws IOException - { - flush(); - outPut.close(); - outPut = null; // Null private data to show - cvt = null; - } - - - /** Ends current page. The application MUST use this method - * to end the current page after the page data has been written. - * - * @exception IOException If an error occurs while communicating - * with the system. - * - **/ - public void endPage() - throws IOException - { - addToBuffer(FF); - pageStarted_ = false; - } - - - /** Flushes the stream. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void flush() - throws IOException - { - if (dataLength > 0) { - if (outPut == null) { - throw new IOException("Stream closed"); - } - - outPut.write(buffer, 0, dataLength); - dataLength = 0; - } - } - - - // Get the CCSID used for this writer. - int getCcsid() - { - if (cvt == null) { - return 0; - } else { - return cvt.getCcsid(); - } - } - - - - /** Returns the name of the encoding being used by this stream. - * It may return null if the stream has been closed. - **/ - public String getEncoding() - { - if (cvt == null) { - return(null); - } else { - return cvt.getEncoding(); - } - } - - - /* Sends out controls to initialize the start of a page. - * - * @exception IOException If an error occurs while communicating - * with the system. - * - */ - void initPage() - throws IOException - { - pageStarted_ = true; - - sendSGEA(); - - if (horizontalFormat_ != (-1)) { - setHorizontalFormat(horizontalFormat_); - } - - if (verticalFormat_ != (-1)) { - setVerticalFormat(verticalFormat_); - } - } - - - /** Adds a line feed control to the stream. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void lineFeed() - throws IOException - { - addToBuffer(LF); - } - - - /** Adds a new line control to the stream. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void newLine() - throws IOException - { - addToBuffer(NL); - } - - - /** Moves the print position the number of characters specified. Moving - * beyond the right end of the page will cause an error on the - * printer. - * - * @param chars The number of character widths to move. Valid values are - * 0 to the maximum print position minus the current column. The maximum - * print position is the current CPI * 13.2 inches. A value of 0 causes a - * no-op. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void relativeHorizontalPosition(int chars) - throws IOException - { - byte [] cmd = RHPP; - - // Just check chars for min and max value. User must keep track of - // max value for page size - if ((chars < 0) || (chars > 255)) { - String arg = "chars (" + String.valueOf(chars) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } - if (pageStarted_ == false) initPage(); - cmd[cmd.length-1] = (byte)chars; - addToBuffer(cmd); - } - - /** Moves the print position the number of lines specified. - * - * @param lines The number of lines to move down the page. Valid values are - * 0 to the last logical line on the page. A value of 0 causes a - * no-op. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void relativeVerticalPosition(int lines) - throws IOException - { - byte [] cmd = RVPP; - - // Just check chars for min and max value. User must keep track of - // max value for page size - if ((lines < 0) || (lines > 255)) { - String arg = "lines (" + String.valueOf(lines) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } - if (pageStarted_ == false) initPage(); - cmd[cmd.length-1] = (byte)lines; - addToBuffer(cmd); - } - - /* Sends Set Graphic Error Action (SGEA) command. One multibyte - * command must be sent for the data stream sniffer to determine - * this is a SCS data stream. - * - */ - private void sendSGEA() - throws IOException - { - addToBuffer(SGEA); - } - - /** Sets the Horizontal Format. This specifies the maximum number of - * characters on the line. - * - * @param NumOfChars The maximum number of characters. Valid values are - * 0 to 255. A value of 0 causes horizontal format to be set to the - * printer default. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void setHorizontalFormat(int NumOfChars) - throws IOException - { - byte [] cmd = {0,0,0,0}; - - if ((NumOfChars < 0) || (NumOfChars > 255)) { - String arg = "NumOfChars (" + String.valueOf(NumOfChars) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } - horizontalFormat_ = NumOfChars; - - for(int i=0; i< (cmd.length-1); i++) - { - cmd[i] = SHF[i]; - } - cmd[cmd.length-1] = (byte)NumOfChars; - addToBuffer(cmd); - } - - /** Sets the Vertical Format. This specifies the maximum number of - * lines on the page. Note that when the printer executes this command - * the current line number on the printer is set to 1. Also, the - * combination of LPI and Vertical Format should not exceed 159 cm - * (63.75 inches). Changing the Line Density changes where the maximum - * line is on the physical page. - * - * @param NumOfLines The maximum number of lines. Valid values are - * 0 to 255. A value of 0 causes vertical format to be set to the - * printer default. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void setVerticalFormat(int NumOfLines) - throws IOException - { - byte [] cmd = {0,0,0,0}; - - if ((NumOfLines < 0) || (NumOfLines > 255)) { - String arg = "NumOfLines (" + String.valueOf(NumOfLines) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } - verticalFormat_ = NumOfLines; - - for(int i=0; i< (cmd.length-1); i++) - { - cmd[i] = SVF[i]; - } - cmd[cmd.length-1] = (byte)NumOfLines; - addToBuffer(cmd); - } - - - /** Writes a portion of an array of characters. - * - * @param databuffer The buffer of characters. - * @param offset The offset from which to start writing characters. - * @param length The number of characters to write. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void write(char databuffer[], - int offset, - int length) - throws IOException - { - // Convert input to a string. - String aStr = new String(databuffer, offset, length); - write(aStr); - } - - - /** Writes a single character. - * - * @param c The character to write. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void write(int c) - throws IOException - { - // Convert input to a string. - String aStr = String.valueOf(c); - write(aStr); - } - - - /** Writes a string. - * - * @param str The string to write. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void write(String str) - throws IOException - { - if (outPut == null) { - throw new IOException("Stream closed"); - } - - if (pageStarted_ == false) initPage(); - - // Convert input to a byte array of proper encoding. - byte [] convertedBytes = cvt.stringToByteArray(str); - - // If input too large for room in buffer, flush buffer - if ((dataLength + convertedBytes.length) > buffer.length) { - flush(); - - // If input data is larger than buffer, write data - if (convertedBytes.length > buffer.length) { - outPut.write(convertedBytes, 0, convertedBytes.length); - return; - } - } - - // Copy input to buffer - System.arraycopy(convertedBytes, 0, buffer, dataLength, - convertedBytes.length); - dataLength += convertedBytes.length; - } - - - /** Writes a portion of a string. - * - * @param str The string to write. - * @param offset The offset from which to start writing characters. - * @param length The number of characters to write. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void write(String str, - int offset, - int length) - throws IOException - { - String aStr = str.substring(offset, offset + length); - write(aStr); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/SCS5553Writer.java b/cvsroot/src/com/ibm/as400/access/SCS5553Writer.java deleted file mode 100644 index a6570d72c..000000000 --- a/cvsroot/src/com/ibm/as400/access/SCS5553Writer.java +++ /dev/null @@ -1,389 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SCS5553Writer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.OutputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -/** - * The SCS5553Writer class writes an SCS 5553 data stream to an output stream, - * translating characters into bytes of the specified CCSID. - * SCS5553Writer extends the SCS5224Writer and adds support for presentation of - * control characters, character rotation, grid lines, and font scaling. - * - * The 5553 is a DBCS data stream. - * - * @see SCS5224Writer - **/ - - /* - * This class now subclasses SCS5224Writer instead of SCS5219Writer - * Added Set Presentation of Control Character (SPPC) which required - * that initPage() be overridden. - */ - - -public class SCS5553Writer extends SCS5224Writer -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - /** Constant for normal character rotation. **/ - public static final int CHARACTER_NORMAL = 0; - /** Constant for 270-degree character rotation. **/ - public static final int CHARACTER_ROTATED = 1; - - /** Constant for double horizontal font scaling. **/ - public static final int SCALE_DOUBLE_HORIZONTAL = 0x20; - /** Constant for regular font scaling. **/ - public static final int SCALE_REGULAR = 0x10; - - - /** Constant for all control characters take no printing positions **/ - public static final int SETCCP_NO_PRINT = 0; //@A1A - - /** Constant for SO/SI are printed as A/N/K blank code (default) **/ - public static final int SETCCP_BLANK_CODE = 1; //@A1A - - /** Constant for SO takes no position, SI takes 2 A/N/K blanks **/ - public static final int SETCCP_SI_BLANK = 2; //@A1A - - private static final byte [] SCD = {0x2B, (byte)0xD2, 0x04, 0x29, - 0x00, 0x00}; - - private static final byte [] DGL = {0x2B, (byte)0xFD, 0x00, - 0x00, 0x00, 0x00}; - private static final byte [] SFSS = {0x2B, (byte)0xFD, 0x04, - 0x02, 0x00, 0x00}; - private static final byte [] STO = {0x2B, (byte)0xD3, 0x04, - (byte)0xF6, 0x00, 0x00}; - private static final byte [] SPPC = {0x2B, (byte)0xFD, 0x04, - 0x03, 0x00, 0x00}; //@A1A - - private int setCCP = SETCCP_BLANK_CODE; //@A1A - - - /** - * Constructs a SCS5553Writer. The default encoding will be used. - * - * @param out An OutputStream. - * - * @deprecated Replaced by SCS5553Writer(OutputStream, int, AS400). - Any SCS5553Writer object that is created without - specifying an AS400 system object on its constructor may - not behave as expected in certain environments. - **/ - public SCS5553Writer(OutputStream out) - { - super(out); - } - - - /** - * Constructs a SCS5553Writer. - * - * @param out An OutputStream. - * @param ccsid The name of the target CCSID to be used. - * - * @exception UnsupportedEncodingException If ccsid is invalid. - * @deprecated Replaced by SCS5553Writer(OutputStream, int, AS400). - Any SCS5553Writer object that is created without - specifying an AS400 system object on its constructor may - not behave as expected in certain environments. - **/ - public SCS5553Writer(OutputStream out, - int ccsid) - throws UnsupportedEncodingException - { - super(out, ccsid); - } - - - // @B1A - /** - * Constructs a SCS5553Writer. - * - * @param out An OutputStream. - * @param ccsid The name of the target CCSID to be used. - * @param system The system. - * - * @exception UnsupportedEncodingException If ccsid is invalid. - **/ - public SCS5553Writer(OutputStream out, - int ccsid, - AS400 system) - throws UnsupportedEncodingException - { - super(out, ccsid, system); - } - - - /** - * Constructs a SCS5553Writer. - * - * @param out An OutputStream. - * @param encoding The name of the target encoding to be used. - * - * @exception UnsupportedEncodingException If encoding is invalid. - * @deprecated Replaced by SCS5553Writer(OutputStream, int, AS400). - Any SCS5553Writer object that is created without - specifying an AS400 system object on its constructor may - not behave as expected in certain environments. - **/ - public SCS5553Writer(OutputStream out, - String encoding) - throws UnsupportedEncodingException - { - super(out, encoding); - } - - /* Sends out controls to initialize the start of a page. - * - */ - void initPage() //@A1A - throws IOException - { - super.initPage(); - - // Set the current or default control character presentation. - setControlCharPresentation(setCCP); //@A1A - } - - /** Sets characters per inch. All following text will be - * in the set pitch. - * - * @param cpi The characters per inch. Valid values are 10, 12, 13.3, 15, 18 and 20 but - * we won't implement 13.3 for now - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void setCPI(int cpi) - throws IOException - { - switch (cpi) { - case 10: - CPI = 10; - break; - case 12: - CPI = 12; - break; - case 15: - CPI = 15; - break; - case 18: - CPI = 18; - break; - case 20: - CPI = 20; - break; - default: - String arg = "CPI (" + String.valueOf(cpi) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } /* endswitch */ - - fontOrCPI = CPI_; - -// if (pageStarted_ == true) { @A1D - if (pageStarted_ == false) //@A1A - initPage(); //@A1A - - // now set the callers CPI - byte [] cmd = SCD; - cmd[cmd.length-1] = CPI; - addToBuffer(cmd); - } - - /** Prints a horizontal grid line at the current line. - * - * @param start The absolute position in inches, from the left paper edge, - * to start the grid line. - * @param stop The absolute position in inches, from the left paper edge, - * to stop the grid line. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void printHorizontalGridLine(double start, double stop) - throws IOException - { - byte [] positions = new byte [4]; - byte [] cmd = DGL; - - cmd[2] = 0x08; /* Set length of command */ - cmd[cmd.length - 1] = (byte)0x80; /* Set horizontal option */ - - addToBuffer(cmd); /* Output command */ - - /* Calculate start and stop in 1440ths of an inch */ - int iStart = (int)(start * 1440.0); - int iStop = (int)(stop * 1440.0); - - /* Put start and stop in to an array */ - positions[0] = (byte)(iStart >> 8); - positions[1] = (byte)iStart; - positions[2] = (byte)(iStop >> 8); - positions[3] = (byte)iStop; - - addToBuffer(positions); /* Output start and stop */ - } - - - /** Sets character rotation. Characters can be rotated 270 degrees - * for vertical printing. - * - * @param rotation The value of character rotation. Valid values are - * CHARACTER_NORMAL and CHARACTER_ROTATED. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void setCharacterRotation(int rotation) - throws IOException - { - byte [] cmd = STO; - - switch (rotation) { - case CHARACTER_NORMAL: - cmd[cmd.length -2] = 0x00; - cmd[cmd.length -1] = 0x00; - addToBuffer(cmd); /* Output normal rotation */ - break; - - case CHARACTER_ROTATED: - cmd[cmd.length -2] = (byte)0x87; - cmd[cmd.length -1] = 0x00; - addToBuffer(cmd); /* Output 270 degree rotation */ - break; - - default: - String arg = "Rotation (" + String.valueOf(rotation) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } - } - - - /** Defines the action taken by the SI/SO characters. These characters - * are either not printed at all or printed as spaces. - * - * @param set The parameter that defines the presentation option. Valid - * values are SETCCP_NO_PRINT, SETCCP_BLANK_CODE, and SETCCP_SI_BLANK. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void setControlCharPresentation(int set) - throws IOException - { - byte [] cmd = SPPC; - - switch(set) { - case SETCCP_NO_PRINT: - case SETCCP_BLANK_CODE: - case SETCCP_SI_BLANK: - setCCP = set; - cmd[4] = (byte)(set >> 8); - cmd[5] = (byte)set; - addToBuffer(cmd); - break; - default: - String arg = "set (" + String.valueOf(set) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } - } - - /** Sets font scaling. Allows doubling the horizontal size of the - * font. Applies to both A/N/K and IGC characters. Actual characters - * per inch is affected. - * - * @param scale The value of font scaling. Valid values are SCALE_REGULAR and - * SCALE_DOUBLE_HORIZONTAL. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void setFontScaling(int scale) - throws IOException - { - byte [] cmd = SFSS; - - switch (scale) { - case SCALE_REGULAR: - cmd[cmd.length -2] = (byte)SCALE_REGULAR; - addToBuffer(cmd); /* Output regular font size */ - break; - - case SCALE_DOUBLE_HORIZONTAL: - cmd[cmd.length -2] = (byte)SCALE_DOUBLE_HORIZONTAL; - addToBuffer(cmd); /* Output double font size */ - break; - - default: - String arg = "Scale (" + String.valueOf(scale) + ")"; - throw new ExtendedIllegalArgumentException(arg, 2); - } - } - - - - /** Starts printing vertical grid lines at the specified positions. - * - * @param positions An array of absolute positions in inches, from the - * left paper edge, to start a vertical grid line. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void startVerticalGridLines(double [] positions) - throws IOException - { - byte [] cmd = DGL; - int len = positions.length; - byte [] iPositions = new byte [2 * len]; - - cmd[2] = (byte)(4 + (2 * len)); /* Set command length */ - cmd[5] = 0x40; /* Set vertical grid line option */ - addToBuffer(cmd); /* Add command part to buffer */ - - int iPos; /* Position in 1440ths of an inch */ - int j = 0; /* iPositions index */ - - /* Loop through the positions, convert to 1440th of an inch */ - /* and store in a byte array. */ - for (int i = 0; i < len; i++) { - iPos = (int)(positions[i] * 1440.0); - iPositions[j] = (byte)(iPos >> 8); - j++; - iPositions[j] = (byte)iPos; - j++; - } - addToBuffer(iPositions); /* Add positions to buffer */ - } - - - /** Stops printing vertical grid lines. - * - * @exception IOException If an error occurs while communicating - * with the system. - **/ - public void stopVerticalGridLines() - throws IOException - { - byte [] cmd = DGL; - - cmd[2] = 0x04; /* Set command length */ - cmd[5] = 0x00; /* Stop and clear vertical grids */ - addToBuffer(cmd); /* Add command to buffer */ - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SCSFontData.java b/cvsroot/src/com/ibm/as400/access/SCSFontData.java deleted file mode 100644 index b0683b18b..000000000 --- a/cvsroot/src/com/ibm/as400/access/SCSFontData.java +++ /dev/null @@ -1,221 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SCSFontData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * This class stores font data used by the SCS Writer classes. - * -**/ - - -class SCSFontData extends Object -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - /* The following array stores FGID values for fonts used by the */ - /* SCS3812Writer class. The order of the fonts in the array (comment */ - /* value) must match the order of the font constants defined in the */ - /* SCS3812Writer class. */ - static final int [] fontIDs = { - 11, /* FONT_COURIER_10 */ - 85, /* FONT_COURIER_12 */ - 223, /* FONT_COURIER_15 */ - 252, /* FONT_COURIER_17 */ - 244, /* FONT_COURIER_5 */ - 46, /* FONT_COURIER_BOLD_10 */ - 253, /* FONT_COURIER_BOLD_17 */ - 245, /* FONT_COURIER_BOLD_5 */ - 18, /* FONT_COURIER_ITALIC_10 */ - 91, /* FONT_COURIER_ITALIC_12 */ - 40, /* FONT_GOTHIC_10 */ - 66, /* FONT_GOTHIC_12 */ - 204, /* FONT_GOTHIC_13 */ - 230, /* FONT_GOTHIC_15 */ - 281, /* FONT_GOTHIC_20 */ - 290, /* FONT_GOTHIC_27 */ - 39, /* FONT_GOTHIC_BOLD_10 */ - 69, /* FONT_GOTHIC_BOLD_12 */ - 68, /* FONT_GOTHIC_ITALIC_12 */ - 87, /* FONT_LETTER_GOTHIC_12 */ - 110, /* FONT_LETTER_GOTHIC_BOLD_12 */ - 19, /* FONT_OCR_A_10 */ - 3, /* FONT_OCR_B_10 */ - 5, /* FONT_ORATOR_10 */ - 38, /* FONT_ORATOR_BOLD_10 */ - 12, /* FONT_PRESTIGE_10 */ - 86, /* FONT_PRESTIGE_12 */ - 221, /* FONT_PRESTIGE_15 */ - 111, /* FONT_PRESTIGE_BOLD_12 */ - 112, /* FONT_PRESTIGE_ITALIC_12 */ - 41, /* FONT_ROMAN_10 */ - 84, /* FONT_SCRIPT_12 */ - 42, /* FONT_SERIF_10 */ - 70, /* FONT_SERIF_12 */ - 229, /* FONT_SERIF_15 */ - 72, /* FONT_SERIF_BOLD_12 */ - 43, /* FONT_SERIF_ITALIC_10 */ - 71 /* FONT_SERIF_ITALIC_12 */ - }; - - - /* The following array stores the width of fonts used by the */ - /* SCS3812Writer class. The order of the fonts in the array (comment */ - /* value) must match the order of the font constants defined in the */ - /* SCS3812Writer class. */ - static final int [] fontWidths = { - 144, /* FONT_COURIER_10 */ - 120, /* FONT_COURIER_12 */ - 96, /* FONT_COURIER_15 */ - 84, /* FONT_COURIER_17 */ - 288, /* FONT_COURIER_5 */ - 144, /* FONT_COURIER_BOLD_10 */ - 84, /* FONT_COURIER_BOLD_17 */ - 288, /* FONT_COURIER_BOLD_5 */ - 144, /* FONT_COURIER_ITALIC_10 */ - 120, /* FONT_COURIER_ITALIC_12 */ - 144, /* FONT_GOTHIC_10 */ - 120, /* FONT_GOTHIC_12 */ - 108, /* FONT_GOTHIC_13 */ - 96, /* FONT_GOTHIC_15 */ - 72, /* FONT_GOTHIC_20 */ - 54, /* FONT_GOTHIC_27 */ - 144, /* FONT_GOTHIC_BOLD_10 */ - 120, /* FONT_GOTHIC_BOLD_12 */ - 120, /* FONT_GOTHIC_ITALIC_12 */ - 120, /* FONT_LETTER_GOTHIC_12 */ - 120, /* FONT_LETTER_GOTHIC_BOLD_12 */ - 144, /* FONT_OCR_A_10 */ - 144, /* FONT_OCR_B_10 */ - 144, /* FONT_ORATOR_10 */ - 144, /* FONT_ORATOR_BOLD_10 */ - 144, /* FONT_PRESTIGE_10 */ - 120, /* FONT_PRESTIGE_12 */ - 96, /* FONT_PRESTIGE_15 */ - 120, /* FONT_PRESTIGE_BOLD_12 */ - 120, /* FONT_PRESTIGE_ITALIC_12 */ - 144, /* FONT_ROMAN_10 */ - 120, /* FONT_SCRIPT_12 */ - 144, /* FONT_SERIF_10 */ - 120, /* FONT_SERIF_12 */ - 96, /* FONT_SERIF_15 */ - 120, /* FONT_SERIF_BOLD_12 */ - 144, /* FONT_SERIF_ITALIC_10 */ - 120 /* FONT_SERIF_ITALIC_12 */ - }; - - - /* The following array stores code values used by the SCS writer */ - /* classes. The order of the array must match the codePageID */ - /* array. */ - static final int [] codePage = { - 0, - 29, - 37, - 38, - 256, - 259, - 260, - 273, - 274, - 275, - 276, - 277, - 278, - 279, - 280, - 281, - 282, - 283, - 284, - 285, - 286, - 287, - 288, - 289, - 290, - 297, - 305, - 310, - 340, - 361, - 420, - 423, - 424, - 437, - 500, - 803, - 831, - 870, - 871, - 875, - 880, - 892, - 893, - 905, - 1026, - 1002 }; - - - /* The following array stores code page IDs used in the SCGL */ - /* command. The order of the array must match that of the */ - /* codePage array. */ - static final byte [] codePageID = { - (byte)0xFF, /* 0 */ - (byte)0xFF, /* 29 */ - (byte)0x01, /* 37 */ - (byte)0xFF, /* 38 */ - (byte)0xFF, /* 256 */ - (byte)0xFF, /* 259 */ - (byte)0xFF, /* 260 */ - (byte)0x02, /* 273 */ - (byte)0x03, /* 274 */ - (byte)0x03, /* 275 */ - (byte)0x05, /* 276 */ - (byte)0x06, /* 277 */ - (byte)0x07, /* 278 */ - (byte)0x08, /* 279 */ - (byte)0x09, /* 280 */ - (byte)0x0A, /* 281 */ - (byte)0x0C, /* 282 */ - (byte)0x0D, /* 283 */ - (byte)0x0E, /* 284 */ - (byte)0x0F, /* 285 */ - (byte)0xFF, /* 286 */ - (byte)0xFF, /* 287 */ - (byte)0xFF, /* 288 */ - (byte)0xFF, /* 289 */ - (byte)0x0B, /* 290 */ - (byte)0x08, /* 297 */ - (byte)0x0D, /* 305 */ - (byte)0xFF, /* 310 */ - (byte)0xFF, /* 340 */ - (byte)0xFF, /* 361 */ - (byte)0xFF, /* 420 */ - (byte)0xFF, /* 423 */ - (byte)0xFF, /* 424 */ - (byte)0xFF, /* 437 */ - (byte)0xFF, /* 500 */ - (byte)0xFF, /* 803 */ - (byte)0xFF, /* 831 */ - (byte)0xFF, /* 870 */ - (byte)0xFF, /* 871 */ - (byte)0xFF, /* 875 */ - (byte)0xFF, /* 880 */ - (byte)0xFF, /* 892 */ - (byte)0xFF, /* 893 */ - (byte)0xFF, /* 905 */ - (byte)0xFF, /*1026 */ - (byte)0xFF }; /*1002 */ - -} diff --git a/cvsroot/src/com/ibm/as400/access/SQLArray.java b/cvsroot/src/com/ibm/as400/access/SQLArray.java deleted file mode 100644 index 0e2b8a3eb..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLArray.java +++ /dev/null @@ -1,476 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// - -//JTOpen (IBM Toolbox for Java - OSS version) - -//Filename: SQLArray.java - -//The source code contained herein is licensed under the IBM Public License -//Version 1.0, which has been approved by the Open Source Initiative. -//Copyright (C) 2009-2009 International Business Machines Corporation and -//others. All rights reserved. - -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -//@array new class -class SQLArray implements SQLData -{ - static final String copyright = "Copyright (C) 2009-2010 International Business Machines Corporation and others."; - - private SQLData[] values_; // Since lobs do conversion during execute (not - // setLob()), let SQLData objects manage - // conversion and truncation etc for each - // element - private int arrayCount_ = 0; - private SQLData contentTemplate_; // This is just a reference to the SQLData type that this array contains which is cloned at set() time - //It will reflect the prepare/describe metadata both for DB input and output - private int elemDataTypeLen_ = 0; //needed for to/fromRawBytes - private int vrm_; - - SQLArray() - { - // restrict type-less array construction - } - - /** - * - * @param elemDataTypeLen The length of the datatype that are in the array - * @param contentTemplate A dummy SQLDataX object used for cloning - * @param vrm Version - */ - public SQLArray(int elemDataTypeLen, SQLData contentTemplate, int vrm) - { - - values_ = null; // length not known at prepare/describe time. - contentTemplate_ = contentTemplate; // contains type, length, etc - vrm_ = vrm; - elemDataTypeLen_ = elemDataTypeLen; - } - - public Object clone() - { - - //Just clone with attrs with no data - SQLArray cpy = new SQLArray(elemDataTypeLen_, contentTemplate_, vrm_); - - return cpy; - } - - /* populate values_[] with data from host. */ - public void convertFromRawBytes(byte[] rawBytes, int offset, - ConvTable converter) throws SQLException - { - values_ = new SQLData[arrayCount_]; - for (int x = 0; x < arrayCount_; x++) - { - values_[x] = (SQLData)contentTemplate_.clone(); //create empty SQLX objects - //No need to deal with locators in arrays here. They are not supported in locators due to QQ constraint - try{ //@dec - values_[x].convertFromRawBytes(rawBytes, offset, converter); - }catch(NumberFormatException e) //@dec - { //@dec - //ignore since null array elements will have invalid decimal/numeric value bits - } //@dec - offset += elemDataTypeLen_; //values_[x].getActualSize(); - } - } - - /* copy data from values_[] to stream for sending to host. */ - public void convertToRawBytes(byte[] rawBytes, int offset, - ConvTable ccsidConverter) throws SQLException - { - for (int x = 0; x < arrayCount_; x++) - { - if(values_ != null && values_[x] != null) //@array null element - values_[x].convertToRawBytes(rawBytes, offset, ccsidConverter); - else - { - //for arrays, we set the element null indicator here since we don't really have the offset before now - contentTemplate_.convertToRawBytes(rawBytes, offset, ccsidConverter); - } - offset += elemDataTypeLen_; //values_[x].getActualSize(); - } - } - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - //note that we could be getting a user-defined Array as input - Object[] data = (Object[]) ((Array) object).getArray(); // These elements must be wrapped in a type wrapper before calling (ie Integer, not int) - if(data == null) - data = new Object[0]; //if null array just make 0 length array - - arrayCount_ = data.length; - values_ = new SQLData[arrayCount_]; - - boolean isSQLData = false; - //since values can be null, don't check if data_[0] is instance of SQLData - if((arrayCount_ > 0) && (data[0] != null) && (data instanceof SQLData[])) - isSQLData = true; //data was output from previous and is still in SQLData object - - for (int x = 0; x < arrayCount_; x++) - { - //prepare/describe is the type that we ARE. - //create sqlX objects and let them do conversion from input type to actual type - values_[x] = (SQLData)contentTemplate_.clone(); //create empty SQLX objects - //@array no locators supported in qq of arrays...none to set here - - Object inObj; - if(isSQLData) - inObj = ((SQLData)data[x]).getObject(); - else - inObj = data[x];//can be null array element - - if(inObj == null) - setElementNull(x); - else - values_[x].set(inObj, calendar, scale); //let the SQLX objects do the conversions - } - } - - public int getActualSize() - { - - int totalSize = 0; - for (int x = 0; x < arrayCount_; x++) - { - totalSize += values_[x].getActualSize(); - } - return totalSize; - } - - public InputStream getAsciiStream() throws SQLException - { - - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) throws SQLException - { - - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public byte[] getBytes() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - public String getNString() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - /* ifdef JDBC40 - - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -endif */ - - /* ifdef JDBC40 - - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -endif */ - public Date getDate(Calendar calendar) throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public float getFloat() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public int getInt() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public long getLong() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public short getShort() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public String getString() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Time getTime(Calendar calendar) throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - // @array - public Array getArray() throws SQLException - { - /*Object[] content = new Object[values_.length]; - for(int x = 0; x < values_.length; x++) - { - content[x] = values_[x].getObject(); //get in default object type - }*/ - - //return new AS400JDBCArray with array of SQLData[] as elements - return new AS400JDBCArray(contentTemplate_.getTypeName(), values_, vrm_, null); - } - - public String getCreateParameters() - { - - return null; - } - - public int getDisplaySize() - { - - return 0; - } - - public String getJavaClassName() - { - return "java.sql.Array"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "ARRAY"; - } - - public int getMaximumPrecision() - { - return 0; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - - return 0; - } - - public int getNativeType() - { - return SQLData.NATIVE_ARRAY; - //For arrays, we don't have a native type number, just a bit flag in the stream header - } - - //array only method - public int getElementNativeType() - { - return contentTemplate_.getNativeType(); //works if elems are null - //if(values_ != null && values_.length > 0) - // return values_[0].getNativeType(); - //else - // return getNativeType(); //should not ever return this with current design, but better than null pointers - - } - - /* //array only method - public int getElementSize() - { - return getActualSize(); - - } -*/ - public Object getObject() throws SQLException - { - return getArray(); - } - - public int getPrecision() - { - - return 0; - } - - public int getRadix() - { - - return 0; - } - - public int getSQLType() - { - - return SQLData.ARRAY; - } - - public int getScale() - { - - return 0; - } - - public int getTruncated() - { - return 0; - } - - public int getType() { - - return java.sql.Types.ARRAY; - } - - public String getTypeName() - { - - return "ARRAY"; - } - - public boolean isSigned() - { - return values_[0].isSigned(); - } - - public boolean isText() - { - return values_[0].isText(); - - } - - public void setArrayCount(int count) - { - arrayCount_ = count; - } - - public int getArrayCount() - { - return arrayCount_; - } - - public void setElementNull(int element) - { - values_[element] = null; - } - - public boolean isElementNull(int element) - { - if( values_[element] == null) - return true; - else - return false; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SQLBigint.java b/cvsroot/src/com/ibm/as400/access/SQLBigint.java deleted file mode 100644 index 0f6fd9563..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLBigint.java +++ /dev/null @@ -1,527 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLBigint.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/*ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/*ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLBigint -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private static final BigInteger LONG_MAX_VALUE = BigInteger.valueOf(Long.MAX_VALUE); - private static final BigInteger LONG_MIN_VALUE = BigInteger.valueOf(Long.MIN_VALUE); - - // Private data. - private int truncated_ = 0; - private long value_ = 0; - private int vrm_; //@trunc3 - - SQLBigint(int vrm) //@trunc3 - { //@trunc3 - vrm_ = vrm; //@trunc3 - } //@trunc3 - - public Object clone() - { - return new SQLBigint(vrm_); //@trunc3 - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = BinaryConverter.byteArrayToLong(rawBytes, offset); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - BinaryConverter.longToByteArray(value_, rawBytes, offset); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - truncated_ = 0; - - if(object instanceof String) - { - // @BWS - changed how we parse this because people want to pass in 111222.333 for an int - // and using a double is causing rounding errors. We use a BigDecimal for the - // case that we have to "try again" because if people were interested in performance - // they would not set a floating point value on an integer field and expect it to work - // so we would never hit the BigDecimal code path... - - try - { - value_ = Long.parseLong((String)object); - } - catch(NumberFormatException nfe) - { - try - { - BigInteger bigInteger = new BigDecimal((String)object).toBigInteger(); - if((bigInteger.compareTo(LONG_MAX_VALUE) > 0) || (bigInteger.compareTo(LONG_MIN_VALUE) < 0)) - { - truncated_ = bigInteger.toByteArray().length - 8; - //@trunc3 match native for ps.setString() to throw mismatch instead of truncation - if(vrm_ >= JDUtilities.vrm610) //@trunc3 - { //@trunc3 - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); //@trunc3 - } //@trunc3 - } - value_ = bigInteger.longValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - } - } - } - - else if(object instanceof Number) - { - // Compute truncation by getting the value as a double - // and comparing it against MAX_VALUE/MIN_VALUE. - double doubleValue = ((Number)object).doubleValue(); - - if((doubleValue > Long.MAX_VALUE) || (doubleValue < Long.MIN_VALUE)) // @D9a - { - // Note: Truncated here is set to 1 byte because the - // value has to be something positive in order - // for the code that checks it to do the right - // thing. - truncated_ = 1; // @D9a - } - - value_ = ((Number)object).longValue(); - - // @D9d - // Compute truncation. @Wz put the following three lines back in - // double doubleValue = ((Number) object).doubleValue(); - // if(doubleValue != value_) - // truncated_ = Double.toString(doubleValue - value_).length() / 2; - } - - else if(object instanceof Boolean) - value_ = (((Boolean)object).booleanValue() == true) ? 1 : 0; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.BIGINT; - } - - //@E1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.Long"; - } - - public String getCreateParameters() - { - return null; - } - - public int getDisplaySize() - { - return 20; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "BIGINT"; - } - - public int getMaximumPrecision() - { - return 19; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 492; // @A1C - } - - public int getPrecision() - { - return 19; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.BIGINT; - } - - public String getTypeName() - { - return "BIGINT"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return 8; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(Long.toString(value_))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - if(scale <= 0) - return BigDecimal.valueOf(value_); - else - return BigDecimal.valueOf(value_).setScale(scale); - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new ByteArrayInputStream(BinaryConverter.longToByteArray(value_)); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - byte[] bytes = BinaryConverter.longToByteArray(value_); - return new AS400JDBCBlob(bytes, bytes.length); - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_ != 0); - } - - public byte getByte() - throws SQLException - { - if(value_ > Byte.MAX_VALUE || value_ < Byte.MIN_VALUE) - { - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 7; - - } - else - { - truncated_ = 3; - } - } - else - { - truncated_ = 1; - } - } - - return(byte) value_; - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - return BinaryConverter.longToByteArray(value_); - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - return new StringReader(Long.toString(value_)); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - String string = Long.toString(value_); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - return(double) value_; - } - - public float getFloat() - throws SQLException - { - if(value_ > Float.MAX_VALUE || value_ < -Float.MAX_VALUE) //@trunc min_val is a positive number. //Float.MIN_VALUE) - { - truncated_ = 4; - } - else - { - truncated_ = 0; - } - - return(float) value_; - } - - public int getInt() - throws SQLException - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 4; - } - else - { - truncated_ = 0; - } - - return(int) value_; - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return new Long(value_); - } - - public short getShort() - throws SQLException - { - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 6; - - } - else - { - truncated_ = 2; - } - } - - return(short) value_; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - return Long.toString(value_); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(Long.toString(value_))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; //@pdc - return new StringReader(Long.toString(value_)); //@pdc - } - - //@pda jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - String string = Long.toString(value_); - return new AS400JDBCNClob(string, string.length()); - } -endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - return Long.toString(value_); - } - - //@pda jdbc40 - /* ifdef JDBC40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -endif */ - - //@pda jdbc40 - /* ifdef JDBC40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLBinary.java b/cvsroot/src/com/ibm/as400/access/SQLBinary.java deleted file mode 100644 index e98c38450..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLBinary.java +++ /dev/null @@ -1,641 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLBinary.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLBinary -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private SQLConversionSettings settings_; - private int maxLength_; - private int truncated_; - private AS400ByteArray typeConverter_; - private byte[] value_; - - SQLBinary(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - maxLength_ = maxLength; - truncated_ = 0; - typeConverter_ = new AS400ByteArray(maxLength); - value_ = new byte[maxLength]; - } - - public Object clone() - { - return new SQLBinary(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - value_ = (byte[])typeConverter_.toObject(rawBytes, offset); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - typeConverter_.toBytes(value_, rawBytes, offset); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(object instanceof String) - { - try - { - value_ = BinaryConverter.stringToBytes((String)object); - } - catch(NumberFormatException nfe) - { - // we throw a data type mismatch exception here because the - // value of the Clob contained characters that were not valid hex - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else if(object instanceof byte[]) - value_ = (byte[])object; - - else if(object instanceof InputStream) - { - //value_ = JDUtilities.streamToBytes((InputStream)object, scale); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(object instanceof Reader) - { - // value_ = SQLBinary.stringToBytes(JDUtilities.readerToString((Reader)object, scale)); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - stream.close(); //@scan1 - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - - stream.close(); //@scan1 - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Blob) - value_ = ((Blob)object).getBytes(1, (int)((Blob)object).length()); - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - try - { - value_ = BinaryConverter.stringToBytes(((Clob)object).getSubString(1, (int)((Clob)object).length())); - } - catch(NumberFormatException nfe) - { - // we throw a data type mismatch exception here because the - // value of the Clob contained characters that were not valid hex - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Set to the exact length. - int valueLength = value_.length; - if(valueLength < maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, valueLength); - value_ = newValue; - truncated_ = 0; - } - else if(valueLength > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - truncated_ = valueLength - maxLength_; - } - else - truncated_ = 0; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.BINARY; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - public String getLiteralPrefix() - { - return "BINARY(X\'"; //@5WXVJX changed from x' - } - - public String getLiteralSuffix() - { - return "\')"; //@5WXVJX changed from ' - } - - public String getLocalName() - { - return "BINARY"; - } - - public int getMaximumPrecision() - { - return 32765; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 912; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.BINARY; - } - - public String getTypeName() - { - return "BINARY"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length; - } - - public String getJavaClassName() - { - return "[B"; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return new ByteArrayInputStream(getBytes()); - } - - public Blob getBlob() - throws SQLException - { - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCBlob(getBytes(), maxLength_); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length > maxFieldSize) && (maxFieldSize > 0)) - { - byte[] truncatedValue = new byte[maxFieldSize]; - System.arraycopy(value_, 0, truncatedValue, 0, maxFieldSize); - return truncatedValue; - } - else - { - return value_; - } - } - - public Reader getCharacterStream() - throws SQLException - { - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - - public Clob getClob() - throws SQLException - { - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCClob(BinaryConverter.bytesToHexString(getBytes()), maxLength_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return getBytes(); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - - //@PDA jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCNClob(BinaryConverter.bytesToHexString(getBytes()), maxLength_); - } - endif */ - - //@PDA jdbc40 - public String getNString() throws SQLException - { - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } - - //@PDA jdbc40 - /* ifdef JDBC40 - - public RowId getRowId() throws SQLException - { - //Decided this is of no use because rowid is so specific to the dbms internals. - //And there are issues in length and difficulties in converting a binary to a - //valid rowid that is useful. - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - //@PDA jdbc40 - /* ifdef JDBC40 - - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLBlob.java b/cvsroot/src/com/ibm/as400/access/SQLBlob.java deleted file mode 100644 index c5054e65d..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLBlob.java +++ /dev/null @@ -1,670 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLBlob.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLBlob implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2010 International Business Machines Corporation and others."; - - private static final byte[] default_ = new byte[0]; - - private int maxLength_; - private int truncated_; - private byte[] value_ = default_; - private Object savedObject_; // This is our byte[] or InputStream or whatever that we save to convert to bytes until we really need to. - private int scale_ = -1; // This is our length. - - SQLBlob(int maxLength, SQLConversionSettings settings) - { - maxLength_ = maxLength; - } - - public Object clone() - { - return new SQLBlob(maxLength_, null); - } - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int length = BinaryConverter.byteArrayToInt(rawBytes, offset); - value_ = new byte[length]; - System.arraycopy(rawBytes, offset+4, value_, 0, value_.length); - savedObject_ = null; - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - if(savedObject_ != null) doConversion(); - - BinaryConverter.intToByteArray(value_.length, rawBytes, offset); - System.arraycopy(value_, 0, rawBytes, offset+4, value_.length); - } - - public void set(Object object, Calendar calendar, int scale) throws SQLException - { - // If it's a byte[] we check for data truncation. - if(object instanceof byte[]) - { - byte[] bytes = (byte[])object; - truncated_ = (bytes.length > maxLength_ ? bytes.length-maxLength_ : 0); - } - else if(object instanceof String) - { - byte[] bytes = null; - try - { - bytes = BinaryConverter.stringToBytes((String)object); - } - catch(NumberFormatException nfe) - { - // the String contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - object = bytes; - truncated_ = 0; - } - else if(object instanceof Reader) - { - int length = scale; // hack to get the length into the set method - byte[] bytes = null; - if(length >= 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - bytes = baos.toByteArray(); - - if(bytes.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - int objectLength = bytes.length; - if(bytes.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(bytes, 0, newValue, 0, maxLength_); - bytes = newValue; - } - stream.close(); //@scan1 - object = bytes; - truncated_ = objectLength - bytes.length; - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - bytes = baos.toByteArray(); - - int objectLength = bytes.length; - if(bytes.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(bytes, 0, newValue, 0, maxLength_); - bytes = newValue; - } - stream.close(); //@scan1 - object = bytes; - truncated_ = objectLength - bytes.length; - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if((JDUtilities.JDBCLevel_ >= 20 && !(object instanceof Blob)) && - !(object instanceof InputStream)) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - savedObject_ = object; - if(scale != -1) scale_ = scale; - } - - private void doConversion() - throws SQLException - { - try - { - Object object = savedObject_; - if(object instanceof byte[]) - { - value_ = (byte[]) object; - int objectLength = value_.length; - if(value_.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - } - truncated_ = objectLength - value_.length; - } - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Blob) - { - Blob blob = (Blob) object; - int blobLength = (int)blob.length(); - int lengthToUse = blobLength < 0 ? 0x7FFFFFFF : blobLength; - if(lengthToUse > maxLength_) lengthToUse = maxLength_; - value_ = blob.getBytes(1, lengthToUse); - truncated_ = blobLength - lengthToUse; - } - else if(object instanceof InputStream) - { - int length = scale_; // hack to get the length into the set method - if(length >= 0) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - - value_ = baos.toByteArray(); - - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - int objectLength = value_.length; - if(value_.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - } - truncated_ = objectLength - value_.length; - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - - value_ = baos.toByteArray(); - - int objectLength = value_.length; - if(value_.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - } - truncated_ = objectLength - value_.length; - } - else - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - } - finally - { - savedObject_ = null; - } - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.BLOB; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCBlob"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "BLOB"; - } - - public int getMaximumPrecision() - { - return AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; //@xml3 // the DB2 SQL reference says this should be 2147483647 but we return 1 less to allow for NOT NULL columns - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 404; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.BLOB; - } - - public String getTypeName() - { - return "BLOB"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; //@CRS - Why is this true? - } - - public int getActualSize() - { - return value_.length; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(BinaryConverter.bytesToHexString(value_))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) //@CRS - Could use a Converter here to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new ByteArrayInputStream(value_); - } - - public Blob getBlob() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCBlob(value_, maxLength_); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return value_; - } - - public Reader getCharacterStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new StringReader(BinaryConverter.bytesToHexString(value_)); - } - - public Clob getClob() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - String string = BinaryConverter.bytesToHexString(value_); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) //@CRS - Could use toLong() to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() //@CRS - Could use a Converter here to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() //@CRS - Could use a Converter here to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() //@CRS - Could use a Converter here to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() //@CRS - Could use a Converter here to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCBlob(value_, maxLength_); - } - - public short getShort() //@CRS - Could use a Converter here to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return BinaryConverter.bytesToHexString(value_); - } - - public Time getTime(Calendar calendar) //@CRS - Could use toLong() to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) //@CRS - Could use toLong() to make this work. - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(BinaryConverter.bytesToHexString(value_))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - if(savedObject_ != null) doConversion(); //@pdc - truncated_ = 0; //@pdc - return new StringReader(BinaryConverter.bytesToHexString(value_)); //@pdc - } - - //@PDA jdbc40 - /* ifdef JDBC40 - - public NClob getNClob() throws SQLException - { - if(savedObject_ != null) doConversion(); //@pdc - truncated_ = 0;//@pdc - String string = BinaryConverter.bytesToHexString(value_); //@pdc - return new AS400JDBCNClob(string, string.length()); //@pdc - } - endif */ - //@PDA jdbc40 - public String getNString() throws SQLException - { - if(savedObject_ != null) doConversion(); //@pdc - truncated_ = 0; //@pdc - return BinaryConverter.bytesToHexString(value_); //@pdc - } - /* ifdef JDBC40 - - //@PDA jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@PDA jdbc40 - public SQLXML getSQLXML() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - //String string = BinaryConverter.bytesToHexString(value_); //@xml2 - return new AS400JDBCSQLXML(value_, maxLength_); //@xml2 - //return new AS400JDBCSQLXML(string, string.length()); //@xml2 - } - endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLBlobLocator.java b/cvsroot/src/com/ibm/as400/access/SQLBlobLocator.java deleted file mode 100644 index 8f35774fb..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLBlobLocator.java +++ /dev/null @@ -1,877 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLBlobLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - - -final class SQLBlobLocator implements SQLLocator -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private AS400JDBCConnection connection_; - private ConvTable converter_; - private int id_; - private JDLobLocator locator_; - private int maxLength_; - private SQLConversionSettings settings_; - private int truncated_; - private int columnIndex_; - private byte[] value_; //@loch //Note that value_ is not used as the output for a ResultSet.getX() call. We Get the value from a call to the JDLocator (not from value_) and not from the savedObject_, unless resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - - private Object savedObject_; // This is the AS400JDBCBlobLocator or InputStream or whatever got set into us. - private int scale_; // This is actually the length that got set into us. - - SQLBlobLocator(AS400JDBCConnection connection, - int id, - int maxLength, - SQLConversionSettings settings, - ConvTable converter, - int columnIndex) - { - connection_ = connection; - id_ = id; - locator_ = new JDLobLocator(connection, id, maxLength, false); //@CRS - We know it's not graphic, because we are not a DBClob. - maxLength_ = maxLength; - settings_ = settings; - truncated_ = 0; - converter_ = converter; - columnIndex_ = columnIndex; - } - - public Object clone() - { - return new SQLBlobLocator(connection_, id_, maxLength_, settings_, converter_, columnIndex_); - } - - public void setHandle(int handle) - { - locator_.setHandle(handle); - } - - //@loch - public int getHandle() - { - return locator_.getHandle(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int locatorHandle = BinaryConverter.byteArrayToInt(rawBytes, offset); - locator_.setHandle(locatorHandle); - locator_.setColumnIndex(columnIndex_); - } - - //@CRS - This is only called from AS400JDBCPreparedStatement in one place. - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - BinaryConverter.intToByteArray(locator_.getHandle(), rawBytes, offset); - - // Now we write our saved data to the system, because the prepared statement is being executed. - // We used to write the data to the system on the call to set(), but this messed up - // batch executes, since the host server only reserves temporary space for locator handles one row at a time. - // See the toObject() method in this class for more details. - if(savedObject_ != null) writeToServer(); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - // This method actually writes the data to the system. - private void writeToServer() - throws SQLException - { - if(savedObject_ instanceof byte[]) - { - byte[] bytes = (byte[])savedObject_; - locator_.writeData(0, bytes, true); //@K1A - } - else if(savedObject_ instanceof InputStream) - { - int length = scale_; // hack to get the length into the set method - - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); //@K1A - } - else if(length > 0) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - locator_.writeData(totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. @K1A - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - if(totalBytesRead < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2 ) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - locator_.writeData(totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. @K1A - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(JDUtilities.JDBCLevel_ >= 20 && savedObject_ instanceof Blob) //@H0A check for jdbc level to know if lobs exist - { - // @A1C - //@G5A Start new code for updateable locator case to go through the Vectors - //@G5A and update the blob copy when ResultSet.updateBlob() is called. - boolean set = false; - if(savedObject_ instanceof AS400JDBCBlobLocator) - { - AS400JDBCBlobLocator blob = (AS400JDBCBlobLocator)savedObject_; - - //Synchronize on a lock so that the user can't keep making updates - //to the blob while we are taking updates off the vectors. - synchronized(blob) - { - // See if we saved off our real object from earlier. - if(blob.savedObject_ != null) - { - savedObject_ = blob.savedObject_; - scale_ = blob.savedScale_; - blob.savedObject_ = null; - writeToServer(); - return; - } - } - } - - //@G5A If the code for updateable lob locators did not run, then run old code. - if(!set) - { - Blob blob = (Blob)savedObject_; // @A1C - int length = (int)blob.length(); - byte[] data = blob.getBytes(1, length); - locator_.writeData(0, data, 0, length, true); //@K1A - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - // If it's a byte[] we can check for data truncation. - if(object instanceof byte[]) - { - byte[] bytes = (byte[])object; - truncated_ = (bytes.length > maxLength_ ? bytes.length-maxLength_ : 0); - } - else if(object instanceof String) - { - byte[] bytes = null; - try - { - bytes = BinaryConverter.stringToBytes((String)object); - } - catch(NumberFormatException nfe) - { - // the String contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - object = bytes; - truncated_ = 0; - } - else if(object instanceof Reader) - { - int length = scale; // hack to get the length into the set method - byte[] bytes = null; - if(length >= 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - bytes = baos.toByteArray(); - - if(bytes.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - int objectLength = bytes.length; - if(bytes.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(bytes, 0, newValue, 0, maxLength_); - bytes = newValue; - } - stream.close(); //@scan1 - object = bytes; - truncated_ = objectLength - bytes.length; - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - bytes = baos.toByteArray(); - - int objectLength = bytes.length; - if(bytes.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(bytes, 0, newValue, 0, maxLength_); - bytes = newValue; - } - stream.close(); //@scan1 - object = bytes; - truncated_ = objectLength - bytes.length; - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(!(object instanceof String) && - (JDUtilities.JDBCLevel_ >= 20 && !(object instanceof Blob)) && - !(object instanceof Reader) && - !(object instanceof InputStream)) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - savedObject_ = object; - if(scale != -1) scale_ = scale; // Skip resetting it if we don't know the real length - } - - //@loch method to temporary convert from object input to output before even going to host (writeToServer() does the conversion needed before writting to host) - //This will only be used when resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - //Purpose is to do a local type conversion from obj1 to obj2 like other non-locator lob types - private void doConversion() - throws SQLException - { - try - { - Object object = savedObject_; - if(object instanceof byte[]) - { - value_ = (byte[]) object; - int objectLength = value_.length; - if(value_.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - } - truncated_ = objectLength - value_.length; - } - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Blob) - { - Blob blob = (Blob) object; - int blobLength = (int)blob.length(); - int lengthToUse = blobLength < 0 ? 0x7FFFFFFF : blobLength; - if(lengthToUse > maxLength_) lengthToUse = maxLength_; - value_ = blob.getBytes(1, lengthToUse); - truncated_ = blobLength - lengthToUse; - } - else if(object instanceof InputStream) - { - int length = scale_; // hack to get the length into the set method - if(length >= 0) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - - value_ = baos.toByteArray(); - - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - int objectLength = value_.length; - if(value_.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - } - truncated_ = objectLength - value_.length; - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - - value_ = baos.toByteArray(); - - int objectLength = value_.length; - if(value_.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - } - truncated_ = objectLength - value_.length; - } - else - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - } - finally - { - //nothing - } - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.BLOB_LOCATOR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - //@D1A JDBC 3.0 - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCBlobLocator"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "BLOB"; - } - - public int getMaximumPrecision() - { - return AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; //@xml3 // the DB2 SQL reference says this should be 2147483647 but we return 1 less to allow for NOT NULL columns - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 960; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.BLOB; - } - - public String getTypeName() - { - return "BLOB"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return maxLength_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - //return new AS400JDBCInputStream(new JDLobLocator(locator_)); - - // fix this to use a Stream - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new AS400JDBCInputStream(new JDLobLocator(locator_)); - } - - public Blob getBlob() - throws SQLException - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCBlob(value_, maxLength_); //@loch - } //@loch - - // We don't want to give out our internal locator to the public, - // otherwise when we go to change its handle on the next row, they'll - // get confused. So we have to clone it. - truncated_ = 0; - return new AS400JDBCBlobLocator(new JDLobLocator(locator_), savedObject_, scale_); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - throws SQLException - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return value_;//@loch - } //@loch - - int locatorLength = (int)locator_.getLength(); - if(locatorLength == 0) return new byte[0]; - DBLobData data = locator_.retrieveData(0, locatorLength); - int actualLength = data.getLength(); - byte[] bytes = new byte[actualLength]; - System.arraycopy(data.getRawBytes(), data.getOffset(), bytes, 0, actualLength); - truncated_ = 0; - return bytes; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - //return new InputStreamReader(new AS400JDBCInputStream(new JDLobLocator(locator_))); - - // fix this to use a Stream - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - String string = BinaryConverter.bytesToHexString(getBytes()); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - // toObject is used by AS400JDBCPreparedStatement for batching, so we save off our InputStream - // inside the AS400JDBCBlobLocator. Then, when convertToRawBytes() is called, the writeToServer() - // code checks the AS400JDBCBlobLocator's saved InputStream... if it exists, then it writes the - // data out of the InputStream to the system by calling writeToServer() again. - - // Since toObject could also be called from an external user's standpoint, we have - // to clone our internal locator (because we reuse it internally). - // This doesn't make much sense, since we technically can't reuse it because - // the prepared statement is calling toObject() to store off the parameters, - // but it's all we can do for now. - truncated_ = 0; - return new AS400JDBCBlobLocator(new JDLobLocator(locator_), savedObject_, scale_); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - return BinaryConverter.bytesToHexString(getBytes()); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - //return new AS400JDBCInputStream(new JDLobLocator(locator_)); - - // fix this to use a Stream - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; //@PDC - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); //@PDC - } - - //@PDA jdbc40 - /* ifdef JDBC40 - - public NClob getNClob() throws SQLException - { - truncated_ = 0; - String string = BinaryConverter.bytesToHexString(getBytes());//@pdc - return new AS400JDBCNClob(string, string.length()); //@pdc - } -endif */ - //@PDA jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; //@pdc - return BinaryConverter.bytesToHexString(getBytes()); //@pdc - } - - /* ifdef JDBC40 - - //@PDA jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -endif */ - - /* ifdef JDBC40 - - //@PDA jdbc40 - public SQLXML getSQLXML() throws SQLException - { - truncated_ = 0; - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCSQLXML(value_, value_.length);//@loch - } //@loch - - String string = BinaryConverter.bytesToHexString(getBytes()); - //return new AS400JDBCSQLXML(string, string.length()); - return new AS400JDBCSQLXMLLocator(new JDLobLocator(locator_), savedObject_, scale_); //@xml3 - } - -endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLChar.java b/cvsroot/src/com/ibm/as400/access/SQLChar.java deleted file mode 100644 index 297c07791..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLChar.java +++ /dev/null @@ -1,716 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLChar.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.CharConversionException; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.net.URL; - -final class SQLChar -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int maxLength_; - private int truncated_; - private String value_; - - SQLChar(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; // @C4C - } - - public Object clone() - { - return new SQLChar(maxLength_,settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - try{ - value_ = ccsidConverter.byteArrayToString(rawBytes, offset, maxLength_, bidiConversionProperties); //@KBC bidiStringType); - }catch(Exception e){ - JDError.throwSQLException(JDError.EXC_CHAR_CONVERSION_INVALID, e); - } - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - try - { - //in cases of variable length chars, check for truncation after conversion - truncated_ = ccsidConverter.stringToByteArray(value_, rawBytes, offset, maxLength_, bidiConversionProperties); //@KBC bidiStringType); //@trnc - } - catch(CharConversionException e) - { - maxLength_ = ccsidConverter.stringToByteArray(value_, bidiConversionProperties).length; //@KBC changed to use bidiConversionProperties_ instead of bidiStringType - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e, "Change Descriptor"); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - String value = null; // @C2A - - if(object instanceof String) - value = (String)object; // @C2C - - else if(object instanceof Character) - value = object.toString(); - - else if(object instanceof Number) - value = object.toString(); // @C2C - - else if(object instanceof Boolean) - { - // @PDC - // if "translate boolean" == false, then use "0" and "1" values to match native driver - if(settings_.getTranslateBoolean() == true) - value = object.toString(); //"true" or "false" - else - value = ((Boolean)object).booleanValue() == true ? "1" : "0"; - } - else if(object instanceof Time) - value = SQLTime.timeToString((Time)object, settings_, calendar); // @C2C - - else if(object instanceof Timestamp) - value = SQLTimestamp.timestampToString((Timestamp)object, calendar); // @C2C - - else if(object instanceof java.util.Date) // @F5M @F5C - value = SQLDate.dateToString((java.util.Date)object, settings_, calendar); // @C2C @F5C - - else if(object instanceof URL) - value = object.toString(); - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value = clob.getSubString(1, (int)clob.length()); - } - // @C2C - /* ifdef JDBC40 - - else if(object instanceof SQLXML) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value = xml.getString(); - } -endif */ - if(value == null) // @C2C - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - value_ = value; // @C2A - - // Set to the exact length. - int valueLength = value_.length(); - int exactLength = getDisplaySize(); // @C1A - if(valueLength < exactLength) // @C1C - { - StringBuffer buffer = new StringBuffer(value_); - char c = '\u0020'; // @F66c - Pad with single byte space for now - for(int i = valueLength; i < exactLength; ++i) // @C1C - buffer.append(c); //@F6C - value_ = buffer.toString(); - truncated_ = 0; - } - else if(valueLength > exactLength) - { // @C1C @F6C - value_ = value_.substring(0, exactLength); // @C1C - truncated_ = valueLength - exactLength; // @C1C - } - else - truncated_ = 0; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.CHAR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "CHAR"; - } - - public int getMaximumPrecision() - { - return 32765; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 452; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.CHAR; - } - - public String getTypeName() - { - return "CHAR"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(getString().trim())); // @F3C - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(getString())); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(getString()), maxLength_); - } - catch(NumberFormatException nfe) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true", "false", "1", or "0", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = getString().trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).byteValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - if(d > Byte.MAX_VALUE || d < Byte.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.byteValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(getString(), settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).intValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Integer.MAX_VALUE || d < Integer.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.intValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).longValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Long.MAX_VALUE || d < Long.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.longValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).shortValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Short.MAX_VALUE || d < Short.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.shortValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length() - maxFieldSize; - return value_.substring(0, maxFieldSize); - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(getString(), settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(getString(), calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - - try - { - return new ReaderInputStream(new StringReader(getString()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - // @A1A - // Added method trim() to trim the string. - public void trim() // @A1A - { // @A1A - value_ = value_.trim(); // @A1A - } // @A1A - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } - - //@pda jdbc40 - /* ifdef JDBC40 - - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } - - //@pda jdbc40 - /* ifdef JDBC40 - - public RowId getRowId() throws SQLException - { - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this string contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - //@pda jdbc40 - /* ifdef JDBC40 - - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } - endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLCharForBitData.java b/cvsroot/src/com/ibm/as400/access/SQLCharForBitData.java deleted file mode 100644 index baa478b15..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLCharForBitData.java +++ /dev/null @@ -1,671 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLCharForBitData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLCharForBitData -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private SQLConversionSettings settings_; - private int maxLength_; - private int truncated_; - private AS400ByteArray typeConverter_; - private byte[] value_; - - SQLCharForBitData(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - maxLength_ = maxLength; - truncated_ = 0; - typeConverter_ = new AS400ByteArray(maxLength); - value_ = new byte[maxLength]; - } - - public Object clone() - { - return new SQLCharForBitData(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = (byte[])typeConverter_.toObject(rawBytes, offset); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - typeConverter_.toBytes(value_, rawBytes, offset); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(object instanceof String) - { - try - { - value_ = BinaryConverter.stringToBytes((String)object); // @F1A - } - catch(NumberFormatException nfe) - { - // the String contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else if(object instanceof byte[]) - value_ = (byte[])object; // @C1C - - else if(object instanceof InputStream) - { - //value_ = JDUtilities.streamToBytes((InputStream)object, scale); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(length == -2 ) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(object instanceof Reader) - { - // value_ = BinaryConverter.stringToBytes(JDUtilities.readerToString((Reader)object, scale)); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - stream.close(); //@scan1 - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - stream.close(); //@scan1 - - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Blob) - value_ = ((Blob)object).getBytes(1, (int)((Blob)object).length()); // @C1C @E2C Blobs are 1 based. - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - try - { - value_ = BinaryConverter.stringToBytes(((Clob)object).getSubString(1, (int)((Clob)object).length())); //@F1A - } - catch(NumberFormatException nfe) - { - // the Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - - // Set to the exact length. - int valueLength = value_.length; - if(valueLength < maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, valueLength); - value_ = newValue; - truncated_ = 0; - } - else if(valueLength > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - truncated_ = valueLength - maxLength_; - } - else - truncated_ = 0; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.CHAR_FOR_BIT_DATA; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - public String getLiteralPrefix() - { - return "X\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - // Use "CHAR" not "BINARY". See ODBC SQLGetTypeInfo(). - return "CHAR() FOR BIT DATA"; //@KKB changed from CHAR - } - - public int getMaximumPrecision() - { - return 32765; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 452; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.BINARY; - } - - public String getTypeName() - { - return "CHAR() FOR BIT DATA"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length; - } - - //@F2A JDBC 3.0 - public String getJavaClassName() - { - return "[B"; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - - // changed to return stream containing hex string - // return new ByteArrayInputStream(toBytes()); - - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - - return new ByteArrayInputStream(getBytes()); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - - return new AS400JDBCBlob(getBytes(), maxLength_); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length - maxFieldSize; - byte[] truncatedValue = new byte[maxFieldSize]; - System.arraycopy(value_, 0, truncatedValue, 0, maxFieldSize); - return truncatedValue; - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - //@F1D return new StringReader (new String(toBytes())); - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); //@F1A - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - //@F1D return new AS400JDBCClob(new String(toBytes())); - return new AS400JDBCClob(BinaryConverter.bytesToHexString(getBytes()), maxLength_); //@F1A - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return getBytes(); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - //@F1D return new String (toBytes()); - return BinaryConverter.bytesToHexString(getBytes()); //@F1A - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - - // changed to return stream containing hex string - // return new ByteArrayInputStream(toBytes()); - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - - //@PDA jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCNClob(BinaryConverter.bytesToHexString(getBytes()), maxLength_); - } - endif */ - - //@PDA jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } - - //@PDA jdbc40 - /* ifdef JDBC40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - //@PDA jdbc40 - /* ifdef JDBC40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLClob.java b/cvsroot/src/com/ibm/as400/access/SQLClob.java deleted file mode 100644 index 7dc2a8c80..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLClob.java +++ /dev/null @@ -1,629 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLClob.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -/* ifdef JDBC40 -import java.sql.SQLXML; //@PDA jdbc40 -endif */ -final class SQLClob implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private int length_; // Length of string, in characters. - private int maxLength_; // Max length of field, in bytes. - private SQLConversionSettings settings_; - private int truncated_; - private String value_; - private Object savedObject_; // This is our byte[] or InputStream or whatever that we save to convert to bytes until we really need to. - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLClob(int maxLength, SQLConversionSettings settings) - { - length_ = 0; - maxLength_ = maxLength; - settings_ = settings; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLClob(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToInt(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - value_ = ccsidConverter.byteArrayToString(rawBytes, offset + 4, length_, bidiConversionProperties); //@KBC changed to used bidiConversionProperties instead of bidiStringType - savedObject_ = null; - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - if(savedObject_ != null) doConversion(); - - //@PDC change to do same as SQLVarchar to get true length of byte array instead of number of chars - //BinaryConverter.intToByteArray(length_, rawBytes, offset); - try - { - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - //@PDC ccsidConverter.stringToByteArray(value_, rawBytes, offset + 4, maxLength_, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - byte[] temp = ccsidConverter.stringToByteArray(value_, bidiConversionProperties); - // The length in the first 4 bytes is actually the length in characters. - BinaryConverter.intToByteArray(temp.length, rawBytes, offset); - if(temp.length > maxLength_) - { - maxLength_ = temp.length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL, "Change Descriptor"); - } - System.arraycopy(temp, 0, rawBytes, offset+4, temp.length); - } - catch(Exception e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - //@selins1 make same as SQLCloblocator - // If it's a String we check for data truncation. - if(object instanceof String) - { - String s = (String)object; - int byteLength = s.length(); //@selins1 - truncated_ = (byteLength > maxLength_ ? byteLength-maxLength_ : 0); - } - //@PDD jdbc40 (JDUtilities.JDBCLevel_ >= 20 incorrect logic, but n/a now - else if(!(object instanceof Clob) && //@PDC NClob extends Clob - !(object instanceof Reader) && //@PDC jdbc40 - !(object instanceof InputStream) -/* ifdef JDBC40 - && !(object instanceof SQLXML) -endif */ - ) //@PDC jdbc40 - - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - savedObject_ = object; - if(scale != -1) length_ = scale; - } - - private void doConversion() - throws SQLException - { - try - { - Object object = savedObject_; - if(savedObject_ instanceof String) - { - value_ = (String)object; - } - else if(object instanceof Reader) - { - if(length_ >= 0) - { - try - { - int blockSize = length_ < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length_ : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 && totalCharsRead < length_) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - int charsRemaining = length_ - totalCharsRead; - if(charsRemaining < blockSize) - { - blockSize = charsRemaining; - } - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - - if(value_.length() < length_) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length_ == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - // int charsRemaining = length_ - totalCharsRead; - - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value_ = clob.getSubString(1, (int)clob.length()); - } - /* ifdef JDBC40 - else if( object instanceof SQLXML ) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value_ = xml.getString(); - } - endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - // Truncate if necessary. - int valueLength = value_.length(); - if(valueLength > maxLength_) - { - value_ = value_.substring(0, maxLength_); - truncated_ = valueLength - maxLength_; - } - else - { - truncated_ = 0; - } - - length_ = value_.length(); - } - finally - { - savedObject_ = null; - } - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.CLOB; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCClob"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "CLOB"; - } - - public int getMaximumPrecision() - { - return AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; //@xml3 // the DB2 SQL reference says this should be 2147483647 but we return 1 less to allow for NOT NULL columns - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 408; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.CLOB; - } - - public String getTypeName() - { - return "CLOB"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_)); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new HexReaderInputStream(new StringReader(value_)); - } - - public Blob getBlob() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(value_), maxLength_); - } - catch(NumberFormatException nfe) - { - // this Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public byte[] getBytes() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(value_); - } - catch(NumberFormatException nfe) - { - // this Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new StringReader(value_); - } - - public Clob getClob() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCClob(value_, maxLength_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public Object getObject() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCClob(value_, maxLength_); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public String getString() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return value_; - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(value_), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new StringReader(value_); - } - - //@pda jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCNClob(value_, maxLength_); - } - endif */ - //@pda jdbc40 - public String getNString() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return value_; - } - - //@pda jdbc40 - /* ifdef JDBC40 - public RowId getRowId() throws SQLException - { - // - //if(savedObject_ != null) doConversion(); - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this Clob contains non-hex characters - //JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - //return null; - //} - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - //@pda jdbc40 - /* ifdef JDBC40 - public SQLXML getSQLXML() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCSQLXML(value_.toCharArray()); - } - endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLClobLocator.java b/cvsroot/src/com/ibm/as400/access/SQLClobLocator.java deleted file mode 100644 index a83373a5c..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLClobLocator.java +++ /dev/null @@ -1,974 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLClobLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - - -final class SQLClobLocator implements SQLLocator -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private AS400JDBCConnection connection_; - private SQLConversionSettings settings_; - private ConvTable converter_; - private int id_; - private JDLobLocator locator_; - private int maxLength_; - private int truncated_; - private int columnIndex_; - private String value_; //@loch //Note that value_ is not used as the output for a ResultSet.getX() call. We Get the value from a call to the JDLocator (not from value_) and not from the savedObject_, unless resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - - private Object savedObject_; // This is the AS400JDBCBlobLocator or InputStream or whatever got set into us. - private int scale_; // This is actually the length that got set into us. - - SQLClobLocator(AS400JDBCConnection connection, - int id, - int maxLength, - SQLConversionSettings settings, - ConvTable converter, - int columnIndex) - { - connection_ = connection; - id_ = id; - locator_ = new JDLobLocator(connection, id, maxLength, false); - maxLength_ = maxLength; - truncated_ = 0; - settings_ = settings; - converter_ = converter; - columnIndex_ = columnIndex; - } - - public Object clone() - { - return new SQLClobLocator(connection_, id_, maxLength_, settings_, converter_, columnIndex_); - } - - public void setHandle(int handle) - { - locator_.setHandle(handle); - } - - //@loch - public int getHandle() - { - return locator_.getHandle(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int locatorHandle = BinaryConverter.byteArrayToInt(rawBytes, offset); - locator_.setHandle(locatorHandle); - locator_.setColumnIndex(columnIndex_); - } - - //@CRS - This is only called from AS400JDBCPreparedStatement in one place. - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - BinaryConverter.intToByteArray(locator_.getHandle(), rawBytes, offset); - - // Now we write our saved data to the system, because the prepared statement is being executed. - // We used to write the data to the system on the call to set(), but this messed up - // batch executes, since the host server only reserves temporary space for locator handles one row at a time. - // See the toObject() method in this class for more details. - if(savedObject_ != null) writeToServer(); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - //@selins1 make same as SQLClob - // If it's a String we check for data truncation. - if(object instanceof String) - { - String s = (String)object; - int length = s.length(); - truncated_ = (length > maxLength_ ? length-maxLength_ : 0); - } - else if( !(object instanceof Reader) && - !(object instanceof InputStream) && - (JDUtilities.JDBCLevel_ >= 20 && !(object instanceof Clob)) -/*ifdef JDBC40 - && !(object instanceof SQLXML) -endif*/ - ) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - savedObject_ = object; - if(scale != -1) scale_ = scale; // Skip resetting it if we don't know the real length - } - - //@loch method to temporary convert from object input to output before even going to host (writeToServer() does the conversion needed before writing to host) - //This will only be used when resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - //Purpose is to do a local type conversion from obj1 to obj2 like other non-locator lob types - private void doConversion() - throws SQLException - { - int length_ = scale_; - - if( length_ == -1) - { - try{ - //try to get length from locator - length_ = (int)locator_.getLength(); - }catch(Exception e){ } - } - - try - { - Object object = savedObject_; - if(savedObject_ instanceof String) - { - value_ = (String)object; - } - else if(object instanceof Reader) - { - if(length_ >= 0) - { - try - { - int blockSize = length_ < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length_ : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 && totalCharsRead < length_) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - int charsRemaining = length_ - totalCharsRead; - if(charsRemaining < blockSize) - { - blockSize = charsRemaining; - } - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - - if(value_.length() < length_) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length_ == -2)//@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if( object instanceof Clob) - { - Clob clob = (Clob)object; - value_ = clob.getSubString(1, (int)clob.length()); - } - /* ifdef JDBC40 - else if( object instanceof SQLXML ) - { - SQLXML xml = (SQLXML)object; - value_ = xml.getString(); - } - endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - // Truncate if necessary. - int valueLength = value_.length(); - if(valueLength > maxLength_) - { - value_ = value_.substring(0, maxLength_); - } - } - finally - { - //nothing - } - } - - private void writeToServer() - throws SQLException - { - try - { - Object object = savedObject_; - if(object instanceof String) - { - String string = (String)object; - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = converter_.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - byte[] bytes = converter_.stringToByteArray(string, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - locator_.writeData(0L, bytes, true); //@K1C - } - else if(object instanceof Reader) - { - int length = scale_; // hack to get the length into the set method - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); //@K1C - } - else if(length > 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = converter_.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - ReaderInputStream stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); //@KBC changed to use bidiConversionProperties instead of bidiStringType - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - locator_.writeData((long)totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. @K1C - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - if(stream.available() == 0 && blockSize != 0) - { - stream.close(); //@scan1 - stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); // do this so we don't read more chars out of the Reader than we have to. //@KBC changed to use bidiConversionProperties instead of bidiStringType - } - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - stream.close(); //@scan1 - - if(totalBytesRead < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2)//@readerlen new else-if block (read all data) - { - try - { - //String readerStr = JDUtilities.readerToString((Reader)savedObject_); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = converter_.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - ReaderInputStream stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); //@KBC changed to use bidiConversionProperties instead of bidiStringType - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - locator_.writeData((long)totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. @K1C - totalBytesRead += bytesRead; - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - stream.close(); //@scan1 - - - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(object instanceof InputStream) - { - int length = scale_; // hack to get the length into the set method - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); //@K1C - } - else if(length > 0) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - locator_.writeData((long)totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. @K1C - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - if(totalBytesRead < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2)//@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - locator_.writeData((long)totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. @K1C - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) //@H0A check for jdbc level to know if lobs exist - { - //@G5A Start new code for updateable locator case - boolean set = false; - if(object instanceof AS400JDBCClobLocator) - { - AS400JDBCClobLocator clob = (AS400JDBCClobLocator)object; - - //Synchronize on a lock so that the user can't keep making updates - //to the clob while we are taking updates off the vectors. - synchronized(clob) - { - // See if we saved off our real object from earlier. - if(clob.savedObject_ != null) - { - savedObject_ = clob.savedObject_; - scale_ = clob.savedScale_; - clob.savedObject_ = null; - writeToServer(); - return; - } - } - } - - //@G5A If the code for updateable lob locators did not run, then run old code. - if(!set) - { - Clob clob = (Clob)object; - int length = (int)clob.length(); - String substring = clob.getSubString(1, length); - locator_.writeData(0L, converter_.stringToByteArray(substring), 0, length, true); //@K1C - set = true; - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - /*ifdef JDBC40 - else if( object instanceof SQLXML ) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - - String stringVal = xml.getString(); - locator_.writeData(0L, converter_.stringToByteArray(stringVal), 0, stringVal.length(), true); - } - endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - finally - { - savedObject_ = null; - } - scale_ = (int)locator_.getLength(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.CLOB_LOCATOR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCClobLocator"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "CLOB"; - } - - public int getMaximumPrecision() - { - return AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; //@xml3 // the DB2 SQL reference says this should be 2147483647 but we return 1 less to allow for NOT NULL columns - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 964; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.CLOB; - } - - public String getTypeName() - { - return "CLOB"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return maxLength_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_));//@loch - } //@loch - - return new ReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()), 819); // ISO-8859-1. - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new HexReaderInputStream(new StringReader(value_)); //@loch - } //@loch - - return new HexReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - byte[] bytes = BinaryConverter.stringToBytes(getString()); - return new AS400JDBCBlob(bytes, bytes.length); - } - catch(NumberFormatException nfe) - { - // this Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - // this Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new StringReader(value_); //@loch - } //@loch - - return new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCClob(value_, maxLength_); //@loch - } //@loch - - return new AS400JDBCClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // getObject is used by AS400JDBCPreparedStatement for batching, so we save off our InputStream - // inside the AS400JDBCClobLocator. Then, when convertToRawBytes() is called, the writeToServer() - // code checks the AS400JDBCClobLocator's saved InputStream... if it exists, then it writes the - // data out of the InputStream to the system by calling writeToServer() again. - return new AS400JDBCClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public String getString() - throws SQLException - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return value_; //@loch - } //@loch - - DBLobData data = locator_.retrieveData(0, locator_.getMaxLength()); - String value = converter_.byteArrayToString(data.getRawBytes(), - data.getOffset(), - data.getLength()); - truncated_ = 0; //@pda make consistent with other SQLData Clob classes - return value; - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new ReaderInputStream(new StringReader(value_), 13488); //@loch - } //@loch - - - return new ReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); - return null; - } - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new StringReader(value_); //@loch - } //@loch - - try - { - return new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCNClob(value_, maxLength_); //@loch - } //@loch - - return new AS400JDBCNClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - - } - endif */ - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return value_; //@loch - } //@loch - - DBLobData data = locator_.retrieveData(0, locator_.getMaxLength()); - String value = converter_.byteArrayToString(data.getRawBytes(), - data.getOffset(), - data.getLength()); - return value; - } - - //@pda jdbc40 - /* ifdef JDBC40 - public RowId getRowId() throws SQLException - { - - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(getString())); - //} - //catch(NumberFormatException nfe) - //{ - // this Clob contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - //@pda jdbc40 - /* ifdef JDBC40 - public SQLXML getSQLXML() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCSQLXML(value_, maxLength_); //@loch - } //@loch - - //return new AS400JDBCSQLXML( getString().toCharArray() ); - return new AS400JDBCSQLXMLLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_, false); //@xml3 //@xml4 - } - endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLConversionSettings.java b/cvsroot/src/com/ibm/as400/access/SQLConversionSettings.java deleted file mode 100644 index cb9076418..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLConversionSettings.java +++ /dev/null @@ -1,247 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLConversionSettings.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; - - - -/** -This class keeps track of the current data formatting options. -Storing these in a single object not only makes it more convenient -to pass around, but also enables the settings to be changed -on-the-fly and be reflected in existing data. -**/ -class SQLConversionSettings -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - - // Formatting constants. Using constants makes - // quick comparisons and switch-case statements easier. - // All constant values correspond directly to the index - // of the string in the JDProperties class. - public static final int DATE_FORMAT_JULIAN = 0; - public static final int DATE_FORMAT_MDY = 1; - public static final int DATE_FORMAT_DMY = 2; - public static final int DATE_FORMAT_YMD = 3; - public static final int DATE_FORMAT_USA = 4; - public static final int DATE_FORMAT_ISO = 5; - public static final int DATE_FORMAT_EUR = 6; - public static final int DATE_FORMAT_JIS = 7; - - public static final int TIME_FORMAT_HMS = 0; - public static final int TIME_FORMAT_USA = 1; - public static final int TIME_FORMAT_ISO = 2; - public static final int TIME_FORMAT_EUR = 3; - public static final int TIME_FORMAT_JIS = 4; - - - - - // Private data. - private int dateFormat_; - private String dateSeparator_; - private String decimalSeparator_; - private int maxFieldSize_; - private int timeFormat_; - private String timeSeparator_; - private boolean useBigDecimal_; // @E0A - private int bidiStringType_; // @E1A - private boolean bidiImplicitReordering_; // @KBA - private boolean bidiNumericOrdering_; // @KBA - private boolean translateBoolean_; // @PDA - - - -/** -Constructs a SQLConversionSettings object. - -@param connection Connection to the system. -**/ - SQLConversionSettings (AS400JDBCConnection connection) - throws SQLException - { - JDProperties properties = connection.getProperties (); - - dateFormat_ = properties.getIndex (JDProperties.DATE_FORMAT); - dateSeparator_ = properties.getString (JDProperties.DATE_SEPARATOR); - decimalSeparator_ = properties.getString (JDProperties.DECIMAL_SEPARATOR); - timeFormat_ = properties.getIndex (JDProperties.TIME_FORMAT); - timeSeparator_ = properties.getString (JDProperties.TIME_SEPARATOR); - bidiStringType_ = getInt(properties.getString (JDProperties.BIDI_STRING_TYPE)); // @E1A - bidiImplicitReordering_ = properties.getBoolean(JDProperties.BIDI_IMPLICIT_REORDERING); //@KBA - bidiNumericOrdering_ = properties.getBoolean(JDProperties.BIDI_NUMERIC_ORDERING); //@KBA - - if (dateSeparator_.equalsIgnoreCase (JDProperties.DATE_SEPARATOR_SPACE)) - dateSeparator_ = " "; - if (timeSeparator_.equalsIgnoreCase (JDProperties.TIME_SEPARATOR_SPACE)) - timeSeparator_ = " "; - - maxFieldSize_ = 0; - useBigDecimal_ = properties.getBoolean(JDProperties.BIG_DECIMAL); // @E0A - translateBoolean_ = properties.getBoolean(JDProperties.TRANSLATE_BOOLEAN); // @PDA - } - - - //@E1A - /** - Get int value of bidiString property which is a string. Return -1 if empty string - (property not set) since 0 is BidiStringType.DEFAULT. - - @return The int value of a string bidiString property. - **/ - int getInt (String value) - { - try { - return Integer.parseInt (value); - } - catch (NumberFormatException e) { - return -1; - } - } - - - //@E1A - /** - Returns the bidi string type. - - @return The bidi string type. - **/ - int getBidiStringType () - { - return bidiStringType_; - } - - //@KBA - boolean getBidiImplicitReordering() - { - return bidiImplicitReordering_; - } - - //@KBA - boolean getBidiNumericOrdering() - { - return bidiNumericOrdering_; - } - - //@PDA - boolean getTranslateBoolean() - { - return translateBoolean_; - } - - -/** -Returns the current date format. - -@return The date format. -**/ - int getDateFormat () - { - return dateFormat_; - } - - - -/** -Returns the current date separator. - -@return The date separator. -**/ - String getDateSeparator () - { - return dateSeparator_; - } - - - -/** -Returns the current decimal separator. - -@return The decimal separator. -**/ - String getDecimalSeparator () - { - return decimalSeparator_; - } - - - -/** -Returns the current max field size. - -@return The max field size (in bytes). -**/ - int getMaxFieldSize () - { - return maxFieldSize_; - } - - - -/** -Returns the current time format. - -@return The time format. -**/ - int getTimeFormat () - { - return timeFormat_; - } - - - -/** -Returns the current time separator. - -@return The time separator. -**/ - String getTimeSeparator () - { - return timeSeparator_; - } - - - -/** -Sets the current max field size. - -@param maxFieldSize The maximum field size - (in bytes). -**/ - void setMaxFieldSize (int maxFieldSize) - { - maxFieldSize_ = maxFieldSize; - } - - -// @E0A -/** -Indicates if packed/zoned decimal conversions should -use a BigDecimal. - -@return true of packed/zoned decimal conversions should - use a BigDecimal, false otherwise. -**/ - boolean useBigDecimal() - { - return useBigDecimal_; - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLDBClob.java b/cvsroot/src/com/ibm/as400/access/SQLDBClob.java deleted file mode 100644 index 8508cdf98..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLDBClob.java +++ /dev/null @@ -1,617 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLDBClob.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLDBClob implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - private int length_; // Length of string, in characters. @E3C - private int maxLength_; // Max length of field, in bytes. @E3C - private SQLConversionSettings settings_; - private int truncated_; - private String value_; - private Object savedObject_; // This is our byte[] or InputStream or whatever that we save to convert to bytes until we really need to. - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLDBClob(int maxLength, SQLConversionSettings settings) - { - length_ = 0; - maxLength_ = maxLength; - settings_ = settings; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLDBClob(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToInt(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - // If the field is DBCLOB, length_ contains the number - // of characters in the string, while the converter is expecting - // the number of bytes. Thus, we need to multiply length_ by 2. - value_ = ccsidConverter.byteArrayToString(rawBytes, offset + 4, length_*2, bidiConversionProperties); //@KBA changed to use bidiConversionProperties instead of bidiStringType - savedObject_ = null; - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - if(savedObject_ != null) doConversion(); - - BinaryConverter.intToByteArray(length_, rawBytes, offset); - try - { - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - ccsidConverter.stringToByteArray(value_, rawBytes, offset + 4, maxLength_, bidiConversionProperties); //@KBC changed to bidiConversionProperties instead of bidiStringType - } - catch(Exception e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - //@selins1 make similar to SQLDBClobLocator - // If it's a String we check for data truncation. - if(object instanceof String) - { - String s = (String)object; - int byteLength = s.length() * 2; //@selins1 - truncated_ = (byteLength > maxLength_ ? byteLength-maxLength_ : 0); //@selins1 - } else if( !(object instanceof Reader) && - !(object instanceof InputStream) && - (JDUtilities.JDBCLevel_ >= 20 && !(object instanceof Clob)) -/*ifdef JDBC40 - && !(object instanceof SQLXML) -endif */ - - - ) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - savedObject_ = object; - if(scale != -1) length_ = scale; - } - - private void doConversion() throws SQLException - { - try - { - Object object = savedObject_; - if(savedObject_ instanceof String) - { - value_ = (String)object; - } - else if(object instanceof Reader) - { - if(length_ >= 0) - { - try - { - int blockSize = length_ < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length_ : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 && totalCharsRead < length_) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - int charsRemaining = length_ - totalCharsRead; - if(charsRemaining < blockSize) - { - blockSize = charsRemaining; - } - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length_ == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 ) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value_ = clob.getSubString(1, (int)clob.length()); - } - /* ifdef JDBC40 - - else if(object instanceof SQLXML) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value_ = xml.getString(); - } - endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - // Truncate if necessary. - int valueLength = value_.length(); - if(valueLength > maxLength_) - { - value_ = value_.substring(0, maxLength_); - truncated_ = valueLength - maxLength_; - } - else - { - truncated_ = 0; - } - - length_ = value_.length(); - } - finally - { - savedObject_ = null; - } - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.DBCLOB; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return(maxLength_ / 2); - } - - - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCClob"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "DBCLOB"; - } - - public int getMaximumPrecision() - { - return 1073741822; // the DB2 SQL reference says this should be 1073741823 but we return 1 less to allow for NOT NULL columns - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 412; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.CLOB; - } - - public String getTypeName() - { - return "DBCLOB"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_)); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new HexReaderInputStream(new StringReader(value_)); - } - - public Blob getBlob() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(value_), maxLength_); - } - catch(NumberFormatException nfe) - { - // this DBClob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public byte[] getBytes() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(value_); - } - catch(NumberFormatException nfe) - { - // this DBClob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new StringReader(value_); - } - - public Clob getClob() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCClob(value_, maxLength_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public Object getObject() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCClob(value_, maxLength_); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public String getString() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return value_; - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(value_), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new StringReader(value_); - } - - //@pda jdbc40 - /* ifdef JDBC40 - - public NClob getNClob() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCNClob(value_, maxLength_); - } - endif */ - //@pda jdbc40 - public String getNString() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return value_; - } - - //@pda jdbc40 - /* ifdef JDBC40 - - public RowId getRowId() throws SQLException - { - - //if(savedObject_ != null) doConversion(); - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this Clob contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - //@pda jdbc40 - /* ifdef JDBC40 - public SQLXML getSQLXML() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCSQLXML(value_.toCharArray()); - } - endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SQLDBClobLocator.java b/cvsroot/src/com/ibm/as400/access/SQLDBClobLocator.java deleted file mode 100644 index 772269c88..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLDBClobLocator.java +++ /dev/null @@ -1,958 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLDBClobLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLDBClobLocator implements SQLLocator -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private AS400JDBCConnection connection_; - private ConvTable converter_; - private int id_; - private JDLobLocator locator_; - private int maxLength_; //note length in chars - private SQLConversionSettings settings_; - private int truncated_; - private int columnIndex_; - private String value_; //@loch //Note that value_ is not used as the output for a ResultSet.getX() call. We Get the value from a call to the JDLocator (not from value_) and not from the savedObject_, unless resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - - private Object savedObject_; // This is the AS400JDBCBlobLocator or InputStream or whatever got set into us. - private int scale_; // This is actually the length that got set into us. - - SQLDBClobLocator(AS400JDBCConnection connection, - int id, - int maxLength, - SQLConversionSettings settings, - ConvTable converter, - int columnIndex) - { - connection_ = connection; - id_ = id; - locator_ = new JDLobLocator(connection, id, maxLength, true); - maxLength_ = maxLength; - settings_ = settings; - truncated_ = 0; - converter_ = converter; - columnIndex_ = columnIndex; - } - - public Object clone() - { - return new SQLDBClobLocator(connection_, id_, maxLength_, settings_, converter_, columnIndex_); - } - - public void setHandle(int handle) - { - locator_.setHandle(handle); - } - - //@loch - public int getHandle() - { - return locator_.getHandle(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int locatorHandle = BinaryConverter.byteArrayToInt(rawBytes, offset); - locator_.setHandle(locatorHandle); - locator_.setColumnIndex(columnIndex_); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - BinaryConverter.intToByteArray(locator_.getHandle(), rawBytes, offset); - - // Now we write our saved data to the system, because the prepared statement is being executed. - // We used to write the data to the system on the call to set(), but this messed up - // batch executes, since the host server only reserves temporary space for locator handles one row at a time. - // See the toObject() method in this class for more details. - if(savedObject_ != null) writeToServer(); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) throws SQLException - { - //@selins1 make similar to SQLDBClob - // If it's a String we check for data truncation. - if(object instanceof String) - { - String s = (String)object; - int length = s.length(); - truncated_ = (length > maxLength_ ? length-maxLength_ : 0); - } - else if( !(object instanceof Reader) && - !(object instanceof InputStream) && - (JDUtilities.JDBCLevel_ >= 20 && !(object instanceof Clob)) - /* ifdef JDBC40 - && !(object instanceof SQLXML) - endif*/ - ) - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - - - - savedObject_ = object; - if(scale != -1) scale_ = scale; // Skip resetting it if we don't know the real length - } - - - //@loch method to temporary convert from object input to output before even going to host (writeToServer() does the conversion needed before writting to host) - //This will only be used when resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - //Purpose is to do a local type conversion from obj1 to obj2 like other non-locator lob types - private void doConversion() - throws SQLException - { - int length_ = scale_; - - if( length_ == -1) - { - try{ - //try to get length from locator - length_ = (int)locator_.getLength(); - }catch(Exception e){ } - } - - try - { - Object object = savedObject_; - if(savedObject_ instanceof String) - { - value_ = (String)object; - } - else if(object instanceof Reader) - { - if(length_ >= 0) - { - try - { - int blockSize = length_ < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length_ : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 && totalCharsRead < length_) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - int charsRemaining = length_ - totalCharsRead; - if(charsRemaining < blockSize) - { - blockSize = charsRemaining; - } - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length_ == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 ) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if( object instanceof Clob) - { - Clob clob = (Clob)object; - value_ = clob.getSubString(1, (int)clob.length()); - } - /*ifdef JDBC40 - else if( object instanceof SQLXML ) - { - SQLXML xml = (SQLXML)object; - value_ = xml.getString(); - } - endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - // Truncate if necessary. - int valueLength = value_.length(); - if(valueLength > maxLength_) - { - value_ = value_.substring(0, maxLength_); - } - - - } - finally - { - - } - } - - private void writeToServer() throws SQLException - { - Object object = savedObject_; - if(object instanceof String) - { - String string = (String)object; - byte[] bytes = converter_.stringToByteArray(string); - locator_.writeData(0L, bytes, true); //@k1C - } - else if(object instanceof Reader) - { - int length = scale_*2; // We are always graphic. - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); //@K1C - } - else if(length > 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = converter_.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - ReaderInputStream stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); //@KBC changed to use bidiConversionProperties instead of bidiStringType - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - locator_.writeData((long)(totalBytesRead/2), byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. //@K1C //@K2C totalBytesRead is our offset (offset should be in number of characters, not bytes) - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - if(stream.available() == 0 && blockSize != 0) - { - stream.close(); //@scan1 - stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); // do this so we don't read more chars out of the Reader than we have to. //@KBC changed to use bidiConversionProperties instead of bidiStringType - } - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - stream.close(); //@scan1 - - if(totalBytesRead < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -4) //@readerlen new else-if block (read all data) (-2 * 2) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = converter_.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - ReaderInputStream stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); //@KBC changed to use bidiConversionProperties instead of bidiStringType - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - locator_.writeData((long)(totalBytesRead/2), byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. //@K1C //@K2C totalBytesRead is our offset (offset should be in number of characters, not bytes) - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - stream.close(); //@scan1 - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(object instanceof InputStream) - { - int length = scale_*2; // We are always graphic. - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); //@K1C - } - else if(length > 0) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - locator_.writeData((long)(totalBytesRead/2), byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. //@K1C //@K2C offset should be in number of characters not bytes - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - if(totalBytesRead < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -4) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - locator_.writeData((long)(totalBytesRead/2), byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. //@K1C //@K2C offset should be in number of characters not bytes - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - boolean set = false; - if(object instanceof AS400JDBCClobLocator) - { - AS400JDBCClobLocator clob = (AS400JDBCClobLocator)object; - - //Synchronize on a lock so that the user can't keep making updates - //to the clob while we are taking updates off the vectors. - synchronized (clob) - { - // See if we saved off our real object from earlier. - if(clob.savedObject_ != null) - { - savedObject_ = clob.savedObject_; - scale_ = clob.savedScale_; - clob.savedObject_ = null; - writeToServer(); - return; - } - } - } - if(!set) - { - Clob clob = (Clob)object; - int length = (int)clob.length(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - if(length < blockSize) blockSize = length; - int position = 1; - AS400JDBCClobLocator thisClob = new AS400JDBCClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); //@hloc1 getClob() returns local value since it was just set. Here we want the locator on the host so we can write to it. - while(position <= length) - { - String substring = clob.getSubString(position, blockSize); - thisClob.setString(position, substring); - position += blockSize; - if((length - position) < blockSize) - { - blockSize = length - position + 1; - } - } - set = true; - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - /* ifdef JDBC40 - else if( object instanceof SQLXML ) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - - String stringVal = xml.getString(); - - locator_.writeData(0L, converter_.stringToByteArray(stringVal), 0, stringVal.length()*2, true); //@xml4 - } - endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.DBCLOB_LOCATOR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_ / 2; - } - - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCClobLocator"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "DBCLOB"; - } - - public int getMaximumPrecision() - { - return 1073741822; // the DB2 SQL reference says this should be 1073741823 but we return 1 less to allow for NOT NULL columns - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 968; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.CLOB; - } - - public String getTypeName() - { - return "DBCLOB"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return maxLength_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_));//@loch - } //@loch - - return new ReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()), 819); // ISO-8859-1. - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new HexReaderInputStream(new StringReader(value_)); //@loch - } //@loch - - return new HexReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCBlob(BinaryConverter.stringToBytes(value_), maxLength_); - } //@loch - - return new AS400JDBCBlob(BinaryConverter.stringToBytes(getString()), maxLength_); - } - catch(NumberFormatException nfe) - { - // this DBClob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - // this DBClob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new StringReader(value_); //@loch - } //@loch - - return new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCClob(value_, maxLength_); //@loch - } //@loch - - return new AS400JDBCClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public Object getObject() - throws SQLException - { - // getObject is used by AS400JDBCPreparedStatement for batching, so we save off our InputStream - // inside the AS400JDBCClobLocator. Then, when convertToRawBytes() is called, the writeToServer() - // code checks the AS400JDBCClobLocator's saved InputStream... if it exists, then it writes the - // data out of the InputStream to the system by calling writeToServer() again. - truncated_ = 0; - return new AS400JDBCClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public String getString() - throws SQLException - { - - - truncated_ = 0; - Clob c = getClob(); - return c.getSubString(1L, (int)c.length()); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new ReaderInputStream(new StringReader(value_), 13488); //@loch - } //@loch - - return new ReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(locator_), converter_.getCcsid()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new StringReader(value_); //@loch - } //@loch - - try - { - return new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - /* ifdef JDBC40 - - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCNClob(value_, maxLength_); //@loch - } //@loch - - return new AS400JDBCNClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - - } - endif */ - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return value_; //@loch - } //@loch - - DBLobData data = locator_.retrieveData(0, locator_.getMaxLength()); - String value = converter_.byteArrayToString(data.getRawBytes(), - data.getOffset(), - data.getLength()); - return value; - } - - //@pda jdbc40 - /* ifdef JDBC40 - public RowId getRowId() throws SQLException - { - // - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(getString())); - //} - //catch(NumberFormatException nfe) - //{ - // this Clob contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -endif */ - //@pda jdbc40 -/* ifdef JDBC40 - public SQLXML getSQLXML() throws SQLException - { - truncated_ = 0; - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCSQLXML(value_, maxLength_); //@loch - } //@loch - - //return new AS400JDBCSQLXML( getString().toCharArray() ); - return new AS400JDBCSQLXMLLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_, false); //@xml3 //@xml4 - } -endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLData.java b/cvsroot/src/com/ibm/as400/access/SQLData.java deleted file mode 100644 index 6239c4214..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLData.java +++ /dev/null @@ -1,570 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.Ref; -import java.sql.RowId; - endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; - endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -/** -The SQLData interface represents native SQL data. A specific -implementation of this interface will implement a specific -type of SQL data. - -

    The implementation's constructor should not necessarily -initialize the data. That is done via the set() methods. -**/ -interface SQLData -extends Cloneable -{ - //NATIVE_ARRAY is defined here for the array type received from zda. But zda does not have a visible array type. - //zda uses a bit that flags if the stream is an array. - //So we just define it here as 10000. This number is not important; it just needs to be different from other native type numbers. - //This is used in SQLDataFactory and other array related classes. - public static final short NATIVE_ARRAY = 10000; //@array - - public static final int UNDEFINED = 0; - public static final int BIGINT = 1; - public static final int BINARY = 2; - public static final int BLOB = 3; - public static final int BLOB_LOCATOR = 4; - public static final int CHAR = 5; - public static final int CHAR_FOR_BIT_DATA = 6; - public static final int CLOB = 7; - public static final int CLOB_LOCATOR = 8; - public static final int DATALINK = 9; - public static final int DATE = 10; - public static final int DBCLOB = 11; - public static final int DBCLOB_LOCATOR = 12; - public static final int DECIMAL = 13; - public static final int DECIMAL_USING_DOUBLE = 14; - public static final int DOUBLE = 15; - public static final int FLOAT = 16; - public static final int GRAPHIC = 17; - public static final int INTEGER = 18; - public static final int LONG_VARCHAR = 19; - public static final int LONG_VARCHAR_FOR_BIT_DATA = 20; - public static final int LONG_VARGRAPHIC = 21; - public static final int NUMERIC = 22; - public static final int NUMERIC_USING_DOUBLE = 23; - public static final int REAL = 24; - public static final int ROWID = 25; - public static final int SMALLINT = 26; - public static final int TIME = 27; - public static final int TIMESTAMP = 28; - public static final int VARBINARY = 29; - public static final int VARCHAR = 30; - public static final int VARCHAR_FOR_BIT_DATA = 31; - public static final int VARGRAPHIC = 32; - public static final int NCLOB = 33; //@PDA jdbc40 (jdbc40 just added here for info) - public static final int NCLOB_LOCATOR = 34; //@PDA jdbc40 - public static final int NCHAR = 35; //@PDA jdbc40 - public static final int NVARCHAR = 36; //@PDA jdbc40 - public static final int LONG_NVARCHAR = 37; //@pda jdbc40 - public static final int DECFLOAT = 38; //@DFA - public static final int ARRAY = 39; //@array - public static final int XML_LOCATOR = 40; //@xml3 - - /** - Returns a clone of the SQLData object. Use this sparingly - so that we minimize the number of copies. - @return The clone. - **/ - public abstract Object clone(); - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - /** - Loads the contents of the data from raw bytes, as returned - in a reply from the system. - @param rawBytes raw bytes from the system. - @param offset offset. - @param converter the converter. - @exception SQLException If the raw bytes are not in - the expected format. - **/ - public abstract void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable converter) - throws SQLException; - - /** - Converts the contents of the data in raw bytes, as needed - in a request to the system. - @param rawBytes the raw bytes for the system. - @param offset the offset into the byte array. - @param ccsidConverter the converter. - **/ - public abstract void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException; - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - // The set methods initialize the data in a uniform way // - // across all types. If a specific initialization is // - // needed based on a Java type, then add other flavors // - // of set() methods. // - // // - //---------------------------------------------------------// - - /** - Sets the contents of the data based on a Java object. - This performs all conversions described in Table 6 - of the JDBC specification. - @param object a Java object. - @param calendar The calendar. - @param scale The scale. - @exception SQLException If the Java object is not an - appropriate type. - **/ - public abstract void set(Object object, Calendar calendar, int scale) - throws SQLException; - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - // These methods describe information about the actual // - // type of data. // - // // - /*---------------------------------------------------------*/ - - /** - Returns the SQL type constant for the implementing class. - @return the SQL type constant. - **/ - public abstract int getSQLType(); - - /** - Returns the parameters used in creating the - type. - @return the parameters, separated by commas, - or null if none. - **/ - public abstract String getCreateParameters(); - - /** - Returns the display size. This is defined in Appendix - D of the ODBC 2.0 Programmer's Reference. - @return the display size (in characters). - @exception SQLException If the index is invalid - or an error occurs. - **/ - public abstract int getDisplaySize(); - - //@F1A JDBC 3.0 - /** - Returns the Java class name for ParameterMetaData.getParameterClassName(). - @return the Java class name. - **/ - public abstract String getJavaClassName(); - - /** - Returns the prefix used to quote a literal. - @return the prefix, or null if none. - **/ - public abstract String getLiteralPrefix(); - - /** - Returns the suffix used to quote a literal. - @return the suffix, or null if none. - **/ - public abstract String getLiteralSuffix(); - - /** - Returns the localized version of the name of the - data type. - @return the name, or null. - **/ - public abstract String getLocalName(); - - /** - Returns the maximum precision of the type. This is - defined in Appendix D of the ODBC 2.0 Programmer's - Reference. - @return the maximum precision. - **/ - public abstract int getMaximumPrecision(); - - /** - Returns the maximum scale of the type. This is - defined in Appendix D of the ODBC 2.0 Programmer's - Reference. - @return the maximum scale. - **/ - public abstract int getMaximumScale(); - - /** - Returns the minimum scale of the type. This is - defined in Appendix D of the ODBC 2.0 Programmer's - Reference. - @return the minimum scale. - **/ - public abstract int getMinimumScale(); - - /** - Returns the native IBM i identifier for the type. - @return the native type. - **/ - public abstract int getNativeType(); - - /** - Returns the precision of the type. This is - defined in Appendix D of the ODBC 2.0 Programmer's - Reference. - @return the precision. - **/ - public abstract int getPrecision(); - - /** - Returns the radix for the type. - @return the radix. - **/ - public abstract int getRadix(); - - /** - Returns the scale of the type. This is - defined in Appendix D of the ODBC 2.0 Programmer's - Reference. - @return the scale. - **/ - public abstract int getScale(); - - /** - Returns the type constant associated with the type. - @return SQL type code defined in java.sql.Types. - **/ - public abstract int getType(); - - /** - Returns the name of the data type. - @return the name. - **/ - public abstract String getTypeName(); - - /** - Indicates whether the type is signed. - @return true or false - **/ - public abstract boolean isSigned(); - - /** - Indicates whether the type is text. This also - indicates that the associated data needs to be - converted. - @return true or false - **/ - public abstract boolean isText(); - - /** - Returns the actual size of this piece of data in bytes. - @return the actual size of this piece of data in bytes. - **/ - public abstract int getActualSize(); - - /** - Returns the number of bytes truncated by the last conversion - of this piece of data. - @return the number of bytes truncated by the last conversion - **/ - public abstract int getTruncated(); - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - // These methods convert the data to a specific Java // - // type. These conversions should be provided per // - // section 7, table 1 ("Use of ResultSet.getXxx methods // - // to retrieve common SQL data types") of the JDBC 1.10 // - // specification. If a conversion is not required or is // - // not possible given the data, then the method should // - // throw an exception. // - // // - /*---------------------------------------------------------*/ - - /** - Converts the data to a stream of ASCII characters. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract InputStream getAsciiStream() - throws SQLException; - - /** - Converts the data to a Java BigDecimal object. - @param scale scale, or -1 to use full scale. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract BigDecimal getBigDecimal(int scale) - throws SQLException; - - /** - Converts the data to a stream of uninterpreted bytes. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract InputStream getBinaryStream() - throws SQLException; - - /** - Converts the data to a java.sql.Blob object. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Blob getBlob() - throws SQLException; - - /** - Converts the data to a Java boolean. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract boolean getBoolean() - throws SQLException; - - /** - Converts the data to a Java byte. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract byte getByte() - throws SQLException; - - /** - Converts the data to a Java byte array containing - uninterpreted bytes. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract byte[] getBytes() - throws SQLException; - - /** - Converts the data to a java.io.Reader object. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Reader getCharacterStream() - throws SQLException; - - /** - Converts the data to a java.sql.Clob object. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Clob getClob() - throws SQLException; - - /** - Converts the data to a java.sql.Date object. - @param calendar The calendar. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Date getDate(Calendar calendar) - throws SQLException; - - /** - Converts the data to a Java double. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract double getDouble() - throws SQLException; - - /** - Converts the data to a Java float. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract float getFloat() - throws SQLException; - - /** - Converts the data to a Java int. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract int getInt() - throws SQLException; - - /** - Converts the data to a Java long. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract long getLong() - throws SQLException; - - /** - Converts the data to a Java object. The actual type - of the Java object is dictated per section 8, - table 2 ("Standard mapping from SQL types to Java types") - of the JDBC 1.10 specification - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Object getObject() - throws SQLException; - - /** - Converts the data to a Java short. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract short getShort() - throws SQLException; - - /** - Converts the data to a Java String object. This - conversion must be provided by the implementation. - @return the result of the conversion. - **/ - public abstract String getString() - throws SQLException; - - /** - Converts the data to a java.sql.Time object. - @param calendar The calendar. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Time getTime(Calendar calendar) - throws SQLException; - - /** - Converts the data to a java.sql.Timestamp object. - @param calendar The calendar. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Timestamp getTimestamp(Calendar calendar) - throws SQLException; - - /** - Converts the data to a stream of Unicdoe characters. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract InputStream getUnicodeStream() - throws SQLException; - - //@PDA jdbc40 - /** - Converts the data to a java.io.Reader object. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Reader getNCharacterStream() - throws SQLException; - - //@PDA jdbc40 - /** - Converts the data to a java.sql.NClob object - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - /* ifdef JDBC40 - public abstract NClob getNClob() - throws SQLException; - endif */ - //@PDA jdbc40 - /** - Converts the data to String object. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract String getNString() - throws SQLException; - - //@PDA jdbc40 - /** - Converts the data to a java.sql.SQLXML object. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - /* ifdef JDBC40 - public abstract SQLXML getSQLXML() - throws SQLException; - endif */ - - //@PDA jdbc40 - /** - Converts the data to a java.sql.RowId object. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - /* ifdef JDBC40 - - public abstract RowId getRowId() - throws SQLException; - endif */ - - //@array - /** - Converts (returns) the data to a java.sql.Array object. - @return the result of the conversion. - @exception SQLException If the conversion is not - required or not possible. - **/ - public abstract Array getArray() - throws SQLException; - -} diff --git a/cvsroot/src/com/ibm/as400/access/SQLDataFactory.java b/cvsroot/src/com/ibm/as400/access/SQLDataFactory.java deleted file mode 100644 index 22fad05c3..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLDataFactory.java +++ /dev/null @@ -1,892 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLDataFactory.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.math.BigDecimal; -import java.sql.SQLException; -import java.sql.Types; - -/** -

    A factory that generates appropriate SQLData objects given -various conditions. -**/ -class SQLDataFactory -{ - // @C2A - /** - Converts a String representation of a number in scientific - notation to a String representation without scientific - notation. - - @param scientificNotation The String representation of a number - in scientific notation. - @return The String representation without - scientific notation. - **/ - static String convertScientificNotation(String scientificNotation) - { - // Check to see if it is indeed scientific notation. - int e = scientificNotation.indexOf('E'); - if(e < 0) - return scientificNotation; - - // Parse the exponent and ensure that we don't have a number starting with '+' - // as the parseInt function will throw a number format exception if we pass that. - // @F3D int exponent = Integer.parseInt(scientificNotation.substring(e + 1)); - String tempValue = scientificNotation.substring(e + 1); // @F3a - if(tempValue.startsWith("+")) // @F3a - tempValue = tempValue.substring(1); // @F3a - int exponent = Integer.parseInt(tempValue); // @F3a - - // Parse the sign. - boolean sign = (scientificNotation.charAt(0) != '-'); - - String mantissa = scientificNotation.substring(sign ? 0 : 1, e); //@K1A - - //Check to see if the number contains a decimal point. If not, add a decimal point and a 0 to - //the end of the number. - int index = mantissa.indexOf('.'); //@K1A - if(index == -1) //@K1A - { //@K1A - mantissa = mantissa + ".0"; //@K1A - index = mantissa.indexOf('.'); //@K1A - } //@K1A - - StringBuffer buffer = new StringBuffer(); //@K1A - - //Check if the exponent is positive. If it is, move the decimal to the right - if( exponent >= 0 ) //@K1A - { //@k1A - //Determine the new position the decimal should be in - int newLocation = index + exponent; //@K1A - //Copy the numbers before the current decimal - buffer.append(mantissa.substring(0, index)); //@K1A - //Copy the numbers after the decimal - buffer.append(mantissa.substring(index + 1)); //@K1A - mantissa = buffer.toString(); //@K1A - //Determine the length of the string, if the length is less than the new position for the decimal - //must add 0's to the end of the number - int length = mantissa.length(); //@K1A - for (; length newLocation) //@K1A - { - //Copy the digits before the decimal - String temp = buffer.toString().substring(0, newLocation); //@K1A - //put in the decimal - temp = temp + "."; //@K1A - //Copy the rest of the digits to the number - temp = temp + buffer.toString().substring(newLocation); //@K1A - buffer = new StringBuffer(temp); - } - else //@K1A - buffer.append(".0"); //@K1A - } //@K1A - else //negative exponent //@K1A - { //@K1A - //IF the decimal point will be at the beginning - if( (-exponent - index) > 0) //@K1A - { //@K1A - buffer.append("0."); //@K1A - //Pad the number with 0's in front if we have to move the decimal to left more times - //than we currently have digits - for(int i = 0; i< (-exponent - index) ; i++) //@K1A - buffer.append("0"); //@K1A - //copy the digits before the current decimal - buffer.append(mantissa.substring(0, index)); //@K1A - //copy the digits after the current decimal - buffer.append(mantissa.substring(index+1)); //@K1A - } //@K1A - else //A number will be at the beginning //@K1A - { //@K1A - //Copy the number without the current decimal point - String temp = mantissa.substring(0, index); //@K1A - temp = temp + mantissa.substring(index+1); //@K1A - - //Copy the number from the beginning to the location of the new decimal point - buffer.append(temp.substring(0, index + exponent)); //@K1A - //Add the decimal point - buffer.append('.'); //@K1A - //Copy the rest of the number - buffer.append(temp.substring(index + exponent)); //@K1A - } //@K1A - } //@K1A - - //Add the sign to the number and return - String number = (sign ? "" : "-") + buffer.toString(); //@K1A - return number; //@K1A - - /** //@K1D - // Parse the mantissa and pad with either trailing - // or leading 0's based on the sign and magnitude - // of the exponent. - StringBuffer buffer = new StringBuffer(); - if(exponent < 0) - { - int digits = -exponent; - for(int i = 1; i <= digits; ++i) - buffer.append('0'); - buffer.append(scientificNotation.substring(sign ? 0 : 1, e)); - } - else if(exponent >= 0) - { //@G3C Added the equals. - buffer.append(scientificNotation.substring(sign ? 0 : 1, e)); - for(int i = 1; i <= exponent; ++i) - buffer.append('0'); - } - String mantissa = buffer.toString(); - - // All that is left is to move the decimal point. - // So we copy the digits, insert the decimal point - // at the correct place. - int decimalPoint = mantissa.indexOf('.') + exponent; - if(exponent > 0) // @C5A - ++decimalPoint; // @C5A - buffer = new StringBuffer(); - int mantissaLength = mantissa.length(); - for(int i = 0; i < mantissaLength; ++i) - { - if(i == decimalPoint) - buffer.append('.'); - char ch = mantissa.charAt(i); - if(ch != '.') - buffer.append(ch); - } - - // Strip leading and trailing 0's, if any. - int start = 0; - for(; start < buffer.length() && buffer.charAt(start) == '0'; ++start); // @G3C - int end = buffer.length() - 1; - for(; end >= 0 && buffer.charAt(end) == '0'; --end); // @G3C - String result; // @G3C - if(end >= start) - { // @G3A - result = buffer.toString().substring(start, end + 1); // @G3C - } - else - { // @G3A - result = "0"; // @G3A - } // @G3A - - // check to make sure we have more than just "." - if(result.equals(".")) - result = "0.0"; - - // Add the sign and return. - return(sign ? "" : "-") + result; - **/ - } - - /** - Compute the scale of an object. This is the number - of digits to the right of the decimal point. - - @param object A Java object. - @return the scale. - **/ - static int getScale(Object value) - { - int scale = 0; - - String toString = value.toString(); - int point = toString.indexOf('.'); - if(point != -1) - scale = toString.length() - point - 1; - - return scale; - } - - /** - Compute the precision of an object. This is the - total number of digits. - - @param object A Java object. - @return the precision. - **/ - static int getPrecision(Object value) - { - int precision = 0; - - if(value instanceof Boolean) - precision = 1; - - else - { - String toString = value.toString(); - - if(toString.charAt(0) == '-') // @F1a - toString = toString.substring(1); // @F1a - - int length = toString.length(); - - // We need to truncate any padding zeroes. Without this, @E2A - // the precision of 0.1000 was getting computed as 5 rather @E2A - // than 1. // @E2A - int startIndex = -1; // @E2A - int endIndex = length; // @E2A - int pointIndex = toString.indexOf('.'); // @E2A - if(pointIndex >= 0) - { // @E2A - while(toString.charAt(++startIndex) == '0'); // @E2A - while(toString.charAt(--endIndex) == '0'); // @E2A - } // @E2A - else - { // @E2A - startIndex = 0; // @E2A - endIndex = length - 1; // @E2A - } // @E2A - - // Count the characters that are actually digits. @E2A - for(int i = startIndex; i <= endIndex; ++i) // @E2C - if(Character.isDigit(toString.charAt(i))) - ++precision; - } - - return precision; - } - - - //@DFA - /** - Compute the smallest possible precision of a BigDecimal. This is the - total number of digits, disregarding the trailing 0's. Needed so that we can use as - a comparison for truncation. - (ie. 9E17 in BigDecimal is represented as BigInt(900000000000000000), but we want - to calculate precision taking into account that trailing 0's can be represented in an exponent that - is not possible in the BigDecimal object as a negative scale.) - - @param value BigDecimal object. - @param maxSize max size of precision (16 or 34 for decfloats) - @return the precision. - **/ - static int[] getPrecisionForTruncation(BigDecimal value, int maxSize) //@rnd1 - { - int precision = 0; - - String toString = value.unscaledValue().toString(); //value.toString(); 1.6 returns "123E+4", 1.4 returns "1230000" - - //int pointIndex = value.scale();//@rnd1 toString.indexOf('.'); - - if(toString.charAt(0) == '-') - toString = toString.substring(1); - - int length = toString.length(); - - // We need to truncate any ending zeroes. Without this, - // the precision of 1e5 was getting computed as 5 rather - // than 1. - - int endIndex = length; - - //@rnd1 if(pointIndex != 0) - //@rnd1 maxSize++; //allow for extra '.' char - while((toString.charAt(--endIndex) == '0') && (endIndex > maxSize) ); - - int numberZeros = length - endIndex - 1; //@rnd1 - - if(endIndex == maxSize) - { - if(toString.charAt(endIndex) == '0') - {//@rnd1 - precision = endIndex; - numberZeros++; //@rnd1 - }//@rnd1 - else - precision = endIndex + 1; - } - else - precision = endIndex + 1; - - //@rnd1 if(pointIndex != -1) - //@rnd1 precision--; - - - int[] retVal = new int[2]; //@rnd1 - retVal[0] = precision; //@rnd1 - retVal[1] = numberZeros; //@rnd1 - return retVal; //@rnd1 - } - - - /** - Return a SQLData object corresponding to a - a SQL type code defined in java.sql.Types. - In the case where a SQL type code specifies a - type that is not supported in DB2 for IBM i, then - it will map to the next closest type. - - @param sqlType SQL type code defined in java.sql.Types. - @param maxLength Max length of data. - @param precision Precision of data. - @param scale Scale of data. - @param settings The conversion settings. - @param vrm The OS/400 or IBM i Version, Release, and Modification. - @return A SQLData object. - - @exception SQLException If no valid type can be - mapped. - **/ - - //Note: this method is not used anywhere. I am tempted to remove it, but it has a nice history of mapping of sqlTypes to SQLData objects - static SQLData newData(int sqlType, - int maxLength, - int precision, - int scale, - SQLConversionSettings settings, - int vrm, - JDProperties properties) // @M0A - added the JDProperties parm - throws SQLException - { - switch(sqlType) - { // @D0C - - case Types.BIGINT: // @D0A - if(vrm >= JDUtilities.vrm450) // @D0A - return new SQLBigint(vrm); //trunc3 // @D0A - else - return new SQLInteger(vrm); //trunc3 - - case Types.BINARY: - { // @M0C - changed the code to return a - if(vrm >= JDUtilities.vrm530) // @M0C - SQLBinary for v5r3 and newer - return new SQLBinary(maxLength, settings); // @M0C - only because the old SQLBinary - else // @M0C - function has been moved to - return new SQLCharForBitData(maxLength, settings); // @M0C - SQLCharForBitData - } // @M0C - - case Types.BLOB: - return new SQLBlob(maxLength - 4, settings); // @D1C - - case Types.CHAR: - return new SQLChar(maxLength, settings); - - case Types.CLOB: - return new SQLClob(maxLength - 4, settings); // @D1C @E1C - //return new SQLClob(maxLength - 4, false, settings); // @D1C @E1C - - case Types.DATE: - return new SQLDate(settings, -1); // @550C - - case Types.DECIMAL: - if(settings != null) // @E0A - if(! settings.useBigDecimal()) // @E0A - return new SQLDecimal2(precision, scale, settings, vrm, properties); // @M0C - pass the JDProperties so we can get the scale - return new SQLDecimal(precision, scale, settings, vrm, properties); // @M0C // @E0A - - case Types.DOUBLE: - return new SQLDouble(settings); - - case Types.FLOAT: - return new SQLFloat(settings); - - case Types.INTEGER: - return new SQLInteger(vrm); //trunc3 - - case Types.NUMERIC: - if(settings != null) // @E0A - if(! settings.useBigDecimal()) // @E0A - return new SQLNumeric2(precision, scale, settings, vrm, properties); // @M0C - pass the JDProperties so we can get the scale - return new SQLNumeric(precision, scale, settings, vrm, properties); // @M0C // @E0A - - case Types.REAL: - return new SQLReal(settings); - - case Types.SMALLINT: - case Types.TINYINT: // @D0A - case Types.BIT: // @D0A - return new SQLSmallint(vrm); //trunc3 - - case Types.TIME: - return new SQLTime(settings, -1); // @550C - - case Types.TIMESTAMP: - return new SQLTimestamp(settings); - - case Types.VARBINARY: - { - if(vrm >= JDUtilities.vrm530) - return new SQLVarbinary(maxLength, settings); - else - return new SQLVarcharForBitData(maxLength, settings); - } - - case Types.LONGVARBINARY: // @D0A - { // @M0C - changed the code to return a - if(vrm >= JDUtilities.vrm530) // @M0C - SQLVarbinary for v5r3 and newer - return new SQLVarbinary(maxLength, settings); // @M0C - only because the old SQLVarbinary - else // @M0C - function has been moved to - return new SQLLongVarcharForBitData(maxLength, settings); // @M0C - SQLVarcharForBitData - } // @M0C - - case Types.VARCHAR: - return new SQLVarchar(maxLength, settings); - - case Types.LONGVARCHAR: // @D0A - return new SQLLongVarchar(maxLength, settings); // @E1C - - default: - JDError.throwSQLException(JDError.EXC_DATA_TYPE_INVALID); - return null; - - } - } - - /** - Return a SQLData object corresponding to the - specific IBM i native type identifier. - - @param connection The connection. - @param id The id. - @param nativeType An IBM i native type identifier. - @param length Length of data (in bytes). - @param precision Precision of data. - @param scale Scale of data. - @param ccsid CCSID of data field. - @param translateBinary Indicates if binary fields should - be translated. - @param settings The conversion settings. - @param lobMaxSize The lob max size. @C3A - @param columnIndex The columnIndex - @param dateFormat The dateFormat - @param timeFormat The timeFormat - @param compositeContentType The compositeContentType (type of data in composite type (array, structs or associative-array) NativeType specifies if array or struct etc. - @return A SQLData object. - - @exception SQLException If no valid type can be - mapped. - **/ - //@array comment: we are assuming here that all of the metadata parms (except sqlType) is for the array content type - static SQLData newData(AS400JDBCConnection connection, - int id, - int nativeType, - int length, - int precision, - int scale, - int ccsid, - boolean translateBinary, - SQLConversionSettings settings, - int lobMaxSize, // @C3A - int columnIndex, //@F2A - int dateFormat, // @550A - int timeFormat, // @550A - int compositeContentType, //@array this corresponds to the nativeType numbering system //@datarray 0 = array element, -1 = nonarray, other = that type of an array. - int xmlCharType) //@xml3 SB or DB XML - throws SQLException - { - switch(nativeType) - { - - case 384: // Date. - { //@datarray - if(compositeContentType == 0) //@datarray - dateFormat = 5; //@datarray always iso for input and output for arrays of dates due to zda constraint - return new SQLDate(settings, dateFormat); // @550 - } //@datarray - case 388: // Time. - return new SQLTime(settings, timeFormat); - - case 392: // Timestamp. - return new SQLTimestamp(settings); - - case 396: // Datalink. - return new SQLDatalink(length - 2, settings); - - case 404: // Blob. - return new SQLBlob(length - 4, settings); // @D1C - - case 408: // Clob. - if((ccsid == 65535) && (translateBinary == false)) //@E4C - return new SQLBlob(length - 4, settings); // @D1C - else - return new SQLClob(length - 4, settings); // @D1C @E1C - //return new SQLClob(length - 4, false, settings); // @D1C @E1C - - case 412: // Dbclob. - return new SQLDBClob(length - 4, settings); // @D1C - //return new SQLClob(length - 4, true, settings); // @D1C - - case 448: // Varchar. - if((ccsid == 65535) && (translateBinary == false)) //@E4C - return new SQLVarcharForBitData(length - 2, settings); // @M0C - changed from SQLVarbinary - else - return new SQLVarchar(length - 2, settings); - - case 456: // Varchar long. - if((ccsid == 65535) && (translateBinary == false)) //@E4C - return new SQLLongVarcharForBitData(length - 2, settings); // @M0C - changed from SQLVarbinary - else - return new SQLLongVarchar(length - 2, settings); - - case 452: // Char. - if((ccsid == 65535) && (translateBinary == false)) //@E4C - return new SQLCharForBitData(length, settings); // @M0C - changed from SQLBinary - else - return new SQLChar(length, settings); - - case 464: // Graphic (pure DBCS). - if(ccsid == 65535) //@bingra - return new SQLVargraphic((length-2)/2, settings, ccsid); //@bingra - return new SQLVargraphic(length - 2, settings, ccsid); // @C1C @C4C @cca1 - - case 472: // Graphic long (pure DBCS). - return new SQLLongVargraphic(length - 2, settings); // @C1C @C4C - - case 468: // Graphic fix (pure DBCS). - if(ccsid == 65535) //@bingra - return new SQLGraphic(length/2, settings, ccsid); //@bingra - return new SQLGraphic(length, settings, ccsid); // @C1C @C4C @cca1 - - case 480: // Float. - if(length == 4) - return new SQLReal(settings); - else - return new SQLDouble(settings); - - case 484: // Packed decimal. - if(settings != null) // @E0A - if(! settings.useBigDecimal()) // @E0A - return new SQLDecimal2(precision, scale, settings, connection.getVRM(), connection.getProperties()); // @M0C - pass the JDProperties object so we can get the precision - return new SQLDecimal(precision, scale, settings, connection.getVRM(), connection.getProperties()); // @M0C // @E0A - - case 488: // Zoned decimal. - if(settings != null) // @E0A - if(! settings.useBigDecimal()) // @E0A - return new SQLNumeric2(precision, scale, settings, connection.getVRM(), connection.getProperties()); // @M0C - pass the JDProperties object so we can get the precision - return new SQLNumeric(precision, scale, settings, connection.getVRM(), connection.getProperties()); // @M0C // @E0A - - case 492: // Bigint. // @D0A - return new SQLBigint(connection.getVRM()); // @D0A //trunc3 - - case 496: // Integer. - return new SQLInteger(scale, connection.getVRM()); // @A0C //trunc3 - - case 500: // Smallint. - return new SQLSmallint(scale, connection.getVRM()); // @A0C //trunc3 - - case 904: // Rowid. // @M0A - Added support for the ROWID data type - return new SQLRowID(settings); // @M0A - - case 908: // Varbinary. // @M0A - added support for VARBINARY type - return new SQLVarbinary(length-2, settings); // @M0A - - case 912: // Binary. // @M0A - added support for BINARY type - return new SQLBinary(length, settings); // @M0A - - case 960: // Blob locator. - return new SQLBlobLocator(connection, id, lobMaxSize, settings, connection.getConverter(ccsid), columnIndex); //@F2C //@J0M added converter - - case 964: // Clob locator. - if((ccsid == 65535) && (translateBinary == false)) //@E4C - return new SQLBlobLocator(connection, id, lobMaxSize, settings, connection.getConverter(ccsid), columnIndex); //@F2C //@J0M added converter - else - return new SQLClobLocator(connection, id, lobMaxSize, settings, connection.getConverter(ccsid), columnIndex); // @E1C //@F2C - //return new SQLClobLocator(connection, id, lobMaxSize, false, settings, connection.getConverter(ccsid), columnIndex); // @E1C //@F2C - - case 968: // Dbclob locator. - return new SQLDBClobLocator(connection, id, lobMaxSize, settings, connection.getConverter(ccsid), columnIndex); // @E1C //@F2C - //return new SQLClobLocator(connection, id, lobMaxSize, true, settings, connection.getConverter(ccsid), columnIndex); // @E1C //@F2C - - case 996: // Decimal float. //@DFA - if(precision == 16) //@DFA - return new SQLDecFloat16(settings, connection.getVRM(), connection.getProperties() ); //@DFA - else - return new SQLDecFloat34(settings, connection.getVRM(), connection.getProperties() ); //@DFA - case SQLData.NATIVE_ARRAY: //@array - return new SQLArray( length, newData( connection, - id, - compositeContentType, - length, - precision, - scale, - ccsid, - translateBinary, - settings, - lobMaxSize, - columnIndex, - dateFormat, - timeFormat, - 0, 0) , connection.getVRM()); //@array create SQLData array wrapper of actual datatype - - case 2452: //@xml3 xml returned in bloblocator - case 988: // the xml type will be seen when a parameter is retrieved from a cached package. We'll change - // this to an SQLXML Locator 01/27/2010 - if(ccsid == 65535) - xmlCharType = 2; //sb=0 or db=1 binary=2 - return new SQLXMLLocator(connection, id, lobMaxSize, settings, connection.getConverter(ccsid), columnIndex, xmlCharType); //@xml3 - - default: - JDError.throwSQLException(JDError.EXC_INTERNAL, new IllegalArgumentException(Integer.toString(nativeType))); // @E3C - return null; - } - } - - /** - Return a SQLData object corresponding to the - specific IBM i native type string. - - @param nativeType An IBM i native type. - @param length Length of data (in bytes). - @param precision Precision of data. - @param scale Scale of data. - @param settings The conversion settings. - @return A SQLData object. - - @exception SQLException If no valid type can be - mapped. - **/ - // - // In some cases, there are several different strings - // that match a particular data type. This is because, - // different functions refer to the types with - // different strings. - // - static SQLData newData(String nativeType, - int length, - int precision, - int scale, - int ccsid, //@KKB - SQLConversionSettings settings, - int vrm, // @M0C - added vrm parm - JDProperties properties) // @M0C - added JDProperties parm - throws SQLException - { - if(properties == null) //@array7 - properties = new JDProperties(); //@array7 - if(nativeType.equals("BINARY")) - { // @M0C - changed to return SQLBinary - if(vrm >= JDUtilities.vrm530) // @M0C - only for v5r3 and newer - return new SQLBinary(length, settings); // @M0C - because the original function - else // @M0C - from SQLBinary has been moved - return new SQLCharForBitData(length, settings); // @M0C - to SQLCharForBitData in order - } // @M0C - to add support for real BINARY - - else if(nativeType.equals("BIGINT")) // @D0A - return new SQLBigint(vrm); // @D0A //trunc3 - - else if(nativeType.equals("BLOB")) - return new SQLBlob(length, settings); // @D1C @G1C Remove length-4 - - else if(nativeType.equals("BINARY LARGE OBJECT")) //@KKB - return new SQLBlob(length, settings); //@KKB - - else if(nativeType.equals("CHAR")) - { - if(ccsid == 65535 && !properties.getBoolean(JDProperties.TRANSLATE_BINARY)) //@KKB - return new SQLCharForBitData(length, settings); //@KKB - else //@KKB - return new SQLChar(length, settings); - } - - else if(nativeType.equals("CHARACTE")) - { - if(ccsid == 65535 && !properties.getBoolean(JDProperties.TRANSLATE_BINARY)) //@KKB - return new SQLCharForBitData(length, settings); //@KKB - else //@KKB - return new SQLChar(length, settings); - } - - else if(nativeType.equals("CHARACTER")) - { - if(ccsid == 65535 && !properties.getBoolean(JDProperties.TRANSLATE_BINARY)) //@KKB - return new SQLCharForBitData(length, settings); //@KKB - else //@KKB - return new SQLChar(length, settings); - } - - else if(nativeType.equals("CHARACTER VARYING")) - { - if(ccsid == 65535 && !properties.getBoolean(JDProperties.TRANSLATE_BINARY)) //@KKB - return new SQLVarcharForBitData(length, settings); //@KKB - else //@KKB - return new SQLVarchar(length, settings); // @E1C - } - - else if(nativeType.equals("CLOB")) - return new SQLClob(length, settings); // @D1C @E1C @G1C Remove length-4 - //return new SQLClob(length, false, settings); // @D1C @E1C @G1C Remove length-4 - - else if(nativeType.equals("CHARACTER LARGE OBJECT")) //@KKB - return new SQLClob(length, settings); //@KKB - - else if(nativeType.equals("DATALINK")) - return new SQLDatalink(length, settings); - - else if(nativeType.equals("DBCLOB")) // @G2A - return new SQLDBClob(length, settings); // @G2A - //return new SQLClob(length, true, settings); // @G2A - - else if(nativeType.equals("DOUBLE-BYTE CHARACTER LARGE OBJECT")) //@KKB - return new SQLDBClob(length, settings); //@KKB - - else if(nativeType.equals("DATE")) - return new SQLDate(settings, -1); // @550 - - else if(nativeType.equals("DECIMAL")) - { - if(settings != null) // @E0A - if(! settings.useBigDecimal()) // @E0A - return new SQLDecimal2(precision, scale, settings, vrm, properties); // @M0C - pass the JDProperties so we can get the scale - return new SQLDecimal(precision, scale, settings, vrm, properties); // @M0C // @E0A - } - else if(nativeType.equals("DECFLOAT")) //@DFA - { //@DFA - if(precision == 16) //@DFA - return new SQLDecFloat16(settings, vrm, properties); //@DFA - else //@DFA - return new SQLDecFloat34(settings, vrm, properties); //@DFA - } //@DFA - - else if(nativeType.equals("DOUBLE")) - return new SQLDouble(settings); - - else if(nativeType.equals("DOUBLE P")) - return new SQLDouble(settings); - - else if(nativeType.equals("DOUBLE PRECISION")) - return new SQLDouble(settings); - - else if(nativeType.equals("FLOAT")) - { - if(length == 4) - return new SQLReal(settings); - else - return new SQLDouble(settings); - } - - else if(nativeType.equals("GRAPHIC") || nativeType.equals("NCHAR")) //@j40type - return new SQLGraphic(length, settings, ccsid); // @C1C @C4C @cca1 - - else if(nativeType.equals("GRAPHIC VARYING")) - return new SQLVargraphic(length, settings, ccsid); // @C1C @C4C @E1C @cca1 - - else if(nativeType.equals("INTEGER")) - return new SQLInteger(vrm); //trunc3 - - else if(nativeType.equals("NUMERIC")) - { - if(settings != null) // @E0A - if(! settings.useBigDecimal()) // @E0A - return new SQLNumeric2(precision, scale, settings, vrm, properties); // @M0C - pass the JDProperties so we can get the scale - return new SQLNumeric(precision, scale, settings, vrm, properties); // @M0C // @E0A - } - - else if(nativeType.equals("REAL")) - return new SQLReal(settings); - - else if(nativeType.equals("ROWID")) // @M0A - added support for the ROWID type - return new SQLRowID(settings); // @M0A - - else if(nativeType.equals("SMALLINT")) - return new SQLSmallint(vrm); //trunc3 - - else if(nativeType.equals("TIME")) - return new SQLTime(settings, -1); // @550C - - else if(nativeType.equals("TIMESTAM")) - return new SQLTimestamp(settings); - - else if(nativeType.equals("TIMESTAMP")) - return new SQLTimestamp(settings); - - else if(nativeType.equals("TIMESTMP")) - return new SQLTimestamp(settings); - - else if(nativeType.equals("VARBINARY")) - { // @M0C - changed to return SQLVarbinary - if(vrm >= JDUtilities.vrm530) // @M0C - only for v5r3 and newer - return new SQLVarbinary(length, settings); // @M0C - because the original function - else // @M0C - from SQLVarbinary has been moved - return new SQLVarcharForBitData(length, settings); // @M0C - to SQLVarcharForBitData in order - } // @M0C - to add support for real VARBINARY - - else if(nativeType.equals("VARBIN")) //@K1A - { - if(vrm >= JDUtilities.vrm530) - return new SQLVarbinary(length, settings); - else - return new SQLVarcharForBitData(length, settings); - } - - else if(nativeType.equals("BINARY VARYING")) //@K1A - { - if(vrm >= JDUtilities.vrm530) - return new SQLVarbinary(length, settings); - else - return new SQLVarcharForBitData(length, settings); - } - - else if(nativeType.equals("VARCHAR")) - { - if(ccsid == 65535 && !properties.getBoolean(JDProperties.TRANSLATE_BINARY)) //@KKB - return new SQLVarcharForBitData(length, settings); //@KKB - else //@KKB - return new SQLVarchar(length, settings); // @E1C - } - - else if(nativeType.equals("VARG")) - return new SQLVargraphic(length, settings, ccsid); // @E1C @cca1 - - else if(nativeType.equals("VARGRAPH")) - return new SQLVargraphic(length, settings, ccsid); // @E1C @cca1 - - else if(nativeType.equals("VARGRAPHIC") || nativeType.equals("NVARCHAR")) //@j40type - return new SQLVargraphic(length, settings, ccsid); //@KKB @cca1 - else if(nativeType.equals("ARRAY")) - return new SQLArray( length, newData( nativeType, - length, - precision, - scale, - ccsid, - settings, - vrm, - properties) , vrm); //@array create SQLData array wrapper of actual datatype //length is element length - - else - { - JDError.throwSQLException(JDError.EXC_INTERNAL, new IllegalArgumentException(nativeType)); // @E3C - return null; - } - } - - /** - Truncates the precision of a BigDecimal by removing digits from - the left side of the decimal point. - **/ - public static BigDecimal truncatePrecision(BigDecimal bd, int precision) - { - boolean positive = bd.longValue() > 0; - StringBuffer buffer = new StringBuffer(positive ? "" : "-"); - buffer.append(bd.toString().substring(positive ? precision : precision + 1)); - return new BigDecimal(buffer.toString()); - } - - /** - Truncates the precision of a String representation of a number - by removing digits from the right side of the decimal point. - **/ - public static String truncateScale(String value, int scale) - { - int point = value.indexOf('.'); - if(point >= 0) - { - StringBuffer buffer = new StringBuffer(value); - for(int i = 1; i <= scale; ++i) - buffer.append('0'); - return buffer.toString().substring(0, point + scale + 1); - } - else - return value; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SQLDatalink.java b/cvsroot/src/com/ibm/as400/access/SQLDatalink.java deleted file mode 100644 index c625e1a49..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLDatalink.java +++ /dev/null @@ -1,455 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLDatalink.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.net.URL; // @d2a -import java.net.MalformedURLException; - -final class SQLDatalink -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - // Private data. - private int length_; - private int maxLength_; - private SQLConversionSettings settings_; - private int truncated_; - private String value_; - - SQLDatalink(int maxLength, SQLConversionSettings settings) - { - length_ = 0; - maxLength_ = maxLength; - settings_ = settings; - truncated_ = 0; - value_ = ""; // @A1C - } - - public Object clone() - { - return new SQLDatalink(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - value_ = ccsidConverter.byteArrayToString(rawBytes, offset+2, length_); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - BinaryConverter.unsignedShortToByteArray(length_, rawBytes, offset); - try - { - ccsidConverter.stringToByteArray(value_, rawBytes, offset + 2, length_); - } - catch(Exception e) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); // @C2A - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(object instanceof String) - value_ = (String)object; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - length_ = value_.length(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.DATALINK; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - //@D1A JDBC 3.0 - //@d2a - method rewritten for URLs - //@j4c - rewritten now that JDUtilites knows the JDBC level - public String getJavaClassName() - { - if(JDUtilities.JDBCLevel_ >= 30) - return "java.net.URL"; - else - return "java.lang.Datalink"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "DATALINK"; - } - - public int getMaximumPrecision() - { - return 32717; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 396; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - if(JDUtilities.JDBCLevel_ >= 30) //@J5A - return 70; //java.sql.Types.DATALINK without requiring 1.4 //@J5A - else //@J5A - return java.sql.Types.VARCHAR; - } - - public String getTypeName() - { - return "DATALINK"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_)); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - return new StringReader(value_); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - return new AS400JDBCClob(value_, value_.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - // @d2a entire method reworked. Used to simply return value_. - // @j4c - rewritten now that JDUtilites knows the JDBC level - public Object getObject() - throws SQLException - { - truncated_ = 0; - // if JDBC 3.0 or later return a URL instead of a string. - // If we are not able to turn the string into a URL then return - // the string (that is why there is no "else". That shouldn't - // happen because the database makes sure the cell contains - // a valid URL for this data type. - if(JDUtilities.JDBCLevel_ >= 30) - { - try - { - return new java.net.URL(value_); - } - catch(MalformedURLException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - else - { - return value_; - } - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public String getString() - throws SQLException - { - return value_; - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(value_)); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - return new StringReader(value_); - } - - //@pda jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - return new AS400JDBCNClob(value_, value_.length()); - } - endif */ - //@pda jdbc40 - public String getNString() throws SQLException - { - return value_; - } - - //@pda jdbc40 - /* ifdef JDBC40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - //@pda jdbc40 - /* ifdef JDBC40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLDate.java b/cvsroot/src/com/ibm/as400/access/SQLDate.java deleted file mode 100644 index 0b0463d4b..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLDate.java +++ /dev/null @@ -1,775 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLDate.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; -import java.io.InputStream; -import java.io.Reader; -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLDate -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2002 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int dateFormat_; // @550A - private int truncated_; - private int year_; - private int month_; - private int day_; - - SQLDate(SQLConversionSettings settings, int dateFormat) - { - settings_ = settings; - truncated_ = 0; - year_ = 0; - month_ = 0; - day_ = 0; - dateFormat_ = dateFormat; // @550A - } - - public Object clone() - { - return new SQLDate(settings_, dateFormat_); // @550C - } - - public static Date stringToDate(String s, - SQLConversionSettings settings, - Calendar calendar) - throws SQLException - { - // If the string is empty or set to zeros, - // then it is likely a NULL, so just set this - // to a default date. - String sTrim = s.trim(); - int sTrimLength = sTrim.length(); // @F2A - try - { - if((sTrimLength == 0) || (Integer.parseInt(sTrim) == 0)) // @F2C - return new Date(0); - } - catch(NumberFormatException e) - { - // Ignore. This just means the value is not NULL. - } - - if(calendar == null) - { - calendar = Calendar.getInstance(); //@P0A - calendar.setLenient(false); //@dat1 - } - - try - { - // Parse the string according to the format and separator. - switch(settings.getDateFormat()) - { - case SQLConversionSettings.DATE_FORMAT_USA: - calendar.set(Calendar.YEAR, Integer.parseInt(s.substring(6, 10))); - calendar.set(Calendar.MONTH, Integer.parseInt(s.substring(0, 2)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s.substring(3, 5))); - break; - - case SQLConversionSettings.DATE_FORMAT_EUR: - calendar.set(Calendar.YEAR, Integer.parseInt(s.substring(6, 10))); - calendar.set(Calendar.MONTH, Integer.parseInt(s.substring(3, 5)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s.substring(0, 2))); - break; - - case SQLConversionSettings.DATE_FORMAT_JULIAN: - if(sTrimLength <= 6) - { // YY/DDD // @F2C - calendar.set(Calendar.DAY_OF_YEAR, Integer.parseInt(s.substring(3, 6))); - calendar.set(Calendar.YEAR, twoDigitYearToFour(Integer.parseInt(s.substring(0, 2)))); - } - else - { // Assume they've specified a 4-digit year: YYYY/DDD // @F2A - calendar.set(Calendar.DAY_OF_YEAR, Integer.parseInt(s.substring(5, 8))); - calendar.set(Calendar.YEAR, Integer.parseInt(s.substring(0, 4))); - } - break; - - case SQLConversionSettings.DATE_FORMAT_MDY: - if(sTrimLength <= 8) - { // MM/DD/YY // @F2C - calendar.set(Calendar.YEAR, twoDigitYearToFour(Integer.parseInt(s.substring(6, 8)))); - } - else - { // Assume they've specified a 4-digit year: MM/DD/YYYY // @F2A - calendar.set(Calendar.YEAR, Integer.parseInt(s.substring(6, 10))); - } - calendar.set(Calendar.MONTH, Integer.parseInt(s.substring(0, 2)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s.substring(3, 5))); - break; - - case SQLConversionSettings.DATE_FORMAT_DMY: - if(sTrimLength <= 8) - { // DD/MM/YY // @F2C - calendar.set(Calendar.YEAR, twoDigitYearToFour(Integer.parseInt(s.substring(6, 8)))); - } - else - { // Assume they've specified a 4-digit year: DD/MM/YYYY // @F2A - calendar.set(Calendar.YEAR, Integer.parseInt(s.substring(6, 10))); - } - calendar.set(Calendar.MONTH, Integer.parseInt(s.substring(3, 5)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s.substring(0, 2))); - break; - - case SQLConversionSettings.DATE_FORMAT_YMD: - if(sTrimLength <= 8) - { // YY/MM/DD // @F2C - calendar.set(Calendar.YEAR, twoDigitYearToFour(Integer.parseInt(s.substring(0, 2)))); - calendar.set(Calendar.MONTH, Integer.parseInt(s.substring(3, 5)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s.substring(6, 8))); - } - else - { // Assume they've specified a 4-digit year: YYYY/MM/DD // @F2A - calendar.set(Calendar.YEAR, Integer.parseInt(s.substring(0, 4))); - calendar.set(Calendar.MONTH, Integer.parseInt(s.substring(5, 7)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s.substring(8, 10))); - } - break; - - case SQLConversionSettings.DATE_FORMAT_JIS: - case SQLConversionSettings.DATE_FORMAT_ISO: - calendar.set(Calendar.YEAR, Integer.parseInt(s.substring(0, 4))); - calendar.set(Calendar.MONTH, Integer.parseInt(s.substring(5, 7)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s.substring(8, 10))); - break; - } - - calendar.set(Calendar.HOUR_OF_DAY, 0); - calendar.set(Calendar.MINUTE, 0); - calendar.set(Calendar.SECOND, 0); - calendar.set(Calendar.MILLISECOND, 0); - } - catch(NumberFormatException e) - { - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing date "+s, e); - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); - } - catch(StringIndexOutOfBoundsException e) - { - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing date "+s, e); - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); - } - - try //@dat1 - { - return new Date(calendar.getTime().getTime()); - }catch(Exception e){ - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing date "+s, e); //@dat1 - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); //@dat1 - return null; //@dat1 - } - } - - public static String dateToString(java.util.Date d, // @F5C - SQLConversionSettings dataFormat, - Calendar calendar) - { - StringBuffer buffer = new StringBuffer(); - String separator = dataFormat.getDateSeparator(); - if(calendar == null) calendar = Calendar.getInstance(); //@P0A - calendar.setTime(d); - - // @F3D Note: No matter what format is being used, ensure that exactly 10 characters are in the buffer. - - switch(dataFormat.getDateFormat()) - { - - case SQLConversionSettings.DATE_FORMAT_USA: // mm/dd/yyyy - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.MONTH) + 1, 2)); - buffer.append('/'); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.DAY_OF_MONTH), 2)); - buffer.append('/'); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.YEAR), 4)); - break; - - case SQLConversionSettings.DATE_FORMAT_EUR: // dd.mm.yyyy - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.DAY_OF_MONTH), 2)); - buffer.append('.'); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.MONTH) + 1, 2)); - buffer.append('.'); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.YEAR), 4)); - break; - - case SQLConversionSettings.DATE_FORMAT_JULIAN: // yy/ddd - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.YEAR), 2)); - buffer.append(separator); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.DAY_OF_YEAR), 3)); - // @F3D buffer.append(" "); - break; - - case SQLConversionSettings.DATE_FORMAT_MDY: // mm/dd/yy - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.MONTH) + 1, 2)); - buffer.append(separator); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.DAY_OF_MONTH), 2)); - buffer.append(separator); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.YEAR), 2)); - // @F3D buffer.append(" "); - break; - - case SQLConversionSettings.DATE_FORMAT_DMY: // dd/mm/yy - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.DAY_OF_MONTH), 2)); - buffer.append(separator); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.MONTH) + 1, 2)); - buffer.append(separator); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.YEAR), 2)); - // @F3D buffer.append(" "); - break; - - case SQLConversionSettings.DATE_FORMAT_YMD: // yy/mm/dd - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.YEAR), 2)); - buffer.append(separator); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.MONTH) + 1, 2)); - buffer.append(separator); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.DAY_OF_MONTH), 2)); - // @F3D buffer.append(" "); - break; - - case SQLConversionSettings.DATE_FORMAT_JIS: // yyyy-mm-dd - case SQLConversionSettings.DATE_FORMAT_ISO: // yyyy-mm-dd - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.YEAR), 4)); - buffer.append('-'); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.MONTH) + 1, 2)); - buffer.append('-'); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.DAY_OF_MONTH), 2)); - break; - } - - return buffer.toString(); - } - - private static int twoDigitYearToFour(int twoDigitYear) - { - return(twoDigitYear <= 39) - ? (twoDigitYear + 2000) - : (twoDigitYear + 1900); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - int connectionDateFormat = settings_.getDateFormat(); // @550A - // @550 If the date is in a stored procedure result set, it could have a different date format than the format of the connection - switch(((dateFormat_ != -1) && (dateFormat_ != connectionDateFormat)) ? dateFormat_ : connectionDateFormat) // @550C - { - - case SQLConversionSettings.DATE_FORMAT_JULIAN: // yy/ddd - year_ = twoDigitYearToFour((rawBytes[offset+0] & 0x0f) * 10 - + (rawBytes[offset+1] & 0x0f)); - Calendar calendar = Calendar.getInstance(); - calendar.clear(); - calendar.set(Calendar.YEAR, year_); - calendar.set(Calendar.DAY_OF_YEAR, - (rawBytes[offset+3] & 0x0f) * 100 - + (rawBytes[offset+4] & 0x0f) * 10 - + (rawBytes[offset+5] & 0x0f)); - calendar.setTime(calendar.getTime()); - month_ = calendar.get(Calendar.MONTH); - day_ = calendar.get(Calendar.DAY_OF_MONTH); - break; - - case SQLConversionSettings.DATE_FORMAT_MDY: // mm/dd/yy - month_ = (rawBytes[offset+0] & 0x0f) * 10 - + (rawBytes[offset+1] & 0x0f) - 1; - day_ = (rawBytes[offset+3] & 0x0f) * 10 - + (rawBytes[offset+4] & 0x0f); - year_ = twoDigitYearToFour((rawBytes[offset+6] & 0x0f) * 10 - + (rawBytes[offset+7] & 0x0f)); - break; - - case SQLConversionSettings.DATE_FORMAT_DMY: // dd/mm/yy - day_ = (rawBytes[offset+0] & 0x0f) * 10 - + (rawBytes[offset+1] & 0x0f); - month_ = (rawBytes[offset+3] & 0x0f) * 10 - + (rawBytes[offset+4] & 0x0f) - 1; - year_ = twoDigitYearToFour((rawBytes[offset+6] & 0x0f) * 10 - + (rawBytes[offset+7] & 0x0f)); - break; - - case SQLConversionSettings.DATE_FORMAT_YMD: // yy/mm/dd - year_ = twoDigitYearToFour((rawBytes[offset+0] & 0x0f) * 10 - + (rawBytes[offset+1] & 0x0f)); - month_ = (rawBytes[offset+3] & 0x0f) * 10 - + (rawBytes[offset+4] & 0x0f) - 1; - day_ = (rawBytes[offset+6] & 0x0f) * 10 - + (rawBytes[offset+7] & 0x0f); - break; - - case SQLConversionSettings.DATE_FORMAT_USA: // mm/dd/yyyy - month_ = (rawBytes[offset+0] & 0x0f) * 10 - + (rawBytes[offset+1] & 0x0f) - 1; - day_ = (rawBytes[offset+3] & 0x0f) * 10 - + (rawBytes[offset+4] & 0x0f); - year_ = (rawBytes[offset+6] & 0x0f) * 1000 - + (rawBytes[offset+7] & 0x0f) * 100 - + (rawBytes[offset+8] & 0x0f) * 10 - + (rawBytes[offset+9] & 0x0f); - break; - - case SQLConversionSettings.DATE_FORMAT_ISO: // yyyy-mm-dd - case SQLConversionSettings.DATE_FORMAT_JIS: // yyyy-mm-dd - year_ = (rawBytes[offset+0] & 0x0f) * 1000 - + (rawBytes[offset+1] & 0x0f) * 100 - + (rawBytes[offset+2] & 0x0f) * 10 - + (rawBytes[offset+3] & 0x0f); - month_ = (rawBytes[offset+5] & 0x0f) * 10 - + (rawBytes[offset+6] & 0x0f) - 1; - day_ = (rawBytes[offset+8] & 0x0f) * 10 - + (rawBytes[offset+9] & 0x0f); - break; - - case SQLConversionSettings.DATE_FORMAT_EUR: // dd.mm.yyyy - day_ = (rawBytes[offset+0] & 0x0f) * 10 - + (rawBytes[offset+1] & 0x0f); - month_ = (rawBytes[offset+3] & 0x0f) * 10 - + (rawBytes[offset+4] & 0x0f) - 1; - year_ = (rawBytes[offset+6] & 0x0f) * 1000 - + (rawBytes[offset+7] & 0x0f) * 100 - + (rawBytes[offset+8] & 0x0f) * 10 - + (rawBytes[offset+9] & 0x0f); - break; - } - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - // Always use ISO format here. - StringBuffer buffer = new StringBuffer(10); - buffer.append(JDUtilities.padZeros(year_, 4)); - buffer.append('-'); - buffer.append(JDUtilities.padZeros(month_ + 1, 2)); - buffer.append('-'); - buffer.append(JDUtilities.padZeros(day_, 2)); - - try - { - ccsidConverter.stringToByteArray(buffer.toString(), rawBytes, offset); - } - catch(CharConversionException e) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); // @E2C - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(calendar == null) - { - calendar = Calendar.getInstance(); //@P0A - calendar.setLenient(false); //@dat1 - } - if(object instanceof String) - { - stringToDate((String) object, settings_, calendar); - year_ = calendar.get(Calendar.YEAR); - month_ = calendar.get(Calendar.MONTH); - day_ = calendar.get(Calendar.DAY_OF_MONTH); - } - - else if(object instanceof Timestamp) - { // @F5M - calendar.setTime((Timestamp) object); - year_ = calendar.get(Calendar.YEAR); - month_ = calendar.get(Calendar.MONTH); - day_ = calendar.get(Calendar.DAY_OF_MONTH); - } - - else if(object instanceof java.util.Date) - { // @F5C - calendar.setTime((java.util.Date) object); // @F5C - year_ = calendar.get(Calendar.YEAR); - month_ = calendar.get(Calendar.MONTH); - day_ = calendar.get(Calendar.DAY_OF_MONTH); - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.DATE; - } - - public String getCreateParameters() - { - return null; - } - - - public int getDisplaySize() - { - return 10; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.sql.Date"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "DATE"; - } - - public int getMaximumPrecision() - { - return 10; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 384; - } - - public int getPrecision() - { - return 10; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.DATE; - } - - public String getTypeName() - { - return "DATE"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return 10; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) calendar = Calendar.getInstance(); - calendar.set(year_, month_, day_, 0, 0, 0); - calendar.set(Calendar.MILLISECOND, 0); - return new Date(calendar.getTime().getTime()); - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return getDate(null); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - Calendar calendar = Calendar.getInstance(); - calendar.set(year_, month_, day_, 0, 0, 0); - calendar.set(Calendar.MILLISECOND, 0); - Date d = new Date(calendar.getTime().getTime()); - return dateToString(d, settings_, calendar); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) calendar = Calendar.getInstance(); //@P0A - calendar.set(year_, month_, day_, 0, 0, 0); - calendar.set(Calendar.MILLISECOND, 0); - Timestamp ts = new Timestamp(calendar.getTime().getTime()); - ts.setNanos(0); - return ts; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - return new StringReader(getNString()); - } - - //@pda jdbc40 - /* ifdef JDBC40 - - public NClob getNClob() throws SQLException - { - truncated_ = 0; //@pda - String string = getString(); //@pda - return new AS400JDBCNClob(string, string.length()); //@pda - } - endif */ - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - Calendar calendar = Calendar.getInstance(); - calendar.set(year_, month_, day_, 0, 0, 0); - calendar.set(Calendar.MILLISECOND, 0); - Date d = new Date(calendar.getTime().getTime()); - return dateToString(d, settings_, calendar); - } - - //@pda jdbc40 - /* ifdef JDBC40 - - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - //@pda jdbc40 - /* ifdef JDBC40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLDecFloat16.java b/cvsroot/src/com/ibm/as400/access/SQLDecFloat16.java deleted file mode 100644 index cfd042eca..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLDecFloat16.java +++ /dev/null @@ -1,686 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -//JTOpen (IBM Toolbox for Java - OSS version) -// -//Filename: SQLDecFloat16.java -// -//The source code contained herein is licensed under the IBM Public License -//Version 1.0, which has been approved by the Open Source Initiative. -//Copyright (C) 2006 International Business Machines Corporation and -//others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -//@DFA new class -final class SQLDecFloat16 implements SQLData { - - private static final BigDecimal default_ = BigDecimal.valueOf(0); - - //various min/max values used for comparisons in calculating truncation etc - private static final BigDecimal BYTE_MAX_VALUE = BigDecimal.valueOf(Byte.MAX_VALUE); - - private static final BigDecimal BYTE_MIN_VALUE = BigDecimal.valueOf(Byte.MIN_VALUE); - - private static final BigDecimal SHORT_MAX_VALUE = BigDecimal.valueOf(Short.MAX_VALUE); - - private static final BigDecimal SHORT_MIN_VALUE = BigDecimal.valueOf(Short.MIN_VALUE); - - private static final BigDecimal INTEGER_MAX_VALUE = BigDecimal.valueOf(Integer.MAX_VALUE); - - private static final BigDecimal INTEGER_MIN_VALUE = BigDecimal.valueOf(Integer.MIN_VALUE); - - private static final BigDecimal LONG_MAX_VALUE = BigDecimal.valueOf(Long.MAX_VALUE); - - private static final BigDecimal LONG_MIN_VALUE = BigDecimal.valueOf(Long.MIN_VALUE); - - private static final BigDecimal FLOAT_MAX_VALUE = new BigDecimal(Float.MAX_VALUE); - - private static final BigDecimal FLOAT_MIN_VALUE = new BigDecimal(-Float.MAX_VALUE); //@PDC MIN_VALUE is positive - - private static final BigDecimal DOUBLE_MAX_VALUE = new BigDecimal(Double.MAX_VALUE); - - private static final BigDecimal DOUBLE_MIN_VALUE = new BigDecimal(-Double.MAX_VALUE); //@PDC MIN_VALUE is positive - - static final int DECFLOAT16_MIN_EXP = -383; - - private SQLConversionSettings settings_; - - private int precision_; //16 - - private int truncated_; - - String specialValue_ = null; //since BigDecimal cannot hold "Infinity", "-Infinity" or "NaN", store them here as string - - private AS400DecFloat typeConverter_; - - private BigDecimal value_; - - private JDProperties properties_; - - private int roundingMode; - - private String roundingModeStr; - - private int vrm_; - - SQLDecFloat16( SQLConversionSettings settings, int vrm, JDProperties properties) { - settings_ = settings; - precision_ = 16; - truncated_ = 0; - roundingModeStr = properties.getString(JDProperties.DECFLOAT_ROUNDING_MODE); - typeConverter_ = new AS400DecFloat(precision_ ); - value_ = default_; - vrm_ = vrm; - properties_ = properties; - - //parse property rounding mode and save its value as int (needed for BigDecimal, MathContext etc) - // valid rounding modes are: - //"half even" - //"half up" - //"down" - //"ceiling" - //"floor" - //"half down" - //"up" - - if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_UP)) - roundingMode = BigDecimal.ROUND_UP; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_DOWN)) - roundingMode = BigDecimal.ROUND_DOWN; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_CEILING)) - roundingMode = BigDecimal.ROUND_CEILING; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_FLOOR)) - roundingMode = BigDecimal.ROUND_FLOOR; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_UP)) - roundingMode = BigDecimal.ROUND_HALF_UP; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_DOWN)) - roundingMode = BigDecimal.ROUND_HALF_DOWN; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_EVEN)) - roundingMode = BigDecimal.ROUND_HALF_EVEN; - - - //for MathContext, methods take strings which are same as JDProperties rounding modes with "round" added. - roundingModeStr = "ROUND_" + roundingModeStr.toUpperCase().replace(' ', '_'); - - } - - public Object clone() { - return new SQLDecFloat16( settings_, vrm_, properties_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccisdConverter) - throws SQLException { - try{ - value_ = ((BigDecimal) typeConverter_.toObject(rawBytes, offset)); - specialValue_ = null; - } catch (ExtendedIllegalArgumentException e) { - //check for NAN and INF flag exception - if ( (specialValue_ = getSpecialValue( e.toString())) == null ) - throw e; - } - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException { - try { - if ( specialValue_ == null) - typeConverter_.toBytes(value_, rawBytes, offset); - else - typeConverter_.toBytes(specialValue_, rawBytes, offset); //Nan, Infinity, -Infinity - - } catch (ExtendedIllegalArgumentException e) { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) throws SQLException { - BigDecimal bigDecimal = null; - specialValue_ = null; - - if (object instanceof String) { - try { - if ( (specialValue_ = getSpecialValue( (String)object)) == null ) { - //not one of the special values, just store as BigDecimal - - // Because the string may be using a comma for the decimal separator and we are going to - // store the object as a Java Bigdec, we much check and change to the default '.' notation. - if (((String)object).indexOf(',')!=-1) { - bigDecimal = new BigDecimal (((String)object).replace(',', '.')); - } else { - bigDecimal = new BigDecimal((String)object); - } - } - } catch (NumberFormatException e) { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - } catch (StringIndexOutOfBoundsException e) // jdk 1.3.x throws this - // instead of a NFE - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if (object instanceof Number) { - if ( (specialValue_ = getSpecialValue( object.toString())) == null ) { - //not one of the special values, just store as BigDecimal - bigDecimal = new BigDecimal(object.toString()); //convert to string so all Number types can be passed in - } - } - - else if (object instanceof Boolean) - bigDecimal = (((Boolean) object).booleanValue() == true) ? BigDecimal.valueOf(1) : BigDecimal.valueOf(0); - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Round by mode if necessary. - truncated_ = 0; - - //if one of the special values, then no need to check truncation - if(specialValue_ != null) - { - //Nan, Infinity, -Infinity - value_ = null; - return; - } - - //follow native and allow rounding mode to handle - //@pdd int otherScale = bigDecimal.scale(); - //@pdd if(otherScale > ((-1) * DECFLOAT16_MIN_EXP)) //absolute of min_exp is max scale - //@pdd truncated_ += otherScale + DECFLOAT16_MIN_EXP; //diff in scales - - //get precision from bigDecimal without 0's on right side - //@pdd int otherPrecision = SQLDataFactory.getPrecisionForTruncation(bigDecimal, 16); - - - //follow native and allow rounding mode to handle - //@pddif(otherPrecision > precision_) - //@pdd{ - //@pdd int digits = otherPrecision - precision_; - //@pdd truncated_ += digits; - //@pdd} - //@pddelse - //@pdd truncated_ = 0; // No left side truncation, report nothing - //@pdd // (even if there was right side truncation). - - value_ = AS400DecFloat.roundByMode(bigDecimal, 16, roundingModeStr); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() { - return SQLData.DECFLOAT; - } - - public String getCreateParameters() { - return null; - } - - public int getDisplaySize() { - return 23; //@pdc same as native - } - - - public String getJavaClassName() { - return "java.math.BigDecimal"; - } - - public String getLiteralPrefix() { - return null; - } - - public String getLiteralSuffix() { - return null; - } - - public String getLocalName() { - return "DECFLOAT"; - } - - public int getMaximumPrecision() { - return precision_; - } - - public int getMaximumScale() { - return 0; - } - - public int getMinimumScale() { - return 0; - } - - public int getNativeType() { - return 996; //same as in SQLDataFactory.java - } - - public int getPrecision() { - return precision_; - } - - public int getRadix() { - return 10; //decimal base (4 bits per digit) - } - - public int getScale() { - return 0; - } - - public int getType() { - return java.sql.Types.OTHER; - } - - public String getTypeName() { - return "DECFLOAT"; - } - - public boolean isSigned() { - return true; - } - - public boolean isText() { - return false; - } - - public int getActualSize() { - if(specialValue_ == null) - return SQLDataFactory.getPrecision( value_ ); - else - return specialValue_.length(); - } - - public int getTruncated() { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - //remove this when BigDecimal supports Nan, Inf, -Inf - if(specialValue_ != null){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - if(scale >= 0) - { - if(scale >= value_.scale()) - { - return value_.setScale(scale); - } - else - { - truncated_ = value_.scale() - scale; - return value_.setScale(scale, roundingMode); - } - } - else - return value_; - } - - public InputStream getBinaryStream() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - return false; //false seems logical here - } - - return (value_.compareTo(BigDecimal.valueOf(0)) != 0); - } - - public byte getByte() throws SQLException { - //this code is similar to SQLDouble, and then in inner iff, it is like - // SQLDecimal - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - //@snan snan is not yet supported, return as regular nan - if(specialValue_.indexOf("-SNaN") != -1) //@snan - return (new Double("-NaN")).byteValue(); - else if(specialValue_.indexOf("SNaN") != -1) //@snan - return (new Double("NaN")).byteValue(); - else - return (new Double(specialValue_)).byteValue(); - } - - if (value_.compareTo(BYTE_MAX_VALUE) > 0 || value_.compareTo(BYTE_MIN_VALUE) < 0) { - if (value_.compareTo(SHORT_MAX_VALUE) > 0 || value_.compareTo(SHORT_MIN_VALUE) < 0) { - if (value_.compareTo(INTEGER_MAX_VALUE) > 0 || value_.compareTo(INTEGER_MIN_VALUE) < 0) { - if (value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) { - truncated_ = 15; //16 bytes - 1; - } else { - truncated_ = 7; - } - } else { - truncated_ = 3; - } - } else { - truncated_ = 1; - } - } - return value_.byteValue(); - } - - public byte[] getBytes() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - //@snan snan is not yet supported, return as regular nan - if(specialValue_.indexOf("-SNaN") != -1) //@snan - return (new Double("-NaN")).doubleValue(); - else if(specialValue_.indexOf("SNaN") != -1) //@snan - return (new Double("NaN")).doubleValue(); - else - return (new Double(specialValue_)).doubleValue(); - } - - if (value_.compareTo(DOUBLE_MAX_VALUE) > 0 || value_.compareTo(DOUBLE_MIN_VALUE) < 0) { - truncated_ = 8; //16 bytes - 8; - } - - return value_.doubleValue(); - } - - public float getFloat() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - //@snan snan is not yet supported, return as regular nan - if(specialValue_.indexOf("-SNaN") != -1) //@snan - return (new Float("-NaN")).floatValue(); - else if(specialValue_.indexOf("SNaN") != -1) //@snan - return (new Float("NaN")).floatValue(); - else - return (new Float(specialValue_)).floatValue(); - } - - if (value_.compareTo(FLOAT_MAX_VALUE) > 0 || value_.compareTo(FLOAT_MIN_VALUE) < 0) { - if (value_.compareTo(DOUBLE_MAX_VALUE) > 0 || value_.compareTo(DOUBLE_MIN_VALUE) < 0) { - truncated_ = 12; //16 bytes - 4; - } else { - truncated_ = 4; - } - } - return value_.floatValue(); - } - - public int getInt() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - //remove this when Integer supports Nan, Inf, -Inf - if(specialValue_ != null){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - if (value_.compareTo(INTEGER_MAX_VALUE) > 0 || value_.compareTo(INTEGER_MIN_VALUE) < 0) { - if (value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) { - truncated_ = 12; //16 bytes - 4; - } else { - truncated_ = 4; - } - } - - return value_.intValue(); - } - - public long getLong() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - //remove this when Long supports Nan, Inf, -Inf - if(specialValue_ != null){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - if( value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) - { - truncated_ = 8; //16 bytes - 8; - } - return value_.longValue(); - } - - public Object getObject() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - //in this case, return String object instead of throwing exception - //remove this when BigDecimal supports Nan, Inf, -Inf - if(specialValue_ != null){ - return specialValue_; - } - - return value_; - } - - public short getShort() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - if (value_.compareTo(SHORT_MAX_VALUE) > 0 || value_.compareTo(SHORT_MIN_VALUE) < 0) { - if (value_.compareTo(INTEGER_MAX_VALUE) > 0 || value_.compareTo(INTEGER_MIN_VALUE) < 0) { - if (value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) { - truncated_ = 14; //16 bytes - 2; - } else { - truncated_ = 6; - } - } else { - truncated_ = 2; - } - } - - return value_.shortValue(); - } - - public String getString() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - return specialValue_; - } - - String stringRep = value_.toString(); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - /** Helper method to return string value of special values that - * cannot be held in current BigDecimal objects. - * Valid inputs = "NaN", "NAN", "+NaN", "-NaN", "QNaN", "+QNaN", "-QNaN", "SNaN", "+SNaN", "-SNaN", "INF", "+INF", - * "-INF", "Infinity", "+Infinity", "-Infinity" - */ - private String getSpecialValue(String number){ - //use indexOf() so that we can use this method for exception text from AS400DecFloat also - int startOfValue = -1; - //@snan - if ( (startOfValue = number.toUpperCase().indexOf("SNAN")) != -1 ){ - //check for sign - if ( ((startOfValue > 0 ) && (number.charAt(startOfValue - 1) == '-') ) ) - return "-SNaN"; //no representaion in Double - else - return "SNaN"; //no representaion in Double - } - else if ( (startOfValue = number.toUpperCase().indexOf("NAN")) != -1 ){ - //check for sign - if ( ((startOfValue > 0 ) && (number.charAt(startOfValue - 1) == '-') ) - || ((startOfValue > 1 ) && (number.charAt(startOfValue - 2) == '-')) ) - return "-NaN"; //no representaion in Double - return String.valueOf(Double.NaN); - } - else if ( (startOfValue = number.toUpperCase().indexOf("INF")) != -1){ - //check for sign - if ( (startOfValue != 0 ) && (number.charAt(startOfValue - 1) == '-')) - return String.valueOf(Double.NEGATIVE_INFINITY); - else - return String.valueOf(Double.POSITIVE_INFINITY); - } - else - return null; //not a special value - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - return specialValue_; - } - - String stringRep = value_.toString(); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - //@pda jdbc40 - /* ifdef JDBC40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - //@pda jdbc40 - /* ifdef JDBC40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SQLDecFloat34.java b/cvsroot/src/com/ibm/as400/access/SQLDecFloat34.java deleted file mode 100644 index 55789d643..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLDecFloat34.java +++ /dev/null @@ -1,684 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -//JTOpen (IBM Toolbox for Java - OSS version) -// -//Filename: SQLDecFloat34.java -// -//The source code contained herein is licensed under the IBM Public License -//Version 1.0, which has been approved by the Open Source Initiative. -//Copyright (C) 2006 International Business Machines Corporation and -//others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/*ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -//@DFA new class -final class SQLDecFloat34 implements SQLData { - static final String copyright = "Copyright (C) 2006 International Business Machines Corporation and others."; - - private static final BigDecimal default_ = BigDecimal.valueOf(0); - - //various min/max values used for comparisons in calculating truncation etc - private static final BigDecimal BYTE_MAX_VALUE = BigDecimal.valueOf(Byte.MAX_VALUE); - - private static final BigDecimal BYTE_MIN_VALUE = BigDecimal.valueOf(Byte.MIN_VALUE); - - private static final BigDecimal SHORT_MAX_VALUE = BigDecimal.valueOf(Short.MAX_VALUE); - - private static final BigDecimal SHORT_MIN_VALUE = BigDecimal.valueOf(Short.MIN_VALUE); - - private static final BigDecimal INTEGER_MAX_VALUE = BigDecimal.valueOf(Integer.MAX_VALUE); - - private static final BigDecimal INTEGER_MIN_VALUE = BigDecimal.valueOf(Integer.MIN_VALUE); - - private static final BigDecimal LONG_MAX_VALUE = BigDecimal.valueOf(Long.MAX_VALUE); - - private static final BigDecimal LONG_MIN_VALUE = BigDecimal.valueOf(Long.MIN_VALUE); - - private static final BigDecimal FLOAT_MAX_VALUE = new BigDecimal(Float.MAX_VALUE); - - private static final BigDecimal FLOAT_MIN_VALUE = new BigDecimal(-Float.MAX_VALUE); //@PDC MIN_VALUE is positive - - private static final BigDecimal DOUBLE_MAX_VALUE = new BigDecimal(Double.MAX_VALUE); - - private static final BigDecimal DOUBLE_MIN_VALUE = new BigDecimal(-Double.MAX_VALUE); //@PDC MIN_VALUE is positive - - static final int DECFLOAT34_MIN_EXP = -6143; - - private SQLConversionSettings settings_; - - private int precision_; //34 - - private int truncated_; - - String specialValue_ = null; //since BigDecimal cannot hold "Infinity", "-Infinity" or "NaN", store them here as string - - private AS400DecFloat typeConverter_; - - private BigDecimal value_; - - private JDProperties properties_; - - private int roundingMode; - - private String roundingModeStr; - - private int vrm_; - - SQLDecFloat34( SQLConversionSettings settings, int vrm, JDProperties properties) { - settings_ = settings; - precision_ = 34; - truncated_ = 0; - roundingModeStr = properties.getString(JDProperties.DECFLOAT_ROUNDING_MODE); - typeConverter_ = new AS400DecFloat(precision_); - value_ = default_; - vrm_ = vrm; - properties_ = properties; - - //parse property rounding mode and save its value as int (needed for BigDecimal, MathContext etc) - // valid rounding modes are: - //"half even" - //"half up" - //"down" - //"ceiling" - //"floor" - //"half down" - //"up" - - if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_UP)) - roundingMode = BigDecimal.ROUND_UP; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_DOWN)) - roundingMode = BigDecimal.ROUND_DOWN; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_CEILING)) - roundingMode = BigDecimal.ROUND_CEILING; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_FLOOR)) - roundingMode = BigDecimal.ROUND_FLOOR; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_UP)) - roundingMode = BigDecimal.ROUND_HALF_UP; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_DOWN)) - roundingMode = BigDecimal.ROUND_HALF_DOWN; - else if ( roundingModeStr.equals(JDProperties.DECFLOAT_ROUNDING_MODE_HALF_EVEN)) - roundingMode = BigDecimal.ROUND_HALF_EVEN; - - - //for MathContext, methods take strings which are same as JDProperties rounding modes with "round" added. - roundingModeStr = "ROUND_" + roundingModeStr.toUpperCase().replace(' ', '_'); - } - - public Object clone() { - return new SQLDecFloat34( settings_, vrm_, properties_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccisdConverter) - throws SQLException { - try{ - value_ = ((BigDecimal) typeConverter_.toObject(rawBytes, offset)); - specialValue_ = null; - } catch (ExtendedIllegalArgumentException e) { - //check for NAN and INF flag exception - if ( (specialValue_ = getSpecialValue( e.toString())) == null ) - throw e; - } - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException { - try{ - if ( specialValue_ == null) - typeConverter_.toBytes(value_, rawBytes, offset); - else - typeConverter_.toBytes(specialValue_, rawBytes, offset); //Nan, Infinity, -Infinity - } catch (ExtendedIllegalArgumentException e) { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) throws SQLException { - BigDecimal bigDecimal = null; - specialValue_ = null; - - if (object instanceof String) { - try { - if ( (specialValue_ = getSpecialValue( (String)object)) == null ) { - //not one of the special values, just store as BigDecimal - // Because the string may be using a comma for the decimal separator and we are going to - // store the object as a Java Bigdec, we much check and change to the default '.' notation. - if (((String)object).indexOf(',')!=-1) { - bigDecimal = new BigDecimal (((String)object).replace(',', '.')); - } else { - bigDecimal = new BigDecimal((String)object); - } - } - } catch (NumberFormatException e) { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - } catch (StringIndexOutOfBoundsException e) // jdk 1.3.x throws this - // instead of a NFE - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if (object instanceof Number) { - if ( (specialValue_ = getSpecialValue( object.toString())) == null ) { - //not one of the special values, just store as BigDecimal - bigDecimal = new BigDecimal(object.toString()); //convert to string so all Number types can be passed in - } - } - - else if (object instanceof Boolean) - bigDecimal = (((Boolean) object).booleanValue() == true) ? BigDecimal.valueOf(1) : BigDecimal.valueOf(0); - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - //Round by mode if necessary. - truncated_ = 0; - - //if one of the special values, then no need to check truncation - if(specialValue_ != null) - { - //Nan, Infinity, -Infinity - value_ = null; - return; - } - - //follow native and allow rounding mode to handle - //@pdd int otherScale = bigDecimal.scale(); - //@pdd if(otherScale > ((-1) * DECFLOAT34_MIN_EXP)) //absolute of min_exp is max scale - //@pdd truncated_ += otherScale + DECFLOAT34_MIN_EXP; //diff in scales - - //get precision from bigDecimal without 0's on right side - //@pdd int otherPrecision = SQLDataFactory.getPrecisionForTruncation(bigDecimal, 34); - - //follow native and allow rounding mode to handle - //@pdd if(otherPrecision > precision_) - //@pdd { - //@pdd int digits = otherPrecision - precision_; - //@pdd truncated_ += digits; - //@pdd } - //@pdd else - //@pdd truncated_ = 0; // No left side truncation, report nothing - //@pdd // (even if there was right side truncation). - - value_ = AS400DecFloat.roundByMode(bigDecimal, 34, roundingModeStr); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() { - return SQLData.DECFLOAT; - } - - public String getCreateParameters() { - return null; - } - - public int getDisplaySize() { - return 42; //@pdc same as native - } - - - public String getJavaClassName() { - return "java.math.BigDecimal"; - } - - public String getLiteralPrefix() { - return null; - } - - public String getLiteralSuffix() { - return null; - } - - public String getLocalName() { - return "DECFLOAT"; - } - - public int getMaximumPrecision() { - return precision_; - } - - public int getMaximumScale() { - return 0; - } - - public int getMinimumScale() { - return 0; - } - - public int getNativeType() { - return 996; - } - - public int getPrecision() { - return precision_; - } - - public int getRadix() { - return 10; //decimal base (4 bits per digit) - } - - public int getScale() { - return 0; - } - - public int getType() { - return java.sql.Types.OTHER; //decfloat is not sql type right now. - } - - public String getTypeName() { - return "DECFLOAT"; - } - - public boolean isSigned() { - return true; - } - - public boolean isText() { - return false; - } - - public int getActualSize() { - if(specialValue_ == null) - return SQLDataFactory.getPrecision( value_ ); - else - return specialValue_.length(); - } - - public int getTruncated() { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - //remove this when BigDecimal supports Nan, Inf, -Inf - if(specialValue_ != null){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - if(scale >= 0) - { - if(scale >= value_.scale()) - { - return value_.setScale(scale); - } - else - { - truncated_ = value_.scale() - scale; - return value_.setScale(scale, roundingMode); - } - } - else - return value_; - } - - public InputStream getBinaryStream() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - return false; //false seems logical here - } - - return (value_.compareTo(BigDecimal.valueOf(0)) != 0); - } - - public byte getByte() throws SQLException { - //this code is similar to SQLDouble, and then in inner iff, it is like - // SQLDecimal - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - //@snan snan is not yet supported, return as regular nan - if(specialValue_.indexOf("-SNaN") != -1) //@snan - return (new Double("-NaN")).byteValue(); - else if(specialValue_.indexOf("SNaN") != -1) //@snan - return (new Double("NaN")).byteValue(); - else - return (new Double(specialValue_)).byteValue(); - } - - if (value_.compareTo(BYTE_MAX_VALUE) > 0 || value_.compareTo(BYTE_MIN_VALUE) < 0) { - if (value_.compareTo(SHORT_MAX_VALUE) > 0 || value_.compareTo(SHORT_MIN_VALUE) < 0) { - if (value_.compareTo(INTEGER_MAX_VALUE) > 0 || value_.compareTo(INTEGER_MIN_VALUE) < 0) { - if (value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) { - truncated_ = 15; //16 bytes - 1; - } else { - truncated_ = 7; - } - } else { - truncated_ = 3; - } - } else { - truncated_ = 1; - } - } - return value_.byteValue(); - } - - public byte[] getBytes() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - //@snan snan is not yet supported, return as regular nan - if(specialValue_.indexOf("-SNaN") != -1) //@snan - return (new Double("-NaN")).doubleValue(); - else if(specialValue_.indexOf("SNaN") != -1) //@snan - return (new Double("NaN")).doubleValue(); - else - return (new Double(specialValue_)).doubleValue(); - } - - if (value_.compareTo(DOUBLE_MAX_VALUE) > 0 || value_.compareTo(DOUBLE_MIN_VALUE) < 0) { - truncated_ = 8; //16 bytes - 8; - } - - return value_.doubleValue(); - } - - public float getFloat() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - //@snan snan is not yet supported, return as regular nan - if(specialValue_.indexOf("-SNaN") != -1) //@snan - return (new Float("-NaN")).floatValue(); - else if(specialValue_.indexOf("SNaN") != -1) //@snan - return (new Float("NaN")).floatValue(); - else - return (new Float(specialValue_)).floatValue(); - } - - if (value_.compareTo(FLOAT_MAX_VALUE) > 0 || value_.compareTo(FLOAT_MIN_VALUE) < 0) { - if (value_.compareTo(DOUBLE_MAX_VALUE) > 0 || value_.compareTo(DOUBLE_MIN_VALUE) < 0) { - truncated_ = 12; //16 bytes - 4; - } else { - truncated_ = 4; - } - } - return value_.floatValue(); - } - - public int getInt() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - //remove this when Integer supports Nan, Inf, -Inf - if(specialValue_ != null){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - if (value_.compareTo(INTEGER_MAX_VALUE) > 0 || value_.compareTo(INTEGER_MIN_VALUE) < 0) { - if (value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) { - truncated_ = 12; //16 bytes - 4; - } else { - truncated_ = 4; - } - } - - return value_.intValue(); - } - - public long getLong() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - //remove this when Long supports Nan, Inf, -Inf - if(specialValue_ != null){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - if( value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) - { - truncated_ = 8; //16 bytes - 8; - } - return value_.longValue(); - } - - public Object getObject() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - //in this case, return String object instead of throwing exception - //remove this when BigDecimal supports Nan, Inf, -Inf - if(specialValue_ != null){ - return specialValue_; - } - - return value_; - } - - public short getShort() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - if (value_.compareTo(SHORT_MAX_VALUE) > 0 || value_.compareTo(SHORT_MIN_VALUE) < 0) { - if (value_.compareTo(INTEGER_MAX_VALUE) > 0 || value_.compareTo(INTEGER_MIN_VALUE) < 0) { - if (value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) { - truncated_ = 14; //16 bytes - 2; - } else { - truncated_ = 6; - } - } else { - truncated_ = 2; - } - } - - return value_.shortValue(); - } - - public String getString() throws SQLException { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - return specialValue_; - } - - String stringRep = value_.toString(); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() throws SQLException { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - /** Helper method to return string value of special values that - * cannot be held in current BigDecimal objects. - * Valid inputs = "NaN", "NAN", "+NaN", "-NaN", "QNaN", "+QNaN", "-QNaN", "SNaN", "+SNaN", "-SNaN", "INF", "+INF", - * "-INF", "Infinity", "+Infinity", "-Infinity" - */ - private String getSpecialValue(String number){ - //use indexOf() so that we can use this method for exception text from AS400DecFloat also - int startOfValue = -1; - //@snan - if ( (startOfValue = number.toUpperCase().indexOf("SNAN")) != -1 ){ - //check for sign - if ( ((startOfValue > 0 ) && (number.charAt(startOfValue - 1) == '-') ) ) - return "-SNaN"; //no representaion in Double - else - return "SNaN"; //no representaion in Double - } - else if ( (startOfValue = number.toUpperCase().indexOf("NAN")) != -1 ){ - //check for sign - if ( ((startOfValue > 0 ) && (number.charAt(startOfValue - 1) == '-') ) - || ((startOfValue > 1 ) && (number.charAt(startOfValue - 2) == '-')) ) - return "-NaN"; //no representaion in Double - return String.valueOf(Double.NaN); - } - else if ( (startOfValue = number.toUpperCase().indexOf("INF")) != -1){ - //check for sign - if ( (startOfValue != 0 ) && (number.charAt(startOfValue - 1) == '-')) - return String.valueOf(Double.NEGATIVE_INFINITY); - else - return String.valueOf(Double.POSITIVE_INFINITY); - } - else - return null; //not a special value - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - /*ifdef JDBC40 - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - - //NaN, Infinity, -Infinity - if(specialValue_ != null){ - return specialValue_; - } - - String stringRep = value_.toString(); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - //@pda jdbc40 - /* ifdef JDBC40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - //@pda jdbc40 - /* ifdef JDBC40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/SQLDecimal.java b/cvsroot/src/com/ibm/as400/access/SQLDecimal.java deleted file mode 100644 index 88b360ec2..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLDecimal.java +++ /dev/null @@ -1,572 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLDecimal.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/*ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/*ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLDecimal -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private. - private static final BigDecimal default_ = BigDecimal.valueOf(0); // @C2A - private static final BigDecimal BYTE_MAX_VALUE = BigDecimal.valueOf(Byte.MAX_VALUE); - private static final BigDecimal BYTE_MIN_VALUE = BigDecimal.valueOf(Byte.MIN_VALUE); - private static final BigDecimal SHORT_MAX_VALUE = BigDecimal.valueOf(Short.MAX_VALUE); - private static final BigDecimal SHORT_MIN_VALUE = BigDecimal.valueOf(Short.MIN_VALUE); - private static final BigDecimal INTEGER_MAX_VALUE = BigDecimal.valueOf(Integer.MAX_VALUE); - private static final BigDecimal INTEGER_MIN_VALUE = BigDecimal.valueOf(Integer.MIN_VALUE); - private static final BigDecimal LONG_MAX_VALUE = BigDecimal.valueOf(Long.MAX_VALUE); - private static final BigDecimal LONG_MIN_VALUE = BigDecimal.valueOf(Long.MIN_VALUE); - static final BigDecimal FLOAT_MAX_VALUE = new BigDecimal(Float.MAX_VALUE); - static final BigDecimal FLOAT_MIN_VALUE = new BigDecimal(Float.MIN_VALUE); - static final BigDecimal DOUBLE_MAX_VALUE = new BigDecimal(Double.MAX_VALUE); - static final BigDecimal DOUBLE_MIN_VALUE = new BigDecimal(Double.MIN_VALUE); - - private SQLConversionSettings settings_; - private int precision_; - private int scale_; - private int truncated_; - private AS400PackedDecimal typeConverter_; - private BigDecimal value_; - private JDProperties properties_; // @M0A - added JDProperties so we can get the scale & precision - private int vrm_; // @M0A - - SQLDecimal(int precision, - int scale, - SQLConversionSettings settings, - int vrm, // @M0C - JDProperties properties) // @M0C - { - settings_ = settings; - precision_ = precision; - scale_ = scale; - truncated_ = 0; - typeConverter_ = new AS400PackedDecimal(precision_, scale_); - value_ = default_; // @C2C - vrm_ = vrm; // @M0A - properties_ = properties; // @M0A - } - - public Object clone() - { - return new SQLDecimal(precision_, scale_, settings_, vrm_, properties_); // @M0C - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccisdConverter) //@P0C - throws SQLException - { - value_ = ((BigDecimal)typeConverter_.toObject(rawBytes, offset)); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - try{ - typeConverter_.toBytes(value_, rawBytes, offset); - } - catch(ExtendedIllegalArgumentException e){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - BigDecimal bigDecimal = null; - - if(object instanceof String) - { - try - { - String value = SQLDataFactory.convertScientificNotation((String)object); // @F3C - if(scale >= 0) - value = SQLDataFactory.truncateScale(value, scale); - bigDecimal = new BigDecimal(value); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - } - catch(StringIndexOutOfBoundsException e) // jdk 1.3.x throws this instead of a NFE - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(object instanceof Number) - { - String value = SQLDataFactory.convertScientificNotation(object.toString()); // @C1C - if(scale >= 0) - value = SQLDataFactory.truncateScale(value, scale); - bigDecimal = new BigDecimal(value); - } - - else if(object instanceof Boolean) - bigDecimal = (((Boolean)object).booleanValue() == true) ? BigDecimal.valueOf(1) : BigDecimal.valueOf(0); - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Truncate if necessary. If we ONLY truncate on the right side, we don't @E2C - // need to report it. If we truncate on the left side, then we report the @E2A - // number of truncated digits on both ends...this will make the dataSize @E2A - // and transferSize make sense on the resulting DataTruncation. @E2A - truncated_ = 0; - int otherScale = bigDecimal.scale(); - if(otherScale > scale_) - truncated_ += otherScale - scale_; - value_ = bigDecimal.setScale(scale_, BigDecimal.ROUND_DOWN); // @E2C - - int otherPrecision = SQLDataFactory.getPrecision(value_); - if(otherPrecision > precision_) - { - int digits = otherPrecision - precision_; - truncated_ += digits; - value_ = SQLDataFactory.truncatePrecision(value_, digits); - } - else // @E2A - truncated_ = 0; // No left side truncation, report nothing @E2A - // (even if there was right side truncation). @E2A - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.DECIMAL; - } - - public String getCreateParameters() - { - StringBuffer buffer = new StringBuffer(); - buffer.append(AS400JDBCDriver.getResource("PRECISION")); - buffer.append(","); - buffer.append(AS400JDBCDriver.getResource("SCALE")); - return buffer.toString(); - } - - public int getDisplaySize() - { - return precision_ + 2; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.math.BigDecimal"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "DECIMAL"; - } - - public int getMaximumPrecision() - { - // @M0C - change to check vrm and JDProperties - if(vrm_ >= JDUtilities.vrm530) - return properties_.getInt(JDProperties.MAXIMUM_PRECISION); - else - return 31; - } - - public int getMaximumScale() - { - // @M0C - change to check vrm and JDProperties - if(vrm_ >= JDUtilities.vrm530) - return properties_.getInt(JDProperties.MAXIMUM_SCALE); - else - return 31; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 484; - } - - public int getPrecision() - { - return precision_; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return scale_; - } - - public int getType() - { - return java.sql.Types.DECIMAL; - } - - public String getTypeName() - { - return "DECIMAL"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return precision_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - if(scale >= 0) - { - if(scale >= value_.scale()) - { - return value_.setScale(scale); - } - else - { - truncated_ = value_.scale() - scale; - return value_.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return value_; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_.compareTo(BigDecimal.valueOf(0)) != 0); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - if(value_.compareTo(BYTE_MAX_VALUE) > 0 || value_.compareTo(BYTE_MIN_VALUE) < 0) - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 1; - } - return(byte) value_.byteValue(); - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - double d = value_.doubleValue(); //@KBA - //@KBD will never occur with current precision of 63 - //@KBD if(value_.compareTo(DOUBLE_MAX_VALUE) > 0 || value_.compareTo(DOUBLE_MIN_VALUE) < 0) - if(d == Double.POSITIVE_INFINITY || d == Double.NEGATIVE_INFINITY) //@KBA - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 8; - } - return d; //@KBC value_.doubleValue(); - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - float f = value_.floatValue(); //@KBA - //@KBD changed in order to avoid optimization problem in JRE 1.3 - //@KBD if(value_.compareTo(FLOAT_MAX_VALUE) > 0 || value_.compareTo(FLOAT_MIN_VALUE) < 0) - if( f == Float.POSITIVE_INFINITY || f == Float.NEGATIVE_INFINITY) //@KBA - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 4; - } - return f; //@KBC value_.floatValue(); - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - if(value_.compareTo(INTEGER_MAX_VALUE) > 0 || value_.compareTo(INTEGER_MIN_VALUE) < 0) - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 4; - } - return value_.intValue(); - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - if(value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 8; - } - return value_.longValue(); - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - if(value_.compareTo(SHORT_MAX_VALUE) > 0 || value_.compareTo(SHORT_MIN_VALUE) < 0) - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 2; - } - return(short) value_.shortValue(); - } - - public String getString() - throws SQLException - { - truncated_ = 0; - String stringRep = JDUtilities.bigDecimalToPlainString(value_); //@big java 1.5 support - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - return new StringReader(getNString()); - } - - //@pda jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - String stringRep = value_.toString(); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - /* ifdef JDBC40 - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SQLDecimal2.java b/cvsroot/src/com/ibm/as400/access/SQLDecimal2.java deleted file mode 100644 index 7c200da63..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLDecimal2.java +++ /dev/null @@ -1,508 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLDecimal2.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/*ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/*ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLDecimal2 -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int precision_; - private int scale_; - private AS400PackedDecimal typeConverter_; - private double value_; - private int truncated_; - private JDProperties properties_; // @M0A - added JDProperties so we can get the scale & precision - private int vrm_; // @M0A - - SQLDecimal2(int precision, - int scale, - SQLConversionSettings settings, - int vrm, // @M0C - JDProperties properties) // @M0C - { - settings_ = settings; - precision_ = precision; - scale_ = scale; - typeConverter_ = new AS400PackedDecimal(precision_, scale_); - value_ = 0; - truncated_ = 0; - vrm_ = vrm; // @M0A - properties_ = properties; // @M0A - } - - public Object clone() - { - return new SQLDecimal2(precision_, scale_, settings_, vrm_, properties_); // @M0C - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccisdConverter) //@P0C - throws SQLException - { - value_ = typeConverter_.toDouble(rawBytes, offset); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - typeConverter_.toBytes(value_, rawBytes, offset); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(object instanceof String) - { - try - { - value_ = Double.valueOf((String)object).doubleValue(); - } - catch(NumberFormatException nfe) - { // @E4A - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); // @E4A - } - } - - else if(object instanceof Number) - value_ = ((Number)object).doubleValue(); - - else if(object instanceof Boolean) - value_ = ((Boolean)object).booleanValue() ? 1 : 0; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.DECIMAL_USING_DOUBLE; - } - - public String getCreateParameters() - { - StringBuffer buffer = new StringBuffer(); - buffer.append(AS400JDBCDriver.getResource("PRECISION")); - buffer.append(","); - buffer.append(AS400JDBCDriver.getResource("SCALE")); - return buffer.toString(); - } - - public int getDisplaySize() - { - return precision_ + 2; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.math.BigDecimal"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "DECIMAL"; - } - - public int getMaximumPrecision() - { - // @M0C - change to check vrm and JDProperties - if(vrm_ >= JDUtilities.vrm530) - return properties_.getInt(JDProperties.MAXIMUM_PRECISION); - else - return 31; - } - - public int getMaximumScale() - { - // @M0C - change to check vrm and JDProperties - if(vrm_ >= JDUtilities.vrm530) - return properties_.getInt(JDProperties.MAXIMUM_SCALE); - else - return 31; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 484; - } - - public int getPrecision() - { - return precision_; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return scale_; - } - - public int getType() - { - return java.sql.Types.DECIMAL; - } - - public String getTypeName() - { - return "DECIMAL"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return precision_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - return new BigDecimal(value_); - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_ != 0); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - if(value_ > Byte.MAX_VALUE || value_ < Byte.MIN_VALUE) - { - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 7; - } - else - { - truncated_ = 3; - } - } - else - { - truncated_ = 1; - } - } - return(byte)value_; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - if(value_ > Float.MAX_VALUE || value_ < -Float.MAX_VALUE) //@trunc min_val is a posative number. //Float.MIN_VALUE) - { - truncated_ = 4; - } - return(float)value_; - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 4; - } - return(int)value_; - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - if(value_ > Long.MAX_VALUE || value_ < Long.MIN_VALUE) - { - truncated_ = 1; // this is not necessarily correct, but we know there is truncation - } - return(long)value_; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return new Double(value_); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 6; - } - else - { - truncated_ = 2; - } - } - return(short)value_; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - String stringRep = Double.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - return new StringReader(getNString()); - } - - //@pda jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - String stringRep = Double.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - /* ifdef JDBC40 - - //@pda jdbc40 - - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SQLDouble.java b/cvsroot/src/com/ibm/as400/access/SQLDouble.java deleted file mode 100644 index deb103170..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLDouble.java +++ /dev/null @@ -1,534 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLDouble.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/*ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/*ifdef JDBC40 -import java.sql.SQLXML; -endif*/ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLDouble -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int truncated_; - private double value_; - - SQLDouble(SQLConversionSettings settings) - { - settings_ = settings; - truncated_ = 0; - value_ = 0.0d; - } - - public Object clone() - { - return new SQLDouble(settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = BinaryConverter.byteArrayToDouble(rawBytes, offset); // @D0C - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - BinaryConverter.doubleToByteArray(value_, rawBytes, offset); // @D0C - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - truncated_ = 0; - - if(object instanceof String) - { - try - { - value_ = Double.valueOf((String) object).doubleValue(); - // You can't test for data truncation of a number by testing - // the lengths of two string versions of it. - // Example string that should work but will fail: - // "4.749000000000E+00" - //@E2D int objectLength = ((String) object).length(); - //@E2D int valueLength = Double.toString(value_).length(); - //@E2D if(valueLength < objectLength) - //@E2D truncated_ = objectLength - valueLength; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - // @ D9d - // else if(object instanceof BigDecimal) { - // value_ = ((BigDecimal) object).doubleValue(); - // int objectLength = SQLDataFactory.getPrecision((BigDecimal) object); - // int valueLength = SQLDataFactory.getPrecision(new BigDecimal(value_)); - // if(valueLength < objectLength) - // truncated_ = objectLength - valueLength; - // } - - else if(object instanceof Number) - { - // Set the value to the right type. - //@bigdectrunc change to follow native driver - value_ = ((Number) object).doubleValue(); - } - - else if(object instanceof Boolean) - value_ = (((Boolean) object).booleanValue() == true) ? 1d : 0d; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.DOUBLE; - } - - public String getCreateParameters() - { - return null; - } - - public int getDisplaySize() - { - return 22; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.Double"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - // Use "FLOAT" not "DOUBLE". See ODBC SQLGetTypeInfo(). - return "FLOAT"; - } - - public int getMaximumPrecision() - { - return 53; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 480; - } - - public int getPrecision() - { - return 53; - } - - public int getRadix() - { - return 2; //@K1C Changed from 10 - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.DOUBLE; - } - - public String getTypeName() - { - return "DOUBLE"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return SQLDataFactory.getPrecision(Double.toString(value_)); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - // Convert the value to a String before creating the - // BigDecimal. This will create the exact BigDecimal - // that we want. If you pass the value directly to - // BigDecimal, then the value is not exact, and the - // scale becomes bigger than expected. - - // @A0A - // Modified the code to deal with numbers in scientific - // notations. The numbers that are in scientific notation - // are parsed to a base (the part before 'E') and an - // exponent (the part after 'E'). The base is then used - // to construct the BigDecimal object and then the exponent - // is used to shift the decimal point to its rightful place. - - // BigDecimal bigDecimal = new BigDecimal(Double.toString(value_)) // @A0D - - truncated_ = 0; - - BigDecimal bigDecimal = null; // @A0A - - String numString = Double.toString(value_); // @A0A - int eIndex = numString.indexOf("E"); // @A0A - if(eIndex == -1) - { // @A0A - bigDecimal = new BigDecimal(numString); // @A0A - } // @A0A - else - { // @A0A - String base = numString.substring(0, eIndex); // @A0A - int exponent = Integer.parseInt(numString.substring(eIndex+1)); // @A0A - bigDecimal = new BigDecimal(base); // @A0A - bigDecimal = bigDecimal.movePointRight(exponent); // @A0A - } // @A0A - - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_ != 0.0d); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - if(value_ > Byte.MAX_VALUE || value_ < Byte.MIN_VALUE) - { - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 7; - } - else - { - truncated_ = 3; - } - } - else - { - truncated_ = 1; - } - } - return(byte) value_; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - return(double) value_; - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - if(Double.isInfinite(value_)) //@tr3a - truncated_ = 0; //@tr3a - else if(value_ > Float.MAX_VALUE || value_ < -Float.MAX_VALUE) //@trunc min_val is a posative number. //Float.MIN_VALUE) //@tr3c - { - truncated_ = 4; - } - return(float) value_; - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 4; - } - return(int) value_; - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - if(value_ > Long.MAX_VALUE || value_ < Long.MIN_VALUE) - { - truncated_ = 1; // this is not necessarily correct, but we know there is truncation - } - return(long) value_; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return new Double(value_); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 6; - } - else - { - truncated_ = 2; - } - } - return(short) value_; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - String stringRep = Double.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - String stringRep = Double.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - /* ifdef JDBC40 - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLFloat.java b/cvsroot/src/com/ibm/as400/access/SQLFloat.java deleted file mode 100644 index 71875d526..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLFloat.java +++ /dev/null @@ -1,529 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLFloat.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/*ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/*ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLFloat -implements SQLData -{ - - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int truncated_; - private double value_; - - SQLFloat(SQLConversionSettings settings) - { - settings_ = settings; - truncated_ = 0; - value_ = 0.0d; - } - - public Object clone() - { - return new SQLFloat(settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = BinaryConverter.byteArrayToDouble(rawBytes, offset); // @D0C - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - BinaryConverter.doubleToByteArray(value_, rawBytes, offset); // @D0C - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - truncated_ = 0; - - if(object instanceof String) - { - try - { - value_ = Double.valueOf((String) object).doubleValue(); - // You can't test for data truncation of a number by testing - // the lengths of two string versions of it. - // Example string that should work but will fail: - // "4.749000000000E+00" - //@E2D int objectLength = ((String) object).length(); - //@E2D int valueLength = Double.toString(value_).length(); - //@E2D if(valueLength < objectLength) - //@E2D truncated_ = objectLength - valueLength; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - //else if(object instanceof BigDecimal) { - // value_ = ((BigDecimal) object).doubleValue(); - // int objectLength = SQLDataFactory.getPrecision((BigDecimal) object); - // int valueLength = SQLDataFactory.getPrecision(new BigDecimal(value_)); - // if(valueLength < objectLength) - // truncated_ = objectLength - valueLength; - //} - - else if(object instanceof Number) - { - // Set the value to the right type. - value_ = ((Number) object).doubleValue(); // @D9c - - // Get the whole number portion of that value. - //long value = (long) value_; // @D9a //@bigdectrunc change to follow native driver - - // Get the original value as a long. This is the - // largest precision we can test for for a truncation. - // long truncTest = ((Number) object).longValue(); // @D9a //@bigdectrunc - - // If they are not equal, then we truncated significant - // data from the original value the user wanted us to insert. - //if(truncTest != value) // @D9a //@bigdectrunc - //truncated_ = 1; //@bigdectrunc - } - - else if(object instanceof Boolean) - value_ = (((Boolean) object).booleanValue() == true) ? 1d : 0d; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.FLOAT; - } - - public String getCreateParameters() - { - return null; - } - - public int getDisplaySize() - { - return 22; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.Float"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "FLOAT"; - } - - public int getMaximumPrecision() - { - return 53; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 480; - } - - public int getPrecision() - { - return 53; - } - - public int getRadix() - { - return 2; //@K1C changed from 10 - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.FLOAT; - } - - public String getTypeName() - { - return "FLOAT"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return SQLDataFactory.getPrecision(Double.toString(value_)); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - // Convert the value to a String before creating the - // BigDecimal. This will create the exact BigDecimal - // that we want. If you pass the value directly to - // BigDecimal, then the value is not exact, and the - // scale becomes bigger than expected. - - // @A0A - // Modified the code to deal with numbers in scientific - // notations. The numbers that are in scientific notation - // are parsed to a base (the part before 'E') and an - // exponent (the part after 'E'). The base is then used - // to construct the BigDecimal object and then the exponent - // is used to shift the decimal point to its rightful place. - - // BigDecimal bigDecimal = new BigDecimal(Double.toString(value_)) // @A0D - - truncated_ = 0; - - BigDecimal bigDecimal = null; // @A0A - - String numString = Double.toString(value_); // @A0A - int eIndex = numString.indexOf("E"); // @A0A - if(eIndex == -1) - { // @A0A - bigDecimal = new BigDecimal(numString); // @A0A - } // @A0A - else - { // @A0A - String base = numString.substring(0, eIndex); // @A0A - int exponent = Integer.parseInt(numString.substring(eIndex+1)); // @A0A - bigDecimal = new BigDecimal(base); // @A0A - bigDecimal = bigDecimal.movePointRight(exponent); // @A0A - } // @A0A - - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_ != 0.0d); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - if(value_ > Byte.MAX_VALUE || value_ < Byte.MIN_VALUE) - { - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - truncated_ = 3; - } - else - { - truncated_ = 1; - } - } - return(byte) value_; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - return(double) value_; - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - return(float) value_; - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 1; // this may not be accurate but we know truncation will occur - } - return(int) value_; - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - if(value_ > Long.MAX_VALUE || value_ < Long.MIN_VALUE) - { - truncated_ = 1; // this is not necessarily correct, but we know there is truncation - } - return(long) value_; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return new Double(value_); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 3; - } - else - { - truncated_ = 2; - } - } - return(short) value_; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - String stringRep = Double.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - String stringRep = Double.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - /* ifdef JDBC40 - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SQLGraphic.java b/cvsroot/src/com/ibm/as400/access/SQLGraphic.java deleted file mode 100644 index 887be637c..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLGraphic.java +++ /dev/null @@ -1,701 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLGraphic.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.CharConversionException; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/*ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/*ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.net.URL; - -final class SQLGraphic -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int maxLength_; - private int truncated_; - private String value_; - private String originalValue_; - private int ccsid_; //@cca1 - - SQLGraphic(int maxLength, SQLConversionSettings settings, int ccsid) //@cca1 - { - settings_ = settings; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; - originalValue_ = ""; - ccsid_ = ccsid; //@cca1 - } - - public Object clone() - { - return new SQLGraphic(maxLength_, settings_, ccsid_); //@cca1 - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - value_ = ccsidConverter.byteArrayToString(rawBytes, offset, maxLength_, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - // We originally padded with a single byte space. We now have the - // ccsid so we can figure out if that was right or not. If we should - // have use the double byte space, re-pad. - int ccsid = ccsidConverter.getCcsid(); - if(ccsid != 13488 && ccsid != 1200) - { - int valueLength = originalValue_.length(); - int exactLength = getDisplaySize(); - if(valueLength < exactLength) - { - StringBuffer buffer = new StringBuffer(originalValue_); - char c = '\u3000'; - for(int i = valueLength; i < exactLength; ++i) - buffer.append(c); - value_ = buffer.toString(); - } - } - - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - try - { - ccsidConverter.stringToByteArray(value_, rawBytes, offset, maxLength_, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - } - catch(CharConversionException e) - { - maxLength_ = ccsidConverter.stringToByteArray(value_, bidiConversionProperties).length; //@KBC changed to use bidiConversionProperties instead of bidiStringType - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - String value = null; - - if(object instanceof String) - value = (String) object; - - else if(object instanceof Number) - value = object.toString(); - - else if(object instanceof Boolean) - { - // @PDC - // if "translate boolean" == false, then use "0" and "1" values to match native driver - if(settings_.getTranslateBoolean() == true) - value = object.toString(); //"true" or "false" - else - value = ((Boolean)object).booleanValue() == true ? "1" : "0"; - } - - else if(object instanceof Time) - value = SQLTime.timeToString((Time) object, settings_, calendar); - - else if(object instanceof Timestamp) - value = SQLTimestamp.timestampToString((Timestamp) object, calendar); - - else if(object instanceof java.util.Date) - value = SQLDate.dateToString((java.util.Date) object, settings_, calendar); - - else if(object instanceof URL) - value = object.toString(); - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value = clob.getSubString(1, (int)clob.length()); - } - /* ifdef JDBC40 - else if(object instanceof SQLXML) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value = xml.getString(); - } - endif */ - - if(value == null) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - value_ = value; - originalValue_ = value; - - - // Set to the exact length. - int valueLength = value_.length(); - int exactLength = getDisplaySize(); - if(valueLength < exactLength) - { - StringBuffer buffer = new StringBuffer(value_); - char c = '\u0020'; - for(int i = valueLength; i < exactLength; ++i) - buffer.append(c); - value_ = buffer.toString(); - truncated_ = 0; - } - else if(valueLength > exactLength) - { - value_ = value_.substring(0, exactLength); - truncated_ = valueLength - exactLength; - } - else - truncated_ = 0; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.GRAPHIC; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - if(ccsid_ == 65535) //@bingra - return maxLength_; //@bingra - else - return maxLength_ / 2; - } - - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "GRAPHIC"; - } - - public int getMaximumPrecision() - { - return 16382; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 468; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.CHAR; - } - - public String getTypeName() - { - if( ccsid_ == 13488 || ccsid_ == 1200) //@cca1 - return "NCHAR"; //@cca1 same as native - return "GRAPHIC"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(getString().trim())); - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(getString())); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(getString()), maxLength_); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true", "false", "1", or "0", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = getString().trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).byteValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCClob(getString(), maxLength_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(getString(), settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).intValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).longValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).shortValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(getString(), settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(getString(), calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(getString()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - // Added method trim() to trim the string. - public void trim() - { - value_ = value_.trim(); - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } - - //@pda jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } - - /* ifdef JDBC40 - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - // - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this string contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } - endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLInteger.java b/cvsroot/src/com/ibm/as400/access/SQLInteger.java deleted file mode 100644 index 65887a6a2..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLInteger.java +++ /dev/null @@ -1,558 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLInteger.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/*ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLInteger -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private int truncated_; - private int value_; - private int scale_; // @A0A - private BigDecimal bigDecimalValue_ = null; // @A0A - private int vrm_; //trunc3 - - SQLInteger(int vrm) //@trunc3 - { - this(0, vrm); //@trunc3 - } - - SQLInteger(int scale, int vrm) // @A0A //@trunc3 - { - truncated_ = 0; - value_ = 0; - scale_ = scale; // @A0A - if(scale_ > 0) // @C0A - bigDecimalValue_ = new BigDecimal(Integer.toString(value_)); // @A0A - vrm_ = vrm; //@trunc3 - } - - public Object clone() - { - return new SQLInteger(scale_, vrm_); //@trunc3 - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = BinaryConverter.byteArrayToInt(rawBytes, offset); // @D0C - - if(scale_ > 0) - { // @C0A - bigDecimalValue_ = (new BigDecimal(Integer.toString(value_))).movePointLeft(scale_); // @A0A - value_ = bigDecimalValue_.intValue(); // @A0A - } // @C0A - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - BinaryConverter.intToByteArray(value_, rawBytes, offset); // @D0C - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - truncated_ = 0; // @D9c - - if(object instanceof String) - { - // @D10c new implementation - // old ... - // - // try - // { - // value_ = Integer.parseInt((String) object); - // } - // catch(NumberFormatException e) - // { - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - // } - // - // new ... - - // @P1 First try to convert the string to an int (no extra object creation). If - // that fails try turning it into a Double, which will involve an extra object - // create but Double will accept bigger numbers and floating point numbers so it - // will catch more truncation cases. The bottom line is don't create an extra - // object in the normal case. If the user does ps.setString(1, "111222333.444.555") - // on an integer field, they can't expect the best performance. - boolean tryAgain = false; // @P1a - - try - { - // @P1d long longValue = (long) Double.parseDouble((String) object); - long longValue = (long) Long.parseLong((String) object); // @P1a - - if(( longValue > Integer.MAX_VALUE ) || ( longValue < Integer.MIN_VALUE )) - { - truncated_ = 4; // @D9c - //@trunc3 match native for ps.setString() to throw mismatch instead of truncation - if(vrm_ >= JDUtilities.vrm610) //@trunc3 - { //@trunc3 - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); //@trunc3 - } //@trunc3 - } - value_ = (int) longValue; - } - catch(NumberFormatException e) - { - tryAgain = true; // @P1a - // @P1d JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - if(tryAgain) // @P1a - { - // @P1a - try // @P1a - { - // @P1a - double doubleValue = Double.valueOf((String) object).doubleValue(); // @P1a - // @P1a - if(( doubleValue > Integer.MAX_VALUE ) || ( doubleValue < Integer.MIN_VALUE )) // @P1a - { - // @P1a - truncated_ = 4; // @P1a - //@trunc3 match native for ps.setString() to throw mismatch instead of truncation - if(vrm_ >= JDUtilities.vrm610) //@trunc3 - { //@trunc3 - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); //@trunc3 - } //@trunc3 - } // @P1a - value_ = (int) doubleValue; // @P1a - } // @P1a - catch(NumberFormatException e) // @P1a - { - // @P1a - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); // @P1a - } // @P1a - } // @P1a - } - - else if(object instanceof Number) - { - // Compute truncation by getting the value as a long - // and comparing it against MAX_VALUE/MIN_VALUE. You - // do this because truncation of the decimal portion of - // the value is insignificant. We only care if the - // whole number portion of the value is too large/small - // for the column. - long longValue = ((Number) object).longValue(); // @D9c - if(( longValue > Integer.MAX_VALUE ) || ( longValue < Integer.MIN_VALUE )) // @D9c - { - // Note: Truncated here is set to 4 bytes. This is based on - // the idea that a long was used and an int was the - // column type. We could check for different types - // and provide a more accurate number, but I don't - // really know that this field is of any use to people - // in this case anyway (for example, you could have a - // float (4 bytes) that didn't fit into a bigint (8 - // bytes) without some data truncation. - truncated_ = 4; // @D9c - } - - // Store the value. - value_ = (int) longValue; // @D9c - } - - else if(object instanceof Boolean) - value_ = (((Boolean) object).booleanValue() == true) ? 1 : 0; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - if(scale_ > 0) - { // @C0A - bigDecimalValue_ = (new BigDecimal(Integer.toString(value_))).movePointLeft(scale_); // @A0A - value_ = bigDecimalValue_.intValue(); // @A0A - } // @C0A - } - - public void set(int value) // @E2A - { // @E2A - value_ = value; // @E2A - } // @E2A - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.INTEGER; - } - - public String getCreateParameters() - { - return null; - } - - public int getDisplaySize() - { - return 11; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.Integer"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "INTEGER"; - } - - public int getMaximumPrecision() - { - return 10; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 496; - } - - public int getPrecision() - { - return 10; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return scale_; - } - - public int getType() - { - return java.sql.Types.INTEGER; - } - - public String getTypeName() - { - return "INTEGER"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return 4; // @D0C - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - if(scale_ > 0) - { // @C0A - if(scale >= 0) - return bigDecimalValue_.setScale(scale); // @A0A - else - return bigDecimalValue_; - } // @C0A - else - { // @C0A - if(scale <= 0) // @C0A - return BigDecimal.valueOf((long) value_); // @C0A - else // @C0A - return BigDecimal.valueOf((long) value_).setScale(scale); // @C0A - } // @C0A - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_ != 0); - } - - public byte getByte() - throws SQLException - { - if(value_ > Byte.MAX_VALUE || value_ < Byte.MIN_VALUE) - { - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - truncated_ = 3; - } - else - { - truncated_ = 1; - } - } - return(byte) value_; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - if(scale_ > 0) // @C0A - return bigDecimalValue_.doubleValue(); // @A0A - else // @C0A - return(double) value_; // @A0D @C0A - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - if(scale_ > 0) // @C0A - return bigDecimalValue_.floatValue(); // @A0A - else // @C0A - return(float) value_; // @A0D @C0A - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return new Integer((int) value_); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - truncated_ = 2; - } - return(short) value_; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - if(scale_ > 0) // @C0A - return bigDecimalValue_.toString(); // @A0A - else // @C0A - return Integer.toString(value_); // @A0D @C0A - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - if(scale_ > 0) - return bigDecimalValue_.toString(); - else - return Integer.toString(value_); - } - /* ifdef JDBC40 - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLLocator.java b/cvsroot/src/com/ibm/as400/access/SQLLocator.java deleted file mode 100644 index 9b38108bf..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLLocator.java +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -interface SQLLocator -extends SQLData -{ - - - public abstract void setHandle (int handle); - public abstract int getHandle (); //@loch - - -} diff --git a/cvsroot/src/com/ibm/as400/access/SQLLongNVarchar.java b/cvsroot/src/com/ibm/as400/access/SQLLongNVarchar.java deleted file mode 100644 index 8e2bb1483..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLLongNVarchar.java +++ /dev/null @@ -1,733 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLLongNVarchar.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ - -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -//@PDA jdbc40 new class - -final class SQLLongNVarchar -implements SQLData -{ - - // Private data. - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private String value_; - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLLongNVarchar(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLLongNVarchar(maxLength_, settings_); //@pdc - } - - public void trim() - { - value_ = value_.trim(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - value_ = ccsidConverter.byteArrayToString(rawBytes, offset+2, length_, bidiConversionProperties); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - try - { - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - // The length in the first 2 bytes is actually the length in characters. - byte[] temp = ccsidConverter.stringToByteArray(value_, bidiConversionProperties); - BinaryConverter.unsignedShortToByteArray(temp.length, rawBytes, offset); - if(temp.length > maxLength_) - { - maxLength_ = temp.length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL); - } - System.arraycopy(temp, 0, rawBytes, offset+2, temp.length); - - // The buffer we are filling with data is big enough to hold the entire field. - // For varchar fields the actual data is often smaller than the field width. - // That means whatever is in the buffer from the previous send is sent to the - // system. The data stream includes actual data length so the old bytes are not - // written to the database, but the junk left over may decrease the affectiveness - // of compression. The following code will write hex 0s to the buffer when - // actual length is less that field length. Note the 0s are written only if - // the field length is pretty big. The data stream code (DBBaseRequestDS) - // does not compress anything smaller than 1K. - if((maxLength_ > 256) && (maxLength_ - temp.length > 16)) - { - int stopHere = offset + 2 + maxLength_; - for(int i=offset + 2 + temp.length; i= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value = clob.getSubString(1, (int)clob.length()); - } - /* ifdef JDBC40 - else if(object instanceof SQLXML) - { - SQLXML xml = (SQLXML)object; - value = xml.getString(); - } - endif */ - - if(value == null) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - value_ = value; - - // Truncate if necessary. - int valueLength = value_.length(); - - int truncLimit = maxLength_; - - if(valueLength > truncLimit) - { - value_ = value_.substring(0, truncLimit); - truncated_ = valueLength - truncLimit; - } - else - truncated_ = 0; - - length_ = value_.length(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.LONG_NVARCHAR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - // JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "LONGNVARCHAR"; - } - - public int getMaximumPrecision() - { - return 32739; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 456; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - /* ifdef JDBC40 - return java.sql.Types.LONGNVARCHAR; - endif */ - /* ifndef JDBC40 */ - return java.sql.Types.LONGVARCHAR; - /* endif */ - - - } - - public String getTypeName() - { - /* ifdef JDBC40 - return "LONGNVARCHAR"; - endif */ - /* ifndef JDBC40 */ - return "LONGVARCHAR"; - /* endif */ - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_)); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(value_)); - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(value_)); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(value_), maxLength_); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true" or "false", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = value_.trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(value_.trim())).byteValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - if(d > Byte.MAX_VALUE || d < Byte.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.byteValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(value_); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCClob(getString(), maxLength_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(value_, settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(value_.trim())).intValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Integer.MAX_VALUE || d < Integer.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.intValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(value_.trim())).longValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Long.MAX_VALUE || d < Long.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.longValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(value_.trim())).shortValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Short.MAX_VALUE || d < Short.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.shortValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length() - maxFieldSize; - return value_.substring(0, maxFieldSize); - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(value_, settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(value_, calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(value_), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } - - - /*ifdef JDBC40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, maxLength_); - } - endif */ - - public String getNString() throws SQLException - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - - } - - /* ifdef JDBC40 - public RowId getRowId() throws SQLException - { - - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this string contains non-hex characters - //JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - //return null; - //} - - //Decided this is of no use because rowid is so specific to the dbms internals. - //And there are issues in length and difficulties in converting to a - //valid rowid that is useful. - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } - - endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLLongVarchar.java b/cvsroot/src/com/ibm/as400/access/SQLLongVarchar.java deleted file mode 100644 index ffbf9196f..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLLongVarchar.java +++ /dev/null @@ -1,724 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLLongVarchar.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/*ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/*ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLLongVarchar -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private String value_; - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLLongVarchar(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLLongVarchar(maxLength_, settings_); //@pdc - } - - // @A2A - // Added method trim() to trim the string. - public void trim() // @A2A - { // @A2A - value_ = value_.trim(); // @A2A - } // @A2A - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - try{ - value_ = ccsidConverter.byteArrayToString(rawBytes, offset+2, length_, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidStringType - }catch(Exception e){ - JDError.throwSQLException(JDError.EXC_CHAR_CONVERSION_INVALID, e); - } - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - try - { - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - // The length in the first 2 bytes is actually the length in characters. - byte[] temp = ccsidConverter.stringToByteArray(value_, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - BinaryConverter.unsignedShortToByteArray(temp.length, rawBytes, offset); - if(temp.length > maxLength_) - { - maxLength_ = temp.length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL); - } - System.arraycopy(temp, 0, rawBytes, offset+2, temp.length); - - // The buffer we are filling with data is big enough to hold the entire field. - // For varchar fields the actual data is often smaller than the field width. - // That means whatever is in the buffer from the previous send is sent to the - // system. The data stream includes actual data length so the old bytes are not - // written to the database, but the junk left over may decrease the affectiveness - // of compression. The following code will write hex 0s to the buffer when - // actual length is less that field length. Note the 0s are written only if - // the field length is pretty big. The data stream code (DBBaseRequestDS) - // does not compress anything smaller than 1K. - if( (maxLength_ - temp.length > 16)) //@rle - { - int stopHere = offset + 2 + maxLength_; - for(int i=offset + 2 + temp.length; i= 20 && object instanceof Clob) - { // @C1C - Clob clob = (Clob)object; // @C1C - value = clob.getSubString(1, (int)clob.length()); // @C1C @D1 - } // @C1C - - /*ifdef JDBC40 - else if(object instanceof SQLXML) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value = xml.getString(); - } - endif */ - - if(value == null) // @C1C - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - value_ = value; // @C1A - - // Truncate if necessary. - int valueLength = value_.length(); - - int truncLimit = maxLength_; // @F2a - - if(valueLength > truncLimit) // @F2c - { - value_ = value_.substring(0, truncLimit); // @F2c - truncated_ = valueLength - truncLimit; // @F2c - } - else - truncated_ = 0; - - length_ = value_.length(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.LONG_VARCHAR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "VARCHAR"; //@E1C changed to return VARCHAR to match other clients - } - - public int getMaximumPrecision() - { - return 32739; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 456; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.VARCHAR; //@E1C changed to return VARCHAR to match other clients - } - - public String getTypeName() - { - return "VARCHAR"; //@E1C changed to return VARCHAR to match other clients - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_)); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(value_)); // @F3C - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(value_)); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(value_), maxLength_); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true" or "false", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = value_.trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(value_.trim())).byteValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - if(d > Byte.MAX_VALUE || d < Byte.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.byteValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(value_); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCClob(getString(), maxLength_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(value_, settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(value_.trim())).intValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Integer.MAX_VALUE || d < Integer.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.intValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(value_.trim())).longValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Long.MAX_VALUE || d < Long.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.longValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(value_.trim())).shortValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Short.MAX_VALUE || d < Short.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.shortValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length() - maxFieldSize; - return value_.substring(0, maxFieldSize); - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(value_, settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(value_, calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(value_), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } - - //@pda jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, maxLength_); - } - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - - } - - /* ifdef JDBC40 - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this string contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } - endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLLongVarcharForBitData.java b/cvsroot/src/com/ibm/as400/access/SQLLongVarcharForBitData.java deleted file mode 100644 index 1b53fc963..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLLongVarcharForBitData.java +++ /dev/null @@ -1,661 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLLongVarcharForBitData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/*ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/*ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLLongVarcharForBitData -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private static final byte[] default_ = new byte[0]; // @C2A - - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private byte[] value_; - - SQLLongVarcharForBitData(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = default_; // @C2C - } - - public Object clone() - { - return new SQLLongVarcharForBitData(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - AS400ByteArray typeConverter = new AS400ByteArray(length_); - value_ = (byte[])typeConverter.toObject(rawBytes, offset+2); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - AS400ByteArray typeConverter = new AS400ByteArray(length_); - BinaryConverter.unsignedShortToByteArray(length_, rawBytes, offset); - typeConverter.toBytes(value_, rawBytes, offset + 2); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(object instanceof String) - { - try - { - value_ = BinaryConverter.stringToBytes((String)object); //@F1A - } - catch(NumberFormatException nfe) - { - // the String contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else if(object instanceof byte[]) - value_ = (byte[])object; // @C1C - - else if(object instanceof InputStream) - { - //value_ = JDUtilities.streamToBytes((InputStream)object, scale); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(object instanceof Reader) - { - // value_ = BinaryConverter.stringToBytes(JDUtilities.readerToString((Reader)object, scale)); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - stream.close(); //@scan1 - - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - stream.close(); //@scan1 - - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Blob) - value_ = ((Blob)object).getBytes(1, (int)((Blob)object).length()); // @C1C @E2C Blobs are 1 based. - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - try - { - value_ = BinaryConverter.stringToBytes(((Clob)object).getSubString(1, (int)((Clob)object).length())); //@F1A - } - catch(NumberFormatException nfe) - { - // the Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Truncate if necessary. - int valueLength = value_.length; - if(valueLength > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - truncated_ = valueLength - maxLength_; - } - else - truncated_ = 0; - - length_ = value_.length; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.LONG_VARCHAR_FOR_BIT_DATA; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_ ; - } - - //@F2A JDBC 3.0 - public String getJavaClassName() - { - return "[B"; - } - - public String getLiteralPrefix() - { - return "X\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "LONG VARCHAR"; - } - - public int getMaximumPrecision() - { - return 32739; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 456; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.LONGVARBINARY; - } - - public String getTypeName() - { - return "LONG VARCHAR FOR BIT DATA"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - - // changed to return stream containing hex string - // return new ByteArrayInputStream(getBytes()); - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new ByteArrayInputStream(getBytes()); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCBlob(getBytes(), maxLength_); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length - maxFieldSize; - byte[] truncatedValue = new byte[maxFieldSize]; - System.arraycopy(value_, 0, truncatedValue, 0, maxFieldSize); - return truncatedValue; - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - //@F1D return new StringReader(new String(getBytes())); - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); //@F1A - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - //@F1D return new AS400JDBCClob(new String(getBytes())); - return new AS400JDBCClob(BinaryConverter.bytesToHexString(getBytes()), maxLength_); //@F1A - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return getBytes(); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - //@F1D return new String(getBytes()); - return BinaryConverter.bytesToHexString(getBytes()); //@F1A - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - - // changed to return stream containing hex string - // return new ByteArrayInputStream(getBytes()); - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - - //@PDA jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCNClob(BinaryConverter.bytesToHexString(getBytes()), maxLength_); - } - endif */ - - //@PDA jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } - /* ifdef JDBC40 - //@PDA jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@PDA jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLLongVargraphic.java b/cvsroot/src/com/ibm/as400/access/SQLLongVargraphic.java deleted file mode 100644 index 8feb54124..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLLongVargraphic.java +++ /dev/null @@ -1,696 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLLongVargraphic.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/*ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/*ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLLongVargraphic -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private String value_; - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLLongVargraphic(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLLongVargraphic(maxLength_, settings_); - } - - // Added method trim() to trim the string. - public void trim() - { - value_ = value_.trim(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - // If the field is VARGRAPHIC, length_ contains the number - // of characters in the string, while the converter is expecting - // the number of bytes. Thus, we need to multiply length_ by 2. - value_ = ccsidConverter.byteArrayToString(rawBytes, offset+2, length_*2, bidiConversionProperties); //@KBC changed to use bidiConvesionProperties instead of bidiStringType - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - try - { - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - // The length in the first 2 bytes is actually the length in characters. - byte[] temp = ccsidConverter.stringToByteArray(value_, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - BinaryConverter.unsignedShortToByteArray(temp.length/2, rawBytes, offset); - - if(temp.length > maxLength_) - { - maxLength_ = temp.length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL); - } - System.arraycopy(temp, 0, rawBytes, offset+2, temp.length); - - // The buffer we are filling with data is big enough to hold the entire field. - // For varchar fields the actual data is often smaller than the field width. - // That means whatever is in the buffer from the previous send is sent to the - // system. The data stream includes actual data length so the old bytes are not - // written to the database, but the junk left over may decrease the effectiveness - // of compression. The following code will write hex 0s to the buffer when - // actual length is less that field length. Note the 0s are written only if - // the field length is pretty big. The data stream code (DBBaseRequestDS) - // does not compress anything smaller than 1K. - if((maxLength_ > 256) && (maxLength_ - temp.length > 16)) - { - int stopHere = offset + 2 + maxLength_; - for(int i=offset + 2 + temp.length; i= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value = clob.getSubString(1, (int)clob.length()); - } - /*ifdef JDBC40 - else if(object instanceof SQLXML) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value = xml.getString(); - } -endif */ - - if(value == null) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - value_ = value; - - // Truncate if necessary. - int valueLength = value_.length(); - - int truncLimit = maxLength_ / 2; - - if(valueLength > truncLimit) - { - value_ = value_.substring(0, truncLimit); - truncated_ = valueLength - truncLimit; - } - else - truncated_ = 0; - - length_ = value_.length(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.LONG_VARGRAPHIC; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_ / 2; - } - - // JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "LONG VARGRAPHIC"; - } - - public int getMaximumPrecision() - { - return 16369; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 472; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.LONGVARCHAR; - } - - public String getTypeName() - { - return "LONG VARGRAPHIC"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_)); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(value_)); // @F3C - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(value_)); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(value_), maxLength_); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true" or "false", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = value_.trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).byteValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(value_); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCClob(getString(), maxLength_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(value_, settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).intValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).longValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(value_.trim())).shortValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length() - maxFieldSize; - return value_.substring(0, maxFieldSize); - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(value_, settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(value_, calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(value_), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } - - //@pda jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, maxLength_); - } - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } - /* ifdef JDBC40 - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - // - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this string contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } -endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLNChar.java b/cvsroot/src/com/ibm/as400/access/SQLNChar.java deleted file mode 100644 index 13e86ca31..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLNChar.java +++ /dev/null @@ -1,707 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLNChar.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.CharConversionException; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/*ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.net.URL; - -//@PDA jdbc40 new class -final class SQLNChar -implements SQLData -{ - - // Private data. - private SQLConversionSettings settings_; - private int maxLength_; - private int truncated_; - private String value_; - - SQLNChar(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLNChar(maxLength_,settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - value_ = ccsidConverter.byteArrayToString(rawBytes, offset, maxLength_, bidiConversionProperties); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - try - { - ccsidConverter.stringToByteArray(value_, rawBytes, offset, maxLength_, bidiConversionProperties); - } - catch(CharConversionException e) - { - maxLength_ = ccsidConverter.stringToByteArray(value_, bidiConversionProperties).length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e, "Change Descriptor"); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - String value = null; - - if(object instanceof String) - value = (String)object; - - else if(object instanceof Character) - value = object.toString(); - - else if(object instanceof Number) - value = object.toString(); - - else if(object instanceof Boolean) - { - // if "translate boolean" == false, then use "0" and "1" values to match native driver - if(settings_.getTranslateBoolean() == true) - value = object.toString(); //"true" or "false" - else - value = ((Boolean)object).booleanValue() == true ? "1" : "0"; - } - else if(object instanceof Time) - value = SQLTime.timeToString((Time)object, settings_, calendar); - - else if(object instanceof Timestamp) - value = SQLTimestamp.timestampToString((Timestamp)object, calendar); - - else if(object instanceof java.util.Date) - value = SQLDate.dateToString((java.util.Date)object, settings_, calendar); - - else if(object instanceof URL) - value = object.toString(); - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value = clob.getSubString(1, (int)clob.length()); - } - - if(value == null) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - value_ = value; - - // Set to the exact length. - int valueLength = value_.length(); - int exactLength = getDisplaySize(); - if(valueLength < exactLength) - { - StringBuffer buffer = new StringBuffer(value_); - char c = '\u0020'; - for(int i = valueLength; i < exactLength; ++i) - buffer.append(c); - value_ = buffer.toString(); - truncated_ = 0; - } - else if(valueLength > exactLength) - { - value_ = value_.substring(0, exactLength); - truncated_ = valueLength - exactLength; - } - else - truncated_ = 0; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.NCHAR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - // JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "NCHAR"; - } - - public int getMaximumPrecision() - { - return 32765; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 452; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - /* ifdef JDBC40 - return java.sql.Types.NCHAR; - endif */ - /* ifndef JDBC40 */ - return java.sql.Types.CHAR; - /* endif */ - } - - public String getTypeName() - { - /* ifdef JDBC40 - return "NCHAR"; - endif */ - /* ifndef JDBC40 */ - return "CHAR"; - /* endif */ - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(getString().trim())); - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(getString())); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(getString()), maxLength_); - } - catch(NumberFormatException nfe) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true", "false", "1", or "0", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = getString().trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).byteValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - if(d > Byte.MAX_VALUE || d < Byte.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.byteValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(getString(), settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).intValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Integer.MAX_VALUE || d < Integer.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.intValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).longValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Long.MAX_VALUE || d < Long.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.longValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).shortValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Short.MAX_VALUE || d < Short.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.shortValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(getString(), settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(getString(), calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - - try - { - return new ReaderInputStream(new StringReader(getString()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - // Added method trim() to trim the string. - public void trim() - { - value_ = value_.trim(); - } - - - - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } - -/* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } -endif */ - - public String getNString() throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } - -/* ifdef JDBC40 - public RowId getRowId() throws SQLException - { - - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this string contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - - //Decided this is of no use because rowid is so specific to the dbms internals. - //And there are issues in length and difficulties in converting to a - //valid rowid that is useful. - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } -endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLNClob.java b/cvsroot/src/com/ibm/as400/access/SQLNClob.java deleted file mode 100644 index 0db20129d..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLNClob.java +++ /dev/null @@ -1,638 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLNClob.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/*ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ - -//@PDA jdbc40 brand new class -//This is almost the same as SQLClob, and I would have liked to extend it, but it is final, and so decided -//to not extend. It may come in handy for future NClob deviations also. - -final class SQLNClob implements SQLData -{ - - private int length_; // Length of string, in characters. - private int maxLength_; // Max length of field, in bytes. - private SQLConversionSettings settings_; - private int truncated_; - private String value_; - private Object savedObject_; // This is our byte[] or InputStream or whatever that we save to convert to bytes until we really need to. - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLNClob(int maxLength, SQLConversionSettings settings) - { - length_ = 0; - maxLength_ = maxLength; - settings_ = settings; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLNClob(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToInt(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - value_ = ccsidConverter.byteArrayToString(rawBytes, offset + 4, length_, bidiConversionProperties); - savedObject_ = null; - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - if(savedObject_ != null) doConversion(); - - try - { - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - byte[] temp = ccsidConverter.stringToByteArray(value_, bidiConversionProperties); - // The length in the first 4 bytes is actually the length in characters. - BinaryConverter.intToByteArray(temp.length, rawBytes, offset); - if(temp.length > maxLength_) - { - maxLength_ = temp.length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL, "Change Descriptor"); - } - System.arraycopy(temp, 0, rawBytes, offset+4, temp.length); - } - catch(Exception e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - // If it's a String we check for data truncation. - if(object instanceof String) - { - String s = (String)object; - truncated_ = (s.length() > maxLength_ ? s.length()-maxLength_ : 0); - } - //@PDD jdbc40 (JDUtilities.JDBCLevel_ >= 20 incorrect logic, but n/a now - else if(!(object instanceof Clob) && //@PDC NClob extends Clob - !(object instanceof InputStream) && - !(object instanceof Reader) //@PDC jdbc40 -/* ifdef JDBC40 - && !(object instanceof SQLXML) - endif */ - ) //@PDC jdbc40 - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - savedObject_ = object; - if(scale != -1) length_ = scale; - } - - private void doConversion() - throws SQLException - { - try - { - Object object = savedObject_; - if(savedObject_ instanceof String) - { - value_ = (String)object; - } - else if(object instanceof Reader) - { - if(length_ >= 0) - { - try - { - int blockSize = length_ < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length_ : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 && totalCharsRead < length_) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - int charsRemaining = length_ - totalCharsRead; - if(charsRemaining < blockSize) - { - blockSize = charsRemaining; - } - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - - if(value_.length() < length_) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length_ == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 ) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if( object instanceof Clob) //@PDC jdbc40 - NClob isa Clob - { - Clob clob = (Clob)object; - value_ = clob.getSubString(1, (int)clob.length()); - } - /* ifdef JDBC40 - else if( object instanceof SQLXML ) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value_ = xml.getString(); - } - endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - // Truncate if necessary. - int valueLength = value_.length(); - if(valueLength > maxLength_) - { - value_ = value_.substring(0, maxLength_); - truncated_ = valueLength - maxLength_; - } - else - { - truncated_ = 0; - } - - length_ = value_.length(); - } - finally - { - savedObject_ = null; - } - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.NCLOB; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCNClob"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "NCLOB"; - } - - public int getMaximumPrecision() - { - return AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; //@xml3 // the DB2 SQL reference says this should be 2147483647 but we return 1 less to allow for NOT NULL columns - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 408; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - /* ifdef JDBC40 - return java.sql.Types.NCLOB; - endif */ - /* ifndef JDBC40 */ - return java.sql.Types.CLOB; - /* endif */ - - - } - - public String getTypeName() - { - return "NCLOB"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_)); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new HexReaderInputStream(new StringReader(value_)); - } - - public Blob getBlob() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new AS400JDBCBlob(BinaryConverter.stringToBytes(value_), maxLength_); - } - catch(NumberFormatException nfe) - { - // this NClob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public byte[] getBytes() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(value_); - } - catch(NumberFormatException nfe) - { - // this NClob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new StringReader(value_); - } - - public Clob getClob() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCClob(value_, maxLength_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public Object getObject() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - /*ifdef JDBC40 - return new AS400JDBCNClob(value_, maxLength_); - endif */ - /* ifndef JDBC40 */ - return new AS400JDBCClob(value_, maxLength_); - /* endif */ - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public String getString() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return value_; - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(value_), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - public Reader getNCharacterStream() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new StringReader(value_); - } - -/* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCNClob(value_, maxLength_); - } -endif */ - - public String getNString() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return value_; - } - -/* ifdef JDBC40 - public RowId getRowId() throws SQLException - { - // - //if(savedObject_ != null) doConversion(); - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this NClob contains non-hex characters - //JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - //return null; - //} - - //Decided this is of no use because rowid is so specific to the dbms internals. - //And there are issues in length and difficulties in converting to a - //valid rowid that is useful. - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public SQLXML getSQLXML() throws SQLException - { - if(savedObject_ != null) doConversion(); - truncated_ = 0; - return new AS400JDBCSQLXML(value_.toCharArray()); - } - - endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLNClobLocator.java b/cvsroot/src/com/ibm/as400/access/SQLNClobLocator.java deleted file mode 100644 index c7eab37df..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLNClobLocator.java +++ /dev/null @@ -1,1001 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLNclobLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/*ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/*ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -//@PDA jdbc40 new class - -final class SQLNClobLocator implements SQLLocator -{ - - private AS400JDBCConnection connection_; - private SQLConversionSettings settings_; - private ConvTable converter_; - private int id_; - private JDLobLocator locator_; - private int maxLength_; - private int truncated_; - private int columnIndex_; - private String value_; //@loch //Note that value_ is not used as the output for a ResultSet.getX() call. We Get the value from a call to the JDLocator (not from value_) and not from the savedObject_, unless resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - - private Object savedObject_; // This is the AS400JDBCBlobLocator or InputStream or whatever got set into us. - private int scale_; // This is actually the length that got set into us. - - SQLNClobLocator(AS400JDBCConnection connection, - int id, - int maxLength, - SQLConversionSettings settings, - ConvTable converter, - int columnIndex) - { - connection_ = connection; - id_ = id; - locator_ = new JDLobLocator(connection, id, maxLength, false); - maxLength_ = maxLength; - truncated_ = 0; - settings_ = settings; - converter_ = converter; - columnIndex_ = columnIndex; - } - - public Object clone() - { - return new SQLNClobLocator(connection_, id_, maxLength_, settings_, converter_, columnIndex_); - } - - public void setHandle(int handle) - { - locator_.setHandle(handle); - } - - //@loch - public int getHandle() - { - return locator_.getHandle(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int locatorHandle = BinaryConverter.byteArrayToInt(rawBytes, offset); - locator_.setHandle(locatorHandle); - locator_.setColumnIndex(columnIndex_); - } - - // This is only called from AS400JDBCPreparedStatement in one place. - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - BinaryConverter.intToByteArray(locator_.getHandle(), rawBytes, offset); - - // Now we write our saved data to the system, because the prepared statement is being executed. - // We used to write the data to the system on the call to set(), but this messed up - // batch executes, since the host server only reserves temporary space for locator handles one row at a time. - // See the toObject() method in this class for more details. - if(savedObject_ != null) writeToServer(); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - //@selins1 - // If it's a String we check for data truncation. - if(object instanceof String) - { - String s = (String)object; - truncated_ = (s.length() > maxLength_ ? s.length()-maxLength_ : 0); - } - //@PDD jdbc40 (JDUtilities.JDBCLevel_ >= 20 incorrect logic, but n/a now - else if( !(object instanceof Reader) && - !(object instanceof InputStream) && - !(object instanceof Clob) -/*ifdef JDBC40 - && !(object instanceof SQLXML) - endif */ - - ) //@PDC jdbc40 - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - savedObject_ = object; - if(scale != -1) scale_ = scale; // Skip resetting it if we don't know the real length - } - - //@loch method to temporary convert from object input to output before even going to host (writeToServer() does the conversion needed before writting to host) - //This will only be used when resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - //Purpose is to do a local type conversion from obj1 to obj2 like other non-locator lob types - private void doConversion() - throws SQLException - { - int length_ = scale_; - - if( length_ == -1) - { - try{ - //try to get length from locator - length_ = (int)locator_.getLength(); - }catch(Exception e){ } - } - - try - { - Object object = savedObject_; - if(savedObject_ instanceof String) - { - value_ = (String)object; - } - else if(object instanceof Reader) - { - if(length_ >= 0) - { - try - { - int blockSize = length_ < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length_ : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 && totalCharsRead < length_) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - int charsRemaining = length_ - totalCharsRead; - if(charsRemaining < blockSize) - { - blockSize = charsRemaining; - } - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - - if(value_.length() < length_) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length_ == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)object; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - - charsRead = stream.read(charBuffer, 0, blockSize); - } - value_ = buf.toString(); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if( object instanceof Clob) - { - Clob clob = (Clob)object; - value_ = clob.getSubString(1, (int)clob.length()); - } - /* ifdef JDBC40 - else if( object instanceof SQLXML ) - { - SQLXML xml = (SQLXML)object; - value_ = xml.getString(); - } - endif */ - - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - // Truncate if necessary. - int valueLength = value_.length(); - if(valueLength > maxLength_) - { - value_ = value_.substring(0, maxLength_); - } - } - finally - { - //nothing - } - } - - private void writeToServer() - throws SQLException - { - try - { - Object object = savedObject_; - if(object instanceof String) - { - String string = (String)object; - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = converter_.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - byte[] bytes = converter_.stringToByteArray(string, bidiConversionProperties); - locator_.writeData(0L, bytes, true); - } - else if(object instanceof Reader) - { - int length = scale_; // hack to get the length into the set method - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); - } - else if(length > 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = converter_.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - ReaderInputStream stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); - try{ - byte[] byteBuffer = new byte[blockSize]; - - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - locator_.writeData((long)totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - if(stream.available() == 0 && blockSize != 0) - { - stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); // do this so we don't read more chars out of the Reader than we have to. //@KBC changed to use bidiConversionProperties instead of bidiStringType - } - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - - if(totalBytesRead < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - }finally{ - try{ - stream.close(); - }catch(Exception e){} - } - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - int bidiStringType = settings_.getBidiStringType(); - if(bidiStringType == -1) bidiStringType = converter_.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - ReaderInputStream stream = new ReaderInputStream((Reader)savedObject_, converter_.getCcsid(), bidiConversionProperties, blockSize); - try{ - byte[] byteBuffer = new byte[blockSize]; - - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - locator_.writeData((long)totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - }finally{ - try{ - stream.close(); - }catch(Exception e){} - } - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(object instanceof InputStream) - { - int length = scale_; // hack to get the length into the set method - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); - } - else if(length > 0) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - locator_.writeData((long)totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - if(totalBytesRead < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - locator_.writeData((long)totalBytesRead, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if( object instanceof Clob) //check for jdbc level to know if lobs exist //@PDD jdbc40 NClob isa Clob - { - // Start new code for updateable locator case - boolean set = false; - if(object instanceof AS400JDBCClobLocator) //@PDA jdbc40 comment: AS400JDBCNClobLocator isa AS400JDBCClobLocator - { - AS400JDBCClobLocator clob = (AS400JDBCClobLocator)object; - - //Synchronize on a lock so that the user can't keep making updates - //to the clob while we are taking updates off the vectors. - synchronized(clob) - { - // See if we saved off our real object from earlier. - if(clob.savedObject_ != null) - { - savedObject_ = clob.savedObject_; - scale_ = clob.savedScale_; - clob.savedObject_ = null; - writeToServer(); - return; - } - } - } - - //If the code for updateable lob locators did not run, then run old code. - if(!set) - { - Clob clob = (Clob)object; - int length = (int)clob.length(); - String substring = clob.getSubString(1, length); - locator_.writeData(0L, converter_.stringToByteArray(substring), 0, length, true); - set = true; - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - /* ifdef JDBC40 - else if( object instanceof SQLXML ) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - - String stringVal = xml.getString(); - locator_.writeData(0L, converter_.stringToByteArray(stringVal), 0, stringVal.length(), true); - } - endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - finally - { - savedObject_ = null; - } - scale_ = (int)locator_.getLength(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.NCLOB_LOCATOR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCNClobLocator"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "NCLOB"; - } - - public int getMaximumPrecision() - { - return AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; //@xml3 // the DB2 SQL reference says this should be 2147483647 but we return 1 less to allow for NOT NULL columns - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 964; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - /* ifdef JDBC40 - return java.sql.Types.NCLOB; - endif */ - /* ifndef JDBC40 */ - return java.sql.Types.CLOB; - /* endif */ - } - - public String getTypeName() - { - /* ifdef JDBC40 - return "NCLOB"; - endif */ - /* ifndef JDBC40 */ - return "CLOB"; - /* endif */ - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return maxLength_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(value_));//@loch - } //@loch - - return new ReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()), 819); // ISO-8859-1. - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new HexReaderInputStream(new StringReader(value_)); //@loch - } //@loch - - return new HexReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - byte[] bytes = BinaryConverter.stringToBytes(getString()); - return new AS400JDBCBlob(bytes, bytes.length); - } - catch(NumberFormatException nfe) - { - // this Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - // this Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new StringReader(value_); //@loch - } //@loch - - return new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCClob(value_, maxLength_); //@loch - } //@loch - - return new AS400JDBCClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // getObject is used by AS400JDBCPreparedStatement for batching, so we save off our InputStream - // inside the AS400JDBCNClobLocator. Then, when convertToRawBytes() is called, the writeToServer() - // code checks the AS400JDBCNClobLocator's saved InputStream... if it exists, then it writes the - // data out of the InputStream to the system by calling writeToServer() again. - /* ifdef JDBC40 - return new AS400JDBCNClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - endif */ - /* ifndef JDBC40 */ - return new AS400JDBCClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - - /* endif */ - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return 0; - } - - public String getString() - throws SQLException - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return value_; //@loch - } //@loch - - DBLobData data = locator_.retrieveData(0, locator_.getMaxLength()); - String value = converter_.byteArrayToString(data.getRawBytes(), - data.getOffset(), - data.getLength()); - truncated_ = 0; //@pda jdbc40 make consistent with other SQLData Clob classes - return value; - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new ReaderInputStream(new StringReader(value_), 13488); //@loch - } //@loch - - - return new ReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); - return null; - } - } - - - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new StringReader(value_); //@loch - } //@loch - - try - { - return new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid()); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - -/* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCNClob(value_, maxLength_); //@loch - } //@loch - - return new AS400JDBCNClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_); - - } -endif */ - - public String getNString() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return value_; //@loch - } //@loch - - DBLobData data = locator_.retrieveData(0, locator_.getMaxLength()); - String value = converter_.byteArrayToString(data.getRawBytes(), - data.getOffset(), - data.getLength()); - return value; - } - - /* ifdef JDBC40 - public RowId getRowId() throws SQLException - { - - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(getString())); - //} - //catch(NumberFormatException nfe) - //{ - // this Clob contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - - //Decided this is of no use because rowid is so specific to the dbms internals. - //And there are issues in length and difficulties in converting to a - //valid rowid that is useful. - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public SQLXML getSQLXML() throws SQLException - { - truncated_ = 0; - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCSQLXML(value_, maxLength_); //@loch - } //@loch - return new AS400JDBCSQLXML( getString().toCharArray() ); - } - endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - - - diff --git a/cvsroot/src/com/ibm/as400/access/SQLNVarchar.java b/cvsroot/src/com/ibm/as400/access/SQLNVarchar.java deleted file mode 100644 index be47cdcc6..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLNVarchar.java +++ /dev/null @@ -1,736 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLNVarchar.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ - -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.net.URL; - -//@PDA jdbc40 new class - -final class SQLNVarchar -implements SQLData -{ - - // Private data. - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private String value_; - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLNVarchar(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLNVarchar(maxLength_, settings_); - } - - // Added method trim() to trim the string. - public void trim() // @A2A - { // @A2A - value_ = value_.trim(); // @A2A - } // @A2A - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - value_ = ccsidConverter.byteArrayToString(rawBytes, offset+2, length_, bidiConversionProperties); //changed to use bidiConversionProperties instead of bidiStringType - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - try - { - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); - - // The length in the first 2 bytes is actually the length in characters. - byte[] temp = ccsidConverter.stringToByteArray(value_, bidiConversionProperties); //changed to used bidiConversionProperties instead of bidiStringType - BinaryConverter.unsignedShortToByteArray(temp.length, rawBytes, offset); - if(temp.length > maxLength_) - { - maxLength_ = temp.length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL, "Change Descriptor"); - } - System.arraycopy(temp, 0, rawBytes, offset+2, temp.length); - - // The buffer we are filling with data is big enough to hold the entire field. - // For NVarchar fields the actual data is often smaller than the field width. - // That means whatever is in the buffer from the previous send is sent to the - // system. The data stream includes actual data length so the old bytes are not - // written to the database, but the junk left over may decrease the affectiveness - // of compression. The following code will write hex 0s to the buffer when - // actual length is less that field length. Note the 0s are written only if - // the field length is pretty big. The data stream code (DBBaseRequestDS) - // does not compress anything smaller than 1K. - if((maxLength_ > 256) && (maxLength_ - temp.length > 16)) - { - int stopHere = offset + 2 + maxLength_; - for(int i=offset + 2 + temp.length; i= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value = clob.getSubString(1, (int)clob.length()); - } - /* ifdef JDBC40 - else if(object instanceof SQLXML) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value = xml.getString(); - } - endif */ - - if(value == null) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - value_ = value; - - // Truncate if necessary. - int valueLength = value_.length(); - - int truncLimit = maxLength_; - - if(valueLength > truncLimit) - { - value_ = value_.substring(0, truncLimit); - truncated_ = valueLength - truncLimit; - } - else - truncated_ = 0; - - length_ = value_.length(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.NVARCHAR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "NVARCHAR"; - } - - public int getMaximumPrecision() - { - return 32739; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 448; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - /* ifdef JDBC40 - return java.sql.Types.NVARCHAR; - endif */ - /* ifndef JDBC40 */ - return java.sql.Types.VARCHAR; - /* endif */ - } - - public String getTypeName() - { - /* ifdef JDBC40 - return "NVARCHAR"; - endif */ - - /* ifndef JDBC40 */ - return "VARCHAR"; - /* endif */ - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(getString())); - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(getString())); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - byte[] bytes = BinaryConverter.stringToBytes(getString()); - return new AS400JDBCBlob(bytes, bytes.length); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true" or "false", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = getString().trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).byteValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - if(d > Byte.MAX_VALUE || d < Byte.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.byteValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(getString(), settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).intValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Integer.MAX_VALUE || d < Integer.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.intValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).longValue();//@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Long.MAX_VALUE || d < Long.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.longValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).shortValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Short.MAX_VALUE || d < Short.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.shortValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length() - maxFieldSize; - return value_.substring(0, maxFieldSize); - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(getString(), settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(getString(), calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(getString()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } - -/* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } -endif */ - - public String getNString() throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } - - /* ifdef JDBC40 - - public RowId getRowId() throws SQLException - { - - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this string contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - - //Decided this is of no use because rowid is so specific to the dbms internals. - //And there are issues in length and difficulties in converting to a - //valid rowid that is useful. - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } - -endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLNumeric.java b/cvsroot/src/com/ibm/as400/access/SQLNumeric.java deleted file mode 100644 index 498544cbd..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLNumeric.java +++ /dev/null @@ -1,589 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLNumeric.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/*ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/*ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLNumeric -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private static final BigDecimal default_ = BigDecimal.valueOf(0); // @C2A - private static final BigDecimal BYTE_MAX_VALUE = BigDecimal.valueOf(Byte.MAX_VALUE); - private static final BigDecimal BYTE_MIN_VALUE = BigDecimal.valueOf(Byte.MIN_VALUE); - private static final BigDecimal SHORT_MAX_VALUE = BigDecimal.valueOf(Short.MAX_VALUE); - private static final BigDecimal SHORT_MIN_VALUE = BigDecimal.valueOf(Short.MIN_VALUE); - private static final BigDecimal INTEGER_MAX_VALUE = BigDecimal.valueOf(Integer.MAX_VALUE); - private static final BigDecimal INTEGER_MIN_VALUE = BigDecimal.valueOf(Integer.MIN_VALUE); - private static final BigDecimal LONG_MAX_VALUE = BigDecimal.valueOf(Long.MAX_VALUE); - private static final BigDecimal LONG_MIN_VALUE = BigDecimal.valueOf(Long.MIN_VALUE); - static final BigDecimal FLOAT_MAX_VALUE = new BigDecimal(Float.MAX_VALUE); - static final BigDecimal FLOAT_MIN_VALUE = new BigDecimal(Float.MIN_VALUE); - static final BigDecimal DOUBLE_MAX_VALUE = new BigDecimal(Double.MAX_VALUE); - static final BigDecimal DOUBLE_MIN_VALUE = new BigDecimal(Double.MIN_VALUE); - - private SQLConversionSettings settings_; - private int precision_; - private int scale_; - private int truncated_; - private AS400ZonedDecimal typeConverter_; - private BigDecimal value_; - private JDProperties properties_; // @M0A - added JDProperties so we can get the scale & precision - private int vrm_; // @M0A - - SQLNumeric(int precision, - int scale, - SQLConversionSettings settings, - int vrm, // @M0C - JDProperties properties) // @M0C - { - settings_ = settings; - precision_ = precision; - scale_ = scale; - truncated_ = 0; - typeConverter_ = new AS400ZonedDecimal(precision_, scale_); - value_ = default_; // @C2C - vrm_ = vrm; // @M0A - properties_ = properties; // @M0A - } - - public Object clone() - { - return new SQLNumeric(precision_, scale_, settings_, vrm_, properties_); // @M0C - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = ((BigDecimal)typeConverter_.toObject(rawBytes, offset)); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - try{ - typeConverter_.toBytes(value_, rawBytes, offset); - } - catch(ExtendedIllegalArgumentException e){ - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - BigDecimal bigDecimal = null; - - if(object instanceof String) - { - try - { - String value = SQLDataFactory.convertScientificNotation((String)object); // @F3C - if(scale >= 0) - value = SQLDataFactory.truncateScale(value, scale); - bigDecimal = new BigDecimal(value); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - catch(StringIndexOutOfBoundsException e) // jdk 1.3.x throws this instead of a NFE - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(object instanceof Number) - { - String value = SQLDataFactory.convertScientificNotation(object.toString()); // @C1C - if(scale >= 0) - value = SQLDataFactory.truncateScale(value, scale); - bigDecimal = new BigDecimal(value); - } - - else if(object instanceof Boolean) - bigDecimal = (((Boolean)object).booleanValue() == true) ? BigDecimal.valueOf(1) : BigDecimal.valueOf(0); - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Truncate if necessary. If we ONLY truncate on the right side, we don't @E3C - // need to report it. If we truncate on the left side, then we report the @E3A - // number of truncated digits on both ends...this will make the dataSize @E3A - // and transferSize make sense on the resulting DataTruncation. @E3A - truncated_ = 0; - int otherScale = bigDecimal.scale(); - if(otherScale > scale_) - truncated_ += otherScale - scale_; - value_ = bigDecimal.setScale(scale_, BigDecimal.ROUND_DOWN); // @E3C - - int otherPrecision = SQLDataFactory.getPrecision(value_); - if(otherPrecision > precision_) - { // @E2D @E3C - int digits = otherPrecision - precision_; // @E2D @E3C - truncated_ += digits; // @E2D @E3C - value_ = SQLDataFactory.truncatePrecision(value_, digits); // @E2D @E3C - } // @E2D @E3C - else // @E3A - truncated_ = 0; // No left side truncation, report nothing @E3A - // (even if there was right side truncation). @E3A - - /* @E3D - int otherLeftSide = otherPrecision - otherScale; // @E2A - int leftSide = precision_ - scale_; // @E2A - if(otherLeftSide > leftSide) { // @E2A - int digits = otherLeftSide - leftSide; // @E2A - truncated_ += digits; // @E2A - value_ = SQLDataFactory.truncatePrecision(value_, digits + scale_); // @E2A - } // @E2A - */ - - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.NUMERIC; - } - - public String getCreateParameters() - { - StringBuffer buffer = new StringBuffer(); - buffer.append(AS400JDBCDriver.getResource("PRECISION")); - buffer.append(","); - buffer.append(AS400JDBCDriver.getResource("SCALE")); - return buffer.toString(); - } - - public int getDisplaySize() - { - return precision_ + 2; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.math.BigDecimal"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "NUMERIC"; - } - - public int getMaximumPrecision() - { - // @M0C - change to check vrm and JDProperties - if(vrm_ >= JDUtilities.vrm530) - return properties_.getInt(JDProperties.MAXIMUM_PRECISION); - else - return 31; - } - - public int getMaximumScale() - { - // @M0C - change to check vrm and JDProperties - if(vrm_ >= JDUtilities.vrm530) - return properties_.getInt(JDProperties.MAXIMUM_SCALE); - else - return 31; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 488; - } - - public int getPrecision() - { - return precision_; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return scale_; - } - - public int getType() - { - return java.sql.Types.NUMERIC; - } - - public String getTypeName() - { - return "NUMERIC"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return precision_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - if(scale >= 0) - { - if(scale >= value_.scale()) - { - truncated_ = 0; - return value_.setScale(scale); - } - else - { - truncated_ = value_.scale() - scale; - return value_.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return value_; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_.compareTo(BigDecimal.valueOf(0)) != 0); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - if(value_.compareTo(BYTE_MAX_VALUE) > 0 || value_.compareTo(BYTE_MIN_VALUE) < 0) - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 1; - } - return(byte) value_.byteValue(); - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - double d = value_.doubleValue(); //@KBA - //@KBD This will never be the case with the current precision - //@KBD if(value_.compareTo(DOUBLE_MAX_VALUE) > 0 || value_.compareTo(DOUBLE_MIN_VALUE) < 0) - if( d == Double.POSITIVE_INFINITY || d == Double.NEGATIVE_INFINITY) //@KBA - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 8; - } - return d; //@KBC value_.doubleValue(); - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - float f = value_.floatValue(); //@KBA - //@KBD Changed to avoid optimization problem with JRE 1.3 - //@KBD if(value_.compareTo(FLOAT_MAX_VALUE) > 0 || value_.compareTo(FLOAT_MIN_VALUE) < 0) - if(f == Float.POSITIVE_INFINITY || f == Float.NEGATIVE_INFINITY) //@KBA - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 4; - } - return f; //@KBC value_.floatValue(); - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - if(value_.compareTo(INTEGER_MAX_VALUE) > 0 || value_.compareTo(INTEGER_MIN_VALUE) < 0) - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 4; - } - return value_.intValue(); - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - if(value_.compareTo(LONG_MAX_VALUE) > 0 || value_.compareTo(LONG_MIN_VALUE) < 0) - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 8; - } - return value_.longValue(); - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - if(value_.compareTo(SHORT_MAX_VALUE) > 0 || value_.compareTo(SHORT_MIN_VALUE) < 0) - { - // we don't count the fractional part of the number as truncation - int length = value_.toBigInteger().toByteArray().length; - truncated_ = length - 2; - } - return(short) value_.shortValue(); - } - - public String getString() - throws SQLException - { - truncated_ = 0; - String stringRep = JDUtilities.bigDecimalToPlainString(value_); //@big java 1.5 support - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - return new StringReader(getNString()); - - } - - /* ifdef JDBC40 - //@pda jdbc40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - String stringRep = value_.toString(); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - /* ifdef JDBC40 - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLNumeric2.java b/cvsroot/src/com/ibm/as400/access/SQLNumeric2.java deleted file mode 100644 index 3a0e10785..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLNumeric2.java +++ /dev/null @@ -1,512 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLNumeric2.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/*ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -// This uses a double instead of a BigDecimal (like SQLNumeric does). -// It will be faster but won't really preserve a lot of normal -// JDBC semantics. This will be documented in the "big decimal" -// property. -// -final class SQLNumeric2 -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int precision_; - private int scale_; - private int truncated_; - private AS400ZonedDecimal typeConverter_; - private double value_; - private JDProperties properties_; // @M0A - added JDProperties so we can get the scale & precision - private int vrm_; // @M0A - - SQLNumeric2(int precision, - int scale, - SQLConversionSettings settings, - int vrm, // @M0C - JDProperties properties) // @M0C - { - settings_ = settings; - precision_ = precision; - scale_ = scale; - truncated_ = 0; - typeConverter_ = new AS400ZonedDecimal(precision_, scale_); - value_ = 0; - vrm_ = vrm; // @M0A - properties_ = properties; // @M0A - } - - public Object clone() - { - return new SQLNumeric2(precision_, scale_, settings_, vrm_, properties_); // @M0C - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = typeConverter_.toDouble(rawBytes, offset); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - typeConverter_.toBytes(value_, rawBytes, offset); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(object instanceof String) - { - try - { - value_ = Double.valueOf((String)object).doubleValue(); - } - catch(NumberFormatException nfe) - { // @E4A - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); // @E4A - } - } - - else if(object instanceof Number) - value_ = ((Number)object).doubleValue(); - - else if(object instanceof Boolean) - value_ = ((Boolean)object).booleanValue() ? 1 : 0; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.NUMERIC_USING_DOUBLE; - } - - public String getCreateParameters() - { - StringBuffer buffer = new StringBuffer(); - buffer.append(AS400JDBCDriver.getResource("PRECISION")); - buffer.append(","); - buffer.append(AS400JDBCDriver.getResource("SCALE")); - return buffer.toString(); - } - - public int getDisplaySize() - { - return precision_ + 2; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.math.BigDecimal"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "NUMERIC"; - } - - public int getMaximumPrecision() - { - // @M0C - change to check vrm and JDProperties - if(vrm_ >= JDUtilities.vrm530) - return properties_.getInt(JDProperties.MAXIMUM_PRECISION); - else - return 31; - } - - public int getMaximumScale() - { - // @M0C - change to check vrm and JDProperties - if(vrm_ >= JDUtilities.vrm530) - return properties_.getInt(JDProperties.MAXIMUM_SCALE); - else - return 31; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 488; - } - - public int getPrecision() - { - return precision_; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return scale_; - } - - public int getType() - { - return java.sql.Types.NUMERIC; - } - - public String getTypeName() - { - return "NUMERIC"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return precision_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - return new BigDecimal(value_); - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_ != 0); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - if(value_ > Byte.MAX_VALUE || value_ < Byte.MIN_VALUE) - { - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 7; - } - else - { - truncated_ = 3; - } - } - else - { - truncated_ = 1; - } - } - return(byte) value_; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - if(value_ > Float.MAX_VALUE || value_ < -Float.MAX_VALUE) //@trunc min_val is a posative number. //Float.MIN_VALUE) - { - truncated_ = 4; - } - return(float)value_; - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 4; - } - return(int)value_; - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - if(value_ > Long.MAX_VALUE || value_ < Long.MIN_VALUE) - { - truncated_ = 1; // this is not necessarily correct, but we know there is truncation - } - return(long)value_; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return new Double(value_); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) - { - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) - { - truncated_ = 6; - } - else - { - truncated_ = 2; - } - } - return(short) value_; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - String stringRep = Double.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - return new StringReader(getNString()); - } - - //@pda jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } - endif */ - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - String stringRep = Double.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - /* ifdef JDBC40 - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLReal.java b/cvsroot/src/com/ibm/as400/access/SQLReal.java deleted file mode 100644 index 5440d687c..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLReal.java +++ /dev/null @@ -1,534 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLReal.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/*ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/*ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLReal -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int truncated_; - private float value_; - - SQLReal(SQLConversionSettings settings) - { - settings_ = settings; - truncated_ = 0; - value_ = 0.0f; - } - - public Object clone() - { - return new SQLReal(settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = BinaryConverter.byteArrayToFloat(rawBytes, offset); // @D0C - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - BinaryConverter.floatToByteArray(value_, rawBytes, offset); // @D0C - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - truncated_ = 0; - - if(object instanceof String) - { - try - { - value_ = Float.valueOf((String) object).floatValue(); - // @E2d int objectLength = ((String) object).length(); - // @E2d int valueLength = Float.toString(value_).length(); - // @E2d if(valueLength < objectLength) - // @E2d truncated_ = objectLength - valueLength; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - // @D9d - // We do not start messing with floating point values trying - // to figure out if they truncate. The performance of this - // in the BigDecimal case below is probably slower then creating - // a table on the system. - // - //else if(object instanceof Double) { - // value_ = ((Double) object).floatValue(); - // if(((Double) object).doubleValue() > value_) - // truncated_ = 8; - //} - // - // @D9d - //else if(object instanceof BigDecimal) { - // value_ = ((BigDecimal) object).floatValue(); - // int objectLength = SQLDataFactory.getPrecision((BigDecimal) object); - // int valueLength = SQLDataFactory.getPrecision(new BigDecimal(value_)); - // if(valueLength < objectLength) - // truncated_ = objectLength - valueLength; - //} - - else if(object instanceof Number) - { - // Set the value to the right type. - value_ = ((Number) object).floatValue(); // @D9c - - // Get the whole number portion of that value. - //long value = (long) value_; // @D9c //@bigdectrunc change to follow native driver - - // Get the original value as a long. This is the - // largest precision we can test for for a truncation. - //long truncTest = ((Number) object).longValue(); // @D9c //@bigdectrunc - - // If they are not equal, then we truncated significant - // data from the original value the user wanted us to insert. - //if(truncTest != value) // @D9c //@bigdectrunc - //truncated_ = 1; //@bigdectrunc - } - - - else if(object instanceof Boolean) - value_ = (((Boolean) object).booleanValue() == true) ? 1f : 0f; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.REAL; - } - - public String getCreateParameters() - { - return null; - } - - - public int getDisplaySize() - { - return 13; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.Float"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "REAL"; - } - - public int getMaximumPrecision() - { - return 24; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 480; - } - - public int getPrecision() - { - return 24; - } - - public int getRadix() - { - return 2; //@K1C Changed from 10 - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.REAL; - } - - public String getTypeName() - { - return "REAL"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return SQLDataFactory.getPrecision(Float.toString(value_)); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - // Convert the value to a String before creating the - // BigDecimal. This will create the exact BigDecimal - // that we want. If you pass the value directly to - // BigDecimal, then the value is not exact, and the - // scale becomes bigger than expected. - - // @A0A - // Modified the code to deal with numbers in scientific - // notations. The numbers that are in scientific notation - // are parsed to a base (the part before 'E') and an - // exponent (the part after 'E'). The base is then used - // to construct the BigDecimal object and then the exponent - // is used to shift the decimal point to its rightful place. - - // BigDecimal bigDecimal = new BigDecimal(Float.toString(value_)) // @A0D - - BigDecimal bigDecimal = null; // @A0A - - String numString = Float.toString(value_); // @A0A - int eIndex = numString.indexOf("E"); // @A0A - if(eIndex == -1) - { // @A0A - bigDecimal = new BigDecimal(numString); // @A0A - } // @A0A - else - { // @A0A - String base = numString.substring(0, eIndex); // @A0A - int exponent = Integer.parseInt(numString.substring(eIndex+1)); // @A0A - bigDecimal = new BigDecimal(base); // @A0A - bigDecimal = bigDecimal.movePointRight(exponent); // @A0A - } // @A0A - - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_ != 0.0f); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - if(value_ > Byte.MAX_VALUE || value_ < Byte.MIN_VALUE) //@trunc - { //@trunc - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE)//@trunc - { //@trunc - truncated_ = 3; //@trunc - } //@trunc - else //@trunc - { //@trunc - truncated_ = 1; //@trunc - } //@trunc - } //@trunc - return(byte) value_; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - return(double) value_; - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - return(float) value_; - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - if(value_ > Integer.MAX_VALUE || value_ < Integer.MIN_VALUE) //@trunc - { //@trunc - truncated_ = 4; //@trunc - } //@trunc - - return(int) value_; - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - if(value_ > Long.MAX_VALUE || value_ < Long.MIN_VALUE) //@trunc - { //@trunc - truncated_ = 8; //@trunc - } //@trunc - return(long) value_; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return new Float(value_); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - if(value_ > Short.MAX_VALUE || value_ < Short.MIN_VALUE) //@trunc - { //@trunc - truncated_ = 2; //@trunc - } //@trunc - return(short) value_; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - String stringRep = Float.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - /* ifdef JDBC40 - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - String stringRep = Float.toString(value_); - int decimal = stringRep.indexOf('.'); - if(decimal == -1) - return stringRep; - else - return stringRep.substring(0, decimal) - + settings_.getDecimalSeparator() - + stringRep.substring(decimal+1); - } - - /* ifdef JDBC40 - - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SQLRowID.java b/cvsroot/src/com/ibm/as400/access/SQLRowID.java deleted file mode 100644 index 3a4fda5a4..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLRowID.java +++ /dev/null @@ -1,615 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLRowID.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/*ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/*ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLRowID implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private static final byte[] default_ = new byte[0]; - - private SQLConversionSettings settings_; - private int length_; - private int truncated_; - private byte[] value_; - - SQLRowID(SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - truncated_ = 0; - value_ = default_; - } - - public Object clone() - { - return new SQLRowID(settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException { - - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - value_ = new byte[length_]; - System.arraycopy(rawBytes, offset+2, value_, 0, length_); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException { - - BinaryConverter.unsignedShortToByteArray(length_, rawBytes, offset); - int len = (value_.length < rawBytes.length) ? value_.length : rawBytes.length; - System.arraycopy(value_, 0, rawBytes, offset + 2, len); - // pad rawBytes with zeros if it has room - for(int i=(offset + 2 + len); i= 0) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - int objectLength = value_.length; - if(value_.length > 40) - { - byte[] newValue = new byte[40]; - System.arraycopy(value_, 0, newValue, 0, 40); - value_ = newValue; - } - truncated_ = objectLength - value_.length; - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(object instanceof Reader) - { - // value_ = BinaryConverter.stringToBytes(JDUtilities.readerToString((Reader)object, scale)); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - int objectLength = value_.length; - if(value_.length > 40) - { - byte[] newValue = new byte[40]; - System.arraycopy(value_, 0, newValue, 0, 40); - value_ = newValue; - } - stream.close(); //@scan1 - - truncated_ = objectLength - value_.length; - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Blob) - value_ = ((Blob)object).getBytes(1, (int)((Blob)object).length()); - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - try - { - value_ = BinaryConverter.stringToBytes(((Clob)object).getSubString(1, (int)((Clob)object).length())); - } - catch(NumberFormatException nfe) - { - // the Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Truncate if necessary. - int valueLength = value_.length; - if(valueLength > 40) - { - byte[] newValue = new byte[40]; - System.arraycopy(value_, 0, newValue, 0, 40); - value_ = newValue; - truncated_ = valueLength - 40; - } - else - truncated_ = 0; - - length_ = value_.length; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.ROWID; - } - - public String getCreateParameters() - { - return null; - } - - public int getDisplaySize() - { - return 40; - } - - public String getJavaClassName() - { - return "[B"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "ROWID"; - } - - public int getMaximumPrecision() - { - return 40; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 904; - } - - public int getPrecision() - { - return 40; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - /* ifdef JDBC40 - return java.sql.Types.ROWID; - endif */ - /* ifndef JDBC40 */ - return java.sql.Types.BINARY; - /* endif */ - } - - public String getTypeName() - { - return "ROWID"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new ByteArrayInputStream(getBytes()); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - byte[] bytes = getBytes(); - return new AS400JDBCBlob(bytes, bytes.length); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length > maxFieldSize) && (maxFieldSize > 0)) - { - byte[] truncatedValue = new byte[maxFieldSize]; - System.arraycopy(value_, 0, truncatedValue, 0, maxFieldSize); - return truncatedValue; - } - else - return value_; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - String string = BinaryConverter.bytesToHexString(getBytes()); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - /* ifdef JDBC40 - return new AS400JDBCRowId(getBytes()); //@PDC - endif */ - /* ifndef JDBC40 */ - return getBytes(); - /* endif */ - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - - //@PDA jdbc40 - /* ifdef JDBC40 - - public NClob getNClob() throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - String string = BinaryConverter.bytesToHexString(getBytes()); - return new AS400JDBCNClob(string, string.length()); - } - endif */ - //@PDA jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } - - /* ifdef JDBC40 - - //@PDA jdbc40 - public RowId getRowId() throws SQLException - { - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCRowId(getBytes()); - } - - //@PDA jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLSmallint.java b/cvsroot/src/com/ibm/as400/access/SQLSmallint.java deleted file mode 100644 index 90f084db0..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLSmallint.java +++ /dev/null @@ -1,548 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLSmallint.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/*ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLSmallint -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private int truncated_; - private short value_; - private int scale_; // @A0A - private BigDecimal bigDecimalValue_ = null; // @A0A - private int vrm_; //@trunc3 - - - SQLSmallint(int vrm) //@trunc3 - { - this(0, vrm); //@trunc3 - } - - SQLSmallint(int scale, int vrm) // @A0A //@trunc3 - { - truncated_ = 0; - value_ = 0; - scale_ = scale; // @A0A - if(scale_ > 0) // @C0A - bigDecimalValue_ = new BigDecimal(Short.toString(value_)); // @A0A - vrm_ = vrm; //@trunc3 - } - - public Object clone() - { - return new SQLSmallint(scale_, vrm_); //@trunc - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - value_ = BinaryConverter.byteArrayToShort(rawBytes, offset); // @D0C - - if(scale_ > 0) - { // @C0A - bigDecimalValue_ = (new BigDecimal(Short.toString(value_))).movePointLeft(scale_); // @A0A - value_ = (short) bigDecimalValue_.intValue(); // @A0A - } // @C0A - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - BinaryConverter.shortToByteArray(value_, rawBytes, offset); // @D0C - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - truncated_ = 0; // @D9c - - if(object instanceof String) - { - // @D10c new implementation - // old ... - // - // try - // { - // value_ = Short.parseShort((String) object); - // } - // catch(NumberFormatException e) - // { - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - // } - - // @P1 First try to convert the string to an int(no extra object creation). If - // that fails try turning it into a double, which will involve an extra object - // create but Double will accept bigger numbers and floating point numbers so it - // will catch more truncation cases. The bottom line is don't create an extra - // object in the normal case. If the user does ps.setString(1, "111222333.444.555") - // on an integer field, they can't expect the best performance. - // create. - boolean tryAgain = false; // @P1a - - try - { - // @P1d long longValue = (long) Double.parseDouble((String) object); - int intValue = (int) Integer.parseInt((String) object); // @P1a - - if(( intValue > Short.MAX_VALUE ) || ( intValue < Short.MIN_VALUE )) - { - truncated_ = 6; - //@trunc3 match native for ps.setString() to throw mismatch instead of truncation - if(vrm_ >= JDUtilities.vrm610) //@trunc3 - { //@trunc3 - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); //@trunc3 - } //@trunc3 - } - value_ = (short) intValue; // @D9c - } - catch(NumberFormatException e) - { - tryAgain = true; // @P1a - // @P1d JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - if(tryAgain) // @P1a - { - // @P1a - try // @P1a - { - // @P1a - double doubleValue = Double.valueOf((String) object).doubleValue(); // @P1a - // @P1a - if(( doubleValue > Short.MAX_VALUE ) || ( doubleValue < Short.MIN_VALUE )) // @P1a - { - // @P1a - truncated_ = 6; // @P1a - //@trunc3 match native for ps.setString() to throw mismatch instead of truncation - if(vrm_ >= JDUtilities.vrm610) //@trunc3 - { //@trunc3 - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); //@trunc3 - } //@trunc3 - } // @P1a - value_ = (short) doubleValue; // @P1a - } // @P1a - catch(NumberFormatException e) // @P1a - { - // @P1a - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); // @P1a - } // @P1a - } // @P1a - } // @P1a - - else if(object instanceof Number) - { - // Compute truncation by getting the value as a long - // and comparing it against MAX_VALUE/MIN_VALUE. You - // do this because truncation of the decimal portion of - // the value is insignificant. We only care if the - // whole number portion of the value is too large/small - // for the column. - long longValue = ((Number) object).longValue(); // @D9c - if(( longValue > Short.MAX_VALUE ) || ( longValue < Short.MIN_VALUE )) // @D9a - { - // Note: Truncated here is set to 6 bytes. This is based on - // the idea that a long was used and a short was the - // column type. We could check for different types - // and provide a more accurate number, but I don't - // really know that this field is of any use to people - // in this case anyway (for example, you could have a - // float (4 bytes) that didn't fit into a bigint (8 - // bytes) without some data truncation. - truncated_ = 6; // @D9c - } - - - // Store the value. - value_ = (short) longValue; // @D9c - } - - else if(object instanceof Boolean) - value_ = (((Boolean) object).booleanValue() == true) ? (short) 1 : (short) 0; - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - if(scale_ > 0) - { // @C0A - bigDecimalValue_ = (new BigDecimal(Short.toString(value_))).movePointLeft(scale_); // @A0A - value_ = (short) bigDecimalValue_.intValue(); // @A0A - } // @C0A - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.SMALLINT; - } - - public String getCreateParameters() - { - return null; - } - - public int getDisplaySize() - { - return 6; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - /* smallints are Integers from jdbc 4.0 spec: - Note � The JDBC 1.0 specification defined the Java object mapping for the - SMALLINT and TINYINT JDBC types to be Integer. The Java language did not - include the Byte and Short data types when the JDBC 1.0 specification was - finalized. The mapping of SMALLINT and TINYINT to Integer is maintained to - preserve backwards compatibility.*/ - //this corresponds to getObject() also - return "java.lang.Integer"; //@int - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "SMALLINT"; - } - - public int getMaximumPrecision() - { - return 5; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 500; - } - - public int getPrecision() - { - return 5; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return scale_; - } - - public int getType() - { - return java.sql.Types.SMALLINT; - } - - public String getTypeName() - { - return "SMALLINT"; - } - - public boolean isSigned() - { - return true; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return 2; // @D0C - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - if(scale_ > 0) - { // @C0A - if(scale >= 0) - return bigDecimalValue_.setScale(scale); // @A0A - else - return bigDecimalValue_; - } // @C0A - else - { // @C0A - if(scale <= 0) // @C0A - return BigDecimal.valueOf((long) value_); // @C0A - else // @C0A - return BigDecimal.valueOf((long) value_).setScale(scale); // @C0A - } // @C0A - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - return(value_ != 0); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - if(value_ > Byte.MAX_VALUE || value_ < Byte.MIN_VALUE) - { - truncated_ = 1; - } - return(byte) value_; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - if(scale_ > 0) // @C0A - return bigDecimalValue_.doubleValue(); // @A0A - else // @C0A - return(double) value_; // @A0D @C0A - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - if(scale_ > 0) // @C0A - return bigDecimalValue_.floatValue(); // @A0A - else // @C0A - return(float) value_; // @A0D @C0A - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - return new Integer(value_); // @D2c -- used to be new Short(value_) - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - return value_; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - if(scale_ > 0) // @C0A - return bigDecimalValue_.toString(); // @A0A - else // @C0A - return Short.toString(value_); // @A0D @C0A - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - /* ifdef JDBC40 - //@pda jdbc40 - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - if(scale_ > 0) - return bigDecimalValue_.toString(); - else - return Short.toString(value_); - } - /* ifdef JDBC40 - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLTime.java b/cvsroot/src/com/ibm/as400/access/SQLTime.java deleted file mode 100644 index 4ce217bf9..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLTime.java +++ /dev/null @@ -1,698 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLTime.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLTime -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int timeFormat_; - private int hour_; - private int minute_; - private int second_; - private int truncated_; - - SQLTime(SQLConversionSettings settings, int timeFormat) // @550C - { - settings_ = settings; - hour_ = 0; - minute_ = 0; - second_ = 0; - truncated_ = 0; - timeFormat_ = timeFormat; // @550A - } - - public Object clone() - { - return new SQLTime(settings_, timeFormat_); // @550C - } - - public static Time stringToTime(String s, - SQLConversionSettings settings, - Calendar calendar) - throws SQLException - { - try - { - - // If the string is empty, then it is likely a NULL, so - // just set this to a default date. - if(s.trim().length() == 0) - return new Time(0); - - // Parse the string according to the format and separator. - // else if(format.equalsIgnoreCase(JDProperties.TIME_FORMAT_USA)) { - if(calendar == null) - { - calendar = Calendar.getInstance(); //@P0A - calendar.setLenient(false); //@dat1 - } - switch(settings.getTimeFormat()) - { // @A0A - case SQLConversionSettings.TIME_FORMAT_USA: // @A0A - int hour = Integer.parseInt(s.substring(0, 2)); - char amPm = s.charAt(6); - if(hour == 12) - { - if(amPm == 'A') - hour = 0; - } - else - { // Hour between 1 and 11. - if(amPm == 'P') - hour += 12; - } - calendar.set(Calendar.HOUR_OF_DAY, hour); - calendar.set(Calendar.MINUTE, Integer.parseInt(s.substring(3, 5))); - calendar.set(Calendar.SECOND, 0); - break; // @A0A - - case SQLConversionSettings.TIME_FORMAT_EUR: - case SQLConversionSettings.TIME_FORMAT_JIS: - case SQLConversionSettings.TIME_FORMAT_HMS: - case SQLConversionSettings.TIME_FORMAT_ISO: - calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(s.substring(0, 2))); - calendar.set(Calendar.MINUTE, Integer.parseInt(s.substring(3, 5))); - calendar.set(Calendar.SECOND, Integer.parseInt(s.substring(6, 8))); - break; - } - - //@dat1 non-lenient does not allow 0s - //@dat1 calendar.set(Calendar.YEAR, 0); - //@dat1 calendar.set(Calendar.MONTH, 0); - //@dat1 calendar.set(Calendar.DAY_OF_MONTH, 0); - //@dat1 calendar.set(Calendar.MILLISECOND, 0);*/ - } - catch(NumberFormatException e) - { - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing time "+s, e); - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); - } - catch(StringIndexOutOfBoundsException e) - { - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing time "+s, e); - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); - } - - try //@dat1 - { - return new Time(calendar.getTime().getTime()); - }catch(Exception e){ - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing time "+s, e); //@dat1 - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); //@dat1 - return null; //@dat1 - } - } - - public static String timeToString(Time t, - SQLConversionSettings dataFormat, - Calendar calendar) - { - return timeToString(t, dataFormat, calendar, -1); // @E3C - } - - // @E3A - This contains the logic from the original timeToString(), with new arg "hourIn". - private static String timeToString(Time t, - SQLConversionSettings dataFormat, - Calendar calendar, - int hourIn) - { - StringBuffer buffer = new StringBuffer(); - String separator = dataFormat.getTimeSeparator(); - if(calendar == null) calendar = Calendar.getInstance(); //@P0A - calendar.setTime(t); - - int hour = calendar.get(Calendar.HOUR_OF_DAY); // @E3A - int minute = calendar.get(Calendar.MINUTE); // @E3A - int second = 0; // @E3A - - // Note: No matter what format is being used, - // ensure that exactly 8 characters are in the - // buffer. - - switch(dataFormat.getTimeFormat()) - { // @A0A - case SQLConversionSettings.TIME_FORMAT_USA: // @A0A - // @E3D int hour = calendar.get(Calendar.HOUR_OF_DAY); - char amPm; - //@PDc - translate to ampm based on hour,min,sec - - //13-23 -> (x-12)pm - //12 -> 12pm - //1-11 -> xam - //0 -> 12am - //0:0:0 -> 00:00:00am (special case) - //24:0:0 -> 12:00:00am (special case) //hour=0, hourIn=24 since 0 and 24 both map to 0 in Calendar - - if(hour > 12) - { - hour -= 12; - amPm = 'P'; - } - else if(hour == 12) - amPm = 'P'; - else if((hour > 0) && (hour < 12)) - amPm = 'A'; - else if((minute == 0) && (second == 0)) - { - //special cases: 0:0:0 and 24:0:0 - if(hourIn == 24) - hour = 12; - amPm = 'A'; - } - else - { - //0 hour case - hour = 12; - amPm = 'A'; - } - - buffer.append(JDUtilities.padZeros(hour, 2)); - buffer.append(':'); - buffer.append(JDUtilities.padZeros(minute, 2)); // @E3C - buffer.append(' '); - buffer.append(amPm); - buffer.append('M'); - break; // @A0A - - case SQLConversionSettings.TIME_FORMAT_EUR: // @A0A - case SQLConversionSettings.TIME_FORMAT_ISO: // @A0A - second = calendar.get(Calendar.SECOND); // @E3A - buffer.append(JDUtilities.padZeros(hour, 2)); // @E3C - buffer.append('.'); - buffer.append(JDUtilities.padZeros(minute, 2)); // @E3C - buffer.append('.'); - buffer.append(JDUtilities.padZeros(second, 2)); // @E3C - break; // @A0A - - case SQLConversionSettings.TIME_FORMAT_JIS: // @A0A - second = calendar.get(Calendar.SECOND); // @F3A - buffer.append(JDUtilities.padZeros(hour, 2)); // @E3C - buffer.append(':'); - buffer.append(JDUtilities.padZeros(minute, 2)); // @E3C - buffer.append(':'); - buffer.append(JDUtilities.padZeros(second, 2)); // @E3C - break; // @A0A - - case SQLConversionSettings.TIME_FORMAT_HMS: // @A0A - second = calendar.get(Calendar.SECOND); // @E3A - buffer.append(JDUtilities.padZeros(hour, 2)); // @E3C - buffer.append(separator); - buffer.append(JDUtilities.padZeros(minute, 2)); // @E3C - buffer.append(separator); - buffer.append(JDUtilities.padZeros(second, 2)); // @E3C - break; // @A0A - } - - // The Calendar class represents 24:00:00 as 00:00:00. // @E3A - if(hourIn == 24 && hour==0 && minute==0 && second==0 ) // @E3A //@tim3 - { - buffer.setCharAt(0,'2'); // @E3A - buffer.setCharAt(1,'4'); // @E3A - // Note: StringBuffer.replace() is available in Java2. - } - - return buffer.toString(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - int connectionTimeFormat = settings_.getTimeFormat(); // @550A - // @550 If the time is from a stored procedure result set, it could be in a different time format than the connection's format - switch(((timeFormat_ != -1) && (timeFormat_ != connectionTimeFormat)) ? timeFormat_ : connectionTimeFormat) // @550C - { - - case SQLConversionSettings.TIME_FORMAT_USA: // hh:mm AM or PM - hour_ = (rawBytes[offset] & 0x0f) * 10 + (rawBytes[offset+1] & 0x0f); - minute_ = (rawBytes[offset+3] & 0x0f) * 10 + (rawBytes[offset+4] & 0x0f); - second_ = 0; - - //translate from ampm to 24hour - //since we can get back duplicate values of 00:00 (00:00am) and 24:00 (12:00am) (which map to - //the same time of day in Calendar), we need a way to differentiate the two. - if(((rawBytes[offset+6] == (byte)0xd7) && (hour_ < 12)) || // xd7='P' - ((rawBytes[offset+6] == (byte)0xC1) && (hour_ == 12))) // xC1='A' - hour_ += 12; - break; - - case SQLConversionSettings.TIME_FORMAT_HMS: // hh:mm:ss - case SQLConversionSettings.TIME_FORMAT_ISO: // hh.mm.ss - case SQLConversionSettings.TIME_FORMAT_EUR: // hh.mm.ss - case SQLConversionSettings.TIME_FORMAT_JIS: // hh:mm:ss - hour_ = (rawBytes[offset] & 0x0f) * 10 + (rawBytes[offset+1] & 0x0f); - minute_ = (rawBytes[offset+3] & 0x0f) * 10 + (rawBytes[offset+4] & 0x0f); - second_ = (rawBytes[offset+6] & 0x0f) * 10 + (rawBytes[offset+7] & 0x0f); - break; - - default: - break; - } - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - StringBuffer buffer = new StringBuffer(8); - - // Always use ISO format here. - buffer.append(JDUtilities.padZeros(hour_, 2)); - buffer.append('.'); - buffer.append(JDUtilities.padZeros(minute_, 2)); - buffer.append('.'); - buffer.append(JDUtilities.padZeros(second_, 2)); - - try - { - ccsidConverter.stringToByteArray(buffer.toString(), rawBytes, offset); - } - catch(CharConversionException e) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); // @E2C - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(calendar == null) - { - calendar = Calendar.getInstance(); //@P0A - calendar.setLenient(false); //@dat1 - } - if(object instanceof String) - { - stringToTime((String) object, settings_, calendar); - hour_ = calendar.get(Calendar.HOUR_OF_DAY); - minute_ = calendar.get(Calendar.MINUTE); - second_ = calendar.get(Calendar.SECOND); - } - - else if(object instanceof Time) - { - calendar.setTime((Time) object); - hour_ = calendar.get(Calendar.HOUR_OF_DAY); - minute_ = calendar.get(Calendar.MINUTE); - second_ = calendar.get(Calendar.SECOND); - } - - else if(object instanceof Timestamp) - { - calendar.setTime((Timestamp) object); - hour_ = calendar.get(Calendar.HOUR_OF_DAY); - minute_ = calendar.get(Calendar.MINUTE); - second_ = calendar.get(Calendar.SECOND); - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.TIME; - } - - public String getCreateParameters() - { - return null; - } - - public int getDisplaySize() - { - return 8; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.sql.Time"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "TIME"; - } - - public int getMaximumPrecision() - { - return 8; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 388; - } - - public int getPrecision() - { - return 8; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.TIME; - } - - public String getTypeName() - { - return "TIME"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return 8; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - Calendar calendar = Calendar.getInstance(); - calendar.set(1970, Calendar.JANUARY, 1, hour_, minute_, second_); - calendar.set(Calendar.MILLISECOND, 0); - return new Time(calendar.getTime().getTime()); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - Calendar calendar = Calendar.getInstance(); - calendar.set(1970, Calendar.JANUARY, 1, hour_, minute_, second_); - calendar.set(Calendar.MILLISECOND, 0); - Time t = new Time(calendar.getTime().getTime()); - return timeToString(t, settings_, calendar, hour_); // @E3C - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) calendar = Calendar.getInstance(); //@P0A - // @F2A - // You are supposed to normalize the time to the epoch, - // not set its extra fields to 0. This produces totally different - // results. See JDBC API Reference and Tutorial, pg 860 for complete - // details. - calendar.set(1970, Calendar.JANUARY, 1, hour_, minute_, second_); // @F2C - // @F2D calendar.set(0, 0, 0, hour_, minute_, second_); - - // Make sure to set the millisecond value from the time too as - // SQL Time objects do not track this field. - calendar.set(Calendar.MILLISECOND, 0); // @F2A - - return new Time(calendar.getTime().getTime()); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - // - // The JDBC 1.22 specification says that this conversion - // does not need to be supported, but the Graham Hamilton - // book says it does. I am going to go with the spec for - // now, since I don't think that any such conversion - // really makes sense. - // - //@54A JDBC 3.0 specification says this converstion is valid - //@54D JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - //@54D return null; - - //@54A - truncated_ = 0; //@54A - if(calendar == null) calendar = Calendar.getInstance(); //@54A - calendar.set(1970, Calendar.JANUARY, 1, hour_, minute_, second_); //@54A - calendar.set(Calendar.MILLISECOND, 0); //@54A - Timestamp ts = new Timestamp(calendar.getTime().getTime()); //@54A - ts.setNanos(0); //@54A - return ts; //@54A - - - } - - public InputStream getUnicodeStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); //@pdc - return null; //@pdc - } - - /* ifdef JDBC40 - //@pda jdbc40 - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - Calendar calendar = Calendar.getInstance(); - calendar.set(1970, Calendar.JANUARY, 1, hour_, minute_, second_); - calendar.set(Calendar.MILLISECOND, 0); - Time t = new Time(calendar.getTime().getTime()); - return timeToString(t, settings_, calendar, hour_); // @E3C - } - - /* ifdef JDBC40 - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLTimestamp.java b/cvsroot/src/com/ibm/as400/access/SQLTimestamp.java deleted file mode 100644 index fe703931d..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLTimestamp.java +++ /dev/null @@ -1,630 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLTimestamp.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLTimestamp -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int truncated_; - private int year_; - private int month_; - private int day_; - private int hour_; - private int minute_; - private int second_; - private int nanos_; - - SQLTimestamp(SQLConversionSettings settings) - { - settings_ = settings; - truncated_ = 0; - year_ = 0; - month_ = 0; - day_ = 0; - hour_ = 0; - minute_ = 0; - second_ = 0; - nanos_ = 0; - } - - public Object clone() - { - return new SQLTimestamp(settings_); - } - - public static Timestamp stringToTimestamp(String s, Calendar calendar) - throws SQLException - { - try - { - // @E3D // If the string has a year 1, then it is likely a NULL, so - // @E3D // just set this to a default date. - int year = Integer.parseInt(s.substring(0, 4)); - // @E3D if(year == 1) { - // @E3D return new Timestamp(0); - // @E3D } - - // Parse the string . - // @E3D else { - - if(calendar == null) - { - calendar = Calendar.getInstance(); // @F5A - calendar.setLenient(false); //@dat1 - } - calendar.set(Calendar.YEAR, year); - calendar.set(Calendar.MONTH, Integer.parseInt(s.substring(5, 7)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s.substring(8, 10))); - calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(s.substring(11, 13))); - calendar.set(Calendar.MINUTE, Integer.parseInt(s.substring(14, 16))); - calendar.set(Calendar.SECOND, Integer.parseInt(s.substring(17, 19))); - - Timestamp ts = null;//@dat1 - try //@dat1 - { - ts = new Timestamp(calendar.getTime().getTime()); //@dat1 - }catch(Exception e){ - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing timestamp "+s, e); //@dat1 - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); //@dat1 - return null; //@dat1 - } - - // @F2A - // Remember that the value for nanoseconds is optional. If we don't check the - // length of the string before trying to handle nanoseconds for the timestamp, - // we will blow up if there is no value available. An example of a String value - // as a timestamp that would have this problem is: "1999-12-31 12:59:59" - if(s.length() > 20) - { // @F2A - String nanos = s.substring(20).trim() + "000000000"; // @F2M - ts.setNanos(Integer.parseInt(nanos.substring(0, 6)) * 1000); - } - else - { - ts.setNanos(0); // @F2A - } - - return ts; - // @E3D } - } - catch(NumberFormatException e) - { - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing timestamp "+s, e); - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); - } - catch(StringIndexOutOfBoundsException e) - { - if (JDTrace.isTraceOn()) JDTrace.logException((Object)null, "Error parsing timestamp "+s, e); - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH, s); - } - - return new Timestamp(0); - } - - public static String timestampToString(Timestamp ts, - Calendar calendar) - { - return timestampToString(ts, calendar, -1); // @F4C - } - - // @F4A - New method - Contains the logic from the old method, with the addition of the hourIn parameter. - public static String timestampToString(Timestamp ts, - Calendar calendar, int hourIn) - { - // @F3A - // The native driver outputs timestamps like 2100-01-02-03.45.56.000000, while we output timestamps like 2100-01-02 03:45:56.000000. The first is apparently the ISO standard while ours follows Java's Timestamp.toString() method. This was pointed out by a user who noticed that although he gets a timestamp from our database in one format, he can't put it back in the database in that same format. - // @F6A Change back to old format because of service issue. - StringBuffer buffer = new StringBuffer(); - if(calendar == null) calendar = Calendar.getInstance(); //@P0A - calendar.setTime(ts); - - int hour = calendar.get(Calendar.HOUR_OF_DAY); //@tim2 - if(hourIn == 24 && hour==0) //@tim2 - {//@tim2 - //db2 represents midnight as 24:00 and midnight + 1 min as 00:01, but in java, 24 is midnight of - //the next day (ie calendar.set(2007, 9, 10, 24, 0, 0) toString() -> 2007-10-11 00:00) - //java changes 1/1/2007 24:00 -> 1/2/2007 00:00 - //for Native jdbc driver compliance, code block at bottom replaces "00" with "24", but need to - //go back one day to counteract java's conversion. - calendar.add(Calendar.DATE, -1); - }//@tim2 - - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.YEAR), 4)); - buffer.append('-'); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.MONTH) + 1, 2)); - buffer.append('-'); - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.DAY_OF_MONTH), 2)); - buffer.append(' '); //@F6C - //@F6D buffer.append('-'); // @F3C - hour = calendar.get(Calendar.HOUR_OF_DAY); // @F4A //@tim2 - // @F4D buffer.append(JDUtilities.padZeros(calendar.get(Calendar.HOUR_OF_DAY), 2)); - buffer.append(JDUtilities.padZeros(hour, 2)); // @F4C - buffer.append(':'); //@F6C - //@F6D buffer.append('.'); // @F3C - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.MINUTE), 2)); - buffer.append(':'); //@F6C - //@F6D buffer.append('.'); // @F3C - buffer.append(JDUtilities.padZeros(calendar.get(Calendar.SECOND), 2)); - buffer.append('.'); - buffer.append(JDUtilities.padZeros(ts.getNanos(), 9)); // @B1C - - // The Calendar class represents 24:00:00 as 00:00:00. // @F4A - // Format of timestamp is YYYY-MM-DD-hh.mm.ss.uuuuuu, so hh is at offset 11. - if(hourIn == 24 && hour==0) // @F4A - { - buffer.setCharAt(11,'2'); // @F4A - buffer.setCharAt(12,'4'); // @F4A - // Note: StringBuffer.replace() is available in Java2. - } - - // Ensure that exactly 26 characters are returned. - String tempString = buffer.toString() + "000000"; - return tempString.substring(0, 26); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - year_ = (rawBytes[offset] & 0x0f) * 1000 - + (rawBytes[offset+1] & 0x0f) * 100 - + (rawBytes[offset+2] & 0x0f) * 10 - + (rawBytes[offset+3] & 0x0f); - - // @E3D // If the string has a year 1, then it is likely a NULL, so - // @E3D // just set this to a default date. - // @E3D if(year_ != 1) { - month_ = (rawBytes[offset+5] & 0x0f) * 10 - + (rawBytes[offset+6] & 0x0f) - 1; - day_ = (rawBytes[offset+8] & 0x0f) * 10 - + (rawBytes[offset+9] & 0x0f); - hour_ = (rawBytes[offset+11] & 0x0f) * 10 - + (rawBytes[offset+12] & 0x0f); - minute_ = (rawBytes[offset+14] & 0x0f) * 10 - + (rawBytes[offset+15] & 0x0f); - second_ = (rawBytes[offset+17] & 0x0f) * 10 - + (rawBytes[offset+18] & 0x0f); - nanos_ = - ((rawBytes[offset+20] & 0x0f) * 100000 - + (rawBytes[offset+21] & 0x0f) * 10000 - + (rawBytes[offset+22] & 0x0f) * 1000 - + (rawBytes[offset+23] & 0x0f) * 100 - + (rawBytes[offset+24] & 0x0f) * 10 - + (rawBytes[offset+25] & 0x0f) ) * 1000; - // @E3D } - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - StringBuffer buffer = new StringBuffer(getString().replace(':', '.')); - buffer.setCharAt(10, '-'); - - try - { - ccsidConverter.stringToByteArray(buffer.toString(), rawBytes, offset); - } - catch(CharConversionException e) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); // @E2C - } - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.TIMESTAMP; - } - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(calendar == null) - { - calendar = Calendar.getInstance(); // @F5A - calendar.setLenient(false); //@dat1 - } - if(object instanceof String) - { - Timestamp ts = stringToTimestamp((String) object, calendar); - year_ = calendar.get(Calendar.YEAR); - month_ = calendar.get(Calendar.MONTH); - day_ = calendar.get(Calendar.DAY_OF_MONTH); - hour_ = calendar.get(Calendar.HOUR_OF_DAY); - minute_ = calendar.get(Calendar.MINUTE); - second_ = calendar.get(Calendar.SECOND); - nanos_ = ts.getNanos(); - } - - else if(object instanceof Timestamp) - { // @F5M - calendar.setTime((Timestamp) object); - year_ = calendar.get(Calendar.YEAR); - month_ = calendar.get(Calendar.MONTH); - day_ = calendar.get(Calendar.DAY_OF_MONTH); - hour_ = calendar.get(Calendar.HOUR_OF_DAY); - minute_ = calendar.get(Calendar.MINUTE); - second_ = calendar.get(Calendar.SECOND); - nanos_ = ((Timestamp) object).getNanos(); - } - - else if(object instanceof java.util.Date) - { // @F5C - calendar.setTime((java.util.Date) object); // @F5C - year_ = calendar.get(Calendar.YEAR); - month_ = calendar.get(Calendar.MONTH); - day_ = calendar.get(Calendar.DAY_OF_MONTH); - hour_ = calendar.get(Calendar.HOUR_OF_DAY); - minute_ = calendar.get(Calendar.MINUTE); - second_ = calendar.get(Calendar.SECOND); - nanos_ = calendar.get(Calendar.MILLISECOND) * 1000000; - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public String getCreateParameters() - { - return null; - } - - public int getDisplaySize() - { - return 26; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.sql.Timestamp"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "TIMESTAMP"; - } - - public int getMaximumPrecision() - { - return 26; - } - - public int getMaximumScale() - { - return 6; - } - - public int getMinimumScale() - { - return 6; - } - - public int getNativeType() - { - return 392; - } - - public int getPrecision() - { - return 26; - } - - public int getRadix() - { - return 10; - } - - public int getScale() - { - return 6; - } - - public int getType() - { - return java.sql.Types.TIMESTAMP; - } - - public String getTypeName() - { - return "TIMESTAMP"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return false; - } - - public int getActualSize() - { - return 26; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public Blob getBlob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Reader getCharacterStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Clob getClob() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 16; - if(calendar == null) calendar = Calendar.getInstance(); //@P0A - calendar.set(year_, month_, day_, 0, 0, 0); - calendar.set(Calendar.MILLISECOND, 0); //@KBA added per JTOpen Bug 3818. According to java.sql.Date, the milliseconds also need to be 'normalized' to zero. - return new Date(calendar.getTime().getTime()); - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - Calendar calendar = Calendar.getInstance(); - calendar.set(year_, month_, day_, hour_, minute_, second_); - Timestamp ts = new Timestamp (calendar.getTime().getTime()); - ts.setNanos(nanos_); - return ts; - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - Calendar calendar = Calendar.getInstance(); - calendar.set(year_, month_, day_, hour_, minute_, second_); - Timestamp ts = new Timestamp (calendar.getTime().getTime()); - ts.setNanos(nanos_); - return timestampToString(ts, calendar, hour_); // @F4C - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 18; - if(calendar == null) calendar = Calendar.getInstance(); //@P0A - calendar.set(0, 0, 0, hour_, minute_, second_); - return new Time(calendar.getTime().getTime()); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) calendar = Calendar.getInstance(); //@P0A - calendar.set(year_, month_, day_, hour_, minute_, second_); - Timestamp ts = new Timestamp(calendar.getTime().getTime()); - ts.setNanos(nanos_); - return ts; - } - - public InputStream getUnicodeStream() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); //@pdc - return null; //@pdc - } - - /* ifdef JDBC40 - //@pda jdbc40 - public NClob getNClob() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - Calendar calendar = Calendar.getInstance(); - calendar.set(year_, month_, day_, hour_, minute_, second_); - Timestamp ts = new Timestamp (calendar.getTime().getTime()); - ts.setNanos(nanos_); - return timestampToString(ts, calendar, hour_); - } - - /* ifdef JDBC40 - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLVarbinary.java b/cvsroot/src/com/ibm/as400/access/SQLVarbinary.java deleted file mode 100644 index 583de7bec..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLVarbinary.java +++ /dev/null @@ -1,649 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLVarbinary.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLVarbinary -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private static final byte[] default_ = new byte[0]; - - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private byte[] value_; - - SQLVarbinary(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = default_; - } - - public Object clone() - { - return new SQLVarbinary(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset);; - AS400ByteArray typeConverter = new AS400ByteArray(length_); - value_ = (byte[])typeConverter.toObject(rawBytes, offset+2); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - AS400ByteArray typeConverter = new AS400ByteArray(length_); - BinaryConverter.unsignedShortToByteArray(length_, rawBytes, offset); - typeConverter.toBytes(value_, rawBytes, offset + 2); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(object instanceof String) - { - try - { - value_ = BinaryConverter.stringToBytes((String)object); - } - catch(NumberFormatException nfe) - { - // the String contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else if(object instanceof byte[]) - value_ = (byte[])object; - - else if(object instanceof InputStream) - { - //value_ = JDUtilities.streamToBytes((InputStream)object, scale); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(object instanceof Reader) - { - // value_ = BinaryConverter.stringToBytes(JDUtilities.readerToString((Reader)object, scale)); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - stream.close(); //@scan1 - - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - stream.close(); //@scan1 - - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Blob) - value_ = ((Blob)object).getBytes(1, (int)((Blob)object).length()); - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - try - { - value_ = BinaryConverter.stringToBytes(((Clob)object).getSubString(1, (int)((Clob)object).length())); - } - catch(NumberFormatException nfe) - { - // the Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Truncate if necessary. - int valueLength = value_.length; - if(valueLength > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - truncated_ = valueLength - maxLength_; - } - else - truncated_ = 0; - - length_ = value_.length; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.VARBINARY; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_ ; - } - - public String getJavaClassName() - { - return "[B"; - } - - public String getLiteralPrefix() - { - return "VARBINARY(X\'"; //@5WXVJX changed from x' - } - - public String getLiteralSuffix() - { - return "\')"; //@5WXVJX changed from ' - } - - public String getLocalName() - { - return "VARBINARY"; - } - - public int getMaximumPrecision() - { - return 32739; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 908; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.VARBINARY; - } - - public String getTypeName() - { - return "VARBINARY"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new ByteArrayInputStream(getBytes()); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - byte[] bytes = getBytes(); - return new AS400JDBCBlob(bytes, bytes.length); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length > maxFieldSize) && (maxFieldSize > 0)) - { - byte[] truncatedValue = new byte[maxFieldSize]; - System.arraycopy(value_, 0, truncatedValue, 0, maxFieldSize); - return truncatedValue; - } - else - { - return value_; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - String string = BinaryConverter.bytesToHexString(getBytes()); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return getBytes(); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - -/* ifdef JDBC40 - //@PDA jdbc40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - String string = BinaryConverter.bytesToHexString(getBytes()); - return new AS400JDBCNClob(string, maxLength_); - } -endif */ - - //@PDA jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } - -/* ifdef JDBC40 - //@PDA jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@PDA jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLVarchar.java b/cvsroot/src/com/ibm/as400/access/SQLVarchar.java deleted file mode 100644 index d93d349d3..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLVarchar.java +++ /dev/null @@ -1,727 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLVarchar.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.net.URL; - -final class SQLVarchar -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private String value_; - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLVarchar(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; - } - - public Object clone() - { - return new SQLVarchar(maxLength_, settings_); - } - - // @A2A - // Added method trim() to trim the string. - public void trim() // @A2A - { // @A2A - value_ = value_.trim(); // @A2A - } // @A2A - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - try{ - value_ = ccsidConverter.byteArrayToString(rawBytes, offset+2, length_, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - }catch(Exception e){ - JDError.throwSQLException(JDError.EXC_CHAR_CONVERSION_INVALID, e); - } - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - try - { - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - // The length in the first 2 bytes is actually the length in characters. - byte[] temp = ccsidConverter.stringToByteArray(value_, bidiConversionProperties); //@KBC changed to used bidiConversionProperties instead of bidiStringType - BinaryConverter.unsignedShortToByteArray(temp.length, rawBytes, offset); - if(temp.length > maxLength_) - { - maxLength_ = temp.length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL, "Change Descriptor"); - } - System.arraycopy(temp, 0, rawBytes, offset+2, temp.length); - - // The buffer we are filling with data is big enough to hold the entire field. - // For varchar fields the actual data is often smaller than the field width. - // That means whatever is in the buffer from the previous send is sent to the - // system. The data stream includes actual data length so the old bytes are not - // written to the database, but the junk left over may decrease the affectiveness - // of compression. The following code will write hex 0s to the buffer when - // actual length is less that field length. Note the 0s are written only if - // the field length is pretty big. The data stream code (DBBaseRequestDS) - // does not compress anything smaller than 1K. - if( (maxLength_ - temp.length > 16)) //@rle - { - int stopHere = offset + 2 + maxLength_; - for(int i=offset + 2 + temp.length; i= 20 && object instanceof Clob) - { // @C1C - Clob clob = (Clob)object; // @C1C - value = clob.getSubString(1, (int)clob.length()); // @C1C @D1 - } // @C1C - - /* ifdef JDBC40 - else if(object instanceof SQLXML) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value = xml.getString(); - } - endif */ - - if(value == null) // @C1C - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - value_ = value; // @C1A - - // Truncate if necessary. - int valueLength = value_.length(); - - int truncLimit = maxLength_; // @F2a - - if(valueLength > truncLimit) // @F2c - { - value_ = value_.substring(0, truncLimit); // @F2c - truncated_ = valueLength - truncLimit; // @F2c - } - else - truncated_ = 0; - - length_ = value_.length(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.VARCHAR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - //@F1A JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "VARCHAR"; - } - - public int getMaximumPrecision() - { - return 32739; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 448; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.VARCHAR; - } - - public String getTypeName() - { - return "VARCHAR"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(getString())); // @F3C - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(getString())); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - byte[] bytes = BinaryConverter.stringToBytes(getString()); - return new AS400JDBCBlob(bytes, bytes.length); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true" or "false", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = getString().trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).byteValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - if(d > Byte.MAX_VALUE || d < Byte.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.byteValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(getString(), settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).intValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Integer.MAX_VALUE || d < Integer.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.intValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).longValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Long.MAX_VALUE || d < Long.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.longValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - //return(new Double(getString().trim())).shortValue(); //@trunc - Double doubleValue = new Double (value_.trim ()); //@trunc - double d = doubleValue.doubleValue(); //@trunc - - if( d > Short.MAX_VALUE || d < Short.MIN_VALUE) //@trunc - truncated_ = 1; //@trunc - - return doubleValue.shortValue (); //@trunc - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length() - maxFieldSize; - return value_.substring(0, maxFieldSize); - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(getString(), settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(getString(), calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(getString()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } - /* ifdef JDBC40 - //@pda jdbc40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } - - /* ifdef JDBC40 - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - // - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // this string contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} / - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } - endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLVarcharForBitData.java b/cvsroot/src/com/ibm/as400/access/SQLVarcharForBitData.java deleted file mode 100644 index 291e3f676..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLVarcharForBitData.java +++ /dev/null @@ -1,665 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLVarcharForBitData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -final class SQLVarcharForBitData -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private static final byte[] default_ = new byte[0]; // @C2A - - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private byte[] value_; - - SQLVarcharForBitData(int maxLength, SQLConversionSettings settings) - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = default_; // @C2C - } - - public Object clone() - { - return new SQLVarcharForBitData(maxLength_, settings_); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - AS400ByteArray typeConverter = new AS400ByteArray(length_); - value_ = (byte[])typeConverter.toObject(rawBytes, offset+2); - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) //@P0C - throws SQLException - { - AS400ByteArray typeConverter = new AS400ByteArray(length_); - BinaryConverter.unsignedShortToByteArray(length_, rawBytes, offset); - typeConverter.toBytes(value_, rawBytes, offset + 2); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - if(object instanceof String) - { - try - { - value_ = BinaryConverter.stringToBytes((String)object); //@F1A - } - catch(NumberFormatException nfe) - { - // the String contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else if(object instanceof byte[]) - value_ = (byte[])object; // @C1C - - else if(object instanceof InputStream) - { - //value_ = JDUtilities.streamToBytes((InputStream)object, scale); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)object; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - value_ = baos.toByteArray(); - - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(object instanceof Reader) - { - // value_ = BinaryConverter.stringToBytes(JDUtilities.readerToString((Reader)object, scale)); - - int length = scale; // hack to get the length into the set method - if(length >= 0) - { - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - stream.close(); //@scan1 - - if(value_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HexReaderInputStream stream = new HexReaderInputStream((Reader)object); - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - value_ = baos.toByteArray(); - stream.close(); //@scan1 - - } - catch(ExtendedIOException eie) - { - // the Reader contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Blob) - value_ = ((Blob)object).getBytes(1, (int)((Blob)object).length()); // @C1C @E2C Blobs are 1 based. - - else if(JDUtilities.JDBCLevel_ >= 20 && object instanceof Clob) - { - try - { - value_ = BinaryConverter.stringToBytes(((Clob)object).getSubString(1, (int)((Clob)object).length())); //@F1A - } - catch(NumberFormatException nfe) - { - // the Clob contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - } - } - - else - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - // Truncate if necessary. - int valueLength = value_.length; - if(valueLength > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(value_, 0, newValue, 0, maxLength_); - value_ = newValue; - truncated_ = valueLength - maxLength_; - } - else - truncated_ = 0; - - length_ = value_.length; - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.VARCHAR_FOR_BIT_DATA; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_ ; - } - - //@F2A JDBC 3.0 - public String getJavaClassName() - { - return "[B"; - } - - public String getLiteralPrefix() - { - return "X\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "VARCHAR() FOR BIT DATA"; //@KKB changed from VARCHAR - } - - public int getMaximumPrecision() - { - return 32739; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 448; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.VARBINARY; - } - - public String getTypeName() - { - return "VARCHAR() FOR BIT DATA"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - - // changed to return stream containing hex string - // return new ByteArrayInputStream(toBytes()); - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return new ByteArrayInputStream(getBytes()); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - byte[] bytes = getBytes(); - return new AS400JDBCBlob(bytes, bytes.length); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length - maxFieldSize; - byte[] truncatedValue = new byte[maxFieldSize]; - System.arraycopy(value_, 0, truncatedValue, 0, maxFieldSize); - return truncatedValue; - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - //@F1D return new StringReader(new String(getBytes())); - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); //@F1A - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - //@F1D return new AS400JDBCClob(new String(getBytes())); - String string = BinaryConverter.bytesToHexString(getBytes()); - return new AS400JDBCClob(string, string.length()); //@F1A - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - return getBytes(); - } - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - //@F1D return new String(getBytes()); - return BinaryConverter.bytesToHexString(getBytes()); //@F1A - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getBytes(), since it will - // handle truncating to the max field size if needed. - - // changed to return stream containing hex string - // return new ByteArrayInputStream(getBytes()); - try - { - return new ByteArrayInputStream(ConvTable.getTable(13488, null).stringToByteArray(BinaryConverter.bytesToHexString(getBytes()))); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return new StringReader(BinaryConverter.bytesToHexString(getBytes())); - } - -/* ifdef JDBC40 - //@PDA jdbc40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new AS400JDBCNClob(BinaryConverter.bytesToHexString(getBytes()), maxLength_); - } -endif */ - - //@PDA jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - - // This is written in terms of toBytes(), since it will - // handle truncating to the max field size if needed. - return BinaryConverter.bytesToHexString(getBytes()); - } - -/* ifdef JDBC40 - //@PDA jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@PDA jdbc40 - public SQLXML getSQLXML() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -endif */ - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLVargraphic.java b/cvsroot/src/com/ibm/as400/access/SQLVargraphic.java deleted file mode 100644 index 8db7375ca..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLVargraphic.java +++ /dev/null @@ -1,710 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLVargraphic.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.net.URL; - -final class SQLVargraphic -implements SQLData -{ - static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Private data. - private SQLConversionSettings settings_; - private int length_; - private int maxLength_; - private int truncated_; - private String value_; - private int ccsid_; //@cca1 - - // Note: maxLength is in bytes not counting 2 for LL. - // - SQLVargraphic(int maxLength, SQLConversionSettings settings, int ccsid) //@cca1 - { - settings_ = settings; - length_ = 0; - maxLength_ = maxLength; - truncated_ = 0; - value_ = ""; - ccsid_ = ccsid; //@cca1 - } - - public Object clone() - { - return new SQLVargraphic(maxLength_, settings_, ccsid_); //@cca1 - } - - // Added method trim() to trim the string. - public void trim() - { - value_ = value_.trim(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - length_ = BinaryConverter.byteArrayToUnsignedShort(rawBytes, offset); - - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - // If the field is VARGRAPHIC, length_ contains the number - // of characters in the string, while the converter is expecting - // the number of bytes. Thus, we need to multiply length_ by 2. - value_ = ccsidConverter.byteArrayToString(rawBytes, offset+2, length_*2, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - } - - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - try - { - int bidiStringType = settings_.getBidiStringType(); - // if bidiStringType is not set by user, use ccsid to get value - if(bidiStringType == -1) - bidiStringType = ccsidConverter.bidiStringType_; - - BidiConversionProperties bidiConversionProperties = new BidiConversionProperties(bidiStringType); //@KBA - bidiConversionProperties.setBidiImplicitReordering(settings_.getBidiImplicitReordering()); //@KBA - bidiConversionProperties.setBidiNumericOrderingRoundTrip(settings_.getBidiNumericOrdering()); //@KBA - - // The length in the first 2 bytes is actually the length in characters. - byte[] temp = ccsidConverter.stringToByteArray(value_, bidiConversionProperties); //@KBC changed to use bidiConversionProperties instead of bidiStringType - BinaryConverter.unsignedShortToByteArray(temp.length/2, rawBytes, offset); - - if(temp.length > maxLength_) - { - maxLength_ = temp.length; - JDError.throwSQLException(this, JDError.EXC_INTERNAL); - } - System.arraycopy(temp, 0, rawBytes, offset+2, temp.length); - - // The buffer we are filling with data is big enough to hold the entire field. - // For varchar fields the actual data is often smaller than the field width. - // That means whatever is in the buffer from the previous send is sent to the - // system. The data stream includes actual data length so the old bytes are not - // written to the database, but the junk left over may decrease the effectiveness - // of compression. The following code will write hex 0s to the buffer when - // actual length is less that field length. Note the 0s are written only if - // the field length is pretty big. The data stream code (DBBaseRequestDS) - // does not compress anything smaller than 1K. - if((maxLength_ > 256) && (maxLength_ - temp.length > 16)) - { - int stopHere = offset + 2 + maxLength_; - for(int i=offset + 2 + temp.length; i= 20 && object instanceof Clob) - { - Clob clob = (Clob)object; - value = clob.getSubString(1, (int)clob.length()); - } - /* ifdef JDBC40 - else if(object instanceof SQLXML) //@PDA jdbc40 - { - SQLXML xml = (SQLXML)object; - value = xml.getString(); - } - endif */ - if(value == null) - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - - value_ = value; - - // Truncate if necessary. - int valueLength = value_.length(); - - int truncLimit = maxLength_ / 2; - - if(valueLength > truncLimit) - { - value_ = value_.substring(0, truncLimit); - truncated_ = valueLength - truncLimit; - } - else - truncated_ = 0; - - length_ = value_.length(); - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.VARGRAPHIC; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - if(ccsid_ == 65535) //@bingra - return maxLength_; //@bingra - else - return maxLength_ / 2; - } - - // JDBC 3.0 - public String getJavaClassName() - { - return "java.lang.String"; - } - - public String getLiteralPrefix() - { - return "\'"; - } - - public String getLiteralSuffix() - { - return "\'"; - } - - public String getLocalName() - { - return "VARGRAPHIC"; - } - - public int getMaximumPrecision() - { - return 16369; - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 464; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { - return java.sql.Types.VARCHAR; - } - - public String getTypeName() - { - if( ccsid_ == 13488 || ccsid_ == 1200) //@cca1 - return "NVARCHAR"; //@cca1 same as native - - return "VARGRAPHIC"; - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return value_.length(); - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(getString())); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - truncated_ = 0; - try - { - BigDecimal bigDecimal = new BigDecimal(SQLDataFactory.convertScientificNotation(getString())); // @F3C - if(scale >= 0) - { - if(scale >= bigDecimal.scale()) - { - truncated_ = 0; - return bigDecimal.setScale(scale); - } - else - { - truncated_ = bigDecimal.scale() - scale; - return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP); - } - } - else - return bigDecimal; - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return null; - } - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new HexReaderInputStream(new StringReader(getString())); - } - - public Blob getBlob() - throws SQLException - { - truncated_ = 0; - try - { - byte[] bytes = BinaryConverter.stringToBytes(getString()); - return new AS400JDBCBlob(bytes, bytes.length); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public boolean getBoolean() - throws SQLException - { - truncated_ = 0; - - // If value equals "true" or "false", then return the - // corresponding boolean, otherwise an empty string is - // false, a non-empty string is true. - String trimmedValue = getString().trim(); - return((trimmedValue.length() > 0) - && (! trimmedValue.equalsIgnoreCase("false")) - && (! trimmedValue.equals("0"))); - } - - public byte getByte() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).byteValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public byte[] getBytes() - throws SQLException - { - truncated_ = 0; - try - { - return BinaryConverter.stringToBytes(getString()); - } - catch(NumberFormatException nfe) - { - // this field contains non-hex characters - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - return null; - } - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getString()); - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - String string = getString(); - return new AS400JDBCClob(string, string.length()); - } - - public Date getDate(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLDate.stringToDate(getString(), settings_, calendar); - } - - public double getDouble() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).doubleValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public float getFloat() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).floatValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public int getInt() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).intValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public long getLong() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).longValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public Object getObject() - throws SQLException - { - truncated_ = 0; - // This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - return getString(); - } - - public short getShort() - throws SQLException - { - truncated_ = 0; - - try - { - return(new Double(getString().trim())).shortValue(); - } - catch(NumberFormatException e) - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, e); - return -1; - } - } - - public String getString() - throws SQLException - { - truncated_ = 0; - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. @B1A - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - // @B1D truncated_ = value_.length() - maxFieldSize; - return value_.substring(0, maxFieldSize); - } - else - { - // @B1D truncated_ = 0; - return value_; - } - } - - public Time getTime(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTime.stringToTime(getString(), settings_, calendar); - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - truncated_ = 0; - if(calendar == null) //@dat1 - { - //getter methods do not enforce strict conversion - calendar = Calendar.getInstance(); //@dat1 - } - return SQLTimestamp.stringToTimestamp(getString(), calendar); - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - return new ReaderInputStream(new StringReader(getString()), 13488); - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - //@pda jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - return new StringReader(getNString()); - } - - /* ifdef JDBC40 - //@pda jdbc40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - // This is written in terms of getNString(), since it will - // handle truncating to the max field size if needed. - String string = getNString(); - return new AS400JDBCNClob(string, string.length()); - } - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - // Truncate to the max field size if needed. - // Do not signal a DataTruncation per the spec. - int maxFieldSize = settings_.getMaxFieldSize(); - if((value_.length() > maxFieldSize) && (maxFieldSize > 0)) - { - return value_.substring(0, maxFieldSize); - } - else - { - return value_; - } - } - - /* ifdef JDBC40 - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - // - //truncated_ = 0; - //try - //{ - // return new AS400JDBCRowId(BinaryConverter.stringToBytes(value_)); - //} - //catch(NumberFormatException nfe) - //{ - // // this string contains non-hex characters - // JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, nfe); - // return null; - //} - //decided this is of no use - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@pda jdbc40 - public SQLXML getSQLXML() throws SQLException - { - //This is written in terms of getString(), since it will - // handle truncating to the max field size if needed. - truncated_ = 0; - return new AS400JDBCSQLXML(getString().toCharArray()); - } - endif */ - - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SQLXMLLocator.java b/cvsroot/src/com/ibm/as400/access/SQLXMLLocator.java deleted file mode 100644 index b5d754257..000000000 --- a/cvsroot/src/com/ibm/as400/access/SQLXMLLocator.java +++ /dev/null @@ -1,1200 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLXMLLocator.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2009-2009 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -import java.sql.Types; -/* ifdef JDBC40 -import java.sql.NClob; -import java.sql.RowId; -endif */ -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.SQLXML; -endif */ - -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; - -//@xml3 new class -//sending xml to host, this class acts like BlobLocator -//reading xml from host, this class acts like ClobLocator -final class SQLXMLLocator implements SQLLocator -{ - static final String copyright = "Copyright (C) 1997-2006 International Business Machines Corporation and others."; - - private AS400JDBCConnection connection_; - //writing to host, we let host do all the conversion - //reading from host, we do all the conversion - private ConvTable converter_; //used when reading from host - private ConvTable unicodeConverter_; //1200 unicode to simulate no conversion //used when writing to host - private ConvTable unicodeUtf8Converter_; //1208 when no XML declaration //@xmlutf8 - private int id_; - private JDLobLocator locator_; - private int maxLength_; - private SQLConversionSettings settings_; - private int truncated_; - private int columnIndex_; - private byte[] valueBlob_; //@loch //Note that value_ is not used as the output for a ResultSet.getX() call. We Get the value from a call to the JDLocator (not from value_) and not from the savedObject_, unless resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - private String valueClob_; - - private Object savedObject_; // This is the AS400JDBCXMLLocator or InputStream or whatever got set into us. - private int scale_; // This is actually the length that got set into us. - private int xmlType_; //@xml3 0=SB 1=DB 2=binary XML - - SQLXMLLocator(AS400JDBCConnection connection, - int id, - int maxLength, - SQLConversionSettings settings, - ConvTable converter, - int columnIndex, - int xmlType) //@xml3 - { - connection_ = connection; - maxLength = AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; //@xml3 //for xml, length is unknown. use max for single byte lobs since xml is returned via bloblocator - id_ = id; - if(xmlType == 1) - locator_ = new JDLobLocator(connection, id, maxLength, false); //DB //@xmlgraphic (xml is always sent with bytecount) - else - locator_ = new JDLobLocator(connection, id, maxLength, false); //SB - maxLength_ = maxLength; - settings_ = settings; - truncated_ = 0; - converter_ = converter; - columnIndex_ = columnIndex; - xmlType_ = xmlType; //@xml3 0=SB 1=DB 2=binary XML - try{ - //Since we want to pass string's bytes as 1200 (java default for String) - //But if XML does not have a declaration then hostserver expects 1208 - unicodeConverter_ = connection.getConverter(1200); - unicodeUtf8Converter_ = connection.getConverter(1208); //@xmlutf8 - }catch(SQLException e){ - unicodeConverter_ = connection.converter_;//should never happen - } - } - - public Object clone() - { - return new SQLXMLLocator(connection_, id_, maxLength_, settings_, converter_, columnIndex_, xmlType_); //@xml3 - } - - public void setHandle(int handle) - { - locator_.setHandle(handle); - } - - public int getHandle() - { - return locator_.getHandle(); - } - - //---------------------------------------------------------// - // // - // CONVERSION TO AND FROM RAW BYTES // - // // - //---------------------------------------------------------// - - public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - int locatorHandle = BinaryConverter.byteArrayToInt(rawBytes, offset); - locator_.setHandle(locatorHandle); - locator_.setColumnIndex(columnIndex_); - } - - //This is only called from AS400JDBCPreparedStatement in one place. - public void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) - throws SQLException - { - BinaryConverter.intToByteArray(locator_.getHandle(), rawBytes, offset); - - // Now we write our saved data to the system, because the prepared statement is being executed. - // We used to write the data to the system on the call to set(), but this messed up - // batch executes, since the host server only reserves temporary space for locator handles one row at a time. - // See the toObject() method in this class for more details. - if(savedObject_ != null) writeToServer(); - } - - //---------------------------------------------------------// - // // - // SET METHODS // - // // - //---------------------------------------------------------// - - // This method actually writes the data to the system. - private void writeToServer() - throws SQLException - { - if(savedObject_ instanceof byte[]) - { - byte[] bytes = (byte[])savedObject_; - locator_.writeData(0, bytes, true); - } - else if(savedObject_ instanceof InputStream) - { - int length = scale_; // hack to get the length into the set method - //if(xmlType_ == 1) - // length *=2; //double-byte - - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); - } - else if(length > 0) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - if(xmlType_ == 1) - locator_.writeData(totalBytesRead/2, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. - else - locator_.writeData(totalBytesRead, byteBuffer, 0, bytesRead, true); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - if(totalBytesRead < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)savedObject_; - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 ) - { - if(xmlType_ == 1) - locator_.writeData(totalBytesRead/2, byteBuffer, 0, bytesRead, true); // totalBytesRead is our offset. - else - locator_.writeData(totalBytesRead, byteBuffer, 0, bytesRead, true); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if (savedObject_ instanceof Blob) - { - //Start new code for updateable locator case to go through the Vectors - //and update the blob copy when ResultSet.updateBlob() is called. - boolean set = false; - if(savedObject_ instanceof AS400JDBCBlobLocator) - { - AS400JDBCBlobLocator blob = (AS400JDBCBlobLocator)savedObject_; - - //Synchronize on a lock so that the user can't keep making updates - //to the blob while we are taking updates off the vectors. - synchronized(blob) - { - // See if we saved off our real object from earlier. - if(blob.savedObject_ != null) - { - savedObject_ = blob.savedObject_; - scale_ = blob.savedScale_; - blob.savedObject_ = null; - writeToServer(); - return; - } - } - } - - //If the code for updateable lob locators did not run, then run old code. - if(!set) - { - Blob blob = (Blob)savedObject_; - int length = (int)blob.length(); - byte[] data = blob.getBytes(1, length); - locator_.writeData(0, data, 0, length, true); - } - } - else if(savedObject_ instanceof String) - { - String string = (String)savedObject_; - byte[] bytes; - if(JDUtilities.hasXMLDeclaration(string)) //@xmlutf8 - { - string = JDUtilities.handleXMLDeclarationEncoding(string); //if encoding is non utf-16 then remove to match Java Strings //@xmlutf16 - bytes = unicodeConverter_.stringToByteArray(string); //just get bytes - } - else //@xmlutf8 - bytes = unicodeUtf8Converter_.stringToByteArray(string); //@xmlutf8 - locator_.writeData(0L, bytes, true); - } - else if(savedObject_ instanceof Reader) - { - int length = scale_; // hack to get the length into the set method - // Need to write even if there are 0 bytes in case we are batching and - // the host server reuses the same handle for the previous locator; otherwise, - // we'll have data in the current row from the previous row. - if (length == 0) - { - locator_.writeData(0, new byte[0], 0, 0, true); - } - else if(length > 0) - { - //@xmlutf8 (for reader and stream, don't do any conversion) - //@xmlutf8 added code here similar to SQLBlob.set() for Reader input. - byte[] bytes = null; - - try - { - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - //assume reader is utf-8 since setAsciiStream() - ReaderInputStream stream = new ReaderInputStream((Reader)savedObject_, unicodeUtf8Converter_.getCcsid(), null, blockSize); //@xmlreader - - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - bytes = baos.toByteArray(); - - if(bytes.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - int objectLength = bytes.length; - if(bytes.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(bytes, 0, newValue, 0, maxLength_); - bytes = newValue; - } - stream.close(); //@scan1 - locator_.writeData(0, bytes, true); - } - catch(ExtendedIOException eie) - { - // the Reader contains bad chars that can't convert - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - } - else if(length == -2) //@readerlen new else-if block (read all data) - { - byte[] bytes = null; - - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - //assume reader is utf-8 since setAsciiStream() - ReaderInputStream stream = new ReaderInputStream((Reader)savedObject_, unicodeUtf8Converter_.getCcsid(), null, blockSize); //@xmlreader - - byte[] byteBuffer = new byte[blockSize]; - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - - bytes = baos.toByteArray(); - - int objectLength = bytes.length; - if(bytes.length > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(bytes, 0, newValue, 0, maxLength_); - bytes = newValue; - } - stream.close(); //@scan1 - locator_.writeData(0, bytes, true); - } - catch(ExtendedIOException eie) - { - // the Reader contains bad chars that can't convert - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH, eie); - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if( savedObject_ instanceof Clob) //jdbc40 NClob isa Clob - { - //@G5A Start new code for updateable locator case - boolean set = false; - if(savedObject_ instanceof AS400JDBCClobLocator) //@PDA jdbc40 comment: AS400JDBCNClobLocator isa AS400JDBCClobLocator - { - AS400JDBCClobLocator clob = (AS400JDBCClobLocator)savedObject_; - - //Synchronize on a lock so that the user can't keep making updates - //to the clob while we are taking updates off the vectors. - synchronized(clob) - { - // See if we saved off our real object from earlier. - if(clob.savedObject_ != null) - { - savedObject_ = clob.savedObject_; - scale_ = clob.savedScale_; - clob.savedObject_ = null; - writeToServer(); - return; - } - } - } - - //If the code for updateable lob locators did not run, then run old code. - if(!set) - { - Clob clob = (Clob)savedObject_; - int length = (int)clob.length(); - String substring = clob.getSubString(1, length); - byte[] inputBytes; //@len2utf8 - if(JDUtilities.hasXMLDeclaration(substring)) //@xmlutf8 - inputBytes = unicodeConverter_.stringToByteArray(JDUtilities.handleXMLDeclarationEncoding(substring)); //@len2utf8 //here, we have a string, so it has to be in utf-16, so just take out encoding and sq and detect encoding - else - inputBytes = unicodeUtf8Converter_.stringToByteArray(substring); //@len2utf8 - - - locator_.writeData(0L, inputBytes, 0, inputBytes.length, true); //@xmlutf8 - set = true; - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - /* ifdef JDBC40 - else if( savedObject_ instanceof SQLXML ) //@olddesc - { - SQLXML xml = (SQLXML)savedObject_; - - boolean set = false; - if(savedObject_ instanceof AS400JDBCSQLXMLLocator) - { - AS400JDBCSQLXMLLocator xmlLocator = (AS400JDBCSQLXMLLocator)savedObject_; - - //Synchronize on a lock so that the user can't keep making updates - //to the xml while we are taking updates off the vectors. - synchronized(xmlLocator) - { - // See if we saved off our real object from earlier. - if(xmlLocator.clobLocatorValue_ != null && xmlLocator.clobLocatorValue_.savedObject_ != null) - { - savedObject_ = xmlLocator.clobLocatorValue_.savedObject_; - scale_ = xmlLocator.clobLocatorValue_.savedScale_; - xmlLocator.clobLocatorValue_.savedObject_ = null; - writeToServer(); - return; - } - else if(xmlLocator.blobLocatorValue_ != null && xmlLocator.blobLocatorValue_.savedObject_ != null) - { - savedObject_ = xmlLocator.blobLocatorValue_.savedObject_; - scale_ = xmlLocator.blobLocatorValue_.savedScale_; - xmlLocator.blobLocatorValue_.savedObject_ = null; - writeToServer(); - return; - } - } - } - - if(!set) - { - - //getString() handles internal representation of clob/dbclob/blob... - String stringVal = xml.getString(); - byte[] inputBytes; //@len2utf8 - if(JDUtilities.hasXMLDeclaration(stringVal)) //@xmlutf8 - inputBytes = unicodeConverter_.stringToByteArray(JDUtilities.handleXMLDeclarationEncoding(stringVal)); //@len2utf8 //here, we have a string, so it has to be in utf-16, so just take out encoding and sq and detect encoding - else - inputBytes = unicodeUtf8Converter_.stringToByteArray(stringVal); //@len2utf8 - - - locator_.writeData(0L, inputBytes, 0, inputBytes.length, true); //@xmlutf8 - } - } -endif */ - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - - public void set(Object object, Calendar calendar, int scale) - throws SQLException - { - //no need to check truncation since xml does not have size - savedObject_ = object; - if(object instanceof ConvTableReader) //@ascii - { - //set xml flag so ConvTableReader will trim off xml declaration since we will be transmitting in utf-8 - ((ConvTableReader)savedObject_).isXML_ = true; //@ascii - scale_ = -2;//@ascii flag -2 to read to end of stream (xml transmits in utf8 which may have 2-byte chars, which does not match length) - } - else if(scale != -1) - scale_ = scale; // Skip resetting it if we don't know the real length - } - - //Method to temporary convert from object input to output before even going to host (writeToServer() does the conversion needed before writing to host) - //This will only be used when resultSet.updateX(obj1) is called followed by a obj2 = resultSet.getX() - //Purpose is to do a local type conversion from obj1 to obj2 like other non-locator lob types - private void doConversion() - throws SQLException - { - valueClob_ = null; - valueBlob_ = null; - int length_ = scale_; - - if( length_ == -1) - { - try{ - //try to get length from locator - length_ = (int)locator_.getLength(); - }catch(Exception e){ } - } - - try - { - - if(savedObject_ instanceof String) - { - valueClob_ = (String)savedObject_; - - } - else if(savedObject_ instanceof Reader) - { - if(length_ >= 0) - { - try - { - int blockSize = length_ < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length_ : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)savedObject_; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1 && totalCharsRead < length_) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - int charsRemaining = length_ - totalCharsRead; - if(charsRemaining < blockSize) - { - blockSize = charsRemaining; - } - charsRead = stream.read(charBuffer, 0, blockSize); - } - valueClob_ = buf.toString(); - - if(valueClob_.length() < length_) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else if(length_ == -2) //@readerlen new else-if block (read all data) - { - try - { - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - Reader stream = (Reader)savedObject_; - StringBuffer buf = new StringBuffer(); - char[] charBuffer = new char[blockSize]; - int totalCharsRead = 0; - int charsRead = stream.read(charBuffer, 0, blockSize); - while(charsRead > -1) - { - buf.append(charBuffer, 0, charsRead); - totalCharsRead += charsRead; - - charsRead = stream.read(charBuffer, 0, blockSize); - } - valueClob_ = buf.toString(); - - } - catch(IOException ie) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, ie); - } - } - else - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else if( savedObject_ instanceof Clob) - { - Clob clob = (Clob)savedObject_; - valueClob_ = clob.getSubString(1, (int)clob.length()); - } - else if(savedObject_ instanceof byte[]) - { - valueBlob_ = (byte[]) savedObject_; - int objectLength = valueBlob_.length; - if(objectLength > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(valueBlob_, 0, newValue, 0, maxLength_); - valueBlob_ = newValue; - } - //xml has no max size truncated_ = objectLength - valueBlob_.length; - } - else if(savedObject_ instanceof Blob) - { - Blob blob = (Blob) savedObject_; - int blobLength = (int)blob.length(); - int lengthToUse = blobLength < 0 ? 0x7FFFFFFF : blobLength; - if(lengthToUse > maxLength_) lengthToUse = maxLength_; - valueBlob_ = blob.getBytes(1, lengthToUse); - //xml has no max sizetruncated_ = blobLength - lengthToUse; - } - else if(savedObject_ instanceof InputStream) - { - int length = scale_; - if(length >= 0) - { - InputStream stream = (InputStream)savedObject_; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = length < AS400JDBCPreparedStatement.LOB_BLOCK_SIZE ? length : AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1 && totalBytesRead < length) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - int bytesRemaining = length - totalBytesRead; - if(bytesRemaining < blockSize) - { - blockSize = bytesRemaining; - } - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - - valueBlob_ = baos.toByteArray(); - - if(valueBlob_.length < length) - { - // a length longer than the stream was specified - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - } - - int objectLength = valueBlob_.length; - if(objectLength > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(valueBlob_, 0, newValue, 0, maxLength_); - valueBlob_ = newValue; - } - //xml has no max sizetruncated_ = objectLength - valueBlob_.length; - } - else if(length == -2 )//@readerlen new else-if block (read all data) - { - InputStream stream = (InputStream)savedObject_; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int blockSize = AS400JDBCPreparedStatement.LOB_BLOCK_SIZE; - byte[] byteBuffer = new byte[blockSize]; - try - { - int totalBytesRead = 0; - int bytesRead = stream.read(byteBuffer, 0, blockSize); - while(bytesRead > -1) - { - baos.write(byteBuffer, 0, bytesRead); - totalBytesRead += bytesRead; - - bytesRead = stream.read(byteBuffer, 0, blockSize); - } - } - catch(IOException ie) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, ie); - } - - valueBlob_ = baos.toByteArray(); - - int objectLength = valueBlob_.length; - if(objectLength > maxLength_) - { - byte[] newValue = new byte[maxLength_]; - System.arraycopy(valueBlob_, 0, newValue, 0, maxLength_); - valueBlob_ = newValue; - } - //xml has no max sizetruncated_ = objectLength - valueBlob_.length; - } - /* ifdef JDBC40 - else if( savedObject_ instanceof SQLXML ) - { - SQLXML xml = (SQLXML)savedObject_; - valueClob_ = xml.getString(); - } - endif */ - else - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - } - else - { - JDError.throwSQLException(JDError.EXC_DATA_TYPE_MISMATCH); - } - } - finally - { - //nothing - } - } - - //---------------------------------------------------------// - // // - // DESCRIPTION OF SQL TYPE // - // // - //---------------------------------------------------------// - - public int getSQLType() - { - return SQLData.XML_LOCATOR; - } - - public String getCreateParameters() - { - return AS400JDBCDriver.getResource("MAXLENGTH"); - } - - public int getDisplaySize() - { - return maxLength_; - } - - public String getJavaClassName() - { - return "com.ibm.as400.access.AS400JDBCSQLXML"; - } - - public String getLiteralPrefix() - { - return null; - } - - public String getLiteralSuffix() - { - return null; - } - - public String getLocalName() - { - return "XML"; - } - - public int getMaximumPrecision() - { -/*ifdef JDBC40 - return AS400JDBCSQLXML.MAX_XML_SIZE; -endif */ -/* ifndef JDBC40 */ - return AS400JDBCDatabaseMetaData.MAX_LOB_LENGTH; -/* endif */ - } - - public int getMaximumScale() - { - return 0; - } - - public int getMinimumScale() - { - return 0; - } - - public int getNativeType() - { - return 2452; - } - - public int getPrecision() - { - return maxLength_; - } - - public int getRadix() - { - return 0; - } - - public int getScale() - { - return 0; - } - - public int getType() - { -/*ifdef JDBC40 - return Types.SQLXML; -endif */ -/* ifndef JDBC40 */ - return Types.CLOB; -/* endif */ - } - - public String getTypeName() - { - return "XML"; - - } - - public boolean isSigned() - { - return false; - } - - public boolean isText() - { - return true; - } - - public int getActualSize() - { - return maxLength_; - } - - public int getTruncated() - { - return truncated_; - } - - //---------------------------------------------------------// - // // - // CONVERSIONS TO JAVA TYPES // - // // - //---------------------------------------------------------// - - public InputStream getAsciiStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new ByteArrayInputStream(ConvTable.getTable(819, null).stringToByteArray(valueClob_));//@loch - } //@loch - //remove xml declaration via ConvTableReader - Reader tmpUnicodeReader = new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid(), true); - // tmpUnicodeReader. - return new ReaderInputStream(tmpUnicodeReader, 819); // ISO-8859-1. //is xml type - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public BigDecimal getBigDecimal(int scale) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getBinaryStream() - throws SQLException - { - truncated_ = 0; - return new AS400JDBCInputStream(new JDLobLocator(locator_)); - } - - public Blob getBlob() - throws SQLException - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCBlob(valueBlob_, maxLength_); //@loch - } //@loch - - // We don't want to give out our internal locator to the public, - // otherwise when we go to change its handle on the next row, they'll - // get confused. So we have to clone it. - truncated_ = 0; - return new AS400JDBCBlobLocator(new JDLobLocator(locator_), savedObject_, scale_); - } - - public boolean getBoolean() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return false; - } - - public byte getByte() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public byte[] getBytes() - throws SQLException - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return valueBlob_;//@loch - } //@loch - - int locatorLength = (int)locator_.getLength(); - if(locatorLength == 0) return new byte[0]; - DBLobData data = locator_.retrieveData(0, locatorLength); - int actualLength = data.getLength(); - byte[] bytes = new byte[actualLength]; - System.arraycopy(data.getRawBytes(), data.getOffset(), bytes, 0, actualLength); - truncated_ = 0; - return bytes; - } - - public Reader getCharacterStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new StringReader(valueClob_); //@loch - } //@loch - //remove xml declaration via ConvTableReader - return new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid(), true); //@xml4 - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - public Clob getClob() - throws SQLException - { - truncated_ = 0; - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCClob(valueClob_, maxLength_); //@loch - } //@loch - - return new AS400JDBCClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_, true);//@xml4 - } - - public Date getDate(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public double getDouble() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public float getFloat() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public int getInt() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public long getLong() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public Object getObject() - throws SQLException - { - // toObject is used by AS400JDBCPreparedStatement for batching, so we save off our InputStream - // inside the AS400JDBCBlobLocator. Then, when convertToRawBytes() is called, the writeToServer() - // code checks the AS400JDBCBlobLocator's saved InputStream... if it exists, then it writes the - // data out of the InputStream to the system by calling writeToServer() again. - - // Since toObject could also be called from an external user's standpoint, we have - // to clone our internal locator (because we reuse it internally). - // This doesn't make much sense, since we technically can't reuse it because - // the prepared statement is calling toObject() to store off the parameters, - // but it's all we can do for now. - truncated_ = 0; - /* ifdef JDBC40 - if(savedObject_ != null)//@xmlupdate //either return savedObject_ here, or add two iterations of getting savedObject_ in writeToServer if type is AS400JDBCSQLXML since it contains clob which contains savedObject_ - return savedObject_; //@xmlupdate - return new AS400JDBCSQLXMLLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_, true); //@xml4 - - endif */ - /* ifndef JDBC40 */ - return getClob(); //@xml4 - /* endif */ - } - - - public short getShort() - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return -1; - } - - public String getString() - throws SQLException - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return valueClob_; //@loch - } //@loch - - DBLobData data = locator_.retrieveData(0, locator_.getMaxLength()); - String value = converter_.byteArrayToString(data.getRawBytes(), - data.getOffset(), - data.getLength()); - value = JDUtilities.stripXMLDeclaration(value); //remove xml declaration - truncated_ = 0; - return value; - } - - public Time getTime(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public Timestamp getTimestamp(Calendar calendar) - throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - public InputStream getUnicodeStream() - throws SQLException - { - truncated_ = 0; - try - { - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new ReaderInputStream(new StringReader(valueClob_), 13488); //@loch - } //@loch - - //remove xml declaration via ConvTableReader - return new ReaderInputStream(new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid(), true), 13488); //@xml4 - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(JDError.EXC_INTERNAL, e); - return null; - } - } - - //@PDA jdbc40 - public Reader getNCharacterStream() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new StringReader(valueClob_); //@loch - } //@loch - - try - { - //remove xml declaration via ConvTableReader - return new ConvTableReader(new AS400JDBCInputStream(new JDLobLocator(locator_)), converter_.getCcsid(), true); //@xml4 - } - catch(UnsupportedEncodingException e) - { - JDError.throwSQLException(this, JDError.EXC_INTERNAL, e); - return null; - } - } - - /* ifdef JDBC40 - //@pda jdbc40 - public NClob getNClob() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return new AS400JDBCNClob(valueClob_, maxLength_); //@loch - } //@loch - - return new AS400JDBCNClobLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_, true); //@xml4 - - } - endif */ - - //@pda jdbc40 - public String getNString() throws SQLException - { - truncated_ = 0; - - if(savedObject_ != null)//@loch - { //@loch - //get value from RS.updateX(value) - doConversion(); //@loch - truncated_ = 0; //@loch - return valueClob_; //@loch - } //@loch - - DBLobData data = locator_.retrieveData(0, locator_.getMaxLength()); - String value = converter_.byteArrayToString(data.getRawBytes(), - data.getOffset(), - data.getLength()); - value = JDUtilities.stripXMLDeclaration(value); //remove xml declaration - return value; - } - -/* ifdef JDBC40 - //@pda jdbc40 - public RowId getRowId() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } - - //@PDA jdbc40 - public SQLXML getSQLXML() throws SQLException - { - truncated_ = 0; - //xml data is always retrieved from host in binary 65535 format - //may or maynot need converter depending on how user gets data from SQLXML - //return xmllocator which will treat data as cloblocator and do conversion - //@xml3 if xml column, remove xml declaration from within internal cloblocator inside of sqlxmllocator. - return new AS400JDBCSQLXMLLocator(new JDLobLocator(locator_), converter_, savedObject_, scale_, true); //@xml4 - } -endif */ - - - // @array - public Array getArray() throws SQLException - { - JDError.throwSQLException(this, JDError.EXC_DATA_TYPE_MISMATCH); - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SSLOptions.java b/cvsroot/src/com/ibm/as400/access/SSLOptions.java deleted file mode 100644 index 294ec89e6..000000000 --- a/cvsroot/src/com/ibm/as400/access/SSLOptions.java +++ /dev/null @@ -1,32 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SSLOptions.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; - -// Class to move SSL configuration options from proxy client to proxy server. -class SSLOptions implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - static final long serialVersionUID = 4L; - // Package and class name of key ring object, initialized to default. - String keyRingName_ = "com.ibm.as400.access.KeyRing"; - // Password for keyring class, initialized to default. - String keyRingPassword_ = "toolbox"; - // Data from keyring class. - String keyRingData_ = null; - // Legs of proxy server communications that should be encrypted. Default is to encrypt all legs. - int proxyEncryptionMode_ = SecureAS400.CLINT_TO_SERVER; - boolean useSslight_ = false; -} diff --git a/cvsroot/src/com/ibm/as400/access/SSTS0100Format.java b/cvsroot/src/com/ibm/as400/access/SSTS0100Format.java deleted file mode 100644 index 8e7c34a46..000000000 --- a/cvsroot/src/com/ibm/as400/access/SSTS0100Format.java +++ /dev/null @@ -1,40 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: SSTS0100Format.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class SSTS0100Format extends SystemStatusFormat -{ - static final long serialVersionUID = 4L; - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - SSTS0100Format(AS400 sys) - { - super(sys); - setName("SSTS0100"); - addBin4("usersCurrentlySignedOn"); - addBin4("usersTemporarilySignedOff"); - addBin4("usersSuspendedBySystemRequest"); - addBin4("usersSuspendedByGroupJobs"); - addBin4("usersSignedOffWithPrinterOutputWaitingToPrint"); - addBin4("batchJobsWaitingForMessages"); - addBin4("batchJobsRunning"); - addBin4("batchJobsHeldWhileRunning"); - addBin4("batchJobsEnding"); - addBin4("batchJobsWaitingToRunOrAlreadyScheduled"); - addBin4("batchJobsHeldOnAJobQueue"); - addBin4("batchJobsOnAHeldJobQueue"); - addBin4("batchJobsOnAnUnassignedJobQueue"); - addBin4("batchJobsEndedWithPrinterOutputWaitingToPrint"); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SSTS0200Format.java b/cvsroot/src/com/ibm/as400/access/SSTS0200Format.java deleted file mode 100644 index fbc235778..000000000 --- a/cvsroot/src/com/ibm/as400/access/SSTS0200Format.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: SSTS0200Format.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class SSTS0200Format extends SystemStatusFormat -{ - static final long serialVersionUID = 4L; - - SSTS0200Format(AS400 sys) - { - super(sys); - setName("SSTS0200"); - addChar(6, "elapsedTime"); - addChar(1, "restrictedStateFlag"); - addChar(1, "reserved"); - addBin4("percentProcessingUnitUsed"); - addBin4("jobsInSystem"); - addBin4("percentPermanentAddresses"); - addBin4("percentTemporaryAddresses"); - addBin4("systemASP"); - addBin4("percentSystemASPUsed"); - addBin4("totalAuxiliaryStorage"); - addBin4("currentUnprotectedStorageUsed"); - addBin4("maximumUnprotectedStorageUsed"); - addBin4("percentDBCapability"); - addBin4("mainStorageSize"); - addBin4("numberOfPartitions"); - addBin4("partitionIdentifier"); - addBin4("reserved1"); - addBin4("currentProcessingCapacity"); - addChar(1, "processorSharingAttribute"); - addChar(3, "reserved2"); - addBin4("numberOfProcessors"); - addBin4("activeJobsInSystem"); - addBin4("activeThreadsInSystem"); - addBin4("maximumJobsInSystem"); - addBin4("percentTemporary256MBSegmentsUsed"); - addBin4("percentTemporary4GBSegmentsUsed"); - addBin4("percentPermanent256MBSegmentsUsed"); - addBin4("percentPermanent4GBSegmentsUsed"); - addBin4("percentCurrentInteractivePerformance"); - addBin4("percentUncappedCPUCapacityUsed"); - addBin4("percentSharedProcessorPoolUsed"); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SSTS0300Format.java b/cvsroot/src/com/ibm/as400/access/SSTS0300Format.java deleted file mode 100644 index b3648cfb7..000000000 --- a/cvsroot/src/com/ibm/as400/access/SSTS0300Format.java +++ /dev/null @@ -1,33 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: SSTS0300Format.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class SSTS0300Format extends SystemStatusFormat -{ - static final long serialVersionUID = 4L; - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - SSTS0300Format(AS400 sys) - { - super(sys); - setName("SSTS0300"); - addChar(6, "elapsedTime"); - addChar(2, "reserved"); - addBin4("numberOfPools"); - addBin4("offsetToPoolInformation"); - addBin4("lengthOfPoolInformationEntry"); - // The rest of this format is dynamic depending on - // the above 3 fields and must be built at runtime. - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SSTS0400Format.java b/cvsroot/src/com/ibm/as400/access/SSTS0400Format.java deleted file mode 100644 index 82fab8e46..000000000 --- a/cvsroot/src/com/ibm/as400/access/SSTS0400Format.java +++ /dev/null @@ -1,38 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: SSTS0400Format.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -class SSTS0400Format extends SystemStatusFormat -{ - static final long serialVersionUID = 4L; - private static final String copyright = "Copyright (C) 2007-2007 International Business Machines Corporation and others."; - - // Design note: Whereas the SSTS0300 format returns info on _active_ pools only, this format returns info on _all_ pools (active or inactive). - SSTS0400Format(AS400 sys) - { - super(sys); - setName("SSTS0400"); - addChar(6, "elapsedTime"); - addChar(2, "reserved"); - addBin4("mainStorageSize"); - addBin4("minimumMachinePoolSize"); - addBin4("minimumBasePoolSize"); - addBin4("numberOfPools"); - addBin4("offsetToPoolInformation"); - addBin4("lengthOfPoolInformationEntry"); - addBin8("mainStorageSize"); - // The rest of this format is dynamic depending on - // the above fields and must be built at runtime. - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SVMRI.java b/cvsroot/src/com/ibm/as400/access/SVMRI.java deleted file mode 100644 index f6ffe2720..000000000 --- a/cvsroot/src/com/ibm/as400/access/SVMRI.java +++ /dev/null @@ -1,296 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SVMRI.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.ListResourceBundle; - -/** - Locale-specific objects for IBM Toolbox for Java. - **/ -public class SVMRI extends ListResourceBundle -{ - // NLS_MESSAGEFORMAT_NONE - // Each string is assumed NOT to be processed by the MessageFormat class. - // This means that a single quote must be coded as 1 single quote. - - // NLS_ENCODING=UTF-8 - // Instructs the translation tools to interpret the text as UTF-8. - - public Object[][] getContents() - { - return resources; - } - - private static final Object[][] resources = - { - // #TRANNOTE Before you add a new resource, please make - // #TRANNOTE sure you are not duplicating another. The - // #TRANNOTE goal is to keep the amount of translatable - // #TRANNOTE text down. - // #TRANNOTE - // #TRANNOTE NOTE TO TRANSLATORS: The format of a line of MRI - // #TRANNOTE is { "KEY", "value" }, - // #TRANNOTE - // #TRANNOTE The key must be left alone so translate only the value. - // #TRANNOTE - // #TRANNOTE - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for system value's description. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts a short identifier to descript system - // #TRANNOTE value, then a postfix _DES. - // #TRANNOTE - { "QABNORMSW_DES" , "Previous end of system indicator" }, - { "QACGLVL_DES" , "Accounting level" }, - { "QACTJOB_DES" , "Initial number of active jobs" }, - { "QADLACTJ_DES" , "Additional number of active jobs" }, - { "QADLSPLA_DES" , "Spooling control block additional storage" }, - { "QADLTOTJ_DES" , "Additional number of total jobs" }, - { "QALWJOBITP_DES", "Allow jobs to be interrupted" }, // @G1A - { "QALWOBJRST_DES" , "Allow object restore option" }, - { "QALWUSRDMN_DES" , "Allow user domain objects in libraries" }, - { "QASTLVL_DES" , "User assistance level" }, - { "QATNPGM_DES" , "Attention program" }, - { "QAUDCTL_DES" , "Auditing control" }, - { "QAUDENDACN_DES" , "Auditing end action" }, - { "QAUDFRCLVL_DES" , "Force auditing data" }, - { "QAUDLVL_DES" , "Security auditing level" }, - { "QAUDLVL2_DES" , "Enhanced security auditing level" }, //@F1A - { "QAUTOCFG_DES" , "Autoconfigure devices" }, - { "QAUTORMT_DES" , "Autoconfigure of remote controllers" }, - { "QAUTOSPRPT_DES" , "Automatic system disabled reporting" }, - { "QAUTOVRT_DES" , "Autoconfigure virtual devices" }, - { "QBASACTLVL_DES" , "Base storage pool activity level" }, - { "QBASPOOL_DES" , "Base storage pool minimum size" }, - { "QBOOKPATH_DES" , "Book and bookshelf search path" }, - { "QCCSID_DES" , "Coded character set identifier" }, - { "QCENTURY_DES" , "Century" }, - { "QCFGMSGQ_DES" , "Configuration message queue" }, //@D1a - { "QCHRID_DES" , "Graphic character set and code page" }, - { "QCHRIDCTL_DES" , "Character identifier control" }, - { "QCMNARB_DES" , "Comunication arbiters" }, - { "QCMNRCYLMT_DES" , "Communications recovery limits" }, - { "QCNTRYID_DES" , "Country or Region identifier" }, // @D4C - { "QCONSOLE_DES" , "Console name" }, - { "QCRTAUT_DES" , "Create default public authority" }, - { "QCRTOBJAUD_DES" , "Create object auditing" }, - { "QCTLSBSD_DES" , "Controlling subsystem" }, - { "QCURSYM_DES" , "Currency symbol" }, - { "QDATE_DES" , "System date" }, - { "QDATETIME_DES" , "System date and time" }, //@F1A - { "QDATFMT_DES" , "Date format" }, - { "QDATSEP_DES" , "Date separator" }, - { "QDAY_DES" , "Day" }, - { "QDAYOFWEEK_DES" , "Day of week" }, - { "QDBFSTCCOL_DES" , "Database file statistics to collect" }, //@E0A - { "QDBRCVYWT_DES" , "Database recovery wait indicator" }, - { "QDECFMT_DES" , "Decimal format" }, - { "QDEVNAMING_DES" , "Device naming conventions" }, - { "QDEVRCYACN_DES" , "Device I/O error action" }, - { "QDSCJOBITV_DES" , "Time interval before disconnected jobs end" }, - { "QDSPSGNINF_DES" , "Sign-on display information control" }, - { "QDYNPTYADJ_DES" , "Dynamic priority adjustment" }, - { "QDYNPTYSCD_DES" , "Dynamic priority scheduler" }, - { "QENDJOBLMT_DES" , "Time limit during immediate ending of a job" }, //@F1A - { "QFRCCVNRST_DES" , "Force conversion on restore" }, - { "QHOUR_DES" , "Hour of the day" }, - { "QHSTLOGSIZ_DES" , "Maximum history log records" }, - { "QIGC_DES" , "DBCS version installed indicator" }, - { "QIGCCDEFNT_DES" , "Double byte code font" }, - { "QIGCFNTSIZ_DES" , "Double byte coded font point size" }, - { "QINACTITV_DES" , "Inactive job time-out" }, - { "QINACTMSGQ_DES" , "Inactive job message queue" }, - { "QIPLDATTIM_DES" , "Date and time to automatically IPL" }, - { "QIPLSTS_DES" , "IPL status indicator" }, - { "QIPLTYPE_DES" , "Type of IPL to perform" }, - { "QJOBMSGQFL_DES" , "Job message queue full action" }, - { "QJOBMSGQMX_DES" , "Maximum size of job message queue" }, - { "QJOBMSGQSZ_DES" , "Job message queue initial size" }, - { "QJOBMSGQTL_DES" , "Job message queue maximum initial size" }, - { "QJOBSPLA_DES" , "Spooling control block initial size" }, - { "QKBDBUF_DES" , "Type ahead and/or attention key option" }, - { "QKBDTYPE_DES" , "Keyboard language character set" }, - { "QLANGID_DES" , "Language identifier" }, - { "QLEAPADJ_DES" , "Leap year adjustment" }, - { "QLIBLCKLVL_DES" , "Library locking level" }, //@D2a - { "QLMTDEVSSN_DES" , "Limit device sessions" }, - { "QLMTSECOFR_DES" , "Limit security officer device access" }, - { "QLOCALE_DES" , "Locale path name" }, - { "QLOGOUTPUT_DES" , "Produce printer output for job log" }, // @G1A - { "QMAXACTLVL_DES" , "Maximum activity level of system" }, //@550 - { "QMAXJOB_DES" , "Maximum number of jobs" }, //@D2a - { "QMAXSGNACN_DES" , "Action to take for failed signon attempts" }, - { "QMAXSIGN_DES" , "Maximum sign-on attempts allowed" }, - { "QMAXSPLF_DES" , "Maximum number of spooled files" }, //@D2a - { "QMCHPOOL_DES" , "Machine storage pool size" }, - { "QMINUTE_DES" , "Minute of the hour" }, - { "QMLTTHDACN_DES" , "Multithreaded job action" }, //@D1a - { "QMODEL_DES" , "System model number" }, - { "QMONTH_DES" , "Month of the year" }, - { "QPASTHRSVR_DES" , "Pass-through servers" }, - { "QPFRADJ_DES" , "Performance adjustment" }, - { "QPRBFTR_DES" , "Problem log filter" }, - { "QPRBHLDITV_DES" , "Problem log hold interval" }, - { "QPRCMLTTSK_DES" , "Processor multitasking" }, - { "QPRCFEAT_DES" , "Processor feature" }, - { "QPRTDEV_DES" , "Printer device description" }, - { "QPRTKEYFMT_DES" , "Print header and/or border information" }, - { "QPRTTXT_DES" , "Print text" }, - { "QPWDCHGBLK_DES" , "Prevent password change time limit" }, //@H1A - { "QPWDEXPITV_DES" , "Password expiration interval" }, - { "QPWDEXPWRN_DES" , "Password expiration warning interval" }, //@H1A - { "QPWDLMTAJC_DES" , "Limit adjacent digits in password" }, - { "QPWDLMTCHR_DES" , "Limit characters in password" }, - { "QPWDLMTREP_DES" , "Limit repeating characters in password" }, - { "QPWDLVL_DES" , "Password Level" }, //@D2a - { "QPWDMAXLEN_DES" , "Maximum password length" }, - { "QPWDMINLEN_DES" , "Minimum password length" }, - { "QPWDPOSDIF_DES" , "Limit password character positions" }, - { "QPWDRQDDGT_DES" , "Require digit in password" }, - { "QPWDRQDDIF_DES" , "Duplicate password control" }, - { "QPWDRULES_DES" , "Password rules" }, //@H1A - { "QPWDVLDPGM_DES" , "Password validation program" }, - { "QPWRDWNLMT_DES" , "Maximum time for PWRDWNSYS *IMMED" }, - { "QPWRRSTIPL_DES" , "Automatic IPL after power restored" }, - { "QQRYDEGREE_DES" , "Parallel processing degree" }, - { "QQRYTIMLMT_DES" , "Query processing time limit" }, - { "QRCLSPLSTG_DES" , "Reclaim spool storage" }, - { "QRETSVRSEC_DES" , "Retain server security data" }, - { "QRMTIPL_DES" , "Remote power on and IPL" }, - { "QRMTSRVATR_DES" , "Remote Service attribute" }, - { "QRMTSIGN_DES" , "Remote sign-on control" }, - { "QSAVACCPTH_DES" , "Save access paths" }, //@F1A - { "QSCANFS_DES" , "Scan file system" }, //@F1A - { "QSCANFSCTL_DES" , "Scan file system control" }, //@F1A - { "QSCPFCONS_DES" , "IPL action with console problem" }, - { "QSECOND_DES" , "Second of the minute" }, - { "QSECURITY_DES" , "System security level" }, - { "QSETJOBATR_DES" , "Set job attributes from locale" }, //@A2A - { "QSFWERRLOG_DES" , "Software error logging" }, - { "QSHRMEMCTL_DES" , "Shared memory control" }, //@D2a - { "QSPCENV_DES" , "Special environment" }, - { "QSPLFACN_DES" , "Spooled file action" }, //@E0A - { "QSRLNBR_DES" , "System serial number" }, - { "QSRTSEQ_DES" , "Sort sequence" }, - { "QSRVDMP_DES" , "Service dump control" }, - { "QSSLPCL_DES" , "Secure sockets layer protocols" }, //@H2A - { "QSSLCSLCTL_DES" , "Secure sockets layer cipher control" }, //@H2A - { "QSSLCSL_DES" , "Secure sockets layer cipher specification list" }, //@H2A - { "QSTGLOWACN_DES" , "Auxiliary storage lower limit action" }, - { "QSTGLOWLMT_DES" , "Auxiliary storage lower limit" }, - { "QSTRPRTWTR_DES" , "Start print writers at IPL" }, - { "QSTRUPPGM_DES" , "Startup program" }, - { "QSTSMSG_DES" , "Display status messages" }, - { "QSVRAUTITV_DES" , "Server authentication interval" }, //@A2A - { "QSYSLIBL_DES" , "System part of the library list" }, - { "QTIMADJ_DES" , "Time adjustment" }, //@F1A - { "QTIME_DES" , "Time of day" }, - { "QTIMSEP_DES" , "Time separator" }, - { "QTIMZON_DES" , "Time zone" }, //@F1A - { "QTOTJOB_DES" , "Initial total number of jobs" }, - { "QTSEPOOL_DES" , "Time slice end pool" }, - { "QUPSDLYTIM_DES" , "Uninterruptible power supply delay time" }, - { "QUPSMSGQ_DES" , "Uninterruptible power supply message queue" }, - { "QUSEADPAUT_DES" , "Use adopted authority" }, - { "QUSRLIBL_DES" , "User part of the library list" }, - { "QUTCOFFSET_DES" , "Coordinated universal time offset" }, - { "QVFYOBJRST_DES" , "Verify object on restore" }, //@D2a - { "QYEAR_DES" , "Year" }, - { "ALRBCKFP_DES" , "Alert backup focal point" }, - { "ALRCTLD_DES" , "Alert controller" }, - { "ALRDFTFP_DES" , "Alert focal point" }, - { "ALRFTR_DES" , "Alert filter" }, - { "ALRHLDCNT_DES" , "Alert hold count" }, - { "ALRLOGSTS_DES" , "Alert logging status" }, - { "ALRPRIFP_DES" , "Alert primary focal point" }, - { "ALRRQSFP_DES" , "Alert focal point to request" }, - { "ALRSTS_DES" , "Alert status" }, - { "ALWADDCLU_DES" , "Allow add to cluster" }, //@D1a - { "ALWANYNET_DES" , "Allow AnyNet support" }, - { "ALWHPRTWR_DES" , "Allow HPR tower support" }, - { "ALWVRTAPPN_DES" , "Allow virtual APPN support" }, - { "VRTAUTODEV_DES" , "Virtual controller autocreate device" }, - { "DDMACC_DES" , "DDM request access" }, - { "DFTCNNLST_DES" , "Default ISDN connection list" }, - { "DFTMODE_DES" , "Default mode" }, - { "DFTNETTYPE_DES" , "ISDN network type" }, - { "DTACPR_DES" , "Data compression" }, - { "DTACPRINM_DES" , "Intermediate data compression" }, //@A2C - { "HPRPTHTMR_DES" , "HPR path switch timers" }, - { "JOBACN_DES" , "Job action" }, - { "LCLCPNAME_DES" , "Local control point" }, - { "LCLLOCNAME_DES" , "Local location" }, - { "LCLNETID_DES" , "Local network identifier" }, - { "MAXINTSSN_DES" , "Maximum sessions" }, - { "MAXHOP_DES" , "Maximum hop count" }, - { "MDMCNTRYID_DES" , "Modem country or region identifier" }, //@D1a @D4C - { "MSGQ_DES" , "Message queue" }, - { "NETSERVER_DES" , "Server network identifier" }, - { "NODETYPE_DES" , "APPN node type" }, - { "NWSDOMAIN_DES" , "Network server domain" }, - { "OUTQ_DES" , "Output queue" }, - { "PNDSYSNAME_DES" , "Pending system name" }, - { "PCSACC_DES" , "Client Access" }, - { "RAR_DES" , "Addition resistance" }, - { "SYSNAME_DES" , "Current system name" }, - { "QTHDRSCAFN_DES", "Thread resources affinity" }, //@K1A - { "QTHDRSCADJ_DES", "Thread resources adjustment" }, //@K1A - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for system values group's name. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix SYSTEM_VALUE_GROUP_, a short - // #TRANNOTE identifier to describe the system value group and - // #TRANNOTE a postfix _NAME. - // #TRANNOTE - { "SYSTEM_VALUE_GROUP_ALL_NAME" , "All" }, - { "SYSTEM_VALUE_GROUP_ALC_NAME" , "Allocation" }, - { "SYSTEM_VALUE_GROUP_DATTIM_NAME" , "Date and Time" }, - { "SYSTEM_VALUE_GROUP_EDT_NAME" , "Editing" }, - { "SYSTEM_VALUE_GROUP_LIBL_NAME" , "Library List" }, - { "SYSTEM_VALUE_GROUP_MSG_NAME" , "Message and Logging" }, - { "SYSTEM_VALUE_GROUP_SEC_NAME" , "Security" }, - { "SYSTEM_VALUE_GROUP_STG_NAME" , "Storage" }, - { "SYSTEM_VALUE_GROUP_SYSCTL_NAME" , "System Control" }, - { "SYSTEM_VALUE_GROUP_NET_NAME" , "Network Attributes" }, - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for system values group's description. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix SYSTEM_VALUE_GROUP_, a short - // #TRANNOTE identifier to describe the system value group and - // #TRANNOTE a postfix _DESC. - // #TRANNOTE - - { "SYSTEM_VALUE_GROUP_ALL_DESC" , "All system values in the system" }, - { "SYSTEM_VALUE_GROUP_ALC_DESC" , "Allocation system values" }, - { "SYSTEM_VALUE_GROUP_DATTIM_DESC" , "Date and time system values" }, - { "SYSTEM_VALUE_GROUP_EDT_DESC" , "Editing system values" }, - { "SYSTEM_VALUE_GROUP_LIBL_DESC" , "Library list system values" }, - { "SYSTEM_VALUE_GROUP_MSG_DESC" , "Message and logging system values" }, - { "SYSTEM_VALUE_GROUP_SEC_DESC" , "Security system values" }, - { "SYSTEM_VALUE_GROUP_STG_DESC" , "Storage system values" }, - { "SYSTEM_VALUE_GROUP_SYSCTL_DESC" , "System control system values" }, - { "SYSTEM_VALUE_GROUP_NET_DESC" , "Network attributes of the system" }, - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for system values various items - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix SYSTEM_VALUE_, and a - // #TRANNOTE description of the value. - // #TRANNOTE - { "SYSTEM_VALUE_USER_DEFINED" , "User Defined" } - }; -} diff --git a/cvsroot/src/com/ibm/as400/access/SVMRI_en.java b/cvsroot/src/com/ibm/as400/access/SVMRI_en.java deleted file mode 100644 index 727b92c91..000000000 --- a/cvsroot/src/com/ibm/as400/access/SVMRI_en.java +++ /dev/null @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SVMRI_en.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.access; - -/** - * An empty English MRI resource bundle. - *

    - * Normally we do not need _en or _en_US bundles - * since the default bundle contains English. - * However, in the case of SVMRI, since the SystemValue - * classes let you specify a Locale used to load their MRI, - * the following scenario exists: - *

    - * The default Locale of the JVM is (for example) Korean. - * The requested Locale passed into SystemValue is English. - * Java will attempt to load the English MRI bundle. If that - * bundle does not exist, it will attempt to load the default - * Locale's bundle, in this case Korean. If the Korean bundle - * does exist, the user will get Korean Strings instead of - * English, even though they requested English and English - * is available. So in this case, we provide an English bundle. - * We just provide an empty bundle, so we don't need to instantiate - * the base English Strings twice. - *

    - * We do not need _en bundles for our other MRI because there - * is currently not a way for a user to override the Locale - * we are using to load the MRI, unless they change the default - * Locale of the JVM (before our ResourceBundleLoader is first - * touched, since it loads our MRI statically). That is, for - * our other MRI bundles, if the user wants English MRI, they - * will have to switch the JVM's default Locale to be English. -**/ -public class SVMRI_en extends java.util.ListResourceBundle -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - private static final Object[][] empty_ = {}; - - public Object[][] getContents() - { - return empty_; - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SaveFile.java b/cvsroot/src/com/ibm/as400/access/SaveFile.java deleted file mode 100644 index 0e8503ae2..000000000 --- a/cvsroot/src/com/ibm/as400/access/SaveFile.java +++ /dev/null @@ -1,1574 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SaveFile.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2004-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.Serializable; -import java.io.ObjectInputStream; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.util.Date; -import java.beans.PropertyVetoException; - -/** - Represents a save file on a system. -**/ - -public class SaveFile -implements Serializable -{ - static final long serialVersionUID = 4L; - - private static final boolean DEBUG = false; - - /** - Value for the "targetRelease" property, indicating "current release". The object is to be restored to, and used on, the release of the operating system currently running on the system. The object can also be restored to a system with any subsequent release of the operating system installed. - **/ - public static final String CURRENT_RELEASE = "*CURRENT"; - - /** - Value for the "targetRelease" property, indicating "previous release". The object is to be restored to the previous release with modification level 0 of the operating system. The object can also be restored to a system with any subsequent release of the operating system installed. - **/ - public static final String PREVIOUS_RELEASE = "*PRV"; - - /** - Value for the "maximumNumberOfRecords" property, indicating that the system maximum is used. - **/ - public static final long NO_MAX = 0L; - - /** - Value for the "waitTime" property, indicating "immediate". The program does not wait; when the file is opened, an immediate allocation of the file resources is required. - **/ - public static final int IMMED = -1; - - /** - Special value for the "waitTime" property. Indicates that the job default wait time is used as the wait time for the file resources being allocated. - **/ - public static final int CLS = 0; - - /** - Special value for the "maximumNumberOfRecords", "waitTime", and "asp" properties. Indicates that the system default value is used. - **/ - public static final int DEFAULT = -99; - - // Values for the existence_ variable: - private static final int EXISTENCE_UNKNOWN = 0; // save file existence is unknown - private static final int EXISTENCE_YES = 1; // save file exists on system - private static final int EXISTENCE_NO = 2; // save file doesn't exist - - private static final String USERSPACE_NAME = "JT4USRSPC QTEMP "; - private static final String USERSPACE_PATH = "/QSYS.LIB/QTEMP.LIB/JT4USRSPC.USRSPC"; - - private final static ProgramParameter errorCode_ = new ProgramParameter(new byte[4]); - - // Persistent attributes: - private AS400 system_; // the system where the save file is located - private String path_; // fully qualified IFS pathname of the save file - private String library_; // library where the save file is located - private String name_; // the name of the save file - private String targetRelease_ = CURRENT_RELEASE; // target release for save file - private String saveOutput_ = "*NONE"; // whether output from API's should be saved - - // The remaining fields are for internal housekeeping. - - private transient int systemVRM_; - private transient boolean gotSystemVRM_; - private transient ObjectDescription objectDescription_; - private transient Record fileAttributes_; // format is described by class "SaveFileAttrFormat" - private transient String savefileNameAndLib_; - - private transient int existence_ = EXISTENCE_UNKNOWN; // cached value from most recent existence check - private transient AS400Timestamp timestampConverter_; - - // Note: If it's ever required, we'll make this class into a Bean later. - // Until then, we don't provide a default (zero-argument) constructor. - - - /** - Constructs a SaveFile object. -
    Note: This method does not create a save file on the system. To create a save file, use {@link #create() create()} or {@link #create(long,int,int,boolean,String,String) create()}. - @param system The system where the save file is located. - @param library The library (on the system) where the save file is located. Example: "MYLIB1". Case is preserved. - @param name The name of the save file. Example: "MYFILE1". Case is preserved. - **/ - public SaveFile(AS400 system, String library, String name) - { - if (system == null) { throw new NullPointerException("system"); } - if (library == null) { throw new NullPointerException("library"); } - if (name == null) { throw new NullPointerException("name"); } - - system_ = system; - library_ = library; - name_ = name; - path_ = QSYSObjectPathName.toPath(library, name, "FILE"); - } - - - /** - Clears all existing records from the save file and reduces the amount of storage used by this file. -

    - A save file must be cleared before it can be used again to receive data from a save command or to receive another save file. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void clear() - throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - checkExistence(); - CommandCall cmd = new CommandCall(system_, "QSYS/CLRSAVF FILE("+library_+"/"+name_+")"); - if (!cmd.run()) { - throw new AS400Exception(cmd.getMessageList()); - } - fileAttributes_ = null; // force a refresh - } - - - /** - Copies the save file to another save file on the same system. -
    If the target save file doesn't exist on the system, it is created. -
    If the target save file already contains data, the data is replaced. -
    If the target exists but is not a save file, this method fails. -
    If the target has insufficient capacity, an exception is thrown. - @param library The library of the target save file. Example: "MYLIB1". Case is preserved. - @param name The name of the target save file. Example: "MYFILE1". Case is preserved. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void copyTo(String library, String name) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (library == null) { throw new NullPointerException("library"); } - if (name == null) { throw new NullPointerException("name"); } - - checkExistence(); - String targetPath = QSYSObjectPathName.toPath(library, name, "FILE"); - CommandCall cmd = new CommandCall(system_, "QSYS/CPY OBJ('"+path_+"') TOOBJ('" + targetPath + "') REPLACE(*YES)"); - if (!cmd.run()) { - throw new AS400Exception(cmd.getMessageList()); - } - } - - /** - Creates a save file on the system. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectAlreadyExistsException If the save file already exists on the system. - @throws ObjectDoesNotExistException If the system API that queries save file description information is missing. - **/ - public void create() - throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException, ObjectAlreadyExistsException - { - create(DEFAULT, DEFAULT, DEFAULT, false, null, null); - } - - - /** - Creates a save file on the system. - @param maxRecords The maximum number of records the save file can hold. If {@link #NO_MAX NO_MAX} is specified, the system maximum is used. - @param asp The auxiliary storage pool (ASP) in which the system creates the save file. If {@link #DEFAULT DEFAULT} is specified, the save file is created in the same ASP as the one containing the library holding the file. - @param waitTime The number of seconds that the program waits for the file resources and session resources to be allocated when the file is opened, or for the device or session resources to be allocated when an acquire operation is performed to the file. Special values: {@link #CLS CLS}, {@link #IMMED IMMED} - @param shared Specifies whether the open data path (ODP) for the save file is shared with other programs in the routing step. When an ODP is shared, the programs accessing the file share facilities such as the file status and the buffer. Default is false. - @param authority The authority given to users who do not have specific authority to the save file, who are not on an authorization list, and whose user group has no specific authority to the save file. Defaults to *EXCLUDE if null. - @param description The text that briefly describes the save file. Defaults to blank if null. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectAlreadyExistsException If the save file already exists on the system. - @throws ObjectDoesNotExistException If the system API that queries save file description information is missing. - **/ - public void create(long maxRecords, int asp, int waitTime, boolean shared, String authority, String description) - throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException, ObjectAlreadyExistsException - { - if (exists()) { - throw new ObjectAlreadyExistsException(path_, ObjectAlreadyExistsException.OBJECT_ALREADY_EXISTS); - } - - // Note: We tolerate null args. They are interpreted to indicate "Use the default value". - - StringBuffer cmdBuf = new StringBuffer("QSYS/CRTSAVF FILE("+library_+"/"+name_+") "); - - if (maxRecords == DEFAULT) { - // Ignore; the user wants the default. - } - else if (maxRecords == NO_MAX) { - cmdBuf.append("MAXRCDS(*NOMAX) "); - } - else { - cmdBuf.append("MAXRCDS("+maxRecords+") "); - } - - if (asp != DEFAULT) { - cmdBuf.append("ASP("+asp+") "); - } - - switch (waitTime) { - case DEFAULT: - // Ignore; the user wants the default. - break; - case CLS: - cmdBuf.append("WAITFILE(*CLS) "); - break; - case IMMED: // 0 - cmdBuf.append("WAITFILE(*IMMED) "); - break; - default: - cmdBuf.append("WAITFILE("+Integer.toString(waitTime) + ") "); - } - - if (shared) { cmdBuf.append("SHARE(*YES) "); } - // Note: Default is *NO. - - if (authority != null) { - cmdBuf.append("AUT("+authority+") "); - } - - if (description != null) { - cmdBuf.append("TEXT('"+description+"') "); - } - - if (DEBUG) System.out.println("Running command: " + cmdBuf.toString()); - CommandCall cmd = new CommandCall(system_, cmdBuf.toString()); - if (!cmd.run()) { - existence_ = EXISTENCE_UNKNOWN; - throw new AS400Exception(cmd.getMessageList()); - } - existence_ = EXISTENCE_YES; - } - - - /** - Deletes the save file. If the save file does not exist, does nothing. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - **/ - public void delete() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException - { - CommandCall cmd = new CommandCall(system_, "QSYS/DLTF FILE("+library_+"/"+name_+")"); - if (!cmd.run()) - { - existence_ = EXISTENCE_UNKNOWN; - AS400Message[] msgs = cmd.getMessageList(); - if (msgs.length > 0) { - if (msgs[0].getID() != null && - !msgs[0].getID().equals("CPF2105") && // file not found - !msgs[0].getID().equals("CPF2110") /*&&*/ // library not found - /* !msgs[0].getID().equals("CPC2191") */ ) { - throw new AS400Exception(msgs); - } - } - else { - throw new InternalErrorException("No messages returned from failed delete.", - InternalErrorException.UNKNOWN); - } - } - existence_ = EXISTENCE_NO; - } - - - /** - Determines whether this SaveFile object is equal to another object. - @return true if the two instances are equal - **/ - public boolean equals(Object obj) - { - if (obj == null) return false; - try - { - SaveFile other = (SaveFile)obj; - - // Note: For any given SaveFile object: system_, library_, and name_ are all guaranteed to be non-null. - if (!system_.equals(other.getSystem())) return false; - if (!library_.equals(other.getLibrary())) return false; - if (!name_.equals(other.getName())) return false; - else return true; - } - catch (Throwable e) { - return false; - } - } - - /** - Returns a hash code value for the object. - @return A hash code value for this object. - **/ - public int hashCode() - { - // We must conform to the invariant that equal objects must have equal hashcodes. - return (system_.hashCode() + library_.hashCode() + name_.hashCode()); - } - - - /** - Determines if the save file currently exists on the system. - @return true if the save file exists; false if the save file does not exist. - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the system API that queries save file description information is missing. - **/ - public boolean exists() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (objectDescription_ == null) { objectDescription_ = getObjDesc(); } - existence_ = (objectDescription_.exists() ? EXISTENCE_YES : EXISTENCE_NO); - return (existence_==EXISTENCE_YES); - } - - - /** - Returns the auxiliary storage pool ID for the save file. -
    If the save file doesn't exist on the system, an exception is thrown. - @return The auxiliary storage pool ID. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getASP() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - checkExistence(); - if (fileAttributes_ == null) fileAttributes_ = getFileAttributes(); - - BigDecimal decVal = (BigDecimal)fileAttributes_.getField("SAASP"); - int value = decVal.intValue(); // It's only a 3-digit field, so it'll fit. - return value; - } - - - /** - Returns the current number of records in the save file. -
    If the save file doesn't exist on the system, an exception is thrown. - @return The current number of records in the save file. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getCurrentNumberOfRecords() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - checkExistence(); - if (fileAttributes_ == null) fileAttributes_ = getFileAttributes(); - - BigDecimal decVal = (BigDecimal)fileAttributes_.getField("SACNRC"); - long value = decVal.longValue(); - if (value == 99999) { - decVal = (BigDecimal)fileAttributes_.getField("SACNR2"); - value = decVal.longValue(); - } - return value; - } - - - /** - Returns the text description of the save file. - @return The text description. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getDescription() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - objectDescription_ = checkExistence(); - return (String)objectDescription_.getValue(ObjectDescription.TEXT_DESCRIPTION); - } - - - /** - Returns the current total size (in bytes) of the save file. - @return The size of the save file. - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getLength() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Note: From the spec for the CHGSAVF command: - // The size of the save file is estimated in bytes at about 8192 + (512 x number of records in the save file). There is room for approximately two thousand 512-byte records in 1 megabyte of space. For example, to ensure that the save file does not exceed approximately 20 megabytes (20 x 2000), specify MAXRCDS (40000). Note: The maximum amount of data that a save file can contain is approximately one terabyte (1,099,511,627,776 bytes). - objectDescription_ = checkExistence(); - long value = ((Long)objectDescription_.getValue(ObjectDescription.OBJECT_SIZE)).longValue(); - return value; - } - - /** - Returns the name of the library where the save file is located on the system. - @return The name of the library - **/ - public String getLibrary() - { - return library_; - } - - - /** - Returns the capacity (maximum number of records) of the save file. - Returns {@link #NO_MAX NO_MAX} if there is no maximum. -
    If the save file doesn't exist on the system, an exception is thrown. - @return The maximum number of records that the save file can hold. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getMaximumNumberOfRecords() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - checkExistence(); - if (fileAttributes_ == null) fileAttributes_ = getFileAttributes(); - - BigDecimal decVal = (BigDecimal)fileAttributes_.getField("SASIZE"); - return decVal.longValue(); - } - - /** - Returns the name of the save file on the system. - @return The name of the save file - **/ - public String getName() - { - return name_; - } - - - /** - Returns an ObjectDescription instance representing the save file. Various attributes of the save file can then be queried via the ObjectDescription. - @return An ObjectDescription representing the save file. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public ObjectDescription getObjectDescription() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - objectDescription_ = checkExistence(); - return objectDescription_; - } - - - /** - Returns the fully-qualifed IFS pathname of the save file. - Example: "/QSYS.LIB/MYLIB1.LIB/MYFILE1.SAVF" - @return The path of the save file. - **/ - public String getPath() - { - return path_; - } - - - /** - Returns the system where the save file is located. - @return The system. - **/ - public AS400 getSystem() - { - return system_; - } - - /** - Returns the target release level of the operating system on which you intend to restore and use the object(s) saved in the save file by a subsequent invocation of one of the save() methods. - The format VxRxMx is used to specify the target release, where Vx is the version, Rx is the release, and Mx is the modification level. For example, V5R2M0 is version 5, release 2, modification level 0. - Special values include {@link #CURRENT_RELEASE CURRENT_RELEASE} and {@link #PREVIOUS_RELEASE PREVIOUS_RELEASE}. The default is CURRENT_RELEASE. - **/ - public String getTargetRelease() - { - return targetRelease_; - } - - - private static final int FORMAT_DTS = AS400Timestamp.FORMAT_DTS; // *DTS format - private synchronized AS400Timestamp getTimestampConverter(int format) - { - if (timestampConverter_ == null) { - timestampConverter_ = new AS400Timestamp(); - timestampConverter_.setFormat(format); - } - else if (format != timestampConverter_.getFormat()) { - timestampConverter_.setFormat(format); - } - return timestampConverter_; - } - - - /** - Returns the wait time for the save file. This is the number of seconds to wait for the file resources and session resources to be allocated when the save file is opened, or for the device or session resources to be allocated when an acquire operation is performed to the save file. -
    Special values: {@link #IMMED IMMED}, {@link #CLS CLS} -
    If the save file doesn't exist on the system, an exception is thrown. - @return The wait time. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getWaitTime() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - checkExistence(); - if (fileAttributes_ == null) fileAttributes_ = getFileAttributes(); - - BigDecimal val = (BigDecimal)fileAttributes_.getField("SAWAIT"); - return val.intValue(); - } - - - /** - Indicates whether output from called API's will be saved in the job's spooled output. -
    By default, output is not saved. - **/ - public boolean isSaveOutput() - { - return (saveOutput_.equals("*PRINT")); - } - - /** - Reports whether the open data path (ODP) for the save file is shared with other programs in the routing step. When an ODP is shared, the programs accessing the file, share facilities such as the file status and the buffer. -
    The default is "not shared". -
    If the save file doesn't exist on the system, an exception is thrown. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isShared() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - checkExistence(); - if (fileAttributes_ == null) fileAttributes_ = getFileAttributes(); - - String val = (String)fileAttributes_.getField("SASHAR"); - return (val.equals("Y") ? true : false); - } - - - - /** - Lists the contents of the save file. -
    Note: Due to a limitation in the underlying API (QSRLSAVF). files saved from the "root" file system ("/") cannot be listed. Use the DSPSAVF to view the contents of such save files. - @return The entries in the save file. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public SaveFileEntry[] listEntries() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, UnsupportedEncodingException - { - checkExistence(); - -// "List Save File" (QSRLSAVF) API: -// -// Required Parameter Group: -// -// 1 Qualified user space name Input Char(20) <- UserSpaceName / LibraryName -// 2 Format name Input Char(8) <- SAVF0200 -// 3 Qualified save file name Input Char(20) <- SaveFileName / LibraryName -// 4 Object name filter Input Char(10) <- *ALL -// 5 Object type filter Input Char(10) <- *ALL -// 6 Continuation handle Input Char(36) <- -// 7 Error code I/O Char(*) -// -// Default Public Authority: *USE -// -// Threadsafe: No - - final int systemCCSID = system_.getCcsid(); - CharConverter conv = new CharConverter(systemCCSID); - final AS400Text text36 = new AS400Text(36, systemCCSID); - - ProgramParameter[] parms = new ProgramParameter[7]; - - parms[0] = new ProgramParameter(conv.stringToByteArray(USERSPACE_NAME)); - parms[1] = new ProgramParameter(conv.stringToByteArray("SAVF0200")); - parms[2] = new ProgramParameter(conv.stringToByteArray(getNameAndLib())); - parms[3] = new ProgramParameter(conv.stringToByteArray("*ALL ")); - parms[4] = new ProgramParameter(conv.stringToByteArray("*ALL ")); - parms[5] = new ProgramParameter(text36.toBytes(" ")); - parms[6] = errorCode_; - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QSRLSAVF.PGM", parms); - // Note: The called API is not thread-safe. - - // Determine the needed scope of synchronization. - Object lockObject; - boolean willRunProgramsOnThread = pc.isStayOnThread(); - if (willRunProgramsOnThread) { - // The calls will run in the job of the JVM, so lock for entire JVM. - lockObject = USERSPACE_PATH; - } - else { - // The calls will run in the job of the Remote Command Host Server, so lock on the connection. - lockObject = system_; - } - - byte[] buf = null; - - synchronized (lockObject) - { - // Create a user space in QTEMP to receive output. - UserSpace space = new UserSpace(system_, USERSPACE_PATH); - space.setMustUseProgramCall(true); - if (!willRunProgramsOnThread) - { - space.setMustUseSockets(true); - // Force the use of sockets when running natively but not on-thread. - // We have to do it this way since UserSpace will otherwise make a native ProgramCall, and will use a different QTEMP library than that used by the host server. - } - - try - { - space.create(256*1024, true, "", (byte)0, "User space for SaveFile", "*EXCLUDE"); - - if (!pc.run()) { - throw new AS400Exception(pc.getMessageList()); - } - - // Get the results from the user space. - int size = space.getLength(); - buf = new byte[size]; - space.read(buf, 0); - } - - finally { - // Delete the temporary user space, to allow other threads to re-create and use it. - try { space.delete(); } - catch (Exception e) { - Trace.log(Trace.ERROR, "Exception while deleting temporary user space", e); - } - } - } - - // Parse the list data returned in the user space. - - int startingOffset = BinaryConverter.byteArrayToInt(buf, 124); - int numEntries = BinaryConverter.byteArrayToInt(buf, 132); - int entrySize = BinaryConverter.byteArrayToInt(buf, 136); - int entryCCSID = BinaryConverter.byteArrayToInt(buf, 140); - - if (entryCCSID == 0) entryCCSID = systemCCSID; // From the API spec: "The coded character set ID for data in the list entries. If 0, then the data is not associated with a specific CCSID and should be treated as hexadecimal data." - conv = new CharConverter(entryCCSID); - - String objName, libSaved, objType, extObjAttr; - Date saveDateTime; - int objSize, objSizeMult, asp; - String dataSaved, objOwner, dloName, folder, desc, aspDevName; - byte[] saveDateTimeBytes = new byte[8]; - - SaveFileEntry[] entries = new SaveFileEntry[numEntries]; - int offset = 0; - for (int i=0; i= 0x00050200) { - aspDevName = conv.byteArrayToString(buf, offset, 10).trim(); // - } - else aspDevName = ""; - - entries[i] = new SaveFileEntry(objName, libSaved, objType, extObjAttr, saveDateTime, objSize, objSizeMult, asp, dataSaved, objOwner, dloName, folder, desc, aspDevName); - } - - return entries; - } - - - /** - Lists the product loads in the save file. - If the save file contains no product loads, returns an empty list. - @return The product loads in the save file. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Product[] listProducts() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - checkExistence(); - -// "List Product in a Save File" (QLPLPRDS) API: -// -// Required Parameter Group: -// -// 1 Qualified user space name Input Char(20) -// 2 Format name Input Char(8) -// 3 Qualified save file name Input Char(20) -// 4 Error code I/O Char(*) -// -// Default Public Authority: *USE -// -// Threadsafe: No - - final int systemCCSID = system_.getCcsid(); - CharConverter conv = new CharConverter(systemCCSID); - - ProgramParameter[] parms = new ProgramParameter[4]; - - parms[0] = new ProgramParameter(conv.stringToByteArray(USERSPACE_NAME)); - parms[1] = new ProgramParameter(conv.stringToByteArray("PRDL0100")); - parms[2] = new ProgramParameter(conv.stringToByteArray(getNameAndLib())); - parms[3] = errorCode_; - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QLPLPRDS.PGM", parms); - // Note: The called API is not thread-safe. - - // Determine the needed scope of synchronization. - Object lockObject; - boolean willRunProgramsOnThread = pc.isStayOnThread(); - if (willRunProgramsOnThread) { - // The calls will run in the job of the JVM, so lock for entire JVM. - lockObject = USERSPACE_PATH; - } - else { - // The calls will run in the job of the Remote Command Host Server, so lock on the connection. - lockObject = system_; - } - - byte[] buf = null; - - synchronized (USERSPACE_NAME) - { - // Create a user space in QTEMP to receive output. - UserSpace space = new UserSpace(system_, USERSPACE_PATH); - space.setMustUseProgramCall(true); - if (!willRunProgramsOnThread) - { - space.setMustUseSockets(true); - // Force the use of sockets when running natively but not on-thread. - // We have to do it this way since UserSpace will otherwise make a native ProgramCall, and will use a different QTEMP library than that used by the host server. - } - - try - { - space.create(256*1024, true, "", (byte)0, "User space for SaveFile", "*EXCLUDE"); - - if (!pc.run()) - { - // Get the message id of the first message. - AS400Message[] messageList = pc.getMessageList(); - String id = messageList[0].getID(); - - // Handle a "No product found in save file" message. - if (id.equalsIgnoreCase("CPF3D94")) - { - if (Trace.isTraceOn()) { - Trace.log(Trace.INFORMATION, "No product found in save file"); - } - return new Product[0]; // return an empty list - } - else - { - throw new AS400Exception(messageList); - } - } - - // Get the results from the user space. - int size = space.getLength(); - buf = new byte[size]; - space.read(buf, 0); - } - - finally { - // Delete the temporary user space, to allow other threads to re-create and use it. - try { space.delete(); } - catch (Exception e) { - Trace.log(Trace.ERROR, "Exception while deleting temporary user space", e); - } - } - } - - // Parse the list data returned in the user space. - - int startingOffset = BinaryConverter.byteArrayToInt(buf, 124); - int numEntries = BinaryConverter.byteArrayToInt(buf, 132); - int entrySize = BinaryConverter.byteArrayToInt(buf, 136); - int entryCCSID = BinaryConverter.byteArrayToInt(buf, 140); - - if (entryCCSID == 0) entryCCSID = systemCCSID; // From the API spec: "The coded character set ID for data in the list entries. If 0, then the data is not associated with a specific CCSID and should be treated as hexadecimal data." - conv = new CharConverter(entryCCSID); - - String prodID, releaseLevel, prodOption, loadType, langID; - - Product[] entries = new Product[numEntries]; - int offset = 0; - for (int i=0; i for the SAVLIB() argument, when we also specify the SAVF parameter. - // "The SAVF parameter is not allowed when the value for either the LIB or SAVLIB parameter is specified as *ALLUSR, *IBM, or *NONSYS." - // Note that RSTOBJ also requires a "saved library" parameter, if we specify OBJ(*ALL). - - - /** - Renames the save file. The library is not changed. - @param name The new name for the save file. Example: "MYFILE1". - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void renameTo(String name) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (name == null) throw new NullPointerException("name"); - - checkExistence(); - CommandCall cmd = new CommandCall(system_, "QSYS/RNM OBJ('"+path_+"') NEWOBJ("+name+".FILE)"); - if (!cmd.run()) { - throw new AS400Exception(cmd.getMessageList()); - } - name_ = name; - path_ = QSYSObjectPathName.toPath(library_, name_, "FILE"); - fileAttributes_ = null; // force a refresh - objectDescription_ = null; - } - - - /** - Restores a library that was saved into the save file. - If the library does not exist, it is created. - If the save file does not contain a library named libraryName, an exception is thrown. -
    Note: This method presents a subset of the functionality of the 'RSTLIB' CL command. For full functionality, call the CL directly using the CommandCall class. - @param libraryName The library to be restored. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void restore(String libraryName) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (libraryName == null) throw new NullPointerException("libraryName"); - checkExistence(); - - String cmdString = "QSYS/RSTLIB SAVLIB("+libraryName+") " + - "DEV(*SAVF) SAVF("+library_+"/"+name_+") " + - "OUTPUT("+saveOutput_+") "; - if (DEBUG) System.out.println("Running command: " + cmdString); - CommandCall cmd = new CommandCall(system_, cmdString); - if (!cmd.run()) { - throw new AS400Exception(cmd.getMessageList()); - } - } - - - /** - Restores objects that were saved into the save file. - If the target library does not exist, it is created. - If the save file does not contain the specified library or object, an exception is thrown. -
    Note: This method presents a subset of the functionality of the 'RSTOBJ' CL command. For full functionality, call the CL directly using the CommandCall class. - @param libraryName The library from which the object was saved. - @param objectList The objects to be restored. Objects are specified by simple object name. For example: MYPROG1 or MYFILE2. - @param toLibraryName The library to which to restore the object. If null, restores to the original library, that is, the library from which the object was saved. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void restore(String libraryName, String[] objectList, String toLibraryName) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (libraryName == null) throw new NullPointerException("libraryName"); - if (objectList == null) throw new NullPointerException("objectList"); - // Tolerate a null-valued toLibraryName. - checkExistence(); - - // Build the object list for the OBJ parameter. - StringBuffer objects = new StringBuffer(); - for (int i=0; iNote: This method presents a subset of the functionality of the 'RSTLICPGM' CL command. For full functionality, call the CL directly using the CommandCall class. - @param product The product to be restored. - - @throws AS400Exception If the product is already installed, or if the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void restore(Product product) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (product == null) throw new NullPointerException("product"); - checkExistence(); - - StringBuffer cmdBuf = - new StringBuffer("QSYS/RSTLICPGM " + - "LICPGM("+product.getProductID()+") " + - "DEV(*SAVF) SAVF("+library_+"/"+name_+") " + - "OPTION("+getProductOption(product)+") " + - "RSTOBJ("+getObjectType(product)+") " + - "RLS("+product.getReleaseLevel()+") " + - "OUTPUT("+saveOutput_+") "); - - String lang = product.getPrimaryLanguageFeatureID(); - if (lang != null && lang.length() != 0) { - cmdBuf.append("LNG("+lang+") "); - } - - if (DEBUG) System.out.println("Running command: " + cmdBuf.toString()); - CommandCall cmd = new CommandCall(system_, cmdBuf.toString()); - if (!cmd.run()) { - throw new AS400Exception(cmd.getMessageList()); - } - } - - - // Design note: If a SAVxxx command is called with CLEAR(*NONE) and the save file already contains data, then an enquiry message is sent: - // SAVE FILE [fileName] IN [libraryName] ALREADY CONTAINS DATA. (C G) - // This will cause a hang, since we're not running interactive. - // So the easiest solution is just to always specify CLEAR(*ALL) - - - /** - Saves a library into the save file. - Any existing data in the save file is cleared. - If libraryName does not specify an existing library, an exception is thrown. -
    Note: This method presents a subset of the functionality of the 'SAVLIB' CL command. For full functionality, call the CL directly using the CommandCall class. - @param libraryName The library to be saved. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void save(String libraryName) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (libraryName == null) throw new NullPointerException("libraryName"); - checkExistence(); - - String cmdString = "QSYS/SAVLIB LIB("+libraryName+") " + - "DEV(*SAVF) SAVF("+library_+"/"+name_+") " + - "TGTRLS("+targetRelease_+") " + - "CLEAR(*ALL) " + - "OUTPUT("+saveOutput_+") "; - if (DEBUG) System.out.println("Running command: " + cmdString); - CommandCall cmd = new CommandCall(system_, cmdString); - if (!cmd.run()) { - throw new AS400Exception(cmd.getMessageList()); - } - } - - - /** - Saves objects into the save file. - Any existing data in the save file is cleared. - If a specified library or object does not exist, an exception is thrown. -
    Note: This method presents a subset of the functionality of the 'SAVOBJ' CL command. For full functionality, call the CL directly using the CommandCall class. - @param libraryName The library where the object resides. - @param objectList The objects to be saved. Objects are specified by simple object name. For example: MYPROG1 or MYFILE2. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void save(String libraryName, String[] objectList) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (libraryName == null) throw new NullPointerException("libraryName"); - if (objectList == null) throw new NullPointerException("objectList"); - checkExistence(); - - // Build the object list for the OBJ parameter. - StringBuffer objects = new StringBuffer(); - for (int i=0; iNote: The objects must all reside in the root file system ("/"). This method will throw an exception if pathList specifies files under QSYS or QDLS. -
    Note: This method presents a subset of the functionality of the 'SAV' CL command. For full functionality, call the CL directly using the CommandCall class. - @param pathList The objects to be saved; objects are specified by path. For example: "/myDirectory/myFile" or "/myDirectory/*". - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void save(String[] pathList) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (pathList == null) throw new NullPointerException("pathList"); - checkExistence(); - - // Build the path list for the OBJ parameter. - StringBuffer paths = new StringBuffer(); - for (int i=0; iNote: Depending on the size of the product, this method may take a very long time to complete. -
    Note: This method presents a subset of the functionality of the 'SAVLICPGM' CL command. For full functionality, call the CL directly using the CommandCall class. - @param product The product to be saved. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void save(Product product) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (product == null) throw new NullPointerException("product"); - checkExistence(); - - StringBuffer cmdBuf = - new StringBuffer("QSYS/SAVLICPGM " + - "LICPGM("+product.getProductID()+") " + - "DEV(*SAVF) SAVF("+library_+"/"+name_+") " + - "OPTION("+getProductOption(product)+") " + - "RLS("+product.getReleaseLevel()+") " + - "OBJTYPE("+getObjectType(product)+") " + - "TGTRLS("+targetRelease_+") " + - "CLEAR(*ALL) "); - - String lang = product.getPrimaryLanguageFeatureID(); - if (lang != null && lang.length() != 0) { - cmdBuf.append("LNG("+lang+") "); - } - - // Note: This API has no OUTPUT parameter. - - if (DEBUG) System.out.println("Running command: " + cmdBuf.toString()); - CommandCall cmd = new CommandCall(system_, cmdBuf.toString()); - if (!cmd.run()) { - throw new AS400Exception(cmd.getMessageList()); - } - } - - - /** - Sets the text description of the save file. - If the save file doesn't exist on the system, an exception is thrown. - @param description The description. - Maximum length is 50 characters. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setDescription(String description) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (description == null) throw new NullPointerException("description"); - objectDescription_ = checkExistence(); - - String cmdString = "QSYS/CHGSAVF FILE("+library_+"/"+name_+") TEXT('"+description+"') "; - CommandCall cmd = new CommandCall(system_, cmdString); - if (!cmd.run()) { - throw new AS400Exception(cmd.getMessageList()); - } - objectDescription_ = null; // force a refresh on next getDescription() - } - - /** - Sets the capacity (maximum number of records) of the save file. -
    If the current number of records in the save file is greater than the new maximumNumberOfRecords value, an exception is thrown, and the save file is not changed. -
    Special value: {@link #NO_MAX NO_MAX} -
    If the save file doesn't exist on the system, an exception is thrown. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setMaximumNumberOfRecords(long maximumNumberOfRecords) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - checkExistence(); - // Note: We let the system validate the argument. - - String value; - if (maximumNumberOfRecords == NO_MAX) { value = "*NOMAX"; } - else { value = Long.toString(maximumNumberOfRecords); } - - String cmdString = "QSYS/CHGSAVF FILE("+library_+"/"+name_+") MAXRCDS("+value+") "; - CommandCall cmd = new CommandCall(system_, cmdString); - if (!cmd.run()) { - throw new AS400Exception(cmd.getMessageList()); - } - fileAttributes_ = null; // force a refresh - } - - - /** - Indicates whether output from called API's will be saved in the job's spooled output. The job will be that of the Remote Command Host Server, job QUSRWRK/QZRCSRVS. The saved information may be useful when analyzing errors. -
    By default, output is not saved. - @param save Whether output should be saved. - **/ - public void setSaveOutput(boolean save) - { - saveOutput_ = (save == true ? "*PRINT" : "*NONE"); - } - - /** - Sets whether the open data path (ODP) for the save file is shared with other programs in the routing step. When an ODP is shared, the programs accessing the file can share facilities such as the file status and the buffer. For more details refer to the specification of the CHGSAVF CL command in the IBM i reference. - If the save file doesn't exist on the system, an exception is thrown. -
    The default is "not shared". - @param shared Whether ODP is shared. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setShared(boolean shared) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - checkExistence(); - - String value = (shared ? "*YES" : "*NO"); - - String cmdString = "QSYS/CHGSAVF FILE("+library_+"/"+name_+") SHARE("+value+") "; - CommandCall cmd = new CommandCall(system_, cmdString); - if (!cmd.run()) { - throw new AS400Exception(cmd.getMessageList()); - } - fileAttributes_ = null; // force a refresh - } - - - /** - Sets the target release level of the operating system on which you intend to restore and use the object(s) saved in the save file by a subsequent invocation of one of the save() methods. - The format VxRxMx is used to specify the target release, where Vx is the version, Rx is the release, and Mx is the modification level. For example, V5R2M0 is version 5, release 2, modification level 0. -
    The object(s) in the save file can be restored to a system with the specified release or with any subsequent release of the operating system installed. Valid values depend on the system's current version, release, and modification level. - Special values include {@link #CURRENT_RELEASE CURRENT_RELEASE} and {@link #PREVIOUS_RELEASE PREVIOUS_RELEASE}. The default is CURRENT_RELEASE. - @param targetRelease The target release. - **/ - public void setTargetRelease(String targetRelease) - { - if (targetRelease == null) throw new NullPointerException("targetRelease"); - targetRelease_ = targetRelease; - } - - - /** - Sets the number of seconds to wait for the file resources and session resources to be allocated when the save file is opened, or for the device or session resources to be allocated when an acquire operation is performed to the save file. -
    The default is {@link #IMMED IMMED}. -
    If the save file doesn't exist on the system, an exception is thrown. - @param seconds The wait time. - - @throws AS400Exception If the program call returns error messages. - @throws AS400SecurityException If a security or authority error occurs. - @throws ErrorCompletingRequestException If an error occurs before the request is completed. - @throws InterruptedException If this thread is interrupted. - @throws IOException If an error occurs while communicating with the system. - @throws ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setWaitTime(int seconds) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - checkExistence(); - // Note: We let the system validate the argument. - - String value; - switch (seconds) { - case DEFAULT: - case IMMED: - value = "*IMMED"; - break; - case CLS: - value = "*CLS"; - break; - default: - value = Integer.toString(seconds); - } - String cmdString = "QSYS/CHGSAVF FILE("+library_+"/"+name_+") WAITFILE("+value+") "; - CommandCall cmd = new CommandCall(system_, cmdString); - if (!cmd.run()) { - throw new AS400Exception(cmd.getMessageList()); - } - fileAttributes_ = null; // force a refresh - } - - - /** - Returns the String representation of this object. - @return The String representation of this object. - **/ - public String toString() - { - return "SaveFile (system: " + system_.getSystemName() + "; path: "+ path_ + "): " + super.toString(); - } - - - - - // Helper methods. - - - - - /** - Returns the "qualified save file name" for use in API calls. - **/ - private String getNameAndLib() - { - if (savefileNameAndLib_ == null) - { - StringBuffer buff = new StringBuffer(" "); // initialize to 20 blanks - buff.replace(0, name_.length(), name_); - buff.replace(10, 10+library_.length(), library_); - savefileNameAndLib_ = buff.toString(); - } - return savefileNameAndLib_; - } - - /** - Converts an 8-byte system timestamp value into a Date object. - **/ - private Date getAsSystemDate(byte[] data) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - AS400Timestamp conv = getTimestampConverter(FORMAT_DTS); // field is in *DTS format - return conv.toDate(conv.toTimestamp(data), system_.getTimeZone()); - } - - - - /** - Generates a record containing the save file attributes. - **/ - private Record getFileAttributes() - throws AS400Exception, AS400SecurityException, InterruptedException, IOException - { - AS400FileRecordDescriptionImplRemote recDesc = new AS400FileRecordDescriptionImplRemote(); - recDesc.setSystem(system_.getImpl()); - recDesc.setPath(path_); - return recDesc.getSavefileAttributes(); - } - - - /** - Returns the system VRM. - **/ - private int getSystemVRM() - throws AS400SecurityException, IOException - { - if (!gotSystemVRM_) { systemVRM_ = system_.getVRM(); gotSystemVRM_ = true; } - return systemVRM_; - } - - - /** - Gets an ObjectDescription object representing the save file. - **/ - private ObjectDescription getObjDesc() - { - return new ObjectDescription(system_, library_, name_, "FILE"); - } - - - /** - Deserializes and initializes transient data. - **/ - private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "De-serializing SaveFile object."); - in.defaultReadObject(); - } - - - /** - Checks for existence of the save file on the system. - **/ - private ObjectDescription checkExistence() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // If we've already checked, use cached state, assume it's still current. - if (existence_ == EXISTENCE_YES && objectDescription_ != null) { - return objectDescription_; - } - - // Send query to the system. - if (objectDescription_ == null) { objectDescription_ = getObjDesc(); } - if (objectDescription_.exists()) return objectDescription_; - else { - throw new ObjectDoesNotExistException(path_, ObjectDoesNotExistException.OBJECT_DOES_NOT_EXIST); - } - } - - - // Gets the "load type" from the product, and converts it to an "object type". - private static String getObjectType(Product product) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - String type = product.getLoadType(); - if (type == null || type.length() == 0) { type = "*ALL"; } - else if (type.equals(Product.LOAD_TYPE_CODE)) { type = "*PGM"; } - else if (type.equals(Product.LOAD_TYPE_LANGUAGE)) { type = "*LNG"; } - else { - Trace.log(Trace.ERROR, "Unrecognized load type in Product: " + type); - type = "*ALL"; - } - return type; - } - - - // Gets the "product option" from the product, and strips leading zero's. - private static String getProductOption(Product product) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - String option = product.getProductOption(); - if (option == null) { - Trace.log(Trace.ERROR, "Product.getProductOption() returned null."); - return ""; - } - // Strip any leading zero's. - for (int i=0; itrue if the two instances are equal - **/ - public boolean equals(Object obj) - { - if (obj == null) return false; - try - { - SaveFileEntry other = (SaveFileEntry)obj; - - // Note: Since SaveFileEntry objects can only be created internally by the Toolbox, we can guarantee that all instance variables are non-null. - if (!objName_.equals(other.getName())) return false; - else if (!libSaved_.equals(other.getLibrary())) return false; - else if (!objType_.equals(other.getType())) return false; - else if (!dloName_.equals(other.getDLOName())) return false; - else if (!folder_.equals(other.getFolder())) return false; - else if (!aspDevName_.equals(other.getASPDevice())) return false; - else if (asp_ != other.getASP()) return false; - else return true; - } - catch (Throwable e) { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, e); - return false; - } - } - - - /** - Returns the name of the object saved. If the object is a DLO object, this field will contain the system name of the object. - @return The object name. - **/ - public String getName() - { - return objName_; - } - - /** - Returns the name of the library from which the object is saved. - @return the object library. - **/ - public String getLibrary() - { - return libSaved_; - } - - /** - Returns the type of object. For examples: *LIB, *PGM, or *FILE. - @return The object type. - **/ - public String getType() - { - return objType_; - } - - - /** - Returns extended information about the object type. If there is no extended information, returns an empty String. - @return The object's extended information. - **/ - public String getExtendedObjectAttribute() - { - return extObjAttr_; - } - - /** - Returns the time at which the object was saved. - @return The object save date. - **/ - public Date getSaveDate() - { - return (Date)saveDateTime_.clone(); // return a copy - } - - /** - Returns the total size of the object in bytes. - @return The object size in bytes. - **/ - public long getSize() - { - return ((long)objSize_ * (long)objSizeMult_); - // From the API reference ("List Save File" (QSRLSAVF) API): - // - // Object size: The size of the object in units of the size multiplier. The true object size is equal to or smaller than the object size multiplied by the object size multiplier. - // - // Object size multiplier: The value to multiply the object size by to get the true size. The value is 1 if the object is smaller than or equal to 999 999 999 bytes, 1024 if it is larger than 999 999 999 but smaller than or equal to 4 294 967 295, and 4096 if larger than 4 294 967 295. - } - - /** - Returns the auxiliary storage pool (ASP) of the object when it was saved. - @return The auxiliary storage pool. - **/ - public int getASP() - { - return asp_; - } - - /** - Indicates whether the data for this object was saved with the object. - @return true if the data was saved; false otherwise. - **/ - public boolean isDataSaved() - { - return (dataSaved_.equals("1") ? true : false); - } - - /** - Returns the name of the object owner's user profile. - @return The object owner. - **/ - public String getOwner() - { - return objOwner_; - } - - /** - Returns the document library object (DLO) name. This is the name of the document, folder, or mail object that was saved. If the save file does not contain DLO information, this field will be an empty String. - @return The DLO name. - **/ - public String getDLOName() - { - return dloName_; - } - - /** - Returns the name of the folder that was saved. If the object is not a *FLR or *DOC object, this field will be empty. For *DOC and *FLR objects, this field will be set to the qualified name of the folder or to *NONE. - @return The folder. - **/ - public String getFolder() - { - return folder_; - } - - /** - Returns the text description of the object. - @return The description. - **/ - public String getDescription() - { - return desc_; - } - - /** - Returns the auxiliary storage pool device name. This is the name of the independent auxiliary storage pool (ASP) device of the object when it was saved. - @return The ASP device name. - **/ - public String getASPDevice() - { - return aspDevName_; - } - - /** - Returns a hash code value for the object. - @return A hash code value for this object. - **/ - public int hashCode() - { - // We must conform to the invariant that equal objects must have equal hashcodes. - return (objName_.hashCode() + libSaved_.hashCode() + objType_.hashCode() + dloName_.hashCode() + folder_.hashCode() + aspDevName_.hashCode() + asp_ ); - } - - - /** - Returns the String representation of this object. - @return The String representation of this object. - **/ - public String toString() - { - return "SaveFileEntry (name: " + objName_ + "; library: "+ libSaved_+ "; type: "+ objType_ + "): " + super.toString(); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/SecureAS400.java b/cvsroot/src/com/ibm/as400/access/SecureAS400.java deleted file mode 100644 index 644506007..000000000 --- a/cvsroot/src/com/ibm/as400/access/SecureAS400.java +++ /dev/null @@ -1,364 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SecureAS400.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -// Note: This class was moved 10/20/2010 from the include tree to the -// src tree. The class was also changed to use reflection to -// access SSLight. -/////////////////////////////////////////////////////////////////////////////// - - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.lang.reflect.Method; - -import com.ibm.as400.security.auth.ProfileTokenCredential; - -/** - Represents a secure system sign-on. Secure Sockets Layer (SSL) connections are used to provide encrypted communications. This function requires an SSL capable system at release V4R4 or later. - **/ -public class SecureAS400 extends AS400 -{ - static final long serialVersionUID = 4L; - /** - Constant indicating that encryption should only be done on the connection between the client and the proxy server. - **/ - public static final int CLIENT_TO_PROXY_SERVER = 1; - - /** - Constant indicating that encryption should only be done on the connection between the proxy server and the system. - **/ - public static final int PROXY_SERVER_TO_SERVER = 2; - - /** - @deprecated Use CLIENT_TO_SERVER instead. - **/ - public static final int CLINT_TO_SERVER = 3; - - /** - Constant indicating that encryption should be done in both the connection between the client and the proxy server and the connection between the proxy server and the system. - **/ - public static final int CLIENT_TO_SERVER = 3; - - private void construct() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Turning SSL connections on."); - useSSLConnection_ = new SSLOptions(); - - // Check for proxy encryption mode system property, if not set or not valid retain default of 3. - String prop = SystemProperties.getProperty(SystemProperties.SECUREAS400_PROXY_ENCRYPTION_MODE); - if (prop != null && (prop.equals("1") || prop.equals("2"))) - { - useSSLConnection_.proxyEncryptionMode_ = Integer.parseInt(prop); - } - - // Check for use sslight system property, if not set or not valid retain default of false. - prop = SystemProperties.getProperty(SystemProperties.SECUREAS400_USE_SSLIGHT); - if (prop != null && prop.equalsIgnoreCase("true")) - { - useSSLConnection_.useSslight_ = true; - } - } - - /** - Constructs a SecureAS400 object. - **/ - public SecureAS400() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SecureAS400 object."); - construct(); - } - - /** - Constructs a SecureAS400 object. It uses the specified system name. - @param systemName The name of the system. - **/ - public SecureAS400(String systemName) - { - super(systemName); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SecureAS400 object."); - construct(); - } - - /** - Constructs a SecureAS400 object. It uses the specified system name and user ID. When the sign-on prompt is displayed, the user is able to specify the password. Note that the user ID may be overridden. - @param systemName The name of the system. - @param userId The user profile name to use to authenticate to the system. - **/ - public SecureAS400(String systemName, String userId) - { - super(systemName, userId); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SecureAS400 object."); - construct(); - } - - /** - Constructs a SecureAS400 object. It uses the specified system name and profile token. - @param systemName The name of the system. Use localhost to access data locally. - @param profileToken The profile token to use to authenticate to the system. - **/ - public SecureAS400(String systemName, ProfileTokenCredential profileToken) - { - super(systemName, profileToken); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SecureAS400 object."); - construct(); - } - - /** - Constructs a SecureAS400 object. It uses the specified system name, user ID, and password. No sign-on prompt is displayed unless the sign-on fails. - @param systemName The name of the system. - @param userId The user profile name to use to authenticate to the system. - @param password The user profile password to use to authenticate to the system. - **/ - public SecureAS400(String systemName, String userId, String password) - { - super(systemName, userId, password); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SecureAS400 object."); - construct(); - } - - /** - Constructs a SecureAS400 object. It uses the specified system, user ID, and password. No sign-on prompt is displayed unless the sign-on fails. - @param systemName The name of the system. - @param userId The user profile name to use to authenticate to the system. - @param password The user profile password to use to authenticate to the system. - @param proxyServer The name and port in the format serverName[:port]. If no port is specified, a default will be used. - **/ - public SecureAS400(String systemName, String userId, String password, String proxyServer) - { - super(systemName, userId, password, proxyServer); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SecureAS400 object."); - construct(); - } - - /** - Constructs a SecureAS400 object. It uses the same system name and user ID. This does not create a clone. The new SecureAS400 object has the same behavior, but results in a new set of socket connections. - @param system A previously instantiated AS400 or SecureAS400 object. - **/ - public SecureAS400(AS400 system) - { - super(system); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SecureAS400 object."); - construct(); - - // If passed in system has SSL options, deep copy them. - if (system.useSSLConnection_ != null) - { - useSSLConnection_.keyRingName_ = system.useSSLConnection_.keyRingName_; - useSSLConnection_.keyRingPassword_ = system.useSSLConnection_.keyRingPassword_; - useSSLConnection_.proxyEncryptionMode_ = system.useSSLConnection_.proxyEncryptionMode_; - } - } - - /** - Validates the user ID and password against the system, and if successful, adds the information to the password cache. - @param systemName The name of the system. - @param userId The user profile name. - @param password The user profile password. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public static void addPasswordCacheEntry(String systemName, String userId, String password) throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding password cache entry, system name: '" + systemName + "' user ID: '" + userId + "'"); - addPasswordCacheEntry(new SecureAS400(systemName, userId, password)); - } - - /** - Validates the user ID and password against the system, and if successful, adds the information to the password cache. - @param systemName The name of the system. - @param userId The user profile name. - @param password The user profile password. - @param proxyServer The name and port in the format serverName[:port]. If no port is specified, a default will be used. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - **/ - public static void addPasswordCacheEntry(String systemName, String userId, String password, String proxyServer) throws AS400SecurityException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding password cache entry, system name: '" + systemName + "' user ID: '" + userId + "' proxy server: '" + proxyServer + "'"); - addPasswordCacheEntry(new SecureAS400(systemName, userId, password, proxyServer)); - } - - /** - Returns the key ring class name used for SSL communications with the system. The class com.ibm.as400.access.KeyRing is the default and will be returned if not overridden. - @return The key ring class name. - **/ - public String getKeyRingName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting key ring name: " + useSSLConnection_.keyRingName_); - return useSSLConnection_.keyRingName_; - } - - /** - Returns the proxy encryption mode. The proxy encryption mode specifies which portions of the communications between the client, proxy server, and IBM i system are encrypted. - @return The proxy encryption mode. - **/ - public int getProxyEncryptionMode() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting proxy encryption mode:", useSSLConnection_.proxyEncryptionMode_); - return useSSLConnection_.proxyEncryptionMode_; - } - - /** - Sets the key ring class name used for SSL communications with the system. The default class name that will be used if this method is not called is com.ibm.as400.access.KeyRing. - @param keyRingName The key ring class name. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setKeyRingName(String keyRingName) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting key ring name: " + keyRingName); - if (propertiesFrozen_) - { - Trace.log(Trace.ERROR, "Cannot set key ring class name after connection has been made."); - throw new ExtendedIllegalStateException("keyRingName", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - if (keyRingName == null) { - throw new NullPointerException("keyRingName"); - } - - String oldValue = useSSLConnection_.keyRingName_; - String newValue = keyRingName; - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("keyRingName", oldValue, newValue); - } - - useSSLConnection_.keyRingName_ = keyRingName; - try - { - // SSLight has been depreciated. Access via reflection to avoid the need to use this jar - Class ssLightKeyRingClass = Class.forName(keyRingName); - Object ssLightKeyRing = ssLightKeyRingClass.newInstance(); - Class[] parameterTypes = new Class[0]; - Method getKeyRindDataMethod = ssLightKeyRingClass.getMethod("getKeyRingData", parameterTypes); - Object[] args = new Object[0]; - useSSLConnection_.keyRingData_ = (String) getKeyRindDataMethod.invoke(ssLightKeyRing, args); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Value of parameter 'keyRingName' is not valid: " + keyRingName, e); - throw new ExtendedIllegalArgumentException("keyRingName (" + keyRingName + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("keyRingName", oldValue, newValue); - } - } - - /** - Sets the key ring class name used for SSL communications with the system. The default class name that will be used if this method is not called is com.ibm.as400.access.KeyRing. - @param keyRingName The key ring class name. - @param keyRingPassword The password for the key ring class. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setKeyRingName(String keyRingName, String keyRingPassword) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting key ring name: " + keyRingName); - if (propertiesFrozen_) - { - Trace.log(Trace.ERROR, "Cannot set key ring class name after connection has been made."); - throw new ExtendedIllegalStateException("keyRingName", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - if (keyRingName == null) { - throw new NullPointerException("keyRingName"); - } - - String oldValue = useSSLConnection_.keyRingName_; - String newValue = keyRingName; - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("keyRingName", oldValue, newValue); - } - - useSSLConnection_.keyRingName_ = keyRingName; - useSSLConnection_.keyRingPassword_ = keyRingPassword; - try - { - // SSLight has been depreciated. Access via reflection to avoid the need to use this jar - Class ssLightKeyRingClass = Class.forName(keyRingName); - Object ssLightKeyRing = ssLightKeyRingClass.newInstance(); - Class[] parameterTypes = new Class[0]; - Method getKeyRindDataMethod = ssLightKeyRingClass.getMethod("getKeyRingData", parameterTypes); - Object[] args = new Object[0]; - useSSLConnection_.keyRingData_ = (String) getKeyRindDataMethod.invoke(ssLightKeyRing, args); - - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Value of parameter 'keyRingName' is not valid: " + keyRingName, e); - throw new ExtendedIllegalArgumentException("keyRingName (" + keyRingName + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("keyRingName", oldValue, newValue); - } - } - - /** - Sets the key ring password used for SSL communications with the system. - @param keyRingPassword The password for the key ring class. - **/ - public void setKeyRingPassword(String keyRingPassword) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting key ring password."); - if (propertiesFrozen_) - { - Trace.log(Trace.ERROR, "Cannot set key ring class password after connection has been made."); - throw new ExtendedIllegalStateException("keyRingPassword", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - useSSLConnection_.keyRingPassword_ = keyRingPassword; - } - - /** - Sets the proxy encryption mode. The proxy encryption mode specifies which portions of the communications between the client, proxy server, and IBM i system are encrypted. The default is to encrypt all communications. This value is ignored if a proxy server is not used. -
    Valid proxy encryption modes are: -
    {@link #CLIENT_TO_PROXY_SERVER CLIENT_TO_PROXY_SERVER} - encrypt between client and proxy server. -
    {@link #PROXY_SERVER_TO_SERVER PROXY_SERVER_TO_SERVER} - encrypt between proxy server and IBM i system. -
    {@link #CLIENT_TO_SERVER CLIENT_TO_SERVER} - encrypt both portions of connection. - @param proxyEncryptionMode The proxy encryption mode. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setProxyEncryptionMode(int proxyEncryptionMode) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting proxy encryption mode:", proxyEncryptionMode); - // Validate parameter. - if (proxyEncryptionMode < CLIENT_TO_PROXY_SERVER || - proxyEncryptionMode > CLIENT_TO_SERVER) - { - Trace.log(Trace.ERROR, "Value of parameter 'proxyEncryptionMode' is not valid:", proxyEncryptionMode); - throw new ExtendedIllegalArgumentException("proxyEncryptionMode (" + proxyEncryptionMode + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (propertiesFrozen_) - { - Trace.log(Trace.ERROR, "Cannot set proxy encryption mode after connection has been made."); - throw new ExtendedIllegalStateException("proxyEncryptionMode", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - Integer oldValue = new Integer(useSSLConnection_.proxyEncryptionMode_); - Integer newValue = new Integer(proxyEncryptionMode); - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("proxyEncryptionMode", oldValue, newValue); - } - - useSSLConnection_.proxyEncryptionMode_ = proxyEncryptionMode; - - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("proxyEncryptionMode", oldValue, newValue); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SecureAS40016.gif b/cvsroot/src/com/ibm/as400/access/SecureAS40016.gif deleted file mode 100644 index d74d7cb1d..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/SecureAS40016.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/SecureAS40032.gif b/cvsroot/src/com/ibm/as400/access/SecureAS40032.gif deleted file mode 100644 index 263c168d1..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/SecureAS40032.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/SecureAS400BeanInfo.java b/cvsroot/src/com/ibm/as400/access/SecureAS400BeanInfo.java deleted file mode 100644 index 3a1cf2734..000000000 --- a/cvsroot/src/com/ibm/as400/access/SecureAS400BeanInfo.java +++ /dev/null @@ -1,106 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: SecureAS400BeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; - -/** - The SecureAS400BeanInfo class provides bean information for the SecureAS400 class. - **/ -public class SecureAS400BeanInfo extends AS400BeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Class this bean info represents. - private static final Class BEAN_CLASS = SecureAS400.class; - - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - PropertyDescriptor keyRingName = new PropertyDescriptor("keyRingName", BEAN_CLASS); - keyRingName.setBound(true); - keyRingName.setConstrained(true); - keyRingName.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SECUREAS400_KEYRINGNAME")); - keyRingName.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SECUREAS400_KEYRINGNAME")); - - PropertyDescriptor keyRingPassword = new PropertyDescriptor("keyRingPassword", BEAN_CLASS, null, "setKeyRingPassword"); - keyRingPassword.setBound(false); - keyRingPassword.setConstrained(false); - keyRingPassword.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SECUREAS400_KEYRINGPASSWORD")); - keyRingPassword.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SECUREAS400_KEYRINGPASSWORD")); - - PropertyDescriptor proxyEncryptionMode = new PropertyDescriptor("proxyEncryptionMode", BEAN_CLASS); - proxyEncryptionMode.setBound(true); - proxyEncryptionMode.setConstrained(true); - proxyEncryptionMode.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SECUREAS400_PROXYENCRYPTIONMODE")); - proxyEncryptionMode.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SECUREAS400_PROXYENCRYPTIONMODE")); - - propertyDescriptors = new PropertyDescriptor[AS400BeanInfo.propertyDescriptors.length + 3]; - System.arraycopy(AS400BeanInfo.propertyDescriptors, 0, propertyDescriptors, 0, AS400BeanInfo.propertyDescriptors.length); - propertyDescriptors[propertyDescriptors.length - 3] = keyRingName; - propertyDescriptors[propertyDescriptors.length - 2] = keyRingPassword; - propertyDescriptors[propertyDescriptors.length - 1] = proxyEncryptionMode; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - // Note: The parent's method grabs parent's BEAN_CLASS (AS400.class). - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("SecureAS40016.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("SecureAS40032.gif"); - } - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SequentialFile.java b/cvsroot/src/com/ibm/as400/access/SequentialFile.java deleted file mode 100644 index a9024116d..000000000 --- a/cvsroot/src/com/ibm/as400/access/SequentialFile.java +++ /dev/null @@ -1,467 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SequentialFile.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.net.UnknownHostException; -import java.io.Serializable; - -/** - *The SequentialFile class represents a physical or logical file on the system. - *The SequentialFile class allows the user to do the following: - *

      - *
    • Create a physical file by: - *
        - *
      • Specifying a record length. - *
      • Specifying an existing DDS source file. - *
      • Specifying a RecordFormat object that contains a description of the - * record format for the file. - *
      - *
    • Access the records in a file sequentially or by record number. - * Note: To read a keyed physical or logical file sequentially and have the records - * returned in key order, use the read...() methods of {@link KeyedFile KeyedFile}. - *
    • Write records to a file sequentially. - *
    • Update records in a file sequentially or by record number. - *
    • Lock a file for different types of access. - *
    • Use commitment control when accessing a file. The user can: - *
        - *
      • Start commitment control for the connection. - *
      • Specify different commitment control lock levels for the individual - * files being accessed. - *
      • Commit and rollback transactions for the connection. - *
      - *
    • Delete a physical or logical file or member. - *
    - *SequentialFile objects generate the following events: - *
      - *
    • FileEvent - *
      The events fired are: - *
        - *
      • FILE_CLOSED - *
      • FILE_CREATED - *
      • FILE_DELETED - *
      • FILE_MODIFIED - *
      • FILE_OPENED - *
      - *
    • PropertyChangeEvent - *
    • VetoableChangeEvent - *
    - *@see MemberList -**/ -public class SequentialFile extends AS400File implements Serializable -{ - static final long serialVersionUID = 4L; - - - - /** - *Constructs a SequentialFile object. - **/ - public SequentialFile() - { - - } - - /** - *Constructs a SequentialFile object. It uses the - * system and file name specified. - *If the name for the file does not include a member, the - *first member of the file will be used. - *@param system The system to which to connect. The system cannot - *be null. - *@param name The integrated file system pathname of the file. The name - *cannot be null. - **/ - public SequentialFile(AS400 system, String name) - { - super(system, name); - } - - /** - *Deletes the record specified by record number. The file must be open when - *invoking this method. - *@param recordNumber The record number of the record to be deleted. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void deleteRecord(int recordNumber) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Find the record - positionCursor(recordNumber); - // Call super to delete it - deleteCurrentRecord(); - } - - //@C0D - moved open(...) code to base class - /** - *Opens the file. The file must not be open when invoking this method. - *If commitment control is not started for the connection, - *commitLockLevel is ignored. The file cursor is positioned prior - *to the first record. If blockingFactor is greater than one (or - *if zero is specified and a blocking factor greater than one is determined - *by the object) and the file is opened for READ_ONLY, the record cache will - *be filled with an initial set of records.
    - *The record format for the file must be set prior to calling this method.
    - *The name of the file and the system to which to connect must be set prior - *to invoking this method. - *@see AS400File#AS400File(com.ibm.as400.access.AS400, java.lang.String) - *@see AS400File#setPath - *@see AS400File#setSystem - *@see AS400File#refreshRecordCache - *@see AS400File#setRecordFormat - *@param openType The manner in which to open the file. Valid values are: - *
      - *
    • READ_ONLY - *
    • READ_WRITE - *
    • WRITE_ONLY - *
    - *@param blockingFactor The number of records to retrieve or to write during a - *read or write operation.
    - *The AS400File object will attempt to anticipate the need for data by accessing - *blocks of records if the openType is READ_ONLY. If the openType - *is WRITE_ONLY, blockingFactor number of records will be written at one - *time when writing an array of records. - *If the open type is READ_WRITE, blockingFactor is ignored and a - *blocking factor of 1 will be used for data integrity reasons. - *Specify an appropriate blockingFactor for your performance needs.
    - *If 0 is specified for blockingFactor, a default value will be calculated - *by taking the integer result of dividing 2048 by the byte length of the record - *plus 16.
    - *If the user either specifies a blocking factor greater than 1 or specifies 0, - *which will cause a blocking factor to be calculated, there is the risk of - *obtaining stale data when doing multiple read operations. - *Invoke the refreshRecordCache() method prior to reading a record to cause the object - *to read from the system if this is a problem.
    - *@param commitLockLevel Used to control record locking during a transaction if - *commitment control has been started for the connection. - *Valid values are: - *
      - *
    • COMMIT_LOCK_LEVEL_ALL - *
    • COMMIT_LOCK_LEVEL_CHANGE - *
    • COMMIT_LOCK_LEVEL_CURSOR_STABILITY - *
    • COMMIT_LOCK_LEVEL_DEFAULT - *
    • COMMIT_LOCK_LEVEL_NONE - *
    - *The commitLockLevel is ignored if commitment control is not started for - *the connection. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ -/*@C0D public void open(int openType, int blockingFactor, int commitLockLevel) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - // Verify the object state - if (recordFormat_ == null) - { - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - // Verify the parameters - if (openType != READ_ONLY && - openType != READ_WRITE && - openType != WRITE_ONLY) - { - throw new ExtendedIllegalArgumentException("openType", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (blockingFactor < 0) - { - throw new ExtendedIllegalArgumentException("blockingFactor", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (commitLockLevel < 0 || commitLockLevel > 4) - { - throw new ExtendedIllegalArgumentException("commitLockLevel", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - openFile(openType, blockingFactor, commitLockLevel, "seq"); - } -*/ // @C0D - - /** - *Positions the file cursor to the first record whose record number - *matches the specified record number. The file must be open when invoking - *this method. - *@param recordNumber The record number of the record at which to position the - *cursor. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void positionCursor(int recordNumber) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - verifyState(recordNumber); //@C0A - impl_.doIt("positionCursor", new Class[] { Integer.TYPE }, new Object[] { new Integer(recordNumber) }); - } - - - /** - *Positions the file cursor to the first record after the record specified - *by the record number. The file must be open when invoking - *this method. - *@param recordNumber The record number of the record after which to position the - * cursor. The recordNumber must be greater than zero. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void positionCursorAfter(int recordNumber) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - positionCursor(recordNumber); // This will cause the cache to be refreshed if we - // are caching and the record is not in the cache - positionCursorToNext(); // This will do the same, however at this point - // the record will be in the cache if caching - } - - /** - *Positions the file cursor to the first record before the record specified - *by the record number. The file must be open when invoking - *this method. - *@param recordNumber The record number of the record before which to position - * the cursor. The recordNumber must be greater than zero. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void positionCursorBefore(int recordNumber) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - verifyState(recordNumber); //@C0A - impl_.doIt("positionCursorBefore", new Class[] { Integer.TYPE }, new Object[] { new Integer(recordNumber) }); - } - - - /** - *Reads the record with the specified record number. The file must be open - *when invoking this method. - *@param recordNumber The record number of the record to be read. The - *recordNumber must be greater than zero. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record read(int recordNumber) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - verifyState(recordNumber); //@C0A - return fillInRecord(impl_.doItRecord("read", new Class[] { Integer.TYPE }, new Object[] { new Integer(recordNumber) })); //@D0C - } - - - /** - *Reads the first record after the record with the specified record number. - *The file must be open when invoking this method. - *@param recordNumber record number of the record prior to the record to be read. - *The recordNumber must be greater than zero. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record readAfter(int recordNumber) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - verifyState(recordNumber); //@C0A - return fillInRecord(impl_.doItRecord("readAfter", new Class[] { Integer.TYPE }, new Object[] { new Integer(recordNumber) })); //@D0C - } - - - /** - *Reads all the records in the file. The file must be closed when invoking this method. - *The record format for the file must have been set prior to invoking this method. - *@return The records read. If no records are read, an array of size zero is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - *@exception ServerStartupException If the host server cannot be started. - *@exception UnknownHostException If the system cannot be located. - **/ - public Record[] readAll() - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (isOpen_) - { - throw new ExtendedIllegalStateException(ExtendedIllegalStateException.OBJECT_CAN_NOT_BE_OPEN); - } - if (recordFormat_ == null) - { - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Read all records. - // Since readAll() now behaves under-the-covers like readNext(), - // need to open the file. Also synchronize on this, because - // the file isn't supposed to be open and this might mess up - // other references to this object, which expect it to be closed. - // See AS400FileImplRemote.readAll() for information regarding - // changes in the under-the-covers behavior. - chooseImpl(); - - // Before we calculate, make sure the record format has had - // its text objects initialized. - recordFormat_.initializeTextObjects(system_); //@D0A - - // Use a calculated blocking factor, else use a large blocking factor - int bf = 2048/(recordFormat_.getNewRecord().getRecordLength() + 16); //@D0M - if (bf <= 1) bf = 100; //@D0M - - Record[] recs = impl_.doItRecordArray("readAll", new Class[] { String.class, Integer.TYPE }, new Object[] { "seq", new Integer(bf) }); //@D0C - //@D0A - if (recs != null) - { - for (int i=0; irecordNumber must be greater than zero. - *@return The record read. If the record is not found, null is returned. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public Record readBefore(int recordNumber) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - verifyState(recordNumber); //@C0A - return fillInRecord(impl_.doItRecord("readBefore", new Class[] { Integer.TYPE }, new Object[] { new Integer(recordNumber) })); //@D0C - } - - - /** - *Overrides the ObjectInputStream.readObject() method in order to return any - *transient parts of the object to there properly initialized state. We also - *generate a declared file name for the object. I.e we in effect - *call the null constructor. By calling ObjectInputStream.defaultReadObject() - *we restore the state of any non-static and non-transient variables. We - *then continue on to restore the state (as necessary) of the remaining varaibles. - *@param in The input stream from which to deserialize the object. - *@exception ClassNotFoundException If the class being deserialized is not found. - *@exception IOException If an error occurs while communicating with the system. - **/ - - private void readObject(ObjectInputStream in) - throws ClassNotFoundException, - IOException - { - in.defaultReadObject(); - initializeTransient(); //@C0C - } - - - /** - *Updates the record at the position specified by the record number. The file - *must be open when invoking this method. - *@param recordNumber The record number of the record to update. - *The recordNumber must be greater than zero. - *@param record The record with which to update. - *@exception AS400Exception If the system returns an error message. - *@exception AS400SecurityException If a security or authority error occurs. - *@exception ConnectionDroppedException If the connection is dropped unexpectedly. - *@exception InterruptedException If this thread is interrupted. - *@exception IOException If an error occurs while communicating with the system. - **/ - public void update(int recordNumber, Record record) - throws AS400Exception, - AS400SecurityException, - InterruptedException, - IOException - { - if (record == null) - { - throw new NullPointerException("record"); - } - positionCursor(recordNumber); - update(record); - } - - - //@C0A - /** - * Make sure the file is open and the recordNumber is valid. - **/ - private void verifyState(int recordNumber) - { - // Verify object state - if (!isOpen_) - { - throw new ExtendedIllegalStateException(ExtendedIllegalStateException.OBJECT_MUST_BE_OPEN); - } - // Verify parameters - if (recordNumber < 1) - { - throw new ExtendedIllegalArgumentException("recordNumber", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SequentialFile16.gif b/cvsroot/src/com/ibm/as400/access/SequentialFile16.gif deleted file mode 100644 index 277f5a9d0..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/SequentialFile16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/SequentialFile32.gif b/cvsroot/src/com/ibm/as400/access/SequentialFile32.gif deleted file mode 100644 index 033321497..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/SequentialFile32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/SequentialFileBeanInfo.java b/cvsroot/src/com/ibm/as400/access/SequentialFileBeanInfo.java deleted file mode 100644 index 57f69c12e..000000000 --- a/cvsroot/src/com/ibm/as400/access/SequentialFileBeanInfo.java +++ /dev/null @@ -1,226 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SequentialFileBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2008 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// @A1 12/12/2007 Correct EventSet for VetoablePropertyChange -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.lang.reflect.Method; //@B0A - -/** - *The SequentialFileBeanInfo class represents bean information for the SequentialFile class. -**/ -public class SequentialFileBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Bean class - private final static Class beanClass_ = SequentialFile.class; - - - // BeanDescriptor for this class - private static BeanDescriptor beanDescriptor_ = new BeanDescriptor(SequentialFile.class); - - - // Set of event descriptors for this class: - // PropertyChange, VetoableChange, RecordDescriptionEvent.FIELD_MODIFIED - private static EventSetDescriptor[] eventSet_ = new EventSetDescriptor[3]; - - - // Set of property descriptors for this class - // memberName, fileName, recordFormat, path, system - private static PropertyDescriptor[] propertySet_ = new PropertyDescriptor[5]; - - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - - public SequentialFileBeanInfo() - { - try - { - // Populate the event descriptor set - // FileEvent - String[] listenerMethods = {"fileClosed", "fileCreated", "fileDeleted", - "fileModified", "fileOpened"}; - eventSet_[0] = new EventSetDescriptor(beanClass_, "file", - FileListener.class, - listenerMethods, "addFileListener", - "removeFileListener"); - eventSet_[0].setDisplayName(loader_.getText("EVT_NAME_FILE_EVENT")); - eventSet_[0].setShortDescription(loader_.getText("EVT_DESC_FILE_EVENT")); - - - // PropertyChangeEvent - eventSet_[1] = new EventSetDescriptor(beanClass_, "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - eventSet_[1].setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - eventSet_[1].setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - - // VetoablePropertyChange - eventSet_[2] = new EventSetDescriptor(beanClass_, "propertyChange", //@A1C - java.beans.VetoableChangeListener.class, - "vetoableChange"); - eventSet_[2].setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - eventSet_[2].setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - } - catch(IntrospectionException e) - { - throw new Error(e.toString()); - } - - try - { - // Populate the property descriptor set - // getFileName - propertySet_[0] = new PropertyDescriptor("fileName", beanClass_, - "getFileName", null); - propertySet_[0].setBound(true); - propertySet_[0].setConstrained(false); - propertySet_[0].setDisplayName(loader_.getText("PROP_NAME_FILE_NAME")); - propertySet_[0].setShortDescription(loader_.getText("PROP_DESC_FILE_NAME")); - - - // getKeyFields - propertySet_[1] = new PropertyDescriptor("memberName", beanClass_, - "getMemberName", null); - propertySet_[1].setBound(true); - propertySet_[1].setConstrained(false); - propertySet_[1].setDisplayName(loader_.getText("PROP_NAME_MEMBER")); - propertySet_[1].setShortDescription(loader_.getText("PROP_DESC_MEMBER")); - - - // get/setPath - propertySet_[2] = new PropertyDescriptor("path", beanClass_, - "getPath", - "setPath"); - propertySet_[2].setBound(true); - propertySet_[2].setConstrained(true); - propertySet_[2].setDisplayName(loader_.getText("PROP_NAME_PATH")); - propertySet_[2].setShortDescription(loader_.getText("PROP_DESC_PATH")); - - - // get/setRecordFormat -//@B0D propertySet_[3] = new PropertyDescriptor("recordFormat", beanClass_, -//@B0D "getRecordFormat", -//@B0D "setRecordFormat"); - Method getter = beanClass_.getMethod("getRecordFormat", (java.lang.Class [])null); //@B0A //@pdc cast for jdk1.5 - Method setter = beanClass_.getMethod("setRecordFormat", new Class[] { RecordFormat.class }); //@B0A - propertySet_[3] = new PropertyDescriptor("recordFormat", getter, setter); //@B0A - propertySet_[3].setBound(true); - propertySet_[3].setConstrained(true); - propertySet_[3].setDisplayName(loader_.getText("PROP_NAME_RECORD_FORMAT")); - propertySet_[3].setShortDescription(loader_.getText("PROP_DESC_RECORD_FORMAT")); - - - // get/setSystem - propertySet_[4] = new PropertyDescriptor("system", beanClass_, - "getSystem", - "setSystem"); - propertySet_[4].setBound(true); - propertySet_[4].setConstrained(true); - propertySet_[4].setDisplayName(loader_.getText("PROP_NAME_SYSTEM")); - propertySet_[4].setShortDescription(loader_.getText("PROP_DESC_SYSTEM")); - - } - catch(Exception e) //@B0C - { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) //@B0A - { //@B0A - Trace.log(Trace.ERROR, "Failed to initialize SequentialFileBeanInfo.", e); //@B0A - } //@B0A - throw new Error(e.toString()); - } - } - - /** - *Returns the bean descriptor. - *@return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - /** - *Returns the index of the default event. - *@return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the property change event - return 0; - } - - - /** - *Returns the index of the default property. - *@return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the default property - return 0; - } - - - /** - *Returns the set of event descriptors. - *@return The event descriptor set. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSet_; - } - - /** - *Returns the property descriptors. - *@return The property descriptors. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertySet_; - } - - /** - *Returns the icon image for a SequentialFile bean. - *@return The icon image. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("SequentialFile16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("SequentialFile32.gif"); - break; - } - return image; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SerializableInputStream.java b/cvsroot/src/com/ibm/as400/access/SerializableInputStream.java deleted file mode 100644 index 854b0d2c5..000000000 --- a/cvsroot/src/com/ibm/as400/access/SerializableInputStream.java +++ /dev/null @@ -1,88 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SerializableInputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.ByteArrayInputStream; - - -/** -The SerializableInputStream class can be used to encapsulate an InputStream -such that it is serializable. -**/ -class SerializableInputStream -extends java.io.InputStream -implements java.io.Serializable -{ - static final long serialVersionUID = 4L; - - // Private data. - private byte[] byteArray_; - private transient ByteArrayInputStream iStream_; - - - public SerializableInputStream (java.io.InputStream iStream) - throws IOException - { - // Assume that the arguments have been validated. - byteArray_ = new byte[iStream.available()]; - int bytesRead = iStream.read (byteArray_); - if (bytesRead < 1) { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Initial read() of 'iStream' into internal buffer returned " + bytesRead); - } - iStream_ = new ByteArrayInputStream (byteArray_); - } - - public int available() throws IOException - { return iStream_.available (); } - - public void close() throws IOException - { iStream_.close (); } - - public synchronized void mark(int readlimit) - { iStream_.mark (readlimit); } - - public boolean markSupported() - { return iStream_.markSupported (); } - - public int read() throws IOException - { return iStream_.read (); } - - public int read(byte b[]) throws IOException - { return iStream_.read (b); } - - public int read(byte b[], - int off, - int len) throws IOException - { return iStream_.read (b, off, len); } - - // This is called when the object is deserialized. - // Note that byteArray_ gets serialized/deserialized. - private void readObject (java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - // Restore the non-static and non-transient fields. - in.defaultReadObject (); - - iStream_ = new ByteArrayInputStream (byteArray_); - } - - public synchronized void reset() throws IOException - { iStream_.reset (); } - - public long skip(long n) throws IOException - { return iStream_.skip (n); } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/SerializableReader.java b/cvsroot/src/com/ibm/as400/access/SerializableReader.java deleted file mode 100644 index 7b0d1c5e3..000000000 --- a/cvsroot/src/com/ibm/as400/access/SerializableReader.java +++ /dev/null @@ -1,146 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: SerializableReader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharArrayReader; -import java.io.IOException; -import java.io.Reader; -import java.sql.SQLException; - - -/** -The SerializableReader class can be used to encapsulate a Reader object -such that it is serializable. -**/ -class SerializableReader -extends java.io.Reader -implements java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private char[] charArray_; - private transient CharArrayReader reader_; - - - - - public SerializableReader (java.io.Reader reader, int length) - throws IOException, SQLException - { - // Assume that the arguments have been validated. - charArray_ = new char[length]; - int numChars = reader.read (charArray_); - if (numChars != length || - reader.read() != -1) - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation (this, "Length parameter does not match actual length of buffer."); - throw new SQLException (); - } - reader_ = new CharArrayReader (charArray_); - } - - //@pda jdbc40 - public SerializableReader (java.io.Reader reader) - throws IOException, SQLException - { - // Assume that the arguments have been validated. - charArray_ = readerToChars( reader ); - reader_ = new CharArrayReader (charArray_); - } - - //@pda jdbc40 new method for unknown length. - /** - Reads a reader and returns its data as a Char[]. - Reads until reader returns -1 for eof. - - @param input The reader. - @return Char array of chars in reader. - - **/ - static final char[] readerToChars (Reader input) - throws SQLException - { - StringBuffer buffer = new StringBuffer (); - int actualLength = 0; - try { - - char[] rawChars = new char[32000]; - - while (input.ready ()) { - int length2 = input.read (rawChars); - if (length2 < 0) - break; - //buffer.append (new String (rawChars, 0, length2)); - buffer.append (rawChars, 0, length2); - actualLength += length2; - } - - } - catch (IOException e) { - JDError.throwSQLException (JDError.EXC_PARAMETER_TYPE_INVALID); - } - - char[] allChars = new char[actualLength]; - buffer.getChars(0, actualLength, allChars, 0); - return allChars; - } - - public void close() - { reader_.close (); } - - public void mark(int readAheadLimit) throws IOException - { reader_.mark (readAheadLimit); } - - public boolean markSupported() - { return reader_.markSupported (); } - - public int read() throws IOException - { return reader_.read (); } - - public int read(char b[], - int off, - int len) throws IOException - { return reader_.read (b, off, len); } - - // This is called when the object is deserialized. - // Note that charArray_ gets serialized/deserialized. - private void readObject (java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - // Restore the non-static and non-transient fields. - in.defaultReadObject (); - - reader_ = new CharArrayReader (charArray_); - } - - public boolean ready() throws IOException - { return reader_.ready (); } - - public void reset() throws IOException - { reader_.reset (); } - - public long skip(long n) throws IOException - { return reader_.skip (n); } - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/ServerStartupException.java b/cvsroot/src/com/ibm/as400/access/ServerStartupException.java deleted file mode 100644 index 806d1bf08..000000000 --- a/cvsroot/src/com/ibm/as400/access/ServerStartupException.java +++ /dev/null @@ -1,234 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ServerStartupException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - The ServerStartupException class represents an exception that indicates that a host server could not be started. - **/ -public class ServerStartupException extends IOException implements ReturnCodeException -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4; - - private int rc_; // Return code associated with this exception. - - /** - The return code indicating that it was unable to establish a connection. - **/ - public static final int CONNECTION_NOT_ESTABLISHED = 1; - /** - The return code indicating that it was unable to connect to the port. - **/ - public static final int CONNECTION_PORT_CANNOT_CONNECT_TO = 2; - /** - The return code indicating that it was unable to start the host server. - **/ - public static final int SERVER_NOT_STARTED = 3; - /** - The return code indicating that it was unable to connect to signon server. - **/ - public static final int SIGNON_CONNECT_FAILED = 4; - /** - The return code indicating that it was an invalid exchange random seed request. - **/ - public static final int RANDOM_SEED_EXCHANGE_INVALID = 5; - /** - The return code indicating that it was a request ID not valid. - **/ - public static final int REQUEST_ID_NOT_VALID = 6; - /** - The return code indicating that it was a random seed not valid. - **/ - public static final int RANDOM_SEED_INVALID = 7; - /** - The return code indicating that it was a random seed required when doing password substitute. - **/ - public static final int RANDOM_SEED_REQUIRED = 8; - /** - The return code indicating that the password encryption indicator is not valid. - **/ - public static final int PASSWORD_ENCRYPT_INVALID = 9; - /** - The return code indicating that the user ID length is not valid. - **/ - public static final int USERID_LENGTH_NOT_VALID = 10; - /** - The return code indicating that the password length is not valid. - **/ - public static final int PASSWORD_LENGTH_NOT_VALID = 11; - /** - The return code indicating that the send reply indicator is not valid. - **/ - public static final int SEND_REPLY_INVALID = 12; - /** - The return code indicating that the start host server request is not valid. - **/ - public static final int START_SERVER_REQUEST_NOT_VALID = 13; - /** - The return code indicating that it was an error in request data. - **/ - public static final int REQUEST_DATA_ERROR = 14; - /** - The return code indicating that there was an unknown error when starting the host server. - **/ - public static final int START_SERVER_UNKNOWN_ERROR = 15; - /** - The return code indicating that a host server ID is not valid. - **/ - public static final int SERVER_ID_NOT_VALID = 16; - /** - The return code indicating that there was an error passing the connection to the server job. Program data length is incorrect. - **/ - public static final int CONNECTION_NOT_PASSED_LENGTH = 17; - /** - The return code indicating that there was an error passing the connection to the server job. Server job timed out. - **/ - public static final int CONNECTION_NOT_PASSED_TIMEOUT = 18; - /** - The return code indicating that there was an error passing the connection to the server job. Server job could not be started. - **/ - public static final int CONNECTION_NOT_PASSED_SERVER_NOT_STARTED = 19; - /** - The return code indicating that there was an error passing the connection to the server job. Prestart job could not be started. - **/ - public static final int CONNECTION_NOT_PASSED_PRESTART_NOT_STARTED = 20; - /** - The return code indicating that there was an error passing the connection to the server job. Subsystem problem detected. - **/ - public static final int CONNECTION_NOT_PASSED_SUBSYSTEM = 21; - /** - The return code indicating that there was an error passing the connection to the server job. Server job is ending. - **/ - public static final int CONNECTION_NOT_PASSED_SERVER_ENDING = 22; - /** - The return code indicating that there was an error passing the connection to the server job. Receiver area is too small. - **/ - public static final int CONNECTION_NOT_PASSED_RECEIVER_AREA = 23; - /** - The return code indicating that there was an error passing the connection to the server job. Unknown or unrecoverable error occured. - **/ - public static final int CONNECTION_NOT_PASSED_UNKNOWN = 24; - /** - The return code indicating that there was an error passing the connection to the server job. User profile for server job does not exist. - **/ - public static final int CONNECTION_NOT_PASSED_PROFILE = 25; - /** - The return code indicating that there was an error passing the connection to the server job. User profile for server job does not have enough authority. - **/ - public static final int CONNECTION_NOT_PASSED_AUTHORITY = 26; - /** - The return code indicating that there was an error passing the connection to the server job. Server job program was not found. - **/ - public static final int CONNECTION_NOT_PASSED_PROGRAM_NOT_FOUND = 27; - /** - The return code indicating that there was an error passing the connection to the server job. Daemon job is not authorized to server job library. - **/ - public static final int CONNECTION_NOT_PASSED_LIBRARY_AUTHORITY = 28; - /** - The return code indicating that there was an error passing the connection to the server job. Daemon job is not authorized to server job program. - **/ - public static final int CONNECTION_NOT_PASSED_PROGRAM_AUTHORITY = 29; - - // Constructs a ServerStartupException object. It indicates that the host server can not be started. Exception message will look like this: Unable to connect to the port. - // @param returnCode The return code which identifies the message to be returned. - ServerStartupException(int returnCode) - { - // Create the message. - super(ResourceBundleLoader.getText(getMRIKey(returnCode))); - rc_ = returnCode; - } - - // Returns the text associated with the return code. - // @param returnCode The return code associated with this exception. - // @return The text string which describes the error. - // This method is required so the message can be created and sent in super(). - static String getMRIKey(int returnCode) - { - switch (returnCode) - { - case CONNECTION_NOT_ESTABLISHED: - return "EXC_CONNECTION_NOT_ESTABLISHED"; - case CONNECTION_PORT_CANNOT_CONNECT_TO: - return "EXC_CONNECTION_PORT_CANNOT_CONNECT_TO"; - case SERVER_NOT_STARTED: - return "EXC_SERVER_NOT_STARTED"; - case SIGNON_CONNECT_FAILED: - return "EXC_SIGNON_CONNECT_FAILED"; - case RANDOM_SEED_EXCHANGE_INVALID: - return "EXC_RANDOM_SEED_EXCHANGE_INVALID"; - case REQUEST_ID_NOT_VALID: - return "EXC_REQUEST_ID_NOT_VALID"; - case RANDOM_SEED_INVALID: - return "EXC_RANDOM_SEED_INVALID"; - case RANDOM_SEED_REQUIRED: - return "EXC_RANDOM_SEED_REQUIRED"; - case PASSWORD_ENCRYPT_INVALID: - return "EXC_PASSWORD_ENCRYPT_INVALID"; - case USERID_LENGTH_NOT_VALID: - return "EXC_USERID_LENGTH_NOT_VALID"; - case PASSWORD_LENGTH_NOT_VALID: - return "EXC_PASSWORD_LENGTH_NOT_VALID"; - case SEND_REPLY_INVALID: - return "EXC_SEND_REPLY_INVALID"; - case START_SERVER_REQUEST_NOT_VALID: - return "EXC_START_SERVER_REQUEST_NOT_VALID"; - case REQUEST_DATA_ERROR: - return "EXC_REQUEST_DATA_ERROR"; - case START_SERVER_UNKNOWN_ERROR: - return "EXC_START_SERVER_UNKNOWN_ERROR"; - case SERVER_ID_NOT_VALID: - return "EXC_SERVER_ID_NOT_VALID"; - case CONNECTION_NOT_PASSED_LENGTH: - return "EXC_CONNECTION_NOT_PASSED_LENGTH"; - case CONNECTION_NOT_PASSED_TIMEOUT: - return "EXC_CONNECTION_NOT_PASSED_TIMEOUT"; - case CONNECTION_NOT_PASSED_SERVER_NOT_STARTED: - return "EXC_CONNECTION_NOT_PASSED_SERVER_NOT_STARTED"; - case CONNECTION_NOT_PASSED_PRESTART_NOT_STARTED: - return "EXC_CONNECTION_NOT_PASSED_PRESTART_NOT_STARTED"; - case CONNECTION_NOT_PASSED_SUBSYSTEM: - return "EXC_CONNECTION_NOT_PASSED_SUBSYSTEM"; - case CONNECTION_NOT_PASSED_SERVER_ENDING: - return "EXC_CONNECTION_NOT_PASSED_SERVER_ENDING"; - case CONNECTION_NOT_PASSED_RECEIVER_AREA: - return "EXC_CONNECTION_NOT_PASSED_RECEIVER_AREA"; - case CONNECTION_NOT_PASSED_UNKNOWN: - return "EXC_CONNECTION_NOT_PASSED_UNKNOWN"; - case CONNECTION_NOT_PASSED_PROFILE: - return "EXC_CONNECTION_NOT_PASSED_PROFILE"; - case CONNECTION_NOT_PASSED_AUTHORITY: - return "EXC_CONNECTION_NOT_PASSED_AUTHORITY"; - case CONNECTION_NOT_PASSED_PROGRAM_NOT_FOUND: - return "EXC_CONNECTION_NOT_PASSED_PROGRAM_NOT_FOUND"; - case CONNECTION_NOT_PASSED_LIBRARY_AUTHORITY: - return "EXC_CONNECTION_NOT_PASSED_LIBRARY_AUTHORITY"; - case CONNECTION_NOT_PASSED_PROGRAM_AUTHORITY: - return "EXC_CONNECTION_NOT_PASSED_PROGRAM_AUTHORITY"; - default: - return "EXC_UNKNOWN"; // Bad return code was provided. - } - } - - /** - Returns the return code associated with this exception. - @return The return code. - **/ - public int getReturnCode() - { - return rc_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ServerTrace.java b/cvsroot/src/com/ibm/as400/access/ServerTrace.java deleted file mode 100644 index 0a4be86b2..000000000 --- a/cvsroot/src/com/ibm/as400/access/ServerTrace.java +++ /dev/null @@ -1,177 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ServerTrace.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** - The ServerTrace class enables server job tracing for the - server jobs that handle Toolbox requests. - The following jobs can be traced: -
    -
      -
    1. JDBC
      - The ServerTrace class can be used to trace JDBC server jobs. - Various types of traces can be started. These types include: -
        -
      • Database monitor -- same as CL command STRDBMON
        -
      • Debug the server job -- same as CL command STRDBG
        -
      • Save the server job's joblog -- same as CL command CHGJOB to change logging options
        -
      • Start trace on the server job -- same as CL command TRCJOB
        -
      • Save SQL information -- PRTSQLINF
        -
      - Tracing must be started before a connection is made to - the server since the client enables server tracing only at connect time. - Trace data is collected in spooled files on the server. The - various types of tracing can be turn on in any combination by adding the - constants that represent each type of trace. - For example, to start the - database monitor and save the job log: -
      -         ServerTrace.setJDBCServerTraceCategories(ServerTrace.JDBC_SAVE_SERVER_JOBLOG + ServerTrace.JDBC_START_DATABASE_MONITOR);
      -         // ...
      -
      -         Connection c = DriverManager.getConnection(url);
      -      
      - Server trace can also be started via the com.ibm.as400.access.ServerTrace.JDBC system property. - For example, -
      -         java -Dcom.ibm.as400.access.ServerTrace.JDBC=10 myClass
      -      
      -
    -**/ - - -class ServerTrace -{ - private static int JDBCServerTraceCategories_ = 0; - - - /** - Start tracing the JDBC client. This is the same as setting - property "trace=true"; Note the constant is not public. - It is defined only to be compatible with ODBC - The numeric value of this constant is 1. - **/ - static final int JDBC_TRACE_CLIENT = 1; - - /** - Start the database monitor on the JDBC server job. - The numeric value of this constant is 2. - **/ - static final int JDBC_START_DATABASE_MONITOR = 2; - - /** - Start debug on the JDBC server job. - The numeric value of this constant is 4. - **/ - static final int JDBC_DEBUG_SERVER_JOB = 4; - - /** - Save the joblog when the JDBC server job ends. - The numeric value of this constant is 8. - **/ - static final int JDBC_SAVE_SERVER_JOBLOG = 8; - - /** - Start job trace on the JDBC server job. - The numeric value of this constant is 16. - **/ - static final int JDBC_TRACE_SERVER_JOB = 16; - - /** - Save SQL information. - The numeric value of this constant is 32. This - option is valid when connecting to V5R1 and - newer versions of IBM i. - **/ - static final int JDBC_SAVE_SQL_INFORMATION = 32; - - - /** - Start the database host server trace. - The numeric value of this constant is 64. - This option is valid when connecting to V5R3 and - newer versions of IBM i. - **/ - static final int JDBC_TRACE_DATABASE_HOST_SERVER = 64; //@540 - - static - { - loadTraceProperties (); - } - - - - // This is only here to prevent the user from constructing a ServerTrace object. - private ServerTrace() - { - } - - - /** - * Gets the value of JDBC server tracing. Zero means tracing is - * disabled. - * @return JDBCServerTrace value. - **/ - static final int getJDBCServerTraceCategories() - { - return JDBCServerTraceCategories_; - } - - - - static void loadTraceProperties () - { - // The following section is new - // Load and apply the JDBC Server Trace value. - String value = SystemProperties.getProperty (SystemProperties.TRACE_JDBC_SERVER); - if (value != null) - { - try - { - JDBCServerTraceCategories_ = (new Integer(value)).intValue(); - } - catch (Exception e) - { - if (JDTrace.isTraceOn()) - JDTrace.logInformation("ServerTrace", "Value " + value + " for JDBCServerTrace is not valid."); - } - } - - } - - - /** - * Sets JDBC server tracing. - * Tracing must be started before a connection is made. - * @param categories Valid values are: - *
      - *
    • JDBC_START_DATABASE_MONITOR - start the database monitor - *
    • JDBC_DEBUG_SERVER_JOB - start debug on the server job - *
    • JDBC_SAVE_SERVER_JOBLOG - save the joblog when the server job ends - *
    • JDBC_TRACE_SERVER_JOB - start trace on the server job - *
    • JDBC_SAVE_SQL_INFORMATION - save SQL information - *
    • JDBC_TRACE_DATABASE_HOST_SERVER - start database host server trace - *
    - * The constants can be added together to start more than one type - * of tracing. - **/ - - static void setJDBCServerTraceCategories(int categories) - { - JDBCServerTraceCategories_ = categories; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/ServerVersion.java b/cvsroot/src/com/ibm/as400/access/ServerVersion.java deleted file mode 100644 index 613cc66af..000000000 --- a/cvsroot/src/com/ibm/as400/access/ServerVersion.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ServerVersion.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; - -class ServerVersion implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - int vrm_; - - // Create a version object. - // @param int version/release/modification. High 16 bits represent version next 8 bits represent release, low 8 bits represent modification. Thus Version 3, release 1, modification level 0 is 0x00030100. - ServerVersion(int vrm) - { - vrm_ = vrm; - } - - // Get the server version. - // @return Version of the server. - int getVersion() - { - return vrm_ >> 16 & 0x0000ffff; - } - - // Get the server release. - // @return Release of the server. - int getRelease() - { - return vrm_ >> 8 & 0x000000ff; - } - - // Get the modification level of the server. - // @return Modification level of the server. - int getModificationLevel() - { - return vrm_ & 0x000000ff; - } - - // Get the combined version, release and modification level of the server. - // @return Version/release/modification level where the high 16 bits is the version, next 8 bits the release, and low 8 bits the modification level. - int getVersionReleaseModification() - { - return vrm_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ServiceProgramCall.java b/cvsroot/src/com/ibm/as400/access/ServiceProgramCall.java deleted file mode 100644 index 996fc6fa8..000000000 --- a/cvsroot/src/com/ibm/as400/access/ServiceProgramCall.java +++ /dev/null @@ -1,517 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ServiceProgramCall.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1998-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.IOException; - -/** - Allows a user to call an IBM i service program. Input data is passed via input parameters, - and output data is accessed via output parameters. ProgramParameter objects are used to pass data - between the Java program and the service program. -

    Limitations of this class: -

      -
    • The service program must be on an IBM i system running V4R4 or later. -
    • Up to seven parameters can be passed to the service program. -
    • The return value must be void or numeric. This class does not support calling service programs - that return a pointer. -
    • Parameters can be "pass by reference" or "pass by value". -
        -
      • When pass by reference, the data is copied from Java storage to system storage, then a pointer to - the system storage is passed to the service program. -
      • Up to four bytes can be passed by value. Parameters longer than four bytes must be passed by - reference which may require a change to the service program. -
      • Procedures defined using "#pragma argopt" are not supported. -
      -
    -

    The name of the service program to call is the fully qualified name in the integrated file system. - The extension is ".SRVPGM". For example, to call MySrvPgm in MyLib, - the program name is /QSYS.LIB/MYLIB.LIB/MYSRVPGM.SRVPGM. -

    Service program entry point notes: -

      -
    • The service program entry point to call is supplied by the Java program. - The entry point name is case sensitive. If the run() method fails with the message - "CPF226E - Value for a parameter was not valid.", there is a good chance the entry point name is incorrect. -
    • The service program entry point name is converted from a Java String to an array of EBCDIC bytes before - being sent to the system. By default this conversion is performed using CCSID 37, - not the job CCSID which Toolbox classes usually use for conversion. This is because the entry point - name is set when the service program is built. CCSID 37 is the default because most IBM supplied service - programs set the entry point name based on CCSID 37. A setProcedureName() method exists which lets you - override the default. -
    -

    The following example calls procedure int_int in service program ENTRYPTS in library MYPGM. - The procedure takes one input parameter, an integer, and returns an integer. -

    - *    // Create a single parameter parameter list.
    - *    ProgramParameter[] parameterList = new ProgramParameter[1];
    - *
    - *    // Create the input parameter.  We are sending the number 9 to the service program.
    - *    AS400Bin4 bin4 = new AS400Bin4();
    - *    byte[] parameter = bin4.toBytes(9);
    - *    parameterList[0] = new ProgramParameter(parameter);
    - *
    - *    // Construct the system object.  The service program is on this system.
    - *    AS400 system = new AS400("mySystem");
    - *
    - *    // Construct the ServiceProgramCall object.
    - *    ServiceProgramCall sPGMCall = new ServiceProgramCall(system);
    - *
    - *    // Set the fully qualified service program and the parameter list.
    - *    sPGMCall.setProgram("/QSYS.LIB/MYPGM.LIB/ENTRYPTS.SRVPGM", parameterList);
    - *
    - *    // Set the procedure to call in the service program.
    - *    sPGMCall.setProcedureName("int_int");
    - *
    - *    // Set the format of returned value.  The program we call returns an integer.
    - *    sPGMCall.setReturnValueFormat(ServiceProgramCall.RETURN_INTEGER);
    - *
    - *    // Call the service program.
    - *    if (sPGMCall.run() != true)
    - *    {
    - *        // Get the error messages when the call fails.
    - *        AS400Message[] messageList = sPGMCall.getMessageList();
    - *        for (int i = 0; i < messageList.length; ++i)
    - *        {
    - *            System.out.println(messageList[i].getText());
    - *        }
    - *    }
    - *    else
    - *    {
    - *        // Get the returned value when the call is successful.
    - *        int i = bin4.toInt(sPGMCall.getReturnValue());
    - *        System.out.println("Result is: " + i);
    - *    }
    - 
    - **/ -public class ServiceProgramCall extends ProgramCall -{ - static final long serialVersionUID = 4L; - - /** - Constant indicating the service program returns void. - **/ - public static final int NO_RETURN_VALUE = 0; - - /** - Constant indicating the service program returns an integer. - **/ - public static final int RETURN_INTEGER = 1; - - // Constant indicating the service program returns an integer and an error number. Internally we will always use this constant instead of RETURN_INTEGER. If the program is return-int, the errno will be 0 so returning both will still work. - static final int RETURN_INTEGER_AND_ERRNO = 3; - - // The variable represents the name of calling procedure. - private String procedureName_ = ""; - - // The variable represents the returned value after calling the procedure is successful. - private byte[] returnValue_ = null; - - // The variable represents the format of returned value. - private int returnValueFormat_ = NO_RETURN_VALUE ; - - // The ccsid of the entry point. This is set at service program compile time. For all Rochester delivered service programs this is 37 so that is the default. The customer can override the default with the setProcedureName method. - private int procedureNameCCSID_ = 37; - - // Whether to align the first parameter of the service program, on a 16-byte boundary. - private boolean alignOn16Bytes_ = false; - - /** - Constructs a ServiceProgramCall object. A default ServiceProgramCall object is created. The system, program name, procedure name and parameters, must be set before calling the program. - **/ - public ServiceProgramCall() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing ServiceProgramCall object."); - } - - /** - Constructs a ServiceProgramCall object. A ServiceProgramCall object representing the program on system is created. The program name, procedure name and parameters, must be set before calling the program. - @param system The system that contains the program. - **/ - public ServiceProgramCall(AS400 system) - { - super(system); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing ServiceProgramCall object."); - } - - /** - Constructs a ServiceProgramCall object. A ServiceProgramCall object representing the program on system with name serviceProgram and parameters parameterList created. The service program's procedure name must be set before calling the program. - @param system The system which contains the program. - @param serviceProgram The service program name as a fully qualified name in the integrated file system. - @param parameterList A list of up to 7 parameters with which to call the program. - **/ - public ServiceProgramCall(AS400 system, String serviceProgram, ProgramParameter[] parameterList) - { - super(system, serviceProgram, parameterList); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing ServiceProgramCall object."); - } - - /** - Constructs a ServiceProgramCall object. A ServiceProgramCall object representing the program on system with name serviceProgram, procedure name procedureName, and parameters parameterList, is created. - @param system The system which contains the program. - @param serviceProgram The program name as a fully qualified name in the integrated file system. - @param procedureName The procedure in the service program to call. - @param parameterList A list of up to 7 parameters with which to call the program. - **/ - public ServiceProgramCall(AS400 system, String serviceProgram, String procedureName, ProgramParameter[] parameterList) - { - super(system, serviceProgram, parameterList); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing ServiceProgramCall object, procedureName: " + procedureName); - if (procedureName == null) { - throw new NullPointerException("procedureName"); - } - procedureName_ = procedureName; - } - - /** - Constructs a ServiceProgramCall object. A ServiceProgramCall object representing the program on system with name serviceProgram, procedure name procedureName, parameters parameterList, and returning a value as specified in returnValueFormat, is created. - @param system The system which contains the program. - @param serviceProgram The program name as a fully qualified name in the integrated file system. - @param procedureName The procedure in the service program to call. - @param returnValueFormat The format of the returned data. The value must be one of the following: -
      -
    • {@link #NO_RETURN_VALUE NO_RETURN_VALUE} The procedure does not return a value. -
    • {@link #RETURN_INTEGER RETURN_INTEGER} The procedure returns an integer. -
    - @param parameterList A list of up to 7 parameters with which to call the program. - **/ - public ServiceProgramCall(AS400 system, String serviceProgram, String procedureName, int returnValueFormat, ProgramParameter[] parameterList) - { - super(system, serviceProgram, parameterList); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing ServiceProgramCall object, procedureName: " + procedureName + " return value format:", returnValueFormat); - - if (procedureName == null) { - throw new NullPointerException("procedureName"); - } - if (returnValueFormat < NO_RETURN_VALUE || returnValueFormat > RETURN_INTEGER) - { - throw new ExtendedIllegalArgumentException("returnValueFormat (" + returnValueFormat + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - procedureName_ = procedureName; - returnValueFormat_ = returnValueFormat; - } - - /** - Returns the error number (errno). If the service program returns an integer and an errno, use this method to retrieve the errno. Zero is returned if the service program returns an integer but no errno. -

    The errno is valid only when the return code is non-zero. Service programs are not required to reset the errno each time the API is called, so the errno may not be reset from a previous call. Suppose, for example, calling an entry point the first time fails so the return code and errno are both non-zero. If the next call works, the return code will be zero but the errno may have the non-zero value from the previous call of the entry point. Checking only the errno would indicate the second call failed when it actually worked. Call this method only when a call to getIntegerReturnValue returns a non-zero value. - @return The return data. - **/ - public int getErrno() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting error number."); - if (returnValue_ == null || returnValueFormat_ != RETURN_INTEGER) - { - Trace.log(Trace.ERROR, "Attempt to get error number before running service program."); - throw new ExtendedIllegalStateException("returnValueFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (returnValue_.length > 7) - { - return BinaryConverter.byteArrayToInt(returnValue_, 4); - } - return 0; - } - - /** - Returns the return data when the service program returns an integer. - @return The return data. - **/ - public int getIntegerReturnValue() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting integer return value."); - if (returnValue_ == null || returnValueFormat_ != RETURN_INTEGER) - { - Trace.log(Trace.ERROR, "Attempt to get integer return value before running service program."); - throw new ExtendedIllegalStateException("returnValueFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - return BinaryConverter.byteArrayToInt(returnValue_, 0); - } - - /** - Returns the service program procedure to be called. If the name has not been set, an empty string ("") is returned. - @return The service program procedure to be called. - **/ - public String getProcedureName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting procedure name: " + procedureName_); - return procedureName_; - } - - /** - Returns the data returned from the service program. The data is returned as a byte array. If no data is returned or if the service program has not yet been called, null is returned. - @return The data as a byte array. - **/ - public byte[] getReturnValue() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting return value:", returnValue_); - return returnValue_; - } - - /** - Returns the format of the returned data. - @return The format of the returned data. Possible values are: -

      -
    • {@link #NO_RETURN_VALUE NO_RETURN_VALUE} The procedure does not return a value. -
    • {@link #RETURN_INTEGER RETURN_INTEGER} The procedure returns an integer. -
    - **/ - public int getReturnValueFormat() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting return value format:", returnValueFormat_); - return returnValueFormat_; - } - - /** - Calls the service program. - @return true if the call is successful; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public boolean run() throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "Running service program: " + program_ + " procedure name: " + procedureName_); - if (program_.length() == 0) - { - Trace.log(Trace.ERROR, "Attempt to run before setting program."); - throw new ExtendedIllegalStateException("program", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - if (procedureName_.length() == 0) - { - Trace.log(Trace.ERROR, "Attempt to run before setting procedure name."); - throw new ExtendedIllegalStateException("procedureName", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - if (parameterList_.length > 7) - { - Trace.log(Trace.ERROR, "Parameter list length exceeds limit of 7 parameters:", parameterList_.length); - throw new ExtendedIllegalArgumentException("parameterList.length (" + parameterList_.length + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - chooseImpl(); - - int rvf = returnValueFormat_; - if (rvf == RETURN_INTEGER) - { - rvf = RETURN_INTEGER_AND_ERRNO; - } - - // Run the service program. - returnValue_ = impl_.runServiceProgram(library_, name_, procedureName_, rvf, parameterList_, threadSafetyValue_, procedureNameCCSID_, messageOption_, alignOn16Bytes_); - - // Retrieve the messages. - messageList_ = impl_.getMessageList(); - // Set our system object into each of the messages. - if (system_ != null) - { - for (int i = 0; i < messageList_.length; ++i) - { - messageList_[i].setSystem(system_); - } - } - - // The SRVPGM API we call will return an MCH3401 if the object or library do not exist. We need to monitor the message list for that return code and throw an ObjectDoesNotExistException. Unfortunately we do not know if it is the object or the library that does not exist. - if (messageList_.length != 0) - { - if (messageList_[0].getID().startsWith("MCH3401")) - { - throw new ObjectDoesNotExistException(program_, ObjectDoesNotExistException.OBJECT_DOES_NOT_EXIST); - } - } - - // Fire action completed event. - if (actionCompletedListeners_ != null) fireActionCompleted(); - return returnValue_ != null; - } - - /** - Calls the service program. Calls the specified service program with the specified parameters. The system and service program procedure name must be set before calling this method. - @param serviceProgram The program name as a fully qualified name in the integrated file system. - @param parameterList A list of up to 7 parameters with which to call the program. - @return true if the call is successful, false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception PropertyVetoException If a change for a property is vetoed. - **/ - public boolean run(String serviceProgram, ProgramParameter[] parameterList) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException, PropertyVetoException - { - setProgram(serviceProgram, parameterList); - return run(); - } - - /** - Calls the service program. - @param system The system which contains the program. - @param serviceProgram The program name as a fully qualified name in the integrated file system. - @param procedureName The procedure in the service program to call. - @param returnValueFormat The format of the returned data. The value must be one of the following: -
      -
    • {@link #NO_RETURN_VALUE NO_RETURN_VALUE} The procedure does not return a value. -
    • {@link #RETURN_INTEGER RETURN_INTEGER} The procedure returns an integer. -
    - @param parameterList A list of up to 7 parameters with which to call the program. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception PropertyVetoException If a change for a property is vetoed. - **/ - public boolean run(AS400 system, String serviceProgram, String procedureName, int returnValueFormat, ProgramParameter[] parameterList) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException, PropertyVetoException - { - setSystem(system); - setProgram(serviceProgram); - setProcedureName(procedureName); - setReturnValueFormat(returnValueFormat); - setParameterList(parameterList); - return run(); - } - - /** - Sets whether to align the first parameter on a 16-byte boundary. - Some service programs require that the "receiver variable" (typically the first parameter) be aligned on a 16-byte boundary. - By default, no alignment is done. - @param align Whether to align the first parameter on a 16-byte boundary. - **/ - public void setAlignOn16Bytes(boolean align) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting alignment: " + align); - alignOn16Bytes_ = align; - } - - /** - Sets the service program procedure to call. - @param procedureName The procedure in the service program to call. - @exception PropertyVetoException If a change for the value of procedureName is vetoed. - **/ - public void setProcedureName(String procedureName) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting procedure name: " + procedureName); - if (procedureName == null) { - throw new NullPointerException("procedureName"); - } - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - procedureName_ = procedureName; - } - else - { - String oldValue = procedureName_; - String newValue = procedureName; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("procedureName", oldValue, newValue); - } - procedureName_ = procedureName; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("procedureName", oldValue, newValue); - } - } - } - - /** - Sets the service program procedure to call. - @param procedureName The procedure in the service program to call. - @param procedureNameCCSID The CCSID to use when converting the procedure name from a Java String to EBCDIC. - @exception PropertyVetoException If a change for the value of procedureName is vetoed. - **/ - public void setProcedureName(String procedureName, int procedureNameCCSID) throws PropertyVetoException - { - setProcedureName(procedureName); - procedureNameCCSID_ = procedureNameCCSID; - } - - /** - Sets the path name of the service program. - @param serviceProgram The fully qualified integrated file system path name to the service program. The library and service program name must each be 10 characters or less. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setProgram(String serviceProgram) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting service program: " + serviceProgram); - if (serviceProgram == null) { - throw new NullPointerException("program"); - } - // Verify serviceProgram is valid IFS path name. - QSYSObjectPathName ifs = new QSYSObjectPathName(serviceProgram, "SRVPGM"); - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - library_ = ifs.getLibraryName(); - name_ = ifs.getObjectName(); - program_ = serviceProgram; - } - else - { - String oldValue = program_; - String newValue = serviceProgram; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("program", oldValue, newValue); - } - library_ = ifs.getLibraryName(); - name_ = ifs.getObjectName(); - program_ = newValue; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("program", oldValue, newValue); - } - } - } - - /** - Sets the format of the returned data. - @param returnValueFormat The format of the returned data. The value must be one of the following: -
      -
    • {@link #NO_RETURN_VALUE NO_RETURN_VALUE} The procedure does not return a value. -
    • {@link #RETURN_INTEGER RETURN_INTEGER} The procedure returns an integer. -
    - @exception PropertyVetoException If a change for the value of returnValueFormat is vetoed. - **/ - public void setReturnValueFormat(int returnValueFormat) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting return value format:", returnValueFormat); - if (returnValueFormat < NO_RETURN_VALUE || returnValueFormat > RETURN_INTEGER) - { - throw new ExtendedIllegalArgumentException("returnValueFormat (" + returnValueFormat + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - returnValueFormat_ = returnValueFormat; - } - else - { - Integer oldValue = new Integer(returnValueFormat_); - Integer newValue = new Integer(returnValueFormat); - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("returnValueFormat", oldValue, newValue); - } - returnValueFormat_ = returnValueFormat; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("returnValueFormat", oldValue, newValue); - } - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ServiceProgramCall16.gif b/cvsroot/src/com/ibm/as400/access/ServiceProgramCall16.gif deleted file mode 100644 index 5b2602dc3..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/ServiceProgramCall16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/ServiceProgramCall32.gif b/cvsroot/src/com/ibm/as400/access/ServiceProgramCall32.gif deleted file mode 100644 index 1883419de..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/ServiceProgramCall32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/ServiceProgramCallBeanInfo.java b/cvsroot/src/com/ibm/as400/access/ServiceProgramCallBeanInfo.java deleted file mode 100644 index 54e810c13..000000000 --- a/cvsroot/src/com/ibm/as400/access/ServiceProgramCallBeanInfo.java +++ /dev/null @@ -1,115 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: ServiceProgramCallBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - -/** - The ServiceProgramCallBeanInfo class provides bean information for the ServiceProgramCall class. ServiceProgramCall is a subclass of ProgramCall so bean information from ProgramCallBeanInfo also applies to ServiceProgramCall. - **/ -public class ServiceProgramCallBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Class this bean info represents. - private static final Class BEAN_CLASS = ServiceProgramCall.class; - - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - PropertyDescriptor procedureName = new PropertyDescriptor("procedureName", BEAN_CLASS); - procedureName.setBound(true); - procedureName.setConstrained(true); - procedureName.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_PARMPROCEDURE")); - procedureName.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_PARMPROCEDURE")); - - PropertyDescriptor returnValueFormat = new PropertyDescriptor("returnValueFormat", BEAN_CLASS); - returnValueFormat.setBound(true); - returnValueFormat.setConstrained(true); - returnValueFormat.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_PARMRETURNFORMAT")); - returnValueFormat.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_PARMRETURNFORMAT")); - - propertyDescriptors = new PropertyDescriptor[] { procedureName, returnValueFormat }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the BeanInfo for the superclass of this bean. Since ServiceProgramCall is a subclass of ProgramCall, this method will return a ProgramCallBeanInfo object. - @return an array of BeanInfo objects containing this bean's superclass BeanInfo. - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new ProgramCallBeanInfo() }; - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default property. - @return Zero (0), the index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // The index for the "procedureName" property. - return 0; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("ServiceProgramCall16.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("ServiceProgramCall32.gif"); - } - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SignonConverter.java b/cvsroot/src/com/ibm/as400/access/SignonConverter.java deleted file mode 100644 index a4f0e187a..000000000 --- a/cvsroot/src/com/ibm/as400/access/SignonConverter.java +++ /dev/null @@ -1,162 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SignonConverter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -// Sign-on converter maps only valid user ID and DES password characters between Unicode and EBCDIC CCSID 37. Also maps so called "special characters" where an N with tilde becomes a # character. -class SignonConverter -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - // No need for instances of this class. - private SignonConverter() - { - } - - // Convert EBCDIC CCSID 37 to Unicode String. - static String byteArrayToString(byte[] source) - { - return new String(byteArrayToCharArray(source)).trim(); - } - - // Convert EBCDIC CCSID 37 to Unicode character array. - static char[] byteArrayToCharArray(byte[] source) - { - char[] returnChars = new char[10]; - for (int i = 0; i < 10; ++i) - { - switch (source[i] & 0xFF) - { - case 0x40: returnChars[i] = 0x0020; break; // (SP) - - case 0x5B: returnChars[i] = 0x0024; break; // $ - case 0x6D: returnChars[i] = 0x005F; break; // _ - case 0x7B: returnChars[i] = 0x0023; break; // # - case 0x7C: returnChars[i] = 0x0040; break; // @ - - case 0xC1: returnChars[i] = 0x0041; break; // A - case 0xC2: returnChars[i] = 0x0042; break; // B - case 0xC3: returnChars[i] = 0x0043; break; // C - case 0xC4: returnChars[i] = 0x0044; break; // D - case 0xC5: returnChars[i] = 0x0045; break; // E - case 0xC6: returnChars[i] = 0x0046; break; // F - case 0xC7: returnChars[i] = 0x0047; break; // G - case 0xC8: returnChars[i] = 0x0048; break; // H - case 0xC9: returnChars[i] = 0x0049; break; // I - case 0xD1: returnChars[i] = 0x004A; break; // J - case 0xD2: returnChars[i] = 0x004B; break; // K - case 0xD3: returnChars[i] = 0x004C; break; // L - case 0xD4: returnChars[i] = 0x004D; break; // M - case 0xD5: returnChars[i] = 0x004E; break; // N - case 0xD6: returnChars[i] = 0x004F; break; // O - case 0xD7: returnChars[i] = 0x0050; break; // P - case 0xD8: returnChars[i] = 0x0051; break; // Q - case 0xD9: returnChars[i] = 0x0052; break; // R - case 0xE2: returnChars[i] = 0x0053; break; // S - case 0xE3: returnChars[i] = 0x0054; break; // T - case 0xE4: returnChars[i] = 0x0055; break; // U - case 0xE5: returnChars[i] = 0x0056; break; // V - case 0xE6: returnChars[i] = 0x0057; break; // W - case 0xE7: returnChars[i] = 0x0058; break; // X - case 0xE8: returnChars[i] = 0x0059; break; // Y - case 0xE9: returnChars[i] = 0x005A; break; // Z - - case 0xF0: returnChars[i] = 0x0030; break; // 0 - case 0xF1: returnChars[i] = 0x0031; break; // 1 - case 0xF2: returnChars[i] = 0x0032; break; // 2 - case 0xF3: returnChars[i] = 0x0033; break; // 3 - case 0xF4: returnChars[i] = 0x0034; break; // 4 - case 0xF5: returnChars[i] = 0x0035; break; // 5 - case 0xF6: returnChars[i] = 0x0036; break; // 6 - case 0xF7: returnChars[i] = 0x0037; break; // 7 - case 0xF8: returnChars[i] = 0x0038; break; // 8 - case 0xF9: returnChars[i] = 0x0039; break; // 9 - default: throw new ExtendedIllegalArgumentException("source", ExtendedIllegalArgumentException.SIGNON_CHAR_NOT_VALID); - } - } - return returnChars; - } - - // Convert Unicode string to EBCID CCSID 37 byte array. - static byte[] stringToByteArray(String source) throws AS400SecurityException - { - char[] sourceChars = source.toCharArray(); - byte[] returnBytes = {(byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40}; - for (int i = 0; i < sourceChars.length; ++i) - { - switch (sourceChars[i]) - { - case 0x0023: returnBytes[i] = (byte)0x7B; break; // # - case 0x0024: returnBytes[i] = (byte)0x5B; break; // $ - - case 0x0030: returnBytes[i] = (byte)0xF0; break; // 0 - case 0x0031: returnBytes[i] = (byte)0xF1; break; // 1 - case 0x0032: returnBytes[i] = (byte)0xF2; break; // 2 - case 0x0033: returnBytes[i] = (byte)0xF3; break; // 3 - case 0x0034: returnBytes[i] = (byte)0xF4; break; // 4 - case 0x0035: returnBytes[i] = (byte)0xF5; break; // 5 - case 0x0036: returnBytes[i] = (byte)0xF6; break; // 6 - case 0x0037: returnBytes[i] = (byte)0xF7; break; // 7 - case 0x0038: returnBytes[i] = (byte)0xF8; break; // 8 - case 0x0039: returnBytes[i] = (byte)0xF9; break; // 9 - - case 0x0040: returnBytes[i] = (byte)0x7C; break; // @ - - case 0x0041: returnBytes[i] = (byte)0xC1; break; // A - case 0x0042: returnBytes[i] = (byte)0xC2; break; // B - case 0x0043: returnBytes[i] = (byte)0xC3; break; // C - case 0x0044: returnBytes[i] = (byte)0xC4; break; // D - case 0x0045: returnBytes[i] = (byte)0xC5; break; // E - case 0x0046: returnBytes[i] = (byte)0xC6; break; // F - case 0x0047: returnBytes[i] = (byte)0xC7; break; // G - case 0x0048: returnBytes[i] = (byte)0xC8; break; // H - case 0x0049: returnBytes[i] = (byte)0xC9; break; // I - case 0x004A: returnBytes[i] = (byte)0xD1; break; // J - case 0x004B: returnBytes[i] = (byte)0xD2; break; // K - case 0x004C: returnBytes[i] = (byte)0xD3; break; // L - case 0x004D: returnBytes[i] = (byte)0xD4; break; // M - case 0x004E: returnBytes[i] = (byte)0xD5; break; // N - case 0x004F: returnBytes[i] = (byte)0xD6; break; // O - case 0x0050: returnBytes[i] = (byte)0xD7; break; // P - case 0x0051: returnBytes[i] = (byte)0xD8; break; // Q - case 0x0052: returnBytes[i] = (byte)0xD9; break; // R - case 0x0053: returnBytes[i] = (byte)0xE2; break; // S - case 0x0054: returnBytes[i] = (byte)0xE3; break; // T - case 0x0055: returnBytes[i] = (byte)0xE4; break; // U - case 0x0056: returnBytes[i] = (byte)0xE5; break; // V - case 0x0057: returnBytes[i] = (byte)0xE6; break; // W - case 0x0058: returnBytes[i] = (byte)0xE7; break; // X - case 0x0059: returnBytes[i] = (byte)0xE8; break; // Y - case 0x005A: returnBytes[i] = (byte)0xE9; break; // Z - - case 0x005F: returnBytes[i] = (byte)0x6D; break; // _ - - case 0x00A3: returnBytes[i] = (byte)0x7B; break; // Cp423, pound sterling. - case 0x00A5: returnBytes[i] = (byte)0x5B; break; // Cp281, yen sign. - case 0x00A7: returnBytes[i] = (byte)0x7C; break; // Cp273, section sign. - case 0x00C4: returnBytes[i] = (byte)0x7B; break; // Cp278, A with dieresis. - case 0x00C5: returnBytes[i] = (byte)0x5B; break; // Cp277, A with ring. - case 0x00C6: returnBytes[i] = (byte)0x7B; break; // Cp277, ligature AE. - case 0x00D0: returnBytes[i] = (byte)0x7C; break; // Cp871, D with stroke. - case 0x00D1: returnBytes[i] = (byte)0x7B; break; // Cp284, N with tilde. - case 0x00D6: returnBytes[i] = (byte)0x7C; break; // Cp278, O with dieresis. - case 0x00D8: returnBytes[i] = (byte)0x7C; break; // Cp277, O with stroke. - case 0x00E0: returnBytes[i] = (byte)0x7C; break; // Cp297, a with grave. - case 0x0130: returnBytes[i] = (byte)0x5B; break; // Cp905, I with over dot. - case 0x015E: returnBytes[i] = (byte)0x7C; break; // Cp905, S with cedilla. - default: throw new AS400SecurityException(AS400SecurityException.SIGNON_CHAR_NOT_VALID); - } - } - return returnBytes; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SignonEndServerReq.java b/cvsroot/src/com/ibm/as400/access/SignonEndServerReq.java deleted file mode 100644 index 044cc423c..000000000 --- a/cvsroot/src/com/ibm/as400/access/SignonEndServerReq.java +++ /dev/null @@ -1,41 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SignonEndServerReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -class SignonEndServerReq extends ClientAccessDataStream -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - SignonEndServerReq() - { - super(new byte[20]); - - setLength(20); - // setHeaderID(0x0000); - setServerID(0xE009); - // setCSInstance(0x00000000); - // setCorrelation(0x00000000); - // setTemplateLen(0x0000); - setReqRepID(0x7006); - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending end signon server request..."); //@P0C - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SignonEvent.java b/cvsroot/src/com/ibm/as400/access/SignonEvent.java deleted file mode 100644 index 891060715..000000000 --- a/cvsroot/src/com/ibm/as400/access/SignonEvent.java +++ /dev/null @@ -1,89 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SignonEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2004-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.EventObject; - -/** - An Event object generated by an {@link AS400 AS400} instance during an attempt to sign-on to the system. SignonEvent objects are consumed by instances of {@link SignonHandler SignonHandler}. - For all instances of SignonEvent, the {@link EventObject#getSource getSource()} method always returns the AS400 instance that originated the event. - @see AS400#setSignonHandler - **/ -public final class SignonEvent extends EventObject -{ - private AS400SecurityException exception_; - private boolean reconnecting_; - - - /** - Constructs a SignonEvent object. - @param system The system. - @param reconnecting Indicates whether the system object is already connected. - **/ - SignonEvent(AS400 system, boolean reconnecting) - { - // Assume args have been validated. - super(system); - reconnecting_ = reconnecting; - } - - - /** - Constructs a SignonEvent object. - @param system The system. - @param reconnecting Indicates whether the system object is already connected. - @param exc The exception. null if no exception is associated with this event. - **/ - SignonEvent(AS400 system, boolean reconnecting, AS400SecurityException exc) - { - // Assume args have been validated as non-null. - super(system); - reconnecting_ = reconnecting; - exception_ = exc; // tolerate null value - } - - - /** - Returns the exception that is associated with this event, if any. - @return The exception that is associated with this event, or null if no exception is associated with the event. - @see #hasException - **/ - public AS400SecurityException getException() - { - return exception_; - } - - - /** - Indicates whether this SignonEvent object has an associated exception. That is, indicates whether getException() will return non-null. - @return true if there is an associated exception; false otherwise. - @see #getException - **/ - public boolean hasException() - { - return (exception_ != null); - } - - - /** - Indicates whether the system object was previously connected. That is, indicates whether this is a reconnection (for example, to an additional service) rather than an initial connection. - @return true if the system object is already connected. - **/ - public boolean isReconnecting() - { - return reconnecting_; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/SignonExchangeAttributeRep.java b/cvsroot/src/com/ibm/as400/access/SignonExchangeAttributeRep.java deleted file mode 100644 index b1e8b7a8c..000000000 --- a/cvsroot/src/com/ibm/as400/access/SignonExchangeAttributeRep.java +++ /dev/null @@ -1,113 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SignonExchangeAttributeRep.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -class SignonExchangeAttributeRep extends ClientAccessDataStream -{ - /** - Generate a new instance of this type. - @return a reference to the new instance - **/ - public Object getNewDataStream() - { - return new SignonExchangeAttributeRep(); - } - - int getRC() - { - return get32bit(20); - } - - int getServerVersion() - { - return get32bit(30); - } - - int getServerLevel() - { - return get16bit(40); - } - - byte[] getServerSeed() - { - int offset = findCP(0x1103); - if (offset == -1) return null; - - byte[] seed = new byte[8]; - System.arraycopy(data_, offset + 6, seed, 0, 8); - return seed; - } - - boolean getPasswordLevel() - { - int offset = findCP(0x1119); - if (offset == -1) return false; - - return data_[offset + 6] >= 2; - } - - byte[] getJobNameBytes() - { - int offset = findCP(0x111F); - if (offset == -1) return new byte[0]; - - byte[] jobNameBytes = new byte[get32bit(offset) - 10]; - System.arraycopy(data_, offset + 10, jobNameBytes, 0, jobNameBytes.length); - return jobNameBytes; - } - - int findCP(int cp) - { - int offset = 42; - while (offset < data_.length - 1) - { - if (get16bit(offset + 4) == cp) return offset; - offset += get32bit(offset); - } - return -1; - } - - void read(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving signon server exchange client/server attributes reply..."); - - // Receive the header. - byte[] header = new byte[20]; - if (readFromStream(in, header, 0, 20) < 20) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Failed to read all of the signon server exchange client/server attributes reply header."); - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - - // Allocate bytes for datastream. - data_ = new byte[BinaryConverter.byteArrayToInt(header, 0)]; - System.arraycopy(header, 0, data_, 0, 20); - - // Read in the rest of the data. - readAfterHeader(in); - } - - /** - Generates a hash code for this data stream. - @return the hash code - **/ - public int hashCode() - { - return 0xF003; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/SignonExchangeAttributeReq.java b/cvsroot/src/com/ibm/as400/access/SignonExchangeAttributeReq.java deleted file mode 100644 index fd2525757..000000000 --- a/cvsroot/src/com/ibm/as400/access/SignonExchangeAttributeReq.java +++ /dev/null @@ -1,66 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SignonExchangeAttributeReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -class SignonExchangeAttributeReq extends ClientAccessDataStream -{ - SignonExchangeAttributeReq(byte[] seed) - { - super(new byte[seed != null ? 52 : 38]); - - setLength(data_.length); - // setHeaderID(0x0000); - setServerID(0xE009); - // setCSInstance(0x00000000); - // setCorrelation(0x00000000); - // setTemplateLen(0x0000); - setReqRepID(0x7003); - - // Set client version. - // LL - set32bit(10, 20); - // CP - set16bit(0x1101, 24); - // Client version. - set32bit(1, 26); - - // Set client data stream level. - // LL - set32bit(8, 30); - // CP - set16bit(0x1102, 34); - // Client level. - set16bit(2, 36); - - if (seed != null) - { - // Set client seed. - // LL - set32bit(14, 38); - // CP - set16bit(0x1103, 42); - // Client seed. - System.arraycopy(seed, 0, data_, 44, 8); - } - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending signon server exchange client/server attributes request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SignonGenAuthTokenReplyDS.java b/cvsroot/src/com/ibm/as400/access/SignonGenAuthTokenReplyDS.java deleted file mode 100644 index 64ec6cdf8..000000000 --- a/cvsroot/src/com/ibm/as400/access/SignonGenAuthTokenReplyDS.java +++ /dev/null @@ -1,76 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SignonGenAuthTokenReplyDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2003-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; - -// The SignonGenAuthTokenReplyDS class represents the data stream for the 'Generate authentication token on behalf of another user' reply. -class SignonGenAuthTokenReplyDS extends ClientAccessDataStream -{ - /** - Generate a new instance of this type. - @return a reference to the new instance - **/ - public Object getNewDataStream() - { - return new SignonGenAuthTokenReplyDS(); - } - - int getRC() - { - return get32bit(20); - } - - byte[] getProfileTokenBytes() - { - byte[] token = new byte[32]; - System.arraycopy(data_, 30, token, 0, 32); - return token; - } - - AS400Message[] getErrorMessages(ConverterImplRemote converter) throws IOException - { - return AS400ImplRemote.parseMessages(data_, 24, converter); - } - - void read(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving generate authentication token on behalf of another user reply..."); - - // Receive the header. - byte[] header = new byte[20]; - if (readFromStream(in, header, 0, 20) < 20) - { - Trace.log(Trace.ERROR, "Failed to read all of the generate authentication token on behalf of another user reply header."); - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - - // Allocate bytes for datastream. - data_ = new byte[BinaryConverter.byteArrayToInt(header, 0)]; - System.arraycopy(header, 0, data_, 0, 20); - - // Read in the rest of the data. - readAfterHeader(in); - } - - /** - Generates a hash code for this data stream. - @return the hash code - **/ - public int hashCode() - { - return 0xF008; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SignonGenAuthTokenRequestDS.java b/cvsroot/src/com/ibm/as400/access/SignonGenAuthTokenRequestDS.java deleted file mode 100644 index 307523f44..000000000 --- a/cvsroot/src/com/ibm/as400/access/SignonGenAuthTokenRequestDS.java +++ /dev/null @@ -1,78 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SignonGenAuthTokenRequestDS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2003-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -// The SignonGenAuthTokenRequestDS class represents the data stream for the 'Generate authentication token on behalf of another user' request. -class SignonGenAuthTokenRequestDS extends ClientAccessDataStream -{ - SignonGenAuthTokenRequestDS(byte[] userIdentity, int profileTokenType, int profileTokenTimeout, int serverLevel) - { - super(new byte[51 + userIdentity.length + (serverLevel < 5 ? 0 : 7)]); - - setLength(data_.length); - // setHeaderID(0x0000); - setServerID(0xE009); - // setCSInstance(0x00000000); - // setCorrelation(0x00000000); - setTemplateLen(0x0001); - setReqRepID(0x7008); - - // Authentication token return type. - data_[20] = 0x01; // 0x01 - profile token. - - // Profile token type. - set32bit(7, 21); - set16bit(0x1116, 25); - data_[27] = (byte)(0xF0 | profileTokenType); - - // Experation interval. - set32bit(10, 28); - set16bit(0x1117, 32); - set32bit(profileTokenTimeout, 34); - - // Type of user identity. - set32bit(7, 38); - set16bit(0x1126, 42); - data_[44] = (byte)0xF1; - - // Set user identity. - // LL - set32bit(6 + userIdentity.length, 45); - // CP - set16bit(0x1127, 49); - // Data. - System.arraycopy(userIdentity, 0, data_, 51, userIdentity.length); - - if (serverLevel >= 5) - { - int offset = 51 + userIdentity.length; - // Set return error messages. - // LL - set32bit(7, offset); - // CP - set16bit(0x1128, offset + 4); - // Data. - data_[offset + 6] = 0x01; - } - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending generate authentication token on behalf of another user request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SignonHandler.java b/cvsroot/src/com/ibm/as400/access/SignonHandler.java deleted file mode 100644 index 913150fbb..000000000 --- a/cvsroot/src/com/ibm/as400/access/SignonHandler.java +++ /dev/null @@ -1,258 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SignonHandler.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2004-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.net.UnknownHostException; - -/** - Specifies the methods required for a SignonHandler. - The application can direct the system object to use a specific SignonHandler by calling {@link AS400#setSignonHandler setSignonHandler()}. - The AS400 class invokes the SignonHandler at runtime, if additional information (such as userID or password) must be obtained while attempting to connect to the system. - By default, the Toolbox uses an internal AWT-based implementation of SignonHandler. - -

    For all methods that return a boolean, a returned value of true indicates that the sign-on should proceed; false indicates that the sign-on should not proceed, in which case the system object will throw an {@link AS400SecurityException AS400SecurityException} with an error code indicating what information is missing or incorrect. In the case of {@link #connectionInitiated connectionInitiated()} and {@link #passwordAboutToExpire passwordAboutToExpire()}, the return code will be {@link AS400SecurityException#SIGNON_CANCELED SIGNON_CANCELED}. - -

    Suggestions for implementers: -
    Extend {@link SignonHandlerAdapter SignonHandlerAdapter} rather than implementing this interface directly. That will insulate your implementation from future additions to the interface. -
    In order to avoid hang conditions, the SignonHandler should not attempt to display a GUI if {@link AS400#isGuiAvailable isGuiAvailable()} indicates false. -
    In order to avoid infinite loops, a SignonHandler must not call the following AS400 methods: -

      -
    • addPasswordCacheEntry() -
    • authenticate() -
    • connectService() -
    • validateSignon() -
    - -

    Here is a minimal implementation that just prints a message when connectionInitiated() is called.: -

    -import com.ibm.as400.access.SignonHandlerAdapter;
    -import com.ibm.as400.access.SignonEvent;
    -public class SimpleSignonHandler extends SignonHandlerAdapter
    -{
    -  public boolean connectionInitiated(SignonEvent event)
    -    throws SignonHandlerException
    -  {
    -    System.out.println("SimpleSignonHandler.connectionInitiated()");
    -    return true;  // indicate that the sign-on should proceed
    -  }
    -}
    -
    - -

    Here is a somewhat more realistic sample implementation: -

    -import com.ibm.as400.access.*;
    -import java.io.File;
    -public class MySignonHandler extends SignonHandlerAdapter
    -{
    -  public boolean connectionInitiated(SignonEvent event)
    -  {
    -    AS400 system = (AS400)event.getSource();
    -    if (system.isGuiAvailable())
    -    {
    -      // Display an interactive dialog to prompt user for userid and password.
    -      ...
    -      system.setUserId(userId);
    -      system.setPassword(password);
    -    }
    -    else  // no GUI available
    -    {
    -      File myPasswordFile = new File(...);  // file containing sign-on information
    -      if (myPasswordFile.exists())
    -      {
    -        // Read systemName, userId, and password from file, and update the system object.
    -        ...
    -        system.setUserId(userId);
    -        system.setPassword(password);
    -      }
    -      else
    -      {
    -        // Just return 'true'.  Let the system object proceed with the connection.
    -        // If anything necessary is missing, the Toolbox will call handleEvent().
    -      }
    -    }
    -    return true;  // indicate that the sign-on should proceed
    -  }
    -}
    -
    - @see AS400#setSignonHandler - @see AS400#getSignonHandler - @see AS400#setDefaultSignonHandler - @see AS400#getDefaultSignonHandler - **/ -public interface SignonHandler -{ - - /** - Informs the SignonHandler that a connection operation has been initiated. - The SignonHandler inspects the state of the system object (the source of the event), and calls the appropriate setter methods on the system object to fill in or correct fields. -

    In order to avoid infinite loops, a SignonHandler must not call the following AS400 methods: -

      -
    • addPasswordCacheEntry() -
    • authenticate() -
    • connectService() -
    • validateSignon() -
    - @param event The sign-on event. - @param forceUpdate true indicates that the sign-on information is known to be incomplete or incorrect. false indicates that the information may be correct. - @return true if sign-on should proceed, false if sign-on should not proceed. - @see SignonEvent#getSource - **/ - public boolean connectionInitiated(SignonEvent event, boolean forceUpdate); - - - /** - Handles an exception that was thrown during a sign-on attempt. - If the handler cannot deal with the exception, the handler should rethrow exc. - @param event The sign-on event. {@link SignonEvent#getException getException()} is guaranteed to return non-null. - @exception AS400SecurityException If the handler cannot handle the exception. - @see AS400SecurityException#getReturnCode - **/ - public void exceptionOccurred(SignonEvent event) throws AS400SecurityException; - - - /** - Handles the situation where the password is within a few days of expiring. - A typical implementation is to put up a warning message, ask the user if they want to - change the password, and if so, solicit a new password and call {@link AS400#changePassword changePassword}. - Another reasonable implementation is to just return true, indicating - that the password is not to be changed at this time, and the sign-on should proceed. - @param event The sign-on event. - @param daysUntilExpiration The number of days until the password expires. - @return true if sign-on should proceed, false if sign-on should not proceed. - @see AS400#changePassword - **/ - public boolean passwordAboutToExpire(SignonEvent event, int daysUntilExpiration); - - - /** - Handles the situation where the password has expired. - The typical implementation is to solicit the user for old and new passwords, - and call {@link AS400#changePassword changePassword}. - @param event The sign-on event. - @return true if sign-on should proceed, false if sign-on should not proceed. - @see AS400#changePassword - **/ - public boolean passwordExpired(SignonEvent event); - - - /** - Handles the situation where an incorrect password has been specified. - @param event The sign-on event. - @return true if sign-on should proceed, false if sign-on should not proceed. - @see AS400#setPassword - **/ - public boolean passwordIncorrect(SignonEvent event); - - - /** - Handles the situation where a specified password is either too long or too short. - @param event The sign-on event. - @return true if sign-on should proceed, false if sign-on should not proceed. - @see AS400#setPassword - **/ - public boolean passwordLengthIncorrect(SignonEvent event); - - - /** - Handles the situation where a password has not been specified. - @param event The sign-on event. - @return true if sign-on should proceed, false if sign-on should not proceed. - @see AS400#setPassword - **/ - public boolean passwordMissing(SignonEvent event); - - - /** - Handles the situation where the system name has not been specified. - @param event The sign-on event. - @return true if sign-on should proceed, false if sign-on should not proceed. - @see AS400#setSystemName - **/ - public boolean systemNameMissing(SignonEvent event); - - - /** - Handles the situation where the specified system name is unknown to the network. - @param event The sign-on event. - @param exc The exception. - @return true if sign-on should proceed, false if sign-on should not proceed. - @see AS400#setSystemName - **/ - public boolean systemNameUnknown(SignonEvent event, UnknownHostException exc); - - - /** - Handles the situation where a default userID has already been assigned for the system object. - A typical implementation is simply to put up a warning message. - Another reasonable implementation is simply to return true, indicating - that the sign-on should proceed. - @param event The sign-on event. - @param defaultUser The current default user. - @return true if sign-on should proceed, false if sign-on should not proceed. - @see AS400#isUseDefaultUser - @see AS400#setUseDefaultUser - @see AS400#setDefaultUser - @see AS400#removeDefaultUser - **/ - public boolean userIdDefaultAlreadyAssigned(SignonEvent event, String defaultUser); - - - /** - Handles the situation where the specified user profile will be disabled after next incorrect sign-on attempt. - This usually indicates that several successive incorrect sign-on attempts have occurred. - @param event The sign-on event. - @return true if sign-on should proceed, false if sign-on should not proceed. - @see AS400#setUserId - @see AS400#setPassword - **/ - public boolean userIdAboutToBeDisabled(SignonEvent event); - - - /** - Handles the situation where the specified user profile has been disabled. - The application may choose to specify a different userID, or re-enable the user profile. - @param event The sign-on event. - @return true if sign-on should proceed, false if sign-on should not proceed. - @see AS400#setUserId - **/ - public boolean userIdDisabled(SignonEvent event); - - - /** - Handles the situation where a specified userID is either too long or too short. - @param event The sign-on event. - @return true if sign-on should proceed, false if sign-on should not proceed. - @see AS400#setUserId - **/ - public boolean userIdLengthIncorrect(SignonEvent event); - - - /** - Handles the situation where a userID has not been specified. - @param event The sign-on event. - @return true if sign-on should proceed, false if sign-on should not proceed. - @see AS400#setUserId - **/ - public boolean userIdMissing(SignonEvent event); - - - /** - Handles the situation where a specified userID is unknown to the system. - @param event The sign-on event. - @return true if sign-on should proceed, false if sign-on should not proceed. - @see AS400#setUserId - **/ - public boolean userIdUnknown(SignonEvent event); - -} diff --git a/cvsroot/src/com/ibm/as400/access/SignonHandlerAdapter.java b/cvsroot/src/com/ibm/as400/access/SignonHandlerAdapter.java deleted file mode 100644 index 3bc9dc3fe..000000000 --- a/cvsroot/src/com/ibm/as400/access/SignonHandlerAdapter.java +++ /dev/null @@ -1,230 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SignonHandlerAdapter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2004-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.net.UnknownHostException; - -/** - An abstract adapter class for receiving Toolbox sign-on events. The methods in this class perform bare-minimum default processing. This class exists as a convenience for application writers when creating customized sign-on handler objects. - -

    Extend this class to create a SignonHandler implementation and override the methods for the events of interest. (If you directly implement the SignonHandler interface, you must provide implementations for all of the SignonHandler methods. The SignonHandlerAdapter class provides default implementations for all SignonHandler methods, so you only have to implement methods for events you care about.) - -

    Create a SignonHandler object using your extended class, and then register it with the system object using {@link AS400#setSignonHandler setSignonHandler()}. When a sign-on related event occurs on the AS400 system object, the relevant method in your handler object is invoked. - -

    For all methods that return a boolean, returning true indicates that the sign-on should proceed; false indicates that the sign-on should be terminated. - -

    In order to avoid hang conditions, the SignonHandler object must not attempt to display a GUI if {@link AS400#isGuiAvailable isGuiAvailable()} indicates false. - -

    In order to avoid infinite loops, a SignonHandler must not call the following AS400 methods: -

      -
    • addPasswordCacheEntry() -
    • authenticate() -
    • connectService() -
    • validateSignon() -
    - - @see AS400#setSignonHandler - @see AS400#getSignonHandler - @see AS400#setDefaultSignonHandler - @see AS400#getDefaultSignonHandler - **/ -public abstract class SignonHandlerAdapter implements SignonHandler -{ - /** - Returns true, indicating that the sign-on should proceed. - @param event The sign-on event. - @param forceUpdate true indicates that the sign-on information is known to be incomplete or incorrect. false indicates that the information may be correct. - @return true - **/ - public boolean connectionInitiated(SignonEvent event, boolean forceUpdate) - { - return true; // Take a chance that everything's OK. If there's a problem, we'll be notified. - } - - - /** - Rethrows the exception. - @param event The sign-on event. - @exception AS400SecurityException If the handler cannot handle the exception. - @see AS400SecurityException#getReturnCode - **/ - public void exceptionOccurred(SignonEvent event) throws AS400SecurityException - { - throw event.getException(); // give up - } - - - /** - Returns true, indicating that the sign-on should proceed. - @param event The sign-on event. - @param daysUntilExpiration The number of days until the password expires. - @return true - @see AS400#changePassword - **/ - public boolean passwordAboutToExpire(SignonEvent event, int daysUntilExpiration) - { - return true; // don't change password, proceed with sign-on - } - - - /** - Returns false, indicating that the sign-on should not proceed. - @param event The sign-on event. - @return false - @see AS400#changePassword - **/ - public boolean passwordExpired(SignonEvent event) - { - return false; // give up - } - - - /** - Returns false, indicating that the sign-on should not proceed. - @param event The sign-on event. - @return false - @see AS400#setPassword - **/ - public boolean passwordIncorrect(SignonEvent event) - { - return false; // give up - } - - - /** - Returns false, indicating that the sign-on should not proceed. - @param event The sign-on event. - @return false - @see AS400#setPassword - **/ - public boolean passwordLengthIncorrect(SignonEvent event) - { - return false; // give up - } - - - /** - Returns false, indicating that the sign-on should not proceed. - @param event The sign-on event. - @return false - @see AS400#setPassword - **/ - public boolean passwordMissing(SignonEvent event) - { - return false; // give up - } - - - /** - Returns false, indicating that the sign-on should not proceed. - @param event The sign-on event. - @return false - @see AS400#setSystemName - **/ - public boolean systemNameMissing(SignonEvent event) - { - return false; // give up - } - - - /** - Returns false, indicating that the sign-on should not proceed. - @param event The sign-on event. - @param exc The exception. - @return false - @see AS400#setSystemName - **/ - public boolean systemNameUnknown(SignonEvent event, UnknownHostException exc) - { - return false; // give up - } - - - /** - Returns true, indicating that the sign-on should proceed. - @param event The sign-on event. - @param defaultUser The current default user. - @return true - @see AS400#isUseDefaultUser - @see AS400#setUseDefaultUser - @see AS400#setDefaultUser - **/ - public boolean userIdDefaultAlreadyAssigned(SignonEvent event, String defaultUser) - { - return true; // proceed with sign-on anyway; don't change default user - } - - - /** - Returns false, indicating that the sign-on should not proceed. - @param event The sign-on event. - @return false - @see AS400#setUserId - @see AS400#setPassword - **/ - public boolean userIdAboutToBeDisabled(SignonEvent event) - { - return false; // give up - } - - - /** - Returns false, indicating that the sign-on should not proceed. - @param event The sign-on event. - @return false - @see AS400#setUserId - **/ - public boolean userIdDisabled(SignonEvent event) - { - return false; // give up - } - - - /** - Returns false, indicating that the sign-on should not proceed. - @param event The sign-on event. - @return false - @see AS400#setUserId - **/ - public boolean userIdLengthIncorrect(SignonEvent event) - { - return false; // give up - } - - - /** - Returns false, indicating that the sign-on should not proceed. - @param event The sign-on event. - @return false - @see AS400#setUserId - **/ - public boolean userIdMissing(SignonEvent event) - { - return false; // give up - } - - - /** - Returns false, indicating that the sign-on should not proceed. - @param event The sign-on event. - @return false - @see AS400#setUserId - **/ - public boolean userIdUnknown(SignonEvent event) - { - return false; // give up - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/SignonInfo.java b/cvsroot/src/com/ibm/as400/access/SignonInfo.java deleted file mode 100644 index 7c6b0323b..000000000 --- a/cvsroot/src/com/ibm/as400/access/SignonInfo.java +++ /dev/null @@ -1,32 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SignonInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.util.GregorianCalendar; - -class SignonInfo implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - GregorianCalendar currentSignonDate; - GregorianCalendar lastSignonDate; - GregorianCalendar expirationDate; - ServerVersion version; - int serverCCSID; - // Note: not maintained as com.ibm.as400.security.auth.ProfileToken. Class is currently not available in proxy environments, so don't want to force instantiation during signon. - Object profileToken; - String userId; -} diff --git a/cvsroot/src/com/ibm/as400/access/SignonInfoRep.java b/cvsroot/src/com/ibm/as400/access/SignonInfoRep.java deleted file mode 100644 index 466e6fed1..000000000 --- a/cvsroot/src/com/ibm/as400/access/SignonInfoRep.java +++ /dev/null @@ -1,146 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SignonInfoRep.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.util.GregorianCalendar; - -class SignonInfoRep extends ClientAccessDataStream -{ - /** - Generate a new instance of this type. - @return a reference to the new instance - **/ - public Object getNewDataStream() - { - return new SignonInfoRep(); - } - - int getRC() - { - return get32bit(20); - } - - GregorianCalendar getCurrentSignonDate() - { - return getDate(0x1106); - } - - GregorianCalendar getLastSignonDate() - { - return getDate(0x1107); - } - - GregorianCalendar getExpirationDate() - { - return getDate(0x1108); - } - - GregorianCalendar getDate(int cp) - { - int offset = 24; - GregorianCalendar date = null; - - while (offset < (data_.length - 1)) - { - if (get16bit(offset + 4) != cp) - { - offset += get32bit(offset); - } - else - { - date = new GregorianCalendar((int)(get16bit(offset+6))/*year*/, (int)(data_[offset+8] - 1)/*month convert to zero based*/, (int)(data_[offset+9])/*day*/, (int)(data_[offset+10])/*hour*/, (int)(data_[offset+11])/*minute*/, (int)(data_[offset+12])/*second*/); - break; - } - } - - return date; - } - - int getServerCCSID() - { - int offset = 24; - int ccsid = 0; - - while (offset < (data_.length - 1)) - { - if (get16bit(offset + 4) != 0x1114) - { - offset = offset + get32bit(offset); - } - else - { - ccsid = get32bit(offset + 6); - break; - } - } - - return ccsid; - } - - byte[] getUserIdBytes() - { - int offset = 24; - while (offset < (data_.length - 1)) - { - if (get16bit(offset + 4) != 0x1104) - { - offset += get32bit(offset); - } - else - { - byte[] userIdBytes = {(byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40}; - System.arraycopy(data_, offset + 10, userIdBytes, 0, get32bit(offset) - 10); - return userIdBytes; - } - } - - return null; - } - - AS400Message[] getErrorMessages(ConverterImplRemote converter) throws IOException - { - return AS400ImplRemote.parseMessages(data_, 24, converter); - } - - void read(InputStream in) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Receiving retrieve signon information reply..."); - - // Receive the header. - byte[] header = new byte[20]; - if (readFromStream(in, header, 0, 20) < 20) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Failed to read all of the retrieve signon information reply header."); - throw new ConnectionDroppedException(ConnectionDroppedException.CONNECTION_DROPPED); - } - - // Allocate bytes for datastream. - data_ = new byte[BinaryConverter.byteArrayToInt(header, 0)]; - System.arraycopy(header, 0, data_, 0, 20); - - // Read in the rest of the data. - readAfterHeader(in); - } - - /** - Generates a hash code for this data stream. - @return the hash code - **/ - public int hashCode() - { - return 0xF004; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SignonInfoReq.java b/cvsroot/src/com/ibm/as400/access/SignonInfoReq.java deleted file mode 100644 index a6c97481a..000000000 --- a/cvsroot/src/com/ibm/as400/access/SignonInfoReq.java +++ /dev/null @@ -1,88 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SignonInfoReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2007 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -class SignonInfoReq extends ClientAccessDataStream -{ - SignonInfoReq(byte[] userIDbytes, byte[] authenticationBytes, int byteType, int serverLevel) - { - super(new byte[37 + authenticationBytes.length + (userIDbytes == null ? 0 : 16) + (serverLevel < 5 ? 0 : 7)]); - - setLength(data_.length); - // setHeaderID(0x0000); - setServerID(0xE009); - // setCSInstance(0x00000000); - // setCorrelation(0x00000000); - setTemplateLen(0x0001); - setReqRepID(0x7004); - - // Password's always encrypted. - data_[20] = (byteType == AS400.AUTHENTICATION_SCHEME_PASSWORD) ? (authenticationBytes.length == 8) ? (byte)0x01 : (byte)0x03 : (byteType == AS400.AUTHENTICATION_SCHEME_GSS_TOKEN) ? (byte)0x05 : (byteType == AS400.AUTHENTICATION_SCHEME_IDENTITY_TOKEN) ? (byte)0x06 : (byte)0x02; - - // Client CCSID. - // LL - set32bit(10, 21); - // CP - set16bit(0x1113, 25); - // CCSID - set32bit(1200, 27); // Client CCSID. - - // Set password or authentication token. - // LL - set32bit(6 + authenticationBytes.length, 31); - // CP - if (byteType == AS400.AUTHENTICATION_SCHEME_PASSWORD) - { - set16bit(0x1105, 35); - } - else - { - set16bit(0x1115, 35); - } - // Data. - System.arraycopy(authenticationBytes, 0, data_, 37, authenticationBytes.length); - - if (userIDbytes != null) - { - // Set user ID info. - // LL - set32bit(16, 37 + authenticationBytes.length); - // CP - set16bit(0x1104, 41 + authenticationBytes.length); - // EBCDIC user ID. - System.arraycopy(userIDbytes, 0, data_, 43 + authenticationBytes.length, 10); - } - - if (serverLevel >= 5) - { - int offset = 37 + authenticationBytes.length + (userIDbytes == null ? 0 : 16); - // Set return error messages. - // LL - set32bit(7, offset); - // CP - set16bit(0x1128, offset + 4); - // Data. - data_[offset + 6] = 0x01; - } - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending retrieve signon information request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SignonPingReq.java b/cvsroot/src/com/ibm/as400/access/SignonPingReq.java deleted file mode 100644 index c2e61094f..000000000 --- a/cvsroot/src/com/ibm/as400/access/SignonPingReq.java +++ /dev/null @@ -1,35 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SignonPingReq.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2008-2008 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.OutputStream; - -class SignonPingReq extends ClientAccessDataStream -{ - SignonPingReq() - { - super(new byte[20]); - - setLength(20); - setServerID(0xE009); - setReqRepID(0x7FFE); - } - - void write(OutputStream out) throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Sending signon server ping request..."); - super.write(out); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SocketContainer.java b/cvsroot/src/com/ibm/as400/access/SocketContainer.java deleted file mode 100644 index 1e78b6bda..000000000 --- a/cvsroot/src/com/ibm/as400/access/SocketContainer.java +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SocketContainer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.Socket; - -abstract class SocketContainer -{ - abstract void setProperties(Socket socket, String serviceName, String systemName, int port, SSLOptions options) throws IOException; - abstract void close() throws IOException; - abstract InputStream getInputStream() throws IOException; - abstract OutputStream getOutputStream() throws IOException; -} diff --git a/cvsroot/src/com/ibm/as400/access/SocketContainerInet.java b/cvsroot/src/com/ibm/as400/access/SocketContainerInet.java deleted file mode 100644 index de60e7db9..000000000 --- a/cvsroot/src/com/ibm/as400/access/SocketContainerInet.java +++ /dev/null @@ -1,44 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SocketContainerInet.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.Socket; - -class SocketContainerInet extends SocketContainer -{ - Socket socket_; - - void setProperties(Socket socket, String serviceName, String systemName, int port, SSLOptions options) throws IOException - { - socket_ = socket; - } - - void close() throws IOException - { - socket_.close(); - } - - InputStream getInputStream() throws IOException - { - return socket_.getInputStream(); - } - - OutputStream getOutputStream() throws IOException - { - return socket_.getOutputStream(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SocketContainerJSSE.java b/cvsroot/src/com/ibm/as400/access/SocketContainerJSSE.java deleted file mode 100644 index 345fb80d3..000000000 --- a/cvsroot/src/com/ibm/as400/access/SocketContainerJSSE.java +++ /dev/null @@ -1,53 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SocketContainerJSSE.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.Socket; - -import javax.net.ssl.SSLSocket; -import javax.net.ssl.SSLSocketFactory; - -// SocketContainerJSSE contains a socket capable of SSL communications with JSSE. -class SocketContainerJSSE extends SocketContainer -{ - private SSLSocket sslSocket_; - - void setProperties(Socket socket, String serviceName, String systemName, int port, SSLOptions options) throws IOException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "SocketContainerJSSE: create SSLSocket"); - SSLSocketFactory sslFactory = (SSLSocketFactory)SSLSocketFactory.getDefault(); - sslSocket_ = (SSLSocket)sslFactory.createSocket(socket, systemName, port, true); - } - - void close() throws IOException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "SocketContainerJSSE: close"); - sslSocket_.close(); - } - - InputStream getInputStream() throws IOException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "SocketContainerJSSE: getInputStream"); - return sslSocket_.getInputStream(); - } - - OutputStream getOutputStream() throws IOException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "SocketContainerJSSE: getOutputStream"); - return sslSocket_.getOutputStream(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SocketContainerUnix.java b/cvsroot/src/com/ibm/as400/access/SocketContainerUnix.java deleted file mode 100644 index f57dd4542..000000000 --- a/cvsroot/src/com/ibm/as400/access/SocketContainerUnix.java +++ /dev/null @@ -1,71 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SocketContainerUnix.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.Socket; - -class SocketContainerUnix extends SocketContainer -{ - private UnixSocket usocket_; - - - void setProperties(Socket socket, String serviceName, String systemName, int port, SSLOptions options) throws IOException - { - int serverNumber = 0; - if (serviceName.equalsIgnoreCase("as-central")) - { - serverNumber = 0; - } - else if (serviceName.equalsIgnoreCase("as-dtaq")) - { - serverNumber = 1; - } - else if (serviceName.equalsIgnoreCase("as-netprt")) - { - serverNumber = 2; - } - else if (serviceName.equalsIgnoreCase("as-rmtcmd")) - { - serverNumber = 3; - } - else if (serviceName.equalsIgnoreCase("as-signon")) - { - serverNumber = 4; - } - else if (serviceName.equalsIgnoreCase("as-ddm")) - { - serverNumber = 8; - } - - usocket_ = new UnixSocket(serverNumber); - } - - void close() throws IOException - { - usocket_.close(); - } - - InputStream getInputStream() throws IOException - { - return usocket_.getInputStream(); - } - - OutputStream getOutputStream() throws IOException - { - return usocket_.getOutputStream(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SocketContainerUnix2.java b/cvsroot/src/com/ibm/as400/access/SocketContainerUnix2.java deleted file mode 100644 index 8d5605862..000000000 --- a/cvsroot/src/com/ibm/as400/access/SocketContainerUnix2.java +++ /dev/null @@ -1,469 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SocketContainerUnix.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.Socket; -import java.net.SocketException; - -class SocketContainerUnix2 extends SocketContainer -{ - private int[] sd_; // [0] is normal descriptor, [1] is additionally needed for close() - private boolean closed_ = false; - private Object lock_ = new Object(); - - void setProperties(Socket socket, String serviceName, String systemName, int port, SSLOptions options) throws IOException - { - int serverNumber = 0; - if (serviceName.equalsIgnoreCase("as-central")) - { - serverNumber = 0; - } - else if (serviceName.equalsIgnoreCase("as-dtaq")) - { - serverNumber = 1; - } - else if (serviceName.equalsIgnoreCase("as-netprt")) - { - serverNumber = 2; - } - else if (serviceName.equalsIgnoreCase("as-rmtcmd")) - { - serverNumber = 3; - } - else if (serviceName.equalsIgnoreCase("as-signon")) - { - serverNumber = 4; - } - else if (serviceName.equalsIgnoreCase("as-database")) - { - serverNumber = 6; - } - else if (serviceName.equalsIgnoreCase("as-ddm")) - { - serverNumber = 8; - } - else - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Unrecognized serviceName: " + serviceName + ". Defaulting to as-central"); - } - try - { - /* A little background: From jt400Native.jar (NativeMethod.java) - we first load qyjspase32/64 followed by load of QYJSPART.SRVPGM. - qyjspase contains functions with same signature as qyjspart. - So these methods are used in a JNI call since they were loaded first. - (However, load order can't be relied upon when predicting which of - same-named methods will be found and used at run-time.) - We had a leak since socketPair creates two descriptors, - but we were only closing one of them. - Since we need to close both socketPair descriptors, we ended - up having to create a new method with new signature to return - both socket descriptors. And a corresponding socketPaseClose - method was added. We cannot just change the existing function - signatures to handle two descriptors, since if calling from old - jt400Native.jar they will fail, but other methods will still - be accessable, but will not work with ILE sockets. So the - solution is to use all or none of the PASE socket related methods. - (create, close, read, write). (ie. We cannot allow just - socketCreate() to fail and thus use old method (in qyjspntv.C), followed - by calls to PASE socketRead/Write since they fail.) - Also note that we want to be able to run with the old jt400Native - jar with the new qyjspaseXX lib. To do this, we have to add a try/catch - in java com.ibm.as400.access.SocketContainerUnix2 to first try - the new socketPaseCreate() function and if it fails, then catch the exception - and try the old function signature (ie socketCreate()). - If socketPaseCreate() fails, we cannot just move on down to the socketCreate() - in qyjspart since then socketRead/Write would fail (no mixing of ILE with PASE). - So this is why we have left the socketCreate/Close functions - here in this file and just added socketPaseCreate/Close with the needed updates. - */ - - boolean paseCallSucceeded = false; - if(NativeMethods.paseLibLoaded) - { - try{ - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Calling NativeMethods.socketPaseCreate()"); - - sd_ = NativeMethods.socketPaseCreate(serverNumber); //socketPaseCreate in qyjspase - paseCallSucceeded = true; - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Socket descriptor:", Integer.toString(sd_[0])); - } - catch(NativeException ne){ - // Got here because of actual exception creating socket on host. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "NativeException while calling NativeMethods.socketPaseCreate()"); - throw ne; - } - catch(UnsatisfiedLinkError e){ - // Probably got here because using new jt400Native.jar with old qyjspaseXX.so, - // so we just call the generic-named method in qyjspaseXX.so - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "UnsatisfiedLinkError while calling NativeMethods.socketPaseCreate()"); - } - catch(Throwable e){ - // Probably got here because using new jt400Native.jar with old qyjspaseXX.so, - // so we just call the generic-named method in qyjspaseXX.so - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Throwable while calling NativeMethods.socketPaseCreate()", e); - } - } - - if (!paseCallSucceeded) // try calling the generic-named method - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Calling NativeMethods.socketCreate()"); - - sd_ = new int[1]; - sd_[0] = NativeMethods.socketCreate(serverNumber); //socketCreate in qyjspart - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Socket descriptor:", Integer.toString(sd_[0])); - } - } - catch (NativeException e) - { - throw createSocketException(e); - } - } - - void close() throws IOException - { - if (!closed_) - { - try - { - boolean paseCallSucceeded = false; - if(NativeMethods.paseLibLoaded) - { - try{ - if (sd_.length < 2) { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Descriptor is not paired:", (sd_.length == 0 ? "null" : Integer.toString(sd_[0]))); - throw new Throwable(); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Calling NativeMethods.socketPaseClose("+Integer.toString(sd_[0])+")"); - - NativeMethods.socketPaseClose(sd_[0], sd_[1]); - paseCallSucceeded = true; - } - catch(NativeException ne){ - // Got here because of actual exception calling 'close' on host. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "NativeException while calling NativeMethods.socketPaseClose("+Integer.toString(sd_[0])+","+Integer.toString(sd_[1])+")"); - throw ne; - } - catch(UnsatisfiedLinkError e){ - // Probably got here because using new jt400Native.jar with old qyjspaseXX.so, - // so we just call the generic-named method in qyjspaseXX.so - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "UnsatisfiedLinkError while calling NativeMethods.socketPaseClose("+Integer.toString(sd_[0])+","+Integer.toString(sd_[1])+")"); - } - catch(Throwable e){ - // Probably got here because using new jt400Native.jar with old qyjspaseXX.so, - // so we just call the generic-named method in qyjspaseXX.so - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Throwable while calling NativeMethods.socketPaseClose("+Integer.toString(sd_[0])+","+Integer.toString(sd_[1])+")", e); - } - } - - if (!paseCallSucceeded) // try calling the generic-named method - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Calling NativeMethods.socketClose("+Integer.toString(sd_[0])+")"); - - NativeMethods.socketClose(sd_[0]); - } - } - catch (NativeException e) - { - throw createSocketException(e); - } - finally //@socket2 - { - sd_ = null; //@socket2 - closed_ = true; //@socket2 //add this so if close fails, we don't keep trying to close a broken socket - } - } - } - - protected void finalize() throws IOException - { - close(); - } - - InputStream getInputStream() throws IOException - { - synchronized (lock_) - { - return new SCUInputStream(); - } - } - - OutputStream getOutputStream() throws IOException - { - synchronized (lock_) - { - return new SCUOutputStream(); - } - } - - private static SocketException createSocketException(NativeException e) - { - try - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Error with unix domain socket, errno: " + e.errno_, e); - int jobCCSID; //@socket2 - if(NativeMethods.paseLibLoaded) - jobCCSID = 367; // PASE is ascii - else - jobCCSID = JobCCSIDNative.retrieveCcsid(); - - Converter conv = new Converter(jobCCSID); - return new SocketException(conv.byteArrayToString(e.data)); - } - catch (Throwable t) - { - } - return new SocketException(); - } - - private final class SCUInputStream extends InputStream - { - private boolean eof_; - private byte[] temp_ = new byte[1]; - - public int read(byte b[]) throws IOException - { - return read(b, 0, b.length); - } - - public int read(byte[] b, int off, int length) throws IOException - { - if (eof_) - { - return -1; - } - try - { - int n = 0; - boolean paseCallSucceeded = false; - if(NativeMethods.paseLibLoaded) - { - try - { - if (sd_.length < 2) { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Descriptor is not paired:", (sd_.length == 0 ? "null" : Integer.toString(sd_[0]))); - throw new Throwable(); - } - //if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Calling NativeMethods.socketPaseRead("+Integer.toString(sd_[0])+")"); - - n = NativeMethods.socketPaseRead(sd_[0], sd_[1], b, off, length); - paseCallSucceeded = true; - } - catch(NativeException ne) { - // Got here because of actual exception calling 'read' on host. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "NativeException while calling NativeMethods.socketPaseRead("+Integer.toString(sd_[0])+","+Integer.toString(sd_[1])+")"); - throw ne; - } - catch(UnsatisfiedLinkError e) { - // Probably got here because using new jt400Native.jar with old qyjspaseXX.so, - // so we just call the generic-named method in qyjspaseXX.so - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "UnsatisfiedLinkError while calling NativeMethods.socketPaseRead("+Integer.toString(sd_[0])+","+Integer.toString(sd_[1])+")"); - } - catch(Throwable e) { - // Probably got here because using new jt400Native.jar with old qyjspaseXX.so, - // so we just call the generic-named method in qyjspaseXX.so - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Throwable while calling NativeMethods.socketPaseRead("+Integer.toString(sd_[0])+","+Integer.toString(sd_[1])+")", e); - } - } - - if (!paseCallSucceeded) // try calling the generic-named method - { - if (Trace.traceOn_ && NativeMethods.paseLibLoaded) Trace.log(Trace.DIAGNOSTIC, "Calling NativeMethods.socketRead("+Integer.toString(sd_[0])+")"); - - n = NativeMethods.socketRead(sd_[0], b, off, length); - } - - if (n <= 0) - { - eof_ = true; - return -1; - } - return n; - } - catch (NativeException e) - { - throw createSocketException(e); - } - } - - public int read() throws IOException - { - if (eof_) - { - return -1; - } - - int n = read(temp_, 0, 1); - if (n <= 0) - { - return -1; - } - return temp_[0] & 0xff; - } - - public long skip(long numbytes) throws IOException - { - if (numbytes <= 0) - { - return 0; - } - long n = numbytes; - int buflen = (int)Math.min(1024, n); - byte data[] = new byte[buflen]; - while (n > 0) - { - int r = read(data, 0, (int)Math.min((long)buflen, n)); - if (r < 0) - { - break; - } - n -= r; - } - return numbytes - n; - } - - public int available() throws IOException - { - synchronized (lock_) - { - try - { - int result = 0; - boolean paseCallSucceeded = false; - if(NativeMethods.paseLibLoaded) - { - try - { - if (sd_.length < 2) { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Descriptor is not paired:", (sd_.length == 0 ? "null" : Integer.toString(sd_[0]))); - throw new Throwable(); - } - //if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Calling NativeMethods.socketPaseAvailable("+Integer.toString(sd_[0])+")"); - - result = NativeMethods.socketPaseAvailable(sd_[0], sd_[1]); - paseCallSucceeded = true; - } - catch(NativeException ne){ - // Got here because of actual exception calling 'available' on host. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "NativeException while calling NativeMethods.socketPaseAvailable("+Integer.toString(sd_[0])+","+Integer.toString(sd_[1])+")"); - throw ne; - } - catch(UnsatisfiedLinkError e){ - // Probably got here because using new jt400Native.jar with old qyjspaseXX.so, - // so we just call the generic-named method in qyjspaseXX.so - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "UnsatisfiedLinkError while calling NativeMethods.socketPaseAvailable("+Integer.toString(sd_[0])+","+Integer.toString(sd_[1])+")"); - } - catch(Throwable e){ - // Probably got here because using new jt400Native.jar with old qyjspaseXX.so, - // so we just call the generic-named method in qyjspaseXX.so - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Throwable while calling NativeMethods.socketPaseAvailable("+Integer.toString(sd_[0])+","+Integer.toString(sd_[1])+")", e); - } - } - - if (!paseCallSucceeded) // try calling the generic-named method - { - if (Trace.traceOn_ && NativeMethods.paseLibLoaded) Trace.log(Trace.DIAGNOSTIC, "Calling NativeMethods.socketAvailable("+Integer.toString(sd_[0])+")"); - - result = NativeMethods.socketAvailable(sd_[0]); - } - - return result; - } - catch (NativeException e) - { - throw createSocketException(e); - } - } - } - - public void close() throws IOException - { - SocketContainerUnix2.this.close(); - } - } - - private final class SCUOutputStream extends OutputStream - { - private byte temp_[] = new byte[1]; - - public void write(int b) throws IOException - { - temp_[0] = (byte)b; - write(temp_, 0, 1); - } - - public void write(byte b[]) throws IOException - { - write(b, 0, b.length); - } - - public void write(byte b[], int off, int length) throws IOException - { - try - { - boolean paseCallSucceeded = false; - if(NativeMethods.paseLibLoaded) - { - try - { - if (sd_.length < 2) { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Descriptor is not paired:", (sd_.length == 0 ? "null" : Integer.toString(sd_[0]))); - throw new Throwable(); - } - //if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Calling NativeMethods.socketPaseWrite("+Integer.toString(sd_[0])+")"); - - NativeMethods.socketPaseWrite(sd_[0], sd_[1], b, off, length); - paseCallSucceeded = true; - } - catch(NativeException ne){ - // Got here because of actual exception calling 'write' on host. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "NativeException while calling NativeMethods.socketPaseWrite("+Integer.toString(sd_[0])+","+Integer.toString(sd_[1])+")"); - throw ne; - } - catch(UnsatisfiedLinkError e){ - // Probably got here because using new jt400Native.jar with old qyjspaseXX.so, - // so we just call the generic-named method in qyjspaseXX.so - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "UnsatisfiedLinkError while calling NativeMethods.socketPaseWrite("+Integer.toString(sd_[0])+","+Integer.toString(sd_[1])+")"); - } - catch(Throwable e){ - // Probably got here because using new jt400Native.jar with old qyjspaseXX.so, - // so we just call the generic-named method in qyjspaseXX.so - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Throwable while calling NativeMethods.socketPaseWrite("+Integer.toString(sd_[0])+","+Integer.toString(sd_[1])+")", e); - } - } - - if (!paseCallSucceeded) // try calling the generic-named method - { - if (Trace.traceOn_ && NativeMethods.paseLibLoaded) Trace.log(Trace.DIAGNOSTIC, "Calling NativeMethods.socketWrite("+Integer.toString(sd_[0])+")"); - - NativeMethods.socketWrite(sd_[0], b, off, length); - } - } - catch (NativeException e) - { - throw createSocketException(e); - } - } - - public void close() throws IOException - { - SocketContainerUnix2.this.close(); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SocketProperties.java b/cvsroot/src/com/ibm/as400/access/SocketProperties.java deleted file mode 100644 index 38516c8a7..000000000 --- a/cvsroot/src/com/ibm/as400/access/SocketProperties.java +++ /dev/null @@ -1,387 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SocketProperties.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; - -/** - The SocketProperties class represents a set of socket options the IBM Toolbox for Java will set on its client side sockets. Setting the values on this object will not change any existing connection to the system. The values retrieved from this object reflect only the values set into this object, not the properties of any actual connection to the system. -

    Socket properties are described in the javadoc for the JDK's java.net.Socket class. See the JDK documentation for further details. - **/ -public class SocketProperties implements Serializable -{ - static final long serialVersionUID = 6818790247993750518L; - - boolean keepAliveSet_ = false; - boolean keepAlive_ = false; - boolean receiveBufferSizeSet_ = false; - int receiveBufferSize_ = 0; - boolean sendBufferSizeSet_ = false; - int sendBufferSize_ = 0; - boolean soLingerSet_ = false; - int soLinger_ = 0; - boolean soTimeoutSet_ = false; - int soTimeout_ = 0; - boolean tcpNoDelaySet_ = false; - boolean tcpNoDelay_ = false; - boolean loginTimeoutSet_ = false; //@STIMEOUT - int loginTimeout_ = 0; //@STIMEOUT this is an option in java.net.Socket.connect(SocketAddress endpoint, int timeout) (java 1.4) - - // Internal method to copy all the options from one object to another. - void copyValues(SocketProperties properties) - { - keepAliveSet_ = properties.keepAliveSet_; - keepAlive_ = properties.keepAlive_; - receiveBufferSizeSet_ = properties.receiveBufferSizeSet_; - receiveBufferSize_ = properties.receiveBufferSize_; - sendBufferSizeSet_ = properties.sendBufferSizeSet_; - sendBufferSize_ = properties.sendBufferSize_; - soLingerSet_ = properties.soLingerSet_; - soLinger_ = properties.soLinger_; - soTimeoutSet_ = properties.soTimeoutSet_; - soTimeout_ = properties.soTimeout_; - loginTimeoutSet_ = properties.loginTimeoutSet_; //@st3 - loginTimeout_ = properties.loginTimeout_; //@st3 - tcpNoDelaySet_ = properties.tcpNoDelaySet_; - tcpNoDelay_ = properties.tcpNoDelay_; - } - - /** - Indicates whether some other object is "equal to" this one. - SocketProperties objects are considered equal if all of their property values match. - @return true if this object is equals the obj argument; false otherwise. - **/ - public boolean equals(Object other) - { - if (other == null) return false; - try { - SocketProperties props = (SocketProperties)other; - if (keepAliveSet_ == props.keepAliveSet_ && - keepAlive_ == props.keepAlive_ && - receiveBufferSizeSet_ == props.receiveBufferSizeSet_ && - receiveBufferSize_ == props.receiveBufferSize_ && - sendBufferSizeSet_ == props.sendBufferSizeSet_ && - sendBufferSize_ == props.sendBufferSize_ && - soLingerSet_ == props.soLingerSet_ && - soLinger_ == props.soLinger_ && - soTimeoutSet_ == props.soTimeoutSet_ && - soTimeout_ == props.soTimeout_ && - tcpNoDelaySet_ == props.tcpNoDelaySet_ && - tcpNoDelay_ == props.tcpNoDelay_) - return true; - else return false; - } - catch (Throwable e) { return false; } - } - - /** - Returns a hash code value for the object. - @return A hash code value for this object. - **/ - public int hashCode() - { - // We must conform to the invariant that equal objects must have equal hashcodes. - // Since we don't anticipate that instances of this class will ever get added into a HashMap/HashTable, we will simply return an arbitrary constant. - return 99; - } - - /** - Indicates the value to which the SO_RCVBUF socket option is set. - @return The value of SO_RCVBUF, in bytes. - **/ - public int getReceiveBufferSize() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting receive buffer size:", receiveBufferSize_); - return receiveBufferSize_; - } - - /** - Indicates the value to which the SO_SNDBUF socket option is set. - @return The value of SO_SNDBUF, in bytes. - **/ - public int getSendBufferSize() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting send buffer size:", sendBufferSize_); - return sendBufferSize_; - } - - /** - Indicates the value to which the SO_LINGER socket option is set. - @return The value of SO_LINGER, in seconds. - **/ - public int getSoLinger() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting so linger:", soLinger_); - return soLinger_; - } - - //@STIMEOUT - /** - Indicates the value to which the login timeout socket option is set in milliseconds. - @return The value in milliseconds. - **/ - public int getLoginTimeout() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting so socket login timeout:", loginTimeout_); - return loginTimeout_; - } - - /** - Indicates the value to which the SO_TIMEOUT socket option is set. - @return The value of SO_TIMEOUT, in milliseconds. - **/ - public int getSoTimeout() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting so timeout:", soTimeout_); - return soTimeout_; - } - - /** - Indicates the value to which the SO_KEEPALIVE socket option is set. - @return true if SO_KEEPALIVE is set; false otherwise. - **/ - public boolean isKeepAlive() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if keep alive:", keepAlive_); - return keepAlive_; - } - - /** - Indicates if the value of any of the socket options will be set. - This method provides a quick way to see if this SocketProperties object has been altered (via a setter) such that it would cause at least one socket option to be set. - @return true if any option will be set; false otherwise. - **/ - boolean isAnyOptionSet() - { - boolean result = - keepAliveSet_ || receiveBufferSizeSet_ || sendBufferSizeSet_ || - soLingerSet_ || soTimeoutSet_ || tcpNoDelaySet_; - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if any option is set:", result); - return result; - } - - /** - Indicates if the value of the SO_KEEPALIVE socket option will be set. - @return true if SO_KEEPALIVE will be set; false otherwise. - **/ - public boolean isKeepAliveSet() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if keep alive is set:", keepAliveSet_); - return keepAliveSet_; - } - - /** - Indicates if the value of the SO_RCVBUF socket option will be set. - @return true if SO_RCVBUF will be set; false otherwise. - **/ - public boolean isReceiveBufferSizeSet() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting receive buffer size is set:", receiveBufferSizeSet_); - return receiveBufferSizeSet_; - } - - /** - Indicates if the value of the SO_SNDBUF socket option will be set. - @return true if SO_SNDBUF will be set; false otherwise. - **/ - public boolean isSendBufferSizeSet() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting send buffer size is set:", sendBufferSizeSet_); - return sendBufferSizeSet_; - } - - /** - Indicates if the value of the SO_LINGER socket option will be set. - @return true if SO_LINGER will be set; false otherwise. - **/ - public boolean isSoLingerSet() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting so linger is set:", soLingerSet_); - return soLingerSet_; - } - - //@STIMEOUT - /** - Indicates if the value of the login timeout socket option will be set. - @return true if login timeout will be set; false otherwise. - **/ - public boolean isLoginTimeoutSet() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting socket login timeout is set:", loginTimeoutSet_); - return loginTimeoutSet_; - } - - /** - Indicates if the value of the SO_TIMEOUT socket option will be set. - @return true if SO_TIMEOUT will be set; false otherwise. - **/ - public boolean isSoTimeoutSet() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting so timeout is set:", soTimeoutSet_); - return soTimeoutSet_; - } - - /** - Indicates the value to which the TCP_NODELAY socket option is set. - @return true if TCP_NODELAY is set; false otherwise. - **/ - public boolean isTcpNoDelay() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if TCP no delay:", tcpNoDelay_); - return tcpNoDelay_; - } - - /** - Indicates if the value of the TCP_NODELAY socket option will be set. - @return true if TCP_NODELAY will be set; false otherwise. - **/ - public boolean isTcpNoDelaySet() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if TCP no delay is set:", tcpNoDelaySet_); - return tcpNoDelaySet_; - } - - /** - Indicates the value to which the SO_KEEPALIVE socket option should be set. - @param keepAlive true to set SO_KEEPALIVE; false otherwise. - **/ - public void setKeepAlive(boolean keepAlive) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting keep alive:", keepAlive); - keepAliveSet_ = true; - keepAlive_ = keepAlive; - } - - //@STIMEOUT - /** - Indicates the value to for timeout when creating a new socket connection in milliseconds. - @param loginTimeout The value in milliseconds. - **/ - public void setLoginTimeout(int loginTimeout) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting socket login timeout:", loginTimeout); - loginTimeoutSet_ = true; - loginTimeout_ = loginTimeout; - } - - /** - Indicates the value to which the SO_RCVBUF socket option should be set. - @param receiveBufferSize The value to set SO_RCVBUF, in bytes. - **/ - public void setReceiveBufferSize(int receiveBufferSize) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting receive buffer size:", receiveBufferSize); - receiveBufferSizeSet_ = true; - receiveBufferSize_ = receiveBufferSize; - } - - /** - Indicates the value to which the SO_SNDBUF socket option should be set. - @param sendBufferSize The value to set SO_SNDBUF, in bytes. - **/ - public void setSendBufferSize(int sendBufferSize) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting send buffer size:", sendBufferSize); - sendBufferSizeSet_ = true; - sendBufferSize_ = sendBufferSize; - } - - /** - Indicates the value to which the SO_LINGER socket option should be set. - @param soLinger The value to set SO_LINGER, in seconds. - **/ - public void setSoLinger(int soLinger) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting so linger:", soLinger); - soLingerSet_ = true; - soLinger_ = soLinger; - } - - /** - Indicates the value to which the SO_TIMEOUT socket option should be set. - @param soTimeout The value to set SO_TIMEOUT, in milliseconds. - **/ - public void setSoTimeout(int soTimeout) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting so timeout:", soTimeout); - soTimeoutSet_ = true; - soTimeout_ = soTimeout; - } - - /** - Indicates the value to which the TCP_NODELAY socket option should be set. - @param tcpNoDelay true to set TCP_NODELAY; false otherwise. - **/ - public void setTcpNoDelay(boolean tcpNoDelay) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting TCP no delay:", tcpNoDelay); - tcpNoDelaySet_ = true; - tcpNoDelay_ = tcpNoDelay; - } - - /** - Indicates that the value of the SO_KEEPALIVE socket option should not be set. - **/ - public void unsetKeepAlive() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Unsetting keep alive."); - keepAliveSet_ = false; - } - - /** - Indicates that the value of the SO_RCVBUF socket option should not be set. - **/ - public void unsetReceiveBufferSize() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Unsetting receive buffer size."); - receiveBufferSizeSet_ = false; - } - - /** - Indicates that the value of the SO_SNDBUF socket option should not be set. - **/ - public void unsetSendBufferSize() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Unsetting send buffer size."); - sendBufferSizeSet_ = false; - } - - /** - Indicates that the value of the SO_LINGER socket option should not be set. - **/ - public void unsetSoLinger() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Unsetting so linger."); - soLingerSet_ = false; - } - - /** - Indicates that the value of the SO_TIMEOUT socket option should not be set. - **/ - public void unsetSoTimeout() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Unsetting so timeout."); - soTimeoutSet_ = false; - } - - /** - Indicates that the value of the TCP_NODELAY socket option should not be set. - **/ - public void unsetTcpNoDelay() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Unsetting TCP no delay."); - tcpNoDelaySet_ = false; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SpooledFile.java b/cvsroot/src/com/ibm/as400/access/SpooledFile.java deleted file mode 100644 index 07a9a0105..000000000 --- a/cvsroot/src/com/ibm/as400/access/SpooledFile.java +++ /dev/null @@ -1,1137 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SpooledFile.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.UnsupportedEncodingException; - -/** - * Represents a spooled file. - * You can use an instance of this class to manipulate an individual - * spooled file (hold, release, delete, send, read, and so on). - * To create new spooled files on the system, use the - * {@link SpooledFileOutputStream SpooledFileOutputStream} class. - * - * See Spooled File Attributes for - * valid attributes. - * - * @see PrintObjectInputStream - * @see PrintObjectPageInputStream - * @see PrintObjectTransformedInputStream - **/ - -public class SpooledFile extends PrintObject -implements java.io.Serializable -{ - static final long serialVersionUID = 4L; - - transient boolean fMsgRetrieved_ = false; - - // constructor used internally (not externalized since it takes - // an ID code point - SpooledFile(AS400 system, NPCPIDSplF id, NPCPAttribute attrs) - { - super(system, id, attrs, NPConstants.SPOOLED_FILE); - } - - - // We have decide that spooled files are too transient to be JavaBeans. - - - /** - * Constructs a SpooledFile object. It uses the specified system and - * spooled file attributes that identify it on that system. - * - * @param system The system on which this spooled file exists. - * @param name The name of the spooled file. - * @param number The number of the spooled file. - * @param jobName The name of the job that created the spooled file. - * @param jobUser The user who created the spooled file. - * @param jobNumber The number of the job that created the spooled file. - * - **/ - public SpooledFile(AS400 system, - String name, - int number, - String jobName, - String jobUser, - String jobNumber) - { - super(system, - new NPCPIDSplF(name, - number, - jobName, - jobUser, - jobNumber), - null, - NPConstants.SPOOLED_FILE); - - // base class constructor checks for null system. - if (name == null) - { - Trace.log(Trace.ERROR, "Parameter 'name' is null."); - throw new NullPointerException("name"); - } - - if (number < -1) // (changed from 1 to -1 to allow 0(=*ONLY) and -1(=*LAST)) - { - Trace.log(Trace.ERROR, "Parameter 'number' is less than -1."); - throw new ExtendedIllegalArgumentException( - "number(" + number + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (jobName == null) - { - Trace.log(Trace.ERROR, "Parameter 'jobName' is null."); - throw new NullPointerException("jobName"); - } - - if (jobUser == null) - { - Trace.log(Trace.ERROR, "Parameter 'jobUser' is null."); - throw new NullPointerException("jobUser"); - } - - if (jobNumber == null) - { - Trace.log(Trace.ERROR, "Parameter 'jobNumber' is null."); - throw new NullPointerException("jobNumber"); - } - } - - // Alternate constructor for spooled files detached from jobs - /** - * Constructs a SpooledFile object. It uses the specified system and - * spooled file attributes that identify it on that system. - * - * @param system The system on which this spooled file exists. - * @param name The name of the spooled file. - * @param number The number of the spooled file. - * @param jobName The name of the job that created the spooled file. - * @param jobUser The user who created the spooled file. - * @param jobNumber The number of the job that created the spooled file. - * @param jobSysName The name of the system where the spooled file was created. - * @param createDate The date the spooled file was created on the system. - *
    - * The date is encoded in a character string with the following format, - * CYYMMDD where: - *

      - *
    • C is the Century, where 0 indicates years 19xx and 1 indicates years 20xx - *
    • YY is the Year - *
    • MM is the Month - *
    • DD is the Day - *
    - * @param createTime The time the spooled file was created on the system. - *
    - * The time is encoded in a character string with the following format, - * HHMMSS where: - *
      - *
    • HH - Hour - *
    • MM - Minutes - *
    • SS - Seconds - *
    - **/ - - public SpooledFile(AS400 system, - String name, - int number, - String jobName, - String jobUser, - String jobNumber, - String jobSysName, - String createDate, - String createTime) - { - super(system, - new NPCPIDSplF(name, - number, - jobName, - jobUser, - jobNumber, - jobSysName, - createDate, - createTime), - null, - NPConstants.SPOOLED_FILE); - - // base class constructor checks for null system. - - if (name == null) - { - Trace.log(Trace.ERROR, "Parameter 'name' is null."); - throw new NullPointerException("name"); - } - - if (number < -1) // (changed from 1 to -1 to allow 0(=*ONLY) and -1(=*LAST)) - { - Trace.log(Trace.ERROR, "Parameter 'number' is less than -1."); - throw new ExtendedIllegalArgumentException( - "number(" + number + ")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (jobName == null) - { - Trace.log(Trace.ERROR, "Parameter 'jobName' is null."); - throw new NullPointerException("jobName"); - } - - if (jobUser == null) - { - Trace.log(Trace.ERROR, "Parameter 'jobUser' is null."); - throw new NullPointerException("jobUser"); - } - - if (jobNumber == null) - { - Trace.log(Trace.ERROR, "Parameter 'jobNumber' is null."); - throw new NullPointerException("jobNumber"); - } - - if (jobSysName == null) - { - Trace.log(Trace.ERROR, "Parameter 'jobSysName' is null."); - throw new NullPointerException("jobSysName"); - } - - if (createDate == null) - { - Trace.log(Trace.ERROR, "Parameter 'createDate' is null."); - throw new NullPointerException("createDate"); - } - - if (createTime == null) - { - Trace.log(Trace.ERROR, "Parameter 'createTime' is null."); - throw new NullPointerException("createTime"); - } - } - - - - /** Replies to the message that caused the spooled file to wait. - * - * @param reply The string that contains the reply for the message. - * The default reply can be obtained by calling - * the getMessage() method, and then calling the - * getDefaultReply() method on the message object that is returned. - * Other possible replies are given in the message help, - * which can also be retrieved from the message object returned - * on the getMessage() method. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is - * completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system is not at the correct level. - **/ - public void answerMessage(String reply) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - if (impl_ == null) - chooseImpl(); - ((SpooledFileImpl) impl_).answerMessage(reply); - // update the spooled file attributes - attrs = impl_.getAttrValue(); - fMsgRetrieved_ = ((SpooledFileImpl) impl_).getFMsgRetrieved(); - } - - - - /** - * Chooses the implementation - **/ - void chooseImpl() - throws IOException, AS400SecurityException - { - // We need to get the system to connect to... - AS400 system = getSystem(); - if (system == null) { - Trace.log( Trace.ERROR, "Attempt to use SpooledFile before setting system." ); - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - impl_ = (SpooledFileImpl) system.loadImpl2("com.ibm.as400.access.SpooledFileImplRemote", - "com.ibm.as400.access.SpooledFileImplProxy"); - // The connectService(AS400.PRINT) is done in setImpl() - // in the Printobject class. - super.setImpl(); - } - - - - /** - * Creates a copy of the spooled file this (SpooledFile) object represents. The - * new spooled file is created on the same output queue and on the same system - * as the original spooled file. A reference to the new spooled file is returned. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system is not at the correct level. - **/ - public SpooledFile copy() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - String name = getStringAttribute(ATTR_OUTPUT_QUEUE); - OutputQueue outq = new OutputQueue(getSystem(), name); - SpooledFile sf = copy(outq); - return sf; - } - - - - /** - * Creates a copy of the spooled file this object represents. The - * new spooled file is created on the specified output queue. - * A reference to the new spooled file is returned. - * - * @param outputQueue The output queue location to create the new version of the - * original spooled file. The spooled file will be created to the first - * position on this output queue. The output queue and this spooled - * file must reside on the same system. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system is not at the correct level. - **/ - public SpooledFile copy(OutputQueue outputQueue) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - // choose implementations - if (impl_ == null) { - chooseImpl(); - } - if (outputQueue.getImpl() == null) { - outputQueue.chooseImpl(); - } - - NPCPIDSplF spID = - ((SpooledFileImpl) impl_).copy((OutputQueueImpl)outputQueue.getImpl()); - - try { - spID.setConverter((new Converter(getSystem().getCcsid(), getSystem())).impl); - } - catch (UnsupportedEncodingException e) { - if (Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR, "Error initializing converter for spooled file."); - } - } - SpooledFile sf = new SpooledFile(getSystem(), spID, null); - return sf; - } - - - - /** - * Deletes the spooled file on the system. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - **/ - public void delete() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - if (impl_ == null) - chooseImpl(); - ((SpooledFileImpl) impl_).delete(); - } - - - /** - * Returns an input stream that can be used to read the contents of the - * spooled file. - * This method will fail with an AS400Exception if the spooled file is - * still being created (ATTR_SPLFSTATUS is *OPEN). - * Note that the bytes are returned untransformed, that is, as they are - * stored on the server. To transform the bytes into other forms, use - * {@link #getPageInputStream getPageInputStream} or - * {@link #getTransformedInputStream getTransformedInputStream}. - * - * @return The input stream object that can be used to read the contents - * of this spooled file. - * @exception AS400Exception If system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported - * because the system is not at the - * correct level. - * @see #getPageInputStream - * @see #getTransformedInputStream - **/ - public PrintObjectInputStream getInputStream() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - PrintObjectInputStream is = new PrintObjectInputStream(this, null); - return is; - } - - - /** - * Returns an input stream that can be used to read the contents of the - * spooled file. - * This method will fail with an AS400Exception if the spooled file is - * still being created (ATTR_SPLFSTATUS is *OPEN). - * Note that the bytes are returned untransformed, that is, as they are - * stored on the server. To transform the bytes into other forms, use - * {@link #getPageInputStream getPageInputStream} or - * {@link #getTransformedInputStream getTransformedInputStream}. - * - * @return The input stream object that can be used to read the contents - * of this spooled file. - * @exception AS400Exception If system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported - * because the system is not at the - * correct level. - * @see #getPageInputStream - * @see #getTransformedInputStream - **/ - public PrintObjectInputStream getInputStream(PrintParameterList ppl) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - PrintObjectInputStream is = new PrintObjectInputStream(this, ppl); - return(is); - } - - - /** - * @deprecated Use getAFPInputStream() instead. - * @see #getAFPInputStream - **/ - public PrintObjectInputStream getInputACIFMergedStream(boolean acifB) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - String acifS; - // possible open options that we could use - - // acifB == true then process ACIF merged data - // else normal processing - if (acifB){ - acifS = "Y"; - } else acifS = "N"; - - PrintObjectInputStream is = new PrintObjectInputStream(this, null, acifS); - return is; - } - - /** - * Returns an input stream that can be used to read the contents of an - * AFP spooled file. The external resources referenced by the original - * AFP spooled file will be included in this input stream. If you don't want - * the external resources included use - * {@link #getInputStream getInputStream} or - * {@link #getPageInputStream getPageInputStream}. - * This method will fail with an AS400Exception if the spooled file is - * still being created (ATTR_SPLFSTATUS is *OPEN) or if the spooled file - * doesn't contain AFDS data ie. ATTR_PRTDEVTYPE is not *AFPDS. - * - * @return The input stream object that can be used to read the contents - * of this spooled file. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported - * because the system operating system is not - * at the correct level. - * @see #getInputStream - * @see #getPageInputStream - **/ - public PrintObjectInputStream getAFPInputStream() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - PrintObjectInputStream is = new PrintObjectInputStream(this, null, "Y"); - return is; - } - - /** - * Returns the name of the job that created the spooled file. - * @return The job name. - **/ - public String getJobName() - { - NPCPID IDCodePoint = getIDCodePoint(); - - if( IDCodePoint == null ) { - return EMPTY_STRING; // "" - } else { - return IDCodePoint.getStringValue(ATTR_JOBNAME); - } - } - - - - /** - * Returns the number of the job that created the spooled file. - * @return The job number. - **/ - public String getJobNumber() - { - NPCPID IDCodePoint = getIDCodePoint(); - - if( IDCodePoint == null ) { - return EMPTY_STRING; // "" - } else { - return IDCodePoint.getStringValue(ATTR_JOBNUMBER); - } - } - - - - /** - * Returns the ID of the user that created the spooled file. - * @return The user ID. - **/ - public String getJobUser() - { - NPCPID IDCodePoint = getIDCodePoint(); - - if( IDCodePoint == null ) { - return EMPTY_STRING; // "" - } else { - return IDCodePoint.getStringValue(ATTR_JOBUSER); - } - } - - // The next three attributes are added to provide the - // decoupled spooled file identity. - - /** - * Returns the name of the system where the spooled file was created. - * @return The name of the system where the spooled file was created. - **/ - public String getJobSysName() - { - String jobSysName = EMPTY_STRING; - NPCPID IDCodePoint = getIDCodePoint(); - if (IDCodePoint == null) { - return(jobSysName); - } else { - jobSysName = IDCodePoint.getStringValue(ATTR_JOBSYSTEM); - if (jobSysName == null) { - try { - jobSysName = this.getStringAttribute(ATTR_JOBSYSTEM); - } - catch (Exception e) { - // ignore exceptions, splf may not have this attr. - jobSysName = EMPTY_STRING; - } - } - return(jobSysName); - } - } - - /** - * Returns the date of the spooled file creation. - * The date is encoded in the CYYMMDD format. - * @return The date (CYYMMDD) of the spooled file creation. - **/ - public String getCreateDate() - { - String createDate = EMPTY_STRING; - NPCPID IDCodePoint = getIDCodePoint(); - if (IDCodePoint == null) { - return(createDate); - } else { - createDate = IDCodePoint.getStringValue(ATTR_DATE); - if (createDate == null) { - try { - createDate = this.getStringAttribute(ATTR_DATE); - } - catch (Exception e) { - // ignore exceptions, splf may not have this attr. - createDate = EMPTY_STRING; - } - } - return(createDate); - } - } - - /** - * Returns the time of spooled file creation. - * The time is encoded in the HHMMSS format. - * @return The time (HHMMSS) of the spooled file creation. - **/ - public String getCreateTime() - { - String createTime = EMPTY_STRING; - NPCPID IDCodePoint = getIDCodePoint(); - if (IDCodePoint == null) { - return(createTime); - } else { - createTime = IDCodePoint.getStringValue(ATTR_TIME); - if (createTime == null) { - try { - createTime = this.getStringAttribute(ATTR_TIME); - } - catch (Exception e) { - // ignore exceptions, splf may not have this attr. - createTime = EMPTY_STRING; - } - } - return(createTime); - } - } - - /** - * Returns the message that is associated with this spooled file. - * A spooled file has a message associated with it if its - * ATTR_SPLFSTATUS attribute returns *MESSAGE. - * - * @return The AS400Message object that contains the message text, - * type, severity, id, date, time, and default reply. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - **/ - public AS400Message getMessage() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - if (impl_ == null) - chooseImpl(); - AS400Message msg = ((SpooledFileImpl) impl_).getMessage(); - fMsgRetrieved_ = ((SpooledFileImpl) impl_).getFMsgRetrieved(); - return msg; - } - - - - /** - * Returns the name of the spooled file. - * @return The name of the spooled file. - **/ - public String getName() - { - NPCPID IDCodePoint = getIDCodePoint(); - - if( IDCodePoint == null ) - { - return EMPTY_STRING; // "" - } else { - return IDCodePoint.getStringValue(ATTR_SPOOLFILE); - } - } - - - - /** - * Returns the number of the spooled file. - * @return The number of the spooled file. - **/ - public int getNumber() - { - NPCPID IDCodePoint = getIDCodePoint(); - - if( IDCodePoint == null ) { - return 0; - } else { - return IDCodePoint.getIntValue(ATTR_SPLFNUM).intValue(); - } - } - - - - /** - * Returns a page input stream that can be used to read the contents of the - * spooled file, one page at a time. - *
    - * See Example using PrintObjectPageInputStream - *
    - * @param pageStreamOptions A print parameter list that contains - * parameters for generating the page input stream.
    - * The following attributes are optional: - *
      - *
    • ATTR_MFGTYPE - Specifies the manufacturer type and model. - *
    • ATTR_WORKSTATION_CUST_OBJECT - Specifies the integrated file system name of - * the workstation customization object to be - * used. The workstation customizing object - * associated with the manufacturer, type, and - * model is the default. - *
    • ATTR_PAPER_SOURCE_1 - Specifies the paper size of drawer 1. - *
    • ATTR_PAPER_SOURCE_2 - Specifies the paper size of drawer 2. - *
    • ATTR_VIEWING_FIDELITY - Specifies the fidelity used to process pages. - * - *
    - * - * @return A page input stream object that can be used to read the contents - * of this spooled file, one page at a time. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed, - or the spooled file format is not supported. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported - * because the system operating system is not - * at the correct level. - **/ - public PrintObjectPageInputStream getPageInputStream(PrintParameterList pageStreamOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - PrintObjectPageInputStream is = new PrintObjectPageInputStream(this, pageStreamOptions); - return is; - } - - - - /** - * Returns a transformed input stream that can be used to read the contents of the - * spooled file. - *
    - * See Example using PrintObjectTransformedInputStream - *
    - * @param transformOptions A print parameter list that contains - * parameters for generating the transformed input stream.
    - * The following attribute MUST be set: - *
      - *
    • ATTR_MFGTYPE - Specifies the manufacturer, type, and model. - *
    - * The following attributes are optional: - *
      - *
    • ATTR_WORKSTATION_CUST_OBJECT - Specifies the integrated file system name of - * the workstation customization object to be - * used. The workstation customizing object - * associated with the manufacturer, type, and - * model is the default. - *
    • ATTR_PAPER_SOURCE_1 - Specifies the paper size of drawer 1. - *
    • ATTR_PAPER_SOURCE_2 - Specifies the paper size of drawer 2. - * - *
    - * - * @return The transformed input stream object that can be used to read the contents - * of the transformed spooled file. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed, - * or the spooled file format is not supported. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported - * because the system operating system is not - * at the correct level. - **/ - public PrintObjectTransformedInputStream getTransformedInputStream(PrintParameterList transformOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - PrintObjectTransformedInputStream is = new PrintObjectTransformedInputStream(this, transformOptions); - return is; - } - - - - /** - * Holds the spooled file. - * @param holdType When to hold the spooled file. - * May be any of the following values: - *
      - *
    • *IMMED - The spooled file is held immediately. - *
    • *PAGEEND - The spooled file is held at the end of the current page. - *
    - * holdType may be null. If holdType is not specified, the default is - * *IMMED. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported - * because the system operating system is not - * at the correct level. - **/ - public void hold(String holdType) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - if (impl_ == null) - chooseImpl(); - ((SpooledFileImpl) impl_).hold(holdType); - // update the spooled file attributes - attrs = impl_.getAttrValue(); - } - - - - /** - * Moves the spooled file to another output queue or to another - * position on the same output queue. - * - * @param targetSpooledFile The spooled file to move this - * spooled file after. The targetSpooledFile and this spooled file - * must reside on the same system. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system operating system is not at the correct level. - **/ - public void move(SpooledFile targetSpooledFile) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - if (impl_ == null) - chooseImpl(); - if (targetSpooledFile.getImpl() == null) { - targetSpooledFile.chooseImpl(); - } - ((SpooledFileImpl) impl_).move((SpooledFileImpl)targetSpooledFile.getImpl()); - //update the spooled file attributes - attrs = impl_.getAttrValue(); - } - - - - /** - * Moves the spooled file to another output queue. - * - * @param targetOutputQueue The output queue to move the - * spooled file to. The spooled file will be moved to the first - * position on this output queue. The output queue and this spooled - * file must reside on the same system. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system operating system is not at the correct level. - **/ - public void move(OutputQueue targetOutputQueue) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - if (impl_ == null) - chooseImpl(); - if (targetOutputQueue.getImpl() == null) { - targetOutputQueue.chooseImpl(); - } - ((SpooledFileImpl) impl_).move((OutputQueueImpl)targetOutputQueue.getImpl()); - // update the spooled file attributes - attrs = impl_.getAttrValue(); - } - - - - /** - * Moves the spooled file to the first position on the output queue. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system operating system is not at the correct level. - **/ - public void moveToTop() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - if (impl_ == null) - chooseImpl(); - ((SpooledFileImpl) impl_).moveToTop(); - // update the spooled file attributes - attrs = impl_.getAttrValue(); - } - - - - /** - Restores the state of the object from an input stream. - This is used when deserializing an object. - - @param in The input stream. - - @exception IOException Thrown if an IO error occurs. - @exception ClassNotFoundException Thrown if class is not found. - **/ - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - fMsgRetrieved_ = false; - } - - - - /** - * Releases a held spooled file on the system. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system operating system is not at the correct level. - **/ - public void release() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - if (impl_ == null) - chooseImpl(); - ((SpooledFileImpl) impl_).release(); - // update the spooled file attributes - attrs = impl_.getAttrValue(); - } - - - - /** - * Sends the spooled file to another user on the same system or to - * a remote system on the network. The equivalent of the system - * Send Network Spooled File - * (SNDNETSPLF) command will be issued against the spooled file. - * - * @param sendOptions A print parameter list that contains the - * parameters for the send. The following attributes MUST be set: - *
      - *
    • ATTR_TOUSERID - Specifies the user ID to send the spooled file to. - *
    • ATTR_TOADDRESS - Specifies the remote system to send the spooled file to. - *
    - * The following attributes are optional: - *
      - *
    • ATTR_DATAFORMAT - Specifies the data format in which to transmit the - * spooled file. May be either of *RCDDATA or - * *ALLDATA. *RCDDATA is the default. - *
    • ATTR_VMMVSCLASS - Specifies the VM/MVS SYSOUT class for distributions - * sent to a VM host system or to an MVS host system. - * May be A to Z or 0 to 9. A is the default. - *
    • ATTR_SENDPTY - Specifies the queueing priority used for this spooled file - * when it is being routed through a SNADS network. May be - * *NORMAL or *HIGH. *NORMAL is the default. - *
    - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - **/ - public void sendNet(PrintParameterList sendOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - if (impl_ == null) - chooseImpl(); - ((SpooledFileImpl) impl_).sendNet(sendOptions); - } - - - - /** - * Sends a spooled file to be printed on a remote system. - * The equivalent of the Send TCP/IP Spooled File - * (SNDTCPSPLF) command will be issued against the spooled file. - * This is the system's version of the TCP/IP LPR command. - * - * @param sendOptions A print parameter list that contains the - * parameters for the send. The following attributes MUST be set: - *
      - *
    • ATTR_RMTSYSTEM - Specifies the remote system to which the print - * request will be sent. May be a remote system - * name or the special value *INTNETADR. - *
    • ATTR_RMTPRTQ - Specifies the name of the destination print queue. - *
    - * The following attributes are optional: - *
      - *
    • ATTR_DELETESPLF - Specifies whether or not to delete the spooled file - * after it has been successfully sent. May be *NO - * or *YES. *NO is the default. - *
    • ATTR_DESTOPTION - Specifies a destination-dependant option. These options will - * be sent to the remote system with the spooled file. - *
    • ATTR_DESTINATION - Specifies the type of system to which the spooled file is - * being sent. When sending to other IBM i systems, this value - * should be *AS/400. May also be *OTHER or *PSF/2. - * *OTHER is the default. - *
    • ATTR_INTERNETADDR - Specifies the Internet address of the receiving system. - *
    • ATTR_MFGTYPE - Specifies the manufacturer, type, and model when transforming print - * data from SCS or AFP to ASCII. - *
    • ATTR_SCS2ASCII - Specifies whether the print data is to be transformed to - * ASCII. May be *NO or *YES. *NO is the default. - *
    • ATTR_SEPPAGE - Specifies whether to print the separator page. May be - * *NO or *YES. *YES is the default. - *
    - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - **/ - public void sendTCP(PrintParameterList sendOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - if (impl_ == null) - chooseImpl(); - ((SpooledFileImpl) impl_).sendTCP(sendOptions); - } - - - - /** - * Sets one or more attributes of the object. See - * Spooled File Attributes for - * a list of valid attributes that can be changed. - * - * @param attributes A print parameter list that contains the - * attributes to be changed. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system operating system is not at the correct level. - **/ - public void setAttributes(PrintParameterList attributes) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - if (attributes == null) - { - Trace.log(Trace.ERROR, "Parameter 'attributes' is null."); - throw new NullPointerException("attributes"); - } - - if (impl_ == null) - chooseImpl(); - ((SpooledFileImpl) impl_).setAttributes(attributes); - - // we changed the spooled file attributes on the system, - // merge those changed attributes into our current attributes - // here. - if (attrs == null) - { - attrs = new NPCPAttribute(); - } - // update the spooled file attributes - attrs = impl_.getAttrValue(); - } - -} // SpooledFile class - - diff --git a/cvsroot/src/com/ibm/as400/access/SpooledFileImpl.java b/cvsroot/src/com/ibm/as400/access/SpooledFileImpl.java deleted file mode 100644 index 001cdd29d..000000000 --- a/cvsroot/src/com/ibm/as400/access/SpooledFileImpl.java +++ /dev/null @@ -1,142 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SpooledFileImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - * The SpooledFileImpl interface defines a set of methods - * needed for a full implementation of the SpooledFile class. - **/ - -interface SpooledFileImpl extends PrintObjectImpl -{ - - public abstract void answerMessage(String reply) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - - // method for synchronization with base class. - public boolean getFMsgRetrieved(); - - - - public abstract void delete() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException; - - - - public abstract AS400Message getMessage() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException; - - - - public abstract void hold(String holdType) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - - public abstract void move(SpooledFileImpl targetSpooledFile) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - - public abstract void move(OutputQueueImpl targetOutputQueue) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - - public abstract void moveToTop() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - - public abstract void release() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - - public abstract void sendNet(PrintParameterList sendOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException; - - - - public abstract void sendTCP(PrintParameterList sendOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException; - - - public abstract void setAttributes(PrintParameterList attributes) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - public abstract NPCPIDSplF copy(OutputQueueImpl outputQueue) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - -} diff --git a/cvsroot/src/com/ibm/as400/access/SpooledFileImplProxy.java b/cvsroot/src/com/ibm/as400/access/SpooledFileImplProxy.java deleted file mode 100644 index 63871921a..000000000 --- a/cvsroot/src/com/ibm/as400/access/SpooledFileImplProxy.java +++ /dev/null @@ -1,279 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SpooledFileImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - -/** - * The SpooledFileImplProxy class implements proxy versions of - * the public methods defined in the SpooledFileImpl class. - * Unless commented otherwise, the implementations of the methods below - * are merely proxy calls to the corresponding method in the remote - * implementation class (SpooledFileImplRemote). - **/ - -class SpooledFileImplProxy extends PrintObjectImplProxy -implements SpooledFileImpl, ProxyImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - SpooledFileImplProxy() - { - super("SpooledFile"); - } - - public void answerMessage(String reply) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "answerMessage", - new Class[] { String.class }, - new Object[] { reply }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public void delete() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - try { - connection_.callMethod(pxId_, "delete"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow4(e); - } - } - - - - - // Added method for synchronization with base class. - public boolean getFMsgRetrieved() - { - try { - return connection_.callMethod(pxId_, "getFMsgRetrieved").getReturnValueBoolean(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow(e); - } - } - - - - public AS400Message getMessage() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - try { - return (AS400Message) connection_.callMethod(pxId_, "getMessage").getReturnValue(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow4(e); - } - } - - - - public void hold(String holdType) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "hold", - new Class[] { String.class }, - new Object[] { holdType }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public void move(SpooledFileImpl targetSpooledFile) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "move", - new Class[] { SpooledFileImpl.class }, - new Object[] { targetSpooledFile }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public void move(OutputQueueImpl targetOutputQueue) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "move", - new Class[] { OutputQueueImpl.class }, - new Object[] { targetOutputQueue }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public void moveToTop() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "moveToTop"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public void release() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "release"); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public void sendNet(PrintParameterList sendOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - try { - connection_.callMethod(pxId_, "sendNet", - new Class[] { PrintParameterList.class }, - new Object[] { sendOptions }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow4(e); - } - } - - - - public void sendTCP(PrintParameterList sendOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - try { - connection_.callMethod(pxId_, "sendTCP", - new Class[] { PrintParameterList.class }, - new Object[] { sendOptions }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow4(e); - } - } - - - - public void setAttributes(PrintParameterList attributes) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "setAttributes", - new Class[] { PrintParameterList.class }, - new Object[] { attributes }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public NPCPIDSplF copy(OutputQueueImpl outputQueue) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - NPCPIDSplF cpID = (NPCPIDSplF) connection_.callMethod(pxId_, "copy", - new Class[] { OutputQueueImpl.class }, - new Object[] { outputQueue }).getReturnValue(); - return cpID; - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/SpooledFileImplRemote.java b/cvsroot/src/com/ibm/as400/access/SpooledFileImplRemote.java deleted file mode 100644 index ec57e7516..000000000 --- a/cvsroot/src/com/ibm/as400/access/SpooledFileImplRemote.java +++ /dev/null @@ -1,1050 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SpooledFileImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - * The SpooledFile class represents a server spooled file. - * You can use an instance of this class to manipulate an individual - * server spooled file (hold, release, delete, send, read, and so on). - * To create new spooled files on the server, use the - * SpooledFileOutputStream class. - * - * See Spooled File Attributes for - * valid attributes. - * - * @see PrintObjectInputStream - * @see PrintObjectPageInputStream - * @see PrintObjectTransformedInputStream - **/ - -class SpooledFileImplRemote extends PrintObjectImplRemote -implements SpooledFileImpl -{ - private static final NPCPAttributeIDList attrsToRetrieve_ = new NPCPAttributeIDList(); - private static boolean fAttrIDsToRtvBuilt_ = false; - private static final int CMD_SEND_NET = 1; - private static final int CMD_SEND_TCP = 2; - - transient NPCPMsgHandle cpMsgHandle_ = null; - transient boolean fMsgRetrieved_ = false; - - // We have decide that spooled files are too transient to - // be JavaBeans - - /** Replies to the message that caused the spooled file to wait. - * - * @param reply The string that contains the reply for the message. - * The default reply can be obtained by calling - * the getMessage() method, and then calling the - * getDefaultReply() method on the message object that is returned. - * Other possible replies are given in the message help, - * which can also be retrieved from the message object returned - * on the getMessage() method. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is - * completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system is not at the correct level. - **/ - public void answerMessage(String reply) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - synchronized( this ) - { - if (reply == null) - { - Trace.log(Trace.ERROR, "Parameter 'reply' is null."); - throw new NullPointerException("reply"); - } - - if (!fMsgRetrieved_) - { - // retrieve just the message handle - retrieveMessage(null, null); - } - - NPDataStream sendDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPDataStream returnDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - NPCPAttribute cpCPFMessage = new NPCPAttribute(); - NPCPAttribute cpMsgReply = new NPCPAttribute(); - - // set up the send data stream - we set the action to - // retrieve message and we set the code points of - // the message handle along with what attribute code point for - // the answer - - sendDS.setAction(NPDataStream.ANSWER_MESSAGE); - sendDS.addCodePoint(cpMsgHandle_); - - cpMsgReply.setAttrValue(PrintObject.ATTR_MSGREPLY, reply); - sendDS.addCodePoint(cpMsgReply); - - // setup the return datastream - we get back a cpf message maybe - returnDS.addCodePoint(cpCPFMessage); - - int rc = npSystem.makeRequest(sendDS, returnDS); - switch(rc) - { - case 0: - fMsgRetrieved_ = false; // we just answered the message - // update the spooled file attributes - updateAttrs(getAttrIDsToRetrieve()); - break; - - case NPDataStream.RET_SPLF_NO_MESSAGE: - // this should not be a runtime exception - Trace.log(Trace.ERROR, "No spooled file message waiting."); - throw new ErrorCompletingRequestException( - ErrorCompletingRequestException.SPOOLED_FILE_NO_MESSAGE_WAITING); - - default: - // Throw some other internal/unexpected error or something here - // create new RC for this - //throw new InternalErrorException(InternalErrorException.UNKNOWN, - // "NPServer Error RC = " + rc); - Trace.log(Trace.ERROR, "Unexpected Error."); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - - } // answerMessage() - - - - private synchronized void buildAttrIDsToRtv() - { - if (!fAttrIDsToRtvBuilt_) - { - fAttrIDsToRtvBuilt_ = true; - attrsToRetrieve_.addAttrID(PrintObject.ATTR_3812SCS); // 3812 SCS (fonts) - attrsToRetrieve_.addAttrID(PrintObject.ATTR_ACCOUNT_CODE); // Accounting code - attrsToRetrieve_.addAttrID(PrintObject.ATTR_AFP); // AFP resources used - attrsToRetrieve_.addAttrID(PrintObject.ATTR_AFPRESOURCE); // AFP Resource - attrsToRetrieve_.addAttrID(PrintObject.ATTR_ALIGN); // Align page - attrsToRetrieve_.addAttrID(PrintObject.ATTR_ASCIITRANS); // ASCII transparency - attrsToRetrieve_.addAttrID(PrintObject.ATTR_ASPDEVICE); // Auxiliary storage pool device name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_AUX_POOL); // Auxiliary storage pool - attrsToRetrieve_.addAttrID(PrintObject.ATTR_BARCODE); // Barcode - attrsToRetrieve_.addAttrID(PrintObject.ATTR_BKMGN_ACR); // Back margin across - attrsToRetrieve_.addAttrID(PrintObject.ATTR_BKMGN_DWN); // Back margin down - attrsToRetrieve_.addAttrID(PrintObject.ATTR_BKOVL_ACR); // Back overlay offset across - attrsToRetrieve_.addAttrID(PrintObject.ATTR_BKOVL_DWN); // Back overlay offset down - attrsToRetrieve_.addAttrID(PrintObject.ATTR_BKOVRLAY); // Back side overlay name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_BKOVRLLIB); // Back side overlay library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CHAR_ID); // Graphic character set - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CHARID); // Character ID - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CHR_RTT_CMDS); // DBCS character rotation commands - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CHRSET); // Character set name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CHRSET_LIB); // Character set library name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CHRSET_SIZE); // Character set point size - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CODEDFNT); // *Coded font name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CODEDFNTLIB); // *Coded font library name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CODEDFONT_SIZE); // Coded font point size - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CODEPAGE); // Code page - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CODEPAGE_NAME); // Code page name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CODEPAGE_NAME_LIB); // Code page library name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CODFNT_ARRAY); // Coded font array - attrsToRetrieve_.addAttrID(PrintObject.ATTR_COLOR); // Color - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CONSTBCK_OVL); // Constant back overlay - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CONTROLCHAR); // Control character - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CONVERT_LINEDATA); // Convert line data - attrsToRetrieve_.addAttrID(PrintObject.ATTR_COPIES); // Copies (total) - attrsToRetrieve_.addAttrID(PrintObject.ATTR_COPIESLEFT); // Copies left to produce - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CORNER_STAPLE); // Corner staple - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CPI); // Characters per inch - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CPI_CHANGES); // Characters per inch changes - attrsToRetrieve_.addAttrID(PrintObject.ATTR_CURPAGE); // Current page - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DATE); // Date file opened (created) - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DATE_USED); // Date file last used - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DATE_WTR_BEGAN_FILE); // Date writer began processing file - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DATE_WTR_CMPL_FILE); // Date writer finished processing file - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DBCS_FNT); // DBCS coded font name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DBCS_FNT_LIB); // DBCS coded font library name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DBCS_FNT_SIZE); // DBCS coded font point size - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DBCSCPI); // DBCS characters per inch - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DBCSDATA); // Contains DBCS character set data - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DBCSEXTENSN); // Process DBCS extension characters - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DBCSROTATE); // Rotate DBCS characters before printing - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DBCSSISO); // DBCS SI/SO space requirements - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DDS); // DDS - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DECIMAL_FMT); // Decimal format used - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DOUBLEWIDE); // Double wide characters - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DRAWERCHANGE); // Drawer change - attrsToRetrieve_.addAttrID(PrintObject.ATTR_DUPLEX); // Print on both sides (duplex) - attrsToRetrieve_.addAttrID(PrintObject.ATTR_EDGESTITCH_NUMSTAPLES); // Edge stitch number of staples - attrsToRetrieve_.addAttrID(PrintObject.ATTR_EDGESTITCH_REF); // Edge stitch reference edge - attrsToRetrieve_.addAttrID(PrintObject.ATTR_EDGESTITCH_REFOFF); // Offset from edge stitch reference edge - attrsToRetrieve_.addAttrID(PrintObject.ATTR_ENDPAGE); // Ending page - attrsToRetrieve_.addAttrID(PrintObject.ATTR_EXPIRATION_DATE); // Spool file expiration date - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FIDELITY); // Print fidelity - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FIELD_OUTLIN); // Field outlining - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FILESEP); // Number of file separators - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FOLDREC); // Fold records - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FONT_CHANGES); // Font changes - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FONTID); // Font identifier - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FONTRESFMT); // Font resolution for formatting - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FORMDEF); // Form definition name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FORMDEFLIB); // Form definition library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FORMFEED); // Form feed - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FORMTYPE); // Form type - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FTMGN_ACR); // Front margin across - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FTMGN_DWN); // Front margin down - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FTOVL_ACR); // Front overlay offset across - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FTOVL_DWN); // Front overlay offset down - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FTOVRLAY); // Front overlay name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_FTOVRLLIB); // Front overlay library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_GRAPHICS); // Graphics in spooled file - attrsToRetrieve_.addAttrID(PrintObject.ATTR_GRAPHICS_TOK); // Graphics token - attrsToRetrieve_.addAttrID(PrintObject.ATTR_GRPLVL_IDXTAG); // Group level index tags - attrsToRetrieve_.addAttrID(PrintObject.ATTR_HIGHLIGHT); // Highlight - attrsToRetrieve_.addAttrID(PrintObject.ATTR_HOLD); // Hold the spool file before written - attrsToRetrieve_.addAttrID(PrintObject.ATTR_IPDSPASSTHRU); // IPDS pass-through - attrsToRetrieve_.addAttrID(PrintObject.ATTR_IPP_ATTR_CCSID); // IPP attributes-charset - attrsToRetrieve_.addAttrID(PrintObject.ATTR_IPP_ATTR_NL); // IPP natural language - attrsToRetrieve_.addAttrID(PrintObject.ATTR_IPP_JOB_ID); // IPP job ID - attrsToRetrieve_.addAttrID(PrintObject.ATTR_IPP_JOB_NAME); // IPP job name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_IPP_JOB_NAME_NL); // IPP job name NL - attrsToRetrieve_.addAttrID(PrintObject.ATTR_IPP_JOB_ORIGUSER); // IPP job original user - attrsToRetrieve_.addAttrID(PrintObject.ATTR_IPP_JOB_ORIGUSER_NL); // IPP job original user NL - attrsToRetrieve_.addAttrID(PrintObject.ATTR_IPP_PRINTER_NAME); // IPP printer name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_JOBCCSID); // ccsid of the job that created file - attrsToRetrieve_.addAttrID(PrintObject.ATTR_JOBNAME); // name of the job that created file - attrsToRetrieve_.addAttrID(PrintObject.ATTR_JOBNUMBER); // number of the job that created file - attrsToRetrieve_.addAttrID(PrintObject.ATTR_JOBSYSTEM); // System which job that created splf ran - attrsToRetrieve_.addAttrID(PrintObject.ATTR_JOBUSER); // name of the user that created file - attrsToRetrieve_.addAttrID(PrintObject.ATTR_JUSTIFY); // Justification - attrsToRetrieve_.addAttrID(PrintObject.ATTR_LASTPAGE); // Last page that printed - attrsToRetrieve_.addAttrID(PrintObject.ATTR_LINESPACING); // Line spacing - attrsToRetrieve_.addAttrID(PrintObject.ATTR_LPI); // Lines per inch - attrsToRetrieve_.addAttrID(PrintObject.ATTR_LPI_CHANGES); // Lines per inch changes - attrsToRetrieve_.addAttrID(PrintObject.ATTR_MAXRCDS); // Maximum records - attrsToRetrieve_.addAttrID(PrintObject.ATTR_MEASMETHOD); // Measurement method (*ROWCOL or *UOM) - attrsToRetrieve_.addAttrID(PrintObject.ATTR_MULTIUP); // logical pages per physical side - attrsToRetrieve_.addAttrID(PrintObject.ATTR_NETWORK); // network were output was created - attrsToRetrieve_.addAttrID(PrintObject.ATTR_NUMBYTES_SPLF); // number of bytes contained w/in splf - attrsToRetrieve_.addAttrID(PrintObject.ATTR_NUMRSC_LIB_ENT);// Number of user resource library list entries - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OFFICEVISION); // OfficeVision - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OS4_CRT_AFP); // IBM i created AFPDS - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OUTPTY); // Output priority - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OUTPUTBIN); // Output bin - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OUTQUE); // Output queue - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OUTQUELIB); // Output queue library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_OVERFLOW); // Overflow line number - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PAGDFN); // Page definition library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PAGDFNLIB); // Page definition library name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PAGE_GROUPS); // Spooled File contains Page groups - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PAGE_ROTATE); // Page rotation used - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PAGELEN); // page length in measurement method - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PAGELVLIDXTAG); // Page level index tags - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PAGES); // Number of pages in spool file - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PAGES_EST); // Number of pages is estimated - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PAGEWIDTH); // Page width in measurement method - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PAGRTT); // Degree of page rotation - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PGM_OPN_FILE); // Program that opened file name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PGM_OPN_LIB); // Program that opened the file library name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_POINTSIZE); // the default font's point size - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PRINTER); // Printer (device name) - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PRTASSIGNED); // Printer assigned - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PRTDEVTYPE); // Printer dev type (data stream type (*SCS, *AFPDS, etc)) - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PRTFILE); // Printer file - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PRTFLIB); // Printer file library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PRTQUALITY); // Print quality - attrsToRetrieve_.addAttrID(PrintObject.ATTR_PRTTEXT); // Text printed at bottom of each page - attrsToRetrieve_.addAttrID(PrintObject.ATTR_RCDFMT_DATA); // Record format name present in data stream - attrsToRetrieve_.addAttrID(PrintObject.ATTR_RECLENGTH); // Record length - attrsToRetrieve_.addAttrID(PrintObject.ATTR_REDUCE); // Reduce output - attrsToRetrieve_.addAttrID(PrintObject.ATTR_RESTART); // where to restart printing at - attrsToRetrieve_.addAttrID(PrintObject.ATTR_RPLCHAR); // character to replace unprintables with - attrsToRetrieve_.addAttrID(PrintObject.ATTR_RPLUNPRT); // replace unprintable characters - attrsToRetrieve_.addAttrID(PrintObject.ATTR_RSC_LIB_LIST); // User resource library list - attrsToRetrieve_.addAttrID(PrintObject.ATTR_RSCLIB); // Resource library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_RSCNAME); // Resource name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_RSCTYPE); // Resource object type - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SADDLESTITCH_NUMSTAPLES); // Saddle stitch number of staples - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SADDLESTITCH_REF); // Saddle stitch reference edge - //attrsToRetrieve_.addAttrID(PrintObject.ATTR_SADDLESTITCH_STPL_OFFSEINFO); // saddle stitch offset distance - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SAVE); // whether to save after printing or not - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SAVE_COMMAND); // Save command - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SAVE_DEVICE); // Save device - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SAVEFILE); // Save file name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SAVEFILELIB); // Save file library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SAVE_LABEL); // Save label - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SAVE_SEQUENCE_NUMBER); // Save sequence number - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SAVE_VOLUME_FORMAT); // Save volume format - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SAVE_VOLUME_ID);// Save volume ID - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SCHEDULE); // File available (schedule) - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SPLF_AUTH_METHOD); // Spooled file authentication method - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SPLF_CREATOR); // Spooled file creator - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SPLF_RESTORED_DATE); // Spooled file restored date - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SPLF_RESTORED_TIME); // Spooled file restored time - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SPLF_SAVED_DATE); // Spooled file saved date - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SPLF_SAVED_TIME); // Spooled file saved time - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SPLF_SECURITY_METHOD); // Spooled file security method - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SPLF_SIZE); // Spooled file size - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SPLF_SIZE_MULT);// Spooled file size multiplier - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SPLFNUM); // Spooled file number - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SPLFSTATUS); // Spooled file status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SPOOLFILE); // Spooled file name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SRCDRWR); // Source drawer - attrsToRetrieve_.addAttrID(PrintObject.ATTR_STARTPAGE); // Starting page - attrsToRetrieve_.addAttrID(PrintObject.ATTR_SYSTEM); // System where output was created - attrsToRetrieve_.addAttrID(PrintObject.ATTR_TIME); // Time spooled file was opened at - attrsToRetrieve_.addAttrID(PrintObject.ATTR_TIME_WTR_BEGAN_FILE); // Time writer began processing file - attrsToRetrieve_.addAttrID(PrintObject.ATTR_TIME_WTR_CMPL_FILE); // Time writer finished processing file - attrsToRetrieve_.addAttrID(PrintObject.ATTR_TRC1403); // Trc for 1403 - attrsToRetrieve_.addAttrID(PrintObject.ATTR_UNITOFMEAS); // Unit of measure - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USER_DFN_TXT); // User defined text - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USERCMT); // User comment - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USERDATA); // User data - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USERGEN_DATA); // System Validated data stream - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFDATA); // User define data - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFFILE); // User define file - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFOBJ); // *User defined object - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFOBJLIB); // *User defined object library - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFOBJTYP); // *User defined object type - attrsToRetrieve_.addAttrID(PrintObject.ATTR_USRDEFOPT); // User defined options - } - } - - - /** - * Creates a copy of the spooled file this object represents. The - * new spooled file is created on the specified output queue. - * A reference to the new spooled file is returned. - * - * @param outputQueue The output queue location to create the new version of the - * original spooled file. The spooled file will be created to the first - * position on this output queue. The output queue and this spooled - * file must reside on the same system. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system is not at the correct level. - **/ - public NPCPIDSplF copy(OutputQueueImpl outputQueue) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - - NPDataStream sendDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPDataStream returnDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - - NPCPAttribute cpCPFMessage = new NPCPAttribute(); - NPCPIDOutQ tgtOutQID = (NPCPIDOutQ)((OutputQueueImplRemote)outputQueue).getIDCodePoint(); - - sendDS.setAction(NPDataStream.COPY); - sendDS.addCodePoint(getIDCodePoint()); - sendDS.addCodePoint(tgtOutQID); - - NPCPIDSplF splfID = new NPCPIDSplF(); - returnDS.addCodePoint(splfID); - returnDS.addCodePoint(cpCPFMessage); - - int rc = npSystem.makeRequest(sendDS, returnDS); - if (rc == 0) { - return splfID; - } - else { - NPConversation conversation = npSystem.getConversation(); - String curLevel = conversation.getAttribute(PrintObject.ATTR_NPSLEVEL); - npSystem.returnConversation(conversation); - - switch(rc) { - // we get back RET_INV_REQ_ACT on pre-V5R3 systems if we try - // to copy a spooled file, so throw a requestNotSupportedException - // here. - case NPDataStream.RET_INV_REQ_ACT: - throw new RequestNotSupportedException(curLevel, - RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - - // any other error is either an unexpected error or an error - // completing request - default: - Trace.log(Trace.ERROR, "SpooledFileImplRemote::copy - An exception was thrown attempting to " + - "copy the spooled file. RC = " + rc); - - break; - } - return null; - } - } - - - - /** - * Deletes the spooled file on the server. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - **/ - public void delete() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - NPDataStream sendDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPDataStream returnDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - - NPCPAttribute cpCPFMessage = new NPCPAttribute(); - - sendDS.setAction(NPDataStream.DELETE); - sendDS.addCodePoint(getIDCodePoint()); - - returnDS.addCodePoint(cpCPFMessage); - - npSystem.makeRequest(sendDS, returnDS); - } - - - - /** - * Creates the message handle codepoint. It is - * a synchonized method so that we don't get 2 threads creating - * the code point at once. - **/ - synchronized void generateMsgHandle() - { - if (cpMsgHandle_ == null) - { - cpMsgHandle_ = new NPCPMsgHandle(); - } - } - - // retrieve only one attribute - NPCPAttributeIDList getAttrIDsToRetrieve(int attrToRtv) - { - if (!fAttrIDsToRtvBuilt_) { - attrsToRetrieve_.addAttrID(attrToRtv); - } - return attrsToRetrieve_; - } - - - NPCPAttributeIDList getAttrIDsToRetrieve() - { - if (!fAttrIDsToRtvBuilt_) { - buildAttrIDsToRtv(); - } - return attrsToRetrieve_; - } - - - - // method for synchronization with base class. - public boolean getFMsgRetrieved() - { - return fMsgRetrieved_; - } - - - - /** - * Returns the message that is associated with this spooled file. - * A spooled file has a message associated with it if its - * ATTR_SPLFSTATUS attribute returns *MESSAGE. - * - * @return The AS400Message object that contains the message text, - * type, severity, id, date, time, and default reply. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - **/ - public AS400Message getMessage() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - AS400Message msg = null; - - NPCPAttributeIDList cpAttrsToRetrieve = new NPCPAttributeIDList(); - NPCPAttribute cpMessage = new NPCPAttribute(); - - // set which attributes we want to retrieve - cpAttrsToRetrieve.addAttrID(PrintObject.ATTR_MSGTEXT); - cpAttrsToRetrieve.addAttrID(PrintObject.ATTR_MSGTYPE); - cpAttrsToRetrieve.addAttrID(PrintObject.ATTR_MSGHELP); - cpAttrsToRetrieve.addAttrID(PrintObject.ATTR_MSGREPLY); - cpAttrsToRetrieve.addAttrID(PrintObject.ATTR_MSGID); - cpAttrsToRetrieve.addAttrID(PrintObject.ATTR_MSGSEV); - cpAttrsToRetrieve.addAttrID(PrintObject.ATTR_DATE); - cpAttrsToRetrieve.addAttrID(PrintObject.ATTR_TIME); - - // call to synchoronized method to make the request. This - // serves 2 purposes: - // 1) synchonizes access to instance variable cpMsgHandle - // 2) synchronizes accsss to instance variable fMsgRetrieved - retrieveMessage(cpAttrsToRetrieve, cpMessage); - - // create an AS400Message and set appropriate values - msg = new AS400Message(cpMessage.getStringValue(PrintObject.ATTR_MSGID), - cpMessage.getStringValue(PrintObject.ATTR_MSGTEXT)); - msg.setDate(cpMessage.getStringValue(PrintObject.ATTR_DATE),cpMessage.getStringValue(PrintObject.ATTR_TIME)); - msg.setDefaultReply(cpMessage.getStringValue(PrintObject.ATTR_MSGREPLY)); - msg.setHelp(cpMessage.getStringValue(PrintObject.ATTR_MSGHELP)); - msg.setSeverity((cpMessage.getIntValue(PrintObject.ATTR_MSGSEV)).intValue()); - msg.setType(Integer.parseInt(cpMessage.getStringValue(PrintObject.ATTR_MSGTYPE))); - - return msg; - } // getMessage - - - - /** - * Holds the spooled file. - * @param holdType When to hold the spooled file. - * May be any of the following values: - *
      - *
    • *IMMED - The spooled file is held immediately. - *
    • *PAGEEND - The spooled file is held at the end of the current page. - *
    - * holdType may be null. If holdType is not specified, the default is - * *IMMED. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system is not at the correct level. - **/ - public void hold(String holdType) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - NPDataStream sendDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPDataStream returnDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - - NPCPAttribute cpCPFMessage = new NPCPAttribute(); - - sendDS.setAction(NPDataStream.HOLD); - sendDS.addCodePoint(getIDCodePoint()); - - if (holdType != null) - { - NPCPAttribute cpAttr = new NPCPAttribute(); - cpAttr.setAttrValue(PrintObject.ATTR_HOLDTYPE, holdType); - sendDS.addCodePoint(cpAttr); - } - - returnDS.addCodePoint(cpCPFMessage); - - npSystem.makeRequest(sendDS, returnDS); - - // update the spooled file attributes - updateAttrs(getAttrIDsToRetrieve()); - } - - - - /** - * Moves the spooled file to another output queue or to another - * position on the same output queue. - * - * @param targetSpooledFile The spooled file to move this - * spooled file after. The targetSpooledFile and this spooled file - * must reside on the same system. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system is not at the correct level. - **/ - public void move(SpooledFileImpl targetSpooledFile) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - NPDataStream sendDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPDataStream returnDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - - NPCPAttribute cpCPFMessage = new NPCPAttribute(); - // make a copy of the target spooled file ID codepoint so we can - // change its ID - NPCPIDSplF tgtSplfID = new NPCPIDSplF((NPCPIDSplF)((SpooledFileImplRemote)targetSpooledFile).getIDCodePoint()); - - // must change the ID of the target splf ID from a SPOOLED_FILE_ID codepoint - // to a TARGET_SPOOLED_FILE_ID codpoint - tgtSplfID.setID(NPCodePoint.TARGET_SPOOLED_FILE_ID); - sendDS.setAction(NPDataStream.MOVE); - sendDS.addCodePoint(getIDCodePoint()); - sendDS.addCodePoint(tgtSplfID); - - returnDS.addCodePoint(cpCPFMessage); - - npSystem.makeRequest(sendDS, returnDS); - - // update the spooled file attributes - updateAttrs(getAttrIDsToRetrieve()); - } - - - - /** - * Moves the spooled file to another output queue. - * - * @param targetOutputQueue The output queue to move the - * spooled file to. The spooled file will be moved to the first - * position on this output queue. The output queue and this spooled - * file must reside on the same system. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system is not at the correct level. - **/ - public void move(OutputQueueImpl targetOutputQueue) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - NPDataStream sendDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPDataStream returnDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - - NPCPAttribute cpCPFMessage = new NPCPAttribute(); - NPCPIDOutQ tgtOutQID = (NPCPIDOutQ)((OutputQueueImplRemote)targetOutputQueue).getIDCodePoint(); - - sendDS.setAction(NPDataStream.MOVE); - sendDS.addCodePoint(getIDCodePoint()); - sendDS.addCodePoint(tgtOutQID); - - returnDS.addCodePoint(cpCPFMessage); - - npSystem.makeRequest(sendDS, returnDS); - - // update the spooled file attributes - updateAttrs(getAttrIDsToRetrieve()); - } - - - - /** - * Moves the spooled file to the first position on the output queue. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system is not at the correct level. - **/ - public void moveToTop() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - NPDataStream sendDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPDataStream returnDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - - NPCPAttribute cpCPFMessage = new NPCPAttribute(); - - sendDS.setAction(NPDataStream.MOVE); - sendDS.addCodePoint(getIDCodePoint()); - - returnDS.addCodePoint(cpCPFMessage); - - npSystem.makeRequest(sendDS, returnDS); - - // update the spooled file attributes - updateAttrs(getAttrIDsToRetrieve()); - } - - - - /** - * Releases a held spooled file on the server. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system is not at the correct level. - **/ - public void release() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - NPDataStream sendDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPDataStream returnDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - - NPCPAttribute cpCPFMessage = new NPCPAttribute(); - - sendDS.setAction(NPDataStream.RELEASE); - sendDS.addCodePoint(getIDCodePoint()); - - returnDS.addCodePoint(cpCPFMessage); - - npSystem.makeRequest(sendDS, returnDS); - - // update the spooled file attributes - updateAttrs(getAttrIDsToRetrieve()); - } - - - - // synchronized method to retrieve the message for this spooled file - - // we'll keep the message handle for answering it later - synchronized void retrieveMessage(NPCPAttributeIDList cpAttrsToRetrieve, - NPCPAttribute cpMessage) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - NPDataStream sendDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPDataStream returnDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - - if (cpMessage == null) - { - cpMessage = new NPCPAttribute(); - } - - generateMsgHandle(); // create message handle code point if - // not already created - - // set up the send data stream - we set the action to - // retrieve message and we set the code points of - // this spooled files ID along with what attributes we want for - // the message - sendDS.setAction(NPDataStream.RETRIEVE_MESSAGE); - sendDS.addCodePoint(getIDCodePoint()); - - // if we did not get some attributes then - // generate them. - if (cpAttrsToRetrieve == null) - { - NPCPAttributeIDList cpGenAttrsToRetrieve = new NPCPAttributeIDList(); - - // set which attributes we want to retrieve - cpGenAttrsToRetrieve.addAttrID(PrintObject.ATTR_MSGTEXT); - cpGenAttrsToRetrieve.addAttrID(PrintObject.ATTR_MSGTYPE); - cpGenAttrsToRetrieve.addAttrID(PrintObject.ATTR_MSGHELP); - cpGenAttrsToRetrieve.addAttrID(PrintObject.ATTR_MSGREPLY); - cpGenAttrsToRetrieve.addAttrID(PrintObject.ATTR_MSGID); - cpGenAttrsToRetrieve.addAttrID(PrintObject.ATTR_MSGSEV); - cpGenAttrsToRetrieve.addAttrID(PrintObject.ATTR_DATE); - cpGenAttrsToRetrieve.addAttrID(PrintObject.ATTR_TIME); - sendDS.addCodePoint(cpGenAttrsToRetrieve); - } - else - sendDS.addCodePoint(cpAttrsToRetrieve); - - - // setup the return datastream - we get back a message handle - // code point and an attribues/attributes value code point. - // We will get back either a CPF message or the spooled file message - // in the cpMessage code point - returnDS.addCodePoint(cpMessage); - returnDS.addCodePoint(cpMsgHandle_); - - int rc = npSystem.makeRequest(sendDS, returnDS); - switch(rc) - { - case 0: - fMsgRetrieved_ = true; - break; - case NPDataStream.RET_SPLF_NO_MESSAGE: - // This should throw a non-runtime exception so the caller may - // catch it. - Trace.log(Trace.ERROR, "No spooled file message waiting."); - throw new ErrorCompletingRequestException( - ErrorCompletingRequestException.SPOOLED_FILE_NO_MESSAGE_WAITING); - default: - // Throw some other internal/unexpected error or something here - // create new RC for this - //throw new InternalErrorException(InternalErrorException.UNKNOWN, - // "NPServer Error RC = " + rc); - Trace.log(Trace.ERROR, "Unexpected Error."); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - - } // retrieveMessage() - - - - /** - * Sends the spooled file to another user on the same system or to - * a remote system on the network. The equivalent of the server - * Send Network Spooled File - * (SNDNETSPLF) command will be issued against the spooled file. - * - * @param sendOptions A print parameter list that contains the - * parameters for the send. The following attributes MUST be set: - *
      - *
    • ATTR_TOUSERID - Specifies the user ID to send the spooled file to. - *
    • ATTR_TOADDRESS - Specifies the remote system to send the spooled file to. - *
    - * The following attributes are optional: - *
      - *
    • ATTR_DATAFORMAT - Specifies the data format in which to transmit the - * spooled file. May be either of *RCDDATA or - * *ALLDATA. *RCDDATA is the default. - *
    • ATTR_VMMVSCLASS - Specifies the VM/MVS SYSOUT class for distributions - * sent to a VM host system or to an MVS host system. - * May be A to Z or 0 to 9. A is the default. - *
    • ATTR_SENDPTY - Specifies the queueing priority used for this spooled file - * when it is being routed through a SNADS network. May be - * *NORMAL or *HIGH. *NORMAL is the default. - *
    - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - **/ - public void sendNet(PrintParameterList sendOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - NPDataStream sendDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPDataStream returnDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - - NPCPAttribute cpCPFMessage = new NPCPAttribute(); - NPCPAttribute cpSendOptions; - - // if the user has given us any options, - // send them - // else - // create our own attribute/value codepoint to put in the type of - // send to do. - // endif - if (sendOptions != null) - { - cpSendOptions = sendOptions.getAttrCodePoint(); - } else { - cpSendOptions = new NPCPAttribute(); - } - // set the type of send we want to do here (1=SNDNETSPLF) - cpSendOptions.setAttrValue(PrintObject.ATTR_SPLFSENDCMD, CMD_SEND_NET); - - sendDS.setAction(NPDataStream.SEND); - sendDS.addCodePoint(getIDCodePoint()); - sendDS.addCodePoint(cpSendOptions); - - returnDS.addCodePoint(cpCPFMessage); - - npSystem.makeRequest(sendDS, returnDS); - } - - - - /** - * Sends a spooled file to be printed on a remote system. - * The equivalent of the server Send TCP/IP Spooled File - * (SNDTCPSPLF) command will be issued against the spooled file. - * This is the server version of the TCP/IP LPR command. - * - * @param sendOptions A print parameter list that contains the - * parameters for the send. The following attributes MUST be set: - *
      - *
    • ATTR_RMTSYSTEM - Specifies the remote system to which the print - * request will be sent. May be a remote system - * name or the special value *INTNETADR. - *
    • ATTR_RMTPRTQ - Specifies the name of the destination print queue. - *
    - * The following attributes are optional: - *
      - *
    • ATTR_DELETESPLF - Specifies whether or not to delete the spooled file - * after it has been successfully sent. May be *NO - * or *YES. *NO is the default. - *
    • ATTR_DESTOPTION - Specifies a destination-dependant option. These options will - * be sent to the remote system with the spooled file. - *
    • ATTR_DESTINATION - Specifies the type of system to which the spooled file is - * being sent. When sending to other systems, this value - * should be *AS/400. May also be *OTHER or *PSF/2. - * *OTHER is the default. - *
    • ATTR_INTERNETADDR - Specifies the Internet address of the receiving system. - *
    • ATTR_MFGTYPE - Specifies the manufacturer, type, and model when transforming print - * data from SCS or AFP to ASCII. - *
    • ATTR_SCS2ASCII - Specifies whether the print data is to be transformed to - * ASCII. May be *NO or *YES. *NO is the default. - *
    • ATTR_WSCUSTMOBJ - Specifies the name of the workstation customization object. - *
    • ATTR_WSCUSTMOBJL - Specifies the name of the workstation customization object library. - *
    • ATTR_SEPPAGE - Specifies whether to print the separator page. May be - * *NO or *YES. *YES is the default. - *
    • ATTR_USRDTATFMLIB - Specifies the name of the user data transform library. - *
    • ATTR_USRDTATFM - Specifies the name of the user data transform. - *
    - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - **/ - public void sendTCP(PrintParameterList sendOptions) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - NPDataStream sendDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPDataStream returnDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - - NPCPAttribute cpCPFMessage = new NPCPAttribute(); - NPCPAttribute cpSendOptions; - - // if the user has given us any options, - // send them - // else - // create our own attribute/value codepoint to put in - // the type of send to do. - // endif - if (sendOptions != null) - { - cpSendOptions = sendOptions.getAttrCodePoint(); - } else { - cpSendOptions = new NPCPAttribute(); - } - // set the type of send we want to do here (2=SNDTCPSPLF) - cpSendOptions.setAttrValue(PrintObject.ATTR_SPLFSENDCMD, CMD_SEND_TCP); - - sendDS.setAction(NPDataStream.SEND); - sendDS.addCodePoint(getIDCodePoint()); - sendDS.addCodePoint(cpSendOptions); - - returnDS.addCodePoint(cpCPFMessage); - - npSystem.makeRequest(sendDS, returnDS); - } - - - - /** - * Sets one or more attributes of the object. See - * Spooled File Attributes for - * a list of valid attributes that can be changed. - * - * @param attributes A print parameter list that contains the - * attributes to be changed. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system is not at the correct level. - **/ - public void setAttributes(PrintParameterList attributes) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - if (attributes == null) - { - Trace.log(Trace.ERROR, "Parameter 'attributes' is null."); - throw new NullPointerException("attributes"); - } - - NPDataStream sendDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPDataStream returnDS = new NPDataStream(NPConstants.SPOOLED_FILE); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - - NPCPAttribute cpCPFMessage = new NPCPAttribute(); - NPCPAttribute cpNewAttrs = attributes.getAttrCodePoint(); - - sendDS.setAction(NPDataStream.CHANGE_ATTRIBUTES); - sendDS.addCodePoint(getIDCodePoint()); - sendDS.addCodePoint(cpNewAttrs); - - returnDS.addCodePoint(cpCPFMessage); - - npSystem.makeRequest(sendDS, returnDS); - - // we changed the spooled file attributes on the server, - // merge those changed attributes into our current attributes - // here. - if (attrs == null) - { - attrs = new NPCPAttribute(); - } - attrs.addUpdateAttributes(cpNewAttrs); - } - -} // SpooledFile class - - diff --git a/cvsroot/src/com/ibm/as400/access/SpooledFileList.java b/cvsroot/src/com/ibm/as400/access/SpooledFileList.java deleted file mode 100644 index be03dd224..000000000 --- a/cvsroot/src/com/ibm/as400/access/SpooledFileList.java +++ /dev/null @@ -1,707 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SpooledFileList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; - -/** - * Builds a list of objects of type SpooledFile. - * The list can be filtered by formtype, output queue, user, ending date, - * ending time, or user data. - * - *@see SpooledFile - **/ - - -public class SpooledFileList extends PrintObjectList -implements java.io.Serializable -{ - static final long serialVersionUID = 4L; - - private static final String FORM_TYPE_FILTER = "formTypeFilter"; - private static final String QUEUE_FILTER = "queueFilter"; - private static final String USER_FILTER = "userFilter"; - private static final String USER_DATA_FILTER = "userDataFilter"; - private static final String END_DATE_FILTER = "endDateFilter"; - private static final String END_TIME_FILTER = "endTimeFilter"; - private static final String START_DATE_FILTER = "startDateFilter"; - private static final String START_TIME_FILTER = "startTimeFilter"; - private static final String JOB_SYSTEM_FILTER = "jobSystemFilter"; - - /** - * Constructs a SpooledFileList object. The system - * must be set later. This constructor is provided for visual - * application builders that support JavaBeans. It is not - * intended for use by application programmers. - * - * @see PrintObjectList#setSystem - **/ - public SpooledFileList() - { - super(NPConstants.SPOOLED_FILE, new NPCPSelSplF()); - - // Because of this constructor we will need to check the - // system before trying to use it. - } - - - - /** - * Constructs a SpooledFileList object. It uses the system - * name specified. - * The default list filter will list all spooled files for the - * current user on the specified system. - * - * @param system The system on which the spooled files exist. - * - **/ - public SpooledFileList(AS400 system) - { - super(NPConstants.SPOOLED_FILE, new NPCPSelSplF(), system); - } - - - - /** - * Chooses the appropriate implementation. - **/ - void chooseImpl() - { - AS400 system = getSystem(); - if (system == null) { - Trace.log( Trace.ERROR, "Attempt to use SpooledFileList before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - impl_ = (PrintObjectListImpl) system.loadImpl2("com.ibm.as400.access.SpooledFileListImplRemote", - "com.ibm.as400.access.SpooledFileListImplProxy"); - super.setImpl(); - } - - - - /** - * Returns the formtype list filter. - * - **/ - public String getFormTypeFilter() - { - // The selection code point is always present, the formType Filter - // may not have been set. If empty, getFormType() will - // return an empty string. - - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - return( selectionCP.getFormType() ); - } - - - - /** - * Returns the output queue filter. - * - **/ - public String getQueueFilter() - { - // The selection code point is always present, the Queue Filter - // may not have been set. If empty, getQueue() will return - // an empty string. - - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - return( selectionCP.getQueue() ); - } - - - - /** - * Returns the user ID list filter. - * - **/ - public String getUserFilter() - { - // The selection code point is always present, the user Filter - // may not have been set. If empty, getUser() will return - // an empty string. - - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - return( selectionCP.getUser() ); - } - - - - /** - * Returns the user data list filter. - * - **/ - public String getUserDataFilter() - { - // The selection code point is always present, the userData Filter - // may not have been set. If empty, getUserData() will return - // an empty string. - - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - return( selectionCP.getUserData() ); - } - - /** - * Returns the create job system filter. - * - **/ - public String getJobSystemFilter() - { - // If empty, getJobSystem will return an blank string. - - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - return( selectionCP.getJobSystem() ); - } - - /** - * Returns the create end date filter. - * - **/ - public String getEndDateFilter() - { - // If empty, getEndDate will return an blank string. - - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - return( selectionCP.getEndDate() ); - } - - /** - * Returns the create end time filter. - * - **/ - public String getEndTimeFilter() - { - // If empty, getEndTime will return an blank string. - - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - return( selectionCP.getEndTime() ); - } - - - - PrintObject newNPObject(NPCPID cpid, NPCPAttribute cpattr) - { - return new SpooledFile(system_, (NPCPIDSplF)cpid, cpattr); - } - - /** - * Returns the create start date filter. - * - **/ - public String getStartDateFilter() - { - // If empty, getStartDate will return blank string. - - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - return( selectionCP.getStartDate() ); - } - - /** - * Returns the create start time filter. - * - **/ - public String getStartTimeFilter() - { - // If empty, getStartTime will return an blank string. - - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - return( selectionCP.getStartTime() ); - } - - - - - /** - * Sets the formtype list filter. - * @param formTypeFilter The form type the spooled file must to be included - * in the list. It cannot be greater than 10 characters. - * The value can be any specific value or any of these special values: - *
      - *
    • *ALL - Spooled files with any form type will be included in the list. - *
    • *STD - Spooled files with the form type *STD will be included in the list. - *
    - * The default is *ALL. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setFormTypeFilter(String formTypeFilter) - throws PropertyVetoException - { - if( formTypeFilter == null ) - { - Trace.log( Trace.ERROR, "Parameter 'formTypeFilter' is null" ); - throw new NullPointerException( FORM_TYPE_FILTER ); - } - - // Allow a length of 0 to remove the filter from the - // selection code point. - - if (formTypeFilter.length() > 10) - { - Trace.log(Trace.ERROR, "Parameter 'formTypeFilter' is greater than 10 characters in length."); - throw new ExtendedIllegalArgumentException( - "formTypeFilter("+formTypeFilter+")", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - String oldFormTypeFilter = getFormTypeFilter(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( FORM_TYPE_FILTER, - oldFormTypeFilter, formTypeFilter ); - - // No one vetoed, make the change. - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - selectionCP.setFormType(formTypeFilter); - - // Propagate any change to ImplRemote if necessary... - if (impl_ != null) - impl_.setFilter("formType", formTypeFilter); - - changes.firePropertyChange( FORM_TYPE_FILTER, - oldFormTypeFilter, formTypeFilter ); - } - - - /** - * Sets the output queue filter. - * @param queueFilter The library and output queues on which to list spooled - * files. The format of the queueFilter string must be in the - * format of /QSYS.LIB/libname.LIB/queuename.OUTQ where - *
    - * libname is the library name that contains the queues to search. - * It can be a specific name or one of these special values: - *
      - *
    • %CURLIB% - The server job's current library - *
    • %LIBL% - The server job's library list - *
    • %ALL% - All libraries are searched. This value is only valid - * if the queuename is %ALL%. - *
    - * queuename is the name of an output queues to search. - * It can be a specific name or the special value %ALL%. - * If it is %ALL%, then the libname must be %ALL%. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setQueueFilter(String queueFilter) - throws PropertyVetoException - { - if( queueFilter == null ) - { - Trace.log( Trace.ERROR, "Parameter 'queueFilter' is null" ); - throw new NullPointerException( QUEUE_FILTER ); - } - - String oldQueueFilter = getQueueFilter(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( QUEUE_FILTER, oldQueueFilter, queueFilter ); - - // No one vetoed, make the change. - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - selectionCP.setQueue(queueFilter); - - // Propagate any change to ImplRemote if necessary... - if (impl_ != null) - impl_.setFilter("spooledFileQueue", queueFilter); - - // Notify any property change listeners. - changes.firePropertyChange( QUEUE_FILTER, oldQueueFilter, queueFilter ); - } - - - /** - * Sets the create job system filter. - * The name of the system where the job, specified in the qualified job name - * parameter, was run. This parameter can be used in conjunction with the user - * name, qualified output queue name, form type, user-specified data, auxiliary - * storage pool, starting spooled file create date, starting spooled file create - * time, ending spooled file create date, ending spooled file create time, or - * qualified job name parameters to return a partial list of all the spooled - * files. The list of spooled files returned is sorted by status, output - * priority, date, and time. - * - * The following special values are supported for this parameter: - *@param jobSystemFilter - *
    - * *ALL The returned list is not to be filtered based on job system name. - * *CURRENT - * Only spooled files created on the current system are to be returned. - * - * Only spooled files created on the system specified are to be returned. - *
    - * The system referenced by system must be at V5R2 or later to - * support this filter. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setJobSystemFilter(String jobSystemFilter) - throws PropertyVetoException - { - if( jobSystemFilter == null ) - { - Trace.log( Trace.ERROR, "Parameter 'jobSystemFilter' is null" ); - throw new NullPointerException( JOB_SYSTEM_FILTER ); - } - - String oldJobSystemFilter = getJobSystemFilter(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( JOB_SYSTEM_FILTER, oldJobSystemFilter, jobSystemFilter ); - - // No one vetoed, make the change. - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - selectionCP.setJobSystem(jobSystemFilter); - - // Propagate any change to ImplRemote if necessary... - if (impl_ != null) - impl_.setFilter("jobSystem", jobSystemFilter); - - // Notify any property change listeners. - changes.firePropertyChange( JOB_SYSTEM_FILTER, oldJobSystemFilter, jobSystemFilter ); - } - - /** - * Sets the end date filter. - * The date the spooled file was created on the system. If the Starting - * spooled file create date field is set to *ALL, then this field must be - * set to blanks. If a date has been specified for the Starting spooled - * file create date field, then this field must be set to a valid date. The - * date must be in the CYYMMDD format or the following special value: - * @param endDateFilter - *
    - * date All spooled files with a create date and time equal to or - * later than the starting spooled file create date are to be returned. - *
      - *
    • *LAST - All spooled files with a create date and time equal to or - * later than the starting spooled file create date are to be returned. - *
    - *
    - * The system referenced by system must be at V5R2 or later to - * support this filter. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setEndDateFilter(String endDateFilter) - throws PropertyVetoException - { - if( endDateFilter == null ) - { - Trace.log( Trace.ERROR, "Parameter 'endDateFilter' is null" ); - throw new NullPointerException( END_DATE_FILTER ); - } - if ((endDateFilter.length() > 7)) - { - Trace.log(Trace.ERROR, "Parameter 'endDateFilter' has invalid length."); - throw new ExtendedIllegalArgumentException( - "endDateFilter("+endDateFilter+")", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - String oldEndDateFilter = getEndDateFilter(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( END_DATE_FILTER, oldEndDateFilter, endDateFilter ); - - // No one vetoed, make the change. - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - selectionCP.setEndDate(endDateFilter); - - // Propagate any change to ImplRemote if necessary... - if (impl_ != null) - impl_.setFilter("endDate", endDateFilter); - - // Notify any property change listeners. - changes.firePropertyChange( END_DATE_FILTER, oldEndDateFilter, endDateFilter ); - } - - /** - * Sets the end time filter. - * The time the spooled file was created on the system. This field must be - * set to blanks when special value *ALL is used for field Starting spooled - * file create date or when special value *LAST is used for field Ending - * spooled file create date. This field must have a value set if a date is - * specified for field Ending spooled file create date. The time must be in the - * HHMMSS format. - * @param endTimeFilter - *
    - * time All spooled files with a create date and time equal to or - * later than the starting spooled file create date are to be returned. - * - *
    - * The system referenced by system must be at V5R2 or later to - * support this filter. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setEndTimeFilter(String endTimeFilter) - throws PropertyVetoException - { - if( endTimeFilter == null ) - { - Trace.log( Trace.ERROR, "Parameter 'endTimeFilter' is null" ); - throw new NullPointerException( END_TIME_FILTER ); - } - - String oldEndTimeFilter = getEndTimeFilter(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( END_TIME_FILTER, oldEndTimeFilter, endTimeFilter ); - - // No one vetoed, make the change. - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - selectionCP.setEndTime(endTimeFilter); - - // Propagate any change to ImplRemote if necessary... - if (impl_ != null) - impl_.setFilter("endTime", endTimeFilter); - - // Notify any property change listeners. - changes.firePropertyChange( END_TIME_FILTER, oldEndTimeFilter, endTimeFilter ); - } - - /** - * Sets the create start date filter. - * The date the spooled file was created on the system. This parameter can be - * used in conjunction with the user name, qualified output queue name, form - * type, user-specified data, auxiliary storage pool, job system name, starting - * spooled file create time, ending spooled file create date, ending spooled file - * create time, or qualified job name parameters to return a partial list of all - * the spooled files. The list of spooled files returned is sorted by status, - * output priority, date, and time. The date must be in the CYYMMDD format or - * one of the following special values: - * @param startDateFilter - *
    - * date All spooled files with a create date and time equal to or - * later than the starting spooled file create date are to be returned. - * *ALL The returned list is not to be filtered based on spooled file - * create date and spooled file create time. - * *FIRST All spooled files starting with the earliest create date and time and less than or equal to the ending - * spooled file create date and time are to be returned. - *
    - * The system referenced by system must be at V5R2 or later to - * support this filter. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setStartDateFilter(String startDateFilter) - throws PropertyVetoException - { - if( startDateFilter == null ) - { - Trace.log( Trace.ERROR, "Parameter 'startDateFilter' is null" ); - throw new NullPointerException( START_DATE_FILTER ); - } - - String oldStartDateFilter = getStartDateFilter(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( START_DATE_FILTER, oldStartDateFilter, startDateFilter ); - - // No one vetoed, make the change. - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - selectionCP.setStartDate(startDateFilter); - - // Propagate any change to ImplRemote if necessary... - if (impl_ != null) - impl_.setFilter("startDate", startDateFilter); - - // Notify any property change listeners. - changes.firePropertyChange( START_DATE_FILTER, oldStartDateFilter, startDateFilter ); - } - - /** - * Sets the create start time filter. - * This parameter can be used in conjunction with the user name, qualified - * output queue name, form type, user-specified data, auxiliary storage pool, - * job system name, starting spooled file create date, ending spooled file - * create date, ending spooled file create time, or qualified job name - * parameters to return a partial list of all the spooled files. The list of - * spooled files returned is sorted by status, output priority, date, and time. - * This parameter must be set to blanks when special value *ALL or *FIRST is used - * for parameter Starting spooled file create date. This parameter must have a - * value set if a date is specified for parameter Starting spooled file create - * date. The time must be in the HHMMSS format. - * - * The time format HHMMSS is defined as follows: - * @param startTimeFilter - *
    - * time All spooled files with a create date and time equal to or - *
    - * The system referenced by system must be at V5R2 or later to - * support this filter. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setStartTimeFilter(String startTimeFilter) - throws PropertyVetoException - { - if( startTimeFilter == null ) - { - Trace.log( Trace.ERROR, "Parameter 'startTimeFilter' is null" ); - throw new NullPointerException( START_TIME_FILTER ); - } - - String oldStartTimeFilter = getStartTimeFilter(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( START_TIME_FILTER, oldStartTimeFilter, startTimeFilter ); - - // No one vetoed, make the change. - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - selectionCP.setStartTime(startTimeFilter); - - // Propagate any change to ImplRemote if necessary... - if (impl_ != null) - impl_.setFilter("StartTime", startTimeFilter); - - // Notify any property change listeners. - changes.firePropertyChange( START_TIME_FILTER, oldStartTimeFilter, startTimeFilter ); - } - - - - - /** - * Sets the user ID list filter. - * - * @param userFilter The user or users for which to list spooled files. - * The value cannot be greater than 10 characters. - * The value can be any specific user ID or any of these special values: - *
      - *
    • *ALL - Spooled files created by all users will be included in the list. - *
    • *CURRENT - Spooled files created by the current user only will be in the list. - *
    - * The default is *CURRENT. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setUserFilter(String userFilter) - throws PropertyVetoException - { - if( userFilter == null ) - { - Trace.log( Trace.ERROR, "Parameter 'userFilter' is null" ); - throw new NullPointerException( USER_FILTER ); - } - - // Allow a length of 0 to remove the filter from the - // selection code point. - - if (userFilter.length() > 10) - { - Trace.log(Trace.ERROR, "Parameter 'userFilter' is greater than 10 characters in length."); - throw new ExtendedIllegalArgumentException( - "userFilter("+userFilter+")", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - String oldUserFilter = getUserFilter(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( USER_FILTER, oldUserFilter, userFilter ); - - // No one vetoed, make the change. - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - selectionCP.setUser(userFilter); - - // Propagate any change to ImplRemote if necessary... - if (impl_ != null) - impl_.setFilter("user", userFilter); - - // Notify any property change listeners - changes.firePropertyChange( USER_FILTER, oldUserFilter, userFilter ); - } - - - - /** - * Sets the user data list filter. - * - * @param userDataFilter The user data the spooled file must - * have for it to be included in the list. The value can be - * any specific value or the special value *ALL. The value cannot be - * greater than 10 characters. - * The default is *ALL. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setUserDataFilter(String userDataFilter) - throws PropertyVetoException - { - if( userDataFilter == null ) - { - Trace.log( Trace.ERROR, "Parameter 'userDataFilter' is null" ); - throw new NullPointerException( USER_DATA_FILTER ); - } - - // Allow a length of 0 to remove the filter from the - // selection code point. - - if (userDataFilter.length() > 10) - { - Trace.log(Trace.ERROR, "Parameter 'userDataFilter' is greater than 10 characters in length."); - throw new ExtendedIllegalArgumentException( - "userDataFilter("+userDataFilter+")", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - String oldUserDataFilter = getUserDataFilter(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( USER_DATA_FILTER, - oldUserDataFilter, userDataFilter ); - - // No one vetoed, make the change. - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - selectionCP.setUserData(userDataFilter); - - // Propagate any change to ImplRemote if necessary... - if (impl_ != null) - impl_.setFilter("userData", userDataFilter); - - // Notify any property change listeners. - changes.firePropertyChange( USER_DATA_FILTER, - oldUserDataFilter, userDataFilter ); - } - -} // SpooledFileList class - diff --git a/cvsroot/src/com/ibm/as400/access/SpooledFileList16.gif b/cvsroot/src/com/ibm/as400/access/SpooledFileList16.gif deleted file mode 100644 index 4b85c2278..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/SpooledFileList16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/SpooledFileList32.gif b/cvsroot/src/com/ibm/as400/access/SpooledFileList32.gif deleted file mode 100644 index 102dfed64..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/SpooledFileList32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/SpooledFileListBeanInfo.java b/cvsroot/src/com/ibm/as400/access/SpooledFileListBeanInfo.java deleted file mode 100644 index 2706f61db..000000000 --- a/cvsroot/src/com/ibm/as400/access/SpooledFileListBeanInfo.java +++ /dev/null @@ -1,162 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SpooledFileListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; -import java.awt.Image; - -/** -BeanInfo for SpooledFileList class. -**/ -public class SpooledFileListBeanInfo extends PrintObjectListBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Additional properties for SpooledFileList - private static PropertyDescriptor[] splFListProperties_; - - // Class this bean info represents. - private final static Class beanClass = SpooledFileList.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader rbl_; - - static - { - try - { - PropertyDescriptor formTypeFilter = - new PropertyDescriptor("formTypeFilter", beanClass); - formTypeFilter.setBound(true); - formTypeFilter.setConstrained(true); - formTypeFilter.setDisplayName(rbl_.getText("PROP_NAME_SPLF_FORMTYPE_FILTER")); - formTypeFilter.setShortDescription(rbl_.getText("PROP_DESC_SPLF_FORMTYPE_FILTER")); - - PropertyDescriptor outQFilter = - new PropertyDescriptor("queueFilter", beanClass); - outQFilter.setBound(true); - outQFilter.setConstrained(true); - outQFilter.setDisplayName(rbl_.getText("PROP_NAME_SPLF_OUTQ_FILTER")); - outQFilter.setShortDescription(rbl_.getText("PROP_DESC_SPLF_OUTQ_FILTER")); - - PropertyDescriptor userFilter = - new PropertyDescriptor("userFilter", beanClass); - userFilter.setBound(true); - userFilter.setConstrained(true); - userFilter.setDisplayName(rbl_.getText("PROP_NAME_SPLF_USER_FILTER")); - userFilter.setShortDescription(rbl_.getText("PROP_DESC_SPLF_USER_FILTER")); - - PropertyDescriptor userDataFilter = - new PropertyDescriptor("userDataFilter", beanClass); - userDataFilter.setBound(true); - userDataFilter.setConstrained(true); - userDataFilter.setDisplayName(rbl_.getText("PROP_NAME_SPLF_USERDATA_FILTER")); - userDataFilter.setShortDescription(rbl_.getText("PROP_DESC_SPLF_USERDATA_FILTER")); - - PropertyDescriptor[] properties = {formTypeFilter, outQFilter, - userFilter, userDataFilter }; - splFListProperties_ = properties; - } - - catch (IntrospectionException e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - // SpooledFileList does not define any additional events so we - // let the PrintObjectList provide: - // public int getDefaultEventIndex() - // public EventSetDescriptor[] getEventSetDescriptors() - - // We want "system" as the default property. PrintObjectList - // sets this so we don't have to override: - // public int getDefaultPropertyIndex() - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - // Per the JavaBean spec, properties are discrete, named attributes - // of a Java Bean that can affect its appearance or its behavior. - - PropertyDescriptor[] printObjectListProperties; - PropertyDescriptor[] combinedProperties; - int combinedSize; - - // Get the properties defined in PrintObjectListBeanInfo - printObjectListProperties = super.getPropertyDescriptors(); - - combinedSize = printObjectListProperties.length + splFListProperties_.length; - combinedProperties = new PropertyDescriptor[combinedSize]; - - // copy PrintObjectList properties - System.arraycopy( printObjectListProperties, // source - 0, // --offset - combinedProperties, // destination - 0, // --offset - printObjectListProperties.length ); // length - - // copy SpooledFileList properties - System.arraycopy( splFListProperties_, // source - 0, // --offset - combinedProperties, // destination - printObjectListProperties.length, // --offset - splFListProperties_.length ); // length - - return combinedProperties; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("SpooledFileList16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("SpooledFileList32.gif"); - break; - } - - return image; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/SpooledFileListImplProxy.java b/cvsroot/src/com/ibm/as400/access/SpooledFileListImplProxy.java deleted file mode 100644 index 7b8ea0e06..000000000 --- a/cvsroot/src/com/ibm/as400/access/SpooledFileListImplProxy.java +++ /dev/null @@ -1,28 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SpooledFileListImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; - -class SpooledFileListImplProxy extends PrintObjectListImplProxy -implements ProxyImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - SpooledFileListImplProxy() - { - super("SpooledFileList"); - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/SpooledFileListImplRemote.java b/cvsroot/src/com/ibm/as400/access/SpooledFileListImplRemote.java deleted file mode 100644 index b98c65152..000000000 --- a/cvsroot/src/com/ibm/as400/access/SpooledFileListImplRemote.java +++ /dev/null @@ -1,264 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SpooledFileListImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The SpooledFileList class is used to build a list of spooled file objects of type - * SpooledFile. The list can be filtered by formtype, output queue, user, ending date and - * time or user data. - * - *@see SpooledFile - **/ - -class SpooledFileListImplRemote extends PrintObjectListImplRemote -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // static private binary data for default attribute to - // retrieve on a spooled file when listing spooled files - // format is: - // --------------------------------------------------- - // |nn | LEN | ID1 | ID2 | ID3 | ID4 | ....... | IDnn| - // --------------------------------------------------- - // nn - two byte total # of attributes in code point - // LEN - two byte length of each attribute entry, right - // now this will be 2 (0x02). - // IDx - two byte attribute ID - - private static final byte[] attrIDToList_ = - { - // 80 attributes - 0x00, 0x50, // big endian(BE), number of attrs - 0x00, 0x02, // BE - size in bytes of each ID - 0x00, 0x0B, // ATTR_ALIGN - 0x01, 0x1A, // ATTR_AFP_RESOURCE - 0x00, 0x11, // ATTR_BKMGN_ACR - 0x00, 0x12, // ATTR_BKMGN_DWN - 0x00, 0x13, // ATTR_BKOVRLLIB - 0x00, 0x14, // ATTR_BKOVRLAY - 0x00, 0x15, // ATTR_BKOVL_DWN - 0x00, 0x16, // ATTR_BKOVL_ACR - 0x00, 0x17, // ATTR_CPI - 0x00, 0x18, // ATTR_CODEDFNTLIB - 0x00, 0x1A, // ATTR_CODEDFNT - 0x00, 0x1C, // ATTR_COPIES - 0x00, 0x1D, // ATTR_COPIESLEFT - 0x00, 0x1E, // ATTR_CURPAGE - 0x00, 0x22, // ATTR_DATE - 0x00, (byte)0xFD, // ATTR_DATE_END - 0x00, (byte)0x99, // ATTR_DBCSDATA - 0x00, (byte)0x9A, // ATTR_DBCSEXTENSN - 0x00, (byte)0x9B, // ATTR_DBCSROTATE - 0x00, (byte)0x9C, // ATTR_DBCSCPI - 0x00, (byte)0x9D, // ATTR_DBCSSISO - 0x00, 0x24, // ATTR_PAGRTT - 0x00, 0x2B, // ATTR_ENDPAGE - 0x00, 0x2C, // ATTR_FILESEP - 0x00, 0x2D, // ATTR_FOLDREC - 0x00, 0x2E, // ATTR_FONTID - 0x00, (byte)0xB7, // ATTR_FORMDEFLIB - 0x00, (byte)0xB6, // ATTR_FORMDEF - 0x00, 0x2F, // ATTR_FORMFEED - 0x00, 0x30, // ATTR_FORMTYPE - 0x00, 0x31, // ATTR_FTMGN_ACR - 0x00, 0x32, // ATTR_FTMGN_DWN - 0x00, 0x33, // ATTR_FTOVRLLIB - 0x00, 0x34, // ATTR_FTOVRLAY - 0x00, 0x36, // ATTR_FTOVL_ACR - 0x00, 0x35, // ATTR_FTOVL_DWN - 0x00, 0x37, // ATTR_CHAR_ID - 0x00, 0x38, // ATTR_JUSTIFY - 0x00, 0x39, // ATTR_HOLD - 0x00, 0x3B, // ATTR_JOBNAME - 0x00, 0x3C, // ATTR_JOBNUMBER - 0x00, (byte)0xFB, // ATTR_JOBSYSTEM - 0x00, 0x3E, // ATTR_JOBUSER - 0x00, 0x3F, // ATTR_LASTPAGE - 0x00, 0x40, // ATTR_LPI - 0x00, 0x42, // ATTR_MAXRCDS - 0x00, 0x4E, // ATTR_PAGELEN - 0x00, 0x51, // ATTR_PAGEWIDTH - 0x00, 0x4F, // ATTR_MEASMETHOD - 0x00, 0x48, // ATTR_OUTPTY - 0x00, 0x49, // ATTR_OUTQUELIB - 0x00, 0x4A, // ATTR_OUTQUE - 0x00, 0x4C, // ATTR_OVERFLOW - 0x00, 0x52, // ATTR_MULTIUP - 0x00, 0x53, // ATTR_POINTSIZE - 0x00, 0x54, // ATTR_FIDELITY - 0x00, 0x55, // ATTR_DUPLEX - 0x00, 0x56, // ATTR_PRTQUALITY - 0x00, 0x58, // ATTR_PRTTEXT - 0x00, 0x5A, // ATTR_PRTDEVTYPE - 0x00, 0x5B, // ATTR_PRTFLIB - 0x00, 0x5C, // ATTR_PRTFILE - 0x00, 0x5F, // ATTR_RECLENGTH - 0x00, 0x61, // ATTR_RPLUNPRT - 0x00, 0x62, // ATTR_RPLCHAR - 0x00, 0x63, // ATTR_RESTART - 0x00, 0x64, // ATTR_SAVE - 0x00, 0x66, // ATTR_SRCDRWR - 0x00, 0x68, // ATTR_SPOOLFILE - 0x00, 0x69, // ATTR_SPLFNUM - 0x00, 0x6A, // ATTR_SPLFSTATUS - 0x00, 0x6B, // ATTR_SCHEDULE - 0x00, 0x6C, // ATTR_STARTPAGE - 0x00, 0x6E, // ATTR_TIME - 0x00, (byte)0xFE, // ATTR_TIME_END - 0x00, 0x6F, // ATTR_PAGES - 0x00, (byte)0xF5, // ATTR_PAGDFNLIB - 0x00, (byte)0xF6, // ATTR_PAGDFN - 0x00, 0x72, // ATTR_UNITOFMEAS - 0x00, 0x73, // ATTR_USERCMT - 0x00, 0x74, // ATTR_USERDATA - 0x00, (byte)0xA2, // ATTR_USRDEFDATA - 0x00, (byte)0xA3, // ATTR_USRDEFOPT - 0x00, (byte)0xA5, // ATTR_USRDEFOBJ - 0x00, (byte)0xA4, // ATTR_USRDEFOBJLIB - 0x00, (byte)0xA6, // ATTR_USRDEFOBJTYP - }; - - private static final NPCPAttributeIDList defaultAttrIDsToList_ = new NPCPAttributeIDList(attrIDToList_); - - // register the spooled file return datastream for listing spooled files - static - { - NPDataStream ds; - NPCodePoint cp; - - ds = new NPDataStream(NPConstants.SPOOLED_FILE); - cp = new NPCPIDSplF(); - ds.addCodePoint(cp); - cp = new NPCPAttribute(); - ds.addCodePoint(cp); - AS400Server.addReplyStream(ds, "as-netprt"); - } - - - - /** - * Returns the default attributes to list. - **/ - NPCPAttributeIDList getDefaultAttrsToList() - { - return defaultAttrIDsToList_; - } - - - - /** - * Creates a new SpooledFile object. - **/ - /* @D - PrintObject newNPObject(AS400 system, NPDataStream reply) - { - SpooledFile npSplF = null; - NPCPIDSplF cpidSplF; - NPCPAttribute cpAttrs; - cpidSplF = (NPCPIDSplF)reply.getCodePoint(NPCodePoint.SPOOLED_FILE_ID); // never should return null - cpAttrs = (NPCPAttribute)reply.getCodePoint(NPCodePoint.ATTRIBUTE_VALUE); // may return null - npSplF = new SpooledFile(system, cpidSplF, cpAttrs); - return npSplF; - } - */ - - - NPCPID newNPCPID(NPDataStream reply) - { - return (NPCPIDSplF)reply.getCodePoint(NPCodePoint.SPOOLED_FILE_ID); // never should return null - } - - - - /** - * Sets the formtype list filter. - * @param formTypeFilter The form type the spooled file must to be included - * in the list. It cannot be greater than 10 characters. - * The value can be any specific value or any of these special values: - *
      - *
    • *ALL - Spooled files with any form type will be included in the list. - *
    • *STD - Spooled files with the form type *STD will be included in the list. - *
    - * The default is *ALL. - **/ - public void setFormTypeFilter(String formTypeFilter) - { - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - selectionCP.setFormType(formTypeFilter); - } - - - - /** - * Sets the output queue filter. - * @param queueFilter The library and output queues on which to list spooled - * files. The format of the queueFilter string must be in the - * format of /QSYS.LIB/libname.LIB/queuename.OUTQ where - *
    - * libname is the library name that contains the queues to search. - * It can be a specific name or one of these special values: - *
      - *
    • %CURLIB% - The server job's current library - *
    • %LIBL% - The server job's library list - *
    • %ALL% - All libraries are searched. This value is only valid - * if the queuename is %ALL%. - *
    - * queuename is the name of an output queues to search. - * It can be a specific name or the special value %ALL%. - * If it is %ALL%, then the libname must be %ALL%. - **/ - public void setQueueFilter(String queueFilter) - { - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - selectionCP.setQueue(queueFilter); - } - - - - /** - * Sets the user ID list filter. - * - * @param userFilter The user or users for which to list spooled files. - * The value cannot be greater than 10 characters. - * The value can be any specific user ID or any of these special values: - *
      - *
    • *ALL - Spooled files created by all users will be included in the list. - *
    • *CURRENT - Spooled files created by the current user only will be in the list. - *
    - * The default is *CURRENT. - **/ - public void setUserFilter(String userFilter) - { - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - selectionCP.setUser(userFilter); - } - - - - /** - * Sets the user data list filter. - * - * @param userDataFilter The user data the spooled file must - * have for it to be included in the list. The value can be - * any specific value or the special value *ALL. The value cannot be - * greater than 10 characters. - * The default is *ALL. - **/ - public void setUserDataFilter(String userDataFilter) - { - NPCPSelSplF selectionCP = (NPCPSelSplF)getSelectionCP(); - selectionCP.setUserData(userDataFilter); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/SpooledFileOutputStream.java b/cvsroot/src/com/ibm/as400/access/SpooledFileOutputStream.java deleted file mode 100644 index 0b3ebf525..000000000 --- a/cvsroot/src/com/ibm/as400/access/SpooledFileOutputStream.java +++ /dev/null @@ -1,454 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SpooledFileOutputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.OutputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -/** - * The SpooledFileOutputStream class is used to write data into a spooled file. - **/ -public class SpooledFileOutputStream extends OutputStream -{ - //Private Data - - private transient AS400 system_; - private transient SpooledFileOutputStreamImpl impl_; - - /** - * Constructs a SpooledFileOutputStream object. - * Use this object to create a new spooled file on the given system - * with the specified parameters. - * @param system The system on which to create the spooled file. - * @param options Optional. A print parameter list that contains - * a list of attributes with which to create the spooled file. - * The attributes set in options will - * override those attributes in the printer file that is used. - * The printer file used will be the one specified with the - * printerFile parameter, or if that parameter is null, - * it will be the default network print server printer file (QPNPSPRTF). - * If the output queue is specified in options, it - * will override any output queue passed in the outputQueue - * parameter. - * The following parameters may be set: - * - * Note 1: Code page and graphical character set are dependent upon each - * other. If you set one you must set the other. - *
    - * Note 2: The special value of *FILE is not allowed when creating a new - * spooled file. - *
    - * Note 3: Up to 4 user-defined options may be specified. - *
    - * Note 4: A page definition can be specified with *LINE data. - *

    - * @param printerFile Optional. The printer file that should be used - * to create the spooled file. This printer file - * must reside on the same system that the - * spooled file is being created on. - * @param outputQueue Optional. The output queue on which to create the - * spooled file. The output queue must reside on - * the same system that the spooled file - * is being created on. - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - **/ - - public SpooledFileOutputStream(AS400 system, - PrintParameterList options, - PrinterFile printerFile, - OutputQueue outputQueue) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException - { - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - system_ = system; - chooseImpl(); - // Do connect here because it may throw Exceptions. - system_.connectService(AS400.PRINT); - - PrinterFileImpl pfi = null; - if (printerFile != null) { - if (printerFile.getImpl() == null) { - printerFile.chooseImpl(); - } - pfi = (PrinterFileImpl) printerFile.getImpl(); - } - OutputQueueImpl oqi = null; - if (outputQueue != null) { - if (outputQueue.getImpl() == null) { - outputQueue.chooseImpl(); - } - oqi = (OutputQueueImpl) outputQueue.getImpl(); - } - impl_.createSpooledFileOutputStream(system_.getImpl(), - options, - pfi, - oqi); - } - - - - // A1A - Added method - private void chooseImpl() - { - if (system_ == null) { - Trace.log( Trace.ERROR, "Attempt to use SpooledFileOutputStream before setting system."); - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - impl_ = (SpooledFileOutputStreamImpl) system_.loadImpl2("com.ibm.as400.access.SpooledFileOutputStreamImplRemote", - "com.ibm.as400.access.SpooledFileOutputStreamImplProxy"); - } - - - - /** - * Closes the stream. - * It must be called to release any resources associated with the stream. - * @exception IOException If an error occurs while communicating with the system. - **/ - public void close() - throws IOException - { - impl_.close(); - } - - - - /** Flushes the stream. This will write any buffered output bytes. - * @exception IOException If an error occurs while communicating with the system. - **/ - public void flush() - throws IOException - { - impl_.flush(); - } - - - - /** Returns the spooled file that was created (or is being created) with - * this output stream. - * @return A reference to the spooled file object. - **/ - public SpooledFile getSpooledFile() - throws IOException - { - SpooledFile sf = null; - NPCPIDSplF spID = impl_.getSpooledFile(); - try { - spID.setConverter((new Converter(system_.getCcsid(), system_)).impl); - } - catch(UnsupportedEncodingException e) { - if (Trace.isTraceErrorOn()) - Trace.log(Trace.ERROR, "Error initializing converter for print object", e); - } - sf = new SpooledFile(system_, spID, null); - return sf; - } - - - - /** Writes a byte of data. - * @param b The byte to be written. - * @exception IOException If an error occurs while communicating with the system. - **/ - public void write(int b) - throws IOException - { - byte[] buffer1Byte_ = new byte[1]; - buffer1Byte_[0] = (byte)b; - write(buffer1Byte_, 0, 1); - } - - - - /** Writes data.length bytes of data from the byte array - * data to the spooled file. - * - * @param data The data to be written. - * @exception IOException If an error occurs while communicating with the system. - **/ - public void write(byte[] data) - throws IOException - { - write(data, 0, data.length); - } - - - - /** - * Writes up to length bytes of data from the byte array data, - * starting at offset, to this spooled file. - * - * @param data The data to be written. - * @param offset The start offset in the data. - * @param length The number of bytes that are written. - * - * @exception IOException If an error occurs while communicating with the system. - **/ - public void write(byte data[], int offset, int length) - throws IOException - { - impl_.write(data, offset, length); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SpooledFileOutputStreamImpl.java b/cvsroot/src/com/ibm/as400/access/SpooledFileOutputStreamImpl.java deleted file mode 100644 index a3bf7f3c0..000000000 --- a/cvsroot/src/com/ibm/as400/access/SpooledFileOutputStreamImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SpooledFileOutputStreamImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - * The SpooledFileOutputStreamImpl interface defines a set of methods - * needed for a full implementation of the SpooledFileOutputStream class. - **/ - -interface SpooledFileOutputStreamImpl -{ - public abstract void createSpooledFileOutputStream(AS400Impl system, - PrintParameterList options, - PrinterFileImpl printerFile, - OutputQueueImpl outputQueue) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException; - - - - public abstract void close() - throws IOException; - - - - public abstract void flush() - throws IOException; - - - - public abstract /* synchronized */ NPCPIDSplF getSpooledFile() - throws IOException; - - - - public abstract /* synchronized */ void write(byte data[], int offset, int length) - throws IOException; -} diff --git a/cvsroot/src/com/ibm/as400/access/SpooledFileOutputStreamImplProxy.java b/cvsroot/src/com/ibm/as400/access/SpooledFileOutputStreamImplProxy.java deleted file mode 100644 index 1ae72151e..000000000 --- a/cvsroot/src/com/ibm/as400/access/SpooledFileOutputStreamImplProxy.java +++ /dev/null @@ -1,131 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SpooledFileOutputStreamImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; -import java.io.IOException; - -/** - * The SpooledFileOutputStreamImplProxy class implements proxy versions of - * the public methods defined in the SpooledFileOutputStreamImpl class. - * Unless commented otherwise, the implementations of the methods below - * are merely proxy calls to the corresponding method in the remote - * implementation class (SpooledFileOutputStreamImplRemote). - **/ - -class SpooledFileOutputStreamImplProxy extends AbstractProxyImpl -implements SpooledFileOutputStreamImpl, ProxyImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - SpooledFileOutputStreamImplProxy() - { - super("SpooledFileOutputStream"); - } - - - public void createSpooledFileOutputStream(AS400Impl system, - PrintParameterList options, - PrinterFileImpl printerFile, - OutputQueueImpl outputQueue) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException - { - try { - connection_.callMethod(pxId_, "createSpooledFileOutputStream", - new Class [] { AS400Impl.class, PrintParameterList.class, - PrinterFileImpl.class, OutputQueueImpl.class }, - new Object[] { system, options, printerFile, outputQueue }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow4(e); - } - } - - - - public void close() - throws IOException - { - try { - connection_.callMethod(pxId_, "close"); - } - catch (InvocationTargetException e) { - Throwable error = e.getTargetException(); - if (error instanceof IOException) - throw (IOException) error; - else - throw ProxyClientConnection.rethrow(e); - } - } - - - - public void flush() - throws IOException - { - try { - connection_.callMethod(pxId_, "flush"); - } - catch (InvocationTargetException e) { - Throwable error = e.getTargetException(); - if (error instanceof IOException) - throw (IOException) error; - else - throw ProxyClientConnection.rethrow(e); - } - } - - - - public /* synchronized */ NPCPIDSplF getSpooledFile() - throws IOException - { - try { - return (NPCPIDSplF) connection_.callMethod(pxId_, "getSpooledFile").getReturnValue(); - } - catch (InvocationTargetException e) { - Throwable error = e.getTargetException(); - if (error instanceof IOException) - throw (IOException) error; - else - throw ProxyClientConnection.rethrow(e); - } - } - - - - public /* synchronized */ void write(byte data[], int offset, int length) - throws IOException - { - try { - connection_.callMethod(pxId_, "write", - new Class[] { byte[].class , Integer.TYPE, Integer.TYPE }, - new Object[] { data, new Integer(offset), new Integer(length) }); - } - catch (InvocationTargetException e) { - Throwable error = e.getTargetException(); - if (error instanceof IOException) - throw (IOException) error; - else - throw ProxyClientConnection.rethrow(e); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SpooledFileOutputStreamImplRemote.java b/cvsroot/src/com/ibm/as400/access/SpooledFileOutputStreamImplRemote.java deleted file mode 100644 index 3630cd1ff..000000000 --- a/cvsroot/src/com/ibm/as400/access/SpooledFileOutputStreamImplRemote.java +++ /dev/null @@ -1,775 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SpooledFileOutputStreamImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.OutputStream; -import java.io.IOException; - -/** - * The SpooledFileOutputStream class is used to write data into a server spooled file. - **/ -class SpooledFileOutputStreamImplRemote -implements SpooledFileOutputStreamImpl -{ - static final String DT_AUTO = "*AUTO"; - static final String DT_PRTF = "*PRTF"; - - private byte[] buffer_ = new byte[4096]; // we'll buffer up to 4K before sending - - private NPConversation conversation_; - - private NPCPAttribute cpAttr_; // attributes to create spooled file with - private NPCPAttribute cpCPFMsg_; // any error messages come back here - private NPCPIDSplF cpIDSplF_; // ID codepoint of spooled file created - private NPCPIDOutQ cpIDOutQ_; // output queue ID (may be null) - private NPCPIDPrinterFile cpIDPrtrFile_; // printer file ID (may be null) - private NPCPSplFHandle cpSplFHndl_; // handle used for writes and close request - - private boolean fCreatePending_; - private NPSystem npSystem_; - private int offset_ = 0; // current offset into buffer - private AS400ImplRemote sys_; - - /** - * Constructs a SpooledFileOutputStream object. - * Use this object to create a new spooled file on the given system - * with the specified parameters. - * @param system The system on which to create the spooled file. - * @param options Optional. A print parameter list that contains - * a list of attributes with which to create the spooled file. - * The attributes set in options will - * override those attributes in the printer file that is used. - * The printer file used will be the one specified with the - * printerFile parameter, or if that parameter is null, - * it will be the default network print server printer file (QPNPSPRTF). - * If the output queue is specified in options, it - * will override any output queue passed in the outputQueue - * parameter. - * The following parameters may be set: - *

    - * Note 1: Code page and graphical character set are dependent upon each - * other. If you set one you must set the other. - *
    - * Note 2: The special value of *FILE is not allowed when creating a new - * spooled file. - *
    - * Note 3: Up to 4 user-defined options may be specified. - *

    - * @param printerFile Optional. The printer file that should be used - * to create the spooled file. This printer file - * must reside on the same server system that the - * spooled file is being created on. - * @param outputQueue Optional. The output queue on which to create the - * spooled file. The output queue must reside on - * the same server system that the spooled file - * is being created on. - * @return An output stream that can be used to write data into the spooled - * file and to close the spooled file. - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - **/ - - public synchronized void createSpooledFileOutputStream(AS400Impl system, - PrintParameterList options, - PrinterFileImpl printerFile, - OutputQueueImpl outputQueue) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException - { - // Force the system param to connect if it isn't already - // so that we can check its system name against the - // system outputQueue and printerFile are on - - // NPSystem npSystem = NPSystem.getSystem(system); - // NPConversation conv = npSystem.getConversation(); - // npSystem.returnConversation(conv); // we're done with it - - fCreatePending_ = true; // we haven't issued the create yet - sys_ = (AS400ImplRemote) system; - npSystem_ = NPSystem.getSystem(sys_); - conversation_ = npSystem_.getConversation(); - cpCPFMsg_ = new NPCPAttribute(); - cpIDSplF_ = new NPCPIDSplF(); - cpSplFHndl_ = new NPCPSplFHandle(); - - - // if the user passed in a printer file, get its ID - if (printerFile != null) - { - cpIDPrtrFile_ = (NPCPIDPrinterFile)((PrinterFileImplRemote) printerFile).getIDCodePoint(); - } - - // if the user passed in an output queue, get its ID - if (outputQueue != null) - { - cpIDOutQ_ = (NPCPIDOutQ)((OutputQueueImplRemote) outputQueue).getIDCodePoint(); - } - - //------------------------------------------------------------- - // figure out what data type we're using. - // If the user has specified nothing or *AUTO - // delay the open until we get some data to analyze. - // If the user has specified *PRTF, change it to be nothing and the server - // will use what is in the printer file. - //------------------------------------------------------------- - String strDataType = null; - - cpAttr_ = new NPCPAttribute(); // we need our own copy because we may change things - - if (options != null) - { - cpAttr_.addUpdateAttributes(options.getAttrCodePoint()); - } - - strDataType = cpAttr_.getStringValue(PrintObject.ATTR_PRTDEVTYPE); - if (strDataType == null) - { - // datastream type not specified, so use *AUTO - strDataType = DT_AUTO; - } else { - //------------------------------------------------------------- - // strip trailing nulls & uppercase user specified value. - //------------------------------------------------------------- - strDataType = strDataType.toUpperCase().trim(); - } - - //------------------------------------------------------------- - // strDataType now contains the data type to use, whether the user - // explicitly set it or we defaulted it. - // Need to see if we should delay the create here - // IF not - // Need to change *PRTF to "" - // IF pAttrs specified, change it to "". - // ELSE - // set create pending flag on - // ENDIF - //------------------------------------------------------------- - if (strDataType.equals(DT_AUTO)) - { - fCreatePending_ = true; // data type is automatic so wait for create - } else { - if (strDataType.equals(DT_PRTF)) - { - strDataType = ""; - } - makeCreateRequest(strDataType); - } - - } - - - /** - * Closes the stream. - * It must be called to release any resources associated with the stream. - * @exception IOException If an error occurs while communicating with the server. - **/ - public synchronized void close() - throws IOException - { - if (conversation_ == null) - { - Trace.log(Trace.ERROR, "Conversation is null."); - throw new IOException(); - } - // if there is any data pending. write it out - if (offset_ != 0) - { - makeWriteRequest(buffer_, 0, offset_); - offset_ = 0; - } - // if create is still pending here, then we have an empty spooled - // file, send it up anyway... - if (fCreatePending_) - { - makeCreateRequest(null); - } - - - NPDataStream closeReq = new NPDataStream(NPConstants.SPOOLED_FILE); - NPDataStream closeRep = new NPDataStream(NPConstants.SPOOLED_FILE); - - // setup the close request data stream - closeReq.setAction(NPDataStream.CLOSE); - closeReq.addCodePoint(cpSplFHndl_); - - // setup the close reply to catch the return codepoints - closeRep.addCodePoint(cpCPFMsg_); - - try - { - // make the request - conversation_.makeRequest(closeReq, closeRep); - } - - catch (Exception e) - { - Trace.log(Trace.ERROR, "Caught an Exception." + e.toString()); - throw new IOException(e.toString()); - } - finally - { - // if we still have a conversation, return it - if (conversation_ != null) - { - npSystem_.returnConversation(conversation_); - conversation_ = null; - } - } - } // close() - - - - /** - * Closes the stream when garbage is collected. - * @exception Throwable If an error occurs. - **/ - protected void finalize() - throws Throwable - { - // We must be very careful here to not try to receive a - // reply from the server - we are being called by the - // garbage collector which could be running on the - // background thread of the AS400Server object in our - // conversation. If we were to call back to the AS400Server - // to wait for a reply we could end up in a deadlock situation - // Any requests we make we'll discard the reply on - - // if we still have a conversation - // they must not have sent the close yet - - if (conversation_ != null) - { - // if we have sent the create request - if (!fCreatePending_) - { - // send up a close request and ignore the reply - NPDataStream closeReq = new NPDataStream(NPConstants.SPOOLED_FILE); - - - // setup the close request data stream - closeReq.setAction(NPDataStream.CLOSE); - closeReq.addCodePoint(cpSplFHndl_); - - AS400Server server= conversation_.getServer(); - if (server != null) - { - // @D closeReq.setHostCCSID(conversation_.getHostCCSID()); - closeReq.setConverter(conversation_.getConverter()); - server.sendAndDiscardReply(closeReq); - } - } - npSystem_.returnConversation(conversation_); - } - super.finalize(); // always call super.finalize()! - } - - - - /** Flushes the stream. This will write any buffered output bytes. - * @exception IOException If an error occurs while communicating with the server. - **/ - public synchronized void flush() - throws IOException - { - // send what we have, if any - if (offset_ != 0) - { - makeWriteRequest(buffer_, 0, offset_); - offset_ = 0; - } - } - - - - /** Returns the spooled file that was created (or is being created) with - * this output stream. - * @return A reference to the spooled file object. - **/ - public synchronized NPCPIDSplF getSpooledFile() - throws IOException - { - // @D SpooledFile sf = null; - NPCPIDSplF sfID = null; - - // flush any data we have first - // if the file hasn't been closed already - if (conversation_ != null) - { - flush(); - } - - // if we've issued the create already - if (!fCreatePending_) - { - // return the spooled file that we created - - // sf = new SpooledFile(sys_, cpIDSplF_, null); // @D (see below) - // The call to create the SpooledFile will be made on the proxy side - sfID = cpIDSplF_; - } else { - Trace.log(Trace.ERROR, "Spooled File has not been created."); - throw new - ExtendedIllegalStateException(ExtendedIllegalStateException.OBJECT_MUST_BE_OPEN); - } - - // return sf; // @D - return sfID; - } - - - - /** - * Generates the create request. - * @param strDataType The PRTDEVTYPE to use (*SCS, *AFPDS, *USERASCII)... - * @exception IOException If an error occurs while communicating with the server. - **/ - private synchronized void makeCreateRequest(String strDataType) - throws IOException - { - if (conversation_ == null) - { - Trace.log(Trace.ERROR, "Conversation is null."); - throw new IOException(); - } - //------------------------------------------------------------- - // if datatype is something (override the printer file - // set the datatype in the attributes - //------------------------------------------------------------- - if ((strDataType != null) && - (!strDataType.equals(""))) // if strDataType is something - { - if (cpAttr_ == null) - { - cpAttr_ = new NPCPAttribute(); - } - cpAttr_.setAttrValue(PrintObject.ATTR_PRTDEVTYPE, strDataType); - } - NPDataStream createReq = new NPDataStream(NPConstants.SPOOLED_FILE); - NPDataStream createRep = new NPDataStream(NPConstants.SPOOLED_FILE); - - // setup the create request data stream - createReq.setAction(NPDataStream.CREATE); - if (cpAttr_ != null) - { - createReq.addCodePoint(cpAttr_); - } - if (cpIDOutQ_ != null) - { - createReq.addCodePoint(cpIDOutQ_); - } - if (cpIDPrtrFile_ != null) - { - createReq.addCodePoint(cpIDPrtrFile_); - } - - // setup the create reply to catch the return codepoints - createRep.addCodePoint(cpSplFHndl_); - createRep.addCodePoint(cpCPFMsg_); - createRep.addCodePoint(cpIDSplF_); - - try - { - // make the request - conversation_.makeRequest(createReq, createRep); - } - - catch (Exception e) - { - Trace.log(Trace.ERROR, "Caught an Exception." + e.toString()); - throw new IOException(e.toString()); - } - fCreatePending_ = false; // reset the create flag - - } // makeCreateRequest() - - - - /** - * Generates the write request. - * @param buf The array of bytes to write. - * @param length The length of data to write. - * @exception IOException If an error occurs while communicating with the server. - **/ - private synchronized void makeWriteRequest(byte[] buf, - int offset, - int len) - throws IOException - { - if (conversation_ == null) - { - Trace.log(Trace.ERROR, "Conversation is null."); - throw new IOException(); - } - // if the create is still pending here then - // we should sniff the data and then issue the create - // request with the correct data type - if (fCreatePending_) - { - String strDataType = NPDataAnalyzer.sniff(buf, offset, len); - makeCreateRequest(strDataType); - } - - // - // now make the write request - // - NPDataStream writeReq = new NPDataStream(NPConstants.SPOOLED_FILE); - NPDataStream writeRep = new NPDataStream(NPConstants.SPOOLED_FILE); - NPCPData cpData = new NPCPData(); - cpData.setDataBuffer(buf, len, offset); - - // setup the write request data stream - writeReq.setAction(NPDataStream.WRITE); - - writeReq.addCodePoint(cpSplFHndl_); - writeReq.addCodePoint(cpData); - - - // setup the create reply to catch the return codepoints - writeRep.addCodePoint(cpCPFMsg_); - - try - { - // make the request - conversation_.makeRequest(writeReq, writeRep); - } - - catch (Exception e) - { - Trace.log(Trace.ERROR, "Caught an Exception." + e.toString()); - throw new IOException(e.toString()); - } - - } - - - - /** - * Writes up to length bytes of data from the byte array data, - * starting at offset, to this spooled file. - * - * @param data The data to be written. - * @param offset The start offset in the data. - * @param length The number of bytes that are written. - * - * @exception IOException If an error occurs while communicating with the server. - **/ - public synchronized void write(byte data[], int offset, int length) - throws IOException - { - if (conversation_ == null) - { - Trace.log(Trace.ERROR, "SpooledFileOutputStream already closed."); - throw new IOException(); - } - - int currentSourceOffset = offset; - int dataLeftToSend = length; - - while(dataLeftToSend > 0) - { - - - //------------------------------------------------------------- - // calculate the available buffer space left in the current - // buffer - //------------------------------------------------------------- - int availLen = buffer_.length - offset_; - - if (availLen >= dataLeftToSend) - { - //------------------------------------------------------------- - // If we have enough to hold it all - // Move it all to the current buffer - //------------------------------------------------------------- - System.arraycopy(data, currentSourceOffset, - buffer_, offset_, - dataLeftToSend); - currentSourceOffset += dataLeftToSend; - offset_ += dataLeftToSend; - dataLeftToSend = 0; - } else { - if (availLen != 0) - { - //------------------------------------------------------------- - // If we have ANY room at all - // Move what we can from the callers buffer to - // the current write bitstream - //------------------------------------------------------------- - System.arraycopy(data, currentSourceOffset, - buffer_, offset_, - availLen); - - currentSourceOffset += availLen; - offset_ += availLen; - dataLeftToSend -= availLen; - } - - //------------------------------------------------------------- - // if there is any data in the bytestream, send it out - //------------------------------------------------------------- - if (offset_ != 0) - { - makeWriteRequest(buffer_, 0, offset_); - offset_ = 0; - } - } - } // end while - } // write(byte[], int, int) - -} diff --git a/cvsroot/src/com/ibm/as400/access/StoppableThread.java b/cvsroot/src/com/ibm/as400/access/StoppableThread.java deleted file mode 100644 index 1032686b7..000000000 --- a/cvsroot/src/com/ibm/as400/access/StoppableThread.java +++ /dev/null @@ -1,98 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: StoppableThread.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - - -/** -The StoppableThread class represents a thread -that can be safely stopped. See the JDK 1.2 -documentation for Thread.stop() to see why -this is necessary. -**/ -abstract class StoppableThread -extends Thread -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - - - // Private data. - private static boolean DEBUG_ = false; - - private boolean continue_ = true; - - private static Object countLock_ = new Object(); - private static int count_ = 0; - - - - protected StoppableThread () - { - this("Stoppable-Thread-" + newId()); - } - - - - protected StoppableThread(String name) - { - super(name); - - if (DEBUG_) - System.out.println ("Thread:start:" + getName() + "(" + getClass() + ")."); - } - - - -/** -Indicates if the thread can continue. -**/ - protected boolean canContinue () - { - return continue_; - } - - - - protected static long newId() - { - synchronized(countLock_) { - return ++count_; - } - } - - - -/** -Stops the thread safely. -**/ - public void stopSafely () - { - if (DEBUG_) - System.out.println ("Thread:stop:" + getName() + "(" + getClass() + ")."); - - continue_ = false; - } - - - public boolean wasStoppedSafely() - { - return (continue_ == false); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/Subsystem.java b/cvsroot/src/com/ibm/as400/access/Subsystem.java deleted file mode 100644 index b24624d77..000000000 --- a/cvsroot/src/com/ibm/as400/access/Subsystem.java +++ /dev/null @@ -1,984 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemPool.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2004-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.*; -import java.beans.PropertyVetoException; -import java.util.Vector; -import java.util.Enumeration; - -/** - Represents a subsystem on the system. - Most of the getter methods simply return the cached attribute value obtained by the most recent {@link #refresh() refresh()}. Other than getObjectDescription(), none of the getters will themselves go to the system to get the current attribute value. Prior to the first refresh(), many of the getters will return null or zero. -
    Example: -

    - Subsystem sbs = new Subsystem(system, library, name);
    - if (!sbs.exists()) {
    -   System.out.println("No such subsystem: "+sbs.getPath());
    - }
    - else {
    -   sbs.refresh();
    -   System.out.println("Status: " + sbs.getStatus());
    -   System.out.println("Number of jobs: " + sbs.getCurrentActiveJobs());
    -   System.out.println("Maximum jobs: " + sbs.getMaximumActiveJobs());
    -   SystemPool[] pools = sbs.getPools();
    -   System.out.print("Pools: ");
    -   if (pools == null) System.out.println("null");
    -   else for (int i=0; i
    - **/
    -public class Subsystem
    -{
    -  static final long serialVersionUID = 4L;
    -
    -  private static final boolean DEBUG = false;
    -  private static final String NO_MESSAGES_RETURNED = "No messages returned from failed command.";
    -  private static final String REFRESH_METHOD_NOT_YET_CALLED = "The refresh() method has not yet been called.";
    -
    -  /**
    -   Value for the maximumActiveJobs property, indicating "no maximum".
    -   **/
    -  public static final int NO_MAX = -1;
    -
    -  /**
    -   Value for the timeLimit parameter of the end() methods, indicating "no time limit".
    -   **/
    -  public static final int NO_TIME_LIMIT = -1;
    -
    -
    -  private AS400 system_;
    -  private String path_;
    -
    -  private String name_;
    -  private String library_;
    -  private String extendedStatus_;
    -  private int maxActiveJobs_;
    -  private int currentActiveJobs_;
    -  private String monitorJobName_;
    -  private String monitorJobUser_;
    -  private String monitorJobNumber_;
    -  private String descriptionText_;
    -
    -  private String dspFileName_;
    -  private String dspFileLibrary_;
    -  private String langLibrary_;
    -  private SystemPool[] pools_;  // Exactly 10 elements.  Null-valued elements signify an empty (unassigned) slot in the pool sequence for the subsystem.
    -
    -  private transient ObjectDescription objectDescription_;
    -
    -  private transient boolean refreshed_;
    -
    -  /**
    -   Constructs a Subsystem object.
    -   
    Note: Does not create a subsystem on the system. - @param system The system. - @param library The name of the library where the subsystem resides. - @param name The simple name of the subsystem. - @see #create() - **/ - public Subsystem(AS400 system, String library, String name) - { - if (system == null) throw new NullPointerException("system"); - if (library == null) throw new NullPointerException("library"); - if (name == null) throw new NullPointerException("name"); - - system_ = system; - path_ = QSYSObjectPathName.toPath(library, name, "SBSD"); - library_ = library; - name_ = name; - } - - /** - Constructs a Subsystem object. -
    Note: Does not create a subsystem on the system. - @param system The system. - @param path The qualified path. For example, "/QSYS.LIB/MYSUBSYS.SBSD". - @see #create() - **/ - public Subsystem(AS400 system, String path) - { - if (system == null) throw new NullPointerException("system"); - if (path == null) throw new NullPointerException("path"); - - QSYSObjectPathName qsys = new QSYSObjectPathName(path); - if (!qsys.getObjectType().equalsIgnoreCase("SBSD")) - { - throw new ExtendedIllegalArgumentException("path", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - system_ = system; - path_ = path; - library_ = qsys.getLibraryName(); - name_ = qsys.getObjectName(); - } - - - - /** - Adds a shared system pool to the list of storage pools defined for the subsystem. - Current pool definitions, other than the one specified, remain unchanged. - @param sequenceNumber The number of the pool, within the pool list for the subsystem. Valid values are 1-10. - @param poolName The name of a shared system storage pool. Valid values include: *BASE, *NOSTG, *INTERACT, *SPOOL, and *SHRPOOLnn, where nn is an integer from 1 to 60. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void assignPool(int sequenceNumber, String poolName) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (poolName == null) throw new NullPointerException("poolName"); - if (sequenceNumber<1 || sequenceNumber>10) { - throw new ExtendedIllegalArgumentException("sequenceNumber", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - CommandCall cmd = new CommandCall(system_, "QSYS/CHGSBSD SBSD("+library_+"/"+name_+") POOLS(("+sequenceNumber+" "+poolName+"))"); // not a threadsafe API - if (DEBUG) System.out.println("Command string: " + cmd.getCommand()); - // Note: Pool size must be at least 256 (meaning 256 kilobytes). - if (!cmd.run()) - { - AS400Message[] msgs = cmd.getMessageList(); - if (msgs.length > 0) { - throw new AS400Exception(msgs); - } - else { - Trace.log(Trace.ERROR, NO_MESSAGES_RETURNED); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - } - - - /** - Defines a private storage pool and adds it to the list of storage pools defined for the subsystem. - Current pool definitions, other than the one specified, remain unchanged. - @param sequenceNumber The number of the pool, within the pool list for the subsystem. Valid values are 1-10. - @param size The size of the storage pool, in kilobytes. Must be at least 256 (meaning 256 kilobytes). - @param activityLevel The activity level of the pool. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void assignPool(int sequenceNumber, int size, int activityLevel) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (sequenceNumber<1 || sequenceNumber>10) { - throw new ExtendedIllegalArgumentException("sequenceNumber", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - CommandCall cmd = new CommandCall(system_, "QSYS/CHGSBSD SBSD("+library_+"/"+name_+") POOLS(("+sequenceNumber+" "+size+" "+activityLevel+"))"); // not a threadsafe API - if (DEBUG) System.out.println("Command string: " + cmd.getCommand()); - // Note: Pool size must be at least 256 (meaning 256 kilobytes). - if (!cmd.run()) - { - AS400Message[] msgs = cmd.getMessageList(); - if (msgs.length > 0) { - throw new AS400Exception(msgs); - } - else { - Trace.log(Trace.ERROR, NO_MESSAGES_RETURNED); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - } - - /** - Sets the subsystem description text. The default is "". - @param text The subsystem description text. To clear the description, specify "". - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void changeDescriptionText(String text) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (text == null) throw new NullPointerException("text"); - - if (text.length() == 0) text = "*BLANK"; - CommandCall cmd = new CommandCall(system_, "QSYS/CHGSBSD SBSD("+library_+"/"+name_+") TEXT('"+text+"')"); // not a threadsafe API - if (!cmd.run()) - { - AS400Message[] msgs = cmd.getMessageList(); - if (msgs.length > 0) { - throw new AS400Exception(msgs); - } - else { - Trace.log(Trace.ERROR, NO_MESSAGES_RETURNED); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - } - - - /** - Specifies the signon display file that is used when showing signon displays at work stations allocated to the subsystem. By default, QSYS/QDSIGNON (path /QSYS.LIB/QDSIGNON.FILE) is used. - @param path The fully qualified pathname of the signon display file. See {@link com.ibm.as400.access.QSYSObjectPathName#toPath(String,String,String) QSYSObjectPathName.toString()} - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void changeDisplayFilePath(String path) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (path == null) throw new NullPointerException("path"); - - QSYSObjectPathName qpath = new QSYSObjectPathName(path); - - CommandCall cmd = new CommandCall(system_, "QSYS/CHGSBSD SBSD("+library_+"/"+name_+") SGNDSPF("+qpath.getLibraryName()+"/"+qpath.getObjectName()+")"); // not a threadsafe API - if (!cmd.run()) - { - AS400Message[] msgs = cmd.getMessageList(); - if (msgs.length > 0) { - throw new AS400Exception(msgs); - } - else { - Trace.log(Trace.ERROR, NO_MESSAGES_RETURNED); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - } - - /** - Specifies a library to enter ahead of other libraries in the system portion of the library list. This method allows you to use a secondary language library. - @param library The name of the library. Specify "" or "*NONE" to remove the current secondary language library from the system library list. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void changeLanguageLibrary(String library) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (library == null) throw new NullPointerException("library"); - - if (library.trim().length() == 0) library = "*NONE"; - - CommandCall cmd = new CommandCall(system_, "QSYS/CHGSBSD SBSD("+library_+"/"+name_+") SYSLIBLE("+library+")"); // not a threadsafe API - - if (!cmd.run()) - { - AS400Message[] msgs = cmd.getMessageList(); - if (msgs.length > 0) { - throw new AS400Exception(msgs); - } - else { - Trace.log(Trace.ERROR, NO_MESSAGES_RETURNED); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - } - - - /** - Sets the maximum number of active jobs that can run or use resources within the subsystem at one time. - @param maxJobs The maximum number of active jobs. Valid values are 0-1000. Special value {@link #NO_MAX NO_MAX} is the default, and indicates no maximum. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void changeMaximumActiveJobs(int maxJobs) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - String max = (maxJobs == NO_MAX ? "*NOMAX" : Integer.toString(maxJobs)); - CommandCall cmd = new CommandCall(system_, "QSYS/CHGSBSD SBSD("+library_+"/"+name_+") MAXJOBS("+max+")"); // not a threadsafe API - if (!cmd.run()) - { - AS400Message[] msgs = cmd.getMessageList(); - if (msgs.length > 0) { - throw new AS400Exception(msgs); - } - else { - Trace.log(Trace.ERROR, NO_MESSAGES_RETURNED); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - } - - /** - Creates the subsystem on the system. -
    More precisely, this method creates a subsystem description on the system. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @exception ObjectAlreadyExistsException If the object already exists on the system. - **/ - public void create() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, ObjectAlreadyExistsException - { - create("*LIBCRTAUT"); - } - - /** - Creates the subsystem on the system. -
    More precisely, this method creates a subsystem description on the system. - @param authority The authority to give to users who do not have specific authority for the object, who are not on an authorization list, and whose group profile or supplemental group profiles do not have specific authority for the object. The default is *LIBCRTAUT. The "base system pool" (*BASE) is used. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @exception ObjectAlreadyExistsException If the object already exists on the system. - **/ - public void create(String authority) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, ObjectAlreadyExistsException - { - if (authority == null) throw new NullPointerException("authority"); - - // Note: The AUT parameter is the only parameter unique to CRTSBSD, and not available with CHGSBSD. - if (exists()) { - throw new ObjectAlreadyExistsException(path_, ObjectAlreadyExistsException.OBJECT_ALREADY_EXISTS); - } - - String cmdString = "QSYS/CRTSBSD SBSD("+library_+"/"+name_+") AUT(" + authority + ") POOLS((1 *BASE))"; // not a threadsafe API - - CommandCall cmd = new CommandCall(system_, cmdString); - if (!cmd.run()) { - throw new AS400Exception(cmd.getMessageList()); - } - } - - - /** - Deletes the subsystem from the system. -
    More precisely, this method deletes a subsystem description on the system. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - **/ - public void delete() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - CommandCall cmd = new CommandCall(system_, "QSYS/DLTSBSD SBSD("+library_+"/"+name_+")"); // not a threadsafe API - if (!cmd.run()) - { - AS400Message[] msgs = cmd.getMessageList(); - if (msgs.length > 0) { - if (msgs[0].getID() != null && - !msgs[0].getID().equals("CPF2105") && // object not found - !msgs[0].getID().equals("CPF2110")) // library not found - { - throw new AS400Exception(msgs); - } - } - else { - Trace.log(Trace.ERROR, NO_MESSAGES_RETURNED); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - } - - /** - Ends the subsystem on the system, in a controlled manner. - This allows the programs that are running in the subsystem, to perform cleanup (end of job processing). When a job being ended has a signal handling procedure for the asynchronous signal SIGTERM, the SIGTERM signal is generated for that job. The application has timeLimit seconds to complete cleanup before the job is ended. - @param timeLimit The amount of time (in seconds) that is allowed to complete the controlled subsystem end operation. If this amount of time is exceeded and the end operation is not complete, any jobs still being processed in the subsystem are ended immediately. Special value {@link #NO_TIME_LIMIT NO_TIME_LIMIT} indicates no time limit. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void end(int timeLimit) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Possible future enhancements (if requested): - // Support setting additional ENDSBS parameters: - // ENDSBSOPT (end subsystem option), and BCHTIMLMT (batch time limit). - end(system_, name_, false, timeLimit); - } - - /** - Ends all active subsystems on the system, in a controlled manner. - @param system The system. - @param timeLimit The amount of time (in seconds) that is allowed to complete the controlled subsystem end operation. If this amount of time is exceeded and the end operation is not complete, any jobs still being processed in the subsystem are ended immediately. Special value {@link #NO_TIME_LIMIT NO_TIME_LIMIT} indicates no time limit. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - **/ - public static void endAllSubsystems(AS400 system, int timeLimit) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (system == null) throw new NullPointerException("system"); - end(system, "*ALL", false, timeLimit); - } - - /** - Ends all active subsystems on the system, immediately. - @param system The system. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - **/ - public static void endAllSubsystemsImmediately(AS400 system) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (system == null) throw new NullPointerException("system"); - end(system, "*ALL", true, NO_TIME_LIMIT); - } - - /** - Ends the subsystem on the system, immediately. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void endImmediately() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - end(system_, name_, true, NO_TIME_LIMIT); - } - - - /** - Determines whether this Subsystem object is equal to another object. - @return true if the two instances are equal - **/ - public boolean equals(Object obj) - { - - if (Trace.isTraceOn() && !refreshed_) Trace.log(Trace.WARNING, REFRESH_METHOD_NOT_YET_CALLED); - if (obj == null) return false; - try - { - Subsystem other = (Subsystem)obj; - - if (!system_.equals(other.getSystem())) return false; - if (!library_.equals(other.getLibrary())) return false; - if (!name_.equals(other.getName())) return false; - else return true; - } - catch (Throwable e) { - return false; - } - } - - /** - Returns a hash code value for the object. - @return A hash code value for this object. - **/ - public int hashCode() - { - // We must conform to the invariant that equal objects must have equal hashcodes. - return (system_.hashCode() + library_.hashCode() + name_.hashCode()); - } - - /** - Determines if the subsystem currently exists on the system. -
    More precisely, this method reports if the subsystem description exists on the system. - @return true if the subsystem exists; false if the subsystem does not exist. - @exception AS400Exception If the program call returns error messages. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system API (that queries subsystem description information) is missing. - **/ - public boolean exists() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (objectDescription_ == null) { objectDescription_ = getObjDesc(); } - return objectDescription_.exists(); - } - - /** - Returns the number of jobs currently active in the subsystem. - @return The number of currently active jobs. 0 if refresh() has not been called, or if the subsystem status is *INACTIVE. - **/ - public int getCurrentActiveJobs() - { - if (Trace.isTraceOn() && !refreshed_) Trace.log(Trace.WARNING, REFRESH_METHOD_NOT_YET_CALLED); - - return currentActiveJobs_; - } - - /** - Returns the subsystem description text. - @return The subsystem description text. null if refresh() has not been called. "" if description is blank. - **/ - public String getDescriptionText() - { - if (Trace.isTraceOn() && !refreshed_) Trace.log(Trace.WARNING, REFRESH_METHOD_NOT_YET_CALLED); - - return descriptionText_; - } - - /** - Returns the path of the signon display file that is used when showing signon displays at work stations allocated to the subsystem. By default, QSYS/QDSIGNON (path /QSYS.LIB/QDSIGNON.FILE) is used. - @return The path of the signon display file. null if refresh() has not been called. - **/ - public String getDisplayFilePath() - { - if (Trace.isTraceOn() && !refreshed_) Trace.log(Trace.WARNING, REFRESH_METHOD_NOT_YET_CALLED); - - if (dspFileLibrary_ == null) return null; - else return QSYSObjectPathName.toPath(dspFileLibrary_, dspFileName_, "FILE"); - } - - /** - Returns the library that is entered ahead of other libraries in the system portion of the library list. This library typically specifies a secondary language library. - @return The name of the secondary language library. null if refresh() has not been called. "*NONE" if no secondary language library is set. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getLanguageLibrary() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.isTraceOn() && !refreshed_) Trace.log(Trace.WARNING, REFRESH_METHOD_NOT_YET_CALLED); - - return langLibrary_; - } - - /** - Returns the name of the library where the subsystem resides on the system. - @return The name of the library. - **/ - public String getLibrary() - { - return library_; - } - - /** - Returns the maximum number of active jobs that can run or use resources within the subsystem at one time. - @return The maximum number of active jobs. 0 if refresh() has not been called. {@link #NO_MAX NO_MAX} if no maximum. - **/ - public int getMaximumActiveJobs() - { - if (Trace.isTraceOn() && !refreshed_) Trace.log(Trace.WARNING, REFRESH_METHOD_NOT_YET_CALLED); - - return maxActiveJobs_; - } - - /** - Returns the subsystem monitor job. - @return The subsystem monitor job. null if refresh() has not been called, or if subsystem status is *INACTIVE. - **/ - public Job getMonitorJob() - { - if (Trace.isTraceOn() && !refreshed_) Trace.log(Trace.WARNING, REFRESH_METHOD_NOT_YET_CALLED); - - if (monitorJobName_ == null || monitorJobUser_ == null || - monitorJobNumber_ == null || monitorJobName_.length() == 0) { - return null; - } - - return new Job(system_, monitorJobName_, monitorJobUser_, monitorJobNumber_); - } - - /** - Returns the subsystem name. - @return The subsystem name. - **/ - public String getName() - { - return name_; - } - - /** - Returns an ObjectDescription instance representing the subsystem. - @return An ObjectDescription for the subsystem. - **/ - public ObjectDescription getObjectDescription() - { - if (objectDescription_ == null) { objectDescription_ = getObjDesc(); } - return objectDescription_; - } - - /** - Returns the fully-qualifed IFS pathname of the subsystem. - For example: "/QSYS.LIB/MYSUBSYS.SBSD". - @return The path of the subsystem. - **/ - public String getPath() - { - return path_; - } - - /** - Returns the storage pool defined at the specified position for the subsystem. - @param sequenceNumber The number of the pool, within the pool list for the subsystem. Valid values are 1-10. - @return The pool used by the subsystem, at the specified sequence position. null if refresh() has not been called, or if no pool has been assigned at that position. - **/ - public SystemPool getPool(int sequenceNumber) - { - if (Trace.isTraceOn() && !refreshed_) Trace.log(Trace.WARNING, REFRESH_METHOD_NOT_YET_CALLED); - if (sequenceNumber<1 || sequenceNumber>10) { - throw new ExtendedIllegalArgumentException("sequenceNumber", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - return pools_[sequenceNumber-1]; - } - - /** - Returns the list of storage pools that are defined for the subsystem. That is, the list of storage pool definitions that are in the subsystem description. - The element at offset 0 represents subsystem pool #1, element at offset 1 represents pool #2, and so on. - In positions where no pool assignment has been made, the array element will be null. - @return The pools that are used by the subsystem. null if refresh() has not been called. Otherwise, a 10-element array is returned. - **/ - public SystemPool[] getPools() - { - if (Trace.isTraceOn() && !refreshed_) Trace.log(Trace.WARNING, REFRESH_METHOD_NOT_YET_CALLED); - - return pools_; - } - - /** - Returns the extended status of the subsystem. - Possible values are: *ACTIVE, *ENDING, *INACTIVE, *RESTRICTED, and *STARTING. - @return The subsystem status. null if refresh() has not been called. - **/ - public String getStatus() - { - if (Trace.isTraceOn() && !refreshed_) Trace.log(Trace.WARNING, REFRESH_METHOD_NOT_YET_CALLED); - - return extendedStatus_; - } - - /** - Returns the system where the subsystem resides. - @return The system. - **/ - public AS400 getSystem() - { - return system_; - } - - - /** - Lists all subsystems on the system. - @return A list of all defined subsystems, both active and inactive. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @exception RequestNotSupportedException If the requested function is not supported because the system is not at the correct level. - **/ - public static Subsystem[] listAllSubsystems(AS400 system) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, - RequestNotSupportedException - { - Vector sbsList = new Vector(20); - ObjectList objList = new ObjectList(system, "*ALL", "*ALL", "*SBSD"); - Enumeration list = objList.getObjects(); - while (list.hasMoreElements()) { - ObjectDescription objDesc = (ObjectDescription)list.nextElement(); - Subsystem sbs = new Subsystem(system, objDesc.getPath()); - sbsList.addElement(sbs); - } - Subsystem[] sbsArray = new Subsystem[sbsList.size()]; - sbsList.toArray(sbsArray); - return sbsArray; - } - - - /** - Refreshes the attributes of this Subsystem object, to reflect the current state of the subsystem on the system. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public synchronized void refresh() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - final int ccsid = system_.getCcsid(); - final ConvTable conv = ConvTable.getTable(ccsid, null); - - try - { - // Call the API, specifying format SBSI0200. This will retrieve most of the attributes. - - ProgramParameter[] parms = new ProgramParameter[5]; - int outputSize = 200; - parms[0] = new ProgramParameter(outputSize); - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(outputSize)); - parms[2] = new ProgramParameter(conv.stringToByteArray("SBSI0200")); - QSYSObjectPathName qsys = new QSYSObjectPathName(path_); - AS400Text text10 = new AS400Text(10, ccsid); - byte[] qualifiedSubsystemName = new byte[20]; - text10.toBytes(qsys.getObjectName(), qualifiedSubsystemName, 0); - text10.toBytes(qsys.getLibraryName(), qualifiedSubsystemName, 10); - parms[3] = new ProgramParameter(qualifiedSubsystemName); - parms[4] = new ProgramParameter(new byte[4]); - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QWDRSBSD.PGM", parms); - pc.suggestThreadsafe(); - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - byte[] data = parms[0].getOutputData(); - int bytesReturned = BinaryConverter.byteArrayToInt(data, 0); - int bytesAvailable = BinaryConverter.byteArrayToInt(data, 4); - while (bytesReturned < bytesAvailable) - { - outputSize += bytesAvailable*2; - parms[0].setOutputDataLength(outputSize); - parms[1].setInputData(BinaryConverter.intToByteArray(outputSize)); - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - data = parms[0].getOutputData(); - bytesReturned = BinaryConverter.byteArrayToInt(data, 0); - bytesAvailable = BinaryConverter.byteArrayToInt(data, 4); - } - int offset = BinaryConverter.byteArrayToInt(data, 8); - //int numEntries = BinaryConverter.byteArrayToInt(data, 12); // This had better be 1. - //int entrySize = BinaryConverter.byteArrayToInt(data, 16); - name_ = conv.byteArrayToString(data, offset, 10).trim(); - library_ = conv.byteArrayToString(data, offset+10, 10).trim(); - extendedStatus_ = conv.byteArrayToString(data, offset+20, 12).trim(); - maxActiveJobs_ = BinaryConverter.byteArrayToInt(data, offset+32); - currentActiveJobs_ = BinaryConverter.byteArrayToInt(data, offset+36); - monitorJobName_ = conv.byteArrayToString(data, offset+40, 10).trim(); - monitorJobUser_ = conv.byteArrayToString(data, offset+50, 10).trim(); - monitorJobNumber_ = conv.byteArrayToString(data, offset+60, 6).trim(); - descriptionText_ = conv.byteArrayToString(data, offset+66, 50).trim(); - - - // Call the API again, specifying format SBSI0100. This will retrieve some additional attributes. - - outputSize = 500; - parms[0] = new ProgramParameter(outputSize); - parms[1] = new ProgramParameter(BinaryConverter.intToByteArray(outputSize)); - parms[2] = new ProgramParameter(conv.stringToByteArray("SBSI0100")); - - pc.setParameterList(parms); - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - data = parms[0].getOutputData(); - bytesReturned = BinaryConverter.byteArrayToInt(data, 0); - bytesAvailable = BinaryConverter.byteArrayToInt(data, 4); - while (bytesReturned < bytesAvailable) - { - outputSize += bytesAvailable*2; - parms[0].setOutputDataLength(outputSize); - parms[1].setInputData(BinaryConverter.intToByteArray(outputSize)); - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - data = parms[0].getOutputData(); - bytesReturned = BinaryConverter.byteArrayToInt(data, 0); - bytesAvailable = BinaryConverter.byteArrayToInt(data, 4); - } - - dspFileName_ = conv.byteArrayToString(data, 38, 10).trim(); - dspFileLibrary_ = conv.byteArrayToString(data, 48, 10).trim(); - langLibrary_ = conv.byteArrayToString(data, 58, 10).trim(); - int numPools = BinaryConverter.byteArrayToInt(data, 76); - pools_ = new SystemPool[10]; - if (DEBUG) System.out.println("SubSystem.refresh(): Number of pools reported: " + numPools); - - int poolID = 0; - for (int i=0; i 10) System.out.println("ERROR: Unexpected poolID value: " + poolID); // This should never happen. - } - String poolName = conv.byteArrayToString(data, offsetToEntry+4, 10).trim(); - if (DEBUG) System.out.println("Subsystem.refresh(): Returned poolName is: " + poolName); - int size = BinaryConverter.byteArrayToInt(data, offsetToEntry+20); - int activityLevel = BinaryConverter.byteArrayToInt(data, offsetToEntry+24); - SystemPool pool = null; - if (poolName.equals("*USERPOOL")) { // it's a private pool - pool = new SystemPool(this, poolID, size, activityLevel); - } - else { // it's a shared pool - pool = new SystemPool(system_, poolName); - } - pool.setCaching(true); - pools_[poolID-1] = pool; - } - for (int i=poolID; i<10; i++) { pools_[i] = null; } // fill remaining slots with nulls - - refreshed_ = true; - } - catch (PropertyVetoException pve) { // this will never happen - Trace.log(Trace.ERROR,pve); - } - } - - - /** - Removes a storage pool from the list of pools defined for the subsystem. - You should first end the subsystem before removing a pool. - @param sequenceNumber The number of the pool, within the pool list for the subsystem. Valid values are 1-10. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void removePool(int sequenceNumber) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (sequenceNumber<1 || sequenceNumber>10) { - throw new ExtendedIllegalArgumentException("sequenceNumber", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - CommandCall cmd = new CommandCall(system_, "QSYS/CHGSBSD SBSD("+library_+"/"+name_+") POOLS(("+sequenceNumber+" *RMV))"); // not a threadsafe API - if (DEBUG) System.out.println("Command string: " + cmd.getCommand()); - if (!cmd.run()) - { - AS400Message[] msgs = cmd.getMessageList(); - if (msgs.length > 0) { - throw new AS400Exception(msgs); - } - else { - Trace.log(Trace.ERROR, NO_MESSAGES_RETURNED); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - } - - /** - Starts the subsystem on the system. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void start() - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - CommandCall cmd = new CommandCall(system_, "QSYS/STRSBS SBSD("+library_+"/"+name_+")"); // not a threadsafe API - if (!cmd.run()) - { - AS400Message[] msgs = cmd.getMessageList(); - if (msgs.length > 0) { - if (msgs[0].getID() != null && - !msgs[0].getID().equals("CPF1010")) // subsystem already active - { - throw new AS400Exception(msgs); - } - } - else { - Trace.log(Trace.ERROR, NO_MESSAGES_RETURNED); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - } - - - - // Private utility methods. - - - - /** - Ends the subsystem on the system. - @exception AS400Exception If the system returns an error message. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - **/ - private static void end(AS400 system, String subsystemName, boolean immediate, int timeLimit) - throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - String endOption = (immediate ? "*IMMED" : "*CNTRLD"); - StringBuffer cmdBuf = new StringBuffer("QSYS/ENDSBS SBS("+subsystemName+") OPTION("+endOption+")"); // not a threadsafe API - if (!immediate) cmdBuf.append(" DELAY("+timeLimit+")"); - CommandCall cmd = new CommandCall(system, cmdBuf.toString()); - if (!cmd.run()) - { - AS400Message[] msgs = cmd.getMessageList(); - if (msgs.length > 0) { - if (msgs[0].getID() != null && - !msgs[0].getID().equals("CPF1032") && // system ending *CNTRLD - !msgs[0].getID().equals("CPF1033") && // system ending *IMMED - !msgs[0].getID().equals("CPF1034") && // subsys's ending *CNTRLD - !msgs[0].getID().equals("CPF1035") && // subsys's ending *IMMED - !msgs[0].getID().equals("CPF1036") && // sys powering-down *CNTRLD - !msgs[0].getID().equals("CPF1037") && // sys powering-down *IMMED - !msgs[0].getID().equals("CPF1054") && // subsys not active - !msgs[0].getID().equals("CPF1055") && // subsys ending *CNTRLD - !msgs[0].getID().equals("CPF1056")) // subsys ending *IMMED - { - throw new AS400Exception(msgs); - } - } - else { - Trace.log(Trace.ERROR, NO_MESSAGES_RETURNED); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - } - - - /** - Gets an ObjectDescription object representing the subsystem. - **/ - private ObjectDescription getObjDesc() - { - return new ObjectDescription(system_, library_, name_, "SBSD"); - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/SystemPool.java b/cvsroot/src/com/ibm/as400/access/SystemPool.java deleted file mode 100644 index ce47da202..000000000 --- a/cvsroot/src/com/ibm/as400/access/SystemPool.java +++ /dev/null @@ -1,2478 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemPool.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Hashtable; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.VetoableChangeSupport; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -/** - * Represents a system pool. It provides - * facilities for retrieving and changing system pool information. - * - * Here is a example: - * - *

    - *  try {
    - *      // Creates AS400 object.
    - *      AS400 as400 = new AS400("systemName");
    - *      // Constructs a SystemPool object
    - *      SystemPool systemPool = new SystemPool(as400,"*SPOOL");
    - *      // Gets system pool attributes.
    - *      System.out.println("Paging option : "+systemPool.getPagingOption());
    - *
    - *  } catch (Exception e)
    - *  {
    - *      System.out.println("error : "+e)
    - *  }
    - * 

    - * - **/ -public class SystemPool -{ - private static final boolean DEBUG = false; - - /** - * Indicates that the system should calculate - * a system pool attribute. - * @deprecated - **/ - public static final float CALCULATE = -2; - private static final Float CALCULATE_FLOAT = new Float(-2); - - /** - * Indicates that the system should calculate - * a system pool attribute. - * @deprecated - **/ - public static final int CALCULATE_INT = -2; - - private static final Integer CALCULATE_INTEGER = new Integer(-2); - private static final Integer NO_CHANGE = new Integer(-1); - private static final String DEFAULT = "*DFT"; - - private AS400 system_; - - // The pool's name. In the case of a subsystem (non-shared) pool, this field will contain a number from 1-10. - private String poolName_; - - // The system pool identifier. The number is assigned by the system, and is unique across the system at any given moment. Shared system pools that are not in use by a subsystem, will not have a system pool identifier assigned; in which case this variable will be null. Otherwise, this variable will contain a number from 1-64. - private Integer poolIdentifier_; - - private boolean indicatedSharedPool_; // true if caller indicated it's a shared system pool; false otherwise - - // Attributes that are meaningful only if the pool is a subsystem (non-shared) pool. - private String subsystemLibrary_; - private String subsystemName_; - private int poolSequenceNumber_; // subsystem pool sequence number (within the subsystem) (1-10) - - private transient boolean connected_; - private boolean cacheChanges_ = false; - - private transient PropertyChangeSupport changes_; - private transient VetoableChangeSupport vetos_; - - // This format maps the API getter. - private SystemStatusFormat systemStatusFormat_; - // This format maps the pool information portion of the format. - private PoolInformationFormat poolFormat_; - - // This record holds the data for one system pool -- us. - private Record poolRecord_; - - // This table holds the data to be set on the API. - private transient Hashtable changesTable_; - - /** - * Constructs a SystemPool object. - **/ - public SystemPool() - { - } - - /** - * Constructs a SystemPool object, to represent a shared system pool. - * - * @param system The system. - * @param poolName The name of the shared system pool. - * Valid values are *MACHINE, *BASE, *INTERACT, *SPOOL, and *SHRPOOL1-60. - **/ - public SystemPool(AS400 system, String poolName) - { - if (system == null) - throw new NullPointerException ("system"); - if (poolName == null) - throw new NullPointerException ("poolName"); - if (Trace.isTraceOn() && !isValidNameForSharedPool(poolName)) { - Trace.log(Trace.WARNING, "Invalid name for shared pool: " + poolName); - } - - system_ = system; - poolName_ = poolName.trim(); - indicatedSharedPool_ = true; - } - - /** - * Constructs a SystemPool object, to represent a subsystem (non-shared) pool. - * - * @param subsystem The subsystem that "owns" the pool. - * @param sequenceNumber The pool's sequence number within the subsystem. - * Valid values are 1 through 10. - **/ - public SystemPool(Subsystem subsystem, int sequenceNumber) - { - if (subsystem == null) throw new NullPointerException ("subsystem"); - - if (sequenceNumber < 1 || sequenceNumber > 10) - { - throw new ExtendedIllegalArgumentException("sequenceNumber (" + sequenceNumber + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - system_ = subsystem.getSystem(); - poolName_ = Integer.toString(sequenceNumber); - subsystemLibrary_ = subsystem.getLibrary(); - subsystemName_ = subsystem.getName(); - poolSequenceNumber_ = sequenceNumber; // pool sequence number within the subsystem (1-10) - indicatedSharedPool_ = false; // not a shared system pool - } - - /** - * Constructs a SystemPool object, to represent a subsystem (non-shared) pool. - * - * @param subsystem The subsystem that "owns" the pool. - * @param sequenceNumber The pool's sequence number within the subsystem. - * Valid values are 1 through 10. - * @param size The size of the system pool, in kilobytes. - * @param activityLevel The activity level of the pool. - **/ - public SystemPool(Subsystem subsystem, int sequenceNumber, int size, int activityLevel) - { - this(subsystem, sequenceNumber); - - cacheChanges_ = true; // don't send values to the system yet - try { - set("poolSize", new Integer(size)); - set("activityLevel", new Integer(activityLevel)); - } - catch (Exception e) { // should never happen, no system contact - Trace.log(Trace.ERROR, e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - cacheChanges_ = false; - } - - /** - * Constructs a SystemPool object, to represent a shared system pool. - * - * @param system The system. - * @param poolName The name of the shared system pool. - * Valid values are *MACHINE, *BASE, *INTERACT, *SPOOL, and *SHRPOOL1-60. - * @param poolIdentifier The system pool identifier. - * Valid values are 1 through 64. - * @deprecated Use {@link #SystemPool(AS400,int) SystemPool(system, poolIdentifier)} instead. - **/ - public SystemPool(AS400 system, String poolName, int poolIdentifier) - { - if (system == null) - throw new NullPointerException ("system"); - if (poolName == null) - throw new NullPointerException ("poolName"); - - if (poolIdentifier < 1 || poolIdentifier > 64) - { - throw new ExtendedIllegalArgumentException("poolIdentifier (" + poolIdentifier + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - system_ = system; - poolName_ = poolName.trim(); - poolIdentifier_ = new Integer(poolIdentifier); - indicatedSharedPool_ = true; - - if (Trace.isTraceOn() && !isValidNameForSharedPool(poolName)) { - Trace.log(Trace.WARNING, "Invalid name for shared pool: " + poolName); - } - } - - /** - * Constructs a SystemPool object, to represent a pool identified - * by its unique system pool identifier. - * Either a shared pool or a non-shared pool can be specified. - * - * @param system The system. - * @param poolIdentifier The system pool identifier. - * Valid values are 1 through 64. - **/ - public SystemPool(AS400 system, int poolIdentifier) - { - if (system == null) - throw new NullPointerException ("system"); - - if (poolIdentifier < 1 || poolIdentifier > 64) - { - throw new ExtendedIllegalArgumentException("poolIdentifier (" + poolIdentifier + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - system_ = system; - poolIdentifier_ = new Integer(poolIdentifier); - } - - - /** - * Adds a listener to be notified when the value of any bound property - * changes. - * - * @param listener The listener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - if (changes_ == null) changes_ = new PropertyChangeSupport(this); - changes_.addPropertyChangeListener(listener); - } - - /** - * Adds a listener to be notified when the value of any constrained - * property changes. - * - * @param listener The listener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); - vetos_.addVetoableChangeListener(listener); - } - - - // Converts a Float value to hundredths, and returns it as an Integer. - // Assumes that obj is never null. - private static final Integer convertToHundredths(Object obj) - { - float floatVal = ((Float)obj).floatValue(); - Integer obj1; - - // For some fields, negative values have special meanings. - // It never makes sense to convert a negative value to hundredths. - if (floatVal <= 0) obj1 = new Integer((int)floatVal); - else obj1 = new Integer((int)(floatVal*100)); - - return obj1; - } - - - /** - * Commits any cached system pool information changes to the system. - * If caching is not enabled, this method does nothing. - * @see #isCaching - * @see #refreshCache - * @see #setCaching - * @exception AS400Exception If the system returns an error - * message. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ConnectionDroppedException If the connection is dropped - * unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public synchronized void commitCache() - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - // If there are no changes, don't do anything! - if (changesTable_ == null || changesTable_.isEmpty()) return; - - if (!connected_) connect(); - - int poolIdentifier = 0; - try { - poolIdentifier = getIdentifier(); - } - catch (ObjectDoesNotExistException e) { - // This may indicate that it's a shared pool that's not currently in use by any subsystem. - poolIdentifier = 0; - if (Trace.isTraceOn()) { - Trace.log(Trace.DIAGNOSTIC, "No pool identifier is assigned to pool.", e); - } - } - - String messageLogging_pending = null; // We might need to leave the change uncommitted, if we end up calling CHGSHRPOOL. - - // Note: "Shared" pools that are not currently in use by any subsystem, do not have a system pool identifier assigned, and therefore are beyond the reach of QUSCHGPA. - // QUSCHGPA works only on active pools that have been allocated by system pood ID. - // To modify such pools, we must use CHGSHRPOOL. - - if (poolIdentifier == 0) - { - // We need to use CHGSHRPOOL, since QUSCHGPA requires a unique system pool identifier. - StringBuffer cmdBuf = new StringBuffer("QSYS/CHGSHRPOOL POOL("+poolName_+")"); - Object obj; // attribute value - - obj = changesTable_.get("poolSize"); - if (obj != null) { - cmdBuf.append(" SIZE("+obj.toString()+")"); - } - - obj = changesTable_.get("activityLevel"); - if (obj != null) { - if (obj.equals(CALCULATE_INTEGER)) { // this constant has been deprecated - obj = "*SAME"; - if (Trace.isTraceOn()) { - Trace.log(Trace.WARNING, "Setting activityLevel to SAME."); - } - } - cmdBuf.append(" ACTLVL("+obj.toString()+")"); - } - - obj = changesTable_.get("pagingOption"); - if (obj != null) { - cmdBuf.append(" PAGING("+obj.toString()+")"); - } - - obj = changesTable_.get("priority"); - if (obj != null) { - if (obj.equals(CALCULATE_INTEGER)) { - obj = DEFAULT; - if (Trace.isTraceOn()) { - Trace.log(Trace.WARNING, "Setting priority to DEFAULT."); - } - } - cmdBuf.append(" PTY("+obj.toString()+")"); - } - - obj = changesTable_.get("minimumPoolSize"); - if (obj != null) { - if (obj.equals(CALCULATE_FLOAT)) { // this constant has been deprecated - obj = DEFAULT; - if (Trace.isTraceOn()) { - Trace.log(Trace.WARNING, "Setting minimumPoolSize to DEFAULT."); - } - } - cmdBuf.append(" MINPCT("+obj.toString()+")"); - } - - obj = changesTable_.get("maximumPoolSize"); - if (obj != null) { - if (obj.equals(CALCULATE_FLOAT)) { - obj = DEFAULT; - if (Trace.isTraceOn()) { - Trace.log(Trace.WARNING, "Setting maximumPoolSize to DEFAULT."); - } - } - cmdBuf.append(" MAXPCT("+obj.toString()+")"); - } - - obj = changesTable_.get("minimumFaults"); - if (obj != null) { - if (obj.equals(CALCULATE_FLOAT)) { - obj = DEFAULT; - if (Trace.isTraceOn()) { - Trace.log(Trace.WARNING, "Setting minimumFaults to DEFAULT."); - } - } - cmdBuf.append(" MINFAULT("+obj.toString()+")"); - } - - obj = changesTable_.get("perThreadFaults"); - if (obj != null) { - if (obj.equals(CALCULATE_FLOAT)) { - obj = DEFAULT; - if (Trace.isTraceOn()) { - Trace.log(Trace.WARNING, "Setting perThreadFaults to DEFAULT."); - } - } - cmdBuf.append(" JOBFAULT("+obj.toString()+")"); - } - - obj = changesTable_.get("maximumFaults"); - if (obj != null) { - if (obj.equals(CALCULATE_FLOAT)) { - obj = DEFAULT; - if (Trace.isTraceOn()) { - Trace.log(Trace.WARNING, "Setting maximumFaults to DEFAULT."); - } - } - cmdBuf.append(" MAXFAULT("+obj.toString()+")"); - } - - if (DEBUG) System.out.println("Running command: " + cmdBuf.toString()); - CommandCall cmd = new CommandCall(system_, cmdBuf.toString()); - // CHGSHRPOOL is not thread safe. - cmd.suggestThreadsafe(false); - if (!cmd.run()) { - throw new AS400Exception(cmd.getMessageList()); - } - - // See if we were asked to change the message logging attribute. - // The CL command doesn't have a "message logging" parameter. - messageLogging_pending = (String)changesTable_.get("messageLogging"); - - // Future enhancement: The CL command also has a TEXT() parameter, which can be specified to change the pool's text description. - } - - else // The pool identifier is known, therefore we can use the QUSCHGPA API. - { - QSYSObjectPathName prgName = new QSYSObjectPathName("QSYS","QUSCHGPA","PGM"); - AS400Bin4 bin4 = new AS400Bin4(); - AS400Text text; - - ProgramParameter[] parmList = new ProgramParameter[12]; - - parmList[0] = new ProgramParameter(bin4.toBytes(getIdentifier())); - - Object obj = changesTable_.get("poolSize"); - if (obj == null) obj = NO_CHANGE; - parmList[1] = new ProgramParameter(bin4.toBytes(obj)); - - obj = changesTable_.get("activityLevel"); - if (obj == null) obj = NO_CHANGE; - parmList[2] = new ProgramParameter(bin4.toBytes(obj)); - - obj = changesTable_.get("messageLogging"); - if (obj == null) obj = "Y"; // no change - AS400Text text1 = new AS400Text(1, system_.getCcsid(), system_); - parmList[3] = new ProgramParameter(text1.toBytes(obj)); - - byte[] errorInfo = new byte[32]; - parmList[4] = new ProgramParameter(errorInfo, 0); // don't care about error info - - obj = changesTable_.get("pagingOption"); - if (obj == null) obj = "*SAME"; // no change - AS400Text text10 = new AS400Text(10, system_.getCcsid(), system_); - parmList[5] = new ProgramParameter(text10.toBytes(obj)); - - obj = changesTable_.get("priority"); - if (obj == null) obj = NO_CHANGE; - parmList[6] = new ProgramParameter(bin4.toBytes(obj)); - - obj = changesTable_.get("minimumPoolSize"); - if (obj == null) obj = NO_CHANGE; - else if (obj.equals(CALCULATE_FLOAT)) obj = CALCULATE_INTEGER; - else obj = convertToHundredths(obj); // the API expect units of hundredths - parmList[7] = new ProgramParameter(bin4.toBytes(obj)); - - obj = changesTable_.get("maximumPoolSize"); - if (obj == null) obj = NO_CHANGE; - else if (obj.equals(CALCULATE_FLOAT)) obj = CALCULATE_INTEGER; - else obj = convertToHundredths(obj); - parmList[8] = new ProgramParameter(bin4.toBytes(obj)); - - obj = changesTable_.get("minimumFaults"); - if (obj == null) obj = NO_CHANGE; - else if (obj.equals(CALCULATE_FLOAT)) obj = CALCULATE_INTEGER; - else obj = convertToHundredths(obj); - parmList[9] = new ProgramParameter(bin4.toBytes(obj)); - - obj = changesTable_.get("perThreadFaults"); - if (obj == null) obj = NO_CHANGE; - else if (obj.equals(CALCULATE_FLOAT)) obj = CALCULATE_INTEGER; - else obj = convertToHundredths(obj); - parmList[10] = new ProgramParameter(bin4.toBytes(obj)); - - obj = changesTable_.get("maximumFaults"); - if (obj == null) obj = NO_CHANGE; - else if (obj.equals(CALCULATE_FLOAT)) obj = CALCULATE_INTEGER; - else obj = convertToHundredths(obj); - parmList[11] = new ProgramParameter(bin4.toBytes(obj)); - - ProgramCall pgm = new ProgramCall(system_); - try - { - pgm.setProgram(prgName.getPath(), parmList); - } - catch(PropertyVetoException pve) {} // Quiet the compiler - - if (Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "Setting system pool information."); - } - if (pgm.run() != true) - { - AS400Message[] msgList = pgm.getMessageList(); - if (Trace.isTraceOn()) - { - Trace.log(Trace.ERROR, "Error setting system pool information:"); - for (int i=0; itrue if the two instances are equal. - **/ - public boolean equals(Object obj) - { - if (obj == null) return false; - try - { - SystemPool other = (SystemPool)obj; - - if (system_ == null) { - if (other.getSystem() != null) return false; - } - else if (!system_.equals(other.getSystem())) return false; - - if (poolName_ == null) { - if (other.getName() != null) return false; - } - else if (!poolName_.equals(other.getName())) return false; - - if (subsystemLibrary_ == null) { - if (other.getSubsystemLibrary() != null) return false; - } - else if (!subsystemLibrary_.equals(other.getSubsystemLibrary())) return false; - - if (subsystemName_ == null) { - if (other.getSubsystemName() != null) return false; - } - else if (!subsystemName_.equals(other.getSubsystemName())) return false; - - // If both objects have non-zero identifiers, they must match. - if (poolIdentifier_ != null && - poolIdentifier_.intValue() != 0 && - other.getIdentifier() != 0) - { - if (poolIdentifier_.intValue() != other.getIdentifier()) return false; - } - - return true; - } - catch (Throwable e) { - return false; - } - } - - /** - Returns a hash code value for the object. - @return A hash code value for this object. - **/ - public int hashCode() - { - // We must conform to the invariant that equal objects must have equal hashcodes. - int hash = 0; - - if (system_ != null) hash += system_.hashCode(); - if (poolName_ != null) hash += poolName_.hashCode(); - if (subsystemLibrary_ != null) hash += subsystemLibrary_.hashCode(); - if (subsystemName_ != null) hash += subsystemName_.hashCode(); - if (poolIdentifier_ != null) hash += poolIdentifier_.hashCode(); - - return hash; - } - - - /** - * Gets the value for the specified field out of the - * appropriate record in the format cache. If the particular - * format has not been loaded yet, it is loaded from the 400. - **/ - private Object get(String field) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - // Retrieve the info out of our own record - Object obj = null; - if (!cacheChanges_) { - refreshCache(); // Load the info if we're not caching. - } - else { - if (changesTable_ != null) obj = changesTable_.get(field); - } - - if (obj == null) - { - retrieveInformation(); // this will do the connect() if needed - obj = poolRecord_.getField(field); - } - return obj; - } - - - /** - * Returns the rate, in transitions per minute, of transitions - * of threads from an active condition to an ineligible condition. - * - * @return The rate. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public float getActiveToIneligible() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - return ((Integer)get("activeToIneligible")).floatValue()/(float)10.0; - } - - /** - * Returns the rate, in transitions per minute, of transitions - * of threads from an active condition to a waiting condition. - * - * @return The rate. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public float getActiveToWait() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - return ((Integer)get("activeToWait")).floatValue()/(float)10.0; - } - - /** - * Returns the rate, shown in page faults per second, of - * database page faults against pages containing either database data - * or access paths. A page fault is a program notification that occurs - * when a page that is marked as not in main storage is referred to be - * an active program. An access path is the means by which the system - * provides a logical organization to the data in a database file. - * - * @return The rate. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public float getDatabaseFaults() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - return ((Integer)get("databaseFaults")).floatValue()/(float)10.0; - } - - /** - * Returns the rate, in pages per second, at which database - * pages are brought into the storage pool. - * - * @return The rate. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public float getDatabasePages() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - return ((Integer)get("databasePages")).floatValue()/(float)10.0; - } - - /** - * Returns the description of the system pool. - * - * @return The description of the system pool. - **/ - public String getDescription() - { - if(poolName_ == null) return ""; - if(poolName_.equals("*MACHINE")) - return ResourceBundleLoader.getText("SYSTEM_POOL_MACHINE"); - else if(poolName_.equals("*BASE")) - return ResourceBundleLoader.getText("SYSTEM_POOL_BASE"); - else if(poolName_.equals("*INTERACT")) - return ResourceBundleLoader.getText("SYSTEM_POOL_INTERACT"); - else if(poolName_.equals("*SPOOL")) - return ResourceBundleLoader.getText("SYSTEM_POOL_SPOOL"); - else - return ResourceBundleLoader.getText("SYSTEM_POOL_OTHER"); - } - - /** - * Returns the maximum number of threads that can be active in the pool - * at any one time. - * - * @return The maximum number of threads. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - * @deprecated Use getActivityLevel() instead. - **/ - public int getMaximumActiveThreads() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - return getActivityLevel(); - } - - - /** - * Returns the activity level for the pool. This is the maximum number of - * threads that can be active in the pool at any one time. - * - * @return The pool activity level. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public int getActivityLevel() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - return ((Integer)get("activityLevel")).intValue(); - } - - /** - * Returns the rate, in page faults per second, of - * nondatabase page faults against pages other than those designated - * as database pages. - * - * @return The rate. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public float getNonDatabaseFaults() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - return ((Integer)get("nonDatabaseFaults")).floatValue()/(float)10.0; - } - - /** - * Returns the rate, in page per second, at which non-database - * pages are brought into the storage pool. - * - * @return The rate. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public float getNonDatabasePages() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - return ((Integer)get("nonDatabasePages")).floatValue()/(float)10.0; - } - - /** - * Returns the value indicating whether the system will dynamically - * adjust the paging characteristics of the storage pool for optimum - * performance. The following special values may be returned. - * - * *FIXED: The system does not dynamically adjust the paging - * characteristics. - * *CALC: The system dynamically adjusts the paging - * characteristics. - * USRDFN: The system does not dynamically adjust the paging - * characteristics for the storage pool but uses values - * that have been defined through an API. - * - * @return The value indicating whether the system will dynamically adjust - * the paging characteristics of the storage pool for optimum performance. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public String getPagingOption() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - return ((String)get("pagingOption")).trim(); - } - - /** - * Returns the system pool identifier. - * - * @return The system pool identifier. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - * @deprecated Use getIdentifier() instead. - **/ - public int getPoolIdentifier() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - return getIdentifier(); - } - - /** - * Returns the system pool identifier. - * The system assigns a unique identifier (from 1 through 64) to each - * system storage pool that currently has main storage allocated. - * If the pool is inactive, 0 is returned. - * - * @return The system pool identifier. 0 indicates that the pool is inactive. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public int getIdentifier() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - if (poolIdentifier_ == null) { - synchronized(this) { - if (poolIdentifier_ == null) { - boolean oldVal = cacheChanges_; - cacheChanges_ = true; - poolIdentifier_ = (Integer)get("poolIdentifier"); - cacheChanges_ = oldVal; - } - } - } - return (poolIdentifier_ == null ? 0 : poolIdentifier_.intValue()); - } - - /** - * Returns the name of this storage pool. The name may be a number, in - * which case it is a non-shared pool associated with a subsystem. - * The following special values may be returned, in the case of shared pools: - *

    - *

  • *MACHINE The specified pool definition is defined to be the - * machine pool. - *
  • *BASE The specified pool definition is defined to be the base - * system pool, which can be shared with other subsystems. - *
  • *INTERACT The specified pool definition is defined to be shared - * pool used for interactive work. - *
  • *SPOOL The specified pool definition is defined to be the - * shared pool used for spooled writers. - *
  • *SHRPOOL1 - *SHRPOOL60 The specified pool definition is defined - * to be a shared pool. - *

    - * - * @return The pool name. - * @deprecated Use getName() instead. - **/ - public String getPoolName() - { - //return (String)get("poolName"); - return getName(); - } - - /** - * Returns the name of this storage pool. The name may be a number, in - * which case it is a non-shared pool associated with a subsystem. - * The following special values may be returned, in the case of shared pools: - *

    - *

  • *MACHINE The specified pool definition is defined to be the - * machine pool. - *
  • *BASE The specified pool definition is defined to be the base - * system pool, which can be shared with other subsystems. - *
  • *INTERACT The specified pool definition is defined to be shared - * pool used for interactive work. - *
  • *SPOOL The specified pool definition is defined to be the - * shared pool used for spooled writers. - *
  • *SHRPOOL1 - *SHRPOOL60 The specified pool definition is defined - * to be a shared pool. - *

    - * - * @return The pool name. If the pool name cannot be determined, null is returned. - **/ - public String getName() - { - if (poolName_ != null) return poolName_; - else { - try - { - poolName_ = ((String)get("poolName")).trim(); - return poolName_; - } - catch (Exception e) - { - if (Trace.isTraceOn()) Trace.log(Trace.ERROR, "Unable to get pool name.", e); - return null; - } - } - } - - /** - * Returns the amount of main storage, in kilobytes, currently allocated to the pool. - * Note: Depending on system storage availability, this may be less than - * the pool's requested ("defined") size. - * - * @return The pool size, in kilobytes. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - * @deprecated Use getSize() instead. - **/ - public int getPoolSize() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - return getSize(); - } - - /** - * Returns the amount of main storage, in kilobytes, currently allocated to the pool. - * Note: Depending on system storage availability, this may be less than - * the pool's requested ("defined") size. - * - * @return The pool size, in kilobytes. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public int getSize() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - return ((Integer)get("poolSize")).intValue(); - } - - /** - * Returns the amount of storage, in kilobytes, in the pool reserved for - * system use. (For example, for save and restore operations.) The system - * calculates this amount by using storage pool sizes and activity levels. - * - * @return The reserved size. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public int getReservedSize() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - return ((Integer)get("reservedSize")).intValue(); - } - - /** - * Returns the library of the subsystem with which this storage pool is associated. - * The field will be blank for shared pools. - * - * @return The subsystem library. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public String getSubsystemLibrary() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - return ((String)get("subsystemLibraryName")).trim(); - } - - /** - * Returns the subsystem with which this storage pool is associated. - * The field will be blank for shared pools. - * - * @return The subsystem name. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public String getSubsystemName() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - return ((String)get("subsystemName")).trim(); - } - - /** - * Returns the system. - * - * @return The system. - **/ - public AS400 getSystem() - { - return system_; - } - - /** - * Returns the rate, in transitions per minute, of transitions - * of threads from a waiting condition to an ineligible condition. - * - * @return The rate. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public float getWaitToIneligible() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - return ((Integer)get("waitToIneligible")).floatValue()/(float)10.0; - } - - /** - * Returns the current cache status. - * The default behavior is no caching. - * @return true if caching is enabled, false otherwise. - * @see #commitCache - * @see #refreshCache - * @see #setCaching - **/ - public boolean isCaching() - { - return cacheChanges_; - } - - - /** - * Indicates whether the pool is a shared system pool. - *
    Note: In some cases, this method may incorrectly report false for a shared pool; for example, if the object was constructed using {@link #SystemPool(AS400, int) SystemPool(system, poolIdentifier)}, and the pool name is not *MACHINE, *BASE, *INTERACT, *SPOOL, or *SHRPOOL1-60. - * @return true if it's a shared system pool, false otherwise. - **/ - public boolean isShared() - { - return (indicatedSharedPool_ || isValidNameForSharedPool(poolName_)) && - (subsystemLibrary_ == null && subsystemName_ == null && - poolSequenceNumber_ == 0); - } - - - /** - * Loads the system pool information. The system and the system pool - * name or identifier should be set before this method is invoked. - * - * Note: This method is equivalent to the refreshCache() method. - * - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public void loadInformation() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - refreshCache(); - } - - /* - * Refreshes the current system pool information. The - * currently cached data is cleared and new data will - * be retrieved from the system when needed. That is, - * after a call to refreshCache(), a call to one of the get() or set() - * methods will go to the system to retrieve or set the value. - * - * Any cached (uncommitted) changes will be lost if not committed by a prior call - * to commitCache(). - * - * If caching is not enabled, this method does nothing. - * @see #commitCache - * @see #isCaching - * @see #setCaching - **/ - public synchronized void refreshCache() - { - // The next time a get() is done, the record data - // will be reloaded. - poolRecord_ = null; - - // Clear the current cache of (uncommitted) changes. - if (changesTable_ != null) changesTable_.clear(); - } - - /** - * Removes a property change listener. - * - * @param listener The listener. - **/ - - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if(listener==null) - throw new NullPointerException("listener"); - if (changes_ != null) changes_.removePropertyChangeListener(listener); - } - - /** - * Removes a vetoable change listener. - * - * @param listener The listener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if(listener==null) - throw new NullPointerException("listener"); - if (vetos_ != null) vetos_.removeVetoableChangeListener(listener); - } - - - private final static String TEN_BLANKS = " "; - - /** - * Creates a parameter list for the call to QWCRSSTS. - **/ - private ProgramParameter[] buildParameterList() - { - AS400Bin4 bin4 = new AS400Bin4(); - AS400Text text; - - // Note: If we have a pool identifier, or if the pool is identified as a "shared" pool, we can use the 7-parameter call. - // Otherwise we must use the 5-parameter call. - - int numParms; - if (indicatedSharedPool_ || poolIdentifier_ != null) - { - numParms = 7; - if (systemStatusFormat_ == null || - systemStatusFormat_.getClass() != SSTS0400Format.class) - { - systemStatusFormat_ = new SSTS0400Format(system_); - poolFormat_ = new PoolInformationFormat0400(system_); - } - } - else - { - numParms = 5; - if (systemStatusFormat_ == null || - systemStatusFormat_.getClass() != SSTS0300Format.class) - { - systemStatusFormat_ = new SSTS0300Format(system_); - poolFormat_ = new PoolInformationFormat(system_); - } - } - ProgramParameter[] parmList = new ProgramParameter[numParms]; - - // Required parameters: - - // Receiver variable - int receiverLength = systemStatusFormat_.getNewRecord().getRecordLength(); - parmList[0] = new ProgramParameter(receiverLength); - - // Length of receiver variable - parmList[1] = new ProgramParameter(bin4.toBytes(receiverLength)); - if (DEBUG) System.out.println("QWCRSSTS parm 2: " + receiverLength); - - // Format name - text = new AS400Text(8, system_.getCcsid(), system_); - parmList[2] = new ProgramParameter(text.toBytes(systemStatusFormat_.getName())); - if (DEBUG) System.out.println("QWCRSSTS parm 3: " + systemStatusFormat_.getName()); - - // Reset status statistics - text = new AS400Text(10, system_.getCcsid(), system_); - parmList[3] = new ProgramParameter(text.toBytes("*NO")); - // Note that this parm is ignored for formats SSTS0100 and SSTS0500. - if (DEBUG) System.out.println("QWCRSSTS parm 4: " + "*NO"); - - // Error code - byte[] errorInfo = new byte[32]; - parmList[4] = new ProgramParameter(errorInfo, 0); - if (DEBUG) System.out.println("QWCRSSTS parm 5: " + "0"); - - if (numParms > 5) - { - // Optional parameters: - - // Pool selection information. - // 3 subfields: - // typeOfPool (CHAR10) - Possible values are: *SHARED, *SYSTEM. - // sharedPoolName (CHAR10) - Possible values are: *ALL, *MACHINE, *BASE, *INTERACT, *SPOOL, *SHRPOOL1-60. If type of pool is *SYSTEM, then this field must be blank. - // systemPoolIdentifier (BIN4) - If typeOfPool is *SHARED, must be zero. Otherwise: -1 for "all active pools"; 1-64 to specify an active pool. If the pool is not active, CPF186B is sent. - - // Note: The typeOfPool field simply indicates _how_ we are identifying the pool in this API: Either by shared-pool name, or by system pool identifier. - String typeOfPool = (indicatedSharedPool_ ? "*SHARED " : "*SYSTEM "); - - StringBuffer sharedPoolName = new StringBuffer(indicatedSharedPool_ ? poolName_ : ""); - if (sharedPoolName.length() < 10) { - int numPadBytes = 10 - sharedPoolName.length(); - sharedPoolName.append(TEN_BLANKS.substring(10-numPadBytes)); // pad field to a length of 10 chars - } - - int systemPoolIdentifier = (indicatedSharedPool_ ? 0 : poolIdentifier_.intValue()); - - byte[] poolType = text.toBytes(typeOfPool); - byte[] poolNam = text.toBytes(sharedPoolName.toString()); - byte[] poolId = BinaryConverter.intToByteArray(systemPoolIdentifier); - byte[] poolSelectionInformation = new byte[24]; - System.arraycopy(poolType, 0, poolSelectionInformation, 0, 10); - System.arraycopy(poolNam, 0, poolSelectionInformation, 10, 10); - System.arraycopy(poolId, 0, poolSelectionInformation, 20, 4); - parmList[5] = new ProgramParameter(poolSelectionInformation); - if (Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "QWCRSSTS parameter 6: poolType==|" + typeOfPool +"| , poolName==|"+ sharedPoolName.toString() +"| , poolID==|"+ systemPoolIdentifier +"|"); - } - - // Size of pool selection information. - // Valid values are 0, 20, or 24 - parmList[6] = new ProgramParameter(bin4.toBytes(24)); // size is 24 bytes - if (DEBUG) System.out.println("QWCRSSTS parm 7: " + "24"); - } - - return parmList; - } - - - /** - * Indicates whether the pool name is a valid name for a shared system pool. - *
    Note: In some cases, this method may incorrectly report false for a name that actually specifies a shared pool; for example, for a shared pool with a non-standard name. - * @return true if poolName is *MACHINE, *BASE, *INTERACT, *SPOOL, or *SHRPOOLxx; false otherwise. - **/ - public static final boolean isValidNameForSharedPool(String name) - { - if (name == null) return false; - if (name.equals("*ALL") || - name.equals("*MACHINE") || - name.equals("*BASE") || - name.equals("*INTERACT") || - name.equals("*SPOOL") || - name.startsWith("*SHRPOOL")) - return true; - else return false; - } - - - /** - * Loads pool data from the system using the SSTS0300 or SSTS0400 format. - * If the information is already cached, this method does nothing. - **/ - private void retrieveInformation() - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - UnsupportedEncodingException - { - // Check to see if the format has been loaded already - if (poolRecord_ != null) return; - - if (!connected_) connect(); - - QSYSObjectPathName prgName = new QSYSObjectPathName("QSYS","QWCRSSTS","PGM"); - ProgramParameter[] parmList = buildParameterList(); - - ProgramCall pgm = new ProgramCall(system_); - try - { - pgm.setProgram(prgName.getPath(), parmList); - } - catch(PropertyVetoException pve) {} // Quiet the compiler - - if (Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "Retrieving system pool information."); - } - if (pgm.run() != true) - { - AS400Message[] msgList = pgm.getMessageList(); - if (Trace.isTraceOn()) - { - Trace.log(Trace.ERROR, "Error retrieving system pool information:"); - for (int i=0; i returned) - { - int numPools = ((Integer)rec.getField("numberOfPools")).intValue(); - int offset = ((Integer)rec.getField("offsetToPoolInformation")).intValue(); - int entryLength = ((Integer)rec.getField("lengthOfPoolInformationEntry")).intValue(); - // Make the byte array big enough to hold the pool information. - int baseLength = systemStatusFormat_.getNewRecord().getRecordLength(); - int newLength = numPools*entryLength + (offset-baseLength); - systemStatusFormat_.addFieldDescription(new HexFieldDescription(new AS400ByteArray(newLength), "poolInformation")); - if (Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "Resizing System Status format to hold more system pool information."); - Trace.log(Trace.DIAGNOSTIC, " New pool information: "+baseLength+", "+newLength+", "+systemStatusFormat_.getNewRecord().getRecordLength()); - } - return true; - } - return false; - } - - - /** - * Sets the value for the specified field to value in the - * appropriate record in the format cache. - **/ - private void set(String field, Object value) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - PropertyVetoException, - UnsupportedEncodingException - - { - // Set the info into our own record - Object oldValue = null; - if ((vetos_ != null || changes_ != null) && - changesTable_ != null) { - oldValue = changesTable_.get(field); - } - if (vetos_ != null) vetos_.fireVetoableChange(field, oldValue, value); - if (changesTable_ == null) changesTable_ = new Hashtable(11); - changesTable_.put(field, value); - if (changes_ != null) changes_.firePropertyChange(field, oldValue, value); - if (!cacheChanges_) commitCache(); - } - - - /** - * Turns caching on or off. - * If caching is turned off, the next get() or set() will go to the system. - * @param cache true if caching should be used when getting - * and setting information to and from the system; false - * if every get or set should communicate with the system - * immediately. Any cached changes that are not committed - * when caching is turned off will be lost. - * The default behavior is no caching. - * @see #commitCache - * @see #isCaching - * @see #refreshCache - **/ - public synchronized void setCaching(boolean cache) - { - cacheChanges_ = cache; - } - - - /** - * Sets the minimum faults-per-second guideline, the faults per second for each active thread, - * and the maximum faults-per-second guideline for this storage pool. - * The sum of minimum faults and per-thread faults must be less than the - * value of the maximum faults parameter. Each value is used by the - * system if the performance adjustment (QPFRADJ) system value is set to - * 2 or 3. - *
    Note: This method is supported only for shared pools, - * not for subsystem (non-shared) pools. - * - * @param minValue The new minimum faults-per-second guideline. - * @param perValue The new faults per second for each active thread. - * @param maxValue The new maximum faults-per-second guideline. - * @exception AS400Exception If the system returns an error - * message. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ConnectionDroppedException If the connection is dropped - * unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - * @see #isShared - **/ - public void setFaults(float minValue, float perValue, float maxValue) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - PropertyVetoException, - UnsupportedEncodingException - { - if (!indicatedSharedPool_) throwUnsupported(); - if (!cacheChanges_) - { - synchronized(this) - { - cacheChanges_ = true; - setMinimumFaults(minValue); - setPerThreadFaults(perValue); - setMaximumFaults(maxValue); - commitCache(); - cacheChanges_ = false; - } - } - else - { - setMinimumFaults(minValue); - setPerThreadFaults(perValue); - setMaximumFaults(maxValue); - } - } - - - /** - * Sets the maximum faults-per-second guideline to use for this storage - * pool. The sum of minimum faults and per-thread faults must be less than the - * value of the maximum faults parameter. This value is used by the - * system if the performance adjustment (QPFRADJ) system value is set to - * 2 or 3. - *
    Note: This method is supported only for shared pools, - * not for subsystem (non-shared) pools. - * - * @param value The new maximum faults-per-second guideline. - * @exception AS400Exception If the system returns an error - * message. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ConnectionDroppedException If the connection is dropped - * unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - * @see #isShared - **/ - public void setMaximumFaults(float value) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - PropertyVetoException, - UnsupportedEncodingException - { - if (!indicatedSharedPool_) throwUnsupported(); - set("maximumFaults", new Float(value)); - } - - /** - * Sets the maximum amount of storage to allocate to this storage pool - * (as a percentage of total main storage). This value cannot be - * less than the minimum pool size % parameter value. This value is used - * by the system if the performance adjustment (QPFRADJ) system value - * is set to 2 or 3. - *
    Note: This method is supported only for shared pools, - * not for subsystem (non-shared) pools. - * - * @param value The new maximum pool size. - * @exception AS400Exception If the system returns an error - * message. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ConnectionDroppedException If the connection is dropped - * unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - * @see #isShared - **/ - public void setMaximumPoolSize(float value) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - PropertyVetoException, - UnsupportedEncodingException - { - if (!indicatedSharedPool_) throwUnsupported(); - set("maximumPoolSize", new Float(value)); - } - - - /** - * Sets the value indicating whether messages reporting that a change was - * made are written to the current job's job log and to the QHST message - * log. This affects the logging of change-related messages only; it does - * not affect the logging of error messages. Valid values are: - *

    - *

  • true - Log change messages. - *
  • false - Do not log change messages. - *

    - * The default value for messages logging is true. - * - * @param log The value indicating whether messages reporting that a - * change was made are written to the current job's job log - * and to the QHST message log. - * @exception AS400Exception If the system returns an error - * message. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ConnectionDroppedException If the connection is dropped - * unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public void setMessageLogging(boolean log) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - PropertyVetoException, - UnsupportedEncodingException - { - set("messageLogging", log ? "Y" : "N"); - } - - - /** - * Sets the minimum faults-per-second guideline to use for this storage - * pool. This value is used by the system if the performance adjustment - * (QPFRADJ) system value is set to 2 or 3. If you want the system to - * calculate the priority, you must specify -2 for this parameter. If - * you do not want this value to change, you may specify -1 for this - * parameter. - *
    Note: This method is supported only for shared pools, - * not for subsystem (non-shared) pools. - * - * @param value The new minumum faults-per-second guideline. - * - * @exception AS400Exception If the system returns an error - * message. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ConnectionDroppedException If the connection is dropped - * unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - * @see #isShared - **/ - public void setMinimumFaults(float value) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - PropertyVetoException, - UnsupportedEncodingException - { - if (!indicatedSharedPool_) throwUnsupported(); - set("minimumFaults", new Float(value)); - } - - - /** - * Sets the minimum and maximum amount of storage to allocate to this storage pool - * (as a percentage of total main storage). Maximum value cannot be - * less than the minimum pool size % parameter value. Each value is used - * by the system if the performance adjustment (QPFRADJ) system value - * is set to 2 or 3. - *
    Note: This method is supported only for shared pools, - * not for subsystem (non-shared) pools. - * - * @param minValue The new minimum pool size. - * @param maxValue The new maximum pool size. - * @exception AS400Exception If the system returns an error - * message. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ConnectionDroppedException If the connection is dropped - * unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - * @see #isShared - **/ - public void setMinAndMaxPoolSize(float minValue, float maxValue) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - PropertyVetoException, - UnsupportedEncodingException - { - if (!indicatedSharedPool_) throwUnsupported(); - if (!cacheChanges_) - { - synchronized(this) - { - cacheChanges_ = true; - setMinimumPoolSize(minValue); - setMaximumPoolSize(maxValue); - commitCache(); - cacheChanges_ = false; - } - } - else - { - setMinimumPoolSize(minValue); - setMaximumPoolSize(maxValue); - } - } - - - /** - * Sets the minimum amount of storage to allocate to this storage pool - * (as a percentage of total main storage). This value cannot be - * greater than the maximum pool size % parameter value. This value is - * used by the system if the performance adjustment (QPFRADJ) system - * value is set to 2 or 3. - *
    Note: This method is supported only for shared pools, - * not for subsystem (non-shared) pools. - * - * @param value The new minimum pool size. - * @exception AS400Exception If the system returns an error - * message. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ConnectionDroppedException If the connection is dropped - * unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - * @see #isShared - **/ - - public void setMinimumPoolSize(float value) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - PropertyVetoException, - UnsupportedEncodingException - { - if (!indicatedSharedPool_) throwUnsupported(); - set("minimumPoolSize", new Float(value)); - } - - - /** - * Sets the value indicating whether the system dynamically adjust the - * paging characteristics of the storage pool for optimum performance. - * Valid values are: - *

    - *

  • *SAME - The paging option for the storage pool is not changed. - *
  • *FIXED - The system will not dynamically adjust the paging - * characteristics; system default values are used. - *
  • *CALC - The system will dynamically adjust the paging - * characteristics. - * - * @param value The value indicating whether the system dynamically adjust - * the paging characteristics of the sorage pool for optimum - * performance. - * @exception AS400Exception If the system returns an error - * message. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ConnectionDroppedException If the connection is dropped - * unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public void setPagingOption(String value) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - PropertyVetoException, - UnsupportedEncodingException - { - set("pagingOption", value); - } - - - /** - * Sets the faults per second for each active thread in this storage - * pool. Each job is comprised of one or more threads. The system multiples - * this number by the number of active threads that it finds in the - * pool. This result is added to the minimum faults parameter to - * calculate the faults-per-second guideline to use for this pool. This - * value is used by the system if the performance adjustment (QPFRADJ) - * system value is set to 2 or 3. - *
    Note: This method is supported only for shared pools, - * not for subsystem (non-shared) pools. - * - * @param value The new faults. - * @exception AS400Exception If the system returns an error - * message. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ConnectionDroppedException If the connection is dropped - * unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - * @see #isShared - **/ - public void setPerThreadFaults(float value) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - PropertyVetoException, - UnsupportedEncodingException - { - if (!indicatedSharedPool_) throwUnsupported(); - set("perThreadFaults", new Float(value)); - } - - - /** - * Sets the activity level for the pool. This is the maximum number of - * threads that can be active in the pool at any one time. - * The activity level of a "machine" pool (*MACHINE) cannot be changed. - * - * @param value The new activity level for the pool. - * @exception AS400Exception If the system returns an error - * message. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ConnectionDroppedException If the connection is dropped - * unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - * @deprecated Use setActivityLevel() instead. - **/ - public void setPoolActivityLevel(int value) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - PropertyVetoException, - UnsupportedEncodingException - { - setActivityLevel(value); - } - - - /** - * Sets the activity level for the pool. This is the maximum number of - * threads that can be active in the pool at any one time. - * The activity level of a "machine" pool (*MACHINE) cannot be changed. - * - * Recommended coding pattern: - * systemPool.setCaching(true); - * systemPool.setSize(size); - * systemPool.setActivityLevel(level); - * systemPool.commitCache(); - * - * @param value The new activity level for the pool. - * @exception AS400Exception If the system returns an error - * message. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ConnectionDroppedException If the connection is dropped - * unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public void setActivityLevel(int value) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - PropertyVetoException, - UnsupportedEncodingException - { - set("activityLevel", new Integer(value)); - } - - - /** - * Sets the system pool name. - * - * @param poolName The name of the system pool. - * @exception PropertyVetoException If the change is vetoed. - * @deprecated Use setName() instead. - **/ - public void setPoolName(String poolName) - throws PropertyVetoException - { - setName(poolName); - } - - - /** - * Sets the system pool name. - * - * @param poolName The name of the system pool. - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setName(String poolName) - throws PropertyVetoException - { - if (poolName == null) - throw new NullPointerException("poolName"); - if (connected_) - throw new ExtendedIllegalStateException("poolName", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - String oldValue = poolName_; - String newValue = poolName.trim(); - if (vetos_ != null) vetos_.fireVetoableChange("poolName", oldValue, newValue); - poolName_ = poolName; - if (changes_ != null) changes_.firePropertyChange("poolName", oldValue, newValue); - } - - - /** - * Sets the size of the system pool in kilobytes, where one kilobyte is - * 1024 bytes. - * For shared pools, this specifies the requested ("defined") size. - * The minimum value is 256 kilobytes. - * To indicate that no storage or activity level is defined - * for the pool, specify 0. - * - * @param value The new size of the system pool. - * @exception AS400Exception If the system returns an error - * message. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ConnectionDroppedException If the connection is dropped - * unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - * @deprecated Use setSize() instead. - **/ - public void setPoolSize(int value) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - PropertyVetoException, - UnsupportedEncodingException - { - setSize(value); - } - - - /** - * Sets the size of the system pool in kilobytes, where one kilobyte is - * 1024 bytes. - * For shared pools, this specifies the requested ("defined") size. - * The minimum value is 256 kilobytes. - * To indicate that no storage or activity level is defined - * for the pool, specify 0. - * - * Recommended coding pattern: - * systemPool.setCaching(true); - * systemPool.setSize(size); - * systemPool.setActivityLevel(level); - * systemPool.commitCache(); - * - * @param value The new size of the system pool. - * @exception AS400Exception If the system returns an error - * message. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ConnectionDroppedException If the connection is dropped - * unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - **/ - public void setSize(int value) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - PropertyVetoException, - UnsupportedEncodingException - { - set("poolSize", new Integer(value)); - } - - - /** - * Sets the priority of this pool relative the priority of the other - * storage pools. Valid values are 1 through 14. The priority for the - * *MACHINE pool must be 1. This value is used by the system if the - * performance adjustment (QPFRADJ) system value is set to 2 or 3. - *
    Note: This method is supported only for shared pools, - * not for subsystem (non-shared) pools. - * - * @param value The new priority. - * @exception AS400Exception If the system returns an error - * message. - * @exception AS400SecurityException If a security or authority error - * occurs. - * @exception ConnectionDroppedException If the connection is dropped - * unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - * the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - * the system. - * @exception ObjectDoesNotExistException If the object does not exist on the system. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - * not supported. - * @see #isShared - **/ - public void setPriority(int value) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException, - PropertyVetoException, - UnsupportedEncodingException - { - if (!indicatedSharedPool_) throwUnsupported(); - set("priority", new Integer(value)); - } - - - /** - * Sets the system. - * @param system The system. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem(AS400 system) - throws PropertyVetoException - { - if (system == null) - throw new NullPointerException("system"); - if (connected_) - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - AS400 oldValue = system_; - AS400 newValue = system; - if (vetos_ != null) vetos_.fireVetoableChange("system", oldValue,newValue); - system_ = system; - if (changes_ != null) changes_.firePropertyChange("system", oldValue,newValue); - } - - - /** - * Return the pool name. - * - * @return The pool name. - **/ - public String toString() - { - StringBuffer buf = new StringBuffer(super.toString()); - if (poolName_ != null || subsystemName_ != null || poolIdentifier_ != null) - { - if (subsystemName_ != null) { - buf.append("["+subsystemLibrary_+"/"+subsystemName_+"/"+poolSequenceNumber_+"]"); - } - else if (poolName_ != null) { - buf.append("["+poolName_+"]"); - } - else if (poolIdentifier_ != null) { - buf.append("[poolID="+poolIdentifier_.toString()+"]"); - } - } - return buf.toString(); - } - - private static final void throwUnsupported() - { - Trace.log(Trace.ERROR, "Method not supported for subsystem (non-shared) pools."); - throw new UnsupportedOperationException(); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/SystemPool16.gif b/cvsroot/src/com/ibm/as400/access/SystemPool16.gif deleted file mode 100644 index c4cfb1781..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/SystemPool16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/SystemPool32.gif b/cvsroot/src/com/ibm/as400/access/SystemPool32.gif deleted file mode 100644 index a489fa97f..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/SystemPool32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/SystemPoolBeanInfo.java b/cvsroot/src/com/ibm/as400/access/SystemPoolBeanInfo.java deleted file mode 100644 index a94484b19..000000000 --- a/cvsroot/src/com/ibm/as400/access/SystemPoolBeanInfo.java +++ /dev/null @@ -1,355 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemPoolBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.lang.reflect.Method; - -/** - * The SystemPoolBeanInfo class provides bean information for the - * SystemPool class. -**/ -public class SystemPoolBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private final static Class beanClass_ = SystemPool.class; - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - // Static initializer. - static - { - try - { - // Property change events - EventSetDescriptor changed = new EventSetDescriptor(beanClass_, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - // Vetoable change events - EventSetDescriptor veto = new EventSetDescriptor(beanClass_, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - events_ = new EventSetDescriptor[] { changed, veto }; - - // Properties. - PropertyDescriptor poolName = new PropertyDescriptor("poolName", beanClass_, - "getPoolName", null); - poolName.setBound(false); - poolName.setConstrained(false); - poolName.setDisplayName(loader_.getText("PROP_NAME_SP_POOLNAME")); - poolName.setShortDescription(loader_.getText("PROP_DESC_SP_POOLNAME")); - - PropertyDescriptor poolIdentifier = new PropertyDescriptor("poolIdentifier", beanClass_, - "getPoolIdentifier", null); - poolIdentifier.setBound(false); - poolIdentifier.setConstrained(false); - poolIdentifier.setDisplayName(loader_.getText("PROP_NAME_SP_POOLID")); - poolIdentifier.setShortDescription(loader_.getText("PROP_DESC_SP_POOLID")); - - PropertyDescriptor activeToIneligible = new PropertyDescriptor("activeToIneligible", - beanClass_, - "getActiveToIneligible", - null); - activeToIneligible.setBound(false); - activeToIneligible.setConstrained(false); - activeToIneligible.setDisplayName(loader_.getText("PROP_NAME_SP_ATE")); - activeToIneligible.setShortDescription(loader_.getText("PROP_DESC_SP_ATE")); - - PropertyDescriptor activeToWait = new PropertyDescriptor("activeToWait", beanClass_, - "getActiveToWait", null); - activeToWait.setBound(false); - activeToWait.setConstrained(false); - activeToWait.setDisplayName(loader_.getText("PROP_NAME_SP_ATW")); - activeToWait.setShortDescription(loader_.getText("PROP_DESC_SP_ATW")); - - PropertyDescriptor databaseFaults = new PropertyDescriptor("databaseFaults", beanClass_, - "getDatabaseFaults", null); - databaseFaults.setBound(false); - databaseFaults.setConstrained(false); - databaseFaults.setDisplayName(loader_.getText("PROP_NAME_SP_DBFAULTS")); - databaseFaults.setShortDescription(loader_.getText("PROP_DESC_SP_DBFAULTS")); - - PropertyDescriptor databasePages = new PropertyDescriptor("databasePages", beanClass_, - "getDatabasePages", null); - databasePages.setBound(false); - databasePages.setConstrained(false); - databasePages.setDisplayName(loader_.getText("PROP_NAME_SP_DBPAGES")); - databasePages.setShortDescription(loader_.getText("PROP_DESC_SP_DBPAGES")); - - PropertyDescriptor maxAT = new PropertyDescriptor("maximumActiveThreads", - beanClass_, - "getMaximumActiveThreads", - null); - maxAT.setBound(false); - maxAT.setConstrained(false); - maxAT.setDisplayName(loader_.getText("PROP_NAME_SP_MAXAT")); - maxAT.setShortDescription(loader_.getText("PROP_DESC_SP_MAXAT")); - - PropertyDescriptor nonDatabaseFaults = new PropertyDescriptor("nonDatabaseFaults", - beanClass_, - "getNonDatabaseFaults", - null); - nonDatabaseFaults.setBound(false); - nonDatabaseFaults.setConstrained(false); - nonDatabaseFaults.setDisplayName(loader_.getText("PROP_NAME_SP_NONDBFLTS")); - nonDatabaseFaults.setShortDescription(loader_.getText("PROP_DESC_SP_NONDBFLTS")); - - PropertyDescriptor nonDatabasePages = new PropertyDescriptor("nonDatabasePages", - beanClass_, - "getNonDatabasePages", - null); - nonDatabasePages.setBound(false); - nonDatabasePages.setConstrained(false); - nonDatabasePages.setDisplayName(loader_.getText("PROP_NAME_SP_NONDBPGS")); - nonDatabasePages.setShortDescription(loader_.getText("PROP_DESC_SP_NONDBPGS")); - - PropertyDescriptor pagingOption = new PropertyDescriptor("pagingOption", beanClass_, - "getPagingOption", - "setPagingOption"); - pagingOption.setBound(true); - pagingOption.setConstrained(true); - pagingOption.setDisplayName(loader_.getText("PROP_NAME_SP_PAGINGOPTION")); - pagingOption.setShortDescription(loader_.getText("PROP_DESC_SP_PAGINGOPTION")); - - PropertyDescriptor poolSize = new PropertyDescriptor("poolSize", beanClass_, - "getPoolSize", "setPoolSize"); - poolSize.setBound(true); - poolSize.setConstrained(true); - poolSize.setDisplayName(loader_.getText("PROP_NAME_SP_POOLSIZE")); - poolSize.setShortDescription(loader_.getText("PROP_DESC_SP_POOLSIZE")); - - PropertyDescriptor reservedSize = new PropertyDescriptor("reservedSize", beanClass_, - "getReservedSize", null); - reservedSize.setBound(false); - reservedSize.setConstrained(false); - reservedSize.setDisplayName(loader_.getText("PROP_NAME_SP_RSVDSIZE")); - reservedSize.setShortDescription(loader_.getText("PROP_DESC_SP_RSVDSIZE")); - - PropertyDescriptor subsystemName = new PropertyDescriptor("subsystemName", beanClass_, - "getSubsystemName", null); - subsystemName.setBound(false); - subsystemName.setConstrained(false); - subsystemName.setDisplayName(loader_.getText("PROP_NAME_SP_SUBSYSNAME")); - subsystemName.setShortDescription(loader_.getText("PROP_DESC_SP_SUBSYSNAME")); - - PropertyDescriptor waitToIneligible = new PropertyDescriptor("waitToIneligible", - beanClass_, - "getWaitToIneligible", - null); - waitToIneligible.setBound(false); - waitToIneligible.setConstrained(false); - waitToIneligible.setDisplayName(loader_.getText("PROP_NAME_SP_WTI")); - waitToIneligible.setShortDescription(loader_.getText("PROP_DESC_SP_WTI")); - - PropertyDescriptor maximumFaults = new PropertyDescriptor("maximumFaults", beanClass_, - null, "setMaximumFaults"); - maximumFaults.setBound(true); - maximumFaults.setConstrained(true); - maximumFaults.setDisplayName(loader_.getText("PROP_NAME_SP_MAXFAULTS")); - maximumFaults.setShortDescription(loader_.getText("PROP_DESC_SP_MAXFAULTS")); - - PropertyDescriptor maximumPoolSize = new PropertyDescriptor("maximumPoolSize", - beanClass_, - null, - "setMaximumPoolSize"); - maximumPoolSize.setBound(true); - maximumPoolSize.setConstrained(true); - maximumPoolSize.setDisplayName(loader_.getText("PROP_NAME_SP_MAXPOOLSIZE")); - maximumPoolSize.setShortDescription(loader_.getText("PROP_DESC_SP_MAXPOOLSIZE")); - - PropertyDescriptor messageLogging = new PropertyDescriptor("messageLogging", beanClass_, - null, "setMessageLogging"); - messageLogging.setBound(true); - messageLogging.setConstrained(true); - messageLogging.setDisplayName(loader_.getText("PROP_NAME_SP_MSGLOGGING")); - messageLogging.setShortDescription(loader_.getText("PROP_DESC_SP_MSGLOGGING")); - - PropertyDescriptor minimumFaults = new PropertyDescriptor("minimumFaults", beanClass_, - null, "setMinimumFaults"); - minimumFaults.setBound(true); - minimumFaults.setConstrained(true); - minimumFaults.setDisplayName(loader_.getText("PROP_NAME_SP_MINFAULTS")); - minimumFaults.setShortDescription(loader_.getText("PROP_DESC_SP_MINFAULTS")); - - PropertyDescriptor minimumPoolSize = new PropertyDescriptor("minimumPoolSize", beanClass_, - null, "setMinimumPoolSize"); - minimumPoolSize.setBound(true); - minimumPoolSize.setConstrained(true); - minimumPoolSize.setDisplayName(loader_.getText("PROP_NAME_SP_MINPOOLSIZE")); - minimumPoolSize.setShortDescription(loader_.getText("PROP_DESC_SP_MINPOOLSIZE")); - - PropertyDescriptor perThreadFaults = new PropertyDescriptor("perThreadFaults", - beanClass_, - null, - "setPerThreadFaults"); - perThreadFaults.setBound(true); - perThreadFaults.setConstrained(true); - perThreadFaults.setDisplayName(loader_.getText("PROP_NAME_SP_PERTHRDFLTS")); - perThreadFaults.setShortDescription(loader_.getText("PROP_DESC_SP_PERTHRDFLTS")); - - PropertyDescriptor poolActivityLevel = new PropertyDescriptor("poolActivityLevel", - beanClass_, - null, - "setPoolActivityLevel"); - poolActivityLevel.setBound(true); - poolActivityLevel.setConstrained(true); - poolActivityLevel.setDisplayName(loader_.getText("PROP_NAME_SP_POOLACTLVL")); - poolActivityLevel.setShortDescription(loader_.getText("PROP_DESC_SP_POOLACTLVL")); - - PropertyDescriptor priority = new PropertyDescriptor("priority", beanClass_, - null, "setPriority"); - priority.setBound(true); - priority.setConstrained(true); - priority.setDisplayName(loader_.getText("PROP_NAME_SP_PRIORITY")); - priority.setShortDescription(loader_.getText("PROP_DESC_SP_PRIORITY")); - - PropertyDescriptor system = new PropertyDescriptor("system", beanClass_, - "getSystem", "setSystem"); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(loader_.getText("PROP_NAME_AS400_SYSTEM")); - system.setShortDescription(loader_.getText("PROP_DESC_AS400_SYSTEM")); - - - properties_ = new PropertyDescriptor[]{ - activeToIneligible, - activeToWait, - databaseFaults, - databasePages, - maxAT, - maximumFaults, - maximumPoolSize, - messageLogging, - minimumFaults, - minimumPoolSize, - nonDatabaseFaults, - nonDatabasePages, - pagingOption, - perThreadFaults, - poolActivityLevel, - poolIdentifier, - poolName, - poolSize, - priority, - reservedSize, - subsystemName, - system, - waitToIneligible - }; - } - catch (IntrospectionException e) - { - throw new Error(e.toString()); - } - } - - /** - * Returns the bean descriptor. - * - * @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - /** - * Returns the default event index. - * @return The default event index (always 1). - **/ - public int getDefaultEventIndex() - { - return 1; - } - - /** - * Returns the default property index. - * @return The default property index (always 0). - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - * Returns the descriptors for all events. - * @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - */ - public Image getIcon(int icon) - { - if(icon== BeanInfo.ICON_MONO_16x16) - { - java.awt.Image img = loadImage("SystemPool16.gif"); - return img; - } - else if(icon== BeanInfo.ICON_COLOR_16x16) - { - java.awt.Image img = loadImage("SystemPool16.gif"); - return img; - } - else if(icon == BeanInfo.ICON_MONO_32x32) - { - java.awt.Image img = loadImage("SystemPool32.gif"); - return img; - } - else if(icon == BeanInfo.ICON_COLOR_32x32) - { - java.awt.Image img = loadImage("SystemPool32.gif"); - return img; - } - return null; - } - - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/SystemProperties.java b/cvsroot/src/com/ibm/as400/access/SystemProperties.java deleted file mode 100644 index 231554045..000000000 --- a/cvsroot/src/com/ibm/as400/access/SystemProperties.java +++ /dev/null @@ -1,475 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemProperties.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.BufferedInputStream; -import java.io.InputStream; -import java.util.Properties; -import java.util.Vector; - -/** - Contains constants representing names of all Java system properties recognized by the IBM Toolbox for Java. -

    Note: This class is reserved for internal use within the Toolbox, and is subject to change without notice. - **/ -public class SystemProperties -{ - // System property constants. - private static final String ACCESS_PREFIX = "com.ibm.as400.access."; - private static final String DATA_PREFIX = "com.ibm.as400.data."; - private static final String PROPERTIES_CLASS_NAME = ACCESS_PREFIX + "Properties"; - private static final String PROPERTIES_FILE_NAME = ACCESS_PREFIX + "jt400.properties"; - private static final String PROPERTIES_FILE_NAME_WITH_SLASHES = "com/ibm/as400/access/jt400.properties"; - - - // System property names. - - /** - Specifies whether GUI support is available in the current execution environment. - If set to true, then the {@link AS400 AS400} class may prompt during sign-on to display error conditions, to obtain additional signon information, or to change the password. - If set to false, then connection error conditions or missing information will result in exceptions. -

      -
    • Property name: com.ibm.as400.access.AS400.guiAvailable -
    • Values/syntax: true or false -
    • Default: true -
    • Overridden by: {@link AS400#setGuiAvailable AS400.setGuiAvailable()} -
    - **/ - public static final String AS400_GUI_AVAILABLE = ACCESS_PREFIX + "AS400.guiAvailable"; - - /** - Specifies the proxy server host name and port number. - The port number is optional. -
      -
    • Property name: com.ibm.as400.access.AS400.proxyServer -
    • Values/syntax: hostName:portNumber -
    • Default: (no default) -
    • Overridden by: {@link AS400#setProxyServer AS400.setProxyServer()} -
    - **/ - public static final String AS400_PROXY_SERVER = ACCESS_PREFIX + "AS400.proxyServer"; - - /** - Specifies the name of the default signon handler class used by the {@link AS400 AS400} class. -
      -
    • Property name: com.ibm.as400.access.AS400.signonHandler -
    • Values/syntax: packageName.classname -
    • Default: An internal Toolbox class is used. -
    • Overridden by: {@link AS400#setSignonHandler AS400.setSignonHandler()} and {@link AS400#setDefaultSignonHandler AS400.setDefaultSignonHandler()} -
    - **/ - public static final String AS400_SIGNON_HANDLER = ACCESS_PREFIX + "AS400.signonHandler"; - - /** - Specifies whether the {@link AS400 AS400} class should attempt to add the appropriate secondary language library to the library list. - This property is ignored if not running on the IBM i system. -
      -
    • Property name: com.ibm.as400.access.AS400.mustAddLanguageLibrary -
    • Values/syntax: true or false -
    • Default: false -
    • Overridden by: {@link AS400#setMustAddLanguageLibrary AS400.setMustAddLanguageLibrary()} -
    - **/ - public static final String AS400_MUST_ADD_LANGUAGE_LIBRARY = ACCESS_PREFIX + "AS400.mustAddLanguageLibrary"; - - /** - Specifies whether sockets must be used when communicating with the system. Setting this property to true directs the Toolbox to refrain from exploiting native optimizations, when running directly on the system. -
      -
    • Property name: com.ibm.as400.access.AS400.mustUseSockets -
    • Values/syntax: true or false -
    • Default: false -
    • Overridden by: {@link AS400#setMustUseSockets AS400.setMustUseSockets()} -
    - **/ - public static final String AS400_MUST_USE_SOCKETS = ACCESS_PREFIX + "AS400.mustUseSockets"; - - /** - Specifies whether only Internet domain sockets must be used when communicating with the system. Setting this property to true directs the Toolbox to refrain from exploiting Unix sockets, when running directly on the system. -
      -
    • Property name: com.ibm.as400.access.AS400.mustUseNetSockets -
    • Values/syntax: true or false -
    • Default: false -
    • Overridden by: {@link AS400#setMustUseNetSockets AS400.setMustUseNetSockets()} -
    - **/ - public static final String AS400_MUST_USE_NET_SOCKETS = ACCESS_PREFIX + "AS400.mustUseNetSockets"; - - /** - Specifies whether the explicitly supplied profile must be used when communicating with the system. Setting this property to true directs the Toolbox to refrain from exploiting the currently signed-on profile by default, when running directly on the system. -
      -
    • Property name: com.ibm.as400.access.AS400.mustUseSuppliedProfile -
    • Values/syntax: true or false -
    • Default: false -
    • Overridden by: {@link AS400#setMustUseSuppliedProfile AS400.setMustUseSuppliedProfile()} -
    - **/ - public static final String AS400_MUST_USE_SUPPLIED_PROFILE = ACCESS_PREFIX + "AS400.mustUseSuppliedProfile"; - - /** - Specifies whether threads are used when communicating with the host servers. - By default, the AS400 object creates separate threads to listen on communication sockets to the host servers. Setting this property to false directs the Toolbox to refrain from creating separate threads for host server communications. -
      -
    • Property name: com.ibm.as400.access.AS400.threadUsed -
    • Values/syntax: true or false -
    • Default: true -
    • Overridden by: {@link AS400#setThreadUsed AS400.setThreadUsed()} -
    - **/ - public static final String AS400_THREAD_USED = ACCESS_PREFIX + "AS400.threadUsed"; - - /*public*/ static final String SECUREAS400_PROXY_ENCRYPTION_MODE = ACCESS_PREFIX + "SecureAS400.proxyEncryptionMode"; - /*public*/ static final String SECUREAS400_USE_SSLIGHT = ACCESS_PREFIX + "SecureAS400.useSslight"; - - /** - Specifies which trace categories to enable. This is a comma-delimited - list containing any combination of trace categories. -
      -
    • Property name: com.ibm.as400.access.Trace.category -
    • Values/syntax: datastream, diagnostic, error, information, ... -
      (Refer to the {@link Trace Trace} class for complete list.) -
    • Default: (no default) -
    • Overridden by: Various setTrace... methods in the Trace class. -
    - **/ - public static final String TRACE_CATEGORY = ACCESS_PREFIX + "Trace.category"; - static final String TRACE_CATEGORIES = ACCESS_PREFIX + "Trace.categories"; // catch misspellings - - /** - Specifies the file to which the {@link Trace Trace} class writes output. -
      -
    • Property name: com.ibm.as400.access.Trace.file -
    • Values/syntax: true or false -
    • Default: {@link System#out System.out}. -
    • Overridden by: Any of the Trace.setFileName() or Trace.setPrintWriter() methods. -
    - **/ - public static final String TRACE_FILE = ACCESS_PREFIX + "Trace.file"; - - /** - Specifies which trace categories to start on the JDBC server job. -
      -
    • Property name: com.ibm.as400.access.ServerTrace.JDBC -
    • Values/syntax: Refer to the javadoc for class {@link AS400JDBCDriver AS400JDBCDriver}. Follow the link labeled "JDBC properties", and search for the "server trace" property. -
    • Default: (no default) -
    • Overridden by: Specifying property values in either the connection URL or via one of the connect() methods of class {@link AS400JDBCDriver AS400JDBCDriver} -
    - **/ - public static final String TRACE_JDBC_SERVER = ACCESS_PREFIX + "ServerTrace.JDBC"; // @j1a - - /*public*/ static final String TRACE_ENABLED = ACCESS_PREFIX + "Trace.enabled"; - - /** - Specifies whether the {@link CommandCall CommandCall} class should assume that called commands are threadsafe. - If true, all called commands are assumed to be threadsafe. - If false, all called commands are assumed to be non-threadsafe. -
      -
    • Property name: com.ibm.as400.access.CommandCall.threadSafe -
    • Values/syntax: true or false -
    • Default: false -
    • Overridden by: {@link CommandCall#setThreadSafe(Boolean) CommandCall.setThreadSafe()} -
    - **/ - public static final String COMMANDCALL_THREADSAFE = ACCESS_PREFIX + "CommandCall.threadSafe"; - - /** - Specifies whether the {@link ProgramCall ProgramCall} class should assume that called programs are threadsafe. - If true, all called programs are assumed to be thread-safe. - If false, all called programs are assumed to be non-thread-safe. -
      -
    • Property name: com.ibm.as400.access.ProgramCall.threadSafe -
    • Values/syntax: true or false -
    • Default: false -
    • Overridden by: {@link ProgramCall#setThreadSafe ProgramCall.setThreadSafe()} -
    - **/ - public static final String PROGRAMCALL_THREADSAFE = ACCESS_PREFIX + "ProgramCall.threadSafe"; - - /** - Specifies how often, in seconds, the proxy server looks for idle connections. - The proxy server starts a thread to look for clients that are no longer - communicating. Use this property to set how often the thread looks for idle - connections. -
      -
    • Property name: com.ibm.as400.access.TunnelProxyServer.clientCleanupInterval -
    • Values/syntax: numberOfSeconds -
    • Default: 2 hours -
    • Overridden by: (none) -
    - **/ - public static final String TUNNELPROXYSERVER_CLIENTCLEANUPINTERVAL = ACCESS_PREFIX + "TunnelProxyServer.clientCleanupInterval"; //@A2A - - /** - Specifies how long, in seconds, a client can be idle before the proxy - server removes references to the objects. - Removing the references allows the JVM to garbage collect the objects. - The proxy server starts a thread to look for clients that are no longer - communicating. Use this property to set how long a client can be idle before - performing garbage collection on it. -
      -
    • Property name: com.ibm.as400.access.TunnelProxyServer.clientLifetime -
    • Values/syntax: numberOfSeconds -
    • Default: 30 minutes -
    • Overridden by: (none) -
    - **/ - public static final String TUNNELPROXYSERVER_CLIENTLIFETIME = ACCESS_PREFIX + "TunnelProxyServer.clientLifetime"; //@A2A - - /** - Specifies whether the socket is reused for multiple file transfers when in "active" mode. This property is referenced by classes {@link FTP FTP} and {@link AS400FTP AS400FTP}. - If true, the socket is reused. - If false, a new socket is created for each file transfer. - This property is ignored for a given FTP object if FTP.setReuseSocket(true/false) has - been performed on the object. -
      -
    • Property name: com.ibm.as400.access.FTP.reuseSocket -
    • Values/syntax: true or false -
    • Default: true -
    • Overridden by: {@link FTP#setReuseSocket FTP.setReuseSocket()} -
    - **/ - public static final String FTP_REUSE_SOCKET = ACCESS_PREFIX + "FTP.reuseSocket"; - - /*public*/ static final String JDBC_STATEMENT_LISTENERS = ACCESS_PREFIX + "JDBC.statementListeners"; - /*public*/ static final String JDBC_SECURE_CURRENT_USER = ACCESS_PREFIX + "JDBC.secureCurrentUser"; //@pw3 not documented in html - /*public*/ static final String JDBC_JVM16_SYNCHRONIZE = ACCESS_PREFIX + "JDBC.jvm16Synchronize"; //@dmy temp fix for jvm 1.6 memory stomping - /*public*/ static final String TRACE_MONITOR = ACCESS_PREFIX + "Trace.monitor"; - /*public*/ static final String TRACE_MONITOR_PORT = ACCESS_PREFIX + "Trace.monitorPort"; - - /** - Specifies the fallback CCSID to use in cases where a text data field with CCSID 65535 is encountered and must be converted. - Sometimes, especially in non-English environments, the default CCSID is left at 65535. That causes classes such as {@link AS400Text AS400Text} to make a "best guess" on the CCSID, based on the default locale. - This option overrides the best guess with a specific CCSID value. - This is useful where the Locale of a client system is different from that of the IBM i system. -
      -
    • Property name: com.ibm.as400.access.AS400.fallbackCCSID -
    • Values/syntax: 0-65535 -
    • Default: (no default) -
    • Overridden by: (none) -
    - **/ - public static final String FALLBACK_CCSID = ACCESS_PREFIX + "AS400.fallbackCCSID"; - - /** - Specifies whether pooled connections are to be pretested before being allocated to a requester by the connection pool manager. -
      -
    • Property name: com.ibm.as400.access.ConnectionPool.pretest -
    • Values/syntax: true or false -
    • Default: false -
    • Overridden by: {@link ConnectionPool#setPretestConnections(boolean) ConnectionPool.setPretestConnections()} -
    - **/ - public static final String CONNECTIONPOOL_PRETEST = ACCESS_PREFIX + "ConnectionPool.pretest"; - - /** - Specifies the behavior of the {@link com.ibm.as400.data.ProgramCallDocument ProgramCallDocument} in the event that XML parsing errors occur. - By default, the ProgramCallDocument object simply traces any parse errors. The trace category is {@link Trace#PCML PCML}. Setting this property to true directs the Toolbox to also throw a SAXException in the event of a parsing error. -
      -
    • Property name: com.ibm.as400.data.ProgramCallDocument.throwSAXExceptionIfParseError -
    • Values/syntax: true or false -
    • Default: false -
    • Overridden by: (none) -
    - **/ - public static final String THROW_SAX_EXCEPTION_IF_PARSE_ERROR = DATA_PREFIX + "ProgramCallDocument.throwSAXExceptionIfParseError"; - - /** - Specifies the maximum number of seconds to wait for an object list to be built, before timing out. - Some Toolbox methods (such as {@link JobList#load() JobList.load()}) call list-building APIs (such as QGYOLJOB) that build object lists remotely on the IBM i system. If the number of objects being listed is extremely large, the building of the list may take longer than anticipated. -
      -
    • Property name: com.ibm.as400.access.ListUtilities.listWaitTimeout -
    • Values/syntax: 0 or greater (0 means "wait until complete") -
    • Default: 60 seconds -
    • Overridden by: (none) -
    - **/ - public static final String LIST_WAIT_TIMEOUT = ACCESS_PREFIX + "ListUtilities.listWaitTimeout"; - - - - // *** Note: *** - // - // If you add a new system property, remember to also add it to the - // following other files: - // - SystemProperties.htm - // - SystemPropertiesSample1.htm - // - SystemPropertiesSample2.htm - // The *.htm files are owned/maintained by the InfoCenter support people. - - // Private data. - private static Vector ignored_ = new Vector(); - private static Properties propertiesFromClass_ = null; - private static Properties propertiesFromFile_ = null; - private static boolean propertiesClassLoadFailed_ = false; - private static boolean propertiesFileLoadFailed_ = false; - private static boolean systemPropertiesLoadFailed_ = false; - - // Private constructor - since this class never needs to be instantiated. - private SystemProperties() - { - // Nothing. - } - - // Returns the value of a system property. - // This method is reserved for internal use within the Toolbox. - // @param propertyName The system property name. - // @return The system property value, or null if the system property is not specified. - public static String getProperty(String propertyName) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Getting system property: '" + propertyName + "'"); - - String propertyValue = null; - - // Check to see if any specified value should be ignored. - if (ignored_.contains(propertyName)) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "System property on ignore list, value remains null."); - return null; - } - - // Look in the system property. This will get the value if it was set programmatically using java.lang.System.setProperties() or using the -D option of the java command. - if (systemPropertiesLoadFailed_ == false) - { - try - { - propertyValue = System.getProperty(propertyName); - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Value found in system properties: '" + propertyValue + "'"); - } - catch (SecurityException e) - { - // This will get thrown in a browser, since it is not cool to get properties from an applet. - systemPropertiesLoadFailed_ = true; - if (Trace.isTraceErrorOn()) Trace.log(Trace.ERROR, "Browser security exception:", e); - } - } - - // If it is not found, then look in the Properties class. - if (propertyValue == null) - { - // If the Properties class has not yet been loaded, and no previous attempt failed, then load the Properties class. - if ((propertiesFromClass_ == null) && (propertiesClassLoadFailed_ == false)) - { - loadPropertiesFromClass(); - } - - if (propertiesFromClass_ != null) - { - propertyValue = propertiesFromClass_.getProperty(propertyName); - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Value found in Properties class: '" + propertyValue + "'"); - } - } - - // If it is still not found, then look in the properties file. - if (propertyValue == null) - { - // If the jt400.properties file has not yet been loaded, and no previous attempt failed, then load the properties file. - if ((propertiesFromFile_ == null) && (propertiesFileLoadFailed_ == false)) - { - loadPropertiesFromFile(); - } - - if (propertiesFromFile_ != null) - { - propertyValue = propertiesFromFile_.getProperty(propertyName); - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Value found in jt400.properties file: '" + propertyValue + "'"); - } - } - - if (Trace.isTraceOn()) if (propertyValue == null) Trace.log(Trace.DIAGNOSTIC, "Value not found."); - - return propertyValue; - } - - // Tells this object to ignore any settings for a system property. - // @param propertyName The system property name. - static void ignoreProperty(String propertyName) - { - if (Trace.isTraceOn()) Trace.log(Trace.WARNING, "Adding system property to ignore list: '" + propertyName + "'"); - ignored_.addElement(propertyName); - } - - // Loads the properties from the Properties class (if one exists on the classpath). - private static void loadPropertiesFromClass() - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Loading Properties class: '" + PROPERTIES_CLASS_NAME + "'"); - - try - { - propertiesFromClass_ = (Properties)Class.forName(PROPERTIES_CLASS_NAME).newInstance(); - } - catch (ClassNotFoundException e) - { - propertiesClassLoadFailed_ = true; - if (Trace.isTraceDiagnosticOn()) Trace.log(Trace.DIAGNOSTIC, "Class not found: " + PROPERTIES_CLASS_NAME); - } - catch (Throwable e) - { - // We catch Throwable here because certain browsers (to remain nameless) throw ClassFormatError instead of an exception. - propertiesClassLoadFailed_ = true; - if (Trace.isTraceDiagnosticOn()) Trace.log(Trace.DIAGNOSTIC, "Unable to load class: " + PROPERTIES_CLASS_NAME, e); - } - } - - // Loads the properties from the jt400.properties file. - private static void loadPropertiesFromFile() - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Loading jt400.properties file: '" + PROPERTIES_FILE_NAME + "'"); - - propertiesFromFile_ = new Properties(); - InputStream input = null; - BufferedInputStream bis = null; - try - { - // Try to load the properties file using two different approaches. The first works on some environments, the second on others. - input = SystemProperties.class.getResourceAsStream(PROPERTIES_FILE_NAME); - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Trying with Class.getResourceAsStream(): " + (input != null)); - - if (input == null) - { - input = ClassLoader.getSystemResourceAsStream(PROPERTIES_FILE_NAME_WITH_SLASHES); - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Trying with ClassLoader.getSystemResourceAsStream(): " + (input != null)); - } - - // If that does not work, then we can't find the jt400.properties file. - if (input == null) - { - propertiesFileLoadFailed_ = true; - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Load of jt400.properties failed."); - return; - } - - // Load the properties from the jt400.properties file. - bis = new BufferedInputStream(input); - propertiesFromFile_.load(bis); - bis.close(); // this also closes the underlying stream ('input') - bis = null; - input = null; - } - catch (Exception e) - { - // We catch Exception here (rather than IOException) because browsers throw SecurityException when we try to read a local file. - propertiesFileLoadFailed_ = true; - if (Trace.isTraceWarningOn()) Trace.log(Trace.WARNING, "Unable to load jt400.properties file: " + PROPERTIES_FILE_NAME, e); - } - finally - { - if (bis != null) { - try { bis.close(); input = null; } - catch (Throwable t) { if (Trace.traceOn_) Trace.log(Trace.ERROR, t); } - } - if (input != null) { - try { input.close(); } - catch (Throwable t) { if (Trace.traceOn_) Trace.log(Trace.ERROR, t); } - } - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SystemStatus.java b/cvsroot/src/com/ibm/as400/access/SystemStatus.java deleted file mode 100644 index fca681f35..000000000 --- a/cvsroot/src/com/ibm/as400/access/SystemStatus.java +++ /dev/null @@ -1,1102 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemStatus.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.Serializable; -import java.util.Date; -import java.util.Enumeration; -import java.util.Vector; - -/** - Provides access to a group of statistics that represent the current status of the system. - **/ -public class SystemStatus implements Serializable -{ - static final long serialVersionUID = 4L; - - // Shared error code parameter. - private static final ProgramParameter ERROR_CODE = new ProgramParameter(new byte[8]); - - // The system from which status is being retrieved. - private AS400 system_; - - // The receiver variables retrieved for each format. Index zero will be set to the last format retrieved. - byte[][] receiverVariables_ = new byte[4][]; - // A vector of SystemPool object retrieved from the system. - private Vector poolsVector_; - - // Flag indicating if we have connected to the system yet. - private transient boolean connected_ = false; - // Flag indicating if we are caching stats or retrieving everytime. - private transient boolean caching_ = false; - - // List of property change event bean listeners, set on first add. - private transient PropertyChangeSupport propertyChangeListeners_ = null; - // List of vetoable change event bean listeners, set on first add. - private transient VetoableChangeSupport vetoableChangeListeners_ = null; - - private transient AS400Timestamp timestampConverter_; - - /** - Constructs a SystemStatus object. - **/ - public SystemStatus() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SystemStatus object."); - } - - /** - Constructs a SystemStatus object. - @param system The system object representing the system from which the status statistics should be retrieved. - **/ - public SystemStatus(AS400 system) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SystemStatus object, system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - system_ = system; - } - - /** - Adds a PropertyChangeListener. The specified PropertyChangeListener's {@link java.beans.PropertyChangeListener#propertyChange propertyChange()} method will be called each time the value of any bound property is changed. - @param listener The listener. - @see #removePropertyChangeListener - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Adds a VetoableChangeListener. The specified VetoableChangeListener's {@link java.beans.VetoableChangeListener#vetoableChange vetoableChange()} method will be called each time the value of any constrained property is changed. - @param listener The listener. - @see #removeVetoableChangeListener - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - } - - /** - Returns the number of jobs active in the system (jobs that have been started, but have not yet ended), including both user and system jobs. - @return The number of jobs active in the system (jobs that have been started, but have not yet ended), including both user and system jobs. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getActiveJobsInSystem() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 100); - } - - /** - Returns the number of initial and secondary threads in the system (threads that have been started, but have not yet ended), including both user and system threads. - @return The number of initial and secondary threads in the system (threads that have been started, but have not yet ended), including both user and system threads. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getActiveThreadsInSystem() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 104); - } - - /** - Returns the number of completed batch jobs that produced printer output that is waiting to print. - @return The number of completed batch jobs that produced printer output that is waiting to print. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getBatchJobsEndedWithPrinterOutputWaitingToPrint() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(1); - return BinaryConverter.byteArrayToInt(receiverVariables_[1], 76); - } - - /** - Returns the number of batch jobs that are in the process of ending due to one of the following conditions: -
      -
    • The job finishes processing normally. -
    • The job ends before its normal completion point and is being - removed from the system. -
    - @return The number of batch jobs that are in the process of ending. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getBatchJobsEnding() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(1); - return BinaryConverter.byteArrayToInt(receiverVariables_[1], 56); - } - - /** - Returns the number of batch jobs that were submitted, but were held before they could begin running. - @return The number of batch jobs that were submitted, but were held before they could begin running. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getBatchJobsHeldOnJobQueue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(1); - return BinaryConverter.byteArrayToInt(receiverVariables_[1], 64); - } - - /** - Returns the number of batch jobs that had started running, but are now held. - @return The number of batch jobs that had started running, but are now held. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getBatchJobsHeldWhileRunning() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(1); - return BinaryConverter.byteArrayToInt(receiverVariables_[1], 52); - } - - /** - Returns the number of batch jobs on job queues that have been assigned to a subsystem, but are being held. - @return The number of batch jobs on job queues that have been assigned to a subsystem, but are being held. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getBatchJobsOnAHeldJobQueue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(1); - return BinaryConverter.byteArrayToInt(receiverVariables_[1], 68); - } - - /** - Returns the number of batch jobs on job queues that have not been assigned to a subsystem. - @return The number of batch jobs on job queues that have not been assigned to a subsystem. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getBatchJobsOnUnassignedJobQueue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(1); - return BinaryConverter.byteArrayToInt(receiverVariables_[1], 72); - } - - /** - Returns the number of batch jobs currently running on the system. - @return The number of batch jobs currently running on the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getBatchJobsRunning() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(1); - return BinaryConverter.byteArrayToInt(receiverVariables_[1], 48); - } - - /** - Returns the number of batch jobs waiting for a reply to a message before they can continue to run. - @return The number of batch jobs waiting for a reply to a message before they can continue to run. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getBatchJobsWaitingForMessage() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(1); - return BinaryConverter.byteArrayToInt(receiverVariables_[1], 44); - } - - /** - Returns the number of batch jobs on the system that are currently waiting to run, including those that were submitted to run at a future date and time. Jobs on the job schedule that have not been submitted are not included. - @return The number of batch jobs on the system that are currently waiting to run. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getBatchJobsWaitingToRunOrAlreadyScheduled() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(1); - return BinaryConverter.byteArrayToInt(receiverVariables_[1], 60); - } - - /** - Returns the amount (in number of physical processors) of current processing capacity of the partition. For a partition sharing physical processors, this attribute represents the share of the physical processors in the pool it is executing. - @return The amount of current processing capacity of the partition. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public float getCurrentProcessingCapacity() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 88) / 100.0f; - } - - /** - Returns the current amount of storage in use for temporary objects. This value is in millions of bytes. - @return The current amount of storage in use for temporary objects. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getCurrentUnprotectedStorageUsed() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 60); - } - - /** - Returns the date and time when the status was gathered. - @return The date and time when the status was gathered. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Date getDateAndTimeStatusGathered() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(0); - byte[] currentDateAndTime = new byte[8]; - System.arraycopy(receiverVariables_[0], 8, currentDateAndTime, 0, 8); - AS400Timestamp conv = getTimestampConverter(FORMAT_DTS); // field is in *DTS format - return conv.toDate(conv.toTimestamp(currentDateAndTime), system_.getTimeZone()); - } - - /** - Returns the time (in seconds) that has elapsed between the measurement start time and the current system time. - @return The time (in seconds) that has elapsed between the measurement start time and the current system time. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getElapsedTime() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!caching_) refreshCache(); - - int format; - if (receiverVariables_[2] == null) - { - if (receiverVariables_[3] == null) - { - loadInformation(2); - format = 2; - } - else - { - format = 3; - } - } - else - { - format = 2; - } - - // The value is in the format HHMMSS where HH is the hour, MM is the minute, and SS is the second. - int hours = (receiverVariables_[format][24] & 0x0F) * 10 + (receiverVariables_[format][25] & 0x0F); - int minutes = (receiverVariables_[format][26] & 0x0F) * 10 + (receiverVariables_[format][27] & 0x0F); - int seconds = (receiverVariables_[format][28] & 0x0F) * 10 + (receiverVariables_[format][29] & 0x0F); - return hours * 3600 + minutes * 60 + seconds; - } - - /** - Returns the total number of user jobs and system jobs that are currently in the system. The total includes: -
      -
    • All jobs on job queues waiting to be processed. -
    • All jobs currently active (being processed). -
    • All jobs that have completed running but still have pending job logs or output on output queues to be produced. -
    - @return The total number of user jobs and system jobs that are currently in the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getJobsInSystem() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 36); - } - - /** - Returns the amount of main storage, in kilobytes, in the system. On a partitioned system, the main storage size can change while the system is active. - @return The amount of main storage, in kilobytes, in the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getMainStorageSize() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - if (system_.getVRM() < 0x00050400) - { - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 72); - } - return BinaryConverter.byteArrayToLong(receiverVariables_[2], 140); - } - - /** - Returns the maximum number of jobs that are allowed on the system. When the number of jobs reaches this maximum, you can no longer submit or start more jobs on the system. The total includes: -
      -
    • All jobs on job queues waiting to be processed. -
    • All jobs currently active (being processed). -
    • All jobs that have completed running but still have output on output queues to be produced. -
    - @return The maximum number of jobs that are allowed on the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public long getMaximumJobsInSystem() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 108); - } - - /** - Returns the largest amount of storage for temporary object used at any one time since the last IPL. This value is in millions (M) of bytes. - @return The largest amount of storage for temporary object used at any one time since the last IPL. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getMaximumUnprotectedStorageUsed() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 64); - } - - /** - Returns the number of partitions on the system. This includes partitions that are currently powered on (running) and partitions that are powered off. - @return The number of partitions on the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getNumberOfPartitions() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 76); - } - - /** - Returns the number of processors that are currently active in this partition. - @return The number of processors that are currently active in this partition. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getNumberOfProcessors() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 96); - } - - /** - Returns the identifier for the current partition in which the API is running. - @return The identifier for the current partition in which the API is running. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getPartitionIdentifier() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 80); - } - - /** - Returns the percentage of interactive performance assigned to this logical partition. This value is a percentage of the total interactive performance available to the entire physical system. - @return The percentage of interactive performance assigned to this logical partition. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public float getPercentCurrentInteractivePerformance() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return (float)BinaryConverter.byteArrayToInt(receiverVariables_[2], 128); - } - - /** - Returns the percentage of processor database capability that was used during the elapsed time. Database capability is the maximum CPU utilization available for database processing on this system. -1 is returned if this system does not report the amount of CPU used for database processing. - @return The percentage of processor database capability that was used during the elapsed time. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public float getPercentDBCapability() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - int intValue = BinaryConverter.byteArrayToInt(receiverVariables_[2], 68); - return intValue == -1 ? -1f : intValue / 10.0f; - } - - /** - Returns the percentage of the maximum possible addresses for permanent objects that have been used. - @return The percentage of the maximum possible addresses for permanent objects that have been used. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public float getPercentPermanentAddresses() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 40) / 1000.0f; - } - - /** - Returns the percentage of the maximum possible permanent 256MB segments that have been used. - @return The percentage of the maximum possible permanent 256MB segments that have been used. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public float getPercentPermanent256MBSegmentsUsed() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 120) / 1000.0f; - } - - /** - Returns the percentage of the maximum possible permanent 4GB segments that have been used. - @return The percentage of the maximum possible permanent 4GB segments that have been used. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public float getPercentPermanent4GBSegmentsUsed() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 124) / 1000.0f; - } - - /** - Returns the average of the elapsed time during which the processing units were in use. For an uncapped partition, this is the percentage of the configured uncapped shared processing capacity for the partition that was used during the elapsed time. This percentage could be greater than 100% for an uncapped partition. - @return The average of the elapsed time during which the processing units were in use. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public float getPercentProcessingUnitUsed() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 32) / 10.0f; - } - - /** - Returns the percentage of the total shared processor pool capacity used by all partitions using the pool during the elapsed time. -1 is returned if this partition does not share processors. - @return The percentage of the total shared processor pool capacity used by all partitions using the pool during the elapsed time. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public float getPercentSharedProcessorPoolUsed() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - int intValue = BinaryConverter.byteArrayToInt(receiverVariables_[2], 136); - return system_.getVRM() < 0x00050300 || intValue == -1 ? -1f : intValue / 10.0f; - } - - /** - Returns the percentage of the system storage pool currently in use. - @return The percentage of the system storage pool currently in use. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public float getPercentSystemASPUsed() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 52) / 10000.0f; - } - - /** - Returns the percentage of the maximum possible addresses for temporary objects that have been used. - @return The percentage of the maximum possible addresses for temporary objects that have been used. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public float getPercentTemporaryAddresses() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 44) / 1000.0f; - } - - /** - Returns the percentage of the maximum possible temporary 256MB segments that have been used. - @return The percentage of the maximum possible temporary 256MB segments that have been used. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public float getPercentTemporary256MBSegmentsUsed() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 112) / 1000.0f; - } - - /** - Returns the percentage of the maximum possible temporary 4GB segments that have been used. - @return The percentage of the maximum possible temporary 4GB segments that have been used. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public float getPercentTemporary4GBSegmentsUsed() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 116) / 1000.0f; - } - - /** - Returns the percentage of the uncapped shared processing capacity for the partition that was used during the elapsed time. -1 is returned if this partition can not use more than its configured processing capacity. - @return The percentage of the uncapped shared processing capacity for the partition that was used during the elapsed time. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public float getPercentUncappedCPUCapacityUsed() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - int intValue = BinaryConverter.byteArrayToInt(receiverVariables_[2], 132); - return system_.getVRM() < 0x00050300 || intValue == -1 ? -1f : intValue / 10.0f; - } - - /** - Returns the number of system pools. - @return The number of system pools. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getPoolsNumber() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(3); - return BinaryConverter.byteArrayToInt(receiverVariables_[3], 32); - } - - /** - Returns the processor sharing attribute. This attribute indicates whether this partition is sharing processors. If the value indicates the partition does not share physical processors, then this partition uses only dedicated processors. If the value indicates the partition shares physical processors, then this partition uses physical processors from a shared pool of physical processors. The following values are returned: -
      -
    • 0: Partition does not share processors. -
    • 1: Partition shares processors (capped). The partition is limited to using its configured capacity. -
    • 2: Partition shares processors (uncapped). The partition can use more than its configured capacity. -
    - @return The processor sharing attribute. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getProcessorSharingAttribute() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return receiverVariables_[2][92] & 0x0F; - } - - /** - Returns the value indicating whether the system is in restricted state. - @return true if the system is in restricted state; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean getRestrictedStateFlag() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return receiverVariables_[2][30] == (byte)0xF1; - } - - /** - Returns the system object representing the system from which the system status information will be retrieved. - @return The system object representing the system from which the system status information will be retrieved. If the system has not been set, null is returned. - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - /** - Returns the storage capacity of the system auxiliary storage pool (ASP1). This value is in millions (M) of bytes. - @return The storage capacity of the system auxiliary storage pool (ASP1). - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getSystemASP() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 48); - } - - /** - Returns the name of the system where the statistics were collected. - @return The name of the system where the statistics were collected. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String getSystemName() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(0); - Converter conv = new Converter(system_.getJobCcsid(), system_); - return conv.byteArrayToString(receiverVariables_[0], 16, 8).trim(); - } - - /** - Returns an enumeration containing a SystemPool object for each system pool. - @return An enumeration containing a SystemPool object for each system pool. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Enumeration getSystemPools() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(3); - - // If we've already retrieved the pools, just return it. - if (poolsVector_ != null) return poolsVector_.elements(); - poolsVector_ = new Vector(); - - // Parse the pool information. - int number = BinaryConverter.byteArrayToInt(receiverVariables_[3], 32); - int offset = BinaryConverter.byteArrayToInt(receiverVariables_[3], 36); - int length = BinaryConverter.byteArrayToInt(receiverVariables_[3], 40); - - for (int i = 0; i < number; ++i) - { - byte[] poolInformation = new byte[length]; - System.arraycopy(receiverVariables_[3], offset, poolInformation, 0, length); - SystemPool systemPool = null; - int poolIdentifier = BinaryConverter.byteArrayToInt(poolInformation, 0); - if (poolIdentifier != 0) // this will usually (maybe always) be true - { - systemPool = new SystemPool(system_, poolIdentifier); - } - else { - String poolName = new CharConverter(system_.getJobCcsid(), system_).byteArrayToString(poolInformation, 44, 10); - systemPool = new SystemPool(system_, poolName); - } - poolsVector_.addElement(systemPool); - offset += length; - } - return poolsVector_.elements(); - } - - - private static final int FORMAT_DTS = AS400Timestamp.FORMAT_DTS; // *DTS format - private synchronized AS400Timestamp getTimestampConverter(int format) - { - if (timestampConverter_ == null) { - timestampConverter_ = new AS400Timestamp(); - timestampConverter_.setFormat(format); - } - else if (format != timestampConverter_.getFormat()) { - timestampConverter_.setFormat(format); - } - return timestampConverter_; - } - - - /** - Returns the total auxiliary storage (in millions of bytes) on the system. - @return The total auxiliary storage (in millions of bytes) on the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getTotalAuxiliaryStorage() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(2); - return BinaryConverter.byteArrayToInt(receiverVariables_[2], 56); - } - - /** - Returns the number of users currently signed on the system. System request jobs and group jobs are not included in this number. - @return The number of users currently signed on the system. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getUsersCurrentSignedOn() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(1); - return BinaryConverter.byteArrayToInt(receiverVariables_[1], 24); - } - - /** - Returns the number of sessions that have ended with printer output files waiting to print. - @return The number of sessions that have ended with printer output files waiting to print. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getUsersSignedOffWithPrinterOutputWaitingToPrint() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(1); - return BinaryConverter.byteArrayToInt(receiverVariables_[1], 40); - } - - /** - Returns the number of user jobs that have been temporarily suspended by group jobs so that another job may be run. - @return The number of user jobs that have been temporarily suspended by group jobs so that another job may be run. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getUsersSuspendedByGroupJobs() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(1); - return BinaryConverter.byteArrayToInt(receiverVariables_[1], 36); - } - - /** - Returns the number of user jobs that have been temporarily suspended by system request jobs so that another job may be run. - @return The number of user jobs that have been temporarily suspended by system request jobs so that another job may be run. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getUsersSuspendedBySystemRequest() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(1); - return BinaryConverter.byteArrayToInt(receiverVariables_[1], 32); - } - - /** - Returns the number of jobs that have been disconnected due to either the selection of option 80 (Temporary sign-off) or the entry of the Disconnect Job (DSCJOB) command. - @return The number of jobs that have been disconnected due to either the selection of option 80 (Temporary sign-off) or the entry of the Disconnect Job (DSCJOB) command. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getUsersTemporarilySignedOff() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - loadInformation(1); - return BinaryConverter.byteArrayToInt(receiverVariables_[1], 28); - } - - /** - Returns the current cache status. The default behavior is no caching. - @return true if caching is enabled, false otherwise. - @see #refreshCache - @see #setCaching - **/ - public boolean isCaching() - { - return caching_; - } - - // If necessary, call the API and retrieve the information for the specified format. - private void loadInformation(int format) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!caching_) refreshCache(); - - // Check to see if the format has been loaded already. - if (receiverVariables_[format] != null) return; - if (format == 0) format = 1; - - if (!connected_) - { - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - connected_ = true; - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving system status."); - int receiverVariableLength = format == 1 ? 80 : format == 2 ? 148 : 2048; - - ProgramParameter[] parameters = new ProgramParameter[] - { - // Receiver variable, output, char(*). - new ProgramParameter(receiverVariableLength), - // Receiver variable length, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(receiverVariableLength)), - // Format name, input, char(8), EBCDIC 'SSTS0X00'. - new ProgramParameter(new byte[] { (byte)0xE2, (byte)0xE2, (byte)0xE3, (byte)0xE2, (byte)0xF0, (byte)(0xF0 | format), (byte)0xF0, (byte)0xF0 } ), - // Reset status statistics, input, char(10), EBCDIC '*NO'. - new ProgramParameter(new byte[] { 0x5C, (byte)0xD5, (byte)0xD6, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 } ), - // Error code, I/O, char(*). - ERROR_CODE - }; - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QWCRSSTS.PGM", parameters); - // QWCRSSTS is not thread safe. - boolean repeatRun; - do - { - repeatRun = false; - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - - receiverVariables_[format] = parameters[0].getOutputData(); - - int bytesAvailable = BinaryConverter.byteArrayToInt(receiverVariables_[format], 0); - int bytesReturned = BinaryConverter.byteArrayToInt(receiverVariables_[format], 4); - if (bytesReturned < bytesAvailable) - { - repeatRun = true; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieve system status receiver variable too small, bytes returned: " + bytesReturned + ", bytes available: " + bytesAvailable); - parameters[0] = new ProgramParameter(bytesAvailable); - parameters[1] = new ProgramParameter(BinaryConverter.intToByteArray(bytesAvailable)); - } - } - while (repeatRun); - receiverVariables_[0] = receiverVariables_[format]; - } - - /** - Refreshes the current system status information. The currently cached data is cleared and new data will be retrieved from the system when needed. That is, after a call to refreshCache(), a call to one of the get() methods will go to the system to retrieve the value. If caching is not enabled, this method does nothing. - @see #isCaching - @see #setCaching - **/ - public void refreshCache() - { - // Clear the receiver variables; - receiverVariables_ = new byte[4][]; - // Clear the vector of pools. - poolsVector_ = null; - } - - /** - Removes the PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done. - @param listener The listener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes the VetoableChangeListener. If the VetoableChangeListener is not on the list, nothing is done. - @param listener The listener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - /** - Turns caching on or off. - @param caching true if caching should be used when getting information from the system; false if every get should communicate with the system immediately. The default behavior is no caching. - @see #isCaching - @see #refreshCache - **/ - public void setCaching(boolean caching) - { - caching_ = caching; - } - - /** - Sets the system object representing the system from which the system status information will be retrieved. This property cannot be changed if the object has established a connection to the system. - @param system The system object representing the system from which the system status information will be retrieved. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setSystem(AS400 system) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system: " + system); - - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (connected_) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - system_ = system; - } - else - { - AS400 oldValue = system_; - AS400 newValue = system; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("system", oldValue, newValue); - } - system_ = system; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("system", oldValue, newValue); - } - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SystemStatus16.gif b/cvsroot/src/com/ibm/as400/access/SystemStatus16.gif deleted file mode 100644 index e14c270fc..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/SystemStatus16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/SystemStatus32.gif b/cvsroot/src/com/ibm/as400/access/SystemStatus32.gif deleted file mode 100644 index 7a31daaf1..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/SystemStatus32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/SystemStatusBeanInfo.java b/cvsroot/src/com/ibm/as400/access/SystemStatusBeanInfo.java deleted file mode 100644 index 84ed338ca..000000000 --- a/cvsroot/src/com/ibm/as400/access/SystemStatusBeanInfo.java +++ /dev/null @@ -1,356 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemStatusBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.lang.reflect.Method; - - -/** - * The SystemStatusBeanInfo class provides bean information for the - * SystemStatus class. -**/ -public class SystemStatusBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private final static Class beanClass_ = SystemStatus.class; - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader loader_; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - // Static initializer. - static - { - try - { - // Property change events - EventSetDescriptor changed = new EventSetDescriptor(beanClass_, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - // Vetoable change events - EventSetDescriptor veto = new EventSetDescriptor(beanClass_, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - events_ = new EventSetDescriptor[] { changed, veto }; - - - - // Properties. - PropertyDescriptor dtg = new PropertyDescriptor("dateAndTimeStatusGathered", beanClass_, - "getDateAndTimeStatusGathered", null); - dtg.setBound(false); - dtg.setConstrained(false); - dtg.setDisplayName(loader_.getText("PROP_NAME_SS_DTG")); - dtg.setShortDescription(loader_.getText("PROP_DESC_SS_DTG")); - - - PropertyDescriptor ucso = new PropertyDescriptor("usersCurrentSignedOn", beanClass_, - "getUsersCurrentSignedOn", null); - ucso.setBound(false); - ucso.setConstrained(false); - ucso.setDisplayName(loader_.getText("PROP_NAME_SS_UCSO")); - ucso.setShortDescription(loader_.getText("PROP_DESC_SS_UCSO")); - - PropertyDescriptor utso = new PropertyDescriptor("usersTemporarilySignedOff", - beanClass_, - "getUsersTemporarilySignedOff", - null); - utso.setBound(false); - utso.setConstrained(false); - utso.setDisplayName(loader_.getText("PROP_NAME_SS_UTSO")); - utso.setShortDescription(loader_.getText("PROP_DESC_SS_UTSO")); - - PropertyDescriptor usbs = new PropertyDescriptor("usersSuspendedBySystemRequest", - beanClass_, - "getUsersSuspendedBySystemRequest", - null); - usbs.setBound(false); - usbs.setConstrained(false); - usbs.setDisplayName(loader_.getText("PROP_NAME_SS_USBS")); - usbs.setShortDescription(loader_.getText("PROP_DESC_SS_USBS")); - - PropertyDescriptor usowp = new PropertyDescriptor("usersSignedOffWithPrinterOutputWaitingToPrint", - beanClass_, - "getUsersSignedOffWithPrinterOutputWaitingToPrint", - null); - usowp.setBound(false); - usowp.setConstrained(false); - usowp.setDisplayName(loader_.getText("PROP_NAME_SS_USOWP")); - usowp.setShortDescription(loader_.getText("PROP_DESC_SS_USOWP")); - - PropertyDescriptor bjwm = new PropertyDescriptor("batchJobsWaitingForMessage", beanClass_, - "getBatchJobsWaitingForMessage", null); - bjwm.setBound(false); - bjwm.setConstrained(false); - bjwm.setDisplayName(loader_.getText("PROP_NAME_SS_BJWM")); - bjwm.setShortDescription(loader_.getText("PROP_DESC_SS_BJWM")); - - PropertyDescriptor bjr = new PropertyDescriptor("batchJobsRunning", beanClass_, - "getBatchJobsRunning", null); - bjr.setBound(false); - bjr.setConstrained(false); - bjr.setDisplayName(loader_.getText("PROP_NAME_SS_BJR")); - bjr.setShortDescription(loader_.getText("PROP_DESC_SS_BJR")); - - PropertyDescriptor bjhr = new PropertyDescriptor("batchJobsHeldWhileRunning", beanClass_, - "getBatchJobsHeldWhileRunning", null); - bjhr.setBound(false); - bjhr.setConstrained(false); - bjhr.setDisplayName(loader_.getText("PROP_NAME_SS_BJHR")); - bjhr.setShortDescription(loader_.getText("PROP_DESC_SS_BJHR")); - - PropertyDescriptor bje = new PropertyDescriptor("batchJobsEnding", beanClass_, - "getBatchJobsEnding", null); - bje.setBound(false); - bje.setConstrained(false); - bje.setDisplayName(loader_.getText("PROP_NAME_SS_BJE")); - bje.setShortDescription(loader_.getText("PROP_DESC_SS_BJE")); - - PropertyDescriptor bjwr = new PropertyDescriptor("batchJobsWaitingToRunOrAlreadyScheduled", - beanClass_, - "getBatchJobsWaitingToRunOrAlreadyScheduled", - null); - bjwr.setBound(false); - bjwr.setConstrained(false); - bjwr.setDisplayName(loader_.getText("PROP_NAME_SS_BJWR")); - bjwr.setShortDescription(loader_.getText("PROP_DESC_SS_BJWR")); - - PropertyDescriptor bjh = new PropertyDescriptor("batchJobsHeldOnJobQueue", beanClass_, - "getBatchJobsHeldOnJobQueue", null); - bjh.setBound(false); - bjh.setConstrained(false); - bjh.setDisplayName(loader_.getText("PROP_NAME_SS_BJH")); - bjh.setShortDescription(loader_.getText("PROP_DESC_SS_BJH")); - - PropertyDescriptor bju = new PropertyDescriptor("batchJobsOnUnassignedJobQueue", beanClass_, - "getBatchJobsOnUnassignedJobQueue", null); - bju.setBound(false); - bju.setConstrained(false); - bju.setDisplayName(loader_.getText("PROP_NAME_SS_BJU")); - bju.setShortDescription(loader_.getText("PROP_DESC_SS_BJU")); - - PropertyDescriptor et = new PropertyDescriptor("elapsedTime", beanClass_, - "getElapsedTime", null); - et.setBound(false); - et.setConstrained(false); - et.setDisplayName(loader_.getText("PROP_NAME_SS_ET")); - et.setShortDescription(loader_.getText("PROP_DESC_SS_ET")); - - PropertyDescriptor mus = new PropertyDescriptor("maximumUnprotectedStorageUsed", beanClass_, - "getMaximumUnprotectedStorageUsed", null); - mus.setBound(false); - mus.setConstrained(false); - mus.setDisplayName(loader_.getText("PROP_NAME_SS_MUS")); - mus.setShortDescription(loader_.getText("PROP_DESC_SS_MUS")); - - PropertyDescriptor ppa = new PropertyDescriptor("percentPermanentAddresses", beanClass_, - "getPercentPermanentAddresses", null); - ppa.setBound(false); - ppa.setConstrained(false); - ppa.setDisplayName(loader_.getText("PROP_NAME_SS_PPA")); - ppa.setShortDescription(loader_.getText("PROP_DESC_SS_PPA")); - - PropertyDescriptor ppu = new PropertyDescriptor("percentProcessingUnitUsed", beanClass_, - "getPercentProcessingUnitUsed", null); - ppu.setBound(false); - ppu.setConstrained(false); - ppu.setDisplayName(loader_.getText("PROP_NAME_SS_PPU")); - ppu.setShortDescription(loader_.getText("PROP_DESC_SS_PPU")); - - PropertyDescriptor sasp = new PropertyDescriptor("percentSystemASPUsed", beanClass_, - "getPercentSystemASPUsed", null); - sasp.setBound(false); - sasp.setConstrained(false); - sasp.setDisplayName(loader_.getText("PROP_NAME_SS_SASP")); - sasp.setShortDescription(loader_.getText("PROP_DESC_SS_SASP")); - - PropertyDescriptor pta = new PropertyDescriptor("percentTemporaryAddresses", beanClass_, - "getPercentTemporaryAddresses", null); - pta.setBound(false); - pta.setConstrained(false); - pta.setDisplayName(loader_.getText("PROP_NAME_SS_PTA")); - pta.setShortDescription(loader_.getText("PROP_DESC_SS_PTA")); - - PropertyDescriptor pn = new PropertyDescriptor("poolsNumber", beanClass_, - "getPoolsNumber", null); - pn.setBound(false); - pn.setConstrained(false); - pn.setDisplayName(loader_.getText("PROP_NAME_SS_PN")); - pn.setShortDescription(loader_.getText("PROP_DESC_SS_PN")); - - PropertyDescriptor rsf = new PropertyDescriptor("restrictedStateFlag", beanClass_, - "getRestrictedStateFlag", null); - rsf.setBound(false); - rsf.setConstrained(false); - rsf.setDisplayName(loader_.getText("PROP_NAME_SS_RSF")); - rsf.setShortDescription(loader_.getText("PROP_DESC_SS_RSF")); - - PropertyDescriptor system = new PropertyDescriptor("system", beanClass_, - "getSystem", "setSystem"); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(loader_.getText("PROP_NAME_AS400_SYSTEM")); - system.setShortDescription(loader_.getText("PROP_DESC_AS400_SYSTEM")); - - PropertyDescriptor systemASP = new PropertyDescriptor("systemASP", beanClass_, - "getSystemASP", null); - systemASP.setBound(false); - systemASP.setConstrained(false); - systemASP.setDisplayName(loader_.getText("PROP_NAME_SS_SYSTEMASP")); - systemASP.setShortDescription(loader_.getText("PROP_DESC_SS_SYSTEMASP")); - - PropertyDescriptor syspool = new PropertyDescriptor("systemPools", beanClass_, - "getSystemPools", null); - syspool.setBound(false); - syspool.setConstrained(false); - syspool.setDisplayName(loader_.getText("PROP_NAME_SS_SYSPOOL")); - syspool.setShortDescription(loader_.getText("PROP_DESC_SS_SYSPOOL")); - - PropertyDescriptor tas = new PropertyDescriptor("totalAuxiliaryStorage", beanClass_, - "getTotalAuxiliaryStorage", null); - tas.setBound(false); - tas.setConstrained(false); - tas.setDisplayName(loader_.getText("PROP_NAME_SS_TAS")); - tas.setShortDescription(loader_.getText("PROP_DESC_SS_TAS")); - - properties_ = new PropertyDescriptor[]{ - bje, - bjh, - bjhr, - bju, - bjr, - bjwm, - bjwr, - dtg, - et, - mus, - ppa, - ppu, - sasp, - pta, - pn, - rsf, - system, - systemASP, - syspool, - tas, - ucso, - usowp, - usbs, - utso - }; - } - catch(IntrospectionException e) - { e.printStackTrace(); - throw new Error(e.toString()); - } - } - /** - * Returns the bean descriptor. - * - * @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - /** - * Returns the default event index. - * @return The default event index (always 1). - **/ - public int getDefaultEventIndex() - { - return 1; - } - - /** - * Returns the default property index. - * @return The default property index (always 0). - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - * Returns the descriptors for all events. - * @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - */ - public Image getIcon(int icon) - { - if(icon== BeanInfo.ICON_MONO_16x16) - { - java.awt.Image img = loadImage("SystemStatus16.gif"); - return img; - } - else if(icon== BeanInfo.ICON_COLOR_16x16) - { - java.awt.Image img = loadImage("SystemStatus16.gif"); - return img; - } - else if(icon == BeanInfo.ICON_MONO_32x32) - { - java.awt.Image img = loadImage("SystemStatus32.gif"); - return img; - } - else if(icon == BeanInfo.ICON_COLOR_32x32) - { - java.awt.Image img = loadImage("SystemStatus32.gif"); - return img; - } - return null; - } - - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/SystemStatusFormat.java b/cvsroot/src/com/ibm/as400/access/SystemStatusFormat.java deleted file mode 100644 index dcd2d1bf2..000000000 --- a/cvsroot/src/com/ibm/as400/access/SystemStatusFormat.java +++ /dev/null @@ -1,80 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: SystemStatusFormat.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; - -/** -The SystemStatusFormat class is the parent class for the different -types of formats on the QWCRSSTS API. -**/ -class SystemStatusFormat extends RecordFormat -{ - static final long serialVersionUID = 4L; - - static AS400Bin4 bin4 = new AS400Bin4(); - static AS400Bin8 bin8; - AS400 system_; - - SystemStatusFormat(AS400 sys) - { - system_ = sys; - addBin4("numberOfBytesAvailable"); - addBin4("numberOfBytesReturned"); - addFieldDescription(new HexFieldDescription(new AS400ByteArray(8), "currentDateAndTime")); - addChar(8, "systemName"); - } - - /** - * Adds a binary field description to this format. - **/ - void addBin4(String name) - { - addFieldDescription(new BinaryFieldDescription(bin4, name)); - } - - /** - * Adds a binary field description to this format. - **/ - void addBin8(String name) - { - if (bin8 == null) bin8 = new AS400Bin8(); - addFieldDescription(new BinaryFieldDescription(bin8, name)); - } - - /** - * Adds a character field description to this format. - **/ - void addChar(int length, String name) - { - addFieldDescription(new CharacterFieldDescription(new AS400Text(length, system_.getCcsid(), system_), name)); - } - - /** - * Sets the name of this format. - **/ - public void setName(String name) - { - try - { - super.setName(name); - } - catch(PropertyVetoException e) - { - // Quiet the compiler. - } - } -} - - diff --git a/cvsroot/src/com/ibm/as400/access/SystemValue.java b/cvsroot/src/com/ibm/as400/access/SystemValue.java deleted file mode 100644 index 646436e2e..000000000 --- a/cvsroot/src/com/ibm/as400/access/SystemValue.java +++ /dev/null @@ -1,613 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemValue.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.Serializable; -import java.util.Vector; - -/** - The SystemValue class represents a system value or network attribute on the system. - **/ -public class SystemValue implements Serializable -{ - static final long serialVersionUID = 4L; - - // The system where the system value is located. - private AS400 system_ = null; - // The properties of this system value. - SystemValueInfo info_ = null; // Also accessed by SystemValueGroup. - // The actual data to which this system value is set. - Object value_ = null; // Also accessed by SystemValueGroup. - - // The user-defined group name. - private String groupName_ = null; - // The user-defined group description. - private String groupDescription_ = null; - - // Locale specific MRI description. - private String localeDescription_ = null; - - // Flag indicating this system value has been read from the system. - transient private boolean cached_ = false; - // Flag indicating if a connection been made. - transient private boolean connected_ = false; - - // List of system value event bean listeners. - transient private Vector systemValueListeners_ = null; // Set on first add. - // List of property change event bean listeners. - transient private PropertyChangeSupport propertyChangeListeners_ = null; // Set on first add. - // List of vetoable change event bean listeners. - transient private VetoableChangeSupport vetoableChangeListeners_ = null; // Set on first add. - - /** - Constructs a SystemValue object. It creates a default SystemValue. The system and name properties must be set before attempting a connection. - **/ - public SystemValue() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SystemValue object."); - } - - /** - Constructs a SystemValue object. It creates a SystemValue instance that represents the system value name on system. - @param system The system object representing the system on which the system value exists. - @param name The name of the system value. - **/ - public SystemValue(AS400 system, String name) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SystemValue object, system: " + system + ", name: " + name); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (name == null) - { - Trace.log(Trace.ERROR, "Parameter 'name' is null."); - throw new NullPointerException("name"); - } - if (name.length() == 0) - { - Trace.log(Trace.ERROR, "Length of parameter 'name' is not valid: '" + name + "'"); - throw new ExtendedIllegalArgumentException("name (" + name + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - system_ = system; - info_ = SystemValueList.lookup(name.toUpperCase()); - localeDescription_ = SystemValueList.lookupDescription(info_, system.getLocale()); - } - - // This constructor is used by SystemValueUtility to fill in all of the internal data for a SystemValue object when it comes from the API call. - // Note that the SystemValue's cached_ flag is set to true. - SystemValue(AS400 system, SystemValueInfo info, Object value, String groupName, String groupDescription) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SystemValue object, system: " + system + ", group name: " + groupName); - system_ = system; - info_ = info; - value_ = value; - - groupName_ = groupName; - groupDescription_ = groupDescription; - - localeDescription_ = SystemValueList.lookupDescription(info_, system.getLocale()); - - cached_ = true; - connected_ = true; - } - - /** - Adds an SystemValueListener. The specified SystemValueListener's systemValueChanged method will be called each time a system value has been changed. The SystemValueListener object is added to a list of SystemValueListeners managed by this SystemValue. It can be removed with removeSystemValueListener. - @param listener The listener object. - **/ - public void addSystemValueListener(SystemValueListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding system value listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (systemValueListeners_ == null) - { - systemValueListeners_ = new Vector(); - } - systemValueListeners_.addElement(listener); - } - } - - /** - Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method will be called each time the value of any bound property is changed. The PropertyChangeListener object is added to a list of PropertyChangeListeners managed by this SystemValue. It can be removed with removePropertyChangeListener. - @param listener The listener object. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Adds a VetoableChangeListener. The specified VetoableChangeListener's vetoableChange method will be called each time the value of any constrained property is changed. - @param listener The listener object. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - } - - /** - Clears this system value from the cache. The next time a getValue() is performed on this system value, the value will be retrieved from the system instead of from the cache. - **/ - public void clear() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Clearing system value from cache."); - cached_ = false; - } - - // Makes a "connection" to the system. The system and name properties must be set before a connection can be made. - private void connect() throws AS400SecurityException, IOException, RequestNotSupportedException - { - // Verify required attributes have been set. - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (info_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect before setting name."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Check if the system value is supported on this system. - // Also don't want to prohibit the user from running to a pre-V4R2 system, even though we do not support it. - if (info_.release_ > system_.getVRM() && info_.release_ != 0x00040200) - { - byte[] vrmBytes = BinaryConverter.intToByteArray(info_.release_); - Trace.log(Trace.ERROR, "System not at correct release for system value, name: " + info_.name_ + ", release:", vrmBytes); - throw new RequestNotSupportedException(info_.name_, RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - } - connected_ = true; - } - - // Fires the event. - // @param oldValue The old value. - // @param newValue The new value. - private void fireChangedEvent(Object oldValue, Object newValue) - { - // If we have made it this far, we know we have listeners. - Vector targets = (Vector)systemValueListeners_.clone(); - SystemValueEvent event = new SystemValueEvent(this, oldValue, newValue); - for (int i = 0; i < targets.size(); ++i) - { - SystemValueListener target = (SystemValueListener)targets.elementAt(i); - target.systemValueChanged(event); - } - } - - /** - Returns the description for this system value. - @return The description for the system value. - **/ - public String getDescription() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system value description."); - if (info_ == null) - { - Trace.log(Trace.ERROR, "Cannot get description before system value name is set."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - String description = (localeDescription_ == null) ? info_.description_ : localeDescription_; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Description: " + description); - return description; - } - - /** - Returns the system value group to which this system value belongs. Possible values are: -
      -
    • GROUP_ALC -
    • GROUP_ALL -
    • GROUP_DATTIM -
    • GROUP_EDT -
    • GROUP_LIBL -
    • GROUP_MSG -
    • GROUP_NET -
    • GROUP_SEC -
    • GROUP_STG -
    • GROUP_SYSCTL -
    - @see SystemValueList - @return The system value group. - **/ - public int getGroup() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system value group."); - if (info_ == null) - { - Trace.log(Trace.ERROR, "Cannot get group before system value name is set."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - int group = info_.group_; - - // QFRCCVNRST was in group SYSCTL in release V5R1M0 and below, and moved to group SEC in V5R2M0 and above. By default we have it in group SEC, so if the system release is V5R1M0 or below, we fix up the group here. - try - { - if (system_ != null && info_.name_.equals("QFRCCVNRST") && system_.getVRM() <= 0x00050100) - { - group = SystemValueList.GROUP_SYSCTL; - } - } - catch (Exception e) - { - // If there is an exception getting the system VRM, do nothing. - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Couldn't retrieve VRM for system value:", e); - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Group:", group); - return group; - } - - /** - Returns the user-defined group description. If this system value was not generated by the SystemValueGroup class, then null is returned. - @return The group description. - **/ - public String getGroupDescription() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system value group description: " + groupDescription_); - return groupDescription_; - } - - /** - Returns the user-defined group name. If this system value was not generated by the SystemValueGroup class, then null is returned. - @return The group name. - **/ - public String getGroupName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system value group name: " + groupName_); - return groupName_; - } - - /** - Returns the name of this system value. If the name has not been set null is returned. - @return The name of the system value. - **/ - public String getName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system value name."); - String name = (info_ == null) ? null : info_.name_; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Name: " + name); - return name; - } - - /** - Returns the supported release for this system value. The returned value is the earliest version of IBM i under which the system value is supported. If the system value is supported in a release prior to V4R2M0, then V4R2M0 is returned. - @see AS400#generateVRM - @return The release. - **/ - public int getRelease() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system value release."); - if (info_ == null) - { - Trace.log(Trace.ERROR, "Cannot get release before system value name is set."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (Trace.traceOn_) - { - byte[] vrmBytes = BinaryConverter.intToByteArray(info_.release_); - Trace.log(Trace.DIAGNOSTIC, "Release:", vrmBytes); - } - return info_.release_; - } - - /** - Returns the length (in bytes) of this system value's data value component. For system values that are of type {@link SystemValueList#TYPE_ARRAY TYPE_ARRAY}, this method returns the total size of the data value. - @return The size. - **/ - public int getSize() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system value size."); - if (info_ == null) - { - Trace.log(Trace.ERROR, "Cannot get size before system value name is set."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - int size = (info_.type_ == SystemValueList.TYPE_ARRAY) ? info_.size_ * info_.arraySize_ : info_.size_; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Size:", size); - return size; - } - - /** - Returns the system object representing the system on which the system value exists. - @return The system object representing the system on which the system value exists. If the system has not been set, null is returned. - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - /** - Returns the type for this system value. Possible values are: -
      -
    • {@link SystemValueList#TYPE_ARRAY TYPE_ARRAY} - The data contained by this system value is a String[] object. -
    • {@link SystemValueList#TYPE_DATE TYPE_DATE} - The data contained by this system value is a Date object. -
    • {@link SystemValueList#TYPE_DECIMAL TYPE_DECIMAL} - The data contained by this system value is a BigDecimal object. -
    • {@link SystemValueList#TYPE_INTEGER TYPE_INTEGER} - The data contained by this system value is an Integer object. -
    • {@link SystemValueList#TYPE_STRING TYPE_STRING} - The data contained by this system value is a String object. -
    - @see SystemValueList - @return The return type. - **/ - public int getType() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system value type."); - if (info_ == null) - { - Trace.log(Trace.ERROR, "Cannot get type before system value name is set."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Type:", info_.type_); - return info_.type_; - } - - /** - Returns the current value of this system value. Use {@link #getType getType()} to determine the type of the returned object. For example, some system values are represented as arrays of String. - @see #getType - @return The data. Never returns null. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @exception RequestNotSupportedException If the IBM i release level of the system does not support the system value. - **/ - public Object getValue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, RequestNotSupportedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system value value."); - if (!connected_) connect(); - - if (!cached_) - { - // Retrieve the value here. - value_ = SystemValueUtility.retrieve(system_, info_); - cached_ = true; - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Value: " + value_); - return value_; - } - - /** - Indicates if this system value is read only or if it can be set by the user. - @return true if the system value is read only; false otherwise. - **/ - public boolean isReadOnly() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if system value is read only."); - if (info_ == null) - { - Trace.log(Trace.ERROR, "Cannot determine read only before system value name is set."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Read only:", info_.readOnly_); - return info_.readOnly_; - } - - /** - Removes the SystemValueListener. If the SystemValueListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removeSystemValueListener(SystemValueListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing system value listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (systemValueListeners_ != null) - { - systemValueListeners_.removeElement(listener); - } - } - - /** - Removes the PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes the VetoableChangeListener. If the VetoableChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - /** - Sets the system value name. - @param name The system value. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setName(String name) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system value name: " + name); - if (name == null) - { - Trace.log(Trace.ERROR, "Parameter 'name' is null."); - throw new NullPointerException("name"); - } - if (connected_) - { - Trace.log(Trace.ERROR, "Cannot set property 'name' after connect."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - // Set instance variables. - info_ = SystemValueList.lookup(name.toUpperCase()); - localeDescription_ = (system_ != null) ? SystemValueList.lookupDescription(info_, system_.getLocale()) : null; - } - else - { - String oldValue = (info_ != null) ? info_.name_ : null; - SystemValueInfo info = SystemValueList.lookup(name.toUpperCase()); - String newValue = info.name_; - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("name", oldValue, newValue); - } - info_ = info; - localeDescription_ = (system_ != null) ? SystemValueList.lookupDescription(info_, system_.getLocale()) : null; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("name", oldValue, newValue); - } - } - } - - /** - Sets the system object representing the system on which the system value exists. - @param system The system object representing the system on which the system value exists. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setSystem(AS400 system) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system: " + system); - - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (connected_) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - system_ = system; - localeDescription_ = (info_ != null) ? SystemValueList.lookupDescription(info_, system_.getLocale()) : null; - } - else - { - AS400 oldValue = system_; - AS400 newValue = system; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("system", oldValue, newValue); - } - system_ = system; - localeDescription_ = (info_ != null) ? SystemValueList.lookupDescription(info_, system_.getLocale()) : null; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("system", oldValue, newValue); - } - } - } - - /** - Sets the value for this system value. Use {@link #getType getType()} to determine the type of object to set. For example, some system values are represented as arrays of String. - @see #getType - @param value The data. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception RequestNotSupportedException If the IBM i release level of the system does not support the system value. - **/ - public void setValue(Object value) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, RequestNotSupportedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system value value: " + value); - if (value == null) - { - Trace.log(Trace.ERROR, "Parameter 'value' is null."); - throw new NullPointerException("value"); - } - - if (!connected_) connect(); - - SystemValueUtility.set(system_, info_, value); - value_ = value; - cached_ = true; - if (systemValueListeners_ != null) fireChangedEvent(value_, value); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SystemValue16.gif b/cvsroot/src/com/ibm/as400/access/SystemValue16.gif deleted file mode 100644 index 92c28ce6e..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/SystemValue16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/SystemValue32.gif b/cvsroot/src/com/ibm/as400/access/SystemValue32.gif deleted file mode 100644 index d54eed317..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/SystemValue32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/SystemValueBeanInfo.java b/cvsroot/src/com/ibm/as400/access/SystemValueBeanInfo.java deleted file mode 100644 index ce573cc21..000000000 --- a/cvsroot/src/com/ibm/as400/access/SystemValueBeanInfo.java +++ /dev/null @@ -1,141 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemValueBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - The SystemValueBeanInfo class provides bean information for the SystemValue class. - **/ -public class SystemValueBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private static final Class BEAN_CLASS = SystemValue.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - EventSetDescriptor systemValue = new EventSetDescriptor(BEAN_CLASS, "systemValue", SystemValueListener.class, "systemValueChanged"); - systemValue.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_SV_EVENT")); - systemValue.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_SV_EVENT")); - - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - - eventSetDescriptors = new EventSetDescriptor[] { systemValue, propertyChange, vetoableChange }; - - PropertyDescriptor name = new PropertyDescriptor("name", BEAN_CLASS); - name.setBound(true); - name.setConstrained(true); - name.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_NAME")); - name.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_NAME")); - - PropertyDescriptor system = new PropertyDescriptor("system", BEAN_CLASS); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - - propertyDescriptors = new PropertyDescriptor[] { name, system }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return One (1), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "propertyChange" event. - return 1; - } - - /** - Returns the index of the default property. - @return Zero (0), the index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // The index for the "name" property. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("SystemValue16.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("SystemValue32.gif"); - } - return null; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SystemValueEvent.java b/cvsroot/src/com/ibm/as400/access/SystemValueEvent.java deleted file mode 100644 index b6907831e..000000000 --- a/cvsroot/src/com/ibm/as400/access/SystemValueEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemValueEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.EventObject; - -/** - The SystemValueEvent class represents a system value event. - @see SystemValueListener - **/ -public class SystemValueEvent extends EventObject -{ - static final long serialVersionUID = 4L; - - // Private data - private Object newValue_; - private Object oldValue_; - - /** - Constructs a new SystemValueEvent object. - @param source The source of the event. - @param newValue The new value. - @param oldValue The old value. - **/ - public SystemValueEvent(Object source, Object newValue, Object oldValue) - { - super(source); - newValue_ = newValue; - oldValue_ = oldValue; - } - - /** - Returns the new value of the system value. - @return The new value of the system value. - **/ - public Object getNewValue() - { - return newValue_; - } - - /** - Returns the old value of the system value. - @return The old value of the system value. - **/ - public Object getOldValue() - { - return oldValue_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SystemValueGroup.java b/cvsroot/src/com/ibm/as400/access/SystemValueGroup.java deleted file mode 100644 index 338a604a8..000000000 --- a/cvsroot/src/com/ibm/as400/access/SystemValueGroup.java +++ /dev/null @@ -1,695 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemValueGroup.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.Serializable; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -/** - The SystemValueGroup class represents a user-defined collection of system values and network attributes. It is not as much a container for SystemValue objects as it is a factory for generating collections of SystemValues having certain attributes. - @see com.ibm.as400.access.SystemValue - @see com.ibm.as400.access.SystemValueList - **/ -public class SystemValueGroup implements Serializable -{ - static final long serialVersionUID = 4L; - - // The system where the group of system values is located. - private AS400 system_ = null; - // The user-defined group name. - private String groupName_ = null; - // The user-defined group description. - private String groupDescription_ = null; - - // Contains a list of SystemValueInfo objects. - private Vector infos_ = null; - - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_ = null; // Set on first add. - // List of vetoable change event bean listeners. - private transient VetoableChangeSupport vetoableChangeListeners_ = null; // Set on first add. - - /** - Constructs a SystemValueGroup object. The system property must be set before attempting a connection. - @see #setSystem - **/ - public SystemValueGroup() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SystemValueGroup object."); - infos_ = new Vector(); - } - - /** - Constructs a SystemValueGroup object. The group of system value names is initialized to be empty. - @param system The system that this group of system value names references. - @param groupName The user-defined group name to be used. - @param groupDescription The user-defined group description to be used. - **/ - public SystemValueGroup(AS400 system, String groupName, String groupDescription) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SystemValueGroup object, system: " + system + ", group name: " + groupName); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (groupName == null) - { - Trace.log(Trace.ERROR, "Parameter 'groupName' is null."); - throw new NullPointerException("groupName"); - } - if (groupDescription == null) - { - Trace.log(Trace.ERROR, "Parameter 'groupDescription' is null."); - throw new NullPointerException("groupDescription"); - } - - system_ = system; - groupName_ = groupName; - groupDescription_ = groupDescription; - infos_ = new Vector(); - } - - /** - Constructs a SystemValueGroup object. The group of system value names is initialized to contain the system value names in names. - @param system The system that this group of system value names references. - @param groupName The user-defined group name to be used. - @param groupDescription The user-defined group description to be used. - @param names The array of system value names to be initially added to this group. - **/ - public SystemValueGroup(AS400 system, String groupName, String groupDescription, String[] names) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SystemValueGroup object, system: " + system + ", group name: " + groupName); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (groupName == null) - { - Trace.log(Trace.ERROR, "Parameter 'groupName' is null."); - throw new NullPointerException("groupName"); - } - if (groupDescription == null) - { - Trace.log(Trace.ERROR, "Parameter 'groupDescription' is null."); - throw new NullPointerException("groupDescription"); - } - if (names == null) - { - Trace.log(Trace.ERROR, "Parameter 'names' is null."); - throw new NullPointerException("names"); - } - - system_ = system; - groupName_ = groupName; - groupDescription_ = groupDescription; - infos_ = new Vector(names.length); - for (int i = 0; i < names.length; ++i) add(names[i]); - } - - /** - Constructs a SystemValueGroup object. The group of system value names is initialized to contain all of the system value names in the system-defined group groupIndicator. For example, specifying SystemValueList.GROUP_ALL for groupIndicator would result in this group of system value names being initialized to contain all system value and network attribute names. -

    Note: This constructor now makes a connection to the system in order to retrieve the IBM i release level of the system. - @param system The system that this group of system values references. - @param groupName The user-defined group name to be used. - @param groupDescription The user-defined group description to be used. - @param group The system value group constant indicating the set of system value names to be initially added to this group. Valid constants are defined in the SystemValueList class. - @see com.ibm.as400.access.SystemValueList - @see com.ibm.as400.access.SystemValueList#GROUP_ALL - **/ - public SystemValueGroup(AS400 system, String groupName, String groupDescription, int group) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SystemValueGroup object, system: " + system + ", group name: " + groupName + ", group:", group); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (groupName == null) - { - Trace.log(Trace.ERROR, "Parameter 'groupName' is null."); - throw new NullPointerException("groupName"); - } - if (groupDescription == null) - { - Trace.log(Trace.ERROR, "Parameter 'groupDescription' is null."); - throw new NullPointerException("groupDescription"); - } - if (group < 0 || group > SystemValueList.GROUP_ALL) - { - Trace.log(Trace.ERROR, "Value of parameter 'group' is not valid:", group); - throw new ExtendedIllegalArgumentException("group", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - system_ = system; - groupName_ = groupName; - groupDescription_ = groupDescription; - - // If we can't get the vrm, add all the values. - int vrm = 0x7FFFFFFF; - try - { - vrm = system.getVRM(); - } - catch (Exception e) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Couldn't retrieve VRM for system value group:", e); - } - - // Copy all the SystemValueInfo objects for the release into this object's Vector. - Vector groupInfos = SystemValueList.groups[group]; - int length = groupInfos.size(); - infos_ = new Vector(length); - for (int i = 0; i < length; ++i) - { - SystemValueInfo info = (SystemValueInfo)groupInfos.elementAt(i); - if (info.release_ <= vrm) - { - // Copy the SystemValueInfo objects into the new Vector. - infos_.addElement(info); - } - } - - // QFRCCVNRST was in group SYSCTL in release V5R1M0 and below, and moved to group SEC in V5R2M0 and above. By default we have it in group SEC, so if the system release is V5R1M0 or below, we fix up the group here. - if (vrm <= 0x00050100) - { - switch (group) - { - case SystemValueList.GROUP_SEC: - // Remove QFRCCVNRST from group SEC. - infos_.removeElement(SystemValueList.lookup("QFRCCVNRST")); - break; - case SystemValueList.GROUP_SYSCTL: - // Add QFRCCVNRST to group SYSCTL. - infos_.addElement(SystemValueList.lookup("QFRCCVNRST")); - break; - } - } - } - - /** - Adds a system value name to this group. All names in this group must be unique, so if name already exists in this group, it is ignored. - @param name The system value name to be added to this group. - @see #contains - @see #getNames - @see #remove - **/ - public void add(String name) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding to system value group, name: " + name); - if (name == null) - { - Trace.log(Trace.ERROR, "Parameter 'name' is null."); - throw new NullPointerException("name"); - } - - // Validates the String to make sure it's a valid system value. - SystemValueInfo info = SystemValueList.lookup(name.toUpperCase()); - - synchronized (infos_) - { - if (!infos_.contains(info)) infos_.addElement(info); - } - } - - /** - Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method will be called each time the value of any bound property is changed. The PropertyChangeListener object is added to a list of PropertyChangeListeners managed by this SystemValueGroup. It can be removed with removePropertyChangeListener. - @param listener The listener object. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Adds a VetoableChangeListener. The specified VetoableChangeListener's vetoableChange method will be called each time the value of any constrained property is changed. - @param listener The listener object. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - } - - /** - Determines if a system value name is part of this group. - @param name The system value name in question. - @return Returns true if the system value is part of this group; false otherwise. - @see #add - @see #getNames - @see #remove - **/ - public boolean contains(String name) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if system value group contains, name: " + name); - if (name == null) - { - Trace.log(Trace.ERROR, "Parameter 'name' is null."); - throw new NullPointerException("name"); - } - - SystemValueInfo info = SystemValueList.lookup(name.toUpperCase()); - - synchronized (infos_) - { - return infos_.contains(info); - } - } - - /** - Returns the user-defined description for this group. - @return The group description. - @see #setGroupDescription - **/ - public String getGroupDescription() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system value group description: " + groupDescription_); - return groupDescription_; - } - - /** - Returns the user-defined name for this group. - @return The group name. - @see #setGroupName - **/ - public String getGroupName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system value group name: " + groupName_); - return groupName_; - } - - /** - Returns the system value names that are currently part of this group. - @return An array of system value names. - @see #add - @see #contains - @see #remove - **/ - public String[] getNames() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system value group names."); - synchronized (infos_) - { - int length = infos_.size(); - String[] names = new String[length]; - for (int i = 0; i < length; ++i) - { - names[i] = ((SystemValueInfo)infos_.elementAt(i)).name_; - } - return names; - } - } - - /** - Returns the system object representing the system on which the system value group exists. - @return The system object representing the system on which the system value group exists. If the system has not been set, null is returned. - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - /** - Returns newly-generated SystemValue objects representing the system values in this group. The SystemValue objects in the Vector are sorted by system value name. -

    If any value in this group is not supported by this group's system, its corresponding SystemValue object will not be returned in the Vector. Therefore, the number of SystemValue objects in the returned Vector may not be the same as the number of system value names represented by this group. -

    To refresh the values in a Vector of SystemValues, use the refresh() method. - @return A Vector of SystemValue objects. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #refresh - **/ - public Vector getSystemValues() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system values, system: " + system_ + " group name: " + groupName_); - // Make sure they've set the system, we don't care about the name or description. - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to system before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - Vector systemValues = null; - synchronized (infos_) - { - systemValues = SystemValueUtility.retrieve(system_, infos_.elements(), groupName_, groupDescription_); - } - // Separate the sort from the retrieve so we are synchronized as short as possible. - return SystemValueList.sort(systemValues); - } - - /** - Retrieves new values for the SystemValue objects in the Vector. The SystemValue objects in systemValues have their values refreshed from their respective systems. This method does not create new SystemValue objects; rather, it refreshes all SystemValue objects at once for a given system, which is more efficient than calling clear() on each SystemValue. All objects in systemValues must be SystemValue objects. - @param systemValues The group of SystemValue objects to be refreshed. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see com.ibm.as400.access.SystemValue#clear - **/ - public static void refresh(Vector systemValues) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Refreshing system values."); - if (systemValues == null) - { - Trace.log(Trace.ERROR, "Parameter 'systemValues' is null."); - throw new NullPointerException("systemValues"); - } - - // Since each SystemValue could have a different system object, we need to separate them by system. - Hashtable systemHash = null; - synchronized (systemValues) - { - int length = systemValues.size(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Number of system values:", length); - // Can't use Hashtable(0) in JDK 1.1.x. - if (length == 0) return; - - // The hashtable uses system objects as the keys, and the elements are Vectors of SystemValue objects that have the key for their system. - systemHash = new Hashtable(length); - for (int i = 0; i < length; ++i) - { - try - { - SystemValue systemValue = (SystemValue)systemValues.elementAt(i); - AS400 system = systemValue.getSystem(); - Vector sameSystemVals = (Vector)systemHash.get(system); - if (sameSystemVals == null) - { - sameSystemVals = new Vector(); - systemHash.put(system, sameSystemVals); - } - sameSystemVals.addElement(systemValue); - } - catch (ClassCastException e) - { - Trace.log(Trace.ERROR, "Type of element 'systemValues[" + i + "]' is not valid:", e); - throw new ExtendedIllegalArgumentException("systemValues[" + i + "]", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - } - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Number of systems:", systemHash.size()); - - // Loop through all of the different systems that we put in the hashtable. - Enumeration list = systemHash.keys(); - while (list.hasMoreElements()) - { - // Get the Vector of system values for the current system out of the hashtable. - AS400 system = (AS400)list.nextElement(); - // The sysvals that have that system object for their system. - Vector systemSystemValues = (Vector)systemHash.get(system); - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Refreshing, system: " + system + ", number of values:", systemSystemValues.size()); - - // Next, retrieve the values from the system. This actually results in 2 ProgramCalls, one for the system values, the other for the network attributes. This code is similar to SystemValueUtility.retrieve(). - Vector svInfos = new Vector(); // System values These are the SystemValueInfo objects. - Vector naInfos = new Vector(); // Network attributes. - Vector svSystemValues = new Vector(); // These are the SystemValue objects. - Vector naSystemValues = new Vector(); - for (int i = 0; i < systemSystemValues.size(); ++i) - { - SystemValue systemValue = (SystemValue)systemSystemValues.elementAt(i); - SystemValueInfo info = systemValue.info_; - if (systemValue.getGroup() == SystemValueList.GROUP_NET) - { - naInfos.addElement(info); - naSystemValues.addElement(systemValue); - } - else - { - svInfos.addElement(info); - svSystemValues.addElement(systemValue); - } - } - - Vector svValues = new Vector(); // Actual values for system values. - Vector naValues = new Vector(); // Actual values for network attributes. - if (svInfos.size() > 0) - { - // Get the system value values. - svValues = SystemValueUtility.retrieveFromSystem(system, svInfos, false); - } - if (naInfos.size() > 0) - { - // Get the network attribute values. - naValues = SystemValueUtility.retrieveFromSystem(system, naInfos, true); - } - - // Set the new value inside each of the SystemValue objects. - for (int c = 0; c < svInfos.size(); ++c) - { - SystemValue systemValue = (SystemValue)svSystemValues.elementAt(c); - systemValue.value_ = svValues.elementAt(c); - } - for (int c = 0; c < naInfos.size(); ++c) - { - SystemValue systemValue = (SystemValue)naSystemValues.elementAt(c); - systemValue.value_ = naValues.elementAt(c); - } - } - } - - /** - Removes a system value name from this group. - @param name The system value name to be removed from this group. - @return Returns true if the system value was successfully removed; false otherwise. - @see #add - @see #contains - @see #getNames - **/ - public boolean remove(String name) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing from system value group, name: " + name); - if (name == null) - { - Trace.log(Trace.ERROR, "Parameter 'name' is null."); - throw new NullPointerException("name"); - } - - SystemValueInfo info = SystemValueList.lookup(name.toUpperCase()); - - synchronized (infos_) - { - return infos_.removeElement(info); - } - } - - /** - Removes the PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes the VetoableChangeListener. If the VetoableChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - /** - Sets the user-defined group description for any SystemValue objects generated by this group. - @param groupDescription The group description. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - @see #getGroupDescription - **/ - public void setGroupDescription(String groupDescription) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system value group description: " + groupDescription); - if (groupDescription == null) - { - Trace.log(Trace.ERROR, "Parameter 'groupDescription' is null."); - throw new NullPointerException("groupDescription"); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - groupDescription_ = groupDescription; - } - else - { - String oldValue = groupDescription_; - String newValue = groupDescription; - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("groupDescription", oldValue, newValue); - } - groupDescription_ = groupDescription; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("groupDescription", oldValue, newValue); - } - } - } - - /** - Sets the user-defined group name for any SystemValue objects generated by this group. - @param groupName The group name. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - @see #getGroupName - **/ - public void setGroupName(String groupName) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system value group name: " + groupName); - if (groupName == null) - { - Trace.log(Trace.ERROR, "Parameter 'groupName' is null."); - throw new NullPointerException("groupName"); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - groupName_ = groupName; - } - else - { - String oldValue = groupName_; - String newValue = groupName; - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("groupName", oldValue, newValue); - } - groupName_ = groupName; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("groupName", oldValue, newValue); - } - } - } - - /** - Sets the system object representing the system on which the system value group exists. - @param system The system object representing the system on which the system value group exists. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setSystem(AS400 system) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - system_ = system; - } - else - { - AS400 oldValue = system_; - AS400 newValue = system; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("system", oldValue, newValue); - } - system_ = newValue; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("system", oldValue, newValue); - } - } - } - - /** - Returns a String representation of this object. - @return A String representing this SystemValueGroup object. - **/ - public String toString() - { - String ret = ""; - if (groupName_ != null) - { - ret += groupName_ + " "; - } - ret += "{" + infos_.size() + "} "; - if (groupDescription_ != null) - { - ret += groupDescription_ + " "; - } - if (system_ != null) - { - ret += system_ + " "; - } - ret += "[" + super.toString() + "]"; - - return ret; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SystemValueGroup16.gif b/cvsroot/src/com/ibm/as400/access/SystemValueGroup16.gif deleted file mode 100644 index c53a79d69..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/SystemValueGroup16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/SystemValueGroup32.gif b/cvsroot/src/com/ibm/as400/access/SystemValueGroup32.gif deleted file mode 100644 index c943f1864..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/SystemValueGroup32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/SystemValueGroupBeanInfo.java b/cvsroot/src/com/ibm/as400/access/SystemValueGroupBeanInfo.java deleted file mode 100644 index 75bb1763e..000000000 --- a/cvsroot/src/com/ibm/as400/access/SystemValueGroupBeanInfo.java +++ /dev/null @@ -1,143 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemValueGroupBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - The SystemValueGroupBeanInfo class provides bean information for the SystemValueGroup class. - **/ -public class SystemValueGroupBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private static final Class BEAN_CLASS = SystemValueGroup.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - - eventSetDescriptors = new EventSetDescriptor[] { propertyChange, vetoableChange }; - - PropertyDescriptor system = new PropertyDescriptor("system", BEAN_CLASS); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - - PropertyDescriptor groupName = new PropertyDescriptor("groupName", BEAN_CLASS); - groupName.setBound(true); - groupName.setConstrained(true); - groupName.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_NAME")); - groupName.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_NAME")); - - PropertyDescriptor groupDescription = new PropertyDescriptor("groupDescription", BEAN_CLASS); - groupDescription.setBound(true); - groupDescription.setConstrained(true); - groupDescription.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_DESCRIPTION")); - groupDescription.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_DESCRIPTION")); - - propertyDescriptors = new PropertyDescriptor[] { system, groupName, groupDescription }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return One (1), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "vetoableChange" event. - return 1; - } - - /** - Returns the index of the default property. - @return Zero (0), the index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // The index for the "system" property. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("SystemValueGroup16.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("SystemValueGroup32.gif"); - } - return null; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SystemValueInfo.java b/cvsroot/src/com/ibm/as400/access/SystemValueInfo.java deleted file mode 100644 index e3287556a..000000000 --- a/cvsroot/src/com/ibm/as400/access/SystemValueInfo.java +++ /dev/null @@ -1,103 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemValueInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; - -// The SystemValueInfo class represents all of the static properties of a system value. The dynamic properties of a system value, such as its data and caching, are encapsulated by the SystemValue class. -class SystemValueInfo implements Serializable -{ - static final long serialVersionUID = 4L; - - // The name of this system value. - String name_ = null; - // The IBM i data type of this system value. - // Valid values are SystemValueList.SERVER_TYPE_BINARY and SERVER_TYPE_CHAR. - byte serverDataType_ = (byte)'\0'; - // The size in bytes of this system value on the system. - int size_ = 0; - // The number of actual data values this system value contains on the system. - // Note: arraySize_ is multiplied by size_ to get the total length of this system value on the datastream. - // e.g. QACGLVL represents an 8-element array of 10-byte character values so size_ = 10 and arraySize_ = 8 for QACGLVL. - int arraySize_ = 1; - // The number of decimal positions if this is a type TYPE_DECIMAL value. - int decimalPositions_ = -1; - // The Java data type for this value. - // Valid values are SystemValueList.TYPE_ARRAY, TYPE_DATE, TYPE_DECIMAL, TYPE_INTEGER, TYPE_STRING. - int type_ = -1; - // The group in which this system value belongs. - int group_ = -1; - // The earliest VRM release in which this value exists. - int release_ = -1; - // The text describing this system value. - String description_ = null; - // Indicates if this system value is read only. - boolean readOnly_ = false; - - SystemValueInfo(String name, byte serverDataType, int size, int arraySize, int type, int group, int release, String description) - { - name_ = name; - serverDataType_ = serverDataType; - size_ = size; - arraySize_ = arraySize; - type_ = type; - group_ = group; - release_ = release; - description_ = description; - } - - // Constructor that takes a readOnly parameter. - // @param readOnly Indicates if the system value is read only. - SystemValueInfo(String name, byte serverDataType, int size, int arraySize, int type, int group, int release, String description, boolean readOnly) - { - name_ = name; - serverDataType_ = serverDataType; - size_ = size; - arraySize_ = arraySize; - type_ = type; - group_ = group; - release_ = release; - description_ = description; - readOnly_ = readOnly; - } - - // Constructor that takes a decimalPositions parameter. - SystemValueInfo(String name, byte serverDataType, int size, int decimalPositions, int arraySize, int type, int group, int release, String description) - { - name_ = name; - serverDataType_ = serverDataType; - size_ = size; - arraySize_ = arraySize; - decimalPositions_ = decimalPositions; - type_ = type; - group_ = group; - release_ = release; - description_ = description; - } - - // Equals method for comparison of 2 SystemValueInfo objects. - public boolean equals(Object obj) - { - if (obj == null || !(obj instanceof SystemValueInfo)) return false; - - SystemValueInfo target = (SystemValueInfo)obj; - return (name_ != null && name_.equals(target.name_)); - } - - // hashCode method, to complement the equals() method. - public int hashCode() - { - return (name_ == null ? super.hashCode() : name_.hashCode()); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SystemValueList.java b/cvsroot/src/com/ibm/as400/access/SystemValueList.java deleted file mode 100644 index 59b1e123e..000000000 --- a/cvsroot/src/com/ibm/as400/access/SystemValueList.java +++ /dev/null @@ -1,791 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemValueList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.Serializable; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Locale; -import java.util.Vector; - -/** - Provided methods for retrieving information about lists of System Values. - @see SystemValue -**/ -public class SystemValueList implements Serializable -{ - static final long serialVersionUID = 4L; - - /** - Constant indicating the system value's group is *ALC (Allocation). - **/ - public static final int GROUP_ALC = 0; - /** - Constant indicating the system value's group is *ALL (All). - **/ - public static final int GROUP_ALL = 9; - /** - Constant indicating the system value's group is *DATTIM (Date and Time). - **/ - public static final int GROUP_DATTIM = 1; - /** - Constant indicating the system value's group is *EDT (Editing). - **/ - public static final int GROUP_EDT = 2; - /** - Constant indicating the system value's group is *LIBL (Library List). - **/ - public static final int GROUP_LIBL = 3; - /** - Constant indicating the system value's group is *MSG (Message and Logging). - **/ - public static final int GROUP_MSG = 4; - /** - Constant indicating the system value's group is *NET (Net Attribute). - **/ - public static final int GROUP_NET = 8; - /** - Constant indicating the system value's group is *SEC (Security). - **/ - public static final int GROUP_SEC = 5; - /** - Constant indicating the system value's group is *STG (Storage). - **/ - public static final int GROUP_STG = 6; - /** - Constant indicating the system value's group is *SYSCTL (System control). - **/ - public static final int GROUP_SYSCTL = 7; - - /** - Constant indicating the returned system value type is String[]. - **/ - public static final int TYPE_ARRAY = 4; - /** - Constant indicating the returned system value type is Date. - **/ - public static final int TYPE_DATE = 5; - /** - Constant indicating the returned system value type is BigDecimal. - **/ - public static final int TYPE_DECIMAL = 2; - /** - Constant indicating the returned system value type is Integer. - **/ - public static final int TYPE_INTEGER = 3; - /** - Constant indicating the returned system value type is String. - **/ - public static final int TYPE_STRING = 1; - - // Constant indicating the system value's type on the system is BINARY. - static final byte SERVER_TYPE_BINARY = (byte)0xC2; - // Constant indicating the system value's type on the system is CHAR. - static final byte SERVER_TYPE_CHAR = (byte)0xC3; - - // Constants for operating system VRM. - private static final int VRM420 = 0x00040200; - private static final int VRM430 = 0x00040300; - private static final int VRM440 = 0x00040400; - private static final int VRM510 = 0x00050100; - private static final int VRM520 = 0x00050200; - private static final int VRM530 = 0x00050300; - private static final int VRM540 = 0x00050400; - private static final int VRM610 = 0x00060100; - - // The total number of groups. - private static final int GROUP_COUNT = 10; - - // The MRI for the group names. - private static final String[] GROUP_NAMES = new String[] - { - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_ALC_NAME"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_DATTIM_NAME"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_EDT_NAME"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_LIBL_NAME"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_MSG_NAME"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_SEC_NAME"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_STG_NAME"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_SYSCTL_NAME"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_NET_NAME"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_ALL_NAME"), - }; - - // The MRI for the group descriptions. - private static final String[] GROUP_DESCRIPTIONS = new String[] - { - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_ALC_DESC"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_DATTIM_DESC"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_EDT_DESC"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_LIBL_DESC"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_MSG_DESC"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_SEC_DESC"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_STG_DESC"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_SYSCTL_DESC"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_NET_DESC"), - ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_ALL_DESC"), - }; - - // The list of all SystemValueInfo objects. - // For V4R2, there are 125 system values and 35 network attributes. - // For V4R3, there are an additional 5 system values. - // For V4R4, there are 2 additional system values and 2 additional network attributes. - // For V5R1, there are 6 additional system values. - // For V5R2, there are 2 additional system values. - // For V5R3, there are 10 additional system values. - // For V5R4, there are 2 additional system values. - // For V6R1, there are 6 additional system values. - // There are at least 195 system values. - // The optimal hash size is 195/0.75 = 260. - private static Hashtable list = new Hashtable(260); - - // Provided for convenient lookup of system value groups. - static Vector[] groups = { new Vector(), new Vector(), new Vector(), new Vector(), new Vector(), new Vector(), new Vector(), new Vector(), new Vector(), new Vector() }; - - // Initialize the hashtables. - static - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Populating system value table..."); - - // Network attributes. - SystemValueList.list.put("ALRBCKFP", new SystemValueInfo("ALRBCKFP", SERVER_TYPE_CHAR, 8, 2, TYPE_ARRAY, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("ALRBCKFP_DES"))); - SystemValueList.list.put("ALRCTLD", new SystemValueInfo("ALRCTLD", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("ALRCTLD_DES"))); - SystemValueList.list.put("ALRDFTFP", new SystemValueInfo("ALRDFTFP", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("ALRDFTFP_DES"))); - SystemValueList.list.put("ALRFTR", new SystemValueInfo("ALRFTR", SERVER_TYPE_CHAR, 20, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("ALRFTR_DES"))); - SystemValueList.list.put("ALRHLDCNT", new SystemValueInfo("ALRHLDCNT", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("ALRHLDCNT_DES"))); - SystemValueList.list.put("ALRLOGSTS", new SystemValueInfo("ALRLOGSTS", SERVER_TYPE_CHAR, 8, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("ALRLOGSTS_DES"))); - SystemValueList.list.put("ALRPRIFP", new SystemValueInfo("ALRPRIFP", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("ALRPRIFP_DES"))); - SystemValueList.list.put("ALRRQSFP", new SystemValueInfo("ALRRQSFP", SERVER_TYPE_CHAR, 8, 2, TYPE_ARRAY, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("ALRRQSFP_DES"))); - SystemValueList.list.put("ALRSTS", new SystemValueInfo("ALRSTS", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("ALRSTS_DES"))); - SystemValueList.list.put("ALWANYNET", new SystemValueInfo("ALWANYNET", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("ALWANYNET_DES"))); - SystemValueList.list.put("ALWHPRTWR", new SystemValueInfo("ALWHPRTWR", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("ALWHPRTWR_DES"))); - SystemValueList.list.put("ALWVRTAPPN", new SystemValueInfo("ALWVRTAPPN", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("ALWVRTAPPN_DES"))); - SystemValueList.list.put("DDMACC", new SystemValueInfo("DDMACC", SERVER_TYPE_CHAR, 20, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("DDMACC_DES"))); - SystemValueList.list.put("DFTCNNLST", new SystemValueInfo("DFTCNNLST", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("DFTCNNLST_DES"))); - SystemValueList.list.put("DFTMODE", new SystemValueInfo("DFTMODE", SERVER_TYPE_CHAR, 8, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("DFTMODE_DES"))); - SystemValueList.list.put("DFTNETTYPE", new SystemValueInfo("DFTNETTYPE", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("DFTNETTYPE_DES"))); - SystemValueList.list.put("DTACPR", new SystemValueInfo("DTACPR", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("DTACPR_DES"))); - SystemValueList.list.put("DTACPRINM", new SystemValueInfo("DTACPRINM", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("DTACPRINM_DES"))); - SystemValueList.list.put("HPRPTHTMR", new SystemValueInfo("HPRPTHTMR", SERVER_TYPE_CHAR, 10, 4, TYPE_ARRAY, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("HPRPTHTMR_DES"))); - SystemValueList.list.put("JOBACN", new SystemValueInfo("JOBACN", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("JOBACN_DES"))); - SystemValueList.list.put("LCLCPNAME", new SystemValueInfo("LCLCPNAME", SERVER_TYPE_CHAR, 8, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("LCLCPNAME_DES"))); - SystemValueList.list.put("LCLLOCNAME", new SystemValueInfo("LCLLOCNAME", SERVER_TYPE_CHAR, 8, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("LCLLOCNAME_DES"))); - SystemValueList.list.put("LCLNETID", new SystemValueInfo("LCLNETID", SERVER_TYPE_CHAR, 8, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("LCLNETID_DES"))); - SystemValueList.list.put("MAXHOP", new SystemValueInfo("MAXHOP", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("MAXHOP_DES"))); - SystemValueList.list.put("MAXINTSSN", new SystemValueInfo("MAXINTSSN", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("MAXINTSSN_DES"))); - SystemValueList.list.put("MSGQ", new SystemValueInfo("MSGQ", SERVER_TYPE_CHAR, 20, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("MSGQ_DES"))); - SystemValueList.list.put("NETSERVER", new SystemValueInfo("NETSERVER", SERVER_TYPE_CHAR, 17, 5, TYPE_ARRAY, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("NETSERVER_DES"))); - SystemValueList.list.put("NODETYPE", new SystemValueInfo("NODETYPE", SERVER_TYPE_CHAR, 8, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("NODETYPE_DES"))); - SystemValueList.list.put("NWSDOMAIN", new SystemValueInfo("NWSDOMAIN", SERVER_TYPE_CHAR, 8, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("NWSDOMAIN_DES"))); - SystemValueList.list.put("OUTQ", new SystemValueInfo("OUTQ", SERVER_TYPE_CHAR, 20, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("OUTQ_DES"))); - SystemValueList.list.put("PCSACC", new SystemValueInfo("PCSACC", SERVER_TYPE_CHAR, 20, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("PCSACC_DES"))); - SystemValueList.list.put("PNDSYSNAME", new SystemValueInfo("PNDSYSNAME", SERVER_TYPE_CHAR, 8, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("PNDSYSNAME_DES"),true)); - SystemValueList.list.put("RAR", new SystemValueInfo("RAR", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("RAR_DES"))); - SystemValueList.list.put("SYSNAME", new SystemValueInfo("SYSNAME", SERVER_TYPE_CHAR, 8, 1, TYPE_STRING, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("SYSNAME_DES"))); - SystemValueList.list.put("VRTAUTODEV", new SystemValueInfo("VRTAUTODEV", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_NET, VRM420, ResourceBundleLoader.getSystemValueText("VRTAUTODEV_DES"))); - - // V4R4 network attributes. - SystemValueList.list.put("ALWADDCLU", new SystemValueInfo("ALWADDCLU", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_NET, VRM440, ResourceBundleLoader.getSystemValueText("ALWADDCLU_DES"))); - SystemValueList.list.put("MDMCNTRYID", new SystemValueInfo("MDMCNTRYID", SERVER_TYPE_CHAR, 2, 1, TYPE_STRING, GROUP_NET, VRM440, ResourceBundleLoader.getSystemValueText("MDMCNTRYID_DES"))); - - // System values. - SystemValueList.list.put("QABNORMSW", new SystemValueInfo("QABNORMSW", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QABNORMSW_DES"), true)); - SystemValueList.list.put("QACGLVL", new SystemValueInfo("QACGLVL", SERVER_TYPE_CHAR, 10, 8, TYPE_ARRAY, GROUP_MSG, VRM420, ResourceBundleLoader.getSystemValueText("QACGLVL_DES"))); - SystemValueList.list.put("QACTJOB", new SystemValueInfo("QACTJOB", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_ALC, VRM420, ResourceBundleLoader.getSystemValueText("QACTJOB_DES"))); - SystemValueList.list.put("QADLACTJ", new SystemValueInfo("QADLACTJ", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_ALC, VRM420, ResourceBundleLoader.getSystemValueText("QADLACTJ_DES"))); - SystemValueList.list.put("QADLSPLA", new SystemValueInfo("QADLSPLA", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_ALC, VRM420, ResourceBundleLoader.getSystemValueText("QADLSPLA_DES"))); - SystemValueList.list.put("QADLTOTJ", new SystemValueInfo("QADLTOTJ", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_ALC, VRM420, ResourceBundleLoader.getSystemValueText("QADLTOTJ_DES"))); - SystemValueList.list.put("QALWOBJRST", new SystemValueInfo("QALWOBJRST", SERVER_TYPE_CHAR, 10, 15, TYPE_ARRAY, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QALWOBJRST_DES"))); - SystemValueList.list.put("QALWUSRDMN", new SystemValueInfo("QALWUSRDMN", SERVER_TYPE_CHAR, 10, 50, TYPE_ARRAY, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QALWUSRDMN_DES"))); - SystemValueList.list.put("QASTLVL", new SystemValueInfo("QASTLVL", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QASTLVL_DES"))); - SystemValueList.list.put("QATNPGM", new SystemValueInfo("QATNPGM", SERVER_TYPE_CHAR, 20, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QATNPGM_DES"))); - SystemValueList.list.put("QAUDCTL", new SystemValueInfo("QAUDCTL", SERVER_TYPE_CHAR, 10, 5, TYPE_ARRAY, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QAUDCTL_DES"))); - SystemValueList.list.put("QAUDENDACN", new SystemValueInfo("QAUDENDACN", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QAUDENDACN_DES"))); - SystemValueList.list.put("QAUDFRCLVL", new SystemValueInfo("QAUDFRCLVL", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QAUDFRCLVL_DES"))); - SystemValueList.list.put("QAUDLVL", new SystemValueInfo("QAUDLVL", SERVER_TYPE_CHAR, 10, 16, TYPE_ARRAY, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QAUDLVL_DES"))); - SystemValueList.list.put("QAUTOCFG", new SystemValueInfo("QAUTOCFG", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QAUTOCFG_DES"))); - SystemValueList.list.put("QAUTORMT", new SystemValueInfo("QAUTORMT", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QAUTORMT_DES"))); - SystemValueList.list.put("QAUTOSPRPT", new SystemValueInfo("QAUTOSPRPT", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QAUTOSPRPT_DES"))); - SystemValueList.list.put("QAUTOVRT", new SystemValueInfo("QAUTOVRT", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QAUTOVRT_DES"))); - SystemValueList.list.put("QBASACTLVL", new SystemValueInfo("QBASACTLVL", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_STG, VRM420, ResourceBundleLoader.getSystemValueText("QBASACTLVL_DES"))); - SystemValueList.list.put("QBASPOOL", new SystemValueInfo("QBASPOOL", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_STG, VRM420, ResourceBundleLoader.getSystemValueText("QBASPOOL_DES"))); - SystemValueList.list.put("QBOOKPATH", new SystemValueInfo("QBOOKPATH", SERVER_TYPE_CHAR, 63, 5, TYPE_ARRAY, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QBOOKPATH_DES"))); - SystemValueList.list.put("QCCSID", new SystemValueInfo("QCCSID", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QCCSID_DES"))); - SystemValueList.list.put("QCENTURY", new SystemValueInfo("QCENTURY", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_DATTIM, VRM420, ResourceBundleLoader.getSystemValueText("QCENTURY_DES"))); - SystemValueList.list.put("QCHRID", new SystemValueInfo("QCHRID", SERVER_TYPE_CHAR, 10, 2, TYPE_ARRAY, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QCHRID_DES"))); - SystemValueList.list.put("QCMNARB", new SystemValueInfo("QCMNARB", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QCMNARB_DES"))); - SystemValueList.list.put("QCMNRCYLMT", new SystemValueInfo("QCMNRCYLMT", SERVER_TYPE_CHAR, 10, 2, TYPE_ARRAY, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QCMNRCYLMT_DES"))); - SystemValueList.list.put("QCNTRYID", new SystemValueInfo("QCNTRYID", SERVER_TYPE_CHAR, 2, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QCNTRYID_DES"))); - SystemValueList.list.put("QCONSOLE", new SystemValueInfo("QCONSOLE", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QCONSOLE_DES"), true)); - SystemValueList.list.put("QCRTAUT", new SystemValueInfo("QCRTAUT", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QCRTAUT_DES"))); - SystemValueList.list.put("QCRTOBJAUD", new SystemValueInfo("QCRTOBJAUD", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QCRTOBJAUD_DES"))); - SystemValueList.list.put("QCTLSBSD", new SystemValueInfo("QCTLSBSD", SERVER_TYPE_CHAR, 20, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QCTLSBSD_DES"))); - SystemValueList.list.put("QCURSYM", new SystemValueInfo("QCURSYM", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_EDT, VRM420, ResourceBundleLoader.getSystemValueText("QCURSYM_DES"))); - SystemValueList.list.put("QDATE", new SystemValueInfo("QDATE", SERVER_TYPE_CHAR, 7, 1, TYPE_DATE, GROUP_DATTIM, VRM420, ResourceBundleLoader.getSystemValueText("QDATE_DES"))); - SystemValueList.list.put("QDATFMT", new SystemValueInfo("QDATFMT", SERVER_TYPE_CHAR, 3, 1, TYPE_STRING, GROUP_EDT, VRM420, ResourceBundleLoader.getSystemValueText("QDATFMT_DES"))); - SystemValueList.list.put("QDATSEP", new SystemValueInfo("QDATSEP", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_EDT, VRM420, ResourceBundleLoader.getSystemValueText("QDATSEP_DES"))); - SystemValueList.list.put("QDAY", new SystemValueInfo("QDAY", SERVER_TYPE_CHAR, 3, 1, TYPE_STRING, GROUP_DATTIM, VRM420, ResourceBundleLoader.getSystemValueText("QDAY_DES"))); - SystemValueList.list.put("QDAYOFWEEK", new SystemValueInfo("QDAYOFWEEK", SERVER_TYPE_CHAR, 4, 1, TYPE_STRING, GROUP_DATTIM, VRM420, ResourceBundleLoader.getSystemValueText("QDAYOFWEEK_DES"), true)); - SystemValueList.list.put("QDBRCVYWT", new SystemValueInfo("QDBRCVYWT", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QDBRCVYWT_DES"))); - SystemValueList.list.put("QDECFMT", new SystemValueInfo("QDECFMT", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_EDT, VRM420, ResourceBundleLoader.getSystemValueText("QDECFMT_DES"))); - SystemValueList.list.put("QDEVNAMING", new SystemValueInfo("QDEVNAMING", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QDEVNAMING_DES"))); - SystemValueList.list.put("QDEVRCYACN", new SystemValueInfo("QDEVRCYACN", SERVER_TYPE_CHAR, 20, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QDEVRCYACN_DES"))); - SystemValueList.list.put("QDSCJOBITV", new SystemValueInfo("QDSCJOBITV", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QDSCJOBITV_DES"))); - SystemValueList.list.put("QDSPSGNINF", new SystemValueInfo("QDSPSGNINF", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QDSPSGNINF_DES"))); - SystemValueList.list.put("QDYNPTYSCD", new SystemValueInfo("QDYNPTYSCD", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QDYNPTYSCD_DES"))); - SystemValueList.list.put("QFRCCVNRST", new SystemValueInfo("QFRCCVNRST", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QFRCCVNRST_DES"))); - SystemValueList.list.put("QHOUR", new SystemValueInfo("QHOUR", SERVER_TYPE_CHAR, 2, 1, TYPE_STRING, GROUP_DATTIM, VRM420, ResourceBundleLoader.getSystemValueText("QHOUR_DES"))); - SystemValueList.list.put("QHSTLOGSIZ", new SystemValueInfo("QHSTLOGSIZ", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_MSG, VRM420, ResourceBundleLoader.getSystemValueText("QHSTLOGSIZ_DES"))); - SystemValueList.list.put("QIGC", new SystemValueInfo("QIGC", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QIGC_DES"), true)); - SystemValueList.list.put("QIGCCDEFNT", new SystemValueInfo("QIGCCDEFNT", SERVER_TYPE_CHAR, 10, 2, TYPE_ARRAY, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QIGCCDEFNT_DES"))); - SystemValueList.list.put("QINACTITV", new SystemValueInfo("QINACTITV", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QINACTITV_DES"))); - SystemValueList.list.put("QINACTMSGQ", new SystemValueInfo("QINACTMSGQ", SERVER_TYPE_CHAR, 10, 2, TYPE_ARRAY, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QINACTMSGQ_DES"))); - SystemValueList.list.put("QIPLDATTIM", new SystemValueInfo("QIPLDATTIM", SERVER_TYPE_CHAR, 20, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QIPLDATTIM_DES"))); - SystemValueList.list.put("QIPLSTS", new SystemValueInfo("QIPLSTS", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QIPLSTS_DES"), true)); - SystemValueList.list.put("QIPLTYPE", new SystemValueInfo("QIPLTYPE", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QIPLTYPE_DES"))); - SystemValueList.list.put("QJOBMSGQFL", new SystemValueInfo("QJOBMSGQFL", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_ALC, VRM420, ResourceBundleLoader.getSystemValueText("QJOBMSGQFL_DES"))); - SystemValueList.list.put("QJOBMSGQMX", new SystemValueInfo("QJOBMSGQMX", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_ALC, VRM420, ResourceBundleLoader.getSystemValueText("QJOBMSGQMX_DES"))); - SystemValueList.list.put("QJOBMSGQSZ", new SystemValueInfo("QJOBMSGQSZ", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_ALC, VRM420, ResourceBundleLoader.getSystemValueText("QJOBMSGQSZ_DES"))); - SystemValueList.list.put("QJOBMSGQTL", new SystemValueInfo("QJOBMSGQTL", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_ALC, VRM420, ResourceBundleLoader.getSystemValueText("QJOBMSGQTL_DES"))); - SystemValueList.list.put("QJOBSPLA", new SystemValueInfo("QJOBSPLA", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_ALC, VRM420, ResourceBundleLoader.getSystemValueText("QJOBSPLA_DES"))); - SystemValueList.list.put("QKBDBUF", new SystemValueInfo("QKBDBUF", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QKBDBUF_DES"))); - SystemValueList.list.put("QKBDTYPE", new SystemValueInfo("QKBDTYPE", SERVER_TYPE_CHAR, 3, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QKBDTYPE_DES"))); - SystemValueList.list.put("QLANGID", new SystemValueInfo("QLANGID", SERVER_TYPE_CHAR, 3, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QLANGID_DES"))); - SystemValueList.list.put("QLEAPADJ", new SystemValueInfo("QLEAPADJ", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_DATTIM, VRM420, ResourceBundleLoader.getSystemValueText("QLEAPADJ_DES"))); - SystemValueList.list.put("QLMTDEVSSN", new SystemValueInfo("QLMTDEVSSN", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QLMTDEVSSN_DES"))); - SystemValueList.list.put("QLMTSECOFR", new SystemValueInfo("QLMTSECOFR", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QLMTSECOFR_DES"))); - // This is size 2080 because of data returned on API. Actual size for path name is 1024 chars. - SystemValueList.list.put("QLOCALE", new SystemValueInfo("QLOCALE", SERVER_TYPE_CHAR, 2080, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QLOCALE_DES"))); - SystemValueList.list.put("QMAXACTLVL", new SystemValueInfo("QMAXACTLVL", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_STG, VRM420, ResourceBundleLoader.getSystemValueText("QMAXACTLVL_DES"))); - SystemValueList.list.put("QMAXSGNACN", new SystemValueInfo("QMAXSGNACN", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QMAXSGNACN_DES"))); - SystemValueList.list.put("QMAXSIGN", new SystemValueInfo("QMAXSIGN", SERVER_TYPE_CHAR, 6, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QMAXSIGN_DES"))); - SystemValueList.list.put("QMCHPOOL", new SystemValueInfo("QMCHPOOL", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_STG, VRM420, ResourceBundleLoader.getSystemValueText("QMCHPOOL_DES"))); - SystemValueList.list.put("QMINUTE", new SystemValueInfo("QMINUTE", SERVER_TYPE_CHAR, 2, 1, TYPE_STRING, GROUP_DATTIM, VRM420, ResourceBundleLoader.getSystemValueText("QMINUTE_DES"))); - SystemValueList.list.put("QMODEL", new SystemValueInfo("QMODEL", SERVER_TYPE_CHAR, 4, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QMODEL_DES"),true)); - SystemValueList.list.put("QMONTH", new SystemValueInfo("QMONTH", SERVER_TYPE_CHAR, 2, 1, TYPE_STRING, GROUP_DATTIM, VRM420, ResourceBundleLoader.getSystemValueText("QMONTH_DES"))); - SystemValueList.list.put("QPASTHRSVR", new SystemValueInfo("QPASTHRSVR", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QPASTHRSVR_DES"))); - SystemValueList.list.put("QPFRADJ", new SystemValueInfo("QPFRADJ", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QPFRADJ_DES"))); - SystemValueList.list.put("QPRBFTR", new SystemValueInfo("QPRBFTR", SERVER_TYPE_CHAR, 10, 2, TYPE_ARRAY, GROUP_MSG, VRM420, ResourceBundleLoader.getSystemValueText("QPRBFTR_DES"))); - SystemValueList.list.put("QPRBHLDITV", new SystemValueInfo("QPRBHLDITV", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_MSG, VRM420, ResourceBundleLoader.getSystemValueText("QPRBHLDITV_DES"))); - SystemValueList.list.put("QPRTDEV", new SystemValueInfo("QPRTDEV", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QPRTDEV_DES"))); - SystemValueList.list.put("QPRTKEYFMT", new SystemValueInfo("QPRTKEYFMT", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QPRTKEYFMT_DES"))); - SystemValueList.list.put("QPRTTXT", new SystemValueInfo("QPRTTXT", SERVER_TYPE_CHAR, 30, 1, TYPE_STRING, GROUP_MSG, VRM420, ResourceBundleLoader.getSystemValueText("QPRTTXT_DES"))); - SystemValueList.list.put("QPWDEXPITV", new SystemValueInfo("QPWDEXPITV", SERVER_TYPE_CHAR, 6, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QPWDEXPITV_DES"))); - SystemValueList.list.put("QPWDLMTAJC", new SystemValueInfo("QPWDLMTAJC", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QPWDLMTAJC_DES"))); - SystemValueList.list.put("QPWDLMTCHR", new SystemValueInfo("QPWDLMTCHR", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QPWDLMTCHR_DES"))); - SystemValueList.list.put("QPWDLMTREP", new SystemValueInfo("QPWDLMTREP", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QPWDLMTREP_DES"))); - SystemValueList.list.put("QPWDMAXLEN", new SystemValueInfo("QPWDMAXLEN", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QPWDMAXLEN_DES"))); - SystemValueList.list.put("QPWDMINLEN", new SystemValueInfo("QPWDMINLEN", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QPWDMINLEN_DES"))); - SystemValueList.list.put("QPWDPOSDIF", new SystemValueInfo("QPWDPOSDIF", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QPWDPOSDIF_DES"))); - SystemValueList.list.put("QPWDRQDDGT", new SystemValueInfo("QPWDRQDDGT", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QPWDRQDDGT_DES"))); - SystemValueList.list.put("QPWDRQDDIF", new SystemValueInfo("QPWDRQDDIF", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QPWDRQDDIF_DES"))); - SystemValueList.list.put("QPWDVLDPGM", new SystemValueInfo("QPWDVLDPGM", SERVER_TYPE_CHAR, 20, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QPWDVLDPGM_DES"))); - SystemValueList.list.put("QPWRDWNLMT", new SystemValueInfo("QPWRDWNLMT", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QPWRDWNLMT_DES"))); - SystemValueList.list.put("QPWRRSTIPL", new SystemValueInfo("QPWRRSTIPL", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QPWRRSTIPL_DES"))); - SystemValueList.list.put("QQRYDEGREE", new SystemValueInfo("QQRYDEGREE", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QQRYDEGREE_DES"))); - SystemValueList.list.put("QQRYTIMLMT", new SystemValueInfo("QQRYTIMLMT", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QQRYTIMLMT_DES"))); - SystemValueList.list.put("QRCLSPLSTG", new SystemValueInfo("QRCLSPLSTG", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_ALC, VRM420, ResourceBundleLoader.getSystemValueText("QRCLSPLSTG_DES"))); - SystemValueList.list.put("QRETSVRSEC", new SystemValueInfo("QRETSVRSEC", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QRETSVRSEC_DES"))); - SystemValueList.list.put("QRMTIPL", new SystemValueInfo("QRMTIPL", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QRMTIPL_DES"))); - SystemValueList.list.put("QRMTSIGN", new SystemValueInfo("QRMTSIGN", SERVER_TYPE_CHAR, 20, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QRMTSIGN_DES"))); - SystemValueList.list.put("QRMTSRVATR", new SystemValueInfo("QRMTSRVATR", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QRMTSRVATR_DES"))); - SystemValueList.list.put("QSCPFCONS", new SystemValueInfo("QSCPFCONS", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QSCPFCONS_DES"))); - SystemValueList.list.put("QSECOND", new SystemValueInfo("QSECOND", SERVER_TYPE_CHAR, 2, 1, TYPE_STRING, GROUP_DATTIM, VRM420, ResourceBundleLoader.getSystemValueText("QSECOND_DES"))); - SystemValueList.list.put("QSECURITY", new SystemValueInfo("QSECURITY", SERVER_TYPE_CHAR, 2, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QSECURITY_DES"))); - SystemValueList.list.put("QSETJOBATR", new SystemValueInfo("QSETJOBATR", SERVER_TYPE_CHAR, 10, 16, TYPE_ARRAY, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QSETJOBATR_DES"))); - SystemValueList.list.put("QSFWERRLOG", new SystemValueInfo("QSFWERRLOG", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_MSG, VRM420, ResourceBundleLoader.getSystemValueText("QSFWERRLOG_DES"))); - SystemValueList.list.put("QSPCENV", new SystemValueInfo("QSPCENV", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QSPCENV_DES"))); - SystemValueList.list.put("QSRLNBR", new SystemValueInfo("QSRLNBR", SERVER_TYPE_CHAR, 8, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QSRLNBR_DES"),true)); - SystemValueList.list.put("QSRTSEQ", new SystemValueInfo("QSRTSEQ", SERVER_TYPE_CHAR, 20, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QSRTSEQ_DES"))); - SystemValueList.list.put("QSRVDMP", new SystemValueInfo("QSRVDMP", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_MSG, VRM420, ResourceBundleLoader.getSystemValueText("QSRVDMP_DES"))); - SystemValueList.list.put("QSTGLOWACN", new SystemValueInfo("QSTGLOWACN", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_STG, VRM420, ResourceBundleLoader.getSystemValueText("QSTGLOWACN_DES"))); - SystemValueList.list.put("QSTGLOWLMT", new SystemValueInfo("QSTGLOWLMT", SERVER_TYPE_BINARY, 7, 4, 1, TYPE_DECIMAL, GROUP_STG, VRM420, ResourceBundleLoader.getSystemValueText("QSTGLOWLMT_DES"))); - SystemValueList.list.put("QSTRPRTWTR", new SystemValueInfo("QSTRPRTWTR", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QSTRPRTWTR_DES"), true)); - SystemValueList.list.put("QSTRUPPGM", new SystemValueInfo("QSTRUPPGM", SERVER_TYPE_CHAR, 20, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QSTRUPPGM_DES"))); - SystemValueList.list.put("QSTSMSG", new SystemValueInfo("QSTSMSG", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_MSG, VRM420, ResourceBundleLoader.getSystemValueText("QSTSMSG_DES"))); - SystemValueList.list.put("QSVRAUTITV", new SystemValueInfo("QSVRAUTITV", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QSVRAUTITV_DES"))); - SystemValueList.list.put("QSYSLIBL", new SystemValueInfo("QSYSLIBL", SERVER_TYPE_CHAR, 10, 15, TYPE_ARRAY, GROUP_LIBL, VRM420, ResourceBundleLoader.getSystemValueText("QSYSLIBL_DES"))); - SystemValueList.list.put("QTIME", new SystemValueInfo("QTIME", SERVER_TYPE_CHAR, 9, 1, TYPE_DATE, GROUP_DATTIM, VRM420, ResourceBundleLoader.getSystemValueText("QTIME_DES"))); - SystemValueList.list.put("QTIMSEP", new SystemValueInfo("QTIMSEP", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_EDT, VRM420, ResourceBundleLoader.getSystemValueText("QTIMSEP_DES"))); - SystemValueList.list.put("QTOTJOB", new SystemValueInfo("QTOTJOB", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_ALC, VRM420, ResourceBundleLoader.getSystemValueText("QTOTJOB_DES"))); - SystemValueList.list.put("QTSEPOOL", new SystemValueInfo("QTSEPOOL", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_STG, VRM420, ResourceBundleLoader.getSystemValueText("QTSEPOOL_DES"))); - SystemValueList.list.put("QUPSDLYTIM", new SystemValueInfo("QUPSDLYTIM", SERVER_TYPE_CHAR, 10, 2, TYPE_ARRAY, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QUPSDLYTIM_DES"))); - SystemValueList.list.put("QUPSMSGQ", new SystemValueInfo("QUPSMSGQ", SERVER_TYPE_CHAR, 20, 1, TYPE_STRING, GROUP_SYSCTL, VRM420, ResourceBundleLoader.getSystemValueText("QUPSMSGQ_DES"))); - SystemValueList.list.put("QUSEADPAUT", new SystemValueInfo("QUSEADPAUT", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SEC, VRM420, ResourceBundleLoader.getSystemValueText("QUSEADPAUT_DES"))); - SystemValueList.list.put("QUSRLIBL", new SystemValueInfo("QUSRLIBL", SERVER_TYPE_CHAR, 10, 25, TYPE_ARRAY, GROUP_LIBL, VRM420, ResourceBundleLoader.getSystemValueText("QUSRLIBL_DES"))); - SystemValueList.list.put("QUTCOFFSET", new SystemValueInfo("QUTCOFFSET", SERVER_TYPE_CHAR, 5, 1, TYPE_STRING, GROUP_DATTIM, VRM420, ResourceBundleLoader.getSystemValueText("QUTCOFFSET_DES"))); - SystemValueList.list.put("QYEAR", new SystemValueInfo("QYEAR", SERVER_TYPE_CHAR, 2, 1, TYPE_STRING, GROUP_DATTIM, VRM420, ResourceBundleLoader.getSystemValueText("QYEAR_DES"))); - - // V4R3 system values. - SystemValueList.list.put("QCHRIDCTL", new SystemValueInfo("QCHRIDCTL", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SYSCTL, VRM430, ResourceBundleLoader.getSystemValueText("QCHRIDCTL_DES"))); - SystemValueList.list.put("QDYNPTYADJ", new SystemValueInfo("QDYNPTYADJ", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM430, ResourceBundleLoader.getSystemValueText("QDYNPTYADJ_DES"))); - SystemValueList.list.put("QIGCFNTSIZ", new SystemValueInfo("QIGCFNTSIZ", SERVER_TYPE_BINARY, 4, 1, 1, TYPE_DECIMAL, GROUP_SYSCTL, VRM430, ResourceBundleLoader.getSystemValueText("QIGCFNTSIZ_DES"))); - SystemValueList.list.put("QPRCMLTTSK", new SystemValueInfo("QPRCMLTTSK", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM430, ResourceBundleLoader.getSystemValueText("QPRCMLTTSK_DES"))); - SystemValueList.list.put("QPRCFEAT", new SystemValueInfo("QPRCFEAT", SERVER_TYPE_CHAR, 4, 1, TYPE_STRING, GROUP_SYSCTL, VRM430, ResourceBundleLoader.getSystemValueText("QPRCFEAT_DES"),true)); - - // V4R4 system values. - SystemValueList.list.put("QCFGMSGQ", new SystemValueInfo("QCFGMSGQ", SERVER_TYPE_CHAR, 20, 1, TYPE_STRING, GROUP_MSG, VRM440, ResourceBundleLoader.getSystemValueText("QCFGMSGQ_DES"))); - SystemValueList.list.put("QMLTTHDACN", new SystemValueInfo("QMLTTHDACN", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM440, ResourceBundleLoader.getSystemValueText("QMLTTHDACN_DES"))); - - SystemValueList.list.put("QMAXJOB", new SystemValueInfo("QMAXJOB", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_ALC, VRM510, ResourceBundleLoader.getSystemValueText("QMAXJOB_DES"))); - SystemValueList.list.put("QMAXSPLF", new SystemValueInfo("QMAXSPLF", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_ALC, VRM510, ResourceBundleLoader.getSystemValueText("QMAXSPLF_DES"))); - SystemValueList.list.put("QVFYOBJRST", new SystemValueInfo("QVFYOBJRST", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SEC, VRM510, ResourceBundleLoader.getSystemValueText("QVFYOBJRST_DES"))); - SystemValueList.list.put("QSHRMEMCTL", new SystemValueInfo("QSHRMEMCTL", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SEC, VRM510, ResourceBundleLoader.getSystemValueText("QSHRMEMCTL_DES"))); - SystemValueList.list.put("QLIBLCKLVL", new SystemValueInfo("QLIBLCKLVL", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_LIBL, VRM510, ResourceBundleLoader.getSystemValueText("QLIBLCKLVL_DES"))); - SystemValueList.list.put("QPWDLVL", new SystemValueInfo("QPWDLVL", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_SEC, VRM510, ResourceBundleLoader.getSystemValueText("QPWDLVL_DES"))); - - // V5R2 system values. - SystemValueList.list.put("QSPLFACN", new SystemValueInfo("QSPLFACN", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_ALC, VRM520, ResourceBundleLoader.getSystemValueText("QSPLFACN_DES"))); - SystemValueList.list.put("QDBFSTCCOL", new SystemValueInfo("QDBFSTCCOL", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SYSCTL, VRM520, ResourceBundleLoader.getSystemValueText("QDBFSTCCOL_DES"))); - - // V5R3 system values. - SystemValueList.list.put("QAUDLVL2", new SystemValueInfo("QAUDLVL2", SERVER_TYPE_CHAR, 10, 99, TYPE_ARRAY, GROUP_SEC, VRM530, ResourceBundleLoader.getSystemValueText("QAUDLVL2_DES"))); - SystemValueList.list.put("QDATETIME", new SystemValueInfo("QDATETIME", SERVER_TYPE_CHAR, 20, 1, TYPE_STRING, GROUP_DATTIM, VRM530, ResourceBundleLoader.getSystemValueText("QDATETIME_DES"))); - // The format of the QDATETIME field is YYYYMMDDHHNNSSXXXXXX - // where YYYY is the year, MM is the month, DD is the day, - // HH is the hours, NN is the minutes, SS is the seconds, - // and XXXXXX is the microseconds. - - SystemValueList.list.put("QENDJOBLMT", new SystemValueInfo("QENDJOBLMT", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_SYSCTL, VRM530, ResourceBundleLoader.getSystemValueText("QENDJOBLMT_DES"))); - SystemValueList.list.put("QSAVACCPTH", new SystemValueInfo("QSAVACCPTH", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM530, ResourceBundleLoader.getSystemValueText("QSAVACCPTH_DES"))); - SystemValueList.list.put("QSCANFS", new SystemValueInfo("QSCANFS", SERVER_TYPE_CHAR, 10, 20, TYPE_ARRAY, GROUP_SEC, VRM530, ResourceBundleLoader.getSystemValueText("QSCANFS_DES"))); - SystemValueList.list.put("QSCANFSCTL", new SystemValueInfo("QSCANFSCTL", SERVER_TYPE_CHAR, 10, 20, TYPE_ARRAY, GROUP_SEC, VRM530, ResourceBundleLoader.getSystemValueText("QSCANFSCTL_DES"))); - SystemValueList.list.put("QTIMADJ", new SystemValueInfo("QTIMADJ", SERVER_TYPE_CHAR, 28, 1, TYPE_STRING, GROUP_DATTIM, VRM530, ResourceBundleLoader.getSystemValueText("QTIMADJ_DES"))); - SystemValueList.list.put("QTIMZON", new SystemValueInfo("QTIMZON", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_DATTIM, VRM530, ResourceBundleLoader.getSystemValueText("QTIMZON_DES"))); - SystemValueList.list.put("QTHDRSCAFN", new SystemValueInfo("QTHDRSCAFN", SERVER_TYPE_CHAR, 10, 2, TYPE_ARRAY, GROUP_SYSCTL, VRM530, ResourceBundleLoader.getSystemValueText("QTHDRSCAFN_DES"))); - SystemValueList.list.put("QTHDRSCADJ", new SystemValueInfo("QTHDRSCADJ", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM530, ResourceBundleLoader.getSystemValueText("QTHDRSCADJ_DES"))); - - // V5R4 system values. - SystemValueList.list.put("QALWJOBITP", new SystemValueInfo("QALWJOBITP", SERVER_TYPE_CHAR, 1, 1, TYPE_STRING, GROUP_SYSCTL, VRM540, ResourceBundleLoader.getSystemValueText("QALWJOBITP_DES"))); - SystemValueList.list.put("QLOGOUTPUT", new SystemValueInfo("QLOGOUTPUT", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_MSG, VRM540, ResourceBundleLoader.getSystemValueText("QLOGOUTPUT_DES"))); - - // V6R1 system values. - SystemValueList.list.put("QPWDRULES", new SystemValueInfo("QPWDRULES", SERVER_TYPE_CHAR, 15, 50, TYPE_ARRAY, GROUP_SEC, VRM610, ResourceBundleLoader.getSystemValueText("QPWDRULES_DES"))); - SystemValueList.list.put("QPWDCHGBLK", new SystemValueInfo("QPWDCHGBLK", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SEC, VRM610, ResourceBundleLoader.getSystemValueText("QPWDCHGBLK_DES"))); - SystemValueList.list.put("QPWDEXPWRN", new SystemValueInfo("QPWDEXPWRN", SERVER_TYPE_BINARY, 4, 1, TYPE_INTEGER, GROUP_SEC, VRM610, ResourceBundleLoader.getSystemValueText("QPWDEXPWRN_DES"))); - SystemValueList.list.put("QSSLPCL", new SystemValueInfo("QSSLPCL", SERVER_TYPE_CHAR, 10, 10, TYPE_ARRAY, GROUP_SEC, VRM610, ResourceBundleLoader.getSystemValueText("QSSLPCL_DES"))); - SystemValueList.list.put("QSSLCSLCTL", new SystemValueInfo("QSSLCSLCTL", SERVER_TYPE_CHAR, 10, 1, TYPE_STRING, GROUP_SEC, VRM610, ResourceBundleLoader.getSystemValueText("QSSLCSLCTL_DES"))); - SystemValueList.list.put("QSSLCSL", new SystemValueInfo("QSSLCSL", SERVER_TYPE_CHAR, 40, 32, TYPE_ARRAY, GROUP_SEC, VRM610, ResourceBundleLoader.getSystemValueText("QSSLCSL_DES"))); - - // Populate the group vectors. - Enumeration elements = SystemValueList.list.elements(); - while (elements.hasMoreElements()) - { - SystemValueInfo obj = (SystemValueInfo)elements.nextElement(); - SystemValueList.groups[obj.group_].addElement(obj); - SystemValueList.groups[GROUP_ALL].addElement(obj); - } - } - - // The system where the system value list is located. - private AS400 system_ = null; - // Flag indicating if a connection been made. - private boolean connected_ = false; - - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_ = null; // Set on first add. - // List of vetoable change event bean listeners. - private transient VetoableChangeSupport vetoableChangeListeners_ = null; // Set on first add. - - /** - Constructs a SystemValueList object. It creates a default SystemValueList object. The system property must be set before attempting a connection. - **/ - public SystemValueList() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SystemValueList object."); - } - - /** - Constructs a SystemValueList object. It creates a SystemValueList instance that represents a list of system values on system. - @param system The system that contains the system values. - **/ - public SystemValueList(AS400 system) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing SystemValueGroup object, system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - system_ = system; - } - - /** - Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method will be called each time the value of any bound property is changed. The PropertyChangeListener object is added to a list of PropertyChangeListeners managed by this SystemValue. It can be removed with removePropertyChangeListener. - @param listener The listener object. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Adds a VetoableChangeListener. The specified VetoableChangeListener's vetoableChange method will be called each time the value of any constrained property is changed. - @param listener The listener object. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - } - - // Makes a connection to the system. The system property must be set before a connection can be made. - private void connect() throws AS400SecurityException, IOException - { - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - connected_ = true; - } - - /** - Returns a set of SystemValue objects. Returns the system values that belong to the system value group specified by group and sorted by name. - @param group The system value group. - @return A Vector of {@link SystemValue SystemValue} objects. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public Vector getGroup(int group) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (!connected_) connect(); - - if (group < 0 || group > GROUP_ALL) - { - Trace.log(Trace.ERROR, "Value of parameter 'group' is not valid:", group); - throw new ExtendedIllegalArgumentException("group", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Get the group vector. - Vector infos = SystemValueList.groups[group]; - - // QFRCCVNRST was in group SYSCTL in release V5R1M0 and below, and moved to group SEC in V5R2M0 and above. By default we have it in group SEC, so if the IBM i release is V5R1M0 or below, we fix up the group here. - if (system_.getVRM() <= VRM510) - { - switch (group) - { - case SystemValueList.GROUP_SEC: - // Make a copy of the group and remove QFRCCVNRST. - infos = (Vector)infos.clone(); - infos.removeElement(SystemValueList.lookup("QFRCCVNRST")); - break; - case SystemValueList.GROUP_SYSCTL: - // Make a copy of the group and add QFRCCVNRST. - infos = (Vector)infos.clone(); - infos.addElement(SystemValueList.lookup("QFRCCVNRST")); - break; - } - } - - // Call retrieve() to get the data from the server and create a Vector of corresponding SystemValue objects. - return sort(SystemValueUtility.retrieve(system_, infos.elements(), getGroupName(group), getGroupDescription(group))); - } - - /** - Returns the total number of possible groups. - @return The number of groups. - **/ - public static int getGroupCount() - { - return GROUP_COUNT; - } - - /** - Returns the description for the specified system value group. - @param group The system value group. - @return The description of the system value group. - **/ - public static String getGroupDescription(int group) - { - if (group < 0 || group > GROUP_ALL) - { - Trace.log(Trace.ERROR, "Value of parameter 'group' is not valid:", group); - throw new ExtendedIllegalArgumentException("group", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - return GROUP_DESCRIPTIONS[group]; - } - - /** - Returns the description for the specified system value group. - @param group The system value group. - @param locale The Locale used to load the appropriate language. - @return The description of the system value group. - **/ - public static String getGroupDescription(int group, Locale locale) - { - if (group < 0 || group > GROUP_ALL) - { - Trace.log(Trace.ERROR, "Value of parameter 'group' is not valid:", group); - throw new ExtendedIllegalArgumentException("group", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (locale == null) return GROUP_DESCRIPTIONS[group]; - switch (group) - { - case 0: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_ALC_DESC", locale); - case 1: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_DATTIM_DESC", locale); - case 2: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_EDT_DESC", locale); - case 3: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_LIBL_DESC", locale); - case 4: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_MSG_DESC", locale); - case 5: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_SEC_DESC", locale); - case 6: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_STG_DESC", locale); - case 7: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_SYSCTL_DESC", locale); - case 8: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_NET_DESC", locale); - case 9: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_ALL_DESC", locale); - } - return GROUP_DESCRIPTIONS[group]; - } - - /** - Returns the name of the specified system value group. - @param group The system value group. - @return The name of the system value group. - **/ - public static String getGroupName(int group) - { - if (group < 0 || group > GROUP_ALL) - { - Trace.log(Trace.ERROR, "Value of parameter 'group' is not valid:", group); - throw new ExtendedIllegalArgumentException("group", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - return GROUP_NAMES[group]; - } - - /** - Returns the name of the specified system value group. - @param group The system value group. - @param locale The Locale used to load the appropriate language. - @return The name of the system value group. - **/ - public static String getGroupName(int group, Locale locale) - { - if (group < 0 || group > GROUP_ALL) - { - Trace.log(Trace.ERROR, "Value of parameter 'group' is not valid:", group); - throw new ExtendedIllegalArgumentException("group", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (locale == null) return GROUP_NAMES[group]; - switch (group) - { - case 0: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_ALC_NAME", locale); - case 1: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_DATTIM_NAME", locale); - case 2: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_EDT_NAME", locale); - case 3: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_LIBL_NAME", locale); - case 4: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_MSG_NAME", locale); - case 5: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_SEC_NAME", locale); - case 6: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_STG_NAME", locale); - case 7: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_SYSCTL_NAME", locale); - case 8: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_NET_NAME", locale); - case 9: return ResourceBundleLoader.getSystemValueText("SYSTEM_VALUE_GROUP_ALL_NAME", locale); - } - return GROUP_NAMES[group]; - } - - /** - Returns the system object representing the system on which the system value list exists. - @return The system object representing the system on which the system value list exists. If the system has not been set, null is returned. - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - // Returns a SystemValueInfo object for the system value specified by name. - // @param name The name of the system value. - // @return The SystemValueInfo object corresponding to name. - static SystemValueInfo lookup(String name) - { - SystemValueInfo obj = (SystemValueInfo)SystemValueList.list.get(name); - if (obj == null) - { - Trace.log(Trace.ERROR, "System value was not found: " + name); - throw new ExtendedIllegalArgumentException(name, ExtendedIllegalArgumentException.FIELD_NOT_FOUND); - } - return obj; - } - - // Returns the locale-specific description for a SystemValue. - static String lookupDescription(SystemValueInfo info, Locale locale) - { - return ResourceBundleLoader.getSystemValueText(info.name_.toUpperCase().trim() + "_DES", locale); - } - - /** - Removes the PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes the VetoableChangeListener. If the VetoableChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - /** - Sets the system object representing the system on which the system value list exists. - @param system The system object representing the system on which the system value list exists. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setSystem(AS400 system) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system: " + system); - - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (connected_) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - system_ = system; - } - else - { - AS400 oldValue = system_; - AS400 newValue = system; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("system", oldValue, newValue); - } - system_ = system; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("system", oldValue, newValue); - } - } - } - - // Recursively sorts vectors of SystemValue objects by name. - // @param vec The objects to sort. - // @return The Vector of sorted objects. - static Vector sort(Vector vec) - { - int len = vec.size(); - if (len < 2) return vec; - SystemValue middle = (SystemValue)vec.elementAt(len / 2); - Vector lessthan = new Vector(len / 2); - Vector equalto = new Vector(len / 2); - Vector greaterthan = new Vector(len / 2); - Enumeration elements = vec.elements(); - while (elements.hasMoreElements()) - { - SystemValue obj = (SystemValue)elements.nextElement(); - int comparison = obj.getName().compareTo(middle.getName()); - if (comparison < 0) lessthan.addElement(obj); - else if (comparison > 0) greaterthan.addElement(obj); - else equalto.addElement(obj); - } - lessthan.trimToSize(); - equalto.trimToSize(); - greaterthan.trimToSize(); - Vector lefthalf = sort(lessthan); - Vector righthalf = sort(greaterthan); - Vector whole = new Vector(lefthalf.size() + righthalf.size() + equalto.size()); - elements = lefthalf.elements(); - while (elements.hasMoreElements()) - { - whole.addElement(elements.nextElement()); - } - elements = equalto.elements(); - while (elements.hasMoreElements()) - { - whole.addElement(elements.nextElement()); - } - elements = righthalf.elements(); - while (elements.hasMoreElements()) - { - whole.addElement(elements.nextElement()); - } - return whole; - } - -/* static String getName(Vector systemValues, int position) - { - return ((SystemValue)systemValues.elementAt(position)).info_.name_; - }*/ -} diff --git a/cvsroot/src/com/ibm/as400/access/SystemValueList16.gif b/cvsroot/src/com/ibm/as400/access/SystemValueList16.gif deleted file mode 100644 index eaed6d40b..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/SystemValueList16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/SystemValueList32.gif b/cvsroot/src/com/ibm/as400/access/SystemValueList32.gif deleted file mode 100644 index ec4d56380..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/SystemValueList32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/SystemValueListBeanInfo.java b/cvsroot/src/com/ibm/as400/access/SystemValueListBeanInfo.java deleted file mode 100644 index ff5667208..000000000 --- a/cvsroot/src/com/ibm/as400/access/SystemValueListBeanInfo.java +++ /dev/null @@ -1,131 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemValueListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - The SystemValueListBeanInfo class provides bean information for the SystemValueList class. - **/ -public class SystemValueListBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private static final Class BEAN_CLASS = SystemValueList.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - - eventSetDescriptors = new EventSetDescriptor[] { propertyChange, vetoableChange }; - - PropertyDescriptor system = new PropertyDescriptor("system", BEAN_CLASS); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - - propertyDescriptors = new PropertyDescriptor[] { system }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return One (1), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "vetoableChange" event. - return 1; - } - - /** - Returns the index of the default property. - @return Zero (0), the index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // The index for the "system" property. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("SystemValueList16.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("SystemValueList32.gif"); - } - return null; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/SystemValueListener.java b/cvsroot/src/com/ibm/as400/access/SystemValueListener.java deleted file mode 100644 index bed60d291..000000000 --- a/cvsroot/src/com/ibm/as400/access/SystemValueListener.java +++ /dev/null @@ -1,29 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemValueListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.EventListener; - -/** - The SystemValueListener interface provides a listener interface for receiving SystemValueEvents. - @see SystemValueEvent - **/ -public interface SystemValueListener extends EventListener -{ - /** - Invoked when a system value on the system is changed by this object. - @param event The system value changed event. - **/ - abstract public void systemValueChanged(SystemValueEvent event); -} diff --git a/cvsroot/src/com/ibm/as400/access/SystemValueUtility.java b/cvsroot/src/com/ibm/as400/access/SystemValueUtility.java deleted file mode 100644 index 8e9b0d454..000000000 --- a/cvsroot/src/com/ibm/as400/access/SystemValueUtility.java +++ /dev/null @@ -1,427 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemValueUtility.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.math.BigInteger; -import java.math.BigDecimal; -import java.sql.Time; -import java.util.Calendar; -import java.util.Enumeration; -import java.util.Vector; - -// Contains static methods for setting and getting system values from the system. Used by the SystemValue, SystemValueGroup, and SystemValueList classes. -class SystemValueUtility -{ - // Parses the data stream returned by the Program Call. Extracts the system value information tables from the data stream. - // @return A Vector of Java objects corresponding to the values retrieved from the data stream. - private static Vector parse(byte[] data, AS400 system, Converter conv) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, ObjectDoesNotExistException, IOException - { - Vector values = new Vector(); - - // Separates the return values, see API reference for detail. - int valueNumber = BinaryConverter.byteArrayToInt(data, 0); - - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC,"Number of values:", valueNumber); - - // Loop through the information tables returned and set the appropriate system values to their corresponding data values. - for (int i = 0; i < valueNumber; ++i) - { - int valueOffset = BinaryConverter.byteArrayToInt(data, (i + 1) * 4); - - // Get system value name. - String name = conv.byteArrayToString(data, valueOffset, 10).trim(); - SystemValueInfo obj = SystemValueList.lookup(name); - - // Get system value information status. - if (data[valueOffset + 11] == (byte)0xD3) - { - // If the value is locked then throw an exception. - Trace.log(Trace.ERROR, "System value is locked, name: " + name); - throw new ExtendedIOException(name, ExtendedIOException.LOCK_VIOLATION); - } - // Get system value type. - if (data[valueOffset + 10] != obj.serverDataType_) - { - Trace.log(Trace.ERROR, "System value type mismatch, name: " + name); - throw new ExtendedIllegalStateException("type", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Gets value data. - int size = BinaryConverter.byteArrayToInt(data, valueOffset + 12); - - Object value = null; - - switch (obj.serverDataType_) - // Valid values are SystemValueList.SERVER_TYPE_BINARY and SERVER_TYPE_CHAR. - { - case SystemValueList.SERVER_TYPE_CHAR: - if (obj.type_ == SystemValueList.TYPE_ARRAY) - { - int arrayCount = 0; - int dataOffset = valueOffset + 16; - while (arrayCount < obj.arraySize_ && data[dataOffset + (arrayCount * obj.size_)] != 0x40) ++arrayCount; - String[] valueArray = new String[arrayCount]; - for (int ii = 0; ii < arrayCount; ++ii) - { - valueArray[ii] = conv.byteArrayToString(data, dataOffset + (ii * obj.size_), obj.size_); - } - value = valueArray; - } - else - { - value = conv.byteArrayToString(data, valueOffset + 16, size); - } - break; - case SystemValueList.SERVER_TYPE_BINARY: - if (obj.type_ == SystemValueList.TYPE_DECIMAL) - { - byte[] valueBytes = new byte[4]; - System.arraycopy(data, valueOffset + 16, valueBytes, 0, 4); - value = new BigDecimal(new BigInteger(valueBytes), obj.decimalPositions_); - } - else - { - value = new Integer(BinaryConverter.byteArrayToInt(data, valueOffset + 16)); - } - break; - default: - Trace.log(Trace.WARNING, "Invalid value for SystemValueInfo.serverDataType_: " + obj.serverDataType_); - } - - // Handle special cases. - if (obj.name_.equals("QDATE")) - { - // Need to parse the String into a Date object, API format is CYYMMDD. - String stringValue = value.toString(); - Calendar cal = Calendar.getInstance(); - cal.set(1900 + (100 * Integer.parseInt(stringValue.substring(0, 1))) + Integer.parseInt(stringValue.substring(1, 3)), Integer.parseInt(stringValue.substring(3, 5)) - 1, Integer.parseInt(stringValue.substring(5, 7))); - value = new java.sql.Date(cal.getTime().getTime()); - } - else if (obj.name_.equals("QTIME")) - { - // Need to parse the String into a Date object, API format is HHMMSSXXX. - String stringValue = value.toString(); - Calendar cal = Calendar.getInstance(); - cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(stringValue.substring(0, 2))); - cal.set(Calendar.MINUTE, Integer.parseInt(stringValue.substring(2, 4))); - cal.set(Calendar.SECOND, Integer.parseInt(stringValue.substring(4, 6))); - cal.set(Calendar.MILLISECOND, Integer.parseInt(stringValue.substring(6, 9))); - value = new Time(cal.getTime().getTime()); - } - - // Sometimes hex zeros get returned for the PNDSYSNAME which shows up as square boxes in the visual system value components. So we replace the hex zeros with Unicode spaces. - else if (obj.name_.equals("PNDSYSNAME")) - { - value = ((String)value).replace((char)0x00, ' '); - } - - // Handle QLOCALE as a special case. - else if (obj.name_.equals("QLOCALE")) - { - //offset length description - // 0 bin 4 ccsid - // 4 char 2 country id - // 6 char 3 language id - // 9 char 3 reserved - // 12 bin 4 flag byte - // 16 bin 4 number of bytes in locale path name - // 20 char 2 locale delimiter - // 22 char 10 reserved - // 32 char 2048 locale path name - - int offset = valueOffset + 16; - - int localeCcsid = BinaryConverter.byteArrayToInt(data, offset); - int localeLen = BinaryConverter.byteArrayToInt(data, offset + 16); - - if (localeLen == 0) // *NONE - { - value = "*NONE"; - } - else if (localeLen == 1) // *POSIX or *C - { - value = conv.byteArrayToString(data, offset + 32, 20); - } - else // A real path name. - { - value = (new Converter(localeCcsid, system)).byteArrayToString(data, offset + 32, localeLen); - } - } - values.addElement(value); - } - return values; - } - - // Retrieves a system value from the system. - // @return A Java object representing the current setting for the system value specified by info on system. Never returns null. - static Object retrieve(AS400 system, SystemValueInfo info) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - Vector infos = new Vector(); - infos.addElement(info); - Vector values = retrieveFromSystem(system, infos, info.group_ == SystemValueList.GROUP_NET); - return values.elementAt(0); - } - - // Retrieves several system values from the system. If a value is not supported by the provided system, then it is not retrieved. - // @param system The system. - // @param infos The enumeration of SystemValueInfo objects for which to retrieve values. - // @return A Vector of SystemValue objects representing the current settings for the system values specified by infos on system. - static Vector retrieve(AS400 system, Enumeration infos, String groupName, String groupDescription) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - Vector svInfos = new Vector(); // System values. - Vector naInfos = new Vector(); // Network attributes. - int vrm = system.getVRM(); - while (infos.hasMoreElements()) - { - SystemValueInfo svi = (SystemValueInfo)infos.nextElement(); - if (svi.release_ <= vrm) - { - if (svi.group_ == SystemValueList.GROUP_NET) - { - naInfos.addElement(svi); // naInfos contains the net attributes. - } - else - { - svInfos.addElement(svi); // svInfos contains the system values. - } - } - } - - Vector svValues = new Vector(); // Actual values for system values. - Vector naValues = new Vector(); // Actual values for network attributes. - if (svInfos.size() > 0) - { - // Get the system value values. - svValues = retrieveFromSystem(system, svInfos, false); - } - if (naInfos.size() > 0) - { - // Get the network attribute values. - naValues = retrieveFromSystem(system, naInfos, true); - } - - // Build new SystemValue objects to hold the data. - Vector systemValues = new Vector(svInfos.size() + naInfos.size()); - for (int i = 0; i < svInfos.size(); ++i) - { - systemValues.addElement(new SystemValue(system, (SystemValueInfo)svInfos.elementAt(i), svValues.elementAt(i), groupName, groupDescription)); - } - for (int i = 0; i < naInfos.size(); ++i) - { - systemValues.addElement(new SystemValue(system, (SystemValueInfo)naInfos.elementAt(i), naValues.elementAt(i), groupName, groupDescription)); - } - return systemValues; - } - - // This method does the actual retrieving with a Program Call. - // @param values The Vector of SystemValueInfo objects. - // @return A Vector of SystemValue objects containing the retrieved data. - static Vector retrieveFromSystem(AS400 system, Vector infos, boolean isNetA) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Calculates the length of the return values. - int valuesCount = infos.size(); - int rLength = 4; - byte[] names = new byte[valuesCount * 10]; - for (int i = 0; i < names.length; ++i) names[i] = 0x40; - Converter conv = new Converter(system.getJobCcsid(), system); - for (int i = 0; i < valuesCount; ++i) - { - SystemValueInfo svi = (SystemValueInfo)infos.elementAt(i); - rLength += svi.size_ * svi.arraySize_ + 24; - conv.stringToByteArray(svi.name_, names, i * 10); - } - - // Construct parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Receiver variable - Output - Char(*). - new ProgramParameter(rLength), - // Length of receiver variable - Input - Binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(rLength)), - // Number of network attributes or system values to retrieve - Input - Binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(valuesCount)), - // Network attribute or system value names - Input - Array(*) of Char(10). - new ProgramParameter(names), - // Error code - I/0 - Char(*). - new ProgramParameter(new byte[8]) - }; - - ProgramCall prog = new ProgramCall(system, isNetA ? "/QSYS.LIB/QWCRNETA.PGM" : "/QSYS.LIB/QWCRSVAL.PGM", parameters); - // Both QWCRNETA and QWCRSVAL are threadsafe. - prog.suggestThreadsafe(); - - if (!prog.run()) - { - throw new AS400Exception(prog.getMessageList()); - } - - // Parse the returned data. - return parse(parameters[0].getOutputData(), system, conv); - } - - // Sets the system value on the system. - // @param system The system. - // @param info The system value to set. - // @param value The data that the system value is to contain. - static void set(AS400 system, SystemValueInfo info, Object value) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (info.readOnly_) - { - Trace.log(Trace.ERROR, "Cannot set value of read only system value, name: " + info.name_); - throw new ExtendedIllegalStateException(info.name_, ExtendedIllegalStateException.OBJECT_IS_READ_ONLY); - } - boolean isNetA = info.group_ == SystemValueList.GROUP_NET; - - // String containing command. - StringBuffer command = new StringBuffer( - (isNetA) ? "QSYS/CHGNETA " + info.name_ + "(" : - "QSYS/CHGSYSVAL SYSVAL(" + info.name_ + ") VALUE("); - - // String containing value for command. - String valueString = value.toString(); - - // First check to see if the value being set is *SOMETHING since that can occur on any type of parameter, not just strings. - if (valueString.indexOf("*") == 0) - { - // It is a starcmd. - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "System value's value is special star value: '" + (String)value + "'"); - command.append(valueString.trim()); - } - else - { - try - { - switch (info.type_) - // Valid values are TYPE_STRING, TYPE_DECIMAL, TYPE_INTEGER, TYPE_ARRAY, and TYPE_DATE. - { - case SystemValueList.TYPE_STRING: - // Add string to command. - command.append( - (isNetA) ? valueString : "'" + valueString + "'"); - break; - - case SystemValueList.TYPE_DECIMAL: - // Convert BigDecimal value to String value, add to command. - command.append( - ((BigDecimal)value).setScale(info.decimalPositions_, BigDecimal.ROUND_HALF_UP).toString()); - break; - - case SystemValueList.TYPE_INTEGER: - // Convert Integer value to String value. - command.append(((Integer)value).toString()); - break; - - case SystemValueList.TYPE_ARRAY: - // Convert an array of strings to a single line String, add to command. - Object[] objarr = (Object[])value; - int length = objarr.length; - if (!isNetA) command.append("'"); - for (int j = 0; j < length; ++j) - { - command.append((String)objarr[j]); - command.append(" "); - } - if (!isNetA) command.append("'"); - break; - - case SystemValueList.TYPE_DATE: - // Get date information. - Calendar dateTime = Calendar.getInstance(); - dateTime.clear(); - dateTime.setTime((java.util.Date)value); - - if (info.name_.equals("QDATE")) - { - //String values of year, month and day. - String century, year, month, day; - //Converts year's information to QYEAR and QCENTURY. - int iYear = dateTime.get(Calendar.YEAR); - if (iYear < 1900 || iYear > 2100) - { - Trace.log(Trace.ERROR, "Value of system value 'QYEAR' is not valid:", iYear); - throw new ExtendedIllegalArgumentException("QYEAR (" + iYear + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (iYear < 2000) - { - century = "0"; - year = Integer.toString(iYear - 1900); - } - else - { - century = "1"; - year = Integer.toString(iYear - 2000); - } - if (year.length() == 1) year = "0" + year; - - // Converts month's information to QMONTH. - month = Integer.toString(dateTime.get(Calendar.MONTH) + 1); - if (month.length() == 1) month = "0" + month; - - // Converts day's information to QDAY. - day = Integer.toString(dateTime.get(Calendar.DAY_OF_MONTH)); - if (day.length() == 1) day = "0" + day; - - // Sets QCENTURY, QYEAR, QMONTH and QDAY. - set(system, SystemValueList.lookup("QCENTURY"), century); - set(system, SystemValueList.lookup("QYEAR"), year); - set(system, SystemValueList.lookup("QMONTH"), month); - set(system, SystemValueList.lookup("QDAY"), day); - - return; - } - command.append("'"); - - // It is either QTIME or QIPLDATTIM. - int hour = dateTime.get(Calendar.HOUR_OF_DAY); - if (hour < 10) command.append("0"); - command.append(Integer.toString(hour)); - - int minute = dateTime.get(Calendar.MINUTE); - if (minute < 10) command.append("0"); - command.append(Integer.toString(minute)); - - int second = dateTime.get(Calendar.SECOND); - if (second < 10) command.append("0"); - command.append(Integer.toString(second)); - - command.append("'"); - break; - - default: - Trace.log(Trace.ERROR, "Invalid value for SystemValueInfo.type_: " + info.type_); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - } - catch (ClassCastException cce) - { - Trace.log(Trace.ERROR, "Cannot set system value, value is of incorrect type, name: " + info.name_ + ", value: " + value, cce); - throw new ExtendedIllegalArgumentException(info.name_, ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - command.append(")"); - - CommandCall cmd = new CommandCall(system, command.toString()); - // Neither CHGSYSVAL nor CHGNETA is threadsafe. - cmd.suggestThreadsafe(false); - - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Running system value command: " + command.toString()); - - if (!cmd.run()) - { - throw new AS400Exception(cmd.getMessageList()); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/TimeFieldDescription.java b/cvsroot/src/com/ibm/as400/access/TimeFieldDescription.java deleted file mode 100644 index b688d5db8..000000000 --- a/cvsroot/src/com/ibm/as400/access/TimeFieldDescription.java +++ /dev/null @@ -1,327 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: TimeFieldDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.util.Vector; -//@B0A -import java.util.Date; -import java.text.SimpleDateFormat; - -/** - *Represents the description of the data in a time field. - *The TimeFieldDescription class allows: - *

      - *
    • The user to describe a time field to the RecordFormat object. - *
    • The RecordFormat object to describe a time field to the user. - *
    - *click here to see an example. -**/ -public class TimeFieldDescription extends FieldDescription implements Serializable -{ - static final long serialVersionUID = 4L; - // The time format for this field - private String timeFormat_ = null; - // The time separator for this field - private String timeSeparator_ = null; - - /** - *Constructs a TimeFieldDescription object. - **/ - public TimeFieldDescription() - { - } - - /** - *Constructs a TimeFieldDescription object. It uses the data type - *and name of the field specified. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public TimeFieldDescription(AS400Text dataType, String name) - { - super(dataType, name); - } - - /** - *Constructs a TimeFieldDescription object. It uses the data type, - *name, and DDS name of the field specified. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - **/ - public TimeFieldDescription(AS400Text dataType, String name, String ddsName) - { - super(dataType, name, ddsName); - } - - /** - *Constructs a TimeFieldDescription object. It uses the data type - *and name of the field specified. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public TimeFieldDescription(AS400Time dataType, String name) - { - super(dataType, name); - } - - /** - *Constructs a TimeFieldDescription object. It uses the data type, - *name, and DDS name of the field specified. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - **/ - public TimeFieldDescription(AS400Time dataType, String name, String ddsName) - { - super(dataType, name, ddsName); - } - - - /** - *Returns the DDS description for the field. This is a string containing - *the description of the field as it would be specified in a DDS source file. - *This method is used by AS400File.createDDSSourceFile (called by the AS400File.create methods) - *to specify the field - *in the DDS source file which is used to create the file for the user who - *has passed in a RecordFormat object. - *@return The DDS description of this field properly formatted for entry - *into a DDS source file. - **/ - String[] getDDSDescription() - { - Vector v = new Vector(); - // Name columns (10) - StringBuffer desc = new StringBuffer(ddsName_); - // Blank pad the ddsName to 10 characters. - while(desc.length() < 10) - { - desc.append(" "); - } - // Reference column (1) - if (!refFld_.equals("")) - { - desc.append("R"); - } - else - { - desc.append(" "); - } - // Get length as 5 digit string, right justified - // Length columns (5) - desc.append(" "); // No length can be specified for a time field - // Type column (1) - desc.append("T"); - // Decimal positions columns (2) - desc.append(" "); - // Not used columns (7) - desc.append(" "); - // Add fixed portion of DDS description to Vector - v.addElement(desc.toString()); - // Add the field level keywords - String[] keywords = super.getFieldFunctions(); - if (keywords != null) - { - for (int i = 0; i < keywords.length; ++i) - { - v.addElement(keywords[i]); - } - } - if (timeFormat_ != null) - { - v.addElement("TIMFMT(" + timeFormat_ + ") "); - } - if (timeSeparator_ != null) - { - if (!formatHasFixedSeparator(timeFormat_)) { - v.addElement("TIMSEP('" + timeSeparator_ + "') "); - } - else { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "DDS time format " + timeFormat_ + " has a fixed separator."); - } - } - if (defaultValue_ != null) - { - v.addElement("DFT('" + defaultValue_.toString() + "') "); - } - //@B0A - else if (isDFTNull_) - { - v.addElement("DFT(*NULL) "); - } - String[] s = new String[v.size()]; - v.copyInto(s); - return s; - } - - private static boolean formatHasFixedSeparator(String format) - { - // Both DATSEP and TIMSEP have the same lists of "fixed-separator" formats. - return DateFieldDescription.formatHasFixedSeparator(format); - } - - /** - *Returns the value specified for the TIMFMT keyword for this field. - *@return The value specified for TIMFMT for - * this field. If TIMFMT was not specified for this field, - * an empty string is returned. - **/ - public String getTIMFMT() - { - return (timeFormat_ == null ? "" : timeFormat_); - } - - /** - *Returns the value specified for the TIMSEP keyword for this field. - *@return The value specified for TIMSEP for - * this field. If TIMSEP was not specified for this field, - * an empty string is returned. - **/ - public String getTIMSEP() - { - return (timeSeparator_ == null ? "" : timeSeparator_); - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400Text dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length of the field based on the data type - length_ = dataType.getByteLength(); - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400Time dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length of the field based on the data type - length_ = dataType.getByteLength(); - } - - //@B0C - javadoc - /** - *Sets the value for the DFT keyword for this field. - *@param defaultValue The default value for this - * field. The defaultValue cannot be null. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(String defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; //@B0A - isDFTCurrent_ = false; //@B0A - DFTCurrentValue_ = null; //@B0A - } - - //@B0A - /** - *Sets the default value for this field to be the current date. - *Calling this method will replace the DFT keyword that was previously - *set on a call to setDFT(String) or setDFTNull(). - **/ - public void setDFTCurrent() - { - isDFTCurrent_ = true; - isDFTNull_ = false; - defaultValue_ = null; - DFTCurrentValue_ = (new SimpleDateFormat("HH.mm.ss")).format(new Date()); - } - - //@B0A - /** - *Sets the value for the DFT keyword to be *NULL for this field. - *Calling this method will replace the DFT keyword that was previously - *set on a call to setDFT(String) or setDFTCurrent(). Note: This field - *must also have its ALWNULL keyword set to true to prevent DDS errors. - **/ - public void setDFTNull() - { - isDFTNull_ = true; - defaultValue_ = null; - isDFTCurrent_ = false; - DFTCurrentValue_ = null; - } - - /** - *Sets the value to specify for the TIMFMT keyword for this field. - *@param timeFormat The value to specify for TIMFMT for - * this field. The timeFormat cannot be null. - **/ - public void setTIMFMT(String timeFormat) - { - if (timeFormat == null) throw new NullPointerException("timeFormat"); - - if (timeFormat.startsWith("*")) { - timeFormat_ = timeFormat.toUpperCase(); - } - else { - timeFormat_ = "*" + timeFormat.toUpperCase(); - } - - // Inform the AS400Time object of the format. - if (dataType_ instanceof AS400Time) { - ((AS400Time)dataType_).setFormat(timeFormat); - } - } - - /** - *Sets the value to specify for the TIMSEP keyword for this field. - *@param separator The value to specify for TIMSEP for this field. - *A null value indicates "no separator". - **/ - public void setTIMSEP(String separator) - { - // Inform the AS400Time object of the separator. - if (dataType_ instanceof AS400Time) - { - if (separator != null && separator.length() > 1) { - throw new ExtendedIllegalArgumentException("separator (" + separator + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - Character sep = ( separator == null ? null : new Character(separator.charAt(0))); - ((AS400Time)dataType_).setSeparator(sep); - } - timeSeparator_ = separator; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/TimestampFieldDescription.java b/cvsroot/src/com/ibm/as400/access/TimestampFieldDescription.java deleted file mode 100644 index 4a14957b1..000000000 --- a/cvsroot/src/com/ibm/as400/access/TimestampFieldDescription.java +++ /dev/null @@ -1,241 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: TimestampFieldDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.Serializable; -import java.util.Vector; -//@B0A -import java.util.Date; -import java.text.SimpleDateFormat; - -/** - *Represents the description of the data in a Timestamp field. - *The TimestampFieldDescription class allows: - *
      - *
    • The user to describe a Timestamp field to the RecordFormat object. - *
    • The RecordFormat object to describe a Timestamp field to the user. - *
    - *Click here to see an example. -**/ -public class TimestampFieldDescription extends FieldDescription implements Serializable -{ - static final long serialVersionUID = 4L; - /** - *Constructs a TimestampFieldDescription object. - **/ - public TimestampFieldDescription() - { - } - - /** - *Constructs a TimestampFieldDescription object. It uses the data type - *and name of the field specified. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public TimestampFieldDescription(AS400Text dataType, String name) - { - super(dataType, name); - } - - /** - *Constructs a TimestampFieldDescription object. It uses the data type, - *name, and DDS name of the field specified. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - **/ - public TimestampFieldDescription(AS400Text dataType, String name, String ddsName) - { - super(dataType, name, ddsName); - } - - /** - *Constructs a TimestampFieldDescription object. It uses the data type - *and name of the field specified. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public TimestampFieldDescription(AS400Timestamp dataType, String name) - { - super(dataType, name); - } - - /** - *Constructs a TimestampFieldDescription object. It uses the data type, - *name, and DDS name of the field specified. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - **/ - public TimestampFieldDescription(AS400Timestamp dataType, String name, String ddsName) - { - super(dataType, name, ddsName); - } - - - /** - *Returns the DDS description for the field. This is a string containing - *the description of the field as it would be specified in a DDS source file. - *This method is used by AS400File.createDDSSourceFile (called by the AS400File.create methods) - *to specify the field - *in the DDS source file which is used to create the file for the user who - *has passed in a RecordFormat object. - *@return The DDS description of this field properly formatted for entry - *into a DDS source file. - **/ - String[] getDDSDescription() - { - Vector v = new Vector(); - // Name columns (10) - StringBuffer desc = new StringBuffer(ddsName_); - // Blank pad the ddsName to 10 characters. - while(desc.length() < 10) - { - desc.append(" "); - } - // Reference column (1) - if (!refFld_.equals("")) - { - desc.append("R"); - } - else - { - desc.append(" "); - } - // Get length as 5 digit string, right justified - // Length columns (5) - desc.append(" "); // No length can be specified for a timestamp field - // Type column (1) - desc.append("Z"); - // Decimal positions columns (2) - desc.append(" "); - // Not used columns (7) - desc.append(" "); - // Add fixed portion of DDS description to Vector - v.addElement(desc.toString()); - // Add the field level keywords - String[] keywords = super.getFieldFunctions(); - if (keywords != null) - { - for (int i = 0; i < keywords.length; ++i) - { - v.addElement(keywords[i]); - } - } - if (defaultValue_ != null) - { - v.addElement("DFT('" + defaultValue_.toString() + "') "); - } - //@B0A - else if (isDFTNull_) - { - v.addElement("DFT(*NULL) "); - } - String[] s = new String[v.size()]; - v.copyInto(s); - return s; - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400Text dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length of the field based on the data type - length_ = dataType.getByteLength(); - } - - /** - *Sets the AS400DataType object describing this field. - *@param dataType The AS400DataType that describes this field. The dataType - *cannot be null. - **/ - public void setDataType(AS400Timestamp dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - // Set the length of the field based on the data type - length_ = dataType.getByteLength(); - } - - //@B0C - javadoc - /** - *Sets the value for the DFT keyword for this field. - *@param defaultValue The default value for this - * field. The defaultValue cannot be null. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(String defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; //@B0A - isDFTCurrent_ = false; //@B0A - DFTCurrentValue_ = null; //@B0A - } - - //@B0A - /** - *Sets the default value for this field to be the current date. - *Calling this method will replace the DFT keyword that was previously - *set on a call to setDFT(String) or setDFTNull(). - **/ - public void setDFTCurrent() - { - isDFTCurrent_ = true; - isDFTNull_ = false; - defaultValue_ = null; - DFTCurrentValue_ = (new SimpleDateFormat("yyyy-MM-dd-HH.mm.ss.SSS")).format(new Date()); - } - - //@B0A - /** - *Sets the value for the DFT keyword to be *NULL for this field. - *Calling this method will replace the DFT keyword that was previously - *set on a call to setDFT(String) or setDFTCurrent(). Note: This field - *must also have its ALWNULL keyword set to true to prevent DDS errors. - **/ - public void setDFTNull() - { - isDFTNull_ = true; - defaultValue_ = null; - isDFTCurrent_ = false; - DFTCurrentValue_ = null; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/TokenManager.java b/cvsroot/src/com/ibm/as400/access/TokenManager.java deleted file mode 100644 index cbf610526..000000000 --- a/cvsroot/src/com/ibm/as400/access/TokenManager.java +++ /dev/null @@ -1,51 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: TokenManager.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import org.ietf.jgss.GSSContext; -import org.ietf.jgss.GSSCredential; -import org.ietf.jgss.GSSManager; -import org.ietf.jgss.GSSName; -import org.ietf.jgss.Oid; - -class TokenManager -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - static byte[] getGSSToken(String systemName, String gssName) throws Exception - { - GSSManager manager = GSSManager.getInstance(); - if (Trace.isTraceOn()) - { - Oid[] mechs = manager.getMechs(); - Trace.log(Trace.DIAGNOSTIC, "GSS number of mechs available: ", mechs.length); - for (int i = 0; i < mechs.length; ++i) Trace.log(Trace.DIAGNOSTIC, mechs[i].toString()); - } - Oid krb5Mech = new Oid("1.2.840.113554.1.2.2"); - GSSName serverName = manager.createName("krbsvr400@" + systemName, GSSName.NT_HOSTBASED_SERVICE, krb5Mech); - - GSSCredential credential; - if (gssName.length() == 0) - { - credential = manager.createCredential(GSSCredential.INITIATE_ONLY); - } - else - { - GSSName userName = manager.createName(gssName, GSSName.NT_USER_NAME); - credential = manager.createCredential(userName, GSSCredential.DEFAULT_LIFETIME, krb5Mech, GSSCredential.INITIATE_ONLY); - } - - GSSContext context = manager.createContext(serverName, krb5Mech, credential, GSSCredential.DEFAULT_LIFETIME); - return context.initSecContext(new byte[0], 0, 0); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/TokenManager2.java b/cvsroot/src/com/ibm/as400/access/TokenManager2.java deleted file mode 100644 index 165a84e84..000000000 --- a/cvsroot/src/com/ibm/as400/access/TokenManager2.java +++ /dev/null @@ -1,41 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: TokenManager2.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import org.ietf.jgss.GSSContext; -import org.ietf.jgss.GSSCredential; -import org.ietf.jgss.GSSManager; -import org.ietf.jgss.GSSName; -import org.ietf.jgss.Oid; - -class TokenManager2 -{ - static byte[] getGSSToken(String systemName, Object gssCredential) throws Exception - { - GSSManager manager = GSSManager.getInstance(); - if (Trace.isTraceOn()) - { - Oid[] mechs = manager.getMechs(); - Trace.log(Trace.DIAGNOSTIC, "GSS number of mechs available: ", mechs.length); - for (int i = 0; i < mechs.length; ++i) Trace.log(Trace.DIAGNOSTIC, mechs[i].toString()); - } - Oid krb5Mech = new Oid("1.2.840.113554.1.2.2"); - GSSName serverName = manager.createName("krbsvr400@" + systemName, GSSName.NT_HOSTBASED_SERVICE, krb5Mech); - - GSSCredential credential = (GSSCredential)gssCredential; - - GSSContext context = manager.createContext(serverName, krb5Mech, credential, GSSCredential.DEFAULT_LIFETIME); - return context.initSecContext(new byte[0], 0, 0); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/ToolboxLogger.java b/cvsroot/src/com/ibm/as400/access/ToolboxLogger.java deleted file mode 100644 index 6a4fb7d62..000000000 --- a/cvsroot/src/com/ibm/as400/access/ToolboxLogger.java +++ /dev/null @@ -1,198 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ToolboxLogger.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2005-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.logging.*; -import java.util.Enumeration; -import java.util.Vector; - -/** - This class is used to wrapper the (static) Toolbox Logger (java.util.logging.Logger), if one has been activated. We need to do this indirection because the java.util.logging package didn't exist prior to JDK 1.4. -**/ -class ToolboxLogger -{ - private static final String copyright = "Copyright (C) 2005-2005 International Business Machines Corporation and others."; - - private static Logger logger_ = null; - private static Logger[] parentLoggers_ = null; - private final static Object loggerLock_ = new Object(); - - private static boolean JDK14_OR_HIGHER; - static - { - try { - Class.forName("java.util.logging.LogManager"); // Class added in JDK 1.4. - JDK14_OR_HIGHER = true; // If we got this far, we're on JDK 1.4 or higher. - } - catch (Throwable e) { // We're not on JDK 1.4 or higher, - JDK14_OR_HIGHER = false; // so don't even try to get the Toolbox Logger. - } - } - - // Private constructor to prevent instantiation by other classes. - private ToolboxLogger() {} - - final void config(String msg) - { - logger_.config(msg); - } - - - /** - Obtains the (static) Toolbox Logger from the JVM, if one has been activated, and wrappers it in a ToolboxLogger instance. - Returns null if no Toolbox Logger has been activated. - To set up a Toolbox logger, the calling application can call Logger.getLogger(Trace.LOGGER_NAME). - **/ - static final ToolboxLogger getLogger() - { - if (logger_ == null && JDK14_OR_HIGHER) - { - synchronized (loggerLock_) - { - if (logger_ == null) - { - // Determine if a Toolbox Logger has been registered. - - // Note: The javadoc for LogManager.getLogger() says that it "Returns matching logger or null if none is found". That appears to be the behavior in JDK 1.4. However, in JDK 1.5 (J2SE 5.0) this method apparently returns a non-null value in all cases. - // So a safer technique is to call LogManager.getLoggerNames(), and see if the Toolbox Logger is listed. - - - // Get list of all registered Loggers. - Enumeration loggerNames = LogManager.getLogManager().getLoggerNames(); - - // See if the list contains the Toolbox Logger. - while (loggerNames.hasMoreElements() && logger_ == null) { - String name = (String)loggerNames.nextElement(); - if (name.equals(Trace.LOGGER_NAME)) { // Found the Toolbox Logger. - logger_ = LogManager.getLogManager().getLogger(Trace.LOGGER_NAME); - } - } - - // Build the list of parent loggers. - if (logger_ != null) - { - Vector parents = new Vector(); - Logger parent = logger_.getParent(); - while (parent != null) { - parents.add(parent); - parent = parent.getParent(); - } - - if (!parents.isEmpty()) { - parentLoggers_ = (Logger[])parents.toArray(new Logger[0]); - } - } - } - } - } - - if (logger_ != null) return new ToolboxLogger(); - else return null; - } - - final void info(String msg) - { - logger_.info(msg); - } - - final boolean isLoggable(int category) - { - return logger_.isLoggable(mapTracingLevel(category)); - } - - - final boolean isLoggingOn() - { - if (logger_ == null) return false; - else if (logger_.getLevel() == Level.OFF) return false; - else if (logger_.getLevel() != null) return true; - else // Level is null, indicating that the level is inherited from parent. - { - if (parentLoggers_ != null) // are there any parent Loggers - { - // Work upwards through the parents until we find a non-null Level. - for (int i=0; itrue. - @param event The sign-on event. - @param forceUpdate true indicates that the sign-on information is known to be incomplete or incorrect. false indicates that the information may be correct. - @return true if sign-on should proceed, false if sign-on should not proceed. - **/ - public boolean connectionInitiated(SignonEvent event, boolean forceUpdate) - { - if (DEBUG) System.out.println("ToolboxSignonHandler.connectionInitiated("+forceUpdate+")"); - - return handleSignon((AS400)event.getSource(), forceUpdate, false); - } - - - /** - Handles an exception that was thrown during a sign-on attempt. - If the handler cannot deal with the exception, the handler rethrows exc. - @param event The sign-on event. - @exception AS400SecurityException If the handler cannot handle the exception. - **/ - public void exceptionOccurred(SignonEvent event) - throws AS400SecurityException - { - if (DEBUG) System.out.println("ToolboxSignonHandler.exceptionOccurred()"); - - AS400SecurityException exc = event.getException(); - AS400 system = (AS400)event.getSource(); - if (!system.isGuiAvailable()) throw exc; // do nothing, rethrow the exception - - handleException(system, exc); - } - - - /** - Displays a message warning that the password will expire in daysUntilExpiration days, and asks the userif they would like to change the password. - If user clicks OK, then a "change password" - dialog is displayed, prompting user for old and new passwords. - Otherwise, simply returns true. - @param event The sign-on event. - @return true - **/ - public boolean passwordAboutToExpire(SignonEvent event, int daysUntilExpiration) - { - if (DEBUG) System.out.println("ToolboxSignonHandler.passwordAboutToExpire(" + daysUntilExpiration + ")"); - - AS400 system = (AS400)event.getSource(); - if (!system.isGuiAvailable()) return true; // do nothing, proceed with sign-on - - boolean response = displayMessage(ResourceBundleLoader.substitute(ResourceBundleLoader.getText("DLG_PASSWORD_EXP_WARNING"), Integer.toString(daysUntilExpiration)) + " " + ResourceBundleLoader.getText("DLG_CHANGE_PASSWORD_PROMPT"), ResourceBundleLoader.getText("DLG_SIGNON_TITLE"), true); - if (response) - { - handlePasswordChange(system); // tolerate cancellation of the password change - } - return true; // do nothing, proceed with sign-on - } - - - /** - Displays a message indicating that the password has expired, and asks the user - if they would like to change the password. If user clicks OK, then a "change password" - dialog is displayed, prompting user for old and new passwords. - @param event The sign-on event. - @return true if user clicks OK, false if user clicks Cancel. - **/ - public boolean passwordExpired(SignonEvent event) - { - if (DEBUG) System.out.println("ToolboxSignonHandler.passwordExpired()"); - - AS400 system = (AS400)event.getSource(); - if (!system.isGuiAvailable()) return noGuiAvailable(); - - // See if user wants to change password. - boolean response = displayMessage(ResourceBundleLoader.getText("EXC_PASSWORD_EXPIRED") + "\n" + ResourceBundleLoader.getText("DLG_CHANGE_PASSWORD_PROMPT"), ResourceBundleLoader.getText("DLG_SIGNON_TITLE"), true); - if (response) // User wants to change password. - { - return handlePasswordChange(system); - } - else // User canceled the password change. - { - return false; - } - } - - - /** - Displays a message indicating that the password is incorrect, - and redisplays the sign-on dialog. - @param event The sign-on event. - @return true if user clicks OK, false if user clicks Cancel. - **/ - public boolean passwordIncorrect(SignonEvent event) - { - if (DEBUG) System.out.println("ToolboxSignonHandler.passwordIncorrect()"); - - AS400 system = (AS400)event.getSource(); - if (!system.isGuiAvailable()) return noGuiAvailable(); - displayMessage(ResourceBundleLoader.getText("EXC_PASSWORD_INCORRECT"), - ResourceBundleLoader.getText("DLG_SIGNON_TITLE")); - return handleSignon(system, true, false); - } - - - /** - Displays a message indicating that the password length is incorrect, - and redisplays the sign-on dialog. - @param event The sign-on event. - @return true if user clicks OK, false if user clicks Cancel. - **/ - public boolean passwordLengthIncorrect(SignonEvent event) - { - if (DEBUG) System.out.println("ToolboxSignonHandler.passwordLengthIncorrect()"); - - AS400 system = (AS400)event.getSource(); - if (!system.isGuiAvailable()) return noGuiAvailable(); - displayMessage(ResourceBundleLoader.getText("EXC_PASSWORD_LENGTH_NOT_VALID"), - ResourceBundleLoader.getText("DLG_SIGNON_TITLE")); - return handleSignon(system, true, false); - } - - - /** - Displays a message indicating that the password was not specified, - and redisplays the sign-on dialog. - @param event The sign-on event. - @return true if user clicks OK, false if user clicks Cancel. - **/ - public boolean passwordMissing(SignonEvent event) - { - if (DEBUG) System.out.println("ToolboxSignonHandler.passwordMissing()"); - - AS400 system = (AS400)event.getSource(); - if (!system.isGuiAvailable()) return noGuiAvailable(); - displayMessage(ResourceBundleLoader.getText("DLG_MISSING_PASSWORD"), - ResourceBundleLoader.getText("DLG_SIGNON_TITLE")); - return connectionInitiated(event, true); - } - - - /** - Displays a message indicating that the system name was not specified, - and redisplays the sign-on dialog. - @param event The sign-on event. - @return true if user clicks OK, false if user clicks Cancel. - **/ - public boolean systemNameMissing(SignonEvent event) - { - if (DEBUG) System.out.println("ToolboxSignonHandler.systemNameMissing()"); - - AS400 system = (AS400)event.getSource(); - if (!system.isGuiAvailable()) return noGuiAvailable(); - displayMessage(ResourceBundleLoader.getText("DLG_MISSING_USERID"), // generic MRI - ResourceBundleLoader.getText("DLG_SIGNON_TITLE")); - return handleSignon(system, true, true); - } - - - // Design Note: In order to preserve historical default behavior, this class does not implement the systemNameUnknown() method. If an unknown system name is specified, an UnknownHostException will be thrown. - - - /** - Displays a message indicating that the user profile will be disabled if next sign-on attempt is incorrect, - and redisplays the sign-on dialog. - @param event The sign-on event. - @return true if user clicks OK, false if user clicks Cancel. - **/ - public boolean userIdAboutToBeDisabled(SignonEvent event) - { - if (DEBUG) System.out.println("ToolboxSignonHandler.userIdAboutToBeDisabled()"); - - AS400 system = (AS400)event.getSource(); - if (!system.isGuiAvailable()) return noGuiAvailable(); - displayMessage(ResourceBundleLoader.getText("EXC_PASSWORD_INCORRECT_USERID_DISABLE"), - ResourceBundleLoader.getText("DLG_SIGNON_TITLE")); - return handleSignon(system, true, false); - } - - - /** - Displays a message warning that the system object already has a default user assigned. - @param event The sign-on event. - @param defaultUser The current default user. - @return true - **/ - public boolean userIdDefaultAlreadyAssigned(SignonEvent event, String defaultUser) - { - if (DEBUG) System.out.println("ToolboxSignonHandler.userIdDefaultAlreadyAssigned()"); - - // Put up an informational message, and proceed with sign-on. - displayMessage(ResourceBundleLoader.getText("DLG_DEFAULT_USER_EXISTS"), - ResourceBundleLoader.getText("DLG_SIGNON_TITLE")); - displayMessage(ResourceBundleLoader.getText("DLG_SET_DEFAULT_USER_FAILED"), - ResourceBundleLoader.getText("DLG_SIGNON_TITLE")); - return true; - } - - - /** - Displays a message indicating that the user profile is disabled, - and redisplays the sign-on dialog. - @param event The sign-on event. - @return true if user clicks OK, false if user clicks Cancel. - **/ - public boolean userIdDisabled(SignonEvent event) - { - if (DEBUG) System.out.println("ToolboxSignonHandler.userIdDisabled()"); - - AS400 system = (AS400)event.getSource(); - if (!system.isGuiAvailable()) return noGuiAvailable(); - displayMessage(ResourceBundleLoader.getText("EXC_USERID_DISABLE"), - ResourceBundleLoader.getText("DLG_SIGNON_TITLE")); - return handleSignon(system, true, false); - } - - - /** - Displays a message indicating that the user ID length is incorrect, - and redisplays the sign-on dialog. - @param event The sign-on event. - @return true if user clicks OK, false if user clicks Cancel. - **/ - public boolean userIdLengthIncorrect(SignonEvent event) - { - if (DEBUG) System.out.println("ToolboxSignonHandler.userIdLengthIncorrect()"); - - AS400 system = (AS400)event.getSource(); - if (!system.isGuiAvailable()) return noGuiAvailable(); - displayMessage(ResourceBundleLoader.getText("EXC_USERID_LENGTH_NOT_VALID"), - ResourceBundleLoader.getText("DLG_SIGNON_TITLE")); - return handleSignon(system, true, false); - } - - - /** - Displays a message indicating that the user name was not specified, - and redisplays the sign-on dialog. - @param event The sign-on event. - @return true if user clicks OK, false if user clicks Cancel. - **/ - public boolean userIdMissing(SignonEvent event) - { - if (DEBUG) System.out.println("ToolboxSignonHandler.userIdMissing()"); - - AS400 system = (AS400)event.getSource(); - if (!system.isGuiAvailable()) return noGuiAvailable(); - displayMessage(ResourceBundleLoader.getText("DLG_MISSING_USERID"), - ResourceBundleLoader.getText("DLG_SIGNON_TITLE")); - return handleSignon(system, true, false); - } - - - /** - Displays a message indicating that the specified user ID is unknown, - and redisplays the sign-on dialog. - @param event The sign-on event. - @return true if user clicks OK, false if user clicks Cancel. - **/ - public boolean userIdUnknown(SignonEvent event) - { - if (DEBUG) System.out.println("ToolboxSignonHandler.userIdUnknown()"); - - AS400 system = (AS400)event.getSource(); - if (!system.isGuiAvailable()) return noGuiAvailable(); - displayMessage(ResourceBundleLoader.getText("EXC_USERID_UNKNOWN"), - ResourceBundleLoader.getText("DLG_SIGNON_TITLE")); - return handleSignon(system, true, false); - } - - - // - // - // Private utility methods. - // - // - - - - /** - Displays an informational dialog to the user. - @param message The message text to display. - @param dialogTitle The title for the dialog. - **/ - private void displayMessage(String message, String dialogTitle) - { - displayMessage(message, dialogTitle, false); - } - - - /** - Displays an informational dialog to the user. - @param message The message text to display. - @param dialogTitle The title for the dialog. - @param getResponse Whether to get response from user. - @return The response from the user. true if user indicated approval, false otherwise. - **/ - private boolean displayMessage(String message, String dialogTitle, boolean getResponse) - { - MessageDialog md = new MessageDialog(new Frame(), message, dialogTitle, getResponse); - return md.display(); - } - - - /** - Handles an exception that was thrown during a sign-on attempt. - If the handler cannot deal with the exception, the handler rethrows exc. - @param system The system. - @param exc The exception. - @exception AS400SecurityException If the handler cannot handle the exception. - **/ - private void handleException(AS400 system, AS400SecurityException exc) - throws AS400SecurityException - { - switch (exc.getReturnCode()) - { - case AS400SecurityException.USERID_LENGTH_NOT_VALID: - case AS400SecurityException.PASSWORD_LENGTH_NOT_VALID: - case AS400SecurityException.USERID_DISABLE: - case AS400SecurityException.PASSWORD_INCORRECT: - case AS400SecurityException.PASSWORD_INCORRECT_USERID_DISABLE: - case AS400SecurityException.SIGNON_REQUEST_NOT_VALID: - case AS400SecurityException.USERID_UNKNOWN: - case AS400SecurityException.SIGNON_CHAR_NOT_VALID: - - case AS400SecurityException.PASSWORD_CHANGE_REQUEST_NOT_VALID: - case AS400SecurityException.PASSWORD_OLD_NOT_VALID: - case AS400SecurityException.PASSWORD_NEW_NOT_VALID: - case AS400SecurityException.PASSWORD_NEW_TOO_LONG: - case AS400SecurityException.PASSWORD_NEW_TOO_SHORT: - case AS400SecurityException.PASSWORD_NEW_REPEAT_CHARACTER: - case AS400SecurityException.PASSWORD_NEW_ADJACENT_DIGITS: - case AS400SecurityException.PASSWORD_NEW_CONSECUTIVE_REPEAT_CHARACTER: - case AS400SecurityException.PASSWORD_NEW_PREVIOUSLY_USED: - case AS400SecurityException.PASSWORD_NEW_NO_NUMERIC: - case AS400SecurityException.PASSWORD_NEW_NO_ALPHABETIC: - case AS400SecurityException.PASSWORD_NEW_DISALLOWED: - case AS400SecurityException.PASSWORD_NEW_USERID: - case AS400SecurityException.PASSWORD_NEW_SAME_POSITION: - case AS400SecurityException.PASSWORD_NEW_CHARACTER_NOT_VALID: - case AS400SecurityException.PASSWORD_NEW_VALIDATION_PROGRAM: - - if (changingPassword_) - { - displayMessage(exc.getMessage(), ResourceBundleLoader.getText("DLG_CHANGE_PASSWORD_TITLE")); - if (!handlePasswordChange(system)) throw exc; - } - else // not changing password - { // Give user another chance on the sign-on dialog. - displayMessage(exc.getMessage(), ResourceBundleLoader.getText("DLG_SIGNON_TITLE")); - if (!handleSignon(system, true, false)) throw exc; - } - break; - - case AS400SecurityException.PASSWORD_EXPIRED: - - // See if user wants to change password. - boolean response = displayMessage(ResourceBundleLoader.getText("EXC_PASSWORD_EXPIRED") + "\n" + ResourceBundleLoader.getText("DLG_CHANGE_PASSWORD_PROMPT"), ResourceBundleLoader.getText("DLG_SIGNON_TITLE"), true); - if (response) // User wants to change password. - { - if (!handlePasswordChange(system)) throw exc; - } - else // User canceled the password change. - { // Fail the sign-on. - throw exc; - } - break; - - default: // None of the above. Just display the error text to the user and throw the exception. - - String title; - if (changingPassword_) - { - title = ResourceBundleLoader.getText("DLG_CHANGE_PASSWORD_TITLE"); - } - else - { - title = ResourceBundleLoader.getText("DLG_SIGNON_TITLE"); - } - displayMessage(exc.getMessage(), title); - throw exc; - } - } - - - // Solicits password-change information from the user. Validates the information, and if valid, calls AS400.changePassword(). - private boolean handlePasswordChange(AS400 system) - { - ChangePasswordDialog cpd = new ChangePasswordDialog(new Frame(), ResourceBundleLoader.getText("DLG_CHANGE_PASSWORD_TITLE")); - boolean changedPassword = false; - boolean done = false; - - do - { - if (!cpd.prompt(system.getSystemName(), system.getUserId())) // user canceled - { - changingPassword_ = false; - break; - } - String oldPassword = cpd.getOldPassword(); - String newPassword = cpd.getNewPassword(); - String confirmPassword = cpd.getConfirmPassword(); - if (PASSWORD_TRACE) - { - Trace.log(Trace.DIAGNOSTIC, "Old password: '" + oldPassword + "'"); - Trace.log(Trace.DIAGNOSTIC, "New password: '" + newPassword + "'"); - Trace.log(Trace.DIAGNOSTIC, "Confirm password: '" + confirmPassword + "'"); - } - if (validatePasswordInfo(oldPassword, newPassword, confirmPassword)) - { - changingPassword_ = true; - try { - system.changePassword(oldPassword, newPassword); - } - catch (AS400SecurityException e) { - displayMessage(e.getMessage(), ResourceBundleLoader.getText("DLG_CHANGE_PASSWORD_TITLE")); - return handlePasswordChange(system); - } - catch (IOException e) { - displayMessage(e.getMessage(), ResourceBundleLoader.getText("DLG_CHANGE_PASSWORD_TITLE")); - return handlePasswordChange(system); - } - changingPassword_ = false; - changedPassword = true; - done = true; - } - - } while (!done); - - return changedPassword; - } - - - /** - Gathers any missing sign-on information, and calls the relevant setters in the system object. - If GUI is available, displays an interactive sign-on dialog to the user, with fields for systemName, userID, and password, along with "OK" and "CANCEL" buttons. - Otherwise, simply returns true. - @param event The sign-on event. - @param forceUpdate true indicates that the sign-on information is known to be incomplete or incorrect. false indicates that the information may be correct. - @param enableSystemNameField Indicates whether the "system name" field should be enabled for input. - @return true if sign-on should proceed, false if sign-on should not proceed. - **/ - private boolean handleSignon(AS400 system, boolean forceUpdate, boolean enableSystemNameField) - { - if (DEBUG) System.out.println("ToolboxSignonHandler.handleSignon("+forceUpdate+"," + enableSystemNameField+")"); - - if (!forceUpdate && - system.getSystemName().length() != 0 && - system.getUserId().length() != 0) - { - return true; // assume all the needed info is there - } - - if (system.isGuiAvailable()) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Signing-on with prompting turned on."); - boolean done = false; - do - { - PasswordDialog pd = setupPasswordDialog(system); - if (enableSystemNameField) pd.enableSystemNameField(); - - if (!pd.prompt()) { // user canceled - return false; - } - - // Note: The PasswordDialog getters never return null. - String systemName = pd.getSystemName().trim(); - String userId = pd.getUserId().trim().toUpperCase(); - String password = pd.getPassword(); - - if (validateInfo(systemName, userId, password, system)) - { - try - { - systemName_ = systemName; - system.setSystemName(systemName_); - if (userId.length() != 0) { - userId_ = userId; - system.setUserId(userId_); - } - if (password.length() != 0) system.setPassword(password); - - // Check to see if we should set the default user. - // Design note: There's a slight usability exposure here, in the event that an erroneous userID is specified. Then that userID gets set as the default user. To reset it, the app must first call AS400.removeDefaultUser(). - if (pd.getDefaultState() && userId_.length() != 0) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting default user from dialog..."); - // Set the default user. - if (!AS400.setDefaultUser(systemName_, userId_)) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Failed to set default user."); - if (system.isGuiAvailable()) - { - displayMessage(ResourceBundleLoader.getText("DLG_DEFAULT_USER_EXISTS") + "\n\n" + ResourceBundleLoader.getText("DLG_SET_DEFAULT_USER_FAILED"), - ResourceBundleLoader.getText("DLG_SIGNON_TITLE")); - } - } - } - - // Also see if the AS400 should use the cached password. - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting password cache entry from dialog..."); - system.setUsePasswordCache(pd.getPasswordCacheState()); - - done = true; // if we got this far, we're good to go - } - catch (PropertyVetoException e) { - displayMessage(e.getMessage(), ResourceBundleLoader.getText("DLG_SIGNON_TITLE")); - return handleSignon(system, forceUpdate, enableSystemNameField); - } - } - - } while (!done); - } - else // no GUI available - { - // Just return true. Let the caller validate it. - // If anything necessary is missing, they will call our handleEvent() method. - if (Trace.traceOn_) Trace.log(Trace.INFORMATION, "No GUI is available to sign-on handler."); - } - return true; - } - - - // Complains about missing GUI, and returns false. - private boolean noGuiAvailable() - { - Trace.log(Trace.ERROR, "The internal Toolbox sign-on handler requires a GUI in order to gather new information."); - return false; - } - - - - // Sets up a password dialog, to solicit system name, user ID, and password. - private PasswordDialog setupPasswordDialog(AS400 system) - { - PasswordDialog pd = new PasswordDialog(new Frame(), ResourceBundleLoader.getText("DLG_SIGNON_TITLE"), system.isShowCheckboxes()); - - // If system name is not set. - String systemName = system.getSystemName(); - if (systemName.length() == 0) systemName = systemName_; - if (systemName.length() == 0) - { - // Enable default user checkbox. - pd.enableDefaultUserCheckbox(); - // But uncheck it. - pd.setDefaultUserState(false); - } - else - { - // Put system name in dialog. - pd.setSystemName(systemName); - systemName_ = systemName; - // Do we already have a default user for this system - if (AS400.getDefaultUser(systemName) == null) - { // No default user yet. - // Enable the check box. - pd.enableDefaultUserCheckbox(); - // And check it. - pd.setDefaultUserState(true); - } - else - { - // Disable the check box. There's already a default user for this system. - pd.disableDefaultUserCheckbox(); - } - } - // Check the use cache checkbox. - pd.setPasswordCacheState(system.isUsePasswordCache()); - // If user ID set, put it in dialog. - String userId = system.getUserId(); - if (userId.length() == 0) userId = userId_; - if (userId.length() == 0 && systemName.length() != 0) { - String defaultUser = AS400.getDefaultUser(systemName); - if (defaultUser != null) userId = defaultUser; - } - if (userId.length() != 0) { - pd.setUserId(userId); - userId_ = userId; - } - return pd; - } - - - // Checks lengths of systemName, userID, and password. - private boolean validateInfo(String systemName, String userId, String password, AS400 system) - { - // Assume args are already validated as non-null. - boolean valid = true; - if (systemName.length() == 0 || - (!system.isUseDefaultUser() && userId.length() == 0) || - (!system.isUsePasswordCache() && password.length() == 0)) - { - // A field is not filled in. - displayMessage(ResourceBundleLoader.getText("DLG_MISSING_PASSWORD"), ResourceBundleLoader.getText("DLG_SIGNON_TITLE")); - valid = false; - } - else if (password.length() > 128) - { - Trace.log(Trace.ERROR, "Length of password is greater than 128 characters: " + password.length()); - displayMessage(ResourceBundleLoader.getText("EXC_PASSWORD_LENGTH_NOT_VALID"), ResourceBundleLoader.getText("DLG_SIGNON_TITLE")); - valid = false; - } - - return valid; - } - - - // Checks lengths of old/new passwords, and verifies that they match. - private boolean validatePasswordInfo(String oldPassword, String newPassword, String confirmPassword) - { - if (oldPassword.length() == 0 || newPassword.length() == 0 || confirmPassword.length() == 0) - { - // A field is not filled in. - displayMessage(ResourceBundleLoader.getText("DLG_MISSING_PASSWORD"), ResourceBundleLoader.getText("DLG_CHANGE_PASSWORD_TITLE")); - return false; - } - if (!newPassword.equals(confirmPassword)) - { - // New and confirm are not the same. - displayMessage(ResourceBundleLoader.getText("EXC_PASSWORD_NOT_MATCH"), ResourceBundleLoader.getText("DLG_CHANGE_PASSWORD_TITLE")); - return false; - } - if (oldPassword.length() > 128) - { - Trace.log(Trace.ERROR, "Length of old password is greater than 128 characters: " + oldPassword.length()); - displayMessage(ResourceBundleLoader.getText("EXC_PASSWORD_LENGTH_NOT_VALID"), ResourceBundleLoader.getText("DLG_CHANGE_PASSWORD_TITLE")); - return false; - } - if (newPassword.length() > 128) - { - Trace.log(Trace.ERROR, "Length of new password is greater than 128 characters: " + newPassword.length()); - displayMessage(ResourceBundleLoader.getText("EXC_PASSWORD_NEW_NOT_VALID"), ResourceBundleLoader.getText("DLG_CHANGE_PASSWORD_TITLE")); - return false; - } - - return true; - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/ToolboxWrapper.java b/cvsroot/src/com/ibm/as400/access/ToolboxWrapper.java deleted file mode 100644 index 875d812e0..000000000 --- a/cvsroot/src/com/ibm/as400/access/ToolboxWrapper.java +++ /dev/null @@ -1,122 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ToolboxWrapper.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2006-2006 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.sql.SQLException; -/* ifdef JDBC40 -import java.sql.Wrapper; -endif */ - - -/* - * This class provides a single point where we implement java.sql.Wrapper. - * Any of the other classes (ie Connection, Statement, ResultSet, etc) that - * implement java.sql.Wrapper are done so by extending this class. - * The original purpose of this class was so that we could have a single code base - * for both pre jdk 1.6 and post jdk 1.6. Then this class (containing Generics), could - * be in a jdk 1.6 only release, and a stub could be in the pre jdk 1.6 release. But - * because of so many issues with security and class loading, we did not pursue the - * "stub" infrastructure. But since this class design was a nice way to keep the - * wrapper code in one class, we decided to keep it. - */ -class ToolboxWrapper -/* ifdef JDBC40 -implements Wrapper -endif */ -{ - - - //@PDA jdbc40 - //Copied from JDError. Needed for proxy classes that extend this class. - private static final String EXC_PARAMETER_TYPE_INVALID = "HY105"; - - - //this method needs to be overridden by classes that extend ToolboxWrapper to return a list of classes - //that the class may be a wrapper of. - protected String[] getValidWrappedList() - { - return new String[] { }; //return empty array - } - - //JDBC40DOC /** - //JDBC40DOC * Returns true if this either implements the interface argument or is - //JDBC40DOC * directly or indirectly a wrapper for an object that does. Returns false - //JDBC40DOC * otherwise. If this implements the interface then return true, else if - //JDBC40DOC * this is a wrapper then return the result of recursively calling - //JDBC40DOC * isWrapperFor on the wrapped object. If this does not - //JDBC40DOC * implement the interface and is not a wrapper, return false. This method - //JDBC40DOC * should be implemented as a low-cost operation compared to - //JDBC40DOC * unwrap so that callers can use this method to avoid - //JDBC40DOC * expensive unwrap calls that may fail. If this method - //JDBC40DOC * returns true then calling unwrap with the same argument - //JDBC40DOC * should succeed. - //JDBC40DOC * - //JDBC40DOC * @param iface - //JDBC40DOC * a Class defining an interface. - //JDBC40DOC * @return true if this implements the interface or directly or indirectly - //JDBC40DOC * wraps an object that does. - //JDBC40DOC * @throws java.sql.SQLException - //JDBC40DOC * if an error occurs while determining whether this is a - //JDBC40DOC * wrapper for an object with the given interface. - //JDBC40DOC */ - /* ifdef JDBC40 - public boolean isWrapperFor(Class iface) throws SQLException - { - if (iface == null) - return false; - - String[] validWrappedList = getValidWrappedList(); - for (int i = 0; i < validWrappedList.length; i++) - { - if (iface.getName().equals(validWrappedList[i])) - return true; - } - - return false; - } - endif */ - //JDBC40DOC /** - //JDBC40DOC * Returns an object that implements the given interface to allow access to - //JDBC40DOC * non-standard methods, or standard methods not exposed by the proxy. - //JDBC40DOC * - //JDBC40DOC * If the receiver implements the interface then the result is the receiver - //JDBC40DOC * or a proxy for the receiver. If the receiver is a wrapper and the wrapped - //JDBC40DOC * object implements the interface then the result is the wrapped object or - //JDBC40DOC * a proxy for the wrapped object. Otherwise return the the result of - //JDBC40DOC * calling unwrap recursively on the wrapped object or a - //JDBC40DOC * proxy for that result. If the receiver is not a wrapper and does not - //JDBC40DOC * implement the interface, then an SQLException is thrown. - //JDBC40DOC * - //JDBC40DOC * @param iface - //JDBC40DOC * A Class defining an interface that the result must implement. - //JDBC40DOC * @return an object that implements the interface. May be a proxy for the - //JDBC40DOC * actual implementing object. - //JDBC40DOC * @throws java.sql.SQLException - //JDBC40DOC * If no object found that implements the interface - //JDBC40DOC */ - /* ifdef JDBC40 - public T unwrap(Class iface) throws SQLException { - if (isWrapperFor(iface)) - return (T)this; - else - { - throw new SQLException ( - AS400JDBCDriver.getResource("JD" + EXC_PARAMETER_TYPE_INVALID), - EXC_PARAMETER_TYPE_INVALID, -99999); - //JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); - } - - } - endif */ -} diff --git a/cvsroot/src/com/ibm/as400/access/Trace.java b/cvsroot/src/com/ibm/as400/access/Trace.java deleted file mode 100644 index 4ec854eff..000000000 --- a/cvsroot/src/com/ibm/as400/access/Trace.java +++ /dev/null @@ -1,1897 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Trace.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.StringTokenizer; // $D0A -import java.util.Hashtable; // $W1A -import java.util.Vector; -import java.util.Enumeration; -import java.net.ServerSocket; -import java.net.Socket; -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.UnknownHostException; - -/** - Logs trace points and diagnostic messages. - Each trace point and diagnostic message is logged by category. - The valid categories are: -
      -
    • DATASTREAM
      - This category is used by Toolbox classes to log data flow between the - local host and the remote system. It is not intended for use by - application classes. -
    • DIAGNOSTIC
      - This category is used to log object state information. -
    • ERROR
      - This category is used to log errors that cause an exception. -
    • INFORMATION
      - This category is used to track the flow of control through the code. -
    • WARNING
      - This category is used to log errors that are recoverable. -
    • CONVERSION
      - This category is used by Toolbox classes to log character set - conversions between Unicode and native code pages. It is not intended - for use by application classes. -
    • PROXY
      - This category is used by Toolbox classes to log data flow between the - client and the proxy server. It is not intended for use by application classes. -
    • PCML
      - This category is used to determine how PCML interprets the data that is - sent to and from the system. -
    • JDBC
      - This category is used to include JDBC data in the standard Toolbox trace. -
    - -

    - The caller can enable or disable all tracing or specific - trace categories. Enabling or disabling one category does not - affect other categories. Once appropriate category traces - are enabled, trace must be turned on to get trace data. For example, - -

    -      // By default, trace is disabled for all categories and
    -      // tracing is off.
    -      ..
    -      Trace.setTraceErrorOn(true);          // Enable error messages
    -      Trace.setTraceWarningOn(true);        // Enable warning messages
    -
    -      Trace.setTraceOn(true);               // Turn trace on for all
    -                                            // Enabled categories
    -
    -      ..
    -      Trace.setTraceOn(false);              // Turn trace off
    -      ..
    -      Trace.setTraceOn(true);               // Turn trace back on
    -      ..
    -      Trace.setTraceInformationOn(true);    // Enable informational messages.
    -                                            // Since trace is still on, no
    -                                            // other action is required to
    -                                            // get this data
    -
    -      ..
    -      Trace.setTraceWarningOn(false);       // Disable warning messages.  Since
    -                                            // trace is still on, the other
    -                                            // categories will still be logged
    -  
    - - The traces are logged to standard out by default. A file name can - be provided to log to a file. File logging is only possible in an - application as most browsers do not allow access to the local file system. - -

    - Trace data can also be specified by component. Trace data is always - written to the default log but component tracing provides a way - to write trace data to a separate log. - -

    - The following example logs data for Function123 into log file - C:\Function123.log, and logs data for Function456 into log file - C:\Function456.log. Data for these two components is also traced to - the normal trace file (standard output in this case since that is the - default for normal tracing). The result is three sets of data -- - a file containing trace data for only Function123, a file containing trace - data for only Function456, and standard output which records all trace - data. In the example a Java String object is used to indicate the - component, but any object can be used. - -

    -      // tracing is off by default
    -      ..
    -      String cmpF123 = "Function123";      // More efficient to create an object
    -      String cmpF456 = "Function456";      // than many String literals.
    -
    -                                             // Specify where data should go
    -                                             // for the two components.
    -      Trace.setFileName(cmpF123, "C:\\Function123.log");
    -      Trace.setFileName(cmpF456, "C:\\Function456.log");
    -
    -      Trace.setTraceInformationOn(true);     // Trace only the information category.
    -      Trace.setTraceOn(true);                // Turn tracing on.
    -      ..
    -      Trace.log(cmpF123, Trace.INFORMATION, "I am here");
    -      ..
    -      Trace.log(cmpF456, Trace.INFORMATION, "I am there");
    -      ..
    -      Trace.log(cmpF456, Trace.INFORMATION, "I am everywhere");
    -      ..
    -      Trace.setTraceOn(false);               // Turn tracing off.
    -  
    - -

    - Component tracing provides an easy way to write application specific - trace data to a log or standard output. Any application and the - Toolbox classes can use trace to log messages. With component tracing, - application data can be easily separated from other data. For example, - -

    -      String myComponent = "com.myCompany";      // More efficient to create an object
    -                                                 // than many String literals.
    -
    -      Trace.setFileName("C:\\bit.bucket");       // Send default trace data to
    -                                                 // a file.
    -
    -      Trace.setTraceInformationOn(true);         // Enable information messages.
    -      Trace.setTraceOn(true);                    // Turn trace on.
    -
    -      ...
    -
    -                             // Since no file was specified, data for
    -                             // myComponent goes to standard output.
    -                             // Other information messages are sent to a file.
    -      Trace.log(myComponent, Trace.INFORMATION, "my trace data");
    -
    -  
    - - -

    - Two techniques can be used to log information: - -

    -      ..
    -      // Let the Trace method determine if logging should occur
    -      Trace.log(Trace.INFORMATION, "I got here...");
    -      ..
    -      // Pre-determine if we should log.  This may be more efficient
    -      // if a lot of processing in needed to generate the trace data.
    -      if (Trace.isTraceOn() && Trace.isTraceInformationOn())
    -      {
    -            Trace.log(Trace.INFORMATION, "I got here...");
    -      }
    -  
    - -

    - It is suggested that programs provide some mechanism to enable tracing at run-time, so - that the modification and recompilation of code is not necessary. Two possibilities - for that mechanism are a command line argument (for applications) or a menu option - (for applications and applets). - -

    - In addition, tracing can be set using the "com.ibm.as400.access.Trace.category" - and "com.ibm.as400.access.Trace.file" system properties. - -

    - Note: This class can exploit a standard Java Logger if one is defined in the JVM (per JSR 47, package java.util.logging, added in J2SE 1.4). - See {@link #LOGGER_NAME LOGGER_NAME}. - **/ - - -public class Trace implements Runnable -{ - private static final String CLASSNAME = "com.ibm.as400.access.Trace"; - private static final int DEFAULT_MONITOR_PORT = 55555; - - static boolean traceOn_; //@P0C - static boolean traceInfo_; - static boolean traceWarning_; - static boolean traceError_; - static boolean traceDiagnostic_; - static boolean traceDatastream_; - static boolean traceConversion_; - static boolean traceProxy_; // @D0A - static boolean traceThread_; // @D3A - static boolean traceJDBC_; // @D5A - static boolean tracePCML_; - - private static int mostRecentTracingChange_; // either 0 (no action), TURNED_TRACE_OFF, or TURNED_TRACE_ON - private static final int TURNED_TRACE_ON = 1; - private static final int TURNED_TRACE_OFF = 2; - private static boolean aTraceCategoryHasBeenActivated_ = false; // goes to 'true' when any setTraceXxx() method has been called with argument 'true' - - private static String fileName_ = null; - private static PrintWriter destination_ = new PrintWriter(System.out, true); // never null - private static boolean userSpecifiedDestination_ = false; // true if setFileName() or setPrintWriter() was called with a non-null argument - - private static Hashtable printWriterHash_ = new Hashtable(); // @W1A - private static Hashtable fileNameHash_ = new Hashtable(); // @W1A - private static SimpleDateFormat timeStampFormatter_ = new SimpleDateFormat( "EEE MMM d HH:mm:ss:SSS z yyyy" ); - - - /** - 'Data stream' trace category. This category is used by Toolbox classes - to log data flow between the local host and the remote system. It is - not intended for use by application classes. - **/ - public static final int DATASTREAM = 0; - //private static final int FIRST_ONE = 0; // @W1A - - /** - 'Diagnostic message' trace category. This category is used to log object - state information. - **/ - public static final int DIAGNOSTIC = 1; - /** - 'Error message' trace category. This category is used to log errors that - cause an exception. - **/ - public static final int ERROR = 2; - /** - 'Information message' trace category. This category is used to track - the flow of control through the code. - **/ - public static final int INFORMATION = 3; - /** - 'Warning message' trace category. This category is used to log errors - that are recoverable. - **/ - public static final int WARNING = 4; - /** - 'Character set conversion' trace category. This category is used by Toolbox - classes to log conversions between Unicode and native code pages. It is - not intended for use by application classes. - **/ - public static final int CONVERSION = 5; - - /** - 'Proxy' trace category. This category is used by Toolbox classes to log data - flow between the client and the proxy server. It is not intended for - use by application classes. - **/ - public static final int PROXY = 6; // @D0A - - /** - 'PCML' trace category. This category is used to determine how PCML interprets - the data that is sent to and from the system. - **/ - public static final int PCML = 7; // @D8A - - /** - 'JDBC' trace category. This category is used by the Toolbox JDBC driver to - determine whether or not JDBC data should be included in the standard Toolbox trace. - This setting is independent of what is set using the {@link java.sql.DriverManager DriverManager} class. - **/ - public static final int JDBC = 8; - - - // This is used so we don't have to change our bounds checking every time we add a new trace category. - //private static final int LAST_ONE = 9; // @D3A @D8C - - // The following are trace categories which cannot be log()-ed to directly. - /* - Thread trace category. This category is used to enable or disable tracing of thread - information. This is useful when debugging multi-threaded applications. Trace - information cannot be directly logged to this category. - */ - // @E1D private static final int THREAD = 99; // @D3A - - /* - All trace category. This category is - used to enable or disable tracing for all of the other categories at - once. Trace information cannot be directly logged to this category. - */ - // @E1D private static final int ALL = 100; //@D2A - - - /** - Name of the instance of java.util.logging.Logger that the Toolbox uses. - If no Logger by this name exists in the JVM, then traditional Toolbox tracing is done. - To activate a Toolbox logger, the application can simply call Logger.getLogger(Trace.LOGGER_NAME). -
    Note: This constant resolves to the value com.ibm.as400.access. - **/ - public static final String LOGGER_NAME = "com.ibm.as400.access"; - - // Design note: We needed to segregate the Logger logic into a separate class. The Java logging package doesn't exist prior to JDK 1.4, so if we're executing in an older JVM, we get SecurityException's if the JVM sees _any_ runtime reference to a java.util.logging class. - private static ToolboxLogger logger_ = null; - private static boolean firstCallToFindLogger_ = true; - private static boolean JDK14_OR_HIGHER; - - // @D0A - static - { - try { - Class.forName("java.util.logging.LogManager"); // Class added in JDK 1.4. - JDK14_OR_HIGHER = true; // If we got this far, we're on JDK 1.4 or higher. - } - catch (Throwable e) { // We're not on JDK 1.4 or higher, - JDK14_OR_HIGHER = false; // so don't even try to get the Toolbox Logger. - } - - loadTraceProperties (); - } - - - - // This is only here to prevent anyone from instantiating a Trace object. - private Trace() - { - } - - - /** - Returns the trace file name. - @return The file name if logging to file. If logging to System.out, - null is returned. - **/ - public static String getFileName() - { - return fileName_; - } - - - /** - Returns the trace file name for the specified component. Null - is returned if no file name has been set for the component. - @return The file name for the specified component. Null is - returned if no file name has been set for the component. - **/ - public static String getFileName(Object component) - { - if (component == null) - throw new NullPointerException("component"); - - return(String) fileNameHash_.get(component); - } - - - /** - Returns the PrintWriter object. - @return The PrintWriter object for the trace data output. - **/ - public static PrintWriter getPrintWriter() - { - return destination_; - } - - - /** - Returns the print writer object for the specified component. Null - is returned if no writer or file name has been set. If a file - name for a component is set, that component automatically - gets a print writer. - @return The print writer object for the specified component. - If no writer or file name has been set, null is returned. - **/ - public static PrintWriter getPrintWriter(Object component) - { - if (component == null) - throw new NullPointerException("component"); - - return(PrintWriter) printWriterHash_.get(component); - } - - - - //@D2A - /** - Indicates if all of the tracing categories are enabled. - @return true if all categories are traced; false otherwise. - **/ - public static final boolean isTraceAllOn() - { - return traceConversion_ && traceDatastream_ && traceDiagnostic_ && - traceError_ && traceInfo_ && traceProxy_ && - traceWarning_ && traceThread_ && traceJDBC_ && tracePCML_; //@D3C @D5C - } - - - /** - Indicates if character set conversion tracing is enabled. - @return true if conversions are traced; false otherwise. - **/ - public static final boolean isTraceConversionOn() - { - return traceConversion_; - } - - /** - Indicates if data stream tracing is enabled. - @return true if data streams are traced; false otherwise. - **/ - public static final boolean isTraceDatastreamOn() - { - return traceDatastream_; - } - - /** - Indicates if diagnostic tracing is enabled. - @return true if diagnostic messages are traced; false otherwise. - **/ - public static final boolean isTraceDiagnosticOn() - { - return traceDiagnostic_; - } - - /** - Indicates if error tracing is enabled. - @return true if error messages are traced; false otherwise. - **/ - public static final boolean isTraceErrorOn() - { - return traceError_; - } - - /** - Indicates if information tracing is enabled. - @return true if information messages are traced; false otherwise. - **/ - public static final boolean isTraceInformationOn() - { - return traceInfo_; - } - - - /** - * Indicates if JDBC tracing is enabled. - * @return true if JDBC messages are traced; false otherwise. - **/ - public static final boolean isTraceJDBCOn() // @D5A - { - return traceJDBC_; - } - - /** - Indicates if overall tracing is enabled. If this is false, no tracing occurs. - @return true if tracing is enabled; false otherwise. - **/ - public static final boolean isTraceOn() - { - return traceOn_; - } - - /** - Indicates if tracing is enabled for the specified category. - @param category The message category [DATASTREAM, DIAGNOSTIC, - ERROR, INFORMATION, WARNING, CONVERSION, PROXY, JDBC]. - @return true if tracing for the category is enabled; false otherwise. - **/ - public static final boolean isTraceOn(int category) - { - switch (category) { - case DATASTREAM: - return traceDatastream_; - case DIAGNOSTIC: - return traceDiagnostic_; - case ERROR: - return traceError_; - case INFORMATION: - return traceInfo_; - case WARNING: - return traceWarning_; - case CONVERSION: - return traceConversion_; - case PROXY: - return traceProxy_; - case PCML: - return tracePCML_; - case JDBC: - return traceJDBC_; - default: - return false; - } - } - - - /** - * Indicates if PCML tracing is enabled. - * @return true if PCML messages are traced; false otherwise. - **/ - public static final boolean isTracePCMLOn() // @D5A - { - return tracePCML_; - } - - // @D0A - /** - Indicates if proxy tracing is enabled. - @return true if proxy tracing is enabled; false otherwise. - **/ - public static final boolean isTraceProxyOn() - { - return traceProxy_; - } - - // @D3A - /** - Indicates if thread tracing is enabled. - @return true if thread tracing is enabled; false otherwise. - **/ - public static final boolean isTraceThreadOn() - { - return traceThread_; - } - - - /** - Indicates if warning tracing is enabled. - @return true if warning messages are traced; false otherwise. - **/ - public static final boolean isTraceWarningOn() - { - return traceWarning_; - } - - - - // Note: If the properties file specifies the "com.ibm.as400.access.Trace.file" property, then we will disregard any existing Toolbox Logger. - // @D0A - static void loadTraceProperties () - { - // Load and apply the trace categories system property. - // Warn if they specified "categories" (rather than "category") for the property name. - String categories0 = SystemProperties.getProperty(SystemProperties.TRACE_CATEGORIES); - if (categories0 != null) { - setTraceCategories(categories0); - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Incorrect tracing property name specified: " + SystemProperties.TRACE_CATEGORIES); - } - String categories = SystemProperties.getProperty(SystemProperties.TRACE_CATEGORY); - if (categories0 == null || categories != null) setTraceCategories(categories); - - // Load and apply the trace file system property. - String file = SystemProperties.getProperty (SystemProperties.TRACE_FILE); - if (file != null) - { - try - { - setFileName (file); - destination_.println("Toolbox for Java - " + Copyright.version); - destination_.println(getJvmInfo()); /* @B1A*/ - } - catch (IOException e) - { - if (isTraceOn ()) - { - String msg = "Trace file not valid: " + file; - System.err.println(msg); - e.printStackTrace(System.err); - Trace.log(Trace.WARNING, msg, e); - } - } - } - - // Load and apply the trace enabled system property. - String enabled = SystemProperties.getProperty (SystemProperties.TRACE_ENABLED); - if (enabled != null) - { - boolean value = Boolean.valueOf(enabled).booleanValue(); - traceOn_ = value; - } - - startTraceMonitorIfNeeded(); - } - - /** - Logs the path where the ClassLoader found the specified class. - Each specific class is logged no more than once. - @param className The package-qualified class name. - **/ - static final void logLoadPath(String className) - { - if (traceDiagnostic_ && - className != null) - { - String loadPath = null; - try - { - ClassLoader loader = Class.forName(className).getClassLoader(); - if (loader != null) - { - String resourceName = className.replace('.', '/') + ".class"; - java.net.URL resourceUrl = loader.getResource(resourceName); - if (resourceUrl != null) { - loadPath = resourceUrl.getPath(); - // Note: The following logic strips the entry name from the end of the path. - // int delimiterPos = loadPath.lastIndexOf('!'); - // if (delimiterPos != -1) loadPath = loadPath.substring(0, delimiterPos); - } - } - } - catch (Throwable t) { - String message = "Unable to determine load path for class " + className; - logData(null, ERROR, message, t); - } - - String message = "Class " + className + " was loaded from " + loadPath; - logData(null, DIAGNOSTIC, message, null); - } - } - - // Log time stamp information in the trace. - private static void logTimeStamp(Object component, PrintWriter pw) //@W1C - { - if (component != null) //@W1A - if (component.toString() != null) //@W1A - pw.print("[" + component.toString() + "] "); //@W1A - - if (traceThread_) //@D3A @W1C - { - //@D3A @W1C - pw.print(Thread.currentThread().toString()); //@D3A @W1C - pw.print(" "); //@D3A @W1C - } //@D3A @W1C - - synchronized (timeStampFormatter_) // date formats are not synchronized - { - pw.print(timeStampFormatter_.format(new Date())); // @W1C - } - pw.print(" "); // @W1C - } - - // Log time stamp information in the trace. - private static void logTimeStamp(Object component, StringBuffer buf) - { - if (component != null) - if (component.toString() != null) - buf.append("[" + component.toString() + "] "); - - if (traceThread_) - { - buf.append(Thread.currentThread().toString()); - buf.append(" "); - } - - synchronized (timeStampFormatter_) // date formats are not synchronized - { - buf.append(timeStampFormatter_.format(new Date())); - } - buf.append(" "); - } - - - // This is the routine that actually writes to the log. - private static final void logData(Object component, - int category, - String message, - Throwable e) - { - // See if tracing is activated for the specified category. - if ((traceOn_ && traceCategory(category)) || - (findLogger() && logger_.isLoggable(category))) - { - if (message == null) message = "(null)"; - - // Two different cases: Either traditional Toolbox trace, or Java Logging. - - if (logger_ == null || userSpecifiedDestination_) // traditional trace - { - // First, write to the default log - synchronized(destination_) - { - // If component tracing is being used, log the component name to - // the default log as well as the specific component log. - if (component != null && getFileName(component) != null) //$W2A - { - //$W2A - logTimeStamp(component, destination_); //$W2A - destination_.println(message); //$W2A - } //$W2A - else //$W2A - { - //$W2A - // Only trace to the default log if we are not doing component - // tracing. This will avoid duplicate messages in the default - // log. - if (component == null) //$W2A - { - //$W2A - logTimeStamp(null, destination_); //$W2A - destination_.println(message); //$W2A - } //$W2A - } //$W2A - - if (e != null) - e.printStackTrace(destination_); - else if (category == ERROR) - new Throwable().printStackTrace(destination_); - } - - if (component != null) - { - PrintWriter pw = (PrintWriter) printWriterHash_.get(component); - if (pw == null) - { - pw = new PrintWriter(System.out, true); - printWriterHash_.put(component, pw); - } - synchronized(pw) - { - logTimeStamp(component, pw); - pw.println(message); - if (e != null) - e.printStackTrace(pw); - else if (category == ERROR) - new Throwable().printStackTrace(pw); - } - } - } // traditional Toolbox tracing - - else // We are logging to a Java Logger. - { - // Log to the Logger instead of to destination_. - // Don't bother splitting up into separate component-specific trace files. - StringBuffer buf = new StringBuffer(); - logTimeStamp(component, buf); - buf.append(message); - - if (e != null) { - logger_.log(category, buf.toString(), e); - } - else if (category == ERROR) { - logger_.log(category, buf.toString(), new Throwable()); - } - else { - logger_.log(category, buf.toString()); - } - - } // using a Java Logger - } - else {} // tracing is not activated for the specified category, so do nothing - } - - /** - Logs a message in the specified category. If the category is disabled, - nothing is logged. - @param category The message category [DATASTREAM, DIAGNOSTIC, - ERROR, INFORMATION, WARNING, CONVERSION, PROXY, JDBC]. - @param message The message to log. - **/ - public static final void log(int category, String message) - { - logData(null, category, message, null); - } - - - /** - Logs a message for the specified component for the specified category. - If the category is disabled, nothing is logged. If no print writer - or file name has been set for the component, nothing is logged. - @param component The component to trace. - @param category The message category [DATASTREAM, DIAGNOSTIC, - ERROR, INFORMATION, WARNING, CONVERSION, PROXY, JDBC]. - @param message The message to log. - **/ - public static final void log(Object component, int category, String message) - { - logData(component, category, message, null); - } - - - /** - Logs a message in the specified category. If the category is disabled, nothing is logged. - @param category The message category [DATASTREAM, DIAGNOSTIC, ERROR, INFORMATION, - WARNING, CONVERSION, PROXY, JDBC]. - @param message The message to log. - @param e The Throwable object that contains the stack trace to log. - **/ - public static final void log(int category, String message, Throwable e) - { - logData(null, category, message, e); - } - - - /** - Logs a message in the specified category for the specified component. - If the category is disabled, nothing is logged. - @param component The component to trace. - @param category The message category [DATASTREAM, DIAGNOSTIC, ERROR, - INFORMATION, WARNING, CONVERSION, PROXY, JDBC]. - @param message The message to log. - @param e The Throwable object that contains the stack trace to log. - **/ - public static final void log(Object component, int category, String message, Throwable e) - { - logData(component, category, message, e); - } - - /** - Logs a message in the specified category. If the category is disabled, nothing is logged. - @param category The message category [DATASTREAM, DIAGNOSTIC, ERROR, - INFORMATION, WARNING, CONVERSION, PROXY, JDBC]. - @param e The Throwable object that contains the stack trace to log. - **/ - public static final void log(int category, Throwable e) - { - if (e.getLocalizedMessage() == null) //$B2A - log(category, "Exception does not contain a message.", e); //$B2A - else //$B2A - log(category, e.getLocalizedMessage (), e); //$B2C - } - - - /** - Logs a message in the specified category for the specified component. - If the category is disabled, nothing is logged. - @param component The component to trace. - @param category The message category [DATASTREAM, DIAGNOSTIC, ERROR, - INFORMATION, WARNING, CONVERSION, PROXY, JDBC]. - @param e The Throwable object that contains the stack trace to log. - **/ - public static final void log(Object component, int category, Throwable e) - { - if (e.getLocalizedMessage() == null) //$B2A - log(component, category, "Exception does not contain a message.", e); //$B2A - else //$B2A - log(component, category, e.getLocalizedMessage (), e); //$B2C - } - - - - /** - Logs a message and an integer value in the specified category. If the - category is disabled, nothing is logged. The integer value is appended - to the end of the message, preceded by two blanks. - @param category The message category [DATASTREAM, DIAGNOSTIC, ERROR, - INFORMATION, WARNING, CONVERSION, PROXY, JDBC]. - @param message The message to log. - @param value The integer value to log. - **/ - public static final void log(int category, String message, int value) - { - if (message == null) message = "(null)"; - log(category, message + " " + value); - } - - - - /** - Logs a message and a String value in the specified category. If the - category is disabled, nothing is logged. The String value is appended - to the end of the message, preceded by two blanks. - @param category The message category [DATASTREAM, DIAGNOSTIC, ERROR, - INFORMATION, WARNING, CONVERSION, PROXY, JDBC]. - @param message The message to log. - @param value The String value to log. - **/ - public static final void log(int category, String message, String value) - { - if (message == null) message = "(null)"; - log(category, message + " " + (value == null ? "(null)" : value)); - } - - - - /** - Logs a message and an integer value in the specified category for the - specified component. If the - category is disabled, nothing is logged. The integer value is appended - to the end of the message, preceded by two blanks. - @param component The component to trace. - @param category The message category [DATASTREAM, DIAGNOSTIC, ERROR, - INFORMATION, WARNING, CONVERSION, PROXY, JDBC]. - @param message The message to log. - @param value The integer value to log. - **/ - public static final void log(Object component, int category, String message, int value) - { - if (message == null) message = "(null)"; - log(component, category, message + " " + value); - } - - - /** - Logs a SSL message based on the SSLException integer values to the specified category. - @param category The message category [DATASTREAM, DIAGNOSTIC, ERROR, - INFORMATION, WARNING, CONVERSION, PROXY, JDBC]. - @param sslCategory The SSLException category. - @param sslError The SSLException error. - @param sslInt1 The SSLException Int1. - **/ - static final void logSSL(int category, int sslCategory, int sslError, int sslInt1) //$B1A - { - log(Trace.ERROR, "An SSLException occurred, turn on DIAGNOSITC tracing to see the details."); - log(category, "SSL Category: " + sslCategory); - log(category, "SSL Error: " + sslError); - log(category, "SSL Int1: " + sslInt1); - } - - - /** - Logs a message and a boolean value in the specified category. - If the category is disabled, nothing is logged. The boolean - value is appended to the end of the message, preceded by two blanks. - true is logged for true, and false is logged for false. - @param category The message category [DATASTREAM, DIAGNOSTIC, ERROR, - INFORMATION, WARNING, CONVERSION, PROXY, JDBC]. - @param message The message to log. - @param value The boolean data to log. - **/ - public static final void log(int category, String message, boolean value) - { - if (message == null) message = "(null)"; - log(category, message + " " + value); - } - - /** - Logs a message and a boolean value in the specified category - for the specified component. - If the category is disabled, nothing is logged. The boolean - value is appended to the end of the message, preceded by two blanks. - true is logged for true, and false is logged for false. - @param component The component to trace. - @param category The message category [DATASTREAM, DIAGNOSTIC, ERROR, - INFORMATION, WARNING, CONVERSION, PROXY, JDBC]. - @param message The message to log. - @param value The boolean data to log. - **/ - public static final void log(Object component, int category, String message, boolean value) - { - if (message == null) message = "(null)"; - log(component, category, message + " " + value); - } - - - - - /** - Logs a message and byte data in the specified category. If the category is disabled, nothing is logged. The byte data is appended to the end of the message, sixteen bytes per line. - @param category The message category [DATASTREAM, DIAGNOSTIC, ERROR, INFORMATION, WARNING, CONVERSION, PROXY, JDBC]. - @param message The message to log. - @param data The bytes to log. - **/ - public static final void log(int category, String message, byte[] data) - { - if (data == null) - { - if (message == null) message = "(null)"; - log(category, message + " " + "(null)"); - } - else - { - log(category, message, data, 0, data.length); - } - } - - - - - /** - Logs a message and byte data in the specified category for the - specified component. If the category is disabled, nothing is logged. - The byte data is appended to the end of the message, sixteen bytes per line. - @param component The component to trace. - @param category The message category [DATASTREAM, DIAGNOSTIC, ERROR, - INFORMATION, WARNING, CONVERSION, PROXY, JDBC]. - @param message The message to log. - @param data The bytes to log. - **/ - public static final void log(Object component, int category, String message, byte[] data) - { - if (data == null) - { - if (message == null) message = "(null)"; - log(component, category, message + " " + "(null)"); - } - else - { - log(component, category, message, data, 0, data.length); - } - } - - - - /** - Logs a message and byte data in the specified category. If the - category is disabled, nothing is logged. The byte data is - appended to the end of the message, sixteen bytes per line. - @param category The message category [DATASTREAM, DIAGNOSTIC, ERROR, - INFORMATION, WARNING, CONVERSION, PROXY, JDBC]. - @param message The message to log. - @param data The bytes to log. - @param offset The start offset in the data. - @param length The number of bytes of data to log. - **/ - - public static final void log(int category, String message, byte[] data, int offset, int length) - { - if ((traceOn_ && traceCategory(category)) || - (findLogger() && logger_.isLoggable(category))) - { - if (logger_ == null || userSpecifiedDestination_) // traditional trace - { // log to destination_ - synchronized(destination_) - { - logTimeStamp(null, destination_); - if (message != null) destination_.println(message); - printByteArray(destination_, data, offset, length); - if (category == ERROR) - { - new Throwable().printStackTrace(destination_); - } - } - } - else // log to logger_ - { - StringBuffer buf = new StringBuffer(); - logTimeStamp(null, buf); - printByteArray(buf, data, offset, length); - if (category == ERROR) { - logger_.log(category, buf.toString(), new Throwable()); - } - else { - logger_.log(category, buf.toString()); - } - } - } - } - - - /** - Logs a message and byte data in the specified category - for the specified component. If the - category is disabled, nothing is logged. The byte data is - appended to the end of the message, sixteen bytes per line. - @param component The component to trace. - @param category The message category [DATASTREAM, DIAGNOSTIC, ERROR, - INFORMATION, WARNING, CONVERSION, PROXY, JDBC]. - @param message The message to log. - @param data The bytes to log. - @param offset The start offset in the data. - @param length The number of bytes of data to log. - **/ - public static final void log(Object component, int category, String message, - byte[] data, int offset, int length) - { - if (message == null) message = "(null)"; - if (component == null) - { - throw new NullPointerException("component"); - } - - if ((traceOn_ && traceCategory(category)) || - (findLogger() && logger_.isLoggable(category))) - { - if (logger_ == null || userSpecifiedDestination_) // traditional trace - { // log to component-specific trace file - PrintWriter pw = (PrintWriter) printWriterHash_.get(component); - if (pw == null) - { - pw = new PrintWriter(System.out, true); - printWriterHash_.put(component, pw); - } - - synchronized(pw) - { - logTimeStamp(component, pw); - pw.println(message); - printByteArray(pw, data, offset, length); - if (category == ERROR) - { - new Throwable().printStackTrace(pw); - } - } - } - log(category, message, data, offset, length); - } - } - - - // Logs data from a byte array starting at offset for the length specified. - // Output sixteen bytes per line, two hexadecimal digits per byte, one - // space between bytes. - static void printByteArray(PrintWriter pw, byte[] data, int offset, int length) - { - if (data == null) { - pw.println("(null)"); - return; - } - - for (int i = 0; i < length; i++, offset++) - { - pw.print(toHexString(data[offset])); - pw.print(" "); - - if ((i & 0x0F ) == 0x0F) - { - pw.println(); // start a new line - } - } - if (((length - 1) & 0x0F) != 0x0F) - { - // Finish the line of data. - pw.println(); - } - } - - - // Logs data from a byte array. - // Output sixteen bytes per line, two hexadecimal digits per byte, one - // space between bytes. - static void printByteArray(StringBuffer buf, byte[] data) - { - printByteArray(buf, data, 0, data.length); - } - - - // Logs data from a byte array starting at offset for the length specified. - // Output sixteen bytes per line, two hexadecimal digits per byte, one - // space between bytes. - static void printByteArray(StringBuffer buf, byte[] data, int offset, int length) - { - if (data == null) { - buf.append("(null)\n"); - return; - } - - for (int i = 0; i < length; i++, offset++) - { - buf.append(toHexString(data[offset])); - buf.append(" "); - - if ((i & 0x0F ) == 0x0F) - { - buf.append("\n"); // start a new line - } - } - if (((length - 1) & 0x0F) != 0x0F) - { - // Finish the line of data. - buf.append("\n"); - } - } - - // Hexadecimal string representations of all possible values for a single byte. - private static final String[] HEX_BYTE_ARRAY = new String[] - { - "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0A", "0B", "0C", "0D", "0E", "0F", - "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1A", "1B", "1C", "1D", "1E", "1F", - "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2A", "2B", "2C", "2D", "2E", "2F", - "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3A", "3B", "3C", "3D", "3E", "3F", - "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4A", "4B", "4C", "4D", "4E", "4F", - "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5A", "5B", "5C", "5D", "5E", "5F", - "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6A", "6B", "6C", "6D", "6E", "6F", - "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7A", "7B", "7C", "7D", "7E", "7F", - "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8A", "8B", "8C", "8D", "8E", "8F", - "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9A", "9B", "9C", "9D", "9E", "9F", - "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "AA", "AB", "AC", "AD", "AE", "AF", - "B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9", "BA", "BB", "BC", "BD", "BE", "BF", - "C0", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "CA", "CB", "CC", "CD", "CE", "CF", - "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "D9", "DA", "DB", "DC", "DD", "DE", "DF", - "E0", "E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8", "E9", "EA", "EB", "EC", "ED", "EE", "EF", - "F0", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "FA", "FB", "FC", "FD", "FE", "FF" - }; - - - /** - Returns a string representation of the byte argument, as 2 hexadecimal digits. - @param b A byte to be converted to a string. - @return The 2-digit hexadecimal string representation of the byte argument. - **/ - public static final String toHexString(byte b) - { - return HEX_BYTE_ARRAY[0x00FF & b]; - } - - - /** - Returns a string representation of the byte-array argument, as a sequence of hexadecimal digits. - @param bytes A byte array to be converted to a string. - @return The hexadecimal string representation of the byte array argument. - **/ - public static final String toHexString(byte[] bytes) - { - if (bytes == null) throw new NullPointerException("bytes"); - StringBuffer buf = new StringBuffer(); - for (int i=0; iNote: "thread" is not a separate trace category. That is, simply calling setTraceThreadOn(true) by itself will not cause any trace messages to be generated. - Rather, it will cause additional thread-related information to be included in trace messages generated for other trace categories, such as "diagnostic" and "information". - @param traceThread If true, thread tracing is on; - otherwise, thread tracing is off. - @see Trace#setTraceOn - **/ - public static void setTraceThreadOn(boolean traceThread) - { - if (traceThread_ != traceThread) - { - traceThread_ = traceThread; - if (traceThread) aTraceCategoryHasBeenActivated_ = true; - if (findLogger()) logger_.setLevel(); - } - } - - - /** - Sets warning tracing on or off. The actual tracing does not happen - unless tracing is enabled. - @param traceWarning If true, warning tracing is enabled; - otherwise, warning tracing is disabled. - @see Trace#setTraceOn - **/ - public static void setTraceWarningOn(boolean traceWarning) - { - if (traceWarning_ != traceWarning) - { - traceWarning_ = traceWarning; - if (traceWarning) aTraceCategoryHasBeenActivated_ = true; - if (findLogger()) logger_.setLevel(); - } - } - - // Indicates if this category is being traced or not. - private static boolean traceCategory(int category) // @D5C - { - boolean trace = false; - switch (category) - { - case INFORMATION: - trace = traceInfo_; - break; - case WARNING: - trace = traceWarning_; - break; - case ERROR: - trace = traceError_; - break; - case DIAGNOSTIC: - trace = traceDiagnostic_; - break; - case DATASTREAM: - trace = traceDatastream_; - break; - case CONVERSION: - trace = traceConversion_; - break; - case PROXY: - trace = traceProxy_; - break; - case PCML: // @D8A - trace = tracePCML_; // @D8A - break; // @D8A - case JDBC: - trace = traceJDBC_; - break; - default: - throw new ExtendedIllegalArgumentException("category (" - + Integer.toString(category) - + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - return trace; - } - - - /** - * Determines if the user has requested the trace monitor be started. If so, starts the - * monitor thread. - */ - private static void startTraceMonitorIfNeeded() - { - String shouldMonitor = SystemProperties.getProperty(SystemProperties.TRACE_MONITOR); - if (shouldMonitor==null) return; //Not set, return - if (Boolean.valueOf(shouldMonitor).equals(Boolean.TRUE)) { - try { - Thread monitor = new Thread(new Trace(), "Toolbox Trace Monitor"); - monitor.setDaemon(true); //So this thread ends with the JVM - monitor.start(); - } - catch (Exception e) - { - System.err.println("Failed to start trace monitor: " + e.getMessage()); - e.printStackTrace(System.err); - } - } - } - - /** - * Handle the commands submitted to the monitor thread. - * @param commands - */ - private static String handleTraceStatusChange(String command) - { - int index = command.indexOf('='); - if (index<0) { - String msg = "Invalid trace command: " + command; - System.err.println(msg); - logData(null, ERROR, msg, null); - return msg; - } - - String property = command.substring(0,index); - String value = command.substring(index+1); - if (value.length()==0) value = null; //com.ibm.as400.access.Trace.category= - - if (property.equals(SystemProperties.TRACE_CATEGORY)) { - setTraceCategories(value); - } - else if (property.equals(SystemProperties.TRACE_FILE)) { - if (value==null || !value.equals(fileName_)) { - try { - setFileName(value); - } - catch (IOException e) { - String msg = "Failed to set file name to "+value+": " + e.getMessage(); - System.err.println(msg); - e.printStackTrace(System.err); - return msg; - } - } - } - else return ("Unrecognized command: " + command); - - return "Command processed: " + command; - } - - /** - * Listens for trace status changes. - */ - public void run() - { - int port; - try { - String portNum = SystemProperties.getProperty(SystemProperties.TRACE_MONITOR_PORT); - if (portNum!=null) port = Integer.parseInt(portNum); - else port = DEFAULT_MONITOR_PORT; - } - catch (Exception e) { - System.err.println("Failed to get TRACE_MONITOR_PORT property: " + e.getMessage()); - e.printStackTrace(System.err); - return; - } - - try { - ServerSocket monitorSocket_ = new ServerSocket(port, 1); //Only 1 connection at a time - while (true) - { - Socket currentSocket = monitorSocket_.accept(); //Wait for connect requests. - BufferedReader in = new BufferedReader(new InputStreamReader(currentSocket.getInputStream())); - PrintWriter out = new PrintWriter(currentSocket.getOutputStream(), true); - String command = in.readLine(); - if (command != null) { - String result = handleTraceStatusChange(command); - out.println(result); - } - currentSocket.close(); - } - } - catch (Exception e) { - System.err.println("Exception in trace monitor daemon: " + e.getMessage()); - e.printStackTrace(System.err); - } - } - - /** - * Update trace parameters. - * @param args - */ - public static void main(String[] args) - { - if (args.length<3) printUsage(); - else { - int port = 0; - try { - port = Integer.parseInt(args[1]); // assume the 2nd arg is portNum - } catch (Exception e) { - System.err.println("Invalid port specified (" + args[1] + ")"); - e.printStackTrace(System.err); - return; - } - - try { - for (int i=2; i -

  • /dev/qaspXX/udfsname.udfs, where XX is one of the valid system or basic user auxiliary storage pool (ASP) numbers on the system, and udfsname is the name of the user-defined file system. All other parts of the name must appear as in the example above. -
  • /dev/aspname/udfsname.udfs, where aspname is one of the valid independent ASP names on the system, and udfsname is the name of the user-defined file system. All other parts of the name must appear as in the example above. - -

    The name part of the path must be unique within the specified qaspXX or aspname directory. -

    Wildcard characters such as '*' and '?' are not allowed in this parameter. - **/ - public UDFS(AS400 system, String path) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing UDFS object, system: " + system + " path: " + path); - // Validate arguments. - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (path == null) - { - Trace.log(Trace.ERROR, "Parameter 'path' is null."); - throw new NullPointerException("path"); - } - system_ = system; - path_ = path; - } - - /** - Creates a file system that can be made visible to the rest of the integrated file system name space through the mount() method. -

    A UDFS is represented by the object type *BLKSF, or block special file. -

    The public data authority and public object authority will be *INDIR, the auditing value will be *SYSVAL, the scanning option will be *PARENT, rename and unlink will not be restricted, the default disk storage option and the default main storage option will be *NORMAL, the case sensitivity will be *MONO, the default file format will be *TYPE2, and the description will be *BLANK. -

    Restrictions: -

      -
    1. The user must have input/output (I/O) system configuration (*IOSYSCFG) special authority. -
    2. A maximum of approximately 4,000 user-defined file systems can be created on an independent auxiliary storage pool (ASP). -
    - @see #setPreferredStorageUnit - **/ - public void create() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Creating UDFS."); - StringBuffer cmd = new StringBuffer("CRTUDFS UDFS('" + path_ + "')"); - if (storageUnit_ != null && !storageUnit_.equalsIgnoreCase("*ANY")) - { - if (system_.getVRM() >= 0x00070100) { - cmd.append(" UNIT("+storageUnit_+")"); - } - else { - if (Trace.traceOn_) { - Trace.log(Trace.WARNING, "setPreferredStorageUnit(*SSD) is not supported prior to IBM i 7.1."); - } - } - } - runCommand(cmd.toString()); - } - - /** - Creates a file system that can be made visible to the rest of the integrated file system name space through the mount() method. -

    A UDFS is represented by the object type *BLKSF, or block special file. -

    Restrictions: -

      -
    1. The user must have input/output (I/O) system configuration (*IOSYSCFG) special authority. -
    2. The audit (*AUDIT) special authority is required when specifying a value other than *SYSVAL on the auditingValue parameter. -
    3. The user must have all object (*ALLOBJ) and security administrator (*SECADM) special authorities to specify a value for the scanningOption parameter other than *PARENT. -
    4. A maximum of approximately 4,000 user-defined file systems can be created on an independent auxiliary storage pool (ASP). -
    - To retrieve attribute values, use the 'get' methods of {@link FileAttributes FileAttributes}. - @param publicDataAuthority Specifies the public data authority given to the user for the new user-defined file system (UDFS), or specifies that all authorities are inherited from the directory it is to be created in. Possible values are: -
      -
    • "*INDIR" - The authority for the UDFS to be created is determined by the directory it is to be created in. This means the new UDFS will inherit its primary group, authorization list, and its public, private and primary group authorities from the /dev/qaspXX or /dev/aspname directory. If the value *INDIR is specified for either the publicObjectAuthority parameter or the publicDataAuthority parameter, then *INDIR must be specified for both parameters. -
    • "*RWX" - The user can change the object and perform basic functions on the object except those limited to the owner or controlled by object existence (*OBJEXIST), object management (*OBJMGT), object alter (*OBJALTER) and object reference (*OBJREF) authority. Read, write, execute (*RWX) provides object operational (*OBJOPR) and all data authorities. -
    • "*RW" - The user can view and change the contents of an object. Read, write (*RW) authority provides *OBJOPR and data read (*READ), add (*ADD), update (*UPD) and delete (*DLT) authorities. -
    • "*RX" - The user can perform basic operations on the object, such as run a program or display the contents of a file. The user is prevented from changing the object. Read, execute (*RX) authority provides *OBJOPR and data *READ and *EXECUTE authorities. -
    • "*WX" - The user can change the contents of an object and run a program or search a library or directory. Write, execute (*WX) authority provides *OBJOPR and data *READ, *UPD, *DLT, and *EXECUTE authorities. -
    • "*R" - The user can view the contents of an object. Read (*R) authority provides *OBJOPR and data *READ authorities. -
    • "*W" - The user can change the contents of an object. Write (*W) authority provides *OBJOPR and data *READ, *UPD, and *DLT authorities. -
    • "*X" - The user can run a program or search a library or directory. Execute (*X) authority provides *OBJOPR and data *EXECUTE authorities. -
    • "*EXCLUDE" - The user cannot access the object. The publicObjectAuthority parameter value must be *NONE, if this special value is used. -
    • "*NONE" - The user is given no data authorities to the object. This value cannot be used with publicObjectAuthority parameter value of *NONE. -
    • authorization-list-name - The format of the authorization list name remains the current ten-character format. The publicObjectAuthority parameter value must be *NONE, if this special value is used. -
    - @param publicObjectAuthority Specifies the public object authority given to users for the user-defined file system, or specifies that all authorities are inherited from the directory it is to be created in. Possible values for the elements of this array are: -
      -
    • "*INDIR" - The object authority for the UDFS to be created is determined by the directory it is to be created in. This means the new UDFS will inherit its primary group, authorization list, and its public, private and primary group authorities from the /dev/qaspXX or /dev/aspname directory. If the value *INDIR is specified for either the publicObjectAuthority parameter or the publicDataAuthority parameter, then *INDIR must be specified for both parameters. This value must be the only element of the array. -
    • "*NONE" - None of the other object authorities (*OBJEXIST, *OBJMGT, *OBJALTER or *OBJREF) are given to the users. If *EXCLUDE or an authorization list is specified for the publicDataAuthority parameter, *NONE must be specified. This value cannot be used with the publicDataAuthority parameter value of *NONE. This value must be the only element of the array. -
    • "*ALL" - All of the other object authorities (*OBJEXIST, *OBJMGT, *OBJALTER or *OBJREF) are given to the users. This value must be the only element of the array. -
    • "*OBJEXIST" - The user is given object existence (*OBJEXIST) authority to the object. The user can delete the object, free storage of the object, perform save and restore operations for the object, and transfer ownership of the object. -
    • "*OBJMGT" - The user is given object management (*OBJMGT) authority to the object. With this authority the user can specify security for the object, move or rename the object and add members to database files. -
    • "*OBJALTER" - The user is given object alter (*OBJALTER) authority to the object. The user is able to alter the attributes of the objects. On a database file, the user can add and remove triggers, add and remove referential and unique constraints, and change the attributes of the database file. With this authority on an SQL package, the user can change the attributes of the SQL package. Currently, this authority is used only for database files and SQL packages. -
    • "*OBJREF" - The user is given object reference (*OBJREF) authority to objects. Used only for database files, the user can reference an object from another object such that operations on that object may be restricted by the other object. On a physical file, the user can add a referential constraint in which the physical file is the parent. -
    - @param auditingValue Specifies the auditing value of root directory objects created in this user-defined file system. Possible values are: -
      -
    • "*SYSVAL" - The object auditing value for the objects in the UDFS is determined by the Create object auditing (QCRTOBJAUD) system value. -
    • "*NONE" - Using or changing this object does not cause an audit entry to be sent to the security journal. -
    • "*USRPRF" - The user profile of the user accessing this object is used to determine if an audit record is sent for this access. The OBJAUD parameter of the Change User Auditing (CHGUSRAUD) command is used to turn on auditing for a specific user. -
    • "*CHANGE" - All change accesses to this object by all users are logged. -
    • "*ALL" - All change or read accesses to this object by all users are logged. -
    - @param scanningOption Specifies whether the root directory objects created in the user-defined file system will be scanned when exit programs are registered with any of the integrated file system scan-related exit points. -

    The integrated file system scan-related exit points are: -

      -
    • QIBM_QP0L_SCAN_OPEN - Integrated File System Scan on Open Exit Program -
    • QIBM_QP0L_SCAN_CLOSE - Integrated File System Scan on Close Exit Program -
    -

    For details on these exit points, see the System API Reference information in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter. -

    Even though this attribute can be set for user-defined file systems, only objects which are in *TYPE2 directories in that user-defined file system will actually be scanned, no matter what value is set for this attribute. -

    Possible values are: -

      -
    • "*PARENT" - The create object scanning attribute value for this user-defined file system is copied from the create object scanning attribute value of the parent directory. -
    • "*YES" - After an object is created in the user-defined file system, the object will be scanned according to the rules described in the scan-related exit programs if the object has been modified or if the scanning software has been updated since the last time the object was scanned. -
    • "*NO" - After an object is created in the user-defined file system, the object will not be scanned by the scan-related exit programs. -

      Note: If the Scan file systems control (QSCANFSCTL) value *NOPOSTRST is not specified when an object with this attribute is restored, the object will be scanned at least once after the restore. -

    • "*CHGONLY" - After an object is created in the user-defined file system, the object will be scanned according to the rules described in the scan-related exit programs only if the object has been modified since the last time the object was scanned. It will not be scanned if the scanning software has been updated. This attribute only takes effect if the Scan file systems control (QSCANFSCTL) system value has *USEOCOATR specified. Otherwise, it will be treated as if the attribute is *YES. -

      Note: If the Scan file systems control (QSCANFSCTL) value *NOPOSTRST is not specified when an object with this attribute is restored, the object will be scanned at least once after the restore. -

    -

    This parameter is ignored on Version 5 Release 2 and earlier of IBM i. - @param specialRestrictions Specifies whether special restrictions apply for rename and unlink operations performed on objects within the root directory of the user-defined file system. This attribute is equivalent to the S_ISVTX mode bit for this directory. true if objects within the root directory of the user-defined file system may be renamed or unlinked only if one or more of the following are true for the user performing the operation: -

      -
    • The user is the owner of the object. -
    • The user is the owner of the directory. -
    • The user has all object (*ALLOBJ) special authority. -
    -

    false if no additional restrictions for renaming or unlinking objects from the root directory of the user-defined file system. This parameter is ignored on Version 5 Release 2 and earlier of IBM i. - @param defaultDiskStorageOption Specifies how auxiliary storage will be allocated by the system for the stream files (*STMF) created in this user-defined file system. This option will be ignored for *TYPE1 stream files. Possible values are: -

      -
    • "*NORMAL" - The auxiliary storage will be allocated normally. That is, as additional auxiliary storage is required, it will be allocated in logically sized extents to accommodate the current space requirement, and anticipated future requirements, while minimizing the number of disk I/O operations. -
    • "*MINIMIZE" - The auxiliary storage will be allocated to minimize the space used by the object. That is, as additional auxiliary storage is required, it will be allocated in small sized extents to accommodate the current space requirement. Accessing an object composed of many small extents may increase the number of disk I/O operations for that object. -
    • "*DYNAMIC" - The system will dynamically determine the optimal auxiliary storage allocation for the object, balancing space used versus disk I/O operations. For example, if a file has many small extents, yet is frequently being read and written, then future auxiliary storage allocations will be larger extents to minimize the number of disk I/O operations. Or, if a file is frequently truncated, then future auxiliary storage allocations will be small extents to minimize the space used. Additionally, information will be maintained on the stream file sizes for this system and its activity. This file size information will also be used to help determine the optimal auxiliary storage allocations for this object as it relates to the other objects' sizes. -
    -

    This parameter is ignored on Version 5 Release 4 and earlier of IBM i. - @param defaultMainStorageOption Specifies how main storage is allocated and used by the system for the stream files (*STMF) created in this user-defined file system. Possible values are: -

      -
    • "*NORMAL" - The main storage will be allocated normally. That is, as as much main storage as possible will be allocated and used. This minimizes the number of disk I/O operations since the information is cached in main storage. -
    • "*MINIMIZE" - The main storage will be allocated to minimize the space used by the object. That is, as little main storage as possible will be allocated and used. This minimizes main storage usage while increasing the number of disk I/O operations since less information is cached in main storage. -
    • "*DYNAMIC" - The system will dynamically determine the optimal main storage allocation for the object depending on other system activity and main storage contention. That is, when there is little main storage contention, as much storage as possible will be allocated and used to minimize the number of disk I/O operations. When there is significant main storage contention, less main storage will be allocated and used to minimize the main storage contention. This option only has an effect when the storage pool's paging option is *CALC. When the storage pool's paging option is *FIXED, the behavior is the same as *NORMAL. When the object is accessed through a file server, this option has no effect. Instead, its behavior is the same as *NORMAL. -
    -

    This parameter is ignored on Version 5 Release 4 and earlier of IBM i. - @param caseSensitivity Specifies the case sensitivity of this file system. Possible values are: -

      -
    • "*MONO" - The file system will not be case sensitive. For example, the names FileA and filea refer to the same object. -
    • "*MIXED" - The file system will be case sensitive. For example, the names FileA and filea do NOT refer to the same object. -
    - @param defaultFileFormat Specifies the format of stream files (*STMF) created in this user-defined file system. Possible values are: -
      -
    • "*TYPE2" - A *TYPE2 *STMF has high performance file access and was new in Version 4 Release 4 of IBM i. It has a minimum object size of 4096 bytes and a maximum object size of approximately 1 terabyte. A *TYPE2 stream file is capable of memory mapping as well as the ability to specify an attribute to optimize disk storage allocation. -
    • "*TYPE1" - A *TYPE1 *STMF has the same format as *STMF objects created on releases prior to Version 4 Release 4 of IBM i. It has a minimum size of 4096 bytes and a maximum object size of approximately 256 gigabytes. -
    - @param description Text description for the user-defined file system. Possible values are: -
      -
    • "*BLANK" - Text is not specified. -
    • description - Specify no more than 50 characters. -
    - @see #setPreferredStorageUnit - **/ - public void create(String publicDataAuthority, String[] publicObjectAuthority, String auditingValue, String scanningOption, boolean specialRestrictions, String defaultDiskStorageOption, String defaultMainStorageOption, String caseSensitivity, String defaultFileFormat, String description) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Creating UDFS."); - int vrm = system_.getVRM(); - - StringBuffer cmd = new StringBuffer("CRTUDFS UDFS('" + path_ + "')"); - cmd.append(" DTAAUT(" + publicDataAuthority + ")"); - cmd.append(" OBJAUT(" + setArrayToString(publicObjectAuthority) + ")"); - cmd.append(" CRTOBJAUD(" + auditingValue + ")"); - if (vrm >= 0x00050300) { - cmd.append(" CRTOBJSCAN(" + scanningOption + ")"); - cmd.append(" RSTDRNMUNL(" + (specialRestrictions ? "*YES" : "*NO") + ")"); - } - if (vrm >= 0x00060100) { - cmd.append(" DFTDISKSTG(" + defaultDiskStorageOption + ")"); - cmd.append(" DFTMAINSTG(" + defaultMainStorageOption + ")"); - } - cmd.append(" CASE(" + caseSensitivity + ")"); - cmd.append(" DFTFILEFMT(" + defaultFileFormat + ")"); - cmd.append(" TEXT('" + description + "')"); - - if (storageUnit_ != null && !storageUnit_.equalsIgnoreCase("*ANY")) - { - if (vrm >= 0x00070100) { - cmd.append(" UNIT("+storageUnit_+")"); - } - else { - if (Trace.traceOn_) { - Trace.log(Trace.WARNING, "setPreferredStorageUnit(*SSD) is not supported prior to IBM i 7.1."); - } - } - } - - runCommand(cmd.toString()); - } - - /** - Deletes an existing and unmounted user-defined file system (UDFS) and all of the objects within it. The command will fail if the UDFS is mounted. -

    Restrictions: -

      -
    1. The UDFS to be deleted must not be mounted. -
    2. Only a user with input/output (I/O) system configuration (*IOSYSCFG) special authority can specify this command. -
    3. The user must have object existence (*OBJEXIST) authority to all of the objects in the UDFS. -
    - **/ - public void delete() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Deleting UDFS."); - runCommand("DLTUDFS UDFS('" + path_ + "')"); - } - - /** - Makes the objects in a file system accessible to the integrated file system name space. The directory that is the destination for the mount, the mountPoint parameter, must exist. The mount will be performed with default options, read-write and setuid execution allowed. -

    Restrictions: -

      -
    1. The user must have input/output (I/O) system configuration (*IOSYSCFG) special authority to use this command. -
    2. The user must have write (*W) authority to the directory to be mounted over. -
    3. The user must have execute (*X) authority to each directory in the path. -
    - @param mountPoint Specifies the path name of the existing directory that the file system will be mounted over. This directory gets 'covered' by the mounted file system. This directory must exist. -

    Multiple file systems can be mounted over the same directory, one on top of the other. However, only the topmost mounted file system is accessible, and the file systems must later be unmounted in the opposite order from which they were mounted (last-in first-out order). - **/ - public void mount(String mountPoint) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Mounting UDFS."); - runCommand("ADDMFS TYPE(*UDFS) MFS('" + path_ + "') MNTOVRDIR('" + mountPoint + "')"); - } - - /** - Makes the objects in a file system accessible to the integrated file system name space. The directory that is the destination for the mount, the mountPoint parameter, must exist. -

    Restrictions: -

      -
    1. The user must have input/output (I/O) system configuration (*IOSYSCFG) special authority to use this command. -
    2. The user must have write (*W) authority to the directory to be mounted over. -
    3. The user must have execute (*X) authority to each directory in the path. -
    - @param mountPoint Specifies the path name of the existing directory that the file system will be mounted over. This directory gets 'covered' by the mounted file system. This directory must exist. -

    Multiple file systems can be mounted over the same directory, one on top of the other. However, only the topmost mounted file system is accessible, and the file systems must later be unmounted in the opposite order from which they were mounted (last-in first-out order). - @param rwOption This option specifies the protection for the mounted file system. true if read-write, false if read-only. - @param suidOption This option specifies whether setuid execution is allowed. true if suid is specified and setuid execution is allowed. This means that bits other than the permission bits may be set. false if nosuid is specified, setuid execution is not allowed. This parameter is ignored on Version 5 Release 2 and earlier of IBM i. - **/ - public void mount(String mountPoint, boolean rwOption, boolean suidOption) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Mounting UDFS."); - runCommand("ADDMFS TYPE(*UDFS) MFS('" + path_ + "') MNTOVRDIR('" + mountPoint + "') OPTIONS('" + (rwOption ? "rw," : "ro,") + (suidOption ? "suid" : "nosuid") + "')"); - } - - /** - Makes a previously mounted file system inaccessible within the integrated file system name space. If any of the objects in the file system are in use, the command will return an error message to the user. Note that if any part of the file system has itself been mounted over, then this file system cannot be unmounted until it is uncovered. -

    Restrictions: -

      -
    1. The user must have input/output (I/O) system configuration (*IOSYSCFG) special authority to use this command. - **/ - public void unmount() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Unmounting UDFS."); - runCommand("RMVMFS TYPE(*UDFS) MFS('" + path_ + "')"); - } - - // Convenience method for making a command string from array of strings. - static private String setArrayToString(String[] array) - { - int arrayLength = array.length; - if (arrayLength == 0) return "*INDIR"; - if (arrayLength == 1) return array[0]; - StringBuffer buf = new StringBuffer(array[0]); - for (int i = 1; i < arrayLength; ++i) - { - buf.append(" "); - buf.append(array[i]); - } - return buf.toString(); - } - - // Common code for running the commands. - private void runCommand(String command) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - CommandCall cmd = new CommandCall(system_, command); - // CRTUDFS, DLTUDFS, ADDMFS, RMVMFS are not thread safe. - cmd.suggestThreadsafe(false); - if (!cmd.run()) - { - throw new AS400Exception(cmd.getMessageList()); - } - } - - // Add IOCTL reply stream. - static - { - AS400Server.addReplyStream(new IFSIoctlRep(), AS400.FILE); - } - - // File descriptor object for communication with the file server. - private IFSFileDescriptorImplRemote fd_ = new IFSFileDescriptorImplRemote(); - - // Create the path name expected by the file server. - private static byte[] createPathName(AS400 system, String path) throws IOException - { - path = path.replace('/', '\\'); - Converter conv = new Converter(1200, system); - - byte[] pathName = new byte[4 + path.length() * 2]; - BinaryConverter.intToByteArray(path.length() * 2, pathName, 0); - conv.stringToByteArray(path, pathName, 4); - return pathName; - } - - /** - Returns information about a UDFS. - @return Information about a UDFS. - **/ - public UdfsInformationStructure getUdfsInformationStructure() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - fd_.system_ = (AS400ImplRemote)system_.getImpl(); - fd_.connect(); - DataStream baseReply = fd_.server_.sendAndReceive(new IFSIoctlReq(0x00000001, createPathName(system_, path_))); - - // Punt if unknown data stream. - if (!(baseReply instanceof IFSIoctlRep)) - { - Trace.log(Trace.ERROR, "Unknown reply datastream:", baseReply.data_); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - - IFSIoctlRep reply = (IFSIoctlRep)baseReply; - - // Get info from reply. - return new UdfsInformationStructure(reply.getReplyData()); - } - - /** - Returns information about a mounted file system. - @return Information about a mounted file system. - **/ - public MountedFsInformationStructure getMountedFsInformationStructure() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - fd_.system_ = (AS400ImplRemote)system_.getImpl(); - fd_.connect(); - DataStream baseReply = fd_.server_.sendAndReceive(new IFSIoctlReq(0x00000004, createPathName(system_, path_))); - - // Punt if unknown data stream. - if (!(baseReply instanceof IFSIoctlRep)) - { - Trace.log(Trace.ERROR, "Unknown reply datastream:", baseReply.data_); - throw new InternalErrorException(InternalErrorException.DATA_STREAM_UNKNOWN); - } - - IFSIoctlRep reply = (IFSIoctlRep)baseReply; - - // Get info from reply. - return new MountedFsInformationStructure(reply.getReplyData()); - } - - - /** - Specifies the preferred storage media of objects created in this user-defined file system. In order to be effective, this method must be called prior to {@link #create create()}. -

      Note: This method is supported only on IBM i version 7.1 and higher. On IBM i version 7.1 it is supported only if IBM i 7.1 PTF SI39439 is installed. If *SSD is specified for a system at IBM i 7.1, and PTF SI39439 is not installed, then the create() methods will throw an AS400Exception indicating "Keyword UNIT not valid for this command". -

      To retrieve the in-effect value of the "preferred storage unit" attribute, call {@link FileAttributes#getUdfsPreferredStorageUnit FileAttributes.getUdfsPreferredStorageUnit()}. - @param storageUnit Preferred storage unit. - Possible values are: -

        -
      • "*ANY" - No storage media is preferred. Storage will be allocated from any available storage media. -
      • "*SSD" - Solid state drive disk storage media is preferred. Storage should be allocated from solid state drive storage media, if available. -
      - The default is "*ANY". null is interpreted as "*ANY". - **/ - public void setPreferredStorageUnit(String storageUnit) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting storage unit to " + storageUnit); - if (storageUnit == null || storageUnit.equalsIgnoreCase("*ANY")) { - storageUnit_ = null; // internally interpreted as *ANY - } - else if (storageUnit.equalsIgnoreCase("*SSD")) { - storageUnit_ = "*SSD"; - } - else { - throw new ExtendedIllegalArgumentException("storageUnit (" + storageUnit + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - - /** - Contains information about a UDFS. - **/ - public class UdfsInformationStructure - { - private String owner_; - private int ccsid_; - private String caseSensitivity_; - private String description_; - private String pathWhereMounted_; - - /** - Returns the user profile name of the user who owns the user-defined file system (UDFS). - @return The user profile name of the user who owns the user-defined file system (UDFS). - **/ - public String getOwner() - { - return owner_; - } - - /** - Returns the coded character set identifier (CCSID) for the data in the user-defined file system (UDFS). - @return The coded character set identifier (CCSID) for the data in the user-defined file system (UDFS). - **/ - public int getCcsid() - { - return ccsid_; - } - - /** - Returns the case sensitivity of this file system. - @return The case sensitivity of this file system. Possible values are: -
        -
      • "*MONO" - The file system will not be case sensitive. For example, the names FileA and filea refer to the same object. -
      • "*MIXED" - The file system will be case sensitive. For example, the names FileA and filea do NOT refer to the same object. -
      - **/ - public String getCaseSensitivity() - { - return caseSensitivity_; - } - - /** - Returns the text description for the user-defined file system. - @return The text description for the user-defined file system. - **/ - public String getDescription() - { - return description_; - } - - /** - Returns the path name where the user-defined file system (UDFS) is mounted. - @return The path name where the user-defined file system (UDFS) is mounted. - **/ - public String getPathWhereMounted() - { - return pathWhereMounted_; - } - - // Parse the returned information. - private UdfsInformationStructure(byte[] replyData) throws ErrorCompletingRequestException, IOException - { - Converter convu = new Converter(1200, system_); - Converter conve = new Converter(37, system_); - - int rc = BinaryConverter.byteArrayToInt(replyData, 0); - if (rc != 0) - { - Trace.log(Trace.ERROR, "Get UDFS information structure was not successful, errno:", rc); - throw new ErrnoException(system_, rc); - } - owner_ = conve.byteArrayToString(replyData, 4, 10).trim(); - ccsid_ = BinaryConverter.byteArrayToUnsignedShort(replyData, 14); - caseSensitivity_ = replyData[16] == 0x00 ? "*MONO" : "*MIXED"; - int descriptionLength = replyData[19]; - description_ = conve.byteArrayToString(replyData, 21, descriptionLength).trim(); - pathWhereMounted_ = convu.byteArrayToString(replyData, 121, replyData.length - 121); - } - } - - /** - Contains information about a mounted file system. - **/ - public class MountedFsInformationStructure - { - private boolean idUdfs_; - private boolean isMounted_; - - /** - Returns whether the the path is a user-defined file system (UDFS). - @return true if the object is a user-defined file system (UDFS); false otherwise. - **/ - public boolean isUdfs() - { - return idUdfs_; - } - - /** - Returns whether the the path is mounted. - @return true if the object is mounted; false otherwise. - **/ - public boolean isMounted() - { - return isMounted_; - } - - // Parse the returned information. - private MountedFsInformationStructure(byte[] replyData) throws ErrorCompletingRequestException - { - int rc = BinaryConverter.byteArrayToInt(replyData, 0); - if (rc != 0) - { - Trace.log(Trace.ERROR, "Get mounted FS information structure was not successful, errno:", rc); - throw new ErrnoException(system_, rc); - } - idUdfs_ = replyData[4] == 0x00 ? false : true; - isMounted_ = replyData[5] == 0x00 ? false : true; - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/UnixSocket.java b/cvsroot/src/com/ibm/as400/access/UnixSocket.java deleted file mode 100644 index e116c2354..000000000 --- a/cvsroot/src/com/ibm/as400/access/UnixSocket.java +++ /dev/null @@ -1,45 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UnixSocket.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -class UnixSocket -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - UnixSocketImpl impl; - - public UnixSocket(int serverNumber) throws IOException - { - impl = new UnixSocketImpl(); - impl.create(serverNumber); - } - - public InputStream getInputStream() throws IOException - { - return impl.getInputStream(); - } - - public OutputStream getOutputStream() throws IOException - { - return impl.getOutputStream(); - } - - public synchronized void close() throws IOException - { - impl.close(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/UnixSocketImpl.java b/cvsroot/src/com/ibm/as400/access/UnixSocketImpl.java deleted file mode 100644 index d996f2f20..000000000 --- a/cvsroot/src/com/ibm/as400/access/UnixSocketImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UnixSocketImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.FileDescriptor; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -class UnixSocketImpl -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - static - { - System.load("/QSYS.LIB/QYJSPSCK.SRVPGM"); - } - - FileDescriptor fd; - - UnixSocketImpl() - { - } - - synchronized void create(int serverNumber) throws IOException - { - fd = new FileDescriptor(); - try - { - this.socketCreate(serverNumber); - } - catch (IOException e) - { - this.close(); - throw e; - } - } - - FileDescriptor getFileDescriptor() - { - return fd; - } - - synchronized InputStream getInputStream() throws IOException - { - return new UnixSocketInputStream(this); - } - - synchronized OutputStream getOutputStream() throws IOException - { - return new UnixSocketOutputStream(this); - } - - synchronized int available() throws IOException - { - return this.socketAvailable(); - } - - void close() throws IOException - { - if (fd != null) - { - this.socketClose(); - fd = null; - } - } - - protected void finalize() throws IOException - { - this.close(); - } - - private native int socketAvailable() throws IOException; - private native void socketCreate(int serverNumber) throws IOException; - private native void socketClose() throws IOException; -} diff --git a/cvsroot/src/com/ibm/as400/access/UnixSocketInputStream.java b/cvsroot/src/com/ibm/as400/access/UnixSocketInputStream.java deleted file mode 100644 index f6fa86cf5..000000000 --- a/cvsroot/src/com/ibm/as400/access/UnixSocketInputStream.java +++ /dev/null @@ -1,103 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UnixSocketInputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.FileInputStream; -import java.io.IOException; - -class UnixSocketInputStream extends FileInputStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - private boolean eof; - private UnixSocketImpl impl; - private byte temp[] = new byte[1]; - - UnixSocketInputStream(UnixSocketImpl impl) throws IOException - { - super(impl.getFileDescriptor()); - this.impl = impl; - } - - private native int socketRead(byte b[], int off, int len) throws IOException; - - public int read(byte b[]) throws IOException - { - return read(b, 0, b.length); - } - - public int read(byte b[], int off, int length) throws IOException - { - if (eof) - { - return -1; - } - int n = socketRead(b, off, length); - if (n <= 0) - { - eof = true; - return -1; - } - return n; - } - - public int read() throws IOException - { - if (eof) - { - return -1; - } - - int n = read(temp, 0, 1); - if (n <= 0) - { - return -1; - } - return temp[0] & 0xff; - } - - public long skip(long numbytes) throws IOException - { - if (numbytes <= 0) - { - return 0; - } - long n = numbytes; - int buflen = (int) Math.min(1024, n); - byte data[] = new byte[buflen]; - while (n > 0) - { - int r = read(data, 0, (int) Math.min((long) buflen, n)); - if (r < 0) - { - break; - } - n -= r; - } - return numbytes - n; - } - - public int available() throws IOException - { - return impl.available(); - } - - public void close() throws IOException - { - impl.close(); - } - - protected void finalize() - { - } -} diff --git a/cvsroot/src/com/ibm/as400/access/UnixSocketOutputStream.java b/cvsroot/src/com/ibm/as400/access/UnixSocketOutputStream.java deleted file mode 100644 index 99fca321c..000000000 --- a/cvsroot/src/com/ibm/as400/access/UnixSocketOutputStream.java +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UnixSocketOutputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.FileOutputStream; -import java.io.IOException; - -class UnixSocketOutputStream extends FileOutputStream -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - private UnixSocketImpl impl; - private byte temp[] = new byte[1]; - - UnixSocketOutputStream(UnixSocketImpl impl) throws IOException - { - super(impl.getFileDescriptor()); - this.impl = impl; - } - - private native void socketWrite(byte b[], int off, int len) throws IOException; - - public void write(int b) throws IOException - { - temp[0] = (byte)b; - this.socketWrite(temp, 0, 1); - } - - public void write(byte b[]) throws IOException - { - this.socketWrite(b, 0, b.length); - } - - public void write(byte b[], int off, int len) throws IOException - { - this.socketWrite(b, off, len); - } - - public void close() throws IOException - { - impl.close(); - } - - protected void finalize() - { - } -} diff --git a/cvsroot/src/com/ibm/as400/access/UnixSocketUser.java b/cvsroot/src/com/ibm/as400/access/UnixSocketUser.java deleted file mode 100644 index 19095a14b..000000000 --- a/cvsroot/src/com/ibm/as400/access/UnixSocketUser.java +++ /dev/null @@ -1,42 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UnixSocketUser.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -class UnixSocketUser -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - static - { - System.load("/QSYS.LIB/QYJSPSCK.SRVPGM"); - } - - public UnixSocketUser() - { - } - - public byte[] getUserId() throws IOException - { - return this.getUserIdNative(); - } - - public byte[] getSubstitutePassword(byte[] cSeed, byte[] sSeed) throws IOException - { - return this.getSubstitutePasswordNative(cSeed, sSeed); - } - - private native byte[] getUserIdNative() throws IOException; - private native byte[] getSubstitutePasswordNative(byte[] cSeed, byte[] sSeed) throws IOException; -} diff --git a/cvsroot/src/com/ibm/as400/access/User.java b/cvsroot/src/com/ibm/as400/access/User.java deleted file mode 100644 index e903638c3..000000000 --- a/cvsroot/src/com/ibm/as400/access/User.java +++ /dev/null @@ -1,3483 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: User.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.Serializable; -import java.util.Date; -import java.util.Calendar; -import java.util.TimeZone; - -/** - Represents a user profile object on the system. -

      Note: User attribute information is cached internally in the User object, after the first retrieval. To force an update of the cached information, call {@link #refresh refresh()}. -

      Note: Calling any of the attribute getters for the first time (for a given User instance) will result in an implicit call to {@link #refresh refresh()}. If any exceptions are thrown by the implicit refresh(), they are logged under trace category {@link Trace#ERROR Trace.ERROR} and ignored. However, if an exception occurs during an explicit call to refresh(), it will be thrown to the caller. -

      Implementation note: This class internally calls the Retrieve User Information (QSYRUSRI) API for the methods that retrieve user profile information. In order to use those methods, the caller must have *READ authority to the user profile object. This class internally calls the Change User Profile (CHGUSRPRF) command for the methods that change user profile information. In order to use those methods, the caller must have security administrator (*SECADM) special authority, and object management (*OBJMGT) and use (*USE) authorities to the user profile being changed. - @see DirectoryEntry - @see UserList - @see UserGroup - **/ -public class User implements Serializable -{ - static final long serialVersionUID = 5L; - - // These need to be in this order so we can easily reference them from the code that parses the API return information in loadUserInformation(). - private static final String[] SPECIAL_AUTHORITIES = new String[] - { - "*ALLOBJ", - "*SECADM", - "*JOBCTL", - "*SPLCTL", - "*SAVSYS", - "*SERVICE", - "*AUDIT", - "*IOSYSCFG" - }; - - /** - Constant value representing the String "*NONE". - @see #getGroupProfileName - @see #getAttentionKeyHandlingProgram - @see #getGroupAuthority - @see #getInitialProgram - @see #getLocaleJobAttributes - @see #getLocalePathName - @see #getObjectAuditingValue - @see #getSpecialEnvironment - **/ - public static final String NONE = "*NONE"; - - /** - Constant value representing a special authority of "*ALLOBJ". - @see #getSpecialAuthority - **/ - public static final String SPECIAL_AUTHORITY_ALL_OBJECT = SPECIAL_AUTHORITIES[0]; - - /** - Constant value representing a special authority of "*AUDIT". - @see #getSpecialAuthority - **/ - public static final String SPECIAL_AUTHORITY_AUDIT = SPECIAL_AUTHORITIES[6]; - - /** - Constant value representing a special authority of "*IOSYSCFG". - @see #getSpecialAuthority - **/ - public static final String SPECIAL_AUTHORITY_IO_SYSTEM_CONFIGURATION = SPECIAL_AUTHORITIES[7]; - - /** - Constant value representing a special authority of "*JOBCTL". - @see #getSpecialAuthority - **/ - public static final String SPECIAL_AUTHORITY_JOB_CONTROL = SPECIAL_AUTHORITIES[2]; - - /** - Constant value representing a special authority of "*SAVSYS". - @see #getSpecialAuthority - **/ - public static final String SPECIAL_AUTHORITY_SAVE_SYSTEM = SPECIAL_AUTHORITIES[4]; - - /** - Constant value representing a special authority of "*SECADM". - @see #getSpecialAuthority - **/ - public static final String SPECIAL_AUTHORITY_SECURITY_ADMINISTRATOR = SPECIAL_AUTHORITIES[1]; - - /** - Constant value representing a special authority of "*SERVICE". - @see #getSpecialAuthority - **/ - public static final String SPECIAL_AUTHORITY_SERVICE = SPECIAL_AUTHORITIES[5]; - - /** - Constant value representing a special authority of "*SPLCTL". - @see #getSpecialAuthority - **/ - public static final String SPECIAL_AUTHORITY_SPOOL_CONTROL = SPECIAL_AUTHORITIES[3]; - - // Shared error code parameter. - private static final ProgramParameter ERROR_CODE = new ProgramParameter(new byte[8]); - - // The system where the user is located. - private AS400 system_ = null; - // User profile name. - private String name_ = null; - // Text description. - private String description_ = null; - // Group member indicator. - private boolean groupHasMember_ = false; - - private CommandCall chgUsrPrf_ = null; - private CommandCall chgUsrAud_ = null; - private final static boolean COMMAND_CHGUSRPRF = true; - private final static boolean COMMAND_CHGUSRAUD = false; - - // Flag that indicates that the above properties were set by UserList. - private boolean partiallyLoaded_ = false; - // Flag that indicates that all properties were set by loadUserInformation(). - private boolean loaded_ = false; - // Flag that indicates that a connection has been made and the properties are frozen. - private boolean connected_ = false; - - // List of property change event bean listeners, set on first add. - private transient PropertyChangeSupport propertyChangeListeners_ = null; - // List of vetoable change event bean listeners, set on first add. - private transient VetoableChangeSupport vetoableChangeListeners_ = null; - - // User profile name. - private String userProfileName_; - // Previous sign-on date and time. - private Date previousSignedOnDate_; - // Sign-on attempts not valid. - private int signedOnAttemptsNotValid_; - // Status. - private String status_; - // Password change date (raw from API). - private byte[] passwordLastChangedDateBytes_; - // Password change date (converted). - private Date passwordLastChangedDate_; - // No password indicator. - private boolean noPassword_; - // Password expiration interval. - private int passwordExpirationInterval_; - // Date password expires (raw from API). - private byte[] passwordExpireDateBytes_; - // Date password expires (converted). - private Date passwordExpireDate_; - // Days until password expires. - private int daysUntilPasswordExpire_; - // Set password to expire. - private boolean passwordSetExpire_; - // User class name. - private String userClassName_; - // Special authorities. - private String[] specialAuthority_; - // Group profile name. - private String groupProfileName_; - // Owner. - private String owner_; - // Group authority. - private String groupAuthority_; - // Assistance level. - private String assistanceLevel_; - // Current library name. - private String currentLibraryName_; - // Initial menu (full IFS path). - private String initialMenu_; - // Initial program name (full IFS path). - private String initialProgram_; - // Limit capabilities. - private String limitCapabilities_; - // Display sign-on information. - private String displaySignOnInformation_; - // Limit device sessions. - private String limitDeviceSessions_; - // Keyboard buffering. - private String keyboardBuffering_; - // Maximum allowed storage. - private int maximumStorageAllowed_; - // Storage used. - private int storageUsed_; - // Highest scheduling priority. - private int highestSchedulingPriority_; - // Job description (full IFS path). - private String jobDescription_; - // Accounting code. - private String accountingCode_; - // Message queue (full IFS path). - private String messageQueue_; - // Message queue delivery method. - private String messageQueueDeliveryMethod_; - // Message queue severity. - private int messageQueueSeverity_; - // Output queue (full IFS path). - private String outputQueue_; - // Print device. - private String printDevice_; - // Special environment. - private String specialEnvironment_; - // Attention-key-handling program (full IFS path). - private String attentionKeyHandlingProgram_; - // Language ID. - private String languageID_; - // Country or region ID. - private String countryID_; - // Character code set ID. - private int ccsid_; - // User options. - private String[] userOptions_; - // Sort sequence table (full IFS path). - private String sortSequenceTable_; - // Object auditing value. - private String objectAuditingValue_; - // User action audit level. - private String[] userActionAuditLevel_; - // Group authority type. - private String groupAuthorityType_; - // Supplemental groups. - private String[] supplementalGroups_; - // User ID number. - private long userID_; - // Group ID number. - private long groupID_; - // Home directory. - private String homeDirectory_; - // Locale job attributes. - private String[] localeJobAttributes_; - // Local path name. - private String localePathName_; - // Digital certificate indicator. - private boolean withDigitalCertificates_; - // Character identifier control. - private String chridControl_; - // Independent ASP name. - private String[] iaspNames_; - // Independent ASP maximum allowed storage. - private int[] iaspStorageAllowed_; - // Independent ASP Storage used. - private int[] iaspStorageUsed_; - // Local password management. - private boolean localPasswordManagement_; - // Password change block - private String pwdChangeBlock_; // @610 - // User entitlement required. - // (Note: No setter for this attribute) - private boolean userEntitlementRequired_; // @610 - // User expiration interval. - private int userExpirationInterval_; // @710 - // User expiration date (raw from API). - private byte[] userExpirationDateBytes_; // @710 - // User expiration date. - private Date userExpirationDate_; // @710 - // User expiration action. - // (Note: No setter for this attribute) - private String userExpirationAction_; // @710 - - private transient DateTimeConverter dateConverter_; - private String jobDateFormat_; - - private transient AS400Timestamp timestampConverter_; - - /** - Constructs a User object. - **/ - public User() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing User object."); - } - - /** - Constructs a User object. Note that this constructor no longer throws any of the declared exceptions, but they remain for compatibility. - @param system The system object representing the system on which the user profile exists. - @param name The user profile name. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public User(AS400 system, String name) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing User object, system: " + system + ", name: " + name); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (name == null) - { - Trace.log(Trace.ERROR, "Parameter 'name' is null."); - throw new NullPointerException("name"); - } - name = name.trim(); - if (name.length() > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'name' is not valid: '" + name + "'"); - throw new ExtendedIllegalArgumentException("name (" + name + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - // Perform simple validation of the user profile name. - // According to the help text for the CRTUSRPRF command: - // "A simple name starts with an alphabetic character followed by any of these characters: 0-9, A-Z, @, $, # and underscore (_)." - if (name.length() == 0 || !Character.isLetter(name.charAt(0))) - { - if (Trace.traceOn_) Trace.log(Trace.WARNING, "Value of parameter 'name' is not a valid user profile name: '" + name + "'"); - // Note: The Domino plugin function of Web Navigator, in some situations, creates a User object with name "*NONE", which they subsequently validate. So we just trace a warning message and continue. - } - system_ = system; - name_ = name.toUpperCase(); - } - - // Called by UserList.getUsers() and a UserGroup constructor. - User(AS400 system, String name, boolean groupHasMember, String description) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing User object, system: " + system + ", name: " + name); - system_ = system; - name_ = name; - groupHasMember_ = groupHasMember; - description_ = description; - partiallyLoaded_ = true; - } - - /** - Adds a PropertyChangeListener. The specified PropertyChangeListener's {@link java.beans.PropertyChangeListener#propertyChange propertyChange()} method will be called each time the value of any bound property is changed. - @param listener The listener. - @see #removePropertyChangeListener - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Adds a VetoableChangeListener. The specified VetoableChangeListener's {@link java.beans.VetoableChangeListener#vetoableChange vetoableChange()} method will be called each time the value of any constrained property is changed. - @param listener The listener. - @see #removeVetoableChangeListener - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - } - - /** - Determines if this user profile exists on the system. This method simply calls the CHKOBJ API and if no exception is thrown, the user profile exists; if a CPF9801 occurs then the user profile does not exist. Any other exceptions are still thrown. -

      The value returned by this method is not cached. That is, every time exists() is called, a call to the system is made to determine if the user profile still exists. - @return true if the profile exists, false if it does not. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean exists() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Determining user existence."); - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (name_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting name."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - try - { - String cmdString = "QSYS/CHKOBJ OBJ(QSYS/"+name_+") OBJTYPE(*USRPRF) AUT(*NONE)"; // not a threadsafe API prior to V5R3 - CommandCall cmd = new CommandCall(system_, cmdString); - if (!cmd.run()) - { - throw new AS400Exception(cmd.getMessageList()); - } - } - catch (AS400Exception e) - { - AS400Message[] messages = e.getAS400MessageList(); - if (messages.length == 1 && messages[0].getID().equalsIgnoreCase("CPF9801")) - { - return false; - } - throw e; - } - return true; - } - - /** - Retrieves the accounting code that is associated with this user. - @return The accounting code that is associated with this user. If the user does not have an accounting code, an empty string ("") is returned. - @see #setAccountingCode - **/ - public String getAccountingCode() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return accountingCode_; - } - - /** - Retrieves the user interface that the user will use. - @return The user interface that the user will use. Possible values are: -

        -
      • "*SYSVAL" - The system value QASTLVL determines which user interface the user is using. -
      • "*BASIC" - The Operational Assistant user interface. -
      • "*INTERMED" - The system user interface. -
      • "*ADVANCED" - The expert system user interface. -
      - **/ - public String getAssistanceLevel() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return assistanceLevel_; - } - - /** - Retrieves the attention key handling program for this user. - @return The attention key handling program for this user. Possible values are: -
        -
      • "*SYSVAL" - The system value QATNPGM determines the user's attention key handling program. -
      • {@link #NONE NONE} - No attention key handling program is used. -
      • The fully qualified integrated file system path name of the attention key handling program. -
      - @see QSYSObjectPathName - **/ - public String getAttentionKeyHandlingProgram() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return attentionKeyHandlingProgram_; - } - - /** - Retrieves the character code set ID to be used by the system for this user. - @return The character code set ID to be used by the system for this user. Possible values are: -
        -
      • -2 - The system value QCCSID is used to determine the user's character code set ID. -
      • A character code set ID. -
      - **/ - public int getCCSID() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return ccsid_; - } - - /** - Retrieves the character identifier control for the user. - @return The character identifier control for this user. Possible values are: -
        -
      • "*SYSVAL" - The system value QCHRIDCTL will be used to determine the CHRID control for this user. -
      • "*DEVD" - The *DEVD special value performs the same function as on the CHRID command parameter for display files, printer files, and panel groups. -
      • "*JOBCCSID" - The *JOBCCSID special value performs the same function as on the CHRID command parameter for display files, printer files, and panel groups. -
      - @see #setCHRIDControl - **/ - public String getCHRIDControl() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return chridControl_; - } - - /** - Retrieves the country or region ID used by the system for this user. - @return The country or region ID used by the system for this user. Possible values are: -
        -
      • "*SYSVAL" - The system value QCNTRYID is used to determine the user's country or region ID. -
      • A country or region ID. -
      - @see #setCountryID - **/ - public String getCountryID() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return countryID_; - } - - /** - Retrieves the name of the user's current library. - @return The name of the user's current library. Possible values are: -
        -
      • "*CRTDFT" - The user does not have a current library. -
      • A library name. -
      - @see #setCurrentLibraryName - **/ - public String getCurrentLibraryName() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return currentLibraryName_; - } - - /** - Retrieves the number of days until the password will expire. - @return The number of days until the password will expire. Possible values are: -
        -
      • 0 - The password is expired. -
      • 1-7 - The number of days until the password expires. -
      • -1 - The password will not expire in the next 7 days. -
      - **/ - public int getDaysUntilPasswordExpire() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return daysUntilPasswordExpire_; - } - - /** - Retrieves the descriptive text for the user profile. This value is pre-loaded into any User objects generated from a UserList object so that a call to the system is not required to retrieve this value. In the event that this User object was not constructed by a UserList, the description will need to be retrieved from the system via an implicit call to refresh(). - @return The descriptive text for the user profile. - @see #setDescription - **/ - public String getDescription() - { - if (!loaded_ && !partiallyLoaded_) loadUserInformation_SwallowExceptions(); - return description_; - } - - /** - Retrieves the system distribution directory entry for the user profile, if one exists. The directory entry is retrieved from the system every time this method is called, so its value is unaffected by any call to refresh(). - @return The directory entry, or null if none exists. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public DirectoryEntry getDirectoryEntry() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - DirectoryEntryList list = new DirectoryEntryList(system_); - list.addSelection(DirectoryEntryList.USER_PROFILE, name_.toUpperCase()); - DirectoryEntry[] entries = list.getEntries(); - if (entries.length == 0) return null; - return entries[0]; - } - - /** - Retrieves whether the sign-on information display is shown when the user signs on. - @return Whether the sign-on information display is shown when the user signs on. Possible values are: -
        -
      • "*SYSVAL" - The system value QDSPSGNINF determines if the sign-on information display is shown when the user signs on. -
      • "*YES" - The sign-on information display is shown when the user signs on. -
      • "*NO" - The sign-on information display is not shown when the user signs on. -
      - @see #setDisplaySignOnInformation - **/ - public String getDisplaySignOnInformation() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return displaySignOnInformation_; - } - - /** - Retrieves the authority the user's group profile has to objects the user creates. - @return The authority the user's group profile has to objects the user creates. Possible values are: -
        -
      • {@link #NONE NONE} - The group profile has no authority to the objects the user creates, or the user does not have a group profile. -
      • "*ALL" - The group profile has all authority to the objects the user creates. -
      • "*CHANGE" - The group profile has change authority to the objects the user creates. -
      • "*USE" - The group profile has use authority to the objects the user creates. -
      • "*EXCLUDE" - The group profile has exclude authority to the objects the user creates. -
      - @see #setGroupAuthority - **/ - public String getGroupAuthority() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return groupAuthority_; - } - - /** - Retrieves the type of authority the user's group has to objects the user creates. - @return The type of authority the user's group has to objects the user creates. Possible values are: -
        -
      • "*PRIVATE" - The group profile has a private authority to the objects the user creates, or the user does not have a group profile. -
      • "*PGP" - The group profile will be the primary group for objects the user creates. -
      - @see #setGroupAuthorityType - **/ - public String getGroupAuthorityType() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return groupAuthorityType_; - } - - /** - Retrieves the group ID number for the user profile. The group ID number is used to identify the user when it is a group and a member of the group is using the integrated file system. - @return The group ID number for the user profile. Possible values are: -
        -
      • 0 - user does not have a group ID (*NONE). -
      • A GID. -
      - @see #setGroupID(long) - @see #setGroupID(String) - **/ - public long getGroupID() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return groupID_; - } - - /** - Retrieves the group ID number for the user profile. The group ID number is used to identify the user when it is a group and a member of the group is using the integrated file system. - @return The group ID number for the user profile. Possible values are: -
        -
      • 0 - user does not have a group ID (*NONE). -
      • A GID. -
      - @deprecated This method has been replaced by {@link #getGroupID getGroupID()} which returns a long. - **/ - public int getGroupIDNumber() - { - // The original code did not account for a group ID number being an unsigned 4 byte binary bigger than Integer.MAX_VALUE. - return (int)getGroupID(); - } - - /** - Retrieves the name of the group profile. - @return The name of the group profile. Possible values are: -
        -
      • {@link #NONE NONE} - The user does not have a group profile. -
      • The group profile name. -
      - @see #setGroupProfileName - **/ - public String getGroupProfileName() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return groupProfileName_; - } - - /** - Retrieves the highest scheduling priority the user is allowed to have for each job submitted to the system. - @return The highest scheduling priority the user is allowed to have for each job submitted to the system. The priority is a value from 0 to 9, with 0 being the highest priority. - @see #setHighestSchedulingPriority - **/ - public int getHighestSchedulingPriority() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return highestSchedulingPriority_; - } - - /** - Retrieves the home directory for this user profile. The home directory is the user's initial working directory. The working directory, associated with a process, is used in path name resolution in the directory file system for path names that do not begin with a slash (/). - @return The home directory for this user profile. - @see #setHomeDirectory - **/ - public String getHomeDirectory() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return homeDirectory_; - } - - /** - Retrieves the list of independent auxiliary storage pool (IASP) names in use by this user. - @return The list of independent auxiliary storage pool (IASP) names in use by this user. If no IASP name are in use by this user, a zero length array is returned. If the system operating system is not release V5R1M0 or higher, null is returned. - @see #getIASPStorageAllowed - @see #getIASPStorageUsed - @see AS400#getVRM - @see AS400#generateVRM - **/ - public String[] getIASPNames() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return iaspNames_; - } - - /** - Retrieves the maximum amount of auxiliary storage in kilobytes that can be assigned to store permanent object owned by this user on the given independant ASP. - @return The maximum amount of auxiliary storage in kilobytes that can be assigned to store permanent object owned by this user on the given independant ASP. If the user does not have a maximum amount of allowed storage on the given independent ASP, -1 for *NOMAX is returned. If the system operating system is not release V5R1M0 or higher, or if the given IASP name is not listed for this user, -2 is returned. - @see #getIASPNames - @see #getIASPStorageUsed - **/ - public int getIASPStorageAllowed(String iaspName) - { - if (iaspName == null) - { - Trace.log(Trace.ERROR, "Parameter 'iaspName' is null."); - throw new NullPointerException("iaspName"); - } - if (!loaded_) loadUserInformation_SwallowExceptions(); - if (iaspStorageAllowed_ == null) return -2; - for (int i = 0; i < iaspNames_.length; ++i) - { - if (iaspNames_[i].equals(iaspName)) - { - return iaspStorageAllowed_[i]; - } - } - return -2; - } - - /** - Retrieves the amount of auxiliary storage in kilobytes occupied by this user's owned objects on the given independent ASP. - @return The amount of auxiliary storage in kilobytes occupied by this user's owned objects on the given independent ASP. If the system operating system is not release V5R1M0 or higher, or if the given IASP name is not listed for this user, -2 is returned. - @see #getIASPNames - @see #getIASPStorageAllowed - **/ - public int getIASPStorageUsed(String iaspName) - { - if (iaspName == null) - { - Trace.log(Trace.ERROR, "Parameter 'iaspName' is null."); - throw new NullPointerException("iaspName"); - } - if (!loaded_) loadUserInformation_SwallowExceptions(); - if (iaspStorageUsed_ == null) return -2; - for (int i = 0; i < iaspNames_.length; ++i) - { - if (iaspNames_[i].equals(iaspName)) - { - return iaspStorageUsed_[i]; - } - } - return -2; - } - - /** - Retrieves the initial menu for the user. - @return The initial menu for the user. Possible values are: -
        -
      • "*SIGNOFF" - The user is limited to running the initial program specified in this profile. -
      • The fully qualified integrated file system path name of the initial menu name. -
      - @see QSYSObjectPathName - @see #setInitialMenu - **/ - public String getInitialMenu() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return initialMenu_; - } - - /** - Retrieves the initial program for the user. - @return The initial program for the user. Possible values are: -
        -
      • {@link #NONE NONE} - The user does not have an initial program. -
      • The fully qualified integrated file system path name of the initial program name. -
      - @see QSYSObjectPathName - @see #setInitialProgram - **/ - public String getInitialProgram() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return initialProgram_; - } - - /** - Retrieves the fully qualified integrated file system path name of the job description used for jobs that start through subsystem work station entries. - @return The fully qualified integrated file system path name of the job description used for jobs that start through subsystem work station entries. - @see QSYSObjectPathName - @see #setJobDescription - **/ - public String getJobDescription() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return jobDescription_; - } - - /** - Retrieves the keyboard buffering value that is used when a job is initialized for this user. - @return The keyboard buffering value that is used when a job is initialized for this user. Possible values are: -
        -
      • "*SYSVAL" - The system value QKBDBUF determines the keyboard buffering value for this user. -
      • "*YES" - The type-ahead and attention-key buffering options are both on. -
      • "*NO" - The type-ahead and attention-key buffering options are not on. -
      • "*TYPEAHEAD" - The type-ahead option is on, but the attention-key buffering option is not. -
      - @see #setKeyboardBuffering - **/ - public String getKeyboardBuffering() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return keyboardBuffering_; - } - - /** - Retrieves the language ID used by the system for this user. - @return The language ID used by the system for this user. Possible values are: -
        -
      • "*SYSVAL" - The system value QLANGID will be used to determine the language ID. -
      • The language ID. -
      - @see #setLanguageID - **/ - public String getLanguageID() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return languageID_; - } - - /** - Retrieves whether the user has limited capabilites. - @return Whether the user has limited capabilites. Possible values are: -
        -
      • "*PARTIAL" - The user cannot change the initial program or current library. -
      • "*YES" - The user cannot change the initial menu, initial program, or current library. The user cannot run commands from the command line. -
      • "*NO" - The user is not limited. -
      - @see #setLimitCapabilities - **/ - public String getLimitCapabilities() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return limitCapabilities_; - } - - /** - Retrieves whether the user is limited to one device session. - Note: Values "0-9" are only valid when running to IBM i 6.1 or higher. - @return Whether the user is limited to one device session. Possible values are: -
        -
      • "*SYSVAL" - The system value QLMTDEVSSN determines if the user is limited to one device session. -
      • "*YES" - The user is limited to one session. -
      • "*NO" - The user is not limited to one device session. -
      • "0" - The user is not limited to a specific number of device session. The value has the same meaning as *NO. -
      • "1" - The user is limited to a single device session. The value has the same meaning as *YES. -
      • "2-9" - The user is limited to the specified number of device sessions. -
      - @see #setLimitDeviceSessions - **/ - public String getLimitDeviceSessions() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return limitDeviceSessions_; - } - - /** - Retrieves a list of the job attributes which are set from the user's locale path name. - @return A list of the job attributes which are set from the user's locale path name. Possible values for the elements of this array are: -
        -
      • {@link #NONE NONE} - No job attributes are used from the locale path name at the time a job is started for this user profile. -
      • "*SYSVAL" - The job attributes assigned from the locale path name are determined by the system value QSETJOBATR at the time a job is started for this user profile. -
      • "*CCSID" - The coded character set identifier is set from the locale path name at the time a job is started for this user profile. -
      • "*DATFMT" - The date format is set from the locale path name at the time a job is started for this user profile. -
      • "*DATSEP" - The date separator is set from the locale path name at the time a job is started for this user profile. -
      • "*SRTSEQ" - The sort sequence is set from the locale path name at the time a job is started for this user profile. -
      • "*TIMSEP" - The time separator is set from the locale path name at the time a job is started for this user profile. -
      • "*DECFMT" - The decimal format is set from the locale path name at the time a job is started for this user profile. -
      - @see #setLocaleJobAttributes - **/ - public String[] getLocaleJobAttributes() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return localeJobAttributes_; - } - - private static final String[] LOCALE_ATTRIBUTES = new String[] - { - NONE, - "*SYSVAL", - "*CCSID", - "*DATFMT", - "*DATSEP", - "*SRTSEQ", - "*TIMSEP", - "*DECFMT" - }; - - /** - Retrieves the locale path name that is assigned to the user profile when a job is started. - @return The locale path name that is assigned to the user profile when a job is started. Possible values are: -
        -
      • "*C" - The C locale path name is assigned. -
      • {@link #NONE NONE} - No locale path name is assigned. -
      • "*POSIX" - The POSIX locale path name is assigned. -
      • "*SYSVAL" - The QLOCALE system value is used to determine the locale path name. -
      • A locale path name. -
      - @see #setLocalePathName - **/ - public String getLocalePathName() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return localePathName_; - } - - /** - Retrieves the maximum amount of auxiliary storage (in kilobytes) that can be assigned to store permanant objects owned by the user. - @return The maximum amount of auxiliary storage (in kilobytes) that can be assigned to store permanant objects owned by the user. Possible values are: -
        -
      • -1 - The user does not have a maximum amount of allowed storage (*NOMAX). -
      • The maximum amount of auxiliary storage (in kilobytes). -
      - @see #setMaximumStorageAllowed(int) - @see #setMaximumStorageAllowed(String) - **/ - public int getMaximumStorageAllowed() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return maximumStorageAllowed_; - } - - /** - Retrieves the fully qualified integrated file system path name of the message queue that is used by this user. - @return The fully qualified integrated file system path name of the message queue that is used by this user. - @see QSYSObjectPathName - @see #setMessageQueue - **/ - public String getMessageQueue() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return messageQueue_; - } - - /** - Retrieves how the messages are delivered to the message queue used by the user. - @return How the messages are delivered to the message queue used by the user. Possible values are: -
        -
      • "*BREAK" - The job to which the message queue is assigned is interrupted when a message arrives on the message queue. -
      • "*DFT" - Messages requiring replies are answered with their default reply. -
      • "*HOLD" - The messages are held in the message queue until they are requested by the user or program. -
      • "*NOTIFY" - The job to which the message queue is assigned is notified when a message arrives on the message queue. -
      - @see #setMessageQueueDeliveryMethod - **/ - public String getMessageQueueDeliveryMethod() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return messageQueueDeliveryMethod_; - } - - /** - Retrieves the lowest severity that a message can have and still be delivered to a user in break or notify mode. - @return The lowest severity that a message can have and still be delivered to a user in break or notify mode. The severity is a value in the range 0 through 99. - @see #setMessageQueueSeverity - **/ - public int getMessageQueueSeverity() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return messageQueueSeverity_; - } - - /** - Returns the user profile name. - @return The user profile name. - @see #setName - **/ - public String getName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting name: " + name_); - return name_; - } - - /** - Retrieves the user's object auditing value. - @return The user's object auditing value. Possible values are: -
        -
      • {@link #NONE NONE} - No additional object auditing is done for the user. -
      • "*CHANGE" - Object changes are audited for the user if the object's auditing value is *USRPRF. -
      • "*ALL" - Object read and change operations are audited for the user if the object's auditing value is *USRPRF. -
      - @see #setObjectAuditingValue - **/ - public String getObjectAuditingValue() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return objectAuditingValue_; - } - - /** - Return an object representing the objects that this user owns. - @return UserObjectsOwnedList object constructed with default selection criteria. - **/ - public UserObjectsOwnedList getObjectsOwned() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loading user information."); - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (name_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting name."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - return (new UserObjectsOwnedList(system_, name_)); - } - - - /** - Retrieves the output queue used by this user. - @return The output queue used by this user. Possible values are: -
        -
      • "*WRKSTN" - The output queue assigned to the user's work station is used. -
      • "*DEV" - An output queue with the same name as the device specified in the printer device parameter is used. -
      • The fully qualified integrated file system path name of the output queue. -
      - @see QSYSObjectPathName - @see #setOutputQueue - **/ - public String getOutputQueue() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return outputQueue_; - } - - /** - Retrieves who is to own objects created by this user. - @return Who is to own objects created by this user. Possible values are: -
        -
      • "*USRPRF" - The user owns any objects the user creates. If the user does not have a group profile, the field contains this value. -
      • "*GRPPRF" - The user's group profile owns any objects the user creates. -
      - @see #setOwner - **/ - public String getOwner() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return owner_; - } - - /** - Retrieves the date the user's password expires. - @return The date the user's password expires. Possible values are: -
        -
      • A date object containing the date the user's password expires. -
      • null - The user's password will not expire (password expiration interval of *NOMAX) or the user's password is set to expired. -
      - **/ - public Date getPasswordExpireDate() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - if (passwordExpireDate_ == null) - { - try - { - // First see if a blank value was returned. - if (isNullOrBlanks(passwordExpireDateBytes_)) return null; - - AS400Timestamp conv = getTimestampConverter(FORMAT_DTS); // field is in *DTS format - passwordExpireDate_ = conv.toDate(conv.toTimestamp(passwordExpireDateBytes_), system_.getTimeZone()); - } - catch (Exception e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Exception while converting datePasswordExpires:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - } - return passwordExpireDate_; - } - - - private static final int FORMAT_DTS = AS400Timestamp.FORMAT_DTS; // *DTS format - private synchronized AS400Timestamp getTimestampConverter(int format) - { - if (timestampConverter_ == null) { - timestampConverter_ = new AS400Timestamp(); - timestampConverter_.setFormat(format); - } - else if (format != timestampConverter_.getFormat()) { - timestampConverter_.setFormat(format); - } - return timestampConverter_; - } - - - // @610 - /** - * Retrieves the time period during which a password is blocked from being changed - * following the prior successful password change operation. - *

      Note: This method should not be used when running to IBM i 5.4 or earlier releases. - * @return The time period during which a password is blocked from being changed. Possible values are: - *

        - *
      • "*SYSVAL" - The system value QPWDCHGBLK is used to determine the block password change value.
      • - *
      • {@link #NONE NONE} - The password can be changed at any time.
      • - *
      • 1-99 - Indicates the number of hours a user must wait after the prior successful password change operation - * before they are able to change the password again.
      • - *
      - * @see #setPasswordChangeBlock - */ - public String getPasswordChangeBlock() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return pwdChangeBlock_; - } - - /** - Retrieves the number of days the user's password can remain active before it must be changed. - @return The number of days the user's password can remain active before it must be changed. Possible values are: -
        -
      • 0 - The system value QPWDEXPITV is used to determine the user's password expiration interval. -
      • -1 - The user's password does not expire (*NOMAX). -
      • 1-366 - The number of days the user's password can remain active before it must be changed. -
      - @see #setPasswordExpirationInterval(int) - @see #setPasswordExpirationInterval(String) - **/ - public int getPasswordExpirationInterval() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return passwordExpirationInterval_; - } - - /** - Retrieves the date the user's password was last changed. - @return The date the user's password was last changed. - **/ - public Date getPasswordLastChangedDate() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - if (passwordLastChangedDate_ == null) - { - try - { - // First see if a blank value was returned. If so, return null. - if (isNullOrBlanks(passwordLastChangedDateBytes_)) return null; - - AS400Timestamp conv = getTimestampConverter(FORMAT_DTS); // field is in *DTS format - passwordLastChangedDate_ = conv.toDate(conv.toTimestamp(passwordLastChangedDateBytes_), system_.getTimeZone()); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Exception while converting passwordLastChangedDate:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - } - return passwordLastChangedDate_; - } - - /** - Retrieves the date and time the user last signed on. - @return The date and time the user last signed on. Possible values are: -
        -
      • A date object containing the date and time the user last signed on. -
      • null - The user has never signed on the system. -
      - **/ - public Date getPreviousSignedOnDate() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return previousSignedOnDate_; - } - - /** - Retrieves the printer used to print for this user. - @return The printer used to print for this user. Possible values are: -
        -
      • "*WRKSTN" - The printer assigned to the user's work station is used. -
      • "*SYSVAL" - The default system printer specified in the system value QPRTDEV is used. -
      • The print device. -
      - @see #setPrintDevice - **/ - public String getPrintDevice() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return printDevice_; - } - - /** - Retrieves the number of sign-on attempts that were not valid since the last successful sign-on. - @return The number of sign-on attempts that were not valid since the last successful sign-on. - **/ - public int getSignedOnAttemptsNotValid() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return signedOnAttemptsNotValid_; - } - - /** - Retrieves the name of the sort sequence table used for string comparisons. - @return The name of the sort sequence table used for string comparisons. Possible values are: -
        -
      • "*HEX" - The hexadecimal values of the characters are used to determine the sort sequence. -
      • "*LANGIDUNQ" - A unique-weight sort table associated with the language specified. -
      • "*LANGIDSHR" - A shared-weight sort table associated with the language specified. -
      • "*SYSVAL" - The system value QSRTSEQ. -
      • The fully qualified integrated file system path name of the sort sequence table name. -
      - @see QSYSObjectPathName - @see #setSortSequenceTable - **/ - public String getSortSequenceTable() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return sortSequenceTable_; - } - - /** - Retrieves a list of the special authorities the user has. - @return A list of the special authorities the user has. If the user has no special authorities, an empty array is returned. Possible values for the elements of this array are: -
        -
      • {@link #SPECIAL_AUTHORITY_ALL_OBJECT SPECIAL_AUTHORITY_ALL_OBJECT} - All object. -
      • {@link #SPECIAL_AUTHORITY_SECURITY_ADMINISTRATOR SPECIAL_AUTHORITY_SECURITY_ADMINISTRATOR} - Security administrator. -
      • {@link #SPECIAL_AUTHORITY_JOB_CONTROL SPECIAL_AUTHORITY_JOB_CONTROL} - Job control. -
      • {@link #SPECIAL_AUTHORITY_SPOOL_CONTROL SPECIAL_AUTHORITY_SPOOL_CONTROL} - Spool control. -
      • {@link #SPECIAL_AUTHORITY_SAVE_SYSTEM SPECIAL_AUTHORITY_SAVE_SYSTEM} - Save system. -
      • {@link #SPECIAL_AUTHORITY_SERVICE SPECIAL_AUTHORITY_SERVICE} - Service. -
      • {@link #SPECIAL_AUTHORITY_AUDIT SPECIAL_AUTHORITY_AUDIT} - Audit. -
      • {@link #SPECIAL_AUTHORITY_IO_SYSTEM_CONFIGURATION SPECIAL_AUTHORITY_IO_SYSTEM_CONFIGURATION} - Input/output system configuration. -
      - @see #hasSpecialAuthority - @see #setSpecialAuthority - **/ - public String[] getSpecialAuthority() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return specialAuthority_; - } - - /** - Retrieves the special environment the user operates in after signing on. - @return The special environment the user operates in after signing on. Possible values are: -
        -
      • "*SYSVAL" - The system value QSPCENV is used to determine the user's special environment. -
      • {@link #NONE NONE} - The user operates in the IBM i system environment. -
      • "*S36" - The user operates in the System/36 environment. -
      - @see #setSpecialEnvironment - **/ - public String getSpecialEnvironment() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return specialEnvironment_; - } - - /** - Retrieves the status of the user profile. - @return The status of the user profile. Possible values are: -
        -
      • "*ENABLED" - The user profile is enabled; therefor, the user is able to sign on. -
      • "*DISABLED" - The user profile is not enabled; therefor, the user cannot sign on. -
      - @see #setStatus - **/ - public String getStatus() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return status_; - } - - /** - Retrieves the amount of auxiliary storage (in kilobytes) occupied by this user's owned objects. - @return The amount of auxiliary storage (in kilobytes) occupied by this user's owned objects. - **/ - public int getStorageUsed() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return storageUsed_; - } - - /** - Retrieves the supplemental groups for the user profile. - @return The array of supplemental groups for the user profile, or an array of length 0 if there are no supplemental groups. - @see #setSupplementalGroups - **/ - public String[] getSupplementalGroups() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return supplementalGroups_; - } - - /** - Retrieves the number of supplemental groups for the user profile. -

      This method simply returns getSupplementalGroups().length. - @return The number of supplemental groups for the user profile. - @see #getSupplementalGroups - **/ - public int getSupplementalGroupsNumber() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return supplementalGroups_ == null ? 0 : supplementalGroups_.length; - } - - /** - Returns the system object representing the system on which the user profile exists. - @return The system object representing the system on which the user profile exists. If the system has not been set, null is returned. - @see #setSystem - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - - /** - Retrieves a list of action audit levels for the user. - @return A list of action audit levels for the user. Possible values for the elements of this array are: -

        -
      • "*CMD" - The user has the *CMD audit value specified in the user profile. -
      • "*CREATE" - The user has the *CREATE audit value specified in the user profile. -
      • "*DELETE" - The user has the *DELETE audit value specified in the user profile. -
      • "*JOBDTA" - The user has the *JOBDTA audit value specified in the user profile. -
      • "*OBJMGT" - The user has the *OBJMGT audit value specified in the user profile. -
      • "*OFCSRV" - The user has the *OFCSRV audit value specified in the user profile. -
      • "*OPTICAL" - The user has the *OPTICAL audit value specified in the user profile. -
      • "*PGMADP" - The user has the *PGMADP audit value specified in the user profile. -
      • "*SAVRST" - The user has the *SAVRST audit value specified in the user profile. -
      • "*SECURITY" - The user has the *SECURITY audit value specified in the user profile. -
      • "*SERVICE" - The user has the *SERVICE audit value specified in the user profile. -
      • "*SPLFDTA" - The user has the *SPLFDTA audit value specified in the user profile. -
      • "*SYSMGT" - The user has the *SYSMGT audit value specified in the user profile. -
      - @see #setUserActionAuditLevel - **/ - public String[] getUserActionAuditLevel() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return userActionAuditLevel_; - } - - private static final String[] AUDIT_LEVELS = new String[] - { - "*CMD", - "*CREATE", - "*DELETE", - "*JOBDTA", - "*OBJMGT", - "*OFCSRV", - "*PGMADP", - "*SAVRST", - "*SECURITY", - "*SERVICE", - "*SPLFDTA", - "*SYSMGT", - "*OPTICAL" // The API shows optical in the middle of the list, but observed behavior is otherwise (at least on V4R3). - }; - - /** - Retrieves the user class name. - @return The user class name. Possible values are: -
        -
      • "*SECOFR" - The user has a class of security officer. -
      • "*SECADM" - The user has a class of security administrator. -
      • "*PGMR" - The user has a class of programmer. -
      • "*SYSOPR" - The user has a class of system operator. -
      • "*USER" - The user has a class of end user. -
      - @see #setUserClassName - **/ - public String getUserClassName() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return userClassName_; - } - - - /** - Retrieves the action that will occur when the user profile has expired. -

      Note: This method should not be used when running to IBM i 6.1 or earlier releases. - @return The action that will occur when the user profile has expired. - Possible values include: -

        -
      • {@link #NONE NONE} - The user profile will not expire. -
      • "*DISABLE" - The user profile will be disabled. -
      • "*DELETE" - The user profile will be deleted. If the user profile cannot be deleted, it will be disabled. -
      - **/ - public String getUserExpirationAction() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return userExpirationAction_; - } - - - /** - Retrieves the date when the user profile expires and is automatically disabled. -

      Note: This method should not be used when running to IBM i 6.1 or earlier releases. - @return The date when the user profile expires. - null is returned if the user profile does not have an expiration date. - @see #setUserExpirationDate - **/ - public Date getUserExpirationDate() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - if (userExpirationDate_ == null) - { - try - { - // First see if a blank value was returned. If so, return null. - if (isNullOrBlanks(userExpirationDateBytes_)) return null; - - AS400Timestamp conv = getTimestampConverter(FORMAT_DTS); // field is in *DTS format - userExpirationDate_ = conv.toDate(conv.toTimestamp(userExpirationDateBytes_), system_.getTimeZone()); - } - catch (Exception e) - { - if (Trace.traceOn_) Trace.log(Trace.ERROR, "Exception while converting userExpirationDate:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - } - return userExpirationDate_; - } - - // Returns true if the specified byte array is either null or a sequence of EBCDIC blanks (x40). Returns false if any character other than EBCDIC blank is encountered. - private static final boolean isNullOrBlanks(byte[] bytes) - { - if (bytes == null) return true; - for (int i=0; iNote: This method should not be used when running to IBM i 6.1 or earlier releases. - @return The number of days until the user profile expires, starting from when the profile was created or last re-enabled. 0 is returned if the user profile does not have a user expiration interval. - @see #setUserExpirationInterval - **/ - public int getUserExpirationInterval() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return userExpirationInterval_; - } - - /** - Retrieves the user ID (UID) number for the user profile. The UID is used to identify the user when using the integrated file system. - @return The user ID (UID) number for the user profile. - @see #setUserID - **/ - public long getUserID() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return userID_; - } - - /** - Retrieves the user ID (UID) number for the user profile. The UID is used to identify the user when using the integrated file system. - @return The user ID (UID) number for the user profile. - @deprecated This method has been replaced by {@link #getUserID getUserID()} which returns a long. - **/ - public int getUserIDNumber() - { - return (int)getUserID(); - } - - /** - Retrieves a list of options for users to customize their environment. - @return The list of options for users to customize their environment. Possible values include: -

        -
      • "*CLKWD" - The keywords are shown when a CL command is displayed. -
      • "*EXPERT" - More detailed information is shown when the user is defining or changing the system using edit or display object authority. This is independent of the ASTLVL parameter that is available on the user profile and other commands. -
      • "*HLPFULL" - UIM online help is to be displayed full screen instead of in a window. -
      • "*STSMSG" - Status messages sent to the user are shown. -
      • "*NOSTSMSG" - Status messages sent to the user are not shown. -
      • "*ROLLKEY" - The opposite action from the system default for roll keys is taken. -
      • "*PRTMSG" - A message is sent to the user when a spooled file is printed. -
      - @see #setUserOptions - **/ - public String[] getUserOptions() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return userOptions_; - } - - private static final String[] USER_OPTIONS = new String[] - { - "*CLKWD", - "*EXPERT", - "*HLPFULL", - "*STSMSG", - "*NOSTSMSG", - "*ROLLKEY", - "*PRTMSG" - }; - - /** - Retrieves the name of the user profile for which the information is returned. Note this is the name that is returned by the system, not the name that was set into this User object by the constructor or by a call to setUser(). - @return The name of the user profile for which the information is returned. - **/ - public String getUserProfileName() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return userProfileName_; - } - - /** - Retrieves if this user profile has been granted the specified authority, or belongs to a group profile that has been granted the specified authority. - @param authority The authority to check. It must be one of the following special authority values: -
        -
      • *ALLOBJ - All object. -
      • *SECADM - Security administrator. -
      • *JOBCTL - Job control. -
      • *SPLCTL - Spool control. -
      • *SAVSYS - Save system. -
      • *SERVICE - Service. -
      • *AUDIT - Audit. -
      • *IOSYSCFG - Input/output system configuration. -
      - @return true if this user has the authority or belongs to a group that has the authority; false if it does not have authority or an error occurs. - @see #getSpecialAuthority - @see #setSpecialAuthority - **/ - public boolean hasSpecialAuthority(String authority) - { - if (authority == null) - { - Trace.log(Trace.ERROR, "Parameter 'authority' is null."); - throw new NullPointerException("authority"); - } - - // Check to see if this user is authorized. - String[] specialAuthorities = getSpecialAuthority(); - if (specialAuthorities != null) - { - for (int i = 0; i < specialAuthorities.length; ++i) - { - if (specialAuthorities[i].equals(authority)) - { - return true; - } - } - } - - // Check to see if a group this user belongs to is authorized. - String primaryGroup = getGroupProfileName(); - if (primaryGroup != null && !primaryGroup.equals(NONE)) - { - try - { - User group = new User(system_, primaryGroup); - if (group.hasSpecialAuthority(authority)) - { - return true; - } - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Unexpected Exception constructing User object:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - } - // Check the supplemental groups. - String[] supplementalGroups = getSupplementalGroups(); - if (supplementalGroups != null) - { - for (int i = 0; i < supplementalGroups.length; ++i) - { - try - { - User group = new User(system_, supplementalGroups[i]); - if (group.hasSpecialAuthority(authority)) - { - return true; - } - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Unexpected Exception constructing User object:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - } - } - // Not authorized. - return false; - } - - /** - Retrieves whether this user is a group that has members. -

      For User objects, this should always return false. For UserGroup objects, this should return true if the group profile has members. - @return true if the user is a group that has members, false otherwise. - @see UserGroup - **/ - public boolean isGroupHasMember() - { - if (!loaded_ && !partiallyLoaded_) loadUserInformation_SwallowExceptions(); - return groupHasMember_; - } - - /** - Retrieves whether the password is managed locally. - @return true if the password is managed locally, false otherwise. - @see #setLocalPasswordManagement - **/ - public boolean isLocalPasswordManagement() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return localPasswordManagement_; - } - - /** - Retrieves whether *NONE is specified for the password in the user profile. - @return true if *NONE is specified for the password in the user profile, false otherwise. - **/ - public boolean isNoPassword() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return noPassword_; - } - - /** - Retrieves whether the user's password is set to expired, requiring the user to change the password when signing on. - @return true if the password is set to expired, false otherwise. - @see #setPasswordSetExpire - **/ - public boolean isPasswordSetExpire() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return passwordSetExpire_; - } - - - /** - Retrieves whether a user entitlement is required for this user profile. This property should be ignored on systems that do not have feature 5052 installed. - Note: This method is valid only when running to IBM i 6.1 or higher. - @return true if a user entitlement is required for this user profile; false otherwise. - **/ - public boolean isUserEntitlementRequired() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return userEntitlementRequired_; - } - - /** - Retrieves whether there are digital certificates associated with this user. - @return true if there are digital certificates associated with this user; false otherwise. - **/ - public boolean isWithDigitalCertificates() - { - if (!loaded_) loadUserInformation_SwallowExceptions(); - return withDigitalCertificates_; - } - - // Helper method... calls loadUserInformation and swallows all exceptions so that all of the getters can call it. - private void loadUserInformation_SwallowExceptions() - { - try - { - loadUserInformation(); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Exception swallowed during retrieval of user information:", e); - } - } - - /** - Refreshes the values for all attributes. -
      Same as {@link #refresh refresh()}. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void loadUserInformation() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loading user information."); - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (name_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting name."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - Converter conv = new Converter(system_.getCcsid(), system_); - byte[] userProfileName = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - conv.stringToByteArray(name_, userProfileName); - int receiverVariableLength = 1024; - - ProgramParameter[] parameters = new ProgramParameter[] - { - // Receiver variable, output, char(*). - new ProgramParameter(receiverVariableLength), - // Receiver variable length, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(receiverVariableLength)), - // Format name, input, char(8), EBCDIC 'USRI0300'. - new ProgramParameter(new byte[] { (byte)0xE4, (byte)0xE2, (byte)0xD9, (byte)0xC9, (byte)0xF0, (byte)0xF3, (byte)0xF0, (byte)0xF0 } ), - // User profile name, input, char(10). - new ProgramParameter(userProfileName), - // Error code, I/O, char(*). - ERROR_CODE - }; - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QSYRUSRI.PGM", parameters); - // Note: QSYRUSRI is designated "Threadsafe: Yes". - // But honor the ProgramCall.threadsafe property if set. - pc.suggestThreadsafe(); - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - - byte[] data = parameters[0].getOutputData(); - - int bytesReturned = BinaryConverter.byteArrayToInt(data, 0); - int bytesAvailable = BinaryConverter.byteArrayToInt(data, 4); - if (bytesReturned < bytesAvailable) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieve user information receiver variable too small, bytes returned: " + bytesReturned + ", bytes available: " + bytesAvailable); - receiverVariableLength = bytesAvailable; - try - { - parameters[0].setOutputDataLength(receiverVariableLength); - parameters[1].setInputData(BinaryConverter.intToByteArray(receiverVariableLength)); - } - catch (PropertyVetoException e) - { - Trace.log(Trace.ERROR, "Unexpected PropertyVetoException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION, e.getMessage()); - } - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - data = parameters[0].getOutputData(); - } - - userProfileName_ = conv.byteArrayToString(data, 8, 10).trim(); - - // Previous sign-on is in format: "CYYMMDDHHMMSS". - String previousSignon = conv.byteArrayToString(data, 18, 13); // Note: This time value is relative to the system's local time zone, not UTC. - if (previousSignon.trim().length() > 0) - { - Calendar cal = Calendar.getInstance(); - cal.clear(); - cal.set(Calendar.YEAR, 1900 + Integer.parseInt(previousSignon.substring(0, 3))); - cal.set(Calendar.MONTH, Integer.parseInt(previousSignon.substring(3, 5)) - 1); - cal.set(Calendar.DATE, Integer.parseInt(previousSignon.substring(5, 7))); - cal.set(Calendar.HOUR, Integer.parseInt(previousSignon.substring(7, 9))); - cal.set(Calendar.MINUTE, Integer.parseInt(previousSignon.substring(9, 11))); - cal.set(Calendar.SECOND, Integer.parseInt(previousSignon.substring(11, 13))); - // Set the correct time zone (in case client is in a different zone than server). - cal.setTimeZone(system_.getTimeZone()); - previousSignedOnDate_ = cal.getTime(); - } - else - { - previousSignedOnDate_ = null; - } - - signedOnAttemptsNotValid_ = BinaryConverter.byteArrayToInt(data, 32); - status_ = conv.byteArrayToString(data, 36, 10).trim(); - - if (passwordLastChangedDateBytes_ == null) passwordLastChangedDateBytes_ = new byte[8]; - // *DTS format - convert on getter. - System.arraycopy(data, 46, passwordLastChangedDateBytes_, 0, 8); - passwordLastChangedDate_ = null; // Reset. - - // EBCDIC 'Y' for no password. - noPassword_ = (data[54] == (byte)0xE8); - // 1-366. 0 means use system value QPWDEXPITV. -1 means *NOMAX. - passwordExpirationInterval_ = BinaryConverter.byteArrayToInt(data, 56); - - if (passwordExpireDateBytes_ == null) passwordExpireDateBytes_ = new byte[8]; - // *DTS format. - System.arraycopy(data, 60, passwordExpireDateBytes_, 0, 8); - passwordExpireDate_ = null; // Reset. - - daysUntilPasswordExpire_ = BinaryConverter.byteArrayToInt(data, 68); - // EBCDIC 'Y' if the user's password is set to expired. - passwordSetExpire_ = (data[72] == (byte)0xE8); - userClassName_ = conv.byteArrayToString(data, 73, 10).trim(); - - int numSpecAuth = 0; - for (int i = 0; i < 8; ++i) - { - if (data[83 + i] == (byte)0xE8) // EBCDIC 'Y' is 0xE8. - { - ++numSpecAuth; - } - } - specialAuthority_ = new String[numSpecAuth]; - int counter = 0; - for (int i = 0; i < 8; ++i) - { - if (data[83 + i] == (byte)0xE8) // EBCDIC 'Y' is 0xE8. - { - specialAuthority_[counter++] = SPECIAL_AUTHORITIES[i]; - } - } - - groupProfileName_ = conv.byteArrayToString(data, 98, 10).trim(); - owner_ = conv.byteArrayToString(data, 108, 10).trim(); - groupAuthority_ = conv.byteArrayToString(data, 118, 10).trim(); - assistanceLevel_ = conv.byteArrayToString(data, 128, 10).trim(); - currentLibraryName_ = conv.byteArrayToString(data, 138, 10).trim(); - - String menu = conv.byteArrayToString(data, 148, 10).trim(); - initialMenu_ = menu.equals("*SIGNOFF") ? menu : QSYSObjectPathName.toPath(conv.byteArrayToString(data, 158, 10).trim(), menu, "MNU"); - - String prog = conv.byteArrayToString(data, 168, 10).trim(); - initialProgram_ = prog.equals(NONE) ? NONE : QSYSObjectPathName.toPath(conv.byteArrayToString(data, 178, 10).trim(), prog, "PGM"); - - limitCapabilities_ = conv.byteArrayToString(data, 188, 10).trim(); - description_ = conv.byteArrayToString(data, 198, 50).trim(); - displaySignOnInformation_ = conv.byteArrayToString(data, 248, 10).trim(); - limitDeviceSessions_ = conv.byteArrayToString(data, 258, 10).trim(); - keyboardBuffering_ = conv.byteArrayToString(data, 268, 10).trim(); - maximumStorageAllowed_ = BinaryConverter.byteArrayToInt(data, 280); - storageUsed_ = BinaryConverter.byteArrayToInt(data, 284); - highestSchedulingPriority_ = data[288] & 0x0000000F; - jobDescription_ = QSYSObjectPathName.toPath(conv.byteArrayToString(data, 299, 10).trim(), conv.byteArrayToString(data, 289, 10).trim(), "JOBD"); - accountingCode_ = conv.byteArrayToString(data, 309, 15).trim(); - messageQueue_ = QSYSObjectPathName.toPath(conv.byteArrayToString(data, 334, 10).trim(), conv.byteArrayToString(data, 324, 10).trim(), "MSGQ"); - messageQueueDeliveryMethod_ = conv.byteArrayToString(data, 344, 10).trim(); - messageQueueSeverity_ = BinaryConverter.byteArrayToInt(data, 356); - - String outQueueName = conv.byteArrayToString(data, 360, 10).trim(); - outputQueue_ = outQueueName.equals("*WRKSTN") || outQueueName.equals("*DEV") ? outQueueName : QSYSObjectPathName.toPath(conv.byteArrayToString(data, 370, 10).trim(), outQueueName, "OUTQ"); - - printDevice_ = conv.byteArrayToString(data, 380, 10).trim(); - specialEnvironment_ = conv.byteArrayToString(data, 390, 10).trim(); - - String keyName = conv.byteArrayToString(data, 400, 10).trim(); - attentionKeyHandlingProgram_ = keyName.equals(NONE) || keyName.equals("*SYSVAL") ? keyName : QSYSObjectPathName.toPath(conv.byteArrayToString(data, 410, 10).trim(), keyName, "PGM"); - - languageID_ = conv.byteArrayToString(data, 420, 10).trim(); - countryID_ = conv.byteArrayToString(data, 430, 10).trim(); - ccsid_ = BinaryConverter.byteArrayToInt(data, 440); - - int numUserOptions = 0; - for (int i = 0; i < 7; ++i) - { - if (data[444 + i] == (byte)0xE8) // EBCDIC 'Y' is 0xE8. - { - ++numUserOptions; - } - } - userOptions_ = new String[numUserOptions]; - counter = 0; - for (int i = 0; i < 7; ++i) - { - if (data[444 + i] == (byte)0xE8) // EBCDIC 'Y' is 0xE8. - { - userOptions_[counter++] = USER_OPTIONS[i]; - } - } - - String sortName = conv.byteArrayToString(data, 480, 10).trim(); - sortSequenceTable_ = sortName.equals("*HEX") || sortName.equals("*LANGIDUNQ") || sortName.equals("*LANGIDSHR") || sortName.equals("*SYSVAL") || sortName.length() == 0 ? sortName : QSYSObjectPathName.toPath(conv.byteArrayToString(data, 490, 10).trim(), sortName, "FILE"); - - objectAuditingValue_ = conv.byteArrayToString(data, 500, 10).trim(); - - int numAudLevel = 0; - for (int i = 0; i < 13; ++i) - { - if (data[510 + i] == (byte)0xE8) // EBCDIC 'Y' is 0xE8. - { - ++numAudLevel; - } - } - userActionAuditLevel_ = new String[numAudLevel]; - counter = 0; - for (int i = 0; i < 13; ++i) - { - if (data[510 + i] == (byte)0xE8) // EBCDIC 'Y' is 0xE8. - { - userActionAuditLevel_[counter++] = AUDIT_LEVELS[i]; - } - } - - groupAuthorityType_ = conv.byteArrayToString(data, 574, 10).trim(); - - int supplementalGroupOffset = BinaryConverter.byteArrayToInt(data, 584); - int supplementalGroupCount = BinaryConverter.byteArrayToInt(data, 588); - supplementalGroups_ = new String[supplementalGroupCount]; - for (int i = 0; i < supplementalGroupCount; ++i) - { - supplementalGroups_[i] = conv.byteArrayToString(data, supplementalGroupOffset + i * 10, 10).trim(); - } - - userID_ = BinaryConverter.byteArrayToUnsignedInt(data, 592); - groupID_ = BinaryConverter.byteArrayToUnsignedInt(data, 596); - - int homeDirOffset = BinaryConverter.byteArrayToInt(data, 600); - int homeDirCcsid = BinaryConverter.byteArrayToInt(data, homeDirOffset); - int homeDirLength = BinaryConverter.byteArrayToInt(data, homeDirOffset + 16); - Converter homeDirConv = homeDirCcsid > 0 && homeDirCcsid < 65535 ? new Converter(homeDirCcsid, system_) : conv; - homeDirectory_ = homeDirConv.byteArrayToString(data, homeDirOffset + 32, homeDirLength).trim(); - - int numLocaleJobAttribs = 0; - for (int i = 0; i < 8; ++i) - { - if (data[608 + i] == (byte)0xE8) // EBCDIC 'Y' is 0xE8. - { - ++numLocaleJobAttribs; - } - } - localeJobAttributes_ = new String[numLocaleJobAttribs]; - counter = 0; - for (int i = 0; i < 8; ++i) - { - if (data[608 + i] == (byte)0xE8) // EBCDIC 'Y' is 0xE8. - { - localeJobAttributes_[counter++] = LOCALE_ATTRIBUTES[i]; - } - } - - int localePathOffset = BinaryConverter.byteArrayToInt(data, 624); - int localePathLength = BinaryConverter.byteArrayToInt(data, 628); - if (localePathLength == 10) - { - localePathName_ = conv.byteArrayToString(data, localePathOffset, localePathLength).trim(); - } - else - { - int localePathCcsid = BinaryConverter.byteArrayToInt(data, localePathOffset); - localePathLength = BinaryConverter.byteArrayToInt(data, localePathOffset + 16); - Converter localePathConv = localePathCcsid > 0 && localePathCcsid < 65535 ? new Converter(localePathCcsid, system_) : conv; - localePathName_ = localePathConv.byteArrayToString(data, localePathOffset + 32, localePathLength).trim(); - } - - // EBCDIC '1' indicates the user is a group that has members. - groupHasMember_ = (data[632] == (byte)0xF1); - // EBCDIC '1' indicates there is at least one digital certificate associated with this user. - withDigitalCertificates_ = (data[633] == (byte)0xF1); - chridControl_ = conv.byteArrayToString(data, 634, 10).trim(); - - int vrm = system_.getVRM(); - if (vrm >= 0x00050100) - { - int iaspOffset = BinaryConverter.byteArrayToInt(data, 644); - int iaspCount = BinaryConverter.byteArrayToInt(data, 648); - int iaspCountReturned = BinaryConverter.byteArrayToInt(data, 652); - int iaspLength = BinaryConverter.byteArrayToInt(data, 656); - if (Trace.traceOn_ && iaspCount != iaspCountReturned) - { - Trace.log(Trace.WARNING, "Not all IASP information was returned, count: " + iaspCount + ", returned:", iaspCountReturned); - } - iaspNames_ = new String[iaspCountReturned]; - iaspStorageAllowed_ = new int[iaspCountReturned]; - iaspStorageUsed_ = new int[iaspCountReturned]; - for (int i = 0; i < iaspCountReturned; ++i) - { - int offset = iaspOffset + (i * iaspLength); - iaspNames_[i] = conv.byteArrayToString(data, offset, 10).trim(); - iaspStorageAllowed_[i] = BinaryConverter.byteArrayToInt(data, offset + 12); - iaspStorageUsed_[i] = BinaryConverter.byteArrayToInt(data, offset + 16); - } - - if (vrm >= 0x00050300) - { - // EBCDIC 'Y' indicates the password is managed locally. - localPasswordManagement_ = (data[660] == (byte)0xE8); - - if (vrm >= 0x00060100) // @550 added password change block - { - pwdChangeBlock_ = conv.byteArrayToString(data, 661, 10).trim(); - // EBCDIC '1' indicates user entitlement is required. - userEntitlementRequired_ = (data[671] == (byte)0xF1); - - if (vrm >= 0x00070100) // @710 added more fields - { - userExpirationInterval_ = BinaryConverter.byteArrayToInt(data, 672); - if (userExpirationDateBytes_ == null) userExpirationDateBytes_ = new byte[8]; - // *DTS format - convert on getter. - System.arraycopy(data, 676, userExpirationDateBytes_, 0, 8); - userExpirationDate_ = null; // Reset. - userExpirationAction_ = conv.byteArrayToString(data, 684, 10).trim(); - } - } - } - } - loaded_ = true; - connected_ = true; - } - - - /** - Refreshes all the attribute values for this User object by retrieving them from the system. -
      Same as {@link #loadUserInformation loadUserInformation()}. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void refresh() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - loadUserInformation(); - } - - /** - Removes the PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes the VetoableChangeListener. If the VetoableChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - // Used by the setters to change the user profile. - private void runCommand(String parameters) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Changing user profile."); - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (name_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting name."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - CommandCall cmd = getCommandCallObject(COMMAND_CHGUSRPRF); - try { - cmd.setCommand("QSYS/CHGUSRPRF USRPRF(" + name_ + ") " + parameters); - } catch (PropertyVetoException e) {} // will never happen - - if (!cmd.run()) - { - throw new AS400Exception(cmd.getMessageList()); - } - loaded_ = false; - connected_ = true; - } - - - // Utility method. - private final CommandCall getCommandCallObject(boolean isChgUsrPrf) - { - if (isChgUsrPrf) - { - if (chgUsrPrf_ == null) - { - chgUsrPrf_ = new CommandCall(system_); - // CHGUSRPRF is not threadsafe, but honor the property if set. - chgUsrPrf_.suggestThreadsafe(false); - } - return chgUsrPrf_; - } - else - { - if (chgUsrAud_ == null) - { - chgUsrAud_ = new CommandCall(system_); - // CHGUSRAUD is not threadsafe, but honor the property if set. - chgUsrAud_.suggestThreadsafe(false); - } - return chgUsrAud_; - } - } - - // Used by the setters to change the user auditing. - private void runCommandAud(String parameters) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Changing user auditing."); - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (name_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting name."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - CommandCall cmd = getCommandCallObject(COMMAND_CHGUSRAUD); - try { - cmd.setCommand("QSYS/CHGUSRAUD USRPRF(" + name_ + ") " + parameters); - } catch (PropertyVetoException e) {}; // will never happen - - if (!cmd.run()) - { - throw new AS400Exception(cmd.getMessageList()); - } - loaded_ = false; - connected_ = true; - } - - /** - Sets the accounting code that is associated with this user profile. - @param accountingCode The accounting code that is associated with this user profile. Possible values are: -

        -
      • "*BLANK" - An accounting code of 15 blanks is assigned to this user profile. -
      • An accounting code - A 15 character accounting code to be used by jobs that get their accounting code from this user profile. If less than 15 characters are specified, the string is padded on the right with blanks. -
      - @see #getAccountingCode - **/ - public void setAccountingCode(String accountingCode) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (accountingCode == null) - { - Trace.log(Trace.ERROR, "Parameter 'accountingCode' is null."); - throw new NullPointerException("accountingCode"); - } - if (accountingCode.equals("*BLANK")) - { - runCommand("ACGCDE(*BLANK)"); - } - else - { - runCommand("ACGCDE('" + accountingCode + "')"); - } - } - - // Convenience method for making a command string from array of strings. - static private String setArrayToString(String[] array) - { - int arrayLength = array.length; - if (arrayLength == 0) return NONE; - if (arrayLength == 1) return array[0]; - StringBuffer string = new StringBuffer(array[0]); - for (int i = 1; i < arrayLength; ++i) - { - string.append(" "); - string.append(array[i]); - } - return string.toString(); - } - - /** - Sets which user interface to use. - @param assistanceLevel The user interface to use. Possible values are: -
        -
      • "*SYSVAL" - The assistance level defined in the system value QASTLVL is used. -
      • "*BASIC" - The Operational Assistant user interface is used. -
      • "*INTERMED" - The system user interface is used. -
      • "*ADVANCED" - The expert system user interface is used. To allow for more list entries, option keys and function keys are not displayed. If a command does not have an advanced (*ADVANCED) level, the intermediate (*INTERMED) level is used. -
      - **/ - public void setAssistanceLevel(String assistanceLevel) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (assistanceLevel == null) - { - Trace.log(Trace.ERROR, "Parameter 'assistanceLevel' is null."); - throw new NullPointerException("assistanceLevel"); - } - runCommand("ASTLVL(" + assistanceLevel + ")"); - } - - /** - Sets the program to be used as the Attention (ATTN) key handling program for this user. The ATTN key handling program is called when the ATTN key is pressed during an interactive job. The program is active only when the user routes to the system-supplied QCMD processor. The ATTN key handling program is set on before the initial program (if any) is called and it is active for both program and menu. If the program changes the ATNPGM (by using the SETATNPGM command), the new program remains active only for the duration of the program. When contol returns and QCMD call the menu, the original ATTN key handling program becomes active again. If the SETATNPGM command is run from the menues or an application is called from the menues, the new ATTN key handling program that is specified overrides the original ATTN key handling program. If *YES or *PARTIAL is specified for the Limit capabilites (LMTCPB) parameter on the Create User Profile (CRTUSRPRF) or Change User Profile (CHGUSRPRF) command, the ATTN key handling program cannot be changed. The caller must have *USE authority to the specified program. - @param attentionKeyHandlingProgram The program to be used as the Attention (ATTN) key handling program for this user. Possible values are: -
        -
      • "*SYSVAL" - The system value QATNPGM is used. -
      • {@link #NONE NONE} - No ATTN key handling program is used by this user. -
      • "*ASSIST" - The Operational Assistant ATTN key handling program, QEZMAIN, is used. -
      • The fully qualified integrated file system path name of the attention key handling program. -
      - @see QSYSObjectPathName - **/ - public void setAttentionKeyHandlingProgram(String attentionKeyHandlingProgram) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (attentionKeyHandlingProgram == null) - { - Trace.log(Trace.ERROR, "Parameter 'attentionKeyHandlingProgram' is null."); - throw new NullPointerException("attentionKeyHandlingProgram"); - } - if (attentionKeyHandlingProgram.length() == 0 || attentionKeyHandlingProgram.startsWith("*")) - { - runCommand("ATNPGM(" + attentionKeyHandlingProgram + ")"); - } - else - { - QSYSObjectPathName ifs = new QSYSObjectPathName(attentionKeyHandlingProgram, "PGM"); - runCommand("ATNPGM(" + ifs.getLibraryName() + "/" + ifs.getObjectName() + ")"); - } - } - - /** - Sets the character code set identifier (CCSID) to be used for this user. -

      A CCSID is a 16-bit number identifying a specific set of encoding scheme identifiers, character set identifiers, code page identifiers, and additional coding-related information that uniquely identifies the coded graphic representation used. -

      Note: If the value for CCSID is changed, the change does not affect job that are currently running. - @param ccsid The character code set identifier (CCSID) to be used for this user. Possible values are: -

        -
      • -2 - The system value QCCSID is used to determine the user's character code set ID. -
      • A character code set ID. -
      - **/ - public void setCCSID(int ccsid) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - runCommand("CCSID(" + (ccsid == -2 ? "*SYSVAL" : Integer.toString(ccsid)) + ")"); - } - - /** - Sets the character code set identifier (CCSID) to be used for this user. -

      A CCSID is a 16-bit number identifying a specific set of encoding scheme identifiers, character set identifiers, code page identifiers, and additional coding-related information that uniquely identifies the coded graphic representation used. -

      Note: If the value for CCSID is changed, the change does not affect job that are currently running. - @param ccsid The character code set identifier (CCSID) to be used for this user. Possible values are: -

        -
      • "*SYSVAL" - The system value QCCSID is used to determine the user's character code set ID. -
      • "*HEX" - The CCSID 65535 is used. -
      • A character code set ID. -
      - **/ - public void setCCSID(String ccsid) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (ccsid == null) - { - Trace.log(Trace.ERROR, "Parameter 'ccsid' is null."); - throw new NullPointerException("ccsid"); - } - runCommand("CCSID(" + ccsid + ")"); - } - - /** - Sets the character identifier control (CHRIDCTL) for the job. This attribute controls the type of coded character set identifier (CCSID) conversion that occurs for display files, printer files and panel groups. The *CHRIDCTL special value must be specified for the Character identifier (CHRID) parameter an the create, change, or override commands for display files, printer files, and panel groups before this attribute will be used. - @param chridControl The character identifier control (CHRIDCTL) for the job. Possible values are: -
        -
      • "*SYSVAL" - The system value QCHRIDCTL is used. -
      • "*DEVD" - The *DEVD special value performs the same function as on the CHRID command parameter for display files, printer files, and panel groups. -
      • "*JOBCCSID" - The *JOBCCSID special value performs the same function as on the CHRID command parameter for display files, printer files, and panel groups. -
      - @see #getCHRIDControl - **/ - public void setCHRIDControl(String chridControl) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (chridControl == null) - { - Trace.log(Trace.ERROR, "Parameter 'chridControl' is null."); - throw new NullPointerException("chridControl"); - } - runCommand("CHRIDCTL(" + chridControl + ")"); - } - - /** - Sets the country or region identifier to be used for this user. - @param countryID The country or region identifier to be used for this user. Possible values are: -
        -
      • "*SYSVAL" - The system value QCNTRYID is used. -
      • A country or region identifier. -
      - @see #getCountryID - **/ - public void setCountryID(String countryID) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (countryID == null) - { - Trace.log(Trace.ERROR, "Parameter 'countryID' is null."); - throw new NullPointerException("countryID"); - } - runCommand("CNTRYID(" + countryID + ")"); - } - - /** - Sets the name of the current library associated with the job being run. -

      Specifies the name of the library to be used as the current library for this user. If *PARTIAL or *YES is specified for the Limit capabilities (LMTCPB) parameter of the Create User Profile (CRTUSRPRF) or Change User Profile (CHGUSRPRF) command, the user cannot change the current library at sign-on or with the Change Profile (CHGPRF) command. -

      The caller must have *USE authority to the specified library. - @param currentLibraryName The name of the current library associated with the job being run. Possible values are: -

        -
      • "*CRTDFT" - The user has no current library. The library QGPL is used as the default current library. -
      • A library name. -
      - @see #getCurrentLibraryName - **/ - public void setCurrentLibraryName(String currentLibraryName) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (currentLibraryName == null) - { - Trace.log(Trace.ERROR, "Parameter 'currentLibraryName' is null."); - throw new NullPointerException("currentLibraryName"); - } - runCommand("CURLIB(" + currentLibraryName + ")"); - } - - /** - Sets the text that briefly describes the object. - @param description The text that briefly describes the object. Possible values are: -
        -
      • "*BLANK" - No text is specified. -
      • No more than 50 characters of text. -
      - @see #getDescription - **/ - public void setDescription(String description) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (description == null) - { - Trace.log(Trace.ERROR, "Parameter 'description' is null."); - throw new NullPointerException("description"); - } - if (description.equals("*BLANK")) - { - runCommand("TEXT(*BLANK)"); - } - else - { - runCommand("TEXT('" + description + "')"); - } - } - - /** - Sets whether the sign-on information display is shown. - @param displaySignOnInformation Whether the sign-on information display is shown. Possible values are: -
        -
      • "*SYSVAL" - The system value QDSPSGNINF is used to determine whether the sign-on information display is shown. -
      • "*NO" - The sign-on information display is not shown. -
      • "*YES" - The sign-on information display is shown. -
      - @see #getDisplaySignOnInformation - **/ - public void setDisplaySignOnInformation(String displaySignOnInformation) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (displaySignOnInformation == null) - { - Trace.log(Trace.ERROR, "Parameter 'displaySignOnInformation' is null."); - throw new NullPointerException("displaySignOnInformation"); - } - runCommand("DSPSGNINF(" + displaySignOnInformation + ")"); - } - - /** - Sets the specific authority given to the group profile for newly created objects. If *GRPPRF is specified for the Owner (OWNER) parameter, specification of this parameter is not allowed. - @param groupAuthority The specific authority given to the group profile for newly created objects. Possible values are: -
        -
      • {@link #NONE NONE} - No group authority is given. -
      • "*ALL" - The user can perform all operations execept those limited to the owner or controlled by authorization list management (*AUTLMGT) authority. The user can control the object's existence, specify the security for the object, change the object, and perform basic functions on the object. The user can also change ownership of the object. -
      • "*CHANGE" - The user can perform all operations execept those limited to the owner or controlled by the object existence (*OBJEXIST) and object management (*OBJMGT) authorities. The user can change and perform basic functions on the object. *CHANGE authority provides object operational (*OBJOPR) authority and all data authority. If the object is an authorization list, the user cannot add, change, or remove users. -
      • "*USE" - The user can perform basic operations on the object, such as running a program or reading a file. The user cannot change the object. User (*USE) authority provides object operational (*OBJOPR), read (*READ), and execute (*EXECUTE) authorities. -
      • "*EXCLUDE" - The user cannot access the object. -
      - @see #getGroupAuthority - **/ - public void setGroupAuthority(String groupAuthority) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (groupAuthority == null) - { - Trace.log(Trace.ERROR, "Parameter 'groupAuthority' is null."); - throw new NullPointerException("groupAuthority"); - } - runCommand("GRPAUT(" + groupAuthority + ")"); - } - - /** - Sets the type of authority to be granted to the group profile for newly-created objects. If {@link #NONE NONE} is specified for the Group Authority (GRPAUT) parameter, specification of this parameter is ignored. - @param groupAuthorityType The type of authority to be granted to the group profile for newly-created objects. Possible values are: -
        -
      • "*PRIVATE" - The group profile is granted private authority to newly-created objects, with the authority value determined by the GRPAUT parameter. If the authority value in the GRPAUT parameter is {@link #NONE NONE}, this value is ignored. -
      • "*PGP" - The group profile is the primary group for newly-created objects, with the authority value determined by the GRPAUT parameter. If the authority value in the GRPAUT parameter is {@link #NONE NONE}, this value is ignored. -
      - @see #getGroupAuthorityType - **/ - public void setGroupAuthorityType(String groupAuthorityType) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (groupAuthorityType == null) - { - Trace.log(Trace.ERROR, "Parameter 'groupAuthorityType' is null."); - throw new NullPointerException("groupAuthorityType"); - } - runCommand("GRPAUTTYP(" + groupAuthorityType + ")"); - } - - /** - Sets the group ID number (gid number) for this user profile. The gid number is used to identify the group profile when a member of the group is using the directory file system. The gid number for a user may not be changed if: -
        -
      • The user profile is the primary group of an object in a directory. -
      • There are one or more active jobs for the user. -
      - @param groupID The group ID number (gid number) for this user profile. Possible values are: -
        -
      • 0 - The user does not have a gid number or an existing gid number is removed. -

        Note: This value cannot be specified if the user is a group profile or the primary group of an object. -

      • 1-4294967294 - The gid number to be assigned to the user profile. The gid number assigned must not already be assigned to another user profile. -
      - @see #getGroupID - **/ - public void setGroupID(long groupID) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (groupID == 0) - { - runCommand("GID(*NONE)"); - } - else - { - runCommand("GID(" + Long.toString(groupID) + ")"); - } - } - - /** - Sets the group ID number (gid number) for this user profile. The gid number is used to identify the group profile when a member of the group is using the directory file system. The gid number for a user may not be changed if: -
        -
      • The user profile is the primary group of an object in a directory. -
      • There are one or more active jobs for the user. -
      - @param groupID The group ID number (gid number) for this user profile. Possible values are: -
        -
      • {@link #NONE NONE} - The user does not have a gid number or an existing gid number is removed. -

        Note: This value cannot be specified if the user is a group profile or the primary group of an object. -

      • "*GEN" - The gid number will be generated for the user. The system generates a gid number that is not already assigned to another user. The gid number generated is greater than 100. -
      • 1-4294967294 - The gid number to be assigned to the user profile. The gid number assigned must not already be assigned to another user profile. -
      - @see #getGroupID - **/ - public void setGroupID(String groupID) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (groupID == null) - { - Trace.log(Trace.ERROR, "Parameter 'groupID' is null."); - throw new NullPointerException("groupID"); - } - runCommand("GID(" + groupID + ")"); - } - - /** - Sets the user's group profile name whose authority is used if no specific authority is given for the user. The caller must have object management (*OBJMGT) and change (*CHANGE) authority to the profile specified for the Group profile (GRPPRF) parameter. The required *OBJMGT authority cannot be given by a program adopt operation. - @param groupProfileName The user's group profile name whose authority is used if no specific authority is given for the user. Possible values are: -
        -
      • {@link #NONE NONE} - The user profile has no group profile. -
      • The name of the group profile used with this user profile. -
      - @see #getGroupProfileName - **/ - public void setGroupProfileName(String groupProfileName) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (groupProfileName == null) - { - Trace.log(Trace.ERROR, "Parameter 'groupProfileName' is null."); - throw new NullPointerException("groupProfileName"); - } - runCommand("GRPPRF(" + groupProfileName + ")"); - } - - /** - Sets the highest scheduling priority the user is allowed to have for each job submitted to the system. This value controls the job processing priority and output priority for any job running under this user profile; that is, values specified in the JOBPTY and OUTPTY parameters of any job command cannot exceed the PTYLMT value of the user profile under which the job is run. The scheduling priority can have a value ranging from 0 through 9, where 0 is the highest priority and 9 is the lowest priority. - @param highestSchedulingPriority The highest scheduling priority the user is allowed to have for each job submitted to the system. - @see #getHighestSchedulingPriority - **/ - public void setHighestSchedulingPriority(int highestSchedulingPriority) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - runCommand("PTYLMT(" + Integer.toString(highestSchedulingPriority) + ")"); - } - - /** - Sets the path name of the home directory for this user profile. The home directory is the user's initial working directory. The working directory, associated with a process, is used during path name resolution in the directory file system for path names that do not begin with a slash (/). If the home directory specified does not exist when the user signs on, the user's initial working directory is the root (/) directory. - @param homeDirectory The path name of the home directory for this user profile. Possible values are: -
        -
      • "*USRPRF" - The home directory assigned to the user will be /home/USRPRF, where USRPRF is the name of the user profile. -
      • The path name of the home directory to be assigned to this user. -
      - @see #getHomeDirectory - **/ - public void setHomeDirectory(String homeDirectory) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (homeDirectory == null) - { - Trace.log(Trace.ERROR, "Parameter 'homeDirectory' is null."); - throw new NullPointerException("homeDirectory"); - } - if (homeDirectory.length() == 0 || homeDirectory.startsWith("*")) - { - runCommand("HOMEDIR(" + homeDirectory + ")"); - } - else - { - runCommand("HOMEDIR('" + homeDirectory + "')"); - } - } - - /** - Sets the initial menu displayed when the user signs on the system if the user's routing program is the command processor. If *YES is specified for the Limit capabilities (LMTCPB) parameter, the user cannot change the menu either at sign-on or with the Change Profile (CHGPRF) command. -

      A System/36 environment menu can be specified as the initial menu if either of the following conditions are true: -

        -
      • *S36 is specified for the Special environments (SPCENV) parameter. -
      • *SYSVAL is specified on the SPCENV parameter and the system value, QSPCENV, is *S36. -
      -

      The caller must have *USE authority to the specified menu. - @param initialMenu The initial menu displayed when the user signs on the system if the user's routing program is the command processor. Possible values are: -

        -
      • "*SIGNOFF" - The system signs off the user when the program completes. This is intended for users authorized only to run the program. -
      • The fully qualified integrated file system path name of the initial menu. -
      - @see QSYSObjectPathName - @see #getInitialMenu - **/ - public void setInitialMenu(String initialMenu) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (initialMenu == null) - { - Trace.log(Trace.ERROR, "Parameter 'initialMenu' is null."); - throw new NullPointerException("initialMenu"); - } - if (initialMenu.length() == 0 || initialMenu.startsWith("*")) - { - runCommand("INLMNU(" + initialMenu + ")"); - } - else - { - QSYSObjectPathName ifs = new QSYSObjectPathName(initialMenu, "MNU"); - runCommand("INLMNU(" + ifs.getLibraryName() + "/" + ifs.getObjectName() + ")"); - } - } - - /** - Sets, for an interactive job, the program called whenever a new routing step is started that has QCMD as the request processing program. If *PARTIAL or *YES is specified for the Limit capabilities parameter, the program value cannot be changed at sign on or by using the Change Profile (CHGPRF) command. No parameters can be passed to the program. -

      A System/36 environment procedure name can be specified as the initial program if the procedure is a member of the file QS36PRC (in the library list or specified library) and if either of the following conditions are true: -

        -
      • *36 is specified on the SPCENV parameter. -
      • *SYSVAL is specified on the SPCENV parameter and the system value, QSPCENV is *S36. -
      -

      The caller must have *USE authority to the specified program. - @param initialProgram The initial program for the user. Possible values are: -

        -
      • {@link #NONE NONE} - No program is called when the user signs on. If a menu name is specified in the Initial menu (INLMNU) parameter, that menu is displayed. -
      • The fully qualified integrated file system path name of the initial program for the user. -
      - @see QSYSObjectPathName - @see #getInitialProgram - **/ - public void setInitialProgram(String initialProgram) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (initialProgram == null) - { - Trace.log(Trace.ERROR, "Parameter 'initialProgram' is null."); - throw new NullPointerException("initialProgram"); - } - if (initialProgram.length() == 0 || initialProgram.startsWith("*")) - { - runCommand("INLPGM(" + initialProgram + ")"); - } - else - { - QSYSObjectPathName ifs = new QSYSObjectPathName(initialProgram, "PGM"); - runCommand("INLPGM(" + ifs.getLibraryName() + "/" + ifs.getObjectName() + ")"); - } - } - - /** - Sets the fully qualified integrated file system path name of the job description used for jobs that start through subsystem work station entries. If the job description does not exist when the user profile is created or changed, a library qualifier must be specified, because the job description name is kept in the user profile. The caller must have *USE authority to the specified job description. - @param jobDescription The fully qualified integrated file system path name of the job description used for jobs that start through subsystem work station entries. - @see QSYSObjectPathName - @see #getJobDescription - **/ - public void setJobDescription(String jobDescription) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (jobDescription == null) - { - Trace.log(Trace.ERROR, "Parameter 'jobDescription' is null."); - throw new NullPointerException("jobDescription"); - } - if (jobDescription.length() == 0 || jobDescription.startsWith("*")) - { - runCommand("JOBD(" + jobDescription + ")"); - } - else - { - QSYSObjectPathName ifs = new QSYSObjectPathName(jobDescription, "JOBD"); - runCommand("JOBD(" + ifs.getLibraryName() + "/" + ifs.getObjectName() + ")"); - } - } - - /** - Sets the keyboard buffering value to be used when a job is initialized for this user profile. If the type-ahead feature is active, you can buffer your keyboard strokes. If the attention key buffering option is active, the attention key is buffered as any other key. If it is not active, the attention key is not buffered and is sent to the system even if the display station is input-inhibited. This value can alse be set by a user application. - @param keyboardBuffering The keyboard buffering value to be used when a job is initialized for this user profile. Possible values are: -
        -
      • "*SYSVAL" - The system value, QKBDBUF, is used to determine the keyboard buffering value. -
      • "*NO" - The type-ahead and attention-key buffering options are not active. -
      • "*TYPEAHEAD" - The type-ahead option is active, but the attention key buffering option is not. -
      • "*YES" - The type-ahead and attention key buffering options are active. -
      - @see #getKeyboardBuffering - **/ - public void setKeyboardBuffering(String keyboardBuffering) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (keyboardBuffering == null) - { - Trace.log(Trace.ERROR, "Parameter 'keyboardBuffering' is null."); - throw new NullPointerException("keyboardBuffering"); - } - runCommand("KBDBUF(" + keyboardBuffering + ")"); - } - - /** - Sets the language ID to be used for this user. - @param languageID The language ID to be used for this user. Possible values are: -
        -
      • "*SYSVAL" - The system value QLANGID is used. -
      • The language ID to be used. -
      - @see #getLanguageID - **/ - public void setLanguageID(String languageID) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (languageID == null) - { - Trace.log(Trace.ERROR, "Parameter 'languageID' is null."); - throw new NullPointerException("languageID"); - } - runCommand("LANGID(" + languageID + ")"); - } - - /** - Sets the limit to which the user can control the program, menu, current library, and the ATTN key handling program values. It alse determines whether the user can run commands from the command line. This parameter is ignored when the security level is 10. -

      Note: When creating or changing other users' user profile, you cannot specify values on this parameter that grant greater capabilities to other users than your own user profile grants to you. For example, if *PARTIAL is specified for the Limit capabilities (LMTCPB) parameter in your user profile, you can specify *PARTIAL or *YES for anther user. You cannot specify *NO for another user. - @param limitCapabilities The limit to which the user can control the program, menu, current library, and the ATTN key handling program values. Possible values are: -

        -
      • "*NO" - The program, menu, and current library values can be changed when the usre signs on the system. User may change the program, menu, current library, or ATTN key handling program values is the own user profiles with the Change Profile (CHGPRF) command. Commands can be run from a command line. -
      • "*PARTIAL" - The program and current library cannot be changed on the sign-on display. The menu can be changed and comands can be run from a command line. A user can change the menu value with the Change profile (CHGPRF) command. The program, current library, and the ATTN key handling program cannot be changed using the CHGPRF command. -
      • "*YES" - The program, menu, and current library values cannot be changed on the sign-on display. Commands cannot be run when issued from a command line or by selecting an option from a command grouping menu such as CMDADD, but can still be run from a command entry screen. The user cannot change the program, menu, current library, or the ATTN key program handling values by using the CHGPRF command. -
      - @see #getLimitCapabilities - **/ - public void setLimitCapabilities(String limitCapabilities) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (limitCapabilities == null) - { - Trace.log(Trace.ERROR, "Parameter 'limitCapabilities' is null."); - throw new NullPointerException("limitCapabilities"); - } - runCommand("LMTCPB(" + limitCapabilities + ")"); - } - - /** - Sets if the number of device sessions allowed for a user is limited to 1. This does not limit SYSREQ and second sign-on. - Note: Values "0-9" are only valid when running to IBM i 6.1 or higher. - @param limitDeviceSessions If the number of device sessions allowed for a user is limited to 1. Possible values are: -
        -
      • "*SYSVAL" - The system value QLMTDEVSSN is used to determine whether the user is limited to a single device session. -
      • "*NO" - The user is not limited to one device session. -
      • "*YES" - The user is limited to one session. -
      • "0" - The user is not limited to a specific number of device session. The value has the same meaning as *NO. -
      • "1" - The user is limited to a single device session. The value has the same meaning as *YES. -
      • "2-9" - The user is limited to the specified number of device sessions. -
      - @see #getLimitDeviceSessions - **/ - public void setLimitDeviceSessions(String limitDeviceSessions) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (limitDeviceSessions == null) - { - Trace.log(Trace.ERROR, "Parameter 'limitDeviceSessions' is null."); - throw new NullPointerException("limitDeviceSessions"); - } - runCommand("LMTDEVSSN(" + limitDeviceSessions + ")"); - } - - /** - Sets which job attributes are to be taken from the locale specified for the Locale (LOCALE) parameter when the job is initiated. - @param localeJobAttributes A list of attributes which are set from the locale path name at the time a job is started for this user. Possible values for the elements of this array are: -
        -
      • "*SYSVAL" - The system value, QSETJOBATR, is used to determine which job attributes are taken from the locale. -
      • {@link #NONE NONE} - No job attributes are taken from the locale. -
      • "*CCSID" - The coded character set identifier from the locale is used. The CCSID value from the locale overrides the user profile CCSID. -
      • "*DATFMT" - The date format from the locale is used. -
      • "*DATSEP" - The date separator from the locale is used. -
      • "*DECFMT" - The decimal format from the locale is used. -
      • "*SRTSEQ" - The sort sequence from the locale is used. The sort sequence from the locale overrides the user profile sort sequence. -
      • "*TIMSEP" - The time separator from the locale is used. -
      - @see #getLocaleJobAttributes - **/ - public void setLocaleJobAttributes(String[] localeJobAttributes) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (localeJobAttributes == null) - { - Trace.log(Trace.ERROR, "Parameter 'localeJobAttributes' is null."); - throw new NullPointerException("localeJobAttributes"); - } - runCommand("SETJOBATR(" + setArrayToString(localeJobAttributes) + ")"); - } - - /** - Sets the path name of the locale that is assigned to LANG environment variable for this user. - @param localePathName The locale path name that is assigned to the user profile when a job is started. Possible values are: -
        -
      • "*SYSVAL" - The system value QLOCALE is used to determine the locale path name to be assigned for this user. -
      • {@link #NONE NONE} - No locale path name is assigned for this user. -
      • "*C" - The C locale path name is assigned for this user. -
      • "*POSIX" - The POSIX locale path name is assigned for this user. -
      • The path name of the locale to be assigned for this user. -
      - @see #getLocalePathName - **/ - public void setLocalePathName(String localePathName) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (localePathName == null) - { - Trace.log(Trace.ERROR, "Parameter 'localePathName' is null."); - throw new NullPointerException("localePathName"); - } - if (localePathName.length() == 0 || localePathName.startsWith("*")) - { - runCommand("LOCALE(" + localePathName + ")"); - } - else - { - runCommand("LOCALE('" + localePathName + "')"); - } - } - - /** - Sets whether the user profile password should be managed locally. - @param localPasswordManagement true if the password will be managed on the local system, false otherwise. - @see #isLocalPasswordManagement - **/ - public void setLocalPasswordManagement(boolean localPasswordManagement) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - runCommand("LCLPWDMGT(" + (localPasswordManagement ? "*YES" : "*NO") + ")"); - } - - /** - Sets the maximum amount of auxiliary storage (in kilobytes) assigned to store permanant objects owned by this user profile (1 kilobyte equals 1024 bytes). If the maximum is exceeded, when an interactive user tries to create an object, an error message is displayed, and the object is not created. If the maximum is exceeded when an object is created in a batch job, an error message is sent to the job log (depending on the logging level of the job), and the object is not created. -

      Storage is allocated in 4K increments. Therefore, if you specify MAXSTG (9), the profile is allocated 12K of storage. -

      When planning maximum storage for user profiles, consider the following system actions: -

        -
      • A restore operation assigns the storage to the user doing the restore, and then transfers the object to the owner. For a large restore, specify MAXSTG(*NOMAX). -
      • The user profile that creates a journal receiver is assigned the required storage as the receiver size grows. If new receivers are created using JRNRCV(*GEN), the storage continues to be assigned to the user profile that wons the active journal receiver. If a very active journal receiver is owned, specify MAXSTG(*NOMAX). -
      • User profiles that transfer created objects to their group profile must have adequate storage in the user profiles to contain created objects before the objects are transferred to the group profile. -
      • The owner of the library is assigned the storage for the descriptions of objects which are stored in a library, even when the objects are owned by another user profile. Examples of such objects are text and program references. -
      - @param maximumStorageAllowed The maximum amount of auxiliary storage (in kilobytes) assigned to store permanant objects owned by this user profile. Possible values are: -
        -
      • -1 - As much storage as is required is assigned to this profile (*NOMAX). -
      • The maximum amount of storage for the user, in kilobytes (1 kilobyte equals 1024 bytes). -
      - @see #getMaximumStorageAllowed - **/ - public void setMaximumStorageAllowed(int maximumStorageAllowed) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - runCommand("MAXSTG(" + (maximumStorageAllowed == -1 ? "*NOMAX" : Integer.toString(maximumStorageAllowed)) + ")"); - } - - /** - Sets the maximum amount of auxiliary storage (in kilobytes) assigned to store permanant objects owned by this user profile (1 kilobyte equals 1024 bytes). If the maximum is exceeded, when an interactive user tries to create an object, an error message is displayed, and the object is not created. If the maximum is exceeded when an object is created in a batch job, an error message is sent to the job log (depending on the logging level of the job), and the object is not created. -

      Storage is allocated in 4K increments. Therefore, if you specify MAXSTG (9), the profile is allocated 12K of storage. -

      When planning maximum storage for user profiles, consider the following system actions: -

        -
      • A restore operation assigns the storage to the user doing the restore, and then transfers the object to the owner. For a large restore, specify MAXSTG(*NOMAX). -
      • The user profile that creates a journal receiver is assigned the required storage as the receiver size grows. If new receivers are created using JRNRCV(*GEN), the storage continues to be assigned to the user profile that wons the active journal receiver. If a very active journal receiver is owned, specify MAXSTG(*NOMAX). -
      • User profiles that transfer created objects to their group profile must have adequate storage in the user profiles to contain created objects before the objects are transferred to the group profile. -
      • The owner of the library is assigned the storage for the descriptions of objects which are stored in a library, even when the objects are owned by another user profile. Examples of such objects are text and program references. -
      - @param maximumStorageAllowed The maximum amount of auxiliary storage (in kilobytes) assigned to store permanant objects owned by this user profile. Possible values are: -
        -
      • "*NOMAX" - As much storage as is required is assigned to this profile. -
      • The maximum amount of storage for the user, in kilobytes (1 kilobyte equals 1024 bytes). -
      - @see #getMaximumStorageAllowed - **/ - public void setMaximumStorageAllowed(String maximumStorageAllowed) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (maximumStorageAllowed == null) - { - Trace.log(Trace.ERROR, "Parameter 'maximumStorageAllowed' is null."); - throw new NullPointerException("maximumStorageAllowed"); - } - runCommand("MAXSTG(" + maximumStorageAllowed + ")"); - } - - /** - Sets the message queue to which messages are sent. -

      Note: The message queue is created, if it does not exist. The user profile specified for the User profile (USRPRF) parameter is the owner of the message queue. -

      The caller must have *USE authority to the specified message queue. - @param messageQueue The message queue to which messages are sent. Possible values are: -

        -
      • "*USRPRF" - A message queue with the same name as that specified for the USRPRF parameter is used as the message queue for this user. This message queue is located in the QUSERSYS library. -
      • The fully qualified integrated file system path name of the message queue to be used with this profile. -
      - @see QSYSObjectPathName - @see #getMessageQueue - **/ - public void setMessageQueue(String messageQueue) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (messageQueue == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageQueue' is null."); - throw new NullPointerException("messageQueue"); - } - if (messageQueue.length() == 0 || messageQueue.startsWith("*")) - { - runCommand("MSGQ(" + messageQueue + ")"); - } - else - { - QSYSObjectPathName ifs = new QSYSObjectPathName(messageQueue, "MSGQ"); - runCommand("MSGQ(" + ifs.getLibraryName() + "/" + ifs.getObjectName() + ")"); - } - } - - /** - Sets how the messages are sent to the message queue for this user are to be delivered. - @param messageQueueDeliveryMethod How the messages are sent to the message queue for this user are to be delivered. Possible values are: -
        -
      • "*NOTIFY" - The job to which the message queue is assigned is notified when a message arrives on the message queue. For interactive jobs at a work station, the audible alarm is sounded (if the alarm feature is set) and the Message Waiting light is turned on. The delivery mode cannot be changed to *NOTIFY if the message queue is also being used by another job. -
      • "*HOLD" - The messages are held in the message queue until they are requested by the user or program. -
      • "*BREAK" - The job to which the message queue is assigned is interrupted when a message arrives at the message queue. If the job is an interactive job, the autdible alarm is sounded (if the alarm feature is set). The delivery mode cannot be changed to *BREAK if the message queue is also being used by another job. -
      • "*DFT" - The default reply to the inquiry message is sent. If no default reply is specified in the message description of the inquiry message, the system default reply, *N, is used. -
      - @see #setMessageQueueDeliveryMethod - **/ - public void setMessageQueueDeliveryMethod(String messageQueueDeliveryMethod) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (messageQueueDeliveryMethod == null) - { - Trace.log(Trace.ERROR, "Parameter 'messageQueueDeliveryMethod' is null."); - throw new NullPointerException("messageQueueDeliveryMethod"); - } - runCommand("DLVRY(" + messageQueueDeliveryMethod + ")"); - } - - /** - Sets the lowest severity code that a message can have and still be delivered to a user in break or notify mode. Messages arriving at the message queue whose severities are lower than the the severity code specified for this parameter do not interrupt the job or turn on the audible alarm or the message-waiting light; they are held in the queue until they are requested by using the Display Message (DSPMSG) command. If *BREAK or *NOTIFY is specidied for the Delivery (DLVRY) parameter, and is in effect when a message arrives at the queue, the message is delivered if the severity code associated with the message is equal or greater then the value specified here. Otherwiese, the message is held in the queue until it is requested. - @param messageQueueSeverity A severity code ranging from 00 through 99. - @see #getMessageQueueSeverity - **/ - public void setMessageQueueSeverity(int messageQueueSeverity) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - runCommand("SEV(" + Integer.toString(messageQueueSeverity) + ")"); - } - - /** - Sets the user profile name. This does not change the name of the user profile on the system. Instead, it changes the user profile to which this User object references. This property cannot be changed if the object has established a connection to the system. - @param name The user profile name. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - @see #getName - **/ - public void setName(String name) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting name: " + name); - - if (name == null) - { - Trace.log(Trace.ERROR, "Parameter 'name' is null."); - throw new NullPointerException("name"); - } - name = name.trim(); - if (name.length() > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'name' is not valid: '" + name + "'"); - throw new ExtendedIllegalArgumentException("name (" + name + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (name.equalsIgnoreCase(NONE)) - { - Trace.log(Trace.ERROR, "Value of parameter 'name' is not valid: '" + name + "'"); - throw new ExtendedIllegalArgumentException("name (" + name + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (connected_) - { - Trace.log(Trace.ERROR, "Cannot set property 'name' after connect."); - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - name_ = name.toUpperCase(); - } - else - { - String oldValue = name_; - String newValue = name.toUpperCase(); - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("name", oldValue, newValue); - } - name_ = newValue; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("name", oldValue, newValue); - } - } - } - - /** - Sets the object auditing value for the user. This value only takes effect if the object auditing (OBJAUD) value for the object being accessed has the value *USRPRF. -

      Implementation note: The method internally calls the Change User Auditing (CHGUSRAUD) command and not the Change User Profile (CHGUSRPRF) command. The caller must have audit (*AUDIT) special authority. Changes take effect the next time a job is started for this user. - @param objectAuditingValue The object auditing value for the user. Possible values are: -

        -
      • {@link #NONE NONE} - The auditing value for the object determines when auditing is performed. -
      • "*CHANGE" - All changes accesses by this user on all objects with the *USRPRF audit value are logged. -
      • "*ALL" - All change and read accesses by this use on all objects with the *USRPRF audit value are logged. -
      - @see #getObjectAuditingValue - **/ - public void setObjectAuditingValue(String objectAuditingValue) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (objectAuditingValue == null) - { - Trace.log(Trace.ERROR, "Parameter 'objectAuditingValue' is null."); - throw new NullPointerException("objectAuditingValue"); - } - runCommandAud("OBJAUD(" + objectAuditingValue + ")"); - } - - /** - Sets the output queue to be used by this user profile. The output queue must already exist when this command is run. The caller must have *USE authority to the specified output queue. - @param outputQueue The output queue to be used by this user profile. Possible values are: -
        -
      • "*WRKSTN" - The output queue assigned to the user's work station is used. -
      • "*DEV" - The output queue associated with the printer specified for the Print device (PRTDEV) parameter is used. The output queue has the same name as the printer. (The pringer file DEV parameter is determined by the CRTPRTF, CHGPRTF, or the OVRPRTF command). -

        Note: This assumes the defaults are specified for the Output queue (OUTQ) parameter for the printer file, job description, user profile, and workstation. -

      • The fully qualified integrated file system path name of the output queue to be used by this user profile. -
      - @see QSYSObjectPathName - @see #getOutputQueue - **/ - public void setOutputQueue(String outputQueue) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (outputQueue == null) - { - Trace.log(Trace.ERROR, "Parameter 'outputQueue' is null."); - throw new NullPointerException("outputQueue"); - } - if (outputQueue.length() == 0 || outputQueue.startsWith("*")) - { - runCommand("OUTQ(" + outputQueue + ")"); - } - else - { - QSYSObjectPathName ifs = new QSYSObjectPathName(outputQueue, "OUTQ"); - runCommand("OUTQ(" + ifs.getLibraryName() + "/" + ifs.getObjectName() + ")"); - } - } - - /** - Sets the user profile that is to be the owner of objects created by this user. - @param owner The user profile that is to be the owner of objects created by this user. Possible values are: -
        -
      • "*USRPRF" - The user profile associated with the job is the owner of the object. -
      • "*GRPPRF" - The group profile is made the owner of newly created objects and has all authority to the object. The user profile associated with the job does not have any specific authority to the object. If *GRPPRF is specified, a user profile name must be specified for the Group profile (GRPPRF) parameter, and the Group authority (GRPAUT) parameter cannot be specified. -
      - @see #getOwner - **/ - public void setOwner(String owner) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (owner == null) - { - Trace.log(Trace.ERROR, "Parameter 'owner' is null."); - throw new NullPointerException("owner"); - } - runCommand("OWNER(" + owner + ")"); - } - - // @610 - /** - * Sets the time period during which a password is blocked from being changed - * following the prior successful password change operation. - *

      Note: This method should not be used when running to IBM i 5.4 or earlier releases. - * @param pwdChangeBlock The time period during which a password is blocked from being changed. Possible values are: - *

        - *
      • "*SYSVAL" - The system value QPWDCHGBLK is used to determine the block password change value.
      • - *
      • {@link #NONE NONE} - The password can be changed at any time.
      • - *
      • 1-99 - Indicates the number of hours a user must wait after the prior successful password change operation - * before they are able to change the password again.
      • - *
      - * @see #getPasswordChangeBlock - */ - public void setPasswordChangeBlock(String pwdChangeBlock) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (pwdChangeBlock == null) - { - Trace.log(Trace.ERROR, "Parameter 'pwdChangeBlock' is null."); - throw new NullPointerException("pwdChangeBlock"); - } - runCommand("PWDCHGBLK(" + pwdChangeBlock + ")"); - } - - /** - Sets the password expiration interval (in days). - @param passwordExpirationInterval The number of days the user's password can remain active before it must be changed. Possible values are: -
        -
      • 0 - The system value QPWDEXPITV is used to determine the password expiration interval (*SYSVAL). -
      • -1 - The password does not expire (*NOMAX). -
      • 1-366 - The number of days between the date when the password is changed and the date when the password expires. -
      - @see #getPasswordExpirationInterval - **/ - public void setPasswordExpirationInterval(int passwordExpirationInterval) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - runCommand("PWDEXPITV(" + (passwordExpirationInterval == -1 ? "*NOMAX" : passwordExpirationInterval == 0 ? "*SYSVAL" : Integer.toString(passwordExpirationInterval)) + ")"); - } - - /** - Sets the password expiration interval (in days). - @param passwordExpirationInterval The number of days the user's password can remain active before it must be changed. Possible values are: -
        -
      • "*SYSVAL" - The system value QPWDEXPITV is used to determine the password expiration interval. -
      • "*NOMAX" - The password does not expire. -
      • 1-366 - The number of days between the date when the password is changed and the date when the password expires. -
      - @see #getPasswordExpirationInterval - **/ - public void setPasswordExpirationInterval(String passwordExpirationInterval) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (passwordExpirationInterval == null) - { - Trace.log(Trace.ERROR, "Parameter 'passwordExpirationInterval' is null."); - throw new NullPointerException("passwordExpirationInterval"); - } - runCommand("PWDEXPITV(" + passwordExpirationInterval + ")"); - } - - /** - Sets whether the password for this user is set to expired. If the password is set to expired, the user is required to change the password to sign on to the system. When the user attempts to sign on to the system, the sign-on information display is shown and the user has the option to change this password. - @param passwordSetExpire true if the password set to expired, false otherwise. - @see #isPasswordSetExpire - **/ - public void setPasswordSetExpire(boolean passwordSetExpire) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - runCommand("PWDEXP(" + (passwordSetExpire ? "*YES" : "*NO") + ")"); - } - - /** - Sets the default printer device for this user. If the pringer file used to create printed output specifies to spool the data, the spooled file is placed on the device's output queue, which is named the same as the device. -

      Note: This assumes the defaults are specified for the Output queue (OUTQ) parameter for the printer file, job description, user profile, and workstation. -

      The caller must have *USE authority to the specified print device. - @param printDevice The default printer device for this user. Possible values are: -

        -
      • "*WRKSTN" - The printer assigned to the user's work station is used. -
      • "*SYSVAL" - The value specified in the system value QPRTDEV is used. -
      • The name of a printer that is to be used to print the output for this user. -
      - @see #getPrintDevice - **/ - public void setPrintDevice(String printDevice) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (printDevice == null) - { - Trace.log(Trace.ERROR, "Parameter 'printDevice' is null."); - throw new NullPointerException("printDevice"); - } - runCommand("PRTDEV(" + printDevice + ")"); - } - - /** - Sets the sort sequence table to be used for string comparisons for this profile. - @param sortSequenceTable The sort sequence table to be used for string comparisons for this profile. Possible values are: -
        -
      • "*SYSVAL" - The system value QSRTSEQ is used. -
      • "*HEX" - A sort sequence table is not used. The hexadecimal values of the characters are used to determine the sort sequence. -
      • "*LANGIDUNQ" - A unique-weight sort table is used -
      • "*LANGIDSHR" - A shared-weight sort table is used. -
      • The fully qualified integrated file system path name of the sort sequence table to be used with this profile. -
      - @see QSYSObjectPathName - @see #getSortSequenceTable - **/ - public void setSortSequenceTable(String sortSequenceTable) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (sortSequenceTable == null) - { - Trace.log(Trace.ERROR, "Parameter 'sortSequenceTable' is null."); - throw new NullPointerException("sortSequenceTable"); - } - if (sortSequenceTable.length() == 0 || sortSequenceTable.startsWith("*")) - { - runCommand("SRTSEQ(" + sortSequenceTable + ")"); - } - else - { - QSYSObjectPathName ifs = new QSYSObjectPathName(sortSequenceTable, "FILE"); - runCommand("SRTSEQ(" + ifs.getLibraryName() + "/" + ifs.getObjectName() + ")"); - } - } - - /** - Sets the special authorities given to a user. Special authorities are required to perform certain functions on the system. Special authorities cannot be removed from many of the system-supplied user profiles, including QSECOFR and QSYS. -

      The following special authorities are usually given: -

        -
      • Save system (*SAVSYS) special authority to users who need to operate the system. -
      • Input/output system configuration (*IOSYSCFG) special authority to users who need to change system I/O configurations. -
      • Job control (*JOBCTL) special authority is given to the user. The user is given the authority to change, display, hold, release, cancel, and clear all jobs that are running on the system or that are on a job queue or output queue that has OPRCTL (*YES) specified. The user also has the authority to load the system, to start writers, and to stop active subsystems. -
      • Security administrator (*SECADM) special authority to users who need to create, change, or delete user profiles. -
      • All object (*ALLOBJ) special authority to users who need to work with system resources. -
      • Service (*SERVICE) special authority to users who need to perform service functions. -
      • Spool control (*SPLCTL) special authority to users who need to perform all spool-related functions. -
      • Audit (*AUDIT) special authority to users who need to perform auditing functions. -
      -

      Restrictions: -

        -
      • The user profile creating or changing another user profile must have all of the special authorities being given. All special authorities are needed to give all special authorities to another user profile. -
      • A user must have *ALLOBJ and *SECADM special authorities to give a user *SECADM special authority when using the CHGUSRPRF command. -
      • The user must have *ALLOBJ, *SECADM, and *AUDIT special authorities to give a user *AUDIT special authority when using the CHGUSRPRF command. -
      - @param specialAuthority The special authorities given to a user. Possible values for the elements of this array are: -
        -
      • "*USRCLS" - Special authorities are granted to this user based on the value specified on User class (USRCLS) parameter. -
      • {@link #NONE NONE} - No special authorities are granted to this user. -
      • {@link #SPECIAL_AUTHORITY_ALL_OBJECT SPECIAL_AUTHORITY_ALL_OBJECT} - All object authority is given to the user. The user can access any system resource with or without private user authorizations. -
      • {@link #SPECIAL_AUTHORITY_AUDIT SPECIAL_AUTHORITY_AUDIT} - Audit authority is granted to this user. The user is given the authority to perform auditing functions. Auditing functions include turning auditing on or off for the system and controlling the level of auditing on an object or user. -
      • {@link #SPECIAL_AUTHORITY_JOB_CONTROL SPECIAL_AUTHORITY_JOB_CONTROL} - Job control authority is given to the user. The user has authority to change, display, hold, release, cancel, and clear all jobs that are running on the system or that are on a job queue or output queue that has OPRCTL (*YES) specified. The user also has the authority to start writers and to stop active subsystems. -
      • {@link #SPECIAL_AUTHORITY_SAVE_SYSTEM SPECIAL_AUTHORITY_SAVE_SYSTEM} - Save system authority is given to the user profile. This user has the authority to save, restore, and free storage for all objects on the system, with or without object management authority. -
      • {@link #SPECIAL_AUTHORITY_IO_SYSTEM_CONFIGURATION SPECIAL_AUTHORITY_IO_SYSTEM_CONFIGURATION} - Input/output (I/O) system configuration authority is given to the user. The user has authority to change system I/O configurations. -
      • {@link #SPECIAL_AUTHORITY_SECURITY_ADMINISTRATOR SPECIAL_AUTHORITY_SECURITY_ADMINISTRATOR} - Security administrator authority is given to the user. The user can create, change, or delete user profiles if authorized to the Create User Profile (CRTUSRPRF), Change User Profile (CHGUSRPRF), or Delete User Profile (DLTUSRPRF) commands and is authorized to the user profile. This authority does not allow giving special authorities that this user profile does not have. To give *SECADM special authority to another user, a user must have both *ALLOBJ and *SECADM special authorities. -
      • {@link #SPECIAL_AUTHORITY_SERVICE SPECIAL_AUTHORITY_SERVICE} - Service authority is given to this user. The user can perform service functions. -
      • {@link #SPECIAL_AUTHORITY_SPOOL_CONTROL SPECIAL_AUTHORITY_SPOOL_CONTROL} - Spool control authority is given to this user. The user can perform all spool functions. -
      - @see #getSpecialAuthority - @see #hasSpecialAuthority - **/ - public void setSpecialAuthority(String[] specialAuthority) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (specialAuthority == null) - { - Trace.log(Trace.ERROR, "Parameter 'specialAuthority' is null."); - throw new NullPointerException("specialAuthority"); - } - runCommand("SPCAUT(" + setArrayToString(specialAuthority) + ")"); - } - - /** - Sets the special environment in which the user operates after signing on. - @param specialEnvironment The special environment in which the user operates after signing on. Possible values are: -
        -
      • "*SYSVAL" - The system value, QSPCENV, is used to determine the system environment after the user signs on the system. -
      • {@link #NONE NONE} - The user operates in the IBM i system environment after signing on the system. -
      • "*S36" - The user operates in the System/36 environment after signing on the system. -
      - @see #getSpecialEnvironment - **/ - public void setSpecialEnvironment(String specialEnvironment) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (specialEnvironment == null) - { - Trace.log(Trace.ERROR, "Parameter 'specialEnvironment' is null."); - throw new NullPointerException("specialEnvironment"); - } - runCommand("SPCENV(" + specialEnvironment + ")"); - } - - /** - Sets the status of the user profile. -

      The system will disable a user profile if the number of failed sign-on attempts reaches the limit specified on the QMAXSIGN system value and option 2 or 3 has been specified on the QMAXSGNACN system value. - @param status The status of the user profile. Possible values are: -

        -
      • "*ENABLED" - The user profile is valid for sign-on. -
      • "*DISABLED" - The user profile is not valid for sign-on until an authorized user enables it again. Batch jobs can be submitted under a disabled user profile. -
      - @see #getStatus - **/ - public void setStatus(String status) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (status == null) - { - Trace.log(Trace.ERROR, "Parameter 'status' is null."); - throw new NullPointerException("status"); - } - runCommand("STATUS(" + status + ")"); - } - - /** - Sets the user's supplemental group profiles. The profiles specified here, along with the group profile specified for the Group profile (GRPPRF) parameter, are used to determine what authority the user has if no specific user authority is given for the job. If profiles are specified for this parameter, a group profile name must be specified on the GRPPRF parameter for this user profile (either on this command or on a previous Create User Profile (CRTUSRPRF) or Change User Profile (CHGUSRPRF) command. The current user of this command must have object management (*OBJMGT) and change (*CHANGE) authority to the profiles specified for this. The required *OBJMGT authority cannot be given by a program adopt operation. -

      Notes: -

        -
      • When a group profile is specified, the user is automatically granted *CHANGE and *OBJMGT authority to the group profile. -
      • The following IBM-supplied user profiles are not valid for this parameter: -

        QAUTPROF, QCLUMGT, QCLUSTER, QCOLSRV, QDBSHR, QDBSHRDO, QDFTOWN, QDIRSRV, QDLFM, QDOC, QDSNX, QEJB, QFNC, QGATE, QIPP, QLPAUTO, QLPINSTALL, QMGTC, QMSF, QNETSPLF, QNFSANON, QNTP, QPEX, QPM400, QRJE, QSNADS, QSPL, QSPLJOB, QSRV, QSRVAGT, QSRVBAS, QSYS, QTCM, QTCP, QTFTP, QTSTRQS, QYCMCIMOM, QYPSJSVR -

      - @param supplementalGroups The user's supplemental group profiles. Possible values for the elements of this array are: -
        -
      • {@link #NONE NONE} - No supplemental group profiles are used with this user profile. -
      • The group profile names to be used with this user profile and the group profile specified on the GRPPRF parameter to determine a job's eligibility for getting access to existing objects and special authority. A maximum of 15 group profile names may be specified. - @see #getSupplementalGroups - **/ - public void setSupplementalGroups(String[] supplementalGroups) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (supplementalGroups == null) - { - Trace.log(Trace.ERROR, "Parameter 'supplementalGroups' is null."); - throw new NullPointerException("supplementalGroups"); - } - runCommand("SUPGRPPRF(" + setArrayToString(supplementalGroups) + ")"); - } - - /** - Sets the system object representing the system on which the user profile exists. This property cannot be changed if the object has established a connection to the system. - @param system The system object representing the system on which the user profile exists. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - @see #getSystem - **/ - public void setSystem(AS400 system) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system: " + system); - - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (connected_) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - system_ = system; - } - else - { - AS400 oldValue = system_; - AS400 newValue = system; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("system", oldValue, newValue); - } - system_ = system; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("system", oldValue, newValue); - } - } - } - - /** - Sets the level of activity that is audited for this user profile. Note: The system values QAUDLVL and QAUDLVL2 are used in conjunction with this parameter. Example: If QAUDLVL is set to *DELETE and AUDLVL is set to *CREATE, then both *DELETE and *CREATE would be audited for this user. The default value for the QAUDLVL and QAUDLVL2 system values is {@link #NONE NONE}. -

        Implementation note: The method internally calls the Change User Auditing (CHGUSRAUD) command and not the Change User Profile (CHGUSRPRF) command. The caller must have audit (*AUDIT) special authority. Changes take effect the next time a job is started for this user. - @param userActionAuditLevel The level of activity that is audited for this user profile. Possible values for the elements of this array are: -

          -
        • {@link #NONE NONE} - No auditing level is specified. The auditing level for this user is taken from system values QAUDLVL and QAUDLVL2. -
        • "*CMD" - CL command strings, System/36 environment operator control commands, and System/36 enviromnent procedures are logged for this user. -
        • "*CREATE" - Auditing entries are sent when objects are created by this user. -
        • "*DELETE" - Auditing entries are sent when objects are deleteed by this user. -
        • "*JOBDTA" - The following actions taken by this user that affect a job are audited: -
            -
          • Job start and stop data. -
          • Hold, release, stop, continue, change, disconnect, end, end abnormal. -
          • Program start request (PSR) is attached to a prestart job. -
          -
        • "*OBJMGT" - Object management changes made by this user, such as move or rename, are audited. -
        • "*OFCSRV" - Office services changes made by this user, such as changes to the system directory and use of OfficeVision, are audited. -
        • "*OPTICAL" - The following optical functions are audited: -
            -
          • Add or remove optical cartridge. -
          • Change the authorization list used to secure an optical volume. -
          • Open optical file or directory. -
          • Create or delete optical directory. -
          • Change or retrieve optical directory attributes. -
          • Copy, move, or rename optical file. -
          • Copy optical directory. -
          • Back up optical volume. -
          • Initialize or rename optical volume. -
          • Convert backup optical volume to a primary volume. -
          • Save or release help optical file. -
          • Absolute read of an optical volume. -
          -
        • "*PGMADP" - Authority obtained through program adoption is audited for this user. -
        • "*SAVRST" - Save and restore actions performed by this user are audited. -
        • "*SECURITY" - Security changes made by this user are audited. -
        • "*SERVICE" - User of the system service tools by this user is audited. -
        • "*SPLFDTA" - Spooled file operations made by this user are audited. -
        • "*SYSMGT" - Use of system management functions by this user are audited. -
        - @see #getUserActionAuditLevel - **/ - public void setUserActionAuditLevel(String[] userActionAuditLevel) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (userActionAuditLevel == null) - { - Trace.log(Trace.ERROR, "Parameter 'userActionAuditLevel' is null."); - throw new NullPointerException("userActionAuditLevel"); - } - runCommandAud("AUDLVL(" + setArrayToString(userActionAuditLevel) + ")"); - } - - /** - Sets the type of user associated with this user profile: security officer, security administrator, programmer, system operator, or user. The user class controls the options that are shown on a menu. Special authorities are given only if *USRCLS is specified for the Special authority (SPCAUT) parameter. If SPCAUT(*USRCLS) is specified, the special authorities granted will differ depending on the QSECURITY value. - @param userClassName The type of user associated with this user profile. Possible values are: -
          -
        • "*USER" - At QSECURITY level 10 or 20, the user has *ALLOBJ and *SAVSYS authority. At QSECURITY level 30 or above, the user has no special authorities. -
        • "*SECOFR" - At all levels of security, the security officer is granted the following special authorities: -
            -
          • *ALLOBJ -
          • *SAVSYS -
          • *JOBCTL -
          • *SERVICE -
          • *SPLCTL -
          • *SECADM -
          • *AUDIT -
          • *IOSYSCFG -
          -
        • "*SECADM" - At QSECURITY level 10 or 20, the security administrator has *ALLOBJ, *SAVSYS, *SECADM, and *JOBCTL special authorities. At QSECURITY level 30 or above, the user has *SECADM special authority. -
        • "*PGMR" - At QSECURITY level 10 or 20, the programmer has *ALLOBJ, *SAVSYS, and *JOBCTL special authorities. At QSECURITY level 30 or above, the user has no special authorities. -
        • "*SYSOPR" - At QSECURITY level 10 or 20, the system operator has *ALLOBJ, *SAVSYS, and *JOBCTL special authorities. At QSECURITY level 30 or above, the user has *SAVSYS and *JOBCTL special authorities. -
        - @see #getUserClassName - **/ - public void setUserClassName(String userClassName) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (userClassName == null) - { - Trace.log(Trace.ERROR, "Parameter 'userClassName' is null."); - throw new NullPointerException("userClassName"); - } - runCommand("USRCLS(" + userClassName + ")"); - } - - - /** - Sets the date when the user profile expires and is automatically disabled. -

        Note: Certain IBM-supplied user profiles cannot specify a user expiration date. -

        Note: This method should not be used when running to IBM i 6.1 or earlier releases. - @param expirationDate The date when the user profile expires and is automatically disabled. null is returned if the user profile does not have an expiration date. - @see #getUserExpirationDate - @see #setUserExpirationInterval - **/ - public void setUserExpirationDate(Date expirationDate) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, RequestNotSupportedException, ObjectDoesNotExistException - { - if (system_.getVRM() < 0x00070100) - { - String currentRelease = system_.getVersion() + "." + system_.getRelease(); - throw new RequestNotSupportedException(currentRelease, RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - } - - String expDate; - if (expirationDate == null) - { - expDate = NONE; - } - else - { - // The date must be specified in the "job date format". - String jobDateFormat = getJobDateFormat(); - byte[] dateBytes = getDateTimeConverter().convert(expirationDate, jobDateFormat); - expDate = DateTimeConverter.formatDateForCommandParameter(dateBytes, jobDateFormat); - } - - runCommand("USREXPDATE(" + expDate + ")"); - } - - - // Utility method. Returns this object's internal DateTimeConverter object. - // If we haven't already created dateConverter_, creates it now. - private final DateTimeConverter getDateTimeConverter() - { - if (dateConverter_ == null) { - dateConverter_ = new DateTimeConverter(system_); - } - return dateConverter_; - } - - - // Utility method. Gets the job date format for the job in which CHGUSRPRF will be run. - private final String getJobDateFormat() - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (jobDateFormat_ == null) - { - // First, get the CommandCall object that will be used to submit the CHGUSRPRF command. This will ensure that we're querying the correct job (on-thread versus off-thread). - CommandCall cmd = getCommandCallObject(COMMAND_CHGUSRPRF); - Job job = cmd.getServerJob(); - jobDateFormat_ = job.getDateFormat(); - } - return jobDateFormat_; - } - - - /** - Sets the expiration interval (in days) before the user profile is automatically disabled. - If the user profile does not have a user expiration date, or the user profile has expired and the Status parameter is set to *ENABLED, specifies the number of days between today and the new date when the user profile expires. If the user profile has not yet expired, the user expiration interval is changed, but the existing user expiration date is not changed. -

        Note: This method should not be used when running to IBM i 6.1 or earlier releases. - @param expirationInterval The number of days from today until the user profile is automatically disabled. Valid values range from 1 through 366. To specify that the user profile has no expiration interval, call {@link #setUserExpirationDate setUserExpirationDate(null)}. - @see #getUserExpirationInterval - @see #setUserExpirationDate - **/ - public void setUserExpirationInterval(int expirationInterval) - throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, RequestNotSupportedException - { - if (system_.getVRM() < 0x00070100) - { - String currentRelease = system_.getVersion() + "." + system_.getRelease(); - throw new RequestNotSupportedException(currentRelease, RequestNotSupportedException.SYSTEM_LEVEL_NOT_CORRECT); - } - - if (expirationInterval < 1 || expirationInterval > 366) - { - throw new ExtendedIllegalArgumentException("expirationInterval (" + expirationInterval + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - runCommand("USREXPITV(" + expirationInterval + ") USREXPDATE(*USREXPITV)"); - } - - /** - Sets the user ID number (uid number) for this user profile. The uid number is used to identify the user when the user is using the directory file system. The uid number for a user cannot be changed if there are one or more active jobs for the user. - @param userID The uid number to be assigned to the user profile. A value from 1 to 4294967294 can be entered. The uid number assigned must not already be assigned to another user profile. - @see #getUserID - **/ - public void setUserID(long userID) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - runCommand("UID(" + Long.toString(userID) + ")"); - } - - /** - Sets the level of help information detail to be shown and the function of the Page Up and Page Down keys by default. The system shows several displays that are suitable for the inexperienced user. More experienced users must perform an extra action to see detailed information. When values are specified for this parameter, the system presents detailed information without further action by the experienced user. - @param userOptions The level of help information detail to be shown and the function of the Page Up and Page Down keys by default. Possible values include: -

          -
        • {@link #NONE NONE} - Detailed information is not shown. -
        • "*CLKWD" - Parameter keywords are shown instead of the possible parameter values when a control language (CL) command is prompted. -
        • "*EXPERT" - More detailed information is shown when the user is performing display and edit options to define or change the system (such as edit or display object authority). -
        • "*ROLLKEY" - The actions of the Page Up and Page Down keys are reversed. -
        • "*NOSTSMSG" - Status messages are not displayed when sent to the user. -
        • "*STSMSG" - Status messages are displayed when sent to the user. -
        • "*HLPFULL" - Help text is shown on a full display rather than in a window. -
        • "*PRTMSG" - A message is sent to this user's message queue when a spooled file for this user is printed or held by the printer writer. -
        - @see #getUserOptions - **/ - public void setUserOptions(String[] userOptions) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (userOptions == null) - { - Trace.log(Trace.ERROR, "Parameter 'userOptions' is null."); - throw new NullPointerException("userOptions"); - } - runCommand("USROPT(" + setArrayToString(userOptions) + ")"); - } - - /** - Sets the string representation of this User object. - @return The user profile name. - **/ - public String toString() - { - return super.toString() + "[" + name_ + "]"; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/User16.gif b/cvsroot/src/com/ibm/as400/access/User16.gif deleted file mode 100644 index 0a35fe116..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/User16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/User32.gif b/cvsroot/src/com/ibm/as400/access/User32.gif deleted file mode 100644 index 6c0bd075b..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/User32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/UserBeanInfo.java b/cvsroot/src/com/ibm/as400/access/UserBeanInfo.java deleted file mode 100644 index c4042d893..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserBeanInfo.java +++ /dev/null @@ -1,136 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - The UserBeanInfo class represents the bean information for the User class. - **/ -public class UserBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - // Class this bean info represents. - private static final Class BEAN_CLASS = User.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - - eventSetDescriptors = new EventSetDescriptor[] { propertyChange, vetoableChange }; - - PropertyDescriptor system = new PropertyDescriptor("system", BEAN_CLASS); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - - PropertyDescriptor name = new PropertyDescriptor("name", BEAN_CLASS); - name.setBound(true); - name.setConstrained(true); - name.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_NAME")); - name.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_NAME")); - - propertyDescriptors = new PropertyDescriptor[] { system, name }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return Zero (0), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "propertyChange" event. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. Possible values are: -
          -
        • BeanInfo.ICON_MONO_16x16 -
        • BeanInfo.ICON_MONO_32x32 -
        • BeanInfo.ICON_COLOR_16x16 -
        • BeanInfo.ICON_COLOR_32x32 -
        - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("User16.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("User32.gif"); - } - Trace.log(Trace.ERROR, "Value of parameter 'icon' is not valid:", icon); - throw new ExtendedIllegalArgumentException("icon (" + icon + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/UserEnumeration.java b/cvsroot/src/com/ibm/as400/access/UserEnumeration.java deleted file mode 100644 index 3ed8db9d8..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserEnumeration.java +++ /dev/null @@ -1,83 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserEnumeration.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.Enumeration; -import java.util.NoSuchElementException; - -// Helper class. Used to wrap the User[] with an Enumeration. -// This class is used by UserList. -class UserEnumeration implements Enumeration -{ - // The user list object from which to get the users. - private UserList list_ = null; - - // The number of objects returned so far by nextElement() - private int counter_; - - // The number of users in the list. - private int length_ = 0; - - // Offset in the user list. - private int listOffset_ = 0; - - // Cache of user objects. - private User[] userCache_ = null; - // Offset in the cache. - private int cacheOffset_ = 0; - - UserEnumeration(UserList list, int length) - { - list_ = list; - length_ = length; - } - - public final boolean hasMoreElements() - { - return counter_ < length_; - } - - public final Object nextElement() - { - if (counter_ >= length_) - { - Trace.log(Trace.ERROR, "Next element not available in UserEnumeration."); - throw new NoSuchElementException(); - } - - if (userCache_ == null || cacheOffset_ >= userCache_.length) - { - try - { - userCache_ = list_.getUsers(listOffset_, 1000); - cacheOffset_ = 0; - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loaded next block in UserEnumeration: " + userCache_.length + " messages at list offset " + listOffset_ + " out of " + length_ + " total."); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Exception while loading nextElement() in UserEnumeration:", e); - throw new NoSuchElementException(); - } - - // We have a freshly loaded cache, so reset to the beginning of the cache. - cacheOffset_ = 0; - - // Set starting offset for next call to getUsers(), - // in case another call is needed. - listOffset_ += userCache_.length; - } - ++counter_; - return userCache_[cacheOffset_++]; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/UserGroup.java b/cvsroot/src/com/ibm/as400/access/UserGroup.java deleted file mode 100644 index 40dea7b40..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserGroup.java +++ /dev/null @@ -1,72 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserGroup.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.util.Enumeration; - -/** - The UserGroup class represents a user profile that is a group profile. - @see com.ibm.as400.access.User - @see com.ibm.as400.access.UserList - **/ -public class UserGroup extends User -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - static final long serialVersionUID = 5L; - - // Private data. - private UserList userList_ = null; - - /** - Constructs a UserGroup object. Note that this constructor no longer throws any of the declared exceptions, but they remain for compatibility. - @param system The system object representing the system on which the group profile exists. - @param name The group profile name. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public UserGroup(AS400 system, String name) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - super(system, name); - } - - // Called by UserList.getUsers(). - UserGroup(AS400 system, String name, boolean groupHasMember, String description) - { - super(system, name, groupHasMember, description); - } - - /** - Returns the list of users that are members of this group. - @return An Enumeration of {@link com.ibm.as400.access.User User} objects. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @exception RequestNotSupportedException If the requested function is not supported because the system is not at the correct level. - **/ - public Enumeration getMembers() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, RequestNotSupportedException - { - if (userList_ == null) - { - userList_ = new UserList(getSystem(), UserList.MEMBER, getName()); - } - return userList_.getUsers(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/UserIndex.java b/cvsroot/src/com/ibm/as400/access/UserIndex.java deleted file mode 100644 index edd59e3e5..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserIndex.java +++ /dev/null @@ -1,527 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserIndex.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2010-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.util.Arrays; - -/** - The UserIndex class represents an IBM i user index object. - - This class currently will only function when running on the IBM i using native Methods. - -

        As a performance optimization, when running directly on IBM i, it is possible to use native - methods to access the user space from the current job. To enable this support, use the - {@link #setMustUseNativeMethods setMustUseNativeMethods()} method. - - **/ - -public class UserIndex -{ - /* search rules */ - public static final int FIND_EQUALS = 0x0001; - public static final int FIND_GREATER = 0x0002 ; - public static final int FIND_LESSER = 0x0003; - public static final int FIND_NOT_LESSER = 0x0004; - public static final int FIND_NOT_GREATER = 0x0005; - public static final int FIND_FIRST = 0x0006; - public static final int FIND_LAST = 0x0007; - public static final int FIND_BETWEEN = 0x0008; - - /* Entry length attribute */ - public static final byte FIXED_LENGTH_ENTRIES = (byte) 0xc6; - public static final byte VARIABLE_LENGTH_ENTRIES = (byte) 0xe5; - /* Key insertion */ - public static final byte INSERTION_BY_KEY = (byte) 0xf1; - public static final byte NO_INSERTION_BY_KEY = (byte) 0xf0; - /* Immediate update options */ - public static final byte IMMEDIATE_UPDATE = (byte) 0xF1; - public static final byte NO_IMMEDIATE_UPDATE= (byte) 0xF0; - /* optimization options */ - public static final byte OPTIMIZE_FOR_RANDOM_REFERENCES = (byte) 0xF0; - public static final byte OPTIMIZE_FOR_SEQUENTIAL_REFERENCES = (byte) 0xF1; - - /* insertion rules */ - /** - * Insert unique argument. The RULE_INSERT is valid only for indexes not containing keys - * */ - public static final int RULE_INSERT = 0x0001; - /** - * Insert argument, replacing the nonkey portion if the key is already in the index - */ - public static final int RULE_INSERT_REPLACE = 0x0002; - /** - * Insert argument only if the key is not already in the index - */ - public static final int RULE_INSERT_NO_REPLACE = 0x0003; - - - private static byte[] IDXA0100 = {(byte)0xc9, (byte)0xc4, (byte)0xe7, (byte)0xc1, (byte)0xf0, (byte)0xf1, (byte)0xf0, (byte)0xf0}; - // Use native methods when running natively; - private boolean mustUseNativeMethods_ = false; - - - AS400 system_; - String path_; - private byte[] insertKeyValueBytes_; - private byte[] insertOptionBytes_; - private byte entryLengthAttribute_; - private int entryLength_; - private int keyLength_; - private int valueLength_; - private int handle_; /* handle for native method */ - private byte[] objectNameBytes_; /* name of the object in ebcdic */ - private byte[] findOptionBytes_; - UserIndexNativeImpl impl_; - - /** - Constructs a UserIndex object. - @param system The system object representing the system on which the user index exists. - @param path The fully qualified integrated file system path name of the user index. - - **/ - public UserIndex(AS400 system, String path) throws Exception - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing UserIndex object."); - system_ = system; - path_ = path; - - objectNameBytes_ = new byte[20]; - - Arrays.fill(objectNameBytes_, (byte) 0x40); - if (path.indexOf("/QSYS.LIB/") == 0) { - path = path.substring(9); - } - - if (path.charAt(0) != '/') { - throw new Exception("Path does not begin with / : "+path); - } - int libIndex = path.indexOf(".LIB/"); - if (libIndex < 2) { - throw new Exception("Path does not contain .LIB / : "+path); - } - String lib = path.substring(1,libIndex); - byte[] libBytes = lib.getBytes("IBM-037"); - - int usridxIndex = path.indexOf(".USRIDX"); - if (usridxIndex < libIndex) { - throw new Exception("Path does not contain .USRIDX / : "+path); - } - - String indexName = path.substring(libIndex+5, usridxIndex); - byte[] indexNameBytes = indexName.getBytes("IBM-037"); - - System.arraycopy(indexNameBytes, 0, objectNameBytes_, 0, indexNameBytes.length); - System.arraycopy(libBytes, 0, objectNameBytes_, 10, libBytes.length); - - handle_ = 0; - - - // - // Pick the impl - // - - impl_ = new UserIndexNativeImplILE(); - } - - /** - Creates a user index on the system. The index will be created with the attributes provided. - @param extendedAttribute The extended attribute of the user index to be created. - @param entryLengthAttribute Length attribute of the queue entries. Must be set to - FIXED_LENGTH_ENTRIES or VARIABLE_LENGTH_ENTRIES. Currently only FIXED_LENGTH_ENTRIES is supported. - @param entryLength The length of entries in the index. - The valid values for fixed-length entries are from 1 through 2000. - Valid values for variable length entries are 0 or -1. - A value of 0 enables a maximum entry length of 120 bytes and a key length from 1 through 120. - A value of -1 enables a maximum entry length of 2000 and a key length from 1 through 2000. - @param keyInsertion Whether the inserts to the index are by key. The valid values are: - INSERTION_BY_KEY and NO_INSERTION_BY_KEY - @param keyLength The length of the key where the first byte of an entry is the beginning of the key for the index entries. - The value for this parameter must be 0 for NO_INSERTION_BY_KEY. - If you specify key length insertion, this value is from 1 through 2000 - @param immediateUpdate Whether the updates to the index are written synchronously to auxiliary storage on each - update to the index. The valid values are: IMMEDIATE_UPDATE and NO_IMMEDIATE_UPDATE. - @param optimization The type of access in which to optimize the index. The valid values are: OPTIMIZE_FOR_RANDOM_REFERENCES and OPTIMIZE_FOR_SEQUENTIAL_REFERENCES. - - @param authority The public authority for the user space. This string must be 10 characters or less. - Valid values are: -

          -
        • *ALL -
        • *CHANGE -
        • *EXCLUDE -
        • *LIBCRTAUT -
        • *USE -
        • authorization-list name -
        - @param description - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectAlreadyExistsException If the object already exists on the system. - **/ - public void create(String extendedAttribute, - byte entryLengthAttribute, - int entryLength, - byte keyInsertion, - int keyLength, - byte immediateUpdate, - byte optimization, - String authority, - String description - ) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectAlreadyExistsException, Exception - { - entryLengthAttribute_ = entryLengthAttribute; - entryLength_ = entryLength; - keyLength_ = keyLength; - valueLength_ = entryLength_ - keyLength ; - - byte[] extendedAttributeBytes = extendedAttribute.getBytes("IBM-037"); - byte[] publicAuthorityBytes = authority.getBytes("IBM-037"); - byte[] descriptionBytes = description.getBytes("IBM-037"); - - int valueLength = entryLength - keyLength; - if (valueLength <= 0) { - throw new Exception("Entry lentgh attribute of "+entryLength+" not correct for key length of "+keyLength); - } - - if (entryLengthAttribute_ != FIXED_LENGTH_ENTRIES) { - throw new Exception("Entry lenth attribute of "+entryLengthAttribute+" not supported: Valid values = "+FIXED_LENGTH_ENTRIES); - } - - - handle_ = impl_.createAndOpen( - objectNameBytes_, - extendedAttributeBytes, - entryLengthAttribute, - entryLength, - keyInsertion, - keyLength, - immediateUpdate, - optimization, - publicAuthorityBytes, - descriptionBytes); - - - - } - - - /** - * Deletes the user index. - */ - public void delete() { - impl_.delete(handle_, objectNameBytes_); - handle_ = 0; - } - - /** - * Inserts key and value represented as Strings into the INDEX. The values - * are stored in the index using the translation CCSID (Currently IBM-037) - * - * @param key - * The key for the new entry - * @param value - * The value portion of the new entry - * @param insertionRuleOption - * The rule used for inserting the entries. Valid values are : - * RULE_INSERT, RULE_INSERT_REPLACE, RULE_INSERT_NO_REPLACE - */ - public void insertEntry(String key, String value, int insertionRuleOption) throws Exception { - byte[] keyBytes = key.getBytes("IBM-037"); - byte[] valueBytes = value.getBytes("IBM-037"); - - if (handle_ == 0) { - open(); - } - - if (entryLengthAttribute_ == FIXED_LENGTH_ENTRIES) { - if (valueBytes.length > entryLength_ - keyLength_) { - throw new Exception("value too long " + value); - } - } else { - throw new Exception("EntryLengthAttribute of " - + entryLengthAttribute_ + " Not yet supported"); - } - - if (insertOptionBytes_ == null) { - insertOptionBytes_ = new byte[20]; - } - if (insertKeyValueBytes_ == null) { - insertKeyValueBytes_ = new byte[entryLength_]; - } - synchronized (insertKeyValueBytes_) { - Arrays.fill(insertKeyValueBytes_, (byte) 0x40); - if (entryLengthAttribute_ == FIXED_LENGTH_ENTRIES) { - System.arraycopy(keyBytes, 0, insertKeyValueBytes_, 0, - keyBytes.length); - System.arraycopy(valueBytes, 0, insertKeyValueBytes_, - keyLength_, valueBytes.length); - } - resetOptionBytes(insertOptionBytes_); - setOptionBytesRule(insertOptionBytes_, insertionRuleOption); - setOptionBytesOccCount(insertOptionBytes_, 1); - if (handle_ == 0) { - open(); - } - impl_.insertEntry(handle_, insertKeyValueBytes_, insertOptionBytes_); - } /* synchronized */ - } - - - /** - Inserts one or more entries into the user index using the insinxen MI instruction. For more information, see the following: - http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=/rzatk/INSINXEN.htm - - @param entryBytes Byte array containing the bytes of the entry or entries to be inserted. - @param optionBytes Byte array containing insertion options. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void insertEntry(byte[] entryBytes, byte[] optionBytes) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (handle_ == 0) { - open(); - } - impl_.insertEntry(handle_, entryBytes, optionBytes); - } - - - /** - * Returns one or more entries from the user index. The entries are returned as two element string - * arrays, where the first entry of each array is the key and the second entry is the value. - * The translation is done using the translation CCSID (Currently IBM-037). - * - * Currently only supported for fixed length keys. - */ - - public String[][] findEntries(String key, int rule, int occCount) throws Exception { - String[][] returnValue = null; - - if (handle_ == 0) { - open(); - } - - if (entryLengthAttribute_ != FIXED_LENGTH_ENTRIES) { - throw new Exception("Unsupported entryLengthAttribute=0x"+Integer.toHexString(0xFF & entryLengthAttribute_)); - } - byte[] keyBytes = key.getBytes("IBM-037"); - byte[] outputBuffer = new byte[occCount * (entryLength_)]; - byte[] findOptionBytes; - if (occCount == 1) { - if (findOptionBytes_ == null) { - findOptionBytes_ = new byte[40]; - } - findOptionBytes = findOptionBytes_; - } else { - findOptionBytes = new byte[10+4*occCount]; - } - - synchronized (findOptionBytes) { - setOptionBytesOccCount(findOptionBytes, occCount); - setOptionBytesRule(findOptionBytes, rule); - setOptionBytesArgLength(findOptionBytes, keyBytes.length); - - impl_.findEntries(handle_, outputBuffer, findOptionBytes, keyBytes); - - int returnCount = getOptionBytesReturnCount(findOptionBytes); - - // Divide string into arrays. This is to avoid excessive object - // creation - // by the native code. - - returnValue = new String[returnCount][]; - if (entryLengthAttribute_ == FIXED_LENGTH_ENTRIES) { - for (int i = 0; i < returnCount; i++) { - int entryStart = i * entryLength_; - returnValue[i] = new String[2]; - returnValue[i][0] = new String(outputBuffer, entryStart, - keyLength_, "IBM-037"); - returnValue[i][1] = new String(outputBuffer, entryStart - + keyLength_, valueLength_, "IBM-037"); - } - - } else { - throw new Exception("EntryLengthAttribute of " - + entryLengthAttribute_ + " Not yet supported"); - } - } - return returnValue; - - - } - - - - - /** - * Returns one or more entries from the user index using the FNDINXEN MI instruction. - * For more information, - * see http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=/rzatk/FNDINXEN.htm. - * - * @param outputBytes Byte array into which the returned entries are placed. - * @param optionBytes Byte array containing the options for the query. Also returns - * information about the retrieved entries. - * @param keyBytes Byte array containing the key used to find the entries. - */ - public void findEntries(byte[] outputBytes, byte[] optionBytes, byte[] keyBytes) throws Exception { - if (handle_ == 0) { - open(); - } - impl_.findEntries(handle_, outputBytes, optionBytes, keyBytes); - } - - - - - /** - Returns the String representation of this user index object. - @return The String representation of this user index object. - **/ - public String toString() - { - return "UserIndex " + path_; - } - - - /** - Indicates if the native methods will be used internally to perform user index insertion and retrieval requests. - @return true if user index insertion and retrieval requests will be performed via native methods; false otherwise. - @see #setMustUseNativeMethods - **/ - - public boolean isMustUseNativeMethods() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if user index must use native methods:", mustUseNativeMethods_); - return mustUseNativeMethods_; - } - - /** - Specifies whether native methods are used by the current job to perform user index operations. - This option can only be set to true when the application is running on the System i. - @param useNativeMethods Internally use ProgramCall to perform read and write requests. - @see #isMustUseNativeMethods - **/ - public void setMustUseNativeMethods(boolean useNativeMethods) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting if user index must use native methods:", useNativeMethods); - mustUseNativeMethods_ = useNativeMethods; - } - - private void open() { - - handle_ = impl_.open(objectNameBytes_); - - - byte[] outputBytes = new byte[60]; - - // Output is the following - // - // Offset Type Field - // Dec Hex - // 0 0 BINARY(4) Bytes returned - // 4 4 BINARY(4) Bytes available - // 8 8 CHAR(10) User index name - // 18 12 CHAR(10) User index library name - // 28 1C CHAR(1) Entry length attribute - // 29 1D CHAR(1) Immediate update - // 30 1E CHAR(1) Key insertion - // 31 1F CHAR(1) Optimized processing mode - // 32 20 CHAR(4) Reserved - // 36 24 BINARY(4) Entry length - // 40 28 BINARY(4) Maximum entry length - // 44 2C BINARY(4) Key length - // 48 30 BINARY(4) Number of entries added - // 52 34 BINARY(4) Number of entries removed - // 56 38 BINARY(4) Number of retrieve operations - - impl_.getAttributes(outputBytes, IDXA0100, objectNameBytes_); - - entryLengthAttribute_ = outputBytes[28]; - entryLength_ = (0xFF & outputBytes[36]) * 0x1000000+ - (0xFF & outputBytes[37]) * 0x10000+ - (0xFF & outputBytes[38]) *0x100+ - (0xFF & outputBytes[39]); - keyLength_ = (0xFF & outputBytes[44])*0x1000000+ - (0xFF & outputBytes[45])*0x10000+ - (0xFF & outputBytes[46])*0x100+ - (0xFF & outputBytes[47]); - valueLength_ = entryLength_ - keyLength_; - - } - - - - /** Utility method to reset the optionBytes. The layout of the optionBytes is the following - * Offset - * Dec Hex Field Name Data Type and Length - * 0 0 Rule option short - * 2 2 Argument length unsigned short - * 4 4 Argument offset short - * 6 6 Occurrence count short - * 8 8 Return count short - * 10 A Returned index entry (unsigned short,short) - (Repeated return count times) - * 10 A Entry length unsigned short - * 12 C Entry offset short - * - * The occurrence count is limited to a maximum value of 4095. - * The number of bytes in the optionBytes must be at least - * 10 + 4 * "Occurrence Count" - */ - public static void resetOptionBytes(byte[] optionBytes) { - Arrays.fill(optionBytes, (byte) 0x0); - } - - /** - * Utility method to set the rule option in the option bytes - */ - public static void setOptionBytesRule(byte[] optionBytes, int insertionRuleOption) { - optionBytes[0] = 0; - optionBytes[1] = (byte) (insertionRuleOption & 0xFF); - } - /** - * Utility method to set the argument length in the option bytes - */ - public static void setOptionBytesArgLength(byte[] optionBytes, int argLength) { - optionBytes[2] = (byte) ((argLength / 0x100) & 0xFF); - optionBytes[3] = (byte) (argLength & 0xFF); - } - /** - * Utility method to set the occurrence count in the option bytes - */ - public static void setOptionBytesOccCount(byte[] optionBytes, int occurrenceCount) { - optionBytes[6] = (byte) ((occurrenceCount / 0x100) & 0xFF); - optionBytes[7] = (byte) (occurrenceCount & 0xFF); - } - - - /** - * Utility method to obtain the return count from the option bytes. - * @param optionBytes - * @return return count - */ - public static int getOptionBytesReturnCount(byte[] optionBytes) { - return (((int) optionBytes[8]) & 0xFF) * 0x100 + (((int) optionBytes[9]) & 0xFF); - } - - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/UserIndexNativeImpl.java b/cvsroot/src/com/ibm/as400/access/UserIndexNativeImpl.java deleted file mode 100644 index 757fa2560..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserIndexNativeImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserIndex.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2010-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - - -interface UserIndexNativeImpl -{ - - /* native methods */ - void insertEntry(int handle, byte[] entryBytes, byte[] optionBytes) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException; - void findEntries(int handle, byte[] outputBytes, byte[] optionBytes, byte[] keyBytes) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException; - int createAndOpen( - byte[]objectNameBytes, - byte[] extendedAttributeBytes, - byte entryLengthAttribute, - int entryLength, - byte keyInsertion, - int keyLength, - byte immediateUpdate, - byte optimization, - byte[] publicAuthorityBytes, - byte[] descriptionBytes) ; - void closeHandle(int handle); - int open(byte[] objectNameBytes); - int delete(int handle, byte[] objectNameBytes); - int getAttributes(byte[] outputBytes, byte[] formatBytes, byte[]objectNameBytes); - - -} diff --git a/cvsroot/src/com/ibm/as400/access/UserIndexNativeImplILE.java b/cvsroot/src/com/ibm/as400/access/UserIndexNativeImplILE.java deleted file mode 100644 index cc843a4c9..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserIndexNativeImplILE.java +++ /dev/null @@ -1,79 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserIndex.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2010-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - - -class UserIndexNativeImplILE implements UserIndexNativeImpl -{ - - static { - /* Make sure the library is loaded */ - NativeMethods.loadNativeLibraryQyjspart(); - } - - /* native methods */ - public void insertEntry(int handle, byte[] entryBytes, byte[] optionBytes) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException { - nativeInsertEntry(handle, entryBytes, optionBytes); - } - public void findEntries(int handle, byte[] outputBytes, byte[] optionBytes, byte[] keyBytes) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException { - nativeFindEntries(handle, outputBytes, optionBytes, keyBytes); - } - public int createAndOpen( - byte[]objectNameBytes, - byte[] extendedAttributeBytes, - byte entryLengthAttribute, - int entryLength, - byte keyInsertion, - int keyLength, - byte immediateUpdate, - byte optimization, - byte[] publicAuthorityBytes, - byte[] descriptionBytes) { - return nativeCreateAndOpen(objectNameBytes, extendedAttributeBytes, entryLengthAttribute, entryLength, keyInsertion, keyLength, immediateUpdate, optimization, publicAuthorityBytes, descriptionBytes); - } - public void closeHandle(int handle){ - nativeCloseHandle(handle); - } - public int open(byte[] objectNameBytes){ - return nativeOpen(objectNameBytes); - } - public int delete(int handle, byte[] objectNameBytes) { - return nativeDelete(handle, objectNameBytes); - } - public int getAttributes(byte[] outputBytes, byte[] formatBytes, byte[] objectNameBytes) { - return nativeGetAttributes(outputBytes, formatBytes, objectNameBytes); - } - - private native void nativeInsertEntry(int handle, byte[] entryBytes, byte[] optionBytes) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException; - private native void nativeFindEntries(int handle, byte[] outputBytes, byte[] optionBytes, byte[] keyBytes) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException; - private native int nativeCreateAndOpen( - byte[]objectNameBytes, - byte[] extendedAttributeBytes, - byte entryLengthAttribute, - int entryLength, - byte keyInsertion, - int keyLength, - byte immediateUpdate, - byte optimization, - byte[] publicAuthorityBytes, - byte[] descriptionBytes) ; - private native void nativeCloseHandle(int handle); - private native int nativeOpen(byte[] objectNameBytes); - private native int nativeDelete(int handle, byte[] objectNameBytes); - private native int nativeGetAttributes(byte[] outputBytes, byte[] formatBytes, byte[] objectNameBytes); - - -} diff --git a/cvsroot/src/com/ibm/as400/access/UserList.java b/cvsroot/src/com/ibm/as400/access/UserList.java deleted file mode 100644 index d906eeb11..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserList.java +++ /dev/null @@ -1,756 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.Serializable; -import java.util.Enumeration; - -/** - Represents a list of user profiles on the system. -

        Implementation note: This class internally uses the Open List APIs (such as QGYOLAUS). - @see com.ibm.as400.access.User - @see com.ibm.as400.access.UserGroup - **/ -public class UserList implements Serializable -{ - static final long serialVersionUID = 5L; - - /** - Selection value indicating that the list contains all user profiles and group profiles. - **/ - public static final String ALL = "*ALL"; - - /** - Selection value indicating that the list contains only user profiles that are not group profiles. These are user profiles that do not have a group identifier specified. - **/ - public static final String USER = "*USER"; - - /** - Selection value indicating that the list contains only user profiles that are group profiles. These are user profiles that have a group identifier specified. - **/ - public static final String GROUP = "*GROUP"; - - /** - Selection value indicating that the list contains only user profiles that are members of a specified group. - **/ - public static final String MEMBER = "*MEMBER"; - - /** - Selection value indicating that no group profile is specified. - **/ - public static final String NONE = "*NONE"; - - /** - Selection value indicating that the list contains only user profiles that are not group profiles. These are user profiles that do not have a group identifier specified. - **/ - public static final String NOGROUP = "*NOGROUP"; - - // The system where the users are located. - private AS400 system_ = null; - // The selection criteria for which users are returned. - private String userInfo_ = ALL; - // The secection criteria for the group profile whose members are returned. - private String groupInfo_ = NONE; - // The profile names to include in the list. - private String userProfile_ = ALL; - - // Length of the user list. - private int length_ = 0; - // Handle that references the user space used by the open list APIs. - private byte[] handle_ = null; - // If the user or group info has changed, close the old handle before loading the new one. - private boolean closeHandle_ = false; - - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_ = null; // Set on first add. - // List of vetoable change event bean listeners. - private transient VetoableChangeSupport vetoableChangeListeners_ = null; // Set on first add. - - /** - Constructs a UserList object. The {@link #setSystem system} must be set before calling any of the methods that connect to the system. The userInfo parameter defaults to {@link #ALL ALL}, the groupInfo parameter defaults to {@link #NONE NONE}, and the userProfile parameter defaults to {@link #ALL ALL}. - **/ - public UserList() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing UserList object."); - } - - /** - Constructs a UserList object. The userInfo parameter defaults to {@link #ALL ALL}, the groupInfo parameter defaults to {@link #NONE NONE}, and the userProfile parameter defaults to {@link #ALL ALL}. - @param system The system object representing the system on which the users exists. - **/ - public UserList(AS400 system) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing UserList object, system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - system_ = system; - } - - /** - Constructs a UserList object. The userProfile parameter defaults to {@link #ALL ALL}. - @param system The system object representing the system on which the users exists. - @param userInfo The users to be returned. Possible values are: -

          -
        • {@link #ALL ALL} - All user profiles and group profiles are returned. -
        • {@link #USER USER} - Only user profiles that are not group profiles are returned. These are user profiles that do not have a group identifier specified. -
        • {@link #GROUP GROUP} - Only user profiles that are group profiles are returned. These are user profiles that have a group identifier specified. -
        • {@link #MEMBER MEMBER} - User profiles that are members of the group specified for groupInfo are returned. -
        - @param groupInfo The group profile whose members are to be returned. Possible values are: -
          -
        • {@link #NONE NONE} - No group profile is specified. -
        • {@link #NOGROUP NOGROUP} - Users who are not a member of any group are returned. -
        • The group profile name - Users who are a member of this group are returned. -
        - **/ - public UserList(AS400 system, String userInfo, String groupInfo) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing UserList object, system: " + system + ", user info: " + userInfo + ", group info: " + groupInfo); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (userInfo == null) - { - Trace.log(Trace.ERROR, "Parameter 'userInfo' is null."); - throw new NullPointerException("userInfo"); - } - if (groupInfo == null) - { - Trace.log(Trace.ERROR, "Parameter 'groupInfo' is null."); - throw new NullPointerException("groupInfo"); - } - if (groupInfo.length() > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'groupInfo' is not valid: '" + groupInfo + "'"); - throw new ExtendedIllegalArgumentException("groupInfo (" + groupInfo + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - if (!userInfo.equals(ALL) && !userInfo.equals(USER) && !userInfo.equals(GROUP) && !userInfo.equals(MEMBER)) - { - Trace.log(Trace.ERROR, "Value of parameter 'userInfo' is not valid: " + userInfo); - throw new ExtendedIllegalArgumentException("userInfo (" + userInfo + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (userInfo.equals(MEMBER) && groupInfo.equals(NONE)) - { - Trace.log(Trace.ERROR, "Value of parameter 'groupInfo' is not valid: " + groupInfo); - throw new ExtendedIllegalArgumentException("groupInfo (" + groupInfo + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (!userInfo.equals(MEMBER) && !groupInfo.equals(NONE)) - { - Trace.log(Trace.ERROR, "Value of parameter 'groupInfo' is not valid: " + groupInfo); - throw new ExtendedIllegalArgumentException("groupInfo (" + groupInfo + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - system_ = system; - userInfo_ = userInfo; - groupInfo_ = groupInfo; - } - - /** - Constructs a UserList object. - @param system The system object representing the system on which the users exists. - @param userInfo The users to be returned. Possible values are: -
          -
        • {@link #ALL ALL} - All user profiles and group profiles are returned. -
        • {@link #USER USER} - Only user profiles that are not group profiles are returned. These are user profiles that do not have a group identifier specified. -
        • {@link #GROUP GROUP} - Only user profiles that are group profiles are returned. These are user profiles that have a group identifier specified. -
        • {@link #MEMBER MEMBER} - User profiles that are members of the group specified for groupInfo are returned. -
        - @param groupInfo The group profile whose members are to be returned. Possible values are: -
          -
        • {@link #NONE NONE} - No group profile is specified. -
        • {@link #NOGROUP NOGROUP} - Users who are not a member of any group are returned. -
        • The group profile name - Users who are a member of this group are returned. -
        - @param userProfile The profile names to include in the list. Possible values are: -
          -
        • {@link #ALL ALL} - All profiles are returned. -
        • The user profile name - If a generic profile name is specifed, the profiles that match the the generic name are returned. If a simple profile name is specified, only that profile is returned. -
        - **/ - public UserList(AS400 system, String userInfo, String groupInfo, String userProfile) - { - this(system, userInfo, groupInfo); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing UserList object, userProfile: " + userProfile); - if (userProfile == null) - { - Trace.log(Trace.ERROR, "Parameter 'userProfile' is null."); - throw new NullPointerException("userProfile"); - } - if (userProfile.length() > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'userProfile' is not valid: '" + userProfile + "'"); - throw new ExtendedIllegalArgumentException("userProfile (" + userProfile + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - userProfile_ = userProfile; - } - - /** - Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange() method will be called each time the value of any bound property is changed. - @param listener The listener. - @see #removePropertyChangeListener - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - } - - /** - Adds a VetoableChangeListener. The specified VetoableChangeListener's vetoableChange() method will be called each time the value of any constrained property is changed. - @param listener The listener. - @see #removeVetoableChangeListener - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - synchronized (this) - { - // If first add. - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - } - - /** - Closes the user list on the system. This releases any system resources previously in use by this user list. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #load - **/ - public synchronized void close() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Closing user list, handle: ", handle_); - if (handle_ == null) return; - - try { - ListUtilities.closeList(system_, handle_); - } - finally { - handle_ = null; - closeHandle_ = false; - } - } - - /** - Returns the group profile whose members are to be returned. - @return The group profile whose members are to be returned. Possible values are: -
          -
        • {@link #NONE NONE} - No group profile is specified. -
        • {@link #NOGROUP NOGROUP} - Users who are not a member of any group are returned. -
        • The group profile name - Users who are a member of this group are returned. -
        - **/ - public String getGroupInfo() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting group info: " + groupInfo_); - return groupInfo_; - } - - /** - Returns the number of users in the user list. This method implicitly calls {@link #load load()}. - @return The number of users, or 0 if no list was retrieved. - @see #load - **/ - public synchronized int getLength() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting user list length."); - try - { - if (handle_ == null || closeHandle_) load(); - } - catch (Exception e) - { - Trace.log(Trace.ERROR, "Exception caught getting length of user list:", e); - if (e instanceof ExtendedIllegalStateException) throw (ExtendedIllegalStateException)e; - } - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Length:", length_); - return length_; - } - - /** - Returns the system object representing the system on which the users exist. - @return The system object representing the system on which the users exist. If the system has not been set, null is returned. - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - /** - Returns the description of which users are returned. - @return The description of which users are returned. Possible values are: -
          -
        • {@link #ALL ALL} - All user profiles and group profiles are returned. -
        • {@link #USER USER} - Only user profiles that are not group profiles are returned. These are user profiles that do not have a group identifier specified. -
        • {@link #GROUP GROUP} - Only user profiles that are group profiles are returned. These are user profiles that have a group identifier specified. -
        • {@link #MEMBER MEMBER} - User profiles that are members of the group specified for the group info are returned. -
        - **/ - public String getUserInfo() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting user info: " + userInfo_); - return userInfo_; - } - - /** - Returns the user profile names of which users are returned. - @return The profile names of which users are returned. Possible values are: -
          -
        • {@link #ALL ALL} - All profiles are returned. -
        • The user profile name - If a generic profile name is specifed, the profiles that match the the generic name are returned. If a simple profile name is specified, only that profile is returned. -
        - **/ - public String getUserProfile() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting user profile: " + userProfile_); - return userProfile_; - } - - /** - Returns the list of users in the user list. - @return An Enumeration of {@link com.ibm.as400.access.User User} and/or {@link com.ibm.as400.access.UserGroup UserGroup} objects. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the system object does not exist. - @exception RequestNotSupportedException If the requested function is not supported because the system is not at the correct level. - @see #close - @see #load - **/ - public synchronized Enumeration getUsers() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, RequestNotSupportedException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving user list."); - // Need to get the length. - if (handle_ == null || closeHandle_) load(); - - return new UserEnumeration(this, length_); - } - - /** - Returns a subset of the list of users. This method allows the user to retrieve the user list from the system in pieces. If a call to {@link #load load()} is made (either implicitly or explicitly), then the users at a given list offset will change, so a subsequent call to getUsers() with the same listOffset and number will most likely not return the same Users as the previous call. - @param listOffset The offset in the list of users (0-based). This value must be greater than or equal to 0 and less than the list length; or specify -1 to retrieve all of the users. - Note: Prior to JTOpen 7.2, this parameter was incorrectly described. - @param number The number of users to retrieve out of the list, starting at the specified listOffset. This value must be greater than or equal to 0 and less than or equal to the list length. If the listOffset is -1, this parameter is ignored. - @return The array of retrieved {@link com.ibm.as400.access.User User} and/or {@link com.ibm.as400.access.UserGroup UserGroup} objects. The length of this array may not necessarily be equal to number, depending upon the size of the list on the system, and the specified listOffset. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see com.ibm.as400.access.Job - @see #close - @see #load - **/ - public synchronized User[] getUsers(int listOffset, int number) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving user list, list offset: " + listOffset + ", number:", number); - if (listOffset < -1) - { - throw new ExtendedIllegalArgumentException("listOffset (" + listOffset + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (number < 0 && listOffset != -1) - { - throw new ExtendedIllegalArgumentException("number (" + number + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (handle_ == null || closeHandle_) load(); // this sets the length_ variable - - if (length_ == 0 || (number == 0 && listOffset != -1)) { - return new User[0]; - } - - if (listOffset == -1) - { - number = length_; // request entire list - listOffset = 0; // ... starting at beginning of list - } - else if (listOffset >= length_) - { - if (Trace.traceOn_) - Trace.log(Trace.WARNING, "Value of parameter 'listOffset' is beyond end of list:", listOffset + " (list length: " + length_ + ")"); - - return new User[0]; - } - else if (listOffset + number > length_) - { - number = length_ - listOffset; - } - - // AUTU0150 format has 62 bytes per user. - int lengthOfReceiverVariable = number * 62; - - // Retrieve the entries in the list that was built by the most recent load(). - byte[] data = ListUtilities.retrieveListEntries(system_, handle_, lengthOfReceiverVariable, number, listOffset, null); - - Converter conv = new Converter(system_.getCcsid(), system_); - User[] users = new User[number]; - for (int i = 0, offset = 0; i < users.length; ++i, offset += 62) - { - String profileName = conv.byteArrayToString(data, offset, 10).trim(); - // 0xF1 = group profile. - boolean isGroupProfile = data[offset + 10] == (byte)0xF1; - // 0xF1 = group that has members. - boolean groupHasMember = data[offset + 11] == (byte)0xF1; - String textDescription = conv.byteArrayToString(data, offset + 12, 50).trim(); - users[i] = isGroupProfile ? new UserGroup(system_, profileName, groupHasMember, textDescription) : new User(system_, profileName, groupHasMember, textDescription); - } - - return users; - } - - /** - Loads the list of users on the system. This method informs the system to build a list of users. This method blocks until the system returns the total number of users it has compiled. A subsequent call to {@link #getUsers getUsers()} will retrieve the actual user information and attributes for each user in the list from the system. -

        This method updates the list length. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @see #getLength - @see #close - **/ - public synchronized void load() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loading user list."); - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Close the previous list. - if (closeHandle_) close(); - - // Generate text objects based on system CCSID. - Converter conv = new Converter(system_.getCcsid(), system_); - byte[] selectionCriteria = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - conv.stringToByteArray(userInfo_, selectionCriteria); - byte[] groupProfileName = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - conv.stringToByteArray(groupInfo_.toUpperCase().trim(), groupProfileName); - byte[] profileName = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - conv.stringToByteArray(userProfile_.toUpperCase().trim(), profileName); - - // Setup program parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Receiver variable, output, char(*). - new ProgramParameter(0), - // Length of receiver variable, input, binary(4). - new ProgramParameter(new byte[] { 0x00, 0x00, 0x00, 0x00 } ), - // List information, output, char(80). - new ProgramParameter(ListUtilities.LIST_INFO_LENGTH), - // Number of records to return, input, binary(4). - // Special value '-1' indicates that "all records are built synchronously in the list". - new ProgramParameter(new byte[] { (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF } ), - // Format name, input, char(8), EBCDIC 'AUTU0150'. - new ProgramParameter(new byte[] { (byte)0xC1, (byte)0xE4, (byte)0xE3, (byte)0xE4, (byte)0xF0, (byte)0xF1, (byte)0xF5, (byte)0xF0 } ), - // Selection criteria, input, char(10). - new ProgramParameter(selectionCriteria), - // Group profile name, input, char(10). - new ProgramParameter(groupProfileName), - // Error code, I/0, char(*). - new ErrorCodeParameter(), - // Profile name, input, char(10). - new ProgramParameter(profileName), - }; - - // Call the program. - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QGY.LIB/QGYOLAUS.PGM", parameters); - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - - // List information returned - byte[] listInformation = parameters[2].getOutputData(); - handle_ = new byte[4]; - System.arraycopy(listInformation, 8, handle_, 0, 4); - - // Wait for the list-building to complete. - listInformation = ListUtilities.waitForListToComplete(system_, handle_, listInformation); - - length_ = BinaryConverter.byteArrayToInt(listInformation, 0); - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Loaded user list, length: " + length_ + ", handle: ", Trace.toHexString(handle_)); - } - - /** - Removes the PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes the VetoableChangeListener. If the VetoableChangeListener is not on the list, nothing is done. - @param listener The listener object. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - // If we have listeners. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - /** - Sets the group profile whose members are to be returned. -

        This must be set to a group profile name or {@link #NOGROUP NOGROUP} if group info is set to {@link #MEMBER MEMBER}. This must be set to {@link #NONE NONE} if group info is not set to {@link #MEMBER MEMBER}. - @param groupInfo The group profile whose members are to be returned. Possible values are: -

          -
        • {@link #NONE NONE} - No group profile is specified. -
        • {@link #NOGROUP NOGROUP} - Users who are not a member of any group are returned. -
        • The group profile name - Users who are a member of this group are returned. -
        - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setGroupInfo(String groupInfo) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting group info: " + groupInfo); - if (groupInfo == null) - { - Trace.log(Trace.ERROR, "Parameter 'groupInfo' is null."); - throw new NullPointerException("groupInfo"); - } - if (groupInfo.length() > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'groupInfo' is not valid: '" + groupInfo + "'"); - throw new ExtendedIllegalArgumentException("groupInfo (" + groupInfo + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - synchronized (this) - { - groupInfo_ = groupInfo; - if (handle_ != null) closeHandle_ = true; - } - } - else - { - String oldValue = groupInfo_; - String newValue = groupInfo; - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("groupInfo", oldValue, newValue); - } - synchronized (this) - { - groupInfo_ = groupInfo; - if (handle_ != null) closeHandle_ = true; - } - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("groupInfo", oldValue, newValue); - } - } - } - - /** - Sets the system object representing the system on which the users exist. The system cannot be changed once a connection to the system has been established. - @param system The system object representing the system on which the users exists. - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setSystem(AS400 system) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting system: " + system); - - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - if (handle_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - system_ = system; - } - else - { - AS400 oldValue = system_; - AS400 newValue = system; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("system", oldValue, newValue); - } - system_ = system; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("system", oldValue, newValue); - } - } - } - - /** - Sets which users are returned. - @param userInfo A description of which users are returned. Possible values are: -
          -
        • {@link #ALL ALL} - All user profiles and group profiles are returned. -
        • {@link #USER USER} - Only user profiles that are not group profiles are returned. These are user profiles that do not have a group identifier specified. -
        • {@link #GROUP GROUP} - Only user profiles that are group profiles are returned. These are user profiles that have a group identifier specified. -
        • {@link #MEMBER MEMBER} - User profiles that are members of the group specified for the group info are returned. -
        - @exception PropertyVetoException If any of the registered listeners vetos the property change. - **/ - public void setUserInfo(String userInfo) throws PropertyVetoException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting user info: " + userInfo); - if (userInfo == null) - { - Trace.log(Trace.ERROR, "Parameter 'userInfo' is null."); - throw new NullPointerException("userInfo"); - } - - if (!userInfo.equals(ALL) && !userInfo.equals(USER) && !userInfo.equals(GROUP) && !userInfo.equals(MEMBER)) - { - Trace.log(Trace.ERROR, "Value of parameter 'userInfo' is not valid: " + userInfo); - throw new ExtendedIllegalArgumentException("userInfo", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - synchronized (this) - { - userInfo_ = userInfo; - if (handle_ != null) closeHandle_ = true; - } - } - else - { - String oldValue = userInfo_; - String newValue = userInfo; - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("userInfo", oldValue, newValue); - } - synchronized (this) - { - userInfo_ = userInfo; - if (handle_ != null) closeHandle_ = true; - } - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("userInfo", oldValue, newValue); - } - } - } - - /** - Sets which profile names to include in the list. - @param userProfile The profile names to include in the list. Possible values are: -
          -
        • {@link #ALL ALL} - All profiles are returned. -
        • The user profile name - If a generic profile name is specifed, the profiles that match the the generic name are returned. If a simple profile name is specified, only that profile is returned. -
        - **/ - public void setUserProfile(String userProfile) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting user profile: " + userProfile); - if (userProfile == null) - { - Trace.log(Trace.ERROR, "Parameter 'userProfile' is null."); - throw new NullPointerException("userProfile"); - } - if (userProfile.length() > 10) - { - Trace.log(Trace.ERROR, "Length of parameter 'userProfile' is not valid: '" + userProfile + "'"); - throw new ExtendedIllegalArgumentException("userProfile (" + userProfile + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - synchronized (this) - { - userProfile_ = userProfile; - if (handle_ != null) closeHandle_ = true; - } - } - - - /** - Closes the list on the system when this object is garbage collected. - **/ - protected void finalize() throws Throwable - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Finalize method for user list invoked."); - if (handle_ != null) try { close(); } catch (Throwable t) {} - super.finalize(); - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/UserList16.gif b/cvsroot/src/com/ibm/as400/access/UserList16.gif deleted file mode 100644 index 4031c3ac9..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/UserList16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/UserList32.gif b/cvsroot/src/com/ibm/as400/access/UserList32.gif deleted file mode 100644 index e4ac5091c..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/UserList32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/UserListBeanInfo.java b/cvsroot/src/com/ibm/as400/access/UserListBeanInfo.java deleted file mode 100644 index b7d2fe50d..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserListBeanInfo.java +++ /dev/null @@ -1,147 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - The UserListBeanInfo class represents the bean information for the UserList class. - **/ -public class UserListBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - // Class this bean info represents. - private static final Class BEAN_CLASS = UserList.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - - eventSetDescriptors = new EventSetDescriptor[] { propertyChange, vetoableChange }; - - PropertyDescriptor system = new PropertyDescriptor("system", BEAN_CLASS); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - - PropertyDescriptor groupInfo = new PropertyDescriptor("groupInfo", BEAN_CLASS); - groupInfo.setBound(true); - groupInfo.setConstrained(true); - groupInfo.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_GROUPINFO")); - groupInfo.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_GROUPINFO")); - - PropertyDescriptor userInfo = new PropertyDescriptor("userInfo", BEAN_CLASS); - userInfo.setBound(true); - userInfo.setConstrained(true); - userInfo.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_USERINFO")); - userInfo.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_USERINFO")); - - PropertyDescriptor userProfile = new PropertyDescriptor("userProfile", BEAN_CLASS); - userProfile.setBound(false); - userProfile.setConstrained(false); - userProfile.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_USERPROFILE")); - userProfile.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_USERPROFILE")); - propertyDescriptors = new PropertyDescriptor[] { system, groupInfo, userInfo, userProfile }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return Zero (0), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "propertyChange" event. - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. Possible values are: -
          -
        • BeanInfo.ICON_MONO_16x16 -
        • BeanInfo.ICON_MONO_32x32 -
        • BeanInfo.ICON_COLOR_16x16 -
        • BeanInfo.ICON_COLOR_32x32 -
        - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("UserList16.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("UserList32.gif"); - } - Trace.log(Trace.ERROR, "Value of parameter 'icon' is not valid:", icon); - throw new ExtendedIllegalArgumentException("icon (" + icon + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/UserObjectsOwnedList.java b/cvsroot/src/com/ibm/as400/access/UserObjectsOwnedList.java deleted file mode 100644 index 3b9c7ba20..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserObjectsOwnedList.java +++ /dev/null @@ -1,570 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserObjectsOwnedList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2008 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - - -/** -Allows you to retrieve a list of IBM i objects that a user is authorized to and/or list of IBM i objects that the user owns. -
        Refer to the QSYLOBJA API for additional information. -

        -The list of authorized objects only includes objects the user is specifically authorized to. -The list does not include objects the user is solely authorized to because: -

          -
        • The user is part of a group that is authorized -
        • The user can access the object using the public authority -
        • The object is secured with an authorization list the user is authorized to -
        • The user can access the object using adopted authority -
        -

        Example code: -

        -      AS400 system = new AS400("sysname", "userid", "password");
        -      
        -      UserObjectsOwnedList list1 = new UserObjectsOwnedList(system, "USER1", UserObjectsOwnedList.SELECTION_FILE_SYSTEM_LIBRARY, UserObjectsOwnedList.SELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED);
        -      UserObjectsOwnedListEntry[] entries1 = list1.getObjectList();
        -      System.out.println(list1);
        -      for (int i=0; i < entries1.length; ++i)
        -      {
        -        System.out.println("Entry["+i+"/"+entries1.length+"]= "+entries1[i]);
        -      }      
        -      list1.setSelectionObjectRelation(UserObjectsOwnedList.SELECTION_OBJECT_RELATION_OWNED);
        -      entries1 = list1.getObjectList();
        -      System.out.println(list1);
        -      for (int i=0; i < entries1.length; ++i)
        -      {
        -        System.out.println("Entry["+i+"/"+entries1.length+"]= "+entries1[i]);
        -      }      
        -
        - - @see com.ibm.as400.access.User#getObjectsOwned -**/ -public class UserObjectsOwnedList -{ - private static final String USERSPACE_NAME = "JT4SYLOBJAQTEMP "; - private static final String USERSPACE_PATH = "/QSYS.LIB/QTEMP.LIB/JT4SYLOBJA.USRSPC"; - private static final String CONTINUATION_HANDLE_BLANKS = " "; // 20 Blanks - - /** - Selection value indicating to select IBM i objects that reside in the QSYS library based file system. - **/ - public static final int SELECTION_FILE_SYSTEM_LIBRARY = 0; - private static final String SELECTION_FILE_SYSTEM_LIBRARY_0300 = "OBJA0300"; - /** - Selection value indicating to select IBM i objects that reside in a directory (non-QSYS) based file system. - **/ - public static final int SELECTION_FILE_SYSTEM_DIRECTORY = 1; - private static final String SELECTION_FILE_SYSTEM_DIRECTORY_0310 = "OBJA0310"; - /** - Selection value indicating to select the list of objects the user is authorized to - **/ - public static final int SELECTION_OBJECT_RELATION_AUTHORIZED = 0; - private static final String SELECTION_OBJECT_RELATION_AUTHORIZED_PRIV = "*OBJAUT "; - /** - Selection value indicating to select the list of objects the user owns. - **/ - public static final int SELECTION_OBJECT_RELATION_OWNED = 1; - private static final String SELECTION_OBJECT_RELATION_OWNED_PRIV = "*OBJOWN "; - /** - Selection value indicating to select the both list of objects the user is authorized to and the list of objects the user owns. - **/ - public static final int SELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED = 2; - private static final String SELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED_PRIV = "*BOTH "; - /** - Selection value indicating the object type to request - **/ - private static final String SELECTION_OBJECT_TYPE_ALL_PRIV = "*ALL "; - - private static final ProgramParameter errorCode_ = new ProgramParameter(new byte[4]); - - - private AS400 system_; - private String userName_; - private String selectionFileSystem_; - private String selectionObjectRelation_; - - - /** - Constructs a UserObjectsOwnedList object. -
        You must call {@link #getObjectList() getObjectList()} method to retrieve the object list. -
        Default values are set to select library based objects which the user owns. -
        The selectionFileSystem parameter defaults to {@link #SELECTION_FILE_SYSTEM_LIBRARY SELECTION_FILE_SYSTEM_LIBRARY}, - the selectionObjectRelation parameter defaults to {@link #SELECTION_OBJECT_RELATION_OWNED SELECTION_OBJECT_RELATION_OWNED}. - @param system The system upon which the user resides. - @param userName The user name which owns the objects to be returned. - **/ - public UserObjectsOwnedList(AS400 system, String userName) - { - this(system, userName, SELECTION_FILE_SYSTEM_LIBRARY, SELECTION_OBJECT_RELATION_OWNED); - } - - /** - Constructs a UserObjectsOwnedList object. -
        You must call {@link #getObjectList() getObjectList()} method to retrieve the object list. - @param system The system upon which the user resides. - @param userName The user name which owns (or is authorized to) the objects to be returned. - @param selectionFileSystem The format name. Possible values are: -
          -
        • {@link #SELECTION_FILE_SYSTEM_LIBRARY SELECTION_FILE_SYSTEM_LIBRARY} - QSYS objects in the QSYS library based file system. -
        • {@link #SELECTION_FILE_SYSTEM_DIRECTORY SELECTION_FILE_SYSTEM_DIRECTORY} - IFS objects that reside in a directory. -
        - @param selectionObjectRelation The objects to return. Possible values are: -
          -
        • {@link #SELECTION_OBJECT_RELATION_AUTHORIZED SELECTION_OBJECT_RELATION_AUTHORIZED} - select the list of objects the user is authorized to -
        • {@link #SELECTION_OBJECT_RELATION_OWNED SELECTION_OBJECT_RELATION_OWNED} - select the list of objects the user owns -
        • {@link #SELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED SELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED} - select the list of objects the user is authorized to and the list of objects the user owns -
        -**/ -public UserObjectsOwnedList(AS400 system, String userName, int selectionFileSystem, int selectionObjectRelation) -{ - setSystem(system); - setUserName(userName); - setSelectionFileSystem(selectionFileSystem); - setSelectionObjectRelation(selectionObjectRelation); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, this.toString()); -} - - /** - Returns a list of all UserObjectsOwnedListEntry IBM i objects based on the current - selection criteria for the file system and object relation. -

        This method retrieves the list of objects from the system based on the selection critera set via the constructor or - modified by any of the set methods. - @return The array of objects retrieved from the system. - **/ - public UserObjectsOwnedListEntry[] getObjectList() - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - final int systemCCSID = system_.getCcsid(); - CharConverter conv = new CharConverter(systemCCSID); - - ProgramParameter[] parms = new ProgramParameter[7]; - - parms[0] = new ProgramParameter(conv.stringToByteArray(USERSPACE_NAME)); //Qualified user space name - parms[1] = new ProgramParameter(conv.stringToByteArray(selectionFileSystem_)); // Format Name "OBJA0300" or "OBJA0310" - - StringBuffer userNameBuff = new StringBuffer(" "); // initialize to 10 blanks - userNameBuff.replace(0, userName_.length(), userName_); - parms[2] = new ProgramParameter(conv.stringToByteArray(userNameBuff.toString())); // User profile name - parms[3] = new ProgramParameter(conv.stringToByteArray(SELECTION_OBJECT_TYPE_ALL_PRIV)); // Object type filter - parms[4] = new ProgramParameter(conv.stringToByteArray(selectionObjectRelation_)); // Returned objects (Authorized to, Owns, or Both) - parms[5] = new ProgramParameter(conv.stringToByteArray(CONTINUATION_HANDLE_BLANKS)); // Continuation Handle - parms[6] = errorCode_; - - // QSYLOBJA is the API that is being used to get the object list into a user space. - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QSYLOBJA.PGM", parms); - pc.suggestThreadsafe(); // the called API is thread-safe - - // Determine the needed scope of synchronization. - Object lockObject; - boolean willRunProgramsOnThread = pc.isStayOnThread(); - if (willRunProgramsOnThread) { - // The calls will run in the job of the JVM, so lock for entire JVM. - lockObject = USERSPACE_PATH; - } - else { - // The calls will run in the job of the Remote Command Host Server, so lock on the connection. - lockObject = system_; - } - - byte[] buf = null; - - synchronized (lockObject) - { - // Create a user space in QTEMP to receive output. - UserSpace space = new UserSpace(system_, USERSPACE_PATH); - try - { - space.setMustUseProgramCall(true); - if (!willRunProgramsOnThread) - { - space.setMustUseSockets(true); - // Force the use of sockets when running natively but not on-thread. - // We have to do it this way since UserSpace will otherwise make a native ProgramCall, and will use a different QTEMP library than that used by the host server. - } - space.create(256*1024, true, "", (byte)0, "User space for UserObjectsOwnedList", "*EXCLUDE"); - // Note: User Spaces by default are auto-extendible (by QUSCRTUS API) - // So it will always have enough space available. - // Allocated 256K bytes as a reasonable initial size (1500+ entries) - - if (!pc.run()) { - throw new AS400Exception(pc.getMessageList()); - } - - // Get the results from the user space. - int size = space.getLength(); - buf = new byte[size]; - space.read(buf, 0); - } - finally - { - // Delete the temporary user space, to allow other threads to re-create and use it. - try { space.delete(); } - catch (Exception e) { - Trace.log(Trace.ERROR, "Exception while deleting temporary user space", e); - } - } - } - - // -------------------------------------------------------------------------------------------- - // QSYLOBJA (List Objects User is Authorized to, Owns, or Is Primary Group of) is a "list" API. - // It puts the list of objects in a user space. In addition, to the QSYLOBJA documentation, - // the developer must refer to additional documentation describing the data returned: - // - User spaces: List APIs return data to user spaces. To provide a consistent design and - // use of user space objects, the list APIs use a general data structure. - // - General data structure & Common data structure format (General header format 0100) - // - This format in info center describes the general header format (referenced in the - // code below). - // - This information is/was documented in info center under the following: - // - Programming -> API Concepts -> User spaces and receiver variables -> User spaces - // -------------------------------------------------------------------------------------------- - // Parse the list data returned in the user space. - int headerOffset = BinaryConverter.byteArrayToInt(buf, 116); // General header - Offset to header section - int startingOffset = BinaryConverter.byteArrayToInt(buf, 124); // General header - Offset to list data section - int numEntries = BinaryConverter.byteArrayToInt(buf, 132); // General header - Number of list entries - int entrySize = BinaryConverter.byteArrayToInt(buf, 136); // General header - Size of each entry - int entryCCSID = BinaryConverter.byteArrayToInt(buf, 140); // General header - CCSID of data in the list entries - //String subsettedListIndicator = conv.byteArrayToString(buf, 149, 1); // General header - Subsetted list indicator - String informationStatus = conv.byteArrayToString(buf, 103, 1); // General header - info status - // informationStatus - 'C'=Complete, 'I'=Incomplete, 'P'=Partial - // - refer to QSYLOBJA documentation regarding the "Continuation Handle" for more info - // - see comment below regarding the continuationHandle - - if (entryCCSID == 0) entryCCSID = systemCCSID; // From the API spec: "The coded character set ID for data in the list entries. If 0, then the data is not associated with a specific CCSID and should be treated as hexadecimal data." - conv = new CharConverter(entryCCSID); - - String objectName,libraryName,objectType,authorityHolder,ownership; - String authorityValue,authorityListManagement,objectOperational,objectManagement; - String objectExistence,dataRead,dataAdd,dataUpdate,dataDelete,attribute; - String textDescription,dataExecute,objectAlter,objectReference,aspDeviceNameOfLibrary; - String aspDeviceNameOfObject,pathName; - - // ----------------------------------------------------------------------------------------- - // Extract fields from the QSYLOBJA Specific Header - // ----------------------------------------------------------------------------------------- - //String hdrUserProfile = conv.byteArrayToString(buf, headerOffset+0, 10).trim(); // QSYLOBJA Specific Header - User profile name - // There is currently no need to make use of the returned "continuationHandle". Since - // the user space above is set to "auto-extend", there user space will grow as needed. - String continuationHandle= conv.byteArrayToString(buf, headerOffset+10, 20).trim(); // QSYLOBJA Specific Header - Continuation Handle - // The reason code may have the following values: - // 0000 = list returned in the user space contains all objects meeting the search criteria. - // 0001 = Objects were found that meet the search criteria but could not be included in the returned list. - // The requested format could not handle path names for directory objects - // (Normal behavior when requesting FMTOBJA0300 format but IFS objects could be returned) - // 0002 = Objects were found that meet the search criteria but could not be included in the returned list. - // The requested format could not handle objects found in library QSYS - // (Normal behavior when requesting FMTOBJA0310 format but QSYS objects could be returned) - // 0003 = Directory objects were found but did not have links to them - // There is no plan to make use of (nor make available to the caller)the reasonCode. - int reasonCode = BinaryConverter.byteArrayToInt(buf, headerOffset+30); // QSYLOBJA Specific Header - Reason code - - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "UserObjectsOwnedList.getObjectList() informationStatus='"+informationStatus+"' reasonCode='"+reasonCode+"' continuationHandle='"+continuationHandle+"' numEntries='"+numEntries+"'"); - - UserObjectsOwnedListEntry[] entries = new UserObjectsOwnedListEntry[numEntries]; - - // Extract the fields from each entry in the list - int offset = startingOffset; - for (int i=0; iThis method changes the value set via the constructor, allowing subsequent calls to - {@link #getObjectList() getObjectList()} method to retrieve a different list of objects. - @param system The system upon which the user resides. - **/ - public void setSystem(AS400 system) - { - if (system == null) throw new NullPointerException("system"); - system_ = system; - } - - /** - Returns the system from which to retrieve the list of objects that a user is authorized to and the list of objects the user owns. - @return The system upon which the user resides. - **/ - public AS400 getSystem() - { - return system_; - } - /** - Sets the user name for which to retrieve the list of objects that the user is authorized to and/or the list of objects the user owns. -

        This method changes the value set via the constructor, allowing subsequent calls to - {@link #getObjectList() getObjectList()} method to retrieve a different list of objects. - @param userName The user name which owns (or is authorized to) the objects to be returned. - **/ - public void setUserName(String userName) - { - if (userName == null) throw new NullPointerException("userName"); - userName_ = userName; - } - - /** - Returns the user name for which to retrieve the list of objects that a user is authorized to and list of objects the user owns. - @return The user name which owns (or is authorized to) the objects to be returned. - **/ - public String getUserName() - { - return userName_; - } - - - /** - Sets the selection criteria for the file system from which to retrieve the list of objects that the user is authorized to or the list of objects the user owns. -

        This method changes the value set via the constructor, allowing subsequent calls to - {@link #getObjectList() getObjectList()} method to retrieve a different list of objects. - @param selectionFileSystem The format name. Valid values: -

          -
        • {@link #SELECTION_FILE_SYSTEM_LIBRARY SELECTION_FILE_SYSTEM_LIBRARY} - objects that reside in an IBM i library -
        • {@link #SELECTION_FILE_SYSTEM_DIRECTORY SELECTION_FILE_SYSTEM_DIRECTORY} - objects that reside in an IBM i directory -
        - **/ - public void setSelectionFileSystem(int selectionFileSystem) - { - // The public const values are passed on the interface, but the private constant values - // are stored in this object. - switch (selectionFileSystem) - { - case SELECTION_FILE_SYSTEM_LIBRARY: - selectionFileSystem_ = SELECTION_FILE_SYSTEM_LIBRARY_0300; - break; - case SELECTION_FILE_SYSTEM_DIRECTORY: - selectionFileSystem_ = SELECTION_FILE_SYSTEM_DIRECTORY_0310; - break; - default: - { - Trace.log(Trace.ERROR, "UserObjectsOwnedList.setSelectionFileSystem() PARAMETER_VALUE_NOT_VALID"); - throw new ExtendedIllegalArgumentException("selectionFileSystem", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - } - - - /** - Returns the current selection criteria for the file system from which to retrieve the list of objects that a user is authorized to or list of objects the user owns. - @return the selection file system. Possible values: -
          -
        • {@link #SELECTION_FILE_SYSTEM_LIBRARY SELECTION_FILE_SYSTEM_LIBRARY} - objects that reside in an IBM i library -
        • {@link #SELECTION_FILE_SYSTEM_DIRECTORY SELECTION_FILE_SYSTEM_DIRECTORY} - objects that reside in an IBM i directory -
        - **/ - public int getSelectionFileSystem() - { - // The public const values are passed on the interface, but the private constant values - // are stored in this object. - if (selectionFileSystem_.equals(SELECTION_FILE_SYSTEM_LIBRARY_0300)) - return (SELECTION_FILE_SYSTEM_LIBRARY); - else // OBJECT_FORMAT_IFS_0310 - return (SELECTION_FILE_SYSTEM_DIRECTORY); - } - - - /** - Sets which objects are to be selected (indicating objects authorized to, objects owned, or both). -

        This method changes the value set via the constructor, allowing subsequent calls to - {@link #getObjectList() getObjectList()} method to retrieve a different list of objects. - @param selectionObjectRelation Which objects are to be selected . Valid values: -

          -
        • {@link #SELECTION_OBJECT_RELATION_AUTHORIZED SELECTION_OBJECT_RELATION_AUTHORIZED} - select a list of objects the user is authorized to -
        • {@link #SELECTION_OBJECT_RELATION_OWNED SELECTION_OBJECT_RELATION_OWNED} - select a list of objects the user owns -
        • {@link #SELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED SELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED} - select a list of objects the user is authorized to and a list of objects the user owns -
        - **/ - public void setSelectionObjectRelation(int selectionObjectRelation) - { - // The public const values are passed on the interface, but the private constant values - // are stored in this object. - switch (selectionObjectRelation) - { - case SELECTION_OBJECT_RELATION_AUTHORIZED: - selectionObjectRelation_ = SELECTION_OBJECT_RELATION_AUTHORIZED_PRIV; - break; - case SELECTION_OBJECT_RELATION_OWNED: - selectionObjectRelation_ = SELECTION_OBJECT_RELATION_OWNED_PRIV; - break; - case SELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED: - selectionObjectRelation_ = SELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED_PRIV; - break; - default: - { - Trace.log(Trace.ERROR, "UserObjectsOwnedList.setSelectionObjectRelation() PARAMETER_VALUE_NOT_VALID"); - throw new ExtendedIllegalArgumentException("selectionObjectRelation", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - } - - - /** - Returns the returned objects setting indicating that objects to be returned are objects that the user is authorized to, objects owned, or both. - @return the selection object relation. Possible values: -
          -
        • {@link #SELECTION_OBJECT_RELATION_AUTHORIZED SELECTION_OBJECT_RELATION_AUTHORIZED} - select a list of objects the user is authorized to -
        • {@link #SELECTION_OBJECT_RELATION_OWNED SELECTION_OBJECT_RELATION_OWNED} - select a list of objects the user owns -
        • {@link #SELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED SELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED} - select a list of objects the user is authorized to and a list of objects the user owns -
        - **/ - public int getSelectionObjectRelation() - { - // The public const values are passed on the interface, but the private constant values - // are stored in this object. - if (selectionObjectRelation_.equals(SELECTION_OBJECT_RELATION_AUTHORIZED_PRIV)) - return (SELECTION_OBJECT_RELATION_AUTHORIZED); - else if (selectionObjectRelation_.equals(SELECTION_OBJECT_RELATION_OWNED_PRIV)) - return (SELECTION_OBJECT_RELATION_OWNED); - else - return (SELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED); - } - - - /** - Returns a string representation of this object. - @return a string with the system, userName, selectionFileSystem, and selectionObjectRelation - **/ - public String toString() - { - String returnString; - returnString = "UserObjectsOwnedList (getSystem()="+getSystem()+" getUserName()="+getUserName() + " getSelectionFileSystem()="+getSelectionFileSystem()+" getSelectionObjectRelation()="+getSelectionObjectRelation()+")"; - return returnString; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/UserObjectsOwnedListEntry.java b/cvsroot/src/com/ibm/as400/access/UserObjectsOwnedListEntry.java deleted file mode 100644 index 2a9a57950..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserObjectsOwnedListEntry.java +++ /dev/null @@ -1,423 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserObjectsOwnedListEntry.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2008 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - - -/** - This entry represents a single IBM i object that a user owns or is authorized to. -

        Each entry corresponds to an entry from the QSYLOBJA API (format OBJA0300 or OBJA0310).
        - Instances of this class are created by the {@link UserObjectsOwnedList#getObjectList() UserObjectsOwnedList.getObjectList()} method. -**/ - -public class UserObjectsOwnedListEntry -{ - - /** - Special authority value indicating that the user has all object (operational, management, existence, alter and reference) and - data (read, add, update, delete, and execute) authorities to the object. - **/ - public static final String AUTHORITY_VALUE_ALL = "*ALL"; - - /** - Special authority value indicating that the user has object operational and all data authorities to the object. - **/ - public static final String AUTHORITY_VALUE_CHANGE = "*CHANGE"; - - /** - Special authority value indicating that the user has object operational and data read and execute authorities to the object. - **/ - public static final String AUTHORITY_VALUE_USE = "*USE"; - - /** - Special authority value indicating that the user has none of the object or data authorities to the object, or authorization list management authority. - **/ - public static final String AUTHORITY_VALUE_EXCLUDE = "*EXCLUDE"; - - /** - Special authority value indicating that the user has some combination of object and data authorities that do not relate to a special value. - The individual authorities for the user should be checked to determine what authority the user has to the object. - This value is returned if the user owns an object and all authority for the user to the object has been removed. - If this happens, all individual authority fields are set to false. - **/ - public static final String AUTHORITY_VALUE_USER_DEF = "USER DEF"; - - - private String objectName_; - private String libraryName_; - private String objectType_; - private String authorityHolder_; - private String ownership_; - private String authorityValue_; - private String authorityListManagement_; - private String objectOperational_; - private String objectManagement_; - private String objectExistence_; - private String dataRead_; - private String dataAdd_; - private String dataUpdate_; - private String dataDelete_; - private String attribute_; - private String textDescription_; - private String dataExecute_; - private String objectAlter_; - private String objectReference_; - private String aspDeviceNameOfLibrary_; - private String aspDeviceNameOfObject_; - private String pathName_; - private boolean qsysObjectEntry_; - - - // Make constructors package scoped - only constructed by UserObjectsOwnedList.getObjectList() - // No verification of data is performed in the constructors, since - // the data for these fields comes from the QSYLOBJA API. - // This constructor is for QSYS library (non-directory) based objects (i.e. QSYLOBJA Format OBJA0300) - UserObjectsOwnedListEntry(String objectName,String libraryName,String objectType,String authorityHolder,String ownership,String authorityValue,String authorityListManagement,String objectOperational,String objectManagement, - String objectExistence,String dataRead,String dataAdd,String dataUpdate,String dataDelete,String attribute,String textDescription, - String dataExecute,String objectAlter,String objectReference,String aspDeviceNameOfLibrary,String aspDeviceNameOfObject) - { - construct(objectType, authorityHolder, ownership, authorityValue, authorityListManagement, objectOperational, objectManagement, - objectExistence, dataRead, dataAdd, dataUpdate, dataDelete, attribute, textDescription, - dataExecute, objectAlter, objectReference, aspDeviceNameOfObject); - // No verification of data is performed. The data for these fields comes from the QSYLOBJA API. - objectName_ = objectName; - libraryName_ = libraryName; - aspDeviceNameOfLibrary_ = aspDeviceNameOfLibrary; - qsysObjectEntry_ = true; - } - - - // This constructor is for IFS directory (non-QSYS) based objects (i.e. QSYLOBJA Format OBJA0310) - UserObjectsOwnedListEntry(String objectType,String authorityHolder,String ownership,String authorityValue,String authorityListManagement,String objectOperational,String objectManagement, - String objectExistence,String dataRead,String dataAdd,String dataUpdate,String dataDelete,String attribute,String textDescription, - String dataExecute,String objectAlter,String objectReference,String aspDeviceNameOfObject,String pathName) - { - construct(objectType, authorityHolder, ownership, authorityValue, authorityListManagement, objectOperational, objectManagement, - objectExistence, dataRead, dataAdd, dataUpdate, dataDelete, attribute, textDescription, - dataExecute, objectAlter, objectReference, aspDeviceNameOfObject); - pathName_ = pathName; - qsysObjectEntry_ = false; - } - - - // Common code for all constructors - private void construct(String objectType,String authorityHolder,String ownership,String authorityValue,String authorityListManagement,String objectOperational,String objectManagement, - String objectExistence,String dataRead,String dataAdd,String dataUpdate,String dataDelete,String attribute,String textDescription, - String dataExecute,String objectAlter,String objectReference,String aspDeviceNameOfObject) - { - // No verification of data is performed. The data for these fields comes from the QSYLOBJA API. - objectName_ = null; // Not passed - so default to NULL - libraryName_ = null; // Not passed - so default to NULL - objectType_ = objectType; - authorityHolder_ = authorityHolder; - ownership_ = ownership; - authorityValue_ = authorityValue; - authorityListManagement_ = authorityListManagement; - objectOperational_ = objectOperational; - objectManagement_ = objectManagement; - objectExistence_ = objectExistence; - dataRead_ = dataRead; - dataAdd_ = dataAdd; - dataUpdate_ = dataUpdate; - dataDelete_ = dataDelete; - attribute_ = attribute; - textDescription_ = textDescription; - dataExecute_ = dataExecute; - objectAlter_ = objectAlter; - objectReference_ = objectReference; - aspDeviceNameOfLibrary_ = null; // Not passed - so default to NULL - aspDeviceNameOfObject_ = aspDeviceNameOfObject; - pathName_ = null; // Not passed - so default to NULL - } - - - /** - Returns the name of the object the user is authorized to, owns, or is the primary group for. - @return The object name. Will return null when {@link #isQSYSObjectEntry() isQSYSObjectEntry()} is false. - - **/ - public String getObjectName() - { - return objectName_; - } - - /** - Returns the name of the library containing the object. - @return The object library. Will return null when {@link #isQSYSObjectEntry() isQSYSObjectEntry()} is false. - **/ - public String getLibraryName() - { - return libraryName_; - } - - /** - Returns the type of object the user is authorized to, owns, or is the primary group of. - @return The object type. - **/ - public String getObjectType() - { - return objectType_; - } - - - /** - Returns whether the object is an authority holder. - @return true if the object is an authority holder; - false otherwise - **/ - public boolean getAuthorityHolder() - { - // If the object is an authority holder, this field is Y. If not, this field is N. - return (authorityHolder_.equals("Y")); - } - - /** - Returns whether the user owns the object or is the primary group for the object. - If the user owns the object, this field is Y. If the user is the primary group - for the object, this field is G. Otherwise, this field is N. - @return ownership - **/ - public String getOwnership() - { - return ownership_; - } - - /** - Returns the special value indicating the user's authority to the object. - @return authority value Possible values: -

          -
        • {@link #AUTHORITY_VALUE_ALL UserObjectsOwnedListEntry.AUTHORITY_VALUE_ALL} - The user has all object (operational, management, existence, alter and reference) and - data (read, add, update, delete, and execute) authorities to the object. -
        • {@link #AUTHORITY_VALUE_CHANGE UserObjectsOwnedListEntry.AUTHORITY_VALUE_CHANGE} - The user has object operational and all data authorities to the object. -
        • {@link #AUTHORITY_VALUE_USE UserObjectsOwnedListEntry.AUTHORITY_VALUE_USE} - The user has object operational and data read and execute authorities to the object. -
        • {@link #AUTHORITY_VALUE_EXCLUDE UserObjectsOwnedListEntry.AUTHORITY_VALUE_EXCLUDE} - The user has none of the object or data authorities to the object, or authorization list management authority. -
        • {@link #AUTHORITY_VALUE_USER_DEF UserObjectsOwnedListEntry.AUTHORITY_VALUE_USER_DEF} - The user has some combination of object and data authorities that do not relate to a special value. - The individual authorities for the user should be checked to determine what authority the user has to the object. - This value is returned if the user owns an object and all authority for the user to the object has been removed. - If this happens, all individual authority fields are set to false. -
        - **/ - public String getAuthorityValue() - { - return authorityValue_; - } - - /** - Returns whether the user has authorization list management authority to the - object. This field is only valid if the object type is *AUTL. - @return true if user has authorization list management authority to the object; - false otherwise - **/ - public boolean getAuthorityListManagement() - { - // If the user has the authority, this field is Y. If not, this field is N. - return (authorityListManagement_.equals("Y")); - } - - /** - Returns whether the user has object operational authority to the object. - @return true if user has object operational authority to the object; - false otherwise - **/ - public boolean getObjectOperational() - { - // If the user has the authority, this field is Y. If not, this field is N. - return (objectOperational_.equals("Y")); - } - - /** - Returns whether the user has object management authority to the object. - @return true if user has object management authority to the object; - false otherwise - **/ - public boolean getObjectManagement() - { - // If the user has the authority, this field is Y. If not, this field is N. - return (objectManagement_.equals("Y")); - } - - /** - Returns whether the user has object existence authority to the object. - @return true if user has object existence authority to the object; - false otherwise - **/ - public boolean getObjectExistence() - { - // If the user has the authority, this field is Y. If not, this field is N. - return (objectExistence_.equals("Y")); - } - - /** - Returns whether the user has data read authority to the object. - @return true if user has data read authority to the object; - false otherwise - **/ - public boolean getDataRead() - { - // If the user has the authority, this field is Y. If not, this field is N. - return (dataRead_.equals("Y")); - } - - /** - Returns whether the user has data add authority to the object. - @return true if user has data add authority to the object; - false otherwise - **/ - public boolean getDataAdd() - { - // If the user has the authority, this field is Y. If not, this field is N. - return (dataAdd_.equals("Y")); - } - - /** - Returns whether the user has data update authority to the object. - @return true if user has data update authority to the object; - false otherwise - **/ - public boolean getDataUpdate() - { - // If the user has the authority, this field is Y. If not, this field is N. - return (dataUpdate_.equals("Y")); - } - - /** - Returns whether the user has data delete authority to the object. - @return true if user has data delete authority to the object; - false otherwise - **/ - public boolean getDataDelete() - { - // If the user has the authority, this field is Y. If not, this field is N. - return (dataDelete_.equals("Y")); - } - - /** - Returns the object's attribute. - @return attribute - **/ - public String getAttribute() - { - return attribute_; - } - - /** - Returns the text description of the object. - @return text description - **/ - public String getTextDescription() - { - return textDescription_; - } - - /** - Returns whether the user has data execute authority to the object. - @return true if user has data execute authority to the object; - false otherwise - **/ - public boolean getDataExecute() - { - // If the user has the authority, this field is Y. If not, this field is N. - return (dataExecute_.equals("Y")); - } - - /** - Returns whether the user has object alter authority to the object. - @return true if user has object alter authority to the object; - false otherwise - **/ - public boolean getObjectAlter() - { - // If the user has the authority, this field is Y. If not, this field is N. - return (objectAlter_.equals("Y")); - } - - /** - Returns whether the user has object reference authority to the object. - @return true if user has object reference authority to the object; - false otherwise - **/ - public boolean getObjectReference() - { - // If the user has the authority, this field is Y. If not, this field is N. - return (objectReference_.equals("Y")); - } - - /** - Returns the auxiliary storage pool (ASP) device name where the object's - library is stored. If the object's library is in the system ASP or one - of the basic user ASPs, this field contains *SYSBAS. - @return asp device name of library. Will return null when {@link #isQSYSObjectEntry() isQSYSObjectEntry()} is false. - **/ - public String getAspDeviceNameOfLibrary() - { - return aspDeviceNameOfLibrary_; - } - - /** - Returns the auxiliary storage pool (ASP) device name where the object - is stored. If the object is in the system ASP or one of the basic - user ASPs, this field contains *SYSBAS. - @return asp device name of object - **/ - public String getAspDeviceNameOfObject() - { - return aspDeviceNameOfObject_; - } - - /** - Returns the path name of the object the user owns, is authorized to, or is the primary group for. - @return path name of the object. Will return null when {@link #isQSYSObjectEntry() isQSYSObjectEntry()} is true. - **/ - public String getPathName() - { - return pathName_; - } - - /** - Indicates if this UserObjectsOwnedListEntry is for a QSYS library based object vs an IFS directory based object. - A QSYS library based objects resides in a library in the QSYS file system. Other IBM i objects would - reside in an IFS directory based file system. -

        Some fields are not valid for QSYS vs IFS directory based objects. Refer to: -

          -
        • {@link #getObjectName() getObjectName()} -
        • {@link #getLibraryName() getLibraryName()} -
        • {@link #getAspDeviceNameOfLibrary()() getAspDeviceNameOfLibrary()()} -
        • {@link #getPathName() getPathName()} -
        - @return true if this entry is for a QSYS based object; false otherwise - **/ - public boolean isQSYSObjectEntry() - { - return qsysObjectEntry_; - } - - /** - Returns a string representation of this object. - @return a string representing the object by path name or by library name, object name, and object type - **/ - public String toString() - { - String returnString; - if (isQSYSObjectEntry()) - { - returnString = "UserObjectsOwnedListEntry (getLibraryName()="+getLibraryName()+" getObjectName()="+getObjectName() + " getObjectType()="+getObjectType() + ")"; - } - else - { - returnString = "UserObjectsOwnedListEntry (getPathName()='" + getPathName()+"')"; - } - return returnString; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/access/UserPermission.java b/cvsroot/src/com/ibm/as400/access/UserPermission.java deleted file mode 100644 index 0703ab34d..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserPermission.java +++ /dev/null @@ -1,350 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserPermission.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; - -/** - * Represents the authority of a specific user. - * Instances of UserPermission are returned by {@link Permission#getUserPermission(String) Permission.getUserPermission()} -**/ -public class UserPermission - implements Cloneable, - Serializable -{ - static final long serialVersionUID = 4L; - - /** - * Constant indicating that no operation has been done. - **/ - final static int COMMIT_NONE = -1; - - /** - * Constant indicating that this user has just been added. - **/ - final static int COMMIT_ADD = 0; - - /** - * Constant indicating that this item has been changed for the object. - **/ - final static int COMMIT_REMOVE = 1; - - /** - * Constant indicating that this user has just been removed. - **/ - final static int COMMIT_CHANGE = 2; - - /** - * Constant indicating that this user permission has just been set from authorization list. - **/ - final static int COMMIT_FROM_AUTL = 3; - - /** - * Constant indicating that this user is neither a user nor a group. - * It may be a *PUBLIC, *NTWIRF, or *NTWEFF. - **/ - public final static int GROUPINDICATOR_SPECIALVALUE = 0; - - /** - * Constant indicating that this user profile is a user. - **/ - public final static int GROUPINDICATOR_USER = 1; - - /** - * Constant indicating that this user profile is a group. - **/ - public final static int GROUPINDICATOR_GROUP = 2; - - // Basic authorities mapping to detailed authorities. - final static boolean[][] basicAutMapping = { - {true, true, true, true, true, - true, true, true, true, true }, - {false,false,false,false,false, - false,false,false,false,false }, - {true, false,false,false,false, - true, false,false,false,true }, - {true, false,false,false,false, - true, true, true, true, true } - }; - - //Constant indicating basic authority type. - final static int BASIC_USER_DEF = -1; - final static int BASIC_ALL = 0; - final static int BASIC_EXCLUDE = 1; - final static int BASIC_USE = 2; - final static int BASIC_CHANGE = 3; - - //Constant indicating data authority type. - final static int DATA_READ = 5; - final static int DATA_ADD = 6; - final static int DATA_UPDATE = 7; - final static int DATA_DELETE = 8; - final static int DATA_EXECUTE = 9; - - //Constant indicating object authority type. - final static int OBJECT_OPERATION = 0; - final static int OBJECT_MANAGEMENT = 1; - final static int OBJECT_EXIST = 2; - final static int OBJECT_ALTER = 3; - final static int OBJECT_REFERENCE = 4; - - //Authorities information. - boolean[] authorities_; - - //Data authority information. - String dataAuthority_; - - //Object authority informatin. - int objectAuthority_; - - // Authorization list management flag. - private boolean autListMgt_; - - // Commit flag - private int committed_; - - // The value indicating whether this user profile is a user - // profile or a group profile. - private int groupIndicator_; - - // User profile name. - private String userName_; - - // Indicates whether the user is from authorization list. - private boolean fromAuthorizationList_; - - /** - * Constructs a UserPermission object. - * @param userProfileName The name of the user profile. - * - **/ - UserPermission(String userProfileName) - { - authorities_ = new boolean[10]; - for(int i=0;i - *
      • -1 COMMIT_NONE means no change and any operation to the object. - *
      • 0 COMMIT_ADD means this user permission which was added - * to the object has not been committed. - *
      • 1 COMMIT_REMOVE means this user permission which was - * removed from the object has not been committed. - *
      • 2 COMMIT_CHANGE means the changes of the content have - * not committed. - *
      - * @see #setCommitted - **/ - int getCommitted() - { - return committed_; - } - - - /** - * Returns the value indicating if the user profile is a group profile. - * @return The value indicating if the user profile is a group profile. - * - **/ - public int getGroupIndicator() - { - return groupIndicator_; - } - - - - /** - * Returns the user profile name for this permission. - * @return The user profile name for this permission. - * - **/ - public String getUserID() - { - return userName_; - } - - /** - * Indicates whether the user permission is from authorization list. - * @return true if the user is from authorization list; - * false otherwise. - **/ - public boolean isFromAuthorizationList() - { - return fromAuthorizationList_; - } - - /** - * Indicates whether the user has the authority of authorization list management. - * It is valid only for the object which is an authorization list. - * @return true if the user has the authority of authorization list - * management; false otherwise. - * - **/ - public boolean isAuthorizationListManagement() - { - return autListMgt_; - } - - /** - * Serialization support. - **/ - private void readObject(ObjectInputStream s) - throws ClassNotFoundException, IOException - { - s.defaultReadObject(); - s.readObject(); - } - - /** - * Sets the authority of authorization list management. - * It is valid only for the object which is an authorizaiton list. - * @param autListMgt true if the user has the authority - * of authorization list management; false otherwise. - * - **/ - public synchronized void setAuthorizationListManagement(boolean autListMgt ) - { - autListMgt_ = autListMgt; - if (getCommitted() == COMMIT_NONE) - { - setCommitted(COMMIT_CHANGE); - } - return; - } - - /** - * Sets the committed signal. - * @param commit The committed signal. - * @see #isCommitted - **/ - void setCommitted(int commit) - { - - committed_ = commit; - return; - } - - /** - * Sets the permission of user as coming from an authorization list. - * This is valid only if the user is *PUBLIC and the authorization list - * exists. If set to true, all of the other authorities will be set to false. - * If any of the other authorities are set to true, - * this value is automatically set to false. - * @param fromAutList true if the user is from the authorization list; - * false otherwise. - * - **/ - public synchronized void setFromAuthorizationList(boolean fromAutList) - { - if (fromAuthorizationList_ == fromAutList) - return; - if (fromAutList == true) - { - fromAuthorizationList_ = fromAutList; - for(int i=0;iAs a performance optimization, when running directly on IBM i, it is possible to use native - methods to access the user space from the current job. To enable this support, use the - {@link #setMustUseNativeMethods setMustUseNativeMethods()} method. - - **/ - -public class UserQueue -{ - /** Queue type is first-in first-out */ - public final static byte QUEUE_TYPE_FIRST_IN_FIRST_OUT = (byte) 0xc6; - /** Queue type is keyed */ - public final static byte QUEUE_TYPE_KEYED = (byte) 0xd2; - /** Queue type is last-in first-out */ - public final static byte QUEUE_TYPE_LAST_IN_FIRST_OUT = (byte) 0xd3; - - // Use native methods when running natively; - private boolean mustUseNativeMethods_ = false; - - AS400 system_; - String path_; - int handle_ = 0; - byte[] objectNameBytes_; - int dataSize_; - int keyLength_; - private byte queueType_; - UserQueueImpl impl_; - /** - Constructs a UserQueue object. - @param system The system object representing the system on which the user queue exists. - @param path The fully qualified integrated file system path name of the user queue. - **/ - public UserQueue(AS400 system, String path) throws Exception - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing UserQueue object."); - system_ = system; - path_ = path; - - objectNameBytes_ = new byte[20]; - - Arrays.fill(objectNameBytes_, (byte) 0x40); - if (path.indexOf("/QSYS.LIB/") == 0) { - path = path.substring(9); - } - - if (path.charAt(0) != '/') { - throw new Exception("Path does not begin with / : "+path); - } - int libIndex = path.indexOf(".LIB/"); - if (libIndex < 2) { - throw new Exception("Path does not contain .LIB / : "+path); - } - String lib = path.substring(1,libIndex); - byte[] libBytes = lib.getBytes("IBM-037"); - - int usridxIndex = path.indexOf(".USRQ"); - if (usridxIndex < libIndex) { - throw new Exception("Path does not contain .USRQ / : "+path); - } - - String indexName = path.substring(libIndex+5, usridxIndex); - byte[] indexNameBytes = indexName.getBytes("IBM-037"); - - System.arraycopy(indexNameBytes, 0, objectNameBytes_, 0, indexNameBytes.length); - System.arraycopy(libBytes, 0, objectNameBytes_, 10, libBytes.length); - - // - // Pick the impl - // - - impl_ = new UserQueueImplILE(); - - } - - /** - Creates a user queue on the system. The queue will be created with the attributes provided. - @param extendedAttribute The extended attribute of the user queue to be created. - @param queueType The type of the queue, which indicates the sequences in which messages are to be - dequeued from the queue. Valid values are QUEUE_TYPE_FIRST_IN_FIRST_OUT, - QUEUE_TYPE_KEYED, QUEUE_TYPE_LAST_IN_FIRST_OUT. - @param keyLength The length in bytes of the message key from 1 to 256, if the type of the queue is - QUEUE_TYPE_KEYED. Otherwise, the value must be 0. - @param maximumMessageSize The maximum allowed size of messages to be placed on the queue. The maximum size allowed is - 64,0000 bytes. - @param initialNumberOfMessages The initial number of messages that the queue can contain. - @param additionalNumberOfMessages The amount to increase the maximum number of messages value when the queue is full. - If set to 0, the queue cannot be extended and an error message is returned when - attempting to enqueue an additional entry. - @param authority The public authority for the user space. This string must be 10 characters or less. - Valid values are: -
        -
      • *ALL -
      • *CHANGE -
      • *EXCLUDE -
      • *LIBCRTAUT -
      • *USE -
      • authorization-list name -
      - - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectAlreadyExistsException If the object already exists on the system. - @exception ObjectDoesNotExistException If the library does not exist on the system. - **/ - public void create(String extendedAttribute, - byte queueType, - int keyLength, - int maximumMessageSize, - int initialNumberOfMessages, - int additionalNumberOfMessages, - String authority, - String description, - String replace - ) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectAlreadyExistsException, ObjectDoesNotExistException - { - dataSize_ = maximumMessageSize; - - byte[] extendedAttributeBytes = extendedAttribute.getBytes("IBM-037"); - byte[] publicAuthorityBytes = authority.getBytes("IBM-037"); - byte[] descriptionBytes = description.getBytes("IBM-037"); - byte[] replaceBytes = replace.getBytes("IBM-037"); - - keyLength_ = keyLength; - queueType_ = queueType; - - - handle_ = impl_.create(objectNameBytes_, - extendedAttributeBytes, - queueType, - keyLength, - dataSize_, - initialNumberOfMessages, - additionalNumberOfMessages, - publicAuthorityBytes, - descriptionBytes, - replaceBytes); - - - - - } - - - /** - * Deletes the user queue. - */ - public void delete() { - impl_.delete(handle_, objectNameBytes_); - } - - /** - * Dequeues the next entry from a FIFO or LIFO queue as a string - */ - public String dequeue() throws Exception { - if (handle_ == 0) { - open(); - } - if (queueType_ == QUEUE_TYPE_FIRST_IN_FIRST_OUT || - queueType_ == QUEUE_TYPE_LAST_IN_FIRST_OUT ) { - // Queue type is ok - } else { - // TODO: Throw invalid queue type exception - throw new Exception("Invalid queue type. QUEUE must be FIFO or LIFO"); - } - if (keyLength_ == 0) { - byte[] deqMsgPrefixBytes = new byte[20]; - byte[] outputBytes = new byte[dataSize_]; - - int messageDequeued = impl_.dequeue(handle_, - deqMsgPrefixBytes, - outputBytes); - - if (messageDequeued == 0) { - return null; - } else { - int outputLength = - (0xFF & deqMsgPrefixBytes[16]) * 256 * 16 + - (0xFF & deqMsgPrefixBytes[17]) * 256 + - (0xFF & deqMsgPrefixBytes[18]) * 16 + - (0xFF & deqMsgPrefixBytes[19]); - - return new String(outputBytes, 0, outputLength, "IBM-037"); - } - - } else { - throw new Exception("not supported "); - } - } - /** - Dequeues an entry from the user queue. - @param dequeueMessagePrefixBytes A Dequeue Message Prefix byte array used by the DEQI MI instruction. - This provides both input and output information for the dequeue operation. The format of this byte array - is as follows. For more information, see http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=/rzatk/DEQ.htm. -
      -     Offset 	
      -     Dec    Hex     Field Name    	                  	Data Type and Length
      -       0 	0   	Timestamp of enqueue of message 	Char(8) ++
      -	   8 	8 		Dequeue wait time-out value         Char(8) +
      -	   16 	10 		Size of message dequeued        	Bin(4) ++
      -	   20 	14   	Access state modification option    Char(1) + 
      -	                indicator and message selection 
      -	                criteria 	
      -       21 	15 	    Search key (ignored for FIFO/LIFO  Char(key length) + 
      -                    queues but must be present for 
      -                    FIFO/LIFO queues with nonzero key 
      -                     length values) 	
      -	    * 	* 	   	Message key  	                    Char(key length) ++
      -
      -     Note:	Fields shown here with one plus sign (+) indicate input to the instruction, 
      -     and fields shown here with two plus signs (++) are returned by the machine. 
      -     
      - @param outputBytes Byte array to receive the bytes contained in the queue entry. - @return Returns 1 if a message was dequeued, 0 if a message was not dequeued. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int dequeue(byte[] dequeueMessagePrefixBytes, byte[] outputBytes) throws AS400SecurityException, ErrorCompletingRequestException, IOException, IllegalObjectTypeException, InterruptedException, ObjectDoesNotExistException - { - if (handle_ == 0) { - open(); - } - return impl_.dequeue(handle_, dequeueMessagePrefixBytes, outputBytes); - } - - - /** - Returns the String representation of this user queue object. - @return The String representation of this user queue object. - **/ - public String toString() - { - return "UserQueue " + path_; - } - - - - /** - * Enqueues a string on the user queue - */ - public void enqueue(String value) throws Exception { - byte[] valueBytes = value.getBytes("IBM-037"); - if (handle_ == 0) { - open(); - } - if (queueType_ == QUEUE_TYPE_FIRST_IN_FIRST_OUT || - queueType_ == QUEUE_TYPE_LAST_IN_FIRST_OUT ) { - // Queue type is ok - } else { - // TODO: Throw invalid queue type exception - throw new Exception("Invalid queue type. QUEUE must be FIFO or LIFO"); - } - impl_.enqueue(handle_, null, valueBytes); - } - - - - /** - Enqueues an entry on the user queue using the ENQ MI instruction. - @param enqueueMessagePrefixBytes A byte array representing the message prefix passed to the ENQ MI instruction. - A value of null may be passed when using a FIFO to LIFO queue. -

      The format of the message prefix is the following. For more information, see - http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=/rzatk/ENQ.htm -

      -     Offset 	
      -     Dec 	Hex 	Field Name 						Data Type and Length
      -		0 	0 		Size of message to be enqueued 	Bin(4)
      -		4 	4		Enqueue key value (ignored for  Char(key length)  
      -			        FIFO/LIFO queues with key 
      -			        lengths equal to 0) 	
      -     
      - - The static method {@link #setEnqueueMessagePrefixBytesMessageSize setEnqueueMessagePrefixBytesMessageSize()} can be used to set the size. - The static method {@link #setEnqueueMessagePrefixBytesEnqueueKey setEnqueueMessagePrefixBytesEnqueueKey()} can be used to set the size. - - @param entryBytes A byte array representing the entry to add to the queue. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception IllegalObjectTypeException If the object on the system is not the required type. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - - public void enqueue(byte[] enqueueMessagePrefixBytes, byte[] entryBytes) throws Exception { - if (handle_ == 0) { - open(); - } - if (enqueueMessagePrefixBytes == null) { - impl_.enqueue(handle_, null, entryBytes); - } else { - throw new Exception("Keyed message queue not yet supported"); - } - - } - - - - /** - Indicates if the native methods will be used internally to perform user queue dequeue and enqueue requests. - @return true if user dequeue and enqueue requests will be performed via native methods; false otherwise. - @see #setMustUseNativeMethods - **/ - - public boolean isMustUseNativeMethods() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if user queue must use native methods:", mustUseNativeMethods_); - return mustUseNativeMethods_; - } - - /** - Specifies whether native methods are used by the current job to perform user queue operations. - This option can only be set to true when the application is running on the System i. - @param useNativeMethods Internally use native methods to perform read and write requests. - @see #isMustUseNativeMethods - **/ - public void setMustUseNativeMethods(boolean useNativeMethods) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Setting if user queue must use native methods:", useNativeMethods); - if (useNativeMethods) { - if (!mustUseNativeMethods_) { - mustUseNativeMethods_ = useNativeMethods; - impl_ = new UserQueueImplILE(); - } - - } else { - if (mustUseNativeMethods_) { - mustUseNativeMethods_ = useNativeMethods; - if (impl_ != null) { - impl_.close(handle_); - impl_ = null; - handle_ = 0; - } - } - } - - } - - - /* - * private methods - */ - - private void open() { - - handle_ = impl_.open(objectNameBytes_); - // TODO : Determine attributes. - byte[] outputBytes = new byte[128]; - impl_.getAttributes(handle_, outputBytes); - // - // 96 60 Queue type Bits 1-2 - // 00 = Keyed - // 01 = Last in, first out (LIFO) - // 10 = First in, first out (FIFO) - if ((outputBytes[96] & 0x60) == 0 ) { - queueType_ = QUEUE_TYPE_KEYED; - } else if ((outputBytes[96] & 0x60) == 0x20 ) { - queueType_ = QUEUE_TYPE_LAST_IN_FIRST_OUT; - } else if ((outputBytes[96] & 0x60) == 0x40 ) { - queueType_ = QUEUE_TYPE_FIRST_IN_FIRST_OUT; - } - // 111 6F Maximum size of message to be enqueued Bin(4) - dataSize_ = 0x1000000 * (0xFF & outputBytes[111]) + - 0x10000 * (0xFF & outputBytes[112]) + - 0x100 * (0xFF & outputBytes[113]) + - (0xFF & outputBytes[114]); - // 109 6D Key length Bin(2) - keyLength_ = 0x100 * (0xFF & outputBytes[109]) + (0xFF & outputBytes[110]); - - - } - - - /* - * Static methods for working with dequeue message prefix bytes. - */ - - /** - * Resets the dequeueMessagePrefixBytes to zero - */ - public static void resetDequeueMessagePrefixBytes(byte[] dequeueMessagePrefixBytes) { - Arrays.fill(dequeueMessagePrefixBytes, (byte) 0x0); - } - - /** - * Returns the output length from the deqMsgPrefixBytes buffer - */ - public static int getDequeueMessagePrefixBytesLength(byte[] deqMsgPrefixBytes) { - return (0xFF & deqMsgPrefixBytes[16]) * 256 * 16 + - (0xFF & deqMsgPrefixBytes[17]) * 256 + - (0xFF & deqMsgPrefixBytes[18]) * 16 + - (0xFF & deqMsgPrefixBytes[19]); - } - - /** - * Resets the enqueueMessagePrefixBytes to zero - * - * The format of the enqueueMessagePrefix is the following - * Offset - * Dec Hex Field Name Data Type and Length - * 0 0 Size of message to be enqueued Bin(4) - * 4 4 Enqueue key value Char(key length) - * (ignored for FIFO/LIFO queues - * with key lengths equal to 0) - * - */ - public static void resetEnqueueMessagePrefixBytes(byte[] enqueueMessagePrefixBytes) { - Arrays.fill(enqueueMessagePrefixBytes, (byte) 0x0); - } - - public static void setEnqueueMessagePrefixBytesMessageSize(byte[] enqueueMessagePrefixBytes, int messageSize) { - enqueueMessagePrefixBytes[0] = (byte) ( messageSize / 0x1000000); - enqueueMessagePrefixBytes[1] = (byte) ((messageSize / 0x10000) & 0xFF); - enqueueMessagePrefixBytes[2] = (byte) ((messageSize / 0x100) & 0xFF); - enqueueMessagePrefixBytes[3] = (byte) ( messageSize & 0xFF); - } - - public static void setEnqueueMessagePrefixBytesEnqueueKey(byte[] enqueueMessagePrefixBytes, byte[] keyBytes) { - System.arraycopy(keyBytes, 0, enqueueMessagePrefixBytes, 4, keyBytes.length) ; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/UserQueueImpl.java b/cvsroot/src/com/ibm/as400/access/UserQueueImpl.java deleted file mode 100644 index d9437e659..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserQueueImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserQueue.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2010-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.util.Arrays; - -/** - The UserQueue class represents an IBM i user queue object. - - This class currently will only function when running on the IBM i using native Methods. - -

      As a performance optimization, when running directly on IBM i, it is possible to use native - methods to access the user space from the current job. To enable this support, use the - {@link #setMustUseNativeMethods setMustUseNativeMethods()} method. - - **/ - -interface UserQueueImpl -{ - public int create(byte[] objectNameBytes, - byte[] extendedAttributeBytes, byte queueType, int keyLength, - int dataSize, int initialNumberOfMessages, - int additionNumberOfMessages, byte[] publicAuthorityBytes, - byte[] descriptionBytes, byte[] replaceBytes); - - public int enqueue(int handle, byte[] enqMsgPrefix, byte[] value); - public int dequeue(int handle, byte[] deqMsgPrefix, byte[] outputBuffer); - public int delete(int handle, byte[] objectNameBytes); - public int open(byte[] objectNameBytes); - public int close(int handle); - public int getAttributes(int handle, byte[] outputBytes); -} diff --git a/cvsroot/src/com/ibm/as400/access/UserQueueImplILE.java b/cvsroot/src/com/ibm/as400/access/UserQueueImplILE.java deleted file mode 100644 index 619da4449..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserQueueImplILE.java +++ /dev/null @@ -1,85 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserQueue.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2010-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.util.Arrays; - -/** - The UserQueue class represents an IBM i user queue object. - - This class currently will only function when running on the IBM i using native Methods. - -

      As a performance optimization, when running directly on IBM i, it is possible to use native - methods to access the user space from the current job. To enable this support, use the - {@link #setMustUseNativeMethods setMustUseNativeMethods()} method. - - **/ - -class UserQueueImplILE implements UserQueueImpl -{ - static { - /* Make sure the library is loaded */ - NativeMethods.loadNativeLibraryQyjspart(); - } - - public UserQueueImplILE() { - // Nothing to do in constructor - } - - public int create(byte[] objectNameBytes, - byte[] extendedAttributeBytes, byte queueType, int keyLength, - int dataSize, int initialNumberOfMessages, - int additionNumberOfMessages, byte[] publicAuthorityBytes, - byte[] descriptionBytes, byte[] replaceBytes) { - return nativeCreate(objectNameBytes, extendedAttributeBytes, queueType, keyLength, dataSize, initialNumberOfMessages, additionNumberOfMessages, publicAuthorityBytes, descriptionBytes, replaceBytes); - - } - - public int enqueue(int handle, byte[] enqMsgPrefix, byte[] value) { - return nativeEnqueue(handle, enqMsgPrefix, value); - } - public int dequeue(int handle, byte[] deqMsgPrefix, byte[] outputBuffer) { - return nativeDequeue(handle, deqMsgPrefix, outputBuffer); - } - public int delete(int handle, byte[] objectNameBytes) { - return nativeDelete(handle, objectNameBytes); - } - public int open(byte[] objectNameBytes) { - return nativeOpen(objectNameBytes); - } - - public int close(int handle) { - return nativeClose(handle); - } - - public int getAttributes(int handle, byte[] outputBytes) { - return nativeGetAttributes(handle, outputBytes); - } - - native int nativeCreate(byte[] objectNameBytes, - byte[] extendedAttributeBytes, byte queueType, int keyLength, - int dataSize, int initialNumberOfMessages, - int additionNumberOfMessages, byte[] publicAuthorityBytes, - byte[] descriptionBytes, byte[] replaceBytes); - native int nativeEnqueue(int handle, byte[] enqMsgPrefix, byte[] value); - native int nativeDequeue(int handle, byte[] deqMsgPrefix, byte[] outputBuffer); - native int nativeDelete(int handle, byte[] objectNameBytes); - native int nativeOpen(byte[] objectNameBytes); - native int nativeClose(int handle); - native int nativeGetAttributes(int handle, byte[] outputBytes); - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/UserSpace.java b/cvsroot/src/com/ibm/as400/access/UserSpace.java deleted file mode 100644 index 8cf917385..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserSpace.java +++ /dev/null @@ -1,1142 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserSpace.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.CharConversionException; -import java.io.IOException; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.util.Vector; - -/** - Represents a user space object in the IBM i operating system. -

      Usage note: By default, the UserSpace class will make use of two different host servers. - For performance reasons, the File Server will be used for read() and write() requests, and - the Remote Command Host Server will be used for create() and other requests. - This behavior can be changed with the {@link #setMustUseProgramCall setMustUseProgramCall()} method. -

      Similarly, when running directly on IBM i, by default the UserSpace class will call internal - API's and commands on-thread when possible, bypassing the Remote Command Host Server. - This behavior can be changed with the {@link #setMustUseSockets setMustUseSockets()} method. -

      As a performance optimization, when running directly on IBM i, it is possible to use native - methods to access the user space from the current job. To enable this support, use the - {@link #setMustUseNativeMethods setMustUseNativeMethods()} method. -

      For applications that access user spaces located in QTEMP, users are strongly advised - to keep everything in the same job, by calling setMustUseProgramCall(true) and - setMustUseSockets(true), since different jobs have different QTEMP libraries. - **/ -public class UserSpace implements Serializable -{ - private static final String CLASSNAME = "com.ibm.as400.access.UserSpace"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - static final long serialVersionUID = 4L; - - /** - Force to auxiliary storage option that allows changes to be forced asynchronously. - **/ - public static final int FORCE_ASYNCHRONOUS = 1; - - /** - Force to auxiliary storage option that does not allow changes to be forced. It uses normal system writes. - **/ - public static final int FORCE_NONE = 0; - - /** - Force to auxiliary storage option that allows changes to be forced synchronously. - **/ - public static final int FORCE_SYNCHRONOUS = 2; - - /** - Constant representing the default domain for the user space. The QALWUSRDMN system value is used to determine the domain. - **/ - public static final String DOMAIN_DEFAULT = "*DEFAULT"; - - /** - Constant indicating the domain for the user space is *USER. - **/ - public static final String DOMAIN_USER = "*USER"; - - /** - Constant indicating the domain for the user space is *SYSTEM. - **/ - public static final String DOMAIN_SYSTEM = "*SYSTEM"; - - // Maximum allowed user space size. - private static final int MAX_USER_SPACE_SIZE = 16776704; - - // The system where the user space is located. - private AS400 system_ = null; - // The full IFS path name of the user space. - private String path_ = ""; - // The library that contains the user space. - private String library_ = ""; - // The name of the user space. - private String name_ = ""; - // Use ProgramCall instead of IFS. - private boolean mustUseProgramCall_ = false; - // Use sockets instead of native methods when running natively. - private boolean mustUseSockets_ = false; - // Use native methods when running natively; - private boolean mustUseNativeMethods_ = false; - - // Data converter for reads and writes with string objects. - private transient Converter dataConverter_ = null; - - // Implementation object interacts with system or native methods. - private transient UserSpaceImpl impl_ = null; - - private transient UserSpaceNativeReadWriteImpl nativeReadWriteImpl_ = null; - // List of user space event bean listeners. - private transient Vector userSpaceListeners_ = null; // Set on first add. - // List of property change event bean listeners. - private transient PropertyChangeSupport propertyChangeListeners_ = null; // Set on first add. - // List of vetoable change event bean listeners. - private transient VetoableChangeSupport vetoableChangeListeners_ = null; // Set on first add. - - /** - Constructs a UserSpace object. The system and path properties must be set before using any method requiring a connection to the system. - **/ - public UserSpace() - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing UserSpace object."); - } - - /** - Constructs a UserSpace object. It creates a UserSpace instance that represents the user space path on system. - @param system The system that contains the user space. - @param path The fully qualified integrated file system path name to the user space. - **/ - public UserSpace(AS400 system, String path) - { - super(); - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Constructing UserSpace object, system: " + system + " path: " + path); - // Validate arguments. - if (system == null) { - throw new NullPointerException("system"); - } - if (path == null) { - throw new NullPointerException("path"); - } - // Verify path is valid IFS path name. - QSYSObjectPathName ifs = new QSYSObjectPathName(path, "USRSPC"); - - // Set instance variables. - system_ = system; - path_ = path; - library_ = ifs.getLibraryName(); - name_ = ifs.getObjectName(); - } - - /** - Adds a listener to be notified when the value of any bound property is changed. It can be removed with removePropertyChangeListener(). - @param listener The listener object. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding property change listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - // If first add. - if (propertyChangeListeners_ == null) - { - synchronized (this) - { - if (propertyChangeListeners_ == null) - { - propertyChangeListeners_ = new PropertyChangeSupport(this); - } - } - } - propertyChangeListeners_.addPropertyChangeListener(listener); - } - - /** - Adds a listener to be notified when a UserSpaceEvent is fired. - @param listener The listener object. - **/ - public void addUserSpaceListener(UserSpaceListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding user space listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - // If first add. - if (userSpaceListeners_ == null) - { - synchronized (this) - { - if (userSpaceListeners_ == null) - { - userSpaceListeners_ = new Vector(); - } - } - } - userSpaceListeners_.addElement(listener); - } - - /** - Adds a listener to be notified when the value of any constrained property is changed. - @param listener The listener object. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Adding vetoable change listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - // If first add. - if (vetoableChangeListeners_ == null) - { - synchronized (this) - { - if (vetoableChangeListeners_ == null) - { - vetoableChangeListeners_ = new VetoableChangeSupport(this); - } - } - } - vetoableChangeListeners_.addVetoableChangeListener(listener); - } - - // Determines the type of implementation that will be used. Properties system, path, and mustUseProgramCall are committed at this time. - private synchronized void chooseImpl() throws AS400SecurityException, IOException - { - if (system_ != null) system_.signon(false); - if (impl_ == null) - { - // Verify required attributes have been set. - if (system_ == null) - { - Trace.log(Trace.ERROR, "Cannot connect to the server before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (path_.length() == 0) - { - Trace.log(Trace.ERROR, "Cannot connect to the server before setting path."); - throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - if(mustUseSockets_) - impl_ = (com.ibm.as400.access.UserSpaceImpl)system_.loadImpl2("com.ibm.as400.access.UserSpaceImplRemote", "com.ibm.as400.access.UserSpaceImplProxy"); - else - impl_ = (com.ibm.as400.access.UserSpaceImpl)system_.loadImpl3("com.ibm.as400.access.UserSpaceImplNative", "com.ibm.as400.access.UserSpaceImplRemote", "com.ibm.as400.access.UserSpaceImplProxy"); - - // Set the fixed properties in the implementation object. - impl_.setProperties(system_.getImpl(), path_, name_, library_, mustUseProgramCall_, mustUseSockets_); - } - } - - /** - Closes the user space and releases any system resources associated with the stream. - Note: Closing the user space does not delete it. It simply closes this UserSpace object's file stream connection to the user space. - @see #delete - **/ - public synchronized void close() throws IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Closing user space."); - if (impl_ != null) impl_.close(); - } - - /** - Creates the user space. - @param length The initial size (in bytes) of the user space. Valid values are 1 through 16,776,704. User spaces with lengths of 16,773,120 or less will be created with optimum space alignment. These user spaces can not be resized to greater than 16,773,120 bytes. For performance, lengths of 16,773,120 or less are recommended. - @param replace The value indicating if an existing user space is to be replaced. - @param extendedAttribute The user-defined extended attribute of the user space. This string must be 10 characters or less. - @param initialValue The value used in creation and extension. - @param textDescription The text describing the user space. This string must be 50 characters or less. - @param authority The public authority for the user space. This string must be 10 characters or less. Valid values are: -

        -
      • *ALL -
      • *CHANGE -
      • *EXCLUDE -
      • *LIBCRTAUT -
      • *USE -
      • authorization-list name -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void create(int length, boolean replace, String extendedAttribute, byte initialValue, String textDescription, String authority) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Create with domain "*DEFAULT" - create(new byte[] { 0x5C, (byte)0xC4, (byte)0xC5, (byte)0xC6, (byte)0xC1, (byte)0xE4, (byte)0xD3, (byte)0xE3, (byte)0x40, (byte)0x40 }, length, replace, extendedAttribute, initialValue, textDescription, authority); - } - - /** - Creates the user space. - @param domain The domain into which the user space is created. Valid value are: -
        -
      • {@link #DOMAIN_DEFAULT DOMAIN_DEFAULT} -
      • {@link #DOMAIN_USER DOMAIN_USER} -
      • {@link #DOMAIN_SYSTEM DOMAIN_SYSTEM} -
      - @param length The initial size (in bytes) of the user space. Valid values are 1 through 16,776,704. User spaces with lengths of 16,773,120 or less will be created with optimum space alignment. These user spaces can not be resized to greater than 16,773,120 bytes. For performance, lengths of 16,773,120 or less are recommended. - @param replace The value indicating if an existing user space is to be replaced. - @param extendedAttribute The user-defined extended attribute of the user space. This string must be 10 characters or less. - @param initialValue The value used in creation and extension. - @param textDescription The text describing the user space. This string must be 50 characters or less. - @param authority The public authority for the user space. This string must be 10 characters or less. Valid values are: -
        -
      • *ALL -
      • *CHANGE -
      • *EXCLUDE -
      • *LIBCRTAUT -
      • *USE -
      • authorization-list name -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void create(String domain, int length, boolean replace, String extendedAttribute, byte initialValue, String textDescription, String authority) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Validate the domain parameter. - if (domain == null) { - throw new NullPointerException("domain"); - } - byte[] domainBytes; - if (domain.equals(DOMAIN_DEFAULT)) - { - // EBCDIC "*DEFAULT" - domainBytes = new byte[] { 0x5C, (byte)0xC4, (byte)0xC5, (byte)0xC6, (byte)0xC1, (byte)0xE4, (byte)0xD3, (byte)0xE3, (byte)0x40, (byte)0x40 }; - } - else if (domain.equals(DOMAIN_USER)) - { - // EBCDIC "*USER" - domainBytes = new byte[] { 0x5C, (byte)0xE4, (byte)0xE2, (byte)0xC5, (byte)0xD9, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40 }; - } - else if (domain.equals(DOMAIN_SYSTEM)) - { - // EBCDIC "*SYSTEM" - domainBytes = new byte[] { 0x5C, (byte)0xE2, (byte)0xE8, (byte)0xE2, (byte)0xE3, (byte)0xC5, (byte)0xD4, (byte)0x40, (byte)0x40, (byte)0x40 }; - } - else - { - throw new ExtendedIllegalArgumentException("domain (" + domain + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - create(domainBytes, length, replace, extendedAttribute, initialValue, textDescription, authority); - } - - // Creates the user space. - private void create(byte[] domainBytes, int length, boolean replace, String extendedAttribute, byte initialValue, String textDescription, String authority) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Creating user space."); - // Validate the length parameter. - if (length < 1 || length > MAX_USER_SPACE_SIZE) - { - throw new ExtendedIllegalArgumentException("length (" + length + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // Validate the extended attribute parameter. - if (extendedAttribute == null) { - throw new NullPointerException("extendedAttribute"); - } - if (extendedAttribute.length() == 0) extendedAttribute = " "; - if (extendedAttribute.length() > 10) - { - throw new ExtendedIllegalArgumentException("extendedAttribute (" + extendedAttribute + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - // Validate the text description parameter. - if (textDescription == null) { - throw new NullPointerException("textDescription"); - } - if (textDescription.length() == 0) textDescription = " "; - if (textDescription.length() > 50) - { - throw new ExtendedIllegalArgumentException("textDescription (" + textDescription + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - // Validate the authority parameter. - if (authority == null) { - throw new NullPointerException("authority"); - } - if (authority.length() == 0 || authority.length() > 10) - { - throw new ExtendedIllegalArgumentException("authority (" + authority + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - chooseImpl(); - impl_.create(domainBytes, length, replace, extendedAttribute, initialValue, textDescription, authority); - - // Fire the CREATED event. - if (userSpaceListeners_ != null) fireUserSpaceEvent(UserSpaceEvent.US_CREATED); - } - - /** - Deletes the user space. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void delete() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Deleting user space."); - chooseImpl(); - impl_.delete(); - - // Fire the DELETED event. - if (userSpaceListeners_ != null) fireUserSpaceEvent(UserSpaceEvent.US_DELETED); - } - - /** - Determines if the user space exists. - @return true if the user space exists; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - **/ - public boolean exists() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Determining user space existence."); - try - { - chooseImpl(); - impl_.getLength(); - return true; - } - catch (ObjectDoesNotExistException e) - { - return false; - } - } - - // Fires the user space events. - private void fireUserSpaceEvent(int eventType) - { - Vector targets = (Vector)userSpaceListeners_.clone(); - UserSpaceEvent event = new UserSpaceEvent(this, eventType); - for (int i = 0; i < targets.size(); ++i) - { - UserSpaceListener target = (UserSpaceListener)targets.elementAt(i); - switch (eventType) - { - case UserSpaceEvent.US_CREATED: - target.created(event); - break; - case UserSpaceEvent.US_DELETED: - target.deleted(event); - break; - case UserSpaceEvent.US_READ: - target.read(event); - break; - case UserSpaceEvent.US_WRITTEN: - target.written(event); - break; - } - } - } - - /** - Returns the initial value used for filling in the user space during creation and extension. - @return The initial value used during user space creation and extension. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public byte getInitialValue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving user space initial value."); - chooseImpl(); - return impl_.getInitialValue(); - } - - /** - Returns the size (in bytes) of the user space. - @return The size (in bytes) of the user space. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int getLength() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving user space length."); - chooseImpl(); - return impl_.getLength(); - } - - /** - Returns the user space name. - @return The name of the user space. - **/ - public String getName() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting user space name: " + name_); - return name_; - } - - /** - Returns the integrated file system path name of the object represented by the user space. - @return The integrated file system path name of the object represented by the user space. - **/ - public String getPath() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting user space path: " + path_); - return path_; - } - - /** - Returns the system object for this user space. - @return The system object for this user space. - **/ - public AS400 getSystem() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Getting system: " + system_); - return system_; - } - - /** - Indicates if the user space is auto extendible. When running on a system other than the system that contains the user space, the auto extend attribute is always true and cannot be changed, so the attribute value returned should be ignored. The auto extend attribute can be used when running on the same system as the user space with the optimizations that are a part of the operating system. - @return true if the user space is auto extendible; false otherwise. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public boolean isAutoExtendible() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Retrieving user space auto extendibility."); - chooseImpl(); - return impl_.isAutoExtendible(); - } - - /** - Indicates if the Toolbox ProgramCall class will be used internally to perform user space read and write requests. If false, Toolbox Integrated File System classes will be used to perform user space read and write requests. - @return true if user space read and write requests will be performed via program call; false otherwise. - @see #setMustUseProgramCall - **/ - public boolean isMustUseProgramCall() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if user space must use program call:", mustUseProgramCall_); - return mustUseProgramCall_; - } - - /** - Indicates if the native methods will be used internally to perform user space read and write requests. - If false, either ProgramCall or Toolbox Integrated File System classes will be used to perform - user space read and write requests. - @return true if user space read and write requests will be performed via native methods; false otherwise. - @see #setMustUseNativeMethods - **/ - - public boolean isMustUseNativeMethods() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if user space must use native methods:", mustUseNativeMethods_); - return mustUseNativeMethods_; - } - - /** - Reads up to dataBuffer.length bytes from the user space beginning at userSpaceOffset into dataBuffer. - @param dataBuffer The buffer to fill with data. Buffer.length() bytes will be read from the user space. - @param userSpaceOffset The offset in the user space from which to start reading. - @return The total number of bytes read into the buffer, or -1 if the userSpaceOffset is beyond the end of the user space. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int read(byte[] dataBuffer, int userSpaceOffset) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Validate the data buffer parameter. - if (dataBuffer == null) { - throw new NullPointerException("dataBuffer"); - } - - return read(dataBuffer, userSpaceOffset, 0, dataBuffer.length); - } - - /** - Reads up to length bytes from the user space beginning at userSpaceOffset into dataBuffer beginning at dataOffset. - @param dataBuffer The buffer to fill with data. - @param userSpaceOffset The offset in the user space from which to start reading. - @param dataOffset The starting offset in the data buffer for the results of the read. - @param length The number of bytes to read. - @return The total number of bytes read into the buffer, or -1 if the userSpaceOffset is beyond the end of the user space. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public int read(byte[] dataBuffer, int userSpaceOffset, int dataOffset, int length) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Validate the data buffer parameter. - if (dataBuffer == null) { - throw new NullPointerException("dataBuffer"); - } - if (dataBuffer.length == 0) - { - throw new ExtendedIllegalArgumentException("dataBuffer.length (" + dataBuffer.length + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - // Validate the user space offset parameter. - if (userSpaceOffset < 0 || userSpaceOffset > MAX_USER_SPACE_SIZE) - { - throw new ExtendedIllegalArgumentException("userSpaceOffset (" + userSpaceOffset + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - // Validate the data offset parameter. - if (dataOffset < 0 || dataOffset >= dataBuffer.length) - { - throw new ExtendedIllegalArgumentException("dataOffset (" + dataOffset + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // Validate the length parameter. - if (length < 0 || length > (dataBuffer.length - dataOffset)) - { - throw new ExtendedIllegalArgumentException("length (" + length + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - // Handle a read of 0 bytes here. - if (length == 0) return 0; - - // Do the read. - int bytesRead; - if (nativeReadWriteImpl_ != null) { - bytesRead = nativeReadWriteImpl_.read(dataBuffer, userSpaceOffset, dataOffset, length); - } else { - chooseImpl(); - bytesRead = impl_.read(dataBuffer, userSpaceOffset, dataOffset, length); - } - // Fire the READ event. - if (userSpaceListeners_ != null) fireUserSpaceEvent(UserSpaceEvent.US_READ); - - return bytesRead; - } - - /** - Returns a string from the user space beginning at userSpaceOffset. Data is read from the user space as if by the read(byte[], int, int, int) method. The resulting byte array is then converted into a String. - @param userSpaceOffset The offset in the user space from which to start reading. - @param length The number of bytes to read. - @return The string value from the user space. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public String read(int userSpaceOffset, int length) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Validate the length parameter. - if (length <= 0) - { - throw new ExtendedIllegalArgumentException("length (" + length + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - // Do the read. - byte[] dataBuffer = new byte[length]; - read(dataBuffer, userSpaceOffset, 0, length); - if (dataConverter_ == null) - { - synchronized (this) - { - if (dataConverter_ == null) - { - dataConverter_ = new Converter(system_.getCcsid(), system_); - } - } - } - return dataConverter_.byteArrayToString(dataBuffer); - } - - /** - Removes this listener from being notified when a bound property changes. - @param listener The listener object. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing property change listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - // If we have listeners. - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.removePropertyChangeListener(listener); - } - } - - /** - Removes a listener from the UserSpace listeners list. - @param listener The listener object. - **/ - public void removeUserSpaceListener(UserSpaceListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing user space listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - // If we have listeners. - if (userSpaceListeners_ != null) - { - userSpaceListeners_.removeElement(listener); - } - } - - /** - Removes this listener from being notified when a constrained property changes. - @param listener The listener object. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Removing vetoable change listener."); - if (listener == null) { - throw new NullPointerException("listener"); - } - // If we have listeners. - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.removeVetoableChangeListener(listener); - } - } - - /** - Sets the auto extend attribute if possible. When running on a system other than the system that contains the user space, the auto extend attribute cannot be set, so this method is ignored and auto extend is always true. Auto extend can be set when running on the same system as the user space with the optimizations that are a part of the operating system. - @param autoExtendibility The attribute for user space auto extendibility. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setAutoExtendible(boolean autoExtendibility) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - chooseImpl(); - impl_.setAutoExtendible(autoExtendibility); - } - - /** - Sets the initial value to be used during user space creation or extension. - @param initialValue The new initial value used during future extensions. For best performance, set to zero. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setInitialValue(byte initialValue) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - chooseImpl(); - impl_.setInitialValue(initialValue); - } - - /** - Sets the size (in bytes) of the user space. - @param length The new size (in bytes) of the user space. Valid values are 1 through 16,776,704. User spaces with lengths of 16,773,120 or less, created with optimum space alignment, can not be resized to greater than 16,773,120 bytes. For performance, lengths of 16,773,120 or less are recommended. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void setLength(int length) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Validate the length parameter. - if (length < 1 || length > MAX_USER_SPACE_SIZE) - { - throw new ExtendedIllegalArgumentException("length (" + length + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - chooseImpl(); - impl_.setLength(length); - } - - /** - Specifies the API set that is used to perform user space read and write operations. - This method is useful when using ProgramCall or CommandCall objects in conjunction with user spaces. - If false (the default), read and write requests are made via the File Server; internally, an IFSRandomAccessFile object is used to perform read and write requests. If true, internally a ProgramCall object is used to perform read and write requests, which are made via the Remote Command Host Server. In general, requests made via the File object are faster, but the behavior of requests made via a ProgramCall object is more consistent with user space API's. -

      If accessing user spaces located in QTEMP, it is strongly advised that setMustUseProgramCall(true) be called. In addition, depending on whether subsequent accesses of the user space (such as by program calls) will be run on- or off-thread, you should also call {@link #setMustUseSockets setMustUseSockets(true)}. -

      This property cannot be reset once a connection has been established. - @param useProgramCall Internally use ProgramCall to perform read and write requests. - @see #isMustUseProgramCall - **/ - public void setMustUseProgramCall(boolean useProgramCall) - { - // Verify that connection has not been made. - if (impl_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property 'mustUseProgramCall' after connect."); - throw new ExtendedIllegalStateException("mustUseProgramCall", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null) - { - mustUseProgramCall_ = useProgramCall; - } - else - { - Boolean oldValue = new Boolean(mustUseProgramCall_); - Boolean newValue = new Boolean(useProgramCall); - - mustUseProgramCall_ = useProgramCall; - - // Fire the property change event. - propertyChangeListeners_.firePropertyChange("mustUseProgramCall", oldValue, newValue); - } - } - - - /** - Specifies whether native methods are used by the current to perform user space read and write operations. - This option can only be set to true when the application is running on the System i. - This method may only be called after the path to the user space is set. -

      It is not advised to use native methods to access user spaces in QTEMP because toolbox does not - provide a method to create a user space in QTEMP of the current job. -

      The programmer must be aware that no locking occurs when native methods are used to read and write from the - user space. If a user space is being used by multiple threads or processes, the values read may reflect a partial - operation performed by another thread or process. - @param useNativeMethods Internally use ProgramCall to perform read and write requests. - * @throws CharConversionException - * @throws UnsupportedEncodingException - * @throws SecurityException - * @throws UnsatisfiedLinkError - @see #isMustUseNativeMethods - **/ - public void setMustUseNativeMethods(boolean useNativeMethods) throws - UnsupportedEncodingException, - CharConversionException, - UnsatisfiedLinkError, - SecurityException - { - - if (propertyChangeListeners_ == null) - { - mustUseNativeMethods_ = useNativeMethods; - } - else - { - Boolean oldValue = new Boolean(mustUseNativeMethods_); - Boolean newValue = new Boolean(useNativeMethods); - - mustUseNativeMethods_ = useNativeMethods; - - // Fire the property change event. - propertyChangeListeners_.firePropertyChange("mustUseNativeMethods", oldValue, newValue); - } - if (useNativeMethods) { - // Only open it not already set. - if (nativeReadWriteImpl_ == null) { - // For now assume ILE methods, in the future we may need to choose PASE methods - nativeReadWriteImpl_ = new UserSpaceNativeReadWriteImplILE(system_); - nativeReadWriteImpl_.open(library_, name_); - } - } else { - if (nativeReadWriteImpl_ != null) { - nativeReadWriteImpl_.close(); - nativeReadWriteImpl_ = null; - } - } - } - - - - /** - Sets the path for the user space. The path can only be set before a connection has been established. - @param path The fully qualified integrated file system path name to the user space. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setPath(String path) throws PropertyVetoException - { - // Check parameter. - if (path == null) { - throw new NullPointerException("path"); - } - // Verify path is valid IFS path name. - QSYSObjectPathName ifs = new QSYSObjectPathName(path, "USRSPC"); - - if (impl_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property 'path' after connect."); - throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - library_ = ifs.getLibraryName(); - name_ = ifs.getObjectName(); - path_ = path; - } - else - { - String oldValue = path_; - String newValue = path; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("path", oldValue, newValue); - } - - library_ = ifs.getLibraryName(); - name_ = ifs.getObjectName(); - path_ = newValue; - - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("path", oldValue, newValue); - } - } - } - - /** - Sets the system object for the user space. The system can only be set before a connection has been established. - @param system The system that contains the user space. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem(AS400 system) throws PropertyVetoException - { - // Check parameter. - if (system == null) { - throw new NullPointerException("system"); - } - // Verify that connection has not been made. - if (impl_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property 'system' after connect."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null && vetoableChangeListeners_ == null) - { - system_ = system; - } - else - { - AS400 oldValue = system_; - AS400 newValue = system; - - if (vetoableChangeListeners_ != null) - { - vetoableChangeListeners_.fireVetoableChange("system", oldValue, newValue); - } - system_ = newValue; - if (propertyChangeListeners_ != null) - { - propertyChangeListeners_.firePropertyChange("system", oldValue, newValue); - } - } - } - - /** - Writes up to dataBuffer.length bytes from dataBuffer into the user space beginning at userSpaceOffset. - @param dataBuffer The data buffer to be written to the user space. - @param userSpaceOffset The position in the user space to start writing. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void write(byte[] dataBuffer, int userSpaceOffset) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Validate the data buffer parameter. - if (dataBuffer == null) { - throw new NullPointerException("dataBuffer"); - } - write(dataBuffer, userSpaceOffset, 0, dataBuffer.length, FORCE_NONE); - } - - /** - Writes up to length bytes from dataBuffer beginning at dataOffset into the user space beginning at userSpaceOffset. - @param dataBuffer The data buffer to be written to the user space. - @param userSpaceOffset The position in the user space to start writing. - @param dataOffset The position in the write data buffer from which to start copying. - @param length The length (in bytes) of data to be written. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void write(byte[] dataBuffer, int userSpaceOffset, int dataOffset, int length) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - write(dataBuffer, userSpaceOffset, dataOffset, length, FORCE_NONE); - } - - /** - Writes up to length bytes from dataBuffer beginning at dataOffset into the user space beginning at userSpaceOffset. - @param dataBuffer The data buffer to be written to the user space. - @param userSpaceOffset The position in the user space to start writing. - @param dataOffset The position in the write data buffer from which to start copying. - @param length The length (in bytes) of data to be written. - @param forceAuxiliary The method of forcing changes made to the user space to auxiliary storage. Valid values are: -

        -
      • FORCE_NONE -
      • FORCE_ASYNCHRONOUS -
      • FORCE_SYNCHRONOUS -
      - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void write(byte[] dataBuffer, int userSpaceOffset, int dataOffset, int length, int forceAuxiliary) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Validate the data buffer parameter. - if (dataBuffer == null) { - throw new NullPointerException("dataBuffer"); - } - if (dataBuffer.length == 0) - { - throw new ExtendedIllegalArgumentException("dataBuffer.length (" + dataBuffer.length + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - // Validate the user space offset parameter. - if (userSpaceOffset < 0 || userSpaceOffset > MAX_USER_SPACE_SIZE) - { - throw new ExtendedIllegalArgumentException("userSpaceOffset (" + userSpaceOffset + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // Validate the data offset parameter. - if (dataOffset < 0 || dataOffset >= dataBuffer.length) - { - throw new ExtendedIllegalArgumentException("dataOffset (" + dataOffset + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // Validate the length parameter. - if (length < 0 || length > (dataBuffer.length - dataOffset)) - { - throw new ExtendedIllegalArgumentException("length (" + length + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // Validate the overflow possibility. - if (userSpaceOffset + length >= MAX_USER_SPACE_SIZE) - { - Trace.log(Trace.ERROR, "Request is not supported, causes space overflow."); - throw new ExtendedIllegalArgumentException("userSpaceOffset + length (" + userSpaceOffset + " + " + length + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - // Validate the force auxiliary parameter. - if (forceAuxiliary < 0 || forceAuxiliary > 2) - { - throw new ExtendedIllegalArgumentException("forceAuxiliary (" + forceAuxiliary + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (nativeReadWriteImpl_ != null) { - nativeReadWriteImpl_.write(dataBuffer, userSpaceOffset, dataOffset, length, forceAuxiliary); - } else { - chooseImpl(); - impl_.write(dataBuffer, userSpaceOffset, dataOffset, length, forceAuxiliary); - } - - // Fire the WRITTEN event. - if (userSpaceListeners_ != null) fireUserSpaceEvent(UserSpaceEvent.US_WRITTEN); - } - - /** - Writes a string into the user space beginning at userSpaceOffset. String is converted into bytes and written to the user space as if by the write(byte[], int) method. - @param data The data buffer to be written to the user space. - @param userSpaceOffset The position in the user space to start writing. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public void write(String data, int userSpaceOffset) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Validate the data parameter. - if (data == null) { - throw new NullPointerException("data"); - } - if (data.length() == 0) - { - throw new ExtendedIllegalArgumentException("data (" + data + ")", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - chooseImpl(); - if (dataConverter_ == null) - { - synchronized (this) - { - if (dataConverter_ == null) - { - dataConverter_ = new Converter(system_.getCcsid(), system_); - } - } - } - write(dataConverter_.stringToByteArray(data), userSpaceOffset); - } - - /** - * Sets this object to using sockets. - * This method is useful when running directly on IBM i, using ProgramCall or CommandCall objects - * in conjunction with user spaces. - * When your Java program runs on the IBM i system, some Toolbox classes access data via a - * direct API call instead of making a socket call to the system (for example, to the Remote - * Command Host Server). - * There are minor differences in the behavior of the classes when they use direct API calls - * instead of socket calls. If your program is affected by these differences you can use this - * method to force the Toolbox classes to use socket calls instead of direct API calls. - * The default is false. - *

      Note: This method has no effect if the Java application is running remotely, that is, not - * running directly on an IBM i system. When running remotely, the Toolbox submits all - * program and command calls via sockets, regardless of the setting of this property. - *

      This property cannot be reset once a connection has been established. - * @param mustUseSockets true to use sockets; false otherwise. - * @see #isMustUseSockets - * @see CommandCall#setThreadSafe(Boolean) - * @see ProgramCall#setThreadSafe(boolean) - **/ - public void setMustUseSockets(boolean mustUseSockets) - { - // Verify that connection has not been made. - if (impl_ != null) - { - Trace.log(Trace.ERROR, "Cannot set property 'mustUseSockets' after connect."); - throw new ExtendedIllegalStateException("mustUseSockets", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - - if (propertyChangeListeners_ == null) - { - mustUseSockets_ = mustUseSockets; - } - else - { - Boolean oldValue = new Boolean(mustUseSockets_); - Boolean newValue = new Boolean(mustUseSockets); - - mustUseSockets_ = mustUseSockets; - - // Fire the property change event. - propertyChangeListeners_.firePropertyChange("mustUseSockets", oldValue, newValue); - } - } - - /** - Indicates whether sockets must be used when internally calling programs and commands. - When your Java program runs on the system, some Toolbox classes access data via a direct call to an API instead of making a socket call to the system (for example, to the Remote Command Host Server). There are minor differences in the behavior of the classes when they use direct API calls instead of socket calls. If your program is affected by these differences you can check whether this object will use socket calls instead of API calls by using this method. - @return true if this object must use sockets; false otherwise. - @see #setMustUseSockets - **/ - public boolean isMustUseSockets() - { - if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Checking if must use sockets:", mustUseSockets_); - return mustUseSockets_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/UserSpace16.gif b/cvsroot/src/com/ibm/as400/access/UserSpace16.gif deleted file mode 100644 index 75d6351db..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/UserSpace16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/UserSpace32.gif b/cvsroot/src/com/ibm/as400/access/UserSpace32.gif deleted file mode 100644 index 7d59650ce..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/UserSpace32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/UserSpaceBeanInfo.java b/cvsroot/src/com/ibm/as400/access/UserSpaceBeanInfo.java deleted file mode 100644 index 68d8f543f..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserSpaceBeanInfo.java +++ /dev/null @@ -1,163 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserSpaceBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** - The UserSpaceBeanInfo class provides bean information for the UserSpace class. - **/ -public class UserSpaceBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Class this bean info represents. - private static final Class BEAN_CLASS = UserSpace.class; - - private static EventSetDescriptor[] eventSetDescriptors; - private static PropertyDescriptor[] propertyDescriptors; - - static - { - try - { - // Define the event descriptors. - EventSetDescriptor propertyChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor userSpace = new EventSetDescriptor(BEAN_CLASS, "userSpace", UserSpaceListener.class, new String[] { "created", "deleted", "read", "written" }, "addUserSpaceListener", "removeUserSpaceListener"); - userSpace.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_US_EVENT")); - userSpace.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_US_EVENT")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(BEAN_CLASS, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(ResourceBundleLoader.getText("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription(ResourceBundleLoader.getText("EVT_DESC_PROPERTY_VETO")); - eventSetDescriptors = new EventSetDescriptor[] { propertyChange, userSpace, vetoableChange }; - - // Define the property descriptors. - PropertyDescriptor path = new PropertyDescriptor("path", BEAN_CLASS); - path.setBound(true); - path.setConstrained(true); - path.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_PATH")); - path.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_PATH")); - - PropertyDescriptor system = new PropertyDescriptor("system", BEAN_CLASS); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_SYSTEM")); - - // The introspecition process will reveal features that aren't really properties. We must declare them and mark as hidden. - PropertyDescriptor autoExtendible = new PropertyDescriptor("autoExtendible", BEAN_CLASS); - autoExtendible.setHidden(true); - - PropertyDescriptor initialValue = new PropertyDescriptor("initialValue", BEAN_CLASS); - initialValue.setHidden(true); - - PropertyDescriptor length = new PropertyDescriptor("length", BEAN_CLASS); - length.setHidden(true); - - PropertyDescriptor name = new PropertyDescriptor("name",BEAN_CLASS, "getName", null); - name.setHidden(true); - - PropertyDescriptor mustUseProgramCall = new PropertyDescriptor("mustUseProgramCall", BEAN_CLASS); - mustUseProgramCall.setBound(true); - mustUseProgramCall.setConstrained(false); - mustUseProgramCall.setDisplayName(ResourceBundleLoader.getText("PROP_NAME_US_MUSTUSEPGMCALL")); - mustUseProgramCall.setShortDescription(ResourceBundleLoader.getText("PROP_DESC_US_MUSTUSEPGMCALL")); - - propertyDescriptors = new PropertyDescriptor[] { path, system, autoExtendible, initialValue, length, name, mustUseProgramCall }; - } - catch (IntrospectionException e) - { - Trace.log(Trace.ERROR, "Unexpected IntrospectionException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(BEAN_CLASS); - } - - /** - Returns the index of the default event. - @return One (1), the index to the default event. - **/ - public int getDefaultEventIndex() - { - // The index for the "userSpace" event. - return 1; - } - - /** - Returns the index of the default property. - @return One (1), the index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // The index for the "path" property. - return 1; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors; - } - - /** - Returns an Image for this bean's icon. - @param icon The desired icon size and color. - @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - return loadImage("UserSpace16.gif"); - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - return loadImage("UserSpace32.gif"); - } - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/UserSpaceEvent.java b/cvsroot/src/com/ibm/as400/access/UserSpaceEvent.java deleted file mode 100644 index 25ef4f67b..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserSpaceEvent.java +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserSpaceEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.EventObject; - -/** - The UserSpaceEvent class represents a user space event. - **/ -public class UserSpaceEvent extends EventObject -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - /** - Event ID indicating that a user space has been created. - **/ - public static final int US_CREATED = 0; - /** - Event ID indicating that a user space has been deleted. - **/ - public static final int US_DELETED = 1; - /** - Event ID indicating that a user space has been read. - **/ - public static final int US_READ = 2; - /** - Event ID indicating that a user space has been written. - **/ - public static final int US_WRITTEN = 3; - - // Event identifier. - private int id_; - - /** - Constructs a UserSpaceEvent object. It uses the specified source and ID. - @param source The object where the event originated. - @param id The event identifier. - **/ - public UserSpaceEvent(Object source, int id) - { - super(source); - - if (id < US_CREATED || id > US_WRITTEN) - { - Trace.log(Trace.ERROR, "Parameter 'id' is not valid."); - throw new ExtendedIllegalArgumentException("id (" + id + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - id_ = id; - } - - /** - Returns the identifier for this event. - @return The identifier for this event. - **/ - public int getID() - { - return id_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/UserSpaceImpl.java b/cvsroot/src/com/ibm/as400/access/UserSpaceImpl.java deleted file mode 100644 index e7d9bde96..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserSpaceImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserSpaceImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -// UserSpaceImpl defines the implementation interface for the UserSpace object. -interface UserSpaceImpl -{ - public void close() throws IOException; - - public void create(byte[] domainBytes, int length, boolean replace, String extendedAttribute, byte initialValue, String textDescription, String authority) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException; - - public void delete() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException; - - public byte getInitialValue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException; - - public int getLength() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException; - - public boolean isAutoExtendible() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException; - - public int read(byte dataBuffer[], int userSpaceOffset, int dataOffset, int length) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException; - - public void setAutoExtendible(boolean autoExtendibility) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException; - - public void setInitialValue(byte initialValue) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException; - - public void setLength(int length) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException; - - public void setProperties(AS400Impl system, String path, String name, String library, boolean mustUseProgramCall, boolean mustUseSockets); - - public void write(byte[] dataBuffer, int userSpaceOffset, int dataOffset, int length, int forceAuxiliary) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException; -} diff --git a/cvsroot/src/com/ibm/as400/access/UserSpaceImplNative.java b/cvsroot/src/com/ibm/as400/access/UserSpaceImplNative.java deleted file mode 100644 index 99b5313e4..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserSpaceImplNative.java +++ /dev/null @@ -1,1191 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserSpaceImplNative.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -class UserSpaceImplNative extends UserSpaceImplRemote -{ - private static final String CLASSNAME = "com.ibm.as400.access.UserSpaceImplNative"; - static - { - if (Trace.traceOn_) Trace.logLoadPath(CLASSNAME); - } - - // Load the service program. - static - { - NativeMethods.loadNativeLibraryQyjspart(); - } - - // declare constants for the attribute type. These types - // are used on getAttrs and setAttrs. *** Warning *** these - // values are duplicated in the "C" code. Since there is no - // way to share a common header file, it is manual process to - // keep them in sync. If you add, change or delete one of - // these constants also change qyjspjus.C in yjsp.xpf. - private static final int INITIAL_VALUE = 0; - private static final int LENGTH = 1; - private static final int AUTO_EXTENDIBLE = 2; - - // declare constants for parameter type. - private static final short IN = 0; - private static final short OUT = 1; - private static final short INOUT = 2; - - // declare constants for the entry points. These constants - // are used when converting Native exceptions to the exception - // thrown to the user. - private static final int CREATE = 0; - private static final int READ = 1; - private static final int WRITE = 2; - private static final int DELETE = 3; - private static final int GET_ATTRIBUTES = 4; - private static final int SET_ATTRIBUTES = 5; - - // ---------------------------------------------------------------------- - // - // Convert a native exception into the exception we really want to throw - // - // ---------------------------------------------------------------------- - - private void buildException(NativeException e, int source) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - String id = converter_.byteArrayToString(e.data, 12, 7); - - int substitutionDataLength = BinaryConverter.byteArrayToInt(e.data, 80); - int textLength = BinaryConverter.byteArrayToInt(e.data, 88); - - String text = converter_.byteArrayToString(e.data, 112 + substitutionDataLength, textLength); - - String idAndText = id + " " + text; - - if ((source == CREATE) || - (source == DELETE) || - (source == GET_ATTRIBUTES) || - (source == SET_ATTRIBUTES)) - { - throw new IOException(idAndText); - } - - else if ((source == READ) || (source == WRITE)) - { - if ((source == READ) && (id.equals("CPF3C14"))) - { - } - - else if ((id.equals("CPF9801")) || - (id.equals("CPF9810"))) - { - throw new ObjectDoesNotExistException("path", - ObjectDoesNotExistException.OBJECT_DOES_NOT_EXIST); - } - - else if ((id.equals("CPF9802")) || - (id.equals("CPF9820")) || - (id.equals("CPF9830"))) - { - throw new AS400SecurityException(AS400SecurityException.OBJECT_AUTHORITY_INSUFFICIENT); - } - else - throw new IOException(idAndText); - } - else - throw new IOException(idAndText); - } - - - // ---------------------------------------------------------------------- - // - // Declare the native methods - // - // Performance: - // - callProgramReturnInt has a built-in 4K programParameter buffer. - // If more than 4K is passed, it must do a malloc/free. If your - // program uses only slightly more than 4K it is probably better - // to update the "C" code to have a bigger default buffer. - // - // - callProgramReturnVoid and callProgramReturnBytes have a default - // programParameter buffer size of 128K. If the buffer is larger - // 128K, the service program will do a malloc/free. If your - // program uses only slightly more than 128K it is probably better - // to update the "C" code to have a bigger default buffer. - // - // ---------------------------------------------------------------------- - - private native void callProgramReturnVoid(byte[] programNameStructure, - byte[] programParameterStructure, - byte[] programParameters) throws NativeException; - - - private native int callProgramReturnInt(byte[] programNameStructure, - byte[] programParameterStructure, - byte[] programParameters, - int valueToReturn) throws NativeException; - - - private native byte[] callProgramReturnBytes(byte[] programNameStructure, - byte[] programParameterStructure, - byte[] programParameters, - int dataLength, - int offsetOfData) throws NativeException; - - // Creates a user space. - public void createZ(String domain, int length, boolean replace, String extendedAttribute, byte initialValue, String textDescription, String authority) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - String replaceString = (replace) ? "*YES" : "*NO"; - - // Set up the buffer that contains the program to call. - byte [] programNameBuffer = createCommandNameBuffer("QUSCRTUS", 9); - - // Set up the parameter structure. There is one structure - // for each parameter. The structure contains: - // 4 bytes - the length of the parameter - // 2 bytes - the parameters usage (input/output/inout) - // 4 bytes - the offset into the parameter buffer - - byte[] programParameterStructure = new byte[90]; - - // The first parameter is user space name (20 bytes) - BinaryConverter.intToByteArray (20, programParameterStructure, 0); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 4); - BinaryConverter.intToByteArray ( 0, programParameterStructure, 6); - - // The second parameter is the extended attribute (10 bytes) - BinaryConverter.intToByteArray (10, programParameterStructure, 10); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 14); - BinaryConverter.intToByteArray (20, programParameterStructure, 16); - - // The third parameter is the initial size (4 bytes) - BinaryConverter.intToByteArray ( 4, programParameterStructure, 20); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 24); - BinaryConverter.intToByteArray (30, programParameterStructure, 26); - - // The fourth parameter is the initial value (1 bytes) - BinaryConverter.intToByteArray ( 1, programParameterStructure, 30); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 34); - BinaryConverter.intToByteArray (34, programParameterStructure, 36); - - // The fifth parameter is the public authority (10 bytes) - BinaryConverter.intToByteArray (10, programParameterStructure, 40); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 44); - BinaryConverter.intToByteArray (35, programParameterStructure, 46); - - // The sixth parameter is the description (50 bytes) - BinaryConverter.intToByteArray (50, programParameterStructure, 50); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 54); - BinaryConverter.intToByteArray (45, programParameterStructure, 56); - - // The seventh parameter is the replace option (10 bytes) - BinaryConverter.intToByteArray (10, programParameterStructure, 60); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 64); - BinaryConverter.intToByteArray (95, programParameterStructure, 66); - - // The eighth parameter is the error code area (32 bytes) - BinaryConverter.intToByteArray ( 32, programParameterStructure, 70); - BinaryConverter.shortToByteArray(INOUT, programParameterStructure, 74); - BinaryConverter.intToByteArray ( 105, programParameterStructure, 76); - - // The ninth parameter is the domain (10 bytes) - BinaryConverter.intToByteArray ( 10, programParameterStructure, 80); - BinaryConverter.shortToByteArray( IN, programParameterStructure, 84); - BinaryConverter.intToByteArray (137, programParameterStructure, 86); - - - - // Set up the Parameter area. - byte[] programParameters = new byte[147]; - - - - // Put the first parm (the user space name) into the parm area. - setBytes(programParameters, converter_.stringToByteArray(createUserSpaceName(name_, library_)), 0); // @C1C - - - // Put the second parm (the extended attribute) into the parm - // area. It is a 10 character field - StringBuffer EAName = new StringBuffer(" "); - if (extendedAttribute != null) - EAName.insert(0, extendedAttribute); - EAName.setLength(10); - String EANameString = EAName.toString(); - setBytes(programParameters, converter_.stringToByteArray(EANameString), 20); // @C1C - - - // Put the third parm (the initial size) into the parm area. - BinaryConverter.intToByteArray(length, programParameters, 30); - - - // Put the fourth parm (the initial value) into the parm area. - programParameters[34] = initialValue; - - - // Put the fifth parm (the authority) into the parm - // area. It is a 10 character field - StringBuffer authorityValue = new StringBuffer(" "); - if (authority != null) - authorityValue.insert(0, authority); - authorityValue.setLength(10); - String authorityString = authorityValue.toString(); - setBytes(programParameters, converter_.stringToByteArray(authorityString), 35); // @C1C - - - // Put the sixth parm (the description) into the parm - // area. It is a 50 character field - StringBuffer descriptionValue = new StringBuffer(" "); - if (textDescription != null) - descriptionValue.insert(0, textDescription); - descriptionValue.setLength(50); - String descriptionString = descriptionValue.toString(); - setBytes(programParameters, converter_.stringToByteArray(descriptionString), 45); // @C1C - - - // Put the seventh parm (replace) into the parm - // area. It is a 10 character field - StringBuffer replaceValue = new StringBuffer(" "); - replaceValue.insert(0, replaceString); - replaceValue.setLength(10); - String replaceString2 = replaceValue.toString(); - setBytes(programParameters, converter_.stringToByteArray(replaceString2), 95); // @C1C - - - // Put the eighth parm (the Error Code) into the parm area. - // This parm is the value 0. This will cause the - // program to generate exceptions that will be handled - // by the service program. - BinaryConverter.intToByteArray(0, programParameters, 105); - - - - // Put the ninth parm (the domain) into the parm - // area. It is a 10 character field - StringBuffer domainValue = new StringBuffer(" "); - if (domain != null) - domainValue.insert(0, domain); - domainValue.setLength(10); - String domainString = domainValue.toString(); - setBytes(programParameters, converter_.stringToByteArray(domainString), 137); // @C1C - - - - - // call the native method to carry out the request. - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = ((AS400ImplRemote)system_).swapTo(swapToPH, swapFromPH); - try - { - Trace.log(Trace.INFORMATION, "calling native method (create) "); - - callProgramReturnVoid(programNameBuffer, - programParameterStructure, - programParameters); - - Trace.log(Trace.INFORMATION, "back from native method (normal) (create) "); - - } - catch (NativeException e) - { - - Trace.log(Trace.INFORMATION, "back from native method (exception) (create) "); - - buildException(e, CREATE); - } - finally - { - if (didSwap) ((AS400ImplRemote)system_).swapBack(swapToPH, swapFromPH); - } - } - - // ---------------------------------------------------------------------- - // - // Create the command-name buffer requred by the service program. It - // contains the program name, program lib (always QSYS) and the number - // of parms. - // - // ---------------------------------------------------------------------- - - private byte[] createCommandNameBuffer(String command, int numberOfParameters) - - throws IOException - - { - - - // Set up the buffer that contains the program to call. The - // buffer contains three items: - // 10 characters - the program to call - // 10 characters - the library that contains the program - // 4 bytes - the number of parameters - - StringBuffer programName = new StringBuffer(" "); - programName.insert(0, command); - programName.insert(10,"QSYS"); - programName.setLength(20); - String programNameString = programName.toString(); - - // converter_ = Converter.getConverter(getCcsidToUse(), system_); //$C0D - byte[] programNameBuffer = new byte[24]; - setBytes(programNameBuffer, converter_.stringToByteArray(programNameString), 0); // @C1C - - BinaryConverter.intToByteArray(numberOfParameters, programNameBuffer, 20); - - return programNameBuffer; - } - - // /** - // Returns the CCSID from the AS400 to be used for this user space. //$C0D - // **/ //$C0D - // int getCcsidToUse() throws InterruptedException, IOException //$C0D - // { //$C0D - // return system_.getCcsid(); //$C0D - // //return system_.getCcsidFromServer(); //$C0D - // } //$C0D - - - - // ---------------------------------------------------------------------- - // - // Create a user space name in the format required by the APIs. - // - // ---------------------------------------------------------------------- - - private String createUserSpaceName(String name, String library) - { - - // Create the 20 character user space name. The first 10 - // characters are the name, the second 10 are the library - StringBuffer pathName = new StringBuffer(" "); - pathName.insert(0, name); - pathName.insert(10, library); - pathName.setLength(20); - return pathName.toString(); - } - - - // ---------------------------------------------------------------------- - // - // Delete a user space (called from userSpaceImpl) - // - // ---------------------------------------------------------------------- - - public void deleteZ() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - - // Set up the buffer that contains the program to call. - byte[] programNameBuffer = createCommandNameBuffer("QUSDLTUS", 2); - - - // Set up the parameter structure. There is one structure - // for each parameter. The structure contains: - // 4 bytes - the length of the parameter - // 2 bytes - the parameters usage (input/output/inout) - // 4 bytes - where to find this data (offset) in the parm buffer - - // The first parameter is the name of the user space - byte[] programParameterStructure = new byte[20]; - BinaryConverter.intToByteArray (20, programParameterStructure, 0); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 4); - BinaryConverter.intToByteArray ( 0, programParameterStructure, 6); - - // The second parameter is the Error Code area - BinaryConverter.intToByteArray ( 32, programParameterStructure, 10); - BinaryConverter.shortToByteArray(INOUT, programParameterStructure, 14); - BinaryConverter.intToByteArray ( 20, programParameterStructure, 16); - - - // Set up the Parameter area. - byte[] programParameters = new byte[52]; - - - // Put the first parm (the user space name) into the parm area. - setBytes(programParameters, converter_.stringToByteArray(createUserSpaceName(name_, library_)), 0); // @C1C - - - // Put the second parm (the Error Code) into the parm area. - // The second parm is the value 0. This will cause the - // program to generate exceptions that will be handled - // by the service program. - BinaryConverter.intToByteArray(0, programParameters, 20); - - - // call the native method to carry out the request. - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = ((AS400ImplRemote)system_).swapTo(swapToPH, swapFromPH); - try - { - Trace.log(Trace.INFORMATION, "calling native method (delete) "); - - callProgramReturnVoid(programNameBuffer, - programParameterStructure, - programParameters); - - Trace.log(Trace.INFORMATION, "back from native method (normal) (delete) "); - - } - catch (NativeException e) - { - - Trace.log(Trace.INFORMATION, "back from native method (exception) (delete) "); - - buildException(e, DELETE); - } - finally - { - if (didSwap) ((AS400ImplRemote)system_).swapBack(swapToPH, swapFromPH); - } - } - - - // ---------------------------------------------------------------------- - // - // Get the attributes of the user space (called locally) - // - // ---------------------------------------------------------------------- - - protected int getAttributesZ(int valueToReturn) - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - int returnValue = 0; - - - // Set up the buffer that contains the program to call. - byte [] programNameBuffer = createCommandNameBuffer("QUSRUSAT", 5); - - - - - // Set up the parameter structure. There is one structure - // for each parameter. The structure contains: - // 4 bytes - the length of the parameter - // 2 bytes - the parameters usage (input/output/inout) - // 4 bytes - the offset into the parameter buffer - - byte[] programParameterStructure = new byte[60]; - - // The first parameter is storage where the attributes are returned - // (24 bytes) - BinaryConverter.intToByteArray ( 24, programParameterStructure, 0); - BinaryConverter.shortToByteArray(OUT, programParameterStructure, 4); - BinaryConverter.intToByteArray ( 0, programParameterStructure, 6); - - // The second parameter is the length of the first parameter - // (a four byte number) - BinaryConverter.intToByteArray ( 4, programParameterStructure, 10); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 14); - BinaryConverter.intToByteArray (24, programParameterStructure, 16); - - // The third parameter is the format name (8 bytes) - BinaryConverter.intToByteArray ( 8, programParameterStructure, 20); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 24); - BinaryConverter.intToByteArray (28, programParameterStructure, 26); - - // The fourth parameter is the user space name (20 bytes) - BinaryConverter.intToByteArray (20, programParameterStructure, 30); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 34); - BinaryConverter.intToByteArray (36, programParameterStructure, 36); - - // The fifth parameter is the error code area - BinaryConverter.intToByteArray ( 32, programParameterStructure, 40); - BinaryConverter.shortToByteArray(INOUT, programParameterStructure, 44); - BinaryConverter.intToByteArray ( 56, programParameterStructure, 46); - - - - - - // Set up the Parameter area. - byte[] programParameters = new byte[88]; - - - // Note the first parm is an output parm so nothing needs to be - // done to the parm area. - - - // Put the second parm (the length of the output area) in the - // parm area. - BinaryConverter.intToByteArray(24, programParameters, 24); - - - // Put the third parm (the attribute format) into the parm - // area. It is an 8 character field - setBytes(programParameters, converter_.stringToByteArray("SPCA0100"), 28); // @C1C - - - // Put the fourth parm (the user space name) into the parm area. - setBytes(programParameters, converter_.stringToByteArray(createUserSpaceName(name_, library_)), 36); // @C1C - - - // Put the fifth parm (the Error Code) into the parm area. - // This parm is the value 0. This will cause the - // program to generate exceptions that will be handled - // by the service program. - BinaryConverter.intToByteArray(0, programParameters, 56); - - - - // call the native method to carry out the request. - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = ((AS400ImplRemote)system_).swapTo(swapToPH, swapFromPH); - try - { - Trace.log(Trace.INFORMATION, "calling native method (get attrs) "); - - returnValue = callProgramReturnInt(programNameBuffer, - programParameterStructure, - programParameters, - valueToReturn); - - Trace.log(Trace.INFORMATION, "back from native method (normal) (get attrs) "); - - } - catch (NativeException e) - { - - Trace.log(Trace.INFORMATION, "back from native method (exception) (get attrs) "); - - buildException(e, GET_ATTRIBUTES); - } - finally - { - if (didSwap) ((AS400ImplRemote)system_).swapBack(swapToPH, swapFromPH); - } - return(returnValue); - } - - - - - // ---------------------------------------------------------------------- - // - // Get the initial value of the user space (called from UserSpaceImpl) - // - // ---------------------------------------------------------------------- - - public byte getInitialValueZ() - - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - - { - return ((byte) getAttributesZ(INITIAL_VALUE)); - } - - // ---------------------------------------------------------------------- - // - // Get the length of the user space (called from UserSpaceImpl) - // - // ---------------------------------------------------------------------- - - public int getLengthZ() - - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - - return (getAttributesZ(LENGTH)); - - } - - - - - // --------------------------------------------------------------------------- - // - // Get the auto-extenible value of the user space (called from UserSpaceImpl) - // - // --------------------------------------------------------------------------- - - public boolean isAutoExtendibleZ() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - - // The AS/400 indicator is a single character -- - // F0 is '0' in ebcdic which is false, F1 is '1' - // in ebcdic which is true. - if (getAttributesZ(AUTO_EXTENDIBLE) == 0x000000F0) - return false; - else - return true; - - } - - // ---------------------------------------------------------------------- - // - // Read from a user space (called from UserSpaceImpl) - // - // ---------------------------------------------------------------------- - - public int readZ(byte dataBuffer[], int userSpaceOffset, int dataOffset, int length) - - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - - { - - int actualLength = readData(dataBuffer, userSpaceOffset, dataOffset, length); - - if (actualLength == 0) - { - int userSpaceLength = getAttributesZ(LENGTH); - - if (userSpaceLength < userSpaceOffset) - { - actualLength = -1; - } - else - { - actualLength = userSpaceLength - userSpaceOffset; - actualLength = readData(dataBuffer, userSpaceOffset, dataOffset, actualLength); - } - } - - return actualLength; - } - - - - - - // ---------------------------------------------------------------------- - // - // Read from a user space (called internally) - // - // ---------------------------------------------------------------------- - - private int readData(byte dataBuffer[], int userSpaceOffset, int dataOffset, int length) - - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - - { - int actualLength = length; - - byte[] returnedData; - - // Set up the buffer that contains the program to call. - byte[] programNameBuffer = createCommandNameBuffer("QUSRTVUS", 5); - - - // Set up the parameter structure. There is one structure - // for each parameters. The structure contains: - // 4 bytes - the length of the parameter - // 2 bytes - the parameters usage (input/output/inout) - // 4 bytes - the offset into the parameter buffer - - byte[] programParameterStructure = new byte[50]; - - // The first parameter is the name of the user space - BinaryConverter.intToByteArray (20, programParameterStructure, 0); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 4); - BinaryConverter.intToByteArray ( 0, programParameterStructure, 6); - - // The second parameter is the position where to write the data - BinaryConverter.intToByteArray ( 4, programParameterStructure, 10); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 14); - BinaryConverter.intToByteArray (20, programParameterStructure, 16); - - // The third parameter is the length - BinaryConverter.intToByteArray ( 4, programParameterStructure, 20); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 24); - BinaryConverter.intToByteArray (24, programParameterStructure, 26); - - // The fourth parameter is the data - BinaryConverter.intToByteArray (length, programParameterStructure, 30); - BinaryConverter.shortToByteArray(OUT, programParameterStructure, 34); - BinaryConverter.intToByteArray (28, programParameterStructure, 36); - - // The fifth parameter is the Error Code area - BinaryConverter.intToByteArray (32, programParameterStructure, 40); - BinaryConverter.shortToByteArray(INOUT, programParameterStructure, 44); - BinaryConverter.intToByteArray (length + 28, programParameterStructure, 46); - - - - // Set up the Parameter area. - byte[] programParameters = new byte[length + 60]; - - - // Put the first parm (the user space name) into the parm area. - setBytes(programParameters, converter_.stringToByteArray(createUserSpaceName(name_, library_)), 0); // @C1C - - - // Put the second parm (the position) into the parm area. We - // get an offset from our caller but the API we call needs a - // position. Add 1 to the offset to get a position. - BinaryConverter.intToByteArray(userSpaceOffset + 1, programParameters, 20); - - - // Put the third parm (the length) into the parm area. - BinaryConverter.intToByteArray(length, programParameters, 24); - - - // Put the last parm (the Error Code) into the parm area. - // The second parm is the value 0. This will cause the - // program to generate exceptions that will be handled - // by the service program. - BinaryConverter.intToByteArray(0, programParameters, length + 28); - - // call the native method to carry out the request. - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = ((AS400ImplRemote)system_).swapTo(swapToPH, swapFromPH); - try - { - Trace.log(Trace.INFORMATION, "calling native method (read) "); - - - returnedData = callProgramReturnBytes(programNameBuffer, - programParameterStructure, - programParameters, - length, - 28); - - System.arraycopy(returnedData, 0, dataBuffer, dataOffset, length); - - Trace.log(Trace.INFORMATION, "back from native method (normal) (read) "); - - } - catch (NativeException e) - { - - Trace.log(Trace.INFORMATION, "back from native method (exception) (read) "); - - buildException(e, READ); - - actualLength = 0; - } - finally - { - if (didSwap) ((AS400ImplRemote)system_).swapBack(swapToPH, swapFromPH); - } - - return actualLength; - } - - - - - - - - - // ---------------------------------------------------------------------- - // - // Set the attributes of a user space (called locally) - // - // ---------------------------------------------------------------------- - - protected void setAttributesZ(int valueToSet, int newValue) - - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - - // Set up the buffer that contains the program to call. - byte[] programNameBuffer = createCommandNameBuffer("QUSCUSAT", 4); - - - - - // Set up the parameter structure. There is one structure - // for each parameter. The structure contains: - // 4 bytes - the length of the parameter - // 2 bytes - the parameters usage (input/output/inout) - // 4 bytes - the offset into the parameter buffer - - byte[] programParameterStructure = new byte[40]; - - // The first parameter is storage where the library is returned - // (don't ask me why the library is returned) - 10 bytes. - BinaryConverter.intToByteArray ( 10, programParameterStructure, 0); - BinaryConverter.shortToByteArray(OUT, programParameterStructure, 4); - BinaryConverter.intToByteArray ( 0, programParameterStructure, 6); - - // The second parameter is the user space name - 20 bytes. - BinaryConverter.intToByteArray (20, programParameterStructure, 10); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 14); - BinaryConverter.intToByteArray (10, programParameterStructure, 16); - - // The third parameter is the buffer of attributes to change - - // a maximum of 16 bytes - BinaryConverter.intToByteArray (16, programParameterStructure, 20); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 24); - BinaryConverter.intToByteArray (30, programParameterStructure, 26); - - // The fourth parameter is the error space (32 bytes) - BinaryConverter.intToByteArray ( 32, programParameterStructure, 30); - BinaryConverter.shortToByteArray(INOUT, programParameterStructure, 34); - BinaryConverter.intToByteArray ( 46, programParameterStructure, 36); - - - - - // Set up the Parameter area. - byte[] programParameters = new byte[78]; - - - // Put the second parm (the user space name) into the parm area. - setBytes(programParameters, converter_.stringToByteArray(createUserSpaceName(name_, library_)), 10); // @C1C - - - // Put the third parm (the attribute to set) into the parm area. - // - // Add the number of attributes to set. We always set one - // attribute at a time. - BinaryConverter.intToByteArray(1, programParameters, 30); - - - // Add the key - if (valueToSet == LENGTH) - BinaryConverter.intToByteArray(1, programParameters, 34); - else if (valueToSet == INITIAL_VALUE) - BinaryConverter.intToByteArray(2, programParameters, 34); - else if (valueToSet == AUTO_EXTENDIBLE) - BinaryConverter.intToByteArray(3, programParameters, 34); - - - // Add the length of the value (four bytes for length, - // one byte for initial value and auto-extendible) - if (valueToSet == LENGTH) - BinaryConverter.intToByteArray(4, programParameters, 38); - else if (valueToSet == INITIAL_VALUE) - BinaryConverter.intToByteArray(1, programParameters, 38); - else if (valueToSet == AUTO_EXTENDIBLE) - BinaryConverter.intToByteArray(1, programParameters, 38); - - - // Add the value - if (valueToSet == LENGTH) - { - BinaryConverter.intToByteArray(newValue, programParameters, 42); - } - else if (valueToSet == INITIAL_VALUE) - { - programParameters[42] = (byte) newValue; - } - else if (valueToSet == AUTO_EXTENDIBLE) - { - if (newValue == 0) - { - setBytes(programParameters, converter_.stringToByteArray("0"), 42); - } - else - { - setBytes(programParameters, converter_.stringToByteArray("1"), 42); - } - } - - - // Put the fourth parm (the Error Code) into the parm area. - // This parm is the value 0. This will cause the - // program to generate exceptions that will be handled - // by the service program. - BinaryConverter.intToByteArray(0, programParameters, 46); - - - - // call the native method to carry out the request. - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = ((AS400ImplRemote)system_).swapTo(swapToPH, swapFromPH); - try - { - Trace.log(Trace.INFORMATION, "calling native method (set attrs) "); - - callProgramReturnVoid(programNameBuffer, - programParameterStructure, - programParameters); - - - Trace.log(Trace.INFORMATION, "back from native method (normal) (set attrs) "); - - } - catch (NativeException e) - { - - Trace.log(Trace.INFORMATION, "back from native method (exception) (set attrs) "); - - buildException(e, SET_ATTRIBUTES); - } - finally - { - if (didSwap) ((AS400ImplRemote)system_).swapBack(swapToPH, swapFromPH); - } - } - - - - - // ---------------------------------------------------------------------- - // - // set the autoExtendible attribute (called from UserSpaceImpl) - // - // ---------------------------------------------------------------------- - - public void setAutoExtendibleZ(boolean newValue) - - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - - if (newValue) - setAttributesZ(AUTO_EXTENDIBLE, 1); - else - setAttributesZ(AUTO_EXTENDIBLE, 0); - } - - - - // ---------------------------------------------------------------------- - // - // Utility routines - // - // ---------------------------------------------------------------------- - - - // @C1A - private void setBytes(byte[] dest, byte[] src, int offset) - { - System.arraycopy(src, 0, dest, offset, src.length); - } - - - // ---------------------------------------------------------------------- - // - // set the initial value attribute (called from UserSpaceImpl) - // - // ---------------------------------------------------------------------- - - public void setInitialValueZ(byte initialValue) - - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - setAttributesZ(INITIAL_VALUE, initialValue); - } - - - - - - // ---------------------------------------------------------------------- - // - // set the length of the user space (called from UserSpaceImpl) - // - // ---------------------------------------------------------------------- - - public void setLengthZ(int length) - - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - - { - setAttributesZ(LENGTH, length); - } - - - - - - - // ---------------------------------------------------------------------- - // - // write to a user space (called from UserSpaceImpl) - // - // ---------------------------------------------------------------------- - - public void writeZ(byte[] dataBuffer, int userSpaceOffset, int dataOffset, int length, int forceAuxiliary) - - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - - - - // Set up the buffer that contains the program to call. - byte[] programNameBuffer = createCommandNameBuffer("QUSCHGUS", 6); - - - // Set up the parameter structure. There is one structure - // for each parameters. The structure contains: - // 4 bytes - the length of the parameter - // 2 bytes - the parameters usage (input/output/inout) - // 4 bytes - the offset into the parameter buffer - - // The first parameter is the name of the user space - byte[] programParameterStructure = new byte[60]; - BinaryConverter.intToByteArray (20, programParameterStructure, 0); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 4); - BinaryConverter.intToByteArray ( 0, programParameterStructure, 6); - - // The second parameter is the position where to write the data - BinaryConverter.intToByteArray ( 4, programParameterStructure, 10); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 14); - BinaryConverter.intToByteArray (20, programParameterStructure, 16); - - // The third parameter is the length - BinaryConverter.intToByteArray ( 4, programParameterStructure, 20); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 24); - BinaryConverter.intToByteArray (24, programParameterStructure, 26); - - // The fourth parameter is the data - BinaryConverter.intToByteArray (length, programParameterStructure, 30); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 34); - BinaryConverter.intToByteArray (28, programParameterStructure, 36); - - // The fifth parameter is the force option - BinaryConverter.intToByteArray (1, programParameterStructure, 40); - BinaryConverter.shortToByteArray(IN, programParameterStructure, 44); - BinaryConverter.intToByteArray (length + 28, programParameterStructure, 46); - - // The sixth parameter is the Error Code area - BinaryConverter.intToByteArray (32, programParameterStructure, 50); - BinaryConverter.shortToByteArray(INOUT, programParameterStructure, 54); - BinaryConverter.intToByteArray (length + 29, programParameterStructure, 56); - - - - // Set up the Parameter area. - byte[] programParameters = new byte[length + 61]; - - - // Put the first parm (the user space name) into the parm area. - setBytes(programParameters, converter_.stringToByteArray(createUserSpaceName(name_, library_)), 0); // @C1C - - - // Put the second parm (the position) into the parm area. We - // get an offset from the user but our API needs a position. We - // add 1 to the offset to get a position. - BinaryConverter.intToByteArray(userSpaceOffset + 1, programParameters, 20); - - - // Put the third parm (the length) into the parm area. - BinaryConverter.intToByteArray(length, programParameters, 24); - - - // Put the fourth parm (the data) into the parm area. - System.arraycopy(dataBuffer, dataOffset, programParameters, 28, length); - - - // Put the fifth parm (the length) into the parm area. - if (forceAuxiliary == 1) - setBytes(programParameters, converter_.stringToByteArray("1"), length + 28); // @C1C - else if (forceAuxiliary == 2) - setBytes(programParameters, converter_.stringToByteArray("2"), length + 28); // @C1C - else - setBytes(programParameters, converter_.stringToByteArray("0"), length + 28); // @C1C - - - // Put the last parm (the Error Code) into the parm area. - // The second parm is the value 0. This will cause the - // program to generate exceptions that will be handled - // by the service program. - BinaryConverter.intToByteArray(0, programParameters, length + 29); - - // call the native method to carry out the request. - byte[] swapToPH = new byte[12]; - byte[] swapFromPH = new byte[12]; - boolean didSwap = ((AS400ImplRemote)system_).swapTo(swapToPH, swapFromPH); - try - { - Trace.log(Trace.INFORMATION, "calling native method (write) "); - - - callProgramReturnVoid(programNameBuffer, - programParameterStructure, - programParameters); - - - Trace.log(Trace.INFORMATION, "back from native method (normal) (write) "); - - } - catch (NativeException e) - { - - Trace.log(Trace.INFORMATION, "back from native method (exception) (write) "); - - buildException(e, WRITE); - } - finally - { - if (didSwap) ((AS400ImplRemote)system_).swapBack(swapToPH, swapFromPH); - } - } - - - - - - - - - - - - - - - - - -} - diff --git a/cvsroot/src/com/ibm/as400/access/UserSpaceImplProxy.java b/cvsroot/src/com/ibm/as400/access/UserSpaceImplProxy.java deleted file mode 100644 index 12c7f15f4..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserSpaceImplProxy.java +++ /dev/null @@ -1,178 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserSpaceImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - -// The UserSpaceImplProxy class is an implementation of the UserSpace class used on a client communicating with a proxy server. -class UserSpaceImplProxy extends AbstractProxyImpl implements UserSpaceImpl -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - UserSpaceImplProxy() - { - super("UserSpace"); - } - - public void close() throws IOException - { - try - { - connection_.callMethod(pxId_, "close"); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow1(e); - } - } - - public void create(byte[] domainBytes, int length, boolean replace, String extendedAttribute, byte initialValue, String textDescription, String authority) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - try - { - connection_.callMethod(pxId_, "create", new Class[] { byte[].class, Integer.TYPE, Boolean.TYPE, String.class, Byte.TYPE, String.class, String.class }, new Object[] { domainBytes, new Integer(length), new Boolean(replace), extendedAttribute, new Byte(initialValue), textDescription, authority } ); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow5(e); - } - } - - public void delete() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - try - { - connection_.callMethod(pxId_, "delete"); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow5(e); - } - } - - public byte getInitialValue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - try - { - return (byte)connection_.callMethod(pxId_, "getInitialValue").getReturnValueByte(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow5(e); - } - } - - public int getLength() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - try - { - return connection_.callMethod(pxId_, "getLength").getReturnValueInt(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow5(e); - } - } - - public boolean isAutoExtendible() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - try - { - return connection_.callMethod(pxId_, "isAutoExtendible").getReturnValueBoolean(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow5(e); - } - } - - public int read(byte[] dataBuffer, int userSpaceOffset, int dataOffset, int length) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - try - { - ProxyReturnValue rv = connection_.callMethod(pxId_, "read", new Class[] { byte[].class, Integer.TYPE, Integer.TYPE, Integer.TYPE }, new Object[] { dataBuffer, new Integer(userSpaceOffset), new Integer(dataOffset), new Integer(length) }, new boolean[] { true, false, false, false }, false); - byte [] returnDataB = (byte[])rv.getArgument(0); - for (int i = 0; i < dataBuffer.length; ++i) - { - dataBuffer[i] = returnDataB[i]; - } - return rv.getReturnValueInt(); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow5(e); - } - } - - public void setAutoExtendible(boolean autoExtendibility) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - try - { - connection_.callMethod(pxId_, "setAutoExtendible", new Class[] { Boolean.TYPE }, new Object[] { new Boolean(autoExtendibility) } ); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow5(e); - } - } - - public void setInitialValue(byte initialValue) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - try - { - connection_.callMethod(pxId_, "setInitialValue", new Class[] { Byte.TYPE }, new Object[] { new Byte(initialValue) } ); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow5(e); - } - } - - public void setLength(int length) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - try - { - connection_.callMethod(pxId_, "setLength", new Class[] { Integer.TYPE }, new Object[] { new Integer(length) } ); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow5(e); - } - } - - public void setProperties(AS400Impl system, String path, String name, String library, boolean mustUseProgramCall, boolean mustUseSockets) - { - try - { - connection_.callMethod(pxId_, "setProperties", new Class[] { AS400Impl.class, String.class, String.class, String.class, Boolean.TYPE, Boolean.TYPE }, new Object[] { system, path, name, library, new Boolean(mustUseProgramCall), new Boolean(mustUseSockets) } ); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow(e); - } - } - - public void write(byte[] dataBuffer, int userSpaceOffset, int dataOffset, int length, int forceAuxiliary) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - try - { - connection_.callMethod(pxId_, "write", new Class[] { byte[].class, Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE }, new Object[] { dataBuffer, new Integer(userSpaceOffset), new Integer(dataOffset), new Integer(length), new Integer(forceAuxiliary) } ); - } - catch (InvocationTargetException e) - { - throw ProxyClientConnection.rethrow5(e); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/UserSpaceImplRemote.java b/cvsroot/src/com/ibm/as400/access/UserSpaceImplRemote.java deleted file mode 100644 index 2464f590d..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserSpaceImplRemote.java +++ /dev/null @@ -1,564 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserSpaceImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; -import java.io.FileNotFoundException; -import java.io.IOException; - -// The UserSpaceImplRemote class is the remote implementation of the user space class. -class UserSpaceImplRemote implements UserSpaceImpl -{ - // The server where the user space is located. - protected AS400ImplRemote system_ = null; - // The full path name of the user space. - protected String path_ = null; - // The library that contains the user space. - protected String library_ = null; - // The name of the user space. - protected String name_ = null; - // Use ProgramCall instead of IFS. - protected boolean mustUseProgramCall_ = false; - // Use sockets instead of native methods when running natively. - protected boolean mustUseSockets_ = false; - // The string to byte data converter. - protected ConverterImplRemote converter_; - // Qualified user space name parameter, set on first touch. - private ProgramParameter nameParameter_ = null; - // Error code parameter for API's, set on first touch. - private ProgramParameter errorCodeParameter_ = null; - - // Impl object for remote command server delete, getAttributes, setAttributes. - protected RemoteCommandImpl remoteCommand_; - // Whether to call remote commands on-thread. - private Boolean runOnThread_ = RemoteCommandImpl.OFF_THREAD; - - // The integrated file system object used for read and write. - private IFSRandomAccessFileImplRemote file_; - - // Throw or return an exception based on the message list from a remote program call. - private AS400Exception buildException() throws AS400SecurityException, ObjectDoesNotExistException - { - // Get the message list. - AS400Message[] messageList = remoteCommand_.getMessageList(); - // Get the message id of the first message. - String id = messageList[0].getID(); - - // Throw appropriate exceptions for not existing or not authorized. - if (id.equals("CPF9801") || id.equals("CPF2105")) - { - Trace.log(Trace.ERROR, "Object does not exist: " + path_); - throw new ObjectDoesNotExistException(path_, ObjectDoesNotExistException.OBJECT_DOES_NOT_EXIST); - } - if (id.equals("CPF9802") || id.equals("CPF2189")) - { - Trace.log(Trace.ERROR, "User is not authorized to object: " + path_); - throw new AS400SecurityException(path_, AS400SecurityException.OBJECT_AUTHORITY_INSUFFICIENT); - } - if (id.equals("CPF9810") || id.equals("CPF2209") || id.equals("CPF2110")) - { - Trace.log(Trace.ERROR, "Library does not exist: " + path_); - throw new ObjectDoesNotExistException(path_, ObjectDoesNotExistException.LIBRARY_DOES_NOT_EXIST); - } - if (id.equals("CPF9820") || id.equals("CPF2182")) - { - Trace.log(Trace.ERROR, "User is not authorized to library: " + path_); - throw new AS400SecurityException(path_, AS400SecurityException.LIBRARY_AUTHORITY_INSUFFICIENT); - } - if (id.equals("CPF2283")) - { - String authorizationListName = "/QSYS.LIB/" + converter_.byteArrayToString(messageList[0].getSubstitutionData()).trim() + ".AUTL"; - Trace.log(Trace.ERROR, "Object does not exist: " + authorizationListName); - throw new ObjectDoesNotExistException(authorizationListName, ObjectDoesNotExistException.OBJECT_DOES_NOT_EXIST); - } - // Else return exception for messages. - return new AS400Exception(messageList); - } - - // Closes our file stream to the user space (if a stream has been created), - // and releases any system resources associated with the stream. - public void close() throws IOException - { - if (file_ != null) - { - // Close the random access file stream. - file_.close(); - // Clear the file connection info. - file_ = null; - } - } - - // Creates a user space. - public void create(byte[] domainBytes, int length, boolean replace, String extendedAttribute, byte initialValue, String textDescription, String authority) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Close the file stream to the user space (if one already exists). - close(); - - // Setup qualified user space name parameter. - setupNameParameter(); - // Setup error code parameter. - setupErrorCodeParameter(); - // Setup program call parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Qualified user space name, input, char(20). - nameParameter_, - // Extended attributes, input, char(10). - new ProgramParameter(padByteArray(converter_.stringToByteArray(extendedAttribute), 10)), - // Initial size, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(length)), - // Initial value, input, char(1). - new ProgramParameter(new byte[] { initialValue }), - // Public authority, input, char(10). - new ProgramParameter(padByteArray(converter_.stringToByteArray(authority), 10)), - // Text description, input, char(50). - new ProgramParameter(padByteArray(converter_.stringToByteArray(textDescription), 50)), - // Replace, input, char(10), EBCDIC "*YES" or "*NO". - new ProgramParameter((replace) ? new byte[] { 0x5C, (byte)0xE8, (byte)0xC5, (byte)0xE2, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 } : new byte[] { 0x5C, (byte)0xD5, (byte)0xD6, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 } ), - // Error code, input/output, char(*). - errorCodeParameter_, - // Domain, input, char(10). - new ProgramParameter(domainBytes), - // Transfer size request, input, binary(4). - new ProgramParameter(new byte[] { 0x00, 0x00, 0x00, 0x00 } ), - // Optimum space alignment, input, char(1). - new ProgramParameter(new byte[] { length > 16773120 ? (byte)0xF0 : (byte)0xF1 } ) - }; - - // Setup for remote program call. - if (remoteCommand_ == null) { - setupRemoteCommand(); - } - // Run create user space (QUSCRTUS) API. This is a threadsafe API. - if (!remoteCommand_.runProgram("QSYS", "QUSCRTUS", parameters, runOnThread_)) - { - // Throw the returned messages. - throw buildException(); - } - } - - // Return a byte array padded to the correct length. - private static byte[] padByteArray(byte[] bytes, int length) - { - byte[] result = new byte[length]; - System.arraycopy(bytes, 0, result, 0, bytes.length); - for (int i = bytes.length; i < length; ++i) result[i] = 0x40; - return result; - } - - // Deletes a user space. - public void delete() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Close the file stream to the user space (if one exists), to avoid locking problems. - close(); - - // Setup qualified user space name parameter. - setupNameParameter(); - // Setup error code parameter. - setupErrorCodeParameter(); - // Setup program call parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Qualified user space name, input, char(20). - nameParameter_, - // Error code, input/output, char(*). - errorCodeParameter_ - }; - - // Setup for remote program call. - if (remoteCommand_ == null) { - setupRemoteCommand(); - } - // Run delete user space (QUSDLTUS) API. This is a threadsafe API. - if (!remoteCommand_.runProgram("QSYS", "QUSDLTUS", parameters, runOnThread_)) - { - // Throw the returned messages. - throw buildException(); - } - } - - // Returns the initial value used for filling in the user space during creation and extension. - public byte getInitialValue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return retrieveAttributes()[13]; - } - - // Returns the size in bytes of the user space. - public int getLength() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return BinaryConverter.byteArrayToInt(retrieveAttributes(), 8); - } - - // Indicates if the user space is auto extendible. - public boolean isAutoExtendible() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - return retrieveAttributes()[12] == (byte)0xF1; - } - - // Retrieve the user space attributes. - protected byte[] retrieveAttributes() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Close the file stream to the user space (if one exists), to avoid locking problems. - close(); - - // Setup qualified user space name parameter. - setupNameParameter(); - // Setup error code parameter. - setupErrorCodeParameter(); - // Setup program call parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Receiver variable, output, char(*), ask for 24 bytes. - new ProgramParameter(24), - // Length of receiver variable, input, binary(4), 24 bytes. - new ProgramParameter(new byte[] { 0x00, 0x00, 0x00, 0x18 } ), - // Format name, input, char(8), EBCDIC "SPCA0100". - new ProgramParameter(new byte[] { (byte)0xE2, (byte)0xD7, (byte)0xC3, (byte)0xC1, (byte)0xF0, (byte)0xF1, (byte)0xF0, (byte)0xF0 } ), - // Qualified user space name, input, char(20). - nameParameter_, - // Error code, input/output, char(*). - errorCodeParameter_ - }; - - // Setup for remote program call. - if (remoteCommand_ == null) { - setupRemoteCommand(); - } - // Run retrieve user space attributes (QUSRUSAT) API. This is a threadsafe API. - if (!remoteCommand_.runProgram("QSYS", "QUSRUSAT", parameters, runOnThread_)) - { - // Throw the returned messages. - throw buildException(); - } - // Return the data returned from the program. - return parameters[0].getOutputData(); - } - - // Read from user space. - public int read(byte[] dataBuffer, int userSpaceOffset, int dataOffset, int length) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Use remote program call implementation or file implementation. - if (mustUseProgramCall_) - { - // Setup qualified user space name parameter. - setupNameParameter(); - // Setup program call parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Qualified user space name, input, char(20). - nameParameter_, - // Starting position, input, binary(4), add 1 for 1 based offset. - new ProgramParameter(BinaryConverter.intToByteArray(userSpaceOffset + 1)), - // Length of data, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(length)), - // Receiver variable, output, char(*). - new ProgramParameter(length) - // Omit error code optional parameter. - }; - - // Setup for remote program call. - if (remoteCommand_ == null) { - setupRemoteCommand(); - } - // Run retrieve user space (QUSRTVUS) API. This is a threadsafe API. - if (!remoteCommand_.runProgram("QSYS", "QUSRTVUS", parameters, runOnThread_)) - { - String id = remoteCommand_.getMessageList()[0].getID(); - if (!id.equals("CPF3C14") && !id.equals("CPD3C14")) - { - // Throw the returned messages. - throw buildException(); - } - int userSpaceLength = getLength(); - if (userSpaceLength < userSpaceOffset) return -1; - length = userSpaceLength - userSpaceOffset; - try - { - parameters[2].setInputData(BinaryConverter.intToByteArray(length)); - parameters[3].setOutputDataLength(length); - } - catch (PropertyVetoException e) - { - Trace.log(Trace.ERROR, "Unexpected PropertyVetoException:", e); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - if (!remoteCommand_.runProgram("QSYS", "QUSRTVUS", parameters, runOnThread_)) - { - // Throw the returned messages. - throw buildException(); - } - } - // Copy output data into user's array. - System.arraycopy(parameters[3].getOutputData(), 0, dataBuffer, dataOffset, length); - return length; - } - else - { - // Setup for file. - setupFile(); - - // Seek to correct offset. - file_.seek(userSpaceOffset); - // Read from the user space, return number of bytes read. - return file_.read(dataBuffer, dataOffset, length, false); - } - } - - // Sets the auto extend attribute. - public void setAutoExtendible(boolean autoExtendibility) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Number of attributes is 1, key is 3, length of attribute is 1 byte, value is EBCDIC "1" or "0". - changeAttributes(new byte[] { 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, autoExtendibility ? (byte)0xF1 : (byte)0xF0 }); - } - - // Sets the initial value to be used during user space creation or extension. - public void setInitialValue(byte initialValue) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Number of attributes is 1, key is 2, length of attribute is 1 byte, value is as specified. - changeAttributes(new byte[] { 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, initialValue }); - } - - // Sets the size of the user space. Valid values are 1 through 1,6776,704. - public void setLength(int length) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Number of attributes is 1, key is 1, length of attribute is 4 bytes, use 4 bytes of 0 to hold space for value. - byte[] attributeBytes = new byte[] { 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00 }; - // Set the length into the 12th position of the byte array. - BinaryConverter.intToByteArray(length, attributeBytes, 12); - changeAttributes(attributeBytes); - } - - // Change the user space attributes. - protected void changeAttributes(byte[] attributeBytes) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Close the file stream to the user space (if one exists), to avoid locking problems. - close(); - - // Setup qualified user space name parameter. - setupNameParameter(); - // Setup error code parameter. - setupErrorCodeParameter(); - // Setup program call parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Returned library name, output, char(10). - new ProgramParameter(10), - // Qualified user space name, input, char(20). - nameParameter_, - // Attribtes to change, input, char(*). - new ProgramParameter(attributeBytes), - // ErrorCode, input/output, char(*). - errorCodeParameter_ - }; - - // Setup for remote program call. - if (remoteCommand_ == null) { - setupRemoteCommand(); - } - // Run change user space attributes (QUSCUSAT) API. This is a threadsafe API. - if (!remoteCommand_.runProgram("QSYS", "QUSCUSAT", parameters, runOnThread_)) - { - // Throw the returned messages. - throw buildException(); - } - } - - // Set needed implementation properties. - public void setProperties(AS400Impl system, String path, String name, String library, boolean mustUseProgramCall, boolean mustUseSockets) - { - system_ = (AS400ImplRemote)system; - path_ = path; - library_ = library; - name_ = name; - mustUseProgramCall_ = mustUseProgramCall; - mustUseSockets_ = mustUseSockets; - } - - // Setup error code program parameter object on first touch. Synchronized to protect instance variables. This method can safely be called multiple times because it checks for a previous call before changing the instance variables. - private void setupErrorCodeParameter() - { - // If not already setup. - if (errorCodeParameter_ == null) - { - // Set error code parameter to eight bytes of zero's. This causes the messages to be issued to the API caller. - errorCodeParameter_ = new ProgramParameter(new byte[8]); - } - } - - // Setup file object on first touch. Synchronized to protect instance variables. This method can safely be called multiple times because it checks for a previous call before changing the instance variables. - private synchronized void setupFile() throws AS400SecurityException, IOException, ObjectDoesNotExistException - { - // If not already setup. - if (file_ == null) - { - try - { - // Create the file descriptor implementation object. - IFSFileDescriptorImplRemote fd_ = new IFSFileDescriptorImplRemote(); - // Set the necessary properties into it. - fd_.initialize(0, this, path_, IFSRandomAccessFile.SHARE_ALL, system_); - - // Create the file implementation object. - file_ = new IFSRandomAccessFileImplRemote(); - // Set the necessary properties into it. - file_.setFD(fd_); - file_.setMode("rw"); - file_.setExistenceOption(IFSRandomAccessFile.OPEN_OR_FAIL); - // Open the file. - file_.open(); - } - catch (FileNotFoundException e) - { - Trace.log(Trace.ERROR, "Object does not exist: " + path_, e); - throw new ObjectDoesNotExistException(path_, ObjectDoesNotExistException.OBJECT_DOES_NOT_EXIST); - } - catch (ExtendedIOException e) - { - if (e.getReturnCode() == ExtendedIOException.ACCESS_DENIED) - { - Trace.log(Trace.ERROR, "User is not authorized to object: " + path_, e); - throw new AS400SecurityException(path_, AS400SecurityException.OBJECT_AUTHORITY_INSUFFICIENT); - } - if (e.getReturnCode() == ExtendedIOException.REQUEST_NOT_SUPPORTED && library_.equals("QTEMP")) - { - // File server cannot access QTEMP library. - Trace.log(Trace.WARNING, "File server cannot access QTEMP, use mustUseProgramCall option."); - } - Trace.log(Trace.ERROR, "Error opening file: " + path_, e); - throw e; - } - } - } - - // Setup qualified user space name program parameter object on first touch. Synchronized to protect instance variables. This method can safely be called multiple times because it checks for a previous call before changing the instance variables. - private synchronized void setupNameParameter() throws IOException - { - // If not already setup. - if (nameParameter_ == null) - { - // Get a converter for the system objects CCSID. - converter_ = ConverterImplRemote.getConverter((system_).getCcsid(), system_); - // The name and library of the user space used in program call. Start with 20 EBCDIC spaces (" "). - byte[] qualifiedUserSpaceName = new byte[] { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - // Put the converted object name at the beginning of the array. - converter_.stringToByteArray(name_, qualifiedUserSpaceName, 0); - // Put the converted library name at position ten. - converter_.stringToByteArray(library_, qualifiedUserSpaceName, 10); - // Create the program parameter object. - nameParameter_ = new ProgramParameter(qualifiedUserSpaceName); - } - } - - // Setup remote command object on first touch. Synchronized to protect instance variables. This method can safely be called multiple times because it checks for a previous call before changing the instance variables. - protected synchronized void setupRemoteCommand() throws IOException - { - // If not already setup. - if (remoteCommand_ == null) - { - boolean runningNatively = false; - if (system_.canUseNativeOptimizations()) - { - try - { - remoteCommand_ = (RemoteCommandImpl)Class.forName("com.ibm.as400.access.RemoteCommandImplNative").newInstance(); - // Avoid direct reference - it can cause NoClassDefFoundError at class loading time on Sun JVM's. - runningNatively = true; - } - catch (Throwable e) { - // A ClassNotFoundException would be unexpected, since canUseNativeOptions() returned true. - Trace.log(Trace.WARNING, "Unable to instantiate class RemoteCommandImplNative.", e); - } - } - if (remoteCommand_ == null) - { - remoteCommand_ = new RemoteCommandImplRemote(); - } - remoteCommand_.setSystem(system_); - - // Note: All the API's that are called from this class, are threadsafe API's. - // However, we need to stay consistent with the Toolbox's default threadsafety behavior. - // So we'll indicate that the remote commands can safely be run on-thread (but only if the threadSafe property isn't set to 'false'). This will enable applications to use UserSpace when running on IBM i and using a profile that is disabled or has password *NONE. - - if (runningNatively && !mustUseSockets_) - { - // Abide by the setting of the thread-safety property (if it's set). - String propVal = ProgramCall.getThreadSafetyProperty(); - if (propVal == null || !propVal.equals("false")) - { - runOnThread_ = RemoteCommandImpl.ON_THREAD; - } - } - } - } - - // Remote implementation of write. - public void write(byte[] dataBuffer, int userSpaceOffset, int dataOffset, int length, int force) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Use remote program call implementation or file implementation. - if (mustUseProgramCall_) - { - // Setup qualified user space name parameter. - setupNameParameter(); - // Allocate parameter array bytes. - byte[] inputData = new byte[length]; - // Copy data into parameter array. - System.arraycopy(dataBuffer, dataOffset, inputData, 0, length); - // Setup program call parameters. - ProgramParameter[] parameters = new ProgramParameter[] - { - // Qualified user space name, input, char(20). - nameParameter_, - // Starting position, input, binary(4), add 1 for 1 based offset. - new ProgramParameter(BinaryConverter.intToByteArray(userSpaceOffset + 1)), - // Length of data, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(length)), - // Input data, input, char(*). - new ProgramParameter(inputData), - // Force changes to auxiliary storage, input, char(1). - new ProgramParameter(new byte[] { (byte)(0xF0 | force) } ) - // Omit error code optional parameter. - }; - - // Setup for remote program call. - if (remoteCommand_ == null) { - setupRemoteCommand(); - } - // Run change user space (QUSCHGUS) API. This is a threadsafe API. - if (!remoteCommand_.runProgram("QSYS", "QUSCHGUS", parameters, runOnThread_)) - { - // Throw the returned messages. - throw buildException(); - } - } - else - { - // Setup for file. - setupFile(); - // Seek to correct offset. - file_.seek(userSpaceOffset); - // Set force option. - switch (force) - { - case UserSpace.FORCE_SYNCHRONOUS: - file_.setForceToStorage(true); - break; - case UserSpace.FORCE_ASYNCHRONOUS: - file_.setForceToStorage(false); - break; - } - // Write data. - file_.writeBytes(dataBuffer, dataOffset, length); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/UserSpaceListener.java b/cvsroot/src/com/ibm/as400/access/UserSpaceListener.java deleted file mode 100644 index 172801d85..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserSpaceListener.java +++ /dev/null @@ -1,46 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserSpaceListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.util.EventListener; - -/** - The UserSpaceListener interface provides an interface for receiving UserSpaceEvents. - **/ -public interface UserSpaceListener extends EventListener -{ - /** - Invoked when a create has been performed. - @param event The user space event. - **/ - public void created(UserSpaceEvent event); - - /** - Invoked when a delete has been performed. - @param event The user space event. - **/ - public void deleted(UserSpaceEvent event); - - /** - Invoked when a read has been performed. - @param event The user space event. - **/ - public void read(UserSpaceEvent event); - - /** - Invoked when a write has been performed. - @param event The user space event. - **/ - public void written(UserSpaceEvent event); -} diff --git a/cvsroot/src/com/ibm/as400/access/UserSpaceNativeReadWriteImpl.java b/cvsroot/src/com/ibm/as400/access/UserSpaceNativeReadWriteImpl.java deleted file mode 100644 index 5af3a0977..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserSpaceNativeReadWriteImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserSpaceImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2010-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -// UserSpaceImpl defines the implementation interface for the UserSpace object. -interface UserSpaceNativeReadWriteImpl -{ - public void open(String library_, String name_) throws UnsupportedEncodingException, CharConversionException; - public int read(byte dataBuffer[], int userSpaceOffset, int dataOffset, int length) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException; - public void write(byte[] dataBuffer, int userSpaceOffset, int dataOffset, int length, int forceAuxiliary) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException; - public void close(); -} diff --git a/cvsroot/src/com/ibm/as400/access/UserSpaceNativeReadWriteImplILE.java b/cvsroot/src/com/ibm/as400/access/UserSpaceNativeReadWriteImplILE.java deleted file mode 100644 index afbcb7ff3..000000000 --- a/cvsroot/src/com/ibm/as400/access/UserSpaceNativeReadWriteImplILE.java +++ /dev/null @@ -1,86 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserSpaceImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2010-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.CharConversionException; -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -// UserSpaceImpl defines the implementation interface for the UserSpace object. -class UserSpaceNativeReadWriteImplILE implements UserSpaceNativeReadWriteImpl -{ - static SecurityException loadSecurityException = null; - static UnsatisfiedLinkError loadUnsatisfiedLinkError = null; - static { - /* Make sure the library is loaded */ - /* Delay the error until actual usage */ - try { - NativeMethods.loadNativeLibraryQyjspartThrowsException(); - } catch (SecurityException secEx) { - loadSecurityException = secEx; - } catch (UnsatisfiedLinkError unsatisfiedLinkError) { - loadUnsatisfiedLinkError = unsatisfiedLinkError; - } - } - - - AS400 system_; - byte[] qualifiedUserSpaceName_ = null; - int handle_; - - public UserSpaceNativeReadWriteImplILE(AS400 impl) throws SecurityException, UnsatisfiedLinkError{ - if (loadSecurityException != null ) throw loadSecurityException; - if (loadUnsatisfiedLinkError != null) throw loadUnsatisfiedLinkError; - system_ = impl; - } - - - public void open(String library_, String name_) throws UnsupportedEncodingException, CharConversionException { - // Get a converter for the system objects CCSID. - Converter converter_ = new Converter(system_.getCcsid(), system_); - // The name and library of the user space used in program call. Start with 20 EBCDIC spaces (" "). - qualifiedUserSpaceName_ = new byte[] { - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - // Put the converted object name at the beginning of the array. - converter_.stringToByteArray(name_, qualifiedUserSpaceName_, 0); - // Put the converted library name at position ten. - converter_.stringToByteArray(library_, qualifiedUserSpaceName_, 10); - handle_= nativeAllocate(qualifiedUserSpaceName_); - } - /* read bytes from the userSpace and return number of bytes read */ - public int read(byte dataBuffer[], int userSpaceOffset, int dataOffset, int length) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException { - return nativeRead(handle_, dataBuffer, userSpaceOffset, dataOffset, length); - } - - public void write(byte[] dataBuffer, int userSpaceOffset, int dataOffset, int length, int forceAuxiliary) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException { - nativeWrite(handle_, dataBuffer, userSpaceOffset,dataOffset,length, forceAuxiliary); - } - - public void close() { - if (handle_ != 0) { - nativeClose(handle_); - handle_=0; - } - } - - native int nativeAllocate(byte[] qualifiedUserSpaceName); - native int nativeRead (int handle, byte dataBuffer[], int userSpaceOffset, int dataOffset, int length); - native int nativeWrite(int handle, byte[] dataBuffer, int userSpaceOffset, int dataOffset, int length, int forceAuxiliary); - native int nativeClose(int handle); - - protected void finalize() throws Throwable { - if (handle_ != 0) close(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/VariableLengthFieldDescription.java b/cvsroot/src/com/ibm/as400/access/VariableLengthFieldDescription.java deleted file mode 100644 index b68e9a5a3..000000000 --- a/cvsroot/src/com/ibm/as400/access/VariableLengthFieldDescription.java +++ /dev/null @@ -1,34 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: VariableLengthFieldDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - *The VariableLengthFieldDescription interface provides an interface - *for FieldDescription subclasses that can contain - *variable-length data. -**/ -public interface VariableLengthFieldDescription -{ - /** - *Indicates if the field is a variable-length field. - *@return true if the field is a variable-length field; false otherwise. - **/ - public boolean isVariableLength(); - - /** - *Sets the value that indicates if the field is a variable-length field. - *@param value true if the field is a variable-length field; false otherwise. - **/ - public void setVariableLength(boolean value); -} diff --git a/cvsroot/src/com/ibm/as400/access/Verbose.java b/cvsroot/src/com/ibm/as400/access/Verbose.java deleted file mode 100644 index 10c9ae6f3..000000000 --- a/cvsroot/src/com/ibm/as400/access/Verbose.java +++ /dev/null @@ -1,99 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Verbose.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.PrintStream; - - - -/** -The Verbose class prints verbose output depending -on the state of a flag. -**/ -class Verbose -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static PrintStream output_ = System.out; - private static boolean state_ = false; - - - -/** -Prints text. - -@param text The text. -**/ - public static void forcePrintln (String text) - { - output_.println (text); - if (Trace.isTraceInformationOn ()) - Trace.log (Trace.INFORMATION, text); - } - - - -/** -Indicates if verbose output is printed. - -@return true if verbose output is printed; false otherwise. -**/ - public static boolean isVerbose () - { - return state_; - } - - - - public static void println (Exception e) - { - if (state_) { - String text = e.getMessage(); - if (text == null) - text = e.getClass().getName(); - forcePrintln(text); - } - } - - - -/** -Prints text, if appropriate. - -@param text The text. -**/ - public static void println (String text) - { - if (state_) - forcePrintln (text); - } - - - -/** -Sets whether verbose output is printed. - -@param verbose true if verbose output is printed; false otherwise. -**/ - public static void setVerbose (boolean verbose) - { - state_ = verbose; - } - - - - -} diff --git a/cvsroot/src/com/ibm/as400/access/WriterJob.java b/cvsroot/src/com/ibm/as400/access/WriterJob.java deleted file mode 100644 index c86d5d144..000000000 --- a/cvsroot/src/com/ibm/as400/access/WriterJob.java +++ /dev/null @@ -1,260 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: WriterJob.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - * The WriterJob class represents a writer job. - * An instance of this class can be used to manipulate an individual - * writer. Use the start method to obtain a instance of this class. - * - * See Writer Job Attributes for - * valid attributes. - * - **/ - -public class WriterJob extends PrintObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - // We have decided that writer jobs are too transient to - // be a JavaBean. - - // constructor used internally (not externalized since it takes - // an ID code point - WriterJob(AS400 system, NPCPIDWriter id, NPCPAttribute attrs) - { - super(system, id, attrs, NPConstants.WRITER_JOB); - } - - - - // A1A - Added chooseImpl() method - /** - * Chooses the appropriate implementation. - **/ - void chooseImpl() - throws IOException, AS400SecurityException - { - // We need to get the system to connect to... - AS400 system = getSystem(); - if (system == null) { - Trace.log( Trace.ERROR, "Attempt to use WriterJob before setting system." ); - throw new ExtendedIllegalStateException("system", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - impl_ = (WriterJobImpl) system.loadImpl2("com.ibm.as400.access.WriterJobImplRemote", - "com.ibm.as400.access.WriterJobImplProxy"); - super.setImpl(); - } - - - - /** - * Ends a writer on the system. - * - * @param endType When to end the writer. - * May be any of the following values: - *

        - *
      • *CNTRLD - The writer is ended at the end of the current spooled file. - *
      • *IMMED - The writer is ended immediately. - *
      • *PAGEEND - The writer is ended at the end of the current page. - *
      - * endType may be null. If endType is not specified, the default is - * *IMMED. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * system operating system is not at the correct level. - **/ - public void end(String endType) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - if (impl_ == null) - chooseImpl(); - ((WriterJobImpl) impl_).end(endType); - } // end end - - - - /** - * Returns the name of the writer. - * - * @return The name of the writer. - **/ - public String getName() - { - NPCPID IDCodePoint = getIDCodePoint(); - - if( IDCodePoint == null ) { - return EMPTY_STRING; // "" - } else { - return IDCodePoint.getStringValue(ATTR_WTRJOBNAME); - } - } - - - - /** - * Starts a writer on the system. - * Use this method to start a new writer job on the given system - * with the specified parameters. - * @param system The system on which to start the writer job. - * @param printer The printer that should be used - * to start the writer job. This printer - * must reside on the same system that the - * writer job is being started on. - * @param options Optional. A print parameter list that contains - * a list of attributes to start the writer job. - * The output queue parameters set in this list override the - * output queue parameter. - * The following parameters may be set: - * - *
      - * - * @param outputQueue Optional. The output queue to start the - * writer job. The output queue must reside on - * the same system that the writer job - * is being created on. - * - * @return A writer job object that was created. - * - * @exception AS400Exception If the system returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the system. - * @exception InterruptedException If this thread is interrupted. - **/ - public static WriterJob start(AS400 system, - Printer printer, - PrintParameterList options, - OutputQueue outputQueue) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - - { - // note: This is a static method - - // First check the required parameters of system and printer - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - - if (printer == null) - { - Trace.log(Trace.ERROR, "Parameter 'printer' is null."); - throw new NullPointerException("printer"); - } - - if (printer.getImpl() == null) { - printer.chooseImpl(); - } - - OutputQueueImpl oqi = null; - if (outputQueue != null) { - if (outputQueue.getImpl() == null) { - outputQueue.chooseImpl(); - } - oqi = (OutputQueueImpl) outputQueue.getImpl(); - } - - WriterJobImpl impl = (WriterJobImpl) system.loadImpl2("com.ibm.as400.access.WriterJobImplRemote", - "com.ibm.as400.access.WriterJobImplProxy"); - - // Changed below line to send in the Impls, and receive the - // NPCPIDWriter instead of a WriterJob - NPCPIDWriter cpWriterID = ((WriterJobImpl) impl).start(system.getImpl(), - (PrintObjectImpl) printer.getImpl(), - options, - oqi); - - return new WriterJob(system, cpWriterID, null); - - } // end start - -} // end WriterJob class diff --git a/cvsroot/src/com/ibm/as400/access/WriterJobImpl.java b/cvsroot/src/com/ibm/as400/access/WriterJobImpl.java deleted file mode 100644 index c566e1565..000000000 --- a/cvsroot/src/com/ibm/as400/access/WriterJobImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: WriterJobImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - * The WriterJobImpl interface defines a set of methods - * needed for a full implementation of the WriterJob class. - **/ - -interface WriterJobImpl extends PrintObjectImpl -{ - public void end(String endType) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException; - - - - public NPCPIDWriter start(AS400Impl system, - PrintObjectImpl printer, - PrintParameterList options, - OutputQueueImpl outputQueue) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException; -} diff --git a/cvsroot/src/com/ibm/as400/access/WriterJobImplProxy.java b/cvsroot/src/com/ibm/as400/access/WriterJobImplProxy.java deleted file mode 100644 index b5e0d29e9..000000000 --- a/cvsroot/src/com/ibm/as400/access/WriterJobImplProxy.java +++ /dev/null @@ -1,81 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: WriterJobImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - -/** - * The WriterJobImplProxy class implements proxy versions of - * the public methods defined in the WriterJobImpl class. - * Unless commented otherwise, the implementations of the methods below - * are merely proxy calls to the corresponding method in the remote - * implementation class (WriterJobImplRemote). - **/ - -class WriterJobImplProxy extends PrintObjectImplProxy -implements WriterJobImpl, ProxyImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - WriterJobImplProxy() - { - super("WriterJob"); - } - - - public void end(String endType) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - try { - connection_.callMethod(pxId_, "end", - new Class [] { String.class }, - new Object[] { endType }); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow6a(e); - } - } - - - - public NPCPIDWriter start(AS400Impl system, - PrintObjectImpl printer, - PrintParameterList options, - OutputQueueImpl outputQueue) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - { - try { - // changed parms to send Impls in; changed return - // type from WriterJob to NPCPIDWriter - return (NPCPIDWriter) connection_.callMethod(pxId_, "start", - new Class [] { AS400Impl.class, PrintObjectImpl.class, - PrintParameterList.class, OutputQueueImpl.class }, - new Object[] { system, printer, options, outputQueue }).getReturnValue(); - } - catch (InvocationTargetException e) { - throw ProxyClientConnection.rethrow4(e); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/access/WriterJobImplRemote.java b/cvsroot/src/com/ibm/as400/access/WriterJobImplRemote.java deleted file mode 100644 index d3b79f19e..000000000 --- a/cvsroot/src/com/ibm/as400/access/WriterJobImplRemote.java +++ /dev/null @@ -1,346 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: WriterJobImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.io.IOException; - -/** - * The WriterJob class represents a server writer job. - * An instance of this class can be used to manipulate an individual - * writer. Use the start method to obtain a instance of this class. - * - * See Writer Job Attributes for - * valid attributes. - * - **/ - -class WriterJobImplRemote extends PrintObjectImplRemote -implements WriterJobImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private static final NPCPAttributeIDList attrsToRetrieve_ = new NPCPAttributeIDList(); - private static boolean fAttrIDsToRtvBuilt_ = false; - - - private synchronized void buildAttrIDsToRtv() - { - if (!fAttrIDsToRtvBuilt_) - { - fAttrIDsToRtvBuilt_ = true; - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WTRJOBNAME); // writer job name - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WTRJOBNUM); // writer job number - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WTRJOBSTS); // writer job status - attrsToRetrieve_.addAttrID(PrintObject.ATTR_WTRJOBUSER); // writer job user name - } - } - - - - /** - * Ends a writer on the server. - * - * @param endType When to end the writer. - * May be any of the following values: - *
        - *
      • *CNTRLD - The writer is ended at the end of the current spooled file. - *
      • *IMMED - The writer is ended immediately. - *
      • *PAGEEND - The writer is ended at the end of the current page. - *
      - * endType may be null. If endType is not specified, the default is - * *IMMED. - * - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - * @exception RequestNotSupportedException If the requested function is not supported because the - * server operating system is not at the correct level. - **/ - public void end(String endType) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - NPDataStream sendDS = new NPDataStream(NPConstants.WRITER_JOB); - NPDataStream returnDS = new NPDataStream(NPConstants.WRITER_JOB); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - - NPCPAttribute cpCPFMessage = new NPCPAttribute(); - - sendDS.setAction(NPDataStream.END); - sendDS.addCodePoint(getIDCodePoint()); - - if (endType != null) - { - NPCPAttribute cpAttr = new NPCPAttribute(); - cpAttr.setAttrValue(PrintObject.ATTR_WTREND, endType); - sendDS.addCodePoint(cpAttr); - } - - returnDS.addCodePoint(cpCPFMessage); - - npSystem.makeRequest(sendDS, returnDS); - - } // end end - - - - NPCPAttributeIDList getAttrIDsToRetrieve() - { - if (!fAttrIDsToRtvBuilt_) { - buildAttrIDsToRtv(); - } - return attrsToRetrieve_; - } - - // retrieve only one attribute - NPCPAttributeIDList getAttrIDsToRetrieve(int attrToRtv) - { - if (!fAttrIDsToRtvBuilt_) { - attrsToRetrieve_.addAttrID(attrToRtv); - } - return attrsToRetrieve_; - } - - - /** - * Returns the name of the writer. - * - * @return The name of the writer. - **/ - public String getName() - { - NPCPID IDCodePoint = getIDCodePoint(); - - if( IDCodePoint == null ) { - return PrintObject.EMPTY_STRING; // "" - } else { - return IDCodePoint.getStringValue(PrintObject.ATTR_WTRJOBNAME); - } - } - - - - /** - * Starts a writer on the server. - * Use this method to start a new writer job on the given server - * with the specified parameters. - * @param system The system on which to start the writer job. - * @param printer The printer that should be used - * to start the writer job. This printer - * must reside on the same server that the - * writer job is being started on. - * @param options Optional. A print parameter list that contains - * a list of attributes to start the writer job. - * The output queue parameters set in this list override the - * output queue parameter. - * The following parameters may be set: - * - *
      - * - * @param outputQueue Optional. The output queue to start the - * writer job. The output queue must reside on - * the same server that the writer job - * is being created on. - * - * @return A writer job object that was created. - * - * @exception AS400Exception If the server returns an error message. - * @exception AS400SecurityException If a security or authority error occurs. - * @exception ErrorCompletingRequestException If an error occurs before the request is completed. - * @exception IOException If an error occurs while communicating with the server. - * @exception InterruptedException If this thread is interrupted. - **/ - public /* static @A1D */ NPCPIDWriter start(AS400Impl system, - PrintObjectImpl printer, - PrintParameterList options, - OutputQueueImpl outputQueue) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException - - { - // note: This is a static method - // - // build the send and reply datastreams - // We send up the printer ID codepoint and optionally an output queue ID codedpoint - // and an Attribute/Attribute Value code point. - // We receive a writer job ID code point or maybe a CPF error message code point - // - - NPDataStream sendDS = new NPDataStream(NPConstants.WRITER_JOB); - NPDataStream returnDS = new NPDataStream(NPConstants.WRITER_JOB); - NPCPAttribute cpCPFMessage = new NPCPAttribute(); - NPCPIDWriter cpWriterID = new NPCPIDWriter(); - - NPSystem npSystem = NPSystem.getSystem((AS400ImplRemote) system); - sendDS.setAction(NPDataStream.START); - - sendDS.addCodePoint(((PrinterImplRemote) printer).getIDCodePoint()); - if (outputQueue != null) - { - sendDS.addCodePoint(((OutputQueueImplRemote) outputQueue).getIDCodePoint()); - } - if (options != null) - { - sendDS.addCodePoint(options.getAttrCodePoint()); - } - returnDS.addCodePoint(cpCPFMessage); - returnDS.addCodePoint(cpWriterID); - int rc = npSystem.makeRequest(sendDS, returnDS); - // - // if there is some error that occured that makerequest didn't throw an - // exception for, throw a generic AS400_ERROR here with the RC in the text - // - if (rc != NPDataStream.RET_OK) - { - Trace.log(Trace.ERROR, "Bad RC starting writer from server. RC = " + rc ); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.AS400_ERROR, - " Network Print Server RC = " + rc); - } - - // everything went OK, create and return the WriterJob object - // Changed method to return cpWriterID instead of WriterJob - // Create the WriterJob on the proxy(client) side instead. - // return new WriterJob(system, cpWriterID, null); - return cpWriterID; - - } // end start - - // go to the server and get the lastest attributes for this object - // Override this from the PrintObject class because the network - // print server doesn't allow retrieve attributes on a writer - // We will implement it by going to the to list 1 writer (this one) - // and if the writer is there we will get its new attributes. If - // the writer is not there, we will get back an empty list an we - // will return an ErrorCompletingRequestException with a RC of - // WRITER_JOB_ENDED - // - void updateAttrs(NPCPAttributeIDList attrIDs) - throws AS400Exception, - AS400SecurityException, - ErrorCompletingRequestException, - IOException, - InterruptedException, - RequestNotSupportedException - { - NPDataStream req = new NPDataStream(NPConstants.WRITER_JOB); - NPDataStream reply = new NPDataStream(NPConstants.WRITER_JOB); - NPSystem npSystem = NPSystem.getSystem(getSystem()); - - // code point we will send up to select just one writer job - NPCPSelWrtJ writerSelection = new NPCPSelWrtJ(); - String strWriter = getName(); - writerSelection.setWriter(strWriter); - - // This code point will hold the returned attribute OR the - // CPF message if we get one of those instead - NPCPAttribute cpAttrs = new NPCPAttribute(); - - // This code point will hold the writer job ID that comes back - // on the list request - we will just throw it away - NPCPIDWriter cpWriterID = new NPCPIDWriter(); - - req.setAction(NPDataStream.LIST); - req.addCodePoint(writerSelection); - req.addCodePoint(attrIDs); - reply.addCodePoint(cpAttrs); - reply.addCodePoint(cpWriterID); - - int rc = npSystem.makeRequest(req, reply); - switch (rc) - { - case 0: - if (attrs != null) - { - attrs.addUpdateAttributes(cpAttrs); - } else { - attrs = cpAttrs; - } - break; - case NPDataStream.RET_EMPTY_LIST: - Trace.log(Trace.ERROR, "Writer Job " + strWriter + " not active"); - throw new ErrorCompletingRequestException( - ErrorCompletingRequestException.WRITER_JOB_ENDED, - strWriter); - default: - Trace.log(Trace.ERROR, "NetPrint DataStream RC = " + rc); - throw new ErrorCompletingRequestException(ErrorCompletingRequestException.AS400_ERROR); - } - } // updateAttrs() - -} diff --git a/cvsroot/src/com/ibm/as400/access/WriterJobList.java b/cvsroot/src/com/ibm/as400/access/WriterJobList.java deleted file mode 100644 index bdd0fc91a..000000000 --- a/cvsroot/src/com/ibm/as400/access/WriterJobList.java +++ /dev/null @@ -1,212 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: WriterJobList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.PropertyVetoException; - -/** - * The WriterJobList class is used to build a list of objects of type - * WriterJob. The list can be filtered by writer job name or output queue. - * - * @see WriterJob - **/ - -public class WriterJobList extends PrintObjectList -implements java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - static final long serialVersionUID = 4L; - - private static final String QUEUE_FILTER = "queueFilter"; - private static final String WRITER_FILTER = "writerFilter"; - - /** - * Constructs a WriterJobList object. The system must - * be set later. This constructor is provided for visual application - * builders that support JavaBeans. It is not intended for use - * by application programmers. - * - * @see PrintObjectList#setSystem - **/ - public WriterJobList() - { - super(NPConstants.WRITER_JOB, new NPCPSelWrtJ()); - // Because of this constructor we will need to check the - // system before trying to use it. - } - - - /** - * Constructs a WriterJobList object. It uses the system name provided. - * The default list filter will list all writer jobs on the specified system. - * - * @param system The system on which the writer jobs exist. - * - **/ - public WriterJobList(AS400 system) - { - super(NPConstants.WRITER_JOB, new NPCPSelWrtJ(), system); - } - - - /** - * Chooses the appropriate implementation. - **/ - void chooseImpl() - { - AS400 system = getSystem(); - if (system == null) { - Trace.log( Trace.ERROR, "Attempt to use WriterJobList before setting system."); - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - impl_ = (PrintObjectListImpl) system.loadImpl2("com.ibm.as400.access.WriterJobListImplRemote", - "com.ibm.as400.access.WriterJobListImplProxy"); - super.setImpl(); - } - - - /** - * Returns the output queue filter. - * - **/ - public String getQueueFilter() - { - // The selection code point is always present, the Queue Filter - // may not have been set. If empty, getQueue() returns - // an empty string. - - NPCPSelWrtJ selectionCP = (NPCPSelWrtJ)getSelectionCP(); - return( selectionCP.getQueue() ); - } - - - /** - * Returns the writer filter. - * - **/ - public String getWriterFilter() - { - // The selection code point is always present, the writer Filter - // may not have been set. If empty, getWriter() returns an - // empty string. - - NPCPSelWrtJ selectionCP = (NPCPSelWrtJ)getSelectionCP(); - return( selectionCP.getWriter() ); - } - - - PrintObject newNPObject(NPCPID cpid, NPCPAttribute cpattr) - { - return new WriterJob(system_, (NPCPIDWriter)cpid, cpattr); - } - - - /** - * Sets the output queue filter. Only writers active for this output queue - * will be listed. - * @param queueFilter Specifies the library and output queue name for which the writer - * jobs will be listed. The format of the queueFilter string must be in the - * format of /QSYS.LIB/libname.LIB/queuename.OUTQ, where - *
      - * libname is the library name that contains the queue for which to list writer - * jobs. It must be a specific library name. - * queuename is the name of an output queue for which to list writer jobs. - * It must be a specific output queue name. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setQueueFilter(String queueFilter) - throws PropertyVetoException - { - if( queueFilter == null ) - { - Trace.log( Trace.ERROR, "Parameter 'queueFilter' is null" ); - throw new NullPointerException( QUEUE_FILTER ); - } - - String oldQueueFilter = getQueueFilter(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( QUEUE_FILTER, oldQueueFilter, queueFilter ); - - // No one vetoed, make the change. - NPCPSelWrtJ selectionCP = (NPCPSelWrtJ)getSelectionCP(); - selectionCP.setQueue(queueFilter); - - // Propagate change to ImplRemote if necessary... - if (impl_ != null) - impl_.setFilter("writerJobQueue", queueFilter); - - // Notify any property change listeners. - changes.firePropertyChange( QUEUE_FILTER, oldQueueFilter, queueFilter ); - } - - - /** - * Sets writer list filter. - * @param writerFilter The name of the writers to list. - * writer is the name of the writers to list. - * It can be a specific name, a generic name, or the special value *ALL. - * The default for the writerFilter is *ALL. - * - * @exception PropertyVetoException If the change is vetoed. - * - **/ - public void setWriterFilter(String writerFilter) - throws PropertyVetoException - { - if( writerFilter == null ) - { - Trace.log( Trace.ERROR, "Parameter 'writerFilter' is null" ); - throw new NullPointerException( WRITER_FILTER ); - } - - // Allow a length of 0 to remove the filter from the - // selection code point. writerFilter.length() == 0 is OK. - - if( writerFilter.length() > 10 ) - { - Trace.log(Trace.ERROR, "Parameter 'writerFilter' is greater than 10 characters in length."); - throw new ExtendedIllegalArgumentException( - "writerFilter("+writerFilter+")", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - String oldWriterFilter = getWriterFilter(); - - // Tell any vetoers about the change. If anyone objects - // we let the PropertyVetoException propagate back to - // our caller. - vetos.fireVetoableChange( WRITER_FILTER, - oldWriterFilter, writerFilter ); - - // No one vetoed, make the change. - NPCPSelWrtJ selectionCP = (NPCPSelWrtJ)getSelectionCP(); - selectionCP.setWriter(writerFilter); - - // Propagate change to ImplRemote if necessary... - if (impl_ != null) - impl_.setFilter("writer", writerFilter); - - // Notify any property change listeners. - changes.firePropertyChange( WRITER_FILTER, - oldWriterFilter, writerFilter ); - } - -} // WriterJobList class - diff --git a/cvsroot/src/com/ibm/as400/access/WriterJobList16.gif b/cvsroot/src/com/ibm/as400/access/WriterJobList16.gif deleted file mode 100644 index 0a6cd2052..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/WriterJobList16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/WriterJobList32.gif b/cvsroot/src/com/ibm/as400/access/WriterJobList32.gif deleted file mode 100644 index 5c50b63bd..000000000 Binary files a/cvsroot/src/com/ibm/as400/access/WriterJobList32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/access/WriterJobListBeanInfo.java b/cvsroot/src/com/ibm/as400/access/WriterJobListBeanInfo.java deleted file mode 100644 index 4682d367e..000000000 --- a/cvsroot/src/com/ibm/as400/access/WriterJobListBeanInfo.java +++ /dev/null @@ -1,150 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: WriterJobListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; -import java.awt.Image; - -/** -BeanInfo for WriterJobList class. -**/ -public class WriterJobListBeanInfo extends PrintObjectListBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Additional properties for WriterJobList - private static PropertyDescriptor[] wrtJListProperties_; - - // Class this bean info represents. - private final static Class beanClass = WriterJobList.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader rbl_; - - static - { - try - { - PropertyDescriptor outQFilter = - new PropertyDescriptor("queueFilter", beanClass); - outQFilter.setBound(true); - outQFilter.setConstrained(true); - outQFilter.setDisplayName(rbl_.getText("PROP_NAME_WRTJ_OUTQ_FILTER")); - outQFilter.setShortDescription(rbl_.getText("PROP_DESC_WRTJ_OUTQ_FILTER")); - - PropertyDescriptor wrtJFilter = - new PropertyDescriptor("writerFilter", beanClass); - wrtJFilter.setBound(true); - wrtJFilter.setConstrained(true); - wrtJFilter.setDisplayName(rbl_.getText("PROP_NAME_WRTJ_NAME_FILTER")); - wrtJFilter.setShortDescription(rbl_.getText("PROP_DESC_WRTJ_NAME_FILTER")); - - PropertyDescriptor[] properties = {outQFilter, wrtJFilter}; - wrtJListProperties_ = properties; - } - - catch (IntrospectionException e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - // WriterJobList does not define any additional events so we - // let the PrintObjectList provide: - // public int getDefaultEventIndex() - // public EventSetDescriptor[] getEventSetDescriptors() - - // We want "system" as the default property. PrintObjectList - // sets this so we don't have to override: - // public int getDefaultPropertyIndex() - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - // Per the JavaBean spec, properties are discrete, named attributes - // of a Java Bean that can affect its appearance or its behavior. - - PropertyDescriptor[] printObjectListProperties; - PropertyDescriptor[] combinedProperties; - int combinedSize; - - // Get the properties defined in PrintObjectListBeanInfo - printObjectListProperties = super.getPropertyDescriptors(); - - combinedSize = printObjectListProperties.length + wrtJListProperties_.length; - combinedProperties = new PropertyDescriptor[combinedSize]; - - // copy PrintObjectList properties - System.arraycopy( printObjectListProperties, // source - 0, // --offset - combinedProperties, // destination - 0, // --offset - printObjectListProperties.length ); // length - - // copy WriterJobList properties - System.arraycopy( wrtJListProperties_, // source - 0, // --offset - combinedProperties, // destination - printObjectListProperties.length, // --offset - wrtJListProperties_.length ); // length - - return combinedProperties; - } - - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("WriterJobList16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("WriterJobList32.gif"); - break; - } - - return image; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/WriterJobListImplProxy.java b/cvsroot/src/com/ibm/as400/access/WriterJobListImplProxy.java deleted file mode 100644 index 23ef0ac0a..000000000 --- a/cvsroot/src/com/ibm/as400/access/WriterJobListImplProxy.java +++ /dev/null @@ -1,28 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: WriterJobListImplProxy.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.lang.reflect.InvocationTargetException; - -class WriterJobListImplProxy extends PrintObjectListImplProxy -implements ProxyImpl -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - WriterJobListImplProxy() - { - super("WriterJobList"); - } -} - diff --git a/cvsroot/src/com/ibm/as400/access/WriterJobListImplRemote.java b/cvsroot/src/com/ibm/as400/access/WriterJobListImplRemote.java deleted file mode 100644 index 63e7e2cdd..000000000 --- a/cvsroot/src/com/ibm/as400/access/WriterJobListImplRemote.java +++ /dev/null @@ -1,130 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: WriterJobListImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -/** - * The WriterJobList class is used to build a list of objects of type - * WriterJob. The list can be filtered by writer job name or output queue. - * - * @see WriterJob - **/ - -class WriterJobListImplRemote extends PrintObjectListImplRemote -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // static private binary data for default attribute to - // retrieve on a writer jobs when listing writer jobs - // format is: - // --------------------------------------------------- - // |nn | LEN | ID1 | ID2 | ID3 | ID4 | ....... | IDnn| - // --------------------------------------------------- - // nn - two byte total # of attributes in code point - // LEN - two byte length of each attribute entry, right - // now this will be 2 (0x02). - // IDx - two byte attribute ID - - private static final byte[] attrIDToList_ = - { - 0x00, 0x04, // big endian(BE), number of attrs - 0x00, 0x02, // BE - size in bytes of each ID - 0x00, 0x79, // writer job name - 0x00, 0x7A, // writer job number - 0x00, 0x7B, // writer job status - 0x00, 0x7C // writer job user name - }; - - private static final NPCPAttributeIDList defaultAttrIDsToList_ = new NPCPAttributeIDList(attrIDToList_); - - // register the writer return datastream for listing writers - static - { - NPDataStream ds; - NPCodePoint cp; - - ds = new NPDataStream(NPConstants.WRITER_JOB); - cp = new NPCPIDWriter(); - ds.addCodePoint(cp); - cp = new NPCPAttribute(); - ds.addCodePoint(cp); - AS400Server.addReplyStream(ds, "as-netprt"); - } - - - /** - * Returns the default attributes to list. - **/ - NPCPAttributeIDList getDefaultAttrsToList() - { - return defaultAttrIDsToList_; - } - - - /** - * Creates a new Writer object. - **/ - /* - PrintObject newNPObject(AS400 system, NPDataStream reply) - { - WriterJob npObj = null; - NPCPIDWriter cpid; - NPCPAttribute cpAttrs; - cpid = (NPCPIDWriter)reply.getCodePoint(NPCodePoint.WRITER_JOB_ID); // never should return null - cpAttrs = (NPCPAttribute)reply.getCodePoint(NPCodePoint.ATTRIBUTE_VALUE); // may return null - npObj = new WriterJob(system, cpid, cpAttrs); - return npObj; - } - */ - - - NPCPID newNPCPID(NPDataStream reply) - { - return (NPCPIDWriter)reply.getCodePoint(NPCodePoint.WRITER_JOB_ID); // never should return null - } - - - /** - * Sets the output queue filter. Only writers active for this output queue - * will be listed. - * @param queueFilter Specifies the library and output queue name for which the writer - * jobs will be listed. The format of the queueFilter string must be in the - * format of /QSYS.LIB/libname.LIB/queuename.OUTQ, where - *
      - * libname is the library name that contains the queue for which to list writer - * jobs. It must be a specific library name. - * queuename is the name of an output queue for which to list writer jobs. - * It must be a specific output queue name. - **/ - public void setQueueFilter(String queueFilter) - { - NPCPSelWrtJ selectionCP = (NPCPSelWrtJ)getSelectionCP(); - selectionCP.setQueue(queueFilter); - } - - - /** - * Sets writer list filter. - * @param writerFilter The name of the writers to list. - * writer is the name of the writers to list. - * It can be a specific name, a generic name, or the special value *ALL. - * The default for the writerFilter is *ALL. - **/ - public void setWriterFilter(String writerFilter) - { - NPCPSelWrtJ selectionCP = (NPCPSelWrtJ)getSelectionCP(); - selectionCP.setWriter(writerFilter); - } - -} - diff --git a/cvsroot/src/com/ibm/as400/access/ZonedDecimalFieldDescription.java b/cvsroot/src/com/ibm/as400/access/ZonedDecimalFieldDescription.java deleted file mode 100644 index c23243fd1..000000000 --- a/cvsroot/src/com/ibm/as400/access/ZonedDecimalFieldDescription.java +++ /dev/null @@ -1,220 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ZonedDecimalFieldDescription.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access; - -import java.math.BigDecimal; -import java.io.Serializable; -import java.util.Vector; - -/** - *Represents the description of the data in a zoned decimal field. - *The ZonedDecimalFieldDescription class allows: - *
        - *
      • The user to describe a zoned decimal field to the RecordFormat object. - *
      • The RecordFormat object to describe a zoned decimal field to the user. - *
      - *Click here to see an example. -**/ -public class ZonedDecimalFieldDescription extends FieldDescription implements Serializable -{ - static final long serialVersionUID = 4L; - - - // Number of decimal positions for this field - private int decimalPositions_; - - /** - *Constructs a ZonedDecimalFieldDescription object. - **/ - public ZonedDecimalFieldDescription() - { - } - - /** - *Constructs a ZonedDecimalFieldDescription object. It uses the data - *type and name of the field specified. - *The number of digits and the number of decimal positions will be determined from - *dataType. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - **/ - public ZonedDecimalFieldDescription(AS400ZonedDecimal dataType, String name) - { - super(dataType, name); - length_ = dataType.getNumberOfDigits(); - decimalPositions_ = dataType.getNumberOfDecimalPositions(); - } - - /** - *Constructs a ZonedDecimalFieldDescription object. It uses the - *data type, name, and DDS name of the field specified. - *The number of digits and the number of decimal positions will be determined from - *dataType. - *@param dataType Describes the field and provides - * the conversion capability for the contents of the field. - *@param name The name of the field. - *@param ddsName The DDS name of this field. This is the - * name of the field as it would appear in a DDS description of the - * field. The length of ddsName must be 10 characters or less. - **/ - public ZonedDecimalFieldDescription(AS400ZonedDecimal dataType, String name, String ddsName) - { - super(dataType, name, ddsName); - length_ = dataType.getNumberOfDigits(); - decimalPositions_ = dataType.getNumberOfDecimalPositions(); - } - - - /** - *Returns the DDS description for the field. This is a string containing - *the description of the field as it would be specified in a DDS source file. - *This method is used by AS400File.createDDSSourceFile to specify the field - *in the DDS source file which is used to create the file for the user who - *has passed in a RecordFormat object. - *@return The DDS description of this field properly formatted for entry - *into a DDS source file. - **/ - String[] getDDSDescription() - { - Vector v = new Vector(); - // Name columns (10) - StringBuffer desc = new StringBuffer(ddsName_); - // Blank pad the ddsName to 10 characters. - while(desc.length() < 10) - { - desc.append(" "); - } - // Reference column (1) - if (!refFld_.equals("")) - { - desc.append("R"); - } - else - { - desc.append(" "); - } - // Get length as 5 digit string, right justified -/* StringBuffer len = new StringBuffer(new Integer(length_).toString()); - if (len.length() < 5) - { - int blanksNeeded = 5 - len.length(); - for (short i = 0; i < blanksNeeded; ++i) - { - len.insert(0, " "); - } - } -*/ - String len = String.valueOf(length_); - int numSpaces = 5-len.length(); - for (int i=0; idataType - *cannot be null. - **/ - public void setDataType(AS400ZonedDecimal dataType) - { - // Verify parameters - if (dataType == null) - { - throw new NullPointerException("dataType"); - } - dataType_ = dataType; - length_ = dataType.getNumberOfDigits(); - decimalPositions_ = dataType.getNumberOfDecimalPositions(); - } - - //@B0C - javadoc - /** - *Sets the value for the DFT keyword for this field. - *@param defaultValue The default value for this - * field. The defaultValue cannot be null. - *To set a default value of *NULL, use the setDFTNull() method. - **/ - public void setDFT(BigDecimal defaultValue) - { - if (defaultValue == null) - { - throw new NullPointerException("defaultValue"); - } - defaultValue_ = defaultValue; - isDFTNull_ = false; //@B0A - isDFTCurrent_ = false; //@B0A - DFTCurrentValue_ = null; //@B0A - } - - //@B0A - /** - *Sets the value for the DFT keyword to be *NULL for this field. - *Calling this method will replace the DFT keyword that was previously - *set on a call to setDFT(). Note: This field - *must also have its ALWNULL keyword set to true to prevent DDS errors. - **/ - public void setDFTNull() - { - isDFTNull_ = true; - defaultValue_ = null; - isDFTCurrent_ = false; - DFTCurrentValue_ = null; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/doc-files/AFPResourceAttrs.html b/cvsroot/src/com/ibm/as400/access/doc-files/AFPResourceAttrs.html deleted file mode 100644 index 59d96fa75..000000000 --- a/cvsroot/src/com/ibm/as400/access/doc-files/AFPResourceAttrs.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - -IBM Toolbox for Java: AFP Resource Attributes - -

      AFP Resource Attributes

      - -
      - -

      Retrieve Attributes

      - -

      The following attributes may be retrieved for an AFP resource using the appropriate -getIntegerAttribute(), getStringAttribute(), or getFloatAttribute() method : - -

      - -
      - -

      Set Attributes

      - -

      Attributes are not allowed to be set for an AFP resource. - -


      - - - diff --git a/cvsroot/src/com/ibm/as400/access/doc-files/JDBCProperties.html b/cvsroot/src/com/ibm/as400/access/doc-files/JDBCProperties.html deleted file mode 100644 index 16b404677..000000000 --- a/cvsroot/src/com/ibm/as400/access/doc-files/JDBCProperties.html +++ /dev/null @@ -1,1070 +0,0 @@ - - - -IBM Toolbox for Java: JDBC properties - - - - -

      IBM Toolbox for Java JDBC properties

      - -

      Many properties can be specified when connecting to DB2 for IBM i using - JDBC. All properties are optional and can be specified either as part of the - URL or in a java.util.Properties object. If a property is set in both the URL - and a Properties object, the value in the URL will be used.

      - -

      Note: The following list does not include DataSource properties.

      - -

      The following tables list the different connection -properties that are recognized by this driver. Some of these -properties affect performance and others are server job -attributes. The tables organize the properties into the following categories:

      - - - - -

      General properties

      - -

      General properties are system attributes that specify the user, password, and - whether a prompt is necessary to connect to the system.

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      General propertyDescriptionRequiredChoicesDefault
      "password"Specifies the password for connecting to the system. If none is specified, - then the user will be prompted, unless the "prompt" property is - set to "false", in which case an attempt to connect will fail.nosystem password(user will be prompted)
      "prompt"Specifies whether the user should be prompted if a user name or password - is needed to connect to the system. If a connection can not be made without - prompting the user, and this property is set to "false", then - an attempt to connect will fail.no"true"
      - "false"
      "true"
      "user"Specifies the user name for connecting to the system. If none is specified, - then the user will be prompted, unless the "prompt" property is - set to "false", in which case an attempt to connect will fail.nosystem user(user will be prompted)
      - - -

      System properties

      -

      System properties specify attributes that govern transactions, libraries, and - databases.

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      System propertyDescriptionRequiredChoicesDefault
      "auto commit"Specifies whether auto-commit mode is the default connection - mode for new connections. Calling AS400JDBCConnection.setAutoCommit(boolean) - will override this property on a per-connection basis. Note that, in order - to use transaction isolation levels other than *NONE when using auto-commit - mode, the property "true autocommit" needs to be set to true.no"true"
      - "false"
      "true"
      "concurrent access resolution"Specifies whether "currently committed" access is used on the connection. A value of 1 - indicates that "currently committed" will be used. A value of 2 indicates that "wait for - outcome" will be used. A value of 3 indicates that "skip locks" will be used.no"1"
      - "2"
      - "3"
      (system default)
      "cursor hold" Specifies whether to hold the cursor across transactions. - If this property is set to "true", cursors are not closed when - a transaction is committed. All resources acquired during - the unit of work are held, but locks on specific rows and objects implicitly - acquired during the unit of work are released.no"true"
      - "false"
      "true"
      "cursor sensitivity"

      Specifies the cursor sensitivity to request from the database. The behavior depends on the resultSetType:

      -
        -
      • ResultSet.TYPE_FORWARD_ONLY or ResultSet.TYPE_SCROLL_SENSITIVE means that the value of this property controls what cursor sensitivity the Java program requests from the database.
      • -
      • ResultSet.TYPE_SCROLL_INSENSITIVE causes this property to be ignored.
      • -
      -
      no - "asensitive"
      - "sensitive"
      - "insensitive"
      "asensitive"
      "database - name" -

      Specifies the database to use for a connection to an independent auxiliary storage pool (ASP). - When you specify a database name, the name must exist in the relational - database directory on the system and correspond to either an independent ASP or the system - default database. The following criteria determine which - database is accessed:

      -
        -
      • When this property is used to specify a database which corresponds to an independent ASP, - the connection is made to the independent ASP. -
      • -
      • When this property is used to specify *SYSBAS as the database name, - the system default database is used.
      • -
      • When this property is omitted, the initial ASP group specified in the job description - for the user profile is used. When the job description - does not specify an initial ASP group, the system default database is used. -
      • -
      -
      noDatabase name "*SYSBAS"The initial ASP group specified in the job description - for the user profile. When the job description does not specify - an initial ASP group, the system default database is used.
      "decfloat rounding mode" -

      Specifies the rounding mode to use when working with decfloat data type. - Note, this property is ignored when connecting to systems running IBM i V5R4 and earlier. -

      no"half even"
      - "half up"
      - "down"
      - "ceiling"
      - "floor"
      - "half down"
      - "up"
      -
      "half even"
      "libraries" -

      Specifies one or more libraries that you want to add to or replace the - library list of the server job, and optionally sets the default SQL schema - (default library). Note that libraries cannot be longer than 10 characters in - length. You must use SET PATH sql if you have libraries longer than 10 characters. -

      Library list
      - The system uses specified libraries to resolve unqualified stored procedure - names, and stored procedures use them to resolve unqualified names. To - specify multiple libraries, use commas or spaces to separate individual - entries. You can use *LIBL as a placeholder for the current library list - of the server job: -

      When the first entry is *LIBL, the specified libraries are added to - the current library list of the server job When you do not use *LIBL, - the specified libraries replace the current library list of the server - job -

      Default SQL schema
      - The system uses the default SQL schema to resolve unqualified names in SQL - statements. For example, in the statement "SELECT * FROM MYTABLE", the - system looks only in the default SQL schema for MYTABLE. You can specify the - default SQL schema on the connection URL. When you do not specify the default - SQL schema on the connection URL, the following conditions apply, depending - on whether you use SQL Naming or System Naming. -

        -
      • SQL Naming
        - When you do not specify the default SQL schema on the connection URL: -
          -
        • The first entry (unless it is *LIBL) becomes the default SQL schema
        • -
        • When the first entry is *LIBL, the second entry becomes the default SQL - schema
        • -
        • When you do not set this property or when it contains only *LIBL, - the user profile becomes the default SQL schema
        • -
        -
      • -
      • System Naming
        - When you do not specify the default SQL schema on the connection URL: -
          -
        • No default SQL schema is set, and the system uses the specified libraries - to search for unqualified names
        • -
        • When you do not set this property or when it contains only *LIBL, - the system uses the current library list of the server job to search - for unqualified names
        • -
        -
      • -
      -
      noList of system libraries, separated by commas or spaces"*LIBL"
      "maximum precision"Specifies the maximum decimal precision the database should use.no "31"
      - "63"
      -
      "31"
      "maximum scale"Specifies the maximum scale the database should use.no "0"-"63"
      -
      "31"
      "minimum divide scale"Specifies the minimum scale value for the result of decimal division.no "0"
      - "1"
      - "2"
      - "3"
      - "4"
      - "5"
      - "6"
      - "7"
      - "8"
      - "9"
      -
      "0"
      "package ccsid"Specifies the character encoding to use for the SQL package and any statements sent to the system.no "1200" (UTF-16)
      - "13488" (UCS-2)
      - "system" (host CCSID)
      -
      "13488"
      "transaction isolation"Specifies the default transaction isolation.no "none"
      - "read uncommitted"
      - "read committed"
      - "repeatable read"
      - "serializable"
      "read uncommitted"
      "translate hex"Specifies how hexadecimal literals are interpreted.no "character" (Interpret hexadecimal literals as character data)
      - "binary" (Interpret hexadecimal literals as binary data)
      -
      "character"
      "true autocommit"Specifies whether the connection should use true auto commit support. - True autocommit means that autocommit is on and is running under a isolation level other - than *NONE. By default, the driver handles autocommit by running under the system isolation - level of *NONE. no "true" (Use true autocommit.)
      - "false" (Do not use true autocommit.)
      -
      "false"
      "XA loosely coupled support"Specifies whether lock sharing is allowed for loosely coupled transaction branches. - Note, this property is ignored when connecting to systems running to IBM i V5R3 and earlier. - This option can be set to 0 to indicate to not share locks or 1 to share locks. no "0" (Do not share locks.)
      - "1" (Share locks.)
      -
      "0"
      - - -

      Format properties

      -

      Format properties specify date and time formats, date and decimal separators, - and table naming conventions used within SQL statements.

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Format propertyDescriptionRequiredChoicesDefault
      "date format"Specifies the date format used in date literals within SQL statements.no "mdy"
      - "dmy"
      - "ymd"
      - "usa"
      - "iso"
      - "eur"
      - "jis"
      - "julian"
      (server job)
      "date separator"Specifies the date separator used in date literals within SQL statements. - This property has no effect unless the "date format" property - is set to "julian", "mdy", "dmy" or "ymd".no "/" (slash)
      - "-" (dash)
      - "." (period)
      - "," (comma)
      - "b" (space)
      (server job)
      "decimal separator"Specifies the decimal separator used in numeric literals within SQL statements.no "." (period)
      - "," (comma)
      (server job)
      "naming"Specifies the naming convention used when referring to tables.no "sql" (as in schema.table)
      - "system" (as in schema/table)
      "sql"
      "time format"Specifies the time format used in time literals within SQL statements.no "hms"
      - "usa"
      - "iso"
      - "eur"
      - "jis"
      (server job)
      "time separator"Specifies the time separator used in time literals within SQL statements. - This property has no effect unless the "time format" property - is set to "hms".no ":" (colon)
      - "." (period)
      - "," (comma)
      - "b" (space)
      (server job)
      - - -

      Performance properties

      -

      Performance properties are attributes that include caching, data conversion, - data compression, and prefetching that affect performance.

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Performance propertyDescriptionRequiredChoicesDefault
      "big decimal"Specifies whether an intermediate java.math.BigDecimal object - is used for packed and zoned decimal conversions. If this property is set - to "true", an intermediate java.math.BigDecimal object is used - for packed and zoned decimal conversions as described by the JDBC specification. - If this property is set to "false", no intermediate objects are - used for packed and zoned decimal conversions. Instead, such values are - converted directly to and from Java double values. Such conversions will - be faster but may not follow all conversion and data truncation rules documented - by the JDBC specification.no"true"
      - "false"
      "true"
      "block criteria"Specifies the criteria for retrieving data from the system - in blocks of records. Specifying a non-zero value for this property will - reduce the frequency of communication to the system, and therefore increase - performance. -

      Ensure that record blocking is off if the cursor is going to be used - for subsequent UPDATEs, or else the row that is updated will not necessarily - be the current row. -

      no "0" (no record blocking)
      - "1" (block if FOR FETCH ONLY is specified)
      - "2" (block unless FOR UPDATE is specified)
      "2"
      "block size"Specifies the block size (in kilobytes) to retrieve from - the system and cache on the client. This property has no effect unless the - "block criteria" property is non-zero. Larger block sizes reduce - the frequency of communication to the system, and therefore may increase - performance.no "0"
      - "8"
      - "16"
      - "32"
      - "64"
      - "128"
      - "256"
      - "512"
      "32"
      "data compression"Specifies whether result set data is compressed. If this - property is set to "true", then result set data is compressed. - If this property is set to "false", then result set data is not - compressed. Data compression may improve performance when retrieving large - result sets.no"true"
      - "false"
      "true"
      "extended dynamic"Specifies whether to use extended dynamic support. Extended - dynamic support provides a mechanism for caching dynamic SQL statements - on the system. The - first time a particular SQL statement is prepared, it is stored in a SQL - package on the system. If the package does not exist, it is automatically - created. On subsequent prepares of the same SQL statement, the system can - skip a significant part of the processing by using information stored in - the SQL package. - If this is set to "true", then a package name must be set using - the "package" property.no"true"
      - "false"
      "false"
      "lazy close"Specifies whether to delay closing cursors until subsequent - requests. This will increase overall performance by reducing the total number - of requests.no"true"
      - "false"
      "false"
      "lob threshold"Specifies the maximum LOB (large object) size (in bytes) - that can be retrieved as part of a result set. LOBs that are larger than - this threshold will be retrieved in pieces using extra communication to - the system. Larger LOB thresholds will reduce the frequency of communication - to the system, but will download more LOB data, even if it is not used. - Smaller LOB thresholds may increase frequency of communication to the system, - but will only download LOB data as it is needed.no"0" - "16777216""32768"
      "maximum blocked input rows"Specifies the maximum number of rows to be sent to the database - engine when using a blocked insert or update operation. The database engine has a - limit of 32000 rows with a total of 16MB of data. This property may be used to - reduce the size of buffers in the JVM when using batched insert operations. - no"1" - "32000""32000"
      "package"Specifies the base name of the SQL package. Note - that only the first seven characters are used to generate the name of the - SQL package on the system. - This property has no effect unless the "extended dynamic" property - is set to "true". In addition, this property must be set if the - "extended dynamic" property is set to "true".noSQL package""
      "package add"Specifies - whether to add newly prepared statements to the SQL package specified on - the "package" property. This property has no effect unless the - "extended dynamic" property is set to "true".no"true"
      - "false"
      "true"
      "package cache"Specifies - whether to cache a subset of the SQL package information in client memory. - Caching SQL packages locally reduces the amount of communication to the - system for prepares and describes. This property has no effect unless the - "extended dynamic" property is set to "true".no"true"
      - "false"
      "false"
      "package criteria"Specifies the type of SQL statements to be stored in the - SQL package. This can be useful to improve the performance of complex join - conditions. This property has no effect unless the "extended dynamic" - property is set to "true".no"default" (only store SQL statements with parameter - markers in the package)
      - "select" - (store all SQL SELECT statements in the package)
      "default"
      "package error"Specifies the action to take when SQL package errors occur. - When a SQL package error occurs, the driver will optionally throw a SQLException - or post a warning to the Connection, based on the value of this property. - This property has no effect unless the "extended dynamic" property - is set to "true".no "exception"
      - "warning"
      - "none"
      "warning"
      "package library"Specifies the library for the SQL package. This property - has no effect unless the "extended dynamic" property is set to - "true".noLibrary for SQL package"QGPL"
      "prefetch"Specifies whether to prefetch data upon executing a SELECT - statement. This will increase performance when accessing the initial rows - in the ResultSet.no"true"
      - "false"
      "true"
      "qaqqinilib"Specifies a QAQQINI library name. Used to specify the library that contains the qaqqini file to use. A qaqqini file contains all of the attributes that can potentially impact the performance of the DB2 for IBM i database engine.no"QAQQINI library name"
      -
      (system default)
      "query optimize goal"Specifies the goal the system should use with optimization of queries. This setting corresponds with the system's QAQQINI option called OPTIMIZATION_GOAL. Note, this property is ignored when connecting to systems running to IBM i V5R3 and earlier.no"0" = Optimize query for first block of data (*ALLIO) when extended dynamic packages are used; Optimize query for entire result set (*FIRSTIO) when packages are not used
      - "1" = Optimize query for first block of data (*FIRSTIO)
      - "2" = Optimize query for entire result set (*ALLIO)
      "0"
      "query storage limit"Specifies the query storage limit to be used when statements in a connection are executed. - Valid values are -1 to 2147352578 megabytes. Note, this property is ignored when connecting to systems running IBM i V5R4 and earlier.
      - You must have *JOBCTL special authority to use query storage limit with Version 6 Release 1 of IBM i.
      no"-1 (no limit)" - "2147352578""-1"
      "receive buffer size"Specifies the buffer size used to receive data through the socket connection between the front-end driver and the IBM i system.
      NOTE: This does not specify the actual receive buffer size. It is only used as a hint by the underlying socket code.
      no"1" - max size(platform dependent)
      "send buffer size"Specifies the buffer size used to send data through the socket connection between the front-end driver and the IBM i system.
      NOTE: This does not specify the actual send buffer size. It is only used as a hint by the underlying socket code.
      no"1" - max size(platform dependent)
      "variable field compression"Specifies whether variable-length fields should be compressed.no"true"
      - "false"
      "true"
      - - -

      Sort properties

      -

      Sort properties specify how the system performs stores and performs sorts.

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Sort propertyDescriptionRequiredChoicesDefault
      "sort"Specifies how the system sorts records before sending them to the client.no "hex" (base the sort on hexadecimal values)
      - "language" (base the sort on the language set in the "sort - language" property)
      - "table" (base the sort on the sort sequence table set in - the "sort table" property)
      "hex"
      "sort language"Specifies a 3-character language id to use for selection of a sort sequence. - This property has no effect unless the "sort" property is set - to "language".noLanguage idENU
      "sort table"Specifies the library and file name of a sort sequence table stored on - the system. This property has no effect unless the "sort" property - is set to "table".noQualified sort table name""
      "sort weight"Specifies how the system treats case while sorting records. This property - has no effect unless the "sort" property is set to "language".no "shared" (uppercase and lowercase characters sort as - the same character)
      - "unique" (uppercase and lowercase characters sort as different - characters)
      "shared"
      - - -

      Other properties

      -

      Other properties are those properties not easily categorized. These properties - determine which JDBC driver is used, and specify options related to level of - database access, bidirectional string type, data truncation and so on.

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Other propertyDescriptionRequiredChoicesDefault
      "access"Specifies the level of database access for the connection.no "all" (all SQL statements allowed)
      - "read call" (SELECT and CALL statements allowed)
      - "read only" (SELECT statements only)
      "all"
      "autocommit exception"Specifies whether to throw an SQLException when Connection.commit() or Connection.rollback() is called if autocommit is enabled.no -

      "true"
      - "false"

      -
      "false"
      "bidi string type"Specifies the output string type of bidirectional data. See - BidiStringType - for more information.no -

      "4"
      - "5"
      - "6"
      - "7"
      - "8"
      - "9"
      - "10"
      - "11"

      -
      "5"
      "bidi implicit reordering"Specifies if bidi implicit LTR-RTL reordering should be used.no -

      "true"
      - "false"

      -
      "true"
      "bidi numeric ordering"Specifies if the numeric ordering round trip feature should be used.no -

      "true"
      - "false"

      -
      "false"
      "data truncation" -

      Specifies - whether truncation of character data generates warnings - and exceptions. When this property is "true", the following apply:

      -
        -
      • Writing truncated character data to the database throws an exception
      • -
      • Using truncated character data in a query posts a warning.
      • -
      -

      When this property is "false", writing truncated data to the database - or using such data in a query generates no exception or warning.

      -

      The default value is "true".

      -

      This property does not affect numeric data. Writing - truncated numeric data to the database always throws an error and using - truncated numeric data in a query always posts a warning. -

      -
      no"true"
      - "false"
      "true"
      "driver"Specifies the JDBC driver implementation. The IBM Toolbox - for Java JDBC driver can use different JDBC driver implementations based - on the environment. If the environment is an IBM i JVM on the same system - as the database to which the program is connecting, the native IBM Developer - Kit for Java JDBC driver can be used. In any other environment, the IBM - Toolbox for Java JDBC driver is used. This property has no effect if the - "secondary URL" property is set. no"toolbox" (use only the IBM Toolbox for Java JDBC - driver).
      - "native" (use the IBM Developer Kit for Java JDBC driver if running - on the system, otherwise use the Toolbox for Java JDBC driver).
      "toolbox"
      "errors"Specifies the amount of detail to be returned in the message - for errors that occur on the system.no "basic"
      - "full"
      "basic"
      "extended - metadata"Specifies whether the driver should request extended metadata - from the system. Setting this property to true increases the accuracy of - the information returned from the following ResultSetMetaData methods: -
        -
      • getColumnLabel(int)
      • -
      • isReadOnly(int)
      • -
      • isSearchable(int)
      • -
      • isWriteable(int)
      • -
      -

      Additionally, setting this property to true enables support for the ResultSetMetaData.getSchemaName(int) - and ResultSetMetaData.isAutoIncrement(int) methods. Setting this property to true may slow performance because it requires retrieving more information - from the system. Leave the property as the default (false) unless you need more specific information from - the listed methods. For example, when this property is off (false), ResultSetMetaData.isSearchable(int) - always returns "true" because because the driver does not have enough information - from the system to make a judgment. Turning on this property (true) forces - the driver to get the correct data from the system.

      -
      no"true"
      "false"
      "false"
      "full open"Specifies whether the system fully opens a file for each - query. By default the system optimizes open requests. This optimization - improves performance but may fail if a database monitor is active when a - query is run more than once. Set the property to true only when identical - queries are issued when monitors are active.no"true"
      - "false"
      "false"
      "hold input locators"Specifies whether input locators should be allocated as type hold locators or not hold locators. If the - locators are of type hold, they will not be released when a commit is done.no"true" (type hold)
      - "false"
      "true"
      "hold statements"Specifies if statements should remain open until a transaction boundary when - autocommit is off and they are associated with a LOB locator. By default, all the resources - associated with a statement are released when the statement is closed. Set this property to true - only when access to a LOB locator is needed after a statement has been closed.no"true"
      - "false"
      "false"
      "ignore warnings"Specifies a list of SQL states for which the driver should not create warning objects. - By default, the Toolbox JDBC driver will internally create a java.sql.SQLWarning - object for each warning returned by the database. For example, a warning with - the SQLSTATE 0100C is created every time a result set is returned from a stored procedure. This - warning can be safely ignored to improve the performance of applications that call stored procedures.noA comma separated list of SQL states that should be ignored""
      "keep alive"Specifies whether socket connection is to be periodically checked for operational status.no"true"
      - "false"
      (platform dependent)
      "key ring name"Specifies the key ring class name used for SSL connections - with the system. This property has no effect unless "secure" is - set to true and a key ring password is set using the "key ring password" - property.no"key ring name"""
      "key ring password"Specifies the password for the key ring class used for SSL - communications with the system. This property has no effect unless "secure" - is set to true and a key ring name is set using the "key ring name" - property.no"key ring password"""
      "metadata source"Specifies how to retrieve DatabaseMetaData. If set to "0", database metadata - will be retrieved through the ROI (Retrieve Object Information) data flow. If set to - "1", database metadata will be retrieved by calling system stored procedures.no"0" (ROI access)
      - "1" (SQL stored procedures)
      "0" (V6R1 and earlier) "1" (post V6R1)
      "proxy server"Specifies the host name and port of the middle-tier machine - where the proxy server is running. The format for this is hostname[:port], - where the port is optional. If this is not set, then the hostname and port - are retrieved from the com.ibm.as400.access.AS400.proxyServer property. - The default port is 3470 (if the connection uses SSL, the default - port is 3471). The ProxyServer must be running on the middle-tier - machine. -

      The name of the middle-tier machine is ignored in a two-tier environment.

      -
      noProxy server host name and port(value of the proxyServer property, or none if not set)
      "remarks"Specifies the source of the text for REMARKS columns in ResultSets - returned by DatabaseMetaData methods.no "sql" (SQL object comment)
      - "system" (IBM i object description)
      "system"
      "secondary URL"Specifies the URL to be used for a connection on the middle-tier's - DriverManager in a multiple tier environment, if it is different than already - specified. This property allows you to use this driver to connect to databases - other than DB2 for IBM i. Use a backslash as an escape character - before backslashes and semicolons in the URL.noJDBC URL(current JDBC URL)
      "secure"Specifies whether a Secure Sockets Layer (SSL) connection - is used to communicate with the system.no "true" (encrypt all client/server communication)
      - "false" (encrypt only the password)
      "false"
      "server - trace"Specifies the level of tracing of the JDBC server job. When - tracing is enabled, tracing starts when the client connects to the system - and ends when the connection is disconnected. You must start tracing before - connecting to the system, because the client enables system tracing only - at connect time. no -

      "0" (trace is not active)
      - "2" (start the database monitor on the JDBC server job)
      - "4" (start debug on the JDBC server job)
      - "8" (save the job log when the JDBC server job ends)
      - "16" (start job trace on the JDBC server job)
      - "32" (save SQL information)
      - "64" (start the database host server trace)

      -

      Multiple types of trace can be started by adding these values together. - For example, "6" starts the database monitor and starts debug. -

      -
      "0"
      "thread used"Specifies whether threads should be used in communication - with the host servers.no"true"
      - "false"
      "true"
      "toolbox trace"Specifies what category of a toolbox trace to log. Trace - messages are useful for debugging programs that call JDBC. However, there - is a performance penalty associated with logging trace messages, so this - property should only be set for debugging. Trace messages - are logged to System.out.no""
      - "none"
      - "datastream" (log data flow between the local host and the remote system)
      - "diagnostic" (log object state information)
      - "error" (log errors that cause an exception)
      - "information" (used to track the flow of control through the code)
      - "warning" (log errors that are recoverable)
      - "conversion" (log character set conversions between Unicode and native code pages)
      - "proxy" (log data flow between the client and the proxy server)
      - "pcml" (used to determine how PCML interprets the data that is sent to and from the system)
      - "jdbc" (log jdbc information)
      - "all" (log all categories)
      - "thread" (log thread information)
      -
      ""
      "trace"Specifies whether trace messages should be logged. Trace - messages are useful for debugging programs that call JDBC. However, there - is a performance penalty associated with logging trace messages, so this - property should only be set to "true" for debugging. Trace messages - are logged to System.out.no"true"
      - "false"
      "false"
      "translate binary"Specifies whether binary data is translated. If this property - is set to "true", then BINARY and VARBINARY fields are treated - as CHAR and VARCHAR fields.no"true"
      - "false"
      "false"
      "translate boolean"Specifies how Boolean objects are interpreted when setting the value - for a character field/parameter using the PreparedStatement.setObject(), - CallableStatement.setObject() or ResultSet.updateObject() methods. Setting the - property to "true", would store the Boolean object in the character field as either - "true" or "false". Setting the property to "false", would store the Boolean object - in the character field as either "1" or "0".no"true"
      - "false"
      "true"
      - - - diff --git a/cvsroot/src/com/ibm/as400/access/doc-files/LDRWExample.html b/cvsroot/src/com/ibm/as400/access/doc-files/LDRWExample.html deleted file mode 100644 index a9fed2109..000000000 --- a/cvsroot/src/com/ibm/as400/access/doc-files/LDRWExample.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - -IBM Toolbox for Java Example: Using LineDataRecordWriter - - - - -

      Example: Using LineDataRecordWriter to create a line data spooled file

      -

      Note: Read the Code example disclaimer -for important legal information. -

      - -
      /////////////////////////////////////////////////////////////////////
      -//
      -// LineDataRecordWriter example.  This program uses the line data
      -// record writer access class to create a line data spooled file
      -// on the system.
      -//
      -// This source is an example of using the IBM Toolbox for Java
      -// "LineDataRecordWriter" class.
      -//
      -////////////////////////////////////////////////////////////////////////
      -
      -import com.ibm.as400.access.*;
      -import java.io.*;
      -import java.math.BigDecimal;
      -   
      -public class TestA {
      -
      -    //Private 
      -    private static int ccsid_           = -1;       // local ccsid variable
      -    private static AS400 system_        = null;     // the system
      -    private static SequentialFile file_ = null;     // the file
      -
      -    /**
      -     **  Create the record field descriptions and record format.
      -     **/
      -    public static RecordFormat initializeRecordFormat()
      -    {
      -        // Create the record format. 
      -        RecordFormat qcustcdt = new RecordFormat();
      -        
      -        // Create record field descriptions for the record format.
      -        ZonedDecimalFieldDescription customerNumber =
      -                          new ZonedDecimalFieldDescription(new AS400ZonedDecimal(6,0),
      -                                                           "CUSNUM");
      -        CharacterFieldDescription lastName =
      -                          new CharacterFieldDescription(new AS400Text(8, ccsid_, system_), "LSTNAM");
      -
      -        CharacterFieldDescription initials =
      -                          new CharacterFieldDescription(new AS400Text(3, ccsid_, system_), "INIT");
      -
      -        CharacterFieldDescription street =
      -                          new CharacterFieldDescription(new AS400Text(13, ccsid_, system_), "STREET");
      -
      -        CharacterFieldDescription city =
      -                          new CharacterFieldDescription(new AS400Text(6, ccsid_, system_), "CITY");
      -
      -        CharacterFieldDescription state =
      -                          new CharacterFieldDescription(new AS400Text(2, ccsid_, system_), "STATE");
      -
      -        ZonedDecimalFieldDescription zipCode =
      -                          new ZonedDecimalFieldDescription(new AS400ZonedDecimal(5,0),
      -                                                           "ZIPCOD");
      -        ZonedDecimalFieldDescription creditLimit =
      -                          new ZonedDecimalFieldDescription(new AS400ZonedDecimal(4,0),
      -                                                           "CDTLMT");
      -        ZonedDecimalFieldDescription chargeCode =
      -                          new ZonedDecimalFieldDescription(new AS400ZonedDecimal(1,0),
      -                                                           "CHGCOD");
      -        ZonedDecimalFieldDescription balanceDue =
      -                          new ZonedDecimalFieldDescription(new AS400ZonedDecimal(6,2),
      -                                                           "BALDUE");
      -        ZonedDecimalFieldDescription creditDue =
      -                          new ZonedDecimalFieldDescription(new AS400ZonedDecimal(6,2),
      -                                                           "CDTDUE");
      -      
      -        // assign constants from FieldDescription class
      -        int justLeft = FieldDescription.ALIGN_LEFT;
      -        int justRight = FieldDescription.ALIGN_RIGHT;
      -       
      -        // set the length and alignment attributes for writing the fields
      -        // The length indicates how many characters the field is, and
      -        // justification indicates where in the layout field the data
      -        // should be placed.
      -        customerNumber.setLayoutAttributes(10,justLeft);
      -        lastName.setLayoutAttributes(10,justLeft);
      -        initials.setLayoutAttributes(4,justLeft);
      -        street.setLayoutAttributes(15,justLeft);
      -        city.setLayoutAttributes(10,justLeft);
      -        state.setLayoutAttributes(3,justLeft);
      -        zipCode.setLayoutAttributes(5,justLeft);
      -        creditLimit.setLayoutAttributes(10,justRight);
      -        chargeCode.setLayoutAttributes(3,justRight);
      -        balanceDue.setLayoutAttributes(10,justRight);
      -        creditDue.setLayoutAttributes(10,justRight);
      -
      -        // set the record format ID
      -        String d = "CUSTRECID";
      -        qcustcdt.setRecordFormatID(d);
      -        
      -        // if this were a variable field length record,
      -        // we would set the type and delimiter accordingly.  We
      -        // also would not have needed to specify layoutLength and
      -        // layoutAlignment values.
      -        // qcustcdt.setRecordFormatType(RecordFormat.VARIABLE_LAYOUT_LENGTH);
      -        // qcustcdt.setDelimiter(';');
      - 
      -        // set the record type to fixed field length 
      -        qcustcdt.setRecordFormatType(RecordFormat.FIXED_LAYOUT_LENGTH);
      -        
      -        // add the field descriptions to the record format.
      -        qcustcdt.addFieldDescription(customerNumber);
      -        qcustcdt.addFieldDescription(lastName);
      -        qcustcdt.addFieldDescription(initials);
      -        qcustcdt.addFieldDescription(street);
      -        qcustcdt.addFieldDescription(city);
      -        qcustcdt.addFieldDescription(state);
      -        qcustcdt.addFieldDescription(zipCode);
      -        qcustcdt.addFieldDescription(creditLimit);
      -        qcustcdt.addFieldDescription(chargeCode);
      -        qcustcdt.addFieldDescription(balanceDue);
      -        qcustcdt.addFieldDescription(creditDue);
      -        
      -        return qcustcdt;
      -    }
      -
      -
      -    /**
      -     ** Creates the actual record with data
      -     **/
      -    public static void createRecord(Record record)
      -    {
      -        record.setField("CUSNUM", new BigDecimal(323));
      -        record.setField("LSTNAM", "Johnson");
      -        record.setField("INIT", "B E");
      -        record.setField("STREET", "5234 Elm St");
      -        record.setField("CITY", "Rchstr");
      -        record.setField("STATE", "MN");
      -        record.setField("ZIPCOD", new BigDecimal(55901));
      -        record.setField("CDTLMT", new BigDecimal(5000.00));
      -        record.setField("CHGCOD", new BigDecimal(3));
      -        record.setField("BALDUE", new BigDecimal(25.00));
      -        record.setField("CDTDUE", new BigDecimal(0.00));
      -    }
      -   
      -   
      -    public static void main(String[]args) {
      -  
      -        // create an instance of the system
      -        system_ = new AS400("SYSTEMA", "JOE", "PGMR");      
      -  
      -        // create a ccsid
      -        ccsid_ = system_.getCcsid();
      -             
      -        // create output queue and specify spooled file data to be *LINE
      -        OutputQueue outQ = new OutputQueue(system_, "/QSYS.LIB/QUSRSYS.LIB/LDRW.OUTQ");
      -        PrintParameterList parms = new PrintParameterList();
      -        parms.setParameter(PrintObject.ATTR_PRTDEVTYPE, "*LINE");
      -        parms.setParameter(PrintObject.ATTR_PAGDFN,"/QSYS.LIB.QUSRSYS.LIB/LDRW.PAGDFN");
      -        parms.setParameter(PrintObject.ATTR_CONVERT_LINEDATA,"*YES");
      -        
      -      
      -        // initialize the record format for writing data 
      -        RecordFormat recfmt = initializeRecordFormat();
      -        
      -        // create a record and assign data to be printed...
      -        Record record = new Record(recfmt);
      -        createRecord(record);
      -       
      -        SpooledFileOutputStream os = null;
      -        
      -        try { 
      -            // create the output spooled file to hold the record data
      -            os = new SpooledFileOutputStream(system_, parms, null, outQ);   
      -        }
      -        
      -        if (os != null) { // Output stream was created successfully!
      -            LineDataRecordWriter ldw;
      -            try {
      -                // create the line data record writer
      -                ldw = new LineDataRecordWriter(os, ccsid_, system_);
      -                
      -                // write the record of data
      -                ldw.writeRecord(record);
      -            }
      -            catch (IOException e) {
      -                System.out.println("Error occurred writing record data");
      -            }
      -                
      -            // close the output stream (spooled file)
      -            try {
      -                os.close();
      -            }
      -            catch (Exception e) {
      -                System.out.println("Error occurred closing output stream.");
      -            }
      -        }
      -    }
      -}
      - - diff --git a/cvsroot/src/com/ibm/as400/access/doc-files/OutputQueueAttrs.html b/cvsroot/src/com/ibm/as400/access/doc-files/OutputQueueAttrs.html deleted file mode 100644 index 5d7bf9a7b..000000000 --- a/cvsroot/src/com/ibm/as400/access/doc-files/OutputQueueAttrs.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - -IBM Toolbox for Java: Output queue attributes - - - -

      Output Queue Attributes

      - -
      - -

      Retrieve Attributes

      - -

      The following attributes may be retrieved for an output queue using the appropriate - getIntegerAttribute(), getStringAttribute(), or getFloatAttribute() method : - -

      - -
      - -

      Set Attributes

      - -

      Attributes are not allowed to be set for an output queue. - -


      - - - diff --git a/cvsroot/src/com/ibm/as400/access/doc-files/PrintAttributes.html b/cvsroot/src/com/ibm/as400/access/doc-files/PrintAttributes.html deleted file mode 100644 index 1e8a5a04a..000000000 --- a/cvsroot/src/com/ibm/as400/access/doc-files/PrintAttributes.html +++ /dev/null @@ -1,7718 +0,0 @@ - - - - - - - - - IBM Toolbox for Java: Object Keys - - - - - - - - - - - - - - - - - -

      Print Object Attributes

      - - -

      -

      -
      -

      - - -

      Table of Contents

      - - - - - -

      -

      -
      -

      - -

      3812 SCS (Fonts)

      - -
      - -
      ID
      - -
      ATTR_3812SCS
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Whether the spooled file contains fonts supported only on the -3812 printer. Valid values are Y (yes) or N (no).
      - -
      - - -

      -

      -
      -

      - -

      Accounting Code

      - -
      - -
      ID
      - -
      ATTR_ACCOUNT_CODE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      An identifier assigned by the system to record the resources -used to write the spooled file.
      - -
      - - -

      -

      -
      -

      - -

      Advanced Function Printing

      - -
      - -
      ID
      - -
      ATTR_AFP
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Indicates whether this spooled file uses AFP resources external to -the spooled file. Valid values are *YES and *NO.
      - -
      - - -

      -

      -
      -

      - -

      AFP Resource

      - -
      - -
      ID
      - -
      ATTR_AFP_RESOURCE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The Integrated File System path of the external AFP (Advanced Function Print) resource. -The format of the Integrated File System path is "/QSYS.LIB/library.LIB/resource.type" where - library is the library that contains the resource, resource is -the name of the resource and type is the resource type. Valid values -for type include FNTRSC, FORMDF, OVL, PAGSEG, and PAGDFN. -
      - -
      - - -

      -

      -
      -

      - -

      Align Forms

      - -
      - -
      ID
      - -
      ATTR_ALIGNFORMS
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The time at which a forms alignment message will be sent. Valid values are *WTR, *FILE, *FIRST.
      - -
      - - -

      -

      -
      -

      - -

      Align Page

      - -
      - -
      ID
      - -
      ATTR_ALIGN
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Indicates whether a forms alignment message is sent prior to printing -this spooled file. Valid values are *YES, *NO.
      - -
      - - -

      -

      -
      -

      - -

      Allow Direct Print

      - -
      - -
      ID
      - -
      ATTR_ALWDRTPRT
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Indicates whether the printer writer allows the printer to be allocated -to a job that prints directly to a printer. Valid values are *YES, *NO. -
      - -
      - - -

      -

      -
      -

      - -

      ASCII Transparency

      - -
      - -
      ID
      - -
      ATTR_ASCIITRANS
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      For SCS spooled files, whether ASCII commands are embedded in the -spooled file. Valid values are Y (yes) or N (no).
      - -
      - - -

      -

      -
      -

      - -

      Authority

      - -
      - -
      ID
      - -
      ATTR_AUT
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Specifies the authority that is given to users who do not have specific -authority to the output queue. Valid values are *USE, *ALL, *CHANGE, *EXCLUDE, -*LIBCRTAUT.
      - -
      - - -

      -

      -
      -

      - -

      Authority to Check

      - -
      - -
      ID
      - -
      ATTR_AUTCHK
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Indicates what type of authorities to the output queue allow the user -to control all the files on the output queue. Valid values are *OWNER, -*DTAAUT.
      - -
      - - -

      -

      -
      -

      - -

      Automatically End Writer

      - -
      - -
      ID
      - -
      ATTR_AUTOEND
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Specifies if the writer should be automatically ended. Valid values -are *NO, *YES.
      - -
      - - -

      -

      -
      -

      - -

      Auxiliary Storage Pool

      - -
      - -
      ID
      - -
      ATTR_AUX_POOL
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      Specifies the number of the auxiliary storage pool (ASP) that the spooled file is stored on. -The possible values are: -
        - -
      • 1: System ASP
      • - -
      • 2-32: One of the user ASPs
      • - -
      - -
      -
      - - -

      -

      -
      -

      - -

      Auxiliary Storage Pool Device Name

      - -
      - -
      ID
      - -
      ATTR_ASPDEVICE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the auxiliary storage pool (ASP) device -that the spooled file is stored on. Valid values are -*SYSBAS or a specific auxiliary storage pool device name.
      - -
      - - -

      -

      -
      -

      - -

      Back Margin Offset Across

      - -
      - -
      ID
      - -
      ATTR_BKMGN_ACR
      - -
      Type
      - -
      Float
      - -
      Description
      - -
      For the back side of a piece of paper, it specifies, how far in from -the left side of the page printing starts. The special value *FRONTMGN -is encoded as -1.0.
      - -
      - - -

      -

      -
      -

      - -

      Back Margin Offset Down

      - -
      - -
      ID
      - -
      ATTR_BKMGN_DWN
      - -
      Type
      - -
      Float
      - -
      Description
      - -
      For the back side of a piece of paper, it specifies, how far down from -the top of the page printing starts. The special value *FRONTMGN is -encoded as -1.
      - -
      - - -

      -

      -
      -

      - -

      Back Overlay

      - -
      - -
      ID
      - -
      ATTR_BACK_OVERLAY
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The Integrated File System path of the back overlay or a special value. If the value is an - Integrated File System path it will have the format "/QSYS.LIB/library.LIB/overlay.OVL" where - library is the library of the resource and overlay is the - name of the overlay. - Valid special values include *FRONTOVL. -
      - -
      - - -

      -

      -
      -

      - -

      Back Overlay Offset Across

      - -
      - -
      ID
      - -
      ATTR_BKOVL_ACR
      - -
      Type
      - -
      Float
      - -
      Description
      - -
      The offset across from the point of origin where the overlay is printed.
      - -
      - - -

      -

      -
      -

      - -

      Back Overlay Offset Down

      - -
      - -
      ID
      - -
      ATTR_BKOVL_DWN
      - -
      Type
      - -
      Float
      - -
      Description
      - -
      The offset down from the point of origin where the overlay is printed. -
      - -
      - - -

      -

      -
      -

      - -

      Barcode

      - -
      - -
      ID
      - -
      ATTR_BARCODE
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Whether the spooled file contains bar codes created using -the BARCODE keyword in the data description specifications -(DDS). Valid values are Y (yes) or N (no).
      - -
      - - -

      -

      -
      -

      - -

      Between Copies Status

      - -
      - -
      ID
      - -
      ATTR_BTWNCPYSTS
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether or not the writer is between copies of a multiple copy spooled file. Returned -values are *YES or *NO.
      - -
      - - -

      -

      -
      -

      - -

      Between Files Status

      - -
      - -
      ID
      - -
      ATTR_BTWNFILESTS
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether or not the writer is between files. Returned values are *YES or *NO.
      - -
      - - -

      -

      -
      -

      - -

      Changes

      - -
      - -
      ID
      - -
      ATTR_CHANGES
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The time at which pending changes take effect. Valid values are -*NORDYF, *FILEEND, or blank which implies no changes pending to the -writer.
      - -
      - - -

      -

      -
      -

      - -

      Character ID

      - -
      - -
      ID
      - -
      ATTR_CHARID
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Whether the character ID can change within the spooled file. Valid -values are Y (yes) or N (no).
      - -
      - - -

      -

      -
      -

      - -

      Character Set Library Name

      - -
      - -
      ID
      - -
      ATTR_CHRSET_LIB
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the library containing the font character set -object. Valid values are *LIBL or a specific library name.
      - -
      - - -

      -

      -
      -

      - -

      Character Set Name

      - -
      - -
      ID
      - -
      ATTR_CHRSET
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the font character set object used to print the -spooled file. Valid values are *FONT or a specific font character -set name.
      - -
      - - -

      -

      -
      -

      - -

      Character Set Point Size

      - -
      - -
      ID
      - -
      ATTR_CHRSET_SIZE
      - -
      Type
      - -
      Float
      - -
      Description
      - -
      The point size in which to print the spooled file's character data. - Valid values are from 000.1 to 999.0. Value 000.0 represents *NONE, - the character set does not have a point size. -
      - -
      - - -

      -

      -
      -

      - -

      Characters Per Inch

      - -
      - -
      ID
      - -
      ATTR_CPI
      - -
      Type
      - -
      Float
      - -
      Description
      - -
      The number of characters per horizontal inch.
      - -
      - - -

      -

      -
      -

      - -

      Characters Per Inch Changes

      - -
      - -
      ID
      - -
      ATTR_CPI_CHANGES
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Whether the spooled file changes the characters per inch -(cpi) within the file. Valid values are Y (yes) or N (no).
      - -
      - - -

      -

      -
      -

      - -

      Code Page

      - -
      - -
      ID
      - -
      ATTR_CODEPAGE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The mapping of graphic characters to code points for this spooled file. - If the graphic character set field contains a special value, this field - may contain a zero (0). -
      - -
      - - -

      -

      -
      -

      - -

      Code Page Library Name

      - -
      - -
      ID
      - -
      ATTR_CODEPAGE_NAME_LIB
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the library containing the code page used to print - this spooled file. Valid values are *LIBL or a specific library - name. -
      - -
      - - -

      -

      -
      -

      - -

      Code Page Name

      - -
      - -
      ID
      - -
      ATTR_CODEPAGE_NAME
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the code page used to print this spooled file.
      - -
      - - -

      -

      -
      -

      - -

      Coded Font Array

      - -
      - -
      ID
      - -
      ATTR_CODFNT_ARRAY
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the fonts used for printing spooled files - containing line data. This corresponds to the CHARS parameter - of MVS and VM printing services. A maximum of 4 four-character-coded - font names are returned. -
      - -
      - - -

      -

      -
      -

      - -

      Coded Font Library Name

      - -
      - -
      ID
      - -
      ATTR_CODEDFNTLIB
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the library that contains the coded font. This field may - contain blanks if the coded font name field has a special value. -
      - -
      - - -

      -

      -
      -

      - -

      Coded Font Name

      - -
      - -
      ID
      - -
      ATTR_CODEDFNT
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the coded font. A coded font is an AFP resource that is -composed of a character set and a code page. Special values include *FNTCHRSET. -
      - -
      - - -

      -

      -
      -

      - -

      Coded Font Point Size

      - -
      - -
      ID
      - -
      ATTR_CODEDFONT_SIZE
      - -
      Type
      - -
      Float
      - -
      Description
      - -
      The point size in which to print the spooled file's character data. - Valid values are from 000.1 to 999.0. Value 000.0 represents *NONE, - the coded font does not have a point size. -
      - -
      - - -

      -

      -
      -

      - -

      Color

      - -
      - -
      ID
      - -
      ATTR_COLOR
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Whether the spooled file contains data stream commands requesting - color. Valid values are Y (yes) or N (no). -
      - -
      - - -

      -

      -
      -

      - -

      Constant Back Overlay

      - -
      - -
      ID
      - -
      ATTR_CONSTBCK_OVL
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Whether or not constant back overlay is used. Constant back overlay -allows the user to print overlays on the back side of each sheet of -media without the need for the print application to generate print blank -pages. Valid values are "0" (*NOCONSTANT) or "1" (*CONSTANT).
      - -
      - - -

      -

      -
      -

      - -

      Control Character

      - -
      - -
      ID
      - -
      ATTR_CONTROLCHAR
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether this file uses the American National Standards printer -control character. The possible values are *NONE for no print control -characters are passed in the data that is printed or *FCFC which means -that the first character of every record is an American National -Standards printer control character.
      - -
      - - -

      -

      -
      -

      - -

      Convert Line Data

      - -
      - -
      ID
      - -
      ATTR_CONVERT_LINEDATA
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether the line data is converted to AFPDS before it is written to spool. The possible values are *NO and *YES.
      - -
      - - -

      -

      -
      -

      - -

      Copies

      - -
      - -
      ID
      - -
      ATTR_COPIES
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The total number of copies to be produced for this spooled file.
      - -
      - - -

      -

      -
      -

      - -

      Copies Left to Produce

      - -
      - -
      ID
      - -
      ATTR_COPIESLEFT
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The remaining number of copies to be produced for this spooled file. -
      - -
      - - -

      -

      -
      -

      - -

      Corner Staple

      - -
      - -
      ID
      - -
      ATTR_CORNER_STAPLE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The reference corner to be used for a corner staple. A staple is -driven into the media at the reference corner. Valid values are *NONE, -*DEVD, *BOTRIGHT, *TOPRIGHT, *TOPLEFT, and *BOTLEFT. -
      -
      - - -

      -

      -
      -

      - -

      Current Page

      - -
      - -
      ID
      - -
      ATTR_CURPAGE
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      Current page that is being written by the writer job.
      - -
      - - -

      -

      -
      -

      - -

      Data Format

      - -
      - -
      ID
      - -
      ATTR_DATAFORMAT
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Data format. Valid values are *RCDDATA, *ALLDATA.
      - -
      - - -

      -

      -
      -

      - -

      Data Queue

      - -
      - -
      ID
      - -
      ATTR_DATA_QUEUE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Specifies the Integrated File System path of the data queue that is associated with the output -queue or "*NONE" if no data queue is associated with the the output queue. The -format of the Integrated File System path is "/QSYS.LIB/library.LIB/dataqueue.DTAQ" where library -is the library that contains the data queue and dataqueue is the name of -the data queue. -
      - -
      - - -

      -

      -
      -

      - -

      Date File Last Used

      - -
      - -
      ID
      - -
      ATTR_DATE_USED
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The date the spooled file data was last displayed, copied, -printed or sent; or when the spooled file attributes were last -changed. -The date format is CYYMMDD, where C=century (0=19XX, 1=20XX), -YY=year, MM=month, and DD=day.
      - -
      - - -

      -

      -
      -

      - -

      Date File Opened (created)

      - -
      - -
      ID
      - -
      ATTR_DATE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      For spooled files this is the date the spooled file was opened. -For AFP resources this is the date the object was last modified. -The date format is CYYMMDD, where C=century (0=19XX, 1=20XX), -YY=year, MM=month, and DD=day.
      - -
      - - -

      -

      -
      -

      - -

      Date Writer Began Processing Spooled File

      - -
      - -
      ID
      - -
      ATTR_DATE_WTR_BEGAN_FILE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Indicates the date at which the writer began processing this spooled file. - The date format is CYYMMDD, where C=century (0=19XX, 1=20XX), - YY=year, MM=month, and DD=day. -
      - -
      - - -

      -

      -
      -

      - -

      Date Writer Completed Processing Spooled File

      - -
      - -
      ID
      - -
      ATTR_DATE_WTR_CMPL_FILE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Indicates the date at which the writer finished this spooled file. - The date format is CYYMMDD, where C=century (0=19XX, 1=20XX), - YY=year, MM=month, and DD=day. -
      - -
      - - -

      -

      -
      -

      - -

      User Specified DBCS Data

      - -
      - -
      ID
      - -
      ATTR_DBCSDATA
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether the spooled file contains double-byte character set (DBCS) - data. Valid values are *NO and *YES. -
      - -
      - - -

      -

      -
      -

      - -

      DBCS Extension Characters

      - -
      - -
      ID
      - -
      ATTR_DBCSEXTENSN
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether the system is to process the DBCS extension characters. Valid - values are *NO and *YES. -
      - -
      - - -

      -

      -
      -

      - -

      DBCS Character Rotation

      - -
      - -
      ID
      - -
      ATTR_DBCSROTATE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether the DBCS characters are rotated 90 degrees counterclockwise - before printing. Valid values are *NO and *YES. -
      - -
      - - -

      -

      -
      -

      - -

      DBCS Characters Per Inch

      - -
      - -
      ID
      - -
      ATTR_DBCSCPI
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The number of double-byte characters to be printed per inch. Valid - values are -1, -2, 5, 6, and 10. The value *CPI is encoded as -1. The value - *CONDENSED is encoded as -2. -
      - -
      - - - -

      -

      -
      -

      - -

      DBCS Coded Font Library Name

      - -
      - -
      ID
      - -
      ATTR_DBCS_FNT_LIB
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the library containing the DBCS coded font. Valid values - are *CURLIB, *LIBL, and a specific library name. -
      - -
      - - -

      -

      -
      -

      - -

      DBCS Coded Font Name

      - -
      - -
      ID
      - -
      ATTR_DBCS_FNT
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the DBCS coded font used to print DBCS coded - data on printers configured as AFP(*YES). Valid values are - *SYSVAL or a specific DBCS coded font. -
      - -
      - - -

      -

      -
      -

      - -

      DBCS Coded Font Point Size

      - -
      - -
      ID
      - -
      ATTR_DBCS_FNT_SIZE
      - -
      Type
      - -
      Float
      - -
      Description
      - -
      The point size in which to print the spooled file's character data. - Valid values are from 000.1 to 999.0. Value 000.0 represents *NONE, - the DBCS coded font does not have a point size. -
      - -
      - - -

      -

      -
      -

      - -

      DBCS SO/SI Spacing

      - -
      - -
      ID
      - -
      ATTR_DBCSSISO
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Determines the presentation of shift-out and shift-in characters when - printed. Valid values are *NO, *YES, and *RIGHT. -
      - -
      - - -

      -

      -
      -

      - -

      DDS (Data description specifications)

      - -
      - -
      ID
      - -
      ATTR_DDS
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Whether the spooled file was created with data description - specifications (DDS). Valid values are Y (yes) or N (no). -
      - -
      - - -

      -

      -
      -

      - -

      Decimal Format

      - -
      - -
      ID
      - -
      ATTR_DECIMAL_FMT
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether the decimal format from the DECFMT job attribute or - from the printer file was used when the spooled file was - created. Valid values are *FILE or *JOB. -
      - -
      - - -

      -

      -
      -

      - -

      Defer Write

      - -
      - -
      ID
      - -
      ATTR_DFR_WRITE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether print data is held in system buffers before
      - -
      - - -

      -

      -
      -

      - -

      Double Wide Characters

      - -
      - -
      ID
      - -
      ATTR_DOUBLEWIDE
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      For SCS spooled files, whether the characters are printed - twice as wide as normal. Valid values are Y (yes) or N (no). -
      - -
      - - -

      -

      -
      -

      - -

      Drawer Change

      - -
      - -
      ID
      - -
      ATTR_DRAWERCHANGE
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Whether the printer drawer is changed within the spooled - file. Valid values are Y (yes) or N (no). -
      - -
      - - -

      -

      -
      -

      - -

      Degree of Page Rotation

      - -
      - -
      ID
      - -
      ATTR_PAGRTT
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The degree of rotation of the text on the page, with respect to the -way the form is loaded into the printer. Valid values are -1, -2, -3, 0, -90, 180, 270. The value *AUTO is encoded as -1, the value *DEVD is encoded -as -2, and the value *COR is encoded as -3.
      - -
      - - -

      -

      -
      -

      - -

      Delete File After Sending

      - -
      - -
      ID
      - -
      ATTR_DELETESPLF
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Delete the spooled file after sending? Valid values are *NO and *YES. -
      - -
      - - -

      -

      -
      -

      - -

      Destination Option

      - -
      - -
      ID
      - -
      ATTR_DESTOPTION
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Destination option. A text string that allows the user to pass options -to the receiving system.
      - -
      - - -

      -

      -
      -

      - -

      Destination Type

      - -
      - -
      ID
      - -
      ATTR_DESTINATION
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Destination type. Valid values are *OTHER, *AS400, *PSF2.
      - -
      - - -

      -

      -
      -

      - -

      Device Class

      - -
      - -
      ID
      - -
      ATTR_DEVCLASS
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The device class.
      - -
      - - -

      -

      -
      -

      - -

      Device Model

      - -
      - -
      ID
      - -
      ATTR_DEVMODEL
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The model number of the device.
      - -
      - - -

      -

      -
      -

      - -

      Device Status

      - -
      - -
      ID
      - -
      ATTR_DEVSTATUS
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The status of the printer device. Valid values are 0 (varied -off), 10 (vary off pending), 20 (vary on pending), 30 (varied on), 40 -(connect pending), 60 (active), 66 (active writer), 70 (held), 75 -(powered off), 80 (recovery pending), 90 (recovery canceled), 100 -(failed), 106 (failed writer), 110 (being serviced), 111 (damaged), 112 -(locked), 113 (unknown).
      - -
      - - -

      -

      -
      -

      - -

      Device Type

      - -
      - -
      ID
      - -
      ATTR_DEVTYPE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Specifies the type of printer configured in the device -description (Printer object). Valid values are 3287, 3812, -4214, 4234, 4245, 4247, 5219, 5224, 5225, 5256, 5262, -5553, 5583, 6252, 6404, 6408, 6412, *IPDS.
      - -
      - - -

      -

      -
      -

      - -

      Display any File

      - -
      - -
      ID
      - -
      ATTR_DISPLAYANY
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether users who have authority to read this output queue can display -the output data of any output file on this queue or only the data in their -own files. Valid values are *YES, *NO, *OWNER.
      - -
      - - -

      -

      -
      -

      - -

      Days Until File Expires

      - -
      - -
      ID
      - -
      ATTR_DAYS_UNTIL_EXPIRE
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      Specifies the number of days to keep the spooled file.
      - -
      - - -

      -

      -
      -

      - -

      Drawer for Separators

      - -
      - -
      ID
      - -
      ATTR_DRWRSEP
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      Identifies the drawer from which the job and file separator pages are -to be taken. Valid values are -1, -2, 1, 2, 3. The value *FILE is encoded -as -1, and the value *DEVD is encoded as -2.
      - -
      - - -

      -

      -
      -

      - -

      Edge Stitch Number of Staples

      - -
      - -
      ID
      - -
      ATTR_EDGESTITCH_NUMSTAPLES
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The number of staples that are applied along the finishing operation axis.
      - -
      - - -

      -

      -
      -

      - -

      Edge Stitch Reference Edge

      - -
      - -
      ID
      - -
      ATTR_EDGESTITCH_REF
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Where one or more staples are driven into the media along the -finishing operation axis. Valid values are *NONE, *DEVD, *BOTTOM, -*RIGHT, *TOP, and *LEFT.
      - -
      - - -

      -

      -
      -

      - -

      Edge Stitch Reference Offset

      - -
      - -
      ID
      - -
      ATTR_EDGESTITCH_REFOFF
      - -
      Type
      - -
      Float
      - -
      Description
      - -
      The offset of the edge stitch from the reference edge toward the center of the media.
      - -
      - - -

      -

      -
      -

      - -

      End Pending Status

      - -
      - -
      ID
      - -
      ATTR_ENDPNDSTS
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether an End Writer (ENDWTR) command has been issued for this writer. Possible -values are *NO - no ENDWTR command was issued, *IMMED - the writer ends as soon as its -output buffers are empty, *CTRLD - the writer ends after the current copy of the spooled -file has printed, *PAGEEND - the writer ends at the end of the page.
      - -
      - - -

      -

      -
      -

      - -

      Ending Page

      - -
      - -
      ID
      - -
      ATTR_ENDPAGE
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The page number at which to end printing the spooled file. Valid values -are 0 or the ending page number. The value *END is encoded as 0.
      - -
      - - -

      -

      -
      -

      - -

      Envelope Source

      - -
      - -
      ID
      - -
      ATTR_ENVLP_SOURCE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The size of the envelope in the envelope source. If this field -is not specified or the value is not valid, the special value of *MFRTYPMDL -is used. Valid values are *NONE - there is no envelope source, -*MFRTYPMDL - the envelope size suggested by the manufacturer type -and model is used, *MONARCH (3.875 x 7.5 inches), *NUMBER9 (3.875 x 8.875 inches), -*NUMBER10 (4.125 x 9.5 inches), *B5 (176mm x 250mm), -*C5 (162mm x 229mm), *DL (110mm x 220mm).
      - -
      - - -

      -

      -
      -

      - -

      Expiration Date

      - -
      - -
      ID
      - -
      ATTR_EXPIRATION_DATE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The date the spooled file will be eligible for removal from the system -by the Delete Expired Spooled Files (DLTEXPSPLF) command. If this value is -blank the file will not expire. The spooled file expires at 23:59:59, -system local time on the date specified. The date format is CYYMMDD, -where C=century (0=19XX, 1=20XX), YY=year, MM=month, and DD=day.
      - -
      - - -

      -

      -
      -

      - -

      Field Outlining

      - -
      - -
      ID
      - -
      ATTR_FIELD_OUTLIN
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Whether the spooled file outlines fields of data with -boxes. Valid values are Y (yes) or N (no).
      - -
      - - - -

      -

      -
      -

      - -

      File Separators

      - -
      - -
      ID
      - -
      ATTR_FILESEP
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The number of file separator pages that are placed at the beginning -of each copy of the spooled file. Valid values are -1, or the number of -separators. The value *FILE is encoded as -1.
      - -
      - - -

      -

      -
      -

      - -

      Fold Records

      - -
      - -
      ID
      - -
      ATTR_FOLDREC
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether records that exceed the printer forms width are folded (wrapped) -to the next line. Valid values are *YES, *NO.
      - -
      - - -

      -

      -
      -

      - -

      Font Changes

      - -
      - -
      ID
      - -
      ATTR_FONT_CHANGES
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Whether the spooled file uses multiple fonts. Valid -values are Y (yes) or N (no).
      - -
      - - -

      -

      -
      -

      - -

      Font Identifier

      - -
      - -
      ID
      - -
      ATTR_FONTID
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The printer font that is used. Valid special values include *CPI and -*DEVD.
      - -
      - - -

      -

      -
      -

      - -

      Font Resolution for Formatting

      - -
      - -
      ID
      - -
      ATTR_FONTRESFMT
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The font resolution Print Services Facility (PSF) should -try to use when printing the spooled file. Valid values are -*DEVD, *SEARCH, 240, or 300.
      - -
      - - -

      -

      -
      -

      - -

      Form Definition

      - -
      - -
      ID
      - -
      ATTR_FORM_DEFINITION
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The Integrated File System path name of the form definition or a special value. - If an Integrated File System path is specified the format is "/QSYS.LIB/library.LIB/formdef.FORMDF" - where library is the library of the form definition and - formdef is the name of the form definition. - Valid special values include *NONE, *INLINE, *INLINED, and *DEVD. -
      - -
      - - -

      -

      -
      -

      - -

      Form Feed

      - -
      - -
      ID
      - -
      ATTR_FORMFEED
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The manner in which forms feed to the printer. Valid values are *CONT, -*CUT, *AUTOCUT, *DEVD.
      - -
      - - -

      -

      -
      -

      - -

      Form Type

      - -
      - -
      ID
      - -
      ATTR_FORMTYPE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The type of form to be loaded in the printer to print this spooled -file.
      - -
      - - -

      -

      -
      -

      - -

      Form Type Message Option

      - -
      - -
      ID
      - -
      ATTR_FORMTYPEMSG
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Message option for sending a message to the writer's message queue -when the current form type is finished. Valid values are *MSG, *NOMSG, -*INFOMSG, *INQMSG.
      - -
      - - -

      -

      -
      -

      - -

      Front Margin Offset Across

      - -
      - -
      ID
      - -
      ATTR_FTMGN_ACR
      - -
      Type
      - -
      Float
      - -
      Description
      - -
      For the front side of a piece of paper, it specifies, how far in from -the left side of the page printing starts. The special value *DEVD is encoded -as -2.0.
      - -
      - - -

      -

      -
      -

      - -

      Front Margin Offset Down

      - -
      - -
      ID
      - -
      ATTR_FTMGN_DWN
      - -
      Type
      - -
      Float
      - -
      Description
      - -
      For the front side of a piece of paper, it specifies, how far down -from the top of the page printing starts. The special value *DEVD is encoded -as -2.
      - -
      - - -

      -

      -
      -

      - - -

      Front Overlay

      - - -
      - -
      ID
      - - -
      ATTR_FRONT_OVERLAY
      - - -
      Type
      - - -
      String
      - - -
      Description
      - - -
      The Integrated File System path of the front overlay. The format of the Integrated File System path is - "/QSYS.LIB/library.LIB/overlay.OVL" where - library is the library of the resource and overlay is the - name of the overlay. - The string *NONE is used to indicate that no front overlay is specified. -
      - -
      - - -

      -

      -
      -

      - -

      Front Overlay Offset Across

      - -
      - -
      ID
      - -
      ATTR_FTOVL_ACR
      - -
      Type
      - -
      Float
      - -
      Description
      - -
      The offset across from the point of origin where the overlay is printed. -
      - -
      - - -

      -

      -
      -

      - -

      Front Overlay Offset Down

      - -
      - -
      ID
      - -
      ATTR_FTOVL_DWN
      - -
      Type
      - -
      Float
      - -
      Description
      - -
      The offset down from the point of origin where the overlay is printed. -
      - -
      - - -

      -

      -
      -

      - -

      Graphic Character Set

      - -
      - -
      ID
      - -
      ATTR_CHAR_ID
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The set of graphic characters to be used when printing this file. Valid -special values include *DEVD, *SYSVAL, and *JOBCCSID.
      - -
      - - -

      -

      -
      -

      - -

      Graphics

      - -
      - -
      ID
      - -
      ATTR_GRAPHICS
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Whether the spooled file contains graphics. Valid -values are Y (yes) or N (no).
      - -
      - - -

      -

      -
      -

      - -

      Graphics Token

      - -
      - -
      ID
      - -
      ATTR_GRAPHICS_TOK
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The printer type on which graphics in the spooled file can be -printed. Valid values are 4214, 4234, 522X, or IPDS.
      - -
      - - -

      -

      -
      -

      - -

      Group Level Index Tags

      - -
      - -
      ID
      - -
      ATTR_GRPLVL_IDXTAG
      - -
      Type
      - -
      String (One character)
      - -
      Description
      - -
      Whether the spooled file contains group level index tags as -indicated by the DDS keyword DOCIDXTAG with a tag level of GROUP. -Valid values are Y (yes) or N (no).
      - -
      - - -

      -

      -
      -

      - -

      Justification

      - -
      - -
      ID
      - -
      ATTR_JUSTIFY
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The percentage that the output is right justified. Valid values are -0, 50, 100.
      - -
      - - -

      -

      -
      -

      - -

      Held Status

      - -
      - -
      ID
      - -
      ATTR_HELDSTS
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether the writer is held. Valid values are *YES, *NO.
      - -
      - - -

      -

      -
      -

      - -

      Highlight

      - -
      - -
      ID
      - -
      ATTR_HIGHLIGHT
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Whether the spooled file contains character data that is -to appear darker than the surrounding character data. Valid -values are Y (yes) or N (no).
      - -
      - - -

      -

      -
      -

      - -

      Hold Spool File

      - -
      - -
      ID
      - -
      ATTR_HOLD
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether the spooled file is held. Valid values are *YES, *NO.
      - -
      - - -

      -

      -
      -

      - -

      Hold Pending Status

      - -
      - -
      ID
      - -
      ATTR_HOLDPNDSTS
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether a Hold Writer (HLDWTR) command has been issued for this writer. Possible values -are *NO - no HLDWTR command was issued, *IMMED - the writer is held when its output buffers -are empty, *CTRLD - writer held after the current copy of the spooled file has printed, -*PAGEEND - writer held at the end of the page.
      - -
      - - -

      -

      -
      -

      - -

      Image Configuration

      - -
      - -
      ID
      - -
      ATTR_IMGCFG
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The transform services for a variety of image and print data-stream formats.
      - -
      - - - -

      -
      -

      - -

      Initialize the Writer

      - -
      - -
      ID
      - -
      ATTR_WTRINIT
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The user can specify when to initialize the printer device. Valid values -are *WTR, *FIRST, *ALL.
      - -
      - - -

      -

      -
      -

      - -

      Internet Address

      - -
      - -
      ID
      - -
      ATTR_INTERNETADDR
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The internet address of the receiving system.
      - -
      - - -

      -

      -
      -

      - -

      IPDS Pass-Through

      - -
      - -
      ID
      - -
      ATTR_IPDSPASSTHRU
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Specifies whether IPDS pass-through is done for the spooled file. - Valid values are 0 (*DEVD), 1 (*NO), or 2 (*YES). -
      - -
      - - -

      -

      -
      -

      - -

      IPP Attributes CCSID

      - -
      - -
      ID
      - -
      ATTR_IPP_ATTR_CCSID
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      Indicates the CCSID of the IPP specified spooled file attributes.
      - -
      - - -

      -

      -
      -

      - -

      IPP Attributes Natural Language

      - -
      - -
      ID
      - -
      ATTR_IPP_ATTR_NL
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Indicates the natural language of the IPP specified spooled - file attributes. For example 'en' English or 'fr' French. -
      - -
      - - -

      -

      -
      -

      - -

      IPP Job ID

      - -
      - -
      ID
      - -
      ATTR_IPP_JOB_ID
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      IPP Job ID relative to the IPP printer that created the job.
      - -
      - - -

      -

      -
      -

      - -

      IPP Job Name

      - -
      - -
      ID
      - -
      ATTR_IPP_JOB_NAME
      - -
      Type
      - -
      String
      - -
      Description
      - -
      User friendly name of job.
      - -
      - - -

      -

      -
      -

      - -

      IPP Job Name NL

      - -
      - -
      ID
      - -
      ATTR_IPP_JOB_NAME_NL
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Natural language of job name.
      - -
      - - - -

      -

      -
      -

      - -

      IPP Job Originating User Name

      - -
      - -
      ID
      - -
      ATTR_IPP_JOB_ORIGUSER
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Identifies the end user that submitted this IPP job.
      - -
      - - -

      -

      -
      -

      - -

      IPP Job Originating User Name NL

      - -
      - -
      ID
      - -
      ATTR_IPP_JOB_ORIGUSER_NL
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Identifies the natural language of job-originating user name.
      - -
      - - -

      -

      -
      -

      - -

      IPP Printer Name

      - -
      - -
      ID
      - -
      ATTR_IPP_PRINTER_NAME
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Identifies the IPP printer that created this job.
      - -
      - - -

      -

      -
      -

      - -

      Job CCSID

      - -
      - -
      ID
      - -
      ATTR_JOBCCSID
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The CCSID of the job that created the spooled file.
      - -
      - - -

      -

      -
      -

      - -

      Job Name

      - -
      - -
      ID
      - -
      ATTR_JOBNAME
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the job that created the spooled file.
      - -
      - - -

      -

      -
      -

      - - -

      Job Number

      - - -
      - -
      ID
      - - -
      ATTR_JOBNUMBER
      - - -
      Type
      - - -
      String
      - - -
      Description
      - - -
      The number of the job that created the spooled file.
      - -
      - - -

      -

      -
      -

      - - -

      Job Separators

      - - -
      - -
      ID
      - - -
      ATTR_JOBSEPRATR
      - - -
      Type
      - - -
      Integer
      - - -
      Description
      - - -
      The number of job separators to be placed at the beginning of the output -for each job having spooled files on this output queue. Valid values are --2, 0-9. The value *MSG is encoded as -2. Job separators are specified -when the output queue is created.
      - -
      - - -

      -

      -
      -

      - - - -

      Job System Name

      - -
      - -
      ID
      - -
      ATTR_JOBSYSTEM
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the system that ran the job that created the -spooled file.
      - -
      - - -

      -
      -

      - -

      Job User

      - -
      - -
      ID
      - -
      ATTR_JOBUSER
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the user that created the spooled file.
      - -
      - - -

      -

      -
      -

      - -

      Last Page Printed

      - -
      - -
      ID
      - -
      ATTR_LASTPAGE
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The number of the last printed page is the file if printing ended before - the job completed processing. -
      - -
      - - -

      -

      -
      -

      - -

      Length of Page

      - -
      - -
      ID
      - -
      ATTR_PAGELEN
      - -
      Type
      - -
      Float
      - -
      Description
      - -
      The length of a page. Units of measurement are specified in the measurement - method attribute.
      - -
      - - -

      -

      -
      -

      - -

      Library Name

      - -
      - -
      ID
      - -
      ATTR_LIBRARY
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the library.
      - -
      - - -

      -

      -
      -

      - -

      Line Spacing

      - -
      - -
      ID
      - -
      ATTR_LINESPACING
      - -
      Type
      - -
      String
      - -
      Description
      - -
      How a file's line data records are spaced when printed. The -information is returned only for *LINE and *AFPDSLINE printer device -types files. Valid values are *SINGLE, *DOUBLE, *TRIPLE, or *CTLCHAR.
      - -
      - - -

      -

      -
      -

      - -

      Lines Per Inch

      - -
      - -
      ID
      - -
      ATTR_LPI
      - -
      Type
      - -
      Float
      - -
      Description
      - -
      The number of lines per vertical inch in the spooled file.
      - -
      - - -

      -

      -
      -

      - -

      Lines Per Inch Changes

      - -
      - -
      ID
      - -
      ATTR_LPI_CHANGES
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Whether the lines per inch (lpi) changes within the spooled -file. Valid values are Y(yes) or N (no).
      - -
      - - -

      -

      -
      -

      - -

      Manufacturer Type and Model

      - -
      - -
      ID
      - -
      ATTR_MFGTYPE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Specifies the manufacturer, type, and model when transforming print -data from SCS to ASCII.
      - -
      - - -

      -

      -
      -

      - -

      Maximum Jobs per Client List

      - -
      - -
      ID
      - -
      ATTR_MAX_JOBS_PER_CLIENT
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      Supplied by the client to indicate the maximum printer queue size of limitation.
      - -
      - - -

      -

      -
      -

      - -

      Maximum Records

      - -
      - -
      ID
      - -
      ATTR_MAXRCDS
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The maximum number of records allowed in this file at the time this -file was opened. The value *NOMAX is encoded as 0.
      - -
      - - -

      -

      -
      -

      - -

      Measurement Method

      - -
      - -
      ID
      - -
      ATTR_MEASMETHOD
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The measurement method that is used for the length of page and width -of page attributes. Valid values are *ROWCOL, *UOM.
      - -
      - - -

      -

      -
      -

      - -

      Message Queue

      - -
      - -
      ID
      - -
      ATTR_MESSAGE_QUEUE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The Integrated File System path of the message queue that the writer uses for operational -messages. The format of the Integrated File System path is "/QSYS.LIB/library.LIB/messageque.MSGQ" -where library is the library that contains the message queue and - messageque is the name of the message queue. -
      - -
      - - -

      -

      -
      -

      - - -

      Message Help

      - - -
      - -
      ID
      - - -
      ATTR_MSGHELP
      - - -
      Type
      - - -
      char(*)
      - - -
      Description
      - - -
      The message help, which is sometimes known as second-level text, can -be returned by a "retrieve message" request. The system limits -the length to 3000 characters (English version must be 30% less to allow -for translation).
      - -
      - - -

      -

      -
      -

      - -

      Message ID

      - -
      - -
      ID
      - -
      ATTR_MSGID
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The message ID.
      - -
      - - -

      -

      -
      -

      - - -

      Message Reply

      - - -
      - -
      ID
      - - -
      ATTR_MSGREPLY
      - - -
      Type
      - - -
      String
      - - -
      Description
      - - -
      The message reply. Text string to be provided by the client which answers -a message of type "inquiry". In the case of message retrieved, -the attribute value is returned by the server and contains the default -reply which the client can use. The system limits the length to 132 characters. -Should be null-terminated due to variable length.
      - -
      - - -

      -

      -
      -

      - - -

      Message Text

      - - -
      - -
      ID
      - - -
      ATTR_MSGTEXT
      - - -
      Type
      - - -
      String
      - - -
      Description
      - - -
      The message text, that is sometimes known as first-level text, can -be returned by a "retrieve message" request. The system limits -the length to 132 characters.
      - -
      - - -

      -

      -
      -

      - - -

      Message Type

      - - -
      - -
      ID
      - - -
      ATTR_MSGTYPE
      - - -
      Type
      - - -
      String
      - - -
      Description
      - - -
      The message type, a 2-digit, EBCDIC encoding. Two types of messages -indicate whether one can "answer" a "retrieved" message: -'04' Informational messages convey information without asking for a reply -(may require a corrective action instead), '05' Inquiry messages convey -information and ask for a reply.
      - -
      - - -

      -

      -
      -

      - - -

      Message Severity

      - - -
      - -
      ID
      - - -
      ATTR_MSGSEV
      - - -
      Type
      - - -
      Integer
      - - -
      Description
      - - -
      Message severity. Values range from 00 to 99. The higher the value, -the more severe or important the condition.
      - -
      - - -

      -

      -
      -

      - - -

      Multi-item Reply Capability

      - - -
      - -
      ID
      - - -
      ATTR_MULTI_ITEM_REPLY
      - - -
      Type
      - - -
      String
      - - -
      Description
      - - -
      When this attribute value is set to *YES by the client, the -performance of list spooled file operations can be greatly improved. -The default value is *NO.
      - -
      - -

      -

      -
      -

      - - -

      Network Identifier

      - - -
      - -
      ID
      - - -
      ATTR_NETWORK
      - - -
      Type
      - - -
      String
      - - -
      Description
      - - -
      The network identifier of the system where the file was created.
      - -
      - - -

      -

      -
      -

      - - -

      Number of Bytes in Spooled File

      - - -
      - -
      ID
      - - -
      ATTR_NUMBYTES_SPLF
      - - -
      Type
      - - -
      Integer
      - - -
      Description
      - - -
      The total number of bytes available in the stream or spooled file. -The value indicates the number of bytes BEFORE any transform of the data takes place. -In order to accommodate files of sizes greater than 2**31 - 1 bytes, this value -is scaled; the user needs to multiply the value by 10K to get the actual number of bytes. -This attribute is not valid for spooled files being viewed in page-at-a-time mode.
      - -
      - - -

      -

      -
      -

      - - -

      Number of Bytes to Read/Write

      - - -
      - -
      ID
      - - -
      ATTR_NUMBYTES
      - - -
      Type
      - - -
      Integer
      - - -
      Description
      - - -
      The number of bytes to read for a read operation, or the number of -bytes to write for a write operation. The object action determines how -to interpret this attribute.
      - -
      - - -

      -

      -
      -

      - - -

      Number of Files

      - - -
      - -
      ID
      - - -
      ATTR_NUMFILES
      - - -
      Type
      - - -
      Integer
      - - -
      Description
      - - -
      The number of spooled files that exist on the output queue.
      - -
      - - -

      -

      -
      -

      - - -

      Number of Writers Started to Queue

      - - -
      - -
      ID
      - - -
      ATTR_NUMWRITERS
      - - -
      Type
      - - -
      Integer
      - - -
      Description
      - - -
      The number of writer jobs started to the output queue.
      - -
      - - -

      -

      -
      -

      - -

      Object Extended Attribute

      - -
      - -
      ID
      - -
      ATTR_OBJEXTATTR
      - -
      Type
      - -
      String
      - -
      Description
      - -
      An "extended" attribute used by some objects like font resources. - This value shows up via WRKOBJ and DSPOBJD commands on the server. The - title on a server screen may just indicate "Attribute". In the - case of object types of font resources, for example, common values are - CDEPAG, CDEFNT, and FNTCHRSET. -
      - -
      - - -

      -

      -
      -

      - -

      OfficeVision

      - -
      - -
      ID
      - -
      ATTR_OFFICEVISION
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Specifies whether the spooled file was generated by the - OfficeVision licensed program. Valid values are Y (yes) or N (no). -
      - -
      - - -

      -

      -
      -

      - -

      On Job Queue Status

      - -
      - -
      ID
      - -
      ATTR_ONJOBQSTS
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether the writer is on a job queue and therefore is not currently - running. The possible values are *YES, *NO. -
      - -
      - - -

      -

      -
      -

      - -

      Open Time Commands

      - -
      - -
      ID
      - -
      ATTR_OPENCMDS
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Specifies whether user wants SCS open time commands to be inserted - into datastream prior to spool file data. Valid values are *YES, *NO. -
      - -
      - - -

      -

      -
      -

      - - -

      Operator Controlled

      - - -
      - -
      ID
      - - -
      ATTR_OPCNTRL
      - - -
      Type
      - - -
      String
      - - -
      Description
      - - -
      Whether users with job control authority are allowed to manage or control -the spooled files on this queue. Valid values are *YES, *NO.
      - -
      - - -

      -

      -
      -

      - -

      Order of Files on Queue

      - -
      - -
      ID
      - -
      ATTR_ORDER
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The order of spooled files on this output queue. - Valid values are *FIFO, *JOBNBR. -
      - -
      - - -

      -

      -
      -

      - -

      OS/400 Created AFPDS

      - -
      - -
      ID
      - -
      ATTR_OS4_CRT_AFP
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Specifies whether the spooled file was created by i5/OS using - a printer file with the device type (DEVTYPE) parameter value - set to *AFPDS. Valid values are Y (yes) or N (no). -
      - -
      - - - -

      -

      -
      -

      - -

      Output Bin

      - -
      - -
      ID
      - -
      ATTR_OUTPUTBIN
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The output bin the printer uses for the printed output. - Values range from 1 to 65535. The value *DEVD is encoded as 0. -
      - -
      - - -

      -

      -
      -

      - -

      Output Priority

      - -
      - -
      ID
      - -
      ATTR_OUTPTY
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The priority of the spooled file. The priority ranges from 1 (highest) - to 9 (lowest). Valid values are 0-9, where 0 represents *JOB. -
      - -
      - - -

      -

      -
      -

      - - -

      Output Queue

      - - -
      - -
      ID
      - - -
      ATTR_OUTPUT_QUEUE
      - - -
      Type
      - - -
      String
      - - -
      Description
      - - -
      The Integrated File System path of the output queue. The format of the Integrated File System path is - "/QSYS.LIB/library.LIB/queue.OUTQ" where library is the library - that contains the output queue and queue is the name of the - output queue. -
      - -
      - - -

      -

      -
      -

      - -

      Output Queue Status

      - -
      - -
      ID
      - -
      ATTR_OUTQSTS
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The status of the output queue. Valid values are RELEASED, HELD.
      - -
      - - -

      -

      -
      -

      - -

      Overall Status

      - -
      - -
      ID
      - -
      ATTR_OVERALLSTS
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The overall status of the "logical printer". "Logical printer" -refers to printer device, output queue and writer job. Valid values are -1 (unavailable), 2 (powered off or not yet available), 3 (stopped), 4 -(message waiting), 5 (held), 6 (stop pending), 7 (hold pending), 8 -(waiting for printer), 9 (waiting to start), 10 (printing), 11 (waiting -for output queue), 12 (connect pending), 13 (powered off), 14 -(unusable), 15 (being serviced), 999 (unknown).
      - -
      - - -

      -

      -
      -

      - -

      Overflow Line Number

      - -
      - -
      ID
      - -
      ATTR_OVERFLOW
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The last line to be printed before the data that is being printed overflows -to the next page.
      - -
      - - -

      -

      -
      -

      - -

      Page At A Time

      - -
      - -
      ID
      - -
      ATTR_PAGE_AT_A_TIME
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Specifies whether the spooled file is to be opened in page-at-a-time mode. -Valid values are *YES and *NO.
      - -
      - - -

      -

      -
      -

      - -

      Page Count Estimated

      - -
      - -
      ID
      - -
      ATTR_PAGES_EST
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Specifies whether the page count is estimated rather than actual. Valid -values are *YES and *NO.
      - -
      - - -

      -

      -
      -

      - -

      Page Definition

      - -
      - -
      ID
      - -
      ATTR_PAGE_DEFINITION
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The Integrated File System path name of the page definition or a special value. -If an Integrated File System path is specified the format is "/QSYS.LIB/library.LIB/pagedef.PAGDFN" -where library is the library of the page definition and pagedef is -the name of the page definition. Valid special values include *NONE.
      - -
      - - -

      -

      -
      -

      - -

      Page Groups

      - -
      - -
      ID
      - -
      ATTR_PAGE_GROUPS
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Whether the spooled file contains page groups as indicated by -the DDS keyword STRPAGGRP and ENDPAGGRP. Valid values are -Y (yes) or N (no).
      - -
      - - -

      -

      -
      -

      - -

      Page Level Index Tags

      - -
      - -
      ID
      - -
      ATTR_PAGELVLIDXTAG
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Whether the spooled file contains page level index tags as indicated by -the DDS keyword DOCIDXTAG with a tag level of PAGE. Valid values are -Y (yes) or N (no).
      - -
      - - -

      -

      -
      -

      - -

      Page Number

      - -
      - -
      ID
      - -
      ATTR_PAGENUMBER
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The number of the page to be read from a spooled file opened in page-at-a-time mode.
      - -
      - - -

      -

      -
      -

      - -

      Pages Per Side

      - -
      - -
      ID
      - -
      ATTR_MULTIUP
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The number of logical pages that print on each side of each physical -page when the file is printed. Valid values are 1, 2, 4.
      - -
      - - -

      -

      -
      -

      - -

      Page Rotate

      - -
      - -
      ID
      - -
      ATTR_PAGE_ROTATE
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      Whether the page rotation is changed within the spooled -file. Valid values are Y (yes) or N (no).
      - -
      - - -

      -

      -
      -

      - -

      Paper Source 1

      - -
      - -
      ID
      - -
      ATTR_PAPER_SOURCE_1
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The size of the paper in paper source one. If this field -is not specified or the value is not valid, the special value of *MFRTYPMDL -is used. Valid values are *NONE - there is no paper source one or the -paper is manually fed into the printer, -*MFRTYPMDL - the paper size suggested by the manufacturer type -and model is used, *LETTER (8.5 x 11.0 inches), *LEGAL (8.5 x 14.0 inches), -*EXECUTIVE (7.25 x 10.5 inches), *LEDGER (17.0 x 11.0 inches), -*A3 (297mm x 420mm), *A4 (210mm x 297mm), *A5 (148mm x 210mm), -*B4 (257mm x 364mm), *B5 (182mm x 257mm), *CONT80 (8.0 inches wide with -continuous form), *CONT132 (13.2 inches wide with continuous form).
      - -
      - - -

      -

      -
      -

      - -

      Paper Source 2

      - -
      - -
      ID
      - -
      ATTR_PAPER_SOURCE_2
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The size of the paper in paper source two. If this field -is not specified or the value is not valid, the special value of *MFRTYPMDL -is used. Valid values are *NONE - there is no paper source two or the -paper is manually fed into the printer, -*MFRTYPMDL - the paper size suggested by the manufacturer type -and model is used, *LETTER (8.5 x 11.0 inches), *LEGAL (8.5 x 14.0 inches), -*EXECUTIVE (7.25 x 10.5 inches), *LEDGER (17.0 x 11.0 inches), -*A3 (297mm x 420mm), *A4 (210mm x 297mm), *A5 (148mm x 210mm), -*B4 (257mm x 364mm), *B5 (182mm x 257mm), *CONT80 (8.0 inches wide with -continuous form), *CONT132 (13.2 inches wide with continuous form).
      - -
      - - -

      -

      -
      -

      - -

      Pel Density

      - -
      - -
      ID
      - -
      ATTR_PELDENSITY
      - -
      Type
      - -
      String
      - -
      Description
      - -
      For font resources only, this value is an encoding of the number of -pels ("1" represents a pel size of 240, "2" represents -a pel size of 320). Additional values may become meaningful as the server defines them.
      - -
      - - -

      -

      -
      -

      - -

      Point Size

      - -
      - -
      ID
      - -
      ATTR_POINTSIZE
      - -
      Type
      - -
      Float
      - -
      Description
      - -
      The point size in which this spooled file's text is printed. The special - value *NONE is encoded as 0. -
      - -
      - - -

      -

      -
      -

      - -

      Print Fidelity

      - -
      - -
      ID
      - -
      ATTR_FIDELITY
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The kind of error handling that is performed when printing. Valid values -are *ABSOLUTE, *CONTENT.
      - -
      - - -

      -

      -
      -

      - -

      Print on Both Sides

      - -
      - -
      ID
      - -
      ATTR_DUPLEX
      - -
      Type
      - -
      String
      - -
      Description
      - -
      How the information prints. Valid values are *FORMDF, *NO, *YES, *TUMBLE. -
      - -
      - - -

      -

      -
      -

      - -

      Print Quality

      - -
      - -
      ID
      - -
      ATTR_PRTQUALITY
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The print quality that is used when printing this spooled file. Valid -values are *STD, *DRAFT, *NLQ, *FASTDRAFT.
      - -
      - - -

      -

      -
      -

      - -

      Print Sequence

      - -
      - -
      ID
      - -
      ATTR_PRTSEQUENCE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Print sequence. Valid values are *NEXT.
      - -
      - - -

      -

      -
      -

      - -

      Print Text

      - -
      - -
      ID
      - -
      ATTR_PRTTEXT
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The text that is printed at the bottom of each page of printed output -and on separator pages. Valid special values include *BLANK and *JOB.
      - -
      - - -

      -

      -
      -

      - - -

      Printer

      - - -
      - -
      ID
      - - -
      ATTR_PRINTER
      - - -
      Type
      - - -
      String
      - - -
      Description
      - - -
      The name of the printer device.
      - -
      - - -

      -

      -
      -

      - -

      Printer Assigned

      - -
      - -
      ID
      - -
      ATTR_PRTASSIGNED
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Indicates if the printer is assigned. Valid values are 1 -(assigned to a specific printer), 2 (assigned to multiple printers), 3 -(not assigned).
      - -
      - - -

      -

      -
      -

      - -

      Printer Device Type

      - -
      - -
      ID
      - -
      ATTR_PRTDEVTYPE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The printer data stream type. Valid values are *SCS, *IPDS, *USERASCII, - *AFPDS, *LINE. -
      - -
      - - -

      -

      -
      -

      - -

      Printer File

      - -
      - -
      ID
      - -
      ATTR_PRINTER_FILE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The Integrated File System path of the printer file. The format of the Integrated File System path is - "/QSYS.LIB/library.LIB/printerfile.FILE" where library is the library - that contains the printer file and printerfile is the name of - the printer file. -
      - -
      - - -

      -

      -
      -

      - -

      Printer Queue

      - -
      - -
      ID
      - -
      ATTR_RMTPRTQ
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the destination printer queue when sending spooled files - via SNDTCPSPLF (LPR). -
      - -
      - - -

      -

      -
      -

      - -

      Program That Opened File Library Name

      - -
      - -
      ID
      - -
      ATTR_PGM_OPN_LIB
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the library that contains the program that opened - the spooled file. -
      - -
      - - -

      -

      -
      -

      - -

      Program That Opened File Name

      - -
      - -
      ID
      - -
      ATTR_PGM_OPN_FILE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the program that opened the spooled file.
      - -
      - - -

      -

      -
      -

      - -

      Published Printer

      - -
      - -
      ID
      - -
      ATTR_PUBINF
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Indicates if the printer information has been published - in the LDAP directory. Valid values are *YES or *NO. -
      - -
      - - -

      -

      -
      -

      - -

      Publishing Info Color Supported

      - -
      - -
      ID
      - -
      ATTR_PUBINF_COLOR_SUP
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Indicates color is supported for this publishing list entry.
      - -
      - - -

      -

      -
      -

      - -

      Publishing Info Pages per Minute (Color)

      - -
      - -
      ID
      - -
      ATTR_PUBINF_PPM_COLOR
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The pages per minute supported in color mode for this publishing list entry.
      - -
      - - -

      -

      -
      -

      - -

      Publishing Info Pages per Minute (Monochrome)

      - -
      - -
      ID
      - -
      ATTR_PUBINF_PPM
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The pages per minute supported in monochrome for this publishing list entry.
      - -
      - - -

      -

      -
      -

      - -

      Publishing Info Duplex Support

      - -
      - -
      ID
      - -
      ATTR_PUBINF_DUPLEX_SUP
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The duplex supported indicator for this publishing list entry.
      - -
      - - -

      -

      -
      -

      - -

      Publishing Info Location

      - -
      - -
      ID
      - -
      ATTR_PUBINF_LOCATION
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The location description for this publishing list entry.
      - -
      - - -

      -

      -
      -

      - -

      Record Format Name Present in Data Stream

      - -
      - -
      ID
      - -
      ATTR_RCDFMT_DATA
      - -
      Type
      - -
      String (one character)
      - -
      Description
      - -
      A record format name exists in columns 1-10 of a line data record - or columns 2-11 if the spooled file contains control characters. - Valid values are Y (yes) or N (no). -
      - -
      - - -

      -

      -
      -

      - -

      Record Length

      - -
      - -
      ID
      - -
      ATTR_RECLENGTH
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      Record length.
      - -
      - - -

      -

      -
      -

      - -

      Reduce Output

      - -
      - -
      ID
      - -
      ATTR_REDUCE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The manner in which multiple logical pages print on each side of a physical page. Valid values *TEXT or ????.
      - -
      - - -

      -

      -
      -

      - -

      Remote Location Name

      - -
      - -
      ID
      - -
      ATTR_RMTLOCNAME
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The printer device location name.
      - -
      - - -

      -

      -
      -

      - -

      Remote System Name

      - -
      - -
      ID
      - -
      ATTR_RMTSYSTEM
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Remote system name. Valid special values include *INTNETADR.
      - -
      - - -

      -

      -
      -

      - -

      Replace Unprintable Characters

      - -
      - -
      ID
      - -
      ATTR_RPLUNPRT
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether characters that cannot be printed are to be replaced with another -character. Valid values are *YES or *NO.
      - -
      - - -

      -

      -
      -

      - -

      Replacement Character

      - -
      - -
      ID
      - -
      ATTR_RPLCHAR
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The character that replaces any unprintable characters.
      - -
      - - -

      -

      -
      -

      - -

      Resource library list

      - -
      - -
      ID
      - -
      ATTR_RSC_LIB_LIST
      - -
      Type
      - -
      todo
      - -
      Description
      - -
      todo attr_rsc_lib_list
      - -
      - - -

      -

      -
      -

      - -

      Restart Printing

      - -
      - -
      ID
      - -
      ATTR_RESTART
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      Restart printing. Valid values are -1, -2, -3, or the page number to -restart at. The value *STRPAGE is encoded as -1, the value *ENDPAGE is -encoded as -2, and the value *NEXT is encoded as -3.
      - -
      - - -

      -

      -
      -

      - -

      Saddle Stitch Number of Staples

      - -
      - -
      ID
      - -
      ATTR_SADDLESTITCH_NUMSTAPLES
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The number of staples that are to be applied along the finishing operation axis.
      - -
      - - -

      -

      -
      -

      - -

      Saddle Stitch Reference Edge

      - -
      - -
      ID
      - -
      ATTR_SADDLESTITCH_REF
      - -
      Type
      - -
      String
      - -
      Description
      - -
      One or more staples are driven into the media along the finishing -operation axis, which is positioned at the center of the media parallel -to the reference edge. Valid values are *NONE, *DEVD, *TOP, and *LEFT.
      - -
      - - -

      -

      -
      -

      - -

      Save File

      - -
      - -
      ID
      - -
      ATTR_SAVE_FILE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The Integrated File System path of the save file that contains the - saved spooled file. The format of the Integrated File System path is - "/QSYS.LIB/library.LIB/savefile.SAVF" where library is the library - that contains the save file and savefile is the name of - the save file. The value is blank if the spooled file was not saved - to a save file. -
      - -
      - - -

      -

      -
      -

      - -

      Save Spooled File After Written

      - -
      - -
      ID
      - -
      ATTR_SAVE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether the spooled file is kept on the output queue after it is written. -Valid values are *YES, *NO, or *IMMED.
      - -
      - - -

      -

      -
      -

      - -

      Save Command

      - -
      - -
      ID
      - -
      ATTR_SAVE_COMMAND
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The command used to save the spooled file. The value is blank if the -spooled file was not saved. -
      - -
      - - -

      -

      -
      -

      - -

      Save Device

      - -
      - -
      ID
      - -
      ATTR_SAVE_DEVICE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The type of device to which the spooled file was last saved. The - value is *SAVF if the last save operation was to a save file. The - value is *TAP if the last save operation was to tape. The value is - *OPT if the last save operation was to optical. The value is the - empty string "", if the spooled file was not saved. -
      - -
      - - -

      -

      -
      -

      - -

      Save Label

      - -
      - -
      ID
      - -
      ATTR_SAVE_LABEL
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The file label used when the spooled file was saved. The - value corresponds to the value specified for the LABEL or OPTFILE - parameter on the system command used to save the spooled file. - The value is blank if the object was not saved to tape or optical. -
      - -
      - - -

      -

      -
      -

      - -

      Save Sequence Number

      - -
      - -
      ID
      - -
      ATTR_SAVE_SEQUENCE_NUMBER
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The tape sequence number assigned when the spooled file was - saved on tape. If the spooled file was not saved to tape, the - field contains zeros. -
      - -
      - - -

      -

      -
      -

      - -

      Save Volume Format

      - -
      - -
      ID
      - -
      ATTR_SAVE_VOLUME_FORMAT
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The format of the saved spooled file. This format is used when - spooled files are saved to tape or optical media. The possible values - are SERIAL or PARALLEL. For SERIAL, the spooled file was saved serially - in a single media file. For PARALLEL, the spooled file was saved - in a parallel save/restore file with more than one media file. All of - the media files are needed to restore this data. -
      - -
      - - -

      -

      -
      -

      - -

      Save Volume ID

      - -
      - -
      ID
      - -
      ATTR_SAVE_VOLUME_ID
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The tape or optical volumes that are used for saving the spooled file. -This string contains a maximum of ten (10) six character volume names. -The volume names are separated by blanks.
      - -
      - - -

      -

      -
      -

      - -

      Seek Offset

      - -
      - -
      ID
      - -
      ATTR_SEEKOFF
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      Seek offset. Allows both positive and negative values relative to the - seek origin. -
      - -
      - - -

      -

      -
      -

      - -

      Seek Origin

      - -
      - -
      ID
      - -
      ATTR_SEEKORG
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      Valid values include 1 (beginning or top), 2 (current), and 3 (end - or bottom). -
      - -
      - - -

      -

      -
      -

      - -

      Send Priority

      - -
      - -
      ID
      - -
      ATTR_SENDPTY
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Send priority. Valid values are *NORMAL, *HIGH.
      - -
      - - -

      -

      -
      -

      - -

      Separator Page

      - -
      - -
      ID
      - -
      ATTR_SEPPAGE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Allows a user the option of printing a banner page or not. Valid values - are *YES or *NO. -
      - -
      - - -

      -

      -
      -

      - -

      Source Drawer

      - -
      - -
      ID
      - -
      ATTR_SRCDRWR
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The drawer to be used when the automatic cut sheet feed option is selected. - Valid values are -1, -2, 1-255. The value *E1 is encoded as -1, and the - value *FORMDF is encoded as -2. -
      - -
      - - -

      -

      -
      -

      - -

      Spool SCS

      - -
      - -
      ID
      - -
      ATTR_SPLSCS
      - -
      Type
      - -
      Long
      - -
      Description
      - -
      Determines how SCS data is used during create spool file.
      - -
      - - -

      -

      -
      -

      - -

      Spool the Data

      - -
      - -
      ID
      - -
      ATTR_SPOOL
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether the output data for the printer device is spooled. Valid values -are *YES, *NO.
      - -
      - - -

      -

      -
      -

      - -

      Spooled File Creation Authentication Method

      - -
      - -
      ID
      - -
      ATTR_SPLF_AUTH_METHOD
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      Indicates the client authentication method used to create this -spooled file. Valid values include x'00'(*NONE), x'01'(*REQUESTER), -x'02'(*BASIC), x'03'(*CERTIFICATE), and 'x'04'(*DIGEST).
      - -
      - - -

      -

      -
      -

      - -

      Spooled File Creation Security Method

      - -
      - -
      ID
      - -
      ATTR_SPLF_SECURITY_METHOD
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Indicates the security method used to create this spooled file. Valid values are x'00'(*NONE), x'01'(*SSL3), and x'02'(*TLS).
      - -
      - - -

      -

      -
      -

      - -

      Spooled File Name

      - -
      - -
      ID
      - -
      ATTR_SPOOLFILE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the spooled file.
      - -
      - - -

      -

      -
      -

      - -

      Spooled File Number

      - -
      - -
      ID
      - -
      ATTR_SPLFNUM
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The spooled file number. Special values allowed are -1 and 0. -The value *LAST is encoded as -1, the value *ONLY is -encoded as 0.
      - -
      - - -

      -

      -
      -

      - -

      Spooled File Restored Date

      - -
      - -
      ID
      - -
      ATTR_SPLF_RESTORED_DATE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The date the spooled file was last restored. This value is blank if the -spooled file was not restored. The date format is CYYMMDD, -where C=century (0=19XX, 1=20XX), YY=year, MM=month, and DD=day.
      - -
      - - -

      -

      -
      -

      - -

      Spooled File Restored Time

      - -
      - -
      ID
      - -
      ATTR_SPLF_RESTORED_TIME
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The time the spooled file was last restored. This value is blank if the -spooled file was not restored. The time is in the HHMMSS format, -where HH=hour, MM=minute, and SS=second.
      - -
      - - -

      -

      -
      -

      - -

      Spooled File Saved Date

      - -
      - -
      ID
      - -
      ATTR_SPLF_SAVED_DATE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The date the spooled file was last saved. This value is blank if the -spooled file was not saved. The date format is CYYMMDD, -where C=century (0=19XX, 1=20XX), YY=year, MM=month, and DD=day.
      - -
      - - -

      -

      -
      -

      - -

      Spooled File Saved Time

      - -
      - -
      ID
      - -
      ATTR_SPLF_SAVED_TIME
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The time the spooled file was last saved. This value is blank if the -spooled file was not saved. The time is in the HHMMSS format, -where HH=hour, MM=minute, and SS=second.
      - -
      - - -

      -

      -
      -

      - -

      Spooled File Size

      - -
      - -
      ID
      - -
      ATTR_SPLF_SIZE
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The spooled file size. Multiply this value by the spooled file -size multiplier value to get the size of the spooled file in -number of bytes. The spooled file size is the data stream plus -the "overhead" storage used to store the spooled files's -data stream.
      - -
      - - -

      -

      -
      -

      - -

      Spooled File Size Multiplier

      - -
      - -
      ID
      - -
      ATTR_SPLF_SIZE_MULT
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The number to multiply the spooled file size value by to -get the spooled file size in number of bytes.
      - -
      - - -

      -

      -
      -

      - -

      Spooled File Status

      - -
      - -
      ID
      - -
      ATTR_SPLFSTATUS
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The status of the spooled file. Valid values are *CLOSED, *HELD, *MESSAGE, -*OPEN, *PENDING, *PRINTER, *READY, *SAVED, *WRITING.
      - -
      - - -

      -

      -
      -

      - -

      Spooled Output Schedule

      - -
      - -
      ID
      - -
      ATTR_SCHEDULE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Specifies, for spooled files only, when the spooled file is available -to the writer. Valid values are *IMMED, *FILEEND, *JOBEND.
      - -
      - - -

      -

      -
      -

      - -

      Started By User

      - -
      - -
      ID
      - -
      ATTR_STARTEDBY
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the user who started the writer.
      - -
      - - -

      -

      -
      -

      - -

      Starting Page

      - -
      - -
      ID
      - -
      ATTR_STARTPAGE
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The page number at which to start printing the spooled file. Valid -values are -1, 0, 1, or the page number. The value *ENDPAGE is encoded -as -1. For the value 0, printing starts on page 1. For the value 1, the -entire file prints.
      - -
      - - -

      -

      -
      -

      - -

      System Where File Originated

      - -
      - -
      ID
      - -
      ATTR_SYSTEM
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the system where the spooled file was created. When -the name of the system where this spooled file was created cannot be -determined, the receiving system name is used.
      - -
      - - -

      -

      -
      -

      - -

      Text Description

      - -
      - -
      ID
      - -
      ATTR_DESCRIPTION
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Text to describe an instance of an i5/OS object.
      - -
      - - -

      -

      -
      -

      - -

      Time File Opened (Created)

      - -
      - -
      ID
      - -
      ATTR_TIME
      - -
      Type
      - -
      String
      - -
      Description
      - -
      For spooled files this is the time this spooled file was opened. -For AFP resources this is the time the object was last modified. -The time is encoded in a character string with the following format, -HHMMSS where: -
        - -
      • HH - Hour
      • - -
      • MM - Minutes
      • - -
      • SS - Seconds
      • - -
      -
      - -
      - - -

      -

      -
      -

      - -

      Time Writer Began Processing Spooled File

      - -
      - -
      ID
      - -
      ATTR_TIME_WTR_BEGAN_FILE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Indicates the time at which the writer began processing the spooled file. -The time is encoded in a character string with the following format, - HH MM SS.
      - -
      - - -

      -

      -
      -

      - -

      Time Writer Completed Processing Spooled File

      - -
      - -
      ID
      - -
      ATTR_TIME_WTR_CMPL_FILE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Indicates the time at which the writer finished processing the spooled file. -The time is encoded in a character string with the following format, - HH MM SS.
      - -
      - - - -

      -

      -
      -

      - -

      Total Pages

      - -
      - -
      ID
      - -
      ATTR_PAGES
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      The number of pages that are contained in a spooled file.
      - -
      - - -

      -

      -
      -

      - -

      Transform SCS to ASCII

      - -
      - -
      ID
      - -
      ATTR_SCS2ASCII
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether the print data is to be transformed from SCS to ASCII. Valid -values are *YES, *NO.
      - -
      - - - -

      -

      -
      -

      - -

      TRC for 1403

      - -
      - -
      ID
      - -
      ATTR_TRC1403
      - -
      Type
      - -
      String (One character)
      - -
      Description
      - -
      Whether the spooled file contains 1403 line data with -table-reference characters (TRC). Valid values are Y (yes) or N (no).
      - -
      - - - -

      -

      -
      -

      - -

      Unit of Measure

      - -
      - -
      ID
      - -
      ATTR_UNITOFMEAS
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The unit of measure to use for specifying distances. Valid values are -*CM, *INCH.
      - -
      - - -

      -

      -
      -

      - -

      User Comment

      - -
      - -
      ID
      - -
      ATTR_USERCMT
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The 100 characters of user-specified comment that describe the spooled - file. -
      - -
      - - -

      -

      -
      -

      - -

      User Data

      - -
      - -
      ID
      - -
      ATTR_USERDATA
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The 10 characters of user-specified data that describe the spooled - file. Valid special values include *SOURCE. -
      - -
      - - -

      -

      -
      -

      - -

      User Defined Data

      - -
      - -
      ID
      - -
      ATTR_USRDEFDATA
      - -
      Type
      - -
      String
      - -
      Description
      - -
      User defined data to be utilized by user applications or user specified -programs that process spool files. All characters are acceptable. Max size -is 255.
      - -
      - - -

      -

      -
      -

      - -

      User Defined File

      - -
      - -
      ID
      - -
      ATTR_USRDEFFILE
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether the spooled file was created using an API. Valid values are *YES, or *NO.
      - -
      - - -

      -

      -
      -

      - -

      User Defined Object

      - -
      - -
      ID
      - -
      ATTR_USER_DEFINED_OBJECT
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The Integrated File System path of the user defined object to be utilized - by user applications that process spool files. If an Integrated File System path the format - of the Integrated File System path is "/QSYS.LIB/library.LIB/object.type" where library - is the name of the library that contains the object or one of the special - values %LIBL% or %CURLIB%. object is the name of the object and - type is the object type. Valid values for type include - "DTAARA", "DTAQ", "FILE", "PSFCFG", "USRIDX", "USRQ" and "USRSPC". - The string "*NONE" is used to indicate no user defined object is to - be used. -
      - -
      - - -

      -

      -
      -

      - -

      User Defined Option(s)

      - -
      - -
      ID
      - -
      ATTR_USRDEFOPT
      - -
      Type
      - -
      String
      - -
      Description
      - -
      User defined options to be utilized by user applications that process -spool files. Up to 4 options may be specifies, each value is length char(10). -All characters are acceptable.
      - -
      - - -

      -

      -
      -

      - -

      User Driver Program Data

      - -
      - -
      ID
      - -
      ATTR_USRDRVDATA
      - -
      Type
      - -
      String
      - -
      Description
      - -
      User data to be used with the user driver program. All characters are -acceptable. Maximum size is 5000 characters.
      - -
      - - -

      -

      -
      -

      - -

      User -Driver Program

      - -
      - -
      ID
      - -
      ATTR_USER_DRIVER_PROG
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The Integrated File System path of the user defined driver program that processes spooled files. - The format of the Integrated File System path is "/QSYS.LIB/library.LIB/program.PGM" where - library is the name of the library that contains the program and - program is the program name. The library may be one of the - special values %LIBL% and %CURLIB% or a specific library name. - The string "*NONE" is used to indicate that no driver program is defined. -
      - -
      - - -

      -

      -
      -

      - -

      User ID

      - -
      - -
      ID
      - -
      ATTR_TOUSERID
      - -
      Type
      - -
      String
      - -
      Description
      - -
      User id to whom the spooled file is sent.
      - -
      - - -

      -

      -
      -

      - -

      User ID Address

      - -
      - -
      ID
      - -
      ATTR_TOADDRESS
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Address of user to whom the spooled file is sent.
      - -
      - - -

      -

      -
      -

      - -

      User Defined Text

      - -
      - -
      ID
      - -
      ATTR_USER_DFN_TXT
      - -
      Type
      - -
      String
      - -
      Description
      - -
      User defined text taken from the interactive user profile - when the spooled file was created. -
      - -
      - - -

      -

      -
      -

      - -

      User Generated Data Stream

      - -
      - -
      ID
      - -
      ATTR_USERGEN_DATA
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether the data stream has been validated by a system program - on the i5/OS when the file was spooled. -
      - -
      - - - -

      -

      -
      -

      - -

      User Transform Program

      - -
      - -
      ID
      - -
      ATTR_USER_TRANSFORM_PROG
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The Integrated File System path of the user defined transform program that - transforms spool file data before it is processed by the driver program. - The format of the Integrated File System path is "/QSYS.LIB/library.LIB/program.PGM" where - library is the name of the library that contains the program and - program is the program name. The library may be one of the - special values %LIBL% and %CURLIB% or a specific library name. - The string "*NONE" is used to indicate that no transform program is defined. -
      - -
      - - -

      -

      -
      -

      - -

      User Who Owned File

      - -
      - -
      ID
      - -
      ATTR_SPLF_CREATOR
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the user profile that owns this spooled file on the - sending system.
      - -
      - - -

      -

      -
      -

      - -

      Fidelity

      - -
      - -
      ID
      - -
      ATTR_VIEWING_FIDELITY
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The processing to take place when viewing a page of -spooled file data (in page-at-a-time mode). -Valid values are *ABSOLUTE and *CONTENT(default). To process all non-raster data (commands) prior -to the current page, *ABSOLUTE is used. For SCS files, *CONTENT is used to process -only open time commands plus the current page. For AFPDS files, *CONTENT -is used to process the first page of data plus the current page.
      - -
      - - -

      -

      -
      -

      - - -

      VM/MVS Class

      - - -
      - -
      ID
      - - -
      ATTR_VMMVSCLASS
      - - -
      Type
      - - -
      String
      - - -
      Description
      - - -
      VM/MVS class. Valid values are A-Z and 0-9.
      - -
      - - -

      -

      -
      -

      - - -

      When to Automatically End Writer

      - - -
      - -
      ID
      - - -
      ATTR_WTRAUTOEND
      - - -
      Type
      - - -
      String
      - - -
      Description
      - - -
      When to end the writer if it is to be ended automatically. Valid values -are *NORDYF, *FILEEND. Attribute Automatically end writer must be set to -*YES.
      - -
      - - -

      -

      -
      -

      - -

      Waiting for Data Status

      - -
      - -
      ID
      - -
      ATTR_WTNGDATASTS
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether the writer has written all the data currently in the spooled file -and is waiting for more data. Possible values are *NO - the writer is not -waiting for more data, *YES - the writer has written all the data currently in -the spooled file and is waiting for more data. This condition occurs when the -writer is producing an open spooled file with SCHEDULE(*IMMED) specified.
      - -
      - - -

      -

      -
      -

      - -

      Waiting for Device Status

      - -
      - -
      ID
      - -
      ATTR_WTNGDEVSTS
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Whether the writer is waiting to get the device from a job that is printing -directly to the printer. Values are *NO - the writer is not waiting for the -device, *YES - the writer is waiting for the device.
      - -
      - - -

      -

      -
      -

      - - -

      Waiting -for Message Status

      - - -
      - -
      ID
      - - -
      ATTR_WTNGMSGSTS
      - - -
      Type
      - - -
      String
      - - -
      Description
      - - -
      Whether the writer is waiting for a reply to an inquiry message. Values are -*NO and *YES.
      - -
      - - -

      -

      -
      -

      - - -

      When to End Writer

      - - -
      - -
      ID
      - - -
      ATTR_WTREND
      - - -
      Type
      - - -
      String
      - - -
      Description
      - - -
      When to end the writer. Valid value are *CNTRLD, *IMMED, and *PAGEEND. -This is different from when to automatically end the writer.
      - -
      - - -

      -

      -
      -

      - - -

      When to Hold File

      - - -
      - -
      ID
      - - -
      ATTR_HOLDTYPE
      - - -
      Type
      - - -
      String
      - - -
      Description
      - - -
      When to hold the spooled file. Valid values are *IMMED, and *PAGEEND. -
      - -
      - - -

      -

      -
      -

      - - -

      Width of Page

      - - -
      - -
      ID
      - - -
      ATTR_PAGEWIDTH
      - - -
      Type
      - - -
      Float
      - - -
      Description
      - - -
      The width of a page. Units of measurement are specified in the measurement -method attribute.
      - -
      - - -

      -

      -
      -

      - -

      Workstation Customizing Object

      - -
      - -
      ID
      - -
      ATTR_WORKSTATION_CUST_OBJECT
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The Integrated File System path of the workstation customizing object. The format of the Integrated File System path -is "/QSYS.LIB/library.LIB/custobj.WSCST" where library is the library that -contains the customization object and custobj is the name of the workstation -customization object. -
      - -
      - - -

      -

      -
      -

      - -

      Writer Job Name

      - -
      - -
      ID
      - -
      ATTR_WTRJOBNAME
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the writer job.
      - -
      - - -

      -

      -
      -

      - -

      Writer Job Number

      - -
      - -
      ID
      - -
      ATTR_WTRJOBNUM
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The writer job number.
      - -
      - - -

      -

      -
      -

      - -

      Writer Job Status

      - -
      - -
      ID
      - -
      ATTR_WTRJOBSTS
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The status of the writer job. Valid values are STR, END, JOBQ, HLD, -MSGW.
      - -
      - - -

      -

      -
      -

      - -

      Writer Job User Name

      - -
      - -
      ID
      - -
      ATTR_WTRJOBUSER
      - -
      Type
      - -
      String
      - -
      Description
      - -
      The name of the user that started the writer job.
      - -
      - - -

      -

      -
      -

      - -

      Writer Started

      - -
      - -
      ID
      - -
      ATTR_WTRSTRTD
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Indicates whether or not a writer is started for this printer. Values - are 1 - yes a writer is started, 0 - no writer is started.
      - -
      - - -

      -

      -
      -

      - -

      Writer Starting Page

      - -
      - -
      ID
      - -
      ATTR_WTRSTRPAGE
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      Specifies the page number of the first page to print from the first -spooled file when the writer job starts. This is only valid if the spooled -file name is also specified when the writer starts.
      - -
      - - -

      -

      -
      -

      - -

      Writing Status

      - -
      - -
      ID
      - -
      ATTR_WRTNGSTS
      - -
      Type
      - -
      String
      - -
      Description
      - -
      Indicates whether the print writer is in writing status. Values are -*YES - the writer is in writing status, *NO - the writer is not in writing -status, *FILE - the writer is writing the file separators.
      - -
      - - -

      -

      -
      -

      - -

      Network Print Server Object Attributes

      - - -

      NPS CCSID

      - -
      - -
      ID
      - -
      ATTR_NPSCCSID
      - -
      Type
      - -
      Integer
      - -
      Description
      - -
      CCSID that the Network Print Server expects that all strings will be -encoded in.
      - -
      - - -

      NPS Level

      - -
      - -
      ID
      - -
      ATTR_NPSLEVEL
      - -
      Description
      - -
      The version, release, and modification level of the Network Print Server. -This attribute is a character string encoded as VXRYMY (ie. "V3R1M0") -where -
           X is in (0..9)
      Y is in (0..9,A..Z)
      -
      - -
      - - -

      -

      - - diff --git a/cvsroot/src/com/ibm/as400/access/doc-files/PrinterAttrs.html b/cvsroot/src/com/ibm/as400/access/doc-files/PrinterAttrs.html deleted file mode 100644 index d04133f95..000000000 --- a/cvsroot/src/com/ibm/as400/access/doc-files/PrinterAttrs.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - -IBM Toolbox for Java: Printer attributes - - - -

      Printer Attributes

      - -
      - -

      Retrieve Attributes

      - -

      The following attributes may be retrieved for a Printer using the appropriate -getIntegerAttribute(), getStringAttribute(), or getFloatAttribute() method : - -

      - -

      The following additional attributes may be retrieved for a Printer -when a Writer is active to the Printer. - -

      - -
      - -

      Set Attributes

      - -

      Attributes are not allowed to be set for a Printer. - -


      - - - diff --git a/cvsroot/src/com/ibm/as400/access/doc-files/PrinterFileAttrs.html b/cvsroot/src/com/ibm/as400/access/doc-files/PrinterFileAttrs.html deleted file mode 100644 index 17dce518b..000000000 --- a/cvsroot/src/com/ibm/as400/access/doc-files/PrinterFileAttrs.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - -IBM Toolbox for Java: Printer file attributes - - - -

      Printer file attributes

      - -

      Retrieve attributes

      - -

      The following attributes may be retrieved for a printer file using the appropriate -getIntegerAttribute(), getStringAttribute(), or getFloatAttribute() method: - -

      - -

      Set attributes

      - -

      The following attributes may be set for a printer file -using the setAttributes() method: - -

      - - - diff --git a/cvsroot/src/com/ibm/as400/access/doc-files/RLReadFileExample.html b/cvsroot/src/com/ibm/as400/access/doc-files/RLReadFileExample.html deleted file mode 100644 index a6e42d5d4..000000000 --- a/cvsroot/src/com/ibm/as400/access/doc-files/RLReadFileExample.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - -IBM Toolbox for Java Example: Using Record-level Access Classes - - -

      Example: Using record-level access classes to read records from a file

      -

      Note: Read the Code example disclaimer -for important legal information. -

      - -
      ///////////////////////////////////////////////////////////////////////////////
      -//
      -// Record-Level Access example.  This program uses the record-level
      -// access classes to read records from a file on the system.
      -//
      -// Command syntax:
      -//    java RLReadFile system
      -//
      -// This program reads the records from CA/400's sample database file
      -// (QCUSTCDT in library QIWS).  If you change this example to update
      -// records you should make a copy of QCUSTCDT and update the copy.
      -//
      -// This source is an example of IBM Toolbox for Java "Record-level access".
      -//
      -///////////////////////////////////////////////////////////////////////////////
      -
      -
      -import java.io.*;
      -import java.util.*;
      -import java.math.*;
      -import com.ibm.as400.access.*;
      -
      -public class RLReadFile extends Object
      -{
      -   public static void main(String[] parameters)
      -   {
      -
      -      String system = "";
      -
      -      // Continue only if a system name was specified.
      -
      -      if (parameters.length >= 1)
      -      {
      -
      -         try
      -         {
      -
      -            // Assume the first parameter is the system name.
      -
      -            system = parameters[0];
      -
      -            // Create an AS400 object for the system that has the file.
      -
      -            AS400 as400 = new AS400(system);
      -
      -
      -            // Create a record description for the file.  The file is QCUSTCDT
      -            // in library QIWS.
      -  
      -            ZonedDecimalFieldDescription customerNumber =
      -                          new ZonedDecimalFieldDescription(new AS400ZonedDecimal(6,0),
      -                                                           "CUSNUM");
      -            CharacterFieldDescription lastName =
      -                          new CharacterFieldDescription(new AS400Text(8, as400), "LSTNAM");
      -
      -            CharacterFieldDescription initials =
      -                          new CharacterFieldDescription(new AS400Text(3, as400), "INIT");
      -
      -            CharacterFieldDescription street =
      -                          new CharacterFieldDescription(new AS400Text(13, as400), "STREET");
      -
      -            CharacterFieldDescription city =
      -                          new CharacterFieldDescription(new AS400Text(6, as400), "CITY");
      -
      -            CharacterFieldDescription state =
      -                          new CharacterFieldDescription(new AS400Text(2, as400), "STATE");
      -
      -            ZonedDecimalFieldDescription zipCode =
      -                          new ZonedDecimalFieldDescription(new AS400ZonedDecimal(5,0),
      -                                                           "ZIPCOD");
      -            ZonedDecimalFieldDescription creditLimit =
      -                          new ZonedDecimalFieldDescription(new AS400ZonedDecimal(4,0),
      -                                                           "CDTLMT");
      -            ZonedDecimalFieldDescription chargeCode =
      -                          new ZonedDecimalFieldDescription(new AS400ZonedDecimal(1,0),
      -                                                           "CHGCOD");
      -            ZonedDecimalFieldDescription balanceDue =
      -                          new ZonedDecimalFieldDescription(new AS400ZonedDecimal(6,2),
      -                                                           "BALDUE");
      -            ZonedDecimalFieldDescription creditDue =
      -                          new ZonedDecimalFieldDescription(new AS400ZonedDecimal(6,2),
      -                                                           "CDTDUE");
      -       
      - 
      -            // The record format name should be specified for a DDM file.
      -            // In the case of the QCUSTCDT file, its record format is called CUSREC.
      -
      -            RecordFormat qcustcdt = new RecordFormat("CUSREC");
      -
      -            qcustcdt.addFieldDescription(customerNumber);
      -            qcustcdt.addFieldDescription(lastName);
      -            qcustcdt.addFieldDescription(initials);
      -            qcustcdt.addFieldDescription(street);
      -            qcustcdt.addFieldDescription(city);
      -            qcustcdt.addFieldDescription(state);
      -            qcustcdt.addFieldDescription(zipCode);
      -            qcustcdt.addFieldDescription(creditLimit);
      -            qcustcdt.addFieldDescription(chargeCode);
      -            qcustcdt.addFieldDescription(balanceDue);
      -            qcustcdt.addFieldDescription(creditDue);
      -
      -
      -            // Create the sequential file object that represents the
      -            // file on the system.  We use a QSYSObjectPathName object
      -            // to get the name of the file into the correct format.
      -
      -            QSYSObjectPathName fileName = new QSYSObjectPathName("QIWS",
      -                                                                 "QCUSTCDT",
      -                                                                 "FILE");
      -
      -            SequentialFile file = new SequentialFile(as400, fileName.getPath());
      -
      -
      -            // Let the file object know the format of the records.
      -
      -            file.setRecordFormat(qcustcdt);
      -
      -
      -            // Open the file for read-only access.  Specify a blocking
      -            // factor of 10 (the file object will get 10 records when
      -            // it accesses the system for data).  Do not use commitment
      -            // control.
      -
      -            file.open(SequentialFile.READ_ONLY,
      -                      10,
      -                      SequentialFile.COMMIT_LOCK_LEVEL_NONE);
      -
      -
      -            // Read the first record of the file.
      -
      -            Record data = file.readNext();
      -
      -
      -            // Loop while there are records in the file (while we have not
      -            // reached end-of-file).
      -
      -            while (data != null)
      -            {
      -
      -               // Display the record only if balance due is greater than
      -               // zero.  In that case display the customer name and
      -               // the balance due.  The following code pulls fields out
      -               // of the record by field name.  As the field is retrieved
      -               // from the record it is converted from i5/OS format to
      -               // Java format.
      -
      -               if (((BigDecimal)data.getField("BALDUE")).floatValue() > 0.0)
      -               {
      -                  System.out.print((String) data.getField("INIT") + "  ");
      -                  System.out.print((String) data.getField("LSTNAM") + "  ");
      -                  System.out.println((BigDecimal) data.getField("BALDUE"));
      -               }
      -
      -               // Read the next record in the file.
      -
      -               data = file.readNext();
      -            }
      -
      -
      -            // When there are no more records to read, disconnect from the system.
      -
      -            as400.disconnectAllServices();
      -         }
      -
      -         catch (Exception e)
      -         {
      -
      -            // If any of the above operations failed, print an error message
      -            // and output the exception.
      -
      -            System.out.println("Could not read the file");
      -            System.out.println(e);
      -         }
      -      }
      -
      -
      -      // Display help text when parameters are incorrect.
      -
      -      else
      -      {
      -         System.out.println("");
      -         System.out.println("");
      -         System.out.println("");
      -         System.out.println("Parameters are not correct.  Command syntax is:");
      -         System.out.println("");
      -         System.out.println("   RLReadFile as400");
      -         System.out.println("");
      -         System.out.println("Where");
      -         System.out.println("");
      -         System.out.println("   as400 = system that contains the file");
      -         System.out.println("");
      -         System.out.println("For example:");
      -         System.out.println("");
      -         System.out.println("   RLReadFile mySystem");
      -         System.out.println("");
      -         System.out.println("");
      -         System.out.println("Note, this program reads data base file QIWS/QCUSTCDT.  ");
      -         System.out.println("");
      -         System.out.println("");
      -      }
      -
      -      System.exit(0);
      -
      -   }
      -}
      - - diff --git a/cvsroot/src/com/ibm/as400/access/doc-files/SQLTypes.html b/cvsroot/src/com/ibm/as400/access/doc-files/SQLTypes.html deleted file mode 100644 index 1421bcbf2..000000000 --- a/cvsroot/src/com/ibm/as400/access/doc-files/SQLTypes.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - -IBM Toolbox for Java: JDBC SQL Types - - - - - -

      JDBC SQL Types

      - -

      Unsupported SQL Types

      - -

      Not all of the SQL types described by the JDBC specification -are supported by DB2 for i5/OS. In the cases where a SQL type -is not supported, the JDBC driver substitutes a similar SQL type.

      - -

      The following table lists the SQL types that are not supported -and the SQL type that JDBC driver substitutes for each.

      - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Unsupported SQL typeSubstituted SQL type
      BITSMALLINT
      TINYINTSMALLINT
      BIGINT (on OS/400 Version 4 Release 4 and previous)INTEGER
      LONGVARCHARVARCHAR
      LONGVARBINARYVARBINARY
      - -

      Note: BIGINT is supported on OS/400 V4R5 and later.

      - - - diff --git a/cvsroot/src/com/ibm/as400/access/doc-files/SpooledFileAttrs.html b/cvsroot/src/com/ibm/as400/access/doc-files/SpooledFileAttrs.html deleted file mode 100644 index 846f03446..000000000 --- a/cvsroot/src/com/ibm/as400/access/doc-files/SpooledFileAttrs.html +++ /dev/null @@ -1,710 +0,0 @@ - - - - - - IBM Toolbox for Java: Spooled file attributes - - - - - - - -

      Spooled file attributes

      - -
      -

      Retrieve attributes

      - -

      The following attributes may be retrieved for a spooled file -using the appropriate getIntegerAttribute(), getStringAttribute(), or -getFloatAttribute() method : -

      - - - -
      -

      Set attributes

      - -

      The following attributes may be set for a spooled file using -the setAttributes() method: -

      - - - -
      - - diff --git a/cvsroot/src/com/ibm/as400/access/doc-files/SystemProperties.html b/cvsroot/src/com/ibm/as400/access/doc-files/SystemProperties.html deleted file mode 100644 index 405780d0b..000000000 --- a/cvsroot/src/com/ibm/as400/access/doc-files/SystemProperties.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - -IBM Toolbox for Java: System properties - - - - - -

      System properties

      - -

      You can specify system properties to configure various aspects of the IBM - Toolbox for Java. For example, you can use system properties to define a proxy - server or a level of tracing. System properties are useful for convenient runtime - configuration without needing to recompile code. System properties work like - environment variables in that when you change a system property during runtime, - the change is generally not reflected until the next time you run the application.

      - -

      There are several ways that you can set system properties:

      - -
        -
      • Using the java.lang.System.setProperties() method -

        You can set system properties programmatically by using the java.lang.System.setProperties() - method.

        -

        For example, the following code sets the com.ibm.as400.access.AS400.proxyServer - property to hqoffice:

        -
        Properties systemProperties = System.getProperties();
        -   systemProperties.put ("com.ibm.as400.access.AS400.proxyServer", "hqoffice");
        -   System.setProperties (systemProperties);
        -
      • -
      • Using the -D option of the java command -

        Many environments allow you to set system properties when running applications - from a command line by using the -D option of the java - command.

        -

        For example, the following program runs the application called Inventory - with the com.ibm.as400.access.AS400.proxyServer property set - to hqoffice:

        -
           java -Dcom.ibm.as400.access.AS400.proxyServer=hqoffice Inventory
        -
      • -
      • Using a jt400.properties file -

        In some environments, it may be inconvenient to instruct all users to set - their own system properties. As an alternative, you can specify IBM Toolbox - for Java system properties in a file called jt400.properties that is searched - for as if it is part of the com.ibm.as400.access package. In other words, - place the jt400.properties file in a com/ibm/as400/access directory pointed - to by the classpath.

        -

        For example, set the com.ibm.as400.access.AS400.proxyServer - property to hqoffice by inserting the following line into the - jt400.properties file:

        -
           com.ibm.as400.access.AS400.proxyServer=hqoffice
        -

        The backslash character (\) functions as an escape character in properties - files. Specify a literal backslash character by using two backslashes (\\).

        -

        Modify this sample of a jt400.properties - file for your environment.

        -
      • -
      • Using a Properties class -

        Some browsers do not load properties files without explicitly changing - security settings. However, most browsers do allow properties in .class - files, so IBM Toolbox for Java system properties can also be specified - by a class called com.ibm.as400.access.Properties which extends java.util.Properties.

        -

        For example, to set the com.ibm.as400.access.AS400.proxyServer - property to hqoffice, use the following Java code:

        -
           package com.ibm.as400.access;
        -
        -   public class Properties
        -   extends java.util.Properties
        -   {
        -      public Properties ()
        -      {
        -         put ("com.ibm.as400.access.AS400.proxyServer", "hqoffice");
        -      }
        -   }
        -

        Modify and compile this sample - of a Properties.java source file for your environment.

        -
      • -
      - -

      If an IBM Toolbox for Java system property is set using more than one of -the mechanisms described above, then the precedence is as follows (in order of -decreasing precedence):

      - -
        -
      1. The system property set programmatically using java.lang.System.setProperties()
      2. -
      3. The system property set using the -D option of the java command
      4. -
      5. The system property set using a Properties class
      6. -
      7. The system property set using a jt400.properties file
      8. -
      - -

      IBM Toolbox for Java supports the following system properties:

      - - -

      Proxy server properties

      - - - - - - - - - - - - - - - - - - - - - - -
      Proxy server propertyDescription
      com.ibm.as400.access.AS400.proxyServerSpecifies the proxy server host name and port number, using the format: -
         hostName:portNumber
      - The port number is optional.
      com.ibm.as400.access.SecureAS400.proxyEncryptionMode - -

      Specifies which portion of the proxy data flow is encrypted by using - SSL. Valid values are:

      -
        -
      • 1 = Proxy client to proxy server
      • -
      • 2 = Proxy server to IBM i system
      • -
      • 3 = Proxy client to proxy server and proxy server to IBM i system -
      • -
      -
      com.ibm.as400.access.TunnelProxyServer.clientCleanupInterval - Specifies how often, in seconds, the proxy server looks for idle connections. - The proxy server starts a thread to look for clients that are no longer - communicating. Use this property to set how often the thread looks for idle - connections.
      com.ibm.as400.access.TunnelProxyServer.clientLifetime - Specifies how long, in seconds, a client can be idle before the proxy - server removes references to the objects so the JVM can garbage collect - them. The proxy server starts a thread to look for clients that are no longer - communicating. Use this property to set how long a client can be idle before - performing garbage collection on it.
      - -

      Trace properties

      - - - - - - - - - - - - - - - - - -
      Trace propertyDescription
      com.ibm.as400.access.Trace.categorySpecifies which trace categories to enable. This is a comma-delimited - list containing any combination of trace categories. The complete list of - trace categories is defined in the - Trace class.
      com.ibm.as400.access.Trace.fileSpecifies the file to which trace output is written. The - default is to write trace output to System.out.
      com.ibm.as400.access.ServerTrace.JDBCSpecifies which trace categories to start on the JDBC server - job. For information about supported values, see the JDBC - server trace property.
      - -

      CommandCall/ProgramCall properties

      - - - - - - - - - - -
      CommandCall/ProgramCall propertyDescription
      com.ibm.as400.access.CommandCall.threadSafeSpecifies whether CommandCalls should be assumed to be thread-safe. If true, - all CommandCalls are assumed to be thread-safe. If false, all - CommandCalls are assumed to be non-thread-safe. This property is ignored - for a given CommandCall object if either CommandCall.setThreadSafe(true/false) - or AS400.setMustUseSockets(true) has been performed on the - object. -
      com.ibm.as400.access.ProgramCall.threadSafeSpecifies whether ProgramCalls should be assumed to be thread-safe. If true, - all ProgramCalls are assumed to be thread-safe. If false, all - ProgramCalls are assumed to be non-thread-safe. This property is ignored - for a given ProgramCall object if either ProgramCall.setThreadSafe(true/false) - or AS400.setMustUseSockets(true) has been performed on the - object. -
      - - diff --git a/cvsroot/src/com/ibm/as400/access/doc-files/SystemPropertiesSample1.html b/cvsroot/src/com/ibm/as400/access/doc-files/SystemPropertiesSample1.html deleted file mode 100644 index d72a03c5f..000000000 --- a/cvsroot/src/com/ibm/as400/access/doc-files/SystemPropertiesSample1.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - -IBM Toolbox for Java System Properties Example - - - - -

      Example: Properties File

      - -
      -#=========================================================#
      -# IBM Toolbox for Java                                 #
      -#---------------------------------------------------------#
      -# Sample properties file                                  #
      -#                                                         #
      -# Name this file jt400.properties and store it in a       #
      -# com/ibm/as400/access directory that is pointed to by    #
      -# the classpath.                                          #
      -#=========================================================#
      -
      -#---------------------------------------------------------#
      -# Proxy server system properties                          #
      -#---------------------------------------------------------#
      -
      -# This system property specifies the proxy server host name
      -# and port number, specified in the format: hostName:portNumber
      -# The port number is optional.
      -com.ibm.as400.access.AS400.proxyServer=hqoffice
      -
      -# This system property specifies which portion of the proxy
      -# data flow is encrypted via SSL.  Valid values are:
      -#   1 - Proxy client to proxy server
      -#   2 - Proxy server to AS/400
      -#   3 - Proxy client to proxy, and proxy server to AS/400
      -com.ibm.as400.access.SecureAS400.proxyEncryptionMode=1
      -
      -# This system property specifies how often, in seconds,
      -# the proxy server will look for idle connections. The
      -# proxy server starts a thread to look for clients that are
      -# no longer communicating. Use this property to set how
      -# often the thread looks for idle connections.
      -com.ibm.as400.access.TunnelProxyServer.clientCleanupInterval=7200
      -
      -# This system property specifies how long, in seconds, a
      -# client can be idle before it is cleaned up. The proxy server
      -# starts a thread to look for clients that are no longer
      -# communicating. Use this property to set long a client can
      -# be idle before it is cleaned up.
      -com.ibm.as400.access.TunnelProxyServer.clientLifetime=2700
      -
      -
      -#---------------------------------------------------------#
      -# Trace system properties                                 #
      -#---------------------------------------------------------#
      -
      -# This system property specifies which trace categories to enable.
      -# This is a comma-delimited list containing any combination of trace
      -# categories.  The complete list of trace categories is defined in
      -# the Trace class.
      -com.ibm.as400.access.Trace.category=error,warning,information
      -
      -# This system property specifies the file to which trace output
      -# is written.  The default is to write trace output to System.out.
      -com.ibm.as400.access.Trace.file=c:\\temp\\trace.out
      -
      -
      -#---------------------------------------------------------#
      -# Command Call system properties                          #
      -#---------------------------------------------------------#
      -
      -# This system property specifies whether CommandCalls should 
      -# be assumed to be thread-safe. If true, all CommandCalls are 
      -# assumed to be thread-safe. If false, all CommandCalls are 
      -# assumed to be non-thread-safe. This property is ignored 
      -# for a given CommandCall object if either 
      -# CommandCall.setThreadSafe(true/false) or
      -# AS400.setMustUseSockets(true) has been performed on the object.
      -com.ibm.as400.access.CommandCall.threadSafe=true
      -
      -
      -#---------------------------------------------------------#
      -# Program Call system properties                          #
      -#---------------------------------------------------------#
      -
      -# This system property specifies whether ProgramCalls should 
      -# be assumed to be thread-safe. If true, all ProgramCalls are 
      -# assumed to be thread-safe. If false, all ProgramCalls are 
      -# assumed to be non-thread-safe. This property is ignored 
      -# for a given ProgramCall object if either 
      -# ProgramCall.setThreadSafe(true/false) or
      -# AS400.setMustUseSockets(true) has been performed on the object.
      -com.ibm.as400.access.ProgramCall.threadSafe=true
      -
      -
      -# End
      -
      - - diff --git a/cvsroot/src/com/ibm/as400/access/doc-files/SystemPropertiesSample2.html b/cvsroot/src/com/ibm/as400/access/doc-files/SystemPropertiesSample2.html deleted file mode 100644 index a97634ff3..000000000 --- a/cvsroot/src/com/ibm/as400/access/doc-files/SystemPropertiesSample2.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - -IBM Toolbox for Java Example: System Properties - - - - -

      Example: System Properties Class Source File

      - -
      -
      -//=========================================================
      -// IBM Toolbox for Java                                 
      -//---------------------------------------------------------
      -// Sample properties class source file                     
      -//                                                         
      -// Compile this source file and store the class file in    
      -// the classpath.                                          
      -//=========================================================
      -package com.ibm.as400.access;
      -
      -public class Properties
      -extends java.util.Properties
      -{
      -   public Properties ()
      -   {
      -      /*---------------------------------------------------------*/
      -      /* Proxy server system properties                          */
      -      /*---------------------------------------------------------*/
      -
      -      // This system property specifies the proxy server host name 
      -      // and port number, specified in the format: hostName:portNumber
      -      // The port number is optional.
      -      put ("com.ibm.as400.access.AS400.proxyServer", "hqoffice");
      -                                                        
      -      // This system property specifies which portion of the proxy          
      -      // data flow is encrypted via SSL.  Valid values are:                 
      -      //   1 - Proxy client to proxy server                                 
      -      //   2 - Proxy server to System i                                       
      -      //   3 - Proxy client to proxy, and proxy server to System i            
      -      put("com.ibm.as400.access.SecureAS400.proxyEncryptionMode", "1");
      -                                                                           
      -      // This system property specifies how often, in seconds,              
      -      // the proxy server will look for idle connections. The               
      -      // proxy server starts a thread to look for clients that are          
      -      // no longer communicating. Use this property to set how              
      -      // often the thread looks for idle connections.                       
      -      put("com.ibm.as400.access.TunnelProxyServer.clientCleanupInterval", "7200");
      -                                                                           
      -      // This system property specifies how long, in seconds, a             
      -      // client can be idle before it is cleaned up. The proxy server       
      -      // starts a thread to look for clients that are no longer             
      -      // communicating. Use this property to set long a client can          
      -      // be idle before it is cleaned up.                                   
      -      put("com.ibm.as400.access.TunnelProxyServer.clientLifetime", "2700");           
      -                                                        
      -      /*---------------------------------------------------------*/
      -      /* Trace system properties                                 */
      -      /*---------------------------------------------------------*/
      -
      -      // This system property specifies which trace categories to enable.
      -      // This is a comma-delimited list containing any combination of trace 
      -      // categories.  The complete list of trace categories is defined in 
      -      // the Trace class.
      -      put ("com.ibm.as400.access.Trace.category", "error,warning,information");
      -
      -      // This system property specifies the file to which trace output 
      -      // is written.  The default is to write trace output to System.out.
      -      put ("com.ibm.as400.access.Trace.file", "c:\temp\trace.out");  
      -      
      -      
      -      /*---------------------------------------------------------*/
      -      /* Command Call system properties                          */
      -      /*---------------------------------------------------------*/
      -
      -      // This system property specifies whether CommandCalls should 
      -      // be assumed to be thread-safe. If true, all CommandCalls are 
      -      // assumed to be thread-safe. If false, all CommandCalls are 
      -      // assumed to be non-thread-safe. This property is ignored 
      -      // for a given CommandCall object if either 
      -      // CommandCall.setThreadSafe(true/false) or
      -      // AS400.setMustUseSockets(true) has been performed on the object.
      -      put ("com.ibm.as400.access.CommandCall.threadSafe", "true");
      -      
      -
      -      /*---------------------------------------------------------*/
      -      /* Program Call system properties                          */
      -      /*---------------------------------------------------------*/
      -
      -      // This system property specifies whether ProgramCalls should 
      -      // be assumed to be thread-safe. If true, all ProgramCalls are 
      -      // assumed to be thread-safe. If false, all ProgramCalls are 
      -      // assumed to be non-thread-safe. This property is ignored 
      -      // for a given ProgramCall object if either 
      -      // ProgramCall.setThreadSafe(true/false) or
      -      // AS400.setMustUseSockets(true) has been performed on the object.
      -      put ("com.ibm.as400.access.ProgramCall.threadSafe", "true");
      -   }
      -}
      -
      - - - diff --git a/cvsroot/src/com/ibm/as400/access/doc-files/TransInStr.html b/cvsroot/src/com/ibm/as400/access/doc-files/TransInStr.html deleted file mode 100644 index 7f6050614..000000000 --- a/cvsroot/src/com/ibm/as400/access/doc-files/TransInStr.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - -IBM Toolbox for Java Example: Reading and Transforming Spooled File Data - - -

      Examples using PrintObjectPageInputStream and PrintObjectTransformedInputStream

      -

      -The following examples demonstrate how to set up a PrintParameterList to obtain -different transformations when reading spooled file data. In the code -segments that follow, assume a spooled file already exists on a system, -and the createSpooledFile() method creates -an instance of the SpooledFile class representing the spooled file. -

      -

      Example of PrintObjectPageInputStream

      -The following example shows how to create a PrintObjectPageInputStream object for -reading pages of data formatted as GIF images. -In this case, each page from the spooled file will be transformed into -a GIF image. A GIF workstation customization object is used to -specify the data transform. -
      -// Create a spooled file
      -SpooledFile splF = createSpooledFile();
      -
      -// Set up print parameter list
      -PrintParameterList printParms = new PrintParameterList();
      -printParms.setParameter(PrintObject.ATTR_WORKSTATION_CUST_OBJECT, "/QSYS.LIB/QWPGIF.WSCST");
      -printParms.setParameter(PrintObject.ATTR_MFGTYPE, "*WSCST");
      -
      -// Create a page input stream from the spooled file
      -PrintObjectPageInputStream is = splF.getPageInputStream(printParms);
      -
      -

      -

      Example of PrintObjectTransformedInputStream

      -The following example shows how to create a PrintObjectTransformedInputStream object for -reading data formatted as TIFF. -A TIFF (G4 compression) workstation customization object is used -to specify the data transform. -
      -// Create a spooled file
      -SpooledFile splF = createSpooledFile();
      -
      -// Set up print parameter list
      -PrintParameterList printParms = new PrintParameterList();
      -printParms.setParameter(PrintObject.ATTR_WORKSTATION_CUST_OBJECT, "/QSYS.LIB/QWPTIFFG4.WSCST");
      -printParms.setParameter(PrintObject.ATTR_MFGTYPE, "*WSCST");
      -
      -// Create a transformed input stream from the spooled file
      -PrintObjectTransformedInputStream is = splF.getTransformedInputStream(printParms);
      -
      -

      -

      Example of PrintObjectTransformedInputStream using manufacturer type and model

      -The following example shows how to create a PrintObjectTransformedInputStream object for -reading data formatted for output to an ASCII printer. -A manufacturer type and model of *HP4 is used to specify the data transform. -
      -// Create a spooled file
      -SpooledFile splF = createSpooledFile();
      -
      -// Set up print parameter list
      -PrintParameterList printParms = new PrintParameterList();
      -printParms.setParameter(PrintObject.ATTR_MFGTYPE, "*HP4");
      -
      -// Create a transformed input stream from the spooled file
      -PrintObjectTransformedInputStream is = splF.getTransformedInputStream(printParms);
      -
      - - diff --git a/cvsroot/src/com/ibm/as400/access/doc-files/WriterJobAttrs.html b/cvsroot/src/com/ibm/as400/access/doc-files/WriterJobAttrs.html deleted file mode 100644 index 584f2b93a..000000000 --- a/cvsroot/src/com/ibm/as400/access/doc-files/WriterJobAttrs.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - -IBM Toolbox for Java: Writer job attributes - - - -

      Writer Job Attributes

      - -
      - -

      Retrieve Attributes

      - -

      The following attributes may be retrieved for a writer job using the appropriate -getIntegerAttribute(), getStringAttribute(), or getFloatAttribute() method : - -

      - -
      - -

      Set Attributes

      - -

      Attributes are not allowed to be set for a writer job. - -


      - - - diff --git a/cvsroot/src/com/ibm/as400/access/doc-files/codedisclaimer.htm b/cvsroot/src/com/ibm/as400/access/doc-files/codedisclaimer.htm deleted file mode 100644 index 7956edbec..000000000 --- a/cvsroot/src/com/ibm/as400/access/doc-files/codedisclaimer.htm +++ /dev/null @@ -1,25 +0,0 @@ - - -Code disclaimer information - - - - - - - - -

      Code disclaimer information

      -

      This document contains programming examples.

      -

      IBM grants you a nonexclusive copyright license to use all -programming code examples from which you can generate similar function tailored -to your own specific needs.

      -

      All sample code is provided by IBM for illustrative purposes only. These -examples have not been thoroughly tested under all conditions. IBM, therefore, -cannot guarantee or imply reliability, serviceability, or function of these -programs.

      -

      All programs contained herein are provided to you "AS IS" without any warranties -of any kind. The implied warranties of non-infringement, merchantability and -fitness for a particular purpose are expressly disclaimed.

      - - diff --git a/cvsroot/src/com/ibm/as400/access/doc-files/recordxmp.html b/cvsroot/src/com/ibm/as400/access/doc-files/recordxmp.html deleted file mode 100644 index 260b1af47..000000000 --- a/cvsroot/src/com/ibm/as400/access/doc-files/recordxmp.html +++ /dev/null @@ -1,185 +0,0 @@ - - - -IBM Toolbox for Java Example: Using the Record classes - - - -

      Using the FieldDescription, RecordFormat, and Record classes

      -

      The following examples show how you can use the FieldDescription, RecordFormat -and Record classes with data queues.

      -

      Example: Using the FieldDescription classes

      -

      You can use the FieldDescription classes can to describe the different types of data that make up -an entry on a data queue. These examples assume the following format for entries on the data queue:

      -
      -  Message number    Sender    Time sent      Message text     Reply required
      -        |             |           |               |                |
      -     bin(4)        char(50)    char(8)         char(1024)        char(1)
      -
      -
      -  // Create field descriptions for the entry data
      -  BinaryFieldDescription msgNumber = new BinaryFieldDescription(new AS400Bin4(), "msgnum");
      -  CharacterFieldDescription sender = new CharacterFieldDescription(new AS400Text(50), "sender");
      -  CharacterFieldDescription timeSent = new CharacterFieldDescription(new AS400Text(8), "timesent");
      -  CharacterFieldDescription msgText = new CharacterFieldDescription(new AS400Text(1024), "msgtext");
      -  CharacterFieldDescription replyRequired = new CharacterFieldDescription(new AS400Text(1), "replyreq");
      -
      - -

      Using the RecordFormat class

      -

      You can use the RecordFormat class to describe the data that makes up the data queue entry.

      -

      Example: Defining RecordFormat and using it dynamically

      -The following example uses the RecordFormat class to describe the format of the data queue entry and then dynamically uses it to retrieve a record:

      -
      -  RecordFormat entryFormat = new RecordFormat();
      -  // Describe the fields in an entry on the data queue
      -  entryFormat.addFieldDescription(msgNumber);
      -  entryFormat.addFieldDescription(sender);
      -  entryFormat.addFieldDescription(timeSent);
      -  entryFormat.addFieldDescription(msgText);
      -  entryFormat.addFieldDescription(replyRequired);
      -
      -  // Get a record based on the format of the entries on the data queue
      -  Record rec = entryFormat.getNewRecord();
      - -Example: Defining RecordFormat statically -

      The following example defines the record format statically, which allows many programs to use the format without coding the record format multiple times.

      -
      -  public class MessageEntryFormat extends RecordFormat
      -  {
      -    // The field descriptions are contained in the class
      -    static BinaryFieldDescription msgNumber = new BinaryFieldDescription(new AS400Bin4(), "msgnum");
      -    static CharacterFieldDescription sender = new CharacterFieldDescription(new AS400Text(50), "sender");
      -    static CharacterFieldDescription timeSent = new CharacterFieldDescription(new AS400Text(8), "timesent");
      -    static CharacterFieldDescription msgText = new CharacterFieldDescription(new AS400Text(1024), "msgtext");
      -    static CharacterFieldDescription replyRequired = new CharacterFieldDescription(new AS400Text(1), "replyreq");
      -
      -    public MessageEntryFormat()
      -    {
      -      // We will name this format for posterity
      -      super("MessageEntryFormat");
      -      // Add the field descriptions
      -      addFieldDescription(msgNumber);
      -      addFieldDescription(sender);
      -      addFieldDescription(timeSent);
      -      addFieldDescription(msgText);
      -      addFieldDescription(replyRequired);
      -    }
      -  }
      -
      - -Example: Using RecordFormat statically -

      The following example shows how a Java program can use a statically defined RecordFormat:

      -
      -  MessageEntryFormat entryFormat = new MessageEntryFormat();
      -  // Get a record based on the format of the entries on the data queue
      -  Record rec = entryFormat.getNewRecord();
      -
      -

      Using the Record class

      -

      You can use the Record class to access individual fields of data queue entries.

      -Example: Using a generic Record object -
      -  // Instantiate our data queue object
      -  DataQueue dq = new DataQueue(new AS400(), "/qsys.lib/mylib.lib/myq.dtaq");
      -
      -  // Read an entry
      -  DataQueueEntry dqEntry = null;
      -  try
      -  {
      -    dqEntry = dq.read();
      -  }
      -  catch(Exception e)
      -  {
      -    // Handle any exceptions
      -  }
      -
      -  // Get a record object from our record format, initializing it with the data from the entry we
      -  // just read.
      -  Record rec = entryFormat.getNewRecord(dqEntry.getData());
      -
      -  // Output the complete entry as a String.  The contents of the record are converted to Java Objects
      -  // based on the record format of the entry.
      -  System.out.println(rec.toString());
      -  // Get the contents of the individual fields of the entry.  Each field's contents are converted to
      -  // a Java Object.
      -  Integer num = (Integer)rec.getField(0);    // Retrieve contents by index
      -  String s = (String)rec.getField("sender");// Retrieve contents by field name
      -  String text = (String)rec.getField(3);    // Retrieve the message text
      -  // Output the data
      -  System.out.println(num + " " + s + " " + text);
      -
      - -Example: Using a specific Record object -

      You can also statically define and use a Record specific to the format of this data queue, which allows you to provide get() and set() methods for the fields that are more meaningfully named than getField() and setField(). Also, by using the statically defined specific Record, you can return basic Java types instead of objects, and you can identify the return type for your user.

      -

      Note that this example must explicitly cast the correct Java object.

      -
      -  public class MessageEntryRecord extends Record
      -  {
      -    static private RecordFormat format = new MessageEntryFormat();
      -
      -    public MessageEntryRecord()
      -    {
      -      super(format);
      -    }
      -
      -    public int getMessageNumber()
      -    {
      -      // Return the message number as an int.  Note: We know our record format and therefore
      -      // know the names of our fields.  It is safest to get the field by name in case a field
      -      // has been inserted into the format unbeknownst to us.
      -      return ((Integer)getField("msgnum")).intValue();
      -    }
      -
      -    public String getMessageText()
      -    {
      -      // Return the text of the message
      -      return (String)getField("msgtext");
      -    }
      -
      -    public String getSender()
      -    {
      -      // Return the sender of the message
      -      return (String)getField("sender");
      -    }
      -
      -    public String getTimeSent()
      -    {
      -      // Return the sender of the message
      -      return (String)getField("timesent");
      -    }
      -
      -    // We could add setters here
      -  }
      - -Example: Returning a new MessageEntryRecord -

      We need to override the getNewRecord() method in the MessageEntryFormat class - (in the example above) in order to - return a new MessageEntryRecord. To override the method, add the following to - the MessageEntryFormat class:

      -
      -    public Record getNewRecord(byte[] data)
      -    {
      -      Record r = new MessageEntryRecord();
      -      r.setContents(data);
      -      return r;
      -    }
      -
      -

      After adding the new getNewRecord() method, you can use the MessageEntryRecord - to interpret the data queue entry:

      -
      -  // Get a record object from our record format, initializing it with the data from the entry we
      -  // just read. Note the use of the new overridden method getNewRecord().
      -  MessageEntryRecord rec = (MessageEntryRecord)entryFormat.getNewRecord(dqEntry.getData());
      -
      -  // Output the complete entry as a String.  The contents of the record are converted to Java Objects
      -  // based on the record format of the entry.
      -  System.out.println(rec.toString());
      -  // Get the contents of the individual fields of the entry.  Each field's contents are converted to
      -  // a Java Object.
      -  int num = rec.getMessageNumber();    // Retrieve the message number as an int
      -  String s = rec.getSender();         // Retrieve the sender
      -  String text = rec.getMessageText(); // Retrieve the message text
      -  // Output the data
      -  System.out.println(num + " " + s + " " + text);
      -
      - - diff --git a/cvsroot/src/com/ibm/as400/access/list/OpenList.java b/cvsroot/src/com/ibm/as400/access/list/OpenList.java deleted file mode 100644 index f575baa6d..000000000 --- a/cvsroot/src/com/ibm/as400/access/list/OpenList.java +++ /dev/null @@ -1,507 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OpenList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access.list; - -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.Serializable; -import java.util.Enumeration; -import java.util.Vector; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400Exception; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.BinaryConverter; -//import com.ibm.as400.access.CharConverter; -import com.ibm.as400.access.ErrorCodeParameter; -import com.ibm.as400.access.ErrorCompletingRequestException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ObjectDoesNotExistException; -import com.ibm.as400.access.ProgramCall; -import com.ibm.as400.access.ProgramParameter; -import com.ibm.as400.access.Trace; - -/** - Abstract base class that wraps a list of resources on the system. OpenList classes are Java wrappers for system API's that are known as "Open List API's" or "QGY API's". -

      The way an open list works is that a request is initially sent to the system with selection, filter, and sort information that is to be applied to the list of resources. The system compiles a list of resources that satisfy the requested set of selection parameters. The OpenList class can then retrieve the list all at once, or in pieces, depending upon the memory and performance requirements of the application. -

      The system can be told explicitly to compile the list of resources by calling {@link #open open()}. If {@link #open open()} is not called explicitly by the application, an implicit call to {@link #open open()} is made by any of the following methods: {@link #getLength getLength()}, {@link #getItems getItems()}, and {@link #getItems(int,int) getItems(int,int)}. -

      Once the list is open, the application can retrieve resources from the list using either {@link #getItems getItems()} or {@link #getItems(int,int) getItems(offset, length)}. One returns an Enumeration, the other returns an array and allows for arbitrarily indexing into the list on the system. The type of resource returned is determined by the type of subclass that extends OpenList. For example, the SpooledFileOpenList class returns SpooledFileListItem objects when getItems() is called. -

      When an OpenList object is no longer needed by the application, {@link #close close()} should be called to free up resources on the system. If {@link #close close()} is not explicitly called, an attempt will be made to automatically close the list when the OpenList object is {@link #finalize garbage collected}. - **/ -public abstract class OpenList implements Serializable -{ - static final long serialVersionUID = -5967313807836097042L; - - /** - Constant that can be used for APIs that have an error code parameter. An empty error code parameter instructs the remote command server to return error messages via the ProgramCall message list. This allows the ProgramCall logic to handle error conditions rather than the OpenList subclass. All the caller has to do is this: -

      -         ProgramCall pc = new ProgramCall(system, "/LIBRARY.LIB/PROGRAM.PGM", parameters);
      -         if (!pc.run())
      -         {
      -             AS400Message[] errorMessages = pc.getMessageList();
      -             throw new AS400Exception(errorMessages);
      -         }
      -     
      - **/ - protected static final ProgramParameter EMPTY_ERROR_CODE_PARM = new ErrorCodeParameter(); - - /* - Status indicating complete and accurate information. All of the requested records have been returned in the receiver variable of the Open List API. - @see #getInformationStatus - */ - // public static final byte COMPLETE = (byte)0xC3; - - /* - Status indicating incomplete information. An interruption caused the receiver variable to contain incomplete information. - @see #getInformationStatus - */ - // public static final byte INCOMPLETE = (byte)0xC9; - - /* - Status indicating partial and accurate information. Partial information is returned when the receiver variable is full and not all of the records requested are returned. - @see #getInformationStatus - */ - // public static final byte PARTIAL = (byte)0xD7; - - /* - Status indicating that the list is not open. - @see #getInformationStatus - */ - // public static final byte NONE = 0; - - /** - The system object specified on this OpenList's constructor. - @see #getSystem - **/ - protected AS400 system_; - - // Number of objects in the list on the system, updated when open() is called. - private int length_; - // Used by OpenListEnumeration when it calls getItems(int, int). - private int enumerationBlockSize_ = 1000; - // Handle that references the user space used by the open list API's. - private byte[] handle_; - // If the list info has changed, close the old handle before loading the new one. - private boolean closeHandle_ = false; - - // All the enumerations created for this list. - private Vector enumerations_; - - // Date and time created. - // private String creationDate_; - // Information complete indicator. - // private byte informationStatus_; - - /** - Called by subclasses to construct an OpenList object. - @param system The system object representing the system on which the list exists. This cannot be null. - **/ - protected OpenList(AS400 system) - { - super(); - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Constructing OpenList object, system: " + system); - if (system == null) - { - Trace.log(Trace.ERROR, "Parameter 'system' is null."); - throw new NullPointerException("system"); - } - system_ = system; - } - - /** - This method should be implemented by subclasses to call a particular QGY API and return the 80-byte list information parameter. This method is called by open(). - @return The output data from the list information parameter in the call to the QGY API. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - protected abstract byte[] callOpenListAPI() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException; - - /** - Closes the list on the system. This releases any system resources previously in use by this OpenList. -

      Any Enumerations created by this OpenList by calling {@link #getItems getItems} will close, so that a call to nextElement() will throw a NoSuchElementException when they reach the end of their {@link #getEnumerationBlockSize enumeration cache block}. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - public synchronized void close() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Closing open list, handle: ", handle_); - if (handle_ == null) return; - - try - { - // Invalidate all Enumerations this OpenList has created. - if (enumerations_ != null) - { - for (int i = enumerations_.size() - 1; i >= 0; --i) - { - OpenListEnumeration element = (OpenListEnumeration)enumerations_.elementAt(i); - element.close(); - } - enumerations_ = null; - } - - ProgramParameter[] parameters = new ProgramParameter[] - { - new ProgramParameter(handle_), - EMPTY_ERROR_CODE_PARM - }; - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QGY.LIB/QGYCLST.PGM", parameters); - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - } - finally - { - // creationDate_ = null; - // informationStatus_ = 0; - handle_ = null; - closeHandle_ = false; - } - } - - /** - Attempts to close the list on the system when this OpenList object is garbage collected. - **/ - protected void finalize() throws Throwable - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Finalize method for open list invoked."); - try - { - if (system_.isConnected(AS400.COMMAND)) close(); - } - catch (Exception e) - { - if (Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "Exception occurred while finalizing open list with handle:", handle_); - Trace.log(Trace.ERROR, e); - } - } - super.finalize(); - } - - /** - Returns the actual array of Objects that getItems(int,int) returns. Subclasses should implement this method to return instances of their own list item classes. This method is called by getItems(int,int). - @param data The output data from the receiver variable from the call to the QGYGTLE (Get List Entries) API. - @param recordsReturned The number of records returned, as reported in the open list information returned on the call to QGYGTLE. - @param recordLength The length of a record, in bytes, as reported in the open list information returned on the call to QGYGTLE. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - **/ - protected abstract Object[] formatOutputData(byte[] data, int recordsReturned, int recordLength) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException; - - /** - Returns the initial size in bytes of the receiver variable for a particular implementation of an Open List API. Subclasses should implement this method to return an appropriate value. This method is called by getItems(int,int). - @param number The number of records in the list on the system. This is useful if the subclass needs to return a receiver size based on how many records are in the list. - @return The number of bytes to allocate for the receiver variable when the QGYGTLE (Get List Entries) API is called. This number does not have to be calculated exactly, as QGYGTLE will be called repeatedly until the correct size is known. This number is just for the initial call to QGYGTLE. Too low of a value may result in extra API calls, too high of a value may result in wasted bytes being sent and received. - **/ - protected abstract int getBestGuessReceiverSize(int number); - - // I don't want to expose this yet, as asynchronous list processing may be added in the future, and the creation date getter may need to throw exceptions. - /* - Returns the date and time the list was created on the system. - @return The creation date, or null if this list is not open. - */ - // public Date getCreationDate() - // { - // if (creationDate_ == null) return null; - // Calendar c = Calendar.getInstance(); - // c.clear(); - // c.set(Integer.parseInt(creationDate_.substring(0,2)) + 1900, // Year. - // Integer.parseInt(creationDate_.substring(2,4)) - 1, // Month is zero based. - // Integer.parseInt(creationDate_.substring(4,6)), // Day. - // Integer.parseInt(creationDate_.substring(6,8)), // Hour. - // Integer.parseInt(creationDate_.substring(8,10)), // Minute. - // Integer.parseInt(creationDate_.substring(10,12))); // Second. - // return c.getTime(); - // } - - /** - Returns the number of items that Enumerations returned by this OpenList's {@link #getItems getItems()} method will attempt to retrieve from the system and cache. A larger number will result in fewer calls to the system but will take more memory. - @return The block size. The default is 1000 items. - **/ - public int getEnumerationBlockSize() - { - return enumerationBlockSize_; - } - - // I don't want to expose this yet, as asynchronous list processing may be added in the future, and the information complete indicator may need to throw exceptions. - /* - Returns the information complete indicator, which indicates whether all requested information has been supplied on the most recent call to this Open List API. Possible values are: -

        -
      • {@link #COMPLETE COMPLETE} -
      • {@link #INCOMPLETE INCOMPLETE} -
      • {@link #PARTIAL PARTIAL} -
      • {@link #NONE NONE} -
      - @return The status of the information built by the most recent implicit or explicit call to {@link #open open()}. - */ - // public byte getInformationStatus() - // { - // return informationStatus_; - // } - - /** - Returns the number of items in the list the system has built. This method implicitly calls {@link #open open()} to instruct the system to build the list if it hasn't been built already. - @return The number of items, or 0 if no list was retrieved. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @exception OpenListException If the system is unable to correctly generate the list of items. - @see #open - **/ - public synchronized int getLength() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, OpenListException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Getting open list length."); - if (handle_ == null || closeHandle_) open(); - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Length:", length_); - return length_; - } - - /** - Returns the list of items. The Enumeration will retrieve the items from the list built on the system in blocks for performance. The chunk size can be adjusted by using the {@link #setEnumerationBlockSize setEnumerationBlockSize()} method. This method implicity calls {@link #open open()} to instruct the system to build the list if it hasn't been built already. -

      Note that if this OpenList is closed, the Enumeration returned by this method will also be closed, such that a subsequent call to hasMoreElements() returns false and a subsequent call to nextElement() throws a NoSuchElementException. -

      Calling this method in a loop without either (a) closing this OpenList or (b) calling nextElement() on the Enumerations until they are at an end, will result in a memory leak. - @return An Enumeration of objects. The types of objects in the Enumeration are dependent on which particular OpenList subclass is being used. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @exception OpenListException If the system is unable to correctly generate the list of items. - @see #close - @see #open - **/ - public synchronized Enumeration getItems() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, OpenListException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Retrieving open list."); - // Need to get the length. - if (handle_ == null || closeHandle_) open(); - - // Keep track of all Enumerations we create, in case someone closes this OpenList, we can invalidate them. - if (enumerations_ == null) - { - enumerations_ = new Vector(); - } - Enumeration items = new OpenListEnumeration(this, length_); - enumerations_.addElement(items); - return items; - } - - /** - Returns an array of items, which can be a subset of the entire list built on the system. This method allows the user to retrieve the item list from the system in pieces. If a call to {@link #open open()} is made (either implicitly or explicitly), then the items at a given offset will change, so a subsequent call to getItems() with the same listOffset and number will most likely not return the same items as the previous call. - @param listOffset The offset into the list of items. This value must be greater than or equal to 0 and less than the list length, or specify -1 to retrieve all of the items. - @param number The number of items to retrieve out of the list, starting at the specified listOffset. This value must be greater than or equal to 0 and less than or equal to the list length. If the listOffset is -1, this parameter is ignored. - @return The array of retrieved items. The types of items in the array are dependent on which particular OpenList subclass is being used. The length of this array may not necessarily be equal to number, depending upon the size of the list on the system, and the specified listOffset. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @exception OpenListException If the system is unable to correctly generate the list of items. - @see com.ibm.as400.access.Job - @see #close - @see #open - **/ - public synchronized Object[] getItems(int listOffset, int number) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, OpenListException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Retrieving open list, list offset: " + listOffset + ", number:", number); - if (listOffset < -1) - { - Trace.log(Trace.ERROR, "Value of parameter 'listOffset' is not valid:", listOffset); - throw new ExtendedIllegalArgumentException("listOffset (" + listOffset + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (number < 0 && listOffset != -1) - { - Trace.log(Trace.ERROR, "Value of parameter 'number' is not valid:", number); - throw new ExtendedIllegalArgumentException("number (" + number + ")", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - if (handle_ == null || closeHandle_) open(); - - if (listOffset == -1) - { - number = length_; - listOffset = 0; - } - else if (listOffset + number > length_) - { - number = length_ - listOffset; - } - - int lengthOfReceiverVariable = getBestGuessReceiverSize(number); - ProgramParameter[] parameters = new ProgramParameter[] - { - // Receiver variable, output, char(*). - new ProgramParameter(lengthOfReceiverVariable), - // Length of receiver variable, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(lengthOfReceiverVariable)), - // Request handle, input, char(4). - new ProgramParameter(handle_), - // List information, output, char(80). - new ProgramParameter(80), - // Number of records to return, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(number)), - // Starting record, input, binary(4). - new ProgramParameter(BinaryConverter.intToByteArray(listOffset + 1)), - // Error code, I/0, char(*). - EMPTY_ERROR_CODE_PARM - }; - - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QGY.LIB/QGYGTLE.PGM", parameters); - - byte[] listInformation = null; - int recordsReturned = 0; - do - { - if (pc.run()) - { - listInformation = parameters[3].getOutputData(); - recordsReturned = BinaryConverter.byteArrayToInt(listInformation, 4); - } - else - { - AS400Message[] messages = pc.getMessageList(); - // GUI0002 means the receiver variable was too small. - if (!messages[0].getID().equals("GUI0002")) throw new AS400Exception(messages); - } - - if (recordsReturned < number) - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Retrieved messages, records returned: " + recordsReturned + ", number:", number); - lengthOfReceiverVariable *= 1 + number / (recordsReturned + 1); - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Updated length: ", lengthOfReceiverVariable); - parameters[0] = new ProgramParameter(lengthOfReceiverVariable); - parameters[1] = new ProgramParameter(BinaryConverter.intToByteArray(lengthOfReceiverVariable)); - } - } while (recordsReturned < number || listInformation == null); - - //int totalRecords = BinaryConverter.byteArrayToInt(listInformation, 0); - int recordLength = BinaryConverter.byteArrayToInt(listInformation, 12); - // informationStatus_ = listInfo[16]; - // CharConverter conv = new CharConverter(system_.getCcsid(), system_); - // creationDate_ = conv.byteArrayToString(listInfo, 17, 13); - int listStatusIndicator = listInformation[30] & 0xFF; - - // '2' means the list has been completely built. - if (listStatusIndicator != 0xF2) - { - if (Trace.isTraceOn()) Trace.log(Trace.ERROR, "Unable to build object list on server, list status indicator:", listStatusIndicator); - throw new OpenListException(listStatusIndicator); - } - - return formatOutputData(parameters[0].getOutputData(), recordsReturned, recordLength); - } - - /** - Returns the system object used by this OpenList. - @return The system. - **/ - public AS400 getSystem() - { - return system_; - } - - /** - Returns whether or not this list is open. - @return true if this list has been either implicitly or explictly {@link #open opened}; false if this list has been {@link #close closed}, or was never opened in the first place, or has had its properties changed such that it no longer accurately represents the list that was built on the system. - **/ - public boolean isOpen() - { - return handle_ == null || closeHandle_; - } - - /** - Loads the list of items on the system. This method instructs the system to build the list of items. This method blocks until the system returns the total number of items it has compiled. A subsequent call to {@link #getItems getItems()} will retrieve the actual object information and attributes for each item in the list from the system. -

      This method updates the list length returned by {@link #getLength getLength()}. -

      If this list is already open, {@link #close close()} is called implicitly. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception InterruptedException If this thread is interrupted. - @exception IOException If an error occurs while communicating with the system. - @exception ObjectDoesNotExistException If the object does not exist on the system. - @exception OpenListException If the system is unable to correctly generate the list of items. - @see #getLength - @see #close - **/ - public synchronized void open() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, OpenListException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Opening object list."); - // Close the previous list. - if (closeHandle_) close(); - - byte[] listInformation = callOpenListAPI(); - if (listInformation == null || listInformation.length < 30) - { - if (Trace.isTraceOn()) Trace.log(Trace.ERROR, "Bad list information returned:", listInformation); - throw new OpenListException(OpenListException.LIST_INFO_NOT_VALID); - } - - int listStatusIndicator = listInformation[30] & 0xFF; - // '2' means the list has been completely built. - if (listStatusIndicator != 0xF2) - { - if (Trace.isTraceOn()) Trace.log(Trace.ERROR, "Unable to build object list on server, list status indicator:", listStatusIndicator); - throw new OpenListException(listStatusIndicator); - } - - length_ = BinaryConverter.byteArrayToInt(listInformation, 0); - handle_ = new byte[4]; - System.arraycopy(listInformation, 8, handle_, 0, 4); - // creationDate_ = conv.byteArrayToString(listInformation, 17, 13); - // informationStatus_ = listInformation[16]; - - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Opened object list, length: " + length_ + ", record length: " + BinaryConverter.byteArrayToInt(listInformation, 12) + ", handle:", handle_); - } - - // Used for Enumerations so they can tell us that they have reached the end. We remove them from our list so they can get garbage collected. - void remove(OpenListEnumeration enum1) - { - enumerations_.removeElement(enum1); - } - - /** - Resets the handle to indicate we should close the list the next time we do something, usually as a result of one of the selection criteria being changed, since that should build a new list on the system. Subclasses should call this method when their list filtering, selection, and sort criteria are changed in order to discard the stale list data on the system and build a new list when open() is called. -

      It is better that a subclass not allow any of its selection criteria to be changed while the list is open, but that is not always desirable, which is why this method exists. - **/ - protected synchronized void resetHandle() - { - if (handle_ != null) closeHandle_ = true; - // creationDate_ = null; - // informationStatus_ = 0; - } - - /** - Sets the number of items that Enumerations returned by this OpenList's {@link #getItems getItems()} method will attempt to retrieve from the system and cache. A larger number will result in fewer calls to the system but will take more memory. - @param enumerationBlockSize The block size. The default is 1000 items. If a number less than 1 is specified, the default block size of 1000 is used. - **/ - public void setEnumerationBlockSize(int enumerationBlockSize) - { - enumerationBlockSize_ = enumerationBlockSize < 1 ? 1000 : enumerationBlockSize; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/list/OpenListEnumeration.java b/cvsroot/src/com/ibm/as400/access/list/OpenListEnumeration.java deleted file mode 100644 index 451203b1d..000000000 --- a/cvsroot/src/com/ibm/as400/access/list/OpenListEnumeration.java +++ /dev/null @@ -1,98 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OpenListEnumeration.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access.list; - -import java.util.Enumeration; -import java.util.NoSuchElementException; - -import com.ibm.as400.access.Trace; - -// Helper class. Used to wrap the OpenList objects with an Enumeration. -final class OpenListEnumeration implements Enumeration -{ - // Reference back to list object. - private OpenList list_; - // Indication if list is closed. - private boolean closed_ = false; - // Total number of objects in the server list. - private int length_; - // Position in the server list. - private int counter_; - // Offset in the server list. - private int listOffset_ = 0; - // Cached objects from list. - private Object[] objectCache_; - // Current position within the cache. - private int cachePosition_ = 0; - - OpenListEnumeration(OpenList list, int length) - { - list_ = list; - length_ = length; - } - - // Called by OpenList when someone closes it. This invalidates us. - synchronized void close() - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "OpenList closed enumeration: " + this); - closed_ = true; - } - - public boolean hasMoreElements() - { - return closed_ && counter_ < listOffset_ || !closed_ && counter_ < length_; - } - - public synchronized Object nextElement() - { - // If we are closed, but we still have objects in the cache, then we might as well return them. - if (closed_ && counter_ >= listOffset_ || !closed_ && counter_ >= length_) - { - throw new NoSuchElementException(); - } - - if (objectCache_ == null || cachePosition_ >= objectCache_.length) - { - try - { - int blockSize = list_.getEnumerationBlockSize(); - objectCache_ = list_.getItems(listOffset_, blockSize); - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Loaded next block in OpenListEnumeration: " + objectCache_.length + " messages at offset " + listOffset_ + " out of " + length_ + " total, using block size " + blockSize + "."); - } - catch (Exception e) - { - if (Trace.isTraceOn()) Trace.log(Trace.ERROR, "Exception while loading nextElement() in OpenListEnumeration:", e); - throw new NoSuchElementException(); - } - cachePosition_ = 0; - listOffset_ += objectCache_.length; - } - ++counter_; - Object obj = objectCache_[cachePosition_]; - // Set to null to reduce memory usage as nextElement() is called. - objectCache_[cachePosition_++] = null; - - // When we reach the end, our Enumeration is now useless. - // We "close" ourselves and notify our Open List that we're used up. - // This aids in garbage collection. - if (counter_ >= length_) - { - closed_ = true; - list_.remove(this); - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "OpenListEnumeration reached last element: " + this); - } - - return obj; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/list/OpenListException.java b/cvsroot/src/com/ibm/as400/access/list/OpenListException.java deleted file mode 100644 index f639499a1..000000000 --- a/cvsroot/src/com/ibm/as400/access/list/OpenListException.java +++ /dev/null @@ -1,75 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OpenListException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access.list; - -/** - Represents an exception that indicates an error has occurred processing an Open List API call on the system. - **/ -public class OpenListException extends Exception -{ - /** - Error indicating that the list information did not exist or there was not enough list information returned to determine the list status. - **/ - public static final int LIST_INFO_NOT_VALID = 0x00100000; - - /** - Status indicating that the building of the list is pending. - **/ - public static final int LIST_STATUS_PENDING = 0x000000F0; - - /** - Status indicating that the list is in the process of being built. - **/ - public static final int LIST_STATUS_BUILDING = 0x000000F1; - - /** - Status indicating an error occurred when building the list. - **/ - public static final int LIST_STATUS_ERROR = 0x000000F3; - - /** - Status indicating the list is primed and ready to be built. - **/ - public static final int LIST_STATUS_PRIMED = 0x000000F4; - - /** - Status indicating there is too much data to be returned. - **/ - public static final int LIST_STATUS_FULL = 0x000000F5; - - - private int status_; - - OpenListException(int status) - { - status_ = status; - } - - /** - Returns the list status indicator for the Open List API call that generated this exception, or the error code. Possible values are: -

        -
      • {@link #LIST_STATUS_PENDING LIST_STATUS_PENDING} -
      • {@link #LIST_STATUS_BUILDING LIST_STATUS_BUILDING} -
      • {@link #LIST_STATUS_ERROR LIST_STATUS_ERROR} -
      • {@link #LIST_STATUS_PRIMED LIST_STATUS_PRIMED} -
      • {@link #LIST_STATUS_FULL LIST_STATUS_FULL} -
      • {@link #LIST_INFO_NOT_VALID LIST_INFO_NOT_VALID} -
      - @return The error code. - **/ - public int getStatus() - { - return status_; - } -} diff --git a/cvsroot/src/com/ibm/as400/access/list/SpooledFileListItem.java b/cvsroot/src/com/ibm/as400/access/list/SpooledFileListItem.java deleted file mode 100644 index 29f7e45e1..000000000 --- a/cvsroot/src/com/ibm/as400/access/list/SpooledFileListItem.java +++ /dev/null @@ -1,667 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SpooledFileListItem.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access.list; - -import java.util.Calendar; -import java.util.Date; - -import com.ibm.as400.access.QSYSObjectPathName; - -/** - Contains spooled file information that was generated by {@link com.ibm.as400.access.list.SpooledFileOpenList SpooledFileOpenList}. -

      Some attributes will not be available, depending on the {@link #getFormat format} that was used to generate this item. The javadoc for each attribute getter indicates which formats will generate valid data for the given attribute. If an attribute getter that is only valid for a format other than what was used to generate this SpooledFileListItem, the data returned by that getter is not valid. - **/ -public class SpooledFileListItem -{ - /** - Constant indicating the spooled file is assigned to a specific printer. - @see #getPrinterAssignment - **/ - public static final String ASSIGNED_SPECIFIC = "1"; - - /** - Constant indicating the spooled file is assigned to multiple printers. - @see #getPrinterAssignment - **/ - public static final String ASSIGNED_MULTIPLE = "2"; - - /** - Constant indicating the spooled file is not assigned to a printer. - @see #getPrinterAssignment - **/ - public static final String ASSIGNED_NONE = "3"; - - - /** - Constant indicating the spooled file is intended for a diskette device. - @see #getDeviceType - **/ - public static final String DEVICE_TYPE_DISKETTE = "DISKETTE"; - - /** - Constant indicating the spooled file is intended for a printer device. - @see #getDeviceType - **/ - public static final String DEVICE_TYPE_PRINTER = "PRINTER"; - - - /** - Constant indicating the spooled file is schedule immediate. A spooling writer can process the spooled file immediately. - @see #getSchedule - **/ - public static final String SCHEDULE_IMMEDIATE = "1"; - - /** - Constant indicating the spooled file is schedule file end. A spooling writer cannot process the spooled file until it has been closed. - @see #getSchedule - **/ - public static final String SCHEDULE_FILE_END = "2"; - - /** - Constant indicating the spooled file is schedule job end. A spooling writer cannot process the spooled file until the job of the spooled file has ended. - @see #getSchedule - **/ - public static final String SCHEDULE_JOB_END = "3"; - - - /** - Constant indicating the spooled file is available to be written to an output device by a writer. - @see #getStatus - **/ - public static final String STATUS_READY = "*READY"; - - /** - Constant indicating the spooled file has not been completely processed and is not ready to be selected by a writer. - @see #getStatus - **/ - public static final String STATUS_OPEN = "*OPEN"; - - /** - Constant indicating the spooled file has been processed completely by a program, but SCHEDULE(*JOBEND) was specified. The job that produced the spooled file has not finished. - @see #getStatus - **/ - public static final String STATUS_CLOSED = "*CLOSED"; - - /** - Constant indicating the spooled file has been written and then saved. This spooled file remains saved until it is released. - @see #getStatus - **/ - public static final String STATUS_SAVED = "*SAVED"; - - /** - Constant indicating the spooled file currently is being produced by the writer on an output device. - @see #getStatus - **/ - public static final String STATUS_WRITING = "*WRITING"; - - /** - Constant indicating the spooled file has been held. - @see #getStatus - **/ - public static final String STATUS_HELD = "*HELD"; - - /** - Constant indicating the spooled file has a message that needs a reply or needs an action to be taken. - @see #getStatus - **/ - public static final String STATUS_MESSAGE_WAIT = "*MESSAGE"; - - /** - Constant indicating the spooled file is pending (waiting) to be printed. - @see #getStatus - **/ - public static final String STATUS_PENDING = "*PENDING"; - - /** - Constant indicating the spooled file has been completely sent to the printer, but the print complete status has not been sent back. - @see #getStatus - **/ - public static final String STATUS_PRINTING = "*PRINTER"; - - /** - Constant indicating the spooled file is no longer in the system. A spooled file with this status is only returned in the list of spooled files if the qualified job name was specified. - @see #getStatus - **/ - public static final String STATUS_FINISHED = "*FINISHED"; - - /** - Constant indicating the spooled file is being sent or has been sent to a remote system. - @see #getStatus - **/ - public static final String STATUS_SENDING = "*SENDING"; - - /** - Constant indicating the spooled file has been deferred from printing. - @see #getStatus - **/ - public static final String STATUS_DEFERRED = "*DEFERRED"; - - - // Job name. - private String jobName_; - // User name. - private String jobUser_; - // Job number. - private String jobNumber_; - // Spooled file name. - private String name_; - // Spooled file number. - private int number_; - // File status or status or spooled file status. - private String status_; - // Date spooled file was opened. - private String dateOpened_; - // Time spooled file was opened. - private String timeOpened_; - // Spooled file schedule. - private String schedule_; - // Job system name. - private String jobSystemName_; - // User data. - private String userData_; - // Spooled file form type or form type. - private String formType_; - // Output queue name. - private String outputQueueName_; - // Output queue library name. - private String outputQueueLibrary_; - // Auxiliary storage pool. - private int asp_; - // Size of spooled file. - private int size_; - // Spooled file size multiplier. - private int sizeMultiplier_; - // Total pages. - private int totalPages_; - // Copies left to print. - private int copiesLeftToPrint_; - // Priority. - private String priority_; - // Internet print protocol job identifier. - private int ippJobIdentifier_; - - // Internal job identifier. - private byte[] internalJobIdentifier_; - // Internal spooled file identifier. - private byte[] internalSpooledFileIdentifier_; - // Current page. - private int currentPage_; - // Device type. - private String deviceType_; - // Printer assigned. - private String printerAssignment_; - // Printer name. - private String printerName_; - - // Format of receiver variable. - private String format_; - - SpooledFileListItem(String name, String jobName, String jobUser, String jobNumber, int number, int totalPages, int currentPage, int copiesLeftToPrint, String outputQueueName, String outputQueueLibrary, String userData, String status, String formType, String priority, byte[] internalJobIdentifier, byte[] internalSpooledFileIdentifier, String deviceType, String jobSystemName, String dateOpened, String timeOpened) - { - name_ = name; - jobName_ = jobName; - jobUser_ = jobUser; - jobNumber_ = jobNumber; - number_ = number; - totalPages_ = totalPages; - currentPage_ = currentPage; - copiesLeftToPrint_ = copiesLeftToPrint; - outputQueueName_ = outputQueueName; - outputQueueLibrary_ = outputQueueLibrary; - userData_ = userData; - status_ = status; - formType_ = formType; - priority_ = priority; - internalJobIdentifier_ = internalJobIdentifier; - internalSpooledFileIdentifier_ = internalSpooledFileIdentifier; - deviceType_ = deviceType; - jobSystemName_ = jobSystemName; - dateOpened_ = dateOpened; - timeOpened_ = timeOpened; - format_ = SpooledFileOpenList.FORMAT_0100; - } - - SpooledFileListItem(String name, String jobName, String jobUser, String jobNumber, int number, int totalPages, int currentPage, int copiesLeftToPrint, String outputQueueName, String outputQueueLibrary, String userData, String status, String formType, String priority, byte[] internalJobIdentifier, byte[] internalSpooledFileIdentifier, String deviceType, String jobSystemName, String dateOpened, String timeOpened, String printerAssignment, String printerName) - { - this(name, jobName, jobUser, jobNumber, number, totalPages, currentPage, copiesLeftToPrint, outputQueueName, outputQueueLibrary, userData, status, formType, priority, internalJobIdentifier, internalSpooledFileIdentifier, deviceType, jobSystemName, dateOpened, timeOpened); - printerAssignment_ = printerAssignment; - printerName_ = printerName; - format_ = SpooledFileOpenList.FORMAT_0200; - } - - SpooledFileListItem(String jobName, String jobUser, String jobNumber, String name, int number, int status, String dateOpened, String timeOpened, String schedule, String jobSystemName, String userData, String formType, String outputQueueName, String outputQueueLibrary, int asp, int size, int sizeMultiplier, int totalPages, int copiesLeftToPrint, String priority, int ippJobIdentifier) - { - jobName_ = jobName; - jobUser_ = jobUser; - jobNumber_ = jobNumber; - name_ = name; - number_ = number; - status_ = mapStatus(status); - dateOpened_ = dateOpened; - timeOpened_ = timeOpened; - schedule_ = schedule; - jobSystemName_ = jobSystemName; - userData_ = userData; - formType_ = formType; - outputQueueName_ = outputQueueName; - outputQueueLibrary_ = outputQueueLibrary; - asp_ = asp; - size_ = size; - sizeMultiplier_ = sizeMultiplier; - totalPages_ = totalPages; - copiesLeftToPrint_ = copiesLeftToPrint; - priority_ = priority; - ippJobIdentifier_ = ippJobIdentifier; - format_ = SpooledFileOpenList.FORMAT_0300; - } - - /** - Returns the auxiliary storage pool (ASP) in which the spooled file resides. Possible values are: -

        -
      • 1 - The system auxiliary storage pool (*SYSTEM). -
      • 2-255 - The number of the auxiliary storage pool. -
      -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The auxiliary storage pool. - **/ - public int getASP() - { - return asp_; - } - - /** - Returns the remaining number of copies to be printed. This attribute applies to printer device type spooled files only. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The number of copies left. - @see #getDeviceType - **/ - public int getCopiesLeftToPrint() - { - return copiesLeftToPrint_; - } - - /** - Returns the date and time the spooled file was created. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100} (i5/OS V5R2M0 and higher), {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @see #getDateOpened - @see #getTimeOpened - @return The date and time formatted into a java.util.Date object. - **/ - public Date getCreationDate() - { - if (dateOpened_ == null) return null; - Calendar c = Calendar.getInstance(); - c.clear(); - c.set(Integer.parseInt(dateOpened_.substring(0, 3)) + 1900, // Year. - Integer.parseInt(dateOpened_.substring(3, 5)) - 1, // Month is zero based. - Integer.parseInt(dateOpened_.substring(5, 7)), // Day. - Integer.parseInt(timeOpened_.substring(0, 2)), // Hour. - Integer.parseInt(timeOpened_.substring(2, 4)), // Minute. - Integer.parseInt(timeOpened_.substring(4, 6))); // Second. - return c.getTime(); - } - - /** - Returns the page number or record number currently being written. The page number may be lower or higher than the page number actually being printed because of buffering done by the system. For example, if the spooled file is routed to a diskette unit or the writer is currently printing job separators or file separators for the spooled file, the page number returned may be zero. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200} - @return The current page number. - **/ - public int getCurrentPage() - { - return currentPage_; - } - - /** - Returns the date the spooled file was created. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100} (i5/OS V5R2M0 and higher), {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @see #getCreationDate - @return The date in the format CYYMMDD. - **/ - public String getDateOpened() - { - return dateOpened_; - } - - /** - Returns the type of device for which the spooled file is intended. Possible values are: -

        -
      • {@link #DEVICE_TYPE_DISKETTE DEVICE_TYPE_DISKETTE} -
      • {@link #DEVICE_TYPE_PRINTER DEVICE_TYPE_PRINTER} -
      -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200} - @return The device type. - **/ - public String getDeviceType() - { - if (deviceType_ == null) return null; - if (deviceType_.equals(DEVICE_TYPE_PRINTER)) return DEVICE_TYPE_PRINTER; - if (deviceType_.equals(DEVICE_TYPE_DISKETTE)) return DEVICE_TYPE_DISKETTE; - return deviceType_; - } - - /** - Returns the format that was used by SpooledFileOpenList to generate this item. - @return The format. - @see com.ibm.as400.access.list.SpooledFileListItem#getFormat - **/ - public String getFormat() - { - return format_; - } - - /** - Returns the type of forms that should be loaded on the printer before this spooled file is printed. This attribute applies to printer device type spooled files only. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The form type. - @see #getDeviceType - **/ - public String getFormType() - { - return formType_; - } - - /** - Returns the internal job identifier for the job that created the spooled file. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200} - @return The 16-byte internal job ID. - @see com.ibm.as400.access.Job#setInternalJobIdentifier - **/ - public byte[] getInternalJobIdentifier() - { - return internalJobIdentifier_; - } - - /** - Returns the internal spooled file identifier for the spooled file. This is the input value that other programs use to improve the performance of locating the spooled file on the system. Only the spooled file APIs use this identifier, not any other interface on the system. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200} - @return The 16-byte internal spooled file ID. - **/ - public byte[] getInternalSpooledFileIdentifier() - { - return internalSpooledFileIdentifier_; - } - - /** - Returns the Internet Print Protocol (IPP) job identifier assigned by the system based on the output queue to which the file was added or moved. This value ranges from 1 to 2,147,483,647 and is not guaranteed to be unique for a given output queue. This value will be 0 when retrieved from systems running i5/OS V5R2M0 and earlier. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300}, - @return The IPP job identifier. - **/ - public int getIPPJobIdentifier() - { - return ippJobIdentifier_; - } - - /** - Returns the name of the job that created the spooled file. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The job name. - @see #getJobNumber - @see #getJobUser - **/ - public String getJobName() - { - return jobName_; - } - - /** - Returns the number of the job that created the spooled file. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The job number. - @see #getJobName - @see #getJobUser - **/ - public String getJobNumber() - { - return jobNumber_; - } - - /** - Returns the name of the system where the job that created the spooled file ran. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100} (i5/OS V5R2M0 and higher), {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200} (i5/OS V5R2M0 and higher), {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The system name. - **/ - public String getJobSystemName() - { - return jobSystemName_; - } - - /** - Returns the user of the job that created the spooled file. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The user name. - @see #getJobName - @see #getJobNumber - **/ - public String getJobUser() - { - return jobUser_; - } - - /** - Returns the name of the spooled file. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The spooled file name. - **/ - public String getName() - { - return name_; - } - - /** - Returns the number of the spooled file. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The spooled file number. - **/ - public int getNumber() - { - return number_; - } - - /** - Returns the fully-qualified integrated file system path of the output queue in which the spooled file is located. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The output queue. - @see #getOutputQueueName - @see #getOutputQueueLibrary - **/ - public String getOutputQueue() - { - return QSYSObjectPathName.toPath(outputQueueLibrary_, outputQueueName_, "OUTQ"); - } - - /** - Returns the library of the output queue in which the spooled file is located. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The library. - @see #getOutputQueue - **/ - public String getOutputQueueLibrary() - { - return outputQueueLibrary_; - } - - /** - Returns the name of the output queue in which the spooled file is located. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The output queue name. - @see #getOutputQueue - **/ - public String getOutputQueueName() - { - return outputQueueName_; - } - - /** - Returns how the spooled file is assigned. This attribute applies to printer device type spooled files only. Possible values are: -

        -
      • {@link #ASSIGNED_SPECIFIC ASSIGNED_SPECIFIC} - The printer name will be valid. -
      • {@link #ASSIGNED_MULTIPLE ASSIGNED_MULTIPLE} - The printer name will be blank. -
      • {@link #ASSIGNED_NONE ASSIGNED_NONE} - The printer name will be blank. -
      -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200} - @return The printer assignment. - @see #getPrinterName - @see #getDeviceType - **/ - public String getPrinterAssignment() - { - if (printerAssignment_ == null) return null; - if (printerAssignment_.equals(ASSIGNED_SPECIFIC)) return ASSIGNED_SPECIFIC; - if (printerAssignment_.equals(ASSIGNED_MULTIPLE)) return ASSIGNED_MULTIPLE; - if (printerAssignment_.equals(ASSIGNED_NONE)) return ASSIGNED_NONE; - return printerAssignment_; - } - - /** - Returns the name of the printer the spooled file has been assigned to print on. This attribute applies to printer device type spooled files only, and is only valid when the printer assignment is ASSIGNED_SPECIFIC. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200} - @return The printer name. - @see #getPrinterAssignment - @see #getDeviceType - **/ - public String getPrinterName() - { - return printerName_; - } - - /** - Returns the priority of the spooled file. The priority ranges from 1 (highest) to 9 (lowest). -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The priority. - **/ - public String getPriority() - { - return priority_; - } - - /** - Returns the schedule of the spooled file. Possible values are: -

        -
      • {@link #SCHEDULE_IMMEDIATE SCHEDULE_IMMEDIATE} -
      • {@link #SCHEDULE_FILE_END SCHEDULE_FILE_END} -
      • {@link #SCHEDULE_JOB_END SCHEDULE_JOB_END} -
      -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The schedule. - **/ - public String getSchedule() - { - if (schedule_ == null) return null; - if (schedule_.equals(SCHEDULE_IMMEDIATE)) return SCHEDULE_IMMEDIATE; - if (schedule_.equals(SCHEDULE_FILE_END)) return SCHEDULE_FILE_END; - if (schedule_.equals(SCHEDULE_JOB_END)) return SCHEDULE_JOB_END; - return schedule_; - } - - /** - Returns the spooled file size in bytes. The size of the spooled file is the data stream size, plus the spooled file's attributes, plus the overhead storage used to store the spooled file's data stream. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The size. - **/ - public long getSize() - { - if (sizeMultiplier_ > 0) return (long)size_*(long)sizeMultiplier_; - return size_; - } - - /** - Returns the status of the spooled file. Possible values are: -

        -
      • {@link #STATUS_READY STATUS_READY} -
      • {@link #STATUS_OPEN STATUS_OPEN} -
      • {@link #STATUS_CLOSED STATUS_CLOSED} -
      • {@link #STATUS_SAVED STATUS_SAVED} -
      • {@link #STATUS_WRITING STATUS_WRITING} -
      • {@link #STATUS_HELD STATUS_HELD} -
      • {@link #STATUS_MESSAGE_WAIT STATUS_MESSAGE_WAIT} -
      • {@link #STATUS_PENDING STATUS_PENDING} -
      • {@link #STATUS_PRINTING STATUS_PRINTING} -
      • {@link #STATUS_FINISHED STATUS_FINISHED} -
      • {@link #STATUS_SENDING STATUS_SENDING} -
      • {@link #STATUS_DEFERRED STATUS_DEFERRED} -
      -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The status. - **/ - public String getStatus() - { - if (status_ == null) return null; - if (status_.equals(STATUS_READY)) return STATUS_READY; - if (status_.equals(STATUS_OPEN)) return STATUS_OPEN; - if (status_.equals(STATUS_CLOSED)) return STATUS_CLOSED; - if (status_.equals(STATUS_SAVED)) return STATUS_SAVED; - if (status_.equals(STATUS_WRITING)) return STATUS_WRITING; - if (status_.equals(STATUS_HELD)) return STATUS_HELD; - if (status_.equals(STATUS_MESSAGE_WAIT)) return STATUS_MESSAGE_WAIT; - if (status_.equals(STATUS_PENDING)) return STATUS_PENDING; - if (status_.equals(STATUS_PRINTING)) return STATUS_PRINTING; - if (status_.equals(STATUS_FINISHED)) return STATUS_FINISHED; - if (status_.equals(STATUS_SENDING)) return STATUS_SENDING; - if (status_.equals(STATUS_DEFERRED)) return STATUS_DEFERRED; - - return status_; - } - - /** - Returns the time the spooled file was created. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100} (i5/OS V5R2M0 and higher), {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @see #getCreationDate - @return The time in the format HHMMSS. - **/ - public String getTimeOpened() - { - return timeOpened_; - } - - /** - Returns the total number of pages or number of records for this spooled file. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The number of pages. - **/ - public int getTotalPages() - { - return totalPages_; - } - - /** - Returns the 10 characters of user-specified data that describe the spooled file. -

      Available in format: {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0100 FORMAT_0100}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0200 FORMAT_0200}, {@link com.ibm.as400.access.list.SpooledFileOpenList#FORMAT_0300 FORMAT_0300} - @return The user data. - **/ - public String getUserData() - { - return userData_; - } - - // Helper method used to convert the integer status returned by one API format to the String status returned by the other API format. - private static final String mapStatus(int status) - { - switch (status) - { - case 1: return STATUS_READY; - case 2: return STATUS_OPEN; - case 3: return STATUS_CLOSED; - case 4: return STATUS_SAVED; - case 5: return STATUS_WRITING; - case 6: return STATUS_HELD; - case 7: return STATUS_MESSAGE_WAIT; - case 8: return STATUS_PENDING; - case 9: return STATUS_PRINTING; - case 10: return STATUS_FINISHED; - case 11: return STATUS_SENDING; - case 12: return STATUS_DEFERRED; - default: return ""; // Shouldn't happen. - } - } -} diff --git a/cvsroot/src/com/ibm/as400/access/list/SpooledFileOpenList.java b/cvsroot/src/com/ibm/as400/access/list/SpooledFileOpenList.java deleted file mode 100644 index 176659582..000000000 --- a/cvsroot/src/com/ibm/as400/access/list/SpooledFileOpenList.java +++ /dev/null @@ -1,1302 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SpooledFileOpenList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.access.list; - -import java.io.IOException; -import java.util.Calendar; -import java.util.Date; -import java.util.Vector; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400Exception; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.BinaryConverter; -import com.ibm.as400.access.CharConverter; -import com.ibm.as400.access.ErrorCompletingRequestException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ObjectDoesNotExistException; -import com.ibm.as400.access.ProgramCall; -import com.ibm.as400.access.ProgramParameter; -import com.ibm.as400.access.QSYSObjectPathName; -import com.ibm.as400.access.Trace; - -/** - An {@link com.ibm.as400.access.list.OpenList OpenList} implementation that generates lists of {@link com.ibm.as400.access.list.SpooledFileListItem SpooledFileListItem} objects. -

      -    AS400 system = new AS400("mySystem", "myUserID", "myPassword");
      -    SpooledFileOpenList list = new SpooledFileOpenList(system);
      -    // Get all of myUserID's spooled files.
      -    list.setFilterUsers(new String[] { "*CURRENT" } );
      -    // Sort the list by job number in ascending order.
      -    list.addSortField(SpooledFileOpenList.JOB_NUMBER, true);
      -    list.open();
      -    Enumeration items = list.getItems();
      -    while (items.hasMoreElements())
      -    {
      -        SpooledFileListItem item = (SpooledFileListItem)items.nextElement();
      -        System.out.println(item.getJobName() + "/" + item.getJobUser() + "/" + item.getJobNumber() + " - " + item.getName() + ", " + item.getNumber());
      -    }
      -    list.close();
      - 
      - **/ -public class SpooledFileOpenList extends OpenList -{ - static final long serialVersionUID = 17674018445884278L; - - // Constant representing the EBCDIC value for "*ALL ". Used internally for filtering. - private static final byte[] ALL = new byte[] { 0x5C, (byte)0xC1, (byte)0xD3, (byte)0xD3, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; - - /** - Constant indicating that this list will accept parameters for, and, generate SpooledFileListItem objects in accordance with, the OSPL0100 format of the underlying API. - @see #setFormat - **/ - public static final String FORMAT_0100 = "OSPL0100"; - - /** - Constant indicating that this list will accept parameters for, and, generate SpooledFileListItem objects in accordance with, the OSPL0200 format of the underlying API. - @see #setFormat - **/ - public static final String FORMAT_0200 = "OSPL0200"; - - /** - Constant indicating that this list will accept parameters for, and, generate SpooledFileListItem objects in accordance with, the OSPL0300 format of the underlying API. This is the default format. - @see #setFormat - **/ - public static final String FORMAT_0300 = "OSPL0300"; - - - // Sorting constants... in no particular order... - - /** - Sorting constant used to sort the list of spooled files by the job name portion of the job information. - @see #addSortField - **/ - public static final int JOB_NAME = 0; - - /** - Sorting constant used to sort the list of spooled files by the user name portion of the job information. - @see #addSortField - **/ - public static final int JOB_USER = 1; - - /** - Sorting constant used to sort the list of spooled files by the job number portion of the job information. - @see #addSortField - **/ - public static final int JOB_NUMBER = 2; - - /** - Sorting constant used to sort the list of spooled files by spooled file name. - @see #addSortField - **/ - public static final int NAME = 3; - - /** - Sorting constant used to sort the list of spooled files by spooled file number. - @see #addSortField - **/ - public static final int NUMBER = 4; - - /** - Sorting constant used to sort the list of spooled files by status. - @see #addSortField - **/ - public static final int STATUS = 5; - - /** - Sorting constant used to sort the list of spooled files by date. Only systems running operating system releases V5R2M0 and higher can sort with this value using FORMAT_0100. - @see #addSortField - **/ - public static final int DATE_OPENED = 6; - - /** - Sorting constant used to sort the list of spooled files by time. Only systems running operating system releases V5R2M0 and higher can sort with this value using FORMAT_0100. - @see #addSortField - **/ - public static final int TIME_OPENED = 7; - - /** - Sorting constant used to sort the list of spooled files by schedule. This value is only valid for FORMAT_0300. - @see #addSortField - **/ - public static final int SCHEDULE = 8; - - /** - Sorting constant used to sort the list of spooled files by system. Only systems running operating system releases V5R2M0 and higher can sort with this value using FORMAT_0100 or FORMAT_0200. - @see #addSortField - **/ - public static final int JOB_SYSTEM = 9; - - /** - Sorting constant used to sort the list of spooled files by user data. - @see #addSortField - **/ - public static final int USER_DATA = 10; - - /** - Sorting constant used to sort the list of spooled files by form type. - @see #addSortField - **/ - public static final int FORM_TYPE = 11; - - /** - Sorting constant used to sort the list of spooled files by output queue name. - @see #addSortField - **/ - public static final int OUTPUT_QUEUE_NAME = 12; - - /** - Sorting constant used to sort the list of spooled files by output queue library. - @see #addSortField - **/ - public static final int OUTPUT_QUEUE_LIBRARY = 13; - - /** - Sorting constant used to sort the list of spooled files by auxiliary storage pool (ASP). This value is only valid for FORMAT_0300. - @see #addSortField - **/ - public static final int ASP = 14; - - /** - Sorting constant used to sort the list of spooled files by size. This value is only valid for FORMAT_0300. - @see #addSortField - **/ - public static final int SIZE = 15; - - // Sorting constant. Used internally. When the user specifies SIZE, we automatically assume SIZE_MULTIPLIER as well. This value is only valid for FORMAT_0300. - private static final int SIZE_MULTIPLIER = 16; - - /** - Sorting constant used to sort the list of spooled files by total number of pages. - @see #addSortField - **/ - public static final int TOTAL_PAGES = 17; - - /** - Sorting constant used to sort the list of spooled files by number of copies left to print. - @see #addSortField - **/ - public static final int COPIES_LEFT_TO_PRINT = 18; - - /** - Sorting constant used to sort the list of spooled files by priority. - @see #addSortField - **/ - public static final int PRIORITY = 19; - - /** - Sorting constant used to sort the list of spooled files by printer name. This value is only valid for FORMAT_0200. - @see #addSortField - **/ - public static final int PRINTER_NAME = 20; - - /** - Sorting constant used to sort the list of spooled files by printer assignment. This value is only valid for FORMAT_0200. - @see #addSortField - **/ - public static final int PRINTER_ASSIGNED = 21; - - /** - Sorting constant used to sort the list of spooled files by current page number. This value is only valid for FORMAT_0100 and FORMAT_0200. - @see #addSortField - **/ - public static final int CURRENT_PAGE = 22; - - /** - Sorting constant used to sort the list of spooled files by device type. This value is only valid for FORMAT_0100 and FORMAT_0200. - @see #addSortField - **/ - public static final int DEVICE_TYPE = 23; - - - // Use an enumeration to represent the format value. - private int format_ = 3; - - // Job name portion of qualified job name filter. - private String filterJobName_ = ""; - // User name portion of qualified job name filter. - private String filterJobUser_ = ""; - // Job number portion of qualified job name filter. - private String filterJobNumber_ = ""; - - // User name filter. - private String[] filterUsers_; - // Qualified output queue name filter. - private QSYSObjectPathName[] filterOutputQueues_; - // Form type filter. - private String filterFormType_; - // User-specified data filter. - private String filterUserData_; - // Spooled file status filter. - private String[] filterStatuses_; - // Device name or printer device name filter. - private String[] filterDevices_; - // System name filter. - private String filterJobSystemName_; - // Starting spooled file create data and time filter. - private Date filterCreationDateStart_; - // Ending spooled file create data and time filter. - private Date filterCreationDateEnd_; - - // Keys for sort information. - private Vector sortKeys_ = new Vector(); - - /** - Constructs a SpooledFileOpenList object with the given system. By default, this list will generate a list of SpooledFileListItem objects for all spooled files on the system using the default format of {@link #FORMAT_0300 FORMAT_0300}. - @param system The system object representing the system on which the spooled files exist. - **/ - public SpooledFileOpenList(AS400 system) - { - super(system); - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Constructing SpooledFileOpenList object."); - } - - /** - Constructs a SpooledFileOpenList object with the given system and format. By default, this list will generate a list of SpooledFileListItem objects for all spooled files on the system. - @param system The system object representing the system on which the spooled files exist. - @param format The format of the underlying API. - @see #setFormat - **/ - public SpooledFileOpenList(AS400 system, String format) - { - this(system); - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Constructing SpooledFileOpenList object."); - setFormat(format); - } - - /** - Adds a field on which to sort the list when it is built. Use one of the sort constants on this class. By default, no sorting is done. - @param field The field used to sort the list. Fields which are not applicable to the format used or the operating system release are silently ignored. - @param ascending true to sort in ascending order on this field (e.g. A-Z or 0-9); false for descending. - **/ - public void addSortField(int field, boolean ascending) - { - // We map the field constant to the appropriate offset in the output record of the API. - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Adding sort field, field: " + field + ", ascending: " + ascending); - // For 'size of spooled file' automatically add 'spooled file size multiplier'. - if (field == SIZE) addSortField(SIZE_MULTIPLIER, ascending); - // '1' is ascending, '2' is descending. - sortKeys_.addElement(new int[] { field, ascending ? 0xF1 : 0xF2 } ); - } - - /** - Calls QGY/QGYOLSPL. - @return The list information parameter. - **/ - protected byte[] callOpenListAPI() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Opening spooled file list."); - - // Retrieve operating system VRM. - int vrm = system_.getVRM(); - // Convert based on server job CCSID. - CharConverter conv = new CharConverter(system_.getCcsid(), system_); - - // Figure out our 'sort information' parameter. - int sortKeysSize = sortKeys_.size(); - byte[] sortInformation = new byte[4 + (12 * sortKeysSize)]; - BinaryConverter.intToByteArray(sortKeysSize, sortInformation, 0); - - int validSortKeysSize = 0; - for (int i = 0; i < sortKeysSize; ++i) - { - int[] pair = (int[])sortKeys_.elementAt(i); - int field = pair[0]; - int fieldLength = findFieldLength(field, vrm); - - // Ignore any sort fields that don't apply for our current format. - if (fieldLength > 0) - { - BinaryConverter.intToByteArray(findStartingPosition(field), sortInformation, 4 + validSortKeysSize * 12); - BinaryConverter.intToByteArray(fieldLength, sortInformation, 8 + validSortKeysSize * 12); - BinaryConverter.shortToByteArray(findDataType(field), sortInformation, 12 + validSortKeysSize * 12); - sortInformation[14 + validSortKeysSize * 12] = (byte)pair[1]; - ++validSortKeysSize; - } - else - { - Trace.log(Trace.WARNING, "Sort key not valid, position: " + i + ", field: " + field + ""); - } - } - // If any invalid keys were found, shrink the array. - if (validSortKeysSize != sortKeysSize) - { - byte[] oldValue = sortInformation; - sortInformation = new byte[4 + (12 * validSortKeysSize)]; - BinaryConverter.intToByteArray(validSortKeysSize, sortInformation, 0); - System.arraycopy(oldValue, 4, sortInformation, 4, 12 * validSortKeysSize); - } - - // Figure out the length of the 'filter information' parameter and the 'format of filter information' to use. - int filterInformationLength = 0; - boolean useOSPF0200 = false; - if (vrm < 0x00050200 || filterJobSystemName_ == null && filterCreationDateStart_ == null && filterCreationDateEnd_ == null) - { - // OSPF0100 filter format. - filterInformationLength = 92; - if (filterUsers_ != null && filterUsers_.length > 1) - { - filterInformationLength += 12 * (filterUsers_.length - 1); - } - if (filterOutputQueues_ != null && filterOutputQueues_.length > 1) - { - filterInformationLength += 20 * (filterOutputQueues_.length - 1); - } - if (filterStatuses_ != null && filterStatuses_.length > 1) - { - filterInformationLength += 12 * (filterStatuses_.length - 1); - } - if (filterDevices_ != null && filterDevices_.length > 1) - { - filterInformationLength += 12 * (filterDevices_.length - 1); - } - } - else - { - // OSPF0200 filter format. - useOSPF0200 = true; - filterInformationLength = 110; - if (filterUsers_ != null) - { - filterInformationLength += 10 * filterUsers_.length; - } - if (filterOutputQueues_ != null) - { - filterInformationLength += 20 * filterOutputQueues_.length; - } - if (filterStatuses_ != null) - { - filterInformationLength += 10 * filterStatuses_.length; - } - if (filterDevices_ != null) - { - filterInformationLength += 10 * filterDevices_.length; - } - } - - // Figure out the 'filter information' parameter. - byte[] filterInformation = new byte[filterInformationLength]; - int offset = 0; - if (!useOSPF0200) - { - // Fill in the filter info for the OSPF0100 format. - if (filterUsers_ == null || filterUsers_.length == 0) - { - // Number of user names is one. - BinaryConverter.intToByteArray(1, filterInformation, offset); - offset += 4; - // User name is *ALL. - System.arraycopy(ALL, 0, filterInformation, offset, 10); - offset += 12; - } - else - { - // Number of user names. - BinaryConverter.intToByteArray(filterUsers_.length, filterInformation, offset); - offset += 4; - for (int i = 0; i < filterUsers_.length; ++i) - { - // User name. - for (int ii = 0; ii < 10; ++ii) filterInformation[ii + offset] = 0x40; - conv.stringToByteArray(filterUsers_[i], filterInformation, offset, 10); - offset += 12; - } - } - if (filterOutputQueues_ == null || filterOutputQueues_.length == 0) - { - // Number of output queue names is one. - BinaryConverter.intToByteArray(1, filterInformation, offset); - offset += 4; - // Output queue name is *ALL. - System.arraycopy(ALL, 0, filterInformation, offset, 10); - offset += 10; - // Output queue library name is blanks. - for (int ii = 0; ii < 10; ++ii) filterInformation[ii + offset] = 0x40; - offset += 10; - } - else - { - // Number of qualified output queue names. - BinaryConverter.intToByteArray(filterOutputQueues_.length, filterInformation, offset); - offset += 4; - for (int i = 0; i < filterOutputQueues_.length; ++i) - { - for (int ii = 0; ii < 20; ++ii) filterInformation[ii + offset] = 0x40; - // Output queue name. - conv.stringToByteArray(filterOutputQueues_[i].getObjectName(), filterInformation, offset, 10); - offset += 10; - // Output queue library name. - conv.stringToByteArray(filterOutputQueues_[i].getLibraryName(), filterInformation, offset, 10); - offset += 10; - } - } - if (filterFormType_ == null) - { - // Form type is *ALL. - System.arraycopy(ALL, 0, filterInformation, offset, 10); - } - else - { - // Form type. - for (int ii = 0; ii < 10; ++ii) filterInformation[ii + offset] = 0x40; - conv.stringToByteArray(filterFormType_, filterInformation, offset, 10); - } - offset += 10; - if (filterUserData_ == null) - { - // User-specified data is *ALL. - System.arraycopy(ALL, 0, filterInformation, offset, 10); - } - else - { - // User-specified data. - for (int ii = 0; ii < 10; ++ii) filterInformation[ii + offset] = 0x40; - conv.stringToByteArray(filterUserData_, filterInformation, offset, 10); - } - offset += 10; - if (filterStatuses_ == null || filterStatuses_.length == 0) - { - // Number of statuses is one. - BinaryConverter.intToByteArray(1, filterInformation, offset); - offset += 4; - // Spooled file status is *ALL. - System.arraycopy(ALL, 0, filterInformation, offset, 10); - offset += 12; - } - else - { - // Number of statuses. - BinaryConverter.intToByteArray(filterStatuses_.length, filterInformation, offset); - offset += 4; - for (int i = 0; i < filterStatuses_.length; ++i) - { - // Spooled file status. - for (int ii = 0; ii < 10; ++ii) filterInformation[ii + offset] = 0x40; - conv.stringToByteArray(filterStatuses_[i], filterInformation, offset, 10); - offset += 12; - } - } - if (filterDevices_ == null || filterDevices_.length == 0) - { - // Number of device names is one. - BinaryConverter.intToByteArray(1, filterInformation, offset); - offset += 4; - // Device name is *ALL. - System.arraycopy(ALL, 0, filterInformation, offset, 10); - offset += 12; - } - else - { - // Number of device names. - BinaryConverter.intToByteArray(filterDevices_.length, filterInformation, offset); - offset += 4; - for (int i = 0; i < filterDevices_.length; ++i) - { - // Device name. - for (int ii = 0; ii < 10; ++ii) filterInformation[ii + offset] = 0x40; - conv.stringToByteArray(filterDevices_[i], filterInformation, offset, 10); - offset += 12; - } - } - } - else - { - // Fill in the filter infomation for the OSPF0200 format. - - // Blank fill char portions of filter information. - for (int ii = 52; ii < 106; ++ii) filterInformation[ii] = 0x40; - for (int ii = 110; ii < filterInformation.length; ++ii) filterInformation[ii] = 0x40; - // Start offset past fixed portion of filter information. - offset = 110; - - // Length of filter information (just the fixed portion). - BinaryConverter.intToByteArray(106, filterInformation, 0); - if (filterUsers_ != null && filterUsers_.length > 0) - { - // Offset to user name entries. - BinaryConverter.intToByteArray(offset, filterInformation, 4); - // Number of user name entries. - BinaryConverter.intToByteArray(filterUsers_.length, filterInformation, 8); - - for (int i = 0; i < filterUsers_.length; ++i) - { - // User name. - conv.stringToByteArray(filterUsers_[i], filterInformation, offset, 10); - offset += 10; - } - } - // Length of user name entry. - BinaryConverter.intToByteArray(10, filterInformation, 12); - if (filterOutputQueues_ != null && filterOutputQueues_.length > 0) - { - // Offset to output queue name entries. - BinaryConverter.intToByteArray(offset, filterInformation, 16); - // Number of output queue name entries. - BinaryConverter.intToByteArray(filterOutputQueues_.length, filterInformation, 20); - - for (int i = 0; i < filterOutputQueues_.length; ++i) - { - // Output queue name. - conv.stringToByteArray(filterOutputQueues_[i].getObjectName(), filterInformation, offset, 10); - offset += 10; - // Output queue library name. - conv.stringToByteArray(filterOutputQueues_[i].getLibraryName(), filterInformation, offset, 10); - offset += 10; - } - } - // Length of output queue name entry. - BinaryConverter.intToByteArray(20, filterInformation, 24); - if (filterStatuses_ != null && filterStatuses_.length > 0) - { - // Offset to spooled file status entries. - BinaryConverter.intToByteArray(offset, filterInformation, 28); - // Number of spooled file status entries. - BinaryConverter.intToByteArray(filterStatuses_.length, filterInformation, 32); - - for (int i = 0; i < filterStatuses_.length; ++i) - { - // Spooled file status. - conv.stringToByteArray(filterStatuses_[i], filterInformation, offset, 10); - offset += 10; - } - } - // Length of spooled file status entry. - BinaryConverter.intToByteArray(10, filterInformation, 36); - if (filterDevices_ != null && filterDevices_.length > 0) - { - // Offset to printer device name entries. - BinaryConverter.intToByteArray(offset, filterInformation, 40); - // Number of printer device name entries. - BinaryConverter.intToByteArray(filterDevices_.length, filterInformation, 44); - - for (int i = 0; i < filterDevices_.length; ++i) - { - // Printer device name. - conv.stringToByteArray(filterDevices_[i], filterInformation, offset, 10); - offset += 10; - } - } - // Length of printer device name entry. - BinaryConverter.intToByteArray(10, filterInformation, 48); - if (filterFormType_ == null) - { - // Form type is *ALL. - System.arraycopy(ALL, 0, filterInformation, 52, 4); - } - else - { - // Form type. - conv.stringToByteArray(filterFormType_, filterInformation, 52, 10); - } - if (filterUserData_ == null) - { - // User-specified data is *ALL. - System.arraycopy(ALL, 0, filterInformation, 62, 4); - } - else - { - // User-specified data. - conv.stringToByteArray(filterUserData_, filterInformation, 62, 10); - } - if (filterJobSystemName_ == null) - { - // System name is *ALL. - System.arraycopy(ALL, 0, filterInformation, 72, 4); - } - else - { - // System name. - conv.stringToByteArray(filterJobSystemName_, filterInformation, 72, 8); - } - if (filterCreationDateStart_ == null && filterCreationDateEnd_ == null) - { - // Starting spooled file create date is *ALL. - System.arraycopy(ALL, 0, filterInformation, 80, 4); - // Starting spooled file create time is blank. - // Ending spooled file create date is blank. - // Ending spooled file create time is blank. - } - else if (filterCreationDateStart_ == null) - { - // Starting spooled file create date is *FIRST. - filterInformation[80] = 0x5C; - filterInformation[81] = (byte)0xC6; - filterInformation[82] = (byte)0xC9; - filterInformation[83] = (byte)0xD9; - filterInformation[84] = (byte)0xE2; - filterInformation[85] = (byte)0xE3; - // Starting spooled file create time is blank. - // Ending spooled file create date and time. - formatOS400DateString(filterCreationDateEnd_, filterInformation, 93); - } - else if (filterCreationDateEnd_ == null) - { - // Starting spooled file create date and time. - formatOS400DateString(filterCreationDateStart_, filterInformation, 80); - // Ending spooled file create date is *LAST. - filterInformation[93] = 0x5C; - filterInformation[94] = (byte)0xD3; - filterInformation[95] = (byte)0xC1; - filterInformation[96] = (byte)0xE2; - filterInformation[97] = (byte)0xE3; - // Ending spooled file create time is blank. - } - else - { - // Starting spooled file create date and time. - formatOS400DateString(filterCreationDateStart_, filterInformation, 80); - // Ending spooled file create date and time. - formatOS400DateString(filterCreationDateEnd_, filterInformation, 93); - } - } - - // Figure out the 'qualified job name' parameter. - byte[] qualifiedJobName = new byte[26]; - for (int ii = 0; ii < 26; ++ii) qualifiedJobName[ii] = 0x40; - conv.stringToByteArray(filterJobName_, qualifiedJobName, 0, 10); - conv.stringToByteArray(filterJobUser_, qualifiedJobName, 10, 10); - conv.stringToByteArray(filterJobNumber_, qualifiedJobName, 20, 6); - - // Format bytes is EBCDIC 'OSPL0X00' where X is 1, 2, or 3. - byte[] formatBytes = new byte[] { (byte)0xD6, (byte)0xE2, (byte)0xD7, (byte)0xD3, (byte)0xF0, (byte)(0xF0 | format_), (byte)0xF0, (byte)0xF0 }; - - // Setup program parameters. - ProgramParameter[] parameters = new ProgramParameter[useOSPF0200 ? 10 : 9]; - // Receiver variable, output, char(*). - parameters[0] = new ProgramParameter(0); - // Length of receiver variable, input, binary(4). - parameters[1] = new ProgramParameter(new byte[] { 0x00, 0x00, 0x00, 0x00 } ); - // List information, output, char(80). - parameters[2] = new ProgramParameter(80); - // Number of records to return, input, binary(4). - parameters[3] = new ProgramParameter(new byte[] { (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF } ); - // Sort information, input, char(*). - parameters[4] = new ProgramParameter(sortInformation); - // Filter information, input, char(*). - parameters[5] = new ProgramParameter(filterInformation); - // Qualified job name, input, char(26). - parameters[6] = new ProgramParameter(qualifiedJobName); - // Format of the generated list, input, char(8). - parameters[7] = new ProgramParameter(formatBytes); - // Error code, I/O, char(*). - parameters[8] = EMPTY_ERROR_CODE_PARM; - // We default to OSPF0100 to be compatible with pre-V5R2 systems. - if (useOSPF0200) - { - // Format of filter information, input, char(8), EBCDIC 'OSPF0200'. - parameters[9] = new ProgramParameter(new byte[] { (byte)0xD6, (byte)0xE2, (byte)0xD7, (byte)0xC6, (byte)0xF0, (byte)0xF2, (byte)0xF0, (byte)0xF0 } ); - } - - // Call the program. - ProgramCall pc = new ProgramCall(system_, "/QSYS.LIB/QGY.LIB/QGYOLSPL.PGM", parameters); - if (!pc.run()) - { - throw new AS400Exception(pc.getMessageList()); - } - - // List information returned. - return parameters[2].getOutputData(); - } - - /** - Clears all sorting information for this list. No sorting will be done when the list is generated unless {@link #addSortField addSortField()} is called to specify which fields to sort on. - **/ - public void clearSortFields() - { - if (Trace.isTraceOn()) Trace.log(Trace.DIAGNOSTIC, "Clearing sort fields."); - sortKeys_.removeAllElements(); - } - - // Helper method for sort parameter. - private final short findDataType(int field) - { - // 4 is character. - // 0 is signed binary. - switch (field) - { - case JOB_NAME: return 4; - case JOB_USER: return 4; - case JOB_NUMBER: return 4; - case NAME: return 4; - case NUMBER: return 0; - case STATUS: return format_ == 3 ? (short)0 : (short)4; - case DATE_OPENED: return 4; - case TIME_OPENED: return 4; - case SCHEDULE: return 4; - case JOB_SYSTEM: return 4; - case USER_DATA: return 4; - case FORM_TYPE: return 4; - case OUTPUT_QUEUE_NAME: return 4; - case OUTPUT_QUEUE_LIBRARY: return 4; - case ASP: return 0; - case SIZE: return 0; - case SIZE_MULTIPLIER: return 0; - case TOTAL_PAGES: return 0; - case COPIES_LEFT_TO_PRINT: return 0; - case PRIORITY: return 4; - case PRINTER_NAME: return 4; - case PRINTER_ASSIGNED: return 4; - case CURRENT_PAGE: return 0; - case DEVICE_TYPE: return 4; - default: - return 0; - } - } - - // Helper method for sort parameter. Returns 0 for fields that do not exist on the current format or VRM. - private final int findFieldLength(int field, int vrm) - { - switch (field) - { - case JOB_NAME: return 10; - case JOB_USER: return 10; - case JOB_NUMBER: return 6; - case NAME: return 10; - case NUMBER: return 4; - case STATUS: return format_ == 3 ? 4 : 10; - case DATE_OPENED: return format_ != 1 || vrm >= 0x00050200 ? 7 : 0; - case TIME_OPENED: return format_ != 1 || vrm >= 0x00050200 ? 6 : 0; - case SCHEDULE: return format_ == 3 ? 1 : 0; - case JOB_SYSTEM: return format_ == 3 ? 10 : vrm >= 0x00050200 ? 8 : 0; - case USER_DATA: return 10; - case FORM_TYPE: return 10; - case OUTPUT_QUEUE_NAME: return 10; - case OUTPUT_QUEUE_LIBRARY: return 10; - case ASP: return format_ == 3 ? 4 : 0; - case SIZE: return format_ == 3 ? 4 : 0; - case SIZE_MULTIPLIER: return format_ == 3 ? 4 : 0; - case TOTAL_PAGES: return 4; - case COPIES_LEFT_TO_PRINT: return 4; - case PRIORITY: return format_ == 3 ? 1 : 2; - case PRINTER_NAME: return format_ == 2 ? 10 : 0; - case PRINTER_ASSIGNED: return format_ == 2 ? 1 : 0; - case CURRENT_PAGE: return format_ == 3 ? 0 : 4; - case DEVICE_TYPE: return format_ == 3 ? 0 : 10; - default: - return 0; - } - } - - // Helper method for sort parameter. - private final int findStartingPosition(int field) - { - // This is 1-based for whatever reason. - switch (field) - { - case JOB_NAME: return format_ == 3 ? 1 : 11; - case JOB_USER: return format_ == 3 ? 11 : 21; - case JOB_NUMBER: return format_ == 3 ? 21 : 31; - case NAME: return format_ == 3 ? 27 : 1; - case NUMBER: return 37; - case STATUS: return format_ == 3 ? 41 : 83; - case DATE_OPENED: return format_ == 3 ? 45 : format_ == 2 ? 161 : 169; - case TIME_OPENED: return format_ == 3 ? 52 : format_ == 2 ? 168 : 176; - case SCHEDULE: return 58; - case JOB_SYSTEM: return format_ == 3 ? 59 : format_ == 2 ? 193 : 161; - case USER_DATA: return format_ == 3 ? 69 : 73; - case FORM_TYPE: return format_ == 3 ? 79 : 93; - case OUTPUT_QUEUE_NAME: return format_ == 3 ? 89 : 53; - case OUTPUT_QUEUE_LIBRARY: return format_ == 3 ? 99 : 63; - case ASP: return 109; - case SIZE: return 113; - case SIZE_MULTIPLIER: return 117; - case TOTAL_PAGES: return format_ == 3 ? 121 : 41; - case COPIES_LEFT_TO_PRINT: return format_ == 3 ? 125 : 49; - case PRIORITY: return format_ == 3 ? 129 : 103; - case PRINTER_NAME: return 175; - case PRINTER_ASSIGNED: return 174; - case CURRENT_PAGE: return 45; - case DEVICE_TYPE: return 137; - default: - return 0; - } - } - - // Helper method that fills in EBCDIC bytes in the format CYYMMDDHHMMSS. - private static final void formatOS400DateString(Date d, byte[] data, int offset) - { - Calendar cal = Calendar.getInstance(); - cal.clear(); - cal.setTime(d); - - // Set C byte. - int year = cal.get(Calendar.YEAR); - data[offset] = (byte)(year / 100 - 19 | 0xF0); - // Set YY bytes. - int yy = year % 100; - data[offset + 1] = (byte)(yy / 10 | 0xF0); - data[offset + 2] = (byte)(yy % 10 | 0xF0); - // Set MM bytes. - int month = cal.get(Calendar.MONTH) + 1; - data[offset + 3] = (byte)(month / 10 | 0xF0); - data[offset + 4] = (byte)(month % 10 | 0xF0); - // Set DD bytes. - int day = cal.get(Calendar.DAY_OF_MONTH); - data[offset + 5] = (byte)(day / 10 | 0xF0); - data[offset + 6] = (byte)(day % 10 | 0xF0); - // Set HH bytes. - int hour = cal.get(Calendar.HOUR_OF_DAY); - data[offset + 7] = (byte)(hour / 10 | 0xF0); - data[offset + 8] = (byte)(hour % 10 | 0xF0); - // Set MM bytes. - int minute = cal.get(Calendar.MINUTE); - data[offset + 9] = (byte)(minute / 10 | 0xF0); - data[offset + 10] = (byte)(minute % 10 | 0xF0); - // Set SS bytes. - int second = cal.get(Calendar.SECOND); - data[offset + 11] = (byte)(second / 10 | 0xF0); - data[offset + 12] = (byte)(second % 10 | 0xF0); - } - - /** - Formats the data from QGY/QGYOLSPL. - **/ - protected Object[] formatOutputData(byte[] data, int recordsReturned, int recordLength) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException - { - // Retrieve operating system VRM. - int vrm = system_.getVRM(); - // Convert based on server job CCSID. - CharConverter conv = new CharConverter(system_.getCcsid(), system_); - - SpooledFileListItem[] sp = new SpooledFileListItem[recordsReturned]; - int offset = 0; - for (int i = 0; i < recordsReturned; ++i) - { - if (format_ != 3) - { - // Format OSPL0100 or OSPL0200. - String spooledFileName = conv.byteArrayToString(data, offset, 10).trim(); - String jobName = conv.byteArrayToString(data, offset + 10, 10).trim(); - String userName = conv.byteArrayToString(data, offset + 20, 10).trim(); - String jobNumber = conv.byteArrayToString(data, offset + 30, 6); - int spooledFileNumber = BinaryConverter.byteArrayToInt(data, offset + 36); - int totalPages = BinaryConverter.byteArrayToInt(data, offset + 40); - // Not in 0300 format. - int currentPage = BinaryConverter.byteArrayToInt(data, offset + 44); - int copiesLeftToPrint = BinaryConverter.byteArrayToInt(data, offset + 48); - String outputQueueName = conv.byteArrayToString(data, offset + 52, 10).trim(); - String outputQueueLibraryName = conv.byteArrayToString(data, offset + 62, 10).trim(); - String userData = conv.byteArrayToString(data, offset + 72, 10); - // This is a BIN(4) in 0300 format. - String status = conv.byteArrayToString(data, offset + 82, 10).trim(); - String formType = conv.byteArrayToString(data, offset + 92, 10).trim(); - // This is a CHAR(1) in 0300 format. - String priority = conv.byteArrayToString(data, offset + 102, 2).trim(); - // Not in 0300 format. - byte[] internalJobIdentifier = new byte[16]; - System.arraycopy(data, offset + 104, internalJobIdentifier, 0, 16); - // Not in 0300 format. - byte[] internalSpooledFileIdentifier = new byte[16]; - System.arraycopy(data, offset + 120, internalSpooledFileIdentifier, 0, 16); - // Not in 0300 format. - String deviceType = conv.byteArrayToString(data, offset + 136, 10).trim(); - int offsetToExtension = BinaryConverter.byteArrayToInt(data, offset + 148); - String jobSystemName = null; - String dateSpooledFileWasOpened = null; - String timeSpooledFileWasOpened = null; - // If there is an extension. - if (offsetToExtension > 0) - { - // This is a CHAR(10) in 0300 format. - jobSystemName = conv.byteArrayToString(data, offset + offsetToExtension, 8).trim(); - dateSpooledFileWasOpened = conv.byteArrayToString(data, offset + offsetToExtension + 8, 7); - timeSpooledFileWasOpened = conv.byteArrayToString(data, offset + offsetToExtension + 15, 6); - } - if (format_ == 1) - { - // Format OSPL0100. - sp[i] = new SpooledFileListItem(spooledFileName, jobName, userName, jobNumber, spooledFileNumber, totalPages, currentPage, copiesLeftToPrint, outputQueueName, outputQueueLibraryName, userData, status, formType, priority, internalJobIdentifier, internalSpooledFileIdentifier, deviceType, jobSystemName, dateSpooledFileWasOpened, timeSpooledFileWasOpened); - } - else - { - // Format OSPL0200 only. - dateSpooledFileWasOpened = conv.byteArrayToString(data, offset + 160, 7); - timeSpooledFileWasOpened = conv.byteArrayToString(data, offset + 167, 6); - // Not in 0300 format. - String printerAssigned = conv.byteArrayToString(data, offset + 173, 1); - // Not in 0300 format. - String printerName = conv.byteArrayToString(data, offset + 174, 10).trim(); - - sp[i] = new SpooledFileListItem(spooledFileName, jobName, userName, jobNumber, spooledFileNumber, totalPages, currentPage, copiesLeftToPrint, outputQueueName, outputQueueLibraryName, userData, status, formType, priority, internalJobIdentifier, internalSpooledFileIdentifier, deviceType, jobSystemName, dateSpooledFileWasOpened, timeSpooledFileWasOpened, printerAssigned, printerName); - } - } - else - { - // Format OSPL0300. - String jobName = conv.byteArrayToString(data, offset, 10).trim(); - String userName = conv.byteArrayToString(data, offset + 10, 10).trim(); - String jobNumber = conv.byteArrayToString(data, offset + 20, 6); - String spooledFileName = conv.byteArrayToString(data, offset + 26, 10).trim(); - int spooledFileNumber = BinaryConverter.byteArrayToInt(data, offset + 36); - // This is a CHAR(10) in 0200 format. - int fileStatus = BinaryConverter.byteArrayToInt(data, offset + 40); - String dateSpooledFileWasOpened = conv.byteArrayToString(data, offset + 44, 7); - String timeSpooledFileWasOpened = conv.byteArrayToString(data, offset + 51, 6); - // Not in 0200 format. - String spooledFileSchedule = conv.byteArrayToString(data, offset + 57, 1); - // This is a CHAR(8) in 0100 format. - String jobSystemName = conv.byteArrayToString(data, offset + 58, 10).trim(); - String userData = conv.byteArrayToString(data, offset + 68, 10); - String spooledFileFormType = conv.byteArrayToString(data, offset + 78, 10).trim(); - String outputQueueName = conv.byteArrayToString(data, offset + 88, 10).trim(); - String outputQueueLibraryName = conv.byteArrayToString(data, offset + 98, 10).trim(); - // Not in 0200 format. - int auxiliaryStoragePool = BinaryConverter.byteArrayToInt(data, offset + 108); - // Not in 0200 format. - int sizeOfSpooledFile = BinaryConverter.byteArrayToInt(data, offset + 112); - // Not in 0200 format. - int spooledFileSizeMultiplier = BinaryConverter.byteArrayToInt(data, offset + 116); - int totalPages = BinaryConverter.byteArrayToInt(data, offset + 120); - int copiesLeftToPrint = BinaryConverter.byteArrayToInt(data, offset + 124); - // This is a CHAR(2) in 0200 format. - String priority = conv.byteArrayToString(data, offset + 128, 1); - int internetPrintProtocolJobIdentifier = 0; - if (vrm >= 0x00050300) - { - internetPrintProtocolJobIdentifier = BinaryConverter.byteArrayToInt(data, offset + 132); - } - sp[i] = new SpooledFileListItem(jobName, userName, jobNumber, spooledFileName, spooledFileNumber, fileStatus, dateSpooledFileWasOpened, timeSpooledFileWasOpened, spooledFileSchedule, jobSystemName, userData, spooledFileFormType, outputQueueName, outputQueueLibraryName, auxiliaryStoragePool, sizeOfSpooledFile, spooledFileSizeMultiplier, totalPages, copiesLeftToPrint, priority, internetPrintProtocolJobIdentifier); - } - offset += recordLength; - } - return sp; - } - - /** - Returns receiver variable size based on format used. - **/ - protected int getBestGuessReceiverSize(int number) - { - switch (format_) - { - case 1: return 192 * number; - case 2: return 224 * number; - } - return 136 * number; - } - - /** - Returns the end creation date being used to filter the list of spooled files. - @return The end creation date or null if the end creation date used will be the latest date in the list. - @see #getFilterCreationDateStart - **/ - public Date getFilterCreationDateEnd() - { - return filterCreationDateEnd_; - } - - /** - Returns the start creation date being used to filter the list of spooled files. - @return The start creation date or null if the start creation date used will be the earliest date in the list. - @see #getFilterCreationDateEnd - **/ - public Date getFilterCreationDateStart() - { - return filterCreationDateStart_; - } - - /** - Returns the printer device names being used to filter the list of spooled files. - @return The array of printer device names or null if the list is not being filtered by device. - **/ - public String[] getFilterDevices() - { - return filterDevices_; - } - - /** - Returns the form type being used to filter the list of spooled files. - @return The form type or null if the list is not being filtered by form type. - **/ - public String getFilterFormType() - { - return filterFormType_; - } - - /** - Returns the job name portion of the job information used to determine which spooled files belong in the list. - @return The job name or the empty string ("") to indicate any job name. - @see #setFilterJobInformation - **/ - public String getFilterJobName() - { - return filterJobName_; - } - - /** - Returns the job number portion of the job information used to determine which spooled files belong in the list. - @return The job number or the empty string ("") to indicate any job number. - @see #setFilterJobInformation - **/ - public String getFilterJobNumber() - { - return filterJobNumber_; - } - - /** - Returns the job system name used to determine which spooled files belong in the list. - @return The job system name, "*CURRENT" for the current system, or null to indicate the default of "*ALL" meaning the list is not being filtered by job system name. Note that the job system name filter is only used when connecting to systems running operating system releases V5R2M0 and higher. - @see #setFilterJobSystemName - **/ - public String getFilterJobSystemName() - { - return filterJobSystemName_; - } - - /** - Returns the user name portion of the job information used to determine which spooled files belong in the list. - @return The user name or the empty string ("") to indicate any user name. - @see #setFilterJobInformation - **/ - public String getFilterJobUser() - { - return filterJobUser_; - } - - /** - Returns the output queue names being used to filter the list of spooled files. - @return The array of fully-qualified integrated file system path names of output queues, or null if the list is not being filtered by output queue. - **/ - public String[] getFilterOutputQueues() - { - if (filterOutputQueues_ == null) return null; - String[] returnValue = new String[filterOutputQueues_.length]; - for (int i = 0; i < filterOutputQueues_.length; ++i) - { - returnValue[i] = filterOutputQueues_[i].getPath(); - } - return returnValue; - } - - /** - Returns the statuses being used to filter the list of spooled files. - @return The array of statuses or null if the list is not being filtered by status. - **/ - public String[] getFilterStatuses() - { - return filterStatuses_; - } - - /** - Returns the user data being used to filter the list of spooled files. - @return The user data or null if the list is not being filtered by user data. - **/ - public String getFilterUserData() - { - return filterUserData_; - } - - /** - Returns the user names being used to filter the list of spooled files. - @return The array of user names or null if the list is not being filtered by user name. - **/ - public String[] getFilterUsers() - { - return filterUsers_; - } - - /** - Returns the format currently in use by this open list. Possible values are: -
        -
      • {@link #FORMAT_0100 FORMAT_0100} -
      • {@link #FORMAT_0200 FORMAT_0200} -
      • {@link #FORMAT_0300 FORMAT_0300} -
      - @return The format. The default format is FORMAT_0300. - **/ - public String getFormat() - { - switch (format_) - { - case 1: return FORMAT_0100; - case 2: return FORMAT_0200; - } - return FORMAT_0300; - } - - /** - Sets the creation date range used to filter the list of spooled files. By default, the list is not filtered by creation date. Note that the creation date filter is only used when connecting to systems running operating system releases V5R2M0 and higher. - @param filterCreationDateStart The start date. All spooled files with a creation date and time equal to or later than the start date will be selected. Specify null to indicate that the earliest creation date and later will be selected, up to the specified end date. - @param filterCreationDateEnd The end date. All spooled files with a creation date and time equal to or earlier than the end date will be selected. Specify null to indicate that the latest creation date and earlier will be selected, down to the specified start date. - @see #getFilterCreationDateStart - @see #getFilterCreationDateEnd - **/ - public void setFilterCreationDate(Date filterCreationDateStart, Date filterCreationDateEnd) - { - filterCreationDateStart_ = filterCreationDateStart; - filterCreationDateEnd_ = filterCreationDateEnd; - resetHandle(); - } - - /** - Sets the printer device names used to filter the list of spooled files. - @param devices The array of printer device names. Only spooled files that belong to the specified printer devices are returned in the list. Specify null to clear the status filter, so that spooled files in the list are no longer filtered based on device. - **/ - public void setFilterDevices(String[] devices) - { - filterDevices_ = devices; - resetHandle(); - } - - /** - Sets the form type used to filter the list of spooled files. - @param formType The form type. Only spooled files whose form type matches the specified form type are returned in the list. Specify "*STD" for the standard form type. Specify null to clear the form type filter, so that spooled files in the list are no longer filtered based on form type. - **/ - public void setFilterFormType(String formType) - { - filterFormType_ = formType; - resetHandle(); - } - - /** - Sets the qualified job information used to filter the list of spooled files. Specifying null for a parameter resets it to its default value of blank. Blank is only valid for a parameter if all three parameters are specified as blank, or the filterJobName parameter is specified as "*". - @param filterJobName The job name of the job whose spooled files are to be included in the list. Specify "*" for the current job. If "*" is specified, the filterJobUser and filterJobNumber parameters are automatically set to blank. - @param filterJobUser The user name of the job whose spooled files are to be included in the list. - @param filterJobNumber The job number of the job whose spooled files are to be included in the list. - @see #getFilterJobName - @see #getFilterJobUser - @see #getFilterJobNumber - **/ - public void setFilterJobInformation(String filterJobName, String filterJobUser, String filterJobNumber) - { - filterJobName_ = filterJobName == null ? "" : filterJobName.trim(); - filterJobUser_ = filterJobUser == null ? "" : filterJobUser.trim(); - filterJobNumber_ = filterJobNumber == null ? "" : filterJobNumber.trim(); - - if (filterJobName_.equals("*")) - { - filterJobUser_ = ""; - filterJobNumber_ = ""; - } - resetHandle(); - } - - /** - Sets the job system name used to filter the list of spooled files. Specifying null resets it to its default value of "*ALL". Note that the job system name filter is only used when connecting to systems running operating system releases V5R2 and higher. - @param systemName Only spooled files created on systemNamewill be included in the list. Specify "*CURRENT" to return only spooled files created on the current system. - @see #getFilterJobSystemName - **/ - public void setFilterJobSystemName(String systemName) - { - filterJobSystemName_ = systemName; - resetHandle(); - } - - /** - Sets the output queues used to filter the list of spooled files. - @param filterOutputQueues An array of fully-qualified integrated file system path names of output queues. Only spooled files that reside in the specified output queues are returned in the list. Specify null to clear the output queue filter, so that the spooled files in the list are no longer filtered based on output queue. - **/ - public void setFilterOutputQueues(String[] filterOutputQueues) - { - if (filterOutputQueues == null) - { - filterOutputQueues_ = null; - } - else - { - filterOutputQueues_ = new QSYSObjectPathName[filterOutputQueues.length]; - for (int i = 0; i < filterOutputQueues.length; ++i) - { - filterOutputQueues_[i] = new QSYSObjectPathName(filterOutputQueues[i]); - // Ensure that the type is correct. - if (!filterOutputQueues_[i].getObjectType().equals("OUTQ")) - { - Trace.log(Trace.WARNING, "Object type is not valid, path: '" + filterOutputQueues[i] + "'"); - } - } - } - resetHandle(); - } - - /** - Sets the statuses used to filter the list of spooled files. Possible status values are: -
        -
      • {@link com.ibm.as400.access.list.SpooledFileListItem#STATUS_CLOSED SpooledFileListItem.STATUS_CLOSED} - "*CLOSED" -
      • {@link com.ibm.as400.access.list.SpooledFileListItem#STATUS_DEFERRED SpooledFileListItem.STATUS_DEFERRED} - "*DEFERRED" -
      • {@link com.ibm.as400.access.list.SpooledFileListItem#STATUS_SENDING SpooledFileListItem.STATUS_SENDING} - "*SENDING" -
      • {@link com.ibm.as400.access.list.SpooledFileListItem#STATUS_FINISHED SpooledFileListItem.STATUS_FINISHED} - "*FINISHED" -
      • {@link com.ibm.as400.access.list.SpooledFileListItem#STATUS_HELD SpooledFileListItem.STATUS_HELD} - "*HELD" -
      • {@link com.ibm.as400.access.list.SpooledFileListItem#STATUS_MESSAGE_WAIT SpooledFileListItem.STATUS_MESSAGE_WAIT} - "*MESSAGE" -
      • {@link com.ibm.as400.access.list.SpooledFileListItem#STATUS_OPEN SpooledFileListItem.STATUS_OPEN} - "*OPEN" -
      • {@link com.ibm.as400.access.list.SpooledFileListItem#STATUS_PENDING SpooledFileListItem.STATUS_PENDING} - "*PENDING" -
      • {@link com.ibm.as400.access.list.SpooledFileListItem#STATUS_PRINTING SpooledFileListItem.STATUS_PRINTING} - "*PRINTER" -
      • {@link com.ibm.as400.access.list.SpooledFileListItem#STATUS_READY SpooledFileListItem.STATUS_READY} - "*READY" -
      • {@link com.ibm.as400.access.list.SpooledFileListItem#STATUS_SAVED SpooledFileListItem.STATUS_SAVED} - "*SAVED" -
      • {@link com.ibm.as400.access.list.SpooledFileListItem#STATUS_WRITING SpooledFileListItem.STATUS_WRITING} - "*WRITING" -
      - @param statuses The array of statuses. Only spooled files whose status matches one of the specified statuses are returned in the list. Specify null to clear the status filter, so that spooled files in the list are no longer filtered based on status. - **/ - public void setFilterStatuses(String[] statuses) - { - filterStatuses_ = statuses; - resetHandle(); - } - - /** - Sets the user data used to filter the list of spooled files. - @param userData The user data. Only spooled files whose user data exactly matches the specified user data are returned in the list. Specify null to clear the user data filter, so that spooled files in the list are no longer filtered based on user data. - **/ - public void setFilterUserData(String userData) - { - filterUserData_ = userData; - resetHandle(); - } - - /** - Sets the user names used to filter the list of spooled files. - @param users An array of user names. Only spooled files that were created by the specified users are returned in the list. Specify "*CURRENT" as one of the users to mean the current user profile. Specify null to clear the user filter, so that the spooled files in the list are no longer filtered based on user name. - **/ - public void setFilterUsers(String[] users) - { - filterUsers_ = users; - resetHandle(); - } - - /** - Sets the format this list will use on the next call to {@link #open open()}. Any SpooledFileListItems generated by this list will have attributes associated with the specified format. The default format is FORMAT_0300. - @param format The format of the underlying API. Possible values are: -
        -
      • {@link #FORMAT_0100 FORMAT_0100} - This is faster than FORMAT_0200. -
      • {@link #FORMAT_0200 FORMAT_0200} - Contains more information than FORMAT_0100. -
      • {@link #FORMAT_0300 FORMAT_0300} - This is faster than FORMAT_0100. -
      - **/ - public void setFormat(String format) - { - if (format == null) - { - Trace.log(Trace.ERROR, "Parameter 'format' is null."); - throw new NullPointerException("format"); - } - format = format.toUpperCase().trim(); - if (format.equals(FORMAT_0100)) - { - format_ = 1; - } - else if (format.equals(FORMAT_0200)) - { - format_ = 2; - } - else if (format.equals(FORMAT_0300)) - { - format_ = 3; - } - else - { - Trace.log(Trace.ERROR, "Value of parameter 'format' is not valid: " + format); - throw new ExtendedIllegalArgumentException("format (" + format + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - resetHandle(); - } -} diff --git a/cvsroot/src/com/ibm/as400/access/list/package.html b/cvsroot/src/com/ibm/as400/access/list/package.html deleted file mode 100644 index c15223467..000000000 --- a/cvsroot/src/com/ibm/as400/access/list/package.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - -Provides classes that efficiently access lists of resources on an IBM i system. - -

      -Classes in this package are wrappers around the IBM i "Open List" (QGY) system APIs. A list of -resources is compiled on the system to satisfy certain filter criteria. The list can then be accessed -sequentially or randomly by the client. -

      - -

      -Users can implement their own Open List API wrappers by extending the com.ibm.as400.access.list.OpenList class. -

      - -

      Related Documentation

      - -For overviews, tutorials, examples, guides, and tool documentation, please see: - - - - diff --git a/cvsroot/src/com/ibm/as400/access/package.html b/cvsroot/src/com/ibm/as400/access/package.html deleted file mode 100644 index a276cbc7d..000000000 --- a/cvsroot/src/com/ibm/as400/access/package.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - -Provides classes that represent various IBM i data and resources. - -

      -These classes work with IBM i systems to provide an internet-enabled interface -to access and update data and resources on the system. -

      - -

      -The access classes use the existing IBM i host servers as the access points to the -system. Each host server runs in a separate job on the system, and sends and -receives data streams on a socket connection. -

      - -

      Related Documentation

      - -For overviews, tutorials, examples, guides, and tool documentation, please see: - - - - diff --git a/cvsroot/src/com/ibm/as400/data/DAMRI.java b/cvsroot/src/com/ibm/as400/data/DAMRI.java deleted file mode 100644 index 485d8eeb2..000000000 --- a/cvsroot/src/com/ibm/as400/data/DAMRI.java +++ /dev/null @@ -1,216 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DAMRI.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import java.util.ListResourceBundle; - -/** - Locale-specific objects for IBM Toolbox for Java. - **/ -public class DAMRI extends ListResourceBundle -{ - // NLS_MESSAGEFORMAT_ALL - // Each string is assumed to be processed by the MessageFormat class. - // This means that a single quote must be coded as 2 consecutive single quotes ''. - - // NLS_ENCODING=UTF-8 - // Instructs the translation tools to interpret the text as UTF-8. - - // Define constants so compiler can catch invalid keys - public final static String PCML_EXCEPTION_TITLE = "PCML_EXCEPTION_TITLE"; - public final static String MISSING_KEY = "MISSING_KEY"; - public final static String INPUT_VALUE_NOT_SET = "INPUT_VALUE_NOT_SET"; - public final static String NULL_VALUE = "NULL_VALUE"; - public final static String STRING_OR_NUMBER = "STRING_OR_NUMBER"; - public final static String BYTE_ARRAY = "BYTE_ARRAY"; - public final static String UNSUPPORTED_CCSID = "UNSUPPORTED_CCSID"; - public final static String STRING_TO_BYTES = "STRING_TO_BYTES"; - public final static String ELEMENT_NOT_FOUND = "ELEMENT_NOT_FOUND"; - public final static String WRONG_ELEMENT_TYPE = "WRONG_ELEMENT_TYPE"; - public final static String TOO_FEW_INDICES = "TOO_FEW_INDICES"; - public final static String INDEX_OUT_OF_BOUNDS = "INDEX_OUT_OF_BOUNDS"; - public final static String FAILED_TO_PARSE = "FAILED_TO_PARSE"; - public final static String ONE_PARSE_ERROR = "ONE_PARSE_ERROR"; - public final static String MANY_PARSE_ERRORS = "MANY_PARSE_ERRORS"; - public final static String FAILED_TO_VALIDATE = "FAILED_TO_VALIDATE"; - public final static String SERIALIZED_PCML_NOT_FOUND = "SERIALIZED_PCML_NOT_FOUND"; - public final static String PCML_NOT_FOUND = "PCML_NOT_FOUND"; - public final static String PCML_DTD_NOT_FOUND = "PCML_DTD_NOT_FOUND"; - public final static String PCML_SERIALIZED = "PCML_SERIALIZED"; - public final static String EXCEPTION_RECEIVED = "EXCEPTION_RECEIVED"; - public final static String OFFSETFROM_NOT_FOUND = "OFFSETFROM_NOT_FOUND"; - public final static String CIRCULAR_REFERENCE = "CIRCULAR_REFERENCE"; - public final static String REF_NOT_FOUND = "REF_NOT_FOUND"; - public final static String REF_WRONG_TYPE = "REF_WRONG_TYPE"; - public final static String MULTIPLE_DEFINE = "MULTIPLE_DEFINE"; - public final static String BAD_ATTRIBUTE_SYNTAX = "BAD_ATTRIBUTE_SYNTAX"; - public final static String BAD_ATTRIBUTE_VALUE = "BAD_ATTRIBUTE_VALUE"; - public final static String ATTRIBUTE_NOT_ALLOWED = "ATTRIBUTE_NOT_ALLOWED"; - public final static String INITIAL_VALUE_ERROR = "INITIAL_VALUE_ERROR"; - public final static String PARSEORDER_NOT_FOUND = "PARSEORDER_NOT_FOUND"; - public final static String PARSEORDER_NOT_CHILD = "PARSEORDER_NOT_CHILD"; - public final static String BAD_TAG = "BAD_TAG"; - public final static String ATTR_REF_NOT_FOUND = "ATTR_REF_NOT_FOUND"; - public final static String ATTR_REF_WRONG_NODETYPE = "ATTR_REF_WRONG_NODETYPE"; - public final static String ATTR_REF_WRONG_DATATYPE = "ATTR_REF_WRONG_DATATYPE"; - public final static String BAD_DATA_LENGTH = "BAD_DATA_LENGTH"; - public final static String DATA_LENGTH_OUT_OF_RANGE = "DATA_LENGTH_OUT_OF_RANGE"; // after 7.1 - public final static String BAD_OFFSET_VALUE = "BAD_OFFSET_VALUE"; - public final static String BAD_TOTAL_OFFSET = "BAD_TOTAL_OFFSET"; - public final static String NOT_ENOUGH_DATA = "NOT_ENOUGH_DATA"; - public final static String READ_DATA = "READ_DATA"; - public final static String READ_DATA_W_INDICES = "READ_DATA_W_INDICES"; - public final static String WRITE_DATA = "WRITE_DATA"; - public final static String WRITE_DATA_W_INDICES = "WRITE_DATA_W_INDICES"; - public final static String PCD_ARGUMENTS = "PCD_ARGUMENTS"; - - // The following are new in Toolbox mod3 - - public final static String BAD_PCML_VERSION = "BAD_PCML_VERSION"; // @B1A - public final static String NOT_CHILD_OF_PGM = "NOT_CHILD_OF_PGM"; // @B1A - public final static String NOT_SRVPGM = "NOT_SRVPGM"; // @B1A - public final static String NO_ENTRYPOINT = "NO_ENTRYPOINT"; // @B1A - public final static String TOO_MANY_PARMS = "TOO_MANY_PARMS"; // @B1A - public final static String NOT_SERVICE_PGM = "NOT_SERVICE_PGM"; // @B1A - - // The following are new in Toolbox mod4 - - public final static String DOCUMENT_ALREADY_SET = "DOCUMENT_ALREADY_SET"; // @C1A - public final static String DOCUMENT_NOT_SET = "DOCUMENT_NOT_SET"; // @C2A - public final static String DATATYPE_NOT_SUPPORTED = "DATATYPE_NOT_SUPPORTED"; // @C2A - public final static String MULTI_ARRAY_NOT_SUPPORTED = "MULTI_ARRAY_NOT_SUPPORTED"; // @C2A - public final static String NO_STRUCT = "NO_STRUCT"; // @C2A - public final static String NO_LENGTH = "NO_LENGTH"; // @C2A - public final static String INSUFFICIENT_INPUT_DATA = "INSUFFICIENT_INPUT_DATA"; // @C2A - public final static String EXCESS_INPUT_DATA = "EXCESS_INPUT_DATA"; // @C2A - public final static String RECORD_NOT_INITIALIZED = "RECORD_NOT_INITIALIZED"; // @C2A - public final static String RECORDFORMAT_NOT_INITIALIZED = "RECORDFORMAT_NOT_INITIALIZED"; // @C2A - public final static String SERIALIZED_XML_NOT_FOUND = "SERIALIZED_XML_NOT_FOUND"; // @C2A - public final static String XML_NOT_FOUND = "XML_NOT_FOUND"; // @C2A - public final static String DTD_NOT_FOUND = "DTD_NOT_FOUND"; // @C2A - public final static String XML_SERIALIZED = "XML_SERIALIZED"; // @C2A - public final static String STRUCT_VALUE = "STRUCT_VALUE"; // @C2A - public final static String DUPLICATE_FIELD_NAME = "DUPLICATE_FIELD_NAME"; // @C3A - - // Internal errors - public final static String BAD_DATA_TYPE = "BAD_DATA_TYPE"; - public final static String BAD_NODE_TYPE = "BAD_NODE_TYPE"; - public final static String CLASS_NOT_FOUND = "CLASS_NOT_FOUND"; - public final static String ERROR_ACCESSING_VALUE = "ERROR_ACCESSING_VALUE"; - - - - public Object[][] getContents() - { - return contents; - } - - static final Object[][] contents = { - // BEGIN TRANSLATION - - // Messages for PcmlException class - { PCML_EXCEPTION_TITLE, "Error" }, - { MISSING_KEY, "Text not available for error message key ''{0}''" }, - { INPUT_VALUE_NOT_SET, "Value is not set. Processing element ''{0}''." }, - { NULL_VALUE, "Cannot set a value to ''null''. Processing element ''{0}''." }, //@D1C - { STRING_OR_NUMBER, "Invalid data type ''{0}''. String or Number expected. Processing element ''{1}''." }, - { BYTE_ARRAY, "Invalid data type ''{0}''. byte[] expected. Processing element ''{1}''." }, - { UNSUPPORTED_CCSID, "Unsupported CCSID {0} for system {1}. Processing element ''{2}''." }, //@550 - { STRING_TO_BYTES, "Error converting String to data using CCSID {0}. Processing element ''{1}''." }, - { ELEMENT_NOT_FOUND, "{1} element named ''{0}'' not found in document." }, - { WRONG_ELEMENT_TYPE, "Element named ''{0}'' in document is not a {1} element." }, - { TOO_FEW_INDICES, "The number of indices required is {1}. The number of indices specified is {0}. Processing element ''{2}''." }, - { INDEX_OUT_OF_BOUNDS, "An index specified is out of bounds (0 - {0}). The index in error is index number {1} of the indices specified, {2}. Processing element ''{3}''." }, - { FAILED_TO_PARSE, "File ''{0}'' failed to parse." }, - { ONE_PARSE_ERROR, "1 error detected parsing pcml document." }, - { MANY_PARSE_ERRORS, "{0} errors detected parsing pcml document." }, - { FAILED_TO_VALIDATE, "File ''{0}'' contains PCML specification errors." }, - { SERIALIZED_PCML_NOT_FOUND, "Serialized PCML document ''{0}'' cannot be found." }, - { PCML_NOT_FOUND, "PCML document source ''{0}'' cannot be found." }, - { PCML_DTD_NOT_FOUND, "PCML document type definition (DTD) ''{0}'' cannot be found" }, - { PCML_SERIALIZED, "PCML document ''{0}'' saved." }, - { EXCEPTION_RECEIVED, "Exception received: {0}" }, // @C4C - { OFFSETFROM_NOT_FOUND, "Element ''{0}'' for offsetfrom= attribute is not a parent of this element. Processing element ''{1}''." }, - { CIRCULAR_REFERENCE, "Structure referenced, ''{0}'', is a circular reference. Processing {1} element ''{2}''." }, - { REF_NOT_FOUND, "{1} element named ''{0}'' not found in document. Processing {2} element ''{3}''." }, - { REF_WRONG_TYPE, "Element named ''{0}'' in document is not a {1} element. Processing {2} element ''{3}''." }, - { MULTIPLE_DEFINE, "More than one element named ''{0}'' in document." }, - { BAD_ATTRIBUTE_SYNTAX, "Syntax of attribute, {0}, is not correct. Processing {1} element ''{2}''." }, - { BAD_ATTRIBUTE_VALUE, "Value of attribute, {0}, is not correct. Processing {1} element ''{2}''." }, - { ATTRIBUTE_NOT_ALLOWED, "Attribute, {0}, is not allowed when {1} is specified. Processing {2} element ''{3}''." }, - { INITIAL_VALUE_ERROR, "Initial value {0} is not correct for the data type specified. Processing {1} element ''{2}''." }, - { PARSEORDER_NOT_FOUND, "{0} specified but ''{1}'' cannot be found in document. Processing {2} element ''{3}''." }, - { PARSEORDER_NOT_CHILD, "{0} specified but ''{1}'' is not a child of this element. Processing {2} element ''{3}''." }, - { BAD_TAG, "''{0}'' is an unrecognized tag name. Processing element ''{1}''." }, - { ATTR_REF_NOT_FOUND, "Element specified by ''{0}'' not found in document. Processing element ''{1}''." }, - { ATTR_REF_WRONG_NODETYPE, "Element specified by ''{0}'' found in document as ''{1}'' but is not a {2} element. Processing element ''{3}''." }, - { ATTR_REF_WRONG_DATATYPE, "Element specified by ''{0}'' found in document as ''{1}'' but is not a defined as {2}. Processing element ''{3}''." }, - { BAD_DATA_LENGTH, "Data length, {0}, is either negative or exceeds maximum supported length of {1}. Processing {2} element \"{3}\"." }, - { DATA_LENGTH_OUT_OF_RANGE, "Data length, {0}, is out of the supported range of {1} to {2}. Processing {3} element \"{4}\"." }, - { BAD_OFFSET_VALUE, "Offset to data, {0}, is either negative or exceeds number of bytes available, {1}. Processing {2} element \"{3}\"." }, - { BAD_TOTAL_OFFSET, "Offset to data, {0}, is either negative or exceeds number of bytes available, {1}. Offest is calculated as {2} bytes from document element {3}. Processing {4} element \"{5}\"." }, - { NOT_ENOUGH_DATA, "Not enough output data available for this document element. Processing {0} element \"{1}\"." }, - { PCD_ARGUMENTS, "Arguments are: [-serialize] " }, - - // The following are new in v4r5m0 - - { BAD_PCML_VERSION, "Attribute, {0}, only allowed with pcml version=\"{1}\" or later. Processing {2} element \"{3}\"." }, // @B1A - { NOT_CHILD_OF_PGM, "Attribute, {0}, only allowed when this element is a child of a element. Processing {1} element \"{2}\"." }, // @B1A - { NOT_SRVPGM, "Attribute, {0}, only allowed when path= attribute specifies a service program object. Processing {1} element \"{2}\"." }, // @B1A - { NO_ENTRYPOINT, "The entrypoint= attribute is required when path= attribute specifies a service program object. Processing {1} element \"{2}\"." }, // @B1A - { TOO_MANY_PARMS, "Attribute, {0}, only allowed for programs with {1} or fewer parameters. Processing {2} element \"{3}\"." }, // @B1A - { NOT_SERVICE_PGM, "Operation allowed only for {0} elements with {1} specified. Processing {2} element \"{3}\"." }, // @B1A - - // The following are new in Toolbox mod4 - - { DOCUMENT_ALREADY_SET, "Document is already set and cannot be set more than once." }, // @C1A - { DOCUMENT_NOT_SET, "Document has not been set." }, // @C2A - { DATATYPE_NOT_SUPPORTED, "Data type {0} is not supported by RFML." }, // @C2A - { MULTI_ARRAY_NOT_SUPPORTED, "Multidimensional AS400Array is not supported by RFML." }, // @C2A - { NO_STRUCT, "The struct= attribute is required when type=''struct''. Processing {1} element \"{2}\"." }, // @C2A @D1C - { NO_LENGTH, "The length= attribute is required when the type= attribute has a value other than ''struct''. Processing {1} element \"{2}\"." }, // @C2A @D1C - { INSUFFICIENT_INPUT_DATA, "Insufficient input data available for this document element. Bytes required: {0}\tBytes provided: {1}\tProcessing {2} element \"{3}\"." }, // @C2A - { EXCESS_INPUT_DATA, "Excess input data was provided for this document element. Bytes required: {0}\tBytes provided: {1}\tProcessing {2} element \"{3}\"." }, // @C2A - { RECORD_NOT_INITIALIZED, "The Record object is not initialized." }, // @C2A - { RECORDFORMAT_NOT_INITIALIZED, "The RecordFormat object is not initialized." }, // @C2A - - { SERIALIZED_XML_NOT_FOUND, "Serialized {0} document ''{1}'' cannot be found." }, // @C2A - { XML_NOT_FOUND, "{0} document source ''{1}'' cannot be found." }, // @C2A - { DTD_NOT_FOUND, "{0} document type definition (DTD) ''{1}'' cannot be found" }, // @C2A - { XML_SERIALIZED, "{0} document ''{1}'' saved." }, // @C2A - { STRUCT_VALUE, "Cannot set or get the value of a with type=''struct''. Processing element ''{0}''." }, // @C2A - { DUPLICATE_FIELD_NAME, "RecordFormat ''{0}'' has duplicate field name ''{1}''." }, // @C3A - - // NOTE TO TRANSLATORS: The following four messages are trace messages used for debugging - { READ_DATA, "Reading data -- Offset: {0}\tLength: {1}\tName: \"{2}\"\tByte data: {3}"}, - { READ_DATA_W_INDICES, "Reading data -- Offset: {0}\tLength: {1}\tName: \"{2}\" Indices: {3}\tByte data: {4}"}, - { WRITE_DATA, "Writing data -- Offset: {0}\tLength: {1}\tName: \"{2}\"\tByte data: {3}"}, - { WRITE_DATA_W_INDICES, "Writing data -- Offset: {0}\tLength: {1}\tName: \"{2}\" Indices: {3}\tByte data: {4}"}, - - - { "com.ibm.as400.data.ParseException", "A parse error occurred." }, - { "com.ibm.as400.data.PcmlSpecificationException", "A PCML specification error occurred." }, - { "java.io.IOException", "An I/O error occurred." }, - { "java.lang.ClassNotFound", "A ClassNotFound error occurred." }, - - - // Internal errors - { BAD_DATA_TYPE, "Internal Error: Unknown data type, {0}. Processing element ''{1}''." }, - { BAD_NODE_TYPE, "Internal Error: Unknown document node type, {0}. Processing document item ''{1}''." }, - { CLASS_NOT_FOUND, "Internal Error: Class not found for data type {0}. Processing document item ''{1}''." }, - { ERROR_ACCESSING_VALUE, "Internal Error: Error accessing data value. Indices: {0}, Dimensions: {1}. Processing element ''{2}''." }, - - // END TRANSLATION - }; -} diff --git a/cvsroot/src/com/ibm/as400/data/DataDescriptor.java b/cvsroot/src/com/ibm/as400/data/DataDescriptor.java deleted file mode 100644 index ea703984a..000000000 --- a/cvsroot/src/com/ibm/as400/data/DataDescriptor.java +++ /dev/null @@ -1,227 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataDescriptor.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import com.ibm.as400.access.ProgramParameter; -import com.ibm.as400.access.BidiStringType; - -/** - * The DataDescriptor class implements the methods of the Descriptor interface - * that are unique to the <data> tag. - * - **/ - -class DataDescriptor extends DocNodeDescriptor -{ - /* Constructor */ - public DataDescriptor(PcmlDocNode node) - { - super(node); - } - - /** - * Return the list of valid attributes for the data element. - **/ - public String[] getAttributeList() - { - return ((PcmlData)getDocNode()).getAttributeList(); - } - - /** - * Return a String containing the current value for the requested attribute. - **/ - public String getAttributeValue(String attr) - { - if (attr != null) - { - if (attr.equals("name")) - { - String name = getDocNode().getName(); - if (name.equals("")) - return null; - else - return name; - } - else if (attr.equals("usage")) - { - switch (getDocNode().getUsage()) - { - case PcmlDocNode.INPUT: - return "input"; - case PcmlDocNode.INPUTOUTPUT: - return "inputoutput"; - case PcmlDocNode.OUTPUT: - return "output"; - case PcmlDocNode.INHERIT: - return "inherit"; - } - } - else if (attr.equals("count")) - { - String countId = ((PcmlData)getDocNode()).getUnqualifiedCountId(); - if (countId != null) - return countId; - else - { - int count = ((PcmlData)getDocNode()).getCount(); - if (count < 1) - return null; - else - return Integer.toString(count); - } - } - else if (attr.equals("minvrm")) - return ((PcmlData)getDocNode()).getMinvrmString(); - else if (attr.equals("maxvrm")) - return ((PcmlData)getDocNode()).getMaxvrmString(); - else if (attr.equals("offset")) - { - String offsetId = ((PcmlData)getDocNode()).getUnqualifiedOffsetId(); - if (offsetId != null) - return offsetId; - else - { - int offset = ((PcmlData)getDocNode()).getOffset(); - if (offset < 1) - return null; - else - return Integer.toString(offset); - } - } - else if (attr.equals("offsetfrom")) - { - String offsetfromId = ((PcmlData)getDocNode()).getUnqualifiedOffsetfromId(); - if (offsetfromId != null) - return offsetfromId; - else - { - int offsetfrom = ((PcmlData)getDocNode()).getOffsetfrom(); - if (offsetfrom < 0) - return null; - else - return Integer.toString(offsetfrom); - } - } - else if (attr.equals("outputsize")) - { - String outputsizeId = ((PcmlData)getDocNode()).getUnqualifiedOutputsizeId(); - if (outputsizeId != null) - return outputsizeId; - else - { - int outputsize = ((PcmlData)getDocNode()).getOutputsize(); - if (outputsize < 1) - return null; - else - return Integer.toString(outputsize); - } - } - else if (attr.equals("type")) - { - switch (((PcmlData)getDocNode()).getDataType()) - { - case PcmlData.CHAR: - return "char"; - case PcmlData.INT: - return "int"; - case PcmlData.PACKED: - return "packed"; - case PcmlData.ZONED: - return "zoned"; - case PcmlData.FLOAT: - return "float"; - case PcmlData.BYTE: - return "byte"; - case PcmlData.STRUCT: - return "struct"; - case PcmlData.DATE: - return "date"; - case PcmlData.TIME: - return "time"; - case PcmlData.TIMESTAMP: - return "timestamp"; - } - } - else if (attr.equals("length")) - { - String lengthId = ((PcmlData)getDocNode()).getUnqualifiedLengthId(); - if (lengthId != null) - return lengthId; - else - { - if (((PcmlData)getDocNode()).isLengthSpecified() == true) // @A3a - return Integer.toString(((PcmlData)getDocNode()).getLength()); - else // @A3a - return null; // @A3a - } - } - else if (attr.equals("precision")) - { - int precision = ((PcmlData)getDocNode()).getPrecision(); - if (precision < 1) - return null; - else - return Integer.toString(precision); - } - else if (attr.equals("ccsid")) - { - String ccsidId = ((PcmlData)getDocNode()).getUnqualifiedCcsidId(); - if (ccsidId != null) - return ccsidId; - else - { - int ccsid = ((PcmlData)getDocNode()).getCcsid(); - if (ccsid < 1) - return null; - else - return Integer.toString(ccsid); - } - } - else if (attr.equals("init")) - return ((PcmlData)getDocNode()).getInit(); - else if (attr.equals("struct")) - return ((PcmlData)getDocNode()).getStruct(); - else if (attr.equals("passby")) - { - if (((PcmlData)getDocNode()).getPassby() == ProgramParameter.PASS_BY_VALUE) - return "value"; - else - return "reference"; - } - else if (attr.equals("bidistringtype")) - { - return (((PcmlData)getDocNode()).getBidistringtypeStr()); // @A2C - } - else if (attr.equals("trim")) // @D1A - { - return (((PcmlData)getDocNode()).getTrim()); // @D1A - } - else if (attr.equals("chartype")) // @D2A - { - return (((PcmlData)getDocNode()).getCharType()); // @D2A - } - else if (attr.equals("dateformat")) - return ((PcmlData)getDocNode()).getDateFormat(); - else if (attr.equals("timeformat")) - return ((PcmlData)getDocNode()).getTimeFormat(); - else if (attr.equals("dateseparator")) - return ((PcmlData)getDocNode()).getDateSeparator(); - else if (attr.equals("timeseparator")) - return ((PcmlData)getDocNode()).getTimeSeparator(); - else - return null; - } - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/data/Descriptor.java b/cvsroot/src/com/ibm/as400/data/Descriptor.java deleted file mode 100644 index 23c62881c..000000000 --- a/cvsroot/src/com/ibm/as400/data/Descriptor.java +++ /dev/null @@ -1,103 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Descriptor.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import java.util.Enumeration; - -/** - * The Descriptor interface defines a mechanism for inspecting a node - * of an XML based document. - *

      - * The idea is to give a programmer the ability to inspect the various - * tags and attribute values without having to parse the tags. This is - * useful in that some XML based documents do post-parser processing - * that can then be handled appropriately by implementations of this - * interface. - * - **/ - -public interface Descriptor -{ - - /** - * Returns an array of attribute names for the current node. - * - * @return Array containing the names of all attributes associated with - * the node type for this descriptor. - * If there are no attributes for this descriptor, an empty array is returned. - **/ - public String[] getAttributeList(); - - /** - * Returns the value of the named attribute. - * - * @return String containing the value of the specified attribute. - * If the named attribute is not valid for this descriptor, null is returned. - **/ - public String getAttributeValue(String attr); - - /** - * Returns the Descriptors of the children of this node. - * - * @return Descriptors for the children of this Descriptor as an Enumeration. - * If there are no children, an empty enumeration is returned. - **/ - public Enumeration getChildren(); - - /** - * Returns the Descriptor for another element contained within the same document. - * - * @return Descriptor for another element within the same document given a qualified - * name (i.e. - "structName1.structName2.dataElementName"). - * Returns null if there is no element with the specified name. - **/ - public Descriptor getDescriptor(String qualifiedName); - - /** - * Returns the simple name of the Descriptor as specified on the name= attribute of its - * associated tag. - * - * @return String containing the simple name of the Descriptor as specified on the name= - * attribute of its associated tag. - * If there is no name= attribute, null is returned. - **/ - public String getName(); - - /** - * Returns the qualified name of the Descriptor. This qualified name is the simple name - * prefixed with the qualified name of this Descriptor's parent and separated with a period ("."). - * - * @return String containing the qualified name of the Descriptor. - * If there is no qualified name, null is returned. - **/ - public String getQualifiedName(); - - /** - * Returns the tag name of the Descriptor. - * - * - * @return String containing the tag name of the element in the Descriptor. - **/ - public String getTagName(); - - /** - * Returns true if this Descriptor has childen. - * Returns false if this Descriptor has no childen. - * - * - * @return Boolean indicating if the Descriptor has children. - **/ - public boolean hasChildren(); - -} diff --git a/cvsroot/src/com/ibm/as400/data/DocNodeDescriptor.java b/cvsroot/src/com/ibm/as400/data/DocNodeDescriptor.java deleted file mode 100644 index 99d9f35a2..000000000 --- a/cvsroot/src/com/ibm/as400/data/DocNodeDescriptor.java +++ /dev/null @@ -1,186 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DocNodeDescriptor.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import java.util.Enumeration; -import java.util.Vector; -import com.ibm.as400.access.InternalErrorException; // @A1A -import com.ibm.as400.access.Trace; // @A1A - -/** - * The DocNodeDescriptor class is an abstract class that provide implementations - * for common methods in the Descriptor interface. - * - **/ - -abstract class DocNodeDescriptor implements Descriptor -{ - protected PcmlDocNode m_docNode; // The PcmlDocNode object that is described by this Descriptor - - /* Constructor */ - public DocNodeDescriptor(PcmlDocNode node) - { - m_docNode = node; - } - - public PcmlDocNode getDocNode() - { - return m_docNode; - } - /** - * The following method is implemented in the subclasses. - **/ - abstract public String[] getAttributeList(); - - /** - * The following method is implemented in the subclasses. - **/ - abstract public String getAttributeValue(String attr); - - /* - * Returns the Descriptors of the children of this node. - * - * @return Descriptors for the children of this Descriptor as an Enumeration. - * If there are no children, an empty enumeration is returned. - **/ - public Enumeration getChildren() - { - int nbrChildren = m_docNode.getNbrChildren(); // Get number of children - Vector v = new Vector(nbrChildren); // Allocate correct vector size - - if (nbrChildren > 0) - { - PcmlDocNode dnChild; // Used to generate child Descriptors - DocNodeDescriptor child; - - Enumeration dnChildren = m_docNode.getChildren(); - while (dnChildren.hasMoreElements()) // For each PcmlDocNode - { - dnChild = (PcmlDocNode)dnChildren.nextElement(); // Get the next PcmlDocNode - if (dnChild instanceof PcmlStruct) - { - child = new StructDescriptor(dnChild); // Allocate StructDescriptor - } - else if (dnChild instanceof PcmlData) - { - child = new DataDescriptor(dnChild); // Allocate DataDescriptor - } - else if (dnChild instanceof PcmlProgram) - { - child = new ProgramDescriptor(dnChild); // Allocate ProgramDescriptor - } - else if (dnChild instanceof RfmlRecordFormat) // @A1A - { - child = new RecordFormatDescriptor(dnChild); - } - else // None of the above // @A1A - { - Trace.log(Trace.ERROR, "Unrecognized child element type: " + dnChild.getClass().getName()); // @A1A - throw new InternalErrorException(InternalErrorException.UNKNOWN); // @A1A - } - v.addElement(child); // Add child to vector - } - } - return v.elements(); // Return Enumeration of children - } - - /** - * Returns the Descriptor for another element contained within the same document. - * - * @return Descriptor for another element within the same document given a qualified - * name (i.e. - "structName1.structName2.dataElementName"). - * Returns null if there is no element with the specified name. - **/ - public Descriptor getDescriptor(String qualifiedName) - { - PcmlDocNode dn = (PcmlDocNode)m_docNode.getDoc().getElement(qualifiedName); - if (dn == null) - return null; - if (dn instanceof PcmlStruct) - { - return new StructDescriptor(dn); // Allocate StructDescriptor - } - else if (dn instanceof PcmlData) - { - return new DataDescriptor(dn); // Allocate DataDescriptor - } - else if (dn instanceof PcmlProgram) - { - return new ProgramDescriptor(dn); // Allocate ProgramDescriptor - } - else if (dn instanceof RfmlRecordFormat) // @A1A - { - return new RecordFormatDescriptor(dn); - } - else // None of the above @A1A - { - Trace.log(Trace.ERROR, "Unrecognized element type: " + dn.getClass().getName()); // @A1A - throw new InternalErrorException(InternalErrorException.UNKNOWN); // @A1A - } - } - - /** - * Returns the simple name of the Descriptor as specified on the name= attribute of its - * associated tag. - * - * @return String containing the simple name of the Descriptor as specified on the name= - * attribute of its associated tag. - * If there is no name= attribute, an empty String ("") is returned. - **/ - public String getName() - { - return m_docNode.getName(); - } - - /** - * Returns the qualified name of the Descriptor. This qualified name is the simple name - * prefixed with the qualified name of this Descriptor's parent and separated with a period ("."). - * - * @return String containing the qualified name of the Descriptor. - * If there is no name= attribute, an empty String ("") is returned. - **/ - public String getQualifiedName() - { - return m_docNode.getQualifiedName(); - } - - /** - * Returns the tag name of the Descriptor. - * - * - * @return String containing the tag name of the Descriptor. - * For example, this method could return a String containing one of the following values: - * pcml - * struct - * data - * program - **/ - public String getTagName() - { - return m_docNode.getTagName(); - } - - /** - * Returns true if this Descriptor has childen. - * Returns false if this Descriptor has no childen. - * - * - * @return Boolean indicating if the Descriptor has children. - **/ - public boolean hasChildren() - { - return m_docNode.hasChildren(); - } - -} diff --git a/cvsroot/src/com/ibm/as400/data/ParseException.java b/cvsroot/src/com/ibm/as400/data/ParseException.java deleted file mode 100644 index 757c439d9..000000000 --- a/cvsroot/src/com/ibm/as400/data/ParseException.java +++ /dev/null @@ -1,94 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ParseException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import com.ibm.as400.access.Trace; // @A1A -import java.util.Vector; -import java.io.StringWriter; // @A1A -import java.io.PrintWriter; // @A1A - -class ParseException extends Exception -{ - Vector m_messages = new Vector(); - - ParseException() - { - super(); - } - - ParseException(String s) - { - super(s); - } - - void addMessage(String msg) - { - m_messages.addElement(msg); - } - - public void reportErrors() - { - ///System.err.println(toString()); // @A1D - reportErrors(new PrintWriter(System.err, true)); // @A1C - } - - // @A1A - public String getLocalizedMessage() - { - return getMessage(); - } - - // @A1A - Moved logic to here from original reportErrors() method. - private void reportErrors(PrintWriter writer) - { - int count = m_messages.size(); - for (int i = 0; i < count; i++) - { - // Check if first message indicates DTD not found and - // suppress all the parser errors if true - if (i == 0) - { - String msg = (String)m_messages.elementAt(i); - if (msg != null && // @A1A - msg.indexOf("java.io.FileNotFoundException") != -1 && msg.indexOf(".dtd") != -1) - count = 1; - } - - writer.println((String)m_messages.elementAt(i)); - } - - if (count == 1) - writer.println( SystemResourceFinder.format( DAMRI.ONE_PARSE_ERROR ) ); - else - writer.println( SystemResourceFinder.format( DAMRI.MANY_PARSE_ERRORS, new Object[] {new Integer(count)} ) ); - // Note: The previous 2 messages refer to "PCML". @A1A - if (writer.checkError()) // See if writer had any trouble. @A1A - { - Trace.log(Trace.ERROR, "Error when reporting errors to PrintWriter."); // @A1A - System.err.println(toString()); // @A1A - } - // Note: Don't close the writer here, as it might be System.out or System.err. - - } - - public String getMessage() - { - StringWriter writer = new StringWriter(); - reportErrors(new PrintWriter(writer)); - String msg = writer.toString(); - try { writer.close(); } catch (java.io.IOException e) {} - return msg; - } - -} diff --git a/cvsroot/src/com/ibm/as400/data/PcmlAttribute.java b/cvsroot/src/com/ibm/as400/data/PcmlAttribute.java deleted file mode 100644 index 92023cc6a..000000000 --- a/cvsroot/src/com/ibm/as400/data/PcmlAttribute.java +++ /dev/null @@ -1,42 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PcmlAttribute.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -class PcmlAttribute extends Object { - private String name; - private String value; - private boolean specified; - - PcmlAttribute(String aName, String aValue, boolean aFlag) - { - name = aName; - value = aValue; - specified = aFlag; - } - - String getName() - { - return name; - } - - String getAttributeValue() - { - return value; - } - - boolean getSpecified() - { - return specified; - } -} diff --git a/cvsroot/src/com/ibm/as400/data/PcmlAttributeList.java b/cvsroot/src/com/ibm/as400/data/PcmlAttributeList.java deleted file mode 100644 index ed478b491..000000000 --- a/cvsroot/src/com/ibm/as400/data/PcmlAttributeList.java +++ /dev/null @@ -1,46 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PcmlAttributeList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import java.util.Vector; -import java.util.Enumeration; - -class PcmlAttributeList extends Object { - private Vector v; - //private String value; - //private boolean specified; - - PcmlAttributeList(int size) - { - v = new Vector(size); - } - - void addAttribute(PcmlAttribute attr) - { - v.addElement(attr); - } - - String getAttributeValue(String name) - { - for (int i = 0; i < v.size(); i++) - { - PcmlAttribute attr = (PcmlAttribute) v.elementAt(i); - if ( attr.getName().equals(name) ) - { - return attr.getAttributeValue(); - } - } - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/data/PcmlData.java b/cvsroot/src/com/ibm/as400/data/PcmlData.java deleted file mode 100644 index 1d9783839..000000000 --- a/cvsroot/src/com/ibm/as400/data/PcmlData.java +++ /dev/null @@ -1,2516 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PcmlData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400Date; -import com.ibm.as400.access.AS400Time; -import com.ibm.as400.access.AS400Timestamp; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ProgramParameter; // @B1A -import com.ibm.as400.access.BidiStringType; // @C9A - -import java.io.IOException; // @C1A -import java.io.ObjectOutputStream; // @C1A -import java.io.OutputStream; - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.StringTokenizer; - -class PcmlData extends PcmlDocNode -{ - /*********************************************************** - Static Members - ***********************************************************/ - - // Constant values for type= attribute - public static final int UNSUPPORTED = 0; - public static final int CHAR = 1; - public static final int INT = 2; - public static final int PACKED = 3; - public static final int ZONED = 4; - public static final int FLOAT = 5; - public static final int BYTE = 6; - public static final int STRUCT = 7; - - public static final int DATE = 8; // PCML version 6.0 - public static final int TIME = 9; // PCML version 6.0 - public static final int TIMESTAMP = 10; // PCML version 6.0 - - // Largest length= supported for type="char" and type="byte" - public static final int MAX_STRING_LENGTH = 1024*1024; // @C6C - - // Serial verion unique identifier - static final long serialVersionUID = 8578048664805881489L; - - // New attributes should be added to the end of this array - private static final String DATAATTRIBUTES[] = { - "name", - "usage", - "count", - "minvrm", - "maxvrm", - "offset", - "offsetfrom", - "outputsize", - "type", - "length", - "precision", - "ccsid", - "init", - "struct", - "passby", // PCML Ver. 2.0 - "bidistringtype", // PCML Ver. 3.0 @C9A - "trim", // PCML Ver. 4.0 @D1A - "chartype", // PCML Ver. 4.0 @D2A - // Note: "keyfield" is unique to RFML (Ver. 5.0), so is not listed here. - "dateformat", // PCML Ver. 6.0 - "dateseparator", // PCML Ver. 6.0 - "timeformat", // PCML Ver. 6.0 - "timeseparator" // PCML Ver. 6.0 - }; - private static final int VERSION_1_ATTRIBUTE_COUNT = 14; - private static final int VERSION_2_ATTRIBUTE_COUNT = 15; - private static final int VERSION_3_ATTRIBUTE_COUNT = 16; // @C9A - private static final int VERSION_4_ATTRIBUTE_COUNT = 18; // @D1A @D2C - private static final int VERSION_5_ATTRIBUTE_COUNT = 20; - - private static Hashtable bidiTypeMap_; - - /*********************************************************** - Instance Members - ***********************************************************/ - - // The "m_name" and "m_usage" attributes are implemented by PcmlDocNode - - // The following values are implemented by PcmlData and PcmlStruct - private int m_Count; // count=, integer literal - private String m_CountId; // count=, element name - private int m_Offset; // offset=, integer literal - private String m_OffsetId; // offset=, element name - private boolean m_OffsetfromFixed; // Flag indicating whether serialized version @A1A - // of this object contains fix for offsetfrom - private int m_Offsetfrom; // offsetfrom=, integer literal @A1A - private String m_OffsetfromId; // offsetfrom=, element name - private String m_Minvrm; // minvrm=, string literal - private int m_MinvrmInt; // minvrm=, from AS400.generateVRM() - private String m_Maxvrm; // maxvrm=, string literal - private int m_MaxvrmInt; // maxvrm=, from AS400.generateVRM() - private int m_Outputsize; // outputsize=, integer literal - private String m_OutputsizeId; // outputsize=, element name - - // The following attribute are implemented only by PcmlData - private String m_TypeStr; // type=, string literal - private int m_Type; // type=, integer representing data type - private int m_Length; // length=, integer literal - private String m_LengthId; // length=, element name - private boolean m_LengthWasSpecified; // Indicates whether length was specified. @D0A - private int m_Precision; // precison=, integer literal - private int m_Ccsid; // ccsid=, integer literal - private String m_CcsidId; // ccsid=, element name - private boolean m_CcsidWasSpecified; // Indicates whether ccsid was specified. @D0A - private String m_Init; // init=, string literal - private String m_StructId; // struct=, element name - - // The following attributes added for PCML v2.0 - private String m_PassbyStr; // passby=, string literal @B1A - private int m_Passby; // passby=, integer representing passby value @B1A - - // The following attributes added for PCML v3.0 - private String m_BidistringtypeStr; // bidistringtype=, string literal @C9A - private int m_Bidistringtype; // bidistringtype=, integer representing value @C9A - - private boolean m_IsRfml; // Indicates whether RFML versus PCML. @D0A - - // The following attributes added for PCML v4.0 - private String m_TrimStr; // trim=, string literal @D1A - private String m_CharType; // chartype=, string literal @D2A - - // The following attributes added for RFML v5.0 (not relevant to PCML) - private String m_KeyFieldStr; // keyfield=, string literal - private boolean m_KeyField; // keyfield=, boolean representing value - - // The following attributes added for PCML v6.0 - private String m_DateFormat; // dateformat=, string literal - private String m_DateSeparator; // dateseparator=, string literal (single character) - private String m_TimeFormat; // timeformat=, string literal - private String m_TimeSeparator; // timeseparator=, string literal (single character) - - // We store 'separator' values as String rather than char, - // in order to use 'null' to indicate 'not set'. - - /*********************************************************** - Semi-Transient Members -- - Not written when serializing interface definition. - Written when serializing ProgramCallDocument object. - ***********************************************************/ - private PcmlDataValues m_scalarValue; // @C1C - private PcmlDataVector m_vectorValue; // @C1C - - // Default constructor - PcmlData() - { - this(false); // @D0A - } - - // Constructor with description - PcmlData(PcmlAttributeList attrs) // @C3C - { - this(attrs, false); // @D0C - } - - PcmlData(boolean isRfml) // @D0A - { - m_IsRfml = isRfml; - } - - // Constructor with description - PcmlData(PcmlAttributeList attrs, boolean isRfml) // @D0A - { - super(attrs); // @C3C - m_IsRfml = isRfml; // @D0A - setNodeType(PcmlNodeType.DATA); // @C3C - - // ********************************** - // Set attribute values - // - // The following code extracts the attribute values - // from the parsed document node and - // stores the values in private data members. - // ********************************** - - // Set count= attribute value - setCount(getAttributeValue("count")); - - // Set offset= attribute value - setOffset(getAttributeValue("offset")); - - // Set offsetfrom= attribute value - setOffsetfrom(getAttributeValue("offsetfrom")); - - // Set minvrm= attribute value - setMinvrm(getAttributeValue("minvrm")); - - // Set maxvrm= attribute value - setMaxvrm(getAttributeValue("maxvrm")); - - // Set type= attribute value - setType(getAttributeValue("type")); - - // Set length= attribute value - setLength(getAttributeValue("length")); - - // Set precision= attribute value - setPrecision(getAttributeValue("precision")); - - // Set ccsid= member variable - setCcsid(getAttributeValue("ccsid")); - - // Set init= member variable - setInit(getAttributeValue("init")); - - // Set outputsize= member variable - setOutputsize(getAttributeValue("outputsize")); - - // Set struct= member variable - setStruct(getAttributeValue("struct")); - - // Set passby= member variable - setPassby(getAttributeValue("passby")); // @B1A - - // Set bidistringtype= member variable - setBidiStringType(getAttributeValue("bidistringtype")); // @C9A - - // Set trim= attribute value - setTrim(getAttributeValue("trim")); // @D1A - - // Set chartype= attribute value - setCharType(getAttributeValue("chartype")); // @D2A - - // Set keyfield= attribute value (relevant only to RFML) - setKeyField(getAttributeValue("keyfield")); - - // Set dateformat= attribute value - setDateFormat(getAttributeValue("dateformat")); - - // Set dateseparator= attribute value - setDateSeparator(getAttributeValue("dateseparator")); - - // Set timeformat= attribute value - setTimeFormat(getAttributeValue("timeformat")); - - // Set timeseparator= attribute value - setTimeSeparator(getAttributeValue("timeseparator")); - - m_scalarValue = null; // Transient data created as needed - m_vectorValue = null; // Transient data created as needed - - } - - public Object clone() // @C5A - { // @C5A - PcmlData node = (PcmlData) super.clone(); // @C5A - // Cloning does not include 'live' data, only the interface - // definitions described by the PCML tags. - // Null out the 'semi-transient' data values. - node.m_scalarValue = null; // @C5A - node.m_vectorValue = null; // @C5A - - return node; // @C5A - } // @C5A - - - // Custom serialization - private void writeObject(ObjectOutputStream out) throws IOException // @C1A - { // @C1A - synchronized (this) // @C1A - { // @C1A - // Keep a local reference to the scalar and vector data values - PcmlDataValues scalarValue = m_scalarValue; // @C1A - PcmlDataVector vectorValue = m_vectorValue; // @C1A - - // If not saving with serialization, temporarily null out the - // scalar and vector data values member variables - // so they are not written to the ObjectOutputStream. - if ( !getDoc().isSerializingWithData() ) // @C1A - { // @C1A - m_scalarValue = null; // @C1A - m_vectorValue = null; // @C1A - } // @C1A - - // Perform default serialization - out.defaultWriteObject(); // @C1A - - // Restore scalar and vector data values - m_scalarValue = scalarValue; // @C1A - m_vectorValue = vectorValue; // @C1A - } // end of synchronized code // @C1A - } // @C1A - - // Custom deserialization post-processing - // This processing cannot be done during readObject() because - // references to parent objects in the document are not yet set - // due to the recursive nature of deserialization. - void readObjectPostprocessing() // @C1A - { // @C1A - if (m_scalarValue != null) // @C1A - m_scalarValue.readObjectPostprocessing(); // @C1A - if (m_vectorValue != null) // @C1A - m_vectorValue.readObjectPostprocessing(); // @C1A - - super.readObjectPostprocessing(); // @C1A - } // @C1A - - // Returns a single PcmlDataValues given an array of indices - private PcmlDataValues getPcmlDataValues(PcmlDimensions indices) throws PcmlException - { - int index; - int[] myDimensions = getDimensions(indices).asArray(); - - - // Make sure enough indices are specified - // Allow more indices than necessary in order to - // allow nieces and nephews to get access to - // values such as getCount() - if (indices.size() < myDimensions.length) - { - throw new PcmlException(DAMRI.TOO_FEW_INDICES, new Object[] {new Integer(indices.size()), new Integer(myDimensions.length), getNameForException()} ); - } - - if (myDimensions.length == 0) - { - if (m_scalarValue == null) - { - m_scalarValue = new PcmlDataValues(this, new PcmlDimensions()); - } - return m_scalarValue; - } - - PcmlDataValues item; - PcmlDataVector v, nextVector; - PcmlDimensions myIndices = new PcmlDimensions(); - - // If the vector for the first dimension (first index) has not been - // created, create and initialize the vector - if (m_vectorValue == null) - { - m_vectorValue = new PcmlDataVector(myDimensions[0], this, myIndices ); - for (int elem = 0; elem < myDimensions[0]; elem++) - { - m_vectorValue.addElement(null); - } - } - - // Walk down the tree of vectors. All but the last index is to a - // vector; the last index is to a PcmlDataValues. - long[] myDimensionTimestamps = getDimensionTimestamps(indices); - v = m_vectorValue; - for (int i = 0; i < myDimensions.length; i++) - { - - // If the current dimension is more recent - // than the dimension of the data, we need to - // trow away all data at this and deeper dimensions - // because it is stale. - // In other words, the count= value was changed for this dimension - // and we need to throw away all the values stored. - if ( myDimensionTimestamps[i] > v.getTimestamp() ) - { - v.redimension(myDimensions[i]); - } - - // Get index for current dimension and add it to my working PcmlDimensions - index = indices.at(i); - myIndices.add(index); - - // Make sure index is not out of bounds - if (index < 0 || index >= myDimensions[i]) - { - throw new PcmlException(DAMRI.INDEX_OUT_OF_BOUNDS, new Object[] {new Integer(myDimensions[i]-1), new Integer(i), indices, getNameForException()} ); // @D0C Subtract 1 from myDimensions to get the upper end of range to come out right in the message. - } - - // If we have are not on the last (deepest) dimension - // get the PcmlDataVector for this dimension - if (i != myDimensions.length - 1 ) - { - nextVector = v.vectorAt(index); - // If no PcmlDataVector has been created yet, create one now - if (nextVector == null) - { - nextVector = new PcmlDataVector(myDimensions[i+1], this, myIndices); - for (int elem = 0; elem < myDimensions[i+1]; elem++) - { - nextVector.addElement(null); - } - v.setElementAt(nextVector, index); - } - v = nextVector; - } - // We are on the last (deepest) dimension, - // get the PcmlDataValues object -- at last! - else - { - item = v.valuesAt(index); - // If no PcmlDataValues has been created yet, create it now. - if (item == null) - { - item = new PcmlDataValues(this, myIndices); - v.setElementAt(item, index); - } - // Finally return the PcmlDataValues object requested - return item; - } - } - - // We should never get here, but... - throw new PcmlException(DAMRI.ERROR_ACCESSING_VALUE, new Object[] {indices, myDimensions, getNameForException()} ); - } - - // Get Timestamp of data - long getTimestamp(PcmlDimensions indices) throws PcmlException - { - // Make sure enough indices are specified - if ( indices.size() >= getNbrOfDimensions() ) - { - PcmlDataValues values = getPcmlDataValues(indices); - return values.getTimestamp(); - } - else - { - throw new PcmlException(DAMRI.TOO_FEW_INDICES, new Object[] {new Integer(indices.size()), new Integer(getNbrOfDimensions()), getNameForException()} ); - } - } - - // Get Java native value - final Object getValue() throws PcmlException - { - return getValue(new PcmlDimensions()); - } - - // Get Java native value - final Object getValue(PcmlDimensions indices) throws PcmlException - { - if (m_Type == CHAR) // @C9A - { - return getStringValue(indices, m_Bidistringtype); // @C9A - } - else // @C9A - { - // Make sure enough indices are specified - if ( indices.size() >= getNbrOfDimensions() ) - { - PcmlDataValues values = getPcmlDataValues(indices); - return values.getValue(); - } - else - { - throw new PcmlException(DAMRI.TOO_FEW_INDICES, new Object[] {new Integer(indices.size()), new Integer(getNbrOfDimensions()), getNameForException()} ); - } - } - } - - - // Get String value specifying string type - final String getStringValue(PcmlDimensions indices, int type) - throws PcmlException // @C9A - { - Object val = null; - - // Make sure enough indices are specified - if ( indices.size() >= getNbrOfDimensions() ) // @C9A - { - PcmlDataValues values = getPcmlDataValues(indices); // @C9A - if (m_Type == CHAR) // @CBA - values.setStringType(type); // Set the string type @C9A - val = values.getValue(); // Get the value @C9A @CAC - if (val == null) // @CBA - { - return null; // @CBA - } - if (val instanceof Number) - { - return ((Number)val).toString(); // @C9A - } - else if (val instanceof String) // @C9A - { - return (String)val; // @C9A - } - else // @C9A - { - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {val.getClass().getName(), getNameForException()} ); // @C9A - } - } - else - { - throw new PcmlException(DAMRI.TOO_FEW_INDICES, new Object[] {new Integer(indices.size()), new Integer(getNbrOfDimensions()), getNameForException()} ); // @C9A - } - } - - // Set Java native value - final void setValue(Object v) throws PcmlException - { - setValue(v, new PcmlDimensions()); - } - - // Set Java native value - final void setValue(Object v, PcmlDimensions indices) throws PcmlException - { - // Make sure enough indices are specified - if ( indices.size() >= getNbrOfDimensions() ) - { - PcmlDataValues values = getPcmlDataValues(indices); - values.setStringType(m_Bidistringtype); - values.setValue(v); - } - else - { - throw new PcmlException(DAMRI.TOO_FEW_INDICES, new Object[] {new Integer(indices.size()), new Integer(getNbrOfDimensions()), getNameForException()} ); - } - } - - // Set String value specifying string type - final void setStringValue(String val, PcmlDimensions indices, int type) - throws PcmlException // @C9A - { - // Make sure enough indices are specified - if ( indices.size() >= getNbrOfDimensions() ) // @C9A - { - PcmlDataValues values = getPcmlDataValues(indices); // @C9A - values.flushValues(); // Flush current values @C9A - values.setStringType(type); // Set the string type @C9A - values.setValue(val); // Set the value @C9A - } - else - { - throw new PcmlException(DAMRI.TOO_FEW_INDICES, new Object[] {new Integer(indices.size()), new Integer(getNbrOfDimensions()), getNameForException()} ); // @C9A - } - } - - // Set IBM i system bytes - void setBytes(byte[] ba) - { - } - - /** - * Return the list of valid attributes for the data element. - **/ - String[] getAttributeList() // @C7A - { - int returnCount = 0; // @C7A - String returnArray[]; // @C7A - - if ( getDoc().getVersion().compareTo("2.0") < 0 ) // @C7A - returnCount = VERSION_1_ATTRIBUTE_COUNT; // @C7A - else if ( getDoc().getVersion().compareTo("3.0") < 0 ) // @C9A - returnCount = VERSION_2_ATTRIBUTE_COUNT; // @C9A - else if ( getDoc().getVersion().compareTo("4.0") < 0 ) // @D1A - returnCount = VERSION_3_ATTRIBUTE_COUNT; // @D1A - else if ( getDoc().getVersion().compareTo("6.0") < 0 ) - returnCount = VERSION_4_ATTRIBUTE_COUNT; - else // Anything else: Return the entire array - return DATAATTRIBUTES; // @C7A - - returnArray = new String[returnCount]; // @C7A - - System.arraycopy(DATAATTRIBUTES, 0, returnArray, 0, returnCount); // @C7A - return returnArray; // @C7A - } - - - final int getCcsid(PcmlDimensions indices) throws PcmlException - { - int tmpCcsid = resolveIntegerValue( getCcsid(), - getCcsidId(), - indices ); - // If a CCSID is not explicitly defined for this element, - // use the CCSID from the element - if (tmpCcsid == 0) - { // @C2A - PcmlNode node = getParent(); // @C2A - while (node.getParent() != getDoc()) // @C2A - node = node.getParent(); // @C2A - // If this element is a descendent of a Program element - // use the CCSID saved the last time the - if (node instanceof PcmlProgram) // @C2A - return ((PcmlProgram) node).getProgramCCSID(); // @C2A - else // @C2A - return getDoc().getAs400().getCcsid(); // @C2A - } // @C2A - else - return tmpCcsid; - } - - // Get the run-time dimension for this element - final int getCount(PcmlDimensions indices) throws PcmlException - { - return resolveIntegerValue( getCount(), - getCountId(), - indices ); - } - - // @E0A -- New XPCML method - // Get the run-time dimension for this element but don't throw an exception if count not set - final int getXPCMLCount(PcmlDimensions indices) throws PcmlException - { - int rc; - try { - rc = resolveIntegerValue( getCount(), - getCountId(), - indices ); - return rc; - } - catch (Exception e) - { - return 0; - } - } - - // Get the count= integer literal value, if any - public final int getCount() - { - return m_Count; - } - - // Get the count= resolved element name, if any - public final String getCountId() - { - return resolveRelativeName(m_CountId); - } - - // Get the count= unresolved element name, if any - public final String getUnqualifiedCountId() // @C7A - { - return m_CountId; // @C7A - } - - final int getLength(PcmlDimensions indices) throws PcmlException - { - return resolveIntegerValue( getLength(), - getLengthId(), - indices ); - } - - // Get the run-time offset value for this element - final int getOffset(PcmlDimensions indices) throws PcmlException - { - return resolveIntegerValue( getOffset(), - getOffsetId(), - indices ); - } - - // Get the offset= integer literal value, if any - public final int getOffset() - { - return m_Offset; - } - - // Get the offset= resolved element name, if any - public final String getOffsetId() - { - return resolveRelativeName(m_OffsetId); - } - - // Get the offset= unresolved element name, if any - public final String getUnqualifiedOffsetId() // @C7A - { - return m_OffsetId; // @C7A - } - - // Return indication of whether this object contains - // the fix for ofsetfrom - private final boolean isOffsetfromFixed() // @A1A - { // @A1A - return m_OffsetfromFixed; // @A1A - } // @A1A - - // Get the passby= value as an integer (ProgramParameter constant) - public final int getPassby() // @B1A - { // @B1A - if (m_PassbyStr != null) // @B1A - return m_Passby; // @B1A - else // @B1A - return ProgramParameter.PASS_BY_REFERENCE; // @B1A - } // @B1A - - // Get the bidistringtype= value as an integer - public final String getBidistringtypeStr() // @C9A @CAC - { - return m_BidistringtypeStr; // @C9A @CAC - } - - // Get the offsetfrom= integer literal value, if any - final int getOffsetfrom() // @A1C - { - if ( isOffsetfromFixed() ) // @A1A - return m_Offsetfrom; // @A1C - else // @A1A - return -1; // @A1A - } - - // Get the offsetfrom= resolved element name, if any - final String getOffsetfromId() // @A1A - { // @A1A - return resolveRelativeName(m_OffsetfromId); // @A1A - } // @A1A - - // Get the offset= unresolved element name, if any - public final String getUnqualifiedOffsetfromId() // @C7A - { - return m_OffsetfromId; // @C7A - } - - // Returns an array of integers containing the array dimensions - // Notes: - // getDimensions().length == 0 for scalar data - PcmlDimensions getDimensions(PcmlDimensions indices) throws PcmlException - { - PcmlDimensions myDimensions = null; - PcmlNode node = getParent(); // @CCA - - // Retrieve array dimensions from all ancestors - if (node instanceof PcmlData) // @CCC - { - myDimensions = ((PcmlData) node).getDimensions(indices);// @CCC - } - else - if (node instanceof PcmlStruct) // @CCC - { - myDimensions = ((PcmlStruct) node).getDimensions(indices); // @CCC - } - else - { - myDimensions = new PcmlDimensions(getNbrOfDimensions()); - } - - // If this node is defined as an array, add its dimension - if (isArray()) - { - int myCount = getCount(indices); - myDimensions.add(myCount); - } - - return myDimensions; - } - - // Returns an array of integers containing the timestamps - // for each of the array dimensions for this node. - // Notes: - // getNbrOfDimensions() == 0 for scalar data - // getNbrOfDimensions() == getDimensions().length - long[] getDimensionTimestamps(PcmlDimensions indices) throws PcmlException - { - long[] myTimestamps; - Integer myIndex = null; - long[] previousTimestamps; - PcmlNode node = getParent(); // @CCA - - // If an array is defined at this node, - // remove its dimension from the array of indices - if (isArray()) - { - myIndex = indices.integerAt(indices.size()-1); - indices.remove(); - } - - // Retrieve array dimensions from all ancestors - if (node instanceof PcmlData) // @CCC - { - previousTimestamps = ((PcmlData) node).getDimensionTimestamps(indices); // @CCC - } - else - if (node instanceof PcmlStruct) // @CCC - { - previousTimestamps = ((PcmlStruct) node).getDimensionTimestamps(indices); // @CCC - } - else - { - previousTimestamps = new long[0]; - } - - // If this node is defined as an array, add its dimension - // back to the array of indices and get the time stamp for this dimension. - if (myIndex != null) - { - int i; - indices.add(myIndex); - myTimestamps = new long[previousTimestamps.length + 1]; - for (i = 0; i < previousTimestamps.length; i++) - { - myTimestamps[i] = previousTimestamps[i]; - } - myTimestamps[i] = resolveDimensionTimestamp(indices); - if (i > 0) - { - myTimestamps[i] = Math.max(myTimestamps[i], myTimestamps[i-1]); - } - } - else - { - myTimestamps = previousTimestamps; - } - - return myTimestamps; - } - - // Returns the number of dimensions for this data node - // Notes: - // getNbrOfDimensions() == 0 for scalar data - // getNbrOfDimensions() == getDimensions().length - int getNbrOfDimensions() - { - int total = 0; - PcmlNode node = getParent(); // @CCA - - if (isArray()) - total++; - - if (node instanceof PcmlData) // @CCC - total += ((PcmlData)node).getNbrOfDimensions(); // @CCC - else - if (node instanceof PcmlStruct) // @CCC - total += ((PcmlStruct)node).getNbrOfDimensions(); // @CCC - - return total; - } - - int getOutputsize(PcmlDimensions indices) throws PcmlException - { - int totalSize = 0; - int myCount; - boolean processArray; - - // If outputsize= was specified for this element use that - // as the output size for this and all descendents. - totalSize = resolveIntegerValue( getOutputsize(), - getOutputsizeId(), - indices ); - if (totalSize > 0) - return totalSize; - - if (isArray() && indices.size() < getNbrOfDimensions() ) - { - myCount = getCount(indices); - processArray = true; - } - else - { - myCount = 1; - processArray = false; - } - - for (int myIndex = 0; myIndex < myCount; myIndex++) - { - - if (processArray) - { - indices.add(myIndex); - } - - - switch (getDataType()) - { - - case PcmlData.STRUCT: - Enumeration children; - PcmlDocNode child; - - children = getChildren(); - while (children.hasMoreElements()) - { - child = (PcmlDocNode) children.nextElement(); - switch (child.getNodeType()) - { - case PcmlNodeType.STRUCT: - totalSize += ((PcmlStruct) child).getOutputsize(indices); - break; - case PcmlNodeType.DATA: - totalSize += ((PcmlData) child).getOutputsize(indices); - break; - default: - throw new PcmlException(DAMRI.BAD_NODE_TYPE, new Object[] {new Integer(child.getNodeType()) , getNameForException()} ); - } - } - break; - - // For all scalar types - default: - totalSize += getPcmlDataValues(indices).byteLength(); - if (totalSize == 0) - { - totalSize = 32; - } - - } - - if (processArray) - { - indices.remove(); - } - - } // END: for myIndex - - return totalSize; - } - - // Get the trim= resolved element name, if any - public final String getTrim() // @D1A - { // @D1A - return m_TrimStr; // @D1A - } // @D1A - - // Get the trim= resolved element name, if any - public final String getCharType() // @D2A - { // @D2A - return m_CharType; // @D2A - } // @D2A - - boolean isArray() - { - if ( getCount() > 0 ) - return true; - else - if ( getCountId() != null ) - return true; - - return false; - } - - // Returns true if this node is defined as an array or - // has an ancestor defined as an array. - boolean isInArray() - { - PcmlNode node = getParent(); // @CCA - - if (isArray()) - return true; - else - if (node instanceof PcmlData) // @CCC - return ((PcmlData)node).isInArray(); // @CCC - else - if (node instanceof PcmlStruct) // @CCC - return ((PcmlStruct)node).isInArray(); // @CCC - else - return false; - } - - // Returns true if the length attribute has been specified. @D0A - public final boolean isLengthSpecified() - { - return (m_LengthWasSpecified || m_Length != 0 || m_LengthId != null); - // Note: This conditional is beefed-up to handle the case where a PcmlData object from an older version (before m_LengthWasSpecified was added) was serialized and then deserialized into the current version. - } - - // Returns true if this document element is supported at the - // at the VRM of the current host. - // Returns false if not. - boolean isSupportedAtHostVRM() throws PcmlException // @A1A - { // @A1A - if (m_IsRfml) return true; // @D0A - int hostVrm = getAs400VRM(); // VRM of the IBM i system @A1A - - // If the minvrm= for this element is greater than the server VRM - // do not process this element. The item is not available at this release. - if (getMinvrm() > hostVrm) // @A1A - { // @A1A - return false; // @A1A - } // @A1A - - // If the maxvrm= for this element is less than the server VRM - // do not process this element. The item is not available at this release. - if (getMaxvrm() < hostVrm) // @A1A - { // @A1A - return false; // @A1A - } // @A1A - - return true; // @A1A - } // @A1A - - - // Convert Java object IBM i system bytes - // Returns the number of bytes converted - int toBytes(OutputStream bytes, int offset, PcmlDimensions indices) throws PcmlException - { - int totalBytes = 0; - int myCount; - boolean processArray; - - // Do not process if this element is not supported at the - // VRM of the current host. - if ( !isSupportedAtHostVRM() ) // @A1C - return 0; - - // If this is an array element, set up array processing information - if (isArray() && indices.size() < getNbrOfDimensions() ) - { - myCount = getCount(indices); - processArray = true; - } - else // Non-array element, only process once. - // Note: Although this element is not an array - // (i.e. does not have a count= attribute) - // It may be a child of an element that is an array. - { - myCount = 1; - processArray = false; - } - - // ----------------------------------------------------------- - // Now actually convert data to bytes - // ----------------------------------------------------------- - for (int myIndex = 0; myIndex < myCount; myIndex++) - { - - if (processArray) - { - indices.add(myIndex); - } - - switch (getDataType()) - { - - case PcmlData.STRUCT: - Enumeration children; - PcmlDocNode child; - - children = getChildren(); - while (children.hasMoreElements()) - { - child = (PcmlDocNode) children.nextElement(); - switch (child.getNodeType()) - { - case PcmlNodeType.STRUCT: - totalBytes += ((PcmlStruct) child).toBytes(bytes, offset + totalBytes, indices); - break; - case PcmlNodeType.DATA: - totalBytes += ((PcmlData) child).toBytes(bytes, offset + totalBytes, indices); - break; - default: - throw new PcmlException(DAMRI.BAD_NODE_TYPE, new Object[] {new Integer(child.getNodeType()) , getNameForException()} ); - } // END: switch (child.getNodeType()) - } // END: while (children.hasMoreElements()) - break; - - default: - // Convert scalar leaf node based on current dimensions - totalBytes += getPcmlDataValues(indices).toBytes(bytes, offset + totalBytes); - break; - - } // END: switch (getDataType()) - - if (processArray) - { - indices.remove(); - } - - } // END: for myIndex - - return totalBytes; - } // public void toBytes(OutputStream bytes, int offset, PcmlDimensions indices) - - - // Parses array of bytes and stores for later conversion - // to Java objects. This allows for lazy data translation - // for better performance. - // Returns the number of bytes consumed from the input byte array - // Note: This may be larger than the number of bytes saved for this element - // because of bytes skipped due to an offset value. - int parseBytes(byte[] bytes, int offset, Hashtable offsetStack, PcmlDimensions indices) throws PcmlException - { - PcmlData dataNode; // Child of this element that is a node - PcmlStruct structNode; // Child of this element that is a node - int nbrBytes = 0; - int myCount; - boolean processArray; - - // Do not process if this element is not supported at the - // VRM of the current host. - if ( !isSupportedAtHostVRM() ) // @A1C - return 0; - - // If this is an array element, set up array processing information - if (isArray() && indices.size() < getNbrOfDimensions() ) - { - myCount = getCount(indices); - processArray = true; - } - else // Non-array element, only process once. - // Note: Although this element is not an array - // (i.e. does not have a count= attribute) - // It may be a child of an element that is an array. - { - myCount = 1; - processArray = false; - } - - // ----------------------------------------------------------- - // Calculate bytes to skip based on the offset= - // and offsetfrom= attributes. - // ----------------------------------------------------------- - int skipBytes = 0; // Initially, no need to skip bytes @C8A - if (getDataType() == PcmlData.STRUCT) // @C8A - { - int myOffset = getOffset(indices); // Retrieve offset value for this element @C8A - if (myOffset > 0) // If this element has a non-zero offset @C8A - { - // Determine from where the offset is based - Integer myOffsetbase = null; // @C8A - String myOffsetfromId = getOffsetfromId(); // Get offsetfrom= element name, if any @C8A - - // If offsetfrom= was specified with the name of another element, - // get the base for the offset from the offset stack. - // The offset stack is a stack of beginning offsets for all - // ancestors of the current element. The offsetfrom= value must be one - // of these ancestors or an error will be reported. - if (myOffsetfromId != null) // @C8A - { - myOffsetbase = (Integer) offsetStack.get(myOffsetfromId); // @C8A - if (myOffsetbase == null) // @C8A - { - throw new PcmlException(DAMRI.OFFSETFROM_NOT_FOUND, new Object[] {myOffsetfromId, getNameForException()} ); // @C8A - } - } - else - { - // If offsetfrom= was specified with an integer literal, use it. - if (getOffsetfrom() >= 0) // @C8A - { - myOffsetbase = new Integer(getOffsetfrom()); // @C8A - } - // getOffsetfrom() returns -1 to indicate that offset from was not specified. - // No offsetfrom= was specified, the offset will be relative to the - // beginning offset of the parent of this elements parent. - // This is the first (most recent) entry in the offset stack. - else - { - myOffsetbase = (Integer) offsetStack.get( ((PcmlDocNode) getParent()).getQualifiedName()); //@C8A - } - } - - // Add the base value to the offset value - if (myOffsetbase != null) // @C8A - { - myOffset = myOffset + myOffsetbase.intValue(); // @C8A - } - - // If the total offset value is greater than the current - // offset into the input byte array, calculate the - // number of bytes to skip. - // (Bytes skipped over as a result ofthe offset=.) - if (myOffset > offset) // @C8A - { - skipBytes = myOffset - offset; // @C8A - } - } // End calculating bytes to skip because of offset= attribute - } - - // ----------------------------------------------------------- - // Now actually parse the bytes for this element - // ----------------------------------------------------------- - for (int myIndex = 0; myIndex < myCount; myIndex++) - { - - if (processArray) - { - indices.add(myIndex); - } - - // If this is not a structure, get the PcmlDataValues object and - // parse the bytes - if (getDataType() != PcmlData.STRUCT) - { - nbrBytes += getPcmlDataValues(indices).parseBytes(bytes, offset + skipBytes + nbrBytes, offsetStack); // @C8C - } - else - { - Enumeration children; - PcmlDocNode child; - - // Add this node to the offset stack - String qName = getQualifiedName(); - if (!qName.equals("")) - { - offsetStack.put(qName, new Integer(offset + skipBytes + nbrBytes)); // @C8C - } - - children = getChildren(); - while (children.hasMoreElements()) - { - child = (PcmlDocNode) children.nextElement(); - switch (child.getNodeType()) - { - case PcmlNodeType.STRUCT: - structNode = (PcmlStruct) child; - nbrBytes += structNode.parseBytes(bytes, offset + skipBytes + nbrBytes, offsetStack, indices); // @C8C - break; - case PcmlNodeType.DATA: - dataNode = (PcmlData) child; - nbrBytes += dataNode.parseBytes(bytes, offset + skipBytes + nbrBytes, offsetStack, indices); // @C8C - break; - default: - throw new PcmlException(DAMRI.BAD_NODE_TYPE, new Object[] {new Integer(child.getNodeType()) , getNameForException()} ); - } // END: switch (child.getNodeType()) - } // END: while (children.hasMoreElements()) - - // Remove this node from the offset stack - if (!qName.equals("")) - { - offsetStack.remove(qName); - } - - } - - if (processArray) - { - indices.remove(); - } - - } // END: for myIndex - - return nbrBytes + skipBytes; // @C8C - } // public int parseBytes(byte[] bytes, int offset) - - - // Resolve an integer value from either a named element or a literal - private int resolveIntegerValue(int intLiteral, String name, PcmlDimensions indices) throws PcmlException - { - PcmlNode node; - PcmlData dataNode; - Object nodeValue; - - if (name != null) - { - node = getDoc().getElement(name); - if (node instanceof PcmlData) - { - dataNode = (PcmlData) node; - nodeValue = dataNode.getValue(indices); - if (nodeValue instanceof String) - { - return Integer.parseInt((String) nodeValue); - } - else if (nodeValue instanceof Number) - { - return ((Number) nodeValue).intValue(); - } - else - { - if (nodeValue == null) - throw new PcmlException(DAMRI.INPUT_VALUE_NOT_SET, new Object[] {dataNode.getNameForException()} ); - else - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {nodeValue.getClass().getName(), dataNode.getNameForException()} ); - } - } - else - { - if (node == null) - throw new PcmlException(DAMRI.ELEMENT_NOT_FOUND, new Object[] {name, ""} ); - else - throw new PcmlException(DAMRI.WRONG_ELEMENT_TYPE, new Object[] {name, ""} ); - } - } - return intLiteral; - } - - // Resolve a timestamp for the given indices - private long resolveDimensionTimestamp(PcmlDimensions indices) throws PcmlException - { - PcmlNode node; - String name = getCountId(); - - if (name != null) - { - node = getDoc().getElement(name); - if (node instanceof PcmlData) - { - return ((PcmlData)node).getTimestamp(indices); - } - else - { - if (node == null) - throw new PcmlException(DAMRI.ELEMENT_NOT_FOUND, new Object[] {name, ""} ); - else - throw new PcmlException(DAMRI.WRONG_ELEMENT_TYPE, new Object[] {name, ""} ); - } - } - return Long.MIN_VALUE; - } - - // Get the ccsid= integer literal value, if any - public final int getCcsid() - { - return m_Ccsid; - } - - // Get the ccsid= resolved element name, if any - public final String getCcsidId() - { - return resolveRelativeName(m_CcsidId); - } - - // Get the offset= unresolved element name, if any - public final String getUnqualifiedCcsidId() // @C7A - { - return m_CcsidId; // @C7A - } - - // Get the type= value as an Integer - public final int getDataType() - { - return m_Type; - } - - // Get the type= value as a String - public final String getDataTypeString() - { - return m_TypeStr; - } - - // Get the init= string value, if any - public final String getInit() - { - return m_Init; - } - - // Get the length= integer literal value, if any - public final int getLength() - { - return m_Length; - } - - // Get the length= resolved element name, if any - public final String getLengthId() - { - return resolveRelativeName(m_LengthId); - } - - // Get the offset= unresolved element name, if any - public final String getUnqualifiedLengthId() // @C7A - { - return m_LengthId; // @C7A - } - - // Get the maxvrm= integer value -- compatible w/ AS400.generateVRM() - // Returns Integer.MAX_VALUE is maxvrm= was not specified - public final int getMaxvrm() - { - return m_MaxvrmInt; - } - - // Get the maxvrm= String value - public final String getMaxvrmString() // @C7A - { - return m_Maxvrm; - } - - // Get the minvrm= integer value -- compatible w/ AS400.generateVRM() - // Returns Integer.MIN_VALUE minvrm= was not specified - public final int getMinvrm() - { - return m_MinvrmInt; - } - - // Get the minvrm= String value - public final String getMinvrmString() // @C7A - { - return m_Minvrm; - } - - // Get the outputsize= integer literal value, if any - public final int getOutputsize() - { - return m_Outputsize; - } - - // Get the outputsize= resolved element name, if any - public final String getOutputsizeId() - { - return resolveRelativeName(m_OutputsizeId); - } - - // Get the offset= unresolved element name, if any - public final String getUnqualifiedOutputsizeId() // @C7A - { - return m_OutputsizeId; // @C7A - } - - // Get the precision= integer literal value, if any - public final int getPrecision() - { - return m_Precision; - } - - // Get the struct= element name, if any - public final String getStruct() - { - return m_StructId; - } - - // Get the dateformat= value, if any - public final String getDateFormat() - { - return m_DateFormat; - } - - // Get the dateseparator= value, if any - public final String getDateSeparator() - { - return m_DateSeparator; - } - - // Get the timeformat= value, if any - public final String getTimeFormat() - { - return m_TimeFormat; - } - - // Get the timeseparator= value, if any - public final String getTimeSeparator() - { - return m_TimeSeparator; - } - - // Get the keyfield= value, if any - public boolean isKeyField() - { - return m_KeyField; - } - - // Set the count= attribute - private void setCount(String count) - { - // Handle null or empty string - if (count == null || count.equals("")) - { - m_Count = 0; - m_CountId = null; - return; - } - - // Try to parse an integer from the attribute value - try - { - m_Count = Integer.parseInt(count); - m_CountId = null; - } - // If value is not an integer, it must be an element name - // checkAttributes() will be called later to verify the element name - catch (NumberFormatException e) - { - m_Count = 0; - m_CountId = count; - } - } - - private void setCcsid(String ccsid) - { - // Handle null or empty string - if (ccsid == null || ccsid.equals("")) - { - m_Ccsid = 0; - m_CcsidId = null; - return; - } - - m_CcsidWasSpecified = true; // @D0A - - // Try to parse an integer from the attribute value - try - { - m_Ccsid = Integer.parseInt(ccsid); - m_CcsidId = null; - } - // If value is not an integer, it must be an element name - // checkAttributes() will be called later to verify the element name - catch (NumberFormatException e) - { - m_Ccsid = 0; - m_CcsidId = ccsid; - } - } - - void setInit(String init) // E0C - { -// @D0D -// // Handle null or empty string -// if (init == null || init.equals("")) -// { -// m_Init = null; -// return; -// } - - // Save the attribute value - m_Init = init; - // checkAttributes() will verify the value against the data type - } - - protected void setLength(String length) // @D0C - { - // Handle null or empty string - if (length == null || length.equals("")) - { - m_Length = 0; - m_LengthId = null; - return; - } - - m_LengthWasSpecified = true; // @D0A - - // Try to parse an integer from the attribute value - try - { - m_Length = Integer.parseInt(length); - m_LengthId = null; - } - // If value is not an integer, it must be an element name - // checkAttributes() will be called later to verify the element name - catch (NumberFormatException e) - { - m_Length = 0; - m_LengthId = length; - // checkAttributes() will make sure m_LengthId resolves to a element with type="int" - } - } - - private void setMaxvrm(String maxvrm) - { - m_MaxvrmInt = Integer.MAX_VALUE; - // Handle null or empty string - if (maxvrm == null || maxvrm.equals("")) - { - m_Maxvrm = null; - return; - } - - // Save the attribute value - m_Maxvrm = maxvrm; - } - - private void setMinvrm(String minvrm) - { - m_MinvrmInt = Integer.MIN_VALUE; - // Handle null or empty string - if (minvrm == null || minvrm.equals("")) - { - m_Minvrm = null; - return; - } - - m_Minvrm = minvrm; - } - - private void setOffset(String offset) - { - // Handle null or empty string - if (offset == null || offset.equals("")) - { - m_Offset = 0; - m_OffsetId = null; - return; - } - - // Try to parse an integer from the attribute value - try - { - m_Offset = Integer.parseInt(offset); - m_OffsetId = null; - } - // If value is not an integer, it must be an element name - // checkAttributes() will be called later to verify the element name - catch (NumberFormatException e) - { - m_Offset = 0; - m_OffsetId = offset; - // checkAttributes() will make sure m_OffsetId resolves to a element with type="int" - } - } - - private void setOffsetfrom(String offsetfrom) - { - m_OffsetfromFixed = true; // @A1A - // Handle null or empty string - if (offsetfrom == null || offsetfrom.equals("")) - { - m_Offsetfrom = -1; // @A1A - m_OffsetfromId = null; - return; - } - - try // @A1A - { // @A1A - m_Offsetfrom = Integer.parseInt(offsetfrom); // @A1A - m_OffsetfromId = null; // @A1A - } // @A1A - catch (NumberFormatException e) // @A1A - { // @A1A - m_Offsetfrom = 0; // @A1A - m_OffsetfromId = offsetfrom; - // checkAttributes() will make sure m_OffsetfromId resolves to a document element that - // an ancestor of this node. - } // @A1A - } - - private void setOutputsize(String outputsize) - { - // Handle null or empty string - if (outputsize == null || outputsize.equals("")) - { - m_Outputsize = 0; - return; - } - - // Try to parse an integer from the attribute value - try - { - m_Outputsize = Integer.parseInt(outputsize); - m_OutputsizeId = null; - } - // If value is not an integer, it must be an element name - // checkAttributes() will be called later to verify the element name - catch (NumberFormatException e) - { - m_Outputsize = 0; - m_OutputsizeId = outputsize; - // checkAttributes() will make sure m_OutputsizeId resolves to a element with type="int" - } - } - - private void setPassby(String passby) // @B1A - { // @B1A - // Handle null or empty string - if (passby == null || passby.equals("")) // @B1A - { // @B1A - m_PassbyStr = null; // @B1A - m_Passby = ProgramParameter.PASS_BY_REFERENCE; // @B1A - return; // @B1A - } // @B1A - - // Save the attribute value - m_PassbyStr = passby; // @B1A - if ( m_PassbyStr.equals("value") ) // @B1A - { // @B1A - m_Passby = ProgramParameter.PASS_BY_VALUE; // @B1A - } // @B1A - else // Either passby="reference" was specified or defaulted @B1A - { // @B1A - m_Passby = ProgramParameter.PASS_BY_REFERENCE; // @B1A - } // @B1A - } // @B1A - - - private void setBidiStringType(String type) // @C9A - { - // Handle null, empty string, or DEFAULT. - if (type == null || type.equals("") || type.equals("DEFAULT")) - { - m_BidistringtypeStr = null; // @C9A - m_Bidistringtype = BidiStringType.DEFAULT; // @C9A - return; // @C9A - } // @C9A - - // Save the attribute value - m_BidistringtypeStr = type; // @C9A - Integer bidistringtypeInt = (Integer)getBidiTypeMap().get(m_BidistringtypeStr); - - if (bidistringtypeInt == null) { - m_Bidistringtype = BidiStringType.DEFAULT; - if (Trace.isTraceOn()) { - Trace.log(Trace.PCML, "[Warning]: Value of 'bidistringtype' attribute is not recognized: "+ m_BidistringtypeStr); - } - } - else m_Bidistringtype = bidistringtypeInt.intValue(); - } - - private static Hashtable getBidiTypeMap() - { - if (bidiTypeMap_ == null) - { - synchronized (PcmlData.class) - { - if (bidiTypeMap_ == null) - { - bidiTypeMap_ = new Hashtable(10); - - bidiTypeMap_.put("DEFAULT", new Integer(BidiStringType.DEFAULT)); - bidiTypeMap_.put("NONE", new Integer(BidiStringType.NONE)); - bidiTypeMap_.put("ST4", new Integer(BidiStringType.ST4)); - bidiTypeMap_.put("ST5", new Integer(BidiStringType.ST5)); - bidiTypeMap_.put("ST6", new Integer(BidiStringType.ST6)); - bidiTypeMap_.put("ST7", new Integer(BidiStringType.ST7)); - bidiTypeMap_.put("ST8", new Integer(BidiStringType.ST8)); - bidiTypeMap_.put("ST9", new Integer(BidiStringType.ST9)); - bidiTypeMap_.put("ST10", new Integer(BidiStringType.ST10)); - bidiTypeMap_.put("ST11", new Integer(BidiStringType.ST11)); - } - } - } - return bidiTypeMap_; - } - - private void setPrecision(String precision) - { - // Handle null or empty string - if (precision == null || precision.equals("")) - { - m_Precision = 0; - return; - } - - // Try to parse an integer from the attribute value - try - { - m_Precision = Integer.parseInt(precision); - } - // If value is not an integer, set the precision to -1 - // checkAttributes() log an error that the precision is invalid. - catch (NumberFormatException e) - { - // checkAttributes() will add a PcmlSpecificationException - m_Precision = -1; - } - } - - private void setStruct(String struct) - { - // Handle null or empty string - if (struct == null || struct.equals("")) - { - m_StructId = null; - return; - } - - // Save the attribute value - m_StructId = struct; - // checkAttributes() will make sure m_StructId resolves to a document element - } - - private void setType(String type) - { - m_TypeStr = type; - - // char | int | packed | zoned | float | byte | struct - // | date | time | timestamp - if (type.equals("char")) - m_Type = CHAR; - else if (type.equals("int")) - m_Type = INT; - else if (type.equals("packed")) - m_Type = PACKED; - else if (type.equals("zoned")) - m_Type = ZONED; - else if (type.equals("float")) - m_Type = FLOAT; - else if (type.equals("byte")) - m_Type = BYTE; - else if (type.equals("struct")) - m_Type = STRUCT; - else if (type.equals("date")) - m_Type = DATE; - else if (type.equals("time")) - m_Type = TIME; - else if (type.equals("timestamp")) - m_Type = TIMESTAMP; - - - else // none of the above - // checkattributes() will add a pcml specification error. - m_Type = UNSUPPORTED; - } - - private void setTrim(String trimEnd) // @D1A - { // @D1A - // Handle null or empty string // @D1A - if (trimEnd == null || trimEnd.equals("")) // @D1A - { // @D1A - m_TrimStr = null; // @D1A - return; // @D1A - } // @D1A - - // Save the attribute value - m_TrimStr = trimEnd; // @D1A - } - - private void setCharType(String charType) // @D2A - { // @D2A - // Handle null or empty string // @D2A - if (charType == null || charType.equals("")) // @D2A - { // @D2A - m_CharType = null; // @D2A - return; // @D2A - } // @D2A - - // Save the attribute value - m_CharType = charType; // @D2A - } - - private void setKeyField(String keyField) - { - // Handle null or empty string - if (keyField == null || keyField.equals("")) - { - m_KeyField = false; - return; - } - - // Save the attribute value - m_KeyFieldStr = keyField; - if (keyField.equalsIgnoreCase("true")) m_KeyField = true; - else m_KeyField = false; - } - - private void setDateFormat(String format) - { - // Handle null or empty string - if (format == null || format.equals("")) - { - m_DateFormat = null; - return; - } - - // Save the attribute value - m_DateFormat = format; - } - - private void setDateSeparator(String separator) - { - // Handle null or empty string - if (separator == null || separator.equals("")) - { - m_DateSeparator = null; - return; - } - - // Save the attribute value - m_DateSeparator = separator; - } - - private void setTimeFormat(String format) - { - // Handle null or empty string - if (format == null || format.equals("")) - { - m_TimeFormat = null; - return; - } - - // Save the attribute value - m_TimeFormat = format; - } - - private void setTimeSeparator(String separator) - { - // Handle null or empty string - if (separator == null || separator.equals("")) - { - m_TimeSeparator = null; - return; - } - - // Save the attribute value - m_TimeSeparator = separator; - } - - protected void checkAttributes() - { - //String resolvedName = null; - PcmlDocNode resolvedNode = null; - - super.checkAttributes(); - - // Verify the count= attribute - // If an integer was specified for the count, no checking is needed. - // If a document element ID was was specified, make sure - // it resolves to a element with type="int". - if (m_CountId != null) - { - resolvedNode = resolveRelativeNode(m_CountId); - if (resolvedNode == null) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_NOT_FOUND, new Object[] {makeQuotedAttr("count", m_CountId), getNameForException()} ); - } - else - { - if (resolvedNode instanceof PcmlData) - { - if ( ((PcmlData)resolvedNode).getDataType() != PcmlData.INT ) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_WRONG_NODETYPE, new Object[] {makeQuotedAttr("count", m_CountId), resolvedNode.getQualifiedName(), "", getNameForException()} ); - } - } - else - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_WRONG_DATATYPE, new Object[] {makeQuotedAttr("count", m_CountId), resolvedNode.getQualifiedName(), "type=\"int\"", getNameForException()} ); - } - } - } - else - // Do not allow count= to be a literal value that is negative - if (m_Count < 0) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("count", m_Count), getBracketedTagName(), getNameForException()} ); // @A1C - } - - - // Verify the ccsid= attribute - // If an integer was specified for the ccsid, no checking is needed. - // If a document element ID was was specified, make sure - // it resolves to a element with type="int". - if (m_IsRfml && m_CcsidWasSpecified && (getDataType() != CHAR)) // @D0A - { - getDoc().addPcmlSpecificationError(DAMRI.ATTRIBUTE_NOT_ALLOWED, new Object[] {makeQuotedAttr("ccsid", getAttributeValue("ccsid")), makeQuotedAttr("type", getDataTypeString()), getBracketedTagName(), getNameForException()} ); - } - if (m_CcsidId != null) - { - resolvedNode = resolveRelativeNode(m_CcsidId); - if (resolvedNode == null) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_NOT_FOUND, new Object[] {makeQuotedAttr("ccsid", m_CcsidId), getNameForException()} ); - } - else - { - if (resolvedNode instanceof PcmlData) - { - if ( ((PcmlData)resolvedNode).getDataType() != PcmlData.INT ) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_WRONG_NODETYPE, new Object[] {makeQuotedAttr("ccsid", m_CcsidId), resolvedNode.getQualifiedName(), "", getNameForException()} ); - } - } - else - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_WRONG_DATATYPE, new Object[] {makeQuotedAttr("ccsid", m_CcsidId), resolvedNode.getQualifiedName(), "type=\"int\"", getNameForException()} ); - } - } - } - else - // Do not allow ccsid= to be a literal value that is negative or greater than 65535. @D0C - if (m_Ccsid < 0 || m_Ccsid > 65535) // @D0C - added check for >65535. - { - getDoc().addPcmlSpecificationError(DAMRI.DATA_LENGTH_OUT_OF_RANGE, new Object[] {new Integer(m_Ccsid), new Integer(0), new Integer(65535), getBracketedTagName(), getNameForException()} ); - } - - - // Verify the init= attribute - if (getInit() != null) - { - switch (getDataType()) - { - default: - try - { - PcmlDataValues.convertValue((Object) getInit(), getDataType(), getLength(), getPrecision(), getNameForException()); - } - catch (Exception e) - { - getDoc().addPcmlSpecificationError(DAMRI.INITIAL_VALUE_ERROR, new Object[] {getInit(), getBracketedTagName(), getNameForException()} ); - } - break; - } - - } - - - - // Verify the length= attribute - // If an integer was specified for the length, no checking is needed. - // If a document element ID was was specified, make sure - // it resolves to a element with type="int". - if (m_LengthId != null) - { - switch (getDataType()) - { - case CHAR: - case BYTE: - break; - default: - getDoc().addPcmlSpecificationError(DAMRI.ATTRIBUTE_NOT_ALLOWED, new Object[] {makeQuotedAttr("length", getAttributeValue("length")), getDataTypeString(), getBracketedTagName(), getNameForException()} ); - } - - - resolvedNode = resolveRelativeNode(m_LengthId); - if (resolvedNode == null) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_NOT_FOUND, new Object[] {makeQuotedAttr("length", m_LengthId), getNameForException()} ); - } - else - { - if (resolvedNode instanceof PcmlData) - { - if ( ((PcmlData)resolvedNode).getDataType() != PcmlData.INT ) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_WRONG_NODETYPE, new Object[] {makeQuotedAttr("length", m_LengthId), resolvedNode.getQualifiedName(), "", getNameForException()} ); - } - } - else - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_WRONG_DATATYPE, new Object[] {makeQuotedAttr("length", m_LengthId), resolvedNode.getQualifiedName(), "type=\"int\"", getNameForException()} ); - } - } - } - else // an integer literal was specified for the 'length' attribute - { - // Verify the integer literal specified for length. - if (m_Length < 0) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_SYNTAX, new Object[] {makeQuotedAttr("length", getAttributeValue("length")), "type=\"int\"", getBracketedTagName(), getNameForException()} ); - } - else - { - switch (getDataType()) - { - case CHAR: - case BYTE: - if ( m_Length < 0 || m_Length > (MAX_STRING_LENGTH) ) - { - getDoc().addPcmlSpecificationError(DAMRI.DATA_LENGTH_OUT_OF_RANGE, new Object[] {new Integer(m_Length), new Integer(0), new Integer(PcmlData.MAX_STRING_LENGTH), getBracketedTagName(), getNameForException()} ); - - } - break; - - case INT: - if (m_Length != 2 && m_Length != 4 && m_Length != 8) // @C4C - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("length", m_Length), getBracketedTagName(), getNameForException()} ); - } - break; - - case PACKED: - case ZONED: - if (m_Length < 1 || m_Length > 31) - { - getDoc().addPcmlSpecificationError(DAMRI.DATA_LENGTH_OUT_OF_RANGE, new Object[] {new Integer(m_Length), new Integer(1), new Integer(31), getBracketedTagName(), getNameForException()} ); - } - break; - - case FLOAT: - if (m_Length != 4 && m_Length != 8) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("length", m_Length), getBracketedTagName(), getNameForException()} ); - } - break; - - case STRUCT: - case DATE: - case TIME: - case TIMESTAMP: - if ( getAttributeValue("length") != null - && !getAttributeValue("length").equals("") ) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTRIBUTE_NOT_ALLOWED, new Object[] {makeQuotedAttr("length", getAttributeValue("length")), makeQuotedAttr("type", getAttributeValue("type")), getBracketedTagName(), getNameForException()} ); - } - break; - - default: // none of the above - getDoc().addPcmlSpecificationError(DAMRI.BAD_DATA_TYPE, new Object[] {makeQuotedAttr("type", getAttributeValue("type")), getBracketedTagName(), getNameForException()} ); - - } - - // Check for presence of 'length' attribute. - if (!m_LengthWasSpecified && - getDataType() != STRUCT && - getDataType() != DATE && - getDataType() != TIME && - getDataType() != TIMESTAMP ) - { - if (m_IsRfml || ProgramCallDocument.exceptionIfParseError_) { - getDoc().addPcmlSpecificationError(DAMRI.NO_LENGTH, new Object[] {makeQuotedAttr("length", null), getBracketedTagName(), getNameForException()} ); - } - else - { - if (Trace.isTraceOn()) { - Trace.log(Trace.PCML, "[Warning]: 'length' attribute was not specified in "+ getBracketedTagName() +" element: "+ getNameForException()); - } - } - } - - // Extra logic for RFML. @D0A - if (m_IsRfml) - { - // If type="struct", the 'struct' attribute is required. - if (getDataType() == STRUCT) - { - if (getAttributeValue("struct") == null || - getAttributeValue("struct").equals("")) - { - getDoc().addPcmlSpecificationError(DAMRI.NO_STRUCT, new Object[] {makeQuotedAttr("struct", null), getBracketedTagName(), getNameForException()} ); - } - } - - // If type="struct", the 'struct' attribute is required. - else if (getDataType() == DATE || getDataType() == TIME || - getDataType() == TIMESTAMP) - {} // 'length' is not required - - // Otherwise, the 'length' attribute is required. - else if (!m_LengthWasSpecified) - { - getDoc().addPcmlSpecificationError(DAMRI.NO_LENGTH, new Object[] {makeQuotedAttr("length", null), getBracketedTagName(), getNameForException()} ); - } - } - } - } - - // Verify the offset= attribute - // If an integer was specified for the offset, no checking is needed. - // If a document element ID was was specified, make sure - // it resolves to a element with type="int". - if (m_OffsetId != null) - { - resolvedNode = resolveRelativeNode(m_OffsetId); - if (resolvedNode == null) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_NOT_FOUND, new Object[] {makeQuotedAttr("offset", m_OffsetId), getNameForException()} ); - } - else - { - if (resolvedNode instanceof PcmlData) - { - if ( ((PcmlData)resolvedNode).getDataType() != PcmlData.INT ) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_WRONG_NODETYPE, new Object[] {makeQuotedAttr("offset", m_OffsetId), resolvedNode.getQualifiedName(), "", getNameForException()} ); - } - } - else - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_WRONG_DATATYPE, new Object[] {makeQuotedAttr("offset", m_OffsetId), resolvedNode.getQualifiedName(), "type=\"int\"", getNameForException()} ); - } - } - } - else - // Do not allow offset= to be a literal value that is negative - if (m_Offset < 0) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("offset", m_Offset), getBracketedTagName(), getNameForException()} ); // @A1C - } - - // Verify the offsetfrom= attribute - // If a document element ID was was specified, make sure - // it resolves to a document element that is an ancestor of this element. - if (m_OffsetfromId != null) - { - resolvedNode = resolveRelativeNode(m_OffsetfromId); - if (resolvedNode == null) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_NOT_FOUND, new Object[] {makeQuotedAttr("offsetfrom", m_OffsetfromId), getNameForException()} ); - } - else - { - String qName = getQualifiedName(); - if (qName.equals("")) - { - qName = getNameForException(); - } - String qNameResolved = resolvedNode.getQualifiedName(); - if (!qName.startsWith(qNameResolved + ".")) - { - getDoc().addPcmlSpecificationError(DAMRI.OFFSETFROM_NOT_FOUND, new Object[] {m_OffsetfromId, getNameForException()} ); - } - } - } - else - // Do not allow offsetfrom= to be a literal value that is negative - if (m_Offsetfrom < -1) // @A1A - { // @A1A - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("offsetfrom", m_Offsetfrom), getBracketedTagName(), getNameForException()} ); // @A1A - } // @A1A - - // Verify the outputsize= attribute - // If an integer was specified for the offset, make sure it is in valid range. - // If a document element ID was was specified, make sure - // it resolves to a element with type="int". - if (m_OutputsizeId != null) - { - resolvedNode = resolveRelativeNode(m_OutputsizeId); - if (resolvedNode == null) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_NOT_FOUND, new Object[] {makeQuotedAttr("outputsize", m_OutputsizeId), getNameForException()} ); - } - else - { - if (resolvedNode instanceof PcmlData) - { - if ( ((PcmlData)resolvedNode).getDataType() != PcmlData.INT ) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_WRONG_NODETYPE, new Object[] {makeQuotedAttr("outputsize", m_OutputsizeId), resolvedNode.getQualifiedName(), "", getNameForException()} ); - } - } - else - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_WRONG_DATATYPE, new Object[] {makeQuotedAttr("outputsize", m_OutputsizeId), resolvedNode.getQualifiedName(), "type=\"int\"", getNameForException()} ); - } - } - } - else - // Do not allow offset= to be a literal value that is negative - if (m_Outputsize < 0) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("outputsize", m_Outputsize), getBracketedTagName(), getNameForException()} ); // @A1C - } - - - // Verify the precision= attribute - if (getAttributeValue("precision") != null - && !getAttributeValue("precision").equals("") ) // @++C - { - switch (getDataType()) - { - // precision= is not allowed for these data types - case CHAR: - case BYTE: - case FLOAT: - case STRUCT: - case DATE: - case TIME: - case TIMESTAMP: - getDoc().addPcmlSpecificationError(DAMRI.ATTRIBUTE_NOT_ALLOWED, new Object[] {makeQuotedAttr("precision", getAttributeValue("precision")), makeQuotedAttr("type", getDataTypeString()), getBracketedTagName(), getNameForException()} ); - break; - - // For type=int, precision= must be 15 or 16, or 31 or 32, or 63 or 64, depending on length= - case INT: - if (m_Length == 2) - { - if (m_Precision != 15 && m_Precision != 16) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("precision", getAttributeValue("precision")), getBracketedTagName(), getNameForException()} ); - } - } - if (m_Length == 4) - { - if (m_Precision != 31 && m_Precision != 32) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("precision", getAttributeValue("precision")), getBracketedTagName(), getNameForException()} ); - } - } - if (m_Length == 8) // @C4A - { // @C4A - if (m_Precision != 63 && m_Precision != 64) // @C4A - { // @C4A - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("precision", getAttributeValue("precision")), getBracketedTagName(), getNameForException()} ); // @C4A - } // @C4A - } // @C4A - break; - - // For type=packed and type=zoned, - // precision= must be >= 0 and <= the data length (length=) - case PACKED: - case ZONED: - if (m_Precision < 0 || m_Precision > m_Length) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("precision", getAttributeValue("precision")), getBracketedTagName(), getNameForException()} ); - } - break; - - } - - } - - - // Verify the struct= attribute - if (m_StructId != null) - { - if (getDataType() != STRUCT) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTRIBUTE_NOT_ALLOWED, new Object[] {makeQuotedAttr("struct", getAttributeValue("struct")), makeQuotedAttr("type", getDataTypeString()), getBracketedTagName(), getNameForException()} ); - } - } - - - - // Verify the minvrm= attribute - if (m_Minvrm != null) - { - m_MinvrmInt = validateVRM(m_Minvrm); - if (m_MinvrmInt <= 0) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("minvrm", m_Minvrm), getBracketedTagName(), getNameForException()} ); // @A1C - } - } - - - // Verify the maxvrm= attribute - if (m_Maxvrm != null) - { - m_MaxvrmInt = validateVRM(m_Maxvrm); - if (m_MaxvrmInt <= 0) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("maxvrm", m_Maxvrm), getBracketedTagName(), getNameForException()} ); // @A1C - } - } - - // Verify the passby= attribute - if (m_PassbyStr != null) // @B1A - { // @B1A - // Only allow this attribute when the pcml version is 2.0 or higher (e.g. ) - if ( getDoc().getVersion().compareTo("2.0") < 0 ) // @B1A - { // @B1A - getDoc().addPcmlSpecificationError(DAMRI.BAD_PCML_VERSION, new Object[] {makeQuotedAttr("passby", m_PassbyStr), "2.0", getBracketedTagName(), getNameForException()} ); // @B1A @C9C - } // @B1A - - // Only allow this attribute when it is a child of - if ( !(getParent() instanceof PcmlProgram) ) // @B1A - { // @B1A - getDoc().addPcmlSpecificationError(DAMRI.NOT_CHILD_OF_PGM, new Object[] {makeQuotedAttr("passby", m_PassbyStr), getBracketedTagName(), getNameForException()} ); // @B1A - } // @B1A - } // @B1A - - // Verify the bidistringtype= attribute - if (m_BidistringtypeStr != null) // @C9A - { // @C9A - // Only allow this attribute when the pcml version is 3.0 or higher (e.g. ) - if ( getDoc().getVersion().compareTo("3.0") < 0 ) // @C9A - { // @C9A - getDoc().addPcmlSpecificationError(DAMRI.BAD_PCML_VERSION, new Object[] {makeQuotedAttr("bidistringtype", m_BidistringtypeStr), "3.0", getBracketedTagName(), getNameForException()} ); // @C9A - } // @C9A - } - - // Verify the trim= attribute - if (m_TrimStr != null) // @D1A - { // @D1A - // Only allow this attribute when the pcml version is 4.0 or higher (e.g. ) - if ( getDoc().getVersion().compareTo("4.0") < 0 ) // @D1A - { // @D1A - getDoc().addPcmlSpecificationError(DAMRI.BAD_PCML_VERSION, new Object[] {makeQuotedAttr("trim", m_TrimStr), "4.0", getBracketedTagName(), getNameForException()} ); // @D1A - } // @D1A - } - - // Verify the chartype= attribute - if (m_CharType != null) // @D2A - { // @D2A - // Only allow this attribute when the pcml version is 4.0 or higher (e.g. ) - if ( getDoc().getVersion().compareTo("4.0") < 0 ) // @D2A - { // @D2A - getDoc().addPcmlSpecificationError(DAMRI.BAD_PCML_VERSION, new Object[] {makeQuotedAttr("chartype", m_CharType), "4.0", getBracketedTagName(), getNameForException()} ); // @D2A - } // @D2A - else - { - if (getDataType() != CHAR) // @D2A - { - getDoc().addPcmlSpecificationError(DAMRI.ATTRIBUTE_NOT_ALLOWED, new Object[] {makeQuotedAttr("chartype", getAttributeValue("chartype")), makeQuotedAttr("type", getDataTypeString()), getBracketedTagName(), getNameForException()} ); - } - } - } - - // Verify the keyfield= attribute (applies only to RFML) - if (m_KeyFieldStr != null) - { - // Only allow this attribute when the rfml version is 5.0 or higher (e.g. ) - if (!m_IsRfml) // if not rfml, then assume it's pcml - { - getDoc().addPcmlSpecificationError(DAMRI.ATTRIBUTE_NOT_ALLOWED, new Object[] {makeQuotedAttr("keyfield", getAttributeValue("keyfield")), makeQuotedAttr("pcml", getDataTypeString()), getBracketedTagName(), getNameForException()} ); - } - if ( getDoc().getVersion().compareTo("5.0") < 0 ) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_PCML_VERSION, new Object[] {makeQuotedAttr("keyfield", m_KeyFieldStr), "5.0", getBracketedTagName(), getNameForException()} ); - } - } - - // Verify the dateformat= attribute - if (m_DateFormat != null) - { - // Only allow this attribute when the pcml version is 6.0 or higher (e.g. ), and only for type "date". - if ( getDoc().getVersion().compareTo("6.0") < 0 ) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_PCML_VERSION, new Object[] {makeQuotedAttr("dateformat", m_DateFormat), "6.0", getBracketedTagName(), getNameForException()} ); - } - - switch (getDataType()) - { - case DATE: - // Check that it's a recognized format. Note: This is NOT already checked by the parser. - if (!AS400Date.validateFormat(AS400Date.toFormat(m_DateFormat))) { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("dateformat", getAttributeValue("dateformat")), getBracketedTagName(), getNameForException()} ); - } - break; - - default: // type is not DATE - // dateformat= is not allowed for any other data type - getDoc().addPcmlSpecificationError(DAMRI.ATTRIBUTE_NOT_ALLOWED, new Object[] {makeQuotedAttr("dateformat", getAttributeValue("dateformat")), makeQuotedAttr("type", getDataTypeString()), getBracketedTagName(), getNameForException()} ); - break; - } - } - - // Verify the dateseparator= attribute - if (m_DateSeparator != null) - { - // Only allow this attribute when the pcml version is 6.0 or higher (e.g. ), and only for type "date". - if ( getDoc().getVersion().compareTo("6.0") < 0 ) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_PCML_VERSION, new Object[] {makeQuotedAttr("dateseparator", m_DateSeparator), "6.0", getBracketedTagName(), getNameForException()} ); - } - - switch (getDataType()) - { - case DATE: - // Check that it's a recognized separator name. - if (!isValidSeparatorName(m_DateSeparator)) { - Trace.log(Trace.PCML, "Separator name '" + m_DateSeparator + "' is not recognized."); - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("dateseparator", getAttributeValue("dateseparator")), getBracketedTagName(), getNameForException()} ); - } - break; - - default: // type is not DATE - // dateseparator= is not allowed for any other data type - getDoc().addPcmlSpecificationError(DAMRI.ATTRIBUTE_NOT_ALLOWED, new Object[] {makeQuotedAttr("dateseparator", getAttributeValue("dateseparator")), makeQuotedAttr("type", getDataTypeString()), getBracketedTagName(), getNameForException()} ); - break; - } - } - - // Verify the timeformat= attribute - if (m_TimeFormat != null) - { - // Only allow this attribute when the pcml version is 6.0 or higher (e.g. ), and only for type "time". - if ( getDoc().getVersion().compareTo("6.0") < 0 ) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_PCML_VERSION, new Object[] {makeQuotedAttr("timeformat", m_TimeFormat), "6.0", getBracketedTagName(), getNameForException()} ); - } - - switch (getDataType()) - { - case TIME: - // Check that it's a recognized format. Note: This is NOT already checked by the parser. - if (!AS400Time.validateFormat(AS400Time.toFormat(m_TimeFormat))) { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("timeformat", getAttributeValue("timeformat")), getBracketedTagName(), getNameForException()} ); - } - break; - - default: // type is not TIME - // timeformat= is not allowed for any other data type - getDoc().addPcmlSpecificationError(DAMRI.ATTRIBUTE_NOT_ALLOWED, new Object[] {makeQuotedAttr("timeformat", getAttributeValue("timeformat")), makeQuotedAttr("type", getDataTypeString()), getBracketedTagName(), getNameForException()} ); - break; - } - } - - // Verify the timeseparator= attribute - if (m_TimeSeparator != null) - { - // Only allow this attribute when the pcml version is 6.0 or higher (e.g. ), and only for type "time". - if ( getDoc().getVersion().compareTo("6.0") < 0 ) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_PCML_VERSION, new Object[] {makeQuotedAttr("timeseparator", m_TimeSeparator), "6.0", getBracketedTagName(), getNameForException()} ); - } - - switch (getDataType()) - { - case TIME: - // Check that it's a recognized separator name. - if (!isValidSeparatorName(m_TimeSeparator)) { - Trace.log(Trace.PCML, "Separator name '" + m_TimeSeparator + "' is not recognized."); - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("timeseparator", getAttributeValue("timeseparator")), getBracketedTagName(), getNameForException()} ); - } - break; - - default: // type is not TIME - // timeseparator= is not allowed for any other data type - getDoc().addPcmlSpecificationError(DAMRI.ATTRIBUTE_NOT_ALLOWED, new Object[] {makeQuotedAttr("timeseparator", getAttributeValue("timeseparator")), makeQuotedAttr("type", getDataTypeString()), getBracketedTagName(), getNameForException()} ); - break; - } - } - - } - - - // Check if a string is a valid IBM i system VRM - // Allowed syntax: - // "VxRyMz" - // - // where: - // "V", "R" and "M" are literal characters - // x is an integer from 1 to 255 - // y is an integer from 0 to 255 - // z is an integer from 0 to 255 - // - // If valid, a positive integer is returned. This is the value generated - // by com.ibm.as400.access.AS400.generateVRM(). - // If invalid, -1 is returned. - private static final String vrmDelimChars = "VRM"; - static int validateVRM(String vrmStr) - { - StringTokenizer vrmTokens, vrmDelimiters; - - int as400vrm = -1; - int[] vrm = new int[] {-1, -1, -1}; - - vrmTokens = new StringTokenizer(vrmStr, vrmDelimChars, true); - int vrmTokenNbr = 0; - vrmDelimiters = new StringTokenizer(vrmDelimChars, vrmDelimChars, true); - - if (vrmTokens.countTokens() == 6) - { - while (vrmDelimiters.hasMoreTokens()) - { - if (vrmTokens.nextToken().equals(vrmDelimiters.nextToken())) - { - try - { - vrm[vrmTokenNbr] = Integer.parseInt(vrmTokens.nextToken()); - vrmTokenNbr++; - } - catch (NumberFormatException e) - { } - } - } - } - - // If all of the integers are within allowed ranges - // generate the VRM integer to be returned. - if ( vrm[0] >= 1 && vrm[0] <= 255 - && vrm[1] >= 0 && vrm[0] <= 255 - && vrm[2] >= 0 && vrm[0] <= 255) - { - as400vrm = AS400.generateVRM(vrm[0],vrm[1],vrm[2]); - } - - return as400vrm; - } - -} diff --git a/cvsroot/src/com/ibm/as400/data/PcmlDataValues.java b/cvsroot/src/com/ibm/as400/data/PcmlDataValues.java deleted file mode 100644 index 7b58fa0df..000000000 --- a/cvsroot/src/com/ibm/as400/data/PcmlDataValues.java +++ /dev/null @@ -1,1188 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PcmlDataValues.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import com.ibm.as400.access.AS400DataType; -import com.ibm.as400.access.AS400Text; -import com.ibm.as400.access.AS400Date; -import com.ibm.as400.access.AS400Time; -import com.ibm.as400.access.AS400Timestamp; -import com.ibm.as400.access.BidiStringType; -import com.ibm.as400.access.BinaryConverter; -import com.ibm.as400.access.Trace; // @D3A - -import java.math.BigDecimal; -import java.math.BigInteger; - -import java.io.IOException; // @C1A -import java.io.ObjectInputStream; // @C1A -import java.io.ObjectOutputStream; // @C1A -import java.io.OutputStream; -import java.io.Serializable; // @C1A - -import java.util.Hashtable; -import java.util.StringTokenizer; - -class PcmlDataValues extends Object implements Serializable // @C1C -{ - static final long serialVersionUID = -8169008879805188674L; // @C1A - - private PcmlData m_owner; // PcmlData node that owns this object - - private PcmlDimensions m_indices; // Indices into owning PcmlNode's vectors of PcmlDataValues - - private Object m_value; // Java native value: (String, Short, Integer, Long, Float, Double, BigDecimal. byte[]) - private long m_valueTs; // Correlation id of Java native value from PcmlDocument.getCorrelationID() - private byte[] m_bytes; // IBM i bytes (ebcdic/big-endian) - private long m_bytesTs; // Correlation id of IBM i bytes from PcmlDocument.getCorrelationID() - - private int m_bidiStringType; // Type of string that is contained in the value @C6A - - // Default constructor - private PcmlDataValues() - { - m_value = null; - m_bytes = null; - m_valueTs = 0; - m_bytesTs = 0; - m_bidiStringType = BidiStringType.DEFAULT; // @C6A - } - - // Constructor - PcmlDataValues(PcmlData creator, PcmlDimensions indices) - { - this(); - m_owner = creator; - m_indices = new PcmlDimensions(indices); - } - - // Custom serialization - private void writeObject(ObjectOutputStream out) throws IOException // @C1A - { // @C1A - synchronized (this) // @C1A - { // @C1A - // For input values, serialize only the IBM i byte value - // if it is current than the Java value - if ( m_owner.getUsage() == PcmlDocNode.INPUT ) // @C1A - { // @C1A - // If the byte value is more recent than the Java value - // convert the bytes to a Java value - if (m_bytesTs > m_valueTs) // @C1A - { // @C1A - m_value = null; // @C1A - m_valueTs = 0; // @C1A - } // @C1A - } // @C1A - - // For ouput values, serialize only the Java value - // if it is current than the IBM i byte value - if ( m_owner.getUsage() == PcmlDocNode.OUTPUT ) // @C1A - { - // If the byte value is more recent than the Java value - // convert the bytes to a Java value - if (m_valueTs > m_bytesTs) // @C1A - { // @C1A - m_bytes = null; // @C1A - m_bytesTs = 0; // @C1A - } // @C1A - } // @C1A - - // Perform default serialization - out.defaultWriteObject(); // @C1A - } // end of synchronized code // @C1A - } // @C1A - - // Custom deserialization - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException // @C1A - { // @C1A - // Default deserialization - in.defaultReadObject(); // @C1A - } // @C1A - - // Custom deserialization post-processing - // This processing cannot be done during readObject() because - // references to parent objects in the document are not yet set - // due to the recursive nature of deserialization. - void readObjectPostprocessing() // @C1A - { // @C1A - if (m_valueTs == m_bytesTs && m_valueTs > 0) // @C1A - { // @C1A - m_valueTs = m_owner.getDoc().getDeserializationTimestamp(); // @C1A - m_bytesTs = m_owner.getDoc().getDeserializationTimestamp(); // @C1A - } // @C1A - if (m_valueTs > m_bytesTs) // @C1A - { // @C1A - m_valueTs = m_owner.getDoc().getDeserializationTimestamp(); // @C1A - m_bytesTs = 0; // @C1A - } // @C1A - if (m_bytesTs > m_valueTs) // @C1A - { // @C1A - m_bytesTs = m_owner.getDoc().getDeserializationTimestamp(); // @C1A - m_valueTs = 0; // @C1A - } // @C1A - } // @C1A - - // Flush data values - // This allows the object to be reused when the - // m_owner (PcmlData object) redimensions its vectors. - void flushValues() - { - m_value = null; - m_bytes = null; - m_valueTs = 0; - m_bytesTs = 0; - } - - // Get qualified name of data object - String getQualifiedName() - { - return m_owner.getQualifiedName(); - } - - // Get name for exceptions - String getNameForException() - { - return m_owner.getNameForException(); - } - - - // Get Timestamp of data - long getTimestamp() - { - return Math.max(m_valueTs, m_bytesTs); - } - - // Get Java native value - public Object getValue() throws PcmlException - { - return bytesToValue(); - } - - // Set Java native value - public void setValue(Object v) throws PcmlException - { - // Do not allow a null value to be set - if (v == null) - throw new PcmlException(DAMRI.NULL_VALUE, new Object[] {getNameForException()} ); - - // If the new value matches the Java type for this element - // store the new value. - if (getDataType() == PcmlData.STRUCT) { // @D0A - throw new PcmlException(DAMRI.STRUCT_VALUE, new Object[] {getNameForException()} ); // @D0A - } - if ( v.getClass().equals(getValueClass()) ) - { - if (v instanceof BigDecimal) { - m_value = ((BigDecimal)v).setScale(getPrecision(), BigDecimal.ROUND_HALF_EVEN); // @D0A - } - else { - m_value = v; - } - } - // New value does not match the Java type for this element. - // Convert to the Java type needed -- errors may occur. - else - { - m_value = convertValue(v, getDataType(), getLength(), getPrecision(), getNameForException()); - } - // Update the value timestamp - m_valueTs = m_owner.getDoc().getCorrelationID(); - } - - // Set IBM i bytes - public void setBytes(byte[] ba) - { - m_bytes = ba; - m_bytesTs = m_owner.getDoc().getCorrelationID(); // @C7C - } - - // Set the bidi string type - public void setStringType(int type) // @C6A - { - if (m_bidiStringType == type) // @C6A - { - // If new type is same as old, just return - return; // @C6A - } - // If we are setting a new string type, we want to - // clear the java value and timestamp. This will ensure - // that the correct conversion occurs on subsequent - // getValue() calls - m_bidiStringType = type; // @C6A - m_value = null; // @C6A - m_valueTs = 0; // @C6A - - } - - // Convert IBM i bytes to Java native value - private Object bytesToValue() throws PcmlException - { - // If the byte value is more recent than the Java value - // convert the bytes to a Java value - if (m_bytesTs > m_valueTs) - { - m_valueTs = m_bytesTs; // Update value timestamp - toObject(m_bytes); - } - - // If value is not set and there is an - // init= value specified, initialize the value - if (m_value == null) - { - String initValue = m_owner.getInit(); - if (initValue != null) - setValue(initValue); - } - - if (m_value == null) // If value has not been set @C5A - return m_value; // return null @C5A - - // Return the Java value - if (getDataType() == PcmlData.BYTE) - { - // Make a copy of the byte array, so caller can - // modify the value without repercussions - byte[] srcArray = (byte[]) m_value; - byte[] cloneArray = new byte[srcArray.length]; - for (int b = 0; b element - if (tmpCcsid == 0) - { // @C2A - PcmlNode node = m_owner.getParent(); // @C2A - node = node.getParent(); // get next ancestor @C7A - while (node != m_owner.getDoc()) // @C2A @C7C - node = node.getParent(); // @C2A - // If this element is a descendent of a Program element - // use the CCSID saved the last time the - if (node instanceof PcmlProgram) // @C2A - return ((PcmlProgram) node).getProgramCCSID(); // @C2A - else if (node instanceof RfmlDocument) // @D0A - return ((RfmlDocument) node).getCcsidInt(); // @D0A - else // @C2A - return m_owner.getDoc().getAs400().getCcsid(); // @C2A - } // @C2A - else - return tmpCcsid; - } - - - // Returns the precision= attribute - // The precision is only meaningful when type=int or packed - // For type=int: - // A 2-byte signed integer is: length=2 precision=15 - // A 2-byte unsigned integer is: length=2 precision=16 - // A 4-byte signed integer is: length=4 precision=31 - // A 4-byte unsigned integer is: length=4 precision=32 - // For type=packed: - // length= species the total number of digits - // precision= specifies the number of decimal digits - int getPrecision() - { - return m_owner.getPrecision(); - } - - - // Returns the dateformat= attribute - // The dateformat is only meaningful when type=date - String getDateFormat() - { - return m_owner.getDateFormat(); - } - - // Returns the dateseparator= attribute - // The dateseparator is only meaningful when type=date - String getDateSeparator() - { - return m_owner.getDateSeparator(); - } - - - // Returns the timeformat= attribute - // The timeformat is only meaningful when type=time - String getTimeFormat() - { - return m_owner.getTimeFormat(); - } - - // Returns the timeseparator= attribute - // The timeseparator is only meaningful when type=time - String getTimeSeparator() - { - return m_owner.getTimeSeparator(); - } - - String getTrim() // @D1A - { // @D1A - return m_owner.getTrim(); // @D1A - } // @D1A - - boolean isArray() - { - return m_owner.isArray(); - } - - // Return number of bytes required to perform toBytes(); - // This is similar to C++ DataObject::FlattenedLengthAt() - public int byteLength() throws PcmlException - { - - int length = getLength(); - - switch (getDataType()) - { - case PcmlData.CHAR: - case PcmlData.INT: - case PcmlData.FLOAT: - case PcmlData.BYTE: - return length; - - case PcmlData.PACKED: - return length / 2 + 1; // Packed contains 2 digits per byte plus sign - - case PcmlData.ZONED: - return length; // Zoned contains 1 digit per byte, sign is in low order digit - - case PcmlData.DATE: - if (length == 0) { - String format = getDateFormat(); - if (format != null) { - length = AS400Date.getByteLength(AS400Date.toFormat(format), PcmlNode.separatorAsChar(getDateSeparator())); - } - } - return length; - - case PcmlData.TIME: - if (length == 0) { - String format = getTimeFormat(); - if (format != null) { - length = AS400Time.getByteLength(AS400Time.toFormat(format), PcmlNode.separatorAsChar(getTimeSeparator())); - } - } - return length; - - case PcmlData.TIMESTAMP: - if (length == 0) { - //length = AS400Timestamp.getByteLength(null); - length = 26; // we publicly support only the 26-byte timestamp format - } - return length; - - default: - throw new PcmlException(DAMRI.BAD_DATA_TYPE, new Object[] {new Integer(getDataType()) , getNameForException()} ); - - } - } - - // Converts an object to the correct type (class) for - // the defined data tpe. - // The setValue method allows most data types to be set using - // either the Java class associaed with the data type or using - // a String. This method converts the value to the Java class - // defined for the data type. Exceptions such as - // NumberFormatException may result. - private Class getValueClass() throws PcmlException - { - int dataLength = getLength(); - int dataPrecision = getPrecision(); - int dataType = getDataType(); - - try - { - switch (dataType) - { - - case PcmlData.CHAR: - return Class.forName("java.lang.String"); - - case PcmlData.INT: - if (dataLength == 2) - { - if (dataPrecision == 16) - { - return Class.forName("java.lang.Integer"); - } - else - { // dataPrecision == 15 or defaulted - return Class.forName("java.lang.Short"); - } - } - else - if (dataLength == 4) // @C3A - { // dataLength == 4 - if (dataPrecision == 32) - { - return Class.forName("java.lang.Long"); - } - else - { // dataPrecision == 31 or defaulted - return Class.forName("java.lang.Integer"); - } - } - else // @C3A - if (dataLength == 8) // @C3A - { // dataLength == 8 // @C3A - return Class.forName("java.lang.Long"); // @C3A - } // @C3A - - case PcmlData.PACKED: - case PcmlData.ZONED: - return Class.forName("java.math.BigDecimal"); - - - case PcmlData.FLOAT: - if (dataLength == 4) - { - return Class.forName("java.lang.Float"); - } - else - { // Must be length=8 - return Class.forName("java.lang.Double"); - } - - case PcmlData.BYTE: - return (new byte[0]).getClass(); - - case PcmlData.DATE: - return Class.forName("java.sql.Date"); - - case PcmlData.TIME: - return Class.forName("java.sql.Time"); - - case PcmlData.TIMESTAMP: - return Class.forName("java.sql.Timestamp"); - - - default: - throw new PcmlException(DAMRI.BAD_DATA_TYPE, new Object[] {new Integer(getDataType()) , getNameForException()} ); - - } // END: switch (getDataType()) - } - catch (ClassNotFoundException e) - { - throw new PcmlException(DAMRI.CLASS_NOT_FOUND, new Object[] {new Integer(getDataType()) , getNameForException()} ); - } - } - - // Convert Java object IBM i bytes - // Returns the number of bytes converted - public int toBytes(OutputStream bytes, int offset) throws PcmlException - { - Object value = null; - int dataType = getDataType(); - int dataLength = getLength(); - if (dataLength == 0) { // this can happen with date, time, timestamp - dataLength = byteLength(); - } - int bytesConverted = 0; // @B2A - - // Get the Java object and make sure it has been set. - value = getValue(); - if (value == null) - { - throw new PcmlException(DAMRI.INPUT_VALUE_NOT_SET, new Object[] {getNameForException()} ); - } - - // Get a converter from the PcmlDocument node. - // PcmlDocument will either create a converter or return an existing one. - AS400DataType converter = m_owner.getDoc().getConverter(dataType, dataLength, getPrecision(), getCcsid(), getDateFormat(), getDateSeparator(), getTimeFormat(), getTimeSeparator()); - byte[] byteArray = new byte[dataLength]; - if (dataType != PcmlData.CHAR) // @C6A - { - synchronized(converter) // @B1A - { // @B1A - converter.toBytes(value, byteArray); - bytesConverted = converter.getByteLength(); // @B2A - } // @B1A - } - else // We need to use the string type for the conversion @C6A - { - synchronized(converter) // @C6A - { - ((AS400Text)converter).toBytes(value, byteArray, 0, m_bidiStringType); // @C6A - bytesConverted = converter.getByteLength(); // @C6A - } - } - try { bytes.write(byteArray, 0, bytesConverted); } - catch (IOException e) { throw new PcmlException(e); } - - // Detail tracing of data conversion - if (Trace.isTracePCMLOn()) // @D3C - { // @B2A - String parseMsg; // @B2A - if (m_indices.size() > 0) // @B2A - { // @B2A - parseMsg = SystemResourceFinder.format(DAMRI.WRITE_DATA_W_INDICES, new Object[] {Integer.toHexString(offset), Integer.toString(bytesConverted), getNameForException(), m_indices.toString(), PcmlMessageLog.toHexString(byteArray, 0, bytesConverted)} ); // @B2A - } // @B2A - else // @B2A - { // @B2A - parseMsg = SystemResourceFinder.format(DAMRI.WRITE_DATA, new Object[] {Integer.toHexString(offset), Integer.toString(bytesConverted), getNameForException(), PcmlMessageLog.toHexString(byteArray, 0, bytesConverted)} ); // @B2A - } // @B2A - parseMsg = parseMsg + "\t " + Thread.currentThread(); // @B2A - Trace.log(Trace.PCML, parseMsg); // @D3C - } // @B2A - - return bytesConverted; // @B2A - } // public int toBytes(OutputStream bytes, int offset) - - // Convert IBM i bytes to Java Object - // Returns the Java Object - public Object toObject(byte[] bytes) throws PcmlException - { - Object newVal = null; - int dataType = getDataType(); - - // Get a converter from the PcmlDocument node. - // PcmlDocument will either create a converter or return an existing one. - AS400DataType converter = m_owner.getDoc().getConverter(dataType, getLength(), getPrecision(), getCcsid(), getDateFormat(), getDateSeparator(), getTimeFormat(), getTimeSeparator()); - if (dataType != PcmlData.CHAR) // @C6A - { - synchronized(converter) // @B1A - { // @B1A - newVal = converter.toObject(bytes); - } // @B1A - } - else // We need to use the string type for the conversion @C6A - { - synchronized(converter) // @C6A - { - newVal = ((AS400Text)converter).toObject(bytes, 0, m_bidiStringType); // @C6A - } - } - - // For Strings, trim blanks and nulls appropriately - if (dataType == PcmlData.CHAR) - { - newVal = trimString((String) newVal, getTrim()); // @B2A @D1C - } - - // Set the new value - setValue(newVal); - - return newVal; - } // public int toBytes(byte[] bytes, int offset) - - // Parses array of bytes and stores for later conversion - // to Java objects. This allows for lazy data translation - // for performance. - // Returns the number of bytes consumed from the input byte array - // Note: This may be larger than the number of bytes saved for this element - // because of bytes skipped due to an offset value. - public int parseBytes(byte[] bytes, int offset, Hashtable offsetStack) throws PcmlException - { - int nbrBytes = 0; - int skipBytes = 0; - - - // Adjust offset if necessary - // This is driven by the offset= attribute on the tag - int myOffset = getOffset(); - if (myOffset != 0) - { - // Handle errors caused by bad offset values - if (myOffset < 0 || myOffset > bytes.length) - { - throw new PcmlException(DAMRI.BAD_OFFSET_VALUE, new Object[] {new Integer(myOffset), new Integer(bytes.length), "", getNameForException()} ); - } - - // Determine from where the offset is based - Integer myOffsetbase = null; - String myOffsetfrom = m_owner.getOffsetfromId(); // Get offsetfrom= element name, if any @A1C - - // If offsetfrom= was specified with the name of another element, - // get the base for the offset from the offset stack. - // The offset stack is a stack of beginning offsets for all - // ancestors of the current element. The offsetfrom= value must be one - // of these ancestors or an error will be reported. - if (myOffsetfrom != null) - { - myOffsetbase = (Integer) offsetStack.get(myOffsetfrom); - if (myOffsetbase == null) - { - throw new PcmlException(DAMRI.OFFSETFROM_NOT_FOUND, new Object[] {myOffsetfrom, getNameForException()} ); - } - } - else - { - // If offsetfrom= was specified with an integer literal, use it. - if (m_owner.getOffsetfrom() >= 0) // @A1A - { // @A1A - myOffsetbase = new Integer(m_owner.getOffsetfrom()); // @A1A - } // @A1A - // getOffsetfrom() returns -1 to indicate that offset from was not specified. - // No offsetfrom= was specified, the offset will be relative to the - // beginning offset of the parent of this elements parent. - // This is the first (most recent) entry in the offset stack. - else // @A1A - { // @A1A - myOffsetfrom = ((PcmlDocNode) m_owner.getParent()).getQualifiedName(); - myOffsetbase = (Integer) offsetStack.get( myOffsetfrom ); - } // @A1A - } - - if (myOffsetbase != null) - { - myOffset = myOffset + myOffsetbase.intValue(); - // Handle errors caused by bad offset values - if (myOffset < 0 || myOffset > bytes.length) - { - throw new PcmlException(DAMRI.BAD_TOTAL_OFFSET, new Object[] {new Integer(myOffset), new Integer(bytes.length), myOffsetbase, myOffsetfrom, "", getNameForException()} ); - } - } - - // If offset for this element is beyond current offset - // calculate number of bytes to skip - if (myOffset > offset) - { - skipBytes = myOffset - offset; - } - - } - - // Get number of bytes to parse for this value - nbrBytes = byteLength(); - - // Make sure length makes sense - if (nbrBytes < 0 || nbrBytes > PcmlData.MAX_STRING_LENGTH) - { - throw new PcmlException(DAMRI.BAD_DATA_LENGTH, new Object[] {new Integer(nbrBytes), new Integer(PcmlData.MAX_STRING_LENGTH), "", getNameForException()} ); // @C4C - } - - // Make sure we are not trying to access more bytes than available. - if (offset + skipBytes + nbrBytes > bytes.length) - { - throw new PcmlException(DAMRI.INSUFFICIENT_INPUT_DATA, new Object[] {Integer.toString(offset + skipBytes + nbrBytes), Integer.toString(bytes.length), "", getNameForException()} ); - } - - // Finally, make a new byte array, copy the bytes, and save them - byte [] newBytes = new byte[nbrBytes]; - for (int b = 0; b < nbrBytes; b++) - { - newBytes[b] = bytes[offset+ skipBytes + b]; - } - setBytes(newBytes); - - // Detail tracing of data parsing - if (Trace.isTracePCMLOn()) // @D3C - { - String parseMsg; - if (m_indices.size() > 0) - { - parseMsg = SystemResourceFinder.format(DAMRI.READ_DATA_W_INDICES, new Object[] {Integer.toHexString(offset+ skipBytes), Integer.toString(nbrBytes), getNameForException(), m_indices.toString(), PcmlMessageLog.toHexString(newBytes)} ); - } - else - { - parseMsg = SystemResourceFinder.format(DAMRI.READ_DATA, new Object[] {Integer.toHexString(offset+ skipBytes), Integer.toString(nbrBytes), getNameForException(), PcmlMessageLog.toHexString(newBytes)} ); - } - parseMsg = parseMsg + "\t " + Thread.currentThread(); - Trace.log(Trace.PCML, parseMsg); - } - - - return skipBytes + nbrBytes; - } // End parseBytes() - - // Resolve an integer value from either a named element or a literal - private int resolveIntegerValue(int intLiteral, String intId) throws PcmlException - { - PcmlData intNode; - Object nodeValue; - - if (intId != null) - { - intNode = (PcmlData) ((PcmlDocRoot)m_owner.getRootNode()).getElement(intId); - nodeValue = intNode.getValue(m_indices); - if (nodeValue instanceof String) - { - return Integer.parseInt((String) nodeValue); - } - else if (nodeValue instanceof Number) - { - return ((Number) nodeValue).intValue(); - } - else if (nodeValue == null) - { - throw new PcmlException(DAMRI.INPUT_VALUE_NOT_SET, new Object[] {intNode.getNameForException()} ); - } - else - { - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {nodeValue.getClass().getName(), intNode.getNameForException()} ); - } - } - return intLiteral; - } - - // Converts an object to the correct type (class) for - // the defined data type. - // The setValue method allows most data types to be set using - // either the Java class associated with the data type or using - // a String. This method converts the value to the Java class - // defined for the data type. Exceptions such as - // NumberFormatException may result. - // - // This is implemented as a static method so it can be used - // to verify the init= attribute after parsing the pcml document tags. - public static Object convertValue(Object newVal, int dataType, int dataLength, int dataPrecision, String nodeNameForException) throws PcmlException - { - Object convertedVal = null; - - if (newVal == null) - throw new PcmlException(DAMRI.NULL_VALUE, new Object[] {nodeNameForException} ); - - switch (dataType) - { - - case PcmlData.CHAR: - if (newVal instanceof String) - { - convertedVal = newVal; - } - else - { - convertedVal = newVal.toString(); - } - break; - - case PcmlData.INT: - if (dataLength == 2) - { - if (dataPrecision == 16) - { - if (newVal instanceof String) - { - convertedVal = new Integer((String) newVal); - } - else - { - if (newVal instanceof Integer) - { - convertedVal = newVal; - } - else if (newVal instanceof Number) - { - convertedVal = new Integer( ((Number) newVal).intValue() ); - } - else - { - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {newVal.getClass().getName(), nodeNameForException} ); - } - } - } - else - { // dataPrecision == 15 or defaulted - if (newVal instanceof String) - { - convertedVal = new Short( ((String) newVal) ); - } - else - { - if (newVal instanceof Short) - { - convertedVal = newVal; - } - else if (newVal instanceof Number) - { - convertedVal = new Short( ((Number) newVal).shortValue() ); - } - else - { - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {newVal.getClass().getName(), nodeNameForException} ); - } - } - } - } - else if (dataLength == 4) // @C3A - { - if (dataPrecision == 32) - { - if (newVal instanceof String) - { - convertedVal = new Long((String) newVal); - } - else - { - if (newVal instanceof Long) - { - convertedVal = newVal; - } - else if (newVal instanceof Number) - { - convertedVal = new Long( ((Number) newVal).longValue() ); - } - else - { - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {newVal.getClass().getName(), nodeNameForException} ); - } - } - } - else - { // dataPrecision == 31 or defaulted - if (newVal instanceof String) - { - convertedVal = new Integer((String) newVal); - } - else - { - if (newVal instanceof Integer) - { - convertedVal = newVal; - } - else if (newVal instanceof Number) - { - convertedVal = new Integer( ((Number) newVal).intValue() ); - } - else - { - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {newVal.getClass().getName(), nodeNameForException} ); - } - } - } - } - else // @C3A - { // dataLength == 8 // @C3A - if (dataPrecision == 64) - { - if (newVal instanceof String) - { - convertedVal = new BigInteger((String) newVal); - } - else - { - if (newVal instanceof BigInteger) - { - convertedVal = newVal; - } - else if (newVal instanceof Number) - { - long longVal = ((Number) newVal).longValue(); - convertedVal = new BigInteger(Long.toString(longVal)); - } - else - { - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {newVal.getClass().getName(), nodeNameForException} ); - } - } - } - else - { // dataPrecision == 63 or defaulted - if (newVal instanceof String) // @C3A - { // @C3A - convertedVal = new Long((String) newVal); // @C3A - } // @C3A - else // @C3A - { // @C3A - if (newVal instanceof Long) - { - convertedVal = newVal; - } - else if (newVal instanceof Number) // @C3A - { // @C3A - convertedVal = new Long( ((Number) newVal).longValue() ); // @C3A - } // @C3A - else // @C3A - { // @C3A - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {newVal.getClass().getName(), nodeNameForException} ); // @C3A - } // @C3A - } // @C3A - } - } // @C3A - break; - - // Allows input value to be one of: BigDecimal, String or a subclass of Number - case PcmlData.PACKED: - case PcmlData.ZONED: - if (newVal instanceof BigDecimal) - { - convertedVal = ((BigDecimal)newVal).setScale(dataPrecision, BigDecimal.ROUND_HALF_EVEN); // @D0C - } - else - { - if (newVal instanceof String) - { - convertedVal = (new BigDecimal((String) newVal)); - if (((BigDecimal)convertedVal).scale() != dataPrecision) { - convertedVal = ((BigDecimal)convertedVal).setScale(dataPrecision, BigDecimal.ROUND_HALF_EVEN); // @D0A - } - } - else - { - if (newVal instanceof Number) - { - convertedVal = (new BigDecimal(((Number) newVal).doubleValue())).setScale(dataPrecision, BigDecimal.ROUND_HALF_EVEN); // @D0C - } - else - { - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {newVal.getClass().getName(), nodeNameForException} ); - } - } - } - break; - - - case PcmlData.FLOAT: - if (dataLength == 4) - { - if (newVal instanceof String) - { - convertedVal = new Float((String) newVal); - } - else - { - if (newVal instanceof Float) - { - convertedVal = newVal; - } - else if (newVal instanceof Number) - { - convertedVal = new Float( ((Number) newVal).floatValue() ); - } - else - { - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {newVal.getClass().getName(), nodeNameForException} ); - } - } - } - else - { // Must be length=8 - if (newVal instanceof String) - { - convertedVal = new Double((String) newVal); - } - else - { - if (newVal instanceof Double) - { - convertedVal = newVal; - } - else if (newVal instanceof Number) - { - convertedVal = new Double( ((Number) newVal).doubleValue() ); - } - else - { - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {newVal.getClass().getName(), nodeNameForException} ); - } - } - } - break; - - case PcmlData.BYTE: - if (newVal instanceof String) - { - StringTokenizer st = new StringTokenizer((String) newVal, " ,"); - byte byteVal = 0; - byte[] byteArray = new byte[dataLength]; - for (int i=0; i < dataLength; i++) - { - if (st.hasMoreTokens()) - { - String token = st.nextToken(); - try { - byteVal = Byte.decode(token).byteValue(); - } - catch (NumberFormatException nfe) - { - // If leftmost bit is on (as in, for example, 0x80), and token isn't prefixed by a minus sign, Byte.decode() throws a NumberFormatException. - // For such cases we must use a more accommodating conversion utility. - try { - byte[] bytes = BinaryConverter.stringToBytes(token); - byteVal = bytes[0]; - } - catch (NumberFormatException e) { - // Rethrow original exception; it's more informative. - throw nfe; - } - } - } - else { - // Pad with final token in string - } - byteArray[i] = byteVal; - } - convertedVal = byteArray; - } - else - if (newVal instanceof Number) - { - byte byteVal = ((Number) newVal).byteValue(); - byte[] byteArray = new byte[dataLength]; - for (int i=0; i < dataLength; i++) - { - byteArray[i] = byteVal; - } - convertedVal = byteArray; - } - else - { - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {newVal.getClass().getName(), nodeNameForException} ); - } - break; - - case PcmlData.DATE: - if (newVal instanceof String) - { - // Parse XML Schema-style date value: yyyy-mm-dd - convertedVal = AS400Date.parseXsdString((String)newVal); - } - else - { - if (newVal instanceof java.sql.Date) - { - convertedVal = (java.sql.Date)newVal; - } - else - { - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {newVal.getClass().getName(), nodeNameForException} ); - } - } - break; - - case PcmlData.TIME: - if (newVal instanceof String) - { - // Parse XML Schema-style time value: hh:mm:ss - convertedVal = AS400Time.parseXsdString((String)newVal); - } - else - { - if (newVal instanceof java.sql.Time) - { - convertedVal = (java.sql.Time)newVal; - } - else - { - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {newVal.getClass().getName(), nodeNameForException} ); - } - } - break; - - case PcmlData.TIMESTAMP: - if (newVal instanceof String) - { - // Parse XML Schema-style timestamp value: yyyy-MM-ddTHH:mm:ss.SSSSSSSSS - convertedVal = AS400Timestamp.parseXsdString((String)newVal); - } - else - { - if (newVal instanceof java.sql.Timestamp) - { - convertedVal = (java.sql.Timestamp)newVal; - } - else - { - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {newVal.getClass().getName(), nodeNameForException} ); - } - } - break; - - - default: - throw new PcmlException(DAMRI.BAD_DATA_TYPE, new Object[] {new Integer(dataType) , nodeNameForException} ); - - } // END: switch (getDataType()) - - return convertedVal; - } - - // Trims blanks and nulls from the ends of a string - // Returns the trimmed string // @D1C - static String trimString(String str, String trimEnd) - { - if (trimEnd != null && trimEnd.equals("none")) - { - return str; - } - char[] charBuff = str.toCharArray(); - int startOffset = 0; // Used when constructing return string - int lengthReturned = charBuff.length; // Used when constructing return string - if (trimEnd == null || trimEnd.equals("right") || trimEnd.equals("both") ) - { - // Trim blanks and nulls - trimRight: while (lengthReturned > 0) - { - switch (charBuff[lengthReturned-1]) - { - case ' ': - case '\0': - lengthReturned--; - break; - default: - break trimRight; - } - } - } - if (trimEnd != null && (trimEnd.equals("left") || trimEnd.equals("both")) ) - { - // Trim blanks and nulls - trimLeft: while (startOffset < lengthReturned) - { - switch (charBuff[startOffset]) - { - case ' ': - case '\0': - startOffset++; - lengthReturned--; - break; - default: - break trimLeft; - } - } - } - return new String(charBuff, startOffset, lengthReturned); - } -} diff --git a/cvsroot/src/com/ibm/as400/data/PcmlDataVector.java b/cvsroot/src/com/ibm/as400/data/PcmlDataVector.java deleted file mode 100644 index 80d118a7d..000000000 --- a/cvsroot/src/com/ibm/as400/data/PcmlDataVector.java +++ /dev/null @@ -1,158 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PcmlDataVector.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import java.io.IOException; // @C1A -import java.io.ObjectInputStream; // @C1A -import java.io.Serializable; - -import java.util.Vector; - -class PcmlDataVector extends Vector { - static final long serialVersionUID = -8169008879805188674L; // @C1A - - private PcmlData m_owner; // PcmlData node that owns this vector - - private PcmlDimensions m_indices; // Indices into owning PcmlNode's vectors of PcmlDataValues - - private long m_dimTs; // Timestamp when this vector was redimensioned - - // Default constructor - PcmlDataVector(PcmlData owner, PcmlDimensions indices) - { - super(); - m_owner = owner; - m_indices = new PcmlDimensions(indices); - m_dimTs = m_owner.getDoc().getCorrelationID(); - } - - PcmlDataVector(int size, PcmlData owner, PcmlDimensions indices) - { - super(size); - m_owner = owner; - m_indices = new PcmlDimensions(indices); - m_dimTs = m_owner.getDoc().getCorrelationID(); - } - - // Custom deserialization - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException // @C1A - { // @C1A - // Default deserialization - in.defaultReadObject(); // @C1A - } // @C1A - - // Custom deserialization post-processing - // This processing cannot be done during readObject() because - // references to parent objects in the document are not yet set - // due to the recursive nature of deserialization. - void readObjectPostprocessing() // @C1A - { // @C1A - Object item; // @C1A - - // Set dimension timestamp - m_dimTs = m_owner.getDoc().getDeserializationTimestamp(); // @C1A - - // Recursively perform post processing for - // all nested PcmlDataVectors and PcmlDataValues - for (int i = 0; i < size(); i++) // @C1A - { // @C1A - item = elementAt(i); // @C1A - if (item instanceof PcmlDataValues) // @C1A - { // @C1A - ((PcmlDataValues) item).readObjectPostprocessing(); // @C1A - } // @C1A - else if (item instanceof PcmlDataVector) // @C1A - { // @C1A - ((PcmlDataVector) item).readObjectPostprocessing(); // @C1A - } // @C1A - } // @C1A - } // @C1A - - // Get Timestamp of data - long getTimestamp() - { - return m_dimTs; - } - - // Flush the values held by this vector - void flushValues() - { - Object item; - for (int i = 0; i < size(); i++) - { - item = elementAt(i); - if (item instanceof PcmlDataValues) - { - ((PcmlDataValues) item).flushValues(); - } - else if (item instanceof PcmlDataVector) - { - ((PcmlDataVector) item).flushValues(); - } - setElementAt(null, i); - } - } - - // Redimension the vector - void redimension(int newSize) - { - flushValues(); - m_dimTs = m_owner.getDoc().getCorrelationID(); - if (newSize > capacity()) - { - ensureCapacity(newSize); - setSize(newSize); - } - else - { - setSize(newSize); - trimToSize(); - } - } - - // Return the PcmlDataValues object at the index - PcmlDataValues valuesAt(int i) - { - return (PcmlDataValues) elementAt(i); - } - - // Return the PcmlDataValues object at the index - PcmlDataVector vectorAt(int i) - { - return (PcmlDataVector) elementAt(i); - } - - // Create a PcmlDataValues object for each entry in the vector - void populateWithValues() - { - PcmlDataValues item; - PcmlDimensions newIndices = new PcmlDimensions(m_indices); - for (int i = 0; i < size(); i++) - { - newIndices.add(i); - item = valuesAt(i); - if (item == null) - { - item = new PcmlDataValues(m_owner, newIndices); - setElementAt(item, i); - } - else - { - item.flushValues(); - } - newIndices.remove(); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/data/PcmlDescriptor.java b/cvsroot/src/com/ibm/as400/data/PcmlDescriptor.java deleted file mode 100644 index cae577130..000000000 --- a/cvsroot/src/com/ibm/as400/data/PcmlDescriptor.java +++ /dev/null @@ -1,47 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PcmlDescriptor.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -/** - * The PcmlDescriptor class implements the methods of the Descriptor interface - * that are unique to the tag. - * - **/ - -class PcmlDescriptor extends DocNodeDescriptor -{ - /* Constructor */ - public PcmlDescriptor(PcmlDocNode node) - { - super(node); - } - /** - * Return list of valid attributes for the tag. - **/ - public String[] getAttributeList() - { - return ((PcmlDocument)getDocNode()).getAttributeList(); - } - - /** - * Return a String containing the current value for the requested attribute. - **/ - public String getAttributeValue(String attr) - { - if (attr != null && attr.equals("version")) - return ((PcmlDocument)getDocNode()).getVersion(); - else - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/data/PcmlDimensions.java b/cvsroot/src/com/ibm/as400/data/PcmlDimensions.java deleted file mode 100644 index fa445312a..000000000 --- a/cvsroot/src/com/ibm/as400/data/PcmlDimensions.java +++ /dev/null @@ -1,126 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PcmlDimensions.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import java.io.Serializable; // @C1A - -import java.util.Vector; - -class PcmlDimensions extends Object implements Serializable -{ - static final long serialVersionUID = -8169008879805188674L; // @C1A - - private Vector v; - - PcmlDimensions() - { - v = new Vector(5, 5); - } - - PcmlDimensions(int nbrDimensions) - { - v = new Vector(nbrDimensions, 5); - } - - PcmlDimensions(int[] values) - { - v = new Vector(values.length, 5); - add(values); - } - - PcmlDimensions(PcmlDimensions values) - { - v = new Vector(values.size(), 5); - add(values); - } - - int[] asArray() - { - int[] values = new int[v.size()]; - for (int i=0; i < v.size(); i++) - { - values[i] = ((Integer)v.elementAt(i)).intValue(); - } - return values; - } - - public String toString() - { - StringBuffer buf = new StringBuffer(v.size()*10); - buf.append("{"); - for (int i=0; i < v.size(); i++) - { - buf.append( v.elementAt(i) ); - if (i < v.size()-1) - buf.append( ", " ); - } - buf.append("}"); - return buf.toString(); - } - - int at(int index) throws ArrayIndexOutOfBoundsException - { - return ((Integer)v.elementAt(index)).intValue(); - } - - Integer integerAt(int index) throws ArrayIndexOutOfBoundsException - { - return (Integer) v.elementAt(index); - } - - void add(Integer value) - { - v.addElement(value); - } - - void add(int value) - { - add(new Integer(value)); - } - - void add(int[] values) - { - v.ensureCapacity(v.size() + values.length); - for (int i=0; i < values.length; i++) - { - v.addElement(new Integer(values[i])); - } - } - - void add(PcmlDimensions values) - { - v.ensureCapacity(v.size() + values.size()); - for (int i=0; i < values.size(); i++) - { - v.addElement(values.integerAt(i)); - } - } - - void remove() - { - v.removeElementAt(v.size() - 1); - } - - // @D1A -- Added for XPCML - void set(int index, int value) - { - v.set(index, new Integer(value)); - } - - int size() - { - return v.size(); - } - -} diff --git a/cvsroot/src/com/ibm/as400/data/PcmlDocNode.java b/cvsroot/src/com/ibm/as400/data/PcmlDocNode.java deleted file mode 100644 index 1953410c9..000000000 --- a/cvsroot/src/com/ibm/as400/data/PcmlDocNode.java +++ /dev/null @@ -1,497 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PcmlDocNode.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import com.ibm.as400.access.AS400; - -import java.util.Enumeration; - -abstract class PcmlDocNode extends PcmlNode -{ - public final int PROGRAM = 1; - public final int STRUCT = 2; - public final int DATA = 3; - public final int RECORDFORMAT = 5; // @D0A - - /*********************************************************** - Static Members - ***********************************************************/ - - /* Usage */ - public static final int UNSUPPORTED = 0; - public static final int INHERIT = 1; - public static final int INPUT = 2; - public static final int OUTPUT = 3; - public static final int INPUTOUTPUT = 4; - - // Serial verion unique identifier - static final long serialVersionUID = 2085968464631195453L; - - // This member is transient because it is only needed when - // instantiated (parse) from source tags. - protected transient PcmlAttributeList m_XmlAttrs; - private String m_Name; - private String m_QualName; - private String m_TagName; - private int m_NodeType; - private int m_Usage; - private String m_Type; // value of "type=" attribute - private String m_Struct; // value of "struct=" attribute - - // @E0A - Add holder for condensed name if used - private String m_CondensedName; //@E0A - private boolean m_IsExtendedType; //@E0A - - // @E0A - Add counter for use in xpcml output processing - private int m_CountReps; //@E0A - - - // Constructor - public PcmlDocNode() - { - m_XmlAttrs = null; - m_Name = null; - m_QualName = null; - m_TagName = ""; - m_CondensedName=""; //@E0A - m_IsExtendedType=false; //@E0A - m_NodeType = PcmlNodeType.UNSUPPORTED; - m_CountReps = -10; //@E0A - } - - // Constructor - public PcmlDocNode(PcmlAttributeList attrs) // @C1A - { // @C1A - m_XmlAttrs = attrs; // @C1A - m_TagName = ""; // @C1A - m_CondensedName=""; //@E0A - m_IsExtendedType=false; //@E0A - m_CountReps=-10; //@E0A - m_NodeType = PcmlNodeType.UNSUPPORTED; // @C1A - - // Set name= attribute value - m_Name = getAttributeValue("name"); // @C1A - m_QualName = null; // @C1A - - // Set usage= attribute value - setUsage(getAttributeValue("usage")); // @C1A - - // Set type= attribute value - m_Type = getAttributeValue("type"); - - // Set struct= attribute value - m_Struct = getAttributeValue("struct"); - } // @C1A - - public Object clone() - { - PcmlDocNode child = null, newChild = null; - - PcmlDocNode node = (PcmlDocNode) super.clone(); - node.m_QualName = null; - - // Now clone children - Enumeration children = getChildren(); // @C2A - while (children.hasMoreElements()) // @C2A - { // @C2A - child = (PcmlDocNode) children.nextElement(); // @C2A - newChild = (PcmlDocNode) child.clone(); // @C2A - node.addChild(newChild); // @C2A - } // @C2A - - return node; - } - - - // Add a child to this element - protected void addChild(PcmlNode child) // @C2C - { - String qName; // Qualified name of child - - - super.addChild(child); - - qName = child.getQualifiedName(); - if ( !qName.equals("") && getDoc() != null) // @C2C - { - if ( getDoc().containsElement(qName) ) - { - getDoc().addPcmlSpecificationError(DAMRI.MULTIPLE_DEFINE, new Object[] {qName} ); - } - ((PcmlDocRoot) getRootNode()).addElement(child); - } - } - - // Get the system object for this document - AS400 getAs400() - { - return getDoc().getAs400(); - } - - // Get the system VRM for this document - int getAs400VRM() throws PcmlException - { - return getDoc().getAs400VRM(); - } - - // Get the document node (PcmlDocument) - final PcmlDocument getDoc() - { - return (PcmlDocument) getRootNode(); - } - - // Get the name of the document element (NAME=) - public String getName() - { - if (m_Name == null) - return ""; - else - return m_Name; - } - - // Get the fully qualified name of the document element - // The qualified name is the concatentation of the names - // of all ancestors and the name of "this" with each - // name separated by a period. - public String getQualifiedName() - { - if (m_QualName != null && !m_QualName.equals("") ) - { - return m_QualName; - } - - String ancestor; - String myName = getName(); - - // If the node does not have a parent return and empty string. - // A node without a parent is either the PcmlDocument (root of the tree) - // or it is a node that is not inserted into a document tree (yet). - if ( getDoc() == null ) // @C2A - { // @C2A - return ""; // @C2A - } // @C2A - - if ( getParent() == null ) - { - return ""; - } - - // For nodes in the middle of the heirarchy that have no name, - // stop going up the heirarchy. I.E. Do not give name like: - // "a.b..d.e" - if ( myName.equals("") && getParent().getParent() != null ) - { - return ""; - } - - ancestor = ((PcmlDocNode)getParent()).getQualifiedName(); - - if ( ancestor.equals("") ) - { - if ( getParent().getParent() != null ) - { - return ""; - } - else - { - m_QualName = myName; - return m_QualName; - } - } - else - { - m_QualName = ancestor + "." + myName; - return m_QualName; - } - } - - // Get the fully qualified name of the document element - // for use in exceptions. - // Whereas getQualifiedName() returns an empty string if - // any of the ancestors is not named, this method - // returns a full name with a child number for - // any unnamed ancestors. - // The qualified name is the concatentation of the names - // of all ancestors and the name of "this" with each - // name separated by a period. - public String getNameForException() - { - String ancestor; - String myName = getName(); - - if ( getParent() == null ) - { - return ""; - } - - // For nodes in the middle of the heirarchy that have no name, - // stop going up the heirarchy. I.E. Do not give name like: - // "a.b..d.e" - if ( myName.equals("") ) - { - myName = "[" + Integer.toString( getChildNbr() ) + "]"; - } - - ancestor = ((PcmlDocNode)getParent()).getQualifiedName(); - - if ( ancestor.equals("") ) - { - return myName; - } - else - { - return ancestor + "." + myName; - } - } - - // Returns one of the PcmlNodeType constants indicating - // what type of node this is: - // Possible values: - // PcmlNodeType.DOCUMENT - // PcmlNodeType.PROGRAM - // PcmlNodeType.STRUCT - // PcmlNodeType.DATA - // PcmlNodeType.RECORDFORMAT - int getNodeType() - { - return m_NodeType; - } - - protected void setNodeType(int theType) // @C1A - { // @C1A - m_NodeType = theType; // @C1A - switch (m_NodeType) // @C1A - { // @C1A - case PcmlNodeType.DOCUMENT: // @C1A - m_TagName = "pcml"; // @C1A - break; // @C1A - case PcmlNodeType.RFML: // @D0A - m_TagName = "rfml"; // @D0A - break; // @D0A - case PcmlNodeType.PROGRAM: // @C1A - m_TagName = "program"; // @C1A - break; // @C1A - case PcmlNodeType.RECORDFORMAT: // @D0A - m_TagName = "recordformat"; // @D0A - break; // @D0A - case PcmlNodeType.STRUCT: // @C1A - m_TagName = "struct"; // @C1A - break; // @C1A - case PcmlNodeType.DATA: // @C1A - m_TagName = "data"; // @C1A - break; // @C1A - } // @C1A - - } // @C1A - - // Return value of "struct=" attribute. - // If "type" attribute value is not "struct", returns null. - protected String getStructName() - { - return m_Struct; - } - - // Return value of "type=" attribute. - protected String getType() - { - return m_Type; - } - - public int getUsage() - { - if (m_Usage == INHERIT) - { - if (getParent() == null) - { - return INPUTOUTPUT; - } - else - { - return ((PcmlDocNode) getParent()).getUsage(); - } - } - return m_Usage; - } - - // Resolve a relative name and return its qualified name - String resolveRelativeName(String relativeName) - { - PcmlDocNode relativeNode = resolveRelativeNode(relativeName); - if (relativeNode != null) - return relativeNode.getQualifiedName(); - else - return null; - } - - // Resolve a relative name and return the resolved node - PcmlDocNode resolveRelativeNode(String relativeName) - { - PcmlDocNode p = (PcmlDocNode) this.getParent(); - PcmlDocRoot root = getRootNode(); - PcmlDocNode relativeNode = null; - String currentName; - - if (relativeName == null) - return null; - - while ( p != null ) - { - currentName = p.getQualifiedName(); - if (currentName.equals("")) - { - currentName = relativeName; - } - else - { - currentName = currentName + "." + relativeName; - } - relativeNode = (PcmlDocNode) root.getElement(currentName); - if (relativeNode != null) - { - return relativeNode; - } - p = (PcmlDocNode) p.getParent(); - } - return null; - } - - // Returns an Enumeration containing the children of this element - public String toString() - { - String myName = getQualifiedName(); - if (myName.equals("")) - { - return super.toString(); - } - else - return super.toString() + ":" + myName; // @C2C - } - - // Returns a string containing the tag name for this node - String getTagName() - { - return m_TagName; - } - - // Returns a string containing the tag name for this node - String getBracketedTagName() - { - return "<" + m_TagName + ">"; - } - - // Returns a list of the names of all attributes for this node. // @D0A - abstract String[] getAttributeList(); - - // Returns a string containing the value of the specified attribute. - // Note: This method must not be called on a deserialized object, - // since m_XmlAttrs is transient and will be null. - protected String getAttributeValue(String attributeName) - { - return m_XmlAttrs.getAttributeValue(attributeName); // @C1C - } - - - private void setUsage(String usage) - { - if (usage == null || usage.equals("")) // @B1C - m_Usage = INHERIT; - else - if (usage.equals("inherit")) - m_Usage = INHERIT; - else - if (usage.equals("input")) - m_Usage = INPUT; - else - if (usage.equals("output")) - m_Usage = OUTPUT; - else - if (usage.equals("inputoutput")) - m_Usage = INPUTOUTPUT; - else - m_Usage = UNSUPPORTED; - } - - protected void checkAttributes() - { - // Verify the syntax of the name= attribute - // The name cannot begin with '%' (percent) or '[' (left brace) and - // cannot contain '.' (period) or ' ' (blank). - if (m_Name != null) - { - if (m_Name.indexOf('%') == 0 - || m_Name.indexOf('/') == 0 - || m_Name.indexOf('\\') == 0 - || m_Name.indexOf(':') == 0 - || m_Name.indexOf('[') == 0 - || m_Name.indexOf('.') > -1 - || m_Name.indexOf(' ') > -1 ) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_SYNTAX, new Object[] {makeQuotedAttr("name", m_Name), getBracketedTagName(), getNameForException()} ); - } - } - - if (m_Usage == UNSUPPORTED) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_SYNTAX, new Object[] {makeQuotedAttr("usage", getAttributeValue("usage")), getBracketedTagName(), getNameForException()} ); - } - - if (m_NodeType == PcmlNodeType.UNSUPPORTED) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_TAG, new Object[] {getBracketedTagName(), getNameForException()} ); - } - } - - protected static String makeQuotedAttr(String attrName, String attrValue) - { - return attrName + "=\"" + attrValue + "\""; - } - - protected static String makeQuotedAttr(String attrName, int attrValue) - { - return makeQuotedAttr(attrName, Integer.toString(attrValue)); - } - - // ****************************** - // @E0A -- New methods for XPCML * - // ****************************** - void setCondensedName(String condensedName) - { - m_CondensedName = condensedName; - } - - String getCondensedName() - { - return m_CondensedName; - } - - void setIsExtendedType(boolean extendedType) - { - m_IsExtendedType = extendedType; - } - - boolean getIsExtendedType() - { - return m_IsExtendedType; - } - - protected void setCountReps(int reps) - { - m_CountReps = reps; - } - - protected int getCountReps() - { - return m_CountReps; - } -} diff --git a/cvsroot/src/com/ibm/as400/data/PcmlDocRoot.java b/cvsroot/src/com/ibm/as400/data/PcmlDocRoot.java deleted file mode 100644 index 22993d86c..000000000 --- a/cvsroot/src/com/ibm/as400/data/PcmlDocRoot.java +++ /dev/null @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PcmlDocRoot.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import java.util.Hashtable; - -// This class implements the root node for the PcmlDocument - -abstract class PcmlDocRoot extends PcmlDocNode { - // Serial verion unique identifier - static final long serialVersionUID = 8045487976295209373L; // @C2A - - private Hashtable m_hash; - - PcmlDocRoot() - { - m_hash = new Hashtable(); - } - - public Object clone() // @C1A - { // @C1A - PcmlDocRoot node = null; // @C1A - node = (PcmlDocRoot) super.clone(); // @C1A - node.m_hash = new Hashtable(); // @C1A - - return node; // @C1A - } // @C1A - - public void addElement(PcmlNode elem) - { - m_hash.put(elem.getQualifiedName(), elem); - } - - public boolean containsElement(String qName) - { - return m_hash.containsKey(qName); - } - - public PcmlNode getElement(String qName) - { - return (PcmlNode) m_hash.get(qName); - } -} diff --git a/cvsroot/src/com/ibm/as400/data/PcmlDocument.java b/cvsroot/src/com/ibm/as400/data/PcmlDocument.java deleted file mode 100644 index 399e0c661..000000000 --- a/cvsroot/src/com/ibm/as400/data/PcmlDocument.java +++ /dev/null @@ -1,2839 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PcmlDocument.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400DataType; -import com.ibm.as400.access.AS400Text; -import com.ibm.as400.access.AS400Bin2; -import com.ibm.as400.access.AS400UnsignedBin2; -import com.ibm.as400.access.AS400Bin4; -import com.ibm.as400.access.AS400UnsignedBin4; -import com.ibm.as400.access.AS400Bin8; // @C4A -import com.ibm.as400.access.AS400UnsignedBin8; -import com.ibm.as400.access.AS400PackedDecimal; -import com.ibm.as400.access.AS400ZonedDecimal; -import com.ibm.as400.access.AS400Float4; -import com.ibm.as400.access.AS400Float8; -import com.ibm.as400.access.AS400ByteArray; -import com.ibm.as400.access.AS400Date; -import com.ibm.as400.access.AS400Time; -import com.ibm.as400.access.AS400Timestamp; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.ObjectDoesNotExistException; -import com.ibm.as400.access.ErrorCompletingRequestException; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.ProgramCall; - - -import java.io.InputStream; -import java.io.IOException; -import java.io.ObjectInputStream; // @C1A -import java.io.SequenceInputStream; - -import java.io.PrintWriter; //@E1A -import java.io.OutputStream; //@E1A -import com.ibm.as400.access.Trace; //@E1A - -import java.net.UnknownHostException; - -import java.sql.Date; -import java.sql.Time; -import java.sql.Timestamp; - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.MissingResourceException; -import java.util.Stack; -import java.util.Vector; - -import com.ibm.as400.access.BinaryConverter; -//import sun.misc.BASE64Encoder; //@E1A -//import sun.misc.BASE64Decoder; //@E1A - -/** -*/ -class PcmlDocument extends PcmlDocRoot -{ - // Used for XPCML testing - boolean compareSucceeded=true; - - - static final long serialVersionUID = -8169008879805188674L; - - // New attributes should be added to the end of this array - private static final String PCMLATTRIBUTES[] = { - "version" - }; - - private static final int VERSION_1_ATTRIBUTE_COUNT = 1; - - private static final String DEFAULT_DATE_SEPARATOR = "hyphen"; // default separator for 'date' - private static final String DEFAULT_TIME_SEPARATOR = "period"; // default separator for 'time' - - private String m_docName; - private String m_XsdName; //@E1A - - - // The following attributes added for PCML v2.0 - private String m_Version; // version=, string literal @B1A - - private static AS400Bin2 m_Bin2 = new AS400Bin2(); - private static AS400UnsignedBin2 m_UBin2 = new AS400UnsignedBin2(); - private static AS400Bin4 m_Bin4 = new AS400Bin4(); - private static AS400UnsignedBin4 m_UBin4 = new AS400UnsignedBin4(); - private static AS400Bin8 m_Bin8 = new AS400Bin8(); // @C4A - private static AS400UnsignedBin8 m_UBin8 = new AS400UnsignedBin8(); - private static AS400Float4 m_Float4 = new AS400Float4(); - private static AS400Float8 m_Float8 = new AS400Float8(); - private static AS400PackedDecimal m_Packed_15_5 = new AS400PackedDecimal(15, 5); - private static AS400ZonedDecimal m_Zoned_15_5 = new AS400ZonedDecimal(15, 5); - private static AS400Date m_Date = new AS400Date(); - private static AS400Time m_Time = new AS400Time(); - private static AS400Timestamp m_Timestamp = new AS400Timestamp(); - - private long correlationID_ = 0; // @C8A - - // Transient data not stored durial serialization - // These are a cache of the most common converters. - // NOTE: For AS400Text converters, the cached objects are 'thrown away' - // when the IBM i system object changes via setAs400(). This will cause - // the new system (and CCSID) to be used to construct new converters. - protected transient AS400Text m_Text_1 = null; // Create at run time - protected transient AS400Text m_Text_10 = null; // Create at run time - protected transient AS400ByteArray m_Byte_1 = null; // Create at run time - protected transient AS400ByteArray m_Byte_2 = null; // Create at run time - protected transient AS400ByteArray m_Byte_3 = null; // Create at run time - protected transient AS400ByteArray m_Byte_4 = null; // Create at run time - // @D0C: Made the above converters protected. - - private AS400 m_as400; // @C1C - private int m_as400Vrm = -1; // @C1C - - private transient PcmlSpecificationException m_PcmlSpecificationException; - private transient boolean m_bSerializingWithData = false; // @C1A - private transient long m_DeserializationTs = 0; // @C1A - private transient PcmlProgram m_pcmlProgram; - private transient Object correlationIDLock_ = new Object(); - - - // @E1A -- String constant for use in XPCML - private static final String XMLNS_STRING = " xmlns:xsi=" + "\"" + "http://www.w3.org/2001/XMLSchema-instance" + "\"" + - "\n" + " xsi:noNamespaceSchemaLocation="; - - /** - */ - PcmlDocument(PcmlAttributeList attrs, String docName) // @C3A - { - super(); // @C5A - m_PcmlSpecificationException = null; - - setNodeType(PcmlNodeType.DOCUMENT); // @C3A - m_XmlAttrs = attrs; // @C3A - m_docName = docName; - m_XsdName=""; //@E1A - - // Set the pcml version number - m_Version = getAttributeValue("version"); - } - - // All pcml document nodes support clone. - // This is a deep clone in that the result is to - // clone an entire subtree. This method recursively - // clones its children. - public Object clone() // @C5A - { // @C5A - PcmlDocument doc = (PcmlDocument) super.clone(); // @C5A - - // Add the entire cloned tree of objects to the document hash table - doc.addToHashtable(doc); // @C5A - - return doc; // @C5A - } // @C5A - - // Custom deserialization - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException // @C1A - { // @C1A - // Set timestamp for deserialization (load) of the document - // This timestamp is used to set all data and dimension - // timestamps during deserialization because the - // system clock is not necessarily synchronized with the - // clock when the document was serialized (due to transfering - // the serialized document to another system). - // Classes in the document that maintain timestamps will use - // this value as the current timestamp during readObject(). - // Currently, PcmlDataValues and PcmlDataVector use timestamps. - // Note that timestamps are only an issue when serializing "with data". - // The timestamp sensitive classes are not serialized when serializing - // without data. - correlationIDLock_ = new Object(); - m_DeserializationTs = getCorrelationID(); // @C1A @C8C - - // Default deserialization - in.defaultReadObject(); // @C1A - - if (m_as400 == null) // @C1A - m_as400Vrm = -1; // @C1A - - // Perform deserialization post-processing - readObjectPostprocessing(); - } // @C1A - - /** - */ - AS400 getAs400() - { - return m_as400; - } - - /** - */ - long getDeserializationTimestamp() // @C1A - { // @C1A - return m_DeserializationTs; // @C1A - } // @C1A - - /** - * Return the list of valid attributes for the data element. - **/ - String[] getAttributeList() // @C6A - { - return PCMLATTRIBUTES; // @C6A - } - - /** - */ - boolean isSerializingWithData() // @C1A - { // @C1A - return m_bSerializingWithData; // @C1A - } // @C1A - - /** - */ - void setSerializingWithData(boolean b) // @C1A - { // @C1A - m_bSerializingWithData = b; // @C1A - } // @C1A - - /** - */ - int getAs400VRM() throws PcmlException - { - if (m_as400Vrm == -1) - { - // Get the VRM of the host - // Maybe should optimize this by caching initially by callProgram and - // making available to all children - try - { - m_as400Vrm = getAs400().getVRM(); - } - catch (AS400SecurityException e) - { - throw new PcmlException(e); - } - catch (UnknownHostException e) - { - throw new PcmlException(e); - } - catch (IOException e) - { - throw new PcmlException(e); - } - } - - return m_as400Vrm; - } - - /** - */ - String getDocName() - { - return m_docName; - } - - /** - */ - String getVersion() // @B1A - { // @B1A - return m_Version; // @B1A - } // @B1A - - /* - */ - synchronized void setAs400(AS400 sys) - { - m_as400 = sys; - m_as400Vrm = -1; - - // Release any CCSID sensitive data converters - // The CCSID of this system may be different from previous system - m_Text_1 = null; // @C1A - m_Text_10 = null; // @C1A - } - - - /* - Called by PcmlDataValues, PcmlDocument, and RfmlDocument. - */ - protected AS400DataType getConverter(int dataType , int dataLength, int dataPrecision, int ccsid, String dateFormat, String dateSeparator, String timeFormat, String timeSeparator) - throws PcmlException - { - switch (dataType) - { - - case PcmlData.CHAR: - // If the requested CCSID is not the same as - // the system's default host CCSID, always create - // a new converter. I.E. We only cach converters - // with CCSIDs that match the system object. - if (ccsid != m_as400.getCcsid()) // @C2C - { - return new AS400Text(dataLength, ccsid, m_as400); - } - - switch (dataLength) - { - case 1: - if (m_Text_1 == null) - { - m_Text_1 = new AS400Text(dataLength, ccsid, m_as400); - } - return m_Text_1; - case 10: - if (m_Text_10 == null) - { - m_Text_10 = new AS400Text(dataLength, ccsid, m_as400); - } - return m_Text_10; - default: - return new AS400Text(dataLength, ccsid, m_as400); - - } - - case PcmlData.INT: - if (dataLength == 2) - { - if (dataPrecision == 16) - return m_UBin2; - else // must be dataPrecision == 15 - return m_Bin2; - } - else if (dataLength == 4) - { - if (dataPrecision == 32) - return m_UBin4; - else // must be dataPrecision == 31 - return m_Bin4; - } - else // @C4A - { // must be datalength == 8 // @C4A - if (dataPrecision == 64) - return m_UBin8; - else // must be dataPrecision == 63 - return m_Bin8; - } // @C4A - - case PcmlData.PACKED: - if (dataLength == 15 && dataPrecision == 5) - return m_Packed_15_5; - else - return new AS400PackedDecimal(dataLength, dataPrecision); - - case PcmlData.ZONED: - if (dataLength == 15 && dataPrecision == 5) - return m_Zoned_15_5; - else - return new AS400ZonedDecimal(dataLength, dataPrecision); - - case PcmlData.FLOAT: - if (dataLength == 4) - { - return m_Float4; - } - else - { // must be datalength == 8 - return m_Float8; - } - - case PcmlData.BYTE: - switch (dataLength) - { - case 1: - if (m_Byte_1 == null) - { - m_Byte_1 = new AS400ByteArray(dataLength); - } - return m_Byte_1; - case 2: - if (m_Byte_2 == null) - { - m_Byte_2 = new AS400ByteArray(dataLength); - } - return m_Byte_2; - case 3: - if (m_Byte_3 == null) - { - m_Byte_3 = new AS400ByteArray(dataLength); - } - return m_Byte_3; - case 4: - if (m_Byte_4 == null) - { - m_Byte_4 = new AS400ByteArray(dataLength); - } - return m_Byte_4; - default: - return new AS400ByteArray(dataLength); - - } - - case PcmlData.DATE: - if (dateFormat == null || - (dateFormat.equals("ISO") && // default date format - (dateSeparator == null || dateSeparator.equals(DEFAULT_DATE_SEPARATOR)))) - { - return m_Date; - } - else // create a date converter - { - int format = AS400Date.toFormat(dateFormat); - // Note: The format value is validated in PcmlData.checkAttributes(). - if (dateSeparator == null) { - return new AS400Date(format); // assume the default separator - } - else - { // Convert the separator name ('comma', 'hyphen', etc) to a character. - return new AS400Date(format,separatorAsChar(dateSeparator)); - } - } - - case PcmlData.TIME: - if (timeFormat == null || - (timeFormat.equals("ISO") && // default time format - (timeSeparator == null || timeSeparator.equals(DEFAULT_TIME_SEPARATOR)))) - { - return m_Time; - } - else // create a time converter - { - int format = AS400Time.toFormat(timeFormat); - // Note: The format value is validated in PcmlData.checkAttributes(). - if (timeSeparator == null) { - return new AS400Time(format); // assume the default separator - } - else - { // Convert the separator name ('comma', 'hyphen', etc) to a character. - return new AS400Time(format,separatorAsChar(timeSeparator)); - } - } - - case PcmlData.TIMESTAMP: - return m_Timestamp; - - default: - throw new PcmlException(DAMRI.BAD_DATA_TYPE, new Object[] {new Integer(dataType) , "*"} ); - - } // END: switch (getDataType()) - } - - - /** - */ - synchronized boolean callProgram(String name) - throws AS400SecurityException, - ObjectDoesNotExistException, - InterruptedException, - ErrorCompletingRequestException, - IOException, - PcmlException - { - m_pcmlProgram = getProgramNode(name); - return m_pcmlProgram.callProgram(m_as400); - } - - /** - Returns an "errno" value for the named service program element. -

      - The named program element must be defined as service program entrypoint. - The value returned is the "errno" value resulting from the most recent - call to the program. If the program has not been called, zero is returned. - - @return The integer "errno" value for the named service program element. - - @param name The name of the <program> element in the PCML document. - @exception PcmlException - If an error occurs. - */ - synchronized int getErrno(String name) throws PcmlException // @B1A - { // @B1A - return getProgramNode(name).getErrno(); // @B1A - } // @B1A - - /** - Returns an int return value for the named service program element. -

      - The named program element must be defined as service program entrypoint. - The value returned is the integer return value from the most recent - call to the program. If the program has not been called, zero is returned. - - @return The integer return value for the named service program element. - - @param name The name of the <program> element in the PCML document. - @exception PcmlException - If an error occurs. - */ - synchronized int getIntReturnValue(String name) throws PcmlException // @B1A - { // @B1A - return getProgramNode(name).getIntReturnValue(); // @B1A - } // @B1A - - /** - */ - synchronized int getIntValue(String name) throws PcmlException - { - return getIntValue(name, new PcmlDimensions()); - } - - /** - */ - synchronized int getIntValue(String name, PcmlDimensions indices) throws PcmlException - { - Object value; - - value = getValue(name, indices); - if (value instanceof String) - { - return Integer.parseInt((String) value); - } - else if (value instanceof Number) - { - return ((Number) value).intValue(); - } - else - { - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {value.getClass().getName(), name} ); - } - } - - /** - */ - synchronized String getStringValue(String name, int type) throws PcmlException // @C7A - { - return getStringValue(name, new PcmlDimensions(), type); // @C7A - } - - /** - Returns a long value that replaces a timestamp. This value is used by - PcmlDataValues to control data conversion, PcmlDataVector to keep track - of when the data dimension changes, and PcmlDocument for serialization. - */ - long getCorrelationID() // @C8A - { - synchronized (correlationIDLock_) { - return ++correlationID_; // @C8A - } - } - - /** - */ - synchronized String getStringValue(String name, PcmlDimensions indices, int type) - throws PcmlException // @C7A - { - return getDataNode(name).getStringValue(indices, type); // @C7A - } - - /** - */ - synchronized int getOutputsize(String name) throws PcmlException - { - return getOutputsize(name, new PcmlDimensions()); - } - - /** - */ - synchronized int getOutputsize(String name, PcmlDimensions indices) throws PcmlException - { - PcmlNode node = (PcmlDocNode) getElement(name); - - if (node != null && node instanceof PcmlData) - { - return ((PcmlData) node).getOutputsize(indices); - } - else - if (node != null && node instanceof PcmlStruct) - { - return ((PcmlStruct) node).getOutputsize(indices); - } - else - { - return 0; - } - } - - /** - Returns the list of IBM i system messages returned from running the - program. An empty list is returned if the program has not been run yet. - - @return The array of messages returned by the server for the program. - */ - synchronized AS400Message[] getMessageList(String name) throws PcmlException - { - return getProgramNode(name).getMessageList(); - } - - /** - Returns the ProgramCall object that was used in the most recent invocation of {@link #callProgram() callProgram()}. - @return The ProgramCall object; null if callProgram has not been called. - **/ - ProgramCall getProgramCall() - { - return ( m_pcmlProgram == null ? null : m_pcmlProgram.getProgramCall() ); - } - - /** - */ - synchronized Object getValue(String name) throws PcmlException - { - return getValue(name, new PcmlDimensions()); - } - - /** - */ - synchronized Object getValue(String name, PcmlDimensions indices) throws PcmlException - { - return getDataNode(name).getValue(indices); - } - - /** - */ - synchronized boolean isArray(String name) throws PcmlException - { - return getDataNode(name).isArray(); - } - - /** - */ - synchronized boolean isInArray(String name) throws PcmlException - { - return getDataNode(name).isInArray(); - } - - // Set a named data value - /** - */ - synchronized void setValue(String name, Object value) throws PcmlException - { - setValue(name, value, new PcmlDimensions()); - } - - // Set a named data value using dimension indices - /** - */ - synchronized void setValue(String name, Object value, PcmlDimensions indices) throws PcmlException - { - getDataNode(name).setValue(value, indices); - } - - /** - */ - synchronized void setStringValue(String name, String value, int type) throws PcmlException // @C7A - { - setStringValue(name, value, new PcmlDimensions(), type); // @C7A - } - - /** - */ - synchronized void setStringValue(String name, String value, PcmlDimensions indices, int type) - throws PcmlException // @C7A - { - getDataNode(name).setStringValue(value, indices, type); // @C7A - } - - // Overrides the threadsafe= attribute - void setThreadsafeOverride(String program, boolean threadsafe) // @C6A - throws PcmlException - { // @C6A - getProgramNode(program).setThreadsafeOverride(threadsafe); // @C6A - } // @C6A - - // Set the path of the program to be called - void setPath(String program, String path) // @D1A - throws PcmlException - { // @D1A - getProgramNode(program).setPath(path); // @D1A - } // @D1A - - // gets the override of the threadsafe= attribute - boolean getThreadsafeOverride(String program) // @C6A - throws PcmlException - { // @C6A - return getProgramNode(program).getThreadsafeOverride(); // @C6A - } // @C6A - - // Add a subtree to the document's hashtable. - // This is called to complete the document cloneing process. - void addToHashtable(PcmlDocNode newChild) // @C5A - { // @C5A - String qName; // Qualified name of child // @C5A - Enumeration children; // @C5A - PcmlDocNode child; // @C5A - - children = newChild.getChildren(); // @C5A - if (children == null) // @C5A - return; // @C5A - - while ( children.hasMoreElements() ) // @C5A - { // @C5A - child = (PcmlDocNode) children.nextElement(); // @C5A - - qName = child.getQualifiedName(); // @C5A - if ( !qName.equals("") ) // @C5A - { // @C5A - if ( this.containsElement(qName) ) // @C5A - { // @C5A - this.addPcmlSpecificationError(DAMRI.MULTIPLE_DEFINE, new Object[] {qName} ); // @C5A - } // @C5A - this.addElement(child); // @C5A - } // @C5A - - // Recursively add all nodes in the tree to the hash table - addToHashtable(child); // @C5A - } // @C5A - - } // @C5A - - /** - */ - private PcmlProgram getProgramNode(String name) throws PcmlException - { - PcmlNode node; - - node = getElement(name); - if (node instanceof PcmlProgram) - { - return (PcmlProgram) node; - } - else - { - if (node == null) - throw new PcmlException(DAMRI.ELEMENT_NOT_FOUND, new Object[] {name, ""} ); - else - throw new PcmlException(DAMRI.WRONG_ELEMENT_TYPE, new Object[] {name, ""} ); - } - } - - /** - */ - private PcmlData getDataNode(String name) throws PcmlException - { - PcmlNode node; - - node = getElement(name); - if (node instanceof PcmlData) - { - return (PcmlData) node; - } - else - { - if (node == null) - throw new PcmlException(DAMRI.ELEMENT_NOT_FOUND, new Object[] {name, ""} ); - else - throw new PcmlException(DAMRI.WRONG_ELEMENT_TYPE, new Object[] {name, ""} ); - } - } - - // Returns the Pcml specification error (if any). - PcmlSpecificationException getPcmlSpecificationException() - { - return m_PcmlSpecificationException; - } - - // Add a Pcml specification error to the list of errors. - void addPcmlSpecificationError(String key, Object[] args) - { - // If an exception object doesn't exist, create one - if (m_PcmlSpecificationException == null) - { - m_PcmlSpecificationException = new PcmlSpecificationException(SystemResourceFinder.format(DAMRI.FAILED_TO_VALIDATE, new Object[] { m_docName })); - } - - // Now add the message - m_PcmlSpecificationException.addMessage(SystemResourceFinder.format(key, args)); - } - - /** @E1A -- NEW XPCML METHODS -- **/ - - /** - Generates XPCML representing the data contained in this program object. - Throws a runtime exception if this object contains no data. - - @param outStream The output stream to which to write the text. - @exception IOException If an error occurs while writing the data. - @exception XmlException If an error occurs while processing XPCML. - **/ - void generateXPCML(String pgmName,OutputStream outStream) - throws IOException, XmlException - { - PrintWriter xmlFile = new PrintWriter(outStream); - - //@E1A -- New variables for XPCML. These are used to control dimensioning - // of a node. - int num_dim =0; //@E1A - int cur_dim=0; //@E1A - int[] dimArray = {0,0,0,0,0,0,0,0,0,0}; - PcmlDimensions dims = new PcmlDimensions(dimArray); //@E1A - - try - { - - // Start XPCML stream by writing out xpcml tag - // xmlFile.println(""); // @A1c - xmlFile.println(""); - xmlFile.print(""); - } - else - xmlFile.println("'xpcml.xsd' >"); - - -// xmlFile.println(" xmlns:xsi=" + "\"" + "http://www.w3.org/2001/XMLSchema-instance" + "\"" + -// "\n" + " xsi:noNamespaceSchemaLocation='xpcml.xsd'>"); - xmlFile.println(); - - // Check if pgmName is null. If so, generate XPCML for entire PCML node tree. If not, just - // generate XPCML for node tree associated with the given program name. - if (pgmName == null) - generateXPCML(this, this, xmlFile, "",num_dim, cur_dim, dims); - else - { - // Get node for the program requested - generateXPCML(this, getProgramNode(pgmName), xmlFile, "", num_dim, cur_dim, dims); - } - - xmlFile.println(""); - - if (xmlFile.checkError()) // Note: This flushes the stream. - { - Trace.log(Trace.ERROR, "Error when writing PCML to OutputStream."); - } - - } - finally { - xmlFile.close(); // Note: close() flushes the stream first. - } - } - - - /** - Generates XPCML representing the data contained in the specified node. - Throws a runtime exception if this object contains no data. - - @param pcmlDocNode The root node of the tree. - @param node The node to generate PCML for. - @param writer The writer to which to write the text. - @param indent The indentation with which to prepend the generated XML. - @exception IOException If an error occurs while writing the data. - @exception XmlException If an error occurs while processing XPCML. - **/ - private void generateXPCML(PcmlDocument pcmlDocNode, PcmlDocNode node, PrintWriter writer, String indent, int num_dimensions, int current_dimension, PcmlDimensions dimensions) - throws IOException, XmlException - { - int tempInt; - String lastTag=""; - boolean tagDone=false; - - // Define variable to be used to get count values of nodes - PcmlDimensions dim = new PcmlDimensions(); - dim.add(0); - - - // Reset all dimensions if this is a or node - if (node.getNodeType() == PcmlNodeType.PROGRAM || node.getNodeType() == PcmlNodeType.DOCUMENT) - { - for (int i = 0; i < dimensions.size(); ++i) - { - dimensions.set(i,0); - } - current_dimension = 0; - num_dimensions = 0; - } - - // Check if this is the first time this node has been processed. The initial value for CountReps - // is -10. Get the count value for the node to determine how many times the node needs to be processed. - if (node.getCountReps() == -10) - { - int nodeType = node.getNodeType(); - if (nodeType == PcmlNodeType.DATA && ((PcmlData) node).getXPCMLCount(dim) != 0) - { - // If the node is a data node and it has a count set tempInt to the count - tempInt = ( (PcmlData) node).getXPCMLCount(dim); - } - else if (nodeType== PcmlNodeType.STRUCT && ((PcmlStruct) node).getXPCMLCount(dim) != 0) - { - // If the node is a struct node and it has a count set tempInt to the count - tempInt = ( (PcmlStruct) node).getXPCMLCount(dim); - } - else - tempInt = 1; - - node.setCountReps(tempInt); // Set the number of reps for the node. - - // set current dimension - dimensions.set(current_dimension, 0); - } - - // Start the tag. Transform a 0 ) - { - if (dimensions.at(current_dimension)== 0) - { - // Check if this is a user defined element - if (node.getCondensedName() != "") - { - writer.print(indent); - writer.print("<"+ node.getCondensedName()); - lastTag="arrayOfStringParm"; - } - else - { - writer.print(indent); - writer.print(" 0 ) - { - if (dimensions.at(current_dimension)== 0) - { - // Check if this is a user defined element - if (node.getCondensedName() != "") - { - writer.print(indent); - writer.print("<"+ node.getCondensedName()); - lastTag="arrayOfStructParm"; - } - else - { - writer.print(indent); - writer.print(" 0 ) - { - if (dimensions.at(current_dimension)== 0) - { - // Check if this is a user defined element - if (node.getCondensedName() != "") - { - writer.print(indent); - writer.print("<"+ node.getCondensedName()); - lastTag="arrayOfHexBinaryParm"; - } - else - { - writer.print(indent); - writer.print(" 0 ) - // if (node.getAttributeValue("count") != null ) - { - if (dimensions.at(current_dimension)== 0) - { - // Check if this is a user defined element - if (node.getCondensedName() != "") - { - writer.print(indent); - writer.print("<"+ node.getCondensedName()); - lastTag="arrayOfUnsignedIntParm"; - } - else - { - writer.print(indent); - writer.print(" 0 ) - { - if (dimensions.at(current_dimension)== 0) - { - // Check if this is a user defined element - if (node.getCondensedName() != "") - { - writer.print(indent); - writer.print("<"+ node.getCondensedName()); - lastTag="arrayOfIntParm"; - } - else - { - writer.print(indent); - writer.print(" 0 ) - { - if (dimensions.at(current_dimension)== 0) - { - // Check if this is a user defined element - if (node.getCondensedName() != "") - { - writer.print(indent); - writer.print("<"+ node.getCondensedName()); - lastTag="arrayOfUnsignedShortParm"; - } - else - { - writer.print(indent); - writer.print(" 0 ) - { - if (dimensions.at(current_dimension)== 0) - { - // Check if this is a user defined element - if (node.getCondensedName() != "") - { - writer.print(indent); - writer.print("<"+ node.getCondensedName()); - lastTag="arrayOfShortParm"; - } - else - { - writer.print(indent); - writer.print(" 0 ) - // if (node.getAttributeValue("count") != null ) - { - if (dimensions.at(current_dimension)== 0) - { - // Check if this is a user defined element - if (node.getCondensedName() != "") - { - writer.print(indent); - writer.print("<"+ node.getCondensedName()); - lastTag="arrayOfUnsignedLongParm"; - } - else - { - writer.print(indent); - writer.print(" 0 ) - { - if (dimensions.at(current_dimension)== 0) - { - // Check if this is a user defined element - if (node.getCondensedName() != "") - { - writer.print(indent); - writer.print("<"+ node.getCondensedName()); - lastTag="arrayOfLongParm"; - } - else - { - writer.print(indent); - writer.print(" 0 ) - { - if (dimensions.at(current_dimension)== 0) - { - // Check if this is a user defined element - if (node.getCondensedName() != "") - { - writer.print(indent); - writer.print("<"+ node.getCondensedName()); - lastTag="arrayOfFloatParm"; - } - else - { - writer.print(indent); - writer.print(" 0 ) - { - if (dimensions.at(current_dimension)== 0) - { - // Check if this is a user defined element - if (node.getCondensedName() != "") - { - writer.print(indent); - writer.print("<"+ node.getCondensedName()); - lastTag="arrayOfDoubleParm"; - } - else - { - writer.print(indent); - writer.print(" 0 ) - { - if (dimensions.at(current_dimension)== 0) - { - // Check if this is a user defined element - if (node.getCondensedName() != "") - { - writer.print(indent); - writer.print("<"+ node.getCondensedName()); - lastTag="arrayOfZonedDecimalParm"; - } - else - { - writer.print(indent); - writer.print(" 0 ) - { - if (dimensions.at(current_dimension)== 0) - { - // Check if this is a user defined element - if (node.getCondensedName() != "") - { - writer.print(indent); - writer.print("<"+ node.getCondensedName()); - lastTag="arrayOfPackedDecimalParm"; - } - else - { - writer.print(indent); - writer.print(" 0 ) - { - if (dimensions.at(current_dimension)== 0) - { - // Check if this is a user defined element - if (node.getCondensedName() != "") - { - writer.print(indent); - writer.print("<"+ node.getCondensedName()); - lastTag="arrayOfDateParm"; - } - else - { - writer.print(indent); - writer.print(" 0 ) - { - if (dimensions.at(current_dimension)== 0) - { - // Check if this is a user defined element - if (node.getCondensedName() != "") - { - writer.print(indent); - writer.print("<"+ node.getCondensedName()); - lastTag="arrayOfTimeParm"; - } - else - { - writer.print(indent); - writer.print(" 0 ) - { - if (dimensions.at(current_dimension)== 0) - { - // Check if this is a user defined element - if (node.getCondensedName() != "") - { - writer.print(indent); - writer.print("<"+ node.getCondensedName()); - lastTag="arrayOfTimestampParm"; - } - else - { - writer.print(indent); - writer.print(" 0 ) - { - if (dimensions.at(current_dimension)== 0) - { - // Check if this is a user defined element - if (node.getCondensedName() != "") - { - writer.print(indent); - writer.print("<"+ node.getCondensedName()); - lastTag="arrayOfStruct"; - } - else - { - writer.print(indent); - writer.print(" 0) - { - // Don't output attributes working on an array element entry - } - else if (node.getNodeType() == PcmlNodeType.STRUCT && dimensions.at(current_dimension) > 0) - { - } - else - { - for (int i=0; i"); - } - - // Add struct_i tag for struct arrays - - if (node.getNodeType() == PcmlNodeType.DATA && ((PcmlData)node).getDataType()==PcmlData.STRUCT && ((PcmlData) node).getXPCMLCount(dim) > 0 ) - { - if (dimensions.at(current_dimension) > 0) - { - writer.println(indent+ " "); - } - else - { - writer.println(indent+ " " ); - } - lastTag="struct_i"; - } - - if (node.getNodeType() == PcmlNodeType.STRUCT && ((PcmlStruct) node).getXPCMLCount(dim) > 0 ) - { - if (dimensions.at(current_dimension) > 0) - { - writer.println(indent+ " "); - } - else - { - writer.println(indent+ " " ); - } - lastTag="struct_i"; - } - - - // if node = "program" write out "paramterList" tag - if ( node.getNodeType() == PcmlNodeType.PROGRAM) - { - writer.println(indent + ""); - } - - Enumeration children = node.getChildren(); - - // Process the children of the current node - while (children.hasMoreElements()) - { - PcmlDocNode child = (PcmlDocNode) children.nextElement(); - - // Reset all dimensions if this is tag - if (child.getNodeType() == PcmlNodeType.PROGRAM) - { - for (int i = 0; i < dimensions.size(); ++i) - { - dimensions.set(i, 0); - } - current_dimension = 0; - num_dimensions = 0; - } - - // Reset all dimensions if this is a tag without a parent - if (child.getNodeType() == PcmlNodeType.STRUCT && child.getParent().getName().trim().length()==0 ) - { - for (int i = 0; i < dimensions.size(); ++i) - { - dimensions.set(i, 0); - } - current_dimension = 0; - num_dimensions = 0; - } - - // Increase dimensions by 1 if this is the first child, i.e., we've gone down the tree - if (child.getChildNbr()==0 && - ( (node.getNodeType() == PcmlNodeType.DATA && ((PcmlData) node).getXPCMLCount(dim) > 0 ) || - (node.getNodeType() == PcmlNodeType.STRUCT && ((PcmlStruct) node).getXPCMLCount(dim) > 0 ) ) ) - { - num_dimensions++; - current_dimension++; - if (num_dimensions > 9) - dimensions.add(0); - } - - // Call generateXPCML to generate XPCML for the child - generateXPCML(pcmlDocNode,child, writer, indent+" ", num_dimensions, current_dimension, dimensions); - } // end while more children - - - // Write the end tag. - // If node = "program" write out "paramterList" tag - if ( node.getNodeType() == PcmlNodeType.PROGRAM) - writer.println(indent + ""); - if ( node.getNodeType() == PcmlNodeType.DATA) - { - int dataType = ((PcmlData) node).getDataType(); - writer.print(indent); - switch( dataType ) { - case PcmlData.CHAR: - if ( ((PcmlData) node).getXPCMLCount(dim) <= 0 ) - { - if (node.getCondensedName() != "") - writer.print(""); - else - writer.print(""); - } - else - { - // Processing multiples of the node. Should end with "); - if (node.getCountReps() == 0) - { - if (node.getCondensedName() != "") - writer.print(""); - else - { - // All done with elements. Add end array tag - writer.println( ""); - } - } - } - break; - case PcmlData.STRUCT: - if ( ((PcmlData) node).getXPCMLCount(dim) <= 0 ) - { - if (node.getCondensedName() != "") - writer.print(""); - else - writer.println(""); - } - else - { - // Processing multiples of the node. Should end with "); - if (node.getCountReps() == 0) - { - if (node.getCondensedName() != "") - writer.print(indent+""); - else - { - // All done with elements. Add end array tag - writer.println(indent+""); - } - } - } - break; - case PcmlData.BYTE: - if ( ((PcmlData) node).getXPCMLCount(dim) <= 0 ) - { - if (node.getCondensedName() != "") - writer.print(""); - else - writer.print(""); - } - else - { - // Processing multiples of the node. Should end with "); - if (node.getCountReps() == 0) - { - if (node.getCondensedName() != "") - writer.print(""); - else - { - // All done with elements. Add end array tag - writer.println( ""); - } - } - } - break; - case PcmlData.INT: - if (node.getAttributeValue("length").equals("4") && node.getAttributeValue("precision") != null && node.getAttributeValue("precision").equals("32") ) - { - if ( ((PcmlData) node).getXPCMLCount(dim) <= 0 ) - { - if (node.getCondensedName() != "") - writer.print(""); - else - writer.print(""); - } - else - { - // Processing multiples of the node. Should end with "); - if (node.getCountReps() == 0) - { - if (node.getCondensedName() != "") - writer.print(""); - else - { - // All done with elements. Add end array tag - writer.println( ""); - } - } - } - } - else if (node.getAttributeValue("length").equals("4")) - { - if ( ((PcmlData) node).getXPCMLCount(dim) <= 0 ) - { - if (node.getCondensedName() != "") - writer.print(""); - else - writer.print(""); - } - else - { - // Processing multiples of the node. Should end with "); - if (node.getCountReps() == 0) - { - if (node.getCondensedName() != "") - writer.print(""); - else - { - // All done with elements. Add end array tag - writer.println( ""); - } - } - } - } - else if (node.getAttributeValue("length").equals("2") && node.getAttributeValue("precision") != null && node.getAttributeValue("precision").equals("16")) - { - if ( ((PcmlData) node).getXPCMLCount(dim) <= 0 ) - { - if (node.getCondensedName() != "") - writer.print(""); - else - writer.print(""); - } - else - { - // Processing multiples of the node. Should end with "); - if (node.getCountReps() == 0) - { - if (node.getCondensedName() != "") - writer.print(""); - else - { - // All done with elements. Add end array tag - writer.println( ""); - } - } - } - } - else if (node.getAttributeValue("length").equals("2")) - { - if ( ((PcmlData) node).getXPCMLCount(dim) <= 0 ) - { - if (node.getCondensedName() != "") - writer.print(""); - else - writer.print(""); - } - else - { - // Processing multiples of the node. Should end with "); - if (node.getCountReps() == 0) - { - if (node.getCondensedName() != "") - writer.print(""); - else - { - // All done with elements. Add end array tag - writer.println( ""); - } - } - } - } - else if (node.getAttributeValue("length").equals("8")) - { - if ( ((PcmlData) node).getXPCMLCount(dim) <= 0 ) - { - if (node.getCondensedName() != "") - writer.print(""); - else - writer.print(""); - } - else - { - // Processing multiples of the node. Should end with "); - if (node.getCountReps() == 0) - { - if (node.getCondensedName() != "") - writer.print(""); - else - { - // All done with elements. Add end array tag - writer.println( ""); - } - } - } - } - break; - case PcmlData.FLOAT: - if (node.getAttributeValue("length").equals("4")) - { - if ( ((PcmlData) node).getXPCMLCount(dim) <= 0 ) - { - if (node.getCondensedName() != "") - writer.print(""); - else - writer.print(""); - } - else - { - // Processing multiples of the node. Should end with "); - if (node.getCountReps() == 0) - { - if (node.getCondensedName() != "") - writer.print(""); - else - { - // All done with elements. Add end array tag - writer.println( ""); - } - } - } - } - else if (node.getAttributeValue("length").equals("8")) - { - if ( ((PcmlData) node).getXPCMLCount(dim) <= 0 ) - { - if (node.getCondensedName() != "") - writer.print(""); - else - writer.print(""); - } - else - { - // Processing multiples of the node. Should end with "); - if (node.getCountReps() == 0) - { - if (node.getCondensedName() != "") - writer.print(""); - else - { - // All done with elements. Add end array tag - writer.println( ""); - } - } - } - } - break; - case PcmlData.ZONED: - if ( ((PcmlData) node).getXPCMLCount(dim) <= 0 ) - { - if (node.getCondensedName() != "") - writer.print(""); - else - writer.print(""); - } - else - { - // Processing multiples of the node. Should end with "); - if (node.getCountReps() == 0) - { - if (node.getCondensedName() != "") - writer.print(""); - else - { - // All done with elements. Add end array tag - writer.println( ""); - } - } - } - break; - case PcmlData.PACKED: - if ( ((PcmlData) node).getXPCMLCount(dim) <= 0 ) - { - if (node.getCondensedName() != "") - writer.print(""); - else - writer.print(""); - } - else - { - // Processing multiples of the node. Should end with "); - if (node.getCountReps() == 0) - { - if (node.getCondensedName() != "") - writer.print(""); - else - { - // All done with elements. Add end array tag - writer.println( ""); - } - } - } - break; - case PcmlData.DATE: - if ( ((PcmlData) node).getXPCMLCount(dim) <= 0 ) - { - if (node.getCondensedName() != "") - writer.print(""); - else - writer.print(""); - } - else - { - // Processing multiples of the node. Should end with "); - if (node.getCountReps() == 0) - { - if (node.getCondensedName() != "") - writer.print(""); - else - { - // All done with elements. Add end array tag - writer.println( ""); - } - } - } - break; - case PcmlData.TIME: - if ( ((PcmlData) node).getXPCMLCount(dim) <= 0 ) - { - if (node.getCondensedName() != "") - writer.print(""); - else - writer.print(""); - } - else - { - // Processing multiples of the node. Should end with "); - if (node.getCountReps() == 0) - { - if (node.getCondensedName() != "") - writer.print(""); - else - { - // All done with elements. Add end array tag - writer.println( ""); - } - } - } - break; - case PcmlData.TIMESTAMP: - if ( ((PcmlData) node).getXPCMLCount(dim) <= 0 ) - { - if (node.getCondensedName() != "") - writer.print(""); - else - writer.print(""); - } - else - { - // Processing multiples of the node. Should end with "); - if (node.getCountReps() == 0) - { - if (node.getCondensedName() != "") - writer.print(""); - else - { - // All done with elements. Add end array tag - writer.println( ""); - } - } - } - break; - default: - throw new PcmlException(DAMRI.BAD_DATA_TYPE, new Object[] {new Integer(dataType) , "*"} ); - } // switch(dataType) - } // PcmlNodeType.DATA - else if (node.getNodeType() == PcmlNodeType.STRUCT) - { - writer.print(indent); - if ( ((PcmlStruct) node).getXPCMLCount(dim) <= 0 ) - { - if (node.getCondensedName() != "") - writer.print(""); - else - writer.println(""); - } - else - { - // Processing multiples of the node. Should end with "); - if (node.getCountReps() == 0) - { - if (node.getCondensedName() != "") - writer.print(indent+""); - else - { - // All done with elements. Add end array tag - writer.println(indent+ ""); - } - } - } - } - else if (node.getNodeType() == PcmlNodeType.DOCUMENT) - { - } - else - writer.println(indent + ""); - - if ( node.getNodeType() == PcmlNodeType.PROGRAM) - writer.println(); - - // Reduce current and number of dimensions by 1 since their are no - // more children on this node (stepping back up the tree a level) - - if ((node.getNodeType() == PcmlNodeType.DATA && ((PcmlData) node).getXPCMLCount(dim) > 0 ) || - (node.getNodeType() == PcmlNodeType.STRUCT && ((PcmlStruct) node).getXPCMLCount(dim) > 0 )) - { - current_dimension--; - num_dimensions--; - } - - if (node.getCountReps() > 0) - { - // This node has a count greater than 0 so we need to process it again... - // Calculate index - Integer countVal= new Integer(0); - if (node.getNodeType() == PcmlNodeType.DATA && ((PcmlData) node).getXPCMLCount(dim) != 0) - countVal = new Integer( ((PcmlData )node).getXPCMLCount(dim)); - if (node.getNodeType() == PcmlNodeType.STRUCT && ((PcmlStruct) node).getXPCMLCount(dim) != 0) - countVal = new Integer( ((PcmlStruct )node).getXPCMLCount(dim)); - if (node.getNodeType() != PcmlNodeType.DATA && node.getNodeType() != PcmlNodeType.STRUCT) - countVal = new Integer(0); - - dimensions.set(current_dimension, countVal.intValue() - node.getCountReps()); - - // Reprocess the node because count is > 0 so we need to print it out at least one more time - generateXPCML(pcmlDocNode, node, writer, indent, num_dimensions, current_dimension, dimensions); - } - else - { - // We're done with this node so reset its count to -10 - node.setCountReps(-10); - } - } - else // node has no children - { - - // Write out value of node as string value - if (node.getNodeType() == PcmlNodeType.DATA && !node.getAttributeValue("type").equals("struct")) - { - // Get the value of the data node and print out as a string - String strVal=""; - String tempVal=""; - Object objVal; - - int[] indices = new int[1]; - indices[0] = node.getCountReps(); - - if (node.getQualifiedName().trim().equals("")) - { - // Can't set values of unnamed nodes - strVal=""; - } - else - { - try { - if (node.getAttributeValue("type").equals("byte")) - { - int length = ((PcmlData)node).getLength(dimensions); - byte[] byteVal = new byte[length]; - byteVal = (byte[]) pcmlDocNode.getValue(node.getQualifiedName(), dimensions); - if (byteVal != null) - { - // Now hexBinary encode the bytes - strVal = BinaryConverter.bytesToString(byteVal); - } - } - else { - strVal =""; - objVal = pcmlDocNode.getValue(node.getQualifiedName(), dimensions); - if (objVal != null) - { - if (objVal instanceof java.sql.Date) { - strVal = AS400Date.toXsdString(objVal); - } - else if (objVal instanceof java.sql.Time) { - strVal = AS400Time.toXsdString(objVal); - } - else if (objVal instanceof java.sql.Timestamp) { - strVal = AS400Timestamp.toXsdString(objVal); - } - else { - strVal = objVal.toString(); - } - } - } - } - catch (PcmlException e) - { - Trace.log(Trace.PCML, "No value for node: " + node.getQualifiedName() ); - } - catch (java.lang.IllegalArgumentException e) - { - Trace.log(Trace.PCML, "Bad count value for node: " + node.getQualifiedName() ); - } - } - // Check if CountReps > 0. If so, then dealing with an array - if ( ((PcmlData) node).getXPCMLCount(dim) > 0 ) - { - // Outputting an array element. Check which type first - if (lastTag.equals("arrayOfStringParm") || lastTag.equals("arrayOfIntParm") || - lastTag.equals("arrayOfLongParm") || - lastTag.equals("arrayOfUnsignedLongParm") || lastTag.equals("arrayOfUnsignedIntParm") || - lastTag.equals("arrayOfShortParm") || lastTag.equals("arrayOfUnsignedShortParm") || - lastTag.equals("arrayOfFloatParm") || lastTag.equals("arrayOfDoubleParm") || - lastTag.equals("arrayOfZonedDecimalParm") || lastTag.equals("arrayOfPackedDecimalParm") || - lastTag.equals("arrayOfHexBinaryParm") || - lastTag.equals("arrayOfDateParm") || lastTag.equals("arrayOfTimeParm") || lastTag.equals("arrayOfTimestampParm") - ) - writer.println(">"); - if (dimensions.at(current_dimension) > 0) - { - writer.print(indent + " " + strVal); - } - else - { - writer.print(indent + " " + strVal); - } - } else - writer.print(">" + strVal); - - // Check if CountReps > 0. If so, then dealing with an array - if ( ((PcmlData) node).getXPCMLCount(dim) > 0 ) - { - // Outputting an array element. - writer.println(""); - tagDone = true; - } - else - { - writer.println(""); - tagDone = true; - } - } - // Finish the start tag. - if (!tagDone) - writer.println("/>"); - - if (node.getCountReps() > 0) // Only called when data has a count > 0 - { - // Calculate index - int countVal; - if (node.getNodeType() == PcmlNodeType.DATA && ((PcmlData) node).getXPCMLCount(dim) != 0) - countVal = ((PcmlData )node).getXPCMLCount(dim); - else if (node.getNodeType() == PcmlNodeType.STRUCT && ((PcmlStruct) node).getXPCMLCount(dim) != 0) - countVal = ((PcmlStruct)node).getXPCMLCount(dim); - else - countVal = 0; - int countV=countVal-node.getCountReps(); - dimensions.set(current_dimension, countVal - node.getCountReps()); - generateXPCML(pcmlDocNode,node, writer, indent, num_dimensions, current_dimension, dimensions); - } - else - { - // Check if CountReps > 0. If so, then dealing with an array - if ( ((PcmlData) node).getXPCMLCount(dim) > 0 ) - { - // Outputting an array element. Check which type first - int dataType = ((PcmlData) node).getDataType(); - writer.print(indent); - switch( dataType ) { - case PcmlData.CHAR: - if (node.getCondensedName() != "") - writer.println(""); - else - writer.println(""); - break; - case PcmlData.INT: - if (node.getAttributeValue("length").equals("4") && node.getAttributeValue("precision") != null && node.getAttributeValue("precision").equals("32") ) - { - if (node.getCondensedName() != "") - writer.println(""); - else - writer.println(""); - } - else if (node.getAttributeValue("length").equals("4") ) - { - if (node.getCondensedName() != "") - writer.println(""); - else - writer.println(""); - } - else if (node.getAttributeValue("length").equals("2") && node.getAttributeValue("precision") != null && node.getAttributeValue("precision").equals("16") ) - { - if (node.getCondensedName() != "") - writer.println(""); - else - writer.println(""); - } - else if (node.getAttributeValue("length").equals("2") ) - { - if (node.getCondensedName() != "") - writer.println(""); - else - writer.println(""); - } - else if (node.getAttributeValue("length").equals("8") ) - { - if (node.getCondensedName() != "") - writer.println(""); - else - writer.println(""); - } - break; - case PcmlData.FLOAT: - if (node.getAttributeValue("length").equals("8") ) - { - if (node.getCondensedName() != "") - writer.println(""); - else - writer.println(""); - } - else if (node.getAttributeValue("length").equals("4") ) - { - if (node.getCondensedName() != "") - writer.println(""); - else - writer.println(""); - } - break; - case PcmlData.ZONED: - if (node.getCondensedName() != "") - writer.println(""); - else - writer.println(""); - break; - case PcmlData.PACKED: - if (node.getCondensedName() != "") - writer.println(""); - else - writer.println(""); - break; - case PcmlData.BYTE: - if (node.getCondensedName() != "") - writer.println(""); - else - writer.println(""); - break; - case PcmlData.DATE: - if (node.getCondensedName() != "") - writer.println(""); - else - writer.println(""); - break; - case PcmlData.TIME: - if (node.getCondensedName() != "") - writer.println(""); - else - writer.println(""); - break; - case PcmlData.TIMESTAMP: - if (node.getCondensedName() != "") - writer.println(""); - else - writer.println(""); - break; - default: break; - } - } - node.setCountReps(-10); - } - } // end else if string value - writer.flush(); - } // end generateXPCML - - - // ****************************** - // @E0 -- New methods for XPCML * - // ****************************** - void setXsdName(String xsdName) - { - m_XsdName = xsdName; - } - - String getXsdName() - { - return m_XsdName; - } - - - // ****************************** - // @E0 -- New method for XPCML * - // ****************************** - void copyValues(PcmlDocNode root, PcmlDocNode node) throws IOException, XmlException - { - //@E1A -- New variables for XPCML. These are used to control dimensioning - // of a node. - int num_dim =0; //@E1A - int cur_dim=0; //@E1A - int[] dims = {0,0,0,0,0,0,0,0,0,0}; - PcmlDimensions dimensions = new PcmlDimensions(dims); - String[] struct = new String[30]; - String[] structR = new String[30]; - int count=0; - - copyValues(root, node, num_dim, cur_dim, dimensions ,struct, structR, count); - - } - - void copyValues(PcmlDocNode root, PcmlDocNode node, int num_dimensions, int current_dimension, PcmlDimensions dimensions,String[] struct, String[] structR, int count) - throws IOException, XmlException - { - int tempInt; - - - // Define variable to be used to get count values of nodes - PcmlDimensions dim = new PcmlDimensions(); - dim.add(0); - - if (count < 0 ) - count=0; - - // Reset all dimensions if this is a or node - if (node.getNodeType() == PcmlNodeType.PROGRAM || node.getNodeType() == PcmlNodeType.DOCUMENT) - { - for (int i = 0; i < dimensions.size(); ++i) - { - dimensions.set(i,0); - } - current_dimension = 0; - num_dimensions = 0; - for (int i=0; i< 10 ; ++i) - { - struct[i] = ""; - structR[i] = ""; - } - count=0; - } - - // Check if this is the first time this node has been processed. The initial value for CountReps - // is -10. Get the count value for the node to determine how many times the node needs to be processed. - if (node.getNodeType() == PcmlNodeType.DATA && node.getAttributeValue("type").equals("struct")) - { - PcmlDocNode parent = (PcmlDocNode) node.getParent(); - if ( parent.getNodeType()==PcmlNodeType.DATA && - parent.getAttributeValue("type").equals("struct")) - count++; - else - count=0; - // Check if parent is a struct ref also - structR[count] = node.getName(); - struct[count] = node.getAttributeValue("struct"); - - } - if (node.getCountReps() == -10) - { - int nodeType = node.getNodeType(); - if (nodeType == PcmlNodeType.DATA && ((PcmlData) node).getXPCMLCount(dim) != 0 ) - { - // If the node is a data node and it has a count set tempInt to the count - tempInt = ( (PcmlData) node).getXPCMLCount(dim); - } - else if (nodeType== PcmlNodeType.STRUCT && ((PcmlStruct) node).getXPCMLCount(dim) != 0) - { - // If the node is a struct node and it has a count set tempInt to the count - tempInt = ( (PcmlStruct) node).getXPCMLCount(dim); - } - else - tempInt = 1; - - node.setCountReps(tempInt); // Set the number of reps for the node. - - // set current dimension - dimensions.set(current_dimension,0); - } - - // Reduce the count for this node by 1. - if (node.getCountReps() != 0) - { - node.setCountReps(node.getCountReps() - 1); - } - - if (node.hasChildren()) - { - - Enumeration children = node.getChildren(); - - // Process the children of the current node - while (children.hasMoreElements()) - { - PcmlDocNode child = (PcmlDocNode) children.nextElement(); - - // Reset all dimensions if this is tag - if (child.getNodeType() == PcmlNodeType.PROGRAM) - { - for (int i = 0; i < dimensions.size(); ++i) - { - dimensions.set(i,0); - } - current_dimension = 0; - num_dimensions = 0; - for (int i=0; i< 30 ; ++i) - { - struct[i] = ""; - structR[i] = ""; - } - count=0; - } - - // Reset all dimensions if this is a tag without a parent - if (child.getNodeType() == PcmlNodeType.STRUCT && child.getParent().getName().trim().length()==0 ) - { - for (int i = 0; i < dimensions.size(); ++i) - { - dimensions.set(i,0); - } - current_dimension = 0; - num_dimensions = 0; - for (int i=0; i< 30 ; ++i) - { - struct[i] = ""; - structR[i] = ""; - } - count=0; - } - - // Increase dimensions by 1 if this is the first child, i.e., we've gone down the tree - if (child.getChildNbr()==0 && - ( (node.getNodeType() == PcmlNodeType.DATA && ((PcmlData) node).getXPCMLCount(dim) > 0 ) || - (node.getNodeType() == PcmlNodeType.STRUCT && ((PcmlStruct) node).getXPCMLCount(dim) > 0 ) ) ) - { - num_dimensions++; - current_dimension++; - if (num_dimensions > 9) - dimensions.add(0); - } - - copyValues(root, child, num_dimensions, current_dimension, dimensions, struct, structR, count); - } // end while more children - - // Reduce current and number of dimensions by 1 since their are no - // more children on this node (stepping back up the tree a level) - - if ((node.getNodeType() == PcmlNodeType.DATA && ((PcmlData) node).getXPCMLCount(dim) > 0 ) || - (node.getNodeType() == PcmlNodeType.STRUCT && ((PcmlStruct) node).getXPCMLCount(dim) > 0 )) - { - current_dimension--; - num_dimensions--; - count--; - } - - if (node.getCountReps() > 0) - { - // This node has a count greater than 0 so we need to process it again... - // Calculate index - Integer countVal= new Integer(0); - if (node.getNodeType() == PcmlNodeType.DATA && ((PcmlData) node).getXPCMLCount(dim) != 0) - countVal = new Integer( ((PcmlData )node).getXPCMLCount(dim)); - if (node.getNodeType() == PcmlNodeType.STRUCT && ((PcmlStruct) node).getXPCMLCount(dim) != 0) - countVal = new Integer( ((PcmlStruct )node).getXPCMLCount(dim)); - if (node.getNodeType() != PcmlNodeType.DATA && node.getNodeType() != PcmlNodeType.STRUCT) - countVal = new Integer(0); - - dimensions.set(current_dimension, (countVal.intValue() - node.getCountReps())); - - // Reprocess the node because count is > 0 so we need to print it out at least one more time - copyValues(root, node, num_dimensions, current_dimension, dimensions, struct, structR, count); - } - else - { - // We're done with this node so reset its count to -10 - node.setCountReps(-10); - } - } - else // node has no children - { - - // Copy the node value to the new node - if (node.getNodeType() == PcmlNodeType.DATA && !node.getAttributeValue("type").equals("struct")) - { - // Get the value of the data node and print out as a string - String strVal=""; - String tempVal=""; - Object objVal; - - int[] indices = new int[1]; - indices[0] = node.getCountReps(); - - if (node.getQualifiedName().trim().equals("")) - { - // Can't set values of unnamed nodes - objVal=null; - } - else - { - try { - objVal=null; - if ( node.getUsage() != PcmlDocNode.OUTPUT ) - { - objVal = ((PcmlData)node).getValue(dimensions); - if (objVal == null) - { - // Not set yet so see if the referenced node has values and set it to - if ( ( (PcmlDocNode)node.getParent()).getNodeType()==PcmlNodeType.DATA && - ( (PcmlDocNode)node.getParent()).getAttributeValue("type").equals("struct") || - ( (PcmlDocNode)node.getParent()).getNodeType()==PcmlNodeType.STRUCT) - { - // Parent is a struct parm. Check if struct parm referenced value - // is set and, if so, copy that value here... - boolean augmented=false; - PcmlDocNode parent = (PcmlDocNode) node.getParent(); - while ( parent != null && - parent.getNodeType() != PcmlNodeType.PROGRAM && - augmented==false ) - { - if (parent.getNodeType() == PcmlNodeType.DATA && - parent.getAttributeValue("type").equals("struct") ) - augmented=true; - parent=(PcmlDocNode) parent.getParent(); - } - if (augmented) - { - String[] nodeName = new String[count+1]; - for (int i=0; i<= count ; i++) - { - nodeName[i] = ""; - } - boolean found=false; - for (int i=0; i<=count && !found; ++i) - { - nodeName[i] = struct[i]; - for (int j=i+1; j<=count; j++) - { - nodeName[i]= nodeName[i] + "." + structR[j]; - } - String fullName = node.getQualifiedName(); - String restOfName = fullName.substring(fullName.indexOf(structR[count])+structR[count].length()+1); - nodeName[i] = nodeName[i] + "." + restOfName; - String nodeToGet = nodeName[i]; - PcmlDocRoot rootOfTree = root.getRootNode(); - PcmlData nodeToCopy=null; - try { - nodeToCopy = (PcmlData) rootOfTree.getElement(nodeToGet); - } - catch (NullPointerException e) - { - nodeToCopy = null; - } - if (nodeToCopy != null) - { - int copyDim = nodeToCopy.getNbrOfDimensions(); - int[] copy_dim = new int[copyDim]; - for (int j=0; j< copyDim; ++j) - { - copy_dim[j] = dimensions.at( ((PcmlData) node).getNbrOfDimensions() - copyDim + j); - } - PcmlDimensions copy_dimensions = new PcmlDimensions(copy_dim); - objVal = nodeToCopy.getValue(copy_dimensions); - if (objVal != null) - { - ((PcmlData) node).setValue(objVal, dimensions); - found=true; - } - } - } - } - } - } - } - } - catch (PcmlException e) - { - Trace.log(Trace.PCML, "No value for node: " + node.getQualifiedName() ); - } - catch (java.lang.IllegalArgumentException e) - { - Trace.log(Trace.PCML, "Bad count value for node: " + node.getQualifiedName() ); - } - } - - // Check if CountReps > 0. If so, then dealing with an array - - if (node.getCountReps() > 0) // Only called when data has a count > 0 - { - // Calculate index - int countVal; - if (node.getNodeType() == PcmlNodeType.DATA && ((PcmlData) node).getXPCMLCount(dim) != 0) - countVal = ((PcmlData )node).getXPCMLCount(dim); - else if (node.getNodeType() == PcmlNodeType.STRUCT && ((PcmlStruct) node).getXPCMLCount(dim) != 0) - countVal = ((PcmlStruct)node).getXPCMLCount(dim); - else - countVal = 0; - dimensions.set(current_dimension, (countVal - node.getCountReps())); - copyValues(root, node, num_dimensions, current_dimension, dimensions, struct, structR, count); - } - else - { - node.setCountReps(-10); - } - } // end else if string value - } - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/data/PcmlException.java b/cvsroot/src/com/ibm/as400/data/PcmlException.java deleted file mode 100644 index 92f988196..000000000 --- a/cvsroot/src/com/ibm/as400/data/PcmlException.java +++ /dev/null @@ -1,70 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PcmlException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import java.awt.Component; - -/** - * Thrown when an error is encountered using a ProgramCallDocument. - * - * @see ProgramCallDocument - * @see PcmlSpecificationException - */ -public class PcmlException extends XmlException // @C3C -{ - /** - * Constructs a PcmlException without a - * user message. - * - */ - PcmlException() - { - super(); - } - - /** - * Constructs a PcmlException with a user message. - * - * @param key the resource key for the message string - */ - PcmlException(String key) - { - super(key); // @C3C - } - - /** - * Constructs a PcmlException with a user message and substitution values. - * - * @param key The resource key for the message string - * @param args Array of substitution values - */ - PcmlException(String key, Object[] args) - { - super(key, args); // @C3C - } - - /** - * Constructs a PcmlException with another exception. - * - * @param e the exception wrapped by the PcmlException - */ - PcmlException(Exception e) - { - super(e); // @C3C - } - - -// @C3D - Moved to XmlException: getLocalizedMessage(), getException(). - -} diff --git a/cvsroot/src/com/ibm/as400/data/PcmlMessageLog.java b/cvsroot/src/com/ibm/as400/data/PcmlMessageLog.java deleted file mode 100644 index f26b75f0a..000000000 --- a/cvsroot/src/com/ibm/as400/data/PcmlMessageLog.java +++ /dev/null @@ -1,455 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PcmlMessageLog.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import java.io.*; - -import java.util.Date; -import com.ibm.as400.access.Trace; // @A2A - -/** - * Provides control over logging and tracing activity within this - * package. PcmlMessageLog can be used to redirect error logging to a - * specific log file or OutputStream. It is also used - * to suppress the low level information/error messages normally written - * to the console. - */ -public class PcmlMessageLog -{ - private static OutputStream m_outputStream; - private static StringBuffer m_cp37Table; - - static - { - m_cp37Table = new StringBuffer(256); - - for (int i = 0; i < 256; i++) - { - m_cp37Table.append('.'); - } - - m_cp37Table.setCharAt(0x40, ' '); m_cp37Table.setCharAt(0x4b, '.'); m_cp37Table.setCharAt(0x4c, '<'); - m_cp37Table.setCharAt(0x4d, '('); m_cp37Table.setCharAt(0x4e, '+'); m_cp37Table.setCharAt(0x50, '&'); - m_cp37Table.setCharAt(0x5a, '!'); m_cp37Table.setCharAt(0x5b, '$'); m_cp37Table.setCharAt(0x5c, '*'); - m_cp37Table.setCharAt(0x5d, ')'); m_cp37Table.setCharAt(0x5e, ';'); m_cp37Table.setCharAt(0x60, '-'); - m_cp37Table.setCharAt(0x61, '/'); m_cp37Table.setCharAt(0x6a, '|'); m_cp37Table.setCharAt(0x6b, ','); - m_cp37Table.setCharAt(0x6c, '%'); m_cp37Table.setCharAt(0x6d, '_'); m_cp37Table.setCharAt(0x6e, '>'); - m_cp37Table.setCharAt(0x6f, '?'); m_cp37Table.setCharAt(0x79, '`'); m_cp37Table.setCharAt(0x7a, ':'); - m_cp37Table.setCharAt(0x7b, '#'); m_cp37Table.setCharAt(0x7c, '@'); m_cp37Table.setCharAt(0x7d, '\''); - m_cp37Table.setCharAt(0x7e, '='); m_cp37Table.setCharAt(0x7f, '"'); - m_cp37Table.setCharAt(0x81, 'a'); m_cp37Table.setCharAt(0x82, 'b'); m_cp37Table.setCharAt(0x83, 'c'); - m_cp37Table.setCharAt(0x84, 'd'); m_cp37Table.setCharAt(0x85, 'e'); m_cp37Table.setCharAt(0x86, 'f'); - m_cp37Table.setCharAt(0x87, 'g'); m_cp37Table.setCharAt(0x88, 'h'); m_cp37Table.setCharAt(0x89, 'i'); - m_cp37Table.setCharAt(0x91, 'j'); m_cp37Table.setCharAt(0x92, 'k'); m_cp37Table.setCharAt(0x93, 'l'); - m_cp37Table.setCharAt(0x94, 'm'); m_cp37Table.setCharAt(0x95, 'n'); m_cp37Table.setCharAt(0x96, 'o'); - m_cp37Table.setCharAt(0x97, 'p'); m_cp37Table.setCharAt(0x98, 'q'); m_cp37Table.setCharAt(0x99, 'r'); - m_cp37Table.setCharAt(0xa2, 's'); m_cp37Table.setCharAt(0xa3, 't'); m_cp37Table.setCharAt(0xa4, 'u'); - m_cp37Table.setCharAt(0xa5, 'v'); m_cp37Table.setCharAt(0xa6, 'w'); m_cp37Table.setCharAt(0xa7, 'x'); - m_cp37Table.setCharAt(0xa8, 'y'); m_cp37Table.setCharAt(0xa9, 'z'); m_cp37Table.setCharAt(0xc1, 'A'); - m_cp37Table.setCharAt(0xc2, 'B'); m_cp37Table.setCharAt(0xc3, 'C'); m_cp37Table.setCharAt(0xc4, 'D'); - m_cp37Table.setCharAt(0xc5, 'E'); m_cp37Table.setCharAt(0xc6, 'F'); m_cp37Table.setCharAt(0xc7, 'G'); - m_cp37Table.setCharAt(0xc8, 'H'); m_cp37Table.setCharAt(0xc9, 'I'); m_cp37Table.setCharAt(0xd1, 'J'); - m_cp37Table.setCharAt(0xd2, 'K'); m_cp37Table.setCharAt(0xd3, 'L'); m_cp37Table.setCharAt(0xd4, 'M'); - m_cp37Table.setCharAt(0xd5, 'N'); m_cp37Table.setCharAt(0xd6, 'O'); m_cp37Table.setCharAt(0xd7, 'P'); - m_cp37Table.setCharAt(0xd8, 'Q'); m_cp37Table.setCharAt(0xd9, 'R'); m_cp37Table.setCharAt(0xe2, 'S'); - m_cp37Table.setCharAt(0xe3, 'T'); m_cp37Table.setCharAt(0xe4, 'U'); m_cp37Table.setCharAt(0xe5, 'V'); - m_cp37Table.setCharAt(0xe6, 'W'); m_cp37Table.setCharAt(0xe7, 'X'); m_cp37Table.setCharAt(0xe8, 'Y'); - m_cp37Table.setCharAt(0xe9, 'Z'); - m_cp37Table.setCharAt(0xf0, '0'); m_cp37Table.setCharAt(0xf1, '1'); m_cp37Table.setCharAt(0xf2, '2'); - m_cp37Table.setCharAt(0xf3, '3'); m_cp37Table.setCharAt(0xf4, '4'); m_cp37Table.setCharAt(0xf5, '5'); - m_cp37Table.setCharAt(0xf6, '6'); m_cp37Table.setCharAt(0xf7, '7'); m_cp37Table.setCharAt(0xf8, '8'); - m_cp37Table.setCharAt(0xf9, '9'); - - } - - static void main(String[] args) - throws IOException - { - FileOutputStream logStream = null; - try - { - setTraceEnabled(true); - Trace.setTraceErrorOn(true); - logError("This is a test error to the console"); - traceOut("Message to stdout"); - traceErr("Message to stderr"); - - traceOut("Test dump of byte array: " + toHexString(new byte[] {0, 1, 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32} ) ); - Trace.log(Trace.PCML, "Test dump of byte array: " + toHexString(new byte[] {0, 1, 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32} ) ); - byte[] bytes = new byte[Byte.MAX_VALUE - Byte.MIN_VALUE + 1]; - for (byte b = Byte.MIN_VALUE; b < Byte.MAX_VALUE; b++) - { - bytes[b - Byte.MIN_VALUE] = b; - } - bytes[Byte.MAX_VALUE - Byte.MIN_VALUE] = Byte.MAX_VALUE; - dumpBytes(bytes); - - setLogFileName("pcml.log"); - logError("This is a test error to pcml.log"); - - logStream = new FileOutputStream("user.log"); - setLogStream(logStream); - logError("This is a test error to user.log with throwable", new IllegalArgumentException("test exception")); - - setLogFileName(null); - logError("This is a test error back to the console"); - - setTraceEnabled(false); - Trace.log(Trace.PCML, "Message to stdout should not be sent"); - Trace.setTraceErrorOn(false); - Trace.log(Trace.ERROR, "Message to stderr should not be sent"); - - - System.out.println("Test complete!"); - } - catch (Throwable e) { e.printStackTrace(); } - finally { - if (logStream != null) { - try { logStream.close(); } - catch (Exception e) { e.printStackTrace(); } - } - } - } - - // Prevent the user from constructing a PcmlMessageLog object - private PcmlMessageLog() {} - - /** - * Sets the log file name. - * - * If the file exists, error data is appended to it. - * If the file does not exist, it is created. - * - * @deprecated Replaced by com.ibm.as400.access.Trace.setFileName(String fileName). - * - * @param fileName the log file name. If null, output goes to System.err. - * @exception IOException if the file cannot be accessed - * @see #getLogFileName - */ - public static void setLogFileName(String fileName) - throws IOException - { - Trace.setFileName(fileName); // @A2A - } - - /** - * Returns the log file name. - * - * Returns null if errors are being logged to System.err, or if - * an OutputStream was specified on a call to setLogStream. - * - * @deprecated Replaced by com.ibm.as400.access.Trace.getFileName(). - * - * @return the log file name - * @see #setLogFileName - * @see #setLogStream - */ - public static String getLogFileName() - { - return Trace.getFileName(); - } - - /** - * Sets the log stream. - * - * This method allows applications to redirect errors generated - * by this package to the same OutputStream used by the - * application itself for logging errors. - * - * @deprecated Replaced by com.ibm.as400.access.Trace.setPrintWriter(PrintWriter obj). - * - * @param stream the OutputStream to which error data should be sent. - * If null, output goes to System.err. - * @see #getLogStream - */ - public static void setLogStream(OutputStream stream) - { - PrintWriter logTarget = null; - - if (stream != null) - { - m_outputStream = stream; - logTarget = new PrintWriter(stream, true); - } - else - { - m_outputStream = System.err; - logTarget = new PrintWriter(System.err, true); - } - - try - { - Trace.setPrintWriter(logTarget); // @A2A - } - catch (IOException e) // @A2A - { Trace.log(Trace.ERROR, e); } - } - - /** - * Returns the log stream. - * - * This method is guaranteed to return a valid non-null OutputStream. - * - * @deprecated Replaced by com.ibm.as400.access.Trace.getPrintWriter(). - * - * @return the OutputStream to which error data is being sent - * @see #setLogStream - */ - public static OutputStream getLogStream() - { - return m_outputStream; - } - - /** - * Logs an error string to the current logging destination. - * - * The string will be prepended with a header containing a - * date and timestamp if logging has been redirected to - * a destination other than System.err. - * - * @deprecated Replaced by com.ibm.as400.access.Trace.log(int category, String message). - * - * @param errorData the data to be logged - */ - public static void logError(Object errorData) - { - Trace.log(Trace.ERROR, errorData.toString()); // @A2A - } - - /** - * Logs an error string and a stack trace to the current logging destination. - * - * The string will be prepended with a header containing a - * date and timestamp if logging has been redirected to - * a destination other than System.err. - * - * @deprecated Replaced by com.ibm.as400.access.Trace.log(int category, String message, Throwable e). - * - * @param errorData the data to be logged - * @param t the Throwable which will be used to obtain the stack trace - */ - public static void logError(Object errorData, Throwable t) - { - Trace.log(Trace.ERROR, errorData.toString(), t); - } - - /** - * Logs a stack trace to the current logging destination. - * - * @deprecated Use java.lang.Throwable.printStackTrace(PrintWriter w). - * - * @param t the Throwable which will be used to obtain the stack trace - */ - public static void printStackTrace(Throwable t) - { - PrintWriter logTarget = Trace.getPrintWriter(); - logTarget.println("Stack trace:"); - t.printStackTrace(logTarget); - } - - /** - * Controls whether low level trace messages will be written to the console. - * - * The default value is true. - * - * @deprecated Replaced by com.ibm.as400.access.Trace.setTracePCMLOn(boolean tracePCML). - * - * @param enabled If true, allows the messages; otherwise, suppresses the messages. - * @see #isTraceEnabled - */ - public static void setTraceEnabled(boolean enabled) - { - Trace.setTracePCMLOn(enabled); // @A2C - if (enabled) // @A4A - { - Trace.setTraceOn(enabled); // @A4A - } - } - - /** - * Determines whether low level trace messages will be written to the console. - * - * The default value is true. - * - * @deprecated Replaced by com.ibm.as400.access.Trace.isTracePCMLOn(). - * - * @return true if the messages are allowed; false otherwise. - * @see #setTraceEnabled - */ - public static boolean isTraceEnabled() - { - return Trace.isTracePCMLOn(); // @A2C - } - - /** - * Writes data to System.out if low level tracing is enabled. - * - * @deprecated This method does nothing. Replaced by com.ibm.as400.access.Trace.log(int category, String message). - * - * @param data the data to be logged - * @see #traceErr - */ - public static void traceOut(Object data) - { - //if (m_traceEnabled) - // System.out.println(data); - } - - /** - * Writes data to System.err if low level tracing is enabled. - * - * @deprecated This method does nothing. Replaced by com.ibm.as400.access.Trace.log(int category, String message). - * - * @param data the data to be logged - * @see #traceOut - */ - public static void traceErr(Object data) - { - //if (m_traceEnabled) - // System.err.println(data); - } - - static void traceParameter(String program, String parmName, byte[] bytes) // @A1C - { - if (Trace.isTracePCMLOn()) // @A2C - { - Trace.log(Trace.PCML, program + "\t " + parmName); // @A2C - dumpBytes(bytes); - } - } - - private static void dumpBytes(byte[] ba) - { - if (ba == null || ba.length == 0) - return; - - int arrayLength = ba.length; - int offset = 0; - StringBuffer cp37Str = new StringBuffer(); - StringBuffer byteString = new StringBuffer(); - - while (offset < arrayLength) - { - if ((offset % 32) == 0) - { - if (offset == 0) - { - Trace.log(Trace.PCML, "Offset : 0....... 4....... 8....... C....... 0....... 4....... 8....... C....... 0...4...8...C...0...4...8...C..."); // @A2C - } - else - { - byteString.append(" *"); - byteString.append(cp37Str.toString()); - byteString.append("*"); - Trace.log(Trace.PCML, byteString.toString()); // @A2C - cp37Str.setLength(0); - byteString.setLength(0); - } - - String offStr = " " + Integer.toHexString(offset); - offStr = offStr.substring(offStr.length() - 6); - byteString.append(offStr); - byteString.append(" : "); - } - byteString.append(toHexString(ba, offset, 4)); - byteString.append(" "); - cp37Str.append(toCP37String(ba, offset, 4)); - offset = offset + 4; - - } - if (offset > 0) - { - // Add more blanks for the case where the number of bytes - // was not a multiple of four. In this case, offset - // 'overshot' the number of bytes. - for (int b = arrayLength; b < offset; b++) - { - byteString.append(" "); - cp37Str.append(" "); - } - // Now pad the line to a multiple of 32 bytes so the - // character dump on the right side is lined up. - while ((offset % 32) != 0) - { - byteString.append(" "); - cp37Str.append(" "); - offset = offset + 4; - } - byteString.append(" *"); - byteString.append(cp37Str.toString()); - byteString.append("*"); - Trace.log(Trace.PCML, byteString.toString()); // @A2C - byteString.setLength(0); - cp37Str.setLength(0); - } - - } - - // Converts a sequence of EBCDIC bytes to a Unicode string. - private static String toCP37String(byte[] ba, int index, int length) - { - if (ba == null || ba.length == 0 || index < 0 || index >= ba.length) - return ""; - - int arrayLength = ba.length; - int endIndex; - if (index + length <= arrayLength) - endIndex = index + length - 1; - else - endIndex = arrayLength - 1; - - StringBuffer cp37String = new StringBuffer(endIndex-index+1); - for (int b = index; b <= endIndex; b++) - { - if (ba[b] < 0) - { - cp37String.append( m_cp37Table.charAt(256 + ba[b]) ); - } - else - { - cp37String.append( m_cp37Table.charAt(ba[b]) ); - } - } - return cp37String.toString(); - } - - static String toHexString(byte[] ba) - { - if (ba == null) - return ""; - else - return toHexString(ba, 0, ba.length); - } - - static String toHexString(byte[] ba, int index, int length) - { - if (ba == null || ba.length == 0 || index < 0 || index >= ba.length) - return ""; - - int arrayLength = ba.length; - int endIndex; - if (index + length <= arrayLength) - endIndex = index + length - 1; - else - endIndex = arrayLength - 1; - - StringBuffer hexString = new StringBuffer((endIndex-index+1)*2); - for (int b = index; b <= endIndex; b++) - { - hexString.append(Trace.toHexString(ba[b])); - } - return hexString.toString(); - } - -} diff --git a/cvsroot/src/com/ibm/as400/data/PcmlNode.java b/cvsroot/src/com/ibm/as400/data/PcmlNode.java deleted file mode 100644 index e1f21bb62..000000000 --- a/cvsroot/src/com/ibm/as400/data/PcmlNode.java +++ /dev/null @@ -1,264 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PcmlNode.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import com.ibm.as400.access.Trace; -import java.io.Serializable; -import java.util.Vector; -import java.util.Enumeration; -import java.util.Hashtable; - - -abstract class PcmlNode implements Serializable, Cloneable { // @C2A - static final long serialVersionUID = -2955209136470053178L; // @C1A - private static Hashtable separatorsMap_; - - private PcmlNode parent; - private PcmlNode prevSibling; - private PcmlNode nextSibling; - private PcmlNode firstChild; - private PcmlNode lastChild; - private int nbrChildren; - - PcmlNode() - { - parent = null; - prevSibling = null; - nextSibling = null; - firstChild = null; - lastChild = null; - nbrChildren = 0; - } - - // All pcml document nodes support clone. - // This is a deep clone in that the result is to - // clone an entire subtree. This method recursively - // clones its children. - public Object clone() // @C2A - { // @C2A - PcmlNode node = null, child = null, newChild = null; // @C2A - try // @C2A - { // @C2A - node = (PcmlNode) super.clone(); // @C2A - node.parent = null; // @C2A - node.firstChild = null; // @C2A - node.lastChild = null; // @C2A - node.prevSibling = null; // @C2A - node.nextSibling = null; // @C2A - node.nbrChildren = 0; // @C2A - } // @C2A - catch (CloneNotSupportedException e) // @C2A - {} // @C2A - - return node; // @C2A - } // @C2A - - // Custom deserialization post-processing - // This processing cannot be done during readObject() because - // references to parent objects in the document are not yet set - // due to the recursive nature of deserialization. - void readObjectPostprocessing() // @C1A - { // @C1A - Enumeration items; // @C1A - PcmlNode child; // @C1A - - if (getNbrChildren() == 0) // @C1A - return; // @C1A - - items = getChildren(); // @C1A - while (items.hasMoreElements() ) // @C1A - { // @C1A - child = (PcmlNode) items.nextElement(); // @C1A - child.readObjectPostprocessing(); // @C1A - } // @C1A - } // @C1A - - public abstract String getName(); - - public abstract String getQualifiedName(); - - protected final PcmlNode getParent() - { - return parent; - } - - private final void setParent(PcmlNode node) - { - parent = node; - } - - protected final PcmlNode getNextSibling() - { - return nextSibling; - } - - private final void setNextSibling(PcmlNode node) - { - nextSibling = node; - } - - protected final PcmlNode getPrevSibling() - { - return prevSibling; - } - - private final void setPrevSibling(PcmlNode node) - { - prevSibling = node; - } - - protected Enumeration getChildren() - { - Vector v = new Vector(nbrChildren); - PcmlNode child = firstChild; - while (child != null) - { - v.addElement(child); - child = child.getNextSibling(); - } - return v.elements(); - } - - protected final int getNbrChildren() - { - return nbrChildren; - } - - protected final int getChildNbr() - { - int birthOrder = 0; - PcmlNode p = this; - while (p.getPrevSibling() != null) - { - birthOrder++; - p = p.getPrevSibling(); - } - return birthOrder; - } - - protected final boolean hasChildren() - { - return nbrChildren > 0; - } - - protected void addChild(PcmlNode node) - { - if (!hasChildren()) - { - firstChild = node; - } - else - { - lastChild.setNextSibling(node); - node.setPrevSibling(lastChild); - } - lastChild = node; - node.setParent(this); - nbrChildren++; - } - - // Return the root node of this node - protected PcmlDocRoot getRootNode() - { - PcmlNode p = this; - PcmlNode q = parent; // @C4A - - while ( q != null ) // @C4C - { - p = q; // @C4A - q = p.getParent(); // @C4C - } - - if (p instanceof PcmlDocRoot) - { - return (PcmlDocRoot) p; - } - else - { - return null; - } - } - - // Print the PcmlDescNode tree - protected void printTree(PcmlNode p, int level) - { - Enumeration items; - PcmlNode child; - - for (int i = 0; i) - if ( getDoc().getVersion().compareTo("2.0") < 0 ) // @B1A - { // @B1A - getDoc().addPcmlSpecificationError(DAMRI.BAD_PCML_VERSION, new Object[] {makeQuotedAttr("entrypoint", m_EntrypointStr), "2.0", getBracketedTagName(), getNameForException()} ); // @B1A - } // @B1A - - // The following section is moved to the callProgram method to allow for dynamically setting - // the path. The check cannot be done until the program is called. - - // Only allow this attribute when the path= attribute specifies a service program (*SRVPGM). - // if ( !getPath().toUpperCase().endsWith(".SRVPGM") ) // @B1A - // { // @B1A - // getDoc().addPcmlSpecificationError(DAMRI.NOT_SRVPGM, new Object[] {makeQuotedAttr("entrypoint", m_EntrypointStr), getBracketedTagName(), getNameForException()} ); // @B1A - // } // @B1A - - // Only allow this attribute when the program has 7 or fewer parameters - // Note: This check does not take into account that minvrm= and maxvrm= - // can reduce the number of parameters at runtime - // if ( getNbrChildren() > 7 ) // @B1A - // { // @B1A - // getDoc().addPcmlSpecificationError(DAMRI.TOO_MANY_PARMS, new Object[] {makeQuotedAttr("entrypoint", m_EntrypointStr), new Integer(7), getBracketedTagName(), getNameForException()} ); // @B1A - // } // @B1A - } // @B1A - // else // @B1A - // { // @B1A - // If entrypoint not specified, make sure it is not a *SRVPGM - // if ( getPath().toUpperCase().endsWith(".SRVPGM") ) // @B1A - // { // @B1A - // getDoc().addPcmlSpecificationError(DAMRI.NO_ENTRYPOINT, new Object[] {makeQuotedAttr("entrypoint", m_EntrypointStr), getBracketedTagName(), getNameForException()} ); // @B1A - // } // @B1A - // } // @B1A - - // Verify the returnvalue= attribute - if (m_ReturnvalueStr != null) // @B1A - { // @B1A - // Only allow this attribute when the pcml version is 2.0 or higher (e.g. ) - if ( getDoc().getVersion().compareTo("2.0") < 0 ) // @B1A - { // @B1A - getDoc().addPcmlSpecificationError(DAMRI.BAD_PCML_VERSION, new Object[] {makeQuotedAttr("returnvalue", m_ReturnvalueStr), "2.0", getBracketedTagName(), getNameForException()} ); // @B1A - } // @B1A - - // The following section is moved to the callProgram method to allow for dynamically setting - // the path. The check cannot be done until the program is called. - - // Only allow this attribute when the path= attribute specifies a service program (*SRVPGM). - // if ( !getPath().endsWith(".SRVPGM") ) // @B1A - // { // @B1A - // getDoc().addPcmlSpecificationError(DAMRI.NOT_SRVPGM, new Object[] {makeQuotedAttr("returnvalue", m_ReturnvalueStr), getBracketedTagName(), getNameForException()} ); // @B1A - //} // @B1A - } // @B1A - - // Verify the threadsafe= attribute - if (m_ThreadsafeStr != null) // @C6A - { // @C6A - // Only allow this attribute when the pcml version is 3.0 or higher (e.g. ) - if ( getDoc().getVersion().compareTo("3.0") < 0 ) // @C6A - { // @C6A - getDoc().addPcmlSpecificationError(DAMRI.BAD_PCML_VERSION, new Object[] {makeQuotedAttr("threadsafe", m_ThreadsafeStr), "3.0", getBracketedTagName(), getNameForException()} ); // @C6A - } // @C6A - - } // @C6A - - // Verify the epccsid= attribute - if (m_EpCcsidStr != null) // @D1A - { // @D1A - // Only allow this attribute when the pcml version is 3.0 or higher (e.g. ) - if ( getDoc().getVersion().compareTo("4.0") < 0 ) // @D1A - { // @D1A - getDoc().addPcmlSpecificationError(DAMRI.BAD_PCML_VERSION, new Object[] {makeQuotedAttr("epccsid", m_EpCcsidStr), "4.0", getBracketedTagName(), getNameForException()} ); // @D1A - } // @D1A - - } // @D1A - - } - - /** - */ - public boolean callProgram(AS400 as400) - throws AS400SecurityException, - ObjectDoesNotExistException, - InterruptedException, - ErrorCompletingRequestException, - IOException, - PcmlException - { - ProgramParameter[] childParms; // One entry in array for every child of @A1A - // This array is indexed by child number, entries for - // parameters not supported at host VRm are null. - ProgramParameter[] supportedParms; // One entry in array for each parm supported by host VRM @A1A - Enumeration children; // Enumeration of children of this element - PcmlDocNode child; // Current child element of this element - PcmlStruct structNode; // Current child cast as a element - PcmlData dataNode; // Current child cast as a element - boolean bSupportedAtVRM; // Current element is supported at host VRM @A2A - byte[] bytes; // Byte Array for doing toBytes() - int nbrSupportedParms; // Number of parameters supported at current host VRM @A1A - int childNbr; // Current child of this element - int outputSize; // Size of output required for current child element - int usage; // usage= attribute for current child element - int passby; // passby= for , always set to passby="reference" for @B1A - PcmlDimensions noDimensions = new PcmlDimensions(); - - // Stack of offsets used by PcmlData.parseBytes() and PcmlStruct.parseBytes() - Hashtable offsetStack = new Hashtable(); - - // The following checks were moved here from checkAttributes(). This allows for dynamically setting - // the path to be used for the callProgram. - - // Only allow the returnvalue attribute when the path= attribute specifies a service program (*SRVPGM). - if ( getReturnvalue() != null && !getPath().toUpperCase().endsWith(".SRVPGM") ) // @D1A - { - throw new PcmlException(DAMRI.NOT_SRVPGM, new Object[] {makeQuotedAttr("returnvalue", m_ReturnvalueStr), getBracketedTagName(), getNameForException()} ); // @D1A - } - - if ( getPath().toUpperCase().endsWith(".SRVPGM") ) // @D1A - { - // Service programs must have an entrypoint - if (getEntrypoint() == null) // @D1A - { - throw new PcmlException(DAMRI.NO_ENTRYPOINT, new Object[] {makeQuotedAttr("entrypoint", m_EntrypointStr), getBracketedTagName(), getNameForException()} ); // @D1A - } - // Service programs can only have 7 or fewer parameters (this is a server limitation). - // Note: This check does not take into account that minvrm= and maxvrm= - // can reduce the number of parameters at runtime - if ( getNbrChildren() > 7 ) // @D1A - { - throw new PcmlException(DAMRI.TOO_MANY_PARMS, new Object[] {makeQuotedAttr("entrypoint", m_EntrypointStr), new Integer(7), getBracketedTagName(), getNameForException()} ); // @D1A - } - } - else if (getEntrypoint() != null) // @D1A - { - // Only service programs can have an entrypoint - throw new PcmlException(DAMRI.NOT_SRVPGM, new Object[] {makeQuotedAttr("entrypoint", m_EntrypointStr), getBracketedTagName(), getNameForException()} ); // @D1A - } - - // Reset return value and "errno" in case an exception occurs - m_pgmRc = false; // @C1A - msgList = null; // @C1A - m_IntReturnValue = 0; // @B1A - m_Errno = 0; // @B1A - - // Save CCSID of system for character conversion - m_pgmCCSID = as400.getCcsid(); // @C2A - - // - // Convert all input parameters from Java objects to IBM i data - // - childNbr = 0; - children = getChildren(); - nbrSupportedParms = 0; // @A1A - passby = ProgramParameter.PASS_BY_REFERENCE; // @B1A - childParms = new ProgramParameter[getNbrChildren()]; // @A1A - while (children.hasMoreElements()) - { - - child = (PcmlDocNode) children.nextElement(); - usage = child.getUsage(); - outputSize = 0; - - // - // Create a byte array for the parameter and convert the Java objects to IBM i data - // - bSupportedAtVRM = false; // @A2A - bytes = null; // @A2A - switch (child.getNodeType()) - { - case PcmlNodeType.STRUCT: - structNode = (PcmlStruct) child; - if ( structNode.isSupportedAtHostVRM() ) // @A1A - { // @A1A - bSupportedAtVRM = true; // @A2A - passby = ProgramParameter.PASS_BY_REFERENCE; // @B1A - outputSize = structNode.getOutputsize(noDimensions); - if (usage == PcmlDocNode.INPUT || usage == PcmlDocNode.INPUTOUTPUT) - { - ByteArrayOutputStream buf = new ByteArrayOutputStream(outputSize); - structNode.toBytes(buf, 0, noDimensions); - bytes = buf.toByteArray(); - // Dump the data stream if trace is turned on - PcmlMessageLog.traceParameter(getPath(), child.getNameForException(), bytes); // @A1C - } - } // @A1A - break; - case PcmlNodeType.DATA: - dataNode = (PcmlData) child; - if ( dataNode.isSupportedAtHostVRM() ) // @A1A - { // @A1A - bSupportedAtVRM = true; // @A2A - passby = dataNode.getPassby(); // @B1A - outputSize = dataNode.getOutputsize(noDimensions); - if (usage == PcmlDocNode.INPUT || usage == PcmlDocNode.INPUTOUTPUT) - { - ByteArrayOutputStream buf = new ByteArrayOutputStream(outputSize); - dataNode.toBytes(buf, 0, noDimensions); - bytes = buf.toByteArray(); - // Dump the data stream if trace is turned on - PcmlMessageLog.traceParameter(getPath(), child.getNameForException(), bytes); // @A1C - } - } // @A1A - break; - default: - throw new PcmlException(DAMRI.BAD_NODE_TYPE, new Object[] {new Integer(child.getNodeType()) , child.getNameForException()} ); - } - - // Parameter is supported at current host VRM - if (bSupportedAtVRM) // @A2C - { // @A1A - switch (usage) // @A2A - { // @A2A - case PcmlDocNode.INPUT: - // Create a input ProgramParameter using the byte array - childParms[childNbr] = new ProgramParameter( passby, bytes ); // @A2A @B1C - break; // @A2A - - case PcmlDocNode.OUTPUT: // @A2A - // Create a output ProgramParameter using output size - childParms[childNbr] = new ProgramParameter( passby, outputSize ); // @A2A @B1C - break; // @A2A - - case PcmlDocNode.INPUTOUTPUT: // @A2A - // Create a input/output ProgramParameter using byte array and output size - childParms[childNbr] = new ProgramParameter( passby, bytes, outputSize ); // @A2A @B1C - break; // @A2A - } - - nbrSupportedParms++; // @A1A - } // @A1A - else // @A1A - { // @A1A - childParms[childNbr] = null; // @A1A - } // @A1A - - childNbr++; - } - - // Now build array of ProgramParameters for the supported parms - supportedParms = new ProgramParameter[nbrSupportedParms]; // @A1A - int supportedParmNbr = 0; // @A1A - for (childNbr = 0; childNbr < getNbrChildren(); childNbr++) // @A1A - { // @A1A - if ( childParms[childNbr] != null) // @A1A - { // @A1A - supportedParms[supportedParmNbr++] = childParms[childNbr]; // @A1A - } // @A1A - } // @A1A - - - // - // Set the path name and parameters for the target program - // - - if ( isServiceProgram() ) // @B1A - { // @B1A - int rtnValType; // @B1A - if ( m_ReturnvalueStr != null && m_ReturnvalueStr.equals("integer") ) // @B1A - rtnValType = ServiceProgramCall.RETURN_INTEGER; // @B1A - else // @B1A - rtnValType = ServiceProgramCall.NO_RETURN_VALUE; // @B1A - - m_pgmCall = new ServiceProgramCall(as400, - getPath(), - getEntrypoint(), - rtnValType, - supportedParms); // @B1A - if (getEpCcsid() != 0) // @D1A - { // @D1A - try - { - ((ServiceProgramCall) m_pgmCall).setProcedureName(getEntrypoint(), // @D1A - getEpCcsid()); // @D1A - } - catch (PropertyVetoException e) // @D1A - {} // @D1A - - } // @D1A - } // @B1A - else // @B1A - { // @B1A - m_pgmCall = new ProgramCall(as400, - getPath(), - supportedParms); // @A1C @B1C - } // @B1A - - // If threadsafety has been specified, set the attribute in the ProgramCall object - if ( (m_ThreadsafeOverrideCalled) || // @D2A - (getThreadsafe() != null) ) // @D2A - { - m_pgmCall.setThreadSafe(getThreadsafeOverride()); // @C6A - } - - // - // Call the target program - // - if (Trace.isTraceOn()) Trace.log(Trace.PCML, "Submitting program call: " + m_pgmCall.getProgram() + " ..."); - - m_pgmRc = m_pgmCall.run(); // @B1A - - if (Trace.isTraceOn()) Trace.log(Trace.PCML, "Completed program call: " + m_pgmCall.getProgram()); - - // - // If the program signalled a message, save the message list. - // - if (m_pgmRc != true) - { - msgList = m_pgmCall.getMessageList(); - return m_pgmRc; - } - - // - // If the program is a service program, save the integer return - // value and errno. - // - m_IntReturnValue = 0; // @B1A - m_Errno = 0; // @B1A - if ( isServiceProgram() ) // @B1A - { // @B1A - if ( m_ReturnvalueStr != null && m_ReturnvalueStr.equals("integer") ) // @B1A - { // @B1A - m_IntReturnValue = ((ServiceProgramCall) m_pgmCall).getIntegerReturnValue(); // @B1A - m_Errno = ((ServiceProgramCall) m_pgmCall).getErrno(); // @B1A - } // @B1A - } // @B1A - - // - // Parse the bytes from the output parameters - // Data conversion is delayed until the values are requested. - // - String parseorder = getParseorder(); - if (parseorder != null) - { - StringTokenizer tokens = new StringTokenizer(parseorder); - Vector orderVector = new Vector(tokens.countTokens()); - while (tokens.hasMoreTokens()) - { - String token = tokens.nextToken(); - PcmlNode node = getRootNode().getElement(getQualifiedName() + "." + token); - // Should never fail because parseorder attribute was checked after parsing - if (node == null) - { - throw new PcmlException(DAMRI.PARSEORDER_NOT_FOUND, new Object[] {makeQuotedAttr("parseorder", parseorder), token, getBracketedTagName(), getNameForException()} ); - } - else - { - // Make sure node found is a child of this element - // Should never fail because parseorder attribute was checked after parsing - if (node.getParent() != this) - { - throw new PcmlException(DAMRI.PARSEORDER_NOT_CHILD, new Object[] {makeQuotedAttr("parseorder", parseorder), token, getBracketedTagName(), getNameForException()} ); - } - else - { - // For elements check if it is supported at host VRM - if ( node instanceof PcmlStruct ) // @A1A - { // @A1A - if ( ((PcmlStruct) node).isSupportedAtHostVRM() ) // @A1A - { // @A1A - orderVector.addElement(node); - } // @A1A - } // @A1A - // For elements check if it is supported at host VRM - else if ( node instanceof PcmlData ) // @A1A - { // @A1A - if ( ((PcmlData) node).isSupportedAtHostVRM() ) // @A1A - { // @A1A - orderVector.addElement(node); // @A1A - } // @A1A - } // @A1A - else // @A1A - { // @A1A - orderVector.addElement(node); // @A1A - } // @A1A - } - } - } - children = orderVector.elements(); - } - // parseorder= not specified, get enumeration of children in birth order - else - { - children = getChildren(); - } - - // Process children to parse IBM i data - while (children.hasMoreElements()) - { - child = (PcmlDocNode) children.nextElement(); - childNbr = child.getChildNbr(); - - // If this child (parameter) has an output buffer - // parse the bytes into its fields - // Data is not converted to Java objects until the value is requested. - if ( childParms[childNbr] != null - && childParms[childNbr].getOutputDataLength() > 0) // @A1C - { - bytes = childParms[childNbr].getOutputData(); // @A1C - - PcmlMessageLog.traceParameter(getPath(), child.getNameForException(), bytes); // @A1C - - switch (child.getNodeType()) - { - case PcmlNodeType.STRUCT: - ((PcmlStruct) child).parseBytes(bytes, 0, offsetStack, new PcmlDimensions() ); - break; - case PcmlNodeType.DATA: - ((PcmlData) child).parseBytes(bytes, 0, offsetStack, new PcmlDimensions() ); - break; - default: - throw new PcmlException(DAMRI.BAD_NODE_TYPE, new Object[] {new Integer(child.getNodeType()) , child.getNameForException()} ); - } - } - - } - - return true; - } - - /** - Returns the CCSID for this program element. -

      - The CCSID is saved at the beginning of the callProgram() method. - This value is used for subsequent character conversion. - This is especially helpful when the ProgramCallDocument is - serialized with data and transported around the management - central network. - - @return The integer CCSID for this program element. - - */ - int getProgramCCSID() // @C2A - { // @C2A - if (m_pgmCCSID == -1) // @C2A - return 65535; // @C2A - else // @C2A - return m_pgmCCSID; // @C2A - } // @C2A - - /** - Returns an "errno" value for this service program element. -

      - This element must be defined as service program entrypoint. - The value returned is the "errno" value resulting from the most recent - call to the program. If the program has not been called, zero is returned. - - @return The integer "errno" value for this service program element. - - @exception PcmlException - If an error occurs. - */ - int getErrno() throws PcmlException // @B1A - { // @B1A - if ( isServiceProgram() ) // @B1A - { // @B1A - if ( m_ReturnvalueStr.equals("integer") ) // @B1A - return m_Errno; // @B1A - - throw new PcmlException(DAMRI.NOT_SERVICE_PGM, new Object[] { getBracketedTagName(), makeQuotedAttr("returnvalue", "integer"), getBracketedTagName(), getNameForException()} ); // @B1A - } // @B1A - - throw new PcmlException(DAMRI.NOT_SERVICE_PGM, new Object[] { getBracketedTagName(), makeQuotedAttr("entrypoint", ""), getBracketedTagName(), getNameForException()} ); // @B1A - } // @B1A - - /** - Returns an int return value for this service program element. -

      - This element must be defined as a service program entrypoint. - The value returned is the integer return value from the most recent - call to the program. If the program has not been called, zero is returned. - - @return The integer return value for this service program element. - - @exception PcmlException - If an error occurs. - */ - int getIntReturnValue() throws PcmlException // @B1A - { // @B1A - if ( isServiceProgram() ) // @B1A - { // @B1A - if ( m_ReturnvalueStr.equals("integer") ) // @B1A - return m_IntReturnValue; // @B1A - - throw new PcmlException(DAMRI.NOT_SERVICE_PGM, new Object[] { getBracketedTagName(), makeQuotedAttr("returnvalue", "integer"), getBracketedTagName(), getNameForException()} ); // @B1A - } // @B1A - - throw new PcmlException(DAMRI.NOT_SERVICE_PGM, new Object[] { getBracketedTagName(), makeQuotedAttr("entrypoint", ""), getBracketedTagName(), getNameForException()} ); // @B1A - } // @B1A - - AS400Message[] getMessageList() - { - return msgList; - } - - /** - Returns whether or not this element is defined as a service program entrypoint. - - @return Returns true if this element is defined as a service program entrypoint. - Returns false otherwise. - - */ - private boolean isServiceProgram() // @B1A - { // @B1A - return (getEntrypoint() != null); // @B1A - } // @B1A -} diff --git a/cvsroot/src/com/ibm/as400/data/PcmlSAXParser.java b/cvsroot/src/com/ibm/as400/data/PcmlSAXParser.java deleted file mode 100644 index fd22ffbc3..000000000 --- a/cvsroot/src/com/ibm/as400/data/PcmlSAXParser.java +++ /dev/null @@ -1,1931 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PcmlSAXParser.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2010 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -//@E0C -import javax.xml.parsers.SAXParserFactory; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.FactoryConfigurationError; -import javax.xml.parsers.ParserConfigurationException; -import org.xml.sax.Attributes; -import org.xml.sax.helpers.AttributesImpl; -import org.xml.sax.helpers.DefaultHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.SAXNotRecognizedException; //@E1A -import org.xml.sax.SAXNotSupportedException; //@E1A -// import sun.misc.BASE64Decoder; //@E1A -import com.ibm.as400.access.BinaryConverter; //@E1A - -import org.xml.sax.XMLReader; - -import java.io.OutputStream; -import java.io.ByteArrayOutputStream; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.SequenceInputStream; -import java.io.BufferedInputStream; //@E1A -import java.io.InputStreamReader; -import java.io.LineNumberReader; - -import java.util.Enumeration; -import java.util.MissingResourceException; -import java.util.HashSet; -import java.util.Stack; -import java.util.Vector; - -import com.ibm.as400.access.Trace; - -class PcmlSAXParser extends DefaultHandler -{ - private transient PcmlDocument m_rootNode; - private transient PcmlDocNode m_currentNode; - private transient String m_docName; - private transient XMLErrorHandler m_xh; - private transient boolean exceptionIfParseError_; - - // @E1A - New variables for XPCML. - // @E1A - Hold current value of attributes - Vector curAttrs = new Vector(); - Vector curQName = new Vector(); - - int curDim = -1; - String lastQName=""; - int[] dimArray = {0,0,0,0,0,0,0,0,0,0}; - PcmlDimensions dimensions = new PcmlDimensions(dimArray); - - // @E1A - initValue is used to keep track of XML data value for an element - private String initValue=""; //@E1A - - // @E1A -- docIsXPCML - is the document an XPCML doc vs a PCML doc? - private boolean docIsXPCML = false; //@E1A - //private String xsdStreamName; //@E1A // Used to determine if this is first instance of this node or if its an array - private boolean firstInstance=true; //@E1A - /** xsd transformed as a byte array input and output stream **/ - ByteArrayOutputStream xmlOut = new ByteArrayOutputStream(); - ByteArrayInputStream xmlIn; - - /** xsd file **/ - private InputStream xsdFileStream; - - // @E1A -- Set features for XML parser. Need to set for full schema checking - // @E1A feature ids - /** Namespaces feature id (http://xml.org/sax/features/namespaces). */ - private static final String NAMESPACES_FEATURE_ID = "http://xml.org/sax/features/namespaces"; //@E1A - - /** Namespace prefixes feature id (http://xml.org/sax/features/namespace-prefixes). */ - private static final String NAMESPACE_PREFIXES_FEATURE_ID = "http://xml.org/sax/features/namespace-prefixes"; //@E1A - - /** Validation feature id (http://xml.org/sax/features/validation). */ - private static final String VALIDATION_FEATURE_ID = "http://xml.org/sax/features/validation"; //@E1A - - /** Schema validation feature id (http://apache.org/xml/features/validation/schema). */ - private static final String SCHEMA_VALIDATION_FEATURE_ID = "http://apache.org/xml/features/validation/schema"; //@E1A - - /** Schema full checking feature id (http://apache.org/xml/features/validation/schema-full-checking). */ - private static final String SCHEMA_FULL_CHECKING_FEATURE_ID = "http://apache.org/xml/features/validation/schema-full-checking"; //@E1A - - /** Dynamic validation feature id (http://apache.org/xml/features/validation/dynamic). */ - private static final String DYNAMIC_VALIDATION_FEATURE_ID = "http://apache.org/xml/features/validation/dynamic"; //@E1A - - - private static HashSet knownTypes_ = null; - private static HashSet knownArrayTypes_ = null; - - - PcmlSAXParser(String docName, InputStream docStream, InputStream xsdStream, boolean docIsXPCML, boolean exceptionIfParseError) - throws MissingResourceException, IOException, ParseException, PcmlSpecificationException, - FactoryConfigurationError, ParserConfigurationException, SAXException - { - m_rootNode = null; - m_currentNode = null; - exceptionIfParseError_ = exceptionIfParseError; - - String qualDocName; // Potentially package qualified document name @A2A - - xsdFileStream = xsdStream; // xsd stream holder @E1A - - this.docIsXPCML = docIsXPCML; // Fix for JTOpen Bug 1778759 - set the global docIsXPCML variable - - // initialize parsing vectors - curAttrs.add(0,new AttributesImpl()); - curQName.add(0,""); - - // Save the document name (strip the suffix if present) - if (docName.endsWith(".pcml") || docName.endsWith(".pcmlsrc") || - docName.endsWith(".xpcml") || docName.endsWith(".xpcmlsrc")) //@E1C - { - qualDocName = docName.substring(0, docName.lastIndexOf('.') ); // @A2C - } - else - { - qualDocName = docName; // @A2C - } - - m_docName = qualDocName.substring(qualDocName.lastIndexOf('.') + 1); // @A2A - - // @E1A -- Changes for XPCML. First find out if document is XPCML. Then setup SequenceInputStream - InputStream isHeader=null; //@E1A - InputStream instream = null; - - try - { - // First check if xsd stream is valid if this is XPCML - if (docIsXPCML) - { - // Transform the xsd stream to a byte stream we can more easily read - if (xsdFileStream != null) - { - try - { - XPCMLHelper.doSimplifyXSDTransform(xsdFileStream, xmlOut); - } - catch (IOException e) - { - throw e; - } - catch (SAXException e) - { - throw e; - } - - xmlIn = new ByteArrayInputStream(xmlOut.toByteArray()); - if (xmlIn == null) - throw new MissingResourceException(SystemResourceFinder.format(DAMRI.PCML_DTD_NOT_FOUND, new Object[] {"xmlOut"}), "xmlOut", ""); - } - - // Doc is an XPCML document - // Now try to open the XPCML file - instream = new BufferedInputStream(docStream); - } - - else // doc is PCML //@E1A - { - // Doc is a PCML document. Do old processing... - // Open the PCML header document that contains the DTD - isHeader = SystemResourceFinder.getPCMLHeader(); - - // Concatenate the two input streams - instream = new SequenceInputStream(isHeader, docStream); - - } - - // Instantiate our error listener - m_xh = new XMLErrorHandler(m_docName, SystemResourceFinder.getHeaderLineCount()); - - SAXParserFactory factory = SAXParserFactory.newInstance(); //@E0A - factory.setValidating(true); //@E0A - factory.setNamespaceAware(false); //@E0A - - // @E1A -- Set new features for XPCML - // set parser features - if (docIsXPCML) - setFeatures(factory); - - SAXParser parser = factory.newSAXParser(); //@E0A - //@E0D SAXParser parser = new SAXParser(); // @C2C - //@E0D try { // @C2A - //@E0D parser.setFeature("http://xml.org/sax/features/validation", true); // @C2A - //@E0D parser.setFeature( "http://xml.org/sax/features/namespaces", false ); // @C2A - //@E0D } catch (org.xml.sax.SAXException se) { // @C2A - //@E0D } - //@E0D parser.setErrorHandler(xh); - //@E0D parser.setDocumentHandler(this); // @C3C - - // Create an InputSource for passing to the parser. - // Wrap any SAXExceptions as ParseExceptions. - try - { - XMLReader reader = parser.getXMLReader(); //@E0A - reader.setErrorHandler(m_xh); //@E0A - - parser.parse(new InputSource(instream), this); //@E0C - // Close the input stream - instream.close(); - instream = null; - - } - catch (SAXException e) - { - Trace.log(Trace.PCML, e); - ParseException pe = new ParseException(SystemResourceFinder.format(DAMRI.FAILED_TO_PARSE, new Object[] {m_docName} ) ); - pe.addMessage(e.getMessage()); - throw pe; - } - - // Check for errors - ParseException exc = m_xh.getException(); - if (exc != null) - { - exc.reportErrors(); - throw exc; - } - - // Recursively walk the document tree and augment the tree with - // cloned subtrees for nodes. - augmentTree(m_rootNode, new Stack()); - - // Perform post-parsing attribute checking. - // Recursively walk the document tree and ask each node - // to verify all attributes. - // Note that this phase must be performed after the document is completely - // parsed because some attributes (length=, count=, etc.) make reference - // to named document elements occuring later in the document. - - checkAttributes(m_rootNode); - - // Copy in values from augmented nodes - try - { - if (docIsXPCML) - m_rootNode.copyValues(m_rootNode, m_rootNode); - } - catch (XmlException e) - { - Trace.log(Trace.PCML, "All data values may not have been copied to struct parm refs.", e); - throw new SAXException(e); - } - - if (m_rootNode != null && m_rootNode.getPcmlSpecificationException() != null) - { - throw m_rootNode.getPcmlSpecificationException(); - } - } - finally - { - if (isHeader != null) { - try { isHeader.close(); } catch (Exception e) {}; - } - if (instream != null) { - try { instream.close(); } catch (Exception e) {}; - } - } - } - - - // @E1A -- New method to do feature checking - static void setFeatures(SAXParserFactory factory) throws SAXException, SAXNotRecognizedException, SAXNotSupportedException, ParserConfigurationException - { - // @E1A -- Set new features for XPCML - // set parser features - factory.setFeature(NAMESPACES_FEATURE_ID, true); - factory.setFeature(NAMESPACE_PREFIXES_FEATURE_ID, true); - factory.setFeature(VALIDATION_FEATURE_ID, true); - factory.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true); - factory.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID, true); - factory.setFeature(DYNAMIC_VALIDATION_FEATURE_ID, false); - } - - - // Process the PcmlDocNode tree and add new PcmlDocNode subtrees - // for tags that reference tags. - // (e.g. - // This process must be done after the initial tree is built - // because there is no requirement that the referenced - // tag be defined before the referencing tag. - PcmlDocument getPcmlDocument() - { - return m_rootNode; - } - - // Process the PcmlDocNode tree and add new PcmlDocNode subtrees - // for tags that reference tags. - // (e.g. - // This process must be done after the initial tree is built - // because there is no requirement that the referenced - // tag be defined before the referencing tag. - private void augmentTree(PcmlDocNode pcmlElem, Stack recursionStack) - { - Enumeration children; - PcmlDocNode child; - String structName; - PcmlDocNode structNode; - PcmlData dataNode; - - children = pcmlElem.getChildren(); - if (children == null) - return; - - while (children.hasMoreElements()) - { - child = (PcmlDocNode) children.nextElement(); - - // Only augment the tree for items. - // This also makes sure the node has no children - // though this should always be the case because the DTD does - // allow the tag to have nested elements. - if (child instanceof PcmlData) // This node is a tag - { - dataNode = (PcmlData) child; - if (dataNode.getDataType() == PcmlData.STRUCT) // and it is type="struct" - { - if (dataNode.getNbrChildren() == 0) // and it has no children - { - structName = dataNode.getStruct(); - if (structName != null) - { - structNode = (PcmlDocNode) m_rootNode.getElement(structName); - if (structNode instanceof PcmlStruct) - { - if (recursionStack.search(structNode) != -1) - { - m_rootNode.addPcmlSpecificationError(DAMRI.CIRCULAR_REFERENCE, new Object[] {structName, dataNode.getBracketedTagName(), dataNode.getNameForException()} ); - } - else - { - Enumeration structChildren = structNode.getChildren(); - while (structChildren.hasMoreElements()) - { - PcmlDocNode structChild = (PcmlDocNode) structChildren.nextElement(); - PcmlDocNode newChild = (PcmlDocNode) structChild.clone(); - - // Link the new node into the document tree - dataNode.addChild(newChild); - - // Recursively add all of the new node's children - // to the document's hashtable. - m_rootNode.addToHashtable(newChild); // @C1C - } - // Insert subtree for this structure - //makeChildren(structNode.getXmlNode(), dataNode); - - } - } - else - { - if (structNode == null) - { - m_rootNode.addPcmlSpecificationError(DAMRI.REF_NOT_FOUND, new Object[] {structName, "", dataNode.getBracketedTagName(), dataNode.getNameForException()} ); - } - else - { - m_rootNode.addPcmlSpecificationError(DAMRI.REF_WRONG_TYPE, new Object[] {structName, "", dataNode.getBracketedTagName(), dataNode.getNameForException()} ); - } - } - } - } - else - { - // Not allowed by the DTD - } - } - } - - // Recursively augment the newly created tree - recursionStack.push(child); - augmentTree(child, recursionStack); - recursionStack.pop(); - } - } - - // Process the PcmlDocNode tree to resolve references to - // named nodes in the tree. - // - // Some nodes (e.g. ) have attributes with named references - // to other nodes (e.g. offset="xyz"). The named reference can - // be either a simple name or a qualified name. The name - // resolution is performed by walking up the document heirarchy looking - // for a named element relative to the current location in the tree. - // - // Given the following document structure: - // - // - // - // - // - // - // - // - // - // - // - // The element named "lengthOfXyz" is referenced by element "xyz" as - // the length of the character field. In this case the following - // names could be specified on the length attribute and would - // resolve to the same element in the docuement: - // -- length="lengthOfXyz" - // -- length="struct1.lengthOfXyz" - // -- length="parm1.struct1.lengthOfXyz" - // -- length="qabc.parm1.struct1.lengthOfXyz" - // - // The resolution process recursively asks the nodes's parent if the - // name string is a descendant of the current node. - private void checkAttributes(PcmlDocNode pcmlElem) - { - Enumeration children; - PcmlDocNode child; - - children = pcmlElem.getChildren(); - if (children == null) - return; - - while (children.hasMoreElements()) - { - child = (PcmlDocNode) children.nextElement(); - - child.checkAttributes(); - - // Recursively resolve references for all nodes in the tree - checkAttributes(child); - } - } - - - public void startElement(String uri, String localName, String qName, Attributes xmlAttrs) //@E0C - { - - String tagName = qName; //@E0A - PcmlDocNode newNode = null; - String parmName=""; - String equivQName=qName; - AttributesImpl uAttrs= new AttributesImpl(); - boolean uDefinedQName=false; - boolean extendedType=false; - - // Reset initValue - initValue=""; - - - if (!docIsXPCML) // Copy old PCML code exactly - do not change - { - // Create a PcmlAttributeList to hold all the - // attributes for this node. - PcmlAttributeList attrs = new PcmlAttributeList(xmlAttrs.getLength()); - for (int attr = 0; attr < xmlAttrs.getLength(); attr++) - { - attrs.addAttribute( new PcmlAttribute(xmlAttrs.getQName(attr), // @C3C - xmlAttrs.getValue(attr), - (true | false)) ); - } - - // Create PcmlDocNode subclass based on tag name - if (tagName.equals("pcml")) - { - newNode = new PcmlDocument(attrs, m_docName); - } - else if (tagName.equals("program")) - { - newNode = new PcmlProgram(attrs); - } - else if (tagName.equals("struct")) - { - newNode = new PcmlStruct(attrs); - } - else if (tagName.equals("data")) - { - newNode = new PcmlData(attrs); - } - else - { - newNode = null; - // Unrecognized tag name should never happen, if the tags parse successfully. - if (m_rootNode != null) - { - m_rootNode.addPcmlSpecificationError(DAMRI.BAD_TAG, new Object[] {tagName, getBracketedTagName(tagName)} ); - } - else // we haven't established a root node yet - { - // This method has no 'throws' clause in its signature. - // Therefore, to report the error and terminate processing, we have no choice but to throw a RuntimeException. - PcmlSpecificationException pse = new PcmlSpecificationException(SystemResourceFinder.format(DAMRI.BAD_TAG, new Object[] {tagName, getBracketedTagName(tagName)})); - throw new RuntimeException(pse); - } - } - - if (newNode != null) - { - if (m_rootNode == null) - { - m_rootNode = (PcmlDocument) newNode; - m_currentNode = newNode; - } - else - { - m_currentNode.addChild(newNode); - m_currentNode = newNode; - } - } - } - - if (docIsXPCML) - { - if (xsdFileStream != null) - { - - // Check if this is a user defined element. If so, convert to equivalent XPCML element - if (!getKnownTypes().contains(qName)) - { - // User defined parameter. Need to find it in XSD stream. - uDefinedQName=true; - ByteArrayInputStream xmlIn = new ByteArrayInputStream(xmlOut.toByteArray()); - if (xmlIn == null) - throw new MissingResourceException(SystemResourceFinder.format(DAMRI.PCML_DTD_NOT_FOUND, new Object[] {"xmlOut"}), "xmlOut", ""); - - // Cache the line count of the header - LineNumberReader lnr = new LineNumberReader(new InputStreamReader(xmlIn)); - try - { - String line; - line=lnr.readLine(); - boolean found=false; - while (line != null && !found) - { - if (line.indexOf("name="+"\""+qName+"\"") != -1 && line.indexOf("parm type=") != -1) - { - if (line.indexOf("parm type=string") != -1) - { - // String parm found - equivQName = "stringParm"; - found=true; - } - else if (line.indexOf("parm type=int") != -1) - { - // Int parm found - equivQName="intParm"; - found=true; - } - else if (line.indexOf("parm type=uint") != -1) - { - // Unsigned Int parm found - equivQName="unsignedIntParm"; - found=true; - } - else if (line.indexOf("parm type=hexBinary") != -1) - { - // hexBinary parm found - equivQName="hexBinaryParm"; - found=true; - } - else if (line.indexOf("parm type=byte") != -1) - { - // Byte parm found - equivQName="byteParm"; - found=true; - } - else if (line.indexOf("parm type=ubyte") != -1) - { - // Unsigned Byte parm found - equivQName="unsignedByteParm"; - found=true; - } - else if (line.indexOf("parm type=short") != -1) - { - // Short parm found - equivQName="shortParm"; - found=true; - } - else if (line.indexOf("parm type=ushort") != -1) - { - // Unsigned Short parm found - equivQName="unsignedShortParm"; - found=true; - } - else if (line.indexOf("parm type=long") != -1) - { - // Long parm found - equivQName="longParm"; - found=true; - } - else if (line.indexOf("parm type=ulong") != -1) - { - // Unsigned Long parm found - equivQName="unsignedLongParm"; - found=true; - } - else if (line.indexOf("parm type=float") != -1) - { - // Float parm found - equivQName="floatParm"; - found=true; - } - else if (line.indexOf("parm type=double") != -1) - { - // Double parm found - equivQName="doubleParm"; - found=true; - } - else if (line.indexOf("parm type=packed") != -1) - { - // Packed parm found - equivQName="packedDecimalParm"; - found=true; - } - else if (line.indexOf("parm type=zoned") != -1) - { - // Zoned parm found - equivQName="zonedDecimalParm"; - found=true; - } - else if (line.indexOf("parm type=date") != -1) - { - // Date parm found - equivQName="dateParm"; - found=true; - } - else if (line.indexOf("parm type=time") != -1) - { - // Time parm found - equivQName="timeParm"; - found=true; - } - else if (line.indexOf("parm type=timestamp") != -1) - { - // Timestamp parm found - equivQName="timestampParm"; - found=true; - } - else if (line.indexOf("parm type=structParm") != -1) - { - // Struct parm found - equivQName="structParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfString") != -1) - { - // String parm found - equivQName = "arrayOfStringParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfInt") != -1) - { - // Int parm found - equivQName="arrayOfIntParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfUInt") != -1) - { - // Unsigned Int parm found - equivQName="arrayOfUnsignedIntParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfHexBinary") != -1) - { - // hexBinary parm found - equivQName="arrayOfHexBinaryParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfShort") != -1) - { - // Short parm found - equivQName="arrayOfShortParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfUShort") != -1) - { - // Unsigned Short parm found - equivQName="arrayOfUnsignedShortParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfLong") != -1) - { - // Long parm found - equivQName="arrayOfLongParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfULong") != -1) - { - // Unsigned Long parm found - equivQName="arrayOfUnsignedLongParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfFloat") != -1) - { - // Float parm found - equivQName="arrayOfFloatParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfDouble") != -1) - { - // Double parm found - equivQName="arrayOfDoubleParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfPacked") != -1) - { - // Packed parm found - equivQName="arrayOfPackedDecimalParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfZoned") != -1) - { - // Zoned parm found - equivQName="arrayOfZonedDecimalParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfDate") != -1) - { - // Date parm found - equivQName="arrayOfDateParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfTime") != -1) - { - // Time parm found - equivQName="arrayOfTimeParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfTimestamp") != -1) - { - // Timestamp parm found - equivQName="arrayOfTimestampParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfStructParm") != -1) - { - // Struct parm found - equivQName="arrayOfStructParm"; - found=true; - } - else if (line.indexOf("parm type=structArray") != -1) - { - // Struct found - equivQName="arrayOfStruct"; - found=true; - } - else - { - // Should never reach here. Should get parse error if invalid type passed in - Trace.log(Trace.WARNING,"User defined type passed in not found in xsd stream"); - } - - // Now get attributes and set them to equivalent XPCML base attributes - // Find and print attributes - if (found==true) - { - line = lnr.readLine(); - while (line != null && line.indexOf("parm type=") == -1) - { - // Save attributes attributes - String attrName=""; - String attrVal=""; - // Parse line into attribute, value pair - if (line.indexOf("attributeName=") != -1) - { - // Found an attribute - attrName=line.substring(line.indexOf("attributeName=")+14, line.indexOf("attributeValue=")).trim(); - } - if (line.indexOf("attributeValue=") != -1) - { - attrVal=line.substring(line.indexOf("attributeValue=")+15).trim(); - } - // Save the attribute in the attribute list - uAttrs.addAttribute("","",attrName,"",attrVal); - // Read next line. While loop checks if its still an attribute line - line = lnr.readLine(); - } - } - } // end if - if (!found) - line=lnr.readLine(); - } // end while - } // end try - catch (IOException e) - { - Trace.log(Trace.PCML,"Error reading xsd stream in startElement.", e); - } - } - } // end if xsdStream not null - - if (!getKnownArrayTypes().contains(equivQName)) - { - curDim++; - - if (uDefinedQName) - { - if (curAttrs.size() > curDim) - curAttrs.set(curDim,uAttrs); - else - curAttrs.add(curDim,uAttrs); - } - else - { - if (curAttrs.size() > curDim) - curAttrs.set(curDim, new AttributesImpl(xmlAttrs)); - else - curAttrs.add(curDim, new AttributesImpl(xmlAttrs)); - } - if (curQName.size() > curDim) - curQName.set(curDim,equivQName); - else - curQName.add(curDim,equivQName); - lastQName = equivQName; - } - - // Create a PcmlAttributeList to hold all the - // attributes for this node. - AttributesImpl curList; - String curName; - if (equivQName.equals("i") || equivQName.equals("struct_i")) - { - // Check if this is first element in array. If not, then increase dimensions by 1 - if (lastQName.indexOf("arrayOf") == -1) // Last element not arrayOf element so up by 1 - { - // This is not first element so up index by 1 - dimensions.set(curDim, dimensions.at(curDim)+1); - } - curList = new AttributesImpl( (AttributesImpl) curAttrs.elementAt(curDim)); - curName = (String)curQName.elementAt(curDim); - } - else - { - if (uDefinedQName) - { - curList = uAttrs; - for (int attr = 0; attr < xmlAttrs.getLength(); attr++) - { - if (curList.getIndex(xmlAttrs.getQName(attr)) == -1) - { - extendedType=true; - curList.addAttribute(xmlAttrs.getURI(attr), - xmlAttrs.getLocalName(attr), - xmlAttrs.getQName(attr), - xmlAttrs.getType(attr), - xmlAttrs.getValue(attr)); - } - } - } - else - curList = new AttributesImpl(xmlAttrs); - curName = equivQName; - } - - // Check if this is the first instance of this node. If not, do not create the node again - firstInstance = true; - if (m_currentNode != null) - { - if (m_currentNode.getNodeType() == PcmlNodeType.STRUCT && !equivQName.equals("struct_i") && !equivQName.equals("struct") && !equivQName.equals("xpcml")) - { - boolean isInTree; - isInTree = inTree(equivQName,curList); - if (isInTree) - firstInstance=false; - } - } - for (int i=0; i<= curDim; ++i) - { - if (dimensions.at(i) > 0) - firstInstance=false; - } - - // Set current dimension to index value if specified - if (equivQName.equals("i") || equivQName.equals("struct_i")) - { - for (int attr=0; attr < xmlAttrs.getLength(); attr++) - { - if (xmlAttrs.getQName(attr).equals("index")) - { - // Set current dimension to index value - Integer indexInt = new Integer(xmlAttrs.getValue(attr)); - dimensions.set(curDim,indexInt.intValue()); - } - } - } - - // Set attributes if this is the first instance of this node - lastQName = equivQName; - if (firstInstance && !equivQName.equals("i") && !equivQName.equals("struct_i")) - { - PcmlAttributeList attrs= new PcmlAttributeList(curList.getLength()+2); - - for (int attr = 0; attr < curList.getLength(); attr++) - { - //@E1A -- XPCML code. Need to convert XPCML representation of attributes to their PCML - // equivalents. - if (curList.getQName(attr).equals("name")) - parmName = curList.getValue(attr); - - if (curList.getQName(attr).equals("passDirection")) //@E1A - { - //@E1A - if (curList.getValue(attr).equals("in")) //@E1A - attrs.addAttribute( new PcmlAttribute("usage", //@E1A - "input", - (true | false)) ); - else if (curList.getValue(attr).equals("inout")) //@E1A - attrs.addAttribute( new PcmlAttribute("usage", //@E1A - "inputoutput", - (true | false)) ); - - else if (curList.getValue(attr).equals("out")) //@E1A - attrs.addAttribute( new PcmlAttribute("usage", //@E1A - "output", - (true | false)) ); - else if (curList.getValue(attr).equals("inherit")) //@E1A - attrs.addAttribute( new PcmlAttribute("usage", //@E1A - "inherit", - (true | false)) ); - } - else if (curList.getQName(attr).equals("passMode")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("passby", //@E1A - curList.getValue(attr), - (true | false)) ); - } - else if (curList.getQName(attr).equals("bytesPerChar")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("chartype", //@E1A - curList.getValue(attr), - (true | false)) ); - } - else if (curList.getQName(attr).equals("totalBytes")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("length", //@E1A - curList.getValue(attr), - (true | false)) ); - } - else if (curList.getQName(attr).equals("outputSize")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("outputsize", //@E1A - curList.getValue(attr), - (true | false)) ); - } - else if (curList.getQName(attr).equals("entryPoint")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("entrypoint", //@E1A - curList.getValue(attr), - (true | false)) ); - } - else if (curList.getQName(attr).equals("returnValue")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("returnvalue", //@E1A - curList.getValue(attr), - (true | false)) ); - } - else if (curList.getQName(attr).equals("threadSafe")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("threadsafe", //@E1A - curList.getValue(attr), - (true | false)) ); - } - else if (curList.getQName(attr).equals("offsetFrom")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("offsetfrom", //@E1A - curList.getValue(attr), - (true | false)) ); - } - else if (curList.getQName(attr).equals("totalDigits")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("length", //@E1A - curList.getValue(attr), - (true | false)) ); - } - else if (curList.getQName(attr).equals("fractionDigits")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("precision", //@E1A - curList.getValue(attr), - (true | false)) ); - } - else if (curList.getQName(attr).equals("parseOrder")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("parseorder", //@E1A - curList.getValue(attr), - (true | false)) ); - } - else if (curList.getQName(attr).equals("bidiStringType")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("bidistringtype", //@E1A - curList.getValue(attr), - (true | false)) ); - } - else if (curList.getQName(attr).equals("isEmptyString")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("init", //@E1A - "", - (true | false)) ); - } - else if (curList.getQName(attr).equals("dateFormat")) - { - attrs.addAttribute( new PcmlAttribute("dateformat", - curList.getValue(attr), - (true | false)) ); - } - else if (curList.getQName(attr).equals("dateSeparator")) - { - attrs.addAttribute( new PcmlAttribute("dateseparator", - curList.getValue(attr), - (true | false)) ); - } - else if (curList.getQName(attr).equals("timeFormat")) - { - attrs.addAttribute( new PcmlAttribute("timeformat", - curList.getValue(attr), - (true | false)) ); - } - else if (curList.getQName(attr).equals("timeSeparator")) - { - attrs.addAttribute( new PcmlAttribute("timeseparator", - curList.getValue(attr), - (true | false)) ); - } - // Note: This 'else if' clause needs to be the last one in the sequence. - else if (!qName.equals("xpcml") || (qName.equals("xpcml") && curList.getQName(attr).equals("version"))) - { - attrs.addAttribute( new PcmlAttribute(curList.getQName(attr), // @C3C @E0C - curList.getValue(attr), - (true | false)) ); - } - else - { - //System.out.println("Unrecognized attr: |" + curList.getQName(attr) + "|"); - } - } // end for loop - - // Create PcmlDocNode subclass based on tag name - if (tagName.equals("program")) - { - newNode = new PcmlProgram(attrs); - // Reset dimensions - for (int i=0; i< dimensions.size();++i) - dimensions.set(i, 0); - } - else if (tagName.equals("struct")) - { - newNode = new PcmlStruct(attrs); - // Check if outside program parameter list. If so, then reset dimensions - // - } - else if (tagName.equals("arrayOfStruct")) - { - newNode = new PcmlStruct(attrs); - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - - } - else if (equivQName.equals("arrayOfStructParm")) - { - attrs.addAttribute( new PcmlAttribute("type", // @E1A - "struct", - (true | false)) ); - newNode = new PcmlData(attrs); //@E1A - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - - } - else if (tagName.equals("xpcml")) //@E1A - { - newNode = new PcmlDocument(attrs,m_docName); //@E1A - } - else if (equivQName.equals("stringParm") || equivQName.equals("arrayOfStringParm")) //@E1A - { - - attrs.addAttribute( new PcmlAttribute("type", //@E1A - "char", - (true | false)) ); - newNode = new PcmlData(attrs); //@E1A - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else if (equivQName.equals("hexBinaryParm") || equivQName.equals("arrayOfHexBinaryParm")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("type", // @E1A - "byte", - (true | false)) ); - newNode = new PcmlData(attrs); //@E1A - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else if (equivQName.equals("intParm") || equivQName.equals("arrayOfIntParm")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("type", // @E1A - "int", - (true | false)) ); - - attrs.addAttribute( new PcmlAttribute("length", // @E1A - "4", - (true | false)) ); - - newNode = new PcmlData(attrs); //@E1A - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else if (equivQName.equals("unsignedIntParm") || equivQName.equals("arrayOfUnsignedIntParm")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("type", // @E1A - "int", - (true | false)) ); - - attrs.addAttribute( new PcmlAttribute("length", // @E1A - "4", - (true | false)) ); - - attrs.addAttribute( new PcmlAttribute("precision", // @E1A - "32", - (true | false)) ); - - newNode = new PcmlData(attrs); //@E1A - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else if (equivQName.equals("byteParm") || equivQName.equals("arrayOfByteParm")) - { - attrs.addAttribute( new PcmlAttribute("type", - "int", - (true | false)) ); - - attrs.addAttribute( new PcmlAttribute("length", - "1", - (true | false)) ); - newNode = new PcmlData(attrs); - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else if (equivQName.equals("unsignedByteParm") || equivQName.equals("arrayOfUnsignedByteParm")) - { - attrs.addAttribute( new PcmlAttribute("type", - "int", - (true | false)) ); - - attrs.addAttribute( new PcmlAttribute("length", - "1", - (true | false)) ); - - attrs.addAttribute( new PcmlAttribute("precision", - "8", - (true | false)) ); - - newNode = new PcmlData(attrs); - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else if (equivQName.equals("shortParm") || equivQName.equals("arrayOfShortParm")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("type", // @E1A - "int", - (true | false)) ); - - attrs.addAttribute( new PcmlAttribute("length", // @E1A - "2", - (true | false)) ); - newNode = new PcmlData(attrs); - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else if (equivQName.equals("unsignedShortParm") || equivQName.equals("arrayOfUnsignedShortParm")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("type", // @E1A - "int", - (true | false)) ); - - attrs.addAttribute( new PcmlAttribute("length", // @E1A - "2", - (true | false)) ); - - attrs.addAttribute( new PcmlAttribute("precision", // @E1A - "16", - (true | false)) ); - - newNode = new PcmlData(attrs); - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else if (equivQName.equals("longParm") || equivQName.equals("arrayOfLongParm")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("type", // @E1A - "int", - (true | false)) ); - - attrs.addAttribute( new PcmlAttribute("length", // @E1A - "8", - (true | false)) ); - newNode = new PcmlData(attrs); - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else if (equivQName.equals("unsignedLongParm") || equivQName.equals("arrayOfUnsignedLongParm")) - { - attrs.addAttribute( new PcmlAttribute("type", - "int", - (true | false)) ); - - attrs.addAttribute( new PcmlAttribute("length", - "8", - (true | false)) ); - - attrs.addAttribute( new PcmlAttribute("precision", - "64", - (true | false)) ); - - newNode = new PcmlData(attrs); - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else if (equivQName.equals("floatParm") || equivQName.equals("arrayOfFloatParm")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("type", // @E1A - "float", - (true | false)) ); - - attrs.addAttribute( new PcmlAttribute("length", // @E1A - "4", - (true | false)) ); - - newNode = new PcmlData(attrs); - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else if (equivQName.equals("doubleParm") || equivQName.equals("arrayOfDoubleParm")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("type", // @E1A - "float", - (true | false)) ); - - attrs.addAttribute( new PcmlAttribute("length", // @E1A - "8", - (true | false)) ); - - newNode = new PcmlData(attrs); //@E1A - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else if (equivQName.equals("zonedDecimalParm") || equivQName.equals("arrayOfZonedDecimalParm")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("type", // @E1A - "zoned", - (true | false)) ); - newNode = new PcmlData(attrs); //@E1A - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else if (equivQName.equals("packedDecimalParm") || equivQName.equals("arrayOfPackedDecimalParm")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("type", // @E1A - "packed", - (true | false)) ); - newNode = new PcmlData(attrs); - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else if (equivQName.equals("dateParm") || equivQName.equals("arrayOfDateParm")) - { - attrs.addAttribute( new PcmlAttribute("type", - "date", - (true | false)) ); - newNode = new PcmlData(attrs); - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else if (equivQName.equals("timeParm") || equivQName.equals("arrayOfTimeParm")) - { - attrs.addAttribute( new PcmlAttribute("type", - "time", - (true | false)) ); - newNode = new PcmlData(attrs); - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else if (equivQName.equals("timestampParm") || equivQName.equals("arrayOfTimestampParm")) - { - attrs.addAttribute( new PcmlAttribute("type", - "timestamp", - (true | false)) ); - newNode = new PcmlData(attrs); - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else if (equivQName.equals("structParm")) //@E1A - { - attrs.addAttribute( new PcmlAttribute("type", // @E1A - "struct", - (true | false)) ); - newNode = new PcmlData(attrs); //@E1A - // Check if this is a user-defined element. Update field in docNode if so - if (uDefinedQName) - newNode.setCondensedName(qName); - } - else - { - // Unrecognized tag name should never happen, if the tags parse successfully - newNode = null; - } - - if (newNode != null) - { - if (extendedType) - { - newNode.setIsExtendedType(true); - } - if (m_rootNode == null) - { - m_rootNode = (PcmlDocument) newNode; - m_currentNode = newNode; - } - else - { - if (m_currentNode != null) m_currentNode.addChild(newNode); - m_currentNode = newNode; - } - } - } // end if firstInstance - else - { - // Not first instance of node so we need to retrieve the node from the tree and set - // it to current node - if (m_currentNode.getNodeType()== PcmlNodeType.STRUCT && !equivQName.equals("struct_i") || - (m_currentNode.getNodeType()==PcmlNodeType.DATA && m_currentNode.getAttributeValue("type").equals("struct") ) && - !equivQName.equals("struct_i")) - { - String pName=""; - for (int attr = 0; attr < curList.getLength(); attr++) - { - if (curList.getQName(attr).equals("name")) - pName = curList.getValue(attr); - } - - Enumeration items; - PcmlNode child=null; - - items = m_currentNode.getChildren(); - if (items == null) - return; - - boolean found=false; - while (items.hasMoreElements() && !found) - { - child = (PcmlNode) items.nextElement(); - if (child.getName().equals(pName)) - found=true; - } - m_currentNode = (PcmlDocNode) child; - } - } - } // end docIsXPCML - - } - - - /*** @E1A - New for XPCML **/ - /** Characters. This is the actual text of the elements */ - /* We need this method in XPCML because data can be */ - /** passed in on input. */ - public void characters(char ch[], int start, int length) throws SAXException { - - if (m_currentNode != null && - m_currentNode.getNodeType() == PcmlNodeType.DATA && - (m_currentNode.getAttributeValue("type") == null || - !m_currentNode.getAttributeValue("type").equals("struct"))) //@E1A - { - //@E1A - String str = new String(ch,start,length); //@E1A - - // Set the value based on the dimensions - if (!getKnownArrayTypes().contains(lastQName)) - { - // Concatenate to current value of init - // if (str.trim().length() > 0) - // { - if (lastQName.equals("i")) - { - if (str.indexOf(0x0a) != -1) - { - initValue = initValue+str.substring(0,str.indexOf(0x0a)); //@E1A - } - else - initValue = initValue+str; - } - else - initValue = initValue+str; - // } - - try - { - - // Need to determine if current node's type is byte and decode the string to - // a byte array if so - if (m_currentNode.getAttributeValue("type").equals("byte")) - { - // Need to convert hex input to bytes - byte[] byteA = BinaryConverter.stringToBytes(initValue); - ((PcmlData) m_currentNode).setValue(byteA, dimensions); - } - else - { - if (m_currentNode.getAttributeValue("type").equals("char") && - m_currentNode.getAttributeValue("isEmptyString") != null && - m_currentNode.getAttributeValue("isEmptyString").equals("true")) - { - Trace.log(Trace.PCML, "Setting an empty string"); - ( (PcmlData) m_currentNode).setValue("", new PcmlDimensions(dimensions) ); - } - else if (initValue.trim().length() > 0 || m_currentNode.getAttributeValue("type").equals("char")) - { - ( (PcmlData) m_currentNode).setInit(initValue); - ( (PcmlData) m_currentNode).setValue(initValue, dimensions); - } - } - if (!firstInstance || - lastQName.equals("i") || lastQName.equals("struct_i")) - { - // Reset init value if more than one of this node exists - // This keeps subsequent nodes from getting set with value of init value of last node - ( (PcmlData) m_currentNode).setInit(null); - } - } - catch (Exception e) - { - Trace.log(Trace.PCML,"Exception when doing setValue.", e); - Trace.log(Trace.PCML,"current node=" + m_currentNode.getQualifiedName()); - Trace.log(Trace.PCML,"initial value=" + initValue + ".."); - try - { - int length2 = ((PcmlData)m_currentNode).getLength(dimensions); - } - catch (Exception e1) - { - Trace.log(Trace.PCML,"Exception due to length not being set when doing setValue.", e); - Trace.log(Trace.PCML,"setValue not done but init attribute set."); - return; - } - throw new SAXException(e); - } - } - } //@E1A - - } // characters(char[],int,int); - - public void endElement(String uri, String localName, String qName) //@E0C - { - - String equivQName=qName; - boolean uDefinedQName=false; - - if (!docIsXPCML) - m_currentNode = (PcmlDocNode) m_currentNode.getParent(); - - if (docIsXPCML) - { - if (xsdFileStream != null) - { - // Check if this is a user defined element. If so, convert to equivalent XPCML element - if (!getKnownTypes().contains(qName)) - { - // User defined parameter. Need to find it in XSD stream. - uDefinedQName=true; - ByteArrayInputStream xmlIn = new ByteArrayInputStream(xmlOut.toByteArray()); - if (xmlIn == null) - throw new MissingResourceException(SystemResourceFinder.format(DAMRI.PCML_DTD_NOT_FOUND, new Object[] {"xmlOut"}), "xmlOut", ""); - - // Cache the line count of the header - LineNumberReader lnr = new LineNumberReader(new InputStreamReader(xmlIn)); - try - { - String line = lnr.readLine(); - boolean found=false; - while (line != null && !found) - { - if (line.indexOf("name="+"\""+qName+"\"") != -1 && line.indexOf("parm type=") != -1) - { - if (line.indexOf("parm type=string") != -1) - { - // String parm found - equivQName = "stringParm"; - found=true; - } - else if (line.indexOf("parm type=int") != -1) - { - // Int parm found - equivQName="intParm"; - found=true; - } - else if (line.indexOf("parm type=uint") != -1) - { - // Unsigned Int parm found - equivQName="unsignedIntParm"; - found=true; - } - else if (line.indexOf("parm type=hexBinary") != -1) - { - // hexBinary parm found - equivQName="hexBinaryParm"; - found=true; - } - else if (line.indexOf("parm type=byte") != -1) - { - // byte parm found - equivQName="byteParm"; - found=true; - } - else if (line.indexOf("parm type=ubyte") != -1) - { - // Unsigned Byte parm found - equivQName="unsignedByteParm"; - found=true; - } - else if (line.indexOf("parm type=short") != -1) - { - // Short parm found - equivQName="shortParm"; - found=true; - } - else if (line.indexOf("parm type=ushort") != -1) - { - // Unsigned Short parm found - equivQName="unsignedShortParm"; - found=true; - } - else if (line.indexOf("parm type=long") != -1) - { - // Long parm found - equivQName="longParm"; - found=true; - } - else if (line.indexOf("parm type=ulong") != -1) - { - // Unsigned Long parm found - equivQName="unsignedLongParm"; - found=true; - } - else if (line.indexOf("parm type=float") != -1) - { - // Float parm found - equivQName="floatParm"; - found=true; - } - else if (line.indexOf("parm type=double") != -1) - { - // Double parm found - equivQName="doubleParm"; - found=true; - } - else if (line.indexOf("parm type=packed") != -1) - { - // Packed parm found - equivQName="packedDecimalParm"; - found=true; - } - else if (line.indexOf("parm type=zoned") != -1) - { - // Zoned parm found - equivQName="zonedDecimalParm"; - found=true; - } - else if (line.indexOf("parm type=date") != -1) - { - // Date parm found - equivQName="dateParm"; - found=true; - } - else if (line.indexOf("parm type=time") != -1) - { - // Time parm found - equivQName="timeParm"; - found=true; - } - else if (line.indexOf("parm type=timestamp") != -1) - { - // Timestamp parm found - equivQName="timestampParm"; - found=true; - } - else if (line.indexOf("parm type=structParm") != -1) - { - // Struct parm found - equivQName="structParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfString") != -1) - { - // String parm found - equivQName = "arrayOfStringParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfInt") != -1) - { - // Int parm found - equivQName="arrayOfIntParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfUInt") != -1) - { - // Unsigned Int parm found - equivQName="arrayOfUnsignedIntParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfHexBinary") != -1) - { - // hexBinary parm found - equivQName="arrayOfHexBinaryParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfByte") != -1) - { - // Byte parm found - equivQName="arrayOfByteParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfUByte") != -1) - { - // Unsigned Byte parm found - equivQName="arrayOfUnsignedByteParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfShort") != -1) - { - // Short parm found - equivQName="arrayOfShortParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfUShort") != -1) - { - // Unsigned Short parm found - equivQName="arrayOfUnsignedShortParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfLong") != -1) - { - // Long parm found - equivQName="arrayOfLongParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfULong") != -1) - { - // Unsigned Long parm found - equivQName="arrayOfUnsignedLongParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfFloat") != -1) - { - // Float parm found - equivQName="arrayOfFloatParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfDouble") != -1) - { - // Double parm found - equivQName="arrayOfDoubleParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfPacked") != -1) - { - // Packed parm found - equivQName="arrayOfPackedDecimalParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfZoned") != -1) - { - // Zoned parm found - equivQName="arrayOfZonedDecimalParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfDate") != -1) - { - // Date parm found - equivQName="arrayOfDateParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfTime") != -1) - { - // Time parm found - equivQName="arrayOfTimeParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfTimestamp") != -1) - { - // Timestamp parm found - equivQName="arrayOfTimestampParm"; - found=true; - } - else if (line.indexOf("parm type=arrayOfStructParm") != -1) - { - // Struct parm found - equivQName="arrayOfStructParm"; - found=true; - } - else if (line.indexOf("parm type=structArray") != -1) - { - // Struct parm found - equivQName="arrayOfStruct"; - found=true; - } - { - // Should never reach here. Should get parse error if invalid type passed in - // What should I do here? - Trace.log(Trace.PCML,"Error parsing xsd stream in endElement:", line); - } - } - line=lnr.readLine(); - } - } - catch (IOException e) - { - Trace.log(Trace.PCML,"Error reading xsd stream in endElement.", e); - } - } - } - - - if (!equivQName.equals("parameterList") && !equivQName.equals("i") && !equivQName.equals("struct_i")) - m_currentNode = (PcmlDocNode) m_currentNode.getParent(); - - // Backing up tree. Reset dimensions and current dimension - if (!getKnownArrayTypes().contains(equivQName)) - { - dimensions.set(curDim, 0); //reset - curDim--; - } - } // end if docIsXPCML - } - - - // Returns a string containing the tag name enclosed in brackets. - private final static String getBracketedTagName(String tagName) - { - return "<" + tagName + ">"; - } - - - /** Determine if node is in tree already -- used for array processing ****/ - boolean inTree(String equivQName, AttributesImpl curList) - { - boolean found=false; - - String pName=""; - for (int attr = 0; attr < curList.getLength(); attr++) - { - if (curList.getQName(attr).equals("name")) - pName = curList.getValue(attr); - } - - Enumeration items; - PcmlNode child=null; - - items = m_currentNode.getChildren(); - if (items != null) - { - while (items.hasMoreElements() && !found) - { - child = (PcmlNode) items.nextElement(); - if (child.getName().equals(pName) && pName != "") - found=true; - } - } - return found; - } - - - // See Java Bug ID 4806878, http://developer.java.sun.com/developer/bugParade/bugs/4806878.html: - // "[The] W3C XML Spec says that validation errors are not fatalerrors. And DefaultHandler implementation doesn't print out any errors for the validation errors. If user is interested in seeing the validation errors, then they need to extend the DefaultHandler [by re-implementing error() and fatalerror().]" - - public void warning(SAXParseException spe) - throws SAXException - { - if (exceptionIfParseError_) - { - // new behavior (consistent with RfmlSAXParser) - if (m_xh == null) throw spe; - else m_xh.warning(spe); - } - else - { - // old behavior - Trace.log(Trace.PCML, "[Warning]: "+ spe.getMessage()); - } - } - public void error(SAXParseException spe) - throws SAXException - { - if (exceptionIfParseError_) - { - // new behavior (consistent with RfmlSAXParser) - if (m_xh == null) throw spe; - else m_xh.error(spe); - } - else - { - // old behavior - Trace.log(Trace.PCML, "[Error]: "+ spe.getMessage()); - } - } - public void fatalError(SAXParseException spe) - throws SAXException - { - if (m_xh == null) throw spe; - else m_xh.error(spe); - } - - - // Note: After the HashSet is initially built, it is never modified. - // Therefore we don't need to synchronize accesses after it is built. - private static HashSet getKnownTypes() - { - if (knownTypes_ == null) - { - synchronized (PcmlSAXParser.class) - { - if (knownTypes_ == null) - { - knownTypes_ = new HashSet(50); - knownTypes_.addAll(getKnownArrayTypes()); - String[] types = - { - "byteParm", - "dateParm", - "doubleParm", - "floatParm", - "hexBinaryParm", - "intParm", - "longParm", - "packedDecimalParm", - "parameterList", // no corresponding 'array' type - "program", // no corresponding 'array' type - "shortParm", - "stringParm", - "struct", - "structParm", - "timeParm", - "timestampParm", - "unsignedByteParm", - "unsignedIntParm", - "unsignedLongParm", - "unsignedShortParm", - "xpcml", // no corresponding 'array' type - "zonedDecimalParm" - // 41 types (including 19 array types): 12 new, plus 29 old - }; - for (int i=0; icom.ibm.as400.access.Trace. - * - * @see com.ibm.as400.access.Trace - */ - void reportErrors() - { - Trace.log(Trace.PCML, this); - - int count = m_messages.size(); - for (int i = 0; i < count; i++) - Trace.log(Trace.PCML, (String)(m_messages.elementAt(i))); - - if (count == 1) - Trace.log(Trace.PCML, SystemResourceFinder.format(DAMRI.ONE_PARSE_ERROR)); - else - { - Object[] args = { new Integer(count) }; - Trace.log(Trace.PCML, SystemResourceFinder.format(DAMRI.MANY_PARSE_ERRORS, args)); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/data/PcmlStruct.java b/cvsroot/src/com/ibm/as400/data/PcmlStruct.java deleted file mode 100644 index faee3afb3..000000000 --- a/cvsroot/src/com/ibm/as400/data/PcmlStruct.java +++ /dev/null @@ -1,1049 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PcmlStruct.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import com.ibm.as400.access.ProgramParameter; - -import java.util.Enumeration; -import java.util.Hashtable; -import java.io.OutputStream; - -class PcmlStruct extends PcmlDocNode -{ - /*********************************************************** - Static Members - ***********************************************************/ - - // Serial verion unique identifier - static final long serialVersionUID = 5539999574454926624L; - - private static final String STRUCTATTRIBUTES[] = { - "name", - "usage", - "count", - "minvrm", - "maxvrm", - "offset", - "offsetfrom", - "outputsize" - }; - - private static final int VERSION_1_ATTRIBUTE_COUNT = 8; - - /*********************************************************** - Instance Members - ***********************************************************/ - - // The "m_name" and "m_usage" attributes are implemented by PcmlDocNode - - // The following values are implemented by PcmlData and PcmlStruct - private int m_Count; // count=, integer literal - private String m_CountId; // count=, element name - private int m_Offset; // offset=, integer literal - private String m_OffsetId; // offset=, element name - private boolean m_OffsetfromFixed; // Flag indicating whether serialized version @A1A - // of this object contains fix for offsetfrom - private int m_Offsetfrom; // offsetfrom=, integer literal @A1A - private String m_OffsetfromId; // offsetfrom=, element name - private String m_Minvrm; // minvrm=, string literal - private int m_MinvrmInt; // minvrm=, from AS400.generateVRM() - private String m_Maxvrm; // maxvrm=, string literal - private int m_MaxvrmInt; // maxvrm=, from AS400.generateVRM() - private int m_Outputsize; // outputsize=, integer literal - private String m_OutputsizeId; // outputsize=, element name - - // Default constructor - PcmlStruct() - { - } - - // Constructor - public PcmlStruct(PcmlAttributeList attrs) // @C1C - { - super(attrs); // @C1C - setNodeType(PcmlNodeType.STRUCT); // @C1A - - // ********************************** - // Set attribute values - // - // The following code extracts the attribute values - // from the parsed document node and - // stores the values in private data members. - // ********************************** - - // Set count= attribute value - setCount(getAttributeValue("count")); - - // Set offset= attribute value - setOffset(getAttributeValue("offset")); - - // Set offsetfrom= attribute value - setOffsetfrom(getAttributeValue("offsetfrom")); - - // Set outputsize= member variable - setOutputsize(getAttributeValue("outputsize")); - - // Set minvrm= attribute value - setMinvrm(getAttributeValue("minvrm")); - - // Set maxvrm= attribute value - setMaxvrm(getAttributeValue("maxvrm")); - } - - /** - * Return the list of valid attributes for the data element. - **/ - String[] getAttributeList() // @C7A - { - return STRUCTATTRIBUTES; // @C7A - } - - int getCount(PcmlDimensions indices) throws PcmlException - { - return resolveIntegerValue( getCount(), - getCountId(), - indices ); - } - - // @D1 --New XPCML method - // @D1 -- Get the run-time dimension for this element but don't throw an exception if count not set - final int getXPCMLCount(PcmlDimensions indices) throws PcmlException //@D1 - { - int rc; - try { - rc = resolveIntegerValue( getCount(), - getCountId(), - indices ); - return rc; - } - catch (Exception e) - { - return 0; - } - } - - - // Returns an array of integers containing the array dimensions - // Notes: - // getDimensions().length == 0 for scalar data - PcmlDimensions getDimensions(PcmlDimensions indices) throws PcmlException - { - PcmlDimensions myDimensions = null; - PcmlNode node = getParent(); // @C8A - - // Retrieve array dimensions from all ancestors - if (node instanceof PcmlData) // @C8C - { - myDimensions = ((PcmlData) node).getDimensions(indices); // @C8C - } - else - if (node instanceof PcmlStruct) // @@C8C - { - myDimensions = ((PcmlStruct) node).getDimensions(indices); // @C8C - } - else - { - myDimensions = new PcmlDimensions(getNbrOfDimensions()); - } - - // If this node is defined as an array, add its dimension - if (isArray()) - { - int myCount = getCount(indices); - myDimensions.add(myCount); - } - - return myDimensions; - } - - // Returns an array of integers containing the timestamps - // for each of the array dimensions for this node. - // Notes: - // getNbrOfDimensions() == 0 for scalar data - // getNbrOfDimensions() == getDimensions().length - long[] getDimensionTimestamps(PcmlDimensions indices) throws PcmlException - { - long[] myTimestamps; - Integer myIndex = null; - long[] previousTimestamps; - PcmlNode node = getParent(); // @C8A - - // If an array is defined at this node, - // remove its dimension from the array of indices - if (isArray()) - { - myIndex = indices.integerAt(indices.size()-1); - indices.remove(); - } - - // Retrieve array dimensions from all ancestors - if (node instanceof PcmlData) // @C8C - { - previousTimestamps = ((PcmlData) node).getDimensionTimestamps(indices); // @C8C - } - else - if (node instanceof PcmlStruct) // @C8C - { - previousTimestamps = ((PcmlStruct) node).getDimensionTimestamps(indices); // @C8C - } - else - { - previousTimestamps = new long[0]; - } - - // If this node is defined as an array, add its dimension - // back to the array of indices and get the time stamp for this dimension. - if (myIndex != null) - { - int i; - indices.add(myIndex); - myTimestamps = new long[previousTimestamps.length + 1]; - for (i = 0; i < previousTimestamps.length; i++) - { - myTimestamps[i] = previousTimestamps[i]; - } - myTimestamps[i] = resolveDimensionTimestamp(indices); - if (i > 0) - { - myTimestamps[i] = Math.max(myTimestamps[i], myTimestamps[i-1]); - } - } - else - { - myTimestamps = previousTimestamps; - } - - return myTimestamps; - } - - // Returns the number of dimensions for this data node - // Notes: - // getNbrOfDimensions() == 0 for scalar data - // getNbrOfDimensions() == getDimensions().length - int getNbrOfDimensions() - { - int total = 0; - PcmlNode node = getParent(); // @C8A - - if (isArray()) - total++; - - if (node instanceof PcmlData) // @C8C - total += ((PcmlData)node).getNbrOfDimensions(); // @C8C - else - if (node instanceof PcmlStruct) // @C8C - total += ((PcmlStruct)node).getNbrOfDimensions(); // @C8C - - return total; - } - - // Get the run-time offset value for this element - int getOffset(PcmlDimensions indices) throws PcmlException - { - return resolveIntegerValue( getOffset(), - getOffsetId(), - indices ); - } - - // Get the offset= integer literal value, if any - public final int getOffset() - { - return m_Offset; - } - - // Get the offset= resolved element name, if any - public final String getOffsetId() - { - return resolveRelativeName(m_OffsetId); - } - - // Get the offset= unresolved element name, if any - public final String getUnqualifiedOffsetId() // @C7A - { - return m_OffsetId; // @C7A - } - - // Return indication of whether this object contains - // the fix for ofsetfrom - private final boolean isOffsetfromFixed() // @A1A - { // @A1A - return m_OffsetfromFixed; // @A1A - } // @A1A - - - // Get the offsetfrom= integer literal value, if any - final int getOffsetfrom() // @A1C - { - if ( isOffsetfromFixed() ) // @A1A - return m_Offsetfrom; // @A1C - else // @A1A - return -1; // @A1A - } - - // Get the offsetfrom= resolved element name, if any - final String getOffsetfromId() - { - return resolveRelativeName(m_OffsetfromId); - } - - // Get the offsetfrom= unresolved element name, if any - public final String getUnqualifiedOffsetfromId() // @C7A - { - return m_OffsetfromId; // @C7A - } - - // Return number of bytes to allocate in outpout buffer - int getOutputsize(PcmlDimensions indices) throws PcmlException - { - int totalSize = 0; - int myCount; - boolean processArray; - - // If outputsize= was specified for this element use that - // as the output size for this and all descendents. - totalSize = resolveIntegerValue( getOutputsize(), - getOutputsizeId(), - indices ); - if (totalSize > 0) - return totalSize; - - if (isArray() && indices.size() < getNbrOfDimensions() ) - { - myCount = getCount(indices); - processArray = true; - } - else - { - myCount = 1; - processArray = false; - } - - for (int myIndex = 0; myIndex < myCount; myIndex++) - { - - if (processArray) - { - indices.add(myIndex); - } - - Enumeration children; - PcmlDocNode child; - - children = getChildren(); - while (children.hasMoreElements()) - { - child = (PcmlDocNode) children.nextElement(); - switch (child.getNodeType()) - { - case PcmlNodeType.STRUCT: - totalSize += ((PcmlStruct) child).getOutputsize(indices); - break; - case PcmlNodeType.DATA: - totalSize += ((PcmlData) child).getOutputsize(indices); - break; - default: - throw new PcmlException(DAMRI.BAD_NODE_TYPE, new Object[] {new Integer(child.getNodeType()) , getNameForException()} ); - } - } - - if (processArray) - { - indices.remove(); - } - - } // END: for myIndex - - return totalSize; - } - - - boolean isArray() - { - if ( getCount() > 0 ) - return true; - else - if ( getCountId() != null ) - return true; - - return false; - } - - // Returns true if this node is defined as an array or - // has an ancestor defined as an array. - boolean isInArray() - { - PcmlNode node = getParent(); // @C8A - if (isArray()) - return true; - else - if (node instanceof PcmlData) // @C8C - return ((PcmlData)node).isArray(); // @C8C - else - if (node instanceof PcmlStruct) // @C8C - return ((PcmlStruct)node).isArray(); // @C8C - else - return false; - } - - public int getCount() - { - return m_Count; - } - - public String getCountId() - { - return resolveRelativeName(m_CountId); - } - - // Get the count= unresolved element name, if any - public final String getUnqualifiedCountId() // @C7A - { - return m_CountId; // @C7A - } - - // Get the maxvrm= integer value -- compatible w/ AS400.generateVRM() - // Returns Integer.MAX_VALUE is maxvrm= was not specified - public final int getMaxvrm() - { - return m_MaxvrmInt; - } - - // Get the maxvrm= String value - public final String getMaxvrmString() // @C7A - { - return m_Maxvrm; - } - - // Get the minvrm= integer value -- compatible w/ AS400.generateVRM() - // Returns Integer.MIN_VALUE minvrm= was not specified - public final int getMinvrm() - { - return m_MinvrmInt; - } - - // Get the minvrm= String value - public final String getMinvrmString() // @C7A - { - return m_Minvrm; - } - - - // Get the outputsize= integer literal value, if any - public final int getOutputsize() - { - return m_Outputsize; - } - - // Get the outputsize= resolved element name, if any - public final String getOutputsizeId() - { - return resolveRelativeName(m_OutputsizeId); - } - - // Get the outputsize= unresolved element name, if any - public final String getUnqualifiedOutputsizeId() // @C7A - { - return m_OutputsizeId; // @C7A - } - - private void setCount(String count) - { - if (count == null || count.equals("")) - { - m_Count = 0; - m_CountId = null; - return; - } - - try - { - m_Count = Integer.parseInt(count); - m_CountId = null; - } - catch (NumberFormatException e) - { - m_Count = 0; - m_CountId = count; - // checkAttributes() will make sure m_CountId resolves to a element with type="int" - } - } - - private void setMaxvrm(String maxvrm) - { - m_MaxvrmInt = Integer.MAX_VALUE; - if (maxvrm == null || maxvrm.equals("")) - { - m_Maxvrm = null; - return; - } - - m_Maxvrm = maxvrm; - } - - private void setMinvrm(String minvrm) - { - m_MinvrmInt = Integer.MIN_VALUE; - if (minvrm == null || minvrm.equals("")) - { - m_Minvrm = null; - return; - } - - m_Minvrm = minvrm; - } - - private void setOffset(String offset) - { - if (offset == null || offset.equals("")) - { - m_Offset = 0; - m_OffsetId = null; - return; - } - - try - { - m_Offset = Integer.parseInt(offset); - m_OffsetId = null; - } - catch (NumberFormatException e) - { - m_Offset = 0; - m_OffsetId = offset; - // checkAttributes() will make sure m_OffsetId resolves to a element with type="int" - } - } - - private void setOffsetfrom(String offsetfrom) - { - m_OffsetfromFixed = true; // @A1A - // Handle null or empty string - if (offsetfrom == null || offsetfrom.equals("")) - { - m_Offsetfrom = -1; // @A1A - m_OffsetfromId = null; - return; - } - - try // @A1A - { // @A1A - m_Offsetfrom = Integer.parseInt(offsetfrom); // @A1A - m_OffsetfromId = null; // @A1A - } // @A1A - catch (NumberFormatException e) // @A1A - { // @A1A - m_Offsetfrom = 0; // @A1A - m_OffsetfromId = offsetfrom; - // checkAttributes() will make sure m_OffsetfromId resolves to a document element that - // an ancestor of this node. - } // @A1A - } - - private void setOutputsize(String outputsize) - { - // Handle null or empty string - if (outputsize == null || outputsize.equals("")) - { - m_Outputsize = 0; - return; - } - - // Try to parse an integer from the attribute value - try - { - m_Outputsize = Integer.parseInt(outputsize); - m_OutputsizeId = null; - } - // If value is not an integer, it must be an element name - // checkAttributes() will be caled later to verify the element name - catch (NumberFormatException e) - { - m_Outputsize = 0; - m_OutputsizeId = outputsize; - // checkAttributes() will make sure m_OutputsizeId resolves to a element with type="int" - } - } - - protected void checkAttributes() - { - //String resolvedName = null; - PcmlDocNode resolvedNode; - - super.checkAttributes(); - - // Verify the count= attribute - // If an integer was specified for the count, no checking is needed. - // If a document element ID was was specified, make sure - // it resolves to a element with type="int". - if (m_CountId != null) - { - resolvedNode = resolveRelativeNode(m_CountId); - if (resolvedNode == null) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_NOT_FOUND, new Object[] {makeQuotedAttr("count", m_CountId), getNameForException()} ); - } - else - { - if (resolvedNode instanceof PcmlData) - { - if ( ((PcmlData)resolvedNode).getDataType() != PcmlData.INT ) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_WRONG_NODETYPE, new Object[] {makeQuotedAttr("count", m_CountId), resolvedNode.getQualifiedName(), "", getNameForException()} ); - } - } - else - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_WRONG_DATATYPE, new Object[] {makeQuotedAttr("count", m_CountId), resolvedNode.getQualifiedName(), "type=\"int\"", getNameForException()} ); - } - } - } - else - // Do not allow count= to be a literal value that is negative - if (m_Count < 0) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("count", m_Count), getBracketedTagName(), getNameForException()} ); // @A1C - } - - // Verify the offset= attribute - // If an integer was specified for the offset, no checking is needed. - // If a document element ID was was specified, make sure - // it resolves to a element with type="int". - if (m_OffsetId != null) - { - resolvedNode = resolveRelativeNode(m_OffsetId); - if (resolvedNode == null) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_NOT_FOUND, new Object[] {makeQuotedAttr("offset", m_OffsetId), getNameForException()} ); - } - else - { - if (resolvedNode instanceof PcmlData) - { - if ( ((PcmlData)resolvedNode).getDataType() != PcmlData.INT ) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_WRONG_NODETYPE, new Object[] {makeQuotedAttr("offset", m_OffsetId), resolvedNode.getQualifiedName(), "", getNameForException()} ); - } - } - else - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_WRONG_DATATYPE, new Object[] {makeQuotedAttr("offset", m_OffsetId), resolvedNode.getQualifiedName(), "type=\"int\"", getNameForException()} ); - } - } - } - else - // Do not allow offset= to be a literal value that is negative - if (m_Offset < 0) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("offset", m_Offset), getBracketedTagName(), getNameForException()} ); // @A1C - } - - // Verify the offsetfrom= attribute - // If a document element ID was was specified, make sure - // it resolves to a document element that is an ancestor of this element. - if (m_OffsetfromId != null) - { - resolvedNode = resolveRelativeNode(m_OffsetfromId); - if (resolvedNode == null) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_NOT_FOUND, new Object[] {makeQuotedAttr("offsetfrom", m_OffsetfromId), getNameForException()} ); - } - else - { - String qName = getQualifiedName(); - if (qName.equals("")) // @A1A - { // @A1A - qName = getNameForException(); // @A1A - } // @A1A - String qNameResolved = resolvedNode.getQualifiedName(); - if (!qName.startsWith(qNameResolved + ".")) - { - getDoc().addPcmlSpecificationError(DAMRI.OFFSETFROM_NOT_FOUND, new Object[] {m_OffsetfromId, getNameForException()} ); - } - } - } - else // @A1A - // Do not allow offsetfrom= to be a literal value that is negative - if (m_Offsetfrom < -1) // @A1A - { // @A1A - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("offsetfrom", m_Offsetfrom), getBracketedTagName(), getNameForException()} ); // @A1A - } // @A1A - - // Verify the minvrm= attribute - if (m_Minvrm != null) - { - m_MinvrmInt = PcmlData.validateVRM(m_Minvrm); - if (m_MinvrmInt <= 0) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("minvrm", m_Minvrm), getBracketedTagName(), getNameForException()} ); // @A1C - } - } - - - // Verify the maxvrm= attribute - if (m_Maxvrm != null) - { - m_MaxvrmInt = PcmlData.validateVRM(m_Maxvrm); - if (m_MaxvrmInt <= 0) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("maxvrm", m_Maxvrm), getBracketedTagName(), getNameForException()} ); // @A1C - } - } - - // Verify the outputsize= attribute - // If an integer was specified for the offset, make sure it is in valid range. - // If a document element ID was was specified, make sure - // it resolves to a element with type="int". - if (m_OutputsizeId != null) - { - resolvedNode = resolveRelativeNode(m_OutputsizeId); - if (resolvedNode == null) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_NOT_FOUND, new Object[] {makeQuotedAttr("outputsize", m_OutputsizeId), getNameForException()} ); - } - else - { - if (resolvedNode instanceof PcmlData) - { - if ( ((PcmlData)resolvedNode).getDataType() != PcmlData.INT ) - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_WRONG_NODETYPE, new Object[] {makeQuotedAttr("outputsize", m_OutputsizeId), resolvedNode.getQualifiedName(), "", getNameForException()} ); - } - } - else - { - getDoc().addPcmlSpecificationError(DAMRI.ATTR_REF_WRONG_DATATYPE, new Object[] {makeQuotedAttr("outputsize", m_OutputsizeId), resolvedNode.getQualifiedName(), "type=\"int\"", getNameForException()} ); - } - } - } - else - // Do not allow offset= to be a literal value that is negative - if (m_Outputsize < 0) - { - getDoc().addPcmlSpecificationError(DAMRI.BAD_ATTRIBUTE_VALUE, new Object[] {makeQuotedAttr("outputsize", m_Outputsize), getBracketedTagName(), getNameForException()} ); // @A1C - } - - } - - - // Returns true if this document element is supported at the - // at the VRM of the current host. - // Returns false if not. - boolean isSupportedAtHostVRM() throws PcmlException // @A1A - { // @A1A - int hostVrm = getAs400VRM(); // VRM of the IBM i system @A1A - - // If the minvrm= for this element is greater than the server VRM - // do not process this element. The item is not available at this release. - if (getMinvrm() > hostVrm) // @A1A - { // @A1A - return false; // @A1A - } // @A1A - - // If the maxvrm= for this element is less than the server VRM - // do not process this element. The item is not available at this release. - if (getMaxvrm() < hostVrm) // @A1A - { // @A1A - return false; // @A1A - } // @A1A - - return true; // @A1A - } // @A1A - - // Convert data to IBM i system format - // Returns the number of bytes to'ed - int toBytes(OutputStream bytes, int offset, PcmlDimensions indices) throws PcmlException - { - Enumeration children; - PcmlDocNode child; - int totalBytes = 0; - int myCount; - boolean processArray; - - // Do not process if this element is not supported at the - // VRM of the current host. - if ( !isSupportedAtHostVRM() ) // @A1C - return 0; - - // If this is an array element, set up array processing information - if (isArray() && indices.size() < getNbrOfDimensions() ) - { - myCount = getCount(indices); - processArray = true; - } - else // Non-array element, only process once. - // Note: Although this element is not an array - // (i.e. does not have a count= attribute) - // It may be a child of an element that is an array. - { - myCount = 1; - processArray = false; - } - - for (int myIndex = 0; myIndex < myCount; myIndex++) - { - - if (processArray) - { - indices.add(myIndex); - } - - children = getChildren(); - while (children.hasMoreElements()) - { - child = (PcmlDocNode) children.nextElement(); - - switch (child.getNodeType()) - { - case PcmlNodeType.STRUCT: - totalBytes += ((PcmlStruct) child).toBytes(bytes, offset + totalBytes, indices); - break; - case PcmlNodeType.DATA: - totalBytes += ((PcmlData) child).toBytes(bytes, offset + totalBytes, indices); - break; - default: - throw new PcmlException(DAMRI.BAD_NODE_TYPE, new Object[] {new Integer(child.getNodeType()) , getNameForException()} ); - } // END: switch (child.getNodeType()) - } // END: while (children.hasMoreElements()) - - if (processArray) - { - indices.remove(); - } - - } - - return totalBytes; - } // END: public int toBytes(OutputStream bytes, int offset, PcmlDimensions indices) - - // Parses array of bytes and stores for later conversion - // to Java objects. This allows for lazy data translation - // for performance. - // Returns the number of bytes consumed from the input byte array - // Note: This may be larger than the number of bytes saved for this element - // because of bytes skipped due to an offset value. - int parseBytes(byte[] bytes, int offset, Hashtable offsetStack, PcmlDimensions indices) throws PcmlException - { - PcmlData dataNode; // Child of this element that is a node - PcmlStruct structNode; // Child of this element that is a node - int nbrBytes = 0; // Number of bytes consumed from input byte array - Enumeration children; // Enumeration of children of this element - PcmlDocNode child; // Current child node being processed - boolean processArray; // Indicates whether this element is an array - int myCount; // Number of array elements to process, - // or set to 1 for non-array elements - - // Do not process if this element is not supported at the - // VRM of the current host. - if ( !isSupportedAtHostVRM() ) // @A1C - return 0; - - // If this is an array element, set up array processing information - if (isArray() && indices.size() < getNbrOfDimensions() ) - { - myCount = getCount(indices); - processArray = true; - } - else // Non-array element, only process once. - // Note: Although this element is not an array - // (i.e. does not have a count= attribute) - // It may be a child of an element that is an array. - { - myCount = 1; - processArray = false; - } - - // ----------------------------------------------------------- - // Calculate bytes to skip based on the offset= - // and offsetfrom= attributes. - // ----------------------------------------------------------- - int skipBytes = 0; // Initially, no need to skip bytes - int myOffset = getOffset(indices); // Retrieve offset value for this element - if (myOffset > 0) // If this element has a non-zero offset - { - // Determine from where the offset is based - Integer myOffsetbase = null; - String myOffsetfromId = getOffsetfromId(); // Get offsetfrom= element name, if any @A1C - - // If offsetfrom= was specified with the name of another element, - // get the base for the offset from the offset stack. - // The offset stack is a stack of beginning offsets for all - // ancestors of the current element. The offsetfrom= value must be one - // of these ancestors or an error will be reported. - if (myOffsetfromId != null) // @A1C - { - myOffsetbase = (Integer) offsetStack.get(myOffsetfromId); // @A1C - if (myOffsetbase == null) - { - throw new PcmlException(DAMRI.OFFSETFROM_NOT_FOUND, new Object[] {myOffsetfromId, getNameForException()} ); // @A1C - } - } - else - { - // If offsetfrom= was specified with an integer literal, use it. - if (getOffsetfrom() >= 0) // @A1A - { // @A1A - myOffsetbase = new Integer(getOffsetfrom()); // @A1A - } // @A1A - // getOffsetfrom() returns -1 to indicate that offset from was not specified. - // No offsetfrom= was specified, the offset will be relative to the - // beginning offset of the parent of this elements parent. - // This is the first (most recent) entry in the offset stack. - else // @A1A - { // @A1A - myOffsetbase = (Integer) offsetStack.get( ((PcmlDocNode) getParent()).getQualifiedName()); - } // @A1A - } - - // Add the base value to the offset value - if (myOffsetbase != null) - { - myOffset = myOffset + myOffsetbase.intValue(); - } - - // If the total offset value is greater than the current - // offset into the input byte array, calculate the - // number of bytes to skip. - // (Bytes skipped over as a result ofthe offset=.) - if (myOffset > offset) - { - skipBytes = myOffset - offset; - } - } // End calculating bytes to skip because of offset= attribute - - // ----------------------------------------------------------- - // Now actually parse the bytes for this element - // ----------------------------------------------------------- - for (int myIndex = 0; myIndex < myCount; myIndex++) - { - - // ----------------------------------------------------------- - // Add this node to the offset stack - // This element's current offset is put in the stack for use by descendent elements - // to resolve their offset= attributes. - // ----------------------------------------------------------- - String qName = getQualifiedName(); - if (!qName.equals("")) - { - offsetStack.put(qName, new Integer(offset + skipBytes + nbrBytes)); // pva 10/30 - } - - // Add the current index for this dimension to the indices - if (processArray) - { - indices.add(myIndex); - } - - // Process each child element in this structure. - children = getChildren(); - while (children.hasMoreElements()) - { - child = (PcmlDocNode) children.nextElement(); - switch (child.getNodeType()) - { - case PcmlNodeType.STRUCT: - structNode = (PcmlStruct) child; - nbrBytes += structNode.parseBytes(bytes, offset + skipBytes + nbrBytes, offsetStack, indices); - break; - case PcmlNodeType.DATA: - dataNode = (PcmlData) child; - nbrBytes += dataNode.parseBytes(bytes, offset + skipBytes + nbrBytes, offsetStack, indices); - break; - default: - throw new PcmlException(DAMRI.BAD_NODE_TYPE, new Object[] {new Integer(child.getNodeType()) , getNameForException()} ); - } // END: switch (child.getNodeType()) - } // END: while (children.hasMoreElements()) - - // Remove the current index for this dimension from the indices - if (processArray) - { - indices.remove(); - } - // ----------------------------------------------------------- - // Remove this node from the offset stack - // ----------------------------------------------------------- - if (!qName.equals("")) - { - offsetStack.remove(qName); - } - - } // END: for myIndex - - - return nbrBytes + skipBytes; - } // public int parseBytes(byte[] bytes, int offset) - - // Resolve an integer value from either a named element or a literal - private int resolveIntegerValue(int intLiteral, String name, PcmlDimensions indices) throws PcmlException - { - PcmlNode node; - PcmlData dataNode; - Object nodeValue; - - if (name != null) - { - node = getDoc().getElement(name); - if (node instanceof PcmlData) - { - dataNode = (PcmlData) node; - nodeValue = dataNode.getValue(indices); - if (nodeValue instanceof String) - { - return Integer.parseInt((String) nodeValue); - } - else if (nodeValue instanceof Number) - { - return ((Number) nodeValue).intValue(); - } - else - { - if (nodeValue == null) - throw new PcmlException(DAMRI.INPUT_VALUE_NOT_SET, new Object[] {dataNode.getNameForException()} ); - else - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {nodeValue.getClass().getName(), dataNode.getNameForException()} ); - } - } - else - { - if (node == null) - throw new PcmlException(DAMRI.ELEMENT_NOT_FOUND, new Object[] {name, ""} ); - else - throw new PcmlException(DAMRI.WRONG_ELEMENT_TYPE, new Object[] {name, ""} ); - } - } - return intLiteral; - } - - // Resolve a timestamp for the given indices - private long resolveDimensionTimestamp(PcmlDimensions indices) throws PcmlException - { - PcmlNode node; - String name = getCountId(); - if (name != null) - { - node = getDoc().getElement(name); - if (node instanceof PcmlData) - { - return ((PcmlData)node).getTimestamp(indices); - } - else - { - if (node == null) - throw new PcmlException(DAMRI.ELEMENT_NOT_FOUND, new Object[] {name, ""} ); - else - throw new PcmlException(DAMRI.WRONG_ELEMENT_TYPE, new Object[] {name, ""} ); - } - } - return Long.MIN_VALUE; - } -} diff --git a/cvsroot/src/com/ibm/as400/data/ProgramCallDocument.java b/cvsroot/src/com/ibm/as400/data/ProgramCallDocument.java deleted file mode 100644 index 46f2e0ee1..000000000 --- a/cvsroot/src/com/ibm/as400/data/ProgramCallDocument.java +++ /dev/null @@ -1,1946 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Tolbox for Java - OSS version) -// -// Filename: ProgramCallDocument.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.BidiStringType; -import com.ibm.as400.access.ObjectDoesNotExistException; -import com.ibm.as400.access.ErrorCompletingRequestException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.SystemProperties; -import com.ibm.as400.access.Trace; // @C4A -import com.ibm.as400.access.ProgramCall; - -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.io.StreamCorruptedException; -import java.io.ByteArrayOutputStream; //@E1A -import java.io.ByteArrayInputStream; //@E1A -import java.io.BufferedInputStream; //@E1A -import java.io.OutputStream; //@E1A -import java.io.InputStreamReader; //@E1A -import java.io.LineNumberReader; //@E1A - - - -import java.util.MissingResourceException; - -import java.util.zip.GZIPInputStream; - -import javax.xml.transform.TransformerException; //@E1A -import org.xml.sax.SAXException; //@E1A - - -/** - * XML Document based program call. - * - * The ProgramCallDocument class uses a Program Call Markup Language (PCML) document to - * call IBM i system programs. - * PCML is an XML language for describing the input and output parameters - * to the IBM i system program. - * - * This class parses a PCML document and allows the application to call - * IBM i system programs described in the PCML document. - * - *

      Command Line Interface

      - * The command line interface may be used to serialize - * PCML document definitions. Note that XPCML documents cannot - * be serialized. - *
      - * java com.ibm.as400.data.ProgramCallDocument
      - *     -serialize
      - *     PCML document name
      - * 
      - * Options: - *
      - *
      -serialize - *
      Parses the PCML document and creates a serialized version of the document. - * The name of the serialized file will match the document name, and the file extension will be - * .pcml.ser (lowercase). - *

      PCML document name - *
      The fully-qualified resource name of the PCML document - * which defines the program interface. - *
      - */ -public class ProgramCallDocument implements Serializable, Cloneable -{ // @C1C @C3C - static final long serialVersionUID = -1836686444079106483L; // @C1A - - /** - * Constant indicating a serialized PCML or XPCML document is being streamed. - * @see #ProgramCallDocument(AS400,String,InputStream,ClassLoader,InputStream,int) - **/ - public static final int SERIALIZED = 0; - - /** - * Constant indicating a source PCML document is being streamed. - * @see #ProgramCallDocument(AS400,String,InputStream,ClassLoader,InputStream,int) - **/ - public static final int SOURCE_PCML = 1; - - /** - * Constant indicating a source XPCML document is being streamed. - * @see #ProgramCallDocument(AS400,String,InputStream,ClassLoader,InputStream,int) - **/ - public static final int SOURCE_XPCML = 2; - - private AS400 m_as400; - private PcmlDocument m_pcmlDoc; - static boolean exceptionIfParseError_; - static - { - String property = null; - try { - property = SystemProperties.getProperty(SystemProperties.THROW_SAX_EXCEPTION_IF_PARSE_ERROR); - } - catch (Throwable t) {} - if (property == null) { // Property not set. - exceptionIfParseError_ = false; - } - else if (property.trim().equalsIgnoreCase("true")) { - exceptionIfParseError_ = true; - } - else { - exceptionIfParseError_ = false; - } - } - - /** - Constructs a ProgramCallDocument object. - The PCML or XPCML document resource will be loaded from the classpath. - If the document is a PCML document, the classpath will first be searched for a serialized resource. - XPCML documents cannot be serialized. - If a serialized resource is not found, the classpath will be - searched for a PCML or XPCML source file. - - @param sys The system on which to run the program. - @param docName The document resource name of the PCML document for the programs to be called. - All PCML-related file extensions are assumed to be lowercase (for example, .pcml or .pcml.ser). - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myPcml" - - @exception PcmlException when the specified PCML document cannot be found - */ - public ProgramCallDocument(AS400 sys, String docName) - throws PcmlException - { - if (sys == null) warnNull("sys"); - if (docName == null) warnNull("docName"); - - m_as400 = sys; - - m_pcmlDoc = loadPcmlDocument(docName, null,null); // @C8C @E1C - if (m_as400 != null) m_pcmlDoc.setAs400(m_as400); - } - - /** - Constructs a ProgramCallDocument object. - The XPCML document resource will be loaded from the classpath and parsed using - the XML schema definitions provided in the input XSD stream. - - @param sys The system on which to run the program. - @param docName The document resource name of the PCML document for the programs to be called. - All PCML-related file extensions are assumed to be lowercase (for example, .pcml or .pcml.ser). - @param xsdStream An input stream that contains XML schema definitions that extend XPCML. - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myPcml" - - @exception PcmlException when the specified PCML document cannot be found - */ - - public ProgramCallDocument(AS400 sys, String docName, InputStream xsdStream) - throws PcmlException - { - if (sys == null) warnNull("sys"); - if (docName == null) warnNull("docName"); - - m_as400 = sys; - - m_pcmlDoc = loadPcmlDocument(docName, null,xsdStream); // @C8C - if (m_as400 != null) m_pcmlDoc.setAs400(m_as400); - - } - - /** - Constructs a ProgramCallDocument object. - The PCML or XPCML document resource will be loaded from the classpath. - If the document is a PCML document, the classpath will first be searched for a serialized resource. - XPCML documents cannot be serialized. - If a serialized resource is not found, the classpath will be - searched for a PCML or XPCML source file. - - @param sys The system on which to run the program. - @param docName The document resource name of the PCML document for the programs to be called. - All PCML-related file extensions are assumed to be lowercase (for example, .pcml or .pcml.ser). - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myPcml" - @param loader The ClassLoader that will be used when loading the specified document resource. - - @exception PcmlException when the specified PCML document cannot be found - */ - public ProgramCallDocument(AS400 sys, String docName, ClassLoader loader) // @C8A - throws PcmlException - { - if (sys == null) warnNull("sys"); - if (docName == null) warnNull("docName"); - - m_as400 = sys; // @C8A - - m_pcmlDoc = loadPcmlDocument(docName, loader,null); // @C8A - if (m_as400 != null) m_pcmlDoc.setAs400(m_as400); // @C8A - } - - - /** - Constructs a ProgramCallDocument object. - The PCML or XPCML document resource will be loaded from the classpath and parsed using - the XML schema definitions provided in the input XSD stream. - @param sys The system on which to run the program. - @param docName The document resource name of the PCML document for the programs to be called. - All PCML-related file extensions are assumed to be lowercase (for example, .pcml or .pcml.ser). - @param loader The ClassLoader that will be used when loading the specified document resource. - @param xsdStream An input stream that contains XML schema definitions that extend XPCML. This parameter can be null. - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myPcml" - - @exception PcmlException when the specified PCML document cannot be found - */ - public ProgramCallDocument(AS400 sys, String docName, ClassLoader loader, InputStream xsdStream) // @C8A - throws PcmlException - { - if (sys == null) warnNull("sys"); - if (docName == null) warnNull("docName"); - - m_as400 = sys; // @C8A - - m_pcmlDoc = loadPcmlDocument(docName, loader,xsdStream); // @C8A - if (m_as400 != null) m_pcmlDoc.setAs400(m_as400); // @C8A - } - - /** - Constructs a ProgramCallDocument object. - The PCML or XPCML document resource will be read from the specified input stream, and parsed using - the XML schema definitions provided in the input XSD stream. - @param sys The system on which to run the program. - @param docName The document resource name of the PCML document for the programs to be called. - All PCML-related file extensions are assumed to be lowercase (for example, .pcml or .pcml.ser). - @param docStream The InputStream from which to read the contents of the document. - @param loader The ClassLoader that will be used when loading the DTD for PCML. This parameter can be null. - @param xsdStream An input stream that contains XML schema definitions that extend XPCML - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myPcml". This parameter can be null. - @param type The type of data contained in docStream. Possible values are: -
        -
      • {@link #SERIALIZED SERIALIZED} - The docStream contains a serialized PCML or XPCML document. -
      • {@link #SOURCE_PCML SOURCE_PCML} - The docStream contains a PCML document. -
      • {@link #SOURCE_XPCML SOURCE_XPCML} - The docStream contains an XPCML document. -
      - @exception PcmlException when the specified PCML document cannot be found - */ - public ProgramCallDocument(AS400 sys, String docName, InputStream docStream, ClassLoader loader, InputStream xsdStream, int type) - throws PcmlException - { - if (sys == null) warnNull("sys"); - if (docName == null) warnNull("docName"); - - if (type == ProgramCallDocument.SERIALIZED) - { - m_pcmlDoc = loadSerializedPcmlDocumentFromStream(docStream); - } - else if (type == ProgramCallDocument.SOURCE_PCML) - { - m_pcmlDoc = loadSourcePcmlDocumentFromStream(docName, docStream, loader, xsdStream, false); - } - else if (type == ProgramCallDocument.SOURCE_XPCML) - { - m_pcmlDoc = loadSourcePcmlDocumentFromStream(docName, docStream, loader, xsdStream, true); - } - else { - throw new ExtendedIllegalArgumentException("type (" + type + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - m_as400 = sys; - if (m_as400 != null) m_pcmlDoc.setAs400(m_as400); - } - - /** - Constructs a ProgramCallDocument object. - {@link #setSystem setSystem()} and {@link #setDocument setDocument()} must be called prior to using the object. - - @exception PcmlException when the specified PCML document cannot be found - */ - public ProgramCallDocument() - throws PcmlException // @C1A - { // @C1A - m_as400 = null; // @C1A - m_pcmlDoc = null; // @C1A - } // @C1A - - /** - Constructs a ProgramCallDocument object. - {@link #setSystem setSystem()} must be called prior to using the object. - The PCML or XPCML document resource will be loaded from the classpath. - If the document is a PCML document, the classpath will first be searched for a serialized resource. - XPCML documents cannot be serialized. - If a serialized resource is not found, the classpath will be - searched for a PCML or XPCML source file. - - @param docName The document resource name of the PCML document for the programs to be called. - All PCML-related file extensions are assumed to be lowercase (for example, .pcml or .pcml.ser). - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myPcml" - - @exception PcmlException when the specified PCML document cannot be found - */ - public ProgramCallDocument(String docName) - throws PcmlException - { - if (docName == null) { - throw new NullPointerException("docName"); - } - - m_pcmlDoc = loadPcmlDocument(docName, null,null); - } - - /** - Constructs a ProgramCallDocument object. - {@link #setSystem setSystem()} must be called prior to using the object. - The PCML or XPCML document resource will be loaded from the classpath of the specified ClassLoader. - If the document is a PCML document, the classpath will first be searched for a serialized resource. - XPCML documents cannot be serialized. - If a serialized resource is not found, the classpath will be - searched for a PCML or XPCML source file. - - @param docName The document resource name of the PCML document for the programs to be called. - @param loader The ClassLoader that will be used when loading the specified document resource. - - @exception PcmlException when the specified PCML document cannot be found - */ - public ProgramCallDocument(String docName, ClassLoader loader) - throws XmlException - { - if (docName == null) { - throw new NullPointerException("docName"); - } - if (loader == null) { - throw new NullPointerException("loader"); - } - - m_pcmlDoc = loadPcmlDocument(docName, loader, null); - } - - /** - Clones the ProgramCallDocument and the objects contained in it. - {@link #setSystem setSystem()} and {@link #setDocument setDocument()} must be called prior to using the object. - */ - public Object clone() - { // @C3A - ProgramCallDocument newPcml = null; // @C3A - try // @C3A - { // @C3A - newPcml = (ProgramCallDocument) super.clone(); // @C3A - if (m_pcmlDoc != null) // @C3A - newPcml.m_pcmlDoc = (PcmlDocument) m_pcmlDoc.clone(); // @C3A - } // @C3A - catch (CloneNotSupportedException e) // @C3A - {} // @C3A - - return newPcml; // @C3A - } // @C3A - - // Custom serialization - private void writeObject(ObjectOutputStream out) - throws IOException // @C1A - { // @C1A - synchronized (this) // @C1A - { // @C1A - if (m_pcmlDoc != null) // @C1A - { // @C1A - m_pcmlDoc.setSerializingWithData(true); // @C1A - } // @C1A - - // Perform default serialization - out.defaultWriteObject(); // @C1A - - } // end of synchronized code // @C1A - } // @C1A - - /** - * Provides a command line interface to ProgramCallDocument. See the class description. - * Note that XPCML documents cannot be serialized. - * - */ - public static void main(String[] args) - { - PcmlDocument pd = null;; - - System.setErr(System.out); - final String errMsg = SystemResourceFinder.format(DAMRI.PCD_ARGUMENTS); - - if (args.length == 2) - { - if (!args[0].equalsIgnoreCase("-SERIALIZE")) - { - System.out.println(errMsg); - System.exit(-1); - } - - // Load the document from source (previously serialized documents are ignored) - try - { - pd = loadSourcePcmlDocument(args[1], null,null); // @C8C - } - catch (PcmlException e) - { - System.out.println(e.getLocalizedMessage()); - System.exit(-1); - } - - // Save the document as a serialized file - try - { - savePcmlDocument(pd); - } - catch (Exception e) - { - System.out.println(e.getLocalizedMessage()); - System.exit(-1); - } - - } - else - { - System.out.println(errMsg); - System.exit(-1); - } - - } - - - - /** - Calls the named program. - - @param name The name of the <program> element in the PCML document. - @exception PcmlException - If an error occurs. - */ - public boolean callProgram(String name) - throws PcmlException - { - try - { - return m_pcmlDoc.callProgram(name); - } - catch (AS400SecurityException e) - { - if (Trace.isTraceErrorOn()) // @C4A - e.printStackTrace(Trace.getPrintWriter()); // @C4C - PcmlException pe = new PcmlException(e); - throw pe; - } - catch (ObjectDoesNotExistException e) - { - if (Trace.isTraceErrorOn()) // @C4A - e.printStackTrace(Trace.getPrintWriter()); // @C4C - PcmlException pe = new PcmlException(e); - throw pe; - } - catch (InterruptedException e) - { - if (Trace.isTraceErrorOn()) // @C4A - e.printStackTrace(Trace.getPrintWriter()); // @C4C - PcmlException pe = new PcmlException(e); - throw pe; - } - catch (ErrorCompletingRequestException e) - { - if (Trace.isTraceErrorOn()) // @C4A - e.printStackTrace(Trace.getPrintWriter()); // @C4C - PcmlException pe = new PcmlException(e); - throw pe; - } - catch (IOException e) - { - if (Trace.isTraceErrorOn()) // @C4A - e.printStackTrace(Trace.getPrintWriter()); // @C4C - throw new PcmlException(e); - } - - } - - /** - Returns an "errno" value for the named service program element. -

      - The named program element must be defined as a service program entrypoint. - The value returned is the "errno" value resulting from the most recent - call to the program. If the program has not been called, zero is returned. - - @return The integer "errno" value for the named service program element. - - @param name The name of the <program> element in the PCML document. - @exception PcmlException - If an error occurs. - */ - public int getErrno(String name) - throws PcmlException // @B1A - { // @B1A - return m_pcmlDoc.getErrno(name); // @B1A - } // @B1A - - /** - Returns a Descriptor for the specified PCML document. - The PCML document resource will be loaded from the classpath. - The classpath will first be searched for a serialized resource. - If a serialized resource is not found, the classpath will be - searched for a PCML source file. - - @param docName The document resource name of the PCML document for which the Descriptor is returned. - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myPcml" - - @return The Descriptor for the <pcml> element of the named PCML file. - - @exception PcmlException when the specified PCML document cannot be found - */ - public static Descriptor getDescriptor(String docName) - throws PcmlException // @C5A - { - PcmlDocument pd = null; - - pd = loadPcmlDocument(docName, null,null); // @C8C - - return new PcmlDescriptor(pd); - } // @C5A - - /** - Returns a Descriptor for the specified XPCML document. - The XPCML document resource will be loaded from the classpath. - - @param docName The document resource name of the XPCML document for which the Descriptor is returned. - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myPcml" - @param xsdStream An input stream that contains XML schema definitions that extend XPCML - - @return The Descriptor for the <pcml> element of the named PCML file. - - @exception PcmlException when the specified PCML document cannot be found - */ - public static Descriptor getDescriptor(String docName, InputStream xsdStream) - throws PcmlException // @C5A - { - PcmlDocument pd = null; - - pd = loadPcmlDocument(docName, null, xsdStream); // @C8C - - return new PcmlDescriptor(pd); - } // @C5A - - /** - Returns a Descriptor for the specified PCML document. - The PCML document resource will be loaded from the classpath. - The classpath will first be searched for a serialized resource. - If a serialized resource is not found, the classpath will be - searched for a PCML source file. - - @param docName The document resource name of the PCML document for which the Descriptor is returned. - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myPcml" - @param loader The ClassLoader that will be used when loading the specified document resource. - @return The Descriptor for the <pcml> element of the named PCML file. - - @exception PcmlException when the specified PCML document cannot be found - */ - public static Descriptor getDescriptor(String docName, ClassLoader loader) - throws PcmlException // @C8A - { - PcmlDocument pd = null; // @C8A - - pd = loadPcmlDocument(docName, loader,null); // @C8A - - return new PcmlDescriptor(pd); // @C8A - } - - /** - Returns a Descriptor for the specified XPCML document. - The XPCML document resource will be loaded from the classpath. - - @param docName The document resource name of the PCML document for which the Descriptor is returned. - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myPcml" - @param loader The ClassLoader that will be used when loading the specified document resource. - @param xsdStream An input stream that contains XML schema definitions that extend XPCML. - - @return The Descriptor for the <pcml> element of the named PCML file. - - @exception PcmlException when the specified PCML document cannot be found - */ - public static Descriptor getDescriptor(String docName, ClassLoader loader, InputStream xsdStream) - throws PcmlException // @C8A - { - PcmlDocument pd = null; // @C8A - - pd = loadPcmlDocument(docName, loader,xsdStream); // @C8A - - return new PcmlDescriptor(pd); // @C8A - } - - - /** - Returns a Descriptor for the current PCML document. - - @return The Descriptor for the <pcml> element of the current PCML file or - null if the PCML document has not be set. - */ - public Descriptor getDescriptor() // @C5A - { - - if (m_pcmlDoc == null) - return null; - else - return new PcmlDescriptor(m_pcmlDoc); - } // @C5A - - /** - Returns an int return value for the named service program element. -

      - The named program element must be defined as a service program entrypoint. - The value returned is the integer return value from the most recent - call to the program. If the program has not been called, zero is returned. - - @return The integer return value for the named service program element. - - @param name The name of the <program> element in the PCML document. - @exception PcmlException - If an error occurs. - */ - public int getIntReturnValue(String name) throws PcmlException // @B1A - { // @B1A - return m_pcmlDoc.getIntReturnValue(name); // @B1A - } // @B1A - - /** - Returns an int value for the named element. -

      - If the named element is String or a Number output value of a program, the value will - be converted to an int. - - @return The integer value for the named element. - - @param name The name of the <data> element in the PCML document. - @exception PcmlException - If an error occurs. - */ - public int getIntValue(String name) - throws PcmlException - { - return m_pcmlDoc.getIntValue(name); - } - - /** - Returns an int value for the named element given indices to the data element. - If the data element is an array or is an element in a structure array, an index - must be specified for each dimension of the data. -

      - If the named element is String or a Number output value of a program, the value will - be converted to an int. - - @return The integer value for the named element. - - @param name The name of the <data> element in the PCML document. - @exception PcmlException - If an error occurs. - */ - public int getIntValue(String name, int[] indices) - throws PcmlException - { - return m_pcmlDoc.getIntValue(name, new PcmlDimensions(indices)); - } - - - /** - Returns the ProgramCall object that was used in the most recent invocation of {@link #callProgram(String) callProgram()}. - @return The ProgramCall object; null if callProgram() has not been called. - **/ - public ProgramCall getProgramCall() - { - return ( m_pcmlDoc == null ? null : m_pcmlDoc.getProgramCall() ); - } - - - /** - Returns a String value for the named element. -

      - If the named element is String or a Number output value of a program, the value will - be converted to a String. - The default bidi string type is assumed ({@link com.ibm.as400.access.BidiStringType#DEFAULT BidiStringType.DEFAULT}). - - @param name The name of the <data> element in the PCML document. - @exception PcmlException If an error occurs. - */ - public String getStringValue(String name) - throws PcmlException - { - return m_pcmlDoc.getStringValue(name, BidiStringType.DEFAULT); - } - - /** - Returns a String value for the named element. -

      - This method is used when the string type cannot be determined until - run-time. In those cases, the PCML document cannot be used to indicate - the string type so this method is used to get the value using the - string type that is specified. -

      - If the named element is String or a Number output value of a program, the value will - be converted to a String. - - @param name The name of the <data> element in the PCML document. - @param type The bidi string type, as defined by the CDRA (Character - Data Representation Architecture). - @exception PcmlException - If an error occurs. - @see com.ibm.as400.access.BidiStringType - */ - public String getStringValue(String name, int type) - throws PcmlException // @C9A - { - return m_pcmlDoc.getStringValue(name, type); // @C9A - } - - - /** - Returns a String value for the named element given indices to the data element. - If the data element is an array or is an element in a structure array, an index - must be specified for each dimension of the data. - The default bidi string type is assumed ({@link com.ibm.as400.access.BidiStringType#DEFAULT BidiStringType.DEFAULT}). -

      - If the named element is String or a Number output value of a program, the value will - be converted to a String. - - @param name The name of the <data> element in the PCML document. - @param indices An array of indices for setting the value of an element in an array. - @exception PcmlException - If an error occurs. - */ - public String getStringValue(String name, int[] indices) - throws PcmlException - { - return m_pcmlDoc.getStringValue(name, new PcmlDimensions(indices), BidiStringType.DEFAULT); - } - - /** - Returns a String value for the named element given indices to the data element. - If the data element is an array or is an element in a structure array, an index - must be specified for each dimension of the data. -

      - This method is used when the string type cannot be determined until - run-time. In those cases, the PCML document cannot be used to indicate - the string type so this method is used to get the value using the - string type that is specified. -

      - If the named element is String or a Number output value of a program, the value will - be converted to a String. - - @param name The name of the <data> element in the PCML document. - @param indices An array of indices for setting the value of an element in an array. - @param type The bidi string type, as defined by the CDRA (Character - Data Representation Architecture). - @exception PcmlException - If an error occurs. - @see com.ibm.as400.access.BidiStringType - */ - public String getStringValue(String name, int[] indices, int type) - throws PcmlException // @C9A - { - return m_pcmlDoc.getStringValue(name, new PcmlDimensions(indices), type); // @C9A - } - - /** - Returns the list of IBM i system messages returned from running the - program. An empty list is returned if the program has not been run yet. - - @param name The name of the <program> element in the PCML document. - @return The array of messages returned by the system for the program. - @exception PcmlException - If an error occurs. - */ - public AS400Message[] getMessageList(String name) - throws PcmlException - { - return m_pcmlDoc.getMessageList(name); - } - - /** - Returns the number of bytes reserved for output for the named element. - - @return The number of bytes reserved for output for the named element. - @param name The name of the <data> or <struct> element in the PCML document. - @exception PcmlException - If an error occurs. - */ - public int getOutputsize(String name) - throws PcmlException - { - return m_pcmlDoc.getOutputsize(name); - } - - /** - Returns the number of bytes reserved for output for the named element and indices. - - @return The number of bytes reserved for output for the named element. - @param name The name of the <data> or <struct> element in the PCML document. - @param indices An array of indices for accessing the output size of an element in an array. - @exception PcmlException - If an error occurs. - */ - public int getOutputsize(String name, int[] indices) - throws PcmlException - { - return m_pcmlDoc.getOutputsize(name, new PcmlDimensions(indices)); - } - - /** - Returns the Java object value for the named element. -

      - If the named element is an output value of a program, the value will - be converted from IBM i system data to a Java Object. -

      - The type of object returned depends on the description in the PCML document. - - - - - - - - - - - - - - - - - -
      PCML DescriptionObject Returned
      type=charString
      type=bytebyte[]
      type=int
      - length=2
      - precision=15
      Short
      type=int
      - length=2
      - precision=16
      Integer
      type=int
      - length=4
      - precision=31
      Integer
      type=int
      - length=4
      - precision=32
      Long
      type=int
      - length=8
      - precision=63
      Long
      type=int
      - length=8
      - precision=64
      BigInteger
      type=packedBigDecimal
      type=zonedBigDecimal
      type=float
      - length=4
      Float
      type=float
      - length=8
      Double
      type=datejava.sql.Date
      type=timejava.sql.Time
      type=timestampjava.sql.Timestamp
      - - @return The Java object value for the named <data> element in the PCML document. - - @param name The name of the <data> element in the PCML document. - @exception PcmlException - If an error occurs. - */ - public Object getValue(String name) - throws PcmlException - { - if (Trace.isTraceOn()) Trace.log(Trace.PCML, "Entered method ProgramCallDocument.getValue("+name+")"); - - Object val = m_pcmlDoc.getValue(name); - - if (Trace.isTraceOn()) Trace.log(Trace.PCML, "Exiting method ProgramCallDocument.getValue("+name+")"); - - return val; - } - - /** - Returns the Java object value for the named element given indices to the data element. - If the data element is an array or is an element in a structure array, an index - must be specified for each dimension of the data. -

      - If the named element is an output value of a program, the value will - be converted from IBM i system data to a Java Object. -

      - The type of object returned depends on the description in the PCML document. - - - - - - - - - - - - - - - - - -
      PCML DescriptionObject Returned
      type=charString
      type=bytebyte[]
      type=int
      - length=2
      - precision=15
      Short
      type=int
      - length=2
      - precision=16
      Integer
      type=int
      - length=4
      - precision=31
      Integer
      type=int
      - length=4
      - precision=32
      Long
      type=int
      - length=8
      - precision=63
      Long
      type=int
      - length=8
      - precision=64
      BigInteger
      type=packedBigDecimal
      type=zonedBigDecimal
      type=float
      - length=4
      Float
      type=float
      - length=8
      Double
      type=datejava.sql.Date
      type=timejava.sql.Time
      type=timestampjava.sql.Timestamp
      - - @return The Java object value for the named <data> element in the PCML document. - - @param name The name of the <data> element in the PCML document. - @param indices An array of indices for accessing the value of an element in an array. - @exception PcmlException - If an error occurs. - */ - public Object getValue(String name, int[] indices) - throws PcmlException - { - if (Trace.isTraceOn()) Trace.log(Trace.PCML, "Entered method ProgramCallDocument.getValue("+name+", indices)"); - - Object val = m_pcmlDoc.getValue(name, new PcmlDimensions(indices)); - - if (Trace.isTraceOn()) Trace.log(Trace.PCML, "Exiting method ProgramCallDocument.getValue("+name+", indices)"); - - return val; - } - - /** - Gets the system on which programs are to be called. - - @return The current system for this ProgramCallDocument. - - @see #setSystem - **/ - public AS400 getSystem() // @C4A - { // @C4A - return m_as400; // @C4A - } // @C4A - - - /** - Serializes the ProgramCallDocument. Note that XPCML documents - cannot be serialized. - - The filename of the serialized file will be of the form -

      -     docName.pcml.ser
      -     
      - where docName.pcml.ser (lowercase) is the name of the document used to - construct this object. - - @exception PcmlException If an error occurs. - @deprecated Use {@link #serialize(File) serialize(File)} instead. - */ - public void serialize() - throws PcmlException - { - if (m_pcmlDoc == null) { - throw new PcmlException(DAMRI.DOCUMENT_NOT_SET); - } - try { - savePcmlDocument(m_pcmlDoc); - } - catch (IOException e) { - if (Trace.isTraceErrorOn()) - e.printStackTrace(Trace.getPrintWriter()); - throw new PcmlException(e); - } - } - - - /** - Serializes the ProgramCallDocument to a stream. - - @param outputStream The output stream to which to serialize the object. - @exception IOException If an error occurs while writing to the stream. - @exception PcmlException If an error occurs while processing PCML. - **/ - public void serialize(OutputStream outputStream) - throws IOException, PcmlException - { - if (outputStream == null) { - throw new NullPointerException("outputStream"); - } - if (m_pcmlDoc == null) { - throw new PcmlException(DAMRI.DOCUMENT_NOT_SET); - } - savePcmlDocument(m_pcmlDoc, outputStream); - } - - /** - Serializes the ProgramCallDocument to a file. - - @param file The file to which to serialize the object. - @exception IOException If an error occurs while writing to the file. - @exception XmlException If an error occurs while processing RFML. - **/ - public void serialize(File file) - throws IOException, XmlException - { - FileOutputStream fos = null; - try - { - fos = new FileOutputStream(file); - serialize(fos); - } - finally - { - if (fos != null) fos.close(); - } - } - - /** - Sets the Java object value for the named element using a int input. -

      - The named element must be able to be set using a Integer object. - - @param name The name of the <data> element in the PCML document. - @param value The int value for the named element. - @exception PcmlException - If an error occurs. - */ - public void setIntValue(String name, int value) - throws PcmlException - { - setValue(name, new Integer(value)); - } - - /** - Sets the Java object value for the named element using an int input value - given indices to the data element. -

      - The named element must be able to be set using a Integer object. - - @param name The name of the <data> element in the PCML document. - @param indices An array of indices for setting the value of an element in an array. - @param value The int value for the named element. - @exception PcmlException - If an error occurs. - */ - public void setIntValue(String name, int[] indices, int value) - throws PcmlException - { - setValue(name, indices, new Integer(value)); - } - - - /** - Sets the Java object value for the named element using a String input. - The default bidi string type is assumed ({@link com.ibm.as400.access.BidiStringType#DEFAULT BidiStringType.DEFAULT}). - - @param name The name of the <data> element in the PCML document. - @param value The string value for the named element. - @exception PcmlException If an error occurs. - */ - public void setStringValue(String name, String value) - throws PcmlException - { - setStringValue(name, value, BidiStringType.DEFAULT); - } - - /** - Sets the Java object value for the named element using a String input. -

      - This method is used when the string type cannot be determined until - run-time. In those cases, the PCML document cannot be used to indicate - the string type so this method is used to set the value and the - string type of the input value. - - @param name The name of the <data> element in the PCML document. - @param value The string value for the named element. - @param type The bidi string type, as defined by the CDRA (Character - Data Representation Architecture). - @exception PcmlException - If an error occurs. - @see com.ibm.as400.access.BidiStringType - */ - public void setStringValue(String name, String value, int type) - throws PcmlException // @C9A - { - m_pcmlDoc.setStringValue(name, value, type); // @C9A - } - - /** - Sets the Java object value for the named element using a String input value - given indices to the data element. -

      - This method is used when the string type cannot be determined until - run-time. In those cases, the PCML document cannot be used to indicate - the string type so this method is used to set the value and the - string type of the input value. - - @param name The name of the <data> element in the PCML document. - @param indices An array of indices for setting the value of an element in an array. - @param value The string value for the named element. - @param type The bidi string type, as defined by the CDRA (Character - Data Representation Architecture). - @exception PcmlException - If an error occurs. - @see com.ibm.as400.access.BidiStringType - */ - public void setStringValue(String name, int[] indices, String value, int type) - throws PcmlException // @C9A - { - m_pcmlDoc.setStringValue(name, value, new PcmlDimensions(indices), type); // @C9A - } - - /** - Sets the PCML or XPCML document resource. - The PCML or XPCML document resource will be loaded from the classpath. - The classpath will first be searched for a serialized resource. - If a serialized resource is not found, the classpath will be - searched for a PCML or XPCML source file. - - @param docName The document resource name of the PCML document for the programs to be called. - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myPcml" - - @exception PcmlException when the specified PCML document cannot be found - **/ - public void setDocument(String docName) - throws PcmlException // @C1A - { // @C1A - if (m_pcmlDoc != null) // @C1A - throw new PcmlException(DAMRI.DOCUMENT_ALREADY_SET ); // @C1A - - if (docName == null) // @C1A - throw new NullPointerException("docName"); // @C1A - - m_pcmlDoc = loadPcmlDocument(docName, null,null); // @C1A @C8C - if (m_as400 != null) m_pcmlDoc.setAs400(m_as400); // @C1A - } // @C1A - - - /** - Sets the XPCML document resource. - The XPCML document resource will be loaded from the classpath. - - @param docName The document resource name of the PCML document for the programs to be called. - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myPcml" - @param xsdStream An input stream that contains XML schema definitions that extend XPCML - - @exception PcmlException when the specified PCML document cannot be found - **/ - public void setDocument(String docName, InputStream xsdStream) - throws PcmlException // @C1A - { // @C1A - if (m_pcmlDoc != null) // @C1A - throw new PcmlException(DAMRI.DOCUMENT_ALREADY_SET ); // @C1A - - if (docName == null) // @C1A - throw new NullPointerException("docName"); // @C1A - - m_pcmlDoc = loadPcmlDocument(docName, null,xsdStream); // @C1A @C8C - if (m_as400 != null) m_pcmlDoc.setAs400(m_as400); // @C1A - } // @C1A - - - /** - Sets the PCML or XPCML document resource. - The PCML or XPCML document resource will be loaded from the classpath. - The classpath will first be searched for a serialized resource. - If a serialized resource is not found, the classpath will be - searched for a PCML or XPCML source file. - - @param docName The document resource name of the PCML document for the programs to be called. - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myPcml" - @param loader The ClassLoader that will be used when loading the specified document resource. - - @exception PcmlException when the specified PCML document cannot be found - **/ - public void setDocument(String docName, ClassLoader loader) // @C8A - throws PcmlException // @C8A - { // @C8A - if (m_pcmlDoc != null) // @C8A - throw new PcmlException(DAMRI.DOCUMENT_ALREADY_SET ); // @C8A - - if (docName == null) // @C8A - throw new NullPointerException("docName"); // @C8A - - m_pcmlDoc = loadPcmlDocument(docName, loader,null); // @C8A - if (m_as400 != null) m_pcmlDoc.setAs400(m_as400); // @C8A - } // @C8A - - /** - Sets the PCML or XPCML document resource. - The document resource will be loaded from the classpath. - - @param docName The document resource name of the PCML or XPCML document for the programs to be called. - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myPcml" - @param loader The ClassLoader that will be used when loading the specified document resource. - @param xsdStream An input stream that contains XML schema definitions that extend XPCML - - @exception PcmlException when the specified PCML document cannot be found - **/ - public void setDocument(String docName, ClassLoader loader,InputStream xsdStream) // @C8A - throws PcmlException // @C8A - { // @C8A - if (m_pcmlDoc != null) // @C8A - throw new PcmlException(DAMRI.DOCUMENT_ALREADY_SET ); // @C8A - - if (docName == null) // @C8A - throw new NullPointerException("docName"); // @C8A - - m_pcmlDoc = loadPcmlDocument(docName, loader, xsdStream); // @C8A - m_pcmlDoc.setAs400(m_as400); // @C8A - } // @C8A - - - /** - Sets the system on which to call programs. - - @param system The system on which to call programs. - - **/ - public void setSystem(AS400 system) // @C1A - { // @C1A - if (system == null) // @C1A - throw new NullPointerException("system"); // @C1A - - m_as400 = system; // @C1A - m_pcmlDoc.setAs400(m_as400); // @C1A - } // @C1A - - /** - Sets the Java object value for the named element. -

      - If the input value provided is not an instance of the - correct Java class for the defined data type, it will be converted - to the correct Java class. For example, an element defined as "type=int length=2 precision=15", - will be converted to a Java Short object. In this case the value specified must be an instance of Number or String. -

      - If the named element is an input value to a program, the value will - be converted to IBM i system data when {@link #callProgram(String) callProgram()} is called. - - @param name The name of the <data> element in the PCML document. - @param value The java object value for the named element. The type of Object passed must be - the correct type for the element definition or a String that can be converted to the correct type. - @exception PcmlException - If an error occurs. - */ - public void setValue(String name, Object value) - throws PcmlException - { - m_pcmlDoc.setValue(name, value); - } - - /** - Sets the Java object value for the named element - given indices to the data element. - If the data element is an array or is an element in a structure array, an index - must be specified for each dimension of the data. -

      - If the input value provided is not an instance of the - correct Java class for the defined data type, it will be converted - to the correct Java class. For example, an element defined as "type=int length=2 precision=15", - will be converted to a Java Short object. In this case the value specified must be an instance of Number or String. -

      - If the named element is an input value to a program, the value will - be converted to IBM i system data when {@link #callProgram(String) callProgram()} is called. - - @param name The name of the <data> element in the PCML document. - @param indices An array of indices for setting the value of an element in an array. - @param value The java object value for the named element. The type of Object passed must be - the correct type for the element definition or a String that can be converted to the correct type. - @exception PcmlException - If an error occurs. - */ - public void setValue(String name, int[] indices, Object value) - throws PcmlException - { - m_pcmlDoc.setValue(name, value, new PcmlDimensions(indices)); - } - - /** - Allows for dynamically specifying the program path of the program to be called. - - @param program The name of the <program> element in the PCML document. - @param path A String containing the path to the program object to be run on the system. - @exception PcmlException - If an error occurs. - @see #setDocument(String) - @see #ProgramCallDocument(AS400,String,InputStream,ClassLoader,InputStream,int) - */ - public void setPath(String program, String path) // @D1A - throws PcmlException // @D1A - { - m_pcmlDoc.setPath(program, path); // @D1A - } - - /** - Allows the overriding of the threadsafe attribute of a program element. - - @param program The name of the <program> element in the PCML document. - @param threadsafe A boolean indicating whether the named program element should be considered - thread safe (true) or not (false). - @exception PcmlException - If an error occurs. - */ - public void setThreadsafeOverride(String program, boolean threadsafe) - throws PcmlException - { - m_pcmlDoc.setThreadsafeOverride(program, threadsafe); // @C6A - } - - /** - Gets the value of the override of the threadsafe attribute of a program element. - - @param program The name of the <program> element in the PCML document. - @exception PcmlException - If an error occurs. - */ - public boolean getThreadsafeOverride(String program) - throws PcmlException - { - return m_pcmlDoc.getThreadsafeOverride(program); // @C6A - } - - - /** - Saves a PcmlDocument as a serialized resource. - **/ - private static void savePcmlDocument(PcmlDocument pd) - throws PcmlException, IOException - { - String outFileName = pd.getDocName() + SystemResourceFinder.m_pcmlSerializedExtension; - BufferedOutputStream fos = null; - try - { - fos = new BufferedOutputStream(new FileOutputStream(outFileName)); - - savePcmlDocument(pd, fos); - } - finally - { - if (fos != null) fos.close(); - } - } - - - /** - Saves a PcmlDocument as a serialized resource. - **/ - private static void savePcmlDocument(PcmlDocument pd, OutputStream outStream) - throws PcmlException, IOException - { - pd.setSerializingWithData(false); - ObjectOutputStream out = null; - - try - { - out = new ObjectOutputStream(outStream); - out.writeObject(pd); - - String outFileName = pd.getDocName() + SystemResourceFinder.m_pcmlSerializedExtension; - Trace.log(Trace.PCML, SystemResourceFinder.format(DAMRI.PCML_SERIALIZED, new Object[] {outFileName} )); // @D2C - } - finally - { - if (out != null) out.close(); - } - } - - - /** - Loads a serialized PcmlDocument or constructs the document from - a PCML source file. - **/ - private static PcmlDocument loadPcmlDocument(String docName, ClassLoader loader, InputStream xsdStream) // @C8C - throws PcmlException - { - PcmlDocument pd = null; - - pd = loadSerializedPcmlDocument(docName, loader); // @C8C - - // If a PcmlDocument was successfully loaded from a serialized file - // return the document loaded. - if (pd != null) - return pd; - - pd = loadZippedSerializedPcmlDocument(docName, loader); // @C7A @C8C - - // If a PcmlDocument was successfully loaded from a zipped serialized file - // return the document loaded. - if (pd != null) // @C7A - return pd; // @C7A - - pd = loadSourcePcmlDocument(docName, loader, xsdStream); // @C8C - - return pd; - } - - private static PcmlDocument loadSerializedPcmlDocumentFromStream(InputStream docStream) - throws PcmlException - { - PcmlDocument pd = null; - ObjectInputStream in = null; - - try - { - // Try to open the serialized PCML document - in = new ObjectInputStream(docStream); - pd = (PcmlDocument)in.readObject(); - } - catch (Exception e) - { - if (Trace.isTraceErrorOn()) - e.printStackTrace(Trace.getPrintWriter()); - throw new PcmlException(e); - } - finally - { - if (in != null) try { in.close(); } catch (Exception e) {} - } - - return pd; - } - - private static PcmlDocument loadSourcePcmlDocumentFromStream(String docName, InputStream docStream, ClassLoader loader, InputStream xsdStream, boolean isXPCML) throws PcmlException - { - PcmlDocument pd = null; - - // Construct the PCML document from a source file - try - { - PcmlSAXParser psp = new PcmlSAXParser(docName, docStream, xsdStream, isXPCML, exceptionIfParseError_); - pd = psp.getPcmlDocument(); - } - catch (ParseException pe) - { - pe.reportErrors(); - throw new PcmlException(pe); - } - catch (PcmlSpecificationException pse) - { - pse.reportErrors(); - throw new PcmlException(pse); - } - catch (RuntimeException e) - { - Throwable cause = e.getCause(); - if (cause instanceof PcmlSpecificationException) - { - PcmlSpecificationException pse = (PcmlSpecificationException)cause; - pse.reportErrors(); - throw new PcmlException(pse); - } - else - { - if (Trace.isTraceErrorOn()) //@E0A - e.printStackTrace(Trace.getPrintWriter()); //@E0A - throw new PcmlException(e); - } - } - catch (Exception e) - { - if (Trace.isTraceErrorOn()) - e.printStackTrace(Trace.getPrintWriter()); - throw new PcmlException(e); - } - - return pd; - } - - /** - Loads a serialized PcmlDocument from a serialized file. - **/ - private static PcmlDocument loadSerializedPcmlDocument(String docName, ClassLoader loader) // @C8C - throws PcmlException - { - PcmlDocument pd = null; - InputStream is = null; - ObjectInputStream in = null; - - // First try to find a serialized PCML document - try - { - // Try to open the serialized PCML document - is = SystemResourceFinder.getSerializedPCMLDocument(docName, loader); // @C8C - - in = new ObjectInputStream(is); - pd = (PcmlDocument)in.readObject(); - } - catch (MissingResourceException e) - { - // Ignore exception and try looking for PCML source (below) - } - catch (StreamCorruptedException e) - { - // Ignore exception and try looking for zipped serialized PCML (below) - } - catch (IOException e) - { - if (Trace.isTraceErrorOn()) // @C4A - e.printStackTrace(Trace.getPrintWriter()); // @C4C - throw new PcmlException(e); - } - catch (ClassNotFoundException e) - { - if (Trace.isTraceErrorOn()) // @C4A - e.printStackTrace(Trace.getPrintWriter()); // @C4C - throw new PcmlException(e); - } - finally - { - if (in != null) try { in.close(); } catch (Exception e) {} - if (is != null) try { is.close(); } catch (Exception e) {} - } - - return pd; - } - - /** - Loads a serialized PcmlDocument from a serialized file. - **/ - private static PcmlDocument loadZippedSerializedPcmlDocument(String docName, ClassLoader loader) // @C8C - throws PcmlException - { - PcmlDocument pd = null; - InputStream is = null; - GZIPInputStream gzis = null; - ObjectInputStream in = null; - - // First try to find a serialized PCML document - try - { - // Try to open the serialized PCML document - is = SystemResourceFinder.getSerializedPCMLDocument(docName, loader); // @C8C - - gzis = new GZIPInputStream(is); - in = new ObjectInputStream(gzis); - pd = (PcmlDocument)in.readObject(); - } - catch (MissingResourceException e) - { - // Ignore exception and try looking for PCML source (below) - } - catch (IOException e) - { - if (Trace.isTraceErrorOn()) // @C4A - e.printStackTrace(Trace.getPrintWriter()); // @C4C - throw new PcmlException(e); - } - catch (ClassNotFoundException e) - { - if (Trace.isTraceErrorOn()) // @C4A - e.printStackTrace(Trace.getPrintWriter()); // @C4C - throw new PcmlException(e); - } - finally - { - if (in != null) try { in.close(); } catch (Exception e) {} - if (gzis != null) try { gzis.close(); } catch (Exception e) {} - if (is != null) try { is.close(); } catch (Exception e) {} - } - - return pd; - } - - /** - Loads a PcmlDocument from a PCML source file. - **/ - private static PcmlDocument loadSourcePcmlDocument(String docName, ClassLoader loader, InputStream xsdStream) // @C8C - throws PcmlException - { - - PcmlDocument pd = null; - - // Construct the PCML document from a source file - try - { - InputStream docStream = SystemResourceFinder.getPCMLDocument(docName, loader); - boolean isXPCML = SystemResourceFinder.isXPCML(docName,loader); - PcmlSAXParser psp = new PcmlSAXParser(docName, docStream, xsdStream, isXPCML, exceptionIfParseError_); // @C2A @C8C - pd = psp.getPcmlDocument(); // @C2A - } - catch (ParseException pe) - { - pe.reportErrors(); - throw new PcmlException(pe); - } - catch (PcmlSpecificationException pse) - { - pse.reportErrors(); - throw new PcmlException(pse); - } - catch (RuntimeException e) - { - Throwable cause = e.getCause(); - if (cause instanceof PcmlSpecificationException) - { - PcmlSpecificationException pse = (PcmlSpecificationException)cause; - pse.reportErrors(); - throw new PcmlException(pse); - } - else - { - if (Trace.isTraceErrorOn()) //@E0A - e.printStackTrace(Trace.getPrintWriter()); //@E0A - throw new PcmlException(e); - } - } - catch (Exception e) //@E0A - { - if (Trace.isTraceErrorOn()) //@E0A - e.printStackTrace(Trace.getPrintWriter()); //@E0A - throw new PcmlException(e); - } - - return pd; - } - - - // @E1A -- ALL NEW XPCML methods.... - /** - Generates XPCML representing the data associated with the passed-in program name. - Note: XPCML cannot be generated from a serialized PCML file. - XPCML is XML based on the XML schema defined in xpcml.xsd. XPCML is similar - to PCML but allows for better validation of parameters and allows parameter - data to be input and output within an XML document. PCML is data-less in - that only parameter formats are input via PCML. In PCML, data values are set using - the setValue methods of the ProgramCallDocument class, and data values are - gotten using the getValue methods of ProgramCallDocument. In XPCML, data values - can be specified directly within the XPCML source document, and data values can be output - as XML using the generateXPCML method. - Throws an XmlException if this object contains no data. - @param pgmName The program to generate XPCML for - @param outputStream The output stream to which to write the text. - @exception IOException If an error occurs while writing the data. - @exception XmlException If an error occurs while processing XPCML. - **/ - public void generateXPCML(String pgmName, OutputStream outputStream) - throws IOException, XmlException - { - if (outputStream == null) { - throw new NullPointerException("outputStream"); - } - if (m_pcmlDoc == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - m_pcmlDoc.generateXPCML(pgmName, outputStream); - } - - - // @E2C -- Added more info on XPCML. Changed all RFML references to XPCML. - /** - Generates XPCML representing the data contained in the entire PCML node tree. - Note: XPCML cannot be generated from a serialized PCML file. - XPCML is XML based on the XML schema defined in xpcml.xsd. XPCML is similar - to PCML but allows for better validation of parameters and allows parameter - data to be input and output within an XML document. PCML is data-less in - that only parameter formats are input via PCML. In PCML, data values are set using - the setValue methods of the ProgramCallDocument class and data values are - gotten using the getValue methods of ProgramCallDocument. In XPCML, data values - can be specified directly within the XPCML document, and data values can be output - as XML using the generateXPCML method. - - Throws an XmlException if this object contains no data. - - @param outputStream The output stream to which to write the text. - @exception IOException If an error occurs while writing the data. - @exception XmlException If an error occurs while processing XPCML. - **/ - public void generateXPCML(OutputStream outputStream) - throws IOException, XmlException - { - if (outputStream == null) { - throw new NullPointerException("outputStream"); - } - if (m_pcmlDoc == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - m_pcmlDoc.generateXPCML(null, outputStream); - } - - - /** - Generates XPCML representing the data contained in the entire PCML node tree. - Note: XPCML cannot be generated from a serialized PCML file. - XPCML is XML based on the XML schema defined in xpcml.xsd. XPCML is similar - to PCML but allows for better validation of parameters and allows parameter - data to be input and output within an XML document. PCML is data-less in - that only parameter formats are input via PCML. In PCML, data values are set using - the setValue methods of the ProgramCallDocument class and data values are - gotten using the getValue methods of ProgramCallDocument. In XPCML, data values - can be specified directly within the XPCML document, and data values can be output - as XML using the generateXPCML method. - Throws an XmlException if this object contains no data. - - @param fileName The pathname of the file to which to write the text. - @exception IOException If an error occurs while writing the data. - @exception XmlException If an error occurs while processing XPCML. - **/ - public void generateXPCML(String fileName) - throws IOException, XmlException - { - if (fileName == null) { - throw new NullPointerException("fileName"); - } - FileOutputStream fos = null; - try - { - fos = new FileOutputStream(fileName); - generateXPCML(null, fos); - } - finally { - if (fos != null) fos.close(); - } - } - - /** - Generates XPCML representing the data contained for the passed in program name. - Note: XPCML cannot be generated from a serialized PCML file. - XPCML is XML based on the XML schema defined in xpcml.xsd. XPCML is similar - to PCML but allows for better validation of parameters and allows parameter - data to be input and output within an XML document. PCML is data-less in - that only parameter formats are input via PCML. In PCML, data values are set using - the setValue methods of the ProgramCallDocument class and data values are - gotten using the getValue methods of ProgramCallDocument. In XPCML, data values - can be specified directly within the XPCML document, and data values can be output - as XML using the generateXPCML method. - Throws an XmlException if this object contains no data. - - @param pgmName The program name to generate XPCML for. - @param fileName The pathname of the file to which to write the text. - @exception IOException If an error occurs while writing the data. - @exception XmlException If an error occurs while processing XPCML. - **/ - public void generateXPCML(String pgmName,String fileName) - throws IOException, XmlException - { - if (fileName == null) { - throw new NullPointerException("fileName"); - } - if (pgmName == null) { - throw new NullPointerException("pgmName"); - } - FileOutputStream fos = null; - try - { - fos = new FileOutputStream(fileName); - generateXPCML(pgmName, fos); - } - finally { - if (fos != null) fos.close(); - } - } - - // ****************************** - // @E0A -- New method * - // ****************************** - /** - Sets the XSD name that will appear in the generated <xpcml> tag from the generateXPCML() methods. - If name is not set then "xpcml.xsd" will appear in <xpcml> tag. This allows the user - to override the default and put in the name of their own xsd that was - used in condensing the XPCML output. - - @param xsdName The XSD name to appear in the <xpcml> tag when XPCML is output using the - generateXPCML method. - **/ - - public void setXsdName(String xsdName) - { - m_pcmlDoc.setXsdName(xsdName); - } - - - // ****************************** - // @E0A -- New method * - // ****************************** - /** - Returns the value of the XSD name to be used on the <xpcml> tag when - generating XPCML. - - @return The String "xsdName" value for this program object. - **/ - - public String getXsdName() - { - return m_pcmlDoc.getXsdName(); - } - - - /** - Transforms a PCML stream to its equivalent XPCML stream. - Throws an XmlException if this object contains no data. - - @param pcmlStream The PCML input stream. - @param xpcmlStream The output XPCML stream. - @exception IOException If an error occurs while writing the data. - @exception PcmlException If an error occurs while processing XPCML. - - **/ - - public static void transformPCMLToXPCML(InputStream pcmlStream, OutputStream xpcmlStream) - throws IOException, PcmlException, TransformerException, SAXException - { - - if (pcmlStream == null) { - throw new NullPointerException("pcmlStream"); - } - - if (xpcmlStream == null) { - throw new NullPointerException("xpcmlStream"); - } - - // Transform the PCML document to its equivalent XPCML document - XPCMLHelper.doTransform("pcml_xpcml.xsl",pcmlStream, xpcmlStream); //@CRS - } - - /** - Transforms a fully specified XPCML stream to a more condensed XPCML stream - and an XSD stream representing the new type definitions created while condensing. - Throws an XmlException if this object contains no data. - - @param fullStream The full XPCML input stream. - @param xsdStream The output xsd stream. - @param condensedStream The output condensed XPCML stream. - @param xsdStreamName The name of the xsd stream ("name.xsd") that will be created - @exception IOException If an error occurs while writing the data. - @exception PcmlException If an error occurs while processing XPCML. - - **/ - - public static void condenseXPCML(InputStream fullStream, OutputStream xsdStream, OutputStream condensedStream, String xsdStreamName) - throws IOException, PcmlException, TransformerException, SAXException - { - String xpcmlName=""; - - if (fullStream == null) { - throw new NullPointerException("fullStream"); - } - - if (xsdStream == null) { - throw new NullPointerException("xsdStream"); - } - - if (condensedStream == null) { - throw new NullPointerException("condensedStream"); - } - - if (xsdStreamName == null) { - throw new NullPointerException("xsdStreamName"); - } - - // Copy input stream fullStream into twoOutputStream - ByteArrayOutputStream outStream1 = new ByteArrayOutputStream(); - - byte[] bytesIn = new byte[1000]; - int bytesRead = 0; - bytesRead = fullStream.read(bytesIn); - - while (bytesRead != -1) - { - outStream1.write(bytesIn,0,bytesRead); - bytesRead = fullStream.read(bytesIn); - } - - outStream1.flush(); - outStream1.close(); - - // Cache the line count of the header - ByteArrayInputStream inStreamFull = new ByteArrayInputStream(outStream1.toByteArray()); - LineNumberReader lnr = new LineNumberReader(new InputStreamReader(inStreamFull)); - try - { - String line = lnr.readLine(); - boolean found=false; - while (line != null && !found) - { - // Look for xpcml tag - if (line.indexOf("xsi:noNamespaceSchemaLocation=") != -1) - { - found = true; - int index1 = line.indexOf("xsi:noNamespaceSchemaLocation="); - int index2=0; - index2 = line.indexOf("'", index1); - int index3=0; - if (index2 == -1) - { - index2 = line.indexOf("\"",index1); - if (index2 != -1) - index3 = line.indexOf("\"", index2+1); - } - else - { - index3 = line.indexOf("'",index2+1); - } - xpcmlName = line.substring(index2+1,index3); - continue; - } - if (line.indexOf("xsi:noNamespaceSchemaLocation =") != -1) - { - found = true; - int index1 = line.indexOf("xsi:noNamespaceSchemaLocation ="); - int index2=0; - index2 = line.indexOf("'", index1); - int index3=0; - if (index2 == -1) - { - index2 = line.indexOf("\"",index1); - if (index2 != -1) - index3 = line.indexOf("\"", index2+1); - } - else - { - index3 = line.indexOf("'",index2+1); - } - xpcmlName = line.substring(index2+1,index3); - continue; - } - line = lnr.readLine(); - } - } - catch (IOException e) - { - Trace.log(Trace.PCML, "Error when reading input stream in condenseXPCML"); - if (Trace.isTraceErrorOn()) - e.printStackTrace(Trace.getPrintWriter()); - throw new PcmlException(e); - } - if (xpcmlName == "") - xpcmlName="xpcml.xsd"; - - // Write contents of ByteArrayOutputStream to ByteArrayInputStream - ByteArrayInputStream inStream1 = new ByteArrayInputStream(outStream1.toByteArray()); // no need to close byte-array stream - ByteArrayInputStream inStream2 = new ByteArrayInputStream(outStream1.toByteArray()); // no need to close byte-array stream - - // Create new XSD type definitions based on full XPCML stream - XPCMLHelper.doCondenseTransform("xpcml_xsd.xsl",inStream1, xsdStream, xpcmlName); //@CRS - // Create condensed XPCML using XSD and full XPCML stream - XPCMLHelper.doCondenseTransform("xpcml_basic.xsl",inStream2, condensedStream, xsdStreamName); //@CRS - - } - - - // Traces a warning message about a null-valued parameter. - private static final void warnNull(String parmName) - { - if (Trace.isTraceOn()) Trace.log(Trace.WARNING, "Null value specified for '" + parmName + "' parameter on ProgramCallDocument constructor."); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/data/ProgramDescriptor.java b/cvsroot/src/com/ibm/as400/data/ProgramDescriptor.java deleted file mode 100644 index 73cf4873f..000000000 --- a/cvsroot/src/com/ibm/as400/data/ProgramDescriptor.java +++ /dev/null @@ -1,69 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProgramDescriptor.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -/** - * The ProgramDescriptor class implements the methods of the Descriptor interface - * that are unique to the tag. - * - **/ - -class ProgramDescriptor extends DocNodeDescriptor -{ - /* Constructor */ - public ProgramDescriptor(PcmlDocNode node) - { - super(node); - } - /** - * Return list of valid attributes for the tag. - **/ - public String[] getAttributeList() - { - return ((PcmlProgram)getDocNode()).getAttributeList(); - } - - /** - * Return a String containing the current value for the requested attribute. - **/ - public String getAttributeValue(String attr) - { - if (attr != null) - { - if (attr.equals("name")) - { - String name = getDocNode().getName(); - if (name.equals("")) - return null; - else - return name; - } - else if (attr.equals("path")) - return ((PcmlProgram)getDocNode()).getPath(); - else if (attr.equals("parseorder")) - return ((PcmlProgram)getDocNode()).getParseorder(); - else if (attr.equals("entrypoint")) - return ((PcmlProgram)getDocNode()).getEntrypoint(); - else if (attr.equals("returnvalue")) - return ((PcmlProgram)getDocNode()).getReturnvalue(); - else if (attr.equals("threadsafe")) // @A1A - return ((PcmlProgram)getDocNode()).getThreadsafe(); // @A1A - else if (attr.equals("epccsid")) // @D1A - return Integer.toString(((PcmlProgram)getDocNode()).getEpCcsid()); // @D1A - else - return null; - } - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/data/RecordFormatDescriptor.java b/cvsroot/src/com/ibm/as400/data/RecordFormatDescriptor.java deleted file mode 100644 index 60e4ca391..000000000 --- a/cvsroot/src/com/ibm/as400/data/RecordFormatDescriptor.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordFormatDescriptor.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -/** - * The RecordFormatDescriptor class implements the methods of the Descriptor interface - * that are unique to the <recordformat> tag. - * - **/ - -class RecordFormatDescriptor extends DocNodeDescriptor -{ - /* Constructor */ - public RecordFormatDescriptor(PcmlDocNode node) - { - super(node); - } - /** - * Return list of valid attributes for the tag. - **/ - public String[] getAttributeList() - { - return ((RfmlRecordFormat)getDocNode()).getAttributeList(); - } - - /** - * Return a String containing the current value for the requested attribute. - **/ - public String getAttributeValue(String attr) - { - if (attr != null) - { - if (attr.equals("name")) - { - String name = getDocNode().getName(); - if (name.equals("")) - return null; - else - return name; - } - else if (attr.equals("description")) - return ((RfmlRecordFormat)getDocNode()).getDescription(); - else return null; - } - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/data/RecordFormatDocument.java b/cvsroot/src/com/ibm/as400/data/RecordFormatDocument.java deleted file mode 100644 index af2db9a73..000000000 --- a/cvsroot/src/com/ibm/as400/data/RecordFormatDocument.java +++ /dev/null @@ -1,1495 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordFormatDocument.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import com.ibm.as400.access.*; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.OutputStream; -import java.io.Serializable; -import java.io.StreamCorruptedException; -import java.io.UnsupportedEncodingException; - -import java.lang.reflect.Method; - -import java.util.Enumeration; -import java.util.Vector; -import java.util.MissingResourceException; - -/** - * Supports the use of Record Format Markup Language - * (RFML) to specify formats and data values for file records and data buffers. - * RFML is an XML language similar to PCML (Program Call Markup Language). - * - * RecordFormatDocument parses an RFML document and allows the application to - * set and get values of specific fields within a record. - * - * The command line interface may be used to serialize - * RFML document definitions. - *

      - * java com.ibm.as400.data.RecordFormatDocument
      - *     -serialize
      - *     RFML document name
      - * 
      - * Options: - *
      - *
      -serialize - *
      Parses the RFML document and creates a serialized version of the document. - * The name of the serialized file will match the document name, and the file extension will be - * .rfml.ser (lowercase). - *

      rfml document name - *
      The fully-qualified resource name of the RFML document - * which defines the record format(s). - *
      - * - *

      Serialized RFML files - *
      To increase run-time performance, you can use a serialized RFML file. - * A serialized RFML file contains serialized Java objects representing the RFML. - * The objects that are serialized are the same objects that are created when you - * construct the RecordFormatDocument object from a RFML source file. - * Using serialized RFML files gives you better performance because the IBM - * XML parser is not needed at run-time to interpret and validate the RFML tags. - * - *

      For usage examples, refer to the PCML section of the Toolbox Programmer's - * Guide. The behavior of RecordFormatDocument matches that of - * {@link com.ibm.as400.data.ProgramCallDocument ProgramCallDocument} - * for methods that have the same name, such as setIntValue() and getIntValue(). - * - *

      Note: This class requires Java 2 (v1.2.2) or later. - * - **/ -public class RecordFormatDocument implements Serializable, Cloneable -{ - static final long serialVersionUID = 5L; // @A6C - - static final String RFML_VERSION = "4.0"; // NOTE: This needs to match the current value for the "version" attribute for the tag. @A1a - - private RfmlDocument m_rfmlDoc_; - - - /** - Constructs a RecordFormatDocument. -

      Prior to using an object constructed with this method, - either {@link #setDocument(String) setDocument} - or {@link #setValues(String,com.ibm.as400.access.Record) setValues} must be called. - */ - public RecordFormatDocument() - {} - - /** - Constructs a RecordFormatDocument. - The RFML document resource will be loaded from the classpath. - The classpath will first be searched for a serialized resource. - If a serialized resource is not found, the classpath will be - searched for an RFML source file. - - @param documentName The document resource name of the RFML document for the record formats to be referenced. - All RFML-related file extensions are assumed to be lowercase (for example, .rfml or .rfml.ser). - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myRfml" - - @exception XmlException when the specified RFML document cannot be found. - */ - public RecordFormatDocument(String documentName) - throws XmlException - { - if (documentName == null) throw new NullPointerException("documentName"); - m_rfmlDoc_ = loadRfmlDocument(documentName, null); - } - - /** - Constructs a RecordFormatDocument. - The RFML document resource will be loaded from the classpath of the specified ClassLoader. - The classpath will first be searched for a serialized resource. - If a serialized resource is not found, the classpath will be - searched for an RFML source file. - - @param documentName The document resource name of the RFML document for the record formats to be referenced. - All RFML-related file extensions are assumed to be lowercase (for example, .rfml or .rfml.ser). - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myRfml" - @param loader The ClassLoader that will be used when loading the specified document resource. - - @exception XmlException when the specified RFML document cannot be found. - */ - public RecordFormatDocument(String documentName, ClassLoader loader) - throws XmlException - { - if (documentName == null) throw new NullPointerException("documentName"); - if (loader == null) throw new NullPointerException("loader"); - m_rfmlDoc_ = loadRfmlDocument(documentName, loader); - } - - - /** - Constructs a RecordFormatDocument from a Record object. -
      Note: - The following Record datatypes are not supported by this method: -

        -
      • {@link com.ibm.as400.access.AS400Structure AS400Structure} -
      • {@link com.ibm.as400.access.AS400Array AS400Array} with elements of type AS400Array (multidimensional array) -
      - - @param record The Record object. - */ - public RecordFormatDocument(Record record) - throws XmlException - { - if (record == null) throw new NullPointerException("record"); - RecordFormat recordFormat = record.getRecordFormat(); - if (recordFormat == null) { - throw new XmlException(DAMRI.RECORD_NOT_INITIALIZED); - } - setRecordFormat(recordFormat); - setValues(recordFormat.getName(), record); - } - - /** - Constructs a RecordFormatDocument from a RecordFormat object. -
      Note: - The following Record datatypes are not supported by this method: -
        -
      • {@link com.ibm.as400.access.AS400Structure AS400Structure} -
      • {@link com.ibm.as400.access.AS400Array AS400Array} with elements of type AS400Array (multidimensional array) -
      - - @param recordFormat The RecordFormat object. - */ - public RecordFormatDocument(RecordFormat recordFormat) - throws XmlException - { - if (recordFormat == null) throw new NullPointerException("recordFormat"); - setRecordFormat(recordFormat); - } - - /** - Adds the specified attribute to the attribute list. - **/ - private static void addAttribute(PcmlAttributeList attrList, String attrName, String attrValue) - { - PcmlAttribute attr = new PcmlAttribute(attrName, attrValue, true); - attrList.addAttribute(attr); - } - - /** - Creates and returns a copy of this object. - @return A copy of this object. - **/ - public Object clone() - { - RecordFormatDocument newRfml = null; - try - { - newRfml = (RecordFormatDocument) super.clone(); - if (m_rfmlDoc_ != null) - newRfml.m_rfmlDoc_ = (RfmlDocument) m_rfmlDoc_.clone(); - } - catch (CloneNotSupportedException e) { - Trace.log(Trace.DIAGNOSTIC, e); - } - - return newRfml; - } - - /** - Returns an attribute list containing values derived from the FieldDescription. - If the DataType of the FieldDescription is AS400Structure or a multidimensional AS400Array, throws an XmlException. - **/ - private static PcmlAttributeList generateAttributeList(FieldDescription fieldDesc, boolean isKeyField, Vector priorFieldNames, String recordFormatName) - throws XmlException - { - // Determine what kind of field description it is, and map it to the appropriate RFML element. - AS400DataType dataType = fieldDesc.getDataType(); - - PcmlAttributeList attrList = new PcmlAttributeList(1); - int count = 1; - - // Note: Classes that implement interface AS400DataType: - // AS400Array, AS400Bin2, AS400Bin4, AS400Bin8, AS400ByteArray, AS400Date, AS400Time, AS400Timestamp, AS400Float4, AS400Float8, AS400PackedDecimal, AS400Structure, AS400Text, AS400UnsignedBin2, AS400UnsignedBin4, AS400UnsignedBin8, AS400ZonedDecimal. - - int dtType = dataType.getInstanceType(); - - if (dtType == AS400DataType.TYPE_ARRAY) - { - // Set the 'count' attribute. - count = ((AS400Array)dataType).getNumberOfElements(); - if (count < 0) { - Trace.log(Trace.DIAGNOSTIC, "AS400Array count is not set ("+count+")"); - count = 1; - } - addAttribute(attrList, "count", Integer.toString(count)); - // Set the data type to the contained type, so we can then set the attributes appropriately. - dataType = ((AS400Array)dataType).getType(); - dtType = dataType.getInstanceType(); - if (dataType.getInstanceType() == AS400DataType.TYPE_ARRAY) - { - // We don't yet support AS400Array-within-AS400Array. - throw new XmlException(DAMRI.MULTI_ARRAY_NOT_SUPPORTED); - } - } - -// if (dataType instanceof AS400Structure) { - if (dtType == AS400DataType.TYPE_STRUCTURE) - { - // Note: This type is left for a future enhancement. - throw new XmlException(DAMRI.DATATYPE_NOT_SUPPORTED, new String[] {"AS400Structure"} ); - } - - // Set the 'name' attribute. - String fieldName = fieldDesc.getFieldName(); - if (priorFieldNames.contains(fieldName)) { // @A1a - throw new XmlException(DAMRI.DUPLICATE_FIELD_NAME, new String[] {recordFormatName, fieldName} ); - } - if (fieldName != null && fieldName.length() != 0) { - addAttribute(attrList, "name", fieldName); - priorFieldNames.add(fieldName); // Remember that this name is already used. - } - - // Set the 'length' attribute. - // Note: At this point we know we don't have an AS400Structure. All RFML datatypes except "struct" require the 'length' attribute. - if (dtType == AS400DataType.TYPE_BIN2 || - dtType == AS400DataType.TYPE_UBIN2 || - dtType == AS400DataType.TYPE_BIN4 || - dtType == AS400DataType.TYPE_UBIN4 || - dtType == AS400DataType.TYPE_BIN8 || - dtType == AS400DataType.TYPE_UBIN8 || - dtType == AS400DataType.TYPE_FLOAT4 || - dtType == AS400DataType.TYPE_FLOAT8 || - dtType == AS400DataType.TYPE_PACKED) - { - // The numeric field types have architected lengths. We will set the length in the switch() statement below. - } - else { - int fieldLength; - if (count == 0) fieldLength = fieldDesc.getLength(); - else fieldLength = fieldDesc.getLength() / count; - addAttribute(attrList, "length", Integer.toString(fieldLength)); - } - - // If the field description has a default value, set the 'init' attribute. - Object defaultValue = fieldDesc.getDFT(); - if (defaultValue == null) defaultValue = fieldDesc.getDFTCurrentValue(); - if (defaultValue != null) - { - if (defaultValue instanceof byte[] && - ((byte[])defaultValue).length != 0) - { - // Note: In PCML (and RFML), if the 'init' attribute specifies a single-byte numeric value, that value is replicated into each byte in the byte-array. - byte[] dftBytes = (byte[])defaultValue; - if (isSameByteRepeated(dftBytes)) { - String byte0 = Byte.toString(dftBytes[0]); - addAttribute(attrList, "init", byte0); - } - else { - // Construct a String that lists out each separate byte value, e.g. "7 8 9 10". - StringBuffer valList = new StringBuffer(); - for (int i=0; i 0) { - addAttribute(attrList, "ccsid", Integer.toString(ccsid)); - } - } else - { - Method method = fieldDesc.getClass().getMethod("getCCSID", (java.lang.Class[]) null); //@pdc cast for jdk1.5 - String ccsids = (String)method.invoke(fieldDesc, (java.lang.Object[]) null); //@pdc cast for jdk1.5 - if (ccsids != null && ccsids.length() != 0) { - addAttribute(attrList, "ccsid", ccsids); - } - } - } - catch (Exception e) { // This is OK, since not all FieldDescriptions that have type==AS400Text have ccsid's. - Trace.log(Trace.DIAGNOSTIC, e); - } - break; - case AS400DataType.TYPE_ZONED: - addAttribute(attrList, "type", "zoned"); - // $A2 int precision = ((ZonedDecimalFieldDescription)fieldDesc).getDecimalPositions(); - int precisionZ = ((AS400ZonedDecimal) dataType).getNumberOfDecimalPositions(); // $A2 - addAttribute(attrList, "precision", Integer.toString(precisionZ)); - break; - - - case AS400DataType.TYPE_DATE: - addAttribute(attrList, "type", "date"); - addAttribute(attrList, "length",Integer.toString(fieldDesc.getLength())); - String dateFormat = ((DateFieldDescription)dataType).getDATFMT(); - addAttribute(attrList, "dateformat", dateFormat); - String dateSeparator = ((DateFieldDescription)dataType).getDATSEP(); - addAttribute(attrList, "dateseparator", dateSeparator); - break; - - case AS400DataType.TYPE_TIME: - addAttribute(attrList, "type", "time"); - addAttribute(attrList, "length",Integer.toString(fieldDesc.getLength())); - String timeFormat = ((TimeFieldDescription)dataType).getTIMFMT(); - addAttribute(attrList, "timeformat", timeFormat); - String timeSeparator = ((TimeFieldDescription)dataType).getTIMSEP(); - addAttribute(attrList, "timeseparator", timeSeparator); - break; - - case AS400DataType.TYPE_TIMESTAMP: - addAttribute(attrList, "type", "timestamp"); - addAttribute(attrList, "length",Integer.toString(fieldDesc.getLength())); - break; - - - default: - // None of the above. - Trace.log(Trace.ERROR, "Unrecognized data type: dtType=="+dtType); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - - // If the field is a "key field", set the keyfield attribute. - if (isKeyField) { - addAttribute(attrList, "keyfield", "true"); - } - - return attrList; - } - - - /** - Returns a Descriptor for the specified RFML document. - The RFML document resource will be loaded from the classpath. - The classpath will first be searched for a serialized resource. - If a serialized resource is not found, the classpath will be - searched for an RFML source file. - - @param documentName The document resource name of the RFML document for which the Descriptor is returned. - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myRfml" - - @return A descriptor for the element of the named RFML file. - - @exception XmlException when the specified RFML document cannot be found. - **/ - public static Descriptor getDescriptor(String documentName) // @A7c - throws XmlException - { - if (documentName == null) throw new NullPointerException("documentName"); - RfmlDocument pd = null; - - pd = loadRfmlDocument(documentName, null); - - return new RfmlDescriptor(pd); - } - - /** - Returns a Descriptor representing the specified RFML document. - The RFML document resource will be loaded from the classpath. - The classpath will first be searched for a serialized resource. - If a serialized resource is not found, the classpath will be - searched for an RFML source file. - - @param documentName The document resource name of the RFML document for which the Descriptor is returned. - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myRfml" - @param loader The ClassLoader that will be used when loading the specified document resource. - @return A descriptor for the element of the named RFML file. - - @exception XmlException when the specified RFML document cannot be found. - **/ - public static Descriptor getDescriptor(String documentName, ClassLoader loader) // @A7c - throws XmlException - { - if (documentName == null) throw new NullPointerException("documentName"); - if (loader == null) throw new NullPointerException("loader"); - RfmlDocument pd = null; - - pd = loadRfmlDocument(documentName, loader); - - return new RfmlDescriptor(pd); - } - - /** - Returns a Descriptor representing the current RFML document. - - @return A descriptor for the element of the current RFML file, or - null if the RFML document has not be set. - **/ - public Descriptor getDescriptor() // @A7c - { - if (m_rfmlDoc_ != null) return new RfmlDescriptor(m_rfmlDoc_); - else return null; - } - - /** - Returns a Descriptor representing the current RFML document. - - @return The Descriptor for the element of the current RFML file, or - null if the RFML document has not be set. - **/ - String getDocName() - { - - if (m_rfmlDoc_ == null) return null; - else return m_rfmlDoc_.getDocName(); - } - - /** - Returns a double value for the named element. - - @return The integer value for the named element. - - @param name The name of the <data> element in the PCML document. - @exception XmlException If an error occurs while processing RFML. - **/ - public double getDoubleValue(String name) - throws XmlException - { - // Note: The getDoubleValue() methods require Java2 or later, since they use Double.parseDouble(). - if (name == null) throw new NullPointerException("name"); - if (m_rfmlDoc_ == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - return m_rfmlDoc_.getDoubleValue(name); - } - - /** - Returns a double value for the named element given indices to the data element. - If the data element is an array or is an element in a structure array, an index - must be specified for each dimension of the data. - - @return The integer value for the named element. - - @param name The name of the <data> element in the PCML document. - @param indices An array of indices for accessing the value of an element in an array. - @exception XmlException If an error occurs while processing RFML. - **/ - public double getDoubleValue(String name, int[] indices) - throws XmlException - { - if (name == null) throw new NullPointerException("name"); - if (indices == null) throw new NullPointerException("indices"); - if (m_rfmlDoc_ == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - return m_rfmlDoc_.getDoubleValue(name, new PcmlDimensions(indices)); - } - - /** - Returns an int value for the named element. - - @return The integer value for the named element. - - @param name The name of the <data> element in the PCML document. - @exception XmlException If an error occurs while processing RFML. - **/ - public int getIntValue(String name) - throws XmlException - { - if (name == null) throw new NullPointerException("name"); - if (m_rfmlDoc_ == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - return m_rfmlDoc_.getIntValue(name); - } - - /** - Returns an int value for the named element given indices to the data element. - If the data element is an array or is an element in a structure array, an index - must be specified for each dimension of the data. - - @return The integer value for the named element. - - @param name The name of the <data> element in the PCML document. - @param indices An array of indices for accessing the value of an element in an array. - @exception XmlException If an error occurs while processing RFML. - **/ - public int getIntValue(String name, int[] indices) - throws XmlException - { - if (name == null) throw new NullPointerException("name"); - if (indices == null) throw new NullPointerException("indices"); - if (m_rfmlDoc_ == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - return m_rfmlDoc_.getIntValue(name, new PcmlDimensions(indices)); - } - - - /** - Returns a String value for the named <data type="char"> element. - The default bidi string type is assumed ({@link com.ibm.as400.access.BidiStringType#DEFAULT BidiStringType.DEFAULT}). - - @param name The name of the <data> element in the RFML document. - @exception XmlException If an error occurs while processing RFML. - **/ - public String getStringValue(String name) - throws XmlException - { - return getStringValue(name, BidiStringType.DEFAULT); - } - - /** - Returns a String value for the named <data type="char"> element. -

      - This method should be used when the string type cannot be determined until - run-time. In those cases, the RFML document cannot be used to indicate - the string type so this method can be used to get the value using the - string type that is specified. - - @param name The name of the <data> element in the RFML document. - @param type The bidi string type, as defined by the CDRA (Character - Data Representation Architecture). - @exception XmlException If an error occurs while processing RFML. - **/ - public String getStringValue(String name, int type) - throws XmlException - { - if (name == null) throw new NullPointerException("name"); - if (m_rfmlDoc_ == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - return m_rfmlDoc_.getStringValue(name, type); - } - - /** - Returns a String value for the named <data type="char"> element, given indices to the data element. - If the data element is an array or is an element in a structure array, an index - must be specified for each dimension of the data. -

      - This method should be used when the string type cannot be determined until - run-time. In those cases, the RFML document cannot be used to indicate - the string type so this method can be used to get the value using the - string type that is specified. - - @param name The name of the <data> element in the RFML document. - @param indices An array of indices for setting the value of an element in an array. - @param type The bidi string type, as defined by the CDRA (Character - Data Representation Architecture). - @exception XmlException If an error occurs while processing RFML. - **/ - public String getStringValue(String name, int[] indices, int type) - throws XmlException - { - if (name == null) throw new NullPointerException("name"); - if (indices == null) throw new NullPointerException("indices"); - if (m_rfmlDoc_ == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - return m_rfmlDoc_.getStringValue(name, new PcmlDimensions(indices), type); - } - - - - /** - Returns the Java object value for the named element. -

      - The type of object returned depends on the description in the RFML document. - - - - - - - - - - - - - - - -
      RFML DescriptionObject Returned
      type=charString
      type=bytebyte[]
      type=int
      - length=2
      - precision=15
      Short
      type=int
      - length=2
      - precision=16
      Integer
      type=int
      - length=4
      - precision=31
      Integer
      type=int
      - length=4
      - precision=32
      Long
      type=int
      - length=8
      - precision=63
      Long
      type=int
      - length=8
      - precision=64
      Double
      type=packedBigDecimal
      type=zonedBigDecimal
      type=float
      - length=4
      Float
      type=float
      - length=8
      Double
      type=structnull
      - - @return The Java object value for the named <data> element in the RFML document. - - @param name The name of the <data> element in the RFML document. - @exception XmlException If an error occurs while processing RFML. - **/ - public Object getValue(String name) - throws XmlException - { - if (name == null) throw new NullPointerException("name"); - if (m_rfmlDoc_ == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - return m_rfmlDoc_.getValue(name); - } - - /** - Returns the Java object value for the named element given indices to the data element. - If the data element is an array or is an element in a structure array, an index - must be specified for each dimension of the data. -

      - The type of object returned depends on the description in the RFML document. - - @return The Java object value for the named <data> element in the RFML document. - - @param name The name of the <data> element in the RFML document. - @param indices An array of indices for accessing the value of an element in an array. - @exception XmlException If an error occurs while processing RFML. - **/ - public Object getValue(String name, int[] indices) - throws XmlException - { - if (name == null) throw new NullPointerException("name"); - if (indices == null) throw new NullPointerException("indices"); - if (m_rfmlDoc_ == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - return m_rfmlDoc_.getValue(name, new PcmlDimensions(indices)); - } - - /** - Determines whether the specified byte array consists of the same byte repeated. - For example, returns true for {1,1,1,1}, and returns false for {1,2,3,4}. - **/ - private static boolean isSameByteRepeated(byte[] bytes) - { - // Assume that the array is non-null and length is non-zero. - for (int i=1; i - The named element must be able to be set using a Integer object. - - @param name The name of the <data> element in the RFML document. - @param value The int value for the named element. - @exception XmlException If an error occurs while processing RFML. - **/ - public void setIntValue(String name, int value) - throws XmlException - { - setValue(name, new Integer(value)); - } - - /** - Sets the Java object value for the named element using an int input value - given indices to the data element. -

      - The named element must be able to be set using a Integer object. - - @param name The name of the <data> element in the RFML document. - @param indices An array of indices for setting the value of an element in an array. - @param value The int value for the named element. - @exception XmlException If an error occurs while processing RFML. - **/ - public void setIntValue(String name, int[] indices, int value) - throws XmlException - { - setValue(name, indices, new Integer(value)); - } - - /** - Sets the document format. - */ - private void setRecordFormat(RecordFormat recordFormat) - throws XmlException - { - // Assume the caller has validated the argument. - - String fmtName = recordFormat.getName(); - if (fmtName == null || fmtName.length() == 0) { - Trace.log(Trace.ERROR, "RecordFormat name is null or zero-length."); - throw new XmlException(DAMRI.RECORDFORMAT_NOT_INITIALIZED); - } - setRecordFormat(fmtName, recordFormat); - } - - /** - Sets the document format. - */ - private void setRecordFormat(String formatName, RecordFormat recordFormat) - throws XmlException - { - // Assume the caller has validated the arguments. - - // Set up the document node. - // Get document name and attributes (version and ccsid). Note that the RecordFormat class has no CCSID attribute. - PcmlAttributeList attrList = new PcmlAttributeList(1); - addAttribute(attrList, "version", RFML_VERSION); // @A1c - m_rfmlDoc_ = new RfmlDocument(attrList, recordFormat.getName()); - - // Set up a recordformat node. - attrList = new PcmlAttributeList(1); - addAttribute(attrList, "name", formatName); - RfmlRecordFormat recFormatNode = new RfmlRecordFormat(attrList); - m_rfmlDoc_.addChild(recFormatNode); - - // Examine the field descriptions in the RecordFormat. - FieldDescription[] descriptions = recordFormat.getFieldDescriptions(); - FieldDescription[] keyFieldDescriptions = recordFormat.getKeyFieldDescriptions(); - Vector priorFieldNames = new Vector(); // Detect any duplicate names. // @A1a - for (int i=0; i<data> element in the RFML document. - @param value The string value for the named element. - @exception XmlException If an error occurs while processing RFML. - **/ - public void setStringValue(String name, String value) - throws XmlException - { - setStringValue(name, value, BidiStringType.DEFAULT); - } - - /** - Sets the Java object value for the named <data type="char"> element using a String input. -

      - This method should be used when the string type cannot be determined until - run-time. In those cases, the RFML document cannot be used to indicate - the string type so this method can be used to set the value and the - string type of the input value. - - @param name The name of the <data> element in the RFML document. - @param value The string value for the named element. - @param type The bidi string type, as defined by the CDRA (Character - Data Representation Architecture). - @exception XmlException If an error occurs while processing RFML. - @see com.ibm.as400.access.BidiStringType - **/ - public void setStringValue(String name, String value, int type) - throws XmlException - { - if (name == null) throw new NullPointerException("name"); - if (value == null) throw new NullPointerException("value"); - if (m_rfmlDoc_ == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - m_rfmlDoc_.setStringValue(name, value, type); - } - - /** - Sets the Java object value for the named <data type="char"> element using a String input value, given indices to the data element. -

      - This method should be used when the string type cannot be determined until - run-time. In those cases, the RFML document cannot be used to indicate - the string type so this method can be used to set the value and the - string type of the input value. - - @param name The name of the <data> element in the RFML document. - @param indices An array of indices for setting the value of an element in an array. - @param value The string value for the named element. - @param type The bidi string type, as defined by the CDRA (Character - Data Representation Architecture). - @exception XmlException If an error occurs while processing RFML. - **/ - public void setStringValue(String name, int[] indices, String value, int type) - throws XmlException - { - if (name == null) throw new NullPointerException("name"); - if (indices == null) throw new NullPointerException("indices"); - if (value == null) throw new NullPointerException("value"); - if (m_rfmlDoc_ == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - m_rfmlDoc_.setStringValue(name, value, new PcmlDimensions(indices), type); - } - - /** - Sets the RFML document resource. - The RFML document resource will be loaded from the classpath. - The classpath will first be searched for a serialized resource. - If a serialized resource is not found, the classpath will be - searched for an RFML source file. - - @param documentName The document resource name of the RFML document for the record formats to be referenced. - All RFML-related file extensions are assumed to be lowercase (for example, .rfml or .rfml.ser). - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myRfml" - - @exception XmlException when the specified RFML document cannot be found. - **/ - public void setDocument(String documentName) - throws XmlException - { - if (documentName == null) throw new NullPointerException("documentName"); - if (m_rfmlDoc_ != null) - throw new XmlException(DAMRI.DOCUMENT_ALREADY_SET ); - - m_rfmlDoc_ = loadRfmlDocument(documentName, null); - } - - /** - Sets the RFML document resource. - The RFML document resource will be loaded from the classpath. - The classpath will first be searched for a serialized resource. - If a serialized resource is not found, the classpath will be - searched for an RFML source file. - - @param documentName The document resource name of the RFML document for the record formats to be referenced. - All RFML-related file extensions are assumed to be lowercase (for example, .rfml or .rfml.ser). - The resource name can be a package qualified name. For example, "com.myCompany.myPackage.myRfml" - @param loader The ClassLoader that will be used when loading the specified document resource. - - @exception XmlException when the specified RFML document cannot be found. - **/ - public void setDocument(String documentName, ClassLoader loader) - throws XmlException - { - if (documentName == null) throw new NullPointerException("documentName"); - if (loader == null) throw new NullPointerException("loader"); - if (m_rfmlDoc_ != null) - throw new XmlException(DAMRI.DOCUMENT_ALREADY_SET ); - - m_rfmlDoc_ = loadRfmlDocument(documentName, loader); - } - - /** - Sets the Java object value for the named element. -

      - If the input value provided is not an instance of the - correct Java class for the defined data type, it will be converted - to the correct Java class. - For example, if an element is defined as - "type=int length=2 precision=15", - it will automatically be converted to a Java Short object, if the value specified is an instance of Number or String. - - @param name The name of the <data> element in the RFML document. - @param value The Java object value for the named element. The type of Object passed must be - the correct type for the element definition or a String that can be converted to the correct type. Null values are not allowed. - @exception XmlException If an error occurs while processing RFML. - **/ - public void setValue(String name, Object value) - throws XmlException - { - if (name == null) throw new NullPointerException("name"); - if (value == null) throw new NullPointerException("value"); - if (m_rfmlDoc_ == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - m_rfmlDoc_.setValue(name, value); - } - - /** - Sets the Java object value for the named element - given indices to the data element. - If the data element is an array or is an element in a structure array, an index - must be specified for each dimension of the data. -

      - If the input value provided is not an instance of the - correct Java class for the defined data type, it will be converted - to the correct Java class. - For example, if an element is defined as - "type=int length=2 precision=15", - it will automatically be converted to a Java Short object, if the value specified is an instance of Number or String. - - @param name The name of the <data> element in the RFML document. - @param indices An array of indices for setting the value of an element in an array. - @param value The Java object value for the named element. The type of Object passed must be - the correct type for the element definition or a String that can be converted to the correct type. Null values are not allowed. - @exception XmlException If an error occurs while processing RFML. - **/ - public void setValue(String name, int[] indices, Object value) - throws XmlException - { - if (name == null) throw new NullPointerException("name"); - if (indices == null) throw new NullPointerException("indices"); - if (value == null) throw new NullPointerException("value"); - if (m_rfmlDoc_ == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - m_rfmlDoc_.setValue(name, value, new PcmlDimensions(indices)); - } - - - /** - Sets the Java object values for the specified <recordformat> element, based on the values stored in the record object passed into the method. -
      - For any given field, if the input value provided is not an instance of the - correct Java class for the defined data type, it will be converted - to the correct Java class. - For example, if an element is defined as - "type=int length=2 precision=15", - it will automatically be converted to a Java Short object, if the value specified is an instance of Number or String. If any field in the Record is null-valued, a warning is issued. -
      Note: - The following Record datatypes are not supported by this method: -

        -
      • {@link com.ibm.as400.access.AS400Structure AS400Structure} -
      • {@link com.ibm.as400.access.AS400Array AS400Array} with elements of type AS400Array (multidimensional array) -
      - - @param formatName The name of the <recordformat> element in the RFML document. - @param record The record object containing the data. - @exception XmlException If an error occurs while processing RFML, or if an encoding specified by the Record is unsupported. - **/ - public void setValues(String formatName, Record record) - throws XmlException - { - if (formatName == null) throw new NullPointerException("formatName"); - if (record == null) throw new NullPointerException("record"); - if (m_rfmlDoc_ == null) { - RecordFormat recFmt = record.getRecordFormat(); - if (recFmt != null) setRecordFormat(formatName, recFmt); - else { - Trace.log(Trace.ERROR, "The Record has a null RecordFormat."); - throw new XmlException(DAMRI.RECORD_NOT_INITIALIZED); - } - } - - // Get the node for the specified recordformat element. - RfmlRecordFormat recFormatNode = m_rfmlDoc_.getRecordFormatNode(formatName); - - // Set the value of each <data> tag to the corresponding field value in the record. - try { - recFormatNode.setValues(record); - } - catch (UnsupportedEncodingException e) { - throw new XmlException(e); - } - } - - /** - Sets the data represented by the specified <recordformat> element. - - @param formatName The name of the <recordformat> element in the RFML document. - @param values The byte values for all the fields in the the named element. The length of the byte array must exactly match the length of data required, otherwise an XmlException is thrown. - @exception XmlException If an error occurs while processing RFML. - **/ - public void setValues(String formatName, byte[] values) - throws XmlException - { - if (formatName == null) throw new NullPointerException("formatName"); - if (values == null) throw new NullPointerException("values"); - if (m_rfmlDoc_ == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - - // Get the node for the specified recordformat element. - RfmlRecordFormat recFormatNode = m_rfmlDoc_.getRecordFormatNode(formatName); - - // Feed the bytes to the node. - int bytesConsumed = recFormatNode.parseBytes(values); - if (bytesConsumed < values.length) - { - throw new XmlException(DAMRI.EXCESS_INPUT_DATA, new Object[] {Integer.toString(bytesConsumed), Integer.toString(values.length), "", m_rfmlDoc_.getNameForException()} ); - } - } - - - /** - Returns the data contained by the specified <recordformat> element, as a byte array. - - @return The data contained by the record. - - @param formatName The name of the <recordformat> element in the RFML document. - **/ - public byte[] toByteArray(String formatName) - throws XmlException - { - if (formatName == null) throw new NullPointerException("formatName"); - if (m_rfmlDoc_ == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - - // Get the node for the specified recordformat element. - RfmlRecordFormat recFormatNode = m_rfmlDoc_.getRecordFormatNode(formatName); - - // Generate bytes. - return recFormatNode.toBytes(); - } - - - /** - Returns a Record object with the same structure and data as the specified <recordformat> element. - Before this method is called, all <data> elements must either have their values set, or have 'init' values. -
      Note: When the Record is created, the 'count' attribute of <data> elements is disregarded. - - @return A Record object containing the same information as the specified <recordformat> element. - - @param formatName The name of the <recordformat> element in the RFML document. - @exception XmlException If an error occurs while processing RFML. - **/ - public Record toRecord(String formatName) - throws XmlException - { - try { - return new Record(toRecordFormat(formatName), toByteArray(formatName)); - } - catch (UnsupportedEncodingException e) { - throw new XmlException(e); // This should never happen, but if it does... - } - } - - - /** - Returns a RecordFormat object with the same structure as the specified <recordformat> element. - Note: For <data> elements, the 'count' attribute is disregarded. - - @return A RecordFormat object with the same structure as the specified <recordformat> element. - - @param formatName The name of the <recordformat> element in the RFML document. - **/ - public RecordFormat toRecordFormat(String formatName) - throws XmlException - { - if (formatName == null) throw new NullPointerException("formatName"); - if (m_rfmlDoc_ == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - - // Get the node for the specified recordformat element. - RfmlRecordFormat recFormatNode = m_rfmlDoc_.getRecordFormatNode(formatName); - - // Generate a RecordFormat. - return recFormatNode.toRecordFormat(); - } - - - /** - Generates XML (RFML) representing the data contained in this object. - Throws an XmlException if this object contains no data. - - @param outputStream The output stream to which to write the text. - @exception IOException If an error occurs while writing the data. - @exception XmlException If an error occurs while processing RFML. - **/ - public void toXml(OutputStream outputStream) - throws IOException, XmlException - { - if (outputStream == null) { - throw new NullPointerException("outputStream"); - } - if (m_rfmlDoc_ == null) { - throw new XmlException(DAMRI.DOCUMENT_NOT_SET ); - } - m_rfmlDoc_.toXml(outputStream); - } - - /** - Generates XML (RFML) representing the data contained in this object. - Throws an XmlException if this object contains no data. - - @param file The file to which to write the text. - @exception IOException If an error occurs while writing the data. - @exception XmlException If an error occurs while processing RFML. - **/ - public void toXml(File file) - throws IOException, XmlException - { - FileOutputStream fos = null; - try - { - fos = new FileOutputStream(file); - toXml(fos); - } - finally - { - if (fos != null) fos.close(); - } - } - - /** - Generates XML (RFML) representing the data contained in this object. - Throws an XmlException if this object contains no data. - - @param fileName The pathname of the file to which to write the text. - @exception IOException If an error occurs while writing the data. - @exception XmlException If an error occurs while processing RFML. - **/ - public void toXml(String fileName) - throws IOException, XmlException - { - FileOutputStream fos = null; - try - { - fos = new FileOutputStream(fileName); - toXml(fos); - } - finally - { - if (fos != null) fos.close(); - } - } - - /** - Custom serialization. - **/ - private void writeObject(ObjectOutputStream out) - throws IOException - { - synchronized (this) - { - if (m_rfmlDoc_ != null) { - m_rfmlDoc_.setSerializingWithData(true); - } - - // Perform default serialization - out.defaultWriteObject(); - - } // end of synchronized code - } - -} diff --git a/cvsroot/src/com/ibm/as400/data/ResourceLoader.java b/cvsroot/src/com/ibm/as400/data/ResourceLoader.java deleted file mode 100644 index 2a7c50749..000000000 --- a/cvsroot/src/com/ibm/as400/data/ResourceLoader.java +++ /dev/null @@ -1,122 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceLoader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import com.ibm.as400.access.Trace; // @A1A -import java.text.MessageFormat; -import java.util.*; - -/** - * A utility class which wrappers ResourceBundle - * operations and handles exceptions gracefully. - * For example, if a string resource - * cannot be accessed, ResourceLoader returns - * the string "RESOURCEMISSING", allowing the developer to - * quickly detect the missing resource and correct the problem. - */ -class ResourceLoader extends Object -{ - private ResourceBundle m_bundle = null; - - /** - * Sets the resource bundle name. - * - * setResourceName attempts to load the specified - * resource bundle. If an error occurs, an exception is logged - * and appropriate action is taken on subsequent requests for - * specific resources. - * - * @param name the name of the resource bundle to be loaded. - * If the resource bundle could not be found, getString - * will return the string "RESOURCE BUNDLE ERROR". - */ - public void setResourceName(String name) - { - if (m_bundle == null) - { - try - { - m_bundle = ResourceBundle.getBundle(name); - } - catch (MissingResourceException e) - { - Trace.log(Trace.ERROR, e); // @A1C - } - } - } - - /** - * Returns a locale-dependent string. - * - * getString looks for the string resource identified - * by the specified key in the resource bundle specified on setResourceName. - * If the string could not be found, getString - * returns "RESOURCEMISSING". If the resource bundle could not - * be loaded, getString returns "RESOURCEBUNDLEERROR". - * - * @param key the key which identifies the string to be loaded. - */ - public String getString(String key) - { - if (m_bundle != null) - { - try - { - return m_bundle.getString(key); - } - catch (MissingResourceException e) - { - Trace.log(Trace.ERROR, e); // @A1C - try - { - return MessageFormat.format(m_bundle.getString(DAMRI.MISSING_KEY), new Object[] {key}); - } - catch (Exception eAgain) - { - return "RESOURCE BUNDLE ERROR."; - } - } - } - else - return "RESOURCE BUNDLE ERROR."; - } - - /** - * Returns a locale-dependent string. - * - * getString looks for the string resource identified - * by the specified key in the resource bundle specified on setResourceName. - * If the string could not be found, getString - * returns "RESOURCEMISSING". If the resource bundle could not - * be loaded, getString returns "RESOURCEBUNDLEERROR". - * - * @param key the key which identifies the string to be loaded. - */ - public String getStringWithNoSubstitute(String key) - { - if (m_bundle != null) - { - try - { - return m_bundle.getString(key); - } - catch (MissingResourceException e) - { - return null; - } - } - else - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/data/RfmlData.java b/cvsroot/src/com/ibm/as400/data/RfmlData.java deleted file mode 100644 index 8260daaf9..000000000 --- a/cvsroot/src/com/ibm/as400/data/RfmlData.java +++ /dev/null @@ -1,50 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RfmlData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -class RfmlData extends PcmlData { - // New attributes should be added to the end of this array - private static final String DATAATTRIBUTES[] = { - "name", - "count", - "type", - "length", - "precision", - "ccsid", - "init", - "struct", - "bidistringtype", - "keyfield", - "dateformat", - "dateseparator", - "timeformat", - "timeseparator" - }; - // Note: The following PcmlData attributes are irrelevant to this class: - // usage, minvrm, maxvrm, offset, offsetfrom, outputsize, passby, trim, chartype. - - /** Constructor with description. **/ - RfmlData(PcmlAttributeList attrs) - { - super(attrs, true); - } - - /** - Returns the list of valid attributes for the data element. - **/ - String[] getAttributeList() - { - return DATAATTRIBUTES; - } -} diff --git a/cvsroot/src/com/ibm/as400/data/RfmlDescriptor.java b/cvsroot/src/com/ibm/as400/data/RfmlDescriptor.java deleted file mode 100644 index dd2e8185f..000000000 --- a/cvsroot/src/com/ibm/as400/data/RfmlDescriptor.java +++ /dev/null @@ -1,40 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RfmlDescriptor.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -/** - * The RfmlDescriptor class implements the methods of the Descriptor interface - * that are unique to the <rfml> tag. - * - **/ - -class RfmlDescriptor extends PcmlDescriptor -{ - /** Constructor. **/ - public RfmlDescriptor(PcmlDocNode node) - { - super(node); - } - - /** - * Returns a String containing the current value for the requested attribute. - **/ - public String getAttributeValue(String attr) - { - if (attr != null && attr.equals("ccsid")) - return ((RfmlDocument)getDocNode()).getCcsid(); - else - return super.getAttributeValue(attr); - } -} diff --git a/cvsroot/src/com/ibm/as400/data/RfmlDocument.java b/cvsroot/src/com/ibm/as400/data/RfmlDocument.java deleted file mode 100644 index 98dd63b84..000000000 --- a/cvsroot/src/com/ibm/as400/data/RfmlDocument.java +++ /dev/null @@ -1,290 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RfmlDocument.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import com.ibm.as400.access.AS400DataType; -import com.ibm.as400.access.AS400Text; -import com.ibm.as400.access.Record; -import com.ibm.as400.access.RecordFormat; -import com.ibm.as400.access.Trace; - -import java.io.IOException; -import java.io.PrintWriter; -import java.io.OutputStream; -import java.util.Enumeration; - - - -/** -*/ -class RfmlDocument extends PcmlDocument { - static final long serialVersionUID = 5L; - - // New attributes should be added to the end of this array - private static final String RFML_ATTRIBUTES[] = { - "version", "ccsid" - }; - - private static final int DEFAULT_CCSID = 65535; // value to report if not explicitly set. - - // Note: The following two variables represent the same value in two forms. - private String m_Ccsid; // null indicates "uninitialized" - private int m_CcsidInt; // zero indicates "uninitialized" - - /** - */ - RfmlDocument(PcmlAttributeList attrs, String docName) - { - super(attrs,docName); - setNodeType(PcmlNodeType.RFML); - setCcsid(getAttributeValue("ccsid")); - } - - /** - Returns the list of valid attributes for the element. - **/ - String[] getAttributeList() - { - return RFML_ATTRIBUTES; - } - - - /** - Returns the ccsid= String value. If not set, returns null. - **/ - public final String getCcsid() - { - return m_Ccsid; - } - - - /** - Returns the ccsid= integer literal value. If not set, returns 65535. - **/ - public final int getCcsidInt() - { - if (m_CcsidInt == 0) return DEFAULT_CCSID; // if uninitialized, report default - else return m_CcsidInt; - } - - /** - Overrides the implementation of the superclass (PcmlDocument). - **/ - protected AS400DataType getConverter(int dataType, int dataLength, int dataPrecision, int ccsid, String dateFormat, String dateSeparator, String timeFormat, String timeSeparator) - throws PcmlException - { - if (dataType == PcmlData.CHAR) - { - // If the requested CCSID is not the same as - // the system's default host CCSID, always create - // a new converter. We only cache converters - // with CCSIDs that match the system object. - if (ccsid != m_CcsidInt) - { - return new AS400Text(dataLength, ccsid); - } - - switch (dataLength) - { - case 1: - if (m_Text_1 == null) - { - m_Text_1 = new AS400Text(dataLength, ccsid); - } - return m_Text_1; - case 10: - if (m_Text_10 == null) - { - m_Text_10 = new AS400Text(dataLength, ccsid); - } - return m_Text_10; - default: - return new AS400Text(dataLength, ccsid); - - } - } - else { - return super.getConverter(dataType, dataLength, dataPrecision, ccsid, dateFormat, dateSeparator, timeFormat, timeSeparator); - } - } - - /** - Returns the value of the specified (numeric) field, as a "double". - **/ - synchronized double getDoubleValue(String name) throws PcmlException - { - return getDoubleValue(name, new PcmlDimensions()); - } - - /** - Returns the value of the specified (numeric) field, as a "double". - **/ - synchronized double getDoubleValue(String name, PcmlDimensions indices) throws PcmlException - { - Object value; - - value = getValue(name, indices); - - if (value == null) - { - throw new PcmlException(DAMRI.INPUT_VALUE_NOT_SET, new Object[] {name} ); - } - else if (value instanceof String) - { - return Double.parseDouble((String) value); // Note: parseDouble() is new in Java2. - } - else if (value instanceof Number) - { - return ((Number) value).doubleValue(); - } - else - { - throw new PcmlException(DAMRI.STRING_OR_NUMBER, new Object[] {value.getClass().getName(), name} ); - } - } - - - /** - Returns a RfmlRecordFormat object representing the specified <recordformat> element. - **/ - RfmlRecordFormat getRecordFormatNode(String formatName) - throws XmlException - { - PcmlNode node = getElement(formatName); - if (node instanceof RfmlRecordFormat) - { - return (RfmlRecordFormat) node; - } - else - { - if (node == null) - throw new XmlException(DAMRI.ELEMENT_NOT_FOUND, new Object[] {formatName, ""} ); - else - throw new XmlException(DAMRI.WRONG_ELEMENT_TYPE, new Object[] {formatName, ""} ); - } - } - - - - /** - Sets the ccsid= attribute value. - **/ - protected void setCcsid(String ccsid) - { - // Handle null or empty string - if (ccsid == null || ccsid.equals("")) - { - m_Ccsid = null; - m_CcsidInt = 0; - return; - } - - // Try to parse an integer from the attribute value - try - { - m_Ccsid = ccsid; - m_CcsidInt = Integer.parseInt(ccsid); - } - // If value is not an integer, assume that it's an element name. - // checkAttributes() will be called later to verify the element name. - catch (NumberFormatException e) - { - m_Ccsid = null; - m_CcsidInt = 0; - } - } - - - /** - Generates XML (RFML) representing the data contained in this object. - Throws a runtime exception if this object contains no data. - - @param outStream The output stream to which to write the text. - @exception IOException If an error occurs while writing the data. - @exception XmlException If an error occurs while processing RFML. - **/ - public void toXml(OutputStream outStream) - throws IOException, XmlException - { - PrintWriter xmlFile = null; - try - { - xmlFile = new PrintWriter(outStream); - xmlFile.println(""); // @A1c - xmlFile.println(""); - - toXml(this, xmlFile, ""); - - if (xmlFile.checkError()) // Note: This flushes the stream. - { - Trace.log(Trace.ERROR, "Error when writing RFML to OutputStream."); - // Possible future enhancement: Throw an exception indicating IO error when writing RFML. - } - } - finally { - if (xmlFile != null) xmlFile.close(); // Note: close() flushes the stream first. - } - } - - - /** - Generates XML (RFML) representing the data contained in the specified node. - Throws a runtime exception if this object contains no data. - - @param node The node to generate RFML for. - @param writer The writer to which to write the text. - @param indent The indentation with which to prepend the generated XML. - @exception IOException If an error occurs while writing the data. - @exception XmlException If an error occurs while processing RFML. - **/ - private static void toXml(PcmlDocNode node, PrintWriter writer, String indent) - throws IOException, XmlException - { - // Start the start tag. - writer.print(indent + "<" + node.getTagName()); - - // Print out any attributes that have non-null values. - String[] attrs = node.getAttributeList(); - for (int i=0; i"); - - // Step through each element, starting at the document root, and generate RFML for each element. - Enumeration children = node.getChildren(); - while (children.hasMoreElements()) - { - PcmlDocNode child = (PcmlDocNode) children.nextElement(); - toXml(child, writer, indent+" "); - } - - // Write the end tag. - writer.println(indent + ""); - } - else { - // Finish the start tag. - writer.println("/>"); - } - writer.flush(); - } - -} diff --git a/cvsroot/src/com/ibm/as400/data/RfmlRecordFormat.java b/cvsroot/src/com/ibm/as400/data/RfmlRecordFormat.java deleted file mode 100644 index 319e544af..000000000 --- a/cvsroot/src/com/ibm/as400/data/RfmlRecordFormat.java +++ /dev/null @@ -1,672 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RfmlRecordFormat.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import java.io.IOException; -import java.io.ObjectOutputStream; -import java.io.ByteArrayOutputStream; -import java.math.BigDecimal; -import java.math.BigInteger; - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.StringTokenizer; -import java.util.Vector; - -import com.ibm.as400.access.*; - - -/** -**/ -class RfmlRecordFormat extends PcmlDocNode -{ - static final long serialVersionUID = 5L; - - private static final String RECORD_FORMAT_ATTRIBUTES[] = { - "name", - "description", - }; - - private String m_Description; - private static final int DESCRIPTION_MAX_LENGTH = 50; // maximum length of "description" attribute value. - private static final int MAX_DDS_NAME_LENGTH = 10; // maximum length of "DDS name" for a FieldDescription. - private static final int MAX_FIELD_TEXT_LENGTH = 50; // maximum length of "TEXT" (description) for a FieldDescription. - - - /** - Constructor - **/ - public RfmlRecordFormat(PcmlAttributeList attrs) - { - super(attrs); - setNodeType(PcmlNodeType.RECORDFORMAT); - - - // ********************************** - // Set attribute values - // - // The following code extracts the attribute values - // from the parsed document node and - // stores the values in private data members. - // ********************************** - // Note: The superclass does the setName(). - setDescription(getAttributeValue("description")); - } - - /** - Creates and returns a copy of this object. - @return A copy of this object. - **/ - public Object clone() - { - RfmlRecordFormat node = (RfmlRecordFormat) super.clone(); - // Cloning does not include 'live' data, only the interface - // definitions described by the PCML tags. - // Null out the 'semi-transient' data values. - - return node; - } - - - /** - Composes a list of FieldDescription objects representing the specified node and its children. - **/ - private static void addFieldDescriptions(PcmlDocNode node, Vector fieldDescriptions, Vector keyFields, Vector namesAlreadyUsed, String preferredFieldName) throws XmlException // @A1c added arg - { - boolean typeIsStruct = false; // We set this to true if current node is or . // @A1a - String fieldName = null; // @A1c - - // If this is a STRUCT node, and we are being passed a parent name, then set up to pass the name on to the child. // @A1a - This entire 'if' block. - if (node.getNodeType() == PcmlNodeType.STRUCT) { - typeIsStruct = true; - if (preferredFieldName != null) fieldName = preferredFieldName; - else fieldName = node.getName(); - } - - // If this is a DATA node, then set up the appropriate field description object and add it to the descriptions list. - else if (node.getNodeType() == PcmlNodeType.DATA) // It's a node. @A1c - { - RfmlData dNode = (RfmlData)node; - PcmlDimensions noDimensions = new PcmlDimensions(); - int fieldLength; - try { fieldLength = dNode.getLength(noDimensions); } - catch (PcmlException e) { throw new XmlException(e); } - if (preferredFieldName != null) fieldName = preferredFieldName; // @A1a - else fieldName = dNode.getName(); // @A1c - - FieldDescription fieldDesc = null; - String initValue = dNode.getInit(); - int precision = dNode.getPrecision(); - - switch (dNode.getDataType()) - { - // Node is . - case (PcmlData.STRUCT): - { - // Do nothing, a doesn't convert directly to a FieldDescription. Skip it and go on to resolve any child nodes. - typeIsStruct = true; // @A1a - break; - } - - // Node is . - case (PcmlData.CHAR) : - { - // See if the ccsid attribute is set. - int ccsid = dNode.getCcsid(); - AS400Text convAS400Text; - if (ccsid == 0) { // ccsid was not specified - convAS400Text = new AS400Text(fieldLength); - } - else { - convAS400Text = new AS400Text(fieldLength, ccsid); - } - fieldDesc = new CharacterFieldDescription(convAS400Text, fieldName); - // Note: Unless we do the explicit setCCSID(), the FieldDescription doesn't report the correct CCSID. @A1a - This entire 'if' block. - if (ccsid != 0) { - ((CharacterFieldDescription)fieldDesc).setCCSID(Integer.toString(ccsid)); - } - if (initValue != null) { - ((CharacterFieldDescription)fieldDesc).setDFT(initValue); - } - break; - } - - // Node is . - case (PcmlData.INT) : - { - switch (fieldLength) - { - case 2: // Note: All DDS 'binary' fields occupy at least 2 bytes on server. - if (precision == 16) { // Unsigned. @A1c - Swapped the if/else. - fieldDesc = new BinaryFieldDescription(new AS400UnsignedBin2(), fieldName); - if (initValue != null) { - ((BinaryFieldDescription)fieldDesc).setDFT(Integer.valueOf(initValue)); - } - } - else { // Signed. @A1c - fieldDesc = new BinaryFieldDescription(new AS400Bin2(), fieldName); - if (initValue != null) { - ((BinaryFieldDescription)fieldDesc).setDFT(Short.valueOf(initValue)); - } - } - break; - case 4: - if (precision == 32) { // Unsigned. @A1c - Swapped the if/else. - fieldDesc = new BinaryFieldDescription(new AS400UnsignedBin4(), fieldName); - if (initValue != null) { - ((BinaryFieldDescription)fieldDesc).setDFT(Long.valueOf(initValue)); - } - } - else { // Signed. @A1c - fieldDesc = new BinaryFieldDescription(new AS400Bin4(), fieldName); - if (initValue != null) { - ((BinaryFieldDescription)fieldDesc).setDFT(Integer.valueOf(initValue)); - } - } - break; - case 8: - if (precision == 64) { // Unsigned. - fieldDesc = new BinaryFieldDescription(new AS400UnsignedBin8(), fieldName); - if (initValue != null) { - ((BinaryFieldDescription)fieldDesc).setDFT(new BigInteger(initValue)); - } - } - else { // Signed. - fieldDesc = new BinaryFieldDescription(new AS400Bin8(), fieldName); - if (initValue != null) { - ((BinaryFieldDescription)fieldDesc).setDFT(Long.valueOf(initValue)); - } - } - break; - default: - Trace.log(Trace.ERROR, "Invalid field length for type=int: " + fieldLength); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - break; - } - - // Node is . - case (PcmlData.ZONED) : - { - AS400ZonedDecimal convZoned = new AS400ZonedDecimal(fieldLength, precision); - fieldDesc = new ZonedDecimalFieldDescription(convZoned, fieldName); - if (initValue != null) { - BigDecimal bigDec = new BigDecimal(initValue); - if (bigDec.scale() != precision) { - bigDec = bigDec.setScale(precision,BigDecimal.ROUND_HALF_EVEN); - } - ((ZonedDecimalFieldDescription)fieldDesc).setDFT(bigDec); - } - break; - } - - // Node is . - case (PcmlData.PACKED) : - { - AS400PackedDecimal convPacked = new AS400PackedDecimal(fieldLength, precision); - fieldDesc = new PackedDecimalFieldDescription(convPacked, fieldName); - if (initValue != null) { - BigDecimal bigDec = new BigDecimal(initValue); - if (bigDec.scale() != precision) { - bigDec = bigDec.setScale(precision,BigDecimal.ROUND_HALF_EVEN); - } - ((PackedDecimalFieldDescription)fieldDesc).setDFT(new BigDecimal(initValue)); - } - break; - } - - // Node is . - case (PcmlData.FLOAT) : - { - switch (fieldLength) - { - case 4: - fieldDesc = new FloatFieldDescription(new AS400Float4(), fieldName); - break; - case 8: - fieldDesc = new FloatFieldDescription(new AS400Float8(), fieldName); - break; - default: - Trace.log(Trace.ERROR, "Invalid field length for type=float: " + fieldLength); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - if (initValue != null) - { - if (fieldLength == 4) { - ((FloatFieldDescription)fieldDesc).setDFT(new Float(initValue)); - } - else { // length==8 - ((FloatFieldDescription)fieldDesc).setDFT(new Double(initValue)); - } - } - ((FloatFieldDescription)fieldDesc).setLength(fieldLength); - // Note: The "precision" attribute is not allowed for type=float. - break; - } - - // Node is . - case (PcmlData.BYTE) : - { - AS400ByteArray convByte = new AS400ByteArray(fieldLength); - fieldDesc = new HexFieldDescription(convByte, fieldName); - if (initValue != null) { - Object convertedValue = PcmlDataValues.convertValue(initValue, PcmlData.BYTE, fieldLength, 0, dNode.getNameForException()); // @A1a - ((HexFieldDescription)fieldDesc).setDFT((byte[])convertedValue); // @A1a - // Note: We could alternatively use Arrays.fill(). However, java.util.Arrays is new in Java2. - } - break; - } - - // Node is . - case (PcmlData.DATE) : - { - String separatorName = dNode.getDateSeparator(); - String format = dNode.getDateFormat(); - AS400Date convDate; - if (format == null) convDate = new AS400Date(); - else { - int formatInt = AS400Date.toFormat(format); - if (separatorName == null) convDate = new AS400Date(formatInt); - else convDate = new AS400Date(formatInt, separatorAsChar(separatorName)); - } - fieldDesc = new DateFieldDescription(convDate, fieldName); - if (initValue != null) { - // We require the 'init=' value to be specified in standard XML Schema 'date' format. - // Normalize it to match the field's specified DDS format. - String initValueNormalized = convDate.toString(AS400Date.parseXsdString(initValue)); - ((DateFieldDescription)fieldDesc).setDFT(initValueNormalized); - } - if (format != null) { - ((DateFieldDescription)fieldDesc).setDATFMT(format); - } - if (separatorName != null) { - ((DateFieldDescription)fieldDesc).setDATSEP(separatorAsChar(separatorName).toString()); - } - break; - } - - // Node is . - case (PcmlData.TIME) : - { - String separatorName = dNode.getTimeSeparator(); - String format = dNode.getTimeFormat(); - AS400Time convTime; - if (format == null) convTime = new AS400Time(); - else { - int formatInt = AS400Time.toFormat(format); - if (separatorName == null) convTime = new AS400Time(formatInt); - else convTime = new AS400Time(formatInt, separatorAsChar(separatorName)); - } - fieldDesc = new TimeFieldDescription(convTime, fieldName); - if (initValue != null) { - // We require the 'init=' value to be specified in standard XML Schema 'time' format. - // Normalize it to match the field's specified DDS format. - String initValueNormalized = convTime.toString(AS400Time.parseXsdString(initValue)); - ((TimeFieldDescription)fieldDesc).setDFT(initValueNormalized); - } - if (format != null) { - ((TimeFieldDescription)fieldDesc).setTIMFMT(format); - } - if (separatorName != null) { - ((TimeFieldDescription)fieldDesc).setTIMSEP(separatorAsChar(separatorName).toString()); - } - break; - } - - // Node is . - case (PcmlData.TIMESTAMP) : - { - AS400Timestamp convTimestamp = new AS400Timestamp(); - fieldDesc = new TimestampFieldDescription(convTimestamp, fieldName); - if (initValue != null) { - // We require the 'init=' value to be specified in standard XML Schema 'timestamp' format. - // Normalize it to match the field's expected DDS format. - String initValueNormalized = convTimestamp.toString(AS400Timestamp.parseXsdString(initValue)); - ((TimestampFieldDescription)fieldDesc).setDFT(initValueNormalized); - } - break; - } - - default: - Trace.log(Trace.ERROR, "Invalid data field type: " + dNode.getDataType()); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - - } // ... switch - - if (fieldDesc != null) { - // Store the fully-qualified node name in the field text description. - String qualifiedName = dNode.getQualifiedName(); - if (qualifiedName.length() <= MAX_FIELD_TEXT_LENGTH) { - fieldDesc.setTEXT(qualifiedName); - } - else { - // Truncate from the end of the qualified name, and prepend "..". - int startPos = qualifiedName.length() - MAX_FIELD_TEXT_LENGTH + 2; - String truncatedName = ".." + qualifiedName.substring(startPos); - fieldDesc.setTEXT(truncatedName); - } - - // Derive a reasonably unique "DDS name" (limit is 10 characters). - String ddsName = generateUniqueName(fieldName, namesAlreadyUsed); - fieldDesc.setDDSName(ddsName); // Note: setDDSName() uppercases its argument. - namesAlreadyUsed.addElement(ddsName.toUpperCase()); // Avoid re-using the same name for another field within this RecordFormat (case-insensitive). - - // Print a warning if a count was specified. - try { - int count = dNode.getCount(noDimensions); - if (count != 1 && count != 0) { - Trace.log(Trace.WARNING, "Ignoring attribute 'count' ("+count+") for field " + qualifiedName); - } - } - catch (PcmlException e) { throw new XmlException(e); } - - // Add this field description to the list. - fieldDescriptions.addElement(fieldDesc); - - // If this field is a "key field", add its relative field index to keyFields list. - if (dNode.isKeyField()) { - int fieldIndex = fieldDescriptions.size() - 1; // most-recently-added field - keyFields.addElement(new Integer(fieldIndex)); - } - - } - - } // ... getNodeType() == DATA - - else { // Neither nor . @A1c - // Only nodes get converted directly to FieldDescriptions. - // Do nothing with this node, and proceed to its child nodes. - } - - // If this node had child nodes, generate field descriptions for them. - - if (node.hasChildren()) - { - // @A1a - This entire if-else block. - // If the current node is a or , and has exactly one child, then assume that the struct is being used as an "alias", and pass the parent's name to the child (for composing the child's FieldDescription). - String nameForChild; - if (typeIsStruct && (node.getNbrChildren() == 1)) { - nameForChild = fieldName; - } - else nameForChild = null; // This will force the child to use own name. - - // Generate FieldDescriptions for each child node. - Enumeration children = node.getChildren(); - while (children.hasMoreElements()) - { - PcmlDocNode child = (PcmlDocNode) children.nextElement(); - addFieldDescriptions(child, fieldDescriptions, keyFields, namesAlreadyUsed, nameForChild); // @A1c - } - } - } - - - /** - Generates a unique "DDS name" for a field, based on the field name. - **/ - private static String generateUniqueName(String initialName, Vector namesInUse) - { - if (initialName.length() <= MAX_DDS_NAME_LENGTH && - !namesInUse.contains(initialName)) return initialName; - else - { - // Truncate down to the final (MAX_DDS_NAME_LENGTH) characters. - int startPos = Math.max(0, initialName.length()-MAX_DDS_NAME_LENGTH); - String baseName = initialName.substring(startPos); - if (!namesInUse.contains(baseName)) return baseName; - int baseLength = baseName.length(); - - // Try appending digits to the end. - String suffix = Integer.toString(0); - StringBuffer newName = new StringBuffer(baseName); - for (int i=0; suffix.length() nodes get converted directly to FieldDescriptions. - // Do nothing with this node, and proceed to its child nodes. - } - else // It's a node. - { - RfmlData dNode = (RfmlData)node; - PcmlDimensions noDimensions = new PcmlDimensions(); - int fieldLength; - try { fieldLength = dNode.getLength(noDimensions); } - catch (PcmlException e) { throw new XmlException(e); } - String fieldName = dNode.getName(); - - switch (dNode.getDataType()) - { - // Node is . - case (PcmlData.STRUCT): - // Do nothing, a doesn't convert directly to a FieldDescription. Skip it and go on to resolve any child nodes. - // If this node had child nodes, generate field names for them. - break; - - // Node is . - default : - // Add this field description to the list. - dataNodes.addElement(dNode); - break; - } - } // ... else node. - - // If this node had child nodes, generate field names for them. - if (node.hasChildren()) - { - // Generate FieldDescriptions for each child node. - Enumeration children = node.getChildren(); - while (children.hasMoreElements()) - { - PcmlDocNode child = (PcmlDocNode) children.nextElement(); - getDataNodes(child, dataNodes); - } - } - } - - - /** - Returns a string containing the recordformat description. - Returns null if description is not set. - **/ - String getDescription() - { - return m_Description; - } - - - /** - Assigns the value of the current node and its children, by parsing the input bytes. - **/ - int parseBytes(byte[] bytes) - throws XmlException - { - PcmlDimensions noDimensions = new PcmlDimensions(); - - // Stack of offsets used by RfmlData.parseBytes() and RfmlStruct.parseBytes() - Hashtable offsetStack = new Hashtable(); - - int offsetIntoBuffer = 0; - - // Convert all fields from Java objects to IBM i data. - Enumeration children = getChildren(); // children of this node. - while (children.hasMoreElements()) - { - PcmlDocNode child = (PcmlDocNode) children.nextElement(); - - // Create a FieldDescription for the node and convert the Java objects to IBM i data. - if (child.getNodeType() == PcmlNodeType.DATA) { - try { - int bytesConsumed = ((RfmlData) child).parseBytes(bytes, offsetIntoBuffer, offsetStack, noDimensions); - offsetIntoBuffer += bytesConsumed; - } - catch (ArrayIndexOutOfBoundsException e) { - Trace.log(Trace.ERROR, e); - throw new XmlException(DAMRI.INSUFFICIENT_INPUT_DATA, new Object[] {"(unknown)", Integer.toString(bytes.length), "", this.getNameForException()} ); - } - } - else { - throw new XmlException(DAMRI.BAD_NODE_TYPE, new Object[] {new Integer(child.getNodeType()) , child.getNameForException()} ); - } - } - return offsetIntoBuffer; // total number of bytes consumed - } - - /** - Sets the values of the current node and its children, from the values of the corresponding fields in the specified Record. - **/ - public void setValues(Record record) - throws java.io.UnsupportedEncodingException, - XmlException - { - Vector dataNodes = new Vector(); // This is where we will accumulate the data nodes of the record - getDataNodes(this, dataNodes); - - for (int fieldNum=0; fieldNum declarations. - break; - case PcmlNodeType.DATA: - RfmlData dataNode = (RfmlData) child; - { - { - int bytesWritten = dataNode.toBytes(bytes, offsetForNextField, noDimensions); - offsetForNextField += bytesWritten; - } - } - break; - default: - throw new XmlException(DAMRI.BAD_NODE_TYPE, new Object[] {new Integer(child.getNodeType()) , child.getNameForException()} ); - } - } - - try { bytes.flush(); } catch (IOException e) { throw new XmlException(e); } - - return bytes.toByteArray(); - } - - - /** - Creates a RecordFormat object whose fields correspond to the current node and its children. - **/ - public RecordFormat toRecordFormat() throws XmlException - { - Vector fieldDescriptions = new Vector(); // This is where we will accumulate the generated FieldDescription objects. - Vector namesAlreadyUsed = new Vector(); // "DDS names" for fields must be unique within the RecordFormat. This Vector will accumulate the (uppercased) DDS names assigned so far, so we can generate a new unique name for each field. - Vector keyFields = new Vector(); // Indexes of key fields (within fieldDescriptions). - - // Note: We ignore the "count" attribute. Regardless of what value is specified in , we will generate a single FieldDescription for the node. - - // Recursively compose FieldDescription objects representing this node and its child nodes. - addFieldDescriptions(this, fieldDescriptions, keyFields, namesAlreadyUsed, null); // @A1c - - RecordFormat recordFormat = new RecordFormat(getName()); - for (int i=0; i < fieldDescriptions.size(); ++i) - { - recordFormat.addFieldDescription((FieldDescription)fieldDescriptions.elementAt(i)); - } - - for (int i=0; i < keyFields.size(); ++i) - { - recordFormat.addKeyFieldDescription(((Integer)keyFields.elementAt(i)).intValue()); - } - - return recordFormat; - } - - - /** - Custom serialization. - **/ - private void writeObject(ObjectOutputStream out) throws IOException - { - synchronized (this) - { - // Perform default serialization - out.defaultWriteObject(); - } - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/data/RfmlSAXParser.java b/cvsroot/src/com/ibm/as400/data/RfmlSAXParser.java deleted file mode 100644 index 5a67c406c..000000000 --- a/cvsroot/src/com/ibm/as400/data/RfmlSAXParser.java +++ /dev/null @@ -1,463 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RfmlSAXParser.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -//@E0C -import javax.xml.parsers.SAXParserFactory; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.FactoryConfigurationError; -import javax.xml.parsers.ParserConfigurationException; -import org.xml.sax.Attributes; -import org.xml.sax.EntityResolver; -import org.xml.sax.helpers.DefaultHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.SAXNotRecognizedException; -import org.xml.sax.SAXNotSupportedException; -import org.xml.sax.XMLReader; - -import java.io.InputStream; -import java.io.IOException; - -import java.util.Enumeration; -import java.util.MissingResourceException; -import java.util.Stack; - -import com.ibm.as400.access.Trace; - -class RfmlSAXParser extends DefaultHandler implements EntityResolver -{ - private transient RfmlDocument m_rootNode; - private transient PcmlDocNode m_currentNode; - private transient String m_docName; - private transient XMLErrorHandler m_xh; - - /** - Processes the PcmlDocNode tree and adds new PcmlDocNode subtrees - for tags that reference tags. - (e.g. - This process must be done after the initial tree is built - because there is no requirement that the referenced - tag be defined before the referencing tag. - **/ - private void augmentTree(PcmlDocNode RfmlElem, Stack recursionStack) - { - Enumeration children; - PcmlDocNode child; - String structName; - PcmlDocNode structNode; - RfmlData dataNode; - - children = RfmlElem.getChildren(); - if (children == null) - return; - - while (children.hasMoreElements()) - { - child = (PcmlDocNode) children.nextElement(); - - // Only augment the tree for items. - // This also makes sure the node has no children - // though this should always be the case because the DTD does - // allow the tag to have nested elements. - if (child instanceof RfmlData) // This node is a tag - { - dataNode = (RfmlData) child; - if (dataNode.getDataType() == RfmlData.STRUCT) // and it is type="struct" - { - if (dataNode.getNbrChildren() == 0) // and it has no children - { - structName = dataNode.getStruct(); - if (structName != null) - { - structNode = (PcmlDocNode) m_rootNode.getElement(structName); - if (structNode instanceof RfmlStruct) - { - if (recursionStack.search(structNode) != -1) - { - m_rootNode.addPcmlSpecificationError(DAMRI.CIRCULAR_REFERENCE, new Object[] {structName, dataNode.getBracketedTagName(), dataNode.getNameForException()} ); - } - else - { - Enumeration structChildren = structNode.getChildren(); - while (structChildren.hasMoreElements()) - { - PcmlDocNode structChild = (PcmlDocNode) structChildren.nextElement(); - PcmlDocNode newChild = (PcmlDocNode) structChild.clone(); - - // Link the new node into the document tree - dataNode.addChild(newChild); - - // Recursively add all of the new node's children - // to the document's hashtable. - m_rootNode.addToHashtable(newChild); - } - // Insert subtree for this structure - //makeChildren(structNode.getXmlNode(), dataNode); - - } - } - else - { - if (structNode == null) - { - m_rootNode.addPcmlSpecificationError(DAMRI.REF_NOT_FOUND, new Object[] {structName, "", dataNode.getBracketedTagName(), dataNode.getNameForException()} ); - } - else - { - m_rootNode.addPcmlSpecificationError(DAMRI.REF_WRONG_TYPE, new Object[] {structName, "", dataNode.getBracketedTagName(), dataNode.getNameForException()} ); - } - } - } - } - else - { - // Not allowed by the DTD - } - } - } - - // Recursively augment the newly created tree - recursionStack.push(child); - augmentTree(child, recursionStack); - recursionStack.pop(); - } - } - - /** - Processes the PcmlDocNode tree to resolve references to - named nodes in the tree. - - Some nodes (e.g. ) have attributes with named references - to other nodes (e.g. offset="xyz"). The named reference can - be either a simple name or a qualified name. The name - resolution is performed by walking up the document heirarchy looking - for a named element relative to the current location in the tree. - - Given the following document structure: - - - - - - - - - - - - - - The element named "lengthOfXyz" is referenced by element "xyz" as - the length of the character field. In this case the following - names could be specified on the length attribute and would - resolve to the same element in the document: - -- length="lengthOfXyz" - -- length="struct1.lengthOfXyz" - -- length="parm1.struct1.lengthOfXyz" - -- length="qabc.parm1.struct1.lengthOfXyz" - - The resolution process recursively asks the nodes's parent if the - name string is a descendant of the current node. - **/ - private void checkAttributes(PcmlDocNode RfmlElem) - { - Enumeration children; - PcmlDocNode child; - - children = RfmlElem.getChildren(); - if (children == null) - return; - - while (children.hasMoreElements()) - { - child = (PcmlDocNode) children.nextElement(); - - child.checkAttributes(); - - // Recursively resolve references for all nodes in the tree - checkAttributes(child); - } - } - - /** Returns the root node for the document. - **/ - RfmlDocument getRfmlDocument() - { - return m_rootNode; - } - - /** Parses the document, using the specified class loader. - **/ - void parse(String docName, ClassLoader loader) - throws MissingResourceException, IOException, ParseException, PcmlSpecificationException, //@E0C - SAXNotRecognizedException, SAXNotSupportedException, ParserConfigurationException, - SAXException - { - m_rootNode = null; - m_currentNode = null; - - String qualDocName; // Potentially package qualified document name. - - // Save the document name - if (docName.endsWith(".rfml") - || docName.endsWith(".rfmlsrc")) - { - qualDocName = docName.substring(0, docName.lastIndexOf('.') ); - } - else - { - qualDocName = docName; - } - - m_docName = qualDocName.substring(qualDocName.lastIndexOf('.') + 1); - - InputStream inStream = null; - try - { - // Now try to open the Rfml file - inStream = SystemResourceFinder.getRFMLDocument(docName, loader); // Note: Buffer the InputStream??? On AIX at least, this always appears to return a java.io.BufferedInputStream. - - // Instantiate our error listener - if (m_xh == null) { - m_xh = new XMLErrorHandler(m_docName, 0); - } - - SAXParserFactory factory = SAXParserFactory.newInstance(); //@E0A - factory.setValidating(true); //@E0A - factory.setNamespaceAware(false); //@E0A -//@E0D SAXParser parser = new SAXParser(); -//@E0D try { -//@E0D parser.setFeature("http://xml.org/sax/features/validation", true); - factory.setFeature("http://apache.org/xml/features/continue-after-fatal-error", false); - // Note: This is to eliminate a hang condition if rfml.dtd is not found by SAXParser.parse(). - // Note: The above setFeature() call causes a SAXNotRecognizedException on Sun JDK 1.4.2. Even if we swallow this exception, we encounter another exception when we subsequently call SAXParser.parse(): "SAXParseException: Relative URI 'rfml.dtd' can not be resolved without a base URI." So we just allow it to be thrown. - - SAXParser parser = factory.newSAXParser(); //@E0A - -//@E0D parser.setFeature( "http://xml.org/sax/features/namespaces", false ); -//@E0D } -//@E0D catch (org.xml.sax.SAXException se) { -//@E0D if (Trace.isTraceErrorOn()) se.printStackTrace(Trace.getPrintWriter()); -//@E0D } -//@E0D parser.setErrorHandler(xh); -//@E0D parser.setContentHandler(this); -//@E0D parser.setEntityResolver(this); // So that we can find the rfml.dtd for the parser. - - // Create an InputSource for passing to the parser. - // Wrap any SAXExceptions as ParseExceptions. - try - { - XMLReader reader = parser.getXMLReader(); //@E0A - reader.setErrorHandler(m_xh); //@E0A - reader.setEntityResolver(this); //@E0A So that we can find the rfml.dtd for the parser. - parser.parse(new InputSource(inStream), this); // Note: This hangs if rfml.dtd can't be found and "continue-after-fatal-error" is set to true. @E0C - } - catch (SAXException e) - { - if (Trace.isTraceErrorOn()) e.printStackTrace(Trace.getPrintWriter()); - - // See if the error handler cached an exception. - ParseException exc = m_xh.getException(); - if (exc != null) - { - //exc.reportErrors(); // Note - This is redundant with a call in loadSourceXxxDocument() in RecordFormatDocument and ProgramCallDocument. - throw exc; - } - ParseException pe = new ParseException(SystemResourceFinder.format(DAMRI.FAILED_TO_PARSE, new Object[] {m_docName} ) ); - pe.addMessage(e.getMessage()); - throw pe; - } - - // Close the input stream - inStream.close(); - inStream = null; - - // Check for errors - ParseException exc = m_xh.getException(); - if (exc != null) - { - //exc.reportErrors(); // Note - This is redundant with a call in loadSourceXxxDocument() in RecordFormatDocument and ProgramCallDocument. - throw exc; - } - - // Recursively walk the document tree and augment the tree with - // cloned subtrees for nodes. - augmentTree(m_rootNode, new Stack()); - - // Perform post-parsing attribute checking. - // Recursively walk the document tree and ask each node - // to verify all attributes. - // Note that this phase must be performed after the document is completely - // parsed because some attributes (length=, count=, etc.) make reference - // to named document elements occuring later in the document. - checkAttributes(m_rootNode); - - if (m_rootNode != null && m_rootNode.getPcmlSpecificationException() != null) - throw m_rootNode.getPcmlSpecificationException(); - } - finally - { - if (inStream != null) inStream.close(); - } - } - - /** - Implementation of method of interface org.xml.sax.EntityResolver. - Allows the application to resolve external entities. - - The Parser will call this method before opening any external entity except the top-level document entity (including the external DTD subset, external entities referenced within the DTD, and external entities referenced within the document element): the application may request that the parser resolve the entity itself, that it use an alternative URI, or that it use an entirely different input source. - **/ - public InputSource resolveEntity (String publicId, String systemId) - throws SAXException - { - // Note: publicId is generally null. - if (systemId != null && systemId.length() > 0) - { - int finalSlashPos = systemId.lastIndexOf("/"); - String sysFile; - - if (finalSlashPos == -1) - { - sysFile = systemId; - } - else - { - sysFile = systemId.substring(finalSlashPos+1); - } - - if (sysFile.equals("rfml.dtd")) - { - InputStream isHeader = SystemResourceFinder.getRFMLHeader(); - return new InputSource(isHeader); - } - } - - try - { - return super.resolveEntity(publicId, systemId); - } - catch(SAXException sax) - { - throw sax; - } - catch(Exception ioe) - { - // The IBM JDK's DefaultHandler.resolveEntity() method throws IOException; - // the Sun implementation does not. We swallow it here for compatibility - // with the IBM JDK. Since the Sun implementation doesn't declare IOException, - // we have to swallow a generic exception. To avoid throwing a new SAXException - // around an existing one, we use the previous catch block. Good grief! - throw new SAXException(ioe); - } - } - - - /*************************************************************** - The following are extensions to org.xml.sax.helpers.DefaultHandler - ****************************************************************/ - - /** Start element. **/ - public void startElement(String namespaceURI, String localname, String tagName, Attributes xmlAttrs) - { - - PcmlDocNode newNode = null; - - - // Create a PcmlAttributeList to hold all the - // attributes for this node. - PcmlAttributeList attrs = new PcmlAttributeList(xmlAttrs.getLength()); - for (int attr = 0; attr < xmlAttrs.getLength(); attr++) - { -// $A1 - attrs.addAttribute( new PcmlAttribute(xmlAttrs.getQName(attr), - xmlAttrs.getValue(attr), - true) ); - } - - // Create PcmlDocNode subclass based on tag name - if (tagName.equals("rfml")) - { - newNode = new RfmlDocument(attrs, m_docName); - } - else if (tagName.equals("recordformat")) - { - newNode = new RfmlRecordFormat(attrs); - - } - else if (tagName.equals("struct")) - { - newNode = new RfmlStruct(attrs); - } - else if (tagName.equals("data")) - { - newNode = new RfmlData(attrs); - } - else - { - newNode = null; // Unrecognized tag name chould never happen - // if the tags parse successfully - } - - if (newNode != null) - { - if (m_rootNode == null) - { - try { m_rootNode = (RfmlDocument) newNode; } - catch (ClassCastException e) { - Trace.log(Trace.ERROR, "Source document is not a well-formed RFML document."); - throw e; - } - m_currentNode = newNode; - } - else - { - m_currentNode.addChild(newNode); - m_currentNode = newNode; - } - } - - } // startElement(String,AttributeList) - - /** End element. **/ - public void endElement(String namespaceURI, String localname, String element) - { - - m_currentNode = (PcmlDocNode) m_currentNode.getParent(); - - } - - // See Java Bug ID 4806878, http://developer.java.sun.com/developer/bugParade/bugs/4806878.html: - // "[The] W3C XML Spec says that validation errors are not fatalerrors. And DefaultHandler implementation doesn't print out any errors for the validation errors. If user is interested in seeing the validation errors, then they need to extend the DefaultHandler [by re-implementing error() and fatalerror().]" - - public void warning(SAXParseException spe) - throws SAXException - { - if (m_xh == null) throw spe; - else m_xh.warning(spe); - } - public void error(SAXParseException spe) - throws SAXException - { - if (m_xh == null) throw spe; - else m_xh.error(spe); - } - public void fatalError(SAXParseException spe) - throws SAXException - { - if (m_xh == null) throw spe; - else m_xh.fatalError(spe); - } -} diff --git a/cvsroot/src/com/ibm/as400/data/RfmlStruct.java b/cvsroot/src/com/ibm/as400/data/RfmlStruct.java deleted file mode 100644 index f995cd7ce..000000000 --- a/cvsroot/src/com/ibm/as400/data/RfmlStruct.java +++ /dev/null @@ -1,43 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RfmlStruct.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -class RfmlStruct extends PcmlStruct { - /*********************************************************** - Static Members - ***********************************************************/ - - // Serial verion unique identifier - ///static final long serialVersionUID = 5539999574454926624L; - - private static final String STRUCTATTRIBUTES[] = { - "name" - }; - // Note: The following PcmlStruct attributes are irrelevant to this class: - // usage, count, minvrm, maxvrm, offset, offsetfrom, outputsize. - - /** Constructor. **/ - public RfmlStruct(PcmlAttributeList attrs) - { - super(attrs); - } - - /** - Returns the list of valid attributes for the data element. - **/ - String[] getAttributeList() - { - return STRUCTATTRIBUTES; - } -} diff --git a/cvsroot/src/com/ibm/as400/data/StructDescriptor.java b/cvsroot/src/com/ibm/as400/data/StructDescriptor.java deleted file mode 100644 index 154a7d769..000000000 --- a/cvsroot/src/com/ibm/as400/data/StructDescriptor.java +++ /dev/null @@ -1,134 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: StructDescriptor.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import com.ibm.as400.data.Descriptor; -import com.ibm.as400.data.DocNodeDescriptor; - -/** - * The StructDescriptor class implements the methods of the Descriptor interface - * that are unique to the tag. - * - **/ - -class StructDescriptor extends DocNodeDescriptor -{ - /* Constructor */ - public StructDescriptor(PcmlDocNode node) - { - super(node); - } - /** - * Return list of valid attributes for the tag. - **/ - public String[] getAttributeList() - { - return ((PcmlStruct)getDocNode()).getAttributeList(); - } - - /** - * Return a String containing the current value for the requested attribute. - **/ - public String getAttributeValue(String attr) - { - if (attr != null) - { - if (attr.equals("name")) - { - String name = getDocNode().getName(); - if (name.equals("")) - return null; - else - return name; - } - else if (attr.equals("usage")) - { - switch (getDocNode().getUsage()) - { - case PcmlDocNode.INPUT: - return "input"; - case PcmlDocNode.INPUTOUTPUT: - return "inputoutput"; - case PcmlDocNode.OUTPUT: - return "output"; - default: - return "inherit"; - } - } - else if (attr.equals("count")) - { - String countId = ((PcmlStruct)getDocNode()).getUnqualifiedCountId(); - if (countId != null) - return countId; - else - { - int count = ((PcmlStruct)getDocNode()).getCount(); - if (count < 1) - return null; - else - return Integer.toString(count); - } - } - else if (attr.equals("minvrm")) - return ((PcmlStruct)getDocNode()).getMinvrmString(); - else if (attr.equals("maxvrm")) - return ((PcmlStruct)getDocNode()).getMaxvrmString(); - else if (attr.equals("offset")) - { - String offsetId = ((PcmlStruct)getDocNode()).getUnqualifiedOffsetId(); - if (offsetId != null) - return offsetId; - else - { - int offset = ((PcmlStruct)getDocNode()).getOffset(); - if (offset < 1) - return null; - else - return Integer.toString(offset); - } - } - else if (attr.equals("offsetfrom")) - { - String offsetfromId = ((PcmlStruct)getDocNode()).getUnqualifiedOffsetfromId(); - if (offsetfromId != null) - return offsetfromId; - else - { - int offsetfrom = ((PcmlStruct)getDocNode()).getOffsetfrom(); - if (offsetfrom < 0) - return null; - else - return Integer.toString(offsetfrom); - } - } - else if (attr.equals("outputsize")) - { - String outputsizeId = ((PcmlStruct)getDocNode()).getUnqualifiedOutputsizeId(); - if (outputsizeId != null) - return outputsizeId; - else - { - int outputsize = ((PcmlStruct)getDocNode()).getOutputsize(); - if (outputsize < 1) - return null; - else - return Integer.toString(outputsize); - } - } - else - return null; - } - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/data/SystemClassLoader.java b/cvsroot/src/com/ibm/as400/data/SystemClassLoader.java deleted file mode 100644 index 399e6d464..000000000 --- a/cvsroot/src/com/ibm/as400/data/SystemClassLoader.java +++ /dev/null @@ -1,41 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemClassLoader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import java.net.*; -import java.io.*; - -/** - * The SystemClassLoader loads system classes (those in your classpath). - * This is an attempt to unify the handling of system classes and ClassLoader - * classes. - */ -class SystemClassLoader extends java.lang.ClassLoader -{ - protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException - { - return findSystemClass(name); - } - - public InputStream getResourceAsStream(String name) - { - return ClassLoader.getSystemResourceAsStream(name); - } - - public URL getResource(String name) - { - return ClassLoader.getSystemResource(name); - } -} - diff --git a/cvsroot/src/com/ibm/as400/data/SystemResourceFinder.java b/cvsroot/src/com/ibm/as400/data/SystemResourceFinder.java deleted file mode 100644 index f59004987..000000000 --- a/cvsroot/src/com/ibm/as400/data/SystemResourceFinder.java +++ /dev/null @@ -1,451 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemResourceFinder.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import com.ibm.as400.access.Trace; // @B3A -import java.io.*; -import java.text.MessageFormat; -import java.util.*; - -class SystemResourceFinder -{ - public static final String m_pcmlExtension = ".pcml"; - public static final String m_pcmlSerializedExtension = ".pcml.ser"; - public static final String m_rfmlExtension = ".rfml"; // @B2A - public static final String m_rfmlSerializedExtension = ".rfml.ser"; // @B2A - private static final String m_rfmlHeaderName = "com/ibm/as400/data/rfml.dtd"; // @B2A - - private static final String m_pcmlHeaderName = "com/ibm/as400/data/pcml.dtd"; - private static int m_headerLineCount; - - private static ResourceLoader m_loader = new ResourceLoader(); - - static - { - // Load the resource bundle for common properties. - m_loader.setResourceName("com.ibm.as400.data.DAMRI"); - } - - public static final String format(String key) - { - return format(key, null); - } - - public static final String format(String key, Object[] args) - { - if (args != null) - { - try - { - return MessageFormat.format(m_loader.getString(key), args); - } - catch (Exception e) - { - } - } - return m_loader.getString(key); - } - - public static final String getString(String key) - { - return m_loader.getStringWithNoSubstitute(key); - } - - - public static final int getHeaderLineCount() - { - return m_headerLineCount; - } - - - /** - * Helper method used to try loading from all 3 of our class loaders. - **/ - private static final InputStream loadResource(String docPath) - { - InputStream stream = null; - - ClassLoader loader = getLoader1(); - if (loader != null) stream = loader.getResourceAsStream(docPath); - if (stream != null) return new BufferedInputStream(stream); - - loader = getLoader2(); - if (loader != null) stream = loader.getResourceAsStream(docPath); - if (stream != null) return new BufferedInputStream(stream); - - loader = getLoader3(); - if (loader != null) stream = loader.getResourceAsStream(docPath); - if (stream != null) return new BufferedInputStream(stream); - - return null; - } - - - /** - * This method tries to get the current thread's context class loader. - **/ - private static final ClassLoader getLoader1() - { - //3/5/2003 OYG: This doesn't work if this class is in a parent - //classloader and the resource being loaded is in the child. - //Fixed by using the current thread's class loader. - try - { - return Thread.currentThread().getContextClassLoader(); // Fix for WAS. - } - catch (Throwable t) - { - if (Trace.isTraceOn()) Trace.log(Trace.PCML, "Couldn't get current thread's context class loader: "+t.toString()); - return null; - } - } - - - /** - * This method tries to get the SystemResourceFinder class's class loader. - **/ - private static final ClassLoader getLoader2() - { - try - { - Class c = Class.forName("com.ibm.as400.data.SystemResourceFinder"); - try - { - return c.getClassLoader(); - } - catch (Throwable t2) - { - if (Trace.isTraceOn()) Trace.log(Trace.PCML, "Couldn't get SystemResourceFinder class loader: "+t2.toString()); - return null; - } - } - catch (Throwable t) - { - if (Trace.isTraceOn()) Trace.log(Trace.PCML, "Couldn't get SystemResourceFinder class: "+t.toString()); - return null; - } - } - - - /** - * This method returns our own SystemClassLoader, and should be called when - * the previous getLoaderX() methods either return null or return a class loader - * that is unable to load the PCML. - **/ - private static final ClassLoader getLoader3() - { - return new SystemClassLoader(); - } - - - public static synchronized InputStream getPCMLHeader() - { - // Construct the full resource name - String docPath = m_pcmlHeaderName; - - InputStream stream = loadResource(docPath); - if (stream == null) - { - // We couldn't load the resource, no matter how many class loaders we tried. - throw new MissingResourceException(SystemResourceFinder.format(DAMRI.PCML_DTD_NOT_FOUND, new Object[] {m_pcmlHeaderName}), m_pcmlHeaderName, ""); - } - - if (m_headerLineCount <= 0) - { - LineNumberReader lnr = null; - try - { - // Cache the line count of the header - lnr = new LineNumberReader(new InputStreamReader(stream)); - - try - { - String line = lnr.readLine(); - while (line != null) - { - m_headerLineCount++; - line = lnr.readLine(); - } - } - catch (IOException e) - { - Trace.log(Trace.PCML, "Error when reading input stream in getPCMLHeader", e); - } - } - finally - { - if (lnr != null) { - try { lnr.close(); stream = null; } - catch (Exception e) { Trace.log(Trace.ERROR, e); } - } - if (stream != null) { - try { stream.close(); } - catch (Exception e) { Trace.log(Trace.ERROR, e); } - } - } - - // Get the stream again - stream = loadResource(docPath); - } - - return stream; - } - - - // @B4A -- New method for XPCML - public static synchronized InputStream getXPCMLTransformFile(String fileName) - { - String docPath = "com/ibm/as400/data/"+fileName; - - InputStream stream = loadResource(docPath); - - if (stream == null) - { - if (Trace.isTraceOn()) Trace.log(Trace.PCML, "XSL file not found."); - throw new MissingResourceException(SystemResourceFinder.format(DAMRI.XML_NOT_FOUND, new Object[] {fileName}), fileName, ""); - } - return stream; - } - - - static synchronized InputStream getPCMLDocument(String docName, ClassLoader loader) // @B1C - throws MissingResourceException - { - String docPath = null; - - // Construct the full resource name - // $B4 -- Add xpcml and xpcmlsrc as possible doc endings - if (docName.endsWith(".pcml") || docName.endsWith(".pcmlsrc") || - docName.endsWith(".xpcml") || docName.endsWith(".xpcmlsrc")) //@B4 - { - String baseName = docName.substring(0, docName.lastIndexOf('.') ); - String extension = docName.substring(docName.lastIndexOf('.') ); - docPath = baseName.replace('.', '/') + extension; - } - else - { - docPath = docName.replace('.', '/') + m_pcmlExtension; - } - - InputStream stream = null; - if (loader != null) - { - stream = loader.getResourceAsStream(docPath); - if (stream != null) return new BufferedInputStream(stream); - // We throw an exception here because if the user specified a ClassLoader, - // they probably don't want us to use ours, and we don't want to return another - // version of the document found by a different class loader. - throw new MissingResourceException(SystemResourceFinder.format(DAMRI.PCML_NOT_FOUND, new Object[] {docName}), docName, ""); - } - - stream = loadResource(docPath); - if (stream != null) return stream; - - // We couldn't load the resource, no matter how many class loaders we tried. - throw new MissingResourceException(SystemResourceFinder.format(DAMRI.PCML_NOT_FOUND, new Object[] {docName}), docName, ""); - } - - - static synchronized InputStream getSerializedPCMLDocument(String docName, ClassLoader loader) // @B1C - throws MissingResourceException - { - // Construct the full resource name - String docPath = docName.replace('.', '/') + m_pcmlSerializedExtension; - - InputStream stream = null; - if (loader != null) - { - stream = loader.getResourceAsStream(docPath); - if (stream != null) return new BufferedInputStream(stream); - // We throw an exception here because if the user specified a ClassLoader, - // they probably don't want us to use ours, and we don't want to return another - // version of the document found by a different class loader. - throw new MissingResourceException(SystemResourceFinder.format(DAMRI.SERIALIZED_PCML_NOT_FOUND, new Object[] {docName} ), docName, ""); - } - - stream = loadResource(docPath); - if (stream != null) return stream; - - // We couldn't load the resource, no matter how many class loaders we tried. - throw new MissingResourceException(SystemResourceFinder.format(DAMRI.SERIALIZED_PCML_NOT_FOUND, new Object[] {docName}), docName, ""); - } - - - public static synchronized InputStream getRFMLHeader() - { - String docPath = m_rfmlHeaderName; - - InputStream stream = loadResource(docPath); - if (stream == null) - { - throw new MissingResourceException(SystemResourceFinder.format(DAMRI.DTD_NOT_FOUND, new Object[] {"RFML", m_rfmlHeaderName}), m_rfmlHeaderName, ""); - } - return stream; - } - - - static synchronized InputStream getRFMLDocument(String docName, ClassLoader loader) // @B2A - throws MissingResourceException - { - String docPath = null; - - // Construct the full resource name - if (docName.endsWith(".rfml") - || docName.endsWith(".rfmlsrc")) - { - String baseName = docName.substring(0, docName.lastIndexOf('.') ); - String extension = docName.substring(docName.lastIndexOf('.') ); - docPath = baseName.replace('.', '/') + extension; - } - else - { - docPath = docName.replace('.', '/') + m_rfmlExtension; - } - - InputStream stream = null; - if (loader != null) - { - stream = loader.getResourceAsStream(docPath); - if (stream != null) return new BufferedInputStream(stream); - // We throw an exception here because if the user specified a ClassLoader, - // they probably don't want us to use ours, and we don't want to return another - // version of the document found by a different class loader. - throw new MissingResourceException(SystemResourceFinder.format(DAMRI.XML_NOT_FOUND, new Object[] {"RFML", docName}), docName, ""); - } - - stream = loadResource(docPath); - if (stream != null) return stream; - - // We couldn't load the resource, no matter how many class loaders we tried. - throw new MissingResourceException(SystemResourceFinder.format(DAMRI.XML_NOT_FOUND, new Object[] {"RFML", docName}), docName, ""); - } - - - static synchronized InputStream getSerializedRFMLDocument(String docName, ClassLoader loader) // @B2A - throws MissingResourceException - { - // Construct the full resource name - String docPath = docName.replace('.', '/') + m_rfmlSerializedExtension; - - InputStream stream = null; - if (loader != null) - { - stream = loader.getResourceAsStream(docPath); - if (stream != null) return new BufferedInputStream(stream); - // We throw an exception here because if the user specified a ClassLoader, - // they probably don't want us to use ours, and we don't want to return another - // version of the document found by a different class loader. - throw new MissingResourceException(SystemResourceFinder.format(DAMRI.SERIALIZED_XML_NOT_FOUND, new Object[] {"RFML", docName} ), docName, ""); - } - - stream = loadResource(docPath); - if (stream != null) return stream; - - // We couldn't load the resource, no matter how many class loaders we tried. - throw new MissingResourceException(SystemResourceFinder.format(DAMRI.SERIALIZED_XML_NOT_FOUND, new Object[] {"RFML", docName} ), docName, ""); - } - - -/** @B4 -- NEW METHOD FOR XPCML - * isXPCML -- Returns true or false depending on whether the document to - * parse is determined to be an XPCML document. Returns true is XPCML, - * false if PCML. - */ - protected static boolean isXPCML(String docName,ClassLoader loader) - throws MissingResourceException, IOException - { - - String docPath = null; - - // Construct the full resource name - // $B4 -- Add xpcml and xpcmlsrc as possible doc endings - if (docName.endsWith(".pcml") || docName.endsWith(".pcmlsrc") || - docName.endsWith(".xpcml") || docName.endsWith(".xpcmlsrc")) //@B4 - { - String baseName = docName.substring(0, docName.lastIndexOf('.') ); - String extension = docName.substring(docName.lastIndexOf('.') ); - docPath = baseName.replace('.', '/') + extension; - } - else - { - docPath = docName.replace('.', '/') + m_pcmlExtension; - } - - boolean isXPCML = false; - InputStream stream = null; - LineNumberReader lnr = null; - try - { - if (loader != null) - { - stream = loader.getResourceAsStream(docPath); - if (stream == null) - { - // We throw an exception here because if the user specified a ClassLoader, - // they probably don't want us to use ours, and we don't want to return another - // version of the document found by a different class loader. - throw new MissingResourceException(SystemResourceFinder.format(DAMRI.PCML_NOT_FOUND, new Object[] {docName}), docName, ""); - } - } - if (stream == null) - { - stream = loadResource(docPath); - if (stream == null) - { - // We couldn't load the resource, no matter how many class loaders we tried. - throw new MissingResourceException(SystemResourceFinder.format(DAMRI.PCML_NOT_FOUND, new Object[] {docName}), docName, ""); - } - } - - // Cache the line count of the header - lnr = new LineNumberReader(new InputStreamReader(stream)); - try - { - String line = lnr.readLine(); - boolean found=false; - while (line != null && !found) - { - // Look for xpcml tag - if (line.indexOf(" 0)) - { - // We have an error in the DTD. - // Change the filename and ignore any subsequent PCML errors. - fname = "pcml.dtd"; - m_ignorePCML = true; - } - else - { - // Error is in the PCML. Suppress if errors occurred in the DTD. - if (m_ignorePCML) // @C1C - return; // @C1A - - fname = m_filename; - lineNumber -= m_headerLineCount; - } - - // If exception object doesn't exist, create it - if (m_exc == null) - { - m_exc = new ParseException(SystemResourceFinder.format(DAMRI.FAILED_TO_PARSE, new Object[] {fname} ) ); - } - - // Add the formatted message - m_exc.addMessage("[" + lineNumber + "," + (columnNumber - 1) + "]: " + spe.getMessage() ); - } - - public void fatalError(SAXParseException spe) // @C1A - { // @C1A - error(spe); // @C1A - } - - public void warning(SAXParseException spe) // @C1A - { // @C1A - int lineNumber = spe.getLineNumber(); // @C1A - int columnNumber = spe.getColumnNumber(); // @C1A - - // Filename is either the source file or the DTD file - // based on the line number because the DTD was prepended to the - // source as an inline DTD. - String fname; // @C1A - - // Adjust the line number to account for the PCML header - if (!(lineNumber - m_headerLineCount > 0)) // @C1A - { // @C1A - // We have an error in the DTD. - // Change the filename. - fname = "pcml.dtd"; // @C1A - } // @C1A - else // @C1A - { // @C1A - fname = m_filename; // @C1A - lineNumber -= m_headerLineCount; // @C1A - } // @C1A - - System.err.println(fname + "[" + lineNumber + "," + (columnNumber - 1) + "]: " + spe.getMessage() ); // @C1A - } // @C1A - - public ParseException getException() - { - return m_exc; - } -} diff --git a/cvsroot/src/com/ibm/as400/data/XPCMLHelper.java b/cvsroot/src/com/ibm/as400/data/XPCMLHelper.java deleted file mode 100644 index ee8c315b8..000000000 --- a/cvsroot/src/com/ibm/as400/data/XPCMLHelper.java +++ /dev/null @@ -1,89 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: XPCMLHelper.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import java.io.*; -import java.util.*; -import javax.xml.transform.*; -import javax.xml.transform.stream.*; -import org.xml.sax.*; -import com.ibm.as400.access.Trace; - -// This class contains the transform methods originally added to ProgramCallDocument. -// They are here so that ProgramCallDocument does not have a direct dependency on the XSL/XML -// classes at runtime, in case a user wants to use a ProgramCallDocument to just de-serialize -// their PCML under pre-JDK 1.4 (and they don't have the XML parser or XSL processor in their -// CLASSPATH). -class XPCMLHelper -{ - /** - doTransform -- Transforms one XML stream to another. Inputs are transform file - (.xsl file), XML input stream, and XML output stream containing - transformed XML. - **/ - - //@E2C -- Change protected scope to package scope - static void doTransform(String transformFile, InputStream streamSource, OutputStream streamResult) - throws TransformerException, TransformerConfigurationException, - SAXException, IOException, PcmlException - { - StreamSource in = new StreamSource(SystemResourceFinder.getXPCMLTransformFile(transformFile)); // Note: Class 'StreamSource' has no close() method. - TransformerFactory tFactory = TransformerFactory.newInstance(); //@CRS - Transformer transformer = tFactory.newTransformer(in); - transformer.transform(new StreamSource(streamSource), new StreamResult(streamResult)); - } - - - /** - doCondenseTransform -- Transforms one XML stream to another. Inputs are transform file - (.xsl file), full XPCML input stream, XSD stream and XML output - stream containing transformed XPCML. - **/ - - //@E2C -- Change protected scope to package scope - static void doCondenseTransform(String transformFile, InputStream streamSource, OutputStream streamResult, String xsdStreamName) - throws TransformerException, TransformerConfigurationException, - SAXException, IOException, PcmlException - { - StreamSource in = new StreamSource(SystemResourceFinder.getXPCMLTransformFile(transformFile)); - TransformerFactory tFactory = TransformerFactory.newInstance(); //@CRS - Transformer transformer = tFactory.newTransformer(in); - transformer.setParameter("xsdFileName", xsdStreamName); - - StreamSource streamIn = new StreamSource(streamSource); - transformer.transform(streamIn, new StreamResult(streamResult)); - } - - - /** - doSimplifyXSDTransform -- Transform that takes XSD file and transforms it to a more readable form for identifying types and their attributes. - **/ - static void doSimplifyXSDTransform(InputStream streamSource, OutputStream streamResult) - throws SAXException, IOException - { - try - { - StreamSource in = new StreamSource(SystemResourceFinder.getXPCMLTransformFile("xpcml_xpcml.xsl")); - TransformerFactory tFactory = TransformerFactory.newInstance(); - Transformer transformer = tFactory.newTransformer(in); - transformer.transform(new StreamSource(streamSource), new StreamResult(streamResult)); - } - catch (TransformerException e){ - Trace.log(Trace.ERROR, e); - throw new SAXException(e); - } - } - - -} diff --git a/cvsroot/src/com/ibm/as400/data/XmlException.java b/cvsroot/src/com/ibm/as400/data/XmlException.java deleted file mode 100644 index 48406b9fa..000000000 --- a/cvsroot/src/com/ibm/as400/data/XmlException.java +++ /dev/null @@ -1,109 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: XmlException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.data; - -import java.awt.Component; - -/** - * Thrown when an error is encountered processing XML. - */ -public class XmlException extends Exception -{ - private String m_localizedMessage; - private Exception m_exception; - - /** - * Constructs a XmlException without a user message. - */ - XmlException() - { - super(); - } - - /** - * Constructs a XmlException with a user message. - * - * @param key the resource key for the message string - */ - XmlException(String key) - { - super(); - m_localizedMessage = SystemResourceFinder.format(key); - } - - /** - * Constructs a XmlException with a user message and substitution values. - * - * @param key The resource key for the message string - * @param args Array of substitution values - */ - XmlException(String key, Object[] args) - { - super(); - m_localizedMessage = SystemResourceFinder.format(key, args); - } - - /** - * Constructs a XmlException with another exception. - * - * @param e the exception wrapped by the XmlException - */ - XmlException(Exception e) - { - super(e); - - // Try to load a string using the exception's Class name as the key - m_localizedMessage = SystemResourceFinder.getString(e.getClass().getName()); - - // If there is no string for this exception, use a generic "Exception received" message. - if (m_localizedMessage == null) - { - m_localizedMessage = SystemResourceFinder.format(DAMRI.EXCEPTION_RECEIVED, new Object[] { "["+e.getClass().getName()+"] " + e.getLocalizedMessage()}); - } - - m_exception = e; - } - - /** - * Returns a localized description of this XmlException. - */ - public String getLocalizedMessage() - { - if (m_localizedMessage != null) - return m_localizedMessage; - - return super.getLocalizedMessage(); - } - - /** - * Returns a description of this XmlException. - */ - public String getMessage() - { - return getLocalizedMessage(); - } - - /** - * Returns the original exception that caused this XmlException. - * This method returns the same object as Exception.getCause(). - * - * @return The exception that caused this instance of XmlException. - * Note: This may be an instance of {@link PcmlSpecificationException PcmlSpecificationException}. - * If this exception was not caused by another exception, null is returned. - */ - public Exception getException() - { - return m_exception; - } -} diff --git a/cvsroot/src/com/ibm/as400/data/package.html b/cvsroot/src/com/ibm/as400/data/package.html deleted file mode 100644 index 9bee84bb0..000000000 --- a/cvsroot/src/com/ibm/as400/data/package.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - -Provides classes to simplify calling IBM i programs (RPG, COBOL, C, etc) from Java. -

      -The classes in this package use a technology called the -Program Call Markup Language, or PCML. -PCML is based on the Extensible Markup Language (XML) and defines the interface that is -used when calling a program. - -

      Related Documentation

      - -For overviews, tutorials, examples, guides, and tool documentation, please see: - - - - diff --git a/cvsroot/src/com/ibm/as400/data/pcml.dtd b/cvsroot/src/com/ibm/as400/data/pcml.dtd deleted file mode 100644 index 6deb51e5c..000000000 --- a/cvsroot/src/com/ibm/as400/data/pcml.dtd +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -]> diff --git a/cvsroot/src/com/ibm/as400/data/pcml_xpcml.xsl b/cvsroot/src/com/ibm/as400/data/pcml_xpcml.xsl deleted file mode 100644 index 625156e35..000000000 --- a/cvsroot/src/com/ibm/as400/data/pcml_xpcml.xsl +++ /dev/null @@ -1,605 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - in - out - inout - inherit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - in - out - inout - inherit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - in - out - inout - inherit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/data/rfml.dtd b/cvsroot/src/com/ibm/as400/data/rfml.dtd deleted file mode 100644 index e4adc6a44..000000000 --- a/cvsroot/src/com/ibm/as400/data/rfml.dtd +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/data/xpcml.xsd b/cvsroot/src/com/ibm/as400/data/xpcml.xsd deleted file mode 100644 index d25904e19..000000000 --- a/cvsroot/src/com/ibm/as400/data/xpcml.xsd +++ /dev/null @@ -1,1263 +0,0 @@ - - - - - - - - - Schema for xpcml (eXtended Program Call Markup Language). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/data/xpcml_basic.xsl b/cvsroot/src/com/ibm/as400/data/xpcml_basic.xsl deleted file mode 100644 index a6557d0af..000000000 --- a/cvsroot/src/com/ibm/as400/data/xpcml_basic.xsl +++ /dev/null @@ -1,1260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - concat(@name,'_') - - - - - - - - - - - - - - - - - - concat(@name,'_') - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/data/xpcml_xpcml.xsl b/cvsroot/src/com/ibm/as400/data/xpcml_xpcml.xsl deleted file mode 100644 index 5f88046fc..000000000 --- a/cvsroot/src/com/ibm/as400/data/xpcml_xpcml.xsl +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - - - - - - parm type=string name="" - - - - parm type=arrayOfString name="" - - - - parm type=int name="" - - - - parm type=arrayOfInt name="" - - - - parm type=uint name="" - - - - parm type=arrayOfUInt name="" - - - - parm type=short name="" - - - - parm type=arrayOfShort name="" - - - - parm type=ushort name="" - - - - parm type=arrayOfUShort name="" - - - - parm type=long name="" - - - - parm type=arrayOfLong name="" - - - - parm type=float name="" - - - - parm type=arrayOfFloat name="" - - - - parm type=packed name="" - - - - parm type=arrayOfPacked name="" - - - - parm type=zoned name="" - - - - parm type=arrayOfZoned name="" - - - - parm type=double name="" - - - - parm type=arrayOfDouble name="" - - - - parm type=hexBinary name="" - - - - parm type=arrayOfHexBinary name="" - - - - parm type=structParm name="" - - - - parm type=arrayOfStructParm name="" - - - - parm type=structArray name="" - - - - attributeName=name attributeValue= - - - - attributeName=length attributeValue= - - - - attributeName=passDirection attributeValue= - - - - attributeName=passMode attributeValue= - - - - attributeName=count attributeValue= - - - - attributeName=offset attributeValue= - - - - attributeName=offsetFrom attributeValue= - - - - attributeName=outputSize attributeValue= - - - - attributeName=minvrm attributeValue= - - - - attributeName=maxvrm attributeValue= - - - - attributeName=totalDigits attributeValue= - - - - attributeName=fractionDigits attributeValue= - - - - attributeName=trim attributeValue= - - - - attributeName=bytesPerChar attributeValue= - - - - attributeName=bidiStringType attributeValue= - - - - attributeName=ccsid attributeValue= - - - - attributeName=totalBytes attributeValue= - - - - attributeName=isEmptyString attributeValue= - - - - parameterName="" - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/data/xpcml_xsd.xsl b/cvsroot/src/com/ibm/as400/data/xpcml_xsd.xsl deleted file mode 100644 index 8f7b1d1c0..000000000 --- a/cvsroot/src/com/ibm/as400/data/xpcml_xsd.xsl +++ /dev/null @@ -1,1056 +0,0 @@ - - - - - - - - - - - - - - - - - <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'> - <xs:include schemaLocation=''/> - - </xs:schema> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <xs:complexType> - - - <xs:simpleContent> - <xs:restriction base="stringParmType"> - - - <xs:complexContent> - <xs:restriction base="stringParmArrayType"> - <xs:sequence> - <xs:element name="i" type="stringElementType" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - - - <xs:complexContent> - <xs:restriction base="structParmArrayType"> - <xs:sequence> - <xs:element name="struct_i" type="structElementType" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - - - <xs:simpleContent> - <xs:restriction base="intParmType"> - - - <xs:complexContent> - <xs:restriction base="intParmArrayType"> - <xs:sequence> - <xs:element name="i" type="intElementType" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - - - <xs:simpleContent> - <xs:restriction base="unsignedIntParmType"> - - - <xs:complexContent> - <xs:restriction base="unsignedIntParmArrayType"> - <xs:sequence> - <xs:element name="i" type="unsignedIntElementType" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - - - <xs:simpleContent> - <xs:restriction base="hexBinaryParmType"> - - - <xs:complexContent> - <xs:restriction base="hexBinaryParmArrayType"> - <xs:sequence> - <xs:element name="i" type="hexBinaryElementType" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - - - <xs:simpleContent> - <xs:restriction base="shortParmType"> - - - <xs:complexContent> - <xs:restriction base="shortParmArrayType"> - <xs:sequence> - <xs:element name="i" type="shortElementType" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - - - <xs:simpleContent> - <xs:restriction base="unsignedShortParmType"> - - - <xs:complexContent> - <xs:restriction base="unsignedShortParmArrayType"> - <xs:sequence> - <xs:element name="i" type="unsignedShortElementType" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - - - <xs:simpleContent> - <xs:restriction base="longParmType"> - - - <xs:complexContent> - <xs:restriction base="longParmArrayType"> - <xs:sequence> - <xs:element name="i" type="longElementType" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - - - <xs:simpleContent> - <xs:restriction base="floatParmType"> - - - <xs:complexContent> - <xs:restriction base="floatParmArrayType"> - <xs:sequence> - <xs:element name="i" type="floatElementType" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - - - <xs:simpleContent> - <xs:restriction base="doubleParmType"> - - - <xs:complexContent> - <xs:restriction base="doubleParmArrayType"> - <xs:sequence> - <xs:element name="i" type="doubleElementType" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - - - <xs:simpleContent> - <xs:restriction base="packedDecimalParmType"> - - - <xs:complexContent> - <xs:restriction base="packedDecimalParmArrayType"> - <xs:sequence> - <xs:element name="i" type="packedDecimalElementType" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - - - <xs:simpleContent> - <xs:restriction base="zonedDecimalParmType"> - - - <xs:complexContent> - <xs:restriction base="zonedDecimalParmArrayType"> - <xs:sequence> - <xs:element name="i" type="zonedDecimalElementType" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - - - - <xs:attribute name="name" type="string50" fixed="" /> - - - <xs:attribute name="length" type="xs:string" fixed="" /> - - - <xs:attribute name="passDirection" type="passDirectionType" fixed="" /> - - - <xs:attribute name="passMode" type="passModeType" fixed="" /> - - - <xs:attribute name="count" type="xs:string" fixed="" /> - - - <xs:attribute name="totalBytes" type="xs:string" fixed="" /> - - - <xs:attribute name="offsetFrom" type="xs:string" fixed="" /> - - - <xs:attribute name="outputSize" type="xs:string" fixed="" /> - - - <xs:attribute name="offset" type="xs:string" fixed="" /> - - - <xs:attribute name="minvrm" type="string10" fixed="" /> - - - <xs:attribute name="maxvrm" type="string10" fixed="" /> - - - <xs:attribute name="totalDigits" type="xs:positiveInteger" fixed="" /> - - - <xs:attribute name="fractionDigits" type="xs:nonNegativeInteger" fixed="" /> - - - <xs:attribute name="ccsid" type="xs:string" fixed="" /> - - - <xs:attribute name="storageEncoding" type="xs:string" fixed="" /> - - - <xs:attribute name="trim" type="trimType" fixed="" /> - - - <xs:attribute name="bytesPerChar" type="charType" fixed="" /> - - - <xs:attribute name="bidiStringType" type="bidiStringTypeType" fixed="" /> - - - <xs:attribute name="isEmptyString" type="xs:boolean" fixed="true" /> - - - - <xs:attribute name="struct" type="string50" fixed="" /> - - </xs:restriction> - - </xs:complexContent> - - - </xs:simpleContent> - - </xs:complexType> - </xs:element> - - - - - - - - - - - - - - - concat(@name,'_') - - - - - <xs:element name="" substitutionGroup="stringParmGroup" > - - - <xs:element name="" substitutionGroup="stringParmArrayGroup" > - - - <xs:element name="" substitutionGroup="structParmArrayGroup" > - - - <xs:element name="" substitutionGroup="intParmGroup" > - - - <xs:element name="" substitutionGroup="intParmArrayGroup" > - - - <xs:element name="" substitutionGroup="unsignedIntParmGroup" > - - - <xs:element name="" substitutionGroup="unsignedIntParmArrayGroup" > - - - <xs:element name="" substitutionGroup="hexBinaryParmGroup" default="" > - - - <xs:element name="" substitutionGroup="hexBinaryParmArrayGroup" > - - - <xs:element name="" substitutionGroup="shortParmGroup" > - - - <xs:element name="" substitutionGroup="shortParmArrayGroup" > - - - <xs:element name="" substitutionGroup="unsignedShortParmGroup" > - - - <xs:element name="" substitutionGroup="unsignedShortParmArrayGroup" > - - - <xs:element name="" substitutionGroup="longParmGroup" > - - - <xs:element name="" substitutionGroup="longParmArrayGroup" > - - - <xs:element name="" substitutionGroup="floatParmGroup" > - - - <xs:element name="" substitutionGroup="floatParmArrayGroup" > - - - <xs:element name="" substitutionGroup="doubleParmGroup" > - - - <xs:element name="" substitutionGroup="doubleParmArrayGroup" > - - - <xs:element name="" substitutionGroup="zonedDecimalParmGroup" > - - - <xs:element name="" substitutionGroup="zonedDecimalParmArrayGroup" > - - - <xs:element name="" substitutionGroup="packedDecimalParmGroup" > - - - <xs:element name="" substitutionGroup="packedDecimalParmArrayGroup" > - - - - - diff --git a/cvsroot/src/com/ibm/as400/micro/ConnectionHandler.java b/cvsroot/src/com/ibm/as400/micro/ConnectionHandler.java deleted file mode 100644 index 726fd5740..000000000 --- a/cvsroot/src/com/ibm/as400/micro/ConnectionHandler.java +++ /dev/null @@ -1,432 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConnectionHandler.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.io.*; -import java.sql.*; - -import com.ibm.as400.access.Trace; - - -/** - * The ConnectionHandler class is designed to handle all interactions - * needed by the JDBC-ME driver with the JDBC Connection interface. - **/ -class ConnectionHandler -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - private JdbcMeService service_; - private MicroDataInputStream in_; - private MicroDataOutputStream out_; - - /** - Constructor. Creates a JDBC-ME handler for Connection objects. - **/ - public ConnectionHandler(JdbcMeService jdbcme, MicroDataInputStream in, MicroDataOutputStream out) - { - service_ = jdbcme; - in_ = in; - out_ = out; - } - - - /** - The process function routes the function id and the Connection - to the proper handler. - **/ - public void process(Connection connection, int funcId) throws IOException - { - switch (funcId) - { - case MEConstants.CONN_CLOSE: - close(connection); - break; - case MEConstants.CONN_CREATE_STATEMENT: - createStatement(connection); - break; - case MEConstants.CONN_CREATE_STATEMENT2: - createStatement2(connection); - break; - case MEConstants.CONN_PREPARE_STATEMENT: - prepareStatement(connection); - break; - case MEConstants.CONN_SET_AUTOCOMMIT: - setAutoCommit(connection); - break; - case MEConstants.CONN_SET_TRANSACTION_ISOLATION: - setTransactionIsolation(connection); - break; - case MEConstants.CONN_COMMIT: - commit(connection); - break; - case MEConstants.CONN_ROLLBACK: - rollback(connection); - break; - default: - // TODO: This is an exception condition... - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Connection Function ID not recognized - function code: " + funcId); - break; - } - } - - - /** - Closes the Connection object. This function has the side effect - of closing all Statements and ResultSets that are open under the - connection as well. Unlike most of the methods of this class, - if an exception occurs while closing the Connection, this method - will not report it back to the caller in any way. It is simply - swollowed and a message is logged concerning the failure. -

      - The data flow is as follows: - - - nothing more - - - nothing more -

      - - @param connection The connection object to close. - **/ - public void close(Connection connection) throws IOException - { - try - { - connection.close(); - } - catch (SQLException e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Exception caught trying to close connection object " + connection, e); - } - - // Remove it from the vector. - service_.removeConnection(connection); - } - - - /** - Creates a JDBC Statement object under the given connection - and returns a int handle to it to the caller. -

      - The data flow is as follows: - - - nothing more - - int - the statement handle for the object. -

      - - @param connection The connection object to use. - **/ - public void createStatement(Connection connection) throws IOException - { - try - { - Statement s = connection.createStatement(); - - // Insert it into the vector - service_.addStatement(s); - - // Put the object into our map - int objectId = service_.mapObject(s); - out_.writeInt(objectId); - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - /** - Creates a JDBC Statement object under the given connection - and returns a int handle to it to the caller. The statement - object that will get created by this function will be scrollable - and updatable. -

      - The data flow is as follows: - - - nothing more - - int - the statement handle for the object. -

      - - @param connection The connection object to use. - **/ - public void createStatement2(Connection connection) throws IOException - { - try - { - // This is the JDBC create statement enhancement. - int type = in_.readInt(); - int concurrency = in_.readInt(); - Statement s = connection.createStatement(type, concurrency); - - // Insert it into the vector - service_.addStatement(s); - - // Put the object into our map - int objectId = service_.mapObject(s); - out_.writeInt(objectId); - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - /** - Creates a JDBC PreparedStatement object under the given connection - and returns a int handle to it to the caller. -

      - The data flow is as follows: - - String - the sql statement to prepare. - - nothing more - - int - the prepared statement handle for the object. - int 1 = there is a ResultSet - int - the number of columns in the ResultSet - int - list of all the columns data types. - int 0 = there is no Resultset -

      - - @param connection The connection object to use. - **/ - public void prepareStatement(Connection connection) throws IOException - { - try - { - // TODO: We may have to ensure that all the SQL processing happens - // before we try to write anything so that we can put out - // a clean stream.... - // Read in the SQL statement to prepare. - String sql = in_.readUTF(); - - // Create the JDBC PreparedStatement - PreparedStatement ps = connection.prepareStatement(sql); - - // Insert it into the vector - service_.addStatement(ps); - - // Put the object into our map - int objectId = service_.mapObject(ps); - out_.writeInt(objectId); - out_.flush(); - - ResultSetMetaData rsmd = ps.getMetaData(); - - if (rsmd == null) - out_.writeInt(0); - else - { - out_.writeInt(1); - int count = rsmd.getColumnCount(); - out_.writeInt(count); - - for (int i = 0; i < count; i ++) - { - out_.writeInt(rsmd.getColumnType(i + 1)); - } - } - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - /** - Creates a JDBC PreparedStatement object under the given connection - and returns a int handle to it to the caller. The prepared statement - object that will get created by this function will be scrollable - and updatable. -

      - The data flow is as follows: - - String - the sql statement to prepare. - - nothing more - - int - the prepared statement handle for the object. - int 1 = there is a ResultSet - int - the number of columns in the ResultSet - int - list of all the columns data types. - int 0 = there is no Resultset -

      - - @param connection The connection object to use. - **/ - public void prepareStatement2(Connection connection) throws IOException - { - try - { - // TODO: We may have to ensure that all the SQL processing happens - // before we try to write anything so that we can put out - // a clean stream.... - // Read in the SQL statement to prepare. - String sql = in_.readUTF(); - - // Create the JDBC PreparedStatement - PreparedStatement ps = connection.prepareStatement(sql, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - // Insert it into the vector - service_.addStatement(ps); - - // Put the object into our map - int objectId = service_.mapObject(ps); - out_.writeInt(objectId); - out_.flush(); - - ResultSetMetaData rsmd = ps.getMetaData(); - - if (rsmd == null) - out_.writeInt(0); - else - { - out_.writeInt(1); - int count = rsmd.getColumnCount(); - out_.writeInt(count); - - for (int i = 0; i < count; i ++) - { - out_.writeInt(rsmd.getColumnType(i + 1)); - } - } - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - /** - Sets the autocommit attribute for the underlying - connection object. -

      - The data flow is as follows: - - boolean - t/f for autocommit setting - - int - 1/0 for success/failure. -

      - - @param connection The connection object to use. - **/ - public void setAutoCommit(Connection connection) throws IOException - { - try - { - boolean b = in_.readBoolean(); - connection.setAutoCommit(b); - out_.writeInt(1); - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - /** - Sets the transaction isolation level for the underlying - connection object. -

      - The data flow is as follows: - - int - the transaction isolation level to set - - int - 1/0 for success/failure. -

      - - @param connection The connection object to use. - **/ - public void setTransactionIsolation(Connection connection) throws IOException - { - try - { - int level = in_.readInt(); - connection.setTransactionIsolation(level); - out_.writeInt(1); - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - /** - Commits the work that is pending under the current - transaction. -

      - The data flow is as follows: - - none - - int - 1/0 for success/failure. -

      - - @param connection The connection object to use. - **/ - public void commit(Connection connection) throws IOException - { - try - { - connection.commit(); - out_.writeInt(1); - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - /** - Rolls back the work that is pending under the current - transaction. -

      - The data flow is as follows: - - none - - int - 1/0 for success/failure. -

      - - @param connection The connection object to use. - **/ - public void rollback(Connection connection) throws IOException - { - try - { - connection.rollback(); - out_.writeInt(1); - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/micro/JdbcMeService.java b/cvsroot/src/com/ibm/as400/micro/JdbcMeService.java deleted file mode 100644 index ea29a3e1b..000000000 --- a/cvsroot/src/com/ibm/as400/micro/JdbcMeService.java +++ /dev/null @@ -1,518 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JdbcMeService.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import com.ibm.as400.access.Trace; -import java.io.*; -import java.sql.*; -import java.util.*; - -class JdbcMeService implements Service -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - private Vector connections_; - private Vector statements_; - private Hashtable statementresults_; // DOMINO - private Hashtable map_; - private Properties properties_; - - private MicroDataInputStream in_; - private MicroDataOutputStream out_; - private int dataFlowType_; - - // Note: for a multi-threaded client, we would have to synchronize - // access to this. Of course, we would have to do a lot more - // than that. :) - private int NextObjectId_; - - - private ConnectionHandler connectionHandler_; - private StatementHandler statementHandler_; - private ResultSetHandler resultSetHandler_; - - - /** - Constructor so we do not have to pass the streams around in all - the helper functions. - **/ - public JdbcMeService() - { - // Create the data structures to hold our JDBC objects. - connections_ = new Vector(); - statements_ = new Vector(); - map_ = new Hashtable(); - statementresults_ = new Hashtable(); // DOMINO - - NextObjectId_ = 1; - dataFlowType_ = MEConstants.DATA_FLOW_LIMITED; - - registerDrivers(); - } - - - /** - **/ - public void setDataStreams(MicroDataInputStream in, MicroDataOutputStream out) - { - in_ = in; - out_ = out; - - // Create the JDBC internal handlers. - connectionHandler_ = new ConnectionHandler(this, in_, out_); - statementHandler_ = new StatementHandler(this, in_, out_); - resultSetHandler_ = new ResultSetHandler(this, in_, out_); - } - - - /** - Tells the caller whether or not this service request - handler can handle the specified request being input. - **/ - public boolean acceptsRequest(int functionId) - { - - if ((functionId > 999) && (functionId < 2000)) - return true; - - return false; - } - - - /** - Routes the specified function request to the correct - internal handler. - **/ - public void handleRequest(int functionId) throws IOException - { - // Output the function id for debugging. - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, "Function id is " + Integer.toHexString(functionId)); - - // First check for and handle any service requests. - // Just like the various JDBC object handlers have a process - // method for dealing with requests, so do service handlers. - if (isServiceRequest(functionId)) - { - process(functionId); - return; - } - - - // If a new connection is needed, do it inline here. As there - // is not Driver object, there is no JDBC object to follow in - // the data stream. - if (functionId == MEConstants.CONN_NEW) - { - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, "JDBC Service: The request is here. " + Integer.toHexString(functionId)); - - boolean trace = Trace.isTraceOn(); - - if (trace) - Trace.setTraceOn(false); - - // Input Parm - the url to use to get the connection. - String url = in_.readUTF(); - - if (trace) - Trace.setTraceOn(true); - - // Create the connection - try - { - Connection c = DriverManager.getConnection(url); - - // Add it to our vector. - connections_.addElement(c); - - // Put the object into our map. - int objectId = getNextObjectId(); - map_.put(new Integer(objectId), new Integer(c.hashCode())); - out_.writeInt(objectId); - out_.flush(); - } - catch (SQLException e) - { - handleException(e); - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, e); - } - - return; - } - - // The first value on all JDBC requests that are not for a new - // connections or service requests is an object id. - int handle = in_.readInt(); - - // Get the object that is represented by the JDBC handle. - Object object = processJdbcObject(handle); - - // Do the work - I don't really like this layout... perhaps - // I will change it as Fred suggested to do things more OO. - if (object instanceof Connection) - { - connectionHandler_.process((Connection) object, functionId); - } - else if (object instanceof Statement) - { - statementHandler_.process((Statement) object, functionId); - } - else if (object instanceof ResultSet) - { - resultSetHandler_.process((ResultSet) object, functionId); - } - // DOMINO START - else - { - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, "Error, unknown Jdbc object < " + object + ">"); - try - { - throw new SQLException("Error, unknown Jdbc object < " + object + ">"); - } - catch (SQLException e) - { - handleException(e); - } - } - // DOMINO END - } - - - /** - Figure out what the handle type is so that we can figure - out what the function indentifier means. - - TODO: We will probably change this so that that handle - is really the object hash code instead of the CLI handle. - Otherwise we can't be JDBC driver neutral. - **/ - public Object processJdbcObject(int handle) throws IOException - { - // Get the object hashcode based off of the user input handle. - Integer oObjectHash = (Integer) map_.get(new Integer(handle)); - int iObjectHash = oObjectHash.intValue(); - - Integer mapValue = null; - - try - { -// DOMINO ADD - // Loop through all our result sets - // The Hostserver requires JDK 1.2, so using this - // method should be fine. - Collection col = statementresults_.values(); - Iterator it = col.iterator(); - while (it.hasNext()) - { - ResultSet rs = (ResultSet) it.next(); - int rsHandle = rs.hashCode(); - if (iObjectHash == rsHandle) - return rs; - } -// DOMINO END ADD - -// DOMINO REORDER - // Loop through all our statements - for (int i = 0; i < statements_.size(); i++) - { - Statement s = (Statement) statements_.elementAt(i); - int stmtHandle = s.hashCode(); - if (iObjectHash == stmtHandle) - return s; - } - - // Loop through all our connections... - for (int i = 0; i < connections_.size(); i++) - { - // Get the next connection object. - Connection c = (Connection) connections_.elementAt(i); - // Get the connection's hashcode - int connHandle = c.hashCode(); - // Compare it. - if (iObjectHash == connHandle) - return c; - } - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, e); - } - - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "ERROR! returning null from processJdbcObject!"); - - return null; - } - - - /** - This function can handle adding statements, preparedStatements, - and callableStatements to the internal data structures. - **/ - public void addStatement(Statement s) - { - statements_.addElement(s); - // don't add a statementresults entry until the result - // set is created. - } - - /** - This function adds connections to the internal data structures. - **/ - public void addConnection(Connection c) - { - connections_.addElement(c); - } - - /** - * This function adds result sets to the internal data structure - */ - public void addResultSet(Statement s, ResultSet rs) throws SQLException - { // DOMINO - // The DOMINO Jdbc driver doesn't implement - // the getStatement() method. We can't use it - // here. 'lotus.jdbc.domino.DominoDriver' - //// Statement s = rs.getStatement(); - - // statementresults key is statement, value is the resultset - statementresults_.remove(s); // 'close' existing result set - statementresults_.put(s, rs); // Add the new one. - } - - /** - This function can handle removing statements, preparedStatements, - and callableStatements to the internal data structures. - **/ - public void removeStatement(Statement s) - { - statements_.remove(s); - // Also remove the result set associated with the statement - // if there is one. - statementresults_.remove(s); - } - - public void removeResultSet(ResultSet rs) throws SQLException - { // DOMINO - // The DOMINO Jdbc driver doesn't implement - // the getStatement() method. We can't use it - // here. 'lotus.jdbc.domino.DominoDriver' - //// Statement s = rs.getStatement(); - //// statementresults.remove(s); - - // Remove the statement->resultset mapping by going - // backwards its a bit slower. - Collection col = statementresults_.values(); - // The Collection is a live view who's backing - // is the Hashtable, removing this element, removes - // it from the hash table too. - col.remove(rs); - } - - /** - This function removes connections to the internal data structures. - **/ - public void removeConnection(Connection c) - { - // Before removing the connection from our data storage, we - // want to remove the statements from storage for that connection. - Connection toTry = null; - for (int i = 0; i < statements_.size(); i++) - { - Statement s = (Statement) statements_.elementAt(i); - try - { - toTry = s.getConnection(); - } - catch (SQLException e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Exception thrown trying to get the connection for a statement.", e); - } - - if (c == toTry) - { - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, "Implicitly closing a statement because of connection close"); - - removeStatement(s); - } - } - connections_.remove(c); - } - - - /** - This is the generic exception handler for all SQLExceptions - that can happen. - **/ - public void handleException(SQLException e) throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, e); - - out_.writeInt(-1); - - String s = e.getSQLState(); - - if (s == null) - s = "null"; - - out_.writeUTF(s); - - s = e.getMessage(); - - if (s == null) - s = "null"; - - out_.writeUTF(s); - out_.flush(); - } - - - /** - This function returns the next usable object id.. - **/ - public int getNextObjectId() - { - // TODO: at some point, it should be changed to reuse opened - // object ids from holes that get created in its map. - int returnValue = NextObjectId_; - NextObjectId_++; - - return returnValue; - } - - - /** - This method encapsulates the map out of the service handlers. - **/ - public int mapObject(Object object) - { - int objectId = getNextObjectId(); - map_.put(new Integer(objectId), new Integer(object.hashCode())); - - return objectId; - } - - - /** - Get a list of JDBC drivers that the server should attempt to make available. - **/ - public void registerDrivers() - { - String driver = "com.ibm.as400.access.AS400JDBCDriver"; - - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, "Loading driver: " + driver); - try - { - Class.forName(driver); - } - catch (ClassNotFoundException e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, "Failed to load driver " + driver); - } - } - - - - /** - **/ - public boolean isServiceRequest(int funcId) - { - // Check for function id in the JDBCME service request range. - if ((funcId > 1900) && (funcId < 1999)) - return true; - - return false; - } - - - - /** - Process service requests - **/ - public void process(int funcId) throws IOException - { - switch (funcId) - { - case MEConstants.JDBCME_DATA_TYPE_FLOW: - setDataFlowType(); - break; - default: - // TODO: This is an exception condition... - System.out.println("Error - JDBC-ME Service request unrecognized - function code: " + funcId); - break; - } - } - - - /** - Allows JDBCME service handlers to determine the type of - data type flows the user application is interested in. - **/ - public int getDataFlowType() - { - return dataFlowType_; - } - - - /** - **/ - public void setDataFlowType() throws IOException - { - // TODO: Verification should be done that this is - // a value value passed in and stuff like - // that. Also, the function should be broken - // out so that appropriate JavaDoc can be - // created for it. - int type = in_.readInt(); - if ((type == MEConstants.DATA_FLOW_ALL) || - (type == MEConstants.DATA_FLOW_LIMITED) || - (type == MEConstants.DATA_FLOW_STRINGS_ONLY)) - { - dataFlowType_ = type; - out_.writeInt(1); - out_.flush(); - } - else - { - handleServiceException("An invalid setting was passed for setting the data flow type: " + type); - } - } - - - /** - Handles exceptions that happen at a service level. - **/ - public void handleServiceException(String message) throws IOException - { - out_.writeInt(-1); - out_.writeUTF("JDBC"); - out_.writeUTF(message); - out_.flush(); - } - -} - - - diff --git a/cvsroot/src/com/ibm/as400/micro/MEConstants.java b/cvsroot/src/com/ibm/as400/micro/MEConstants.java deleted file mode 100644 index dfea0d0b7..000000000 --- a/cvsroot/src/com/ibm/as400/micro/MEConstants.java +++ /dev/null @@ -1,113 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MEConstants.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -/** - * The MEConstants class defines global constants for the - * ToolboxME for i5/OS support. -**/ - -interface MEConstants -{ - // THE COMPONENT REQUEST DATASTREAM TYPES. - static final int SERVICE_COMMAND = 2; - static final int SERVICE_DATAQUEUE = 3; - static final int SERVICE_DATABASE = 4; - static final int SERVICE_ALL_SERVICES = 99; - - // The default port number. This port number was registered - // with the Internet Assigned Numbers Authority (http://www.iana.org) - // on 01/29/1999. For a complete list of registered port numbers, - // go to http://www.isi.edu/in-notes/iana/assignments/port-numbers. - static final int ME_SERVER_PORT = 3470; - - // Client/Server Seed information. - static final int ADDER_LENGTH = 18; // number of bytes - static final int MASK_LENGTH = 14; // number of bytes - static final int ADDER_PLUS_MASK_LENGTH = ADDER_LENGTH + MASK_LENGTH; - - // THE REQUEST DATASTREAM TYPES. - static final int SIGNON = 0x1122; - static final int COMMAND_CALL = 0x1123; - static final int PROGRAM_CALL = 0x1124; - static final int DISCONNECT = 0x1125; - static final int DATA_QUEUE_READ = 0x1126; - static final int DATA_QUEUE_WRITE = 0x1127; - static final int DATA_QUEUE_BYTES = 0x1128; - static final int DATA_QUEUE_STRING = 0x1129; - - // THE REPLY DATASTREAM TYPTES. - static final int SIGNON_SUCCEEDED = 0x1234; - static final int SIGNON_FAILED = 0x1235; - static final int XML_DOCUMENT_NOT_REGISTERED = 0x1236; - static final int XML_DOCUMENT_REGISTERED = 0x1237; - static final int DATA_QUEUE_ACTION_SUCCESSFUL = 0x1238; - static final int EXCEPTION_OCCURRED = 0x1239; - static final int REQUEST_NOT_SUPPORTED = 0x01240; - - // JDBCME functions - // Connection functions - static final int CONN_NEW = 0x1250; - static final int CONN_CLOSE = 0x1251; - static final int CONN_CREATE_STATEMENT = 0x1252; - static final int CONN_CREATE_STATEMENT2 = 0x1253; - static final int CONN_PREPARE_STATEMENT = 0x1254; - - static final int CONN_SET_AUTOCOMMIT = 0x1255; - static final int CONN_SET_TRANSACTION_ISOLATION = 0x1256; - static final int CONN_COMMIT = 0x1257; - static final int CONN_ROLLBACK = 0x1258; - - // Statement functions - static final int STMT_CLOSE = 0x1261; - static final int STMT_EXECUTE = 0x1262; - static final int STMT_GET_RESULT_SET = 0x1263; - static final int STMT_GET_UPDATE_COUNT = 0x1264; - - // PreparedStatement functions - static final int PREP_EXECUTE = 0x1271; - - // ResultSet functions - static final int RS_CLOSE = 0x1281; - static final int RS_DELETE_ROW = 0x1282; - static final int RS_INSERT_ROW = 0x1283; - static final int RS_NEXT = 0x1284; - static final int RS_PREVIOUS = 0x1285; - static final int RS_UPDATE_ROW = 0x1286; - - static final int RS_ABSOLUTE = 0x1287; - static final int RS_AFTER_LAST = 0x1288; - static final int RS_BEFORE_FIRST = 0x1289; - static final int RS_FIRST = 0x1290; - static final int RS_IS_AFTER_LAST = 0x1291; - static final int RS_IS_BEFORE_FIRST = 0x1292; - static final int RS_IS_FIRST = 0x1293; - static final int RS_IS_LAST = 0x1294; - static final int RS_LAST = 0x1295; - static final int RS_RELATIVE = 0x1296; - - // JDBC-ME Service functions - static final int JDBCME_DATA_TYPE_FLOW = 0x1900; - - // Include the data flow constants here. - // There are multiple types of data flows that the server can - // be setup to provide. This allows the creation of frontends - // of varying complexity. - // - // LIMITED is the only one supported today (and the default). - // The others will be added as time/needs allow. - static final int DATA_FLOW_ALL = 1; - static final int DATA_FLOW_LIMITED = 2; - static final int DATA_FLOW_STRINGS_ONLY = 3; -} diff --git a/cvsroot/src/com/ibm/as400/micro/MEException.java b/cvsroot/src/com/ibm/as400/micro/MEException.java deleted file mode 100644 index 585647169..000000000 --- a/cvsroot/src/com/ibm/as400/micro/MEException.java +++ /dev/null @@ -1,175 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MEException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - - -/** - * The MEException class represents an exception that indicates an error occured - * while processing the ToolboxME for i5/OS request. - **/ -public final class MEException extends Exception -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - // THE SECURITY RETURN CODES (range 0 - 20). - - /** - * This return code indicates that a security or authority error has occurred. - **/ - public static final int AS400_SECURITY_EXCEPTION = 0x0001; - - /** - * The return code indicating that there is a general password error. - **/ - public static final int PASSWORD_ERROR = 0x0002; - - /** - * The return code indicating that the password has expired. - **/ - public static final int PASSWORD_EXPIRED = 0x0003; - - /** - * The return code indicating that the password is not correct. - **/ - public static final int PASSWORD_INCORRECT = 0x0004; - - /** - * The return code indicating that the user ID is not set. - **/ - public static final int USERID_NOT_SET = 0x0005; - - /** - * The return code indicating that the user ID has been disabled by the system. - **/ - public static final int USERID_DISABLE = 0x0006; - - /** - * The return code indicating that the user ID is not known by the system. - **/ - public static final int USERID_UNKNOWN = 0x0007; - - /** - * The return code indicating that the object already exists. - **/ - public static final int OBJECT_ALREADY_EXISTS = 0x0008; - - /** - * The return code indicating that the object does not exist. - **/ - public static final int OBJECT_DOES_NOT_EXIST = 0x0009; - - /** - * The return code indicating that the parameter value is not valid. - **/ - public static final int PARAMETER_VALUE_NOT_VALID = 0x0010; - - /** - * The return code indicating that one or more properties have not been set. - **/ - public static final int PROPERTY_NOT_SET= 0x0011; - - /** - * The return code indicating that the i5/OS resource has a length that is not valid or cannot be handled through this interface. - **/ - public static final int LENGTH_NOT_VALID = 0x0012; - - // THE COMMUNICTION/SERVER RETURN CODES (range 20 - 39). - - /** - * The return code indicating that the connection was dropped unexpectedly. - **/ - public static final int CONNECTION_DROPPED = 0x0020; - - /** - * The return code indicating that it was unable to start the server. - **/ - public static final int SERVER_NOT_STARTED = 0x0021; - - /** - * The return code indicating that the host is unknown. - **/ - public static final int UNKNOWN_HOST = 0x0022; - - /** - * The return code indicating that the MEServer has already been started. - **/ - public static final int ME_SERVER_ALREADY_STARTED = 0x0023; - - /** - * The return code indicating that the MEServer has not been started. - **/ - public static final int ME_SERVER_NOT_STARTED = 0x0024; - - /** - * The return code indicating that the pcml document was not registered with the MEServer. - **/ - public static final int PROGRAM_NOT_REGISTERED = 0x0025; - - /** - * The return code indicating that the program call failed. - **/ - public static final int PROGRAM_FAILED = 0x0026; - - /** - * The return code indicating that an attempt was made to use a data queue with an invalid data queue object type. - **/ - public static final int ILLEGAL_OBJECT_TYPE = 0x0027; - - /** - * The return code indicating that a pcml exception occurred. - **/ - public static final int PCML_EXCEPTION = 0x0028; - - /** - * The return code indicating that an unknown error occurred. - **/ - public static final int UNKNOWN = 0x0035; - - - // THE SQL RETURN CODES (range 40 - 59). - - /** - * The return code indicating that the result set is closed. - **/ - public static final int RESULT_SET_CLOSED = 0x0040; - - - // Private Data - - private int returnCode_; // Return code associated with this exception. - - - /** - * Construct an MEException. - * - * @param message The exception text. - * @param returnCode The return code which identifies the message to be returned. Possible values are defined as constants on this class. - **/ - MEException(String message, int returnCode) - { - super(message); - returnCode_ = returnCode; - } - - - /** - * Returns the return code associated with this exception. - * - * @return The return code. - **/ - public int getReturnCode() - { - return returnCode_; - } -} diff --git a/cvsroot/src/com/ibm/as400/micro/MEServer.java b/cvsroot/src/com/ibm/as400/micro/MEServer.java deleted file mode 100644 index 09f705b69..000000000 --- a/cvsroot/src/com/ibm/as400/micro/MEServer.java +++ /dev/null @@ -1,1407 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MEServer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.io.*; -import java.net.*; -import java.util.*; -import java.sql.*; -import java.util.Date; -import java.util.Locale; -import java.beans.PropertyVetoException; - -import com.ibm.as400.data.*; -import com.ibm.as400.access.*; - -/** - * The MEServer class is used to fulfill requests from programs - * that are using the ToolboxME for i5/OS jar file. The MEServer is responsible for - * creating and invoking methods on Toolbox objects on behalf of the - * program. The MEServer is intended for use when the client - * is running on a Tier 0 wireless device. - * - *

      If there is already a server active on the specified - * port, then an MEServer will not be started. - * - *

      The MEServer can be run as an - * application, as follows: - * - *

      - *
      - *  java com.ibm.as400.micro.MEServer [ options ]
      - *  
      - *
      - * - *

      Options: - *

      - * - *
      -pcml pcml doc1 [;pcml doc2;...]
      - *
      - * Specifies the PCML document to pre-load and parse. This option may be abbreviated -pc.

      - * - * The PCML document will be loaded from the classpath. The classpath will first be searched - * for a serialized document. If a serialized document is not found, the classpath will be searched - * for a PCML source file.

      - * - * Using this option allows the MEServer to load, parse, and cache the ProgramCallDocument before - * it is used. When a ToolboxME ProgramCall request is made, the MEServer can than - * use the cached ProgramCallDocument to call the program. - * - * If this option is not specified, the PCML will be loaded when the ToolboxME ProgramCall - * request is made. The PCML will be loaded during runtime and will decrease performance. - * - * This option may be abbreviated - * -pc. - *

      - * - *
      -port port
      - *
      - * Specifies the port to use for accepting connections from clients. This option may be abbreviated -po. - * The default port is 3470. This option may be abbreviated - * -po. - *
      - * - *
      -verbose [true|false]
      - *
      - * Specifies whether to print status and connection - * information to System.out. This option may be abbreviated - * -v. - *
      - * - *
      -help
      - *
      - * Prints usage information to System.out. This option may be abbreviated - * -h or -?. The default is not to print usage - * information. - *
      - * - *
      - * - *

      Example usage: - * - *

      Start the MEServer from the command line as follows: - *

      - *  java com.ibm.as400.micro.MEServer
      - *  
      - **/ -public class MEServer implements Runnable -{ - // MRI - private static final String ME_CONNECTION_ACCEPTED_ = ResourceBundleLoader_m.getText("ME_CONNECTION_ACCEPTED"); - - // Private data. - private Socket socket_; - private MicroDataInputStream input_; - private MicroDataOutputStream output_; - private com.ibm.as400.access.AS400 system_; - private com.ibm.as400.access.CommandCall cc_; - private Connection connection_; - - private Service service_; - - // increment datastream level whenever a client/server datastream change is made. - private static final int DATASTREAM_LEVEL = 0; - - private static PrintStream verbose_ = System.out; - private static boolean verboseState_ = false; - - // Table of ProgramCallDocument objects. - private static final Hashtable registeredDocuments_ = new Hashtable(); - - private static int port_; - private static int threadIndex_ = 0; - - private static final Vector expectedOptions_ = new Vector(); - private static final Hashtable shortcuts_ = new Hashtable(); - - // These aren't static since they belong to a specific MEServer thread. - private int nextTransactionID_ = 0x0000; - private Hashtable cachedJDBCTransactions_ = new Hashtable(); // Table of ResultSets - - static - { - // Expected options for the ProxyServer application. - expectedOptions_.addElement("-port"); - expectedOptions_.addElement("-pcml"); - expectedOptions_.addElement("-verbose"); - expectedOptions_.addElement("-help"); - - // Shortcuts for the ProxyServer application. - // Note: These are also listed in usage(). - shortcuts_.put("-po", "-port"); - shortcuts_.put("-pc", "-pcml"); - shortcuts_.put("-v", "-verbose"); - shortcuts_.put("-h", "-help"); - shortcuts_.put("-?", "-help"); - } - - - /** - * Constructs an MEServer object. - **/ - private MEServer(Socket s) throws IOException - { - socket_ = s; - input_ = new MicroDataInputStream( new BufferedInputStream( socket_.getInputStream() ) ); - output_ = new MicroDataOutputStream( new BufferedOutputStream( socket_.getOutputStream() ) ); - } - - - /** - * Cache the SQL Result Set. - **/ - private int cacheTransaction(ResultSet rs) - { - Integer key = new Integer(nextTransactionID_++); - cachedJDBCTransactions_.put(key, rs); - - return key.intValue(); - } - - - // From com.ibm.as400.access.BinaryConverter - static char[] byteArrayToCharArray(byte[] byteValue) - { - if (byteValue == null) - return null; - - char[] charValue = new char[byteValue.length / 2]; - int inPos = 0; - int outPos = 0; - - while (inPos < byteValue.length) - { - charValue[outPos++] = (char)(((byteValue[inPos++] & 0xFF) << 8) + (byteValue[inPos++] & 0xFF)); - } - - return charValue; - } - - - /** - * Close the streams and socket associated with this MEServer. - **/ - private void close() - { - try - { - if (connection_ != null) - connection_.close(); - } - catch (Exception e) - { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error closing MEServer SQL Connection.", e); - } - - try - { - if (system_ != null) - { - system_.disconnectAllServices(); - system_ = null; - } - } - catch (Exception e) - { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error disconnecting all services on MEServer.", e); - } - - system_ = null; - - try - { - if (input_ != null) - { - input_.in_.close(); - input_ = null; - } - } - catch (Exception e) - { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error closing MEServer input stream.", e); - } - - try - { - if (output_ != null) - { - output_.out_.close(); - output_ = null; - } - } - catch (Exception e) - { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error closing MEServer output stream.", e); - } - - try - { - if (socket_ != null) - { - socket_.close(); - socket_ = null; - - if (verboseState_) - verbose_.println ( ResourceBundleLoader_m.getText ("ME_CONNECTION_CLOSED", Thread.currentThread().getName() ) ); - } - } - catch (Exception e) - { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error closing MEServer socket.", e); - } - - try - { - for (Enumeration e = cachedJDBCTransactions_.keys() ; e.hasMoreElements() ;) - { - ((AS400JDBCResultSet) cachedJDBCTransactions_.get(e)).close(); - cachedJDBCTransactions_.remove(e); - } - } - catch (Exception e) - { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error closing SQL Result Set.", e); - } - } - - - // Unscramble some bytes. - private static byte[] decode(byte[] adder, byte[] mask, byte[] bytes) - { - int length = bytes.length; - byte[] buf = new byte[length]; - - for (int i = 0; i < length; ++i) - { - buf[i] = (byte)(mask[i % mask.length] ^ bytes[i]); - } - - for (int i = 0; i < length; ++i) - { - buf[i] = (byte)(buf[i] - adder[i % adder.length]); - } - - return buf; - } - - - - /** - * Receives the command call datastream from the client, runs the command, and sends a reply. - * - * Datastream request format: - * String - command string including CL command name and all of its parameters - * - * Datastream reply format: - * int - number of messages; 0 if there are no messages. - * String[] - messages, consisting of CPF ID and message text - **/ - private void doCommandCall() throws ErrorCompletingRequestException, InterruptedException, IOException - { - String command = input_.readUTF(); - - if (cc_ == null) - cc_ = new CommandCall(system_); - - boolean retVal = false; - - try - { - retVal = cc_.run(command); - } - catch (PropertyVetoException pve) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "PropertyVetoException on run(command)", pve); - } - catch (Exception e) - { - output_.writeInt(MEConstants.EXCEPTION_OCCURRED); - output_.flush(); - - sendException(e); - - return; - } - - int numReplies = 0; - AS400Message[] messages = cc_.getMessageList(); - - // Only failed messages are sent back to the client. - if (!retVal) - numReplies = messages.length; - - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, "Number of messages returned from ToolboxME CommandCall: " + numReplies); - - output_.writeInt(numReplies); - output_.flush(); - - for (int i=0; i 7) // time to grab another long - { - feeder = r.nextLong(); - feederIndex = 0; - } - - buf[i] = (byte)(0xFF & (feeder >> 8*feederIndex++)); - } - - return buf; - } - - - /** - * Parses the command line arguments and sets the properties accordingly. - * - * @param args The command line arguments. - * @return true if the combination of command line arguments is valid, false otherwise. - **/ - private static boolean parseArgs (String[] args) - { - String optionValue; - - CommandLineArguments cla = new CommandLineArguments (args, expectedOptions_ , shortcuts_); - - if (cla.getOptionValue ("-help") != null) - return false; - - optionValue = cla.getOptionValue("-verbose"); - if (optionValue != null) - { - if ((optionValue.length () == 0) || (optionValue.equalsIgnoreCase ("true"))) - verboseState_ = true; - else if (optionValue.equalsIgnoreCase ("false")) - verboseState_ = false; - - else - throw new IllegalArgumentException( ResourceBundleLoader_m.getText("ME_OPTION_VALUE_NOT_VALID", new String[] { "verbose", optionValue}) ); - } - - optionValue = cla.getOptionValue ("-pcml"); - if (optionValue != null) - { - StringTokenizer msc = new StringTokenizer(optionValue, ";"); - while (msc.hasMoreTokens()) - { - try - { - getPCMLDocument(msc.nextToken()); - } - catch (PcmlException pe) - { - verbose_.println( ResourceBundleLoader_m.getText("ME_PCML_ERROR") ); - - if (verboseState_) - verbose_.println( pe.getMessage() ); - - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, pe); - } - } - } - - optionValue = cla.getOptionValue ("-port"); - if (optionValue != null) - { - if (optionValue.length() > 0) - port_ = Integer.parseInt (optionValue); - } - else - port_ = MEConstants.ME_SERVER_PORT; - - // Extra options. - Enumeration options = cla.getExtraOptions (); - while (options.hasMoreElements ()) - { - String extraOption = options.nextElement().toString(); - verbose_.println (ResourceBundleLoader_m.getText ("ME_OPTION_NOT_VALID", extraOption)); - } - - return true; - } - - - // Get clear password bytes back. - private static String resolve(byte[] info) - { - byte[] adder = new byte[MEConstants.ADDER_LENGTH]; - System.arraycopy(info, 0, adder, 0, MEConstants.ADDER_LENGTH); - - byte[] mask = new byte[MEConstants.MASK_LENGTH]; - System.arraycopy(info, MEConstants.ADDER_LENGTH, mask, 0, MEConstants.MASK_LENGTH); - - byte[] infoBytes = new byte[info.length - MEConstants.ADDER_PLUS_MASK_LENGTH]; - System.arraycopy(info, MEConstants.ADDER_PLUS_MASK_LENGTH, infoBytes, 0, info.length - MEConstants.ADDER_PLUS_MASK_LENGTH); - - return new String(byteArrayToCharArray(decode(adder, mask, infoBytes))); - } - - - - /** - * Process the datastream from the Tier 0 device. - **/ - public void run() - { - boolean jdbc = false; - try - { - boolean disconnected = false; - - // If the client disconnects or is performing JdbcMe functions, then - // we exit this Thread and continue to listen for connections on the - // Server socket. - while (!disconnected & !jdbc) - { - // Process next datastream from client. - int cmd = input_.readInt(); - - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, "ME Datastream Request: " + Integer.toHexString(cmd)); - - switch (cmd) - { - case MEConstants.SIGNON: - signon(); - break; - case MEConstants.COMMAND_CALL: - doCommandCall(); - break; - case MEConstants.PROGRAM_CALL: - doProgramCall(); - break; - case MEConstants.DATA_QUEUE_READ: - doDataQueueRead(); - break; - case MEConstants.DATA_QUEUE_WRITE: - doDataQueueWrite(); - break; - case MEConstants.CONN_CLOSE: - case MEConstants.CONN_COMMIT: - case MEConstants.CONN_CREATE_STATEMENT: - case MEConstants.CONN_CREATE_STATEMENT2: - case MEConstants.CONN_NEW: - case MEConstants.CONN_PREPARE_STATEMENT: - case MEConstants.CONN_ROLLBACK: - case MEConstants.CONN_SET_AUTOCOMMIT: - case MEConstants.CONN_SET_TRANSACTION_ISOLATION: - case MEConstants.STMT_CLOSE: - case MEConstants.STMT_EXECUTE: - case MEConstants.STMT_GET_RESULT_SET: - case MEConstants.STMT_GET_UPDATE_COUNT: - case MEConstants.PREP_EXECUTE: - case MEConstants.RS_ABSOLUTE: - case MEConstants.RS_AFTER_LAST: - case MEConstants.RS_BEFORE_FIRST: - case MEConstants.RS_CLOSE: - case MEConstants.RS_DELETE_ROW: - case MEConstants.RS_FIRST: - case MEConstants.RS_INSERT_ROW: - case MEConstants.RS_IS_AFTER_LAST: - case MEConstants.RS_IS_BEFORE_FIRST: - case MEConstants.RS_IS_FIRST: - case MEConstants.RS_IS_LAST: - case MEConstants.RS_LAST: - case MEConstants.RS_NEXT: - case MEConstants.RS_PREVIOUS: - case MEConstants.RS_RELATIVE: - case MEConstants.RS_UPDATE_ROW: - - if (service_ == null) - service_ = new JdbcMeService(); - service_.setDataStreams(input_, output_); - - try - { - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, "Trying service com.ibm.as400.micro.JdbcMeService for Function id " + Integer.toHexString(cmd)); - - if (service_.acceptsRequest(cmd)) - break; // maybe throw exception - - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, "Servicing function id " + Integer.toHexString(cmd)); - - // Request the function execution. - - service_.handleRequest(cmd); - - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, "Service complete"); - - - // Always flush the buffer at the end of the request. - output_.flush(); - - // TODO: A resource cleanup call for each service is needed here... - - } - catch (EOFException eof) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "EOF: Client disconnected", eof); - } - catch (IOException ioe) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "IOException detected - finally block handles cleanup.", ioe); - } - break; - case MEConstants.DISCONNECT: - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, "ToolboxME disconnect received."); - close(); - disconnected = true; - break; - default: - output_.writeInt(MEConstants.EXCEPTION_OCCURRED); - output_.writeInt(MEConstants.REQUEST_NOT_SUPPORTED); - output_.writeUTF("ToolboxME Request not supported: " + Integer.toHexString(cmd) ); - output_.flush(); - } - } - } - catch (Exception e) - { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, e); - - stop(e.getMessage()); - } - - close(); - } - - - /** - * Receives the signon datastream from the client, connects to the i5/OS system, and sends a reply. - * - * Datastream request format: - * String - system name - * String - user profile - * String - password - * - * Datastream reply format: - * int - signon return code (e.g. failed, succeeded, etc.) - **/ - private void signon() throws IOException - { - int clientDataStreamLevel = input_.readInt(); - - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, "Micro client datastream level: " + clientDataStreamLevel); - - byte[] proxySeed = new byte[MEConstants.ADDER_LENGTH]; - - input_.readBytes(proxySeed); - - // Tell them what our datastream level is. - output_.writeInt(DATASTREAM_LEVEL); - - // Generate, hold, and send them our seed. - byte[] remoteSeed = nextBytes(new Random(), MEConstants.MASK_LENGTH); - output_.writeBytes(remoteSeed); - output_.flush(); - - String serverName = input_.readUTF(); - String userid = input_.readUTF(); - - int numBytes = input_.readInt(); // Get length of buffer to allocate. - byte[] bytes = new byte[numBytes]; - - input_.readBytes(bytes); // Note: This value is both twiddled and encoded. - - // Disconnect if we were previously signed on. - // We only allow one AS400 object per thread/connection. - if (system_ != null) - system_.disconnectAllServices(); - - boolean retVal = false; - - try - { - system_ = new com.ibm.as400.access.AS400(serverName, userid, resolve(decode(proxySeed, remoteSeed, bytes))); - - // Wireless devices don't have NLS support in the KVM yet. - // So we only want to display english messages. - system_.setLocale(Locale.US); - - retVal = system_.validateSignon(); - } - catch (Exception e) - { - system_ = null; - - output_.writeInt(MEConstants.EXCEPTION_OCCURRED); - output_.flush(); - - sendException(e); - - return; - } - - int retCode = MEConstants.SIGNON_SUCCEEDED; - - if (!retVal) - { - system_ = null; - retCode = MEConstants.SIGNON_FAILED; - } - - // We can differentiate more return codes here later on. - - output_.writeInt(retCode); - output_.flush(); - } - - - /** - * Stop the ME server. - **/ - private final void stop(String failure) - { - try - { - output_.writeInt(MEConstants.EXCEPTION_OCCURRED); - output_.writeUTF(failure); - } - catch (Exception e) - { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error returning exception, during stop, to ME client.", e); - } - - try - { - output_.flush(); - } - catch (Exception e) - { - if (Trace.isTraceErrorOn ()) - Trace.log (Trace.ERROR, "Error flushing output stream during MEServer stop.", e); - } - - close(); - } - - - /** - * Map a Toolbox exception constant to the corresponding MEException constant and - * send the text message of that exception to the client. - * - * @param e The exception. - **/ - private void sendException(Exception e) throws IOException - { - if ( Trace.isTraceOn() ) - Trace.log(Trace.PROXY, "ME Exception Occurred: \n", e); - - // Determine what the exception was and then map it - // the the MEException return code and send it back - // to the Tier 0 client. - if (e instanceof AS400SecurityException) - { - int rc = ((AS400SecurityException)e).getReturnCode(); - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, "Exception return code: " + rc); - - switch (rc) - { - case AS400SecurityException.PASSWORD_ERROR: - output_.writeInt(MEException.PASSWORD_ERROR); - output_.writeUTF( e.getMessage() ); - break; - - case AS400SecurityException.PASSWORD_EXPIRED: - output_.writeInt(MEException.PASSWORD_EXPIRED); - output_.writeUTF( e.getMessage() ); - break; - - case AS400SecurityException.PASSWORD_INCORRECT: - output_.writeInt(MEException.PASSWORD_INCORRECT); - output_.writeUTF( e.getMessage() ); - break; - - case AS400SecurityException.USERID_NOT_SET: - output_.writeInt(MEException.USERID_NOT_SET); - output_.writeUTF( e.getMessage() ); - break; - - case AS400SecurityException.USERID_DISABLE: - output_.writeInt(MEException.USERID_DISABLE); - output_.writeUTF( e.getMessage() ); - break; - - case AS400SecurityException.USERID_UNKNOWN: - output_.writeInt(MEException.USERID_UNKNOWN); - output_.writeUTF( e.getMessage() ); - break; - - default: - output_.writeInt(MEException.AS400_SECURITY_EXCEPTION); - output_.writeUTF( e.getMessage() ); - break; - } - } - else if (e instanceof PcmlException) - { - output_.writeBoolean(false); - output_.writeInt(MEException.PCML_EXCEPTION); - output_.writeUTF( e.getLocalizedMessage() ); - } - else if (e instanceof ObjectDoesNotExistException) - { - output_.writeInt(MEException.OBJECT_DOES_NOT_EXIST); - output_.writeUTF( e.getMessage() ); - } - else if (e instanceof ExtendedIllegalArgumentException) - { - int rc = ((ExtendedIllegalArgumentException)e).getReturnCode(); - if (rc == ExtendedIllegalArgumentException.LENGTH_NOT_VALID) - output_.writeInt(MEException.LENGTH_NOT_VALID); - else - output_.writeInt(MEException.PARAMETER_VALUE_NOT_VALID); - output_.writeUTF( e.getMessage() ); - } - else if (e instanceof ExtendedIllegalStateException) - { - output_.writeInt(MEException.PROPERTY_NOT_SET); - output_.writeUTF( e.getMessage() ); - } - else if (e instanceof ErrorCompletingRequestException) - { - int rc = ((ErrorCompletingRequestException)e).getReturnCode(); - - if (rc == ErrorCompletingRequestException.LENGTH_NOT_VALID) - output_.writeInt(MEException.LENGTH_NOT_VALID); - else - output_.writeInt(MEException.UNKNOWN); - output_.writeUTF( e.getMessage() ); - } - else if (e instanceof ConnectionDroppedException) - { - int rc = ((ConnectionDroppedException)e).getReturnCode(); - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, "Exception return code: " + rc); - - if (rc == ConnectionDroppedException.CONNECTION_DROPPED) - { - output_.writeInt(MEException.CONNECTION_DROPPED); - output_.writeUTF( e.getMessage() ); - } - else - { - output_.writeInt(MEException.UNKNOWN); - output_.writeUTF( e.getMessage() ); - } - } - else if (e instanceof IllegalObjectTypeException) - { - output_.writeInt(MEException.ILLEGAL_OBJECT_TYPE); - output_.writeUTF( e.getMessage() ); - } - else if (e instanceof ServerStartupException) - { - int rc = ((ServerStartupException) e).getReturnCode(); - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, "Exception return code: " + rc); - - if ( rc == ServerStartupException.SERVER_NOT_STARTED) - { - output_.writeInt(MEException.SERVER_NOT_STARTED); - output_.writeUTF( e.getMessage() ); - } - else - { - output_.writeInt(MEException.UNKNOWN); - output_.writeUTF( e.getMessage() ); - } - } - else if (e instanceof UnknownHostException) - { - output_.writeInt(MEException.UNKNOWN_HOST); - output_.writeUTF( e.toString() ); - } - else if (e instanceof IOException) - { - output_.writeInt(MEException.UNKNOWN); - output_.writeUTF( e.toString() ); - } - else - { - output_.writeInt(MEException.UNKNOWN); - output_.writeUTF( e.getMessage() ); - } - - output_.flush(); - } - - - /** - * Prints the application usage information. - * - * @param out The print stream for usage information. - **/ - static void usage (PrintStream out) - { - final String usage = ResourceBundleLoader_m.getText("ME_SERVER_USAGE"); - final String optionslc = ResourceBundleLoader_m.getText("ME_SERVER_OPTIONSLC"); - final String optionsuc = ResourceBundleLoader_m.getText("ME_SERVER_OPTIONSUC"); - final String shortcuts = ResourceBundleLoader_m.getText("ME_SERVER_SHORTCUTS"); - - out.println (usage + ":"); - out.println (); - out.println (" com.ibm.as400.access.MEServer [ " + optionslc + " ]"); - out.println (); - out.println (optionsuc + ":"); - out.println (); - out.println (" -pcml [pcml doc]"); - out.println (" -port port"); - out.println (" -verbose [true | false]"); - out.println (" -help"); - out.println (); - out.println (shortcuts + ":"); - out.println (" -v [true | false]"); - out.println (" -pc pcml doc1 [;pcml doc2;...]"); - out.println (" -po port"); - out.println (" -h"); - out.println (" -?"); - } -} diff --git a/cvsroot/src/com/ibm/as400/micro/MicroDataInputStream.java b/cvsroot/src/com/ibm/as400/micro/MicroDataInputStream.java deleted file mode 100644 index 125dc0eab..000000000 --- a/cvsroot/src/com/ibm/as400/micro/MicroDataInputStream.java +++ /dev/null @@ -1,188 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MicroDataInputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.io.*; -import com.ibm.as400.access.Trace; - -/** -This class allows the DataInputStream used for client/server -communication to be optionally traced. -**/ -class MicroDataInputStream -{ - DataInputStream in_; - - /** - Constructor. - **/ - public MicroDataInputStream(InputStream in) throws IOException - { - in_ = new DataInputStream(in); - } - - - /** - Read a boolean from the underlying DataInputStream. Optionally trace - the value. - **/ - public boolean readBoolean() throws IOException - { - boolean b = in_.readBoolean(); - - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, Thread.currentThread().getName() + " in > " + b); - - return b; - } - - - /** - Read a byte from the underlying DataInputStream. Optionally trace - the value. - **/ - public byte readByte() throws IOException - { - byte b = in_.readByte(); - - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, Thread.currentThread().getName() + " in > " + b); - - return b; - } - - - /** - Read a byte array from the underlying DataInputStream, storing it into the - object that is passed in. Optionally trace the value. - **/ - public void readBytes(byte[] b) throws IOException - { - in_.readFully(b); - - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, " " + Thread.currentThread().getName() + " in > ", b); - } - - - /** - Read a double from the underlying DataInputStream. Optionally trace - the value. - **/ - public double readDouble() throws IOException - { - double d = in_.readDouble(); - - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, Thread.currentThread().getName() + " in > " + d); - - return d; - } - - - /** - Read a float from the underlying DataInputStream. Optionally trace - the value. - **/ - public float readFloat() throws IOException - { - float f = in_.readFloat(); - - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, Thread.currentThread().getName() + " in > " + f); - - return f; - } - - - /** - Read an int from the underlying DataInputStream. Optionally trace - the value. - **/ - public int readInt() throws IOException - { - int i = in_.readInt(); - - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, Thread.currentThread().getName() + " in > " + Integer.toHexString(i)); - - return i; - } - - - /** - Read a long from the underlying DataInputStream. Optionally trace - the value. - **/ - public long readLong() throws IOException - { - long l = in_.readLong(); - - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, Thread.currentThread().getName() + " in > " + l); - - return l; - } - - - /** - Read a short from the underlying DataInputStream. Optionally trace - the value. - **/ - public short readShort() throws IOException - { - short s = in_.readShort(); - - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, Thread.currentThread().getName() + " in > " + s); - - return s; - } - - - /** - Convenience method... the fact that a string gets put into UTF format is - just an implementation detail. - **/ - public String readString() throws IOException - { - return readUTF(); - } - - - /** - Read a String from the underlying DataInputStream. Optionally trace - the value. - **/ - public String readUTF() throws IOException - { - String s = in_.readUTF(); - - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, Thread.currentThread().getName() + " in > " + s); - - return s; - } - - - /** - May be needed someday to allow us to skip over optional information - returned in the stream. - @return The actual number of bytes skipped. - **/ - public int skipBytes(int count) throws IOException - { - return in_.skipBytes(count); - } -} diff --git a/cvsroot/src/com/ibm/as400/micro/MicroDataOutputStream.java b/cvsroot/src/com/ibm/as400/micro/MicroDataOutputStream.java deleted file mode 100644 index e21e96c7f..000000000 --- a/cvsroot/src/com/ibm/as400/micro/MicroDataOutputStream.java +++ /dev/null @@ -1,173 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MicroDataOutputStream.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.io.*; -import com.ibm.as400.access.Trace; - - -/** -This class allows the DataOutputStream used for client/server -communication to be optionally traced. -**/ -class MicroDataOutputStream -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - DataOutputStream out_; - - /** - Constructor. - **/ - public MicroDataOutputStream(OutputStream out) throws IOException - { - out_ = new DataOutputStream(out); - } - - - /** - Flush the underlying DataOutputStream. - **/ - public void flush() throws IOException - { - out_.flush(); - } - - - /** - Write a boolean to the underlying DataOutputStream. Optionally trace - the value. - **/ - public void writeBoolean(boolean b) throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, Thread.currentThread().getName() + " out < " + b); - - out_.writeBoolean(b); - } - - - /** - Write a byte to the underlying DataOutputStream. Optionally trace - the value. - **/ - public void writeByte(byte b) throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, Thread.currentThread().getName() + " out < " + b); - - out_.writeByte(b); - } - - - /** - Write an array of bytes to the underlying DataOutputStream. Optionally trace - the value. - **/ - public void writeBytes(byte[] b) throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, " " + Thread.currentThread().getName() + " out < ", b); - - out_.write(b, 0, b.length); - } - - - /** - Write a double to the underlying DataOutputStream. Optionally trace - the value. - **/ - public void writeDouble(double d) throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, Thread.currentThread().getName() + " out < " + d); - - out_.writeDouble(d); - } - - - /** - Write a float to the underlying DataOutputStream. Optionally trace - the value. - **/ - public void writeFloat(float f) throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, Thread.currentThread().getName() + " out < " + f); - - out_.writeFloat(f); - } - - - /** - Write an int to the underlying DataOutputStream. Optionally trace - the value. - **/ - public void writeInt(int i) throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, Thread.currentThread().getName() + " out < " + Integer.toHexString(i)); - - out_.writeInt(i); - } - - - /** - Write a long to the underlying DataOutputStream. Optionally trace - the value. - **/ - public void writeLong(long l) throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, Thread.currentThread().getName() + " out < " + l); - - out_.writeLong(l); - } - - - /** - Write a short to the underlying DataOutputStream. Optionally trace - the value. - **/ - public void writeShort(short s) throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, Thread.currentThread().getName() + " out < " + s); - - out_.writeShort(s); - } - - - /** - Convenience method... the fact that a string gets put into UTF format is - just an implementation detail. - **/ - public void writeString(String s) throws IOException - { - writeUTF(s); - } - - - /** - Write a String to the underlying DataOutputStream. Optionally trace - the value. - **/ - public void writeUTF(String s) throws IOException - { - if (Trace.isTraceOn()) - Trace.log(Trace.PROXY, Thread.currentThread().getName() + " out < " + s); - - out_.writeUTF(s); - } -} diff --git a/cvsroot/src/com/ibm/as400/micro/ResourceBundleLoader_m.java b/cvsroot/src/com/ibm/as400/micro/ResourceBundleLoader_m.java deleted file mode 100644 index 424c647c4..000000000 --- a/cvsroot/src/com/ibm/as400/micro/ResourceBundleLoader_m.java +++ /dev/null @@ -1,114 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceBundleLoader_m.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - A class representing the ResourceBundleLoader_m object which - is used to load the resource bundle. -**/ -class ResourceBundleLoader_m -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - private static MissingResourceException resourceException_; - - private static ResourceBundle resources_; - - - - static - { - try - { - resources_ = ResourceBundle.getBundle("com.ibm.as400.access.MRI2"); - } - catch (MissingResourceException e) - { - // Save the exception and rethrow it later. This is because exceptions - // thrown from static initializers are hard to debug. - resourceException_ = e; - } - - } - - - /** - * Returns the text associated with the exception. - * - * @param textId the id which identifies the message text to return. - * @return the translatable text which describes the exception. - **/ - static final String getText (String textId) - { - if (resources_ == null) - throw resourceException_; - return resources_.getString(textId); - } - - /** - * Returns the text associated with an MRI key, with subsitution variables. - * - * @param textId the id which identifies the message text to return. - * @param value The replacement value. - * @return The text string with the substitution variable replaced. - **/ - static String getText (String textId, Object value) - { - String text = getText (textId); - return substitute (text, new Object[] { value }); - } - - - /** - * Returns the text associated with an MRI key, with subsitution variables. - * - * @param textId the id which identifies the message text to return. - * @param value0 The first replacement value. - * @param value1 The second replacement value. - * @return The text string with the substitution variable replaced. - **/ - static String getText (String textId, Object value0, Object value1) - { - String text = getText (textId); - return substitute (text, new Object[] { value0, value1 }); - } - - - /** - * Replaces substitution variables in a string. - * - * @param text The text string, with substitution variables (e.g. "Error &0 in table &1.") - * @param values The replacement values. - * @return The text string with all substitution variables replaced. - **/ - static String substitute (String text, Object[] values) - { - String result = text; - for (int i = 0; i < values.length; ++i) { - String variable = "&" + i; - int j = result.indexOf (variable); - if (j >= 0) { - StringBuffer buffer = new StringBuffer(); - buffer.append(result.substring(0, j)); - buffer.append(values[i].toString ()); - buffer.append(result.substring(j + variable.length ())); - result = buffer.toString (); - } - } - return result; - } -} diff --git a/cvsroot/src/com/ibm/as400/micro/ResultSetHandler.java b/cvsroot/src/com/ibm/as400/micro/ResultSetHandler.java deleted file mode 100644 index 91d1c18f2..000000000 --- a/cvsroot/src/com/ibm/as400/micro/ResultSetHandler.java +++ /dev/null @@ -1,797 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResultSetHandler.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.io.*; -import java.net.*; -import java.sql.*; -import java.util.*; - -/** - * The ResultSetHandler class is designed to handle all interactions - * needed by the JDBC-ME driver with the JDBC ResultSet interface. - **/ -class ResultSetHandler -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - JdbcMeService service_; - MicroDataInputStream in_; - MicroDataOutputStream out_; - - - /** - Constructor. Creates a new JDBC-ME handler for ResultSet - objects. - **/ - public ResultSetHandler(JdbcMeService jdbcme, MicroDataInputStream in, MicroDataOutputStream out) - { - service_ = jdbcme; - in_ = in; - out_ = out; - } - - - /** - The process function routes the function id and the ResultSet - to the proper handler. - **/ - public void process(ResultSet rs, int funcId) throws IOException - { - switch (funcId) - { - case MEConstants.RS_CLOSE: - close(rs); - break; - case MEConstants.RS_DELETE_ROW: - deleteRow(rs); - break; - case MEConstants.RS_INSERT_ROW: - insertRow(rs); - break; - case MEConstants.RS_NEXT: - next(rs); - break; - case MEConstants.RS_PREVIOUS: - previous(rs); - break; - case MEConstants.RS_UPDATE_ROW: - updateRow(rs); - break; - // TODO: from here down... - // returns data - case MEConstants.RS_ABSOLUTE: - absolute(rs); - break; - // true/false - case MEConstants.RS_AFTER_LAST: - afterLast(rs); - break; - // true/false - case MEConstants.RS_BEFORE_FIRST: - beforeFirst(rs); - break; - // returns data - case MEConstants.RS_FIRST: - first(rs); - break; - // true/false - case MEConstants.RS_IS_AFTER_LAST: - isAfterLast(rs); - break; - // true/false - case MEConstants.RS_IS_BEFORE_FIRST: - isBeforeFirst(rs); - break; - // true/false - case MEConstants.RS_IS_FIRST: - isFirst(rs); - break; - // true/false - case MEConstants.RS_IS_LAST: - isLast(rs); - break; - // returns data - case MEConstants.RS_LAST: - last(rs); - break; - // returns data - case MEConstants.RS_RELATIVE: - relative(rs); - break; - default: - // TODO: This is an exception condition... - System.out.println("Error - ResultSet Function ID not recognized - function code: " + funcId); - break; - } - } - - - - /** - Closes the ResultSet object. Unlike most of the methods of this class, - if an exception occurs while closing the ResultSet, this method - will not report it back to the caller in any way. It is simply - swollowed and a message is logged concerning the failure. -

      - The data flow is as follows: - - - nothing more - - - nothing more -

      - - @param rs The ResultSet object to close. - **/ - public void close(ResultSet rs) throws IOException - { - try - { - rs.close(); - } - catch (SQLException e) - { - System.out.println("Exception caught trying to close ResultSet object " + rs); - e.printStackTrace(); - } - try - { - // Try this seperately... - service_.removeResultSet(rs); // DOMINO - } - catch (SQLException e) - { - System.out.println("Exception caught trying to remove ResultSet " + - "object from tracking"); - e.printStackTrace(); - } - } - - - - /** - Deletes the current row from the ResultSet object. -

      - The data flow is as follows: - - - nothing more - - int - whether or not the delete was successful. - 1 - the function worked. - -1 - an exception occurred (see exception handling for details) -

      - - @param rs The ResultSet object to use. - **/ - public void deleteRow(ResultSet rs) throws IOException - { - try - { - rs.deleteRow(); - out_.writeInt(1); // Today, we will always say we worked today. - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - - /** - Inserts a new row into the table the ResultSet is for. -

      - The data flow is as follows: - - - a value for all of the columns in the table. - - int - whether or not the insert was successful. - 1 - the function worked. - -1 - an exception occurred (see exception handling for details) -

      - - @param rs The ResultSet object to use. - **/ - public void insertRow(ResultSet rs) throws IOException - { - ResultSetMetaData rsmd = null; - int count; - - try - { - rs.moveToInsertRow(); - rsmd = rs.getMetaData(); - count = rsmd.getColumnCount(); - for (int i = 0; i < count; i++) - { - if (rsmd.getColumnType(i+1) == Types.INTEGER) - { - rs.updateInt(i+1, in_.readInt()); - } - else - { - rs.updateString(i+1, in_.readUTF()); - } - } - // Update the row. - rs.insertRow(); - out_.writeInt(1); // Today we will always say this worked today. - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - - /** - Fetches the next row from the database for the current ResultSet. -

      - The data flow is as follows: - - - nothing more - - int - whether or not the fetch was successful. - 1 - data was fetched and is in the stream - See the writeRow method for the layout of this section - of the data stream... - 0 - there was no more data to fetch - -1 - an exception occurred (see exception handling for details) -

      - - @param rs The ResultSet object to use. - **/ - public void next(ResultSet rs) throws IOException - { - try - { - if (rs.next()) - { - out_.writeInt(1); - - writeRow(rs); - } - else - out_.writeInt(0); - - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - - /** - Fetches the previous row from the database for the current ResultSet. -

      - The data flow is as follows: - - - nothing more - - int - whether or not the fetch was successful. - 1 - data was fetched and is in the stream - See the writeRow method for the layout of this section - of the data stream... - 0 - there was no more data to fetch - -1 - an exception occurred (see exception handling for details) -

      - - @param rs The ResultSet object to use. - **/ - public void previous(ResultSet rs) throws IOException - { - try - { - if (rs.previous()) - { - out_.writeInt(1); - - writeRow(rs); // output the current row. - } - else - out_.writeInt(0); - - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - - /** - Fetches the first row from the database for the current ResultSet. -

      - The data flow is as follows: - - - nothing more - - int - whether or not the fetch was successful. - 1 - data was fetched and is in the stream - See the writeRow method for the layout of this section - of the data stream... - 0 - there was no more data to fetch - -1 - an exception occurred (see exception handling for details) -

      - - @param rs The ResultSet object to use. - **/ - public void first(ResultSet rs) throws IOException - { - try - { - if (rs.first()) - { - out_.writeInt(1); - - writeRow(rs); - } - else - out_.writeInt(0); - - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - - /** - Fetches the last row from the database for the current ResultSet. -

      - The data flow is as follows: - - - nothing more - - int - whether or not the fetch was successful. - 1 - data was fetched and is in the stream - See the writeRow method for the layout of this section - of the data stream... - 0 - there was no more data to fetch - -1 - an exception occurred (see exception handling for details) -

      - - @param rs The ResultSet object to use. - **/ - public void last(ResultSet rs) throws IOException - { - try - { - if (rs.last()) - { - out_.writeInt(1); - - writeRow(rs); - } - else - out_.writeInt(0); - - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - - /** - Fetches a row relative to the current position in the result set. -

      - The data flow is as follows: - - int - the relative record number. - - int - whether or not the fetch was successful. - 1 - data was fetched and is in the stream - See the writeRow method for the layout of this section - of the data stream... - 0 - there was no more data to fetch - -1 - an exception occurred (see exception handling for details) -

      - - @param rs The ResultSet object to use. - **/ - public void relative(ResultSet rs) throws IOException - { - try - { - int value = in_.readInt(); - if (rs.relative(value)) - { - out_.writeInt(1); - - writeRow(rs); - } - else - out_.writeInt(0); - - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - - /** - Fetches a row relative to the begining of the result set. -

      - The data flow is as follows: - - int - the absolute record number. - - int - whether or not the fetch was successful. - 1 - data was fetched and is in the stream - See the writeRow method for the layout of this section - of the data stream... - 0 - there was no more data to fetch - -1 - an exception occurred (see exception handling for details) -

      - - @param rs The ResultSet object to use. - **/ - public void absolute(ResultSet rs) throws IOException - { - try - { - int value = in_.readInt(); - if (rs.absolute(value)) - { - out_.writeInt(1); - - writeRow(rs); - } - else - out_.writeInt(0); - - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - - /** - Positions the cursor before the first row in the ResultSet. This - basically allows you to 'start over' with the ResultSet. -

      - The data flow is as follows: - - none. - - int - whether or not the positioning was successful. - 1 - success - -1 - an exception occurred (see exception handling for details) -

      - - @param rs The ResultSet object to use. - **/ - public void beforeFirst(ResultSet rs) throws IOException - { - try - { - rs.beforeFirst(); - out_.writeInt(1); - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - - /** - Positions the cursor after the last row in the ResultSet. -

      - The data flow is as follows: - - none. - - int - whether or not the positioning was successful. - 1 - success - -1 - an exception occurred (see exception handling for details) -

      - - @param rs The ResultSet object to use. - **/ - public void afterLast(ResultSet rs) throws IOException - { - try - { - rs.afterLast(); - out_.writeInt(1); - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - - /** - Returns whether or not the cursor is after the last row - in the result set. -

      - The data flow is as follows: - - none - - int - whether or not the fetch was successful. - 1 - the cursor is after the last row in the result set. - 0 - the cursor is not after the last row in the result set. - -1 - an exception occurred (see exception handling for details) -

      - - @param rs The ResultSet object to use. - **/ - public void isAfterLast(ResultSet rs) throws IOException - { - try - { - if (rs.isAfterLast()) - out_.writeInt(1); - else - out_.writeInt(0); - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - - /** - Returns whether or not the cursor is before the first row - in the result set. -

      - The data flow is as follows: - - none - - int - whether or not the fetch was successful. - 1 - the cursor is before the first row in the result set. - 0 - the cursor is not before the first row in the result set. - -1 - an exception occurred (see exception handling for details) -

      - - @param rs The ResultSet object to use. - **/ - public void isBeforeFirst(ResultSet rs) throws IOException - { - try - { - if (rs.isBeforeFirst()) - out_.writeInt(1); - else - out_.writeInt(0); - - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - - /** - Returns whether or not the cursor is on the first row - in the result set. -

      - The data flow is as follows: - - none - - int - whether or not the fetch was successful. - 1 - the cursor is on the first row in the result set. - 0 - the cursor is not on the first row in the result set. - -1 - an exception occurred (see exception handling for details) -

      - - @param rs The ResultSet object to use. - **/ - public void isFirst(ResultSet rs) throws IOException - { - try - { - if (rs.isFirst()) - out_.writeInt(1); - else - out_.writeInt(0); - - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - - /** - Returns whether or not the cursor is on the last row - in the result set. -

      - The data flow is as follows: - - none - - int - whether or not the fetch was successful. - 1 - the cursor is on the last row in the result set. - 0 - the cursor is not on the last row in the result set. - -1 - an exception occurred (see exception handling for details) -

      - - @param rs The ResultSet object to use. - **/ - public void isLast(ResultSet rs) throws IOException - { - try - { - if (rs.isLast()) - out_.writeInt(1); - else - out_.writeInt(0); - - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - - /** - Updates the current row into the table the ResultSet is for. -

      - The data flow is as follows: - - - a value for all of the columns in the table. - - int - whether or not the update was successful. - 1 - the function worked. - -1 - an exception occurred (see exception handling for details) -

      - - @param rs The ResultSet object to use. - **/ - public void updateRow(ResultSet rs) throws IOException - { - ResultSetMetaData rsmd = null; - int count; - - try - { - // Just in case we are sitting around on the insert row... - // I am not sure if I can get away with such 'skimpy' logic - // here... there might be holes where we return the wrong thing. - rs.moveToCurrentRow(); - rsmd = rs.getMetaData(); - count = rsmd.getColumnCount(); - for (int i = 0; i < count; i++) - { - if (rsmd.getColumnType(i+1) == Types.INTEGER) - rs.updateInt(i+1, in_.readInt()); - else - rs.updateString(i+1, in_.readUTF()); - } - // Update the row. - rs.updateRow(); - out_.writeInt(1); // We will always say this worked today. - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } - - - - /** - Outputs the current row of the database. This method is going to return - data in this format: - - 1 if the column is null, 0 otherwise. - based on data types flag: - ALL: - - the data values for the columns - - null columns come back as 0 or empty strings in this list. - LIMITED: - - the data values for the columns (as all ints or strings). - - null columns come back as 0 or emtpy strings in this list. - STRING: - - the data values for the columns (as all strings). - - null columns come back as emtpy strings in this list. - **/ - protected void writeRow(ResultSet rs) throws IOException - { - ResultSetMetaData rsmd = null; - int count; - - try - { - rsmd = rs.getMetaData(); - count = rsmd.getColumnCount(); - - // Figure out the bitmap for null values. - // Note: The performance of this solution kinda sucks. - // We need to fetch all the data values into local - // storage and the build the bitmap followed by the - // return values. Fetching everything twice is not - // acceptable. - // BitMap bm = new BitMap(count); - // for (int i = 0; i < count; i++) { - // if (rs.getString(i + 1) == null) - // bm.set(i, true); - // } - // bm.write(out); - switch (service_.getDataFlowType()) - { - case MEConstants.DATA_FLOW_LIMITED: - for (int i = 0; i < count; i++) - { - if (rsmd.getColumnType(i + 1) == Types.INTEGER) - out_.writeInt(rs.getInt(i+1)); - else - out_.writeUTF(rs.getString(i+1)); - } - break; - case MEConstants.DATA_FLOW_STRINGS_ONLY: - System.out.println("DATA_FLOW_STRINGS_ONLY: This isn't implemented yet."); - break; - case MEConstants.DATA_FLOW_ALL: - System.out.println("DATA_FLOW_ALL: This isn't implemented yet."); - break; - default: - System.out.println("getDataFlowType(): Unknown data flow type - " + service_.getDataFlowType()); - break; - } - out_.flush(); - } - catch (SQLException e) - { - System.out.println("Everything is lost... there was an SQLException after the primary function was executed.... stream probably corrupted."); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/micro/Service.java b/cvsroot/src/com/ibm/as400/micro/Service.java deleted file mode 100644 index dd2da6851..000000000 --- a/cvsroot/src/com/ibm/as400/micro/Service.java +++ /dev/null @@ -1,40 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Service.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.util.Properties; -import java.io.IOException; - -/** -Interface to standardize the format of -services to provide from the MEServer. -**/ -interface Service -{ - /** - **/ - void setDataStreams(MicroDataInputStream in, MicroDataOutputStream out); - - /** - Given a function id, returns whether or not - this service knows how to handle the given function. - **/ - boolean acceptsRequest(int functionId); - - /** - Takes care of handling a given request, including - all needed stream input and output. - **/ - void handleRequest(int functionId) throws IOException; -} diff --git a/cvsroot/src/com/ibm/as400/micro/StatementHandler.java b/cvsroot/src/com/ibm/as400/micro/StatementHandler.java deleted file mode 100644 index f1466a477..000000000 --- a/cvsroot/src/com/ibm/as400/micro/StatementHandler.java +++ /dev/null @@ -1,167 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: StatementHandler.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.micro; - -import java.io.*; -import java.sql.*; -import java.util.*; - -/** -The StatementHandler class is designed to handle all interactions -needed by the JDBC-ME driver with the JDBC Statement interface. -**/ -class StatementHandler -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - private JdbcMeService service_; - private MicroDataInputStream in_; - private MicroDataOutputStream out_; - - - /** - Constructor. Creates a new JDBC-ME handler for Statement - objects. - **/ - public StatementHandler(JdbcMeService jdbcme, MicroDataInputStream in, MicroDataOutputStream out) - { - service_ = jdbcme; - in_ = in; - out_ = out; - } - - - /** - The process function routes the function id and the Statement - to the proper handler. - **/ - public void process(Statement statement, int funcId) throws IOException - { - switch (funcId) - { - case MEConstants.STMT_CLOSE: - close(statement); - break; - case MEConstants.STMT_EXECUTE: - execute(statement); - break; - default: - // TODO: This is an exception condition... - System.out.println("Error - Statement Function ID not recognized - function code: " + funcId); - break; - } - } - - - /** - Closes the Statement object. This function has the side effect - of closing any ResultSets that are open under it as well. - Unlike most of the methods of this class, if an exception occurs - while closing the Statement, this method will not report it back - to the caller in any way. It is simply swallowed and a message - is logged concerning the failure. -

      - The data flow is as follows: - - - nothing more - - - nothing more -

      - - @param connection The connection object to close. - **/ - public void close(Statement statement) throws IOException - { - try - { - statement.close(); - } - catch (SQLException e) - { - System.out.println("Exception caught trying to close Statement object " + statement); - e.printStackTrace(); - } - - // Remove it from the vector. - service_.removeStatement(statement); - } - - - /** - Executes an SQL Statement. This method is used to handle executing - both queries and updates. The client can determine what was executed - through the returned data stream. -

      - The data flow is as follows: - - String - the SQL statement that is to be executed. - - - whether or not there is a ResultSet. - 1: There is a ResultSet - The ResultSet object handle - The number of columns in the ResultSet - The data types of each of the columns in the ResultSet - // The sizes of the columns. We don't care about this yet. - - 0: There is no ResultSet - The update count for the executed SQL Statement. - -1: An exception occurred (see exception handling for details) -

      - - @param rs The ResultSet object to use. - **/ - public void execute(Statement statement) throws IOException - { - ResultSetMetaData rsmd; - int count; - - try - { - // Get the SQL statement. - String sql = in_.readUTF(); - boolean rsYes = statement.execute(sql); - if (rsYes) - { - // There is a result set - out_.writeInt(1); - ResultSet rs = statement.getResultSet(); - service_.addResultSet(statement, rs); // DOMINO - - // Put the object into our map. - int objectId = service_.mapObject(rs); - out_.writeInt(objectId); - - rsmd = rs.getMetaData(); - count = rsmd.getColumnCount(); - out_.writeInt(count); - for (int i = 0; i < count; i++) - { - out_.writeInt(rsmd.getColumnType(i+1)); - } - } - else - { - // No ResultSet - out_.writeInt(0); - // output the updateCount - out_.writeInt(statement.getUpdateCount()); - } - out_.flush(); - } - catch (SQLException e) - { - service_.handleException(e); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/micro/doc-files/JDBCProperties.html b/cvsroot/src/com/ibm/as400/micro/doc-files/JDBCProperties.html deleted file mode 100644 index f13301cb3..000000000 --- a/cvsroot/src/com/ibm/as400/micro/doc-files/JDBCProperties.html +++ /dev/null @@ -1,1059 +0,0 @@ - - - -IBM Toolbox for Java: JDBC properties - - - - -

      IBM Toolbox for Java JDBC properties

      - -

      Many properties can be specified when connecting to DB2 for IBM i using - JDBC. All properties are optional and can be specified either as part of the - URL or in a java.util.Properties object. If a property is set in both the URL - and a Properties object, the value in the URL will be used.

      - -

      Note: The following list does not include DataSource properties.

      - -

      The following tables list the different connection -properties that are recognized by this driver. Some of these -properties affect performance and others are server job -attributes. The tables organize the properties into the following categories:

      - - - - -

      General properties

      - -

      General properties are system attributes that specify the user, password, and - whether a prompt is necessary to connect to the system.

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      General propertyDescriptionRequiredChoicesDefault
      "password"Specifies the password for connecting to the system. If none is specified, - then the user will be prompted, unless the "prompt" property is - set to "false", in which case an attempt to connect will fail.nosystem password(user will be prompted)
      "prompt"Specifies whether the user should be prompted if a user name or password - is needed to connect to the system. If a connection can not be made without - prompting the user, and this property is set to "false", then - an attempt to connect will fail.no"true"
      - "false"
      "true"
      "user"Specifies the user name for connecting to the system. If none is specified, - then the user will be prompted, unless the "prompt" property is - set to "false", in which case an attempt to connect will fail.nosystem user(user will be prompted)
      - - -

      System properties

      -

      System properties specify attributes that govern transactions, libraries, and - databases.

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      System propertyDescriptionRequiredChoicesDefault
      "auto commit"Specifies whether auto-commit mode is the default connection - mode for new connections. Calling AS400JDBCConnection.setAutoCommit(boolean) - will override this property on a per-connection basis. Note that, in order - to use transaction isolation levels other than *NONE when using auto-commit - mode, the property "true autocommit" needs to be set to true.no"true"
      - "false"
      "true"
      "concurrent access resolution"Specifies whether "currently committed" access is used on the connection. A value of 1 - indicates that "currently committed" will be used. A value of 2 indicates that "wait for - outcome" will be used. A value of 3 indicates that "skip locks" will be used.no"1"
      - "2"
      - "3"
      (system default)
      "cursor hold" Specifies whether to hold the cursor across transactions. - If this property is set to "true", cursors are not closed when - a transaction is committed. All resources acquired during - the unit of work are held, but locks on specific rows and objects implicitly - acquired during the unit of work are released.no"true"
      - "false"
      "true"
      "cursor sensitivity"

      Specifies the cursor sensitivity to request from the database. The behavior depends on the resultSetType:

      -
        -
      • ResultSet.TYPE_FORWARD_ONLY or ResultSet.TYPE_SCROLL_SENSITIVE means that the value of this property controls what cursor sensitivity the Java program requests from the database.
      • -
      • ResultSet.TYPE_SCROLL_INSENSITIVE causes this property to be ignored.
      • -
      -
      no - "asensitive"
      - "sensitive"
      - "insensitive"
      "asensitive"
      "database - name" -

      Specifies the database to use for a connection to an independent auxiliary storage pool (ASP). - When you specify a database name, the name must exist in the relational - database directory on the system and correspond to either an independent ASP or the system - default database. The following criteria determine which - database is accessed:

      -
        -
      • When this property is used to specify a database which corresponds to an independent ASP, - the connection is made to the independent ASP. -
      • -
      • When this property is used to specify *SYSBAS as the database name, - the system default database is used.
      • -
      • When this property is omitted, the initial ASP group specified in the job description - for the user profile is used. When the job description - does not specify an initial ASP group, the system default database is used. -
      • -
      -
      noDatabase name "*SYSBAS"The initial ASP group specified in the job description - for the user profile. When the job description does not specify - an initial ASP group, the system default database is used.
      "decfloat rounding mode" -

      Specifies the rounding mode to use when working with decfloat data type. - Note, this property is ignored when connecting to systems running IBM i V5R4 and earlier. -

      no"half even"
      - "half up"
      - "down"
      - "ceiling"
      - "floor"
      - "half down"
      - "up"
      -
      "half even"
      "libraries" -

      Specifies one or more libraries that you want to add to or replace the - library list of the server job, and optionally sets the default SQL schema - (default library). Note that libraries cannot be longer than 10 characters in - length. You must use SET PATH sql if you have libraries longer than 10 characters. -

      Library list
      - The system uses specified libraries to resolve unqualified stored procedure - names, and stored procedures use them to resolve unqualified names. To - specify multiple libraries, use commas or spaces to separate individual - entries. You can use *LIBL as a placeholder for the current library list - of the server job: -

      When the first entry is *LIBL, the specified libraries are added to - the current library list of the server job When you do not use *LIBL, - the specified libraries replace the current library list of the server - job -

      Default SQL schema
      - The system uses the default SQL schema to resolve unqualified names in SQL - statements. For example, in the statement "SELECT * FROM MYTABLE", the - system looks only in the default SQL schema for MYTABLE. You can specify the - default SQL schema on the connection URL. When you do not specify the default - SQL schema on the connection URL, the following conditions apply, depending - on whether you use SQL Naming or System Naming. -

        -
      • SQL Naming
        - When you do not specify the default SQL schema on the connection URL: -
          -
        • The first entry (unless it is *LIBL) becomes the default SQL schema
        • -
        • When the first entry is *LIBL, the second entry becomes the default SQL - schema
        • -
        • When you do not set this property or when it contains only *LIBL, - the user profile becomes the default SQL schema
        • -
        -
      • -
      • System Naming
        - When you do not specify the default SQL schema on the connection URL: -
          -
        • No default SQL schema is set, and the system uses the specified libraries - to search for unqualified names
        • -
        • When you do not set this property or when it contains only *LIBL, - the system uses the current library list of the server job to search - for unqualified names
        • -
        -
      • -
      -
      noList of system libraries, separated by commas or spaces"*LIBL"
      "maximum precision"Specifies the maximum decimal precision the database should use.no "31"
      - "63"
      -
      "31"
      "maximum scale"Specifies the maximum scale the database should use.no "0"-"63"
      -
      "31"
      "minimum divide scale"Specifies the minimum scale value for the result of decimal division.no "0"
      - "1"
      - "2"
      - "3"
      - "4"
      - "5"
      - "6"
      - "7"
      - "8"
      - "9"
      -
      "0"
      "package ccsid"Specifies the character encoding to use for the SQL package and any statements sent to the system.no "1200" (UTF-16)
      - "13488" (UCS-2)
      - "system" (host CCSID)
      -
      "13488"
      "transaction isolation"Specifies the default transaction isolation.no "none"
      - "read uncommitted"
      - "read committed"
      - "repeatable read"
      - "serializable"
      "read uncommitted"
      "translate hex"Specifies how hexadecimal literals are interpreted.no "character" (Interpret hexadecimal literals as character data)
      - "binary" (Interpret hexadecimal literals as binary data)
      -
      "character"
      "true autocommit"Specifies whether the connection should use true auto commit support. - True autocommit means that autocommit is on and is running under a isolation level other - than *NONE. By default, the driver handles autocommit by running under the system isolation - level of *NONE. no "true" (Use true autocommit.)
      - "false" (Do not use true autocommit.)
      -
      "false"
      "XA loosely coupled support"Specifies whether lock sharing is allowed for loosely coupled transaction branches. - Note, this property is ignored when connecting to systems running to IBM i V5R3 and earlier. - This option can be set to 0 to indicate to not share locks or 1 to share locks. no "0" (Do not share locks.)
      - "1" (Share locks.)
      -
      "0"
      - - -

      Format properties

      -

      Format properties specify date and time formats, date and decimal separators, - and table naming conventions used within SQL statements.

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Format propertyDescriptionRequiredChoicesDefault
      "date format"Specifies the date format used in date literals within SQL statements.no "mdy"
      - "dmy"
      - "ymd"
      - "usa"
      - "iso"
      - "eur"
      - "jis"
      - "julian"
      (server job)
      "date separator"Specifies the date separator used in date literals within SQL statements. - This property has no effect unless the "date format" property - is set to "julian", "mdy", "dmy" or "ymd".no "/" (slash)
      - "-" (dash)
      - "." (period)
      - "," (comma)
      - "b" (space)
      (server job)
      "decimal separator"Specifies the decimal separator used in numeric literals within SQL statements.no "." (period)
      - "," (comma)
      (server job)
      "naming"Specifies the naming convention used when referring to tables.no "sql" (as in schema.table)
      - "system" (as in schema/table)
      "sql"
      "time format"Specifies the time format used in time literals within SQL statements.no "hms"
      - "usa"
      - "iso"
      - "eur"
      - "jis"
      (server job)
      "time separator"Specifies the time separator used in time literals within SQL statements. - This property has no effect unless the "time format" property - is set to "hms".no ":" (colon)
      - "." (period)
      - "," (comma)
      - "b" (space)
      (server job)
      - - -

      Performance properties

      -

      Performance properties are attributes that include caching, data conversion, - data compression, and prefetching that affect performance.

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Performance propertyDescriptionRequiredChoicesDefault
      "big decimal"Specifies whether an intermediate java.math.BigDecimal object - is used for packed and zoned decimal conversions. If this property is set - to "true", an intermediate java.math.BigDecimal object is used - for packed and zoned decimal conversions as described by the JDBC specification. - If this property is set to "false", no intermediate objects are - used for packed and zoned decimal conversions. Instead, such values are - converted directly to and from Java double values. Such conversions will - be faster but may not follow all conversion and data truncation rules documented - by the JDBC specification.no"true"
      - "false"
      "true"
      "block criteria"Specifies the criteria for retrieving data from the system - in blocks of records. Specifying a non-zero value for this property will - reduce the frequency of communication to the system, and therefore increase - performance. -

      Ensure that record blocking is off if the cursor is going to be used - for subsequent UPDATEs, or else the row that is updated will not necessarily - be the current row. -

      no "0" (no record blocking)
      - "1" (block if FOR FETCH ONLY is specified)
      - "2" (block unless FOR UPDATE is specified)
      "2"
      "block size"Specifies the block size (in kilobytes) to retrieve from - the system and cache on the client. This property has no effect unless the - "block criteria" property is non-zero. Larger block sizes reduce - the frequency of communication to the system, and therefore may increase - performance.no "0"
      - "8"
      - "16"
      - "32"
      - "64"
      - "128"
      - "256"
      - "512"
      "32"
      "data compression"Specifies whether result set data is compressed. If this - property is set to "true", then result set data is compressed. - If this property is set to "false", then result set data is not - compressed. Data compression may improve performance when retrieving large - result sets.no"true"
      - "false"
      "true"
      "extended dynamic"Specifies whether to use extended dynamic support. Extended - dynamic support provides a mechanism for caching dynamic SQL statements - on the system. The - first time a particular SQL statement is prepared, it is stored in a SQL - package on the system. If the package does not exist, it is automatically - created. On subsequent prepares of the same SQL statement, the system can - skip a significant part of the processing by using information stored in - the SQL package. - If this is set to "true", then a package name must be set using - the "package" property.no"true"
      - "false"
      "false"
      "lazy close"Specifies whether to delay closing cursors until subsequent - requests. This will increase overall performance by reducing the total number - of requests.no"true"
      - "false"
      "false"
      "lob threshold"Specifies the maximum LOB (large object) size (in bytes) - that can be retrieved as part of a result set. LOBs that are larger than - this threshold will be retrieved in pieces using extra communication to - the system. Larger LOB thresholds will reduce the frequency of communication - to the system, but will download more LOB data, even if it is not used. - Smaller LOB thresholds may increase frequency of communication to the system, - but will only download LOB data as it is needed.no"0" - "16777216""32768"
      "package"Specifies the base name of the SQL package. Note - that only the first seven characters are used to generate the name of the - SQL package on the system. - This property has no effect unless the "extended dynamic" property - is set to "true". In addition, this property must be set if the - "extended dynamic" property is set to "true".noSQL package""
      "package add"Specifies - whether to add newly prepared statements to the SQL package specified on - the "package" property. This property has no effect unless the - "extended dynamic" property is set to "true".no"true"
      - "false"
      "true"
      "package cache"Specifies - whether to cache a subset of the SQL package information in client memory. - Caching SQL packages locally reduces the amount of communication to the - system for prepares and describes. This property has no effect unless the - "extended dynamic" property is set to "true".no"true"
      - "false"
      "false"
      "package criteria"Specifies the type of SQL statements to be stored in the - SQL package. This can be useful to improve the performance of complex join - conditions. This property has no effect unless the "extended dynamic" - property is set to "true".no"default" (only store SQL statements with parameter - markers in the package)
      - "select" - (store all SQL SELECT statements in the package)
      "default"
      "package error"Specifies the action to take when SQL package errors occur. - When a SQL package error occurs, the driver will optionally throw a SQLException - or post a warning to the Connection, based on the value of this property. - This property has no effect unless the "extended dynamic" property - is set to "true".no "exception"
      - "warning"
      - "none"
      "warning"
      "package library"Specifies the library for the SQL package. This property - has no effect unless the "extended dynamic" property is set to - "true".noLibrary for SQL package"QGPL"
      "prefetch"Specifies whether to prefetch data upon executing a SELECT - statement. This will increase performance when accessing the initial rows - in the ResultSet.no"true"
      - "false"
      "true"
      "qaqqinilib"Specifies a QAQQINI library name. Used to specify the library that contains the qaqqini file to use. A qaqqini file contains all of the attributes that can potentially impact the performance of the DB2 for IBM i database engine.no"QAQQINI library name"
      -
      (system default)
      "query optimize goal"Specifies the goal the system should use with optimization of queries. This setting corresponds with the system's QAQQINI option called OPTIMIZATION_GOAL. Note, this property is ignored when connecting to systems running to IBM i V5R3 and earlier.no"0" = Optimize query for first block of data (*ALLIO) when extended dynamic packages are used; Optimize query for entire result set (*FIRSTIO) when packages are not used
      - "1" = Optimize query for first block of data (*FIRSTIO)
      - "2" = Optimize query for entire result set (*ALLIO)
      "0"
      "query storage limit"Specifies the query storage limit to be used when statements in a connection are executed. - Valid values are -1 to 2147352578 megabytes. Note, this property is ignored when connecting to systems running IBM i V5R4 and earlier.
      - You must have *JOBCTL special authority to use query storage limit with Version 6 Release 1 of IBM i.
      no"-1 (no limit)" - "2147352578""-1"
      "receive buffer size"Specifies the buffer size used to receive data through the socket connection between the front-end driver and the IBM i system.
      NOTE: This does not specify the actual receive buffer size. It is only used as a hint by the underlying socket code.
      no"1" - max size(platform dependent)
      "send buffer size"Specifies the buffer size used to send data through the socket connection between the front-end driver and the IBM i system.
      NOTE: This does not specify the actual send buffer size. It is only used as a hint by the underlying socket code.
      no"1" - max size(platform dependent)
      "variable field compression"Specifies whether variable-length fields should be compressed.no"true"
      - "false"
      "true"
      - - -

      Sort properties

      -

      Sort properties specify how the system performs stores and performs sorts.

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Sort propertyDescriptionRequiredChoicesDefault
      "sort"Specifies how the system sorts records before sending them to the client.no "hex" (base the sort on hexadecimal values)
      - "language" (base the sort on the language set in the "sort - language" property)
      - "table" (base the sort on the sort sequence table set in - the "sort table" property)
      "hex"
      "sort language"Specifies a 3-character language id to use for selection of a sort sequence. - This property has no effect unless the "sort" property is set - to "language".noLanguage idENU
      "sort table"Specifies the library and file name of a sort sequence table stored on - the system. This property has no effect unless the "sort" property - is set to "table".noQualified sort table name""
      "sort weight"Specifies how the system treats case while sorting records. This property - has no effect unless the "sort" property is set to "language".no "shared" (uppercase and lowercase characters sort as - the same character)
      - "unique" (uppercase and lowercase characters sort as different - characters)
      "shared"
      - - -

      Other properties

      -

      Other properties are those properties not easily categorized. These properties - determine which JDBC driver is used, and specify options related to level of - database access, bidirectional string type, data truncation and so on.

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Other propertyDescriptionRequiredChoicesDefault
      "access"Specifies the level of database access for the connection.no "all" (all SQL statements allowed)
      - "read call" (SELECT and CALL statements allowed)
      - "read only" (SELECT statements only)
      "all"
      "autocommit exception"Specifies whether to throw an SQLException when Connection.commit() or Connection.rollback() is called if autocommit is enabled.no -

      "true"
      - "false"

      -
      "false"
      "bidi string type"Specifies the output string type of bidirectional data. See - BidiStringType - for more information.no -

      "4"
      - "5"
      - "6"
      - "7"
      - "8"
      - "9"
      - "10"
      - "11"

      -
      "5"
      "bidi implicit reordering"Specifies if bidi implicit LTR-RTL reordering should be used.no -

      "true"
      - "false"

      -
      "true"
      "bidi numeric ordering"Specifies if the numeric ordering round trip feature should be used.no -

      "true"
      - "false"

      -
      "false"
      "data truncation" -

      Specifies - whether truncation of character data generates warnings - and exceptions. When this property is "true", the following apply:

      -
        -
      • Writing truncated character data to the database throws an exception
      • -
      • Using truncated character data in a query posts a warning.
      • -
      -

      When this property is "false", writing truncated data to the database - or using such data in a query generates no exception or warning.

      -

      The default value is "true".

      -

      This property does not affect numeric data. Writing - truncated numeric data to the database always throws an error and using - truncated numeric data in a query always posts a warning. -

      -
      no"true"
      - "false"
      "true"
      "driver"Specifies the JDBC driver implementation. The IBM Toolbox - for Java JDBC driver can use different JDBC driver implementations based - on the environment. If the environment is an IBM i JVM on the same system - as the database to which the program is connecting, the native IBM Developer - Kit for Java JDBC driver can be used. In any other environment, the IBM - Toolbox for Java JDBC driver is used. This property has no effect if the - "secondary URL" property is set. no"toolbox" (use only the IBM Toolbox for Java JDBC - driver).
      - "native" (use the IBM Developer Kit for Java JDBC driver if running - on the system, otherwise use the Toolbox for Java JDBC driver).
      "toolbox"
      "errors"Specifies the amount of detail to be returned in the message - for errors that occur on the system.no "basic"
      - "full"
      "basic"
      "extended - metadata"Specifies whether the driver should request extended metadata - from the system. Setting this property to true increases the accuracy of - the information returned from the following ResultSetMetaData methods: -
        -
      • getColumnLabel(int)
      • -
      • isReadOnly(int)
      • -
      • isSearchable(int)
      • -
      • isWriteable(int)
      • -
      -

      Additionally, setting this property to true enables support for the ResultSetMetaData.getSchemaName(int) - and ResultSetMetaData.isAutoIncrement(int) methods. Setting this property to true may slow performance because it requires retrieving more information - from the system. Leave the property as the default (false) unless you need more specific information from - the listed methods. For example, when this property is off (false), ResultSetMetaData.isSearchable(int) - always returns "true" because because the driver does not have enough information - from the system to make a judgment. Turning on this property (true) forces - the driver to get the correct data from the system.

      -
      no"true"
      "false"
      "false"
      "full open"Specifies whether the system fully opens a file for each - query. By default the system optimizes open requests. This optimization - improves performance but may fail if a database monitor is active when a - query is run more than once. Set the property to true only when identical - queries are issued when monitors are active.no"true"
      - "false"
      "false"
      "hold input locators"Specifies whether input locators should be allocated as type hold locators or not hold locators. If the - locators are of type hold, they will not be released when a commit is done.no"true" (type hold)
      - "false"
      "true"
      "hold statements"Specifies if statements should remain open until a transaction boundary when - autocommit is off and they are associated with a LOB locator. By default, all the resources - associated with a statement are released when the statement is closed. Set this property to true - only when access to a LOB locator is needed after a statement has been closed.no"true"
      - "false"
      "false"
      "ignore warnings"Specifies a list of SQL states for which the driver should not create warning objects. - By default, the Toolbox JDBC driver will internally create a java.sql.SQLWarning - object for each warning returned by the database. For example, a warning with - the SQLSTATE 0100C is created every time a result set is returned from a stored procedure. This - warning can be safely ignored to improve the performance of applications that call stored procedures.noA comma separated list of SQL states that should be ignored""
      "keep alive"Specifies whether socket connection is to be periodically checked for operational status.no"true"
      - "false"
      (platform dependent)
      "key ring name"Specifies the key ring class name used for SSL connections - with the system. This property has no effect unless "secure" is - set to true and a key ring password is set using the "key ring password" - property.no"key ring name"""
      "key ring password"Specifies the password for the key ring class used for SSL - communications with the system. This property has no effect unless "secure" - is set to true and a key ring name is set using the "key ring name" - property.no"key ring password"""
      "metadata source"Specifies how to retrieve DatabaseMetaData. If set to "0", database metadata - will be retrieved through the ROI (Retrieve Object Information) data flow. If set to - "1", database metadata will be retrieved by calling system stored procedures.no"0" (ROI access)
      - "1" (SQL stored procedures)
      "0" (V6R1 and earlier) "1" (post V6R1)
      "proxy server"Specifies the host name and port of the middle-tier machine - where the proxy server is running. The format for this is hostname[:port], - where the port is optional. If this is not set, then the hostname and port - are retrieved from the com.ibm.as400.access.AS400.proxyServer property. - The default port is 3470 (if the connection uses SSL, the default - port is 3471). The ProxyServer must be running on the middle-tier - machine. -

      The name of the middle-tier machine is ignored in a two-tier environment.

      -
      noProxy server host name and port(value of the proxyServer property, or none if not set)
      "remarks"Specifies the source of the text for REMARKS columns in ResultSets - returned by DatabaseMetaData methods.no "sql" (SQL object comment)
      - "system" (IBM i object description)
      "system"
      "secondary URL"Specifies the URL to be used for a connection on the middle-tier's - DriverManager in a multiple tier environment, if it is different than already - specified. This property allows you to use this driver to connect to databases - other than DB2 for IBM i. Use a backslash as an escape character - before backslashes and semicolons in the URL.noJDBC URL(current JDBC URL)
      "secure"Specifies whether a Secure Sockets Layer (SSL) connection - is used to communicate with the system.no "true" (encrypt all client/server communication)
      - "false" (encrypt only the password)
      "false"
      "server - trace"Specifies the level of tracing of the JDBC server job. When - tracing is enabled, tracing starts when the client connects to the system - and ends when the connection is disconnected. You must start tracing before - connecting to the system, because the client enables system tracing only - at connect time. no -

      "0" (trace is not active)
      - "2" (start the database monitor on the JDBC server job)
      - "4" (start debug on the JDBC server job)
      - "8" (save the job log when the JDBC server job ends)
      - "16" (start job trace on the JDBC server job)
      - "32" (save SQL information)
      - "64" (start the database host server trace)

      -

      Multiple types of trace can be started by adding these values together. - For example, "6" starts the database monitor and starts debug. -

      -
      "0"
      "thread used"Specifies whether threads should be used in communication - with the host servers.no"true"
      - "false"
      "true"
      "toolbox trace"Specifies what category of a toolbox trace to log. Trace - messages are useful for debugging programs that call JDBC. However, there - is a performance penalty associated with logging trace messages, so this - property should only be set for debugging. Trace messages - are logged to System.out.no""
      - "none"
      - "datastream" (log data flow between the local host and the remote system)
      - "diagnostic" (log object state information)
      - "error" (log errors that cause an exception)
      - "information" (used to track the flow of control through the code)
      - "warning" (log errors that are recoverable)
      - "conversion" (log character set conversions between Unicode and native code pages)
      - "proxy" (log data flow between the client and the proxy server)
      - "pcml" (used to determine how PCML interprets the data that is sent to and from the system)
      - "jdbc" (log jdbc information)
      - "all" (log all categories)
      - "thread" (log thread information)
      -
      ""
      "trace"Specifies whether trace messages should be logged. Trace - messages are useful for debugging programs that call JDBC. However, there - is a performance penalty associated with logging trace messages, so this - property should only be set to "true" for debugging. Trace messages - are logged to System.out.no"true"
      - "false"
      "false"
      "translate binary"Specifies whether binary data is translated. If this property - is set to "true", then BINARY and VARBINARY fields are treated - as CHAR and VARCHAR fields.no"true"
      - "false"
      "false"
      "translate boolean"Specifies how Boolean objects are interpreted when setting the value - for a character field/parameter using the PreparedStatement.setObject(), - CallableStatement.setObject() or ResultSet.updateObject() methods. Setting the - property to "true", would store the Boolean object in the character field as either - "true" or "false". Setting the property to "false", would store the Boolean object - in the character field as either "1" or "0".no"true"
      - "false"
      "true"
      - - - diff --git a/cvsroot/src/com/ibm/as400/resource/AbstractValueMap.java b/cvsroot/src/com/ibm/as400/resource/AbstractValueMap.java deleted file mode 100644 index a30963ddf..000000000 --- a/cvsroot/src/com/ibm/as400/resource/AbstractValueMap.java +++ /dev/null @@ -1,95 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AbstractValueMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.Trace; -import java.io.Serializable; - - - -/** -The AbstractValueMap class is a default implementation for a ValueMap. -This is useful if an implementation only needs to provide a single -method. - -

      This class is intended as a helper class for implementing subclasses -of {@link com.ibm.as400.resource.Resource Resource}. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public abstract class AbstractValueMap -implements ValueMap, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - -/** -Maps from a logical value to a physical value. - -@param logicalValue The logical value. -@param system The system. -@return The physical value. -**/ - public Object ltop(Object logicalValue, AS400 system) - { - return ltop(logicalValue); - } - - - -/** -Maps from a logical value to a physical value. - -@param logicalValue The logical value. -@return The physical value. -**/ - public Object ltop(Object logicalValue) - { - return logicalValue; - } - - - -/** -Maps from a physical value to a logical value. - -@param physicalValue The physical value. -@param system The system. -@return The logical value. -**/ - public Object ptol(Object physicalValue, AS400 system) - { - return ptol(physicalValue); - } - - -/** -Maps from a physical value to a logical value. - -@param physicalValue The physical value. -@return The logical value. -**/ - public Object ptol(Object physicalValue) - { - return physicalValue; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ActiveStatusEvent.java b/cvsroot/src/com/ibm/as400/resource/ActiveStatusEvent.java deleted file mode 100644 index 98ac2dcb5..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ActiveStatusEvent.java +++ /dev/null @@ -1,104 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ActiveStatusEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.util.EventObject; - - - -/** -The ActiveStatusEvent class represents an active status event. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class ActiveStatusEvent -extends EventObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private int eventID_ = -1; - - - -/** -Event ID indicating that the active status is busy. This indicates -that a potentially long-running operation has started. -**/ - public static final int BUSY = 1; - - - -/** -Event ID indicating that the active status is idle. This indicates -that a potentially long-running operation has ended. -**/ - public static final int IDLE = 2; - - - - private static final int FIRST_EVENT_ID_ = BUSY; - private static final int LAST_EVENT_ID_ = IDLE; - - - -/** -Constructs a ActiveStatusEvent object. - -@param source The source. -@param eventID The event ID. -**/ - public ActiveStatusEvent(Object source, int eventID) - { - super(source); - validateEventID(eventID); - eventID_ = eventID; - } - - - -/** -Returns the event ID. - -@return The event ID. -**/ - public int getID() - { - return eventID_; - } - - - -/** -Validates the event ID. - -@param eventID The event ID. -**/ - private void validateEventID(int eventID) - { - if ((eventID < FIRST_EVENT_ID_) || (eventID > LAST_EVENT_ID_)) - throw new ExtendedIllegalArgumentException("eventID", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ActiveStatusListener.java b/cvsroot/src/com/ibm/as400/resource/ActiveStatusListener.java deleted file mode 100644 index 24f189e44..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ActiveStatusListener.java +++ /dev/null @@ -1,49 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ActiveStatusListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import java.util.EventListener; - - - -/** -The ActiveStatusListener represents a listener for ActiveStatusEvents. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public interface ActiveStatusListener -extends EventListener -{ - - -/** -Invoked when the active status changes to busy. This indicates -that a potentially long-running operation has started. - -@param event The event. -**/ - public abstract void busy(ActiveStatusEvent event); - - - -/** -Invoked when the active status changes to idle. This indicates -that a potentially long-running operation has ended. - -@param event The event. -**/ - public abstract void idle(ActiveStatusEvent event); - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ArrayResourceList.java b/cvsroot/src/com/ibm/as400/resource/ArrayResourceList.java deleted file mode 100644 index 5d4eb4ba2..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ArrayResourceList.java +++ /dev/null @@ -1,111 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ArrayResourceList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - - - -/** -The ArrayResourceList class represents a subclass -of the {@link com.ibm.as400.resource.ResourceList ResourceList} -class which manages a list of resources predefined as an array -of {@link com.ibm.as400.resource.Resource Resource} objects. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class ArrayResourceList -extends ResourceList -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - // Private data. - private Resource[] resources_; - - - -/** -Constructs a ArrayResourceList object. - -@param resources The array of Resource objects. -@param presentation The presentation. -@param attributeMetaData The attribute meta data, or null if not applicable. -**/ - public ArrayResourceList(Resource[] resources, - Presentation presentation, - ResourceMetaData[] attributeMetaData) - { - super(presentation, attributeMetaData, null, null); - setArray(resources); - } - - - - -/** -Opens the list. The list must be open in order to -perform most operations. This method has no effect -if the list is already opened. - -@exception ResourceException If an error occurs. -**/ - public void open() - throws ResourceException - { - super.open(); - for(int i = 0; i < resources_.length; ++i) - fireResourceAdded(resources_[i], i); - fireLengthChanged(resources_.length); - fireListCompleted(); - } - - - - -/** -Returns the resource specified by the index. - -

      This will implicitly open the list if needed. - -@param index The index. -@return The resource specified by the index, or null - if the resource is not yet available. - -@exception ResourceException If an error occurs. -**/ - public Resource resourceAt(long index) - throws ResourceException - { - super.resourceAt(index); - return resources_[(int)index]; - } - - - - protected void setArray(Resource[] resources) - { - if (resources == null) - throw new NullPointerException("resources"); - for (int i = 0; i < resources.length; ++i) - if (resources[i] == null) - throw new NullPointerException("resources[" + i + "]"); - - resources_ = resources; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ArrayTypeValueMap.java b/cvsroot/src/com/ibm/as400/resource/ArrayTypeValueMap.java deleted file mode 100644 index 9e5b2e8cf..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ArrayTypeValueMap.java +++ /dev/null @@ -1,79 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ArrayTypeValueMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.io.Serializable; -import java.lang.reflect.Array; - - -/** -The ArrayTypeValueMap class maps between a logical array value -and a physical Object[] value. It essentially just changes the -array's element type. -**/ -class ArrayTypeValueMap -extends AbstractValueMap -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private Class elementType_; - - - -/** -Constructs an ArrayTypeValueMap object. - -@param elementType The element type. -**/ - public ArrayTypeValueMap(Class elementType) - { - if (elementType == null) - throw new NullPointerException("elementType"); - - elementType_ = elementType; - } - - - -/** -Maps from a physical value to a logical value. - -@param physicalValue The physical value. -@return The logical value. -**/ - public Object ptol(Object physicalValue) - { - if (physicalValue == null) - throw new NullPointerException("physicalValue"); - if (!(physicalValue instanceof Object[])) - throw new ExtendedIllegalArgumentException("physicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - Object[] asArray = (Object[])physicalValue; - Object[] asSpecificArray = (Object[])Array.newInstance(elementType_, asArray.length); - System.arraycopy(asArray, 0, asSpecificArray, 0, asArray.length); - return asSpecificArray; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ArrayValueMap.java b/cvsroot/src/com/ibm/as400/resource/ArrayValueMap.java deleted file mode 100644 index 1dd7ca6d4..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ArrayValueMap.java +++ /dev/null @@ -1,97 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ArrayValueMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.io.Serializable; -import java.lang.reflect.Array; - - -/** -The ArrayValueMap class maps between a logical array value -and a physical String list of values. -**/ -class ArrayValueMap -extends AbstractValueMap -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private String noneString_ = null; - - - -/** -Constructs an ArrayValueMap object. -**/ - public ArrayValueMap() - { - } - - - -/** -Constructs an ArrayValueMap object. - -@param noneString The text which will be used if the array has 0 elements. -**/ - public ArrayValueMap(String noneString) - { - if (noneString == null) - throw new NullPointerException("noneString"); - - noneString_ = noneString; - } - - - -/** -Maps from a logical value to a physical value. - -@param logicalValue The logical value. -@return The physical value. -**/ - public Object ltop(Object logicalValue) - { - if (logicalValue == null) - throw new NullPointerException("logicalValue"); - if (!(logicalValue instanceof Object[])) - throw new ExtendedIllegalArgumentException("logicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - Object[] asArray = (Object[])logicalValue; - StringBuffer buffer = new StringBuffer(); - - if ((asArray.length == 0) && (noneString_ != null)) - buffer.append(noneString_); - else { - for(int i = 0; i < asArray.length; ++i) { - if (i > 0) - buffer.append(' '); - if (asArray[i] == null) - throw new NullPointerException("logicalValue[" + i + "]"); - buffer.append(asArray[i]); - } - } - return buffer.toString(); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/BooleanValueMap.java b/cvsroot/src/com/ibm/as400/resource/BooleanValueMap.java deleted file mode 100644 index 37c9e95ab..000000000 --- a/cvsroot/src/com/ibm/as400/resource/BooleanValueMap.java +++ /dev/null @@ -1,114 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BooleanValueMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.io.Serializable; - - - -/** -Maps between a logical Boolean value and specified physical values. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class BooleanValueMap -extends AbstractValueMap -implements Serializable -{ - static final long serialVersionUID = 4L; - - // Private data. - private Object[] falseValues_ = null; - private Object[] trueValues_ = null; - - - -/** -Constructs a BooleanValueMap object. - -@param falseValue The physical value which represents false. -@param trueValue The physical value which represents true. -**/ - public BooleanValueMap(Object falseValue, Object trueValue) - { - this(new Object[] { falseValue }, new Object[] { trueValue }); - } - - - -/** -Constructs a BooleanValueMap object. - -@param falseValues The physical values which represent false. -@param trueValues The physical values which represent true. -**/ - public BooleanValueMap(Object[] falseValues, Object[] trueValues) - { - if (falseValues == null) - throw new NullPointerException("falseValues"); - if (falseValues.length == 0) - throw new ExtendedIllegalArgumentException("falseValues", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if (trueValues == null) - throw new NullPointerException("trueValues"); - if (trueValues.length == 0) - throw new ExtendedIllegalArgumentException("trueValues", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - falseValues_ = falseValues; - trueValues_ = trueValues; - } - - - -/** -Maps from a logical value to a physical value. - -@param logicalValue The logical value. -@return The physical value. -**/ - public Object ltop(Object logicalValue) - { - if (logicalValue == null) - throw new NullPointerException("logicalValue"); - if (!(logicalValue instanceof Boolean)) - throw new ExtendedIllegalArgumentException("logicalValue([class "+logicalValue.getClass().getName()+"]: "+logicalValue.toString() + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - return (((Boolean)logicalValue).booleanValue()) ? trueValues_[0] : falseValues_[0]; - } - - - -/** -Maps from a physical value to a logical value. - -@param physicalValue The physical value. -@return The logical value. -**/ - public Object ptol(Object physicalValue) - { - if (physicalValue == null) - throw new NullPointerException("physicalValue"); - - for(int i = 0; i < falseValues_.length; ++i) - if (physicalValue.equals(falseValues_[i])) - return Boolean.FALSE; - - for(int i = 0; i < trueValues_.length; ++i) - if (physicalValue.equals(trueValues_[i])) - return Boolean.TRUE; - - throw new ExtendedIllegalArgumentException("physicalValue([class "+physicalValue.getClass().getName()+"]: "+physicalValue.toString() + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/BufferedResourceList.java b/cvsroot/src/com/ibm/as400/resource/BufferedResourceList.java deleted file mode 100644 index e90f75bce..000000000 --- a/cvsroot/src/com/ibm/as400/resource/BufferedResourceList.java +++ /dev/null @@ -1,330 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BufferedResourceList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.io.IOException; -import java.io.ObjectInputStream; - - - -/** -The BufferedResourceList class represents a subclass -of the {@link com.ibm.as400.resource.ResourceList ResourceList} -class which manages a list of resources and buffers them efficiently. -This class is intended to be extended and customized by subclasses. - -

      The list is retrieved in pages, and each page contains multiple -resources (those which make up the list). The higher that page size, the -more resources are retrieved at once. While the page size does not -affect functionality of the list, it may influence performance. For -instance, setting the page size to match the number of rows presented -in a GUI or servlet may improve overall response time. Call -the {@link #setPageSize(int) setPageSize()} method to set a specific -page size. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class BufferedResourceList -extends ResourceList -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private int numberOfPages_ = 5; - private int pageSize_ = 20; - - private transient PagedListBuffer buffer_ = null; - - -/** -Constructs a BufferedResourceList object. -**/ - public BufferedResourceList() - { - super(); - initializeTransient(); - } - - - -/** -Constructs a BufferedResourceList object. - -@param presentation The presentation. -@param attributeMetaData The attribute meta data, or null if not applicable. -@param selectionMetaData The selection meta data, or null if not applicable. -@param sortMetaData The sort meta data, or null if not applicable. -**/ - public BufferedResourceList(Presentation presentation, - ResourceMetaData[] attributeMetaData, - ResourceMetaData[] selectionMetaData, - ResourceMetaData[] sortMetaData) - { - super(presentation, attributeMetaData, selectionMetaData, sortMetaData); - initializeTransient(); - } - - - - -/** -Constructs a BufferedResourceList object. - -@param presentation The presentation, or null if not applicable. -@param attributes The attributes, or null if not applicable. -@param selections The selections, or null if not applicable. -@param sorts The sorts, or null if not applicable. -**/ -// -// Design note: This method is not public, since it exposes ResourceMetaDataTable, -// which is not a public class. This is intended as a "back-door" -// just for use by the BufferedResourceList class. -// - BufferedResourceList(Presentation presentation, - ResourceMetaDataTable attributes, - ResourceMetaDataTable selections, - ResourceMetaDataTable sorts) - { - super(presentation, attributes, selections, sorts); - initializeTransient(); - } - - - -/** -Closes the list. No further resources can be loaded. The list -must be closed in order to clean up resources appropriately. -This method has no effect if the list is already closed. -This method fires a listClosed() ResourceListEvent. - -@exception ResourceException If an error occurs. -**/ - public void close() - throws ResourceException - { - super.close(); - buffer_.clear(); - } - - - -/** -Fires a resourceAdded() ResourceListEvent. - -@param resource The resource. -@param index The index. -**/ - protected void fireResourceAdded(Resource resource, long index) - { - synchronized(this) { - buffer_.setResource(index, resource); - } - - super.fireResourceAdded(resource, index); - } - - - -/** -Returns the number of pages in the list buffer. - -@return The number of pages in the list buffer. -**/ - public int getNumberOfPages() - { - return numberOfPages_; - } - - - -/** -Returns the page size of the list buffer. - -@return The page size, in number of resources, of the list buffer. -**/ - public int getPageSize() - { - return pageSize_; - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient() - { - } - - - -/** -Indicates if the resource is available. This means that the -resource has been loaded. - -@param index The index. -@return true if the resource is available, - false if the resource is not available - or the list is not open. - -@exception ResourceException If an error occurs. -**/ - public boolean isResourceAvailable(long index) - throws ResourceException - { - // First check to see if the resource is already buffered in the superclass. - boolean isAvailable = super.isResourceAvailable(index); - - // If the resource already exists in our buffer, - // then it is certainly available. - return (isAvailable && (buffer_.getResource(index) != null)); - } - - - - -/** -Opens the list. The list must be open in order to -perform most operations. This method has no effect -if the list is already opened. - -@exception ResourceException If an error occurs. -**/ - public void open() - throws ResourceException - { - if (isOpen()) - return; - - super.open(); - - synchronized(this) { - buffer_ = new PagedListBuffer(numberOfPages_, pageSize_); - } - } - - - -/** -Deserializes the resource list. -**/ - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient (); - } - - - -/** -Refreshes the contents of the list. - -

      This will implicitly open the list if needed. - -@exception ResourceException If an error occurs. -**/ - public void refreshContents() - throws ResourceException - { - if (isOpen()) - buffer_.clear(); - super.refreshContents(); - } - - - -/** -Returns the resource specified by the index. - -

      This will implicitly open the list if needed. - -@param index The index. -@return The resource specified by the index, or null - if the resource is not yet available. - -@exception ResourceException If an error occurs. -**/ - public Resource resourceAt(long index) - throws ResourceException - { - synchronized(this) { - - // It may already be here. - Resource resource = super.resourceAt(index); - - // If not, try to load it. - if (resource == null) { - - synchronized(this) { - return buffer_.getResource(index); - } - - } - - return resource; - } - } - - - -/** -Sets the number of pages in the list buffer. This cannot -be set when the list is open. - -@param numberOfPages The number of pages. -**/ - public void setNumberOfPages(int numberOfPages) - { - if (isOpen()) - throw new ExtendedIllegalStateException("open", ExtendedIllegalStateException.OBJECT_CAN_NOT_BE_OPEN); - if (numberOfPages <= 0) - throw new ExtendedIllegalArgumentException("numberOfPages", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - numberOfPages_ = numberOfPages; - } - - - -/** -Sets the page size of the list buffer. This cannot -be set when the list is open. - -@param pageSize The page size, in number of resources. -**/ - public void setPageSize(int pageSize) - { - if (isOpen()) - throw new ExtendedIllegalStateException("open", ExtendedIllegalStateException.OBJECT_CAN_NOT_BE_OPEN); - if (pageSize <= 0) - throw new ExtendedIllegalArgumentException("pageSize", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - pageSize_ = pageSize; - } - - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ChangeableResource.java b/cvsroot/src/com/ibm/as400/resource/ChangeableResource.java deleted file mode 100644 index 7736b18be..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ChangeableResource.java +++ /dev/null @@ -1,840 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ChangeableResource.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Trace; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - - -/** -The ChangeableResource represents a system resource. -This is an abstract subclass of {@link com.ibm.as400.resource.Resource Resource} -which adds the ability to change attribute values of a system resource. -Attribute changes are cached internally until they are committed -or canceled. This allows you to change many attribute values at -once. Every attribute is identified using an attribute ID. Any given -subclass of ChangeableResource will normally document the attribute IDs -that it supports. - -

      One example of a concrete subclass of ChangeableResource is -{@link com.ibm.as400.resource.RJob RJob}, which represents -a server job. RJob supports many attribute IDs, -each of which can be used to access attribute values. -Here is an example which sets two attribute values for an RJob: - -

      -// Create an RJob object to refer to a specific job.
      -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
      -RJob job = new RJob(system, "AJOBNAME", "AUSERID", "AJOBNUMBER");
      -
      -// Set the date format attribute value. -job.setAttributeValue(RJob.DATE_FORMAT, RJob.DATE_FORMAT_JULIAN); -
      -// Set the country ID attribute value. -job.setAttributeValue(RJob.COUNTRY_ID, RJob.USER_PROFILE); -
      -// Commit both attribute changes. -job.commitAttributeChanges(); -
      - -

      In addition to using concrete subclasses directly, you -can write generic code to work with any ChangeableResource -subclass. Such code may improve reusability and maintainability -and will work with future ChangeableResource subclasses without -modification. Every attribute has an associated attribute -{@link com.ibm.as400.resource.ResourceMetaData meta data} -object which describes various properties of the attribute. -These properties include whether or not the attribute is -read only and what the default and possible values are. -Here is an example of generic code which resets all attributes -of a ChangeableResource to their default values: - -

      -void resetAttributeValues(ChangeableResource resource) throws ResourceException
      -{
      -    // Get the attribute meta data.
      -    ResourceMetaData[] attributeMetaData = resource.getAttributeMetaData();
      -    
      - // Loop through all attributes. - for(int i = 0; i < attributeMetaData.length; ++i) - { - // If the attribute is changeable (not read only), then - // reset its value to the default. - if (! attributeMetaData[i].isReadOnly()) - { - Object attributeID = attributeMetaData[i].getID(); - Object defaultValue = attributeMetaData[i].getDefaultValue(); - resource.setAttributeValue(attributeID, defaultValue); - } - } -
      - // Commit all of the attribute changes. - resource.commitAttributeChanges(); -} -
      - -

      Subclass notes: -

      If you are extending this class to override the mechanism for getting -attribute values, you need to override either -{@link #getAttributeUnchangedValue(java.lang.Object) getAttributeUnchangedValue(Object)} -or {@link #getAttributeUnchangedValue(java.lang.Object, int) getAttributeUnchangedValue(Object, int)}, -but not {@link #getAttributeValue(java.lang.Object) getAttributeValue(Object)} -or {@link #getAttributeValue(java.lang.Object, int) getAttributeValue(Object, int)}. -This is because getAttributeValue() will automatically call getAttributeUnchangedValue() -only when needed. - -

      Consider whether you need to support bidirectional character conversion. If you do -not plan to support bidirectional character conversion, then you only need to override -{@link #getAttributeUnchangedValue(java.lang.Object) getAttributeUnchangedValue(Object)}. -If you do plan to support bidirectional character conversion, then you need -to override {@link #isBidiEnabled() isBidiEnabled()} to return true -and {@link #getAttributeUnchangedValue(java.lang.Object, int) getAttributeUnchangedValue(Object, int)}. - -

      In either case, the overriding method should call the superclass's -method of the same name and perform extra processing only when null -is returned: - -

      -    public Object getAttributeUnchangedValue(Object attributeID)
      -    throws ResourceException
      -    {
      -        // Call the superclass first.
      -        Object value = super.getAttributeUnchangedValue(attributeID);
      -        if (value == null) {
      -
      - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); -
      - // Go get the attribute value. - value = ...; - } - return value; - } -
      - -

      If you are extending this class to override the mechanism for setting -attribute values, you need to override either -{@link #commitAttributeChanges(java.lang.Object[], java.lang.Object[]) commitAttributeChanges(Object[], Object[])} -or {@link #commitAttributeChanges(java.lang.Object[], java.lang.Object[], int[]) commitAttributeChanges(Object[], Object[], int[])}, -but not {@link #commitAttributeChanges() commitAttributeChanges()}, -{@link #setAttributeValue(java.lang.Object, java.lang.Object) setAttributeValue(Object, Object)}, or -{@link #setAttributeValue(java.lang.Object, java.lang.Object, int) setAttributeValue(Object, Object, int)}. - -

      If you do not plan to support bidirectional character conversion, then you only need -to override {@link #commitAttributeChanges(java.lang.Object[], java.lang.Object[]) commitAttributeChanges(Object[], Object[])}. -If you do plan to support bidirectional character conversion, then you need -to override {@link #isBidiEnabled() isBidiEnabled()} to return true -and {@link #commitAttributeChanges(java.lang.Object[], java.lang.Object[], int[]) commitAttributeChanges(Object[], Object[], int[])}}. - -

      In either case, the overriding method should call the superclass's -method of the same name and then perform extra processing: - -

      -    protected void commitAttributeChanges(Object[] attributeIDs, Object[] values)
      -    throws ResourceException
      -    {
      -        // Call the superclass first.
      -        super.commitAttributeChanges(attributeIDs, values);
      -
      - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); -
      - // Commit the attribute changes. - // ... - } -
      -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -// -// Implementation notes: -// -// 1. I have chosen to restrict attribute values from being null. -// This will enable Hashtable implementations to be more -// straightforward (Hashtables cannot have null elements). -// -// 2. There was some discussion as to whether to combine this -// with Resource. The reasons it is left separate are: -// -// * For simple (read-only) resources, their sum of methods -// remains simple. -// * The compiler can enforce the read-only characteristic -// of some resources. Combining this class with Resource -// would leave such checks in run-time. -// -public abstract class ChangeableResource -extends Resource -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - - // This hashtable keeps a buffer of values that have been loaded as a - // result of a previous call to getAttributeValue(). - // Note: This buffer excludes any uncommitted changes. - private transient Hashtable bufferedValues_; - - // This hashtable keeps a list of values that have been set as a result - // of a previous call to setAttributeValue() but have not yet been - // committed. When the changes are committed, the contents of this - // hashtable will be moved to bufferedValues_. - private transient Hashtable uncommittedChanges_; - private transient Hashtable uncommittedChangeBidiStringTypes_; // @A2A - -// private transient Vector resourceListeners_; // @A1d - Moved to Resource. - - - -/** -Constructs a ChangeableResource object. -**/ - public ChangeableResource() - { - super(); - initializeTransient(); - } - - - -/** -Constructs a ChangeableResource object. - -@param presentation The presentation. -@param resourceKey The resource key. -@param attributeMetaData The attribute meta data, or null if not applicable. -**/ - public ChangeableResource(Presentation presentation, - Object resourceKey, - ResourceMetaData[] attributeMetaData) - { - super(presentation, resourceKey, attributeMetaData); - initializeTransient(); - } - - - -/** -Constructs a ChangeableResource object. - -@param presentation The presentation. -@param resourceKey The resource key. -@param attributes The attribute meta data, or null if not applicable. -**/ - public ChangeableResource(Presentation presentation, - Object resourceKey, - ResourceMetaDataTable attributes) - { - super(presentation, resourceKey, attributes); - initializeTransient(); - } - - - -// @A1d - Moved to Resource. -// /** -// Adds a ResourceListener. -// -// @param listener The listener. -// **/ -// public void addResourceListener(ResourceListener listener) -// { -// if (listener == null) -// throw new NullPointerException("listener"); -// -// resourceListeners_.addElement(listener); -// } - - - -/** -Cancels all uncommitted attribute changes. This method -fires an attributeChangesCanceled() ResourceEvent. - -@exception ResourceException If an error occurs. -**/ - public void cancelAttributeChanges() - throws ResourceException - { - synchronized(this) { - uncommittedChanges_.clear(); - } - - fireAttributeChangesCanceled(); - } - - - -/** -Commits all attribute changes. This method -fires an attributeChangesCommitted() ResourceEvent. - -

      This method gathers information about which attribute -changes need to be committed and calls {@link #commitAttributeChanges(java.lang.Object[], java.lang.Object[]) commitAttributeChanges(Object[], Object[])}. -Subclasses should override -commitAttributeChanges(Object[], Object[]) to define how attribute -changes are physically committed. - -@exception ResourceException If an error occurs. -**/ - public void commitAttributeChanges() - throws ResourceException - { - fireBusy(); - - try { - - // Gather the changes. - int uncommittedChangesCount = uncommittedChanges_.size(); - Object[] attributeIDs = new Object[uncommittedChangesCount]; - Object[] values = new Object[uncommittedChangesCount]; - int[] bidiStringTypes = new int[uncommittedChangesCount]; // @A2A - boolean bidiEnabled = isBidiEnabled(); // @A2A - Enumeration list = uncommittedChanges_.keys(); - int i = 0; - while(list.hasMoreElements()) { - attributeIDs[i] = list.nextElement(); - values[i] = uncommittedChanges_.get(attributeIDs[i]); - if (bidiEnabled) { // @A2A - bidiStringTypes[i] = ((Integer)uncommittedChangeBidiStringTypes_.get(attributeIDs[i])).intValue(); // @A2A - if (bidiStringTypes[i] == -1) // @A2A - bidiStringTypes[i] = getDefaultBidiStringType(); // @A2A - } // @A2A - ++i; - } - - // Validation. - for(int j = 0; j < attributeIDs.length; ++j) { - if (attributeIDs[j] == null) - throw new NullPointerException("attributeIDs[" + j + "]"); - ResourceMetaData attributeMetaData = validateAttributeID(attributeIDs[j]); - if (attributeMetaData.isReadOnly()) { - Trace.log(Trace.ERROR, "Attempted to set read-only attribute: " + attributeIDs[j]); // @A3A - throw new ResourceException(ResourceException.ATTRIBUTE_READ_ONLY); // @A3C - } - if (values[j] == null) - throw new NullPointerException("values[" + j + "]"); - values[j] = attributeMetaData.validateValue(values[j]); - } - - // Physically set the uncommitted changes. - if (bidiEnabled) // @A2A - commitAttributeChanges(attributeIDs, values, bidiStringTypes); // @A2A - else // @A2A - commitAttributeChanges(attributeIDs, values); - - // Assuming that went okay, move the uncommitted changes - // to the buffered values. - for(int j = 0; j < attributeIDs.length; ++j) - bufferedValues_.put(attributeIDs[j], values[j]); - uncommittedChanges_.clear(); - uncommittedChangeBidiStringTypes_.clear(); // @A2A - - fireAttributeChangesCommitted(); - } - finally { - fireIdle(); - } - } - - - -// @A2C -/** -Commits the specified attribute changes. - -

      Subclasses should override this method to define how attribute -changes are physically committed. - -@param attributeIDs The attribute IDs for the specified attribute changes. -@param values The specified attribute changes - -@exception ResourceException If an error occurs. - -@see Subclass notes -**/ - protected void commitAttributeChanges(Object[] attributeIDs, Object[] values) - throws ResourceException - { - // Do nothing for the default implementation. - } - - -// @A2A -/** -Commits the specified attribute changes. - -

      Subclasses should override this method to define how attribute -changes are physically committed. - -@param attributeIDs The attribute IDs for the specified attribute changes. -@param values The specified attribute changes -@param bidiStringTypes The bidi string types as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. - -@exception ResourceException If an error occurs. - -@see Subclass notes -**/ - protected void commitAttributeChanges(Object[] attributeIDs, Object[] values, int[] bidiStringTypes) - throws ResourceException - { - // Do nothing for the default implementation. - } - - - -/** -Fires an attributeChangesCanceled() ResourceEvent. -**/ - protected void fireAttributeChangesCanceled() - { - ResourceEvent event = new ResourceEvent(this, ResourceEvent.ATTRIBUTE_CHANGES_CANCELED); - Vector temp = (Vector)resourceListeners_.clone(); - Enumeration list = temp.elements(); - while(list.hasMoreElements()) - ((ResourceListener)list.nextElement()).attributeChangesCanceled(event); - } - - - -/** -Fires an attributeChangesCommitted() ResourceEvent. -**/ - protected void fireAttributeChangesCommitted() - { - ResourceEvent event = new ResourceEvent(this, ResourceEvent.ATTRIBUTE_CHANGES_COMMITTED); - Vector temp = (Vector)resourceListeners_.clone(); - Enumeration list = temp.elements(); - while(list.hasMoreElements()) - ((ResourceListener)list.nextElement()).attributeChangesCommitted(event); - } - - - -/** -Fires an attributeValueChanged() ResourceEvent. - -@param attributeID Identifies the attribute. -@param value The attribute value. -**/ - protected void fireAttributeValueChanged(Object attributeID, Object value) - { - ResourceEvent event = new ResourceEvent(this, ResourceEvent.ATTRIBUTE_VALUE_CHANGED, attributeID, value); - Vector temp = (Vector)resourceListeners_.clone(); - Enumeration list = temp.elements(); - while(list.hasMoreElements()) - ((ResourceListener)list.nextElement()).attributeValueChanged(event); - } - - - -// @A1d - Moved to Resource. -// /** -// Fires an attributeValuesRefreshed() ResourceEvent. -// **/ -// protected void fireAttributeValuesRefreshed() -// { -// ResourceEvent event = new ResourceEvent(this, ResourceEvent.ATTRIBUTE_VALUES_REFRESHED); -// Vector temp = (Vector)resourceListeners_.clone(); -// Enumeration list = temp.elements(); -// while(list.hasMoreElements()) -// ((ResourceListener)list.nextElement()).attributeValuesRefreshed(event); -// } - - - -/** -Fires an resourceCreated() ResourceEvent. -**/ - protected void fireResourceCreated() - { - ResourceEvent event = new ResourceEvent(this, ResourceEvent.RESOURCE_CREATED); - Vector temp = (Vector)resourceListeners_.clone(); - Enumeration list = temp.elements(); - while(list.hasMoreElements()) - ((ResourceListener)list.nextElement()).resourceCreated(event); - } - - - -/** -Fires an resourceDeleted() ResourceEvent. -**/ - protected void fireResourceDeleted() - { - ResourceEvent event = new ResourceEvent(this, ResourceEvent.RESOURCE_DELETED); - Vector temp = (Vector)resourceListeners_.clone(); - Enumeration list = temp.elements(); - while(list.hasMoreElements()) - ((ResourceListener)list.nextElement()).resourceDeleted(event); - } - - - -// @A2C -/** -Returns the value of an attribute, disregarding any uncommitted -changes. - -

      Subclasses should override this method to implement -how attribute values are physically retrieved. - -@param attributeID Identifies the attribute. -@return The attribute value, or null if the attribute - value is not available. - -@exception ResourceException If an error occurs. - -@see Subclass notes -**/ - public Object getAttributeUnchangedValue(Object attributeID) - throws ResourceException - { - // If this resource is bidi enabled, then punt to the bidi flavor - // of getAttributeUnchangedValue(). This will ensure that the subclass's - // bidi-enabled getAttributeUnchangedValue() method gets called even though - // no string type was passed - - and therefore the subclass only - // needs to override the bidi-enabled getAttributeUnchangedValue(). - if (isBidiEnabled()) - return getAttributeUnchangedValue(attributeID, getDefaultBidiStringType()); - else - return getAttributeUnchangedValueImplementation(attributeID, getDefaultBidiStringType()); - } - - - -// @A2A -/** -Returns the value of an attribute, disregarding any uncommitted -changes. - -

      Subclasses should override this method to implement -how attribute values are physically retrieved. - -@param attributeID Identifies the attribute. -@param bidiStringType The bidi string type as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. -@return The attribute value, or null if the attribute - value is not available. - -@exception ResourceException If an error occurs. - -@see Subclass notes -**/ - public Object getAttributeUnchangedValue(Object attributeID, int bidiStringType) - throws ResourceException - { - // If this resource is not bidi enabled, then punt to the non-bidi flavor - // of getAttributeUnchangedValue(). This will ensure that the subclass's - // non-bidi-enabled getAttributeUnchangedValue() method gets called even though - // a string type was passed - - and therefore the subclass only - // needs to override the non-bidi-enabled getAttributeUnchangedValue(). - if (!isBidiEnabled()) - return getAttributeUnchangedValue(attributeID); - else - return getAttributeUnchangedValueImplementation(attributeID, bidiStringType); - } - - - -// @A2A - private Object getAttributeUnchangedValueImplementation(Object attributeID, int bidiStringType) - throws ResourceException - { - validateAttributeID(attributeID); - synchronized(this) { - if (bufferedValues_.containsKey(attributeID)) - return bufferedValues_.get(attributeID); - else - return super.getAttributeValueImplementation(attributeID); - } - } - - - -// @A2C -/** -Returns the current value of an attribute. If the attribute value -has an uncommitted change, this returns the changed (uncommitted) value. - -@param attributeID Identifies the attribute. -@return The attribute value, or null if the attribute - value is not available. - -@exception ResourceException If an error occurs. - -@see Subclass notes -**/ - public Object getAttributeValue(Object attributeID) - throws ResourceException - { - // If this resource is bidi enabled, then punt to the bidi flavor - // of getAttributeValue(). This will ensure that the subclass's - // bidi-enabled getAttributeValue() method gets called even though - // no string type was passed - - and therefore the subclass only - // needs to override the bidi-enabled getAttributeValue(). - if (isBidiEnabled()) - return getAttributeValue(attributeID, getDefaultBidiStringType()); - else - return getAttributeValueImplementation(attributeID, getDefaultBidiStringType()); - } - - - -// @A2A -/** -Returns the current value of an attribute. If the attribute value -has an uncommitted change, this returns the changed (uncommitted) value. - -@param attributeID Identifies the attribute. -@param bidiStringType The bidi string type as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. -@return The attribute value, or null if the attribute - value is not available. - -@exception ResourceException If an error occurs. - -@see Subclass notes -**/ - public Object getAttributeValue(Object attributeID, int bidiStringType) - throws ResourceException - { - // If this resource is not bidi enabled, then punt to the non-bidi flavor - // of getAttributeValue(). This will ensure that the subclass's - // non-bidi-enabled getAttributeValue() method gets called even though - // a string type was passed - - and therefore the subclass only - // needs to override the non-bidi-enabled getAttributeValue(). - if (!isBidiEnabled()) - return getAttributeValue(attributeID); - else - return getAttributeValueImplementation(attributeID, bidiStringType); - } - - - - -// @A2A - private Object getAttributeValueImplementation(Object attributeID, int bidiStringType) - throws ResourceException - { - synchronized(this) { - if (uncommittedChanges_.containsKey(attributeID)) - return uncommittedChanges_.get(attributeID); - else - return getAttributeUnchangedValue(attributeID, bidiStringType); - } - } - - - -/** -Indicates if an attribute has an uncommitted change. - -@param attributeID Identifies the attribute. -@return true if the attribute has a uncommitted change, - false otherwise. -**/ - public boolean hasUncommittedAttributeChanges(Object attributeID) - { - validateAttributeID(attributeID); - return uncommittedChanges_.containsKey(attributeID); - } - - -// @A4A -/** -Initializes an attribute value. This is intended for use by the -subclass when it is initializing attribute values. - -@param attributeID Identifies the attribute. -@param value The attribute value. This cannot be null. -**/ - protected void initializeAttributeValue(Object attributeID, Object value) - { - super.initializeAttributeValue(attributeID, value); - bufferedValues_.put(attributeID, value); // @A4A - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient() - { - uncommittedChanges_ = new Hashtable(); - uncommittedChangeBidiStringTypes_ = new Hashtable(); // @A2A - bufferedValues_ = new Hashtable(); - - //resourceListeners_ = new Vector(); // @A1d - Moved to Resource. - } - - - -/** -Deserializes the resource. -**/ - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient (); - } - - - -/** -Refreshes the values for all attributes. This does not cancel -uncommitted changes. This method fires an attributeValuesRefreshed() -ResourceEvent. - -@exception ResourceException If an error occurs. -**/ - public void refreshAttributeValues() - throws ResourceException - { - bufferedValues_.clear(); - super.refreshAttributeValues(); - //fireAttributeValuesRefreshed(); // @A1d - Moved to Resource. - } - - - -// @A1d - Moved to Resource. - ///** - //Removes a ResourceListener. - // - //@param listener The listener. - //**/ - // public void removeResourceListener(ResourceListener listener) - // { - // if (listener == null) - // throw new NullPointerException("listener"); - // - // resourceListeners_.removeElement(listener); - // } - - - -/** -Sets the current value of an attribute. The changed value will -be uncommitted until changes are committed. This method -fires an attributeValueChanged() ResourceEvent. - -@param attributeID Identifies the attribute. -@param value The attribute value. This cannot be null. - -@exception ResourceException If an error occurs. -**/ - public void setAttributeValue(Object attributeID, Object value) - throws ResourceException - { - // If this resource is bidi enabled, then punt to the bidi flavor - // of setAttributeValue(). This will ensure that the subclass's - // bidi-enabled setAttributeValue() method gets called even though - // no string type was passed - - and therefore the subclass only - // needs to override the bidi-enabled setAttributeValue(). - if (isBidiEnabled()) - setAttributeValue(attributeID, value, getDefaultBidiStringType()); - else - setAttributeValueImplementation(attributeID, value, getDefaultBidiStringType()); - } - - - -// @A2A -/** -Sets the current value of an attribute. The changed value will -be uncommitted until changes are committed. This method -fires an attributeValueChanged() ResourceEvent. - -@param attributeID Identifies the attribute. -@param value The attribute value. This cannot be null. -@param bidiStringType The bidi string type as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. - -@exception ResourceException If an error occurs. -**/ - public void setAttributeValue(Object attributeID, Object value, int bidiStringType) - throws ResourceException - { - // If this resource is not bidi enabled, then punt to the non-bidi flavor - // of setAttributeValue(). This will ensure that the subclass's - // non-bidi-enabled setAttributeValue() method gets called even though - // a string type was passed - - and therefore the subclass only - // needs to override the non-bidi-enabled setAttributeValue(). - if (!isBidiEnabled()) - setAttributeValue(attributeID, value); - else { - // In the default implementation, we don't use the string type, - // since there is no conversion being done. - setAttributeValueImplementation(attributeID, value, bidiStringType); - } - } - - - -// @A2A - private void setAttributeValueImplementation(Object attributeID, Object value, int bidiStringType) - throws ResourceException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, "Setting attribute value " + attributeID + " (for " - + this + ") to " + value + "(" + value.getClass() + "), bidi string type = " - + bidiStringType); // @A2C - - // Validation. - ResourceMetaData attributeMetaData = validateAttributeID(attributeID); - if (attributeMetaData.isReadOnly()) { - Trace.log(Trace.ERROR, "Attempted to set read-only attribute: " + attributeID); // @A3A - throw new ResourceException(ResourceException.ATTRIBUTE_READ_ONLY); // @A3C - } - if (value == null) - throw new NullPointerException("value"); - value = attributeMetaData.validateValue(value); - - // Make the change. - synchronized(this) { - uncommittedChanges_.put(attributeID, value); - uncommittedChangeBidiStringTypes_.put(attributeID, new Integer(bidiStringType)); // @A2A - } - - // Fire the event. - fireAttributeValueChanged(attributeID, value); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/CommandAttributeSetter.java b/cvsroot/src/com/ibm/as400/resource/CommandAttributeSetter.java deleted file mode 100644 index afd38c5e0..000000000 --- a/cvsroot/src/com/ibm/as400/resource/CommandAttributeSetter.java +++ /dev/null @@ -1,287 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CommandAttributeSetter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400BidiTransform; -import com.ibm.as400.access.CharConverter; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.CommandCall; -import com.ibm.as400.access.Trace; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Serializable; -import java.io.Writer; -import java.util.Enumeration; -import java.util.Hashtable; - - - -/** -The CommandAttributeSetter class sets attribute values by calling a -command on the server. The base command string is usually a server command -name and any invariant parameter names and values. - -

      This class uses a -CommandMap object to define how attribute values are -specified in the command string. -**/ -class CommandAttributeSetter -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private CommandMap attributeMap_ = null; - private CommandCall commandCall_ = null; - private CharConverter converter_ = null; // @A2A - private int defaultStringType_ = -1; // @A2A - private Hashtable invariants_ = new Hashtable(); - private AS400 system_ = null; - - - -/** -Constructs a CommandAttributeSetter object. - -@param system The system. -@param attributeMap The attribute map. -**/ - public CommandAttributeSetter(AS400 system, CommandMap attributeMap) - { - if (system == null) - throw new NullPointerException("system"); - if (attributeMap == null) - throw new NullPointerException("attributeMap"); - - system_ = system; - commandCall_ = new CommandCall(system); - attributeMap_ = attributeMap; - } - - - -// @A2A - private void append(ByteArrayOutputStream commandString, - String text) - throws IOException - { - if (defaultStringType_ == -1) - defaultStringType_ = AS400BidiTransform.getStringType((char)system_.getCcsid()); - if (converter_ == null) - converter_ = new CharConverter(system_.getCcsid(), system_); - commandString.write(converter_.stringToByteArray(text)); - } - - - -// @A2A - private void append(ByteArrayOutputStream commandString, - String parameterName, - Object parameterValue) - throws IOException - { - if (defaultStringType_ == -1) - defaultStringType_ = AS400BidiTransform.getStringType((char)system_.getCcsid()); - append(commandString, parameterName, parameterValue, defaultStringType_); - } - - - -// @A2A - private void append(ByteArrayOutputStream commandString, - String parameterName, - Object parameterValue, - int bidiStringType) - throws IOException - { - if (converter_ == null) - converter_ = new CharConverter(system_.getCcsid(), system_); - commandString.write(converter_.stringToByteArray(parameterName + '(')); - commandString.write(converter_.stringToByteArray(parameterValue.toString(), bidiStringType)); - commandString.write(converter_.stringToByteArray(") ")); - } - - - -/** -Sets an invariant parameter value. - -@param commandName The command name. -@param parameterName The command parameter name. -@param parameterValue The command parameter value. -**/ - public void setParameterValue(String commandName, String parameterName, String parameterValue) - { - if (commandName == null) - throw new NullPointerException("commandName"); - if (parameterName == null) - throw new NullPointerException("parameterName"); - if (parameterValue == null) - throw new NullPointerException("parameterValue"); - - synchronized(this) { - Hashtable parameters; - if (invariants_.containsKey(commandName)) - parameters = (Hashtable)invariants_.get(commandName); - else { - parameters = new Hashtable(); - invariants_.put(commandName, parameters); - } - - parameters.put(parameterName, parameterValue); - } - } - - - -// @A2C -/** -Sets the attribute values. The system must be set before this is called. - -@param attributeIDs The attribute IDs. -@param values The values. This array must contain the same number of - elements as attributeIDs. - -@exception ResourceException If an error occurs. -**/ - public void setValues(Object[] attributeIDs, Object[] values) - throws ResourceException - { - if (attributeIDs == null) - throw new NullPointerException("attributeIDs"); - - if (defaultStringType_ == -1) - defaultStringType_ = AS400BidiTransform.getStringType((char)system_.getCcsid()); - int[] bidiStringTypes = new int[attributeIDs.length]; - for(int i = 0; i < bidiStringTypes.length; ++i) - bidiStringTypes[i] = defaultStringType_; - - setValues(attributeIDs, values, bidiStringTypes); - } - - - -// @A2C -/** -Sets the attribute values. The system must be set before this is called. - -@param attributeIDs The attribute IDs. -@param values The values. This array must contain the same number of - elements as attributeIDs. -@param bidiStringTypes The bidi string types as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. - -@exception ResourceException If an error occurs. -**/ - public void setValues(Object[] attributeIDs, Object[] values, int[] bidiStringTypes) - throws ResourceException - { - if (attributeIDs == null) - throw new NullPointerException("attributeIDs"); - if (values == null) - throw new NullPointerException("values"); - if (attributeIDs.length != values.length) - throw new ExtendedIllegalArgumentException("values", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if (attributeIDs.length != bidiStringTypes.length) // @A2A - throw new ExtendedIllegalArgumentException("bidiStringTypes", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); // @A2A - if (commandCall_.getSystem() == null) - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - try { // @A2A - synchronized(this) { - - // Create a list of command strings to execute. The command strings @A2C - // are ByteArrayOutputStreams (and ultimately byte[]s) to enable bidi strings. @A2A - Hashtable commandStrings = new Hashtable(); - for (int i = 0; i < attributeIDs.length; ++i) { - CommandMapEntry[] entries = attributeMap_.getEntries(attributeIDs[i]); - - // If there is an entry for a command already being used, - // then just specify it there. - ByteArrayOutputStream commandString = null; // @A2C - int indexUsed = -1; - for (int j = 0; j < entries.length; ++j) { - String commandName = entries[j].getCommandName(); - if (commandStrings.containsKey(commandName)) { - commandString = (ByteArrayOutputStream)commandStrings.get(commandName); // @A2C - indexUsed = j; - break; - } - } - - // If there is no command already being used, then use the first - // entry. - if (commandString == null) { - String commandName = entries[0].getCommandName(); - commandString = new ByteArrayOutputStream(); // @A2C - append(commandString, commandName + ' '); // @A2A - if (invariants_.containsKey(commandName)) { - Hashtable parameters = (Hashtable)invariants_.get(commandName); - Enumeration keys = parameters.keys(); - while(keys.hasMoreElements()) { - String parameterName = (String)keys.nextElement(); - String parameterValue = (String)parameters.get(parameterName); - append(commandString, parameterName, parameterValue); // @A2C - } - } - commandStrings.put(commandName, commandString); - indexUsed = 0; - } - - // Append the attribute and value to the command string. - ValueMap valueMap = entries[indexUsed].getValueMap(); - Object value = (valueMap != null) ? valueMap.ltop(values[i], commandCall_.getSystem()) : values[i]; - append(commandString, entries[indexUsed].getParameterName(), value, bidiStringTypes[i]); // @A2C - } - - // Execute the command strings. - Enumeration strings = commandStrings.elements(); - while(strings.hasMoreElements()) { - ByteArrayOutputStream commandString = (ByteArrayOutputStream)strings.nextElement(); // @A2C - byte[] asBytes = commandString.toByteArray(); // @A2C - if (Trace.isTraceOn()) { // @A2C - String asString = converter_.byteArrayToString(asBytes); // @A2A - Trace.log(Trace.INFORMATION, "Setting attribute values using command: " // @A2C - + asString + "."); // @A2C - } // @A2A - try { - boolean success = commandCall_.run(asBytes); // @A2C - if (! success) - throw new ResourceException(commandCall_.getMessageList()); - } - catch(Exception e) { - throw new ResourceException(ResourceException.ATTRIBUTES_NOT_SET, e); - } - } - } - } // @A2A - catch(IOException e) { // @A2A - throw new ResourceException(ResourceException.ATTRIBUTES_NOT_SET, e); // @A2A - } // @A2A - } - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/CommandMap.java b/cvsroot/src/com/ibm/as400/resource/CommandMap.java deleted file mode 100644 index 236fec3fa..000000000 --- a/cvsroot/src/com/ibm/as400/resource/CommandMap.java +++ /dev/null @@ -1,126 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CommandMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.io.Serializable; -import java.util.Hashtable; -import java.util.Vector; - - - -/** -The CommandMap class represents a map between logical values (e.g. Resource -attribute values or ResourceList selection values) and parameter values -in a CL command. Each logical value is refered to by a logical ID in the map. -A logical value may map to multiple parameters in multiple CL commands. -**/ -class CommandMap -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private Hashtable table_ = new Hashtable(); - private Object[] ids_ = null; - private Vector idsV_ = new Vector(); - - - -/** -Adds a map entry. - -@param id Identifies the logical value. -@param commandName The command name. -@param parameterName The parameter name. -**/ - public void add(Object id, String commandName, String parameterName) - { - add(id, commandName, parameterName, null); - } - - - -/** -Adds a map entry. - -@param id Identifies the logical value. -@param commandName The command name. -@param parameterName The parameter name. -@param valueMap The value map, or null if there is none. -**/ - public void add(Object id, String commandName, String parameterName, ValueMap valueMap) - { - // Validate the parameters. - if (id == null) - throw new NullPointerException("id"); - if (commandName == null) - throw new NullPointerException("commandName"); - if (parameterName == null) - throw new NullPointerException("parameterName"); - - // Add the entry to the table. The table is a hashtable where the keys - // are IDs, and the elements are each a Vector with a list of entries. - // This Vector is necessary to account for IDs that map to multiple - // entries. - Vector entriesV; - if (table_.containsKey(id)) - entriesV = (Vector)table_.get(id); - else { - entriesV = new Vector(); - table_.put(id, entriesV); - } - - entriesV.addElement(new CommandMapEntry(commandName, parameterName, valueMap)); - idsV_.addElement(id); - - // Since we changed the list, reset the array to null to force it to be - // rebuilt the next time it is needed. - ids_ = null; - } - - - -/** -Returns the map entries for a particular logical value. - -@param id Identifies the logical value. -@return The entries. -**/ - public CommandMapEntry[] getEntries(Object id) - { - // Validate the parameter. - if (id == null) - throw new NullPointerException("id"); - if (! table_.containsKey(id)) - throw new ExtendedIllegalArgumentException("id", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - // Take the Vector element from the hashtable and turn it - // into an array. - Vector entriesV = (Vector)table_.get(id); - CommandMapEntry[] entries = new CommandMapEntry[entriesV.size()]; - entriesV.copyInto(entries); - return entries; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/CommandMapEntry.java b/cvsroot/src/com/ibm/as400/resource/CommandMapEntry.java deleted file mode 100644 index d15e914cf..000000000 --- a/cvsroot/src/com/ibm/as400/resource/CommandMapEntry.java +++ /dev/null @@ -1,104 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CommandMapEntry.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import java.io.Serializable; - - -/** -The CommandMapEntry class represents an entry in a CommandMap. -It contains references to the following items relating to a -parameter in a CL command: - -

        -
      • command name -
      • parameter name -
      • value map (optional) -
      -**/ -class CommandMapEntry -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - // Private data. - private String commandName_ = null; - private String parameterName_ = null; - private ValueMap valueMap_ = null; - - - -/** -Constructs a CommandMapEntry object. - -@param commandName The command name. -@param parameterName The parameter name. -@param valueMap The value map, or null if not applicable. -**/ - public CommandMapEntry(String commandName, - String parameterName, - ValueMap valueMap) - { - if (commandName == null) - throw new NullPointerException("commandName"); - if (parameterName == null) - throw new NullPointerException("parameterName"); - - commandName_ = commandName; - parameterName_ = parameterName; - valueMap_ = valueMap; - } - - - -/** -Returns the command name. - -@return The command name. -**/ - public String getCommandName() - { - return commandName_; - } - - - -/** -Returns the parameter name. - -@return The parameter name. -**/ - public String getParameterName() - { - return parameterName_; - } - - - -/** -Returns the value map. - -@return The value map, or null if none was specified. -**/ - public ValueMap getValueMap() - { - return valueMap_; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/DateValueMap.java b/cvsroot/src/com/ibm/as400/resource/DateValueMap.java deleted file mode 100644 index ebf26fe19..000000000 --- a/cvsroot/src/com/ibm/as400/resource/DateValueMap.java +++ /dev/null @@ -1,251 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DateValueMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.DateTimeConverter; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import java.io.Serializable; -import java.util.Calendar; -import java.util.Date; - - - -/** -The DateValueMap class maps between a logical Date value -and a variety of date formats for a physical value. -**/ -class DateValueMap -implements ValueMap, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - // Date formats. // physical <--> logical - public static final int FORMAT_6 = 6; // HHMMSS <--> Date - public static final int FORMAT_7 = 7; // CYYMMDD <--> Date - public static final int FORMAT_13 = 13; // CYYMMDDHHMMSS <--> Date - public static final int FORMAT_DTS = 99; // System *DTS (date timestamp) format <--> Date - - - - // Private data. - static final Date NO_DATE = new Date(0); - - private static final String DTS = "*DTS"; - private static final String HHMMSS_ZEROS = "000000"; - private static final String CYYMMDD_ZEROS = "0000000"; - - private int format_ = -1; - - - -/** -Constructs a DateValueMap object. - -@param format The format. -**/ - public DateValueMap(int format) - { - if ((format != FORMAT_6) - && (format != FORMAT_7) - && (format != FORMAT_13) - && (format != FORMAT_DTS)) - throw new ExtendedIllegalArgumentException("format", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - format_ = format; - } - - - -/** -Maps from a logical value to a physical value. - -@param logicalValue The logical value. -@param system The system. -@return The physical value. -**/ - public Object ltop(Object logicalValue, AS400 system) - { - if (logicalValue == null) - throw new NullPointerException("logicalValue"); - - switch(format_) { - - case FORMAT_13: - return dateToString13((Date)logicalValue); - - case FORMAT_7: - return dateToString13((Date)logicalValue).substring(0,7); - - case FORMAT_6: - return dateToString13((Date)logicalValue).substring(7); - - case FORMAT_DTS: - if (system == null) - throw new NullPointerException("system"); - - try { - DateTimeConverter converter = new DateTimeConverter(system); - return converter.convert((Date)logicalValue, DTS); - } - catch(Exception e) { - throw new ExtendedIllegalArgumentException("logicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - // If the format specified is bad... - throw new ExtendedIllegalStateException("format", ExtendedIllegalStateException.UNKNOWN); - } - - - -/** -Maps from a physical value to a logical value. - -@param physicalValue The physical value. -@param system The system. -@return The logical value. -**/ - public Object ptol(Object physicalValue, AS400 system) - { - // Validate the physical value. - if (physicalValue == null) - throw new NullPointerException("physicalValue"); - - switch(format_) { - - case FORMAT_13: - return string13ToDate((String)physicalValue); - - case FORMAT_7: - return string13ToDate((String)physicalValue + HHMMSS_ZEROS); - - case FORMAT_6: - return string13ToDate(CYYMMDD_ZEROS + (String)physicalValue); - - case FORMAT_DTS: - if (system == null) - throw new NullPointerException("system"); - try { - byte[] asBytes = (byte[])physicalValue; - - // If the first byte is an EBCDIC space, assume the rest - // are and specify a default date. - if ((asBytes[0] == 0x40) || (asBytes[0] == 0x00)) // @A1C - return NO_DATE; - - DateTimeConverter converter = new DateTimeConverter(system); - return converter.convert((byte[])physicalValue, DTS); - } - catch(Exception e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error converting date from DTS format", e); - throw new ExtendedIllegalArgumentException("physicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - throw new ExtendedIllegalArgumentException("physicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - - -/** -Converts a Date to a String in the format CYYMMDDHHMMSS. - -@param date The Date. -@return The String. -**/ - private static String dateToString13(Date date) - { - Calendar calendar = Calendar.getInstance(); - calendar.setTime(date); - StringBuffer buffer13 = new StringBuffer(13); - int year13 = calendar.get(Calendar.YEAR); - buffer13.append((year13 < 2000) ? '0' : '1'); - buffer13.append(twoDigits(year13 % 100)); - buffer13.append(twoDigits(calendar.get(Calendar.MONTH) + 1)); - buffer13.append(twoDigits(calendar.get(Calendar.DAY_OF_MONTH))); - buffer13.append(twoDigits(calendar.get(Calendar.HOUR_OF_DAY))); - buffer13.append(twoDigits(calendar.get(Calendar.MINUTE))); - buffer13.append(twoDigits(calendar.get(Calendar.SECOND))); - return buffer13.toString(); - } - - -/** -Converts a String in the format CYYMMDDHHMMSS to a Date - -@param string13 The String. -@return The Date. -**/ - private static Date string13ToDate(String string13) - { - int length = string13.length(); - - Calendar calendar = Calendar.getInstance(); - - // If the date is all blanks or if it is a special - // value, then return a date with all zeros. - if (length == 0) - return NO_DATE; - else if (string13.charAt(0) == '*') - return NO_DATE; - - int century = Integer.parseInt(string13.substring(0,1)); - int year = Integer.parseInt(string13.substring(1,3)); - int month = Integer.parseInt(string13.substring(3,5)); - int day = Integer.parseInt(string13.substring(5,7)); - int hour = Integer.parseInt(string13.substring(7,9)); - int minute = Integer.parseInt(string13.substring(9,11)); - int second = Integer.parseInt(string13.substring(11,13)); - - calendar.set(Calendar.YEAR, year + ((century == 0) ? 1900 : 2000)); - calendar.set(Calendar.MONTH, month - 1); - calendar.set(Calendar.DAY_OF_MONTH, day); - calendar.set(Calendar.HOUR_OF_DAY, hour); - calendar.set(Calendar.MINUTE, minute); - calendar.set(Calendar.SECOND, second); - calendar.set(Calendar.MILLISECOND, 0); // @A1A - return calendar.getTime(); - } - - - -/** -Returns a 2 digit String representation of the value. -The value will be 0-padded on the left if needed. - -@param value The value. -@return The 2 digit String representation. -**/ - private static String twoDigits(int value) - { - if (value > 99) - throw new ExtendedIllegalArgumentException("value", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - String full = "00" + Integer.toString(value); - return full.substring(full.length() - 2); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/IntegerToLongValueMap.java b/cvsroot/src/com/ibm/as400/resource/IntegerToLongValueMap.java deleted file mode 100644 index aa10ff407..000000000 --- a/cvsroot/src/com/ibm/as400/resource/IntegerToLongValueMap.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IntegerToLongValueMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; - - -/** -The IntegerToLongValueMap class maps between a logical unsigned -Long value and a physical Integer value. -**/ -class IntegerToLongValueMap -extends AbstractValueMap -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private static final long UPPER_LIMIT_ = (long)Integer.MAX_VALUE * 2 + 2; - - - -/** -Maps from a physical value to a logical value. - -@param physicalValue The physical value. -@return The logical value. -**/ - public Object ptol(Object physicalValue) - { - if (physicalValue == null) - throw new NullPointerException("physicalValue"); - if (!(physicalValue instanceof Integer)) - throw new ExtendedIllegalArgumentException("physicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - int intValue = ((Integer)physicalValue).intValue(); - if (intValue >= 0) - return new Long(intValue); - else - return new Long( ((long)(UPPER_LIMIT_ + (long)intValue))); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/IntegerValueMap.java b/cvsroot/src/com/ibm/as400/resource/IntegerValueMap.java deleted file mode 100644 index 2bdbd30f6..000000000 --- a/cvsroot/src/com/ibm/as400/resource/IntegerValueMap.java +++ /dev/null @@ -1,79 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IntegerValueMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.io.Serializable; - - -/** -The IntegerValueMap class maps between a logical Integer value -and a physical String value. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class IntegerValueMap -implements ValueMap, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - -/** -Maps from a logical value to a physical value. - -@param logicalValue The logical value. -@param system The system. -@return The physical value. -**/ - public Object ltop(Object logicalValue, AS400 system) - { - if (logicalValue == null) - throw new NullPointerException("logicalValue"); - if (!(logicalValue instanceof Integer)) - throw new ExtendedIllegalArgumentException("logicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - return logicalValue.toString(); - } - - - -/** -Maps from a physical value to a logical value. - -@param physicalValue The physical value. -@param system The system. -@return The logical value. -**/ - public Object ptol(Object physicalValue, AS400 system) - { - if (physicalValue == null) - throw new NullPointerException("physicalValue"); - if (!(physicalValue instanceof String)) - throw new ExtendedIllegalArgumentException("physicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - String asString = (String)physicalValue; - if (asString.length() == 0) - return new Integer(0); - else - return new Integer(asString.trim()); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/OptionsValueMap.java b/cvsroot/src/com/ibm/as400/resource/OptionsValueMap.java deleted file mode 100644 index a816e4270..000000000 --- a/cvsroot/src/com/ibm/as400/resource/OptionsValueMap.java +++ /dev/null @@ -1,132 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OptionsValueMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.io.Serializable; -import java.util.Vector; - - - -/** -The QualifiedValueMap class maps between a logical value -which is a String array and a physical value, which is a -single String in which each character indicates either true or false. -**/ -class OptionsValueMap -implements ValueMap, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private char falsePhysicalValue_; - private char truePhysicalValue_; - private String[] possibleLogicalValues_; - - - -/** -Constructs an OptionsValueMap object. - -@param falsePhysicalValue The physical value character indicating false. -@param truePhysicalValue The physical value character indicating true. -@param possibleLogicalValues The possible logical values. -**/ - public OptionsValueMap(char falsePhysicalValue, - char truePhysicalValue, - String[] possibleLogicalValues) - { - falsePhysicalValue_ = falsePhysicalValue; - truePhysicalValue_ = truePhysicalValue; - possibleLogicalValues_ = possibleLogicalValues; - } - - - -/** -Maps from a logical value to a physical value. - -@param logicalValue The logical value. -@param system The system. -@return The physical value. -**/ - public Object ltop(Object logicalValue, AS400 system) - { - // Validate the logical value. - if (logicalValue == null) - throw new NullPointerException("logicalValue"); - if (!(logicalValue instanceof String[])) - throw new ExtendedIllegalArgumentException("logicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - // For each possible logical value, check to see if its specified, - // and build up the physical value. - String[] asArray = (String[])logicalValue; - StringBuffer buffer = new StringBuffer(possibleLogicalValues_.length); - for (int i = 0; i < possibleLogicalValues_.length; ++i) { - boolean found = false; - for(int j = 0; (j < asArray.length) && (!found); ++j) { - if (possibleLogicalValues_[i].equals(asArray[j])) { - found = true; - break; - } - } - buffer.append(found ? truePhysicalValue_ : falsePhysicalValue_); - } - - return buffer.toString(); - } - - - -/** -Maps from a physical value to a logical value. - -@param physicalValue The physical value. -@param system The system. -@return The logical value. -**/ - public Object ptol(Object physicalValue, AS400 system) - { - // Validate the physical value. - if (physicalValue == null) - throw new NullPointerException("physicalValue"); - if (!(physicalValue instanceof String)) - throw new ExtendedIllegalArgumentException("physicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - // For each character in the physical value, check - // to see if it indicates true, and if so, add - // the corresponding option. - String physicalValueS = (String)physicalValue; - int length = Math.max(physicalValueS.length(), possibleLogicalValues_.length); - Vector logicalValuesV = new Vector(length); - for (int i = 0; i < length; ++i) - if (physicalValueS.charAt(i) == truePhysicalValue_) - logicalValuesV.addElement(possibleLogicalValues_[i]); - - // Create the array for the logical values. - String[] logicalValues = new String[logicalValuesV.size()]; - logicalValuesV.copyInto(logicalValues); - return logicalValues; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/PagedListBuffer.java b/cvsroot/src/com/ibm/as400/resource/PagedListBuffer.java deleted file mode 100644 index e2cd1cb3d..000000000 --- a/cvsroot/src/com/ibm/as400/resource/PagedListBuffer.java +++ /dev/null @@ -1,242 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PagedListBuffer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.Trace; -import java.io.Serializable; - - - -/** -The PagedListBuffer class represents a buffer that stores resources in -a set of pages. Each page contains a portion of a resource list. If all -pages are being used and another is needed, the least recently used page is -cleared and reused. - -

      This class can optionally manage a -ResourcePool. It will add and remove entries to the pool as -they are stored and cleared from the buffer. -**/ -// -// Implementation note: -// -// 1. All resource pool registering and deregistering happens in this -// class, because this class is the only one that knows exactly when -// such resources are being paged in/out. -// -class PagedListBuffer -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private boolean clear_; - private int numberOfPages_; - private Resource[][] pages_; - private long[] pageIndices_; - private int pageSize_; - private long[] pageTimestamps_; - - private ResourcePool pool_ = ResourcePool.GLOBAL_RESOURCE_POOL; - - - -/** -Constructs a PagedListBuffer object. - -@param numberOfPages The number of pages. -@param pageSize The page size. -**/ - public PagedListBuffer(int numberOfPages, int pageSize) - { - numberOfPages_ = numberOfPages; - pageSize_ = pageSize; - initialize(); - } - - - -/** -Clears the buffer. -**/ - public void clear() - { - synchronized(this) { - - // Remove all entries from the pool. - if (pool_ != null) { - for (int i = 0; i < numberOfPages_; ++i) - for (int j = 0; j < pageSize_; ++j) { - if (pages_ != null) { - if (pages_[i] != null) - if (pages_[i][j] != null) - pool_.deregister(pages_[i][j]); - } - } - } - - // Re-initialize the buffer. - initialize(); - - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Paged list buffer " + this + " cleared."); - } - } - - - -/** -Finds the page, if any, which should contain the index. - -@param index The resource index. -@return The page number, or -1 if such a page was - not found. -**/ - private int findPage(long index) - { - for (int i = 0; i < numberOfPages_; ++i) { - if ((pageIndices_[i] != -1) - && (pageIndices_[i] <= index) - && (index < pageIndices_[i] + pageSize_)) { - return i; - } - } - return -1; - } - - - -/** -Returns a resource from the buffer. - -@param index The resource index. -@return The resource, or null if the index does not - refer to a resource that is loaded in the - buffer. -**/ - public Resource getResource(long index) - { - synchronized(this) { - int page = findPage(index); - - // If a page was found, then return it. This value could - // still be null in the case where the page was not full. - if (page != -1) - return pages_[page][(int)(index - pageIndices_[page])]; - - // No such page was found, so the resource is not loaded. - return null; - } - } - - - -/** -Initializes the buffer. -**/ - private void initialize() - { - clear_ = true; - pages_ = new Resource[numberOfPages_][]; - pageIndices_ = new long[numberOfPages_]; - pageTimestamps_ = new long[numberOfPages_]; - for (int i = 0; i < numberOfPages_; ++i) { - pages_[i] = null; - pageIndices_[i] = -1; - pageTimestamps_[i] = -1; - } - } - - - -/** -Sets a resource in the buffer. - -@param index The resource index. -@param resource The resource. -**/ - public void setResource(long index, Resource resource) - { - if (resource == null) - throw new NullPointerException("resource"); - - synchronized(this) { - clear_ = false; - - int page = findPage(index); - - // If a page for this index already exists, then just - // set the resource and update its timestamp. - if (page >= 0) { - pages_[page][(int)(index - pageIndices_[page])] = resource; - pageTimestamps_[page] = System.currentTimeMillis(); - if (pool_ != null) - pool_.register(resource); - return; - } - - // If no page exists, check to see if there are any - // pages not being used. - for (int i = 0; i < numberOfPages_; ++i) { - if (pages_[i] == null) { - page = i; - break; - } - } - - // If no pages are available, then remove the least recently - // used page. - if (page < 0) { - long lruTimestamp = System.currentTimeMillis(); - for (int i = 0; i < numberOfPages_; ++i) { - if (pageTimestamps_[i] <= lruTimestamp) { // @A1C - page = i; - lruTimestamp = pageTimestamps_[i]; - } - } - - // Remove the resources on the least recently used page - // from the pool. - if (pool_ != null) { - for (int i = 0; i < pageSize_; ++i) - if (pages_[page][i] != null) - pool_.deregister(pages_[page][i]); - } - - // Force garbage collection for good measure. - for (int i = 0; i < pageSize_; ++i) - pages_[page][i] = null; - pages_[page] = null; -//@B0D System.gc(); - - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Paged list buffer " + this + " swapped out page " + page + "."); - } - - // Create a new page. - pages_[page] = new Resource[pageSize_]; - pages_[page][0] = resource; - pageIndices_[page] = index; - pageTimestamps_[page] = System.currentTimeMillis(); - if (pool_ != null) - pool_.register(resource); - - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Paged list buffer " + this + " created page " + page + "."); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/resource/Presentation.java b/cvsroot/src/com/ibm/as400/resource/Presentation.java deleted file mode 100644 index 4f349a804..000000000 --- a/cvsroot/src/com/ibm/as400/resource/Presentation.java +++ /dev/null @@ -1,323 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Presentation.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import java.io.Serializable; -import java.util.Hashtable; - - - -/** -Represents presentation information that -describes an object. This may include description text, help -text, and icons. In addition, customized information can also -be stored. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class Presentation -implements Serializable -{ - static final long serialVersionUID = 4L; - - // Private data. - private static final String EMPTY_STRING_ = ""; - - private String fullName_ = null; - private Object iconColor16_ = null; - private String iconColor16Name_ = null; - private Object iconColor32_ = null; - private String iconColor32Name_ = null; - private String name_ = EMPTY_STRING_; - private Hashtable values_ = new Hashtable(); - - - -/** -Constant indicating the presentation key for abbreviated name. -**/ - public static final String NAME = "Name"; - - - -/** -Constant indicating the presentation key for full name. -**/ - public static final String FULL_NAME = "Full Name"; - - - -/** -Constant indicating the presentation key for description text. If avaliable, -this represents a String value. -**/ - public static final String DESCRIPTION_TEXT = "Description Text"; - - - -/** -Constant indicating the presentation key for help text. If avaliable, -this represents a String value. -**/ - public static final String HELP_TEXT = "Help Text"; - - - -/** -Constant indicating the presentation key for a 16x16 color icon. If avaliable, -this represents a java.awt.Image value. -**/ - public static final String ICON_COLOR_16x16 = "16"; - - - -/** -Constant indicating the presentation key for a 32x32 color icon. If avaliable, -this represents a java.awt.Image value. -**/ - public static final String ICON_COLOR_32x32 = "32"; - - - -/** -Constructs a Presentation object. -**/ - public Presentation() - { - } - - - -/** -Constructs a Presentation object. - -@param name The abbreviated name. -**/ - public Presentation(String name) - { - if (name == null) - throw new NullPointerException("name"); - - name_ = name; - } - - - -/** -Constructs a Presentation object. - -@param name The abbreviated name. -@param fullName The full name. -**/ - public Presentation(String name, String fullName) - { - if (name == null) - throw new NullPointerException("name"); - if (fullName == null) - throw new NullPointerException("fullName"); - - name_ = name; - fullName_ = fullName; - } - - - -/** -Converts a byte array to a String hexadecimal representation -using 2 characters for each byte. - -@param bytes The byte array. -@return The String hexadecimal representation. -**/ - // - // Implementation note: I stuck this method in this - // class for no particular reason other than it will - // be used most commonly for providing a hex representation - // of a byte array. - // - static String bytesToHex(byte[] bytes) - { - StringBuffer buffer = new StringBuffer(); - buffer.append("0x"); - for(int i = 0; i < bytes.length; ++i) { - int b = 0x000000ff & bytes[i]; - if (b < 16) - buffer.append('0'); - buffer.append(Integer.toHexString(b)); - } - return buffer.toString(); - } - - - -/** -Returns the full name. The length of the full name is usually -greater than or equal to the abbreviated name. - -@return The full name if a full name has been set, - or the abbreviated name if a full name has not been set. -**/ - public String getFullName() - { - if (fullName_ != null) - return fullName_; - else - return name_; - } - - - -/** -Returns the abbreviated name. The length of the abbreviated name is usually -less than or equal to the full name. - -@return The abbreviated name. -**/ - public String getName() - { - return name_; - } - - - -/** -Returns a presentation value. - -@param key The presentation key. -@return The presentation value, or null if no value for the key is set. -**/ - public Object getValue(Object key) - { - if (key == null) - throw new NullPointerException("key"); - - // If the key is in the hashtable, just return its value. - if (values_.containsKey(key)) - return values_.get(key); - - // If the key is name or full name, then return it directly. - else if (key.equals(NAME)) - return getName(); - else if (key.equals(FULL_NAME)) - return getFullName(); - - // If the key is for an icon, and the icon name is set, then - // load the icon and store it in the hashtable. We try to - // put off loading the icon until its asked for. - else if ((key.equals(ICON_COLOR_16x16)) && (iconColor16Name_ != null)) { - iconColor16_ = PresentationLoader.loadIcon(iconColor16Name_); - if (iconColor16_ != null) - values_.put(ICON_COLOR_16x16, iconColor16_); - return iconColor16_; - } - else if ((key.equals(ICON_COLOR_32x32)) && (iconColor32Name_ != null)) { - iconColor32_ = PresentationLoader.loadIcon(iconColor32Name_); - if (iconColor32_ != null) - values_.put(ICON_COLOR_32x32, iconColor32_); - return iconColor32_; - } - - // Otherwise, return null. - else - return null; - } - - - -/** -Sets the color icon names. The icons themselves are not loaded -until the caller requests them. - -@param iconColor16Name The color 16x16 name. -@param iconColor32Name The color 32x32 name. -**/ - void setColorIcons(String iconColor16Name, String iconColor32Name) - { - if (iconColor16Name == null) - throw new NullPointerException("iconColor16Name"); - if (iconColor32Name == null) - throw new NullPointerException("iconColor32Name"); - - iconColor16Name_ = iconColor16Name; - iconColor32Name_ = iconColor32Name; - } - - - -/** -Sets the full name. The length of the full name is usually -greater than or equal to the abbreviated name. - -@param fullName The full name. -**/ - public void setFullName(String fullName) - { - if (fullName == null) - throw new NullPointerException("fullName"); - - fullName_ = fullName; - } - - - -/** -Sets the abbreviated name. The length of the abbreviated name is usually -less than or equal to the full name. - -@param name The abbreviated name. -**/ - public void setName(String name) - { - if (name == null) - throw new NullPointerException("name"); - - name_ = name; - } - - - -/** -Sets a presentation value. - -@param key The presentation key. -@param value The presentation value. -**/ - public void setValue(Object key, Object value) - { - if (key == null) - throw new NullPointerException("key"); - if (value == null) - throw new NullPointerException("value"); - - if (key.equals(NAME)) - name_ = value.toString(); - else if (key.equals(FULL_NAME)) - fullName_ = value.toString(); - else - values_.put(key, value); - } - - - -/** -Returns the abbreviated name. - -@return The abbreviated name. -**/ - public String toString() - { - return name_; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/PresentationLoader.java b/cvsroot/src/com/ibm/as400/resource/PresentationLoader.java deleted file mode 100644 index 198d090bb..000000000 --- a/cvsroot/src/com/ibm/as400/resource/PresentationLoader.java +++ /dev/null @@ -1,390 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PresentationLoader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Trace; -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.io.Serializable; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - - - -/** -The PresentationLoader class is a convenience class for creating -{@link com.ibm.as400.resource.Presentation Presentation} -objects using a resource bundle. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class PresentationLoader -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private static final String DESCRIPTION_SUFFIX = "_DESCRIPTION"; - private static final String FULLNAME_SUFFIX = "_FULLNAME"; - private static final String HELP_SUFFIX = "_HELP"; - private static final String NAME_SUFFIX = "_NAME"; - - private static final String ICON_16_SUFFIX = "16.gif"; - private static final String ICON_32_SUFFIX = "32.gif"; - - private static IconLoader_ iconLoader_; - - private ResourceBundle resourceBundle_; - - - -/** -Constructs a PresentationLoader object. - -@param resourceBundleBaseName The resource bundle base name. -**/ - public PresentationLoader(String resourceBundleBaseName) - { - if (resourceBundleBaseName == null) - throw new NullPointerException("resourceBundleBaseName"); - - resourceBundle_ = ResourceBundle.getBundle(resourceBundleBaseName); - } - - - -/** -Constructs a PresentationLoader object. - -@param resourceBundle The resource bundle. -*/ - public PresentationLoader(ResourceBundle resourceBundle) - { - if (resourceBundle == null) - throw new NullPointerException("resourceBundle"); - - resourceBundle_ = resourceBundle; - } - - - -/** -Returns a Presentation object with text loaded from the resource bundle. -The keys in the resource bundle correspond to the key base name as -follows: - -

      - - - - - - - - - - - - - - - - -
      namekeyBaseName_NAME
      full namekeyBaseName_FULLNAME
      descriptionkeyBaseName_DESCRIPTION
      helpkeyBaseName_HELP
      - -

      All keys are optional. - -@param keyBaseName The key base name. -@return The presentation. -**/ - public Presentation getPresentation(String keyBaseName) - { - if (keyBaseName == null) - throw new NullPointerException("keyBaseName"); - - return newPresentation(keyBaseName, null); - } - - - -/** -Returns a Presentation object with text loaded from the resource bundle. -The keys in the resource bundle correspond to the key base name as -follows: - -

      - - - - - - - - - - - - - - - - -
      namekeyBaseName_NAME
      full namekeyBaseName_FULLNAME
      descriptionkeyBaseName_DESCRIPTION
      helpkeyBaseName_HELP
      - -

      Two icons are loaded, iconFileName16.gif and -iconFileName32.gif. - -

      All keys are optional. - -@param keyBaseName The key base name. -@param iconFileName The icon file name. -@return The presentation. -**/ - public Presentation getPresentationWithIcon(String keyBaseName, String iconFileName) - { - if (keyBaseName == null) - throw new NullPointerException("keyBaseName"); - if (iconFileName == null) - throw new NullPointerException("iconFileName"); - - return newPresentation(keyBaseName, iconFileName); - } - - - -/** -Returns a Presentation object with text loaded from the resource bundle. -The keys in the resource bundle correspond to the key base name and -key suffix as follows: - -

      - - - - - - - - - - - - - - - - -
      namekeyBaseName_keySuffix_NAME
      full namekeyBaseName_keySuffix_FULLNAME
      descriptionkeyBaseName_keySuffix_DESCRIPTION
      helpkeyBaseName_keySuffix_HELP
      - -

      All keys are optional. - -@param keyBaseName The key base name. -@param keySuffix The key suffix. -@return The presentation. -**/ - public Presentation getPresentation(String keyBaseName, String keySuffix) - { - if (keyBaseName == null) - throw new NullPointerException("keyBaseName"); - if (keySuffix == null) - throw new NullPointerException("keySuffix"); - - return newPresentation(newKeyBaseName(keyBaseName, keySuffix), null); - } - - - -/** -Returns a Presentation object with text loaded from the resource bundle. -The keys in the resource bundle correspond to the key base name and -key suffix as follows: - -

      - - - - - - - - - - - - - - - - -
      namekeyBaseName_keySuffix_NAME
      full namekeyBaseName_keySuffix_FULLNAME
      descriptionkeyBaseName_keySuffix_DESCRIPTION
      helpkeyBaseName_keySuffix_HELP
      - -

      Two icons are loaded, iconFileName16.gif and -iconFileName32.gif. - -

      All keys are optional. - -@param keyBaseName The key base name. -@param keySuffix The key suffix. -@param iconFileName The icon file name. -@return The presentation. -**/ - public Presentation getPresentationWithIcon(String keyBaseName, String keySuffix, String iconFileName) - { - if (keyBaseName == null) - throw new NullPointerException("keyBaseName"); - if (keySuffix == null) - throw new NullPointerException("keySuffix"); - if (iconFileName == null) - throw new NullPointerException("iconFileName"); - - return newPresentation(newKeyBaseName(keyBaseName, keySuffix), iconFileName); - } - - - -/** -Returns MRI text. - -@param key The key. -@return The MRI text, or null if the key is not found in the resource bundle. -**/ - private String getString(String key) - { - try { - return resourceBundle_.getString(key); - } - catch(MissingResourceException e) { - return null; - } - } - - - -/** -Loads an icon. - -@param iconFileName The icon file name. -@return The icon, or null if unable. -**/ -// -// Implementation note: For some reason (at least with JDK 1.2.2), this -// ends up leaving a non-daemon AWT thread around. -// I am not sure why and how to avoid it. -// - static Image loadIcon(String iconFileName) - { - if (iconFileName == null) - throw new NullPointerException("iconFileName"); - - if (iconLoader_ == null) - iconLoader_ = new IconLoader_(); - try { - return iconLoader_.loadImage(iconFileName); - } - catch(Exception e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Unable to load icon: " + iconFileName, e); - return null; - } - } - - - -/** -Creates and returns a new key base name in the form: - -

      keyBaseName_keySuffix - -@param keyBaseName The key base name. -@param keySuffix The key suffix. -@return The new key base name. -**/ - private static String newKeyBaseName(String keyBaseName, String keySuffix) - { - StringBuffer buffer = new StringBuffer(); - buffer.append(keyBaseName); - buffer.append('_'); - buffer.append(keySuffix); - return buffer.toString(); - } - - -/** -Creates and returns a new presentation. - -@param keyBaseName The key base name. -@param iconBaseName The icon base name. -@return The presentation. -**/ - private Presentation newPresentation(String keyBaseName, String iconBaseName) - { - String name = getString(keyBaseName + NAME_SUFFIX); - String fullName = getString(keyBaseName + FULLNAME_SUFFIX); - String description = getString(keyBaseName + DESCRIPTION_SUFFIX); - String help = getString(keyBaseName + HELP_SUFFIX); - - // If neither a name, full name, nor description are found, - // then throw an exception. This is probably missing MRI. - if ((name == null) && (fullName == null) && (description == null)) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Unable to load presentation for " + keyBaseName); - throw new ExtendedIllegalArgumentException("keyBaseName", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Create the presentation object. - Presentation presentation = new Presentation(); - if (name != null) - presentation.setName(name); - if (fullName != null) - presentation.setFullName(fullName); - if (description != null) - presentation.setValue(Presentation.DESCRIPTION_TEXT, description); - if (help != null) - presentation.setValue(Presentation.HELP_TEXT, help); - - // We don't load the icon now. Instead, we wait until the caller - // asks for it. This improves performance for sure. But it also - // solves problems like AWT not being around when running on a server - // (since a server Java program will never probably ask for the - // icon). - if (iconBaseName != null) - presentation.setColorIcons(iconBaseName + ICON_16_SUFFIX, iconBaseName + ICON_32_SUFFIX); - - return presentation; - } - - - -/** -Loads icons as needed. -**/ -// -// Implementation note: -// -// SimpleBeanInfo was the only JDK 1.1 way I could figure out to easily load images. -// This class needs to be in our package in order to load icons from our package, -// which is why I subclassed SimpleBeanInfo instead of just instantiating a -// SimpleBeanInfo object directly. -// - private static class IconLoader_ extends SimpleBeanInfo - { } - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ProgramAttributeGetter.java b/cvsroot/src/com/ibm/as400/resource/ProgramAttributeGetter.java deleted file mode 100644 index 86f7f92a9..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ProgramAttributeGetter.java +++ /dev/null @@ -1,185 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProgramAttributeGetter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400BidiTransform; -import com.ibm.as400.access.Trace; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.io.Serializable; -import java.util.Vector; - - - -/** -The ProgramAttributeGetter class gets attribute values by calling a -program on the system. The program call is specified using Program Call -Markup Language (PCML). - -

      This class uses a {@link com.ibm.as400.resource.ProgramMap ProgramMap} -object to define how attribute values are -specified in the PCML definition. This class is intended as a helper -class for implementing subclasses of {@link com.ibm.as400.resource.Resource Resource}. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class ProgramAttributeGetter -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private ProgramMap attributeMap_ = null; - private ProgramCallDocument document_ = null; - private Vector programsCalled_ = new Vector(); - private AS400 system_ = null; - - - -/** -Constructs a ProgramAttributeGetter object. - -@param system The system. -@param document The PCML document. -@param attributeMap The attribute map. -**/ - public ProgramAttributeGetter(AS400 system, - ProgramCallDocument document, - ProgramMap attributeMap) - { - if (system == null) - throw new NullPointerException("system"); - if (document == null) - throw new NullPointerException("document"); - if (attributeMap == null) - throw new NullPointerException("attributeMap"); - - system_ = system; - document_ = document; - attributeMap_ = attributeMap; - } - - - -/** -Clears any buffered attribute values. Calling this method -ensures that subsequent calls to getValues() are current. -**/ - public void clearBuffer() - { - programsCalled_.removeAllElements(); - } - - - -// @A2C -/** -Returns an attribute value. - -@param attributeID The attribute ID. -@return The attribute value. - -@exception ResourceException If an error occurs. -**/ - public Object getValue(Object attributeID) - throws ResourceException - { - return getValue(attributeID, AS400BidiTransform.getStringType((char)system_.getCcsid())); - } - - - -// @A2A -/** -Returns an attribute value. - -@param attributeID The attribute ID. -@param bidiStringType The bidi string type as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. -@return The attribute value. - -@exception ResourceException If an error occurs. -**/ - public Object getValue(Object attributeID, int bidiStringType) - throws ResourceException - { - if (attributeID == null) - throw new NullPointerException("attributeID"); - - synchronized(this) { - ProgramMapEntry entries[] = attributeMap_.getEntries(attributeID); - int indexUsed = -1; - - // If the definitions include a program that has already been called, - // then that is good enough. - String programName = null; - for(int j = 0; j < entries.length; ++j) { - programName = entries[j].getProgramName(); - if (programsCalled_.contains(programName)) { - indexUsed = j; - - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Getting attribute value " + attributeID + " using PCML document " - + document_ + ", program " + programName + " (which has already been called)."); - break; - } - } - - // If none of the potential programs have been called, then - // pick the first one and call it. - if (indexUsed < 0) { - indexUsed = 0; - programName = entries[0].getProgramName(); - - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Getting attribute value " + attributeID + " using PCML document " - + document_ + ", program " + programName + " (which is about to be called)."); - - boolean success = false; - try { - success = document_.callProgram(programName); - if (! success) - throw new ResourceException(document_.getMessageList(programName)); - programsCalled_.addElement(programName); - } - catch (ResourceException re) { // avoid re-wrappering - throw re; - } - catch (Exception e) { - throw new ResourceException(ResourceException.ATTRIBUTES_NOT_RETURNED, e); - } - } - - // Get the value from the PCML document. - try { - return entries[indexUsed].getValue(system_, document_, null, null, bidiStringType); // @A2C - } - catch (PcmlException e) { - throw new ResourceException(ResourceException.ATTRIBUTES_NOT_RETURNED, e); - } - } - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ProgramAttributeSetter.java b/cvsroot/src/com/ibm/as400/resource/ProgramAttributeSetter.java deleted file mode 100644 index 26f244672..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ProgramAttributeSetter.java +++ /dev/null @@ -1,253 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProgramAttributeSetter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400BidiTransform; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Trace; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.io.Serializable; -import java.util.Enumeration; -import java.util.Vector; - - - -/** -The ProgramAttributeSetter class sets attribute values by calling a -program on the system. The program call is specified using Program Call -Markup Language (PCML). - -

      This class uses a {@link com.ibm.as400.resource.ProgramMap ProgramMap} -object to define how attribute values are -specified in the PCML definition. This class is intended as a helper -class for implementing subclasses of {@link com.ibm.as400.resource.Resource Resource}. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class ProgramAttributeSetter -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private ProgramMap attributeMap_ = null; - private int defaultBidiStringType_ = -1; // @A2A - private ProgramCallDocument document_ = null; - private AS400 system_ = null; - - - -/** -Constructs a ProgramAttributeSetter object. - -@param system The system. -@param document The PCML document. -@param attributeMap The attribute map. -**/ - public ProgramAttributeSetter(AS400 system, - ProgramCallDocument document, - ProgramMap attributeMap) - { - if (system == null) - throw new NullPointerException("system"); - if (document == null) - throw new NullPointerException("document"); - if (attributeMap == null) - throw new NullPointerException("attributeMap"); - - system_ = system; - document_ = document; - attributeMap_ = attributeMap; - } - - - -/** -Initializes the attribute values for the setter. -This is useful for "setter" programs that have multiple fields, all of which must contain valid values. - -@param attributeGetter The attribute getter with which to retrieve the current values from the system. - -@exception ResourceException If an error occurs. -**/ - public void initializeAttributeValues(ProgramAttributeGetter attributeGetter) - throws ResourceException - { - initializeAttributeValues(attributeGetter, null); - } - - - -/** -Initializes the attribute values for the setter. -This is useful for "setter" programs that have multiple fields, all of which must contain valid values. - -@param attributeGetter The attribute getter with which to retrieve the current values from the system. -@param attrsToInitializeFirst The IDs of the attributes to initialize first, in desired order of initialization. These will typically be "length of another field" attributes. - -@exception ResourceException If an error occurs. -**/ - public void initializeAttributeValues(ProgramAttributeGetter attributeGetter, Object[] attrsToInitializeFirst) - throws ResourceException - { - attributeGetter.clearBuffer(); - if (defaultBidiStringType_ == -1) // @A2A - defaultBidiStringType_ = AS400BidiTransform.getStringType((char)system_.getCcsid()); // @A2A - - try - { - synchronized(this) { - Object[] attrIDs = attributeMap_.getIDs(); - - // First rearrange the ids into the desired order of initialization. - if (attrsToInitializeFirst != null) - { - for (int i=0; iThis class uses a {@link com.ibm.as400.resource.ProgramKeys ProgramKeys} -object to define how attribute values are -specified in the PCML definition. This class is intended as a helper -class for implementing subclasses of {@link com.ibm.as400.resource.Resource Resource}. -**/ -// -// Implementation notes: -// -// * This class is package-scope. I did not make it public because I -// am not convinced that it is needed for general purpose components. -// -class ProgramKeyAttributeSetter -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private static final String numberOfKeysDataName_ = "numberOfKeys"; - private static final String contentsDataName_ = "contents"; - - private ProgramKeys attributeKeys_ = null; - private CharConverter charConverter_ = null; - private ProgramCallDocument document_ = null; - private String keysDataName_ = null; - private String programName_ = null; - private AS400 system_ = null; - - - -/** -Constructs a ProgramKeyAttributeSetter object. - -@param system The system. -@param documentName The PCML document. -@param programName The program name. -@param keysDataName The keys data name. -@param attributeKeys The attribute keys. -**/ - public ProgramKeyAttributeSetter(AS400 system, - ProgramCallDocument document, - String programName, - String keysDataName, - ProgramKeys attributeKeys) - { - if (system == null) - throw new NullPointerException("system"); - if (document == null) - throw new NullPointerException("document"); - if (programName == null) - throw new NullPointerException("programName"); - if (keysDataName == null) - throw new NullPointerException("keysDataName"); - if (attributeKeys == null) - throw new NullPointerException("attributeKeys"); - - document_ = document; - keysDataName_ = keysDataName; - programName_ = programName; - attributeKeys_ = attributeKeys; - system_ = system; - - try { - charConverter_ = new CharConverter(system.getCcsid(), system); - } - catch(UnsupportedEncodingException e) { - // Just trace this, since we are using the CCSID reported by - // the system. - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error setting system on program attribute setter", e); - } - - } - - - -/** -Pads a String to an exact length. - -@param value The original String. -@param length The padded length. -@return The padded String. -**/ - private static String pad(String value, int length) - { - StringBuffer buffer = new StringBuffer(value); - for(int i = value.length(); i < length; ++i) - buffer.append(' '); - return buffer.toString(); - } - - - -// @A2C -/** -Sets the attribute values. The system must be set before this is called. - -@param attributeIDs The attribute IDs. -@param values The values. This array must contain the same number of - elements as attributeIDs. -@param bidiStringTypes The bidi string types as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. - -@exception ResourceException If an error occurs. -**/ - public void setValues(Object[] attributeIDs, Object[] values, int[] bidiStringTypes) - throws ResourceException - { - if (attributeIDs == null) - throw new NullPointerException("attributeIDs"); - if (values == null) - throw new NullPointerException("values"); - if (attributeIDs.length != values.length) - throw new ExtendedIllegalArgumentException("values", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if (charConverter_ == null) - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - // If there is nothing to set, then do nothing. - if (attributeIDs.length == 0) - return; - - try { - synchronized(this) { - - // Come up with a list of actual keys to write. - Hashtable actualValues = new Hashtable(); - Hashtable stringTypes = new Hashtable(); - for (int i = 0; i < attributeIDs.length; ++i) { - int[] keys = attributeKeys_.getKeys(attributeIDs[i]); - int[] types = attributeKeys_.getTypes(attributeIDs[i]); - int[] lengths = attributeKeys_.getLengths(attributeIDs[i]); - ValueMap[] valueMaps= attributeKeys_.getValueMaps(attributeIDs[i]); - - // For each of the keys returned... - for(int j = 0; j < keys.length; ++j) { - - // Pass the value through the value map if needed. - Object value = values[i]; - if (valueMaps != null) - if (valueMaps[j] != null) - value = valueMaps[j].ltop(values[i], system_); - - // For BINARY and CHAR, just add the actual value. For qualifieds, store - // the value away until both parts have been specified. - switch(types[j]) { - case ProgramKeys.BINARY: - actualValues.put(new Integer(keys[j]), value); - break; - case ProgramKeys.CHAR: - Integer key = new Integer(keys[j]); - actualValues.put(key, pad((String)value, lengths[j])); - stringTypes.put(key, new Integer(bidiStringTypes[i])); - break; - default: - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error setting attribute " + attributeIDs[i] + ", type = " + types[i]); - } - } - } - - // Set the number of keys. - StringBuffer buffer = new StringBuffer(); - buffer.append(programName_); - buffer.append('.'); - buffer.append(keysDataName_); - buffer.append('.'); - - document_.setIntValue(buffer.toString() + numberOfKeysDataName_, actualValues.size()); - - // Set the keys in the PCML document. - String programAndContentsDataName = buffer.toString() + contentsDataName_; - Enumeration keys = actualValues.keys(); - for (int i = 0; keys.hasMoreElements(); ++i) { - Integer key = (Integer)keys.nextElement(); - int[] indices = new int[] { i }; - Object value = actualValues.get(key); - Integer stringType = (Integer)stringTypes.get(key); // @A2A - - document_.setIntValue(programAndContentsDataName + ".key", indices, key.intValue()); - if (value instanceof Integer) { - document_.setIntValue(programAndContentsDataName + ".lengthOfAttributeInformation", indices, 20); - document_.setValue(programAndContentsDataName + ".type", indices, "B"); - document_.setIntValue(programAndContentsDataName + ".length", indices, 4); - document_.setValue(programAndContentsDataName + ".data", indices, BinaryConverter.intToByteArray(((Integer)value).intValue())); - } - else if (value instanceof String) { - int length = ((String)value).length(); - document_.setIntValue(programAndContentsDataName + ".lengthOfAttributeInformation", indices, length + 16); - document_.setValue(programAndContentsDataName + ".type", indices, "C"); - document_.setIntValue(programAndContentsDataName + ".length", indices, length); - document_.setValue(programAndContentsDataName + ".data", indices, charConverter_.stringToByteArray((String)value, stringType.intValue())); // @A2C - } - else { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error setting attribute with key " + key + ", value class = " + value.getClass()); - } - - } - - } - // Set the number of keys. - boolean success = document_.callProgram(programName_); - if (! success) - throw new ResourceException(document_.getMessageList(programName_)); - } - catch(PcmlException e) { - throw new ResourceException(e); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ProgramKeys.java b/cvsroot/src/com/ibm/as400/resource/ProgramKeys.java deleted file mode 100644 index 5bc7cba43..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ProgramKeys.java +++ /dev/null @@ -1,232 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProgramKeys.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.util.Hashtable; -import java.util.Vector; -import java.io.Serializable; - - - - -/** -Represents a map between logical values (e.g. -Resource attribute values) and keys for a program call. This is -useful for system APIs which allow values to be set using a key. -Each logical value is referred to by a logical ID in the map. -**/ -class ProgramKeys implements Serializable -{ - -/** -Constant indicating the type for binary data. -**/ - public static final int BINARY = 0; - - - -/** -Constant indicating the type for character data. -**/ - public static final int CHAR = 1; - - - - // Private data. - private Hashtable map_ = new Hashtable(); - private Hashtable vms_ = new Hashtable(); - - - -/** -Adds a key. The length is 4 for BINARY attributes and -10 for CHAR attributes. - -@param id Identifies the logical value. -@param key The key. -@param type The attribute type. Possible values are: -

        -
      • BINARY -
      • CHAR -
      -**/ - public void add(Object id, int key, int type) - { - add(id, key, type, (type == BINARY) ? 4 : 10, null); - } - - - -/** -Adds a key. - -@param id Identifies the logical value. -@param key The key. -@param type The attribute type. Possible values are: -
        -
      • BINARY -
      • CHAR -
      -@param length The length. -**/ - public void add(Object id, int key, int type, int length) - { - add(id, key, type, length, null); - } - - - -/** -Adds a key. - -@param id Identifies the logical value. -@param key The key. -@param type The attribute type. Possible values are: -
        -
      • BINARY -
      • CHAR -
      -@param length The length. -@param valueMap The value map, or null if none. -**/ - public void add(Object id, int key, int type, int length, ValueMap valueMap) - { - // Validate the parameters. - if (id == null) - throw new NullPointerException("id"); - if ((type < BINARY) && (type > CHAR)) - throw new ExtendedIllegalArgumentException("type", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if (length <= 0) - throw new ExtendedIllegalArgumentException("length", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - // Store the key in the hashtable. The key is the id, - // and the element is a 3 int array with one element - // each for key, type, and length. - Vector v = null; - if (map_.containsKey(id)) - v = (Vector)map_.get(id); - else { - v = new Vector(); - map_.put(id, v); - } - v.addElement(new int[] { key, type, length }); - - if (valueMap != null) { - Vector v2 = null; - if (vms_.containsKey(id)) - v2 = (Vector)vms_.get(id); - else { - v2 = new Vector(); - vms_.put(id, v2); - } - v2.addElement(valueMap); - } - } - - - -/** -Returns the keys associated with the specified logical value. - -@param id Identifies the logical value. -@return The keys. -**/ - public int[] getKeys(Object id) - { - if (id == null) - throw new NullPointerException("id"); - if (!map_.containsKey(id)) - throw new ExtendedIllegalArgumentException("id", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - Vector v = (Vector)map_.get(id); - int[] keys = new int[v.size()]; - for(int i = 0; i < keys.length; ++i) - keys[i] = ((int[])v.elementAt(i))[0]; - return keys; - } - - - -/** -Returns the lengths associated with the specified logical value. - -@param id Identifies the logical value. -@return The lengths. -**/ - public int[] getLengths(Object id) - { - if (id == null) - throw new NullPointerException("id"); - if (!map_.containsKey(id)) - throw new ExtendedIllegalArgumentException("id", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - Vector v = (Vector)map_.get(id); - int[] lengths = new int[v.size()]; - for(int i = 0; i < lengths.length; ++i) - lengths[i] = ((int[])v.elementAt(i))[2]; - return lengths; - } - - - -/** -Returns the types associated with the specified logical value. - -@param id Identifies the logical value. -@return The types. -**/ - public int[] getTypes(Object id) - { - if (id == null) - throw new NullPointerException("id"); - if (!map_.containsKey(id)) - throw new ExtendedIllegalArgumentException("id", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - Vector v = (Vector)map_.get(id); - int[] types = new int[v.size()]; - for(int i = 0; i < types.length; ++i) - types[i] = ((int[])v.elementAt(i))[1]; - return types; - } - - - -/** -Returns the value maps associated with the specified logical value. - -@param id Identifies the logical value. -@return The value map. -**/ - public ValueMap[] getValueMaps(Object id) - { - if (id == null) - throw new NullPointerException("id"); - if (!map_.containsKey(id)) - throw new ExtendedIllegalArgumentException("id", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - if (vms_.containsKey(id)) { - Vector v = (Vector)vms_.get(id); - ValueMap[] valueMaps = new ValueMap[v.size()]; - for(int i = 0; i < valueMaps.length; ++i) - valueMaps[i] = (ValueMap)v.elementAt(i); - return valueMaps; - } - else - return null; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ProgramMap.java b/cvsroot/src/com/ibm/as400/resource/ProgramMap.java deleted file mode 100644 index 7bcfd6983..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ProgramMap.java +++ /dev/null @@ -1,447 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProgramMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400BidiTransform; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.io.Serializable; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - - - -/** -The ProgramMap class represents a map between logical values such -as {@link com.ibm.as400.resource.Resource Resource} -attribute values and data in a PCML document. Each logical value is -referred to by a logical ID in the map. A logical value may map to -multiple pieces of data in a PCML document. - -

      This class is intended as a helper class for implementing subclasses -of {@link com.ibm.as400.resource.Resource Resource}. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class ProgramMap -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private Hashtable table_ = new Hashtable(); - private Object[] ids_ = null; - private Vector idsV_ = new Vector(); - - - -/** -Adds a map entry. - -@param id Identifies the logical value. -@param programName The program name in the PCML definition. -@param dataName The data name in the PCML definition. -**/ - public void add(Object id, String programName, String dataName) - { - // Validate the parameters. - if (dataName == null) - throw new NullPointerException("dataName"); - - add(id, new ProgramMapEntry(programName, dataName, (int[])null, null, null)); - } - - - -/** -Adds a map entry. - -@param id Identifies the logical value. -@param programName The program name in the PCML definition. -@param dataName The data name in the PCML definition. -@param valueMap The value map, or null if there is none. -**/ - public void add(Object id, String programName, String dataName, ValueMap valueMap) - { - // Validate the parameters. - if (dataName == null) - throw new NullPointerException("dataName"); - - add(id, new ProgramMapEntry(programName, dataName, (int[])null, valueMap, null)); - } - - - -/** -Adds a map entry. - -@param id Identifies the logical value. -@param programName The program name in the PCML definition. -@param dataName The data name in the PCML definition. -@param valueMap The value map, or null if there is none. -@param level The level where this entry is valid, or null if this - entry is always valid. -**/ - public void add(Object id, String programName, String dataName, ValueMap valueMap, ResourceLevel level) - { - // Validate the parameters. - if (dataName == null) - throw new NullPointerException("dataName"); - - add(id, new ProgramMapEntry(programName, dataName, (int[])null, valueMap, level)); - } - - - -/** -Adds a map entry. - -@param id Identifies the logical value. -@param programName The program name in the PCML definition. -@param dataName The data name in the PCML definition. -@param indices The indices in the PCML definition, or null if there are none. -**/ - public void add(Object id, String programName, String dataName, int[] indices) - { - // Validate the parameters. - if (dataName == null) - throw new NullPointerException("dataName"); - - add(id, new ProgramMapEntry(programName, dataName, indices, null, null)); - } - - - -/** -Adds a map entry for array elements. - -@param id Identifies the logical value. -@param programName The program name in the PCML definition. -@param dataName The data name in the PCML definition. -@param countName The data name in the PCML defintion which specifies - the size of the array. -@param map The value map, or null if there is none. -**/ - public void add(Object id, String programName, String dataName, String countName, ValueMap map) - { - // Validate the parameters. - if (dataName == null) - throw new NullPointerException("dataName"); - - add(id, new ProgramMapEntry(programName, dataName, countName, map, null)); - } - - - -/** -Adds a map entry for array elements. - -@param id Identifies the logical value. -@param programName The program name in the PCML definition. -@param dataName The data name in the PCML definition. -@param countName The data name in the PCML defintion which specifies - the size of the array. -**/ - public void add(Object id, String programName, String dataName, String countName) - { - // Validate the parameters. - if (dataName == null) - throw new NullPointerException("dataName"); - - add(id, new ProgramMapEntry(programName, dataName, countName, null, null)); - } - - - -/** -Adds a map entry. - -@param id Identifies the logical value. -@param programName The program name in the PCML definition, or null - if it will be filled in later. -@param dataName The data name in the PCML definition. -@param indices The indices in the PCML definition, or null if there are none. -@param valueMap The value map, or null if there is none. -**/ - public void add(Object id, String programName, String dataName, int[] indices, ValueMap valueMap) - { - // Validate the parameters. - if (dataName == null) - throw new NullPointerException("dataName"); - - add(id, new ProgramMapEntry(programName, dataName, indices, valueMap, null)); - } - - - - -/** -Adds a map entry. - -@param id Identifies the logical value. -@param entry The entry. -**/ - private synchronized void add(Object id, ProgramMapEntry entry) - { - // Validate the parameters. - if (id == null) - throw new NullPointerException("id"); - if (entry == null) - throw new NullPointerException("entry"); - - // Add the entry to the table. The table is a hashtable where the keys - // are IDs, and the elements are each a Vector with a list of entries. - // This Vector is necessary to account for IDs that map to multiple - // entries. - Vector entriesV; - if (table_.containsKey(id)) - entriesV = (Vector)table_.get(id); - else { - entriesV = new Vector(); - table_.put(id, entriesV); - } - - entriesV.addElement(entry); - idsV_.addElement(id); - - // Since we changed the list, reset the array to null to force it to be - // rebuilt the next time it is needed. - ids_ = null; - } - - - - -/** -Returns the map entries for a particular logical value. - -@param id Identifies the logical value. -@return The entries. -**/ - ProgramMapEntry[] getEntries(Object id) - { - // Validate the parameter. - if (id == null) - throw new NullPointerException("id"); - if (! table_.containsKey(id)) - throw new ExtendedIllegalArgumentException("id", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - // Take the Vector element from the hashtable and turn it - // into an array. - Vector entriesV = (Vector)table_.get(id); - ProgramMapEntry[] entries = new ProgramMapEntry[entriesV.size()]; - entriesV.copyInto(entries); - return entries; - } - - - -/** -Returns the list of IDs in the map. - -@return The list of IDs. -**/ - public synchronized Object[] getIDs() - { - // If the array needs to be created, do so here. - // We will keep it around in case its needed again. - if (ids_ == null) { - ids_ = new Object[idsV_.size()]; - idsV_.copyInto(ids_); - } - return ids_; - } - - - -/** -Returns the list of IDs in the map which match a specific level. - -@return The list of IDs. -**/ - synchronized Object[] getIDs(String level) - { - Vector subset = new Vector(idsV_.size()); - Enumeration enum1 = idsV_.elements(); - while(enum1.hasMoreElements()) { - Object id = enum1.nextElement(); - Vector entries = (Vector)table_.get(id); - Enumeration enum2 = entries.elements(); - while(enum2.hasMoreElements()) { - ProgramMapEntry entry = (ProgramMapEntry)enum2.nextElement(); - if (entry.getLevel().checkLevel(level)) { - if (!subset.contains(id)) - subset.addElement(id); - } - } - } - - Object[] ids = new Object[subset.size()]; - subset.copyInto(ids); - return ids; - } - - - -/** -Get a set of values from the PCML document and map them to -the appropriate logical values. - -@param ids Identifies the logical values. -@param system The system. -@param document The PCML document. -@param programName The PCML program name, or null if - the program name is specified as - part of the entry. -@param indices The indices, or null if not applicable, - or if the indices are specified as - part of the entry. -**/ - public Object[] getValues(Object[] ids, - AS400 system, - ProgramCallDocument document, - String programName, - int[] indices) - throws PcmlException - { - // Validate the parameters. - if (ids == null) - throw new NullPointerException("ids"); - if (document == null) - throw new NullPointerException("document"); - - int bidiStringType = AS400BidiTransform.getStringType((char)system.getCcsid()); // @A2A - - // Loop for each specified id... - Object[] values = new Object[ids.length]; - for(int i = 0; i < ids.length; ++i) { - if (!table_.containsKey(ids[i])) - throw new ExtendedIllegalArgumentException("ids[" + i + "]", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - // Loop for each entry associated with the id... - Vector entriesV = (Vector)table_.get(ids[i]); - Enumeration entries = entriesV.elements(); - while(entries.hasMoreElements()) { - ProgramMapEntry entry = (ProgramMapEntry)entries.nextElement(); - String entryProgramName = entry.getProgramName(); - - // If no program name was specified here or in the entry, - // then use the first entry. - if ((programName == null) || (entryProgramName == null)) { - values[i] = entry.getValue(system, document, programName, indices, bidiStringType); // @A2C - break; - } - - // Otherwise, find the one that matches. - else if (programName.equals(entry.getProgramName())) { - values[i] = entry.getValue(system, document, programName, indices, bidiStringType); // @A2C - break; - } - } - - // If no value was assigned, it means something is not - // quite right with the map. - if (values[i] == null) - throw new ExtendedIllegalArgumentException("values[" + i + "]", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - return values; - } - - - -/** -Set a set of values in the PCML document and map them from -the appropriate logical values. - -@param ids Identifies the logical values. -@param values The logical values. -@param system The system. -@param document The PCML document. -@param programName The PCML program name, or null if - the program name is specified as - part of the entry. -@param indices The indices, or null if not applicable, - or if the indices are specified as - part of the entry. -@param bidiStringTypes The bidi string types as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. -**/ - void setValues(Object[] ids, - Object[] values, - AS400 system, - ProgramCallDocument document, - String programName, - int[] indices, - int[] bidiStringTypes) // @A2A - throws PcmlException - { - // Validate the parameters. - if (ids == null) - throw new NullPointerException("ids"); - if (values == null) - throw new NullPointerException("values"); - if (ids.length != values.length) - throw new ExtendedIllegalArgumentException("values", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if (ids.length != bidiStringTypes.length) - throw new ExtendedIllegalArgumentException("bidiStringTypes", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if (document == null) - throw new NullPointerException("document"); - - // Loop for each specified id... - for(int i = 0; i < ids.length; ++i) { - if (table_.containsKey(ids[i])) { - - // Loop for each entry associated with the id... - Vector entriesV = (Vector)table_.get(ids[i]); - Enumeration entries = entriesV.elements(); - while(entries.hasMoreElements()) { - ProgramMapEntry entry = (ProgramMapEntry)entries.nextElement(); - String entryProgramName = entry.getProgramName(); - - // If no program name was specified here or in the entry, - // then use the first entry. - if (programName == null) { - entry.setValue(system, document, entryProgramName, indices, values[i], bidiStringTypes[i]); // @A2C - break; - } - else if (entryProgramName == null) { - entry.setValue(system, document, programName, indices, values[i], bidiStringTypes[i]); // @A2C - break; - } - - // Otherwise, find the one that matches. - else if (programName.equals(entry.getProgramName())) { - entry.setValue(system, document, programName, indices, values[i], bidiStringTypes[i]); // @A2C - break; - } - } - } - } - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ProgramMapEntry.java b/cvsroot/src/com/ibm/as400/resource/ProgramMapEntry.java deleted file mode 100644 index 9055bf96a..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ProgramMapEntry.java +++ /dev/null @@ -1,311 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProgramMapEntry.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.data.Descriptor; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.io.Serializable; - - - -/** -The ProgramMapEntry class represents an entry in a ProgramMap. -It contains references to the following items relating to data -in a PCML document: - -

        -
      • program name (optional) -
      • data name -
      • indices (optional) OR count name (optional) -
      • value map (optional) -
      • level (optional) -
      -**/ -class ProgramMapEntry -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private static final ResourceLevel defaultLevel_ = new ResourceLevel(); - - private String programName_ = null; - private String dataName_ = null; - private int[] indices_ = null; - private String countName_ = null; - private ResourceLevel level_ = null; - private ValueMap valueMap_ = null; - - - -/** -Constructs a ProgramMapEntry object. - -@param programName The program name, or null if this should be filled in later. -@param dataName The data name. -@param indices The indices, or null if not applicable, or if these should be - filled in later. -@param valueMap The value map, or null if not applicable. -@param level The level where this meta data is valid, or null if this is - always valid. -**/ - public ProgramMapEntry(String programName, - String dataName, - int[] indices, - ValueMap valueMap, - ResourceLevel level) - { - if (dataName == null) - throw new NullPointerException("dataName"); - - programName_ = programName; - dataName_ = dataName; - indices_ = indices; - countName_ = null; - valueMap_ = valueMap; - - if (level == null) - level_ = defaultLevel_; - else - level_ = level; - } - - - -/** -Constructs a ProgramMapEntry object. - -@param programName The program name, or null if this should be filled in later. -@param dataName The data name. -@param countName The data name in the PCML definition which specifies - the size of the array, or null if not applicable. -@param valueMap The value map, or null if not applicable. -@param level The level where this meta data is valid, or null if this is always valid. -**/ - public ProgramMapEntry(String programName, - String dataName, - String countName, - ValueMap valueMap, - ResourceLevel level) - { - if (dataName == null) - throw new NullPointerException("dataName"); - - programName_ = programName; - dataName_ = dataName; - indices_ = null; - countName_ = countName; - valueMap_ = valueMap; - - if (level == null) - level_ = defaultLevel_; - else - level_ = level; - } - - - -/** -Returns the program name. - -@return The program name, or null if none has been set. -**/ - public String getProgramName() - { - return programName_; - } - - - -/** -Returns the level. - -@return The level. -**/ - public ResourceLevel getLevel() - { - return level_; - } - - - -// @A2C -/** -Returns the logical value directly from the PCML document. - -@param system The system. -@param document The PCML document. -@param programName The program name, or null if it was already specified. -@param indices The indices, or null if not applicable, or if they were - already specified. -@param bidiStringType The bidi string type as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. -@return The logical value. - -@throws PcmlException If an error occurs. -**/ - public Object getValue(AS400 system, - ProgramCallDocument document, - String programName, - int[] indices, - int bidiStringType) - throws PcmlException - { - Object value; - - // Determine the program name to use. If the program name was specified - // here AND in the constructor, then something is not working as intended. - if ((programName != null) && (programName_ != null)) - throw new ExtendedIllegalArgumentException("programName", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - StringBuffer buffer = new StringBuffer(); - buffer.append((programName == null) ? programName_ : programName); - buffer.append('.'); - buffer.append(dataName_); - String programNameAndDataName = buffer.toString(); - - // Determine the indices to use. If the program name was specified - // here AND in the constructor, then something is not working as intended. - if ((indices != null) && (indices_ != null)) - throw new ExtendedIllegalArgumentException("indices", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - int[] indicesToUse = (indices == null) ? indices_ : indices; - - // If a count name was not specified, then just get the single value from - // the PCML document. Otherwise, get multiple values and pack them into - // an array. - if ((indicesToUse == null) && (countName_ == null)) { // @A3C - if (isStringValue(document, programNameAndDataName)) // @A3A - value = document.getStringValue(programNameAndDataName, bidiStringType); // @A2C - else // @A3A - value = document.getValue(programNameAndDataName); // @A3A - } // @A3A - else if (countName_ == null) { // @A3C - if (isStringValue(document, programNameAndDataName)) // @A3A - value = document.getStringValue(programNameAndDataName, indicesToUse, bidiStringType); // @A2C - else // @A3A - value = document.getValue(programNameAndDataName, indicesToUse); // @A3A - } // @A3A - - else { - buffer = new StringBuffer(); - buffer.append((programName == null) ? programName_ : programName); - buffer.append('.'); - buffer.append(countName_); - String programNameAndCountName = buffer.toString(); - - int count = document.getIntValue(programNameAndCountName); - Object[] tempValue = new Object[count]; - for(int i = 0; i < count; ++i) - tempValue[i] = document.getValue(programNameAndDataName, new int[] { i }); - value = tempValue; - } - - // Map the physical value to its logical value. - if (valueMap_ != null) - value = valueMap_.ptol(value, system); - - return value; - } - - - - // @A3A - private static boolean isStringValue(ProgramCallDocument document, String programNameAndDataName) - { - Descriptor descriptor = document.getDescriptor().getDescriptor(programNameAndDataName); - if (descriptor == null) - return false; - String type = descriptor.getAttributeValue("type"); - if (type == null) - return false; - return type.equals("string"); - } - - - - -// @A2C -/** -Sets the logical value directly in the PCML document. - -@param system The system. -@param document The PCML document. -@param programName The program name, or null if it was already specified. -@param indices The indices, or null if not applicable, or if they were - already specified. -@param value The logical value. -@param bidiStringType The bidi string type as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. - -@throws PcmlException If an error occurs. -**/ - public void setValue(AS400 system, - ProgramCallDocument document, - String programName, - int[] indices, - Object value, - int bidiStringType) - throws PcmlException - { - // Determine the program name to use. If the program name was specified - // here AND in the constructor, then something is not working as intended. - if ((programName != null) && (programName_ != null)) - throw new ExtendedIllegalArgumentException("programName", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - StringBuffer buffer = new StringBuffer(); - buffer.append((programName == null) ? programName_ : programName); - buffer.append('.'); - buffer.append(dataName_); - String programNameAndDataName = buffer.toString(); - - // Determine the indices to use. If the program name was specified - // here AND in the constructor, then something is not working as intended. - if ((indices != null) && (indices_ != null)) - throw new ExtendedIllegalArgumentException("indices", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - int[] indicesToUse = (indices == null) ? indices_ : indices; - - // Map the logical value to its physical value. - if (valueMap_ != null) - value = valueMap_.ltop(value, system); - - // Set the value in the PCML document. - if (indicesToUse == null) { // @A3C - if (value instanceof String) // @A3A - document.setStringValue(programNameAndDataName, (String)value, bidiStringType); // @A2C - else // @A3A - document.setValue(programNameAndDataName, value); // @A3A - } // @A3A - else { // @A3C - if (value instanceof String) // @A3A - document.setStringValue(programNameAndDataName, indicesToUse, (String)value, bidiStringType); // @A2C - else // @A3A - document.setValue(programNameAndDataName, indicesToUse, value); // @A3A - } // @A3A - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/QualifiedValueMap.java b/cvsroot/src/com/ibm/as400/resource/QualifiedValueMap.java deleted file mode 100644 index b88a52603..000000000 --- a/cvsroot/src/com/ibm/as400/resource/QualifiedValueMap.java +++ /dev/null @@ -1,211 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: QualifiedValueMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.IllegalPathNameException; -import com.ibm.as400.access.QSYSObjectPathName; -import com.ibm.as400.access.Trace; -import java.io.Serializable; -import java.util.Date; - - - -/** -The QualifiedValueMap class maps between a logical value -and a variety of qualified name formats for a physical value. -**/ -class QualifiedValueMap -implements ValueMap, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Date formats. - public static final int FORMAT_20 = 20; // OOOOOOOOOOLLLLLLLLLL - public static final int FORMAT_CL = 13; // LLLLLLLLLL/OOOOOOOOOO - - - - // Private data. - private int format_ = -1; - private String type_ = null; - - - - -/** -Constructs a QualifiedValueMap object. - -@param format The format. -@param type The object type. -**/ - public QualifiedValueMap(int format, String type) - { - if ((format != FORMAT_20) && (format != FORMAT_CL)) - throw new ExtendedIllegalArgumentException("format", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if (type == null) - throw new NullPointerException("type"); - - format_ = format; - type_ = type; - } - - - -/** -Maps from a logical value to a physical value. - -@param logicalValue The logical value. -@param system The system. -@return The physical value. -**/ - public Object ltop(Object logicalValue, AS400 system) - { - if (logicalValue == null) - throw new NullPointerException("logicalValue"); - if (!(logicalValue instanceof String)) - throw new ExtendedIllegalArgumentException("logicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - String asString = (String)logicalValue; - if (asString.length() == 0) - throw new ExtendedIllegalArgumentException("logicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - QSYSObjectPathName asPath; - StringBuffer buffer = new StringBuffer(); - - switch(format_) { - - case FORMAT_20: - // If a special value has been specified... - if (asString.length() <= 10) - buffer.append(normalize(asString, 20)); - else { - try { - asPath = new QSYSObjectPathName(asString); - buffer.append(normalize(asPath.getObjectName(), 10)); - buffer.append(normalize(asPath.getLibraryName(), 10)); - } - catch(IllegalPathNameException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Bad path name", e); - throw new ExtendedIllegalArgumentException("logicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - break; - - case FORMAT_CL: - // If a special value has been specified... - if (asString.length() <= 10) - buffer.append(asString); - else { - try { - asPath = new QSYSObjectPathName(asString); - buffer.append(asPath.getLibraryName()); - buffer.append('/'); - buffer.append(asPath.getObjectName()); } - catch(IllegalPathNameException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Bad path name", e); - throw new ExtendedIllegalArgumentException("logicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - break; - - // If the format specified is bad... - default: - throw new ExtendedIllegalStateException("format", ExtendedIllegalStateException.UNKNOWN); - } - - return buffer.toString(); - } - - - -/** -Maps from a physical value to a logical value. - -@param physicalValue The physical value. -@param system The system. -@return The logical value. -**/ - public Object ptol(Object physicalValue, AS400 system) - { - // Validate the physical value. - if (physicalValue == null) - throw new NullPointerException("physicalValue"); - if (!(physicalValue instanceof String)) - throw new ExtendedIllegalArgumentException("physicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - String asString = (String)physicalValue; - - switch(format_) { - - case FORMAT_20: - // If a special value has been specified... - if (asString.length() <= 10) - return asString; - else - return QSYSObjectPathName.toPath(asString.substring(10).trim(), - asString.substring(0,10).trim(), - type_); - - case FORMAT_CL: - return QSYSObjectPathName.toPath(asString.substring(11,21).trim(), - asString.substring(0,10).trim(), - type_); - - // If the format specified is bad... - default: - throw new ExtendedIllegalStateException("format", ExtendedIllegalStateException.UNKNOWN); - } - - } - - - -/** -Normalizes a String to a fixed length. This will truncate or pad -with spaces as needed. - -@param source The source String. -@param length The fixed length. -@return The normalized String. -**/ - private static String normalize(String source, int length) - { - int sourceLength = source.length(); - if (sourceLength < length) { - StringBuffer buffer = new StringBuffer(source); - for(int i = sourceLength; i < length; ++i) - buffer.append(' '); - return buffer.toString(); - } - else if (sourceLength > length) - return source.substring(0, length); - else - return source; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/QuoteValueMap.java b/cvsroot/src/com/ibm/as400/resource/QuoteValueMap.java deleted file mode 100644 index f4f13ced9..000000000 --- a/cvsroot/src/com/ibm/as400/resource/QuoteValueMap.java +++ /dev/null @@ -1,142 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: QuoteValueMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.io.Serializable; - - -/** -The QuoteValueMap class maps between a logical value (without -single quotes) and a physical value (with single quotes). -It will not quote special values (starting with *) and will -optionally turn empty strings into a special value (e.g. *NONE). -**/ -class QuoteValueMap -implements ValueMap, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private static final char SINGLE_QUOTE_ = '\''; - - private String emptyStringSpecialValue_ = null; - - - -/** -Constructs a QuoteValueMap object. -**/ - public QuoteValueMap() - { - } - - - -/** -Constructs a QuoteValueMap object. - -@param emptyStringSpecialValue The special value for empty strings. -**/ - public QuoteValueMap(String emptyStringSpecialValue) - { - if (emptyStringSpecialValue == null) - throw new NullPointerException("emptyStringSpecialValue"); - - emptyStringSpecialValue_ = emptyStringSpecialValue; - } - - - -/** -Maps from a logical value to a physical value. - -@param logicalValue The logical value. -@param system The system. -@return The physical value. -**/ - public Object ltop(Object logicalValue, AS400 system) - { - if (logicalValue == null) - throw new NullPointerException("logicalValue"); - if (!(logicalValue instanceof String)) - throw new ExtendedIllegalArgumentException("logicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - String asString = (String)logicalValue; - - // Handle the empty string if needed. - if ((asString.length() == 0) && (emptyStringSpecialValue_ != null)) - return emptyStringSpecialValue_; - - // Do not quote special values. - if (asString.length() > 0) - if (asString.charAt(0) == '*') - return asString; - - // Otherwise... - StringBuffer buffer = new StringBuffer(); - buffer.append(SINGLE_QUOTE_); - buffer.append(asString); - buffer.append(SINGLE_QUOTE_); - return buffer.toString(); - } - - - -/** -Maps from a physical value to a logical value. - -@param physicalValue The physical value. -@param system The system. -@return The logical value. -**/ - public Object ptol(Object physicalValue, AS400 system) - { - // Validate the physical value. - if (physicalValue == null) - throw new NullPointerException("physicalValue"); - if (!(physicalValue instanceof String)) - throw new ExtendedIllegalArgumentException("physicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - String asString = (String)physicalValue; - - int length = asString.length(); - - if (asString.length() >= 2) { - if (asString.charAt(0) == SINGLE_QUOTE_) { - if (asString.charAt(length - 1) == SINGLE_QUOTE_) - return asString.substring(1, length-1); - else - return asString.substring(1); - } - else { - if (asString.charAt(length - 1) == SINGLE_QUOTE_) - return asString.substring(0, length-1); - } - } - - return asString; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/RIFSFile.java b/cvsroot/src/com/ibm/as400/resource/RIFSFile.java deleted file mode 100644 index e3284bfb6..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RIFSFile.java +++ /dev/null @@ -1,767 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RIFSFile.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.IFSJavaFile; -import com.ibm.as400.access.IFSFile; -import java.beans.PropertyVetoException; -import java.io.Serializable; -import java.util.Date; - - - -/** -The RIFSFile class represents a file or directory in the integrated -file system on the system. This class provides function similar to -{@link com.ibm.as400.access.IFSFile IFSFile } and -{@link com.ibm.as400.access.IFSJavaFile IFSJavaFile } -except that it is a subclass of {@link com.ibm.as400.resource.Resource Resource}. -As a result, it can be used directly in conjunction with components -written for Resource objects. - -

      The following attribute IDs are supported: -

        -
      • {@link #ABSOLUTE_PATH ABSOLUTE_PATH} -
      • {@link #CANONICAL_PATH CANONICAL_PATH} -
      • {@link #CAN_READ CAN_READ} -
      • {@link #CAN_WRITE CAN_WRITE} -
      • {@link #CCSID CCSID} -
      • {@link #CREATED CREATED} -
      • {@link #EXISTS EXISTS} -
      • {@link #IS_ABSOLUTE IS_ABSOLUTE} -
      • {@link #IS_DIRECTORY IS_DIRECTORY} -
      • {@link #IS_FILE IS_FILE} -
      • {@link #IS_HIDDEN IS_HIDDEN} -
      • {@link #IS_READ_ONLY IS_READ_ONLY} -
      • {@link #LAST_ACCESSED LAST_ACCESSED} -
      • {@link #LAST_MODIFIED LAST_MODIFIED} -
      • {@link #LENGTH LENGTH} -
      • {@link #NAME NAME} -
      • {@link #PARENT PARENT} -
      • {@link #PATH PATH} -
      • {@link #TYPE TYPE} -
      -
      - -

      Use any of these attribute IDs with -{@link com.ibm.as400.resource.ChangeableResource#getAttributeValue getAttributeValue()} -and {@link com.ibm.as400.resource.ChangeableResource#setAttributeValue setAttributeValue()} -to access the attribute values for an RIFSFile. - -

      -// Create an RIFSFile object to refer to a specific file.
      -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
      -RIFSFile file = new RIFSFile(system, "/home/myuserid/config.txt");
      -
      -// Determine if the file is read only. -boolean readOnly = ((Boolean)file.getAttributeValue(RIFSFile.IS_READ_ONLY)).booleanValue(); -
      -// Set the last modified date to now. -file.setAttributeValue(RIFSFile.LAST_MODIFIED, new Date()); -
      -// Commit the attribute change. -file.commitAttributeChanges(); -
      -@deprecated Use -{@link com.ibm.as400.access.IFSFile IFSFile} instead, as this package may be removed in the future. -@see RIFSFileList -**/ -//----------------------------------------------------------------------------------------- -// I thought delete() would be useful here. There are other methods -// in IFSFile that we could duplicate here, but most of them deal with creating new -// files and directories (like createNewFile() and mkdir()). I believe that, due to the -// nature of the resource framework, that this will be used mostly to deal with existing -// objects. So for now I will leave these other methods off. In the case that someone -// needs to use these, they just need to get the system and path from this object and -// use it to construct an IFSFile directly. -//----------------------------------------------------------------------------------------- -public class RIFSFile -extends ChangeableResource -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - -//----------------------------------------------------------------------------------------- -// Presentation. -//----------------------------------------------------------------------------------------- - - private static PresentationLoader presentationLoader_ = new PresentationLoader("com.ibm.as400.resource.ResourceMRI"); - private static final String ICON_BASE_NAME_ = "RIFSFile"; - private static final String PRESENTATION_KEY_ = "IFSFILE"; - - - -//----------------------------------------------------------------------------------------- -// Attribute IDs. -// -// * If you add an attribute here, make sure and add it to the class javadoc. -//----------------------------------------------------------------------------------------- - - // Private data. - static ResourceMetaDataTable attributes_ = new ResourceMetaDataTable(presentationLoader_, PRESENTATION_KEY_); - - - -/** -Attribute ID for absolute path. This identifies a read-only String -attribute, which represents the absolute path name. -**/ - public static final String ABSOLUTE_PATH = "ABSOLUTE_PATH"; - - static { - attributes_.add(ABSOLUTE_PATH, String.class, true); - } - - - -/** -Attribute ID for canonical path. This identifies a read-only String -attribute, which represents the canonical path name. -**/ - public static final String CANONICAL_PATH = "CANONICAL_PATH"; - - static { - attributes_.add(CANONICAL_PATH, String.class, true); - } - - - -/** -Attribute ID for can read. This identifies a read-only Boolean -attribute, which indicates whether this file can be read. -**/ - public static final String CAN_READ = "CAN_READ"; - - static { - attributes_.add(CAN_READ, Boolean.class, true); - } - - - -/** -Attribute ID for can write. This identifies a read-only Boolean -attribute, which indicates whether this file can be written. -**/ - public static final String CAN_WRITE = "CAN_WRITE"; - - static { - attributes_.add(CAN_WRITE, Boolean.class, true); - } - - - -/** -Attribute ID for CCSID. This identifies a read-only Integer -attribute, which represents the coded character set identifier -for the file. -**/ - public static final String CCSID = "CCSID"; - - static { - attributes_.add(CCSID, Integer.class, true); - } - - - -/** -Attribute ID for created. This identifies a read-only Date -attribute, which represents the date and time that the file -was created. -**/ - public static final String CREATED = "CREATED"; - - static { - attributes_.add(CREATED, Date.class, true); - } - - - -/** -Attribute ID for exists. This identifies a read-only Boolean -attribute, which indicates whether the file exists. -**/ - public static final String EXISTS = "EXISTS"; - - static { - attributes_.add(EXISTS, Boolean.class, true); - } - - - -/** -Attribute ID for is absolute. This identifies a read-only Boolean -attribute, which indicates whether the path name is absolute. -**/ - public static final String IS_ABSOLUTE = "IS_ABSOLUTE"; - - static { - attributes_.add(IS_ABSOLUTE, Boolean.class, true); - } - - - -/** -Attribute ID for is directory. This identifies a read-only Boolean -attribute, which indicates whether this is a directory. -**/ - public static final String IS_DIRECTORY = "IS_DIRECTORY"; - - static { - attributes_.add(IS_DIRECTORY, Boolean.class, true); - } - - - -/** -Attribute ID for is file. This identifies a read-only Boolean -attribute, which indicates whether this is a file. -**/ - public static final String IS_FILE = "IS_FILE"; - - static { - attributes_.add(IS_FILE, Boolean.class, true); - } - - - -/** -Attribute ID for is hidden. This identifies a Boolean -attribute, which indicates whether this file is hidden. -**/ - public static final String IS_HIDDEN = "IS_HIDDEN"; - - static { - attributes_.add(IS_HIDDEN, Boolean.class, false); - } - - - -/** -Attribute ID for is read only. This identifies a Boolean -attribute, which indicates whether this file is read only. -**/ - public static final String IS_READ_ONLY = "IS_READ_ONLY"; - - static { - attributes_.add(IS_READ_ONLY, Boolean.class, false); - } - - - -/** -Attribute ID for last accessed. This identifies a read-only Date -attribute, which represents the date and time the file was -last accessed. -**/ - public static final String LAST_ACCESSED = "LAST_ACCESSED"; - - static { - attributes_.add(LAST_ACCESSED, Date.class, true); - } - - - -/** -Attribute ID for last modified. This identifies a Date -attribute, which represents the date and time the file was -last modified. Setting this to 0 will leave the last modified -date unchanged. -**/ - public static final String LAST_MODIFIED = "LAST_MODIFIED"; - - static { - attributes_.add(LAST_MODIFIED, Date.class, false); - } - - - -/** -Attribute ID for length. This identifies a read-only Long -attribute, which represents the length of the file in bytes. -**/ - public static final String LENGTH = "LENGTH"; - - static { - attributes_.add(LENGTH, Long.class, true); - } - - - -/** -Attribute ID for name. This identifies a read-only String -attribute, which represents the name of the file. -**/ - public static final String NAME = "NAME"; - - static { - attributes_.add(NAME, String.class, true); - } - - - -// @A1a -/** -Attribute ID for owner ID. This identifies a read-only Integer -attribute, which represents the owner ID number of the file. -**/ - public static final String OWNERID = "OWNERID"; - - static { - attributes_.add(OWNERID, Integer.class, true); - } - - - -/** -Attribute ID for parent. This identifies a read-only String -attribute, which represents the name of the parent directory. -**/ - public static final String PARENT = "PARENT"; - - static { - attributes_.add(PARENT, String.class, true); - } - - - -/** -Attribute ID for path. This identifies a read-only String -attribute, which represents the path name of the file. -**/ - public static final String PATH = "PATH"; - - static { - attributes_.add(PATH, String.class, true); - } - - - -/** -Attribute ID for type. This identifies a read-only String -attribute, which indicates whether this is a directory or a file. -Possible values are: -
        -
      • {@link #TYPE_DIRECTORY TYPE_DIRECTORY} - This is a directory. -
      • {@link #TYPE_FILE TYPE_FILE} - This is a file. -
      • {@link #TYPE_UNKNOWN TYPE_UNKNOWN} - The type is unknown. -
      -**/ - public static final String TYPE = "TYPE"; - - /** - Attribute value indicating that this is a directory. - - @see #TYPE - **/ - public static final String TYPE_DIRECTORY = "*DIRECTORY"; - - /** - Attribute value indicating that this is a file. - - @see #TYPE - **/ - public static final String TYPE_FILE = "*FILE"; - - /** - Attribute value indicating that the tyype is unknown. - - @see #TYPE - **/ - public static final String TYPE_UNKNOWN = "*UNKNOWN"; - - static { - attributes_.add(TYPE, String.class, true, - new Object[] {TYPE_DIRECTORY, TYPE_FILE, TYPE_UNKNOWN }, null, true); - } - - - - -//----------------------------------------------------------------------------------------- -// Private data. -//----------------------------------------------------------------------------------------- - - private IFSFile file_ = new IFSFile(); - private String path_ = null; - - - - -//----------------------------------------------------------------------------------------- -// Constructors. -//----------------------------------------------------------------------------------------- - -/** -Constructs an RIFSFile object. -**/ - public RIFSFile() - { - super(presentationLoader_.getPresentationWithIcon(PRESENTATION_KEY_, ICON_BASE_NAME_), null, attributes_); - } - - - -/** -Constructs an RIFSFile object. - -@param system The system. -@param path The file path name. -**/ - public RIFSFile(AS400 system, String path) - { - this(); - - try { - setSystem(system); - setPath(path); - } - catch(PropertyVetoException e) { - // Ignore. - } - } - - -/** -Constructs an RIFSFile object. - -@param file The file. -**/ - RIFSFile(IFSFile file) - { - this(); - - try { - setSystem(file.getSystem()); - file_ = file; - path_ = file.getPath(); - } - catch(PropertyVetoException e) { - // Ignore. - } - } - - - -/** -Commits the specified attribute changes. - -@exception ResourceException If an error occurs. -**/ - protected void commitAttributeChanges(Object[] attributeIDs, Object[] values) - throws ResourceException - { - super.commitAttributeChanges(attributeIDs, values); - - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); - - // Make the changes. - try { - for(int i = 0; i < attributeIDs.length; ++i) { - boolean success = true; - if (attributeIDs[i].equals(RIFSFile.IS_HIDDEN)) - success = file_.setHidden(((Boolean)values[i]).booleanValue()); - else if (attributeIDs[i].equals(RIFSFile.LAST_MODIFIED)) - success = file_.setLastModified(((Date)values[i]).getTime()); - else if (attributeIDs[i].equals(RIFSFile.IS_READ_ONLY)) - success = file_.setReadOnly(((Boolean)values[i]).booleanValue()); - else - throw new ExtendedIllegalArgumentException("attributeIDs[" + i + "](" + attributeIDs[i] + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - if (!success) - throw new ResourceException(ResourceException.ATTRIBUTES_NOT_SET); - } - } - catch(Exception e) { - throw new ResourceException(ResourceException.ATTRIBUTES_NOT_SET, e); - } - } - - - - -/** -Computes a resource key. - -@param system The system. -@param path The file path name. -@return The resource key. -**/ - static Object computeResourceKey(AS400 system, String path) - { - StringBuffer buffer = new StringBuffer(); - buffer.append(RIFSFile.class); - buffer.append(':'); - buffer.append(system.getSystemName()); - buffer.append(':'); - buffer.append(system.getUserId()); - buffer.append(':'); - buffer.append(path); - return buffer.toString(); - } - - - -/** -Deletes this file or directory. - -@exception ResourceException If an error occurs. -**/ - public void delete() - throws ResourceException - { - // Establish the connection if needed. - if (!isConnectionEstablished()) - establishConnection(); - - try { - boolean success = file_.delete(); - if (success == false) - throw new ResourceException(ResourceException.OPERATION_FAILED); - } - catch(Exception e) { - throw new ResourceException(e); - } - } - - - -/** -Establishes the connection to the system. - -

      The method is called by the resource framework automatically -when the connection needs to be established. - -@exception ResourceException If an error occurs. -**/ - protected void establishConnection() - throws ResourceException - { - // Validate if we can establish the connection. - if (file_.getPath() == null) - throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - // Call the superclass. - super.establishConnection(); - } - - - -/** -Freezes any property changes. After this is called, property -changes should not be made. Properties are not the same thing -as attributes. Properties are basic pieces of information -which must be set to make the object usable, such as the system -and the name. - -

      The method is called by the resource framework automatically -when the properties need to be frozen. - -@exception ResourceException If an error occurs. -**/ - protected void freezeProperties() - throws ResourceException - { - // Validate if we can establish the connection. - if (file_.getPath() == null) - throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - // Update the presentation. - Presentation presentation = getPresentation(); - presentation.setName(file_.getName()); - presentation.setFullName(file_.getPath()); - - // Update the resource key. - if (getResourceKey() == null) - setResourceKey(computeResourceKey(getSystem(), file_.getPath())); - - // Call the superclass. - super.freezeProperties(); - } - - - -/** -Returns the unchanged value of an attribute. If the attribute -value has an uncommitted change, this returns the unchanged value. -If the attribute value does not have an uncommitted change, this -returns the same value as getAttributeValue(). - -@param attributeID Identifies the attribute. -@return The attribute value, or null if the attribute - value is not available. - -@exception ResourceException If an error occurs. -**/ - public Object getAttributeUnchangedValue(Object attributeID) - throws ResourceException - { - Object value = super.getAttributeUnchangedValue(attributeID); - if (value == null) { - - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); - - try { - if (attributeID.equals(RIFSFile.ABSOLUTE_PATH)) - return file_.getAbsolutePath(); - else if (attributeID.equals(RIFSFile.CANONICAL_PATH)) - return file_.getCanonicalPath(); - else if (attributeID.equals(RIFSFile.CAN_READ)) - return file_.canRead() ? Boolean.TRUE : Boolean.FALSE; - else if (attributeID.equals(RIFSFile.CAN_WRITE)) - return file_.canWrite() ? Boolean.TRUE : Boolean.FALSE; - else if (attributeID.equals(RIFSFile.CCSID)) - return new Integer(file_.getCCSID()); - else if (attributeID.equals(RIFSFile.CREATED)) - return new Date(file_.created()); - else if (attributeID.equals(RIFSFile.EXISTS)) - return file_.exists() ? Boolean.TRUE : Boolean.FALSE; - else if (attributeID.equals(RIFSFile.IS_ABSOLUTE)) - return file_.isAbsolute() ? Boolean.TRUE : Boolean.FALSE; - else if (attributeID.equals(RIFSFile.IS_DIRECTORY)) - return file_.isDirectory() ? Boolean.TRUE : Boolean.FALSE; - else if (attributeID.equals(RIFSFile.IS_FILE)) - return file_.isFile() ? Boolean.TRUE : Boolean.FALSE; - else if (attributeID.equals(RIFSFile.IS_HIDDEN)) - return file_.isHidden() ? Boolean.TRUE : Boolean.FALSE; - else if (attributeID.equals(RIFSFile.IS_READ_ONLY)) - return file_.isReadOnly() ? Boolean.TRUE : Boolean.FALSE; - else if (attributeID.equals(RIFSFile.LAST_ACCESSED)) - return new Date(file_.lastAccessed()); - else if (attributeID.equals(RIFSFile.LAST_MODIFIED)) - return new Date(file_.lastModified()); - else if (attributeID.equals(RIFSFile.LENGTH)) - return new Long(file_.length()); - else if (attributeID.equals(RIFSFile.NAME)) - return file_.getName(); - else if (attributeID.equals(RIFSFile.OWNERID)) // @A1a - return new Integer(file_.getOwnerId()); - else if (attributeID.equals(RIFSFile.PARENT)) - return file_.getParent(); - else if (attributeID.equals(RIFSFile.PATH)) - return file_.getPath(); - else if (attributeID.equals(RIFSFile.TYPE)) { - if (file_.isDirectory()) - return TYPE_DIRECTORY; - else if (file_.isFile()) - return TYPE_FILE; - else - return TYPE_UNKNOWN; - } - else - throw new ExtendedIllegalArgumentException("attributeID(" + attributeID + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - catch(Exception e) { - throw new ResourceException(e); - } - } - else - return value; - } - - - - -/** -Returns the file path name. - -@return The file path name. -**/ - public String getPath() - { - return path_; - } - - -/** -Refreshes the values for all attributes. This does not cancel -uncommitted changes. This method fires an attributeValuesRefreshed() -ResourceEvent. - -@exception ResourceException If an error occurs. -**/ - public void refreshAttributeValues() - throws ResourceException - { - super.refreshAttributeValues(); - file_.clearCachedAttributes(); - } - - - - -/** -Sets the file path name. This does not change the file on -the system. Instead, it changes the file to which -this object references. This cannot be changed -if the object has established a connection to the system. - -@param path The file path name. -**/ - public void setPath(String path) - { - if (path == null) - throw new NullPointerException("path"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - String oldValue = file_.getPath(); - try { - path_ = path; - // Handle switching the direction of separator chars, if necessary. - String tempPath = path.replace(IFSJavaFile.separatorChar, IFSFile.separatorChar); - file_.setPath(tempPath); - } - catch(PropertyVetoException e) { - // Ignore. - } - firePropertyChange("path", oldValue, path); - } - - - -/** -Sets the system. This does not change the job on -the system. Instead, it changes the system to which -this object references. This cannot be changed -if the object has established a connection to the system. - -@param system The system. - -@exception PropertyVetoException If the property change is vetoed. -**/ - public void setSystem(AS400 system) - throws PropertyVetoException - { - super.setSystem(system); - file_.setSystem(system); - } - - - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/RIFSFile16.gif b/cvsroot/src/com/ibm/as400/resource/RIFSFile16.gif deleted file mode 100644 index dcac2e9a4..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RIFSFile16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RIFSFile32.gif b/cvsroot/src/com/ibm/as400/resource/RIFSFile32.gif deleted file mode 100644 index 2ee958841..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RIFSFile32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RIFSFileBeanInfo.java b/cvsroot/src/com/ibm/as400/resource/RIFSFileBeanInfo.java deleted file mode 100644 index df25c560a..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RIFSFileBeanInfo.java +++ /dev/null @@ -1,157 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RIFSFileBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Trace; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.util.ResourceBundle; - - - -/** -The RIFSFileBeanInfo class represents the bean information -for the RIFSFile class. -@deprecated Use com.ibm.as400.access.IFSFile instead. -**/ -public class RIFSFileBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final Class beanClass_ = RIFSFile.class; - - private static BeanInfo[] additionalBeanInfo_; - private static BeanDescriptor beanDescriptor_; - private static Image icon16_; - private static Image icon32_; - private static PropertyDescriptor[] propertyDescriptors_; - private static ResourceBundle resourceBundle_; - - - -/** -Static initializer. -**/ - static - { - try - { - // Set up the resource bundle. - resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.resource.ResourceMRI"); - - // Set up the additional bean info. - additionalBeanInfo_ = new BeanInfo[] { new ResourceBeanInfo() }; - - // Set up the bean descriptor. - beanDescriptor_ = new BeanDescriptor(beanClass_); - - // Set up the property descriptors. - PropertyDescriptor path = new PropertyDescriptor("path", beanClass_); - path.setBound(true); - path.setConstrained(true); - path.setDisplayName(resourceBundle_.getString("PROPERTY_PATH_NAME")); - path.setShortDescription(resourceBundle_.getString("PROPERTY_PATH_DESCRIPTION")); - - propertyDescriptors_ = new PropertyDescriptor[] { path }; - - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error while loading bean info", e); - throw new Error(e.toString()); - } - } - - - -/** -Returns the additional bean information. - -@return The additional bean information. -**/ - public BeanInfo[] getAdditionalBeanInfo() - { - return additionalBeanInfo_; - } - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - - -/** -Returns the icon. - -@param icon The icon kind. Possible values are: -

        -
      • BeanInfo.ICON_MONO_16x16 -
      • BeanInfo.ICON_MONO_32x32 -
      • BeanInfo.ICON_COLOR_16x16 -
      • BeanInfo.ICON_COLOR_32x32 -
      -@return The icon. -**/ - public Image getIcon(int icon) - { - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - if (icon16_ == null) - icon16_ = loadImage("RIFSFile16.gif"); - return icon16_; - - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - if (icon32_ == null) - icon32_ = loadImage("RIFSFile32.gif"); - return icon32_; - - default: - throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - - -/** -Returns the property descriptors. - -@return The property descriptors. -**/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors_; - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/RIFSFileList.java b/cvsroot/src/com/ibm/as400/resource/RIFSFileList.java deleted file mode 100644 index c138c3c3a..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RIFSFileList.java +++ /dev/null @@ -1,480 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RIFSFileList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.IFSFile; -import com.ibm.as400.access.IFSFileFilter; -import com.ibm.as400.access.IFSJavaFile; -import java.beans.PropertyVetoException; -import java.util.Enumeration; -import java.util.Vector; - - - -/** -The RIFSFileList class represents a list of files and directories -in the integrated file system. This class provides function similar to -{@link com.ibm.as400.access.IFSFile IFSFile } and -{@link com.ibm.as400.access.IFSJavaFile IFSJavaFile } -except that it is a subclass of -{@link com.ibm.as400.resource.ResourceList ResourceList}. As a result, -it can be used directly in conjunction with components written for ResourceList objects. - -

      If the specified directory does not exist, the list will be empty. - -

      The contents of the list are always loaded sequentially, regardless of the -order that you request them. In addition, they are loaded on demand, meaning the -entire list is not loaded until the last item is requested. Use the -{@link #resourceAt resourceAt()} method to request a particular list item. If that -list item is not yet loaded, resourceAt() returns null. To ensure that a -particular list item is loaded, call {@link #waitForResource waitForResource()}. -To ensure that the entire list is loaded, call {@link #waitForComplete waitForComplete()}. -Note that both wait methods will block until the requested resource(s) are loaded. - -

      The following selection IDs are supported: -

      - -

      Use one or more of these selection IDs with -{@link com.ibm.as400.resource.ResourceList#getSelectionValue getSelectionValue()} -and {@link com.ibm.as400.resource.ResourceList#setSelectionValue setSelectionValue()} -to access the selection values for an RIFSFileList. - -

      RIFSFileList objects generate {@link com.ibm.as400.resource.RIFSFile RIFSFile} objects. - -

      -// Create an RIFSFileList object to represent a list of files.
      -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
      -RIFSFileList fileList = new RIFSFileList(system, "/home/myuserid");
      -
      -// Set the selection so that only Java source files are listed. -fileList.setSelectionValue(RIFSFileList.PATTERN, "*.java"); -
      -// Open the list and get the first 50 items. -fileList.open(); -fileList.waitForResource(50); -
      -// Read and print the file names and last modified dates -// for the first 50 items in the list. -for(long i = 0; i < 50; ++i) -{ - RIFSFile file = (RIFSFile)fileList.resourceAt(i); - System.out.println(file.getAttributeValue(RIFSFile.NAME)); - System.out.println(file.getAttributeValue(RIFSFile.LAST_MODIFIED)); - System.out.println(); -} -
      -// Close the list. -fileList.close(); -
      -@deprecated Use -{@link com.ibm.as400.access.IFSFile IFSFile} instead, as this package may be removed in the future. -@see RIFSFile -**/ -public class RIFSFileList -extends ResourceList -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - -//----------------------------------------------------------------------------------------- -// Presentation. -//----------------------------------------------------------------------------------------- - - private static final String PRESENTATION_KEY_ = "IFSFILE_LIST"; - private static final String ICON_BASE_NAME_ = "RIFSFileList"; - private static PresentationLoader presentationLoader_ = new PresentationLoader("com.ibm.as400.resource.ResourceMRI"); - - - - -//----------------------------------------------------------------------------------------- -// Selection IDs. -// -// * If you add a selection here, make sure and add it to the class javadoc -// and in ResourceMRI.java. -//----------------------------------------------------------------------------------------- - - private static ResourceMetaDataTable selections_ = new ResourceMetaDataTable(presentationLoader_, PRESENTATION_KEY_); - - - -/** -Selection ID for filter. This identifies an -{@link com.ibm.as400.access.IFSFileFilter IFSFileFilter} selection, -which represents the filter used to select which files are included in the -list. -**/ - public static final String FILTER = "FILTER"; - - static { - selections_.add(FILTER, IFSFileFilter.class, false); - } - - - -/** -Selection ID for pattern. This identifies a String selection, -which represents the pattern used to select which files are included in the list. -This value can include wildcards (*) and question marks (?). -**/ - public static final String PATTERN = "PATTERN"; - - static { - selections_.add(PATTERN, String.class, false); - } - - - -//----------------------------------------------------------------------------------------- -// Private data. -//----------------------------------------------------------------------------------------- - - private Vector cache_; - private Enumeration enum_; - private IFSFile file_ = new IFSFile(); - private String path_ = null; - - - -//----------------------------------------------------------------------------------------- -// Code. -//----------------------------------------------------------------------------------------- - -/** -Constructs an RIFSFileList object. -**/ - public RIFSFileList() - { - super(presentationLoader_.getPresentationWithIcon(PRESENTATION_KEY_, ICON_BASE_NAME_), - RIFSFile.attributes_, - selections_, - null); - } - - - -/** -Constructs an RIFSFileList object. - -@param system The system. -@param path The directory path. -**/ - public RIFSFileList(AS400 system, String path) - { - this(); - try { - setSystem(system); - setPath(path); - } - catch(PropertyVetoException e) { - // Ignore. - } - } - - - -/** -Constructs an RIFSFileList object. - -@param file The directory. -**/ -// -// Implementation note: This constructor is to faciliate cases where list items -// (RIFSFile objects) must be recursively treated as -// lists (RIFSFileList objects). -// - public RIFSFileList(RIFSFile file) - { - this(); - try { - setSystem(file.getSystem()); - setPath(file.getPath()); - } - catch(PropertyVetoException e) { - // Ignore. - } - } - - - - -/** -Establishes the connection to the system. - -

      The method is called by the resource framework automatically -when the connection needs to be established. - -@exception ResourceException If an error occurs. -**/ - protected void establishConnection() - throws ResourceException - { - // Validate if we can establish the connection. - if (file_.getPath() == null) - throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - // Call the superclass. - super.establishConnection(); - - try { - file_.setSystem(getSystem()); - } - catch(PropertyVetoException e) { - // Ignore. - } - } - - - -/** -Freezes any property changes. After this is called, property -changes should not be made. Properties are not the same thing -as attributes. Properties are basic pieces of information -which must be set to make the object usable, such as the system -and the name. - -

      The method is called by the resource framework automatically -when the properties need to be frozen. - -@exception ResourceException If an error occurs. -**/ - protected void freezeProperties() - throws ResourceException - { - // Validate if we can establish the connection. - if (file_.getPath() == null) - throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - // Update the presentation. - Presentation presentation = getPresentation(); - presentation.setName(file_.getName()); - presentation.setFullName(file_.getPath()); - - // Call the superclass. - super.freezeProperties(); - } - - - -/** -Returns the directory path. - -@return The directory path. -**/ - public String getPath() - { - return path_; - } - - - -/** -Opens the list. The list must be open in order to -perform most operations. This method has no effect -if the list is already opened. - -@exception ResourceException If an error occurs. -**/ - public void open() - throws ResourceException - { - if (isOpen()) - return; - - super.open(); - - fireBusy(); - try { - synchronized(this) { - - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); - - try { - String pattern = (String)getSelectionValue(PATTERN); - if (pattern == null) - enum_ = file_.enumerateFiles((IFSFileFilter)getSelectionValue(FILTER)); - else - enum_ = file_.enumerateFiles((IFSFileFilter)getSelectionValue(FILTER), pattern); - cache_ = new Vector(); - if (! enum_.hasMoreElements()) - fireListCompleted(); - } - catch(Exception e) { - throw new ResourceException(e); - } - } - } - finally { - fireIdle(); - } - } - - - -/** -Refreshes the contents of the list. - -

      This will implicitly open the list if needed. - -@exception ResourceException If an error occurs. -**/ - public void refreshContents() - throws ResourceException - { - if (isOpen()) - close(); - super.refreshContents(); - } - - - -/** -Returns the resource specified by the index. - -

      This will implicitly open the list if needed. - -@param index The index. -@return The resource specified by the index, or null - if the resource is not yet available. - -@exception ResourceException If an error occurs. -**/ - public Resource resourceAt(long index) - throws ResourceException - { - synchronized(this) { - - // It may already be here. - Resource resource = super.resourceAt(index); - - // If not, try to load it. - if (resource == null) { - - synchronized(cache_) { - if (index < cache_.size()) { - return (Resource)cache_.elementAt((int)index); - } - - else { - for(int i = cache_.size(); i <= index; ++i) { - resource = new RIFSFile((IFSFile)enum_.nextElement()); - cache_.addElement(resource); - resource.freezeProperties(); - fireResourceAdded(resource, i); - fireLengthChanged(i + 1); - if (! enum_.hasMoreElements()) { - fireListCompleted(); - break; - } - } - } - } - } - - return resource; - } - } - - - -/** -Sets the directory path. This does not change the directory on -the system. Instead, it changes the directory to which -this object references. This cannot be changed -if the object has established a connection to the system. - -@param path The directory path. -**/ - public void setPath(String path) - { - if (path == null) - throw new NullPointerException("path"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - String oldValue = file_.getPath(); - try { - path_ = path; - // Handle switching the direction of separator chars, if necessary. - String tempPath = path.replace(IFSJavaFile.separatorChar, IFSFile.separatorChar); - file_.setPath(tempPath); - } - catch(PropertyVetoException e) { - // Ignore. - } - firePropertyChange("path", oldValue, path); - } - - - -/** -Waits until the list is completely loaded. - -

      This will implicitly open the list if needed. - -@exception ResourceException If an error occurs. -**/ - public void waitForComplete() - throws ResourceException - { - super.waitForComplete(); - - // Load all files into the cache. - int i = 0; - while(!isComplete()) { - resourceAt(i++); - } - } - - - -/** -Waits until the resource is available or the list is -complete. This waits until all resources up to and including -the specified resource are loaded. - -

      This will implicitly open the list if needed. - -@param index The index. - -@exception ResourceException If an error occurs. -**/ - public void waitForResource(long index) - throws ResourceException - { - super.waitForResource(index); - - // Load all files up to and including this one into the cache. - int i = 0; - while((!isComplete()) && (i <= index)) - resourceAt(i++); - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/RIFSFileList16.gif b/cvsroot/src/com/ibm/as400/resource/RIFSFileList16.gif deleted file mode 100644 index 7c896c65f..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RIFSFileList16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RIFSFileList32.gif b/cvsroot/src/com/ibm/as400/resource/RIFSFileList32.gif deleted file mode 100644 index 23d332105..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RIFSFileList32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RIFSFileListBeanInfo.java b/cvsroot/src/com/ibm/as400/resource/RIFSFileListBeanInfo.java deleted file mode 100644 index 8e970f076..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RIFSFileListBeanInfo.java +++ /dev/null @@ -1,157 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RIFSFileListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Trace; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.util.ResourceBundle; - - - -/** -The RIFSFileListBeanInfo class represents the bean information -for the RIFSFileList class. -@deprecated Use com.ibm.as400.access.IFSFile instead. -**/ -public class RIFSFileListBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final Class beanClass_ = RIFSFileList.class; - - private static BeanInfo[] additionalBeanInfo_; - private static BeanDescriptor beanDescriptor_; - private static Image icon16_; - private static Image icon32_; - private static PropertyDescriptor[] propertyDescriptors_; - private static ResourceBundle resourceBundle_; - - - -/** -Static initializer. -**/ - static - { - try - { - // Set up the resource bundle. - resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.resource.ResourceMRI"); - - // Set up the additional bean info. - additionalBeanInfo_ = new BeanInfo[] { new ResourceListBeanInfo() }; - - // Set up the bean descriptor. - beanDescriptor_ = new BeanDescriptor(beanClass_); - - // Set up the property descriptors. - PropertyDescriptor path = new PropertyDescriptor("path", beanClass_); - path.setBound(true); - path.setConstrained(true); - path.setDisplayName(resourceBundle_.getString("PROPERTY_PATH_NAME")); - path.setShortDescription(resourceBundle_.getString("PROPERTY_PATH_DESCRIPTION")); - - propertyDescriptors_ = new PropertyDescriptor[] { path }; - - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error while loading bean info", e); - throw new Error(e.toString()); - } - } - - - -/** -Returns the additional bean information. - -@return The additional bean information. -**/ - public BeanInfo[] getAdditionalBeanInfo() - { - return additionalBeanInfo_; - } - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - - -/** -Returns the icon. - -@param icon The icon kind. Possible values are: -

        -
      • BeanInfo.ICON_MONO_16x16 -
      • BeanInfo.ICON_MONO_32x32 -
      • BeanInfo.ICON_COLOR_16x16 -
      • BeanInfo.ICON_COLOR_32x32 -
      -@return The icon. -**/ - public Image getIcon(int icon) - { - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - if (icon16_ == null) - icon16_ = loadImage("RIFSFileList16.gif"); - return icon16_; - - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - if (icon32_ == null) - icon32_ = loadImage("RIFSFileList32.gif"); - return icon32_; - - default: - throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - - -/** -Returns the property descriptors. - -@return The property descriptors. -**/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors_; - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/RJavaProgram.java b/cvsroot/src/com/ibm/as400/resource/RJavaProgram.java deleted file mode 100644 index d588628cf..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RJavaProgram.java +++ /dev/null @@ -1,1012 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RJavaProgram.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.CommandCall; -import com.ibm.as400.access.IFSFile; -import com.ibm.as400.access.Trace; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.beans.PropertyVetoException; -import java.util.Date; - - - -/** -Represents a Java program on the system. This is supported -only when connecting to systems running OS/400 V5R1, and is not supported beyond IBM i 7.1. -

      -In the context of this discussion, a "Java program" is the IBM i executable object that is created when the CRTJVAPGM (Create Java Program) CL command is run against a class, JAR, or ZIP file. - -

      The following attribute IDs are supported: -

      - - -

      Use any of these attribute IDs with -{@link com.ibm.as400.resource.ChangeableResource#getAttributeValue getAttributeValue()} -and {@link com.ibm.as400.resource.ChangeableResource#setAttributeValue setAttributeValue()} -to access the attribute values for an RJavaProgram. - -

      -// Create an RJavaProgram object to refer to a specific Java program.
      -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
      -RJavaProgram javaProgram = new RJavaProgram(system, "/home/mydir/HelloWorld.class");
      -
      -// Get the optimization. -Integer optimization = (Integer)javaProgram.getAttributeValue(RJavaProgram.OPTIMIZATION); -
      -// Set the enable peformance collection attribute value to full. -javaProgram.setAttributeValue(RJavaProgram.ENABLE_PERFORMANCE_COLLECTION, RJavaProgram.ENABLE_PERFORMANCE_COLLECTION_FULL); -
      -// Commit the attribute change. -javaProgram.commitAttributeChanges(); -
      -@deprecated Use -{@link com.ibm.as400.access.JavaProgram JavaProgram} instead, as this package may be removed in the future. -**/ -public class RJavaProgram -extends ChangeableResource -{ - static final long serialVersionUID = 4L; - - - -//----------------------------------------------------------------------------------------- -// Presentation. -//----------------------------------------------------------------------------------------- - - private static PresentationLoader presentationLoader_ = new PresentationLoader("com.ibm.as400.resource.ResourceMRI"); - private static final String ICON_BASE_NAME_ = "RJavaProgram"; - private static final String PRESENTATION_KEY_ = "JAVA_PROGRAM"; - - - -//----------------------------------------------------------------------------------------- -// Attribute values. -//----------------------------------------------------------------------------------------- - -/** -Attribute value for yes. -**/ - public static final String YES = "*YES"; - -/** -Attribute value for no. -**/ - public static final String NO = "*NO"; - - - -//----------------------------------------------------------------------------------------- -// Attribute IDs. -// -// * If you add an attribute here, make sure and add it to the class javadoc. -//----------------------------------------------------------------------------------------- - - // Private data. - static ResourceMetaDataTable attributes_ = new ResourceMetaDataTable(presentationLoader_, PRESENTATION_KEY_); - private static ProgramMap getterMap_ = new ProgramMap(); - private static CommandMap setterMap_ = new CommandMap(); - - private static final String CRTJVAPGM_ = "CRTJVAPGM"; - private static final String CHGJVAPGM_ = "CHGJVAPGM"; - private static final String PATH_PARAMETER_ = "CLSF"; - private static final String QJVAMAT_ = "qjvamat"; - - - -/** -Attribute ID for total classes in source. This identifies a read-only -Integer attribute, which represents the total number of classes located -within the ZIP or JAR file. -**/ - public static final String TOTAL_CLASSES_IN_SOURCE = "TOTAL_CLASSES_IN_SOURCE"; // @B1A - - static { - try { - attributes_.add(TOTAL_CLASSES_IN_SOURCE, Integer.class, true); - getterMap_.add(TOTAL_CLASSES_IN_SOURCE, QJVAMAT_, "receiverVariable.numberOfTotalClassesInSource"); - } - catch (Exception found) { found.printStackTrace(); } - } - - - -/** -Attribute ID for classes with errors. This identifies a read-only -Integer attribute, which represents the number of classes in the -file that contain errors. -**/ - public static final String CLASSES_WITH_ERRORS = "CLASSES_WITH_ERRORS"; // @B1A - - static { - try { - attributes_.add(CLASSES_WITH_ERRORS, Integer.class, true); - getterMap_.add(CLASSES_WITH_ERRORS, QJVAMAT_, "receiverVariable.numberOfClassesWithErrors"); - } - catch (Exception found) { found.printStackTrace(); } - } - - - -/** -Attribute ID for classes with current Java programs. This identifies -a read-only Integer attribute, which represents the number of classes -in the file which have current Java programs. -**/ - public static final String CLASSES_WITH_CURRENT_JAVA_PROGRAMS = "CLASSES_WITH_CURRENT_JAVA_PROGRAMS"; - - static { - attributes_.add(CLASSES_WITH_CURRENT_JAVA_PROGRAMS, Integer.class, true); - getterMap_.add(CLASSES_WITH_CURRENT_JAVA_PROGRAMS, QJVAMAT_, "receiverVariable.numberOfClassesWithCurrentJavaPrograms"); - } - - - -/** -Attribute ID for classes without current Java programs. This identifies -a read-only Integer attribute, which represents the number of classes -in the file which do not have current Java programs. -**/ - public static final String CLASSES_WITHOUT_CURRENT_JAVA_PROGRAMS = "CLASSES_WITHOUT_CURRENT_JAVA_PROGRAMS"; - - static { - attributes_.add(CLASSES_WITHOUT_CURRENT_JAVA_PROGRAMS, Integer.class, true); - getterMap_.add(CLASSES_WITHOUT_CURRENT_JAVA_PROGRAMS, QJVAMAT_, "receiverVariable.numberOfClassesWithoutCurrentJavaPrograms"); - } - - - -/** -Attribute ID for enable performance collection. This identifies a -String attribute, which represents the level of performance data -collection allowed for this Java program. Possible -values are: -
        -
      • {@link #ENABLE_PERFORMANCE_COLLECTION_NONE ENABLE_PERFORMANCE_COLLECTION_NONE} - - No performance collection is enabled for this Java program. -
      • {@link #ENABLE_PERFORMANCE_COLLECTION_ENTRY_EXIT ENABLE_PERFORMANCE_COLLECTION_ENTRY_EXIT} - - This gives the entry/exit information on all the procedures of the Java - program (including those that are leaf procedures). This includes the - PEP routine. This is useful in capturing information on all procedures. -
      • {@link #ENABLE_PERFORMANCE_COLLECTION_FULL ENABLE_PERFORMANCE_COLLECTION_FULL} - - This gives the entry/exit information on all procedures of the Java - program (including those that are leaf procedures) and precall and postcall - hooks around calls to other procedures. This is useful in capturing - information on all procedures. -
      -**/ - public static final String ENABLE_PERFORMANCE_COLLECTION = "ENABLE_PERFORMANCE_COLLECTION"; - - /** - Attribute value indicating that no performance collection is enabled for this Java program. - - @see #ENABLE_PERFORMANCE_COLLECTION - **/ - public static final String ENABLE_PERFORMANCE_COLLECTION_NONE = "*NONE"; - - /** - Attribute value indicating that the entry/exit information on all the procedures of the Java - program (including those that are leaf procedures) is given. This includes the - PEP routine. This is useful in capturing information on all procedures. - - @see #ENABLE_PERFORMANCE_COLLECTION - **/ - public static final String ENABLE_PERFORMANCE_COLLECTION_ENTRY_EXIT = "*ENTRYEXIT"; - - /** - Attribute value indicating that the entry/exit information on all procedures of the Java - program (including those that are leaf procedures) and precall and postcall - hooks around calls to other procedures is given. This is useful in capturing - information on all procedures. - - @see #ENABLE_PERFORMANCE_COLLECTION - **/ - public static final String ENABLE_PERFORMANCE_COLLECTION_FULL = "*FULL"; - - static { - attributes_.add(ENABLE_PERFORMANCE_COLLECTION, String.class, false, - new Object[] {ENABLE_PERFORMANCE_COLLECTION_NONE, - ENABLE_PERFORMANCE_COLLECTION_ENTRY_EXIT, - ENABLE_PERFORMANCE_COLLECTION_FULL }, null, true); - getterMap_.add(ENABLE_PERFORMANCE_COLLECTION, QJVAMAT_, "receiverVariable.performanceCollectionEnabledFlag", - new EnablePerformanceCollectionValueMap_()); - setterMap_.add(ENABLE_PERFORMANCE_COLLECTION, CHGJVAPGM_, "ENBPFRCOL"); - } - - private static class EnablePerformanceCollectionValueMap_ extends AbstractValueMap - { - public Object ptol(Object physicalValue) - { - if (physicalValue.equals("11")) - return ENABLE_PERFORMANCE_COLLECTION_FULL; - else if (physicalValue.equals("10")) - return ENABLE_PERFORMANCE_COLLECTION_ENTRY_EXIT; - else - return ENABLE_PERFORMANCE_COLLECTION_NONE; - } - } - - - -/** -Attribute ID for profiling data. This identifies a -String attribute, which indicates if the Java program is -collecting profiling data. Possible values are: -
        -
      • {@link #PROFILING_DATA_NOCOLLECTION PROFILING_DATA_NOCOLLECTION} - - No profiling data collection is enabled for this Java program. -
      • {@link #PROFILING_DATA_COLLECTION PROFILING_DATA_COLLECTION} - - Profiling data collection is enabled for this Java program. This - enablement can only occur if the optimization of the Java program is - 30 or higher. Also, collection does not occur until the profiling - data is applied. -
      • {@link #PROFILING_DATA_APPLY PROFILING_DATA_APPLY} - - Profiling data collection is applied for this Java program. -
      • {@link #PROFILING_DATA_CLEAR PROFILING_DATA_CLEAR} - - All profiling data that has been collected for this Java program is to - be cleared. -
      -**/ - public static final String PROFILING_DATA = "PROFILING_DATA"; // @B1A - - /** - Attribute value indicating that no profiling data collection is enabled for this Java program. - - @see #PROFILING_DATA - **/ - public static final String PROFILING_DATA_NOCOLLECTION = "*NOCOL"; // @B1A - - /** - Attribute value indicating that profiling data collection is enabled for this Java program. - This enablement can only occur if the optimization of the Java program is 30 or higher. - Also, collection does not occur until the profiling data is applied. - - @see #PROFILING_DATA - **/ - public static final String PROFILING_DATA_COLLECTION = "*COL"; // @B1A - - /** - Attribute value indicating that profiling data collection is applied for this Java program. - - @see #PROFILING_DATA - **/ - public static final String PROFILING_DATA_APPLY = "*APY"; // @B1A - - /** - Attribute value indicating that all profiling data that has been collected - for this Java program is to be cleared. - - @see #PROFILING_DATA - **/ - public static final String PROFILING_DATA_CLEAR = "*CLR"; // @B1A - - static { // @B1A - attributes_.add(PROFILING_DATA, String.class, false, - new Object[] {PROFILING_DATA_NOCOLLECTION, - PROFILING_DATA_COLLECTION, - PROFILING_DATA_CLEAR, - PROFILING_DATA_APPLY }, null, true); - getterMap_.add(PROFILING_DATA, QJVAMAT_, "receiverVariable.profilingDataStatus", - new ProfilingDataValueMap_()); - setterMap_.add(PROFILING_DATA, CHGJVAPGM_, "PRFDTA"); - } - - private static class ProfilingDataValueMap_ extends AbstractValueMap // @B1A - { - public Object ptol(Object physicalValue) - { - if (physicalValue.equals("2")) - return PROFILING_DATA_APPLY; - else if (physicalValue.equals("1")) - return PROFILING_DATA_COLLECTION; - else - return PROFILING_DATA_NOCOLLECTION; - } - } - -/** -Attribute ID for file change. This identifies a read-only -Date attribute, which represents the date and time when the file -was last changed. The Date value is converted using the default Java locale. -**/ - public static final String FILE_CHANGE = "FILE_CHANGE"; - - static { - attributes_.add(FILE_CHANGE, Date.class, true); - getterMap_.add(FILE_CHANGE, QJVAMAT_, "receiverVariable.fileChangeModifyDateAndTime", new DateValueMap(DateValueMap.FORMAT_13)); - } - - - -/** -Attribute ID for Java programs. This identifies a read-only -Integer attribute, which represents the number of Java -programs associated with the file. -**/ - public static final String JAVA_PROGRAMS = "JAVA_PROGRAMS"; - - static { - attributes_.add(JAVA_PROGRAMS, Integer.class, true); - getterMap_.add(JAVA_PROGRAMS, QJVAMAT_, "receiverVariable.numberOfJavaProgramsAttached"); - } - - - -/** -Attribute ID for Java program creation. This identifies a read-only -Date attribute, which represents the date and time when the Java -program was created. If this is a zip or jar file, this is the -date and time when the first Java program was attached to the file. -If this is class file, this is the date and time when the Java -program was created. The Date value is converted using the default Java locale. -**/ - public static final String JAVA_PROGRAM_CREATION = "JAVA_PROGRAM_CREATION"; - - static { - attributes_.add(JAVA_PROGRAM_CREATION, Date.class, true); - getterMap_.add(JAVA_PROGRAM_CREATION, QJVAMAT_, "receiverVariable.javaProgramCreationDateAndTime", new DateValueMap(DateValueMap.FORMAT_13)); - } - - - -/** -Attribute ID for Java program size. This identifies -a read-only Long attribute, which represents the size, in kilobytes, -of the Java programs that are attached to the file. -**/ - public static final String JAVA_PROGRAM_SIZE = "JAVA_PROGRAM_SIZE"; - - static { - attributes_.add(JAVA_PROGRAM_SIZE, Long.class, true); - getterMap_.add(JAVA_PROGRAM_SIZE, QJVAMAT_, "receiverVariable.sizeOfJavaProgramsAttached", new JavaProgramSizeValueMap_()); - } - - private static class JavaProgramSizeValueMap_ extends AbstractValueMap - { - - public Object ptol(Object physicalValue) - { - if (physicalValue instanceof Integer) - return new Long((long)((Integer)physicalValue).intValue()); - else - return physicalValue; - } - } - - - - - - - - -/** -Attribute ID for licensed internal code options. This identifies -a String attribute, which represents the selected licensed -internal code (LIC) compile-time options that are used when -the Java program was created. -**/ - public static final String LICENSED_INTERNAL_CODE_OPTIONS = "LICENSED_INTERNAL_CODE_OPTIONS"; - - static { - attributes_.add(LICENSED_INTERNAL_CODE_OPTIONS, String.class, false); - getterMap_.add(LICENSED_INTERNAL_CODE_OPTIONS, QJVAMAT_, "receiverVariable.LICOptions"); - setterMap_.add(LICENSED_INTERNAL_CODE_OPTIONS, CHGJVAPGM_, "LICOPT", new QuoteValueMap()); - } - - - -/** -Attribute ID for optimization. This identifies an Integer attribute, -which represents the optimization level of the Java program. Possible -values are: -
        -
      • {@link #OPTIMIZATION_INTERPRET OPTIMIZATION_INTERPRET} - - The Java program is not optimized. When invoked, the Java program - interprets the class file byte codes. Variables can be displayed and - modified while debugging. -
      • {@link #OPTIMIZATION_10 OPTIMIZATION_10} - - The Java program contains a compiled version of the class file byte codes - but has only minimal additional compiler optimization. Variables can be - displayed and modified while debugging. -
      • {@link #OPTIMIZATION_20 OPTIMIZATION_20} - - The Java program contains a compiled version of the class file byte codes - and has some additional compiler optimization. Variables can be displayed - but not modified while debugging. -
      • {@link #OPTIMIZATION_30 OPTIMIZATION_30} - - The Java program contains a compiled version of the class file byte codes - and has more compiler optimization than optimization level 20. During a - debug session, user variables cannot be changed, but can be displayed. - The presented values may not be the current values of the variables. -
      • {@link #OPTIMIZATION_40 OPTIMIZATION_40} - - The Java program contains a compiled version of the class file byte codes - and has more compiler optimization than optimization level 30. All call and - instruction tracing is disabled. -
      -**/ - public static final String OPTIMIZATION = "OPTIMIZATION"; - - /** - Attribute value indicating that the Java program is not optimized. When invoked, - the Java program interprets the class file byte codes. Variables can be displayed and - modified while debugging. - - @see #OPTIMIZATION - **/ - public static final Integer OPTIMIZATION_INTERPRET = new Integer(-1); - private static final String OPTIMIZATION_INTERPRET_PHYSICAL = "*INTERPRET"; - - /** - Attribute value indicating that the Java program contains a compiled version - of the class file byte codes but has only minimal additional compiler optimization. - Variables can be displayed and modified while debugging. - - @see #OPTIMIZATION - **/ - public static final Integer OPTIMIZATION_10 = new Integer(10); - - /** - Attribute value indicating that the Java program contains a compiled version - of the class file byte codes and has some additional compiler optimization. - Variables can be displayed but not modified while debugging. - - @see #OPTIMIZATION - **/ - public static final Integer OPTIMIZATION_20 = new Integer(20); - - /** - Attribute value indicating that the Java program contains a compiled version - of the class file byte codes and has more compiler optimization than optimization - level 20. During a debug session, user variables cannot be changed, but can be - displayed. The presented values may not be the current values of the variables. - - @see #OPTIMIZATION - **/ - public static final Integer OPTIMIZATION_30 = new Integer(30); - - /** - Attribute value indicating that the Java program contains a compiled version - of the class file byte codes and has more compiler optimization than optimization - level 30. All call and instruction tracing is disabled. - - @see #OPTIMIZATION - **/ - public static final Integer OPTIMIZATION_40 = new Integer(40); - - static { - attributes_.add(OPTIMIZATION, Integer.class, false, - new Object[] {OPTIMIZATION_INTERPRET, - OPTIMIZATION_10, - OPTIMIZATION_20, - OPTIMIZATION_30, - OPTIMIZATION_40 }, null, true); - OptimizationValueMap_ valueMap = new OptimizationValueMap_(); - getterMap_.add(OPTIMIZATION, QJVAMAT_, "receiverVariable.optimizationLevel", valueMap); - setterMap_.add(OPTIMIZATION, CHGJVAPGM_, "OPTIMIZE", valueMap); - } - - private static class OptimizationValueMap_ extends AbstractValueMap - { - public Object ptol(Object physicalValue) - { - if (((Integer)physicalValue).intValue() == 0) - return OPTIMIZATION_INTERPRET; - else - return physicalValue; - } - - public Object ltop(Object logicalValue) - { - if (logicalValue.equals(OPTIMIZATION_INTERPRET)) - return OPTIMIZATION_INTERPRET_PHYSICAL; - else - return logicalValue.toString(); - } - } - - - - -/** -Attribute ID for owner. This identifies a read-only -String attribute, which represents the owner of the -Java program. -**/ - public static final String OWNER = "OWNER"; - - static { - attributes_.add(OWNER, String.class, true); - getterMap_.add(OWNER, QJVAMAT_, "receiverVariable.fileOwnerName"); - } - - - -/** -Attribute ID for release program created for. This identifies -a read-only String attribute, which represents the release of the -operating system for which the object was created. -**/ - public static final String RELEASE_PROGRAM_CREATED_FOR = "RELEASE_PROGRAM_CREATED_FOR"; - - static { - attributes_.add(RELEASE_PROGRAM_CREATED_FOR, String.class, true); - getterMap_.add(RELEASE_PROGRAM_CREATED_FOR, QJVAMAT_, "receiverVariable.javaProgramVersion", new ReleaseProgramCreatedForValueMap_()); - } - - private static class ReleaseProgramCreatedForValueMap_ extends AbstractValueMap - { - public Object ptol(Object physicalValue) - { - byte[] asBytes = (byte[])physicalValue; - StringBuffer buffer = new StringBuffer("V"); - buffer.append(asBytes[0]); - buffer.append("R"); - buffer.append(asBytes[1] >> 4); - buffer.append("M"); - buffer.append(asBytes[1] & 0x0F); - return buffer.toString(); - } - } - - - -/** -Attribute ID for use adopted authority. This identifies a read-only -String attribute, which indicates if the Java programs use adopted authority -from previous call levels in the stack. Possible values are: -
        -
      • {@link #YES YES} -
      • {@link #YES NO} -
      -**/ - public static final String USE_ADOPTED_AUTHORITY = "USE_ADOPTED_AUTHORITY"; - - static { - attributes_.add(USE_ADOPTED_AUTHORITY, String.class, true, - new Object[] {YES, NO } ,null, true); - getterMap_.add(USE_ADOPTED_AUTHORITY, QJVAMAT_, "receiverVariable.useAdoptedAuthority", new UseAdoptedAuthorityValueMap_()); - } - - private static class UseAdoptedAuthorityValueMap_ extends AbstractValueMap - { - public Object ptol(Object physicalValue) - { - return (physicalValue.equals("1") ? YES : NO); - } - } - - - -/** -Attribute ID for user profile. This identifies a read-only -String attribute, which represents who the authority checking -that was done while this program is running should include. -Possible values are: -
        -
      • {@link #USER_PROFILE_USER USER_PROFILE_USER} - - Indicates that the authority checking that was done while - this program is running should include only the user - who is running the program. -
      • {@link #USER_PROFILE_OWNER USER_PROFILE_OWNER} - - Indicates that the authority checking that was done while - this program is running should include both the use - who is running the program and the program owner. -
      -**/ - public static final String USER_PROFILE = "USER_PROFILE"; - - /** - Attribute value indicating that the authority checking that was done while - this program is running should include only the user who is running the program. - - @see #USER_PROFILE - **/ - public static final String USER_PROFILE_USER = "*USER"; - - /** - Attribute value indicating that the authority checking that was done while - this program is running should include both the use who is running the program - and the program owner. - - @see #USER_PROFILE - **/ - public static final String USER_PROFILE_OWNER = "*OWNER"; - - static { - attributes_.add(USER_PROFILE, String.class, true, - new Object[] {USER_PROFILE_USER, USER_PROFILE_OWNER } ,null, true); - getterMap_.add(USER_PROFILE, QJVAMAT_, "receiverVariable.adoptedAuthorityProfile", new UserProfileValueMap_()); - } - - private static class UserProfileValueMap_ extends AbstractValueMap - { - public Object ptol(Object physicalValue) - { - return (physicalValue.equals("1") ? USER_PROFILE_OWNER : USER_PROFILE_USER); - } - } - - - -//----------------------------------------------------------------------------------------- -// PCML document initialization. -//----------------------------------------------------------------------------------------- - - private static final String DOCUMENT_NAME_ = "com.ibm.as400.resource.RJavaProgram"; - private static ProgramCallDocument staticDocument_ = null; - - static { - // Create a static version of the PCML document, then clone it for each document. - // This will improve performance, since we will only have to deserialize the PCML - // object once. - try { - staticDocument_ = new ProgramCallDocument(); - staticDocument_.setDocument(DOCUMENT_NAME_); - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error instantiating ProgramCallDocument", e); - } - } - - -//----------------------------------------------------------------------------------------- -// Private data. -//----------------------------------------------------------------------------------------- - - private String path_ = null; - - private ProgramAttributeGetter attributeGetter_ = null; - private CommandAttributeSetter attributeSetter_ = null; - private ProgramCallDocument document_ = null; - - -//----------------------------------------------------------------------------------------- -// Constructors. -//----------------------------------------------------------------------------------------- - -/** -Constructs an RJavaProgram object. -**/ - public RJavaProgram() - { - super(presentationLoader_.getPresentationWithIcon(PRESENTATION_KEY_, ICON_BASE_NAME_), null, attributes_); - } - - - -/** -Constructs an RJavaProgram object. - -@param system The system. -@param path The path. This can be any class, jar, or zip file. -**/ - public RJavaProgram(AS400 system, String path) - { - this(); - - try { - setSystem(system); - setPath(path); - } - catch(PropertyVetoException e) { - // Ignore. - } - } - - - private void checkVRM() - throws ResourceException - { - try - { - // See if the system VRM is higher than IBM i 7.1. - if (getSystem() != null && getSystem().getVRM() > 0x00070100) { - Trace.log(Trace.ERROR, "RJavaProgram is not supported beyond IBM i 7.1."); - throw new ResourceException(ResourceException.OPERATION_NOT_SUPPORTED); - } - } - catch (ResourceException e) { throw e; } - catch (Exception e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error when checking system VRM.", e); - throw new ResourceException(e); - } - } - - -/** -Commits the specified attribute changes. - -@exception ResourceException If an error occurs. -**/ - protected void commitAttributeChanges(Object[] attributeIDs, Object[] values) - throws ResourceException - { - checkVRM(); - - super.commitAttributeChanges(attributeIDs, values); - - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); - - attributeSetter_.setValues(attributeIDs, values); - } - - - -/** -Computes the resource key. - -@param system The system. -@param path The path. -**/ - static Object computeResourceKey(AS400 system, String path) - { - StringBuffer buffer = new StringBuffer(); - buffer.append(RJavaProgram.class); - buffer.append(':'); - buffer.append(system.getSystemName()); - buffer.append(':'); - buffer.append(system.getUserId()); - buffer.append(':'); - buffer.append(path); - return buffer.toString(); - } - - - -/** -Deletes the Java program. This does not delete the class, jar, or zip file. - -@exception ResourceException If an error occurs. -**/ - public void delete() - throws ResourceException - { - checkVRM(); - - // Establish the connection if needed. - if (!isConnectionEstablished()) - establishConnection(); - - StringBuffer buffer = new StringBuffer("DLTJVAPGM CLSF('"); - buffer.append(path_); - buffer.append("')"); - try { - fireBusy(); - CommandCall dltjvapgm = new CommandCall(getSystem(), buffer.toString()); - if (dltjvapgm.run() == false) - throw new ResourceException(dltjvapgm.getMessageList()); - } - catch (Exception e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error when deleting a Java program", e); - throw new ResourceException(e); - } - finally { - fireIdle(); - } - - } - - - - -/** -Establishes the connection to the system. - -

      The method is called by the resource framework automatically -when the connection needs to be established. - -@exception ResourceException If an error occurs. -**/ - protected void establishConnection() - throws ResourceException - { - // Call the superclass. - super.establishConnection(); - - // Validate if we can establish the connection. - if (path_ == null) - throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - // Initialize the PCML document. - document_ = (ProgramCallDocument)staticDocument_.clone(); - AS400 system = getSystem(); - try { - document_.setSystem(system); - document_.setIntValue("qjvamat.lengthOfPathName", path_.length()); - document_.setValue("qjvamat.pathName", path_); - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error setting PCML document values", e); - } - - // Initialize the attribute getter. - attributeGetter_ = new ProgramAttributeGetter(system, document_, getterMap_); - - // Initialize the attribute setter. - attributeSetter_ = new CommandAttributeSetter(system, setterMap_); - attributeSetter_.setParameterValue(CHGJVAPGM_, PATH_PARAMETER_, '\'' + path_ + '\''); - } - - -/** -Freezes any property changes. After this is called, property -changes should not be made. Properties are not the same thing -as attributes. Properties are basic pieces of information -which must be set to make the object usable, such as the system -and path. - -

      The method is called by the resource framework automatically -when the properties need to be frozen. - -@exception ResourceException If an error occurs. -**/ - protected void freezeProperties() - throws ResourceException - { - // Call the superclass. - super.freezeProperties(); - - // Validate if we can establish the connection. - if (path_ == null) - throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - // Update the presentation. - Presentation presentation = getPresentation(); - IFSFile f = new IFSFile(getSystem(), path_); - presentation.setName(f.getName()); - presentation.setFullName(f.getPath()); - - // Update the resource key. - if (getResourceKey() == null) - setResourceKey(computeResourceKey(getSystem(), path_)); - } - - - -/** -Returns the unchanged value of an attribute. If the attribute -value has a uncommitted change, this returns the unchanged value. -If the attribute value does not have a uncommitted change, this -returns the same value as getAttributeValue(). - -@param attributeID Identifies the attribute. -@return The attribute value, or null if the attribute - value is not available. - -@exception ResourceException If an error occurs. -**/ - public Object getAttributeUnchangedValue(Object attributeID) - throws ResourceException - { - checkVRM(); - - Object value = super.getAttributeUnchangedValue(attributeID); - if (value == null) { - - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); - - value = attributeGetter_.getValue(attributeID); - - /* @A1D - // Check to see if the Java program exists (the API will not result - // in an exception in this case). - try { - if (document_.getIntValue("qjvalibjvm.receiverVariable.bytesAvailable") == 0) - throw new ResourceException(ResourceException.ATTRIBUTES_NOT_RETURNED); - } - catch(PcmlException e) { - throw new ResourceException(e); - } - */ - } - return value; - } - - - - -/** -Returns the path. - -@return The path. -**/ - public String getPath() - { - return path_; - } - - - -/** -Refreshes the values for all attributes. This does not cancel -uncommitted changes. This method fires an attributeValuesRefreshed() -ResourceEvent. - -@exception ResourceException If an error occurs. -**/ - public void refreshAttributeValues() - throws ResourceException - { - checkVRM(); - - super.refreshAttributeValues(); - - if (attributeGetter_ != null) - attributeGetter_.clearBuffer(); - } - - - -/** -Sets the path. This does not change the Java program -on the system. Instead, it changes the Java program -that this object references. - -@param path The path. This can be any class, jar, or zip file. -**/ - public void setPath(String path) - { - if (path == null) - throw new NullPointerException("path"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - String oldValue = path_; - path_ = path; - firePropertyChange("path", oldValue, path_); - } - - - -/** -Returns the path. - -@return The path. -**/ - public String toString() - { - return (path_ == null) ? "" : path_; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/RJavaProgram.pcml b/cvsroot/src/com/ibm/as400/resource/RJavaProgram.pcml deleted file mode 100644 index 6cefc1179..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RJavaProgram.pcml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/resource/RJavaProgram16.gif b/cvsroot/src/com/ibm/as400/resource/RJavaProgram16.gif deleted file mode 100644 index 98e18cc2b..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RJavaProgram16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RJavaProgram32.gif b/cvsroot/src/com/ibm/as400/resource/RJavaProgram32.gif deleted file mode 100644 index e1fc5df46..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RJavaProgram32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RJavaProgramBeanInfo.java b/cvsroot/src/com/ibm/as400/resource/RJavaProgramBeanInfo.java deleted file mode 100644 index 3f730af8d..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RJavaProgramBeanInfo.java +++ /dev/null @@ -1,155 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RJavaProgramBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Trace; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.util.ResourceBundle; - - - -/** -The RJavaProgramBeanInfo class represents the bean information -for the RJavaProgram class. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class RJavaProgramBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final Class beanClass_ = RJavaProgram.class; - - private static BeanInfo[] additionalBeanInfo_; - private static BeanDescriptor beanDescriptor_; - private static Image icon16_; - private static Image icon32_; - private static PropertyDescriptor[] propertyDescriptors_; - private static ResourceBundle resourceBundle_; - - - -/** -Static initializer. -**/ - static - { - try - { - // Set up the resource bundle. - resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.resource.ResourceMRI"); - - // Set up the additional bean info. - additionalBeanInfo_ = new BeanInfo[] { new ResourceBeanInfo() }; - - // Set up the bean descriptor. - beanDescriptor_ = new BeanDescriptor(beanClass_); - - // Set up the property descriptors. - PropertyDescriptor path = new PropertyDescriptor("path", beanClass_); - path.setBound(true); - path.setConstrained(true); - path.setDisplayName(resourceBundle_.getString("PROPERTY_PATH_NAME")); - path.setShortDescription(resourceBundle_.getString("PROPERTY_PATH_DESCRIPTION")); - - propertyDescriptors_ = new PropertyDescriptor[] { path }; - - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error while loading bean info", e); - throw new Error(e.toString()); - } - } - - - -/** -Returns the additional bean information. - -@return The additional bean information. -**/ - public BeanInfo[] getAdditionalBeanInfo() - { - return additionalBeanInfo_; - } - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - - -/** -Returns the property descriptors. - -@return The property descriptors. -**/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors_; - } - - - -/** -Returns the icon. - -@param icon The icon kind. Possible values are: -

        -
      • BeanInfo.ICON_MONO_16x16 -
      • BeanInfo.ICON_MONO_32x32 -
      • BeanInfo.ICON_COLOR_16x16 -
      • BeanInfo.ICON_COLOR_32x32 -
      -@return The icon. -**/ - public Image getIcon(int icon) - { - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - if (icon16_ == null) - icon16_ = loadImage("RJavaProgram16.gif"); - return icon16_; - - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - if (icon32_ == null) - icon32_ = loadImage("RJavaProgram16.gif"); - return icon32_; - - default: - throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/RJob.java b/cvsroot/src/com/ibm/as400/resource/RJob.java deleted file mode 100644 index 32f53e968..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RJob.java +++ /dev/null @@ -1,3528 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RJob.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.CommandCall; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Job; -import com.ibm.as400.access.Trace; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.beans.PropertyVetoException; -import java.util.Calendar; -import java.util.Date; -import java.util.Hashtable; - - - -/** -The RJob class represents a server job. In order to access a job, -the system and either the job name, user name, and job number or -internal job identifier need to be set. A valid combination of -these must be set by getting or setting any of the job's attributes. - - -

      If you do not specify any of the job name, user name, job number, -or internal job identifier properties, the default job is used. -The default job is the host server job for remote program calls. - - -

      The following attribute IDs are supported: -

      - - -

      Use any of these attribute IDs with -{@link com.ibm.as400.resource.ChangeableResource#getAttributeValue(java.lang.Object) getAttributeValue()} -and {@link com.ibm.as400.resource.ChangeableResource#setAttributeValue(java.lang.Object, java.lang.Object) setAttributeValue()} -to access the attribute values for an RJob. - -

      -// Create an RJob object to refer to a specific job.
      -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
      -RJob job = new RJob(system, "AJOBNAME", "AUSERID", "AJOBNUMBER");
      -
      -// Get the job subtype. -String jobSubtype = (String)job.getAttributeValue(RJob.JOB_SUBTYPE); -
      -// Set the date format for a job to Julian. -job.setAttributeValue(RJob.DATE_FORMAT, RJob.DATE_FORMAT_JULIAN); -
      -// Commit the attribute change. -job.commitAttributeChanges(); -
      - -@deprecated Use -{@link com.ibm.as400.access.Job Job} instead, as this package may be removed in the future. -@see RJobList -**/ -public class RJob -extends ChangeableResource -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - -//----------------------------------------------------------------------------------------- -// Presentation. -//----------------------------------------------------------------------------------------- - - private static PresentationLoader presentationLoader_ = new PresentationLoader("com.ibm.as400.resource.ResourceMRI"); - private static final String ICON_BASE_NAME_ = "RJob"; - private static final String PRESENTATION_KEY_ = "JOB"; - - - -//----------------------------------------------------------------------------------------- -// Attribute values. -//----------------------------------------------------------------------------------------- - -/** -Attribute value for system value. -**/ - public static final String SYSTEM_VALUE = "*SYSVAL"; - -/** -Attribute value for user profile. -**/ - public static final String USER_PROFILE = "*USRPRF"; - -/** -Attribute value for yes. -**/ - public static final String YES = "*YES"; - -/** -Attribute value for no. -**/ - public static final String NO = "*NO"; - -/** -Attribute value for none. -**/ - public static final String NONE = "*NONE"; - -/** -Attribute value for no date. -**/ - public static final Date NO_DATE = DateValueMap.NO_DATE; - - -//----------------------------------------------------------------------------------------- -// Attribute IDs. -// -// * If you add an attribute here, make sure and add it to the class javadoc. -//----------------------------------------------------------------------------------------- - - // Private data. - static ResourceMetaDataTable attributes_ = new ResourceMetaDataTable(presentationLoader_, PRESENTATION_KEY_); - private static ProgramMap getterMap_ = new ProgramMap(); - private static ProgramKeys setterKeys_ = new ProgramKeys(); - - private static ArrayTypeValueMap arrayTypeValueMapString_= new ArrayTypeValueMap(String.class); - private static IntegerValueMap integerValueMap_ = new IntegerValueMap(); - private static DateValueMap dateValueMap7_ = new DateValueMap(DateValueMap.FORMAT_6); - private static DateValueMap dateValueMap6_ = new DateValueMap(DateValueMap.FORMAT_7); - private static DateValueMap dateValueMap13_ = new DateValueMap(DateValueMap.FORMAT_13); - private static DateValueMap dateValueMapDts_ = new DateValueMap(DateValueMap.FORMAT_DTS); - - private static final String JOBI0100_ = "qusrjobi_jobi0100"; - private static final String JOBI0150_ = "qusrjobi_jobi0150"; - private static final String JOBI0200_ = "qusrjobi_jobi0200"; - private static final String JOBI0300_ = "qusrjobi_jobi0300"; - private static final String JOBI0400_ = "qusrjobi_jobi0400"; - private static final String JOBI0500_ = "qusrjobi_jobi0500"; - private static final String JOBI0600_ = "qusrjobi_jobi0600"; - private static final String JOBI0700_ = "qusrjobi_jobi0700"; - private static final String JOBI0800_ = "qusrjobi_jobi0800"; - private static final String JOBI0900_ = "qusrjobi_jobi0900"; - - - -/** -Attribute ID for accounting code. This identifies a String attribute, which -represents the identifier assigned to the job by the system to collect resource -use information for the job when job accounting is active. -**/ - public static final String ACCOUNTING_CODE = "ACCOUNTING_CODE"; - - static { - attributes_.add(ACCOUNTING_CODE, String.class, false); - getterMap_.add(ACCOUNTING_CODE, JOBI0400_, "receiverVariable.jobAccountingCode"); - setterKeys_.add(ACCOUNTING_CODE, 1001, ProgramKeys.CHAR, 15); - } - - - -/** -Attribute ID for active job status. This identifies a read-only String attribute, -which represents the active status of the initial thread. -**/ - public static final String ACTIVE_JOB_STATUS = "ACTIVE_JOB_STATUS"; - - static { - attributes_.add(ACTIVE_JOB_STATUS, String.class, true); - getterMap_.add(ACTIVE_JOB_STATUS, JOBI0200_, "receiverVariable.activeJobStatus"); - } - - - -/** -Attribute ID for auxiliary I/O requests. This identifies a read-only Integer attribute, -which represents the number of auxiliary I/O requests for the initial thread of the job. -**/ - public static final String AUXILIARY_IO_REQUESTS = "AUXILIARY_IO_REQUESTS"; - - static { - attributes_.add(AUXILIARY_IO_REQUESTS, Integer.class, true); - getterMap_.add(AUXILIARY_IO_REQUESTS, JOBI0200_, "receiverVariable.numberOfAuxiliaryIORequests"); - } - - - -/** -Attribute ID for break message handling. This identifies a String attribute, -which represents how this job handles break messages. Possible values are: -
        -
      • {@link #BREAK_MESSAGE_HANDLING_NORMAL BREAK_MESSAGE_HANDLING_NORMAL} - - The message queue status determines break message handling. -
      • {@link #BREAK_MESSAGE_HANDLING_HOLD BREAK_MESSAGE_HANDLING_HOLD} - - The message queue holds break messages until a user or program - requests them. -
      • {@link #BREAK_MESSAGE_HANDLING_NOTIFY BREAK_MESSAGE_HANDLING_NOTIFY} - - The system notifies the job's message queue when a message - arrives. -
      -**/ - public static final String BREAK_MESSAGE_HANDLING = "BREAK_MESSAGE_HANDLING"; - - /** - Attribute value indicating that the message queue status determines break message handling. - - @see #BREAK_MESSAGE_HANDLING - **/ - public static final String BREAK_MESSAGE_HANDLING_NORMAL = "*NORMAL"; - - /** - Attribute value indicating that the message queue holds break messages until a user or program - requests them. - - @see #BREAK_MESSAGE_HANDLING - **/ - public static final String BREAK_MESSAGE_HANDLING_HOLD = "*HOLD"; - - /** - Attribute value indicating that the system notifies the job's message queue when a message - arrives. - - @see #BREAK_MESSAGE_HANDLING - **/ - public static final String BREAK_MESSAGE_HANDLING_NOTIFY = "*NOTIFY"; - - static { - attributes_.add(BREAK_MESSAGE_HANDLING, String.class, false, - new Object[] {BREAK_MESSAGE_HANDLING_NORMAL, - BREAK_MESSAGE_HANDLING_HOLD, - BREAK_MESSAGE_HANDLING_NOTIFY}, null, true); - getterMap_.add(BREAK_MESSAGE_HANDLING, JOBI0400_, "receiverVariable.breakMessageHandling"); - setterKeys_.add(BREAK_MESSAGE_HANDLING, 201, ProgramKeys.CHAR, 10); - } - - - -/** -Attribute ID for coded character set identifier (CCSID). -This identifies an Integer attribute. - -

      The following special values can be used when setting the CCSID: -

        -
      • {@link #CCSID_SYSTEM_VALUE CCSID_SYSTEM_VALUE} - The CCSID specified - in the system value QCCSID is used. -
      • {@link #CCSID_INITIAL_USER CCSID_INITIAL_USER} - The CCSID specified - in the user profile under which this thread was initially running is - used. -
      -**/ - public static final String CCSID = "CCSID"; - - /** - Attribute value indicating that the CCSID specified - in the system value QCCSID is used. - - @see #CCSID - **/ - public static final int CCSID_SYSTEM_VALUE = -1; - - /** - Attribute value indicating that the CCSID specified - in the user profile under which this thread was initially running is - used. - - @see #CCSID - **/ - public static final int CCSID_INITIAL_USER = -2; - - static { - attributes_.add(CCSID, Integer.class, false, - new Object[] {new Integer(CCSID_SYSTEM_VALUE), - new Integer(CCSID_INITIAL_USER)}, null, false); - getterMap_.add(CCSID, JOBI0400_, "receiverVariable.codedCharacterSetID"); - setterKeys_.add(CCSID, 302, ProgramKeys.BINARY); - } - - - -/** -Attribute ID for completion status. This identifies a read-only String attribute, -which represents the completion status of the job. Possible values are: -
        -
      • {@link #COMPLETION_STATUS_NOT_COMPLETED COMPLETION_STATUS_NOT_COMPLETED} - - The job has not completed. -
      • {@link #COMPLETION_STATUS_COMPLETED_NORMALLY COMPLETION_STATUS_COMPLETED_NORMALLY} - - The job completed normally. -
      • {@link #COMPLETION_STATUS_COMPLETED_ABNORMALLY COMPLETION_STATUS_COMPLETED_ABNORMALLY} - - The job completed abnormally. -
      -**/ - public static final String COMPLETION_STATUS = "COMPLETION_STATUS"; - - /** - Attribute value indicating that the job has not completed. - - @see #COMPLETION_STATUS - **/ - public static final String COMPLETION_STATUS_NOT_COMPLETED = ""; - - /** - Attribute value indicating that the job completed normally. - - @see #COMPLETION_STATUS - **/ - public static final String COMPLETION_STATUS_COMPLETED_NORMALLY = "0"; - - /** - Attribute value indicating that the job completed abnormally. - - @see #COMPLETION_STATUS - **/ - public static final String COMPLETION_STATUS_COMPLETED_ABNORMALLY = "1"; - - static { - attributes_.add(COMPLETION_STATUS, String.class, true, - new Object[] {COMPLETION_STATUS_NOT_COMPLETED, - COMPLETION_STATUS_COMPLETED_NORMALLY, - COMPLETION_STATUS_COMPLETED_ABNORMALLY}, null, true); - getterMap_.add(COMPLETION_STATUS, JOBI0400_, "receiverVariable.completionStatus"); - } - - - -/** -Attribute ID for controlled end requested. This identifies a read-only String attribute, -which indicates whether or not the system issued a controlled cancelation. Possible -values are: -
        -
      • {@link #CONTROLLED_END_REQUESTED_CANCELED CONTROLLED_END_REQUESTED_CANCELED} - - The system, the subsystem in which the job is running, - or the job itself is canceled. -
      • {@link #CONTROLLED_END_REQUESTED_NOT_CANCELED CONTROLLED_END_REQUESTED_NOT_CANCELED} - - The system, subsystem, or job is not canceled. -
      • {@link #CONTROLLED_END_REQUESTED_NOT_RUNNING CONTROLLED_END_REQUESTED_NOT_RUNNING} - - The job is not running. -
      -**/ - public static final String CONTROLLED_END_REQUESTED = "CONTROLLED_END_REQUESTED"; - - /** - Attribute value indicating that the system, the subsystem in which the job is running, - or the job itself is canceled. - - @see #CONTROLLED_END_REQUESTED - **/ - public static final String CONTROLLED_END_REQUESTED_CANCELED = "1"; - - /** - Attribute value indicating that the system, subsystem, or job is not canceled. - - @see #CONTROLLED_END_REQUESTED - **/ - public static final String CONTROLLED_END_REQUESTED_NOT_CANCELED = "0"; - - /** - Attribute value indicating that the job is not running. - - @see #CONTROLLED_END_REQUESTED - **/ - public static final String CONTROLLED_END_REQUESTED_NOT_RUNNING = ""; - - static { - attributes_.add(CONTROLLED_END_REQUESTED, String.class, true, - new Object[] {CONTROLLED_END_REQUESTED_CANCELED, - CONTROLLED_END_REQUESTED_NOT_CANCELED, - CONTROLLED_END_REQUESTED_NOT_RUNNING}, null, true); - getterMap_.add(CONTROLLED_END_REQUESTED, JOBI0600_, "receiverVariable.endStatus"); - } - - - -/** -Attribute ID for country ID. This identifies a String attribute. - -

      The following special values can be used when setting the country ID: -

        -
      • {@link #SYSTEM_VALUE SYSTEM_VALUE} - The - system value QCNTRYID is used. -
      • {@link #USER_PROFILE USER_PROFILE} - The - country ID specified in the user profile under which this thread - was initially running is used. -
      -**/ - public static final String COUNTRY_ID = "COUNTRY_ID"; - - static { - attributes_.add(COUNTRY_ID, String.class, false, - new Object[] {SYSTEM_VALUE, USER_PROFILE}, null, false); - getterMap_.add(COUNTRY_ID, JOBI0400_, "receiverVariable.countryID"); - setterKeys_.add(COUNTRY_ID, 303, ProgramKeys.CHAR, 10); - } - - - -/** -Attribute ID for CPU time used. This identifies a read-only Integer attribute, -which represents the amount of processing unit time (in milliseconds) that the -job used. -**/ - public static final String CPU_TIME_USED = "CPU_TIME_USED"; - - static { - attributes_.add(CPU_TIME_USED, Integer.class, true); - getterMap_.add(CPU_TIME_USED, JOBI0150_, "receiverVariable.processingUnitTimeUsed"); - getterMap_.add(CPU_TIME_USED, JOBI0200_, "receiverVariable.processingUnitTimeUsed"); - } - - - -/** -Attribute ID for current library. This identifies a read-only String -attribute, which represents the name of the current library -for the initial thread of the job. -**/ - public static final String CURRENT_LIBRARY = "CURRENT_LIBRARY"; - - static { - attributes_.add(CURRENT_LIBRARY, String.class, true); - getterMap_.add(CURRENT_LIBRARY, JOBI0700_, "receiverVariable.currentLibrary", "receiverVariable.currentLibraryExistence", new CurrentLibraryValueMap_()); - } - - private static class CurrentLibraryValueMap_ extends AbstractValueMap - { - public Object ptol(Object physicalValue) - { - String[] logicalValue = (String[])arrayTypeValueMapString_.ptol(physicalValue); - if (logicalValue.length == 0) - return ""; - else - return logicalValue[0]; - } - } - - - -/** -Attribute ID for current library existence. This identifies a -read-only Boolean attribute, which indicates if a current library -exists. -**/ - public static final String CURRENT_LIBRARY_EXISTENCE = "CURRENT_LIBRARY_EXISTENCE"; - - static { - attributes_.add(CURRENT_LIBRARY_EXISTENCE, Boolean.class, true); - getterMap_.add(CURRENT_LIBRARY_EXISTENCE, JOBI0700_, "receiverVariable.currentLibraryExistence", new BooleanValueMap(new Integer(0), new Integer(1))); - } - - - -/** -Attribute ID for current system pool ID. This identifies a read-only -Integer attribute, which represents the identifier of the system-related -pool from which main storage is currently being allocated for the job's -initial thread. -**/ - public static final String CURRENT_SYSTEM_POOL_ID = "CURRENT_SYSTEM_POOL_ID"; - - static { - attributes_.add(CURRENT_SYSTEM_POOL_ID, Integer.class, true); - getterMap_.add(CURRENT_SYSTEM_POOL_ID, JOBI0200_, "receiverVariable.currentSystemPoolIdentifier"); - } - - - -/** -Attribute ID for current user. This identifies a read-only String -attribute, which represents the user profile under which the initial -thread of the current job is running. -**/ - public static final String CURRENT_USER = "CURRENT_USER"; - - static { - attributes_.add(CURRENT_USER, String.class, true); - getterMap_.add(CURRENT_USER, JOBI0600_, "receiverVariable.currentUserProfile"); - } - - - -/** -Attribute ID for date entered system. This identifies a read-only -Date attribute, which represents the date and time when the job was -placed on the system. The Date value is converted using the default Java locale. -**/ - public static final String DATE_ENTERED_SYSTEM = "DATE_ENTERED_SYSTEM"; - - static { - attributes_.add(DATE_ENTERED_SYSTEM, Date.class, true); - getterMap_.add(DATE_ENTERED_SYSTEM, JOBI0400_, "receiverVariable.dateAndTimeJobEnteredSystem", dateValueMap13_); - } - - - -/** -Attribute ID for date format. This identifies a String attribute, which -represents the format in which dates are presented. Possible values are: -
        -
      • {@link #DATE_FORMAT_YMD DATE_FORMAT_YMD} - Year, month, and day format. -
      • {@link #DATE_FORMAT_MDY DATE_FORMAT_MDY} - Month, day, and year format. -
      • {@link #DATE_FORMAT_DMY DATE_FORMAT_DMY} - Day, month, and year format. -
      • {@link #DATE_FORMAT_JULIAN DATE_FORMAT_JULIAN} - Julian format (year and day). -
      - -

      The following special values can be used when setting the date format: -

        -
      • {@link #DATE_FORMAT_SYSTEM_VALUE DATE_FORMAT_SYSTEM_VALUE} - The - system value QDATFMT is used. -
      -**/ - public static final String DATE_FORMAT = "DATE_FORMAT"; - - /** - Attribute value indicating that the system value QDATFMT is used. - - @see #DATE_FORMAT - **/ - public static final String DATE_FORMAT_SYSTEM_VALUE = "*SYS"; - - /** - Attribute value indicating the year, month, and day date format. - - @see #DATE_FORMAT - **/ - public static final String DATE_FORMAT_YMD = "*YMD"; - - /** - Attribute value indicating the month, day, and year date format. - - @see #DATE_FORMAT - **/ - public static final String DATE_FORMAT_MDY = "*MDY"; - - /** - Attribute value indicating the day, month, and year date format. - - @see #DATE_FORMAT - **/ - public static final String DATE_FORMAT_DMY = "*DMY"; - - /** - Attribute value indicating the Julian date format. - - @see #DATE_FORMAT - **/ - public static final String DATE_FORMAT_JULIAN = "*JUL"; - - static { - attributes_.add(DATE_FORMAT, String.class, false, - new Object[] { DATE_FORMAT_YMD, - DATE_FORMAT_MDY, - DATE_FORMAT_DMY, - DATE_FORMAT_JULIAN, - DATE_FORMAT_SYSTEM_VALUE }, null, true); - getterMap_.add(DATE_FORMAT, JOBI0400_, "receiverVariable.dateFormat"); - setterKeys_.add(DATE_FORMAT, 405, ProgramKeys.CHAR, 4); - } - - - -/** -Attribute ID for date separator. This identifies a String attribute, which -represents the value used to separate days, months, and years when presenting -a date. - -

      The following special value can be used when setting the date separator: -

        -
      • {@link #DATE_SEPARATOR_SYSTEM_VALUE DATE_SEPARATOR_SYSTEM_VALUE} - The - system value QDATSEP is used. -
      -**/ - public static final String DATE_SEPARATOR = "DATE_SEPARATOR"; - - /** - Attribute value indicating that the system value QDATSEP is used. - - @see #DATE_SEPARATOR - **/ - public static final String DATE_SEPARATOR_SYSTEM_VALUE = "S"; - - static { - attributes_.add(DATE_SEPARATOR, String.class, false, - new Object[] {DATE_SEPARATOR_SYSTEM_VALUE}, null, false); - getterMap_.add(DATE_SEPARATOR, JOBI0400_, "receiverVariable.dateSeparator", new DateSeparatorValueMap_()); - setterKeys_.add(DATE_SEPARATOR, 406, ProgramKeys.CHAR, 1); - } - - private static class DateSeparatorValueMap_ extends AbstractValueMap - { - public Object ptol(Object physicalValue, AS400 system) - { - // PCML trims blanks, however a blank is a valid date separator. - // Preserve it. - if (((String)physicalValue).length() == 0) - return " "; - else - return super.ptol(physicalValue); - } - } - - - -/** -Attribute ID for date started. This identifies a read-only Date attribute, -which represents the date and time when the job began to run on the system. -The Date value is converted using the default Java locale. -**/ - public static final String DATE_STARTED = "DATE_STARTED"; - - static { - attributes_.add(DATE_STARTED, Date.class, true); - getterMap_.add(DATE_STARTED, JOBI0400_, "receiverVariable.dateAndTimeJobBecameActive", dateValueMap13_); - } - - - -/** -Attribute ID for DBCS capable. This identifies a read-only Boolean attribute, -which indicates whether the job is DBCS capable. -**/ - public static final String DBCS_CAPABLE = "DBCS_CAPABLE"; - - static { - attributes_.add(DBCS_CAPABLE, Boolean.class, true); - getterMap_.add(DBCS_CAPABLE, JOBI0600_, "receiverVariable.dbcsCapable", new BooleanValueMap(new String[] {"0", ""}, new String[] { "1" })); - } - - - -/** -Attribute ID for decimal format. This identifies a String attribute, which -represents the decimal format used for this job. Possible values are: -
        -
      • {@link #DECIMAL_FORMAT_PERIOD DECIMAL_FORMAT_PERIOD} - Uses a period - for a decimal point, a comma for a 3-digit grouping character, and zero-suppresses - to the left of the decimal point. -
      • {@link #DECIMAL_FORMAT_COMMA_I DECIMAL_FORMAT_COMMA_I} - Uses a comma for - a decimal point and a period for a 3-digit grouping character. The zero-suppression - character is in the second character (rather than the first) to the left of the decimal - notation. Balances with zero values to the left of the comma are written with one - leading zero. -
      • {@link #DECIMAL_FORMAT_COMMA_J DECIMAL_FORMAT_COMMA_J} - Uses a comma for a decimal - point, a period for a 3-digit grouping character, and zero-suppresses to the left of the - decimal point. -
      - -

      The following special value can be used when setting the decimal separator: -

        -
      • {@link #SYSTEM_VALUE SYSTEM_VALUE} - The - system value QDECFMT is used. -
      -**/ - public static final String DECIMAL_FORMAT = "DECIMAL_FORMAT"; - - /** - Attribute value indicating the date format that uses a period for a decimal point, a comma - for a 3-digit grouping character, and zero-suppresses to the left of - the decimal point. - - @see #DECIMAL_FORMAT - **/ - public static final String DECIMAL_FORMAT_PERIOD = ""; - - /** - Attribute value indicating the date format that uses a comma for a decimal point - and a period for a 3-digit grouping character. The zero-suppression character is - in the second character (rather than the first) to the left of the decimal - notation. Balances with zero values to the left of the comma are - written with one leading zero. - - @see #DECIMAL_FORMAT - **/ - public static final String DECIMAL_FORMAT_COMMA_I = "I"; - - /** - Attribute value indicating the date format that uses a comma for a decimal point, - a period for a 3-digit grouping character, and zero-suppresses to the left of the - decimal point. - - @see #DECIMAL_FORMAT - **/ - public static final String DECIMAL_FORMAT_COMMA_J = "J"; - - static { - attributes_.add(DECIMAL_FORMAT, String.class, false, - new Object[] { SYSTEM_VALUE, - DECIMAL_FORMAT_PERIOD, - DECIMAL_FORMAT_COMMA_I, - DECIMAL_FORMAT_COMMA_J }, null, true); - getterMap_.add(DECIMAL_FORMAT, JOBI0400_, "receiverVariable.decimalFormat"); - setterKeys_.add(DECIMAL_FORMAT, 413, ProgramKeys.CHAR, 8); - } - - - -/** -Attribute ID for default coded character set identifier (CCSID). This identifies a -read-only Integer attribute, which represents the default CCSID for this job. -The value will be 0 if the job is not active. -**/ - public static final String DEFAULT_CCSID = "DEFAULT_CCSID"; - - static { - attributes_.add(DEFAULT_CCSID, Integer.class, true); - getterMap_.add(DEFAULT_CCSID, JOBI0400_, "receiverVariable.defaultCodedCharacterSetIdentifier"); - } - - - -/** -Attribute ID for default wait time. This identifies an Integer attribute, -which represents the default maximum time (in seconds) that a thread in the job -waits for a system instruction. The value -1 means there is no maximum. -The value 0 is not valid. -**/ - public static final String DEFAULT_WAIT_TIME = "DEFAULT_WAIT_TIME"; - - static { - attributes_.add(DEFAULT_WAIT_TIME, Integer.class, false); - getterMap_.add(DEFAULT_WAIT_TIME, JOBI0100_, "receiverVariable.defaultWait"); - getterMap_.add(DEFAULT_WAIT_TIME, JOBI0150_, "receiverVariable.defaultWait"); - setterKeys_.add(DEFAULT_WAIT_TIME, 409, ProgramKeys.BINARY); - } - - - -/** -Attribute ID for device recovery action. This identifies a String attribute, -which represents the action taken for interactive jobs when an I/O error occurs -for the job's requesting program device. Possible values are: -
        -
      • {@link #DEVICE_RECOVERY_ACTION_MESSAGE DEVICE_RECOVERY_ACTION_MESSAGE} - - Signals the I/O error message to the application and lets the application program - perform error recovery. -
      • {@link #DEVICE_RECOVERY_ACTION_DISCONNECT_MESSAGE DEVICE_RECOVERY_ACTION_DISCONNECT_MESSAGE} - - Disconnects the job when an I/O error occurs. When the job reconnects, the system - sends an error message to the application program, indicating the job has reconnected - and that the workstation device has recovered. -
      • {@link #DEVICE_RECOVERY_ACTION_DISCONNECT_END_REQUEST DEVICE_RECOVERY_ACTION_DISCONNECT_END_REQUEST} - - Disconnects the job when an I/O error occurs. When the job reconnects, the system - sends the End Request (ENDRQS) command to return control to the previous request - level. -
      • {@link #DEVICE_RECOVERY_ACTION_END_JOB DEVICE_RECOVERY_ACTION_END_JOB} - - Ends the job when an I/O error occurs. A message is sent to the job's log and - to the history log (QHST) indicating the job ended because of a device error. -
      • {@link #DEVICE_RECOVERY_ACTION_END_JOB_NO_LIST DEVICE_RECOVERY_ACTION_END_JOB_NO_LIST} - - Ends the job when an I/O error occurs. There is no job log produced for the job. - The system sends a message to the QHST log indicating the job ended because of a device error. -
      - -

      The following special values can be used when setting the device recovery action: -

        -
      • {@link #SYSTEM_VALUE SYSTEM_VALUE} - The - system value QDEVRCYACN is used. -
      -**/ - public static final String DEVICE_RECOVERY_ACTION = "DEVICE_RECOVERY_ACTION"; - - /** - Attribute value indicating the device recovery action that signals the I/O - error message to the application and lets the application program perform - error recovery. - - @see #DEVICE_RECOVERY_ACTION - **/ - public static final String DEVICE_RECOVERY_ACTION_MESSAGE = "*MSG"; - - /** - Attribute value indicating the device recovery action that disconnects the - job when an I/O error occurs. - - @see #DEVICE_RECOVERY_ACTION - **/ - public static final String DEVICE_RECOVERY_ACTION_DISCONNECT_MESSAGE = "*DSCMSG"; - - /** - Attribute value indicating the device recovery action that disconnects the - job when an I/O error occurs. When the job reconnects, the system - sends the End Request (ENDRQS) command to return control to the previous request - level. - - @see #DEVICE_RECOVERY_ACTION - **/ - public static final String DEVICE_RECOVERY_ACTION_DISCONNECT_END_REQUEST= "*DSCENDRQS"; - - /** - Attribute value indicating the device recovery action that ends the job when - an I/O error occurs. A message is sent to the job's log and - to the history log (QHST) indicating the job ended because of a device error. - - @see #DEVICE_RECOVERY_ACTION - **/ - public static final String DEVICE_RECOVERY_ACTION_END_JOB = "*ENDJOB"; - - /** - Attribute value indicating the device recovery action that ends the job when - an I/O error occurs. There is no job log produced for the job. - The system sends a message to the QHST log indicating the job ended because of a device error. - - @see #DEVICE_RECOVERY_ACTION - **/ - public static final String DEVICE_RECOVERY_ACTION_END_JOB_NO_LIST = "*ENDJOBNOLIST"; - - static { - attributes_.add(DEVICE_RECOVERY_ACTION, String.class, false, - new Object[] { DEVICE_RECOVERY_ACTION_MESSAGE, - DEVICE_RECOVERY_ACTION_DISCONNECT_MESSAGE, - DEVICE_RECOVERY_ACTION_DISCONNECT_END_REQUEST, - DEVICE_RECOVERY_ACTION_END_JOB, - DEVICE_RECOVERY_ACTION_END_JOB_NO_LIST, - SYSTEM_VALUE }, null, true); - getterMap_.add(DEVICE_RECOVERY_ACTION, JOBI0400_, "receiverVariable.deviceRecoveryAction"); - setterKeys_.add(DEVICE_RECOVERY_ACTION, 410, ProgramKeys.CHAR, 13); - } - - - -/** -Attribute ID for eligible for purge. This identifies a Boolean attribute, -which indicates whether the job is eligible to be moved out of main storage -and put into auxiliary storage at the end of a time slice or when it is -beginning a long wait. -**/ - public static final String ELIGIBLE_FOR_PURGE = "ELIGIBLE_FOR_PURGE"; - - static { - attributes_.add(ELIGIBLE_FOR_PURGE, Boolean.class, false); - ValueMap valueMap = new BooleanValueMap(new String[] {NO, ""}, new String[] { YES }); - getterMap_.add(ELIGIBLE_FOR_PURGE, JOBI0100_, "receiverVariable.purge", valueMap); - getterMap_.add(ELIGIBLE_FOR_PURGE, JOBI0150_, "receiverVariable.purge", valueMap); - setterKeys_.add(ELIGIBLE_FOR_PURGE, 1604, ProgramKeys.CHAR, 4, valueMap); - } - - - -/** -Attribute ID for end severity. This identifies a read-only Integer attribute, -which represents the message severity level of escape messages that can cause a batch -job to end. The batch job ends when a request in the batch input stream sends -an escape message, whose severity is equal to or greater than this value, to the -request processing program. -**/ - public static final String END_SEVERITY = "END_SEVERITY"; - - static { - attributes_.add(END_SEVERITY, Integer.class, true); - getterMap_.add(END_SEVERITY, JOBI0500_, "receiverVariable.endSeverity"); - } - - -/** -Attribute ID for function name. This identifies a read-only String attribute, which -represents additional information about the function the initial thread is currently -performing. This information is updated only when a command is processed. -**/ - public static final String FUNCTION_NAME = "FUNCTION_NAME"; - - static { - attributes_.add(FUNCTION_NAME, String.class, true); - getterMap_.add(FUNCTION_NAME, JOBI0200_, "receiverVariable.functionName"); - } - - -/** -Attribute ID for function type. This identifies a read-only String attribute, -which represents the high-level function type the initial thread is performing, -if any. Possible values are: -
        -
      • {@link #FUNCTION_TYPE_BLANK FUNCTION_TYPE_BLANK} - The system is not performing a logged function. -
      • {@link #FUNCTION_TYPE_COMMAND FUNCTION_TYPE_COMMAND} - A command is running interactively, or it is - in a batch input stream, or it was requested from a system menu. -
      • {@link #FUNCTION_TYPE_DELAY FUNCTION_TYPE_DELAY} - The initial thread of the job is processing - a Delay Job (DLYJOB) command. -
      • {@link #FUNCTION_TYPE_GROUP FUNCTION_TYPE_GROUP} - The Transfer Group Job (TFRGRPJOB) command - suspended the job. -
      • {@link #FUNCTION_TYPE_INDEX FUNCTION_TYPE_INDEX} - The initial thread of the job is rebuilding - an index (access path). -
      • {@link #FUNCTION_TYPE_IO FUNCTION_TYPE_IO} - The job is a subsystem monitor that is performing - input/output (I/O) operations to a work station. -
      • {@link #FUNCTION_TYPE_LOG FUNCTION_TYPE_LOG} - The system logs history information in a database - file. -
      • {@link #FUNCTION_TYPE_MENU FUNCTION_TYPE_MENU} - The initial thread of the job is currently - at a system menu. -
      • {@link #FUNCTION_TYPE_MRT FUNCTION_TYPE_MRT} - The job is a multiple requester terminal (MRT) - job is the {@link #JOB_TYPE job type} is {@link #JOB_TYPE_BATCH JOB_TYPE_BATCH} - and the {@link #JOB_SUBTYPE job subtype} is {@link #JOB_SUBTYPE_MRT JOB_SUBTYPE_MRT}, - or it is an interactive job attached to an MRT job if the - {@link #JOB_TYPE job type} is {@link #JOB_TYPE_INTERACTIVE JOB_TYPE_INTERACTIVE}. -
      • {@link #FUNCTION_TYPE_PROCEDURE FUNCTION_TYPE_PROCEDURE} - The initial thread of the job is running - a procedure. -
      • {@link #FUNCTION_TYPE_PROGRAM FUNCTION_TYPE_PROGRAM} - The initial thread of the job is running - a program. -
      • {@link #FUNCTION_TYPE_SPECIAL FUNCTION_TYPE_SPECIAL} - The function type is special. -
      -**/ - public static final String FUNCTION_TYPE = "FUNCTION_TYPE"; - - /** - Attribute value indicating that the system is not performing a logged function. - - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_BLANK = ""; - - /** - Attribute value indicating that a command is running interactively, or it is - in a batch input stream, or it was requested from a system menu. - - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_COMMAND = "C"; - - /** - Attribute value indicating that the initial thread of the job is processing - a Delay Job (DLYJOB) command. - - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_DELAY = "D"; - - /** - Attribute value indicating that the Transfer Group Job (TFRGRPJOB) command - suspended the job. - - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_GROUP = "G"; - - /** - Attribute value indicating that the initial thread of the job is rebuilding an index - (access path). - - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_INDEX = "I"; - - /** - Attribute value indicating that the system logs history information in a database - file. - - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_LOG = "L"; - - /** - Attribute value indicating that the job is a multiple requester terminal (MRT) - job is the {@link #JOB_TYPE job type} is {@link #JOB_TYPE_BATCH JOB_TYPE_BATCH} - and the {@link #JOB_SUBTYPE job subtype} is {@link #JOB_SUBTYPE_MRT JOB_SUBTYPE_MRT}, - or it is an interactive job attached to an MRT job if the - {@link #JOB_TYPE job type} is {@link #JOB_TYPE_INTERACTIVE JOB_TYPE_INTERACTIVE}. - - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_MRT = "M"; - - /** - Attribute value indicating that the initial thread of the job is currently - at a system menu. - - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_MENU = "N"; - - /** - Attribute value indicating that the job is a subsystem monitor that is performing - input/output (I/O) operations to a work station. - - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_IO = "O"; - - /** - Attribute value indicating that the initial thread of the job is running - a program. - - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_PROGRAM = "P"; - - /** - Attribute value indicating that the initial thread of the job is running - a procedure. - - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_PROCEDURE = "R"; - - /** - Attribute value indicating that the function type is special. - - @see #FUNCTION_TYPE - **/ - public static final String FUNCTION_TYPE_SPECIAL = "*"; - - static { - attributes_.add(FUNCTION_TYPE, String.class, true, - new String[] { FUNCTION_TYPE_BLANK, - FUNCTION_TYPE_COMMAND, - FUNCTION_TYPE_DELAY, - FUNCTION_TYPE_GROUP, - FUNCTION_TYPE_INDEX, - FUNCTION_TYPE_IO, - FUNCTION_TYPE_LOG, - FUNCTION_TYPE_MENU, - FUNCTION_TYPE_MRT, - FUNCTION_TYPE_PROCEDURE, - FUNCTION_TYPE_PROGRAM, - FUNCTION_TYPE_SPECIAL }, null, true); - getterMap_.add(FUNCTION_TYPE, JOBI0200_, "receiverVariable.functionType"); - } - - -/** -Attribute ID for inquiry message reply. This identifies a String attribute, which -represents how the job answers inquiry messages. Possible values are: -
        -
      • {@link #INQUIRY_MESSAGE_REPLY_REQUIRED INQUIRY_MESSAGE_REPLY_REQUIRED} - - The job requires an answer for any inquiry - messages that occur while this job is running. -
      • {@link #INQUIRY_MESSAGE_REPLY_DEFAULT INQUIRY_MESSAGE_REPLY_DEFAULT} - - The system uses the default message reply to - answer any inquiry messages issued while this job is running. The default - reply is either defined in the message description or is the default system - reply. -
      • {@link #INQUIRY_MESSAGE_REPLY_SYSTEM_REPLY_LIST INQUIRY_MESSAGE_REPLY_SYSTEM_REPLY_LIST} - - The system reply list is - checked to see if there is an entry for an inquiry message issued while this - job is running. If a match occurs, the system uses the reply value for that - entry. If no entry exists for that message, the system uses an inquiry message. -
      -**/ - public static final String INQUIRY_MESSAGE_REPLY = "INQUIRY_MESSAGE_REPLY"; - - /** - Attribute value indicating that the job requires an answer for any inquiry - messages that occur while this job is running. - - @see #INQUIRY_MESSAGE_REPLY - **/ - public static final String INQUIRY_MESSAGE_REPLY_REQUIRED = "*RQD"; - - /** - Attribute value indicating that the system uses the default message reply to - answer any inquiry messages issued while this job is running. The default - reply is either defined in the message description or is the default system - reply. - - @see #INQUIRY_MESSAGE_REPLY - **/ - public static final String INQUIRY_MESSAGE_REPLY_DEFAULT = "*DFT"; - - /** - Attribute value indicating that the system reply list is - checked to see if there is an entry for an inquiry message issued while this - job is running. If a match occurs, the system uses the reply value for that - entry. If no entry exists for that message, the system uses an inquiry message. - - @see #INQUIRY_MESSAGE_REPLY - **/ - public static final String INQUIRY_MESSAGE_REPLY_SYSTEM_REPLY_LIST = "*SYSRPYL"; - - static { - attributes_.add(INQUIRY_MESSAGE_REPLY, String.class, false, - new String[] { INQUIRY_MESSAGE_REPLY_REQUIRED, - INQUIRY_MESSAGE_REPLY_DEFAULT, - INQUIRY_MESSAGE_REPLY_SYSTEM_REPLY_LIST }, null, true); - getterMap_.add(INQUIRY_MESSAGE_REPLY, JOBI0400_, "receiverVariable.inquiryMessageReply"); - setterKeys_.add(INQUIRY_MESSAGE_REPLY, 901, ProgramKeys.CHAR, 10); - } - - - -/** -Attribute ID for instance. This identifies a read-only byte[] attribute, which -further identifies the source that originated the APPC job. This attribute is -part of the unit of work ID, which is used to track jobs across multiple systems. -This is applicable only when the job is associated with a source or target system -using advanced program-to-program communications (APPC). -**/ - public static final String INSTANCE = "INSTANCE"; - - static { - attributes_.add(INSTANCE, byte[].class, true); - getterMap_.add(INSTANCE, JOBI0400_, "receiverVariable.unitOfWorkID.instance"); - } - - -/** -Attribute ID for interactive transactions. This identifies a read-only Integer attribute, -which represents the number of interactive transactions. -**/ - public static final String INTERACTIVE_TRANSACTIONS = "INTERACTIVE_TRANSACTIONS"; - - static { - attributes_.add(INTERACTIVE_TRANSACTIONS, Integer.class, true); - getterMap_.add(INTERACTIVE_TRANSACTIONS, JOBI0200_, "receiverVariable.numberOfInteractiveTransactions"); - } - - - -/** -Attribute ID for internal job identifier. This identifies a read-only byte array attribute, -which represents the internal job identifier of the job as identified to the system. -**/ - public static final String INTERNAL_JOB_ID = "INTERNAL_JOB_ID"; - - static { - attributes_.add(INTERNAL_JOB_ID, byte[].class, true); - getterMap_.add(INTERNAL_JOB_ID, JOBI0100_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(INTERNAL_JOB_ID, JOBI0150_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(INTERNAL_JOB_ID, JOBI0200_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(INTERNAL_JOB_ID, JOBI0300_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(INTERNAL_JOB_ID, JOBI0400_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(INTERNAL_JOB_ID, JOBI0500_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(INTERNAL_JOB_ID, JOBI0600_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(INTERNAL_JOB_ID, JOBI0700_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(INTERNAL_JOB_ID, JOBI0800_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(INTERNAL_JOB_ID, JOBI0900_, "receiverVariable.qualifiedJobName.jobName"); - } - - -/** -Attribute ID for job date. This identifies a Date attribute, which represents -the date to be used for the job. The value {@link #NO_DATE NO_DATE} -indicates that the job uses the system date. -The Date value is converted using the default Java locale. -**/ - public static final String JOB_DATE = "JOB_DATE"; - - static { - attributes_.add(JOB_DATE, Date.class, false); - DateValueMap valueMap = new DateValueMap(DateValueMap.FORMAT_7); - getterMap_.add(JOB_DATE, JOBI0300_, "receiverVariable.jobDate", valueMap); - setterKeys_.add(JOB_DATE, 1002, ProgramKeys.CHAR, 7, valueMap); - } - - - -/** -Attribute ID for job description. This identifies a read-only String attribute, -which represents the fully qualified integrated file system path name of the job -description. - -@see com.ibm.as400.access.QSYSObjectPathName -**/ - public static final String JOB_DESCRIPTION = "JOB_DESCRIPTION"; - - static { - attributes_.add(JOB_DESCRIPTION, String.class, true); - getterMap_.add(JOB_DESCRIPTION, JOBI0400_, "receiverVariable.jobDescription", - new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "JOBD")); - } - - - -/** -Attribute ID for job name. This identifies a read-only String attribute, -which represents the name of the job as identified to the system. -**/ - public static final String JOB_NAME = "JOB_NAME"; - - static { - attributes_.add(JOB_NAME, String.class, true); - getterMap_.add(JOB_NAME, JOBI0100_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(JOB_NAME, JOBI0150_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(JOB_NAME, JOBI0200_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(JOB_NAME, JOBI0300_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(JOB_NAME, JOBI0400_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(JOB_NAME, JOBI0500_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(JOB_NAME, JOBI0600_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(JOB_NAME, JOBI0700_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(JOB_NAME, JOBI0800_, "receiverVariable.qualifiedJobName.jobName"); - getterMap_.add(JOB_NAME, JOBI0900_, "receiverVariable.qualifiedJobName.jobName"); - } - - - -/** -Attribute ID for job number. This identifies a read-only String attribute, -which represents the system-generated job number. -**/ - public static final String JOB_NUMBER = "JOB_NUMBER"; - - static { - attributes_.add(JOB_NUMBER, String.class, true); - getterMap_.add(JOB_NUMBER, JOBI0100_, "receiverVariable.qualifiedJobName.jobNumber"); - getterMap_.add(JOB_NUMBER, JOBI0150_, "receiverVariable.qualifiedJobName.jobNumber"); - getterMap_.add(JOB_NUMBER, JOBI0200_, "receiverVariable.qualifiedJobName.jobNumber"); - getterMap_.add(JOB_NUMBER, JOBI0300_, "receiverVariable.qualifiedJobName.jobNumber"); - getterMap_.add(JOB_NUMBER, JOBI0400_, "receiverVariable.qualifiedJobName.jobNumber"); - getterMap_.add(JOB_NUMBER, JOBI0500_, "receiverVariable.qualifiedJobName.jobNumber"); - getterMap_.add(JOB_NUMBER, JOBI0600_, "receiverVariable.qualifiedJobName.jobNumber"); - getterMap_.add(JOB_NUMBER, JOBI0700_, "receiverVariable.qualifiedJobName.jobNumber"); - getterMap_.add(JOB_NUMBER, JOBI0800_, "receiverVariable.qualifiedJobName.jobNumber"); - getterMap_.add(JOB_NUMBER, JOBI0900_, "receiverVariable.qualifiedJobName.jobNumber"); - } - - - -/** -Attribute ID for job queue. This identifies a String attribute, -which represents the fully qualified integrated file system path name -of the job queue that the job is on, or that -the job was on if it is currently active. - -@see com.ibm.as400.access.QSYSObjectPathName -**/ - public static final String JOB_QUEUE = "JOB_QUEUE"; - - static { - attributes_.add(JOB_QUEUE, String.class, false); - ValueMap valueMap = new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "JOBQ"); - getterMap_.add(JOB_QUEUE, JOBI0300_, "receiverVariable.jobQueue", valueMap); - setterKeys_.add(JOB_QUEUE, 1004, ProgramKeys.CHAR, 20, valueMap); - } - - - -/** -Attribute ID for job queue date. This identifies a read-only -Date attribute, which represents the date and time when the job was -put on the job queue. The Date value is converted using the default Java locale. -**/ - public static final String JOB_QUEUE_DATE = "JOB_QUEUE_DATE"; - - static { - attributes_.add(JOB_QUEUE_DATE, Date.class, true); - getterMap_.add(JOB_QUEUE_DATE, JOBI0300_, "receiverVariable.dateAndTimeJobWasPutOnThisJobQueue", dateValueMapDts_); - } - - - -/** -Attribute ID for job queue priority. This identifies an Integer attribute, -which represents the scheduling priority of the job compared to other jobs -on the same job queue. The highest priority is 0 and the lowest is 9. -**/ - public static final String JOB_QUEUE_PRIORITY = "JOB_QUEUE_PRIORITY"; - - static { - attributes_.add(JOB_QUEUE_PRIORITY, Integer.class, false); - getterMap_.add(JOB_QUEUE_PRIORITY, JOBI0300_, "receiverVariable.jobQueuePriority", integerValueMap_); - setterKeys_.add(JOB_QUEUE_PRIORITY, 1005, ProgramKeys.CHAR, 2, integerValueMap_); - } - - - -/** -Attribute ID for job queue status. This identifies a read-only String attribute, -which represents the status of the job on the job queue. Possible values are: -
        -
      • {@link #JOB_QUEUE_STATUS_BLANK JOB_QUEUE_STATUS_BLANK} - The job is not on a job queue. -
      • {@link #JOB_QUEUE_STATUS_SCHEDULED JOB_QUEUE_STATUS_SCHEDULED} - The job will run as scheduled. -
      • {@link #JOB_QUEUE_STATUS_HELD JOB_QUEUE_STATUS_HELD} - The job is being held on the job queue. -
      • {@link #JOB_QUEUE_STATUS_RELEASED JOB_QUEUE_STATUS_RELEASED} - The job is ready to be selected. -
      -**/ - public static final String JOB_QUEUE_STATUS = "JOB_QUEUE_STATUS"; - - /** - Attribute value indicating that the job is not on a job queue. - - @see #JOB_QUEUE_STATUS - **/ - public static final String JOB_QUEUE_STATUS_BLANK = ""; - - /** - Attribute value indicating that the job will run as scheduled. - - @see #JOB_QUEUE_STATUS - **/ - public static final String JOB_QUEUE_STATUS_SCHEDULED = "SCD"; - - /** - Attribute value indicating that the job is being held on the job queue. - - @see #JOB_QUEUE_STATUS - **/ - public static final String JOB_QUEUE_STATUS_HELD = "HLD"; - - /** - Attribute value indicating that the job is ready to be selected. - - @see #JOB_QUEUE_STATUS - **/ - public static final String JOB_QUEUE_STATUS_RELEASED = "RLS"; - - static { - attributes_.add(JOB_QUEUE_STATUS, String.class, true, - new String[] { JOB_QUEUE_STATUS_BLANK, - JOB_QUEUE_STATUS_SCHEDULED, - JOB_QUEUE_STATUS_HELD, - JOB_QUEUE_STATUS_RELEASED }, null, true); - getterMap_.add(JOB_QUEUE_STATUS, JOBI0300_, "receiverVariable.statusOfJobOnThejobQueue"); - } - - - -/** -Attribute ID for job status. This identifies a read-only String attribute, -which represents the status of the job. Possible values are: -
        -
      • {@link #JOB_STATUS_ACTIVE JOB_STATUS_ACTIVE} - The job is active. -
      • {@link #JOB_STATUS_JOBQ JOB_STATUS_JOBQ} - The job is currently on a job queue. -
      • {@link #JOB_STATUS_OUTQ JOB_STATUS_OUTQ} - The job has completed running, but still has output - on an output queue. -
      -**/ - public static final String JOB_STATUS = "JOB_STATUS"; - - /** - Attribute value indicating that the job is active. - - @see #JOB_STATUS - **/ - public static final String JOB_STATUS_ACTIVE = "*ACTIVE"; - - /** - Attribute value indicating that the job is currently on a job queue. - - @see #JOB_STATUS - **/ - public static final String JOB_STATUS_JOBQ = "*JOBQ"; - - /** - Attribute value indicating that the job has completed running. - - @see #JOB_STATUS - **/ - public static final String JOB_STATUS_OUTQ = "*OUTQ"; - - static { - attributes_.add(JOB_STATUS, String.class, true, - new String[] { JOB_STATUS_ACTIVE, - JOB_STATUS_JOBQ, JOB_STATUS_OUTQ }, null, true); - getterMap_.add(JOB_STATUS, JOBI0400_, "receiverVariable.jobStatus"); - } - - - -/** -Attribute ID for job subtype. This identifies a read-only String attribute, -which represents additional information about the job type. Possible values are: -
        -
      • {@link #JOB_SUBTYPE_BLANK JOB_SUBTYPE_BLANK} - The job has no special subtype or is not a valid job. -
      • {@link #JOB_SUBTYPE_IMMEDIATE JOB_SUBTYPE_IMMEDIATE} - The job is an immediate job. -
      • {@link #JOB_SUBTYPE_PROCEDURE_START_REQUEST JOB_SUBTYPE_PROCEDURE_START_REQUEST} - The job started - with a procedure start request. -
      • {@link #JOB_SUBTYPE_MACHINE_SERVER_JOB JOB_SUBTYPE_MACHINE_SERVER_JOB} - The job is an - Advanced 36 machine server job. -
      • {@link #JOB_SUBTYPE_PRESTART JOB_SUBTYPE_PRESTART} - The job is a prestart job. -
      • {@link #JOB_SUBTYPE_PRINT_DRIVER JOB_SUBTYPE_PRINT_DRIVER} - The job is a print driver job. -
      • {@link #JOB_SUBTYPE_MRT JOB_SUBTYPE_MRT} - The job is a System/36 multiple requester terminal - (MRT) job. -
      • {@link #JOB_SUBTYPE_ALTERNATE_SPOOL_USER JOB_SUBTYPE_ALTERNATE_SPOOL_USER} - Alternate spool user. -
      -**/ - public static final String JOB_SUBTYPE = "JOB_SUBTYPE"; - - /** - Attribute value indicating that the job has no special subtype or is not a valid job. - - @see #JOB_SUBTYPE - **/ - public static final String JOB_SUBTYPE_BLANK = ""; - - /** - Attribute value indicating that the job is an immediate job. - - @see #JOB_SUBTYPE - **/ - public static final String JOB_SUBTYPE_IMMEDIATE = "D"; - - /** - Attribute value indicating that the job started - with a procedure start request. - - @see #JOB_SUBTYPE - **/ - public static final String JOB_SUBTYPE_PROCEDURE_START_REQUEST = "E"; - - /** - Attribute value indicating that the job is an - Advanced 36 machine server job. - - @see #JOB_SUBTYPE - **/ - public static final String JOB_SUBTYPE_MACHINE_SERVER_JOB = "F"; - - /** - Attribute value indicating that the job is a prestart job. - - @see #JOB_SUBTYPE - **/ - public static final String JOB_SUBTYPE_PRESTART = "J"; - - /** - Attribute value indicating that the job is a print driver job. - - @see #JOB_SUBTYPE - **/ - public static final String JOB_SUBTYPE_PRINT_DRIVER = "P"; - - /** - Attribute value indicating that the job is a System/36 multiple requester terminal - (MRT) job. - - @see #JOB_SUBTYPE - **/ - public static final String JOB_SUBTYPE_MRT = "T"; - - /** - Attribute value indicating alternate spool user. - - @see #JOB_SUBTYPE - **/ - public static final String JOB_SUBTYPE_ALTERNATE_SPOOL_USER = "U"; - - static { - attributes_.add(JOB_SUBTYPE, String.class, true, - new String[] { JOB_SUBTYPE_BLANK, - JOB_SUBTYPE_IMMEDIATE, - JOB_SUBTYPE_PROCEDURE_START_REQUEST, - JOB_SUBTYPE_MACHINE_SERVER_JOB, - JOB_SUBTYPE_PRESTART, - JOB_SUBTYPE_PRINT_DRIVER, - JOB_SUBTYPE_MRT, - JOB_SUBTYPE_ALTERNATE_SPOOL_USER }, null, true); - getterMap_.add(JOB_SUBTYPE, JOBI0100_, "receiverVariable.jobSubtype"); - getterMap_.add(JOB_SUBTYPE, JOBI0150_, "receiverVariable.jobSubtype"); - getterMap_.add(JOB_SUBTYPE, JOBI0200_, "receiverVariable.jobSubtype"); - getterMap_.add(JOB_SUBTYPE, JOBI0300_, "receiverVariable.jobSubtype"); - getterMap_.add(JOB_SUBTYPE, JOBI0400_, "receiverVariable.jobSubtype"); - getterMap_.add(JOB_SUBTYPE, JOBI0500_, "receiverVariable.jobSubtype"); - getterMap_.add(JOB_SUBTYPE, JOBI0600_, "receiverVariable.jobSubtype"); - getterMap_.add(JOB_SUBTYPE, JOBI0700_, "receiverVariable.jobSubtype"); - getterMap_.add(JOB_SUBTYPE, JOBI0800_, "receiverVariable.jobSubtype"); - getterMap_.add(JOB_SUBTYPE, JOBI0900_, "receiverVariable.jobSubtype"); - } - - - -/** -Attribute ID for switch settings. This identifies a String attribute, -which represents the current setting of the job switches used by this job. -**/ - public static final String JOB_SWITCHES = "JOB_SWITCHES"; - - static { - attributes_.add(JOB_SWITCHES, String.class, false); - getterMap_.add(JOB_SWITCHES, JOBI0400_, "receiverVariable.jobSwitches"); - setterKeys_.add(JOB_SWITCHES, 1006, ProgramKeys.CHAR, 8); - } - - - -/** -Attribute ID for job type. This identifies a read-only String attribute, -which represents the job type. Possible values are: -
        -
      • {@link #JOB_TYPE_NOT_VALID JOB_TYPE_NOT_VALID} - The job is not a valid job. -
      • {@link #JOB_TYPE_AUTOSTART JOB_TYPE_AUTOSTART} - The job is an autostart job. -
      • {@link #JOB_TYPE_BATCH JOB_TYPE_BATCH} - The job is a batch job. -
      • {@link #JOB_TYPE_INTERACTIVE JOB_TYPE_INTERACTIVE} - The job is an interactive job. -
      • {@link #JOB_TYPE_SUBSYSTEM_MONITOR JOB_TYPE_SUBSYSTEM_MONITOR} - The job is a subsystem monitor job. -
      • {@link #JOB_TYPE_SPOOLED_READER JOB_TYPE_SPOOLED_READER} - The job is a spooled reader job. -
      • {@link #JOB_TYPE_SYSTEM JOB_TYPE_SYSTEM} - The job is a system job. -
      • {@link #JOB_TYPE_SPOOLED_WRITER JOB_TYPE_SPOOLED_WRITER} - The job is a spooled writer job. -
      • {@link #JOB_TYPE_SCPF_SYSTEM JOB_TYPE_SCPF_SYSTEM} - The job is the SCPF system job. -
      -**/ - public static final String JOB_TYPE = "JOB_TYPE"; - - /** - Attribute value indicating that the job is not a valid job. - - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_NOT_VALID = ""; - - /** - Attribute value indicating that the job is an autostart job. - - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_AUTOSTART = "A"; - - /** - Attribute value indicating that the job is a batch job. - - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_BATCH = "B"; - - /** - Attribute value indicating that the job is an interactive job. - - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_INTERACTIVE = "I"; - - /** - Attribute value indicating that the job is a subsystem monitor job. - - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_SUBSYSTEM_MONITOR = "M"; - - /** - Attribute value indicating that the job is a spooled reader job. - - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_SPOOLED_READER = "R"; - - /** - Attribute value indicating that the job is a system job. - - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_SYSTEM = "S"; - - /** - Attribute value indicating that the job is a spooled writer job. - - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_SPOOLED_WRITER = "W"; - - /** - Attribute value indicating that the job is the SCPF system job. - - @see #JOB_TYPE - **/ - public static final String JOB_TYPE_SCPF_SYSTEM = "X"; - - static { - attributes_.add(JOB_TYPE, String.class, true, - new String[] { JOB_TYPE_NOT_VALID, - JOB_TYPE_AUTOSTART, - JOB_TYPE_BATCH, - JOB_TYPE_INTERACTIVE, - JOB_TYPE_SUBSYSTEM_MONITOR, - JOB_TYPE_SPOOLED_READER, - JOB_TYPE_SYSTEM, - JOB_TYPE_SPOOLED_WRITER, - JOB_TYPE_SCPF_SYSTEM }, null, true); - getterMap_.add(JOB_TYPE, JOBI0100_, "receiverVariable.jobType"); - getterMap_.add(JOB_TYPE, JOBI0150_, "receiverVariable.jobType"); - getterMap_.add(JOB_TYPE, JOBI0200_, "receiverVariable.jobType"); - getterMap_.add(JOB_TYPE, JOBI0300_, "receiverVariable.jobType"); - getterMap_.add(JOB_TYPE, JOBI0400_, "receiverVariable.jobType"); - getterMap_.add(JOB_TYPE, JOBI0500_, "receiverVariable.jobType"); - getterMap_.add(JOB_TYPE, JOBI0600_, "receiverVariable.jobType"); - getterMap_.add(JOB_TYPE, JOBI0700_, "receiverVariable.jobType"); - getterMap_.add(JOB_TYPE, JOBI0800_, "receiverVariable.jobType"); - getterMap_.add(JOB_TYPE, JOBI0900_, "receiverVariable.jobType"); - } - - - -/** -Attribute ID for keep DDM connections active. This identifies a String attribute, -which represents whether connections using distributed data management (DDM) -protocols remain active when they are not being used. Possible values are: -
        -
      • {@link #KEEP_DDM_CONNECTIONS_ACTIVE_KEEP KEEP_DDM_CONNECTIONS_ACTIVE_KEEP} - - The system keeps DDM connections active when there are no users. -
      • {@link #KEEP_DDM_CONNECTIONS_ACTIVE_DROP KEEP_DDM_CONNECTIONS_ACTIVE_DROP} - - The system ends a DDM connection when there are no users. -
      -**/ - public static final String KEEP_DDM_CONNECTIONS_ACTIVE = "KEEP_DDM_CONNECTIONS_ACTIVE"; - - /** - Attribute value indicating that the system keeps DDM connections active when there are no users. - - @see #KEEP_DDM_CONNECTIONS_ACTIVE - **/ - public static final String KEEP_DDM_CONNECTIONS_ACTIVE_KEEP = "*KEEP"; - - /** - Attribute value indicating that the system ends a DDM connection when there are no users. - - @see #KEEP_DDM_CONNECTIONS_ACTIVE - **/ - public static final String KEEP_DDM_CONNECTIONS_ACTIVE_DROP = "*DROP"; - - static { - attributes_.add(KEEP_DDM_CONNECTIONS_ACTIVE, String.class, false, - new String[] { KEEP_DDM_CONNECTIONS_ACTIVE_KEEP, - KEEP_DDM_CONNECTIONS_ACTIVE_DROP }, null, true); - getterMap_.add(KEEP_DDM_CONNECTIONS_ACTIVE, JOBI0400_, "receiverVariable.ddmConversationHandling"); - setterKeys_.add(KEEP_DDM_CONNECTIONS_ACTIVE, 408, ProgramKeys.CHAR, 5); - } - - - -/** -Attribute ID for language ID. This identifies a String attribute, -which represents the language identifier associated with this -job. - -

      The following special values can be used when setting the -language ID: -

        -
      • {@link #SYSTEM_VALUE SYSTEM_VALUE} - The - system value QLANGID is used. -
      • {@link #USER_PROFILE USER_PROFILE} - The - language identifier specified in the user profile in which this thread - was initially running is used. -
      -**/ - public static final String LANGUAGE_ID = "LANGUAGE_ID"; - - static { - attributes_.add(LANGUAGE_ID, String.class, false, - new String[] { SYSTEM_VALUE, USER_PROFILE }, null, false); - getterMap_.add(LANGUAGE_ID, JOBI0400_, "receiverVariable.languageID"); - setterKeys_.add(LANGUAGE_ID, 1201, ProgramKeys.CHAR, 8); - } - - - -/** -Attribute ID for location name. This identifies a read-only String attribute, -which represents the name of the source system that originated the -APPC job. This attribute is part of the unit of work ID, which is used to track -jobs across multiple systems. This is applicable only when the job is associated -with a source or target system using advanced program-to-program communications -(APPC). -**/ - public static final String LOCATION_NAME = "LOCATION_NAME"; - - static { - attributes_.add(LOCATION_NAME, String.class, true); - getterMap_.add(LOCATION_NAME, JOBI0400_, "receiverVariable.unitOfWorkID.locationName"); - } - - - -/** -Attribute ID for logging CL programs. This identifies a Boolean attribute, -which indicates whether messages are logged for CL programs. -**/ - public static final String LOG_CL_PROGRAMS = "LOG_CL_PROGRAMS"; - - static { - attributes_.add(LOG_CL_PROGRAMS, Boolean.class, false); - ValueMap valueMap = new BooleanValueMap(NO, YES); - getterMap_.add(LOG_CL_PROGRAMS, JOBI0400_, "receiverVariable.loggingOfCLPrograms", valueMap); - setterKeys_.add(LOG_CL_PROGRAMS, 1203, ProgramKeys.CHAR, 10, valueMap); - } - - - -/** -Attribute ID for logging level. This identifies a String attribute, -which represents the type of information that is logged. Possible values are: -
        -
      • {@link #LOGGING_LEVEL_NONE LOGGING_LEVEL_NONE} - No messages are logged. -
      • {@link #LOGGING_LEVEL_MESSAGES_BY_SEVERITY LOGGING_LEVEL_MESSAGES_BY_SEVERITY} - All messages sent - to the job's external message queue with a severity greater than or equal to - the {@link #LOGGING_SEVERITY message logging severity} are logged. -
      • {@link #LOGGING_LEVEL_REQUESTS_BY_SEVERITY_AND_ASSOCIATED_MESSAGES LOGGING_LEVEL_REQUESTS_BY_SEVERITY_AND_ASSOCIATED_MESSAGES} - - Requests or commands from CL programs for which the system issues messages with - a severity code greater than or equal to the {@link #LOGGING_SEVERITY - logging severity} and all messages - associated with those requests or commands that have a severity code greater - than or equal to the {@link #LOGGING_SEVERITY logging severity} - are logged. -
      • {@link #LOGGING_LEVEL_ALL_REQUESTS_AND_ASSOCIATED_MESSAGES LOGGING_LEVEL_ALL_REQUESTS_AND_ASSOCIATED_MESSAGES} - - All requests or commands from CL programs and all messages - associated with those requests or commands that have a severity code greater - than or equal to the {@link #LOGGING_SEVERITY logging severity} - are logged. -
      • {@link #LOGGING_LEVEL_ALL_REQUESTS_AND_MESSAGES LOGGING_LEVEL_ALL_REQUESTS_AND_MESSAGES} - - All requests or commands from CL programs and all messages - with a severity code greater than or equal to the {@link #LOGGING_SEVERITY - logging severity} are logged. -
      -**/ - public static final String LOGGING_LEVEL = "LOGGING_LEVEL"; - - /** - Attribute value indicating that no messages are logged. - - @see #LOGGING_LEVEL - **/ - public static final String LOGGING_LEVEL_NONE = "0"; - - /** - Attribute value indicating that all messages sent - to the job's external message queue with a severity greater than or equal to - the {@link #LOGGING_SEVERITY message logging severity} are logged. - - @see #LOGGING_LEVEL - **/ - public static final String LOGGING_LEVEL_MESSAGES_BY_SEVERITY = "1"; - - /** - Attribute value indicating that requests or commands from CL programs for which - the system issues messages with a severity code greater than or equal to the - {@link #LOGGING_SEVERITY logging severity} and all messages associated with - those requests or commands that have a severity code greater than or equal to the - {@link #LOGGING_SEVERITY logging severity} are logged. - - @see #LOGGING_LEVEL - **/ - public static final String LOGGING_LEVEL_REQUESTS_BY_SEVERITY_AND_ASSOCIATED_MESSAGES = "2"; - - /** - Attribute value indicating that all requests or commands from CL programs and all messages - associated with those requests or commands that have a severity code greater - than or equal to the {@link #LOGGING_SEVERITY logging severity} - are logged. - - @see #LOGGING_LEVEL - **/ - public static final String LOGGING_LEVEL_ALL_REQUESTS_AND_ASSOCIATED_MESSAGES = "3"; - - /** - Attribute value indicating that all requests or commands from CL programs and all messages - with a severity code greater than or equal to the {@link #LOGGING_SEVERITY - logging severity} are logged. - - @see #LOGGING_LEVEL - **/ - public static final String LOGGING_LEVEL_ALL_REQUESTS_AND_MESSAGES = "4"; - - static { - attributes_.add(LOGGING_LEVEL, String.class, false, - new String[] { LOGGING_LEVEL_NONE, - LOGGING_LEVEL_MESSAGES_BY_SEVERITY, - LOGGING_LEVEL_REQUESTS_BY_SEVERITY_AND_ASSOCIATED_MESSAGES, - LOGGING_LEVEL_ALL_REQUESTS_AND_ASSOCIATED_MESSAGES, - LOGGING_LEVEL_ALL_REQUESTS_AND_MESSAGES }, null, true); - getterMap_.add(LOGGING_LEVEL, JOBI0500_, "receiverVariable.loggingLevel"); - setterKeys_.add(LOGGING_LEVEL, 1202, ProgramKeys.CHAR, 1); - } - - - -/** -Attribute ID for logging severity. This identifies an Integer attribute, -which represents the minimum severity level that causes error messages to be logged -in the job log. -**/ - public static final String LOGGING_SEVERITY = "LOGGING_SEVERITY"; - - static { - attributes_.add(LOGGING_SEVERITY, Integer.class, false); - getterMap_.add(LOGGING_SEVERITY, JOBI0500_, "receiverVariable.loggingSeverity"); - setterKeys_.add(LOGGING_SEVERITY, 1204, ProgramKeys.BINARY); - } - - - -/** -Attribute ID for logging text. This identifies a String attribute, -which represents the level of message text that is written in the job log -or displayed to the user. Possible values are: -
        -
      • {@link #LOGGING_TEXT_MESSAGE LOGGING_TEXT_MESSAGE} - Only the message is written to the job log. -
      • {@link #LOGGING_TEXT_SECLVL LOGGING_TEXT_SECLVL} - Both the message and the message help for the - error message are written to the job log. -
      • {@link #LOGGING_TEXT_NO_LIST LOGGING_TEXT_NO_LIST} - If the job ends normally, there is no job log. - If the job ends abnormally, there is a job log. The messages appearing in the - job log contain both the message and the message help. -
      -**/ - public static final String LOGGING_TEXT = "LOGGING_TEXT"; - - /** - Attribute value indicating that only the message is written to the job log. - - @see #LOGGING_TEXT - **/ - public static final String LOGGING_TEXT_MESSAGE = "*MSG"; - - /** - Attribute value indicating that both the message and the message help for the - error message are written to the job log. - - @see #LOGGING_TEXT - **/ - public static final String LOGGING_TEXT_SECLVL = "*SECLVL"; - - /** - Attribute value indicating that if the job ends normally, there is no job log. - If the job ends abnormally, there is a job log. The messages appearing in the - job log contain both the message and the message help. - - @see #LOGGING_TEXT - **/ - public static final String LOGGING_TEXT_NO_LIST = "*NOLIST"; - - static { - attributes_.add(LOGGING_TEXT, String.class, false, - new String[] { LOGGING_TEXT_MESSAGE, - LOGGING_TEXT_SECLVL, - LOGGING_TEXT_NO_LIST }, null, true); - getterMap_.add(LOGGING_TEXT, JOBI0500_, "receiverVariable.loggingText"); - setterKeys_.add(LOGGING_TEXT, 1205, ProgramKeys.CHAR, 7); - } - - - -/** -Attribute ID for maximum CPU time. This identifies a read-only Integer attribute, -which represents the maximum processing unit time (in milliseconds) that the job -can use. If the job consists of multiple routing steps, this is the maximum -processing unit time that the current routing step can use. If the maximum time -is exceeded, the job is ended. A value of -1 indicates that there is no maximum. -A value of 0 indicates that the job is not active. -**/ - public static final String MAX_CPU_TIME = "MAX_CPU_TIME"; - - static { - attributes_.add(MAX_CPU_TIME, Integer.class, true); - getterMap_.add(MAX_CPU_TIME, JOBI0150_, "receiverVariable.maximumProcessingUnitTime"); - } - - - -/** -Attribute ID for maximum temporary storage. This identifies a read-only Integer attribute, -which represents the maximum amount of auxiliary storage (in megabytes) that the job can -use. If the job consists of multiple routing steps, this is the maximum temporary -storage that the current routing step can use. If the maximum temporary storage is -exceeded, the job is ended. This does not apply to the use of permanent storage, which -is controlled through the user profile. A value of -1 indicates that there is no maximum. -**/ - public static final String MAX_TEMP_STORAGE = "MAX_TEMP_STORAGE"; - - static { - attributes_.add(MAX_TEMP_STORAGE, Integer.class, true); - getterMap_.add(MAX_TEMP_STORAGE, JOBI0150_, "receiverVariable.maximumTemporaryStorageInMegabytes"); - } - - - -/** -Attribute ID for message queue action. This identifies a String attribute, -which represents the action to take when the message queue is full. Possible values are: -
        -
      • {@link #MESSAGE_QUEUE_ACTION_NO_WRAP MESSAGE_QUEUE_ACTION_NO_WRAP} - - Do not wrap. This action causes the job to end. -
      • {@link #MESSAGE_QUEUE_ACTION_WRAP MESSAGE_QUEUE_ACTION_WRAP} - - Wrap to the beginning and start filling again. -
      • {@link #MESSAGE_QUEUE_ACTION_PRINT_WRAP MESSAGE_QUEUE_ACTION_PRINT_WRAP} - - Wrap the message queue and print the - messages that are being overlaid because of the wrapping. -
      -**/ - public static final String MESSAGE_QUEUE_ACTION = "MESSAGE_QUEUE_ACTION"; - - /** - Attribute value indicating that the message queue does not wrap. - This action causes the job to end when the message queue is full. - - @see #MESSAGE_QUEUE_ACTION - **/ - public static final String MESSAGE_QUEUE_ACTION_NO_WRAP = "*NOWRAP"; - - /** - Attribute value indicating that the message queue wraps to the beginning - and starts filling again when the message queue is full. - - @see #MESSAGE_QUEUE_ACTION - **/ - public static final String MESSAGE_QUEUE_ACTION_WRAP = "*WRAP"; - - /** - Attribute value indicating that the message queue wraps and prints the - messages that are being overlaid because of the wrapping. - - @see #MESSAGE_QUEUE_ACTION - **/ - public static final String MESSAGE_QUEUE_ACTION_PRINT_WRAP = "*PRTWRAP"; - - static { - attributes_.add(MESSAGE_QUEUE_ACTION, String.class, false, - new String[] { MESSAGE_QUEUE_ACTION_NO_WRAP, - MESSAGE_QUEUE_ACTION_WRAP, - MESSAGE_QUEUE_ACTION_PRINT_WRAP }, null, true); - getterMap_.add(MESSAGE_QUEUE_ACTION, JOBI0400_, "receiverVariable.jobMessageQueueFullAction"); - setterKeys_.add(MESSAGE_QUEUE_ACTION, 1007, ProgramKeys.CHAR, 10); - } - - - -/** -Attribute ID for message queue maximum size. This identifies a read-only Integer attribute, -which represents the maximum size (in megabytes) of the job's message queue. -The range is 2 to 64. -**/ - public static final String MESSAGE_QUEUE_MAX_SIZE = "MESSAGE_QUEUE_MAX_SIZE"; - - static { - attributes_.add(MESSAGE_QUEUE_MAX_SIZE, Integer.class, true); - getterMap_.add(MESSAGE_QUEUE_MAX_SIZE, JOBI0400_, "receiverVariable.jobMessageQueueMaximumSize"); - } - - - -/** -Attribute ID for mode. This identifies a read-only String attribute, -which represents the mode name of the advanced program-to-program -communications (APPC) device that started the job. -**/ - public static final String MODE = "MODE"; - - static { - attributes_.add(MODE, String.class, true); - getterMap_.add(MODE, JOBI0400_, "receiverVariable.modeName"); - } - - - -/** -Attribute ID for network ID. This identifies a read-only String attribute, -which represents the network name. This attribute is part of the unit of work ID, -which is used to track jobs across multiple systems. This is applicable only when -the job is associated with a source or target system using advanced program-to-program -communications (APPC). -**/ - public static final String NETWORK_ID = "NETWORK_ID"; - - static { - attributes_.add(NETWORK_ID, String.class, true); - getterMap_.add(NETWORK_ID, JOBI0400_, "receiverVariable.unitOfWorkID.networkID"); - } - - - -/** -Attribute ID for output queue. This identifies a String attribute, -which represents the fully qualified integrated file system path name -of the default output queue that is used for -spooled output produced by this job. - -@see com.ibm.as400.access.QSYSObjectPathName -**/ - public static final String OUTPUT_QUEUE = "OUTPUT_QUEUE"; - - static { - attributes_.add(OUTPUT_QUEUE, String.class, false); - ValueMap valueMap = new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "OUTQ"); - getterMap_.add(OUTPUT_QUEUE, JOBI0300_, "receiverVariable.outputQueue", valueMap); - setterKeys_.add(OUTPUT_QUEUE, 1501, ProgramKeys.CHAR, 20, valueMap); - } - - - -/** -Attribute ID for output queue priority. This identifies an Integer attribute, -which represents the output priority for spooled output files that this job -produces. The highest priority is 0 and the lowest is 9. -**/ - public static final String OUTPUT_QUEUE_PRIORITY = "OUTPUT_QUEUE_PRIORITY"; - - static { - attributes_.add(OUTPUT_QUEUE_PRIORITY, Integer.class, false); - getterMap_.add(OUTPUT_QUEUE_PRIORITY, JOBI0300_, "receiverVariable.outputQueuePriority", integerValueMap_); - setterKeys_.add(OUTPUT_QUEUE_PRIORITY, 1502, ProgramKeys.CHAR, 2, integerValueMap_); - } - - - -/** -Attribute ID for print key format. This identifies a String attribute, -which represents whether border and header information is provided when -the Print key is pressed. Possible values are: -
        -
      • {@link #NONE NONE} - The border and header information is not - included with output from the Print key. -
      • {@link #PRINT_KEY_FORMAT_BORDER PRINT_KEY_FORMAT_BORDER} - The border information - is included with output from the Print key. -
      • {@link #PRINT_KEY_FORMAT_HEADER PRINT_KEY_FORMAT_HEADER} - The header information - is included with output from the Print key. -
      • {@link #PRINT_KEY_FORMAT_ALL PRINT_KEY_FORMAT_ALL} - The border and header information - is included with output from the Print key. -
      - -

      The following special value can be used when setting the -print key format: -

        -
      • {@link #SYSTEM_VALUE SYSTEM_VALUE} - The - system value QPRTKEYFMT is used. -
      -**/ - public static final String PRINT_KEY_FORMAT = "PRINT_KEY_FORMAT"; - - /** - Attribute value indicating that the border information - is included with output from the Print key. - - @see #PRINT_KEY_FORMAT - **/ - public static final String PRINT_KEY_FORMAT_BORDER = "*PRTBDR"; - - /** - Attribute value indicating that the header information - is included with output from the Print key. - - @see #PRINT_KEY_FORMAT - **/ - public static final String PRINT_KEY_FORMAT_HEADER = "*PRTHDR"; - - /** - Attribute value indicating that the border and header information - is included with output from the Print key. - - @see #PRINT_KEY_FORMAT - **/ - public static final String PRINT_KEY_FORMAT_ALL = "*PRTALL"; - - static { - attributes_.add(PRINT_KEY_FORMAT, String.class, false, - new String[] { NONE, - PRINT_KEY_FORMAT_BORDER, - PRINT_KEY_FORMAT_HEADER, - PRINT_KEY_FORMAT_ALL, - SYSTEM_VALUE }, null, true); - getterMap_.add(PRINT_KEY_FORMAT, JOBI0400_, "receiverVariable.printKeyFormat"); - setterKeys_.add(PRINT_KEY_FORMAT, 1601, ProgramKeys.CHAR, 10); - } - - - - -/** -Attribute ID for print text. This identifies a String attribute, -which represents the line of text, if any, that is printed at the -bottom of each page of printed output for the job. - -

      The following special value can be used when setting the -print key format: -

        -
      • {@link #SYSTEM_VALUE SYSTEM_VALUE} - The - system value QPRTTXT is used. -
      -**/ - public static final String PRINT_TEXT = "PRINT_TEXT"; - - static { - attributes_.add(PRINT_TEXT, String.class, false, - new String[] { SYSTEM_VALUE }, null, false); - getterMap_.add(PRINT_TEXT, JOBI0400_, "receiverVariable.printText"); - setterKeys_.add(PRINT_TEXT, 1602, ProgramKeys.CHAR, 30); - } - - - -/** -Attribute ID for printer device name. This identifies a String attribute, -which represents the printer device used for printing output -from this job. - -

      The following special values can be used when setting the -printer: -

        -
      • {@link #SYSTEM_VALUE SYSTEM_VALUE} - The - system value QPRTDEV is used. -
      • {@link #PRINTER_DEVICE_NAME_WORK_STATION PRINTER_DEVICE_NAME_WORK_STATION} - The - default printer device used with this job is the printer device - assigned to the work station that is associated with the job. -
      • {@link #USER_PROFILE USER_PROFILE} - The - printer device name specified in the user profile in which this thread - was initially running is used. -
      -**/ - public static final String PRINTER_DEVICE_NAME = "PRINTER_DEVICE_NAME"; - - /** - Attribute value indicating that the default printer device used with this - job is the printer device assigned to the work station that is associated with the job. - - @see #PRINTER_DEVICE_NAME - **/ - public static final String PRINTER_DEVICE_NAME_WORK_STATION = "*WRKSTN"; - - static { - attributes_.add(PRINTER_DEVICE_NAME, String.class, false, - new String[] { SYSTEM_VALUE, - PRINTER_DEVICE_NAME_WORK_STATION, - USER_PROFILE }, null, false); - getterMap_.add(PRINTER_DEVICE_NAME, JOBI0300_, "receiverVariable.printerDeviceName"); - setterKeys_.add(PRINTER_DEVICE_NAME, 1603, ProgramKeys.CHAR, 10); - } - - - -/** -Attribute ID for product libraries. This identifies a read-only String[] -attribute, which represents the libraries that contain product information -for the initial thread of this job. -**/ - public static final String PRODUCT_LIBRARIES = "PRODUCT_LIBRARIES"; - - static { - attributes_.add(PRODUCT_LIBRARIES, String[].class, true); - getterMap_.add(PRODUCT_LIBRARIES, JOBI0700_, "receiverVariable.productLibraries", "receiverVariable.numberOfProductLibraries", arrayTypeValueMapString_); - } - - - -/** -Attribute ID for product return code. This identifies a read-only Integer attribute, -which represents the return code set by the compiler for Integrated Language Environment -(ILE) languages. -**/ - public static final String PRODUCT_RETURN_CODE = "PRODUCT_RETURN_CODE"; - - static { - attributes_.add(PRODUCT_RETURN_CODE, Integer.class, true); - getterMap_.add(PRODUCT_RETURN_CODE, JOBI0600_, "receiverVariable.productReturnCode"); - } - - - -/** -Attribute ID for program return code. This identifies a read-only Integer attribute, -which represents the completion status of the last RPG, COBOL, data file utility (DFU), -or sort utility program that has finished running. -**/ - public static final String PROGRAM_RETURN_CODE = "PROGRAM_RETURN_CODE"; - - static { - attributes_.add(PROGRAM_RETURN_CODE, Integer.class, true); - getterMap_.add(PROGRAM_RETURN_CODE, JOBI0600_, "receiverVariable.programReturnCode"); - } - - - -/** -Attribute ID for routing data. This identifies a read-only String attribute, -which represents the routing data that is used to determine the routing entry -that identifies the program to start for the routing step. -**/ - public static final String ROUTING_DATA = "ROUTING_DATA"; - - static { - attributes_.add(ROUTING_DATA, String.class, true); - getterMap_.add(ROUTING_DATA, JOBI0400_, "receiverVariable.routingData"); - } - - - -/** -Attribute ID for run priority. This identifies an Integer attribute, -which represents the priority at which the job is currently running, -relative to other jobs on the system. The run priority ranges from -1 (highest priority) to 99 (lowest priority). -**/ - public static final String RUN_PRIORITY = "RUN_PRIORITY"; - - static { - attributes_.add(RUN_PRIORITY, Integer.class, false); - getterMap_.add(RUN_PRIORITY, JOBI0200_, "receiverVariable.runPriority"); - setterKeys_.add(RUN_PRIORITY, 1802, ProgramKeys.BINARY); - } - - - -/** -Attribute ID for schedule date. This identifies a Date attribute, -which represents the date and time the job is scheduled to become active. -The Date value is converted using the default Java locale. - -

      The following special values can be used when setting the schedule date: -

        -
      • {@link #SCHEDULE_DATE_CURRENT SCHEDULE_DATE_CURRENT} - The - submitted job becomes eligible to run at the current date. -
      • {@link #SCHEDULE_DATE_MONTH_START SCHEDULE_DATE_MONTH_START} - The - submitted job becomes eligible to run on the first day of - the month. -
      • {@link #SCHEDULE_DATE_MONTH_END SCHEDULE_DATE_MONTH_END} - The - submitted job becomes eligible to run on the last day of - the month. -
      • {@link #SCHEDULE_DATE_MONDAY SCHEDULE_DATE_MONDAY} - The - submitted job becomes eligible to run on Monday. -
      • {@link #SCHEDULE_DATE_TUESDAY SCHEDULE_DATE_TUESDAY} - The - submitted job becomes eligible to run on Tuesday. -
      • {@link #SCHEDULE_DATE_WEDNESDAY SCHEDULE_DATE_WEDNESDAY} - The - submitted job becomes eligible to run on Wednesday. -
      • {@link #SCHEDULE_DATE_THURSDAY SCHEDULE_DATE_THURSDAY} - The - submitted job becomes eligible to run on Thursday. -
      • {@link #SCHEDULE_DATE_FRIDAY SCHEDULE_DATE_FRIDAY} - The - submitted job becomes eligible to run on Friday. -
      • {@link #SCHEDULE_DATE_SATURDAY SCHEDULE_DATE_SATURDAY} - The - submitted job becomes eligible to run on Saturday. -
      • {@link #SCHEDULE_DATE_SUNDAY SCHEDULE_DATE_SUNDAY} - The - submitted job becomes eligible to run on Sunday. -
      -**/ - public static final String SCHEDULE_DATE = "SCHEDULE_DATE"; - - /** - Attribute value indicating that the submitted job becomes eligible to run at the current date. - - @see #SCHEDULE_DATE - **/ - public static final Date SCHEDULE_DATE_CURRENT = computeSpecialDate(0); - - /** - Attribute value indicating that the submitted job becomes eligible to run on the first day of - the month. - - @see #SCHEDULE_DATE - **/ - public static final Date SCHEDULE_DATE_MONTH_START = computeSpecialDate(10); - - /** - Attribute value indicating that the submitted job becomes eligible to run on the last day of - the month. - - @see #SCHEDULE_DATE - **/ - public static final Date SCHEDULE_DATE_MONTH_END = computeSpecialDate(20); - - /** - Attribute value indicating that the submitted job becomes eligible to run on Monday. - - @see #SCHEDULE_DATE - **/ - public static final Date SCHEDULE_DATE_MONDAY = computeSpecialDate(1); - - /** - Attribute value indicating that the submitted job becomes eligible to run on Tuesday. - - @see #SCHEDULE_DATE - **/ - public static final Date SCHEDULE_DATE_TUESDAY = computeSpecialDate(2); - - /** - Attribute value indicating that the submitted job becomes eligible to run on Wednesday. - - @see #SCHEDULE_DATE - **/ - public static final Date SCHEDULE_DATE_WEDNESDAY = computeSpecialDate(3); - - /** - Attribute value indicating that the submitted job becomes eligible to run on Thursday. - - @see #SCHEDULE_DATE - **/ - public static final Date SCHEDULE_DATE_THURSDAY = computeSpecialDate(4); - - /** - Attribute value indicating that the submitted job becomes eligible to run on Friday. - - @see #SCHEDULE_DATE - **/ - public static final Date SCHEDULE_DATE_FRIDAY = computeSpecialDate(5); - - /** - Attribute value indicating that the submitted job becomes eligible to run on Saturday. - - @see #SCHEDULE_DATE - **/ - public static final Date SCHEDULE_DATE_SATURDAY = computeSpecialDate(6); - - /** - Attribute value indicating that the submitted job becomes eligible to run on Sunday. - - @see #SCHEDULE_DATE - **/ - public static final Date SCHEDULE_DATE_SUNDAY = computeSpecialDate(7); - - static { - attributes_.add(SCHEDULE_DATE, Date.class, false, - new Date[] { SCHEDULE_DATE_CURRENT, - SCHEDULE_DATE_MONTH_START, SCHEDULE_DATE_MONTH_END, - SCHEDULE_DATE_MONDAY, SCHEDULE_DATE_TUESDAY, - SCHEDULE_DATE_WEDNESDAY, SCHEDULE_DATE_THURSDAY, - SCHEDULE_DATE_FRIDAY, SCHEDULE_DATE_SATURDAY, - SCHEDULE_DATE_SUNDAY }, null, false, false, - // Hardcode the presentation keys, otherwise the literal - // values (which are strange dates) will be used. - new String[] { "CURRENT", "MONTHSTR", "MONTHEND", - "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN" }); - getterMap_.add(SCHEDULE_DATE, JOBI0400_, "receiverVariable.dateAndTimeJobIsScheduledToRun", dateValueMapDts_); - setterKeys_.add(SCHEDULE_DATE, 1920, ProgramKeys.CHAR, 10, new ScheduleDateValueMap_(DateValueMap.FORMAT_13)); - setterKeys_.add(SCHEDULE_DATE, 1921, ProgramKeys.CHAR, 8, new ScheduleDateValueMap_(DateValueMap.FORMAT_6)); - } - - private static Date computeSpecialDate(int second) - { - Calendar calendar = Calendar.getInstance(); - calendar.set(Calendar.YEAR, 1970); - calendar.set(Calendar.MONTH, 0); - calendar.set(Calendar.DAY_OF_MONTH, 0); - calendar.set(Calendar.HOUR_OF_DAY, 0); - calendar.set(Calendar.MINUTE, 0); - calendar.set(Calendar.SECOND, second); - return calendar.getTime(); - } - - private static class ScheduleDateValueMap_ extends DateValueMap - { - private static Hashtable constantMap_ = new Hashtable(); - - static { - constantMap_.put(SCHEDULE_DATE_CURRENT, "*CURRENT"); - constantMap_.put(SCHEDULE_DATE_MONTH_START, "*MONTHSTR"); - constantMap_.put(SCHEDULE_DATE_MONTH_END, "*MONTHEND"); - constantMap_.put(SCHEDULE_DATE_MONDAY, "*MON"); - constantMap_.put(SCHEDULE_DATE_TUESDAY, "*TUE"); - constantMap_.put(SCHEDULE_DATE_WEDNESDAY, "*WED"); - constantMap_.put(SCHEDULE_DATE_THURSDAY, "*THU"); - constantMap_.put(SCHEDULE_DATE_FRIDAY, "*FRI"); - constantMap_.put(SCHEDULE_DATE_SATURDAY, "*SAT"); - constantMap_.put(SCHEDULE_DATE_SUNDAY, "*SUN"); - } - - private boolean time_; - - public ScheduleDateValueMap_(int type) - { - super(type); - time_ = (type == FORMAT_6); - } - - public Object ltop(Object logicalValue, AS400 system) - { - if (constantMap_.containsKey(logicalValue)) { - if ((time_) && (logicalValue.equals(SCHEDULE_DATE_CURRENT))) - return "*CURRENT"; - else if (!time_) - return constantMap_.get(logicalValue); - } - return super.ltop(logicalValue, system); - } - } - - - - -/** -Attribute ID for sequence number. This identifies a read-only String attribute, -which represents the sequence number. This attribute is part of the unit of work ID, -which is used to track jobs across multiple systems. This is applicable only when -the job is associated with a source or target system using advanced program-to-program -communications (APPC). -**/ - public static final String SEQUENCE_NUMBER = "SEQUENCE_NUMBER"; - - static { - attributes_.add(SEQUENCE_NUMBER, String.class, true); - getterMap_.add(SEQUENCE_NUMBER, JOBI0400_, "receiverVariable.unitOfWorkID.sequenceNumber"); - } - - - -/** -Attribute ID for server type. This identifies a read-only String attribute, -which represents the type of server represented by the job, if the job -is part of a server. -**/ - public static final String SERVER_TYPE = "SERVER_TYPE"; - - static { - attributes_.add(SERVER_TYPE, String.class, true); - getterMap_.add(SERVER_TYPE, JOBI0400_, "receiverVariable.serverType"); - } - - - -/** -Attribute ID for signed on job. This identifies a read-only Boolean attribute, -which indicates whether the job is to be treated like a signed-on user on -the system. -**/ - public static final String SIGNED_ON_JOB = "SIGNED_ON_JOB"; - - static { - attributes_.add(SIGNED_ON_JOB, Boolean.class, true); - getterMap_.add(SIGNED_ON_JOB, JOBI0400_, "receiverVariable.signedOnJob", new BooleanValueMap(new Object[] { "1" }, new Object[] { "0", "" })); - } - - - -/** -Attribute ID for sort sequence table. This identifies a String attribute, -which represents the fully qualified integrated file system path name of the -sort sequence table. - -@see com.ibm.as400.access.QSYSObjectPathName -**/ - public static final String SORT_SEQUENCE_TABLE = "SORT_SEQUENCE_TABLE"; - - static { - attributes_.add(SORT_SEQUENCE_TABLE, String.class, false); - ValueMap valueMap = new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "FILE"); - getterMap_.add(SORT_SEQUENCE_TABLE, JOBI0400_, "receiverVariable.sortSequence", valueMap); - setterKeys_.add(SORT_SEQUENCE_TABLE, 1901, ProgramKeys.CHAR, 20, valueMap); - } - - - -/** -Attribute ID for special environment. This identifies a read-only String attribute, -which indicates whether the job is running in a particular environment. -Possible values are: -
        -
      • {@link #NONE NONE} - The job is not running in any special environment. -
      • {@link #SPECIAL_ENVIRONMENT_SYSTEM_36 SPECIAL_ENVIRONMENT_SYSTEM_36} - - The job is running in the System/36 environment. -
      • {@link #SPECIAL_ENVIRONMENT_NOT_ACTIVE SPECIAL_ENVIRONMENT_NOT_ACTIVE} - - The job is not currently active. -
      -**/ - public static final String SPECIAL_ENVIRONMENT = "SPECIAL_ENVIRONMENT"; - - /** - Attribute value indicating that the job is running in the System/36 environment. - - @see #SPECIAL_ENVIRONMENT - **/ - public static final String SPECIAL_ENVIRONMENT_SYSTEM_36 = "*S36"; - - /** - Attribute value indicating that the job is not currently active. - - @see #SPECIAL_ENVIRONMENT - **/ - public static final String SPECIAL_ENVIRONMENT_NOT_ACTIVE = ""; - - static { - attributes_.add(SPECIAL_ENVIRONMENT, String.class, true, - new String[] { NONE, - SPECIAL_ENVIRONMENT_SYSTEM_36, - SPECIAL_ENVIRONMENT_NOT_ACTIVE }, null, true); - getterMap_.add(SPECIAL_ENVIRONMENT, JOBI0600_, "receiverVariable.specialEnvironment"); - } - - - -/** -Attribute ID for status message handling. This identifies a String attribute, -which indicates whether status messages are displayed for this job. Possible -values are: -
        -
      • {@link #NONE NONE} - - This job does not display status messages. -
      • {@link #STATUS_MESSAGE_HANDLING_NORMAL STATUS_MESSAGE_HANDLING_NORMAL} - - This job displays status messages. -
      - -

      The following special values can be used when setting the status message -handling: -

        -
      • {@link #SYSTEM_VALUE SYSTEM_VALUE} - The - system value QSTSMSG is used. -
      • {@link #USER_PROFILE USER_PROFILE} - The - status message handling that is specified in the user profile under which this thread - was initially running is used. -
      -**/ - public static final String STATUS_MESSAGE_HANDLING = "STATUS_MESSAGE_HANDLING"; - - /** - Attribute value indicating that this job displays status messages. - - @see #STATUS_MESSAGE_HANDLING - **/ - public static final String STATUS_MESSAGE_HANDLING_NORMAL = "*NORMAL"; - - static { - attributes_.add(STATUS_MESSAGE_HANDLING, String.class, false, - new String[] { NONE, - STATUS_MESSAGE_HANDLING_NORMAL, - SYSTEM_VALUE, - USER_PROFILE }, null, true); - getterMap_.add(STATUS_MESSAGE_HANDLING, JOBI0400_, "receiverVariable.statusMessageHandling"); - setterKeys_.add(STATUS_MESSAGE_HANDLING, 1902, ProgramKeys.CHAR, 10); - } - - - -/** -Attribute ID for submitted by job name. This identifies a read-only String attribute, -which represents the job name of the submitter's job. -**/ - public static final String SUBMITTED_BY_JOB_NAME = "SUBMITTED_BY_JOB_NAME"; - - static { - attributes_.add(SUBMITTED_BY_JOB_NAME, String.class, true); - getterMap_.add(SUBMITTED_BY_JOB_NAME, JOBI0300_, "receiverVariable.submittersJob.jobName"); - } - - - -/** -Attribute ID for submitted by job number. This identifies a read-only String attribute, -which represents the job number of the submitter's job. -**/ - public static final String SUBMITTED_BY_JOB_NUMBER = "SUBMITTED_BY_JOB_NUMBER"; - - static { - attributes_.add(SUBMITTED_BY_JOB_NUMBER, String.class, true); - getterMap_.add(SUBMITTED_BY_JOB_NUMBER, JOBI0300_, "receiverVariable.submittersJob.jobNumber"); - } - - - -/** -Attribute ID for submitted by user. This identifies a read-only String attribute, -which represents the user name of the submitter's job. -**/ - public static final String SUBMITTED_BY_USER = "SUBMITTED_BY_USER"; - - static { - attributes_.add(SUBMITTED_BY_USER, String.class, true); - getterMap_.add(SUBMITTED_BY_USER, JOBI0300_, "receiverVariable.submittersJob.userName"); - } - - - -/** -Attribute ID for subsystem. This identifies a read-only String attribute, -which represents the fully qualified integrated file system path name of -the subsystem in which an active job is running. - -@see com.ibm.as400.access.QSYSObjectPathName -**/ - public static final String SUBSYSTEM = "SUBSYSTEM"; - - static { - attributes_.add(SUBSYSTEM, String.class, true); - getterMap_.add(SUBSYSTEM, JOBI0600_, "receiverVariable.subsystemDescription", - new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "SBSD")); - } - - - -/** -Attribute ID for system library list. This identifies a read-only String[] -attribute, which represents the system portion of the library list of -the initial thread. -**/ - public static final String SYSTEM_LIBRARY_LIST = "SYSTEM_LIBRARY_LIST"; - - static { - attributes_.add(SYSTEM_LIBRARY_LIST, String[].class, true); - getterMap_.add(SYSTEM_LIBRARY_LIST, JOBI0700_, "receiverVariable.systemLibraryList", "receiverVariable.numberOfLibrariesInSystemLibraryList", arrayTypeValueMapString_); - } - - - -/** -Attribute ID for system pool ID. This identifies a read-only Integer attribute, -which represents the identifier of the system-related pool from which the -job's main storage is allocated. -**/ - public static final String SYSTEM_POOL_ID = "SYSTEM_POOL_ID"; - - static { - attributes_.add(SYSTEM_POOL_ID, Integer.class, true); - getterMap_.add(SYSTEM_POOL_ID, JOBI0150_, "receiverVariable.systemPoolIdentifier"); - getterMap_.add(SYSTEM_POOL_ID, JOBI0200_, "receiverVariable.systemPoolIdentifier"); - } - - - -/** -Attribute ID for temporary storage used. This identifies a read-only Integer attribute, -which represents the amount of auxiliary storage (in megabytes) that is currently -allocated to this job. -**/ - public static final String TEMP_STORAGE_USED = "TEMP_STORAGE_USED"; - - static { - attributes_.add(TEMP_STORAGE_USED, Integer.class, true); - getterMap_.add(TEMP_STORAGE_USED, JOBI0150_, "receiverVariable.temporaryStorageUsedInMegabytes"); - } - - - -/** -Attribute ID for thread count. This identifies a read-only Integer attribute, -which represents the current number of active threads in the process. -**/ - public static final String THREAD_COUNT = "THREAD_COUNT"; - - static { - attributes_.add(THREAD_COUNT, Integer.class, true); - getterMap_.add(THREAD_COUNT, JOBI0150_, "receiverVariable.threadCount"); - getterMap_.add(THREAD_COUNT, JOBI0200_, "receiverVariable.threadCount"); - } - - - -/** -Attribute ID for time separator. This identifies a String attribute, which -represents the value used to separate hours, minutes, and seconds when presenting -a time. - -

      The following special value can be used when setting the time separator: -

        -
      • {@link #TIME_SEPARATOR_SYSTEM_VALUE TIME_SEPARATOR_SYSTEM_VALUE} - The - system value QTIMSEP is used. -
      -**/ - public static final String TIME_SEPARATOR = "TIME_SEPARATOR"; - - /** - Attribute value indicating that the system value QTIMSEP is used. - - @see #TIME_SEPARATOR - **/ - public static final String TIME_SEPARATOR_SYSTEM_VALUE = "S"; - - static { - attributes_.add(TIME_SEPARATOR, String.class, false, - new String[] { TIME_SEPARATOR_SYSTEM_VALUE }, null, false); - getterMap_.add(TIME_SEPARATOR, JOBI0400_, "receiverVariable.timeSeparator"); - setterKeys_.add(TIME_SEPARATOR, 2001, ProgramKeys.CHAR, 1); - } - - - -/** -Attribute ID for time slice. This identifies an Integer attribute, which -represents the maximum amount of processor time (in milliseconds) given to -each thread in this job before other threads in this job and in other -jobs are given the opportunity to run. -**/ - public static final String TIME_SLICE = "TIME_SLICE"; - - static { - attributes_.add(TIME_SLICE, Integer.class, false); - getterMap_.add(TIME_SLICE, JOBI0100_, "receiverVariable.timeSlice"); - setterKeys_.add(TIME_SLICE, 2002, ProgramKeys.BINARY); - } - - - -/** -Attribute ID for time slice end pool. This identifies a String attribute, which -indicates whether a thread in an interactive job moves to another main storage -pool at the end of its time slice. Possible values are: -
        -
      • {@link #NONE NONE} - - A thread in the job does not move to another main storage pool when it reaches - the end of its time slice. -
      • {@link #TIME_SLICE_END_POOL_BASE TIME_SLICE_END_POOL_BASE} - - A thread in the job moves to the base pool when it reaches - the end of its time slice. -
      - -

      The following special value can be used when setting the time slice end pool: -

        -
      • {@link #SYSTEM_VALUE SYSTEM_VALUE} - The - system value QTSEPOOL is used. -
      -**/ - public static final String TIME_SLICE_END_POOL = "TIME_SLICE_END_POOL"; - - /** - Attribute value indicating that a thread in the job moves to the base pool when it reaches - the end of its time slice. - - @see #TIME_SLICE_END_POOL - **/ - public static final String TIME_SLICE_END_POOL_BASE = "*BASE"; - - static { - attributes_.add(TIME_SLICE_END_POOL, String.class, false, - new String[] { NONE, - TIME_SLICE_END_POOL_BASE, - SYSTEM_VALUE }, null, true); - getterMap_.add(TIME_SLICE_END_POOL, JOBI0150_, "receiverVariable.timeSliceEndPool"); - setterKeys_.add(TIME_SLICE_END_POOL, 2003, ProgramKeys.CHAR, 10); - } - - - -/** -Attribute ID for total response time. This identifies a read-only Integer attribute, -which represents the total amount of response time (in milliseconds) for the -initial thread. -**/ - public static final String TOTAL_RESPONSE_TIME = "TOTAL_RESPONSE_TIME"; - - static { - attributes_.add(TOTAL_RESPONSE_TIME, Integer.class, true); - getterMap_.add(TOTAL_RESPONSE_TIME, JOBI0200_, "receiverVariable.responseTimeTotal"); - } - - - -/** -Attribute ID for user library list. This identifies a read-only String[] -attribute, which represents the user portion of the library list of -the initial thread. -**/ - public static final String USER_LIBRARY_LIST = "USER_LIBRARY_LIST"; - - static { - attributes_.add(USER_LIBRARY_LIST, String[].class, true); - getterMap_.add(USER_LIBRARY_LIST, JOBI0700_, "receiverVariable.userLibraryList", "receiverVariable.numberOfLibrariesInUserLibraryList", arrayTypeValueMapString_); - } - - - -/** -Attribute ID for user name. This identifies a read-only String attribute, -which represents the user name of the job, which is the same as the name -of the user profile under which the job was started. -**/ - public static final String USER_NAME = "USER_NAME"; - - static { - attributes_.add(USER_NAME, String.class, true); - getterMap_.add(USER_NAME, JOBI0100_, "receiverVariable.qualifiedJobName.userName"); - getterMap_.add(USER_NAME, JOBI0150_, "receiverVariable.qualifiedJobName.userName"); - getterMap_.add(USER_NAME, JOBI0200_, "receiverVariable.qualifiedJobName.userName"); - getterMap_.add(USER_NAME, JOBI0300_, "receiverVariable.qualifiedJobName.userName"); - getterMap_.add(USER_NAME, JOBI0400_, "receiverVariable.qualifiedJobName.userName"); - getterMap_.add(USER_NAME, JOBI0500_, "receiverVariable.qualifiedJobName.userName"); - getterMap_.add(USER_NAME, JOBI0600_, "receiverVariable.qualifiedJobName.userName"); - getterMap_.add(USER_NAME, JOBI0700_, "receiverVariable.qualifiedJobName.userName"); - getterMap_.add(USER_NAME, JOBI0800_, "receiverVariable.qualifiedJobName.userName"); - getterMap_.add(USER_NAME, JOBI0900_, "receiverVariable.qualifiedJobName.userName"); - } - - - -/** -Attribute ID for user return code. This identifies a read-only Integer attribute, -which represents the user-defined return code set by ILE high-level language -constructs. -**/ - public static final String USER_RETURN_CODE = "USER_RETURN_CODE"; - - static { - attributes_.add(USER_RETURN_CODE, Integer.class, true); - getterMap_.add(USER_RETURN_CODE, JOBI0600_, "receiverVariable.userReturnCode"); - } - - - -//----------------------------------------------------------------------------------------- -// PCML document initialization. -//----------------------------------------------------------------------------------------- - - private static final String DOCUMENT_NAME_ = "com.ibm.as400.resource.RJob"; - private static ProgramCallDocument staticDocument_ = null; - - static { - // Create a static version of the PCML document, then clone it for each document. - // This will improve performance, since we will only have to deserialize the PCML - // object once. - try { - staticDocument_ = new ProgramCallDocument(); - staticDocument_.setDocument(DOCUMENT_NAME_); - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error instantiating ProgramCallDocument", e); - } - } - - -//----------------------------------------------------------------------------------------- -// Private data. -//----------------------------------------------------------------------------------------- - - private static final byte[] BLANK_INTERNAL_JOB_ID_ = new byte[] { - (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, - (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, - (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, - (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40 - }; - private byte[] internalJobID_ = null; - private String name_ = "*"; - private String number_ = ""; - private String user_ = ""; - - private ProgramAttributeGetter attributeGetter_ = null; - private ProgramKeyAttributeSetter attributeSetter_ = null; - - -//----------------------------------------------------------------------------------------- -// Constructors. -//----------------------------------------------------------------------------------------- - -/** -Constructs an RJob object. -**/ - public RJob() - { - super(presentationLoader_.getPresentationWithIcon(PRESENTATION_KEY_, ICON_BASE_NAME_), null, attributes_); - } - - - -/** -Constructs an RJob object. - -@param system The system. -**/ - public RJob(AS400 system) - { - this(); - - try { - setSystem(system); - } - catch(PropertyVetoException e) { - // Ignore. - } - } - - - -/** -Constructs an RJob object. - -@param system The system. -@param name The job name. Specify "*" to indicate the default job. -@param user The user name. This must be blank if name is "*". -@param number The job number. This must be blank if name is "*". -**/ - public RJob(AS400 system, - String name, - String user, - String number) - { - this(); - - try { - setSystem(system); - setName(name); - setUser(user); - setNumber(number); - } - catch(PropertyVetoException e) { - // Ignore. - } - - if(name.equals("*")) { - if (user.trim() != "") - throw new ExtendedIllegalArgumentException("user", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if (number.trim() != "") - throw new ExtendedIllegalArgumentException("number", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - - -/** -Constructs an RJob object. This sets the job name to "*INT". - -@param system The system. -@param internalJobID The internal job identifier. -**/ - public RJob(AS400 system, byte[] internalJobID) - { - this(); - - try { - setSystem(system); - setName("*INT"); - setInternalJobID(internalJobID); - } - catch(PropertyVetoException e) { - // Ignore. - - } - } - - - -// @A2C -/** -Commits the specified attribute changes. - -@param attributeIDs The attribute IDs for the specified attribute changes. -@param values The specified attribute changes -@param bidiStringTypes The bidi string types as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. - -@exception ResourceException If an error occurs. -**/ - protected void commitAttributeChanges(Object[] attributeIDs, Object[] values, int[] bidiStringTypes) - throws ResourceException - { - super.commitAttributeChanges(attributeIDs, values, bidiStringTypes); - - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); - - attributeSetter_.setValues(attributeIDs, values, bidiStringTypes); - } - - - -/** -Computes the resource key. - -@param system The system. -@param name The job name. -@param user The user name. -@param number The job number. -@param internalJobID The internal job identifier. -**/ - static Object computeResourceKey(AS400 system, String name, String user, String number, byte[] internalJobID) - { - if (internalJobID == null) { - StringBuffer buffer = new StringBuffer(); - buffer.append(RJob.class); - buffer.append(':'); - buffer.append(system.getSystemName()); - buffer.append(':'); - buffer.append(system.getUserId()); - buffer.append(':'); - buffer.append(number); - buffer.append('/'); - buffer.append(user); - buffer.append('/'); - buffer.append(name); - return buffer.toString(); - } - else - return internalJobID; - } - - - -/** -Creates the resource using the specified attribute values. This method -is not supported for this class and always throws a ResourceException. - -@exception ResourceException If an error occurs. -**/ - public void createResource(Object[] attributeIDs, Object[] values) - throws ResourceException - { - throw new ResourceException(ResourceException.OPERATION_NOT_SUPPORTED); - } - - - -/** -Ends the job controlled. The program running in the job -is allowed to perform some cleanup and end of job processing. - -@exception ResourceException If an error occurs. -**/ - public void end() - throws ResourceException - { - endInternal(-1); - } - - - -/** -Ends the job. - -@param delayTime The amount of time (in seconds) allowed for the job to complete - its cleanup and end of job processing during a controlled end. - If the cleanup is not completed before the end of the delay time, - the job is ended immediately. Specify 0 to end the job - immediately. - -@exception ResourceException If an error occurs. -**/ - public void end(int delayTime) - throws ResourceException - { - // Validate the parameters. - if (delayTime < 0) - throw new ExtendedIllegalArgumentException("delayTime", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - endInternal(delayTime); - } - - - - private void endInternal(int delayTime) - throws ResourceException - { - // Validate the properties. - if (name_ == null) - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - if (number_ == null) - throw new ExtendedIllegalStateException("number", ExtendedIllegalStateException.PROPERTY_NOT_SET); - if (user_ == null) - throw new ExtendedIllegalStateException("user", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - // Establish the connection if needed. - if (!isConnectionEstablished()) - establishConnection(); - - // Issue the ENDJOB CL command. - AS400 sys = null; - try { - StringBuffer buffer = new StringBuffer(); - buffer.append("ENDJOB JOB("); - buffer.append(number_); - buffer.append('/'); - buffer.append(user_); - buffer.append('/'); - buffer.append(name_); - buffer.append(") OPTION("); - if (delayTime == 0) { - buffer.append("*IMMED)"); - } - else { - buffer.append("*CNTRLD)"); - if (delayTime > 0) { - buffer.append(" DELAY("); - buffer.append(delayTime); - buffer.append(")"); - } - } - String endJob = buffer.toString(); - - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Ending the job:" + endJob); - - // Use a separate connection, in case the job we're trying to - // end is the Remote Command Call host server. @A1a - sys = new AS400(getSystem()); //@A1a - CommandCall commandCall = new CommandCall(sys, endJob); //@A1c - boolean success = commandCall.run(); - if (!success) - throw new ResourceException(commandCall.getMessageList()); - } - catch(Exception e) { - throw new ResourceException(e); - } - finally { - if (sys != null) sys.disconnectAllServices(); - } - } - - - -/** -Establishes the connection to the system. - -

      The method is called by the resource framework automatically -when the connection needs to be established. - -@exception ResourceException If an error occurs. -**/ - protected void establishConnection() - throws ResourceException - { - // Call the superclass. - super.establishConnection(); - - // Validate if we can establish the connection. - if (internalJobID_ == null) { - if (name_ == null) - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - if (number_ == null) - throw new ExtendedIllegalStateException("number", ExtendedIllegalStateException.PROPERTY_NOT_SET); - if (user_ == null) - throw new ExtendedIllegalStateException("user", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Initialize the PCML document. - ProgramCallDocument document = (ProgramCallDocument)staticDocument_.clone(); - AS400 system = getSystem(); - try { - document.setSystem(system); - - byte[] actualInternalJobID = (internalJobID_ == null) ? BLANK_INTERNAL_JOB_ID_ : internalJobID_; - document.setValue("qusrjobi_jobi0100.internalJobIdentifier", actualInternalJobID); - document.setValue("qusrjobi_jobi0150.internalJobIdentifier", actualInternalJobID); - document.setValue("qusrjobi_jobi0200.internalJobIdentifier", actualInternalJobID); - document.setValue("qusrjobi_jobi0300.internalJobIdentifier", actualInternalJobID); - document.setValue("qusrjobi_jobi0400.internalJobIdentifier", actualInternalJobID); - document.setValue("qusrjobi_jobi0500.internalJobIdentifier", actualInternalJobID); - document.setValue("qusrjobi_jobi0600.internalJobIdentifier", actualInternalJobID); - document.setValue("qusrjobi_jobi0700.internalJobIdentifier", actualInternalJobID); - document.setValue("qwtchgjb.internalJobIdentifier", actualInternalJobID); - - String actualName = (internalJobID_ == null) ? name_.toUpperCase() : "*INT"; - document.setValue("qusrjobi_jobi0100.qualifiedJobName.jobName", actualName); - document.setValue("qusrjobi_jobi0150.qualifiedJobName.jobName", actualName); - document.setValue("qusrjobi_jobi0200.qualifiedJobName.jobName", actualName); - document.setValue("qusrjobi_jobi0300.qualifiedJobName.jobName", actualName); - document.setValue("qusrjobi_jobi0400.qualifiedJobName.jobName", actualName); - document.setValue("qusrjobi_jobi0500.qualifiedJobName.jobName", actualName); - document.setValue("qusrjobi_jobi0600.qualifiedJobName.jobName", actualName); - document.setValue("qusrjobi_jobi0700.qualifiedJobName.jobName", actualName); - document.setValue("qwtchgjb.qualifiedJobName.jobName", actualName); - - String actualNumber = (internalJobID_ == null) ? number_ : ""; - document.setValue("qusrjobi_jobi0100.qualifiedJobName.jobNumber", actualNumber); - document.setValue("qusrjobi_jobi0150.qualifiedJobName.jobNumber", actualNumber); - document.setValue("qusrjobi_jobi0200.qualifiedJobName.jobNumber", actualNumber); - document.setValue("qusrjobi_jobi0300.qualifiedJobName.jobNumber", actualNumber); - document.setValue("qusrjobi_jobi0400.qualifiedJobName.jobNumber", actualNumber); - document.setValue("qusrjobi_jobi0500.qualifiedJobName.jobNumber", actualNumber); - document.setValue("qusrjobi_jobi0600.qualifiedJobName.jobNumber", actualNumber); - document.setValue("qusrjobi_jobi0700.qualifiedJobName.jobNumber", actualNumber); - document.setValue("qwtchgjb.qualifiedJobName.jobNumber", actualNumber); - - String actualUser = (internalJobID_ == null) ? user_.toUpperCase() : ""; - document.setValue("qusrjobi_jobi0100.qualifiedJobName.userName", actualUser); - document.setValue("qusrjobi_jobi0150.qualifiedJobName.userName", actualUser); - document.setValue("qusrjobi_jobi0200.qualifiedJobName.userName", actualUser); - document.setValue("qusrjobi_jobi0300.qualifiedJobName.userName", actualUser); - document.setValue("qusrjobi_jobi0400.qualifiedJobName.userName", actualUser); - document.setValue("qusrjobi_jobi0500.qualifiedJobName.userName", actualUser); - document.setValue("qusrjobi_jobi0600.qualifiedJobName.userName", actualUser); - document.setValue("qusrjobi_jobi0700.qualifiedJobName.userName", actualUser); - document.setValue("qwtchgjb.qualifiedJobName.userName", actualUser); - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error setting PCML document values", e); - } - - // Initialize the attribute getter. - attributeGetter_ = new ProgramAttributeGetter(system, document, getterMap_); - - // Initialize the attribute setter. - attributeSetter_ = new ProgramKeyAttributeSetter(system, document, "qwtchgjb", "jobChangeInformation", setterKeys_); - } - - - -/** -Freezes any property changes. After this is called, property -changes should not be made. Properties are not the same thing -as attributes. Properties are basic pieces of information -which must be set to make the object usable, such as the system, -job name, job number, and user name. - -

      The method is called by the resource framework automatically -when the properties need to be frozen. - -@exception ResourceException If an error occurs. -**/ - protected void freezeProperties() - throws ResourceException - { - // Validate if we can establish the connection. - if (internalJobID_ == null) { - if (name_ == null) - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - if (number_ == null) - throw new ExtendedIllegalStateException("number", ExtendedIllegalStateException.PROPERTY_NOT_SET); - if (user_ == null) - throw new ExtendedIllegalStateException("user", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Update the resource key. - if (getResourceKey() == null) - setResourceKey(computeResourceKey(getSystem(), name_, user_, number_, internalJobID_)); - - // Call the superclass. - super.freezeProperties(); - } - - - -// @A2C -/** -Returns the unchanged value of an attribute. If the attribute -value has an uncommitted change, this returns the unchanged value. -If the attribute value does not have an uncommitted change, this -returns the same value as getAttributeValue(). - -@param attributeID Identifies the attribute. -@param bidiStringType The bidi string type as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. -@return The attribute value, or null if the attribute - value is not available. - -@exception ResourceException If an error occurs. -**/ - public Object getAttributeUnchangedValue(Object attributeID, int bidiStringType) - throws ResourceException - { - Object value = super.getAttributeUnchangedValue(attributeID, bidiStringType); - if (value == null) { - - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); - - value = attributeGetter_.getValue(attributeID, bidiStringType); - } - return value; - } - - - -/** -Returns the internal job identifier. - -@return The internal job identifier, or null if none has been set. -**/ - public byte[] getInternalJobID() - { - return internalJobID_; - } - - - -/** -Returns the job name. - -@return The job name, or "*" if none has been set. -**/ - public String getName() - { - return name_; - } - - - -/** -Returns the job number. - -@return The job number, or "" if none has been set. -**/ - public String getNumber() - { - return number_; - } - - - -/** -Returns the user name. - -@return The user name, or "" if none has been set. -**/ - public String getUser() - { - return user_; - } - - - -// @A2A -/** -Indicates if this resource is enabled for bidirectional character conversion. -This always returns true. - -@return Always true. -**/ - protected boolean isBidiEnabled() - { - return true; - } - - - -/** -Refreshes the values for all attributes. This does not cancel -uncommitted changes. This method fires an attributeValuesRefreshed() -ResourceEvent. - -@exception ResourceException If an error occurs. -**/ - public void refreshAttributeValues() - throws ResourceException - { - super.refreshAttributeValues(); - - if (attributeGetter_ != null) - attributeGetter_.clearBuffer(); - } - - - -/** -Sets the internal job identifier. This does not change -the job on the system. Instead, it changes the job -that this object references. The job name -must be set to "*INT" for this to be recognized. -This cannot be changed if the object has established -a connection to the system. - -@param internalJobID The internal job identifier. - -@exception PropertyVetoException If the property change is vetoed. -**/ - public void setInternalJobID(byte[] internalJobID) - throws PropertyVetoException - { - if (internalJobID == null) - throw new NullPointerException("internalJobID"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - byte[] oldValue = internalJobID_; - fireVetoableChange("internalJobID", oldValue, internalJobID); - internalJobID_ = internalJobID; - firePropertyChange("internalJobID", oldValue, internalJobID); - - // Update the presentation. - Presentation presentation = getPresentation(); - presentation.setName("*INT"); - presentation.setFullName(toString()); - } - - - -/** -Sets the job name. This does not change the job on -the system. Instead, it changes the job -that this object references. This cannot be changed -if the object has established a connection to the system. - -@param name The job name. Specify "*" to indicate the job this - program running in, or "*INT" to indicate that the job - is specified using the internal job identifier. - -@exception PropertyVetoException If the property change is vetoed. -**/ - public void setName(String name) - throws PropertyVetoException - { - if (name == null) - throw new NullPointerException("name"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - String oldValue = name_; - fireVetoableChange("name", oldValue, name); - name_ = name; - firePropertyChange("name", oldValue, name); - - // Update the presentation. - Presentation presentation = getPresentation(); - presentation.setName(name_); - presentation.setFullName(toString()); - } - - - -/** -Sets the job number. This does not change the job on -the system. Instead, it changes the job -that this object references. This cannot be changed -if the object has established a connection to the system. - -@param number The job number. This must be blank if the job name is "*". - -@exception PropertyVetoException If the property change is vetoed. -**/ - public void setNumber(String number) - throws PropertyVetoException - { - if (number == null) - throw new NullPointerException("number"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - String oldValue = number_; - fireVetoableChange("number", oldValue, number); - number_ = number; - firePropertyChange("number", oldValue, number); - - // Update the presentation. - Presentation presentation = getPresentation(); - presentation.setFullName(toString()); - } - - - -/** -Sets the user name. This does not change the job on -the system. Instead, it changes the job -that this object references. This cannot be changed -if the object has established a connection to the system. - -@param user The user name. This must be blank if the job name is "*". - -@exception PropertyVetoException If the property change is vetoed. -**/ - public void setUser(String user) - throws PropertyVetoException - { - if (user == null) - throw new NullPointerException("user"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - String oldValue = user_; - fireVetoableChange("user", oldValue, user); - user_ = user; - firePropertyChange("user", oldValue, user); - - // Update the presentation. - Presentation presentation = getPresentation(); - presentation.setFullName(toString()); - } - - - -/** -Returns the string representation in the format -"number/user/name". - -@return The string representation. -**/ - public String toString() - { - StringBuffer buffer = new StringBuffer(); - buffer.append(number_); - buffer.append('/'); - buffer.append(user_); - buffer.append('/'); - buffer.append(name_); - return buffer.toString(); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/RJob.pcml b/cvsroot/src/com/ibm/as400/resource/RJob.pcml deleted file mode 100644 index 5139f37c8..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RJob.pcml +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/resource/RJob16.gif b/cvsroot/src/com/ibm/as400/resource/RJob16.gif deleted file mode 100644 index c47621035..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RJob16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RJob32.gif b/cvsroot/src/com/ibm/as400/resource/RJob32.gif deleted file mode 100644 index a3b4854fc..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RJob32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RJobBeanInfo.java b/cvsroot/src/com/ibm/as400/resource/RJobBeanInfo.java deleted file mode 100644 index b47900da8..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RJobBeanInfo.java +++ /dev/null @@ -1,167 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RJobBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Trace; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.util.ResourceBundle; - - - -/** -The RJobBeanInfo class represents the bean information -for the RJob class. -@deprecated Use com.ibm.as400.access.Job instead. -**/ -public class RJobBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final Class beanClass_ = RJob.class; - - private static BeanInfo[] additionalBeanInfo_; - private static BeanDescriptor beanDescriptor_; - private static Image icon16_; - private static Image icon32_; - private static PropertyDescriptor[] propertyDescriptors_; - private static ResourceBundle resourceBundle_; - - - -/** -Static initializer. -**/ - static - { - try - { - // Set up the resource bundle. - resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.resource.ResourceMRI"); - - // Set up the additional bean info. - additionalBeanInfo_ = new BeanInfo[] { new ResourceBeanInfo() }; - - // Set up the bean descriptor. - beanDescriptor_ = new BeanDescriptor(beanClass_); - - // Set up the property descriptors. - PropertyDescriptor name = new PropertyDescriptor("name", beanClass_); - name.setBound(true); - name.setConstrained(true); - name.setDisplayName(resourceBundle_.getString("PROPERTY_NAME_NAME")); - name.setShortDescription(resourceBundle_.getString("PROPERTY_NAME_DESCRIPTION")); - - PropertyDescriptor number = new PropertyDescriptor("number", beanClass_); - number.setBound(true); - number.setConstrained(true); - number.setDisplayName(resourceBundle_.getString("PROPERTY_NUMBER_NAME")); - number.setShortDescription(resourceBundle_.getString("PROPERTY_NUMBER_DESCRIPTION")); - - PropertyDescriptor user = new PropertyDescriptor("user", beanClass_); - user.setBound(true); - user.setConstrained(true); - user.setDisplayName(resourceBundle_.getString("PROPERTY_USER_NAME")); - user.setShortDescription(resourceBundle_.getString("PROPERTY_USER_DESCRIPTION")); - - propertyDescriptors_ = new PropertyDescriptor[] { name, number, user }; - - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error while loading bean info", e); - throw new Error(e.toString()); - } - } - - - -/** -Returns the additional bean information. - -@return The additional bean information. -**/ - public BeanInfo[] getAdditionalBeanInfo() - { - return additionalBeanInfo_; - } - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - - -/** -Returns the property descriptors. - -@return The property descriptors. -**/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors_; - } - - - -/** -Returns the icon. - -@param icon The icon kind. Possible values are: -

        -
      • BeanInfo.ICON_MONO_16x16 -
      • BeanInfo.ICON_MONO_32x32 -
      • BeanInfo.ICON_COLOR_16x16 -
      • BeanInfo.ICON_COLOR_32x32 -
      -@return The icon. -**/ - public Image getIcon(int icon) - { - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - if (icon16_ == null) - icon16_ = loadImage("RJob16.gif"); - return icon16_; - - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - if (icon32_ == null) - icon32_ = loadImage("RJob32.gif"); - return icon32_; - - default: - throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/RJobList.java b/cvsroot/src/com/ibm/as400/resource/RJobList.java deleted file mode 100644 index 24b90b9a4..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RJobList.java +++ /dev/null @@ -1,500 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RJobList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.beans.PropertyVetoException; - - - -/** -The RJobList class represents a list of server jobs. - -

      The following selection IDs are supported: -

        -
      • {@link #JOB_NAME JOB_NAME} -
      • {@link #JOB_NUMBER JOB_NUMBER} -
      • {@link #JOB_TYPE JOB_TYPE} -
      • {@link #PRIMARY_JOB_STATUSES PRIMARY_JOB_STATUSES} -
      • {@link #USER_NAME USER_NAME} -
      -
      - -

      Use one or more of these selection IDs with -{@link com.ibm.as400.resource.ResourceList#getSelectionValue(java.lang.Object) getSelectionValue()} -and {@link com.ibm.as400.resource.ResourceList#setSelectionValue(java.lang.Object, java.lang.Object) setSelectionValue()} -to access the selection values for an RJobList. - -

      The following sort IDs are supported: -

      - - -

      Use one or more of these sort IDs with -{@link com.ibm.as400.resource.ResourceList#getSortValue() getSortValue()} -and {@link com.ibm.as400.resource.ResourceList#setSortValue(java.lang.Object[]) setSortValue()} -to access the sort values for an RJobList. - -

      RJobList objects generate {@link com.ibm.as400.resource.RJob RJob} objects. - -

      -// Create an RJobList object to represent a list of jobs.
      -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
      -RJobList jobList = new RJobList(system);
      -
      -// Set the selection so that only active jobs with the name -// "QZDASOINIT" are included in the list. -jobList.setSelectionValue(RJobList.PRIMARY_JOB_STATUSES, new String[] { RJob.JOB_STATUS_ACTIVE }); -jobList.setSelectionValue(RJobList.JOB_NAME, "QZDASOINIT"); -
      -// Set the sort value so that the list is sorted by -// user name and job type. -Object[] sortValue = new Object[] { RJob.USER_NAME, RJob.JOB_TYPE }; -jobList.setSortValue(sortValue); -
      -// Open the list and wait for it to complete. -jobList.open(); -jobList.waitForComplete(); -
      -// Read and print the job numbers for the jobs in the list. -long numberOfJobs = jobList.getListLength(); -for(long i = 0; i < numberOfJobs; ++i) -{ - RJob job = (RJob)jobList.resourceAt(i); - System.out.println(job.getAttributeValue(RJob.JOB_NUMBER)); -} -
      -// Close the list. -jobList.close(); -
      - -@deprecated Use -{@link com.ibm.as400.access.JobList JobList} instead, as this package may be removed in the future. -@see RJob -**/ -public class RJobList -extends SystemResourceList -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - -//----------------------------------------------------------------------------------------- -// Presentation. -//----------------------------------------------------------------------------------------- - - private static final String PRESENTATION_KEY_ = "JOB_LIST"; - private static final String ICON_BASE_NAME_ = "RJobList"; - private static final String SORTS_PRESENTATION_KEY_ = "JOB"; - private static PresentationLoader presentationLoader_ = new PresentationLoader("com.ibm.as400.resource.ResourceMRI"); - - - -//----------------------------------------------------------------------------------------- -// Public constants. -//----------------------------------------------------------------------------------------- - -/** -Constant indicating that all jobs are returned. -**/ - public static final String ALL = "*ALL"; - - -/** -Constant indicating that a blank value is used. -**/ - public static final String BLANK = "*BLANK"; - - -/** -Constant indicating that the current value is used. -**/ - public static final String CURRENT = "*CURRENT"; - - - -//----------------------------------------------------------------------------------------- -// Selection IDs. -// -// * If you add a selection here, make sure and add it to the class javadoc -// and in ResourceMRI.java. -//----------------------------------------------------------------------------------------- - - private static ResourceMetaDataTable selections_ = new ResourceMetaDataTable(presentationLoader_, PRESENTATION_KEY_); - - - -/** -Selection ID for job name. This identifies a String selection, -which represents a specific job name. Possible values are: -
        -
      • "*" - Only the job that this program is running in. -
      • {@link #CURRENT CURRENT} - All jobs with the current job's name. -
      • {@link #ALL ALL} - All job names. -
      • A job name. -
      -The default is ALL. -**/ - public static final String JOB_NAME = "JOB_NAME"; - - static { - selections_.add(JOB_NAME, String.class, false, - new String[] { "*", CURRENT, ALL }, ALL, false); - } - - - -/** -Selection ID for job number. This identifies a String selection, -which represents a specific job number. Possible values are: -
        -
      • {@link #ALL ALL} - All job numbers. -
      • A job number. -
      -The default is ALL. -**/ - public static final String JOB_NUMBER = "JOB_NUMBER"; - - static { - selections_.add(JOB_NUMBER, String.class, false, - new String[] { ALL }, ALL, false); - } - - - -/** -Selection ID for job type. This identifies a String selection, -which represents the type of job to be listed. Possible values are: -
        -
      • {@link #ALL ALL} - All job types. -
      • {@link com.ibm.as400.resource.RJob#JOB_TYPE_AUTOSTART RJob.JOB_TYPE_AUTOSTART} - The job is an autostart job. -
      • {@link com.ibm.as400.resource.RJob#JOB_TYPE_BATCH RJob.JOB_TYPE_BATCH} - The job is a batch job. -
      • {@link com.ibm.as400.resource.RJob#JOB_TYPE_INTERACTIVE RJob.JOB_TYPE_INTERACTIVE} - The job is an interactive job. -
      • {@link com.ibm.as400.resource.RJob#JOB_TYPE_SUBSYSTEM_MONITOR RJob.JOB_TYPE_SUBSYSTEM_MONITOR} - The job is a subsystem monitor job. -
      • {@link com.ibm.as400.resource.RJob#JOB_TYPE_SPOOLED_READER RJob.JOB_TYPE_SPOOLED_READER} - The job is a spooled reader job. -
      • {@link com.ibm.as400.resource.RJob#JOB_TYPE_SYSTEM RJob.JOB_TYPE_SYSTEM} - The job is a system job. -
      • {@link com.ibm.as400.resource.RJob#JOB_TYPE_SPOOLED_WRITER RJob.JOB_TYPE_SPOOLED_WRITER} - The job is a spooled writer job. -
      • {@link com.ibm.as400.resource.RJob#JOB_TYPE_SCPF_SYSTEM RJob.JOB_TYPE_SCPF_SYSTEM} - The job is the SCPF system job. -
      -The default is ALL. -**/ - public static final String JOB_TYPE = "JOB_TYPE"; - - static { - selections_.add(JOB_TYPE, String.class, false, - new String[] { ALL, - RJob.JOB_TYPE_AUTOSTART, - RJob.JOB_TYPE_BATCH, - RJob.JOB_TYPE_INTERACTIVE, - RJob.JOB_TYPE_SUBSYSTEM_MONITOR, - RJob.JOB_TYPE_SPOOLED_READER, - RJob.JOB_TYPE_SYSTEM, - RJob.JOB_TYPE_SPOOLED_WRITER, - RJob.JOB_TYPE_SCPF_SYSTEM }, ALL, true); - } - - - -/** -Selection ID for jobs on primary job statuses. This identifies a String array selection, -which represents the primary statuses of the jobs to be included in the list. -Possible values for each element of the array are: -
        -
      • {@link com.ibm.as400.resource.RJob#JOB_STATUS_ACTIVE RJob.JOB_STATUS_ACTIVE} - The job is active. -
      • {@link com.ibm.as400.resource.RJob#JOB_STATUS_JOBQ RJob.JOB_STATUS_JOBQ} - The job is currently on a job queue. -
      • {@link com.ibm.as400.resource.RJob#JOB_STATUS_OUTQ RJob.JOB_STATUS_OUTQ} - The job has completed running, but still has output - on an output queue. -
      -**/ - public static final String PRIMARY_JOB_STATUSES = "PRIMARY_JOB_STATUSES"; - - static { - selections_.add(PRIMARY_JOB_STATUSES, String.class, false, - new String[] { RJob.JOB_STATUS_ACTIVE, - RJob.JOB_STATUS_JOBQ, - RJob.JOB_STATUS_OUTQ }, null, true, true); - } - - - -/** -Selection ID for user name. This identifies a String selection, -which represents a specific user profile name. Possible values are: -
        -
      • {@link #CURRENT CURRENT} - All jobs with the current job's user profile. -
      • {@link #ALL ALL} - All jobs regardless of user name. -
      • A user profile name. -
      -The default is ALL. -**/ - public static final String USER_NAME = "USER_NAME"; - - static { - selections_.add(USER_NAME, String.class, false, - new String[] { CURRENT, ALL }, ALL, false); - } - - - -//----------------------------------------------------------------------------------------- -// Sort IDs. -// -// * If you add a sort here, make sure and add it to the class javadoc -// and in ResourceMRI.java. -//----------------------------------------------------------------------------------------- - - private static ResourceMetaDataTable sorts_ = new ResourceMetaDataTable(presentationLoader_, SORTS_PRESENTATION_KEY_); - - static { - sorts_.add(RJob.JOB_NAME, String.class, true); - sorts_.add(RJob.USER_NAME, String.class, true); - sorts_.add(RJob.JOB_NUMBER, String.class, true); - sorts_.add(RJob.JOB_TYPE, String.class, true); - sorts_.add(RJob.JOB_SUBTYPE, String.class, true); - } - - - -//----------------------------------------------------------------------------------------- -// PCML document initialization. -//----------------------------------------------------------------------------------------- - - private static final String DOCUMENT_NAME_ = "com.ibm.as400.resource.RJobList"; - private static final String formatName_ = "oljb0100"; - private static ProgramCallDocument staticDocument_ = null; - - static { - // Create a static version of the PCML document, then clone it for each document. - // This will improve performance, since we will only have to deserialize the PCML - // object once. - try { - staticDocument_ = new ProgramCallDocument(); - staticDocument_.setDocument(DOCUMENT_NAME_); - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error instantiating ProgramCallDocument", e); - } - } - - -//----------------------------------------------------------------------------------------- -// Private data. -//----------------------------------------------------------------------------------------- - - private static final String openListProgramName_ = "qgyoljob"; - - - -//----------------------------------------------------------------------------------------- -// Code. -//----------------------------------------------------------------------------------------- - -/** -Constructs an RJobList object. -**/ - public RJobList() - { - super(presentationLoader_.getPresentationWithIcon(PRESENTATION_KEY_, ICON_BASE_NAME_), - RJob.attributes_, - selections_, - sorts_, - openListProgramName_, - formatName_, - null); - } - - - -/** -Constructs an RJobList object. - -@param system The system. -**/ - public RJobList(AS400 system) - { - this(); - try { - setSystem(system); - } - catch(PropertyVetoException e) { - // Ignore. - } - } - - - -/** -Establishes the connection to the system. - -

      The method is called by the resource framework automatically -when the connection needs to be established. - -@exception ResourceException If an error occurs. -**/ - protected void establishConnection() - throws ResourceException - { - // Call the superclass. - super.establishConnection(); - - // Initialize the PCML document. - setDocument((ProgramCallDocument)staticDocument_.clone()); - } - - - -//----------------------------------------------------------------------------------------- -// List implementation. -//----------------------------------------------------------------------------------------- - - void setOpenParameters(ProgramCallDocument document) - throws PcmlException, ResourceException - { - super.setOpenParameters(document); - - // Set the selections. - document.setValue("qgyoljob.jobSelectionInformation.jobName", ((String)getSelectionValue(RJobList.JOB_NAME)).toUpperCase()); - document.setValue("qgyoljob.jobSelectionInformation.userName", ((String)getSelectionValue(RJobList.USER_NAME)).toUpperCase()); - document.setValue("qgyoljob.jobSelectionInformation.jobNumber", (String)getSelectionValue(RJobList.JOB_NUMBER)); - - String jobType = (String)getSelectionValue(RJobList.JOB_TYPE); - document.setValue("qgyoljob.jobSelectionInformation.jobType", (jobType.equals(ALL) ? "*" : jobType)); - - int offset = 108; - - String[] primaryJobStatuses = (String[])getSelectionValue(RJobList.PRIMARY_JOB_STATUSES); - if (primaryJobStatuses == null) - primaryJobStatuses = new String[0]; - document.setIntValue("qgyoljob.jobSelectionInformation.offsetToPrimaryJobStatusArray", offset); - document.setIntValue("qgyoljob.jobSelectionInformation.numberOfPrimaryJobStatusEntries", primaryJobStatuses.length); - for (int i = 0; i < primaryJobStatuses.length; ++i) { - document.setValue("qgyoljob.jobSelectionInformation.primaryJobStatus", new int[] { i }, primaryJobStatuses[i]); - offset += 10; - } - - // Set the sorts. - Object[] sort = getSortValue(); - document.setIntValue("qgyoljob.sortInformation.numberOfKeysToSortOn", sort.length); - for(int i = 0; i < sort.length; ++i) { - int startingPosition; - int length; - int dataType = 4; // Single byte character data. - boolean sortOrder = getSortOrder(sort[i]); - // The offsets used here are 1-based. This seems strange - // to me, but the API gave me an error when I used 0! - if (sort[i].equals(RJob.JOB_NAME)) { - startingPosition = 1; - length = 10; - } - else if (sort[i].equals(RJob.USER_NAME)) { - startingPosition = 11; - length = 10; - } - else if (sort[i].equals(RJob.JOB_NUMBER)) { - startingPosition = 21; - length = 6; - } - else if (sort[i].equals(RJob.JOB_TYPE)) { - startingPosition = 53; - length = 1; - } - else if (sort[i].equals(RJob.JOB_SUBTYPE)) { - startingPosition = 54; - length = 1; - } - else { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Bad sort value specified: " + sort[i] + "(" + sort[i].getClass() + ")"); - throw new ExtendedIllegalStateException("sortValue[" + i + "]", ExtendedIllegalStateException.UNKNOWN); - } - - int[] index = new int[] { i }; - document.setIntValue("qgyoljob.sortInformation.sortKey.sortKeyFieldStartingPosition", index, startingPosition); - document.setIntValue("qgyoljob.sortInformation.sortKey.sortKeyFieldLength", index, length); - document.setIntValue("qgyoljob.sortInformation.sortKey.sortKeyFieldDataType", index, dataType); - document.setValue("qgyoljob.sortInformation.sortKey.sortOrder", index, sortOrder ? "1" : "2"); - } - } - - - - Resource newResource(String programName, int[] indices) - throws PcmlException, ResourceException - { - ProgramCallDocument document = getDocument(); - - // Gather information from the return. - String jobNameUsed = (String)document.getValue(programName + ".receiverVariable.jobNameUsed", indices); - String userNameUsed = (String)document.getValue(programName + ".receiverVariable.userNameUsed", indices); - String jobNumberUsed = (String)document.getValue(programName + ".receiverVariable.jobNumberUsed", indices); - byte[] internalJobIdentifier = (byte[])document.getValue(programName + ".receiverVariable.internalJobIdentifier", indices); - String status = (String)document.getValue(programName + ".receiverVariable.status", indices); - String jobType = (String)document.getValue(programName + ".receiverVariable.jobType", indices); - String jobSubtype = (String)document.getValue(programName + ".receiverVariable.jobSubtype", indices); - - // Create a Job object. - AS400 system = getSystem(); - Object resourceKey = RJob.computeResourceKey(system, jobNameUsed, userNameUsed, jobNumberUsed, internalJobIdentifier); - RJob resource = (RJob)ResourcePool.GLOBAL_RESOURCE_POOL.getResource(resourceKey); - if (resource == null) { - try { - // We could instantiate the RJob with either the name/user/number - // combination or the internal job id. The internal job id is supposed - // to be faster, so I chose to use it. The name, user, and number - // can be retrieved using the attribute values initialized below. - resource = new RJob(system, internalJobIdentifier); - resource.setResourceKey(resourceKey); - resource.setName(jobNameUsed); - resource.setUser(userNameUsed); - resource.setNumber(jobNumberUsed); - resource.freezeProperties(); - } - catch(Exception e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Exception while creating user from user list", e); - throw new ResourceException(e); - } - } - - // Set the loaded attributes. - resource.initializeAttributeValue(RJob.INTERNAL_JOB_ID, internalJobIdentifier); - resource.initializeAttributeValue(RJob.JOB_NAME, jobNameUsed); - resource.initializeAttributeValue(RJob.USER_NAME, userNameUsed); - resource.initializeAttributeValue(RJob.JOB_NUMBER, jobNumberUsed); - resource.initializeAttributeValue(RJob.JOB_STATUS, status); - resource.initializeAttributeValue(RJob.JOB_TYPE, jobType); - resource.initializeAttributeValue(RJob.JOB_SUBTYPE, jobSubtype); - - return resource; - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/RJobList.pcml b/cvsroot/src/com/ibm/as400/resource/RJobList.pcml deleted file mode 100644 index 0ac558c15..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RJobList.pcml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/resource/RJobList16.gif b/cvsroot/src/com/ibm/as400/resource/RJobList16.gif deleted file mode 100644 index 37fa92633..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RJobList16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RJobList32.gif b/cvsroot/src/com/ibm/as400/resource/RJobList32.gif deleted file mode 100644 index 2765c4d95..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RJobList32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RJobListBeanInfo.java b/cvsroot/src/com/ibm/as400/resource/RJobListBeanInfo.java deleted file mode 100644 index b60df6e02..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RJobListBeanInfo.java +++ /dev/null @@ -1,132 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RJobListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Trace; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.util.ResourceBundle; - - - -/** -The RJobListBeanInfo class represents the bean information -for the RJobList class. -@deprecated Use com.ibm.as400.access.JobList instead. -**/ -public class RJobListBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final Class beanClass_ = RJobList.class; - - private static BeanInfo[] additionalBeanInfo_; - private static BeanDescriptor beanDescriptor_; - private static Image icon16_; - private static Image icon32_; - private static ResourceBundle resourceBundle_; - - - -/** -Static initializer. -**/ - static - { - try - { - // Set up the resource bundle. - resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.resource.ResourceMRI"); - - // Set up the additional bean info. - additionalBeanInfo_ = new BeanInfo[] { new ResourceListBeanInfo() }; - - // Set up the bean descriptor. - beanDescriptor_ = new BeanDescriptor(beanClass_); - - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error while loading bean info", e); - throw new Error(e.toString()); - } - } - - - -/** -Returns the additional bean information. - -@return The additional bean information. -**/ - public BeanInfo[] getAdditionalBeanInfo() - { - return additionalBeanInfo_; - } - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - - -/** -Returns the icon. - -@param icon The icon kind. Possible values are: -

        -
      • BeanInfo.ICON_MONO_16x16 -
      • BeanInfo.ICON_MONO_32x32 -
      • BeanInfo.ICON_COLOR_16x16 -
      • BeanInfo.ICON_COLOR_32x32 -
      -@return The icon. -**/ - public Image getIcon(int icon) - { - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - if (icon16_ == null) - icon16_ = loadImage("RJobList16.gif"); - return icon16_; - - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - if (icon32_ == null) - icon32_ = loadImage("RJobList32.gif"); - return icon32_; - - default: - throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/RJobLog.java b/cvsroot/src/com/ibm/as400/resource/RJobLog.java deleted file mode 100644 index c3b5404aa..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RJobLog.java +++ /dev/null @@ -1,841 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RJobLog.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.QSYSObjectPathName; -import com.ibm.as400.access.Trace; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.beans.PropertyVetoException; - - - -/** -The RJobLog class represents a job log. This is used -to get a list of messages in a job log or to write messages to a job log. -In order to access a job log, the system and either the job name, user name, -and job number or internal job identifier need to be set. A valid combination -of these must be set by getting any of the job log's messages. - - -

      If you do not specify any of the job name, user name, job number, -or internal job identifier, the default job is used. -The default job is the host server job for remote program calls. - - -

      The following selection IDs are supported: -

      - - -

      Use one or more of these selection IDs with -{@link com.ibm.as400.resource.ResourceList#getSelectionValue getSelectionValue()} -and {@link com.ibm.as400.resource.ResourceList#setSelectionValue setSelectionValue()} -to access the selection values for an RJobLog. - -

      RJobLog objects generate {@link com.ibm.as400.resource.RQueuedMessage RQueuedMessage} -objects. RQueuedMessage objects have many -attributes. Only some of theses attribute values are set, depending on how an RQueuedMessage -object is created. The following is a list of attribute IDs whose values are set on RQueuedMessage -objects returned in a list of job log messages: -

        -
      • {@link com.ibm.as400.resource.RQueuedMessage#DATE_SENT DATE_SENT} -
      • {@link com.ibm.as400.resource.RQueuedMessage#DEFAULT_REPLY DEFAULT_REPLY} -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_FILE MESSAGE_FILE} -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_HELP MESSAGE_HELP} -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_ID MESSAGE_ID} -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_KEY MESSAGE_KEY} -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_SEVERITY MESSAGE_SEVERITY} -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_TEXT MESSAGE_TEXT} -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_TYPE MESSAGE_TYPE} -
      • {@link com.ibm.as400.resource.RQueuedMessage#REPLY_STATUS REPLY_STATUS} -
      • {@link com.ibm.as400.resource.RQueuedMessage#SENDER_JOB_NAME SENDER_JOB_NAME} -
      • {@link com.ibm.as400.resource.RQueuedMessage#SENDER_JOB_NUMBER SENDER_JOB_NUMBER} -
      • {@link com.ibm.as400.resource.RQueuedMessage#SENDER_USER_NAME SENDER_USER_NAME} -
      • {@link com.ibm.as400.resource.RQueuedMessage#SENDING_PROGRAM_NAME SENDING_PROGRAM_NAME} -
      - -
      -// Create an RJobLog object to represent a specific job log.
      -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
      -RJobLog jobLog = new RJobLog(system, "AJOBNAME", "AUSERID", "AJOBNUMBER");
      -
      -// Set the selection so that the list of messages includes -// only the newest message. -jobLog.setSelectionValue(RJobLog.STARTING_MESSAGE_KEY, RJobLog.NEWEST); -
      -// Open the list and wait for it to complete. -jobLog.open(); -jobLog.waitForComplete(); -
      -// Read and print the messages in the list. -long numberOfMessages = jobLog.getListLength(); -for(long i = 0; i < numberOfMessages; ++i) -{ - RQueuedMessage queuedMessage = (RQueuedMessage)jobLog.resourceAt(i); - System.out.println(queueMessage.getAttributeValue(RQueuedMessage.MESSAGE_TEXT)); -} -
      -// Close the list. -jobLog.close(); -
      - -@deprecated Use -{@link com.ibm.as400.access.JobLog JobLog} instead, as this package may be removed in the future. -@see RQueuedMessage -**/ -public class RJobLog -extends SystemResourceList -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - -/** -Constant referring to the message key for the newest message in the job log. -**/ - public final static byte[] NEWEST = new byte[] { (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF }; - -/** -Constant referring to the next message in the job log. -**/ - public final static String NEXT = "*NEXT"; - -/** -Constant referring to the message key for the oldest message in the job log. -**/ - public final static byte[] OLDEST = new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 }; - -/** -Constant referring to the previous message in the job log. -**/ - public final static String PREVIOUS = "*PRV"; - - -//----------------------------------------------------------------------------------------- -// Private data. -//----------------------------------------------------------------------------------------- - - private static final String PRESENTATION_KEY_ = "JOB_LOG"; - private static final String ICON_BASE_NAME_ = "RJobLog"; - - private static PresentationLoader presentationLoader_ = new PresentationLoader("com.ibm.as400.resource.ResourceMRI"); - - -//----------------------------------------------------------------------------------------- -// Selection IDs. -// -// * If you add a selection here, make sure and add it to the class javadoc -// and in ResourceMRI.java. -//----------------------------------------------------------------------------------------- - - private static ResourceMetaDataTable selections_ = new ResourceMetaDataTable(presentationLoader_, PRESENTATION_KEY_); - private static ProgramMap selectionMap_ = new ProgramMap(); - -/** -Selection ID for list direction. This identifies a String selection, -which represents the direction to list messages relative to the values -specified for the {@link #STARTING_MESSAGE_KEY STARTING_MESSAGE_KEY} -selection. Possible values are: -
        -
      • {@link #NEXT NEXT} - - Returns messages that are newer than the messages specified for - the STARTING_MESSAGE_KEY selection. -
      • {@link #PREVIOUS PREVIOUS} - - Returns messages that are older than the messages specified for - the STARTING_MESSAGE_KEY selection. -
      -The default is NEXT. -**/ - public static final String LIST_DIRECTION = "LIST_DIRECTION"; - - static { - selections_.add(LIST_DIRECTION, String.class, false, - new String[] { NEXT, PREVIOUS }, NEXT, true); - selectionMap_.add(LIST_DIRECTION, null, "messageSelectionInformation.listDirection"); - } - -/** -Selection ID for starting message key. This identifies a byte[] selection, -which represents the message key used to begin searching for messages -to list from the corresponding entry in the message queue. Possible -values are: -
        -
      • {@link #OLDEST OLDEST} - - The first message to be returned is the oldest message in the queue. -
      • {@link #NEWEST NEWEST} - - The first message to be returned is the newest message in the queue. -
      • Any valid message key. -
      -The default is OLDEST. -**/ - public static final String STARTING_MESSAGE_KEY = "STARTING_MESSAGE_KEY"; - - static { - selections_.add(STARTING_MESSAGE_KEY, byte[].class, false, - new byte[][] { NEWEST, OLDEST }, OLDEST, false); - selectionMap_.add(STARTING_MESSAGE_KEY, null, "messageSelectionInformation.startingMessageKey"); - } - - - -//----------------------------------------------------------------------------------------- -// Open list attribute map. -// -// * If you add an attribute here, make sure and add it to the class javadoc. -//----------------------------------------------------------------------------------------- - - private static ProgramMap openListAttributeMap_ = new ProgramMap(); - private static final String openListProgramName_ = "qgyoljbl"; - - static { - openListAttributeMap_.add(RQueuedMessage.MESSAGE_SEVERITY, null, "receiverVariable.messageSeverity"); - openListAttributeMap_.add(RQueuedMessage.MESSAGE_ID, null, "receiverVariable.messageIdentifier"); - openListAttributeMap_.add(RQueuedMessage.MESSAGE_TYPE, null, "receiverVariable.messageType", new IntegerValueMap()); - openListAttributeMap_.add(RQueuedMessage.MESSAGE_KEY, null, "receiverVariable.messageKey"); - openListAttributeMap_.add(RQueuedMessage.MESSAGE_FILE, null, "receiverVariable.messageFile", new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "MSGF")); - openListAttributeMap_.add(RQueuedMessage.DATE_SENT, null, "receiverVariable.dateAndTimeSent", new DateValueMap(DateValueMap.FORMAT_13)); - openListAttributeMap_.add(RQueuedMessage.MESSAGE_TEXT, null, "receiverVariable.messageWithReplacementData.data"); - openListAttributeMap_.add(RQueuedMessage.SENDER_JOB_NAME, null, "receiverVariable.qualifiedSenderJobName.data", new SubstringValueMap(0, 10, true)); - openListAttributeMap_.add(RQueuedMessage.SENDER_JOB_NUMBER, null, "receiverVariable.qualifiedSenderJobName.data", new SubstringValueMap(20, 6, true)); - openListAttributeMap_.add(RQueuedMessage.SENDER_USER_NAME, null, "receiverVariable.qualifiedSenderJobName.data", new SubstringValueMap(10, 10, true)); - openListAttributeMap_.add(RQueuedMessage.SENDING_PROGRAM_NAME, null, "receiverVariable.sendingProgramName.data"); - openListAttributeMap_.add(RQueuedMessage.REPLY_STATUS, null, "receiverVariable.replyStatus.data"); - openListAttributeMap_.add(RQueuedMessage.DEFAULT_REPLY, null, "receiverVariable.defaultReply.data"); - openListAttributeMap_.add(RQueuedMessage.MESSAGE_HELP, null, "receiverVariable.messageHelpWithRDAndFC.data"); - } - - - -//----------------------------------------------------------------------------------------- -// PCML document initialization. -//----------------------------------------------------------------------------------------- - - private static final String DOCUMENT_NAME_ = "com.ibm.as400.resource.RJobLog"; - private static ProgramCallDocument staticDocument_ = null; - - static { - // Create a static version of the PCML document, then clone it for each document. - // This will improve performance, since we will only have to deserialize the PCML - // object once. - try { - staticDocument_ = new ProgramCallDocument(); - staticDocument_.setDocument(DOCUMENT_NAME_); - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error instantiating ProgramCallDocument", e); - } - } - - -//----------------------------------------------------------------------------------------- -// Private data. -//----------------------------------------------------------------------------------------- - - private static final String DEFAULT_MESSAGE_FILE_ = "/QSYS.LIB/QCPFMSG.MSGF"; - private static final byte[] EMPTY_BYTES_ = new byte[0]; - private static final byte[] BLANK_INTERNAL_JOB_ID_ = new byte[] { - (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, - (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, - (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, - (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40 - }; - - private byte[] internalJobID_ = null; - private String name_ = "*"; - private String number_ = ""; - private String user_ = ""; - - - -//----------------------------------------------------------------------------------------- -// Code. -//----------------------------------------------------------------------------------------- - -/** -Constructs an RJobLog object. -**/ - public RJobLog() - { - super(presentationLoader_.getPresentationWithIcon(PRESENTATION_KEY_, ICON_BASE_NAME_), - RQueuedMessage.attributes_, - selections_, - null, - openListProgramName_, - null, - selectionMap_); - - updatePresentation(); - } - - - -/** -Constructs an RJobLog object. - -@param system The system. -**/ - public RJobLog(AS400 system) - { - this(); - try { - setSystem(system); - } - catch(PropertyVetoException e) { - // Ignore. - } - } - - - -/** -Constructs an RJobLog object. - -@param system The system. -@param name The job name. Specify "*" to indicate the default job. -@param user The user name. This must be blank if name is "*". -@param number The job number. This must be blank if name is "*". -**/ - public RJobLog(AS400 system, - String name, - String user, - String number) - { - this(); - try { - setSystem(system); - setName(name); - setUser(user); - setNumber(number); - } - catch(PropertyVetoException e) { - // Ignore. - } - } - - - -/** -Constructs an RJobLog object. This sets the job name to "*INT". - -@param system The system. -@param internalJobID The internal job identifier. -**/ - public RJobLog(AS400 system, byte[] internalJobID) - { - this(); - - try { - setSystem(system); - setName("*INT"); - setInternalJobID(internalJobID); - } - catch(PropertyVetoException e) { - // Ignore. - - } - } - - - -/** -Establishes the connection to the system. - -

      The method is called by the resource framework automatically -when the connection needs to be established. - -@exception ResourceException If an error occurs. -**/ - protected void establishConnection() - throws ResourceException - { - // Validate if we can establish the connection. - if (internalJobID_ == null) { - if (!name_.equals("*")) { - if (number_.length() == 0) - throw new ExtendedIllegalStateException("number", ExtendedIllegalStateException.PROPERTY_NOT_SET); - if (user_.length() == 0) - throw new ExtendedIllegalStateException("user", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - - // Call the superclass. - super.establishConnection(); - - // Initialize the PCML document. - ProgramCallDocument document = (ProgramCallDocument)staticDocument_.clone(); - try { - if (internalJobID_ != null) { - document.setValue("qgyoljbl.messageSelectionInformation.internalJobIdentifier", internalJobID_); - document.setValue("qgyoljbl.messageSelectionInformation.qualifiedJobName.jobName", "*INT"); - } - else { - document.setValue("qgyoljbl.messageSelectionInformation.internalJobIdentifier", BLANK_INTERNAL_JOB_ID_); - document.setValue("qgyoljbl.messageSelectionInformation.qualifiedJobName.jobName", name_.toUpperCase()); - document.setValue("qgyoljbl.messageSelectionInformation.qualifiedJobName.jobNumber", number_.toUpperCase()); - document.setValue("qgyoljbl.messageSelectionInformation.qualifiedJobName.userName", user_.toUpperCase()); - } - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error setting path information in PCML document", e); - } - setDocument(document); - } - - - -/** -Returns the internal job identifier. - -@return The internal job identifier, or null if none has been set. -**/ - public byte[] getInternalJobID() - { - return internalJobID_; - } - - - - -/** -Returns the job name. - -@return The job name, or "*" if none has been set. -**/ - public String getName() - { - return name_; - } - - - -/** -Returns the job number. - -@return The job number, or "" if none has been set. -**/ - public String getNumber() - { - return number_; - } - - - -/** -Returns the user name. - -@return The user name, or "" if none has been set. -**/ - public String getUser() - { - return user_; - } - - - -/** -Sets the internal job identifier. The job name -must be set to "*INT" for this to be recognized. -This cannot be changed if the object has established -a connection to the system. - -@param internalJobID The internal job identifier. - -@exception PropertyVetoException If the property change is vetoed. -**/ - public void setInternalJobID(byte[] internalJobID) - throws PropertyVetoException - { - if (internalJobID == null) - throw new NullPointerException("internalJobID"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - byte[] oldValue = internalJobID_; - fireVetoableChange("internalJobID", oldValue, internalJobID); - internalJobID_ = internalJobID; - updatePresentation(); - firePropertyChange("internalJobID", oldValue, internalJobID); - } - - - -/** -Sets the job name. This cannot be changed -if the object has established a connection to the system. - -@param name The job name. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setName(String name) - throws PropertyVetoException - { - if (name == null) - throw new NullPointerException("name"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - String oldValue = name_; - fireVetoableChange("name", oldValue, name); - name_ = name; - updatePresentation(); - firePropertyChange("name", oldValue, name); - } - - - -/** -Sets the job number. This cannot be changed -if the object has established a connection to the system. - -@param number The job number. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setNumber(String number) - throws PropertyVetoException - { - if (number == null) - throw new NullPointerException("number"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - String oldValue = number_; - fireVetoableChange("number", oldValue, number); - number_ = number; - updatePresentation(); - firePropertyChange("number", oldValue, number); - } - - - -/** -Sets the user name. This cannot be changed -if the object has established a connection to the system. - -@param user The user name. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setUser(String user) - throws PropertyVetoException - { - if (user == null) - throw new NullPointerException("user"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - String oldValue = user_; - fireVetoableChange("user", oldValue, user); - user_ = user; - updatePresentation(); - firePropertyChange("user", oldValue, user); - } - - - -/** -Updates the presentation object for this job log based on the job name, -user name, and job number. This should be called whenever any of these -characteristics change. -**/ - private void updatePresentation() - { - Presentation presentation = getPresentation(); - presentation.setName(name_); - - StringBuffer fullName = new StringBuffer(); - fullName.append(number_); - fullName.append('/'); - fullName.append(user_); - fullName.append('/'); - fullName.append(name_); - presentation.setFullName(fullName.toString()); - } - - -/** -Writes a program message to the job log for the job in which the program is running. -
      Note: The program runs in the job of the Remote Command Host Server (QZRCSRVS) unless it is invoked "on-thread" on the i5/OS system. - -@param system The system. If the system specifies localhost, the message is written - to the job log of the process from which this method is called. - Otherwise the message is written to the QZRCSRVS job. -@param messageID The message ID. The message must be in the default message file - /QSYS.LIB/QCPFMSG.MSGF. -@param messageType The message type. Possible values are: -

        -
      • {@link com.ibm.as400.access.AS400Message#COMPLETION AS400Message.COMPLETION } -
      • {@link com.ibm.as400.access.AS400Message#DIAGNOSTIC AS400Message.DIAGNOSTIC } -
      • {@link com.ibm.as400.access.AS400Message#INFORMATIONAL AS400Message.INFORMATIONAL } -
      • {@link com.ibm.as400.access.AS400Message#ESCAPE AS400Message.ESCAPE } -
      - The message type must be AS400Message.INFORMATIONAL for an immediate - message. -@see com.ibm.as400.access.ProgramCall#isStayOnThread() - -@exception ResourceException If an error occurs. -**/ - public static void writeMessage(AS400 system, - String messageID, - int messageType) - throws ResourceException - { - writeMessage(system, messageID, messageType, DEFAULT_MESSAGE_FILE_, null); - } - - - -/** -Writes a program message to the job log for the job in which the program is running. -
      Note: The program runs in the job of the Remote Command Host Server (QZRCSRVS) unless it is invoked "on-thread" on the i5/OS system. - -@param system The system. If the system specifies localhost, the message is written - to the job log of the process from which this method is called. - Otherwise the message is written to the QZRCSRVS job. -@param messageID The message ID. The message must be in the default message file - /QSYS.LIB/QCPFMSG.MSGF. -@param messageType The message type. Possible values are: -
        -
      • {@link com.ibm.as400.access.AS400Message#COMPLETION AS400Message.COMPLETION } -
      • {@link com.ibm.as400.access.AS400Message#DIAGNOSTIC AS400Message.DIAGNOSTIC } -
      • {@link com.ibm.as400.access.AS400Message#INFORMATIONAL AS400Message.INFORMATIONAL } -
      • {@link com.ibm.as400.access.AS400Message#ESCAPE AS400Message.ESCAPE } -
      - The message type must be AS400Message.INFORMATIONAL for an immediate - message. -@param substitutionData The substitution data. The substitution data can be from 0-32767 bytes - for a conventional message and from 1-6000 bytes for an immediate message. -@see com.ibm.as400.access.ProgramCall#isStayOnThread() - -@exception ResourceException If an error occurs. -**/ - public static void writeMessage(AS400 system, - String messageID, - int messageType, - byte[] substitutionData) - throws ResourceException - { - writeMessage(system, messageID, messageType, DEFAULT_MESSAGE_FILE_, substitutionData); - } - - - -/** -Writes a program message to the job log for the job in which the program is running. -
      Note: The program runs in the job of the Remote Command Host Server (QZRCSRVS) unless it is invoked "on-thread" on the i5/OS system. - -@param system The system. If the system specifies localhost, the message is written - to the job log of the process from which this method is called. - Otherwise the message is written to the QZRCSRVS job. -@param messageID The message ID. -@param messageType The message type. Possible values are: -
        -
      • {@link com.ibm.as400.access.AS400Message#COMPLETION AS400Message.COMPLETION } -
      • {@link com.ibm.as400.access.AS400Message#DIAGNOSTIC AS400Message.DIAGNOSTIC } -
      • {@link com.ibm.as400.access.AS400Message#INFORMATIONAL AS400Message.INFORMATIONAL } -
      • {@link com.ibm.as400.access.AS400Message#ESCAPE AS400Message.ESCAPE } -
      - The message type must be AS400Message.INFORMATIONAL for an immediate - message. -@param messageFile The integrated file system path name of the message file. -@see com.ibm.as400.access.ProgramCall#isStayOnThread() - -@exception ResourceException If an error occurs. -**/ - public static void writeMessage(AS400 system, - String messageID, - int messageType, - String messageFile) - throws ResourceException - { - writeMessage(system, messageID, messageType, messageFile, null); - } - - - -/** -Writes a program message to the job log for the job in which the program is running. -
      Note: The program runs in the job of the Remote Command Host Server (QZRCSRVS) unless it is invoked "on-thread" on the i5/OS system. - -@param system The system. If the system specifies localhost, the message is written - to the job log of the process from which this method is called. - Otherwise the message is written to the QZRCSRVS job. -@param messageID The message ID. -@param messageType The message type. Possible values are: -
        -
      • {@link com.ibm.as400.access.AS400Message#COMPLETION AS400Message.COMPLETION } -
      • {@link com.ibm.as400.access.AS400Message#DIAGNOSTIC AS400Message.DIAGNOSTIC } -
      • {@link com.ibm.as400.access.AS400Message#INFORMATIONAL AS400Message.INFORMATIONAL } -
      • {@link com.ibm.as400.access.AS400Message#ESCAPE AS400Message.ESCAPE } -
      - The message type must be AS400Message.INFORMATIONAL for an immediate - message. -@param messageFile The integrated file system path name of the message file. -@param substitutionData The substitution data. The substitution data can be from 0-32767 bytes - for a conventional message and from 1-6000 bytes for an immediate message. -@see com.ibm.as400.access.ProgramCall#isStayOnThread() - -@exception ResourceException If an error occurs. -**/ - public static void writeMessage(AS400 system, - String messageID, - int messageType, - String messageFile, - byte[] substitutionData) - throws ResourceException - { - // Validate the parameters. - if (system == null) - throw new NullPointerException("system"); - if (messageID == null) - throw new NullPointerException("messageID"); - - String messageTypeAsString = null; - switch(messageType) { - case AS400Message.COMPLETION: - messageTypeAsString = "*COMP"; - break; - case AS400Message.DIAGNOSTIC: - messageTypeAsString = "*DIAG"; - break; - case AS400Message.INFORMATIONAL: - messageTypeAsString = "*INFO"; - break; - case AS400Message.ESCAPE: - messageTypeAsString = "*ESCAPE"; - break; - default: - throw new ExtendedIllegalArgumentException("messageType", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (messageFile == null) - throw new NullPointerException("messageFile"); - else if (messageFile.length() == 0) - throw new ExtendedIllegalArgumentException("messageFile", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - // Set the input parameters and call the API. - try { - ProgramCallDocument document = (ProgramCallDocument)staticDocument_.clone(); - document.setSystem(system); - document.setValue("qmhsndpm.messageID", messageID); - - QSYSObjectPathName messageFilePathName = new QSYSObjectPathName(messageFile); - document.setValue("qmhsndpm.qualifiedMessageFileName.objectName", messageFilePathName.getObjectName()); - document.setValue("qmhsndpm.qualifiedMessageFileName.libraryName", messageFilePathName.getLibraryName()); - - if (substitutionData == null) { - document.setIntValue("qmhsndpm.lengthOfMessageDataOrImmediateText", 0); - document.setValue("qmhsndpm.messageDataOrImmediateText", ""); - } - else { - document.setIntValue("qmhsndpm.lengthOfMessageDataOrImmediateText", substitutionData.length); - document.setValue("qmhsndpm.messageDataOrImmediateText", substitutionData); - } - - document.setValue("qmhsndpm.messageType", messageTypeAsString); - - if (document.callProgram("qmhsndpm") == false) { // @A1C - - // If only one message came back, and it is the one that we sent, @A1A - // then do not throw an exception. @A1A - AS400Message[] messageList = document.getMessageList("qmhsndpm"); // @A1A - if (messageList.length == 1) { // @A1A - if ((messageList[0].getID().equals(messageID)) // @A1A - && (messageList[0].getType() == messageType)) { // @A1A - if (Trace.isTraceOn()) // @A1A - Trace.log(Trace.INFORMATION, "False escape message ignored."); // @A1A - return; // @A1A - } // @A1A - } // @A1A - - throw new ResourceException(messageList); // @A1C - } // @A1A - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error when writing a message", e); - throw new ResourceException(e); - } - } - - - -//----------------------------------------------------------------------------------------- -// List implementation. -//----------------------------------------------------------------------------------------- - - Resource newResource(String programName, int[] indices) - throws PcmlException, ResourceException - { - AS400 system = getSystem(); - ProgramCallDocument document = getDocument(); - - // Create the resource object. - byte[] messageKey = (byte[])document.getValue(programName + ".receiverVariable.messageKey", indices); - String jobLogName = RJobLog.this.toString(); - Object resourceKey = RQueuedMessage.computeResourceKey(system, jobLogName, messageKey); - RQueuedMessage rQueuedMessage = (RQueuedMessage)ResourcePool.GLOBAL_RESOURCE_POOL.getResource(resourceKey); - if (rQueuedMessage == null) { - rQueuedMessage = new RQueuedMessage(); - rQueuedMessage.setResourceKey(resourceKey); - } - - // Copy the information from the API record to the QueuedMessage attributes. - Object[] attributeIDs = openListAttributeMap_.getIDs(); - Object[] values = openListAttributeMap_.getValues(attributeIDs, system, document, programName, indices); - for(int i = 0; i < values.length; ++i) - rQueuedMessage.initializeAttributeValue(attributeIDs[i], values[i]); - - // Set the presentation information. - // The name is in the format: MessageId(MessageKey) - // The full name is in the format: JobNumber/UserName/JobName-MessageId(MessageKey) - StringBuffer name = new StringBuffer(); - name.append((String)rQueuedMessage.getAttributeValue(RQueuedMessage.MESSAGE_ID)); - name.append('('); - name.append(Presentation.bytesToHex((byte[])rQueuedMessage.getAttributeValue(RQueuedMessage.MESSAGE_KEY))); - name.append(')'); - - StringBuffer fullName = new StringBuffer(); - fullName.append(jobLogName); - fullName.append('-'); - fullName.append(name.toString()); - - Presentation presentation = rQueuedMessage.getPresentation(); - presentation.setName(name.toString()); - presentation.setFullName(fullName.toString()); - presentation.setValue(Presentation.DESCRIPTION_TEXT, rQueuedMessage.getAttributeValue(RQueuedMessage.MESSAGE_TEXT)); - presentation.setValue(Presentation.HELP_TEXT, rQueuedMessage.getAttributeValue(RQueuedMessage.MESSAGE_HELP)); - - return rQueuedMessage; - } - - - } - - diff --git a/cvsroot/src/com/ibm/as400/resource/RJobLog.pcml b/cvsroot/src/com/ibm/as400/resource/RJobLog.pcml deleted file mode 100644 index 553e7aba6..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RJobLog.pcml +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/resource/RJobLog16.gif b/cvsroot/src/com/ibm/as400/resource/RJobLog16.gif deleted file mode 100644 index 73d0723bd..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RJobLog16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RJobLog32.gif b/cvsroot/src/com/ibm/as400/resource/RJobLog32.gif deleted file mode 100644 index 447b5f9fe..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RJobLog32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RJobLogBeanInfo.java b/cvsroot/src/com/ibm/as400/resource/RJobLogBeanInfo.java deleted file mode 100644 index 95268d719..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RJobLogBeanInfo.java +++ /dev/null @@ -1,167 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RJobLogBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Trace; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.util.ResourceBundle; - - - -/** -The RJobLogBeanInfo class represents the bean information -for the RJobLog class. -@deprecated Use com.ibm.as400.access.JobLog instead. -**/ -public class RJobLogBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final Class beanClass_ = RJobLog.class; - - private static BeanInfo[] additionalBeanInfo_; - private static BeanDescriptor beanDescriptor_; - private static Image icon16_; - private static Image icon32_; - private static PropertyDescriptor[] propertyDescriptors_; - private static ResourceBundle resourceBundle_; - - - -/** -Static initializer. -**/ - static - { - try - { - // Set up the resource bundle. - resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.resource.ResourceMRI"); - - // Set up the additional bean info. - additionalBeanInfo_ = new BeanInfo[] { new ResourceListBeanInfo() }; - - // Set up the bean descriptor. - beanDescriptor_ = new BeanDescriptor(beanClass_); - - // Set up the property descriptors. - PropertyDescriptor name = new PropertyDescriptor("name", beanClass_); - name.setBound(true); - name.setConstrained(true); - name.setDisplayName(resourceBundle_.getString("PROPERTY_NAME_NAME")); - name.setShortDescription(resourceBundle_.getString("PROPERTY_NAME_DESCRIPTION")); - - PropertyDescriptor number = new PropertyDescriptor("number", beanClass_); - number.setBound(true); - number.setConstrained(true); - number.setDisplayName(resourceBundle_.getString("PROPERTY_NUMBER_NAME")); - number.setShortDescription(resourceBundle_.getString("PROPERTY_NUMBER_DESCRIPTION")); - - PropertyDescriptor user = new PropertyDescriptor("user", beanClass_); - user.setBound(true); - user.setConstrained(true); - user.setDisplayName(resourceBundle_.getString("PROPERTY_USER_NAME")); - user.setShortDescription(resourceBundle_.getString("PROPERTY_USER_DESCRIPTION")); - - propertyDescriptors_ = new PropertyDescriptor[] { name, number, user }; - - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error while loading bean info", e); - throw new Error(e.toString()); - } - } - - - -/** -Returns the additional bean information. - -@return The additional bean information. -**/ - public BeanInfo[] getAdditionalBeanInfo() - { - return additionalBeanInfo_; - } - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - - -/** -Returns the property descriptors. - -@return The property descriptors. -**/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors_; - } - - - -/** -Returns the icon. - -@param icon The icon kind. Possible values are: -
        -
      • BeanInfo.ICON_MONO_16x16 -
      • BeanInfo.ICON_MONO_32x32 -
      • BeanInfo.ICON_COLOR_16x16 -
      • BeanInfo.ICON_COLOR_32x32 -
      -@return The icon. -**/ - public Image getIcon(int icon) - { - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - if (icon16_ == null) - icon16_ = loadImage("RJobLog16.gif"); - return icon16_; - - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - if (icon32_ == null) - icon32_ = loadImage("RJobLog32.gif"); - return icon32_; - - default: - throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/RMessageQueue.java b/cvsroot/src/com/ibm/as400/resource/RMessageQueue.java deleted file mode 100644 index 8333bf2b0..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RMessageQueue.java +++ /dev/null @@ -1,1469 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RMessageQueue.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.CharConverter; -import com.ibm.as400.access.QSYSObjectPathName; -import com.ibm.as400.access.Trace; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.beans.PropertyVetoException; -import java.io.UnsupportedEncodingException; - - - -/** -The RMessageQueue class represents a message queue. If no message -queue path is set, then the default is {@link #CURRENT CURRENT}, -which represents the current user's message queue, -
      /QSYS.LIB/QUSRSYS.LIB/userID.MSGQ
      . - -

      The following selection IDs are supported: -

        -
      • {@link #FORMATTING_CHARACTERS FORMATTING_CHARACTERS} -
      • {@link #LIST_DIRECTION LIST_DIRECTION} -
      • {@link #REPLACEMENT_DATA REPLACEMENT_DATA} -
      • {@link #SELECTION_CRITERIA SELECTION_CRITERIA} -
      • {@link #SEVERITY_CRITERIA SEVERITY_CRITERIA} -
      • {@link #SORT_CRITERIA SORT_CRITERIA} -
      • {@link #STARTING_USER_MESSAGE_KEY STARTING_USER_MESSAGE_KEY} -
      • {@link #STARTING_WORKSTATION_MESSAGE_KEY STARTING_WORKSTATION_MESSAGE_KEY} -
      -
      - -

      Use one or more of these selection IDs with -{@link com.ibm.as400.resource.ResourceList#getSelectionValue getSelectionValue()} -and {@link com.ibm.as400.resource.ResourceList#setSelectionValue setSelectionValue()} -to access the selection values for an RMessageQueue. - -

      RMessageQueue objects generate {@link com.ibm.as400.resource.RQueuedMessage RQueuedMessage} -objects. RQueuedMessage objects have many -attributes. Only some of these attribute values are set, depending on how an RQueuedMessage -object is created. The following is a list of attribute IDs whose values are set on RQueuedMessage -objects returned in a list of messages: -

        -
      • {@link com.ibm.as400.resource.RQueuedMessage#DATE_SENT DATE_SENT } -
      • {@link com.ibm.as400.resource.RQueuedMessage#DEFAULT_REPLY DEFAULT_REPLY } -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_FILE MESSAGE_FILE } -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_HELP MESSAGE_HELP } -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_ID MESSAGE_ID } -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_KEY MESSAGE_KEY } -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_QUEUE MESSAGE_QUEUE } -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_SEVERITY MESSAGE_SEVERITY } -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_TEXT MESSAGE_TEXT } -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_TYPE MESSAGE_TYPE } -
      • {@link com.ibm.as400.resource.RQueuedMessage#REPLY_STATUS REPLY_STATUS } -
      • {@link com.ibm.as400.resource.RQueuedMessage#SENDER_JOB_NAME SENDER_JOB_NAME } -
      • {@link com.ibm.as400.resource.RQueuedMessage#SENDER_JOB_NUMBER SENDER_JOB_NUMBER } -
      • {@link com.ibm.as400.resource.RQueuedMessage#SENDER_USER_NAME SENDER_USER_NAME } -
      • {@link com.ibm.as400.resource.RQueuedMessage#SENDING_PROGRAM_NAME SENDING_PROGRAM_NAME } -
      - - -

      The following is a list of attribute IDs whose values are set on -objects returned by {@link #receive receive()}: -

        -
      • {@link com.ibm.as400.resource.RQueuedMessage#ALERT_OPTION ALERT_OPTION } -
      • {@link com.ibm.as400.resource.RQueuedMessage#DATE_SENT DATE_SENT } -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_FILE MESSAGE_FILE } -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_HELP MESSAGE_HELP } -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_ID MESSAGE_ID } -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_KEY MESSAGE_KEY } -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_SEVERITY MESSAGE_SEVERITY } -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_TEXT MESSAGE_TEXT } -
      • {@link com.ibm.as400.resource.RQueuedMessage#MESSAGE_TYPE MESSAGE_TYPE } -
      • {@link com.ibm.as400.resource.RQueuedMessage#SENDER_JOB_NAME SENDER_JOB_NAME } -
      • {@link com.ibm.as400.resource.RQueuedMessage#SENDER_JOB_NUMBER SENDER_JOB_NUMBER } -
      • {@link com.ibm.as400.resource.RQueuedMessage#SENDER_USER_NAME SENDER_USER_NAME } -
      • {@link com.ibm.as400.resource.RQueuedMessage#SENDING_PROGRAM_NAME SENDING_PROGRAM_NAME } -
      • {@link com.ibm.as400.resource.RQueuedMessage#SUBSTITUTION_DATA SUBSTITUTION_DATA } -
      -
      - -
      -// Create an RMessageQueue object to represent a specific message queue.
      -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
      -RMessageQueue messageQueue = new RMessageQueue(system, "/QSYS.LIB/MYLIB.LIB/MYMSGQ.MSG");
      -
      -// Set the selection so that the list of messages includes -// only messages that need a reply. -messageQueue.setSelectionValue(RMessageQueue.SELECTION_CRITERIA, RMessageQueue.MESSAGES_NEED_REPLY); -
      -// Open the list and wait for it to complete. -messageQueue.open(); -messageQueue.waitForComplete(); -
      -// Read and print the messages in the list. -long numberOfMessages = messageQueue.getListLength(); -for(long i = 0; i < numberOfMessages; ++i) -{ - RQueuedMessage queuedMessage = (RQueuedMessage)messageQueue.resourceAt(i); - System.out.println(queuedMessage.getAttributeValue(RQueuedMessage.MESSAGE_TEXT)); -} -
      -// Close the list. -messageQueue.close(); -
      - -@deprecated Use -{@link com.ibm.as400.access.MessageQueue MessageQueue} instead, as this package may be removed in the future. -@see RQueuedMessage -**/ -public class RMessageQueue -extends SystemResourceList -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - static final long serialVersionUID = 4L; - - - -//----------------------------------------------------------------------------------------- -// Presentation. -//----------------------------------------------------------------------------------------- - - private static final String PRESENTATION_KEY_ = "MESSAGE_QUEUE"; - private static final String ICON_BASE_NAME_ = "RMessageQueue"; - private static PresentationLoader presentationLoader_ = new PresentationLoader("com.ibm.as400.resource.ResourceMRI"); - - - -//----------------------------------------------------------------------------------------- -// Message types. -//----------------------------------------------------------------------------------------- - -/** -Constant referring to all messages in the message queue. -**/ - public final static String ALL = "*ALL"; - -/** -Constant referring to any message in the message queue. -**/ - public final static String ANY = "*ANY"; - -/** -Constant referring to a message identified by a key. -**/ - public final static String BYKEY = "*BYKEY"; - -/** -Constant referring to completion messages. -**/ - public final static String COMPLETION = "*COMP"; - -/** -Constant referring to the sender's copy of a previously sent -inquiry message. -**/ - public final static String COPY = "*COPY"; - -/** -Constant referring to the current user's message queue. -**/ - public final static String CURRENT = "*CURRENT"; - -/** -Constant referring to diagnostic messages. -**/ - public final static String DIAGNOSTIC = "*DIAG"; - -/** -Constant referring to the first message in the message queue. -**/ - public final static String FIRST = "*FIRST"; - -/** -Constant referring to informational messages. -**/ - public final static String INFORMATIONAL = "*INFO"; - -/** -Constant referring to inquiry messages. -**/ - public final static String INQUIRY = "*INQ"; - -/** -Constant referring to all messages in the message queue -except unanswered inquiry and unanswered senders' copy messages. -**/ - public final static String KEEP_UNANSWERED = "*KEEPUNANS"; - -/** -Constant referring to the last message in the message queue. -**/ - public final static String LAST = "*LAST"; - -/** -Constant referring to messages that need a reply. -**/ - public final static String MESSAGES_NEED_REPLY = "*MNR"; - -/** -Constant referring to messages that do not need a reply. -**/ - public final static String MESSAGES_NO_NEED_REPLY = "*MNNR"; - -/** -Constant referring to all new messages in the message queue. -New messages are those that have not been received. -**/ - public final static String NEW = "*NEW"; - -/** -Constant referring to the message key for the newest message in the queue. -**/ - public final static byte[] NEWEST = new byte[] { (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF }; - -/** -Constant referring to the next message in the message queue. -**/ - public final static String NEXT = "*NEXT"; - -/** -Constant referring to all old messages in the message queue. -Old messages are those that have already been received. -**/ - public final static String OLD = "*OLD"; - -/** -Constant referring to the message key for the oldest message in the queue. -**/ - public final static byte[] OLDEST = new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 }; - -/** -Constant referring to the previous message in the message queue. -**/ - public final static String PREVIOUS = "*PRV"; - -/** -Constant indicating that the message should be removed from -the message queue. -**/ - public final static String REMOVE = "*REMOVE"; - -/** -Constant referring to the reply to an inquiry message. -**/ - public final static String REPLY = "*RPY"; // @C1 - -/** -Constant indicating that the message should remain in the -message queue without changing its new or old designation. -**/ - public final static String SAME = "*SAME"; - -/** -Constant referring to the sender's copies of messages that -need replies. -**/ - public final static String SENDERS_COPY_NEED_REPLY = "*SCNR"; - - - -//----------------------------------------------------------------------------------------- -// Message types. -//----------------------------------------------------------------------------------------- - -/** -Constant indicating that message help text is not formatted. -**/ - public final static Integer NO_FORMATTING = new Integer(com.ibm.as400.access.MessageFile.NO_FORMATTING); - -/** -Constant indicating that message help text includes formatting characters. -**/ - public final static Integer RETURN_FORMATTING_CHARACTERS = new Integer(com.ibm.as400.access.MessageFile.RETURN_FORMATTING_CHARACTERS); - -/** -Constant indicating that message help text is formatted. -**/ - public final static Integer SUBSTITUTE_FORMATTING_CHARACTERS = new Integer(com.ibm.as400.access.MessageFile.SUBSTITUTE_FORMATTING_CHARACTERS); - - - -//----------------------------------------------------------------------------------------- -// Selection IDs. -// -// * If you add a selection here, make sure and add it to the class javadoc -// and in ResourceMRI.java. -//----------------------------------------------------------------------------------------- - - private static ResourceMetaDataTable selections_ = new ResourceMetaDataTable(presentationLoader_, PRESENTATION_KEY_); - private static ProgramMap selectionMap_ = new ProgramMap(); - -/** -Selection ID for formatting characters. This identifies a Integer selection, -which represents the type of message help text formatting. Possible values are: -
        -
      • {@link #NO_FORMATTING NO_FORMATTING} - - Message help text is not formatted. -
      • {@link #RETURN_FORMATTING_CHARACTERS RETURN_FORMATTING_CHARACTERS} - - Message help text includes formatting characters. -
      • {@link #SUBSTITUTE_FORMATTING_CHARACTERS SUBSTITUTE_FORMATTING_CHARACTERS} - - Message help text is formatted. -
      -The default is NO_FORMATTING. -**/ - public static final String FORMATTING_CHARACTERS = "FORMATTING_CHARACTERS"; - - static { - selections_.add(FORMATTING_CHARACTERS, Integer.class, false, - new Integer[] { NO_FORMATTING, - RETURN_FORMATTING_CHARACTERS, - SUBSTITUTE_FORMATTING_CHARACTERS }, NO_FORMATTING, true); - } - -/** -Selection ID for list direction. This identifies a String selection, -which represents the direction to list messages relative to the values -specified for the {@link #STARTING_USER_MESSAGE_KEY STARTING_USER_MESSAGE_KEY} -and {@link #STARTING_WORKSTATION_MESSAGE_KEY STARTING_WORKSTATION_MESSAGE_KEY} -selections. Possible values are: -
        -
      • {@link #NEXT NEXT} - - Returns messages that are newer than the messages specified for - the STARTING_USER_MESSAGE_KEY and STARTING_WORKSTATION_MESSAGE_KEY - selections. -
      • {@link #PREVIOUS PREVIOUS} - - Returns messages that are older than the messages specified for - the STARTING_USER_MESSAGE_KEY and STARTING_WORKSTATION_MESSAGE_KEY - selections. -
      -The default is NEXT. -**/ - public static final String LIST_DIRECTION = "LIST_DIRECTION"; - - static { - selections_.add(LIST_DIRECTION, String.class, false, - new String[] { NEXT, PREVIOUS }, NEXT, true); - selectionMap_.add(LIST_DIRECTION, null, "messageSelectionInformation.listDirection"); - } - -/** -Selection ID for replacement data. This identifies a Boolean selection, -which indicates whether to replace substitution data in message text. -The default is true. -**/ - public static final String REPLACEMENT_DATA = "REPLACEMENT_DATA"; - - static { - selections_.add(REPLACEMENT_DATA, Boolean.class, false, - null, Boolean.TRUE, false); - } - -/** -Selection ID for selection criteria. This identifies a String selection, -which represents the type of messages to be listed. Possible values are: -
        -
      • {@link #ALL ALL} - - All messages are listed. -
      • {@link #MESSAGES_NEED_REPLY MESSAGES_NEED_REPLY} - - Only messages that need a reply are listed. -
      • {@link #SENDERS_COPY_NEED_REPLY SENDERS_COPY_NEED_REPLY} - - Only the sender's copy messages that need a reply are listed. -
      • {@link #MESSAGES_NO_NEED_REPLY MESSAGES_NO_NEED_REPLY} - - Only messages that do not need a reply are listed. -
      -The default is ALL. -**/ - public static final String SELECTION_CRITERIA = "SELECTION_CRITERIA"; - - static { - selections_.add(SELECTION_CRITERIA, String.class, false, - new String[] { ALL, - MESSAGES_NEED_REPLY, - SENDERS_COPY_NEED_REPLY, - MESSAGES_NO_NEED_REPLY }, ALL, true); - selectionMap_.add(SELECTION_CRITERIA, null, "messageSelectionInformation.selectionCriteria"); - } - -/** -Selection ID for severity criteria. This identifies an Integer selection, -which represents the minimum severity of a message to be included in the -list. The value must be in the range 0 to 99. The default is 0. -**/ - public static final String SEVERITY_CRITERIA = "SEVERITY_CRITERIA"; - - static { - selections_.add(SEVERITY_CRITERIA, Integer.class, false, - null, new Integer(0), false); - selectionMap_.add(SEVERITY_CRITERIA, null, "messageSelectionInformation.severityCriteria"); - } - -/** -Selection ID for sort criteria. This identifies a Boolean selection, -which indicates whether the list should be sorted by type if the -{@link #SELECTION_CRITERIA SELECTION_CRITERIA} selection is -set to {@link #ALL ALL}. The default is false. -**/ - public static final String SORT_CRITERIA = "SORT_CRITERIA"; - - static { - selections_.add(SORT_CRITERIA, Boolean.class, false, - null, Boolean.FALSE, false); - selectionMap_.add(SORT_CRITERIA, null, "sortInformation", new BooleanValueMap("0", "1")); - } - -/** -Selection ID for starting user message key. This identifies a byte[] selection, -which represents the message key used to begin searching for messages -to list from the corresponding entry in the message queue. If the message queue -path name is set to {@link #CURRENT CURRENT}, then this selection represents -the starting message key for the current user's user message queue. Possible -values are: -
        -
      • {@link #OLDEST OLDEST} - - The first message to be returned is the oldest message in the queue. -
      • {@link #NEWEST NEWEST} - - The first message to be returned is the newest message in the queue. -
      • Any valid message key. -
      -The default is OLDEST. - -

      If a value other than {@link #OLDEST OLDEST} or {@link #NEWEST NEWEST} -is specified and a message with that key does not exist, an exception is thrown. -If the key of a reply message is specified, the message search begins with the -inquiry or sender's copy message that the reply with associated with, not the reply -message itself. -**/ - public static final String STARTING_USER_MESSAGE_KEY = "STARTING_USER_MESSAGE_KEY"; - - static { - selections_.add(STARTING_USER_MESSAGE_KEY, byte[].class, false, - new byte[][] { NEWEST, OLDEST }, OLDEST, false); - selectionMap_.add(STARTING_USER_MESSAGE_KEY, null, "messageSelectionInformation.startingMessageKeys", new int[] { 0 }); - } - -/** -Selection ID for starting workstation message key. This identifies a byte[] selection, -which represents the message key used to begin searching for messages -to list from the corresponding entry in the message queue. If the message queue -path name is set to {@link #CURRENT CURRENT}, then this selection represents -the starting message key for the current user's workstation message queue. Otherwise, -this selection has no effect. Possible values are: -

        -
      • {@link #OLDEST OLDEST} - - The first message to be returned is the oldest message in the queue. -
      • {@link #NEWEST NEWEST} - - The first message to be returned is the newest message in the queue. -
      • Any valid message key. -
      -The default is OLDEST. - -

      If a value other than {@link #OLDEST OLDEST} or {@link #NEWEST NEWEST} -is specified and a message with that key does not exist, an exception is thrown. -If the key of a reply message is specified, the message search begins with the -inquiry or sender's copy message that the reply with associated with, not the reply -message itself. -**/ - public static final String STARTING_WORKSTATION_MESSAGE_KEY = "STARTING_WORKSTATION_MESSAGE_KEY"; - - static { - selections_.add(STARTING_WORKSTATION_MESSAGE_KEY, byte[].class, false, - new byte[][] { NEWEST, OLDEST }, OLDEST, false); - selectionMap_.add(STARTING_WORKSTATION_MESSAGE_KEY, null, "messageSelectionInformation.startingMessageKeys", new int[] { 1 }); - } - - - -//----------------------------------------------------------------------------------------- -// Open list attribute map. -// -// * If you add an attribute here, make sure and add it to the class javadoc. -//----------------------------------------------------------------------------------------- - - private static ProgramMap openListAttributeMap_ = new ProgramMap(); - private static final String openListProgramName_ = "qgyolmsg"; - - static { - openListAttributeMap_.add(RQueuedMessage.MESSAGE_SEVERITY, null, "receiverVariable.messageSeverity"); - openListAttributeMap_.add(RQueuedMessage.MESSAGE_ID, null, "receiverVariable.messageIdentifier"); - openListAttributeMap_.add(RQueuedMessage.MESSAGE_TYPE, null, "receiverVariable.messageType", new IntegerValueMap()); - openListAttributeMap_.add(RQueuedMessage.MESSAGE_KEY, null, "receiverVariable.messageKey"); - openListAttributeMap_.add(RQueuedMessage.MESSAGE_QUEUE, null, "receiverVariable.messageQueue", new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "MSGQ")); - openListAttributeMap_.add(RQueuedMessage.MESSAGE_FILE, null, "receiverVariable.messageFile", new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "MSGF")); // @A2A - openListAttributeMap_.add(RQueuedMessage.DATE_SENT, null, "receiverVariable.dateAndTimeSent", new DateValueMap(DateValueMap.FORMAT_13)); - openListAttributeMap_.add(RQueuedMessage.MESSAGE_TEXT, null, "receiverVariable.message.data"); - openListAttributeMap_.add(RQueuedMessage.SENDER_JOB_NAME, null, "receiverVariable.qualifiedSenderJobName.data", new SubstringValueMap(0, 10, true)); - openListAttributeMap_.add(RQueuedMessage.SENDER_JOB_NUMBER, null, "receiverVariable.qualifiedSenderJobName.data", new SubstringValueMap(20, 6, true)); - openListAttributeMap_.add(RQueuedMessage.SENDER_USER_NAME, null, "receiverVariable.qualifiedSenderJobName.data", new SubstringValueMap(10, 10, true)); - openListAttributeMap_.add(RQueuedMessage.SENDING_PROGRAM_NAME, null, "receiverVariable.sendingProgramName.data"); - openListAttributeMap_.add(RQueuedMessage.REPLY_STATUS, null, "receiverVariable.replyStatus.data"); - openListAttributeMap_.add(RQueuedMessage.DEFAULT_REPLY, null, "receiverVariable.defaultReply.data"); - openListAttributeMap_.add(RQueuedMessage.MESSAGE_HELP, null, "receiverVariable.messageHelp.data"); - } - - - - -//----------------------------------------------------------------------------------------- -// Receive attribute map. -// -// * If you add an attribute here, make sure and add it to the class javadoc. -//----------------------------------------------------------------------------------------- - - private static final String receiveProgramName_ = "qmhrcvm"; - private static ProgramMap receiveAttributeMap_ = new ProgramMap(); - - static { - receiveAttributeMap_.add(RQueuedMessage.MESSAGE_SEVERITY, null, "messageInformation.messageSeverity"); - receiveAttributeMap_.add(RQueuedMessage.MESSAGE_ID, null, "messageInformation.messageID"); - receiveAttributeMap_.add(RQueuedMessage.MESSAGE_TYPE, null, "messageInformation.messageType", new IntegerValueMap()); - receiveAttributeMap_.add(RQueuedMessage.MESSAGE_KEY, null, "messageInformation.messageKey"); - receiveAttributeMap_.add(RQueuedMessage.MESSAGE_FILE, null, "messageInformation.messageFile", new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "MSGF")); - receiveAttributeMap_.add(RQueuedMessage.SENDER_JOB_NAME, null, "messageInformation.sendingJob"); - receiveAttributeMap_.add(RQueuedMessage.SENDER_JOB_NUMBER, null, "messageInformation.sendingJobsNumber"); - receiveAttributeMap_.add(RQueuedMessage.SENDER_USER_NAME, null, "messageInformation.sendingUserProfile"); - receiveAttributeMap_.add(RQueuedMessage.SENDING_PROGRAM_NAME, null, "messageInformation.sendingProgramName"); - receiveAttributeMap_.add(RQueuedMessage.DATE_SENT, null, "messageInformation.dateAndTimeSent", new DateValueMap(DateValueMap.FORMAT_13)); - receiveAttributeMap_.add(RQueuedMessage.ALERT_OPTION, null, "messageInformation.alertOption"); - receiveAttributeMap_.add(RQueuedMessage.MESSAGE_HELP, null, "messageInformation.messageHelp"); - } - - - -//----------------------------------------------------------------------------------------- -// PCML document initialization. -//----------------------------------------------------------------------------------------- - - private static final String DOCUMENT_NAME_ = "com.ibm.as400.resource.RMessageQueue"; - private static final String messageFieldIdentifier_ = "qgyolmsg.messageSelectionInformation.messageFieldIdentifier"; - private static final String messageHelpFieldIdentifier_ = "qgyolmsg.messageSelectionInformation.messageHelpFieldIdentifier"; - - private static ProgramCallDocument staticDocument_ = null; - - static { - // Create a static version of the PCML document, then clone it for each document. - // This will improve performance, since we will only have to deserialize the PCML - // object once. - try { - staticDocument_ = new ProgramCallDocument(); - staticDocument_.setDocument(DOCUMENT_NAME_); - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error instantiating ProgramCallDocument", e); - } - } - - -//----------------------------------------------------------------------------------------- -// Private data. -//----------------------------------------------------------------------------------------- - - private static final byte[] BLANK_KEY = new byte[] { 0x40, 0x40, 0x40, 0x40 }; - private static final String QUSRSYS = "QUSRSYS"; - private ProgramCallDocument document_ = null; - - private String path_ = null; - - - -//----------------------------------------------------------------------------------------- -// Code. -//----------------------------------------------------------------------------------------- - -/** -Constructs an RMessageQueue object. -**/ - public RMessageQueue() - { - super(presentationLoader_.getPresentationWithIcon(PRESENTATION_KEY_, ICON_BASE_NAME_), - RQueuedMessage.attributes_, - selections_, - null, - openListProgramName_, - null, - selectionMap_); - - // Initialize the path to CURRENT. - try { - setPath(CURRENT); - } - catch(PropertyVetoException e) { - // Ignore. - } - } - - - -/** -Constructs an RMessageQueue object. - -@param system The system. -**/ - public RMessageQueue(AS400 system) - { - this(); - - try { - setSystem(system); - } - catch(PropertyVetoException e) { - // Ignore. - } - } - - - -/** -Constructs an RMessageQueue object. - -@param system The system. -@param path The fully qualified integrated file system path name - of the message queue, or {@link #CURRENT CURRENT} to refer to the user's - default message queue. -**/ - public RMessageQueue(AS400 system, String path) - { - this(); - - try { - setSystem(system); - setPath(path); - } - catch(PropertyVetoException e) { - // Ignore. - } - } - - -/** -Establishes the connection to the system. - -

      The method is called by the resource framework automatically -when the connection needs to be established. - -@exception ResourceException If an error occurs. -**/ - protected void establishConnection() - throws ResourceException - { - if (path_ == null) - throw new ExtendedIllegalStateException("path", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - // Call the superclass. - super.establishConnection(); - - // Initialize the PCML document. - document_ = (ProgramCallDocument)staticDocument_.clone(); - setDocument(document_); - try { - document_.setValue("qgyolmsg.userOrQueueInformation.userOrQueueIndicator", (path_.equals(CURRENT) ? "0" : "1")); - formatQualifiedMessageQueueName(document_, "qgyolmsg.userOrQueueInformation.userOrQueueName"); - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error setting path information in PCML document", e); - } - } - - - -/** -Formats the qualified message name into a PCML document. - -@param document The PCML document. -@param name The name of the data element. - -@exception PcmlException If a PCML exception occurs. -**/ - private void formatQualifiedMessageQueueName(ProgramCallDocument document, String name) - throws PcmlException - { - if (path_.equals(CURRENT)) { - AS400 system = getSystem(); - if (system != null) { - String userId = system.getUserId(); - document.setValue(name + ".objectName", userId); - document.setValue(name + ".libraryName", QUSRSYS); - } - } - else { - QSYSObjectPathName fullPath = new QSYSObjectPathName(path_); - document.setValue(name + ".objectName", fullPath.getObjectName()); - document.setValue(name + ".libraryName", fullPath.getLibraryName()); - } - } - - - -/** -Returns the fully qualified integrated file system path name -of the message queue, or {@link #CURRENT CURRENT} to refer to the user's default -message queue. - -@return The fully qualified integrated file system path name of the - message queue, or {@link #CURRENT CURRENT} to refer to the user's default - message queue. -**/ - public String getPath() - { - return path_; - } - - - - -/** -Receives a message from the message queue by key. This method -receives a message of any type except sender's copy. The message is removed -from the message queue. See the list of RQueuedMessage -attribute values which are set on a received message. - -@param messageKey The message key. -@return The queued message, or null if the message can not - be received. - -@exception ResourceException If an error occurs. - -@see RQueuedMessage#MESSAGE_KEY -**/ - public RQueuedMessage receive(byte[] messageKey) - throws ResourceException - { - return receive(messageKey, 0, REMOVE, ANY); - } - - - -/** -Receives a message from the message queue. See the list of RQueuedMessage -attribute values which are set on a received message. - -@param messageKey The message key, or null if no message key is needed. -@param waitTime The number of seconds to wait for the message to arrive in the queue - so it can be received. If the message is not received within the - specified wait time, null is returned. Special values are: -

        -
      • 0 - Do not wait for the message. If the message is not in the - queue and you specified a message key, null is returned. -
      • -1 - Wait until the message arrives in the queue and is received, - no matter how long it takes. The system has no limit for - the wait time. -
      -@param messageAction The action to take after the message is received. Valid values are: -
        -
      • OLD - - Keep the message in the message queue and mark it - as an old message. You can receive the message - again only by using the message key or by - specifying the message type NEXT, PREVIOUS, - FIRST, or LAST. -
      • REMOVE - - Remove the message from the message queue. The - message key is no longer valid, so you cannot - receive the message again. -
      • SAME - - Keep the message in the message queue without - changing its new or old designation. SAME lets - you receive the message again later - without using the message key. -
      - -@param messageType The type of message to return. Valid values are: -
        -
      • ANY - - Receives a message of any type except sender's copy. - The message key is optional. -
      • COMPLETION - - Receives a completion message. The message key is - optional. -
      • COPY - - Receives the sender's copy of a previously sent - inquiry message. The message key is required. -
      • DIAGNOSTIC - - Receives a diagnostic message. The message key is - optional. -
      • FIRST - - Receives the first new or old message in the queue. - The message key is disallowed. -
      • INFORMATIONAL - - Receives an informational message. The message key is - optional. -
      • INQUIRY - - Receives an inquiry message. If the action is - REMOVE and a reply to the inquiry message has not - been sent yet, the default reply is automatically - sent when the inquiry message is received. - The message key is optional. -
      • LAST - - Receives the last new or old message in the queue. - The message key is disallowed. -
      • NEXT - - Receives the next new or old message after the - message with the specified key. You can use the - special value TOP for the message key. TOP designates - the message at the top of the message queue. - The message key is required. -
      • PREVIOUS - - Receives the new or old message before the message - with the specified key. The message key is required. -
      • REPLY - - Receives the reply to an inquiry message. For the - message key, you can use the key to the sender's copy - of the inquiry or notify message. The message key is - optional. -
      -@return The queued message, or null if the message can not - be received. - -@exception ResourceException If an error occurs. - -@see RQueuedMessage#MESSAGE_KEY -**/ - public RQueuedMessage receive(byte[] messageKey, - int waitTime, - String messageAction, - String messageType) - throws ResourceException - { - // Validate the parameters. - if (messageAction == null) - throw new NullPointerException("messageAction"); - if ((!messageAction.equals(OLD)) - && (!messageAction.equals(REMOVE)) - && (!messageAction.equals(SAME))) - throw new ExtendedIllegalArgumentException("messageAction", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - if (messageType == null) - throw new NullPointerException("messageType"); - if ((!messageType.equals(ANY)) - && (!messageType.equals(COMPLETION)) - && (!messageType.equals(COPY)) - && (!messageType.equals(DIAGNOSTIC)) - && (!messageType.equals(FIRST)) - && (!messageType.equals(INFORMATIONAL)) - && (!messageType.equals(INQUIRY)) - && (!messageType.equals(LAST)) - && (!messageType.equals(NEXT)) - && (!messageType.equals(PREVIOUS)) - && (!messageType.equals(REPLY))) - throw new ExtendedIllegalArgumentException("messageType", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if ((messageType.equals(COPY) - || messageType.equals(NEXT) - || messageType.equals(PREVIOUS)) - && (messageKey == null)) - throw new ExtendedIllegalArgumentException("messageKey", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - if ((messageType.equals(FIRST) - || messageType.equals(LAST)) - && (messageKey != null)) - throw new ExtendedIllegalArgumentException("messageKey", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - // Establish the connection if needed. - if (!isConnectionEstablished()) - establishConnection(); - - // Set the input parameters and call the API. - try { - formatQualifiedMessageQueueName(document_, receiveProgramName_ + ".qualifiedMessageQueueName"); - document_.setValue(receiveProgramName_ + ".messageType", messageType); - document_.setValue(receiveProgramName_ + ".messageKey", (messageKey == null) ? BLANK_KEY : messageKey); - document_.setIntValue(receiveProgramName_ + ".waitTime", waitTime); - document_.setValue(receiveProgramName_ + ".messageAction", messageAction); - if (document_.callProgram(receiveProgramName_) == false) - throw new ResourceException(document_.getMessageList(receiveProgramName_)); - - // If the bytes returned is 8, then the message can not - // be received. - if (document_.getIntValue(receiveProgramName_ + ".messageInformation.bytesReturned") <= 8) { - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Queued message can not be received."); - return null; - } - - // Create the RQueuedMessage object. - AS400 system = getSystem(); - RQueuedMessage rQueuedMessage = new RQueuedMessage(); - try { rQueuedMessage.setSystem(system); } catch (PropertyVetoException pve) {} // @D6a - Object[] attributeIDs = receiveAttributeMap_.getIDs(); - Object[] values = receiveAttributeMap_.getValues(attributeIDs, system, document_, receiveProgramName_, null); - for(int j = 0; j < values.length; ++j) - rQueuedMessage.initializeAttributeValue(attributeIDs[j], values[j]); - - // Text and substitution data aren't so straightforward. If the - // message id is there, then message text and substitution data are - // what they say they are. If there is no message id, then what comes - // back as substitution data is really impromptu message text. - String messageText = (String)document_.getValue(receiveProgramName_ + ".messageInformation.message"); - byte[] substitutionData = (byte[])document_.getValue(receiveProgramName_ + ".messageInformation.replacementDataOrImpromptuText"); - if (((String)rQueuedMessage.getAttributeValue(RQueuedMessage.MESSAGE_ID)).length() > 0) { - rQueuedMessage.initializeAttributeValue(RQueuedMessage.MESSAGE_TEXT, messageText); - rQueuedMessage.initializeAttributeValue(RQueuedMessage.SUBSTITUTION_DATA, substitutionData); - } - else { - CharConverter converter = new CharConverter(system.getCcsid(), system); - rQueuedMessage.initializeAttributeValue(RQueuedMessage.MESSAGE_TEXT, converter.byteArrayToString(substitutionData)); - rQueuedMessage.initializeAttributeValue(RQueuedMessage.SUBSTITUTION_DATA, substitutionData); - } - - Object resourceKey = RQueuedMessage.computeResourceKey(system, path_, (byte[])rQueuedMessage.getAttributeValue(RQueuedMessage.MESSAGE_KEY)); - rQueuedMessage.setResourceKey(resourceKey); - return rQueuedMessage; - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error when receiving message", e); - throw new ResourceException(e); - } - catch(UnsupportedEncodingException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error when receiving message", e); - throw new ResourceException(e); - } - } - - - -/** -Remove all messages from the message queue. - -@exception ResourceException If an error occurs. -**/ - public void remove() - throws ResourceException - { - remove(BLANK_KEY, ALL); - } - - - -/** -Removes a message from the message queue. - -@param messageKey The message key. - -@exception ResourceException If an error occurs. -**/ - public void remove(byte[] messageKey) - throws ResourceException - { - remove(messageKey, BYKEY); - } - - - -/** -Remove messages from the message queue. - -@param messageType The type of message to remove. Valid values are: -
        -
      • ALL - - All messages in the message queue. -
      • KEEP_UNANSWERED - - All messages in the message queue except unanswered - inquiry and unanswered senders' copy messages. -
      • NEW - - All new messages in the message queue. New messages - are those that have not been received. -
      • OLD - - All old messages in the message queue. Old messages - are those that have already been received. -
      - -@exception ResourceException If an error occurs. -**/ - public void remove(String messageType) - throws ResourceException - { - remove(BLANK_KEY, messageType); - } - - - -/** -Remove messages from the message queue. - -@param messageKey The message key. -@param messageType The type of message to remove. Valid values are: -
        -
      • ALL - - All messages in the message queue. -
      • BYKEY - - The single message specified by the message key. -
      • KEEP_UNANSWERED - - All messages in the message queue except unanswered - inquiry and unanswered senders' copy messages. -
      • NEW - - All new messages in the message queue. New messages - are those that have not been received. -
      • OLD - - All old messages in the message queue. Old messages - are those that have already been received. -
      - -@exception ResourceException If an error occurs. -**/ - void remove(byte[] messageKey, String messageType) - throws ResourceException - { - // Validate the parameters. - if (messageKey == null) - throw new NullPointerException("messageKey"); - - if (messageType == null) - throw new NullPointerException("messageType"); - if ((!messageType.equals(ALL)) - && (!messageType.equals(BYKEY)) - && (!messageType.equals(KEEP_UNANSWERED)) - && (!messageType.equals(NEW)) - && (!messageType.equals(OLD))) - throw new ExtendedIllegalArgumentException("messageType", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - // Establish the connection if needed. - if (!isConnectionEstablished()) - establishConnection(); - - // Set the input parameters and call the API. - try { - formatQualifiedMessageQueueName(document_, "qmhrmvm.qualifiedMessageQueueName"); - document_.setValue("qmhrmvm.messageKey", messageKey); - document_.setValue("qmhrmvm.messagesToRemove", messageType); - if (document_.callProgram("qmhrmvm") == false) - throw new ResourceException(document_.getMessageList("qmhrmvm")); - } - catch (PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error when removing message", e); - throw new ResourceException(e); - } - } - - - -/** -Replies to and removes a message. - -@param messageKey The message key. -@param replyText The reply. - -@exception ResourceException If an error occurs. -**/ - public void reply(byte[] messageKey, String replyText) - throws ResourceException - { - reply(messageKey, replyText, true); - } - - - -/** -Replies to a message. - -@param messageKey The message key. -@param replyText The reply. -@param remove true to remove the inquiry message and the reply from the - message queue after the reply is sent, false to keep the - inquiry message and the reply after the reply is sent. - -@exception ResourceException If an error occurs. -**/ - public void reply(byte[] messageKey, String replyText, boolean remove) - throws ResourceException - { - // Validate the parameters. - if (messageKey == null) - throw new NullPointerException("messageKey"); - if (replyText == null) - throw new NullPointerException("replyText"); - - // Establish the connection if needed. - if (!isConnectionEstablished()) - establishConnection(); - - // Set the input parameters and call the API. - try { - document_.setValue("qmhsndrm.messageKey", messageKey); - formatQualifiedMessageQueueName(document_, "qmhsndrm.qualifiedMessageQueueName"); - byte[] asBytes = CharConverter.stringToByteArray(getSystem(), replyText); // @A1A - document_.setIntValue("qmhsndrm.lengthOfReplyText", asBytes.length); // @A1C - document_.setValue("qmhsndrm.replyText", asBytes); // @A1C - document_.setValue("qmhsndrm.removeMessage", remove ? "*YES" : "*NO"); - if (document_.callProgram("qmhsndrm") == false) - throw new ResourceException(document_.getMessageList("qmhsndrm")); - } - catch (PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error when replying to message", e); - throw new ResourceException(e); - } - } - - - -/** -Sends a message to the message queue. - -@param messageID The message ID. -@param messageFile The integrated file system path name of the message file. -@param substitutionData The substitution data for the message, or null if none. -@param messageType The message type. Valid values are: -
        -
      • INQUIRY -
      • INFORMATIONAL -
      -@param replyMessageQueue The integrated file system path name of the reply message queue. -@return The message key, if this is an inquiry message, - null otherwise. - -@exception ResourceException If an error occurs. -**/ -// -// Reminder: This is a private method, used for implementing the other methods. -// Some validation is not necessary, since the public methods are only -// available in certain combinations. -// - private byte[] send(String messageID, - String messageFile, - Object substitutionData, - String messageType, - String replyMessageQueue) - throws ResourceException - { - // Validate the parameters. - if (messageID == null) - throw new NullPointerException("messageID"); - if (messageFile == null) - throw new NullPointerException("messageFile"); - - if (substitutionData != null) { - if ((!(substitutionData instanceof byte[])) - && (!(substitutionData instanceof String))) - throw new ExtendedIllegalArgumentException("substitutionData", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (messageType == null) - throw new NullPointerException("messageType"); - if ((!messageType.equals(INFORMATIONAL)) - && (!messageType.equals(INQUIRY))) - throw new ExtendedIllegalArgumentException("messageType", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - if (replyMessageQueue == null) - throw new NullPointerException("replyQueue"); - - // Establish the connection if needed. - if (!isConnectionEstablished()) - establishConnection(); - - // Set the input parameters and call the API. - try { - String programName; - if (substitutionData != null) { - if (substitutionData instanceof byte[]) { - programName = "qmhsndmWithMessageData"; - document_.setIntValue(programName + ".lengthOfMessageData", ((byte[])substitutionData).length); - document_.setValue(programName + ".messageData", substitutionData); - } - else { - programName = "qmhsndmWithImmediateText"; - byte[] asBytes = CharConverter.stringToByteArray(getSystem(), (String)substitutionData); // @A1A - document_.setIntValue(programName + ".lengthOfImmediateText", asBytes.length); // @A1C - document_.setValue(programName + ".immediateText", asBytes); // @A1C - } - } - else { - programName = "qmhsndmWithImmediateText"; - document_.setIntValue(programName + ".lengthOfImmediateText", 0); - document_.setValue(programName + ".immediateText", new byte[0]); // @A1C - } - - document_.setValue(programName + ".messageID", messageID); - - if (messageFile.length() > 0) { - QSYSObjectPathName messageFilePathName = new QSYSObjectPathName(messageFile); - document_.setValue(programName + ".qualifiedMessageFileName.objectName", messageFilePathName.getObjectName()); - document_.setValue(programName + ".qualifiedMessageFileName.libraryName", messageFilePathName.getLibraryName()); - } - else { - document_.setValue(programName + ".qualifiedMessageFileName.objectName", ""); - document_.setValue(programName + ".qualifiedMessageFileName.libraryName", ""); - } - - - document_.setValue(programName + ".messageType", messageType); - formatQualifiedMessageQueueName(document_, programName + ".qualifiedMessageQueueNames"); - - if (replyMessageQueue.length() > 0) { - QSYSObjectPathName replyMessageQueuePathName = new QSYSObjectPathName(replyMessageQueue); - document_.setValue(programName + ".qualifiedReplyMessageQueueName.objectName", replyMessageQueuePathName.getObjectName()); - document_.setValue(programName + ".qualifiedReplyMessageQueueName.libraryName", replyMessageQueuePathName.getLibraryName()); - } - else { - document_.setValue(programName + ".qualifiedReplyMessageQueueName.objectName", ""); - document_.setValue(programName + ".qualifiedReplyMessageQueueName.libraryName", ""); - } - - if (document_.callProgram(programName) == false) - throw new ResourceException(document_.getMessageList(programName)); - - // Get the output and return. - byte[] messageKey = null; - if (messageType.equals(INQUIRY)) - messageKey = (byte[])document_.getValue(programName + ".messageKey"); - return messageKey; - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error when sending a message", e); - throw new ResourceException(e); - } - } - - - -/** -Sends an informational message to the message queue. - -@param messageID The message ID. -@param messageFile The integrated file system path name of the message file. - -@exception ResourceException If an error occurs. -**/ - public void sendInformational(String messageID, String messageFile) - throws ResourceException - { - send(messageID, messageFile, null, INFORMATIONAL, ""); - } - - - -/** -Sends an informational message to the message queue. - -@param messageID The message ID. -@param messageFile The integrated file system path name of the message file. -@param substitutionData The substitution data for the message, or null if none. - -@exception ResourceException If an error occurs. -**/ - public void sendInformational(String messageID, String messageFile, byte[] substitutionData) - throws ResourceException - { - send(messageID, messageFile, substitutionData, INFORMATIONAL, ""); - } - - - -/** -Sends an informational message to the message queue. - -@param messageText The message text. - -@exception ResourceException If an error occurs. -**/ - public void sendInformational(String messageText) - throws ResourceException - { - if (messageText == null) - throw new NullPointerException("messageText"); - - send("", "", messageText, INFORMATIONAL, ""); - } - - - -/** -Sends an inquiry message to the message queue. - -@param messageID The message ID. -@param messageFile The integrated file system path name of the message file. -@param replyMessageQueue The integrated file system path name of the reply message queue. -@return The message key. - -@exception ResourceException If an error occurs. -**/ - public byte[] sendInquiry(String messageID, - String messageFile, - String replyMessageQueue) - throws ResourceException - { - return send(messageID, messageFile, null, INQUIRY, replyMessageQueue); - } - - - -/** -Sends an inquiry message to the message queue. - -@param messageID The message ID. -@param messageFile The integrated file system path name of the message file. -@param substitutionData The substitution data for the message, or null if none. -@param replyMessageQueue The integrated file system path name of the reply message queue. -@return The message key. - -@exception ResourceException If an error occurs. -**/ - public byte[] sendInquiry(String messageID, - String messageFile, - byte[] substitutionData, - String replyMessageQueue) - throws ResourceException - { - return send(messageID, messageFile, substitutionData, INQUIRY, replyMessageQueue); - } - - - -/** -Sends an inquiry message to the message queue. - -@param messageText The message text. -@param replyMessageQueue The integrated file system path name of the reply message queue. -@return The message key. - -@exception ResourceException If an error occurs. -**/ - public byte[] sendInquiry(String messageText, String replyMessageQueue) - throws ResourceException - { - if (messageText == null) - throw new NullPointerException("messageText"); - - return send("", "", messageText, INQUIRY, replyMessageQueue); - } - - - -/** -Sets the fully qualified integrated file system path name of the -message queue. The default is {@link #CURRENT CURRENT}. The path cannot be changed -if this object has already established a connection to the system. - -@param path The fully qualified integrated file system path name of the - message queue, or {@link #CURRENT CURRENT} to refer to the user's default - message queue. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setPath(String path) - throws PropertyVetoException - { - if (path == null) - throw new NullPointerException("path"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - String oldValue = path_; - fireVetoableChange("path", oldValue, path); - path_ = path.trim(); - - // Verify that it is a valid IFS path name and - // set the presentation data. - Presentation presentation = getPresentation(); - if (path_.equals(CURRENT)) { - presentation.setName(CURRENT); - } - else { - QSYSObjectPathName fullPath = new QSYSObjectPathName(path_); - presentation.setName(fullPath.getObjectName()); - presentation.setFullName(fullPath.getPath()); - } - - firePropertyChange("path", oldValue, path); - } - - - - - -//----------------------------------------------------------------------------------------- -// List implementation. -//----------------------------------------------------------------------------------------- - - void setOpenParameters(ProgramCallDocument document) - throws PcmlException, ResourceException - { - super.setOpenParameters(document); - - boolean replacementData = ((Boolean)getSelectionValue(REPLACEMENT_DATA)).booleanValue(); - Integer formattingCharacters = (Integer)getSelectionValue(FORMATTING_CHARACTERS); - if (replacementData) { - document.setIntValue(messageFieldIdentifier_, 302); - if (formattingCharacters.equals(NO_FORMATTING)) - document.setIntValue(messageHelpFieldIdentifier_, 402); - else - document.setIntValue(messageHelpFieldIdentifier_, 404); - } - else { - document.setIntValue(messageFieldIdentifier_, 301); - if (formattingCharacters.equals(NO_FORMATTING)) - document.setIntValue(messageHelpFieldIdentifier_, 401); - else - document.setIntValue(messageHelpFieldIdentifier_, 403); - } - } - - - - Resource newResource(String programName, int[] indices) - throws PcmlException, ResourceException - { - AS400 system = getSystem(); - - // Create the resource object. - byte[] messageKey = (byte[])document_.getValue(programName + ".receiverVariable.messageKey", indices); - Object resourceKey = RQueuedMessage.computeResourceKey(system, path_, messageKey); - RQueuedMessage rQueuedMessage = new RQueuedMessage(); - try { rQueuedMessage.setSystem(system); } catch (PropertyVetoException pve) {} // @D6a - rQueuedMessage.setResourceKey(resourceKey); - - // Copy the information from the API record to the QueuedMessage attributes. - Object[] attributeIDs = openListAttributeMap_.getIDs(); - Object[] values = openListAttributeMap_.getValues(attributeIDs, system, document_, programName, indices); - for(int i = 0; i < values.length; ++i) - rQueuedMessage.initializeAttributeValue(attributeIDs[i], values[i]); - - // Format the help text if needed. - Integer formattingCharacters = (Integer)getSelectionValue(FORMATTING_CHARACTERS); - if (formattingCharacters.equals(SUBSTITUTE_FORMATTING_CHARACTERS)) { - String messageHelp = (String)rQueuedMessage.getAttributeValue(RQueuedMessage.MESSAGE_HELP); - messageHelp = com.ibm.as400.access.MessageFile.substituteFormattingCharacters(messageHelp); - rQueuedMessage.initializeAttributeValue(RQueuedMessage.MESSAGE_HELP, messageHelp); - } - - // Set the presentation information. - // The name is in the format: MessageId(MessageKey) - // The full name is in the format: MessageQueueName-MessageId(MessageKey) - StringBuffer name = new StringBuffer(); - name.append((String)rQueuedMessage.getAttributeValue(RQueuedMessage.MESSAGE_ID)); - name.append('('); - name.append(Presentation.bytesToHex((byte[])rQueuedMessage.getAttributeValue(RQueuedMessage.MESSAGE_KEY))); - name.append(')'); - - StringBuffer fullName = new StringBuffer(); - fullName.append(path_); - fullName.append('-'); - fullName.append(name.toString()); - - Presentation presentation = rQueuedMessage.getPresentation(); - presentation.setName(name.toString()); - presentation.setFullName(fullName.toString()); - presentation.setValue(Presentation.DESCRIPTION_TEXT, rQueuedMessage.getAttributeValue(RQueuedMessage.MESSAGE_TEXT)); - presentation.setValue(Presentation.HELP_TEXT, rQueuedMessage.getAttributeValue(RQueuedMessage.MESSAGE_HELP)); - - return rQueuedMessage; - } - - - } - - - - diff --git a/cvsroot/src/com/ibm/as400/resource/RMessageQueue.pcml b/cvsroot/src/com/ibm/as400/resource/RMessageQueue.pcml deleted file mode 100644 index 6355c1ee4..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RMessageQueue.pcml +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/resource/RMessageQueue16.gif b/cvsroot/src/com/ibm/as400/resource/RMessageQueue16.gif deleted file mode 100644 index 73d0723bd..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RMessageQueue16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RMessageQueue32.gif b/cvsroot/src/com/ibm/as400/resource/RMessageQueue32.gif deleted file mode 100644 index 447b5f9fe..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RMessageQueue32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RMessageQueueBeanInfo.java b/cvsroot/src/com/ibm/as400/resource/RMessageQueueBeanInfo.java deleted file mode 100644 index 749aa18d5..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RMessageQueueBeanInfo.java +++ /dev/null @@ -1,155 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RMessageQueueBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Trace; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.util.ResourceBundle; - - - -/** -The RMessageQueueBeanInfo class represents the bean information -for the RMessageQueue class. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class RMessageQueueBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final Class beanClass_ = RMessageQueue.class; - - private static BeanInfo[] additionalBeanInfo_; - private static BeanDescriptor beanDescriptor_; - private static Image icon16_; - private static Image icon32_; - private static PropertyDescriptor[] propertyDescriptors_; - private static ResourceBundle resourceBundle_; - - - -/** -Static initializer. -**/ - static - { - try - { - // Set up the resource bundle. - resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.resource.ResourceMRI"); - - // Set up the additional bean info. - additionalBeanInfo_ = new BeanInfo[] { new ResourceListBeanInfo() }; - - // Set up the bean descriptor. - beanDescriptor_ = new BeanDescriptor(beanClass_); - - // Set up the property descriptors. - PropertyDescriptor path = new PropertyDescriptor("path", beanClass_); - path.setBound(true); - path.setConstrained(true); - path.setDisplayName(resourceBundle_.getString("PROPERTY_PATH_NAME")); - path.setShortDescription(resourceBundle_.getString("PROPERTY_PATH_DESCRIPTION")); - - propertyDescriptors_ = new PropertyDescriptor[] { path }; - - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error while loading bean info", e); - throw new Error(e.toString()); - } - } - - - -/** -Returns the additional bean information. - -@return The additional bean information. -**/ - public BeanInfo[] getAdditionalBeanInfo() - { - return additionalBeanInfo_; - } - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - - -/** -Returns the property descriptors. - -@return The property descriptors. -**/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors_; - } - - - -/** -Returns the icon. - -@param icon The icon kind. Possible values are: -
        -
      • BeanInfo.ICON_MONO_16x16 -
      • BeanInfo.ICON_MONO_32x32 -
      • BeanInfo.ICON_COLOR_16x16 -
      • BeanInfo.ICON_COLOR_32x32 -
      -@return The icon. -**/ - public Image getIcon(int icon) - { - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - if (icon16_ == null) - icon16_ = loadImage("RMessageQueue16.gif"); - return icon16_; - - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - if (icon32_ == null) - icon32_ = loadImage("RMessageQueue32.gif"); - return icon32_; - - default: - throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/RPrinter.java b/cvsroot/src/com/ibm/as400/resource/RPrinter.java deleted file mode 100644 index d50bf4173..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RPrinter.java +++ /dev/null @@ -1,1585 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RPrinter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.beans.PropertyVetoException; - - - -/** -The RPrinter class represents a printer connected to the system. - - -// Get the text description. -String textDescription = (String)printer.getAttributeValue(RPrinter.TEXT_DESCRIPTION); -
      -// Set the form type for a printer to all. -printer.setAttributeValue(RPrinter.FORM_TYPE, RPrinter.FORM_TYPE_ALL); -
      -// Commit the attribute change. -printer.commitAttributeChanges(); -
  • - -@deprecated Use -{@link com.ibm.as400.access.Printer Printer} instead, as this package may be removed in the future. -@see RPrinterList -**/ -public class RPrinter -extends ChangeableResource -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - -//----------------------------------------------------------------------------------------- -// Presentation. -//----------------------------------------------------------------------------------------- - - private static PresentationLoader presentationLoader_ = new PresentationLoader("com.ibm.as400.resource.ResourceMRI"); - private static final String ICON_BASE_NAME_ = "RPrinter"; - private static final String PRESENTATION_KEY_ = "PRINTER"; - - - -//----------------------------------------------------------------------------------------- -// Attribute values. -//----------------------------------------------------------------------------------------- - -/** -Attribute value that indicates that an operation is effective when the -current spooled file has been printed. -**/ - public static final String OPERATION_FILE_END = "*FILEEND"; - -/** -Attribute value that indicates that an operation is effective when there -are no files are ready to print on the output queue from which the -writer is selected files. -**/ - public static final String OPERATION_NO_FILES_READY = "*NORDYF"; - -/** -Attribute value that indicates that an operation is not effective. -**/ - public static final String OPERATION_NONE = "*NO"; - -/** -Attribute value for status indicating that an operation is pending and will -take effect after the current copy of the spooled file has been printed. -**/ - public static final String PENDING_STATUS_CONTROLLED = "C"; - -/** -Attribute value for status indicating that an operation is pending and will -take effect as soon as its output buffers are empty. -**/ - public static final String PENDING_STATUS_IMMEDIATE = "I"; - -/** -Attribute value for status indicating that no operation is pending. -**/ - public static final String PENDING_STATUS_NONE = "N"; - -/** -Attribute value for status indicating that an operation is pending and will -take effect at the end of the page. -**/ - public static final String PENDING_STATUS_PAGE_END = "P"; - -/** -Attribute value that indicates that separator page information is set in the device description. -**/ - public static final Integer SEPARATOR_PAGE_DEVICE = new Integer(-2); - -/** -Attribute value that indicates that separator page information is set in the file. -**/ - public static final Integer SEPARATOR_PAGE_FILE = new Integer(-1); - -/** -Attribute value that indicates that there is no separator page. -**/ - public static final Integer SEPARATOR_PAGE_NONE = new Integer(-10); - -/** -Attribute value for status indicating held. -**/ - public static final String STATUS_HELD = "H"; - -/** -Attribute value for status indicating released. -**/ - public static final String STATUS_RELEASED = "R"; - - - -//----------------------------------------------------------------------------------------- -// Attribute IDs. -// -// * If you add an attribute here, make sure and add it to the class javadoc. -//----------------------------------------------------------------------------------------- - - // Private data. - static ResourceMetaDataTable attributes_ = new ResourceMetaDataTable(presentationLoader_, PRESENTATION_KEY_); - private static ProgramMap getterMap_ = new ProgramMap(); - private static CommandMap setterMap_ = new CommandMap(); - - private static final BooleanValueMap booleanValueMap01_ = new BooleanValueMap("0", "1"); - private static final BooleanValueMap booleanValueMapNoYes_ = new BooleanValueMap(new String[] {"*NO", ""}, new String[] {"*YES"}); - private static final BooleanValueMap booleanValueMapNY_ = new BooleanValueMap(new String[] {"N", ""}, new String[] { "Y" }); - private static final QuoteValueMap quoteValueMapBlank_ = new QuoteValueMap("*BLANK"); - private static final QuoteValueMap quoteValueMapEmpty_ = new QuoteValueMap(""); - private static final ValueMap separatorValueMap_ = new AbstractValueMap() - { - public Object ltop(Object logicalValue) { - if (logicalValue.equals(SEPARATOR_PAGE_FILE)) - return "*FILE"; - else if (logicalValue.equals(SEPARATOR_PAGE_DEVICE)) - return "*DEVD"; - else - return logicalValue; - } - }; - - - - private static final String CHGDEVPRT_ = "CHGDEVPRT"; - private static final String CHGWTR_ = "CHGWTR"; - private static final String RPTA0100_ = "qgyrprta_rpta0100"; - private static final String DEVD_PARAMETER_ = "DEVD"; - private static final String WTR_PARAMETER_ = "WTR"; - - - -/** -Attribute ID for advanced function printing. This identifies a read-only Boolean -attribute, which indicates whether the printer supports Advanced Function Printing. -**/ - public static final String ADVANCED_FUNCTION_PRINTING = "ADVANCED_FUNCTION_PRINTING"; - - static { - attributes_.add(ADVANCED_FUNCTION_PRINTING, Boolean.class, true); - getterMap_.add(ADVANCED_FUNCTION_PRINTING, RPTA0100_, "receiverVariable.advancedFunctionPrinting", booleanValueMapNoYes_); - } - - - -/** -Attribute ID for align forms. This identifies a read-only String -attribute, which represents the time at which the forms alignment -message will be sent. Possible values are: -
      -
    • {@link #ALIGN_FORMS_WRITER ALIGN_FORMS_WRITER} - - The writer determines when the message is sent. -
    • {@link #ALIGN_FORMS_FILE ALIGN_FORMS_FILE} - - Control of the page alignment is specified by each file. -
    • "" - The writer is ended. -
    -**/ - public static final String ALIGN_FORMS = "ALIGN_FORMS"; - - /** - Attribute value indicating that the writer determines when the forms - alignment message is sent. - - @see #ALIGN_FORMS - **/ - public static final String ALIGN_FORMS_WRITER = "*WTR"; - - /** - Attribute value indicating that control of the page alignment is specified - by each file. - - @see #ALIGN_FORMS - **/ - public static final String ALIGN_FORMS_FILE = "*FILE"; - - static { - attributes_.add(ALIGN_FORMS, String.class, true, - new Object[] {ALIGN_FORMS_WRITER, ALIGN_FORMS_FILE, "" } , - null, true); - getterMap_.add(ALIGN_FORMS, RPTA0100_, "receiverVariable.alignForms"); - } - - - - -/** -Attribute ID for allow direct printing. This identifies a read-only Boolean -attribute, which indicates whether the printer writer allows the printer to -be allocated to a job that prints directly to a printer. -**/ - public static final String ALLOW_DIRECT_PRINTING = "ALLOW_DIRECT_PRINTING"; - - static { - attributes_.add(ALLOW_DIRECT_PRINTING, Boolean.class, true); - getterMap_.add(ALLOW_DIRECT_PRINTING, RPTA0100_, "receiverVariable.allowDirectPrinting", booleanValueMapNoYes_); - } - - - -/** -Attribute ID for automatically end writer. This identifies a read-only String -attribute, which represents when to end the writer if it is to end automatically. -Possible values are: -
      -
    • {@link #OPERATION_NO_FILES_READY OPERATION_NO_FILES_READY} - - When no files are ready to print on the output queue from which - the writer is selecting files to be printed. -
    • {@link #OPERATION_FILE_END OPERATION_FILE_END} - - When the current spooled file has been printed. -
    • {@link #OPERATION_NONE OPERATION_NONE} - - The writer will not end, but it will wait for more spooled files. -
    • "" - The writer is ended. -
    -**/ - public static final String AUTOMATICALLY_END_WRITER = "AUTOMATICALLY_END_WRITER"; - - static { - attributes_.add(AUTOMATICALLY_END_WRITER, String.class, true, - new Object[] {OPERATION_NO_FILES_READY, - OPERATION_FILE_END, - OPERATION_NONE, ""} , - null, true); - getterMap_.add(AUTOMATICALLY_END_WRITER, RPTA0100_, "receiverVariable.automaticallyEndWriter"); - } - - - -/** -Attribute ID for between copies status. This identifies a read-only Boolean -attribute, which indicates whether the writer is between copies of a multiple -copy spooled file. -**/ - public static final String BETWEEN_COPIES_STATUS = "BETWEEN_COPIES_STATUS"; - - static { - attributes_.add(BETWEEN_COPIES_STATUS, Boolean.class, true); - getterMap_.add(BETWEEN_COPIES_STATUS, RPTA0100_, "receiverVariable.betweenCopiesStatus", booleanValueMapNY_); - } - - - -/** -Attribute ID for between files status. This identifies a read-only Boolean -attribute, which indicates whether the writer is between spooled files. -**/ - public static final String BETWEEN_FILES_STATUS = "BETWEEN_FILES_STATUS"; - - static { - attributes_.add(BETWEEN_FILES_STATUS, Boolean.class, true); - getterMap_.add(BETWEEN_FILES_STATUS, RPTA0100_, "receiverVariable.betweenFilesStatus", booleanValueMapNY_); - } - - - -/** -Attribute ID for changes take effect. This identifies a String -attribute, which represents the time at which the pending changes to the -writer take effect. -Possible values are: -
      -
    • {@link #OPERATION_NO_FILES_READY OPERATION_NO_FILES_READY} - - When all the current eligible files are printed. -
    • {@link #OPERATION_FILE_END OPERATION_FILE_END} - - When the current spooled file is done printing. -
    • "" - No pending changes to the writer. -
    -**/ - public static final String CHANGES_TAKE_EFFECT = "CHANGES_TAKE_EFFECT"; - - static { - attributes_.add(CHANGES_TAKE_EFFECT, String.class, false, - new Object[] {OPERATION_NO_FILES_READY, - OPERATION_FILE_END, - ""} , - null, true); - getterMap_.add(CHANGES_TAKE_EFFECT, RPTA0100_, "receiverVariable.changesTakeEffect"); - setterMap_.add(CHANGES_TAKE_EFFECT, CHGWTR_, "OPTION"); - } - - - -/** -Attribute ID for copies left to produce. This identifies a read-only Integer -attribute, which represents the number of copies left to be printed, or 0 -when no file is printing. -**/ - public static final String COPIES_LEFT_TO_PRODUCE = "COPIES_LEFT_TO_PRODUCE"; - - static { - attributes_.add(COPIES_LEFT_TO_PRODUCE, Integer.class, true); - getterMap_.add(COPIES_LEFT_TO_PRODUCE, RPTA0100_, "receiverVariable.copiesLeftToProduce"); - } - - - -/** -Attribute ID for device name. This identifies a read-only String -attribute, which represents the name of the printer device. -**/ - public static final String DEVICE_NAME = "DEVICE_NAME"; - - static { - attributes_.add(DEVICE_NAME, String.class, true); - getterMap_.add(DEVICE_NAME, RPTA0100_, "receiverVariable.deviceName"); - } - - - -/** -Attribute ID for device status. This identifies a read-only Integer -attribute, which represents the status of the printer device. -**/ - public static final String DEVICE_STATUS = "DEVICE_STATUS"; - - static { - attributes_.add(DEVICE_STATUS, Integer.class, true); - getterMap_.add(DEVICE_STATUS, RPTA0100_, "receiverVariable.deviceStatus"); - } - - - -/** -Attribute ID for device type. This identifies a read-only String -attribute, which represents the type of the printer. - -**/ - public static final String DEVICE_TYPE = "DEVICE_TYPE"; - static { - attributes_.add(DEVICE_TYPE, String.class, true); - getterMap_.add(DEVICE_TYPE, RPTA0100_, "receiverVariable.printerDeviceType"); - } - - - -/** -Attribute ID for end pending status. This identifies a read-only String -attribute, which represents whether an End Writer (ENDWTR) command has -been issued for this writer. -Possible values are: -
      -
    • {@link #PENDING_STATUS_NONE PENDING_STATUS_NONE} - - No End Writer (ENDWTR) command has been issued. -
    • {@link #PENDING_STATUS_IMMEDIATE PENDING_STATUS_IMMEDIATE} - - The writer ends as soon as its output buffers are empty. -
    • {@link #PENDING_STATUS_CONTROLLED PENDING_STATUS_CONTROLLED} - - The writer ends after the current copy of the spooled file has been printed. -
    • {@link #PENDING_STATUS_PAGE_END PENDING_STATUS_PAGE_END} - - The writer ends at the end of the page. -
    • "" - The writer is ended. -
    -**/ - public static final String END_PENDING_STATUS = "END_PENDING_STATUS"; - - static { - attributes_.add(END_PENDING_STATUS, String.class, true, - new Object[] {PENDING_STATUS_NONE, - PENDING_STATUS_IMMEDIATE, - PENDING_STATUS_CONTROLLED, - PENDING_STATUS_PAGE_END, ""} , - null, true); - getterMap_.add(END_PENDING_STATUS, RPTA0100_, "receiverVariable.endPendingStatus"); - } - - - -/** -Attribute ID for form type. This identifies a String -attribute, which represents the type of form being used to print -the spooled file. -Possible values are: -
      -
    • {@link #FORM_TYPE_ALL FORM_TYPE_ALL} - - The writer is started with the option to print all spooled files - of any form type. -
    • {@link #FORM_TYPE_FORMS FORM_TYPE_FORMS} - - The writer is started with the option to print all spooled files - with the same form type before using a different form type. -
    • {@link #FORM_TYPE_STANDARD FORM_TYPE_STANDARD} - - The writer is started with the option to print all spooled files - with a form type of *STD. -
    • A form type name - The writer is started with the option - to print all spooled files with the specified form type. -
    -**/ - public static final String FORM_TYPE = "FORM_TYPE"; - - /** - Attribute value indicating that the writer is started with the - option to print all spooled files of any form type. - - @see #FORM_TYPE - **/ - public static final String FORM_TYPE_ALL = "*ALL"; - - /** - Attribute value indicating that the writer is started with the - option to print all spooled files with the same form type - before using a different form type. - - @see #FORM_TYPE - **/ - public static final String FORM_TYPE_FORMS = "*FORMS"; - - /** - Attribute value indicating that the writer is started - with the option to print all spooled files with a form type of *STD. - - @see #FORM_TYPE - **/ - public static final String FORM_TYPE_STANDARD = "*STD"; - - static { - attributes_.add(FORM_TYPE, String.class, false, - new Object[] {FORM_TYPE_ALL, - FORM_TYPE_FORMS, - FORM_TYPE_STANDARD} , - null, false); - getterMap_.add(FORM_TYPE, RPTA0100_, "receiverVariable.formType"); - setterMap_.add(FORM_TYPE, CHGWTR_, "FORMTYPE", quoteValueMapEmpty_); - } - - - -/** -Attribute ID for held status. This identifies a read-only Boolean -attribute, which indicates whether the writer is held. -**/ - public static final String HELD_STATUS = "HELD_STATUS"; - - static { - attributes_.add(HELD_STATUS, Boolean.class, true); - getterMap_.add(HELD_STATUS, RPTA0100_, "receiverVariable.heldStatus", booleanValueMapNY_); - } - - - -/** -Attribute ID for hold pending status. This identifies a read-only String -attribute, which represents whether an Hold Writer (HLDWTR) command has -been issued for this writer. -Possible values are: -
      -
    • {@link #PENDING_STATUS_NONE PENDING_STATUS_NONE} - - No Hold Writer (HLDWTR) command has been issued. -
    • {@link #PENDING_STATUS_IMMEDIATE PENDING_STATUS_IMMEDIATE} - - The writer is held as soon as its output buffers are empty. -
    • {@link #PENDING_STATUS_CONTROLLED PENDING_STATUS_CONTROLLED} - - The writer is held after the current copy of the spooled file has been printed. -
    • {@link #PENDING_STATUS_PAGE_END PENDING_STATUS_PAGE_END} - - The writer is held at the end of the page. -
    • "" - The writer is ended. -
    -**/ - public static final String HOLD_PENDING_STATUS = "HOLD_PENDING_STATUS"; - - static { - attributes_.add(HOLD_PENDING_STATUS, String.class, true, - new Object[] {PENDING_STATUS_NONE, - PENDING_STATUS_IMMEDIATE, - PENDING_STATUS_CONTROLLED, - PENDING_STATUS_PAGE_END, ""} , - null, true); - getterMap_.add(HOLD_PENDING_STATUS, RPTA0100_, "receiverVariable.holdPendingStatus"); - } - - - -/** -Attribute ID for job name. This identifies a read-only String -attribute, which represents the name of the job that created the spooled -file currently being processed by the writer, or "" when no spooled -file is printing. -**/ - public static final String JOB_NAME = "JOB_NAME"; - - static { - attributes_.add(JOB_NAME, String.class, true); - getterMap_.add(JOB_NAME, RPTA0100_, "receiverVariable.jobName"); - } - - - -/** -Attribute ID for job number. This identifies a read-only String -attribute, which represents the number of the job that created the spooled -file currently being processed by the writer, or "" when no spooled -file is printing. -**/ - public static final String JOB_NUMBER = "JOB_NUMBER"; - - static { - attributes_.add(JOB_NUMBER, String.class, true); - getterMap_.add(JOB_NUMBER, RPTA0100_, "receiverVariable.jobNumber"); - } - - -/** -Attribute ID for job queue status. This identifies a read-only Boolean -attribute, which indicates whether the writer is on a job queue. -**/ - public static final String JOB_QUEUE_STATUS = "JOB_QUEUE_STATUS"; - - static { - attributes_.add(JOB_QUEUE_STATUS, Boolean.class, true); - getterMap_.add(JOB_QUEUE_STATUS, RPTA0100_, "receiverVariable.onJobQueueStatus", booleanValueMapNY_); - } - - - -/** -Attribute ID for message key. This identifies a read-only byte array -attribute, which represents the message key for the message that -the writer is waiting for a reply, or all 0x00's if the writer is not -waiting for a reply to an inquiry message. -**/ - public static final String MESSAGE_KEY = "MESSAGE_KEY"; - - static { - attributes_.add(MESSAGE_KEY, byte[].class, true); - getterMap_.add(MESSAGE_KEY, RPTA0100_, "receiverVariable.messageKey"); - } - - - -/** -Attribute ID for message option. This identifies a read-only String -attribute, which represents an option for sending a message to the -message queue when this form is finished. -Possible values are: -
      -
    • {@link #MESSAGE_OPTION_MESSAGE MESSAGE_OPTION_MESSAGE} - - A message is sent to the message queue. -
    • {@link #MESSAGE_OPTION_NO_MESSAGE MESSAGE_OPTION_NO_MESSAGE} - - No message is sent to the message queue. -
    • {@link #MESSAGE_OPTION_INFORMATIONAL_MESSAGE MESSAGE_OPTION_INFORMATIONAL_MESSAGE} - - An informational message is sent to the message queue. -
    • {@link #MESSAGE_OPTION_INQUIRY_MESSAGE MESSAGE_OPTION_INQUIRY_MESSAGE} - - An inquiry message is sent to the message queue. -
    • "" - The writer is ended. -
    -**/ - public static final String MESSAGE_OPTION = "MESSAGE_OPTION"; - - /** - Attribute value indicating that a message is sent to the message queue when - this form is finished. - - @see #MESSAGE_OPTION - **/ - public static final String MESSAGE_OPTION_MESSAGE = "*MSG"; - - /** - Attribute value indicating that no message is sent to the message queue when - this form is finished. - - @see #MESSAGE_OPTION - **/ - public static final String MESSAGE_OPTION_NO_MESSAGE = "*NOMSG"; - - /** - Attribute value indicating that an informational message is sent to the message queue when - this form is finished. - - @see #MESSAGE_OPTION - **/ - public static final String MESSAGE_OPTION_INFORMATIONAL_MESSAGE = "*INFOMSG"; - - /** - Attribute value indicating that an inquiry message is sent to the message queue when - this form is finished. - - @see #MESSAGE_OPTION - **/ - public static final String MESSAGE_OPTION_INQUIRY_MESSAGE = "*INQMSG"; - - static { - attributes_.add(MESSAGE_OPTION, String.class, true, - new Object[] {MESSAGE_OPTION_MESSAGE, - MESSAGE_OPTION_NO_MESSAGE, - MESSAGE_OPTION_INFORMATIONAL_MESSAGE, - MESSAGE_OPTION_INQUIRY_MESSAGE, ""} , - null, true); - getterMap_.add(MESSAGE_OPTION, RPTA0100_, "receiverVariable.messageOption"); - } - - - -/** -Attribute ID for message queue. This identifies a read-only String attribute, -which represents the fully qualified integrated file system path name -of the message queue that this writer uses for operational messages. - -@see com.ibm.as400.access.QSYSObjectPathName -**/ - public static final String MESSAGE_QUEUE = "MESSAGE_QUEUE"; - - static { - attributes_.add(MESSAGE_QUEUE, String.class, true); - getterMap_.add(MESSAGE_QUEUE, RPTA0100_, "receiverVariable.messageQueue", - new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "MSGQ")); - } - - - -/** -Attribute ID for next file separators. This identifies a read-only Integer -attribute, which represents the next number of separator pages to be printed -when the change to the writer takes place. -Possible values are: -
      -
    • {@link #SEPARATOR_PAGE_FILE SEPARATOR_PAGE_FILE} - - The number of separator pages is specified by each file. -
    • {@link #SEPARATOR_PAGE_NONE SEPARATOR_PAGE_NONE} - - There are no pending changes to the writer. -
    • The number of separator pages to be printed. -
    -**/ - public static final String NEXT_FILE_SEPARATORS = "NEXT_FILE_SEPARATORS"; - - static { - attributes_.add(NEXT_FILE_SEPARATORS, Integer.class, true, - new Object[] {SEPARATOR_PAGE_FILE, SEPARATOR_PAGE_NONE} , - null, false); - getterMap_.add(NEXT_FILE_SEPARATORS, RPTA0100_, "receiverVariable.nextFileSeparators"); - } - - - -/** -Attribute ID for next form type. This identifies a read-only String -attribute, which represents the next type of form to be printed. -Possible values are: -
      -
    • {@link #FORM_TYPE_ALL FORM_TYPE_ALL} - - The writer is changed with the option to print all spooled - files of any form type. -
    • {@link #FORM_TYPE_FORMS FORM_TYPE_FORMS} - - The writer is changed with the option to print all spooled files - with the same form type before using a different form type. -
    • {@link #FORM_TYPE_STANDARD FORM_TYPE_STANDARD} - - The writer is changed with the option to print all spooled files - with a form type of *STD. -
    • A form type name - The writer is changed with the option - to print all spooled files with the specified form type. -
    • "" - No change has been made to this writer. -
    -**/ - public static final String NEXT_FORM_TYPE = "NEXT_FORM_TYPE"; - - static { - attributes_.add(NEXT_FORM_TYPE, String.class, true, - new Object[] {FORM_TYPE_ALL, - FORM_TYPE_FORMS, - FORM_TYPE_STANDARD} , - null, false); - getterMap_.add(NEXT_FORM_TYPE, RPTA0100_, "receiverVariable.nextFormType"); - } - - - -/** -Attribute ID for next message option. This identifies a read-only String -attribute, which represents the option for sending a message to the -message queue when the next form type is finished. -Possible values are: -
      -
    • {@link #MESSAGE_OPTION_MESSAGE MESSAGE_OPTION_MESSAGE} - - A message is sent to the message queue. -
    • {@link #MESSAGE_OPTION_NO_MESSAGE MESSAGE_OPTION_NO_MESSAGE} - - No message is sent to the message queue. -
    • {@link #MESSAGE_OPTION_INFORMATIONAL_MESSAGE MESSAGE_OPTION_INFORMATIONAL_MESSAGE} - - An informational message is sent to the message queue. -
    • {@link #MESSAGE_OPTION_INQUIRY_MESSAGE MESSAGE_OPTION_INQUIRY_MESSAGE} - - An inquiry message is sent to the message queue. -
    • "" - No change is pending. -
    -**/ - public static final String NEXT_MESSAGE_OPTION = "NEXT_MESSAGE_OPTION"; - - static { - attributes_.add(NEXT_MESSAGE_OPTION, String.class, true, - new Object[] {MESSAGE_OPTION_MESSAGE, - MESSAGE_OPTION_NO_MESSAGE, - MESSAGE_OPTION_INFORMATIONAL_MESSAGE, - MESSAGE_OPTION_INQUIRY_MESSAGE, - ""} , - null, true); - getterMap_.add(NEXT_MESSAGE_OPTION, RPTA0100_, "receiverVariable.nextMessageOption"); - } - - - -/** -Attribute ID for next output queue. This identifies a read-only String attribute, -which represents the fully qualified integrated file system path name -of the next output queue to be processed, or "" if no changes have been made to the writer. - -@see com.ibm.as400.access.QSYSObjectPathName -**/ - public static final String NEXT_OUTPUT_QUEUE = "NEXT_OUTPUT_QUEUE"; - - static { - attributes_.add(NEXT_OUTPUT_QUEUE, String.class, true); - getterMap_.add(NEXT_OUTPUT_QUEUE, RPTA0100_, "receiverVariable.nextOutputQueue", - new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "OUTQ")); - } - - - -/** -Attribute ID for next separator drawer. This identifies a read-only Integer -attribute, which represents the drawer from which the job and file separator -pages are to be taken if there is a change to the writer. -Possible values are: -
      -
    • {@link #SEPARATOR_PAGE_FILE SEPARATOR_PAGE_FILE} - - The separator pages are taken from the same drawer that the file - is printed from. -
    • {@link #SEPARATOR_PAGE_DEVICE SEPARATOR_PAGE_DEVICE} - - The separator pages are taken from the separator drawer specified - in the printer device description. -
    • {@link #SEPARATOR_PAGE_NONE SEPARATOR_PAGE_NONE} - - There are no pending changes to the writer. -
    • A drawer number. -
    -**/ - public static final String NEXT_SEPARATOR_DRAWER = "NEXT_SEPARATOR_DRAWER"; - - static { - attributes_.add(NEXT_SEPARATOR_DRAWER, Integer.class, true, - new Object[] {SEPARATOR_PAGE_FILE, SEPARATOR_PAGE_DEVICE, SEPARATOR_PAGE_NONE } , - null, false); - getterMap_.add(NEXT_SEPARATOR_DRAWER, RPTA0100_, "receiverVariable.nextSeparatorDrawer"); - } - - - - -/** -Attribute ID for number of separators. This identifies a Integer -attribute, which represents the number of separator pages to be printed. -Possible values are: -
      -
    • {@link #SEPARATOR_PAGE_FILE SEPARATOR_PAGE_FILE} - - The number of separator pages is specified by each file. -
    • The number of separator pages. -
    -**/ - public static final String NUMBER_OF_SEPARATORS = "NUMBER_OF_SEPARATORS"; - - static { - attributes_.add(NUMBER_OF_SEPARATORS, Integer.class, false, - new Object[] {SEPARATOR_PAGE_FILE } , - null, false); - getterMap_.add(NUMBER_OF_SEPARATORS, RPTA0100_, "receiverVariable.numberOfSeparators"); - setterMap_.add(NUMBER_OF_SEPARATORS, CHGWTR_, "FILESEP", separatorValueMap_); - } - - - -/** -Attribute ID for output queue. This identifies a String attribute, -which represents the fully qualified integrated file system path name -of the output queue from which the spooled files are being selected for -printing. - -@see com.ibm.as400.access.QSYSObjectPathName -**/ - public static final String OUTPUT_QUEUE = "OUTPUT_QUEUE"; - - static { - attributes_.add(OUTPUT_QUEUE, String.class, false); - getterMap_.add(OUTPUT_QUEUE, RPTA0100_, "receiverVariable.outputQueue", - new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "OUTQ")); - setterMap_.add(OUTPUT_QUEUE, CHGWTR_, "OUTQ", - new QualifiedValueMap(QualifiedValueMap.FORMAT_CL, "OUTQ")); - } - - - -/** -Attribute ID for output queue status. This identifies a read-only String -attribute, which represents the status of the output queue from which spooled -files are being selected for printing. -Possible values are: -
      -
    • {@link #STATUS_HELD STATUS_HELD} - - The output queue is held. -
    • {@link #STATUS_RELEASED STATUS_RELEASED} - - The output queue is released. -
    • "" - The output queue is not set. -
    -**/ - public static final String OUTPUT_QUEUE_STATUS = "OUTPUT_QUEUE_STATUS"; - - static { - attributes_.add(OUTPUT_QUEUE_STATUS, String.class, true, - new Object[] {STATUS_HELD, STATUS_RELEASED, "" } , - null, true); - getterMap_.add(OUTPUT_QUEUE_STATUS, RPTA0100_, "receiverVariable.outputQueueStatus"); - } - - - -/** -Attribute ID for overall status. This identifies a read-only Integer -attribute, which represents the overall status of the logical printer. -**/ - public static final String OVERALL_STATUS = "OVERALL_STATUS"; - - static { - attributes_.add(OVERALL_STATUS, Integer.class, true); - getterMap_.add(OVERALL_STATUS, RPTA0100_, "receiverVariable.overallStatus"); - } - - - -/** -Attribute ID for page being written. This identifies a read-only Integer -attribute, which represents the page number in the spooled file that is -currently being processed by the writer, or 0 if no spooled file is -printing. -**/ - public static final String PAGE_BEING_WRITTEN = "PAGE_BEING_WRITTEN"; - - static { - attributes_.add(PAGE_BEING_WRITTEN, Integer.class, true); - getterMap_.add(PAGE_BEING_WRITTEN, RPTA0100_, "receiverVariable.pageBeingWritten"); - } - - - -/** -Attribute ID for published status. This identifies a read-only Boolean -attribute, which indicates whether the printer is published. This attribute -is supported only when connecting to systems running OS/400 V5R1 or later. -**/ - public static final String PUBLISHED_STATUS = "PUBLISHED_STATUS"; - - static { - ResourceLevel level = new ResourceLevel(ResourceLevel.V5R1M0); - ResourceMetaData rmd = attributes_.add(PUBLISHED_STATUS, Boolean.class, true); - rmd.setLevel(level); - getterMap_.add(PUBLISHED_STATUS, RPTA0100_, "receiverVariable.waitingForDataStatus", booleanValueMapNY_, level); - } - - - -/** -Attribute ID for separator drawer. This identifies a Integer -attribute, which represents the drawer from which the job and file separator -pages are to be taken. -Possible values are: -
      -
    • {@link #SEPARATOR_PAGE_FILE SEPARATOR_PAGE_FILE} - - The separator pages are taken from the same drawer that the file - is printed from. -
    • {@link #SEPARATOR_PAGE_DEVICE SEPARATOR_PAGE_DEVICE} - - The separator pages are taken from the separator drawer specified - in the printer device description. -
    • A drawer number. -
    -**/ - public static final String SEPARATOR_DRAWER = "SEPARATOR_DRAWER"; - - static { - attributes_.add(SEPARATOR_DRAWER, Integer.class, false, - new Object[] {SEPARATOR_PAGE_FILE, SEPARATOR_PAGE_DEVICE} , - null, false); - getterMap_.add(SEPARATOR_DRAWER, RPTA0100_, "receiverVariable.drawerForSeparators"); - setterMap_.add(SEPARATOR_DRAWER, CHGWTR_, "SEPDRAWER", separatorValueMap_); - } - - - -/** -Attribute ID for spooled file name. This identifies a read-only String -attribute, which represents the name of the spooled file currently -being processed by the writer, or "" if no spooled file is printing. -**/ - public static final String SPOOLED_FILE_NAME = "SPOOLED_FILE_NAME"; - - static { - attributes_.add(SPOOLED_FILE_NAME, String.class, true); - getterMap_.add(SPOOLED_FILE_NAME, RPTA0100_, "receiverVariable.spooledFileName"); - } - - - -/** -Attribute ID for spooled file number. This identifies a read-only Integer -attribute, which represents the number of the spooled file currently -being processed by the writer, or 0 if no spooled file is printing. -**/ - public static final String SPOOLED_FILE_NUMBER = "SPOOLED_FILE_NUMBER"; - - static { - attributes_.add(SPOOLED_FILE_NUMBER, Integer.class, true); - getterMap_.add(SPOOLED_FILE_NUMBER, RPTA0100_, "receiverVariable.spooledFileNumber"); - } - - - -/** -Attribute ID for started by user. This identifies a read-only String -attribute, which represents the name of the user that started the writer. -**/ - public static final String STARTED_BY_USER = "STARTED_BY_USER"; - - static { - attributes_.add(STARTED_BY_USER, String.class, true); - getterMap_.add(STARTED_BY_USER, RPTA0100_, "receiverVariable.startedByUser"); - } - - - -/** -Attribute ID for text description. This identifies a String -attribute, which represents the text description of the printer device. -**/ - public static final String TEXT_DESCRIPTION = "TEXT_DESCRIPTION"; - - static { - attributes_.add(TEXT_DESCRIPTION, String.class, false); - getterMap_.add(TEXT_DESCRIPTION, RPTA0100_, "receiverVariable.textDescription"); - setterMap_.add(TEXT_DESCRIPTION, CHGDEVPRT_, "TEXT", quoteValueMapBlank_); - } - - - -/** -Attribute ID for total copies. This identifies a read-only Integer -attribute, which represents the total number of copies to be printed. -**/ - public static final String TOTAL_COPIES = "TOTAL_COPIES"; - - static { - attributes_.add(TOTAL_COPIES, Integer.class, true); - getterMap_.add(TOTAL_COPIES, RPTA0100_, "receiverVariable.totalCopies"); - } - - - -/** -Attribute ID for total pages. This identifies a read-only Integer -attribute, which represents the total number of pages in the spooled -file, or 0 if no spooled file is printing. -**/ - public static final String TOTAL_PAGES = "TOTAL_PAGES"; - - static { - attributes_.add(TOTAL_PAGES, Integer.class, true); - getterMap_.add(TOTAL_PAGES, RPTA0100_, "receiverVariable.totalPages"); - } - - - -/** -Attribute ID for user name. This identifies a read-only String -attribute, which represents the name of the user who created the spooled -file currently being processed by the writer, or "" if no spooled -file is printing. -**/ - public static final String USER_NAME = "USER_NAME"; - - static { - attributes_.add(USER_NAME, String.class, true); - getterMap_.add(USER_NAME, RPTA0100_, "receiverVariable.userName"); - } - - - -/** -Attribute ID for waiting for data status. This identifies a read-only Boolean -attribute, which indicates whether the writer has written all of the data -currently in the spooled file and is waiting for more data. -**/ - public static final String WAITING_FOR_DATA_STATUS = "WAITING_FOR_DATA_STATUS"; - - static { - attributes_.add(WAITING_FOR_DATA_STATUS, Boolean.class, true); - getterMap_.add(WAITING_FOR_DATA_STATUS, RPTA0100_, "receiverVariable.waitingForDataStatus", booleanValueMapNY_); - } - - - -/** -Attribute ID for waiting for device status. This identifies a read-only Boolean -attribute, which indicates whether the writer is waiting to get the device -from a job that is printing directly to the printer. -**/ - public static final String WAITING_FOR_DEVICE_STATUS = "WAITING_FOR_DEVICE_STATUS"; - - static { - attributes_.add(WAITING_FOR_DEVICE_STATUS, Boolean.class, true); - getterMap_.add(WAITING_FOR_DEVICE_STATUS, RPTA0100_, "receiverVariable.waitingForDeviceStatus", booleanValueMapNY_); - } - - - -/** -Attribute ID for waiting for message status. This identifies a read-only Boolean -attribute, which indicates whether the writer is waiting for a reply to an -inquiry message. -**/ - public static final String WAITING_FOR_MESSAGE_STATUS = "WAITING_FOR_MESSAGE_STATUS"; - - static { - attributes_.add(WAITING_FOR_MESSAGE_STATUS, Boolean.class, true); - getterMap_.add(WAITING_FOR_MESSAGE_STATUS, RPTA0100_, "receiverVariable.waitingForMessageStatus", booleanValueMapNY_); - } - - - -/** -Attribute ID for writer job name. This identifies a read-only String -attribute, which represents the job name of the printer writer. -**/ - public static final String WRITER_JOB_NAME = "WRITER_JOB_NAME"; - - static { - attributes_.add(WRITER_JOB_NAME, String.class, true); - getterMap_.add(WRITER_JOB_NAME, RPTA0100_, "receiverVariable.writerJobName"); - } - - - -/** -Attribute ID for writer job number. This identifies a read-only String -attribute, which represents the job number of the printer writer. -**/ - public static final String WRITER_JOB_NUMBER = "WRITER_JOB_NUMBER"; - - static { - attributes_.add(WRITER_JOB_NUMBER, String.class, true); - getterMap_.add(WRITER_JOB_NUMBER, RPTA0100_, "receiverVariable.writerJobNumber"); - } - - - -/** -Attribute ID for writer job user name. This identifies a read-only String -attribute, which represents the the name of the system user. -**/ - public static final String WRITER_JOB_USER_NAME = "WRITER_JOB_USER_NAME"; - - static { - attributes_.add(WRITER_JOB_USER_NAME, String.class, true); - getterMap_.add(WRITER_JOB_USER_NAME, RPTA0100_, "receiverVariable.writerJobUserName"); - } - - - -/** -Attribute ID for waiting for device status. This identifies a read-only Boolean -attribute, which indicates whether a writer is started for this printer. -**/ - public static final String WRITER_STARTED = "WRITER_STARTED"; - - static { - attributes_.add(WRITER_STARTED, Boolean.class, true); - getterMap_.add(WRITER_STARTED, RPTA0100_, "receiverVariable.writerStarted", booleanValueMap01_); - } - - - -/** -Attribute ID for writer status. This identifies a read-only byte[] -attribute, which represents the status of the writer for this printer. -Possible values are: -
      -
    • {@link #WRITER_STATUS_STARTED WRITER_STATUS_STARTED} - - The writer is started. -
    • {@link #WRITER_STATUS_ENDED WRITER_STATUS_ENDED} - - The writer is ended. -
    • {@link #WRITER_STATUS_JOB_QUEUE WRITER_STATUS_JOB_QUEUE} - - The writer is on a job queue. -
    • {@link #WRITER_STATUS_HELD WRITER_STATUS_HELD} - - The writer is held. -
    • {@link #WRITER_STATUS_MESSAGE_WAITING WRITER_STATUS_MESSAGE_WAITING} - - The writer is waiting on a message. -
    -**/ - public static final String WRITER_STATUS = "WRITER_STATUS"; - - /** - Attribute value indicating that the writer is started. - - @see #WRITER_STATUS - **/ - public static final byte[] WRITER_STATUS_STARTED = new byte[] {((byte)0x01)}; - - /** - Attribute value indicating that the writer is ended. - - @see #WRITER_STATUS - **/ - public static final byte[] WRITER_STATUS_ENDED = new byte[] {((byte)0x02)}; - - /** - Attribute value indicating that the writer is on a job queue. - - @see #WRITER_STATUS - **/ - public static final byte[] WRITER_STATUS_JOB_QUEUE = new byte[] {((byte)0x03)}; - - /** - Attribute value indicating that the writer is held. - - @see #WRITER_STATUS - **/ - public static final byte[] WRITER_STATUS_HELD = new byte[] {((byte)0x04)}; - - /** - Attribute value indicating that the writer is waiting on a message. - - @see #WRITER_STATUS - **/ - public static final byte[] WRITER_STATUS_MESSAGE_WAITING = new byte[] {((byte)0x05)}; - - static { - attributes_.add(WRITER_STATUS, byte[].class, true, - new Object[] {WRITER_STATUS_STARTED, - WRITER_STATUS_ENDED, - WRITER_STATUS_JOB_QUEUE, - WRITER_STATUS_HELD, - WRITER_STATUS_MESSAGE_WAITING} , - null, true); - getterMap_.add(WRITER_STATUS, RPTA0100_, "receiverVariable.writerStatus"); - } - - - -/** -Attribute ID for writing status. This identifies a read-only String -attribute, which indicates whether the printer writer is in writing -status. -Possible values are: -
      -
    • {@link #WRITING_STATUS_YES WRITING_STATUS_YES} - - The writer is in writing status. -
    • {@link #WRITING_STATUS_NO WRITING_STATUS_NO} - - The writer is not in writing status. -
    • {@link #WRITING_STATUS_SEPARATORS WRITING_STATUS_SEPARATORS} - - The writer is writing the file separators. -
    • "" - The writer is ended. -
    -**/ - public static final String WRITING_STATUS = "WRITING_STATUS"; - - /** - Attribute value indicating that the writer is in writing status. - - @see #WRITING_STATUS - **/ - public static final String WRITING_STATUS_YES = "Y"; - - /** - Attribute value indicating that the writer is not in writing status. - - @see #WRITING_STATUS - **/ - public static final String WRITING_STATUS_NO = "N"; - - /** - Attribute value indicating that the writer is writing the file separators. - - @see #WRITING_STATUS - **/ - public static final String WRITING_STATUS_SEPARATORS = "S"; - - static { - attributes_.add(WRITING_STATUS, String.class, true, - new Object[] {WRITING_STATUS_YES, - WRITING_STATUS_NO, - WRITING_STATUS_SEPARATORS, - ""} , - null, true); - getterMap_.add(WRITING_STATUS, RPTA0100_, "receiverVariable.writingStatus"); - } - - - -//----------------------------------------------------------------------------------------- -// PCML document initialization. -//----------------------------------------------------------------------------------------- - - private static final String DOCUMENT_NAME_ = "com.ibm.as400.resource.RPrinter"; - private static ProgramCallDocument staticDocument_ = null; - - static { - // Create a static version of the PCML document, then clone it for each document. - // This will improve performance, since we will only have to deserialize the PCML - // object once. - try { - staticDocument_ = new ProgramCallDocument(); - staticDocument_.setDocument(DOCUMENT_NAME_); - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error instantiating ProgramCallDocument", e); - } - } - - - -//----------------------------------------------------------------------------------------- -// Private data. -//----------------------------------------------------------------------------------------- - - private String name_ = null; - - private ProgramAttributeGetter attributeGetter_ = null; - private CommandAttributeSetter attributeSetter_ = null; - - - -//----------------------------------------------------------------------------------------- -// Constructors. -//----------------------------------------------------------------------------------------- - -/** -Constructs an RPrinter object. -**/ - public RPrinter() - { - super(presentationLoader_.getPresentationWithIcon(PRESENTATION_KEY_, ICON_BASE_NAME_), null, attributes_); - } - - - -/** -Constructs an RPrinter object. - -@param system The system. -@param name The printer device name. -**/ - public RPrinter(AS400 system,String name) - { - this(); - - try { - setSystem(system); - setName(name); - } - catch(PropertyVetoException e) { - // Ignore. - } - } - - - -// @A2C -/** -Commits the specified attribute changes. - -@param attributeIDs The attribute IDs for the specified attribute changes. -@param values The specified attribute changes -@param bidiStringTypes The bidi string types as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. - -@exception ResourceException If an error occurs. -**/ - protected void commitAttributeChanges(Object[] attributeIDs, Object[] values, int[] bidiStringTypes) - throws ResourceException - { - super.commitAttributeChanges(attributeIDs, values, bidiStringTypes); - - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); - - attributeSetter_.setValues(attributeIDs, values, bidiStringTypes); // @A2C - } - - - - -/** -Computes a resource key. - -@param system The system. -@param name The user profile name. -@return The resource key. -**/ - static Object computeResourceKey(AS400 system, String name) - { - StringBuffer buffer = new StringBuffer(); - buffer.append(RPrinter.class); - buffer.append(':'); - buffer.append(system.getSystemName()); - buffer.append(':'); - buffer.append(system.getUserId()); - buffer.append(':'); - buffer.append(name); - return buffer.toString(); - } - - - -/** -Establishes the connection to the system. - -

    The method is called by the resource framework automatically -when the connection needs to be established. - -@exception ResourceException If an error occurs. -**/ - protected void establishConnection() - throws ResourceException - { - // Validate if we can establish the connection. - if (name_ == null) - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - // Update the PCML document. - String nameUpper = name_.toUpperCase(); - AS400 system = getSystem(); - ProgramCallDocument document = (ProgramCallDocument)staticDocument_.clone(); - try { - document.setSystem(system); - document.setValue("qgyrprta_rpta0100.deviceName", nameUpper); - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error setting PCML document values", e); - } - - // Initialize the attribute getter. - attributeGetter_ = new ProgramAttributeGetter(system, document, getterMap_); - - // Initialize the attribute setter. - attributeSetter_ = new CommandAttributeSetter(system, setterMap_); - attributeSetter_.setParameterValue(CHGWTR_, WTR_PARAMETER_, nameUpper); - attributeSetter_.setParameterValue(CHGDEVPRT_, DEVD_PARAMETER_, nameUpper); - - // Call the superclass. - super.establishConnection(); - } - - -/** -Freezes any property changes. After this is called, property -changes should not be made. Properties are not the same thing -as attributes. Properties are basic pieces of information -which must be set to make the object usable, such as the system -and the name. - -

    The method is called by the resource framework automatically -when the properties need to be frozen. - -@exception ResourceException If an error occurs. -**/ - protected void freezeProperties() - throws ResourceException - { - // Validate if we can establish the connection. - if (name_ == null) - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - // Update the presentation. - Presentation presentation = getPresentation(); - presentation.setName(name_); - - // Update the resource key. - if (getResourceKey() == null) - setResourceKey(computeResourceKey(getSystem(), name_)); - - // Call the superclass. - super.freezeProperties(); - } - - - -// @A2C -/** -Returns the unchanged value of an attribute. If the attribute -value has an uncommitted change, this returns the unchanged value. -If the attribute value does not have an uncommitted change, this -returns the same value as getAttributeValue(). - -@param attributeID Identifies the attribute. -@param bidiStringType The bidi string type as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. -@return The attribute value, or null if the attribute - value is not available. - -@exception ResourceException If an error occurs. -**/ - public Object getAttributeUnchangedValue(Object attributeID, int bidiStringType) - throws ResourceException - { - Object value = super.getAttributeUnchangedValue(attributeID, bidiStringType); - if (value == null) { - - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); - - value = attributeGetter_.getValue(attributeID, bidiStringType); - } - return value; - } - - - - -/** -Returns the printer device name. - -@return The printer device name. -**/ - public String getName() - { - return name_; - } - - - -// @A2A -/** -Indicates if this resource is enabled for bidirectional character conversion. -This always returns true. - -@return Always true. -**/ - protected boolean isBidiEnabled() - { - return true; - } - - - -/** -Refreshes the values for all attributes. This does not cancel -uncommitted changes. This method fires an attributeValuesRefreshed() -ResourceEvent. - -@exception ResourceException If an error occurs. -**/ - public void refreshAttributeValues() - throws ResourceException - { - super.refreshAttributeValues(); - - if (attributeGetter_ != null) - attributeGetter_.clearBuffer(); - } - - - -/** -Sets the printer device name. This does not change the printer on -the system. Instead, it changes the printer to which -this object references. This cannot be changed -if the object has established a connection to the system. - -@param name The printer device name. - -@exception PropertyVetoException If the property change is vetoed. -**/ - public void setName(String name) - throws PropertyVetoException - { - if (name == null) - throw new NullPointerException("name"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - String oldValue = name_; - fireVetoableChange("name", oldValue, name); - name_ = name; - firePropertyChange("name", oldValue, name); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/RPrinter.pcml b/cvsroot/src/com/ibm/as400/resource/RPrinter.pcml deleted file mode 100644 index ea4b0759b..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RPrinter.pcml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/resource/RPrinter16.gif b/cvsroot/src/com/ibm/as400/resource/RPrinter16.gif deleted file mode 100644 index 30d95b254..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RPrinter16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RPrinter32.gif b/cvsroot/src/com/ibm/as400/resource/RPrinter32.gif deleted file mode 100644 index adb8aaec1..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RPrinter32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RPrinterBeanInfo.java b/cvsroot/src/com/ibm/as400/resource/RPrinterBeanInfo.java deleted file mode 100644 index c20ea37c6..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RPrinterBeanInfo.java +++ /dev/null @@ -1,155 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RPrinterBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Trace; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.util.ResourceBundle; - - - -/** -The RPrinterBeanInfo class represents the bean information -for the RPrinter class. -@deprecated Use com.ibm.as400.access.Printer instead. -**/ -public class RPrinterBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final Class beanClass_ = RPrinter.class; - - private static BeanInfo[] additionalBeanInfo_; - private static BeanDescriptor beanDescriptor_; - private static Image icon16_; - private static Image icon32_; - private static PropertyDescriptor[] propertyDescriptors_; - private static ResourceBundle resourceBundle_; - - - -/** -Static initializer. -**/ - static - { - try - { - // Set up the resource bundle. - resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.resource.ResourceMRI"); - - // Set up the additional bean info. - additionalBeanInfo_ = new BeanInfo[] { new ResourceBeanInfo() }; - - // Set up the bean descriptor. - beanDescriptor_ = new BeanDescriptor(beanClass_); - - // Set up the property descriptors. - PropertyDescriptor name = new PropertyDescriptor("name", beanClass_); - name.setBound(true); - name.setConstrained(true); - name.setDisplayName(resourceBundle_.getString("PROPERTY_NAME_NAME")); - name.setShortDescription(resourceBundle_.getString("PROPERTY_NAME_DESCRIPTION")); - - propertyDescriptors_ = new PropertyDescriptor[] { name }; - - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error while loading bean info", e); - throw new Error(e.toString()); - } - } - - - -/** -Returns the additional bean information. - -@return The additional bean information. -**/ - public BeanInfo[] getAdditionalBeanInfo() - { - return additionalBeanInfo_; - } - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - - -/** -Returns the property descriptors. - -@return The property descriptors. -**/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors_; - } - - - -/** -Returns the icon. - -@param icon The icon kind. Possible values are: -

      -
    • BeanInfo.ICON_MONO_16x16 -
    • BeanInfo.ICON_MONO_32x32 -
    • BeanInfo.ICON_COLOR_16x16 -
    • BeanInfo.ICON_COLOR_32x32 -
    -@return The icon. -**/ - public Image getIcon(int icon) - { - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - if (icon16_ == null) - icon16_ = loadImage("RPrinter16.gif"); - return icon16_; - - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - if (icon32_ == null) - icon32_ = loadImage("RPrinter32.gif"); - return icon32_; - - default: - throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/RPrinterList.java b/cvsroot/src/com/ibm/as400/resource/RPrinterList.java deleted file mode 100644 index 44a0b31b4..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RPrinterList.java +++ /dev/null @@ -1,333 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RPrinterList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.QSYSObjectPathName; -import com.ibm.as400.access.Trace; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.beans.PropertyVetoException; - - - -/** -The RPrinterList class represents a list of printers that are attached to the system. - -

    The following selection IDs are supported: -

      -
    • {@link #PRINTER_NAMES PRINTER_NAMES} -
    • {@link #OUTPUT_QUEUES OUTPUT_QUEUES} -
    -
    - -

    Use one or more of these selection IDs with -{@link com.ibm.as400.resource.ResourceList#getSelectionValue getSelectionValue()} -and {@link com.ibm.as400.resource.ResourceList#setSelectionValue setSelectionValue()} -to access the selection values for an RPrinterList. - -

    RPrinterList objects generate {@link com.ibm.as400.resource.RPrinter RPrinter} objects. - -

    -// Create an RPrinterList object to represent a list of printers.
    -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -RPrinterList printerList = new RPrinterList(system);
    -
    -// Set the selection so that only printers which are selecting -// spooled files from the listed output queues are included -// in the list. -printerList.setSelectionValue(RPrinterList.OUTPUT_QUEUES, - new String[] { "/QSYS.LIB/MYLIB.LIB/MYOUTQ1.OUTQ1", - "/QSYS.LIB/MYLIB.LIB/MYOUTQ2.OUTQ2" }); -
    -// Open the list and wait for it to complete. -printerList.open(); -printerList.waitForComplete(); -
    -// Read and print the device names and statuses -// for the printers in the list. -long numberOfPrinters = printerList.getListLength(); -for(long i = 0; i < numberOfPrinters; ++i) -{ - RPrinter printer = (RPrinter)printerList.resourceAt(i); - System.out.println(printer.getAttributeValue(RPrinter.DEVICE_NAME)); - System.out.println(printer.getAttributeValue(RPrinter.DEVICE_STATUS)); - System.out.println(); -} -
    -// Close the list. -printerList.close(); -
    - -@deprecated Use -{@link com.ibm.as400.access.PrinterList PrinterList} instead, as this package may be removed in the future. -@see RPrinter -**/ -public class RPrinterList -extends SystemResourceList -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - -//----------------------------------------------------------------------------------------- -// Presentation. -//----------------------------------------------------------------------------------------- - - private static final String PRESENTATION_KEY_ = "PRINTER_LIST"; - private static final String ICON_BASE_NAME_ = "RPrinterList"; - private static PresentationLoader presentationLoader_ = new PresentationLoader("com.ibm.as400.resource.ResourceMRI"); - - - - -//----------------------------------------------------------------------------------------- -// Selection IDs. -// -// * If you add a selection here, make sure and add it to the class javadoc -// and in ResourceMRI.java. -//----------------------------------------------------------------------------------------- - - private static ResourceMetaDataTable selections_ = new ResourceMetaDataTable(presentationLoader_, PRESENTATION_KEY_); - - - -/** -Selection ID for printer names. This identifies a String selection, -which represents the name(s) to be included in the list. -**/ - public static final String PRINTER_NAMES = "PRINTER_NAMES"; - - static { - selections_.add(PRINTER_NAMES, String.class, false, null, null, false, true); - } - - - -/** -Selection ID for output queues. This identifies a String selection, -which represents the output queues(s) to be included in the list. -**/ - public static final String OUTPUT_QUEUES = "OUTPUT_QUEUES"; - - static { - selections_.add(OUTPUT_QUEUES, String.class, false, null, null, false, true); - } - - - -//----------------------------------------------------------------------------------------- -// Open list attribute map. -//----------------------------------------------------------------------------------------- - - private static ProgramMap openListAttributeMap_ = new ProgramMap(); - private static final String openListProgramName_ = "qgyrprtl"; - - static { - ValueMap boolean01Map = new BooleanValueMap("0", "1"); - openListAttributeMap_.add(RPrinter.DEVICE_NAME, null, "receiverVariable.deviceName"); - openListAttributeMap_.add(RPrinter.TEXT_DESCRIPTION, null, "receiverVariable.textDescription"); - openListAttributeMap_.add(RPrinter.OVERALL_STATUS, null, "receiverVariable.overallStatus"); - openListAttributeMap_.add(RPrinter.DEVICE_STATUS, null, "receiverVariable.deviceStatus"); - openListAttributeMap_.add(RPrinter.OUTPUT_QUEUE, null, "receiverVariable.outputQueue"); - openListAttributeMap_.add(RPrinter.OUTPUT_QUEUE_STATUS, null, "receiverVariable.outputQueueStatus"); - openListAttributeMap_.add(RPrinter.WRITER_STATUS, null, "receiverVariable.writerStatus"); - openListAttributeMap_.add(RPrinter.WRITER_STARTED, null, "receiverVariable.writerStarted", boolean01Map); - openListAttributeMap_.add(RPrinter.FORM_TYPE, null, "receiverVariable.formType"); - openListAttributeMap_.add(RPrinter.SPOOLED_FILE_NAME, null, "receiverVariable.currentFileName"); - openListAttributeMap_.add(RPrinter.USER_NAME, null, "receiverVariable.currentFileUser"); - openListAttributeMap_.add(RPrinter.PUBLISHED_STATUS, null, "receiverVariable.publishingStatus", boolean01Map, new ResourceLevel(ResourceLevel.V5R1M0)); - } - - - -//----------------------------------------------------------------------------------------- -// PCML document initialization. -//----------------------------------------------------------------------------------------- - - private static final String DOCUMENT_NAME_ = "com.ibm.as400.resource.RPrinterList"; - private static ProgramCallDocument staticDocument_ = null; - private static final String formatName_ = "prtl0200"; - - static { - // Create a static version of the PCML document, then clone it for each document. - // This will improve performance, since we will only have to deserialize the PCML - // object once. - try { - staticDocument_ = new ProgramCallDocument(); - staticDocument_.setDocument(DOCUMENT_NAME_); - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error instantiating ProgramCallDocument", e); - } - } - - - - -//----------------------------------------------------------------------------------------- -// Private data. -//----------------------------------------------------------------------------------------- - - private static final String deviceNameDataName_ = ".receiverVariable.deviceName"; - - - - -//----------------------------------------------------------------------------------------- -// Code. -//----------------------------------------------------------------------------------------- - -/** -Constructs an RPrinterList object. -**/ - public RPrinterList() - { - super(presentationLoader_.getPresentationWithIcon(PRESENTATION_KEY_, ICON_BASE_NAME_), - RPrinter.attributes_, - selections_, - null, - openListProgramName_, - formatName_, - null); - } - - - -/** -Constructs an RPrinterList object. - -@param system The system. -**/ - public RPrinterList(AS400 system) - { - this(); - try { - setSystem(system); - } - catch(PropertyVetoException e) { - // Ignore. - } - } - - - -/** -Establishes the connection to the system. - -

    The method is called by the resource framework automatically -when the connection needs to be established. - -@exception ResourceException If an error occurs. -**/ - protected void establishConnection() - throws ResourceException - { - // Call the superclass. - super.establishConnection(); - - // Initialize the PCML document. - setDocument((ProgramCallDocument)staticDocument_.clone()); - } - - - -//----------------------------------------------------------------------------------------- -// List implementation. -//----------------------------------------------------------------------------------------- - - void setOpenParameters(ProgramCallDocument document) - throws PcmlException, ResourceException - { - super.setOpenParameters(document); - - // Set the printer names. - Object printerNamesSV = getSelectionValue(RPrinterList.PRINTER_NAMES); - String[] printerNames; - if (printerNamesSV == null) - printerNames = new String[0]; - else if (printerNamesSV instanceof String) - printerNames = new String[] { (String)printerNamesSV }; - else - printerNames = (String[])printerNamesSV; - document.setIntValue("qgyrprtl.filterInformation.numberOfPrinterNames", printerNames.length); - for(int i = 0; i < printerNames.length; ++i) - document.setValue("qgyrprtl.filterInformation.printerName", new int[] { i }, printerNames[i].toUpperCase()); - - // Set the output queues. - Object outputQueuesSV = getSelectionValue(RPrinterList.OUTPUT_QUEUES); - String[] outputQueues; - if (outputQueuesSV == null) - outputQueues = new String[0]; - else if (outputQueuesSV instanceof String) - outputQueues = new String[] { (String)outputQueuesSV }; - else - outputQueues = (String[])outputQueuesSV; - document.setIntValue("qgyrprtl.filterInformation.numberOfOutputQueues", outputQueues.length); - for(int i = 0; i < outputQueues.length; ++i) { - QSYSObjectPathName path = new QSYSObjectPathName(outputQueues[i].toUpperCase()); - document.setValue("qgyrprtl.filterInformation.outputQueue.objectName", new int[] { i }, path.getObjectName()); - document.setValue("qgyrprtl.filterInformation.outputQueue.libraryName", new int[] { i }, path.getLibraryName()); - } - - } - - - - Resource newResource(String programName, int[] indices) - throws PcmlException, ResourceException - { - ProgramCallDocument document = getDocument(); - - String name = (String)document.getValue(programName + deviceNameDataName_, indices); - AS400 system = getSystem(); - Object resourceKey = RPrinter.computeResourceKey(system, name); - RPrinter resource = (RPrinter)ResourcePool.GLOBAL_RESOURCE_POOL.getResource(resourceKey); - if (resource == null) { - try { - resource = new RPrinter(system, name); - resource.setResourceKey(resourceKey); - resource.freezeProperties(); - } - catch(Exception e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Exception while creating printer from printer list", e); - throw new ResourceException(e); - } - } - - // Copy the information from the API record to the RPrinter attributes. - try { - Object[] attributeIDs = openListAttributeMap_.getIDs(ResourceLevel.vrmToLevel(system.getVRM())); - Object[] values = openListAttributeMap_.getValues(attributeIDs, system, document, programName, indices); - for(int i = 0; i < values.length; ++i) { - resource.initializeAttributeValue(attributeIDs[i], values[i]); - } - } - catch(Exception e) { - throw new ResourceException(e); - } - - return resource; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/RPrinterList.pcml b/cvsroot/src/com/ibm/as400/resource/RPrinterList.pcml deleted file mode 100644 index d7c317f44..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RPrinterList.pcml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/resource/RPrinterList16.gif b/cvsroot/src/com/ibm/as400/resource/RPrinterList16.gif deleted file mode 100644 index f2be9ec36..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RPrinterList16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RPrinterList32.gif b/cvsroot/src/com/ibm/as400/resource/RPrinterList32.gif deleted file mode 100644 index 30f70886a..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RPrinterList32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RPrinterListBeanInfo.java b/cvsroot/src/com/ibm/as400/resource/RPrinterListBeanInfo.java deleted file mode 100644 index ca4401454..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RPrinterListBeanInfo.java +++ /dev/null @@ -1,132 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RPrinterListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Trace; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.util.ResourceBundle; - - - -/** -The RPrinterListBeanInfo class represents the bean information -for the RPrinterList class. -@deprecated Use com.ibm.as400.access.PrinterList instead. -**/ -public class RPrinterListBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final Class beanClass_ = RPrinterList.class; - - private static BeanInfo[] additionalBeanInfo_; - private static BeanDescriptor beanDescriptor_; - private static Image icon16_; - private static Image icon32_; - private static ResourceBundle resourceBundle_; - - - -/** -Static initializer. -**/ - static - { - try - { - // Set up the resource bundle. - resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.resource.ResourceMRI"); - - // Set up the additional bean info. - additionalBeanInfo_ = new BeanInfo[] { new ResourceListBeanInfo() }; - - // Set up the bean descriptor. - beanDescriptor_ = new BeanDescriptor(beanClass_); - - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error while loading bean info", e); - throw new Error(e.toString()); - } - } - - - -/** -Returns the additional bean information. - -@return The additional bean information. -**/ - public BeanInfo[] getAdditionalBeanInfo() - { - return additionalBeanInfo_; - } - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - - -/** -Returns the icon. - -@param icon The icon kind. Possible values are: -

      -
    • BeanInfo.ICON_MONO_16x16 -
    • BeanInfo.ICON_MONO_32x32 -
    • BeanInfo.ICON_COLOR_16x16 -
    • BeanInfo.ICON_COLOR_32x32 -
    -@return The icon. -**/ - public Image getIcon(int icon) - { - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - if (icon16_ == null) - icon16_ = loadImage("RPrinterList16.gif"); - return icon16_; - - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - if (icon32_ == null) - icon32_ = loadImage("RPrinterList32.gif"); - return icon32_; - - default: - throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/RQueuedMessage.java b/cvsroot/src/com/ibm/as400/resource/RQueuedMessage.java deleted file mode 100644 index 7f51892dc..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RQueuedMessage.java +++ /dev/null @@ -1,562 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RQueuedMessage.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.*; -import java.util.Date; -import java.io.*; -import java.beans.PropertyVetoException; - - -/** -The RQueuedMessage class represents a message in a message queue -or job log. - -

    The following attribute IDs are supported: -

      -
    • {@link #ALERT_OPTION ALERT_OPTION} -
    • {@link #DATE_SENT DATE_SENT} -
    • {@link #DEFAULT_REPLY DEFAULT_REPLY} -
    • {@link #MESSAGE_FILE MESSAGE_FILE} -
    • {@link #MESSAGE_HELP MESSAGE_HELP} -
    • {@link #MESSAGE_ID MESSAGE_ID} -
    • {@link #MESSAGE_KEY MESSAGE_KEY} -
    • {@link #MESSAGE_QUEUE MESSAGE_QUEUE} -
    • {@link #MESSAGE_SEVERITY MESSAGE_SEVERITY} -
    • {@link #MESSAGE_TEXT MESSAGE_TEXT} -
    • {@link #MESSAGE_TYPE MESSAGE_TYPE} -
    • {@link #REPLY_STATUS REPLY_STATUS} -
    • {@link #SENDER_JOB_NAME SENDER_JOB_NAME} -
    • {@link #SENDER_USER_NAME SENDER_USER_NAME} -
    • {@link #SENDER_JOB_NUMBER SENDER_JOB_NUMBER} -
    • {@link #SENDING_PROGRAM_NAME SENDING_PROGRAM_NAME} -
    • {@link #SUBSTITUTION_DATA SUBSTITUTION_DATA} -
    -
    - -

    Use any of these attribute IDs with -{@link com.ibm.as400.resource.Resource#getAttributeValue getAttributeValue()} -to access the attribute values for an RQueuedMessage. - -

    -// Create an RMessageQueue object to refer to a specific message queue.
    -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -RMessageQueue messageQueue = new RMessageQueue(system, "/QSYS.LIB/MYLIB.LIB/MYMSGQ.MSGQ");
    -
    -// Get the first RQueuedMessage from the RMessageQueue. -RQueuedMessage queuedMessage = messageQueue.resourceAt(0); -
    -// Get the message text from the RQueuedMessage. -String messageText = (String)queuedMessage.getAttributeValue(RQueuedMessage.MESSAGE_TEXT); -
    - -@deprecated Use -{@link com.ibm.as400.access.QueuedMessage QueuedMessage} instead, as this package may be removed in the future. -@see RMessageQueue -@see RJobLog -**/ -// -// Implementation notes: -// -// * Message keys are 4 bytes. -// -public class RQueuedMessage -extends Resource -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - -//----------------------------------------------------------------------------------------- -// Presentation. -//----------------------------------------------------------------------------------------- - - private static PresentationLoader presentationLoader_ = new PresentationLoader("com.ibm.as400.resource.ResourceMRI"); - private static final String ICON_BASE_NAME_ = "RQueuedMessage"; - private static final String PRESENTATION_KEY_ = "QUEUED_MESSAGE"; - - - -//----------------------------------------------------------------------------------------- -// Attribute IDs. -// -// * If you add an attribute here, make sure and add it to the class javadoc, -// and to ResourceMRI.java. -//----------------------------------------------------------------------------------------- - - static ResourceMetaDataTable attributes_ = new ResourceMetaDataTable(presentationLoader_, PRESENTATION_KEY_); - -/** -Attribute ID for alert option. This identifies a read-only String attribute, -which represents whether and when an SNA alert is created and sent for the -message. Possible values are: -
      -
    • {@link #ALERT_OPTION_DEFER ALERT_OPTION_DEFER} - An alert is sent after - local problem analysis. -
    • {@link #ALERT_OPTION_IMMEDIATE ALERT_OPTION_IMMEDIATE} - An alert is sent immediately - when the message is sent to a message queue that has the allows alerts. -
    • {@link #ALERT_OPTION_NO ALERT_OPTION_NO} - No alert is sent. -
    • {@link #ALERT_OPTION_UNATTENDED ALERT_OPTION_UNATTENDED} - An alert is sent immediately - when the system is running in unattended mode. -
    • "" - The alert option is not specified. -
    -**/ - public static final String ALERT_OPTION = "ALERT_OPTION"; - - /** - Constant for {@link #ALERT_OPTION ALERT_OPTION} attribute value - - An alert is sent after local problem analysis. - **/ - public static final String ALERT_OPTION_DEFER = "*DEFER"; - - /** - Constant for {@link #ALERT_OPTION ALERT_OPTION} attribute value - - An alert is sent immediately when the message is sent to a message queue - that has the allows alerts. - **/ - public static final String ALERT_OPTION_IMMEDIATE = "*IMMED"; - - /** - Constant for {@link #ALERT_OPTION ALERT_OPTION} attribute value - - No alert is sent. - **/ - public static final String ALERT_OPTION_NO = "*NO"; - - /** - Constant for {@link #ALERT_OPTION ALERT_OPTION} attribute value - - An alert is sent immediately when the system is running in unattended mode. - **/ - public static final String ALERT_OPTION_UNATTENDED = "*UNATTEND"; - - static { - attributes_.add(ALERT_OPTION, String.class, true, - new String[] { ALERT_OPTION_DEFER, - ALERT_OPTION_IMMEDIATE, - ALERT_OPTION_NO, - ALERT_OPTION_UNATTENDED, - "" }, null, true); - } - -/** -Attribute ID for date sent. This identifies a read-only Date attribute, -which represents the date and time on which the message was sent. -The Date value is converted using the default Java locale. -**/ - public static final String DATE_SENT = "DATE_SENT"; - - static { - attributes_.add(DATE_SENT, Date.class, true); - } - -/** -Attribute ID for default reply. This identifies a read-only String attribute, -which represents the text of the default reply when a stored message is being -listed, and a default reply exists. -**/ - public static final String DEFAULT_REPLY = "DEFAULT_REPLY"; - - static { - attributes_.add(DEFAULT_REPLY, String.class, true); - } - -/** -Attribute ID for message file. This identifies a read-only String attribute, -which represents the fully qualified integrated file system path name -of the message file containing the message. - -@see com.ibm.as400.access.QSYSObjectPathName -**/ - public static final String MESSAGE_FILE = "MESSAGE_FILE"; - - static { - attributes_.add(MESSAGE_FILE, String.class, true); - } - -/** -Attribute ID for message help. This identifies a read-only String attribute, -which represents the message help. -**/ - public static final String MESSAGE_HELP = "MESSAGE_HELP"; - - static { - attributes_.add(MESSAGE_HELP, String.class, true); - } - -/** -Attribute ID for message ID. This identifies a read-only String attribute, -which represents the message identifier. -**/ - public static final String MESSAGE_ID = "MESSAGE_ID"; - - static { - attributes_.add(MESSAGE_ID, String.class, true); - } - -/** -Attribute ID for message key. This identifies a read-only byte array attribute, -which represents the message key. -**/ - public static final String MESSAGE_KEY = "MESSAGE_KEY"; - - static { - attributes_.add(MESSAGE_KEY, byte[].class, true); - } - -/** -Attribute ID for message queue. This identifies a read-only String attribute, -which represents the fully qualified integrated file system path name of -the message queue. - -@see com.ibm.as400.access.QSYSObjectPathName -**/ - public static final String MESSAGE_QUEUE = "MESSAGE_QUEUE"; - - static { - attributes_.add(MESSAGE_QUEUE, String.class, true); - } - -/** -Attribute ID for message severity. This identifies a read-only Integer attribute, -which represents the severity of the message. Possible values are 0 through 99. -**/ - public static final String MESSAGE_SEVERITY = "MESSAGE_SEVERITY"; - - static { - attributes_.add(MESSAGE_SEVERITY, Integer.class, true); - } - -/** -Attribute ID for message text. This identifies a read-only String attribute, -which represents the message text. -**/ - public static final String MESSAGE_TEXT = "MESSAGE_TEXT"; - - static { - attributes_.add(MESSAGE_TEXT, String.class, true); - } - -/** -Attribute ID for message type. This identifies a read-only Integer attribute, -which represents the message type. Converted to an int, the possible values are: -
      -
    • {@link com.ibm.as400.access.AS400Message#COMPLETION COMPLETION } -
    • {@link com.ibm.as400.access.AS400Message#DIAGNOSTIC DIAGNOSTIC } -
    • {@link com.ibm.as400.access.AS400Message#INFORMATIONAL INFORMATIONAL } -
    • {@link com.ibm.as400.access.AS400Message#INQUIRY INQUIRY } -
    • {@link com.ibm.as400.access.AS400Message#SENDERS_COPY SENDERS_COPY } -
    • {@link com.ibm.as400.access.AS400Message#REQUEST REQUEST } -
    • {@link com.ibm.as400.access.AS400Message#REQUEST_WITH_PROMPTING REQUEST_WITH_PROMPTING } -
    • {@link com.ibm.as400.access.AS400Message#NOTIFY NOTIFY } -
    • {@link com.ibm.as400.access.AS400Message#ESCAPE ESCAPE } -
    • {@link com.ibm.as400.access.AS400Message#NOTIFY_NOT_HANDLED NOTIFY_NOT_HANDLED } -
    • {@link com.ibm.as400.access.AS400Message#ESCAPE_NOT_HANDLED ESCAPE_NOT_HANDLED } -
    • {@link com.ibm.as400.access.AS400Message#REPLY_NOT_VALIDITY_CHECKED REPLY_NOT_VALIDITY_CHECKED } -
    • {@link com.ibm.as400.access.AS400Message#REPLY_VALIDITY_CHECKED REPLY_VALIDITY_CHECKED } -
    • {@link com.ibm.as400.access.AS400Message#REPLY_MESSAGE_DEFAULT_USED REPLY_MESSAGE_DEFAULT_USED } -
    • {@link com.ibm.as400.access.AS400Message#REPLY_SYSTEM_DEFAULT_USED REPLY_SYSTEM_DEFAULT_USED } -
    • {@link com.ibm.as400.access.AS400Message#REPLY_FROM_SYSTEM_REPLY_LIST REPLY_FROM_SYSTEM_REPLY_LIST } -
    -**/ // @A1A - public static final String MESSAGE_TYPE = "MESSAGE_TYPE"; - - static { - attributes_.add(MESSAGE_TYPE, Integer.class, true, - new Integer[] { new Integer(AS400Message.COMPLETION), - new Integer(AS400Message.DIAGNOSTIC), - new Integer(AS400Message.INFORMATIONAL), - new Integer(AS400Message.INQUIRY), - new Integer(AS400Message.SENDERS_COPY), - new Integer(AS400Message.REQUEST), - new Integer(AS400Message.REQUEST_WITH_PROMPTING), - new Integer(AS400Message.NOTIFY), - new Integer(AS400Message.ESCAPE), - new Integer(AS400Message.NOTIFY_NOT_HANDLED), // @A1A - new Integer(AS400Message.ESCAPE_NOT_HANDLED), // @A1A - new Integer(AS400Message.REPLY_NOT_VALIDITY_CHECKED), - new Integer(AS400Message.REPLY_VALIDITY_CHECKED), - new Integer(AS400Message.REPLY_MESSAGE_DEFAULT_USED), - new Integer(AS400Message.REPLY_SYSTEM_DEFAULT_USED), - new Integer(AS400Message.REPLY_FROM_SYSTEM_REPLY_LIST) }, null, true); - } - -/** -Attribute ID for reply status. This identifies a read-only String attribute, which -represents the reply status of the message. Possible values are: -
      -
    • {@link #REPLY_STATUS_ACCEPTS_SENT REPLY_STATUS_ACCEPTS_SENT} - - Message accepts a reply, and a reply has been sent. -
    • {@link #REPLY_STATUS_ACCEPTS_NOT_SENT REPLY_STATUS_ACCEPTS_NOT_SENT} - - Message accepts a reply, and a reply has not been sent. (The message - is waiting for a reply.) -
    • {@link #REPLY_STATUS_NOT_ACCEPT REPLY_STATUS_NOT_ACCEPT} - - Message does not accept a reply. -
    -**/ - public static final String REPLY_STATUS = "REPLY_STATUS"; - - /** - Constant for {@link #REPLY_STATUS REPLY_STATUS} attribute value - - Message accepts a reply, and a reply has been sent. - **/ - public static final String REPLY_STATUS_ACCEPTS_SENT = "A"; - - /** - Constant for {@link #REPLY_STATUS REPLY_STATUS} attribute value - - Message accepts a reply, and a reply has not been sent. (The message - is waiting for a reply.) - **/ - public static final String REPLY_STATUS_ACCEPTS_NOT_SENT = "W"; - - /** - Constant for {@link #REPLY_STATUS REPLY_STATUS} attribute value - - Message does not accept a reply. - **/ - public static final String REPLY_STATUS_NOT_ACCEPT = "N"; - - static { - attributes_.add(REPLY_STATUS, String.class, true, - new String[] { REPLY_STATUS_ACCEPTS_SENT, - REPLY_STATUS_ACCEPTS_NOT_SENT, - REPLY_STATUS_NOT_ACCEPT }, null, true); - } - -/** -Attribute ID for sender job name. This identifies a read-only String attribute, -which represents the job name of the sender. -**/ - public static final String SENDER_JOB_NAME = "SENDER_JOB_NAME"; - - static { - attributes_.add(SENDER_JOB_NAME, String.class, true); - } - -/** -Attribute ID for sender user name. This identifies a read-only String attribute, -which represents the user name of the sender. -**/ - public static final String SENDER_USER_NAME = "SENDER_USER_NAME"; - - static { - attributes_.add(SENDER_USER_NAME, String.class, true); - } - -/** -Attribute ID for sender job number. This identifies a read-only String attribute, -which represents the job number of the sender. -**/ - public static final String SENDER_JOB_NUMBER = "SENDER_JOB_NUMBER"; - - static { - attributes_.add(SENDER_JOB_NUMBER, String.class, true); - } - -/** -Attribute ID for sending program name. This identifies a read-only String attribute, -which represents the sending program name or ILE program name that contains the procedure -sending the message. -**/ - public static final String SENDING_PROGRAM_NAME = "SENDING_PROGRAM_NAME"; - - static { - attributes_.add(SENDING_PROGRAM_NAME, String.class, true); - } - -/** -Attribute ID for substitution data. This identifies a read-only byte array attribute, -which represents the values for subsitution variables in a predefined message, or the -text of an impromptu message. -**/ - public static final String SUBSTITUTION_DATA = "SUBSTITUTION_DATA"; - - static { - attributes_.add(SUBSTITUTION_DATA, byte[].class, true); - } - - - -//----------------------------------------------------------------------------------------- -// Private data. -//----------------------------------------------------------------------------------------- - - - -//----------------------------------------------------------------------------------------- -// Constructors. -//----------------------------------------------------------------------------------------- -// -// Implementation notes: -// -// * The constructor and set methods are public, since they -// need to be accessible to the access.QueuedMessage class. - -/** -Constructs an RQueuedMessage object. -**/ - public RQueuedMessage() - { - super(presentationLoader_.getPresentationWithIcon(PRESENTATION_KEY_, ICON_BASE_NAME_), null, attributes_); - } - - - - -/** -Computes the resource key. - -@param system The system. -@param containerName The container name (e.g. message queue or job log name). -@param messageKey The message key. -**/ - static Object computeResourceKey(AS400 system, String containerName, byte[] messageKey) - { - StringBuffer buffer = new StringBuffer(); - buffer.append(RQueuedMessage.class); - buffer.append(':'); - buffer.append(system.getSystemName()); - buffer.append(':'); - buffer.append(system.getUserId()); - buffer.append(':'); - buffer.append(containerName); - buffer.append(':'); - buffer.append(Presentation.bytesToHex(messageKey)); - return buffer.toString(); - } - - - - - - - - - - // @D6a -- new method - /** - Reload message help text. - @param helpTextFormatting Formatting performed on the help text. Valid - values for this parameter are defined in the MessageFile - class. They are no formatting, return formatting characters, - and replace (substitute) formatting characters. - @exception AS400SecurityException If a security or authority error occurs. - @exception ErrorCompletingRequestException If an error occurs before the request is completed. - @exception IOException If an error occurs while communicating with the system. - @exception InterruptedException If this thread is interrupted. - @exception ObjectDoesNotExistException If the system object does not exist. - **/ - public void load(int helpTextFormatting) throws AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException - { - - ////////////////////////////////////////////////////////////////////// - // Note -- this method returns when things go bad. The original code - // threw exceptions but customers complained. The purpose of this - // method is to improve the help text so customers asked that if - // the help text cannot be improved simply return so they can get - // the original help text. Don't throw an exception they have to - // handle. - ////////////////////////////////////////////////////////////////////// - - AS400 system = getSystem(); - - String file = null; - String library = null; - String IFSPath = getAttributeValueAsString(MESSAGE_FILE); - - if ((system == null) || - (IFSPath == null)) - { - - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "system or path is null in load()"); - - return; - } - - try - { - QSYSObjectPathName path = new QSYSObjectPathName(IFSPath); - library = path.getLibraryName(); - file = path.getObjectName(); - - String ID = getAttributeValueAsString(MESSAGE_ID); - byte[] substitutionData = (byte[]) getAttributeValueAsObject(SUBSTITUTION_DATA); - - if ((library == null) || - (file == null) || - (ID == null)) - { - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "library, file or ID is null in load()"); - - return; - } - - AS400Message result = null; - MessageFile msgFile = new MessageFile(system, - QSYSObjectPathName.toPath(library, file, "MSGF")); - - msgFile.setHelpTextFormatting(helpTextFormatting); - result = msgFile.getMessage(ID, substitutionData); - - initializeAttributeValue(MESSAGE_HELP, result.getHelp()); - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Exception getting help from message file in load()", e); - } - } - - - - // @D6a new method to support load() - private Object getAttributeValueAsObject(Object attributeID) - { - try - { - return getAttributeValue(attributeID); - } - catch(ResourceException e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error getting attribute value", e); - return null; - } - } - - - // @D6a new method to support load() - private String getAttributeValueAsString(Object attributeID) - { - try - { - return (String) getAttributeValue(attributeID); - } - catch(ResourceException e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error getting attribute value", e); - return null; - } - } - - - - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/RQueuedMessage16.gif b/cvsroot/src/com/ibm/as400/resource/RQueuedMessage16.gif deleted file mode 100644 index 2182f521a..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RQueuedMessage16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RQueuedMessage32.gif b/cvsroot/src/com/ibm/as400/resource/RQueuedMessage32.gif deleted file mode 100644 index 9174019ed..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RQueuedMessage32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RSoftwareResource.java b/cvsroot/src/com/ibm/as400/resource/RSoftwareResource.java deleted file mode 100644 index a897a08e6..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RSoftwareResource.java +++ /dev/null @@ -1,1004 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RSoftwareResource.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.beans.PropertyVetoException; - - - -/** -The RSoftwareResource class represents a software product. - -

    The following attribute IDs are supported: -

      -
    • {@link #LEVEL LEVEL} -
    • {@link #LOAD_ERROR_INDICATOR LOAD_ERROR_INDICATOR} -
    • {@link #LOAD_ID LOAD_ID} -
    • {@link #LOAD_STATE LOAD_STATE} -
    • {@link #LOAD_TYPE LOAD_TYPE} -
    • {@link #MINIMUM_BASE_VRM MINIMUM_BASE_VRM} -
    • {@link #MINIMUM_TARGET_RELEASE MINIMUM_TARGET_RELEASE} -
    • {@link #PRIMARY_LANGUAGE_LOAD_ID PRIMARY_LANGUAGE_LOAD_ID} -
    • {@link #PRODUCT_ID PRODUCT_ID} -
    • {@link #PRODUCT_OPTION PRODUCT_OPTION} -
    • {@link #REGISTRATION_TYPE REGISTRATION_TYPE} -
    • {@link #REGISTRATION_VALUE REGISTRATION_VALUE} -
    • {@link #RELEASE_LEVEL RELEASE_LEVEL} -
    • {@link #REQUIREMENTS_MET REQUIREMENTS_MET} -
    • {@link #SUPPORTED_FLAG SUPPORTED_FLAG} -
    • {@link #SYMBOLIC_LOAD_STATE SYMBOLIC_LOAD_STATE} -
    -
    - -

    Use any of these attribute IDs with -{@link com.ibm.as400.resource.ChangeableResource#getAttributeValue getAttributeValue()} -to access the attribute values for an RSoftwareResource. - -

    -// Create an RSoftwareResource object to refer to a specific software product.
    -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -RSoftwareResource product = new RSoftwareResource(system, "5722JC1");
    -
    -// Get the load error indicator. -String loadErrorIndicator = (String)product.getAttributeValue(RSoftwareResource.LOAD_ERROR_INDICATOR); -
    -@deprecated Use -{@link com.ibm.as400.access.Product Product} instead, as this package may be removed in the future. -**/ -// -// Implementation notes: -// -// 1. This class is not complete. It should include the other formats for the -// API as well as a complementing list class. -// -// 2. We should get a bean info and a icon for this. -// -public class RSoftwareResource -extends ChangeableResource -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - -//----------------------------------------------------------------------------------------- -// Presentation. -//----------------------------------------------------------------------------------------- - - private static PresentationLoader presentationLoader_ = new PresentationLoader("com.ibm.as400.resource.ResourceMRI"); - private static final String PRESENTATION_KEY_ = "SOFTWARE_RESOURCE"; - - - -//----------------------------------------------------------------------------------------- -// Attribute IDs. -// -// * If you add an attribute here, make sure and add it to the class javadoc. -//----------------------------------------------------------------------------------------- - - // Private data. - static ResourceMetaDataTable attributes_ = new ResourceMetaDataTable(presentationLoader_, PRESENTATION_KEY_); - private static ProgramMap getterMap_ = new ProgramMap(); - - private static final String QSZRTVPR_ = "qszrtvpr"; - - - -/** -Attribute ID for level. This identifies a read-only String attribute, -which represents the level identifier of the product. The format is -Lxx for the operating system and Licensed Internal -Code, or "" for all other products. -**/ - public static final String LEVEL = "LEVEL"; - - static { - attributes_.add(LEVEL, String.class, true); - getterMap_.add(LEVEL, QSZRTVPR_, "receiver.level"); - } - - - -/** -Attribute ID for load error indicator. This identifies a read-only String attribute, -which indicates if there is a known error for this load. Possible values are: -
      -
    • {@link #LOAD_ERROR_INDICATOR_ERROR LOAD_ERROR_INDICATOR_ERROR} - - An error was found the last time that the state of this load was checked - or updated. -
    • {@link #LOAD_ERROR_INDICATOR_NONE LOAD_ERROR_INDICATOR_NONE} - - No error was found the last time that the state of this load was checked - or updated. -
    -**/ - public static final String LOAD_ERROR_INDICATOR = "LOAD_ERROR_INDICATOR"; - - /** - Attribute value indicating that an error was found the last time that the state - of this load was checked or updated. - - @see #LOAD_ERROR_INDICATOR_ERROR - **/ - public static final String LOAD_ERROR_INDICATOR_ERROR = "*ERROR"; - - /** - Attribute value indicating that no error was found the last time that the state - of this load was checked or updated. - - @see #LOAD_ERROR_INDICATOR_NONE - **/ - public static final String LOAD_ERROR_INDICATOR_NONE = "*NONE"; - - static { - attributes_.add(LOAD_ERROR_INDICATOR, String.class, true, - new Object[] { LOAD_ERROR_INDICATOR_ERROR, LOAD_ERROR_INDICATOR_NONE }, null, true); - getterMap_.add(LOAD_ERROR_INDICATOR, QSZRTVPR_, "receiver.loadErrorIndicator"); - } - - - -/** -Attribute ID for load ID. This identifies a read-only String attribute, -which represents the load ID of the product load for which information was -returned. Possible values are: -
      -
    • "5050" - The code load. -
    • A load ID. -
    -**/ - public static final String LOAD_ID = "LOAD_ID"; - - /** - Attribute value indicating the code load. - - @see #LOAD_ID - **/ - public static final String LOAD_ID_CODE = "*CODE"; - - static { - attributes_.add(LOAD_ID, String.class, true, - new Object[] { "5050" }, null, false); - getterMap_.add(LOAD_ID, QSZRTVPR_, "receiver.loadID"); - } - - - -/** -Attribute ID for load state. This identifies a read-only String attribute, -which represents the state of the load. -**/ - public static final String LOAD_STATE = "LOAD_STATE"; - - static { - attributes_.add(LOAD_STATE, String.class, true); - getterMap_.add(LOAD_STATE, QSZRTVPR_, "receiver.loadState"); - } - - - -/** -Attribute ID for load type. This identifies a read-only String attribute, -which represents the type of the load. Possible values are: -
      -
    • {@link #LOAD_TYPE_CODE LOAD_TYPE_CODE} - The load is a code load. -
    • {@link #LOAD_TYPE_LANGUAGE LOAD_TYPE_LANGUAGE} - The load is a language load. -
    -**/ - public static final String LOAD_TYPE = "LOAD_TYPE"; - - /** - Attribute value indicating that the load is a code load. - - @see #LOAD_TYPE - **/ - public static final String LOAD_TYPE_CODE = "*CODE"; - - /** - Attribute value indicating that the load is a language load. - - @see #LOAD_TYPE - **/ - public static final String LOAD_TYPE_LANGUAGE = "*LNG"; - - static { - attributes_.add(LOAD_TYPE, String.class, true, - new Object[] { LOAD_TYPE_CODE, LOAD_TYPE_LANGUAGE }, null, true); - getterMap_.add(LOAD_TYPE, QSZRTVPR_, "receiver.loadType"); - } - - - -/** -Attribute ID for minimum base VRM. This identifies a read-only String attribute, -which represents the minimum release level that is allowed for the *BASE option -that will run with the current level of the option for the product. Possible values are: -
      -
    • {@link #MINIMUM_BASE_VRM_MATCH MINIMUM_BASE_VRM_MATCH} - The release of the option - matches that of the base. -
    • The release value in the form VxRxMx. -
    -**/ - public static final String MINIMUM_BASE_VRM = "MINIMUM_BASE_VRM"; - - /** - Attribute value indicating the release of the option matches that of the base. - - @see #MINIMUM_BASE_VRM - **/ - public static final String MINIMUM_BASE_VRM_MATCH = "*MATCH"; - - static { - attributes_.add(MINIMUM_BASE_VRM, String.class, true, - new Object[] { MINIMUM_BASE_VRM_MATCH }, null, false ); - getterMap_.add(MINIMUM_BASE_VRM, QSZRTVPR_, "receiver.minimumVRMofBaseRequiredOption"); - } - - - -/** -Attribute ID for minimum target release. This identifies a read-only String attribute, -which represents the minimum release of the operating system to which the Save -Licensed Program (SAVLICPGM) command will allow the product to be saved, -in the form VxRxMx. -**/ - public static final String MINIMUM_TARGET_RELEASE = "MINIMUM_TARGET_RELEASE"; - - static { - attributes_.add(MINIMUM_TARGET_RELEASE, String.class, true); - getterMap_.add(MINIMUM_TARGET_RELEASE, QSZRTVPR_, "receiver.minimumTargetRelease"); - } - - - -/** -Attribute ID for primary language load ID. This identifies a read-only String attribute, -which represents the primary language of the product option for code loads, or "" if -no language is installed, or for language loads. -**/ - public static final String PRIMARY_LANGUAGE_LOAD_ID = "PRIMARY_LANGUAGE_LOAD_ID"; - - static { - attributes_.add(PRIMARY_LANGUAGE_LOAD_ID, String.class, true); - getterMap_.add(PRIMARY_LANGUAGE_LOAD_ID, QSZRTVPR_, "receiver.primaryLanguageLoadID"); - } - - - -/** -Attribute ID for product ID. This identifies a read-only String attribute, -which represents the product ID. -**/ - public static final String PRODUCT_ID = "PRODUCT_ID"; - - /** - Attribute value indicating the product ID for the operating system. - - @see #PRODUCT_ID - **/ - public static final String PRODUCT_ID_OPERATING_SYSTEM = "*OPSYS"; - - static { - attributes_.add(PRODUCT_ID, String.class, true ); - getterMap_.add(PRODUCT_ID, QSZRTVPR_, "receiver.productID"); - } - - - -/** -Attribute ID for product option. This identifies a read-only String attribute, -which represents the product option. Possible values are: -
      -
    • {@link #PRODUCT_OPTION_BASE PRODUCT_OPTION_BASE} - The - base option. -
    • A product option. -
    -**/ - public static final String PRODUCT_OPTION = "PRODUCT_OPTION"; - - /** - Attribute value indicating the base option. - - @see #PRODUCT_OPTION - **/ - public static final String PRODUCT_OPTION_BASE = "0000"; - - static { - attributes_.add(PRODUCT_OPTION, String.class, true, - new Object[] { PRODUCT_OPTION_BASE }, null, false ); - getterMap_.add(PRODUCT_OPTION, QSZRTVPR_, "receiver.productOption"); - } - - - -/** -Attribute ID for registration type. This identifies a read-only String attribute, -which represents the registration type, which makes up part of the registration -ID of the product. -**/ - public static final String REGISTRATION_TYPE = "REGISTRATION_TYPE"; - - static { - attributes_.add(REGISTRATION_TYPE, String.class, true); - getterMap_.add(REGISTRATION_TYPE, QSZRTVPR_, "receiver.registrationType"); - } - - - -/** -Attribute ID for registration value. This identifies a read-only String attribute, -which represents the registration value, which makes up part of the registration -ID of the product. -**/ - public static final String REGISTRATION_VALUE = "REGISTRATION_VALUE"; - - static { - attributes_.add(REGISTRATION_VALUE, String.class, true); - getterMap_.add(REGISTRATION_VALUE, QSZRTVPR_, "receiver.registrationValue"); - } - - - -/** -Attribute ID for release level. This identifies a read-only String attribute, -which represents the release level. -**/ - public static final String RELEASE_LEVEL = "RELEASE_LEVEL"; - - /** - Attribute value indicating the release level of the currently installed operating - system. - - @see #RELEASE_LEVEL - **/ - public static final String RELEASE_LEVEL_CURRENT = "*CUR"; - - /** - Attribute value indicating the only release level - for which a product load is found. - - @see #RELEASE_LEVEL - **/ - public static final String RELEASE_LEVEL_ONLY = "*ONLY"; - - /** - Attribute value indicating the previous - release with modification level 0 of the operating system. - - @see #RELEASE_LEVEL - **/ - public static final String RELEASE_LEVEL_PREVIOUS = "*PRV"; - - static { - attributes_.add(RELEASE_LEVEL, String.class, true); - getterMap_.add(RELEASE_LEVEL, QSZRTVPR_, "receiver.releaseLevel"); - } - - - -/** -Attribute ID for requirements met. This identifies a read-only String attribute, -which indicates whether then product requirements are met between a base and option -value. Possible values are: -
      -
    • {@link #REQUIREMENTS_MET_UNKNOWN REQUIREMENTS_MET_UNKNOWN} - There is - not enough information available to determine if the release requirements have - been met, or if {@link #LOAD_TYPE LOAD_TYPE} is set to - {@link #LOAD_TYPE_LANGUAGE LOAD_TYPE_LANGUAGE}. -
    • {@link #REQUIREMENTS_MET_ALL REQUIREMENTS_MET_ALL} - The releases - of the base and option meet all requirements. -
    • {@link #REQUIREMENTS_MET_TOO_OLD_COMPARED_TO_BASE REQUIREMENTS_MET_TOO_OLD_COMPARED_TO_BASE} - - The release of the option is too old compared to the base. -
    • {@link #REQUIREMENTS_MET_TOO_OLD_COMPARED_TO_OPTION REQUIREMENTS_MET_TOO_OLD_COMPARED_TO_BASE} - - The release of the base is too old compared to the option. -
    -**/ - public static final String REQUIREMENTS_MET = "REQUIREMENTS_MET"; - - /** - Attribute value indicating that not enough information is available to determine - if the release requirements have been met. - - @see #REQUIREMENTS_MET - **/ - public static final String REQUIREMENTS_MET_UNKNOWN = "0"; - - /** - Attribute value indicating that the releases - of the base and option meet all requirements. - - @see #REQUIREMENTS_MET - **/ - public static final String REQUIREMENTS_MET_ALL = "1"; - - /** - Attribute value indicating that the release of the option is too old compared to the base. - - @see #REQUIREMENTS_MET - **/ - public static final String REQUIREMENTS_MET_TOO_OLD_COMPARED_TO_BASE = "2"; - - /** - Attribute value indicating that the release of the base is too old compared to the option. - - @see #REQUIREMENTS_MET - **/ - public static final String REQUIREMENTS_MET_TOO_OLD_COMPARED_TO_OPTION = "3"; - - static { - attributes_.add(REQUIREMENTS_MET, String.class, true, - new Object[] { REQUIREMENTS_MET_UNKNOWN, - REQUIREMENTS_MET_ALL, - REQUIREMENTS_MET_TOO_OLD_COMPARED_TO_BASE, - REQUIREMENTS_MET_TOO_OLD_COMPARED_TO_OPTION }, null, true); - getterMap_.add(REQUIREMENTS_MET, QSZRTVPR_, "receiver.requirementsMetBetweenBaseAndOptionValue"); - } - - - -/** -Attribute ID for requirements met. This identifies a read-only Boolean attribute, -which indicates whether this load is currently supported. -**/ - public static final String SUPPORTED_FLAG = "SUPPORTED_FLAG"; - - static { - attributes_.add(SUPPORTED_FLAG, Boolean.class, true); - getterMap_.add(SUPPORTED_FLAG, QSZRTVPR_, "receiver.supportedFlag", new BooleanValueMap("0", "1")); - } - - - -/** -Attribute ID for symbolic load state. This identifies a read-only String attribute, -which represents the symbolic state of the load. Possible values are: -
      -
    • {@link #SYMBOLIC_LOAD_STATE_DEFINED SYMBOLIC_LOAD_STATE_DEFINED} - The - load is defined. The product load object for this load does not exist. -
    • {@link #SYMBOLIC_LOAD_STATE_CREATED SYMBOLIC_LOAD_STATE_CREATED} - The - product load object for this load exists. -
    • {@link #SYMBOLIC_LOAD_STATE_PACKAGED SYMBOLIC_LOAD_STATE_PACKAGED} - The - product load object for this has been packaged. -
    • {@link #SYMBOLIC_LOAD_STATE_DAMAGED SYMBOLIC_LOAD_STATE_DAMAGED} - The - product load object for this has been damaged. -
    • {@link #SYMBOLIC_LOAD_STATE_LOADED SYMBOLIC_LOAD_STATE_LOADED} - The - product is being loaded or deleted. -
    • {@link #SYMBOLIC_LOAD_STATE_INSTALLED SYMBOLIC_LOAD_STATE_INSTALLED} - The - product load object was loaded. -
    -**/ - public static final String SYMBOLIC_LOAD_STATE = "SYMBOLIC_LOAD_STATE"; - - /** - Attribute value indicating that the - load is defined. The product load object for this load does not exist. - - @see #SYMBOLIC_LOAD_STATE - **/ - public static final String SYMBOLIC_LOAD_STATE_DEFINED = "*DEFINED"; - - /** - Attribute value indicating that the product load object for this load exists. - - @see #SYMBOLIC_LOAD_STATE - **/ - public static final String SYMBOLIC_LOAD_STATE_CREATED = "*CREATED"; - - /** - Attribute value indicating that the product load object has been packaged. - - @see #SYMBOLIC_LOAD_STATE - **/ - public static final String SYMBOLIC_LOAD_STATE_PACKAGED = "*PACKAGED"; - - /** - Attribute value indicating that the product load object has been damaged. - - @see #SYMBOLIC_LOAD_STATE - **/ - public static final String SYMBOLIC_LOAD_STATE_DAMAGED = "*DAMAGED"; - - /** - Attribute value indicating that the product load object is being loaded or deleted. - - @see #SYMBOLIC_LOAD_STATE - **/ - public static final String SYMBOLIC_LOAD_STATE_LOADED = "*LOADED"; - - /** - Attribute value indicating that the product load object was loaded. - - @see #SYMBOLIC_LOAD_STATE - **/ - public static final String SYMBOLIC_LOAD_STATE_INSTALLED = "*INSTALLED"; - - static { - attributes_.add(SYMBOLIC_LOAD_STATE, String.class, true, - new Object[] { SYMBOLIC_LOAD_STATE_DEFINED, - SYMBOLIC_LOAD_STATE_CREATED, - SYMBOLIC_LOAD_STATE_PACKAGED, - SYMBOLIC_LOAD_STATE_DAMAGED, - SYMBOLIC_LOAD_STATE_LOADED, - SYMBOLIC_LOAD_STATE_INSTALLED }, null, true); - getterMap_.add(SYMBOLIC_LOAD_STATE, QSZRTVPR_, "receiver.symbolicLoadState"); - } - - - -//----------------------------------------------------------------------------------------- -// PCML document initialization. -//----------------------------------------------------------------------------------------- - - private static final String DOCUMENT_NAME_ = "com.ibm.as400.resource.RSoftwareResource"; - private static ProgramCallDocument staticDocument_ = null; - - static { - // Create a static version of the PCML document, then clone it for each document. - // This will improve performance, since we will only have to deserialize the PCML - // object once. - try { - staticDocument_ = new ProgramCallDocument(); - staticDocument_.setDocument(DOCUMENT_NAME_); - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error instantiating ProgramCallDocument", e); - } - } - - -//----------------------------------------------------------------------------------------- -// Private data. -//----------------------------------------------------------------------------------------- - - private String productID_ = PRODUCT_ID_OPERATING_SYSTEM; - private String releaseLevel_ = RELEASE_LEVEL_CURRENT; - private String productOption_ = PRODUCT_OPTION_BASE; - private String loadID_ = LOAD_ID_CODE; - - private ProgramAttributeGetter attributeGetter_ = null; - private ProgramCallDocument document_ = null; - - -//----------------------------------------------------------------------------------------- -// Constructors. -//----------------------------------------------------------------------------------------- - -/** -Constructs an RSoftwareResource object. -**/ - public RSoftwareResource() - { - super(presentationLoader_.getPresentation(PRESENTATION_KEY_), null, attributes_); - } - - - -/** -Constructs an RSoftwareResource object. - -@param system The system. -@param productID The product ID, or {@link #PRODUCT_ID_OPERATING_SYSTEM PRODUCT_ID_OPERATING_SYSTEM} - to refer to the operating system. -**/ - public RSoftwareResource(AS400 system, String productID) - { - this(); - - try { - setSystem(system); - } - catch(PropertyVetoException e) { - // Ignore. - } - - setProductID(productID); - } - - -/** -Constructs an RSoftwareResource object. - -@param system The system. -@param productID The product ID, or {@link #PRODUCT_ID_OPERATING_SYSTEM PRODUCT_ID_OPERATING_SYSTEM} - to refer to the operating system. -@param releaseLevel The release level. Possible values are: -
      -
    • {@link #RELEASE_LEVEL_CURRENT RELEASE_LEVEL_CURRENT} - Use the release level of - the currently installed operating system. -
    • {@link #RELEASE_LEVEL_ONLY RELEASE_LEVEL_ONLY} - Use the only release level - for which a product load is found. -
    • {@link #RELEASE_LEVEL_PREVIOUS RELEASE_LEVEL_PREVIOUS} - Use the previous - release with modification level 0 of the operating system. -
    • A release level, in the form VxRxMx. -
    -@param productOption The option number for which is being requested, or - {@link #PRODUCT_OPTION_BASE PRODUCT_OPTION_BASE} for the base option. -**/ - public RSoftwareResource(AS400 system, String productID, String releaseLevel, String productOption) - { - this(); - - try { - setSystem(system); - } - catch(PropertyVetoException e) { - // Ignore. - } - - setProductID(productID); - setReleaseLevel(releaseLevel); - setProductOption(productOption); - } - - -/** -Constructs an RSoftwareResource object. - -@param system The system. -@param productID The product ID, or {@link #PRODUCT_ID_OPERATING_SYSTEM PRODUCT_ID_OPERATING_SYSTEM} - to refer to the operating system. -@param releaseLevel The release level. Possible values are: -
      -
    • {@link #RELEASE_LEVEL_CURRENT RELEASE_LEVEL_CURRENT} - Use the release level of - the currently installed operating system. -
    • {@link #RELEASE_LEVEL_ONLY RELEASE_LEVEL_ONLY} - Use the only release level - for which a product load is found. -
    • {@link #RELEASE_LEVEL_PREVIOUS RELEASE_LEVEL_PREVIOUS} - Use the previous - release with modification level 0 of the operating system. -
    • A release level, in the form VxRxMx. -
    -@param productOption The option number for which is being requested, or - {@link #PRODUCT_OPTION_BASE PRODUCT_OPTION_BASE} for the base option. -@param loadID The load ID, or {@link #LOAD_ID_CODE LOAD_ID_CODE} for the code load. -**/ - public RSoftwareResource(AS400 system, String productID, String releaseLevel, String productOption, String loadID) - { - this(); - - try { - setSystem(system); - } - catch(PropertyVetoException e) { - // Ignore. - } - - setProductID(productID); - setReleaseLevel(releaseLevel); - setProductOption(productOption); - setLoadID(loadID); - } - - - - -/** -Computes the resource key. - -@param system The system. -@param productID The product ID. -@param releaseLevel The release level. -@param productOption The product option. -@param loadID The load ID. -**/ - static Object computeResourceKey(AS400 system, String productID, String releaseLevel, String productOption, String loadID) - { - StringBuffer buffer = new StringBuffer(); - buffer.append(RSoftwareResource.class); - buffer.append(':'); - buffer.append(system.getSystemName()); - buffer.append(':'); - buffer.append(system.getUserId()); - buffer.append(':'); - buffer.append(productID); - buffer.append(':'); - buffer.append(releaseLevel); - buffer.append(':'); - buffer.append(productOption); - buffer.append(':'); - buffer.append(loadID); - return buffer.toString(); - } - - - -/** -Establishes the connection to the system. - -

    The method is called by the resource framework automatically -when the connection needs to be established. - -@exception ResourceException If an error occurs. -**/ - protected void establishConnection() - throws ResourceException - { - // Call the superclass. - super.establishConnection(); - - // Initialize the PCML document. - document_ = (ProgramCallDocument)staticDocument_.clone(); - AS400 system = getSystem(); - try { - document_.setSystem(system); - document_.setValue("qszrtvpr.productInformation.productID", productID_); - document_.setValue("qszrtvpr.productInformation.releaseLevel", releaseLevel_); - document_.setValue("qszrtvpr.productInformation.productOption", productOption_); - document_.setValue("qszrtvpr.productInformation.loadID", loadID_); - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error setting PCML document values", e); - } - - // Initialize the attribute getter. - attributeGetter_ = new ProgramAttributeGetter(system, document_, getterMap_); - } - - -/** -Freezes any property changes. After this is called, property -changes should not be made. Properties are not the same thing -as attributes. Properties are basic pieces of information -which must be set to make the object usable, such as the system -and path. - -

    The method is called by the resource framework automatically -when the properties need to be frozen. - -@exception ResourceException If an error occurs. -**/ - protected void freezeProperties() - throws ResourceException - { - // Call the superclass. - super.freezeProperties(); - - // Update the presentation. - Presentation presentation = getPresentation(); - presentation.setName(productID_); - StringBuffer buffer = new StringBuffer(productID_); - buffer.append('-'); - buffer.append(releaseLevel_); - buffer.append('-'); - buffer.append(productOption_); - buffer.append('-'); - buffer.append(loadID_); - presentation.setFullName(buffer.toString()); - - // Update the resource key. - if (getResourceKey() == null) - setResourceKey(computeResourceKey(getSystem(), productID_, releaseLevel_, productOption_, loadID_)); - } - - - -/** -Returns the unchanged value of an attribute. If the attribute -value has a uncommitted change, this returns the unchanged value. -If the attribute value does not have a uncommitted change, this -returns the same value as getAttributeValue(). - -@param attributeID Identifies the attribute. -@return The attribute value, or null if the attribute - value is not available. - -@exception ResourceException If an error occurs. -**/ - public Object getAttributeUnchangedValue(Object attributeID) - throws ResourceException - { - Object value = super.getAttributeUnchangedValue(attributeID); - if (value == null) { - - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); - - value = attributeGetter_.getValue(attributeID); - - // Check to see if the software resource exists (the API will not result - // in an exception in this case). - try { - if (document_.getIntValue("qszrtvpr.receiver.bytesAvailable") == 0) - throw new ResourceException(ResourceException.ATTRIBUTES_NOT_RETURNED); - } - catch(PcmlException e) { - throw new ResourceException(e); - } - } - return value; - } - - - - -/** -Returns the load ID. - -@return The load ID. -**/ - public String getLoadID() - { - return loadID_; - } - - - -/** -Returns the product ID. - -@return The product ID. -**/ - public String getProductID() - { - return productID_; - } - - - -/** -Returns the product option. - -@return The product option. -**/ - public String getProductOption() - { - return productOption_; - } - - - -/** -Returns the release level. - -@return The release level. -**/ - public String getReleaseLevel() - { - return releaseLevel_; - } - - - -/** -Refreshes the values for all attributes. This does not cancel -uncommitted changes. This method fires an attributeValuesRefreshed() -ResourceEvent. - -@exception ResourceException If an error occurs. -**/ - public void refreshAttributeValues() - throws ResourceException - { - super.refreshAttributeValues(); - - if (attributeGetter_ != null) - attributeGetter_.clearBuffer(); - } - - - -/** -Sets the load ID. This does not change the software product -on the system. Instead, it changes the software product -to which this object references. - -

    The default value is LOAD_ID_CODE. - -@param loadID The load ID, or {@link #LOAD_ID_CODE LOAD_ID_CODE} for the code load. -**/ - public void setLoadID(String loadID) - { - if (loadID == null) - throw new NullPointerException("loadID"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - String oldValue = loadID_; - loadID_ = loadID; - firePropertyChange("loadID", oldValue, loadID_); - } - - - -/** -Sets the product ID. This does not change the software product -on the system. Instead, it changes the software product -to which this object references. - -

    The default value is PRODUCT_ID_OPERATING_SYSTEM. - -@param productID The product ID, or {@link #PRODUCT_ID_OPERATING_SYSTEM PRODUCT_ID_OPERATING_SYSTEM} - to refer to the operating system. -**/ - public void setProductID(String productID) - { - if (productID == null) - throw new NullPointerException("productID"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - String oldValue = productID_; - productID_ = productID; - firePropertyChange("productID", oldValue, productID_); - } - - - -/** -Sets the product option. This does not change the software product -on the system. Instead, it changes the software product -to which this object references. - -

    The default value is PRODUCT_OPTION_BASE. - -@param productOption The option number for which is being requested, or - {@link #PRODUCT_OPTION_BASE PRODUCT_OPTION_BASE} for the base option. -**/ - public void setProductOption(String productOption) - { - if (productOption == null) - throw new NullPointerException("productOption"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - String oldValue = productOption_; - productOption_ = productOption; - firePropertyChange("productOption", oldValue, productOption_); - } - - - -/** -Sets the release level. This does not change the software product -on the system. Instead, it changes the software product -to which this object references. - -

    The default value is RELEASE_LEVEL_CURRENT. - -@param releaseLevel The release level. Possible values are: -

      -
    • {@link #RELEASE_LEVEL_CURRENT RELEASE_LEVEL_CURRENT} - Use the release level of - the currently installed operating system. -
    • {@link #RELEASE_LEVEL_ONLY RELEASE_LEVEL_ONLY} - Use the only release level - for which a product load is found. -
    • {@link #RELEASE_LEVEL_PREVIOUS RELEASE_LEVEL_PREVIOUS} - Use the previous - release with modification level 0 of the operating system. -
    • A release level, in the form VxRxMx. -
    -**/ - public void setReleaseLevel(String releaseLevel) - { - if (releaseLevel == null) - throw new NullPointerException("releaseLevel"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - String oldValue = releaseLevel_; - releaseLevel_ = releaseLevel; - firePropertyChange("releaseLevel", oldValue, releaseLevel_); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/RSoftwareResource.pcml b/cvsroot/src/com/ibm/as400/resource/RSoftwareResource.pcml deleted file mode 100644 index 757c9fca7..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RSoftwareResource.pcml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/resource/RSoftwareResourceBeanInfo.java b/cvsroot/src/com/ibm/as400/resource/RSoftwareResourceBeanInfo.java deleted file mode 100644 index a37754e52..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RSoftwareResourceBeanInfo.java +++ /dev/null @@ -1,143 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RSoftwareResourceBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Trace; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.util.ResourceBundle; - - - -/** -The RSoftwareResourceBeanInfo class represents the bean information -for the RSoftwareResource class. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class RSoftwareResourceBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final Class beanClass_ = RSoftwareResource.class; - - private static BeanInfo[] additionalBeanInfo_; - private static BeanDescriptor beanDescriptor_; - private static Image icon16_; - private static Image icon32_; - private static PropertyDescriptor[] propertyDescriptors_; - private static ResourceBundle resourceBundle_; - - - -/** -Static initializer. -**/ - static - { - try - { - // Set up the resource bundle. - resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.resource.ResourceMRI"); - - // Set up the additional bean info. - additionalBeanInfo_ = new BeanInfo[] { new ResourceBeanInfo() }; - - // Set up the bean descriptor. - beanDescriptor_ = new BeanDescriptor(beanClass_); - - // Set up the property descriptors. - PropertyDescriptor productID = new PropertyDescriptor("productID", beanClass_); - productID.setBound(true); - productID.setConstrained(false); - productID.setDisplayName(resourceBundle_.getString("PROPERTY_PRODUCT_ID_NAME")); - productID.setShortDescription(resourceBundle_.getString("PROPERTY_PRODUCT_ID_DESCRIPTION")); - - PropertyDescriptor releaseLevel = new PropertyDescriptor("releaseLevel", beanClass_); - releaseLevel.setBound(true); - releaseLevel.setConstrained(false); - releaseLevel.setDisplayName(resourceBundle_.getString("PROPERTY_RELEASE_LEVEL_NAME")); - releaseLevel.setShortDescription(resourceBundle_.getString("PROPERTY_RELEASE_LEVEL_DESCRIPTION")); - - PropertyDescriptor productOption = new PropertyDescriptor("productOption", beanClass_); - productOption.setBound(true); - productOption.setConstrained(false); - productOption.setDisplayName(resourceBundle_.getString("PROPERTY_PRODUCT_OPTION_NAME")); - productOption.setShortDescription(resourceBundle_.getString("PROPERTY_PRODUCT_OPTION_DESCRIPTION")); - - PropertyDescriptor loadID = new PropertyDescriptor("loadID", beanClass_); - loadID.setBound(true); - loadID.setConstrained(false); - loadID.setDisplayName(resourceBundle_.getString("PROPERTY_LOAD_ID_NAME")); - loadID.setShortDescription(resourceBundle_.getString("PROPERTY_LOAD_ID_DESCRIPTION")); - - propertyDescriptors_ = new PropertyDescriptor[] { productID, releaseLevel, productOption, loadID }; - - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error while loading bean info", e); - throw new Error(e.toString()); - } - } - - - -/** -Returns the additional bean information. - -@return The additional bean information. -**/ - public BeanInfo[] getAdditionalBeanInfo() - { - return additionalBeanInfo_; - } - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - - -/** -Returns the property descriptors. - -@return The property descriptors. -**/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors_; - } - - - - // There currently no icons for this bean. - - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/RUser.java b/cvsroot/src/com/ibm/as400/resource/RUser.java deleted file mode 100644 index 5ab05167f..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RUser.java +++ /dev/null @@ -1,3223 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RUser.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.CommandCall; -import com.ibm.as400.access.ExtendedIllegalArgumentException; //@B1A -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.beans.PropertyVetoException; -import java.io.IOException; // @A3A -import java.net.InetAddress; // @A3A -import java.util.Date; - - - -/** -The RUser class represents a user profile and directory entry on the system. - -

    The following attribute IDs are supported: -

      -
    • {@link #ACCOUNTING_CODE ACCOUNTING_CODE} -
    • {@link #ALLOW_SYNCHRONIZATION ALLOW_SYNCHRONIZATION} -
    • {@link #ASSISTANCE_LEVEL ASSISTANCE_LEVEL} -
    • {@link #ATTENTION_KEY_HANDLING_PROGRAM ATTENTION_KEY_HANDLING_PROGRAM} -
    • {@link #BUILDING BUILDING} -
    • {@link #CC_MAIL_ADDRESS CC_MAIL_ADDRESS} -
    • {@link #CC_MAIL_COMMENT CC_MAIL_COMMENT} -
    • {@link #CHARACTER_CODE_SET_ID CHARACTER_CODE_SET_ID} -
    • {@link #CHARACTER_IDENTIFIER_CONTROL CHARACTER_IDENTIFIER_CONTROL} -
    • {@link #COMPANY COMPANY} -
    • {@link #COUNTRY_ID COUNTRY_ID} -
    • {@link #CURRENT_LIBRARY_NAME CURRENT_LIBRARY_NAME} -
    • {@link #DATE_PASSWORD_EXPIRES DATE_PASSWORD_EXPIRES} -
    • {@link #DAYS_UNTIL_PASSWORD_EXPIRES DAYS_UNTIL_PASSWORD_EXPIRES} -
    • {@link #DEPARTMENT DEPARTMENT} -
    • {@link #DIGITAL_CERTIFICATE_INDICATOR DIGITAL_CERTIFICATE_INDICATOR} -
    • {@link #DISPLAY_SIGN_ON_INFORMATION DISPLAY_SIGN_ON_INFORMATION} -
    • {@link #FAX_TELEPHONE_NUMBER FAX_TELEPHONE_NUMBER} -
    • {@link #FIRST_NAME FIRST_NAME} -
    • {@link #FULL_NAME FULL_NAME} -
    • {@link #GROUP_AUTHORITY GROUP_AUTHORITY} -
    • {@link #GROUP_AUTHORITY_TYPE GROUP_AUTHORITY_TYPE} -
    • {@link #GROUP_ID_NUMBER GROUP_ID_NUMBER} -
    • {@link #GROUP_MEMBER_INDICATOR GROUP_MEMBER_INDICATOR} -
    • {@link #GROUP_PROFILE_NAME GROUP_PROFILE_NAME} -
    • {@link #HIGHEST_SCHEDULING_PRIORITY HIGHEST_SCHEDULING_PRIORITY} -
    • {@link #HOME_DIRECTORY HOME_DIRECTORY} -
    • {@link #INDIRECT_USER INDIRECT_USER} -
    • {@link #INITIAL_MENU INITIAL_MENU} -
    • {@link #INITIAL_PROGRAM INITIAL_PROGRAM} -
    • {@link #JOB_DESCRIPTION JOB_DESCRIPTION} -
    • {@link #JOB_TITLE JOB_TITLE} -
    • {@link #KEYBOARD_BUFFERING KEYBOARD_BUFFERING} -
    • {@link #LANGUAGE_ID LANGUAGE_ID} -
    • {@link #LAST_NAME LAST_NAME} -
    • {@link #LIMIT_CAPABILITIES LIMIT_CAPABILITIES} -
    • {@link #LIMIT_DEVICE_SESSIONS LIMIT_DEVICE_SESSIONS} -
    • {@link #LOCALE_JOB_ATTRIBUTES LOCALE_JOB_ATTRIBUTES} -
    • {@link #LOCALE_PATH_NAME LOCALE_PATH_NAME} -
    • {@link #LOCAL_DATA_INDICATOR LOCAL_DATA_INDICATOR} -
    • {@link #LOCATION LOCATION} -
    • {@link #MAILING_ADDRESS_LINE_1 MAILING_ADDRESS_LINE_1} -
    • {@link #MAILING_ADDRESS_LINE_2 MAILING_ADDRESS_LINE_2} -
    • {@link #MAILING_ADDRESS_LINE_3 MAILING_ADDRESS_LINE_3} -
    • {@link #MAILING_ADDRESS_LINE_4 MAILING_ADDRESS_LINE_4} -
    • {@link #MAIL_NOTIFICATION MAIL_NOTIFICATION} -
    • {@link #MANAGER_CODE MANAGER_CODE} -
    • {@link #MAXIMUM_ALLOWED_STORAGE MAXIMUM_ALLOWED_STORAGE} -
    • {@link #MESSAGE_NOTIFICATION MESSAGE_NOTIFICATION} -
    • {@link #MESSAGE_QUEUE_DELIVERY_METHOD MESSAGE_QUEUE_DELIVERY_METHOD} -
    • {@link #MESSAGE_QUEUE MESSAGE_QUEUE} -
    • {@link #MESSAGE_QUEUE_SEVERITY MESSAGE_QUEUE_SEVERITY} -
    • {@link #MIDDLE_NAME MIDDLE_NAME} -
    • {@link #NETWORK_USER_ID NETWORK_USER_ID} -
    • {@link #NO_PASSWORD_INDICATOR NO_PASSWORD_INDICATOR} -
    • {@link #OBJECT_AUDITING_VALUE OBJECT_AUDITING_VALUE} -
    • {@link #OFFICE OFFICE} -
    • {@link #OR_NAME OR_NAME} -
    • {@link #OUTPUT_QUEUE OUTPUT_QUEUE} -
    • {@link #OWNER OWNER} -
    • {@link #PASSWORD_CHANGE_DATE PASSWORD_CHANGE_DATE} -
    • {@link #PASSWORD_EXPIRATION_INTERVAL PASSWORD_EXPIRATION_INTERVAL} -
    • {@link #PREFERRED_NAME PREFERRED_NAME} -
    • {@link #PREVIOUS_SIGN_ON PREVIOUS_SIGN_ON} -
    • {@link #PRINT_COVER_PAGE PRINT_COVER_PAGE} -
    • {@link #PRINT_DEVICE PRINT_DEVICE} -
    • {@link #PRIORITY_MAIL_NOTIFICATION PRIORITY_MAIL_NOTIFICATION} -
    • {@link #SET_PASSWORD_TO_EXPIRE SET_PASSWORD_TO_EXPIRE} -
    • {@link #SIGN_ON_ATTEMPTS_NOT_VALID SIGN_ON_ATTEMPTS_NOT_VALID} -
    • {@link #SMTP_DOMAIN SMTP_DOMAIN} -
    • {@link #SMTP_ROUTE SMTP_ROUTE} -
    • {@link #SMTP_USER_ID SMTP_USER_ID} -
    • {@link #SORT_SEQUENCE_TABLE SORT_SEQUENCE_TABLE} -
    • {@link #SPECIAL_AUTHORITIES SPECIAL_AUTHORITIES} -
    • {@link #SPECIAL_ENVIRONMENT SPECIAL_ENVIRONMENT} -
    • {@link #STATUS STATUS} -
    • {@link #STORAGE_USED STORAGE_USED} -
    • {@link #SUPPLEMENTAL_GROUPS SUPPLEMENTAL_GROUPS} -
    • {@link #TELEPHONE_NUMBER_1 TELEPHONE_NUMBER_1} -
    • {@link #TELEPHONE_NUMBER_2 TELEPHONE_NUMBER_2} -
    • {@link #TEXT TEXT} -
    • {@link #TEXT_DESCRIPTION TEXT_DESCRIPTION} -
    • {@link #USER_ACTION_AUDIT_LEVEL USER_ACTION_AUDIT_LEVEL} -
    • {@link #USER_ADDRESS USER_ADDRESS} -
    • {@link #USER_CLASS USER_CLASS} -
    • {@link #USER_DESCRIPTION USER_DESCRIPTION} -
    • {@link #USER_ID USER_ID} -
    • {@link #USER_ID_NUMBER USER_ID_NUMBER} -
    • {@link #USER_OPTIONS USER_OPTIONS} -
    • {@link #USER_PROFILE_NAME USER_PROFILE_NAME} -
    -
    - -

    Use any of these attribute IDs with -{@link com.ibm.as400.resource.ChangeableResource#getAttributeValue getAttributeValue()} -and {@link com.ibm.as400.resource.ChangeableResource#setAttributeValue setAttributeValue()} -to access the attribute values for an RUser. - -

    -// Create an RUser object to refer to a specific user.
    -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -RUser user = new RUser(system, "AUSERID");
    -
    -// Get the user status. -String status = (String)user.getAttributeValue(RUser.STATUS); -
    -// Set the print device for a user to work station. -user.setAttributeValue(RUser.PRINT_DEVICE, RUser.PRINT_DEVICE_WORK_STATION); -
    -// Commit the attribute change. -user.commitAttributeChanges(); -
    - -@deprecated Use -{@link com.ibm.as400.access.User User} instead, as this package may be removed in the future. -@see RUserList -**/ -public class RUser -extends ChangeableResource -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - -//----------------------------------------------------------------------------------------- -// Presentation. -//----------------------------------------------------------------------------------------- - - private static PresentationLoader presentationLoader_ = new PresentationLoader("com.ibm.as400.resource.ResourceMRI"); - private static final String ICON_BASE_NAME_ = "RUser"; - private static final String PRESENTATION_KEY_ = "USER"; - - - -//----------------------------------------------------------------------------------------- -// Attribute values. -//----------------------------------------------------------------------------------------- - -/** -Attribute value for system value. -**/ - public static final String SYSTEM_VALUE = "*SYSVAL"; - -/** -Attribute value for yes. -**/ - public static final String YES = "*YES"; - -/** -Attribute value for no. -**/ - public static final String NO = "*NO"; - -/** -Attribute value for none. -**/ - public static final String NONE = "*NONE"; - -/** -Attribute value for no date. -**/ - public static final Date NO_DATE = DateValueMap.NO_DATE; - - -//----------------------------------------------------------------------------------------- -// Attribute IDs. -// -// * If you add an attribute here, make sure and add it to the class javadoc. -//----------------------------------------------------------------------------------------- - - // Private data. - static ResourceMetaDataTable attributes_ = new ResourceMetaDataTable(presentationLoader_, PRESENTATION_KEY_); - private static ProgramMap getterMap_ = new ProgramMap(); - private static CommandMap setterMap_ = new CommandMap(); - - private static final ArrayValueMap arrayValueMap_ = new ArrayValueMap(); - private static final ArrayValueMap arrayValueMapNone_ = new ArrayValueMap(NONE); - private static final ArrayTypeValueMap arrayTypeValueMapString_= new ArrayTypeValueMap(String.class); - private static final BooleanValueMap booleanValueMap01_ = new BooleanValueMap("0", "1"); - private static final BooleanValueMap booleanValueMapNY_ = new BooleanValueMap("N", "Y"); - private static final BooleanValueMap booleanValueMapNoYes_ = new BooleanValueMap(NO, YES); - private static final IntegerToLongValueMap integerToLongValueMap_ = new IntegerToLongValueMap(); - private static final QuoteValueMap quoteValueMap_ = new QuoteValueMap(); - private static final QuoteValueMap quoteValueMapBlank_ = new QuoteValueMap("*BLANK"); - private static final QuoteValueMap quoteValueMapNone_ = new QuoteValueMap(NONE); - -//@B1D private static final String ADDDIRE_ = "ADDDIRE"; - private static final String CHGDIRE_ = "CHGDIRE"; - private static final String CHGUSRPRF_ = "CHGUSRPRF"; - private static final String CHGUSRAUD_ = "CHGUSRAUD"; -//@B1D private static final String CRTUSRPRF_ = "CRTUSRPRF"; - private static final int[] INDEX_0_ = new int[] { 0 }; - private static final String QOKSCHD_ = "qokschd"; - private static final String USRI0100_ = "qsyrusri_usri0100"; - private static final String USRI0200_ = "qsyrusri_usri0200"; - private static final String USRI0300_ = "qsyrusri_usri0300"; - private static final String USRD_PARAMETER_ = "USRD"; - private static final String USRPRF_PARAMETER_ = "USRPRF"; - private static final String USRID_PARAMETER_ = "USRID"; - - - -/** -Attribute ID for accounting code. This identifies a String -attribute, which represents the accounting code associated with this user. -**/ - public static final String ACCOUNTING_CODE = "ACCOUNTING_CODE"; - - static { - attributes_.add(ACCOUNTING_CODE, String.class, false); - getterMap_.add(ACCOUNTING_CODE, USRI0300_, "receiverVariable.accountingCode"); - setterMap_.add(ACCOUNTING_CODE, CHGUSRPRF_, "ACGCDE", quoteValueMapBlank_); - } - - - -/** -Attribute ID for allow synchronization. This identifies a Boolean -attribute, which indicates whether the user's directory entry should be -synchronized with directories other than the System Distribution Directory. -**/ - public static final String ALLOW_SYNCHRONIZATION = "ALLOW_SYNCHRONIZATION"; - - static { - attributes_.add(ALLOW_SYNCHRONIZATION, Boolean.class, false); - getterMap_.add(ALLOW_SYNCHRONIZATION, QOKSCHD_, "receiverVariable.directoryEntries.allowSynchronization.fieldValue", INDEX_0_, booleanValueMap01_); - setterMap_.add(ALLOW_SYNCHRONIZATION, CHGDIRE_, "ALWSYNC", booleanValueMapNoYes_); - } - - - - -/** -Attribute ID for assistance level. This identifies a String -attribute, which represents the user interface that the user will use. -Possible values are: -
      -
    • {@link #SYSTEM_VALUE SYSTEM_VALUE} - - The system value QASTLVL determines which user interface the user is using. -
    • {@link #ASSISTANCE_LEVEL_BASIC ASSISTANCE_LEVEL_BASIC} - - The Operational Assistant user interface. -
    • {@link #ASSISTANCE_LEVEL_INTERMEDIATE ASSISTANCE_LEVEL_INTERMEDIATE} - - The system user interface. -
    • {@link #ASSISTANCE_LEVEL_ADVANCED ASSISTANCE_LEVEL_ADVANCED} - - The expert system user interface. -
    -**/ - public static final String ASSISTANCE_LEVEL = "ASSISTANCE_LEVEL"; - - /** - Attribute value indicating the Operational Assistant user interface. - - @see #ASSISTANCE_LEVEL - **/ - public static final String ASSISTANCE_LEVEL_BASIC = "*BASIC"; - - /** - Attribute value indicating the system user interface. - - @see #ASSISTANCE_LEVEL - **/ - public static final String ASSISTANCE_LEVEL_INTERMEDIATE = "*INTERMED"; - - /** - Attribute value indicating the expert system user interface. - - @see #ASSISTANCE_LEVEL - **/ - public static final String ASSISTANCE_LEVEL_ADVANCED = "*ADVANCED"; - - static { - attributes_.add(ASSISTANCE_LEVEL, String.class, false, - new Object[] {SYSTEM_VALUE, - ASSISTANCE_LEVEL_BASIC, - ASSISTANCE_LEVEL_INTERMEDIATE, - ASSISTANCE_LEVEL_ADVANCED}, null, true); - getterMap_.add(ASSISTANCE_LEVEL, USRI0300_, "receiverVariable.assistanceLevel"); - setterMap_.add(ASSISTANCE_LEVEL, CHGUSRPRF_, "ASTLVL"); - } - - - -/** -Attribute ID for attention key handling program. This identifies a -String attribute, which represents the fully qualified integrated file system -path name of the attention key handling program for -this user. Possible values are: -
      -
    • {@link #SYSTEM_VALUE SYSTEM_VALUE} - - The system value QATNPGM determines the user's attention key handling program. -
    • {@link #NONE NONE} - - No attention key handling program is used. -
    • {@link #ATTENTION_KEY_HANDLING_PROGRAM_ASSIST ATTENTION_KEY_HANDLING_PROGRAM_ASSIST} - - The Operational Assistant attention key handling program. -
    • The attention key handling program name. -
    - -@see com.ibm.as400.access.QSYSObjectPathName -**/ - public static final String ATTENTION_KEY_HANDLING_PROGRAM = "ATTENTION_KEY_HANDLING_PROGRAM"; - - /** - Attribute value indicating the Operational Assistant attention key handling program. - - @see #ATTENTION_KEY_HANDLING_PROGRAM - **/ - public static final String ATTENTION_KEY_HANDLING_PROGRAM_ASSIST = "*ASSIST"; - - static { - attributes_.add(ATTENTION_KEY_HANDLING_PROGRAM, String.class, false, - new Object[] {SYSTEM_VALUE, NONE, ATTENTION_KEY_HANDLING_PROGRAM_ASSIST}, null, false); - getterMap_.add(ATTENTION_KEY_HANDLING_PROGRAM, USRI0300_, "receiverVariable.attentionKeyHandlingProgram", - new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "PGM")); - ValueMap valueMap = new QualifiedValueMap(QualifiedValueMap.FORMAT_CL, "PGM"); - setterMap_.add(ATTENTION_KEY_HANDLING_PROGRAM, CHGUSRPRF_, "ATNPGM", valueMap); - } - - - -/** -Attribute ID for building. This identifies a String -attribute, which represents the building in the user's directory entry. -**/ - public static final String BUILDING = "BUILDING"; - - static { - attributes_.add(BUILDING, String.class, false); - getterMap_.add(BUILDING, QOKSCHD_, "receiverVariable.directoryEntries.building.fieldValue", INDEX_0_); - setterMap_.add(BUILDING, CHGDIRE_, "BLDG", quoteValueMapNone_); - } - - - -/** -Attribute ID for cc:Mail address. This identifies a String -attribute, which represents the cc:Mail address in the user's directory entry. -**/ - public static final String CC_MAIL_ADDRESS = "CC_MAIL_ADDRESS"; - - static { - attributes_.add(CC_MAIL_ADDRESS, String.class, false); - getterMap_.add(CC_MAIL_ADDRESS, QOKSCHD_, "receiverVariable.directoryEntries.ccMailAddress.fieldValue", INDEX_0_); - setterMap_.add(CC_MAIL_ADDRESS, CHGDIRE_, "CCMAILADR", quoteValueMapNone_); - } - - - - -/** -Attribute ID for cc:Mail comment. This identifies a String -attribute, which represents the cc:Mail comment in the user's directory entry. -**/ - public static final String CC_MAIL_COMMENT = "CC_MAIL_COMMENT"; - - static { - attributes_.add(CC_MAIL_COMMENT, String.class, false); - getterMap_.add(CC_MAIL_COMMENT, QOKSCHD_, "receiverVariable.directoryEntries.ccMailComment.fieldValue", INDEX_0_); - setterMap_.add(CC_MAIL_COMMENT, CHGDIRE_, "CCMAILCMT", quoteValueMapNone_); - } - - - -/** -Attribute ID for character code set ID. This identifies a Integer -attribute, which represents the character code set ID to be used by the system -for this user. -**/ - public static final String CHARACTER_CODE_SET_ID = "CHARACTER_CODE_SET_ID"; - - static { - attributes_.add(CHARACTER_CODE_SET_ID, Integer.class, false); - getterMap_.add(CHARACTER_CODE_SET_ID, USRI0300_, "receiverVariable.characterCodeSetID"); - ValueMap valueMap = new CharacterCodeSetIDValueMap_(); - setterMap_.add(CHARACTER_CODE_SET_ID, CHGUSRPRF_, "CCSID", valueMap); - } - - private static class CharacterCodeSetIDValueMap_ extends AbstractValueMap - { - public Object ltop(Object logicalValue) - { - if (((Integer)logicalValue).intValue() == -2) - return SYSTEM_VALUE; - else - return logicalValue; - } - } - - - -/** -Attribute ID for character identifier control. This identifies a String -attribute, which represents the character identifier control for the user. Possible -values are: -
      -
    • {@link #SYSTEM_VALUE SYSTEM_VALUE} - - The system value QCHRIDCTL will be used to determine the character - identifier control for this user. -
    • {@link #CHARACTER_IDENTIFIER_CONTROL_DEVICE_DESCRIPTION CHARACTER_IDENTIFIER_CONTROL_DEVICE_DESCRIPTION} - - Performs the same function as on the CHRID command parameter for display - files, printer files, and panel groups. -
    • {@link #CHARACTER_IDENTIFIER_CONTROL_JOB_CCSID CHARACTER_IDENTIFIER_CONTROL_JOB_CCSID} - - Performs the same function as on the CHRID command parameter for display - files, printer files, and panel groups. -
    -**/ - public static final String CHARACTER_IDENTIFIER_CONTROL = "CHARACTER_IDENTIFIER_CONTROL"; - - /** - Attribute value indicating the same function as on the CHRID command parameter for display - files, printer files, and panel groups. - - @see #CHARACTER_IDENTIFIER_CONTROL - **/ - public static final String CHARACTER_IDENTIFIER_CONTROL_DEVICE_DESCRIPTION = "*DEVD"; - - /** - Attribute value indicating the same function as on the CHRID command parameter for display - files, printer files, and panel groups. - - @see #CHARACTER_IDENTIFIER_CONTROL - **/ - public static final String CHARACTER_IDENTIFIER_CONTROL_JOB_CCSID = "*JOBCCSID"; - - static { - attributes_.add(CHARACTER_IDENTIFIER_CONTROL, String.class, false, - new Object[] {SYSTEM_VALUE, - CHARACTER_IDENTIFIER_CONTROL_DEVICE_DESCRIPTION, - CHARACTER_IDENTIFIER_CONTROL_JOB_CCSID}, null, true); - getterMap_.add(CHARACTER_IDENTIFIER_CONTROL, USRI0300_, "receiverVariable.characterIdentifierControl"); - setterMap_.add(CHARACTER_IDENTIFIER_CONTROL, CHGUSRPRF_, "CHRIDCTL"); - } - - - - -/** -Attribute ID for company. This identifies a String -attribute, which represents the company in the user's directory entry. -**/ - public static final String COMPANY = "COMPANY"; - - static { - attributes_.add(COMPANY, String.class, false); - getterMap_.add(COMPANY, QOKSCHD_, "receiverVariable.directoryEntries.company.fieldValue", INDEX_0_); - setterMap_.add(COMPANY, CHGDIRE_, "CMPNY", quoteValueMapNone_); - } - - - -/** -Attribute ID for country ID. This identifies a String -attribute, which represents the country ID used by the system for this user. -Possible values are: -
      -
    • {@link #SYSTEM_VALUE SYSTEM_VALUE} - - The system value QCNTRYID will be used to determine the country ID. -
    • The country ID. -
    -**/ - public static final String COUNTRY_ID = "COUNTRY_ID"; - - static { - attributes_.add(COUNTRY_ID, String.class, false, - new Object[] {SYSTEM_VALUE}, null, false); - getterMap_.add(COUNTRY_ID, USRI0300_, "receiverVariable.countryID"); - setterMap_.add(COUNTRY_ID, CHGUSRPRF_, "CNTRYID", quoteValueMap_); - } - - - -/** -Attribute ID for current library. This identifies a String -attribute, which represents the name of the user's current library. -Possible values are: -
      -
    • {@link #CURRENT_LIBRARY_NAME_DEFAULT CURRENT_LIBRARY_NAME_DEFAULT} - - The user does not have a current library. -
    • The library name. -
    -**/ - public static final String CURRENT_LIBRARY_NAME = "CURRENT_LIBRARY_NAME"; - - /** - Attribute value indicating that the user does not have a current library. - - @see #CURRENT_LIBRARY_NAME - **/ - public static final String CURRENT_LIBRARY_NAME_DEFAULT = "*CRTDFT"; - - static { - attributes_.add(CURRENT_LIBRARY_NAME, String.class, false, - new Object[] {CURRENT_LIBRARY_NAME_DEFAULT}, null, false); - getterMap_.add(CURRENT_LIBRARY_NAME, USRI0300_, "receiverVariable.currentLibraryName"); - setterMap_.add(CURRENT_LIBRARY_NAME, CHGUSRPRF_, "CURLIB"); - } - - - -/** -Attribute ID for date password expires. This identifies a read-only Date -attribute, which represents the date the user's password expires. If the -password is not set to expire, or is already expired, then this will -be {@link #NO_DATE NO_DATE}. -**/ - public static final String DATE_PASSWORD_EXPIRES = "DATE_PASSWORD_EXPIRES"; - - static { - attributes_.add(DATE_PASSWORD_EXPIRES, Date.class, true); - ValueMap valueMap = new DateValueMap(DateValueMap.FORMAT_DTS); - getterMap_.add(DATE_PASSWORD_EXPIRES, USRI0100_, "receiverVariable.datePasswordExpires", valueMap); - getterMap_.add(DATE_PASSWORD_EXPIRES, USRI0300_, "receiverVariable.datePasswordExpires", valueMap); - } - - - -/** -Attribute ID for days until password expires. This identifies a read-only Integer -attribute, which represents the number of days until the password will expire. -Possible values are: -
      -
    • 0 - The password is expired. -
    • 1-7 - The number of days until the password expires. -
    • -1 - The password will not expire in the next 7 days. -
    -**/ - public static final String DAYS_UNTIL_PASSWORD_EXPIRES = "DAYS_UNTIL_PASSWORD_EXPIRES"; - - static { - attributes_.add(DAYS_UNTIL_PASSWORD_EXPIRES, Integer.class, true); - getterMap_.add(DAYS_UNTIL_PASSWORD_EXPIRES, USRI0100_, "receiverVariable.daysUntilPasswordExpires"); - getterMap_.add(DAYS_UNTIL_PASSWORD_EXPIRES, USRI0300_, "receiverVariable.daysUntilPasswordExpires"); - } - - - -/** -Attribute ID for department. This identifies a String -attribute, which represents the department in the user's directory entry. -**/ - public static final String DEPARTMENT = "DEPARTMENT"; - - static { - attributes_.add(DEPARTMENT, String.class, false); - getterMap_.add(DEPARTMENT, QOKSCHD_, "receiverVariable.directoryEntries.department.fieldValue", INDEX_0_); - setterMap_.add(DEPARTMENT, CHGDIRE_, "DEPT", quoteValueMapNone_); - } - - -/** -Attribute ID for digital certificate indicator. This identifies a read-only Boolean -attribute, which indicates whether there are digital certificates associated with -this user. -**/ - public static final String DIGITAL_CERTIFICATE_INDICATOR = "DIGITAL_CERTIFICATE_INDICATOR"; - - static { - attributes_.add(DIGITAL_CERTIFICATE_INDICATOR, Boolean.class, true); - getterMap_.add(DIGITAL_CERTIFICATE_INDICATOR, USRI0300_, "receiverVariable.digitalCertificateIndicator", booleanValueMap01_); - } - - - -/** -Attribute ID for display sign-on information. This identifies a String -attribute, which represents whether the sign-on information display is shown when -the user signs on. Possible values are: -
      -
    • {@link #SYSTEM_VALUE SYSTEM_VALUE} - - The system value QDSPSGNINF determines if the sign-on information display - is shown when the user signs on. -
    • {@link #YES YES} - - The sign-on information display is shown when the user signs on. -
    • {@link #NO NO} - - The sign-on information display is not shown when the user signs on. -
    -**/ - public static final String DISPLAY_SIGN_ON_INFORMATION = "DISPLAY_SIGN_ON_INFORMATION"; - - static { - attributes_.add(DISPLAY_SIGN_ON_INFORMATION, String.class, false, - new Object[] {SYSTEM_VALUE, YES, NO }, null, true); - getterMap_.add(DISPLAY_SIGN_ON_INFORMATION, USRI0100_, "receiverVariable.displaySignOnInformation"); - getterMap_.add(DISPLAY_SIGN_ON_INFORMATION, USRI0300_, "receiverVariable.displaySignOnInformation"); - setterMap_.add(DISPLAY_SIGN_ON_INFORMATION, CHGUSRPRF_, "DSPSGNINF"); - } - - - -/** -Attribute ID for fax telephone number. This identifies a String -attribute, which represents the fax telephone number in the user's directory entry. -**/ - public static final String FAX_TELEPHONE_NUMBER = "FAX_TELEPHONE_NUMBER"; - - static { - attributes_.add(FAX_TELEPHONE_NUMBER, String.class, false); - getterMap_.add(FAX_TELEPHONE_NUMBER, QOKSCHD_, "receiverVariable.directoryEntries.faxTelephoneNumber.fieldValue", INDEX_0_); - setterMap_.add(FAX_TELEPHONE_NUMBER, CHGDIRE_, "FAXTELNBR", quoteValueMapNone_); - } - - -/** -Attribute ID for first name. This identifies a String -attribute, which represents the first name in the user's directory entry. -**/ - public static final String FIRST_NAME = "FIRST_NAME"; - - static { - attributes_.add(FIRST_NAME, String.class, false); - getterMap_.add(FIRST_NAME, QOKSCHD_, "receiverVariable.directoryEntries.firstName.fieldValue", INDEX_0_); - setterMap_.add(FIRST_NAME, CHGDIRE_, "FSTNAM", quoteValueMapNone_); - } - - -/** -Attribute ID for full name. This identifies a String -attribute, which represents the full name in the user's directory entry. -**/ - public static final String FULL_NAME = "FULL_NAME"; - - static { - attributes_.add(FULL_NAME, String.class, false); - getterMap_.add(FULL_NAME, QOKSCHD_, "receiverVariable.directoryEntries.fullName.fieldValue", INDEX_0_); - setterMap_.add(FULL_NAME, CHGDIRE_, "FULNAM", quoteValueMapNone_); - } - - - -/** -Attribute ID for group authority. This identifies a String -attribute, which represents the authority the user's group profile -has to objects the user creates. This can only be set to -{@link #NONE NONE} if the user does not belong to a group. -Possible values are: -
      -
    • {@link #NONE NONE} - - The group profile has no authority to the objects the user creates, - or the user does not have a group profile. -
    • {@link #GROUP_AUTHORITY_ALL GROUP_AUTHORITY_ALL} - - The group profile has all authority to the objects the user creates. -
    • {@link #GROUP_AUTHORITY_CHANGE GROUP_AUTHORITY_CHANGE} - - The group profile has change authority to the objects the user creates. -
    • {@link #GROUP_AUTHORITY_USE GROUP_AUTHORITY_USE} - - The group profile has use authority to the objects the user creates. -
    • {@link #GROUP_AUTHORITY_EXCLUDE GROUP_AUTHORITY_EXCLUDE} - - The group profile has exclude authority to the objects the user creates. -
    -**/ - public static final String GROUP_AUTHORITY = "GROUP_AUTHORITY"; - - /** - Attribute value indicating that the group profile has all authority to the objects the user creates. - - @see #GROUP_AUTHORITY - **/ - public static final String GROUP_AUTHORITY_ALL = "*ALL"; - - /** - Attribute value indicating that the group profile has change authority to the objects the user creates. - - @see #GROUP_AUTHORITY - **/ - public static final String GROUP_AUTHORITY_CHANGE = "*CHANGE"; - - /** - Attribute value indicating that the group profile has use authority to the objects the user creates. - - @see #GROUP_AUTHORITY - **/ - public static final String GROUP_AUTHORITY_USE = "*USE"; - - /** - Attribute value indicating that the group profile has exclude authority to the objects the user creates. - - @see #GROUP_AUTHORITY - **/ - public static final String GROUP_AUTHORITY_EXCLUDE = "*EXCLUDE"; - - static { - attributes_.add(GROUP_AUTHORITY, String.class, false, - new Object[] {NONE, - GROUP_AUTHORITY_ALL, - GROUP_AUTHORITY_CHANGE, - GROUP_AUTHORITY_USE, - GROUP_AUTHORITY_EXCLUDE }, null, true); - getterMap_.add(GROUP_AUTHORITY, USRI0200_, "receiverVariable.groupAuthority"); - getterMap_.add(GROUP_AUTHORITY, USRI0300_, "receiverVariable.groupAuthority"); - setterMap_.add(GROUP_AUTHORITY, CHGUSRPRF_, "GRPAUT"); - } - - - -/** -Attribute ID for group authority type. This identifies a String -attribute, which represents the type of authority the user's group has to -objects the user creates. Possible values are: -
      -
    • {@link #GROUP_AUTHORITY_TYPE_PRIVATE GROUP_AUTHORITY_TYPE_PRIVATE} - - The group profile has a private authority to the objects the user creates, - or the user does not have a group profile. -
    • {@link #GROUP_AUTHORITY_TYPE_PGP GROUP_AUTHORITY_TYPE_PGP} - - The group profile will be the primary group for objects the user creates. -
    -**/ - public static final String GROUP_AUTHORITY_TYPE = "GROUP_AUTHORITY_TYPE"; - - /** - Attribute value indicating that the group profile has a private authority to the objects the user creates, - or the user does not have a group profile. - - @see #GROUP_AUTHORITY_TYPE - **/ - public static final String GROUP_AUTHORITY_TYPE_PRIVATE = "*PRIVATE"; - - /** - Attribute value indicating that the group profile will be the primary group for objects the user creates. - - @see #GROUP_AUTHORITY_TYPE - **/ - public static final String GROUP_AUTHORITY_TYPE_PGP = "*PGP"; - - static { - attributes_.add(GROUP_AUTHORITY_TYPE, String.class, false, - new Object[] {GROUP_AUTHORITY_TYPE_PRIVATE, - GROUP_AUTHORITY_TYPE_PGP }, null, true); - getterMap_.add(GROUP_AUTHORITY_TYPE, USRI0200_, "receiverVariable.groupAuthorityType"); - getterMap_.add(GROUP_AUTHORITY_TYPE, USRI0300_, "receiverVariable.groupAuthorityType"); - setterMap_.add(GROUP_AUTHORITY_TYPE, CHGUSRPRF_, "GRPAUTTYP"); - } - - - -/** -Attribute ID for group ID number. This identifies a Long -attribute, which represents the group ID number for the user profile. -The group ID number is used to identify the user when it is a group and a -member of the group is using the integrated file system. This will -be {@link #GROUP_ID_NUMBER_NONE GROUP_ID_NUMBER_NONE} if the user does not -have a group ID. It will be {@link #GROUP_ID_NUMBER_GENERATE GROUP_ID_NUMBER_GENERATE} -if it was set as such; in which case, call -{@link #refreshAttributeValues refreshAttributeValues()} to retrieve the actual group ID -that was generated by the system. -**/ - public static final String GROUP_ID_NUMBER = "GROUP_ID_NUMBER"; - - static { - attributes_.add(GROUP_ID_NUMBER, Long.class, false); - getterMap_.add(GROUP_ID_NUMBER, USRI0300_, "receiverVariable.groupIDNumber", integerToLongValueMap_); - ValueMap valueMap = new GroupIDNumberValueMap_(); - setterMap_.add(GROUP_ID_NUMBER, CHGUSRPRF_, "GID", valueMap); - } - - private static class GroupIDNumberValueMap_ extends AbstractValueMap - { - public Object ltop(Object logicalValue) - { - long val = ((Long)logicalValue).longValue(); //@B2A - if (val == 0) return "*NONE"; //@B2C - if (val == -1) return "*GEN"; //@B2A - return logicalValue; //@B2C - } - } - - /** - * Attribute value indicating the system should generate a unique group ID number (*GEN). - * @see #GROUP_ID_NUMBER - **/ - public static final Long GROUP_ID_NUMBER_GENERATE = new Long(-1); //@B2A - - - /** - * Attribute value indicating the group ID number is *NONE. - * @see #GROUP_ID_NUMBER - **/ - public static final Long GROUP_ID_NUMBER_NONE = new Long(0); //@B2A - - - -/** -Attribute ID for group member indicator. This identifies a read-only Boolean -attribute, which indicates whether this user is a group that has members. -**/ - public static final String GROUP_MEMBER_INDICATOR = "GROUP_MEMBER_INDICATOR"; - - static { - attributes_.add(GROUP_MEMBER_INDICATOR, Boolean.class, true); - getterMap_.add(GROUP_MEMBER_INDICATOR, USRI0300_, "receiverVariable.groupMemberIndicator", booleanValueMap01_); - } - - -/** -Attribute ID for group profile name. This identifies a String attribute, -which represents the name of the group profile. -Possible values are: -
      -
    • {@link #NONE NONE} - - If the user does not have a group profile. -
    • The group profile name. -
    -**/ - public static final String GROUP_PROFILE_NAME = "GROUP_PROFILE_NAME"; - - static { - attributes_.add(GROUP_PROFILE_NAME, String.class, false, - new Object[] {NONE }, null, false); - getterMap_.add(GROUP_PROFILE_NAME, USRI0200_, "receiverVariable.groupProfileName"); - getterMap_.add(GROUP_PROFILE_NAME, USRI0300_, "receiverVariable.groupProfileName"); - setterMap_.add(GROUP_PROFILE_NAME, CHGUSRPRF_, "GRPPRF"); - } - - - -/** -Attribute ID for highest scheduling priority. This identifies a Integer -attribute, which represents the highest scheduling priority the user is allowed -to have for each job submitted to the system. The priority is a value from 0 -to 9, with 0 being the highest priority. -**/ - public static final String HIGHEST_SCHEDULING_PRIORITY = "HIGHEST_SCHEDULING_PRIORITY"; - - static { - attributes_.add(HIGHEST_SCHEDULING_PRIORITY, Integer.class, false); - ValueMap valueMap = new IntegerValueMap(); - getterMap_.add(HIGHEST_SCHEDULING_PRIORITY, USRI0300_, "receiverVariable.highestSchedulingPriority", valueMap); - setterMap_.add(HIGHEST_SCHEDULING_PRIORITY, CHGUSRPRF_, "PTYLMT"); - } - - - -/** -Attribute ID for home directory. This identifies a String -attribute, which represents the home directory for this user profile. -**/ - public static final String HOME_DIRECTORY = "HOME_DIRECTORY"; - - static { - attributes_.add(HOME_DIRECTORY, String.class, false); - getterMap_.add(HOME_DIRECTORY, USRI0300_, "receiverVariable.homeDirectory.homeDirectoryNameValue"); - setterMap_.add(HOME_DIRECTORY, CHGUSRPRF_, "HOMEDIR", quoteValueMap_); - } - - - - -/** -Attribute ID for indirect user. This identifies a Boolean -attribute, which indicates whether the user is an indirect user -as specified in the user's directory entry. -**/ - public static final String INDIRECT_USER = "INDIRECT_USER"; - - static { - attributes_.add(INDIRECT_USER, Boolean.class, false); - getterMap_.add(INDIRECT_USER, QOKSCHD_, "receiverVariable.directoryEntries.indirectUser.fieldValue", INDEX_0_, booleanValueMap01_); - setterMap_.add(INDIRECT_USER, CHGDIRE_, "INDUSR", booleanValueMapNoYes_); - } - - - -/** -Attribute ID for initial menu. This identifies a String attribute, -which represents the fully qualified integrated file system path name -of the initial menu for the user. Possible values are: -
      -
    • {@link #INITIAL_MENU_SIGNOFF INITIAL_MENU_SIGNOFF} -
    • The initial menu name. -
    - -@see com.ibm.as400.access.QSYSObjectPathName -**/ - public static final String INITIAL_MENU = "INITIAL_MENU"; - - /** - Attribute value for initial menu signoff. - - @see #INITIAL_MENU - **/ - public static final String INITIAL_MENU_SIGNOFF = "*SIGNOFF"; - - static { - attributes_.add(INITIAL_MENU, String.class, false, - new Object[] {INITIAL_MENU_SIGNOFF}, null, false); - getterMap_.add(INITIAL_MENU, USRI0300_, "receiverVariable.initialMenu", - new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "MNU")); - ValueMap valueMap = new QualifiedValueMap(QualifiedValueMap.FORMAT_CL, "MNU"); - setterMap_.add(INITIAL_MENU, CHGUSRPRF_, "INLMNU", valueMap); - } - - - -/** -Attribute ID for initial program. This identifies a String attribute, -which represents the fully qualified integrated file system path name of -the initial program for the user. Possible values are: -
      -
    • {@link #NONE NONE} -
    • The initial program name. -
    - -@see com.ibm.as400.access.QSYSObjectPathName -**/ - public static final String INITIAL_PROGRAM = "INITIAL_PROGRAM"; - - static { - attributes_.add(INITIAL_PROGRAM, String.class, false, - new Object[] {NONE}, null, false); - getterMap_.add(INITIAL_PROGRAM, USRI0300_, "receiverVariable.initialProgram", - new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "PGM")); - ValueMap valueMap = new QualifiedValueMap(QualifiedValueMap.FORMAT_CL, "PGM"); - setterMap_.add(INITIAL_PROGRAM, CHGUSRPRF_, "INLPGM", valueMap); - } - - - -/** -Attribute ID for job description. This identifies a String attribute, -which represents the fully qualified integrated file system path name -of the job description used for jobs that start through -subsystem work station entries. - -@see com.ibm.as400.access.QSYSObjectPathName -**/ - public static final String JOB_DESCRIPTION = "JOB_DESCRIPTION"; - - static { - attributes_.add(JOB_DESCRIPTION, String.class, false); - getterMap_.add(JOB_DESCRIPTION, USRI0300_, "receiverVariable.jobDescription", - new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "JOBD")); - ValueMap valueMap = new QualifiedValueMap(QualifiedValueMap.FORMAT_CL, "JOBD"); - setterMap_.add(JOB_DESCRIPTION, CHGUSRPRF_, "JOBD", valueMap); - } - - - -/** -Attribute ID for job title. This identifies a String -attribute, which represents the job title in the user's directory entry. -**/ - public static final String JOB_TITLE = "JOB_TITLE"; - - static { - attributes_.add(JOB_TITLE, String.class, false); - getterMap_.add(JOB_TITLE, QOKSCHD_, "receiverVariable.directoryEntries.jobTitle.fieldValue", INDEX_0_); - setterMap_.add(JOB_TITLE, CHGDIRE_, "TITLE", quoteValueMapNone_); - } - - - -/** -Attribute ID for keyboard buffering. This identifies a String -attribute, which represents the keyboard buffering value that is -used when a job is initialized for this user. Possible values are: -
      -
    • {@link #SYSTEM_VALUE SYSTEM_VALUE} - - The system value QKBDBUF determines the keybpard buffering value for - this user. -
    • {@link #YES YES} - - The type-ahead and attention-key buffering options are both on. -
    • {@link #NO NO} - - The type-ahead and attention-key buffering options are not on. -
    • {@link #KEYBOARD_BUFFERING_TYPE_AHEAD KEYBOARD_BUFFERING_TYPE_AHEAD} - - The type-ahead option is on, but the attention-key buffering options is not. -
    -**/ - public static final String KEYBOARD_BUFFERING = "KEYBOARD_BUFFERING"; - - /** - Attribute value indicating the type-ahead option is on, but the attention-key buffering options is not. - - @see #KEYBOARD_BUFFERING - **/ - public static final String KEYBOARD_BUFFERING_TYPE_AHEAD = "*TYPEAHEAD"; - - static { - attributes_.add(KEYBOARD_BUFFERING, String.class, false, - new Object[] {SYSTEM_VALUE, YES, NO, KEYBOARD_BUFFERING_TYPE_AHEAD }, null, true); - getterMap_.add(KEYBOARD_BUFFERING, USRI0300_, "receiverVariable.keyboardBuffering"); - setterMap_.add(KEYBOARD_BUFFERING, CHGUSRPRF_, "KBDBUF"); - } - - - -/** -Attribute ID for language ID. This identifies a String -attribute, which represents the language ID used by the system for this user. -Possible values are: -
      -
    • {@link #SYSTEM_VALUE SYSTEM_VALUE} - - The system value QLANGID will be used to determine the language ID. -
    • The language ID. -
    -**/ - public static final String LANGUAGE_ID = "LANGUAGE_ID"; - - static { - attributes_.add(LANGUAGE_ID, String.class, false, - new Object[] {SYSTEM_VALUE}, null, false); - getterMap_.add(LANGUAGE_ID, USRI0300_, "receiverVariable.languageID"); - setterMap_.add(LANGUAGE_ID, CHGUSRPRF_, "LANGID"); - } - - - -/** -Attribute ID for last name. This identifies a String -attribute, which represents the last name in the user's directory entry. -**/ - public static final String LAST_NAME = "LAST_NAME"; - - static { - attributes_.add(LAST_NAME, String.class, false); - getterMap_.add(LAST_NAME, QOKSCHD_, "receiverVariable.directoryEntries.lastName.fieldValue", INDEX_0_); - setterMap_.add(LAST_NAME, CHGDIRE_, "LSTNAM", quoteValueMapNone_); - } - - - -/** -Attribute ID for limit capabilities. This identifies a String -attribute, which indicates whether the user has limited capabilites. -Possible values are: -
      -
    • {@link #LIMIT_CAPABILITIES_PARTIAL LIMIT_CAPABILITIES_PARTIAL} - - The user cannot change the initial program or current library. -
    • {@link #YES YES} - - The user cannot change the initial menu, initial program, - or current library. The user cannot run commands from the - command line. -
    • {@link #NO NO} - - The user is not limited. -
    -**/ - public static final String LIMIT_CAPABILITIES = "LIMIT_CAPABILITIES"; - - /** - Attribute value indicating the user cannot change the initial program or current library. - - @see #LIMIT_CAPABILITIES - **/ - public static final String LIMIT_CAPABILITIES_PARTIAL = "*PARTIAL"; - - static { - attributes_.add(LIMIT_CAPABILITIES, String.class, false, - new Object[] {LIMIT_CAPABILITIES_PARTIAL, YES, NO }, null, true); - getterMap_.add(LIMIT_CAPABILITIES, USRI0200_, "receiverVariable.limitCapabilities"); - getterMap_.add(LIMIT_CAPABILITIES, USRI0300_, "receiverVariable.limitCapabilities"); - setterMap_.add(LIMIT_CAPABILITIES, CHGUSRPRF_, "LMTCPB"); - } - - - -/** -Attribute ID for limit device sessions. This identifies a String -attribute, which indicates whether the user is limited to one device -session. Possible values are: -
      -
    • {@link #SYSTEM_VALUE SYSTEM_VALUE} - - The system value QLMTDEVSSN determines if the user is limited to one - device session. -
    • {@link #YES YES} - - The user is limited to one session. -
    • {@link #NO NO} - - The user is not limited to one device session. -
    -**/ - public static final String LIMIT_DEVICE_SESSIONS = "LIMIT_DEVICE_SESSIONS"; - - static { - attributes_.add(LIMIT_DEVICE_SESSIONS, String.class, false, - new Object[] {SYSTEM_VALUE, YES, NO}, null, true); - getterMap_.add(LIMIT_DEVICE_SESSIONS, USRI0300_, "receiverVariable.limitDeviceSessions"); - setterMap_.add(LIMIT_DEVICE_SESSIONS, CHGUSRPRF_, "LMTDEVSSN"); - } - - - -/** -Attribute ID for locale job attributes. This identifies a String array -attribute, which represents a list of attributes which are set from the locale path -name at the time a job is started for this user. Possible values for the elements -of this array are: -
      -
    • {@link #NONE NONE} - - No job attributes are used from the locale path name at the time a job is - started for this user profile. If this is specified, then no other values - can be specified. -
    • {@link #SYSTEM_VALUE SYSTEM_VALUE} - - The job attributes assigned from the locale path name are determined by - the system value QSETJOBATR at the time a job is started for this user profile. - If this is specified, then no other values can be specified. -
    • {@link #LOCALE_JOB_ATTRIBUTES_CCSID LOCALE_JOB_ATTRIBUTES_CCSID} - - The coded character set identifier is set from the locale path name - at the time a job is started for this user profile. -
    • {@link #LOCALE_JOB_ATTRIBUTES_DATE_FORMAT LOCALE_JOB_ATTRIBUTES_DATE_FORMAT} - - The date format is set from the locale path name - at the time a job is started for this user profile. -
    • {@link #LOCALE_JOB_ATTRIBUTES_DATE_SEPARATOR LOCALE_JOB_ATTRIBUTES_DATE_SEPARATOR} - - The date separator is set from the locale path name - at the time a job is started for this user profile. -
    • {@link #LOCALE_JOB_ATTRIBUTES_SORT_SEQUENCE LOCALE_JOB_ATTRIBUTES_SORT_SEQUENCE} - - The sort sequence is set from the locale path name - at the time a job is started for this user profile. -
    • {@link #LOCALE_JOB_ATTRIBUTES_TIME_SEPARATOR LOCALE_JOB_ATTRIBUTES_TIME_SEPARATOR} - - The time separator is set from the locale path name - at the time a job is started for this user profile. -
    • {@link #LOCALE_JOB_ATTRIBUTES_DECIMAL_FORMAT LOCALE_JOB_ATTRIBUTES_DECIMAL_FORMAT} - - The decimal format is set from the locale path name - at the time a job is started for this user profile. -
    -**/ - public static final String LOCALE_JOB_ATTRIBUTES = "LOCALE_JOB_ATTRIBUTES"; - - /** - Attribute value indicating that the coded character set identifier is set from the locale path name - at the time a job is started for this user profile. - - @see #LOCALE_JOB_ATTRIBUTES - **/ - public static final String LOCALE_JOB_ATTRIBUTES_CCSID = "*CCSID"; - - /** - Attribute value indicating that the date format is set from the locale path name - at the time a job is started for this user profile. - - @see #LOCALE_JOB_ATTRIBUTES - **/ - public static final String LOCALE_JOB_ATTRIBUTES_DATE_FORMAT = "*DATFMT"; - - /** - Attribute value indicating that the date separator is set from the locale path name - at the time a job is started for this user profile. - - @see #LOCALE_JOB_ATTRIBUTES - **/ - public static final String LOCALE_JOB_ATTRIBUTES_DATE_SEPARATOR = "*DATSEP"; - - /** - Attribute value indicating that the sort sequence is set from the locale path name - at the time a job is started for this user profile. - - @see #LOCALE_JOB_ATTRIBUTES - **/ - public static final String LOCALE_JOB_ATTRIBUTES_SORT_SEQUENCE = "*SRTSEQ"; - - /** - Attribute value indicating that the time separator is set from the locale path name - at the time a job is started for this user profile. - - @see #LOCALE_JOB_ATTRIBUTES - **/ - public static final String LOCALE_JOB_ATTRIBUTES_TIME_SEPARATOR = "*TIMSEP"; - - /** - Attribute value indicating that the decimal format is set from the locale path name - at the time a job is started for this user profile. - - @see #LOCALE_JOB_ATTRIBUTES - **/ - public static final String LOCALE_JOB_ATTRIBUTES_DECIMAL_FORMAT = "*DECFMT"; - - static { - String[] possibleValues = new String[] {NONE, - SYSTEM_VALUE, - LOCALE_JOB_ATTRIBUTES_CCSID, - LOCALE_JOB_ATTRIBUTES_DATE_FORMAT, - LOCALE_JOB_ATTRIBUTES_DATE_SEPARATOR, - LOCALE_JOB_ATTRIBUTES_SORT_SEQUENCE, - LOCALE_JOB_ATTRIBUTES_TIME_SEPARATOR, - LOCALE_JOB_ATTRIBUTES_DECIMAL_FORMAT}; - attributes_.add(LOCALE_JOB_ATTRIBUTES, String.class, false, - possibleValues, null, true, true); - ValueMap valueMap = new OptionsValueMap('N', 'Y', possibleValues); - getterMap_.add(LOCALE_JOB_ATTRIBUTES, USRI0300_, "receiverVariable.localeJobAttributes", valueMap); - setterMap_.add(LOCALE_JOB_ATTRIBUTES, CHGUSRPRF_, "SETJOBATR", arrayValueMapNone_); //@B1C - } - - - -/** -Attribute ID for locale path name. This identifies a String -attribute, which represents the locale path name that is assigned to the -user profile when a job is started. -Possible values are: -
      -
    • {@link #SYSTEM_VALUE SYSTEM_VALUE} - - The QLOCALE system value is used to determine the locale path name. -
    • {@link #NONE NONE} - - No locale path name is assigned. -
    • {@link #LOCALE_PATH_NAME_C LOCALE_PATH_NAME_C} - - The C locale path name is assigned. -
    • {@link #LOCALE_PATH_NAME_POSIX LOCALE_PATH_NAME_POSIX} - - The POSIX locale path name is assigned. -
    -**/ - public static final String LOCALE_PATH_NAME = "LOCALE_PATH_NAME"; - - /** - Attribute value indicating the C locale path name. - - @see #LOCALE_PATH_NAME - **/ - public static final String LOCALE_PATH_NAME_C = "*C"; - - /** - Attribute value indicating the POSIX locale path name. - - @see #LOCALE_PATH_NAME - **/ - public static final String LOCALE_PATH_NAME_POSIX = "*POSIX"; - - static { - attributes_.add(LOCALE_PATH_NAME, String.class, false, - new Object[] {SYSTEM_VALUE, NONE, LOCALE_PATH_NAME_C, LOCALE_PATH_NAME_POSIX }, null, true); - getterMap_.add(LOCALE_PATH_NAME, USRI0300_, "receiverVariable.localePathName"); - setterMap_.add(LOCALE_PATH_NAME, CHGUSRPRF_, "LOCALE"); - } - - - -/** -Attribute ID for local data indicator. This identifies a read-only String -attribute, which indicates where this user was created. Possible values are: -
      -
    • {@link #LOCAL_DATA_INDICATOR_LOCAL LOCAL_DATA_INDICATOR_LOCAL} - - If the user was created on this system or a remote user - was created on this system. -
    • {@link #LOCAL_DATA_INDICATOR_SHADOWED LOCAL_DATA_INDICATOR_SHADOWED} - - If the user was shadowed from another system. -
    -**/ - public static final String LOCAL_DATA_INDICATOR = "LOCAL_DATA_INDICATOR"; - - /** - Attribute value indicating that the user was created on this system or if a remote user - was created on this system. - - @see #LOCAL_DATA_INDICATOR - **/ - public static final String LOCAL_DATA_INDICATOR_LOCAL = "0"; - - /** - Attribute value indicating that the user was shadowed from another system. - - @see #LOCAL_DATA_INDICATOR - **/ - public static final String LOCAL_DATA_INDICATOR_SHADOWED = "1"; - - static { - attributes_.add(LOCAL_DATA_INDICATOR, String.class, true, - new Object[] {LOCAL_DATA_INDICATOR_LOCAL, LOCAL_DATA_INDICATOR_SHADOWED }, null, true); - getterMap_.add(LOCAL_DATA_INDICATOR, QOKSCHD_, "receiverVariable.directoryEntries.localDataIndicator.fieldValue", INDEX_0_); - } - - - -/** -Attribute ID for location. This identifies a String -attribute, which represents the location in the user's directory entry. -**/ - public static final String LOCATION = "LOCATION"; - - static { - attributes_.add(LOCATION, String.class, false); - getterMap_.add(LOCATION, QOKSCHD_, "receiverVariable.directoryEntries.location.fieldValue", INDEX_0_); - setterMap_.add(LOCATION, CHGDIRE_, "LOC", quoteValueMapNone_); - } - - - -/** -Attribute ID for mailing address line 1. This identifies a String -attribute, which represents the mailing address line 1 in the user's directory entry. -**/ - public static final String MAILING_ADDRESS_LINE_1 = "MAILING_ADDRESS_LINE_1"; - - static { - attributes_.add(MAILING_ADDRESS_LINE_1, String.class, false); - getterMap_.add(MAILING_ADDRESS_LINE_1, QOKSCHD_, "receiverVariable.directoryEntries.mailingAddressLine1.fieldValue", INDEX_0_); - setterMap_.add(MAILING_ADDRESS_LINE_1, CHGDIRE_, "ADDR1", quoteValueMapNone_); - } - - - -/** -Attribute ID for mailing address line 2. This identifies a String -attribute, which represents the mailing address line 2 in the user's directory entry. -**/ - public static final String MAILING_ADDRESS_LINE_2 = "MAILING_ADDRESS_LINE_2"; - - static { - attributes_.add(MAILING_ADDRESS_LINE_2, String.class, false); - getterMap_.add(MAILING_ADDRESS_LINE_2, QOKSCHD_, "receiverVariable.directoryEntries.mailingAddressLine2.fieldValue", INDEX_0_); - setterMap_.add(MAILING_ADDRESS_LINE_2, CHGDIRE_, "ADDR2", quoteValueMapNone_); - } - - - -/** -Attribute ID for mailing address line 3. This identifies a String -attribute, which represents the mailing address line 3 in the user's directory entry. -**/ - public static final String MAILING_ADDRESS_LINE_3 = "MAILING_ADDRESS_LINE_3"; - - static { - attributes_.add(MAILING_ADDRESS_LINE_3, String.class, false); - getterMap_.add(MAILING_ADDRESS_LINE_3, QOKSCHD_, "receiverVariable.directoryEntries.mailingAddressLine3.fieldValue", INDEX_0_); - setterMap_.add(MAILING_ADDRESS_LINE_3, CHGDIRE_, "ADDR3", quoteValueMapNone_); - } - - - -/** -Attribute ID for mailing address line 4. This identifies a String -attribute, which represents the mailing address line 4 in the user's directory entry. -**/ - public static final String MAILING_ADDRESS_LINE_4 = "MAILING_ADDRESS_LINE_4"; - - static { - attributes_.add(MAILING_ADDRESS_LINE_4, String.class, false); - getterMap_.add(MAILING_ADDRESS_LINE_4, QOKSCHD_, "receiverVariable.directoryEntries.mailingAddressLine4.fieldValue", INDEX_0_); - setterMap_.add(MAILING_ADDRESS_LINE_4, CHGDIRE_, "ADDR4", quoteValueMapNone_); - } - - - -/** -Attribute ID for mail notification. This identifies a String -attribute, which indicates whether the user is notified of the -arrival of mail. This is part of the user's directory entry. -Possible values are: -
      -
    • {@link #MAIL_NOTIFICATION_SPECIFIC MAIL_NOTIFICATION_SPECIFIC} - - The user is notified of the arrival of specific types of mail. - Use the {@link #PRIORITY_MAIL_NOTIFICATION PRIORITY_MAIL_NOTIFICATION} - and {@link #MESSAGE_NOTIFICATION MESSAGE_NOTIFICATION} attributes - for specific information. -
    • {@link #MAIL_NOTIFICATION_ALL MAIL_NOTIFICATION_ALL} - - The user is notified of the arrival of all types of mail. -
    • {@link #MAIL_NOTIFICATION_NONE MAIL_NOTIFICATION_NONE} - - The user is not notified of the arrival of mail. -
    -**/ - public static final String MAIL_NOTIFICATION = "MAIL_NOTIFICATION"; - - /** - Attribute value indicating that the user is notified of the arrival - of specific types of mail. - - @see #MAIL_NOTIFICATION - **/ - public static final String MAIL_NOTIFICATION_SPECIFIC = "*SPECIFIC"; - - /** - Attribute value indicating that the user is notified of the arrival - of all types of mail. - - @see #MAIL_NOTIFICATION - **/ - public static final String MAIL_NOTIFICATION_ALL = "*ALLMAIL"; - - /** - Attribute value indicating that the user is not notified of the arrival of mail. - - @see #MAIL_NOTIFICATION - **/ - public static final String MAIL_NOTIFICATION_NONE = "*NOMAIL"; - - static { - attributes_.add(MAIL_NOTIFICATION, String.class, false, - new Object[] {MAIL_NOTIFICATION_SPECIFIC, - MAIL_NOTIFICATION_ALL, - MAIL_NOTIFICATION_NONE }, null, true); - getterMap_.add(MAIL_NOTIFICATION, QOKSCHD_, "receiverVariable.directoryEntries.mailNotification.fieldValue", INDEX_0_, - new MailNotificationValueMap_(0, new String[] { null, MAIL_NOTIFICATION_SPECIFIC, MAIL_NOTIFICATION_ALL, MAIL_NOTIFICATION_NONE })); - setterMap_.add(MAIL_NOTIFICATION, CHGDIRE_, "NFYMAIL"); - } - - private static class MailNotificationValueMap_ extends AbstractValueMap - { - private int index_; - private Object[] logicalValues_; - - MailNotificationValueMap_(int index, Object[] logicalValues) - { - index_ = index; - logicalValues_ = logicalValues; - } - - public Object ptol(Object physicalValue) - { - // The possible values are EBCDIC characters for '1', '2', '3;, etc. - // Adding to 16 turns it into an int. - return logicalValues_[16 + ((byte[])physicalValue)[index_]]; - } - } - - - -/** -Attribute ID for manager code. This identifies a read-only Boolean -attribute, which represents the manager code in the user's directory entry. -**/ - public static final String MANAGER_CODE = "MANAGER_CODE"; - - static { - attributes_.add(MANAGER_CODE, Boolean.class, true); - getterMap_.add(MANAGER_CODE, QOKSCHD_, "receiverVariable.directoryEntries.managerCode.fieldValue", INDEX_0_, booleanValueMap01_); - } - - - -/** -Attribute ID for maximum allowed storage. This identifies a Integer -attribute, which represents the maximum amount of auxiliary storage (in -kilobytes) that can be assigned to store permanant objects owned by the user. -If the user does not have a maximum amount of allowed storage, this will -be -1. -**/ - public static final String MAXIMUM_ALLOWED_STORAGE = "MAXIMUM_ALLOWED_STORAGE"; - - static { - attributes_.add(MAXIMUM_ALLOWED_STORAGE, Integer.class, false); - getterMap_.add(MAXIMUM_ALLOWED_STORAGE, USRI0300_, "receiverVariable.maximumAllowedStorage"); - ValueMap valueMap = new MaximumAllowedStorageValueMap_(); - setterMap_.add(MAXIMUM_ALLOWED_STORAGE, CHGUSRPRF_, "MAXSTG", valueMap); - } - - private static class MaximumAllowedStorageValueMap_ extends AbstractValueMap - { - private static final String NOMAX = "*NOMAX"; - - public Object ltop(Object logicalValue) - { - int asInt = ((Integer)logicalValue).intValue(); - switch(asInt) { - case -1: - return NOMAX; - default: - return logicalValue; - } - } - } - - - -/** -Attribute ID for message notification. This identifies a Boolean -attribute, which indicates whether the user is notified of the -arrival of messages. -This is part of the user's directory entry. -**/ - public static final String MESSAGE_NOTIFICATION = "MESSAGE_NOTIFICATION"; - - static { - attributes_.add(MESSAGE_NOTIFICATION, Boolean.class, false, null, null, false); - getterMap_.add(MESSAGE_NOTIFICATION, QOKSCHD_, "receiverVariable.directoryEntries.mailNotification.fieldValue", INDEX_0_, - new MailNotificationValueMap_(2, new Boolean[] { Boolean.FALSE, Boolean.TRUE })); - setterMap_.add(MESSAGE_NOTIFICATION, CHGDIRE_, "NFYMSGS", booleanValueMapNoYes_); - } - - - -/** -Attribute ID for message queue delivery method. This identifies a String -attribute, which represents how the messages are delivered to the message queue -used by the user. Possible values are: -
      -
    • {@link #MESSAGE_QUEUE_DELIVERY_METHOD_BREAK MESSAGE_QUEUE_DELIVERY_METHOD_BREAK} - - The job to which the message queue is assigned is interrupted when a message - arrives on the message queue. -
    • {@link #MESSAGE_QUEUE_DELIVERY_METHOD_DEFAULT MESSAGE_QUEUE_DELIVERY_METHOD_DEFAULT} - - Messages requiring replies are answered with their default reply. -
    • {@link #MESSAGE_QUEUE_DELIVERY_METHOD_HOLD MESSAGE_QUEUE_DELIVERY_METHOD_HOLD} - - The messages are held in the message queue until they are requested by the - user or program. -
    • {@link #MESSAGE_QUEUE_DELIVERY_METHOD_NOTIFY MESSAGE_QUEUE_DELIVERY_METHOD_NOTIFY} - - The job to which the message queue is assigned is notified when a message arrives - on the message queue. -
    -**/ - public static final String MESSAGE_QUEUE_DELIVERY_METHOD = "MESSAGE_QUEUE_DELIVERY_METHOD"; - - /** - Attribute value indicating that the job to which the message queue is - assigned is interrupted when a message arrives on the message queue. - - @see #MESSAGE_QUEUE_DELIVERY_METHOD - **/ - public static final String MESSAGE_QUEUE_DELIVERY_METHOD_BREAK = "*BREAK"; - - /** - Attribute value indicating that messages requiring replies are - answered with their default reply. - - @see #MESSAGE_QUEUE_DELIVERY_METHOD - **/ - public static final String MESSAGE_QUEUE_DELIVERY_METHOD_DEFAULT = "*DFT"; - - /** - Attribute value indicating that the messages are held in the message - queue until they are requested by the user or program. - - @see #MESSAGE_QUEUE_DELIVERY_METHOD - **/ - public static final String MESSAGE_QUEUE_DELIVERY_METHOD_HOLD = "*HOLD"; - - /** - Attribute value indicating that the job to which the message queue is - assigned is notified when a message arrives on the message queue. - - @see #MESSAGE_QUEUE_DELIVERY_METHOD - **/ - public static final String MESSAGE_QUEUE_DELIVERY_METHOD_NOTIFY = "*NOTIFY"; - - static { - attributes_.add(MESSAGE_QUEUE_DELIVERY_METHOD, String.class, false, - new Object[] {MESSAGE_QUEUE_DELIVERY_METHOD_BREAK, - MESSAGE_QUEUE_DELIVERY_METHOD_DEFAULT, - MESSAGE_QUEUE_DELIVERY_METHOD_HOLD, - MESSAGE_QUEUE_DELIVERY_METHOD_NOTIFY }, null, true); - getterMap_.add(MESSAGE_QUEUE_DELIVERY_METHOD, USRI0300_, "receiverVariable.messageQueueDeliveryMethod"); - setterMap_.add(MESSAGE_QUEUE_DELIVERY_METHOD, CHGUSRPRF_, "DLVRY"); - } - - - -/** -Attribute ID for message queue. This identifies a String attribute, -which represents the fully qualified integrated file system path name -of the message queue that is used by this user. - -@see com.ibm.as400.access.QSYSObjectPathName -**/ - public static final String MESSAGE_QUEUE = "MESSAGE_QUEUE"; - - static { - attributes_.add(MESSAGE_QUEUE, String.class, false); - getterMap_.add(MESSAGE_QUEUE, USRI0300_, "receiverVariable.messageQueue", - new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "MSGQ")); - ValueMap valueMap = new QualifiedValueMap(QualifiedValueMap.FORMAT_CL, "MSGQ"); - setterMap_.add(MESSAGE_QUEUE, CHGUSRPRF_, "MSGQ", valueMap); - } - - - -/** -Attribute ID for message queue severity. This identifies an Integer attribute, -which represents the lowest severity that a message can have and still be delivered to -a user in break or notify mode. -**/ - public static final String MESSAGE_QUEUE_SEVERITY = "MESSAGE_QUEUE_SEVERITY"; - - static { - attributes_.add(MESSAGE_QUEUE_SEVERITY, Integer.class, false); - getterMap_.add(MESSAGE_QUEUE_SEVERITY, USRI0300_, "receiverVariable.messageQueueSeverity"); - setterMap_.add(MESSAGE_QUEUE_SEVERITY, CHGUSRPRF_, "SEV"); - } - - - -/** -Attribute ID for middle name. This identifies a String -attribute, which represents the middle name in the user's directory entry. -**/ - public static final String MIDDLE_NAME = "MIDDLE_NAME"; - - static { - attributes_.add(MIDDLE_NAME, String.class, false); - getterMap_.add(MIDDLE_NAME, QOKSCHD_, "receiverVariable.directoryEntries.middleName.fieldValue", INDEX_0_); - setterMap_.add(MIDDLE_NAME, CHGDIRE_, "MIDNAM", quoteValueMapNone_); - } - - - -/** -Attribute ID for network user ID. This identifies a String -attribute, which represents the network user ID in the user's directory entry. -**/ - public static final String NETWORK_USER_ID = "NETWORK_USER_ID"; - - static { - attributes_.add(NETWORK_USER_ID, String.class, false); - getterMap_.add(NETWORK_USER_ID, QOKSCHD_, "receiverVariable.directoryEntries.networkUserID.fieldValue", INDEX_0_); - setterMap_.add(NETWORK_USER_ID, CHGDIRE_, "NETUSRID", quoteValueMapNone_); - } - - -/** -Attribute ID for no password indicator. This identifies a read-only Boolean -attribute, which indicates whether there is no password. -**/ - public static final String NO_PASSWORD_INDICATOR = "NO_PASSWORD_INDICATOR"; - - static { - attributes_.add(NO_PASSWORD_INDICATOR, Boolean.class, true); - getterMap_.add(NO_PASSWORD_INDICATOR, USRI0100_, "receiverVariable.noPasswordIndicator", booleanValueMapNY_); - getterMap_.add(NO_PASSWORD_INDICATOR, USRI0300_, "receiverVariable.noPasswordIndicator", booleanValueMapNY_); - } - - - -/** -Attribute ID for object auditing value. This identifies a String -attribute, which represents the user's object auditing value. Possible values are: -
      -
    • {@link #NONE NONE} - - No additional object auditing is done for the user. -
    • {@link #OBJECT_AUDITING_VALUE_CHANGE OBJECT_AUDITING_VALUE_CHANGE} - - Object changes are audited for the user if the object's auditing - value is *USRPRF. -
    • {@link #OBJECT_AUDITING_VALUE_ALL OBJECT_AUDITING_VALUE_ALL} - - Object read and change operations are audited for the user - if the object's auditing value is *USRPRF. -
    -**/ - public static final String OBJECT_AUDITING_VALUE = "OBJECT_AUDITING_VALUE"; - - /** - Attribute value indicating that object changes are audited for the user if the object's auditing - value is *USRPRF. - - @see #OBJECT_AUDITING_VALUE - **/ - public static final String OBJECT_AUDITING_VALUE_CHANGE = "*CHANGE"; - - /** - Attribute value indicating that object read and change operations are audited for the user - if the object's auditing value is *USRPRF. - - @see #OBJECT_AUDITING_VALUE - **/ - public static final String OBJECT_AUDITING_VALUE_ALL = "*ALL"; - - static { - attributes_.add(OBJECT_AUDITING_VALUE, String.class, false, - new Object[] {NONE, - OBJECT_AUDITING_VALUE_CHANGE, - OBJECT_AUDITING_VALUE_ALL }, null, true); - getterMap_.add(OBJECT_AUDITING_VALUE, USRI0300_, "receiverVariable.objectAuditingValue"); - setterMap_.add(OBJECT_AUDITING_VALUE, CHGUSRAUD_, "OBJAUD"); - } - - - -/** -Attribute ID for office. This identifies a String -attribute, which represents the office in the user's directory entry. -**/ - public static final String OFFICE = "OFFICE"; - - static { - attributes_.add(OFFICE, String.class, false); - getterMap_.add(OFFICE, QOKSCHD_, "receiverVariable.directoryEntries.office.fieldValue", INDEX_0_); - setterMap_.add(OFFICE, CHGDIRE_, "OFC", quoteValueMapNone_); - } - - - -/** -Attribute ID for O/R name. This identifies a read-only String -attribute, which represents the paper representation of the X.400 O/R -name in the user's directory entry. -**/ - public static final String OR_NAME = "OR_NAME"; - - static { - attributes_.add(OR_NAME, String.class, true); - getterMap_.add(OR_NAME, QOKSCHD_, "receiverVariable.directoryEntries.orName.fieldValue", INDEX_0_); - } - - - -/** -Attribute ID for output queue. This identifies a String attribute, -which represents the fully qualified integrated file system path name -of the output queue that is used by this user. Possible values are: -
      -
    • {@link #OUTPUT_QUEUE_WORK_STATION OUTPUT_QUEUE_WORK_STATION} - - The output queue assigned to the user's work station is used. -
    • {@link #OUTPUT_QUEUE_DEVICE OUTPUT_QUEUE_DEVICE} - - An output queue with the same name as the device specified - in the printer device parameter is used. -
    • The output queue name. -
    - -@see com.ibm.as400.access.QSYSObjectPathName -**/ - public static final String OUTPUT_QUEUE = "OUTPUT_QUEUE"; - - /** - Attribute value indicating that the output queue assigned to the user's work station is used. - - @see #OUTPUT_QUEUE - **/ - public static final String OUTPUT_QUEUE_WORK_STATION = "*WRKSTN"; - - /** - Attribute value indicating that an output queue with the same name as the device specified - in the printer device parameter is used. - - @see #OUTPUT_QUEUE - **/ - public static final String OUTPUT_QUEUE_DEVICE = "*DEV"; - - static { - attributes_.add(OUTPUT_QUEUE, String.class, false, - new Object[] {OUTPUT_QUEUE_WORK_STATION, OUTPUT_QUEUE_DEVICE }, null, false); - getterMap_.add(OUTPUT_QUEUE, USRI0300_, "receiverVariable.outputQueue", - new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "OUTQ")); - ValueMap valueMap = new QualifiedValueMap(QualifiedValueMap.FORMAT_CL, "OUTQ"); - setterMap_.add(OUTPUT_QUEUE, CHGUSRPRF_, "OUTQ", valueMap); - } - - - -/** -Attribute ID for owner. This identifies a String attribute, -which indicates who is to own objects created by this user. Possible values are: -
      -
    • {@link #OWNER_USER_PROFILE OWNER_USER_PROFILE} - - The user owns any objects the user creates. If the user does not - have a group profile, the field contains this value. -
    • {@link #OWNER_GROUP_PROFILE OWNER_GROUP_PROFILE} - - The user's group profile owns any objects the user creates. -
    -**/ - public static final String OWNER = "OWNER"; - - /** - Attribute value indicating that the user owns any objects the user creates. - If the user does not have a group profile, the field contains this value. - - @see #OWNER - **/ - public static final String OWNER_USER_PROFILE = "*USRPRF"; - - /** - Attribute value indicating that the user's group profile owns any objects the user creates. - - @see #OWNER - **/ - public static final String OWNER_GROUP_PROFILE = "*GRPPRF"; - - static { - attributes_.add(OWNER, String.class, false, - new Object[] {OWNER_USER_PROFILE, OWNER_GROUP_PROFILE }, null, true); - getterMap_.add(OWNER, USRI0300_, "receiverVariable.owner"); - setterMap_.add(OWNER, CHGUSRPRF_, "OWNER"); - } - - - -/** -Attribute ID for password change date. This identifies a read-only Date attribute, -which represents the date the user's password was last changed. -The Date value is converted using the default Java locale. -**/ - public static final String PASSWORD_CHANGE_DATE = "PASSWORD_CHANGE_DATE"; - - static { - attributes_.add(PASSWORD_CHANGE_DATE, Date.class, true); - ValueMap valueMap = new DateValueMap(DateValueMap.FORMAT_DTS); - getterMap_.add(PASSWORD_CHANGE_DATE, USRI0100_, "receiverVariable.passwordChangeDate", valueMap); - getterMap_.add(PASSWORD_CHANGE_DATE, USRI0300_, "receiverVariable.passwordChangeDate", valueMap); - } - - -/** -Attribute ID for password expiration interval. This identifies a Integer -attribute, which represents the number of days the user's password can remain -active before it must be changed. Possible values are: -
      -
    • 0 - The system value QPWDEXPITV is used to determine the user's - password expiration interval. -
    • -1 - The user's password does not expire. -
    • The number of days the user's password can remain active before it must - be changed. -
    -**/ - public static final String PASSWORD_EXPIRATION_INTERVAL = "PASSWORD_EXPIRATION_INTERVAL"; - - static { - attributes_.add(PASSWORD_EXPIRATION_INTERVAL, Integer.class, false); - getterMap_.add(PASSWORD_EXPIRATION_INTERVAL, USRI0100_, "receiverVariable.passwordExpirationInterval"); - getterMap_.add(PASSWORD_EXPIRATION_INTERVAL, USRI0300_, "receiverVariable.passwordExpirationInterval"); - ValueMap valueMap = new PasswordExpirationIntervalValueMap_(); - setterMap_.add(PASSWORD_EXPIRATION_INTERVAL, CHGUSRPRF_, "PWDEXPITV", valueMap); - } - - private static class PasswordExpirationIntervalValueMap_ extends AbstractValueMap - { - private static final String NOMAX = "*NOMAX"; - - public Object ltop(Object logicalValue) - { - int asInt = ((Integer)logicalValue).intValue(); - switch(asInt) { - case 0: - return SYSTEM_VALUE; - case -1: - return NOMAX; - default: - return logicalValue; - } - } - } - - - -/** -Attribute ID for preferred name. This identifies a String -attribute, which represents the preferred name in the user's directory entry. -**/ - public static final String PREFERRED_NAME = "PREFERRED_NAME"; - - static { - attributes_.add(PREFERRED_NAME, String.class, false); - getterMap_.add(PREFERRED_NAME, QOKSCHD_, "receiverVariable.directoryEntries.preferredName.fieldValue", INDEX_0_); - setterMap_.add(PREFERRED_NAME, CHGDIRE_, "PREFNAM", quoteValueMapNone_); - } - - - -/** -Attribute ID for previous sign-on. This identifies a read-only Date attribute, -which represents the date and time the user last signed on. If the -user has never signed on, then this will be {@link #NO_DATE NO_DATE}. -The Date value is converted using the default Java locale. -**/ - public static final String PREVIOUS_SIGN_ON = "PREVIOUS_SIGN_ON"; - - static { - attributes_.add(PREVIOUS_SIGN_ON, Date.class, true); - ValueMap valueMap = new DateValueMap(DateValueMap.FORMAT_13); - getterMap_.add(PREVIOUS_SIGN_ON, USRI0100_, "receiverVariable.previousSignOnDateAndTime", valueMap); - getterMap_.add(PREVIOUS_SIGN_ON, USRI0300_, "receiverVariable.previousSignOnDateAndTime", valueMap); - } - - - -/** -Attribute ID for print cover page. This identifies a Boolean -attribute, which indicates whether to print a cover page as specified -in the user's directory entry. -**/ - public static final String PRINT_COVER_PAGE = "PRINT_COVER_PAGE"; - - static { - attributes_.add(PRINT_COVER_PAGE, Boolean.class, false); - getterMap_.add(PRINT_COVER_PAGE, QOKSCHD_, "receiverVariable.directoryEntries.printCoverPage.fieldValue", INDEX_0_, booleanValueMap01_); - setterMap_.add(PRINT_COVER_PAGE, CHGDIRE_, "PRTCOVER", booleanValueMapNoYes_); - } - - - -/** -Attribute ID for print device. This identifies a String attribute, -which represents the printer used to print for this user. Possible values are: -
      -
    • {@link #PRINT_DEVICE_WORK_STATION PRINT_DEVICE_WORK_STATION} - - The printer assigned to the user's work station is used. -
    • {@link #SYSTEM_VALUE SYSTEM_VALUE} - - The default system printer specified in the system value QPRTDEV - is used. -
    • The print device. -
    -**/ - public static final String PRINT_DEVICE = "PRINT_DEVICE"; - - /** - Attribute value indicating that the printer assigned to the user's work station is used. - - @see #PRINT_DEVICE - **/ - public static final String PRINT_DEVICE_WORK_STATION = "*WRKSTN"; - - static { - attributes_.add(PRINT_DEVICE, String.class, false, - new Object[] {PRINT_DEVICE_WORK_STATION, SYSTEM_VALUE }, null, false); - getterMap_.add(PRINT_DEVICE, USRI0300_, "receiverVariable.printDevice"); - setterMap_.add(PRINT_DEVICE, CHGUSRPRF_, "PRTDEV"); - } - - - -/** -Attribute ID for priority mail notification. This identifies a Boolean -attribute, which indicates whether the user is notified of the -arrival of priority, private, and important mail. -This is part of the user's directory entry. -**/ - public static final String PRIORITY_MAIL_NOTIFICATION = "PRIORITY_MAIL_NOTIFICATION"; - - static { - attributes_.add(PRIORITY_MAIL_NOTIFICATION, Boolean.class, false, null, null, false); - getterMap_.add(PRIORITY_MAIL_NOTIFICATION, QOKSCHD_, "receiverVariable.directoryEntries.mailNotification.fieldValue", INDEX_0_, - new MailNotificationValueMap_(1, new Boolean[] { Boolean.FALSE, Boolean.TRUE })); - setterMap_.add(PRIORITY_MAIL_NOTIFICATION, CHGDIRE_, "NFYPTYPERS", booleanValueMapNoYes_); - } - - - -/** -Attribute ID for set password to expire. This identifies a Boolean -attribute, which indicates whether the user's password is set to expire, -requiring the user to change the password when signing on. -**/ - public static final String SET_PASSWORD_TO_EXPIRE = "SET_PASSWORD_TO_EXPIRE"; - - static { - attributes_.add(SET_PASSWORD_TO_EXPIRE, Boolean.class, false); - getterMap_.add(SET_PASSWORD_TO_EXPIRE, USRI0100_, "receiverVariable.setPasswordToExpire", booleanValueMapNY_); - getterMap_.add(SET_PASSWORD_TO_EXPIRE, USRI0300_, "receiverVariable.setPasswordToExpire", booleanValueMapNY_); - setterMap_.add(SET_PASSWORD_TO_EXPIRE, CHGUSRPRF_, "PWDEXP", booleanValueMapNoYes_); - } - - - -/** -Attribute ID for sign-on attempts not valid. This identifies a read-only Integer -attribute, which represents the number of sign-on attempts that were not valid -since the last successful sign-on. -**/ - public static final String SIGN_ON_ATTEMPTS_NOT_VALID = "SIGN_ON_ATTEMPTS_NOT_VALID"; - - static { - attributes_.add(SIGN_ON_ATTEMPTS_NOT_VALID, Integer.class, true); - getterMap_.add(SIGN_ON_ATTEMPTS_NOT_VALID, USRI0100_, "receiverVariable.signOnAttemptsNotValid"); - getterMap_.add(SIGN_ON_ATTEMPTS_NOT_VALID, USRI0300_, "receiverVariable.signOnAttemptsNotValid"); - } - - - -/** -Attribute ID for SMTP domain. This identifies a read-only String -attribute, which represents the SMTP domain as specified -in the user's directory entry. -**/ - public static final String SMTP_DOMAIN = "SMTP_DOMAIN"; - - static { - attributes_.add(SMTP_DOMAIN, String.class, true); - getterMap_.add(SMTP_DOMAIN, QOKSCHD_, "receiverVariable.directoryEntries.smtpDomain.fieldValue", INDEX_0_); - } - - - -/** -Attribute ID for SMTP route. This identifies a read-only String -attribute, which represents the SMTP route as specified -in the user's directory entry. -**/ - public static final String SMTP_ROUTE = "SMTP_ROUTE"; - - static { - attributes_.add(SMTP_ROUTE, String.class, true); - getterMap_.add(SMTP_ROUTE, QOKSCHD_, "receiverVariable.directoryEntries.smtpRoute.fieldValue", INDEX_0_); - } - - - -/** -Attribute ID for SMTP user ID. This identifies a read-only String -attribute, which represents the SMTP user ID as specified -in the user's directory entry. -**/ - public static final String SMTP_USER_ID = "SMTP_USER_ID"; - - static { - attributes_.add(SMTP_USER_ID, String.class, true); - getterMap_.add(SMTP_USER_ID, QOKSCHD_, "receiverVariable.directoryEntries.smtpUserID.fieldValue", INDEX_0_); - } - - - -/** -Attribute ID for sort sequence table. This identifies a String attribute, -which represents the fully qualified integrated file system path name of -the sort sequence table used for string comparisons. -Possible values are: -
      -
    • {@link #SORT_SEQUENCE_TABLE_HEX SORT_SEQUENCE_TABLE_HEX} - - The hexadecimal values of the characters are used to determine the - sort sequence. -
    • {@link #SORT_SEQUENCE_TABLE_UNIQUE SORT_SEQUENCE_TABLE_UNIQUE} - - A unique-weight sort table associated with the language specified. -
    • {@link #SORT_SEQUENCE_TABLE_SHARED SORT_SEQUENCE_TABLE_SHARED} - - A shared-weight sort table associated with the language specified. -
    • {@link #SYSTEM_VALUE SYSTEM_VALUE} - - The system value QSRTSEQ. -
    • The sort sequence table name. -
    - -@see com.ibm.as400.access.QSYSObjectPathName -**/ - public static final String SORT_SEQUENCE_TABLE = "SORT_SEQUENCE_TABLE"; - - /** - Attribute value indicating that the hexadecimal values of the characters are used to determine the - sort sequence. - - @see #SORT_SEQUENCE_TABLE - **/ - public static final String SORT_SEQUENCE_TABLE_HEX = "*HEX"; - - /** - Attribute value indicating that a unique-weight sort table associated with the language specified - - @see #SORT_SEQUENCE_TABLE - **/ - public static final String SORT_SEQUENCE_TABLE_UNIQUE = "*LANGIDUNQ"; - - /** - Attribute value indicating that a shared-weight sort table associated with the language specified - - @see #SORT_SEQUENCE_TABLE - **/ - public static final String SORT_SEQUENCE_TABLE_SHARED = "*LANGIDSHR"; - - static { - attributes_.add(SORT_SEQUENCE_TABLE, String.class, false, - new Object[] {SORT_SEQUENCE_TABLE_HEX, - SORT_SEQUENCE_TABLE_UNIQUE, - SORT_SEQUENCE_TABLE_SHARED, - SYSTEM_VALUE }, null, false); - getterMap_.add(SORT_SEQUENCE_TABLE, USRI0300_, "receiverVariable.sortSequenceTable", - new QualifiedValueMap(QualifiedValueMap.FORMAT_20, "FILE")); - ValueMap valueMap = new QualifiedValueMap(QualifiedValueMap.FORMAT_CL, "FILE"); - setterMap_.add(SORT_SEQUENCE_TABLE, CHGUSRPRF_, "SRTSEQ", valueMap); - } - - - -/** -Attribute ID for special authorities. This identifies a String array -attribute, which represents a list of special authorities that the user has. -Possible values for the elements of this array are: -
      -
    • {@link #SPECIAL_AUTHORITIES_ALL_OBJECT SPECIAL_AUTHORITIES_ALL_OBJECT} - - All object. -
    • {@link #SPECIAL_AUTHORITIES_SECURITY_ADMINISTRATOR SPECIAL_AUTHORITIES_SECURITY_ADMINISTRATOR} - - Security administrator. -
    • {@link #SPECIAL_AUTHORITIES_JOB_CONTROL SPECIAL_AUTHORITIES_JOB_CONTROL} - - Job control. -
    • {@link #SPECIAL_AUTHORITIES_SPOOL_CONTROL SPECIAL_AUTHORITIES_SPOOL_CONTROL} - - Spool control. -
    • {@link #SPECIAL_AUTHORITIES_SAVE_SYSTEM SPECIAL_AUTHORITIES_SAVE_SYSTEM} - - Save system. -
    • {@link #SPECIAL_AUTHORITIES_SERVICE SPECIAL_AUTHORITIES_SERVICE} - - Service. -
    • {@link #SPECIAL_AUTHORITIES_AUDIT SPECIAL_AUTHORITIES_AUDIT} - - Audit. -
    • {@link #SPECIAL_AUTHORITIES_IO_SYSTEM_CONFIGURATION SPECIAL_AUTHORITIES_IO_SYSTEM_CONFIGURATION} - - Input/output system configuration. -
    -**/ - public static final String SPECIAL_AUTHORITIES = "SPECIAL_AUTHORITIES"; - - /** - Attribute value indicating all object special authorities. - - @see #SPECIAL_AUTHORITIES - **/ - public static final String SPECIAL_AUTHORITIES_ALL_OBJECT = "*ALLOBJ"; - - /** - Attribute value indicating security administrator special authorities. - - @see #SPECIAL_AUTHORITIES - **/ - public static final String SPECIAL_AUTHORITIES_SECURITY_ADMINISTRATOR = "*SECADM"; - - /** - Attribute value indicating job control special authorities. - - @see #SPECIAL_AUTHORITIES - **/ - public static final String SPECIAL_AUTHORITIES_JOB_CONTROL = "*JOBCTL"; - - /** - Attribute value indicating spool control special authorities. - - @see #SPECIAL_AUTHORITIES - **/ - public static final String SPECIAL_AUTHORITIES_SPOOL_CONTROL = "*SPLCTL"; - - /** - Attribute value indicating save system special authorities. - - @see #SPECIAL_AUTHORITIES - **/ - public static final String SPECIAL_AUTHORITIES_SAVE_SYSTEM = "*SAVSYS"; - - /** - Attribute value indicating service special authorities. - - @see #SPECIAL_AUTHORITIES - **/ - public static final String SPECIAL_AUTHORITIES_SERVICE = "*SERVICE"; - - /** - Attribute value indicating audit special authorities. - - @see #SPECIAL_AUTHORITIES - **/ - public static final String SPECIAL_AUTHORITIES_AUDIT = "*AUDIT"; - - /** - Attribute value indicating I/O system configuration special authorities. - - @see #SPECIAL_AUTHORITIES - **/ - public static final String SPECIAL_AUTHORITIES_IO_SYSTEM_CONFIGURATION = "*IOSYSCFG"; - - static { - String[] possibleValues = new String[] {SPECIAL_AUTHORITIES_ALL_OBJECT, - SPECIAL_AUTHORITIES_SECURITY_ADMINISTRATOR, - SPECIAL_AUTHORITIES_JOB_CONTROL, - SPECIAL_AUTHORITIES_SPOOL_CONTROL, - SPECIAL_AUTHORITIES_SAVE_SYSTEM, - SPECIAL_AUTHORITIES_SERVICE, - SPECIAL_AUTHORITIES_AUDIT, - SPECIAL_AUTHORITIES_IO_SYSTEM_CONFIGURATION}; - attributes_.add(SPECIAL_AUTHORITIES, String.class, false, - possibleValues, null, true, true); - ValueMap valueMap = new OptionsValueMap('N', 'Y', possibleValues); - getterMap_.add(SPECIAL_AUTHORITIES, USRI0200_, "receiverVariable.specialAuthorities", valueMap); - getterMap_.add(SPECIAL_AUTHORITIES, USRI0300_, "receiverVariable.specialAuthorities", valueMap); - setterMap_.add(SPECIAL_AUTHORITIES, CHGUSRPRF_, "SPCAUT", arrayValueMapNone_); //@B1C - } - - - -/** -Attribute ID for special environment. This identifies a String attribute, -which represents the special environment the user operates in after signing on. -Possible values are: -
      -
    • {@link #SYSTEM_VALUE SYSTEM_VALUE} - - The system value QSPCENV is used to determine the user's special - environment. -
    • {@link #NONE NONE} - - The user operates in the i5/OS environment. -
    • {@link #SPECIAL_ENVIRONMENT_SYSTEM_36 SPECIAL_ENVIRONMENT_SYSTEM_36} - - The user operates in the System/36 environment. -
    -**/ - public static final String SPECIAL_ENVIRONMENT = "SPECIAL_ENVIRONMENT"; - - /** - Attribute value indicating that the user operates in the System/36 environment. - - @see #SPECIAL_ENVIRONMENT - **/ - public static final String SPECIAL_ENVIRONMENT_SYSTEM_36 = "*S36"; - - static { - attributes_.add(SPECIAL_ENVIRONMENT, String.class, false, - new Object[] {SYSTEM_VALUE, - NONE, - SPECIAL_ENVIRONMENT_SYSTEM_36 }, null, true); - getterMap_.add(SPECIAL_ENVIRONMENT, USRI0300_, "receiverVariable.specialEnvironment"); - setterMap_.add(SPECIAL_ENVIRONMENT, CHGUSRPRF_, "SPCENV"); - } - - - -/** -Attribute ID for status. This identifies a String attribute, -which represents the status of the user profile. -Possible values are: -
      -
    • {@link #STATUS_ENABLED STATUS_ENABLED} - - The user profile is enabled. -
    • {@link #STATUS_NOT_ENABLED STATUS_NOT_ENABLED} - - The user profile is not enabled. -
    -**/ - public static final String STATUS = "STATUS"; - - /** - Attribute value indicating that the user profile is enabled. - - @see #STATUS - **/ - public static final String STATUS_ENABLED = "*ENABLED"; - - /** - Attribute value indicating that the user profile is not enabled. - - @see #STATUS - **/ - public static final String STATUS_NOT_ENABLED = "*DISABLED"; - - static { - attributes_.add(STATUS, String.class, false, - new Object[] {STATUS_ENABLED, STATUS_NOT_ENABLED }, null, true); - getterMap_.add(STATUS, USRI0300_, "receiverVariable.status"); - setterMap_.add(STATUS, CHGUSRPRF_, "STATUS"); - } - - - -/** -Attribute ID for storage used. This identifies a read-only Integer attribute, -which represents the amount of auxiliary storage (in kilobytes) occupied -by this user's owned objects. -**/ - public static final String STORAGE_USED = "STORAGE_USED"; - - static { - attributes_.add(STORAGE_USED, Integer.class, true); - getterMap_.add(STORAGE_USED, USRI0300_, "receiverVariable.storageUsed"); - } - - - -/** -Attribute ID for supplemental groups. This identifies a String array -attribute, which represents the supplemental groups for the user profile. -**/ - public static final String SUPPLEMENTAL_GROUPS = "SUPPLEMENTAL_GROUPS"; - - static { - attributes_.add(SUPPLEMENTAL_GROUPS, String[].class, false, null, null, false, false); - getterMap_.add(SUPPLEMENTAL_GROUPS, USRI0200_, "receiverVariable.supplementalGroups", "receiverVariable.numberOfSupplementalGroups", arrayTypeValueMapString_); - getterMap_.add(SUPPLEMENTAL_GROUPS, USRI0300_, "receiverVariable.supplementalGroups", "receiverVariable.numberOfSupplementalGroups", arrayTypeValueMapString_); - setterMap_.add(SUPPLEMENTAL_GROUPS, CHGUSRPRF_, "SUPGRPPRF", arrayValueMapNone_); - } - - - -/** -Attribute ID for telephone number 1. This identifies a String -attribute, which represents the telephone number 1 as specified -in the user's directory entry. -**/ - public static final String TELEPHONE_NUMBER_1 = "TELEPHONE_NUMBER_1"; - - static { - attributes_.add(TELEPHONE_NUMBER_1, String.class, false); - getterMap_.add(TELEPHONE_NUMBER_1, QOKSCHD_, "receiverVariable.directoryEntries.telephoneNumber1.fieldValue", INDEX_0_); - setterMap_.add(TELEPHONE_NUMBER_1, CHGDIRE_, "TELNBR1", quoteValueMapNone_); - } - - - -/** -Attribute ID for telephone number 2. This identifies a String -attribute, which represents the telephone number 2 as specified -in the user's directory entry. -**/ - public static final String TELEPHONE_NUMBER_2 = "TELEPHONE_NUMBER_2"; - - static { - attributes_.add(TELEPHONE_NUMBER_2, String.class, false); - getterMap_.add(TELEPHONE_NUMBER_2, QOKSCHD_, "receiverVariable.directoryEntries.telephoneNumber2.fieldValue", INDEX_0_); - setterMap_.add(TELEPHONE_NUMBER_2, CHGDIRE_, "TELNBR2", quoteValueMapNone_); - } - - - -/** -Attribute ID for text. This identifies a String -attribute, which represents the text as specified -in the user's directory entry. This is not the same -as the directory entry description or user profile description. -@see #USER_DESCRIPTION -@see #TEXT_DESCRIPTION -**/ - public static final String TEXT = "TEXT"; - - static { - attributes_.add(TEXT, String.class, false); - getterMap_.add(TEXT, QOKSCHD_, "receiverVariable.directoryEntries.text.fieldValue", INDEX_0_); - setterMap_.add(TEXT, CHGDIRE_, "TEXT", quoteValueMapNone_); - } - - - -/** -Attribute ID for text description. This identifies a String -attribute, which represents the descriptive text for the user profile. -This is not the same as the directory entry text or directory entry description. -@see #TEXT -@see #USER_DESCRIPTION -**/ - public static final String TEXT_DESCRIPTION = "TEXT_DESCRIPTION"; - - static { - attributes_.add(TEXT_DESCRIPTION, String.class, false); - getterMap_.add(TEXT_DESCRIPTION, USRI0300_, "receiverVariable.textDescription"); - setterMap_.add(TEXT_DESCRIPTION, CHGUSRPRF_, "TEXT", quoteValueMapBlank_); - } - - - -/** -Attribute ID for user action audit level. This identifies a String array -attribute, which represents a list of action audit levels for the user. -Possible values for the elements of this array are: -
      -
    • {@link #USER_ACTION_AUDIT_LEVEL_COMMAND USER_ACTION_AUDIT_LEVEL_COMMAND} - - The user has the *CMD audit value specified in the user profile. -
    • {@link #USER_ACTION_AUDIT_LEVEL_CREATE USER_ACTION_AUDIT_LEVEL_CREATE} - - The user has the *CREATE audit value specified in the user profile. -
    • {@link #USER_ACTION_AUDIT_LEVEL_DELETE USER_ACTION_AUDIT_LEVEL_DELETE} - - The user has the *DELETE audit value specified in the user profile. -
    • {@link #USER_ACTION_AUDIT_LEVEL_JOB_DATA USER_ACTION_AUDIT_LEVEL_JOB_DATA} - - The user has the *JOBDTA audit value specified in the user profile. -
    • {@link #USER_ACTION_AUDIT_LEVEL_OBJECT_MANAGEMENT USER_ACTION_AUDIT_LEVEL_OBJECT_MANAGEMENT} - - The user has the *OBJMGT audit value specified in the user profile. -
    • {@link #USER_ACTION_AUDIT_LEVEL_OFFICE_SERVICES USER_ACTION_AUDIT_LEVEL_OFFICE_SERVICES} - - The user has the *OFCSRV audit value specified in the user profile. -
    • {@link #USER_ACTION_AUDIT_LEVEL_OPTICAL USER_ACTION_AUDIT_LEVEL_OPTICAL} - - The user has the *OPTICAL audit value specified in the user profile. -
    • {@link #USER_ACTION_AUDIT_LEVEL_PROGRAM_ADOPTION USER_ACTION_AUDIT_LEVEL_PROGRAM_ADOPTION} - - The user has the *PGMADP audit value specified in the user profile. -
    • {@link #USER_ACTION_AUDIT_LEVEL_SAVE_RESTORE USER_ACTION_AUDIT_LEVEL_SAVE_RESTORE} - - The user has the *SAVRST audit value specified in the user profile. -
    • {@link #USER_ACTION_AUDIT_LEVEL_SECURITY USER_ACTION_AUDIT_LEVEL_SECURITY} - - The user has the *SECURITY audit value specified in the user profile. -
    • {@link #USER_ACTION_AUDIT_LEVEL_SERVICE USER_ACTION_AUDIT_LEVEL_SERVICE} - - The user has the *SERVICE audit value specified in the user profile. -
    • {@link #USER_ACTION_AUDIT_LEVEL_SPOOLED_FILE_DATA USER_ACTION_AUDIT_LEVEL_SPOOLED_FILE_DATA} - - The user has the *SPLFDTA audit value specified in the user profile. -
    • {@link #USER_ACTION_AUDIT_LEVEL_SYSTEM_MANAGEMENT USER_ACTION_AUDIT_LEVEL_SYSTEM_MANAGEMENT} - - The user has the *SYSMGT audit value specified in the user profile. -
    -**/ - public static final String USER_ACTION_AUDIT_LEVEL = "USER_ACTION_AUDIT_LEVEL"; - - /** - Attribute value indicating that the user has the *CMD audit value specified in the user profile. - - @see #USER_ACTION_AUDIT_LEVEL - **/ - public static final String USER_ACTION_AUDIT_LEVEL_COMMAND = "*CMD"; - - /** - Attribute value indicating that the user has the *CREATE audit value specified in the user profile. - - @see #USER_ACTION_AUDIT_LEVEL - **/ - public static final String USER_ACTION_AUDIT_LEVEL_CREATE = "*CREATE"; - - /** - Attribute value indicating that the user has the *DELETE audit value specified in the user profile. - - @see #USER_ACTION_AUDIT_LEVEL - **/ - public static final String USER_ACTION_AUDIT_LEVEL_DELETE = "*DELETE"; - - /** - Attribute value indicating that the user has the *JOBDTA audit value specified in the user profile. - - @see #USER_ACTION_AUDIT_LEVEL - **/ - public static final String USER_ACTION_AUDIT_LEVEL_JOB_DATA = "*JOBDTA"; - - /** - Attribute value indicating that the user has the *OBJMGT audit value specified in the user profile. - - @see #USER_ACTION_AUDIT_LEVEL - **/ - public static final String USER_ACTION_AUDIT_LEVEL_OBJECT_MANAGEMENT = "*OBJMGT"; - - /** - Attribute value indicating that the user has the *OFCSRV audit value specified in the user profile. - - @see #USER_ACTION_AUDIT_LEVEL - **/ - public static final String USER_ACTION_AUDIT_LEVEL_OFFICE_SERVICES = "*OFCSRV"; - - /** - Attribute value indicating that the user has the *OPTICAL audit value specified in the user profile. - - @see #USER_ACTION_AUDIT_LEVEL - **/ - public static final String USER_ACTION_AUDIT_LEVEL_OPTICAL = "*OPTICAL"; - - /** - Attribute value indicating that the user has the *PGMADP audit value specified in the user profile. - - @see #USER_ACTION_AUDIT_LEVEL - **/ - public static final String USER_ACTION_AUDIT_LEVEL_PROGRAM_ADOPTION = "*PGMADP"; - - /** - Attribute value indicating that the user has the *SAVRST audit value specified in the user profile. - - @see #USER_ACTION_AUDIT_LEVEL - **/ - public static final String USER_ACTION_AUDIT_LEVEL_SAVE_RESTORE = "*SAVRST"; - - /** - Attribute value indicating that the user has the *SECURITY audit value specified in the user profile. - - @see #USER_ACTION_AUDIT_LEVEL - **/ - public static final String USER_ACTION_AUDIT_LEVEL_SECURITY = "*SECURITY"; - - /** - Attribute value indicating that the user has the *SERVICE audit value specified in the user profile. - - @see #USER_ACTION_AUDIT_LEVEL - **/ - public static final String USER_ACTION_AUDIT_LEVEL_SERVICE = "*SERVICE"; - - /** - Attribute value indicating that the user has the *SPLFDTA audit value specified in the user profile. - - @see #USER_ACTION_AUDIT_LEVEL - **/ - public static final String USER_ACTION_AUDIT_LEVEL_SPOOLED_FILE_DATA = "*SPLFDTA"; - - /** - Attribute value indicating that the user has the *SYSMGT audit value specified in the user profile. - - @see #USER_ACTION_AUDIT_LEVEL - **/ - public static final String USER_ACTION_AUDIT_LEVEL_SYSTEM_MANAGEMENT = "*SYSMGT"; - - static { - String[] possibleValues = new String[] {USER_ACTION_AUDIT_LEVEL_COMMAND, - USER_ACTION_AUDIT_LEVEL_CREATE, - USER_ACTION_AUDIT_LEVEL_DELETE, - USER_ACTION_AUDIT_LEVEL_JOB_DATA, - USER_ACTION_AUDIT_LEVEL_OBJECT_MANAGEMENT, - USER_ACTION_AUDIT_LEVEL_OFFICE_SERVICES, - USER_ACTION_AUDIT_LEVEL_PROGRAM_ADOPTION, - USER_ACTION_AUDIT_LEVEL_SAVE_RESTORE, - USER_ACTION_AUDIT_LEVEL_SECURITY, - USER_ACTION_AUDIT_LEVEL_SERVICE, - USER_ACTION_AUDIT_LEVEL_SPOOLED_FILE_DATA, - USER_ACTION_AUDIT_LEVEL_SYSTEM_MANAGEMENT, - USER_ACTION_AUDIT_LEVEL_OPTICAL }; - // The API shows optical in the middle of the list, - // but experimental data proves otherwise (at least - // on V4R3). - attributes_.add(USER_ACTION_AUDIT_LEVEL, String.class, false, - possibleValues, null, true, true); - ValueMap valueMap = new OptionsValueMap('N', 'Y', possibleValues); - getterMap_.add(USER_ACTION_AUDIT_LEVEL, USRI0300_, "receiverVariable.userActionAuditLevel", valueMap); - setterMap_.add(USER_ACTION_AUDIT_LEVEL, CHGUSRAUD_, "AUDLVL", arrayValueMapNone_); - } - - - -/** -Attribute ID for user address. This identifies a read-only String -attribute, which represents the user address as specified -in the user's directory entry. -**/ - public static final String USER_ADDRESS = "USER_ADDRESS"; - - static { - attributes_.add(USER_ADDRESS, String.class, true); - getterMap_.add(USER_ADDRESS, QOKSCHD_, "receiverVariable.directoryEntries.userAddress.fieldValue", INDEX_0_); - } - - - - -/** -Attribute ID for user class name. This identifies a String attribute, -which represents the user class name. Possible values are: -
      -
    • {@link #USER_CLASS_SECURITY_OFFICER USER_CLASS_SECURITY_OFFICER} - - The user has a class of security officer. -
    • {@link #USER_CLASS_SECURITY_ADMINISTRATOR USER_CLASS_SECURITY_ADMINISTRATOR} - - The user has a class of security administrator. -
    • {@link #USER_CLASS_PROGRAMMER USER_CLASS_PROGRAMMER} - - The user has a class of programmer. -
    • {@link #USER_CLASS_SYSTEM_OPERATOR USER_CLASS_SYSTEM_OPERATOR} - - The user has a class of system operator. -
    • {@link #USER_CLASS_USER USER_CLASS_USER} - - The user has a class of end user. -
    -**/ - public static final String USER_CLASS = "USER_CLASS"; - - /** - Attribute value indicating that the user has a class of security officer. - - @see #USER_CLASS - **/ - public static final String USER_CLASS_SECURITY_OFFICER = "*SECOFR"; - - /** - Attribute value indicating that the user has a class of security administrator. - - @see #USER_CLASS - **/ - public static final String USER_CLASS_SECURITY_ADMINISTRATOR = "*SECADM"; - - /** - Attribute value indicating that the user has a class of programmer. - - @see #USER_CLASS - **/ - public static final String USER_CLASS_PROGRAMMER = "*PGMR"; - - /** - Attribute value indicating that the user has a class of system operator. - - @see #USER_CLASS - **/ - public static final String USER_CLASS_SYSTEM_OPERATOR = "*SYSOPR"; - - /** - Attribute value indicating that the user has a class of end user. - - @see #USER_CLASS - **/ - public static final String USER_CLASS_USER = "*USER"; - - static { - attributes_.add(USER_CLASS, String.class, false, - new Object[] {USER_CLASS_SECURITY_OFFICER, - USER_CLASS_SECURITY_ADMINISTRATOR, - USER_CLASS_PROGRAMMER, - USER_CLASS_SYSTEM_OPERATOR, - USER_CLASS_USER }, null, true); - getterMap_.add(USER_CLASS, USRI0200_, "receiverVariable.userClassName"); - getterMap_.add(USER_CLASS, USRI0300_, "receiverVariable.userClassName"); - setterMap_.add(USER_CLASS, CHGUSRPRF_, "USRCLS"); - } - - -//@B1A -/** -Attribute ID for user description. This identifies a read-only String -attribute, which represents the user description as specified -in the user's directory entry. This is not the same as the directory -entry text or the user profile description. -@see #TEXT -@see #TEXT_DESCRIPTION -**/ - public static final String USER_DESCRIPTION = "USER_DESCRIPTION"; - - static - { - attributes_.add(USER_DESCRIPTION, String.class, true); - getterMap_.add(USER_DESCRIPTION, QOKSCHD_, "receiverVariable.directoryEntries.userDescription.fieldValue", INDEX_0_); - } - - -/** -Attribute ID for user ID. This identifies a read-only String -attribute, which represents the user ID as specified -in the user's directory entry. -**/ - public static final String USER_ID = "USER_ID"; - - static { - attributes_.add(USER_ID, String.class, true); - getterMap_.add(USER_ID, QOKSCHD_, "receiverVariable.directoryEntries.userID.fieldValue", INDEX_0_); - } - - - -//@B1C - This is a Long, not an Integer. -/** -Attribute ID for user ID number. This identifies a Long attribute, -which represents the user ID number for the user profile. This is used -to identify the user when using the integrated file system. -**/ - public static final String USER_ID_NUMBER = "USER_ID_NUMBER"; - - static { - attributes_.add(USER_ID_NUMBER, Long.class, false); - getterMap_.add(USER_ID_NUMBER, USRI0300_, "receiverVariable.userIDNumber", integerToLongValueMap_); - setterMap_.add(USER_ID_NUMBER, CHGUSRPRF_, "UID"); - } - - - -/** -Attribute ID for user options. This identifies a String array -attribute, which represents a list of options for users to customize their -environment. Possible values for the elements of this array are: -
      -
    • {@link #USER_OPTIONS_KEYWORDS USER_OPTIONS_KEYWORDS} - - Keywords are shown when a CL command is displayed. -
    • {@link #USER_OPTIONS_EXPERT USER_OPTIONS_EXPERT} - - More detailed information is shown when the user is defining or changing - the system using edit or display object authority. -
    • {@link #USER_OPTIONS_FULL_SCREEN_HELP USER_OPTIONS_FULL_SCREEN_HELP} - - UIM online help is to be displayed on a full screen or a window. -
    • {@link #USER_OPTIONS_STATUS_MESSAGE USER_OPTIONS_STATUS_MESSAGE} - - Status messages sent to the user are shown. -
    • {@link #USER_OPTIONS_NO_STATUS_MESSAGE USER_OPTIONS_NO_STATUS_MESSAGE} - - Status messages sent to the user are not shown. -
    • {@link #USER_OPTIONS_ROLL_KEY USER_OPTIONS_ROLL_KEY} - - The opposite action from the system default for roll keys is taken. -
    • {@link #USER_OPTIONS_PRINT_COMPLETE_MESSAGE USER_OPTIONS_PRINT_COMPLETE_MESSAGE} - - A message is sent to the user when a spooled file is printed. -
    -**/ - public static final String USER_OPTIONS = "USER_OPTIONS"; - - /** - Attribute value indicating that keywords are shown when a CL command is displayed. - - @see #USER_OPTIONS - **/ - public static final String USER_OPTIONS_KEYWORDS = "*CLKWD"; - - /** - Attribute value indicating that more detailed information is shown when the user is defining or changing - the system using edit or display object authority. - - @see #USER_OPTIONS - **/ - public static final String USER_OPTIONS_EXPERT = "*EXPERT"; - - /** - Attribute value indicating that UIM online help is to be displayed on a full screen or a window. - - @see #USER_OPTIONS - **/ - public static final String USER_OPTIONS_FULL_SCREEN_HELP = "*HLPFULL"; - - /** - Attribute value indicating that status messages sent to the user are shown. - - @see #USER_OPTIONS - **/ - public static final String USER_OPTIONS_STATUS_MESSAGE = "*STSMSG"; - - /** - Attribute value indicating that status messages sent to the user are not shown. - - @see #USER_OPTIONS - **/ - public static final String USER_OPTIONS_NO_STATUS_MESSAGE = "*NOSTSMSG"; - - /** - Attribute value indicating that the opposite action from the system default for roll keys is taken. - - @see #USER_OPTIONS - **/ - public static final String USER_OPTIONS_ROLL_KEY = "*ROLLKEY"; - - /** - Attribute value indicating that a message is sent to the user when a spooled file is printed. - - @see #USER_OPTIONS - **/ - public static final String USER_OPTIONS_PRINT_COMPLETE_MESSAGE = "*PRTMSG"; - - static { - String[] possibleValues = new String[] {USER_OPTIONS_KEYWORDS, - USER_OPTIONS_EXPERT, - USER_OPTIONS_FULL_SCREEN_HELP, - USER_OPTIONS_STATUS_MESSAGE, - USER_OPTIONS_NO_STATUS_MESSAGE, - USER_OPTIONS_ROLL_KEY, - USER_OPTIONS_PRINT_COMPLETE_MESSAGE}; - attributes_.add(USER_OPTIONS, String.class, false, - possibleValues, null, true, true); - ValueMap valueMap = new OptionsValueMap('N', 'Y', possibleValues); - getterMap_.add(USER_OPTIONS, USRI0300_, "receiverVariable.userOptions", valueMap); - setterMap_.add(USER_OPTIONS, CHGUSRPRF_, "USROPT", arrayValueMapNone_); //@B1C - } - - - -/** -Attribute ID for user profile name. This identifies a read-only String -attribute, which represents the name of the user profile. -**/ - public static final String USER_PROFILE_NAME = "USER_PROFILE_NAME"; - - static { - attributes_.add(USER_PROFILE_NAME, String.class, true); - getterMap_.add(USER_PROFILE_NAME, USRI0100_, "receiverVariable.userProfileName"); - getterMap_.add(USER_PROFILE_NAME, USRI0200_, "receiverVariable.userProfileName"); - getterMap_.add(USER_PROFILE_NAME, USRI0300_, "receiverVariable.userProfileName"); - } - - - -//----------------------------------------------------------------------------------------- -// PCML document initialization. -//----------------------------------------------------------------------------------------- - - private static final String DOCUMENT_NAME_ = "com.ibm.as400.resource.RUser"; - private static ProgramCallDocument staticDocument_ = null; - - static { - // Create a static version of the PCML document, then clone it for each document. - // This will improve performance, since we will only have to deserialize the PCML - // object once. - try { - staticDocument_ = new ProgramCallDocument(); - staticDocument_.setDocument(DOCUMENT_NAME_); - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error instantiating ProgramCallDocument", e); - } - } - - - -//----------------------------------------------------------------------------------------- -// Private data. -//----------------------------------------------------------------------------------------- - - private String name_ = null; - - private ProgramAttributeGetter attributeGetter_ = null; - private CommandAttributeSetter attributeSetter_ = null; - - - - -//----------------------------------------------------------------------------------------- -// Constructors. -//----------------------------------------------------------------------------------------- - -/** -Constructs an RUser object. -**/ - public RUser() - { - super(presentationLoader_.getPresentationWithIcon(PRESENTATION_KEY_, ICON_BASE_NAME_), null, attributes_); - } - - - -/** -Constructs an RUser object. - -@param system The system. -@param name The user profile name. -**/ - public RUser(AS400 system,String name) - { - this(); - - try { - setSystem(system); - setName(name); - } - catch(PropertyVetoException e) { - // Ignore. - } - } - - - -// @A2C -/** -Commits the specified attribute changes. - -@param attributeIDs The attribute IDs for the specified attribute changes. -@param values The specified attribute changes -@param bidiStringTypes The bidi string types as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. - -@exception ResourceException If an error occurs. -**/ - protected void commitAttributeChanges(Object[] attributeIDs, Object[] values, int[] bidiStringTypes) - throws ResourceException - { - super.commitAttributeChanges(attributeIDs, values); - - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); - - attributeSetter_.setValues(attributeIDs, values, bidiStringTypes); // @A2C - } - - - - -/** -Computes a resource key. - -@param system The system. -@param name The user profile name. -@return The resource key. -**/ - static Object computeResourceKey(AS400 system, String name) - { - StringBuffer buffer = new StringBuffer(); - buffer.append(RUser.class); - buffer.append(':'); - buffer.append(system.getSystemName()); - buffer.append(':'); - buffer.append(system.getUserId()); - buffer.append(':'); - buffer.append(name); - return buffer.toString(); - } - - - -/** -Deletes the user. - -@exception ResourceException If an error occurs. -**/ - public void delete() - throws ResourceException - { - // Establish the connection if needed. - if (!isConnectionEstablished()) - establishConnection(); - - try //@B1M - { - fireBusy(); - // Remove the directory entry. - StringBuffer buffer = new StringBuffer("RMVDIRE USRID("); - //@B1D buffer.append(name_); - buffer.append(getAttributeValue(RUser.USER_ID)); //@B1A - buffer.append(' '); //@B1A - buffer.append(getAttributeValue(RUser.USER_ADDRESS)); //@B1A - buffer.append(") USRD("); //@B1C - String desc = (String)getAttributeValue(RUser.USER_DESCRIPTION); //@B1A - if (desc == "") desc = "*FIRST"; //@B1A - buffer.append(desc); //@B1A - buffer.append(')'); //@B1A - CommandCall rmvdire = new CommandCall(getSystem(), buffer.toString()); - if (rmvdire.run() == false) - throw new ResourceException(rmvdire.getMessageList()); - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error when removing a directory entry", e); - // Don't throw an exception here... maybe there is no directory entry. - } - finally - { - fireIdle(); - } - - // Delete the user profile. - StringBuffer buffer = new StringBuffer("DLTUSRPRF USRPRF("); - buffer.append(name_); - buffer.append(')'); - try - { - fireBusy(); - CommandCall dltusrprf = new CommandCall(getSystem(), buffer.toString()); - if (dltusrprf.run() == false) - throw new ResourceException(dltusrprf.getMessageList()); - fireResourceDeleted(); - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error when deleting a user profile", e); - throw new ResourceException(e); - } - finally - { - fireIdle(); - } - - } - - - - -/** -Establishes the connection to the system. - -

    The method is called by the resource framework automatically -when the connection needs to be established. - -@exception ResourceException If an error occurs. -**/ - protected void establishConnection() - throws ResourceException - { - // Call the superclass. - super.establishConnection(); - - // Validate if we can establish the connection. - if (name_ == null) - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - // Update the PCML document. - String nameUpper = name_.toUpperCase(); - AS400 system = getSystem(); - ProgramCallDocument document = (ProgramCallDocument)staticDocument_.clone(); - try { - document.setSystem(system); - document.setValue("qsyrusri_usri0100.userProfileName", nameUpper); - document.setValue("qsyrusri_usri0200.userProfileName", nameUpper); - document.setValue("qsyrusri_usri0300.userProfileName", nameUpper); - document.setValue("qokschd.requestVariable.searchRequestArray.valueToMatch", INDEX_0_, nameUpper); - document.setIntValue("qokschd.requestVariableLength", document.getOutputsize("qokschd.requestVariable")); - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error setting PCML document values", e); - } - - // Initialize the attribute getter. - attributeGetter_ = new ProgramAttributeGetter(system, document, getterMap_); - - // Initialize the attribute setter. - attributeSetter_ = new CommandAttributeSetter(system, setterMap_); - attributeSetter_.setParameterValue(CHGUSRPRF_, USRPRF_PARAMETER_, nameUpper); - attributeSetter_.setParameterValue(CHGUSRAUD_, USRPRF_PARAMETER_, nameUpper); - - String address = ""; //@B1A - String userid = ""; //@B1A - String description = ""; //@B1A - try //@B1A - { - address = (String)attributeGetter_.getValue(USER_ADDRESS); //@B1A - userid = (String)attributeGetter_.getValue(USER_ID); //@B1A - description = (String)attributeGetter_.getValue(USER_DESCRIPTION); //@B1A - } - catch(Exception e) //@B1A - { - if (Trace.isTraceOn()) //@B1A - { - Trace.log(Trace.ERROR, "Error retrieving directory entry user id and address.", e); //@B1A - } - } - - //@B1D String address; // @A3A - if (address == "") //@B1A - { - if (!system.isLocal()) // @A3A - address = system.getSystemName(); // @A3A - else { // @A3A - try { // @A3A - String hostName = InetAddress.getLocalHost().getHostName(); // @A3A - int dot = hostName.indexOf('.'); // @A3A - if (dot == -1) // @A3A - address = hostName; // @A3A - else // @A3A - address = hostName.substring(0, dot); // @A3A - } // @A3A - catch(IOException e) { // @A3A - throw new ResourceException(e); // @A3A - } // @A3A - } // @A3A - } - if (userid == "") //@B1A - { - userid = nameUpper; //@B1A - } - - if (description != "") //@B1A - { - attributeSetter_.setParameterValue(CHGDIRE_, USRD_PARAMETER_, "'"+description+"' '"+description+"'"); //@B1A - } - - //@B1: - // Note that a directory entry is uniquely identified by its 8-character user id, 8-character address, - // and 50-character description (because there can be duplicate userid/address pairs, but each - // description must be unique for a given userid/address pair). - // Also note that the user profile name can be up to 10 characters, and is not necessarily equal to - // the directory entry user id. - - //@B1D attributeSetter_.setParameterValue(CHGDIRE_, USRID_PARAMETER_, nameUpper + " " + address); // @A3C - attributeSetter_.setParameterValue(CHGDIRE_, USRID_PARAMETER_, userid+" "+address); - } - - -/** -Freezes any property changes. After this is called, property -changes should not be made. Properties are not the same thing -as attributes. Properties are basic pieces of information -which must be set to make the object usable, such as the system -and the name. - -

    The method is called by the resource framework automatically -when the properties need to be frozen. - -@exception ResourceException If an error occurs. -**/ - protected void freezeProperties() - throws ResourceException - { - // Validate if we can establish the connection. - if (name_ == null) - throw new ExtendedIllegalStateException("name", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - // Update the presentation. - Presentation presentation = getPresentation(); - presentation.setName(name_); - - // Update the resource key. - if (getResourceKey() == null) - setResourceKey(computeResourceKey(getSystem(), name_)); - - // Call the superclass. - super.freezeProperties(); - } - - - -// @A2C -/** -Returns the unchanged value of an attribute. If the attribute -value has an uncommitted change, this returns the unchanged value. -If the attribute value does not have an uncommitted change, this -returns the same value as getAttributeValue(). - -@param attributeID Identifies the attribute. -@param bidiStringType The bidi string type as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. - -@return The attribute value, or null if the attribute - value is not available. - -@exception ResourceException If an error occurs. -**/ - public Object getAttributeUnchangedValue(Object attributeID, int bidiStringType) - throws ResourceException - { - Object value = super.getAttributeUnchangedValue(attributeID, bidiStringType); - if (value == null) { - - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); - - value = attributeGetter_.getValue(attributeID, bidiStringType); - } - return value; - } - - - - -/** -Returns the user profile name. - -@return The user profile name. -**/ - public String getName() - { - return name_; - } - - -//@B0A - /** - * Indicates if this user profile has been granted the specified authority, or - * belongs to a group profile that has been granted the specified authority. - * @param authority The authority to check. It must be one of the special authority - * constants: -

      -
    • {@link #SPECIAL_AUTHORITIES_ALL_OBJECT SPECIAL_AUTHORITIES_ALL_OBJECT} - - All object. -
    • {@link #SPECIAL_AUTHORITIES_SECURITY_ADMINISTRATOR SPECIAL_AUTHORITIES_SECURITY_ADMINISTRATOR} - - Security administrator. -
    • {@link #SPECIAL_AUTHORITIES_JOB_CONTROL SPECIAL_AUTHORITIES_JOB_CONTROL} - - Job control. -
    • {@link #SPECIAL_AUTHORITIES_SPOOL_CONTROL SPECIAL_AUTHORITIES_SPOOL_CONTROL} - - Spool control. -
    • {@link #SPECIAL_AUTHORITIES_SAVE_SYSTEM SPECIAL_AUTHORITIES_SAVE_SYSTEM} - - Save system. -
    • {@link #SPECIAL_AUTHORITIES_SERVICE SPECIAL_AUTHORITIES_SERVICE} - - Service. -
    • {@link #SPECIAL_AUTHORITIES_AUDIT SPECIAL_AUTHORITIES_AUDIT} - - Audit. -
    • {@link #SPECIAL_AUTHORITIES_IO_SYSTEM_CONFIGURATION SPECIAL_AUTHORITIES_IO_SYSTEM_CONFIGURATION} - - Input/output system configuration. -
    - * @return true if this user has the authority or belongs to a group that has - * the authority; false otherwise. - * @exception ResourceException If an error occurs. - **/ - public boolean hasSpecialAuthority(String authority) throws ResourceException - { - if (authority == null) throw new NullPointerException("authority"); - - // Check to see if this user is authorized. - String[] specialAuthorities = (String[])getAttributeValue(SPECIAL_AUTHORITIES); - if (specialAuthorities != null) - { - for (int i=0; i - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/resource/RUser16.gif b/cvsroot/src/com/ibm/as400/resource/RUser16.gif deleted file mode 100644 index 0a35fe116..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RUser16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RUser32.gif b/cvsroot/src/com/ibm/as400/resource/RUser32.gif deleted file mode 100644 index 6c0bd075b..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RUser32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RUserBeanInfo.java b/cvsroot/src/com/ibm/as400/resource/RUserBeanInfo.java deleted file mode 100644 index 1679bfdde..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RUserBeanInfo.java +++ /dev/null @@ -1,155 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RUserBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Trace; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.util.ResourceBundle; - - - -/** -The RUserBeanInfo class represents the bean information -for the RUser class. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class RUserBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final Class beanClass_ = RUser.class; - - private static BeanInfo[] additionalBeanInfo_; - private static BeanDescriptor beanDescriptor_; - private static Image icon16_; - private static Image icon32_; - private static PropertyDescriptor[] propertyDescriptors_; - private static ResourceBundle resourceBundle_; - - - -/** -Static initializer. -**/ - static - { - try - { - // Set up the resource bundle. - resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.resource.ResourceMRI"); - - // Set up the additional bean info. - additionalBeanInfo_ = new BeanInfo[] { new ResourceBeanInfo() }; - - // Set up the bean descriptor. - beanDescriptor_ = new BeanDescriptor(beanClass_); - - // Set up the property descriptors. - PropertyDescriptor name = new PropertyDescriptor("name", beanClass_); - name.setBound(true); - name.setConstrained(true); - name.setDisplayName(resourceBundle_.getString("PROPERTY_NAME_NAME")); - name.setShortDescription(resourceBundle_.getString("PROPERTY_NAME_DESCRIPTION")); - - propertyDescriptors_ = new PropertyDescriptor[] { name }; - - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error while loading bean info", e); - throw new Error(e.toString()); - } - } - - - -/** -Returns the additional bean information. - -@return The additional bean information. -**/ - public BeanInfo[] getAdditionalBeanInfo() - { - return additionalBeanInfo_; - } - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - - -/** -Returns the property descriptors. - -@return The property descriptors. -**/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors_; - } - - - -/** -Returns the icon. - -@param icon The icon kind. Possible values are: -
      -
    • BeanInfo.ICON_MONO_16x16 -
    • BeanInfo.ICON_MONO_32x32 -
    • BeanInfo.ICON_COLOR_16x16 -
    • BeanInfo.ICON_COLOR_32x32 -
    -@return The icon. -**/ - public Image getIcon(int icon) - { - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - if (icon16_ == null) - icon16_ = loadImage("RUser16.gif"); - return icon16_; - - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - if (icon32_ == null) - icon32_ = loadImage("RUser32.gif"); - return icon32_; - - default: - throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/RUserList.java b/cvsroot/src/com/ibm/as400/resource/RUserList.java deleted file mode 100644 index e4fed0810..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RUserList.java +++ /dev/null @@ -1,398 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RUserList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.Trace; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.beans.PropertyVetoException; - - - -/** -The RUserList class represents a list of users on the system. - -

    The following selection IDs are supported: -

      -
    • {@link #SELECTION_CRITERIA SELECTION_CRITERIA} -
    • {@link #GROUP_PROFILE GROUP_PROFILE} -
    • {@link #USER_PROFILE USER_PROFILE} -
    -
    - -

    Use one or more of these selection IDs with -{@link com.ibm.as400.resource.ResourceList#getSelectionValue getSelectionValue()} -and {@link com.ibm.as400.resource.ResourceList#setSelectionValue setSelectionValue()} -to access the selection values for an RUserList. - -

    RUserList objects generate {@link com.ibm.as400.resource.RUser RUser} objects. - -

    -// Create an RUserList object to represent a list of users.
    -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -RUserList userList = new RUserList(system);
    -
    -// Set the selection so that only user profiles -// that are group profiles are included in the list. -userList.setSelectionValue(RUserList.SELECTION_CRITERIA, RUserList.GROUP); -
    -// Open the list and wait for it to complete. -userList.open(); -userList.waitForComplete(); -
    -// Read and print the user profile names and text -// descriptions for the users in the list. -long numberOfUsers = userList.getListLength(); -for(long i = 0; i < numberOfUsers; ++i) -{ - RUser user = (RUser)userList.resourceAt(i); - System.out.println(user.getAttributeValue(RUser.USER_PROFILE_NAME)); - System.out.println(user.getAttributeValue(RUser.TEXT_DESCRIPTION)); - System.out.println(); -} -
    -// Close the list. -userList.close(); -
    - -@deprecated Use -{@link com.ibm.as400.access.UserList UserList} instead, as this package may be removed in the future. -@see RUser -**/ -public class RUserList -extends SystemResourceList -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - -//----------------------------------------------------------------------------------------- -// Selection values. -//----------------------------------------------------------------------------------------- - -/** -Selection value indicating that the list contains all user profiles -and group profiles. -**/ - public static final String ALL = "*ALL"; - -/** -Selection value indicating that the list contains only user profiles -that are not group profiles. These are user profiles that do not have -a group identifier specified. -**/ - public static final String USER = "*USER"; - -/** -Selection value indicating that the list contains only user profiles -that are group profiles. These are user profiles that have a group -identifier specified. -**/ - public static final String GROUP = "*GROUP"; - -/** -Selection value indicating that the list contains only user profiles -that are members of a specified group. -**/ - public static final String MEMBER = "*MEMBER"; - - -/** -Selection value indicating that no group profile is specified. -**/ - public static final String NONE = "*NONE"; - -/** -Selection value indicating that the list contains only user profiles -that are not group profiles. These are user profiles that do not have -a group identifier specified. -**/ - public static final String NOGROUP = "*NOGROUP"; - - - - -//----------------------------------------------------------------------------------------- -// Presentation. -//----------------------------------------------------------------------------------------- - - private static final String PRESENTATION_KEY_ = "USER_LIST"; - private static final String ICON_BASE_NAME_ = "RUserList"; - private static PresentationLoader presentationLoader_ = new PresentationLoader("com.ibm.as400.resource.ResourceMRI"); - - - - -//----------------------------------------------------------------------------------------- -// Selection IDs. -// -// * If you add a selection here, make sure and add it to the class javadoc -// and in ResourceMRI.java. -//----------------------------------------------------------------------------------------- - - private static ResourceMetaDataTable selections_ = new ResourceMetaDataTable(presentationLoader_, PRESENTATION_KEY_); - private static ProgramMap selectionMap_ = new ProgramMap(); - - - -/** -Selection ID for selection criteria. This identifies a String selection, -which represents which users are returned. Possible values are: -
      -
    • {@link #ALL ALL} - All user profiles and group profiles are - returned. -
    • {@link #USER USER} - Only user profiles that are not group - profiles are returned. These are user profiles that do not have - a group identifier specified. -
    • {@link #GROUP GROUP} - Only user profiles that are group - profiles are returned. These are user profiles that have - a group identifier specified. -
    • {@link #MEMBER MEMBER} - User profiles that are members - of the group specified for the {@link #GROUP_PROFILE GROUP_PROFILE} - selection value are returned. -
    -**/ - public static final String SELECTION_CRITERIA = "SELECTION_CRITERIA"; - - static { - selections_.add(SELECTION_CRITERIA, String.class, false, - new String[] { ALL, USER, GROUP, MEMBER }, ALL, true); - selectionMap_.add(SELECTION_CRITERIA, null, "selectionCriteria"); - } - - - -/** -Selection ID for group profile. This identifies a String selection, -which represents the group profile whose members are to be returned. -Possible values are: -
      -
    • {@link #NONE NONE} - No group profile is specified. -
    • {@link #NOGROUP NOGROUP} - Users who are not a member of - any group are returned. -
    • The group profile name - Users who are a member of this group are - returned. -
    - -

    This must be set to a group profile name or {@link #NOGROUP NOGROUP} -if {@link #SELECTION_CRITERIA SELECTION_CRITERIA} is set to -{@link #MEMBER MEMBER}. This must be set to {@link #NONE NONE} -if {@link #SELECTION_CRITERIA SELECTION_CRITERIA} is not set to -{@link #MEMBER MEMBER}. -**/ - public static final String GROUP_PROFILE = "GROUP_PROFILE"; - - static { - selections_.add(GROUP_PROFILE, String.class, false, - new String[] { NONE, NOGROUP }, NONE, false); - selectionMap_.add(GROUP_PROFILE, null, "groupProfileName", new UpperCaseValueMap()); - } - - - - -/** -Selection ID for user profile. This identifies a String selection, -which represents the user profile specification that describes the -users to be included in the list. The user profile can be specified -only when connecting to systems running OS/400 V5R1 or later. -Possible values are: -

      -
    • {@link #ALL ALL} - All users are specified. -
    • The generic user profile name. A generic name is - a String which contains one or more characters followed by - an '*'. -
    • The user profile name. -
    -**/ - public static final String USER_PROFILE = "USER_PROFILE"; - - static { - ResourceMetaData rmd = selections_.add(USER_PROFILE, String.class, false, - new String[] { ALL }, ALL, false); - rmd.setLevel(new ResourceLevel(ResourceLevel.V5R1M0)); - selectionMap_.add(USER_PROFILE, null, "profileName", new UpperCaseValueMap()); - } - - - - -//----------------------------------------------------------------------------------------- -// Open list attribute map. -//----------------------------------------------------------------------------------------- - - private static ProgramMap openListAttributeMap_ = new ProgramMap(); - private static final String openListProgramName_ = "qgyolaus"; - - static { - openListAttributeMap_.add(RUser.USER_PROFILE_NAME, null, "receiverVariable.profileName"); - openListAttributeMap_.add(RUser.GROUP_MEMBER_INDICATOR, null, "receiverVariable.userOrGroupIndicator", new BooleanValueMap("0", "1")); - openListAttributeMap_.add(RUser.TEXT_DESCRIPTION, null, "receiverVariable.textDescription"); - } - - - -//----------------------------------------------------------------------------------------- -// PCML document initialization. -//----------------------------------------------------------------------------------------- - - private static final String DOCUMENT_NAME_ = "com.ibm.as400.resource.RUserList"; - private static ProgramCallDocument staticDocument_ = null; - private static final String formatName_ = "autu0150"; - - static { - // Create a static version of the PCML document, then clone it for each document. - // This will improve performance, since we will only have to deserialize the PCML - // object once. - try { - staticDocument_ = new ProgramCallDocument(); - staticDocument_.setDocument(DOCUMENT_NAME_); - } - catch(PcmlException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error instantiating ProgramCallDocument", e); - } - } - - -//----------------------------------------------------------------------------------------- -// Private data. -//----------------------------------------------------------------------------------------- - - private static final String profileNameDataName_ = ".receiverVariable.profileName"; - private static final String userOrGroupIndicatorDataName_ = ".receiverVariable.userOrGroupIndicator"; - - - -//----------------------------------------------------------------------------------------- -// Code. -//----------------------------------------------------------------------------------------- - -/** -Constructs an RUserList object. -**/ - public RUserList() - { - super(presentationLoader_.getPresentationWithIcon(PRESENTATION_KEY_, ICON_BASE_NAME_), - RUser.attributes_, - selections_, - null, - openListProgramName_, - formatName_, - selectionMap_); - } - - - -/** -Constructs an RUserList object. - -@param system The system. -**/ - public RUserList(AS400 system) - { - this(); - try { - setSystem(system); - } - catch(PropertyVetoException e) { - // Ignore. - } - } - - - -/** -Establishes the connection to the system. - -

    The method is called by the resource framework automatically -when the connection needs to be established. - -@exception ResourceException If an error occurs. -**/ - protected void establishConnection() - throws ResourceException - { - // Call the superclass. - super.establishConnection(); - - // Initialize the PCML document. - setDocument((ProgramCallDocument)staticDocument_.clone()); - setOpenListProgramName(openListProgramName_); - } - - - - -//----------------------------------------------------------------------------------------- -// List implementation. -//----------------------------------------------------------------------------------------- - - Resource newResource(String programName, int[] indices) - throws PcmlException, ResourceException - { - ProgramCallDocument document = getDocument(); - - String name = (String)document.getValue(programName + profileNameDataName_, indices); - AS400 system = getSystem(); - Object resourceKey = RUser.computeResourceKey(system, name); - RUser resource = (RUser)ResourcePool.GLOBAL_RESOURCE_POOL.getResource(resourceKey); - if (resource == null) { - try { - resource = new RUser(system, name); - resource.setResourceKey(resourceKey); - resource.freezeProperties(); - } - catch(Exception e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Exception while creating user from user list", e); - throw new ResourceException(e); - } - } - - // Copy the information from the API record to the RUser attributes. - Object[] attributeIDs = openListAttributeMap_.getIDs(); - Object[] values = openListAttributeMap_.getValues(attributeIDs, system, document, programName, indices); - for(int i = 0; i < values.length; ++i) { - resource.initializeAttributeValue(attributeIDs[i], values[i]); - } - - return resource; - } - - - - void setOpenParameters(ProgramCallDocument document) - throws PcmlException, ResourceException - { - // If a group profile is specified, but no selection criteria is specified, - // then default the selection criteria to MEMBER. - String groupProfile = (String)getSelectionValue(GROUP_PROFILE); - if (groupProfile != null) { - if (!groupProfile.equals(NONE)) { - if (getSelectionValue(SELECTION_CRITERIA) == null) - setSelectionValue(SELECTION_CRITERIA, MEMBER); - } - } - - super.setOpenParameters(document); - } - -} diff --git a/cvsroot/src/com/ibm/as400/resource/RUserList.pcml b/cvsroot/src/com/ibm/as400/resource/RUserList.pcml deleted file mode 100644 index 73746e9c8..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RUserList.pcml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/resource/RUserList16.gif b/cvsroot/src/com/ibm/as400/resource/RUserList16.gif deleted file mode 100644 index 4031c3ac9..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RUserList16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RUserList32.gif b/cvsroot/src/com/ibm/as400/resource/RUserList32.gif deleted file mode 100644 index e4ac5091c..000000000 Binary files a/cvsroot/src/com/ibm/as400/resource/RUserList32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/resource/RUserListBeanInfo.java b/cvsroot/src/com/ibm/as400/resource/RUserListBeanInfo.java deleted file mode 100644 index 988af0328..000000000 --- a/cvsroot/src/com/ibm/as400/resource/RUserListBeanInfo.java +++ /dev/null @@ -1,132 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RUserListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Trace; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.util.ResourceBundle; - - - -/** -The RUserListBeanInfo class represents the bean information -for the RUserList class. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class RUserListBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final Class beanClass_ = RUserList.class; - - private static BeanInfo[] additionalBeanInfo_; - private static BeanDescriptor beanDescriptor_; - private static Image icon16_; - private static Image icon32_; - private static ResourceBundle resourceBundle_; - - - -/** -Static initializer. -**/ - static - { - try - { - // Set up the resource bundle. - resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.resource.ResourceMRI"); - - // Set up the additional bean info. - additionalBeanInfo_ = new BeanInfo[] { new ResourceListBeanInfo() }; - - // Set up the bean descriptor. - beanDescriptor_ = new BeanDescriptor(beanClass_); - - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error while loading bean info", e); - throw new Error(e.toString()); - } - } - - - -/** -Returns the additional bean information. - -@return The additional bean information. -**/ - public BeanInfo[] getAdditionalBeanInfo() - { - return additionalBeanInfo_; - } - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor() - { - return beanDescriptor_; - } - - - -/** -Returns the icon. - -@param icon The icon kind. Possible values are: -

      -
    • BeanInfo.ICON_MONO_16x16 -
    • BeanInfo.ICON_MONO_32x32 -
    • BeanInfo.ICON_COLOR_16x16 -
    • BeanInfo.ICON_COLOR_32x32 -
    -@return The icon. -**/ - public Image getIcon(int icon) - { - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - if (icon16_ == null) - icon16_ = loadImage("RUserList16.gif"); - return icon16_; - - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - if (icon32_ == null) - icon32_ = loadImage("RUserList32.gif"); - return icon32_; - - default: - throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/Resource.java b/cvsroot/src/com/ibm/as400/resource/Resource.java deleted file mode 100644 index 7c86d0aa9..000000000 --- a/cvsroot/src/com/ibm/as400/resource/Resource.java +++ /dev/null @@ -1,969 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Resource.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400BidiTransform; -import com.ibm.as400.access.BidiStringType; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.Dictionary; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - - -/** -The Resource class represents a system resource. This is an abstract -class which provides generic access to the resource's attributes. -Every attribute is identified using an attribute ID. Any given subclass -of Resource will normally document the attribute IDs that it supports. - -

    One example of a concrete subclass of Resource is -{@link com.ibm.as400.resource.RUser RUser} -which represents a system user. RUser supports -many attribute IDs, -each of which can be used to get -attribute values. Here is an example which retrieves an attribute -value from an RUser: - -

    -// Create an RUser object to refer to a specific user.
    -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -RUser user = new RUser(system, "AUSERID");
    -
    -// Get the text description attribute value. -String textDescription = (String)user.getAttributeValue(RUser.TEXT_DESCRIPTION); -
    - -

    In addition to using concrete subclasses directly, you -can write generic code to work with any Resource subclass. -Such code may improve reusability and maintainability and will -work with future Resource subclasses without modification. -Every attribute has an associated attribute -{@link com.ibm.as400.resource.ResourceMetaData meta data} -object which describes various properties of the attribute. -The attribute meta data can come in handy when writing generic -code. Here is an example of generic code which prints the -value of every attribute supported by a Resource: - -

    -void printAllAttributeValues(Resource resource) throws ResourceException
    -{
    -    // Get the attribute meta data.
    -    ResourceMetaData[] attributeMetaData = resource.getAttributeMetaData();
    -    
    - // Loop through all attributes and print the values. - for(int i = 0; i < attributeMetaData.length; ++i) - { - Object attributeID = attributeMetaData[i].getID(); - Object value = resource.getAttributeValue(attributeID); - System.out.println("Attribute " + attributeID + " = " + value); - } -} -
    - -

    Every Resource and attribute meta data object has an associated -{@link com.ibm.as400.resource.Presentation Presentation} -object which provides translated information about the Resource -or attribute. You can use the Presentation information to -present Resources and attributes to end users. This example -prints a Resource and attribute using their Presentations: - -

    -void printSingleAttributeValue(Resource resource, Object attributeID) throws ResourceException
    -{
    -    // Get the presentation for the Resource and print its full name.
    -    Presentation resourcePresentation = resource.getPresentation();
    -    System.out.println(resourcePresentation.getFullName());
    -    
    - // Get the attribute meta data and the associated Presention. - ResourceMetaData attributeMetaData = resource.getAttributeMetaData(attributeID); - Presentation attributePresentation = attributeMetaData.getPresentation(); -
    - // Get the attribute value and print it. - Object value = resource.getAttributeValue(attributeID); - System.out.println(attributePresentation.getName() + " = " + value); -} -
    - -

    The Resource abstract class only provides read access to the attribute -values. {@link com.ibm.as400.resource.ChangeableResource ChangeableResource}, -which is a subclass of Resource, adds methods which provide write access to -the attribute values. - -

    Subclass notes: -

    If you are extending this class to override the mechanism for getting -attribute values, consider whether you need to support bidirectional -character conversion. If you do not plan to support bidirectional character -conversion, then you only need to override -{@link #getAttributeValue(java.lang.Object) getAttributeValue(Object)}. -If you do plan to support bidirectional character conversion, then you need -to override {@link #isBidiEnabled() isBidiEnabled()} to return true -and {@link #getAttributeValue(java.lang.Object, int) getAttributeValue(Object, int)}. - -

    In either case, the overriding method should call the superclass's -method of the same name and perform extra processing only when null -is returned: - -

    -    public Object getAttributeValue(Object attributeID)
    -    throws ResourceException
    -    {
    -        // Call the superclass first.
    -        Object value = super.getAttributeValue(attributeID);
    -        if (value == null) {
    -
    - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); -
    - // Go get the attribute value. - value = ...; - } - return value; - } -
    - -@see ResourceList -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public abstract class Resource -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private static Object counterLock_ = new Object(); - private static long counter_; - - private ResourceMetaDataTable attributes_; - private Dictionary attributeValues_; - private boolean connectionEstablished_ = false; - private String currentLevel_ = null; - private int defaultBidiStringType_ = -1; // @A2A - private Presentation presentation_; - private boolean propertiesFrozen_ = false; - private Object resourceKey_; - private AS400 system_ = null; - - private transient Vector activeStatusListeners_; - private transient PropertyChangeSupport propertyChangeSupport_; - private transient VetoableChangeSupport vetoableChangeSupport_; - - transient Vector resourceListeners_; // @A1a - - - -/** -Constructs a Resource object. -**/ - public Resource() - { - presentation_ = new Presentation(); - - synchronized(counterLock_) { - resourceKey_ = new Long(counter_++); - } - - attributes_ = new ResourceMetaDataTable(); - attributeValues_ = new Hashtable(); - initializeTransient(); - } - - - -/** -Constructs a Resource object. - -@param presentation The presentation. -@param resourceKey The resource key. -@param attributeMetaData The attribute meta data, or null if not applicable. -**/ - public Resource(Presentation presentation, - Object resourceKey, - ResourceMetaData[] attributeMetaData) - { - if(presentation == null) - throw new NullPointerException("presentation"); - if(resourceKey == null) - throw new NullPointerException("resourceKey"); - - presentation_ = presentation; - resourceKey_ = resourceKey; - attributes_ = new ResourceMetaDataTable(attributeMetaData); - attributeValues_ = new Hashtable(); - initializeTransient(); - } - - - -/** -Constructs a Resource object. - -@param presentation The presentation. -@param resourceKey The resource key. -@param attributeMetaData The attribute meta data, or null if not applicable. -@param values The attribute values. The keys are attribute IDs and - the elements are attribute values. The attribute IDs - and values must be consistent according to the attribute - meta data. -**/ - public Resource(Presentation presentation, - Object resourceKey, - ResourceMetaData[] attributeMetaData, - Dictionary values) - { - this(presentation, resourceKey, attributeMetaData); - - // Validate the attribute values. - synchronized(values) { - Enumeration keys = values.keys(); - while(keys.hasMoreElements()) { - Object attributeID = keys.nextElement(); - Object value = values.get(attributeID); - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, "Initializing attribute value " + attributeID + " (for " - + this + ") to " + value + "(" + value.getClass() + ")"); - - ResourceMetaData singleAttributeMetaData = attributes_.validateID(attributeID); - values.put(attributeID, singleAttributeMetaData.validateValue(value)); - } - } - - attributeValues_ = values; - initializeTransient(); - } - - - -/** -Constructs a Resource object. - -@param presentation The presentation. -@param resourceKey The resource key, or null if it is not set. -@param attributes The attribute meta data. -**/ - public Resource(Presentation presentation, - Object resourceKey, - ResourceMetaDataTable attributes) - { - if(presentation == null) - throw new NullPointerException("presentation"); - if(attributes == null) - throw new NullPointerException("attributes"); - - presentation_ = presentation; - resourceKey_ = resourceKey; - attributes_ = attributes; - attributeValues_ = new Hashtable(); - initializeTransient(); - } - - - -/** -Adds an ActiveStatusListener. - -@param listener The listener. -**/ - public void addActiveStatusListener(ActiveStatusListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - activeStatusListeners_.addElement(listener); - } - - - -/** -Adds a PropertyChangeListener. The specified PropertyChangeListener's -propertyChange() method will be called each time the value of -any bound property is changed. - -@param listener The listener. -*/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - propertyChangeSupport_.addPropertyChangeListener(listener); - } - - - -// @A1a - Formerly in ChangeableResource. -/** -Adds a ResourceListener. - -@param listener The listener. -**/ - public void addResourceListener(ResourceListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - resourceListeners_.addElement(listener); - } - - - -/** -Adds a VetoableChangeListener. The specified VetoableChangeListener's -vetoableChange() method will be called each time the value of -any constrained property is changed. - -@param listener The listener. -*/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - vetoableChangeSupport_.addVetoableChangeListener(listener); - } - - - -/** -Indicates if properties are frozen. If this is true, property -changes should not be made. Properties are not the same thing -as attributes. Properties are basic pieces of information -which must be set to make the object usable, such as the system -or other properties that identify the resource on the system. - -@return true if properties are frozen, false otherwise. -**/ - protected boolean arePropertiesFrozen() - { - return propertiesFrozen_; - } - - - -/** -Indicates if this resource is equal to an object. - -@param other The object. -@return true if this resource is equal to the object, - false otherwise. -**/ - public boolean equals(Object other) - { - if (other instanceof Resource) { - - // If the resource keys are set, then use them to compare. - if ((resourceKey_ != null) && (((Resource)other).resourceKey_ != null)) - return resourceKey_.equals(((Resource)other).resourceKey_); - - // Otherwise, just use the default. - else - return super.equals(other); - } - else - return false; - } - - - -/** -Establishes the connection to the system, if any. Subclasses can override -this method and put all connection initialization code here. -It is assumed that all properties have been set when this -method is called. Any subclass that overrides this method -should include a call to super.establishConnection(). - -@exception ResourceException If an error occurs. -**/ - protected void establishConnection() - throws ResourceException - { - if (system_ == null) - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, "Establishing a connection for " + this + "."); - - if (!propertiesFrozen_) - freezeProperties(); - connectionEstablished_ = true; - } - - - -// @A1a - Moved here from ChangeableResource. -/** -Fires an attributeValuesRefreshed() ResourceEvent. -**/ - protected void fireAttributeValuesRefreshed() - { - ResourceEvent event = new ResourceEvent(this, ResourceEvent.ATTRIBUTE_VALUES_REFRESHED); - Vector temp = (Vector)resourceListeners_.clone(); - Enumeration list = temp.elements(); - while(list.hasMoreElements()) - ((ResourceListener)list.nextElement()).attributeValuesRefreshed(event); - } - - - -/** -Fires a busy active status event. This indicates that a potentially -long-running operation has started. -**/ - protected void fireBusy() - { - ActiveStatusEvent event = new ActiveStatusEvent(this, ActiveStatusEvent.BUSY); - Vector temp = (Vector)activeStatusListeners_.clone(); - Enumeration list = temp.elements(); - while(list.hasMoreElements()) - ((ActiveStatusListener)list.nextElement()).busy(event); - } - - -/** -Fires a idle active status event. This indicates that a potentially -long-running operation has ended. -**/ - protected void fireIdle() - { - ActiveStatusEvent event = new ActiveStatusEvent(this, ActiveStatusEvent.IDLE); - Vector temp = (Vector)activeStatusListeners_.clone(); - Enumeration list = temp.elements(); - while(list.hasMoreElements()) - ((ActiveStatusListener)list.nextElement()).idle(event); - } - - -/** -Fires a property change event. - -@param propertyName The property name. -@param oldValue The old value. -@param newValue The new value. -**/ - protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) - { - propertyChangeSupport_.firePropertyChange(propertyName, oldValue, newValue); - } - - - -/** -Fires a vetoable change event. - -@param propertyName The property name. -@param oldValue The old value. -@param newValue The new value. - -@exception PropertyVetoException If the property change is vetoed. -**/ - protected void fireVetoableChange(String propertyName, Object oldValue, Object newValue) - throws PropertyVetoException - { - vetoableChangeSupport_.fireVetoableChange(propertyName, oldValue, newValue); - } - - - - -/** -Freezes any property changes. After this is called, property -changes should not be made. Properties are not the same thing -as attributes. Properties are basic pieces of information -which must be set to make the object usable, such as the system -or other properties that identify the resource on the system. - -

    Subclasses can override this method and put initialization -code here that is dependent on properties being set. -Any subclass that overrides this method should include a -call to super.freezeProperties(). - -@exception ResourceException If an error occurs. -**/ -// -// Implementation notes: -// -// 1. This will be called when a resource is added to a -// resource pool, to prevent its key from being changed. -// -// 2. This is separate from establishConnection() because -// there are times when we want to freeze the properties -// without incurring the performance hit of setting up -// the connection. For example, getting a list of Users. -// Each User's properties should be frozen, but we don't -// want to establish a connection for each user unless -// the calling program needs to. -// - protected void freezeProperties() - throws ResourceException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, "Freezing properties for " + this + "."); - - propertiesFrozen_ = true; - } - - - -/** -Returns the attribute meta data for a specific attribute. - -@param attributeID Identifies the attribute. -@return The attribute meta data. -**/ - public ResourceMetaData getAttributeMetaData(Object attributeID) - { - return attributes_.getMetaData(attributeID); - } - - - -/** -Returns the attribute meta data. The array will contain an element -for every supported attribute. - -@return The attribute meta data. The array has zero elements if - there are no attributes. -**/ - public ResourceMetaData[] getAttributeMetaData() - { - return attributes_.getMetaData(getCurrentLevel()); - } - - - - // @A2C -/** -Returns the current value of an attribute. - -@param attributeID Identifies the attribute. -@return The attribute value, or null if the attribute - value is not available. - -@exception ResourceException If an error occurs. - -@see Subclass notes -**/ - public Object getAttributeValue(Object attributeID) - throws ResourceException - { - // If this resource is bidi enabled, then punt to the bidi flavor - // of getAttributeValue(). This will ensure that the subclass's - // bidi-enabled getAttributeValue() method gets called even though - // no string type was passed - - and therefore the subclass only - // needs to override the bidi-enabled getAttributeValue(). - if (isBidiEnabled()) - return getAttributeValue(attributeID, getDefaultBidiStringType()); - else - return getAttributeValueImplementation(attributeID); - } - - - -// @A2A -/** -Returns the current value of an attribute. - -@param attributeID Identifies the attribute. -@param bidiStringType The bidi string type as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. -@return The attribute value, or null if the attribute - value is not available. - -@exception ResourceException If an error occurs. - -@see Subclass notes -**/ - public Object getAttributeValue(Object attributeID, int bidiStringType) - throws ResourceException - { - // If this resource is not bidi enabled, then punt to the non-bidi flavor - // of getAttributeValue(). This will ensure that the subclass's - // non-bidi-enabled getAttributeValue() method gets called even though - // a string type was passed - - and therefore the subclass only - // needs to override the non-bidi-enabled getAttributeValue(). - if (!isBidiEnabled()) - return getAttributeValue(attributeID); - else { - // In the default implementation, we don't use the string type, - // since there is no conversion being done. - return getAttributeValueImplementation(attributeID); - } - } - - -// @A2A - Object getAttributeValueImplementation(Object attributeID) - throws ResourceException - { - synchronized(this) { - attributes_.validateID(attributeID); - return attributeValues_.get(attributeID); - } - } - - - -/** -Returns the current level. This is the system VRM, or -"" if the system has not been set. - -@return The current level. -**/ - String getCurrentLevel() - { - if (system_ == null) - return ""; - if (currentLevel_ != null) - return currentLevel_; - - try { - currentLevel_ = ResourceLevel.vrmToLevel(system_.getVRM()); - } - catch(Exception e) { - return ""; - } - return currentLevel_; - } - - - -// @A2A - int getDefaultBidiStringType() - { - if (system_ == null) - return BidiStringType.DEFAULT; - if (defaultBidiStringType_ == -1) - defaultBidiStringType_ = AS400BidiTransform.getStringType((char)system_.getCcsid()); - return defaultBidiStringType_; - } - - - -/** -Returns the presentation information. - -@return The presentation information. -**/ - public Presentation getPresentation() - { - return presentation_; - } - - - -/** -Returns the resource key. The resource key uniquely identifies the resource. -The resource key may not be set if the resource's properties are not set. - -@return The resource key, or null if the resource key has not been set. -**/ -// -// Implementation note: -// -// The resource key is used for identifying reusable objects in the resource -// pool. If there is already an object in the pool with a specified resource -// key, then we can reuse it. Subclasses of this class should define resource -// keys so that if any 2 objects can be used interchangeably, then their resource -// keys should be the same. -// - public Object getResourceKey() - { - return resourceKey_; - } - - - -/** -Returns the system. - -@return The system. -**/ - public AS400 getSystem() - { - return system_; - } - - - -/** -Initializes an attribute value. This is intended for use by the -subclass when it is initializing attribute values. - -@param attributeID Identifies the attribute. -@param value The attribute value. This cannot be null. -**/ - protected void initializeAttributeValue(Object attributeID, Object value) - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, "Initialized attribute value " + attributeID + " (for " - + this + ") to " + value + "(" + value.getClass() + ")"); - - // Validation. - ResourceMetaData attributeMetaData = attributes_.validateID(attributeID); - if (value == null) - throw new NullPointerException("value"); - value = attributeMetaData.validateValue(value); - - // Make the change. - synchronized(this) { - attributeValues_.put(attributeID, value); - } - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient() - { - activeStatusListeners_ = new Vector(); - propertyChangeSupport_ = new PropertyChangeSupport(this); - vetoableChangeSupport_ = new VetoableChangeSupport(this); - - resourceListeners_ = new Vector(); // @A1a - } - - - -// @A2A -/** -Indicates if this resource is enabled for bidirectional character conversion. -The default implementation always returns false. Subclasses that are enabled -for bidirectional character conversion should override this method to return -true. - -@return Always false. - -@see Subclass notes -**/ - protected boolean isBidiEnabled() - { - return false; - } - - - -/** -Indicates if a connection to the system is established, if any. - -@return true if a connection is established, false otherwise. -**/ - protected boolean isConnectionEstablished() - { - return connectionEstablished_; - } - - - -/** -Deserializes the resource. -**/ - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient (); - } - - - -/** -Refreshes the values for all attributes. - -@exception ResourceException If an error occurs. -**/ - public void refreshAttributeValues() - throws ResourceException - { - fireAttributeValuesRefreshed(); // @A1a - // Do nothing else by default. - } - - - -/** -Removes an ActiveStatusListener. - -@param listener The listener. -**/ - public void removeActiveStatusListener(ActiveStatusListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - activeStatusListeners_.removeElement(listener); - } - - - -/** -Removes a PropertyChangeListener. - -@param listener The listener. -**/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - propertyChangeSupport_.removePropertyChangeListener(listener); - } - - - -// @A1a - Moved here from ChangeableResource. -/** -Removes a ResourceListener. - -@param listener The listener. -**/ - public void removeResourceListener(ResourceListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - resourceListeners_.removeElement(listener); - } - - - -/** -Removes a VetoableChangeListener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - vetoableChangeSupport_.removeVetoableChangeListener(listener); - } - - - -/** -Sets the presentation. - -@param presentation The presentation. -**/ - protected void setPresentation(Presentation presentation) - { - if(presentation == null) - throw new NullPointerException("presentation"); - - presentation_ = presentation; - } - - - -/** -Sets the resource key. - -@param resourceKey The resource key. -**/ -// -// Implementation note: -// -// Resources should never change their key once they have -// been added to the resource pool. -// - protected void setResourceKey(Object resourceKey) - { - if(resourceKey == null) - throw new NullPointerException("resourceKey"); - - resourceKey_ = resourceKey; - } - - - -/** -Sets the system. This does not change the job on -the system. Instead, it changes the system to which -this object references. This cannot be changed -if the object has established a connection to the system. - -@param system The system. - -@exception PropertyVetoException If the property change is vetoed. -**/ - public void setSystem(AS400 system) - throws PropertyVetoException - { - if (system == null) - throw new NullPointerException("system"); - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - - AS400 oldValue = system_; - fireVetoableChange("system", oldValue, system); - system_ = system; - firePropertyChange("system", oldValue, system); - } - - - -/** -Returns the presentation full name, if any. - -@return The presentation full name, if any. -**/ - public String toString() - { - if (presentation_ == null) - return super.toString(); - else { - String fullName = presentation_.getFullName(); - if (fullName.length() > 0) - return fullName; - else - return super.toString(); - } - } - - - -/** -Validates the attribute ID. - -@param attributeID The attribute ID. -@return The attribute meta data. -**/ - ResourceMetaData validateAttributeID(Object attributeID) - { - return attributes_.validateID(attributeID); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ResourceAdapter.java b/cvsroot/src/com/ibm/as400/resource/ResourceAdapter.java deleted file mode 100644 index a12173e1b..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ResourceAdapter.java +++ /dev/null @@ -1,86 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceAdapter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - - - -/** -The ResourceAdapter class is a default implementation of the -{@link com.ibm.as400.resource.ResourceListener ResourceListener} -interface. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class ResourceAdapter -implements ResourceListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Invoked when attribute changes are canceled. - -@param event The event. -**/ - public void attributeChangesCanceled(ResourceEvent event) { } - - - -/** -Invoked when attribute changes are committed. - -@param event The event. -**/ - public void attributeChangesCommitted(ResourceEvent event) { } - - - -/** -Invoked when attributes values are refreshed. - -@param event The event. -**/ - public void attributeValuesRefreshed(ResourceEvent event) { } - - - -/** -Invoked when an attribute value is changed. - -@param event The event. -**/ - public void attributeValueChanged(ResourceEvent event) { } - - - -/** -Invoked when an resource is created. - -@param event The event. -**/ - public void resourceCreated(ResourceEvent event) { } - - - -/** -Invoked when an resource is deleted. - -@param event The event. -**/ - public void resourceDeleted(ResourceEvent event) { } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ResourceBeanInfo.java b/cvsroot/src/com/ibm/as400/resource/ResourceBeanInfo.java deleted file mode 100644 index 22df558a3..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ResourceBeanInfo.java +++ /dev/null @@ -1,130 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.Trace; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; -import java.util.ResourceBundle; - - -/** -Represents the bean information for Resource objects. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class ResourceBeanInfo -extends SimpleBeanInfo -{ - // Private data. - - // Technically, this would belong in "ChangeableResourceBeanInfo", - // but there was no need at this time to separate it. - private static final Class beanClass_ = ChangeableResource.class; - - private static EventSetDescriptor[] eventSetDescriptors_; - private static PropertyDescriptor[] propertyDescriptors_; - private static ResourceBundle resourceBundle_; - - - -/** -Static initializer. -**/ - static - { - try - { - // Set up the resource bundle. - resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.resource.ResourceMRI"); - - // Set up the property descriptors. - PropertyDescriptor system = new PropertyDescriptor("system", beanClass_); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(resourceBundle_.getString("PROPERTY_SYSTEM_NAME")); - system.setShortDescription(resourceBundle_.getString("PROPERTY_SYSTEM_DESCRIPTION")); - - propertyDescriptors_ = new PropertyDescriptor[] { system }; - - // Set up the event set descriptors. - EventSetDescriptor propertyChange = new EventSetDescriptor(beanClass_, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(resourceBundle_.getString("EVENT_PROPERTY_CHANGE_NAME")); - propertyChange.setShortDescription(resourceBundle_.getString("EVENT_PROPERTY_CHANGE_DESCRIPTION")); - - // Technically, this would belong in "ChangeableResourceBeanInfo", - // but there was no need at this time to separate it. - EventSetDescriptor resource = new EventSetDescriptor(beanClass_, "resource", ResourceListener.class, - new String[] { "attributeChangesCanceled", "attributeChangesCommitted", "attributeValuesRefreshed", "attributeValueChanged" }, - "addResourceListener", - "removeResourceListener"); - resource.setDisplayName(resourceBundle_.getString("EVENT_RESOURCE_NAME")); - resource.setShortDescription(resourceBundle_.getString("EVENT_RESOURCE_DESCRIPTION")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(beanClass_, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(resourceBundle_.getString("EVENT_VETOABLE_CHANGE_NAME")); - vetoableChange.setShortDescription(resourceBundle_.getString("EVENT_VETOABLE_CHANGE_DESCRIPTION")); - - eventSetDescriptors_ = new EventSetDescriptor[] { propertyChange, resource, vetoableChange }; - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error while loading bean info", e); - throw new Error(e.toString()); - } - } - - - -/** -Returns the default event index. - -@return The default event index. -**/ - public int getDefaultEventIndex() - { - return 0; - } - - - -/** -Returns the event set descriptors. - -@return The event set descriptors. -**/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors_; - } - - - -/** -Returns the property descriptors. - -@return The property descriptors. -**/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors_; - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/ResourceEvent.java b/cvsroot/src/com/ibm/as400/resource/ResourceEvent.java deleted file mode 100644 index 6dc3e2b9a..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ResourceEvent.java +++ /dev/null @@ -1,178 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.util.EventObject; - - - -/** -The ResourceEvent class represents a resource event. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class ResourceEvent -extends EventObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private Object attributeID_ = null; - private int eventID_ = -1; - private Object value_ = null; - - - -/** -Event ID indicating that attribute changes are canceled. -**/ - public static final int ATTRIBUTE_CHANGES_CANCELED = 1; - - - -/** -Event ID indicating that attribute changes are committed. -**/ - public static final int ATTRIBUTE_CHANGES_COMMITTED = 2; - - - -/** -Event ID indicating that attribute values are refreshed. -**/ - public static final int ATTRIBUTE_VALUES_REFRESHED = 3; - - - -/** -Event ID indicating that an attribute is changed. -**/ - public static final int ATTRIBUTE_VALUE_CHANGED = 4; - - - -/** -Event ID indicating that a resource is created. -**/ - public static final int RESOURCE_CREATED = 5; - - - -/** -Event ID indicating that a resource is deleted. -**/ - public static final int RESOURCE_DELETED = 6; - - - - private static final int FIRST_EVENT_ID_ = ATTRIBUTE_CHANGES_CANCELED; - private static final int LAST_EVENT_ID_ = RESOURCE_DELETED; - - - -/** -Constructs a ResourceEvent object. - -@param source The source. -@param eventID The event ID. -**/ - public ResourceEvent(Object source, int eventID) - { - super(source); - validateEventID(eventID); - eventID_ = eventID; - } - - - -/** -Constructs a ResourceEvent object. - -@param source The source. -@param eventID The event ID. -@param attributeID Identifies the associated attribute, or null if none. -@param value The attribute value. -**/ - public ResourceEvent(Object source, - int eventID, - Object attributeID, - Object value) - { - super(source); - validateEventID(eventID); - - eventID_ = eventID; - attributeID_ = attributeID; - value_ = value; - } - - - -/** -Returns the associated attribute ID, or null if none. - -@return The associated attribute ID, or null if none. -**/ - public Object getAttributeID() - { - return attributeID_; - } - - - -/** -Returns the event ID. - -@return The event ID. -**/ - public int getID() - { - return eventID_; - } - - - -/** -Returns the associated attribute value, or null if none. - -@return The associated attribute value, or null if none. -**/ - public Object getValue() - { - return value_; - } - - - -/** -Validates the event ID. - -@param eventID The event ID. -**/ - private void validateEventID(int eventID) - { - if ((eventID < FIRST_EVENT_ID_) || (eventID > LAST_EVENT_ID_)) - throw new ExtendedIllegalArgumentException("eventID", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ResourceException.java b/cvsroot/src/com/ibm/as400/resource/ResourceException.java deleted file mode 100644 index 4a083625f..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ResourceException.java +++ /dev/null @@ -1,376 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400Exception; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.ErrorCompletingRequestException; -import com.ibm.as400.access.InternalErrorException; -import com.ibm.as400.access.ObjectDoesNotExistException; -import com.ibm.as400.access.ReturnCodeException; -import com.ibm.as400.access.Trace; -import com.ibm.as400.data.PcmlException; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.ResourceBundle; - - - -/** -The ResourceException class represents an exception that -occurs when using a -{@link com.ibm.as400.resource.Resource Resource} or -{@link com.ibm.as400.resource.ResourceList ResourceList}. -Most of the time, this exception is thrown as the result -of another exception being caught. In this case, the underlying -exception is available here. - -

    In some cases, the exception is expected by the user. For -example, if the user explicitly canceled an operation, -then the user expects the resulting exception. The default -is that the exception is not expected by the user. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -// -// Design notes: -// -// 1. The isExpected() method came from a request to determine -// when the exception occurred because the user canceled -// the signon. In Operations Navigator today, the user gets -// an annoying error message when they cancel. Rather -// than externalize the concept of "sign on" here, I have -// generalized the concept to the notion of an expected -// exception. -// -public class ResourceException -extends Exception -implements ReturnCodeException -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private static ResourceBundle resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.resource.ResourceMRI"); - - private Throwable exception_ = null; - private boolean expected_ = false; - private AS400Message[] messageList_ = null; - private int returnCode_ = UNKNOWN_ERROR; - - - -/** -The return code indicating that resource attributes were not returned. -**/ - public static final int ATTRIBUTES_NOT_RETURNED = 1; - - - -/** -The return code indicating that resource attributes were not set. -**/ - public static final int ATTRIBUTES_NOT_SET = 2; - - - -/** -The return code indicating that AS400Message's were returned. -**/ - public static final int MESSAGES_RETURNED = 3; - - - -/** -The return code indicating that an operation failed. -**/ - public static final int OPERATION_FAILED = 4; - - - -/** -The return code indicating that an operation is not supported. -**/ - public static final int OPERATION_NOT_SUPPORTED = 5; - - - -/** -The return code indicating that an unknown problem has occurred. -**/ - public static final int UNKNOWN_ERROR = 6; - - - -/** -The return code indicating that user has insuffient authority. -**/ - public static final int AUTHORITY_INSUFFICIENT = 7; - - - -/** -The return code indicating that the resource attribute is read-only. -**/ - public static final int ATTRIBUTE_READ_ONLY = 8; - - - -/** -Constructs a ResourceException object. -**/ - public ResourceException() - { - super(); - } - - - -/** -Constructs a ResourceException object. - -@param returnCode The return code. -**/ - public ResourceException(int returnCode) - { - super(buildMessage(returnCode, null)); - returnCode_ = returnCode; - } - - - -/** -Constructs a ResourceException object. - -@param exception The underlying exception. -**/ - public ResourceException(Throwable exception) - { - super((exception instanceof PcmlException) ? ((PcmlException)exception).getLocalizedMessage() : exception.getMessage()); - -//@B0D if (exception instanceof PcmlException) { -//@B0D exception_ = ((PcmlException)exception).getException(); -//@B0D if (exception_ == null) -//@B0D exception_ = exception; -//@B0D } -//@B0D else - exception_ = exception; - - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "ResourceException was thrown", exception); - } - - - -/** -Constructs a ResourceException object. - -@param messageList The message list. -**/ - public ResourceException(AS400Message[] messageList) - { - super(buildMessage(MESSAGES_RETURNED, messageList)); - returnCode_ = MESSAGES_RETURNED; - messageList_ = messageList; - - if (Trace.isTraceOn()) { - for(int i = 0; i < messageList.length; ++i) - Trace.log(Trace.ERROR, messageList[i].toString()); - } - } - - - -/** -Constructs a ResourceException object. - -@param returnCode The return code. -@param exception The underlying exception. -**/ - public ResourceException(int returnCode, Throwable exception) - { - super(buildMessage(returnCode, null)); - exception_ = exception; - returnCode_ = returnCode; - - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "ResourceException was thrown", exception); - } - - - -/** -Constructs a ResourceException object. - -@param returnCode The return code. -@param exception The underlying exception. -@param expected true if the exception is expected by the user, - false otherwise. -**/ - public ResourceException(int returnCode, Throwable exception, boolean expected) - { - super(buildMessage(returnCode, null)); - exception_ = exception; - expected_ = expected; - returnCode_ = returnCode; - } - - - -/** -Builds the message based on the return code. - -@param returnCode The return code. -@param messageList The message list, or null if none. -@return The message. -**/ - private static String buildMessage(int returnCode, AS400Message[] messageList) - { - String mriKey; - switch(returnCode) { - case ATTRIBUTES_NOT_RETURNED: - mriKey = "EXC_ATTRIBUTES_NOT_RETURNED"; - break; - case ATTRIBUTES_NOT_SET: - mriKey = "EXC_ATTRIBUTES_NOT_SET"; - break; - case MESSAGES_RETURNED: - if (messageList != null) - if (messageList.length > 0) { - return messageList[0].getText(); - } - mriKey = "EXC_MESSAGES_RETURNED"; - break; - case OPERATION_FAILED: - mriKey = "EXC_OPERATION_FAILED"; - break; - case OPERATION_NOT_SUPPORTED: - mriKey = "EXC_OPERATION_NOT_SUPPORTED"; - break; - case AUTHORITY_INSUFFICIENT: - mriKey = "EXC_AUTHORITY_INSUFFICIENT"; - break; - case ATTRIBUTE_READ_ONLY: - mriKey = "EXC_ATTRIBUTE_READ_ONLY"; - break; - case UNKNOWN_ERROR: - default: - mriKey = "EXC_UNKNOWN_ERROR"; - break; - } - - return resourceBundle_.getString(mriKey); - } - - - -/** -Returns the underlying exception, if any. - -@return The underlying exception, or null if there is none. -**/ - public Throwable getException() - { - return exception_; - } - - - -/** -Returns the message list, if any. - -@return The message list, or null if there is none. -**/ - public AS400Message[] getMessageList() - { - if (exception_ instanceof ResourceException) - return ((ResourceException)exception_).getMessageList(); - else - return messageList_; - } - - - -/** -Returns the return code. - -@return The return code. -**/ - public int getReturnCode() - { - if (exception_ instanceof ResourceException) - return ((ResourceException)exception_).getReturnCode(); - else - return returnCode_; - } - - - -/** -Indicates if the exception is expected by the user. For -example, if the user explicitly canceled an operation, -then the user expects the resulting exception. -**/ - public boolean isExpected() - { - return expected_; - } - - - -/** -Unwraps the underlying exception and throws it. - -@exception AS400SecurityException If a security or authority error occurs. -@exception ErrorCompletingRequestException If an error occurs before the request is completed. -@exception InterruptedException If this thread is interrupted. -@exception IOException If an error occurs while communicating with the system. -@exception ObjectDoesNotExistException If the system object does not exist. -**/ - public void unwrap() - throws AS400SecurityException, - ErrorCompletingRequestException, - InterruptedException, - IOException, - ObjectDoesNotExistException - { - //@B0C - Changed this method. - - Throwable x = exception_; - while (x != null && x instanceof PcmlException) - { - x = ((PcmlException)x).getException(); - } - if (x == null) x = exception_; // Nothing else we can do here. - - if (x instanceof AS400SecurityException) throw (AS400SecurityException)x; - if (x instanceof ErrorCompletingRequestException) throw (ErrorCompletingRequestException)x; - if (x instanceof InterruptedException) throw (InterruptedException)x; - if (x instanceof IOException) throw (IOException)x; - if (x instanceof ObjectDoesNotExistException) throw (ObjectDoesNotExistException)x; - if (x instanceof ResourceException) ((ResourceException)exception_).unwrap(); - if (x instanceof RuntimeException) throw (RuntimeException)x; - if (messageList_ != null) throw new AS400Exception(messageList_); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ResourceLevel.java b/cvsroot/src/com/ibm/as400/resource/ResourceLevel.java deleted file mode 100644 index 3971a0907..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ResourceLevel.java +++ /dev/null @@ -1,227 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceLevel.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.io.Serializable; - - - -/** -The ResourceLevel class represents a range of supported levels. -A level is a string which describes some level of support. - -

    In most cases within the IBM Toolbox for Java, the level -is the version, release, and modification level of the system -to which you are connected, in the form VxRxMx. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -// -// Design notes: -// -// 1. I originally wanted to use Object for the level, but I needed -// something for comparisions, i.e., a type that has the notion -// of less than. So I chose what I thought was the next most -// generic type, String. (Number would have been another possible -// choice, but not as usable in my opinion.) -// -public class ResourceLevel -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - -/** -Constant value for the level representing V4R4M0. -**/ - public static final String V4R4M0 = "V4R4M0"; - - - -/** -Constant value for the level representing V4R5M0. -**/ - public static final String V4R5M0 = "V4R5M0"; - - - -/** -Constant value for the level representing V5R1M0. -**/ - public static final String V5R1M0 = "V5R1M0"; - - - - // Private data. - private String minLevel_ = null; - private String maxLevel_ = null; - - - -/** -Constructs a ResourceLevel object which indicates that all levels are supported. -**/ - public ResourceLevel() - { - } - - - -/** -Constructs a ResourceLevel object. - -@param minLevel The minimum supported level, or null if all levels are supported. -**/ - public ResourceLevel(String minLevel) - { - minLevel_ = minLevel; - } - - - -/** -Constructs a ResourceLevel object. - -@param minLevel The minimum supported level, or null if all previous levels are supported. -@param maxLevel The maximum supported level, or null if all following levels are supported. -**/ - public ResourceLevel(String minLevel, String maxLevel) - { - if ((minLevel != null) && (maxLevel != null)) - if (minLevel.compareTo(maxLevel) < 0) - throw new ExtendedIllegalArgumentException("maxLevel", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - minLevel_ = minLevel; - maxLevel_ = maxLevel; - } - - - -/** -Indicates if the VRM is within the range of this level. - -@param vrm The VRM for a system. -@return true if the VRM is within the range of this level, - false otherwise. - -@see com.ibm.as400.access.AS400#getVRM() -**/ - public boolean checkLevel(int vrm) - { - return checkLevel(vrmToLevel(vrm)); - } - - - -/** -Indicates if the specified level is within the range of this level. - -@param level The specified level. -@return true if the specified level is within the range of this level, - false otherwise. -**/ - public boolean checkLevel(String level) - { - if (level == null) - return true; - else if (level.length() == 0) - return true; - else if (minLevel_ == null) { - if (maxLevel_ == null) - return true; - else - return (level.compareTo(maxLevel_) <= 0); - } - else { - if (maxLevel_ == null) - return (minLevel_.compareTo(level) <= 0); - else - return ((minLevel_.compareTo(level) <= 0) - && (level.compareTo(maxLevel_) <= 0)); - } - } - - - -/** -Returns the minimum supported level. - -@return The minimum supported level, or null if all previous levels are supported. -**/ - public String getMinLevel() - { - return minLevel_; - } - - - -/** -Returns the maximum supported level. - -@return The maximum supported level, or null if all following levels are supported. -**/ - public String getMaxLevel() - { - return maxLevel_; - } - - - -/** -Converts the VRM to a level. - -@param vrm The VRM for a system. -@return The level. - -@see com.ibm.as400.access.AS400#getVRM() -**/ - public static String vrmToLevel(int vrm) - { - StringBuffer buffer = new StringBuffer("V"); - buffer.append((int)((vrm & 0xFFFF0000) >> 16)); - buffer.append("R"); - buffer.append((int)((vrm & 0x0000FF00) >> 8)); - buffer.append("M"); - buffer.append((int)((vrm & 0x000000FF))); - return buffer.toString(); - } - - - -/** -Returns a String representation of the level. - -@return The String representation of the level. -**/ - public String toString() - { - StringBuffer buffer = new StringBuffer("["); - if (minLevel_ != null) - buffer.append(minLevel_); - buffer.append(','); - if (maxLevel_ != null) - buffer.append(maxLevel_); - buffer.append(']'); - return buffer.toString(); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ResourceList.java b/cvsroot/src/com/ibm/as400/resource/ResourceList.java deleted file mode 100644 index d39fd9787..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ResourceList.java +++ /dev/null @@ -1,1525 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400BidiTransform; -import com.ibm.as400.access.BidiStringType; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - - - -/** -The ResourceList class represents a list of system resources. This -is an abstract class which provides generic access to the list's -contents. - -

    A ResourceList is always either open or closed. The ResourceList -must be open in order to access its contents. Call {@link #open open()} -to explicitly open the ResourceList. Otherwise, most -access methods will implicitly open the ResourceList if needed. -When you are finished using the ResourceList, call -{@link #close close()} to ensure that it cleans up system -resources as needed. - -

    The contents of a ResourceList are 0 or more -{@link com.ibm.as400.resource.Resource Resource} objects. -Use {@link #resourceAt(long) resourceAt()} to access a specific -Resource from the list. All indices are 0-based. - -

    In order to provide immediate access to the ResourceList's -contents and manage memory efficiently, most ResourceLists are -loaded incrementally. This means that neither all of the contents -nor the exact {@link #getListLength length} is available when the ResourceList -is first opened. Some subclasses may load the contents on demand, -others may load them asynchronously. At some point, depending on -the subclass implementation, the ResourceList will be -{@link #isComplete complete}. This means that all of its contents -are available and the exact length is known. - -

    Call {@link #waitForResource(long) waitForResource()} to ensure that a -particular Resource is made available. Call {@link #waitForComplete waitForComplete()} -to ensure that all of the contents and the exact length -are made available. - -

    ResourceLists can be filtered using selection values. Every selection -value is identified using a selection ID. Similarly, ResourceLists can be -sorted using sort values. Every sort value is identified using a sort ID. -Any given subclass of ResourceList will normally document the selection IDs -and sort IDs that it supports. - -

    One example of a concrete subclass of ResourceList is -{@link com.ibm.as400.resource.RJobList RJobList}, which -represents a list of server jobs. RJobList supports many -selection -IDs and sort -IDs, each of which can be used to filter or sort the list. -Here is an example which prints the contents of an RJobList: - -

    -// Create an RJobList object to represent a list of jobs.
    -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -RJobList jobList = new RJobList(system);
    -
    -// Filter the list to include only interactive jobs. -jobList.setSelectionValue(RJobList.JOB_TYPE, RJob.JOB_TYPE_INTERACTIVE); -
    -// Sort the list by user name, then job name. -Object[] sortValue = new Object[] { RJob.USER_NAME, RJob.JOB_NAME }; -jobList.setSortValue(sortValue); -
    -// Open the list and wait for it to complete. -jobList.open(); -jobList.waitForComplete(); -
    -// Read and print the contents of the list. -long length = jobList.getListLength(); -for(long i = 0; i < length; ++i) -{ - System.out.println(jobList.resourceAt(i)); -} -
    -// Close the list. -jobList.close(); -
    - -

    In addition to using concrete subclasses directly, you -can write generic code to work with any ResourceList subclass. -Such code may improve reusability and maintainability and -will work with future ResourceList subclasses without -modification. Here is an example of generic code which -prints the some of the contents of a ResourceList: - -

    -void printContents(ResourceList resourceList, long numberOfItems) throws ResourceException
    -{
    -    // Open the list and wait for the requested number of items
    -    // to become available.
    -    resourceList.open();
    -    resourceList.waitForResource(numberOfItems);
    -    
    - for(long i = 0; i < numberOfItems; ++i) - { - System.out.println(resourceList.resourceAt(i)); - } -} -
    - -

    Every selection, sort, and resource attribute has an -associated {@link com.ibm.as400.resource.ResourceMetaData meta data} -object which describes various properties such as the -default value and possible values. In addition, every ResourceList and -meta data object has an associated {@link com.ibm.as400.resource.Presentation Presentation} -object which provides translated information about the ResourceList, -selection, sort, or attribute. You can use the Presentation information to -present this information to end users. This example prints a ResourceList -and its sort values using their Presentations: - -

    -void printCurrentSort(ResourceList resourceList) throws ResourceException
    -{
    -    // Get the presentation for the ResourceList and print its full name.
    -    Presentation resourceListPresentation = resourceList.getPresentation();
    -    System.out.println(resourceListPresentation.getFullName());
    -    
    - // Get the current sort value. - Object[] sortIDs = resourceList.getSortValue(); -
    - // Print each sort ID. - for(int i = 0; i < sortIDs.length; ++i) - { - ResourceMetaData sortMetaData = resourceList.getSortMetaData(sortIDs[i]); - System.out.println("Sorting by " + sortMetaData.getName()); - } -} -
    - -

    Use {@link com.ibm.as400.vaccess.ResourceListDetailsPane ResourceListDetailsPane } -or {@link com.ibm.as400.vaccess.ResourceListPane ResourceListPane } -to present a ResourceList in a graphical user interface. Use -{@link com.ibm.as400.util.servlet.ResourceListRowData ResourceListRowData } -to present a ResourceList in a servlet. - -

    Subclass notes: -

    If you are extending this class to override the mechanism for getting -selection values, consider whether you need to support bidirectional -character conversion. If you do not plan to support bidirectional character -conversion, then you only need to override -{@link #getSelectionValue(java.lang.Object) getSelectionValue(Object)}. -If you do plan to support bidirectional character conversion, then you need -to override {@link #isBidiEnabled() isBidiEnabled()} to return true -and {@link #getSelectionValue(java.lang.Object, int) getSelectionValue(Object, int)}. - -

    In either case, the overriding method should call the superclass's -method of the same name and perform extra processing only when null -is returned: - -

    -    public Object getSelectionValue(Object selectionID)
    -    throws ResourceException
    -    {
    -        // Call the superclass first.
    -        Object value = super.getSelectionValue(selectionID);
    -        if (value == null) {
    -
    - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); -
    - // Go get the selection value. - value = ...; - } - return value; - } -
    - -

    Extending this class to override the mechanism for setting -selection values works in a similar fashion. If you do not plan to support bidirectional character -conversion, then you only need to override -{@link #setSelectionValue(java.lang.Object, java.lang.Object) setSelectionValue(Object, Object)}. -If you do plan to support bidirectional character conversion, then you need -to override {@link #isBidiEnabled() isBidiEnabled()} to return true -and {@link #setSelectionValue(java.lang.Object, java.lang.Object, int) setSelectionValue(Object, Object, int)}. - -

    Again, the overriding method should call the superclass's -method of the same name and then perform extra processing: - -

    -    public void setSelectionValue(Object selectionID, Object value)
    -    throws ResourceException
    -    {
    -        // Call the superclass first.
    -        super.setSelectionValue(selectionID, values);
    -
    - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); -
    - // Set the selection value. - // ... - } -
    - -@see Resource -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public abstract class ResourceList -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private ResourceMetaDataTable attributes_; - private String currentLevel_ = null; - private int defaultBidiStringType_ = -1; // @A2A - private Presentation presentation_; - private ResourceMetaDataTable selections_; - private Hashtable selectionValues_ = new Hashtable(); - private ResourceMetaDataTable sorts_; - private Hashtable sortOrders_ = new Hashtable(); - private Object[] sortValue_ = new Object[0]; - private AS400 system_ = null; - - private transient boolean complete_ = false; - private transient boolean connectionEstablished_ = false; - private transient boolean inError_ = false; - private transient long length_ = -1; - private transient boolean open_ = false; - private transient boolean propertiesFrozen_ = false; - - private transient Vector activeStatusListeners_; - private transient PropertyChangeSupport propertyChangeSupport_; - private transient Vector resourceListListeners_; - private transient VetoableChangeSupport vetoableChangeSupport_; - - - -/** -Constructs a ResourceList object. -**/ - public ResourceList() - { - presentation_ = new Presentation(); - attributes_ = new ResourceMetaDataTable(); - selections_ = new ResourceMetaDataTable(); - sorts_ = new ResourceMetaDataTable(); - - initializeTransient(); - } - - - -/** -Constructs a ResourceList object. - -@param presentation The presentation. -@param attributeMetaData The attribute meta data, or null if not applicable. -@param selectionMetaData The selection meta data, or null if not applicable. -@param sortMetaData The sort meta data, or null if not applicable. -**/ - public ResourceList(Presentation presentation, - ResourceMetaData[] attributeMetaData, - ResourceMetaData[] selectionMetaData, - ResourceMetaData[] sortMetaData) - { - if (presentation == null) - throw new NullPointerException("presentation"); - - presentation_ = presentation; - attributes_ = new ResourceMetaDataTable(attributeMetaData); - selections_ = new ResourceMetaDataTable(selectionMetaData); - sorts_ = new ResourceMetaDataTable(sortMetaData); - - initializeTransient(); - } - - - -/** -Constructs a ResourceList object. - -@param presentation The presentation. -@param attributes The attribute meta data, or null if not applicable. -@param selections The selection meta data, or null if not applicable. -@param sorts The sort meta data, or null if not applicable. -**/ -// -// Design note: This method is not public, since it exposes ResourceMetaDataTable, -// which is not a public class. This is intended as a "back-door" -// just for use by the BufferedResourceList class. -// - ResourceList(Presentation presentation, - ResourceMetaDataTable attributes, - ResourceMetaDataTable selections, - ResourceMetaDataTable sorts) - { - if (presentation == null) - throw new NullPointerException("presentation"); - - presentation_ = presentation; - attributes_ = (attributes == null) ? new ResourceMetaDataTable() : attributes; - selections_ = (selections == null) ? new ResourceMetaDataTable() : selections; - sorts_ = (sorts == null) ? new ResourceMetaDataTable() : sorts; - - initializeTransient(); - } - - - -/** -Adds an ActiveStatusListener. - -@param listener The listener. -**/ - public void addActiveStatusListener(ActiveStatusListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - activeStatusListeners_.addElement(listener); - } - - - -/** -Adds a PropertyChangeListener. The specified PropertyChangeListener's -propertyChange() method will be called each time the value of -any bound property is changed. - -@param listener The listener. -*/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - propertyChangeSupport_.addPropertyChangeListener(listener); - } - - - -/** -Adds a ResourceListListener. - -@param listener The listener. -*/ - public void addResourceListListener(ResourceListListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - resourceListListeners_.addElement(listener); - } - - - -/** -Adds a VetoableChangeListener. The specified VetoableChangeListener's -vetoableChange() method will be called each time the value of -any constrained property is changed. - -@param listener The listener. -*/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - vetoableChangeSupport_.addVetoableChangeListener(listener); - } - - - -/** -Indicates if properties are frozen. If this is true, property -changes should not be made. Properties are not the same thing -as attributes. Properties are basic pieces of information -which must be set to make the object usable, such as the system -or other properties that identify the resource on the system. - -@return true if properties are frozen, false otherwise. -**/ - protected boolean arePropertiesFrozen() - { - return propertiesFrozen_; - } - - - -/** -Closes the list. No further resources can be loaded. The list -must be closed in order to clean up resources appropriately. -This method has no effect if the list is already closed. -This method fires a listClosed() ResourceListEvent. - -@exception ResourceException If an error occurs. -**/ - public void close() - throws ResourceException - { - if (open_) { - synchronized(this) { - complete_ = false; - length_ = -1; - open_ = false; - inError_ = false; - } - - fireListClosed(); - } - } - - - -/** -Establishes the connection to the system, if any. Subclasses can override -this method and put all connection initialization code here. -It is assumed that all properties have been set when this -method is called. Any subclass that overrides this method -should include a call to super.establishConnection(). - -@exception ResourceException If an error occurs. -**/ - protected void establishConnection() - throws ResourceException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, "Establishing a connection for " + this + "."); - - // Validate if we can establish the connection. - if (system_ == null) - throw new ExtendedIllegalStateException("system", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - if (!propertiesFrozen_) - freezeProperties(); - connectionEstablished_ = true; - } - - - - -/** -Closes the list when the list is garbage collected. - -@exception Throwable If an error occurs. -**/ -/* @A1D - Removed this because it causes problems when the AS400 object - gets disconnected or swapped before this object gets garbage - collector. We leave it to the caller to call close(). - - protected void finalize() - throws Throwable - { - super.finalize(); - close(); - } -*/ - - - -/** -Fires a busy active status event. This indicates that a potentially -long-running operation has started. -**/ - protected void fireBusy() - { - ActiveStatusEvent event = new ActiveStatusEvent(this, ActiveStatusEvent.BUSY); - Vector temp = (Vector)activeStatusListeners_.clone(); - Enumeration list = temp.elements(); - while(list.hasMoreElements()) - ((ActiveStatusListener)list.nextElement()).busy(event); - } - - -/** -Fires a idle active status event. This indicates that a potentially -long-running operation has ended. -**/ - protected void fireIdle() - { - ActiveStatusEvent event = new ActiveStatusEvent(this, ActiveStatusEvent.IDLE); - Vector temp = (Vector)activeStatusListeners_.clone(); - Enumeration list = temp.elements(); - while(list.hasMoreElements()) - ((ActiveStatusListener)list.nextElement()).idle(event); - } - - -/** -Fires a lengthChanged() resource list event. - -@param length The length. -**/ - protected void fireLengthChanged(long length) - { - // Take note of the change. - length_ = length; - - // Fire the event. - ResourceListEvent event = new ResourceListEvent(this, ResourceListEvent.LENGTH_CHANGED, length); - Vector temp = (Vector)resourceListListeners_.clone(); - Enumeration list = temp.elements(); - while(list.hasMoreElements()) - ((ResourceListListener)list.nextElement()).lengthChanged(event); - } - - - -/** -Fires a listClosed() ResourceListEvent. -**/ - protected void fireListClosed() - { - ResourceListEvent event = new ResourceListEvent(this, ResourceListEvent.LIST_CLOSED); - Vector temp = (Vector)resourceListListeners_.clone(); - Enumeration list = temp.elements(); - while(list.hasMoreElements()) - ((ResourceListListener)list.nextElement()).listClosed(event); - } - - - -/** -Fires a listCompleted() ResourceListEvent. -**/ - protected void fireListCompleted() - { - // Take note of the completion. - complete_ = true; - - // Fire the event. - ResourceListEvent event = new ResourceListEvent(this, ResourceListEvent.LIST_COMPLETED); - Vector temp = (Vector)resourceListListeners_.clone(); - Enumeration list = temp.elements(); - while(list.hasMoreElements()) - ((ResourceListListener)list.nextElement()).listCompleted(event); - } - - - -/** -Fires a listInError() ResourceListEvent. -**/ - protected void fireListInError() - { - // Take note. - inError_ = true; - - // Fire the event. - ResourceListEvent event = new ResourceListEvent(this, ResourceListEvent.LIST_IN_ERROR); - Vector temp = (Vector)resourceListListeners_.clone(); - Enumeration list = temp.elements(); - while(list.hasMoreElements()) - ((ResourceListListener)list.nextElement()).listInError(event); - } - - - -/** -Fires a listOpened() ResourceListEvent. -**/ - protected void fireListOpened() - { - ResourceListEvent event = new ResourceListEvent(this, ResourceListEvent.LIST_OPENED); - Vector temp = (Vector)resourceListListeners_.clone(); - Enumeration list = temp.elements(); - while(list.hasMoreElements()) - ((ResourceListListener)list.nextElement()).listOpened(event); - } - - - -/** -Fires a property change event. - -@param propertyName The property name. -@param oldValue The old value. -@param newValue The new value. -**/ - protected void firePropertyChange(String propertyName, - Object oldValue, - Object newValue) - { - propertyChangeSupport_.firePropertyChange(propertyName, oldValue, newValue); - } - - - - -/** -Fires a resourceAdded() ResourceListEvent. - -@param resource The resource. -@param index The index. -**/ - protected void fireResourceAdded(Resource resource, long index) - { - // Add the new resource to the buffer. - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Resource " + resource + " (index=" + index + ") loaded by list " + this + "."); - - // Fire the event. - ResourceListEvent event = new ResourceListEvent(this, ResourceListEvent.RESOURCE_ADDED, resource, index); - Vector temp = (Vector)resourceListListeners_.clone(); - Enumeration list = temp.elements(); - while(list.hasMoreElements()) - ((ResourceListListener)list.nextElement()).resourceAdded(event); - } - - - -/** -Fires a vetoable change event. - -@param propertyName The property name. -@param oldValue The old value. -@param newValue The new value. - -@exception PropertyVetoException If the property change is vetoed. -**/ - protected void fireVetoableChange(String propertyName, - Object oldValue, - Object newValue) - throws PropertyVetoException - { - vetoableChangeSupport_.fireVetoableChange(propertyName, oldValue, newValue); - } - - - -/** -Freezes any property changes. After this is called, property -changes should not be made. Properties are not the same thing -as attributes. Properties are basic pieces of information -which must be set to make the object usable, such as the system -or other properties that identify the resource on the system. - -

    Subclasses can override this method and put initialization -code here that is dependent on properties being set. -Any subclass that overrides this method should include a -call to super.freezeProperties(). - -@exception ResourceException If an error occurs. -**/ -// -// Implementation notes: -// -// 1. This is separate from establishConnection() because -// there are times when we want to freeze the properties -// without incurring the performance hit of setting up -// the connection. -// - protected void freezeProperties() - throws ResourceException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, "Freezing properties for " + this + "."); - - propertiesFrozen_ = true; - } - - - -/** -Returns the attribute meta data for a specific attribute of a -resource in the contents of the list. - -@param attributeID Identifies the attribute. -@return The attribute meta data. -**/ - public ResourceMetaData getAttributeMetaData(Object attributeID) - { - return attributes_.getMetaData(attributeID); - } - - - -/** -Returns the attribute meta data for the resources in the contents -of the list. If there is more than one type of resource in the list, -this returns the union of all resources' attributes. The array -will contain an element for every supported attribute. - -@return The attribute meta data. The array has zero elements if - there are no attributes. -**/ - public ResourceMetaData[] getAttributeMetaData() - { - return attributes_.getMetaData(getCurrentLevel()); - } - - - -/** -Returns the current level. This is the system VRM, or -"" if the system has not been set. - -@return The current level. -**/ - String getCurrentLevel() - { - if (system_ == null) - return ""; - if (currentLevel_ != null) - return currentLevel_; - - try { - currentLevel_ = ResourceLevel.vrmToLevel(system_.getVRM()); - } - catch(Exception e) { - return ""; - } - return currentLevel_; - } - - - -// @A2A - int getDefaultBidiStringType() - { - if (system_ == null) - return BidiStringType.DEFAULT; - if (defaultBidiStringType_ == -1) - defaultBidiStringType_ = AS400BidiTransform.getStringType((char)system_.getCcsid()); - return defaultBidiStringType_; - } - - - -/** -Returns the total number of resources in the list. This length -reflects the most accurate estimate known. In many cases the -length is not known until the list is completely loaded. - -

    This will implicitly open the list if needed. - -@return The total number of resources in the list. - -@exception ResourceException If an error occurs. -**/ -// -// Design note: -// -// * I would have rather named this getLength(), but some previously -// existing components being retrofitted into this framework already -// declared a getLength() method that returns an int. Replacing that -// with this would cause customers to get compile errors in existing -// code. -// - public long getListLength() - throws ResourceException - { - if (! open_) - open(); - - return length_; - } - - - -/** -Returns the presentation information. - -@return The presentation information. -**/ - public Presentation getPresentation() - { - return presentation_; - } - - - -/** -Returns the selection meta data for a specific selection. - -@param selectionID Identifies the selection. -@return The selection meta data. -**/ - public ResourceMetaData getSelectionMetaData(Object selectionID) - { - return selections_.getMetaData(selectionID); - } - - - -/** -Returns the selection meta data. The array will contain an element -for every supported selection. - -@return The selection meta data. The array has zero elements if - there are no selections. -**/ - public ResourceMetaData[] getSelectionMetaData() - { - return selections_.getMetaData(getCurrentLevel()); - } - - - -// @A2C -/** -Returns the current value of a selection. - -@param selectionID Identifies the selection. -@return The selection value, or null if the selection - value has not been set. - -@exception ResourceException If an error occurs. - -@see Subclass notes -**/ - public Object getSelectionValue(Object selectionID) - throws ResourceException - { - // If this resource is bidi enabled, then punt to the bidi flavor - // of getSelectionValue(). This will ensure that the subclass's - // bidi-enabled getSelectionValue() method gets called even though - // no string type was passed - - and therefore the subclass only - // needs to override the bidi-enabled getSelectionValue(). - if (isBidiEnabled()) - return getSelectionValue(selectionID, getDefaultBidiStringType()); - else - return getSelectionValueImplementation(selectionID); - } - - - -// @A2A -/** -Returns the current value of a selection. - -@param selectionID Identifies the selection. -@param bidiStringType The bidi string type as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. -@return The selection value, or null if the selection - value has not been set. - -@exception ResourceException If an error occurs. - -@see Subclass notes -**/ - public Object getSelectionValue(Object selectionID, int bidiStringType) - throws ResourceException - { - // If this resource is not bidi enabled, then punt to the non-bidi flavor - // of getSelectionValue(). This will ensure that the subclass's - // non-bidi-enabled getSelectionValue() method gets called even though - // a string type was passed - - and therefore the subclass only - // needs to override the non-bidi-enabled getSelectionValue(). - if (!isBidiEnabled()) - return getSelectionValue(selectionID); - else { - // In the default implementation, we don't use the string type, - // since there is no conversion being done. - return getSelectionValueImplementation(selectionID); - } - } - - - -// @A2A - private Object getSelectionValueImplementation(Object selectionID) - throws ResourceException - { - selections_.validateID(selectionID); - Object value = selectionValues_.get(selectionID); - if (value == null) - value = selections_.getMetaData(selectionID).getDefaultValue(); - return value; - } - - - -/** -Returns the sort meta data for a specific sort. - -@param sortID Identifies the sort. -@return The sort meta data. -**/ - public ResourceMetaData getSortMetaData(Object sortID) - { - return sorts_.getMetaData(sortID); - } - - - -/** -Returns the sort meta data. The array will contain an element -for every supported sort. - -@return The sort meta data. The array has zero elements if - there are no sorts. -**/ - public ResourceMetaData[] getSortMetaData() - { - return sorts_.getMetaData(getCurrentLevel()); - } - - - -/** -Returns the current order for a particular sort. - -@param sortID The sort ID. -@return true for ascending, false for descending. - -@exception ResourceException If an error occurs. -**/ - public boolean getSortOrder(Object sortID) - throws ResourceException - { - sorts_.validateID(sortID); - if (sortOrders_.containsKey(sortID)) - return ((Boolean)sortOrders_.get(sortID)).booleanValue(); - else - return true; - } - - - -/** -Returns the current value of the sort. - -@return The array of sort IDs. - -@exception ResourceException If an error occurs. -**/ - public Object[] getSortValue() - throws ResourceException - { - return sortValue_; - } - - - -/** -Returns the system. - -@return The system. -**/ - public AS400 getSystem() - { - return system_; - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient() - { - activeStatusListeners_ = new Vector(); - propertyChangeSupport_ = new PropertyChangeSupport(this); - resourceListListeners_ = new Vector(); - vetoableChangeSupport_ = new VetoableChangeSupport(this); - } - - - -// @A2A -/** -Indicates if this resource is enabled for bidirectional character conversion. -The default implementation always returns false. Subclasses that are enabled -for bidirectional character conversion should override this method to return -true. - -@return Always false. - -@see Subclass notes -**/ - protected boolean isBidiEnabled() - { - return false; - } - - - -/** -Indicates if the list is completely loaded. A list is not considered to -be complete until all of its resources are loaded. Implementations will -differ as to when the list is completely loaded. For example, some -implementations may load all resources in a background thread, others -may load resources on demand. - -@return true if the list is completely loaded, false if it is not - completely loaded, or if the list is not open. -**/ - public boolean isComplete() - { - return complete_; - } - - -/** -Indicates if a connection to the system is established. This means that the -resource is in a state where certain properties can no longer be -changed. - -@return true if a connection is established, false otherwise. -**/ - protected boolean isConnectionEstablished() - { - return connectionEstablished_; - } - - - -/** -Indicates if the list has not been completely loaded due -to an error. If an unrecoverable error occurs while loading -the resources, then the list is in error and no further resources -are loaded. - -@return true if the list has not been completely loaded - due to an error, false if the list is not in error - or if the list is not open. -**/ - public boolean isInError() - { - return inError_; - } - - - -/** -Indicates if the list is open. - -@return true if the list is open, false if the list is not open. -**/ - public boolean isOpen() - { - return open_; - } - - - -/** -Indicates if the resource is available. This means that the -resource has been loaded. - -@param index The index. -@return true if the resource is available, - false if the resource is not available - or the list is not open. - -@exception ResourceException If an error occurs. -**/ - public boolean isResourceAvailable(long index) - throws ResourceException - { - if (index < 0) - throw new ExtendedIllegalArgumentException("index", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - // We don't need to check an upper bounds, if they pass too high, - // we just let it go. This allows them to just say they want at most 50... - // even if they don't know the length ahead of time. - - // Otherwise, check with the loader to see - // if it has loaded that part yet. - return (index < length_); - } - - - -/** -Opens the list. The list must be open in order to -perform most operations. This method has no effect -if the list is already opened. - -@exception ResourceException If an error occurs. -**/ - public void open() - throws ResourceException - { - if (open_) - return; - - synchronized(this) { - - complete_ = false; - inError_ = false; - open_ = true; - length_ = 0; - - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Opening list " + this + "."); - - fireListOpened(); - } - } - - - -/** -Deserializes the resource list. -**/ - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient (); - } - - - -/** -Refreshes the contents of the list. - -

    This will implicitly open the list if needed. - -@exception ResourceException If an error occurs. -**/ - public void refreshContents() - throws ResourceException - { - synchronized(this) { - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Refreshing list contents for " + this + "."); - - if (!open_) - open(); - } - } - - - -/** -Refreshes the status of the list. The status includes -the length and whether the list is completed or in error. -If the list is complete, this method has no effect. - -

    This method does not refresh the contents of the list. Use -{@link #refreshContents refreshContents()} to refresh -the contents of the list. - -

    This will implicitly open the list if needed. - -@exception ResourceException If an error occurs. -**/ - public void refreshStatus() - throws ResourceException - { - if (! open_) - open(); - - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Refreshing status for list " + this + "."); - - } - - -/** -Removes an ActiveStatusListener. - -@param listener The listener. -**/ - public void removeActiveStatusListener(ActiveStatusListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - activeStatusListeners_.removeElement(listener); - } - - - -/** -Removes a PropertyChangeListener. - -@param listener The listener. -*/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - propertyChangeSupport_.removePropertyChangeListener(listener); - } - - -/** -Removes a ResourceListListener. - -@param listener The listener. -*/ - public void removeResourceListListener(ResourceListListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - resourceListListeners_.removeElement(listener); - } - - - -/** -Removes a VetoableChangeListener. - -@param listener The listener. -*/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - vetoableChangeSupport_.removeVetoableChangeListener(listener); - } - - - -/** -Returns the resource specified by the index. - -

    This will implicitly open the list if needed. - -@param index The index. -@return The resource specified by the index, or null - if the resource is not yet available. - -@exception ResourceException If an error occurs. -**/ - public Resource resourceAt(long index) - throws ResourceException - { - if (! open_) - open(); - if ((index < 0) || ((complete_) && (index >= length_))) - throw new ExtendedIllegalArgumentException("index", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - return null; - } - - -/** -Returns an Enumeration of the {@link com.ibm.as400.resource.Resource Resource} -objects. This may be a more convenient mechanism to iterate through -the Resource objects, and is provided as an alternative to using the -other methods in this class. - -

    If the contents of the ResourceList are changed while the -Enumeration is in use, the enumerated Resource objects -may not be consistent. - -@return The Enumeration of Resource objects. - -@exception ResourceException If an error occurs. -**/ - public Enumeration resources() - throws ResourceException - { - return new ResourceListEnumeration(this); - } - - - -/** -Sets the attribute meta data. - -@param attributeMetaData The attribute meta data. -**/ - protected void setAttributeMetaData(ResourceMetaData[] attributeMetaData) - { - if(attributeMetaData == null) - throw new NullPointerException("attributeMetaData"); - - attributes_ = new ResourceMetaDataTable(attributeMetaData); - } - - - - -// @A2C -/** -Sets the current value of a selection. The changed selection -value will take effect the next time the list is opened -or refreshed. - -@param selectionID Identifies the selection. -@param value The selection value, or null to remove - the selection. - -@exception ResourceException If an error occurs. - -@see Subclass notes -**/ - public void setSelectionValue(Object selectionID, Object value) - throws ResourceException - { - // If this resource is bidi enabled, then punt to the bidi flavor - // of setSelectionValue(). This will ensure that the subclass's - // bidi-enabled setSelectionValue() method gets called even though - // no string type was passed - - and therefore the subclass only - // needs to override the bidi-enabled setSelectionValue(). - if (isBidiEnabled()) - setSelectionValue(selectionID, value, getDefaultBidiStringType()); - else - setSelectionValueImplementation(selectionID, value); - } - - - -// @A2A -/** -Sets the current value of a selection. The changed selection -value will take effect the next time the list is opened -or refreshed. - -@param selectionID Identifies the selection. -@param value The selection value, or null to remove - the selection. -@param bidiStringType The bidi string type as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. - -@exception ResourceException If an error occurs. - -@see Subclass notes -**/ - public void setSelectionValue(Object selectionID, Object value, int bidiStringType) - throws ResourceException - { - // If this resource is not bidi enabled, then punt to the non-bidi flavor - // of setSelectionValue(). This will ensure that the subclass's - // non-bidi-enabled setSelectionValue() method gets called even though - // a string type was passed - - and therefore the subclass only - // needs to override the non-bidi-enabled setSelectionValue(). - if (!isBidiEnabled()) - setSelectionValue(selectionID, value); - else { - // In the default implementation, we don't use the string type, - // since there is no conversion being done. - setSelectionValueImplementation(selectionID, value); - } - } - - - - private void setSelectionValueImplementation(Object selectionID, Object value) - throws ResourceException - { - ResourceMetaData selectionMetaData = selections_.validateID(selectionID); - if (value == null) - selectionValues_.remove(selectionID); - else - selectionValues_.put(selectionID, selectionMetaData.validateValue(value)); - } - - - -/** -Sets the presentation. - -@param presentation The presentation. -**/ - protected void setPresentation(Presentation presentation) - { - if(presentation == null) - throw new NullPointerException("presentation"); - - presentation_ = presentation; - } - - - - -/** -Sets the order for a sort. The changed sort -order will take effect the next time the list is opened -or refreshed. - -@param sortID The sort ID. -@param sortOrder true for ascending, false for descending. - -@exception ResourceException If an error occurs. -**/ - public void setSortOrder(Object sortID, boolean sortOrder) - throws ResourceException - { - sorts_.validateID(sortID); - sortOrders_.put(sortID, sortOrder ? Boolean.TRUE : Boolean.FALSE); - } - - - -/** -Sets the current value of the sort. The changed sort -value will take effect the next time the list is opened -or refreshed. - -@param sortValue An array of sort IDs. - -@exception ResourceException If an error occurs. -**/ - public void setSortValue(Object[] sortValue) - throws ResourceException - { - if (sortValue == null) - throw new NullPointerException("sortValue"); - sorts_.validateIDs(sortValue); - sortValue_ = sortValue; - } - - -/** -Sets the system. This cannot be changed -if the object has established a connection -to the system. - -@param system The system. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setSystem(AS400 system) - throws PropertyVetoException - { - if (arePropertiesFrozen()) - throw new ExtendedIllegalStateException("propertiesFrozen", ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - if (system == null) - throw new NullPointerException("system"); - - AS400 oldValue = system_; - fireVetoableChange("system", oldValue, system); - system_ = system; - firePropertyChange("system", oldValue, system); - } - - - - -/** -Returns the presentation full name, if any. - -@return The presentation full name, if any. -**/ - public String toString() - { - if (presentation_ == null) - return super.toString(); - else { - String fullName = presentation_.getFullName(); - if (fullName.length() > 0) - return fullName; - else - return super.toString(); - } - } - - - -/** -Waits until the list is completely loaded. - -

    This will implicitly open the list if needed. - -@exception ResourceException If an error occurs. -**/ - public void waitForComplete() - throws ResourceException - { - if (! open_) - open(); - - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Waiting for the list to complete."); - } - - - -/** -Waits until the resource is available or the list is -complete. - -

    This will implicitly open the list if needed. - -@param index The index. - -@exception ResourceException If an error occurs. -**/ - public void waitForResource(long index) - throws ResourceException - { - if (index < 0) - throw new ExtendedIllegalArgumentException("index", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - // We don't need to check an upper bounds, if they pass too high, - // we just let it go. This allows them to just say they want at most 50... - // even if they don't know the length ahead of time. - - if (! open_) - open(); - - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Waiting for resource " + index + " to become available."); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ResourceListAdapter.java b/cvsroot/src/com/ibm/as400/resource/ResourceListAdapter.java deleted file mode 100644 index 6ade32713..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ResourceListAdapter.java +++ /dev/null @@ -1,85 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListAdapter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - - - -/** -The ResourceListAdapter class is a default implementation of the -{@link com.ibm.as400.resource.ResourceListListener ResourceListListener} -interface. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class ResourceListAdapter -implements ResourceListListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Invoked when the length changes. - -@param event The event. -**/ - public void lengthChanged(ResourceListEvent event) { } - - - -/** -Invoked when the list is closed. - -@param event The event. -**/ - public void listClosed(ResourceListEvent event) { } - - - -/** -Invoked when the list is completely loaded. - -@param event The event. -**/ - public void listCompleted(ResourceListEvent event) { } - - - -/** -Invoked when the list is not completely loaded due to an error. - -@param event The event. -**/ - public void listInError(ResourceListEvent event) { } - - - -/** -Invoked when the list is opened. - -@param event The event. -**/ - public void listOpened(ResourceListEvent event) { } - - - -/** -Invoked when a resource is added to the list. - -@param event The event. -**/ - public void resourceAdded(ResourceListEvent event) { } - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ResourceListBeanInfo.java b/cvsroot/src/com/ibm/as400/resource/ResourceListBeanInfo.java deleted file mode 100644 index 6ea00e6b0..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ResourceListBeanInfo.java +++ /dev/null @@ -1,124 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.Trace; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; -import java.util.ResourceBundle; - - -/** -Represents the bean information for ResourceList objects. -**/ -class ResourceListBeanInfo -extends SimpleBeanInfo -{ - // Private data. - private static final Class beanClass_ = ResourceList.class; - - private static EventSetDescriptor[] eventSetDescriptors_; - private static PropertyDescriptor[] propertyDescriptors_; - private static ResourceBundle resourceBundle_; - - - -/** -Static initializer. -**/ - static - { - try - { - // Set up the resource bundle. - resourceBundle_ = ResourceBundle.getBundle("com.ibm.as400.resource.ResourceMRI"); - - // Set up the property descriptors. - PropertyDescriptor system = new PropertyDescriptor("system", beanClass_); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(resourceBundle_.getString("PROPERTY_SYSTEM_NAME")); - system.setShortDescription(resourceBundle_.getString("PROPERTY_SYSTEM_DESCRIPTION")); - - propertyDescriptors_ = new PropertyDescriptor[] { system }; - - // Set up the event set descriptors. - EventSetDescriptor propertyChange = new EventSetDescriptor(beanClass_, "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName(resourceBundle_.getString("EVENT_PROPERTY_CHANGE_NAME")); - propertyChange.setShortDescription(resourceBundle_.getString("EVENT_PROPERTY_CHANGE_DESCRIPTION")); - - EventSetDescriptor resourceList = new EventSetDescriptor(beanClass_, "resourceList", ResourceListListener.class, - new String[] { "lengthChanged", "listClosed", "listCompleted", "listInError", "listOpened", "resourceAdded" }, - "addResourceListListener", - "removeResourceListListener"); - resourceList.setDisplayName(resourceBundle_.getString("EVENT_RESOURCE_LIST_NAME")); - resourceList.setShortDescription(resourceBundle_.getString("EVENT_RESOURCE_LIST_DESCRIPTION")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor(beanClass_, "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName(resourceBundle_.getString("EVENT_VETOABLE_CHANGE_NAME")); - vetoableChange.setShortDescription(resourceBundle_.getString("EVENT_VETOABLE_CHANGE_DESCRIPTION")); - - eventSetDescriptors_ = new EventSetDescriptor[] { propertyChange, resourceList, vetoableChange }; - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error while loading bean info", e); - throw new Error(e.toString()); - } - } - - - -/** -Returns the default event index. - -@return The default event index. -**/ - public int getDefaultEventIndex() - { - return 0; - } - - - -/** -Returns the event set descriptors. - -@return The event set descriptors. -**/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return eventSetDescriptors_; - } - - - -/** -Returns the property descriptors. - -@return The property descriptors. -**/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return propertyDescriptors_; - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/ResourceListEnumeration.java b/cvsroot/src/com/ibm/as400/resource/ResourceListEnumeration.java deleted file mode 100644 index 0c26b3e3d..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ResourceListEnumeration.java +++ /dev/null @@ -1,161 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListEnumeration.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.Trace; -import java.util.Enumeration; -import java.util.NoSuchElementException; - - - -/** -The ResourceListEnumeration class enumerates the -{@link com.ibm.as400.resource.Resource Resource} objects in a -{@link com.ibm.as400.resource.ResourceList ResourceList}. -This may be a more convenient mechanism to iterate through -the Resource objects in a ResourceList, and is provided as -an alternative to using the methods defined in ResourceList. - -

    If the contents of the ResourceList are changed while the -ResourceListEnumeration is in use, the enumerated Resource objects -may not be consistent. - -

    -// Create an RUserList object to represent a list of users.
    -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -RUserList userList = new RUserList(system);
    -
    -// Create a ResourceListEnumeration to iterate through -// the users in the list. -ResourceListEnumeration list = new ResourceListEnumeration(userList); -while(list.hasMoreElements()) -{ - RUser user = (RUser)list.nextElement(); - System.out.println(user.getAttributeValue(RUser.USER_PROFILE_NAME); - System.out.println(user.getAttributeValue(RUser.TEXT_DESCRIPTION); - System.out.println(); -} -
    -**/ -class ResourceListEnumeration -implements Enumeration -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private boolean done_; - private long index_; - private ResourceList list_; - - - -/** -Constructs the ResourceListEnumeration object. - -@param list The resource list. - -@exception ResourceException If an error occurs. -**/ - public ResourceListEnumeration(ResourceList list) - throws ResourceException - { - if (list == null) - throw new NullPointerException("list"); - - done_ = false; - index_ = 0; - list_ = list; - - // We should not automatically refresh since that is @A1C - // expensive. @A1C - if (! list_.isOpen()) // @A1C - // @A1D list_.refreshContents(); - // @A1D else - list_.open(); - } - - - -/** -Indicates if there are more elements. - -@return true if there are more elements, false otherwise. -**/ - public boolean hasMoreElements() - { - if (done_) - return false; - - try { - - // If the next index is less then the current length, true. - if (index_ < list_.getListLength()) - return true; - - // If the list is complete... then we are done. - if (list_.isComplete()) { - done_ = true; - return false; - } - - // Otherwise, lets wait for the index and try again. - else { - list_.waitForResource(index_); - if (index_ < list_.getListLength()) - return true; - else { - done_ = true; - list_.close(); - return false; - } - } - } - catch(ResourceException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error when enumerating a resource list", e); - done_ = true; - return false; - } - } - - - -/** -Returns the next {@link com.ibm.as400.resource.Resource Resource} -in the list. - -@return The next Resource in the list. -**/ - public Object nextElement() - { - if (done_) - throw new NoSuchElementException(); - - try { - return list_.resourceAt(index_++); - } - catch(ResourceException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error when enumerating a resource list", e); - done_ = true; - throw new NoSuchElementException(); - } - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ResourceListEvent.java b/cvsroot/src/com/ibm/as400/resource/ResourceListEvent.java deleted file mode 100644 index 841556cb5..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ResourceListEvent.java +++ /dev/null @@ -1,208 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.util.EventObject; - - - -/** -The ResourceListEvent class represents a resource list event. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class ResourceListEvent -extends EventObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private int eventID_ = -1; - private long index_ = -1; - private long length_ = -1; - private Resource resource_ = null; - - - -/** -Event ID indicating that the length of the list changed. -**/ - public static final int LENGTH_CHANGED = 1; - - - -/** -Event ID indicating that the list is closed. -**/ - public static final int LIST_CLOSED = 2; - - - -/** -Event ID indicating that the list is completely loaded. -**/ - public static final int LIST_COMPLETED = 3; - - - -/** -Event ID indicating that the list is not completely -loaded due to an error. -**/ - public static final int LIST_IN_ERROR = 4; - - - -/** -Event ID indicating that the list is opened. -**/ - public static final int LIST_OPENED = 5; - - - -/** -Event ID indicating that a resource is added to the list. -**/ - public static final int RESOURCE_ADDED = 6; - - - - private static final int FIRST_EVENT_ID_ = LENGTH_CHANGED; - private static final int LAST_EVENT_ID_ = RESOURCE_ADDED; - - - -/** -Constructs a ResourceListEvent object. - -@param source The source. -@param eventID The event ID. -**/ - public ResourceListEvent(Object source, int eventID) - { - super(source); - validateEventID(eventID); - eventID_ = eventID; - } - - - -/** -Constructs a ResourceListEvent object. - -@param source The source. -@param eventID The event ID. -@param resource The associated resource, or null if none. -@param index The index of the associated resource within the list. -**/ - public ResourceListEvent(Object source, int eventID, Resource resource, long index) - { - super(source); - validateEventID(eventID); - eventID_ = eventID; - resource_ = resource; - index_ = index; - } - - - -/** -Constructs a ResourceListEvent object. - -@param source The source. -@param eventID The event ID. -@param length The list length. -**/ - public ResourceListEvent(Object source, int eventID, long length) - { - super(source); - validateEventID(eventID); - eventID_ = eventID; - length_ = length; - } - - - -/** -Returns the event ID. - -@return The event ID. -**/ - public int getID() - { - return eventID_; - } - - - -/** -Returns the index of the associated resource within the list. - -@return The index of the associated resource within the list, - or -1 if there is no associated resource. -**/ - public long getIndex() - { - return index_; - } - - - -/** -Returns the length of the list. - -@return The length the list, or -1 if the length of the list is - not relevant. -**/ - public long getLength() - { - return length_; - } - - - -/** -Returns the associated resource. - -@return The associated resource, or null if none. -**/ - public Resource getResource() - { - return resource_; - } - - - -/** -Validates the event ID. - -@param eventID The event ID. -**/ - private void validateEventID(int eventID) - { - if ((eventID < FIRST_EVENT_ID_) || (eventID > LAST_EVENT_ID_)) - throw new ExtendedIllegalArgumentException("eventID", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ResourceListListener.java b/cvsroot/src/com/ibm/as400/resource/ResourceListListener.java deleted file mode 100644 index 72f7f0746..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ResourceListListener.java +++ /dev/null @@ -1,83 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import java.util.EventListener; - - - -/** -The ResourceListListener represents a listener for ResourceListEvents. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public interface ResourceListListener -extends EventListener -{ - - - -/** -Invoked when the length changes. - -@param event The event. -**/ - public abstract void lengthChanged(ResourceListEvent event); - - - -/** -Invoked when the list is closed. - -@param event The event. -**/ - public abstract void listClosed(ResourceListEvent event); - - - -/** -Invoked when the list is completely loaded. - -@param event The event. -**/ - public abstract void listCompleted(ResourceListEvent event); - - - -/** -Invoked when the list is not completely loaded due to an error. - -@param event The event. -**/ - public abstract void listInError(ResourceListEvent event); - - - -/** -Invoked when the list is opened. - -@param event The event. -**/ - public abstract void listOpened(ResourceListEvent event); - - - -/** -Invoked when a resource is added to the list. - -@param event The event. -**/ - public abstract void resourceAdded(ResourceListEvent event); - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ResourceListener.java b/cvsroot/src/com/ibm/as400/resource/ResourceListener.java deleted file mode 100644 index cdfedcd6a..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ResourceListener.java +++ /dev/null @@ -1,84 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import java.util.EventListener; - - - -/** -The ResourceListener represents a listener for ResourceEvents. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public interface ResourceListener -extends EventListener -{ - - - -/** -Invoked when attribute changes are canceled. - -@param event The event. -**/ - public abstract void attributeChangesCanceled(ResourceEvent event); - - - -/** -Invoked when attribute changes are committed. - -@param event The event. -**/ - public abstract void attributeChangesCommitted(ResourceEvent event); - - - -/** -Invoked when attributes values are refreshed. - -@param event The event. -**/ - public abstract void attributeValuesRefreshed(ResourceEvent event); - - - -/** -Invoked when an attribute value is changed. - -@param event The event. -**/ - public abstract void attributeValueChanged(ResourceEvent event); - - - -/** -Invoked when an resource is created. - -@param event The event. -**/ - public abstract void resourceCreated(ResourceEvent event); - - - -/** -Invoked when an resource is deleted. - -@param event The event. -**/ - public abstract void resourceDeleted(ResourceEvent event); - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ResourceMRI.java b/cvsroot/src/com/ibm/as400/resource/ResourceMRI.java deleted file mode 100644 index 1da582f9c..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ResourceMRI.java +++ /dev/null @@ -1,921 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceMRI.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import java.util.ListResourceBundle; - - - -/** -Locale-specific objects for the IBM Toolbox for Java. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class ResourceMRI -extends ListResourceBundle -{ - // NLS_MESSAGEFORMAT_NONE - // Each string is assumed NOT to be processed by the MessageFormat class. - // This means that a single quote must be coded as 1 single quote. - - // NLS_ENCODING=UTF-8 - // Instructs the translation tools to interpret the text as UTF-8. - - public Object[][] getContents() - { - return resources_; - } - - - - private final static Object[][] resources_ = { - - // #TRANNOTE Before you add a new resource, please make - // #TRANNOTE sure you are not duplicating another. The - // #TRANNOTE goal is to keep the amount of translatable - // #TRANNOTE text down. - // #TRANNOTE - // #TRANNOTE NOTE TO TRANSLATORS: The format of a line of MRI - // #TRANNOTE is { "KEY", "value" }, - // #TRANNOTE - // #TRANNOTE The key must be left alone so translate only the value. - // #TRANNOTE - - - - // #TRANNOTE ##################################################### - // #TRANNOTE Bean text. - // #TRANNOTE ##################################################### - - { "EVENT_PROPERTY_CHANGE_NAME", "propertyChange" }, - { "EVENT_PROPERTY_CHANGE_DESCRIPTION", "A bound property changed." }, - { "EVENT_RESOURCE_NAME", "resource" }, - { "EVENT_RESOURCE_DESCRIPTION", "A resource event occurred." }, - { "EVENT_RESOURCE_LIST_NAME", "resourceList" }, - { "EVENT_RESOURCE_LIST_DESCRIPTION", "A resource list event occurred." }, - { "EVENT_VETOABLE_CHANGE_NAME", "vetoableChange" }, - { "EVENT_VETOABLE_CHANGE_DESCRIPTION", "A contrained property changed." }, - - { "PROPERTY_LOAD_ID_NAME", "loadID" }, - { "PROPERTY_LOAD_ID_DESCRIPTION", "The load ID." }, - { "PROPERTY_NAME_NAME", "name" }, - { "PROPERTY_NAME_DESCRIPTION", "The name." }, - { "PROPERTY_NUMBER_NAME", "number" }, - { "PROPERTY_NUMBER_DESCRIPTION", "The number." }, - { "PROPERTY_PATH_NAME", "path" }, - { "PROPERTY_PATH_DESCRIPTION", "The path." }, - { "PROPERTY_PRODUCT_ID_NAME", "productID" }, - { "PROPERTY_PRODUCT_ID_DESCRIPTION", "The product ID." }, - { "PROPERTY_PRODUCT_OPTION_NAME", "productOption" }, - { "PROPERTY_PRODUCT_OPTION_DESCRIPTION","The product option." }, - { "PROPERTY_RELEASE_LEVEL_NAME", "releaseLevel" }, - { "PROPERTY_RELEASE_LEVEL_DESCRIPTION", "The release level." }, - { "PROPERTY_SYSTEM_NAME", "system" }, - { "PROPERTY_SYSTEM_DESCRIPTION", "The system." }, - { "PROPERTY_USER_NAME", "user" }, - { "PROPERTY_USER_DESCRIPTION", "The user." }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE Exception text. - // #TRANNOTE ##################################################### - - { "EXC_ATTRIBUTES_NOT_RETURNED", "One or more attributes were not returned." }, - { "EXC_ATTRIBUTES_NOT_SET", "One or more attributes were not set." }, - { "EXC_ATTRIBUTE_READ_ONLY", "Attribute is read-only." }, // @A1a - { "EXC_MESSAGES_RETURNED", "Messages were returned." }, - { "EXC_OPERATION_FAILED", "The operation failed." }, - { "EXC_OPERATION_NOT_SUPPORTED", "The operation is not supported." }, - { "EXC_AUTHORITY_INSUFFICIENT", "User has insufficient authority." }, // @A1a - { "EXC_UNKNOWN_ERROR", "An unknown error occurred." }, - - - - // #TRANNOTE ##################################################### - // #TRANNOTE IFSFile component MRI. - // #TRANNOTE ##################################################### - { "IFSFILE_DESCRIPTION", "File" }, - - { "IFSFILE_ABSOLUTE_PATH_NAME", "Absolute Path" }, - { "IFSFILE_CANONICAL_PATH_NAME", "Canonical Path" }, - { "IFSFILE_CAN_READ_NAME", "Can Read" }, - { "IFSFILE_CAN_WRITE_NAME", "Can Write" }, - { "IFSFILE_CCSID_NAME", "CCSID" }, - { "IFSFILE_CREATED_NAME", "Created" }, - { "IFSFILE_EXISTS_NAME", "Exists" }, - { "IFSFILE_IS_ABSOLUTE_NAME", "Is Absolute" }, - { "IFSFILE_IS_DIRECTORY_NAME", "Is Directory" }, - { "IFSFILE_IS_FILE_NAME", "Is File" }, - { "IFSFILE_IS_HIDDEN_NAME", "Is Hidden" }, - { "IFSFILE_IS_READ_ONLY_NAME", "Is Read Only Name" }, - { "IFSFILE_LAST_ACCESSED_NAME", "Last Accessed" }, - { "IFSFILE_LAST_MODIFIED_NAME", "Last Modified" }, - { "IFSFILE_LENGTH_NAME", "Length" }, - { "IFSFILE_NAME_NAME", "Name" }, - { "IFSFILE_OWNERID_NAME", "Owner ID" }, //@A2a - { "IFSFILE_PARENT_NAME", "Parent" }, - { "IFSFILE_PATH_NAME", "Path" }, - { "IFSFILE_TYPE_NAME", "Type" }, - { "IFSFILE_TYPE_DIRECTORY_NAME", "Directory" }, - { "IFSFILE_TYPE_FILE_NAME", "File" }, - { "IFSFILE_TYPE_UNKNOWN_NAME", "Unknown" }, - - - - // #TRANNOTE ##################################################### - // #TRANNOTE IFSFileList component MRI. - // #TRANNOTE ##################################################### - - { "IFSFILE_LIST_DESCRIPTION", "File" }, - - { "IFSFILE_LIST_FILTER_NAME", "Filter" }, - { "IFSFILE_LIST_PATTERN_NAME", "Pattern" }, - - - - - // #TRANNOTE ##################################################### - // #TRANNOTE Java Program component MRI. - // #TRANNOTE ##################################################### - - { "JAVA_PROGRAM_DESCRIPTION", "Java Program" }, - - { "JAVA_PROGRAM_CLASSES_WITHOUT_CURRENT_JAVA_PROGRAMS_NAME", "Classes Without Current Java Programs" }, - { "JAVA_PROGRAM_CLASSES_WITH_CURRENT_JAVA_PROGRAMS_NAME", "Classes With Current Java Programs" }, - { "JAVA_PROGRAM_CLASSES_WITH_ERRORS_NAME", "Classes With Errors" }, // @A3A - { "JAVA_PROGRAM_ENABLE_PERFORMANCE_COLLECTION_NAME", "Enable Performance Collection" }, - { "JAVA_PROGRAM_ENABLE_PERFORMANCE_COLLECTION_NONE_NAME", "None" }, - { "JAVA_PROGRAM_ENABLE_PERFORMANCE_COLLECTION_ENTRYEXIT_NAME", "Entry/Exit" }, - { "JAVA_PROGRAM_ENABLE_PERFORMANCE_COLLECTION_FULL_NAME", "Full" }, - { "JAVA_PROGRAM_FILE_CHANGE_NAME", "File Change" }, - { "JAVA_PROGRAM_JAVA_PROGRAMS_NAME", "Java Programs" }, - { "JAVA_PROGRAM_JAVA_PROGRAM_CREATION_NAME", "Java Program Creation" }, - { "JAVA_PROGRAM_JAVA_PROGRAM_SIZE_NAME", "Java Program Size" }, - { "JAVA_PROGRAM_LICENSED_INTERNAL_CODE_OPTIONS_NAME", "Licensed Internal Code Options" }, - { "JAVA_PROGRAM_OPTIMIZATION_NAME", "Optimization" }, - { "JAVA_PROGRAM_OPTIMIZATION_-1_NAME", "Interpret" }, - { "JAVA_PROGRAM_OPTIMIZATION_10_NAME", "10" }, - { "JAVA_PROGRAM_OPTIMIZATION_20_NAME", "20" }, - { "JAVA_PROGRAM_OPTIMIZATION_30_NAME", "30" }, - { "JAVA_PROGRAM_OPTIMIZATION_40_NAME", "40" }, - { "JAVA_PROGRAM_OWNER_NAME", "Owner" }, - { "JAVA_PROGRAM_PROFILING_DATA_NAME", "Profiling Data" }, // @A3A - { "JAVA_PROGRAM_PROFILING_DATA_NOCOL_NAME", "Collection" }, // @A3A - { "JAVA_PROGRAM_PROFILING_DATA_COL_NAME", "No Collection" }, // @A3A - { "JAVA_PROGRAM_PROFILING_DATA_APY_NAME", "Apply" }, // @A3A - { "JAVA_PROGRAM_PROFILING_DATA_CLR_NAME", "Clear" }, // @A3A - { "JAVA_PROGRAM_RELEASE_PROGRAM_CREATED_FOR_NAME", "Release Program Created For" }, - { "JAVA_PROGRAM_TOTAL_CLASSES_IN_SOURCE_NAME", "Total Classes In Source" }, // @A3A - { "JAVA_PROGRAM_USE_ADOPTED_AUTHORITY_NAME", "Use Adopted Authority" }, - { "JAVA_PROGRAM_USE_ADOPTED_AUTHORITY_NO_NAME", "No" }, - { "JAVA_PROGRAM_USE_ADOPTED_AUTHORITY_YES_NAME", "Yes" }, - { "JAVA_PROGRAM_USER_PROFILE_NAME", "User Profile" }, - { "JAVA_PROGRAM_USER_PROFILE_OWNER_NAME", "Owner" }, - { "JAVA_PROGRAM_USER_PROFILE_USER_NAME", "User" }, - - - - // #TRANNOTE ##################################################### - // #TRANNOTE Job component MRI. - // #TRANNOTE ##################################################### - - { "JOB_DESCRIPTION", "Job" }, - - { "JOB_ACCOUNTING_CODE_NAME", "Accounting Code" }, - { "JOB_ACTIVE_JOB_STATUS_NAME", "Active Job Status" }, - { "JOB_AUXILIARY_IO_REQUESTS_NAME", "Auxiliary I/O Requests" }, - { "JOB_BREAK_MESSAGE_HANDLING_NAME", "Break Message Handling" }, - { "JOB_BREAK_MESSAGE_HANDLING_HOLD_NAME", "Hold" }, - { "JOB_BREAK_MESSAGE_HANDLING_NORMAL_NAME", "Normal" }, - { "JOB_BREAK_MESSAGE_HANDLING_NOTIFY_NAME", "Notify" }, - { "JOB_CCSID_NAME", "CCSID" }, - { "JOB_CCSID_-1_NAME", "System Value" }, - { "JOB_CCSID_-2_NAME", "Initial User" }, - { "JOB_COMPLETION_STATUS_NAME", "Completion Status" }, - { "JOB_COMPLETION_STATUS__NAME", "Not Completed" }, - { "JOB_COMPLETION_STATUS_0_NAME", "Completed Normally" }, - { "JOB_COMPLETION_STATUS_1_NAME", "Completed Abnormally" }, - { "JOB_CONTROLLED_END_REQUESTED_NAME", "Controlled End Requested" }, - { "JOB_CONTROLLED_END_REQUESTED__NAME", "Not Running" }, - { "JOB_CONTROLLED_END_REQUESTED_0_NAME", "Not Canceled" }, - { "JOB_CONTROLLED_END_REQUESTED_1_NAME", "Canceled" }, - { "JOB_COUNTRY_ID_NAME", "Country or Region ID" }, // @D4C - { "JOB_COUNTRY_ID_SYSVAL_NAME", "System Value" }, - { "JOB_COUNTRY_ID_USRPRF_NAME", "User Profile" }, - { "JOB_CPU_TIME_USED_NAME", "CPU Time Used" }, - { "JOB_CURRENT_LIBRARY_NAME", "Current Library" }, - { "JOB_CURRENT_LIBRARY_EXISTENCE_NAME", "Current Library Existence" }, - { "JOB_CURRENT_SYSTEM_POOL_ID_NAME", "Current System Pool ID" }, - { "JOB_CURRENT_USER_NAME", "Current User" }, - { "JOB_DATE_ENTERED_SYSTEM_NAME", "Date Entered System" }, - { "JOB_DATE_FORMAT_NAME", "Date Format" }, - { "JOB_DATE_FORMAT_DMY_NAME", "Day Month Year" }, - { "JOB_DATE_FORMAT_JUL_NAME", "Julian" }, - { "JOB_DATE_FORMAT_MDY_NAME", "Month Day Year" }, - { "JOB_DATE_FORMAT_SYS_NAME", "System Value" }, - { "JOB_DATE_FORMAT_YMD_NAME", "Year Month Day" }, - { "JOB_DATE_SEPARATOR_NAME", "Date Separator" }, - { "JOB_DATE_SEPARATOR_S_NAME", "System Value" }, - { "JOB_DATE_STARTED_NAME", "Date Started" }, - { "JOB_DBCS_CAPABLE_NAME", "DBCS Capable" }, - { "JOB_DECIMAL_FORMAT_NAME", "Decimal Format" }, - { "JOB_DECIMAL_FORMAT__NAME", "Period" }, - { "JOB_DECIMAL_FORMAT_I_NAME", "Comma Format I" }, - { "JOB_DECIMAL_FORMAT_J_NAME", "Comma Format J" }, - { "JOB_DECIMAL_FORMAT_SYSVAL_NAME", "System Value" }, - { "JOB_DEFAULT_CCSID_NAME", "Default CCSID" }, - { "JOB_DEFAULT_WAIT_TIME_NAME", "Default Wait Time" }, - { "JOB_DEVICE_RECOVERY_ACTION_NAME", "Device Recovery Action" }, - { "JOB_DEVICE_RECOVERY_ACTION_DSCENDRQS_NAME", "Disconnect End Request" }, - { "JOB_DEVICE_RECOVERY_ACTION_DSCMSG_NAME", "Disconnect Message" }, - { "JOB_DEVICE_RECOVERY_ACTION_ENDJOB_NAME", "End Job" }, - { "JOB_DEVICE_RECOVERY_ACTION_ENDJOBNOLIST_NAME", "End Job No List" }, - { "JOB_DEVICE_RECOVERY_ACTION_MSG_NAME", "Message" }, - { "JOB_DEVICE_RECOVERY_ACTION_SYSVAL_NAME", "System Value" }, - { "JOB_ELIGIBLE_FOR_PURGE_NAME", "Eligible For Purge" }, - { "JOB_END_SEVERITY_NAME", "End Severity" }, - { "JOB_FUNCTION_NAME_NAME", "Function Name" }, - { "JOB_FUNCTION_TYPE_NAME", "Function Type" }, - { "JOB_FUNCTION_TYPE__NAME", "Blank" }, - { "JOB_FUNCTION_TYPE_C_NAME", "Command" }, - { "JOB_FUNCTION_TYPE_D_NAME", "Delay" }, - { "JOB_FUNCTION_TYPE_G_NAME", "Group" }, - { "JOB_FUNCTION_TYPE_I_NAME", "Index" }, - { "JOB_FUNCTION_TYPE_L_NAME", "Log" }, - { "JOB_FUNCTION_TYPE_M_NAME", "MRT" }, - { "JOB_FUNCTION_TYPE_N_NAME", "Menu" }, - { "JOB_FUNCTION_TYPE_O_NAME", "I/O" }, - { "JOB_FUNCTION_TYPE_P_NAME", "Program" }, - { "JOB_FUNCTION_TYPE_R_NAME", "Procedure" }, - { "JOB_FUNCTION_TYPE__NAME", "Special" }, - { "JOB_INQUIRY_MESSAGE_REPLY_NAME", "Inquiry Message Reply" }, - { "JOB_INQUIRY_MESSAGE_REPLY_DFT_NAME", "Default" }, - { "JOB_INQUIRY_MESSAGE_REPLY_RQD_NAME", "Required" }, - { "JOB_INQUIRY_MESSAGE_REPLY_SYSRPYL_NAME", "System Reply List" }, - { "JOB_INSTANCE_NAME", "Instance" }, - { "JOB_INTERACTIVE_TRANSACTIONS_NAME", "Interactive Transactions" }, - { "JOB_INTERNAL_JOB_ID_NAME", "Internal Job Identifier" }, - { "JOB_JOB_DATE_NAME", "Job Date" }, - { "JOB_JOB_DESCRIPTION_NAME", "Job Description" }, - { "JOB_JOB_NAME_NAME", "Job Name" }, - { "JOB_JOB_NUMBER_NAME", "Job Number" }, - { "JOB_JOB_QUEUE_NAME", "Job Queue" }, - { "JOB_JOB_QUEUE_DATE_NAME", "Job Queue Date" }, - { "JOB_JOB_QUEUE_PRIORITY_NAME", "Job Queue Priority" }, - { "JOB_JOB_QUEUE_STATUS_NAME", "Job Queue Status" }, - { "JOB_JOB_QUEUE_STATUS__NAME", "Blank" }, - { "JOB_JOB_QUEUE_STATUS_HLD_NAME", "Held" }, - { "JOB_JOB_QUEUE_STATUS_RLS_NAME", "Released" }, - { "JOB_JOB_QUEUE_STATUS_SCD_NAME", "Scheduled" }, - { "JOB_JOB_STATUS_NAME", "Job Status" }, - { "JOB_JOB_STATUS_ACTIVE_NAME", "Active" }, - { "JOB_JOB_STATUS_JOBQ_NAME", "Job Queue" }, - { "JOB_JOB_STATUS_OUTQ_NAME", "Output Queue" }, - { "JOB_JOB_SUBTYPE_NAME", "Job Subtype" }, - { "JOB_JOB_SUBTYPE__NAME", "Blank" }, - { "JOB_JOB_SUBTYPE_D_NAME", "Immediate" }, - { "JOB_JOB_SUBTYPE_E_NAME", "Procedure Start Request" }, - { "JOB_JOB_SUBTYPE_F_NAME", "Machine Server Job" }, - { "JOB_JOB_SUBTYPE_J_NAME", "Prestart" }, - { "JOB_JOB_SUBTYPE_P_NAME", "Print Driver" }, - { "JOB_JOB_SUBTYPE_T_NAME", "MRT" }, - { "JOB_JOB_SUBTYPE_U_NAME", "Alternate Spool User" }, - { "JOB_JOB_SWITCHES_NAME", "Job Switches" }, - { "JOB_JOB_TYPE_NAME", "Job Type" }, - { "JOB_JOB_TYPE__NAME", "Not Valid" }, - { "JOB_JOB_TYPE_A_NAME", "Autostart" }, - { "JOB_JOB_TYPE_B_NAME", "Batch" }, - { "JOB_JOB_TYPE_I_NAME", "Interactive" }, - { "JOB_JOB_TYPE_M_NAME", "Subsystem Monitor" }, - { "JOB_JOB_TYPE_R_NAME", "Spooled Reader" }, - { "JOB_JOB_TYPE_S_NAME", "System" }, - { "JOB_JOB_TYPE_W_NAME", "Spooled Writer" }, - { "JOB_JOB_TYPE_X_NAME", "SCPF System" }, - { "JOB_KEEP_DDM_CONNECTIONS_ACTIVE_NAME", "Keep DDM Connections Active" }, - { "JOB_KEEP_DDM_CONNECTIONS_ACTIVE_KEEP_NAME", "Keep" }, - { "JOB_KEEP_DDM_CONNECTIONS_ACTIVE_DROP_NAME", "Drop" }, - { "JOB_LANGUAGE_ID_NAME", "Language ID" }, - { "JOB_LANGUAGE_ID_SYSVAL_NAME", "System Value" }, - { "JOB_LANGUAGE_ID_USRPRF_NAME", "User Profile" }, - { "JOB_LOCATION_NAME_NAME", "Location Name" }, - { "JOB_LOG_CL_PROGRAMS_NAME", "Log CL Programs" }, - { "JOB_LOGGING_LEVEL_NAME", "Logging Level" }, - { "JOB_LOGGING_LEVEL_0_NAME", "None" }, - { "JOB_LOGGING_LEVEL_1_NAME", "Messages By Severity" }, - { "JOB_LOGGING_LEVEL_2_NAME", "Requests By Severity and Associated Messages" }, - { "JOB_LOGGING_LEVEL_3_NAME", "All Requests and Associated Messages" }, - { "JOB_LOGGING_LEVEL_4_NAME", "All Requests and Messages" }, - { "JOB_LOGGING_SEVERITY_NAME", "Logging Severity" }, - { "JOB_LOGGING_TEXT_NAME", "Logging Text" }, - { "JOB_LOGGING_TEXT_MSG_NAME", "Message" }, - { "JOB_LOGGING_TEXT_SECLVL_NAME", "Seclvl" }, - { "JOB_LOGGING_TEXT_NOLIST_NAME", "No List" }, - { "JOB_MAX_CPU_TIME_NAME", "Max CPU Time" }, - { "JOB_MAX_TEMP_STORAGE_NAME", "Max Temp Storage" }, - { "JOB_MESSAGE_QUEUE_ACTION_NAME", "Message Queue Action" }, - { "JOB_MESSAGE_QUEUE_ACTION_NOWRAP_NAME", "No Wrap" }, - { "JOB_MESSAGE_QUEUE_ACTION_PRTWRAP_NAME", "Print Wrap" }, - { "JOB_MESSAGE_QUEUE_ACTION_WRAP_NAME", "Wrap" }, - { "JOB_MESSAGE_QUEUE_MAX_SIZE_NAME", "Message Queue Max Size" }, - { "JOB_MODE_NAME", "Mode" }, - { "JOB_NETWORK_ID_NAME", "Network ID" }, - { "JOB_OUTPUT_QUEUE_NAME", "Output Queue" }, - { "JOB_OUTPUT_QUEUE_PRIORITY_NAME", "Output Queue Priority" }, - { "JOB_PRINT_KEY_FORMAT_NAME", "Print Key Format" }, - { "JOB_PRINT_KEY_FORMAT_NONE_NAME", "None" }, - { "JOB_PRINT_KEY_FORMAT_PRTALL_NAME", "All" }, - { "JOB_PRINT_KEY_FORMAT_PRTBDR_NAME", "Border" }, - { "JOB_PRINT_KEY_FORMAT_PRTHDR_NAME", "Header" }, - { "JOB_PRINT_KEY_FORMAT_SYSVAL_NAME", "System Value" }, - { "JOB_PRINT_TEXT_NAME", "Print Text" }, - { "JOB_PRINT_TEXT_SYSVAL_NAME", "System Value" }, - { "JOB_PRINTER_DEVICE_NAME_NAME", "Printer Device Name" }, - { "JOB_PRINTER_DEVICE_NAME_SYSVAL_NAME", "System Value" }, - { "JOB_PRINTER_DEVICE_NAME_USRPRF_NAME", "User Profile" }, - { "JOB_PRINTER_DEVICE_NAME_WRKSTN_NAME", "Work Station" }, - { "JOB_PRODUCT_LIBRARIES_NAME", "Product Libraries" }, - { "JOB_PRODUCT_RETURN_CODE_NAME", "Product Return Code" }, - { "JOB_PROGRAM_RETURN_CODE_NAME", "Program Return Code" }, - { "JOB_ROUTING_DATA_NAME", "Routing Data" }, - { "JOB_RUN_PRIORITY_NAME", "Run Priority" }, - { "JOB_SCHEDULE_DATE_NAME", "Schedule Date" }, - { "JOB_SCHEDULE_DATE_CURRENT_NAME", "Current" }, - { "JOB_SCHEDULE_DATE_MONTHSTR_NAME", "Month Start" }, - { "JOB_SCHEDULE_DATE_MONTHEND_NAME", "Month End" }, - { "JOB_SCHEDULE_DATE_MON_NAME", "Monday" }, - { "JOB_SCHEDULE_DATE_TUE_NAME", "Tuesday" }, - { "JOB_SCHEDULE_DATE_WED_NAME", "Wednesday" }, - { "JOB_SCHEDULE_DATE_THU_NAME", "Thursday" }, - { "JOB_SCHEDULE_DATE_FRI_NAME", "Friday" }, - { "JOB_SCHEDULE_DATE_SAT_NAME", "Saturday" }, - { "JOB_SCHEDULE_DATE_SUN_NAME", "Sunday" }, - { "JOB_SEQUENCE_NUMBER_NAME", "Sequence Number" }, - { "JOB_SERVER_TYPE_NAME", "Server Type" }, - { "JOB_SIGNED_ON_JOB_NAME", "Signed On Job" }, - { "JOB_SORT_SEQUENCE_TABLE_NAME", "Sort Sequence Table" }, - { "JOB_SPECIAL_ENVIRONMENT_NAME", "Special Environment" }, - { "JOB_SPECIAL_ENVIRONMENT__NAME", "Not Active" }, - { "JOB_SPECIAL_ENVIRONMENT_NONE_NAME", "None" }, - { "JOB_SPECIAL_ENVIRONMENT_S36_NAME", "System/36" }, - { "JOB_STATUS_MESSAGE_HANDLING_NAME", "Status Message Handling" }, - { "JOB_STATUS_MESSAGE_HANDLING_NORMAL_NAME", "Normal" }, - { "JOB_STATUS_MESSAGE_HANDLING_NONE_NAME", "None" }, - { "JOB_STATUS_MESSAGE_HANDLING_SYSVAL_NAME", "System Value" }, - { "JOB_STATUS_MESSAGE_HANDLING_USRPRF_NAME", "User Profile" }, - { "JOB_SUBMITTED_BY_JOB_NAME_NAME", "Submitted By Job Name" }, - { "JOB_SUBMITTED_BY_JOB_NUMBER_NAME", "Submitted By Job Number" }, - { "JOB_SUBMITTED_BY_USER_NAME", "Submitted By User Name" }, - { "JOB_SUBSYSTEM_NAME", "Subsystem" }, - { "JOB_SYSTEM_POOL_ID_NAME", "System Pool ID" }, - { "JOB_SYSTEM_LIBRARY_LIST_NAME", "System Library List" }, - { "JOB_TEMP_STORAGE_USED_NAME", "Temp Storage Used" }, - { "JOB_THREAD_COUNT_NAME", "Thread Count" }, - { "JOB_TIME_SEPARATOR_NAME", "Time Separator" }, - { "JOB_TIME_SEPARATOR_S_NAME", "System Value" }, - { "JOB_TIME_SLICE_NAME", "Time Slice" }, - { "JOB_TIME_SLICE_END_POOL_NAME", "Time Slice End Pool" }, - { "JOB_TIME_SLICE_END_POOL_BASE_NAME", "Base" }, - { "JOB_TIME_SLICE_END_POOL_NONE_NAME", "None" }, - { "JOB_TIME_SLICE_END_POOL_SYSVAL_NAME", "System Value" }, - { "JOB_TOTAL_RESPONSE_TIME_NAME", "Total Response Time" }, - { "JOB_USER_LIBRARY_LIST_NAME", "User Library List" }, - { "JOB_USER_NAME_NAME", "User Name" }, - { "JOB_USER_RETURN_CODE_NAME", "User Return Code" }, - - - - // #TRANNOTE ##################################################### - // #TRANNOTE Job list component MRI. - // #TRANNOTE ##################################################### - - { "JOB_LIST_NAME", "Job List" }, - { "JOB_LIST_ACTIVE_JOB_STATUSES_NAME", "Active Job Statuses" }, - { "JOB_LIST_CURRENT_USER_PROFILES_NAME", "Current User Profiles" }, - { "JOB_LIST_JOB_NAME_NAME", "Job Name" }, - { "JOB_LIST_JOB_NAME__NAME", "*" }, - { "JOB_LIST_JOB_NAME_ALL_NAME", "All" }, - { "JOB_LIST_JOB_NAME_CURRENT_NAME", "Current" }, - { "JOB_LIST_JOB_NUMBER_NAME", "Job Number" }, - { "JOB_LIST_JOB_NUMBER_ALL_NAME", "All" }, - { "JOB_LIST_JOB_QUEUE_NAMES_NAME", "Job Queue Names" }, - { "JOB_LIST_JOB_TYPE_NAME", "Job Type" }, - { "JOB_LIST_JOB_TYPE_A_NAME", "Autostart Jobs" }, - { "JOB_LIST_JOB_TYPE_ALL_NAME", "All Jobs" }, - { "JOB_LIST_JOB_TYPE_B_NAME", "Batch Jobs" }, - { "JOB_LIST_JOB_TYPE_I_NAME", "Interactive Jobs" }, - { "JOB_LIST_JOB_TYPE_M_NAME", "Subsystem Monitor Jobs" }, - { "JOB_LIST_JOB_TYPE_R_NAME", "Spooled Reader Jobs" }, - { "JOB_LIST_JOB_TYPE_S_NAME", "System Jobs" }, - { "JOB_LIST_JOB_TYPE_W_NAME", "Spooled Writer Jobs" }, - { "JOB_LIST_JOB_TYPE_X_NAME", "SCPF System Jobs" }, - { "JOB_LIST_JOBS_ON_JOB_QUEUE_STATUSES_NAME", "Jobs On Job Queue Statuses" }, - { "JOB_LIST_JOBS_ON_JOB_QUEUE_STATUSES_HLD_NAME", "Held" }, - { "JOB_LIST_JOBS_ON_JOB_QUEUE_STATUSES_RLS_NAME", "Released" }, - { "JOB_LIST_JOBS_ON_JOB_QUEUE_STATUSES_SCD_NAME", "Scheduled" }, - { "JOB_LIST_PRIMARY_JOB_STATUSES_NAME", "Primary Job Statuses" }, - { "JOB_LIST_PRIMARY_JOB_STATUSES_ACTIVE_NAME", "Active Jobs" }, - { "JOB_LIST_PRIMARY_JOB_STATUSES_JOBQ_NAME", "Job Queue" }, - { "JOB_LIST_PRIMARY_JOB_STATUSES_OUTQ_NAME", "Output Queue" }, - { "JOB_LIST_SERVER_TYPES_NAME", "Server Types" }, - { "JOB_LIST_SERVER_TYPES_ALL_NAME", "Jobs With A Server Type" }, - { "JOB_LIST_SERVER_TYPES_BLANK_NAME", "Jobs Without A Server Type" }, - { "JOB_LIST_USER_NAME_NAME", "User Name" }, - { "JOB_LIST_USER_NAME_ALL_NAME", "All Users" }, - { "JOB_LIST_USER_NAME_CURRENT_NAME", "Current" }, - - - - // #TRANNOTE ##################################################### - // #TRANNOTE Job log component MRI. - // #TRANNOTE ##################################################### - - { "JOB_LOG_DESCRIPTION", "Job Log" }, - { "JOB_LOG_LIST_DIRECTION_NAME", "List Direction" }, - { "JOB_LOG_LIST_DIRECTION_NEXT_NAME", "Next" }, - { "JOB_LOG_LIST_DIRECTION_PRV_NAME", "Previous" }, - { "JOB_LOG_STARTING_MESSAGE_KEY_NAME", "Starting Message Key" }, - { "JOB_LOG_STARTING_MESSAGE_KEY_-1_NAME", "Newest" }, - { "JOB_LOG_STARTING_MESSAGE_KEY_0_NAME", "Oldest" }, - - - - // #TRANNOTE ##################################################### - // #TRANNOTE Message component MRI. - // #TRANNOTE ##################################################### - - { "MESSAGE_QUEUE_DESCRIPTION", "Message Queue" }, - { "MESSAGE_QUEUE_FORMATTING_CHARACTERS_NAME", "Formatting Characters" }, - { "MESSAGE_QUEUE_FORMATTING_CHARACTERS_0_NAME", "No Formatting" }, - { "MESSAGE_QUEUE_FORMATTING_CHARACTERS_1_NAME", "Return Formatting Characters" }, - { "MESSAGE_QUEUE_FORMATTING_CHARACTERS_2_NAME", "Substitute Formatting Characters" }, - { "MESSAGE_QUEUE_LIST_DIRECTION_NAME", "List Direction" }, - { "MESSAGE_QUEUE_LIST_DIRECTION_NEXT_NAME", "Next" }, - { "MESSAGE_QUEUE_LIST_DIRECTION_PRV_NAME", "Previous" }, - { "MESSAGE_QUEUE_REPLACEMENT_DATA_NAME", "Replacement Data" }, - { "MESSAGE_QUEUE_SELECTION_CRITERIA_NAME", "Selection Criteria" }, - { "MESSAGE_QUEUE_SELECTION_CRITERIA_ALL_NAME", "All Messages" }, - { "MESSAGE_QUEUE_SELECTION_CRITERIA_MNR_NAME", "Messages Needing Reply" }, - { "MESSAGE_QUEUE_SELECTION_CRITERIA_MNNR_NAME", "Messages Not Needing Reply" }, - { "MESSAGE_QUEUE_SELECTION_CRITERIA_SCNR_NAME", "Senders Copy Needing Reply" }, - { "MESSAGE_QUEUE_SEVERITY_CRITERIA_NAME", "Severity Criteria" }, - { "MESSAGE_QUEUE_SORT_CRITERIA_NAME", "Sort Criteria" }, - { "MESSAGE_QUEUE_STARTING_USER_MESSAGE_KEY_NAME", "Starting User Message Key" }, - { "MESSAGE_QUEUE_STARTING_USER_MESSAGE_KEY_-1_NAME", "Newest" }, - { "MESSAGE_QUEUE_STARTING_USER_MESSAGE_KEY_0_NAME", "Oldest" }, - { "MESSAGE_QUEUE_STARTING_WORKSTATION_MESSAGE_KEY_NAME", "Starting Workstation Message Key" }, - { "MESSAGE_QUEUE_STARTING_WORKSTATION_MESSAGE_KEY_-1_NAME", "Newest" }, - { "MESSAGE_QUEUE_STARTING_WORKSTATION_MESSAGE_KEY_0_NAME", "Oldest" }, - - { "QUEUED_MESSAGE_DESCRIPTION", "Queued Message" }, - { "QUEUED_MESSAGE_ALERT_OPTION_NAME", "Alert Option" }, - { "QUEUED_MESSAGE_ALERT_OPTION__NAME", "Not specified" }, - { "QUEUED_MESSAGE_ALERT_OPTION_DEFER_NAME", "Defer" }, - { "QUEUED_MESSAGE_ALERT_OPTION_IMMED_NAME", "Immediate" }, - { "QUEUED_MESSAGE_ALERT_OPTION_NO_NAME", "No" }, - { "QUEUED_MESSAGE_ALERT_OPTION_UNATTEND_NAME", "Unattend" }, - { "QUEUED_MESSAGE_DATE_SENT_NAME", "Date Sent" }, - { "QUEUED_MESSAGE_DEFAULT_REPLY_NAME", "Default Reply" }, - { "QUEUED_MESSAGE_MESSAGE_FILE_NAME", "Message File" }, - { "QUEUED_MESSAGE_MESSAGE_HELP_NAME", "Message Help" }, - { "QUEUED_MESSAGE_MESSAGE_ID_NAME", "Message ID" }, - { "QUEUED_MESSAGE_MESSAGE_KEY_NAME", "Message Key" }, - { "QUEUED_MESSAGE_MESSAGE_QUEUE_NAME", "Message Queue" }, - { "QUEUED_MESSAGE_MESSAGE_SEVERITY_NAME", "Message Severity" }, - { "QUEUED_MESSAGE_MESSAGE_TEXT_NAME", "Message Text" }, - { "QUEUED_MESSAGE_MESSAGE_TYPE_NAME", "Message Type" }, - { "QUEUED_MESSAGE_MESSAGE_TYPE_1_NAME", "Completion" }, - { "QUEUED_MESSAGE_MESSAGE_TYPE_2_NAME", "Diagnostic" }, - { "QUEUED_MESSAGE_MESSAGE_TYPE_4_NAME", "Informational" }, - { "QUEUED_MESSAGE_MESSAGE_TYPE_5_NAME", "Inquiry" }, - { "QUEUED_MESSAGE_MESSAGE_TYPE_6_NAME", "Senders Copy" }, - { "QUEUED_MESSAGE_MESSAGE_TYPE_8_NAME", "Request Copy" }, - { "QUEUED_MESSAGE_MESSAGE_TYPE_10_NAME", "Request With Prompting" }, - { "QUEUED_MESSAGE_MESSAGE_TYPE_14_NAME", "Notify" }, - { "QUEUED_MESSAGE_MESSAGE_TYPE_15_NAME", "Escape" }, - { "QUEUED_MESSAGE_MESSAGE_TYPE_16_NAME", "Notify Not Handled" }, // @D2A - { "QUEUED_MESSAGE_MESSAGE_TYPE_17_NAME", "Escape Not Handled" }, // @D2A - { "QUEUED_MESSAGE_MESSAGE_TYPE_21_NAME", "Reply Not Validity Checked" }, - { "QUEUED_MESSAGE_MESSAGE_TYPE_22_NAME", "Reply Validity Checked" }, - { "QUEUED_MESSAGE_MESSAGE_TYPE_23_NAME", "Reply Message Default Used" }, - { "QUEUED_MESSAGE_MESSAGE_TYPE_24_NAME", "Reply System Default Used" }, - { "QUEUED_MESSAGE_MESSAGE_TYPE_25_NAME", "Reply From System Reply List" }, - { "QUEUED_MESSAGE_REPLY_STATUS_NAME", "Reply Status" }, - { "QUEUED_MESSAGE_REPLY_STATUS_A_NAME", "Accepts Sent" }, - { "QUEUED_MESSAGE_REPLY_STATUS_N_NAME", "Not Accept" }, - { "QUEUED_MESSAGE_REPLY_STATUS_W_NAME", "Accepts Not Sent" }, - { "QUEUED_MESSAGE_SENDER_JOB_NAME_NAME", "Sender Job Name" }, - { "QUEUED_MESSAGE_SENDER_JOB_NUMBER_NAME", "Sender Job Number" }, - { "QUEUED_MESSAGE_SENDER_USER_NAME_NAME", "Sender User Name" }, - { "QUEUED_MESSAGE_SENDING_PROGRAM_NAME_NAME", "Sending Program Name" }, - { "QUEUED_MESSAGE_SUBSTITUTION_DATA_NAME", "Substitution Data" }, - - // #TRANNOTE ##################################################### - // #TRANNOTE Printer component MRI. - // #TRANNOTE ##################################################### - - { "PRINTER_DESCRIPTION", "Printer" }, - - { "PRINTER_ADVANCED_FUNCTION_PRINTING_NAME", "Advanced Function Printing" }, - { "PRINTER_ALIGN_FORMS_NAME", "Align Forms" }, - { "PRINTER_ALIGN_FORMS_WTR_NAME", "From Writer" }, - { "PRINTER_ALIGN_FORMS_FILE_NAME", "From File" }, - { "PRINTER_ALIGN_FORMS__NAME", "Ended" }, - { "PRINTER_ALLOW_DIRECT_PRINTING_NAME", "Allow Direct Printing" }, - { "PRINTER_AUTOMATICALLY_END_WRITER_NAME", "Automatically End Writer" }, - { "PRINTER_AUTOMATICALLY_END_WRITER_NORDYF_NAME", "No Files Ready" }, - { "PRINTER_AUTOMATICALLY_END_WRITER_FILEEND_NAME", "File End" }, - { "PRINTER_AUTOMATICALLY_END_WRITER_NO_NAME", "Do Not End" }, - { "PRINTER_AUTOMATICALLY_END_WRITER__NAME", "Ended" }, - { "PRINTER_BETWEEN_COPIES_STATUS_NAME", "Between Copies Status" }, - { "PRINTER_BETWEEN_FILES_STATUS_NAME", "Between Files Status" }, - { "PRINTER_CHANGES_TAKE_EFFECT_NAME", "Changes Take Effect" }, - { "PRINTER_CHANGES_TAKE_EFFECT_NORDYF_NAME", "No Files Ready" }, - { "PRINTER_CHANGES_TAKE_EFFECT_FILEEND_NAME", "File End" }, - { "PRINTER_CHANGES_TAKE_EFFECT__NAME", "No Changes" }, - { "PRINTER_COPIES_LEFT_TO_PRODUCE_NAME", "Copies Left To Produce" }, - { "PRINTER_DEVICE_NAME_NAME", "Device Name" }, - { "PRINTER_DEVICE_STATUS_NAME", "Device Status" }, - { "PRINTER_DEVICE_TYPE_NAME", "Device Type" }, - { "PRINTER_END_PENDING_STATUS_NAME", "End Pending Status" }, - { "PRINTER_END_PENDING_STATUS_C_NAME", "Controlled" }, - { "PRINTER_END_PENDING_STATUS_I_NAME", "Immediate" }, - { "PRINTER_END_PENDING_STATUS_N_NAME", "None" }, - { "PRINTER_END_PENDING_STATUS_P_NAME", "Page End" }, - { "PRINTER_END_PENDING_STATUS__NAME", "Ended" }, - { "PRINTER_FORM_TYPE_NAME", "Form Type" }, - { "PRINTER_FORM_TYPE_ALL_NAME", "All" }, - { "PRINTER_FORM_TYPE_FORMS_NAME", "Forms" }, - { "PRINTER_FORM_TYPE_STD_NAME", "Standard" }, - { "PRINTER_HELD_STATUS_NAME", "Held Status" }, - { "PRINTER_HOLD_PENDING_STATUS_NAME", "Hold Pending Status" }, - { "PRINTER_HOLD_PENDING_STATUS_C_NAME", "Controlled" }, - { "PRINTER_HOLD_PENDING_STATUS_I_NAME", "Immediate" }, - { "PRINTER_HOLD_PENDING_STATUS_N_NAME", "None" }, - { "PRINTER_HOLD_PENDING_STATUS_P_NAME", "Page End" }, - { "PRINTER_HOLD_PENDING_STATUS__NAME", "Ended" }, - { "PRINTER_JOB_NAME_NAME", "Job Name" }, - { "PRINTER_JOB_NUMBER_NAME", "Job Number" }, - { "PRINTER_JOB_QUEUE_STATUS_NAME", "Job Queue Status" }, - { "PRINTER_MESSAGE_KEY_NAME", "Message Key" }, - { "PRINTER_MESSAGE_OPTION_NAME", "Message Option" }, - { "PRINTER_MESSAGE_OPTION_INFOMSG_NAME", "Informational Message" }, - { "PRINTER_MESSAGE_OPTION_INQMSG_NAME", "Inquiry Message" }, - { "PRINTER_MESSAGE_OPTION_MSG_NAME", "Message" }, - { "PRINTER_MESSAGE_OPTION_NOMSG_NAME", "No Message" }, - { "PRINTER_MESSAGE_OPTION__NAME", "Ended" }, - { "PRINTER_MESSAGE_QUEUE_NAME", "Message Queue" }, - { "PRINTER_NEXT_FILE_SEPARATORS_NAME", "Next File Separators" }, - { "PRINTER_NEXT_FILE_SEPARATORS_-1_NAME", "From File" }, - { "PRINTER_NEXT_FILE_SEPARATORS_-10_NAME", "No Changes" }, - { "PRINTER_NEXT_FORM_TYPE_NAME", "Next Form Type" }, - { "PRINTER_NEXT_FORM_TYPE_ALL_NAME", "All" }, - { "PRINTER_NEXT_FORM_TYPE_FORMS_NAME", "Forms" }, - { "PRINTER_NEXT_FORM_TYPE_STD_NAME", "Standard" }, - { "PRINTER_NEXT_MESSAGE_OPTION_NAME", "Next Message Option" }, - { "PRINTER_NEXT_MESSAGE_OPTION_INFOMSG_NAME", "Informational Message" }, - { "PRINTER_NEXT_MESSAGE_OPTION_INQMSG_NAME", "Inquiry Message" }, - { "PRINTER_NEXT_MESSAGE_OPTION_MSG_NAME", "Message" }, - { "PRINTER_NEXT_MESSAGE_OPTION_NOMSG_NAME", "No Message" }, - { "PRINTER_NEXT_MESSAGE_OPTION__NAME", "No Changes" }, - { "PRINTER_NEXT_OUTPUT_QUEUE_NAME", "Next Output Queue" }, - { "PRINTER_NEXT_SEPARATOR_DRAWER_NAME", "Next Separator Drawer" }, - { "PRINTER_NEXT_SEPARATOR_DRAWER_-1_NAME", "From File" }, - { "PRINTER_NEXT_SEPARATOR_DRAWER_-2_NAME", "From Device" }, - { "PRINTER_NEXT_SEPARATOR_DRAWER_-10_NAME", "No Changes" }, - { "PRINTER_NUMBER_OF_SEPARATORS_NAME", "Number of Separators" }, - { "PRINTER_NUMBER_OF_SEPARATORS_-1_NAME", "From File" }, - { "PRINTER_OUTPUT_QUEUE_NAME", "Output Queue" }, - { "PRINTER_OUTPUT_QUEUE_STATUS_NAME", "Output Queue Status" }, - { "PRINTER_OUTPUT_QUEUE_STATUS_H_NAME", "Held" }, - { "PRINTER_OUTPUT_QUEUE_STATUS_R_NAME", "Released" }, - { "PRINTER_OUTPUT_QUEUE_STATUS__NAME", "Not Set" }, - { "PRINTER_OVERALL_STATUS_NAME", "Overall Status" }, - { "PRINTER_PAGE_BEING_WRITTEN_NAME", "Page Being Written" }, - { "PRINTER_PUBLISHED_STATUS_NAME", "Published Status" }, - { "PRINTER_SEPARATOR_DRAWER_NAME", "Separator Drawer" }, - { "PRINTER_SEPARATOR_DRAWER_-1_NAME", "From File" }, - { "PRINTER_SEPARATOR_DRAWER_-2_NAME", "From Device" }, - { "PRINTER_SPOOLED_FILE_NAME_NAME", "Spooled File Name" }, - { "PRINTER_SPOOLED_FILE_NUMBER_NAME", "Spooled File Number" }, - { "PRINTER_STARTED_BY_USER_NAME", "Started By User" }, - { "PRINTER_TEXT_DESCRIPTION_NAME", "Text Description" }, - { "PRINTER_TOTAL_COPIES_NAME", "Total Copies" }, - { "PRINTER_TOTAL_PAGES_NAME", "Total Pages" }, - { "PRINTER_USER_NAME_NAME", "User Name" }, - { "PRINTER_WAITING_FOR_DATA_STATUS_NAME", "Waiting For Data Status" }, - { "PRINTER_WAITING_FOR_DEVICE_STATUS_NAME", "Waiting For Device Status" }, - { "PRINTER_WAITING_FOR_MESSAGE_STATUS_NAME", "Waiting for Message Status" }, - { "PRINTER_WRITER_JOB_NAME_NAME", "Writer Job Name" }, - { "PRINTER_WRITER_JOB_NUMBER_NAME", "Writer Job Number" }, - { "PRINTER_WRITER_JOB_USER_NAME_NAME", "Writer Job User Name" }, - { "PRINTER_WRITER_STARTED_NAME", "Writer Started" }, - { "PRINTER_WRITER_STATUS_NAME", "Writer Status" }, - { "PRINTER_WRITER_STATUS_1_NAME", "Started" }, - { "PRINTER_WRITER_STATUS_2_NAME", "Ended" }, - { "PRINTER_WRITER_STATUS_3_NAME", "Job Queue" }, - { "PRINTER_WRITER_STATUS_4_NAME", "Held" }, - { "PRINTER_WRITER_STATUS_5_NAME", "Message Waiting" }, - { "PRINTER_WRITING_STATUS_NAME", "Writing Status" }, - { "PRINTER_WRITING_STATUS_Y_NAME", "Yes" }, - { "PRINTER_WRITING_STATUS_N_NAME", "No" }, - { "PRINTER_WRITING_STATUS_S_NAME", "Separators" }, - { "PRINTER_WRITING_STATUS__NAME", "Ended" }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE Printer list component MRI. - // #TRANNOTE ##################################################### - - { "PRINTER_LIST_NAME", "Printer List" }, - { "PRINTER_LIST_DESCRIPTION", "List of Printers" }, - - { "PRINTER_LIST_OUTPUT_QUEUES_NAME", "Output Queues" }, - { "PRINTER_LIST_PRINTER_NAMES_NAME", "Printer Names" }, - - // #TRANNOTE ##################################################### - // #TRANNOTE Software resource component MRI. - // #TRANNOTE ##################################################### - - { "SOFTWARE_RESOURCE_DESCRIPTION", "Software Resource" }, - - { "SOFTWARE_RESOURCE_LEVEL_NAME", "Level" }, - { "SOFTWARE_RESOURCE_LOAD_ERROR_INDICATOR_NAME", "Load Error Indicator" }, - { "SOFTWARE_RESOURCE_LOAD_ERROR_INDICATOR_ERROR_NAME", "Error" }, - { "SOFTWARE_RESOURCE_LOAD_ERROR_INDICATOR_NONE_NAME", "None" }, - { "SOFTWARE_RESOURCE_LOAD_ID_NAME", "Load ID" }, - { "SOFTWARE_RESOURCE_LOAD_ID_5050_NAME", "Code" }, - { "SOFTWARE_RESOURCE_LOAD_STATE_NAME", "Load State" }, - { "SOFTWARE_RESOURCE_LOAD_TYPE_NAME", "Load Type" }, - { "SOFTWARE_RESOURCE_LOAD_TYPE_CODE_NAME", "Code" }, - { "SOFTWARE_RESOURCE_LOAD_TYPE_LNG_NAME", "Language" }, - { "SOFTWARE_RESOURCE_MINIMUM_BASE_VRM_NAME", "Minimum Base VRM" }, - { "SOFTWARE_RESOURCE_MINIMUM_BASE_VRM_MATCH_NAME", "Match" }, - { "SOFTWARE_RESOURCE_MINIMUM_TARGET_RELEASE_NAME", "Minimum Target Release" }, - { "SOFTWARE_RESOURCE_PRIMARY_LANGUAGE_LOAD_ID_NAME", "Primary Language Load ID" }, - { "SOFTWARE_RESOURCE_PRODUCT_ID_NAME", "Product ID" }, - { "SOFTWARE_RESOURCE_PRODUCT_ID_OPSYS_NAME", "Operating System" }, - { "SOFTWARE_RESOURCE_PRODUCT_OPTION_NAME", "Product Option" }, - { "SOFTWARE_RESOURCE_PRODUCT_OPTION_0000_NAME", "Base" }, - { "SOFTWARE_RESOURCE_REGISTRATION_TYPE_NAME", "Registration Type" }, - { "SOFTWARE_RESOURCE_REGISTRATION_VALUE_NAME", "Registration Value" }, - { "SOFTWARE_RESOURCE_RELEASE_LEVEL_NAME", "Release Level" }, - { "SOFTWARE_RESOURCE_RELEASE_LEVEL_CUR_NAME", "Current" }, - { "SOFTWARE_RESOURCE_RELEASE_LEVEL_ONLY_NAME", "Only" }, - { "SOFTWARE_RESOURCE_RELEASE_LEVEL_PRV_NAME", "Previous" }, - { "SOFTWARE_RESOURCE_REQUIREMENTS_MET_NAME", "Requirements Met" }, - { "SOFTWARE_RESOURCE_REQUIREMENTS_MET_0_NAME", "Unknown" }, - { "SOFTWARE_RESOURCE_REQUIREMENTS_MET_1_NAME", "All" }, - { "SOFTWARE_RESOURCE_REQUIREMENTS_MET_2_NAME", "Too Old Compared To Base" }, - { "SOFTWARE_RESOURCE_REQUIREMENTS_MET_3_NAME", "Too Old Compared To Option" }, - { "SOFTWARE_RESOURCE_SUPPORTED_FLAG_NAME", "Supported Flag" }, - { "SOFTWARE_RESOURCE_SYMBOLIC_LOAD_STATE_NAME", "Symbolic Load State" }, - { "SOFTWARE_RESOURCE_SYMBOLIC_LOAD_STATE_DEFINED_NAME", "Defined" }, - { "SOFTWARE_RESOURCE_SYMBOLIC_LOAD_STATE_CREATED_NAME", "Created" }, - { "SOFTWARE_RESOURCE_SYMBOLIC_LOAD_STATE_PACKAGED_NAME", "Packaged" }, - { "SOFTWARE_RESOURCE_SYMBOLIC_LOAD_STATE_DAMAGED_NAME", "Damaged" }, - { "SOFTWARE_RESOURCE_SYMBOLIC_LOAD_STATE_LOADED_NAME", "Loaded" }, - { "SOFTWARE_RESOURCE_SYMBOLIC_LOAD_STATE_INSTALLED_NAME", "Installed" }, - - - - // #TRANNOTE ##################################################### - // #TRANNOTE User component MRI. - // #TRANNOTE ##################################################### - - { "USER_DESCRIPTION", "User" }, - - { "USER_ACCOUNTING_CODE_NAME", "Accounting Code" }, - { "USER_ALLOW_SYNCHRONIZATION_NAME", "Allow Synchronization" }, - { "USER_ASSISTANCE_LEVEL_NAME", "Assistance Level" }, - { "USER_ASSISTANCE_LEVEL_ADVANCED_NAME", "Advanced" }, - { "USER_ASSISTANCE_LEVEL_BASIC_NAME", "Basic" }, - { "USER_ASSISTANCE_LEVEL_INTERMED_NAME", "Intermediate" }, - { "USER_ASSISTANCE_LEVEL_SYSVAL_NAME", "System Value" }, - { "USER_ATTENTION_KEY_HANDLING_PROGRAM_NAME", "Attention Key Handling Program" }, - { "USER_ATTENTION_KEY_HANDLING_PROGRAM_ASSIST_NAME", "Assist" }, - { "USER_ATTENTION_KEY_HANDLING_PROGRAM_NONE_NAME", "None" }, - { "USER_ATTENTION_KEY_HANDLING_PROGRAM_SYSVAL_NAME", "System Value" }, - { "USER_BUILDING_NAME", "Building" }, - { "USER_CC_MAIL_ADDRESS_NAME", "cc:Mail Address" }, - { "USER_CC_MAIL_COMMENT_NAME", "cc:Mail Comment" }, - { "USER_CHARACTER_CODE_SET_ID_NAME", "Character Code Set ID" }, - { "USER_CHARACTER_IDENTIFIER_CONTROL_NAME", "Character Identifier Control" }, - { "USER_CHARACTER_IDENTIFIER_CONTROL_DEVD_NAME", "Device Description" }, - { "USER_CHARACTER_IDENTIFIER_CONTROL_JOBCCSID_NAME", "Job CCSID" }, - { "USER_CHARACTER_IDENTIFIER_CONTROL_SYSVAL_NAME", "System Value" }, - { "USER_COMPANY_NAME", "Company" }, - { "USER_COUNTRY_ID_NAME", "Country or Region ID" }, // @D4C - { "USER_COUNTRY_ID_SYSVAL_NAME", "System Value" }, - { "USER_CURRENT_LIBRARY_NAME_NAME", "Current Library Name" }, - { "USER_CURRENT_LIBRARY_NAME_CRTDFT_NAME", "Default" }, - { "USER_DATE_PASSWORD_EXPIRES_NAME", "Date Password Expires" }, - { "USER_DAYS_UNTIL_PASSWORD_EXPIRES_NAME", "Days Until Password Expires" }, - { "USER_DEPARTMENT_NAME", "Department" }, - { "USER_DIGITAL_CERTIFICATE_INDICATOR_NAME", "Digital Certificate Indicator" }, - { "USER_DISPLAY_SIGN_ON_INFORMATION_NAME", "Display Sign-On Information" }, - { "USER_DISPLAY_SIGN_ON_INFORMATION_NO_NAME", "No" }, - { "USER_DISPLAY_SIGN_ON_INFORMATION_SYSVAL_NAME", "System Value" }, - { "USER_DISPLAY_SIGN_ON_INFORMATION_YES_NAME", "Yes" }, - { "USER_FAX_TELEPHONE_NUMBER_NAME", "Fax Telephone Number" }, - { "USER_FIRST_NAME_NAME", "First Name" }, - { "USER_FULL_NAME_NAME", "Full Name" }, - { "USER_GROUP_AUTHORITY_NAME", "Group Authority" }, - { "USER_GROUP_AUTHORITY_ALL_NAME", "All" }, - { "USER_GROUP_AUTHORITY_CHANGE_NAME", "Change" }, - { "USER_GROUP_AUTHORITY_EXCLUDE_NAME", "Exclude" }, - { "USER_GROUP_AUTHORITY_NONE_NAME", "None" }, - { "USER_GROUP_AUTHORITY_TYPE_NAME", "Group Authority Type" }, - { "USER_GROUP_AUTHORITY_TYPE_PGP_NAME", "Primary Group" }, - { "USER_GROUP_AUTHORITY_TYPE_PRIVATE_NAME", "Private" }, - { "USER_GROUP_AUTHORITY_USE_NAME", "Use" }, - { "USER_GROUP_ID_NUMBER_NAME", "Group ID Number" }, - { "USER_GROUP_MEMBER_INDICATOR_NAME", "Group Member Indicator" }, - { "USER_GROUP_PROFILE_NAME_NAME", "Group Profile Name" }, - { "USER_GROUP_PROFILE_NAME_NONE_NAME", "None" }, - { "USER_HIGHEST_SCHEDULING_PRIORITY_NAME", "Highest Scheduling Priority" }, - { "USER_HOME_DIRECTORY_NAME", "Home Directory" }, - { "USER_INDIRECT_USER_NAME", "Indirect User" }, - { "USER_INITIAL_MENU_NAME", "Initial Menu" }, - { "USER_INITIAL_MENU_SIGNOFF_NAME", "Sign-Off" }, - { "USER_INITIAL_PROGRAM_NAME", "Initial Program" }, - { "USER_INITIAL_PROGRAM_NONE_NAME", "None" }, - { "USER_JOB_DESCRIPTION_NAME", "Job Description" }, - { "USER_JOB_TITLE_NAME", "Job Title" }, - { "USER_KEYBOARD_BUFFERING_NAME", "Keyboard Buffering" }, - { "USER_KEYBOARD_BUFFERING_NO_NAME", "No" }, - { "USER_KEYBOARD_BUFFERING_SYSVAL_NAME", "System Value" }, - { "USER_KEYBOARD_BUFFERING_TYPEAHEAD_NAME", "Type-Ahead" }, - { "USER_KEYBOARD_BUFFERING_YES_NAME", "Yes" }, - { "USER_LANGUAGE_ID_NAME", "Language ID" }, - { "USER_LANGUAGE_ID_SYSVAL_NAME", "System Value" }, - { "USER_LAST_NAME_NAME", "Last Name" }, - { "USER_LIMIT_CAPABILITIES_NAME", "Limit Capabilities" }, - { "USER_LIMIT_CAPABILITIES_NO_NAME", "No" }, - { "USER_LIMIT_CAPABILITIES_PARTIAL_NAME", "Partial" }, - { "USER_LIMIT_CAPABILITIES_YES_NAME", "Yes" }, - { "USER_LIMIT_DEVICE_SESSIONS_NAME", "Limit Device Sessions" }, - { "USER_LIMIT_DEVICE_SESSIONS_NO_NAME", "No" }, - { "USER_LIMIT_DEVICE_SESSIONS_SYSVAL_NAME", "System Value" }, - { "USER_LIMIT_DEVICE_SESSIONS_YES_NAME", "Yes" }, - { "USER_LOCALE_JOB_ATTRIBUTES_NAME", "Locale Job Attributes" }, - { "USER_LOCALE_JOB_ATTRIBUTES_CCSID_NAME", "CCSID" }, - { "USER_LOCALE_JOB_ATTRIBUTES_DATFMT_NAME", "Date Format" }, - { "USER_LOCALE_JOB_ATTRIBUTES_DATSEP_NAME", "Date Separator" }, - { "USER_LOCALE_JOB_ATTRIBUTES_DECFMT_NAME", "Decimal Format" }, - { "USER_LOCALE_JOB_ATTRIBUTES_NONE_NAME", "None" }, - { "USER_LOCALE_JOB_ATTRIBUTES_SRTSEQ_NAME", "Sort Sequence" }, - { "USER_LOCALE_JOB_ATTRIBUTES_SYSVAL_NAME", "System Value" }, - { "USER_LOCALE_JOB_ATTRIBUTES_TIMSEP_NAME", "Time Separator" }, - { "USER_LOCALE_PATH_NAME_NAME", "Locale Path Name" }, - { "USER_LOCALE_PATH_NAME_C_NAME", "C" }, - { "USER_LOCALE_PATH_NAME_NONE_NAME", "None" }, - { "USER_LOCALE_PATH_NAME_POSIX_NAME", "POSIX" }, - { "USER_LOCALE_PATH_NAME_SYSVAL_NAME", "System Value" }, - { "USER_LOCAL_DATA_INDICATOR_NAME", "Local Data Indicator" }, - { "USER_LOCAL_DATA_INDICATOR_0_NAME", "Local" }, - { "USER_LOCAL_DATA_INDICATOR_1_NAME", "Shadowed" }, - { "USER_LOCATION_NAME", "Location" }, - { "USER_MAILING_ADDRESS_LINE_1_NAME", "Mailing Address Line 1" }, - { "USER_MAILING_ADDRESS_LINE_2_NAME", "Mailing Address Line 2" }, - { "USER_MAILING_ADDRESS_LINE_3_NAME", "Mailing Address Line 3" }, - { "USER_MAILING_ADDRESS_LINE_4_NAME", "Mailing Address Line 4" }, - { "USER_MAIL_NOTIFICATION_NAME", "Mail Notification" }, - { "USER_MAIL_NOTIFICATION_ALLMAIL_NAME", "All" }, - { "USER_MAIL_NOTIFICATION_NOMAIL_NAME", "None" }, - { "USER_MAIL_NOTIFICATION_SPECIFIC_NAME", "Specific" }, - { "USER_MAIL_SERVER_FRAMEWORK_SERVICE_LEVEL_NAME", "Mail Server Framework Service Level" }, - { "USER_MANAGER_CODE_NAME", "Manager Code" }, - { "USER_MAXIMUM_ALLOWED_STORAGE_NAME", "Maximum Allowed Storage" }, - { "USER_MESSAGE_NOTIFICATION_NAME", "Message Notification" }, - { "USER_MESSAGE_QUEUE_DELIVERY_METHOD_NAME", "Message Queue Delivery Method" }, - { "USER_MESSAGE_QUEUE_DELIVERY_METHOD_BREAK_NAME", "Break" }, - { "USER_MESSAGE_QUEUE_DELIVERY_METHOD_DFT_NAME", "Default" }, - { "USER_MESSAGE_QUEUE_DELIVERY_METHOD_HOLD_NAME", "Hold" }, - { "USER_MESSAGE_QUEUE_DELIVERY_METHOD_NOTIFY_NAME", "Notify" }, - { "USER_MESSAGE_QUEUE_NAME", "Message Queue" }, - { "USER_MESSAGE_QUEUE_SEVERITY_NAME", "Message Queue Severity" }, - { "USER_MIDDLE_NAME_NAME", "Middle Name" }, - { "USER_NETWORK_USER_ID_NAME", "Network User ID" }, - { "USER_NO_PASSWORD_INDICATOR_NAME", "No Password Indicator" }, - { "USER_OBJECT_AUDITING_VALUE_NAME", "Object Auditing Value" }, - { "USER_OBJECT_AUDITING_VALUE_ALL_NAME", "All" }, - { "USER_OBJECT_AUDITING_VALUE_CHANGE_NAME", "Change" }, - { "USER_OBJECT_AUDITING_VALUE_NONE_NAME", "None" }, - { "USER_OFFICE_NAME", "Office Name" }, - { "USER_OR_NAME_NAME", "O/R Name" }, - { "USER_OUTPUT_QUEUE_NAME", "Output Queue" }, - { "USER_OUTPUT_QUEUE_DEV_NAME", "Device" }, - { "USER_OUTPUT_QUEUE_WRKSTN_NAME", "Work Station" }, - { "USER_OWNER_NAME", "Owner Name" }, - { "USER_OWNER_GRPPRF_NAME", "Group Profile" }, - { "USER_OWNER_USRPRF_NAME", "User Profile" }, - { "USER_PASSWORD_CHANGE_DATE_NAME", "Password Change Date" }, - { "USER_PASSWORD_EXPIRATION_INTERVAL_NAME", "Password Expiration Interval" }, - { "USER_PREFERRED_ADDRESS_NAME", "Preferred Address" }, - { "USER_PREFERRED_NAME_NAME", "Preferred Name" }, - { "USER_PREVIOUS_SIGN_ON_NAME", "Previous Sign-On" }, - { "USER_PRINT_COVER_PAGE_NAME", "Print Cover Page" }, - { "USER_PRINT_DEVICE_NAME", "Print Device" }, - { "USER_PRINT_DEVICE_SYSVAL_NAME", "System Value" }, - { "USER_PRINT_DEVICE_WRKSTN_NAME", "Work Station" }, - { "USER_PRIORITY_MAIL_NOTIFICATION_NAME", "Priority Mail Notification" }, - { "USER_SET_PASSWORD_TO_EXPIRE_NAME", "Set Password To Expire" }, - { "USER_SIGN_ON_ATTEMPTS_NOT_VALID_NAME", "Sign-On Attempts Not Valid" }, - { "USER_SMTP_DOMAIN_NAME", "SMTP Domain" }, - { "USER_SMTP_ROUTE_NAME", "SMTP Route" }, - { "USER_SMTP_USER_ID_NAME", "SMTP User ID" }, - { "USER_SORT_SEQUENCE_TABLE_NAME", "Sort Sequence Table" }, - { "USER_SORT_SEQUENCE_TABLE_HEX_NAME", "Hex" }, - { "USER_SORT_SEQUENCE_TABLE_LANGIDSHR_NAME", "Shared-Weight" }, - { "USER_SORT_SEQUENCE_TABLE_SYSVAL_NAME", "System Value" }, - { "USER_SORT_SEQUENCE_TABLE_LANGIDUNQ_NAME", "Unique-Weight" }, - { "USER_SPECIAL_AUTHORITIES_NAME", "Special Authorities" }, - { "USER_SPECIAL_AUTHORITIES_ALLOBJ_NAME", "All Object" }, - { "USER_SPECIAL_AUTHORITIES_AUDIT_NAME", "Audit" }, - { "USER_SPECIAL_AUTHORITIES_IOSYSCFG_NAME", "I/O System Configuration" }, - { "USER_SPECIAL_AUTHORITIES_JOBCTL_NAME", "Job Control" }, - { "USER_SPECIAL_AUTHORITIES_SAVSYS_NAME", "Save System" }, - { "USER_SPECIAL_AUTHORITIES_SECADM_NAME", "Security Administrator" }, - { "USER_SPECIAL_AUTHORITIES_SERVICE_NAME", "Service" }, - { "USER_SPECIAL_AUTHORITIES_SPLCTL_NAME", "Spool Control" }, - { "USER_SPECIAL_ENVIRONMENT_NAME", "Special Environment" }, - { "USER_SPECIAL_ENVIRONMENT_NONE_NAME", "None" }, - { "USER_SPECIAL_ENVIRONMENT_S36_NAME", "System/36" }, - { "USER_SPECIAL_ENVIRONMENT_SYSVAL_NAME", "System Value" }, - { "USER_STATUS_NAME", "Status" }, - { "USER_STATUS_DISABLED_NAME", "Not Enabled" }, - { "USER_STATUS_ENABLED_NAME", "Enabled" }, - { "USER_STORAGE_USED_NAME", "Storage Used" }, - { "USER_SUPPLEMENTAL_GROUPS_NAME", "Supplemental Groups" }, - { "USER_TELEPHONE_NUMBER_1_NAME", "Telephone Number 1" }, - { "USER_TELEPHONE_NUMBER_2_NAME", "Telephone Number 2" }, - { "USER_TEXT_NAME", "Text" }, - { "USER_TEXT_DESCRIPTION_NAME", "Text Description" }, - { "USER_USER_ACTION_AUDIT_LEVEL_NAME", "User Action Audit Level" }, - { "USER_USER_ACTION_AUDIT_LEVEL_CMD_NAME", "Command" }, - { "USER_USER_ACTION_AUDIT_LEVEL_CREATE_NAME", "Create" }, - { "USER_USER_ACTION_AUDIT_LEVEL_DELETE_NAME", "Delete" }, - { "USER_USER_ACTION_AUDIT_LEVEL_JOBDTA_NAME", "Job Data" }, - { "USER_USER_ACTION_AUDIT_LEVEL_OBJMGT_NAME", "Object Management" }, - { "USER_USER_ACTION_AUDIT_LEVEL_OFCSRV_NAME", "Office Services" }, - { "USER_USER_ACTION_AUDIT_LEVEL_OPTICAL_NAME", "Optical" }, - { "USER_USER_ACTION_AUDIT_LEVEL_PGMADP_NAME", "Program Adoption" }, - { "USER_USER_ACTION_AUDIT_LEVEL_SAVRST_NAME", "Save Restore" }, - { "USER_USER_ACTION_AUDIT_LEVEL_SECURITY_NAME", "Security" }, - { "USER_USER_ACTION_AUDIT_LEVEL_SERVICE_NAME", "Service" }, - { "USER_USER_ACTION_AUDIT_LEVEL_SPLFDTA_NAME", "Spooled File Data" }, - { "USER_USER_ACTION_AUDIT_LEVEL_SYSMGT_NAME", "System Management" }, - { "USER_USER_ADDRESS_NAME", "User Address" }, - { "USER_USER_CLASS_NAME", "User Class" }, - { "USER_USER_CLASS_PGMR_NAME", "Programmer" }, - { "USER_USER_CLASS_SECADM_NAME", "Security Administrator" }, - { "USER_USER_CLASS_SECOFR_NAME", "Security Officer" }, - { "USER_USER_CLASS_SYSOPR_NAME", "System Operator" }, - { "USER_USER_CLASS_USER_NAME", "User" }, - { "USER_USER_DESCRIPTION_NAME", "User Description" }, - { "USER_USER_ID_NAME", "User ID" }, - { "USER_USER_ID_NUMBER_NAME", "User ID Number" }, - { "USER_USER_OPTIONS_NAME", "User Options" }, - { "USER_USER_OPTIONS_CLKWD_NAME", "CL Keywords" }, - { "USER_USER_OPTIONS_EXPERT_NAME", "Expert" }, - { "USER_USER_OPTIONS_HLPFULL_NAME", "Full Screen Help" }, - { "USER_USER_OPTIONS_NOSTSMSG_NAME", "No Status Message" }, - { "USER_USER_OPTIONS_PRTMSG_NAME", "Print Complete Message" }, - { "USER_USER_OPTIONS_ROLLKEY_NAME", "Roll Key" }, - { "USER_USER_OPTIONS_STSMSG_NAME", "Status Message" }, - { "USER_USER_PROFILE_NAME_NAME", "User Profile Name" }, - - // #TRANNOTE ##################################################### - // #TRANNOTE User list component MRI. - // #TRANNOTE ##################################################### - - { "USER_LIST_NAME", "User List" }, - { "USER_LIST_DESCRIPTION", "List of Users" }, - - { "USER_LIST_GROUP_PROFILE_NAME", "Group Profile" }, - { "USER_LIST_GROUP_PROFILE_NOGROUP_NAME", "No Group" }, - { "USER_LIST_GROUP_PROFILE_NONE_NAME", "None" }, - { "USER_LIST_SELECTION_CRITERIA_NAME", "Selection Criteria" }, - { "USER_LIST_SELECTION_CRITERIA_ALL_NAME", "All" }, - { "USER_LIST_SELECTION_CRITERIA_GROUP_NAME", "Group" }, - { "USER_LIST_SELECTION_CRITERIA_MEMBER_NAME", "Member" }, - { "USER_LIST_SELECTION_CRITERIA_USER_NAME", "User" }, - { "USER_LIST_USER_PROFILE_NAME", "User Profile" }, - { "USER_LIST_USER_PROFILE_ALL_NAME", "All" }, - - - - }; - -} - diff --git a/cvsroot/src/com/ibm/as400/resource/ResourceMetaData.java b/cvsroot/src/com/ibm/as400/resource/ResourceMetaData.java deleted file mode 100644 index 6d872b38a..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ResourceMetaData.java +++ /dev/null @@ -1,564 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceMetaData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.io.Serializable; -import java.lang.reflect.Array; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - - - -/** -The ResourceMetaData class represents information about a -{@link com.ibm.as400.resource.Resource Resource} -or {@link com.ibm.as400.resource.ResourceList ResourceList}. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -// -// Design notes: -// -// 1. I used the term "type" instead of "class" because Java won't let -// me call a variable "class" and it won't let me call a method -// getClass(). -// -// 3. The design of this class is meant to leave the semantics of -// the possible values to the resource implementation. For example, -// if there are different possible values depending on the -// system level or languages installed, the resource is responsible -// for generating that list on the fly and plugging it into the -// ResourceMetaData object. -// -// 4. By default, the ResourceMetaData and possible values are always considered -// to be applicable. It is possible to define the entire ResourceMetaData or -// possible values to be applicable only for certain levels. The notion -// of level is intentionally vague, and can be used to represent a release, -// a set of features, etc. -// -public class ResourceMetaData -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private static ResourceLevel defaultLevel_ = new ResourceLevel(); - - private Object id_; - private Object defaultValue_ = null; - private ResourceLevel level_ = null; - private boolean multipleAllowed_ = false; - private Hashtable possibleValues_ = new Hashtable(); - private Hashtable possibleValuePresentations_ = new Hashtable(); - private Presentation presentation_; - private boolean readOnly_; - private Class type_; - private boolean valueLimited_; - - - -/** -Constructs a ResourceMetaData object for a read-only value with no -possible values. - -@param id The ID. -@param type The type of value. -@param presentation The presentation information. -**/ - public ResourceMetaData(Object id, - Class type, - Presentation presentation) - { - this(id, type, true, null, null, false, false, presentation, null); - } - - - -/** -Constructs a ResourceMetaData object. - -@param id The ID. -@param type The type of value. -@param readOnly true if the value is read-only, - false if the value is writable. -@param possibleValues The possible values, or null if - there are none. All possible values must be - of the correct type. -@param defaultValue The default value, or null if there is no - default. -@param valueLimited true if the value is limited to - the possible values, false if other values are - allowed. -@param multipleAllowed true if multiple values are allowed. -@param presentation The presentation information. -@param possibleValuePresentations The possible value presentations, or null - if none. -**/ - public ResourceMetaData(Object id, - Class type, - boolean readOnly, - Object[] possibleValues, - Object defaultValue, - boolean valueLimited, - boolean multipleAllowed, - Presentation presentation, - Presentation[] possibleValuePresentations) - { - if (id == null) - throw new NullPointerException("id"); - if (type == null) - throw new NullPointerException("type"); - if (presentation == null) - throw new NullPointerException("presentation"); - - id_ = id; - defaultValue_ = defaultValue; - level_ = defaultLevel_; - type_ = type; - readOnly_ = readOnly; - valueLimited_ = valueLimited; - multipleAllowed_ = multipleAllowed; - presentation_ = presentation; - - if (possibleValues != null) - setPossibleValues(possibleValues, null); - - if (defaultValue != null) - validateValue(defaultValue); - - if (possibleValuePresentations != null) { - if (possibleValues == null) - throw new NullPointerException("possibleValues"); - if (possibleValuePresentations.length > possibleValues.length) - throw new ExtendedIllegalArgumentException("possibleValuePresentations", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - for(int i = 0; i < possibleValuePresentations.length; ++i) - possibleValuePresentations_.put(possibleValues[i], possibleValuePresentations[i]); - } - } - - - - private static boolean arrayCompare(byte[] a, byte[] b) - { - if (a.length != b.length) - return false; - for(int i = 0; i < a.length; ++i) { - if (a[i] != b[i]) - return false; - } - return true; - } - - -/** -Indicates if multiple values are allowed. If this is -true, then values are expressed as arrays. - -@return true if multiple values are allowed, false otherwise. -**/ - public boolean areMultipleAllowed() - { - return multipleAllowed_; - } - - - -/** -Returns the ID. - -@return The ID. -**/ - public Object getID() - { - return id_; - } - - - -/** -Returns the default value. - -@return The default value, or null if there is no default value. -**/ - public Object getDefaultValue() - { - return defaultValue_; - } - - - -/** -Returns the level for which this is supported. - -@return The level for which this is supported. -**/ - public ResourceLevel getLevel() - { - return level_; - } - - - -/** -Returns the presentation information. - -@return The presentation. -**/ - public Presentation getPresentation() - { - return presentation_; - } - - - -/** -Returns the possible values. If the value is limited to the -possible values, then the value will always be -one of these values. - -@return The possible values. The array has zero elements if - there are no possible values. -**/ - public Object[] getPossibleValues() - { - Object[] possibleValues = new Object[possibleValues_.size()]; - Enumeration values = possibleValues_.keys(); - int i = 0; - while(values.hasMoreElements()) - possibleValues[i++] = values.nextElement(); - return possibleValues; - } - - - -/** -Returns the possible values that are valid for the specified -level. If this value is limited to the possible values, -then the value will always be one of these values. - -@param level The level. -@return The possible values. The array has zero elements if - there are no possible values. -**/ - Object[] getPossibleValues(String level) - { - if (level == null) - throw new NullPointerException("level"); - - Vector possibleValuesV = new Vector(possibleValues_.size()); - Enumeration values = possibleValues_.keys(); - while(values.hasMoreElements()) { - Object possibleValue = values.nextElement(); - ResourceLevel possibleValueLevel = (ResourceLevel)possibleValues_.get(possibleValue); - if (possibleValueLevel.checkLevel(level)) - possibleValuesV.addElement(possibleValue); - } - - Object[] possibleValues = new Object[possibleValuesV.size()]; - possibleValuesV.copyInto(possibleValues); - return possibleValues; - } - - - -/** -Returns the presentation for a possible value. - -@param possibleValue The possible value. -@return The presentation for the possible value, or null if there - is no presentation available for the possible value. -**/ - public Presentation getPossibleValuePresentation(Object possibleValue) - { - if (possibleValue == null) - throw new NullPointerException("possibleValue"); - validateValue(possibleValue); - - if (possibleValuePresentations_.containsKey(possibleValue)) - return (Presentation)possibleValuePresentations_.get(possibleValue); - else - return null; - } - - - -/** -Returns the presentations for the possible values. - -@return The presentations for the possible values. - The array has zero elements if - there are no possible values. -**/ - public Presentation[] getPossibleValuePresentations() - { - Object[] possibleValues = getPossibleValues(); - Presentation[] possibleValuePresentations = new Presentation[possibleValues.length]; - for(int i = 0; i < possibleValues.length; ++i) - possibleValuePresentations[i] = getPossibleValuePresentation(possibleValues[i]); - return possibleValuePresentations; - } - - -/** -Returns the presentations for the possible values that -are valid for the specified level. - -@param level The level. -@return The presentations for the possible values. - The array has zero elements if - there are no possible values. -**/ - Presentation[] getPossibleValuePresentations(String level) - { - if (level == null) - throw new NullPointerException("level"); - - Object[] possibleValues = getPossibleValues(level); - Presentation[] possibleValuePresentations = new Presentation[possibleValues.length]; - for(int i = 0; i < possibleValues.length; ++i) - possibleValuePresentations[i] = getPossibleValuePresentation(possibleValues[i]); - return possibleValuePresentations; - } - - - - -/** -Returns the type of value. -**/ - public Class getType() - { - return type_; - } - - - -/** -Indicates if the value is read-only. - -@return true if the value is read-only, false if - the value is writable. -**/ - public boolean isReadOnly() - { - return readOnly_; - } - - - -/** -Indicates if the value is limited to the possible values. - -@return true if the value is limited to - the possible values, false if other values - are allowed. -**/ - public boolean isValueLimited() - { - return valueLimited_; - } - - - -/** -Sets the level for which this is valid. - -@param level The level for which this is valid, or null if this is - valid for all levels. -**/ - public void setLevel(ResourceLevel level) - { - if (level == null) - level_ = defaultLevel_; - else - level_ = level; - } - - - -/** -Sets the possible values for a level. If this value -is limited, then the value will always be one of these values. - -@param possibleValues The possible values, or an empty - array if there are none. All possible values - must be of the correct type. -@param level The level for which the possible values are valid, - or null if the possible values are valid for all levels. -**/ - public void setPossibleValues(Object[] possibleValues, ResourceLevel level) - { - if (possibleValues == null) - throw new NullPointerException("possibleValues"); - - Class possibleValuesType = ((multipleAllowed_) && (type_.isArray())) ? type_.getComponentType() : type_; - - for (int i = 0; i < possibleValues.length; ++i) { - if (! (possibleValuesType.isAssignableFrom(possibleValues[i].getClass()))) - throw new ExtendedIllegalArgumentException("possibleValues[" + i + "]", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - for (int i = 0; i < possibleValues.length; ++i) { - if (level == null) - possibleValues_.put(possibleValues[i], defaultLevel_); - else - possibleValues_.put(possibleValues[i], level); - } - } - - - - -/** -Returns the String representation of the ID. - -@return The String representation of the ID. -**/ - public String toString() - { - return id_.toString(); - } - - - -/** -Validates a value. - -@param value The value. -@param possibleValues The possible values. -@return The index in the possible values to which - this value is equal, or -1 if it - does not equal any of the possible values. - -@exception ExtendedIllegalArgumentException If the value is not the - correct type or the value does - not equal any of the possible values and - the value is limited. -**/ - private int validateValue(Object value, Object[] possibleValues) - { - int index = -1; - for (int i = 0; i < possibleValues.length; ++i) { - if (value.getClass().equals(byte[].class)) { - if (arrayCompare((byte[])value, (byte[])possibleValues[i])) { - index = i; - break; - } - } - else if (value.equals(possibleValues[i])) { - index = i; - break; - } - } - - if ((valueLimited_) && (index < 0)) { - throw new ExtendedIllegalArgumentException("value(" + value + ") for id(" + id_ + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - return index; - } - - - -/** -Validates an value. - -@param value The value. -@return The value. If the value should be an array and it was passed as a - single value, then this will return a 1-element array. - -@exception ExtendedIllegalArgumentException If the value is not the - correct type or the value does - not equal any of the possible values and - the value is limited. -**/ - Object validateValue(Object value) - { - if (value == null) - throw new NullPointerException("value"); - - // Validate the type. - Class valueClass = value.getClass(); - if (multipleAllowed_) { - if (valueClass.isArray()) { - if (! (type_.isAssignableFrom(valueClass.getComponentType()))) - throw new ExtendedIllegalArgumentException("value(" + value + ") type(" + valueClass + ") for id(" + id_ + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - Object[] asArray = (Object[])value; - for(int i = 0; i < asArray.length; ++i) { - if (validateValue(asArray[i], getPossibleValues()) < 0) - return value; - } - return value; - } - else { - if (! (type_.isAssignableFrom(valueClass))) - throw new ExtendedIllegalArgumentException("value(" + value + ") type(" + valueClass + ") for id(" + id_ + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - validateValue(value, getPossibleValues()); - // They passed a single value, but the processing code is expecting - // an array, so create a single element array. - Object[] asArray = (Object[])Array.newInstance(type_, 1); - asArray[0] = value; - return asArray; - } - } - else { - if (! (type_.isAssignableFrom(valueClass))) - throw new ExtendedIllegalArgumentException("value(" + value + ") type(" + valueClass + ") for id(" + id_ + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - validateValue(value, getPossibleValues()); - return value; - } - } - - - -/** -Validates an value for the specified level. - -@param value The value. -@param level The level. -@return The index in the possible values to which - this value is equal, or -1 if it - does not equal any of the possible values. - -@exception ExtendedIllegalArgumentException If the value is not the - correct type or the value does - not equal any of the possible values and - the value is limited. -**/ - int validateValue(Object value, String level) - { - if (value == null) - throw new NullPointerException("value"); - if (level == null) - throw new NullPointerException("level"); - - if (! (type_.isAssignableFrom(value.getClass()))) - throw new ExtendedIllegalArgumentException("value(" + value + ") type(" + value.getClass() + ") for id(" + id_ + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - return validateValue(value, getPossibleValues(level)); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ResourceMetaDataTable.java b/cvsroot/src/com/ibm/as400/resource/ResourceMetaDataTable.java deleted file mode 100644 index e18b61faf..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ResourceMetaDataTable.java +++ /dev/null @@ -1,380 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceMetaDataTable.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.io.Serializable; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - - - -/** -The ResourceMetaDataTable class represents a data structure for -building and maintaining a list of -{@link com.ibm.as400.resource.ResourceMetaData ResourceMetaData} -objects. This is intended for use by subclasses of -{@link com.ibm.as400.resource.Resource Resource} and -{@link com.ibm.as400.resource.ResourceList ResourceList} -implementations. This information is externalized as an array of -ResourceMetaData objects, but this class makes it easier to build -this array without knowing the number of elements ahead of time. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class ResourceMetaDataTable -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private Hashtable metaDataByID_ = new Hashtable(); - private ResourceMetaData[] metaData_ = null; - - // The presentation loader can be transient because it is only needed when - // the table is first being built. It will never be needed after a containing - // object is deserialized. - private transient PresentationLoader presentationLoader_ = null; - private transient String presentationKey_ = null; - - - -/** -Constructs a ResourceMetaDataTable object. -**/ - public ResourceMetaDataTable() - { - } - - - -/** -Constructs a ResourceMetaDataTable object. - -@param presentationLoader The presentation loader. -@param presentationKey The presentation key. -**/ - public ResourceMetaDataTable(PresentationLoader presentationLoader, - String presentationKey) - { - presentationLoader_ = presentationLoader; - presentationKey_ = presentationKey; - } - - - -/** -Constructs a ResourceMetaDataTable object. - -@param metaData The meta data, or null if none. -**/ - public ResourceMetaDataTable(ResourceMetaData[] metaData) - { - if (metaData == null) - metaData_ = new ResourceMetaData[0]; - else - metaData_ = metaData; - - for(int i = 0; i < metaData_.length; ++i) - metaDataByID_.put(metaData_[i].getID(), metaData_[i]); - } - - - - -/** -Creates and adds a ResourceMetaData object to the list. - -@param id The ID. -@param type The type of value. -@return The ResourceMetaData object. -**/ - public ResourceMetaData add(Object id, Class type) - { - return add(id, type, false, null, null, false, false); - } - - - -/** -Creates and adds a ResourceMetaData object to the list. - -@param id The ID. -@param type The type of value. -@param readOnly true if the value is read-only, - false if the value is writable. -@return The ResourceMetaData object. -**/ - public ResourceMetaData add(Object id, Class type, boolean readOnly) - { - return add(id, type, readOnly, null, null, false, false); - } - - - -/** -Creates and adds a ResourceMetaData object to the list. - -@param id The ID. -@param type The type of value. -@param defaultValue The default value. -@return The ResourceMetaData object. -**/ - public ResourceMetaData add(Object id, Class type, Object defaultValue) - { - return add(id, type, false, null, defaultValue, false, false); - } - - - -/** -Creates and adds a ResourceMetaData object to the list. - -@param id The ID. -@param type The type of value. -@param readOnly true if the value is read-only, - false if the value is writable. -@param possibleValues The possible values, or null if - there are none. All possible values must be - of the correct type. -@param defaultValue The default value, or null if there is no - default. -@param valueLimited true if the value is limited to - the possible values, false if other values are - allowed. -@return The ResourceMetaData object. -**/ - public ResourceMetaData add(Object id, Class type, boolean readOnly, - Object[] possibleValues, Object defaultValue, boolean valueLimited) - { - return add(id, type, readOnly, possibleValues, defaultValue, valueLimited, false); - } - - - -/** -Creates and adds a ResourceMetaData object to the list. - -@param id The ID. -@param type The type of value. -@param readOnly true if the value is read-only, - false if the value is writable. -@param possibleValues The possible values, or null if - there are none. All possible values must be - of the correct type. -@param defaultValue The default value, or null if there is no - default. -@param valueLimited true if the value is limited to - the possible values, false if other values are - allowed. -@param multipleAllowed true if multiple values are allowed. -@return The ResourceMetaData object. -**/ - public ResourceMetaData add(Object id, Class type, boolean readOnly, - Object[] possibleValues, Object defaultValue, boolean valueLimited, - boolean multipleAllowed) - { - return add(id, type, readOnly, possibleValues, defaultValue, valueLimited, multipleAllowed, null); - } - - - -/** -Creates and adds a ResourceMetaData object to the list. - -@param id The ID. -@param type The type of value. -@param readOnly true if the value is read-only, - false if the value is writable. -@param possibleValues The possible values, or null if - there are none. All possible values must be - of the correct type. -@param defaultValue The default value, or null if there is no - default. -@param valueLimited true if the value is limited to - the possible values, false if other values are - allowed. -@param multipleAllowed true if multiple values are allowed. -@param possibleValuePresentationKeys The possible value presentation keys, or null - if there are none. -@return The ResourceMetaData object. -**/ - public ResourceMetaData add(Object id, Class type, boolean readOnly, - Object[] possibleValues, Object defaultValue, boolean valueLimited, - boolean multipleAllowed, String[] possibleValuePresentationKeys) - { - // Load the presentation. The key suffix is the id. - Presentation presentation = null; - if (presentationLoader_ != null) - presentation = presentationLoader_.getPresentation(presentationKey_, id.toString()); - - // Load the presentations for the possible values, if any. - // Form the key suffix by removing *, adding _. - Presentation[] possibleValuePresentations = null; - if (possibleValues != null && presentationLoader_ != null) { - possibleValuePresentations = new Presentation[possibleValues.length]; - for(int i = 0; i < possibleValues.length; ++i) { - StringBuffer buffer = new StringBuffer(); - buffer.append(id); - buffer.append('_'); - - // Kludge to take into account non-String possible values. - String asString = null; - if (possibleValuePresentationKeys == null) { - if (possibleValues[i] instanceof byte[]) - asString = Byte.toString(((byte[])possibleValues[i])[0]); - else - asString = possibleValues[i].toString(); - } - else - asString = possibleValuePresentationKeys[i]; - - int length = asString.length(); - for(int j = 0; j < length; ++j) { - char ch = asString.charAt(j); - if (ch == ' ') - buffer.append('_'); - else if (ch != '*') - buffer.append(ch); - } - - // Special case. If the string is just "*", use two underscores. - // This differentiates it from "". - String keySuffix = buffer.toString(); - if (length == 1) - if (asString.charAt(0) == '*') - keySuffix = "__"; - - possibleValuePresentations[i] = presentationLoader_.getPresentation(presentationKey_, buffer.toString()); - } - } - - metaData_ = null; - ResourceMetaData rmd = new ResourceMetaData(id, type, readOnly, possibleValues, defaultValue, valueLimited, multipleAllowed, presentation, possibleValuePresentations); - metaDataByID_.put(id, rmd); - return rmd; - } - - - -/** -Returns the array of ResourceMetaData objects. This is the -externalized data structure. - -@return The array of ResourceMetaData objects. -**/ - public ResourceMetaData[] getMetaData() - { - synchronized(this) { - Vector asVector = new Vector(metaDataByID_.size()); - int i = 0; - Enumeration list = metaDataByID_.elements(); - while(list.hasMoreElements()) { - ResourceMetaData rmd = (ResourceMetaData)list.nextElement(); - asVector.addElement(rmd); - } - ResourceMetaData[] metaData = new ResourceMetaData[asVector.size()]; - asVector.copyInto(metaData); - return metaData; - } - } - - - -/** -Returns the array of ResourceMetaData objects. This is the -externalized data structure. - -@param level The current level. -@return The array of ResourceMetaData objects. -**/ - public ResourceMetaData[] getMetaData(String level) - { - if (level == null) - throw new NullPointerException("level"); - - synchronized(this) { - Vector asVector = new Vector(metaDataByID_.size()); - int i = 0; - Enumeration list = metaDataByID_.elements(); - while(list.hasMoreElements()) { - ResourceMetaData rmd = (ResourceMetaData)list.nextElement(); - if (rmd.getLevel().checkLevel(level)) { - asVector.addElement(rmd); - } - } - ResourceMetaData[] metaData = new ResourceMetaData[asVector.size()]; - asVector.copyInto(metaData); - return metaData; - } - } - - - -/** -Returns the meta data for a particular ID. - -@param id The ID. -@return The meta data. -**/ - public ResourceMetaData getMetaData(Object id) - { - return validateID(id); - } - - - -/** -Validates an ID. - -@param id The ID. -@return The meta data. -**/ - ResourceMetaData validateID(Object id) - { - if (id == null) - throw new NullPointerException("id"); - if (! metaDataByID_.containsKey(id)) - throw new ExtendedIllegalArgumentException("id(" + id.toString() + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - return (ResourceMetaData)metaDataByID_.get(id); - } - - - -/** -Validates multiple IDs. - -@param id The IDs. -**/ - void validateIDs(Object[] id) - { - if (id == null) - throw new NullPointerException("id"); - for(int i = 0; i < id.length; ++i) { - if (! metaDataByID_.containsKey(id[i])) - throw new ExtendedIllegalArgumentException("id[" + i + "](" + id.toString() + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ResourcePool.java b/cvsroot/src/com/ibm/as400/resource/ResourcePool.java deleted file mode 100644 index 97ffdde88..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ResourcePool.java +++ /dev/null @@ -1,189 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourcePool.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.Trace; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.util.Hashtable; - - - -/** -The ResourcePool class represents a pool to store Resource objects -for potential lookup and reuse. For example, if a class is maintaining -several resource lists which may contain multiple objects representing -the same resource, it can use a ResourcePool object to efficiently -manage and reuse them. Such reuse may potentially reduce storage -requirements, but may also improve semantics where changes made in one -context will be reflected in other contexts. - -

    The ResourcePool class maintains reference counts for each -registered resource. It keeps a reference to a resource as long as the -reference count is greater than zero. Therefore, it is important -to carefully manage a ResourcePool and ensure that all resources -are registered and deregistered the same number of times. Otherwise -a memory leak can result. - -

    The caller can create and manage its own static or non-static -ResourcePool object or it can use the global static ResourcePool -defined in this class. -**/ -// -// Design notes: -// -// 1. If another class declares its own ResourcePool object, I believe -// that it should be declared as transient, since it would not really -// make sense to serialize a pool. -// -class ResourcePool -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private static final int TRACE_INCREMENT_ = 100; - - private transient Hashtable resources_ = new Hashtable(); - private transient Hashtable referenceCounts_ = new Hashtable(); - - - -/** -Global static resource pool. -**/ - public static final ResourcePool GLOBAL_RESOURCE_POOL = new ResourcePool(); - - - -/** -Clears the pool. -**/ - public void clear() - { - synchronized(this) { - resources_.clear(); - referenceCounts_.clear(); - } - } - - - -/** -Deregisters a resource. If the resource is registered multiple times, -it is not removed from the pool until it is deregistered the -same number of times. - -@param resource The resource. -**/ - public void deregister(Resource resource) - { - if (resource == null) - throw new NullPointerException("resource"); - - Object resourceKey = resource.getResourceKey(); - long referenceCount = -1; - boolean deregister = false; - synchronized(resources_) { - if (resources_.containsKey(resourceKey)) { - deregister = true; - referenceCount = --((long[])referenceCounts_.get(resourceKey))[0]; - if (referenceCount == 0) { - resources_.remove(resourceKey); - referenceCounts_.remove(resourceKey); - - if (Trace.isTraceOn()) { - int size = resources_.size(); - if (size % TRACE_INCREMENT_ == 0) - Trace.log(Trace.INFORMATION, "Resource pool " + this + " contains " + size + " resources."); - } - } - } - } - } - - - -/** -Returns a registered resource. This does not affect -the reference count. - -@param resourceKey Identifies the resource. -@return The resource, or null if the identified resource - is not found. -**/ - public Resource getResource(Object resourceKey) - { - if (resourceKey == null) - throw new NullPointerException("resourceKey"); - - return (Resource)resources_.get(resourceKey); - } - - - -/** -Registers a resource. If a resource with the same resource ID already -exists, it is not replaced, but its reference count is increased. - -@param resource The resource. -**/ - public void register(Resource resource) - { - register(resource, false); - } - - - -/** -Registers a resource. If a resource with the same resource ID already -exists, it will be optionally replaced, and its reference count is -increased. - -@param resource The resource. -@param replace true if a resource with the same resource ID - is replaced, false otherwise. -**/ - public void register(Resource resource, boolean replace) - { - if (resource == null) - throw new NullPointerException("resource"); - - Object resourceKey = resource.getResourceKey(); - long referenceCount; - synchronized(this) { - if (resources_.containsKey(resourceKey)) { - if (replace) - resources_.put(resourceKey, resource); - referenceCount = ++((long[])referenceCounts_.get(resourceKey))[0]; - } - else { - resources_.put(resourceKey, resource); - referenceCounts_.put(resourceKey, new long[] { 1 }); - referenceCount = 1; - - if (Trace.isTraceOn()) { - int size = resources_.size(); - if (size % TRACE_INCREMENT_ == 0) - Trace.log(Trace.INFORMATION, "Resource pool " + this + " contains " + size + " resources."); - } - } - } - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/SubstringValueMap.java b/cvsroot/src/com/ibm/as400/resource/SubstringValueMap.java deleted file mode 100644 index 61db534a5..000000000 --- a/cvsroot/src/com/ibm/as400/resource/SubstringValueMap.java +++ /dev/null @@ -1,107 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SubstringValueMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; - - - -/** -The SubstringValueMap class maps a logical value as a substring -of a physical value. This only makes sense mapping from -a physical value to a logical value. -**/ -class SubstringValueMap -extends AbstractValueMap -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - - // Private data. - private int offset_ = 0; - private int length_ = -1; - private boolean trim_ = false; - - - -/** -Constructs a SubstringValueMap object. - -@param offset The offset of the logical value within the - physical value. -@param length The length of the logical value within the - physical value. Specify -1 to indicate - that the logical value extends to the end - of the physical value. -@param trim true if the logical value should be trimmed, - false otherwise. -**/ - public SubstringValueMap(int offset, int length, boolean trim) - { - offset_ = offset; - length_ = length; - trim_ = trim; - } - - - -/** -Maps from a physical value to a logical value. - -@param physicalValue The physical value. -@return The logical value. -**/ - public Object ptol(Object physicalValue) - { - // Validate the physical value. - if (physicalValue == null) - throw new NullPointerException("physicalValue"); - if (!(physicalValue instanceof String)) - throw new ExtendedIllegalArgumentException("physicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - String asString = (String)physicalValue; - int endOffset = offset_ + length_; - String logicalValue = null; - - // If the offset is greater than the length of the - // physical value, then just return an empty string. - if (offset_ > asString.length()) - logicalValue = ""; - - // If the length is less than zero, then return the - // substring to the end of the physical value. - else if (length_ < 0) - logicalValue = asString.substring(offset_); - - // If the end offset is greater than the length - // of the physical value, then go to the end of the - // physical value. - else if (endOffset > asString.length()) - logicalValue = asString.substring(offset_); - - // Otherwise, return the appropriate substring. - else - logicalValue = asString.substring(offset_, endOffset); - - return trim_ ? logicalValue.trim() : logicalValue; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/SystemResourceList.java b/cvsroot/src/com/ibm/as400/resource/SystemResourceList.java deleted file mode 100644 index c148f6f43..000000000 --- a/cvsroot/src/com/ibm/as400/resource/SystemResourceList.java +++ /dev/null @@ -1,624 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemResourceList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.Trace; -import com.ibm.as400.data.PcmlException; -import com.ibm.as400.data.ProgramCallDocument; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.util.Hashtable; - - - -/** -Retrieves list items using IBM i "Open List" -Application Programming Interfaces (APIs). This class is intended -to be extended and customized by subclasses. -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public class SystemResourceList -extends BufferedResourceList -{ - static final long serialVersionUID = 4L; - - // Private data. - private static final String closeProgramName_ = "qgyclst"; - private static final String requestHandleDataNameSuffix_ = ".requestHandle"; - private static final String closeRequestHandleDataName_ = "qgyclst.requestHandle"; - private static final String getProgramName_ = "qgygtle"; - private static final String getNumberOfRecordsToReturnDataName_ = "qgygtle.numberOfRecordsToReturn"; - private static final String getRequestHandleDataName_ = "qgygtle.requestHandle"; - private static final String getStartingRecordDataName_ = "qgygtle.startingRecord"; - private static final String listInformationDataNameSuffix_ = ".listInformation"; - private static final String listStatusIndicatorDataNameSuffix_ = ".listInformation.listStatusIndicator"; - private static final String receiverVariableLengthDataName_ = "qgygtle.receiverVariableLength"; - private static final String recordsReturnedDataNameSuffix_ = ".listInformation.recordsReturned"; - private static final String requestHandleDataNameSuffix2_ = ".listInformation.requestHandle"; - private static final String totalRecordsDataNameSuffix_ = ".listInformation.totalRecords"; - - private String formatName_ = null; - private String openListProgramName_ = null; - private ProgramMap selectionMap_ = null; - private Hashtable selectionBidiStringTypes_ = new Hashtable(); // @A2A - - private transient ProgramCallDocument document_ = null; - private transient int formatLength_ = -1; - private transient byte[] requestHandle_ = null; - - - -/** -Constructs a SystemResourceList object. - -@param presentation The presentation, or null if not applicable. -@param attributes The attributes, or null if not applicable. -@param selections The selections, or null if not applicable. -@param sorts The sorts, or null if not applicable. -@param openListProgramName The open list program name. -@param formatName The format name for each item in the list, - or null if not needed. -@param selectionMap The program map which maps selection values in the - resource list to parameters in the PCML document, - or null if this should not be used. -**/ - SystemResourceList(Presentation presentation, - ResourceMetaDataTable attributes, - ResourceMetaDataTable selections, - ResourceMetaDataTable sorts, - String openListProgramName, - String formatName, - ProgramMap selectionMap) - { - super(presentation, attributes, selections, sorts); - initializeTransient(); - - if (openListProgramName == null) - throw new NullPointerException("openListProgramName"); - - openListProgramName_ = openListProgramName; - formatName_ = formatName; - selectionMap_ = selectionMap; - } - - - -/** -Closes the list. No further resources can be loaded. The list -must be closed in order to clean up resources appropriately. -This method has no effect if the list is already closed. -This method fires a listClosed() ResourceListEvent. - -@exception ResourceException If an error occurs. -**/ - public void close() - throws ResourceException - { - if (!isOpen()) - return; - - super.close(); - - fireBusy(); - try { - // Close the list by calling the close list API. - if ((document_ != null) && (requestHandle_ != null)) { - document_.setValue(closeRequestHandleDataName_, requestHandle_); - if (document_.callProgram(closeProgramName_) == false) - throw new ResourceException(document_.getMessageList(closeProgramName_)); - } - } - catch (ResourceException e) { - AS400Message[] msgList = e.getMessageList(); - if (msgList != null && msgList.length > 0 && - msgList[0].getID().equals("GUI0001")) // "Invalid handle specified" - { - // Tolerate the error, and continue. - // Note that it's already been traced by the exception ctor. - } - else throw e; // rethrow it - - } - catch(PcmlException e) { - throw new ResourceException(e); - } - finally { - // Done with the request handle. - requestHandle_ = null; // Ensure we don't try to keep using this handle. - - fireIdle(); - } - } - - - -/** -Returns the PCML document. - -@return The PCML document. -**/ - ProgramCallDocument getDocument() - { - return document_; - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient() - { - formatLength_ = -1; - - } - - - -// @A2A -/** -Indicates if this resource is enabled for bidirectional character conversion. -This always returns true. - -@return Always true. -**/ - protected boolean isBidiEnabled() - { - return true; - } - - - -/** -Indicates if the resource is available. This means that the -resource has been loaded. - -@param index The index. -@return true if the resource is available, - false if the resource is not available - or the list is not open. - -@exception ResourceException If an error occurs. -**/ - public boolean isResourceAvailable(long index) - throws ResourceException - { - // First check to see if the resource is already buffered in the superclass. - boolean isAvailable = super.isResourceAvailable(index); - - // If not... and if the list is open... - if ((! isAvailable) && (isOpen())) { - - // Refresh the status, which will include the current list length. - loadResources(0, 0); - - // If this index is less than the length, then its available. - isAvailable = (index < getListLength()); - } - - return isAvailable; - } - - - - -/** -Loads a part of the list. - -@param startIndex The start index (1-based). If this is 0, - then immediately refresh the list status. - If this is -1, then wait for the entire - list to complete. If this is greater than - 0, then wait for the indexed list item - to be built. -@param length The number of resources to load. If this - is 0, then refresh only the list status. - -@exception ResourceException If an error occurs. -**/ - private void loadResources(long startIndex, long length) - throws ResourceException - { - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Loading resources (" + startIndex + ", " + length + ") from list " + this + "."); - - fireBusy(); - try { - // Set the receiver variable length. This only needs - // to be set if a format name was provided in the constructor. - // Otherwise, we will assume its been initialized in the - // PCML. - if (formatName_ != null) { - if (formatLength_ == -1) - formatLength_ = document_.getOutputsize(formatName_); - if (length == 0) - document_.setIntValue(receiverVariableLengthDataName_, 1); // 0 causes problems. - else - document_.setIntValue(receiverVariableLengthDataName_, (int)length*formatLength_); - } - - // Set some other API parameters. - document_.setValue(getRequestHandleDataName_, requestHandle_); - document_.setIntValue(getNumberOfRecordsToReturnDataName_, (int)length); - document_.setIntValue(getStartingRecordDataName_, (int)startIndex); - - // Call the API. - if (document_.callProgram(getProgramName_) == false) - throw new ResourceException(document_.getMessageList(getProgramName_)); - - // Process the returned information. - process(getProgramName_, startIndex - 1); // process() is 0-based. - } - catch(PcmlException e) { - throw new ResourceException(e); - } - finally { - fireIdle(); - } - } - - - -/** -Creates and returns a new resource based on a record returned -from an API call. A subclass must implement this method. - -@param programName The program name. -@param indices The indices. These indicate which record - to use. -@return The new resource. - -@exception PcmlException If a PCML error occurs. -@exception ResourceException If an error occurs. -**/ - Resource newResource(String programName, - int[] indices) - throws PcmlException, ResourceException - { - throw new ResourceException(); - } - - - -/** -Opens the list. The list must be open in order to -perform most operations. This method has no effect -if the list is already opened. - -@exception ResourceException If an error occurs. -**/ - public void open() - throws ResourceException - { - if (isOpen()) - return; - - super.open(); - - fireBusy(); - try { - synchronized(this) { - - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); - - try { - // Set the open parameters. - setOpenParameters(document_); - - // Call the program. - boolean success = document_.callProgram(openListProgramName_); - if (!success) - throw new ResourceException(document_.getMessageList(openListProgramName_)); - requestHandle_ = (byte[])document_.getValue(openListProgramName_ + requestHandleDataNameSuffix2_); - process(openListProgramName_, 0); - } - catch(Exception e) { - // We will mostly catch PcmlExceptions here, but there will be - // occasion when IllegalArguementExceptions are thrown by the - // text conversion classes. - throw new ResourceException(e); - } - } - } - finally { - fireIdle(); - } - } - - - -/** -Process information returned from either the open or get APIs. This method -will take that information and create new Resources for it. - -@param programName The program name. -@param startIndex The start index (0-based). - -@exception PcmlException If a PCML error occurs. -@exception ResourceException If an error occurs. -**/ - private void process(String programName, long startIndex) - throws PcmlException, ResourceException - { - // For each record that was returned... - int recordsReturned = document_.getIntValue(programName + recordsReturnedDataNameSuffix_); - for(int i = 0; i < recordsReturned; ++i) { - int[] indices = { i }; - - // Manufacture a new resource. - Resource resource = newResource(programName, indices); - - // Notify listeners. - fireResourceAdded(resource, startIndex + i); - } - - // Fire any other necessary events. - String listStatusIndicator = (String)document_.getValue(programName + listStatusIndicatorDataNameSuffix_); - long newLength = document_.getIntValue(programName + totalRecordsDataNameSuffix_); - - if (Trace.isTraceOn()) { - Trace.log(Trace.INFORMATION, "API List status indicator = " + listStatusIndicator); - Trace.log(Trace.INFORMATION, "API List length = " + newLength); - } - - if (listStatusIndicator.equals("2")) - fireListCompleted(); - else if (listStatusIndicator.equals("3")) - fireListInError(); - if (newLength != getListLength()) - fireLengthChanged(newLength); - } - - - - -/** -Deserializes the resource list. -**/ - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient (); - } - - - -/** -Refreshes the contents of the list. - -

    This will implicitly open the list if needed. - -@exception ResourceException If an error occurs. -**/ - public void refreshContents() - throws ResourceException - { - // Establish the connection if needed. - if (! isConnectionEstablished()) - establishConnection(); - - // Close to force a re-open. - if (isOpen()) - close(); - - super.refreshContents(); - } - - - -/** -Refreshes the status of the list. The status includes -the length and whether the list is completed or in error. -If the list is complete, this method has no effect. - -

    This method does not refresh the contents of the list. Use -{@link #refreshContents refreshContents()} to refresh -the contents of the list. - -

    This will implicitly open the list if needed. - -@exception ResourceException If an error occurs. -**/ - public void refreshStatus() - throws ResourceException - { - super.refreshStatus(); - loadResources(0, 0); - } - - - -/** -Returns the resource specified by the index. - -

    This will implicitly open the list if needed. - -@param index The index. -@return The resource specified by the index, or null - if the resource is not yet available. - -@exception ResourceException If an error occurs. -**/ - public Resource resourceAt(long index) - throws ResourceException - { - synchronized(this) { - - // It may already be here. - Resource resource = super.resourceAt(index); - - // If not, try to load it. - if (resource == null) { - loadResources(index + 1, getPageSize()); // loadResources() is 1-based - resource = super.resourceAt(index); - - // If the resource is STILL null, it means that the buffer - // swapped out the resource during loading. This happens - // only when the number of pages is 1. The simplest - // workaround is to reload the single resource. - if (resource == null) { - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Double load scenario, index=" + index + - ", number of pages= " + getNumberOfPages() + ", page size=" - + getPageSize()); - - loadResources(index + 1, getPageSize()); // loadResource() is 1-based - resource = super.resourceAt(index); - } - } - - return resource; - } - } - - - -/** -Sets the parameters for the open API. This uses the selection map -to copy selection values from the resource list to the parameters -in the PCML document. - -

    If different settings are needed, then override this method. - -@param document The document. - -@exception PcmlException If a PCML error occurs. -@exception ResourceException If a Resource error occurs. -**/ - void setOpenParameters(ProgramCallDocument document) - throws PcmlException, ResourceException - { - if (selectionMap_ != null) { - - // Copy the selection values from the resource list to the - // parameters in the PCML document. - ResourceMetaData[] selectionMetaData = getSelectionMetaData(); - Object[] ids = new Object[selectionMetaData.length]; - Object[] values = new Object[selectionMetaData.length]; - int[] bidiStringTypes = new int[selectionMetaData.length]; // @A2A - for(int i = 0; i < selectionMetaData.length; ++i) { - ids[i] = selectionMetaData[i].getID(); - values[i] = getSelectionValue(ids[i]); - Integer selectionBidiStringType = (Integer)selectionBidiStringTypes_.get(ids[i]); // @A2A - if (selectionBidiStringType == null) // @A2A - bidiStringTypes[i] = getDefaultBidiStringType(); // @A2A - else // @A2A - bidiStringTypes[i] = selectionBidiStringType.intValue(); // @A2A - } - selectionMap_.setValues(ids, values, getSystem(), document, openListProgramName_, null, bidiStringTypes); // @A2C - } - } - - - -/** -Sets the PCML document. - -@param document The PCML document. -**/ - void setDocument(ProgramCallDocument document) - { - if (document == null) - throw new NullPointerException("document"); - - document_ = document; - - AS400 system = getSystem(); - if (system != null) - document_.setSystem(system); - } - - - - void setOpenListProgramName(String openListProgramName) - { - if (openListProgramName == null) - throw new NullPointerException("openListProgramName"); - - openListProgramName_ = openListProgramName; - } - - - -// @A2A -/** -Sets the current value of a selection. The changed selection -value will take effect the next time the list is opened -or refreshed. - -@param selectionID Identifies the selection. -@param value The selection value, or null to remove - the selection. -@param bidiStringType The bidi string type as defined by the CDRA (Character Data - Representataion Architecture). See - {@link com.ibm.as400.access.BidiStringType BidiStringType} - for more information and valid values. - -@exception ResourceException If an error occurs. -**/ - public void setSelectionValue(Object selectionID, Object value, int bidiStringType) - throws ResourceException - { - super.setSelectionValue(selectionID, value, bidiStringType); - - selectionBidiStringTypes_.put(selectionID, new Integer(bidiStringType)); - } - - - - -/** -Waits until the list is completely loaded. - -

    This will implicitly open the list if needed. - -@exception ResourceException If an error occurs. -**/ - public void waitForComplete() - throws ResourceException - { - super.waitForComplete(); - if (!isComplete()) - loadResources(-1, 0); - } - - - -/** -Waits until the resource is available or the list is -complete. - -

    This will implicitly open the list if needed. - -@param index The index. - -@exception ResourceException If an error occurs. -**/ - public void waitForResource(long index) - throws ResourceException - { - super.waitForResource(index); - if (isComplete()) - return; - if (!isResourceAvailable(index)) - loadResources(index + 1, 0); // loadResource() is 1-based - } - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/UpperCaseValueMap.java b/cvsroot/src/com/ibm/as400/resource/UpperCaseValueMap.java deleted file mode 100644 index 80726a2aa..000000000 --- a/cvsroot/src/com/ibm/as400/resource/UpperCaseValueMap.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UpperCaseValueMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.io.Serializable; - - -/** -The UpperCaseValueMap class maps between a logical String value -and a physical String value. It ensures that the physical String -value will be all uppercase characters. -**/ -class UpperCaseValueMap -extends AbstractValueMap -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - static final long serialVersionUID = 4L; - - - -/** -Maps from a logical value to a physical value. - -@param logicalValue The logical value. -@return The physical value. -**/ - public Object ltop(Object logicalValue) - { - if (logicalValue == null) - throw new NullPointerException("logicalValue"); - if (!(logicalValue instanceof String)) - throw new ExtendedIllegalArgumentException("logicalValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - return ((String)logicalValue).toUpperCase(); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/ValueMap.java b/cvsroot/src/com/ibm/as400/resource/ValueMap.java deleted file mode 100644 index 76764e04b..000000000 --- a/cvsroot/src/com/ibm/as400/resource/ValueMap.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ValueMap.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.resource; - -import com.ibm.as400.access.AS400; - - - -/** -The ValueMap interface represents a mapping between physical and -logical values. While this could be used in many contexts, the -most common is to consider the physical value as stored on or -communicated to a system, and the logical value to be manipulated -or externalized in Java. - -

    This class is intended as a helper class for implementing subclasses -of {@link com.ibm.as400.resource.Resource Resource}. - -@see AbstractValueMap -@deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -**/ -public interface ValueMap -{ - - - -/** -Maps from a logical value to a physical value. - -@param logicalValue The logical value. -@param system The system. -@return The physical value. -**/ - public abstract Object ltop(Object logicalValue, AS400 system); - - - -/** -Maps from a physical value to a logical value. - -@param physicalValue The physical value. -@param system The system. -@return The logical value. -**/ - public abstract Object ptol(Object physicalValue, AS400 system); - - -} diff --git a/cvsroot/src/com/ibm/as400/resource/package.html b/cvsroot/src/com/ibm/as400/resource/package.html deleted file mode 100644 index 66eb9e304..000000000 --- a/cvsroot/src/com/ibm/as400/resource/package.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - -Deprecated Provides classes that represent IBM i resources using a generic list-based scheme. - -

    -This package has been deprecated, and is no longer being enhanced. Users are advised to use packages com.ibm.as400.access and com.ibm.as400.access.list instead. -

    - -

    -These classes use buffering, transaction control, and list manipulation to -improve the performance and manageability of lists of resources on the system. -

    - -

    -Some of the components in the com.ibm.as400.access package have counterparts that -are represented as resources. For example, RJobList is the com.ibm.as400.resource -version of the JobList class in the access package. -

    - - -

    Related Documentation

    - -For overviews, tutorials, examples, guides, and tool documentation, please see: - - - - diff --git a/cvsroot/src/com/ibm/as400/security/SecurityMRI.java b/cvsroot/src/com/ibm/as400/security/SecurityMRI.java deleted file mode 100644 index 7aa52d0f5..000000000 --- a/cvsroot/src/com/ibm/as400/security/SecurityMRI.java +++ /dev/null @@ -1,140 +0,0 @@ -package com.ibm.as400.security; - -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SecurityMRI.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -import java.util.*; -/** - * Defines locale-specific objects for security-related - * components of the IBM Toolbox for Java. - **/ -public class SecurityMRI extends ListResourceBundle -{ - // NLS_MESSAGEFORMAT_NONE - // Each string is assumed NOT to be processed by the MessageFormat class. - // This means that a single quote must be coded as 1 single quote. - - // NLS_ENCODING=UTF-8 - // Instructs the translation tools to interpret the text as UTF-8. - - // Note: It is a build/translation requirement that this NOT refer - // to the Copyright class. The requirement is that the MRI - // builds do not depend on the code builds.) - private final static Object[][] resources= { - // #TRANNOTE ##################################################### - // #TRANNOTE Before you add a new resource, please make - // #TRANNOTE sure you are not duplicating another. The goal is to - // #TRANNOTE keep the amount of translatable text down. - // #TRANNOTE - // #TRANNOTE NOTE TO TRANSLATORS: The format of a line of MRI is - // #TRANNOTE { "KEY", "value" }, - // #TRANNOTE - // #TRANNOTE The key must be left alone. Translate only the value. - // #TRANNOTE ##################################################### - - // #TRANNOTE ##################################################### - // #TRANNOTE Short descriptions and display names for properties. - // #TRANNOTE Descriptions start with PROP_DESC_ prefix, display - // #TRANNOTE names start with PROP_NAME. - // #TRANNOTE ##################################################### - - // #TRANNOTE ##################################################### - // #TRANNOTE Common AS400Credential properties. - // #TRANNOTE ##################################################### - { "PROP_NAME_CR_CURRENT", "current" }, - { "PROP_DESC_CR_CURRENT", "Valid for authentication purposes." }, - - { "PROP_NAME_CR_DESTROYED", "destroyed" }, - { "PROP_DESC_CR_DESTROYED", "Is destroyed." }, - - { "PROP_NAME_CR_PRINCIPAL", "principal" }, - { "PROP_DESC_CR_PRINCIPAL", "The associated principal." }, - - { "PROP_NAME_CR_RENEWABLE", "renewable" }, - { "PROP_DESC_CR_RENEWABLE", "Capable of being refreshed." }, - - { "PROP_NAME_CR_TIMED", "timed" }, - { "PROP_DESC_CR_TIMED", "Expires based on time." }, - - { "PROP_NAME_CR_TIMETOEXPIRATION", "timeToExpiration" }, - { "PROP_DESC_CR_TIMETOEXPIRATION", "The number of seconds before expiration." }, - - // #TRANNOTE ##################################################### - // #TRANNOTE Password credential properties. - // #TRANNOTE ##################################################### - { "PROP_NAME_CR_PW_PASSWORD", "password" }, - { "PROP_DESC_CR_PW_PASSWORD", "The password value." }, - - // #TRANNOTE ##################################################### - // #TRANNOTE Profile Handle credential properties. - // #TRANNOTE ##################################################### - { "PROP_NAME_CR_PH_HANDLE", "handle" }, - { "PROP_DESC_CR_PH_HANDLE", "The profile handle bytes." }, - - // #TRANNOTE ##################################################### - // #TRANNOTE Profile Token credential properties. - // #TRANNOTE ##################################################### - { "PROP_NAME_CR_PT_TIMEOUTINTERVAL", "timeoutInterval" }, - { "PROP_DESC_CR_PT_TIMEOUTINTERVAL", "The number of seconds before expiration assigned when the token is created or refreshed." }, - - { "PROP_NAME_CR_PT_TOKEN", "token" }, - { "PROP_DESC_CR_PT_TOKEN", "The profile token bytes." }, - - { "PROP_NAME_CR_PT_TYPE", "type" }, - { "PROP_DESC_CR_PT_TYPE", "The profile token type." }, - - // #TRANNOTE ##################################################### - // #TRANNOTE Common AS400Principal properties. - // #TRANNOTE ##################################################### - { "PROP_NAME_PR_NAME", "name" }, - { "PROP_DESC_PR_NAME", "The principal name." }, - - { "PROP_NAME_PR_USERPROFILENAME", "userProfileName" }, - { "PROP_DESC_PR_USERPROFILENAME", "The user profile name." }, - - { "PROP_NAME_PR_USER", "user" }, - { "PROP_DESC_PR_USER", "The associated User object." }, - - // #TRANNOTE ##################################################### - // #TRANNOTE Short descriptions and display names for events. - // #TRANNOTE Descriptions start with EVT_DESC_ prefix, display - // #TRANNOTE names start with EVT_NAME. - // #TRANNOTE ##################################################### - { "EVT_NAME_CR_EVENT", "credentialEvent" }, - { "EVT_DESC_CR_EVENT", "A credential event has occurred." }, - - // #TRANNOTE ##################################################### - // #TRANNOTE Dialog MRI. - // #TRANNOTE ##################################################### - - // #TRANNOTE ##################################################### - // #TRANNOTE Common exception messages. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix EXC_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE ##################################################### - - // #TRANNOTE ##################################################### - // #TRANNOTE The following are error and informational messages. - // #TRANNOTE ##################################################### - }; -/** - * Returns the array of all locale-specific - * objects defined. - * - */ -public Object[][] getContents() { - return resources; -} -} - diff --git a/cvsroot/src/com/ibm/as400/security/auth/AS400AuthenticationException.java b/cvsroot/src/com/ibm/as400/security/auth/AS400AuthenticationException.java deleted file mode 100644 index aac23a47e..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/AS400AuthenticationException.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.ibm.as400.security.auth; - -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400AuthenticationException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.AS400SecurityException; -/** - * The AS400AuthenticationException class and subclasses - * represent exceptions issued when errors occur - * during system authentication. - * - */ -public class AS400AuthenticationException extends AS400SecurityException { - - static final long serialVersionUID = 4L; - - private AS400Message[] msgList_ = null; - -/** - * Constructs an AS400AuthenticationException with - * unknown return code. - * - */ -AS400AuthenticationException() { - this(UNKNOWN); -} -/** - * Constructs an AS400AuthenticationException. - * - *

    An appropriate return code is assigned based on - * the provided messages. - * - * @param list - * The AS400Message objects to be associated - * with the exception. - * - */ -AS400AuthenticationException(AS400Message[] list) { - this(getReturnCode(list)); - msgList_ = list; -} -/** - * Constructs an AS400AuthenticationException. - * - * @param rc - * The return code identifying the detail text - * to assign to the exception. - * - */ -AS400AuthenticationException(int rc) { - super(rc); -} -/** - * Returns the AS400Message causing the exception. - * - * @return - * The message causing the exception; null - * if not available. - * - */ -public AS400Message getAS400Message() { - if (msgList_ != null && msgList_.length > 0) - return msgList_[0]; - return null; -} -/** - * Returns the list of AS400Messages causing the exception. - * - * @return - * An array of messages causing the exception; - * null if not available. - * - */ -public AS400Message[] getAS400MessageList() { - return msgList_; -} -/** - * Returns the text associated with the return code. - * - * @param returnCode - * The return code associated with this exception. - * - * @return - * The text string which describes the error. - * - */ -static int getReturnCode(AS400Message[] list) { - for (int i=0; i> " + getAS400Message().toString()); - return sb.toString(); -} -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/AS400BasicAuthenticationCredential.java b/cvsroot/src/com/ibm/as400/security/auth/AS400BasicAuthenticationCredential.java deleted file mode 100644 index d85f784f3..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/AS400BasicAuthenticationCredential.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.ibm.as400.security.auth; - -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400BasicAuthenticationCredential.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -/** - * The AS400BasicAuthenticationCredential interface defines IBM i - * credentials that can be exploited by authentication services - * that rely on basic user and password authentication. - * - */ -public interface AS400BasicAuthenticationCredential { - -/** - * Returns text that can be displayed to prompt for the basic user - * and password information used to initialize the credential. - * - * @return - * An array of two Strings. The first string is the text to - * prompt for the user name; the second is the text to - * prompt for the password. - * - */ -public String[] basicAuthenticationPrompt(); -/** - * Initializes and validates a credential for the local IBM i system. - * - * @param principal - * The principal identifying the authenticated user. - * - * @param password - * The password for the authenticated user. - * - * @param isPrivate - * Indicates whether the credential is considered private. - * - * @param isReusable - * true if the credential can be used to swap - * thread identity multiple times; - * otherwise false. - * - * @param isRenewable - * true if the validity period of the credential - * can be programmatically updated or extended; - * otherwise false. - * - * @param timeoutInterval - * The number of seconds to expiration when the credential - * is initially created; ignored if the credential - * does not expire based on time. - * - * @exception Exception - * If an exception occurs. - * - */ -public void initialize(AS400BasicAuthenticationPrincipal principal, String password, - boolean isPrivate, boolean isReusable, boolean isRenewable, - int timeoutInterval) throws Exception; -/** - * Indicates whether the credential is considered private. - * - *

    This value can be referenced by authentication services - * as an indication of when to check permissions or otherwise - * protect access to sensitive credentials. - * - * @return - * true if private; false if public. - */ -public boolean isPrivate(); -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/AS400BasicAuthenticationPrincipal.java b/cvsroot/src/com/ibm/as400/security/auth/AS400BasicAuthenticationPrincipal.java deleted file mode 100644 index d5a06140d..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/AS400BasicAuthenticationPrincipal.java +++ /dev/null @@ -1,46 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400BasicAuthenticationPrincipal.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2005 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.security.auth; - -import java.security.Principal; - -/** - * The AS400BasicAuthenticationPrincipal interface defines IBM i - * principals that can be exploited by authentication services - * that rely on basic user and password authentication. - * - */ -public interface AS400BasicAuthenticationPrincipal extends Principal { - -/** - * Returns the user profile name. - * - * @return - * A String containing the name; empty if not assigned. - * - */ -public String getUserProfileName(); -/** - * Initializes a principal for the local IBM i system - * based on the given user profile name. - * - * @param name - * The profile name. - * - * @exception Exception - * If an exception occurs. - * - */ -public void initialize(String name) throws Exception; -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/AS400Credential.java b/cvsroot/src/com/ibm/as400/security/auth/AS400Credential.java deleted file mode 100644 index 83c88b029..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/AS400Credential.java +++ /dev/null @@ -1,1430 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Credential.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.security.auth; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Vector; - -/** - * Provides an abstract superclass for - * representations of IBM i system security-related attributes. - * - *

    Credentials may be used for authenticating to system - * services, or may simply enable certain actions to - * be performed. - * - *

    Typical IBM i system credentials include, but are not - * limited to, profile tokens. - * - *

    This abstract class must be subclassed to provide - * specific credential functions. Each subclass can - * contain credential data that may be security-sensitive. - * It is the responsibility of each class to provide - * appropriate access controls to sensitive data. - * - *

    AS400Credential objects generate the following events: - *

      - *
    • AS400CredentialEvent - *
        - *
      • CR_CREATE - *
      • CR_DESTROY - *
      • CR_REFRESH - *
      • CR_SWAP - *
      - *
    • PropertyChangeEvent - *
    • VetoableChangeEvent - *
    - */ -public abstract class AS400Credential implements java.io.Serializable, AS400SwappableCredential -{ - static final long serialVersionUID = 4L; - - - private transient PropertyChangeSupport changes_ ; - private transient VetoableChangeSupport vetos_; - private transient Vector listeners_; - private transient AS400CredentialImpl impl_; - private transient RefreshAgent rAgent_; - - private AS400 system_ = null; - private AS400Principal principal_ = null; - private Boolean renewable_ = null; - private Boolean standalone_ = null; - private Boolean timed_ = null; - boolean private_ = true; - - private static int minVRM_ = 0; - - // Handles loading the appropriate MRI - private static ResourceBundleLoader_a loader_; //$A1A - - /** - ID indicating that automatic refresh has failed. - **/ - public static final int CR_AUTO_REFRESH_FAILED = 0; - /** - ID indicating that automatic refresh is not a valid operation. - **/ - public static final int CR_AUTO_REFRESH_NOT_VALID = 1; - /** - ID indicating that automatic refresh is started. - **/ - public static final int CR_AUTO_REFRESH_STARTED = 2; - /** - ID indicating that automatic refresh is stopped. - **/ - public static final int CR_AUTO_REFRESH_STOPPED = 3; - - - // Initialize information used to check permissions - // when running JDK1.2 and the appropriate - // permission class is available. - static private String permissionClassName_ = "javax.security.auth.AuthPermission"; - static private Constructor permissionClassConstructor_ = null; - static private String permissionCheckMethodName_ = "checkPermission"; - static private Method permissionCheckMethod_ = null; - static - { - java.lang.SecurityManager sm = System.getSecurityManager(); - if ( sm != null ) - try - { - Class permissionClass_ = Class.forName(permissionClassName_); - permissionClassConstructor_ = permissionClass_.getConstructor(new Class[] {String.class}); - permissionCheckMethod_ = - sm.getClass().getMethod( - permissionCheckMethodName_, new Class[] {Class.forName("java.security.Permission")}); - } - catch ( java.security.AccessControlException acf ) - { - Trace.log(Trace.WARNING, - "Access to permission class is denied by SecurityManager, JAAS permissions will not be checked.", acf); - } - catch ( ClassNotFoundException cnf ) - { - Trace.log(Trace.WARNING, - "Unable to resolve permission class, JAAS permissions will not be checked.", cnf); - } - catch ( NoClassDefFoundError ncd ) - { - Trace.log(Trace.WARNING, - "Unable to resolve permission class, JAAS permissions will not be checked.", ncd); - } - catch ( NoSuchMethodException nsm ) - { - Trace.log(Trace.WARNING, - "Security manager does not implement method '" + permissionCheckMethodName_ - + "'. JAAS permissions will not be checked.", nsm); - } - } - /** - * Constructs an AS400Credential object. - * - */ - public AS400Credential() - { - super(); - initTransient(); - } - /** - * Adds a listener to receive credential events. - * - * @param listener - * The AS400CredentialListener. - * - * @see #removeCredentialListener - * - */ - public void addCredentialListener(AS400CredentialListener listener) - { - if ( listener == null ) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - listeners_.addElement(listener); - } - /** - * Adds a PropertyChangeListener. - * - *

    The specified listener's propertyChange - * method will be called each time the value of a - * bound property is changed. - * - * @param listener - * The PropertyChangeListener. - * - * @see #removePropertyChangeListener - * - */ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if ( listener == null ) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - changes_.addPropertyChangeListener(listener); - } - /** - * Adds a VetoableChangeListener. - * - *

    The specified listener's vetoableChange - * method will be called each time the value of a - * constrained property is changed. - * - * @param listener - * The VetoableChangeListener. - * - * @see #removeVetoableChangeListener - * - */ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if ( listener == null ) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - vetos_.addVetoableChangeListener(listener); - } - /** - * Returns text that can be displayed to prompt for the basic user - * and password information used to initialize the credential. - * - * @return - * An array of two Strings. The first string is the text to - * prompt for the user name; the second is the text to - * prompt for the password. - * - */ - public String[] basicAuthenticationPrompt() - { - return new String[] { loader_.getCoreText("DLG_USER_ID_LABEL"), loader_.getCoreText("DLG_PASSWORD_LABEL") }; //$A1C - } - /** - * Checks the given permission for the caller. - * - *

    Does nothing if a security manager is not assigned - * or does not check permissions, or if the permission - * class is not present. - * - * @exception SecurityException - * If the caller does not have the permission. - * - */ - void checkAuthenticationPermission(String p) - { - java.lang.SecurityManager sm = System.getSecurityManager(); - if ( sm != null - && permissionCheckMethod_ != null - && permissionClassConstructor_ != null ) - { - try - { - permissionCheckMethod_.invoke(sm, - new Object[] {permissionClassConstructor_.newInstance( - new Object[] {p})}); - } - catch ( InvocationTargetException ite ) - { - Trace.log(Trace.DIAGNOSTIC, "Authentication permission check failed: " + p); - Throwable t = ite.getTargetException(); - if ( t instanceof SecurityException ) throw (SecurityException)t; - AuthenticationSystem.handleUnexpectedException(t); - } - catch ( Exception e ) - { - AuthenticationSystem.handleUnexpectedException(e); - } - } - } - /** - * Destroys the credential by destroying or clearing - * sensitive information for the credential. - * - * @exception AS400SecurityException - * If an IBM i system security or authentication error occurs. - * - */ - public void destroy() throws AS400SecurityException { - // Check for the associated permission - checkAuthenticationPermission("destroyCredential"); - // Halt any automatic refresh in progress - stopAutomaticRefresh(); - // Destroy any associated implementation object - if ( impl_ != null ) - { - impl_.destroy(); - setImpl(null); - } - // Invalidate all defining properties - invalidateProperties(); - // Provide notification - fireDestroyed(); - if ( Trace.isTraceOn() ) - Trace.log(Trace.INFORMATION, - new StringBuffer("Credential destroyed >> " - ).append(toString()).toString()); - } - /** - * Called when garbage collection determines that there are - * no more references to the object. - * - * @exception java.lang.Throwable - * If an error occurs. - */ - protected void finalize() throws Throwable { - stopAutomaticRefresh(); - super.finalize(); - } - /** - * Fires a CR_CREATE event for the credential. - * - */ - void fireCreated() - { - Vector targets = (Vector)listeners_.clone(); - AS400CredentialEvent event = new AS400CredentialEvent(this, AS400CredentialEvent.CR_CREATE); - for ( int i=0; i Available when the automatic refresh status - * is CR_AUTO_REFRESH_FAILED. - * - * @return - * The exception; null if not available. - * - * @see #getAutomaticRefreshStatus - * - */ - public Throwable getAutomaticRefreshFailure() - { - if ( rAgent_ != null ) - return rAgent_.getFailure(); - return null; - } - /** - * Returns the current status of automatic refresh - * activity for the credential. - * - *

    Possible identifiers are defined as fields on this class: - *

      - *
    • CR_AUTO_REFRESH_STARTED - *
    • CR_AUTO_REFRESH_STOPPED - *
    • CR_AUTO_REFRESH_FAILED - *
    • CR_AUTO_REFRESH_NOT_VALID - *
    - * - *

    Automatic refresh is not valid if the credential - * cannot be programmatically updated or extended, or if - * the associated AS400 system object is not set or - * not allowed to start additional threads. - * - *

    If automatic refresh fails, the associated exception is available - * from the getAutomaticRefreshFailure() method. - * - * @return - * The integer identifier representing the status. - * - * @see #startAutomaticRefresh - * @see #stopAutomaticRefresh - * @see #getAutomaticRefreshFailure - * - */ - public int getAutomaticRefreshStatus() - { - if ( !isRenewable() - || getSystem() == null - ||!getSystem().isThreadUsed() ) - return CR_AUTO_REFRESH_NOT_VALID; - if ( rAgent_ != null ) - { - if ( rAgent_.getFailure() != null ) return CR_AUTO_REFRESH_FAILED; - if ( rAgent_.isAlive() ) return CR_AUTO_REFRESH_STARTED; - } - return CR_AUTO_REFRESH_STOPPED; - } - /** - * Returns the object providing an implementation - * for code delegated by the credential. - * - * @return AS400CredentialImpl - * The object to receive delegated requests. - * - * @exception AS400SecurityException - * If a security or authority error occurs. - * - */ - AS400CredentialImpl getImpl() throws AS400SecurityException { - if ( impl_ == null ) - { - validateProperties(); - setImpl(getImplPrimitive()); - } - return impl_; - } - /** - * Initializes and returns a new implementation object - * to which the credential's behavior can be delegated. - * - *

    The superclass method creates the impl object - * and initializes common attributes. Subclasses - * should override as necessary to provide - * additional initialization. - * - * @exception AS400SecurityException - * If a security or authority error occurs. - * - */ - AS400CredentialImpl getImplPrimitive() throws AS400SecurityException { - validateVRM(); - AS400CredentialImpl impl = null; - try - { - try - { - impl = (AS400CredentialImpl)Class.forName(implClassName()).newInstance(); - } - catch (Exception e) - { - if (implClassNameNative() != null && implClassName().equals(implClassNameNative())) - { - Trace.log(Trace.DIAGNOSTIC, "Load of native implementation '" + implClassNameNative() + "' failed, attempting to load remote implementation."); - impl = (AS400CredentialImpl)Class.forName(implClassNameRemote()).newInstance(); - } - else - { - throw e; - } - } - // Check impl version - if ( impl.getVersion() < typeMinImplVersion() ) - { - // If not sufficient and native, try remote instead - if ( implClassNameNative() != null && - impl.getClass().getName().equals(implClassNameNative()) ) - { - Trace.log(Trace.DIAGNOSTIC, - new StringBuffer("Native impl '" - ).append(impl.getClass().getName() - ).append("' found at version " - ).append(impl.getVersion() - ).append(" not sufficient to meet required level " - ).append(typeMinImplVersion() - ).append(". Attempting to load remote impl instead." - ).toString()); - impl = (AS400CredentialImpl)Class.forName(implClassNameRemote()).newInstance(); - // If still not sufficient, reset to throw exception - if ( impl.getVersion() < typeMinImplVersion() ) - { - Trace.log(Trace.DIAGNOSTIC, - new StringBuffer("Remote impl '" - ).append(impl.getClass().getName() - ).append("' found at version " - ).append(impl.getVersion() - ).append(" not sufficient to meet required level " - ).append(typeMinImplVersion() - ).toString()); - impl = null; - } - } - else - impl = null; - // If both native and remote were not sufficient, throw an exception - if ( impl == null ) - { - Trace.log(Trace.DIAGNOSTIC, "Load of implementation for " + this.getClass().getName() + " failed."); - throw new ExtendedIllegalStateException( - ExtendedIllegalStateException.IMPLEMENTATION_NOT_FOUND); - } - }; - impl.setCredential(this); - } - catch ( Exception e ) - { - Trace.log(Trace.DIAGNOSTIC, "Load of implementation " + implClassName() + " failed."); - AuthenticationSystem.handleUnexpectedException(e); - } - return impl; - } - /** - * Returns the AS400Principal associated with the credential. - * - * @return - * The principal associated with the credential; - * null if not assigned. - * - */ - public AS400Principal getPrincipal() - { - return principal_; - } - /** - * Returns the AS400 system object for the credential. - * - * @return - * The AS400 system for the credential; - * null if not assigned. - * - */ - public AS400 getSystem() - { - return system_; - } - /** - * Returns the number of seconds before the - * credential is due to expire. - * - * @return - * The number of seconds before expiration; - * zero (0) if already expired or if the - * credential is not identified as expiring - * based on time. - * - * @exception AS400SecurityException - * If an IBM i system security or authentication error occurs. - * - */ - public int getTimeToExpiration() throws AS400SecurityException { - if ( isTimed() ) - return getImpl().getTimeToExpiration(); - return 0; - } - /** - * Returns the name of the class providing an implementation - * for code delegated by the credential. - * - * @return - * The qualified class name. - * - */ - String implClassName() - { - if ( implClassNameNative() != null - && AuthenticationSystem.isLocal(getSystem()) ) - return implClassNameNative(); - else - return implClassNameRemote(); - } - /** - * Returns the name of the class providing an implementation - * for code delegated by the credential that performs native - * optimization when running on an IBM i system. - * - *

    Default is to return null, indicating no native - * optimization for this credential. - * - * @return - * The qualified class name for native optimizations; - * null if not applicable. - * - */ - String implClassNameNative() - { - return null; - } - /** - * Returns the name of the class providing an implementation - * for code delegated by the credential when no native - * optimization is to be performed. - * - * @return - * The qualified class name. - * - */ - String implClassNameRemote() - { - return "com.ibm.as400.security.auth.AS400CredentialImplRemote"; - } - /** - * Initializes transient data. - * - *

    Subclasses should override as necessary to - * initialize additional class-specific data. - * - */ - void initTransient() - { - changes_ = new PropertyChangeSupport(this); - vetos_ = new VetoableChangeSupport(this); - listeners_ = new Vector(); - rAgent_ = null; - setImpl(null); - } - /** - * Reset the value of all properties used to define - * the credential. - * - *

    These are the values initialized prior to - * accessing host information for or taking action against - * the credential and not modified thereafter until - * the credential is destroyed. - * - *

    Subclasses should override as necessary to - * invalidate class-specific data. - * - */ - void invalidateProperties() - { - system_ = null; - principal_ = null; - renewable_ = null; - standalone_ = null; - timed_ = null; - } - /** - * Indicates whether or not the credential is considered - * to be in a connected or active state. - * - *

    If connected, defining attributes have been - * initialized and an object has been assigned to - * implement delegated behavior. - * - *

    Once connected, the defining attributes cannot be - * modified until the credential is destroyed. Destroying - * the credential returns it to an disconnected or - * inactive state. - * - * @return - * true if connected; false otherwise. - * - */ - boolean isConnected() - { - return (impl_ != null); - } - /** - * Indicates if a timed credential is still considered valid - * for authenticating to associated IBM i system services - * or performing related actions. - * - * @return - * true if valid or not timed; false if not valid or if - * the operation fails. - * - */ - public boolean isCurrent() - { - try - { - if ( !isDestroyed() ) - return getImpl().isCurrent(); - } - catch ( AS400SecurityException e ) - { - - } - return false; - } - /** - * Indicates if the credential has been destroyed. - * - *

    The credential is considered destroyed if - * the contained information is no longer sufficient - * to access host information for or take action - * against the credential. - * - * @return - * true if destroyed; otherwise false. - * - */ - public boolean isDestroyed() - { - if ( impl_ == null ) - try - { - validateProperties(); - } - catch ( Exception e ) - { - return true; - } - return false; - } - /** - * Indicates whether the credential is considered private. - * - *

    This value can be referenced by authentication services - * as an indication of when to check permissions or otherwise - * protect access to sensitive credentials. - * - * @return - * true if private; false if public. - */ - public boolean isPrivate() - { - return private_; - } - /** - * Indicates if the credential can be refreshed. - * - * @return - * true if the validity period of the credential - * can be programmatically updated or extended - * using refresh(); otherwise false. - * - * @see #refresh - */ - public boolean isRenewable() - { - if ( renewable_ != null ) - return renewable_.booleanValue(); - return typeIsRenewable(); - } - /** - * Indicates if the credential is sufficient by itself - * to change the OS thread identity. - * - * @return - * true if the credential can be used to perform - * a swap independently (without requiring an - * associated principal); otherwise false. - * - */ - boolean isStandalone() - { - if ( standalone_ != null ) - return standalone_.booleanValue(); - return typeIsStandalone(); - } - /** - * Indicates if the credential will expire based on time. - * - * @return - * true if the credential has been identified - * as expiring at the end of a predetermined - * time interval; otherwise false. - * - */ - public boolean isTimed() - { - if ( timed_ != null ) - return timed_.booleanValue(); - return typeIsTimed(); - } - /** - * Overrides the ObjectInputStream.readObject() method in order to return any - * transient parts of the object to there properly initialized state. - * - * By calling ObjectInputStream.defaultReadObject() we restore the state of - * any non-static and non-transient variables. We then continue on to - * restore the state (as necessary) of the remaining varaibles. - * - * @param in - * The input stream from which to deserialize the object. - * - * @exception ClassNotFoundException - * If the class being deserialized is not found. - * - * @exception IOException - * If an error occurs while communicating with the server. - * - */ - private void readObject(java.io.ObjectInputStream in) - throws ClassNotFoundException, java.io.IOException - { - in.defaultReadObject(); - initTransient(); - } - /** - * Updates or extends the validity period for the credential. - * - *

    Does nothing if the credential cannot be - * programmatically updated or extended. - * - * @exception AS400SecurityException - * If an IBM i system security or authentication error occurs. - * - */ - public void refresh() throws AS400SecurityException { - checkAuthenticationPermission("refreshCredential"); - if ( !isRenewable() ) - return; - getImpl().refresh(); - fireRefreshed(); - if ( Trace.isTraceOn() ) - Trace.log(Trace.INFORMATION, - new StringBuffer("Credential refreshed >> ").append(toString()).toString()); - } - /** - * Removes the specified listener from the internal list. - * - *

    Does nothing if the listener is not in the list. - * - * @param listener - * The AS400CredentialListener. - * - * @see #addCredentialListener - * - */ - public void removeCredentialListener(AS400CredentialListener listener) - { - listeners_.removeElement(listener); - } - /** - * Removes the specified listener from the internal list. - * - *

    Does nothing if the listener is not in the list. - * - * @param listener - * The PropertyChangeListener. - * - * @see #addPropertyChangeListener - * - */ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - changes_.removePropertyChangeListener(listener); - } - /** - * Removes the specified listener from the internal list. - * - *

    Does nothing if the listener is not in the list. - * - * @param listener - * The VetoableChangeListener. - * - * @see #addVetoableChangeListener - * - */ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetos_.removeVetoableChangeListener(listener); - } - /** - * Sets the object providing an implementation - * for code delegated by the credential. - * - */ - void setImpl(AS400CredentialImpl impl) - { - impl_ = impl; - } - /** - * Indicates if the credential can be refreshed. - * - *

    This property cannot be changed once a request - * initiates a connection for the object to the - * IBM i system (for example, refresh). - * - * @param b - * true if the validity period of the credential - * can be programmatically updated or extended - * using refresh(); otherwise false. - * - * @exception ExtendedIllegalStateException - * If the property cannot be changed due - * to the current state. - * - * @see #refresh - */ - void setIsRenewable(boolean b) - { - validatePropertyChange("isRenewable"); - renewable_ = new Boolean(b); - } - /** - * Indicates if the credential is sufficient by itself - * to change the OS thread identity. - * - *

    This property cannot be changed once a request - * initiates a connection for the object to the - * IBM i system (for example, refresh). - * - * @param b - * true if the credential can be used to perform - * a swap independently (without requiring an - * associated principal); otherwise false. - * - * @exception ExtendedIllegalStateException - * If the property cannot be changed due - * to the current state. - * - */ - void setIsStandalone(boolean b) - { - validatePropertyChange("isStandalone"); - standalone_ = new Boolean(b); - } - /** - * Indicates if the credential will expire based on time. - * - *

    This property cannot be changed once a request - * initiates a connection for the object to the - * IBM i system (for example, refresh). - * - * @param b - * true if the credential has been identified - * as expiring at the end of a predetermined - * time interval; otherwise false. - * - * @exception ExtendedIllegalStateException - * If the property cannot be changed due - * to the current state. - * - */ - void setIsTimed(boolean b) - { - validatePropertyChange("isTimed"); - timed_ = new Boolean(b); - } - /** - * Sets the principal associated with the credential. - * - *

    This property cannot be changed once a request - * initiates a connection for the object to the - * IBM i system (for example, refresh). - * - * @param p - * The principal. - * - * @exception PropertyVetoException - * If the change is vetoed. - * - * @exception ExtendedIllegalStateException - * If the property cannot be changed due - * to the current state. - * - */ - public void setPrincipal(AS400Principal p) throws PropertyVetoException { - validatePropertyChange("principal"); - AS400Principal old = getPrincipal(); - fireVetoableChange("principal", old, p); - principal_ = p; - firePropertyChange("principal", old, p); - } - /** - * Sets the AS400 system object for the credential. - * - *

    This property cannot be changed once a request - * initiates a connection for the object to the - * IBM i system (for example, refresh). - * - * @param system - * The AS400 system object. - * - * @exception PropertyVetoException - * If the change is vetoed. - * - * @exception ExtendedIllegalStateException - * If the property cannot be changed due - * to the current state. - * - */ - public void setSystem(AS400 system) throws PropertyVetoException { - validatePropertyChange("system"); - AS400 old = getSystem(); - fireVetoableChange("system", old, system); - system_ = system; - firePropertyChange("system", old, system); - } - /** - * Starts automatic refresh for the credential. - * - *

    While this action is designed to automatically - * refresh the credential at the specified interval, - * this is subject to current workload and scheduling - * of the underlying Java Virtual Machine. Calling - * applications should take this into consideration - * when defining the refresh interval in relation - * to the credential's time to expiration, as it may - * not be possible to revive a credential once it - * has expired. - * - * @param refreshInterval - * The number of seconds between refresh attempts. - * The first refresh will occur immediately; - * the second will occur this many seconds after - * the first, and so on. - * - * @param maxRefreshes - * The maximum number of times to refresh the - * credential. A value of negative one (-1) - * indicates no maximum. - * - * @exception IllegalStateException - * If automatic refresh has already been started or - * is not a valid operation for the credential. - * Automatic refresh is not valid if the credential - * cannot be programmatically updated or extended, - * or if the associated AS400 system object is - * not allowed to start additional threads. - * - * @exception ExtendedIllegalArgumentException - * If a parameter value is out of range. - * - * @see #refresh - * @see #getAutomaticRefreshStatus - * @see #stopAutomaticRefresh - * - */ - public void startAutomaticRefresh(int refreshInterval, int maxRefreshes) - { - // Verify status - int s = getAutomaticRefreshStatus(); - if ( s == CR_AUTO_REFRESH_NOT_VALID ) - { - Trace.log(Trace.ERROR, "Automatic refresh for " + toString() + " not valid."); - throw new IllegalStateException("automaticRefreshStatus"); - } - if ( s == CR_AUTO_REFRESH_STARTED ) - { - Trace.log(Trace.ERROR, "Automatic refresh for " + toString() + " already started."); - throw new IllegalStateException("automaticRefreshStatus"); - } - // Validate parms - if ( refreshInterval <= 0 ) - { - Trace.log(Trace.ERROR, "Refresh interval " + refreshInterval + " must be > 0."); - throw new ExtendedIllegalArgumentException( - "refreshInterval", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if ( maxRefreshes < -1 ) - { - Trace.log(Trace.ERROR, "Maximum number of refreshes " + maxRefreshes + " must be >= -1."); - throw new ExtendedIllegalArgumentException( - "maxRefreshes", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // Create and start the refresh agent (a thread) - rAgent_ = new RefreshAgent(this, refreshInterval, maxRefreshes); - rAgent_.start(); - if ( Trace.isTraceOn() ) - Trace.log(Trace.INFORMATION, - new StringBuffer("Automatic refresh started >> " - ).append(toString()).toString()); - } - /** - * Stops and clears the state of any automatic refresh - * in progress for the credential. - * - *

    Does nothing if automatic refresh is not active. - * - * @see #startAutomaticRefresh - * @see #getAutomaticRefreshStatus - * - */ - public void stopAutomaticRefresh() - { - if ( rAgent_ == null || !rAgent_.isAlive() ) - return; - rAgent_.stopRefresh(); - rAgent_ = null; - if ( Trace.isTraceOn() ) - Trace.log(Trace.INFORMATION, - new StringBuffer("Automatic refresh stopped >> " - ).append(toString()).toString()); - } - /** - * Attempts to swap the current thread identity based on this credential. - * - *

    No return credential is generated. - * - *

    Note: This method affects the running user - * profile for subsequent native code invocations and any - * further requests against the assigned IBM i system. - * Any currently existing AS400 instances, even if defined for the local host - * and current user, are not affected if connections - * have been established under the old identity. - * - *

    Note: swap() is supported only when running natively on IBM i. - * It is unsupported as a remote operation. - * - * @exception Exception - * If an exception occurs. - * - * @see Swapper - */ - public void swap() throws Exception { - swap(false); - } - /** - * Attempts to swap the current thread identity based on this credential. - * - *

    Note: This method affects the running user - * profile for subsequent native code invocations and any - * further requests against the assigned IBM i system. - * Any currently existing AS400 instances, even if defined for the local host - * and current user, are not affected if connections - * have been established under the old identity. - * - *

    Note: swap() is supported only when running natively on IBM i. - * It is unsupported as a remote operation. - * - * @param returnCredential - * Indicates whether a credential should be returned - * that is capable of swapping back to the original - * thread identity. Not generating a return credential - * optimizes performance and avoids any potential - * problems in generating the return value. - * This parameter is ignored by credentials not - * supporting the ability to swap back to the - * original thread identity. - * - * @return - * A credential capable of swapping back to the - * original thread identity; classes not supporting this - * capability will return null. This value will also - * be null if returnCredential is false. - * - * @exception AS400SecurityException - * If an IBM i system security or authentication error occurs. - * - * @see Swapper - */ - public AS400Credential swap(boolean returnCredential) throws AS400SecurityException { - // Check for the associated permission - checkAuthenticationPermission("modifyThreadIdentity"); - // Validate compatibility of principal - validatePrincipalCompatibility(); - // Swap - AS400Credential cr = null; - try - { - cr = getImpl().swap(returnCredential); - // Reset local host information on AuthenticationSystem - if ( getSystem() != AuthenticationSystem.localHost() ) - AuthenticationSystem.resetLocalHost(); - // Disconnect and reset the state of AS400 services - getSystem().resetAllServices(); - // Reset the system user ID & password to force re-resolve - getSystem().setUserId("*CURRENT"); - getSystem().setPassword("*CURRENT"); - // Request a service port to take system out of unset state - getSystem().getServicePort(AS400.SIGNON); - // Signal completion - fireSwapped(); - if ( Trace.isTraceOn() ) - Trace.log(Trace.INFORMATION, - new StringBuffer("Credential swapped >> ").append(toString()).toString()); - } - catch ( PropertyVetoException pve ) - { - AuthenticationSystem.handleUnexpectedException(pve); - } - return cr; - } - /** - * Indicates if instances of the class can be refreshed. - * - *

    Typically this behavior is dictated by the type - * of credential and need not be changed for - * individual instances. The superclass answers a - * default value of false. Subclasses should - * override as necessary. - * - * @return - * true if the validity period of instances can be - * programmatically updated or extended using - * refresh(); otherwise false. - * - * @see #refresh - */ - boolean typeIsRenewable() - { - return false; - } - /** - * Indicates if instances of the class are sufficient - * by themselves to change the OS thread identity. - * - *

    Typically this behavior is dictated by the type - * of credential and need not be changed for - * individual instances. The superclass answers a - * default value of false. Subclasses should - * override as necessary. - * - * @return - * true if instances can be used to perform a - * swap independently (without requiring an - * associated principal); otherwise false. - * - */ - boolean typeIsStandalone() - { - return false; - } - /** - * Indicates if instances of the class will expire based on time. - * - *

    Typically this behavior is dictated by the type - * of credential and need not be changed for - * individual instances. The superclass answers a - * default value of false. Subclasses should - * override as necessary. - * - * @return - * true if the credential will expire at the end - * of a known predetermined time interval; - * otherwise false. - */ - boolean typeIsTimed() - { - return false; - } - /** - * Returns the minimum version number for implementations. - * - *

    Used to ensure implementations are sufficient - * to support this version of the credential. - * - * @return - * The version number. - * - */ - int typeMinImplVersion() - { - return 1; //mod 3 - } - /** - * The minimum VRM level supported by credentials of - * this type. - * - *

    Superclass assumes V4R5M0; subclasses may override as necessary. - * - * @return - * The VRM representation (an int). - * - */ - int typeMinVRM() - { - if ( minVRM_ == 0 ) - minVRM_ = AS400.generateVRM(4, 5, 0); - return minVRM_; - } - /** - * Validate compatibility of the assigned principal. - * - *

    If not a standalone credential, this method validates - * that the principal and credential systems do not conflict. - * Note: A principal with a system assigned to null is - * interpreted as an implicit match for the system - * assigned to the credential. - * - * @exception IllegalStateException - * If the principal system is not compatible. - * - */ - void validatePrincipalCompatibility() - { - if ( isStandalone() - || getPrincipal()==null - || getPrincipal().getSystem()==null ) - return; - if ( getPrincipal().getSystem().equals(getSystem()) ) - { - Trace.log(Trace.ERROR, "Incompatible credential and principal systems."); - throw new IllegalStateException("system"); - } - } - /** - * Validates that all properties required to define the - * credential have been set. - * - *

    These are the values initialized prior to - * accessing host information for or taking action against - * the credential and not modified thereafter until - * the credential is destroyed. - * - *

    Subclasses should override as necessary to - * validate class-specific data. - * - * @exception ExtendedIllegalStateException - * If a required property is not set. - * - */ - void validateProperties() - { - validatePropertySet("system", getSystem()); - if ( !isStandalone() ) - validatePropertySet("principal", getPrincipal()); - } - /** - * Validates that the given property can be changed. - * - *

    Used to verify any values initialized prior to - * accessing host information or taking action against - * the credential which cannot be modified thereafter - * until the credential is destroyed and returned - * to an inactive state. - * - *

    Performs a simple check of active state, - * used to centralize exception handling. - * - * @param propertyName - * The property to be validated. - * - * @exception ExtendedIllegalStateException - * If the credential is in an connected state, - * indicating that attributes defining the credential - * cannot be modified. - * - */ - void validatePropertyChange(String propertyName) - { - if ( isConnected() ) - { - Trace.log(Trace.ERROR, "Property '" + propertyName + "' not changed (connected=true)."); - throw new ExtendedIllegalStateException(propertyName, - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } - } - /** - * Validates that the given property has been set. - * - *

    Performs a simple null check, used to - * centralize exception handling. - * - * @param propertyName - * The property to validate. - * - * @param value - * The property value. - * - * @exception ExtendedIllegalStateException - * If the property is not set. - * - */ - void validatePropertySet(String propertyName, Object value) - { - if ( value == null ) - { - Trace.log(Trace.ERROR, "Required property '" + propertyName + "' not set."); - throw new ExtendedIllegalStateException( - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - /** - * Validates that an implementation exists to in support - * of the associated system VRM. - * - * @exception AS400SecurityException - * If a security or authority error occurs. - * - */ - void validateVRM() throws AS400SecurityException { - try - { - if (getSystem().getVRM() < typeMinVRM() ) - { - Trace.log(Trace.ERROR, "VRM<" + typeMinVRM()); - throw new AS400AuthenticationException( - AS400SecurityException.SYSTEM_LEVEL_NOT_CORRECT); - } - } - catch ( Exception ioe ) - { - AuthenticationSystem.handleUnexpectedException(ioe); - } - } - -} //end class diff --git a/cvsroot/src/com/ibm/as400/security/auth/AS400CredentialBeanInfo.java b/cvsroot/src/com/ibm/as400/security/auth/AS400CredentialBeanInfo.java deleted file mode 100644 index 8e62cc109..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/AS400CredentialBeanInfo.java +++ /dev/null @@ -1,212 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CredentialBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.security.auth; - -import java.awt.Image; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.BeanDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.PropertyDescriptor; -import java.beans.IntrospectionException; - -/** - * Bean information for the AS400Credential class. - * - */ -public class AS400CredentialBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private final static Class beanClass = AS400Credential.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_a loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getAccessText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getAccessText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getAccessText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getAccessText("EVT_DESC_PROPERTY_VETO")); - - String[] crListeners = {"created", "destroyed", "refreshed", "swapped"}; - EventSetDescriptor cr = new EventSetDescriptor(beanClass, - "as400Credential", - AS400CredentialListener.class, - crListeners, - "addCredentialListener", - "removeCredentialListener"); - cr.setDisplayName(loader_.getText("EVT_NAME_CR_EVENT")); - cr.setShortDescription(loader_.getText("EVT_DESC_CR_EVENT")); - - events_ = new EventSetDescriptor[] {cr, changed, veto}; - - // ***** PROPERTIES - PropertyDescriptor current = new PropertyDescriptor("current", beanClass, "isCurrent", null); - current.setBound(false); - current.setConstrained(false); - current.setDisplayName(loader_.getText("PROP_NAME_CR_CURRENT")); - current.setShortDescription(loader_.getText("PROP_DESC_CR_CURRENT")); - - PropertyDescriptor destroyed = new PropertyDescriptor("destroyed", beanClass, "isDestroyed", null); - destroyed.setBound(false); - destroyed.setConstrained(false); - destroyed.setDisplayName(loader_.getText("PROP_NAME_CR_DESTROYED")); - destroyed.setShortDescription(loader_.getText("PROP_DESC_CR_DESTROYED")); - - PropertyDescriptor renewable = new PropertyDescriptor("renewable", beanClass, "isRenewable", null); - renewable.setBound(false); - renewable.setConstrained(false); - renewable.setDisplayName(loader_.getText("PROP_NAME_CR_RENEWABLE")); - renewable.setShortDescription(loader_.getText("PROP_DESC_CR_RENEWABLE")); - renewable.setExpert(true); - - PropertyDescriptor timed = new PropertyDescriptor("timed", beanClass, "isTimed", null); - timed.setBound(false); - timed.setConstrained(false); - timed.setDisplayName(loader_.getText("PROP_NAME_CR_TIMED")); - timed.setShortDescription(loader_.getText("PROP_DESC_CR_TIMED")); - timed.setExpert(true); - - PropertyDescriptor timeToExpiration = new PropertyDescriptor("timeToExpiration", beanClass, "getTimeToExpiration", null); - timeToExpiration.setBound(false); - timeToExpiration.setConstrained(false); - timeToExpiration.setDisplayName(loader_.getText("PROP_NAME_CR_TIMETOEXPIRATION")); - timeToExpiration.setShortDescription(loader_.getText("PROP_DESC_CR_TIMETOEXPIRATION")); - - PropertyDescriptor system = new PropertyDescriptor("system", beanClass, "getSystem", "setSystem"); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(loader_.getAccessText("PROP_NAME_SYSTEM")); - system.setShortDescription(loader_.getAccessText("PROP_DESC_SYSTEM")); - - PropertyDescriptor principal = new PropertyDescriptor("principal", beanClass, "getPrincipal", "setPrincipal"); - principal.setBound(true); - principal.setConstrained(true); - principal.setDisplayName(loader_.getText("PROP_NAME_CR_PRINCIPAL")); - principal.setShortDescription(loader_.getText("PROP_DESC_CR_PRINCIPAL")); - principal.setExpert(true); - - properties_ = new PropertyDescriptor[] { system, principal, current, destroyed, renewable, timed, timeToExpiration }; - } - catch ( Exception e ) - { - AuthenticationSystem.handleUnexpectedException(e); - } - - } - - - /** - * Returns the bean descriptor. - * - * @return The bean descriptor. - * - */ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - * Returns the index of the default event. - * - * @return The index to the default event. - * - */ - public int getDefaultEventIndex() - { - return 0; - } - - - /** - * Returns the index of the default property. - * - * @return The index to the default property. - * - */ - public int getDefaultPropertyIndex() - { - return 0; - } - - - /** - * Returns the descriptors for all events. - * - * @return The descriptors for all events. - * - */ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - - /** - * Returns an Image for this bean's icon. - * - *

    The superclass returns a generic image; subclasses - * should override with specific images as appropriate. - * - * @param icon The desired icon size and color. - * - * @return The Image for the icon. - * - */ - public Image getIcon(int icon) - { - Image image = null; - switch ( icon ) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("Credential16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("Credential32.gif"); - break; - } - return image; - } - - - /** - * Returns the descriptors for all properties. - * - * @return The descriptors for all properties. - * - */ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/AS400CredentialEvent.java b/cvsroot/src/com/ibm/as400/security/auth/AS400CredentialEvent.java deleted file mode 100644 index f50080689..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/AS400CredentialEvent.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.ibm.as400.security.auth; - -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CredentialEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -import java.util.EventObject; -/** - * The AS400CredentialEvent class represents a credential event. - * - */ -public class AS400CredentialEvent extends EventObject { - - static final long serialVersionUID = 4L; - - /** - Event ID indicating that a credential has been created. - **/ - public static final int CR_CREATE = 0; - /** - Event ID indicating that a credential has been destroyed. - **/ - public static final int CR_DESTROY = 1; - /** - Event ID indicating that a credential has been refreshed. - **/ - public static final int CR_REFRESH = 2; - /** - Event ID indicating that a credential was used to change the thread identity. - **/ - public static final int CR_SWAP = 3; - - private int id_; // event identifier -/** - * Constructs a AS400CredentialEvent object. - * - * @param source - * The object where the event originated. - * - * @param id - * The event identifier. - * - */ - public AS400CredentialEvent(Object source, int id) { - super(source); - id_ = id; - } -/** - * Returns the identifier for the event. - * - *

    Possible identifiers are available as fields - * on this class. - * - * @return - * The event identifier. - */ -public int getID() { - return id_; -} -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/AS400CredentialImpl.java b/cvsroot/src/com/ibm/as400/security/auth/AS400CredentialImpl.java deleted file mode 100644 index dfa949506..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/AS400CredentialImpl.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.ibm.as400.security.auth; - -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CredentialImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -/** - * The AS400CredentialImpl interface provides the template for - * classes implementing behavior delegated by an - * AS400Credential. - * - *

    This class should be implemented as necessary to provide - * specific credential implementations. Each class can - * contain credential data that may be security-sensitive. - * It is up to each class to provide appropriate access - * controls to sensitive data. - * - */ -interface AS400CredentialImpl { - -/** - * Destroy or clear sensitive information maintained - * by the credential implementation. - * - *

    Subsequent requests may result in a NullPointerException. - * - * @exception DestroyFailedException - * If errors occur while destroying or clearing - * credential implementation data. - * - */ -void destroy() throws DestroyFailedException; -/** - * Returns the number of seconds before the - * credential is due to expire. - * - * @return - * The number of seconds before expiration; - * zero (0) if already expired. - * - * @exception RetrieveFailedException - * If errors occur while retrieving - * timeout information. - * - */ -int getTimeToExpiration() throws RetrieveFailedException; -/** - * Returns the version number for the implementation. - * - *

    Used to ensure the implementation is valid for - * specific functions. - * - * @return - * The version number. - * - */ -int getVersion(); -/** - * Indicates if the credential is still considered valid - * for authenticating to associated system services - * or performing related actions. - * - *

    An exception is not thrown on failure to remain - * consistent with the Refreshable interface (even - * though some credential classes currently avoid the - * dependency established by implementing the - * interface). - * - * @return - * true if valid; false if not valid or if the - * operation fails. - * - */ -boolean isCurrent(); -/** - * Updates or extends the validity period for the - * credential. - * - * @exception RefreshFailedException - * If errors occur during refresh. - * - */ -void refresh() throws RefreshFailedException; -/** - * Sets the credential delegating behavior to - * the implementation object. - * - * @param credential - * The associated credential. - * - */ -public void setCredential(AS400Credential credential); -/** - * Attempts to swap the thread identity based on this - * credential. - * - * @param genRtnCr - * Indicates whether a return credential should be - * generated, even if supported. When appropriate, - * not generating a return credential can - * improve performance and avoid potential problems - * in creating the credential. - * - * @return - * A credential capable of swapping back to - * the original identity; classes not supporting - * this capability will return null. This value - * will also be null if genRtnCr is false. - * - * @exception SwapFailedException - * If errors occur while swapping thread identity. - * - * @exception SecurityException - * If the caller does not have permission to - * modify the OS thread identity. - * - */ -AS400Credential swap(boolean genRtnCr) throws SwapFailedException; -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/AS400CredentialImplRemote.java b/cvsroot/src/com/ibm/as400/security/auth/AS400CredentialImplRemote.java deleted file mode 100644 index c36c5935c..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/AS400CredentialImplRemote.java +++ /dev/null @@ -1,196 +0,0 @@ -package com.ibm.as400.security.auth; - -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CredentialImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -/** - * The AS400CredentialImplRemote class provides the - * default implementation for most behavior delegated by - * an AS400Credential with no native optimization. - * - *

    This class should be subclassed as necessary to - * provide specific credential implementations. Each class - * can contain credential data that may be security-sensitive. - * It is up to each class to provide appropriate access - * controls to sensitive data. - * - */ -class AS400CredentialImplRemote implements AS400CredentialImpl { - - private AS400Credential credential_ = null; -/** - * Constructs an implementation object to receive - * delegated credential behavior. - * - *

    The credential property must be set prior to - * accessing host information or invoking actions. - * - */ -AS400CredentialImplRemote() { - super(); -} -/** - * Destroy or clear sensitive information maintained - * by the credential implementation. - * - *

    Subsequent requests may result in a NullPointerException. - * - *

    Subclasses should override as necessary to - * destroy or clear class-specific data. - * - * @exception DestroyFailedException - * If errors occur while destroying or clearing - * credential implementation data. - * - */ -public void destroy() throws DestroyFailedException { - credential_ = null; - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, - new StringBuffer("Credential implementation destroyed >> " - ).append(toString()).toString()); -} -/** - * Returns the credential delegating behavior to - * the implementation object. - * - * @return - * The associated credential. - * - */ -AS400Credential getCredential() { - return credential_; -} -/** - * Returns the number of seconds before the - * credential is due to expire. - * - *

    Subclasses implementing timed credentials - * must override. - * - * @return - * The number of seconds before expiration; - * zero (0) if already expired. - * - * @exception RetrieveFailedException - * If errors occur while retrieving - * timeout information. - * - */ -public int getTimeToExpiration() throws RetrieveFailedException { - Trace.log(Trace.ERROR, "Subclass must provide getTimeToExpiration() implementation"); - throw new RetrieveFailedException( - RetrieveFailedException.REQUEST_NOT_SUPPORTED); -} -/** - * Returns the version number for the implementation. - * - *

    Used to ensure the implementation is valid for - * specific functions. - * - * @return - * The version number. - * - */ -public int getVersion() { - return 1; // mod 3 -} -/** - * Indicates if the credential is still considered valid - * for authenticating to associated server services - * or performing related actions. - * - *

    An exception is not thrown on failure to remain - * consistent with the Refreshable interface (even - * though some credential classes currently avoid the - * dependency established by implementing the - * interface). - * - * @return - * true if valid; false if not valid or if the - * operation fails. - * - */ -public boolean isCurrent() { - try { - return (!getCredential().isTimed() - || getTimeToExpiration()>0); - } - catch (RetrieveFailedException e) { - Trace.log(Trace.ERROR, "Unable to retrieve credential time to expiration", e); - return false; - } -} -/** - * Updates or extends the validity period for the - * credential. - * - *

    Subclasses implementing renewable credentials - * must override. - * - * @exception RefreshFailedException - * If errors occur during refresh. - * - */ -public void refresh() throws RefreshFailedException { - Trace.log(Trace.ERROR, "Subclass must provide refresh() implementation"); - throw new RefreshFailedException( - RefreshFailedException.REQUEST_NOT_SUPPORTED); -} -/** - * Sets the credential delegating behavior to - * the implementation object. - * - * @param credential - * The associated credential. - * - */ -public void setCredential(AS400Credential credential) { - if (credential == null) { - Trace.log(Trace.ERROR, "Parameter 'credential' is null."); - throw new NullPointerException("credential"); - } - credential_ = credential; -} -/** - * Attempts to swap the IBM i thread identity based on this - * credential. - * - * @param genRtnCr - * Indicates whether a return credential should be - * generated, even if supported. When appropriate, - * not generating a return credential can - * improve performance and avoid potential problems - * in creating the credential. - * - * @return - * A credential capable of swapping back to - * the original identity; classes not supporting - * this capability will return null. This value - * will also be null if genRtnCr is false. - * - * @exception SwapFailedException - * If errors occur while swapping thread identity. - * - * @exception SecurityException - * If the caller does not have permission to - * modify the OS thread identity. - * - */ -public AS400Credential swap(boolean genRtnCr) throws SwapFailedException { - Trace.log(Trace.ERROR, "Unsupported remote operation"); - throw new SwapFailedException( - SwapFailedException.REQUEST_NOT_SUPPORTED); -} -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/AS400CredentialListener.java b/cvsroot/src/com/ibm/as400/security/auth/AS400CredentialListener.java deleted file mode 100644 index ac42b9eb9..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/AS400CredentialListener.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ibm.as400.security.auth; - -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400CredentialListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -/** - * The AS400CredentialListener interface provides an - * interface for receiving AS400CredentialEvents. - * - */ -public interface AS400CredentialListener { - -/** - * Invoked when a create has been performed. - * - * @param event - * The credential event. - * - */ -void created(AS400CredentialEvent event); -/** - * Invoked when a destroy has been performed. - * - * @param event - * The credential event. - * - */ -void destroyed(AS400CredentialEvent event); -/** - * Invoked when a refresh has been performed. - * - * @param event - * The credential event. - * - */ -void refreshed(AS400CredentialEvent event); -/** - * Invoked when a credential has been used to change the - * thread identity. - * - * @param event - * The credential event. - * - */ -void swapped(AS400CredentialEvent event); -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/AS400Principal.java b/cvsroot/src/com/ibm/as400/security/auth/AS400Principal.java deleted file mode 100644 index 224b80e03..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/AS400Principal.java +++ /dev/null @@ -1,312 +0,0 @@ -package com.ibm.as400.security.auth; - -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400Principal.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400Exception; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.ConnectionDroppedException; -import com.ibm.as400.access.ErrorCompletingRequestException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.InternalErrorException; -import com.ibm.as400.access.ObjectDoesNotExistException; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.User; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.IOException; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.security.Principal; -import java.util.Vector; -/** - * The AS400Principal class provides an abstract superclass - * for representations of IBM i system security-related - * identities. - * - *

    Typical IBM i system Principals include, but are not - * necessarily limited to, user profiles. - * - */ -public abstract class AS400Principal implements Principal, Serializable { - - - static final long serialVersionUID = 4L; - - - private transient PropertyChangeSupport changes_ = new PropertyChangeSupport(this); - private transient VetoableChangeSupport vetos_ = new VetoableChangeSupport(this); - private transient Vector credentialListeners_ = new Vector(); - private AS400 system_ = null; -/** - * Constructs an AS400Principal object. - * - */ -public AS400Principal() { - super(); - initTransient(); -} -/** - * Constructs an AS400Principal object. - * - *

    The system property is set to the - * specified value. - * - * @param system - * The IBM i system associated with the principal. - * - */ -public AS400Principal(AS400 system) { - this(); - try { - setSystem(system); } - catch (PropertyVetoException pve) { - AuthenticationSystem.handleUnexpectedException(pve); } -} -/** - * Adds a PropertyChangeListener. - * - *

    The specified listener's propertyChange - * method will be called each time the value of a - * bound property is changed. - * - * @param listener - * The PropertyChangeListener. - * - * @see #removePropertyChangeListener - * - */ -public void addPropertyChangeListener(PropertyChangeListener listener) { - if (listener == null) { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - changes_.addPropertyChangeListener(listener); -} -/** - * Adds a VetoableChangeListener. - * - *

    The specified listener's vetoableChange - * method will be called each time the value of a - * constrained property is changed. - * - * @param listener - * The VetoableChangeListener. - * - * @see #removeVetoableChangeListener - * - */ -public void addVetoableChangeListener(VetoableChangeListener listener) { - if (listener == null) { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - vetos_.addVetoableChangeListener(listener); -} -/** - * Report a bound property update to any registered listeners. - * - * @param propertyName - * The programmatic name of the property that was changed. - * - * @param oldValue - * The old value of the property. - * - * @param newValue - * The new value of the property. - * - */ -void firePropertyChange(String propertyName, Object oldValue, Object newValue) { - changes_.firePropertyChange(propertyName, oldValue, newValue); -} -/** - * Report a vetoable property update to any registered listeners. - * - * @param propertyName - * The programmatic name of the property that was changed. - * - * @param oldValue - * The old value of the property. - * - * @param newValue - * The new value of the property. - * - * @exception PropertyVetoException - * If the recipient wishes the property change to be rolled back. - * - */ -void fireVetoableChange(String propertyName, Object oldValue, Object newValue) throws PropertyVetoException { - vetos_.fireVetoableChange(propertyName, oldValue, newValue); -} -/** - * Returns the name commonly used to refer to the principal. - * - *

    Default behavior for the superclass is to return the - * user profile name - * - * @return - * The principal's name. - * - */ -public String getName() { - return getUserProfileName(); -} -/** - * Returns the AS400 system object for the principal. - * - * @return - * The AS400 system for the principal; - * null if not assigned. - * - */ -public AS400 getSystem() { - return system_; -} -/** - * Returns an IBM i system User object based on the - * user profile name and - * system associated with - * the principal. - * - *

    The system property must be set and a - * valid userProfileName must be identified by - * the principal prior to requesting the user. - * - * @return - * The com.ibm.as400.access.User object. - * - * @exception ExtendedIllegalStateException - * If a required property is not set. - * @exception AS400Exception - * If the IBM i system returns an error message. - * @exception AS400SecurityException - * If a security or authority error occurs. - * @exception ConnectionDroppedException - * If the connection is dropped unexpectedly. - * @exception ErrorCompletingRequestException - * If an error occurs before the request is completed. - * @exception InterruptedException - * If this thread is interrupted. - * @exception IOException - * If an error occurs while communicating with the system. - * @exception ObjectDoesNotExistException - * If the system object does not exist. - * @exception UnsupportedEncodingException - * If the character encoding is not supported. - * - */ -public User getUser() - throws AS400Exception, AS400SecurityException, ConnectionDroppedException, - ErrorCompletingRequestException, InterruptedException, ObjectDoesNotExistException, - IOException, UnsupportedEncodingException -{ - if (getSystem() == null) { - Trace.log(Trace.ERROR, "Required property 'system' not set."); - throw new ExtendedIllegalStateException( - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - return new User(getSystem(), getUserProfileName()); -} -/** - * Returns the name of a user profile associated with - * the thread when work is performed on - * behalf of the principal. - * - * @return - * A String containing the name; empty if not applicable. - * - */ -public String getUserProfileName() { - return ""; -} -/** - * Initializes transient data. - * - *

    Subclasses should override as necessary to - * initialize additional class-specific data. - * - */ -void initTransient() { -} -/** - * Overrides the ObjectInputStream.readObject() method in order to return any - * transient parts of the object to there properly initialized state. - * - * By calling ObjectInputStream.defaultReadObject() we restore the state of - * any non-static and non-transient variables. We then continue on to - * restore the state (as necessary) of the remaining varaibles. - * - * @param in - * The input stream from which to deserialize the object. - * - * @exception ClassNotFoundException - * If the class being deserialized is not found. - * - * @exception IOException - * If an error occurs while communicating with the system. - * - */ -private void readObject(java.io.ObjectInputStream in) - throws ClassNotFoundException, java.io.IOException -{ - in.defaultReadObject(); - initTransient(); -} -/** - * Removes the specified listener from the internal list. - * - *

    Does nothing if the listener is not in the list. - * - * @param listener - * The PropertyChangeListener. - * - * @see #addPropertyChangeListener - * - */ -public void removePropertyChangeListener(PropertyChangeListener listener) { - changes_.removePropertyChangeListener(listener); -} -/** - * Removes the specified listener from the internal list. - * - *

    Does nothing if the listener is not in the list. - * - * @param listener - * The VetoableChangeListener. - * - * @see #addVetoableChangeListener - * - */ -public void removeVetoableChangeListener(VetoableChangeListener listener) { - vetos_.removeVetoableChangeListener(listener); -} -/** - * Sets the AS400 system object for the principal. - * - * @param system - * The AS400 system object. - * - * @exception PropertyVetoException - * If the change is vetoed. - * - */ -public void setSystem(AS400 system) throws PropertyVetoException { - AS400 old = getSystem(); - fireVetoableChange("system", old, system); - system_ = system; - firePropertyChange("system", old, system); -} -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/AS400PrincipalBeanInfo.java b/cvsroot/src/com/ibm/as400/security/auth/AS400PrincipalBeanInfo.java deleted file mode 100644 index 4799e4aa9..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/AS400PrincipalBeanInfo.java +++ /dev/null @@ -1,166 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400PrincipalBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.security.auth; - -import java.awt.Image; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyDescriptor; -import java.beans.IntrospectionException; -import java.beans.SimpleBeanInfo; - -/** - * Bean information for the AS400Principal class. - * - */ -public class AS400PrincipalBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private final static Class beanClass = AS400Principal.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_a loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getAccessText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getAccessText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getAccessText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getAccessText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = { changed, veto}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor system = new PropertyDescriptor("system", beanClass, "getSystem", "setSystem"); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(loader_.getAccessText("PROP_NAME_SYSTEM")); - system.setShortDescription(loader_.getAccessText("PROP_DESC_SYSTEM")); - - PropertyDescriptor name = new PropertyDescriptor("name", beanClass, "getName", null); - name.setBound(false); - name.setConstrained(false); - name.setDisplayName(loader_.getText("PROP_NAME_PR_NAME")); - name.setShortDescription(loader_.getText("PROP_DESC_PR_NAME")); - - PropertyDescriptor user = new PropertyDescriptor("user", beanClass, "getUser", null); - user.setBound(false); - user.setConstrained(false); - user.setDisplayName(loader_.getText("PROP_NAME_PR_USER")); - user.setShortDescription(loader_.getText("PROP_DESC_PR_USER")); - user.setExpert(true); - - properties_ = new PropertyDescriptor[] { system, name, user}; - } - catch ( Exception e ) - { - AuthenticationSystem.handleUnexpectedException(e); - } - - } - - - /** - * Returns the index of the default event. - * - * @return The index to the default event. - * - */ - public int getDefaultEventIndex() - { - return 0; - } - - - /** - * Returns the index of the default property. - * - * @return The index to the default property. - * - */ - - public int getDefaultPropertyIndex() - { - return 0; - } - - - /** - * Returns the descriptors for all events. - * - * @return The descriptors for all events. - * - */ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - - /** - * Returns an Image for this bean's icon. - * - *

    The superclass returns a generic image; subclasses - * should override with specific images as appropriate. - * - * @param icon The desired icon size and color. - * - * @return The Image for the icon. - * - */ - public Image getIcon(int icon) - { - Image image = null; - switch ( icon ) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("Principal16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("Principal32.gif"); - break; - } - return image; - } - - - /** - * Returns the descriptors for all properties. - * - * @return The descriptors for all properties. - * - */ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/AS400SwappableCredential.java b/cvsroot/src/com/ibm/as400/security/auth/AS400SwappableCredential.java deleted file mode 100644 index 17b95989b..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/AS400SwappableCredential.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ibm.as400.security.auth; - -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400SwappableCredential.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -/** - * The AS400SwappableCredential interface defines IBM i - * credentials that can be exploited by authentication services - * to swap the operating system thread identity when running - * on the local IBM i system. - * - */ -public interface AS400SwappableCredential { - -/** - * Attempts to swap the thread identity based on the - * credential. - * - *

    No return credential is generated. - * - * @exception Exception - * If an exception occurs. - * - */ -public void swap() throws Exception; -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/AuthenticationSystem.java b/cvsroot/src/com/ibm/as400/security/auth/AuthenticationSystem.java deleted file mode 100644 index 8ab825cb1..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/AuthenticationSystem.java +++ /dev/null @@ -1,109 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AuthenticationSystem.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.security.auth; - -import java.beans.PropertyVetoException; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400Exception; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.InternalErrorException; -import com.ibm.as400.access.Trace; - -// Common point of access for system information used during authentication of server principals and credentials. -class AuthenticationSystem -{ - private static AS400 system_ = null; - private static boolean onAS400_ = false; - - static - { - try - { - AuthenticationSystem.system_ = new AS400(); - AuthenticationSystem.system_.setGuiAvailable(false); - } - catch (PropertyVetoException e) - { - handleUnexpectedException(e); - } - - try - { - String osName = System.getProperty("os.name"); - Trace.log(Trace.DIAGNOSTIC, "Detected os.name: " + osName); - if (osName != null && osName.equalsIgnoreCase("OS/400")) AuthenticationSystem.onAS400_ = true; - } - catch (SecurityException e) - { - Trace.log(Trace.WARNING, "Error retrieving os.name:", e); - } - } - - // This class is not intended to be instantiated. - private AuthenticationSystem() - { - } - - // Logs trace information and throws an InternalErrorException. - // @param t The unexpected throwable. - static void handleUnexpectedException(Throwable t) - { - Trace.log(Trace.ERROR, "Unexpected Exception:", t); - if (t instanceof AS400Exception) - { - AS400Message[] messageList = ((AS400Exception)t).getAS400MessageList(); - for (int msg = 0; msg < messageList.length; msg++) - Trace.log(Trace.ERROR, messageList[msg].toString()); - } - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - - // Indicates if the given IBM i system and its user ID match the current environment. - // @return true if matched; false otherwise. - static boolean isLocal(AS400 system) - { - return system.isLocal() && system.getUserId().trim().equalsIgnoreCase(new AS400().getUserId()); - } - - // Returns a system object representing the local host. This value is cached so that the same instance is returned on subsequent calls. - // @return The system object. - static AS400 localHost() - { - return AuthenticationSystem.system_; - } - - // Resets services for the local host; ignored if not running on an IBM i system. Since the cached system is always intended to represent the current system and user, it is always affected when a swap occurs. A reset is also required to allow the correct evaluation of when to use native optimizations. - static void resetLocalHost() - { - // Ignore if not running on IBM i. - if (!AuthenticationSystem.onAS400_) return; - - // Reset services for the cached system started under the old identity. - try - { - // Disconnect and reset the state of the system object. - AuthenticationSystem.system_.resetAllServices(); - // Reset the system user ID & password to force re-resolve. - AuthenticationSystem.system_.setUserId(""); - AuthenticationSystem.system_.setPassword(""); - // Request a service port to take system out of unset state. - AuthenticationSystem.system_.getServicePort(AS400.SIGNON); - } - catch (PropertyVetoException e) - { - handleUnexpectedException(e); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/Credential16.gif b/cvsroot/src/com/ibm/as400/security/auth/Credential16.gif deleted file mode 100644 index fafd19005..000000000 Binary files a/cvsroot/src/com/ibm/as400/security/auth/Credential16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/security/auth/Credential32.gif b/cvsroot/src/com/ibm/as400/security/auth/Credential32.gif deleted file mode 100644 index 22e86bd05..000000000 Binary files a/cvsroot/src/com/ibm/as400/security/auth/Credential32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/security/auth/DefaultProfileTokenProvider.java b/cvsroot/src/com/ibm/as400/security/auth/DefaultProfileTokenProvider.java deleted file mode 100644 index 73634986a..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/DefaultProfileTokenProvider.java +++ /dev/null @@ -1,288 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DefaultProfileTokenProvider.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2009-2009 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.security.auth; - -import java.beans.PropertyVetoException; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.InternalErrorException; -import com.ibm.as400.access.Trace; - -/** - * A default implementation of the {@link ProfileTokenProvider ProfileTokenProvider} interface. - */ -public class DefaultProfileTokenProvider implements ProfileTokenProvider -{ - private static final int UNINITIALIZED = -1; - - /** The system used by the ProfileTokenCredential class */ - private AS400 system_; - - /** The timeout interval, in seconds, for the profile token this class creates */ - private int timeoutInterval_ = UNINITIALIZED; - - /** The user which the profile token credential is created for (i.e. who the credential represents) */ - private String userId_ = null; - - /** The type of profile token to create */ - private int tokenType_ = UNINITIALIZED; - - /** Any extended information needed to create the profile token */ - private Object extendedInfo_; - - /** - * Constructs a new DefaultProfileTokenProvider - */ - public DefaultProfileTokenProvider() { - this(new AS400()); - } - - /** - * Constructs a new DefaultProfileTokenProvider. The specified system - * will be used during the creation of the profile token credential. - * - * @param system The system to use during the creation of the profile token credential. - */ - public DefaultProfileTokenProvider(AS400 system) { - setSystem(system); - } - - /** - * Retrieves the system that is used during the creation of the profile token credential. - * - * @return The system that is used during the creation of the profile token credential. - * Returns null if the system has not been set. - */ - public AS400 getSystem() { - return system_; - } - - /** - * Sets the system that is used during the creation of the profile token credential. - * - * @param system The system for the profile token. - */ - public void setSystem(AS400 system) { - system_ = system; - } - - /** - * Retrieves the timeout interval that is specified during the creation of the profile token credential. - * - * @return The timeout interval for the profile token. - * Returns -1 if the timeout interval has not been set. - */ - public int getTimeoutInterval() { - return timeoutInterval_; - } - - /** - * Sets the timeout interval that is specified during the creation of the profile token credential. - * - * @param timeoutInterval The timeout interval for the profile token. - */ - public void setTimeoutInterval(int timeoutInterval) { - timeoutInterval_ = timeoutInterval; - } - - /** - * Retrieves the token type that is specified during the creation of the profile token credential. - * - * @return The token type for the profile token. - * Returns null if the token type has not been set. - */ - public int getTokenType() { - return tokenType_; - } - - /** - * Sets the token type that is specified during the creation of the profile token credential. - * @param tokenType The token type for the profile token. - * Valid values are: - *

      - *
    • {@link ProfileTokenCredential#TYPE_SINGLE_USE TYPE_SINGLE_USE}
    • - *
    • {@link ProfileTokenCredential#TYPE_MULTIPLE_USE_RENEWABLE TYPE_MULTIPLE_USE_RENEWABLE}
    • - *
    • {@link ProfileTokenCredential#TYPE_MULTIPLE_USE_NON_RENEWABLE TYPE_MULTIPLE_USE_NON_RENEWABLE}
    • - *
    - * - * @throws ExtendedIllegalArgumentException If the input token type is not valid - */ - public void setTokenType(int tokenType) - { - if ( (tokenType != ProfileTokenCredential.TYPE_SINGLE_USE) && - (tokenType != ProfileTokenCredential.TYPE_MULTIPLE_USE_RENEWABLE) && - (tokenType != ProfileTokenCredential.TYPE_MULTIPLE_USE_NON_RENEWABLE) ) - { - throw new ExtendedIllegalArgumentException("tokenType", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - tokenType_ = tokenType; - } - - /** - * Retrieves the user ID that is specified during the creation of the profile token credential. - * - * @return The user ID for the profile token. - * Returns null if the user ID has not been set. - */ - public String getUserId() { - return userId_; - } - - /** - * Sets the user ID that is used during the creation of the profile token credential. - * - * @param userId The user ID for the profile token. - */ - public void setUserId(String userId) - { - if ( (null == userId) || (0 == userId.length()) ) { - throw new ExtendedIllegalArgumentException("userId", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - userId_ = userId; - } - - /** - * Retrieves any extended information used during the creation of the profile token credential. - * This extended information may be a password for the profile token user ID, a special - * value that instructs the profile token to be created in a certain manner, etc. - * - * @return Any extended information for the profile token. - * Returns null if the extended information has not been set. - */ - public Object getExtendedInfo() { - return extendedInfo_; - } - - /** - * Sets the password for the user ID that is used during the - * creation of the profile token credential. - * - * @param password The password for the user ID that is used - * during the creation of the profile token credential. - */ - public void setPassword(String password) - { - if (password == null) { - throw new NullPointerException("password"); - } - if (password.length() == 0) { - throw new ExtendedIllegalArgumentException("password", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - setExtendedInfo(password); - } - - /** - * Sets the password special value to be used during the creation of the profile token credential. - * - * @param specialValue The special value. Valid values for this parameter are: - *

      - *
    • {@link ProfileTokenCredential#PW_NOPWD PW_NOPWD}
    • - *
    • {@link ProfileTokenCredential#PW_NOPWDCHK PW_NOPWDCHK}
    • - *
    - * - * @throws ExtendedIllegalArgumentException If the input special value is not valid - */ - public void setPasswordSpecialValue(int specialValue) - { - if ( (specialValue != ProfileTokenCredential.PW_NOPWD) && - (specialValue != ProfileTokenCredential.PW_NOPWDCHK) ) { - throw new ExtendedIllegalArgumentException("specialValue", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - setExtendedInfo(new Integer(specialValue)); - } - - /** - * Sets the extended information used during the creation of the profile token credential. - * - * @param extendedInfo The extended information for the profile token. - */ - protected void setExtendedInfo(Object extendedInfo) { - // Assume that the caller has verified that the value is non-null. - extendedInfo_ = extendedInfo; - } - - /** - * Creates and returns a new profile token credential. - * Before calling this method, the following properties must be set: system, timeout interval, user ID, token type, and extended info. - * - * @return A newly created profile token credential - * @throws AS400SecurityException If an IBM i system security or authentication error occurs - * @throws ExtendedIllegalStateException If a required property has not been set - * @see ProfileTokenProvider#create() - */ - public ProfileTokenCredential create() throws AS400SecurityException - { - // Verify that all required fields have been set - checkFieldSet(system_, "system"); - checkFieldSet(timeoutInterval_, "timeoutInterval"); - checkFieldSet(userId_, "userId"); - checkFieldSet(tokenType_, "tokenType"); - checkFieldSet(extendedInfo_, "extendedInfo"); - - try { - ProfileTokenCredential newToken = new ProfileTokenCredential(); - newToken.setSystem(getSystem()); - newToken.setTimeoutInterval(getTimeoutInterval()); - newToken.setTokenType(getTokenType()); - - Object extended = getExtendedInfo(); - - if (extended instanceof Integer) { - newToken.setToken(getUserId(), ((Integer)extended).intValue()); - } - else if (extended instanceof String) { - newToken.setTokenExtended(getUserId(), (String)extended); - } - else { - throw new ExtendedIllegalStateException("extendedInfo", ExtendedIllegalStateException.UNKNOWN); - } - return newToken; - } - catch (PropertyVetoException pve) { - // Because we have internally created a new profile token credential - // object, there should be no property listeners for it. Thus it should - // not be possible for anyone to veto any property changes. If this - // somehow happens, we do not understand what is going on. - Trace.log(Trace.ERROR, "Unexpected PropertyVetoException:", pve); - throw new InternalErrorException(InternalErrorException.UNEXPECTED_EXCEPTION); - } - } - - /** - * Validate the specified field is set, that is, not null. - * - * @param field The field - * @param fieldName The name of the field to check - */ - protected final void checkFieldSet(Object field, String fieldName) { - if (null == field) { - throw new ExtendedIllegalStateException(fieldName, ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - - /** - * Validate the specified field is set, that is, not null. - * - * @param field The field - * @param description The description to use for the exception thrown if the field is not set - */ - protected final void checkFieldSet(int field, String description) { - if (field < 0) { - throw new ExtendedIllegalStateException(description, ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/DestroyFailedException.java b/cvsroot/src/com/ibm/as400/security/auth/DestroyFailedException.java deleted file mode 100644 index 6dedc0c7c..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/DestroyFailedException.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.ibm.as400.security.auth; - -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DestroyFailedException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -import com.ibm.as400.access.AS400Message; -/** - * The DestroyFailedException class represents an exception - * issued when error occur when destroying IBM i system - * authentication information. - * - *

    If available, one or more AS400Message objects may - * be included in the exception. - * - */ -public class DestroyFailedException extends AS400AuthenticationException { - - static final long serialVersionUID = 4L; - - -/** - * Constructs a DestroyFailedException. - * - */ -DestroyFailedException() { - super(); -} -/** - * Constructs a DestroyFailedException. - * - * @param list - * The AS400Message objects to be associated - * with the exception. - * - */ -DestroyFailedException(AS400Message[] list) { - super(list); -} -/** - * Constructs a DestroyFailedException. - * - * @param rc - * The return code identifying the detail text - * to assign to the exception. - * - */ -DestroyFailedException(int rc) { - super(rc); -} -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/Principal16.gif b/cvsroot/src/com/ibm/as400/security/auth/Principal16.gif deleted file mode 100644 index 89dbceead..000000000 Binary files a/cvsroot/src/com/ibm/as400/security/auth/Principal16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/security/auth/Principal32.gif b/cvsroot/src/com/ibm/as400/security/auth/Principal32.gif deleted file mode 100644 index 5bfb6378c..000000000 Binary files a/cvsroot/src/com/ibm/as400/security/auth/Principal32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleCredential.java b/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleCredential.java deleted file mode 100644 index 6b617aec6..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleCredential.java +++ /dev/null @@ -1,262 +0,0 @@ -package com.ibm.as400.security.auth; - -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProfileHandleCredential.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import java.beans.PropertyVetoException; -/** - * Represents an IBM i system profile handle. - * - *

    This credential does not support all possible behavior - * for IBM i system profile handles. It is provided to fill a secondary - * role in support of other credentials when running on the - * local IBM i system. A profile handle credential provides the ability - * to store the current thread identity and restore that - * identity after performing a swap based on another - * credential (i.e. ProfileTokenCredential). - * - * @see AS400Credential - * @see ProfileTokenCredential - * - */ -public final class ProfileHandleCredential extends AS400Credential { - - static final long serialVersionUID = 4L; - - - private byte[] handle_ = null; - - /** - Indicates the length of a profile handle (in bytes) - **/ - public static final int HANDLE_LENGTH = 12; -/** - * Constructs a ProfileHandleCredential object. - * - */ -public ProfileHandleCredential() { - super(); -} -/** - * Compares the specified Object with the credential - * for equality. - * - * @param o - * Object to be compared for equality. - * - * @return - * true if equal; otherwise false. - * - */ -public boolean equals(Object o) { - if (o == null) - return false; - if (this == o) - return true; - if (!(o instanceof ProfileHandleCredential)) - return false; - return - hashCode() == ((ProfileHandleCredential)o).hashCode(); -} -/** - * Returns the actual bytes for the handle as it exists - * on the IBM i system. - * - * @return - * The handle bytes; null if not set. - * - */ -public byte[] getHandle() { - return handle_; -} -/** - * Returns a hash code for this credential. - * - * @return a hash code for this credential. - * - */ -public int hashCode() { - int hash = 19913; - if (handle_ != null) - for (int i=0; i These are the values initialized prior to - * accessing host information for or taking action against - * the credential and not modified thereafter until - * the credential is destroyed. - * - */ -void invalidateProperties() { - super.invalidateProperties(); - handle_ = null; -} -/** - * Sets the handle based on the current thread identity. - * - *

    The system property must be set prior to - * invoking this method. - * - *

    If successful, this method results in a new profile - * handle being created on the IBM i system. - * - *

    This property cannot be changed once a request - * initiates a connection for the object to the - * IBM i system. - * - * @exception AS400SecurityException - * If an IBM i system security or authentication error occurs. - * - * @exception PropertyVetoException - * If the change is vetoed. - * - * @exception ExtendedIllegalStateException - * If the token cannot be initialized due - * to the current state. - * - */ -public void setHandle() throws PropertyVetoException, AS400SecurityException { - // Validate state - validatePropertySet("system", getSystem()); - // Instantiate a new impl but do not yet set as the default impl_ - ProfileHandleImpl impl = (ProfileHandleImpl)getImplPrimitive(); - // Generate and set the handle value - setHandle(impl.getCurrentHandle()); - // If successful, all defining attributes are now set. - // Set the impl for subsequent references. - setImpl(impl); - // Indicate that a new handle was created. - fireCreated(); -} -/** - * Sets the actual bytes for the handle as it exists - * on the IBM i system. - * - *

    This method allows a credential to be constructed - * based on an existing handle (i.e. previously created using the - * QSYGETPH system API). - * - *

    This property cannot be changed once a request - * initiates a connection for the object to the - * IBM i system. - * - * @param bytes - * The handle bytes. - * - * @exception PropertyVetoException - * If the change is vetoed. - * - * @exception ExtendedIllegalArgumentException - * If the provided value exceeds the maximum - * allowed length. - * - * @exception ExtendedIllegalStateException - * If the property cannot be changed due - * to the current state. - * - */ -public void setHandle(byte[] bytes) throws PropertyVetoException { - // Validate state - validatePropertyChange("handle"); - - // Validate parms - if ((bytes != null) && (bytes.length != HANDLE_LENGTH)) { - Trace.log(Trace.ERROR, "Handle of length " + bytes.length + " not valid "); - throw new ExtendedIllegalArgumentException( - "bytes", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - byte[] old = getHandle(); - fireVetoableChange("handle", old, bytes); - handle_ = bytes; - firePropertyChange("handle", old, bytes); -} -/** - * Indicates if instances of the class are sufficient - * by themselves to change the OS thread identity. - * - *

    Typically this behavior is dictated by the type - * of credential and need not be changed for - * individual instances. - * - * @return - * true - * - */ -boolean typeIsStandalone() { - return true; -} -/** - * Validates that all properties required to define the - * credential have been set. - * - *

    These are the values initialized prior to - * accessing host information for or taking action against - * the credential and not modified thereafter until - * the credential is destroyed. - * - * @exception ExtendedIllegalStateException - * If a required property is not set. - * - */ -void validateProperties() { - super.validateProperties(); - validatePropertySet("handle", getHandle()); -} -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleCredential16.gif b/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleCredential16.gif deleted file mode 100644 index 341b2f67f..000000000 Binary files a/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleCredential16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleCredential32.gif b/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleCredential32.gif deleted file mode 100644 index 321e2a87d..000000000 Binary files a/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleCredential32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleCredentialBeanInfo.java b/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleCredentialBeanInfo.java deleted file mode 100644 index 0b025eafc..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleCredentialBeanInfo.java +++ /dev/null @@ -1,117 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProfileHandleCredentialBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.security.auth; - -import java.awt.Image; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.IntrospectionException; -import java.beans.BeanDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.PropertyDescriptor; -/** - * Bean information for the ProfileHandleCredential class. - * - */ -public class ProfileHandleCredentialBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private final static Class beanClass = ProfileHandleCredential.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_a loader_; - - private static PropertyDescriptor[] properties_; - - static - { - try - { - // ***** PROPERTIES - PropertyDescriptor handle = new PropertyDescriptor("handle", beanClass); - handle.setBound(true); - handle.setConstrained(true); - handle.setDisplayName(loader_.getText("PROP_NAME_CR_PH_HANDLE")); - handle.setShortDescription(loader_.getText("PROP_DESC_CR_PH_HANDLE")); - - properties_ = new PropertyDescriptor[] { handle }; - } - catch ( Exception e ) - { - AuthenticationSystem.handleUnexpectedException(e); - } - } - - - /** - * Returns additional bean information. - * - * @return - * The bean information. - * - */ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new AS400CredentialBeanInfo()}; - } - - - /** - * Returns the bean descriptor. - * - * @return The bean descriptor. - * - */ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - * Returns an Image for this bean's icon. - * - * @param icon The desired icon size and color. - * - * @return The Image for the icon. - * - */ - public Image getIcon(int icon) - { - Image image = null; - switch ( icon ) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("ProfileHandleCredential16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("ProfileHandleCredential32.gif"); - break; - } - return image; - } - - - /** - * Returns the descriptors for all properties. - * - * @return The descriptors for all properties. - * - */ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleImpl.java b/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleImpl.java deleted file mode 100644 index 1a5321646..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ibm.as400.security.auth; - -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProfileHandleImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -/** - * The ProfileHandleImpl interface provides the template for - * classes implementing behavior delegated by a - * ProfileHandleCredential. - * - */ -public interface ProfileHandleImpl extends AS400CredentialImpl { - -/** - * Generates and returns a profile handle based on - * the current thread identity. - * - * @return - * The handle bytes. - * - * @exception RetrieveFailedException - * If errors occur while generating the handle. - * - */ -byte[] getCurrentHandle() throws RetrieveFailedException; -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleImplRemote.java b/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleImplRemote.java deleted file mode 100644 index 1067c3b65..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/ProfileHandleImplRemote.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.ibm.as400.security.auth; - -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProfileHandleImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -import com.ibm.as400.access.Trace; -/** - * The ProfileHandleImplRemote class provides an implementation for - * behavior delegated by a ProfileHandleCredential object. - * - */ -class ProfileHandleImplRemote extends AS400CredentialImplRemote implements ProfileHandleImpl { - -/** - * Generates and returns a profile handle based on - * the current IBM i thread identity. - * - *

    The remote implementation always throws an - * exception. The ProfileHandleCredential has little use - * in remote environments and is introduced in a - * limited capacity to support reestablishing thread - * identity after performing a swap based on another - * credential. Swapping the IBM i thread ID is not - * supported in remote environments. - * - * @return - * The handle bytes. - * - * @exception RetrieveFailedException - * If errors occur while generating the handle. - * - */ -public byte[] getCurrentHandle() throws RetrieveFailedException { - Trace.log(Trace.ERROR, "Unsupported remote operation"); - throw new RetrieveFailedException( - RetrieveFailedException.REQUEST_NOT_SUPPORTED); -} -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenCredential.java b/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenCredential.java deleted file mode 100644 index 72be4c55c..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenCredential.java +++ /dev/null @@ -1,1360 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProfileTokenCredential.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - - -package com.ibm.as400.security.auth; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import java.beans.PropertyVetoException; -import java.util.Random; - -/** - * The ProfileTokenCredential class represents an IBM i system profile token. - * - *

    A profile token provides a timed credential representing an - * authenticated system user profile and password. A profile token can be - * established in either a remote (not running on the target system) or local - * (running on the target system) context. Once created, it may be - * serialized or distributed as required by the application. - * - *

    When referenced from a running process on the associated IBM i system, - * a profile token can be used to modify or swap the thread - * identity and perform a specific task or tasks on behalf of the - * authenticated user. However, a profile token generated on one IBM i - * system cannot be used to swap thread identity on any other system. - * - *

    An application of this support would be in a single tier - * application running on the system when a designated operation must be - * run under the system authorities and permissions of a specific - * user profile. A profile token can be used to swap identity prior - * to performing the operation. Support is also provided to swap - * back to the original identity upon completion. - * - *

    Another application of this support might be in a two tier - * application, with authentication of a user profile and password being - * performed by a graphical user interface on the first tier (i.e. a PC) and - * work being performed for that user on the second tier (the IBM i system). - * By utilizing ProfileTokenCredentials, the application can avoid directly - * passing the user ID and password over the network. The profile token can - * be distributed as required to the program on the second tier, which can - * perform the swap() and run designated operations under the - * system authorities and permissions assigned to the user. - * - *

    Note: While inherently more secure than passing a user profile - * and password due to limited life span, profile tokens should still be - * considered sensitive information by the application and handled accordingly. - * Since the token represents an authenticated user and password, it could - * potentially be exploited by a hostile application to perform work on - * behalf of that user. It is ultimately the responsibility of the - * application to ensure that credentials are accessed in a secure manner. - * - *

    Profile tokens are only supported for IBM i systems - * at release V4R5M0 or greater. - * - *

    The following example demonstrates the use of a ProfileTokenCredential - * when run on the local IBM i system. (Note: swap() is an - * unsupported remote operation.) - * - *

    - *  // Prepare to work with the local IBM i system.
    - *   AS400 system = new AS400("localhost", "*CURRENT", "*CURRENT");
    - *
    - *  // Create a single-use ProfileTokenCredential with a 60 second timeout.
    - *  // A valid user ID and password must be substituted.
    - *   ProfileTokenCredential pt = new ProfileTokenCredential();
    - *   pt.setSystem(system);
    - *   pt.setTimeoutInterval(60);
    - *   pt.setTokenType(ProfileTokenCredential.TYPE_SINGLE_USE);
    - *   pt.setTokenExtended("USERID", "PASSWORD");
    - *
    - *  // Swap the thread identity, retrieving a credential to
    - *  // later swap back to the original identity.
    - *   AS400Credential cr = pt.swap(true);
    - *
    - *  // Perform work under the swapped identity at this point.
    - *  // Newly-connected AS400 objects will run under the new (swapped-to) identity.
    - *   AS400 swapped = new AS400("localhost", "*CURRENT", "*CURRENT");
    - *
    - *  // Swap back to the original thread identity.
    - *   cr.swap();
    - *
    - *  // Clean up the credentials.
    - *   cr.destroy();
    - *   pt.destroy();
    - * 
    - * - *

    General restrictions: - *

      - *
    • Creating a token updates the last-used date for the associated - * user and group profiles.
    • - *
    • Creating a token resets the 'signon attempts not valid' count to - * zero for the user profile.
    • - *
    • If security-related events are being audited, creating a token - * adds an entry to the AUDJRN audit journal.
    • - *
    • The maximum number of profile tokens that can be generated is - * approximately 2,000,000; after that, the space to store them is full. - * Message CPF4AAA is sent to the caller, and no more profile - * tokens can be generated until one is removed.
    • - *
    • You cannot obtain a profile token for the following - * system-supplied user profiles: - *
        - *
      • QAUTPROF - *
      • QFNC - *
      • QNETSPLF - *
      • QSPLJOB - *
      • QDBSHR - *
      • QGATE - *
      • QNFSANON - *
      • QSYS - *
      • QDFTOWN - *
      • QLPAUTO - *
      • QRJE - *
      • QTCP - *
      • QDIRSRV - *
      • QLPINSTALL - *
      • QSNADS - *
      • QTFTP - *
      • QDOC - *
      • QMSF - *
      • QSPL - *
      • QTSTRQS - *
      • QDSNX - *
      - *
    • - *
    - * - *

    Guidelines and restrictions for generating profile tokens based - * on a specified user profile name and password: - *

      - *
    • On level 10 systems, only the user ID is validated - * because no passwords are required.
    • - *
    • If a provided password is not correct, the incorrect password - * count for the user profile is increased. (The QMAXSIGN system - * value contains the maximum number of incorrect attempts to sign on.)
    • - *
    • If the QMAXSGNACN system value is set to disable - * user profiles, repeated attempts to validate an incorrect - * password disables the user ID. This keeps applications - * from methodically determining user passwords.
    • - *
    • Considerations when specifying a password of *NOPWD or *NOPWDCHK: - *
        - *
      • To obtain a profile token for a profile that does not have a - * password, specify *NOPWD or *NOPWDCHK for the password - * parameter.
      • - *
      • The user requesting the profile token must have *USE - * authority to the user profile.
      • - *
      • *NOPWD is not allowed if the user profile name is the name - * of the currently running user profile.
      • - *
      • If the password is *NOPWDCHK and the user requesting the - * profile token has *ALLOBJ and *SECADM special authorities, a - * profile token will be generated even when the status of the - * profile is disabled or its password is expired.
      • - *
      • No profile token is created in the following situations: - *
          - *
        • The user profile is disabled and *NOPWDCHK is not - * specified for the password parameter, or *NOPWDCHK was - * specified but the user requesting the profile token does - * not have *ALLOBJ or *SECADM special authority.
        • - *
        • The password is expired and *NOPWDCHK is not - * specified for the password parameter, or *NOPWDCHK was - * specified but the user requesting the profile token does - * not have *ALLOBJ or *SECADM special authority.
        • - *
        • The password is *NONE, and *NOPWD or *NOPWDCHK is not - * specified for the password parameter.
        • - *
        - *
      • - *
      - *
    • - *
    - * - * @see AS400Credential - * - */ -public final class ProfileTokenCredential extends AS400Credential - implements AS400BasicAuthenticationCredential { - - static final long serialVersionUID = 4L; - - private byte[] addr_ = new byte[9]; // Encode/decode adder - private byte[] mask_ = new byte[7]; // Encode/decode mask - private byte[] token_ = null; // encoded token - private int type_ = TYPE_SINGLE_USE; - private int timeoutInterval_ = 3600; - private final static int MAX_USERPROFILE_LENGTH = 10; - private final static int MAX_PASSWORD_LENGTH = 128; - - /** - ID indicating a single use token. - **/ - public final static int TYPE_SINGLE_USE = 1; - - /** - ID indicating a multiple use token that cannot be regenerated. - **/ - public final static int TYPE_MULTIPLE_USE_NON_RENEWABLE = 2; - - /** - ID indicating a multiple use token that can be regenerated. - **/ - public final static int TYPE_MULTIPLE_USE_RENEWABLE = 3; - - /** - Indicates the length of a profile token (in bytes) - **/ - public final static int TOKEN_LENGTH = 32; - - /** - * Password special value indicating that the current password is - * not verified. - *

    The user requesting the profile token must have *USE authority - * to the user profile. - *

    This value is not allowed if the name of the currently running - * profile is specified for the user profile name parameter. - */ - public final static int PW_NOPWD = 1; //$A2 - - /** - * Password special value indicating that a profile token can be - * generated for a profile that is disabled or has an expired password. - *

    The user requesting the profile token must have *USE authority to - * the user profile. - *

    If the profile is disabled, the user requesting the profile token - * must have *ALLOBJ and *SECADM special authorities to get a token. - *

    If the password is expired, the user requesting the profile token - * must have *ALLOBJ and *SECADM special authorities to get a token. - *

    If the requesting user does not have *ALLOBJ and *SECADM special - * authorities, then the request will be handled as if they had - * indicated *NOPWD. - */ - public final static int PW_NOPWDCHK = 2; //$A2 - - /** - * Constructs a ProfileTokenCredential object. - * - *

    The system and token must be set - * prior to accessing host information or taking - * action against the credential. - * - */ - public ProfileTokenCredential() { - super(); - new Random().nextBytes(addr_); - new Random().nextBytes(mask_); - } - - /** - * Constructs and initializes a ProfileTokenCredential object. - * - *

    The system, token, tokenType, and - * timeoutInterval properties are initialized to - * the specified values. - * - *

    This method allows a credential to be constructed - * based on an existing token (i.e. previously created using the - * QSYGENPT system API). It is the responsibility of the - * application to ensure the tokenType and - * timeoutInterval are consistent with - * the specified token value. - * - * @param system - * The system associated with the credential. - * - * @param token - * The actual bytes for the token as it exists on the - * IBM i system. - * - * @param tokenType - * The type of token provided. - * Possible types are defined as fields on this class: - *

      - *
    • TYPE_SINGLE_USE - *
    • TYPE_MULTIPLE_USE_NON_RENEWABLE - *
    • TYPE_MULTIPLE_USE_RENEWABLE - *
    - * - * @param timeoutInterval - * The number of seconds to expiration, used as the - * default value when the token is refreshed (1-3600). - * - */ - public ProfileTokenCredential(AS400 system, byte[] token, - int tokenType, int timeoutInterval) { - this(); - try { - setSystem(system); - setToken(token); - setTokenType(tokenType); - setTimeoutInterval(timeoutInterval); - } - catch (PropertyVetoException pve) { - AuthenticationSystem.handleUnexpectedException(pve); - } - } - - /** - * Decode the bytes based on the adder and mask. - * - * @return - * The decoded byte array. - * - */ - private static byte[] decode(byte[] adder, byte[] mask, byte[] bytes) { - byte[] buf = new byte[bytes.length]; - for (int i = 0; i < bytes.length; i++) - buf[i] = (byte)( - (mask[i % mask.length] ^ bytes[i]) - - adder[i % adder.length]); - return buf; - } - - /** - * Encode the bytes based on the adder and mask. - * - * @return - * The encoded byte array. - * - */ - private static byte[] encode(byte[] adder, byte[] mask, byte[] bytes) { - byte[] buf = new byte[bytes.length]; - for (int i = 0; i < bytes.length; i++) - buf[i] = (byte)( - (bytes[i] + adder[i % adder.length]) - ^ mask[i % mask.length]); - return buf; - } - - /** - * Compares the specified Object with the credential - * for equality. - * - * @param o - * Object to be compared for equality. - * - * @return - * true if equal; otherwise false. - * - */ - public boolean equals(Object o) { - if (o == null) - return false; - if (this == o) - return true; - if (!(o instanceof ProfileTokenCredential)) - return false; - return - hashCode() == ((ProfileTokenCredential)o).hashCode(); - } - - /** - * Returns the number of seconds to expiration assigned - * when the token was last initialized or refreshed. - * - *

    This value also provides the default value for - * subsequent refresh attempts. - * - *

    The default value is 3600 (1 hour). - * - * @return - * The number of seconds. - * - */ - public int getTimeoutInterval() { - return timeoutInterval_; - } - - /** - * Returns the actual bytes for the token as it exists - * on the IBM i system. - * - * @return - * The token bytes; null if not set. - * - */ - public byte[] getToken() { - if (token_ != null) - return primitiveGetToken(); - return null; - } - - /** - * Returns an integer indicating the type assigned when - * the token was last initialized or refreshed. - * - *

    This value also provides the default value for - * subsequent refresh attempts. - * - *

    The default is TYPE_SINGLE_USE. - * - * @return - * The type of token. - * Possible types are defined as fields on this class: - *

      - *
    • TYPE_SINGLE_USE - *
    • TYPE_MULTIPLE_USE_NON_RENEWABLE - *
    • TYPE_MULTIPLE_USE_RENEWABLE - *
    - * - */ - public int getTokenType() { - return type_; - } - - /** - * Returns a hash code for this credential. - * - * @return a hash code for this credential. - * - */ - public int hashCode() { - int hash = 104473; - if (token_ != null) { - // Obtain unencrypted form as common base for comparison - byte[] tkn = getToken(); - for (int i=0; i> " - ).append(toString() - ).append(", for principal >> " - ).append(principal.toString() - ).append(", isPrivate == " - ).append(isPrivate - ).append(", isReusable == " - ).append(isReusable - ).append(", isRenewable == " - ).append(isRenewable - ).append(", timeoutInterval == " - ).append(timeoutInterval - ).toString()); - - // Validate parameters - if (isRenewable && !isReusable) { - Trace.log(Trace.ERROR, "Profile tokens must be multi-use" + - " if declared as regenerable."); - throw new ExtendedIllegalArgumentException("isReusable", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - // Assign to the local host system - AS400 sys = AuthenticationSystem.localHost(); - setSystem(sys); - // Assign an appropriate principal - AS400Principal pr = - (AS400Principal.class.isAssignableFrom(principal.getClass())) - ? (AS400Principal)principal - : new UserProfilePrincipal(sys, principal.getUserProfileName()); - setPrincipal(pr); - // Assign profile token attributes - private_ = isPrivate; - setTimeoutInterval(timeoutInterval); - if (isRenewable) setTokenType(TYPE_MULTIPLE_USE_RENEWABLE); - else if (isReusable) setTokenType(TYPE_MULTIPLE_USE_NON_RENEWABLE); - else setTokenType(TYPE_SINGLE_USE); - // Generate the token - setTokenExtended(pr, password); - } - - /** - * Reset the value of all properties used to define - * the credential. - * - *

    These are the values initialized prior to - * accessing host information for or taking action against - * the credential and not modified thereafter until - * the credential is destroyed. - * - */ - void invalidateProperties() { - super.invalidateProperties(); - token_ = null; - } - - /** - * Indicates if the credential can be refreshed. - * - * @return - * true if the validity period of the credential - * can be programmatically updated or extended - * using refresh(); otherwise false. - * - * @see #refresh - */ - public boolean isRenewable() { - return type_ == TYPE_MULTIPLE_USE_RENEWABLE; - } - - /** - * Indicates if the credential can be used multiple - * times prior to expiration. - * - * @return - * true if the credential can be used to swap - * thread identity multiple times; - * otherwise false. - * - */ - public boolean isReusable() { - return type_ == TYPE_MULTIPLE_USE_NON_RENEWABLE || - type_ == TYPE_MULTIPLE_USE_RENEWABLE; - } - - /** - * Returns the raw bytes for the token represented - * by the credential, decoding the value in - * memory. - * - * @return - * The token bytes. - * - */ - private byte[] primitiveGetToken() { - return decode(addr_, mask_, token_); - } - - /** - * Sets the raw bytes for the token represented - * by the credential, encoding the value in - * memory. - * - * @param bytes - * The token bytes. - * - */ - private void primitiveSetToken(byte[] bytes) { - token_ = encode(addr_, mask_, bytes); - } - - /** - * Updates or extends the validity period for the credential. - * - *

    Does nothing if the credential cannot be - * programmatically updated or extended. - * - *

    Otherwise, generates a new profile token based - * on the previously established token, type, - * and timeoutInterval. - * - * @exception AS400SecurityException - * If an IBM i system security or authentication error occurs. - * - */ - public void refresh() throws AS400SecurityException { - refresh(getTokenType(), getTimeoutInterval()); - } - - /** - * Updates or extends the validity period for the credential. - * - *

    Does nothing if the credential cannot be - * programmatically updated or extended. - * - *

    Otherwise, generates a new profile token based on - * the previously established token with the - * given type and timeoutInterval. - * - *

    If successful, the specified type and interval - * become the default values for future refresh - * attempts. - * - *

    This method is provided to handle cases where it is - * desirable to allow for a more restrictive type of token - * or a different timeout interval when a new token is - * generated during the refresh. - * - * @param type - * The type of token. - * Possible types are defined as fields on this class: - *

      - *
    • TYPE_SINGLE_USE - *
    • TYPE_MULTIPLE_USE_NON_RENEWABLE - *
    • TYPE_MULTIPLE_USE_RENEWABLE - *
    - * - * @param timeoutInterval - * The number of seconds before expiration (1-3600). - * - * @exception AS400SecurityException - * If an IBM i system security or authentication error occurs. - * - * @exception ExtendedIllegalArgumentException - * If a parameter value is out of range. - * - */ - public void refresh(int type, int timeoutInterval) - throws AS400SecurityException { - // Check permissions - checkAuthenticationPermission("refreshCredential"); - // Check status - if (!isRenewable()) - return; - // Validate parms - if (type < 1 || type > 3) { - Trace.log(Trace.ERROR, "Token type " + type + " out of range"); - throw new ExtendedIllegalArgumentException( - "type", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - if (timeoutInterval < 1 || timeoutInterval > 3600) { - Trace.log(Trace.ERROR, "Timeout interval " + timeoutInterval + " out of range"); - throw new ExtendedIllegalArgumentException( - "timeoutInterval", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // Refresh the credential - byte[] old = getToken(); - byte[] bytes = ((ProfileTokenImpl)getImpl()).refresh(type, timeoutInterval); - - primitiveSetToken(bytes); - type_ = type; - timeoutInterval_ = timeoutInterval; - - fireRefreshed(); - firePropertyChange("token", old, bytes); - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, - new StringBuffer("Credential refreshed with type " - ).append(type - ).append(" and timeoutInterval = " - ).append(timeoutInterval - ).append(" >> " - ).append(toString() - ).toString()); - } - - /** - * Sets the number of seconds to expiration when the - * token is generated or refreshed. - * - *

    It is the application's responsibility to maintain - * consistency between explicitly set token values (those - * not generated from a user and password) and the - * tokenType and timeoutInterval. - * - *

    This property cannot be changed once a request - * initiates a connection for the object to the - * IBM i system (for example, refresh). - * - * @param seconds - * The number of seconds to expiration (1-3600). - * - * @exception PropertyVetoException - * If the change is vetoed. - * - * @exception ExtendedIllegalArgumentException - * If the provided value is out of range. - * - * @exception ExtendedIllegalStateException - * If the property cannot be changed due - * to the current state. - * - */ - public void setTimeoutInterval(int seconds) throws PropertyVetoException { - // Validate state - validatePropertyChange("timeoutInterval"); - - // Validate parms - if (seconds < 1 || seconds > 3600) { - Trace.log(Trace.ERROR, "Number of seconds " + seconds + " out of range"); - throw new ExtendedIllegalArgumentException( - "seconds", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - Integer old = new Integer(timeoutInterval_); - Integer sec = new Integer(seconds); - fireVetoableChange("timeoutInterval", old, sec); - timeoutInterval_ = seconds; - firePropertyChange("timeoutInterval", old, sec); - } - - /** - * Sets the actual bytes for the token as it exists - * on the IBM i system. - * - *

    This method allows a credential to be constructed - * based on an existing token (i.e. previously created using the - * QSYGENPT system API). It is the responsibility of the - * application to ensure the tokenType and - * timeoutInterval are consistent with - * the specified token value. - * - *

    This property cannot be changed once a request - * initiates a connection for the object to the - * IBM i system (for example, refresh). - * - * @param bytes - * The token bytes. - * - * @exception PropertyVetoException - * If the change is vetoed. - * - * @exception ExtendedIllegalArgumentException - * If the provided value is not the correct - * length. - * - * @exception ExtendedIllegalStateException - * If the property cannot be changed due - * to the current state. - * - */ - public void setToken(byte[] bytes) throws PropertyVetoException { - // Validate state - validatePropertyChange("token"); - - // Validate parms - if (bytes == null) { - Trace.log(Trace.ERROR, "Token byte array is null"); - throw new ExtendedIllegalArgumentException( - "bytes", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (bytes.length != TOKEN_LENGTH) { - Trace.log(Trace.ERROR, "Token of length " + bytes.length + - " not valid "); - throw new ExtendedIllegalArgumentException( - "bytes", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - byte[] old = getToken(); - fireVetoableChange("token", old, bytes); - primitiveSetToken(bytes); - firePropertyChange("token", old, bytes); - } - - /** - * Sets the token bytes based on the provided principal and password. - * - *

    The system property must be set prior to - * invoking this method. - * - *

    If successful, this method results in a new token being created - * on the IBM i system. The new token is generated using the - * previously established tokenType and timeoutInterval - * settings. - * - *

    This property cannot be changed once a request - * initiates a connection for the object to the - * IBM i system (for example, refresh). - * - * @deprecated As of V5R3, replaced - * by {@link #setTokenExtended(AS400Principal,String)} for password strings - * or {@link #setToken(AS400Principal,int)} for password special values. - * - * @param principal - * The principal identifying the user profile for - * which the token is to be generated. - * - * @param password - * The user profile password. The following special values are allowed: - *

      - *
    • *NOPWD - The password is not verified. This value is not - * allowed if the name of the currently running profile is - * specified for the name parameter. If specified, the user - * requesting the profile token must have *USE authority to - * the user profile.
    • - *
    • *NOPWDCHK - The password is not verified. This value allows - * a profile token to be generated for a profile that is disabled - * or has an expired password. If disabled or expired, the user - * requesting the profile token must have *ALLOBJ and *SECADM - * special authority.
    • - *
    - * - * @exception AS400SecurityException - * If an IBM i system security or authentication error occurs. - * - * @exception PropertyVetoException - * If the change is vetoed. - * - * @exception ExtendedIllegalArgumentException - * If errors occur during parameter validation. - * - * @exception ExtendedIllegalStateException - * If the token cannot be initialized due - * to the current state. - * - */ - public void setToken(AS400Principal principal, String password) - throws PropertyVetoException, AS400SecurityException { - setToken(principal.getUserProfileName(), password); - } - - /** - * Sets the token bytes based on the provided user profile and password. - * - *

    The system property must be set prior to - * invoking this method. - * - *

    If successful, this method results in a new token being created - * on the IBM i system. The new token is generated using the - * previously established tokenType and timeoutInterval - * settings. - * - *

    This property cannot be changed once a request - * initiates a connection for the object to the - * IBM i system (for example, refresh). - * - * @deprecated As of V5R3, replaced - * by {@link #setTokenExtended(String,String)} for password strings - * or {@link #setToken(String,int)} for password special values. - * - * @param name - * The name of the user profile for which the token - * is to be generated. - * - * @param password - * The user profile password. The following special values are allowed: - *

      - *
    • *NOPWD - The password is not verified. This value is not - * allowed if the name of the currently running profile is - * specified for the name parameter. If specified, the user - * requesting the profile token must have *USE authority to - * the user profile.
    • - *
    • *NOPWDCHK - The password is not verified. This value allows - * a profile token to be generated for a profile that is disabled - * or has an expired password. If disabled or expired, the user - * requesting the profile token must have *ALLOBJ and *SECADM - * special authority.
    • - *
    - * - * @exception AS400SecurityException - * If an IBM i system security or authentication error occurs. - * - * @exception PropertyVetoException - * If the change is vetoed. - * - * @exception ExtendedIllegalArgumentException - * If errors occur during parameter validation. - * - * @exception ExtendedIllegalStateException - * If the token cannot be initialized due - * to the current state. - * - */ - public void setToken(String name, String password) - throws PropertyVetoException, AS400SecurityException { - // Validate state - validatePropertySet("system", getSystem()); - - // Validate name and password parameters - if (name == null) { - Trace.log(Trace.ERROR, "User profile name is null"); - throw new ExtendedIllegalArgumentException( - "name", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (name.length() > MAX_USERPROFILE_LENGTH) { - Trace.log(Trace.ERROR, "User profile name exceeds" + - " maximum allowed length"); - throw new ExtendedIllegalArgumentException( - "name", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (password == null) { - Trace.log(Trace.ERROR, "User profile password is null"); - throw new ExtendedIllegalArgumentException( - "password", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Instantiate a new impl but do not yet set as the default impl_ - ProfileTokenImpl impl = (ProfileTokenImpl)getImplPrimitive(); - - // Generate and set the token value - setToken( - impl.generateToken( - name, - password, - getTokenType(), - getTimeoutInterval())); - - // If successful, all defining attributes are now set. - // Set the impl for subsequent references. - setImpl(impl); - - // Indicate that a new token was created. - fireCreated(); - } - - //$A2 - /** - * Sets the token bytes based on the provided principal and - * special value for a password. - * - *

    This method requires a special value to be specified for - * the user password parameter. If you need to validate a user password, - * see the {@link #setTokenExtended(AS400Principal, String)}. - * - *

    The system property must be set prior to invoking this method. - * - *

    If successful, this method results in a new token being created - * on the IBM i system. The new token is generated using the - * previously established tokenType and timeoutInterval - * settings. - * - *

    This property cannot be changed once a request - * initiates a connection for the object to the - * IBM i system (for example, refresh). - * - * @param principal - * The principal identifying the user profile for - * which the token is to be generated. - * - * @param passwordSpecialValue - * The special value for the user profile password. - * The following special values are allowed: - *

      - *
    • PW_NOPWD - The password is not verified. This value is not - * allowed if the name of the currently running profile is - * specified for the name parameter. If specified, the user - * requesting the profile token must have *USE authority to - * the user profile.
    • - *
    • PW_NOPWDCHK - The password is not verified. This value allows - * a profile token to be generated for a profile that is disabled - * or has an expired password. If specified, the user - * requesting the profile token must have *USE authority to - * the user profile. If disabled or expired, the user - * requesting the profile token must have *ALLOBJ and *SECADM - * special authority.
    • - *
    - * - * @exception AS400SecurityException - * If an IBM i system security or authentication error occurs. - * - * @exception PropertyVetoException - * If the change is vetoed. - * - * @exception ExtendedIllegalArgumentException - * If errors occur during parameter validation. - * - * @exception ExtendedIllegalStateException - * If the token cannot be initialized due - * to the current state. - * - */ - public void setToken(AS400Principal principal, int passwordSpecialValue) - throws PropertyVetoException, AS400SecurityException { - setToken(principal.getUserProfileName(), passwordSpecialValue); - } - - //$A2 - /** - * Sets the token bytes based on the provided user profile and - * special value for a password. - * - *

    This method requires a special value to be specified for - * the user password parameter. If you need to validate a user - * password, see the {@link #setTokenExtended(String, String)}. - * - *

    The system property must be set prior to invoking this method. - * - *

    If successful, this method results in a new token being created - * on the IBM i system. The new token is generated using the - * previously established tokenType and timeoutInterval - * settings. - * - *

    This property cannot be changed once a request - * initiates a connection for the object to the - * IBM i system (for example, refresh). - * - * @param name - * The name of the user profile for which the token - * is to be generated. - * - * @param passwordSpecialValue - * The special value for the user profile password. - * The following special values are allowed: - *

      - *
    • PW_NOPWD - The password is not verified. This value is not - * allowed if the name of the currently running profile is - * specified for the name parameter. If specified, the user - * requesting the profile token must have *USE authority to - * the user profile.
    • - *
    • PW_NOPWDCHK - The password is not verified. This value allows - * a profile token to be generated for a profile that is disabled - * or has an expired password. If specified, the user - * requesting the profile token must have *USE authority to - * the user profile. If disabled or expired, the user - * requesting the profile token must have *ALLOBJ and *SECADM - * special authority.
    • - *
    - * - * @exception AS400SecurityException - * If an IBM i system security or authentication error occurs. - * - * @exception PropertyVetoException - * If the change is vetoed. - * - * @exception ExtendedIllegalArgumentException - * If errors occur during parameter validation. - * - * @exception ExtendedIllegalStateException - * If the token cannot be initialized due - * to the current state. - * - */ - public void setToken(String name, int passwordSpecialValue) - throws PropertyVetoException, AS400SecurityException { - // Validate state - validatePropertySet("system", getSystem()); - - // Validate name - if (name == null) { - Trace.log(Trace.ERROR, "User profile name is null"); - throw new ExtendedIllegalArgumentException( - "name", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (name.length() > MAX_USERPROFILE_LENGTH) { - Trace.log(Trace.ERROR, "User profile name exceeds " + - "maximum allowed length"); - throw new ExtendedIllegalArgumentException( - "name", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - // Validate special value for password - switch (passwordSpecialValue) { - case PW_NOPWD: - case PW_NOPWDCHK: - break; - default: - Trace.log(Trace.ERROR, "Special value for password is not valid"); - throw new ExtendedIllegalArgumentException( - "password", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Instantiate a new impl but do not yet set as the default impl_ - ProfileTokenImpl impl = (ProfileTokenImpl)getImplPrimitive(); - - // Generate and set the token value - setToken( - impl.generateToken( - name, - passwordSpecialValue, - getTokenType(), - getTimeoutInterval())); - - // If successful, all defining attributes are now set. - // Set the impl for subsequent references. - setImpl(impl); - - // Indicate that a new token was created. - fireCreated(); - } - - //$A2 - /** - * Sets the token bytes based on the provided principal and password. - * - *

    The system property must be set prior to - * invoking this method. - * - *

    If successful, this method results in a new token being created - * on the IBM i system. The new token is generated using the - * previously established tokenType and timeoutInterval - * settings. - * - *

    This property cannot be changed once a request - * initiates a connection for the object to the - * IBM i system (for example, refresh). - * - * @param principal - * The principal identifying the user profile for - * which the token is to be generated. - * - * @param password - * The user profile password. - * - * @exception AS400SecurityException - * If an IBM i system security or authentication error occurs. - * - * @exception PropertyVetoException - * If the change is vetoed. - * - * @exception ExtendedIllegalArgumentException - * If errors occur during parameter validation. - * - * @exception ExtendedIllegalStateException - * If the token cannot be initialized due - * to the current state. - * - */ - public void setTokenExtended(AS400Principal principal, String password) - throws PropertyVetoException, AS400SecurityException { - setTokenExtended(principal.getUserProfileName(), password); - } - - //$A2 - /** - * Sets the token bytes based on the provided user profile and password. - * - *

    The system property must be set prior to - * invoking this method. - * - *

    If successful, this method results in a new token being created - * on the IBM i system. The new token is generated using the - * previously established tokenType and timeoutInterval - * settings. - * - *

    This property cannot be changed once a request - * initiates a connection for the object to the - * IBM i system (for example, refresh). - * - * @param name - * The name of the user profile for which the token - * is to be generated. - * - * @param password - * The user profile password. - * - * @exception AS400SecurityException - * If an IBM i system security or authentication error occurs. - * - * @exception PropertyVetoException - * If the change is vetoed. - * - * @exception ExtendedIllegalArgumentException - * If errors occur during parameter validation. - * - * @exception ExtendedIllegalStateException - * If the token cannot be initialized due - * to the current state. - * - */ - public void setTokenExtended(String name, String password) - throws PropertyVetoException, AS400SecurityException { - // Validate state - validatePropertySet("system", getSystem()); - - // Validate name and password parameters - if (name == null) { - Trace.log(Trace.ERROR, "User profile name is null"); - throw new ExtendedIllegalArgumentException("name", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - if (name.length() > MAX_USERPROFILE_LENGTH) { - Trace.log(Trace.ERROR, "User profile name exceeds " + - "maximum allowed length"); - throw new ExtendedIllegalArgumentException("name", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - if (password == null) { - Trace.log(Trace.ERROR, "User profile password is null"); - throw new ExtendedIllegalArgumentException("password", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Instantiate a new impl but do not yet set as the default impl_ - ProfileTokenImpl impl = (ProfileTokenImpl)getImplPrimitive(); - - // Generate and set the token value - setToken( - impl.generateTokenExtended( - name, - password, - getTokenType(), - getTimeoutInterval())); - - // If successful, all defining attributes are now set. - // Set the impl for subsequent references. - setImpl(impl); - - // Indicate that a new token was created. - fireCreated(); - } - - /** - * Sets the type of token. - * - *

    It is the application's responsibility to maintain - * consistency between explicitly set token values (those - * not generated from a user and password) and the - * tokenType and timeoutInterval. - * - *

    This property cannot be changed once a request - * initiates a connection for the object to the - * IBM i system (for example, refresh). - * - * @param type - * The type of token. - * Possible types are defined as fields on this class: - *

      - *
    • TYPE_SINGLE_USE - *
    • TYPE_MULTIPLE_USE_NON_RENEWABLE - *
    • TYPE_MULTIPLE_USE_RENEWABLE - *
    - * - * @exception PropertyVetoException - * If the change is vetoed. - * - * @exception ExtendedIllegalArgumentException - * If the provided value is out of range. - * - * @exception ExtendedIllegalStateException - * If the property cannot be changed due - * to the current state. - * - */ - public void setTokenType(int type) throws PropertyVetoException { - // Validate state - validatePropertyChange("tokenType"); - - // Validate parms - if (type < 1 || type > 3) { - Trace.log(Trace.ERROR, "Token type " + type + " out of range"); - throw new ExtendedIllegalArgumentException( - "type", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - Integer old = new Integer(type_); - Integer typ = new Integer(type); - fireVetoableChange("tokenType", old, typ); - type_ = type; - firePropertyChange("tokenType", old, typ); - } - - /** - * Returns a string representation of the object - * - * @return a string representation of the object. - */ - public String toString() { - return new StringBuffer(256 - ).append(super.toString() - ).append('[' - ).append(getTokenType() - ).append(',' - ).append(getTimeoutInterval() - ).append(']' - ).toString(); - } - - /** - * Indicates if instances of the class are sufficient - * by themselves to change the OS thread identity. - * - *

    Typically this behavior is dictated by the type - * of credential and need not be changed for - * individual instances. - * - * @return - * true - * - */ - boolean typeIsStandalone() { - return true; - } - - /** - * Indicates if instances of the class will expire based on time. - * - *

    Typically this behavior is dictated by the type - * of credential and need not be changed for - * individual instances. - * - * @return - * true - */ - boolean typeIsTimed() { - return true; - } - - /** - * Validates that all properties required to define the - * credential have been set. - * - *

    These are the values initialized prior to - * accessing host information for or taking action against - * the credential and not modified thereafter until - * the credential is destroyed. - * - * @exception ExtendedIllegalStateException - * If a required property is not set. - * - */ - void validateProperties() { - super.validateProperties(); - validatePropertySet("token", getToken()); - } -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenCredential16.gif b/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenCredential16.gif deleted file mode 100644 index f6f407e5c..000000000 Binary files a/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenCredential16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenCredential32.gif b/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenCredential32.gif deleted file mode 100644 index d57b6a8e4..000000000 Binary files a/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenCredential32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenCredentialBeanInfo.java b/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenCredentialBeanInfo.java deleted file mode 100644 index d7d7abfdd..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenCredentialBeanInfo.java +++ /dev/null @@ -1,166 +0,0 @@ - -//////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProfileTokenCredentialBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.security.auth; - -import java.awt.Image; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.IntrospectionException; -import java.beans.BeanDescriptor; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -/** - * Bean information for the ProfileTokenCredential class. - * - */ -public class ProfileTokenCredentialBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private final static Class beanClass = ProfileTokenCredential.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_a loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getAccessText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getAccessText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getAccessText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getAccessText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor token = new PropertyDescriptor("token", beanClass, - "getToken", "setToken"); - token.setBound(true); - token.setConstrained(true); - token.setDisplayName(loader_.getText("PROP_NAME_CR_PT_TOKEN")); - token.setShortDescription(loader_.getText("PROP_DESC_CR_PT_TOKEN")); - - PropertyDescriptor type = new PropertyDescriptor("tokenType", beanClass, - "getTokenType", "setTokenType"); - type.setBound(true); - type.setConstrained(true); - type.setDisplayName(loader_.getText("PROP_NAME_CR_PT_TYPE")); - type.setShortDescription(loader_.getText("PROP_DESC_CR_PT_TYPE")); - - PropertyDescriptor timeoutInterval = new PropertyDescriptor("timeoutInterval", beanClass, - "getTimeoutInterval", "setTimeoutInterval"); - timeoutInterval.setBound(true); - timeoutInterval.setConstrained(true); - timeoutInterval.setDisplayName(loader_.getText("PROP_NAME_CR_PT_TIMEOUTINTERVAL")); - timeoutInterval.setShortDescription(loader_.getText("PROP_DESC_CR_PT_TIMEOUTINTERVAL")); - - properties_ = new PropertyDescriptor[] { token, type, timeoutInterval}; - } - catch ( Exception e ) - { - AuthenticationSystem.handleUnexpectedException(e); - } - - } - - - /** - * Returns additional bean information. - * - * @return - * The bean information. - * - */ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new AS400CredentialBeanInfo()}; - } - - - /** - * Returns the bean descriptor. - * - * @return The bean descriptor. - * - */ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - * Returns the descriptors for all events. - * - * @return The descriptors for all events. - * - */ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - - /** - * Returns an Image for this bean's icon. - * - * @param icon The desired icon size and color. - * - * @return The Image for the icon. - * - */ - public Image getIcon(int icon) - { - Image image = null; - switch ( icon ) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("ProfileTokenCredential16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("ProfileTokenCredential32.gif"); - break; - } - return image; - } - - - /** - * Returns the descriptors for all properties. - * - * @return The descriptors for all properties. - * - */ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenImpl.java b/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenImpl.java deleted file mode 100644 index 563320292..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.ibm.as400.security.auth; - -//////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProfileTokenImpl.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -/** - * The ProfileTokenImpl interface provides the template for - * classes implementing behavior delegated by a - * ProfileTokenCredential. - * - */ -public interface ProfileTokenImpl extends AS400CredentialImpl { - - /** - * String constant for *NOPWD special value. 10 character blank - * padded - */ - public final static String PW_STR_NOPWD = "*NOPWD "; - - /** - * String constant for *NOPWDCHK special value. 10 character blank - * padded - */ - public final static String PW_STR_NOPWDCHK = "*NOPWDCHK "; - - /** - * Generates and returns a new profile token based on - * the provided information. - * - * @deprecated As of V5R3, replaced - * by {@link #generateTokenExtended(String,String,int,int)} - * for password strings - * and {@link #generateToken(String,int,int,int)} for password - * special values - * - * @param uid - * The name of the user profile for which the token - * is to be generated. - * - * @param pwd - * The user profile password (encoded). - * - * @param type - * The type of token. - * Possible types are defined as fields on the - * ProfileTokenCredential class: - *

      - *
    • TYPE_SINGLE_USE - *
    • TYPE_MULTIPLE_USE_NON_RENEWABLE - *
    • TYPE_MULTIPLE_USE_RENEWABLE - *
    - *

    - * - * @param timeoutInterval - * The number of seconds to expiration. - * - * @return - * The token bytes. - * - * @exception RetrieveFailedException - * If errors occur while generating the token. - * - */ - byte[] generateToken(String uid, String pwd, int type, - int timeoutInterval) throws RetrieveFailedException; - - /** - * Generates and returns a new profile token based on - * the provided information using a password special value. - * - * @param uid - * The name of the user profile for which the token - * is to be generated. - * - * @param pwdSpecialValue - * A password special value. - * Possible types are defined as fields on the - * ProfileTokenCredential class: - *

      - *
    • PW_NOPWD - *
    • PW_NOPWDCHK - *
    - *

    - * - * @param type - * The type of token. - * Possible types are defined as fields on the - * ProfileTokenCredential class: - *

      - *
    • TYPE_SINGLE_USE - *
    • TYPE_MULTIPLE_USE_NON_RENEWABLE - *
    • TYPE_MULTIPLE_USE_RENEWABLE - *
    - *

    - * - * @param timeoutInterval - * The number of seconds to expiration. - * - * @return - * The token bytes. - * - * @exception RetrieveFailedException - * If errors occur while generating the token. - * - */ - byte[] generateToken(String uid, int pwdSpecialValue, int type, - int timeoutInterval) throws RetrieveFailedException; - - /** - * Generates and returns a new profile token based on - * the provided information using a password string. - * - * @param uid - * The name of the user profile for which the token - * is to be generated. - * - * @param pwd - * The user profile password (encoded). - * Special values are not supported by this method. - * - * @param type - * The type of token. - * Possible types are defined as fields on the - * ProfileTokenCredential class: - *

      - *
    • TYPE_SINGLE_USE - *
    • TYPE_MULTIPLE_USE_NON_RENEWABLE - *
    • TYPE_MULTIPLE_USE_RENEWABLE - *
    - *

    - * - * @param timeoutInterval - * The number of seconds to expiration. - * - * @return - * The token bytes. - * - * @exception RetrieveFailedException - * If errors occur while generating the token. - * - */ - byte[] generateTokenExtended(String uid, String pwd, int type, - int timeoutInterval) throws RetrieveFailedException; - - /** - * Updates or extends the validity period for the credential. - * - *

    Generates a new profile token based on the previously - * established token with the given type - * and timeoutInterval. - * - *

    This method is provided to handle cases where it is - * desirable to allow for a more restrictive type of token - * or a different timeout interval when a new token is - * generated during the refresh. - * - * @param type - * The type of token. - * Possible types are defined as fields on this class: - *

      - *
    • TYPE_SINGLE_USE - *
    • TYPE_MULTIPLE_USE_NON_RENEWABLE - *
    • TYPE_MULTIPLE_USE_RENEWABLE - *
    - *

    - * - * @param timeoutInterval - * The number of seconds before expiration. - * - * @return - * The new token. - * - * @exception RefreshFailedException - * If errors occur during refresh. - * - */ - byte[] refresh(int type, int timeoutInterval) - throws RefreshFailedException; -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenImplRemote.java b/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenImplRemote.java deleted file mode 100644 index 6de0dc9e4..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenImplRemote.java +++ /dev/null @@ -1,551 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProfileTokenImplRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.security.auth; - -import com.ibm.as400.access.*; -import java.util.Random; - -/** - * The ProfileTokenImplRemote class provides an implementation for - * behavior delegated by a ProfileTokenCredential object. - * - */ -class ProfileTokenImplRemote extends AS400CredentialImplRemote - implements ProfileTokenImpl { - - /** - * Destroy or clear sensitive information maintained - * by the credential implementation. - * - *

    Subsequent requests may result in a NullPointerException. - * - *

    This class will also attempt to remove the associated - * profile token from the IBM i system. - * - * @exception DestroyFailedException - * If errors occur while destroying or clearing - * credential implementation data. - * - */ - public void destroy() throws DestroyFailedException { - removeFromSystem(); - super.destroy(); - } - - /** - * Generates and returns a new profile token based on - * the provided information. - * - * @deprecated As of V5R3, replaced - * by {@link #generateTokenExtended(String,byte[],int,int)}. - * - * @param uid - * The name of the user profile for which the token - * is to be generated. - * - * @param pwd - * The user profile password. Special values are not supported. - * - * @param type - * The type of token. - * Possible types are defined as fields on the - * ProfileTokenCredential class: - *

      - *
    • TYPE_SINGLE_USE - *
    • TYPE_MULTIPLE_USE_NON_RENEWABLE - *
    • TYPE_MULTIPLE_USE_RENEWABLE - *
    - *

    - * - * @param timeoutInterval - * The number of seconds to expiration. - * - * @return - * The token bytes. - * - * @exception RetrieveFailedException - * If errors occur while generating the token. - * - */ - public byte[] generateToken(String uid, String pwd, int type, - int timeoutInterval) throws RetrieveFailedException { - - AS400 sys = getCredential().getSystem(); - - // Deprecated as of V5R3 - try { - if ( sys.getVRM() >= 0x00050300 ) { - Trace.log(Trace.ERROR, - "setToken(String,String,in,int) deprecated." + - "Use setTokenExtended(String,String,int,int)."); - throw new ExtendedIllegalArgumentException("Method deprecated", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - catch (AS400SecurityException se) { - throw new RetrieveFailedException(se.getReturnCode()); - } - catch (java.io.IOException ioe) { - AuthenticationSystem.handleUnexpectedException(ioe); } - - // Use the AS400 object to obtain the token. - // This will obtain the token by interacting with the IBM i - // system signon server and avoid transmitting a cleartext password. - byte[] tkn = null; - try { - tkn = sys.getProfileToken(uid, pwd, type, timeoutInterval).getToken(); - } - catch (AS400SecurityException se) { - throw new RetrieveFailedException(se.getReturnCode()); - } - catch (Exception e) { - AuthenticationSystem.handleUnexpectedException(e); - } - return tkn; - } - - //$A2 - /** - * Generates and returns a new profile token based on - * the provided information using a password special value. - *

    - * This method should be used for generating a token using a - * password special value. - * - * @param uid - * The name of the user profile for which the token - * is to be generated. - *

    - * - * @param pwdSpecialValue - * A password special value. - * Possible types are defined as fields on the - * ProfileTokenCredential class: - *

      - *
    • PW_NOPWD - *
    • PW_NOPWDCHK - *
    - *

    - * - * @param type - * The type of token. - * Possible types are defined as fields on the ProfileTokenCredential class: - *

      - *
    • TYPE_SINGLE_USE - *
    • TYPE_MULTIPLE_USE_NON_RENEWABLE - *
    • TYPE_MULTIPLE_USE_RENEWABLE - *
    - *

    - * - * @param timeoutInterval - * The number of seconds to expiration. - * - * @return - * The token bytes. - * - * @exception RetrieveFailedException - * If errors occur while generating the token. - * - */ - public byte[] generateToken(String uid, int pwdSpecialValue, int type, - int timeoutInterval) throws RetrieveFailedException { - - // Convert password special value from enumerated int to String - String pwd; - switch(pwdSpecialValue) { - case ProfileTokenCredential.PW_NOPWD: - pwd = ProfileTokenImpl.PW_STR_NOPWD; - break; - case ProfileTokenCredential.PW_NOPWDCHK: - pwd = ProfileTokenImpl.PW_STR_NOPWDCHK; - break; - default: - Trace.log(Trace.ERROR, "Password special value = " + - pwdSpecialValue + " is not valid."); - throw new ExtendedIllegalArgumentException( - "Password special value", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Only use SystemProgramCall code with password special values - // such as *NOPWD or *NOPWD. Transmission is in the clear, so - // do not use with real passwords - - AS400 sys = getCredential().getSystem(); - - ProgramParameter[] parmlist = new ProgramParameter[6]; - - // Output: Profile token - parmlist[0] = new ProgramParameter(ProfileTokenCredential.TOKEN_LENGTH); - - // Input: User profile name - parmlist[1] = new ProgramParameter(stringToByteArray(uid.toUpperCase())); - - // Input: User password - try { - parmlist[2] = new ProgramParameter( - CharConverter.stringToByteArray(37, sys, pwd)); - } - catch (java.io.UnsupportedEncodingException uee) { - Trace.log(Trace.ERROR, "Unexpected UnsupportedEncodingException: ", - uee); - throw new RetrieveFailedException(); - } - - // Input: Timeout Interval - parmlist[3] = new ProgramParameter( - BinaryConverter.intToByteArray(timeoutInterval)); - - // Input: Profile token type - parmlist[4] = new ProgramParameter( - CharConverter.stringToByteArray(sys, - new Integer(type).toString())); - - // Input/output: Error code. NULL. - parmlist[5] = new ProgramParameter(BinaryConverter.intToByteArray(0)); - - ProgramCall programCall = new ProgramCall(sys); - - try { - programCall.setProgram( - QSYSObjectPathName.toPath("QSYS", "QSYGENPT", "PGM"), - parmlist); - programCall.suggestThreadsafe(); // Run on-thread if possible; allows app to use disabled profile. - if (!programCall.run()) { - Trace.log(Trace.ERROR, "Call to QSYGENPT failed."); - throw new RetrieveFailedException( - programCall.getMessageList()); - } - } - catch (java.io.IOException ioe) { - AuthenticationSystem.handleUnexpectedException(ioe); } - catch (java.beans.PropertyVetoException pve) { - AuthenticationSystem.handleUnexpectedException(pve); } - catch (InterruptedException ine) { - AuthenticationSystem.handleUnexpectedException(ine); } - catch (Exception e) { - throw new RetrieveFailedException(); } - - return parmlist[0].getOutputData(); - } - - //$A2 - /** - * Generates and returns a new profile token based on - * the provided information using a password string - *

    - * This method is used for generating a token using - * a password string (vs a special value). - * - * @param uid - * The name of the user profile for which the token - * is to be generated. - * - * @param pwd - * The user profile password. - * Special values are not supported by this method. - * - * @param type - * The type of token. - * Possible types are defined as fields on the - * ProfileTokenCredential class: - *

      - *
    • TYPE_SINGLE_USE - *
    • TYPE_MULTIPLE_USE_NON_RENEWABLE - *
    • TYPE_MULTIPLE_USE_RENEWABLE - *
    - *

    - * - * @param timeoutInterval - * The number of seconds to expiration. - * - * @return - * The token bytes. - * - * @exception RetrieveFailedException - * If errors occur while generating the token. - * - */ - public byte[] generateTokenExtended(String uid, String pwd, int type, - int timeoutInterval) throws RetrieveFailedException { - - // Use the AS400 object to obtain the token. - // This will obtain the token by interacting with the IBM i - // system signon server and avoid transmitting a cleartext password. - byte[] tkn = null; - try { - tkn = getCredential().getSystem().getProfileToken(uid, pwd, - type, timeoutInterval).getToken(); - } - catch (AS400SecurityException se) { - throw new RetrieveFailedException(se.getReturnCode()); - } - catch (Exception e) { - AuthenticationSystem.handleUnexpectedException(e); - } - return tkn; - } - - /** - * Returns the number of seconds before the - * credential is due to expire. - * - * @return - * The number of seconds before expiration; - * zero (0) if already expired. - * - * @exception RetrieveFailedException - * If errors occur while retrieving - * timeout information. - * - */ - public int getTimeToExpiration() throws RetrieveFailedException { - ProgramCall programCall = new ProgramCall(getCredential().getSystem()); - - ProgramParameter[] parmlist = new ProgramParameter[3]; - parmlist[0] = new ProgramParameter(4); - parmlist[1] = new ProgramParameter(new AS400ByteArray( - ProfileTokenCredential.TOKEN_LENGTH).toBytes( - ((ProfileTokenCredential)getCredential()).getToken())); - parmlist[2] = new ProgramParameter(new AS400Bin4().toBytes(0)); - - try { - programCall.setProgram(QSYSObjectPathName.toPath("QSYS", - "QSYGETPT", "PGM"), parmlist); - programCall.suggestThreadsafe(); // Run on-thread if possible. - if (!programCall.run()) { - Trace.log(Trace.ERROR, "Call to QSYGETPT failed."); - throw new RetrieveFailedException(); - } - } - catch (java.io.IOException ioe) { - AuthenticationSystem.handleUnexpectedException(ioe); - } - catch (java.beans.PropertyVetoException pve) { - AuthenticationSystem.handleUnexpectedException(pve); - } - catch (InterruptedException ine) { - AuthenticationSystem.handleUnexpectedException(ine); - } - catch (Exception e) { - throw new RetrieveFailedException(programCall.getMessageList()); - } - - return (new AS400Bin4()).toInt(parmlist[0].getOutputData()); - } - - /** - * Updates or extends the validity period for the credential. - * - *

    Generates a new profile token based on the previously - * established token with the given type - * and timeoutInterval. - * - *

    This method is provided to handle cases where it is - * desirable to allow for a more restrictive type of token - * or a different timeout interval when a new token is - * generated during the refresh. - * - * @param type - * The type of token. - * Possible types are defined as fields on the - * ProfileTokenCredential class: - *

      - *
    • TYPE_SINGLE_USE - *
    • TYPE_MULTIPLE_USE_NON_RENEWABLE - *
    • TYPE_MULTIPLE_USE_RENEWABLE - *
    - *

    - * - * @param timeoutInterval - * The number of seconds before expiration. - * - * @return - * The new token. - * - * @exception RefreshFailedException - * If errors occur during refresh. - * - */ - public byte[] refresh(int type, int timeoutInterval) - throws RefreshFailedException { - - ProfileTokenCredential tgt = (ProfileTokenCredential)getCredential(); - AS400 sys = tgt.getSystem(); - ProgramCall programCall = new ProgramCall(tgt.getSystem()); - - ProgramParameter[] parmlist = new ProgramParameter[5]; - parmlist[0] = new ProgramParameter( - ProfileTokenCredential.TOKEN_LENGTH); - parmlist[1] = new ProgramParameter(new AS400ByteArray( - ProfileTokenCredential.TOKEN_LENGTH).toBytes( - tgt.getToken())); - parmlist[2] = new ProgramParameter( - new AS400Bin4().toBytes(timeoutInterval)); - parmlist[3] = new ProgramParameter(new AS400Text( - 1, sys.getCcsid(), sys).toBytes( - new Integer(type).toString())); - parmlist[4] = new ProgramParameter(new AS400Bin4().toBytes(0)); - - try { - programCall.setProgram(QSYSObjectPathName.toPath("QSYS", - "QSYGENFT", "PGM"), parmlist); - programCall.suggestThreadsafe(); // Run on-thread if possible. - if (!programCall.run()) { - Trace.log(Trace.ERROR, "Call to QSYGENFT failed."); - throw new RefreshFailedException(); - } - } - catch (java.io.IOException ioe) { - AuthenticationSystem.handleUnexpectedException(ioe); - } - catch (java.beans.PropertyVetoException pve) { - AuthenticationSystem.handleUnexpectedException(pve); - } - catch (InterruptedException ine) { - AuthenticationSystem.handleUnexpectedException(ine); - } - catch (Exception e) { - throw new RefreshFailedException(programCall.getMessageList()); - } - - return (byte[])new AS400ByteArray( - ProfileTokenCredential.TOKEN_LENGTH).toObject( - parmlist[0].getOutputData()); - } - - /** - * Removes the token from the IBM i system. - * - * @exception DestroyFailedException - * If errors occur while removing the credential. - * - */ - void removeFromSystem() throws DestroyFailedException { - ProfileTokenCredential tgt = (ProfileTokenCredential)getCredential(); - AS400 sys = tgt.getSystem(); - ProgramCall programCall = new ProgramCall(sys); - - ProgramParameter[] parmlist = new ProgramParameter[3]; - parmlist[0] = new ProgramParameter( - new AS400Text(10, sys.getCcsid(), sys).toBytes("*PRFTKN")); - parmlist[1] = new ProgramParameter(new AS400Bin4().toBytes(0)); - parmlist[2] = new ProgramParameter( - new AS400ByteArray( - ProfileTokenCredential.TOKEN_LENGTH).toBytes(tgt.getToken())); - - try { - programCall.setProgram(QSYSObjectPathName.toPath("QSYS", - "QSYRMVPT", "PGM"), parmlist); - programCall.suggestThreadsafe(); // Run on-thread if possible. - if (!programCall.run()) { - Trace.log(Trace.ERROR, "Call to QSYRMVPT failed."); - throw new DestroyFailedException(); - } - } - catch (java.io.IOException ioe) { - AuthenticationSystem.handleUnexpectedException(ioe); - } - catch (java.beans.PropertyVetoException pve) { - AuthenticationSystem.handleUnexpectedException(pve); - } - catch (InterruptedException ine) { - AuthenticationSystem.handleUnexpectedException(ine); - } - catch (Exception e) { - throw new DestroyFailedException(programCall.getMessageList()); - } - } - - //$A2 - /** - * Convert Unicode string to EBCID CCSID 37 byte array. - * Copied from com.ibm.as400.access.SignonConverter - */ - private static byte[] stringToByteArray(String source) - throws RetrieveFailedException - { - char[] sourceChars = source.toCharArray(); - byte[] returnBytes = { - (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, - (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40, (byte)0x40 - }; - for (int i = 0; i < sourceChars.length; ++i) { - switch (sourceChars[i]) - { - case 0x0023: returnBytes[i] = (byte)0x7B; break; // # - case 0x0024: returnBytes[i] = (byte)0x5B; break; // $ - - case 0x0030: returnBytes[i] = (byte)0xF0; break; // 0 - case 0x0031: returnBytes[i] = (byte)0xF1; break; // 1 - case 0x0032: returnBytes[i] = (byte)0xF2; break; // 2 - case 0x0033: returnBytes[i] = (byte)0xF3; break; // 3 - case 0x0034: returnBytes[i] = (byte)0xF4; break; // 4 - case 0x0035: returnBytes[i] = (byte)0xF5; break; // 5 - case 0x0036: returnBytes[i] = (byte)0xF6; break; // 6 - case 0x0037: returnBytes[i] = (byte)0xF7; break; // 7 - case 0x0038: returnBytes[i] = (byte)0xF8; break; // 8 - case 0x0039: returnBytes[i] = (byte)0xF9; break; // 9 - - case 0x0040: returnBytes[i] = (byte)0x7C; break; // @ - - case 0x0041: returnBytes[i] = (byte)0xC1; break; // A - case 0x0042: returnBytes[i] = (byte)0xC2; break; // B - case 0x0043: returnBytes[i] = (byte)0xC3; break; // C - case 0x0044: returnBytes[i] = (byte)0xC4; break; // D - case 0x0045: returnBytes[i] = (byte)0xC5; break; // E - case 0x0046: returnBytes[i] = (byte)0xC6; break; // F - case 0x0047: returnBytes[i] = (byte)0xC7; break; // G - case 0x0048: returnBytes[i] = (byte)0xC8; break; // H - case 0x0049: returnBytes[i] = (byte)0xC9; break; // I - case 0x004A: returnBytes[i] = (byte)0xD1; break; // J - case 0x004B: returnBytes[i] = (byte)0xD2; break; // K - case 0x004C: returnBytes[i] = (byte)0xD3; break; // L - case 0x004D: returnBytes[i] = (byte)0xD4; break; // M - case 0x004E: returnBytes[i] = (byte)0xD5; break; // N - case 0x004F: returnBytes[i] = (byte)0xD6; break; // O - case 0x0050: returnBytes[i] = (byte)0xD7; break; // P - case 0x0051: returnBytes[i] = (byte)0xD8; break; // Q - case 0x0052: returnBytes[i] = (byte)0xD9; break; // R - case 0x0053: returnBytes[i] = (byte)0xE2; break; // S - case 0x0054: returnBytes[i] = (byte)0xE3; break; // T - case 0x0055: returnBytes[i] = (byte)0xE4; break; // U - case 0x0056: returnBytes[i] = (byte)0xE5; break; // V - case 0x0057: returnBytes[i] = (byte)0xE6; break; // W - case 0x0058: returnBytes[i] = (byte)0xE7; break; // X - case 0x0059: returnBytes[i] = (byte)0xE8; break; // Y - case 0x005A: returnBytes[i] = (byte)0xE9; break; // Z - - case 0x005F: returnBytes[i] = (byte)0x6D; break; // _ - - case 0x00A3: returnBytes[i] = (byte)0x7B; break; // Cp423, pound sterling. - case 0x00A5: returnBytes[i] = (byte)0x5B; break; // Cp281, yen sign. - case 0x00A7: returnBytes[i] = (byte)0x7C; break; // Cp273, section sign. - case 0x00C4: returnBytes[i] = (byte)0x7B; break; // Cp278, A with dieresis. - case 0x00C5: returnBytes[i] = (byte)0x5B; break; // Cp277, A with ring. - case 0x00C6: returnBytes[i] = (byte)0x7B; break; // Cp277, ligature AE. - case 0x00D0: returnBytes[i] = (byte)0x7C; break; // Cp871, D with stroke. - case 0x00D1: returnBytes[i] = (byte)0x7B; break; // Cp284, N with tilde. - case 0x00D6: returnBytes[i] = (byte)0x7C; break; // Cp278, O with dieresis. - case 0x00D8: returnBytes[i] = (byte)0x7C; break; // Cp277, O with stroke. - case 0x00E0: returnBytes[i] = (byte)0x7C; break; // Cp297, a with grave. - case 0x0130: returnBytes[i] = (byte)0x5B; break; // Cp905, I with over dot. - case 0x015E: returnBytes[i] = (byte)0x7C; break; // Cp905, S with cedilla. - default: throw new RetrieveFailedException( - AS400SecurityException.SIGNON_CHAR_NOT_VALID); - } - } - return returnBytes; - } -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenProvider.java b/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenProvider.java deleted file mode 100644 index c8b244cad..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/ProfileTokenProvider.java +++ /dev/null @@ -1,38 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProfileTokenProvider.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2009-2009 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.security.auth; - -import com.ibm.as400.access.AS400SecurityException; - -/** - * Defines an interface for providing a {@link ProfileTokenCredential ProfileTokenCredential} to an {@link com.ibm.as400.access.AS400 AS400} object. - * This interface is used when an AS400 object is given the responsibility of managing the life cycle of - * a user's profile token credential. Management of this credential by the AS400 object may require a new - * profile token to be created; this is accomplished via a class that implements this interface. - * - * @see com.ibm.as400.access.AS400#AS400(String, ProfileTokenProvider) - * @see com.ibm.as400.access.AS400#AS400(String, ProfileTokenProvider, int) - */ -public interface ProfileTokenProvider -{ - /** - * Creates and returns a new profile token credential. The attributes - * of the profile token, such as timeout interval, user, etc are - * determined by the class that implements this interface. - * - * @return A newly created profile token credential. - * @throws AS400SecurityException If an IBM i system security or authentication error occurs - */ - public ProfileTokenCredential create() throws AS400SecurityException; -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/RefreshAgent.java b/cvsroot/src/com/ibm/as400/security/auth/RefreshAgent.java deleted file mode 100644 index c20906da3..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/RefreshAgent.java +++ /dev/null @@ -1,299 +0,0 @@ -package com.ibm.as400.security.auth; - -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RefreshAgent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.ConnectionEvent; -import com.ibm.as400.access.ConnectionListener; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -/** - * The RefreshAgent class implements the automatic refresh - * mechanism for credentials. - * - *

    Note: The implementation is potentially generic enough - * to work with any object implementing a refreshable - * interface, but is currently limited to credentials. - * - */ -class RefreshAgent extends Thread implements ConnectionListener { - - private int refreshInterval_, maxRefreshes_ = 0; - private AS400Credential target_ = null; - private Exception failure_ = null; - private boolean stop_ = false; -/** - * Constructs a RefreshAgent object. - * - *

    Agent thread will be identified as a daemon as - * to not prevent the JVM from exiting once user - * threads are complete. - * - *

    Thread will be assigned the maximum permitted - * priority within its thread group. - * - */ -RefreshAgent() { - super(); - setDaemon(true); - setPriority(Thread.MAX_PRIORITY); -} -/** - * Constructs a RefreshAgent object. - * - * @param target - * The object to refresh automatically. - * - * @param refreshInterval - * The number of seconds between refresh attempts. - * The first refresh will occur immediately; - * the second will occur this many seconds after - * the first, and so on. - * - * @param maxRefreshes - * The maximum number of times to refresh the - * credential. A value of negative one (-1) - * indicates no maximum. - * - */ -RefreshAgent(AS400Credential target, int refreshInterval, int maxRefreshes) { - this(); - setTarget(target); - setRefreshInterval(refreshInterval); - setMaxRefreshes(maxRefreshes); -} -/** - * Invoked when a service has been connected - * on an AS400 object. - * - * @param event The connection event. - * - */ -public void connected(ConnectionEvent event) { - // Do nothing; not interested in this event. -} -/** - * Invoked when a service has been disconnected - * on an AS400 object. - * - *

    If all services are disconnected, the thread - * is stopped. - * - * @param event The connection event. - * - */ -public void disconnected(ConnectionEvent event) { - try { - AS400 sys = (AS400)event.getSource(); - if (isAlive() && !sys.isConnected()) { - stopRefresh(); - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, - new StringBuffer("RefreshAgent stopped after system disconnect >> " - ).append(target_.toString()).toString()); - } - } - catch (Exception e) { - Trace.log(Trace.ERROR, - "RefreshAgent not stopped after system disconnect >> " - + target_.toString(), e); - } -} -/** - * Called when garbage collection determines that there are - * no more references to the object. - * - */ -protected void finalize() throws Throwable { - try { - if (isAlive()) { - stopRefresh(); - } - } - catch (Exception e) { - Trace.log(Trace.ERROR, - "RefreshAgent not stopped on finalize >> " + target_.toString(), e); - } - super.finalize(); -} -/** - * Returns the exception resulting from failure of - * the most recent refresh attempt. - * - * @return - * The exception; null if not available. - * - */ -public Throwable getFailure() { - return failure_; -} -/** - * Runs the agent. - * - *

    Starts automatic refresh. The first refresh - * attempt is performed immediately, followed by - * periodic refresh as appropriate. - * - *

    Automatic attempts are discontinued on the - * first failed refresh attempt. - * - */ -public void run() { - stop_ = false; - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, - new StringBuffer("RefreshAgent starting with maximum attempts " - ).append(maxRefreshes_ - ).append(" and refresh interval " - ).append(refreshInterval_ - ).append(" >> " - ).append(target_.toString() - ).toString()); - - validatePropertySet("target", target_); - AS400 sys = target_.getSystem(); - sys.addConnectionListener(this); - failure_ = null; - int i = 0; - while (!stop_ && failure_ == null && (maxRefreshes_ < 0 || i++ < maxRefreshes_)) { - try { - target_.refresh(); - if (maxRefreshes_ < 0 || i < maxRefreshes_) - sleep(refreshInterval_ * 1000); - } - catch(InterruptedException ie) { - if (stop_) - Trace.log(Trace.DIAGNOSTIC, "RefreshAgent stopped on interrupt >> " + target_.toString()); - else { - Trace.log(Trace.ERROR, "RefreshAgent interrupted >> " + target_.toString(), ie); - failure_ = ie; - } - } - catch(Exception e) { - Trace.log(Trace.ERROR, "RefreshAgent failed >> " + target_.toString(), e); - failure_ = e; - } - } - sys.removeConnectionListener(this); -} -/** - * Sets the number of times to perform refresh. - * - *

    This property cannot be changed when active. - * - * @param max - * The maximum number of times to refresh the - * credential. A value of negative one (-1) - * indicates no maximum. - * - * @exception ExtendedIllegalStateException - * If the property cannot be changed due - * to the current state. - * - */ -void setMaxRefreshes(int max) { - validatePropertyChange("maxRefreshes"); - maxRefreshes_ = max; -} -/** - * Sets the number of seconds to pause between attempts. - * - *

    This property cannot be changed when active. - * - * @param seconds - * The number of seconds between refresh attempts. - * The first refresh will occur immediately; - * the second will occur this many seconds after - * the first, and so on. - * - * @exception ExtendedIllegalStateException - * If the property cannot be changed due - * to the current state. - * - */ -void setRefreshInterval(int seconds) { - validatePropertyChange("refreshInterval"); - refreshInterval_ = seconds; -} -/** - * Sets the target for automatic refresh actions. - * - *

    This property cannot be changed when active. - * - * @param impl - * The target object. - * - * @exception ExtendedIllegalStateException - * If the property cannot be changed due - * to the current state. - * - */ -void setTarget(AS400Credential c) { - validatePropertyChange("target"); - target_ = c; -} -/** - * Instructs the thread to stop any automatic refresh in progress. - * - *

    Does nothing if not running. - * - */ -public void stopRefresh() { - stop_ = true; - if (isAlive()) - interrupt(); -} -/** - * Validates that the given property can be changed. - * - *

    Properties cannot be changed while active. - * - * @param propertyName - * The property to be validated. - * - * @exception ExtendedIllegalStateException - * If the agent is in an active state, indicating - * that attributes cannot be modified. - * - */ -void validatePropertyChange(String propertyName) { - if (isAlive()) { - Trace.log(Trace.ERROR, "Property " + propertyName + " not changed (active=true)."); - throw new ExtendedIllegalStateException(propertyName, - ExtendedIllegalStateException.PROPERTY_NOT_CHANGED); - } -} -/** - * Validates that the given property has been set. - * - *

    Performs a simple null check, used to - * centralize exception handling. - * - * @param propertyName - * The property to validate. - * - * @param value - * The property value. - * - * @exception ExtendedIllegalStateException - * If the property is not set. - * - */ -void validatePropertySet(String propertyName, Object value) { - if (value == null) { - Trace.log(Trace.ERROR, "Required property " + propertyName + " not set."); - throw new ExtendedIllegalStateException( - ExtendedIllegalStateException.PROPERTY_NOT_SET); - } -} -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/RefreshFailedException.java b/cvsroot/src/com/ibm/as400/security/auth/RefreshFailedException.java deleted file mode 100644 index 95e172bbd..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/RefreshFailedException.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ibm.as400.security.auth; - -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RefreshFailedException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -import com.ibm.as400.access.AS400Message; -/** - * The RefreshFailedException class represents an exception - * issued when errors occur while refreshing system - * authentication information. - * - *

    If available, one or more AS400Message objects may - * be included in the exception. - * - */ -public class RefreshFailedException extends AS400AuthenticationException { - - static final long serialVersionUID = 4L; - - - -/** - * Constructs a RefreshFailedException. - * - */ -RefreshFailedException() { - super(); -} -/** - * Constructs a RefreshFailedException. - * - * @param list - * The AS400Message objects to be associated - * with the exception. - * - */ -RefreshFailedException(AS400Message[] list) { - super(list); -} -/** - * Constructs a RefreshFailedException. - * - * @param rc - * The return code identifying the detail text - * to assign to the exception. - * - */ -RefreshFailedException(int rc) { - super(rc); -} -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/ResourceBundleLoader_a.java b/cvsroot/src/com/ibm/as400/security/auth/ResourceBundleLoader_a.java deleted file mode 100644 index fbc73e5de..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/ResourceBundleLoader_a.java +++ /dev/null @@ -1,88 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceBundleLoader_a.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.security.auth; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - - -/** - A class representing the ResourceBundleLoader_a object which - is used to load the resource bundle. -**/ -class ResourceBundleLoader_a -{ - private static MissingResourceException resourceException_; - - private static ResourceBundle resources_; - private static ResourceBundle accessResources_; - private static ResourceBundle coreResources_; - - - - static - { - try - { - resources_ = ResourceBundle.getBundle("com.ibm.as400.security.SecurityMRI"); - accessResources_ = ResourceBundle.getBundle("com.ibm.as400.access.MRI"); - coreResources_ = ResourceBundle.getBundle("com.ibm.as400.access.CoreMRI"); - } - catch (MissingResourceException e) - { - // Save the exception and rethrow it later. This is because exceptions - // thrown from static initializers are hard to debug. - resourceException_ = e; - } - - } - - - /** - Returns the text associated with the exception. - @param textId the id which identifies the message text to return. - @return the translatable text which describes the exception. - **/ - static final String getText (String textId) - { - if (resources_ == null) - throw resourceException_; - return resources_.getString(textId); - } - - /** - Returns the text associated with the exception. - @param textId the id which identifies the message text to return. - @return the translatable text which describes the exception. - **/ - static final String getAccessText (String textId) - { - if (accessResources_ == null) - throw resourceException_; - return accessResources_.getString(textId); - } - - /** - Returns the text associated with the exception. - @param textId the id which identifies the message text to return. - @return the translatable text which describes the exception. - **/ - static final String getCoreText (String textId) - { - if (coreResources_ == null) - throw resourceException_; - return coreResources_.getString(textId); - } - -} - diff --git a/cvsroot/src/com/ibm/as400/security/auth/RetrieveFailedException.java b/cvsroot/src/com/ibm/as400/security/auth/RetrieveFailedException.java deleted file mode 100644 index 5cc333fb9..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/RetrieveFailedException.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.ibm.as400.security.auth; - -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RetrieveFailedException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - - -import com.ibm.as400.access.AS400Message; - -/** - * The RetrieveFailedException class represents an exception - * issued when errors occur while retrieving system - * authentication information. - * - *

    If available, one or more AS400Message objects may - * be included in the exception. - * - */ -public class RetrieveFailedException extends AS400AuthenticationException { - - static final long serialVersionUID = 4L; - - /** - * Constructs a RetrieveFailedException. - * - */ - public RetrieveFailedException() { - super(); - } - - /** - * Constructs a RetrieveFailedException. - * - * @param list - * The AS400Message objects to be associated - * with the exception. - * - */ - public RetrieveFailedException(AS400Message[] list) { - super(list); - } - - /** - * Constructs a RetrieveFailedException. - * - * @param rc - * The return code identifying the detail text - * to assign to the exception. - * - */ - public RetrieveFailedException(int rc) { - super(rc); - } -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/SwapFailedException.java b/cvsroot/src/com/ibm/as400/security/auth/SwapFailedException.java deleted file mode 100644 index 1f794f6c1..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/SwapFailedException.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ibm.as400.security.auth; - -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SwapFailedException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -import com.ibm.as400.access.AS400Message; -/** - * The SwapFailedException class represents an exception - * issued when errors occur while attempting to change - * thread identity on the IBM i system. - * - *

    If available, one or more AS400Message objects - * may be included in the exception. - */ -public class SwapFailedException extends AS400AuthenticationException { - - static final long serialVersionUID = 4L; - - - -/** - * Constructs a SwapFailedException. - * - */ -SwapFailedException() { - super(); -} -/** - * Constructs a SwapFailedException. - * - * @param list - * The AS400Message objects to be associated - * with the exception. - * - */ -SwapFailedException(AS400Message[] list) { - super(list); -} -/** - * Constructs a SwapFailedException. - * - * @param rc - * The return code identifying the detail text - * to assign to the exception. - * - */ -SwapFailedException(int rc) { - super(rc); -} -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/Swapper.java b/cvsroot/src/com/ibm/as400/security/auth/Swapper.java deleted file mode 100644 index 1a488c261..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/Swapper.java +++ /dev/null @@ -1,238 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProfileTokenCredential.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2009-2009 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.security.auth; - -import com.ibm.as400.access.*; -import java.io.IOException; -import java.sql.Connection; -import java.sql.Statement; -import java.sql.SQLException; -import java.sql.SQLWarning; - -/** - Provides utility methods to perform credential swaps for existing remote connections. - The methods in this class allow you to do work under - a different user, providing you've obtained a {@link ProfileTokenCredential ProfileTokenCredential} - probably from {@link com.ibm.as400.access.AS400#getProfileToken(String,String) AS400.getProfileToken()}. -

    - Comparison with the swap() methods of ProfileTokenCredential: - -

    - The swap() methods of this class have as one of their arguments either an AS400 object or a Connection object. The contract of these methods is to swap the profile in use for a specified connection. Here is the usage pattern: -

    - AS400 conn1 = new AS400(sysName, userID, password);
    - ProfileTokenCredential myCred = new ProfileTokenCredential(....);
    - Swapper.swap(conn1, myCred);
    - // conn1 is now running under the new (swapped-to) profile
    - 
    - -

    - In constrast, the contract of the swap() methods of class {@link ProfileTokenCredential ProfileTokenCredential} is to swap the profile in use for the current thread of execution. They don't swap the profile in use for a specific AS400 object, but rather for any subsequently-created AS400 objects. Here is the usage pattern: -

    - AS400 conn1 = new AS400();
    - ProfileTokenCredential myCred = new ProfileTokenCredential(....);
    - myCred.swap();
    - AS400 conn2 = new AS400();  // conn2 is running under the swapped-to profile.
    - // conn1 is still running under the original profile.
    - 
    - -

    - The Swapper.swap() methods are useful for swapping credentials for existing remote connections. The ProfileTokenCredential.swap() methods are useful for swapping the current thread of execution when running natively in an IBM i JVM. -

    - This class is mostly based on a prototype contributed by Steve Johnson-Evers. - **/ - -public class Swapper -{ - // Prevent instantiation of this class. - private Swapper() {} - - - /** - Swaps the profile on the specified system. - This method calls system API QSYSETP ("Set To Profile Token"). -

    - Note: This method is intended for use with remote connections only, - and only swaps the profile used by - {@link com.ibm.as400.access.CommandCall CommandCall}, - {@link com.ibm.as400.access.ProgramCall ProgramCall}, and - {@link com.ibm.as400.access.ServiceProgramCall ServiceProgramCall}. - If your Java application is running "natively", that is, on-thread on the - IBM i JVM, and you wish to swap the current thread to a different profile, - use one of the swap() methods of - {@link ProfileTokenCredential ProfileTokenCredential} instead of this method. - - @param system The remote IBM i system. - @param newCredential The credential to use for the swap. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @see ProfileTokenCredential#swap() - @see ProfileTokenCredential#swap(boolean) - **/ - public static void swap(AS400 system, ProfileTokenCredential newCredential) - throws AS400SecurityException, IOException - { - if (system == null) throw new NullPointerException("system"); - if (newCredential == null) throw new NullPointerException("newCredential"); - - // If running natively, suggest the use of ProfileTokenCredential.swap() instead. - if (system.canUseNativeOptimizations()) - { - Trace.log(Trace.WARNING, "When running natively, swaps should be performed via ProfileTokenCredential.swap() instead of Swapper.swap()."); - } - - swapToToken(system, newCredential.getToken()); - newCredential.fireSwapped(); - } - - - /** - Swaps the profile on the specified JDBC connection. - This method calls system API QSYSETP ("Set To Profile Token"). - - @param connection A JDBC connection to the IBM i system. - Must be an instance of - {@link com.ibm.as400.access.AS400JDBCConnection} or {@link com.ibm.as400.access.AS400JDBCConnectionHandle}. - @param newCredential The credential to use for the swap. - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @exception SQLException If the connection is not open, or an error occurs. - **/ - public static void swap(Connection connection, ProfileTokenCredential newCredential) - throws AS400SecurityException, IOException, SQLException - { - if (connection == null) throw new NullPointerException("connection"); - if (newCredential == null) throw new NullPointerException("newCredential"); - - swapToToken(connection, newCredential.getToken()); - newCredential.fireSwapped(); - } - - - /** - Swaps the profile, using the specified profile token. - This method calls system API QSYSETP ("Set To Profile Token"). -

    - Note: This method is intended for use with remote connections only, - and only swaps the profile used by - {@link com.ibm.as400.access.CommandCall CommandCall}, - {@link com.ibm.as400.access.ProgramCall ProgramCall}, and - {@link com.ibm.as400.access.ServiceProgramCall ServiceProgramCall}. - If your Java application is running "natively", that is, on-thread on the - IBM i JVM, and you wish to swap the current thread to a different profile, - use one of the swap() methods of - {@link ProfileTokenCredential ProfileTokenCredential} instead of this method. - - @param system The IBM i system. - @param token The bytes from {@link ProfileTokenCredential#getToken()} - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @see #swap(AS400, ProfileTokenCredential) - **/ - public static void swapToToken(AS400 system, byte[] token) - throws AS400SecurityException, IOException - { - if (system == null) throw new NullPointerException("system"); - if (token == null) throw new NullPointerException("token"); - - // API takes 2 parameters: A char(32) profile token and error code - ProgramParameter[] parmList = new ProgramParameter[2]; - - // Input: Profile token (32A) - parmList[0] = new ProgramParameter(token); - - // Input/Output: Error code - parmList[1] = new ErrorCodeParameter(); - - // Call the program - ProgramCall pgm = new ProgramCall(system, "/QSYS.LIB/QSYSETPT.PGM", parmList); - pgm.suggestThreadsafe(); // Run on-thread if possible; allows app to use disabled profile. - - try - { - if (!pgm.run()) { - throw new SwapFailedException(pgm.getMessageList()); - } - - ///TBD experiment - AS400Message[] msgs = pgm.getMessageList(); - if (msgs != null && msgs.length != 0) - { - System.out.println("Messages returned from QSYSETPT:"); /// - for (int i=0; icall statement to pass the token to QSYSETPT. - - @param connection A JDBC connection to the IBM i system. - @param token The bytes from {@link ProfileTokenCredential#getToken()} - @exception AS400SecurityException If a security or authority error occurs. - @exception IOException If an error occurs while communicating with the system. - @exception SQLException If the connection is not open, or an error occurs. - @see #swap(Connection, ProfileTokenCredential) - **/ - public static void swapToToken(Connection connection, byte[] token) - throws AS400SecurityException, IOException, SQLException - { - if (connection == null) throw new NullPointerException("connection"); - if (token == null) throw new NullPointerException("token"); - - // Note: Since we _always_ submit our JDBC requests via the Database Server, we don't really have a "Toolbox native" mode when using a JDBC connection. So the swap should behave the same, whether the Java app is running remotely or natively on IBM i. - StringBuffer sql = new StringBuffer(80); - sql.append("CALL QSYS"); - sql.append(connection.getMetaData().getCatalogSeparator()); - sql.append("QSYSETPT (X'"); - - for (int i=0; i The system and name properties - * are set to the specified values. - * - * @param system - * The system associated with the principal. - * - * @param name - * The user profile name. - */ -public UserProfilePrincipal(AS400 system, String name) { - super(system); - try { - setUserProfileName(name); } - catch (PropertyVetoException pve) { - AuthenticationSystem.handleUnexpectedException(pve); } -} -/** - * Compares the specified Object with the credential - * for equality. - * - * @param o - * Object to be compared for equality. - * - * @return - * true if equal; otherwise false. - * - */ -public boolean equals(Object o) { - if (o == null) - return false; - if (this == o) - return true; - if (!(o instanceof UserProfilePrincipal)) - return false; - return - hashCode() == ((UserProfilePrincipal)o).hashCode(); -} -/** - * Returns the user profile name. - * - * @return - * A String containing the name; empty if not assigned. - * - */ -public String getUserProfileName() { - return userProfileName_; -} -/** - * Returns a hash code for this principal. - * - * @return a hash code for this principal. - * - */ -public int hashCode() { - if (userProfileName_ == null || userProfileName_.equals("")) - return super.hashCode(); - int hash = userProfileName_.hashCode(); - if (getSystem() != null) - hash += getSystem().getSystemName().hashCode(); - return hash; -} -/** - * Initializes a principal for the local IBM i system - * based on the given user profile name. - * - * @param name - * The profile name. - * - * @exception Exception - * If an exception occurs. - * - */ -public void initialize(String name) throws Exception { - setSystem(AuthenticationSystem.localHost()); - setUserProfileName(name); -} -/** - * Sets the user profile name. - * - * @param name - * The profile name. - * - * @exception PropertyVetoException - * If the change is vetoed. - * - * @exception ExtendedIllegalArgumentException - * If the provided value exceeds the maximum - * allowed length or contains non-valid - * characters. - * - */ -public void setUserProfileName(String name) throws PropertyVetoException { - // Validate parms - if (name == null) { - Trace.log(Trace.ERROR, "User profile name is null"); - throw new NullPointerException("name"); - } - String usr = name.trim().toUpperCase(); - if (usr.length() > maxLen_) { - Trace.log(Trace.ERROR, "User profile name exceeds maximum length of " + maxLen_); - throw new ExtendedIllegalArgumentException("name", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - String old = getUserProfileName(); - fireVetoableChange("userProfileName", old, usr); - userProfileName_ = usr; - firePropertyChange("userProfileName", old, usr); -} -/** - * Returns a string representation of the object - * - * @return a string representation of the object. - */ -public String toString() { - return new StringBuffer(256 - ).append(super.toString() - ).append('[' - ).append(getUserProfileName() - ).append(']' - ).toString(); -} -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/UserProfilePrincipal16.gif b/cvsroot/src/com/ibm/as400/security/auth/UserProfilePrincipal16.gif deleted file mode 100644 index 5c6c4bc07..000000000 Binary files a/cvsroot/src/com/ibm/as400/security/auth/UserProfilePrincipal16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/security/auth/UserProfilePrincipal32.gif b/cvsroot/src/com/ibm/as400/security/auth/UserProfilePrincipal32.gif deleted file mode 100644 index 516c6545f..000000000 Binary files a/cvsroot/src/com/ibm/as400/security/auth/UserProfilePrincipal32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/security/auth/UserProfilePrincipalBeanInfo.java b/cvsroot/src/com/ibm/as400/security/auth/UserProfilePrincipalBeanInfo.java deleted file mode 100644 index 70fdeff40..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/UserProfilePrincipalBeanInfo.java +++ /dev/null @@ -1,121 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserProfilePrincipalBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -package com.ibm.as400.security.auth; - -import java.awt.Image; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.IntrospectionException; -import java.beans.BeanDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.PropertyDescriptor; -/** - * Bean information for the UserProfilePrincipal class. - * - */ -public class UserProfilePrincipalBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private final static Class beanClass = UserProfilePrincipal.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_a loader_; - - private static PropertyDescriptor[] properties_; - - static - { - try - { - // ***** PROPERTIES - PropertyDescriptor userProfileName = new PropertyDescriptor("userProfileName", beanClass); - userProfileName.setBound(true); - userProfileName.setConstrained(true); - userProfileName.setDisplayName(loader_.getText("PROP_NAME_PR_USERPROFILENAME")); - userProfileName.setShortDescription(loader_.getText("PROP_DESC_PR_USERPROFILENAME")); - - properties_ = new PropertyDescriptor[] { userProfileName}; - } - catch ( Exception e ) - { - AuthenticationSystem.handleUnexpectedException(e); - } - } - - - /** - * Returns additional bean information. - * - * @return - * The bean information. - * - */ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new AS400PrincipalBeanInfo()}; - } - - - /** - * Returns the bean descriptor. - * - * @return The bean descriptor. - * - */ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - * Returns an Image for this bean's icon. - * - *

    The superclass returns a generic image; subclasses - * should override with specific images as appropriate. - * - * @param icon The desired icon size and color. - * - * @return The Image for the icon. - * - */ - public Image getIcon(int icon) - { - Image image = null; - switch ( icon ) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("UserProfilePrincipal16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("UserProfilePrincipal32.gif"); - break; - } - return image; - } - - - /** - * Returns the descriptors for all properties. - * - * @return The descriptors for all properties. - * - */ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/security/auth/package.html b/cvsroot/src/com/ibm/as400/security/auth/package.html deleted file mode 100644 index e6b9beca4..000000000 --- a/cvsroot/src/com/ibm/as400/security/auth/package.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - -Provides user profile swapping using IBM i profile token and credential classes. - -

    -These classes interact with the security services provided by IBM i. Specifically, -support is provided to authenticate a user identity, sometimes referred to as a -principal, and password against the native IBM i user registry. A credential -representing the authenticated user can then be established. You can use the credential -to alter the identity of the current IBM i thread to perform work under the authorities -and permissions of the authenticated user. In effect, this identity swap results in the -thread acting as if a sign-on was performed by the authenticated user. -

    - -

    -Note: The services to establish and swap credentials are only supported for -OS/400 release V4R5M0 or greater. -

    - -

    -The AS400 class in the com.ibm.as400.access package now provides authentication for -a given user profile and password against the IBM i system. You can also retrieve -credentials representing authenticated user profiles and passwords for the system. -These credentials, known as profile tokens, represent an authenticated user profile -and password for a specific system. Profile tokens expire based on time, up to -one hour, but can be refreshed in certain cases to provide an extended life span. -

    - -

    -Note: While inherently more secure than passing a user profile and password -due to limited life span, profile tokens should still be considered sensitive information -by the application and handled accordingly. Since the token represents an authenticated user -and password, it could potentially be exploited by a hostile application to perform work -on behalf of that user. It is ultimately the responsibility of the application to ensure -that credentials are accessed in a secure manner. -

    - - -

    Related Documentation

    - -For overviews, tutorials, examples, guides, and tool documentation, please see: - - - - diff --git a/cvsroot/src/com/ibm/as400/util/CommandHelpRetriever.java b/cvsroot/src/com/ibm/as400/util/CommandHelpRetriever.java deleted file mode 100644 index 383177a8e..000000000 --- a/cvsroot/src/com/ibm/as400/util/CommandHelpRetriever.java +++ /dev/null @@ -1,1188 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CommandHelpRetriever.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util; - -// JDK classes. -import java.io.*; -import java.util.*; - -// XSL classes. -import javax.xml.transform.*; -import javax.xml.transform.stream.*; - -// Toolbox classes. -import com.ibm.as400.access.*; - -// WebSphere 4.0 ships only a stub XML4J.jar, and XML4J.jar goes away in the future. We need to -// use xerces.jar to be compatible with the version used by WebSphere. -//import org.apache.xerces.parsers.SAXParser; -//import javax.xml.parsers.*; -import org.xml.sax.SAXException; -import javax.xml.parsers.ParserConfigurationException; -//import org.xml.sax.helpers.*; - - -/** - * Generates IBM-formatted CL command help documentation. - * This class requires that valid XML and XSL processors (e.g. Xerces and Xalan) be in the CLASSPATH. - * - * CommandHelpRetriever can be run as a command line program, as follows: - *
    - * java com.ibm.as400.util.CommandHelpRetriever -library -command [ -system -userid -password -showChoicePgmValues -output -debug ] - *
    - * Options: - *

    - *

    - * - *
    -help - *
    Displays the help text. - * The -help option may be abbreviated to -h or -?. - *
    - *

    - * Parameters: - *

    - *

    - * - *
    -library IBM i library.
    - *
    Specifies the IBM i library. - * This parameter may be abbreviated -l or -lib. - *
    - * - *
    -command IBM i command.
    - *
    Specifies the IBM i command. - * This parameter may be abbreviated -c or -cmd. - *
    - * - *
    -system IBM i system name
    - *
    Specifies the IBM i system. If an IBM i system name is not provided, a signon dialog will be displayed. - * This optional parameter may be abbreviated -s or -sys. - *
    - * - *
    -userid IBM i userID.
    - *
    Specifies the IBM i userId. If an IBM i userID is not provided, a signon dialog will be displayed. - * This optional parameter may be abbreviated -u or -uid. - *
    - * - *
    -password IBM i password.
    - *
    Specifies the IBM i password. If an IBM i password is not provided, a signon dialog will be displayed. - * This optional parameter may be abbreviated -p or -pwd. - *
    - * - *
    -showChoicePgmValues [true | false]
    - *
    Specifies whether or not parameter choices returned from choice programs are shown in the Choices cells of the parameter summary table. - * The default is false. - * This optional parameter may be abbreviated -scpv. - *
    - * - *
    -output output location. - *
    Specifies the output location for the generated help. The default is the current directory. The output - * cannot be a file when the command (-c) parameter contains a wildcard (*). - * This optional parameter may be abbreviated -o. - *
    - * - *
    -debug [true | false] - *
    Specifies whether to output the source command help and xml files to the output location specified by the -output parameter. The default is false. - * This optional parameter may be abbreviated -d. - *
    - * - *
    - * - * @see com.ibm.as400.access.Command - * @see com.ibm.as400.access.CommandList -**/ -public class CommandHelpRetriever -{ - private boolean debug_ = false; - - // The Templates object is threadsafe. We use it to pre-compile - // the XSL code and generate new Transformer objects. - private static Templates htmlTemplate_; - private static Templates uimTemplate_; - private static URIResolver defaultResolver_; - - private static String library_ = null; - private static String command_ = null; - - private boolean showChoices_ = false; - private String outputDirectory_ = "."; // Default to current directory - - // This instance has its own copy of the XSL transformer, - // SAX parser, URI resolver, and entity resolver/handler. - // Hence, the generateHTML() method is synchronized. - private Transformer htmlTransformer_; - private Transformer uimTransformer_; - private final HelpResolver resolver_ = new HelpResolver(); - - // Objects used to load the MRI and transform it into something - // that the output HTML document can use. - private static final String[] mriHTMLTags_ = new String[] - { - "ALLOW_ALL", - "ALLOW_COMPILED_CL_OR_REXX1", - "ALLOW_COMPILED_CL_OR_REXX2", - "ALLOW_INTERACTIVE1", - "ALLOW_INTERACTIVE2", - "ALLOW_JOB_BATCH", - "ALLOW_JOB_INTERACTIVE", - "ALLOW_MODULE_BATCH", - "ALLOW_MODULE_INTERACTIVE", - "ALLOW_PROGRAM_BATCH", - "ALLOW_PROGRAM_INTERACTIVE", - "ALLOW_REXX_BATCH", - "ALLOW_REXX_INTERACTIVE", - "ALLOW_USING_COMMAND_API", - "CHOICES", - "ELEMENT", - "ERRORS", - "EXAMPLES", - "KEY", - "KEYWORD", - "NAME_LOWERCASE", - "NONE", - "NOTES", - "OPTIONAL", - "PARAMETERS", - "POSITIONAL", - "QUALIFIER", - "REQUIRED", - "THREADSAFE", - "THREADSAFE_CONDITIONAL", - "TOP_OF_PAGE", - "TYPE_CL_VARIABLE_NAME", - "TYPE_COMMAND_STRING", - "TYPE_COMMUNICATIONS_NAME", - "TYPE_DATE", - "TYPE_DECIMAL_NUMBER", - "TYPE_ELEMENT_LIST", - "TYPE_GENERIC_NAME", - "TYPE_INTEGER", - "TYPE_NOT_RESTRICTED", - "TYPE_PATH_NAME", - "TYPE_QUALIFIED_JOB_NAME", - "TYPE_QUALIFIED_OBJECT_NAME", - "TYPE_QUALIFIER_LIST", - "TYPE_SIMPLE_NAME", - "TYPE_TIME", - "TYPE_VALUE_LOGICAL", - "TYPE_VALUE_CHARACTER", - "TYPE_VALUE_HEX", - "TYPE_UNSIGNED_INTEGER", - "UNKNOWN", - "VALUES_OTHER", - "VALUES_OTHER_REPEAT", - "VALUES_REPEAT", - "VALUES_SINGLE", - "WHERE_ALLOWED_TO_RUN" - }; - - // Objects used to load the MRI and transform it into something - // that the output UIM document can use. - private static final String[] mriUIMTags_ = new String[] - { - "HELP", - "HELP_FOR_COMMAND", - "INTRO_COMMAND_HELP", - "DESCRIBE_COMMAND", - "RESTRICTIONS_HEADING", - "RESTRICTION_AUT", - "RESTRICTION_THREADSAFE", - "LIST_SPECIAL_AUT", - "LIST_OTHER_AUT", - "LIST_THREADSAFE_RESTRICTIONS", - "DESCRIBE_OTHER_RESTRICTION", - "RESTRICTION_COMMENT", - "NO_PARAMETERS", - "EXAMPLES_HEADING", - "EXAMPLE_1_TITLE", - "DESCRIBE_EXAMPLE_1", - "EXAMPLE_2_TITLE", - "DESCRIBE_EXAMPLE_2", - "INTRO_EXAMPLE_HELP", - "ERROR_MESSAGES_HEADING", - "ERROR_MESSAGES_COMMENT_1", - "ERROR_MESSAGES_COMMENT_2", - "ERROR_MESSAGES_COMMENT_3", - "HELP_FOR_PARAMETER", - "INTRO_PARAMETER_HELP", - "DESCRIBE_PARAMETER", - "REQUIRED_PARAMETER", - "ELEMENT", - "QUALIFIER", - "VALUES_OTHER", - "VALUES_OTHER_REPEAT", - "VALUES_REPEAT", - "VALUES_SINGLE", - "VALUE_CHARACTER", - "VALUE_CL_VARIABLE_NAME", - "VALUE_COMMAND_STRING", - "VALUE_COMMUNICATIONS_NAME", - "VALUE_DATE", - "VALUE_DECIMAL_NUMBER", - "VALUE_GENERIC_NAME", - "VALUE_HEX", - "VALUE_INTEGER", - "VALUE_LOGICAL", - "VALUE_NAME", - "VALUE_NOT_RESTRICTED", - "VALUE_PATH_NAME", - "VALUE_SIMPLE_NAME", - "VALUE_TIME", - "VALUE_UNSIGNED_INTEGER", - "SPECIFY_VALUE", - "SPECIFY_NAME", - "SPECIFY_GENERIC_NAME", - "SPECIFY_PATH_NAME", - "SPECIFY_NUMBER", - "SPECIFY_CL_VARIABLE_NAME", - "SPECIFY_COMMAND_STRING", - "SPECIFY_DATE", - "SPECIFY_TIME", - "MULTIPLE_PARAMETER_VALUES_ALLOWED", - "MULTIPLE_ELEMENT_VALUES_ALLOWED", - "DESCRIBE_PREDEFINED_PARAMETER_VALUE", - "DESCRIBE_USERDEFINED_PARAMETER_VALUE", - "DESCRIBE_PARAMETER_DEFAULT", - "DESCRIBE_PARAMETER_VALUE_WITH_RANGE" - }; - - private static final String[][] transformedHTMLParms_ = getTransformedHTMLParms(Locale.getDefault()); - // Don't ask for UIM MRI unless someone calls the UIM methods. Do this so this tool - // works with V5R2 MRI. -// private static final String[][] transformedUIMParms_ = getTransformedUIMParms(Locale.getDefault()); - //private static String[][] transformedUIMParms_; - - // Find the XSL document, generate an XSL template, load the resource bundles, - // and generate the MRI strings. - static - { - try - { - if (Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "Loading gencmddoc.xsl."); - } - - String docXSLURI = CommandHelpRetriever.class.getClassLoader().getResource("com/ibm/as400/util/gencmddoc.xsl").toString(); - - if (Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "Loading gencmdhlp.xsl."); - } - - String hlpXSLURI = CommandHelpRetriever.class.getClassLoader().getResource("com/ibm/as400/util/gencmdhlp.xsl").toString(); - - if (Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "Loading XSL templates."); - } - - TransformerFactory factory = TransformerFactory.newInstance(); - defaultResolver_ = factory.getURIResolver(); - htmlTemplate_ = factory.newTemplates(new StreamSource(docXSLURI)); - uimTemplate_ = factory.newTemplates(new StreamSource(hlpXSLURI)); - } - catch (Exception e) - { - if (Trace.isTraceOn()) - { - Trace.log(Trace.ERROR, "Unable to initialize CommandHelpRetriever XSL and MRI.", e); - } - - throw new RuntimeException(e.toString()); - } - } - - - // Resolver used in XSL transform. - private static class HelpResolver implements URIResolver - { - public String helpResults_; - - public Source resolve(String href, String base) throws TransformerException - { - // This gets called when the XSL transformer encounters a document() call. - if (href.indexOf("myCommandHelpResolver") > -1) - { - return new StreamSource(new StringReader(helpResults_)); - } - - // If the transformer happens to load the __NO_HELP document, make something - // available. In Sun's later JVMs this gets called. For the J9 JVM this - // doesn't get called. @C2A - if (href.indexOf("__NO_HELP") > -1) - { - return new StreamSource(new StringReader("NO HELP AVAILABLE")); - } - - return defaultResolver_.resolve(href, base); - } - } - - - private static boolean genUIM_ = false; - private static boolean genHTML_ = true; - - /** - * Performs the actions specified in the invocation arguments. - * @param args The command line arguments. - **/ - public static void main(String[] args) - { - PrintWriter writer = new PrintWriter(System.out, true); //The PrintWriter used when running via the command line. - - if (args.length == 0) - { - writer.println(); - usage(); - } - - try - { - CommandHelpRetriever utility = new CommandHelpRetriever(); - - AS400 system = parseParms(args, utility); - CommandList list = new CommandList(system, utility.library_, utility.command_); - Command[] cmds = list.generateList(); - - File outDir = new File(utility.outputDirectory_); - boolean isDir = outDir.isDirectory(); - if (!isDir && cmds.length>1) - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, "The output parameter cannot be a file when a wildcard command is specified"); - - throw new ExtendedIllegalArgumentException("output", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - for (int i=0; i': - dest.append(">"); - break; - default: - dest.append(buf[i]); - break; - } - } - return dest.toString(); - } - - /** - * We don't want to HTML-encode the UIM strings, but we still - * need to replace the ampersands so the XSL doesn't get confused. - **/ - private static final String encodeAmp(String source) - { - StringBuffer dest = new StringBuffer(); - char[] buf = source.toCharArray(); - for (int i=0; iNote: While the String being returned is a typical UTF-16 Java String, the contents - * of the String is an HTML file with a META tag that defines the charset as UTF-8. - * Applications that use the String returned by this method should then be sure to convert - * the contents to UTF-8 bytes, or replace the charset tag inside the HTML with whichever - * encoding the application chooses to convert to. See {@link #generateHTMLBytes generateHTMLBytes()}. - * - * @param command The command. - * @return An HTML string consisting of the help documentation for the command. - * @see java.util.Locale - * @see com.ibm.as400.access.AS400 - * @see com.ibm.as400.access.Command - **/ - public synchronized String generateHTML(Command command) throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException, - SAXException, - ParserConfigurationException, - TransformerConfigurationException, TransformerException - { - if (command == null) - throw new NullPointerException("command"); - - return generate(command, null); - } - - /** - * Generates IBM-formatted command help documentation for the specified CL command. - * Portions of the resulting HTML will contain strings that were translated using - * the {@link java.util.Locale Locale} specified on the {@link com.ibm.as400.access.AS400 AS400} - * object for the given {@link com.ibm.as400.access.Command Command}. - * - *

    Note: While the String being returned is a typical UTF-16 Java String, the contents - * of the String is an HTML file with a META tag that defines the charset as UTF-8. - * Applications that use the String returned by this method should then be sure to convert - * the contents to UTF-8 bytes, or replace the charset tag inside the HTML with whichever - * encoding the application chooses to convert to. See {@link #generateHTMLBytes generateHTMLBytes()}. - * - * @param command The command. - * @param panelGroup The panel group used to generate the help text, instead of the Command's defined panel group. - * @return An HTML string consisting of the help documentation for the command. - * @see java.util.Locale - * @see com.ibm.as400.access.AS400 - * @see com.ibm.as400.access.Command - * @see com.ibm.as400.access.PanelGroup - **/ - public synchronized String generateHTML(Command command, PanelGroup panelGroup) throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException, - SAXException, - ParserConfigurationException, - TransformerConfigurationException, TransformerException - { - if (command == null) - throw new NullPointerException("command"); - if (panelGroup == null) - throw new NullPointerException("panelGroup"); - - return generate(command, panelGroup); - } - - /** - * Generates IBM-formatted command help documentation for the specified CL command. - * Portions of the resulting HTML will contain strings that were translated using - * the {@link java.util.Locale Locale} specified on the {@link com.ibm.as400.access.AS400 AS400} - * object for the given {@link com.ibm.as400.access.Command Command}. - * - *

    Note: The byte array returned by this method has already been encoded in UTF-8 in order to - * match the charset tag within the HTML document. - * - * @param command The command. - * @param panelGroup The panel group used to generate the help text. Specify null to use the Command's defined panel group. - * @return An HTML document encoded in UTF-8 bytes, consisting of the help documentation for the command. - * @see java.util.Locale - * @see com.ibm.as400.access.AS400 - * @see com.ibm.as400.access.Command - * @see com.ibm.as400.access.PanelGroup - **/ - public synchronized byte[] generateHTMLBytes(Command command, PanelGroup panelGroup) throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException, - SAXException, - ParserConfigurationException, - TransformerConfigurationException, TransformerException - { - if (command == null) - throw new NullPointerException("command"); - - return generate(command, panelGroup).getBytes("UTF-8"); - } - - /** - * Generates IBM-formatted command help documentation for the specified CL command. - * Portions of the resulting HTML will contain strings that were translated using - * the {@link java.util.Locale Locale} specified on the {@link com.ibm.as400.access.AS400 AS400} - * object for the given {@link com.ibm.as400.access.Command Command}. - * @param command The command. - * @param panelGroup The panel group used to generate the help text, instead of the Command's defined panel group. - * @return An HTML string consisting of the help documentation for the command. - * @see java.util.Locale - * @see com.ibm.as400.access.AS400 - * @see com.ibm.as400.access.Command - * @see com.ibm.as400.access.PanelGroup - **/ - private synchronized String generate(Command command, PanelGroup panelGroup) throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException, - SAXException, - ParserConfigurationException, - TransformerConfigurationException, TransformerException - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, "Generating HTML documentation for '"+command+"' and panel group '"+panelGroup+"'."); - - String xml = command.getXML(); - - if (debug_) - { - String path = command.getPath(); - QSYSObjectPathName pn = new QSYSObjectPathName(path); - String lib = pn.getLibraryName(); - String name = pn.getObjectName(); - - File outDir = new File(outputDirectory_); - boolean isDir = outDir.isDirectory(); - - File outFile = null; - - if (isDir) - outFile = new File(outDir, lib + "_" + name + "_XML.xml"); - else - outFile = new File(outputDirectory_ + "_XML.xml"); - - FileWriter fw = new FileWriter(outFile); - try { fw.write(xml); } - finally { if (fw != null) fw.close(); } - } - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, "Retrieved command XML:\n"+xml+"\n"); - - String threadSafe = null; - String whereAllowedToRun = null; - - try - { - switch (command.getThreadSafety()) - { - case Command.THREADSAFE_NO: - threadSafe = "0"; - break; - case Command.THREADSAFE_YES: - threadSafe = "1"; - break; - case Command.THREADSAFE_CONDITIONAL: - threadSafe = "2"; - break; - default: - break; - } - whereAllowedToRun = command.getWhereAllowedToRun(); - } - catch (AS400Exception e) - { - AS400Message[] msgs = e.getAS400MessageList(); - - // CPF6250 - Can't retrieve info for command. Probably because it is a system command. - if (msgs.length != 1 || !msgs[0].getID().toUpperCase().trim().equals("CPF6250")) - throw new AS400Exception(msgs); - } - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, "Using command threadsafety = "+threadSafe+" and where allowed to run = "+whereAllowedToRun+"."); - - String helpResults = null; - try - { - helpResults = (panelGroup == null ? command.getXMLHelpText() : command.getXMLHelpText(panelGroup)); - } - catch (AS400Exception e) - { - AS400Message[] msgs = e.getAS400MessageList(); - - // - // Note: It is also possible to get a CPF6E3B when the user is not authorized to the help text. - // However, we do not see the underlying message that the user is not authorized. - // @C2A - // CPF6250 - Can't retrieve info for command. Probably because it is a system command. - if (msgs.length != 1 || - ( !msgs[0].getID().toUpperCase().trim().equals("CPF6250") && - !msgs[0].getID().toUpperCase().trim().equals("CPF6E3B") )) - throw new AS400Exception(msgs); - } - - if (debug_ && helpResults != null) - { - String path = command.getPath(); - QSYSObjectPathName pn = new QSYSObjectPathName(path); - String lib = pn.getLibraryName(); - String name = pn.getObjectName(); - - File outDir = new File(outputDirectory_); - boolean isDir = outDir.isDirectory(); - - File outFile = null; - - if (isDir) - outFile = new File(outDir, lib + "_" + name + "_HTMLHelp.html"); - else - outFile = new File(outputDirectory_ + "_HTMLHelp.html"); - - FileWriter fw = new FileWriter(outFile); - try { fw.write(helpResults); } - finally { if (fw != null) fw.close(); } - } - - // Reset the transformer. We could re-use the same Transformer object, - // but the problem is that any document() calls in the XSL are resolved - // and cached by the transformer, so that the second time through, our - // help text would still be from the previous command. - // One way around this is to DOM parse the help text ourselves and pass - // that in to the transformer, instead of coding a document() call in - // the XSL; however, this is INCREDIBLY slow since the DOM tree can - // consist of a large number of objects, all of which the transformer - // has to marshal into its own internal format. It turns out that - // using a document() call in the XSL code is faster, especially since - // we don't get any re-use out of the help text's DOM tree. - setupHTMLTransformer(command.getSystem().getLocale()); - - htmlTransformer_.setParameter("CommandHelp", helpResults == null || helpResults.trim().length() == 0 ? "__NO_HELP" : "myCommandHelpResolver"); - htmlTransformer_.setParameter("ShowChoicePgmValues", showChoices_ ? "1" : "0"); - htmlTransformer_.setParameter("ThreadSafe", threadSafe == null ? "0" : threadSafe); - htmlTransformer_.setParameter("WhereAllowed", whereAllowedToRun == null ? "000000000000000" : whereAllowedToRun); - - resolver_.helpResults_ = helpResults; - - StreamSource sourceXML = new StreamSource(new StringReader(xml)); - StringWriter buf = new StringWriter(); - StreamResult output = new StreamResult(buf); - - if (Trace.isTraceOn()) { - Trace.log(Trace.DIAGNOSTIC, "Performing XSL transform."); - Trace.log(Trace.DIAGNOSTIC, "Help Results is "+helpResults); - } - try { - htmlTransformer_.transform(sourceXML, output); - } catch (TransformerException e) { - if (Trace.isTraceOn()) { - Trace.log(Trace.DIAGNOSTIC, "Exception from transform."); - Trace.log(Trace.DIAGNOSTIC, e); - } - throw e; - } - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, "Successfully generated help documentation."); - - return buf.toString(); - } - - - /** - * Generates an IBM-formatted UIM template for the specified CL command. - * Portions of the resulting UIM output will contain strings that were translated using - * the {@link java.util.Locale Locale} specified on the {@link com.ibm.as400.access.AS400 AS400} - * object for the given {@link com.ibm.as400.access.Command Command}. - * @param command The command. - * @return A UIM string consisting of the UIM template for the command. - * @see java.util.Locale - * @see com.ibm.as400.access.AS400 - * @see com.ibm.as400.access.Command - **/ - public synchronized String generateUIM(Command command) throws AS400Exception, AS400SecurityException, - ErrorCompletingRequestException, IOException, - InterruptedException, ObjectDoesNotExistException, - SAXException, - ParserConfigurationException, - TransformerConfigurationException, TransformerException - { - if (command == null) - throw new NullPointerException("command"); - - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, "Generating UIM documentation for "+command+"."); - - String xml = null; - try - { - xml = command.getXMLExtended(); - } - catch(AS400Exception ae) - { - AS400Message[] msgs = ae.getAS400MessageList(); - if (msgs.length == 1 && msgs[0].getID().equalsIgnoreCase("CPF3C21")) - { - if (Trace.isTraceOn()) - { - Trace.log(Trace.WARNING, "Extended command XML format not supported by this system. Using older version."); - } - xml = command.getXML(); - } - else - { - throw ae; - } - } - - if (debug_) - { - String path = command.getPath(); - QSYSObjectPathName pn = new QSYSObjectPathName(path); - String lib = pn.getLibraryName(); - String name = pn.getObjectName(); - - File outDir = new File(outputDirectory_); - boolean isDir = outDir.isDirectory(); - - File outFile = null; - - if (isDir) - outFile = new File(outDir, lib + "_" + name + "_XML_X.xml"); - else - outFile = new File(outputDirectory_ + "_XML_X.xml"); - - FileWriter fw = new FileWriter(outFile); - try { fw.write(xml); } - finally { if (fw != null) fw.close(); } - } - - if (Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "Retrieved extended command XML:\n"+xml+"\n"); - } - - // Reset the transformer. We could re-use the same Transformer object, - // but the problem is that any document() calls in the XSL are resolved - // and cached by the transformer, so that the second time through, our - // help text would still be from the previous command. - // One way around this is to DOM parse the help text ourselves and pass - // that in to the transformer, instead of coding a document() call in - // the XSL; however, this is INCREDIBLY slow since the DOM tree can - // consist of a large number of objects, all of which the transformer - // has to marshal into its own internal format. It turns out that - // using a document() call in the XSL code is faster, especially since - // we don't get any re-use out of the help text's DOM tree. - setupUIMTransformer(command.getSystem().getLocale()); - - StreamSource sourceXML = new StreamSource(new StringReader(xml)); - StringWriter buf = new StringWriter(); - StreamResult output = new StreamResult(buf); - - if (Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "Performing XSL transform of UIM."); - } - - uimTransformer_.transform(sourceXML, output); - - if (Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "Successfully generated UIM documentation."); - } - - return buf.toString(); - } - - - /** - * Returns whether or not the source XML and source command HTML help, which are used in - * generating the resulting command help HTML documentation, are saved to the current output location. - * - * @return true if the source XML and source HTML files will be generated; false otherwise. The default is false. - * @see #setDebug - **/ - public boolean getDebug() - { - return debug_; - } - - - /** - * Returns the output location for the source XML and source command HTML help when running programatically. The default is the current directory. - * - * @return The output location of the source files. - * @see #setOutputLocation - **/ - public String getOutputLocation() - { - return outputDirectory_; - } - - - /** - * Returns whether or not the generated HTML documentation will contain parameter values - * returned by a "choices program". - * @return true if the extra parameters will be shown; false otherwise. The default is false. - * @see #setShowChoiceProgramValues - **/ - public boolean getShowChoiceProgramValues() - { - return showChoices_; - } - - - /** - * Used to get the translated MRI for a given Locale. - **/ - private static final String[][] getTransformedHTMLParms(Locale locale) - { - String[][] parms = new String[mriHTMLTags_.length+4][]; - if (Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "Transforming CommandHelpRetriever HTML MRI for locale: "+locale); - } - ResourceBundle bundle = ResourceBundle.getBundle("com.ibm.as400.access.MRI", locale); - ResourceBundle bundle2 = ResourceBundle.getBundle("com.ibm.as400.access.MRI2", locale); - - int i=0; - for (; i - * Extends ExtHeader's methods to parse, print, and allow easy access to the AH Header. - */ -public class AH extends ExtHeader { - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - AH(BitBuf data) { - super(data); - type=Header.EXTAH; - } - - /** - * Returns the length of this header. - * @return Length of this header. - */ - public int getHeaderLen() { - return 64 + ((rawheader.getOctet(8) & 0xFF) * 32); - } - - /** - * Returns the next header in this packet. - * @return Will always return null. - */ - public Header getNextHeader() { - return null; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/ARPHeader.java b/cvsroot/src/com/ibm/as400/util/commtrace/ARPHeader.java deleted file mode 100644 index 63d252586..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/ARPHeader.java +++ /dev/null @@ -1,216 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ARPHeader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import com.ibm.as400.access.Trace; -import java.util.Properties; - -/** - * An Address Resolution Protocol(ARP)/Reverse Address Resolution Protocol(RARP) - * Header.
    - * Extends Header's methods to parse, print, and allow easy access to - * the ARP/RARP Header.
    - */ -public class ARPHeader extends Header { - - // Fields defined in RFC 826 - private Field hardwaretype = new Dec(rawheader.slice(0,16)); - private Field protocol = new Dec(rawheader.slice(16,16)); - private Field hdwlength = new Dec(rawheader.slice(32,8)); - private Field prtlength = new Dec(rawheader.slice(40,8)); - private Field operation = new Dec(rawheader.slice(48,16)); - private Field srchdwraddr = new Hex(rawheader.slice(64,48)); - private Field srcipaddr = new IP4Address(rawheader.slice(112,32)); - private Field dsthdwraddr = new Hex(rawheader.slice(144,48)); - private Field dstipaddr = new IP4Address(rawheader.slice(192,32)); - private int frmtype; // Parsed from the lan Header this field defines the frame type - private final static String CLASS = "ARPHeader"; - private final static String FRAME = "Frame Type"; - private final static String REQUEST = "REQUEST"; - private final static String RESPONSE = "RESPONSE"; - private final static String ARP = "ARP "; - private final static String RARP = "RARP "; - private final static String SRC = "Src Addr"; - private final static String DST = "Dst Addr"; - private final static String OPER = "Operation"; - - /** - * Creates and parses the data of this header. - * @param data The portion of the frame that contains the arp data and all subsequent data. - * @param frmtype used to determine if the frame is ARP or RARP. - */ - ARPHeader(BitBuf data,int frmtype) { - super(data); // Allow the header contructor to parse the data - this.frmtype=frmtype; - } - - /** - * Returns the length of this header. - * @return Will always return 224. - */ - public int getHeaderLen() { - return 224; - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - String operations = "",arp=""; - int oper = Integer.parseInt(operation.toString()); - - // Make sure we have enough data to parse a full header - if(rawheader.getBitSize() < getHeaderLen()) { - return (new Data(rawheader)).toString(); - } - - // Check for IP filtering - if(filter!=null) { // If filter is enabled - boolean print=false; - String IPaddr = filter.getIPAddress(), - IPaddr2 = filter.getSecondIPAddress(), - port = filter.getPort(); - - if(IPaddr==null && IPaddr2==null) { - print=true; - // If only one address is specified. - } else if(IPaddr2==null) { - // If either address matches we print this record - if(srcipaddr.toString().equals(IPaddr) - || dstipaddr.toString().equals(IPaddr)) { - print=true; - } - // Both addresses were specified - // The packet must match both addresses in any order before its - // printed - } else if((srcipaddr.toString().equals(IPaddr) - || srcipaddr.toString().equals(IPaddr2)) && - (dstipaddr.toString().equals(IPaddr) - || dstipaddr.toString().equals(IPaddr2))) { - print=true; - } - if(port!=null) {// Port is specified don't print - print=false; - } - if(!print) { // Don't print the packet - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".toString() " + "Frame doesn't pass ARP IP Filter"); - } - return ""; // Return empty record because it didn't pass the filter - } - } - - // Based on the value of operation variable as defined in the RFC, make - // it so we output text instead of a number - if(oper==1 || oper==3 || oper==8) { - operations=REQUEST; - } else if(oper==2 || oper==4 || oper==9) { - operations=RESPONSE; - } - - // Convert frametype to a readable description - if(frmtype==0x0806) { - arp=ARP; - } else if(frmtype==0x8035) { - arp=RARP; - } - - Object[] args = { - srcipaddr, - dstipaddr, - operations}; - - // Return the header, the next packet, and the Data since data will always follow an ARP header. - return Formatter.jsprintf( - "\t " + FRAME + " : " + arp - + SRC + ": {0,16,L} " + DST + ": {1,16,L} " + OPER + ": {2,8,L}\n", - args) - + printHexHeader() - + printnext(filter) + (new Data(rawpayload)).toString(); - } - - /** - * Returns the hardware type of this packet. - * @return String containing a decimal representation of this hardware type. - */ - public String getHardwareType() { - return hardwaretype.toString(); - } - - /** - * Returns the protocol of this packet - * @return String containing a decimal representation of this protocol. - */ - public String getProtocol() { - return protocol.toString(); - } - - /** - * Returns the byte length of each hardware address of this packet. - * @return String containing a decimal representation of the byte length of each hardware address of this packet. - */ - public String getHardwareLength() { - return hdwlength.toString(); - } - - /** - * Returns the byte length of each protocol address of this packet. - * @return String containing a decimal representation of the byte length of each protocol address of this packet. - */ - public String getProtocolLength() { - return prtlength.toString(); - } - - /** - * Returns the opcode of this packet. - * @return String containing a decimal representation of the opcode of this packet. - */ - public String getOpcode() { - return operation.toString(); - } - - /** - * Returns the hardware address of the sender of this packet. - * @return String containing a hexadecimal representation of the hardware address of the sender of this packet. - */ - public String getSourceHardwareAddress() { - return srchdwraddr.toString(); - } - - /** - * Returns the IP address of the source of this packet. - * @return String containing a ASCII delimited representation of the IP address of the source of this packet. - */ - public String getSourceIPAddress() { - return srcipaddr.toString(); - } - - /** - * Returns the hardware address of the destination of this packet. - * @return String containing a hexadecimal representation of the hardware address of the destination of this packet. - */ - public String getDestinationHardwareAddress() { - return dsthdwraddr.toString(); - } - - /** - * Returns the IP address of the destination of this packet. - * @return String containing a delimited representation of the IP address of the destination of this packet - */ - public String getDestinationIPAddress() { - return dstipaddr.toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/ARPPacket.java b/cvsroot/src/com/ibm/as400/util/commtrace/ARPPacket.java deleted file mode 100644 index 62a675e05..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/ARPPacket.java +++ /dev/null @@ -1,45 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ARPPacket.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * An Address Resolution Protocol(ARP)/Reverse Address Resolution Protocol(RARP) IPPacket.
    - * Extends IPPacket's methods to parse, print, and allow easy access to the ARP IPPacket. - */ -public class ARPPacket extends IPPacket { - private int frmtype; - - /** - * Creates and parses the data of this header. - * @param data The packet of data. - * @param frmtype The frame type of this packet. - */ - public ARPPacket(byte[] data,int frmtype) { - rawpacket = data; - this.frmtype = frmtype; - header = new ARPHeader(new BitBuf(rawpacket),frmtype); - } - - /** - * Returns a printable representation of this packet. - * @param filter FormatProperties object for filtering this packet. - * @return Returns a string representation of this packet. - */ - public String toString(FormatProperties filter) { - return header.toString(filter); - } -} - diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/BitBuf.java b/cvsroot/src/com/ibm/as400/util/commtrace/BitBuf.java deleted file mode 100644 index 7405698b4..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/BitBuf.java +++ /dev/null @@ -1,440 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BitBuf.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.io.StringWriter; - -/** - * The BitBuf class is an abstraction for an arbitrarily long string of bits.
    - * Its methods allow bit shifting, substring extraction, converting substrings - * to bytes, shorts, longs, or floats, and representing a bit string as a - * sequence of binary or hexadecimal digits.
    - * A new BitBuf can be constructed from another BitBuf or from a byte array. - */ -class BitBuf implements Cloneable { - private byte data[]; - private int bitlen; // used if not a byte-boundary; - private static StringBuffer binbyte = new StringBuffer("01234567"); - private static StringBuffer hexbyte = new StringBuffer("FF"); - private final int masks[] = { 128, 64, 32, 16, 8, 4, 2, 1 }; - private final char hexchars[] = - { - '0', - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - 'A', - 'B', - 'C', - 'D', - 'E', - 'F' }; - - /** - * Constructs a BitBuf from a byte array. - * @param bytes The byte array. - */ - public BitBuf(byte[] bytes) { - data = (byte[]) bytes.clone(); - bitlen = data.length * 8; - } - - /** - * Constructor for making a BitBuf from an integer array. - * Note that only the lowest 8 bits of each integer are - * used. This is useful for code such as
    - *

    -     *      int ary[] = {0x01, 0xFF, 0x5E};
    -     *      BitBuf b = new BitBuf(ary);
    -     * 
    - * which would be bulkier if a byte array were used instead - * because of the need for implicit type casting of each - * element of array. - * @param ints The integer array - */ - public BitBuf(int[] ints) { - data = new byte[ints.length]; - for (int i = 0; i < ints.length; i++) - data[i] = (byte) ints[i]; - bitlen = data.length * 8; - } - - /** - * Constructs an BitBuf of length 8 from a single byte. - * @param byte The byte - */ - public BitBuf(byte b) { - data = new byte[1]; - data[0] = b; - bitlen = data.length * 8; - } - - /** - * Constructs a zero-filled BitBuf of length i*8. - * @param int The length of the BitBuf. - */ - public BitBuf(int i) { - data = new byte[i]; - bitlen = data.length * 8; - } - - /** - * Constructs a BitBuf from a substring of another BitBuf. - * @param b The BitBuf to copy bytes from. - * @param bitstart The bit to start copying at. - * @param bitlength the number of bits to copy. - */ - public BitBuf(BitBuf b, int bitstart, int bitlength) { - if (bitlength < 0) - bitlength = 0; - bitlen = bitlength; - int newlen = (bitlength + 7) / 8; - data = new byte[newlen]; - for (int x = 0; x < newlen; x++) - data[x] = b.getOctet(bitstart + 8 * x); - truncate(); - } - - - /** - * Returns a string of binary digits representing the 8 bits starting at bit i. - * @param i the bit to start the binary string at. - * @return String - */ - public String byteAsBin(int i) { - int x; - for (x = 7; x >= 0; x--) - binbyte.setCharAt(x, ((data[i] & 0xFF & masks[x]) > 0) ? '1' : '0'); - return binbyte.toString(); - } - - /** - * Returns a string of hex digits representing the 8 bits starting at bit i. - * @param i the bit to start the hex string at. - * @return String - */ - public String byteAsHex(int i) { - hexbyte.setCharAt(0, hexchars[data[i] >>> 4 & 0xF]); - hexbyte.setCharAt(1, hexchars[data[i] & 0xF]); - return hexbyte.toString(); - } - - /** - * Returns a clone of a BitBuf casted as an Object. - * @return Object a clone of this BitBuf. - */ - public Object clone() { - BitBuf b = new BitBuf(data); - return b; - } - - /** - * Returns a boolean representing one bit (at offset bit) of the BitBuf. - * @param bit the offset bit to return a boolean of. - * @return true is on, false if off - */ - public boolean getBitAsBool(int bit) { - int byteloc = bit / 8; - int bitloc = bit % 8; - if ((data[byteloc] & 0xFF & masks[bitloc]) > 0) - return true; - else - return false; - } - - /** - * Returns a byte representing one bit (at offset bit) of the BitBuf. - * @param bit the offset bit. - * @return the byte at this offset. - */ - public byte getBitAsByte(int bit) { - int byteloc = bit / 8; - int bitloc = bit % 8; - if ((data[byteloc] & 0xFF & masks[bitloc]) > 0) - return (byte) 1; - else - return (byte) 0; - } - - /** - * Returns the length of the BitBuf in bits. - * @return Th Length of this BitBuf in bits. - */ - public int getBitSize() { - return bitlen; - } - - /** - * Returns a clone of the byte array used to store the data in a BitBuf. - * @return byte[] clone of the data in this BitBuf. - */ - public byte[] getBytes() { - return (byte[]) data.clone(); - } - - /** - * Returns the length of the BitBuf in bytes. For example, a BitBuf - * with a bit length of 3 would have a byte length of 1. - * @return length of this BitBuf in bytes - */ - public int getByteSize() { - return data.length; - } - - /** - * Returns a byte consisting of the 8 bits in the BitBuf starting at startbit. - * @param startbit bit to start the byte at - * @return byte - */ - public byte getOctet(int startbit) { - // Gets 8 bits starting at the bit location bitloc - byte b; - if ((startbit >= bitlen) || (startbit < -8)) - b = 0; - else - if (startbit < 0) - b = (byte) ((data[0] & 0xFF) >>> (0 - startbit)); - else { - int byteloc = startbit / 8; - int bitshift = startbit % 8; - b = data[byteloc]; - b <<= bitshift; - if ((bitshift > 0) && (startbit + 8 < bitlen)) - b |= (data[byteloc + 1] & 0xFF) >>> (8 - bitshift); - } - return b; - } - - /** - * Shifts the BitBuf left by x bits, shifting zeros in on the right. - * @param int length to shift to the left - */ - public void shiftLeft(int x) { - shiftBufferLeft(x); - } - - /** - * Shifts the BitBuf right by x bits, shifting zeros in on the left.
    - * Slack bits remain zero (meaning that 11101 shifted right by 2 is 00111, - * even though internally the pattern would be stored using 8 bytes) - * @param int length to shift to the right - */ - public void shiftRight(int x) { - shiftBufferRight(x); - truncate(); - } - - /** - * Efficient left-shifting of entire buffer.
    - * First, byte-resolution shifting is done in one pass, - * then bit-resolution in one more pass through the buffer. - * @param length length to shift left - */ - public void shiftBufferLeft(int d) { - int byteshift = d / 8; - int bitshift = d % 8; - if (byteshift > 0) - for (int i = 0; i < data.length; i++) - if (i < (data.length - byteshift)) - data[i] = data[i + byteshift]; - else - data[i] = 0; - if (bitshift > 0) - for (int i = 0; i < data.length; i++) - if (i < (data.length - 1)) - data[i] = - (byte) ((data[i] << bitshift) | ((data[i + 1] & 0xFF) >>> (8 - bitshift))); - else - data[i] <<= bitshift; - } - - /** - * Efficient right-shifting of entire buffer.
    - * First, byte-resolution shifting is done in one pass, - * then bit-resolution in one more pass through the buffer. - * @param length length to shift right - */ - public void shiftBufferRight(int d) { - int byteshift = d / 8; - int bitshift = d % 8; - if (byteshift > 0) - for (int i = data.length; i-- > 0;) - if (i >= byteshift) - data[i] = data[i - byteshift]; - else - data[i] = 0; - if (bitshift > 0) - for (int i = data.length; i-- > 0;) - if (i > 0) - data[i] = - (byte) (((data[i] & 0xFF) >>> bitshift) | (data[i - 1] << (8 - bitshift))); - else - data[i] = (byte) ((data[i] & 0xFF) >>> bitshift); - } - - - /** - * Returns a new BitBuf consisting of all bits from offset s and beyond. - * @param offset offset at which to slice - * @return The new BitBuf containing the subset of data - */ - public BitBuf slice(int s) { - return new BitBuf(this, s, this.bitlen - s); - } - - /** - * Returns a new BitBuf consisting of l bits starting with offset s. - * @param offset offset at which to slice - * @param length how may bits to slice - * @return The new BitBuf containing the subset of data - */ - public BitBuf slice(int s, int l) { - return new BitBuf(this, s, l); - } - - /** - * Returns a binary string representing the BitBuf, no spacing - * @return String - */ - public String toBinString() { - return toBinString(0, ""); - } - - /** - * Returns a binary string representing the BitBuf. The separator - * string is inserted into the result after every groupsize bytes. - * @return String - */ - public String toBinString(int groupsize, String separator) { - StringWriter out = new StringWriter(); - for (int x = 0; x < data.length; x++) { - out.write(byteAsBin(x)); - if ((groupsize != 0) && (x % groupsize == 0)) - out.write(separator); - } - return out.toString(); - } - - /** - * Returns a binary string representing the bit buf. Every 8 bits - * is separated by the string sep. - * @return String - */ - public String toBinString(String sep) { - return toBinString(1, sep); - } - - /** - * Returns the rightmost 8 bits of the BitBuf as a byte. - * @return byte - */ - public byte toByte() { - return getOctet(bitlen - 8); - } - - /** - * Returns a hex string representing the BitBuf, no spacing. - * @return String - */ - public String toHexString() { - return toHexString(0, ""); - } - - /** - * Returns a hex string representing the BitBuf. The separator - * string is inserted into the result after every groupsize bytes. - * @return String - */ - public String toHexString(int groupsize, String separator) { - StringWriter out = new StringWriter(); - for (int x = 0; x < data.length; x++) { - if ((x != 0) && (groupsize > 0) && (x % groupsize == 0)) - out.write(separator); - out.write(byteAsHex(x)); - } - return out.toString(); - } - - /** - * Returns a hex string representing the bit buf. Every 2 hex digits - * are separated by the string sep. - * @return String - */ - public String toHexString(String sep) { - return toHexString(1, sep); - } - - /** - * Works like toHexString(grouplen, separator) except that if the bitlen - * of the BitBuf is not a multiple of 8, the slack bits will be on the left - * instead of the right. - * @return String - */ - public String toHexStringJustified(int grouplen, String separator) { - BitBuf b = (BitBuf) this.clone(); - int slack = b.bitlen % 8; - if (slack > 0) - b.shiftBufferRight(8 - slack); - return b.toHexString(grouplen, separator); - } - - /** - * Returns the rightmost 32 bits of the BitBuf as an int. - * @return int - */ - public int toInt() { - long r = 0; - for (int i = 0; i < 4; i++) - r |= (getOctet(bitlen - 8 * (i + 1)) & 0xFF) << (i * 8); - return (int) r; - } - - /** - * Returns the rightmost 64 bits of the BitBuf as a long. - * @return long - */ - public long toLong() { - long r = 0; - for (int i = 0; i < 8; i++) - r |= (long) (getOctet(bitlen - 8 * (i + 1)) & 0xFF) << (i * 8); - return r; - } - - /** - * Returns the rightmost 16 bits of the BitBuf as an int. - * @return short - */ - public short toShort() { - long r = 0; - for (int i = 0; i < 2; i++) - r |= (getOctet(bitlen - 8 * (i + 1)) & 0xFF) << (i * 8); - return (short) r; - } - - /** - * Set unused bits on right to 0 (for situations like a string bit len of 6, which still takes 1 byte). - */ - private void truncate() { - int tailbits = bitlen % 8; - if (tailbits > 0) - data[data.length - 1] &= ~((1 << (8 - tailbits)) - 1); - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/CTMRI.java b/cvsroot/src/com/ibm/as400/util/commtrace/CTMRI.java deleted file mode 100644 index f9ca51644..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/CTMRI.java +++ /dev/null @@ -1,160 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CTMRI.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.ListResourceBundle; - -/** -Locale-specific objects for the CommTrace Utility. -**/ -public class CTMRI extends ListResourceBundle -{ - // NLS_MESSAGEFORMAT_NONE - // Each string is assumed NOT to be processed by the MessageFormat class. - // This means that a single quote must be coded as 1 single quote. - - // NLS_ENCODING=UTF-8 - // Instructs the translation tools to interpret the text as UTF-8. - - public Object[][] getContents() - { - return resources; - } - - private final static Object[][] resources= { - -{ "Transfer", "Transfer" }, -{ "TransferDescription", "Copies a file from a system to the local PC" }, -{ "Display", "Display " }, -{ "DisplayButtonDescription", "Displays a previously formatted trace stored on the local PC" }, -{ "Format", "Format" }, -{ "FormatOpt", "Format Options" }, -{ "FormatDescription", "Formats a trace stored on the local PC" }, -{ "FormatRemoteDescription", "Formats a trace stored on a system and saves the result on a system" }, -{ "DisplayRemoteDescription", "Displays a previously formatted trace that resides on a system" }, -{ "Remote", "Remote" }, -{ "Local", "Local" }, -{ "File", "File" }, -{ "Edit", "Edit" }, -{ "Commtrace", "CommTrace" }, -{ "Help", "Help" }, -{ "Disconnect", "Disconnect" }, -{ "Exit", "Exit" }, -{ "HelpTopics", "Help Topics" }, -{ "AboutCommtrace", "About CommTrace ..." }, -{ "About", "About CommTrace" }, -{ "Version", "Version" }, -{ "OK", "OK" }, -{ "Cancel", "Cancel" }, -{ "EOCP", "E N D O F C O M P U T E R P R I N T O U T" }, -{ "Show", "Show Frames:" }, -{ "ShowDescription", "The number of frames to display when the next button is selected" }, -{ "DisplayDescription", "Frames Displayed:" }, -{ "Prolog", "Prolog" }, -{ "frames", "frames" }, -{ "Prev", "Prev" }, -{ "Next", "Next" }, -{ "Save", "Save" }, -{ "SaveasBinary", "Save As Binary" }, -{ "Close", "Close" }, -{ "Find", "Find..." }, -{ "Reverse", "Reverse" }, -{ "Copy", "Copy" }, -{ "Clear", "Clear" }, -{ "Cut", "Cut" }, -{ "Paste", "Paste" }, -{ "of", "of" }, -{ "possible", "possible" }, -{ "PreviousPage", "Previous Page" }, -{ "Src/DestIPAddr", "Source/Destination IP address:" }, -{ "IPPortnum", "IP port number:" }, -{ "FmtBdcst", "Format broadcast" }, -{ "Record", "Record" }, -{ "MACAddress", "MAC Address" }, -{ "Data", "Data" }, -{ "Destination", "Destination" }, -{ "Source", "Source" }, -{ "Frame", "Frame" }, -{ "Number", "Number" }, -{ "S/R", "S/R" }, -{ "Length", "Length" }, -{ "Timer", "Timer" }, -{ "Copyright", "(c) Copyright IBM Corp. 2002. All Rights Reserved" }, -{ "Find", "Find" }, -{ "FindNext", "Find Next" }, -{ "Cancel", "Cancel" }, -{ "MatchCase", "Match Case" }, -{ "WrapSearch", "Wrap Search" }, -{ "SaveAs", "Save As..." }, -{ "FormatDialog", "Format..." }, -{ "OpenDialog", "Open..." }, -{ "AllFiles", "All files (*.*)" }, -{ "CommTraceFiles", "CommTrace files (*.bin)" }, -{ "FiletoView", "File to View" }, -{ "EOCP", "E N D O F C O M P U T E R P R I N T O U T" }, -{ "PTITLE", " COMMUNICATIONS TRACE " }, -{ "PTRACDES", "Trace Description . . . . . :" }, -{ "PCFGOBJ", "Configuration object . . . . : " }, -{ "POTYPE", "Type . . . . . . . . . . . . : " }, -{ "POTYPEH", "1=Line, 2=Network Interface, 3=Network Server" }, -{ "POBJPROT", "Object protocol . . . . . . :" }, -{ "PSTRTIME", "Start date/Time . . . . . . :" }, -{ "PENDTIME", "End date/Time . . . . . . . :" }, -{ "PBYTECOL", "Bytes collected . . . . . . :" }, -{ "PBUFSIZ", "Buffer size . . . . . . . . :" }, -{ "PBUFSIZH", "In bytes " }, -{ "PDATDIR", "Data direction . . . . . . . :" }, -{ "PDATDIRH", "1=Sent, 2=Received, 3=Both" }, -{ "PBUFWRP", "Stop on buffer full . . . . :" }, -{ "PBUFWRPH", "Y=Yes, N=No " }, -{ "PBYTES", "Number of bytes to trace" }, -{ "PBYTESB", " Beginning bytes . . . . . :" }, -{ "PBYTESBH", "Value, *CALC" }, -{ "PBYTESE", " Ending bytes . . . . . . :" }, -{ "PBYTESEH", "Value, *CALC" }, -{ "PFORMAT", "Format Options:" }, -{ "PCDNAME", "Controller name . . . . . . :" }, -{ "PCDNAMEH", "*ALL, name" }, -{ "PDATTYP", "Data representation . . . . :" }, -{ "PDATTYPH", "1=ASCII, 2=EBCDIC, 3=*Calc" }, -{ "PFMTTCP", "Format TCP/IP data only . . :" }, -{ "PIPADDR", " IP address . . . . . . . . :" }, -{ "PIPADDRH", "*ALL, address " }, -{ "PIPPORT", " IP port . . . . . . . . . :" }, -{ "PIPPORTH", "*ALL, IP port " }, -{ "PETHDAT", "Select Ethernet data . . . . :" }, -{ "PETHDATH", "1=802.3, 2=ETHV2, 3=Both" }, -{ "PBDCAST", "Format Broadcast data . . . :" }, -{ "PFMTOH", "Y=Yes, N=No " }, -{ "PRMTCD", "Remote Controller . . . . . :" }, -{ "PRMTMAC", "Remote MAC Address . . . . . :" }, -{ "PRMTSAP", "Remote SAP . . . . . . . . . :" }, -{ "PLCLSAP", "Local SAP . . . . . . . . . :" }, -{ "PPIPID", "IP Identifier . . . . . . . :" }, -{ "PRMTIP", "Remote IP Address . . . . . :" }, -{ "PRMTALLH", "Value, *ALL" }, -{ "Record", "Record" }, -{ "MACAddress", "MAC Address" }, -{ "Data", "Data" }, -{ "Destination", "Destination" }, -{ "Source", "Source" }, -{ "Frame", "Frame" }, -{ "Number", "Number" }, -{ "S/R", "S/R" }, -{ "Length", "Length" }, -{ "Timer", "Timer" }, -{ "NotSupported", "**** N O T E : \n NOT A SUPPORTED LINE TYPE FOR FORMATTING - ONLY ETHERNET AND TOKENRING SUPPORTED" } - -}; -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Char.java b/cvsroot/src/com/ibm/as400/util/commtrace/Char.java deleted file mode 100644 index baa13aa31..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Char.java +++ /dev/null @@ -1,50 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Char.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import com.ibm.as400.access.CharConverter; - -/** - * Represents an ascii character array. - */ -class Char extends Field { - private static CharConverter conv= new CharConverter(); - - /** - * Base constructor which creates a default ascii character field. - * @param data BitBuf(in Ebcdic) which represents this flag field. - */ - public Char(BitBuf data) { - super(data); - } - - /** - * Creates a String representation of this field.
    - * Converts the BitBuf from Ebcdic to Ascii before returning. - * @return String representing this character - */ - public String toString() { - String field= conv.byteArrayToString(data.getBytes()); - char[] array= field.toCharArray(); - for (int i= 0; i < array.length; i++) { - if (!Character.isLowerCase(array[i]) - && !Character.isUpperCase(array[i]) - && !Character.isDigit(array[i]) - && !Character.isSpaceChar(array[i])) { - array[i]= '.'; - } - } - return String.valueOf(array); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/CommTrace.java b/cvsroot/src/com/ibm/as400/util/commtrace/CommTrace.java deleted file mode 100644 index c165a5de0..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/CommTrace.java +++ /dev/null @@ -1,823 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CommTrace.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.awt.Color; -import java.awt.Component; -import java.awt.FileDialog; -import java.awt.Font; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.util.Hashtable; -import java.util.Locale; -import java.util.ResourceBundle; -import java.util.Vector; - -import java.io.IOException; -import javax.swing.ButtonGroup; -import javax.swing.JCheckBox; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JEditorPane; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JTextField; -import javax.swing.KeyStroke; -import javax.swing.JScrollPane; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.CommandLineArguments; -import com.ibm.as400.access.InternalErrorException; -import com.ibm.as400.access.Trace; -import com.ibm.as400.vaccess.FileFilter; -import com.ibm.as400.vaccess.IFSFileDialog; - -/** - * Provides a front end for the {@link Format Format} class, to display and transfer a communications trace file.
    - * The trace must originate from a system (running OS/400 V5R2 or greater) and reside in the IFS directory structure.
    - * The trace should be created with the following sequence of commands: - *
    - * STRCMNTRC
    - * ENDCMNTRC
    - * DMPCMNTRC
    - * 
    - * - * The next step is to either format the trace file, or transfer it to the local PC. - * The format can be done in two different ways.
    - *
    • Using the "Format" button on the main window.
    • - *
    • Using the Commtrace->Format menu option
    • - *
    - * The two options are equivalent.
    - * The format that will be performed can be affected by changing the selection - * of the "Remote" and "Local" radio button.
    - * - *

    - * If Remote is selected:
    - * The file will be formatted remotely on the IBM i system using - * JavaCommandCall. The output file will be an IFS file in the same directory as the trace but with a .bin extension - * appended. The progress of the format operation is not relayed to the - * Commtrace program unless the -verbose option is specified. A dialog will appear when the format has completed.
    - * The file will then be displayed on the local PC. Any previous format can be displayed by selecting - * the "Display" button or using the Commtrace->Display menu option.
    - * The formatted file could also be transfered to the local PC using the "Transfer" - * button or Commtrace->Transfer menu option and then displayed locally using - * the "Display" method.

    - *

    If Local is selected:
    - * The file must be transfered to the local PC using the transfer methods - * described above. A progress dialog will appear showing the transfer as it - * progresses.
    - * The file can then be formatted by selecting the Format button or menu option.
    - * A progress dialog will appear when formatting and display the progress - * of the format.
    - * After the formatting is complete the trace will be displayed as described - * in the FormatDisplay class.

    - * - * CommTrace can be run as an application as follows: - *
    - * java com.ibm.as400.commtrace.Commtrace [options]
    - * Options: - *
    - *
    -verbose/-v [true|false]
    - *
    - * Specifies whether to print status and other information to System.out - *
    - */ - -public class CommTrace extends WindowAdapter { - private AS400 sys_; // The system our connections will be made on. - private FormatDisplay format; // Formats a communications trace - //Commtrace.MainFrame_ Has to be static so our dialogs have something to be bound to. - // Otherwise the dialogs will get lost easily. - private static JFrame MainFrame_; - - private static Locale currentLocale_; - - private static final String ALL = "*ALL", - YES = "*YES", - VERSION = "1.0", - CLASS = "CommTrace", - NO="*NO"; - - // Save the path to the file we most recently transfered so we can open the - // IFSFile dialog in that location. - private String path; - - // The user if the program is verbose or not - private String verbose_; - - // The arguments passed to this program - private String[] pargs; - - // Classes that layout the structure of our frames - private GridBagLayout gridbag; - private GridBagConstraints c; - - // The basic fields in a dialog - private JOptionPane optionPane; - private JDialog dialog; - private JTextField [] args; - private JCheckBox fmtbox_; - private String btnString1; - private String btnString2; - - // Default Menubar Items - // File Menu - private JMenuItem disconnect, - exit; - private JMenuItem display; // Commtrace Menu - private JMenuItem transfer, - mformat, - about; // Help Menu - - // About Items - private JFrame fabout; - private JButton aokay; - - // Buttons on the main window - private JButton [] b = new JButton[5]; - static final int TRANSFER = 0; - static final int FORMAT = 1; - static final int OPEN = 2; - static final int FMTRMT = 3; - static final int OPENRMT = 4; - - // Lets the user select if this class is to read and format from a local or remote location - private JRadioButton remote, - local; - - // The client used to format a trace remotely - private FormatRemote fmtcl=null; - - /** - * Base constructor which creates a Commtrace. - * @param args The command line arguments - */ - public CommTrace(String[] args) { - - // Parse the arguments passed to the program - Vector v = new Vector(); - v.addElement("-verbose"); - - // Create a Hashtable to map shortcuts to the command line arguments. - Hashtable shortcuts = new Hashtable(); - shortcuts.put("-v", "-verbose"); - - // Create a CommandLineArguments object with the args array passed into main(String args[]) - // along with the vector and hashtable just created. - CommandLineArguments arguments = new CommandLineArguments(args, v, shortcuts); - - // Get the verbosity of the program - verbose_ = arguments.getOptionValue("-verbose"); - if(verbose_==null) { - verbose_="false"; - } - - // If supposed to be verbose set the trace - if(verbose_!=null && verbose_.equals("true")) { - Trace.setTraceErrorOn(true); // Enable error messages - Trace.setTraceWarningOn(true); // Enable warning messages - Trace.setTraceInformationOn(true); // Enable warning messages - Trace.setTraceOn(true); // Turns on traceing - } - - pargs = args; // Save the arguments - - MainFrame_ = new JFrame("CommTrace"); - MainFrame_.getContentPane().setLayout((gridbag = new GridBagLayout())); - c = new GridBagConstraints(); - MainFrame_.setFont(new Font("Helvetica", Font.PLAIN, 14)); - - createMenu(); // Create the Menubar for our program - createPanels(); // Fill the frame with buttons etc - - MainFrame_.setBackground(Color.black); - MainFrame_.setForeground(Color.white); - - MainFrame_.addWindowListener(this); - MainFrame_.setSize(525,300); - MainFrame_.setVisible(true); - } - - /** - * Adds the button to the specified panel. - * @param button number of the button in our button array. - * @param label the text shown on the button. - * @param constraints The GridBagConstraints of this button. - * @param panel The panel to attach the button to. - */ - private void addbutton(int button,String l,GridBagConstraints c,JPanel p) { - b[button] = new JButton(l); - b[button].setBackground(Color.black); - b[button].setForeground(Color.white); - b[button].addActionListener(new CommTraceListener(this)); - b[button].addKeyListener(new CommTraceListener(this)); - gridbag.setConstraints(b[button],c); - p.add(b[button]); - } - - /** - * Creates the Panels and objects on the main window. - */ - private void createPanels() { - JPanel pnl = new JPanel(); - pnl.setLayout((gridbag = new GridBagLayout())); - - // Set the gridbag settings - c.fill=GridBagConstraints.BOTH; - c.weightx = 0.0; - c.weighty = 0.0; - c.gridheight = 7; - c.insets = new Insets(3, 3, 3, 3); - c.gridwidth=GridBagConstraints.REMAINDER; - c.anchor=GridBagConstraints.CENTER; - gridbag.setConstraints(pnl,c); - - // Create and add the RadioButtons - ButtonGroup bg = new ButtonGroup(); - remote = new JRadioButton(ResourceBundleLoader_ct.getText("Remote")); - remote.addActionListener(new CommTraceListener(this)); - local = new JRadioButton(ResourceBundleLoader_ct.getText("Local")); - local.addActionListener(new CommTraceListener(this)); - local.setSelected(true); - bg.add(local); - bg.add(remote); - - gridbag.setConstraints(local,c); - pnl.add(local); - - c.gridwidth=GridBagConstraints.RELATIVE; - c.fill=GridBagConstraints.HORIZONTAL; - addbutton(TRANSFER,ResourceBundleLoader_ct.getText("Transfer"),c,pnl); - c.gridwidth=GridBagConstraints.REMAINDER; - JLabel trandesc = new JLabel(ResourceBundleLoader_ct.getText("TransferDescription")); - gridbag.setConstraints(trandesc,c); - pnl.add(trandesc); - - c.gridwidth=GridBagConstraints.RELATIVE; - addbutton(OPEN,ResourceBundleLoader_ct.getText("Display"),c,pnl); - c.gridwidth=GridBagConstraints.REMAINDER; - JLabel opendesc = new JLabel(ResourceBundleLoader_ct.getText("DisplayButtonDescription")); - gridbag.setConstraints(opendesc,c); - pnl.add(opendesc); - - c.gridwidth=GridBagConstraints.RELATIVE; - addbutton(FORMAT,ResourceBundleLoader_ct.getText("Format"),c,pnl); - - c.gridwidth=GridBagConstraints.REMAINDER; - JLabel formatdesc = new JLabel(ResourceBundleLoader_ct.getText("FormatDescription")); - gridbag.setConstraints(formatdesc,c); - pnl.add(formatdesc); - - gridbag.setConstraints(remote,c); - pnl.add(remote); - c.gridwidth=GridBagConstraints.RELATIVE; - addbutton(OPENRMT,ResourceBundleLoader_ct.getText("Display"),c,pnl); - c.gridwidth=GridBagConstraints.REMAINDER; - JLabel dispdsc = new JLabel(ResourceBundleLoader_ct.getText("DisplayRemoteDescription")); - gridbag.setConstraints(dispdsc,c); - pnl.add(dispdsc); - - c.gridwidth=GridBagConstraints.RELATIVE; - addbutton(FMTRMT,ResourceBundleLoader_ct.getText("Format"),c,pnl); - c.gridwidth=GridBagConstraints.REMAINDER; - JLabel fmtdsc = new JLabel(ResourceBundleLoader_ct.getText("FormatRemoteDescription")); - gridbag.setConstraints(fmtdsc,c); - pnl.add(fmtdsc); - - b[FMTRMT].setEnabled(false); - b[OPENRMT].setEnabled(false); - MainFrame_.getContentPane().add(pnl); - } - - /** - * Creates the menu's and attaches the listeners. - */ - private void createMenu() { - JMenuBar mb = new JMenuBar(); - JMenu file = new JMenu(ResourceBundleLoader_ct.getText("File")); - JMenu commtrace = new JMenu(ResourceBundleLoader_ct.getText("Commtrace")); - JMenu help = new JMenu(ResourceBundleLoader_ct.getText("Help")); - - - file.setMnemonic(KeyEvent.VK_F); - - // File menu - disconnect = new JMenuItem(ResourceBundleLoader_ct.getText("Disconnect"),KeyEvent.VK_D); - disconnect.setAccelerator(KeyStroke.getKeyStroke( - KeyEvent.VK_D, ActionEvent.CTRL_MASK)); - exit = new JMenuItem(ResourceBundleLoader_ct.getText("Exit"),KeyEvent.VK_Q); - exit.setAccelerator(KeyStroke.getKeyStroke( - KeyEvent.VK_Q, ActionEvent.CTRL_MASK)); - // Commtrace Menu - display = new JMenuItem(ResourceBundleLoader_ct.getText("Display"),KeyEvent.VK_M); - display.setAccelerator(KeyStroke.getKeyStroke( - KeyEvent.VK_O, ActionEvent.CTRL_MASK)); - transfer = new JMenuItem(ResourceBundleLoader_ct.getText("Transfer"),KeyEvent.VK_T); - transfer.setAccelerator(KeyStroke.getKeyStroke( - KeyEvent.VK_T, ActionEvent.CTRL_MASK)); - mformat = new JMenuItem(ResourceBundleLoader_ct.getText("Format"),KeyEvent.VK_R); - mformat.setAccelerator(KeyStroke.getKeyStroke( - KeyEvent.VK_R, ActionEvent.CTRL_MASK)); - // Help menu - about = new JMenuItem(ResourceBundleLoader_ct.getText("AboutCommtrace")); - - // Add the menu items to the correct menu. - file.add(disconnect); - disconnect.addActionListener(new CommTraceListener(this)); - file.add(exit); - exit.addActionListener(new CommTraceListener(this)); - - commtrace.add(transfer); - transfer.addActionListener(new CommTraceListener(this)); - commtrace.add(display); - display.addActionListener(new CommTraceListener(this)); - commtrace.add(mformat); - mformat.addActionListener(new CommTraceListener(this)); - - help.add(about); - about.addActionListener(new CommTraceListener(this)); - - mb.add(file); - mb.add(commtrace); - mb.add(help); - MainFrame_.setJMenuBar(mb); - } - - /** - * Indicates if the program is supposed to be verbose or not. - * @return "true" if program should be verbose. - */ - String isVerbose() { - return verbose_; - } - - /** - * Returns the main frame for this program. - * @return JFrame - */ - static JFrame getMainFrame() { - return MainFrame_; - } - - /** - * Displays the about box for the program. - */ - void about() { - fabout = new JFrame(ResourceBundleLoader_ct.getText("About")); - JPanel pnl = new JPanel(); - JLabel title = new JLabel(ResourceBundleLoader_ct.getText("Commtrace")); - title.setFont((new Font("Helvetica", Font.BOLD, 18))); - JLabel version = new JLabel(ResourceBundleLoader_ct.getText("Version") + " " + VERSION); - version.setFont((new Font("Helvetica", Font.PLAIN, 12))); - JLabel copyright = new JLabel(ResourceBundleLoader_ct.getText("Copyright")); - copyright.setFont((new Font("Helvetica", Font.PLAIN, 12))); - pnl.setLayout((gridbag = new GridBagLayout())); - c = new GridBagConstraints(); - - aokay = new JButton(ResourceBundleLoader_ct.getText("OK")); - - c.gridwidth=GridBagConstraints.REMAINDER; - c.gridheight=GridBagConstraints.RELATIVE; - c.gridheight = 1; - gridbag.setConstraints(title,c); - pnl.add(title); - - c.gridwidth=GridBagConstraints.REMAINDER; - c.gridheight=GridBagConstraints.RELATIVE; - c.gridheight = 1; - gridbag.setConstraints(version,c); - pnl.add(version); - - c.gridwidth=GridBagConstraints.REMAINDER; - c.gridheight=GridBagConstraints.RELATIVE; - c.gridheight = 1; - gridbag.setConstraints(copyright,c); - pnl.add(copyright); - - c.gridheight = 1; - c.gridwidth=GridBagConstraints.REMAINDER; - c.gridheight=GridBagConstraints.RELATIVE; - gridbag.setConstraints(aokay,c); - pnl.add(aokay); - aokay.addActionListener(new CommTraceListener(this)); - - fabout.getContentPane().add(pnl); - fabout.addWindowListener(this); - - fabout.setSize(300,120); - fabout.setVisible(true); - fabout.invalidate(); - fabout.validate(); - fabout.repaint(); - } - - /** - * Disconnects from the previously connected IBM i system. - */ - void disconnect() { - sys_.disconnectAllServices(); - // Create a new system object so we will be able to connect when needed - sys_ = null; - } - - /** - * Displays an IFSFileDialog to let the user specify a file they want - * retrieved.
    - * If the user pressed OK a FileDialog is presented to allow the user to - * specify a place to save the file.
    - * Then transfers the file from the IBM i system. - */ - void transfer() { - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".transfer() " + "Transfering file"); - } - if(sys_==null) { - sys_ = new AS400(); - } - - IFSFileDialog fd = new IFSFileDialog((new JFrame()), "File Open", sys_); - - FileFilter [] filterList = {new FileFilter(ResourceBundleLoader_ct.getText("AllFiles"), "*.*")}; - fd.setFileFilter(filterList, 0); - if(path!=null) { - fd.setDirectory(path); - } - - String fullpath=""; - if (fd.showDialog() == IFSFileDialog.OK) { - path=fd.getDirectory(); - fullpath = fd.getAbsolutePath(); // get fully qualified file - - FileDialog localfd = new FileDialog(MainFrame_,ResourceBundleLoader_ct.getText("SaveAs"),FileDialog.SAVE); - localfd.setFile(fd.getFileName()); - localfd.show(); - String path = localfd.getDirectory(); - String file = localfd.getFile(); - - if(file!=null) { - Read r = new Read(this,fullpath,path+file,sys_); - Thread read = new Thread(r,"Read"); - r.setThread(read); - read.start(); - } - } - } - - /** - * Opens up a previously saved trace that was formatted with this program. - */ - void open() { - if(format!=null) { - format.setThread(null); - format.close(); - } - if(local.isSelected()) { // Open a local file - format = new FormatDisplay("","","","",FormatDisplay.OPEN); - } else if(remote.isSelected()) { // Open a remote file - if(sys_==null) { - sys_ = new AS400(); - } - - if(fmtcl!=null) { - format = new FormatDisplay(fmtcl.getPath(),fmtcl.getFile(),sys_,FormatDisplay.OPENRMT); - } else { - format = new FormatDisplay("","",sys_,FormatDisplay.OPENRMT); - } - } - else { // Neither 'local' nor 'remote' is selected - this should never happen. - Trace.log(Trace.ERROR,CLASS + ".open() " + "Neither 'local' nor 'remote' is selected."); - throw new InternalErrorException(InternalErrorException.UNKNOWN); - } - Thread fmtTr = new Thread(format,"Format"); - format.setThread(fmtTr); - fmtTr.start(); - } - - /** - * Displays a Format dialog. Which allows the user to specify filtering - * options.
    - * After the format button is clicked the format method is called. - */ - void formatoptions() { - args = new JTextField[3]; - args[0] = new JTextField(ALL); - args[1] = new JTextField(ALL); - args[2] = new JTextField(ALL); - fmtbox_ = new JCheckBox(ResourceBundleLoader_ct.getText("FmtBdcst")); - fmtbox_.setSelected(true); - - btnString1 = ResourceBundleLoader_ct.getText("Format"); - btnString2 = ResourceBundleLoader_ct.getText("Cancel"); - Object[] array = {ResourceBundleLoader_ct.getText("Src/DestIPAddr"),args[0], - ResourceBundleLoader_ct.getText("Src/DestIPAddr"),args[1], - ResourceBundleLoader_ct.getText("IPPortnum"),args[2], - fmtbox_}; - String msg = ""; - Object[] options = {btnString1,btnString2}; - optionPane = new JOptionPane(array, - JOptionPane.QUESTION_MESSAGE, - JOptionPane.YES_NO_OPTION, - null, - options, - options[0]); - dialog = new JDialog(MainFrame_,ResourceBundleLoader_ct.getText("FormatOpt"),true); - dialog.setContentPane(optionPane); - dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); - dialog.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent we) { - // - // Instead of directly closing the window, - // we're going to change the JOptionPane's - // value property. - // - optionPane.setValue(new Integer( - JOptionPane.CLOSED_OPTION)); - } - }); - - for(int i=0;i - * It allows objects on the FormatDisplay window to respond to user events. - */ -class CommTraceDisplayListener implements ActionListener { - private FormatDisplay fmt; - - /** - * Constructs a new CommTraceDisplayListener - * @param fmt The FormatDisplay object - */ - public CommTraceDisplayListener(FormatDisplay fmt) { - this.fmt = fmt; - } - - /** - * Invoked when an action occurs. - * @param e The Event that occured - */ - public void actionPerformed(ActionEvent e) { - Object source = e.getSource(); - JButton next = fmt.getNextButton(); - if(source == fmt.getSaveMenuItem()) { - fmt.save(); - } else if(source == fmt.getCloseMenuItem()) { - fmt.close(); - } else if(source == fmt.getFindMenuItem()) { - fmt.find(); - } else if(source == fmt.getCopyMenuItem()) { - fmt.copy(); - } else if(source == fmt.getClearMenuItem()) { - fmt.clear(); - } else if(source == fmt.getCutMenuItem()) { - fmt.cut(); - } else if(source == fmt.getPasteMenuItem()) { - fmt.paste(); - } else if(source == next) { - // showRecs returns false when there are no more records. So we disable the - // button when that occurs. - next.setEnabled(fmt.showRecs(Integer.parseInt(fmt.getNumberList().getSelectedItem().toString()))); - } else if(source == fmt.getPrevButton()) { - fmt.showPrev(); - // User clicked previous so reenable the next button. - if(!next.isEnabled()) { - next.setEnabled(true); - } - } - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/CommTraceListener.java b/cvsroot/src/com/ibm/as400/util/commtrace/CommTraceListener.java deleted file mode 100644 index 697727907..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/CommTraceListener.java +++ /dev/null @@ -1,127 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CommTraceListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import javax.swing.JButton; - -/** - * CommTraceListener is a Listener for the Commtrace object. This class allows widgets on - * the screen to respond to user events that occur on that widget. - */ -class CommTraceListener implements ActionListener,KeyListener { - private CommTrace c; - private Format fmt; - - /** - * Constructs a CommTraceListener - * @param c This CommTrace - */ - public CommTraceListener(CommTrace c) { - this.c = c; - } - - - /** - * Invoked when an action occurs. - * @param e The Event that occured. - */ - public void actionPerformed(ActionEvent e) { - Object source = e.getSource(); - JButton[] b = c.getButtons(); - if(source == c.getDisconnectMenuItem()) { - c.disconnect(); - } else if(source == c.getExitMenuItem()) { - c.exit(); - } else if(source == c.getDisplayMenuItem()) { - c.open(); - } else if(source == c.getTransferMenuItem()) { - c.transfer(); - } else if(source == c.getFormatMenuItem()) { - c.formatoptions(); - } else if(source == c.getAboutMenuItem()) { - c.about(); - } else if(source == b[c.TRANSFER]) { - c.transfer(); - } else if(source == b[c.FORMAT]) { - c.formatoptions(); - } else if(source == b[c.OPEN]) { - c.open(); - } else if(source == b[c.FMTRMT]) { - c.formatoptions(); - } else if(source == b[c.OPENRMT]) { - c.setFormatRemote(null); // Make sure the file dialog shows - c.open(); - } else if(source == c.getAboutOkayButton()) { - c.getAboutFrame().setVisible(false); - } else if(source == c.getRemoteButton()) { - b[c.TRANSFER].setEnabled(false); - b[c.FORMAT].setEnabled(false); - b[c.OPEN].setEnabled(false); - b[c.FMTRMT].setEnabled(true); - b[c.OPENRMT].setEnabled(true); - } else if(source == c.getLocalButton()) { - b[c.TRANSFER].setEnabled(true); - b[c.FORMAT].setEnabled(true); - b[c.OPEN].setEnabled(true); - b[c.FMTRMT].setEnabled(false); - b[c.OPENRMT].setEnabled(false); - } - c.framerepaint(); // Make sure the frame is going to be redrawn - } - - /** - * Invoked when a key has been typed. - * @param e The associated KeyEvent. - */ - public void keyTyped(KeyEvent e) {} - - /** - * Invoked when a key has been pressed. - * @param e The associated KeyEvent. - */ - public void keyPressed(KeyEvent e) { - JButton[] b = c.getButtons(); - Object source = e.getSource(); - int keyCode = e.getKeyCode(); - if(source==b[c.TRANSFER]) { - if(keyCode==KeyEvent.VK_ENTER) { - c.transfer(); - } - } else if(source==b[c.FORMAT]) { - if(keyCode==KeyEvent.VK_ENTER) { - if(c.getRemoteButton().isSelected()) { - c.formatremote(); - } else if(c.getLocalButton().isSelected()) { - c.formatoptions(); - } - } - } else if(source==b[c.OPEN]) { - if(keyCode==KeyEvent.VK_ENTER) { - c.open(); - } - } - } - - /** - * Invoked when a key has been released. - * @param e The associated KeyEvent. - */ - public void keyReleased(KeyEvent e) {} -} - - diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/CommTracePropertyListener.java b/cvsroot/src/com/ibm/as400/util/commtrace/CommTracePropertyListener.java deleted file mode 100644 index f35a5cb4a..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/CommTracePropertyListener.java +++ /dev/null @@ -1,69 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CommTracePropertyListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeEvent; -import javax.swing.JDialog; -import javax.swing.JOptionPane; - -/** - * Listens for PropertyChanges to our OptionPanes. The correct - * action is performed based on the property change that occured. - */ -class CommTracePropertyListener implements PropertyChangeListener { - private CommTrace comm; - - /** - * Constructs a new CommTracePropertyListener. - * @param comm The CommTrace object. - */ - public CommTracePropertyListener(CommTrace comm) { - this.comm = comm; - } - - /** - * This method gets called when a bound property is changed. - * @param e The event that occured - */ - public void propertyChange(PropertyChangeEvent e) { - String prop = e.getPropertyName(); - JOptionPane op = comm.getOptionPane(); - JDialog dialog = comm.getDialog(); - if (dialog.isVisible() && (e.getSource() == op) - && (prop.equals(JOptionPane.VALUE_PROPERTY) || // Make sure that the dialog had a - prop.equals(JOptionPane.INPUT_VALUE_PROPERTY))) { // property change and not someother widget. - - Object value = op.getValue(); - if (value == JOptionPane.UNINITIALIZED_VALUE) { - //ignore reset - return; - } - - // Reset the JOptionPane's value. - op.setValue(JOptionPane.UNINITIALIZED_VALUE); - if (value.equals(comm.getButtonString1())) { - comm.getDialog().setVisible(false); - if(comm.getRemoteButton().isSelected()) { - comm.formatremote(); - } else if(comm.getLocalButton().isSelected()) { - comm.format(); - } - - } else { // user closed dialog or clicked cancel - dialog.setVisible(false); - } - } - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Data.java b/cvsroot/src/com/ibm/as400/util/commtrace/Data.java deleted file mode 100644 index 0e19d5a04..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Data.java +++ /dev/null @@ -1,93 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Data.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -/** - * Represents the data that is contained in the packet.
    - */ -public class Data { - private BitBuf data; - - private final static String DATA = "Data"; - - /** - * Initializes the data. - * @param data the raw packet of data. - */ - Data(BitBuf data) { - this.data = data; - } - - /** - * Creates a hexadecimal and Ascii representation of this data. One line is 32 characters ASCII and 64 bytes hexadecimal plus formatting characters in length. - * @return String containing a printable representation of the data. - */ - public String toString() { - if(data.getByteSize()==0) { // If there is no data return - return ""; - } - - StringBuffer fmtdata = new StringBuffer(data.getByteSize()*3); // The return data - StringBuffer hexdata = new StringBuffer(32); // The output hexadecimal data - StringBuffer chardata= new StringBuffer(32); // The output character representation - boolean first = true; // Set to true until the first line of data is printed. - int length = data.getByteSize(), i; - - fmtdata.append("\t" + DATA + " . . . . . . : "); - for(i=0;i - * Extends ExtHeader's methods to parse, print, and allow easy access to the - * Destination Header. - */ -public class Destination extends ExtHeader { - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - Destination(BitBuf data) { - super(data); - type=Header.EXTDEST; - } - - /** - * Returns the length of this header. - * @return The length of this header. - */ - public int getHeaderLen() { - return 64 + ((rawheader.getOctet(8) & 0xFF) * 64); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/DestinationUnreachable.java b/cvsroot/src/com/ibm/as400/util/commtrace/DestinationUnreachable.java deleted file mode 100644 index 1db8b938d..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/DestinationUnreachable.java +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DestinationUnreachable.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * A Destination Unreachable Header.
    - * Extends Message's methods to parse, print, and allow easy access to the - * Destination Unreachable Header. - */ -public class DestinationUnreachable extends Message { - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - DestinationUnreachable(BitBuf data) { - super(data); - super.type= DSTUNR; - } - - /** - * Returns the length of this header. - * @return Will always return 32. - */ - public int getHeaderLen() { - return 32; - } - - /** - * Returns the next header in the packet. - * @return Will always return an IP6Header. - */ - public Header getNextHeader() { - return new IP6Header(rawpayload); - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - return printHexHeader() + "\t\t\t" + OFFPKT + ":\n" + printnext(filter); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/ESP.java b/cvsroot/src/com/ibm/as400/util/commtrace/ESP.java deleted file mode 100644 index cdd06bfc5..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/ESP.java +++ /dev/null @@ -1,30 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ESP.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -/** - * An ESP Header
    - * Extends ExtHeader's methods to parse, print, and allow easy access to the ESP Header. - */ -public class ESP extends ExtHeader { - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - ESP(BitBuf data) { - super(data); - type= Header.EXTESP; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/EchoReplyRequest.java b/cvsroot/src/com/ibm/as400/util/commtrace/EchoReplyRequest.java deleted file mode 100644 index 544ca5bbd..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/EchoReplyRequest.java +++ /dev/null @@ -1,71 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: EchoReplyRequest.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * A Echo Reply Request Header.
    - * Extends Message's methods to parse, print, and allow easy access to the - * Echo Reply Request Header. - */ -public class EchoReplyRequest extends Message { - private Field identifier= new Dec(rawheader.slice(0, 16)); - private Field sequencenumber= new Dec(rawheader.slice(16, 16)); - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - EchoReplyRequest(BitBuf data) { - super(data); - super.type= ECHQRPL; - } - - /** - * Returns the length of this header. - * @return Will always return 32. - */ - public int getHeaderLen() { - return 32; - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - Object[] args= { identifier, sequencenumber }; - return Formatter.jsprintf(ID + ": {0,5,R} " + SEQNUM + ": {1}\n", args) - + printHexHeader() - + (new Data(rawpayload)).toString(); - } - - /** - * Returns the identifier of this EchoReplyRequest header. - * @return String containing a decimal representation of the identifier. - */ - public String getIdentifier() { - return identifier.toString(); - } - - /** - * Returns the sequence number of this EchoReplyRequest header. - * @return String containing a decimal representation of the sequence number. - */ - public String getSequenceNumber() { - return sequencenumber.toString(); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/EchoRequest.java b/cvsroot/src/com/ibm/as400/util/commtrace/EchoRequest.java deleted file mode 100644 index 1f71eb335..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/EchoRequest.java +++ /dev/null @@ -1,70 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: EchoRequest.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * A Echo Request Header.
    - * Extends Message's methods to parse, print, and allow easy access to Echo Request Header. - */ -public class EchoRequest extends Message { - private Field identifier= new Dec(rawheader.slice(0, 16)); - private Field sequencenumber= new Dec(rawheader.slice(16, 16)); - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - EchoRequest(BitBuf data) { - super(data); - super.type= ECHOREQ; - } - - /** - * Returns the length of this header. - * @return Will always return 32. - */ - public int getHeaderLen() { - return 32; - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - Object[] args= { identifier, sequencenumber }; - return Formatter.jsprintf(ID + ": {0,5,R} " + SEQNUM + ": {1,5,R}\n", args) - + printHexHeader() - + (new Data(rawpayload)).toString(); - } - - /** - * Returns the identifier of this EchoRequest header. - * @return String containing a decimal representation of the identifier. - */ - public String getIdentifier() { - return identifier.toString(); - } - - /** - * Returns the sequence number of this EchoRequest header. - * @return String containing a decimal representation of the sequence number. - */ - public String getSequenceNumber() { - return sequencenumber.toString(); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/ExtHeader.java b/cvsroot/src/com/ibm/as400/util/commtrace/ExtHeader.java deleted file mode 100644 index 1c5c96ad1..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/ExtHeader.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ExtHeader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * An Extended Header.
    - * Extends Header's methods to parse, print, and allow easy access to the Extended Header. - */ -public abstract class ExtHeader extends Header { - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - ExtHeader(BitBuf data) { - super(data); - } - - /** - * Returns the length of this header. - * @return Will always return 64. - */ - public int getHeaderLen() { - return 64; - } - - /** - * Returns the next header in this packet. - * @return Header - */ - public Header getNextHeader() { - return Header.createHeader(rawheader.getOctet(0), rawpayload); - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - // Make sure we have enough data to parse a full header - if (rawheader.getBitSize() < getHeaderLen()) { - return (new Data(rawheader)).toString(); - } - - Object[] args = { getName().replace('$', '-'), rawheader.toHexString()}; - return Formatter.jsprintf("{0}: {1,64,L}\n", args) + printnext(filter); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Field.java b/cvsroot/src/com/ibm/as400/util/commtrace/Field.java deleted file mode 100644 index 7c0d9aa53..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Field.java +++ /dev/null @@ -1,46 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Field.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import com.ibm.as400.access.AS400; - -/** - * Represents a field in the trace. Used to make converting easy between a BitBuff and readable/printable text. - */ -class Field { - BitBuf data; - - /** - * Returns a copy of the raw data that makes up this field. - * @return The raw data for this field. - */ - public BitBuf getData() { - return (BitBuf) data.clone(); - } - - /** - * Field constructor comment. - */ - public Field() { - super(); - } - - /** - * Default constructor which creates field. - * @param data BitBuf which represents this field - */ - public Field(BitBuf data) { - this.data = data; - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Find.java b/cvsroot/src/com/ibm/as400/util/commtrace/Find.java deleted file mode 100644 index 69661811f..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Find.java +++ /dev/null @@ -1,239 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Find.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.util.ResourceBundle; - -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JTextArea; -import javax.swing.JTextField; - - -/** - * Easily allow for searching of a TextArea.
    - * Presents the user with a dialog which allows them to enter text and search for the text in the specified TextArea. - */ -class Find extends WindowAdapter implements KeyListener { - private JTextArea ta; - private JFrame find; - private JButton fnext, - cancel; - private boolean isClosed=false; - private JCheckBox casebox, - wrapbox, - reverse; - private JTextField input; - private int index=0; // Our position in the text area - private String search=""; - - /** - * Creates a Find Dialog to search the specified text area. - * @param ta the TextArea to search. - */ - public Find(JTextArea ta) { - this.ta = ta; - createDialog(); - } - - /** - * Attempts to send the find dialog to the front of the screen. - */ - public void toFront() { - find.toFront(); - } - - /** - * Creates the find Dialog and presents it to the user. - */ - private void createDialog() { - if(find!=null) { - find.toFront(); - return; - } - find = new JFrame(ResourceBundleLoader_ct.getText("Find")); - JPanel pnl = new JPanel(); - GridBagLayout gridbag = new GridBagLayout(); - pnl.setLayout((gridbag)); - GridBagConstraints c = new GridBagConstraints(); - - input = new JTextField(30); - fnext = new JButton(ResourceBundleLoader_ct.getText("FindNext")); - fnext.addKeyListener(this); - cancel = new JButton(ResourceBundleLoader_ct.getText("Cancel")); - cancel.addKeyListener(this); - casebox = new JCheckBox(ResourceBundleLoader_ct.getText("MatchCase"),true); - wrapbox = new JCheckBox(ResourceBundleLoader_ct.getText("WrapSearch"),true); - reverse = new JCheckBox(ResourceBundleLoader_ct.getText("Reverse"),false); - - c.weightx = 0.0; - c.weighty = 0.0; - c.fill=GridBagConstraints.HORIZONTAL; - c.gridwidth=GridBagConstraints.RELATIVE; - c.gridheight=GridBagConstraints.RELATIVE; - gridbag.setConstraints(input,c); - pnl.add(input); - - c.fill=GridBagConstraints.BOTH; - c.gridheight = 2; - c.gridwidth=GridBagConstraints.REMAINDER; - c.gridheight=GridBagConstraints.RELATIVE; - - gridbag.setConstraints(fnext,c); - pnl.add(fnext); - fnext.addActionListener(new ActionListener() { // When the user selects the find button search the TextArea - public void actionPerformed(ActionEvent e) { - findnext(input.getText()); - } - } - ); - - pnl.add(wrapbox); - pnl.add(casebox); - - c.gridwidth=GridBagConstraints.RELATIVE; - c.gridheight=GridBagConstraints.REMAINDER; - gridbag.setConstraints(reverse,c); - pnl.add(reverse); - - c.gridheight = 2; - c.gridwidth=GridBagConstraints.REMAINDER; - c.gridheight=GridBagConstraints.REMAINDER; - gridbag.setConstraints(cancel,c); - pnl.add(cancel); - cancel.addActionListener(new ActionListener() { // Close the find dialog when the user selects the cancel button - public void actionPerformed(ActionEvent e) { - close(); - } - } - ); - - find.getContentPane().add(pnl); - find.addWindowListener(this); - - //find.pack(); - find.setSize(400,100); - find.setVisible(true); - find.invalidate(); - find.validate(); - find.repaint(); - } - - /** - * Finds the next occurance of the given string in the textarea and selects it. - * - * @param search The string to search for. - */ - public void findnext(String search) { - int tmp = 0; - this.search = search; - String searchText = ta.getText(); - if(!casebox.isSelected()) { - searchText = searchText.toLowerCase(); - search = search.toLowerCase(); - } - if(search == null) { - } else if(search.length() == 0) { - CommTrace.error(find,"Error","No String specified"); - } else { - if(reverse.isSelected()) { - tmp = searchText.lastIndexOf(search,index-search.length()); - } else { - tmp = searchText.indexOf(search,index+search.length()); - } - - if(tmp != -1) { // Search text found - ta.select(tmp,tmp+search.length()); - index=tmp; - } else { // Search text not found - if(index!=0 && wrapbox.isSelected()) { // If the user wants to wrap the search, search again. - index = 0; - findnext(search); - } else { - CommTrace.error(find,"Error","Text not found"); - } - tmp = 0; - } - } - index=tmp; - find.invalidate(); - find.validate(); - find.repaint(); - } - - /** - * Invoked when a window is in the process of being closed. - * @param e The event for this window. - */ - public void windowClosing(WindowEvent e) { - if(e.getSource() == find) { - close(); - } - } - - /** - * Closes the find dialog. - */ - public void close() { - isClosed=true; - find.setVisible(false); - } - - /** - * @return true when the find dialog was closed by the user, false otherwise. - */ - public boolean isClosed() { - return isClosed; - } - - /** - * Invoked when a key has been typed. - * @param e The associated KeyEvent. - */ - public void keyTyped(KeyEvent e) {} - - /** - * Invoked when a key has been pressed. - * @param e The associated KeyEvent. - */ - public void keyPressed(KeyEvent e) { - int keyCode = e.getKeyCode(); - if(e.getSource()==fnext) { // If the enter key is pressed while our search box is selected search. - if(keyCode==KeyEvent.VK_ENTER) { - findnext(input.getText()); - } - } else if(e.getSource()==cancel) { // Remove find dialog is the user selects cancel - if(keyCode==KeyEvent.VK_ENTER) { - isClosed=true; - find.setVisible(false); - } - } - } - - /** - * Invoked when a key has been released. - * @param e The associated KeyEvent. - */ - public void keyReleased(KeyEvent e) {} -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Flag.java b/cvsroot/src/com/ibm/as400/util/commtrace/Flag.java deleted file mode 100644 index 4d826782c..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Flag.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Flag.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -/** - * Represents a user definable flag.
    - * True and false values are overrideable to produce specific output. - */ -class Flag extends Field { - String truevalue; - String falsevalue; - boolean usetext; - - /** - * Base constructor which creates a default flag. - * @param data BitBuf which represents this flag field. - */ - public Flag(BitBuf data) { - super(data); - } - /** - * Constructor which creates a default flag with the specified true and false values. - * @param BitBuf BitBuf which represents this flag field. - * @param truevalue the true value of this flag. - * @param falsevalue the false value of thie flag. - */ - public Flag(BitBuf b, String tv, String fv) { - super(b); - truevalue = tv; - falsevalue = fv; - usetext = true; - } - - /** - * Creates a String representation of this flag. - * @return String representing this flag. - */ - public String toString() { - byte x = data.getBitAsByte(0); - if (usetext == false) - return Byte.toString(x); - else - if (x == 1) - return truevalue; - else - return falsevalue; - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Format.java b/cvsroot/src/com/ibm/as400/util/commtrace/Format.java deleted file mode 100644 index a33b86a5c..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Format.java +++ /dev/null @@ -1,1181 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Format.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.io.BufferedInputStream; -import java.io.BufferedWriter; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.NotSerializableException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Writer; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Hashtable; -import java.util.Locale; -import java.util.Properties; -import java.util.ResourceBundle; -import java.util.Vector; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.CommandLineArguments; -import com.ibm.as400.access.IFSFileInputStream; -import com.ibm.as400.access.IFSFileOutputStream; -import com.ibm.as400.access.IFSTextFileOutputStream; -import com.ibm.as400.access.Trace; - -/** - * The Format object is an interface between the raw trace file and the records the trace file contains.
    - * A example program:
    - * - *
    - * Format f = new Format("/path/to/file");
    - * f.setFilterProperties(fmtprop); // Sets the filtering properties for this format
    - * f.formatProlog(); // Format the prolog
    - * Prolog pro = f.getProlog();	
    - * System.out.println(pro.toString());
    - * if(!pro.invalidData()) { // The is not a valid trace
    - *	 Frame rec; 
    - *	 while((rec=f.getNextRecord())!=null) { // Get the records
    - *	 	System.out.print(rec.getRecNum()); // Print out the Frame Number
    - *	 	System.out.println(rec.getTime()); // Print out the time
    - *	 	IPPacket p = rec.getPacket(); // Get this records packet
    - *	 	Header h = p.getHeader(); // Get the first header
    - *	 	if(p.getType()==IPPacket.IP6) { // If IP6 IPPacket
    - *	 		if(h.getType()==Header.IP6) { // If IP6 Header
    - *				IP6Header ip6 = (IP6Header) h; // Cast to IP6 so we can access methods
    - *				System.out.println(h.getName()); // Print the name
    - *				System.out.println("IP6 src:"+ip6.getSrcAddr() + " dst:" + ip6.getDstAddr());
    - *				System.out.println(ip6.printHexHeader()); // Print the header as hex 
    - *				// Print a string representation of the header.
    - *				System.out.println(ip6.toString(prop)); 
    - *				while((h=h.getNextHeader())!=null) { // Get the rest of the headers
    - *					if(h.getType()==Header.TCP) { // If its a TCP header
    - *						TCPHeader tcp = (TCPHeader) h; // Cast so we can access methods
    - *						System.out.println("TCP src:" + tcp.getSrcPort() + " dst:" + tcp.getDstPort()); 
    - *						System.out.println(tcp.toString(prop));
    - *					} else if(h.getType()==Header.UDP) { // If its a UDP header
    - *						UDPHeader udp = (UDPHeader) h; // Cast so we can access methods
    - *						System.out.println("UDP src:" + udp.getSrcPort() + " dst:" + udp.getDstPort()); 
    - *						System.out.println(udp.toString(prop));
    - *					}
    - *				}
    - *			}
    - *		}
    - *	 } 
    - * }
    -
    - * - * Format can be run as a program as follows:
    - *
    - * java com.ibm.as400.commtrace.Format [ options ]
    - * Options: - *
    - * The first argument is the system to connect to. - *
    -u/-userID
    The userID for the system
    - *
    -p/-password
    The password for the system
    - *
    -t/-trace
    The trace to parse
    - *
    -o/-outfile
    The file to store the output in
    - *
    -c/-current
    Will connect to localhost with the current userID and password
    - *
    -v/-verbose [true|false]
    - *
    -logfile
    The file to store the Trace.log to
    - *
    -ip/-ipaddress
    The IP address to filter by
    - *
    -ip2/-ipaddress2
    The second IP address to filter by
    - *
    -port
    The port number to filter by
    - *
    -broadcast [*YES|*NO]
    Print broadcast frames
    - *
    -starttime
    The start of the display range in MMddyyyykkmmssSSS notation(see java.text.SimpleDateFormat)
    - *
    -endtime
    The end of the display range in MMddyyyykkmmssSSS notation(see java.text.SimpleDateFormat)
    - *
    -starttimelong
    The start of the display range in milliseconds since the epoc
    - *
    -endtimelong
    The end of the display range in milliseconds since the epoc
    - *
    - */ -public class Format { - private static final String ALL= "*ALL", NO= "*NO", CLASS="Format"; - private AS400 sys= null; - private boolean createdSys=false; // True if we created the system so we should close it - private InputStream file_= null; - private Progress progress= null; - // The progress dialog which display the format progress to the user - private byte[] data= null; // The raw data of a specific packet - private Prolog pro_= null; - // The prolog of this trace. Needed so we can get the title and date of this trace - private String filename= null, // The path and filename of the file to format - outfilePath_= null; // The path and filename of the file to put the traced data to - //fmtBroadcast= "Y"; // User wants to see broadcast frames - - private BitBuf nxtRecLen; - private int ifsrecs= 0, // The number of records in this commtrace - tcprecs= 0, // The number of tcp records in this commtrace - numrecs= 0; // The number of records processed - - private FormatProperties filter_; - private ObjectInputStream serin_; - - /** - * Default constructor. - */ - public Format() { - } - - /** - * Creates a new Format.
    - * Initializes the MRI.
    - * Takes an AS400 object as an argument which will be used for - * all IBM i operations.
    - * - * @param sys The system that this object should connect to. - */ - public Format(AS400 sys) { - this.sys= sys; - } - - /** - * Constructs a new Format object.
    - * Initializes the MRI.
    - * Formats the Prolog.
    - * Sets up the Filters.
    - * @param prop The FormatProperties object to filter by. - * @param outfile The file to write the formatted trace data to. - * @param infile The name of the file to read from. - */ - public Format(FormatProperties prop, String outfile, String infile) { - this.filter_= prop; - this.outfilePath_= outfile; - this.filename = infile; - - // If the user didn't specify a file name gracefully exit - if (infile == null) { - close(); - return; - } - // Attempt to open a stream on the file - try { - file_= new BufferedInputStream(new FileInputStream(infile)); - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".Format()" + "Error opening:" + infile, e); - } - close(); // Clean up this thread - return; - } - - formatProlog(); - } - - /** - * Creates a Format object on the given binary trace.
    - * Initializes the MRI.
    - * Formats the Prolog.
    - * Sets up the Filters.
    - * @param args The command line arguments to be used to format the file.
    - */ - public Format(String[] args) { - // Create a vector to hold all the possible command line arguments. - Vector v= new Vector(); - v.addElement("-userID"); - v.addElement("-password"); - v.addElement("-trace"); - v.addElement("-filename"); - v.addElement("-outfile"); - v.addElement("-current"); - v.addElement("-verbose"); - v.addElement("-logfile"); - v.addElement("-country"); - v.addElement("-language"); - v.addElement("-ipaddress"); - v.addElement("-ipaddress2"); - v.addElement("-port"); - v.addElement("-broadcast"); - v.addElement("-starttime"); - v.addElement("-endtime"); - v.addElement("-starttimelong"); - v.addElement("-endtimelong"); - - // Create a Hashtable to map shortcuts to the command line arguments. - Hashtable shortcuts= new Hashtable(); - shortcuts.put("-u", "-userID"); - shortcuts.put("-p", "-password"); - shortcuts.put("-t", "-trace"); - shortcuts.put("-o", "-outfile"); - shortcuts.put("-c", "-current"); - shortcuts.put("-v", "-verbose"); - shortcuts.put("-l", "-language"); - shortcuts.put("-co", "-country"); - shortcuts.put("-ip", "-ipaddress"); - shortcuts.put("-ip2", "-ipaddress2"); - - // Create a CommandLineArguments object with the args array passed - // into main(String args[]) along with the vector and hashtable just - // created. - CommandLineArguments arguments= new CommandLineArguments(args, v, shortcuts); - - // Get the system that the user wants to run to. - String system= arguments.getOptionValue(""); - - // Get the user ID that the user wants to log in with. - String uid= arguments.getOptionValue("-userID"); - - // Get the password that the user wants to log in with. - String pwd= arguments.getOptionValue("-password"); - - // If specified the user wants to logon to localhost with the current - // userID and password - String cur= arguments.getOptionValue("-current"); - - // The name of the file to trace - String filename= arguments.getOptionValue("-trace"); - this.filename= filename; - - // The name of the output file to save to - String outfile= arguments.getOptionValue("-outfile"); - this.outfilePath_= outfile; - - // Enable debugging or not - String verbose= arguments.getOptionValue("-verbose"); - - String logfile= arguments.getOptionValue("-logfile"); - - // The language code - //String language= arguments.getOptionValue("-language"); - - // The country code - String country= arguments.getOptionValue("-country"); - - // If supposed to be verbose set the trace - if (verbose != null && verbose.equals("true")) { - Trace.setTraceErrorOn(true); // Enable error messages - Trace.setTraceWarningOn(true); // Enable warning messages - Trace.setTraceInformationOn(true); // Enable warning messages - Trace.setTraceOn(true); // Turns on traceing - } - - // If log output should be sent to a file - if (logfile != null) { - try { - Trace.setFileName(logfile); - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log( - Trace.ERROR, - CLASS + ".Format" + "Can't set trace file name, defaulting to outputing trace data to standard out"); - } - } - } - - // Set up the filter properties for this trace - filter_= new FormatProperties(); - - String filterIP= arguments.getOptionValue("-ipaddress"); - String filterIP2= arguments.getOptionValue("-ipaddress2"); - String filterPort= arguments.getOptionValue("-port"); - String filterBdcst= arguments.getOptionValue("-broadcast"); - String filterSTime= arguments.getOptionValue("-starttime"); - String filterETime= arguments.getOptionValue("-endtime"); - String filterSTimelong= arguments.getOptionValue("-starttimelong"); - String filterETimelong= arguments.getOptionValue("-endtimelong"); - boolean setUpFilters=false; - - // Set the filter properties that were specified - if (filterIP != null && !filterIP.equals(ALL)) { - filter_.setIPAddress(filterIP); - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".Format() " + "IP Filtering enabled"); - } - } - if (filterIP2 != null && !filterIP2.equals(ALL)) { - filter_.setSecondIPAddress(filterIP2); - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".Format() " + "IP Filtering enabled"); - } - } - if (filterBdcst != null && !filterBdcst.equals(ALL)) { - filter_.setBroadcast(filterBdcst); - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".Format() " + "Broadcast Filtering enabled"); - } - } - if (filterPort != null && !filterPort.equals(ALL)) { - filter_.setPort(filterPort); - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".Format() " + "Port Filtering enabled"); - } - } - if (filterSTime != null && !filterSTime.equals(ALL)) { - filter_.setStartTime(filterSTime); - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".Format() " + "Beginning Timestamp Filtering enabled"); - } - setUpFilters=true; // We need to parse the argument into a timestamp - } - if (filterETime != null && !filterETime.equals(ALL)) { - filter_.setEndTime(filterETime); - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".Format() " + "End Timestamp Filtering enabled"); - } - } - if (filterSTimelong != null && !filterSTimelong.equals(ALL)) { - if(filterETime!=null) { // The End time with a MMddyyyykkmmssSSS format was - // specified. Remove it since a millisecond time was also specified. - String time=null; - filter_.setEndTime(null); - } - filter_.setStartTime(filterSTimelong); - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".Format() " + "Beginning Timestamp Filtering enabled"); - } - } - if (filterETimelong != null && !filterETimelong.equals(ALL)) { - filter_.setEndTime(filterETimelong); - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".Format() " + "End Timestamp Filtering enabled"); - } - } - - if(filename==null) { // User didn't specify a file - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".Format() " + "Outfile not specified"); - } - return; - } - - if (cur != null) { // If use CURRENT - sys= new AS400(); - createdSys=true; - try { - // Opens a input stream on the file - file_= new IFSFileInputStream(sys, filename); - } catch (FileNotFoundException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".Format() " + "File " + filename + " not found", e); - } - return; - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".Format() " + "Error opening " + filename, e); - } - return; - } catch (AS400SecurityException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".Format() " + "Security exception opening file", e); - } - return; - } - // User wants to format a file on their local PC - } else if (system == null || uid == null || pwd == null) { - try { - file_= new BufferedInputStream(new FileInputStream(filename)); - } catch (FileNotFoundException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".Format() " + "File " + filename + " not found", e); - } - return; - } - // User wants to format a file on the AS400 - } else { - sys= new AS400(system, uid, pwd); - createdSys=true; - try { - // Opens a input stream on the file - file_= new IFSFileInputStream(sys, filename); - } catch (FileNotFoundException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".Format() " + "File " + filename + " not found", e); - } - return; - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".Format() " + "Error opening" + filename, e); - } - return; - } catch (AS400SecurityException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".Format() " + "Security exception opening file", e); - } - return; - } - } - - if(!formatProlog()) { - if(setUpFilters) { - setUpFilters(); // Change the time filters into time in milliseconds - } - } - } - - /** - * Creates a Format object on the given local file.
    - * @param filename The file to format. - */ - public Format(String filename) { - this.filename= filename; - if(filename==null) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".Format() " + "File not specified"); - } - return; - } - try { - file_= new BufferedInputStream(new FileInputStream(filename)); - // Opens a input stream on the local file - } catch (FileNotFoundException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".Format() " + "File " + filename + " not found", e); - } - return; - } - } - - /** - * Creates a Format object on the given IFSFileInputStream.
    - * Initializes the MRI.
    - * Formats the Prolog.
    - * Sets up the Filters.
    - * @param file The input stream to read the data off of. - */ - public Format(IFSFileInputStream file) { - this.file_= file; - formatProlog(); - } - - /** - * Changes the TIMESTART and TIMEEND of the Properties into longs with a value of time from the epoc. - */ - private void setUpFilters() { - if(filter_==null) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".setUpFilters() " + "Filters are not initialized"); - } - return; - } - try { - SimpleDateFormat df= new SimpleDateFormat("MMddyyyykkmmssSSS"); - // The format of the date after the record to filter on replaces the start time - - String starttime= filter_.getStartTime(); - String endtime= filter_.getEndTime(); - - if (starttime != null) { - // Set the property to the milliseconds since the epoc - filter_.setStartTime(Long.toString(df.parse(starttime).getTime())); - } - if (endtime != null) { - // Set the property to the milliseconds since the epoc - filter_.setEndTime(Long.toString(df.parse(endtime).getTime())); - } - - } catch (ParseException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".setUpFilters() " + "Invalid Time argument", e); - } - } - } - - /** - * Sets the Properties for this Format. - * @param prop Properties for this Format. - */ - public void setFilterProperties(FormatProperties prop) { - filter_=prop; - } - - /** - * Sets the output file to open a OutputStream on. - * @param outfile The file to open a OutputStream on. - */ - public void setOutFile(String outfile) { - this.outfilePath_=outfile; - } - - /** - * Sets the input stream to read the data from. - * @param infile The open InputStream to read from. - */ - public void setInFileStream(InputStream infile) { - file_=infile; - } - - /** - * Sets the system to use for all IBM i connections. - * @param system The system to connect to. - */ - public void setSystem(AS400 system) { - sys=system; - } - - /** - * Formats the trace and sends the output to an IFS text file on the system we are bound to. - * @return A error code if any. - */ - public int toIFSTxtFile() { - if(sys==null) { // sys isn't specified - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toIFSTxtFile() " + "Error the system wasn't specified"); - } - return 1; - } - if(outfilePath_==null) { // outfile isn't specified - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toIFSTxtFile() " + "Error the out file wasn't specified"); - } - return 1; - } - - IFSTextFileOutputStream out = null; - try - { - try { - out= new IFSTextFileOutputStream(sys, outfilePath_); - // Opens an output stream on the local file - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toIFSTxtFile() " + "Error opening " + outfilePath_, e); - } - return 1; - } catch (AS400SecurityException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toIFSTxtFile() " + "Security exception opening file", e); - } - return 1; - } - int recPrinted=0; - Frame rec; - try { - out.write(pro_.toString()); - while ((rec= getNextRecord()) != null) { - if(recPrinted%5==0) { - out.write(addBanner()); - } - out.write(rec.toString()); - recPrinted++; - } - out.write(addEndBanner()); - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toIFSTxtFile() " + "Error writing to " + filename, e); - } - return 1; - } - } - finally - { - if (out != null) { - try { out.close(); } - catch (IOException e) { Trace.log(Trace.ERROR,e); } - } - } - return 0; - } - - /** - * Formats the trace and sends the output to an IFS text file on the system we are bound to. - * @return A error code if any. - */ - public int toLclTxtFile() { - Writer out; - - if(outfilePath_==null) { // outfile isn't specified - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toLclTxtFile() " + "Error the out file wasn't specified"); - } - return 1; - } - - try { - out= new BufferedWriter(new FileWriter(outfilePath_)); - // Opens an output stream on the local file - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toLclTxtFile() " + "Error opening " + outfilePath_, e); - } - return 1; - } - - int recPrinted=0; - Frame rec; - try { - out.write(pro_.toString()); - while ((rec= getNextRecord()) != null) { - if(recPrinted%5==0) { - out.write(addBanner()); - } - out.write(rec.toString()); - recPrinted++; - } - out.write(addEndBanner()); - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toLclTxtFile() " + "Error writing to " + filename, e); - } - return 1; - } - try { - out.flush(); - out.close(); - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toLclTxtFile() " + "Error closing " + filename, e); - } - return 1; - } - return 0; - } - - /** - * Format the trace and write the results to a binary IFS file on the system - * we are connected to. - * @return A error code if any. - */ - public int toIFSBinFile() { - if(pro_==null) { // Constructed incorrectly - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toIFSBinFile() " + "Error the prolog wasn't formatted"); - } - return 1; - } - - if (pro_.invalidData()) { // If the prolog had invalid data return - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toIFSBinFile() " + "Not a valid IBM i CommTrace"); - } - return 1; - } - - ObjectOutputStream out = null; - try - { - try { - out= new ObjectOutputStream(new IFSFileOutputStream(sys, outfilePath_)); - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toIFSBinFile() " + "Error opening " + outfilePath_, e); - } - return 1; - } catch (AS400SecurityException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toIFSBinFile() " + "Security exception opening file " + outfilePath_, e); - } - return 1; - } - - try { - out.writeUTF(pro_.toString()); - out.writeInt(ifsrecs); - Frame rec = null; - while ((rec= getNextRecord()) != null) { - String record= rec.toString(filter_); - if (record.length() != 0) { - out.writeUTF(record); - } - } - out.writeUTF(addEndBanner()); - } catch (NotSerializableException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toIFSBinFile() " + "Error object not serializable " + outfilePath_, e); - } - return 1; - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toIFSBinFile() " + "Error writing file " + outfilePath_, e); - } - return 1; - } - } - finally { - if (out != null) { - try { out.close(); } - catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toIFSBinFile() " + "Error closing file " + outfilePath_, e); - } - return 1; - } - } - } - return 0; - } - - /** - * Format the trace and write the results to a binary file on the local PC. - * @return A error code if any. - */ - public int toLclBinFile() { - if(pro_==null) { // Constructed incorrectly - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toLclBinFile() " + "Error the prolog wasn't formatted"); - } - return 1; - } - - if (pro_.invalidData()) { // If the prolog had invalid data return - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toLclBinFile() " + "Not a valid IBM i CommTrace"); - } - return 1; - } - - String showprogress= filter_.getProgress(); - if (showprogress != null && showprogress.equals(FormatProperties.TRUE)) { - // Start the progress bar - progress= new Progress(("Formating " + filename), ifsrecs, " records"); - Thread progThread= new Thread(progress, "ProgDiag"); - progress.setThread(progThread); - progThread.start(); - } - - // If no output file specified use the same as the current trace but append the extension onto it. - //if(outfilePath_==null) { - // - //} - - ObjectOutputStream out = null; - try - { - try { - out= new ObjectOutputStream(new FileOutputStream(outfilePath_)); - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toLclBinFile() " + "Error opening " + outfilePath_, e); - } - return 1; - } - - try { - out.writeUTF(pro_.toString()); - out.writeInt(ifsrecs); - Frame rec = null; - if (progress == null) { - while ((rec= getNextRecord()) != null) { - String record= rec.toString(filter_); - if (record.length() != 0) { - out.writeUTF(record); - } - } - } else { - while ((rec= getNextRecord()) != null && !progress.isCanceled()) { - String record= rec.toString(filter_); - if (record.length() != 0) { - out.writeUTF(record); - } - } - } - - out.writeUTF(addEndBanner()); - } catch (NotSerializableException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toLclBinFile() " + "Error object not serializable " + outfilePath_, e); - } - return 1; - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toLclBinFile() " + "Error writing file " + outfilePath_, e); - } - return 1; - } - } - finally { - if (out != null) { - try { out.close(); } - catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".toLclBinFile() " + "Error closing file " + outfilePath_, e); - } - return 1; - } - } - } - return 0; - - } - -// /** -// * Formats the recs and writes them out. -// * @return An error code if any. -// */ -// private int toBinFile(ObjectOutputStream out) { -// Frame rec; -// try { -// out.writeUTF(pro_.toString()); -// out.writeInt(ifsrecs); -// while ((rec= getNextRecord()) != null) { -// out.writeUTF(rec.toString()); -// } -// out.writeUTF(addEndBanner()); -// } catch (NotSerializableException e) { -// if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { -// Trace.log(Trace.ERROR,CLASS + ".toBinFile() " + "Error object not serializable " + outfilePath_, e); -// } -// return 1; -// } catch (IOException e) { -// if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { -// Trace.log(Trace.ERROR, CLASS + ".toBinFile() " + "Error writing file " + outfilePath_, e); -// } -// return 1; -// } -// try { -// out.flush(); -// out.close(); -// } catch (IOException e) { -// if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { -// Trace.log(Trace.ERROR, CLASS + ".toBinFile() " + "Error closing file " + outfilePath_, e); -// } -// return 1; -// } -// return 0; -// } - - /** - * Opens an ObjectInputStream and IFSFileInputStream on the file specified earlier. Used for displaying previously formatted traces. - * @return An error code if any. - */ - public int openIFSFile() { - return openIFSFile(outfilePath_); - } - - /** - * Opens an ObjectInputStream and IFSFileInputStream on the outfile. Used for displaying previously formatted traces. - * @return An error code if any. - */ - public int openIFSFile(String outfile) { - this.outfilePath_= outfile; - if(outfilePath_==null) { // Outfile wasn't set - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".openIFSFile()" + "Outfile not specified"); - } - return 1; - } - - try { - serin_= new ObjectInputStream(new IFSFileInputStream(sys, outfilePath_)); - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".openIFSFile()" + "Error opening " + outfilePath_,e); - } - return 1; - } catch (AS400SecurityException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".openIFSFile()" + "Security exception opening file " + outfilePath_,e); - } - return 1; - } - return 0; - } - - /** - * Opens an ObjectInputStream and FileInputStream on the file specified on the command line. Used for displaying previously formatted traces. - * @return An error code if any. - */ - public int openLclFile() { - return openLclFile(outfilePath_); - } - - /** - * Opens an ObjectInputStream and FileInputStream on the outfile. Used for displaying previously formatted traces. - * @param outfile The file to read in. - * @return int An error code if any. - */ - public int openLclFile(String outfile) { - this.outfilePath_= outfile; - - if(outfilePath_==null) { // Outfile wasn't set - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".openLclFile() " + "Outfile not specified"); - } - return 1; - } - - try { - serin_= new ObjectInputStream(new FileInputStream(outfilePath_)); - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".openLclFile() " + "Error opening " + outfilePath_, e); - } - return 1; - } - return 0; - } - - /** - * Closes this format object. - * @return An error code if any. - */ - public int close() { - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".close()"); - } - int result = 0; - - try { - if (file_ != null) { - file_.close(); - } - } catch (Throwable e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".close() " + "Error closing " + filename, e); - } - return 1; - } - try { - if (serin_ != null) { - serin_.close(); - } - if (sys != null && createdSys) { - sys.disconnectAllServices(); - } - } catch (Throwable e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".close() " + "Error closing " + outfilePath_, e); - } - return 1; - } - if (progress != null) { // Close the progress Thread - progress.setThread(null); - } - return result; - } - - /** - * Reads a Frame from the input stream. Records are stored as Strings. - * @return String - */ - public String getRecFromFile() { - String utf= null; - try { - utf= serin_.readUTF(); - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".getRecFromFile() " + "Error reading file", e); - } - return null; - } catch (NullPointerException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".getRecFromFile() " + "Error file not opened ", e); - } - return null; - } - return utf; - } - - /** - * Reads in an int from the input stream. - * @return int - */ - public int getIntFromFile() { - int tmp= 0; - try { - tmp= serin_.readInt(); - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".getIntFromFile() " + "Error reading file", e); - } - return -1; - } catch (NullPointerException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".getIntFromFile() " + "Error file not opened", e); - } - return -1; - } - return tmp; - } - - /** - * Formats the prolog.
    - * Sets the length of the first record.
    - * Sets the total number of records.
    - * @return true if this trace contains invalid data. - */ - public boolean formatProlog() { - if(file_==null) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".formatProlog() " + "Input file not opened"); - } - return false; - } - - read(0, 258); // Read in the prolog plus the next record length - BitBuf bb= new BitBuf(data); - nxtRecLen= new BitBuf(bb, 2048, 16); // Store the length of the next record - pro_= new Prolog(bb, filter_); // Create and parse the prolog - ifsrecs= pro_.getNumRecs(); // Store the total number of records - return pro_.invalidData(); - } - - /** - * Retrieves the next record from the given trace.
    - * This method discards all non TCP records. - * @return Frame - */ - public Frame getNextRecord() { - if(pro_==null) { // Not initialized correctly - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".getNextRecord() " + "Prolog not formatted."); - } - return null; - } - - if (!pro_.invalidData()) { - Frame rec= getNext(); - while (rec != null) { - if (!rec.isTCP()) { - rec= getNext(); - } else { - tcprecs++; - return rec; - } - } - return rec; - } else { - return null; - } - } - - /** - * Subroutine which allows us to get the next record - * @return Frame - */ - private Frame getNext() { - BitBuf bb; - int recLen= 0; - if (progress != null) { // Progress is being displayed - progress.updateProgress(numrecs); - } - if (numrecs < ifsrecs) { // While we still have records to process - numrecs++; - if (numrecs == ifsrecs) { - // If this is the last record we don't want to read past the end of the file. - read(0, nxtRecLen.toInt()); - bb= new BitBuf(data); - recLen= (nxtRecLen.toInt() - 2) * 8; - } else { - read(0, nxtRecLen.toInt()); - // Read in the next records plus the length of the following record - bb= new BitBuf(data); - recLen= (nxtRecLen.toInt() * 8) - 16; - nxtRecLen= new BitBuf(bb, recLen, 16); - } - return (new Frame(pro_, bb.slice(0, recLen))); - } else { - return null; - } - } - - /** - * Reads len bytes of the file starting at off offest. - * @param off the offset to start reading at. - * @param len the number of bytes to read. - */ - private void read(int off, int len) { - data= new byte[off + len]; - int bytesRead = 0; - try { - bytesRead = file_.read(data, off, len); // Reads and stores the input in the data array - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".read() " + "Error reading file",e); - } - } - if (bytesRead != len) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".read() " + "Incorrect number of bytes read: Requested " + len + ", got " + bytesRead); - } - } - } - - /** - * Return a String containing the banner. - * @return String containing the banner. - */ - public String addBanner() { - StringBuffer banner = new StringBuffer(); - String record= ResourceBundleLoader_ct.getText("Record"); - String mac= ResourceBundleLoader_ct.getText("MACAddress"); - - banner.append(pro_.getTitle()); - banner.append(pro_.getDate()); - banner.append(record); - banner.append(" "); - banner.append(ResourceBundleLoader_ct.getText("Data")); - banner.append(" "); - banner.append(record); - banner.append(" "); - banner.append(ResourceBundleLoader_ct.getText("Destination")); - banner.append(" "); - banner.append(ResourceBundleLoader_ct.getText("Source")); - banner.append(" "); - banner.append(ResourceBundleLoader_ct.getText("Frame")); - banner.append("\n"); - banner.append(ResourceBundleLoader_ct.getText("Number")); - banner.append(" "); - banner.append(ResourceBundleLoader_ct.getText("S/R")); - banner.append(" "); - banner.append(ResourceBundleLoader_ct.getText("Length")); - banner.append(" "); - banner.append(ResourceBundleLoader_ct.getText("Timer")); - banner.append(" "); - banner.append(mac); - banner.append(" "); - banner.append(mac); - banner.append(" "); - banner.append(ResourceBundleLoader_ct.getText("Format")); - banner.append("\n"); - banner.append("------ --- ------ ------------ -------------- -------------- ------"); - banner.append("\n"); - return banner.toString(); - } - - /** Add the end banner. */ - private String addEndBanner() { - return ( - "\n* * * * * * * * * * * * * " - + ResourceBundleLoader_ct.getText("EOCP") - + " * * * * * * * * * * * * *\n"); - } - - /** - * Returns the number of records that have been formatted. - */ - public int getRecsProcessed() { - return numrecs; - } - - /** - * Returns the prolog of this trace. - * @return Prolog - */ - public Prolog getProlog() { - return pro_; - } - - /** - * Returns the number of tcp records in this trace. - * @return The number of tcp records in this trace. - */ - public int getNumberOfTCPRecords() { - return tcprecs; - } - - /** - * Called by the JVM to Format a file. - * @param args The arguments from the command line. - */ - public static void main(String[] args) { - Format f= new Format(args); - f.toIFSBinFile(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/FormatDisplay.java b/cvsroot/src/com/ibm/as400/util/commtrace/FormatDisplay.java deleted file mode 100644 index 69cdf276a..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/FormatDisplay.java +++ /dev/null @@ -1,863 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FormatDisplay.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Cursor; -import java.awt.FileDialog; -import java.awt.Font; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.KeyEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.BufferedWriter; -import java.io.FileWriter; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Writer; -import java.util.Properties; - -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; -import javax.swing.KeyStroke; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.Trace; -import com.ibm.as400.vaccess.FileFilter; -import com.ibm.as400.vaccess.IFSFileDialog; - -/** - * FormatDisplay is used to format traces. The actual formatting is done by the Format class.
    - * FormatDisplay is also used to display formatted traces from disk.
    - */ -class FormatDisplay extends WindowAdapter implements Runnable { - private final String ALL = "*ALL", - YES = "*YES", - NO = "*NO", - CLASS="FormatDisplay"; - private AS400 sys; // The system we are connected to - private Thread fmtThread=null; // This thread - private Format fmt=null; // The format object. Our interface to the trace - private Find find=null; // The find dialog to search our text area - private String filterIPaddr_, // The filter arguments passed to the class - filterIPaddr2_, - filterPort_, - filterBdcst_; - private String currPage="", // The current page - lastPage="", // The previously viewed page - slastPage="",// The oldest page - path=null, // The path of the file we are displaying - file=null, // The name of the file we are displaying - filename=null, // The path that contains the file to be traced, and the name of the file - outfile=null; // The name of the file to save to - private int nextRecLen = 0,index=0; - /** Run a local display operation */ - public final static int OPEN = 1; - /** Run a remote display operation */ - public final static int OPENRMT = 2; - /** Run a format operation and displays the output */ - public final static int FMT = 3; - - private final static String SAVEEXT = ".bin"; // The extension to append to our formatted trace output - private int ifsrecs=0, // The number of records in this commtrace - recsdisp=0, // The number of records displayed so far - page=0, // The page we are showing. 0 - current, 1 - lastPage, 2 - slastPage - oper; // The operation to be run - // Format Menubar items - private JMenuItem fsave, // File Menu - fclose, - ffind, // Edit Menu - fcopy, - fclear, - fcut, - fpaste; - private JButton next, - prev; - private JComboBox numberList_; - private JLabel msg; - private JTextArea formattrace; - private JFrame l; - - /** - * Creates a FormatDisplay and performs the specified operation. - * @param filterIPaddr The IP address filter. - * @param filterIPaddr2 The IP address filter. - * @param filterPort The port filter. - * @param filterBdcst The broadcast filter. - * @param oper The operation to be performed. - */ - public FormatDisplay(String filterIPaddr, String filterIPaddr2, String filterPort, String filterBdcst,int oper) { - filterIPaddr_ = filterIPaddr; - filterIPaddr2_ = filterIPaddr2; - filterPort_ = filterPort; - filterBdcst_ = filterBdcst; - this.oper = oper; - - FileDialog fd; - if(oper==FMT) { - // Ask the user for the file to format - fd = new FileDialog(CommTrace.getMainFrame(),ResourceBundleLoader_ct.getText("FormatDialog"),FileDialog.LOAD); - fd.show(); // Show the dialog - String path = fd.getDirectory(); - filename = fd.getFile(); - - // If the didn't specify a file return - if(path==null || filename==null) { - return; - } - filename = path + filename; - } else if(oper==OPEN || oper==OPENRMT) { - open(); - } - } - - /** - * Displays a formatted trace. Used to display a file remotely. - */ - public FormatDisplay(String path,String file,AS400 sys,int oper) { - this.oper = oper; - this.sys = sys; - - // The path and file that the user just remotely formatted if available - this.path = path; - this.file = file; - - if(oper==OPENRMT || oper==OPEN) { - open(); - } - } - - /** - * Runs the specified FormatDisplay operation. - */ - public void run() { - // True until we have formatted/displayed the file the user specified - boolean fmt=true; - Thread myThread = Thread.currentThread(); - while(fmtThread==myThread) { - if(fmt) { - if(oper==FMT) { - if(filename==null) { // The user didn't select a file - return; - } - - // Display file dialog so user can specify a place to save the trace - FileDialog fd = new FileDialog(CommTrace.getMainFrame(),ResourceBundleLoader_ct.getText("SaveAs"),FileDialog.SAVE); - fd.setFile(filename + SAVEEXT); - fd.show(); - String outpath = fd.getDirectory(); - String outfilename = fd.getFile(); - - if(outfilename==null) { // User didn't sepecify a file - return; - } - outfile = outpath + outfilename; - // Initalize the format object - FormatProperties prop = new FormatProperties(); - prop.setProgress(FormatProperties.TRUE); - - // Set the filter properties that the user specified - if(!filterIPaddr_.equals(ALL)) { - prop.setIPAddress(filterIPaddr_); - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".run() " + "Filtering on IP address"); - } - } - if(!filterIPaddr2_.equals(ALL)) { - prop.setSecondIPAddress(filterIPaddr2_); - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".run() " + "Filtering on IP address"); - } - } - if(!filterPort_.equals(ALL)) { - prop.setPort(filterPort_); - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".run() " + "Filtering on port number"); - } - } - if(filterBdcst_.equals(NO)) { - prop.setBroadcast(filterBdcst_); - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".run() " + "Filtering broadcast records"); - } - } - - this.fmt = new Format(prop,outfile,filename); // Create the format - long strtime = System.currentTimeMillis(); // Record start time of trace - this.fmt.toLclBinFile(); // Format and output to the file specified - long endtime = System.currentTimeMillis(); // Record end time of trace - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".run() " + "Format Start/End/Total Time:" + strtime + "/" + endtime + "/" + (endtime - strtime)); - } - this.fmt.openLclFile(); // Open the outfile for display - showOutput(); // Display the output - - fmt = false; // We are done with the user operation. - } else if(oper==OPEN || oper==OPENRMT) { - showOutput(); - fmt=false; // We are done with the user operation - } - } else { - try { // Idle until the thread is ended - Thread.sleep(1000); - } catch (InterruptedException e) { - // the VM doesn't want us to sleep anymore, - // so get back to work - } - } - } - this.fmt.close(); // Close the Format before exiting - } - - /** - * Creates a frame and displays the output. - */ - private void showOutput() { - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".showOutput() " + "Showing Output"); - } - - ObjectInputStream ser; - l = new JFrame("Comm Trace"); - formattrace = new JTextArea("",10,80); - JMenuBar formatmb = new JMenuBar(); - JMenu ffile = new JMenu(ResourceBundleLoader_ct.getText("File")); - JMenu fedit = new JMenu(ResourceBundleLoader_ct.getText("Edit")); - JScrollPane p = new JScrollPane(formattrace); - - // Navigation - JPanel north = new JPanel(); - north.setLayout(new GridLayout(0,1)); - JPanel nav = new JPanel(); - GridBagLayout gridbag = new GridBagLayout(); - nav.setLayout(gridbag); - GridBagConstraints c = new GridBagConstraints(); - - c.anchor=GridBagConstraints.EAST; - c.gridwidth=3; - c.gridheight=3; - - // Create the Show Label - JLabel lshow = new JLabel(ResourceBundleLoader_ct.getText("Show")); - gridbag.setConstraints(lshow,c); - nav.add(lshow); - - // Create the TextField which allows the user to enter the number of - // records they want displayed at a time - c.anchor=GridBagConstraints.CENTER; - c.gridwidth=GridBagConstraints.RELATIVE; - String[] numberStrings = { "10", "50", "100", "1000", "10000" }; - - // Create the combo box, select item at index 4. - numberList_ = new JComboBox(numberStrings); - numberList_.setSelectedIndex(2); - gridbag.setConstraints(numberList_,c); - nav.add(numberList_); - - // Create the frames label - c.anchor=GridBagConstraints.CENTER; - c.gridwidth=GridBagConstraints.REMAINDER; - JLabel lframes = new JLabel(ResourceBundleLoader_ct.getText("ShowDescription")); - gridbag.setConstraints(lframes,c); - nav.add(lframes); - - // Create the message description label - c.anchor=GridBagConstraints.WEST; - c.gridwidth=GridBagConstraints.RELATIVE; - c.gridheight=GridBagConstraints.RELATIVE; - JLabel msgdesc = new JLabel(ResourceBundleLoader_ct.getText("DisplayDescription")); - gridbag.setConstraints(msgdesc,c); - nav.add(msgdesc); - - // Create the message label - c.gridwidth=GridBagConstraints.REMAINDER; - msg = new JLabel(ResourceBundleLoader_ct.getText("Prolog")); - gridbag.setConstraints(msg,c); - nav.add(msg); - - // Create the previous button - c.anchor=GridBagConstraints.CENTER; - c.gridwidth=GridBagConstraints.RELATIVE; - c.gridheight=GridBagConstraints.REMAINDER; - prev = new JButton(ResourceBundleLoader_ct.getText("Prev")); - prev.addActionListener(new CommTraceDisplayListener(this)); - gridbag.setConstraints(prev,c); - nav.add(prev); - - // Create the Next button - c.anchor=GridBagConstraints.WEST; - c.gridwidth=GridBagConstraints.REMAINDER; - next = new JButton(ResourceBundleLoader_ct.getText("Next")); - next.addActionListener(new CommTraceDisplayListener(this)); - gridbag.setConstraints(next,c); - nav.add(next); - north.add(nav); - - String record = ResourceBundleLoader_ct.getText("Record"); - String mac = ResourceBundleLoader_ct.getText("MACAddress"); - - StringBuffer Banner1 = new StringBuffer(); - Banner1.append(record); - Banner1.append(" "); - Banner1.append(ResourceBundleLoader_ct.getText("Data")); - Banner1.append(" "); - Banner1.append(record); - Banner1.append(" "); - Banner1.append(ResourceBundleLoader_ct.getText("Destination")); - Banner1.append(" "); - Banner1.append(ResourceBundleLoader_ct.getText("Source")); - Banner1.append(" "); - Banner1.append(ResourceBundleLoader_ct.getText("Frame")); - StringBuffer Banner2 = new StringBuffer(); - Banner2.append(ResourceBundleLoader_ct.getText("Number")); - Banner2.append(" "); - Banner2.append(ResourceBundleLoader_ct.getText("S/R")); - Banner2.append(" "); - Banner2.append(ResourceBundleLoader_ct.getText("Length")); - Banner2.append(" "); - Banner2.append(ResourceBundleLoader_ct.getText("Timer")); - Banner2.append(" "); - Banner2.append(mac); - Banner2.append(" "); - Banner2.append(mac); - Banner2.append(" "); - Banner2.append(ResourceBundleLoader_ct.getText("Format")); - String Banner3 = "------ --- ------ ------------ -------------- -------------- ------"; - - // Banner - JPanel ban = new JPanel(); - ban.setLayout(new GridLayout(3,1)); - JLabel banner = new JLabel(Banner1.toString()), - banner2 = new JLabel(Banner2.toString()), - banner3 = new JLabel(Banner3); - banner.setFont(new Font("Monospaced", Font.PLAIN, 12)); - banner2.setFont(new Font("Monospaced", Font.PLAIN, 12)); - banner3.setFont(new Font("Monospaced", Font.PLAIN, 12)); - ban.add(banner); - ban.add(banner2); - ban.add(banner3); - - // Format Menu Bar - // File Menu - fsave = new JMenuItem(ResourceBundleLoader_ct.getText("Save"),KeyEvent.VK_S); // Create the menu and its key binding - fsave.setAccelerator(KeyStroke.getKeyStroke( // Bind the key binding to the menu item - KeyEvent.VK_S, ActionEvent.CTRL_MASK)); - - // Disable save if they are displaying a previously traced file - if(oper==OPEN || oper==OPENRMT) { - fsave.setEnabled(false); - } - - fclose = new JMenuItem(ResourceBundleLoader_ct.getText("Close"),KeyEvent.VK_W); - fclose.setAccelerator(KeyStroke.getKeyStroke( - KeyEvent.VK_W, ActionEvent.CTRL_MASK)); - - // Edit Menu - ffind = new JMenuItem(ResourceBundleLoader_ct.getText("Find"),KeyEvent.VK_F); - ffind.setAccelerator(KeyStroke.getKeyStroke( - KeyEvent.VK_F, ActionEvent.CTRL_MASK)); - fcopy = new JMenuItem(ResourceBundleLoader_ct.getText("Copy"),KeyEvent.VK_C); - fcopy.setAccelerator(KeyStroke.getKeyStroke( - KeyEvent.VK_C, ActionEvent.CTRL_MASK)); - fclear = new JMenuItem(ResourceBundleLoader_ct.getText("Clear")); - fcut = new JMenuItem(ResourceBundleLoader_ct.getText("Cut"),KeyEvent.VK_X); - fcut.setAccelerator(KeyStroke.getKeyStroke( - KeyEvent.VK_X, ActionEvent.CTRL_MASK)); - fpaste = new JMenuItem(ResourceBundleLoader_ct.getText("Paste"),KeyEvent.VK_V); - fpaste.setAccelerator(KeyStroke.getKeyStroke( - KeyEvent.VK_V, ActionEvent.CTRL_MASK)); - - // Add the menu items and their action listener - ffile.add(fsave); - fsave.addActionListener(new CommTraceDisplayListener(this)); - ffile.add(fclose); - fclose.addActionListener(new CommTraceDisplayListener(this)); - - fedit.add(ffind); - ffind.addActionListener(new CommTraceDisplayListener(this)); - fedit.add(fcopy); - fcopy.addActionListener(new CommTraceDisplayListener(this)); - fedit.add(fclear); - fclear.addActionListener(new CommTraceDisplayListener(this)); - fedit.add(fcut); - fcut.addActionListener(new CommTraceDisplayListener(this)); - fedit.add(fpaste); - fpaste.addActionListener(new CommTraceDisplayListener(this)); - - // Disable cut and past - fcut.setEnabled(false); - fpaste.setEnabled(false); - - formatmb.add(ffile); - formatmb.add(fedit); - l.setJMenuBar(formatmb); - - formattrace.enableInputMethods(true); - // Need a monospaced font otherwise formatting will not look correct - formattrace.setFont(new Font("Monospaced", Font.PLAIN, 12)); - - if(fmt==null) { // If format is null we were never initialized so just return - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.ERROR, CLASS + ".showOutput() " + "initialization failed"); - } - return; - } - - showRecs(1); // Read in and display the prolog - msg.setText("Prolog");// Viewing the prolog - recsdisp=0; - ifsrecs=fmt.getIntFromFile(); // Get the total number of records that this trace contains - - l.getContentPane().add(p,BorderLayout.CENTER); - l.getContentPane().add(north,BorderLayout.SOUTH); - l.getContentPane().add(ban,BorderLayout.NORTH); - l.setBackground(Color.black); - l.setForeground(Color.white); - - l.addWindowListener(this); - l.setSize(800,600); - l.setVisible(true); - } - - /** - * Displays numrecs in the TextArea. - * @param numrecs the number of records to show. - * @return returns false when there are no more records to display. - */ - public boolean showRecs(int numrecs) { - int tcprecs = fmt.getNumberOfTCPRecords(); - - // Display the wait cursor - ((Component) l).setCursor(new Cursor(Cursor.WAIT_CURSOR)); - - if(page==0) { // If we are supposed to view a new page - if(oper==OPEN || oper==OPENRMT) { // We are reading the data in from a stream - int end = recsdisp+numrecs; - if(end>ifsrecs) { - msg.setText(recsdisp + "-" + ifsrecs + " " + ResourceBundleLoader_ct.getText("of") + " " + ifsrecs + " " + ResourceBundleLoader_ct.getText("possible")); - } else { - msg.setText(recsdisp + "-" + (recsdisp+numrecs) + " " + ResourceBundleLoader_ct.getText("of") + " " + ifsrecs + " " + ResourceBundleLoader_ct.getText("possible")); - } - recsdisp = end; - - if(lastPage.equals("")) { - // Save the page we are currently viewing - lastPage = formattrace.getText(); - } else { - slastPage = lastPage; - lastPage = formattrace.getText(); - } - - formattrace.setText(null); // Clear the TextArea - for(int i=0;itcprecs) { - msg.setText(recsdisp + "-" + (tcprecs) + " " + ResourceBundleLoader_ct.getText("of") + " " + tcprecs); - } else { - msg.setText(recsdisp + "-" + (end) + " " + ResourceBundleLoader_ct.getText("of") + " " + tcprecs); - } - recsdisp = end; - if(lastPage.equals("")) { - // Save the page we are currently viewing - lastPage = formattrace.getText(); - } else { - slastPage = lastPage; - lastPage = formattrace.getText(); - } - - formattrace.setText(null); // Clear the TextArea - for(int i=0;iifsrecs) { - msg.setText(recsdisp + "-" + ifsrecs + " " + ResourceBundleLoader_ct.getText("of") + " " + ifsrecs + " " + ResourceBundleLoader_ct.getText("possible")); - } else { - msg.setText(recsdisp-numrecs + "-" + (recsdisp) + " " + ResourceBundleLoader_ct.getText("of") + " " + ifsrecs + " " + ResourceBundleLoader_ct.getText("possible")); - } - if(recsdisp>=ifsrecs) { - // Display the default cursor - ((Component) l).setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - page=0; // User is viewing current page - return false; - } - } else { - // User is attempting to view past the end of the available - // number of records - if(recsdisp>tcprecs) { - msg.setText(recsdisp + "-" + (tcprecs) + " " + ResourceBundleLoader_ct.getText("of") + " " + tcprecs); - } else { - msg.setText(recsdisp-numrecs + "-" + (recsdisp) + " " + ResourceBundleLoader_ct.getText("of") + " " + tcprecs); - } - if(recsdisp>=tcprecs) { - // Display the default cursor - ((Component) l).setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - page=0; // User is viewing current page - return false; - } - } - page=0; // User is viewing current page - } else if(page==2) { // The user wants to view the 2nd to last page - formattrace.setText(lastPage); - msg.setText(ResourceBundleLoader_ct.getText("PreviousPage")); - page=1; // User is viewing 2nd to last page - } - - // Display the default cursor - ((Component) l).setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - - return true; - } - - /** Show the previous page. */ - public void showPrev() { - if(page==0) { - currPage = formattrace.getText(); - formattrace.setText(lastPage); - msg.setText(ResourceBundleLoader_ct.getText("PreviousPage")); - page=1; - } else if(page==1) { - formattrace.setText(slastPage); - msg.setText(ResourceBundleLoader_ct.getText("PreviousPage") + " 2"); - page=2; - } else if(page==2) { - CommTrace.error(l,"Not Found","Only the two previous pages are stored"); - } - } - - /** - * Opens a formatted file for reading.
    - * Can be either a local file or a remote IFS file. - */ - public void open() { - if(oper==OPEN) { - // Display file dialog so user can specify a file to open - FileDialog fd = new FileDialog(CommTrace.getMainFrame(),ResourceBundleLoader_ct.getText("OpenDialog"),FileDialog.LOAD); - fd.show(); - String path = fd.getDirectory(); - String file = fd.getFile(); - - if(path == null || file == null) { // User cancled the FileDialog - return; - } - - fmt = new Format(); - fmt.openLclFile(path + file); - outfile = path + file; - } else if(oper==OPENRMT) { - if(path!="" && file !="") { - fmt = new Format(sys); - fmt.openIFSFile(path+"/" + file + FormatRemote.EXT); - } else { - IFSFileDialog fd = new IFSFileDialog((new JFrame()), ResourceBundleLoader_ct.getText("FiletoView"), sys); - - FileFilter [] filterList = {new FileFilter(ResourceBundleLoader_ct.getText("AllFiles"), "*.*"), - new FileFilter(ResourceBundleLoader_ct.getText("CommTraceFiles"), "*.bin")}; - fd.setFileFilter(filterList, 0); - - fd.setDirectory(path); - fd.setFileName(file); - String fullpath=""; - if (fd.showDialog() == IFSFileDialog.OK) { - fullpath = fd.getAbsolutePath(); // get fully qualified file - fmt = new Format(sys); - fmt.openIFSFile(fullpath); - } - } - } - } - - /** - * Saves the output from the trace to the user specified location as ASCII - * text. - */ - public boolean save() { - // Display file dialog so user can specify a place to save the trace - FileDialog fd = new FileDialog(l,ResourceBundleLoader_ct.getText("SaveAs"),FileDialog.SAVE); - if(filename==null) { - int index; - String file = outfile; - if((index = outfile.indexOf('.'))!=-1) { - file = outfile.substring(0,index); - } - fd.setFile(file + ".txt"); - } else { - fd.setFile(filename + ".txt"); - } - fd.show(); - String path = fd.getDirectory(); - String file = fd.getFile(); - Writer out; - - // Set the cursor to a wait cursor - ((Component)l).setCursor(new Cursor(Cursor.WAIT_CURSOR)); - - try { - out = new BufferedWriter(new FileWriter(path + file)); // Opens an output stream on the local file - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".save() " + "Error opening " + path + file,e); - } - return false; - } - - try { - Format fmtlcl = new Format(); - fmtlcl.openLclFile(outfile); - String prolog = fmtlcl.getRecFromFile(); - out.write(prolog); - int numrecs = fmtlcl.getIntFromFile(); - int recPrinted=0; - String rec; - while((rec = fmtlcl.getRecFromFile())!=null) { - if(recPrinted%5==0) { - out.write(fmt.addBanner()); - } - out.write(rec); - recPrinted++; - } - fmtlcl.close(); - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".save() " + "Error writing to " + path + file,e); - } - return false; - } - - try { - out.close(); - } catch (IOException e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".save() " + "Error closing " + path + file,e); - } - return false; - } - // Set the cursor back to the default cursor - ((Component)l).setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - - return true; - } - - /** Add the end banner. */ - private String addEndBanner() { - return("\n* * * * * * * * * * * * * " + - ResourceBundleLoader_ct.getText("EOCP") + - " * * * * * * * * * * * * *\n"); - } - - - /** - * Closes the output window and ends the thread. - */ - public void close() { - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".close()"); - } - - if(l!=null) { - l.setVisible(false); - } - if(fmt!=null) { - fmt.close(); - } - fmtThread=null; - } - - /** - * Sets the correct window invisible based on the user input. - * Called by the JVM when the user attempts to close our window. - */ - - public void windowClosing(WindowEvent e) { - if (e.getSource() == l) { - close(); - } - } - - /** - * Creates a Find object to search our TextArea. - */ - public void find() { - if(find==null || find.isClosed()) { - find = new Find(formattrace); - } else { - find.toFront(); - } - } - - /** Copies the selected text. */ - public void copy() { - formattrace.copy(); - } - - /** Clears the text area. */ - public void clear() { - formattrace.setText(""); - } - - /** Cuts the selected text. */ - public void cut() { - formattrace.cut(); - } - - /** Pastes the copied text into the text area. */ - public void paste() { - formattrace.paste(); - } - - /** - * Returns the thread this object executes under. - * @return Thread - */ - public Thread getThread() { - return fmtThread; - } - - /** - * Sets the thread to execute under. - * @param Thread - */ - public void setThread(Thread tr) { - fmtThread = tr; - } - - /** - * Returns the JComboBox with which the user selects the number of records to display. - * @return JComboBox - */ - public JComboBox getNumberList() { - return numberList_; - } - - /** - * Returns the Save Menu Item. - * @return JMenuItem - */ - public JMenuItem getSaveMenuItem() { - return fsave; - } - - /** - * Returns the Close Menu Item. - * @return JMenuItem - */ - public JMenuItem getCloseMenuItem() { - return fclose; - } - - /** - * Returns the Find Menu Item. - * @return JMenuItem - */ - public JMenuItem getFindMenuItem() { - return ffind; - } - - /** - * Returns the Copy Menu Item. - * @return JMenuItem - */ - public JMenuItem getCopyMenuItem() { - return fcopy; - } - - /** - * Returns the Clear Menu Item. - * @return JMenuItem - */ - public JMenuItem getClearMenuItem() { - return fclear; - } - - /** - * Returns the Cut Menu Item. - * @return JMenuItem - */ - public JMenuItem getCutMenuItem() { - return fcut; - } - - /** - * Returns the Paste Menu Item. - * @return JMenuItem - */ - public JMenuItem getPasteMenuItem() { - return fpaste; - } - - /** - * Returns the Next Button. - * @return JButton - */ - public JButton getNextButton() { - return next; - } - - /** - * Returns the Previous Button. - * @return JButton - */ - public JButton getPrevButton() { - return prev; - } - - /** - * Returns the main frame for the Display of records. - * @return JFrame - */ - public JFrame getDisplayFrame() { - return l; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/FormatProperties.java b/cvsroot/src/com/ibm/as400/util/commtrace/FormatProperties.java deleted file mode 100644 index 06fa9ad9e..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/FormatProperties.java +++ /dev/null @@ -1,163 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FormatProperties.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * Values to use for setting the Properties object that is sent to the Format class.
    - * Example:
    - *
    - *   FormatProperties prop = new FormatProperties();
    - *	prop.setProgress(FormatProperties.TRUE);
    - *	// Set the filter properties that the user specified
    - *	if(!filterIPaddr.equals("*ALL")) {
    - *		prop.setIPAddress(filterIPaddr);
    - *	}
    - */ -public class FormatProperties { - private Properties prop_; - public static final String TRUE="True"; - public static final String YES="*YES"; - public static final String NO="*NO"; - public static final String FALSE="False"; - - static final String FILTER="Filter"; - static final String IPADDRESS="IPAddress"; - static final String IPADDRESS2="IPAddress2"; - static final String PORT="Port"; - static final String BROADCAST="Broadcast"; - /** Should be a string with the time in milliseconds since the epoc. */ - static final String TIMESTART="TimeStart"; - /** Should be a string with the time in milliseconds since the epoc. */ - static final String TIMEEND="TimeEnd"; - static final String PROGRESS="PROGRESS"; - - public FormatProperties() { - prop_ = new Properties(); - prop_.setProperty(FILTER,TRUE); - } - - /** - * Sets the IPAddress filter to the given IPAddress. - * @param IPAddress The IPAddress to filter on. - */ - public void setIPAddress(String IPAddress) { - prop_.setProperty(IPADDRESS,IPAddress); - } - - /** - * Sets the second IPAddress filter to the given IPAddress. - * @param IPAddress The IPAddress to filter on. - */ - public void setSecondIPAddress(String IPAddress) { - prop_.setProperty(IPADDRESS2,IPAddress); - } - - /** - * Sets the port filter to the given port. - * @param port The port to filter on. - */ - public void setPort(String port) { - prop_.setProperty(PORT,port); - } - - /** - * Sets the broadcast filter. - * @param broadcast FormatProperties.YES or FormatProperties.NO. - */ - public void setBroadcast(String broadcast) { - prop_.setProperty(BROADCAST,broadcast); - } - - /** - * Sets the start time filter in milliseconds since the epoc. - * @param starttime The time to start filtering at. - */ - public void setStartTime(String starttime) { - prop_.setProperty(TIMESTART,starttime); - } - - /** - * Sets the end time filter in milliseconds since the epoc. - * @param endtime The time to end filtering. - */ - public void setEndTime(String endtime) { - prop_.setProperty(TIMEEND,endtime); - } - - /** - * Sets if the progress monitor should be displayed or not. - * @param progress FormatProperties.TRUE or FormatProperties.FALSE. - */ - public void setProgress(String progress) { - prop_.setProperty(PROGRESS,progress); - } - - /** - * Gets the IPAddress filter - * @return The IPAddress to filter on - */ - public String getIPAddress() { - return (String) prop_.getProperty(IPADDRESS); - } - - /** - * Gets the second IPAddress filter. - * @return The second IPAddress to filter on. - */ - public String getSecondIPAddress() { - return (String) prop_.getProperty(IPADDRESS2); - } - - /** - * Gets the Port filter. - * @return The Port to filter on. - */ - public String getPort() { - return (String) prop_.getProperty(PORT); - } - - /** - * Gets the Broadcast filter. - * @return The Broadcast filter. - */ - public String getBroadcast() { - return (String) prop_.getProperty(BROADCAST); - } - - /** - * Gets the start time filter - * @return The start time to filter on - */ - public String getStartTime() { - return (String) prop_.getProperty(TIMESTART); - } - - /** - * Gets the end time filter. - * @return The end time to filter on. - */ - public String getEndTime() { - return (String) prop_.getProperty(TIMEEND); - } - - /** - * Property set if progress should be displayed. - * @return The progress property. - */ - public String getProgress() { - return (String) prop_.getProperty(PROGRESS); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/FormatRemote.java b/cvsroot/src/com/ibm/as400/util/commtrace/FormatRemote.java deleted file mode 100644 index b96966b6e..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/FormatRemote.java +++ /dev/null @@ -1,199 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FormatRemote.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.JavaApplicationCall; -import com.ibm.as400.vaccess.FileFilter; -import com.ibm.as400.vaccess.IFSFileDialog; -import java.awt.Cursor; -import java.awt.Component; -import javax.swing.JFrame; -import javax.swing.JOptionPane; - - -/** - * Used to remotely format a trace residing in an IFS directory. - */ -class FormatRemote implements Runnable { - private String classpath_ = "/QIBM/ProdData/OS400/JT400/lib/JT400Native.jar"; - private Thread fmtThread; - private JavaApplicationCall jaCall; - public static final String EXT = ".bin", CLASS="FormatRemote"; - private AS400 sys; - private String file = null, - path = null, - filterIPaddr_= null, - filterIPaddr2_= null, - filterPort_= null, - filterBdcst_= null; - - private String verbose_; - private CommTrace com_; - - /** - * Constructs a FormatRemote object. - * @param sys The system to connect to. - * @param verbose The verbosity of this format. - * @param filterIPaddr The IP address to filter on. - * @param filterIPaddr2 The second IP address to filter on. - * @param filterPort The port to filter on. - * @param filterBdcst Filter broadcast or not. - * @param com This CommTrace object. - */ - public FormatRemote( - AS400 sys, - String verbose, - String filterIPaddr, - String filterIPaddr2, - String filterPort, - String filterBdcst, - CommTrace com) { - try { - this.sys = sys; - filterIPaddr_=filterIPaddr; - filterIPaddr2_=filterIPaddr2; - filterPort_=filterPort; - filterBdcst_=filterBdcst; - verbose_ = verbose; - com_ = com; - - // Construct a JavaApplicationCall object. - jaCall = new JavaApplicationCall(sys); - - // Set the Java application to be run. - jaCall.setJavaApplication("com.ibm.as400.util.commtrace.Format"); - // Set the classpath environment variable used by the system's - // JVM so it can find the class to run. - jaCall.setClassPath( - classpath_); - - } catch (Exception e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".FormatRemote() " + "Exception in FormatRemote", e); - } - } - } - - /** - * returns the currently running format Thread. - * @return Thread - */ - public Thread getThread() { - return fmtThread; - } - - /** - * Sets the thread. - * @param tr The thread this object is running under. - */ - public void setThread(Thread tr) { - fmtThread = tr; - } - - /** - * Returns the file choosen by the user. - * @return String - */ - public String getFile() { - return file; - } - - /** - * Returns the path choosen by the user. - * @return String - */ - public String getPath() { - return path; - } - - /** - * Runs the FormatClient which queries the user for a file and then. - * sends the filename to the FormatServer and waits for it to return. - */ - public void run() { - Thread myThread = Thread.currentThread(); - while (fmtThread == myThread) { - - IFSFileDialog fd = - new IFSFileDialog((new JFrame()), "Pick file to Format", sys); - - FileFilter[] filterList = { new FileFilter(ResourceBundleLoader_ct.getText("AllFiles"), "*.*")}; - fd.setFileFilter(filterList, 0); - - String fullpath = ""; - try { - if (fd.showDialog() == IFSFileDialog.OK) { - String host = sys.getSystemName(); - fullpath = fd.getAbsolutePath(); // get fully qualified filename - file = fd.getFileName(); - path = fd.getDirectory(); - - String[] args2 = - { "-c", "true", "-v", verbose_, "-t", fullpath, "-o", fullpath + EXT, "-ip", filterIPaddr_, "-ip2", filterIPaddr2_, "-port", filterPort_, "-broadcast", filterBdcst_}; - - jaCall.setParameters(args2); - - // Start the thread that will receive standard output - if (verbose_.equals("true")) { - OutputThread ot = new OutputThread(jaCall); - Thread otThread = new Thread(ot, "OutputThread"); - ot.setThread(otThread); - otThread.start(); - } - - // Start the program. The call to run() will not return - // until the system Java program completes. If the Toolbox - // cannot start the Java program, false is returned with - // a list of AS400Message objects indicating why the program - // could not start. - if(com_!=null) { - ((Component) CommTrace.getMainFrame()).setCursor( - new Cursor(Cursor.WAIT_CURSOR)); - } - if (jaCall.run() != true) { - AS400Message[] messageList = jaCall.getMessageList(); - for (int msg = 0; msg < messageList.length; msg++) - Trace.log(Trace.ERROR,CLASS + ".run() " + (messageList[msg].toString())); - } - if(com_!=null) { - ((Component) CommTrace.getMainFrame()).setCursor( - new Cursor(Cursor.DEFAULT_CURSOR)); - JOptionPane.showMessageDialog( - CommTrace.getMainFrame(), - "Format of " + fullpath + " on " + host + " compeleted", - "Format Complete", - JOptionPane.INFORMATION_MESSAGE); - } - } - } catch (Exception e) { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) { - Trace.log(Trace.ERROR,CLASS + ".run() " + "Exception in FormatRemote", e); - } - } - fmtThread = null; // End this thread - if(com_!=null) { - com_.open(); // Call the open function to open the file we just formatted - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // the VM doesn't want us to sleep anymore, - // so get back to work - } - } - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Formatter.java b/cvsroot/src/com/ibm/as400/util/commtrace/Formatter.java deleted file mode 100644 index bee10b886..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Formatter.java +++ /dev/null @@ -1,157 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Formatter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.lang.String; -import java.lang.StringBuffer; -import java.lang.Integer; -import java.util.StringTokenizer; -import com.ibm.as400.access.Trace; - -/** - * Implements a printf style formatter.
    - * The format specifier is {v,w,j} where v is the element number in the arg list
    - * for the variable to be formatted, w is the field width, and the j values are:
    - * r: Right Justification, allow overflow if l > w
    - * R: Right Justification, do not allow overflow
    - * l: Left Justification, allow overflow if l > w
    - * L: Left Justification, do not allow overflow
    - * - */ -abstract class Formatter { - private static final String CLASS="Formatter"; - /** - * send a justified string with the specifed arguments to Trace.log. - * @param fmt Format of this string. - * @param args arguments to be formatted. - */ - public static void jprintf(String fmt, Object[] args) { - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + "jprintf() " + jsprintf(fmt, args)); - } - } - - /** - * create a justified string with the specifed arguments and a maximum length. - * @param maxlen maximum length of this String - * @param fmt Format of this string. - * @param args arguments to be formatted. - * @return String - */ - public static String jsnprintf(int maxlen, String fmt, Object[] args) { - StringBuffer out= new StringBuffer(maxlen); - StringTokenizer t= new StringTokenizer(fmt, "{}", true); - - int s= 0; - String token; - - try { - while (true) { - token= t.nextToken(); - if (!token.equals("{")) { - out.append(token); - } else { - token= t.nextToken(); - if (token.equals("{")) { - out.append(token); - } else { - StringBuffer varspec= new StringBuffer(20); - while (!token.equals("}")) { - varspec.append(token); - token= t.nextToken(); - } - - // Now var contains a format spec - StringTokenizer vars= new StringTokenizer(varspec.toString(), ", ", false); - int n= Integer.decode(vars.nextToken()).intValue(); - if (vars.hasMoreElements() == false) { - out.append(args[n]); - } else { - int w= Integer.decode(vars.nextToken()).intValue(); - if (w < 0) { - w= -w; - } - String j= vars.nextToken(); - String x= args[n].toString(); - int l= x.length(); - - // r: Right Justification, allow overflow if l > w - // R: Right Justification, do not allow overflow - // l: Left Justification, allow overflow if l > w - // L: Left Justification, do not allow overflow - - if (j.equalsIgnoreCase("r")) { - if (l < w) { - out.append(repeater(" ", w - l)).append(x); - } else if (j.equals("r")) { - out.append(x); - } else { - out.append(x.substring(l - w)); - } - } else if (j.equalsIgnoreCase("l")) { - if (l < w) { - out.append(x).append(repeater(" ", w - l)); - } else if (j.equals("l")) { - out.append(x); - } else { - out.append(x.substring(0, w)); - } - } else { - out.append(args[n]); - } - } - } - } - } - } catch (Throwable e) { - // At some point, getting a token or possibly dereffing args[n] will fail. Just return what was formatted so far. - } - - // Truncate output if a max length was set. - if (maxlen > 0) { - if (out.length() > maxlen) { - out.setLength(maxlen); - } - } - - return out.toString(); - } - - /** - * create a justified string with the specifed arguments. - * @param fmt Format of this string. - * @param args arguments to be formatted. - * @return String - */ - public static String jsprintf(String fmt, Object[] args) { - return jsnprintf(0, fmt, args); - } - - /** - * creates a string consisting of s repeated n times. - * @param string String to repeat. - * @param number number of times to repeat s. - * @return String - */ - public static String repeater(String s, int n) { - if (n <= 0) { - return ""; - } - StringBuffer out= new StringBuffer(s.length() * n); - while (n-- > 0) { - out.append(s); - } - return out.toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/FragmentFlag.java b/cvsroot/src/com/ibm/as400/util/commtrace/FragmentFlag.java deleted file mode 100644 index 95ceeea45..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/FragmentFlag.java +++ /dev/null @@ -1,35 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FragmentFlag.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -/** - * Represents a Fragment Flag. - */ -class FragmentFlag extends Field { - - /** - * Constructs a FragmentFlag. - * @param data The data for this flag. - */ - public FragmentFlag(BitBuf data) { - super(data); - } - - /** - * Returns the data for this flag as a hex string. - */ - public String toString() { - return data.toHexString(); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Fragmentation.java b/cvsroot/src/com/ibm/as400/util/commtrace/Fragmentation.java deleted file mode 100644 index 7a27d38c2..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Fragmentation.java +++ /dev/null @@ -1,30 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Fragmentation.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -/** - * A Fragmentation Header.
    - * Extends ExtHeader's methods to parse, print, and allow easy access to the Fragmentation Header. - */ -public class Fragmentation extends ExtHeader { - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - Fragmentation(BitBuf data) { - super(data); - type= Header.EXTFRAG; - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Frame.java b/cvsroot/src/com/ibm/as400/util/commtrace/Frame.java deleted file mode 100644 index dcfab299a..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Frame.java +++ /dev/null @@ -1,349 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Frame.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.io.*; -import com.ibm.as400.access.Trace; -import java.util.Properties; -import java.util.Date; -import java.text.ParseException; -import java.text.SimpleDateFormat; - -/** - * Encapsulates all the data for one Frame of the trace.
    - * Parses the Frame data and creates a printable representation of this - * Frame.
    - * The data in any packet is mainted in a linked list like structure. The - * format of any Frame will be one of the following:
    - *
      - *
    • arp/rarp
    • - *
    • ip4,tcp
    • - *
    • ip4,udp
    • - *
    • ip4,icmp6
    • - *
    • ip6,tcp
    • - *
    • ip6,udp
    • - *
    • ip6,icmp6
    • - *
    • The next 3 are for tunneled packets
    • - *
    • ip4,ip6,tcp
    • - *
    • ip4,ip6,udp
    • - *
    • ip4,ip6,icmp6
    • - *
    • ip6,eh,tcp
    • - *
    • ip6,eh,udp
    • - *
    • ip6,eh,icmp6
    • - *
    • The next 3 are for tunneled packets
    • - *
    • ip4,ip6,eh,tcp
    • - *
    • ip4,ip6,eh,udp
    • - *
    • ip4,ip6,eh,icmp6
    • - *
    - * eh is the extended header
    - * Note: Every set of headers is followed by the raw data if - * applicable
    - * The classes in the structure are accessible through the - * Frame.getPacket() and Header.getNextHeader() methods. The type is - * accessible through the Header.getType() method - */ -public class Frame { - private final static String BROADCAST= "0xFFFFFFFFFFFF", CLASS="Frame"; - private BitBuf data; - private Prolog pro; - private int frmhdrl, datalen, frmtype, ifshdr= 176; - private IPPacket packet; // The parsed packet of data - private Field IFSRECN, /* Frame number */ - IFSRCTD, /* 64 bit TOD */ - IFSRECTP, /* Frame type */ - IFSPDULN, /* PDU length */ - IFSRECST, /* Frame status */ - IFSSLT, /* SDLC slot */ - IFSPORT, /* SDLC port */ - IFSLLC, /* LAN frame is LLC 'FF'x */ - IFSRTLN, /* LAN routing length */ - IFSTCP; /* Frame is TCP Y/N */ - private Time tod_; // The time of this trace - private boolean tcp= true; // If this Frame isn't TCP this field is set - - private LanHeader lnHdr; // The 22 byte LAN header - - /** - * Creates a Frame which parses the raw data contained in this packet. - * @param pro Prolog to this trace. - * @param data BitBuf with the raw data. - */ - Frame(Prolog pro, BitBuf data) { - this.data= data; - this.pro= pro; - IFSRECN= new Dec(data.slice(0, 16)); - IFSRCTD= new Dec(data.slice(16, 64)); - IFSRECTP= new Char(data.slice(80, 8)); - IFSPDULN= new Dec(data.slice(88, 16)); - IFSRECST= new Dec(data.slice(104, 32)); - IFSSLT= new Dec(data.slice(136, 8)); - IFSPORT= new Dec(data.slice(144, 8)); - IFSLLC= new Hex(data.slice(152, 8)); - IFSRTLN= new Dec(data.slice(160, 8)); - IFSTCP= new Char(data.slice(168, 8)); - - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log( - Trace.INFORMATION, - CLASS + ".Frame() " + "Creating Frame " + IFSRECN.toString() + "... tcp:" + IFSTCP.toString()); - } - - if ((IFSTCP.toString()).equals("Y")) { // If the Frame is TCP parse it - tcp= true; - lnHdr= new LanHeader(data, IFSLLC, pro.getProtocol()); - frmhdrl= lnHdr.getDataStart() + ifshdr; - parseIPdata(new BitBuf(data, frmhdrl, (data.getBitSize() - frmhdrl))); - } else { - tcp= false; - } - } - - /** - * Parses the IP data of this Frame. - * @param hdr BitBuf with this Frame's IP data. - */ - private void parseIPdata(BitBuf hdr) { - frmtype= lnHdr.getFrameType(); - - // Create the correct packet based on the Frame type - if (frmtype == 0x86DD) { - packet= new IP6Packet(hdr.getBytes()); - packet.setType(IPPacket.IP6); - } else if (frmtype == 0x0800) { - packet= new IP4Packet(hdr.getBytes()); - packet.setType(IPPacket.IP4); - } else if (frmtype == 0x0806) { - packet= new ARPPacket(hdr.getBytes(), frmtype); - packet.setType(IPPacket.ARP); - } else if (frmtype == 0x8035) { - packet= new ARPPacket(hdr.getBytes(), frmtype); - packet.setType(IPPacket.RARP); - } else { - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".parseIPData() " + "Unknown IPPacket"); - } - packet= new UnknownPacket(hdr.getBytes()); - packet.setType(IPPacket.UNK); - } - } - - /** - * Returns a printable representation of this Frame. - * @param filter FormatProperties object for filtering this Frame. - * @return Returns a string representation of this Frame. - */ - public String toString(FormatProperties filter) { - StringBuffer ret= new StringBuffer(); // The return string - String time; - if (tcp) { // If its not TCP just return - // Create our Time object with the timestamp - if (tod_ == null) { - tod_= new Time(Long.parseLong((IFSRCTD.toString()))); - } - // Get a printable time - time= tod_.getTime(); - - // If user doesn't want broadcast and the Mac address is broadcast - // then just return - - if (filter!=null) { // If filter is enabled - boolean print= false; - String broadcast= filter.getBroadcast(); - String starttime= filter.getStartTime(); - String endtime= filter.getEndTime(); - long timestamp= tod_.getTimeStamp(); - if (starttime == null - && endtime == null) { - // The filter doesn't apply to the two filters for this Frame we will continue on - print= true; - } else if ( - starttime != null && endtime == null) { // A start time but no end time - // Timestamp is greater then the start time we print the Frame - if (timestamp >= Long.parseLong(starttime)) { - print= true; - } - } else { // Start and end time both specified - // Timestamp is less then the end time but greater then the start time we print the Frame - if (Long.parseLong(endtime) >= timestamp - && timestamp >= Long.parseLong(starttime)) { - print= true; - } - } - if (broadcast == null) { // Filtering doesn't apply to the Broadcast - } else if ( - broadcast.equals(FormatProperties.NO) - && (lnHdr.getMacAddress()).equals( - BROADCAST)) { // If the packet is broadcast don't print it - print= false; - } - if (!print) { // Don't print the packet - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".toString() " + "Frame doesn't pass filters. Not printing"); - } - return ""; - } - } - - Object[] args= - { - IFSRECN, - IFSRECTP, - new Integer(Integer.parseInt(IFSPDULN.toString()) - (lnHdr.getDataStart() / 8)), - // Calculate the data length - time }; - - // Add the Frame data - ret.append( - (Formatter - .jsprintf( - "{0,6,R}" + "{1,5,R}" + "{2,8,R}" + "{3,16,R}" + lnHdr.toString(), - args))); - - if ((pro.getProtocol()).equals("E")) { // Token Ring? - ret.append(lnHdr.printRoutingData()); // Append the Routing data - } - String returnpacket= packet.toString(filter); - - if (returnpacket.equals("")) { - // The packet wasn't printed so return an empty Frame - return ""; - } else { // Append the packet - ret.append(returnpacket); - } - - // If there is data that wasn't traced append the amount to the - // end of the Frame - int notTraced= Integer.parseInt(IFSPDULN.toString()) - data.getByteSize() + 22; - if (notTraced > 0) { - ret.append( - "\t\t\t * * * * * * * * * * * * * * " - + notTraced - + " BYTES OF DATA NOT TRACED " - + "* * * * * * * * * * * * * *\n"); - } - return ret.toString(); - } else { - return ""; - } - } - - /** - * Returns the packet contained by this Frame. - * @return IPPacket this packet. - */ - public IPPacket getPacket() { - return packet; - } - - /** - * Returns the Frame number. - * @return String containing the Frame number. - */ - public String getRecNum() { - return IFSRECN.toString(); - } - - /** - * Returns 64 bit Time of Day. - * @return String containing the TOD. - */ - public String getTOD() { - return IFSRCTD.toString(); - } - - /** - * Return the Time of day in HH:MM:SS.mm format. - * @return String containing the Time. - */ - public String getTime() { - if (tod_ == null) { - tod_= new Time(Long.parseLong((IFSRCTD.toString()))); - } - // Get a printable time - return tod_.getTime(); - } - - /** - * Returns the Frame type. - * @return String containing the Frame type. - */ - public String getRecType() { - return IFSRECTP.toString(); - } - - /** - * Returns the PDU length. - * @return String containing the PDU length. - */ - public String getPDUType() { - return IFSPDULN.toString(); - } - - /** - * Returns the Frame status. - * @return String containing the Frame status. - */ - public String getRecStatus() { - return IFSRECST.toString(); - } - - /** - * Returns the SDLC slot. - * @return String containing the SDLC slot. - */ - public String getSDLCSlot() { - return IFSSLT.toString(); - } - - /** - * Returns the SDLC port. - * @return String containing the SDLC port. - */ - public String getSDLCPort() { - return IFSPORT.toString(); - } - - /** - * Returns the code determining if the LAN fame is LLC.
    - * 0xFF = LLC - * @return String containing the code, - */ - public String getLLC() { - return IFSLLC.toString(); - } - - /** - * Returns the LAN routing length, - * @return String containing the LAN routing length, - */ - public String getRoutingLength() { - return IFSRTLN.toString(); - } - - /** - * Returns if the Frame is TCP Y/N. - * @return String containing Y or N. - */ - public String getTCP() { - return IFSTCP.toString(); - } - - /** - * Returns a boolean indicating if the Frame is TCP - * @return true if Frame is TCP. - */ - public boolean isTCP() { - return tcp; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Header.java b/cvsroot/src/com/ibm/as400/util/commtrace/Header.java deleted file mode 100644 index bfdd4daf6..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Header.java +++ /dev/null @@ -1,270 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Header.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.io.StringWriter; -import java.util.Properties; - -/** - * Parent header class.
    - * Contains both the raw header and the raw payload.
    - * Maintains a pointer to the next header.
    - */ -public abstract class Header { - BitBuf rawheader; - BitBuf rawpayload; - Header next; - int type; - - /** An ICMPv6 Header */ - public static final int ICMP6 = 0x3a; - /** An IPv6 Header */ - public static final int IP6 = 0x29; - /** An ICMPv4 Header */ - public static final int ICMP4 = 0x01; - /** An IPv4 Header */ - public static final int IP4 = 0x17; - /** A TCP Header */ - public static final int TCP = 0x06; - /** An UDP Header */ - public static final int UDP = 0x11; - /** An Extended Hop By Hop Header */ - public static final int EXTHOPBYHOP = 0x00; - /** An Extended Routing Header */ - public static final int EXTROUTE = 0x2b; - /** An Extended Fragment Header */ - public static final int EXTFRAG = 0x2c; - /** An Extended ESP Header */ - public static final int EXTESP = 0x32; - /** An Extended AH Header */ - public static final int EXTAH = 0x33; - /** An Extended Destination Header */ - public static final int EXTDEST = 0x3c; - /** An Unknown Header */ - public static final int UNK = 0xFF; - - /** - * Base constructor which slices the data into header and payload.
    - * Creates the next header in this packet. - * @param data BitBuf which represents the raw data of this packet. - */ - Header(BitBuf data) { - rawheader = data; - rawheader = data.slice(0, getHeaderLen()); - rawpayload = data.slice(getHeaderLen()); - - next = getNextHeader(); - } - - /** - * Creates the correct header based on the input byte. - * @param p the protocol of this header. - * @param data the raw data of this header. - * @return The Header - */ - static Header createHeader(byte p, BitBuf data) { - int protocol = p & 0xFF; - - if(data.getBitSize() == 0) - return null; - if (protocol == 0x3a) - return new ICMP6Header(data); - if (protocol == 0x29) - return new IP6Header(data); - if (protocol == 0x01) - return new ICMP4Header(data); - if (protocol == 0x17) - return new IP4Header(data); - if (protocol == 0x06) - return new TCPHeader(data); - if (protocol == 0x11) - return new UDPHeader(data); - // The following are Extension Headers - if (protocol == 0x00) - return new HopByHop(data); - if (protocol == 0x2b) - return new Routing(data); - if (protocol == 0x2c) - return new Fragmentation(data); - if (protocol == 0x32) - return new ESP(data); - if (protocol == 0x33) - return new AH(data); - if (protocol == 0x3b) - return null; - if (protocol == 0x3c) - return new Destination(data); - return new UnknownHeader(data); - } - - /** - * Dumps the raw fields from this header. - * return String representing the raw fields of this header. - */ - String fielddump() { - StringWriter out = new StringWriter(); - java.lang.reflect.Field[] fieldlist = getClass().getFields(); - - out.write("Fields from " + getName() + ":\n"); - int i; - for (i = 0; i < fieldlist.length; i++) { - // Print the field if it is a Field subtype. - if (Field.class.isAssignableFrom(fieldlist[i].getType())) { - try { - out.write( - "\t" + fieldlist[i].getName() + ": " + fieldlist[i].get(this) + "\n"); - } catch (Throwable x) { - out.write("\n\nfielddump: Caught exception: " + x.toString() + "\n"); - } - } - } - - return out.toString(); - } - - /** - * Returns the data of this header. - * @return byte[] containing the raw data. - */ - public byte[] getHeaderData() { - return rawheader.getBytes(); - } - - /** - * Returns the length of this header. - * @return Will always return 0. - */ - public int getHeaderLen() { - return 0; - } - - /** - * The name of this header. - * @return The Name - */ - public String getName() { - return this.getClass().getName().substring(this.getClass().getName().lastIndexOf('.')+1); - } - - /** - * Returns the next header in this packet. - * @return Will always return null. - */ - public Header getNextHeader() { - return null; - } - - /** - * Returns a description of the header along with this header as a hexadecimal string. - * @return String containing this header as a hexadecimal string. - */ - public String printHexHeader() { - String name = getName(); - int i; - if((i = name.indexOf("$"))!=-1) { - name = name.substring(i+1); - name += " Header"; - } - Object[] args = {name,rawheader.toHexString(32,"\n\t\t\t ")}; - - return Formatter.jsprintf("\t {0} : {1}\n",args); - } - - /** - * Returns this header's raw payload. - * @return byte[] containing this header's raw payload. - */ - public byte[] getPayLoad() { - return rawpayload.getBytes(); - } - - /** - * Returns the next header as a string. - * @return String the next header. - */ - String printnext() { - if(next == null) - return ""; - return next.toString(); - } - - /** - * Returns the next header as a string. - * @param filter FormatProperties object for filtering of this header. - * @return String the next header. - */ - String printnext(FormatProperties filter) { - if(next == null) - return ""; - return next.toString(filter); - } - - /** - * Returns a printable representation of this header.
    - * Without any specific formatting for the particular type of Header. - * @return String this header. - */ - public String toString() { - return fielddump() + printnext(); - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - return fielddump() + printnext(filter); - } - - /** - * Returns this header as a hexadecimal string. - * @return A hexadecimal representation of this header. - */ - public String toHexString() { - return rawheader.toHexString(); - } - - /** - * Returns this header's payload as a hexadecimal string. - * @return String a hexadecimal representation of this header's payload. - */ - public String getPayloadHexString() { - return rawpayload.toHexString(); - } - - /** - * Returns this header's payload as a byte array. - * @return byte[] containing this header's raw payload. - */ - public byte[] getPayloadBytes() { - return rawpayload.getBytes(); - } - - /** - * Returns this header's payload as an ascii and hexadecimal string. - * @return An ascii and hexadecimal representation of this header's payload. - */ - public String getPayload() { - return (new Data(rawpayload)).toString(); - } - - /** - * Returns this header's type. - * @return This header's type. - */ - public int getType() { - return type; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Hex.java b/cvsroot/src/com/ibm/as400/util/commtrace/Hex.java deleted file mode 100644 index 967caa62f..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Hex.java +++ /dev/null @@ -1,36 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Hex.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -/** - * Represents a hexadecimal field. - */ -class Hex extends Field { - /** - * Base constructor which creates a default hex field. - * @param b BitBuf which represents this hex field. - */ - public Hex(BitBuf b) { - super(b); - } - - /** - * creates a String representation of this hexadecimal field. - * - * @return String representing this flag. - */ - public String toString() { - return "0x" + data.toHexStringJustified(0, ""); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/HopByHop.java b/cvsroot/src/com/ibm/as400/util/commtrace/HopByHop.java deleted file mode 100644 index debe05c43..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/HopByHop.java +++ /dev/null @@ -1,38 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HopByHop.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -/** - * A HopByHop Header.
    - * Extends ExtHeader's methods to parse, print, and allow easy access to the HopByHop Header. - */ -public class HopByHop extends ExtHeader { - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - HopByHop(BitBuf data) { - super(data); - type= Header.EXTHOPBYHOP; - } - - /** - * Returns the length of this header. - * @return The length of this header. - */ - public int getHeaderLen() { - return 64 + ((rawheader.getOctet(8) & 0xFF) * 64); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/ICMP4Header.java b/cvsroot/src/com/ibm/as400/util/commtrace/ICMP4Header.java deleted file mode 100644 index 67416fc53..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/ICMP4Header.java +++ /dev/null @@ -1,164 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ICMP4Header.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; -import com.ibm.as400.access.Trace; - -/** - * A Internet Control Message Protocol V4 Header.
    - * Extends Header's methods to parse, print, and allow easy access to the ICMPv4 Header. - */ -public class ICMP4Header extends Header { - Field typefield= new Dec(rawheader.slice(0, 8)); - Field code= new Hex(rawheader.slice(8, 8)); - Field checksum= new Hex(rawheader.slice(16, 16)); - - private static final String CLASS="ICMP4Header"; - private static final String ECHRPLY= "Echo Reply"; - private static final String DSTURCH= "Destination Unreachable"; - private static final String SRCQCH= "Source Quench"; - private static final String RDR= "Redirect (Change a Route)"; - private static final String ECHREQ= "Echo Request"; - private static final String TIMEEXC= "Time Exceeded for a Datagram"; - private static final String PARAMPROB= "Parameter Problem on a Datagram"; - private static final String TSTMPREQ= "Timestamp Request"; - private static final String TSTMPRPLY= "Timestamp Reply"; - private static final String INFOREQ= "Information Request (Obsolete)"; - private static final String INFORPLY= "Information Reply (Obsolete)"; - private static final String ADDRREQ= "Address Mask Request"; - private static final String ADDRRPLY= "Address Mask Reply"; - private static final String ICMP= "ICMPv4 Header"; - private static final String TYPE= "Type"; - private static final String CODE= "Code"; - private static final String CHKSUM= "Checksum"; - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - ICMP4Header(BitBuf data) { - super(data); - type= ICMP4; - } - - /** - * Returns the length of this header. - * @return Will always return 32. - */ - public int getHeaderLen() { - return 32; - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - String types= ""; - int type= Integer.parseInt(this.typefield.toString()); - // The ICMP message number - // Make sure we have enough data to parse a full header - if (rawheader.getBitSize() < getHeaderLen()) { - return (new Data(rawheader)).toString(); - } - - // Check for IP filtering - if (filter!=null) { // If filter is enabled - boolean print= false; - String port = filter.getPort(); - - if(port==null) { // A port isn't specified, print the header - print=true; - } - if (!print) { // Don't print the packet - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".toString() " + "Frame doesn't pass IP filter"); - } - return ""; // Return empty record because it didn't pass the filter - } - } - - // Convert ICMP message from a number into a readable message - if (type == 0) { - types= ECHRPLY; - } else if (type == 3) { - types= DSTURCH; - } else if (type == 4) { - types= SRCQCH; - } else if (type == 5) { - types= RDR; - } else if (type == 8) { - types= ECHREQ; - } else if (type == 11) { - types= TIMEEXC; - } else if (type == 12) { - types= PARAMPROB; - } else if (type == 13) { - types= TSTMPREQ; - } else if (type == 14) { - types= TSTMPRPLY; - } else if (type == 15) { - types= INFOREQ; - } else if (type == 16) { - types= INFORPLY; - } else if (type == 17) { - types= ADDRREQ; - } else if (type == 18) { - types= ADDRRPLY; - } - - Object[] args= { types, code, checksum }; - - return Formatter.jsprintf( - "\t " - + ICMP - + " : " - + TYPE - + ": {0} " - + CODE - + ": {1} " - + CHKSUM - + ": {2}\n", - args) - + printHexHeader() - + printnext(filter) - + (new Data(rawpayload)).toString(); - } - - /** - * Returns the type of this ICMPv4 Header from the trace. - * @return String containing a decimal representation of the type of this header. - */ - public String getTypeField() { - return typefield.toString(); - } - - /** - * Returns the code of this ICMPv4 Header. - * @return String containing a decimal representation of the code for this header. - */ - public String getCode() { - return (new Dec(code.getData())).toString(); - } - - /** - * Returns the checksum of this ICMPv4 Header. - * @return String containing a decimal representation of the checksum for this header. - */ - public String getChecksum() { - return (new Dec(checksum.getData())).toString(); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/ICMP6Header.java b/cvsroot/src/com/ibm/as400/util/commtrace/ICMP6Header.java deleted file mode 100644 index 05f6c8e34..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/ICMP6Header.java +++ /dev/null @@ -1,140 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ICMP6Header.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; -import com.ibm.as400.access.Trace; - -/** - * A Internet Control Message Protocol v6 Header.
    - * Extends Header's methods to parse, print, and allow easy access to the ICMPv6 Header. - */ -public class ICMP6Header extends Header { - Field typeh= new Hex(rawheader.slice(0, 8)); - Field code= new Hex(rawheader.slice(8, 8)); - Field checksum= new Hex(rawheader.slice(16, 16)); - - private static final String CLASS="ICMP6Header"; - private static final String ICMPV6= "ICMPv6"; - private static final String DATA= "Data"; - private static final String TYPE= "Type"; - private static final String CODE= "Code"; - private static final String CHKSUM= "Checksum"; - private static final String MSG= "Message"; - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - ICMP6Header(BitBuf data) { - super(data); - super.type= ICMP6; - } - - /** - * Returns the length of this header. - * @return Will always return 32. - */ - public int getHeaderLen() { - return 32; - } - - /** - * Returns the next header in the packet. - * @return Will always return a Message Header. - */ - public Header getNextHeader() { - return Message.createMessage(rawheader.slice(0, 8).toByte(), rawpayload); - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - // Make sure we have enough data to parse a full header - if (rawheader.getBitSize() < getHeaderLen()) { - return (new Data(rawheader)).toString(); - } - - // Check for IP filtering - if (filter!=null) { // If filter is enabled - boolean print= false; - String port = filter.getPort(); - - if(port==null) { // A port isn't specified, print the header - print=true; - } - if (!print) { // Don't print the packet - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".toString() " + "Frame doesn't pass IP filter"); - } - return ""; // Return empty record because it didn't pass the filter - } - } - - Object[] args= - { - typeh, - code, - checksum, - next.getName().substring(next.getName().lastIndexOf('$') + 1)}; - - return Formatter.jsprintf( - "\t " - + ICMPV6 - + " " - + DATA - + " . : " - + TYPE - + ": {0} " - + CODE - + ": {1} " - + CHKSUM - + " : {2}\n" - + printHexHeader() - + "\t " - + ICMPV6 - + " {3} " - + MSG - + " : ", - args) - + printnext(filter); - } - - /** - * Returns the type of this ICMPv6 Header from the trace. - * @return String containing a decimal representation of the type of this header. - */ - public String getTypeField() { - return (new Dec(typeh.getData())).toString(); - } - - /** - * Returns the code of this ICMPv6 Header. - * @return String containing a decimal representation of the code for this header. - */ - public String getCode() { - return (new Dec(code.getData())).toString(); - } - - /** - * Returns the checksum of this ICMPv6 Header. - * @return String containing a decimal representation of the checksum for this header. - */ - public String getChecksum() { - return (new Dec(checksum.getData())).toString(); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/IP4Address.java b/cvsroot/src/com/ibm/as400/util/commtrace/IP4Address.java deleted file mode 100644 index d9af5a30c..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/IP4Address.java +++ /dev/null @@ -1,36 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IP4Address.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -/** - * Represents an IPv4 Address. - */ -class IP4Address extends Field { - /** - * Base constructor which creates an IPv4 Address. - * @param data BitBuf which represents this raw IP address. - */ - public IP4Address(BitBuf data) { - super(new BitBuf(data, 0, 32)); - } - /** - * creates a String representation of this IP Address. - * in presentation format with .'s as delimeters. - * @return String representing this IPv4 Address. - */ - public String toString() { - String IP4Addr= data.toHexString(1, "."); - return (new IPAddressConversion(IP4Addr, IPAddressConversion.IPv4Hex)).ntop(); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/IP4Header.java b/cvsroot/src/com/ibm/as400/util/commtrace/IP4Header.java deleted file mode 100644 index 84e469d9e..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/IP4Header.java +++ /dev/null @@ -1,399 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IP4Header.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.AS400SecurityException; -import java.util.Properties; - -/** - * A Internet Protocol v4 Header.
    - * Extends Header's methods to parse, print, and allow easy access to the ICMPv4 Header. - */ -public class IP4Header extends Header { - - private static final String CLASS="IP4Header"; - - // Fields defined in RFC 760 - Field version= new Dec(rawheader.slice(0, 4)); - Field internetheaderl= new Dec(rawheader.slice(4, 4)); - Field typeofservice= new Hex(rawheader.slice(8, 8)); - Field dscp= new Dec(rawheader.slice(8, 6)); - Field ecn= new Dec(rawheader.slice(14, 2)); // RFC 3168 - Field totallength= new Dec(rawheader.slice(16, 16)); - Field identification= new Hex(rawheader.slice(32, 16)); - Field flag= new FragmentFlag(rawheader.slice(48, 2)); - Field flag2= new FragmentFlag(rawheader.slice(50, 4)); - Field fragmentoffset= new Dec(rawheader.slice(52, 12)); - Field timetolive= new Dec(rawheader.slice(64, 8)); - Field protocol= new Dec(rawheader.slice(72, 8)); - Field headerchecksum= new Dec(rawheader.slice(80, 16)); - Field src= new IP4Address(rawheader.slice(96, 32)); - Field dst= new IP4Address(rawheader.slice(128, 32)); - Field options= - new Hex( - rawheader.slice( - 160, - ((Integer.parseInt(internetheaderl.toString()) * 8) - 40))); - - // Fields from the RFC - private final static String RES= "RESERVED"; - private final static String ICMP= "ICMP"; - private final static String IGMP= "IGMP"; - private final static String TCP= "TCP"; - private final static String UDP= "UDP"; - private final static String IPV6= "IPv6"; - private final static String UNK= "Unknown"; - private final static String MAY= "MAY"; - private final static String DONT= "DON'T"; - private final static String LAST= ",LAST"; - private final static String MORE= ",MORE"; - private final static String NONE= "NONE"; - private final static String NECT= "00 - NECT"; - private final static String ECT1= "01 - ECT1"; - private final static String ECT0= "10 - ECT0"; - private final static String CE= "11 - CE"; - private final static String FRM= "Frame Type"; - private final static String IP= "IP"; - private final static String DSCP= "DSCP"; - private final static String ECN= "ECN"; - private final static String LEN= "Length"; - private final static String PROT= "Protocol"; - private final static String DGID= "DataGram ID"; - private final static String SRC= "Src Addr"; - private final static String DST= "Dest Addr"; - private final static String FRAGFLAG= "Fragment Flags"; - private final static String IPOPT= "IP Options"; - - /** - * Base constructor which creates a IPv4 Header. - * @param data BitBuf which represents this header's raw data. - * @see Header - */ - IP4Header(BitBuf data) { - super(data); - - type= IP4; - } - - public int getHeaderLen() { - if (internetheaderl == null) { - internetheaderl= new Dec(rawheader.slice(4, 4)); - } - return Integer.parseInt(internetheaderl.toString()) * 32; - } - - public Header getNextHeader() { - return Header.createHeader(rawheader.slice(72, 8).toByte(), rawpayload); - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - String protocols= protocol.toString(), flag= ""; - - // Make sure we have enough data to parse a full header - if (rawheader.getBitSize() < getHeaderLen()) { - return (new Data(rawheader)).toString(); - } - - // Check for IP filtering - if (filter!=null) { // If filter is enabled - boolean print= false; - String IPaddr= filter.getIPAddress(), - IPaddr2= filter.getSecondIPAddress(); - - if (IPaddr == null && IPaddr2 == null) { - print= true; // The filtering doesn't apply to this part of the header - } else if(IPaddr==null) { - // If either address matches we print this record - if (src.toString().equals(IPaddr2) || dst.toString().equals(IPaddr2)) { - print= true; - } - } else if (IPaddr.indexOf(':') != -1 || IPaddr.indexOf(':') != -1) { - print= true; // IPv6 Address so don't bother to try and filter ia - // If only one address is specified. - } else if (IPaddr2 == null) { - // If either address matches we print this record - if (src.toString().equals(IPaddr) || dst.toString().equals(IPaddr)) { - print= true; - } - // Both addresses were specified - // The packet must match both addresses in any order before its - // printed - } else if ( - (src.toString().equals(IPaddr) || src.toString().equals(IPaddr2)) - && (dst.toString().equals(IPaddr) || dst.toString().equals(IPaddr2))) { - print= true; - } - if (!print) { // Don't print the packet - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".toString() " + "Frame doesn't pass IP filter"); - } - return ""; // Return empty record because it didn't pass the filter - } - } - - char[] flagss= (this.flag.toString()).toCharArray(); - char[] flagss2= (this.flag2.toString()).toCharArray(); - - // Convert protocol from number into readable text - if (protocols.equals("0")) { - protocols= RES; - } else if (protocols.equals("1")) { - protocols= ICMP; - } else if (protocols.equals("2")) { - protocols= IGMP; - } else if (protocols.equals("6")) { - protocols= TCP; - } else if (protocols.equals("17")) { - protocols= UDP; - } else if (protocols.equals("41")) { - protocols= IPV6; - } else if (protocols.equals("01")) { - protocols= ICMP; - } else if (protocols.equals("255")) { - protocols= RES; - } else { - protocols= UNK; - } - - // Flags as defined in RFC 760 - switch (flagss.length) { - case 1 : - if (flagss[0] == '0') { - flag= MAY; - } else { - flag= DONT; - } - break; - case 2 : - if (flagss[0] == '0' && flagss[1] == '0') { - flag= MAY; - } else { - flag= DONT; - } - break; - default : - break; - } - switch (flagss2.length) { - case 1 : - if (flagss2[0] == '0') { - flag += LAST; - } else { - flag += MORE; - } - break; - case 2 : - if (flagss2[0] == '0' && flagss2[1] == '0') { - flag += LAST; - } else { - flag += MORE; - } - break; - default : - break; - } - - Object[] args= - { totallength, identification, flag, protocols, src, dst, options, dscp, ecn }; - - if ((options.toString()).equals("0x")) { - args[6]= NONE; - } - - if (Integer.parseInt(dscp.toString()) == 0x00) { - args[7]= "0"; - } - - switch (Integer.parseInt(ecn.toString())) { - case 0 : - args[8]= NECT; - break; - case 1 : - args[8]= ECT1; - break; - case 2 : - args[8]= ECT0; - break; - case 3 : - args[8]= CE; - break; - } - - String next= printnext(filter); - if (next == "") { // The header didn't pass the filter - return ""; - } else { - return Formatter.jsprintf( - "\t " - + FRM - + " : " - + IP - + " " - + "\t\t" - + DSCP - + ": {7,2,L} " - + ECN - + ": {8,10,L} " - + LEN - + ": {0,4,L} Protocol: {3,10,L} DataGram ID: {1,6,L}\n" - + "\t\t\t " - + SRC - + ": {4,15,L} " - + DST - + ": {5,15,L} " - + FRAGFLAG - + ": {2,10,L}\n" - + "\t " - + IPOPT - + " : {6,80,L}\n", - args) - + printHexHeader() - + next; - } - } - - /** - * Returns the version of this IPv4 Header. - * @return String containing a decimal representation of the version for this header. - */ - public String getVersion() { - return version.toString(); - } - - /** - * Returns the Internet Header length of this IPv4 Header. - * @return String containing a decimal representation of the header length. - */ - public String getInternetHeaderLength() { - return internetheaderl.toString(); - } - - /** - * Returns the type of service of this IPv4 Header. - * @return String containing a decimal representation of the type of service for this header. - */ - public String getTypeOfService() { - return typeofservice.toString(); - } - - /** - * Returns the dscp of this IPv4 Header. - * @return String containing a decimal representation of the dscp for this header. - */ - public String getDscp() { - return dscp.toString(); - } - - /** - * Returns the ecn of this IPv4 Header. - * @return String containing a decimal representation of the ecn for this header. - */ - public String getEcn() { - return ecn.toString(); - } - - /** - * Returns the total length of this IPv4 Header. - * @return String containing a decimal representation of the total length for this header. - */ - public String getTotalLength() { - return totallength.toString(); - } - - /** - * Returns the indentification of this IPv4 Header. - * @return String containing a decimal representation of the identification for this header. - */ - public String getIdentification() { - return identification.toString(); - } - - /** - * Returns the first flag of this IPv4 Header. - * @return String containing a decimal representation of the flag. - */ - public String getFlag() { - return flag.toString(); - } - - /** - * Returns the second flag of this IPv4 Header. - * @return String containing a decimal representation of the flag. - */ - public String getFlag2() { - return flag2.toString(); - } - - /** - * Returns the fragment offset of this IPv4 Header. - * @return String containing a decimal representation of the fragment offest for this header. - */ - public String getFragmentOffset() { - return fragmentoffset.toString(); - } - - /** - * Returns the time to live of this IPv4 Header. - * @return String containing a decimal representation of the time to live for this header. - */ - public String getTimeToLive() { - return timetolive.toString(); - } - - /** - * Returns the protocol of this IPv4 Header. - * @return String containing a decimal representation of the protocol for this header. - */ - public String getProtocol() { - return protocol.toString(); - } - - /** - * Returns the header check sum. - * @return String containing a decimal representation of the header check sum. - */ - public String getHeaderChecksum() { - return headerchecksum.toString(); - } - - /** - * Returns the source IP address of this IPv4 Header. - * @return String containing a delimited decimal representation of the source IP address. - */ - public String getSrcAddr() { - return src.toString(); - } - - /** - * Returns the destination IP address of this IPv4 Header. - * @return String containing a delimited decimal representation of the destination IP address. - */ - public String getDstAddr() { - return dst.toString(); - } - - /** - * Returns the option of this IPv4 header. - * @return String containing a decimal representation of the options. - */ - public String getOptions() { - return (new Dec(options.getData())).toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/IP4Packet.java b/cvsroot/src/com/ibm/as400/util/commtrace/IP4Packet.java deleted file mode 100644 index c18b80c21..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/IP4Packet.java +++ /dev/null @@ -1,41 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IP4Packet.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * A Internet Protocolv4 IPPacket.
    - * Extends Packets' methods to parse, print, and allow easy access to the IPv4 IPPacket
    - * It has one constructor which takes a byte array of packet data as its only argument. - */ -public class IP4Packet extends IPPacket { - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - public IP4Packet(byte[] data) { - rawpacket= data; - header= new IP4Header(new BitBuf(rawpacket)); - } - - /** - * Returns a printable representation of this packet. - * @param filter FormatProperties object for filtering this packet. - * @return Returns a string representation of this packet. - */ - public String toString(FormatProperties filter) { - return header.toString(filter); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/IP6Address.java b/cvsroot/src/com/ibm/as400/util/commtrace/IP6Address.java deleted file mode 100644 index a3ed96b9c..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/IP6Address.java +++ /dev/null @@ -1,37 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IP6Address.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -/** - * Represents an IPv6 Address. - */ -class IP6Address extends Field { - /** - * Base constructor which creates a IPv6 Address. - * @param data BitBuf which contains this raw IP address. - */ - public IP6Address(BitBuf data) { - super(new BitBuf(data, 0, 128)); - } - - /** - * Creates a String representation of this IPv6 Address. - * in presentation format with :'s as delimeters. - * @return String representing this IPv6 Address. - */ - public String toString() { - String IP6Addr= data.toHexString(2, ":"); - return (new IPAddressConversion(IP6Addr, IPAddressConversion.IPv6)).ntop(); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/IP6Header.java b/cvsroot/src/com/ibm/as400/util/commtrace/IP6Header.java deleted file mode 100644 index 4035b5baf..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/IP6Header.java +++ /dev/null @@ -1,256 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IP6Header.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import com.ibm.as400.access.Trace; -import java.util.Properties; - -/** - * An IPv6 Header.
    - * Extends Header's methods to parse, print, and allow easy access to the IPv6 Header. - */ -public class IP6Header extends Header { - - Field version= new Dec(rawheader.slice(0, 4)); - Field trafficclass= new Hex(rawheader.slice(4, 8)); - Field flowlabel= new Hex(rawheader.slice(12, 20)); - Field payloadlength= new Dec(rawheader.slice(32, 16)); - Field nextheaderh= new Hex(rawheader.slice(48, 8)); - Field nextheader= new Dec(rawheader.slice(48, 8)); - Field hoplimit= new Dec(rawheader.slice(56, 8)); - Field src= new IP6Address(rawheader.slice(64, 128)); - Field dst= new IP6Address(rawheader.slice(192, 128)); - - private final static String CLASS="IP6Header"; - private final static String ICMPV6= "ICMPv6"; - private final static String TCP= "TCP"; - private final static String UDP= "UDP"; - private final static String EXTHOPHOP= "ExtHeader Hop by Hop"; - private final static String EXTROUTE= "ExtHeader Routing"; - private final static String EXTFRAG= "ExtHeader Fragmentation"; - private final static String EXTESP= "ExtHeader ESP"; - private final static String EXTAH= "ExtHeader AH"; - private final static String EXTDST= "ExtHeader Destination"; - private final static String IPV6DATA= "IPv6 Data"; - private final static String VER= "Ver"; - private final static String TRAFFICCLASS= "TrafficClass"; - private final static String FLWLBL= "FlowLabel"; - private final static String PAYLOADLENGTH= "PayloadLength"; - private final static String NXTHDR= "NextHeader"; - private final static String HOPLIMIT= "HopLimit"; - private final static String SRC= "Src"; - private final static String DST= "Dst"; - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - IP6Header(BitBuf data) { - super(data); - type= IP6; - } - - /** - * Returns the length of this header. - * @return Will always return 320. - */ - public int getHeaderLen() { - return 320; - } - - public Header getNextHeader() { - return Header.createHeader(rawheader.slice(48, 8).toByte(), rawpayload); - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - String nextheaders= ""; - // Make sure we have enough data to parse a full header - if (rawheader.getBitSize() < getHeaderLen()) { - return (new Data(rawheader)).toString(); - } - int protocol= Integer.parseInt(nextheader.toString()); - - // Check for IP filtering - if (filter!=null) { // If filter is enabled - boolean print= false; - String IPaddr= filter.getIPAddress(), - IPaddr2= filter.getSecondIPAddress(); - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".toString() " + "Filter Properties:" + IPaddr + " " + IPaddr2); - } - if (IPaddr == null && IPaddr2 == null) { - print= true; // The filtering doesn't apply to this header - // If only one address is specified. - } else if(IPaddr==null) { - // If either address matches we print this record - if (src.toString().equals(IPaddr2) || dst.toString().equals(IPaddr2)) { - print= true; - } - } else if (IPaddr2 == null) { - // If either address matches we print this record - if (src.toString().equals(IPaddr) || dst.toString().equals(IPaddr)) { - print= true; - } - // Both addresses were specified - // The packet must match both addresses in any order before its - // printed - } else if ( - (src.toString().equals(IPaddr) || src.toString().equals(IPaddr2)) - && (dst.toString().equals(IPaddr) || dst.toString().equals(IPaddr2))) { - print= true; - } - if (!print) { // Don't print the packet - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION, "Not printing record"); - } - return ""; // Return empty record because it didn't pass the filter - } - } - - // Make the protocol a readable string instead of just a number - if (protocol == 0x3a) - nextheaders= ICMPV6; - if (protocol == 0x06) - nextheaders= TCP; - if (protocol == 0x11) - nextheaders= UDP; - if (protocol == 0x00) - nextheaders= EXTHOPHOP; - if (protocol == 0x2b) - nextheaders= EXTROUTE; - if (protocol == 0x2c) - nextheaders= EXTFRAG; - if (protocol == 0x32) - nextheaders= EXTESP; - if (protocol == 0x33) - nextheaders= EXTAH; - if (protocol == 0x3c) - nextheaders= EXTDST; - - Object[] args= - { - version, - src, - dst, - hoplimit, - flowlabel, - trafficclass, - payloadlength, - nextheaders, - nextheaderh, - }; - - String next= printnext(filter); - if (next == "") { // The header didn't pass the filter - return ""; - } else { - return Formatter.jsprintf( - "\t " - + IPV6DATA - + " . .:" - + " " - + VER - + " : {0,2,R} \t\t " - + TRAFFICCLASS - + ": {5} \t\t " - + FLWLBL - + ": {4}\n" - + "\t\t\t " - + PAYLOADLENGTH - + ": {6,5,R} \t" - + NXTHDR - + ": {8,4,L},{7,10,L} " - + HOPLIMIT - + ": {3,3,R}\n" - + "\t\t\t " - + SRC - + ": {1}\n" - + "\t\t\t " - + DST - + ": {2}\n", - args) - + printHexHeader() - + next; - } - } - - /** - * Returns the version of this Header. - * @return String containing a decimal representation of the version. - */ - public String getVersion() { - return version.toString(); - } - - /** - * Returns the traffic class of this Header. - * @return String containing a decimal representation of the traffic class. - */ - public String getTrafficClass() { - return (new Dec(trafficclass.getData())).toString(); - } - - /** - * Returns the flow label of this Header. - * @return String containing a decimal representation of the flow label. - */ - public String getFlowLabel() { - return (new Dec(flowlabel.getData())).toString(); - } - - /** - * Returns the payload length of this Header. - * @return String containing a decimal representation of the payload length. - */ - public String getPayloadLength() { - return payloadlength.toString(); - } - - /** - * Returns the next header identifier. - * @return String containing a decimal representation of the next header identifier. - */ - public String getNextHeaderDec() { - return nextheader.toString(); - } - - /** - * Returns the hop limit of this Header. - * @return String containing a decimal representation of the hop limit. - */ - public String getHopLimit() { - return hoplimit.toString(); - } - - /** - * Returns the source IPv6 Address of this Header. - * @return String containing a delimited decimal representation of the source address. - */ - public String getSrcAddr() { - return src.toString(); - } - - /** - * Returns the destination IPv6 Address of this Header - * @return String containing a delimited decimal representation of the destination address - */ - public String getDstAddr() { - return dst.toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/IP6Packet.java b/cvsroot/src/com/ibm/as400/util/commtrace/IP6Packet.java deleted file mode 100644 index 313e7d829..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/IP6Packet.java +++ /dev/null @@ -1,42 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IP6Packet.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * An Internet Protocol v6 IPPacket.
    - * Extends Packets' methods to parse, print, and allow easy access to the IPv6 IPPacket
    - * It has one constructor which takes a byte array of packet data as its only argument. - */ -public class IP6Packet extends IPPacket { - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - public IP6Packet(byte[] data) { - rawpacket= data; - header= new IP6Header(new BitBuf(rawpacket)); - } - - /** - * Returns a printable representation of this packet. - * @param filter FormatProperties object for filtering this packet. - * @return Returns a string representation of this packet. - */ - public String toString(FormatProperties filter) { - return header.toString(filter); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/IPAddressConversion.java b/cvsroot/src/com/ibm/as400/util/commtrace/IPAddressConversion.java deleted file mode 100644 index 53e781098..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/IPAddressConversion.java +++ /dev/null @@ -1,420 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IPaddrConv.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Vector; - -/** - * Converts an IP address between numeric and presentation format.
    - * Numeric format is the following:
    - * IPv4: ddd.ddd.ddd.ddd
    - * IPv6: xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
    - * Presentation format is the same as numeric but with leading 0's removed - * and IPv6 addresses compressed if possible:
    - * IPv4: ddd.ddd.d.d
    - * IPv6: xxxx::xxxx:xxxx
    - * Support is also avalible for IPv4 addresses encapsulated in IPv6 addresses:
    - * IPv6: x:x:x:x:x:x:d.d.d.d
    - * - */ -class IPAddressConversion { - private String IPaddr; - private int type= UNDEF; - /** Undefined */ - public static int UNDEF= -1; - /** IPv4 Address */ - public static int IPv4= 0; - /** IPv4 Address in hexadecimal notation */ - public static int IPv4Hex= 1; - /** IPv6 Address */ - public static int IPv6= 2; - /** A tunneled IPv4 through an IPv6 address */ - public static int IPvMixed= 3; - /** A tunneled IPv4 in hexadeciaml notation through an IPv6 Address */ - public static int IPvMixedHex= 4; - - /** - * Creates a new IPaddrConversion object and sets the type of address. - * @param IPaddr The IP address to convert. - */ - public IPAddressConversion(String IPaddr) { - this.IPaddr= IPaddr; - settype(); - } - - /** - * Creates a new IPaddrConversion object and sets the type of address. - * @param IPaddr The IP address to convert. - * @param type The Type of IP addresses. - */ - public IPAddressConversion(String IPaddr, int type) { - this.IPaddr= IPaddr; - this.type= type; - } - - public int type() { - return type; - } - - /** - * Converts a hexadecimal string into an integer string. - */ - private String toDec(String hex) { - return (new Integer(Integer.parseInt(hex, 16))).toString(); - } - - /** - * Splits a string into string arrays based on the given strin. - * @param str The string to split. - * @param splitstr The string to split on. - */ - public String[] split(String str, String splitstr) { - String[] ret; - Vector temp= new Vector(12); - int fromIndex= 0, index= 0; - while ((index= str.indexOf(splitstr, fromIndex)) != -1) { - temp.add(str.substring(fromIndex, index)); - fromIndex= index + 1; - } - temp.add(str.substring(fromIndex)); - - ret= new String[temp.size()]; - for (int i= 0; i < ret.length; i++) { - ret[i]= (String) temp.remove(0); - } - return ret; - } - - /** - * Converts this IP address from numeric to presentation. - */ - public String ntop() { - if (type == IPv4 || type == IPv4Hex) { - String seg[]= split(IPaddr, "."); - // Break up the IP Address into different segments - return ntopIPv4(seg); - } else if (type == IPv6) { - String seg[]= split(IPaddr, ":"); - // Break up the IP Address into different segments - seg= trim(seg); // Remove extra 0s from the address. - return ntopIPv6(seg); - } else if (type == IPvMixed) { - String seg[]= split(IPaddr, ":"); - String tmp[]= split(seg[7], "."); - seg[7]= ""; - seg= trim(seg); - tmp= trim(tmp); - - return (ntopIPv6(seg) + ":" + ntopIPv4(tmp)); - } - return ""; - } - - /** - * Converts the IPv4 portion of this address from numeric to presentation. - * @param seg The portion of the address to convert. - */ - private String ntopIPv4(String seg[]) { - // String that will be returned. - StringBuffer ret= new StringBuffer(32); - for (int i= 0; i < seg.length; i++) { - // Convert to decimal if the segement is in hex - if (type == IPv4Hex || type == IPvMixedHex) { - seg[i]= toDec(seg[i]); - } else { - seg[i]= (new Integer(Integer.parseInt(seg[i]))).toString(); - } - ret.append(seg[i] + "."); - } - // Remove the last delimiter and return the array - return ret.substring(0, (ret.length() - 1)); - } - - /** - * Converts the IPv6 portion of this address from numeric to presentation. - * @param seg The portion of the address to convert. - */ - private String ntopIPv6(String[] seg) { - boolean zero= false, compressed= false; - int start= 0, end= 0; - // String that will be returned. - StringBuffer ret= new StringBuffer(64); - // Cycle through the segments check for segments with 0s. - for (int i= 0; i < seg.length; i++) { - // If the character is 0 and we have not yet hit a zero. - if (seg[i].charAt(0) == '0' && !zero) { - // If there is compression at the beginning of the string - // add another : so we get :: - if (i == 0) { - ret.append(":"); - } - // Make it so we don't reset our start position. - zero= true; - // The position where the compression will start - start= i; - } - // If 0 and we have not yet set - // our end position check to make sure we don't go past the - // end of the array and make sure the next element isn't a 0. - if (zero && end == 0 && (i + 1) < seg.length && seg[i + 1].charAt(0) != '0') { - end= i; - } - } - for (int i= 0; i < seg.length; i++) { - // If we don't have any 0s just append the segments to the - // return string. - if (!zero) { - ret.append(seg[i] + ":"); - } else { - if (!compressed) { - - // If this segment isn't a 0 append it to the return string. - if (seg[i].charAt(0) != '0') { - ret.append(seg[i] + ":"); - // If the space between 0s is not equal we need to compress. - } else if (start != end) { - // Add another : so we get the compression - ret.append(":"); - i= end; - // Skip past the rest of the 0s. - compressed= true; - } - } else { - ret.append(seg[i] + ":"); - } - } - } - // Remove the last delimiter and return the array - return ret.substring(0, (ret.length() - 1)); - } - - /** - * Trims extra characters from the IP address. - * @param seg The IP address to trim. - * @return String[] containing the IP address. - */ - private String[] trim(String[] seg) { - StringBuffer ret= new StringBuffer(64); - // Cycle through the segments changing if needed - for (int i= 0; i < seg.length; i++) { - // If we have gotten to our first number or not. - boolean first= true; - // Split the segment into a character array - // makes removing the 0s easy. - char[] c= seg[i].toCharArray(); - for (int j= 0; j < c.length; j++) { - // If we have a 0, have not hit our first number, - if (c[j] == '0' && first) { - if (type == IPv4 || type == IPv4Hex) { - // have reached the last possible spot in the address - // and have not added a zero to our output do so - if (j > 1) { - // Add character to return array - ret.append("0"); - } - } else if (type == IPv6) { - if (j > 2) { - // Add character to return array - ret.append("0"); - } - } else if (type == IPvMixed || type == IPvMixedHex) { - if (j > 2) { - // Add character to return array - ret.append("0"); - } - } - } else { - // If this is the first time with a number we - // need returned set this flag so the rest of - // the zeros in this block are preserved. - if (first) { - first= false; - } - // Add the character to the return array. - ret.append(c[j]); - } - } - // Add the correct delimiter based on what type of - // address we have. - if (type == IPv4 || type == IPv4Hex) { - ret.append("."); - } else if (type == IPv6) { - ret.append(":"); - } else if (type == IPvMixed || type == IPvMixedHex) { - ret.append(":"); - } - } - if (type == IPv4 || type == IPv4Hex) { - //ret = ret.substring(0,(ret.length()-1)); - // Remove last delimiter from address. - // Return array using a regex to split the string up - return split(ret.substring(0, (ret.length() - 1)), "."); - } else if (type == IPv6) { - //ret = ret.substring(0,(ret.length()-1)); - // Remove last delimiter from address - // Return array using a regex to split the string up - return split(ret.substring(0, (ret.length() - 1)), ":"); - } else if (type == IPvMixed || type == IPvMixedHex) { - //ret = ret.substring(0,(ret.length()-1)); - // Remove last delimiter from address - // Return array using a regex to split the string up - return split(ret.substring(0, (ret.length() - 1)), ":"); - } - return split(ret.toString(), "."); - } - - /** - * Converts this IP address from presentation to numeric. - */ - public String pton() { - if (type == IPv4 || type == IPv4Hex) { - // Break up the IP Address into different segments - String seg[]= split(IPaddr, "."); - return ptonIPv4(seg); - } else if (type == IPv6) { - // Break up the IP Address into different segments - String seg[]= split(IPaddr, ":"); - return ptonIPv6(seg); - // For a mixed address split it up on IPv6 delimiter. - } else if (type == IPvMixed || type == IPvMixedHex) { - String seg[]= split(IPaddr, ":"); - int index; - String tmp[]= null; - // Cycle through the segments looking for the mixed - for (int i= 0; i < seg.length; i++) { - if (seg[i].indexOf('.') != -1) { // segment - tmp= split(seg[i], "."); // Split up the mixed segment. - seg[i]= ""; // Set the mixed segment to nothing. - index= i; // Set the index of our mixed segment. - } - } - // Convert the two addresses and return the result. - return (ptonIPv6(seg) + ":" + ptonIPv4(tmp)); - } - return "Unknown Type of IP Address"; - } - - /** - * Converts the IPv4 portion of this address from presentation to numeric. - * @param seg The portion of the address to convert. - */ - private String ptonIPv4(String seg[]) { - // String that will be returned. - StringBuffer ret= new StringBuffer(32); - // Cycle through the segments chaging if needed. - for (int i= 0; i < seg.length; i++) { - int length= seg[i].length(); - // If we have a full address just add the delimiter. - if (length == 3) { - ret.append(seg[i] + "."); - // Otherwise add one 0 and a delimiter - } else if (length == 2) { - ret.append("0".concat(seg[i]) + "."); - // Add two 0s and a delimiter - } else if (length == 1) { - ret.append("00".concat(seg[i]) + "."); - } - } - // Remove the last delimiter and return the array - return ret.substring(0, ret.length() - 1); - } - - /** - * Converts the IPv6 portion of this address from presentation to numeric. - * @param seg The portion of the address to convert. - */ - private String ptonIPv6(String seg[]) { - // String that will be returned. - StringBuffer ret= new StringBuffer(64); - - // If the IPaddr is compressed uncompress it. - if (seg.length < 8) { - // Overwrite the compressed string - seg= new String[8]; - // Split into 2 strings. - String comp[]= split(IPaddr, "::"); - // Divide the two strings so we know how much - // compression has occured - String segcomp[]= split(comp[0], ":"); - String segcomp2[]= split(comp[1], ":"); - int size= 0; - // Calculate the amount we will have to add - if (comp[0].equals("")) { - size= 9 - segcomp.length - segcomp2.length; - } else { - size= 8 - segcomp.length - segcomp2.length; - } - // The position in our return array - int pos= 0; - // Dump the first array into our return array - for (int i= 0; i < segcomp.length; i++) { - seg[pos]= segcomp[i]; - if (!comp[0].equals("")) { - pos++; - } - } - // Add the correct number of blank octets - for (int i= 0; i < size; i++) { - seg[pos]= "0"; - pos++; - } - // Dump the second array into our return array - for (int i= 0; i < segcomp2.length; i++) { - seg[pos]= segcomp2[i]; - pos++; - } - } - for (int i= 0; i < seg.length; i++) { - int length= seg[i].length(); - // If we have a full address just add the delimiter. - if (length == 4) { - ret.append(seg[i] + ":"); - // Add one 0 and a delimiter - } else if (length == 3) { - ret.append("0".concat(seg[i]) + ":"); - // Otherwise add two 0 and a delimiter - } else if (length == 2) { - ret.append("00".concat(seg[i]) + ":"); - // Add three 0s and a delimiter - } else if (length == 1) { - ret.append("000".concat(seg[i]) + ":"); - } - } - // Remove the last delimiter and return the array - return ret.substring(0, ret.length() - 1); - } - - /** - * Sets the type of this address. - */ - private void settype() { - int l= IPaddr.length(); - - for (int i= 0; i < l; i++) { - if (IPaddr.charAt(i) == ':') { - if (type == UNDEF) { - type= IPv6; - } - } else if (IPaddr.charAt(i) == '.') { - if (type == UNDEF) { - type= IPv4; - break; - } else { - type= IPvMixed; - break; - } - } - } - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/IPPacket.java b/cvsroot/src/com/ibm/as400/util/commtrace/IPPacket.java deleted file mode 100644 index acabfe82e..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/IPPacket.java +++ /dev/null @@ -1,86 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IPPacket.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * Abstract packet class.
    - * Contains this packet's rawdata and type.
    - * Allows for easy access to this packet. - */ -public abstract class IPPacket { - Header header; - byte[] rawpacket; - int type; - - /** Address Resolution Protocol*/ - public static final int ARP = 0x0806; - /** Reverse Address Resolution Protocol */ - public static final int RARP = 0x8035; - /** Internet Protocol Version Four */ - public static final int IP4 = 0x0800; - /** Internet Protocol Version Six */ - public static final int IP6 = 0x86DD; - /** Unknown IPPacket */ - public static final int UNK = 0x0000; - - /** - * Default constructor. Creates a simple packet. - */ - public IPPacket() { - } - - /** - * Returns a printable representation of this packet. - * @param filter FormatProperties object for filtering this packet. - * @return Returns a string representation of this packet. - */ - public String toString(FormatProperties filter) { - return ""; - } - - /** - * Returns the header of this packet. - * @return Header the header of this packet. - */ - public Header getHeader() { - return header; - } - - /** - * The name of this packet - * @return The name - */ - public String getName() { - return this.getClass().getName().substring(this.getClass().getName().lastIndexOf('.')+1); - } - - /** - * Returns the type of this packet. - * @return The type of this packet. - */ - public int getType() { - return type; - } - - /** - * Sets the type of this packet. - * @param type the type of this packet. - */ - public void setType(int type) { - this.type=type; - } -} - diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/LanHeader.java b/cvsroot/src/com/ibm/as400/util/commtrace/LanHeader.java deleted file mode 100644 index 400f1037b..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/LanHeader.java +++ /dev/null @@ -1,266 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: LanHeader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -/** - * Allows the user to parse, print, and have easy access to the LanHeader. - */ -public class LanHeader { - //private BitBuf data; - private Field llc; - private String protocol, frameformat; - private Field lanroutel, eth2sourcemac, // ETH V2 fields - eth2destmac, - eth2frametypeh, - eth2frametype, - ethsourcemac, - // 802.3 Ethernet fields - ethdestmac, - ethsaps, - ethframetypeh, - ethframetype, - trnsourcemac, - // Tokenring fields - trndestmac, - trnrouteinfo, - trnsaps, - trnframetypeh, - trnframetype, - frametype, - // Generic fields - sourcemac, - destmac; - - /** - * creates and parses the Lan Header. - * @param data The raw data from this packet. - * @param f Field which tells if this packet is LLC or not. - * @param protocol this packet's protocol. - */ - LanHeader(BitBuf data, Field f, String protocol) { - //this.data= data; - this.llc= f; - this.protocol= protocol; - lanroutel= new Dec(data.slice(160, 8)); - eth2destmac= new Hex(data.slice(176, 48)); - eth2sourcemac= new Hex(data.slice(224, 48)); - eth2frametypeh= new Hex(data.slice(272, 16)); - eth2frametype= new Dec(data.slice(272, 16)); - ethdestmac= new Hex(data.slice(176, 48)); - ethsourcemac= new Hex(data.slice(224, 48)); - ethsaps= new Hex(data.slice(288, 16)); - ethframetypeh= new Hex(data.slice(336, 16)); - ethframetype= new Dec(data.slice(336, 16)); - trndestmac= new Hex(data.slice(192, 48)); - trnsourcemac= new Hex(data.slice(240, 48)); - trnrouteinfo= - new Hex(data.slice(288, Integer.parseInt(lanroutel.toString()) * 8)); - trnsaps= - new Hex(data.slice((288 + Integer.parseInt(lanroutel.toString()) * 8), 16)); - trnframetypeh= - new Hex( - data.slice((288 + Integer.parseInt(lanroutel.toString()) * 8 + 48), 16)); - trnframetype= - new Dec( - data.slice((288 + Integer.parseInt(lanroutel.toString()) * 8 + 48), 16)); - } - - /** - * Returns the byte at which the rest of this packet's header starts. - * @return The start of the data. - */ - public int getDataStart() { - if ((llc.toString()).equals("0xFF")) { - if (protocol.equals("E")) { // Tokenring - return ((Integer.parseInt(lanroutel.toString()) * 8) + 176); - } else { // 802.3 Ethernet - return 176; - } - } else { // Etvernet V2 - return 112; - } - } - - /** - * Returns the frame type of this packet. - * @return The frame type. - */ - public int getFrameType() { - if ((llc.toString()).equals("0xFF")) { - if (protocol.equals("E")) { // Tokenring - frametype= trnframetype; - } else { // 802.3 Ethernet - frametype= ethframetype; - } - } else { // Etvernet V2 - frametype= eth2frametype; - } - return Integer.parseInt(frametype.toString()); - } - - /** - * Returns the destination MAC address of this packet. - * @return String MAC address. - */ - public String getMacAddress() { - if ((llc.toString()).equals("0xFF")) { - if (protocol.equals("E")) { // Tokenring - destmac= trndestmac; - } else { // 802.3 Ethernet - destmac= ethdestmac; - } - } else { // Etvernet V2 - destmac= eth2destmac; - } - return destmac.toString(); - } - - /** - * Returns a String with the tokenring routing data. - * @return String routing data. - */ - public String printRoutingData() { - Object[] args= { trnrouteinfo.toString()}; - - return Formatter.jsprintf(" Routing Info: {0,14,L} \n", args); - } - - /** - * Returns a String representation of this lan header with source/destination mac addresses, frame format, and frametype. - * @return Returns a string representation of this header. - */ - public String toString() { - if ((llc.toString()).equals("0xFF")) { - if (protocol.equals("E")) { // Tokenring - sourcemac= trnsourcemac; - destmac= trndestmac; - frametype= trnframetypeh; - frameformat= ("LLC"); - } else { // 802.3 Ethernet - sourcemac= ethsourcemac; - destmac= ethdestmac; - frametype= ethframetypeh; - frameformat= ("802.3"); - } - } else { // Etvernet V2 - sourcemac= eth2sourcemac; - destmac= eth2destmac; - frametype= eth2frametypeh; - frameformat= ("ETHV2"); - } - - Object[] args= - { destmac.toString(), sourcemac.toString(), frameformat, frametype.toString()}; - - return Formatter.jsprintf( - "\t\t {0,14,L} {1,14,L} {2,5,L} Type: {3,2,l}\n", - args); - } - - /** - * Returns the lan routing length. - * @return String containing a decimal representation of the lan routing length. - */ - public String getLanRouteLength() { - return lanroutel.toString(); - } - - /** - * Returns the Ethernet2 destination mac of the Lan header. - * @return String containing a hexadecimal representation of the destination mac address. - */ - public String getEth2DestMacAddress() { - return eth2destmac.toString(); - } - - /** - * Returns the Ethernet2 source mac of the Lan header. - * @return String containing a hexadecimal representation of the source mac address. - */ - public String getEth2SrcMacAddress() { - return eth2sourcemac.toString(); - } - - /** - * Returns the Ethernet destination mac of the Lan header. - * @return String containing a hexadecimal representation of the destination mac address. - */ - public String getEthDestMacAddress() { - return ethdestmac.toString(); - } - - /** - * Returns the Ethernet source mac of the Lan header. - * @return String containing a hexadecimal representation of the source mac address. - */ - public String getEthSrcMacAddress() { - return ethsourcemac.toString(); - } - - /** - * Returns the Service Access Points of the Lan header. - * @return String containing a decimal representation of the Service Access Point. - */ - public String getEthSaps() { - return (new Dec(ethsaps.getData())).toString(); - } - - /** - * Returns the frame type of the Lan header. - * @return String containing a decimal representation of the frame type. - */ - public String getEthFrameType() { - return ethframetype.toString(); - } - - /** - * Returns the Tokenring destination mac of the Lan header. - * @return String containing a hexadecimal representation of the destination mac address. - */ - public String getTrnDestMacAddress() { - return trndestmac.toString(); - } - - /** - * Returns the Tokenring source mac of the Lan header. - * @return String containing a hexadecimal representation of the source mac address. - */ - public String getTrnSrcMacAddress() { - return trnsourcemac.toString(); - } - - /** - * Returns the Tokenring routing information of the Lan header. - * @return String containing a decimal representation of the routing information. - */ - public String getTrnRouteInfo() { - return (new Dec(trnrouteinfo.getData())).toString(); - } - - /** - * Returns the Tokenring Service Access Points of the Lan header. - * @return String containing a decimal representation of the Service Access Points. - */ - public String getTrnSaps() { - return (new Dec(trnsaps.getData())).toString(); - } - - /** - * Returns the Tokenring frame type information of the Lan header. - * @return String containing a decimal representation of the routing information. - */ - public String getTrnFrameType() { - return trnframetype.toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/MLMessage.java b/cvsroot/src/com/ibm/as400/util/commtrace/MLMessage.java deleted file mode 100644 index 17fb74271..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/MLMessage.java +++ /dev/null @@ -1,70 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MLMessage.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * A Multicast Listener Message Header.
    - * Extends Message's methods to parse, print, and allow easy access to the MLMessage Header. - */ -public class MLMessage extends Message { - private Field maxresponsedelay= new Dec(rawheader.slice(0, 16)); - private Field address= new IP6Address(rawheader.slice(32, 128)); - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - MLMessage(BitBuf data) { - super(data); - } - - /** - * Returns the length of this header. - * @return Will always return 160. - */ - public int getHeaderLen() { - return 160; - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - - Object[] args= { maxresponsedelay, address }; - return Formatter.jsprintf(MAX + ": {0,5,R} " + ADDR + ": {1}\n", args) - + printHexHeader() - + printnext(filter); - } - - /** - * Returns the max response delay of this MLMessage. - * @return String containing a decimal representation of the max response delay. - */ - public String getMaxResponseDelay() { - return maxresponsedelay.toString(); - } - - /** - * Returns the IPv6 Address of this MLMessage. - * @return String containing a delimited IPv6 address. - */ - public String getAddress() { - return address.toString(); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/MTU.java b/cvsroot/src/com/ibm/as400/util/commtrace/MTU.java deleted file mode 100644 index 219145cb8..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/MTU.java +++ /dev/null @@ -1,65 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MTU.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * A MTU Header.
    - * Extends NDOption's methods to parse, print, and allow easy access to the MTU Header. - */ -public class MTU extends NDOption { - private Field mtu= new Dec(rawheader.slice(32, 32)); - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - MTU(BitBuf data) { - super(data); - super.type= MTU; - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - - Object[] args= { ndtype, length, mtu }; - return Formatter.jsprintf( - "\t " - + OPTDATA - + ": " - + TYPE - + ": {0,3,R} " - + LEN - + ": {1,3,R} " - + MTUSTR - + ": {2,10,R}\n", - args) - + printHexHeader() - + printnext(filter); - } - - /** - * Returns the MTU of MTU header. - * @return String containing a decimal representation of the MTU. - */ - public String getMTU() { - return mtu.toString(); - } - -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Message.java b/cvsroot/src/com/ibm/as400/util/commtrace/Message.java deleted file mode 100644 index 2a5520d22..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Message.java +++ /dev/null @@ -1,129 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Message.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * An ICMPv6 Message Header.
    - * Extends Header's methods to parse, print, and allow easy access to the ICMPv6 Message Header. - */ -public abstract class Message extends ICMP6Header { - - /** A Unknown Message */ - public final static int MSGUNK= 0x00; - /** A Router Solicitation Message */ - public final static int RTRSOL= 0x85; - /** A Router Advertisement Message */ - public final static int RTRADV= 0x86; - /** A Neighbor Solicitation Message */ - public final static int NGHSOL= 0x87; - /** A Neighbor Advertisement Message */ - public final static int NGHADV= 0x88; - /** A Redirect Message */ - public final static int REDR= 0x89; - /** A Destination Unreachable Message */ - public final static int DSTUNR= 0x01; - /** A Packet To Big Message */ - public final static int PKTTOBIG= 0x02; - /** A Time Exceeded Message */ - public final static int TIMEEXC= 0x03; - /** A Parameter Problem Message */ - public final static int PARMPROB= 0x04; - /** A Echo Request Message */ - public final static int ECHOREQ= 0x80; - /** A Echo Reply Message */ - public final static int ECHQRPL= 0x81; - /** A Multicast Listener Query Message */ - public final static int MLTLSTQRY= 0x82; - /** A Multicast Listener Report Message */ - public final static int MLTLSTRPT= 0x83; - /** A Multicast Listener Done Message */ - public final static int MLTLSTDNE= 0x84; - - final static String OFFPKT= "Offending IPPacket"; - final static String PTR= "Pointer"; - final static String ID= "Identifier"; - final static String SEQNUM= "SequenceNumber"; - final static String CURHOPLIMIT= "CurHopLimit"; - final static String RTRLIFETIME= "RouterLifeTime"; - final static String RCHTIME= "ReachableTime"; - final static String RETRANSTIME= "RetransTimer"; - final static String O= "O"; - final static String M= "M"; - final static String TARGET= "Target"; - final static String FLAGS= "Flags"; - final static String RTR= "Router"; - final static String SOL= "Solicited"; - final static String OVR= "Override"; - final static String DST= "Destination"; - final static String MAX= "Max Response Delay"; - final static String ADDR= "Address"; - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - Message(BitBuf data) { - super(data); - } - - /** - * Creates the correct message for this header. - * @param type The byte indicating the type of this heade. - * @param data The raw data of this header. - */ - static Message createMessage(byte t, BitBuf data) { - int msgtype= t & 0xFF; - - if (msgtype == 0x85) - return new RouterSolicitation(data); - if (msgtype == 0x86) - return new RouterAdvertisement(data); - if (msgtype == 0x87) - return new NeighborSolicitation(data); - if (msgtype == 0x88) - return new NeighborAdvertisement(data); - if (msgtype == 0x89) - return new Redirect(data); - if (msgtype == 0x01) - return new DestinationUnreachable(data); - if (msgtype == 0x02) - return new PacketTooBig(data); - if (msgtype == 0x03) - return new TimeExceeded(data); - if (msgtype == 0x04) - return new ParameterProblem(data); - if (msgtype == 0x80) - return new EchoRequest(data); - if (msgtype == 0x81) - return new EchoReplyRequest(data); - if (msgtype == 0x82) - return new MulticastListenerQuery(data); - if (msgtype == 0x83) - return new MulticastListenerReport(data); - if (msgtype == 0x84) - return new MulticastListenerDone(data); - return new UnknownMessage(data); - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - return printnext(filter); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/MulticastListenerDone.java b/cvsroot/src/com/ibm/as400/util/commtrace/MulticastListenerDone.java deleted file mode 100644 index c818c6a64..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/MulticastListenerDone.java +++ /dev/null @@ -1,31 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MulticastListenerDone.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -/** - * A Mulitcast Listener Done Header.
    - * Extends MLMessage's methods to to parse, print, and allow easy access to the - * Multicast Listener Done Header. - * - */ -public class MulticastListenerDone extends MLMessage { - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - MulticastListenerDone(BitBuf data) { - super(data); - super.type= MLTLSTDNE; - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/MulticastListenerQuery.java b/cvsroot/src/com/ibm/as400/util/commtrace/MulticastListenerQuery.java deleted file mode 100644 index 5e02946c0..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/MulticastListenerQuery.java +++ /dev/null @@ -1,31 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MulticastListenerQuery.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -/** - * A Multicast Listener Query Header.
    - * Extends MLMessage's methods to parse, print, and allow easy access to the - * Multicast Listener Query Header. - * - */ -public class MulticastListenerQuery extends MLMessage { - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - MulticastListenerQuery(BitBuf data) { - super(data); - super.type= MLTLSTQRY; - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/MulticastListenerReport.java b/cvsroot/src/com/ibm/as400/util/commtrace/MulticastListenerReport.java deleted file mode 100644 index 5bc57a2af..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/MulticastListenerReport.java +++ /dev/null @@ -1,30 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MulticastListenerReport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -/** - * A Mulitcast Listener Report Header.
    - * Extends MLMessage's methods to parse, print, and allow easy access to the - * Multicast Listener Report Header. - */ -public class MulticastListenerReport extends MLMessage { - /** - * Creates and parses the data of this header. - * @param data The raw data of this header - */ - MulticastListenerReport(BitBuf data) { - super(data); - super.type= MLTLSTRPT; - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/NDOption.java b/cvsroot/src/com/ibm/as400/util/commtrace/NDOption.java deleted file mode 100644 index bec79d105..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/NDOption.java +++ /dev/null @@ -1,111 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NDOption.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * An ICMPv6 Neighbor Discovery Header.
    - * Extends Header's methods to parse, print, and allow easy access to the Neighbor Discovery Header. - */ -public abstract class NDOption extends ICMP6Header { - Field ndtype= new Dec(rawheader.slice(0, 8)); - Field length= new Dec(rawheader.slice(8, 8)); - - /** A Neighbor Discovery Source LLA Header */ - public final static int SOURCELLA= 0x01; - /** A Neighbor Discovery Target LLA Header */ - public final static int TARGETLLA= 0x02; - /** A Neighbor Discovery Prefix Info Header */ - public final static int PREFIXINFO= 0x03; - /** A Neighbor Discovery Redirected Header */ - public final static int REDIRECTED= 0x04; - /** A Neighbor Discovery MTU Header */ - public final static int MTU= 0x05; - - final static String OPTDATA= "Option Data"; - final static String TYPE= "Type"; - final static String LEN= "Length"; - final static String ADDR= "Address"; - final static String PFXLEN= "PrefixLen"; - final static String PKT= "Packet"; - final static String VLDLIFETIME= "ValidLifeTime"; - final static String PRETIME= "PreferredTime"; - final static String PFX= "Prefix"; - final static String MTUSTR= "MTU"; - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - NDOption(BitBuf data) { - super(data); - } - - /** - * creates the correct header based off the data. - * @param BitBuf The raw data of this header. - */ - static NDOption createNDOption(BitBuf b) { - if (b.getBitSize() == 0) - return null; - int ndtype= 0xFF & b.getOctet(0); - if (ndtype == 0x01) - return new SourceLLA(b); - if (ndtype == 0x02) - return new TargetLLA(b); - if (ndtype == 0x03) - return new PrefixInfo(b); - if (ndtype == 0x04) - return new RedirectedHeader(b); - if (ndtype == 0x05) - return new MTU(b); - return null; - } - - /** - * Returns the length of this header. - * @return The length of this header. - */ - public int getHeaderLen() { - return rawheader.getOctet(8) * 64; - } - - /** - * Returns the next header in the packet. - * @return Will always return either null or a NDOption header. - */ - public Header getNextHeader() { - if (rawpayload.getBitSize() == 0) - return null; - else - return createNDOption(rawpayload); - } - - /** - * Returns the Neighbor Discovery type of this NDOption Header. - * @return String containing a decimal representation of the Neighbor Discovery type of this header. - */ - public String getNDType() { - return ndtype.toString(); - } - - /** - * Returns the length of this NDOption Header. - * @return String containing a decimal representation of the length of this header. - */ - public String getLength() { - return length.toString(); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/NeighborAdvertisement.java b/cvsroot/src/com/ibm/as400/util/commtrace/NeighborAdvertisement.java deleted file mode 100644 index 1a6b9c5d3..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/NeighborAdvertisement.java +++ /dev/null @@ -1,110 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NeighborAdvertisement.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * A Neighbor Advertisement Header.
    - * Extends Message's methods to parse, print, and allow easy access to the - * Neighbor Advertisement Header - */ -public class NeighborAdvertisement extends Message { - private Field router= new Flag(rawheader.slice(0, 1), "Yes", "No"); - private Field solicited= new Flag(rawheader.slice(1, 1), "Yes", "No"); - private Field override= new Flag(rawheader.slice(2, 1), "Yes", "No"); - private Field target= new IP6Address(rawheader.slice(32, 128)); - - /** - * Returns the next header in the packet - * @return Will always return a NDOption header - */ - public Header getNextHeader() { - return NDOption.createNDOption(rawpayload); - } - - /** - * Returns the length of this header. - * @return Will always return 160 - */ - public int getHeaderLen() { - return 160; - } - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - NeighborAdvertisement(BitBuf data) { - super(data); - super.type=NGHADV; - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - - Object[] args= { router, solicited, override, target }; - return Formatter.jsprintf( - FLAGS - + ": " - + RTR - + ": {0,3,R} " - + SOL - + ": {1,3,R} " - + OVR - + ": {2,3,R}\n" - + "\t\t" - + TARGET - + ": {3}\n", - args) - + printHexHeader() - + printnext(filter); - } - - /** - * Returns the router flag of this NeighborAdvertisement Message - * @return String containing a Byte.toString(byte) of this flag bit - */ - public String getRouter() { - return router.toString(); - } - - /** - * Returns the solicited flag of this NeighborAdvertisement Message - * @return String containing a Byte.toString(byte) of this flag bit - */ - public String getSolicited() { - return solicited.toString(); - } - - /** - * Returns the override flag of this NeighborAdvertisement Message - * @return String containing a Byte.toString(byte) of this flag bit - */ - public String getOverride() { - return override.toString(); - } - - /** - * Returns the target address of this NeighborAdvertisement Message - * @return String containing a IPv6 address - */ - public String getTarget() { - return target.toString(); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/NeighborSolicitation.java b/cvsroot/src/com/ibm/as400/util/commtrace/NeighborSolicitation.java deleted file mode 100644 index b8a434052..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/NeighborSolicitation.java +++ /dev/null @@ -1,71 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: NeighborSolicitation.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * A Neighbor Solicitation Header.
    - * Extends Message's methods to parse, print, and allow easy access to the - * Neighbor Solicitation Header. - */ -public class NeighborSolicitation extends Message { - private Field targetaddress= new IP6Address(rawheader.slice(32, 128)); - - /** - * Returns the next header in the packet. - * @return Will always return a NDOption header. - */ - public Header getNextHeader() { - return NDOption.createNDOption(rawpayload); - } - - /** - * Returns the length of this header. - * @return Will always return 160 - */ - public int getHeaderLen() { - return 160; - } - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - NeighborSolicitation(BitBuf data) { - super(data); - super.type= NGHSOL; - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - - Object[] args= { targetaddress }; - return Formatter.jsprintf(TARGET + ": {0}\n", args) - + printHexHeader() - + printnext(filter); - } - - /** - * Returns the target address of this NeighborSolicitation Message. - * @return String containing a delimited IPv6 address. - */ - public String getTargetAddress() { - return targetaddress.toString(); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/OutputThread.java b/cvsroot/src/com/ibm/as400/util/commtrace/OutputThread.java deleted file mode 100644 index 982d93701..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/OutputThread.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputThread.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.JavaApplicationCall; - -/** - * The thread where remote standard out is sent when running JavaApplication call - */ -class OutputThread implements Runnable { - private JavaApplicationCall jaCall_; - private Thread outThread_; - - public OutputThread(JavaApplicationCall jaCall) { - jaCall_= jaCall; - } - /** - * Returns the currently running format Thread - * @return The Thread - */ - public Thread getThread() { - return outThread_; - } - - /** - * Sets the thread. - * @param Thread The thread this object is running under. - */ - public void setThread(Thread tr) { - outThread_= tr; - } - - /** - * Starts the Output Thread to recieve debug info from the remotely running Java program. - */ - public void run() { - Thread myThread= Thread.currentThread(); - while (outThread_ == myThread) { - String s= jaCall_.getStandardOutString(); - if (s != null) - Trace.log(Trace.INFORMATION, s); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // the VM doesn't want us to sleep anymore, - // so get back to work - } - } - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/PacketTooBig.java b/cvsroot/src/com/ibm/as400/util/commtrace/PacketTooBig.java deleted file mode 100644 index a3faf8643..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/PacketTooBig.java +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PacketTooBig.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * A PacketTooBig Header.
    - * Extends Message's methods to parse, print, and allow easy access to the PacketTooBig Header. - */ -public class PacketTooBig extends Message { - private Field mtu= new Dec(rawheader.slice(0, 32)); - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - PacketTooBig(BitBuf data) { - super(data); - super.type= PKTTOBIG; - } - - /** - * Returns the length of this header. - * @return Will always return 32. - */ - public int getHeaderLen() { - return 32; - } - - /** - * Returns the next header in the packet. - * @return Will always return a IP6Header. - */ - public Header getNextHeader() { - return new IP6Header(rawpayload); - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - return printHexHeader() - + "MTU: " - + mtu - + "\n" - + "\t\t\t" - + OFFPKT - + ":\n" - + printnext(filter); - } - - /** - * Returns the MTU of this PacketTooBig Message. - * @return String containing a decimal representation of the MTU. - */ - public String getMTU() { - return mtu.toString(); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/ParameterProblem.java b/cvsroot/src/com/ibm/as400/util/commtrace/ParameterProblem.java deleted file mode 100644 index 8bfdb01f5..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/ParameterProblem.java +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ParameterProblem.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * A Parameter Problem Header.
    - * Extends Message's methods to parse, print, and allow easy access to the Parameter Problem Header. - */ -public class ParameterProblem extends Message { - private Field pointer= new Hex(rawheader.slice(0, 32)); - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - ParameterProblem(BitBuf data) { - super(data); - super.type= PARMPROB; - } - - /** - * Returns the length of this header. - * @return Will always return 32. - */ - public int getHeaderLen() { - return 32; - } - - /** - * Returns the next header in the packet. - * @return Will always return a IP6Header. - */ - public Header getNextHeader() { - return new IP6Header(rawpayload); - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - return PTR - + ": " - + pointer - + "\n" - + "\t\t\t\t\t\t\t" - + OFFPKT - + ":\n" - + printnext(filter); - } - - /** - * Returns the pointer of this Parameter Problem. - * @return String containing a decimal representation of the pointer. - */ - public String getPointer() { - return (new Dec(pointer.getData())).toString(); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Port.java b/cvsroot/src/com/ibm/as400/util/commtrace/Port.java deleted file mode 100644 index 836e7a6f7..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Port.java +++ /dev/null @@ -1,173 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Port.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Hashtable; - -/** - * Takes in a port number and returns a description of the port. - */ -class Port { - private static Hashtable ports = new Hashtable(); - - /** - * Initializes the port table. - */ - public static void initialize() { - // Add port number and name to the hash table - ports.put("1","tcpmux"); - ports.put("5","RJE"); - ports.put("7","echo"); - ports.put("9","discard"); - ports.put("11","systat"); - ports.put("13","daytime"); - ports.put("17","qotd"); - ports.put("18","MSP"); - ports.put("20","ftp-data"); - ports.put("21","ftp"); - ports.put("22","ssh"); - ports.put("23","telnet"); - ports.put("25","smtp"); - ports.put("37","time"); - ports.put("39","rlp"); - ports.put("42","nameserver"); - ports.put("43","nicname"); - ports.put("49","login"); - ports.put("50","re-mail-ck"); - ports.put("52","xns-time"); - ports.put("53","domain"); - ports.put("63","whois++"); - ports.put("67","bootps"); - ports.put("68","bootpc"); - ports.put("69","tftp"); - ports.put("70","gopher"); - ports.put("79","finger"); - ports.put("80","http"); - ports.put("82","xfer"); - ports.put("88","kerberbos"); - ports.put("89","su-mit-tg"); - ports.put("90","dnsix"); - ports.put("92","npp"); - ports.put("93","dcp"); - ports.put("95","supdup"); - ports.put("101","hostname"); - ports.put("102","iso-tsap"); - ports.put("107","rtelnet"); - ports.put("108","snagas"); - ports.put("109","pop2"); - ports.put("110","pop3"); - ports.put("111","sunrpc"); - ports.put("113","ident"); - ports.put("115","sftp"); - ports.put("117","uucp-path"); - ports.put("118","sqlserv"); - ports.put("119","nntp"); - ports.put("123","ntp"); - ports.put("130","cisco-fna"); - ports.put("131","cisco-tna"); - ports.put("132","cisco-sys"); - ports.put("135","loc-srv"); - ports.put("137","netbios-ns"); - ports.put("138","netbios-dgm"); - ports.put("139","netbios-ssn"); - ports.put("143","imap"); - ports.put("144","news"); - ports.put("146","iso-ipo"); - ports.put("147","iso-ip"); - ports.put("144","news"); - ports.put("150","sql-net"); - ports.put("152","bftp"); - ports.put("153","sgmp"); - ports.put("156","sqlsrv"); - ports.put("158","pcmail-srv"); - ports.put("159","nss-routing"); - ports.put("160","sgmp-traps"); - ports.put("161","snmp"); - ports.put("162","snmptrap"); - ports.put("163","cmip-man"); - ports.put("164","cmip-agent"); - ports.put("165","xns-courier"); - ports.put("167","namp"); - ports.put("179","bgp"); - ports.put("197","dls"); - ports.put("198","dls-mon"); - ports.put("200","src"); - ports.put("201","at-rtmp"); - ports.put("202","at-nbp"); - ports.put("204","at-echo"); - ports.put("206","at-zis"); - ports.put("209","qmtp"); - ports.put("213","ipx"); - ports.put("220","imap3"); - ports.put("246","dsp3270"); - ports.put("385","ibm-app"); - ports.put("397","appc/tcp"); - ports.put("414","infoseek"); - ports.put("415","bnet"); - ports.put("423","opc-job-start"); - ports.put("424","opc-job-track"); - ports.put("443","https"); - ports.put("512","exec"); - ports.put("513","login"); - ports.put("514","cmd"); - ports.put("515","printer"); - ports.put("517","talk"); - ports.put("518","ntalk"); - ports.put("519","utime"); - ports.put("520","efs"); - ports.put("525","time"); - ports.put("526","tempo"); - ports.put("530","courier"); - ports.put("531","conference"); - ports.put("532","netnews"); - ports.put("533","netwall"); - ports.put("540","uucp"); - ports.put("543","klogin"); - ports.put("544","krcmd"); - ports.put("550","new-rwho"); - ports.put("565","whoami"); - ports.put("574","ftp-agent"); - ports.put("600","ipcserver"); - ports.put("749","kerberos-adm"); - ports.put("754","tell"); - ports.put("758","nlogin"); - ports.put("765","webster"); - ports.put("767","phonebook"); - ports.put("989","ftps-data"); - ports.put("990","ftps"); - ports.put("991","nas"); - ports.put("992","telnets"); - ports.put("993","imaps"); - ports.put("994","ircs"); - ports.put("995","pop3s"); - } - - /** - * Given a port number returns a text description of that port number. - * @param i this port number as an int. - */ - public static Object get(int i) { - if(ports.isEmpty()) { initialize();} - return ports.get((new Integer(i)).toString()); - } - - /** - * Given a port number returns a text description of that port number. - * @param i this port number as a String. - */ - public static Object get(String i) { - if(ports.isEmpty()) { initialize();} - return ports.get(i); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/PrefixInfo.java b/cvsroot/src/com/ibm/as400/util/commtrace/PrefixInfo.java deleted file mode 100644 index 70e983b66..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/PrefixInfo.java +++ /dev/null @@ -1,118 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrefixInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * A PrefixInfo Header.
    - * Extends NDOption's methods to parse, print, and allow easy access to the PrefixInfo Header - */ -public class PrefixInfo extends NDOption { - private Field prefixlen= new Dec(rawheader.slice(16, 8)); - private Field l= new Flag(rawheader.slice(24, 1)); - private Field a= new Flag(rawheader.slice(25, 1)); - private Field validlifetime= new Dec(rawheader.slice(64, 32)); - private Field preferredlifetime= new Dec(rawheader.slice(96, 32)); - private Field prefix= new IP6Address(rawheader.slice(128, 128)); - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - PrefixInfo(BitBuf data) { - super(data); - super.type= PREFIXINFO; - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - - Object[] args= - { ndtype, length, prefixlen, l, a, validlifetime, preferredlifetime, prefix }; - return Formatter.jsprintf( - "\t " - + OPTDATA - + ": " - + TYPE - + ": {0,3,R} " - + LEN - + ": {1,3,R}\n" - + "\t\t\t\t " - + PFXLEN - + ": {2,3,R} L: {3} A: {4} " - + VLDLIFETIME - + ": {5,10,R} " - + PRETIME - + ": {6,10,R}" - + "\t\t\t\t " - + PFX - + ": {7}\n", - args) - + printHexHeader() - + printnext(filter); - } - - /** - * Returns the prefix length of this PrefixInfo header. - * @return String containing a decimal representation of the prefix length. - */ - public String getPrefixLength() { - return prefixlen.toString(); - } - - /** - * Returns the on-link flag of this PrefixInfo header. - * @return String containing a Byte.toString(byte) representation of this flag bit. - */ - public String getLFlag() { - return l.toString(); - } - - /** - * Returns the autonomous address-configuration flag of this PrefixInfo header. - * @return String containing a Byte.toString(byte) representation of this flag bit. - */ - public String getAFlag() { - return a.toString(); - } - - /** - * Returns the valid life time of this PrefixInfo header. - * @return String containing a decimal representation of the valid life time. - */ - public String getValidLifeTime() { - return validlifetime.toString(); - } - - /** - * Returns the preferred life time of this PrefixInfo header. - * @return String containing a decimal representation of the preferred life time. - */ - public String getPreferredLifeTime() { - return preferredlifetime.toString(); - } - - /** - * Returns the prefix of this PrefixInfo header. - * @return String containing a decimal representation of the prefix. - */ - public String getPrefix() { - return prefix.toString(); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Progress.java b/cvsroot/src/com/ibm/as400/util/commtrace/Progress.java deleted file mode 100644 index 92be35862..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Progress.java +++ /dev/null @@ -1,109 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Progress.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import javax.swing.JFrame; -import javax.swing.ProgressMonitor; -import com.ibm.as400.access.Trace; -import java.awt.Toolkit; - -/** - * To show a progress dialog while the file is being downloaded so our user knows what is happening. - */ -class Progress implements Runnable { - private ProgressMonitor progressMonitor; - private String msg,file,endmsg; - private int total; - private Thread progThread_; // Controls the execution of the Progress Dialog - private static final String CLASS="Progress"; - - /** - * Creates the ProgressDialog. - * @param file The name of the file we are monitoring. - * @param total The total number of records we are processing. - */ - public Progress(String action,int total,String description) { - this.total = total; - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".Progress() " + "Initializing Progress Dialog"); - } - progressMonitor = new ProgressMonitor(null, - action, - "", 0, total); - msg=action; - endmsg = "% of " + total + description; - } - - /** - * Updates the progress Bar. - * @param msg The number of records processed. - */ - public void updateProgress(int num) { - progressMonitor.setProgress(num); - progressMonitor.setNote((int)(((long)num)*100/((long)total)) + endmsg); - } - - /** - * Returns the currently running format Thread. - * @return Thread - */ - public Thread getThread() { - return progThread_; - } - - /** - * Sets the thread. - * @param Thread The thread this object is running under. - */ - public void setThread(Thread tr) { - progThread_ = tr; - } - - /** - * called when our thread is invoked with the Thread.start() method. - * @see Thread - */ - public void run() { - Thread myThread = Thread.currentThread(); - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".run() " + "Progress Dialog.getMillisToPopup():" + progressMonitor.getMillisToPopup()); - } - while(progThread_==myThread) { - if (progressMonitor.isCanceled()) { - progressMonitor.close(); - progThread_=null; - Toolkit.getDefaultToolkit().beep(); - } - try { - Thread.sleep(1000); - } catch (InterruptedException e){ - // the VM doesn't want us to sleep anymore, - // so get back to work - } - } - progThread_=null; - progressMonitor.close(); - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".run() " + "Closing Progress Dialog"); - } - } - - /** - * The state of the Progress Dialog. - * @return true if the dialog has been canceled. - */ - public boolean isCanceled() { - return progressMonitor.isCanceled(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Prolog.java b/cvsroot/src/com/ibm/as400/util/commtrace/Prolog.java deleted file mode 100644 index bedb679f2..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Prolog.java +++ /dev/null @@ -1,665 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Prolog.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.ResourceBundle; -import java.util.Properties; -import java.util.Date; -import java.util.Calendar; -import java.util.GregorianCalendar; - -/** - * Parses the 256 byte header of a trace and allows for printing and - * access to the fields of the Prolog
    - */ -public class Prolog { - private BitBuf data; // The raw data - private boolean invalidData = false; // If we are passed invalid data set this flag - private String IPaddr = null,IPaddr2 = null, fmtBroadcast = "Y"; // The user specified filter options - private String date = null; - private static String ALL_="*ALL", - NO_="*NO"; - - private Field ctsftrcd,/* Trace description */ - ctsfndob, /* ND object name */ - ctsfotyp, /* Object type and subtype */ - /* (OBJTYPE) */ - /* '1' - Line description */ - /* '2' - Network interface */ - /* '3' - Network Server */ - ctsfpro, /* Protocol */ - /* 'A' - ASYNC */ - /* 'B' - BSC */ - /* 'C' - ETHERNET */ - /* 'D' - DDI */ - /* 'E' - ECL(TOKEN-RING) */ - /* 'E' - ECL(TOKEN-RING) */ - /* 'F' - FRAME RELAY */ - /* 'H' - HDLC(X.25) */ - /* 'I' - ISDN */ - /* 'Q' - IDLC */ - /* 'S' - SDLC */ - /* STRCMNTRC variables */ - ctsfbuff, /* Buffer size in bytes */ - ctsfdatd, /* Data direction 1=Sent, */ - /* 2=received, 3=both */ - ctsfstpf, /* Stop on buffer full Y/N */ - ctsfstrb, /* Beginning bytes */ - ctsfendb, /* Ending bytes */ - ctsfctln, /* Controller name */ - ctsfusrd, /* Trace all user data */ - /* 'Y' - yes */ - /* 'N' - no */ - /* Trace filter options on strt */ - ctsffilt, /* LAN filter option */ - /* '0' - All data (no filtering)*/ - /* Filter by : */ - /* '1' - remote controller */ - /* '2' - remote MAC address */ - /* '3' - remote SAP */ - /* '4' - local SAP */ - /* '5' - IP protocol number */ - /* '6' - remote IP address */ - ctsfrctl, /* Remote controller name */ - ctsfrmac, /* Remote MAC address */ - ctsfrsap, /* Remote SAP address */ - ctsflsap, /* Local SAP address */ - ctsfipv6, /* Address filtering for IPv6 */ - /* on the start in case the IOP */ - /* adds support later */ - ctsfipv4, /* IP address IpV4 */ - ctsfipid, /* IP protocol # */ - ctsflmid, /* Trace LMI data */ - /* '0' - Normal trace */ - /* '6' - Exclude LMI */ - /* '3' - LMI only */ - /* ENDCMNTRC variables */ - ctsfsts, /* Status of trace */ - /* (STATUS) */ - /* 'STOP' - Stopped */ - /* 'ERR ' - Error */ - ctsfsttm, /* Start time of trace in */ - /* 8-byte TOD clock value */ - ctsfsptm, /* Stop time of trace in */ - /* 8-byte TOD clock value */ - ctsfbyts, /* Bytes collected */ - ctsfrecs, /* # records in the comm trace */ - ctsfmxpt, /* Max frame allowed by protocol*/ - ctsfmxdf, /* Max frame allowed by user */ - ctsfchls, /* # x.25 logical channels */ - ctsfbwrp, /* Buffer wrapped Y/N */ - ctsfrect, /* Record timer length 2/4 bytes*/ - ctsfdtyp; - - // Constants for the format Prolog - private String PTITLE, - PTRACDES, - PCFGOBJ, - POTYPE, - POTYPEH, - POBJPROT, - PSTRTIME, - PENDTIME, - PBYTECOL, - PBUFSIZ, - PBUFSIZH, - PDATDIR, - PDATDIRH, - PBUFWRP, - PBUFWRPH, - PBYTES, - PBYTESB, - PBYTESBH, - PBYTESE, - PBYTESEH, - PFORMAT, - PCDNAME, - PCDNAMEH, - PDATTYP, - PDATTYPH, - PFMTTCP, - PIPADDR, - PIPADDRH, - PIPPORT, - PIPPORTH, - PETHDAT, - PETHDATH, - PBDCAST, - PFMTOH, - PRMTCD, - PRMTMAC, - PRMTSAP, - PLCLSAP, - PPIPID, - PRMTIP, - PRMTALLH; - - private final static String ETH = "ETHERNET"; - private final static String TOKEN = "TOKENRING"; - private final static String CALC = "*CALC"; - - /** - * Creates a prolog. Which parses the 256 bytes of raw data.
    - * @param data BitBuf which contains the raw prolog data. - * @param IPaddr the IP address to be filtered on. - * @param IPaddr2 the IP address to be filtered on. - * @param fmtBroadcast boolean specifying wether or not to format broadcast data. - */ - Prolog(BitBuf data,FormatProperties filter) { - this.data = data; - String IPaddr = filter.getIPAddress(); - if(IPaddr==null) { - this.IPaddr = ALL_; - } else { - this.IPaddr = IPaddr; - } - String IPaddr2 = filter.getSecondIPAddress(); - if(IPaddr2==null) { - this.IPaddr2=ALL_; - } else { - this.IPaddr2 = IPaddr2; - } - String fmtBroadcast = filter.getBroadcast(); - if(fmtBroadcast==null) { - this.fmtBroadcast = NO_; - } else { - this.fmtBroadcast = fmtBroadcast; - } - - parseData(); - } - - /** - * Parses the data so we can easily access variables in the prolog. - */ - private void parseData() { - // Get the MRI for the prolog - PTITLE=ResourceBundleLoader_ct.getText("PTITLE"); - PTRACDES=ResourceBundleLoader_ct.getText("PTRACDES"); - PCFGOBJ=ResourceBundleLoader_ct.getText("PCFGOBJ"); - POTYPE=ResourceBundleLoader_ct.getText("POTYPE"); - POTYPEH=ResourceBundleLoader_ct.getText("POTYPEH"); - POBJPROT=ResourceBundleLoader_ct.getText("POBJPROT"); - PSTRTIME=ResourceBundleLoader_ct.getText("PSTRTIME"); - PENDTIME=ResourceBundleLoader_ct.getText("PENDTIME"); - PBYTECOL=ResourceBundleLoader_ct.getText("PBYTECOL"); - PBUFSIZ=ResourceBundleLoader_ct.getText("PBUFSIZ"); - PBUFSIZH=ResourceBundleLoader_ct.getText("PBUFSIZH"); - PDATDIR=ResourceBundleLoader_ct.getText("PDATDIR"); - PDATDIRH=ResourceBundleLoader_ct.getText("PDATDIRH"); - PBUFWRP=ResourceBundleLoader_ct.getText("PBUFWRP"); - PBUFWRPH=ResourceBundleLoader_ct.getText("PBUFWRPH"); - PBYTES=ResourceBundleLoader_ct.getText("PBYTES"); - PBYTESB=ResourceBundleLoader_ct.getText("PBYTESB"); - PBYTESBH=ResourceBundleLoader_ct.getText("PBYTESBH"); - PBYTESE=ResourceBundleLoader_ct.getText("PBYTESE"); - PBYTESEH=ResourceBundleLoader_ct.getText("PBYTESEH"); - PFORMAT=ResourceBundleLoader_ct.getText("PFORMAT"); - PCDNAME=ResourceBundleLoader_ct.getText("PCDNAME"); - PCDNAMEH=ResourceBundleLoader_ct.getText("PCDNAMEH"); - PDATTYP=ResourceBundleLoader_ct.getText("PDATTYP"); - PDATTYPH=ResourceBundleLoader_ct.getText("PDATTYPH"); - PFMTTCP=ResourceBundleLoader_ct.getText("PFMTTCP"); - PIPADDR=ResourceBundleLoader_ct.getText("PIPADDR"); - PIPADDRH=ResourceBundleLoader_ct.getText("PIPADDRH"); - PIPPORT=ResourceBundleLoader_ct.getText("PIPPORT"); - PIPPORTH=ResourceBundleLoader_ct.getText("PIPPORTH"); - PETHDAT=ResourceBundleLoader_ct.getText("PETHDAT"); - PETHDATH=ResourceBundleLoader_ct.getText("PETHDATH"); - PBDCAST=ResourceBundleLoader_ct.getText("PBDCAST"); - PFMTOH=ResourceBundleLoader_ct.getText("PFMTOH"); - PRMTCD=ResourceBundleLoader_ct.getText("PRMTCD"); - PRMTMAC=ResourceBundleLoader_ct.getText("PRMTMAC"); - PRMTSAP=ResourceBundleLoader_ct.getText("PRMTSAP"); - PLCLSAP=ResourceBundleLoader_ct.getText("PLCLSAP"); - PPIPID=ResourceBundleLoader_ct.getText("PPIPID"); - PRMTIP=ResourceBundleLoader_ct.getText("PRMTIP"); - PRMTALLH=ResourceBundleLoader_ct.getText("PRMTALLH"); - // Parse 256 bytes of header data. - ctsftrcd = new Char(data.slice(0,160)); - ctsfndob = new Char(data.slice(160,80)); - ctsfotyp = new Char(data.slice(240,8)); - ctsfpro = new Char(data.slice(248,8)); - // 28 Bytes not used - ctsfbuff = new Dec(data.slice(480,32)); - ctsfdatd = new Char(data.slice(512,8)); - ctsfstpf = new Char(data.slice(520,8)); - ctsfstrb = new Dec(data.slice(528,16)); - ctsfendb = new Dec(data.slice(544,16)); - ctsfctln = new Char(data.slice(560,80)); - ctsfusrd = new Char(data.slice(640,8)); - ctsffilt = new Char(data.slice(648,8)); - ctsfrctl = new Char(data.slice(656,80)); - ctsfrmac = new Char(data.slice(736,48)); - ctsfrsap = new Char(data.slice(784,16)); - ctsflsap = new Char(data.slice(800,16)); - // 2 Bytes not used - ctsfipv6 = new Dec(data.slice(832,16)); - ctsfipv4 = new Dec(data.slice(960,32)); - ctsfipid = new Dec(data.slice(992,16)); - ctsflmid = new Char(data.slice(1008,8)); - // 59 Bytes not used - ctsfsts = new Char(data.slice(1488,32)); - ctsfsttm = new Dec(data.slice(1520,64)); - ctsfsptm = new Dec(data.slice(1584,64)); - // 2 Bytes not used - ctsfbyts = new Dec(data.slice(1664,32)); - ctsfrecs = new Dec(data.slice(1696,32)); - ctsfmxpt = new Dec(data.slice(1728,16)); - ctsfmxdf = new Dec(data.slice(1744,16)); - ctsfchls = new Dec(data.slice(1760,16)); - ctsfbwrp = new Char(data.slice(1776,8)); - ctsfrect = new Char(data.slice(1784,8)); - ctsfdtyp = new Char(data.slice(1792,8)); - // 30 Bytes not used - } - - /** - * return the number of records in this communication trace. - * @return The number of records - */ - public int getNumRecs() { - return Integer.parseInt(ctsfrecs.toString()); - } - - /** - * return the title of this communication trace - * @return The title - */ - public String getTitle() { - return PTITLE; - } - - /** - * return the current date in the Date.toString() format. - * @return String - */ - public String getDate() { - return date; - } - - /** - * returns if there was an error parsing the data provided - * @return true if this file contains invalid data, else returns false - */ - public boolean invalidData() { - return invalidData; - } - - /** - * Returns the number of bytes collected during this communication trace . - * @return Number of bytes collected - */ - public int getNumBytes() { - return Integer.parseInt(ctsfbyts.toString()); - } - - /** - * Returns a printable representation of this Prolog. - * @return Returns a string representation of this Prolog. - */ - public String toString() { - StringBuffer formattedData = new StringBuffer(256000); // The formatted data - String ctsfpros = ctsfpro.toString(); // The line protocol - String ctsfprofs; - if(ctsfpros.equals("E") || ctsfpros.equals("C")) { // Tokenring or Ethernet? - formattedData.append(PTITLE + "\n"); - - Calendar cal = new GregorianCalendar(); // Get the current time - cal.setTime((new Date(System.currentTimeMillis()))); - date =(cal.getTime()).toString() + "\n"; - formattedData.append(date); // Append the current time to the file header - - if(ctsfpros.equals("C")) { - ctsfprofs = (ETH); - } else { - ctsfprofs = (TOKEN); - } - Object[] args = - { - ctsftrcd, - ctsfndob, - ctsfotyp, - ctsfprofs}; - - formattedData.append(Formatter.jsprintf( - PTRACDES + " {0,20,L}\n" + - PCFGOBJ + " {1,10,L}\n" + - POTYPE + " {2,13,L}" + POTYPEH + "\n" + - POBJPROT + " {3,13,L}\n",args)); - - formattedData.append(PSTRTIME); - - Time start = new Time(Long.parseLong((ctsfsttm.toString()))); // Convert the timestamp into a readable date - formattedData.append(" " + start.toString() + "\n"); - - formattedData.append(PENDTIME); - - Time end = new Time(Long.parseLong((ctsfsptm.toString()))); - formattedData.append(" " + end.toString() + "\n"); - - String ctsfstrbs = ctsfstrb.toString(), - ctsfendbs = ctsfendb.toString(); - if(ctsfstrbs.equals("0") || ctsfstrbs.equals("100")) { - ctsfstrbs=CALC; - } - if(ctsfendbs.equals("0")) { - ctsfendbs=CALC; - } - - Object [] args2 = { - ctsfbyts, - ctsfbuff, - ctsfdatd, - ctsfstpf, - ctsfstrbs, - ctsfendbs, - CALC, - "Y", - IPaddr, - IPaddr2, - ALL_, - fmtBroadcast}; - - formattedData.append(Formatter.jsprintf( - PBYTECOL + " {0,13,L}\n" + - PBUFSIZ + " {1,13,L}" + PBUFSIZH + "\n" + - PDATDIR + " {2,13,L}" + PDATDIRH + "\n" + - PBUFWRP + " {3,13,L}" + PBUFWRPH + "\n" + - PBYTES + "\n" + - PBYTESB + " {4,13,L}" + PBYTESBH + "\n" + - PBYTESE + " {5,13,L}" + PBYTESEH + "\n" + - PFORMAT + "\n" + - PDATTYP + " {6,13,L}" + PDATTYPH + "\n" + - PFMTTCP + " {7,13,L}" + PFMTOH + "\n" + - PIPADDR + " {8,13,L}" + PIPADDRH + "\n" + - PIPADDR + " {9,13,L}" + PIPADDRH + "\n" + - PIPPORT + " {10,13,L}" + PIPADDRH + "\n" + - PBDCAST + " {11,13,L}" + PFMTOH + "\n",args2)); - } else { - formattedData.append(ResourceBundleLoader_ct.getText("NotSupported")); - invalidData = true; - } - return formattedData.toString(); - } - - /** - * Returns the trace description. - * @return String containing the trace description. - */ - public String getTraceDescription() { - return ctsftrcd.toString(); - } - - /** - * Returns the ND object name. - * @return String containing ND object name. - */ - public String getNDObject() { - return ctsfndob.toString(); - } - - /** - * Returns the Object type and subtype:
    - * '1' - Line description
    - * '2' - Network interface
    - * '3' - Network Server
    - * @return String containing a the Object type and subtype. - */ - public String getObjectType() { - return ctsfotyp.toString(); - } - - /** - * Returns the protocol:
    - * 'A' - ASYNC
    - * 'B' - BSC
    - * 'C' - ETHERNET
    - * 'D' - DDI
    - * 'E' - ECL(TOKEN-RING)
    - * 'E' - ECL(TOKEN-RING)
    - * 'F' - FRAME RELAY
    - * 'H' - HDLC(X.25)
    - * 'I' - ISDN
    - * 'Q' - IDLC
    - * 'S' - SDLC
    - * @return String containing the protocol. - */ - public String getProtocol() { - return ctsfpro.toString(); - } - - /** - * Returns the buffer size in bytes. - * @return String containing buffer size in bytes. - */ - public String getBuffSize() { - return ctsfbuff.toString(); - } - - /** - * Returns the data direction:
    - * 1=Sent
    - * 2=received
    - * 3=both
    - * @return String containing the data direction. - */ - public String getDataDirection() { - return ctsfdatd.toString(); - } - - /** - * returns Stop on Buffer full. - * @return String containing the code(Y/N). - */ - public String getStopFull() { - return ctsfstpf.toString(); - } - - /** - * Returns the beginning bytes. - * @return String containing the beginning bytes. - */ - public String getStartBytes() { - return ctsfstrb.toString(); - } - - /** - * Returns the ending bytes. - * @return String containing the ending bytes. - */ - public String getEndingBytes() { - return ctsfendb.toString(); - } - - /** - * Returns the Controller name. - * @return String containing the controller name. - */ - public String getControllerName() { - return ctsfctln.toString(); - } - - /** - * Returns if traced all user data. - * @return String containing the code(Y/N). - */ - public String getUserData() { - return ctsfusrd.toString(); - } - - /** - * Returns the Lan Filter option.
    - * Filter by :
    - * '0' - All data (no filtering)
    - * '1' - remote controller
    - * '2' - remote MAC address
    - * '3' - remote SAP
    - * '4' - local SAP
    - * '5' - IP protocol number
    - * '6' - remote IP address
    - * @return String containing the code. - */ - public String getLANFilter() { - return ctsffilt.toString(); - } - - /** - * Returns the remote controller name. - * @return String containing the remote controller name. - */ - public String getRmtContName() { - return ctsfrmac.toString(); - } - /** - * Returns remote MAC address. - * @return String containing the remote MAC address. - */ - public String getRmtMacAddr() { - return ctsfrmac.toString(); - } - - /** - * Returns remote SAP address. - * @return String containing the remote SAP address. - */ - public String getRmtSAP() { - return ctsfrsap.toString(); - } - - /** - * Returns local SAP address. - * @return String containing the local SAP address. - */ - public String getLocalSAP() { - return ctsflsap.toString(); - } - - /** - * Returns address filtering for IPv6. - * @return String containing the code. - */ - public String getFilterIPv6() { - return ctsfipv6.toString(); - } - - /** - * Returns IP address IPv4. - * @return String containing the address. - */ - public String getIPv4() { - return ctsfipv4.toString(); - } - - /** - * Returns IP protocol number. - * @return String containing ip protocol number. - */ - public String getIPID() { - return ctsfipid.toString(); - } - - /** - * Returns trace LMI data"
    - * '0' - Normal trace
    - * '6' - Exclude LMI
    - * '3' - LMI only
    - * @return String containing the code. - */ - public String getLMIData() { - return ctsflmid.toString(); - } - - /** - * Returns status of trace:
    - * 'STOP' - Stopped
    - * 'ERR ' - Error
    - * @return String containing the status. - */ - public String getStatus() { - return ctsfsts.toString(); - } - - /** - * Returns Start time of trace in 8-byte TOD clock value. - * @return String containing the start time. - */ - public String getStartTime() { - return ctsfsttm.toString(); - } - - /** - * Returns stop time of trace in 8-byte TOD clock value. - * @return String containing the stop time. - */ - public String getStopTime() { - return ctsfsptm.toString(); - } - - /** - * Returns bytes collected. - * @return String containing the number of bytes collected. - */ - public String getBytesCollected() { - return ctsfbyts.toString(); - } - - /** - * Returns max frame allowed by protocol. - * @return String containing the max frame. - */ - public String getMaxFrameProtocol() { - return ctsfmxpt.toString(); - } - - /** - * Returns max frame allowed by user. - * @return String containing the max frame. - */ - public String getMaxFrameUser() { - return ctsfmxdf.toString(); - } - - /** - * Returns number of x.25 logical channels. - * @return String containing the code. - */ - public String getChannels() { - return ctsfchls.toString(); - } - - /** - * Returns if buffer wrapped Y/N. - * @return String containing the code. - */ - public String getBufferWrap() { - return ctsfbwrp.toString(); - } - - /** - * Returns record timer length 2/4 bytes. - * @return String containing the length. - */ - public String getRecTimer() { - return ctsfmxpt.toString(); - } - - /** - * Returns the type. - * @return String containing the type. - */ - public String getType() { - return ctsfdtyp.toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Read.java b/cvsroot/src/com/ibm/as400/util/commtrace/Read.java deleted file mode 100644 index 1905510e6..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Read.java +++ /dev/null @@ -1,176 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Read.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.IFSFileInputStream; -import com.ibm.as400.access.Trace; -import java.io.BufferedOutputStream; -import java.io.FileOutputStream; -import java.io.File; -import java.io.IOException; -import javax.swing.JOptionPane; - -/** - * The Read class is used to read an IFS file down from an IBM i system and store it - * in the local PC.
    - * A Progress Dialog is displayed and updated so the user is kept current as to - * the progression of the download. - */ -class Read implements Runnable { - - private String rmtfile, // The remote file to download - lclfile; // The local file to save to - private AS400 sys; // The system to connect to - private CommTrace comm; // The commtrace object so we manage our thread - private Progress pro; // The progress Dialog - private Thread proThread; // The progress dialog thread - // The tread to transfer a file to the local PC - private Thread readThread_= null; - private int bytes= 0; // The number of bytes read - - private static final String CLASS = "Read"; - - /** - * Creates a read object which will open an IFSFileStream on the remote file - * from the given system and read into the local file. - * @param rmtfile Path of the remote file to download - * @param lclfile Path of the local file to save to - * @param sys The system to connect to - */ - public Read(CommTrace comm, String rmtfile, String lclfile, AS400 sys) { - this.comm= comm; - this.rmtfile= rmtfile; - this.lclfile= lclfile; - this.sys= sys; - } - - /** - * Transfers the file to the local PC. - */ - public void run() { - byte[] tmp= null; - int len= 0; - bytes= 0; - Thread myThread= Thread.currentThread(); - - while (readThread_ == myThread) { - IFSFileInputStream file= null; - BufferedOutputStream out= null; - try { - file= new IFSFileInputStream(sys, rmtfile); - out= new BufferedOutputStream(new FileOutputStream(lclfile)); - pro= new Progress(("Retrieving " + rmtfile), file.available(), " bytes"); - proThread= new Thread(pro, "ProgDiag"); - proThread.start(); - - int filesize= file.available(); - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".run() " + "Transfer file size:" + filesize); - } - - int selection= - JOptionPane.showConfirmDialog( - CommTrace.getMainFrame(), - "Start transfer of " + rmtfile + "(" + (filesize / 1024) + " KB)?", - "Transfer", - JOptionPane.YES_NO_OPTION); - if (selection == 1) { // The user cancled the download - return; - } else if (selection == 0) { // The user okayed the download - byte[] data= new byte[4096]; - - // Read while there is data, the Progress dialog isn't cancled, - // and the thread is still running - while ((len= file.read(data)) != -1 - && !pro.isCanceled() - && readThread_ != null) { - // Create an array the size of our read. - tmp= new byte[len]; - // Copy from input buffer to tmp buffer - System.arraycopy(data, 0, tmp, 0, len); - // Write tmp to file. - out.write(tmp); - // Increment the total byte counter - bytes += len; - pro.updateProgress(bytes); - } - // The transfer was canceled so delete the file - if (pro.isCanceled() || readThread_ == null) { - file.close(); - out.close(); - File local= new File(lclfile); - if (local.exists()) { - local.delete(); - } - } - } - } catch (IOException e) { - CommTrace.error("File Error", "Error reading/writing file"); - } catch (AS400SecurityException e) { - CommTrace.error("Security Error", "Security problem opening file"); - } - if (!pro.isCanceled() && readThread_ != null) { - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".run() " + "Transfering completed"); - } - JOptionPane.showMessageDialog( - CommTrace.getMainFrame(), - "Transfer of " + rmtfile + " completed", - "Transfer Complete", - JOptionPane.INFORMATION_MESSAGE); - } - readThread_= null; // Tell everyone we are done - - try { - file.close(); - out.close(); - } catch (IOException e) { - CommTrace.error("File Error", "Error closing file"); - } catch (NullPointerException e) { - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // the VM doesn't want us to sleep anymore, - // so get back to work - } - } - } - - /** - * Returns the number of bytes that have been read off this stream. - * @return The number of bytes - */ - public int getBytesRead() { - return bytes; - } - - /** - * Returns the thread that this read process is executing under. - * @returns Thread - */ - public Thread getThread() { - return readThread_; - } - - /** - * Sets the thread this process is executing under. - * @param Thread The thread to execute under - */ - public void setThread(Thread thread) { - readThread_= thread; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Redirect.java b/cvsroot/src/com/ibm/as400/util/commtrace/Redirect.java deleted file mode 100644 index 0a340f219..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Redirect.java +++ /dev/null @@ -1,79 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Redirect.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * A Redirect Header.
    - * Extends Message's methods to parse, print, and allow easy access to the Redirect Header - */ -public class Redirect extends Message { - private Field target= new IP6Address(rawheader.slice(32, 128)); - private Field destination= new IP6Address(rawheader.slice(160, 128)); - - /** - * Returns the next header in the packet - * @return Will always return a NDOption header - */ - public Header getNextHeader() { - return NDOption.createNDOption(rawpayload); - } - - /** - * Creates and parses the data of this header - * @param data The raw data of this header - */ - Redirect(BitBuf data) { - super(data); - super.type= REDR; - } - - /** - * Returns the length of this header. - * @return Will always return 288. - */ - public int getHeaderLen() { - return 288; - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - - Object[] args= { target, destination }; - return Formatter.jsprintf(TARGET + ": {0}\n" + "\t" + DST + ": {1}\n", args) - + printHexHeader() - + printnext(filter); - } - - /** - * Returns the target address of this Redirect Message. - * @return String containing a IPv6 address. - */ - public String getTarget() { - return target.toString(); - } - - /** - * Returns the destination address of this Redirect Message. - * @return String containing a IPv6 address. - */ - public String getDestination() { - return destination.toString(); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/RedirectedHeader.java b/cvsroot/src/com/ibm/as400/util/commtrace/RedirectedHeader.java deleted file mode 100644 index c418779e0..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/RedirectedHeader.java +++ /dev/null @@ -1,74 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RedirectedHeader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * A Redirected Header.
    - * Extends NDOption's methods to parse, print, and allow easy access to the Redirected Header. - */ -class RedirectedHeader extends NDOption { - private Field prefixlen= new Dec(rawheader.slice(16, 8)); - private IP6Header packet= new IP6Header(rawheader.slice(64)); - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - RedirectedHeader(BitBuf data) { - super(data); - super.type= REDIRECTED; - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - Object[] args= { ndtype, length, prefixlen, packet }; - return Formatter.jsprintf( - "\t " - + OPTDATA - + ": " - + TYPE - + ": {0,3,R} " - + LEN - + ": {1,3,R} " - + PFXLEN - + ": {2,3,R}\n" - + printHexHeader() - + PKT - + ":\n", - args) - + packet.toString(filter); - } - - /** - * Returns the prefix length of this RedirectedHeader Header. - * @return String containing a decimal representation of the prefix length. - */ - public String getPrefixLength() { - return prefixlen.toString(); - } - - /** - * Returns the redirected IP6Header. - * @return IP6Header - */ - public IP6Header getPacket() { - return packet; - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/ResourceBundleLoader_ct.java b/cvsroot/src/com/ibm/as400/util/commtrace/ResourceBundleLoader_ct.java deleted file mode 100644 index 8215a36f2..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/ResourceBundleLoader_ct.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceBundleLoader_ct.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - - -// A class representing the ResourceBundleLoader_ct object which is used to load the resource bundle. -class ResourceBundleLoader_ct -{ - private static MissingResourceException resourceException_; // Set if there is an exception during the loading of the resource bundle - private static ResourceBundle coreResources_; // Core toolbox resources @B2A - - static - { - try { - coreResources_ = ResourceBundle.getBundle("com.ibm.as400.util.commtrace.CTMRI"); - } - catch(MissingResourceException e) { - resourceException_ = e; - } - } - - // No need to create instances of this class, all methods are static - private ResourceBundleLoader_ct() - { - } - - // Returns the text associated with the exception. - // @param textId the id which identifies the message text to return. - // @return the translatable text which describes the exception. - static final String getText(String textId) - { - if (coreResources_ == null) { - throw resourceException_; - } - - try { - return coreResources_.getString(textId); - } - catch (MissingResourceException e) { - throw e; - } - } -} - diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/RouterAdvertisement.java b/cvsroot/src/com/ibm/as400/util/commtrace/RouterAdvertisement.java deleted file mode 100644 index 341ff0b51..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/RouterAdvertisement.java +++ /dev/null @@ -1,132 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RouterAdvertisement.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * A Router Advertisement Header.
    - * Extends Message's methods to parse, print, and allow easy access to the - * Router Advertisement Header. - * - */ -public class RouterAdvertisement extends Message { - private Field curhoplimit= new Dec(rawheader.slice(0, 8)); - private Field m= new Flag(rawheader.slice(8, 1)); - private Field o= new Flag(rawheader.slice(9, 1)); - private Field routerlifetime= new Dec(rawheader.slice(16, 16)); - private Field reachabletime= new Dec(rawheader.slice(32, 32)); - private Field retranstimer= new Dec(rawheader.slice(64, 32)); - - /** - * Returns the next header in the packet. - * @return Will always return a NDOption header. - */ - public Header getNextHeader() { - return NDOption.createNDOption(rawpayload); - } - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - RouterAdvertisement(BitBuf data) { - super(data); - super.type= RTRADV; - } - - /** - * Returns the length of this header. - * @return Will always return 96. - */ - public int getHeaderLen() { - return 96; - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - - Object[] args= - { curhoplimit, m, o, routerlifetime, reachabletime, retranstimer }; - return Formatter.jsprintf( - CURHOPLIMIT - + ": {0,3,R} " - + M - + ": {1} " - + O - + ": {2}\n" - + "\t\t" - + RTRLIFETIME - + ": {3,5,R} " - + RCHTIME - + ": {4,10,R} " - + RETRANSTIME - + ": {5,10,R}\n", - args) - + printHexHeader() - + printnext(filter); - } - - /** - * Returns the current hop limit of this RouterAdvertisement Message. - * @return String containing a decimal representation of the current hop limit. - */ - public String getCurrentHopLimit() { - return curhoplimit.toString(); - } - - /** - * Returns the "Managed address configuration" flag of this RouterAdvertisement Message. - * @return String containing a Byte.toString(byte) representation of the flag. - */ - public String getMFlag() { - return m.toString(); - } - - /** - * Returns the "Other stateful configuration" flag of this RouterAdvertisement Message. - * @return String containing a Byte.toString(byte) representation of the flag. - */ - public String getOFlag() { - return o.toString(); - } - - /** - * Returns the router life time of this RouterAdvertisement Message. - * @return String containing a decimal representation of the router life time. - */ - public String getRouterLifeTime() { - return routerlifetime.toString(); - } - - /** - * Returns the reachable time of this RouterAdvertisement Message. - * @return String containing a decimal representation of the reachable time. - */ - public String getReachableTime() { - return reachabletime.toString(); - } - - /** - * Returns the retrans Time of this RouterAdvertisement Message. - * @return String containing a decimal representation of the retrans timer. - */ - public String getRetransTimer() { - return retranstimer.toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/RouterSolicitation.java b/cvsroot/src/com/ibm/as400/util/commtrace/RouterSolicitation.java deleted file mode 100644 index 831f17827..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/RouterSolicitation.java +++ /dev/null @@ -1,47 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RouterSolicitation.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -/** - * A Router Solicitation Header.
    - * Extends Message's methods to parse, print, and allow easy access to the - * Router Solicitation Header. - */ -public class RouterSolicitation extends Message { - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - RouterSolicitation(BitBuf data) { - super(data); - super.type= RTRSOL; - } - - /** - * Returns the next header in the packet. - * @return Will always return a NDOption header. - */ - public Header getNextHeader() { - return NDOption.createNDOption(rawpayload); - } - - /** - * Returns the length of this header. - * @return Will always return 32. - */ - public int getHeaderLen() { - return 32; - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Routing.java b/cvsroot/src/com/ibm/as400/util/commtrace/Routing.java deleted file mode 100644 index f5ea6b3f7..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Routing.java +++ /dev/null @@ -1,37 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Routing.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -/** - * A Routing Header.
    - * Extends ExtHeader's methods to parse, print, and allow easy access to the Routing Header. - */ -public class Routing extends ExtHeader { - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - Routing(BitBuf data) { - super(data); - type= Header.EXTROUTE; - } - /** - * Returns the length of this header. - * @return The length of this header. - */ - public int getHeaderLen() { - return 64 + ((rawheader.getOctet(8) & 0xFF) * 64); - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/SourceLLA.java b/cvsroot/src/com/ibm/as400/util/commtrace/SourceLLA.java deleted file mode 100644 index 5ed806b36..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/SourceLLA.java +++ /dev/null @@ -1,64 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SourceLLA.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * A SouceLLA Header.
    - * Extends NDOption's methods to parse, print, and allow easy access to the SourceLLA Header. - */ -public class SourceLLA extends NDOption { - private Field address= new Hex(rawheader.slice(16)); - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - SourceLLA(BitBuf data) { - super(data); - super.type= SOURCELLA; - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - Object[] args= { ndtype, length, address }; - return Formatter.jsprintf( - "\t " - + OPTDATA - + ": " - + TYPE - + ": {0,3,R} " - + LEN - + ": {1,3,R} " - + ADDR - + ": {2}\n", - args) - + printHexHeader() - + printnext(filter); - } - - /** - * Returns the address of this SourceLLA header. - * @return A String with a decimal representation of the address. - */ - public String getAddress() { - return (new Dec(address.getData())).toString(); - } - -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/TCPHeader.java b/cvsroot/src/com/ibm/as400/util/commtrace/TCPHeader.java deleted file mode 100644 index 525d7cf4c..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/TCPHeader.java +++ /dev/null @@ -1,372 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: TCPHeader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; -import com.ibm.as400.access.Trace; - -/** - * A TCP Header.
    - * Extends Header's methods to parse, print, and allow easy access to the TCP Header. - */ -public class TCPHeader extends Header { - private Field sourceport= new Dec(rawheader.slice(0, 16)); - private Field destport= new Dec(rawheader.slice(16, 16)); - private Field sequence= new Dec(rawheader.slice(32, 32)); - private Field sequencehex= new Hex(rawheader.slice(32, 32)); - private Field acknum= new Dec(rawheader.slice(64, 32)); - private Field acknumhex= new Hex(rawheader.slice(64, 32)); - private Field dataoffset= new Dec(rawheader.slice(96, 4)); - private Field cwr= new Flag(rawheader.slice(104, 1), CWR, ""); - private Field ece= new Flag(rawheader.slice(105, 1), ECE, ""); - private Field urg= new Flag(rawheader.slice(106, 1), URG, ""); - private Field ack= new Flag(rawheader.slice(107, 1), ACK, ""); - private Field psh= new Flag(rawheader.slice(108, 1), PSH, ""); - private Field rst= new Flag(rawheader.slice(109, 1), RST, ""); - private Field syn= new Flag(rawheader.slice(110, 1), SYN, ""); - private Field fin= new Flag(rawheader.slice(111, 1), FIN, ""); - private Field window= new Dec(rawheader.slice(112, 16)); - private Field checksum= new Hex(rawheader.slice(128, 16)); - private Field urgentptr= new Dec(rawheader.slice(144, 16)); - private Field options= - new Hex( - rawheader.slice(160, ((Integer.parseInt(dataoffset.toString()) * 8) - 40))); - private Field option= new Dec(rawheader.slice(160, 8)); - private Field msssize= new Dec(rawheader.slice(168, 8)); - private Field segmentsize= - new Dec(rawheader.slice(176, ((Integer.parseInt(msssize.toString()) * 8) / 2))); - - private final static String CLASS="TCPHeader"; - private final static String CWR= "CWR "; - private final static String ECE= "ECE "; - private final static String URG= "URG "; - private final static String ACK= "ACK "; - private final static String PSH= "PSH "; - private final static String RST= "RST "; - private final static String SYN= "SYN "; - private final static String FIN= "FIN "; - private final static String UNASSIGNED= "Unassigned"; - private final static String MSS= "MSS="; - private final static String NOOP= "NO OP"; - private final static String ENDOP= "END OP"; - private final static String BADOP= "BAD OP"; - private final static String NONE= "NONE"; - private final static String TCPSTR= "TCP"; - private final static String SRC= "SrcPort"; - private final static String DST= "DstPort"; - private final static String SEQ= "SeqNum"; - private final static String ACKNUM= "AckNum"; - private final static String FLAGS= "Flags"; - private final static String DATAOFF= "DataOffset"; - private final static String CHKSUM= "Checksum"; - private final static String WINSIZE= "Window Size"; - private final static String TCPOPT= "TCP Options"; - - /** - * Creates and parses the data of this header - * @param data The raw data of this header - */ - TCPHeader(BitBuf data) { - super(data); - - type= TCP; - } - - /** - * Returns the length of this header. - * @return The length of this header. - */ - public int getHeaderLen() { - return rawheader.slice(96, 4).toInt() * 32; - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - - String portname= (String) Port.get(this.sourceport.toString()); - String portname2= (String) Port.get(this.destport.toString()); - - // Make sure we have enough data to parse a full header - if (rawheader.getBitSize() < getHeaderLen()) { - return (new Data(rawheader)).toString(); - } - - // Check for Port filtering - if (filter!=null) { // If filter is enabled - boolean print= false; - String port= filter.getPort(); - if (port == null) { - print= true; // The filtering doesn't apply to this header - } else if ( - port.equals(sourceport.toString()) || port.equals(destport.toString())) { - print= true; - } - if (!print) { // Don't print the packet - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".toString()" + "Not printing record"); - } - return ""; // Return empty record because it didn't pass the filter - } - } - - // If we couldn't find the port name, set it to Unassigned - if (portname == null) { - portname= UNASSIGNED; - } - if (portname2 == null) { - portname2= UNASSIGNED; - } - String sourceport= this.sourceport.toString() + ", " + portname; - String destport= this.destport.toString() + ", " + portname2; - - Object[] args= - { - sourceport, - destport, - acknum, - acknumhex, - sequence, - sequencehex, - dataoffset, - cwr, - ece, - urg, - ack, - psh, - rst, - syn, - fin, - window, - checksum, - options, - segmentsize }; - - if (Integer.parseInt(dataoffset.toString()) > 0x05) { - switch (Integer.parseInt(option.toString())) { - case 2 : - args[17]= MSS; - break; - case 1 : - args[18]= ""; - args[17]= NOOP; - break; - case 0 : - args[18]= ""; - args[17]= ENDOP; - break; - default : - args[18]= ""; - args[17]= BADOP; - break; - } - } else { - args[18]= ""; - args[17]= NONE; - // 2 = MSS, 1 = NO OP, 0 = END OP - } - - return Formatter.jsprintf( - "\t " - + TCPSTR - + " . . . . : " - + SRC - + ": {0,18,L} " - + DST - + ": {1,18,L}\n" - + "\t\t\t " - + SEQ - + ": {4,10,L} " - + ACKNUM - + ": {2,10,L} {3,10,L} {5,10,L} " - + FLAGS - + ": {7}{8}{9}{10}{11}{12}{13}{14}\n" - + "\t\t\t " - + DATAOFF - + ": {7,2,L} " - + CHKSUM - + ": {16} " - + WINSIZE - + ": {15,5,L} " - + TCPOPT - + ": {17,5,L} {18,6,L}\n", - args) - + printHexHeader() - + printnext(filter) - + (new Data(rawpayload)).toString(); - } - - /** - * Returns the source port for this TCP header. - * @return String containing a decimal representation of the source port. - */ - public String getSrcPort() { - return sourceport.toString(); - } - - /** - * Returns the destination port for this TCP header. - * @return String containing a decimal representation of the destination port. - */ - public String getDstPort() { - return destport.toString(); - } - - /** - * Returns the sequence for this TCP header. - * @return String containing a decimal representation of the sequence. - */ - public String getSequence() { - return sequence.toString(); - } - - /** - * Returns the ack number for this TCP header. - * @return String containing a decimal representation of the ack number. - */ - public String getAckNum() { - return acknum.toString(); - } - - /** - * Returns the data offset for this TCP header. - * @return String containing a decimal representation of the data offset. - */ - public String getDataOffset() { - return dataoffset.toString(); - } - - /** - * Returns the cwr Flag for this TCP header. - * @return String if the field is a 1 this string will contain "CWR " otherwise it will be an empty string. - */ - public String getCWRFlag() { - return cwr.toString(); - } - - /** - * Returns the ece Flag for this TCP header. - * @return String if the field is a 1 this string will contain "ECE " otherwise it will be an empty string. - */ - public String getECEFlag() { - return ece.toString(); - } - - /** - * Returns the urg Flag for this TCP header. - * @return String if the field is a 1 this string will contain "URG " otherwise it will be an empty string. - */ - public String getURGFlag() { - return urg.toString(); - } - - /** - * Returns the ack Flag for this TCP header. - * @return String if the field is a 1 this string will contain "ACK " otherwise it will be an empty string. - */ - public String getACKFlag() { - return ack.toString(); - } - - /** - * Returns the psh Flag for this TCP header. - * @return String if the field is a 1 this string will contain "PSH " otherwise it will be an empty string. - */ - public String getPSHFlag() { - return psh.toString(); - } - - /** - * Returns the rst Flag for this TCP header. - * @return String if the field is a 1 this string will contain "RST " otherwise it will be an empty string. - */ - public String getRSTFlag() { - return rst.toString(); - } - - /** - * Returns the syn Flag for this TCP header. - * @return String if the field is a 1 this string will contain "SYN " otherwise it will be an empty string. - */ - public String getSYNFlag() { - return syn.toString(); - } - - /** - * Returns the fin Flag for this TCP header. - * @return String if the field is a 1 this string will contain "FIN " otherwise it will be an empty string. - */ - public String getFINFlag() { - return fin.toString(); - } - - /** - * Returns the window for this TCP header. - * @return String containing a decimal representation of the window. - */ - public String getWindow() { - return window.toString(); - } - - /** - * Returns the checksum for this TCP header. - * @return String containing a decimal representation of the checksum. - */ - public String getCheckSum() { - return (new Dec(checksum.getData())).toString(); - } - - /** - * Returns the urgent pointer for this TCP header. - * @return String containing a decimal representation of the urgent pointer. - */ - public String getUrgentPointer() { - return urgentptr.toString(); - } - - /** - * Returns the options for this TCP header. - * @return String containing a decimal representation of the options. - */ - public String getOptions() { - return (new Dec(options.getData())).toString(); - } - - /** - * Returns the first 8 bits of the options for this TCP header. - * @return String containing a decimal representation of the options. - */ - public String getOption() { - return options.toString(); - } - - /** - * Returns the Maximum Segment Size option for this TCP header. - * @return String containing a decimal representation of the Maximum Segment Size option. - */ - public String getMaximumSegmentSize() { - return msssize.toString(); - } - - /** - * Returns the Segment Size option for this TCP header. - * @return String containing a decimal representation of the Segment Size option. - */ - public String getSegmentSize() { - return segmentsize.toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/TargetLLA.java b/cvsroot/src/com/ibm/as400/util/commtrace/TargetLLA.java deleted file mode 100644 index bfa4e640d..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/TargetLLA.java +++ /dev/null @@ -1,64 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: TargetLLA.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * A TargetLLA Header.
    - * Extends NDOption's methods to parse, print, and allow easy access to the TargetLLA Header. - */ -public class TargetLLA extends NDOption { - private Field address= new Hex(rawheader.slice(16)); - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - TargetLLA(BitBuf data) { - super(data); - super.type= TARGETLLA; - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - Object[] args= { ndtype, length, address }; - return Formatter.jsprintf( - "\t " - + OPTDATA - + ": " - + TYPE - + ": {0,3,R} " - + LEN - + ": {1,3,R} " - + ADDR - + ": {2}\n", - args) - + printHexHeader() - + printnext(filter); - } - - /** - * Returns the address of this TargetLLA header. - * @return A String containing a decimal representation of the address. - */ - public String getAddress() { - return (new Dec(address.getData())).toString(); - } - -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/Time.java b/cvsroot/src/com/ibm/as400/util/commtrace/Time.java deleted file mode 100644 index 748bf2b3e..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/Time.java +++ /dev/null @@ -1,128 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Time.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.Date; - -/** - * Converts a 64 bit timestamp into a readable date and time - */ -class Time { - long mask= 0xFFFFFFFFFFC00000L; // Mask to and out uneeded bits - // Mask to and with if date is in 21st Century - long mask2= 0x7FFFFFFFFFC00000L; - long timestamp; - Calendar cal; - - /** - * Creates and calculates the timestamp - * @param timestamp The 64 bit timestamp - */ - public Time(long timestamp) { - this.timestamp= timestamp; - if (timestamp != 0) { - createCal(); - } - } - - /** - * Modifies the timestamp to remove unneeded bits and sets the time of the calendar. - */ - private void createCal() { - timestamp= (timestamp & mask2); - - // Remove unneeded bits - timestamp= timestamp >>> 16; - timestamp= ((timestamp / 64) * 1024); - timestamp += 946702800000000L; - timestamp /= 1000; - - // Used if you don't want milliseconds to be calculated - // timestamp /= 1000000; - // timestamp += 946702800; - // timestamp *= 1000; - - cal= new GregorianCalendar(); - Date d= new Date(timestamp); - cal.clear(); - cal.setTime(d); - } - - /** - * Returns the timestamp as a string in Calendar.getTime() format. - * @return The timestamp in the same format as Calendar.getTime(). - * @see Calendar - */ - public String toString() { - if (cal == null) { - return ""; - } else { - return (cal.getTime()).toString(); - } - } - - /** - * Returns the timestamp as a string in HH:MM:SS.mm format. - * @return The timestamp in HH:MM:SS.mm format. - * @see Calendar - */ - public String getTime() { - if (cal == null) { - return ""; - } else { - StringBuffer time = new StringBuffer(); - time.append(cal.get(Calendar.HOUR_OF_DAY)); - time.append(":"); - String min = Integer.toString(cal.get(Calendar.MINUTE)); - if(min.length()==1) { // If there is no leading 0 add one - time.append("0"); - time.append(min); - } else { // Otherwise just append the time - time.append(min); - } - time.append(":"); - String sec = Integer.toString(cal.get(Calendar.SECOND)); - int length = sec.length(); - if(length==1) { // If there is no leading 0 add one - time.append("0"); - time.append(sec); - } else { // Otherwise just append the time - time.append(sec); - } - time.append("."); - String millisec = Integer.toString(cal.get(Calendar.MILLISECOND)); - length = millisec.length(); - if(length==1) { // If there is no leading 0's add them - time.append("00"); - time.append(millisec); - } else if (length==2) { - time.append("0"); - time.append(millisec); - } else { // Otherwise just append the time - time.append(millisec); - } - return time.toString(); - } - } - - /** - * Returns the timestamp in milliseconds since the epoch(January 1, 1970, 00:00:00 GMT). - * @return long - */ - public long getTimeStamp() { - return timestamp; - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/TimeExceeded.java b/cvsroot/src/com/ibm/as400/util/commtrace/TimeExceeded.java deleted file mode 100644 index c0d048b52..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/TimeExceeded.java +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: TimeExceeded.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; - -/** - * A Time Exceeded Header.
    - * Extends Message's methods to parse, print, and allow easy access to the Time Exceeded Header. - */ -public class TimeExceeded extends Message { - /** - * Creates and parses the data of this header. - * @param data The raw data of this header . - */ - TimeExceeded(BitBuf data) { - super(data); - super.type= TIMEEXC; - } - - /** - * Returns the length of this header. - * @return Will always return 32. - */ - public int getHeaderLen() { - return 32; - } - - /** - * Returns the next header in the packet. - * @return Will always return a IP6Header. - */ - public Header getNextHeader() { - return new IP6Header(rawpayload); - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - return "\t\t\t" + OFFPKT + ":\n" + printnext(filter); - } - -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/UDPHeader.java b/cvsroot/src/com/ibm/as400/util/commtrace/UDPHeader.java deleted file mode 100644 index 6e5b7d158..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/UDPHeader.java +++ /dev/null @@ -1,156 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UDPHeader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import com.ibm.as400.access.Trace; -import java.util.Properties; - -/** - * An UDP Header.
    - * Extends Header's methods to parse, print, and allow easy access to the UDP Header. - */ -public class UDPHeader extends Header { - private Field sourceport= new Dec(rawheader.slice(0, 16)); - private Field destport= new Dec(rawheader.slice(16, 16)); - private Field length= new Dec(rawheader.slice(32, 16)); - private Field checksum= new Hex(rawheader.slice(48, 16)); - - private final static String CLASS = "UDPHeader"; - private final static String UNASSIGNED= "Unassigned"; - private final static String UDPSTR= "UDP"; - private final static String SRC= "SrcPort"; - private final static String DST= "DstPort"; - private final static String LEN= "Length"; - private final static String CHKSUM= "Checksum"; - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - UDPHeader(BitBuf data) { - super(data); - - type= UDP; - } - - /** - * Returns the length of this header. - * @return Will always return 64. - */ - public int getHeaderLen() { - return 64; - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - - // Check for Port filtering - if (filter!=null) { // If filter is enabled - boolean print= false; - String port= filter.getPort(); - if (port == null) { - print= true; // The filtering doesn't apply to this header - } else if ( - port.equals(sourceport.toString()) || port.equals(destport.toString())) { - print= true; - } - if (!print) { // Don't print the packet - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".toString() " + "Not printing record"); - } - return ""; // Return empty record because it didn't pass the filter - } - } - - String portname= (String) Port.get(this.sourceport.toString()); - String portname2= (String) Port.get(this.destport.toString()); - - // Make sure we have enough data to parse a full header - if (rawheader.getBitSize() < getHeaderLen()) { - return (new Data(rawheader)).toString(); - } - - if (portname == null) { - portname= UNASSIGNED; - } - if (portname2 == null) { - portname2= UNASSIGNED; - } - String sourceport= this.sourceport.toString() + ", " + portname; - String destport= this.destport.toString() + ", " + portname2; - Object[] args= { sourceport, destport, length, checksum }; - - return Formatter.jsprintf( - "\t " - + UDPSTR - + " . . . . : " - + SRC - + ": {0,18,L} " - + DST - + ": {1,18,L}\n" - + "\t\t\t " - + LEN - + ": {2,5,L} " - + CHKSUM - + ": {3}\n", - args) - + printHexHeader() - + printnext(filter) - + (new Data(rawpayload)).toString(); - } - - /** - * Returns the source port of this UDP Header. - * @return String containing a decimal representation of the source port. - */ - public String getSrcPort() { - return sourceport.toString(); - } - - /** - * Returns the destination port of this UDP Header. - * @return String containing a decimal representation of the destination port. - */ - public String getDstPort() { - return destport.toString(); - } - - /** - * Returns the length of this UDP Header. - * @return String containing a decimal representation of the length port. - */ - public String getLength() { - return length.toString(); - } - - /** - * Returns the raw data of this record. - * @return String containing a hexadecimal representation of the data. - */ - public String getData() { - return rawpayload.toHexString(); - } - - /** - * Returns the raw data of this record. - * @return byte[] containing the data. - */ - public byte[] getByteData() { - return rawpayload.getBytes(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/UnknownHeader.java b/cvsroot/src/com/ibm/as400/util/commtrace/UnknownHeader.java deleted file mode 100644 index 68b6ab7e2..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/UnknownHeader.java +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UnknownHeader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; -import com.ibm.as400.access.Trace; - -/** - * A Unknown Header.
    - * Extends Header's methods to parse, print, and allow easy access to the Unknown Header. - */ -public class UnknownHeader extends Header { - private final static String UNKHDR= "Unknown Header"; - private final static String CLASS= "UnknownHeader"; - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - UnknownHeader(BitBuf data) { - super(data); - } - - /** - * Returns a printable representation of this header. - * @param filter FormatProperties object for filtering this header. - * @return Returns a string representation of this header. - */ - public String toString(FormatProperties filter) { - // Check for IP filtering - if (filter!=null) { // If filter is enabled - boolean print= false; - if(filter.getIPAddress()==null && filter.getSecondIPAddress()==null && filter.getPort()==null) { - // None of the filters apply at the Header level so print out the Unknown Header - print=true; - } - if (!print) { // Don't print the packet - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { - Trace.log(Trace.INFORMATION,CLASS + ".toString() " + "Not printing record"); - } - return ""; - } - } - return "\t " + UNKHDR + ":\n" + (new Data(rawpayload)).toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/UnknownMessage.java b/cvsroot/src/com/ibm/as400/util/commtrace/UnknownMessage.java deleted file mode 100644 index e9788f371..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/UnknownMessage.java +++ /dev/null @@ -1,38 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UnknownMessage.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -/** - * A UnknownMessage Header.
    - * Extends Message's methods to parse, print, and allow easy access to the UnknownMessage Header. - */ -public class UnknownMessage extends Message { - - /** - * Creates and parses the data of this header. - * @param data The raw data of this header. - */ - UnknownMessage(BitBuf data) { - super(data); - super.type= MSGUNK; - } - - /** - * Returns the next header in this packet. - * @return Will always return null. - */ - public Header getNextHeader() { - return null; - } -} \ No newline at end of file diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/UnknownPacket.java b/cvsroot/src/com/ibm/as400/util/commtrace/UnknownPacket.java deleted file mode 100644 index 4aae71f77..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/UnknownPacket.java +++ /dev/null @@ -1,41 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UnknownPacket.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.commtrace; - -import java.util.Properties; -import com.ibm.as400.access.Trace; - -/** - * A Unknown IPPacket.
    - * Extends Packets's methods to parse, print, and allow easy access to the Unknown IPPacket. - */ -public class UnknownPacket extends IPPacket { - /** - * Creates and parses the data of this packet. - * @param data The raw data of this packet. - */ - public UnknownPacket(byte[] data) { - rawpacket= data; - header= new UnknownHeader(new BitBuf(rawpacket)); - } - - /** - * Returns a printable representation of this packet. - * @param filter FormatProperties object for filtering this packet. - * @return Returns a string representation of this packet. - */ - public String toString(FormatProperties filter) { - return header.toString(filter); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/commtrace/package.html b/cvsroot/src/com/ibm/as400/util/commtrace/package.html deleted file mode 100644 index fbe255cbc..000000000 --- a/cvsroot/src/com/ibm/as400/util/commtrace/package.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - -Provides a utility application and classes to assist in the formatting and display of IBM i communication traces. - -

    -These classes provide the ability to parse the data from an IBM i communication trace. Each class represents a specific portion of a packet of data. These classes parse data as defined by the respective RFCs. -

    - -

    Related Documentation

    - -For overviews, tutorials, examples, guides, and tool documentation, please see: - - - - diff --git a/cvsroot/src/com/ibm/as400/util/gencmddoc.xsl b/cvsroot/src/com/ibm/as400/util/gencmddoc.xsl deleted file mode 100644 index 2986c49c6..000000000 --- a/cvsroot/src/com/ibm/as400/util/gencmddoc.xsl +++ /dev/null @@ -1,950 +0,0 @@ - - - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> - - - - - - - <xsl:value-of select="Cmd/@Prompt"/><xsl:text> </xsl:text>(<xsl:value-of select="Cmd/@CmdName"/>) - - - - - - .Top_Of_Page - - - - - - - - - -

    ()

    - - - - - - - - - - - -
    - - - - - : - - - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - - - -
      - - -
    • -
      - -
    • -
      - -
    • -
      - -
    • -
      - -
    • -
      - -
    • -
      - -
    • -
      - -
    • -
      - -
    • -
      - -
    -
    -
    - - : - - - - - - - - - - -
    -
    - #.PARAMETERS.TABLE -
    - - - #.COMMAND.EXAMPLES - - - #.COMMAND.EXAMPLES - - -
    - - - #.ERROR.MESSAGES - - - #.ERROR.MESSAGES - - -
    - - - - - - - - - - - - - - -
    - -
    - -

    - - .PARAMETERS.TABLE - -

    - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - -
    - - -
    - - - - - - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - #. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - : - - - - - : - - - - - - : - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - , - - - - - - - , - - - - - - - - - - - - - - - - - - - - - - - - - - padding-left:pt - - - : - - - - - - - - - - - - - - - - : - - - - - : - - - - - : - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - padding-left:pt - - - : - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - #.Top_Of_Page -
    - -
    - - - - - - - - - - - - - - - - - - - , - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - , - - - , - - - - - - - - - - - - : - -
    -
    - - - - - - - - - - - - - - , - - - - - - - - - - - - - - - - - - - - - - , - - - - - - - - - - - - - , - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - , - - - -
    diff --git a/cvsroot/src/com/ibm/as400/util/gencmdhlp.xsl b/cvsroot/src/com/ibm/as400/util/gencmdhlp.xsl deleted file mode 100644 index 58b65e3cf..000000000 --- a/cvsroot/src/com/ibm/as400/util/gencmdhlp.xsl +++ /dev/null @@ -1,840 +0,0 @@ - - - - - - - - -"> -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -:pnlgrp - - submsgf='/ - ' - -. -.************************************************************************ -.* -.************************************************************************ - - - - - :help name=''. - - - -&msg(). - -:p. -&msg(). () - -.* - - - - - -:p. - () - -.* - - - - - -:p. - - -.* - - - - - - - - - - :p.:hp2.::ehp2. -:ul. -:li. - -.* -:li. - -.* -:li. - -.* -:li. -<...> -.* -.* -:eul. - - - - :p. - - - - :ehelp. - - - - - - - - -.************************************************** -.* -.* - -.* -.************************************************** -:help name='/COMMAND/EXAMPLES'. - - - -:xh3. - -:p.:hp2.:ehp2. -:xmp. - KWD1(PARMVAL1) -:exmp. -:p. -.* -.* -:p.:hp2.:ehp2. -:xmp. - KWD1(PARMVAL1) KWD2(PARMVAL2) - KWD3(PARMVAL3) -:exmp. -:p. -.* -:ehelp. - - -.************************************************** -.* -.* - -.* -.************************************************** -:help name='/ERROR/MESSAGES'. -&msg(CPX0005,QCPFMSG). - -:xh3.&msg(CPX0005,QCPFMSG). -:p.:hp3.*ESCAPE &msg(CPX0006,QCPFMSG).:ehp3. -.************************************************************************ -.* -.* -.* -.************************************************************************ -:DL COMPACT. -:DT.CPF9801 -:DD.&MSG(CPF9801,QCPFMSG,*LIBL,nosub). -:DT.CPF9802 -:DD.&MSG(CPF9802,QCPFMSG,*LIBL,nosub). -:DT.CPF9803 -:DD.&MSG(CPF9803,QCPFMSG,*LIBL,nosub). -:DT.CPF9807 -:DD.&MSG(CPF9807,QCPFMSG,*LIBL,nosub). -:DT.CPF9808 -:DD.&MSG(CPF9808,QCPFMSG,*LIBL,nosub). -:DT.CPF9810 -:DD.&MSG(CPF9810,QCPFMSG,*LIBL,nosub). -:DT.CPF9811 -:DD.&MSG(CPF9811,QCPFMSG,*LIBL,nosub). -:DT.CPF9812 -:DD.&MSG(CPF9812,QCPFMSG,*LIBL,nosub). -:DT.CPF9820 -:DD.&MSG(CPF9820,QCPFMSG,*LIBL,nosub). -:DT.CPF9830 -:DD.&MSG(CPF9830,QCPFMSG,*LIBL,nosub). -:DT.CPF9899 -:DD.&MSG(CPF9899,QCPFMSG,*LIBL,nosub). -:EDL. -:ehelp. - - -:epnlgrp. - - - - - - - - - - - - .******************************************* - .* - .******************************************* - :help name='/'. - - - - &msg(). () - - - :xh3.&msg(). () - - - () - - - :xh3. () - - - - - - :xh3. - - - - :p. - .* - - - - - - :p. - - - - - - - - - - - - - :p.:hp2. - - :ehp2. - - - - :p. - - - - - - - - - :parml. - - - - - - - - - :pt.:pk def.:epk. - - :pd. - <...> - .* - - - - - - - - - - - - - - :pt.:pv.-:epv. - :pd. - <...> - .* - - - - - - - - - :eparml. - - - - - - - - :ehelp. - - - - - - - - - - - - - - - :parml. - - - - - - - :pt.:pd. - - - - :p.:hp2. : - - - &msg(). - - - - - - - :ehp2. - - - - - - - - - - :p.:hp2. - - :ehp2. - - - - :p. - - - - - - - - - :parml. - - - - - - - - - :pt.:pk def.:epk. - - :pd. - <...> - .* - - - - - - - - - - - - - - :pt.:pv.-:epv. - :pd. - <...> - .* - - - - - - - - - :eparml. - - - - - - - - - :eparml. - - - - - - - - - - - - - - - - - :parml. - - - - - - - :pt.:pd. - - - - :p.:hp2. : - - - - - &msg(). - - - - - - - - - - - &msg(). - - - - - - - - - :ehp2. - - - :parml. - - - - - - - :pt.:pk def.:epk. - - :pd. - <...> - .* - - - - - - - - - - - - - - :pt.:pv.-:epv. - :pd. - <...> - .* - - - - - - - - :eparml. - - - - :eparml. - - - - - - - - - - - - - :pt.:pv.:epv. - - :pd. - - .* - - - - - :pt.:pv.:epv. - - :pd. - - .* - - - - - :pt.:pv.:epv. - - :pd. - - .* - - - - - :pt.:pv.:epv. - - :pd. - - .* - - - - - :pt.:pv.:epv. - - :pd. - - .* - - :pt.:pv.:epv. - - :pd. - - .* - - - - - :pt.:pv.:epv. - - :pd. - - .* - - - - - :pt.:pv.:epv. - - :pd. - - .* - - - - - :pt.:pv.:epv. - - :pd. - - .* - - - - - :pt.:pv.:epv. - - :pd. - - .* - - - - - :pt.:pv.:epv. - - :pd. - - .* - - - - - :pt.:pv.:epv. - - :pd. - - .* - - - - - :pt.:pv.:epv. - - :pd. - - .* - - - - - :pt.:pv.:epv. - - :pd. - - .* - - - - - :pt.:pv.:epv. - - :pd. - - .* - - - - - :pt.:pv.:epv. - - :pd. - - .* - - - - - :pt.:pv.:epv. - - :pd. - - .* - - - - - - - - - - :p.:hp2.:ehp2. - :parml. - - :eparml. - - - - - - - - - - - - - - - - - - - - - - :pt.:pk def.:epk. - - - - :pt.:pk.:epk. - - - - :pd. - <...> - .* - - - - diff --git a/cvsroot/src/com/ibm/as400/util/html/BidiOrdering.java b/cvsroot/src/com/ibm/as400/util/html/BidiOrdering.java deleted file mode 100644 index 4c9332640..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/BidiOrdering.java +++ /dev/null @@ -1,422 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BidiOrdering.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; - -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; - -import java.util.Vector; - -/** -* The BidiOrdering class represents an HTML tag used to alter the language -* and direction of text. -*

    -* Here is an example of a BidiOrdering tag:
    -*

    -*  <bdo lang="he" dir="rtl">
    -*  Some Hebrew Text.
    -*  </bdo>
    -*  
    -* -*

    -* The equivalent tag using XSL Formatting Objects looks like this: -*

    -*  <fo:block-container writing-mode='rl'>
    -*  <fo:block>Some Hebrew Text</fo:block>
    -*  </fo:block-container>
    -*  
    -* -*

    BidiOrdering objects generate the following events: -*

      -*
    • ElementEvent - The events fired are: -*
        -*
      • elementAdded -*
      • elementRemoved -*
      -*
    • PropertyChangeEvent -*
    -**/ -public class BidiOrdering extends HTMLTagAttributes implements java.io.Serializable // @Z1C -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - static final long serialVersionUID = 367063750196907253L; - - private String lang_; // The primary language used to display the tags contents. - private String dir_; // The direction of the text interpretation. - private boolean useFO_ = false; //Indicates if XSL-FO tags are outputted. //@D1A - - private Vector list_ = new Vector(); - - transient private Vector elementListeners; // The list of element listeners @CRS - - - /** - * Constructs a default BidiOrdering object. - **/ - public BidiOrdering() - { - super(); - } - - /** - * Constructs a BidiOrdering object with the specified dir. - * @param dir The direction of the text being displayed. - **/ - public BidiOrdering(String dir) - { - this(); - - setDirection(dir); - } - - /** - * Constructs a BidiOrdering object with the specified lang - * and dir. - * @param lang The language of the text. - * @param dir The direction of text being displayed. - **/ - public BidiOrdering(String lang, String dir) - { - this(dir); - - setLanguage(lang); - } - - - /** - * Adds an HTMLTagElement to the list elements. - * - * @param data The data to re-order. - **/ - public void addItem(HTMLTagElement data) - { - if (data == null) - throw new NullPointerException("data"); - - list_.addElement(data); - - fireElementEvent(ElementEvent.ELEMENT_ADDED); - } - - - /** - * Adds a String to the list of elements. - * - * @param data The data to re-order. - **/ - public void addItem(String data) - { - if (data == null) - throw new NullPointerException("data"); - - list_.addElement(new HTMLText(data)); - - fireElementEvent(ElementEvent.ELEMENT_ADDED); - } - - - /** - * Adds an ElementListener. - * - * @param listener The ElementListener. - **/ - public void addItemElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (elementListeners == null) elementListeners = new Vector(); //@CRS - elementListeners.addElement(listener); - } - - - - /** - * This method is used to remove all elements contained - * within the BidiOrdering list. - **/ - void clear() - { - list_.removeAllElements(); - } - - - /** - * Fires the element event. - **/ - private void fireElementEvent(int evt) - { - if (elementListeners == null) return; //@CRS - Vector targets; - targets = (Vector) elementListeners.clone(); - ElementEvent elementEvt = new ElementEvent(this, evt); - for (int i = 0; i < targets.size(); i++) - { - ElementListener target = (ElementListener)targets.elementAt(i); - if (evt == ElementEvent.ELEMENT_ADDED) - target.elementAdded(elementEvt); - else if (evt == ElementEvent.ELEMENT_REMOVED) - target.elementRemoved(elementEvt); - } - } - - - /** - * Returns the direction of the text interpretation. - * @return The direction of the text. - **/ - public String getDirection() - { - return dir_; - } - - - /** - * Returns the language of the element. - * @return The language of the element. - **/ - public String getLanguage() - { - return lang_; - } - - - /** - * Returns the list of items. - * @return The list. - **/ - public Vector getItems() - { - return list_; - } - - - /** - * Returns the tag for the Bi-Directional Ordering. - * @return The tag. - **/ - public String getTag() - { - if(useFO_) //@D1A - return getFOTag(); //@D1A - - // the direction is the only required tag - if (dir_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting direction."); - throw new ExtendedIllegalStateException( - "dir", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - if (list_.isEmpty()) - { - Trace.log(Trace.ERROR, "Attempting to get tag before adding items to list."); - throw new ExtendedIllegalStateException( - "data", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - StringBuffer s = new StringBuffer("\n\n"); - - for (int i=0; i < list_.size(); i++) - { - HTMLTagElement data = (HTMLTagElement)list_.elementAt(i); - s.append(data.getTag()); - } - - s.append("\n\n"); - - return s.toString(); - } - - /** - * Returns the XSL formatting object's tag for the Bi-Directional Ordering. - * The language attribute is not supported in XSL-FO. - * @return The tag. - **/ - public String getFOTag() //@D1A - { - //Output an XSL-FO Tag - - // the direction is the only required tag - if (dir_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get XSL-FO tag before setting direction."); - throw new ExtendedIllegalStateException( - "dir", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - if (list_.isEmpty()) - { - Trace.log(Trace.ERROR, "Attempting to get XSL-FO tag before adding items to list."); - throw new ExtendedIllegalStateException( - "data", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - StringBuffer s = new StringBuffer("\n\n"); - - for (int i=0; i < list_.size(); i++) - { - HTMLTagElement data = (HTMLTagElement)list_.elementAt(i); - s.append(data.getFOTag()); - } - - s.append("\n"); - - return s.toString(); - } - - /** - * Returns if Formatting Object tags are outputted. - * The default value is false. - * @return true if the output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public boolean isUseFO() //@D1A - { - return useFO_; - } - - /** - * Removess an HTMLTagElement from the list. - * - * @param data The data to remove. - **/ - public void removeItem(HTMLTagElement data) - { - if (data == null) - throw new NullPointerException("data"); - - if (list_.removeElement(data)) - fireElementEvent(ElementEvent.ELEMENT_REMOVED); - } - - - /** - * Removes this ElementListener. - * - * @param listener The ElementListener. - **/ - public void removeItemElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (elementListeners != null) elementListeners.removeElement(listener); //@CRS - } - - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - - //@CRS changes_ = new PropertyChangeSupport(this); - - //@CRS elementListeners = new Vector(); - } - - - - /** - * Sets the direction of the text interpretation. - * @param dir The direction. One of the following constants - * defined in HTMLConstants: LTR or RTL. - * - * @see com.ibm.as400.util.html.HTMLConstants - * - **/ - public void setDirection(String dir) - { - if (dir == null) - throw new NullPointerException("dir"); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - { - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - String old = dir_; - - dir_ = dir; - - if (changes_ != null) changes_.firePropertyChange("dir", old, dir ); //@CRS - } - - - /** - * Sets the language of the input tag. - * @param lang The language. Example language tags include: - * en and en-US. - * - **/ - public void setLanguage(String lang) - { - if (lang == null) - throw new NullPointerException("lang"); - - String old = lang_; - - lang_ = lang; - - if (changes_ != null) changes_.firePropertyChange("lang", old, lang ); //@CRS - } - - /** - * Sets if Formatting Object tags should be outputted. - * The default value is false. - * @param useFO - true if output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public void setUseFO(boolean useFO) //@D1A - { - boolean old = useFO_; - - useFO_ = useFO; - - if (changes_ != null) changes_.firePropertyChange("useFO", old, useFO ); - } - - /** - * Returns a String representation for the BidiOrdering tag. - * @return The tag. - **/ - public String toString() - { - return getTag(); - } - -} - diff --git a/cvsroot/src/com/ibm/as400/util/html/BidiOrdering16.gif b/cvsroot/src/com/ibm/as400/util/html/BidiOrdering16.gif deleted file mode 100644 index 364072bbb..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/BidiOrdering16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/BidiOrdering32.gif b/cvsroot/src/com/ibm/as400/util/html/BidiOrdering32.gif deleted file mode 100644 index 4bd225cdc..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/BidiOrdering32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/BidiOrderingBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/BidiOrderingBeanInfo.java deleted file mode 100644 index a7e9b8b98..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/BidiOrderingBeanInfo.java +++ /dev/null @@ -1,170 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: BidiOrderingBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -The BidiOrderingBeanInfo class provides -bean information for the BidiOrdering class. -**/ -public class BidiOrderingBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = BidiOrdering.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = {changed}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor lang = new PropertyDescriptor("lang", beanClass, "getLanguage", "setLanguage"); - lang.setBound(true); - lang.setConstrained(false); - lang.setDisplayName(loader_.getText("PROP_NAME_LANGUAGE")); - lang.setShortDescription(loader_.getText("PROP_DESC_LANGUAGE")); - - PropertyDescriptor dir = new PropertyDescriptor("dir", beanClass, "getDirection", "setDirection"); - dir.setBound(true); - dir.setConstrained(false); - dir.setDisplayName(loader_.getText("PROP_NAME_DIRECTION")); - dir.setShortDescription(loader_.getText("PROP_DESC_DIRECTION")); - - PropertyDescriptor useFO = new PropertyDescriptor("useFO", beanClass, "isUseFO", "setUseFO"); //@B1A - useFO.setBound(true); //@B1A - useFO.setConstrained(false); //@B1A - useFO.setDisplayName(loader_.getText("PROP_NAME_FORMATTING_OBJECT")); //@B1A - useFO.setShortDescription(loader_.getText("PROP_DESC_FORMATTING_OBJECT")); //@B1A - - properties_ = new PropertyDescriptor[] { lang, dir, useFO }; //@B1C - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * BidiOrdering is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("BidiOrdering16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("BidiOrdering32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/util/html/ButtonFormInput.java b/cvsroot/src/com/ibm/as400/util/html/ButtonFormInput.java deleted file mode 100644 index baaf28ff2..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/ButtonFormInput.java +++ /dev/null @@ -1,200 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ButtonFormInput.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; - -import java.beans.PropertyVetoException; - -/** -* The ButtonFormInput class represents a button input type in an HTML form. -* The trailing slash "/" on the ButtonFormInput tag allows it to conform to -* the XHTML specification. -*

    -* -* Here is an example of a ButtonFormInput tag calling a javascript defined within a HTML page:
    -* <input type="button" name="button1" value="Press Me" onclick="test()" /> -* -*

    -* Here is a sample javascript which displays an alert box with the specified message:
    -*

    -*  <head>
    -*  <script language="javascript">
    -*     function test()
    -*     {
    -*        alert("This is a sample script executed with a ButtonFormInput.")
    -*     }
    -*  </script>
    -*  </head>
    -*  
    -* -*

    ButtonFormInput objects generate the following events: -*

      -*
    • PropertyChangeEvent -*
    • VetoableChangeEvent -*
    -* -**/ -public class ButtonFormInput extends FormInput -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - private String action_; // The action the button will perform when pressed. - - /** - * Constructs a default ButtonFormInput object. - **/ - public ButtonFormInput() - { - super(); - - } - - /** - * Constructs a ButtonFormInput object with the specified control name. - * @param name The control name of the input field. - **/ - public ButtonFormInput(String name) - { - super(name); - } - - /** - * Constructs a ButtonFormInput object with the specified control name and - * viewable text value of the button. - * @param name The control name of the input field. - * @param value The viewable text value of the button. - **/ - public ButtonFormInput(String name, String value) - { - super(name, value); - } - - /** - * Constructs a ButtonFormInput object with the specified control name, - * viewable text value of the button, and the action to perform - * when the button is pressed. - * @param name The control name of the input field. - * @param value The viewable text value of the button. - * @param action The script to execute. - **/ - public ButtonFormInput(String name, String value, String action) //$A1A - { - super(name, value); - try - { - setAction(action); - } - catch (PropertyVetoException e) - { - } - } - - - /** - * Returns the action being performed by the button. - * @return The script being executed. - **/ - public String getAction() //$A1A - { - return action_; - } - - - /** - * Returns a comment tag. - * This method should not be called. There is no XSL-FO support for this class. - * @return The comment tag. - **/ - public String getFOTag() //@D1A - { - Trace.log(Trace.ERROR, "Attempting to getFOTag() for an object that doesn't support it."); - return ""; - } - - /** - * Returns the tag for the button form input type. - * @return The tag. - **/ - public String getTag() - { - if (getName() == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting name."); - throw new ExtendedIllegalStateException( - "name", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - StringBuffer s = new StringBuffer(""); - - return s.toString(); - } - - - /** - * Sets the action to perform when the button is clicked. Buttons have no default behavior. - * Each button may have client-side scripts associated with the element's event attributes. - * When an event occurs (the user presses the button), the associated script is triggered. - * @param action The script to execute. - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setAction(String action) //$A1A - throws PropertyVetoException - { - if (action == null) - throw new NullPointerException("action"); - - if (action.length() == 0) - throw new ExtendedIllegalArgumentException("action", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - String old = action_; - - if (vetos_ != null) vetos_.fireVetoableChange("action", old, action); //@CRS - - action_ = action; - - if (changes_ != null) changes_.firePropertyChange("action", old, action); //@CRS - - } -} - diff --git a/cvsroot/src/com/ibm/as400/util/html/ButtonFormInput16.gif b/cvsroot/src/com/ibm/as400/util/html/ButtonFormInput16.gif deleted file mode 100644 index 6bd53784f..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/ButtonFormInput16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/ButtonFormInput32.gif b/cvsroot/src/com/ibm/as400/util/html/ButtonFormInput32.gif deleted file mode 100644 index 3f7b7e752..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/ButtonFormInput32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/ButtonFormInputBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/ButtonFormInputBeanInfo.java deleted file mode 100644 index b2a8570cf..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/ButtonFormInputBeanInfo.java +++ /dev/null @@ -1,163 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ButtonFormInputBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - - -import java.awt.Image; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.BeanDescriptor; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; - -/** -The ButtonFormInputBeanInfo class provides -bean information for the ButtonFormInput class. -**/ -public class ButtonFormInputBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = ButtonFormInput.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor action = new PropertyDescriptor("action", beanClass, - "getAction", "setAction"); - action.setBound(true); - action.setConstrained(true); - action.setDisplayName(loader_.getText("PROP_NAME_ACTION")); - action.setShortDescription(loader_.getText("PROP_DESC_ACTION")); - - properties_ = new PropertyDescriptor[] { action }; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * ButtonFormInput is a subclass of FormInput, this method - * will return a FormInputBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new FormInputBeanInfo() }; - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("ButtonFormInput16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("ButtonFormInput32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/CheckboxFormInput.java b/cvsroot/src/com/ibm/as400/util/html/CheckboxFormInput.java deleted file mode 100644 index fd3d39cdd..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/CheckboxFormInput.java +++ /dev/null @@ -1,127 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CheckboxFormInput.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalStateException; - -import java.beans.PropertyVetoException; - -/** -* The CheckboxFormInput class represents a checkbox input type in an -* HTML form where the checkbox represents an n-of-many choice field. -* The trailing slash "/" on the CheckboxFormInput tag allows it to -* conform to the XHTML specification. -*

    -* Here is an example of a CheckboxFormInput tag:
    -* <input type="checkbox" name="uscitizen" value="yes" -* checked="checked" /> textLabel -**/ -public class CheckboxFormInput extends ToggleFormInput -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - /** - * Constructs a default CheckboxFormInput object. - **/ - public CheckboxFormInput() - { - super(); - - } - - /** - * Constructs a CheckboxFormInput object with the specified viewable text label - * and initial checked value. - * @param label The viewable text label. - * @param checked If the checkbox initializes to checked. - **/ - public CheckboxFormInput(String label, boolean checked) - { - super(label, checked); - } - - /** - * Constructs a CheckboxFormInput object with the specified control name, - * initial input value, viewable text label, and initial checked value. - * @param name The control name of the input field. - * @param value The input value used when the field is submitted. - * @param label The viewable text label. - * @param checked If the checkbox initializes to checked. - **/ - public CheckboxFormInput(String name, String value, String label, boolean checked) - { - super(label, checked); - try - { - setName(name); - setValue(value); - } - catch (PropertyVetoException e) - { - } - } - - /** - * Returns a comment tag. - * This method should not be called. There is no XSL-FO support for this class. - * @return The comment tag. - **/ - public String getFOTag() //@D1A - { - Trace.log(Trace.ERROR, "Attempting to getFOTag() for an object that doesn't support it."); - return ""; - } - - /** - * Returns the tag for the checkbox form input type. - * @return The tag. - **/ - public String getTag() - { - - if (getName() == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting name."); - throw new ExtendedIllegalStateException( - "name", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - if (getValue() == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting value."); - throw new ExtendedIllegalStateException( - "value", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - if (getLabel() == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting label."); - throw new ExtendedIllegalStateException( - "label", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - StringBuffer s = new StringBuffer(" "); - s.append(getLabel()); - - return s.toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/CheckboxFormInput16.gif b/cvsroot/src/com/ibm/as400/util/html/CheckboxFormInput16.gif deleted file mode 100644 index 04d42c5f2..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/CheckboxFormInput16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/CheckboxFormInput32.gif b/cvsroot/src/com/ibm/as400/util/html/CheckboxFormInput32.gif deleted file mode 100644 index 614521b44..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/CheckboxFormInput32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/CheckboxFormInputBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/CheckboxFormInputBeanInfo.java deleted file mode 100644 index dbdd6d460..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/CheckboxFormInputBeanInfo.java +++ /dev/null @@ -1,79 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CheckboxFormInputBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - - -import java.awt.Image; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.BeanDescriptor; - -/** -The CheckboxFormInputBeanInfo class provides -bean information for the CheckboxFormInput class. -**/ -public class CheckboxFormInputBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = CheckboxFormInput.class; - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * CheckboxFormInput is a subclass of ToggleFormInput, this method - * will return a ToggleFormInputBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new ToggleFormInputBeanInfo() }; - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("CheckboxFormInput16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("CheckboxFormInput32.gif"); - break; - } - return image; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/DirFilter.java b/cvsroot/src/com/ibm/as400/util/html/DirFilter.java deleted file mode 100644 index 7a6cfc4da..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/DirFilter.java +++ /dev/null @@ -1,90 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DirFilter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.io.File; -import java.io.FilenameFilter; -import java.util.Vector; - -import com.ibm.as400.access.IFSJavaFile; - - -/** -* The DirFilter class determines if a File object is a directory. -* -*

    -* This example creates a DirFilter object to determine which IFSJavaFile objects -* are directories. -* -*

    -*  // Create an IFSJavaFile object.
    -*  IFSJavaFile root = new IFSJavaFile(system, "/QIBM");
    -*  

    -* // Create a DirFilter object. -* DirFilter filter = new DirFilter(); -*

    -* // Get the list of directories. -* File[] dirList = root.listFiles(filter); -*

    -* // Create a tree element with each directory. -* for (int i=0; i < dirList.length; i++) -* { -* FileTreeElement node = new FileTreeElement(dirList[i]); -*

    -* ServletHyperlink sl = new ServletHyperlink(urlParser.getURI()); -* sl.setHttpServletResponse(resp); -* node.setIconUrl(sl); -*

    -* tree.addElement(node); -* } -*

    -* -* -* @see com.ibm.as400.util.html.FileTreeElement -* -**/ -public class DirFilter implements FilenameFilter -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - /** - * Constructs a default DirFilter object. - **/ - public DirFilter() - { - } - - /** - * Determines if a file should be included in a list of directories. - * - * @param file The directory in which the file was found. - * @param filename The name of the file. - * - * @return true if the file is a directory; false otherwise. - **/ - public boolean accept(File file, String filename) - { - File f; - - if (file instanceof IFSJavaFile) - f = new IFSJavaFile((IFSJavaFile)file, filename); - else - f = new File(file, filename); - - if (!f.isFile()) - return true; - else - return false; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/ElementEvent.java b/cvsroot/src/com/ibm/as400/util/html/ElementEvent.java deleted file mode 100644 index a7963a3a1..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/ElementEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ElementEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; - -/** - The ElementEvent class represents an element event. -**/ - -public class ElementEvent extends java.util.EventObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - /** - Event ID indicating that an element has been added. - **/ - public static final int ELEMENT_ADDED = 0; - - /** - Event ID indicating that an element has been changed. - **/ - public static final int ELEMENT_CHANGED = 1; - - /** - Event ID indicating that an element has been removed. - **/ - public static final int ELEMENT_REMOVED = 2; - - private int id_; // event identifier - - /** - Constructs an ElementEvent object. It uses the specified source and ID. - @param source The object where the event originated. - @param id The event identifier. - **/ - public ElementEvent(Object source, int id) - { - super(source); - - if (id < ELEMENT_ADDED || id > ELEMENT_REMOVED) - { - throw new ExtendedIllegalArgumentException("id", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - id_ = id; - } - - /** - Returns the identifier for this event. - @return The identifier for this event. - **/ - public int getID() - { - return id_; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/ElementListener.java b/cvsroot/src/com/ibm/as400/util/html/ElementListener.java deleted file mode 100644 index 8fe82046c..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/ElementListener.java +++ /dev/null @@ -1,40 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ElementListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -/** -* The ElementListener interface provides a listener -* interface for receiving element events. -**/ -public interface ElementListener extends java.util.EventListener -{ - - /** - * Invoked when an element has been added. - * @param event The event. - **/ - public abstract void elementAdded(ElementEvent event); - - /** - * Invoked when an element has been changed. - * @param event The event. - **/ - public abstract void elementChanged(ElementEvent event); - - /** - * Invoked when an element has been removed. - * @param event The event. - **/ - public abstract void elementRemoved(ElementEvent event); -} diff --git a/cvsroot/src/com/ibm/as400/util/html/FileFormInput.java b/cvsroot/src/com/ibm/as400/util/html/FileFormInput.java deleted file mode 100644 index 7acea692f..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/FileFormInput.java +++ /dev/null @@ -1,85 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FileFormInput.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalStateException; - -/** -* The FileFormInput class represents a file input type in an HTML form. -* The trailing slash "/" on the FileFormInput tag allows it to -* conform to the XHTML specification. -*

    -* Here is an example of a FileFormInput tag:
    -* <input type="file" name="myFile" /> -**/ -public class FileFormInput extends FormInput -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - /** - * Constructs a default FileFormInput object. - **/ - public FileFormInput() - { - super(); - - } - - /** - * Constructs a FileFormInput object with the specified control name. - * @param name The control name of the input field. - **/ - public FileFormInput(String name) - { - super(name); - } - - /** - * Returns a comment tag. - * This method should not be called. There is no XSL-FO support for this class. - * @return The comment tag. - **/ - public String getFOTag() //@C1A - { - Trace.log(Trace.ERROR, "Attempting to getFOTag() for an object that doesn't support it."); - return ""; - } - - /** - * Returns the tag for the file form input type. - * @return The tag. - **/ - public String getTag() - { - if (getName() == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting name."); - throw new ExtendedIllegalStateException( - "name", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - StringBuffer s = new StringBuffer(""); - - return s.toString(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/FileFormInput16.gif b/cvsroot/src/com/ibm/as400/util/html/FileFormInput16.gif deleted file mode 100644 index 3edac0271..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/FileFormInput16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/FileFormInput32.gif b/cvsroot/src/com/ibm/as400/util/html/FileFormInput32.gif deleted file mode 100644 index 75e0172de..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/FileFormInput32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/FileFormInputBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/FileFormInputBeanInfo.java deleted file mode 100644 index a06a546e6..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/FileFormInputBeanInfo.java +++ /dev/null @@ -1,79 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FileFormInputBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - - -import java.awt.Image; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.BeanDescriptor; - -/** -The FileFormInputBeanInfo class provides -bean information for the FileFormInput class. -**/ -public class FileFormInputBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = FileFormInput.class; - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * FileFormInput is a subclass of FormInput, this method - * will return a FormInputBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new FormInputBeanInfo() }; - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("FileFormInput16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("FileFormInput32.gif"); - break; - } - return image; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/FileListElement.java b/cvsroot/src/com/ibm/as400/util/html/FileListElement.java deleted file mode 100644 index 9b16230e6..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/FileListElement.java +++ /dev/null @@ -1,934 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FileListElement.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.io.File; -import java.io.IOException; -import java.text.Collator; // @A2A -import java.beans.PropertyVetoException; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; - -import javax.servlet.http.HttpServletRequest; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.IFSJavaFile; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.IFSFile; -import com.ibm.as400.access.ExtendedIllegalArgumentException; - - -import com.ibm.as400.util.servlet.ListRowData; -import com.ibm.as400.util.servlet.HTMLTableConverter; -import com.ibm.as400.util.servlet.RowDataException; - -/** -* The FileListElement class represents the contents of an Integrated File System directory. -* -*

    This example creates an FileListElement object: -* -*

    -*

    -*  // Create a HTMLTree object.
    -*  HTMLTree tree = new HTMLTree(req);
    -*  

    -* // Create a URLParser object. -* URLParser urlParser = new URLParser(httpServletRequest.getRequestURI()); -*

    -* // Create a object to represent the connection to the system. -* AS400 system = new AS400(mySystem, myUserId, myPassword); -*

    -* // Create an IFS object. -* IFSJavaFile root = new IFSJavaFile(system, "/QIBM"); -*

    -* // Create a DirFilter object and get the directories. -* DirFilter filter = new DirFilter(); -* File[] dirList = root.listFiles(filter); -*

    -* -* for (int i=0; i < dirList.length; i++) -* {

    -* // Create a FileTreeElement. -* FileTreeElement element = new FileTreeElement(dirList[i]); -*

    -* // Set the Icon URL. -* ServletHyperlink sl = new ServletHyperlink(urlParser.getURI()); -* sl.setHttpServletResponse(resp); -* element.setIconUrl(sl); -*

    -* // Set the text url so it calls another -* // servlet to display the contents of the FileTreeElement. -* ServletHyperlink tl = new ServletHyperlink("/servlet/myListServlet"); -* tl.setTarget("listFrame"); -*

    -* // Set the TextUrl for the FileTreeElement. -* element.setTextUrl(tl); -*

    -* // Add the FileTreeElement to the tree. -* tree.addElement(element); -* } -* -*

    -* // When the user clicks on text url in the HTMLTree it should call another -* // servlet to display the contents. It is here that the FileListElement -* // will be created. -* AS400 sys = new AS400(mySystem, myUserId, myPassword); -*

    -* // The FileTreeElment will properly create the text url and pass the -* // file and path information through the httpservletrequest. If the -* // list is meant to display the contents of the local file system, -* // then only pass the HttpServletRequest on the constructor. -* FileListElement fileList = new FileListElement(sys, httpservletrequest); -*

    -* // Output the content of the FileListElement. -* out.println(fileList.list()); -*

    -* -* Once the contents are listed and a user traverses the HTML tree down to /QIBM/ProdData/Http/Public/ and clicks on the -* jt400 directory link, the FileListElement will look something like the following: -*

    -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -*
    NameSizeTypeModified
    ../ (Parent Directory)
    comDirectory06/09/2000 11:00:46 AM
    libDirectory09/11/2000 10:32:24 AM
    MRI2924Directory06/09/2000 11:03:12 PM
    SSL128Directory09/22/2000 10:46:29 AM
    SSL56Directory09/22/2000 10:43:52 PM
    utilitiesDirectory06/09/2000 11:01:58 AM
    ACCESS.LST15950File06/29/2000 06:26:25 PM
    ACCESS.LVL23File06/29/2000 06:26:09 PM
    CKSETUP.INI88File06/29/2000 06:26:21 PM
    GTXSETUP.ini102File05/16/2000 05:51:46 PM
    JT400.PKG19File09/08/1999 04:25:51 PM
    OPNAV.LST16827File09/08/1999 04:26:08 PM
    OPNAV.LVL19File05/16/2000 05:51:31 AM
    OPV4R5M0.LST24121File09/08/1999 04:26:14 PM
    OPV4R5M01.LST104File05/16/2000 05:51:46 AM
    PROXY.LST4636File09/08/1999 04:26:00 AM
    PROXY.LVL29File06/29/2000 06:26:26 AM
    PXV4R5M0.LST7101File09/08/1999 04:25:58 PM
    PXV4R5M01.LST38File06/29/2000 06:27:46 PM
    QSF631215769JC10004R05M005050000000054518File05/10/2000 10:35:10 AM
    QSF631215769JC10004R05M0050500000000620File05/10/2000 10:35:00 AM
    QSF631215769JC10004R05M0050500000000715File05/10/2000 10:35:19 AM
    QSF631215769JC10004R05M0050500000000815950File05/10/2000 10:34:57 AM
    QSF631215769JC10004R05M0050500000000938File05/10/2000 10:35:13 AM
    QSF631215769JC10004R05M0050500000001038586File05/10/2000 10:35:06 AM
    QSF631215769JC10004R05M0050500000001133File05/10/2000 10:35:09 AM
    QSF631215769JC10004R05M0050500000001388File05/10/2000 10:35:03 AM
    READMEGT.TXT3480File05/16/2000 05:52:27 AM
    READMESP.TXT5161File06/29/2000 06:26:14 PM
    V4R5M0.LST38586File06/29/2000 06:26:19 PM
    V4R5M01.LST33File06/29/2000 06:26:33 PM
    V4R5M02.LST33File06/29/2000 06:26:26 PM
    -*

    -* FileListElement objects generate the following events: -*

      -*
    • PropertyChangeEvent -*
    -* -* @see com.ibm.as400.util.html.DirFilter -* @see com.ibm.as400.util.html.FileListRenderer -**/ -public class FileListElement implements java.io.Serializable -{ - static final long serialVersionUID = 6247154241289547698L; - - private AS400 system_; - private HTMLTable table_; - private HttpServletRequest request_; - private FileListRenderer renderer_; // @A4A - private StringBuffer sharePath_; // @B1A - private StringBuffer shareName_; // @B1A - private String parameterPathInfo_; //@CRS - - private boolean sort_ = true; // @A2A - transient private Collator collator_ = null; // @A2A @B3C - - transient private PropertyChangeSupport changes_; //@P2C - - private int patternMatching_ = -1; //@KKB - - - /** - * Constructs a default FileListElement object. - **/ - public FileListElement() - { - // @B3A - // If the locale is Korean, then this throws - // an ArrayIndexOutOfBoundsException. This is - // a bug in the JDK. The workarond in that case - // is just to use String.compareTo(). - try // @B3A - { - collator_ = Collator.getInstance (); // @B3A - collator_.setStrength (Collator.PRIMARY); // @B3A - } - catch (Exception e) // @B3A - { - collator_ = null; // @B3A - } - - renderer_ = null; - system_ = null; - request_ = null; - shareName_ = null; - sharePath_ = null; - } - - - // @A7A - /** - * Constructs an FileListElement for the local file system - * using the pathInfo from the specified request. - * - * Internally a java.io.File object will be used to retrieve - * the contents of the file system. - * - * @param request The Http servlet request. - **/ - public FileListElement(HttpServletRequest request) - { - this(); // @B3A - setHttpServletRequest(request); - setRenderer(new FileListRenderer(request)); - } - - - /** - * Constructs an FileListElement for an IBM i file system - * using the pathInfo from the specified request, and - * the designated system. - * - * Internally a com.ibm.as400.access.IFSJavaFile object will be - * used to retrieve the contents of the file system. - * - * @param system The system. - * @param request The Http servlet request. - **/ - public FileListElement(AS400 system, HttpServletRequest request) - { - this(); // @B3A - setSystem(system); - setHttpServletRequest(request); - setRenderer(new FileListRenderer(request)); // @A4A - } - - - //@CRS - /** - * Constructs an FileListElement for an IBM i file system - * using the pathInfo from the specified request, and - * the designated system. - * - * Internally a com.ibm.as400.access.IFSJavaFile object will be - * used to retrieve the contents of the file system. - * - * @param system The system. - * @param request The Http servlet request. - **/ - public FileListElement(AS400 system, HttpServletRequest request, String parameterPathInfo) - { - this(); // @B3A - setSystem(system); - setHttpServletRequest(request); - setRenderer(new FileListRenderer(request)); // @A4A - parameterPathInfo_ = parameterPathInfo; - } - - - /** - * Constructs an FileListElement with the specified system, request, and table. - * - * Internally a com.ibm.as400.access.IFSJavaFile object will be - * used to retrieve the contents of the file system. - * - * @param system The system. - * @param request The Http servlet request. - * @param table The HTML table. - **/ - public FileListElement(AS400 system, HttpServletRequest request, HTMLTable table) - { - this(); // @B3A - setSystem(system); - setHttpServletRequest(request); - setTable(table); - setRenderer(new FileListRenderer(request)); // @A4A - } - - - /** - * Constructs a FileListElement with the specified system, requst, NetServer sharePath, and - * NetServer shareName. - * - * Internally a com.ibm.as400.access.IFSJavaFile object will be - * used to retrieve the contents of the file system at the network share point. - * - * @param system The IBM i system. - * @param request The Http servlet request. - * @param shareName The NetServer share name. - * @param sharePath The NetServer share path. - * - **/ - public FileListElement(AS400 system, HttpServletRequest request, String shareName, String sharePath) // @B1A - { - this(); // @B3A - setSystem(system); // @B1A - setHttpServletRequest(request); // @B1A - setRenderer(new FileListRenderer(request, shareName, sharePath)); // @B1A - setShareName(shareName); // @B1A - setSharePath(sharePath); // @B1A - } - - - //@CRS - /** - * Constructs a FileListElement with the specified system, requst, NetServer sharePath, and - * NetServer shareName. - * - * Internally a com.ibm.as400.access.IFSJavaFile object will be - * used to retrieve the contents of the file system at the network share point. - * - * @param system The IBM i system. - * @param request The Http servlet request. - * @param shareName The NetServer share name. - * @param sharePath The NetServer share path. - * - **/ - public FileListElement(AS400 system, HttpServletRequest request, String shareName, String sharePath, String parameterPathInfo) // @B1A - { - this(); // @B3A - setSystem(system); // @B1A - setHttpServletRequest(request); // @B1A - setRenderer(new FileListRenderer(request, shareName, sharePath)); // @B1A - setShareName(shareName); // @B1A - setSharePath(sharePath); // @B1A - parameterPathInfo_ = parameterPathInfo; - } - - - /** - * Adds a PropertyChangeListener. The specified - * PropertyChangeListener's propertyChange - * method is called each time the value of any - * bound property is changed. - * - * @see #removePropertyChangeListener - * @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (changes_ == null) changes_ = new PropertyChangeSupport(this); //@P2A - changes_.addPropertyChangeListener(listener); - } - - - /** - * Returns the Collator. - * - * @return The collator. - **/ - public Collator getCollator() // @B3A - { - return collator_; - } - - - - /** - * Returns the Http servlet request. - * - * @return The request. - **/ - public HttpServletRequest getHttpServletRequest() - { - return request_; - } - - - /** - * Return the file list renderer. - * - * @return The renderer. - **/ - public FileListRenderer getRenderer() - { - return renderer_; - } - - /** - * Return the NetServer share point. - * - * @return The NetServer share path. - **/ - public String getSharePath() // @B1A - { // @B1A - // Need to check for null before - // performing a toString(). - if (sharePath_ == null) - return null; - else - return sharePath_.toString(); // @B1A - } // @B1A - - /** - * Return the name of the NetServer share. - * - * @return The name of the NetServer share. - **/ - public String getShareName() // @B1A - { - // Need to check for null before - // performing a toString(). - if (shareName_ == null) // @B1A - return null; - else - return shareName_.toString(); // @B1A - } // @B1A - - - /** - * Returns the system. - * - * @return The system. - * - **/ - public AS400 getSystem() - { - return system_; - } - - - /** - * Returns the HTMLTable. - * - * @return The table. - **/ - public HTMLTable getTable() - { - return table_; - } - - - /** - * Returns a string containing the list of files and directories - * in the path defined in the HttpServletRequest. - * - * If the system has not been set, a java.io.File object - * will be created with the pathInfo from the HttpServletRequest - * to retrieve the list of file and directories from the - * local file system. - * - * @return The list. - **/ - public String list() - { - return list(new HTMLTableConverter()); - } - - - //@CRS - Added HTMLTableConverter parameter. - /** - * Returns a string containing the list of files and directories - * in the path defined in the HttpServletRequest. - * - * If the system has not been set, a java.io.File object - * will be created with the pathInfo from the HttpServletRequest - * to retrieve the list of file and directories from the - * local file system. - * @param conv An HTMLTableConverter used to format the list of files. - * @return The list. - **/ - public String list(HTMLTableConverter conv) - { - if (conv == null) throw new NullPointerException("conv"); - - if (request_ == null) throw new ExtendedIllegalStateException("request", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - String path = null; - if (parameterPathInfo_ == null) - { - path = request_.getPathInfo(); - } - else - { - path = parameterPathInfo_; - } - - if (path == null) path = "/"; - - if (sharePath_ != null) // @B1A - { - try // @B1A - { - path = sharePath_.append(path.substring(path.indexOf('/', 1), path.length())).toString(); // @B1A - } // @B1A - catch (StringIndexOutOfBoundsException e) // @B1A - { - path = sharePath_.insert(0, "/").toString(); // @B1A - } - } - - try - { - File rootFile = null; - - // @A7A - // If a system_ object is not provided then a java.io.File object will be created with the - // path info from the request. - - if (system_ != null) // @A7A - { - rootFile = new IFSJavaFile(system_, path.replace('\\','/')); - if(patternMatching_ != -1) //@KKB specify the pattern matching to be used - { - try{ - ((IFSJavaFile)rootFile).setPatternMatching(patternMatching_); - } - catch(IOException e) - { - // error occured setting pattern matching for the file, default value will be used - if(Trace.isTraceOn()) - Trace.log(Trace.ERROR, e); - } - } - } - else // @A7A - { - rootFile = new File(path); // @A7A - } - - if (Trace.isTraceOn()) Trace.log(Trace.INFORMATION, "FileListElement path: " + path); // @A6A @C1C - - // Set the default table properties if the user has not set the table. - if (table_ == null) - { - table_ = new HTMLTable(); - table_.setCellPadding(7); - - // Set the converter meta data property. - conv.setUseMetaData(true); - } - else - { - // If the table has been set and the headers are empty, use - // the default headers from the meta data. - if (table_.getHeader() == null) conv.setUseMetaData(true); - } - - // Set the converter table property. - conv.setTable(table_); - - // Use the default renderer if one has not been set. // $C2A - if (renderer_ == null) renderer_ = new FileListRenderer(request_); // $C2A - - ListRowData rowData = renderer_.getRowData(rootFile, sort_, collator_); // $C2C - - if (rowData.length() > 0) // @A6C - { -//@CRS return conv.convert(rowData)[0]; //@P2C - HTMLTable[] tables = conv.convertToTables(rowData); //@CRS - StringBuffer buf = new StringBuffer(); //@CRS - for (int i=0; icollator
    . The collator allows the tree to perform - * locale-sensitive String comparisons when sorting the file list elements. - * - * @param collator The Collator. - **/ - public void setCollator(Collator collator) // @B3A - { - if (collator == null) - throw new NullPointerException("collator"); - - Collator old = collator_; - - collator_ = collator; - - if (changes_ != null) changes_.firePropertyChange("collator", old, collator_); //@P2C - } - - - - /** - * Sets the Http servlet request for the element. - * - * @param request The Http servlet request. - **/ - public void setHttpServletRequest(HttpServletRequest request) - { - if (request == null) - throw new NullPointerException("request"); - - HttpServletRequest old = request_; - - request_ = request; - - if (changes_ != null) changes_.firePropertyChange("request", old, request_); //@P2C - } - - - /** - * Set the renderer for the FileListElement. The default - * is FileListRenderer. - * - * @param renderer The file list renderer. - **/ - public void setRenderer(FileListRenderer renderer) - { - if (renderer == null) - throw new NullPointerException("renderer"); - - FileListRenderer old = renderer_; - - renderer_ = renderer; - - if (changes_ != null) changes_.firePropertyChange("renderer", old, renderer_); //@P2C - } - - - /** - * Set the NetServer share path. - * - * @param sharePath The NetServer share path. - **/ - public void setSharePath(String sharePath) // @B1A - { // @B1A - if (sharePath == null) // @B1A - throw new NullPointerException("sharePath"); // @B1A - // @B1A - StringBuffer old = sharePath_; // @B1A - // @B1A - sharePath_ = new StringBuffer(sharePath); // @B1A - // @B1A - if (changes_ != null) changes_.firePropertyChange("sharePath", //@P2C - old==null ? null : old.toString(), sharePath_.toString()); // @B1A - } - - - /** - * Set the name of the NetServer share. - * - * @param shareName The NetServer share name. - **/ - public void setShareName(String shareName) // @B1A - { // @B1A - if (shareName == null) // @B1A - throw new NullPointerException("shareName"); // @B1A - // @B1A - StringBuffer old = shareName_; // @B1A - // @B1A - shareName_ = new StringBuffer(shareName); // @B1A - // @B1A - if (changes_ != null) changes_.firePropertyChange("shareName", //@P2C - old==null ? null : old.toString(), shareName_.toString()); // @B1A - } - - - /** - * Set the system. - * - * @param system The system. - **/ - public void setSystem(AS400 system) - { - if (system == null) - throw new NullPointerException("system"); - - AS400 old = system_; - - system_ = system; - - if (changes_ != null) changes_.firePropertyChange("system", old, system_); //@P2C - } - - - /** - * Set the HTMLTable to use when displaying the file list. - * This will replace the default HTMLTable used. - * - * @param table The HTML table. - **/ - public void setTable(HTMLTable table) - { - if (table == null) - throw new NullPointerException("table"); - - HTMLTable old = table; - - table_ = table; - - if (changes_ != null) changes_.firePropertyChange("table", old, table_); //@P2C - } - - - /** - * Sorts the list elements. - * - * @param sort true if the elements are sorted; false otherwise. - * The default is true. - **/ - public void sort(boolean sort) // @A2A - { - sort_ = sort; - } - - // @KKB give users a way to specify what pattern should be used when listing files - /** - * Sets the pattern-matching behavior used when files are listed. The default is PATTERN_POSIX. - * @param patternMatching Either {@link IFSFile#PATTERN_POSIX PATTERN_POSIX}, {@link IFSFile#PATTERN_POSIX_ALL PATTERN_POSIX_ALL}, or {@link IFSFile#PATTERN_OS2 PATTERN_OS2} - */ - public void setPatternMatching(int patternMatching){ - if(patternMatching < IFSFile.PATTERN_POSIX || patternMatching > IFSFile.PATTERN_OS2) - throw new ExtendedIllegalArgumentException("patternMatching", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - patternMatching_ = patternMatching; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/FileListElement16.gif b/cvsroot/src/com/ibm/as400/util/html/FileListElement16.gif deleted file mode 100644 index 979b51e18..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/FileListElement16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/FileListElement32.gif b/cvsroot/src/com/ibm/as400/util/html/FileListElement32.gif deleted file mode 100644 index 3de0d2f5e..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/FileListElement32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/FileListElementBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/FileListElementBeanInfo.java deleted file mode 100644 index a715ba273..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/FileListElementBeanInfo.java +++ /dev/null @@ -1,183 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FileListElementBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -The FileListElementBeanInfo class provides -bean information for the FileListElement class. -**/ -public class FileListElementBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class beanClass = FileListElement.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = { changed }; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor renderer = new PropertyDescriptor("renderer", beanClass, // @A2C - "getRenderer", "setRenderer"); // @A2C - renderer.setBound(true); // @A2C - renderer.setConstrained(false); // @A2C - renderer.setDisplayName(loader_.getText("PROP_NAME_RENDERER")); // @A2C - renderer.setShortDescription(loader_.getText("PROP_DESC_RENDERER")); // @A2C - - PropertyDescriptor request = new PropertyDescriptor("httpServletRequest", beanClass, - "getHttpServletRequest", "setHttpServletRequest"); - request.setBound(true); - request.setConstrained(false); - request.setDisplayName(loader_.getText("PROP_NAME_REQUEST")); - request.setShortDescription(loader_.getText("PROP_DESC_REQUEST")); - - PropertyDescriptor system = new PropertyDescriptor("system", beanClass, - "getSystem", "setSystem"); - system.setBound(true); - system.setConstrained(false); - system.setDisplayName(loader_.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(loader_.getText("PROP_DESC_SYSTEM")); - - PropertyDescriptor table = new PropertyDescriptor("table", beanClass, //$A1A - "getTable", "setTable"); //$A1A - table.setBound(true); //$A1A - table.setConstrained(false); //$A1A - table.setDisplayName(loader_.getText("PROP_NAME_TABLE")); //$A1A - table.setShortDescription(loader_.getText("PROP_DESC_TABLE")); //$A1A - - PropertyDescriptor shareName = new PropertyDescriptor("shareName", beanClass, //@B1A - "getShareName", "setShareName"); //@B1A - shareName.setBound(true); //@B1A - shareName.setConstrained(false); //@B1A - shareName.setDisplayName(loader_.getText("PROP_NAME_SHARE_NAME")); //@B1A - shareName.setShortDescription(loader_.getText("PROP_DESC_SHARE_NAME")); //@B1A - - PropertyDescriptor sharePath = new PropertyDescriptor("sharePath", beanClass, //@B1A - "getSharePath", "setSharePath"); //@B1A - sharePath.setBound(true); //@B1A - sharePath.setConstrained(false); //@B1A - sharePath.setDisplayName(loader_.getText("PROP_NAME_SHARE_PATH")); //@B1A - sharePath.setShortDescription(loader_.getText("PROP_DESC_SHARE_PATH")); //@B1A - - PropertyDescriptor collator = new PropertyDescriptor("collator", beanClass, //@B2A - "getCollator", "setCollator"); //@B2A - collator.setBound(true); //@B2A - collator.setConstrained(false); //@B2A - collator.setDisplayName(loader_.getText("PROP_NAME_COLLATOR")); //@B2A - collator.setShortDescription(loader_.getText("PROP_DESC_COLLATOR")); //@B1A - - properties_ = new PropertyDescriptor[] { renderer, request, system, table, shareName, sharePath, collator };//$A1C //@A2C //@B1A //@B2C - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("FileListElement16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("FileListElement32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/util/html/FileListRenderer.java b/cvsroot/src/com/ibm/as400/util/html/FileListRenderer.java deleted file mode 100644 index 2fe16f94c..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/FileListRenderer.java +++ /dev/null @@ -1,479 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FileListRenderer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.IFSJavaFile; // $B4A -import com.ibm.as400.util.servlet.ListMetaData; // $B4A -import com.ibm.as400.util.servlet.ListRowData; // $B4A -import com.ibm.as400.util.servlet.RowMetaDataType; // $B4A -import com.ibm.as400.util.servlet.RowDataException; // $B4A - -import java.io.File; -import java.text.Collator; // $B4A -import java.util.Date; // $B4A -import java.util.Vector; // $B4A -import java.text.SimpleDateFormat; // $B4A -import java.beans.PropertyVetoException; // $B4A -import javax.servlet.http.HttpServletRequest; - - -/** -* The FileListRenderer class renders the name field for directories and files -* in a FileListElement. -*

    -* If the behavior of the default FileListRenderer is not desired, subclass -* FileListRenderer and override the appropriate methods until the -* FileListElement achieves the desired behavior. -*

    -* Subclassing FileListRenderer will allow your servlet to include/exclude -* or change the action of any directory or file in the FileListElement. -* For example, if a servlet did not want users to see any *.exe files, -* A subclass of FileListRenderer would be created and the new class -* would override the getFileName() method to figure out if the File object -* passed to it was a *.exe file, if it is, null could be returned, which -* would indicate that the file should not be displayed. -* -*

    Overriding the getRowData method will allow the addition -* of columns in the row data and also enable the reordering of the -* columns. -* -*

    -* This example creates an FileListElement object with a renderer: -*

    -*

    -*   // Create a FileListElement.
    -*  FileListElement fileList = new FileListElement(sys, httpservletrequest);
    -*  

    -* // Set the renderer specific to this servlet, which extends -* // FileListRenderer and overrides applicable methods. -* fileList.setRenderer(new myFileListRenderer(request)); -*

    -**/ -public class FileListRenderer implements java.io.Serializable -{ - private String uri_; - private String reqPath_; - private StringBuffer sharePath_; // @B1A - private StringBuffer shareName_; // @B1A - - - private SimpleDateFormat formatter_ = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a"); // @B4A - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; // @A5A //$B4A - - // The FileListElement default column headers. - private static String name = loader_.getText("PROP_FLE_NAME_NAME"); // @A5A //$B4A - private static String size = loader_.getText("PROP_FLE_NAME_SIZE"); // @A5A //$B4A - private static String type = loader_.getText("PROP_FLE_NAME_TYPE"); // @A5A //$B4A - private static String modified = loader_.getText("PROP_FLE_NAME_MODIFIED"); // @A5A //$B4A - /** - * Constructs a FileListRenderer with the specified request. - * - * @param request The Http servlet request. - **/ - public FileListRenderer(HttpServletRequest request) - { - if (request == null) - throw new NullPointerException("request"); - - - /* @B2A - According to the JSDK, HttpServletRequest.getServletPath() should - return the path to the servlet as a root relative path so that it - can be used to generate self-referencing URLs. This is equivalent - to the CGI environment variable SCRIPT_NAME. However, some webservers - only return the servlet name preceded by a slash (/) when your - appliation server has a path other than slash (/) configured. - (Note that the only application server that can have slash (/) - for a path is the default application server.) - - request.getServletPath(); - - should return: /servlet/name vs. /name - - What follows is a circumvention to accomplish the same thing. - - The following code strips the path information from the - request URI. - */ - uri_ = request.getRequestURI(); // @B2A - - String servletPath = request.getServletPath(); // @B3A - - int i = uri_.indexOf(servletPath); // @B3A - - uri_ = uri_.substring(0, i + servletPath.length()); // @B3C - - reqPath_ = request.getPathInfo(); - } - - - /** - * Constructs a FileListRenderer with the specified request, NetServer sharePath, - * and the NetServer shareName. - * - * @param request The Http servlet request. - * @param shareName The NetServer share name. - * @param sharePath The NetServer share path. - **/ - public FileListRenderer(HttpServletRequest request, String shareName, String sharePath) - { - this(request); - - if (sharePath == null) // @B1A - throw new NullPointerException("sharePath"); // @B1A - - if (shareName == null) // @B1A - throw new NullPointerException("shareName"); // @B1A - - sharePath_ = new StringBuffer(sharePath); // @B1A - shareName_ = new StringBuffer(shareName); // @B1A - - if (Trace.isTraceOn()) // @B1A - { - // @B1A - Trace.log(Trace.INFORMATION, "Renderer sharePath: " + shareName_); // @B1A - Trace.log(Trace.INFORMATION, "Renderer shareName: " + sharePath_); // @B1A - } // @B1A - } - - - /** - * Return the directory name string. A link to the calling servlet with the - * directory included in the path info by default. If the directory should - * not be added to the FileListElement, a null string should be returned. - * - * @param file The File. - * - * @return The directory name string. - **/ - public String getDirectoryName(File file) - { - if (file == null) - throw new NullPointerException("file"); - - String name = file.getName(); - - StringBuffer buffer = new StringBuffer(""); - buffer.append(name); - buffer.append(""); - - return buffer.toString(); - } - - - /** - * Return the file name string. The file name will be returned by default. - * If the file should not be displayed in the FileListElement, a null string - * should be returned. - * - * @param file The File. - * - * @return The file name string. - **/ - public String getFileName(File file) - { - if (file == null) - throw new NullPointerException("file"); - - return file.getName(); - } - - /** - * Return the parent directory name string. A link to the calling servlet with the - * parent directory included in the path info will be returned by default. If the - * parent should not be display in the FileListElement, a null string should be returned. - * - * @param file The File. - * - * @return The parent name string. - **/ - public String getParentName(File file) - { - if (file == null) - throw new NullPointerException("file"); - String parent = file.getParent(); - - if (parent != null) // @A2A - { - if (sharePath_ != null) // @B1A - { - // @B1A - try // @B1A - { - parent = shareName_.append(parent.substring(sharePath_.length(), parent.length())).toString(); // @B1A - } - // This exception will get thrown when the parent is the only directory in the // @B1A - // path. Thus we know that we are at the beginning of the share. // @B1A - catch (StringIndexOutOfBoundsException e) // @B1A - { - // @B1A - // If the parent directory length is shorter than the share path // @B1A - // then don't display the parent of the share. // @B1A - if (parent.length() < sharePath_.length()) // @B1A - return null; // @B1A - } // @B1A - } // @B1A - // @B1A - if (Trace.isTraceOn()) // @B1A - Trace.log(Trace.INFORMATION, "Renderer parent: " + parent); // @B1A - - StringBuffer buffer = new StringBuffer("../ (Parent Directory)"); - - return buffer.toString(); - } - else // @A2A - return null; // @A2A - } - - - // $B4A - /** - * Return the row data to be displayed in the FileListElement. - * - * @param file The File. - * @param sort true if the elements are sorted; false otherwise. - * The default is true. - * @param collator The Collator. - * - * @return ListRowData The row data. - * - * @exception RowDataException If a row data error occurs. - **/ - public ListRowData getRowData(File file, boolean sort, Collator collator) throws RowDataException - { - // This method used to be in the FileListElement class but was moved into the - // the rederer class so that the user could have more control over the columns - // by being able to add, and reorder the columns (just to name a few). - ListMetaData metaData = new ListMetaData(4); - - metaData.setColumnName(0, "Name"); - metaData.setColumnLabel(0, name); - metaData.setColumnType(0, RowMetaDataType.STRING_DATA_TYPE); - - metaData.setColumnName(1, "Size"); // @A3C - metaData.setColumnLabel(1, size); // @A3C @A5C - metaData.setColumnType(1, RowMetaDataType.INTEGER_DATA_TYPE); // @A3C - - metaData.setColumnName(2, "Type"); - metaData.setColumnLabel(2, type); // @A5C - metaData.setColumnType(2, RowMetaDataType.STRING_DATA_TYPE); - - metaData.setColumnName(3, "Modified"); // @A3C - metaData.setColumnLabel(3, modified); // @A3C @A5C - metaData.setColumnType(3, RowMetaDataType.STRING_DATA_TYPE); // @A3C - - ListRowData rowData = new ListRowData(); - - try - { - rowData.setMetaData(metaData); - } - catch (PropertyVetoException e) - { /* Ignore */ - } - - // Get the string to display from the renderer. This allows // @A4A - // the servlet more flexibility as to which files to display // @A4A - // and how to display them. // @A4A - String parentName = getParentName(file); // @A4A $B4C - - if (parentName != null) // @A4A - { - Object[] row = new Object[4]; - - row[0] = parentName.replace('\\','/'); // @A4C - row[1] = ""; - row[2] = ""; - row[3] = ""; - - rowData.addRow(row); - } - - File[] dirList = null; // @B3A - File[] fileList = null; // @B3A - - if (file instanceof IFSJavaFile) //$A1A - { - // @B3A - // When we are using IFSJavaFile objects, we can use - // the listFiles() method becuase it is not dependant on any - // JDK1.2 code. Using listFiles() will also cache information - // like if it is a directory, so we don't flow another call to the - // system to find that out. We can then build both the - // directory and file list at the same time. - - File[] filesAndDirs = ((IFSJavaFile) file).listFiles(); // @B3A - - // The vector of directories. - Vector dv = new Vector(); // @B3A - - // The vector of files. - Vector fv = new Vector(); // @B3A - - for (int i=0; iThis example creates an FileTreeElement object: -* -*

    -*

    -*  // Create an HTMLTree object.
    -*  HTMLTree tree = new HTMLTree(httpServletRequest);
    -*  

    -* // Create a URLParser object. -* URLParser urlParser = new URLParser(httpServletRequest.getRequestURI()); -*

    -* // Create a object to represent the connection to the system. -* AS400 system = new AS400(mySystem, myUserId, myPassword); -*

    -* // Create an IFS object. -* IFSJavaFile root = new IFSJavaFile(system, "/QIBM"); -*

    -* // Create a DirFilter object and get the directories. -* DirFilter filter = new DirFilter(); -* File[] dirList = root.listFiles(filter); -*

    -* -* for (int i=0; i < dirList.length; i++) -* {

    -* // Create a FileTreeElement. -* FileTreeElement node = new FileTreeElement(dirList[i]); -*

    -* // Set the Icon URL. -* ServletHyperlink sl = new ServletHyperlink(urlParser.getURI()); -* sl.setHttpServletResponse(resp); -* node.setIconUrl(sl); -*

    -* // Add the FileTreeElement to the tree. -* tree.addElement(node); -* } -*

    -* -* Once the elements are added to an HTMLTree object, the FileTreeElements will look like this: -*

    -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -*
    -* + -* -* include -*
    -* + -* -* locales -*
    -* + -* -* ProdData -*
    -* + -* -* Test Folder -*
    -* + -* -* UserData -*
    -* + -* -* XML -*
    -*

    -* FileTreeElement objects generate the following events: -*

      -*
    • ElementEvent - The events fired are: -*
        -*
      • elementAdded -*
      • elementRemoved -*
      -*
    • PropertyChangeEvent -*
    -* -* @see com.ibm.as400.util.html.DirFilter -**/ -public class FileTreeElement extends HTMLTreeElement implements java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2002 International Business Machines Corporation and others."; - static final long serialVersionUID = 210948696422108527L; - - private File file_; - private boolean populated_ = false; - private String parameter_; //@CRS - - private String shareName_; // @B1A @CRS - private String sharePath_; // @B1A @CRS - private int patternMatching_ = -1; // @KKB - - - /** - * Constructs a default FileTreeElement object. - **/ - public FileTreeElement() - { - } - - - /** - * Constructs a FileTreeElement with the specified file. - * - * @param file The file. - **/ - public FileTreeElement(File file) - { - setFile(file); - setText(file.getName()); - } - - - //@CRS - /** - * Constructs a FileTreeElement with the specified file. - * - * @param file The file. - **/ - public FileTreeElement(File file, String parameter) - { - setFile(file); - setText(file.getName()); - parameter_ = parameter; - } - - - /** - * Constructs a FileTreeElement with the specified file, - * NetServer shareName and sharePath. - * - * @param file The file. - * @param shareName The name of the NetServer share. - * @param sharePath The path of the NetServer share. - **/ - public FileTreeElement(File file, String shareName, String sharePath) // @B1A - { // @B1A - setFile(file); // @B1A - setShareName(shareName); // @B1A - setSharePath(sharePath); // @B1A - } // @B1A - - //@CRS - /** - * Constructs a FileTreeElement with the specified file, - * NetServer shareName and sharePath. - * - * @param file The file. - * @param shareName The name of the NetServer share. - * @param sharePath The path of the NetServer share. - **/ - public FileTreeElement(File file, String shareName, String sharePath, String parameter) // @B1A - { // @B1A - setFile(file); // @B1A - setShareName(shareName); // @B1A - setSharePath(sharePath); // @B1A - parameter_ = parameter; - } // @B1A - - - /** - * Added the necessary properties to the text url so that if they - * click on the texturl and are using the FileListElement class, - * they will properly see the directory listing. This will - * avoid externalizing the properties we are passing on the - * HttpServletRequest to show the FileListElements. This only - * applies to FileTreeElements. - **/ - private void addProperties() - { - if (getTextUrl() != null) - { - ServletHyperlink sl = (ServletHyperlink)getTextUrl().clone(); - - // If a share name has been specified, then remove the actual path of the share from the // @B1A - // path info and replace it with just the share name and the directories after the share. // @B1A - if (shareName_ != null) // @B1A - { - // @B1A - String absPath = file_.getAbsolutePath().replace('\\','/'); // @B1A - - if (sharePath_.charAt(0) != '/') // @B1A - absPath = absPath.substring(1); // @B1A - - if (Trace.isTraceOn()) // @B1A - { - // @B1A - Trace.log(Trace.INFORMATION, "FileTree absolute path: " + absPath); // @B1A - Trace.log(Trace.INFORMATION, "FileTree share path: " + sharePath_); // @B1A - } // @B1A - - StringBuffer pathInfo = new StringBuffer(shareName_); // @B1A @CRS - String remainingPath = absPath.substring(sharePath_.length()); //@CRS - if (remainingPath.length() > 0 && remainingPath.charAt(0) != '/') pathInfo.append('/'); //@CRS @KKC - pathInfo.append(remainingPath); // @B1A @CRS - - if (parameter_ != null) //@CRS - { - Properties parms = sl.getProperties(); //@CRS - if (parms == null) parms = new Properties(); //@CRS - parms.put(parameter_, pathInfo.toString()); //@CRS - try { sl.setProperties(parms); } catch(PropertyVetoException pve) {} //@CRS - } - else //@CRS - { - sl.setPathInfo(pathInfo.toString()); // @B1A - } - } // @B1A - else - { - String pathInfo = file_.getAbsolutePath().replace('\\', '/'); //@CRS - if (parameter_ != null) //@CRS - { - Properties parms = sl.getProperties(); //@CRS - if (parms == null) parms = new Properties(); //@CRS - parms.put(parameter_, pathInfo); //@CRS - try { sl.setProperties(parms); } catch(PropertyVetoException pve) {} //@CRS - } - else //@CRS - { - sl.setPathInfo(pathInfo); // @A3C @CRS - } - } - - if (Trace.isTraceOn()) // @B1A - { - Trace.log(Trace.INFORMATION, "FileTree path Info: " + sl.getPathInfo()); // @B1A - } - - try - { - sl.setText(file_.getName()); - } - catch (PropertyVetoException e) - { /* Ignore */ - } - - setTextUrl(sl); - } - } - - - /** - * Returns the file represented by this FileTreeElement. - **/ - public File getFile() - { - return file_; - } - - - /** - * Returns the NetServer share name. - **/ - public String getShareName() // @B1A - { // @B1A - // Need to check for null - // before performing a toString(). - if (shareName_ == null) - return null; - else - return shareName_; // @B1A @CRS - } - - - /** - * Returns the NetServer share path. - **/ - public String getSharePath() // @B1A - { // @B1A - // Need to check for null - // before performing a toString(). - if (sharePath_ == null) - return null; - else - return sharePath_; // @B1A @CRS - } - - - /** - * Indicates if the FileTreeElement is a leaf. - * - * @return true if the element is a leaf, false otherwise. - **/ - public boolean isLeaf() - { - // We don't want the user to have to add the path and list properties to - // the TextUrl for the parent elements in the tree. - if (getTextUrl() != null /*&& getTextUrl().getProperties() == null*/) // @B2C - addProperties(); - - if (!populated_) - return file_.isFile(); - else - return super.isLeaf(); - } - - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - //@P2D changes_ = new PropertyChangeSupport(this); - } - - - /** - * Indicates which FileTreeElement is selected. The hashcode is used - * to determine which element within the tree to expand or collapse. - * - * @param hashcode The hashcode. - **/ - public void selected(int hashcode) - { - // @C1D - - if (hashcode == this.hashCode()) - { - if ((file_.isDirectory()) && (!populated_)) - { - File[] files; - - if (file_ instanceof IFSJavaFile) //$A1A - { - if(patternMatching_ != -1) //@KKB specify the pattern matching to be used - { - try{ - ((IFSJavaFile)file_).setPatternMatching(patternMatching_); - } - catch(IOException e) - { - // error occured setting pattern matching for the file, default value will be used - if(Trace.isTraceOn()) - Trace.log(Trace.ERROR, e); - } - } - - // @B6A - // When we are using IFSJavaFile objects, we can use - // the listFiles() method becuase it is not dependant on any - // JDK1.2 code. Using listFiles() will also cache information - // like if it is a directory, so we don't flow another call to the - // system to find that out. We can then build both the - // directory and file list at the same time. - File[] filesAndDirs = ((IFSJavaFile) file_).listFiles(); // @B6A - - // The vector of directories. - Vector dv = new Vector(); // @B6A - - for (int i=0; i IFSFile.PATTERN_OS2) - throw new ExtendedIllegalArgumentException("patternMatching", - ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - patternMatching_ = patternMatching; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/FileTreeElement16.gif b/cvsroot/src/com/ibm/as400/util/html/FileTreeElement16.gif deleted file mode 100644 index 0ef633656..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/FileTreeElement16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/FileTreeElement32.gif b/cvsroot/src/com/ibm/as400/util/html/FileTreeElement32.gif deleted file mode 100644 index 308061226..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/FileTreeElement32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/FileTreeElementBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/FileTreeElementBeanInfo.java deleted file mode 100644 index 036f5f22c..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/FileTreeElementBeanInfo.java +++ /dev/null @@ -1,168 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FileTreeElementBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -The FileTreeElementBeanInfo class provides -bean information for the FileTreeElement class. -**/ -public class FileTreeElementBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class beanClass = FileTreeElement.class; - - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = { changed }; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor file = new PropertyDescriptor("file", beanClass, - "getFile", "setFile"); - file.setBound(true); - file.setConstrained(false); - file.setDisplayName(loader_.getText("PROP_NAME_FILE")); - file.setShortDescription(loader_.getText("PROP_DESC_FILE")); - - PropertyDescriptor shareName = new PropertyDescriptor("shareName", beanClass, // @B1A - "getShareName", "setShareName"); // @B1A - shareName.setBound(true); // @B1A - shareName.setConstrained(false); // @B1A - shareName.setDisplayName(loader_.getText("PROP_NAME_SHARE_NAME")); // @B1A - shareName.setShortDescription(loader_.getText("PROP_DESC_SHARE_NAME")); // @B1A - - PropertyDescriptor sharePath = new PropertyDescriptor("sharePath", beanClass, // @B1A - "getSharePath", "setSharePath"); // @B1A - sharePath.setBound(true); // @B1A - sharePath.setConstrained(false); // @B1A - sharePath.setDisplayName(loader_.getText("PROP_NAME_SHARE_PATH")); // @B1A - sharePath.setShortDescription(loader_.getText("PROP_DESC_SHARE_PATH")); // @B1A - - properties_ = new PropertyDescriptor[] { file, shareName, sharePath }; // @B1A - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * ButtonFormInput is a subclass of FormInput, this method - * will return a HTMLTreeElementBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new HTMLTreeElementBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("FileTreeElement16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("FileTreeElement32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/FormInput.java b/cvsroot/src/com/ibm/as400/util/html/FormInput.java deleted file mode 100644 index 948fca6d2..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/FormInput.java +++ /dev/null @@ -1,417 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FormInput.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalArgumentException; - -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.beans.PropertyVetoException; - -/** -* The FormInput class represents an input element in an HTML form. -* -*

    FormInput objects generate the following events: -*

      -*
    • PropertyChangeEvent -*
    • VetoableChangeEvent -*
    -**/ -abstract public class FormInput extends HTMLTagAttributes implements java.io.Serializable // @Z1C -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - static final long serialVersionUID = 8967841585682519631L; - - private String name_; // The input field name. - private String value_; // The initial value of the input field. - private int size_ = 0; // The visible size of the field in average char widths. - private String lang_; // The primary language used to display the tags contents. //$B1A - private String dir_; // The direction of the text interpretation. //$B1A - - - transient VetoableChangeSupport vetos_; //@CRS - - /** - * Constructs a default FormInput object. - **/ - public FormInput() - { - super(); - } - - /** - * Constructs a FormInput object with the specified control name. - * @param name The control name of the input field. - **/ - public FormInput(String name) - { - this(); - try - { - setName(name); - } - catch (PropertyVetoException e) - { - } - } - - /** - * Constructs a FormInput object with the specified controal name - * and the initial input value. - * @param name The control name of the input field. - * @param value The initial value of the input field. - **/ - public FormInput(String name, String value) - { - this(name); - try - { - setValue(value); - } - catch (PropertyVetoException e) - { - } - } - - - - /** - * Adds the VetoableChangeListener. The specified VetoableChangeListener's - * vetoableChange method will be called each time the value of any - * constrained property is changed. - * - * @see #removeVetoableChangeListener - * - *@param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); //@CRS - vetos_.addVetoableChangeListener(listener); - } - - - /** - * Returns the direction of the text interpretation. - * @return The direction of the text. - **/ - public String getDirection() //$B1A - { - return dir_; - } - - - /** - * Returns the language of the input element. - * @return The language of the input element. - **/ - public String getLanguage() //$B1A - { - return lang_; - } - - /** - * Returns the control name of the input field. - * @return The control name of the input field. - **/ - public String getName() - { - return name_; - } - - /** - * Returns the initial value of the input field. - * @return The initial value. - **/ - public String getValue() - { - return value_; - } - - /** - * Returns the size of the input field. - * The size refers to the width of the input field in pixels or characters. - * @return The field size. - **/ - public int getSize() - { - return size_; - } - - - /** - * Returns the direction attribute tag. - * @return The direction tag. - **/ - String getDirectionAttributeTag() //$B1A - { - //@C1D - - if ((dir_ != null) && (dir_.length() > 0)) - { - StringBuffer buffer = new StringBuffer(" dir=\""); - buffer.append(dir_); - buffer.append("\""); - - return buffer.toString(); - } - else - return ""; - } - - - /** - * Returns the language attribute tag. - * @return The language tag. - **/ - String getLanguageAttributeTag() //$B1A - { - //@C1D - - if ((lang_ != null) && (lang_.length() > 0)) - { - StringBuffer buffer = new StringBuffer(" lang=\""); - buffer.append(lang_); - buffer.append("\""); - - return buffer.toString(); - } - else - return ""; - } - - - /** - * Returns the name attribute tag. - * @return The name tag. - **/ - String getNameAttributeTag() - { - //@C1D - - if ((name_ != null) && (name_.length() > 0)) - { - StringBuffer buffer = new StringBuffer(" name=\""); - buffer.append(name_); - buffer.append("\""); - - return buffer.toString(); - } - else - return ""; - } - - /** - * Returns the size attribute tag. - * @return The size tag. - **/ - String getSizeAttributeTag() - { - //@C1D - - if (size_ > 0) - { - StringBuffer buffer = new StringBuffer(" size=\""); - buffer.append(size_); - buffer.append("\""); - - return buffer.toString(); - } - else - return ""; - } - - /** - * Returns the value attribute tag. - * @param encode true if the value needs to be encoded; false otherwise. - * @return The value tag. - **/ - String getValueAttributeTag(boolean encode) - { - //@C1D - - if (value_ != null) //@C2C - { - if (Trace.isTraceOn()) - Trace.log(Trace.DIAGNOSTIC, " URL value needs Encoding: " + encode); - - if (encode) - value_ = URLEncoder.encode(value_); - - StringBuffer buffer = new StringBuffer(" value=\""); - buffer.append(value_); - buffer.append("\""); - - return buffer.toString(); - } - else - return ""; - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) //$A1A - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS vetos_ = new VetoableChangeSupport(this); - } - - - - /** - Removes the VetoableChangeListener from the internal list. - If the VetoableChangeListener is not on the list, nothing is done. - @see #addVetoableChangeListener - @param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (vetos_ != null) vetos_.removeVetoableChangeListener(listener); //@CRS - } - - - /** - * Sets the direction of the text interpretation. - * @param dir The direction. One of the following constants - * defined in HTMLConstants: LTR or RTL. - * - * @see com.ibm.as400.util.html.HTMLConstants - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setDirection(String dir) //$B1A - throws PropertyVetoException - { - if (dir == null) - throw new NullPointerException("dir"); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - { - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - String old = dir_; - if (vetos_ != null) vetos_.fireVetoableChange("dir", old, dir ); //@CRS - - dir_ = dir; - - if (changes_ != null) changes_.firePropertyChange("dir", old, dir ); //@CRS - } - - - /** - * Sets the language of the input tag. - * @param lang The language. Example language tags include: - * en and en-US. - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setLanguage(String lang) //$B1A - throws PropertyVetoException - { - if (lang == null) - throw new NullPointerException("lang"); - - String old = lang_; - if (vetos_ != null) vetos_.fireVetoableChange("lang", old, lang ); //@CRS - - lang_ = lang; - - if (changes_ != null) changes_.firePropertyChange("lang", old, lang ); //@CRS - } - - /** - * Sets the control name of the input field. - * @param name The control name of the input field. - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setName(String name) - throws PropertyVetoException - { - if (name == null) - throw new NullPointerException("name"); - - String old = name_; - if (vetos_ != null) vetos_.fireVetoableChange("name", old, name ); //@CRS - - name_ = name; - - if (changes_ != null) changes_.firePropertyChange("name", old, name ); //@CRS - } - - /** - * Sets the size of the input field. - * The size refers to the width of the input field in pixels or characters according to its type. - * - * @param size The field size. - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setSize(int size) - throws PropertyVetoException - { - if (size < 0) - throw new ExtendedIllegalArgumentException("size", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - int old = size_; - if (vetos_ != null) vetos_.fireVetoableChange("size", new Integer(old), new Integer(size) ); //@CRS - - size_ = size; - - if (changes_ != null) changes_.firePropertyChange("size", new Integer(old), new Integer(size) ); //@CRS - } - - /** - * Sets the initial value of the input field. - * @param value The initial input value. - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setValue(String value) - throws PropertyVetoException - { - if (value == null) - throw new NullPointerException("value"); - - String old = value_; - if (vetos_ != null) vetos_.fireVetoableChange("value", old, value ); //@CRS - - value_ = value; - - if (changes_ != null) changes_.firePropertyChange("value", old, value ); //@CRS - } - - - /** - * Returns a String representation for the form input tag. - * @return The tag. - **/ - public String toString() - { - return getTag(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/FormInputBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/FormInputBeanInfo.java deleted file mode 100644 index 08bf302b1..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/FormInputBeanInfo.java +++ /dev/null @@ -1,168 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FormInputBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - - -/** -* The FormInputBeanInfo class provides bean information for the FormInput class. -**/ -public class FormInputBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = FormInput.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor name = new PropertyDescriptor("name", beanClass, - "getName", "setName"); - name.setBound(true); - name.setConstrained(true); - name.setDisplayName(loader_.getText("PROP_NAME_NAME")); - name.setShortDescription(loader_.getText("PROP_FI_DESC_NAME")); - - PropertyDescriptor size = new PropertyDescriptor("size", beanClass, "getSize", "setSize"); - size.setBound(true); - size.setConstrained(true); - size.setDisplayName(loader_.getText("PROP_NAME_SIZE")); - size.setShortDescription(loader_.getText("PROP_FI_DESC_SIZE")); - - PropertyDescriptor value = new PropertyDescriptor("value", beanClass, "getValue", "setValue"); - value.setBound(true); - value.setConstrained(true); - value.setDisplayName(loader_.getText("PROP_NAME_VALUE")); - value.setShortDescription(loader_.getText("PROP_FI_DESC_VALUE")); - - PropertyDescriptor lang = new PropertyDescriptor("lang", beanClass, "getLanguage", "setLanguage"); //$B3A - lang.setBound(true); //$B3A - lang.setConstrained(true); //$B3A - lang.setDisplayName(loader_.getText("PROP_NAME_LANGUAGE")); //$B3A - lang.setShortDescription(loader_.getText("PROP_DESC_LANGUAGE")); //$B3A - - PropertyDescriptor dir = new PropertyDescriptor("dir", beanClass, "getDirection", "setDirection"); //$B3A - dir.setBound(true); //$B3A - dir.setConstrained(true); //$B3A - dir.setDisplayName(loader_.getText("PROP_NAME_DIRECTION")); //$B3A - dir.setShortDescription(loader_.getText("PROP_DESC_DIRECTION")); //$B3A - - properties_ = new PropertyDescriptor[] {name, size, value, lang, dir}; //$B3C - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * FormInput is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/GridLayoutFormPanel.java b/cvsroot/src/com/ibm/as400/util/html/GridLayoutFormPanel.java deleted file mode 100644 index bf7b0cd28..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/GridLayoutFormPanel.java +++ /dev/null @@ -1,505 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: GridLayoutFormPanel.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalArgumentException; - -import java.util.Vector; -import java.beans.*; - -/** -* The GridLayoutFormPanel class represents a grid layout of HTML form elements. -* -*

    GridLayoutFormPanel objects generate the following events: -*

      -*
    • ElementEvent - The events fired are: -*
        -*
      • elementAdded -*
      • elementRemoved -*
      -*
    • PropertyChangeEvent -*
    • VetoableChangeEvent -*
    -* -*

    -* This examples creates a GridLayoutFormPanel object with two columns. -*

    -*  

    // Create a text form input element for the system. -* LabelFormElement sysPrompt = new LabelFormElement("System:"); -* TextFormInput system = new TextFormInput("System"); -*

    // Create a text form input element for the userId. -* LabelFormElement userPrompt = new LabelFormElement("User:"); -* TextFormInput user = new TextFormInput("User"); -*

    // Create a password form input element for the password. -* LabelFormElement passwordPrompt = new LabelFormElement("Password:"); -* PasswordFormInput password = new PasswordFormInput("Password"); -*

    // Create the GridLayoutFormPanel object with two columns and add the form elements. -* GridLayoutFormPanel panel = new GridLayoutFormPanel(2); -* panel.addElement(sysPrompt); -* panel.addElement(system); -* panel.addElement(userPrompt); -* panel.addElement(user); -* panel.addElement(passwordPrompt); -* panel.addElement(password); -*

    // Create the submit button to the form. -* SubmitFormInput logonButton = new SubmitFormInput("logon", "Logon"); -*

    // Create HTMLForm object and add the panel to it. -* HTMLForm form = new HTMLForm(servletURI); -* form.addElement(panel); -* form.addElement(logonButton); -*

    -**/ -public class GridLayoutFormPanel extends LayoutFormPanel -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private int columns_; // The number of columns in the layout. - - private String lang_; // The primary language used to display the tags contents. //$B1A - private String dir_; // The direction of the text interpretation. //$B1A - private String[] columnDir_; // The direction of the text interpretation used on each cell for a given table column. - private String[] columnAlign_; // The alignment used on each cell for a given table column. - private String align_; // The alignment used on the overall table. - - - /** - * Constructs a default GridLayoutFormPanel with one column. - **/ - public GridLayoutFormPanel() - { - super(); - columns_ = 1; - columnDir_ = new String[columns_]; - columnAlign_ = new String[columns_]; - } - - /** - * Constructs a GridLayoutFormPanel with the specified number of columns. - * @param columns The number of columns. - **/ - public GridLayoutFormPanel(int columns) - { - super(); - try - { - setColumns(columns); - } - catch (PropertyVetoException e) - { - } - } - - /** - * Adds a PropertyChangeListener. The specified PropertyChangeListener's - * propertyChange method will be called each time the value of any - * bound property is changed. - * - * @see #removePropertyChangeListener - * - * @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (changes_ == null) changes_ = new PropertyChangeSupport(this); //@CRS - changes_.addPropertyChangeListener(listener); - } - - - /** - * Adds the VetoableChangeListener. The specified VetoableChangeListener's - * vetoableChange method will be called each time the value of any - * constrained property is changed. - * - * @see #removeVetoableChangeListener - * - * @param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); //@CRS - vetos_.addVetoableChangeListener(listener); - } - - /** - * Returns the alignment of the text interpretation. - * @return The alignment of the text. - **/ - public String getAlignment() - { - return align_; - } - - /** - * Returns the alignment attribute tag. - **/ - String getAlignmentAttributeTag() - { - if (align_ != null && align_.length() > 0) - { - return " align=\"" + align_ + "\""; - } - return ""; - } - - /** - * Returns the cell alignment attribute tag for the given column. - **/ - String getCellAlignmentAttributeTag(int column) - { - if (columnAlign_[column] != null && columnAlign_[column].length() > 0) - { - return " align=\"" + columnAlign_[column] + "\""; - } - return ""; - } - - /** - * Returns the cell direction attribute tag for the given column. - **/ - String getCellDirectionAttributeTag(int column) - { - if (columnDir_[column] != null && columnDir_[column].length() > 0) - { - return " dir=\"" + columnDir_[column] + "\""; - } - return ""; - } - - /** - * Returns the alignment of the text that is used for - * elements in a specific column in the grid. Use {@link #getAlignment getAlignment} - * to determine the alignment used for the overall grid. - * @param column The column for which to retrieve the alignment. The column is 0-based. - * @return The alignment of the text, or null if one was not set. - * @see #setColumnAlignment - **/ - public String getColumnAlignment(int column) - { - if (column < 0 || column >= columns_) - { - throw new ExtendedIllegalArgumentException("column", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - return columnAlign_[column]; - } - - /** - * Returns the direction of the text interpretation that is - * used for elements in a specific column in the grid. Use {@link #getDirection getDirection} - * to determine the direction used for the overall grid. - * @param column The column for which to retrieve the direction. The column is 0-based. - * @return The direction of the text, or null if one was not set. - * @see #setColumnDirection - **/ - public String getColumnDirection(int column) - { - if (column < 0 || column >= columns_) - { - throw new ExtendedIllegalArgumentException("column", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - return columnDir_[column]; - } - - /** - * Returns the number of columns in the layout. - * @return The number of columns. - **/ - public int getColumns() - { - return columns_; - } - - - /** - * Returns the direction of the text interpretation. - * @return The direction of the text. - **/ - public String getDirection() //$B1A - { - return dir_; - } - - /** - * Returns the direction attribute tag. - * @return The direction tag. - **/ - String getDirectionAttributeTag() //$B1A - { - //@C1D - - if ((dir_ != null) && (dir_.length() > 0)) - return " dir=\"" + dir_ + "\""; - else - return ""; - } - - - /** - * Returns the language of the input element. - * @return The language of the input element. - **/ - public String getLanguage() //$B1A - { - return lang_; - } - - - /** - * Returns the language attribute tag. - * @return The language tag. - **/ - String getLanguageAttributeTag() //$B1A - { - //@C1D - - if ((lang_ != null) && (lang_.length() > 0)) - return " lang=\"" + lang_ + "\""; - else - return ""; - } - - - /** - * Returns a comment tag. - * This method should not be called. There is no XSL-FO support for this class. - * @return The comment tag. - **/ - public String getFOTag() //@D1A - { - Trace.log(Trace.ERROR, "Attempting to getFOTag() for an object that doesn't support it."); - return ""; - } - - /** - * Returns the grid layout panel tag. - * @return The tag. - **/ - public String getTag() - { - //@C1D - - StringBuffer s = new StringBuffer("\n"); //$B1A - - int index = 0; - for (int i=0; i< getSize(); i++) - { - if (index == 0) - s.append("\n"); - - HTMLTagElement e = getElement(i); - s.append(""); - s.append(e.getTag()); - s.append("\n"); - - index++; - if (index >= columns_) - { - s.append("\n"); - index = 0; - } - } - - if (index != 0) - s.append("\n"); - - s.append("
    \n"); - - return s.toString(); - } - - /** - * Removes the PropertyChangeListener from the internal list. - * If the PropertyChangeListener is not on the list, nothing is done. - * - * @see #addPropertyChangeListener - * - * @param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (changes_ != null) changes_.removePropertyChangeListener(listener); //@CRS - } - - - /** - * Removes the VetoableChangeListener from the internal list. - * If the VetoableChangeListener is not on the list, nothing is done. - * - * @see #addVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (vetos_ != null) vetos_.removeVetoableChangeListener(listener); //@CRS - } - - /** - * Sets the alignment of the text for the grid. - * @param align The alignment. Use one of the following constants - * defined in HTMLConstants: LEFT, RIGHT, or CENTER. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setAlignment(String align) - { - if (align == null) throw new NullPointerException("align"); - if (!align.equals(HTMLConstants.LEFT) && - !align.equals(HTMLConstants.RIGHT) && - !align.equals(HTMLConstants.CENTER)) - { - throw new ExtendedIllegalArgumentException("align", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - align_ = align; - } - - /** - * Sets the alignment of the text interpretation that is used - * for elements in a specific column in the grid. Use {@link #setAlignment setAlignment} - * to set the alignment for the overall grid. - * @param column The column. This value is 0-based. - * @param align The alignment. One of the following constants - * defined in HTMLConstants: LEFT, RIGHT, or CENTER. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setColumnAlignment(int column, String align) - { - if (align == null) throw new NullPointerException("align"); - if (column < 0 || column >= columns_) - { - throw new ExtendedIllegalArgumentException("column", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // If direction is not one of the valid HTMLConstants, throw an exception. - if (!align.equals(HTMLConstants.LEFT) && - !align.equals(HTMLConstants.RIGHT) && - !align.equals(HTMLConstants.CENTER)) - { - throw new ExtendedIllegalArgumentException("align", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - columnAlign_[column] = align; - } - - /** - * Sets the direction of the text interpretation that is used - * for elements in a specific column in the grid. Use {@link #setDirection setDirection} - * to set the direction for the overall grid. - * @param column The column. This value is 0-based. - * @param dir The direction. One of the following constants - * defined in HTMLConstants: LTR or RTL. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setColumnDirection(int column, String dir) - { - if (dir == null) throw new NullPointerException("dir"); - if (column < 0 || column >= columns_) - { - throw new ExtendedIllegalArgumentException("column", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - // If direction is not one of the valid HTMLConstants, throw an exception. - if (!dir.equals(HTMLConstants.LTR) && !dir.equals(HTMLConstants.RTL)) - { - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - columnDir_[column] = dir; - } - - /** - * Sets the number of columns in the layout. - * Note that this will not preserve any column alignment or column direction - * information that was previously set. - * @param columns The number of columns. - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setColumns(int columns) - throws PropertyVetoException - { - if (columns < 0) - throw new ExtendedIllegalArgumentException("columns", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - int old = columns_; - if (vetos_ != null) vetos_.fireVetoableChange("columns", new Integer(old), new Integer(columns) ); //@CRS - - columns_ = columns; - columnDir_ = new String[columns_]; // Don't preserve the old direction info. - columnAlign_ = new String[columns_]; // Don't preserve the old alignment info. - - if (changes_ != null) changes_.firePropertyChange("columns", new Integer(old), new Integer(columns) ); //@CRS - } - - /** - * Sets the direction of the text interpretation. - * @param dir The direction. One of the following constants - * defined in HTMLConstants: LTR or RTL. - * - * @see com.ibm.as400.util.html.HTMLConstants - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setDirection(String dir) //$B1A - throws PropertyVetoException - { - if (dir == null) - throw new NullPointerException("dir"); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - { - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - String old = dir_; - if (vetos_ != null) vetos_.fireVetoableChange("dir", old, dir ); //@CRS - - dir_ = dir; - - if (changes_ != null) changes_.firePropertyChange("dir", old, dir ); //@CRS - } - - - /** - * Sets the language of the input tag. - * @param lang The language. Example language tags include: - * en and en-US. - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setLanguage(String lang) //$B1A - throws PropertyVetoException - { - if (lang == null) - throw new NullPointerException("lang"); - - String old = lang_; - if (vetos_ != null) vetos_.fireVetoableChange("lang", old, lang ); //@CRS - - lang_ = lang; - - if (changes_ != null) changes_.firePropertyChange("lang", old, lang ); //@CRS - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/GridLayoutFormPanel16.gif b/cvsroot/src/com/ibm/as400/util/html/GridLayoutFormPanel16.gif deleted file mode 100644 index 00fab4048..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/GridLayoutFormPanel16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/GridLayoutFormPanel32.gif b/cvsroot/src/com/ibm/as400/util/html/GridLayoutFormPanel32.gif deleted file mode 100644 index 2acae3345..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/GridLayoutFormPanel32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/GridLayoutFormPanelBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/GridLayoutFormPanelBeanInfo.java deleted file mode 100644 index 245189355..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/GridLayoutFormPanelBeanInfo.java +++ /dev/null @@ -1,169 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: GridLayoutFormPanelBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -The GridLayoutFormPanelBeanInfo class provides -bean information for the GridLayoutFormPanel class. -**/ -public class GridLayoutFormPanelBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = GridLayoutFormPanel.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor columns = new PropertyDescriptor("columns", beanClass, "getColumns", "setColumns"); - columns.setBound(true); - columns.setConstrained(true); - columns.setDisplayName(loader_.getText("PROP_NAME_COLUMNS")); - columns.setShortDescription(loader_.getText("PROP_GL_DESC_COLUMNS")); - - PropertyDescriptor size = new PropertyDescriptor("size", beanClass, "getSize", null); - size.setBound(false); - size.setConstrained(false); - size.setDisplayName(loader_.getText("PROP_NAME_SIZE")); - size.setShortDescription(loader_.getText("PROP_DESC_PANELSIZE")); - - PropertyDescriptor lang = new PropertyDescriptor("lang", beanClass, "getLanguage", "setLanguage"); //$B3A - lang.setBound(true); //$B3A - lang.setConstrained(true); //$B3A - lang.setDisplayName(loader_.getText("PROP_NAME_LANGUAGE")); //$B3A - lang.setShortDescription(loader_.getText("PROP_DESC_LANGUAGE")); //$B3A - - PropertyDescriptor dir = new PropertyDescriptor("dir", beanClass, "getDirection", "setDirection"); //$B3A - dir.setBound(true); //$B3A - dir.setConstrained(true); //$B3A - dir.setDisplayName(loader_.getText("PROP_NAME_DIRECTION")); //$B3A - dir.setShortDescription(loader_.getText("PROP_DESC_DIRECTION")); //$B3A - - properties_ = new PropertyDescriptor[] { columns, size, lang, dir }; //$B3C - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("GridLayoutFormPanel16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("GridLayoutFormPanel32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HMRI.java b/cvsroot/src/com/ibm/as400/util/html/HMRI.java deleted file mode 100644 index bba589e32..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HMRI.java +++ /dev/null @@ -1,365 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HMRI.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.util.ListResourceBundle; - -/** -Locale-specific objects for the IBM Toolbox for Java. -**/ -public class HMRI extends ListResourceBundle -{ - // NLS_MESSAGEFORMAT_NONE - // Each string is assumed NOT to be processed by the MessageFormat class. - // This means that a single quote must be coded as 1 single quote. - - // NLS_ENCODING=UTF-8 - // Instructs the translation tools to interpret the text as UTF-8. - - public Object[][] getContents() - { - return resources; - } - - private final static Object[][] resources= { - - // #TRANNOTE Before you add a new resource, please make - // #TRANNOTE sure you are not duplicating another. The - // #TRANNOTE goal is to keep the amount of translatable - // #TRANNOTE text down. - // #TRANNOTE - // #TRANNOTE NOTE TO TRANSLATORS: The format of a line of MRI - // #TRANNOTE is { "KEY", "value" }, - // #TRANNOTE - // #TRANNOTE The key must be left alone so translate only the value. - // #TRANNOTE - - - - // #TRANNOTE ##################################################### - // #TRANNOTE Short descriptions and display names for events. - // #TRANNOTE Descriptions start with EVT_DESC_ prefix, display - // #TRANNOTE names start with EVT_NAME. - // #TRANNOTE ##################################################### - - { "EVT_DESC_SC_EVENT", "A section completed event has occurred." }, - - // #TRANNOTE A section completed event has occurred. - { "EVT_NAME_SC_EVENT", "sectionCompletedEvent" }, - { "EVT_DESC_RD_EVENT", "A row data event has occurred." }, - - // #TRANNOTE A row data event has occurred. - { "EVT_NAME_RD_EVENT", "rowDataEvent" }, - - // #TRANNOTE A bound property has changed. - // #TRANNOTE The meaning of 'property' here is like 'attribute'. - { "EVT_NAME_PROPERTY_CHANGE", "propertyChange" }, - { "EVT_DESC_PROPERTY_CHANGE", "A bound property has changed." }, - - // #TRANNOTE A constrained property has changed. - // #TRANNOTE The meaning of 'property' here is like 'attribute'. - { "EVT_NAME_PROPERTY_VETO", "vetoableChange" }, - { "EVT_DESC_PROPERTY_VETO", "A constrained property has changed." }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE Short descriptions and display names for properties. - // #TRANNOTE Descriptions start with PROP__DESC_ or - // #TRANNOTE PROP_DESC_ prefix, display names start with PROP_NAME_ - // #TRANNOTE or with PROP__NAME_. - // #TRANNOTE ##################################################### - - { "PROP_NAME_NAME", "name" }, - { "PROP_FI_DESC_NAME", "The name of the Form Input." }, - { "PROP_RG_DESC_NAME", "The name of the Radio Group." }, - { "PROP_SF_DESC_NAME", "The name of the Select Form." }, - { "PROP_TA_DESC_NAME", "The name of the Text Area." }, - { "PROP_HHLNK_DESC_NAME", "The bookmark name for the resource link." }, - - { "PROP_NAME_SIZE", "size" }, - { "PROP_FI_DESC_SIZE", "The width of the input field." }, - { "PROP_SF_DESC_SIZE", "The number of visible options." }, - { "PROP_HTXT_DESC_SIZE", "The size of the text." }, - { "PROP_DESC_PANELSIZE", "The number of elements in the layout." }, - - { "PROP_NAME_VALUE", "value" }, - { "PROP_FI_DESC_VALUE", "The initial value of the input field." }, - { "PROP_SO_DESC_VALUE", "The value used when the form is submitted." }, - - { "PROP_NAME_COLUMNS", "columns" }, - { "PROP_GL_DESC_COLUMNS", "The number of columns in the layout." }, - { "PROP_TA_DESC_COLUMNS", "The number of visible columns in the text area." }, - - // #TRANNOTE Denotes a Web URL (Uniform Resource Locator) or Web Page - { "PROP_NAME_URL", "URL" }, - { "PROP_DESC_URL", "The ACTION URL address of the form handler on the web server." },//@550 - { "PROP_NAME_METHOD", "method" }, - { "PROP_DESC_METHOD", "The HTTP method used for sending form contents to the web server." }, //@550 - - { "PROP_NAME_TARGET", "target" }, - { "PROP_HF_DESC_TARGET", "The target frame for the form response." }, - { "PROP_HHLNK_DESC_TARGET", "The target frame for the resource link." }, - - { "PROP_NAME_HIDDENPARAMETERLIST", "hiddenParameterList" }, - { "PROP_DESC_HIDDENPARAMETERLIST", "The hidden parameter list for the form." }, - - { "PROP_NAME_LINK", "link" }, - { "PROP_DESC_LINK", "The Uniform Resource Identifier (URI) for the resource link." }, - { "PROP_NAME_PROPERTIES", "properties" }, - { "PROP_DESC_PROPERTIES", "The properties for the resource link." }, - - { "PROP_NAME_TEXT", "text" }, - { "PROP_HT_DESC_TEXT", "The text displayed in the HTML document." }, - { "PROP_SO_DESC_TEXT", "The option text." }, - { "PROP_TA_DESC_TEXT", "The initial text of the text area." }, - { "PROP_HHLNK_DESC_TEXT", "The text representation for the resource link." }, - { "PROP_HTXT_DESC_TEXT", "The text value of the HTML text." }, - - { "PROP_NAME_TITLE", "title" }, - { "PROP_DESC_TITLE", "The title for the resource link." }, - - { "PROP_NAME_ALIGNMENT", "alignment" }, - { "PROP_DESC_ALIGNMENT", "The alignment of the text following the image." }, - { "PROP_HTBL_DESC_ALIGNMENT", "The horizontal alignment of the table." }, - { "PROP_HTCAP_DESC_ALIGNMENT", "The alignment of the table caption." }, - { "PROP_HTXT_DESC_ALIGNMENT", "The horizontal alignment of the text." }, - - { "PROP_NAME_HEIGHT", "height" }, - { "PROP_DESC_HEIGHT", "The height of the image." }, - { "PROP_HTCELL_DESC_HEIGHT", "The height of the table cell." }, - - { "PROP_NAME_SOURCE", "source" }, - { "PROP_DESC_SOURCE", "The source URL for the image." }, - - { "PROP_NAME_WIDTH", "width" }, - { "PROP_DESC_WIDTH", "The width of the image." }, - { "PROP_HTCELL_DESC_WIDTH", "The width of the table cell." }, - { "PROP_HTBL_DESC_WIDTH", "The width of the table." }, - - { "PROP_NAME_LABEL", "label" }, - { "PROP_LF_DESC_LABEL", "The text label." }, - { "PROP_TF_DESC_LABEL", "The viewable text label for the toggle." }, - - { "PROP_NAME_ACTION", "action" }, //$A3A - { "PROP_DESC_ACTION", "The script to execute when the button is pressed." }, //$A3A - - { "PROP_NAME_MULTIPLE", "multiple" }, - { "PROP_DESC_MULTIPLE", "Specifies whether multiple selections can be made." }, - - { "PROP_NAME_SELECTED", "selected" }, - { "PROP_DESC_SELECTED", "Specifies whether the option defaults as being selected." }, - - // #TRANNOTE Specifies the maximum length of the text field. - { "PROP_NAME_MAXLENGTH", "maxLength" }, - { "PROP_DESC_MAXLENGTH", "The maximum number of characters permitted in the text field." }, - - { "PROP_NAME_ROWS", "rows" }, - { "PROP_DESC_ROWS", "The number of visible rows in the text area." }, - - { "PROP_NAME_CHECKED", "checked" }, - { "PROP_DESC_CHECKED", "Specifies whether the toggle initializes to being checked." }, - - { "PROP_NAME_COUNT", "count" }, - { "PROP_DESC_COUNT", "The number of elements in the option layout." }, - { "PROP_HTROW_DESC_COUNT", "The number of columns in the table row." }, - - { "PROP_NAME_BOLD", "bold" }, - { "PROP_DESC_BOLD", "The bold style attribute of the text." }, - { "PROP_NAME_COLOR", "color" }, // @A4 - { "PROP_DESC_COLOR", "The color attribute of the text." }, - { "PROP_NAME_FIXED", "fixed" }, - { "PROP_DESC_FIXED", "The fixed font style attribute of the text." }, - { "PROP_NAME_ITALIC", "italic" }, - { "PROP_DESC_ITALIC", "The italic style attribute of the text." }, - { "PROP_NAME_UNDERSCORE", "underscore" }, - { "PROP_DESC_UNDERSCORE", "The underscore style attribute of the text." }, - - { "PROP_NAME_CSPAN", "columnSpan" }, - { "PROP_DESC_CSPAN", "The column span of the table cell." }, - { "PROP_NAME_RSPAN", "rowSpan" }, - { "PROP_DESC_RSPAN", "The row span of the table cell." }, - - { "PROP_NAME_WRAP", "wrap" }, - { "PROP_DESC_WRAP", "The HTML linebreaking convention of the table cell." }, - - { "PROP_NAME_HALIGN", "horizontalAlignment" }, - { "PROP_HTCELL_DESC_HALIGN", "The horizontal alignment of the table cell." }, - { "PROP_HTROW_DESC_HALIGN", "The horizontal alignment of the table row." }, - - { "PROP_NAME_VALIGN", "verticalAlignment" }, - { "PROP_HTCELL_DESC_VALIGN", "The vertical alignment of the table cell." }, - { "PROP_HTROW_DESC_VALIGN", "The vertical alignment of the table row." }, - { "PROP_RG_DESC_VALIGN", "The vertical alignment of the radio group." }, //$A2A - - { "PROP_NAME_HPERCENT", "heightInPercent" }, - { "PROP_DESC_HPERCENT", "The height unit in pixels or percent of the table cell." }, - { "PROP_NAME_WPERCENT", "widthInPercent" }, - { "PROP_HTCELL_DESC_WPERCENT", "The width unit of the table cell in pixels or percent." }, - { "PROP_HTBL_DESC_WPERCENT", "The width unit of the table in pixels or percent." }, - - { "PROP_NAME_BORDERWIDTH", "borderWidth" }, - { "PROP_DESC_BORDERWIDTH", "The border width of the table." }, - { "PROP_NAME_CAPTION", "caption" }, - { "PROP_DESC_CAPTION", "The caption of the table." }, - { "PROP_NAME_DEFAULTROW", "defaultRow" }, - { "PROP_DESC_DEFAULTROW", "The default row of the table." }, - { "PROP_NAME_DEFAULTCELL", "defaultCell" }, - { "PROP_DESC_DEFAULTCELL", "The default cell of the table." }, - { "PROP_NAME_HEADER", "header" }, - { "PROP_DESC_HEADER", "The column headers of the table." }, - { "PROP_NAME_CELLPADDING", "cellPadding" }, - { "PROP_DESC_CELLPADDING", "The cell padding of the table." }, - { "PROP_NAME_CELLSPACING", "cellSpacing" }, - { "PROP_DESC_CELLSPACING", "The cell spacing of the table." }, - { "PROP_NAME_HEADERINUSE", "headerInUse" }, - { "PROP_DESC_HEADERINUSE", "Indicates whether the table header is in use." }, - - { "PROP_NAME_ITEMDATA", "itemData" }, //$B1A - { "PROP_HLI_DESC_ITEMDATA", "The data in the HTML list item." }, //$B1A - - { "PROP_NAME_COMPACT", "compact" }, //$B1A - { "PROP_HL_DESC_COMPACT", "Indicates whether the list is compact." }, //$B1A - - { "PROP_NAME_ITEMS", "items" }, //$B1A - { "PROP_HL_DESC_ITEMS", "The items in the HTML list." }, //$B1A - - { "PROP_NAME_TYPE", "type" }, //$B1A - { "PROP_OUL_DESC_TYPE", "The labeling scheme of the HTML list." }, //$B1A - { "PROP_OULI_DESC_TYPE", "The labeling scheme of the HTML list item." }, //$B1A - - { "PROP_NAME_START", "start" }, //$B1A - { "PROP_OL_DESC_START", "The starting number to use in incrementing the list structure." }, //$B1A - - { "PROP_OLI_DESC_VALUE", "A number, other than the incremented value, for the current list item." }, //$B1A - - { "PROP_NAME_ALIGN", "align" }, //$B1A - { "PROP_HH_DESC_ALIGN", "The alignment of the HTML heading." }, //$B1A - { "PROP_HA_DESC_ALIGN", "The horizontal alignment for a block of HTML." }, //$B1A - - { "PROP_NAME_LEVEL", "level" }, //$B1A - { "PROP_HH_DESC_LEVEL", "The level of importance of the HTML header." }, //$B1A - - { "PROP_HH_DESC_TEXT", "The text displayed in the HTML heading." }, //$B1A - - - { "PROP_HS_DESC_NAME", "The name of the servlet class file." }, //$B2A - { "PROP_HS_DESC_TEXT", "The alternate text for the servlet to display." }, //$B2A - { "PROP_HP_DESC_NAME", "The name of the parameter." }, //$B2A $B4C - { "PROP_HP_DESC_VALUE", "The value of the parameter." }, //$B2A $B4C - - { "PROP_NAME_LOCATION", "location" }, //$B2A - { "PROP_HS_DESC_LOCATION", "The remote location from which the servlet should be loaded." }, //$B2A - - { "PROP_DESC_SERVLET_ALTTEXT", "If you see this text, the web server providing this page does not support the SERVLET tag." }, //$B2A - - { "PROP_NAME_LANGUAGE", "language" }, //$B3A - { "PROP_DESC_LANGUAGE", "The primary language to be used by the contents of the element." }, //$B3A - - { "PROP_NAME_DIRECTION", "direction" }, //$B3A - { "PROP_DESC_DIRECTION", "The direction of the text interpretation." }, //$B3A - - { "PROP_HH_DESC_TITLE", "The title of the HTML document." }, //$B4A - - { "PROP_HM_DESC_NAME", "The name of the property." }, //$B4A - - { "PROP_NAME_HTTPEQUIV", "HTTP-EQUIV" }, //$B4A - { "PROP_HM_DESC_HTTPEQUIV", "The HTTP-EQUIV meta information." }, //$B4A - - { "PROP_NAME_CONTENT", "content" }, //$B4A - { "PROP_HM_DESC_CONTENT", "The value of a named property." }, //$B4A - - { "PROP_HM_DESC_URL", "The url to reload after the time specified in the content attribute." }, //$B4A - - - { "PROP_NAME_ARCHIVE", "archive" }, //$B6A - { "PROP_HA_DESC_ARCHIVE", "One or more archives containing classes and other resources that will be used by the applet." }, //$B6A - - { "PROP_NAME_CODE", "code" }, //$B6A - { "PROP_HA_DESC_CODE", "The name of the applet class." }, //$B6A - - { "PROP_NAME_CODEBASE", "codebase" }, //$B6A - { "PROP_HA_DESC_CODEBASE", "The base URL of the applet." }, //$B6A - - { "PROP_HA_DESC_WIDTH", "The width of the applet in pixels." }, //$B6A - { "PROP_HA_DESC_HEIGHT", "The height of the applet in pixels." }, //$B6A - { "PROP_DESC_APPLET_ALTTEXT", "If you see this text, the browser does not support the APPLET tag or the applet has failed to load." }, //$B6A - - { "PROP_NAME_ICONURL", "iconUrl" }, //$B7A - { "PROP_DESC_ICONURL", "The URL for the expanded and collapsed icon." }, //$B7A - { "PROP_HTE_DESC_TEXT", "The text displayed in the HTMLTreeElement." }, //$B7A - { "PROP_NAME_TEXTURL", "textUrl" }, //$B7A - { "PROP_DESC_TEXTURL", "The URL for the HTMLTreeElement text." }, //$B7A - { "PROP_NAME_REQUEST", "request" }, //$B7A - { "PROP_DESC_REQUEST", "The http servlet request." }, //$B7A - { "PROP_NAME_SYSTEM", "system" }, //$B8A - { "PROP_DESC_SYSTEM", "The system on which the objects reside." }, //$B8A @550 - { "PROP_NAME_RENDERER", "renderer" }, //$B8A @B9C - { "PROP_DESC_RENDERER", "The renderer used to display FileListElement data." }, //$B8A @B9C - { "PROP_NAME_TABLE", "table" }, //$B8A - { "PROP_DESC_TABLE", "The HTML table used to display FileListElement data." }, //$B8A - - { "PROP_NAME_ATTRIBUTES", "attributes" }, // @Z1A - { "PROP_DESC_ATTRIBUTES", "The additional HTML tag attributes." }, // @Z1A - - { "PROP_FLE_NAME_NAME", "Name" }, // @C1A - { "PROP_FLE_NAME_SIZE", "Size" }, // @C1A - { "PROP_FLE_NAME_TYPE", "Type" }, // @C1A - { "PROP_FLE_NAME_MODIFIED", "Modified" }, // @C1A - - { "PROP_DESC_LOCATION", "The bookmark location of the resource link within a document."}, // @C2A - - { "PROP_NAME_FILE", "file"}, // @D1A - { "PROP_DESC_FILE", "The Integrated File System file represented by this FileTreeElement."}, // @D1A - { "PROP_NAME_SHARE_NAME", "shareName"}, // @D1A - { "PROP_DESC_SHARE_NAME", "The NetServer share name."}, // @D1A - { "PROP_NAME_SHARE_PATH", "sharePath"}, // @D1A - { "PROP_DESC_SHARE_PATH", "The NetServer share path."}, // @D1A - - { "PROP_NAME_ALT", "alt"}, // @D2A - { "PROP_DESC_ALT", "The alternate text."}, // @D2A - { "PROP_NAME_BORDER", "border"}, // @D2A - { "PROP_DESC_BORDER", "The thickness of the border around the image."}, // @D2A - { "PROP_HI_DESC_NAME", "The name of the image." }, // @D2A - { "PROP_NAME_HSPACE", "hspace"}, // @D2A - { "PROP_DESC_HSPACE", "The horizontal space around the image."}, // @D2A - { "PROP_NAME_VSPACE", "vspace"}, // @D2A - { "PROP_DESC_VSPACE", "The vertical space around the image."}, // @D2A - - { "PROP_NAME_COLLATOR", "collator"}, // @D2A - { "PROP_DESC_COLLATOR", "The class that performs locale-sensitive String comparisons."}, // @D2A - - { "PROP_NAME_EXPAND", "Expand"}, // @D3A - { "PROP_NAME_COMPRESS", "Compress"}, // @D3A - { "PROP_NAME_WORK", "Work with document"}, // @D3A - - { "PROP_NAME_FORMATTING_OBJECT", "useFO"}, //@E1A - { "PROP_DESC_FORMATTING_OBJECT", "Indicates if formatting object tags are outputted."}, //@E1A - { "PROP_NAME_HD_HEIGHT", "height"}, //@E1A - { "PROP_HD_DESC_HEIGHT", "The height of the page in inches."}, //@E1A - { "PROP_NAME_HD_WIDTH", "width"}, //@E1A - { "PROP_HD_DESC_WIDTH", "The width of the page in inches."}, //@E1A - { "PROP_NAME_MARGIN_TOP", "marginTop"}, //@E1A - { "PROP_DESC_MARGIN_TOP", "The width, in inches, of the top margin of the page."}, //@E1A - { "PROP_NAME_MARGIN_BOTTOM", "marginBottom"}, //@E1A - { "PROP_DESC_MARGIN_BOTTOM", "The width, in inches, of the bottom margin of the page."}, //@E1A - { "PROP_NAME_MARGIN_LEFT", "marginLeft"}, //@E1A - { "PROP_DESC_MARGIN_LEFT", "The width, in inches, of the left margin of the page."}, //@E1A - { "PROP_NAME_MARGIN_RIGHT", "marginRight"}, //@E1A - { "PROP_DESC_MARGIN_RIGHT", "The width, in inches, of the right margin of the page."}, //@E1A - - - - }; - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLAlign.java b/cvsroot/src/com/ibm/as400/util/html/HTMLAlign.java deleted file mode 100644 index ca17509e8..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLAlign.java +++ /dev/null @@ -1,521 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLAlign.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; - -import java.util.Vector; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; - - -/** -* The HTMLAlign class represents a block formatting element, which uses the HTML -* <DIV> tag, within an HTML page. The tag has an implied line break before -* and after the tag. -*

    -* This example creates a HTMLAlign tag: -*

    -*  // Create an ordered list.
    -*  OrderedList list = new OrderedList(HTMLConstants.LARGE_ROMAN);
    -*  OrderedListItem listItem = new OrderedListItem();
    -*  listItem.setItemData(new HTMLText("my list item"));
    -*  list.addListItem(listItem);
    -*  

    -* // Align the list. -* HTMLAlign align = new HTMLAlign(list, HTMLConstants.CENTER); -* System.out.println(align); -*

    -*

    -* Here is the output of the HTMLAlign tag:
    -*

    -*  <div align="center">
    -*  <ol type="I">
    -*  <li type="i">my list item</li>
    -*  </ol>
    -*  </div>
    -*  
    -* -*

    -* Calling getFOTag() would produce the following: -*

    -*  <fo:block text-align='center'>
    -*  <fo:block-container>
    -*  <fo:list-block>
    -*  <fo:list-item>
    -*  <fo:list-item-label>I.</fo:list-item-label>
    -*  <fo:list-item-body><fo:block-container><fo:block>my list item</fo:block>
    -*  </fo:block-container>
    -*  </fo:list-item-body>
    -*  </fo:list-item>
    -*  </fo:list-block>
    -*  </fo:block-container>
    -*  </fo:block>
    -*  
    -* -*

    HTMLAlign objects generate the following events: -*

      -*
    • ElementEvent - The events fired are: -*
        -*
      • elementAdded -*
      • elementRemoved -*
      -*
    • PropertyChangeEvent -*
    -**/ -public class HTMLAlign extends HTMLTagAttributes implements java.io.Serializable // @Z1C -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - static final long serialVersionUID = -7673670119386729128L; - - private String align_ = HTMLConstants.LEFT; - - private String lang_; // The primary language used to display the tags contents. //$B1A - private String dir_; // The direction of the text interpretation. //$B1A - private boolean useFO_ = false; //Indicates if XSL-FO tags are outputted. //@D1A - - private Vector list_ = new Vector(); - - transient private Vector elementListeners; // The list of element listeners @CRS - - - /** - * Constructs a default HTMLAlign object. - **/ - public HTMLAlign() - { - super(); - - } - - - /** - * Constructs an HTMLAlign object with the specified data. - * The default alignment is left. - * - * @param data The data to align. - **/ - public HTMLAlign(HTMLTagElement data) - { - super(); - - addItem(data); - - } - - - /** - * Constructs an HTMLAlign object with the specified data and align attribute. - * - * @param data The data to align. - * @param align The type of alignment. One of the following constants - * defined in HTMLConstants: LEFT, RIGHT, or CENTER. - **/ - public HTMLAlign(HTMLTagElement data, String align) - { - super(); - - addItem(data); - setAlign(align); - } - - - /** - * Adds an HTMLTagElement to the list of tags to align. - * - * @param data The data to align. - **/ - public void addItem(HTMLTagElement data) - { - //@C1D - - if (data == null) - throw new NullPointerException("data"); - - list_.addElement(data); - - fireElementEvent(ElementEvent.ELEMENT_ADDED); - } - - - /** - * Adds an ElementListener. - * - * @param listener The ElementListener. - **/ - public void addItemElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (elementListeners == null) elementListeners = new Vector(); //@CRS - elementListeners.addElement(listener); - } - - - - /** - * Fires the element event. - **/ - private void fireElementEvent(int evt) - { - if (elementListeners == null) return; - Vector targets; - targets = (Vector) elementListeners.clone(); - ElementEvent elementEvt = new ElementEvent(this, evt); - for (int i = 0; i < targets.size(); i++) - { - ElementListener target = (ElementListener)targets.elementAt(i); - if (evt == ElementEvent.ELEMENT_ADDED) - target.elementAdded(elementEvt); - else if (evt == ElementEvent.ELEMENT_REMOVED) - target.elementRemoved(elementEvt); - } - } - - - /** - * Returns the alignment of the HTMLAlign object. - * @return The alignment. - **/ - public String getAlign() - { - return align_; - } - - - /** - * Returns the direction of the text interpretation. - * @return The direction of the text. - **/ - public String getDirection() //$B1A - { - return dir_; - } - - - /** - * Returns the direction attribute tag. - * @return The direction tag. - **/ - String getDirectionAttributeTag() //$B1A - { - - - if(useFO_) //@D1A - { //@D1A - //If outputting XSL-FO Tags //@D1A - if((dir_!=null) && (dir_.length()>0)) //@D1A - { //@D1A - if(dir_.equals(HTMLConstants.RTL)) //@D1A - return " writing-mode='rl'"; //@D1A - else //@D1A - return " writing-mode='lr'"; //@D1A - } //@D1A - else //@D1A - return ""; //@D1A - } //@D1A - else //@D1A - { //@D1A - - //@C1D - - if ((dir_ != null) && (dir_.length() > 0)) - return " dir=\"" + dir_ + "\""; - else - return ""; - } //@D1A - } - - - /** - * Returns the language of the input element. - * @return The language of the input element. - **/ - public String getLanguage() //$B1A - { - return lang_; - } - - - /** - * Returns the language attribute tag. - * @return The language tag. - **/ - String getLanguageAttributeTag() //$B1A - { - //@C1D - - if ((lang_ != null) && (lang_.length() > 0)) - return " lang=\"" + lang_ + "\""; - else - return ""; - } - - - /** - * Returns the tag for the HTML alignment. - * @return The tag. - **/ - public String getTag() - { - //@C1D - - if(useFO_) //@D1A - return getFOTag(); //@D1A - - if (list_.isEmpty()) - { - Trace.log(Trace.ERROR, "Attempting to get tag before adding items to list."); - throw new ExtendedIllegalStateException( - "data", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - StringBuffer s = new StringBuffer(""); - - if (align_ != null) - { - if (align_.equals(HTMLConstants.LEFT)) - s.append("
    \n"); //$B1C - - for (int i=0; i < list_.size(); i++) - { - HTMLTagElement data = (HTMLTagElement)list_.elementAt(i); - s.append(data.getTag()); - } - - s.append("\n
    \n"); - - return s.toString(); - } - - - /** - * Returns the tag for the XSL-FO alignment. - * The language attribute is not supported in XSL-FO. - * @return The tag. - **/ - public String getFOTag() //@D1A - { - //Save current useFO_ value - boolean useFO = useFO_; - - //Indicate that XSL-FO tags are outputted. - setUseFO(true); - - if (list_.isEmpty()) - { - Trace.log(Trace.ERROR, "Attempting to get XSL-FO tag before adding items to list."); - throw new ExtendedIllegalStateException( - "data", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - StringBuffer s = new StringBuffer(""); - - if (align_ != null) - { - if(align_.equals(HTMLConstants.LEFT)) - s.append("\n"); - - for (int i = 0; i\n"); - - //Set useFO_ to previous state. - setUseFO(useFO); - - return s.toString(); - } - - /** - * Removes this ElementListener. - * - * @param listener The ElementListener. - **/ - public void removeItemElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (elementListeners != null) elementListeners.removeElement(listener); //@CRS - } - - - /** - * Returns if Formatting Object tags are outputted. - * The default value is false. - * @return true if the output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public boolean isUseFO() //@D1A - { - return useFO_; - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS elementListeners = new Vector(); - } - - - /** - * Removes an HTMLTagElement from the list of tags to align. - * - * @param data The data to remove. - **/ - public void removeItem(HTMLTagElement data) - { - //@C1D - - if (data == null) - throw new NullPointerException("data"); - - if (list_.removeElement(data)) - fireElementEvent(ElementEvent.ELEMENT_REMOVED); - } - - - - /** - * Sets the horizontal alignment for a block of HTML. The default is left alignment. - * @param align The alignment. One of the following constants - * defined in HTMLConstants: LEFT, RIGHT, or CENTER. - * - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setAlign(String align) - { - if (align == null) - throw new NullPointerException("align"); - - // If align is not one of the valid HTMLConstants, throw an exception. - if ( !(align.equals(HTMLConstants.LEFT)) && !(align.equals(HTMLConstants.RIGHT)) && !(align.equals(HTMLConstants.CENTER)) ) - { - throw new ExtendedIllegalArgumentException("align", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, " Setting alignment for
    ."); - - String old = align_; - - align_ = align; - - if (changes_ != null) changes_.firePropertyChange("align", old, align ); //@CRS - - } - - - /** - * Sets the direction of the text interpretation. - * @param dir The direction. One of the following constants - * defined in HTMLConstants: LTR or RTL. - * - * @see com.ibm.as400.util.html.HTMLConstants - * - **/ - public void setDirection(String dir) //$B1A - { - if (dir == null) - throw new NullPointerException("dir"); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - { - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - String old = dir_; - - dir_ = dir; - - if (changes_ != null) changes_.firePropertyChange("dir", old, dir ); //@CRS - } - - - /** - * Sets the language of the HTMLAlign tag. - * @param lang The language. Example language tags include: - * en and en-US. - * - **/ - public void setLanguage(String lang) //$B1A - { - if (lang == null) - throw new NullPointerException("lang"); - - String old = lang_; - - lang_ = lang; - - if (changes_ != null) changes_.firePropertyChange("lang", old, lang ); //@CRS - } - - - /** - * Sets if Formatting Object tags should be used. - * The default value is false. - * @param useFO - true if output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public void setUseFO(boolean useFO) //@D1A - { - boolean old = useFO_; - - useFO_ = useFO; - - if (changes_ != null) changes_.firePropertyChange("useFO", old, useFO ); - } - - - /** - * Returns a String representation for the HTMLAlign tag. - * @return The tag. - **/ - public String toString() - { - return getTag(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLAlign16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLAlign16.gif deleted file mode 100644 index 62cdac6d0..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLAlign16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLAlign32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLAlign32.gif deleted file mode 100644 index 70812d48c..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLAlign32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLAlignBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLAlignBeanInfo.java deleted file mode 100644 index dcd3d3292..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLAlignBeanInfo.java +++ /dev/null @@ -1,178 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLAlignBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; - - -/** -* The HTMLAlignBeanInfo class provides bean information for the HTMLAlign class. -**/ -public class HTMLAlignBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = HTMLAlign.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = {changed}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor align = new PropertyDescriptor("align", beanClass, - "getAlign", "setAlign"); - align.setBound(true); - align.setConstrained(false); - align.setDisplayName(loader_.getText("PROP_NAME_ALIGN")); - align.setShortDescription(loader_.getText("PROP_HA_DESC_ALIGN")); - - PropertyDescriptor lang = new PropertyDescriptor("lang", beanClass, "getLanguage", "setLanguage"); //$B3A - lang.setBound(true); //$B3A - lang.setConstrained(false); //$B3A - lang.setDisplayName(loader_.getText("PROP_NAME_LANGUAGE")); //$B3A - lang.setShortDescription(loader_.getText("PROP_DESC_LANGUAGE")); //$B3A - - PropertyDescriptor dir = new PropertyDescriptor("dir", beanClass, "getDirection", "setDirection"); //$B3A - dir.setBound(true); //$B3A - dir.setConstrained(false); //$B3A - dir.setDisplayName(loader_.getText("PROP_NAME_DIRECTION")); //$B3A - dir.setShortDescription(loader_.getText("PROP_DESC_DIRECTION")); //$B3A - - PropertyDescriptor useFO = new PropertyDescriptor("useFO", beanClass, "isUseFO", "setUseFO"); //@C1A - useFO.setBound(true); //@C1A - useFO.setConstrained(false); //@C1A - useFO.setDisplayName(loader_.getText("PROP_NAME_FORMATTING_OBJECT")); //@C1A - useFO.setShortDescription(loader_.getText("PROP_DESC_FORMATTING_OBJECT")); //@C1A - - //$B3C - properties_ = new PropertyDescriptor[] {align, lang, dir, useFO}; //@C1A - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLAlign is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLAlign16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLAlign32.gif"); - break; - } - return image; - } - - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLApplet.java b/cvsroot/src/com/ibm/as400/util/html/HTMLApplet.java deleted file mode 100644 index 36aeecf1d..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLApplet.java +++ /dev/null @@ -1,584 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLApplet.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; - -import java.util.Vector; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; - - -/** -* The HTMLApplet class represents a java application embeded within an HTML page. -*

    -* This example creates a HTMLApplet tag: -*

    -*  // Create an HTMLApplet.
    -*  HTMLApplet applet = new HTMLApplet("myApplet", "http://myCompany.com/dir/", 100, 100);
    -*  

    -* // Create a parameter, then add it to the applet. -* HTMLParameter param = new HTMLParameter("parm1", "value1"); -* applet.addParameter(param); -*

    -* // Create and add second parameter -* HTMLParameter param2 = applet.addParameter("parm2", "value2"); -* System.out.println(applet); -*

    -*

    -* Here is the output of the HTMLApplet tag:
    -*

    -*  <applet name="myApplet" codebase="http://server:port/dir" width="100" height="100";>
    -*  <param name="parm1" value="value1">
    -*  <param name="parm2" value="value2">
    -*  If you see this text, the browser does not support the APPLET tag or the applet has failed to load.
    -*  </applet>
    -*  
    -* -*

    HTMLApplet objects generate the following events: -*

      -*
    • ElementEvent - The events fired are: -*
        -*
      • elementAdded -*
      • elementRemoved -*
      -*
    • PropertyChangeEvent -*
    - -**/ -public class HTMLApplet extends HTMLTagAttributes implements java.io.Serializable // @Z1C -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - static final long serialVersionUID = 3578237003243756490L; - - - private String archive_; - private String code_; - private String codebase_; - private int width_; - private int height_; - - // The alternate text will get displayed if the Applet does not appear in the browser. - private String text_ = loader_.getText("PROP_DESC_APPLET_ALTTEXT"); - - private Vector list_; // The list of Applet parameters. - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - - transient private Vector elementListeners; // The list of element listeners @CRS - - - - /** - * Constructs a default HTMLApplet object. - **/ - public HTMLApplet() - { - super(); - list_ = new Vector(); - } - - - /** - * Constructs an HTMLApplet object with the specified applet code. - * - * @param code The applet name. - **/ - public HTMLApplet(String code) - { - super(); - - setCode(code); - - list_ = new Vector(); - } - - - /** - * Constructs an HTMLApplet object with the specified Applet code, width, and height. - * - * @param code The applet name. - * @param width The applet width. - * @param height The applet height. - **/ - public HTMLApplet(String code, int width, int height) - { - super(); - - setCode(code); - setWidth(width); - setHeight(height); - - list_ = new Vector(); - } - - - /** - * Constructs an HTMLApplet object with the specified Applet code, codebase, width, height. - * - * @param code The applet name. - * @param codebase The base URL. - * @param width The applet width. - * @param height The applet height. - **/ - public HTMLApplet(String code, String codebase, int width, int height) - { - super(); - - setCode(code); - setCodebase(codebase); - setWidth(width); - setHeight(height); - - list_ = new Vector(); - } - - - /** - * Constructs an HTMLApplet object with the specified Applet code, codebase, width, and height. - * - * @param code The applet name. - * @param codebase The base URL. - * @param width The applet width. - * @param height The applet height. - **/ - public HTMLApplet(String archive, String code, String codebase, int width, int height) - { - super(); - - setArchive(archive); - setCode(code); - setCodebase(codebase); - setWidth(width); - setHeight(height); - - list_ = new Vector(); - } - - - /** - * Adds a parameter to the applet tag. - * - * @param param The parameter. - **/ - public void addParameter(HTMLParameter param) - { - //@B1D - - if (param == null) - throw new NullPointerException("param"); - - // add parameter to the list - list_.addElement(param); - - fireElementEvent(ElementEvent.ELEMENT_ADDED); - } - - - /** - * Adds a HTMLParameter to the applet. - * - * @param name The parameter name. - * @param value The parameter value. - * - * @return An HTMLParameter object. - **/ - public HTMLParameter addParameter(String name, String value) - { - //@B1D - - if (name == null) - throw new NullPointerException("name"); - if (value == null) - throw new NullPointerException("value"); - - //Create the HTMLParameter from the values passed in - HTMLParameter param = new HTMLParameter(name,value); - - // Add the HTMLParameter to the group. - list_.addElement(param); - - fireElementEvent(ElementEvent.ELEMENT_ADDED); - - return param; - } - - - /** - * Adds an addElementListener. - * The specified addElementListeners elementAdded method will - * be called each time a HTMLParameter is added to the group. - * The addElementListener object is added to a list of addElementListeners - * managed by this HTMLApplet. It can be removed with removeElementListener. - * - * @see #removeElementListener - * - * @param listener The ElementListener. - **/ - public void addElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (elementListeners == null) elementListeners = new Vector(); //@CRS - elementListeners.addElement(listener); - } - - - - /** - * Fires the element event. - **/ - private void fireElementEvent(int evt) - { - if (elementListeners == null) return; - Vector targets; - targets = (Vector) elementListeners.clone(); - ElementEvent elementEvt = new ElementEvent(this, evt); - for (int i = 0; i < targets.size(); i++) - { - ElementListener target = (ElementListener)targets.elementAt(i); - if (evt == ElementEvent.ELEMENT_ADDED) - target.elementAdded(elementEvt); - else if (evt == ElementEvent.ELEMENT_REMOVED) - target.elementRemoved(elementEvt); - } - } - - - /** - * Returns the name of the archive(s). - * @return The archive(s). - **/ - public String getArchive() - { - return archive_; - } - - - /** - * Returns the class name of the applet class. - * @return The applet name. - **/ - public String getCode() - { - return code_; - } - - - /** - * Returns the base URL of the applet. - * @return The base URL. - **/ - public String getCodebase() - { - return codebase_; - } - - - /** - * Returns the height of the applet in pixels. - * @return The height. - **/ - public int getHeight() - { - return height_; - } - - - /** - * Returns the alternate text of the applet. - * @return The text. - **/ - public String getText() - { - return text_; - } - - - /** - * Returns the width of the applet in pixels. - * @return The width. - **/ - public int getWidth() - { - return width_; - } - - - /** - * Returns a comment tag. - * This method should not be called. There is no XSL-FO support for this class. - * @return The comment tag. - **/ - public String getFOTag() //@C1A - { - Trace.log(Trace.ERROR, "Attempting to getFOTag() for an object that doesn't support it."); - return ""; - } - - /** - * Returns the tag for the HTML applet. - * @return The tag. - **/ - public String getTag() - { - //@B1D - - if (code_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting applet code."); - throw new ExtendedIllegalStateException("code", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - if (width_ <= 0) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting applet width."); - throw new ExtendedIllegalStateException("width", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - if (height_ <= 0) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting applet height."); - throw new ExtendedIllegalStateException("height", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - StringBuffer s = new StringBuffer("\n"); - - // add parameters to the Applet tag - for (int i=0; i< list_.size(); i++) - { - HTMLParameter p = (HTMLParameter)list_.elementAt(i); - - s.append(p.getTag()); - } - - s.append(getText() + "\n"); - - s.append("\n"); - - return s.toString(); - } - - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS elementListeners = new Vector(); - } - - - /** - * Removes a parameter from the applet tag. - * @param param The parameter. - **/ - public void removeParameter(HTMLParameter param) - { - if (param == null) - throw new NullPointerException("param"); - - //@B1D - - if (list_.removeElement(param)) - fireElementEvent(ElementEvent.ELEMENT_REMOVED); - } - - - /** - * Removes this ElementListener from the internal list. - * If the ElementListener is not on the list, nothing is done. - * - * @see #addElementListener - * - * @param listener The ElementListener. - **/ - public void removeElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (elementListeners != null) elementListeners.removeElement(listener); //@CRS - } - - - - /** - * Sets the base URL of the applet. If the CODEBASE URL is relative, it is in - * relation to the current document URL. - * - * @param codebase The base URL. - **/ - public void setCodebase(String codebase) - { - if (codebase == null) - throw new NullPointerException("codebase"); - - if (codebase.length() == 0) - { - throw new ExtendedIllegalArgumentException("codebase", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - //@B1D - - String old = codebase_; - - codebase_ = codebase; - - if (changes_ != null) changes_.firePropertyChange("codebase", old, codebase ); //@CRS - - } - - - /** - * Sets the name of one or more archives containing classes and other resources that will be "preloaded". - * The archives are separated by a ",". - * - * @param archive The applet archive(s). - **/ - public void setArchive(String archive) - { - if (archive == null) - throw new NullPointerException("archive"); - - if (archive.length() == 0) - throw new ExtendedIllegalArgumentException("archive", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - //@B1D - - String old = archive_; - - archive_ = archive; - - if (changes_ != null) changes_.firePropertyChange("archive", old, archive ); //@CRS - } - - - /** - * Sets the class name of the applet code. - * - * @param code The applet name. - **/ - public void setCode(String code) - { - if (code == null) - throw new NullPointerException("code"); - - if (code.length() == 0) - throw new ExtendedIllegalArgumentException("code", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - //@B1D - - String old = code_; - - code_ = code; - - if (changes_ != null) changes_.firePropertyChange("code", old, code ); //@CRS - } - - - /** - * Set the height of the applet in pixels. - * - * @param height The height. - **/ - public void setHeight(int height) - { - if (height <= 0) - throw new ExtendedIllegalArgumentException("height", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - //@B1D - - int old = height_; - - height_ = height; - - if (changes_ != null) changes_.firePropertyChange("height", new Integer(old), new Integer(height) ); //@CRS - } - - - /** - * Set the alternate text for the Applet, which will be displayed if - * the browser does not support the APPLET tag or the applet fails to load. - * - * @param text The alternate text. - **/ - public void setText(String text) - { - if (text == null) - throw new NullPointerException("text"); - - if (text.length() == 0) - throw new ExtendedIllegalArgumentException("text", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - //@B1D - - String old = text_; - - text_ = text; - - if (changes_ != null) changes_.firePropertyChange("text", old, text ); //@CRS - } - - - /** - * Set the width of the applet in pixels. - * - * @param width The width. - **/ - public void setWidth(int width) - { - if (width <= 0) - throw new ExtendedIllegalArgumentException("width", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - //@B1D - - int old = width_; - - width_ = width; - - if (changes_ != null) changes_.firePropertyChange("width", new Integer(old), new Integer(width) ); //@CRS - } - - - /** - * Returns a String representation for the HTMLApplet tag. - * @return The tag. - **/ - public String toString() - { - return getTag(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLApplet16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLApplet16.gif deleted file mode 100644 index 634ab7698..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLApplet16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLApplet32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLApplet32.gif deleted file mode 100644 index 3aec28604..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLApplet32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLAppletBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLAppletBeanInfo.java deleted file mode 100644 index 46e28acd1..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLAppletBeanInfo.java +++ /dev/null @@ -1,190 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLAppletBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - - -/** - * The HTMLAppletBeanInfo class provides bean information for the HTMLApplet class. - **/ -public class HTMLAppletBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = HTMLApplet.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = {changed}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor archive = new PropertyDescriptor("archive", beanClass, - "getArchive", "setArchive"); - archive.setBound(true); - archive.setConstrained(false); - archive.setDisplayName(loader_.getText("PROP_NAME_ARCHIVE")); - archive.setShortDescription(loader_.getText("PROP_HA_DESC_ARCHIVE")); - - PropertyDescriptor code = new PropertyDescriptor("code", beanClass, "getCode", "setCode"); - code.setBound(true); - code.setConstrained(false); - code.setDisplayName(loader_.getText("PROP_NAME_CODE")); - code.setShortDescription(loader_.getText("PROP_HA_DESC_CODE")); - - PropertyDescriptor codebase = new PropertyDescriptor("codebase", beanClass, "getCodebase", "setCodebase"); - codebase.setBound(true); - codebase.setConstrained(false); - codebase.setDisplayName(loader_.getText("PROP_NAME_CODEBASE")); - codebase.setShortDescription(loader_.getText("PROP_HA_DESC_CODEBASE")); - - PropertyDescriptor height = new PropertyDescriptor("height", beanClass, "getHeight", "setHeight"); - height.setBound(true); - height.setConstrained(false); - height.setDisplayName(loader_.getText("PROP_NAME_HEIGHT")); - height.setShortDescription(loader_.getText("PROP_HA_DESC_HEIGHT")); - - PropertyDescriptor text = new PropertyDescriptor("text", beanClass, "getText", "setText"); - text.setBound(true); - text.setConstrained(false); - text.setDisplayName(loader_.getText("PROP_NAME_TEXT")); - text.setShortDescription(loader_.getText("PROP_DESC_APPLET_ALTTEXT")); - - PropertyDescriptor width = new PropertyDescriptor("width", beanClass, "getWidth", "setWidth"); - width.setBound(true); - width.setConstrained(false); - width.setDisplayName(loader_.getText("PROP_NAME_WIDTH")); - width.setShortDescription(loader_.getText("PROP_HA_DESC_WIDTH")); - - - properties_ = new PropertyDescriptor[] { archive, code, codebase, height, text, width }; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLApplet is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - * Returns the bean descriptor. - * @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - * Returns the index of the default event. - * @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - * Returns the index of the default property. - * @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - * Returns the descriptors for all events. - * @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - - /** - * Returns an image for the icon. - * - * @param icon The icon size and color. - * @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLApplet16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLApplet32.gif"); - break; - } - return image; - } - - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLConstants.java b/cvsroot/src/com/ibm/as400/util/html/HTMLConstants.java deleted file mode 100644 index 4c468cfa9..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLConstants.java +++ /dev/null @@ -1,156 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLConstants.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -/** -* The HTMLConstants class is a collection of constants generally used -* for positioning and orienting HTML components. -**/ -public interface HTMLConstants -{ - /** - * Vertical baseline alignment. - **/ - public final static String BASELINE = "baseline"; - - /** - * New, unnamed window as the target frame. - **/ - public final static String TARGET_BLANK = "_blank"; - - /** - * Vertical bottom alignment. - **/ - public final static String BOTTOM = "bottom"; - - /** - * Vertical absolute bottom alignment - **/ - public final static String ABSBOTTOM = "absbottom"; - - /** - * Horizontal alignment in center of page. - **/ - public final static String CENTER = "center"; - - /** - * Horizontal alignment between both text margins. - **/ - public final static String JUSTIFY = "justify"; - - /** - * Horizontal left alignment. - **/ - public final static String LEFT = "left"; - - /** - * Vertical middle alignment. - **/ - public final static String MIDDLE = "middle"; - - /** - * Vertical absolute middle alignment. - **/ - public final static String ABSMIDDLE = "absmiddle"; - - /** - * Frameset parent of current window as target frame. - **/ - public final static String TARGET_PARENT = "_parent"; - - /** - * Horizontal right alignment. - **/ - public final static String RIGHT = "right"; - - /** - * Current frame as the target frame. - **/ - public final static String TARGET_SELF = "_self"; - - /** - * Full, original window as target frame. - **/ - public final static String TARGET_TOP = "_top"; - - /** - * Vertical top alignment. - **/ - public final static String TOP = "top"; - - /** - * Vertical text top alignment. - **/ - public final static String TEXTTOP = "texttop"; - - /** - * Disc, solid bullet, labeling scheme. - **/ - public final static String DISC = "disc"; //$B0A - - - /** - * Square, solid square, labeling scheme. - **/ - public final static String SQUARE = "square"; //$B0A - - - /** - * Circle, hollow circle, labeling scheme. - **/ - public final static String CIRCLE = "circle"; //$B0A - - - /** - * Numbered ordered labeling scheme. - **/ - public final static String NUMBERS = "numbers"; //$B0A - - - /** - * Capital letter ordered labeling scheme. - **/ - public final static String CAPITALS = "capitals"; //$B0A - - - /** - * Lower-case letter ordered labeling scheme. - */ - public final static String LOWER_CASE = "lower_case"; //$B0A - - - /** - * Large Roman numeral ordered labeling scheme. - **/ - public final static String LARGE_ROMAN = "large_roman"; //$B0A - - - /** - * Small Roman numeral ordered labeling scheme. - **/ - public final static String SMALL_ROMAN = "small_roman"; //$B0A - - - /** - * Left to Right text interpretation direction. - **/ - public final static String LTR = "ltr"; //$B1A - - /** - * Right to Left text interpretation direction. - **/ - public final static String RTL = "rtl"; //$B1A - - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLDocument.java b/cvsroot/src/com/ibm/as400/util/html/HTMLDocument.java deleted file mode 100644 index b47157ab7..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLDocument.java +++ /dev/null @@ -1,676 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLDocument.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; - -import java.util.Vector; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.lang.*; - -/** -* The HTMLDocument class represents an HTML or an XSL-FO document. The document -* contains all information needed to display an HTML or an XSL-FO page. -* -* -*
    -*  The following java program creates an HTMLDocument:
    -*
    -*
    -*  package com.ibm.as400.util.html;
    -*  import java.*;
    -*  import java.io.*;
    -*  import java.lang.*;
    -*  import java.beans.PropertyVetoException;
    -*
    -*  public class FoFile
    -*  {
    -*       public static void main (String[] args)
    -*       {
    -*           //Create the HTMLDocument that holds necessary document properties
    -*           HTMLDocument fo = new HTMLDocument();
    -*        
    -*           //Set page and margin properties.  Numbers are in inches.
    -*           fo.setPageWidth(8.5);
    -*           fo.setPageHeight(11);
    -*           fo.setMarginTop(1);
    -*           fo.setMarginBottom(1);
    -*           fo.setMarginLeft(1);
    -*           fo.setMarginRight(1);
    -*        
    -*           //Create a header for the page.
    -*           HTMLHead head = new HTMLHead();
    -*           //Set the title for the header
    -*           head.setTitle("This is the page header.");
    -*        
    -*           //Create several headings
    -*           HTMLHeading h1 = new HTMLHeading(1, "Heading 1");
    -*           HTMLHeading h2 = new HTMLHeading(2, "Heading 2");
    -*           HTMLHeading h3 = new HTMLHeading(3, "Heading 3");
    -*           HTMLHeading h4 = new HTMLHeading(4, "Heading 4");
    -*           HTMLHeading h5 = new HTMLHeading(5, "Heading 5");
    -*           HTMLHeading h6 = new HTMLHeading(6, "Heading 6");
    -*        
    -*           //Create some text that is printed from right to left.
    -*           //Create BidiOrdering object and set the direction
    -*           BidiOrdering bdo = new BidiOrdering();
    -*           bdo.setDirection(HTMLConstants.RTL);
    -*
    -*           //Create some text
    -*           HTMLText text = New HTMLText("This is Arabic text.");
    -*           //Add the text to the bidi-ordering object and get XSL-FO tag
    -*           bdo.addItem(text);
    -*        
    -*           //Add the HTMLHead
    -*           fo.setHTMLHead(head);
    -*
    -*           //Add the items to the document
    -*           fo.addElement(h1);
    -*           fo.addElement(h2);
    -*           fo.addElement(h3);
    -*           fo.addElement(h4);
    -*           fo.addElement(h5);
    -*           fo.addElement(h6);
    -*           fo.addElement(bdo);
    -*        
    -*           //Print the Formatting Object tag.
    -*           System.out.println(fo.getFOTag());
    -*
    -*           //Print the HTML Object tag.
    -*           System.out.println(fo.getTag());
    -*       }   
    -*  }
    -*
    -*
    -*  Here is the output generated by the above program:
    -*
    -*
    -*   <fo:root xmlns:fo = 'http://www.w3.org/1999/XSL/Format'>
    -*   <fo:layout-master-set>
    -*   <fo:simple-page-master master-name='body-page' writing-mode='lr-tb' page-width='8.5in' page-height='11.0in' margin-top='1.0in' margin-bottom='1.0in' margin-left='1.0in' margin-right='1.0in'>
    -*   <fo:region-body region-name='xsl-region-body'/>
    -*   <fo:region-before region-name='xsl-region-before' precedence='true' extent='1.0in'/>
    -*   <fo:region-after region-name='xsl-region-after' precedence='true' extent='1.0in'/>
    -*   <fo:region-start region-name='xsl-region-start' extent='1.0in'/>
    -*   <fo:region-end region-name='xsl-region-end' extent='1.0in'/>
    -*   </fo:simple-page-master>
    -*   </fo:layout-master-set>
    -*   <fo:page-sequence master-name='body-page'>
    -*   <fo:flow flow-name='xsl-region-body'>
    -*   
    -*   <fo:block-container writing-mode='lr'>
    -*   <fo:block font-size='25pt'>Heading 1</fo:block>
    -*   </fo:block-container>                              
    -*
    -*   <fo:block-container writing-mode='lr'>
    -*   <fo:block font-size='20pt'>Heading 2</fo:block>
    -*   </fo:block-container>
    -*
    -*   <fo:block-container writing-mode='lr'>
    -*   <fo:block font-size='15pt'>Heading 3</fo:block>
    -*   </fo:block-container>
    -*   
    -*   <fo:block-container writing-mode='lr'>
    -*   <fo:block font-size='13pt'>Heading 4</fo:block>
    -*   </fo:block-container>
    -*
    -*   <fo:block-container writing-mode='lr'>
    -*   <fo:block font-size='11pt'>Heading 5</fo:block>
    -*   </fo:block-container>
    -*
    -*   <fo:block-container writing-mode='lr'>
    -*   <fo:block font-size='9pt'>Heading 6</fo:block>
    -*   </fo:block-container>
    -*
    -*   <fo:block-container writing-mode='rl'>
    -*   <fo:block>This is Arabic text.</fo:block>
    -*   </fo:block-container>
    -*
    -*   </fo:flow>
    -*   <fo:static-content flow-name='xsl-region-before'>
    -*   <fo:block-container>
    -*   This is the page header.</fo:block-container>
    -*   </fo:static-content>
    -*   </fo:page-sequence>
    -*   </fo:root>
    -*
    -*
    -*   <html>
    -*   <head>
    -*   <title>This is the page header.</title>
    -*   </head>
    -*   <body>
    -*   <h1>Heading 1</h1>
    -*   <h2>Heading 2</h2>
    -*   <h3>Heading 3</h3>
    -*   <h4>Heading 4</h4>
    -*   <h5>Heading 5</h5>
    -*   <h6>Heading 6</h6>
    -*
    -*   <bdo dir="rtl">
    -*   This is Arabic text.
    -*   </bdo>
    -*
    -*   </body>
    -*   </html>
    -*  
    -**/ - -public class HTMLDocument extends HTMLTagAttributes implements java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - static final long serialVersionUID = 1662839037165473585L; - - private Vector tag_ = new Vector(); //Vector to hold any tags added to the main body of the document container - private HTMLHead head_=null; //HTMLHead element to hold the page header. - private double height_ = 11.0; //The height of the fo page. - private double width_ = 8.5; //The width of the fo page. - private double margin_top_=0.5; //The top margin for the page. - private double margin_bottom_=0.5; //The bottom margin for the page. - private double margin_left_=0.5; //The left margin for the page. - private double margin_right_=0.5; //The right margin for the page. - private boolean useFO_ = false; //Specifies if formatting object tags are used. - - transient private Vector tagListeners_; // The list of tag listeners. @CRS - - /** - * Constructs a default HTMLDocument object. - **/ - public HTMLDocument() - { - super(); - } - - /** - * Constructs an HTMLDocument object with the specified HTMLHead. - * @param head An HTMLHead object. - **/ - public HTMLDocument(HTMLHead head) - { - super(); - setHTMLHead(head); - } - - /** - * Adds a tag to the main body of the document. - * @param tag An HTMLTagElement object. - **/ - public void addElement(HTMLTagElement tag) - { - if (tag == null) - throw new NullPointerException("tag"); - - tag_.addElement(tag); - fireAdded(); // Fire the element added event. - } - - /** - * Adds the HTML tag or the page header for an XSL-FO page. - * @param head An HTMLHead object. - **/ - public void setHTMLHead(HTMLHead head) - { - if(head == null) - throw new NullPointerException("head"); - - head_ = head; - fireAdded(); - } - - /** - * Returns an HTMLHead object for the page. - * @return The HTMLHead object. - **/ - public HTMLHead getHTMLHead() - { - return head_; - } - - /** - * Adds an array of tags to the document. - * @param tag An HTMLTagElement array. - **/ - public void addElement(HTMLTagElement[] tag) - { - if (tag == null) - throw new NullPointerException("tag"); - else - { - for(int i=0; i\n"); - - //Add the page header - if (head_ != null) - { - s.append(getHTMLHead().getFOTag()); - } - - s.append(getEndRootTag()); - - //Set useFO_ to previous state. - setUseFO(useFO); - - return new String(s); - } - - /** - * Returns the tag for the HTML document. - * @return The tag. - **/ - public String getTag() - { - if(useFO_) - return getFOTag(); - - //Indicate that HTML tags are outputted. - setUseFO(false); - - StringBuffer s = new StringBuffer("\n"); - - //Add the tag - if (head_ != null) - { - s.append(getHTMLHead().getTag()); - } - - StringBuffer body = new StringBuffer("\n"); - - // Add any tags. - HTMLTagElement tag; - int size = tag_.size(); - for (int i=0; i< size; i++) - { - tag = (HTMLTagElement)tag_.elementAt(i); - body.append(tag.getTag().toString()); - body.append("\n"); - } - - //Add the tag and its contents - s.append(body.toString()); - s.append("\n"); - s.append("\n"); - - return new String(s); - } - - /** - * Returns if Formatting Object tags are outputted. - * The default value is false. - * @return true if the output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public boolean isUseFO() - { - return useFO_; - } - - /** - * Returns the beginning tags for the XSL-FO document. - * @return The tag. - **/ - private String getStartRootTag() - { - - StringBuffer tag = new StringBuffer("\n"); - tag.append("\n"); - tag.append("\n"); - - tag.append("\n"); - tag.append("\n"); - - tag.append("\n"); - - tag.append("\n"); - - tag.append("\n"); - - tag.append("\n"); - tag.append("\n"); - tag.append("\n"); - tag.append("\n"); - - return tag.toString(); - } - - /** - * Returns the ending tags for the XSL-FO document. - * @return The tag. - **/ - private String getEndRootTag() - { - - StringBuffer tag = new StringBuffer("\n"); - tag.append(""); - - return tag.toString(); - } - - /** - * Returns a String representation for the Document tag. - * @return The tag. - **/ - public String toString() - { - return getTag(); - } - - /** - * Fires a ELEMENT_ADDED event. - **/ - private void fireAdded() - { - if (tagListeners_ == null) return; - Vector targets = (Vector) tagListeners_.clone(); - ElementEvent event = new ElementEvent(this, ElementEvent.ELEMENT_ADDED); - for (int i=0; ipage-height of the XSL-FO page in inches. - * The default value is 11 inches. - * @param height The height. - **/ - public void setPageHeight( double height ) - { - if (height < 0 ) - throw new ExtendedIllegalArgumentException("height", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - double old = height_; - - height_ = height; - - if (changes_ != null) changes_.firePropertyChange("height", new Double(old), new Double(height) ); - } - - /** - * Sets the page-width of the XSL-FO page in inches. - * The default value is 8.5 inches. - * @param width The width - **/ - public void setPageWidth( double width ) - { - if (width < 0 ) - throw new ExtendedIllegalArgumentException("width", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - double old = width_; - - width_ = width; - - if (changes_ != null) changes_.firePropertyChange("width", new Double(old), new Double(width) ); - } - - /** - * Sets the top-margin of the XSL-FO page in inches. - * The default value is 0.5 inches. - * @param top The width of the top margin - **/ - public void setMarginTop( double top ) - { - if (top < 0 ) - throw new ExtendedIllegalArgumentException("top", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - double old = margin_top_; - - margin_top_ = top; - - if (changes_ != null) changes_.firePropertyChange("top", new Double(old), new Double(top) ); - } - - /** - * Sets the bottom-margin of the XSL-FO page in inches. - * The default value is 0.5 inches. - * @param bottom The width of the bottom margin - **/ - public void setMarginBottom( double bottom ) - { - if (bottom < 0 ) - throw new ExtendedIllegalArgumentException("bottom", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - double old = margin_bottom_; - - margin_bottom_ = bottom; - - if (changes_ != null) changes_.firePropertyChange("bottom", new Double(old), new Double(bottom) ); - } - - /** - * Sets the right-margin of the XSL-FO page in inches. - * The default value is 0.5 inches. - * @param right The width of the right margin - **/ - public void setMarginRight( double right ) - { - if (right < 0 ) - throw new ExtendedIllegalArgumentException("right", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - double old = margin_right_; - - margin_right_ = right; - - if (changes_ != null) changes_.firePropertyChange("right", new Double(old), new Double(right) ); - } - - /** - * Sets the left-margin of the XSL-FO page in inches. - * The default value is 0.5 inches. - * @param left The width of the left margin - **/ - public void setMarginLeft( double left ) - { - if (left < 0 ) - throw new ExtendedIllegalArgumentException("left", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - double old = margin_left_; - - margin_left_ = left; - - if (changes_ != null) changes_.firePropertyChange("left", new Double(old), new Double(left) ); - } - - /** - * Removes an HTMLTagElement from the document. - * @param tag The HTMLTagElement. - **/ - public void removeElement(HTMLTagElement tag) - { - if (tag == null) - throw new NullPointerException("tag"); - - //verify the document is not empty - // Verify the table is not empty. - if (tag_.size() == 0) - { - Trace.log(Trace.ERROR, "Attempting to remove an element when the document is empty."); - throw new ExtendedIllegalStateException("tag", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - if (tag_.removeElement(tag)) - fireRemoved(); - } - - /** - * Returns the height of the page in inches. - * @return The height. - **/ - public double getPageHeight() - { - return height_; - } - - /** - * Returns the width of the page in inches. - * @return The width. - **/ - public double getPageWidth() - { - return width_; - } - - /** - * Returns the top margin of the page in inches. - * @return The top margin. - **/ - public double getMarginTop() - { - return margin_top_; - } - - /** - * Returns the bottom margin of the page in inches. - * @return The bottom margin. - **/ - public double getMarginBottom() - { - return margin_bottom_; - } - - /** - * Returns the left margin of the page in inches. - * @return The left margin. - **/ - public double getMarginLeft() - { - return margin_left_; - } - - /** - * Returns the right margin of the page in inches. - * @return The right margin. - **/ - public double getMarginRight() - { - return margin_right_; - } - - /** - * Sets if Formatting Object tags should be used. - * The default value is false. - * @param useFO - true if output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public void setUseFO(boolean useFO) - { - boolean old = useFO_; - - useFO_ = useFO; - - if (changes_ != null) changes_.firePropertyChange("useFO", old, useFO ); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLDocument16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLDocument16.gif deleted file mode 100644 index 995ea9019..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLDocument16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLDocument32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLDocument32.gif deleted file mode 100644 index 74e909bb2..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLDocument32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLDocumentBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLDocumentBeanInfo.java deleted file mode 100644 index 4254423b3..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLDocumentBeanInfo.java +++ /dev/null @@ -1,195 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLDocumentBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -* The HTMLDocumentBeanInfo class provides bean information for the HTMLDocument class. -**/ -public class HTMLDocumentBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2003 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class beanClass = HTMLDocument.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - - - EventSetDescriptor[] events = {changed}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor height = new PropertyDescriptor("height", beanClass, - "getPageHeight", "setPageHeight"); - height.setBound(true); - height.setConstrained(false); - height.setDisplayName(loader_.getText("PROP_NAME_HD_HEIGHT")); - height.setShortDescription(loader_.getText("PROP_HD_DESC_HEIGHT")); - - PropertyDescriptor width = new PropertyDescriptor("width", beanClass, - "getPageWidth", "setPageWidth"); - width.setBound(true); - width.setConstrained(false); - width.setDisplayName(loader_.getText("PROP_NAME_HD_WIDTH")); - width.setShortDescription(loader_.getText("PROP_HD_DESC_WIDTH")); - - PropertyDescriptor marginTop = new PropertyDescriptor("marginTop", beanClass, - "getMarginTop", "setMarginTop"); - marginTop.setBound(true); - marginTop.setConstrained(false); - marginTop.setDisplayName(loader_.getText("PROP_NAME_MARGIN_TOP")); - marginTop.setShortDescription(loader_.getText("PROP_DESC_MARGIN_TOP")); - - PropertyDescriptor marginBottom = new PropertyDescriptor("marginBottom", beanClass, - "getMarginBottom", "setMarginBottom"); - marginBottom.setBound(true); - marginBottom.setConstrained(false); - marginBottom.setDisplayName(loader_.getText("PROP_NAME_MARGIN_BOTTOM")); - marginBottom.setShortDescription(loader_.getText("PROP_DESC_MARGIN_BOTTOM")); - - PropertyDescriptor marginLeft = new PropertyDescriptor("marginLeft", beanClass, - "getMarginLeft", "setMarginLeft"); - marginLeft.setBound(true); - marginLeft.setConstrained(false); - marginLeft.setDisplayName(loader_.getText("PROP_NAME_MARGIN_LEFT")); - marginLeft.setShortDescription(loader_.getText("PROP_DESC_MARGIN_LEFT")); - - PropertyDescriptor marginRight = new PropertyDescriptor("marginRight", beanClass, - "getMarginRight", "setMarginRight"); - marginRight.setBound(true); - marginRight.setConstrained(false); - marginRight.setDisplayName(loader_.getText("PROP_NAME_MARGIN_RIGHT")); - marginRight.setShortDescription(loader_.getText("PROP_DESC_MARGIN_RIGHT")); - - PropertyDescriptor useFO = new PropertyDescriptor("useFO", beanClass, "isUseFO", "setUseFO"); - useFO.setBound(true); - useFO.setConstrained(false); - useFO.setDisplayName(loader_.getText("PROP_NAME_FORMATTING_OBJECT")); - useFO.setShortDescription(loader_.getText("PROP_DESC_FORMATTING_OBJECT")); - - properties_ = new PropertyDescriptor[] { height, width, marginTop, marginBottom, marginLeft, marginRight, useFO}; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLDocument is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLDocument16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLDocument32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLFileFilter.java b/cvsroot/src/com/ibm/as400/util/html/HTMLFileFilter.java deleted file mode 100644 index d6f8619f4..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLFileFilter.java +++ /dev/null @@ -1,79 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLFileFilter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.io.File; -import java.io.FilenameFilter; -import java.util.Vector; - -import com.ibm.as400.access.IFSJavaFile; - - -/** -* The HTMLFileFilter class determines if a File object is a file. -* -*

    -* This example creates a HTMLFileFilter object to determine which IFSJavaFile objects -* are files. -* -*

    -*  // Create an IFSJavaFile object.
    -*  IFSJavaFile root = new IFSJavaFile(system, "/QIBM");
    -*  

    -* // Create a HTMLFileFilter object. -* HTMLFileFilter filter = new HTMLFileFilter(); -*

    -* // Get the list of File objects. -* File[] files = root.listFiles(filter); -*

    -* -* @see com.ibm.as400.util.html.FileListElement -* -**/ -public class HTMLFileFilter implements FilenameFilter -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - /** - * Constructs a default HTMLFileFilter object. - **/ - public HTMLFileFilter() - { - } - - - /** - * Determines if a file should be included in a file list. - * - * @param file The directory in which the file was found. - * @param filename The name of the file. - * - * @return true if the File is a file; false otherwise. - **/ - public boolean accept(File file, String filename) - { - File f; - - if (file instanceof IFSJavaFile) - f = new IFSJavaFile((IFSJavaFile)file, filename); - else - f = new File(file, filename); - - if (!f.isFile()) - return false; - else - return true; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLForm.java b/cvsroot/src/com/ibm/as400/util/html/HTMLForm.java deleted file mode 100644 index 319783189..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLForm.java +++ /dev/null @@ -1,592 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLForm.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; - - -import java.util.Vector; -import java.util.Enumeration; -import java.util.Properties; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.beans.PropertyVetoException; - -/** -* The HTMLForm class represents an HTML form. -* -*

    HTMLForm objects generate the following events: -*

      -*
    • ElementEvent - The events fired are: -*
        -*
      • elementAdded -*
      • elementRemoved -*
      -*
    • PropertyChangeEvent -*
    • VetoableChangeEvent -*
    -*

    -* This examples creates an HTMLForm object and adds some form input types to it. -*

    -*  

    // Create a text input form element for the system. -* LabelFormElement sysPrompt = new LabelFormElement("System:"); -* TextFormInput system = new TextFormInput("System"); -*

    // Create a text input form element for the userId. -* LabelFormElement userPrompt = new LabelFormElement("User:"); -* TextFormInput user = new TextFormInput("User"); -*

    // Create a password input form element for the password. -* LabelFormElement passwordPrompt = new LabelFormElement("Password:"); -* PasswordFormInput password = new PasswordFormInput("Password"); -*

    // Create a properties object. -* Properties prop = new Properties(); -*

    // Add customer name and ID values to the properties object. -* prop.put("custName", "Mr. Toolbox"); -* prop.put("custID", "12345"); -*

    // Create the submit button to the form. -* SubmitFormInput logonButton = new SubmitFormInput("logon", "Logon"); -*

    // Create HTMLForm object and add the panel to it. -* HTMLForm form = new HTMLForm(servletURI); -* form.setHiddenParameterList(prop); -* form.addElement(sysPrompt); -* form.addElement(system); -* form.addElement(userPrompt); -* form.addElement(user); -* form.addElement(passwordPrompt); -* form.addElement(password); -* form.addElement(logonButton); -*

    -*

    -* Here is an example of an HTMLForm tag:
    -*

    -* <form action="servletURI" method="get"> -* System: <input type="text" name="System" /> -* User: <input type="text" name="User" /> -* Password: <input type="password" name="Password" /> -* <input type="submit" name="logon" value="Logon" /> -* <input type="hidden" name="custName" value="Mr. Toolbox" /> -* <input type="hidden" name="custID" value="12345" /> -* </form> -*
    -**/ -public class HTMLForm extends HTMLTagAttributes implements HTMLConstants, java.io.Serializable // @Z1C -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - static final long serialVersionUID = -7610016051219431008L; - - /** - HTTP GET Method for sending form contents to the server. - This is the default method used. - **/ - public static final int METHOD_GET = 0; - /** - HTTP POST Method for sending form contents to the server. - **/ - public static final int METHOD_POST = 1; - - - private Vector list_; // The list of FormElements. - private String url_; // The ACTION url address. - private String target_; // The target frame for the link resource. - private Properties parms_; // The hidden parameter list. - private boolean useGet_ = true; // - private int method_ = METHOD_GET; // The HTTP method used. - private String lang_; // The primary language used to display the tags contents. //$B1A - private String dir_; // The direction of the text interpretation. //$B1A - - - transient private VetoableChangeSupport vetos_; //@CRS - transient private Vector elementListeners; // The list of element listeners @CRS - - /** - * Constructs a default HTMLForm object. - **/ - public HTMLForm() - { - list_ = new Vector(); - } - - /** - * Constructs an HTMLForm object with the specified URL. - * @param url The URL address. - **/ - public HTMLForm(String url) - { - this(); - try - { - setURL(url); - } - catch (PropertyVetoException e) - { - } - } - - /** - * Adds a form element to the HTMLForm. - * @param element The form element. - **/ - public void addElement(HTMLTagElement element) - { - //@C1D - - if (element == null) - throw new NullPointerException("element"); - - list_.addElement(element); - - fireElementEvent(ElementEvent.ELEMENT_ADDED); - } - - /** - * Adds an ElementListener. - * The ElementListener object is added to an internal list of ElementListeners; - * it can be removed with removeElementListener. - * @see #removeElementListener - * @param listener The ElementListener. - **/ - public void addElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (elementListeners == null) elementListeners = new Vector(); //@CRS - elementListeners.addElement(listener); - } - - - /** - Adds the VetoableChangeListener. The specified - VetoableChangeListener's vetoableChange - method is called each time the value of any - constrained property is changed. - @see #removeVetoableChangeListener - @param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); //@CRS - vetos_.addVetoableChangeListener(listener); - } - - /** - * Fires the element event. - **/ - private void fireElementEvent(int evt) - { - if (elementListeners == null) return; //@CRS - Vector targets; - targets = (Vector) elementListeners.clone(); - ElementEvent elementEvt = new ElementEvent(this, evt); - for (int i = 0; i < targets.size(); i++) - { - ElementListener target = (ElementListener)targets.elementAt(i); - if (evt == ElementEvent.ELEMENT_ADDED) - target.elementAdded(elementEvt); - else if (evt == ElementEvent.ELEMENT_REMOVED) - target.elementRemoved(elementEvt); - } - } - - - /** - * Returns the direction of the text interpretation. - * @return The direction of the text. - **/ - public String getDirection() //$B1A - { - return dir_; - } - - - /** - * Returns the form's hidden parameter list. - * @return The parameter list. - **/ - public Properties getHiddenParameterList() - { - return parms_; - } - - - /** - * Returns the language of the input element. - * @return The language of the input element. - **/ - public String getLanguage() //$B1A - { - return lang_; - } - - /** - * Returns the HTTP method used for sending form contents to the server. - * @return The HTTP method. - **/ - public int getMethod() - { - return method_; - } - - /** - * Returns a comment tag. - * This method should not be called. There is no XSL-FO support for this class. - * @return The comment tag. - **/ - public String getFOTag() //@D1A - { - Trace.log(Trace.ERROR, "Attempting to getFOTag() for an object that doesn't support it."); - return ""; - } - - /** - * Returns the HTML form tag. - * @return The tag. - **/ - public String getTag() - { - //@C1D - - if (url_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting the action URL address."); - throw new ExtendedIllegalStateException( - "url", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - StringBuffer s = new StringBuffer("
    \n"); - - if (parms_ != null) - { - Enumeration names = parms_.propertyNames(); - while (names.hasMoreElements()) - { - String name = (String)names.nextElement(); - String value = parms_.getProperty(name); - HiddenFormInput h = new HiddenFormInput(); - try - { - h.setName(name); - h.setValue(value); - } - catch (PropertyVetoException e) - { - } - addElement(h); - } - } - - for (int i=0; i"); - - return s.toString(); - } - - /** - * Returns the target frame for the form response. - * @return The target frame. One of the following constants - * defined in HTMLConstants: TARGET_BLANK, TARGET_PARENT, - * TARGET_SELF, TARGET_TOP, or a user defined target. - * - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public String getTarget() - { - return target_; - } - - /** - * Returns the ACTION URL address of the server-side form handler. - * @return The URL address. - **/ - public String getURL() - { - return url_; - } - - /** Indicates if the GET method is used for sending the form contents to the server. - * @return true if GET is used; false otherwise. - **/ - public boolean isUseGet() - { - if (method_ == METHOD_GET) - return true; - else - return false; - } - - /** - * Indicates if the POST method is used for sending the form contents to the server. - * @return true if POST is used; false otherwise. - **/ - public boolean isUsePost() - { - if (method_ == METHOD_POST) - return true; - else - return false; - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) //$A1A - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS vetos_ = new VetoableChangeSupport(this); - //@CRS elementListeners = new Vector(); - } - - /** - * Removes a form element from the HTMLForm. - * @param element The form element. - **/ - public void removeElement(HTMLTagElement element) - { - //@C1D - - if (element == null) - throw new NullPointerException("element"); - - if (list_.removeElement(element)) - fireElementEvent(ElementEvent.ELEMENT_REMOVED); - } - - /** - * Removes this ElementListener from the internal list. - * If the ElementListener is not on the list, nothing is done. - * @see #addElementListener - * @param listener The ElementListener. - **/ - public void removeElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (elementListeners != null) elementListeners.removeElement(listener); //@CRS - } - - - - /** - Removes the VetoableChangeListener from the internal list. - If the VetoableChangeListener is not on the list, nothing is done. - @see #addVetoableChangeListener - @param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (vetos_ != null) vetos_.removeVetoableChangeListener(listener); //@CRS - } - - - /** - * Sets the direction of the text interpretation. - * @param dir The direction. One of the following constants - * defined in HTMLConstants: LTR or RTL. - * - * @see com.ibm.as400.util.html.HTMLConstants - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setDirection(String dir) //$B1A - throws PropertyVetoException - { - if (dir == null) - throw new NullPointerException("dir"); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - { - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - String old = dir_; - if (vetos_ != null) vetos_.fireVetoableChange("dir", old, dir ); //@CRS - - dir_ = dir; - - if (changes_ != null) changes_.firePropertyChange("dir", old, dir ); //@CRS - } - - - /** - * Sets the form's hidden parameter list. - * @param parameterList The parameter list. - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setHiddenParameterList(Properties parameterList) - throws PropertyVetoException - { - if (parameterList == null) - throw new NullPointerException("parameterList"); - - Properties old = parms_; - if (vetos_ != null) vetos_.fireVetoableChange("parameterList", old, parameterList ); //@CRS - - parms_ = parameterList; - - if (changes_ != null) changes_.firePropertyChange("parameterList", old, parameterList ); //@CRS - } - - - /** - * Sets the language of the input tag. - * @param lang The language. Example language tags include: - * en and en-US. - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setLanguage(String lang) //$B1A - throws PropertyVetoException - { - if (lang == null) - throw new NullPointerException("lang"); - - String old = lang_; - if (vetos_ != null) vetos_.fireVetoableChange("lang", old, lang ); //@CRS - - lang_ = lang; - - if (changes_ != null) changes_.firePropertyChange("lang", old, lang ); //@CRS - } - - - /** - * Sets the HTTP method used to send form contents to the server. - * @param method The method. - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setMethod(int method) - throws PropertyVetoException - { - if (method < METHOD_GET || method > METHOD_POST) - throw new ExtendedIllegalArgumentException("method", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - int old = method_; - if (vetos_ != null) vetos_.fireVetoableChange("method", new Integer(old), new Integer(method) ); //@CRS - - method_ = method; - - if (changes_ != null) changes_.firePropertyChange("method", new Integer(old), new Integer(method) ); //@CRS - } - - /** - * Sets the target frame for the form response. - * @param target The target frame. One of the following constants - * defined in HTMLConstants: TARGET_BLANK, TARGET_PARENT, - * TARGET_SELF, TARGET_TOP, or a user defined target. - * - * @exception PropertyVetoException If a change is vetoed. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setTarget(String target) - throws PropertyVetoException - { - if (target == null) - throw new NullPointerException("target"); - - String old = target_; - if (vetos_ != null) vetos_.fireVetoableChange("target", old, target ); //@CRS - - target_ = target; - - if (changes_ != null) changes_.firePropertyChange("target", old, target ); //@CRS - } - - /** - * Sets the ACTION URL address of the server-side form handler. - * @param url The URL address. - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setURL(String url) - throws PropertyVetoException - { - if (url == null) - throw new NullPointerException("url"); - - String old = url_; - if (vetos_ != null) vetos_.fireVetoableChange("url", old, url ); //@CRS - - url_ = url; - - if (changes_ != null) changes_.firePropertyChange("url", old, url ); //@CRS - } - - /** - * Returns the HTMLForm tag as a String. - * @return The tag. - **/ - public String toString() - { - return getTag(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLForm16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLForm16.gif deleted file mode 100644 index 686f648fb..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLForm16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLForm32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLForm32.gif deleted file mode 100644 index 541e9b609..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLForm32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLFormBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLFormBeanInfo.java deleted file mode 100644 index 78efa588e..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLFormBeanInfo.java +++ /dev/null @@ -1,203 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLFormBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -import com.ibm.as400.access.Trace; - -/** -The HTMLFormBeanInfo class provides -bean information for the HTMLForm class. -**/ -public class HTMLFormBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = HTMLForm.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", /* parameter to VetoableChangeListener.vetoableChange */ - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor hidden = new PropertyDescriptor("hiddenParameterList", beanClass, - "getHiddenParameterList", "setHiddenParameterList"); - hidden.setBound(true); - hidden.setConstrained(true); - hidden.setDisplayName(loader_.getText("PROP_NAME_HIDDENPARAMETERLIST")); - hidden.setShortDescription(loader_.getText("PROP_DESC_HIDDENPARAMETERLIST")); - - PropertyDescriptor method = new PropertyDescriptor("method", beanClass, "getMethod", "setMethod"); - method.setBound(true); - method.setConstrained(true); - method.setDisplayName(loader_.getText("PROP_NAME_METHOD")); - method.setShortDescription(loader_.getText("PROP_DESC_METHOD")); - - PropertyDescriptor target = new PropertyDescriptor("target", beanClass, "getTarget", "setTarget"); - target.setBound(true); - target.setConstrained(true); - target.setDisplayName(loader_.getText("PROP_NAME_TARGET")); - target.setShortDescription(loader_.getText("PROP_HF_DESC_TARGET")); - - PropertyDescriptor url = new PropertyDescriptor("url", beanClass, "getURL", "setURL"); - url.setBound(true); - url.setConstrained(true); - url.setDisplayName(loader_.getText("PROP_NAME_URL")); - url.setShortDescription(loader_.getText("PROP_DESC_URL")); - - PropertyDescriptor lang = new PropertyDescriptor("lang", beanClass, "getLanguage", "setLanguage"); //$B3A - lang.setBound(true); //$B3A - lang.setConstrained(true); //$B3A - lang.setDisplayName(loader_.getText("PROP_NAME_LANGUAGE")); //$B3A - lang.setShortDescription(loader_.getText("PROP_DESC_LANGUAGE")); //$B3A - - PropertyDescriptor dir = new PropertyDescriptor("dir", beanClass, "getDirection", "setDirection"); //$B3A - dir.setBound(true); //$B3A - dir.setConstrained(true); //$B3A - dir.setDisplayName(loader_.getText("PROP_NAME_DIRECTION")); //$B3A - dir.setShortDescription(loader_.getText("PROP_DESC_DIRECTION")); //$B3A - - properties_ = new PropertyDescriptor[] { hidden, method, target, url, lang, dir }; //$B3C - } - catch (Exception e) - { - // - // Trace the original exception - // - if (Trace.isTraceAllOn()) { - - Trace.log(Trace.DIAGNOSTIC, e); - } - throw new Error(e.toString()); - } - } - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLForm is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLForm16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLForm32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLHead.java b/cvsroot/src/com/ibm/as400/util/html/HTMLHead.java deleted file mode 100644 index fd0124fde..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLHead.java +++ /dev/null @@ -1,496 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLHead.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; - -import java.util.Vector; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; - - -/** -* The HTMLHead class represents an HTML head tag, which contains information about the HTML document. -*

    -* This example creates an HTMLHead tag: -*

    -*  // Create an HTMLHead with a title.
    -*  HTMLHead head = new HTMLHead("My HTML Document");
    -*  

    -* // Create an HTMLMeta. -* HTMLMeta meta = new HTMLMeta("expires", "Mon, 01 Jun 2000 12:00:00 CST"); -* HTMLMeta meta2 = new HTMLMeta("refresh", "5", "http://www.sample.com/next.html"); -*

    -* // Add the meta information to the HTMLHead -* head.addMetaInformation(meta); -* head.addMetaInformation(meta2); -*

    -*

    -* Here is the output of the HTMLHead tag:
    -*

    -*  <head>
    -*  <meta http-equiv="expired" content="Mon, 06 Jun 2000 12:00:00 CST" />
    -*  <meta http-equiv="refresh" content="5; URL=http://www.sample.com/next.html" />
    -*  <title>My HTML Document</title>
    -*  </head>
    -*  
    -* -* Using XSL Formatting Objects, the head tag represents a page header. -*

    -* Calling getFOTag() would produce the following. -*

    -* <fo:static-content flow-name='xsl-region-before'> -* <fo:block-container> -* My HTML Document</fo:block-container> -* </fo:static-content> -*
    -* -* -*

    HTMLHead objects generate the following events: -*

      -*
    • ElementEvent - The events fired are: -*
        -*
      • elementAdded -*
      • elementRemoved -*
      -*
    • PropertyChangeEvent -*
    -**/ -public class HTMLHead extends HTMLTagAttributes implements java.io.Serializable // @Z1C -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - static final long serialVersionUID = 5006426803056962528L; - - private String title_; // The title to use for HTML document. - private String lang_; // The primary language used to display the tags contents. - private String dir_; // The direction of the text interpretation. - private boolean useFO_ = false; // Indicates if XSL-FO tags are outputted. //@C1A - - private Vector list_ = new Vector(); - - transient private Vector elementListeners; // The list of element listeners @CRS - - - /** - * Constructs a default HTMLHead object. - **/ - public HTMLHead() - { - super(); - } - - - /** - * Constructs an HTMLHead object with the specified title. - * - * @param title The title of the HTML document. - **/ - public HTMLHead(String title) - { - super(); - - setTitle(title); - } - - - /** - * Constructs an HTMLHead object with the specified title and meta information. - * - * @param title The title of the HTML document. - * @param meta The HTML meta information. - **/ - public HTMLHead(String title, HTMLMeta meta) - { - super(); - - addMetaInformation(meta); - setTitle(title); - } - - - /** - * Adds HTMLMeta information to the HTMLHead. - * The <head> tag contains a list of <meta> tags. - * - * @param meta The meta information to add. - **/ - public void addMetaInformation(HTMLMeta meta) - { - //@B1D - - if (meta == null) - throw new NullPointerException("meta"); - - list_.addElement(meta); - - fireElementEvent(ElementEvent.ELEMENT_ADDED); - } - - - /** - * Adds an ElementListener. - * - * @param listener The ElementListener. - **/ - public void addMetaInformationElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (elementListeners == null) elementListeners = new Vector(); //@CRS - elementListeners.addElement(listener); - } - - - /** - * Fires the element event. - **/ - private void fireElementEvent(int evt) - { - if (elementListeners == null) return; //@CRS - Vector targets; - targets = (Vector) elementListeners.clone(); - ElementEvent elementEvt = new ElementEvent(this, evt); - for (int i = 0; i < targets.size(); i++) - { - ElementListener target = (ElementListener)targets.elementAt(i); - if (evt == ElementEvent.ELEMENT_ADDED) - target.elementAdded(elementEvt); - else if (evt == ElementEvent.ELEMENT_REMOVED) - target.elementRemoved(elementEvt); - } - } - - - /** - * Returns the direction of the text interpretation. - * @return The direction of the text. - **/ - public String getDirection() - { - return dir_; - } - - - /** - * Returns the direction attribute tag. - * @return The direction tag. - **/ - String getDirectionAttributeTag() - { - if(useFO_) //@C1A - { //@C1A - if((dir_!=null) && (dir_.length()>0)) //@C1A - { //@C1A - if(dir_.equals(HTMLConstants.RTL)) //@C1A - return " writing-mode='rl'"; //@C1A - else //@C1A - return " writing-mode='lr'"; //@C1A - } //@C1A - else //@C1A - return ""; //@C1A - } //@C1A - else //@C1A - { //@C1A - //@B1D - - if ((dir_ != null) && (dir_.length() > 0)) - return " dir=\"" + dir_ + "\""; - else - return ""; - } //@C1A - } - - - /** - * Returns the language of the head element. - * @return The language of the head element. - **/ - public String getLanguage() - { - return lang_; - } - - - /** - * Returns the language attribute tag. - * @return The language tag. - **/ - String getLanguageAttributeTag() - { - //@B1D - - if ((lang_ != null) && (lang_.length() > 0)) - return " lang=\"" + lang_ + "\""; - else - return ""; - } - - - /** - * Returns the tag for the HTML alignment. - * @return The tag. - **/ - public String getTag() - { - //@B1D - if(useFO_) //@C1A - return getFOTag(); //@C1A - - if (title_ == null && list_.isEmpty()) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting the title or adding meta information to the head."); - throw new ExtendedIllegalStateException( - "title/meta", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - StringBuffer s = new StringBuffer(""); - - s.append("\n"); - - for (int i=0; i < list_.size(); i++) - { - HTMLTagElement data = (HTMLTagElement)list_.elementAt(i); - s.append(data.getTag()); - } - - if (title_ != null) - { - s.append(""); - s.append(title_); - s.append("\n"); - } - - s.append("\n"); - - return s.toString(); - } - - - /** - * Returns the tag for the XSL-FO header. - * The language attribute and Meta tags are not supported in XSL-FO. - * @return The tag. - **/ - public String getFOTag() //@C1A - { - //Save current state of useFO_ - boolean useFO = useFO_; - - //Indicate that Formatting Object tag is outputted - setUseFO(true); - - if (title_ == null && list_.isEmpty()) - { - Trace.log(Trace.ERROR, "Attempting to get XSL-FO tag before setting the title for the head."); - throw new ExtendedIllegalStateException("title", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - StringBuffer s = new StringBuffer("\n"); - s.append("\n"); - - //Add the title - if(title_ != null) - { - s.append(title_); - } - - s.append("\n"); - s.append("\n"); - - //Set useFO_ to previous state. - setUseFO(useFO); - - return s.toString(); - - } - - - /** - * Returns the title of the HTMLHead object. - * @return The title. - **/ - public String getTitle() - { - return title_; - } - - - /** - * Returns if Formatting Object tags are outputted. - * The default value is false. - * @return true if the output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public boolean isUseFO() //@C1A - { - return useFO_; - } - - - /** - * Removes this ElementListener. - * - * @param listener The ElementListener. - **/ - public void removeMetaInformationElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (elementListeners != null) elementListeners.removeElement(listener); //@CRS - } - - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS elementListeners = new Vector(); - } - - - /** - * Removes an HTMLMeta from the HTMLHead. - * - * @param meta The meta information to remove. - **/ - public void removeMetaInformation(HTMLMeta meta) - { - //@B1D - - if (meta == null) - throw new NullPointerException("meta"); - - if (list_.removeElement(meta)) - fireElementEvent(ElementEvent.ELEMENT_REMOVED); - } - - - - /** - * Sets the direction of the text interpretation. Setting the direction - * will add the dir attribute to both the head tag and the - * title tag if one is being used. - * - * @param dir The direction. One of the following constants - * defined in HTMLConstants: LTR or RTL. - * - * @see com.ibm.as400.util.html.HTMLConstants - * - **/ - public void setDirection(String dir) - { - if (dir == null) - throw new NullPointerException("dir"); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - { - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - String old = dir_; - - dir_ = dir; - - if (changes_ != null) changes_.firePropertyChange("dir", old, dir ); //@CRS - } - - - /** - * Sets the language of the HTMLHead tag. Setting the language - * will add the lang attribute to both the head tag and the - * title tag if one is being used. - * - * @param lang The language. Example language tags include: - * en and en-US. - * - **/ - public void setLanguage(String lang) - { - if (lang == null) - throw new NullPointerException("lang"); - - String old = lang_; - - lang_ = lang; - - if (changes_ != null) changes_.firePropertyChange("lang", old, lang ); //@CRS - } - - /** - * Sets the title of the HTML document. - * - * @param title The title of the HTML document. - **/ - public void setTitle(String title) - { - if (title == null) - throw new NullPointerException("title"); - - if (title.length() == 0) - throw new ExtendedIllegalArgumentException("title", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, " Setting title for ."); - - String old = title_; - - title_ = title; - - if (changes_ != null) changes_.firePropertyChange("title", old, title ); //@CRS - - } - - - /** - * Sets if Formatting Object tags should be used. - * The default value is false. - * @param useFO - true if output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public void setUseFO(boolean useFO) //@C1A - { - boolean old = useFO_; - - useFO_ = useFO; - - if (changes_ != null) changes_.firePropertyChange("useFO", old, useFO ); - } - - - /** - * Returns a String representation for the HTMLHead tag. - * @return The tag. - **/ - public String toString() - { - return getTag(); - } -} - diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLHead16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLHead16.gif deleted file mode 100644 index 983c0c25d..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLHead16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLHead32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLHead32.gif deleted file mode 100644 index de8a1ee1b..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLHead32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLHeadBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLHeadBeanInfo.java deleted file mode 100644 index 1a645be11..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLHeadBeanInfo.java +++ /dev/null @@ -1,179 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLHeadBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; - - -/** -* The HTMLHeadBeanInfo class provides bean information for the HTMLHead class. -**/ -public class HTMLHeadBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = HTMLHead.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = {changed}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor title = new PropertyDescriptor("title", beanClass, - "getTitle", "setTitle"); - title.setBound(true); - title.setConstrained(false); - title.setDisplayName(loader_.getText("PROP_NAME_TITLE")); - title.setShortDescription(loader_.getText("PROP_HH_DESC_TITLE")); - - PropertyDescriptor lang = new PropertyDescriptor("lang", beanClass, "getLanguage", "setLanguage"); - lang.setBound(true); - lang.setConstrained(false); - lang.setDisplayName(loader_.getText("PROP_NAME_LANGUAGE")); - lang.setShortDescription(loader_.getText("PROP_DESC_LANGUAGE")); - - PropertyDescriptor dir = new PropertyDescriptor("dir", beanClass, "getDirection", "setDirection"); - dir.setBound(true); - dir.setConstrained(false); - dir.setDisplayName(loader_.getText("PROP_NAME_DIRECTION")); - dir.setShortDescription(loader_.getText("PROP_DESC_DIRECTION")); - - PropertyDescriptor useFO = new PropertyDescriptor("useFO", beanClass, "isUseFO", "setUseFO"); //@B1A - useFO.setBound(true); //@B1A - useFO.setConstrained(false); //@B1A - useFO.setDisplayName(loader_.getText("PROP_NAME_FORMATTING_OBJECT")); //@B1A - useFO.setShortDescription(loader_.getText("PROP_DESC_FORMATTING_OBJECT")); //@B1A - - - properties_ = new PropertyDescriptor[] {title, lang, dir, useFO}; //@B1C - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLHead is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLHead16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLHead32.gif"); - break; - } - return image; - } - - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} - - diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLHeading.java b/cvsroot/src/com/ibm/as400/util/html/HTMLHeading.java deleted file mode 100644 index 6ae597c63..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLHeading.java +++ /dev/null @@ -1,500 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLHeading.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; - -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; - - -/** -* The HTMLHeading class represents a section heading in an HTML page. -*

    -* This example creates a HTMLHeading tag: -*

    -*  // Create an HTMLHeading.
    -*  HTMLHeading header = new HTMLHeading(1, "My Heading", HTMLConstants.CENTER);
    -*  System.out.println(header);
    -*  
    -*

    -* Here is the output of the HTMLHeading tag:
    -*

    -*  <h1 align="center">My Heading</h1>
    -*  
    -* -*

    -* Calling getFOTag() would produce the following XSL Formatting Object tag: -*

    -* <fo:block-container> -* <fo:block font-size='25pt' text-align='center'>My Heading</fo:block> -* </fo:block-container> -*
    -* -*

    HTMLHeading objects generate the following events: -*

      -*
    • PropertyChangeEvent -*
    -**/ -public class HTMLHeading extends HTMLTagAttributes implements java.io.Serializable // @Z1C -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - static final long serialVersionUID = 4715727576328707163L; - - - private int level_; - private String text_; - private String align_; // @B3C - - private String lang_; // The primary language used to display the tags contents. //$B1A - private String dir_; // The direction of the text interpretation. //$B1A - private boolean useFO_ = false; //Indicates if XSL-FO tags are outputted. //@C1A - - - - - - /** - * Constructs a default HTMLHeading object. - **/ - public HTMLHeading() - { - super(); - - setLevel(1); - } - - - /** - * Constructs an HTMLHeading object with the specified heading level. - * - * @param level The heading level. - **/ - public HTMLHeading(int level) - { - super(); - - setLevel(level); - } - - - /** - * Constructs an HTMLHeading object with the specified heading level and text. - * - * @param level The heading level. - * @param text The heading text. - **/ - public HTMLHeading(int level, String text) - { - super(); - - setLevel(level); - setText(text); - } - - - /** - * Constructs an HTMLHeading object with the specified heading level, text, and align. - * - * @param level The heading level. - * @param text The heading text. - * @param align The heading alignment. One of the following constants - * defined in HTMLConstants: LEFT, RIGHT, or CENTER. - **/ - public HTMLHeading(int level, String text, String align) - { - super(); - - setLevel(level); - setText(text); - setAlign(align); - } - - - /** - * Returns the alignment of the header. - * @return The alignment. - **/ - public String getAlign() - { - return align_; - } - - - /** - * Returns the direction of the text interpretation. - * @return The direction of the text. - **/ - public String getDirection() //$B1A - { - return dir_; - } - - - /** - * Returns the direction attribute tag. - * @return The direction tag. - **/ - String getDirectionAttributeTag() //$B1A - { - if(useFO_ ) //@C1A - { //@C1A - if((dir_ != null) && (dir_.length()>0)) //@C1A - { //@C1A - if(dir_.equals(HTMLConstants.RTL)) //@C1A - return " writing-mode='rl'"; //@C1A - else //@C1A - return " writing-mode='lr'"; //@C1A - } //@C1A - else //@C1A - return ""; //@C1A - } //@C1A - else //@C1A - { //@C1A - //@B4D - - if ((dir_ != null) && (dir_.length() > 0)) - return " dir=\"" + dir_ + "\""; - else - return ""; - } //@C1A - - } - - - /** - * Returns the language of the input element. - * @return The language of the input element. - **/ - public String getLanguage() //$B1A - { - return lang_; - } - - - /** - * Returns the language attribute tag. - * @return The language tag. - **/ - String getLanguageAttributeTag() //$B1A - { - //@B4D - - if ((lang_ != null) && (lang_.length() > 0)) - return " lang=\"" + lang_ + "\""; - else - return ""; - } - - - /** - * Returns the level of the header. - * @return The level. - **/ - public int getLevel() - { - return level_; - } - - - /** - * Returns the text of the header. - * @return The text. - **/ - public String getText() - { - return text_; - } - - - /** - * Returns the tag for the HTML heading. - * @return The tag. - **/ - public String getTag() - { - //@B4D - - if(useFO_) //@C1A - return getFOTag(); //@C1A - - if (text_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting heading text."); - throw new ExtendedIllegalStateException( - "text", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - StringBuffer s = new StringBuffer("" + text_ + " 0) - s.append(Integer.toString(level_)); - - s.append(">"); - - return s.toString(); - } - - - /** - * Returns the tag for the XSL-FO heading. - * The language attribute is not supported by XSL-FO. - * @return The tag. - **/ - public String getFOTag() //@C1A - { - //Save current state of useFO_ - boolean useFO = useFO_; - - //Indicate Formatting Object tags are outputted. - setUseFO(true); - - if (text_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get XSL-FO tag before setting heading text."); - throw new ExtendedIllegalStateException( - "text", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - - StringBuffer s = new StringBuffer("\n"); - s.append(""); - s.append(text_); - s.append("\n"); - s.append("\n"); - - //Set useFO_ to previous state. - setUseFO(useFO); - - return s.toString(); - } - - /** - * Returns if Formatting Object tags are outputted. - * The default value is false. - * @return true if the output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public boolean isUseFO() //@C1A - { - return useFO_; - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - //@CRS changes_ = new PropertyChangeSupport(this); - } - - - // @B3C - /** - * Sets the horizontal alignment for the header. - * @param align The alignment. One of the following constants - * defined in HTMLConstants: LEFT, RIGHT, or CENTER. - * - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setAlign(String align) - { - if (align == null) - throw new NullPointerException("align"); - - // If align is not one of the valid HTMLConstants, throw an exception. - if ( !(align.equals(HTMLConstants.LEFT)) && !(align.equals(HTMLConstants.RIGHT)) && !(align.equals(HTMLConstants.CENTER)) ) - { - throw new ExtendedIllegalArgumentException("align", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - //@B4D - - String old = align_; - - align_ = align; - - if (changes_ != null) changes_.firePropertyChange("align", old, align ); //@CRS - - } - - - /** - * Sets the direction of the text interpretation. - * @param dir The direction. One of the following constants - * defined in HTMLConstants: LTR or RTL. - * - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setDirection(String dir) //$B1A - { - if (dir == null) - throw new NullPointerException("dir"); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - { - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - String old = dir_; - - dir_ = dir; - - if (changes_ != null) changes_.firePropertyChange("dir", old, dir ); //@CRS - } - - - /** - * Sets the language of the input tag. - * @param lang The language. Example language tags include: - * en and en-US. - * - **/ - public void setLanguage(String lang) //$B1A - { - if (lang == null) - throw new NullPointerException("lang"); - - String old = lang_; - - lang_ = lang; - - if (changes_ != null) changes_.firePropertyChange("lang", old, lang ); //@CRS - } - - - /** - * Sets the level of the header. Heading 1(H1) is rendered - * as the largest and most important section heading while - * Heading 6(H6) is rendered as the smallest (lowest importance) - * heading. - * - * @param level The heading level (1 - 6). - * - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setLevel(int level) - { - if (level < 1 || level > 6) - throw new ExtendedIllegalArgumentException("level", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - //@B4D - - int old = level_; - - level_ = level; - - if (changes_ != null) changes_.firePropertyChange("level", new Integer(old), new Integer(level) ); //@CRS - } - - - /** - * Set the visible text to display in the header. - * - * @param text The text. - * - **/ - public void setText(String text) - { - if (text == null) - throw new NullPointerException("text"); - - if (text.length() == 0) - throw new ExtendedIllegalArgumentException("text", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - //@B4D - - String old = text_; - - text_ = text; - - if (changes_ != null) changes_.firePropertyChange("text", old, text ); //@CRS - } - - - /** - * Sets if Formatting Object tags should be used. - * The default value is false. - * @param useFO - true if output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public void setUseFO(boolean useFO) //@C1A - { - boolean old = useFO_; - - useFO_ = useFO; - - if (changes_ != null) changes_.firePropertyChange("useFO", old, useFO ); - } - - /** - * Returns a String representation for the HTMLHeading tag. - * @return The tag. - **/ - public String toString() - { - return getTag(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLHeading16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLHeading16.gif deleted file mode 100644 index ee9091a50..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLHeading16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLHeading32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLHeading32.gif deleted file mode 100644 index c0b2ad0d4..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLHeading32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLHeadingBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLHeadingBeanInfo.java deleted file mode 100644 index de1c0dab8..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLHeadingBeanInfo.java +++ /dev/null @@ -1,189 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLHeadingBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; - - -/** -* The HTMLHeadingBeanInfo class provides bean information for the HTMLHeading class. -**/ -public class HTMLHeadingBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = HTMLHeading.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = {changed}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor align = new PropertyDescriptor("align", beanClass, - "getAlign", "setAlign"); - align.setBound(true); - align.setConstrained(false); - align.setDisplayName(loader_.getText("PROP_NAME_ALIGN")); - align.setShortDescription(loader_.getText("PROP_HH_DESC_ALIGN")); - - PropertyDescriptor level = new PropertyDescriptor("level", beanClass, "getLevel", "setLevel"); - level.setBound(true); - level.setConstrained(false); - level.setDisplayName(loader_.getText("PROP_NAME_LEVEL")); - level.setShortDescription(loader_.getText("PROP_HH_DESC_LEVEL")); - - PropertyDescriptor text = new PropertyDescriptor("text", beanClass, "getText", "setText"); - text.setBound(true); - text.setConstrained(false); - text.setDisplayName(loader_.getText("PROP_NAME_TEXT")); - text.setShortDescription(loader_.getText("PROP_HH_DESC_TEXT")); - - PropertyDescriptor lang = new PropertyDescriptor("lang", beanClass, "getLanguage", "setLanguage"); //$B3A - lang.setBound(true); //$B3A - lang.setConstrained(false); //$B3A - lang.setDisplayName(loader_.getText("PROP_NAME_LANGUAGE")); //$B3A - lang.setShortDescription(loader_.getText("PROP_DESC_LANGUAGE")); //$B3A - - PropertyDescriptor dir = new PropertyDescriptor("dir", beanClass, "getDirection", "setDirection"); //$B3A - dir.setBound(true); //$B3A - dir.setConstrained(false); //$B3A - dir.setDisplayName(loader_.getText("PROP_NAME_DIRECTION")); //$B3A - dir.setShortDescription(loader_.getText("PROP_DESC_DIRECTION")); //$B3A - - PropertyDescriptor useFO = new PropertyDescriptor("useFO", beanClass, "isUseFO", "setUseFO"); //@C1A - useFO.setBound(true); //@C1A - useFO.setConstrained(false); //@C1A - useFO.setDisplayName(loader_.getText("PROP_NAME_FORMATTING_OBJECT")); //@C1A - useFO.setShortDescription(loader_.getText("PROP_DESC_FORMATTING_OBJECT")); //@C1A - - properties_ = new PropertyDescriptor[] {align, level, text, lang, dir, useFO}; //$B3C //@C1C - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLHeading is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLHeading16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLHeading32.gif"); - break; - } - return image; - } - - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLHyperlink.java b/cvsroot/src/com/ibm/as400/util/html/HTMLHyperlink.java deleted file mode 100644 index 7864b987f..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLHyperlink.java +++ /dev/null @@ -1,659 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLHyperlink.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Trace; -import com.ibm.as400.util.servlet.ServletHyperlink; - -import java.util.Enumeration; -import java.util.Properties; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; - -/** -* The HTMLHyperlink class represents an HTML hyperlink tag. -* -*

    This example creates an HTMLHyperlink and displays the HTML tag. -*

    -*  HTMLHyperlink link = new HTMLHyperlink("http://www.myCompany.com", "myCompany Home Page");
    -*  System.out.println(link.getTag());
    -*  
    -* -*

    Here is the output of the HTMLHyperlink: -*

    -*  <a href="http://www.myCompany.com">myCompany Home Page</a>
    -*  
    -* -*

    This example creates an HTMLHyperlink and sets two properties. -*

    -*  HTMLHyperlink link = new HTMLHyperlink("http://www.myCompany.com", "myCompany Home Page");
    -*  Properties properties = new Properties();
    -*  properties.put("userID", "fred");
    -*  properties.put("employeeID", "01234567");
    -*  link.setProperties(properties);
    -*  System.out.println(link.getTag());
    -*  
    -* -*

    Here is the output of the HTMLHyperlink: -*

    -*  <a href="http://www.myCompany.com?userid=fred&employeeID=01234567">myCompany Home Page</a>
    -*  
    -* -*

    HTMLHyperlink objects generate the following events: -*

      -*
    • PropertyChangeEvent -*
    • VetoableChangeEvent -*
    -**/ -public class HTMLHyperlink extends HTMLTagAttributes implements HTMLConstants, java.io.Serializable // @Z1C -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - static final long serialVersionUID = 83601853360783566L; - - private String bookmarkName_; // The bookmark name. - private String link_; // The network address for the link resource. - private Properties properties_; // Properties associated with the hyperlink. (ie. parameters for URL rewriting) - private String target_; // The target frame for the link resource. - private String text_; // The text to be used to represent the link. - private String title_; // The title for the link resource. - private String location_; // The bookmark location (ie - #location) for the link resource. // $B4A - - private String lang_; // The primary language used to display the tags contents. //$B1A - private String dir_; // The direction of the text interpretation. //$B1A - - transient VetoableChangeSupport vetos_; //@CRS - - /** - * Creates a default HTMLHyperlink object. - **/ - public HTMLHyperlink() - { - } - - /** - * Creates an HTMLHyperlink object with the specified resource link. - * @param link The Uniform Resource Identifier (URI). - **/ - public HTMLHyperlink(String link) - { - if (link == null) - throw new NullPointerException("link"); - link_ = link; - } - - /** - * Creates an HTMLHyperlink object with the specified resource link - * represented by the specified text. - * @param link The Uniform Resource Identifier (URI). - * @param text The text representation for the resource. - **/ - public HTMLHyperlink(String link, String text) - { - this(link); - - if (text == null) - throw new NullPointerException("text"); - text_ = text; - } - - /** - * Creates an HTMLHyperlink object with the specified resource link - * and target frame represented by the specified text. - * @param link The Uniform Resource Identifier (URI). - * @param text The text representation for the resource. - * @param target The target frame. - **/ - public HTMLHyperlink(String link, String text, String target) - { - this(link,text); - - if (target == null) - throw new NullPointerException("target"); - target_ = target; - } - - - /** - Adds the VetoableChangeListener. The specified - VetoableChangeListener's vetoableChange - method is called each time the value of any - constrained property is changed. - @see #removeVetoableChangeListener - @param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); //@CRS - vetos_.addVetoableChangeListener(listener); - } - - /** - * Returns a copy of the HTMLHyperlink. - * - * @return An HTMLHyperlink. - **/ - public Object clone() //$B3A - { - HTMLHyperlink l = new HTMLHyperlink(); - try - { - if (location_ != null) //$B4A - l.setLocation(location_); //$B4A - - if (properties_ != null) // @B5A - l.setProperties(properties_); // @B5A - - if (getAttributes() != null) // @B5A - l.setAttributes(getAttributes()); // @B5A - - if (link_ != null) - l.setLink(link_); - - if (target_ != null) - l.setTarget(target_); - - if (text_ != null) - l.setText(text_); - - if (title_ != null) - l.setTitle(title_); - - if (dir_ != null) - l.setDirection(dir_); - - if (lang_ != null) - l.setLanguage(lang_); - - if (bookmarkName_ != null) - l.setName(bookmarkName_); - } - catch (PropertyVetoException e) - { /* Ignore */ - } - - return l; - } - - - /** - * Returns the direction of the text interpretation. - * @return The direction of the text. - **/ - public String getDirection() //$B1A - { - return dir_; - } - - - /** - * Returns the direction attribute tag. - * @return The direction tag. - **/ - String getDirectionAttributeTag() //$B1A - { - //@C1D - - if ((dir_ != null) && (dir_.length() > 0)) - return " dir=\"" + dir_ + "\""; - else - return ""; - } - - - /** - * Returns the language of the input element. - * @return The language of the input element. - **/ - public String getLanguage() //$B1A - { - return lang_; - } - - - /** - * Returns the language attribute tag. - * @return The language tag. - **/ - String getLanguageAttributeTag() //$B1A - { - //@C1D - - if ((lang_ != null) && (lang_.length() > 0)) - return " lang=\"" + lang_ + "\""; - else - return ""; - } - - - /** - * Returns the Uniform Resource Identifier (URI) for the resource link. - * @return The Uniform Resource Identifier. - **/ - public String getLink() - { - return link_; - } - - - /** - * Returns the bookmark locatoin of the resource link. - * @return The location. - **/ - public String getLocation() - { - return location_; - } - - - /** - * Returns the bookmark name. - * @return The name. - **/ - public String getName() - { - return bookmarkName_; - } - - /** - * Returns the properties associated with the link resource. - * @return The properties. - **/ - public Properties getProperties() - { - return properties_; - } - - /** - * Returns the target frame for the resource link. - * @return The target frame. a user-defined frame or one - * of the following constants defined in HTMLConstants: - * TARGET_BLANK, TARGET_PARENT, TARGET_SELF, or TARGET_TOP. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public String getTarget() - { - return target_; - } - - /** - * Returns the text that represents the resource link. - * This the text that is shown in the HTML document. - * @return The text. - **/ - public String getText() - { - return text_; - } - - /** - * Returns the title for the resource link. - * @return The title. - **/ - public String getTitle() - { - return title_; - } - - /** - * Returns a comment tag. - * This method should not be called. There is no XSL-FO support for this class. - * @return The comment tag. - **/ - public String getFOTag() //@D1A - { - Trace.log(Trace.ERROR, "Attempting to getFOTag() for an object that doesn't support it."); - return ""; - } - - /** - * Returns the HTML tag that represents the resource link. - * @return The HTML tag. - **/ - public String getTag() - { - return getTag(text_, properties_); - } - - /** - * Returns the HTML tag that represents the resource link - * with the specified text and properties. The original HTMLHyperlink object text - * and properties are not changed/updated. - * @param text The text. - * @param properties The Properties. - * @return The HTML tag. - **/ - public String getTag(String text, Properties properties) - { - return getTag(text, bookmarkName_, link_, properties); //$B2C - } - - - /** - * Returns the HTML tag that represents the resource link - * with the specified text, bookmark name, resource link, and properties. - * The original HTMLHyperlink object text, bookmark name, resource link, and properties - * are not changed/updated. - * @param text The text. - * @param name The bookmark name. - * @param link The Uniform Resource Identifier (URI). - * @param properties The Properties. - * @return The HTML tag. - **/ - public String getTag(String text, String name, String link, Properties properties) //$B2A - { - //@C1D - - // Verify that the link has been set. - if (link == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting the link."); - throw new ExtendedIllegalStateException("link", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Validate the text parameter. - if (text == null) - throw new NullPointerException("text"); - - - // create the tag. - StringBuffer buffer = new StringBuffer(); - - buffer.append(""); - buffer.append(text); - buffer.append(""); - return new String(buffer); - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS vetos_ = new VetoableChangeSupport(this); - } - - - - /** - Removes the VetoableChangeListener from the internal list. - If the VetoableChangeListener is not on the list, nothing is done. - @see #addVetoableChangeListener - @param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ != null) vetos_.removeVetoableChangeListener(listener); //@CRS - } - - - /** - * Sets the direction of the text interpretation. - * @param dir The direction. One of the following constants - * defined in HTMLConstants: LTR or RTL. - * - * @see com.ibm.as400.util.html.HTMLConstants - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setDirection(String dir) //$B1A - throws PropertyVetoException - { - if (dir == null) - throw new NullPointerException("dir"); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - { - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - String old = dir_; - if (vetos_ != null) vetos_.fireVetoableChange("dir", old, dir ); //@CRS - - dir_ = dir; - - if (changes_ != null) changes_.firePropertyChange("dir", old, dir ); //@CRS - } - - - /** - * Sets the language of the input tag. - * @param lang The language. Example language tags include: - * en and en-US. - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setLanguage(String lang) //$B1A - throws PropertyVetoException - { - if (lang == null) - throw new NullPointerException("lang"); - - String old = lang_; - if (vetos_ != null) vetos_.fireVetoableChange("lang", old, lang ); //@CRS - - lang_ = lang; - - if (changes_ != null) changes_.firePropertyChange("lang", old, lang ); //@CRS - } - - - /** - * Sets the bookmark location of the resource link within a document. The location - * is denoted with the # symbol at the end of the - * link followed by a location. (ie - http://myPage.html#myBookmarkLocation) - * @param location The location. - **/ - public void setLocation(String location) //$B4A - { - if (location == null) - throw new NullPointerException("location"); - - String old = location_; - - location_ = location; - - if (changes_ != null) changes_.firePropertyChange("location", old, location); //@CRS - } - - - /** - * Sets the Uniform Resource Identifier (URI) for the resource link. - * @param link The Uniform Resource Identifier. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setLink(String link) throws PropertyVetoException - { - if (link == null) - throw new NullPointerException("link"); - - String old = link_; - if (vetos_ != null) vetos_.fireVetoableChange("link", old, link ); //@CRS - - link_ = link; - - if (changes_ != null) changes_.firePropertyChange("link", old, link ); //@CRS - } - - /** - * Sets the bookmark name. - * @param name The bookmark name. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setName(String name) throws PropertyVetoException - { - if (name == null) - throw new NullPointerException("name"); - - String old = bookmarkName_; - if (vetos_ != null) vetos_.fireVetoableChange("name", old, name); //@CRS - - bookmarkName_ = name; - - if (changes_ != null) changes_.firePropertyChange("name", old, name); //@CRS - } - - /** - * Sets the properties associated with the resource link. - * The properties are the attributes associated with the - * Uniform Resource Identifier. - * @param properties The properties. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setProperties(Properties properties) throws PropertyVetoException - { - if (properties == null) - throw new NullPointerException("properties"); - - Properties old = properties_; - if (vetos_ != null) vetos_.fireVetoableChange("properties", old, properties); //@CRS - - properties_ = properties; - - if (changes_ != null) changes_.firePropertyChange("properties", old, properties); //@CRS - } - - /** - * Sets the target frame for the resource link. - * @param target The target frame. A user-defined frame or - * one of the following constants defined in HTMLConstants: - * TARGET_BLANK, TARGET_PARENT, TARGET_SELF, or TARGET_TOP. - * @exception PropertyVetoException If the change is vetoed. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setTarget(String target) throws PropertyVetoException - { - if (target == null) - throw new NullPointerException("target"); - - String old = target_; - if (vetos_ != null) vetos_.fireVetoableChange("target", old, target); //@CRS - - target_ = target; - - if (changes_ != null) changes_.firePropertyChange("target", old, target); //@CRS - } - - /** - * Sets the text representation for the resource link. - * This is the text that is shown in the HTML document. - * @param text The text. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setText(String text) throws PropertyVetoException - { - if (text == null) - throw new NullPointerException("text"); - - String old = text_; - if (vetos_ != null) vetos_.fireVetoableChange("text", old, text); //@CRS - - text_ = text; - - if (changes_ != null) changes_.firePropertyChange("text", old, text); //@CRS - } - - /** - * Sets the title for the resource link. - * @param title The title. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setTitle(String title) throws PropertyVetoException - { - if (title == null) - throw new NullPointerException("title"); - - String old = title_; - if (vetos_ != null) vetos_.fireVetoableChange("title", old, title); //@CRS - - title_ = title; - - if (changes_ != null) changes_.firePropertyChange("title", old, title); //@CRS - } - - /** - * Returns the HTML tag that represents the resource link. - * @return The HTML tag. - **/ - public String toString() - { - return getTag(); - } -} - diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLHyperlink16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLHyperlink16.gif deleted file mode 100644 index 8ddfd611d..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLHyperlink16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLHyperlink32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLHyperlink32.gif deleted file mode 100644 index ac3bbdc8b..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLHyperlink32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLHyperlinkBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLHyperlinkBeanInfo.java deleted file mode 100644 index cd576f093..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLHyperlinkBeanInfo.java +++ /dev/null @@ -1,214 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLHyperlinkBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -The HTMLHyperlinkBeanInfo class provides -bean information for the HTMLHyperlink class. -**/ -public class HTMLHyperlinkBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class beanClass = HTMLHyperlink.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor link = new PropertyDescriptor("link", beanClass, - "getLink", "setLink"); - link.setBound(true); - link.setConstrained(true); - link.setDisplayName(loader_.getText("PROP_NAME_LINK")); - link.setShortDescription(loader_.getText("PROP_DESC_LINK")); - - PropertyDescriptor name = new PropertyDescriptor("name", beanClass, - "getName", "setName"); - name.setBound(true); - name.setConstrained(true); - name.setDisplayName(loader_.getText("PROP_NAME_NAME")); - name.setShortDescription(loader_.getText("PROP_HHLNK_DESC_NAME")); - - PropertyDescriptor properties = new PropertyDescriptor("properties", beanClass, - "getProperties", "setProperties"); - properties.setBound(true); - properties.setConstrained(true); - properties.setDisplayName(loader_.getText("PROP_NAME_PROPERTIES")); - properties.setShortDescription(loader_.getText("PROP_DESC_PROPERTIES")); - - PropertyDescriptor target = new PropertyDescriptor("target", beanClass, - "getTarget", "setTarget"); - target.setBound(true); - target.setConstrained(true); - target.setDisplayName(loader_.getText("PROP_NAME_TARGET")); - target.setShortDescription(loader_.getText("PROP_HHLNK_DESC_TARGET")); - - PropertyDescriptor text = new PropertyDescriptor("text", beanClass, - "getText", "setText"); - text.setBound(true); - text.setConstrained(true); - text.setDisplayName(loader_.getText("PROP_NAME_TEXT")); - text.setShortDescription(loader_.getText("PROP_HHLNK_DESC_TEXT")); - - PropertyDescriptor title = new PropertyDescriptor("title", beanClass, - "getTitle", "setTitle"); - title.setBound(true); - title.setConstrained(true); - title.setDisplayName(loader_.getText("PROP_NAME_TITLE")); - title.setShortDescription(loader_.getText("PROP_DESC_TITLE")); - - PropertyDescriptor lang = new PropertyDescriptor("lang", beanClass, "getLanguage", "setLanguage"); //$B3A - lang.setBound(true); //$B3A - lang.setConstrained(true); //$B3A - lang.setDisplayName(loader_.getText("PROP_NAME_LANGUAGE")); //$B3A - lang.setShortDescription(loader_.getText("PROP_DESC_LANGUAGE")); //$B3A - - PropertyDescriptor dir = new PropertyDescriptor("dir", beanClass, "getDirection", "setDirection"); //$B3A - dir.setBound(true); //$B3A - dir.setConstrained(true); //$B3A - dir.setDisplayName(loader_.getText("PROP_NAME_DIRECTION")); //$B3A - dir.setShortDescription(loader_.getText("PROP_DESC_DIRECTION")); //$B3A - - PropertyDescriptor location = new PropertyDescriptor("location", beanClass, "getLocation", "setLocation"); //$B4A - location.setBound(true); //$B4A - location.setConstrained(true); //$B4A - location.setDisplayName(loader_.getText("PROP_NAME_LOCATION")); //$B4A - location.setShortDescription(loader_.getText("PROP_DESC_LOCATION")); //$B4A - - properties_ = new PropertyDescriptor[] { link, name, properties, target, text, //$B4C - title, lang, dir, location }; //$B4C - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLHyperlink is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLHyperlink16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLHyperlink32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLImage.java b/cvsroot/src/com/ibm/as400/util/html/HTMLImage.java deleted file mode 100644 index 0ad1178dc..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLImage.java +++ /dev/null @@ -1,595 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResetFormInput.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; - -import java.beans.PropertyChangeSupport; - - -/** -* The HTMLImage class represents an image tag within an HTML page. -*

    -* This example creates a HTMLImage tag: -*

    -*  // Create an HTMLImage.
    -*  HTMLImage image = new HTMLImage("http://myWebPage/pic.gif", "alternate text");
    -*  image.setHeight(50);
    -*  image.setWidth(50);
    -*  System.out.println(image);
    -*  
    -*

    -* Here is the output of the HTMLImage tag:
    -*

    -*  <img src="http://myWebPage/pic.gif" alt="alternate text" height="50" width="50" />
    -*  
    -* -*

    -* The equivalent tag using XSL Formatting Objects looks like the following: -*

    -* <fo:block> -* <fo:external-graphic src="file:http://myWebPage/pic.gif" content-height="50px" content-width="50px"/> -* </fo:block> -*
    -* -*

    HTMLImage objects generate the following events: -*

      -*
    • PropertyChangeEvent -*
    -**/ -public class HTMLImage extends HTMLTagAttributes implements HTMLConstants, java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - static final long serialVersionUID = -7792796091910634206L; - - // Private data. - private String name_; - private String source_; - private String align_; - private String alt_; - private int border_ = -1; - private int height_ = 0; - private int hspace_ = 0; - private int width_ = 0; - private int vspace_ = 0; - private boolean useFO_ = false; //Indicates if XSL-FO tags are outputted. //@A1A - - - /** - * Constructs a default HTMLImage object. - **/ - public HTMLImage() - { - super(); - } - - - /** - * Constructs an HTMLImage object with the specified source and alternate text. - * - * @param source The absolute or relative URL. - * @param alt The alternate text. - **/ - public HTMLImage( String source, String alt ) - { - setSrc(source); - setAlt(alt); - } - - /** - * Returns the alignment of the image. - * - * @return The alignment. - **/ - public String getAlign() - { - return align_; - } - - /** - * Returns the alternate text. - * - * @return The alternate text. - **/ - public String getAlt() - { - return alt_; - } - - - /** - * Returns the thickness of the border around the image. - * - * @return The border. - **/ - public int getBorder() - { - return border_; - } - - - /** - * Returns the height of the image. - * - * @return The height. - **/ - public int getHeight() - { - return height_; - } - - - /** - * Returns the horizontal space around the image in pixels. - * - * @return The horizontal space. - **/ - public int getHSpace() - { - return hspace_; - } - - - /** - * Returns the unique name of the image. - * - * @return The name. - **/ - public String getName() - { - return name_; - } - - - /** - * Returns the absolute or relative URL to reference the image. - * - * @return The source. - **/ - public String getSrc() - { - return source_; - } - - - /** - * Returns the vertical space around the Image in pixels. - * - * @return The vertical space. - **/ - public int getVSpace() - { - return vspace_; - } - - - /** - * Sets the width of the image in pixels. - * - * @return The width. - **/ - public int getWidth() - { - return width_; - } - - /** - * Returns the element tag. - * - * @return The tag. - **/ - public String getTag() - { - if(useFO_) //@A1A - return getFOTag(); //@A1A - - if (source_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting image source."); - throw new ExtendedIllegalStateException("source", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - if (alt_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting image alt."); - throw new ExtendedIllegalStateException("alt", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - StringBuffer tag = new StringBuffer( " -1) - { - tag.append(" border=\""); - tag.append( border_ ); - tag.append("\""); - - } - - if (height_ > 0) - { - tag.append(" height=\""); - tag.append( height_ ); - tag.append("\""); - } - - if (width_ > 0) - { - tag.append(" width=\""); - tag.append( width_ ); - tag.append("\""); - } - - if (hspace_ > 0) - { - tag.append(" hspace=\""); - tag.append( hspace_ ); - tag.append("\""); - } - - if (vspace_ > 0) - { - tag.append(" vspace=\""); - tag.append( vspace_ ); - tag.append("\""); - } - - tag.append( getAttributeString() ); - - tag.append( " />" ); - - return tag.toString(); - } - - - /** - * Returns the element tag for the XSL-FO image. - * The alternate text and name attributes are not supported by XSL-FO. - * @return The tag. - **/ - public String getFOTag() //@A1A - { - //Save current state of useFO_ - boolean useFO = useFO_; - - //Indicate Formatting Object tags are outputted. - setUseFO(true); - - if (source_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get XSL-FO tag before setting image source."); - throw new ExtendedIllegalStateException("source", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - StringBuffer tag = new StringBuffer(""); - - tag.append("\n"); - tag.append(" -1) - { - tag.append(" border-width=\""); - tag.append( border_ ); - tag.append("mm\""); - tag.append(" border-style='solid'"); - } - - if (height_ > 0) - { - tag.append(" content-height=\""); - tag.append( height_ ); - tag.append("px\""); - } - - if (width_ > 0) - { - tag.append(" content-width=\""); - tag.append( width_ ); - tag.append("px\""); - } - - if (hspace_ > 0) - { - tag.append(" width=\""); - tag.append( hspace_ ); - tag.append("px\""); - } - - if (vspace_ > 0) - { - tag.append(" height=\""); - tag.append( vspace_ ); - tag.append("px\""); - } - - tag.append("/>\n"); - tag.append("\n"); - - //Set useFO_ to previous state. - setUseFO(useFO); - - return tag.toString(); - } - - /** - * Returns if Formatting Object tags are outputted. - * The default value is false. - * @return true if the output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public boolean isUseFO() //@A1A - { - return useFO_; - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - - //@CRS changes_ = new PropertyChangeSupport(this); - } - - - /** - * Sets the alignment of text following the image tag relative to the graphic on screen. - * - * @param align The alignment. One of the following constants - * defined in HTMLConstants: LEFT, RIGHT, TOP, TEXTTOP, MIDDLE, ABSMIDDLE, BASELINE, BOTTOM, or ABSBOTTOM . - * - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setAlign(String align) - { - if (align == null) - throw new NullPointerException("align"); - - // If align is not one of the valid HTMLConstants, throw an exception. - if ( !(align.equals(HTMLConstants.LEFT)) && !(align.equals(HTMLConstants.RIGHT)) && !(align.equals(HTMLConstants.TOP)) && - !(align.equals(HTMLConstants.TEXTTOP)) && !(align.equals(HTMLConstants.MIDDLE)) && !(align.equals(HTMLConstants.ABSMIDDLE)) && - !(align.equals(HTMLConstants.BASELINE)) && !(align.equals(HTMLConstants.BOTTOM)) && !(align.equals(HTMLConstants.BOTTOM)) && - !(align.equals(HTMLConstants.ABSBOTTOM)) ) - { - throw new ExtendedIllegalArgumentException("align", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - String old = align_; - - align_ = align; - - if (changes_ != null) changes_.firePropertyChange("align", old, align ); //@CRS - } - - - /** - * Sets the alternate text to be displayed in place of the image. This text will be displayed - * for browsers that can not handle this ability or that have disabled this ability. - * - * @param alt The alternate text. - **/ - public void setAlt( String alt ) - { - if (alt == null) - throw new NullPointerException("alt"); - - String old = alt_; - - alt_ = alt; - - if (changes_ != null) changes_.firePropertyChange("alt", old, alt ); //@CRS - } - - - /** - * Sets the thickness of the border around the image. - * - * @param border The border thickness. - **/ - public void setBorder( int border ) - { - if (border < 0) - throw new ExtendedIllegalArgumentException("border", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - int old = border_; - - border_ = border; - - if (changes_ != null) changes_.firePropertyChange("border", new Integer(old), new Integer(border) ); //@CRS - } - - - /** - * Sets the height of the image in pixels. - * - * @param height The height. - **/ - public void setHeight( int height ) - { - if (height < 0 ) - throw new ExtendedIllegalArgumentException("height", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - int old = height_; - - height_ = height; - - if (changes_ != null) changes_.firePropertyChange("height", new Integer(old), new Integer(height) ); //@CRS - } - - - /** - * Sets the horizontal space around the image in pixels. - * - * @param hspace The horizontal space. - **/ - public void setHSpace( int hspace ) - { - if (hspace < 0) - throw new ExtendedIllegalArgumentException("hspace", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - int old = hspace_; - - hspace_ = hspace; - - if (changes_ != null) changes_.firePropertyChange("hspace", new Integer(old), new Integer(hspace) ); //@CRS - } - - - /** - * Set the a unique name of the image. - * - * @param name The name. - **/ - public void setName( String name ) - { - if (name == null) - throw new NullPointerException("name"); - - String old = name_; - - name_ = name; - - if (changes_ != null) changes_.firePropertyChange("name", old, name ); //@CRS - } - - - /** - * Sets the absolute or relative URL to reference the image. - * - * @param source The source. - **/ - public void setSrc( String source ) - { - if (source == null) - throw new NullPointerException("source"); - - String old = source_; - - source_ = source; - - if (changes_ != null) changes_.firePropertyChange("source", old, source ); //@CRS - } - - - /** - * Sets the vertical space around the image in pixels. - * - * @param vspace The vertical space. - **/ - public void setVSpace( int vspace ) - { - if (vspace < 0 ) - throw new ExtendedIllegalArgumentException("vspace", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - int old = vspace_; - - vspace_ = vspace; - - if (changes_ != null) changes_.firePropertyChange("vspace", new Integer(old), new Integer(vspace) ); //@CRS - } - - - /** - * Sets the width of the image in pixels. - * - * @param width The width. - **/ - public void setWidth( int width ) - { - if (width < 0 ) - throw new ExtendedIllegalArgumentException("width", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - int old = width_; - - width_ = width; - - if (changes_ != null) changes_.firePropertyChange("width", new Integer(old), new Integer(width) ); //@CRS - } - - /** - * Sets if Formatting Object tags should be used. - * The default value is false. - * @param useFO - true if output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public void setUseFO(boolean useFO) //@A1A - { - boolean old = useFO_; - - useFO_ = useFO; - - if (changes_ != null) changes_.firePropertyChange("useFO", old, useFO ); - } - - /** - * Returns a String representation for the HTMLImage tag. - * - * @return The tag. - **/ - public String toString() - { - return getTag(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLImage16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLImage16.gif deleted file mode 100644 index 9f24d03ab..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLImage16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLImage32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLImage32.gif deleted file mode 100644 index 2520d10a1..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLImage32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLImageBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLImageBeanInfo.java deleted file mode 100644 index 52ce8d700..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLImageBeanInfo.java +++ /dev/null @@ -1,212 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResetFormInput.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; - - -/** -* The HTMLImageBeanInfo class provides bean information for the HTMLImage class. -**/ -public class HTMLImageBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class beanClass = HTMLImage.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = { changed }; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor align = new PropertyDescriptor("align", beanClass, - "getAlign", "setAlign"); - align.setBound(true); - align.setConstrained(false); - align.setDisplayName(loader_.getText("PROP_NAME_ALIGNMENT")); - align.setShortDescription(loader_.getText("PROP_DESC_ALIGNMENT")); - - PropertyDescriptor src = new PropertyDescriptor("source", beanClass, "getSrc", "setSrc"); - src.setBound(true); - src.setConstrained(false); - src.setDisplayName(loader_.getText("PROP_NAME_SOURCE")); - src.setShortDescription(loader_.getText("PROP_DESC_SOURCE")); - - PropertyDescriptor alt = new PropertyDescriptor("alt", beanClass, "getAlt", "setAlt"); - alt.setBound(true); - alt.setConstrained(false); - alt.setDisplayName(loader_.getText("PROP_NAME_ALT")); - alt.setShortDescription(loader_.getText("PROP_DESC_ALT")); - - PropertyDescriptor border = new PropertyDescriptor("border", beanClass, "getBorder", "setBorder"); - border.setBound(true); - border.setConstrained(false); - border.setDisplayName(loader_.getText("PROP_NAME_BORDER")); - border.setShortDescription(loader_.getText("PROP_DESC_BORDER")); - - PropertyDescriptor name = new PropertyDescriptor("name", beanClass, "getName", "setName"); - name.setBound(true); - name.setConstrained(false); - name.setDisplayName(loader_.getText("PROP_NAME_NAME")); - name.setShortDescription(loader_.getText("PROP_HI_DESC_NAME")); - - PropertyDescriptor hspace = new PropertyDescriptor("hspace", beanClass, "getHSpace", "setHSpace"); - hspace.setBound(true); - hspace.setConstrained(false); - hspace.setDisplayName(loader_.getText("PROP_NAME_HSPACE")); - hspace.setShortDescription(loader_.getText("PROP_DESC_HSPACE")); - - PropertyDescriptor vspace = new PropertyDescriptor("vspace", beanClass, "getVSpace", "setVSpace"); - vspace.setBound(true); - vspace.setConstrained(false); - vspace.setDisplayName(loader_.getText("PROP_NAME_VSPACE")); - vspace.setShortDescription(loader_.getText("PROP_DESC_VSPACE")); - - PropertyDescriptor width = new PropertyDescriptor("width", beanClass, "getWidth", "setWidth"); - width.setBound(true); - width.setConstrained(false); - width.setDisplayName(loader_.getText("PROP_NAME_WIDTH")); - width.setShortDescription(loader_.getText("PROP_DESC_WIDTH")); - - PropertyDescriptor height = new PropertyDescriptor("height", beanClass, "getHeight", "setHeight"); - height.setBound(true); - height.setConstrained(false); - height.setDisplayName(loader_.getText("PROP_NAME_HEIGHT")); - height.setShortDescription(loader_.getText("PROP_DESC_HEIGHT")); - - PropertyDescriptor useFO = new PropertyDescriptor("useFO", beanClass, "isUseFO", "setUseFO"); //@B1A - useFO.setBound(true); //@B1A - useFO.setConstrained(false); //@B1A - useFO.setDisplayName(loader_.getText("PROP_NAME_FORMATTING_OBJECT")); //@B1A - useFO.setShortDescription(loader_.getText("PROP_DESC_FORMATTING_OBJECT")); //@B1A - - properties_ = new PropertyDescriptor[] {align, src, alt, border, name, hspace, vspace, width, height, useFO}; //@B1C - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLHeading is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo()}; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLImage16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLImage32.gif"); - break; - } - return image; - } - - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLList.java b/cvsroot/src/com/ibm/as400/util/html/HTMLList.java deleted file mode 100644 index b873cffbd..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLList.java +++ /dev/null @@ -1,499 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalArgumentException; - - -import java.util.Vector; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.util.*; - - -/** -* The HTMLList class represents a list. The list can either be an ordered -* list <ol> or an unordered list <ul>. -* -*

    HTMLList objects generate the following events: -*

      -*
    • ElementEvent - The events fired are: -*
        -*
      • elementAdded -*
      • elementRemoved -*
      -*
    • PropertyChangeEvent -*
    -*

    -**/ -public abstract class HTMLList extends HTMLTagAttributes implements java.io.Serializable // @Z1C -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - static final long serialVersionUID = -3017041765887905594L; - - private boolean compact_ = false; - private Vector listItems_; - - private String lang_; // The primary language used to display the tags contents. //$B1A - private String dir_; // The direction of the text interpretation. //$B1A - private boolean useFO_ = false; // Indicates if XSL-FO tags are outputted. //@D1A - private int value_ = -1; //The number other than the incremented value for the current List Item (LI) //@D1A - - transient private Vector elementListeners; // The list of element listeners @CRS - - - /** - * Constructs a default HTMLList object. - **/ - public HTMLList() - { - super(); - listItems_ = new Vector(); - } - - - /** - * Constructs an HTMLList object with the specified itemList. - * @param itemList The items in the HTMLList. - **/ - public HTMLList(Vector itemList) - { - super(); - - setItems(itemList); - } - - - /** - * Adds an HTMLListItem item to the HTMLList. - * @param item The HTMLTagElement. - **/ - public void addListItem(HTMLListItem item) - { - //@C1D - - if (item == null) - throw new NullPointerException("item"); - - listItems_.addElement(item); - - fireElementEvent(ElementEvent.ELEMENT_ADDED); - } - - - /** - * Adds an HTML list to the HTMLList. - * @param list The HTMLList. - **/ - public void addList(HTMLList list) - { - //@C1D - - if (list == null) - throw new NullPointerException("list"); - - listItems_.addElement(list); - - fireElementEvent(ElementEvent.ELEMENT_ADDED); - } - - - /** - * Adds an ElementListener. - * - * @param listener The ElementListener. - **/ - public void addListItemElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (elementListeners == null) elementListeners = new Vector(); //@CRS - elementListeners.addElement(listener); - } - - - - /** - * Fires the element event. - **/ - private void fireElementEvent(int evt) - { - if (elementListeners == null) return; //@CRS - Vector targets; - targets = (Vector) elementListeners.clone(); - ElementEvent elementEvt = new ElementEvent(this, evt); - for (int i = 0; i < targets.size(); i++) - { - ElementListener target = (ElementListener)targets.elementAt(i); - if (evt == ElementEvent.ELEMENT_ADDED) - target.elementAdded(elementEvt); - else if (evt == ElementEvent.ELEMENT_REMOVED) - target.elementRemoved(elementEvt); - } - } - - - /** - * Returns the direction of the text interpretation. - * @return The direction of the text. - **/ - public String getDirection() //$B1A - { - return dir_; - } - - - /** - * Returns the direction attribute tag. - * @return The direction tag. - **/ - String getDirectionAttributeTag() //$B1A - { - - if(useFO_) //@D1A - { //@D1A - if((dir_!=null) && (dir_.length()>0)) //@D1A - { //@D1A - if(dir_.equals(HTMLConstants.RTL)) //@D1A - return " writing-mode='rl'"; //@D1A - else //@D1A - return " writing-mode='lr'"; //@D1A - } //@D1A - else //@D1A - return ""; //@D1A - } //@D1A - else //@D1A - { //@D1A - //@C1D - - if ((dir_ != null) && (dir_.length() > 0)) - { - StringBuffer buffer = new StringBuffer(" dir=\""); - buffer.append(dir_); - buffer.append("\""); - - return buffer.toString(); - } - else - return ""; - } //@D1A - - } - - - /** - * Returns the number of items in the HTMLList. - * @return The number of items. - **/ - public int getItemCount() - { - return listItems_.size(); - } - - - - /** - * Returns the list of items. - * @return The items. - **/ - public Vector getItems() - { - return listItems_; - } - - - /** - * Returns the item attribute tags. - * @return The item tags. - **/ - String getItemAttributeTag() - { - StringBuffer s = new StringBuffer(""); - for (int i=0; i < listItems_.size(); i++) - { - HTMLTagElement item = (HTMLTagElement)listItems_.elementAt(i); - s.append(item.getTag()); - } - - return s.toString(); - } - - - /** - * Returns the item attribute tags. - * @param type, The type of numbering or bulleting used as defined in HTMLConstants - * @return The item tags. - **/ - String getItemAttributeFOTag(String type) //@D1A - { - String itemType = null; - int listItemCounter = 0; - StringBuffer s = new StringBuffer(""); - int size = listItems_.size(); - for (int i=0; i < size; i++) - { - s.append("\n"); - HTMLTagElement item = (HTMLTagElement)listItems_.elementAt(i); - if(listItems_.elementAt(i) instanceof HTMLListItem) - { - listItemCounter++; - if(listItems_.elementAt(i) instanceof OrderedListItem) - { - OrderedListItem listItem = (OrderedListItem)listItems_.elementAt(i); - //Check to see if the user specified a starting value for the list item - value_ = listItem.getValue(); - if(value_ > 0) - listItemCounter = value_; - //Check to see if the user specified a new type for the label - itemType = listItem.getType(); - } - else - { - UnorderedListItem listItem = (UnorderedListItem)listItems_.elementAt(i); - //Check to see if the user specified a new type for the label - itemType = listItem.getType(); - } - if(itemType == null) //User didn't specify a type for the specific list item, use list's type for label - itemType = type; - HTMLListItem listItem = (HTMLListItem)listItems_.elementAt(i); - s.append(listItem.getTypeAttributeFO(itemType, listItemCounter)); - } - s.append("\n"); - s.append(item.getFOTag()); - s.append("\n\n"); - - } - - return s.toString(); - } - - - /** - * Returns the language of the input element. - * @return The language of the input element. - **/ - public String getLanguage() //$B1A - { - return lang_; - } - - - /** - * Returns the language attribute tag. - * @return The language tag. - **/ - String getLanguageAttributeTag() //$B1A - { - //@C1D - - if ((lang_ != null) && (lang_.length() > 0)) - { - StringBuffer buffer = new StringBuffer(" lang=\""); - buffer.append(lang_); - buffer.append("\""); - - return buffer.toString(); - } - else - return ""; - } - - - /** - * Indicates if the list is initialized to compact. - * @return true if compact; false otherwise. - **/ - public boolean isCompact() - { - return compact_; - } - - - /** - * Returns if Formatting Object tags are outputted. - * The default value is false. - * @return true if the output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public boolean isUseFO() //@D1A - { - return useFO_; - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS elementListeners = new Vector(); - } - - - /** - * Removes an HTMLListItem item from the HTMLList. - * @param item The HTMLTagElement. - **/ - public void removeListItem(HTMLListItem item) - { - //@C1D - - if (item == null) - throw new NullPointerException("item"); - - if (listItems_.removeElement(item)) - fireElementEvent(ElementEvent.ELEMENT_REMOVED); - } - - - /** - * Removes an HTML list from the HTMLList. - * @param list The HTMLList. - **/ - public void removeList(HTMLList list) - { - //@C1D - - if (list == null) - throw new NullPointerException("list"); - - if (listItems_.removeElement(list)) - fireElementEvent(ElementEvent.ELEMENT_REMOVED); - } - - - /** - * Removes this ElementListener. - * - * @param listener The ElementListener. - **/ - public void removeListItemElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (elementListeners != null) elementListeners.removeElement(listener); //@CRS - } - - - - /** - * Sets whether the list is initialized to being compact. The compact attribute - * instructs the browser to reduce the space occupied by the list. - * @param compact true if initialized to compact; false otherwise. The default is false. - * - **/ - public void setCompact(boolean compact) - { - //@C1D - - boolean old = compact_; - - compact_ = compact; - - if (changes_ != null) changes_.firePropertyChange("compact", new Boolean(old), new Boolean(compact) ); //@CRS - } - - - /** - * Sets the direction of the text interpretation. - * @param dir The direction. One of the following constants - * defined in HTMLConstants: LTR or RTL. - * - * @see com.ibm.as400.util.html.HTMLConstants - * - **/ - public void setDirection(String dir) //$B1A - { - if (dir == null) - throw new NullPointerException("dir"); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - String old = dir_; - - dir_ = dir; - - if (changes_ != null) changes_.firePropertyChange("dir", old, dir ); //@CRS - } - - - - /** - * Sets the items in the HTMLList. - * @param itemList The list of items. - * - **/ - public void setItems(Vector itemList) - { - if (itemList == null) - throw new NullPointerException("items"); - - //@C1D - - Vector old = listItems_; - - listItems_ = itemList; - - if (changes_ != null) changes_.firePropertyChange("items", old, itemList ); //@CRS - } - - - /** - * Sets the language of the input tag. - * @param lang The language. Example language tags include: - * en and en-US. - * - **/ - public void setLanguage(String lang) //$B1A - { - if (lang == null) - throw new NullPointerException("lang"); - - String old = lang_; - - lang_ = lang; - - if (changes_ != null) changes_.firePropertyChange("lang", old, lang ); //@CRS - } - - - /** - * Sets if Formatting Object tags should be used. - * The default value is false. - * @param useFO - true if output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public void setUseFO(boolean useFO) //@D1A - { - boolean old = useFO_; - - useFO_ = useFO; - - if (changes_ != null) changes_.firePropertyChange("useFO", old, useFO ); - } - - /** - * Returns a String representation for the HTMLList tag. - * @return The tag. - **/ - public String toString() - { - return getTag(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLListBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLListBeanInfo.java deleted file mode 100644 index 85d276cff..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLListBeanInfo.java +++ /dev/null @@ -1,161 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - - -/** -* The HTMLListBeanInfo class provides bean information for the HTMLList class. -**/ -public class HTMLListBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = HTMLList.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = {changed}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor compact = new PropertyDescriptor("compact", beanClass, - "isCompact", "setCompact"); - compact.setBound(true); - compact.setConstrained(false); - compact.setDisplayName(loader_.getText("PROP_NAME_COMPACT")); - compact.setShortDescription(loader_.getText("PROP_HL_DESC_COMPACT")); - - PropertyDescriptor items = new PropertyDescriptor("items", beanClass, "getItems", "setItems"); - items.setBound(true); - items.setConstrained(false); - items.setDisplayName(loader_.getText("PROP_NAME_ITEMS")); - items.setShortDescription(loader_.getText("PROP_HL_DESC_ITEMS")); - - PropertyDescriptor lang = new PropertyDescriptor("lang", beanClass, "getLanguage", "setLanguage"); //$B3A - lang.setBound(true); //$B3A - lang.setConstrained(false); //$B3A - lang.setDisplayName(loader_.getText("PROP_NAME_LANGUAGE")); //$B3A - lang.setShortDescription(loader_.getText("PROP_DESC_LANGUAGE")); //$B3A - - PropertyDescriptor dir = new PropertyDescriptor("dir", beanClass, "getDirection", "setDirection"); //$B3A - dir.setBound(true); //$B3A - dir.setConstrained(false); //$B3A - dir.setDisplayName(loader_.getText("PROP_NAME_DIRECTION")); //$B3A - dir.setShortDescription(loader_.getText("PROP_DESC_DIRECTION")); //$B3A - - PropertyDescriptor useFO = new PropertyDescriptor("useFO", beanClass, "isUseFO", "setUseFO"); //@C1A - useFO.setBound(true); //@C1A - useFO.setConstrained(false); //@C1A - useFO.setDisplayName(loader_.getText("PROP_NAME_FORMATTING_OBJECT")); //@C1A - useFO.setShortDescription(loader_.getText("PROP_DESC_FORMATTING_OBJECT")); //@C1A - - properties_ = new PropertyDescriptor[] {compact, items, lang, dir, useFO}; //$B3C //@C1C - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLList is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLListItem.java b/cvsroot/src/com/ibm/as400/util/html/HTMLListItem.java deleted file mode 100644 index ad84db711..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLListItem.java +++ /dev/null @@ -1,309 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLListItem.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalArgumentException; - -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.io.*; - - -/** -* The HTMLListItem class represents items within a HTMLList. The items within the list -* can either be ordered or unordered. -* -*

    HTMLListItem objects generate the following events: -*

      -*
    • PropertyChangeEvent -*
    -*

    -**/ -abstract public class HTMLListItem extends HTMLTagAttributes implements java.io.Serializable // @Z1C -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - static final long serialVersionUID = -7139184882249518511L; - - - private HTMLTagElement listData_; // Data being added to the list item - - private String lang_; // The primary language used to display the tags contents. //$B1A - private String dir_; // The direction of the text interpretation. //$B1A - boolean useFO_ = false; // Indicates if XSL-FO tags are outputted. //@D1A - - private String type_; //The labeling scheme used to display the list item. //@D1A - - /** - * Returns the type attribute. - * @return The type attribute. - **/ - abstract String getTypeAttribute(); - - - /** - * Returns the type attribute. - * @return The type attribute. - **/ - abstract String getTypeAttributeFO(String itemType, int counter); - - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - //@CRS changes_ = new PropertyChangeSupport(this); - } - - - /** - * Returns the direction of the text interpretation. - * @return The direction of the text. - **/ - public String getDirection() //$B1A - { - return dir_; - } - - - /** - * Returns the direction attribute tag. - * @return The direction tag. - **/ - String getDirectionAttributeTag() //$B1A - { - if(useFO_) //@D1A - { //@D1A - if((dir_!=null) && (dir_.length()>0)) //@D1A - { //@D1A - if(dir_.equals(HTMLConstants.RTL)) //@D1A - return " writing-mode='rl'"; //@D1A - else //@D1A - return " writing-mode='lr'"; //@D1A - } //@D1A - else //@D1A - return ""; //@D1A - } //@D1A - else //@D1A - { //@D1A - //@C1D - - if ((dir_ != null) && (dir_.length() > 0)) - { - StringBuffer buffer = new StringBuffer(" dir=\""); - buffer.append(dir_); - buffer.append("\""); - - return buffer.toString(); - } - else - return ""; - } //@D1A - } - - - /** - * Returns the data in the HTMLListItem. - * @return The item data. - **/ - public HTMLTagElement getItemData() - { - return listData_; - } - - - /** - * Returns the language of the input element. - * @return The language of the input element. - **/ - public String getLanguage() //$B1A - { - return lang_; - } - - - /** - * Returns the language attribute tag. - * @return The language tag. - **/ - String getLanguageAttributeTag() //$B1A - { - //@C1D - - if ((lang_ != null) && (lang_.length() > 0)) - { - StringBuffer buffer = new StringBuffer(" lang=\""); - buffer.append(lang_); - buffer.append("\""); - - return buffer.toString(); - } - else - return ""; - } - - - /** - * Returns the tag for the HTML list item. - * @return The tag. - **/ - public String getTag() - { - //@C1D - - if(useFO_) //@D1A - return getFOTag(); //@D1A - - StringBuffer s = new StringBuffer(""); - s.append(listData_.getTag()); - s.append("

  • \n"); - - return s.toString(); - } - - - - /** - * Returns the tag for the XSL-FO list item. - * The language attribute is not supported in XSL-FO. - * @return The tag. - **/ - public String getFOTag() //@D1A - { - //Save current state of useFO_ - boolean useFO = useFO_; - - //Indicate Formatting Object tags are outputted. - setUseFO(true); - - StringBuffer s = new StringBuffer(""); - s.append(""); - s.append(listData_.getFOTag()); - s.append("\n"); - - //Set useFO_ to previous state. - setUseFO(useFO); - - return s.toString(); - } - - /** - * Returns if Formatting Object tags are outputted. - * The default value is false. - * @return true if the output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public boolean isUseFO() //@D1A - { - return useFO_; - } - - /** - * Sets the direction of the text interpretation. - * @param dir The direction. One of the following constants - * defined in HTMLConstants: LTR or RTL. - * - * @see com.ibm.as400.util.html.HTMLConstants - * - **/ - public void setDirection(String dir) //$B1A - { - if (dir == null) - throw new NullPointerException("dir"); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - String old = dir_; - - dir_ = dir; - - if (changes_ != null) changes_.firePropertyChange("dir", old, dir ); //@CRS - } - - - /** - * Sets the item data in the HTMLListItem. - * - * @param data The item data. - * - **/ - public void setItemData(HTMLTagElement data) - { - //@C1D - - if (data == null) - throw new NullPointerException("data"); - - HTMLTagElement old = listData_; - - listData_ = data; - - if (changes_ != null) changes_.firePropertyChange("data", old, data ); //@CRS - } - - - /** - * Sets the language of the input tag. - * @param lang The language. Example language tags include: - * en and en-US. - * - **/ - public void setLanguage(String lang) //$B1A - { - if (lang == null) - throw new NullPointerException("lang"); - - String old = lang_; - - lang_ = lang; - - if (changes_ != null) changes_.firePropertyChange("lang", old, lang ); //@CRS - } - - - /** - * Sets if Formatting Object tags should be used. - * The default value is false. - * @param useFO - true if output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public void setUseFO(boolean useFO) //@D1A - { - boolean old = useFO_; - - useFO_ = useFO; - - if (changes_ != null) changes_.firePropertyChange("useFO", old, useFO ); - } - - /** - * Returns a String representation for the HTMLList tag. - * @return The tag. - **/ - public String toString() - { - return getTag(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLListItemBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLListItemBeanInfo.java deleted file mode 100644 index 385a542a0..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLListItemBeanInfo.java +++ /dev/null @@ -1,155 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLListItemBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - - -/** -* The HTMLListItemBeanInfo class provides bean information for the HTMLListItem class. -**/ -public class HTMLListItemBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = HTMLListItem.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = {changed}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor items = new PropertyDescriptor("itemData", beanClass, "getItemData", "setItemData"); - items.setBound(true); - items.setConstrained(false); - items.setDisplayName(loader_.getText("PROP_NAME_ITEMDATA")); - items.setShortDescription(loader_.getText("PROP_HLI_DESC_ITEMDATA")); - - PropertyDescriptor lang = new PropertyDescriptor("lang", beanClass, "getLanguage", "setLanguage"); //$B3A - lang.setBound(true); //$B3A - lang.setConstrained(false); //$B3A - lang.setDisplayName(loader_.getText("PROP_NAME_LANGUAGE")); //$B3A - lang.setShortDescription(loader_.getText("PROP_DESC_LANGUAGE")); //$B3A - - PropertyDescriptor dir = new PropertyDescriptor("dir", beanClass, "getDirection", "setDirection"); //$B3A - dir.setBound(true); //$B3A - dir.setConstrained(false); //$B3A - dir.setDisplayName(loader_.getText("PROP_NAME_DIRECTION")); //$B3A - dir.setShortDescription(loader_.getText("PROP_DESC_DIRECTION")); //$B3A - - PropertyDescriptor useFO = new PropertyDescriptor("useFO", beanClass, "isUseFO", "setUseFO"); //@C1A - useFO.setBound(true); //@C1A - useFO.setConstrained(false); //@C1A - useFO.setDisplayName(loader_.getText("PROP_NAME_FORMATTING_OBJECT")); //@C1A - useFO.setShortDescription(loader_.getText("PROP_DESC_FORMATTING_OBJECT")); //@C1A - - properties_ = new PropertyDescriptor[] {items, lang, dir, useFO}; //$B3C //@C1C - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLListItem is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLMeta.java b/cvsroot/src/com/ibm/as400/util/html/HTMLMeta.java deleted file mode 100644 index 7ba37c396..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLMeta.java +++ /dev/null @@ -1,406 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLMeta.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; - -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; - - -/** -* The HTMLMeta class represents meta-information used within an HTMLHead tag. -* This meta information can be used in identifying, indexing, and defining -* information within the HTML document. -*

    -* This example creates an HTMLMeta tag: -*

    -*  // Create an HTMLMeta.
    -*  HTMLMeta meta = new HTMLMeta("Expires", "Mon, 01 Jun 2000 12:00:00 CST");
    -*  System.out.println(header);
    -*  
    -*

    -* Here is the output of the HTMLMeta tag:
    -*

    -*  <meta http-equiv="Expires" content="Mon, 01 Jun 2000 12:00:00 CST" />
    -*  
    -* -*

    HTMLMeta objects generate the following events: -*

      -*
    • PropertyChangeEvent -*
    -**/ -public class HTMLMeta extends HTMLTagAttributes implements java.io.Serializable // @Z1C -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - static final long serialVersionUID = -7017914111994779942L; - - private String content_; - private String name_; - private String HttpEquiv_; - private String url_; - - private String lang_; // The primary language used to display the tags contents. - private String dir_; // The direction of the text interpretation. - - - - /** - * Constructs a default HTMLMeta object. - **/ - public HTMLMeta() - { - super(); - } - - - /** - * Constructs an HTMLMeta object with the specified meta HTTP-EQUIV and content. - * - * @param HttpEquiv The HTTP-EQUIV meta information. - * @param content The value of a named property. - **/ - public HTMLMeta(String HttpEquiv, String content) - { - super(); - - setHttpEquiv(HttpEquiv); - setContent(content); - } - - - /** - * Constructs an HTMLMeta object with the specified meta HTTP-EQUIV, content, and URL. - * - * @param HttpEquiv The HTTP-EQUIV meta information. - * @param content The value of a named property. - * @param url The URL to reload after the time specified in the content attribute. - **/ - public HTMLMeta(String HttpEquiv, String content, String url) - { - super(); - - setHttpEquiv(HttpEquiv); - setContent(content); - setUrl(url); - } - - - - /** - * Returns the content of the HTMLMeta tag. - * @return The value of a named property. - **/ - public String getContent() - { - return content_; - } - - - /** - * Returns the direction of the text interpretation. - * @return The direction of the text. - **/ - public String getDirection() - { - return dir_; - } - - - /** - * Returns the direction attribute tag. - * @return The direction tag. - **/ - String getDirectionAttributeTag() - { - //@C1D - - if ((dir_ != null) && (dir_.length() > 0)) - return " dir=\"" + dir_ + "\""; - else - return ""; - } - - - /** - * Returns the HTTP-EQUIV of the meta tag. - * @return The HTTP-EQUIV meta information. - **/ - public String getHttpEquiv() - { - return HttpEquiv_; - } - - - /** - * Returns the language of the meta tag. - * @return The language of the meta tag. - **/ - public String getLanguage() - { - return lang_; - } - - - /** - * Returns the language attribute tag. - * @return The language tag. - **/ - String getLanguageAttributeTag() - { - //@C1D - - if ((lang_ != null) && (lang_.length() > 0)) - return " lang=\"" + lang_ + "\""; - else - return ""; - } - - - /** - * Returns the name of the meta tag. - * @return The name of a property. - **/ - public String getName() - { - return name_; - } - - - /** - * Returns the URL of the meta tag. - * @return The URL to reload. - **/ - public String getUrl() - { - return url_; - } - - - /** - * Returns the tag for the HTML heading. - * @return The tag. - **/ - public String getTag() - { - //@C1D - - if (content_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting meta content."); - throw new ExtendedIllegalStateException( - "content", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - if (name_ == null && HttpEquiv_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting name or http-equiv attributes."); - throw new ExtendedIllegalStateException("name/HttpEquiv", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - - StringBuffer s = new StringBuffer("\n"); - - return s.toString(); - } - - - /** - * Returns a comment tag. - * This method should not be called. There is no XSL-FO support for this class. - * @return The comment tag. - **/ - public String getFOTag() //@D1A - { - Trace.log(Trace.ERROR, "Attempting to getFOTag() for an object that doesn't support it."); - return ""; - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - //@CRS changes_ = new PropertyChangeSupport(this); - } - - - - /** - * Sets the content of the meta information. - * @param content The value for a named property. - **/ - public void setContent(String content) - { - if (content == null) - throw new NullPointerException("content"); - - String old = content_; - - content_ = content; - - if (changes_ != null) changes_.firePropertyChange("content", old, content ); //@CRS - } - - - /** - * Sets the direction of the text interpretation. - * @param dir The direction. One of the following constants - * defined in HTMLConstants: LTR or RTL. - * - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setDirection(String dir) - { - if (dir == null) - throw new NullPointerException("dir"); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - { - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - String old = dir_; - - dir_ = dir; - - if (changes_ != null) changes_.firePropertyChange("dir", old, dir ); //@CRS - } - - - /** - * Sets the HTTP-EQUIV of the meta tag. - * - * @param HttpEquiv The HTTP-EQUIV meta information. - **/ - public void setHttpEquiv(String HttpEquiv) - { - if (HttpEquiv == null) - throw new NullPointerException("HttpEquiv"); - - String old = HttpEquiv_; - - HttpEquiv_ = HttpEquiv; - - if (changes_ != null) changes_.firePropertyChange("HttpEquiv", old, HttpEquiv ); //@CRS - } - - - /** - * Sets the language of the meta tag. - * - * @param lang The language. Example language tags include: - * en and en-US. - **/ - public void setLanguage(String lang) - { - if (lang == null) - throw new NullPointerException("lang"); - - String old = lang_; - - lang_ = lang; - - if (changes_ != null) changes_.firePropertyChange("lang", old, lang ); //@CRS - } - - - /** - * Sets the name of the meta tag. If the name is - * not set, it is assumed to be the same as the value of - * the HTTP-EQUIV. - * - * @param name The name of a property. - **/ - public void setName(String name) - { - if (name == null) - throw new NullPointerException("name"); - - String old = name_; - - name_ = name; - - if (changes_ != null) changes_.firePropertyChange("name", old, name ); //@CRS - } - - - /** - * Sets the URL to reload after the time specified - * in the content attribute. - * - * @param url The URL to reload. - **/ - public void setUrl(String url) - { - if (url == null) - throw new NullPointerException("url"); - - String old = url_; - - url_ = url; - - if (changes_ != null) changes_.firePropertyChange("url", old, url ); //@CRS - } - - - /** - * Returns a String representation for the HTMLMeta tag. - * @return The tag. - **/ - public String toString() - { - return getTag(); - } -} - diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLMeta16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLMeta16.gif deleted file mode 100644 index 8873ec077..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLMeta16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLMeta32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLMeta32.gif deleted file mode 100644 index fcca02b79..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLMeta32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLMetaBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLMetaBeanInfo.java deleted file mode 100644 index 7f87ed27a..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLMetaBeanInfo.java +++ /dev/null @@ -1,192 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLMetaBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; - - -/** -* The HTMLMetaBeanInfo class provides bean information for the HTMLMeta class. -**/ -public class HTMLMetaBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = HTMLMeta.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = {changed}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor name = new PropertyDescriptor("name", beanClass, - "getName", "setName"); - name.setBound(true); - name.setConstrained(false); - name.setDisplayName(loader_.getText("PROP_NAME_NAME")); - name.setShortDescription(loader_.getText("PROP_HM_DESC_NAME")); - - PropertyDescriptor HttpEquiv = new PropertyDescriptor("HTTP-EQUIV", beanClass, - "getHttpEquiv", "setHttpEquiv"); - HttpEquiv.setBound(true); - HttpEquiv.setConstrained(false); - HttpEquiv.setDisplayName(loader_.getText("PROP_NAME_HTTPEQUIV")); - HttpEquiv.setShortDescription(loader_.getText("PROP_HM_DESC_HTTPEQUIV")); - - PropertyDescriptor content = new PropertyDescriptor("content", beanClass, - "getContent", "setContent"); - content.setBound(true); - content.setConstrained(false); - content.setDisplayName(loader_.getText("PROP_NAME_CONTENT")); - content.setShortDescription(loader_.getText("PROP_HM_DESC_CONTENT")); - - PropertyDescriptor url = new PropertyDescriptor("url", beanClass, - "getUrl", "setUrl"); - url.setBound(true); - url.setConstrained(false); - url.setDisplayName(loader_.getText("PROP_NAME_URL")); - url.setShortDescription(loader_.getText("PROP_HM_DESC_URL")); - - PropertyDescriptor lang = new PropertyDescriptor("lang", beanClass, "getLanguage", "setLanguage"); - lang.setBound(true); - lang.setConstrained(false); - lang.setDisplayName(loader_.getText("PROP_NAME_LANGUAGE")); - lang.setShortDescription(loader_.getText("PROP_DESC_LANGUAGE")); - - PropertyDescriptor dir = new PropertyDescriptor("dir", beanClass, "getDirection", "setDirection"); - dir.setBound(true); - dir.setConstrained(false); - dir.setDisplayName(loader_.getText("PROP_NAME_DIRECTION")); - dir.setShortDescription(loader_.getText("PROP_DESC_DIRECTION")); - - - properties_ = new PropertyDescriptor[] {name, HttpEquiv, content, url, lang, dir}; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLMeta is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLMeta16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLMeta32.gif"); - break; - } - return image; - } - - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLParameter.java b/cvsroot/src/com/ibm/as400/util/html/HTMLParameter.java deleted file mode 100644 index a02687990..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLParameter.java +++ /dev/null @@ -1,222 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLParameter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; - -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; - - -/** -* The HTMLParameter class represents a parameter within an HTML servlet tag. -* -*

    -* This example creates a HTMLParameter tag: -*

    -*  // Create an HTMLServletParameter.
    -*  HTMLParameter parm = new HTMLParameter("age", "21");
    -*  System.out.println(parm);
    -*  
    -*

    -* Here is the output of the HTMLParameter tag:
    -*

    -*  <param name="age" value="21">
    -*  
    -* -*

    HTMLParameter objects generate the following events: -*

      -*
    • PropertyChangeEvent -*
    -**/ -public class HTMLParameter extends HTMLTagAttributes implements java.io.Serializable // @Z1C -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - static final long serialVersionUID = 6620025554753779980L; - - - private String name_; - private String value_; - - - - /** - * Constructs a default HTMLParameter object. - **/ - public HTMLParameter() - { - super(); - - } - - - /** - * Constructs an HTMLParameter object with the specified name and value. - * - * @param name The parameter name. - * @param value The parameter value. - **/ - public HTMLParameter(String name, String value) - { - super(); - - setName(name); - setValue(value); - } - - - - /** - * Returns the name of the parameter. - * @return The name. - **/ - public String getName() - { - return name_; - } - - - /** - * Returns the value of the parameter. - * @return The value. - **/ - public String getValue() - { - return value_; - } - - - /** - * Returns a comment tag. - * This method should not be called. There is no XSL-FO support for this class. - * @return The comment tag. - **/ - public String getFOTag() //@C1A - { - Trace.log(Trace.ERROR, "Attempting to getFOTag() for an object that doesn't support it."); - return ""; - } - - /** - * Returns the tag for the HTML parameter. - * @return The tag. - **/ - public String getTag() - { - //@B1D - - if (name_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting HTML parameter name."); - throw new ExtendedIllegalStateException( - "name", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - if (value_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting HTML parameter value."); - throw new ExtendedIllegalStateException( - "value", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - StringBuffer s = new StringBuffer(""); - - s.append("\n"); - - return s.toString(); - } - - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - //@CRS changes_ = new PropertyChangeSupport(this); - } - - - - /** - * Sets the name of the parameter. - * - * @param name The name. - **/ - public void setName(String name) - { - if (name == null) - throw new NullPointerException("name"); - - if (name.length() == 0 ) - { - throw new ExtendedIllegalArgumentException("name", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - //@B1D - - String old = name_; - - name_ = name; - - if (changes_ != null) changes_.firePropertyChange("name", old, name ); //@CRS - - } - - - /** - * Set the value of the parameter. - * - * @param value The value. - **/ - public void setValue(String value) - { - if (value == null) - throw new NullPointerException("value"); - - if (value.length() == 0) - throw new ExtendedIllegalArgumentException("value", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - //@B1D - - String old = value_; - - value_ = value; - - if (changes_ != null) changes_.firePropertyChange("value", old, value ); //@CRS - } - - - /** - * Returns a String representation for the HTMLParameter tag. - * @return The tag. - **/ - public String toString() - { - return getTag(); - } -} - diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLParameter16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLParameter16.gif deleted file mode 100644 index e37376897..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLParameter16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLParameter32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLParameter32.gif deleted file mode 100644 index 09ef85376..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLParameter32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLParameterBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLParameterBeanInfo.java deleted file mode 100644 index 54b025345..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLParameterBeanInfo.java +++ /dev/null @@ -1,165 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLParameterBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - - -/** -* The HTMLParameterBeanInfo class provides bean information for the HTMLParameter class. -**/ -public class HTMLParameterBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = HTMLParameter.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = {changed}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor name = new PropertyDescriptor("name", beanClass, - "getName", "setName"); - name.setBound(true); - name.setConstrained(false); - name.setDisplayName(loader_.getText("PROP_NAME_NAME")); - name.setShortDescription(loader_.getText("PROP_HP_DESC_NAME")); - - PropertyDescriptor value = new PropertyDescriptor("value", beanClass, "getValue", "setValue"); - value.setBound(true); - value.setConstrained(false); - value.setDisplayName(loader_.getText("PROP_NAME_VALUE")); - value.setShortDescription(loader_.getText("PROP_HP_DESC_VALUE")); - - properties_ = new PropertyDescriptor[] {name, value}; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLParameter is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLParameter16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLParameter32.gif"); - break; - } - return image; - } - - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLServlet.java b/cvsroot/src/com/ibm/as400/util/html/HTMLServlet.java deleted file mode 100644 index a400a2c31..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLServlet.java +++ /dev/null @@ -1,437 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLServlet.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.ExtendedIllegalArgumentException; - -import java.util.Vector; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; - - -/** -* The HTMLServlet class represents a server-side include in an HTML page. -*

    -* This example creates a HTMLServlet tag: -*

    -*  // Create an HTMLServlet.
    -*  HTMLServlet servlet = new HTMLServlet("myServlet", "http://server:port/dir");
    -*  

    -* // Create a parameter, then add it to the servlet. -* HTMLParameter param = new HTMLParameter("parm1", "value1"); -* servlet.addParameter(param); -*

    -* // Create and add second parameter -* HTMLParameter param2 = servlet.add("parm2", "value2"); -* System.out.println(servlet); -*

    -*

    -* Here is the output of the HTMLServlet tag:
    -*

    -*  <servlet name="myServlet" codebase="http://server:port/dir">
    -*  <param name="parm1" value="value1">
    -*  <param name="parm2" value="value2">
    -*  If you see this text, the web server providing this page does not support the SERVLET tag.
    -*  </servlet>
    -*  
    -* -*

    HTMLServlet objects generate the following events: -*

      -*
    • ElementEvent - The events fired are: -*
        -*
      • elementAdded -*
      • elementRemoved -*
      -*
    • PropertyChangeEvent -*
    - -**/ -public class HTMLServlet extends HTMLTagAttributes implements java.io.Serializable // @Z1C -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - static final long serialVersionUID = -3782566892366981877L; - - - private String name_; - - // The alternate text will get displayed if the servlet does not appear in the browser. - private String text_ = loader_.getText("PROP_DESC_SERVLET_ALTTEXT"); - private String location_; - - private Vector list_; // The list of servlet parameters. - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - - transient private Vector elementListeners; // The list of element listeners @CRS - - - - /** - * Constructs a default HTMLServlet object. - **/ - public HTMLServlet() - { - super(); - list_ = new Vector(); - - } - - - /** - * Constructs an HTMLServlet object with the specified servlet name. - * - * @param name The servlet name. - **/ - public HTMLServlet(String name) - { - super(); - - setName(name); - - list_ = new Vector(); - } - - - /** - * Constructs an HTMLServlet object with the specified servlet name and location. - * - * @param name The servlet name. - * @param location The servlet location (http://server:port/dir). - **/ - public HTMLServlet(String name, String location) - { - super(); - - setName(name); - setLocation(location); - - list_ = new Vector(); - - } - - - /** - * Adds an HTMLparameter to the servlet tag. - * - * @param param The parameter. - **/ - public void addParameter(HTMLParameter param) //$A2C - { - //@B1D - - if (param == null) - throw new NullPointerException("param"); - - // add parameter to the list - list_.addElement(param); - - fireElementEvent(ElementEvent.ELEMENT_ADDED); - } - - - /** - * Adds an HTMLParameter to the servlet. - * - * @param name The parameter name. - * @param value The parameter value. - * - * @return A HTMLParameter object. - **/ - public HTMLParameter addParameter(String name, String value) //$A2C - { - //@B1D - - if (name == null) - throw new NullPointerException("name"); - if (value == null) - throw new NullPointerException("value"); - - //Create the HTMLParameter from the values passed in - HTMLParameter param = new HTMLParameter(name,value); - - // Add the HTMLParameter to the group. - list_.addElement(param); - - fireElementEvent(ElementEvent.ELEMENT_ADDED); - - return param; - } - - - /** - * Adds an addElementListener. - * The specified addElementListeners elementAdded method will - * be called each time a HTMLParameter is added to the group. - * The addElementListener object is added to a list of addElementListeners - * managed by this HTMLServlet. It can be removed with removeElementListener. - * - * @see #removeElementListener - * - * @param listener The ElementListener. - **/ - public void addElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (elementListeners == null) elementListeners = new Vector(); //@CRS - elementListeners.addElement(listener); - } - - - - - /** - * Fires the element event. - **/ - private void fireElementEvent(int evt) - { - if (elementListeners == null) return; - Vector targets; - targets = (Vector) elementListeners.clone(); - ElementEvent elementEvt = new ElementEvent(this, evt); - for (int i = 0; i < targets.size(); i++) - { - ElementListener target = (ElementListener)targets.elementAt(i); - if (evt == ElementEvent.ELEMENT_ADDED) - target.elementAdded(elementEvt); - else if (evt == ElementEvent.ELEMENT_REMOVED) - target.elementRemoved(elementEvt); - } - } - - - /** - * Returns the location of the servlet. - * @return The location. - **/ - public String getLocation() - { - return location_; - } - - - /** - * Returns the name of the servlet. - * @return The name. - **/ - public String getName() - { - return name_; - } - - - /** - * Returns the alternate text of the servlet. - * @return The text. - **/ - public String getText() - { - return text_; - } - - - /** - * Returns a comment tag. - * This method should not be called. There is no XSL-FO support for this class. - * @return The comment tag. - **/ - public String getFOTag() //@C1A - { - Trace.log(Trace.ERROR, "Attempting to getFOTag() for an object that doesn't support it."); - return ""; - } - - /** - * Returns the tag for the HTML servlet. - * @return The tag. - **/ - public String getTag() - { - //@B1D - - if (name_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting servlet name."); - throw new ExtendedIllegalStateException( - "name", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - } - - StringBuffer s = new StringBuffer("\n"); - } - else - { - s.append(getAttributeString()); // @Z1A - s.append(">\n"); - } - - // add parameters to the servlet tag - for (int i=0; i< list_.size(); i++) - { - HTMLParameter p = (HTMLParameter)list_.elementAt(i); //$A2C - - s.append(p.getTag()); - } - - s.append(getText() + "\n"); - - s.append("\n"); - - return s.toString(); - } - - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS elementListeners = new Vector(); - } - - - /** - * Removes an HTMLParameter from the servlet tag. - * @param param The parameter. - **/ - public void removeParameter(HTMLParameter param) //$A2C - { - if (param == null) - throw new NullPointerException("param"); - - //@B1D - - if (list_.removeElement(param)) - fireElementEvent(ElementEvent.ELEMENT_REMOVED); - } - - - /** - * Removes this ElementListener from the internal list. - * If the ElementListener is not on the list, nothing is done. - * - * @see #addElementListener - * - * @param listener The ElementListener. - **/ - public void removeElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (elementListeners != null) elementListeners.removeElement(listener); //@CRS - } - - - - /** - * Sets the location for the servlet source. It can refer to a remote location from which - * the servlet should be loaded. The default location is assumed to be local. - * - * @param location The location. - **/ - public void setLocation(String location) - { - if (location == null) - throw new NullPointerException("location"); - - if (location.length() == 0 ) - { - throw new ExtendedIllegalArgumentException("location", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - //@B1D - - String old = location_; - - location_ = location; - - if (changes_ != null) changes_.firePropertyChange("location", old, location ); //@CRS - - } - - - /** - * Sets the class name of the servlet. - * - * @param name The name. - **/ - public void setName(String name) - { - if (name == null) - throw new NullPointerException("name"); - - if (name.length() == 0) - throw new ExtendedIllegalArgumentException("name", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - //@B1D - - String old = name_; - - name_ = name; - - if (changes_ != null) changes_.firePropertyChange("name", old, name ); //@CRS - } - - - /** - * Set the alternate text for the servlet, which will be displayed if - * the web server does not support the servlet tag. - * - * @param text The alternate text. - **/ - public void setText(String text) - { - if (text == null) - throw new NullPointerException("text"); - - if (text.length() == 0) - throw new ExtendedIllegalArgumentException("text", - ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - //@B1D - - String old = text_; - - text_ = text; - - if (changes_ != null) changes_.firePropertyChange("text", old, text ); //@CRS - } - - - /** - * Returns a String representation for the HTMLServlet tag. - * @return The tag. - **/ - public String toString() - { - return getTag(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLServlet16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLServlet16.gif deleted file mode 100644 index 0e2671e33..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLServlet16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLServlet32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLServlet32.gif deleted file mode 100644 index 2c02b93ac..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLServlet32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLServletBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLServletBeanInfo.java deleted file mode 100644 index 4fa3a9576..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLServletBeanInfo.java +++ /dev/null @@ -1,173 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLServletBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - - -/** -* The HTMLServletBeanInfo class provides bean information for the HTMLServlet class. -**/ -public class HTMLServletBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = HTMLServlet.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = {changed}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor location = new PropertyDescriptor("location", beanClass, - "getLocation", "setLocation"); - location.setBound(true); - location.setConstrained(false); - location.setDisplayName(loader_.getText("PROP_NAME_LOCATION")); - location.setShortDescription(loader_.getText("PROP_HS_DESC_LOCATION")); - - PropertyDescriptor name = new PropertyDescriptor("name", beanClass, "getName", "setName"); - name.setBound(true); - name.setConstrained(false); - name.setDisplayName(loader_.getText("PROP_NAME_NAME")); - name.setShortDescription(loader_.getText("PROP_HS_DESC_NAME")); - - PropertyDescriptor text = new PropertyDescriptor("text", beanClass, "getText", "setText"); - text.setBound(true); - text.setConstrained(false); - text.setDisplayName(loader_.getText("PROP_NAME_TEXT")); - text.setShortDescription(loader_.getText("PROP_HS_DESC_TEXT")); - - - properties_ = new PropertyDescriptor[] {location, name, text}; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLServlet is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLServlet16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLServlet32.gif"); - break; - } - return image; - } - - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTable.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTable.java deleted file mode 100644 index 578c513f6..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTable.java +++ /dev/null @@ -1,1503 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTable.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.util.Vector; -import java.io.Serializable; - -/** -* The HTMLTable class represents an HTML table tag. -* -*

    This example creates an HTMLTable object and sets its attributes. -* -*

    -*  HTMLTable table = new HTMLTable();
    -*  table.setAlignment(HTMLTable.CENTER);
    -*  table.setHeaderInUse(false); 
    -*  table.setBorderWidth(1);
    -*  table.setCellSpacing(2);
    -*  table.setCellPadding(2);
    -*  // Add the rows to the table (Assume that the HTMLTableRow objects are already created).
    -*  table.addRow(row1);
    -*  table.addRow(row2);
    -*  table.addRow(row3);
    -*  System.out.println(table.getTag());
    -*  
    -* -*

    Here is the output of the table tag: -*

    -*  <table border="1" align="center" cellspacing="2" cellpadding="2">
    -*  <tr>
    -*  <td>row1data1</td>
    -*  <td>row1data2</td>
    -*  </tr>
    -*  <tr>
    -*  <td>row2data1</td>
    -*  <td>row2data2</td>
    -*  </tr>
    -*  <tr>
    -*  <td>row3data1</td>
    -*  <td>row3data2</td>
    -*  </tr>
    -*  </table>
    -*  
    -* -*

    -* The output generated by calling getFOTag() looks like the following: -*

    -* <fo:block text-align='center'> -* <fo:table> -* <fo:table-column column-width='3pt'/> -* <fo:table-column column-width='3pt'/> -* <fo:table-column column-width='3pt'/> -* <fo:table-body> -* <fo:table-row> -* <fo:table-cell border-style='solid' border-width='1px' padding='2px'><fo:block-container> -* <fo:block>row1data1</fo:block> -* </fo:block-container> -* </fo:table-cell> -* <fo:table-cell border-style='solid' border-width='1px' padding='2px'><fo:block-container> -* <fo:block>row1data2</fo:block> -* </fo:block-container> -* </fo:table-cell> -* </fo:table-row> -* <fo:table-row> -* <fo:table-cell border-style='solid' border-width='1px' padding='2px'><fo:block-container> -* <fo:block>row2data1</fo:block> -* </fo:block-container> -* </fo:table-cell> -* <fo:table-cell border-style='solid' border-width='1px' padding='2px'><fo:block-container> -* <fo:block>row2data2</fo:block> -* </fo:block-container> -* </fo:table-cell> -* </fo:table-row> -* <fo:table-row> -* <fo:table-cell border-style='solid' border-width='1px' padding='2px'><fo:block-container> -* <fo:block>row3data1</fo:block> -* </fo:block-container> -* </fo:table-cell> -* <fo:table-cell border-style='solid' border-width='1px' padding='2px'><fo:block-container> -* <fo:block>row3data2</fo:block> -* </fo:block-container> -* </fo:table-cell> -* </fo:table-row> -* </fo:table-body> -* </fo:table> -* </fo:block> -*
    -* -* -*

    HTMLTable objects generate the following events: -*

      -*
    • ElementEvent - The events fired are: -*
        -*
      • elementAdded -*
      • elementChanged -*
      • elementRemoved -*
      -*
    • PropertyChangeEvent -*
    • VetoableChangeEvent -*
    -* -* @see com.ibm.as400.util.html.HTMLTableRow -* @see com.ibm.as400.util.html.HTMLTableCell -* @see com.ibm.as400.util.html.HTMLTableHeader -* @see com.ibm.as400.util.html.HTMLTableCaption -**/ -public class HTMLTable extends HTMLTagAttributes implements HTMLConstants, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - static final long serialVersionUID = 4552974069573452181L; - - private Vector rows_; // The table rows. - private HTMLTableCaption caption_; // The table caption. - private Vector headerTag_; // The table header. - - private String alignment_; // The table horizontal alignment. - private int borderWidth_ = 0; // The table border. - private int cellPadding_ = -1; // The global table cell padding. // @C1C - private int cellSpacing_ = -1; // The global table cell spacing. // @C1C - private int width_ = 0; // The table width. - - private boolean headerInUse_ = true; // Indicates if the column headers are used. - private boolean widthPercent_ = false; // Indicates if the table width is in percent. - - private String lang_; // The primary language used to display the tags contents. //$B1A - private String dir_; // The direction of the text interpretation. //$B1A - private boolean useFO_ = false; // Indicates if XSL-FO tags are outputted. //@D1A - - transient private Vector rowListeners_; // The list of row listeners. @CRS - transient private VetoableChangeSupport vetos_; //@CRS - - /** - * Constructs a default HTMLTable object. - **/ - public HTMLTable() - { - rows_ = new Vector(); - - } - - /** - * Constructs an HTMLTable object with the specified rows. - * @param rows An array of HTMLTableRow objects. - **/ - public HTMLTable(HTMLTableRow[] rows) - { - this(); - - if (rows == null) - throw new NullPointerException("rows"); - - // Add the rows. - for (int i=0; i < rows.length; i++) - addRow(rows[i]); - } - - /** - * Adds a column to the end of the table. - * @param column An array of HTMLTableCell objects containing the data. - **/ - public void addColumn(HTMLTableCell[] column) - { - // Validate the column parameter. - if (column == null) - throw new NullPointerException("column"); - - HTMLTableRow row; - int size = rows_.size(); - - synchronized (rows_) - { - // Add new rows to an empty table. - if (size == 0) - { - for (int i=0; i< column.length; i++) - { - row = new HTMLTableRow(); - row.addColumn(column[i]); - rows_.addElement(row); - } - } - // Validate the column length. - else if (column.length != size) - { - throw new ExtendedIllegalArgumentException("column", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - // Add the columns. - else - { - for (int i=0; i< size; i++) - { - row = (HTMLTableRow)rows_.elementAt(i); - row.addColumn(column[i]); - } - } - } - } - - /** - * Adds a column header to the end of the table header. - * @param header The column header. - **/ - public void addColumnHeader(String header) - { - addColumnHeader(new HTMLTableHeader(new HTMLText(header))); - } - - /** - * Adds a column header to the end of the table header. - * @param header The column header. - **/ - public void addColumnHeader(HTMLTableHeader header) - { - if (header == null) - throw new NullPointerException("header"); - - // Verify that the header's HTMLTagElement is set. - if (header.getElement() == null) - { - Trace.log(Trace.ERROR, "The HTMLTableHeader's element attribute is invalid."); - throw new ExtendedIllegalArgumentException("header", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - if (headerTag_ == null) - headerTag_ = new Vector(); - - headerTag_.addElement(header); - } - - /** - * Adds a row to the end of the table. - * @param row An HTMLTableRow object containing the row data. - **/ - public void addRow(HTMLTableRow row) // @B2C - { - //@C2D - - if (row == null) - throw new NullPointerException("row"); - - rows_.addElement(row); - fireAdded(); // Fire the row added event. - } - - - - /** - * Adds an ElementListener for the rows. - * The ElementListener object is added to an internal list of RowListeners; - * it can be removed with removeRowListener. - * @see #removeRowListener - * @param listener The ElementListener. - **/ - public void addRowListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (rowListeners_ == null) rowListeners_ = new Vector(); //@CRS - rowListeners_.addElement(listener); - } - - /** - * Adds the VetoableChangeListener. The specified VetoableChangeListener's vetoableChange - * method is called each time the value of any constrained property is changed. - * @see #removeVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); //@CRS - vetos_.addVetoableChangeListener(listener); - } - - /** - * Fires a ELEMENT_ADDED event. - **/ - private void fireAdded() - { - if (rowListeners_ == null) return; //@CRS - Vector targets = (Vector) rowListeners_.clone(); - ElementEvent event = new ElementEvent(this, ElementEvent.ELEMENT_ADDED); - for (int i=0; icolumnIndex. - * @param columnIndex The index of the column header (0-based). - * @return The table header tag. - **/ - public HTMLTableHeader getColumnHeader(int columnIndex) - { - if (columnIndex < 0 || columnIndex >= headerTag_.size()) - throw new ExtendedIllegalArgumentException("columnIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - return(HTMLTableHeader)headerTag_.elementAt(columnIndex); - } - - /** - * Returns the direction of the text interpretation. - * @return The direction of the text. - **/ - public String getDirection() //$B1A - { - return dir_; - } - - - /** - * Returns the direction attribute tag. - * @return The direction tag. - **/ - String getDirectionAttributeTag() //$B1A - { - //@C2D - if(useFO_) //@D1A - { //@D1A - if((dir_ != null) && (dir_.length()>0)) //@D1A - { //@D1A - if(dir_.equals(HTMLConstants.RTL)) //@D1A - return " writing-mode='rl'"; //@D1A - else //@D1A - return " writing-mode='lr'"; //@D1A - } //@D1A - else //@D1A - return ""; //@D1A - } //@D1A - else //@D1A - { //@D1A - //@C2D - - if ((dir_ != null) && (dir_.length() > 0)) - { - StringBuffer buffer = new StringBuffer(" dir=\""); - buffer.append(dir_); - buffer.append("\""); - - return buffer.toString(); - } - else - return ""; - } //@D1A - - } - - /** - * Returns the table end tag. - * @return The tag. - **/ - private String getEndTableTag() - { - if(!useFO_) //@D1A - return "\n"; - else //@D1A - return "\n"; - } - - /** - * Returns the table column header tags. - * @return The header tags or null if the header is not set. - **/ - public HTMLTableHeader[] getHeader() - { - if (headerTag_ == null) - return null; - else - { - HTMLTableHeader[] list = new HTMLTableHeader[headerTag_.size()]; - headerTag_.copyInto(list); - return list; - } - } - - /** - * Returns the HTML tag for the table column headers. - * @return The HTML table header tag or an empty String - * if the header is not set. - **/ - public String getHeaderTag() - { - if (headerTag_ == null) - return ""; - else - { - StringBuffer tag = new StringBuffer(); - if(!useFO_ ) //@D1A - tag.append("\n"); - else //@D1A - { //@D1A - //get the number of columns in the header, XSL-FO to pdf converter requires you specify column width for the columns - int size = headerTag_.size(); //@D1A - int column_width = 100/size; //@D1A - for (int i=0; i< size; i++) //@D1A - { - tag.append("\n"); //@D1A - } - tag.append("\n"); //@D1A - tag.append("\n"); //@D1A - } - - HTMLTableHeader colHeader; - int size = headerTag_.size(); - - for (int i=0; i< size; i++) - { - colHeader = (HTMLTableHeader)headerTag_.elementAt(i); - if( !useFO_ ) //@D1A - tag.append(colHeader.getTag()); - else //@D1A - { //@D1A - colHeader.setBorderWidth(borderWidth_); //@D1A - if(cellPadding_ > -1) //@D1A - colHeader.setCellPadding(cellPadding_); //@D1A - tag.append(colHeader.getFOTag()); //@D1A - } //@D1A - } - if(!useFO_ ) //@D1A - tag.append("\n"); - - else //@D1A - { //@D1A - tag.append("\n"); //@D1A - tag.append("\n"); //@D1A - } //@D1A - return tag.toString(); //@D1C - } - - } - - /** - * Returns the language of the caption. - * @return The language of the caption. - **/ - public String getLanguage() //$B1A - { - return lang_; - } - - - /** - * Returns the language attribute tag. - * @return The language tag. - **/ - String getLanguageAttributeTag() //$B1A - { - //@C2D - - if ((lang_ != null) && (lang_.length() > 0)) - { - StringBuffer buffer = new StringBuffer(" lang=\""); - buffer.append(lang_); - buffer.append("\""); - - return buffer.toString(); - } - else - return ""; - } - - /** - * Returns the number of rows in the table. - * @return The number of rows. - **/ - public int getRowCount() - { - return rows_.size(); - } - - /** - * Returns the HTMLTableRow object for the specified rowIndex. - * @param rowIndex The index of the table row (0-based). - * @return The table row object. - **/ - public HTMLTableRow getRow(int rowIndex) - { - if (rowIndex < 0 || rowIndex >= rows_.size()) - throw new ExtendedIllegalArgumentException("rowIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - return(HTMLTableRow)rows_.elementAt(rowIndex); - } - - /** - * Returns the start table tag. - * @return The tag. - **/ - private String getStartTableTag() - { - //@C2D - - StringBuffer tag = new StringBuffer(""); //@D1A - if( !useFO_ ) //@D1A - { //@D1A - tag.append(" 0) - { - tag.append(" border=\""); - tag.append(borderWidth_); - tag.append("\""); - } - if (cellPadding_ >= 0) // @C1C - { - tag.append(" cellpadding=\""); - tag.append(cellPadding_); - tag.append("\""); - } - if (cellSpacing_ >= 0) // @C1C - { - tag.append(" cellspacing=\""); - tag.append(cellSpacing_); - tag.append("\""); - } - if (width_ > 0) - { - tag.append(" width=\""); - tag.append(width_); - - if (widthPercent_) - tag.append("%"); - tag.append("\""); - } - - tag.append(getLanguageAttributeTag()); //$B1A - tag.append(getDirectionAttributeTag()); //$B1A - tag.append(getAttributeString()); // @Z1A - - tag.append(">\n"); - - if (caption_ != null) - tag.append(caption_.getTag()); - - } - else - { - //@D1A - tag.append("\n"); - if(caption_!= null) - tag.append(caption_.getFOTag()); - tag.append("\n"); - - } - - return tag.toString(); //@D1C - } - - /** - * Returns the HTML table tag. - * @return The tag. - **/ - public String getTag() - { - //@C2D - - if(useFO_) //@D1A - return getFOTag(); //@D1A - - StringBuffer tag = new StringBuffer(getStartTableTag()); - - // Add the column headers. - if (headerInUse_) - { - if (rows_.size() > 0) - { - // Verify that the header is set. - if (headerTag_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get the table tag before setting the table header."); - throw new ExtendedIllegalStateException("header", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - int hdrSize = headerTag_.size(); - - for (int i=0; i 0) - { - // Verify that the header is set. - if (headerTag_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get the XSL-FO table tag before setting the table header."); - throw new ExtendedIllegalStateException("header", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - int hdrSize = headerTag_.size(); - int size = rows_.size(); - for (int i=0; i\n"); - } - } - - tag.append("\n"); - size = rows_.size(); - for (int i=0; i< size; i++) - { - row = (HTMLTableRow)rows_.elementAt(i); - row.setBorderWidth(borderWidth_); - if(cellPadding_ > -1 ) - row.setCellPadding(cellPadding_); - tag.append(row.getFOTag()); - } - tag.append("\n"); //Add Closing xsl-fo table body tag - - tag.append(getEndTableTag()); - - //Set useFO_ to previous state. - setUseFO(useFO); - - return tag.toString(); //@D1C - } - - /** - * Returns the table width in pixels or percent. - * @return The table width. - * @see #isWidthInPercent - **/ - public int getWidth() - { - return width_; - } - - - - /** - * Indicates if the table column header should be used. - * @return true if column header should be used; false otherwise. - **/ - public boolean isHeaderInUse() - { - return headerInUse_; - } - - /** - * Indicates if the table width is in percent or pixels. - * @return true if percent, false if pixels. - * @see #getWidth - **/ - public boolean isWidthInPercent() - { - return widthPercent_; - } - - /** - * Returns if Formatting Object tags are outputted. - * The default value is false. - * @return true if the output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public boolean isUseFO() //@D1A - { - return useFO_; - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - - //@CRS rowListeners_ = new Vector(); - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS vetos_ = new VetoableChangeSupport(this); - } - - /** - * Removes all the rows from the table. - **/ - public void removeAllRows() - { - //@C2D - - rows_.removeAllElements(); - fireRemoved(); - } - - /** - * Removes a column from the table at the specified columnIndex. - * If the column header exists it is also removed. - * @param columnIndex The index of the column to be removed (0-based). - **/ - public void removeColumn(int columnIndex) - { - // Validate the columnIndex parameter. - if (rows_.size() == 0) - { - Trace.log(Trace.ERROR, "Attempting to remove a column before adding a row to the table."); - throw new ExtendedIllegalStateException("rows", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - HTMLTableRow row; - synchronized (rows_) - { - int size = rows_.size(); - for (int i=0; i< size; i++) - { - row = (HTMLTableRow)rows_.elementAt(i); - row.removeColumn( (HTMLTableCell)row.getColumn(columnIndex) ); - } - // Remove the column header. - if (headerTag_ != null && columnIndex < headerTag_.size()) - removeColumnHeader(columnIndex); - } - } - - /** - * Removes the column header at the specified columnIndex. - * @param columnIndex The index of the column header to be removed (0-based). - **/ - public void removeColumnHeader(int columnIndex) - { - // Verify that the column header list exists. - if (headerTag_ == null) - { - Trace.log(Trace.ERROR, "Attempting to remove a column header before adding the header list to the table."); - throw new ExtendedIllegalStateException("header", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - if (columnIndex < 0 || columnIndex >= headerTag_.size()) - throw new ExtendedIllegalArgumentException("columnIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - headerTag_.removeElementAt(columnIndex); - } - - /** - * Removes a column header from the table header. - * @param header The column header. - **/ - public void removeColumnHeader(HTMLTableHeader header) - { - // Verify that the column header list exists. - if (headerTag_ == null) - { - Trace.log(Trace.ERROR, "Attempting to remove a column header before adding the header list to the table."); - throw new ExtendedIllegalStateException("header", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - if (header == null) - throw new NullPointerException("header"); - - if (!headerTag_.removeElement(header)) - throw new ExtendedIllegalArgumentException("header", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - /** - * Removes the row from the table. - * @param row An HTMLTableRow object containing the row data. - **/ - public void removeRow(HTMLTableRow row) - { - //@C2D - - // Validate the row parameter. - if (row == null) - throw new NullPointerException("row"); - - // Verify the table is not empty. - if (rows_.size() == 0) - { - Trace.log(Trace.ERROR, "Attempting to remove a row when the table is empty."); - throw new ExtendedIllegalStateException("rows", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Remove the row and notify the listeners. - if (rows_.removeElement(row)) - fireRemoved(); - } - - /** - * Removes the row at the specified rowIndex. - * @param rowIndex The index of the row to be removed (0-based). - **/ - public void removeRow(int rowIndex) - { - //@C2D - - // Validate the rowIndex parameter. - if (rowIndex < 0 || rowIndex >= rows_.size()) - throw new ExtendedIllegalArgumentException("rowIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - // Remove the row and notify the listeners. - rows_.removeElementAt(rowIndex); - fireRemoved(); - } - - - - /** - * Removes this row ElementListener from the internal list. - * If the ElementListener is not on the list, nothing is done. - * @see #addRowListener - * @param listener The ElementListener. - **/ - public void removeRowListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (rowListeners_ != null) rowListeners_.removeElement(listener); //@CRS - } - - /** - * Removes the VetoableChangeListener from the internal list. - * If the VetoableChangeListener is not on the list, nothing is done. - * @see #addVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ != null) vetos_.removeVetoableChangeListener(listener); //@CRS - } - - /** - * Sets the table horizontal alignment. The default value is LEFT. - * @param alignment The table alignment. One of the following constants - * defined in HTMLConstants: LEFT, CENTER, or RIGHT. - * @exception PropertyVetoException If the change is vetoed. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setAlignment(String alignment) throws PropertyVetoException - { - if (alignment == null) - { - throw new NullPointerException("alignment"); - } - else if (alignment.equalsIgnoreCase(LEFT) || - alignment.equalsIgnoreCase(CENTER) || - alignment.equalsIgnoreCase(RIGHT)) - { - String old = alignment_; - if (vetos_ != null) vetos_.fireVetoableChange("alignment", old, alignment ); //@CRS - - alignment_ = alignment; - - if (changes_ != null) changes_.firePropertyChange("alignment", old, alignment ); //@CRS - } - else - { - throw new ExtendedIllegalArgumentException("alignment", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - /** - * Sets the border width in pixels. A value of zero indicates no border. - * The default value is zero. - * @param borderWidth The border width. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setBorderWidth(int borderWidth) throws PropertyVetoException - { - if (borderWidth < 0) - throw new ExtendedIllegalArgumentException("borderWidth", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - //@CRS Integer oldWidth = new Integer(borderWidth_); - //@CRS Integer newWidth = new Integer(borderWidth); - int oldWidth = borderWidth_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("borderWidth", new Integer(oldWidth), new Integer(borderWidth)); //@CRS - - borderWidth_ = borderWidth; - - if (changes_ != null) changes_.firePropertyChange("borderWidth", new Integer(oldWidth), new Integer(borderWidth)); //@CRS - } - - /** - * Sets the table caption. - * @param caption The table caption. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setCaption(String caption) throws PropertyVetoException - { - setCaption(new HTMLTableCaption(new HTMLText(caption))); - } - - /** - * Sets the table caption. - * @param caption An HTMLTableCaption object containing the table caption. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setCaption(HTMLTableCaption caption) throws PropertyVetoException - { - if (caption == null) - throw new NullPointerException("caption"); - - HTMLTableCaption old = caption_; - if (vetos_ != null) vetos_.fireVetoableChange("caption", old, caption ); //@CRS - - caption_ = caption; - - if (changes_ != null) changes_.firePropertyChange("caption", old, caption ); //@CRS - } - - /** - * Sets the global table cell padding. The cell padding is the spacing between - * data in a table cell and the border of the cell. - * The default value is -1 (browser default used). - * @param cellPadding The cell padding. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setCellPadding(int cellPadding) throws PropertyVetoException - { - if (cellPadding < -1) // @C1C - throw new ExtendedIllegalArgumentException("cellPadding", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - //@CRS Integer oldPadding = new Integer(cellPadding_); - //@CRS Integer newPadding = new Integer(cellPadding); - int oldPadding = cellPadding_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("cellPadding", new Integer(oldPadding), new Integer(cellPadding)); //@CRS - - cellPadding_ = cellPadding; - - if (changes_ != null) changes_.firePropertyChange("cellPadding", new Integer(oldPadding), new Integer(cellPadding)); //@CRS - } - - /** - * Sets the global table cell spacing. - * The cell spacing is the spacing between the cells. - * The default value is -1 (browser default used). - * @param cellSpacing The cell spacing. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setCellSpacing(int cellSpacing) throws PropertyVetoException - { - if (cellSpacing < -1) // @C1C - throw new ExtendedIllegalArgumentException("cellSpacing", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - //@CRS Integer oldSpacing = new Integer(cellSpacing_); - //@CRS Integer newSpacing = new Integer(cellSpacing); - int oldSpacing = cellSpacing_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("cellSpacing", new Integer(oldSpacing), new Integer(cellSpacing)); //@CRS - - cellSpacing_ = cellSpacing; - - if (changes_ != null) changes_.firePropertyChange("cellSpacing", new Integer(oldSpacing), new Integer(cellSpacing)); //@CRS - } - - /** - * Sets a column in the table at the specified columnIndex. - * @param column An array of HTMLTableCell objects containing the column data. - * @param columnIndex The index of the column (0-based). - **/ - public void setColumn(HTMLTableCell[] column, int columnIndex) - { - // Validate the column parameter. - if (column == null) - throw new NullPointerException("column"); - - int size = rows_.size(); - - // Add the rows if table is empty. - if (size == 0) - { - addColumn(column); - return; - } - else if (column.length != size) - { - throw new ExtendedIllegalArgumentException("column", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - // Validate the columnIndex parameter. - if (columnIndex < 0 || columnIndex > ((HTMLTableRow)rows_.elementAt(0)).getColumnCount()) - throw new ExtendedIllegalArgumentException("columnIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - // Update the table rows. - HTMLTableRow row; - synchronized (rows_) - { - for (int i=0; i< size; i++) - { - row = (HTMLTableRow)rows_.elementAt(i); - row.setColumn(column[i], columnIndex); - } - } - } - - /** - * Sets the table column header tag. - * @param header The table column header. - * @param columnIndex The index of the column to be changed (0-based). - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setColumnHeader(String header, int columnIndex) throws PropertyVetoException - { - setColumnHeader(new HTMLTableHeader(new HTMLText(header)), columnIndex); - } - - /** - * Sets the table column header tag at the specified columnIndex. - * @param header The table column header. - * @param columnIndex The index of the column to be changed (0-based). - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setColumnHeader(HTMLTableHeader header, int columnIndex) throws PropertyVetoException - { - // Validate the header parameter. - if (header == null) - throw new NullPointerException("header"); - - // Validate that the header tag exists. - if (headerTag_ == null) - { - if (columnIndex == 0) - { - addColumnHeader(header); - return; - } - else - { - Trace.log(Trace.ERROR, "Attempting to change a column header before adding a column header to the table."); - throw new ExtendedIllegalStateException("header", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - - // Verify that the header's HTMLTagElement is set. - if (header.getElement() == null) - { - Trace.log(Trace.ERROR, "The HTMLTableHeader's element attribute is invalid."); - throw new ExtendedIllegalArgumentException("header", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - // Validate the columnIndex parameter. - if (columnIndex < 0 || columnIndex > headerTag_.size()) - throw new ExtendedIllegalArgumentException("columnIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - else if (columnIndex == headerTag_.size()) - { - addColumnHeader(header); - return; - } - else - { - Vector old = headerTag_; - if (vetos_ != null) vetos_.fireVetoableChange("header", old, headerTag_); //@CRS - - headerTag_.setElementAt(header, columnIndex); - - if (changes_ != null) changes_.firePropertyChange("header", old, headerTag_); //@CRS - } - } - - /** - * Sets the direction of the text interpretation. - * @param dir The direction. One of the following constants - * defined in HTMLConstants: LTR or RTL. - * - * @see com.ibm.as400.util.html.HTMLConstants - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setDirection(String dir) //$B1A - throws PropertyVetoException - { - if (dir == null) - throw new NullPointerException("dir"); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - { - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - String old = dir_; - if (vetos_ != null) vetos_.fireVetoableChange("dir", old, dir ); //@CRS - - dir_ = dir; - - if (changes_ != null) changes_.firePropertyChange("dir", old, dir ); //@CRS - } - - /** - * Sets the table column headers. - * @param header The column headers. - * @exception PropertyVetoException If the change is vetoed. - * @see #setHeaderInUse - **/ - public void setHeader(HTMLTableHeader[] header) throws PropertyVetoException - { - if (header == null) - throw new NullPointerException("header"); - - // Verify that the header size matches the number of columns in a row. - if ((!rows_.isEmpty()) && header.length != ((HTMLTableRow)rows_.elementAt(0)).getColumnCount()) - throw new ExtendedIllegalArgumentException("header", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - Vector old = headerTag_; - if (vetos_ != null) vetos_.fireVetoableChange("header", old, header ); //@CRS - - headerTag_ = new Vector(); - for (int i=0; i< header.length; i++) - headerTag_.addElement(header[i]); - - if (changes_ != null) changes_.firePropertyChange("header", old, header ); //@CRS - } - - /** - * Sets the table column headers. - * @param header The column headers. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setHeader(String[] header) throws PropertyVetoException - { - if (header == null) - throw new NullPointerException("header"); - - // Create an array of HTMLTableHeader objects. - HTMLTableHeader[] tableHeader = new HTMLTableHeader[header.length]; - for (int column=0; column < header.length; column++) - tableHeader[column] = new HTMLTableHeader(new HTMLText(header[column])); - - setHeader(tableHeader); - } - - /** - * Sets if table column headers should be used. The default value is true. - * @param headerInUse true if the column headers should be used; false otherwise. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setHeaderInUse(boolean headerInUse) throws PropertyVetoException - { - //@CRS Boolean oldUse = new Boolean(headerInUse_); - //@CRS Boolean newUse = new Boolean(headerInUse); - boolean oldUse = headerInUse_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("useHeader", new Boolean(oldUse), new Boolean(headerInUse)); //@CRS - - headerInUse_ = headerInUse; - - if (changes_ != null) changes_.firePropertyChange("useHeader", new Boolean(oldUse), new Boolean(headerInUse)); //@CRS - } - - /** - * Sets the language of the caption. - * @param lang The language. Example language tags include: - * en and en-US. - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setLanguage(String lang) //$B1A - throws PropertyVetoException - { - if (lang == null) - throw new NullPointerException("lang"); - - String old = lang_; - if (vetos_ != null) vetos_.fireVetoableChange("lang", old, lang ); //@CRS - - lang_ = lang; - - if (changes_ != null) changes_.firePropertyChange("lang", old, lang ); //@CRS - } - - /** - * Sets the table row at the specified rowIndex. - * @param row An HTMLTableRow object with the row data. - * @param rowIndex The index of the row (0-based). - **/ - public void setRow(HTMLTableRow row, int rowIndex) - { - //@C2D - - // Validate the row parameter. - if (row == null) - throw new NullPointerException("row"); - - // Validate the rowIndex parameter. - if (rowIndex < 0 || rowIndex > rows_.size()) - throw new ExtendedIllegalArgumentException("rowIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - // Set the row. - if (rowIndex == rows_.size()) - addRow(row); - else - { - // Validate the number of columns in the row. - if (row.getColumnCount() != ((HTMLTableRow)rows_.elementAt(0)).getColumnCount()) - throw new ExtendedIllegalArgumentException("row", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - - rows_.setElementAt(row, rowIndex); - // Notify the listeners. - fireChanged(); - } - } - - /** - * Sets the table width. The default width unit is pixels. - * @param width The table width. - * @exception PropertyVetoException If the change is vetoed. - * @see #setWidthInPercent - **/ - public void setWidth(int width) throws PropertyVetoException - { - if (width < 0) - throw new ExtendedIllegalArgumentException("width", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - //@CRS Integer oldWidth = new Integer(width_); - //@CRS Integer newWidth = new Integer(width); - int oldWidth = width_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("width", new Integer(oldWidth), new Integer(width)); //@CRS - - width_ = width; - - if (changes_ != null) changes_.firePropertyChange("width", new Integer(oldWidth), new Integer(width)); //@CRS - } - - /** - * Sets the table width in percent or pixels. - * @param width The table width. - * @param widthInPercent true if width is specified as a percent; false if width is specified in pixels. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setWidth(int width, boolean widthInPercent) throws PropertyVetoException - { - int oldWidth = width_; - - setWidth(width); - - try - { - setWidthInPercent(widthInPercent); - } - catch (PropertyVetoException e) - { - // restore the original width. - width_ = oldWidth; - throw new PropertyVetoException("widthInPercent", e.getPropertyChangeEvent()); - } - } - - /** - * Sets the table width unit in percent or pixels. The default is false. - * @param widthInPercent true if width is specified as a percent; false if width is specified in pixels. - * @exception PropertyVetoException If the change is vetoed. - * @see #setWidth - **/ - public void setWidthInPercent(boolean widthInPercent) throws PropertyVetoException - { - //@CRS Boolean oldValue = new Boolean(widthPercent_); - //@CRS Boolean newValue = new Boolean(widthInPercent); - boolean oldValue = widthPercent_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("widthInPercent", new Boolean(oldValue), new Boolean(widthInPercent)); //@CRS - - widthPercent_ = widthInPercent; - - if (changes_ != null) changes_.firePropertyChange("widthInPercent", new Boolean(oldValue), new Boolean(widthInPercent)); //@CRS - } - - /** - * Sets if Formatting Object tags should be used. - * The default value is false. - * @param useFO - true if output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public void setUseFO(boolean useFO) //@D1A - { - boolean old = useFO_; - - useFO_ = useFO; - - if (changes_ != null) changes_.firePropertyChange("useFO", old, useFO ); - } - - /** - * Returns the HTML table tag. - * @return The tag. - **/ - public String toString() - { - return getTag(); - } -} - - - - - diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTable16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLTable16.gif deleted file mode 100644 index 5aba7e248..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLTable16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTable32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLTable32.gif deleted file mode 100644 index 777c1151f..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLTable32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTableBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTableBeanInfo.java deleted file mode 100644 index 54bb54a83..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTableBeanInfo.java +++ /dev/null @@ -1,239 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTableBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -* The HTMLTableBeanInfo class provides bean information for the HTMLTable class. -**/ -public class HTMLTableBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = HTMLTable.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor alignment = new PropertyDescriptor("alignment", beanClass, - "getAlignment", "setAlignment"); - alignment.setBound(true); - alignment.setConstrained(true); - alignment.setDisplayName(loader_.getText("PROP_NAME_ALIGNMENT")); - alignment.setShortDescription(loader_.getText("PROP_HTBL_DESC_ALIGNMENT")); - - PropertyDescriptor borderWidth = new PropertyDescriptor("borderWidth", beanClass, - "getBorderWidth", "setBorderWidth"); - borderWidth.setBound(true); - borderWidth.setConstrained(true); - borderWidth.setDisplayName(loader_.getText("PROP_NAME_BORDERWIDTH")); - borderWidth.setShortDescription(loader_.getText("PROP_DESC_BORDERWIDTH")); - - //PropertyDescriptor caption = new PropertyDescriptor("caption", beanClass, - // "getCaption", "setCaption"); - Class[] parameterList = { HTMLTableCaption.class }; - PropertyDescriptor caption = new PropertyDescriptor("caption", - beanClass.getMethod("getCaption", (java.lang.Class[]) null), beanClass.getMethod("setCaption", parameterList)); //@pdc cast for jdk1.5 - - caption.setBound(true); - caption.setConstrained(true); - caption.setDisplayName(loader_.getText("PROP_NAME_CAPTION")); - caption.setShortDescription(loader_.getText("PROP_DESC_CAPTION")); - - PropertyDescriptor cellPadding = new PropertyDescriptor("cellPadding", beanClass, - "getCellPadding", "setCellPadding"); - cellPadding.setBound(true); - cellPadding.setConstrained(true); - cellPadding.setDisplayName(loader_.getText("PROP_NAME_CELLPADDING")); - cellPadding.setShortDescription(loader_.getText("PROP_DESC_CELLPADDING")); - - PropertyDescriptor cellSpacing = new PropertyDescriptor("cellSpacing", beanClass, - "getCellSpacing", "setCellSpacing"); - cellSpacing.setBound(true); - cellSpacing.setConstrained(true); - cellSpacing.setDisplayName(loader_.getText("PROP_NAME_CELLSPACING")); - cellSpacing.setShortDescription(loader_.getText("PROP_DESC_CELLSPACING")); - - PropertyDescriptor header = new PropertyDescriptor("header", beanClass, - "getHeader", "setHeader"); - header.setBound(true); - header.setConstrained(true); - header.setDisplayName(loader_.getText("PROP_NAME_HEADER")); - header.setShortDescription(loader_.getText("PROP_DESC_HEADER")); - - PropertyDescriptor useHeader = new PropertyDescriptor("headerInUse", beanClass, - "isHeaderInUse", "setHeaderInUse"); - useHeader.setBound(true); - useHeader.setConstrained(true); - useHeader.setDisplayName(loader_.getText("PROP_NAME_HEADERINUSE")); - useHeader.setShortDescription(loader_.getText("PROP_DESC_HEADERINUSE")); - - PropertyDescriptor width = new PropertyDescriptor("width", beanClass, - "getWidth", "setWidth"); - width.setBound(true); - width.setConstrained(true); - width.setDisplayName(loader_.getText("PROP_NAME_WIDTH")); - width.setShortDescription(loader_.getText("PROP_HTBL_DESC_WIDTH")); - - PropertyDescriptor widthInPercent = new PropertyDescriptor("widthInPercent", beanClass, - "isWidthInPercent", "setWidthInPercent"); - widthInPercent.setBound(true); - widthInPercent.setConstrained(true); - widthInPercent.setDisplayName(loader_.getText("PROP_NAME_WPERCENT")); - widthInPercent.setShortDescription(loader_.getText("PROP_HTBL_DESC_WPERCENT")); - - PropertyDescriptor lang = new PropertyDescriptor("lang", beanClass, "getLanguage", "setLanguage"); //$B1A - lang.setBound(true); //$B1A - lang.setConstrained(true); //$B1A - lang.setDisplayName(loader_.getText("PROP_NAME_LANGUAGE")); //$B1A - lang.setShortDescription(loader_.getText("PROP_DESC_LANGUAGE")); //$B1A - - PropertyDescriptor dir = new PropertyDescriptor("dir", beanClass, "getDirection", "setDirection"); //$B1A - dir.setBound(true); //$B1A - dir.setConstrained(true); //$B1A - dir.setDisplayName(loader_.getText("PROP_NAME_DIRECTION")); //$B1A - dir.setShortDescription(loader_.getText("PROP_DESC_DIRECTION")); //$B1A - - PropertyDescriptor useFO = new PropertyDescriptor("useFO", beanClass, "isUseFO", "setUseFO"); //@C1A - useFO.setBound(true); //@C1A - useFO.setConstrained(false); //@C1A - useFO.setDisplayName(loader_.getText("PROP_NAME_FORMATTING_OBJECT")); //@C1A - useFO.setShortDescription(loader_.getText("PROP_DESC_FORMATTING_OBJECT")); //@C1A - - properties_ = new PropertyDescriptor[] { alignment, borderWidth, caption, cellPadding, cellSpacing, - header, useHeader, width, widthInPercent, lang, dir, useFO}; //$B1C //@C1A - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLTable is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLTable16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLTable32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTableCaption.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTableCaption.java deleted file mode 100644 index 033e3bc84..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTableCaption.java +++ /dev/null @@ -1,478 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTableCaption.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.io.Serializable; - -/** -* The HTMLTableCaption class represents an HTML Caption tag. -* -*

    This example creates an HTMLTableCaption object with an HTMLText object for the caption element. -*

    -*  // Create an HTMLText object for the caption text.
    -*  HTMLText captionText = new HTMLText("MY TABLE");
    -*  // Create the HTMLTableCaption object with the new HTMLText object.
    -*  HTMLTableCaption caption = new HTMLTableCaption(captionText);
    -*  // Display the tag.
    -*  System.out.println(caption.getTag());
    -*  
    -* -*

    Here is the output of the tag: -*

    -*  <caption>MY TABLE</caption>
    -*  
    -*

    -* The equivalent tag using XSL Formatting Objects is: -*

    -* <fo:block><fo:block>MY TABLE</fo:block> -* </fo:block> -*
    -* -*

    This example creates an HTMLTableCaption object with an HTMLHyperlink object for the caption element. -*

    -*  // Create an HTMLHyperlink object for the caption text.
    -*  HTMLHyperlink companyLink = new HTMLHyperlink("http://www.myCompany.com", "My Company");
    -*  // Create the HTMLTableCaption object with the new HTMLHyperlink object.
    -*  HTMLTableCaption caption = new HTMLTableCaption(companyLink);
    -*  caption.setAlignment(HTMLConstants.BOTTOM);
    -*  // Display the tag.
    -*  System.out.println(caption.getTag());
    -*  
    -* -*

    Here is the output of the tag: -*

    -*  <caption align="bottom"><a href="http://www.myCompany.com>My Company"</a></caption>
    -*  
    -* -*

    HTMLTableCaption objects generate the following events: -*

      -*
    • PropertyChangeEvent -*
    • VetoableChangeEvent -*
    -**/ -public class HTMLTableCaption extends HTMLTagAttributes implements HTMLConstants, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - static final long serialVersionUID = 8692666542126042315L; - - private HTMLTagElement element_; // The caption element. - private String align_; // The caption alignment. - - private String lang_; // The primary language used to display the tags contents. //$B1A - private String dir_; // The direction of the text interpretation. //$B1A - private boolean useFO_ = false; // Indicates if XSL-FO tags are outputted. //@D1A - - transient private VetoableChangeSupport vetos_; //@CRS - - /** - * Constructs a default HTMLTableCaption object. - **/ - public HTMLTableCaption() - { - - } - - /** - * Constructs an HTMLTableCaption object with the specified element. - * @param element An HTMLTagElement object. - **/ - public HTMLTableCaption(HTMLTagElement element) - { - if (element == null) - throw new NullPointerException("element"); - - element_ = element; - } - - - - /** - * Adds the VetoableChangeListener. The specified VetoableChangeListener's vetoableChange - * method is called each time the value of any constrained property is changed. - * @see #removeVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); //@CRS - vetos_.addVetoableChangeListener(listener); - } - /** - * Returns the caption alignment relative to the table. - * @return The caption alignment. One of the following constants - * defined in HTMLConstants: BOTTOM, LEFT, RIGHT, or TOP. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public String getAlignment() - { - return align_; - } - - - /** - * Returns the direction of the text interpretation. - * @return The direction of the text. - **/ - public String getDirection() //$B1A - { - return dir_; - } - - - /** - * Returns the direction attribute tag. - * @return The direction tag. - **/ - String getDirectionAttributeTag() //$B1A - { - - if(useFO_) //@D1A - { //@D1A - if((dir_ != null) && (dir_.length()>0)) //@D1A - { //@D1A - if(dir_.equals(HTMLConstants.RTL)) //@D1A - return " writing-mode='rl'"; //@D1A - else //@D1A - return " writing-mode='lr'"; //@D1A - } //@D1A - else //@D1A - return ""; //@D1A - } //@D1A - else //@D1A - { //@D1A - //@C1D - - if ((dir_ != null) && (dir_.length() > 0)) - { - StringBuffer buffer = new StringBuffer(" dir=\""); - buffer.append(dir_); - buffer.append("\""); - - return buffer.toString(); - } - else - return ""; - } //@D1A - - } - - - /** - * Returns the element for the caption. - * @return An HTMLTagElement. - **/ - public HTMLTagElement getElement() - { - return element_; - } - - /** - * Returns the language of the caption. - * @return The language of the caption. - **/ - public String getLanguage() //$B1A - { - return lang_; - } - - - /** - * Returns the language attribute tag. - * @return The language tag. - **/ - String getLanguageAttributeTag() //$B1A - { - //@C1D - - if ((lang_ != null) && (lang_.length() > 0)) - { - StringBuffer buffer = new StringBuffer(" lang=\""); - buffer.append(lang_); - buffer.append("\""); - - return buffer.toString(); - } - else - return ""; - } - - /** - * Returns the HTML caption tag. - * @return The caption tag. - **/ - public String getTag() - { - //@C1D - - if(useFO_) //@D1A - return getFOTag(); //@D1A - - if (element_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting the 'element' parameter."); - throw new ExtendedIllegalStateException("element", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - StringBuffer tag = new StringBuffer(""); - tag.append(element_.getTag()); - tag.append("\n"); - - - return tag.toString(); //@D1C - - } - - /** - * Returns the XSL-FO caption tag. - * The language attribute is not supported in XSL-FO. The table caption will appear at the - * left of the page if align=left, right of the page if align=right, or at the center - * of the page for the rest of the alignments. - * @return The caption tag. - **/ - public String getFOTag() //@D1A - { - //Save current state of useFO_ - boolean useFO = useFO_; - - //Indicate Formatting Object tags are used. - setUseFO(true); - - if (element_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get XSL-FO tag before setting the 'element' parameter."); - throw new ExtendedIllegalStateException("element", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - StringBuffer tag = new StringBuffer(""); - - tag.append(""); - tag.append(element_.getFOTag()); - tag.append("\n"); - - //Set useFO_ to previous state - setUseFO(useFO); - - return tag.toString(); - - } - - /** - * Returns if Formatting Object tags are outputted. - * The default value is false. - * @return true if the output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public boolean isUseFO() //@D1A - { - return useFO_; - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS vetos_ = new VetoableChangeSupport(this); - } - - - - /** - * Removes the VetoableChangeListener from the internal list. - * If the VetoableChangeListener is not on the list, nothing is done. - * @see #addVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ != null) vetos_.removeVetoableChangeListener(listener); //@CRS - } - - /** - * Sets the caption alignment relative to the table. - * @param alignment The caption alignment. One of the following constants - * defined in HTMLConstants: BOTTOM, LEFT, RIGHT, or TOP. - * @exception PropertyVetoException If the change is vetoed. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setAlignment(String alignment) throws PropertyVetoException - { - if (alignment == null) - { - throw new NullPointerException("alignment"); - } - else if (alignment.equalsIgnoreCase(BOTTOM) || - alignment.equalsIgnoreCase(TOP) || - alignment.equalsIgnoreCase(LEFT) || - alignment.equalsIgnoreCase(RIGHT)) - { - String old = align_; - if (vetos_ != null) vetos_.fireVetoableChange("alignment", old, alignment ); //@CRS - - align_ = alignment; - - if (changes_ != null) changes_.firePropertyChange("alignment", old, alignment ); //@CRS - } - else - { - throw new ExtendedIllegalArgumentException("alignment", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - - /** - * Sets the direction of the text interpretation. - * @param dir The direction. One of the following constants - * defined in HTMLConstants: LTR or RTL. - * - * @see com.ibm.as400.util.html.HTMLConstants - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setDirection(String dir) //$B1A - throws PropertyVetoException - { - if (dir == null) - throw new NullPointerException("dir"); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - { - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - String old = dir_; - if (vetos_ != null) vetos_.fireVetoableChange("dir", old, dir ); //@CRS - - dir_ = dir; - - if (changes_ != null) changes_.firePropertyChange("dir", old, dir ); //@CRS - } - - - - /** - * Sets the specified text for the caption. - * @param text The caption text. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setElement(String text) throws PropertyVetoException - { - setElement(new HTMLText(text)); - } - - /** - * Sets the element for the caption. - * @param element An HTMLTagElement. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setElement(HTMLTagElement element) throws PropertyVetoException - { - if (element == null) - - throw new NullPointerException("element"); - - HTMLTagElement old = element_; - if (vetos_ != null) vetos_.fireVetoableChange("element", old, element ); //@CRS - - element_ = element; - - if (changes_ != null) changes_.firePropertyChange("element", old, element ); //@CRS - } - - - /** - * Sets the language of the caption. - * @param lang The language. Example language tags include: - * en and en-US. - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setLanguage(String lang) //$B1A - throws PropertyVetoException - { - if (lang == null) - throw new NullPointerException("lang"); - - String old = lang_; - if (vetos_ != null) vetos_.fireVetoableChange("lang", old, lang ); //@CRS - - lang_ = lang; - - if (changes_ != null) changes_.firePropertyChange("lang", old, lang ); //@CRS - } - - - /** - * Sets if Formatting Object tags should be used. - * The default value is false. - * @param useFO - true if output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public void setUseFO(boolean useFO) //@D1A - { - boolean old = useFO_; - - useFO_ = useFO; - - if (changes_ != null) changes_.firePropertyChange("useFO", old, useFO ); - } - - /** - * Returns the HTML caption tag. - * @return The caption tag. - **/ - public String toString() - { - return getTag(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTableCaption16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLTableCaption16.gif deleted file mode 100644 index 17b5d3743..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLTableCaption16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTableCaption32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLTableCaption32.gif deleted file mode 100644 index f62470e48..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLTableCaption32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTableCaptionBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTableCaptionBeanInfo.java deleted file mode 100644 index d5a5307f1..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTableCaptionBeanInfo.java +++ /dev/null @@ -1,179 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTableCaptionBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -The HTMLTableCaptionBeanInfo class provides -bean information for the HTMLTableCaption class. -**/ -public class HTMLTableCaptionBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class beanClass = HTMLTableCaption.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor alignment = new PropertyDescriptor("alignment", beanClass, - "getAlignment", "setAlignment"); - alignment.setBound(true); - alignment.setConstrained(true); - alignment.setDisplayName(loader_.getText("PROP_NAME_ALIGNMENT")); - alignment.setShortDescription(loader_.getText("PROP_HTCAP_DESC_ALIGNMENT")); - - PropertyDescriptor lang = new PropertyDescriptor("lang", beanClass, "getLanguage", "setLanguage"); //$B1A - lang.setBound(true); //$B1A - lang.setConstrained(true); //$B1A - lang.setDisplayName(loader_.getText("PROP_NAME_LANGUAGE")); //$B1A - lang.setShortDescription(loader_.getText("PROP_DESC_LANGUAGE")); //$B1A - - PropertyDescriptor dir = new PropertyDescriptor("dir", beanClass, "getDirection", "setDirection"); //$B1A - dir.setBound(true); //$B1A - dir.setConstrained(true); //$B1A - dir.setDisplayName(loader_.getText("PROP_NAME_DIRECTION")); //$B1A - dir.setShortDescription(loader_.getText("PROP_DESC_DIRECTION")); //$B1A - - PropertyDescriptor useFO = new PropertyDescriptor("useFO", beanClass, "isUseFO", "setUseFO"); //@C1A - useFO.setBound(true); //@C1A - useFO.setConstrained(false); //@C1A - useFO.setDisplayName(loader_.getText("PROP_NAME_FORMATTING_OBJECT")); //@C1A - useFO.setShortDescription(loader_.getText("PROP_DESC_FORMATTING_OBJECT")); //@C1A - - properties_ = new PropertyDescriptor[] { alignment, lang, dir, useFO }; //$B1C //@C1C - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLTableCaption is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLTableCaption16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLTableCaption32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTableCell.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTableCell.java deleted file mode 100644 index bdb8f0ba4..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTableCell.java +++ /dev/null @@ -1,960 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTableCell.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.io.Serializable; - -/** -* The HTMLTableCell class represents data in an HTML table cell. -* -*

    This example creates an HTML text HTMLTableCell object. -* -*

    -*  // Create an HTMLText object.
    -*  HTMLText ibmText = new HTMLText("IBM");
    -*  ibmText.setBold(true);
    -*  ibmText.setItalic(true);
    -*  HTMLTableCell textCell = new HTMLTableCell(ibmText);
    -*  textCell.setHorizontalAlignment(HTMLConstants.CENTER);
    -*  System.out.println(textCell.getTag());
    -*  
    -* -* Here is the output of the tag: -*

    -*  
    <td align="center"><b><i>IBM</i></b></td> -*

    -*

    Calling getFOTag() produces the following: -*

    -* <fo:table-cell border-style='solid' border-width='1px' padding='1px' text-align='center'><fo:block-container> -* <fo:block font-weight='bold' font-style='italic'>IBM</fo:block> -* </fo:block-container> -* </fo:table-cell> -*
    -* -*

    This example creates an HTMLTableCell object with the element as an HTMLForm -* object containing a submit button. -* -*

    -*  HTMLTableCell formCell = new HTMLTableCell();
    -*  // create an HTMLForm object.
    -*  SubmitFormInput submitButton = new SubmitFormInput("Submit", "Send");
    -*  HTMLForm form = new HTMLForm("http://myCompany.com/myServlet");
    -*  form.addElement(submitButton);
    -*  // add the form to the table cell.
    -*  formCell.setElement(form);
    -*  System.out.println(formCell.getTag());
    -*  
    -* -* Here is the output of the tag: -*

    -*  <td><form action="http://myCompany.com/myServlet" method="get">
    -*  <input type="submit" value="Send" />
    -*  </form></td>
    -*  
    -* -*

    HTMLTableCell objects generate the following events: -*

      -*
    • PropertyChangeEvent -*
    • VetoableChangeEvent -*
    -* -* @see com.ibm.as400.util.html.HTMLTable -* @see com.ibm.as400.util.html.HTMLTableRow -**/ -public class HTMLTableCell extends HTMLTagAttributes implements HTMLConstants, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - static final long serialVersionUID = -4848852026390616957L; - - private HTMLTagElement element_; // The cell data. - - private String align_; // The cell horizontal alignment. - private int colSpan_ = 1; // The number of cell columns in the table the cell should span. - private int height_; // The cell height in percent or pixels. - private int rowSpan_ = 1; // The number of cell rows in the table the cell should span. - private String vAlign_; // The cell vertical alignment. - private int width_; // The cell width in percent or pixels. - private boolean wrap_ = true; // Indicates if normal HTML linebreaking conventions are used. - - private String lang_; // The primary language used to display the tags contents. //$B1A - private String dir_; // The direction of the text interpretation. //$B1A - - private boolean heightPercent_ = false; // Indicates if the height is in percent. - private boolean widthPercent_ = false; // Indicates if the width is in percent. - - private boolean useFO_ = false; // Indicates if XSL-FO tags are used //@D1A - private int borderWidth_ = 1; // The width of the cell border //@D1A - private int cellPadding_ = 1; // The padding for the cell //@D1A - transient private VetoableChangeSupport vetos_; //@CRS - - /** - * Constructs a default HTMLTableCell object. - **/ - public HTMLTableCell() - { - - } - - /** - * Constructs an HTMLTableCell. - * @param element The table cell element. - **/ - public HTMLTableCell(HTMLTagElement element) - { - if (element == null) - throw new NullPointerException("element"); - - element_ = element; - } - - - /** - * Adds the VetoableChangeListener. The specified VetoableChangeListener's vetoableChange - * method is called each time the value of any constrained property is changed. - * @see #removeVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); //@CRS - vetos_.addVetoableChangeListener(listener); - } - - /** - * Returns the column span. The default value is one. - * @return The column span. - **/ - public int getColumnSpan() - { - return colSpan_; - } - - /** - * Returns the direction of the text interpretation. - * @return The direction of the text. - **/ - public String getDirection() //$B1A - { - return dir_; - } - - - /** - * Returns the direction attribute tag. - * @return The direction tag. - **/ - String getDirectionAttributeTag() //$B1A - { - if(useFO_ ) //@D1A - { //@D1A - if((dir_ != null) && (dir_.length()>0)) //@D1A - { //@D1A - if(dir_.equals(HTMLConstants.RTL)) //@D1A - return " writing-mode='rl'"; //@D1A - else //@D1A - return " writing-mode='lr'"; //@D1A - } //@D1A - else //@D1A - return ""; //@D1A - } //@D1A - else //@D1A - { //@D1A - //@C1D - - if ((dir_ != null) && (dir_.length() > 0)) - return " dir=\"" + dir_ + "\""; - else - return ""; - } //@D1A - - } - - - /** - * Returns the table cell element. - * @return The cell element. - **/ - public HTMLTagElement getElement() - { - return element_; - } - - /** - * Returns the table cell end tag. - * @return The end tag. - **/ - String getEndTag() - { - if(!useFO_) //@D1A - return "\n"; - else - return "\n"; // @D1A - } - - /** - * Returns the height relative to the table in pixels or percent. - * @return The height. - **/ - public int getHeight() - { - return height_; - } - - /** - * Returns the horizontal alignment. The default value is LEFT. - * @return The horizontal alignment. One of the following constants - * defined in HTMLConstants: CENTER, LEFT, or RIGHT. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public String getHorizontalAlignment() - { - return align_; - } - - /** - * Returns the language of the table cell. - * @return The language of the table cell. - **/ - public String getLanguage() //$B1A - { - return lang_; - } - - - /** - * Returns the language attribute tag. - * @return The language tag. - **/ - String getLanguageAttributeTag() //$B1A - { - //@C1D - - if ((lang_ != null) && (lang_.length() > 0)) - return " lang=\"" + lang_ + "\""; - else - return ""; - } - - /** - * Returns the row span. The default value is one. - * @return The row span. - **/ - public int getRowSpan() - { - return rowSpan_; - } - - /** - * Returns the table cell start tag. - * @return The start tag. - **/ - String getStartTag() - { - if(!useFO_) //@D1A - return " 1) //@D1A - { - tag.append(" rowspan=\""); - tag.append(rowSpan_); - tag.append("\""); - } - if (colSpan_ > 1) //@D1A - { - tag.append(" colspan=\""); - tag.append(colSpan_); - tag.append("\""); - } - - // Add the size attributes. - if (height_ > 0) //@D1A - { - tag.append(" height=\""); - tag.append(height_); - - if (heightPercent_) - tag.append("%"); - tag.append("\""); - } - if (width_ > 0) //@D1A - { - tag.append(" width=\""); - tag.append(width_); - - if (widthPercent_) - tag.append("%"); - tag.append("\""); - } - - // Add the wrap attribute. - if (!wrap_) //@D1A - tag.append(" nowrap=\"nowrap\""); - - tag.append(getLanguageAttributeTag()); //$B1A - tag.append(getDirectionAttributeTag()); //$B1A - tag.append(getAttributeString()); // @Z1A - } - else //@D1A - { - // Add the span attributes. - if (rowSpan_ > 1) - { - tag.append(" number-rows-spanned='"); - tag.append(rowSpan_); - tag.append("'"); - } - if (colSpan_ > 1) - { - tag.append(" number-columns-spanned='"); - tag.append(colSpan_); - tag.append("'"); - } - // Add the size attributes. - if (height_ > 0) //@D1A - { - tag.append(" height='"); - tag.append(height_); - - if (heightPercent_) - tag.append("%"); - tag.append("'"); - } - if (width_ > 0) - { - tag.append(" width='"); - tag.append(width_); - - if (widthPercent_) - tag.append("%"); - tag.append("'"); - } - } - - tag.append(">"); - - return tag.toString(); //@D1C - } - - /** - * Returns the table cell tag. - * @return The cell tag. - **/ - public String getTag() - { - return getTag(element_); - } - - /** - * Returns the XSL-FO table cell tag. - * @return The cell tag. - **/ - public String getFOTag() //@D1A - { - return getFOTag(element_); - } - - /** - * Returns the XSL-FO table cell tag with the specified element. - * It does not change the cell object's element attribute. - * The valign, wrap and laguage attributes are not supported in XSL-FO. - * @param element The table cell element. - * @return The XSL-FO cell tag. - **/ - public String getFOTag(HTMLTagElement element) //@D1A - { - //Save current state of useFO_ - boolean useFO = useFO_; - - setUseFO(true); - - // Verify that the element is set. - if (element == null) - throw new NullPointerException("element"); - - StringBuffer tag = new StringBuffer(getStartTag()); - tag.append(getAttributeTag()); - tag.append("\n"); - tag.append(element.getFOTag()); - tag.append("\n"); - tag.append(getEndTag()); - - //Set useFO_ to previous state - setUseFO(useFO); - - return tag.toString(); - } - - /** - * Returns the table cell tag with the specified element. - * It does not change the cell object's element attribute. - * @param element The table cell element. - * @return The cell tag. - **/ - public String getTag(HTMLTagElement element) - { - //@C1D - - if(useFO_) //@D1A - return getFOTag(element); //@D1A - - // Verify that the element is set. - if (element == null) - throw new NullPointerException("element"); - - StringBuffer tag = new StringBuffer(getStartTag()); - tag.append(getAttributeTag()); - tag.append(element.getTag()); - tag.append(getEndTag()); - - return tag.toString(); //@D1C - } - - /** - * Returns the vertical alignment. - * @return The vertical alignment. One of the following constants - * defined in HTMLConstants: BASELINE, BOTTOM, MIDDLE, or TOP. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public String getVerticalAlignment() - { - return vAlign_; - } - - /** - * Returns the width relative to the table in pixels or percent. - * @return The width. - **/ - public int getWidth() - { - return width_; - } - - - - /** - * Indicates if the height is in percent or pixels. - * The default value is false. - * @return true if percent; pixels otherwise. - **/ - public boolean isHeightInPercent() - { - return heightPercent_; - } - - /** - * Returns if Formatting Object tags are outputted. - * The default value is false. - * @return true if the output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public boolean isUseFO() - { - //@D1A - return useFO_; - } - - /** - * Indicates if the width is in percent or pixels. - * The default value is false. - * @return true if percent; pixels otherwise. - **/ - public boolean isWidthInPercent() - { - return widthPercent_; - } - - /** - * Indicates if the cell data will use normal HTML linebreaking conventions. - * The default value is true. - * @return true if normal HTML linebreaking is used; false otherwise. - **/ - public boolean isWrap() - { - return wrap_; - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS vetos_ = new VetoableChangeSupport(this); - } - - - /** - * Removes the VetoableChangeListener from the internal list. - * If the VetoableChangeListener is not on the list, nothing is done. - * @see #addVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ != null) vetos_.removeVetoableChangeListener(listener); //@CRS - } - - /** - * Sets the column span. The default value is one. - * @param span The column span. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setColumnSpan(int span) throws PropertyVetoException - { - if (span <= 0) - throw new ExtendedIllegalArgumentException("span", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - //@CRS Integer oldSpan = new Integer(colSpan_); - //@CRS Integer newSpan = new Integer(span); - int oldSpan = colSpan_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("span", new Integer(oldSpan), new Integer(span)); //@CRS - - colSpan_ = span; - - if (changes_ != null) changes_.firePropertyChange("span", new Integer(oldSpan), new Integer(span)); //@CRS - } - - /** - * Sets the direction of the text interpretation. - * @param dir The direction. One of the following constants - * defined in HTMLConstants: LTR or RTL. - * - * @see com.ibm.as400.util.html.HTMLConstants - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setDirection(String dir) //$B1A - throws PropertyVetoException - { - if (dir == null) - throw new NullPointerException("dir"); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - { - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - String old = dir_; - if (vetos_ != null) vetos_.fireVetoableChange("dir", old, dir ); //@CRS - - dir_ = dir; - - if (changes_ != null) changes_.firePropertyChange("dir", old, dir ); //@CRS - } - - /** - * Sets the table cell element. - * @param element The cell element. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setElement(String element) throws PropertyVetoException - { - setElement(new HTMLText(element)); - } - - /** - * Sets the table cell element. - * @param element The cell element. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setElement(HTMLTagElement element) throws PropertyVetoException - { - if (element == null) - throw new NullPointerException("element"); - - HTMLTagElement old = element_; - if (vetos_ != null) vetos_.fireVetoableChange("element", old, element ); //@CRS - - element_ = element; - - if (changes_ != null) changes_.firePropertyChange("element", old, element ); //@CRS - } - - /** - * Sets the height relative to the table. The default unit is pixels. - * A table row can only have one height. - * If multiple cell heights are defined for different cells in the row, the outcome is browser - * dependent. - * @param height The height. - * @exception PropertyVetoException If the change is vetoed. - * @see #setHeightInPercent - **/ - public void setHeight(int height) throws PropertyVetoException - { - if (height <= 0) - throw new ExtendedIllegalArgumentException("height", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - //@CRS Integer oldHeight = new Integer(height_); - //@CRS Integer newHeight = new Integer(height); - int oldHeight = height_; - - if (vetos_ != null) vetos_.fireVetoableChange("height", new Integer(oldHeight), new Integer(height)); //@CRS - - height_ = height; - - if (changes_ != null) changes_.firePropertyChange("height", new Integer(oldHeight), new Integer(height)); //@CRS - } - - /** - * Sets the height relative to the table in pixels or percent. - * A table row can only have one height. - * If multiple cell heights are defined for different cells in the row, the outcome is browser dependent. - * @param height The height. - * @param heightInPercent true if unit is percent; false if pixels. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setHeight(int height, boolean heightInPercent) throws PropertyVetoException - { - int oldHeight = height_; - - setHeight(height); - - try - { - setHeightInPercent(heightInPercent); - } - catch (PropertyVetoException e) - { - // Restore the original height. - height_ = oldHeight; - throw new PropertyVetoException("heightInPercent", e.getPropertyChangeEvent()); - } - } - - /** - * Sets the height unit in percent or pixels. The default is false. - * @param heightInPercent true if unit is percent; false if pixels. - * @exception PropertyVetoException If the change is vetoed. - * @see #setHeight - **/ - public void setHeightInPercent(boolean heightInPercent) throws PropertyVetoException - { - //@CRS Boolean oldHeight = new Boolean(heightPercent_); - //@CRS Boolean newHeight = new Boolean(heightInPercent); - boolean oldHeight = heightPercent_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("heightInPercent", new Boolean(oldHeight), new Boolean(heightInPercent)); //@CRS - - heightPercent_ = heightInPercent; - - if (changes_ != null) changes_.firePropertyChange("heightInPercent", new Boolean(oldHeight), new Boolean(heightInPercent)); //@CRS - } - - /** - * Sets the horizontal alignment. The default value is LEFT. - * @param alignment The horizontal alignment. One of the following constants - * defined in HTMLConstants: CENTER, LEFT, or RIGHT. - * @exception PropertyVetoException If the change is vetoed. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setHorizontalAlignment(String alignment) throws PropertyVetoException - { - if (alignment == null) - { - throw new NullPointerException("alignment"); - } - else if (alignment.equalsIgnoreCase(LEFT) || - alignment.equalsIgnoreCase(CENTER) || - alignment.equalsIgnoreCase(RIGHT)) - { - String old = align_; - if (vetos_ != null) vetos_.fireVetoableChange("alignment", old, alignment ); //@CRS - - align_ = alignment; - - if (changes_ != null) changes_.firePropertyChange("alignment", old, alignment ); //@CRS - } - else - { - throw new ExtendedIllegalArgumentException("alignment", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - /** - * Sets the language of the table cell. - * @param lang The language. Example language tags include: - * en and en-US. - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setLanguage(String lang) //$B1A - throws PropertyVetoException - { - if (lang == null) - throw new NullPointerException("lang"); - - String old = lang_; - if (vetos_ != null) vetos_.fireVetoableChange("lang", old, lang ); //@CRS - - lang_ = lang; - - if (changes_ != null) changes_.firePropertyChange("lang", old, lang ); //@CRS - } - - /** - * Sets the row span. The default value is one. - * @param span The row span. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setRowSpan(int span) throws PropertyVetoException - { - if (span <= 0) - throw new ExtendedIllegalArgumentException("span", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - //@CRS Integer oldSpan = new Integer(rowSpan_); - //@CRS Integer newSpan = new Integer(span); - int oldSpan = rowSpan_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("span", new Integer(oldSpan), new Integer(span)); //@CRS - - rowSpan_ = span; - - if (changes_ != null) changes_.firePropertyChange("span", new Integer(oldSpan), new Integer(span)); //@CRS - } - - /** - * Sets if Formatting Object tags should be used. - * The default value is false. - * @param useFO - true if output generated is a XSL formatting object, false if the output generated is HTML. - **/ - public void setUseFO(boolean useFO) // @D1A - { - boolean old = useFO_; - - useFO_ = useFO; - - if (changes_ != null) changes_.firePropertyChange("useFO", old, useFO ); - } - - /** - * Sets the border width in pixels. A value of zero indicates no border. - * The default value is one. - * @param borderWidth The border width. - **/ - public void setBorderWidth(int borderWidth) // @D1A - { - Integer oldWidth = new Integer(borderWidth_); - Integer newWidth = new Integer(borderWidth); - - borderWidth_ = borderWidth; - - if (changes_ != null) changes_.firePropertyChange("borderWidth", oldWidth, newWidth); - } - - /** - * Sets the global table cell padding. The cell padding is the spacing between - * data in a table cell and the border of the cell. - * @param cellPadding The cell padding. - **/ - public void setCellPadding(int cellPadding) // @D1A - { - Integer oldPadding = new Integer(cellPadding_); - Integer newPadding = new Integer(cellPadding); - - cellPadding_ = cellPadding; - - if (changes_ != null) changes_.firePropertyChange("cellPadding", oldPadding, newPadding); - } - - /** - * Sets the vertical alignment. - * @param alignment The vertical alignment. One of the following constants - * defined in HTMLConstants: BASELINE, BOTTOM, MIDDLE, or TOP. - * @exception PropertyVetoException If the change is vetoed. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setVerticalAlignment(String alignment) throws PropertyVetoException - { - if (alignment == null) - { - throw new NullPointerException("alignment"); - } - else if (alignment.equalsIgnoreCase(TOP) || - alignment.equalsIgnoreCase(MIDDLE) || - alignment.equalsIgnoreCase(BOTTOM) || - alignment.equalsIgnoreCase(BASELINE)) - { - String old = vAlign_; - if (vetos_ != null) vetos_.fireVetoableChange("alignment", old, alignment ); //@CRS - - vAlign_ = alignment; - - if (changes_ != null) changes_.firePropertyChange("alignment", old, alignment ); //@CRS - } - else - { - throw new ExtendedIllegalArgumentException("alignment", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - /** - * Sets the width relative to the table. The default width unit is pixels. - * A table column can only have one width and the width used is usually the widest. - * If multiple cell widths are defined for different cells in the column, the outcome is browser dependent. - * @param width The width. - * @exception PropertyVetoException If the change is vetoed. - * @see #setWidthInPercent - **/ - public void setWidth(int width) throws PropertyVetoException - { - if (width <= 0) - throw new ExtendedIllegalArgumentException("width", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - //@CRS Integer oldWidth = new Integer(width_); - //@CRS Integer newWidth = new Integer(width); - int oldWidth = width_; //@CRS //@K1C - - if (vetos_ != null) vetos_.fireVetoableChange("width", new Integer(oldWidth), new Integer(width)); //@CRS - - width_ = width; - - if (changes_ != null) changes_.firePropertyChange("width", new Integer(oldWidth), new Integer(width)); //@CRS - } - - /** - * Sets the width relative to the table in percent or pixels. - * A table column can only have one width and the width used is usually the widest. - * If multiple cell widths are defined for different cells in the column, the outcome - * is browser dependent. - * @param width The width. - * @param widthInPercent true if unit is percent; false if pixels. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setWidth(int width, boolean widthInPercent) throws PropertyVetoException - { - int oldWidth = width_; - - setWidth(width); - - try - { - setWidthInPercent(widthInPercent); - } - catch (PropertyVetoException e) - { - width_ = oldWidth; - throw new PropertyVetoException("widthInPercent", e.getPropertyChangeEvent()); - } - } - - /** - * Sets the width unit in percent or pixels. The default is false. - * @param widthInPercent true if unit is percent; false if pixels. - * @exception PropertyVetoException If the change is vetoed. - * @see #setWidth - **/ - public void setWidthInPercent(boolean widthInPercent) throws PropertyVetoException - { - //@CRS Boolean oldWidth = new Boolean(widthPercent_); - //@CRS Boolean newWidth = new Boolean(widthInPercent); - boolean oldWidth = widthPercent_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("widthInPercent", new Boolean(oldWidth), new Boolean(widthInPercent)); //@CRS - - widthPercent_ = widthInPercent; - - if (changes_ != null) changes_.firePropertyChange("widthInPercent", new Boolean(oldWidth), new Boolean(widthInPercent)); //@CRS - } - - /** - * Sets if the cell data will use normal HTML linebreaking conventions. - * The default value is true. - * @param wrap true if normal HTML linebreaking is used; false otherwise. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setWrap(boolean wrap) throws PropertyVetoException - { - //@CRS Boolean oldWrap = new Boolean(wrap_); - //@CRS Boolean newWrap = new Boolean(wrap); - boolean oldWrap = wrap_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("wrap", new Boolean(oldWrap), new Boolean(wrap)); //@CRS - - wrap_ = wrap; - - if (changes_ != null) changes_.firePropertyChange("wrap", new Boolean(oldWrap), new Boolean(wrap)); //@CRS - } - - /** - * Returns the HTML table cell tag. - * @return The cell tag. - **/ - public String toString() - { - return getTag(); - } -} - diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTableCell16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLTableCell16.gif deleted file mode 100644 index 717027a91..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLTableCell16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTableCell32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLTableCell32.gif deleted file mode 100644 index 91bff1455..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLTableCell32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTableCellBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTableCellBeanInfo.java deleted file mode 100644 index 3d16aa4a1..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTableCellBeanInfo.java +++ /dev/null @@ -1,235 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTableCellBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -The HTMLTableCellBeanInfo class provides -bean information for the HTMLTableCell class. -**/ -public class HTMLTableCellBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class beanClass = HTMLTableCell.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor columnSpan = new PropertyDescriptor("columnSpan", beanClass, - "getColumnSpan", "setColumnSpan"); - columnSpan.setBound(true); - columnSpan.setConstrained(true); - columnSpan.setDisplayName(loader_.getText("PROP_NAME_CSPAN")); - columnSpan.setShortDescription(loader_.getText("PROP_DESC_CSPAN")); - - PropertyDescriptor height = new PropertyDescriptor("height", beanClass, "getHeight", "setHeight"); - height.setBound(true); - height.setConstrained(true); - height.setDisplayName(loader_.getText("PROP_NAME_HEIGHT")); - height.setShortDescription(loader_.getText("PROP_HTCELL_DESC_HEIGHT")); - - PropertyDescriptor heightInPercent = new PropertyDescriptor("heightInPercent", beanClass, - "isHeightInPercent", "setHeightInPercent"); - heightInPercent.setBound(true); - heightInPercent.setConstrained(true); - heightInPercent.setDisplayName(loader_.getText("PROP_NAME_HPERCENT")); - heightInPercent.setShortDescription(loader_.getText("PROP_DESC_HPERCENT")); - - PropertyDescriptor horizontalAlignment = new PropertyDescriptor("horizontalAlignment", beanClass, - "getHorizontalAlignment", "setHorizontalAlignment"); - horizontalAlignment.setBound(true); - horizontalAlignment.setConstrained(true); - horizontalAlignment.setDisplayName(loader_.getText("PROP_NAME_HALIGN")); - horizontalAlignment.setShortDescription(loader_.getText("PROP_HTCELL_DESC_HALIGN")); - - PropertyDescriptor rowSpan = new PropertyDescriptor("rowSpan", beanClass, - "getRowSpan", "setRowSpan"); - rowSpan.setBound(true); - rowSpan.setConstrained(true); - rowSpan.setDisplayName(loader_.getText("PROP_NAME_RSPAN")); - rowSpan.setShortDescription(loader_.getText("PROP_DESC_RSPAN")); - - PropertyDescriptor verticalAlignment = new PropertyDescriptor("verticalAlignment", beanClass, - "getVerticalAlignment", "setVerticalAlignment"); - verticalAlignment.setBound(true); - verticalAlignment.setConstrained(true); - verticalAlignment.setDisplayName(loader_.getText("PROP_NAME_VALIGN")); - verticalAlignment.setShortDescription(loader_.getText("PROP_HTCELL_DESC_VALIGN")); - - PropertyDescriptor width = new PropertyDescriptor("width", beanClass, - "getWidth", "setWidth"); - width.setBound(true); - width.setConstrained(true); - width.setDisplayName(loader_.getText("PROP_NAME_WIDTH")); - width.setShortDescription(loader_.getText("PROP_HTCELL_DESC_WIDTH")); - - PropertyDescriptor widthInPercent = new PropertyDescriptor("widthInPercent", beanClass, "isWidthInPercent", "setWidthInPercent"); - widthInPercent.setBound(true); - widthInPercent.setConstrained(true); - widthInPercent.setDisplayName(loader_.getText("PROP_NAME_WPERCENT")); - widthInPercent.setShortDescription(loader_.getText("PROP_HTCELL_DESC_WPERCENT")); - - PropertyDescriptor wrap = new PropertyDescriptor("wrap", beanClass, "isWrap", "setWrap"); - wrap.setBound(true); - wrap.setConstrained(true); - wrap.setDisplayName(loader_.getText("PROP_NAME_WRAP")); - wrap.setShortDescription(loader_.getText("PROP_DESC_WRAP")); - - PropertyDescriptor lang = new PropertyDescriptor("lang", beanClass, "getLanguage", "setLanguage"); //$B1A - lang.setBound(true); //$B1A - lang.setConstrained(true); //$B1A - lang.setDisplayName(loader_.getText("PROP_NAME_LANGUAGE")); //$B1A - lang.setShortDescription(loader_.getText("PROP_DESC_LANGUAGE")); //$B1A - - PropertyDescriptor dir = new PropertyDescriptor("dir", beanClass, "getDirection", "setDirection"); //$B1A - dir.setBound(true); //$B1A - dir.setConstrained(true); //$B1A - dir.setDisplayName(loader_.getText("PROP_NAME_DIRECTION")); //$B1A - dir.setShortDescription(loader_.getText("PROP_DESC_DIRECTION")); //$B1A - - PropertyDescriptor useFO = new PropertyDescriptor("useFO", beanClass, "isUseFO", "setUseFO"); //@C1A - useFO.setBound(true); //@C1A - useFO.setConstrained(false); //@C1A - useFO.setDisplayName(loader_.getText("PROP_NAME_FORMATTING_OBJECT")); //@C1A - useFO.setShortDescription(loader_.getText("PROP_DESC_FORMATTING_OBJECT")); //@C1A - - - properties_ = new PropertyDescriptor[] { columnSpan, height, heightInPercent, horizontalAlignment, rowSpan, - verticalAlignment, width, widthInPercent, wrap, lang, dir, useFO }; //$B1C //@C1C - - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLTableCell is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLTableCell16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLTableCell32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTableHeader.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTableHeader.java deleted file mode 100644 index 618de5b35..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTableHeader.java +++ /dev/null @@ -1,259 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTableHeader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; -import java.beans.PropertyVetoException; - -/** -* The HTMLTableHeader represents an HTML table header tag. -* -*

    This example creates an HTMLTableHeader and displays the tag output. -*

    -*  HTMLTableHeader header = new HTMLTableHeader();
    -*  header.setHorizontalAlignment(HTMLTableHeader.CENTER);
    -*  HTMLText headerText = new HTMLText("Customer Name");
    -*  header.setElement(headerText);
    -*  System.out.println(header.getTag());
    -*  
    -* Here is the output of the tag: -*
    -*  <th align="center">Customer Name</th>
    -*  
    -*

    Calling getFOTag() produces the following tag with the default cell border and padding properties: -*

    -* <fo:table-cell border-style='solid' border-width='1px' padding='1px'> -* <fo:block font-weight='bold'><fo:block>Customer Name</fo:block> -* </fo:block> -* </fo:table-cell> -*
    -* -**/ -public class HTMLTableHeader extends HTMLTableCell -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - static final long serialVersionUID = 6954665365850223957L; - - - - private boolean useFO_ = false; // Set use FO tag. //@C1A - private int borderWidth_ = 1; // The table border. //@C1A - private int cellPadding_ = 1; //The cell padding //@C1A - - /** - * Constructs a default HTMLTableHeader object. - **/ - public HTMLTableHeader() - { - super(); - } - - /** - * Constructs an HTMLTableHeader object with the specified data element. - * @param element An HTMLTagElement object containing the data. - **/ - public HTMLTableHeader(HTMLTagElement element) - { - super(element); - } - - /** - * Returns the table header tag. - * @return The HTML tag. - **/ - public String getTag() - { - return getTag(getElement()); - } - - /** - * Returns the XSL-FO table header tag. - * @return the XSL-FO tag - **/ - public String getFOTag() //@C1A - { - return getFOTag(getElement()); - } - - /** - * Returns the table header tag with the specified data element. - * @return The XSL-FO tag. - **/ - public String getFOTag(HTMLTagElement element) //@C1A - { - //Save the current state of useFO_ - boolean useFO = useFO_; - - setUseFO(true); - - if (element == null) - throw new NullPointerException("element"); - - StringBuffer tag = new StringBuffer(" 1) - { - tag.append(" height='"); - tag.append(height); - if(isHeightInPercent()) - tag.append("%"); - tag.append("'"); - } - int width = getWidth(); - if(width > 1) - { - tag.append(" width='"); - tag.append(width); - if(isWidthInPercent()) - tag.append("%"); - tag.append("'"); - } - int columnSpan = getColumnSpan(); - if (columnSpan > 1) - { - tag.append(" number-columns-spanned='"); - tag.append(columnSpan); - tag.append("'"); - } - int rowSpan = getRowSpan(); - if (rowSpan > 1) - { - tag.append(" number-rows-spanned='"); - tag.append(rowSpan); - tag.append("'"); - } - tag.append(">\n"); - tag.append("0)) - { - if(dir.equals(HTMLConstants.RTL)) - tag.append(" writing-mode='rl'"); - else - tag.append(" writing-mode='lr'"); - } - String align = getHorizontalAlignment(); - if(align != null) - { - tag.append(" text-align='"); - if(align.equals(HTMLConstants.CENTER)) - tag.append("center"); - else if(align.equals(HTMLConstants.LEFT)) - tag.append("start"); - else if(align.equals(HTMLConstants.RIGHT)) - tag.append("end"); - tag.append("'"); - } - tag.append(">"); - tag.append(element.getFOTag()); - tag.append("\n"); - tag.append("\n"); - - //Set useFO_ to previous state - setUseFO(useFO); - - return tag.toString(); - } - - /** - * Returns the table header tag with the specified data element. - * @return The HTML tag. - **/ - public String getTag(HTMLTagElement element) - { - //@B1D - - if(useFO_) //@C1A - return getFOTag(element); //@C1A - - if (element == null) - throw new NullPointerException("element"); - - StringBuffer tag = new StringBuffer("\n"); - - return tag.toString(); //@C1C - } - - /** - * Returns if Formatting Object tags are outputted. - * The default value is false. - * @return true if the output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public boolean isUseFO() //@C1A - { - return useFO_; - } - - /** - * Sets the border width in pixels. A value of zero indicates no border. - * The default value is one. - * @param borderWidth The border width. - **/ - public void setBorderWidth(int borderWidth) //@C1A - { - Integer oldWidth = new Integer(borderWidth_); - Integer newWidth = new Integer(borderWidth); - - borderWidth_ = borderWidth; - - if (changes_ != null) changes_.firePropertyChange("borderWidth", oldWidth, newWidth); - } - - /** - * Sets the global table cell padding. The cell padding is the spacing between - * data in a table cell and the border of the cell. - * The default value is 1 - * @param cellPadding The cell padding. - **/ - public void setCellPadding(int cellPadding) //@C1A - { - Integer oldPadding = new Integer(cellPadding_); - Integer newPadding = new Integer(cellPadding); - - cellPadding_ = cellPadding; - - if (changes_ != null) changes_.firePropertyChange("cellPadding", oldPadding, newPadding); - } - - /** - * Sets if Formatting Object tags should be used. - * The default value is false. - * @param useFO - true if output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public void setUseFO(boolean useFO) //@C1A - { - boolean old = useFO_; - - useFO_ = useFO; - - if (changes_ != null) changes_.firePropertyChange("useFO", old, useFO ); - } - - /** - * Returns the HTML table header tag. - * @return The header tag. - **/ - public String toString() - { - return getTag(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTableHeader16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLTableHeader16.gif deleted file mode 100644 index 21e053dbd..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLTableHeader16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTableHeader32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLTableHeader32.gif deleted file mode 100644 index b98c2464b..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLTableHeader32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTableHeaderBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTableHeaderBeanInfo.java deleted file mode 100644 index d5f2aad78..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTableHeaderBeanInfo.java +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTableHeaderBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -The HTMLTableHeaderBeanInfo class provides -bean information for the HTMLTableHeader class. -**/ -public class HTMLTableHeaderBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class beanClass = HTMLTableHeader.class; - - /** - * Returns additional bean information from the HTMLTableHeader superclass. - * @return The bean information. - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new HTMLTableCellBeanInfo() }; - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - /** - Returns an image for the icon. - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLTableHeader16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLTableHeader32.gif"); - break; - } - return image; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTableRow.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTableRow.java deleted file mode 100644 index 8ea4c4e3d..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTableRow.java +++ /dev/null @@ -1,755 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTableRow.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.io.Serializable; -import java.util.Vector; - -/** -* The HTMLTableRow class represents an HTML row tag. -* -*

    This example creates an HTMLTableRow object and sets the attributes. -*

    -*  HTMLTableRow row = new HTMLTableRow();
    -*  row.setHorizontalAlignment(HTMLTableRow.CENTER);
    -*  row.setVerticalAlignment(HTMLTableRow.MIDDLE);
    -*  // Add the columns to the row (Assume that the HTMLTableCell objects are already created).
    -*  row.addColumn(column1);
    -*  row.addColumn(column2);
    -*  row.addColumn(column3);
    -*  row.addColumn(column4);
    -*  System.out.println(row.getTag());
    -*  
    -* Here is the output of the tag: -*
    -*  <tr align="center" valign="middle">
    -*  <td>data1</td>
    -*  <td>data2</td>
    -*  <td>data3</td>
    -*  <td>data4</td>
    -*  </tr>
    -*  
    -*

    -* Using XSL Formatting Objects, the output generated is: -*

    -* <fo:table-row text-align="center"> -* <fo:table-cell border-style='solid' border-width='1px' padding='1px'><fo:block-container> -* <fo:block>data1</fo:block> -* </fo:block-container> -* </fo:table-cell> -* <fo:table-cell border-style='solid' border-width='1px' padding='1px'><fo:block-container> -* <fo:block>data2</fo:block> -* </fo:block-container> -* </fo:table-cell> -* <fo:table-cell border-style='solid' border-width='1px' padding='1px'><fo:block-container> -* <fo:block>data3</fo:block> -* </fo:block-container> -* </fo:table-cell> -* <fo:table-cell border-style='solid' border-width='1px' padding='1px'><fo:block-container> -* <fo:block>data4</fo:block> -* </fo:block-container> -* </fo:table-cell> -* </fo:table-row> -*
    -* -*

    HTMLTableRow objects generate the following events: -*

      -*
    • ElementEvent - The events fired are: -*
        -*
      • elementAdded -*
      • elementChanged -*
      • elementRemoved -*
      -*
    • PropertyChangeEvent -*
    • VetoableChangeEvent -*
    -* -* @see com.ibm.as400.util.html.HTMLTable -* @see com.ibm.as400.util.html.HTMLTableCell -**/ -public class HTMLTableRow extends HTMLTagAttributes implements HTMLConstants, Serializable // @Z1C -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - static final long serialVersionUID = -3968067893063774982L; - - private Vector row_; // The columns in the row. - private String hAlign_; // The global horizontal alignment for each cells in the row. - private String vAlign_; // The global vertical alignment for each cell in the row. - - private String lang_; // The primary language used to display the tags contents. //$B1A - private String dir_; // The direction of the text interpretation. //$B1A - - private boolean useFO_ = false; // Sets use fo tag. //@D1A - private int borderWidth_ = 1; // The border width //@D1A - private int cellPadding_ = 1; // The cell padding //@D1A - - transient private Vector columnListeners_; // The list of column listeners. @CRS - transient private VetoableChangeSupport vetos_; //@CRS - - /** - * Constructs a default HTMLTableRow object. - **/ - public HTMLTableRow() - { - row_ = new Vector(); - } - - /** - * Constructs an HTMLTableRow object with the specified cells. - * @param cells The HTMLTableCell array. - **/ - public HTMLTableRow(HTMLTableCell[] cells) - { - this(); - - if (cells == null) - throw new NullPointerException("cells"); - - for (int i=0; i< cells.length; i++) - row_.addElement(cells[i]); - } - - /** - * Adds the column to the row. - * @param cell The HTMLTableCell containing the column data. - **/ - public void addColumn(HTMLTableCell cell) - { - //@C1D - - if (cell == null) - throw new NullPointerException("cell"); - - row_.addElement(cell); - - // Notify the listeners. - fireAdded(); - } - - /** - * Adds an ElementListener for the columns. - * The ElementListener object is added to an internal list of ColumnListeners; - * it can be removed with removeColumnListener. - * @see #removeColumnListener - * @param listener The ElementListener. - **/ - public void addColumnListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (columnListeners_ == null) columnListeners_ = new Vector(); //@CRS - columnListeners_.addElement(listener); - } - - - /** - * Adds the VetoableChangeListener. The specified VetoableChangeListener's vetoableChange - * method is called each time the value of any constrained property is changed. - * @see #removeVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); //@CRS - vetos_.addVetoableChangeListener(listener); - } - - /** - * Fires a ELEMENT_ADDED event. - **/ - private void fireAdded() - { - if (columnListeners_ == null) return; //@CRS - Vector targets = (Vector) columnListeners_.clone(); - ElementEvent event = new ElementEvent(this, ElementEvent.ELEMENT_ADDED); - for (int i=0; icolumnIndex. - * @param columnIndex - The column index. - * @return An HTMLTableCell object with the column data. - **/ - public HTMLTableCell getColumn(int columnIndex) - { - if (columnIndex < 0 || columnIndex >= row_.size()) - throw new ExtendedIllegalArgumentException("columnIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - return(HTMLTableCell)row_.elementAt(columnIndex); - } - - /** - * Returns the number of columns in the row. - * @return The number of columns. - **/ - public int getColumnCount() - { - return row_.size(); - } - - /** - * Returns the column index of the specified cell. - * @param cell An HTMLTableCell object that contains the cell data. - * @return The column index of the cell. Returns -1 if the column is not found. - **/ - public int getColumnIndex(HTMLTableCell cell) - { - if (cell == null) - throw new NullPointerException("cell"); - - return row_.indexOf(cell); - } - - /** - * Returns the column index of the specified cell. - * @param cell An HTMLTableCell object that contains the cell data. - * @param index The column index to start searching from. - * @return The column index of the cell. Returns -1 if the column is not found. - **/ - public int getColumnIndex(HTMLTableCell cell, int index ) - { - if (cell == null) - throw new NullPointerException("cell"); - - if (index >= row_.size() || index < 0) - throw new ExtendedIllegalArgumentException("index", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - return row_.indexOf(cell, index); - } - - /** - * Returns the direction of the text interpretation. - * @return The direction of the text. - **/ - public String getDirection() //$B1A - { - return dir_; - } - - - /** - * Returns the direction attribute tag. - * @return The direction tag. - **/ - String getDirectionAttributeTag() //$B1A - { - //@C1D - - if ((dir_ != null) && (dir_.length() > 0)) - { - StringBuffer buffer = new StringBuffer(" dir=\""); - buffer.append(dir_); - buffer.append("\""); - - return buffer.toString(); - } - else - return ""; - } - - - /** - * Returns the global horizontal alignment for the row. - * @return The horizontal alignment. One of the following constants - * defined in HTMLConstants: CENTER, LEFT, or RIGHT. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public String getHorizontalAlignment() - { - return hAlign_; - } - - /** - * Returns the language of the caption. - * @return The language of the caption. - **/ - public String getLanguage() //$B1A - { - return lang_; - } - - - /** - * Returns the language attribute tag. - * @return The language tag. - **/ - String getLanguageAttributeTag() //$B1A - { - //@C1D - - if ((lang_ != null) && (lang_.length() > 0)) - { - StringBuffer buffer = new StringBuffer(" lang=\""); - buffer.append(lang_); - buffer.append("\""); - - return buffer.toString(); - } - else - return ""; - } - - - /** - * Returns the table row tag. - * @return The tag. - **/ - public String getTag() - { - //@C1D - - if(useFO_) //@D1A - return getFOTag(); //@D1A - - if (row_.size() == 0) - { - Trace.log(Trace.ERROR, "Attempting to get tag before adding a column to the row."); - throw new ExtendedIllegalStateException("column", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - StringBuffer tag = new StringBuffer("\n"); - - for (int i=0; i< row_.size(); i++) - { - HTMLTableCell cell = (HTMLTableCell)row_.elementAt(i); - tag.append(cell.getTag()); - } - tag.append("\n"); - - - return tag.toString(); //@D1C - - } - - /** - * Returns the XSL-FO table row tag. - * The valign, halign, and language attributes are not supported in XSL-FO. - * @return The xsl-fo tag. - **/ - public String getFOTag() //@D1A - { - //Store the current state of useFO_ - boolean useFO = useFO_; - - setUseFO(true); - - int size = row_.size(); - if (size == 0) - { - Trace.log(Trace.ERROR, "Attempting to get XSL-FO tag before adding a column to the row."); - throw new ExtendedIllegalStateException("column", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - StringBuffer tag = new StringBuffer(""); - - tag.append("\n"); - - for (int i=0; i< size; i++) - { - //Must specify the cell border width and padding for each cell - HTMLTableCell cell = (HTMLTableCell)row_.elementAt(i); - cell.setBorderWidth(borderWidth_); - if(cellPadding_ > -1) - cell.setCellPadding(cellPadding_); - if ((dir_ != null) && (dir_.length() > 0)) - { - try - { - cell.setDirection(dir_); - } - catch(PropertyVetoException p) - { - } - } - tag.append(cell.getFOTag()); - } - tag.append("\n"); - - //Set useFO_ to previous state - setUseFO(useFO); - - return tag.toString(); //@D1C - } - - /** - * Returns the global vertical alignment for the row. - * @return The vertical alignment. One of the following constants - * defined in HTMLConstants: BASELINE, BOTTOM, MIDDLE, or TOP. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public String getVerticalAlignment() - { - return vAlign_; - } - - - - /** - * Returns if Formatting Object tags are outputted. - * The default value is false. - * @return true if the output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public boolean isUseFO() //@D1A - { - return useFO_; - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS vetos_ = new VetoableChangeSupport(this); - //@CRS columnListeners_ = new Vector(); - } - - /** - * Removes all the columns from the row. - **/ - public void removeAllColumns() - { - //@C1D - - row_.removeAllElements(); - fireRemoved(); - } - - /** - * Removes the column element from the row. - * @param cell The HTMLTableCell object to be removed. - **/ - public void removeColumn(HTMLTableCell cell) - { - //@C1D - - if (cell == null) - throw new NullPointerException("cell"); - - if (row_.removeElement(cell)) - fireRemoved(); // Fire the column removed event. - } - - /** - * Removes the column at the specified columnIndex. - * @param columnIndex The column index. - **/ - public void removeColumn(int columnIndex) - { - //@C1D - - if (columnIndex < 0 || columnIndex >= row_.size()) - throw new ExtendedIllegalArgumentException("columnIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - row_.removeElement((HTMLTableCell)row_.elementAt(columnIndex)); - fireRemoved(); - } - - /** - * Removes this column ElementListener from the internal list. - * If the ElementListener is not on the list, nothing is done. - * @see #addColumnListener - * @param listener The ElementListener. - **/ - public void removeColumnListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (columnListeners_ != null) columnListeners_.removeElement(listener); //@CRS - } - - - - /** - * Removes the VetoableChangeListener from the internal list. - * If the VetoableChangeListener is not on the list, nothing is done. - * @see #addVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ != null) vetos_.removeVetoableChangeListener(listener); //@CRS - } - - /** - * Sets the column element at the specified column. - * @param cell The HTMLTableCell object to be added. - * @param columnIndex The column index. - **/ - public void setColumn(HTMLTableCell cell, int columnIndex) - { - //@C1D - - // Validate the cell parameter. - if (cell == null) - throw new NullPointerException("cell"); - // Validate the column parameter. - if (columnIndex > row_.size() || columnIndex < 0) - throw new ExtendedIllegalArgumentException("columnIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - // Set the column. - if (columnIndex == row_.size()) - addColumn(cell); - else - { - row_.setElementAt(cell, columnIndex); - fireChanged(); // Notify the listeners. - } - } - - - /** - * Sets the direction of the text interpretation. - * @param dir The direction. One of the following constants - * defined in HTMLConstants: LTR or RTL. - * - * @see com.ibm.as400.util.html.HTMLConstants - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setDirection(String dir) //$B1A - throws PropertyVetoException - { - if (dir == null) - throw new NullPointerException("dir"); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - { - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - String old = dir_; - if (vetos_ != null) vetos_.fireVetoableChange("dir", old, dir ); //@CRS - - dir_ = dir; - - if (changes_ != null) changes_.firePropertyChange("dir", old, dir ); //@CRS - } - - - /** - * Sets the global horizontal alignment for the row. - * @param alignment The horizontal alignment. One of the following constants - * defined in HTMLConstants: CENTER, LEFT, or RIGHT. - * @exception PropertyVetoException If the change is vetoed. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setHorizontalAlignment(String alignment) throws PropertyVetoException - { - if (alignment == null) - { - throw new NullPointerException("alignment"); - } - else if (alignment.equalsIgnoreCase(LEFT) || - alignment.equalsIgnoreCase(CENTER) || - alignment.equalsIgnoreCase(RIGHT)) - { - String old = hAlign_; - if (vetos_ != null) vetos_.fireVetoableChange("alignment", old, alignment ); //@CRS - - hAlign_ = alignment; - - if (changes_ != null) changes_.firePropertyChange("alignment", old, alignment ); //@CRS - } - else - { - throw new ExtendedIllegalArgumentException("alignment", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - - /** - * Sets the language of the caption. - * @param lang The language. Example language tags include: - * en and en-US. - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setLanguage(String lang) //$B1A - throws PropertyVetoException - { - if (lang == null) - throw new NullPointerException("lang"); - - String old = lang_; - if (vetos_ != null) vetos_.fireVetoableChange("lang", old, lang ); //@CRS - - lang_ = lang; - - if (changes_ != null) changes_.firePropertyChange("lang", old, lang ); //@CRS - } - - /** - * Sets the border width in pixels. A value of zero indicates no border. - * The default value is one. - * @param borderWidth The border width. - **/ - public void setBorderWidth(int borderWidth) //@D1A - { - Integer oldWidth = new Integer(borderWidth_); - Integer newWidth = new Integer(borderWidth); - - borderWidth_ = borderWidth; - - if (changes_ != null) changes_.firePropertyChange("borderWidth", oldWidth, newWidth); - } - - /** - * Sets the global table cell padding. The cell padding is the spacing between - * data in a table cell and the border of the cell. - * The default value is 1. - * @param cellPadding The cell padding. - **/ - public void setCellPadding(int cellPadding) //@D1A - { - Integer oldPadding = new Integer(cellPadding_); - Integer newPadding = new Integer(cellPadding); - - cellPadding_ = cellPadding; - - if (changes_ != null) changes_.firePropertyChange("cellPadding", oldPadding, newPadding); - } - - /** - * Sets if Formatting Object tags should be used. - * The default value is false. - * @param useFO - true if output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public void setUseFO(boolean useFO) //@D1A - { - boolean old = useFO_; - - useFO_ = useFO; - - if (changes_ != null) changes_.firePropertyChange("useFO", old, useFO ); - } - - /** - * Sets the global vertical alignment for the row. - * @param alignment The vertical alignment. One of the following constants - * defined in HTMLConstants: BASELINE, BOTTOM, MIDDLE, or TOP. - * @exception PropertyVetoException If the change is vetoed. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setVerticalAlignment(String alignment) throws PropertyVetoException - { - if (alignment == null) - { - throw new NullPointerException("alignment"); - } - else if (alignment.equalsIgnoreCase(TOP) || - alignment.equalsIgnoreCase(MIDDLE) || - alignment.equalsIgnoreCase(BOTTOM) || - alignment.equalsIgnoreCase(BASELINE)) - { - String old = vAlign_; - if (vetos_ != null) vetos_.fireVetoableChange("alignment", old, alignment ); //@CRS - - vAlign_ = alignment; - - if (changes_ != null) changes_.firePropertyChange("alignment", old, alignment ); //@CRS - } - else - { - throw new ExtendedIllegalArgumentException("alignment", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - /** - * Returns the HTML table row tag. - * @return The row tag. - **/ - public String toString() - { - return getTag(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTableRow16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLTableRow16.gif deleted file mode 100644 index bd3701486..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLTableRow16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTableRow32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLTableRow32.gif deleted file mode 100644 index 0f27d225d..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLTableRow32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTableRowBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTableRowBeanInfo.java deleted file mode 100644 index f96b10d82..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTableRowBeanInfo.java +++ /dev/null @@ -1,195 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTableRowBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -The HTMLTableRowBeanInfo class provides -bean information for the HTMLTableRow class. -**/ -public class HTMLTableRowBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class beanClass = HTMLTableRow.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor columnCount = new PropertyDescriptor("columnCount", beanClass, - "getColumnCount", null); - columnCount.setBound(false); - columnCount.setConstrained(false); - columnCount.setDisplayName(loader_.getText("PROP_NAME_COUNT")); - columnCount.setShortDescription(loader_.getText("PROP_HTROW_DESC_COUNT")); - - PropertyDescriptor horizontalAlignment = new PropertyDescriptor("horizontalAlignment", beanClass, - "getHorizontalAlignment", "setHorizontalAlignment"); - horizontalAlignment.setBound(true); - horizontalAlignment.setConstrained(true); - horizontalAlignment.setDisplayName(loader_.getText("PROP_NAME_HALIGN")); - horizontalAlignment.setShortDescription(loader_.getText("PROP_HTROW_DESC_HALIGN")); - - PropertyDescriptor verticalAlignment = new PropertyDescriptor("verticalAlignment", beanClass, - "getVerticalAlignment", "setVerticalAlignment"); - verticalAlignment.setBound(true); - verticalAlignment.setConstrained(true); - verticalAlignment.setDisplayName(loader_.getText("PROP_NAME_VALIGN")); - verticalAlignment.setShortDescription(loader_.getText("PROP_HTROW_DESC_VALIGN")); - - PropertyDescriptor lang = new PropertyDescriptor("lang", beanClass, "getLanguage", "setLanguage"); //$B1A - lang.setBound(true); //$B1A - lang.setConstrained(true); //$B1A - lang.setDisplayName(loader_.getText("PROP_NAME_LANGUAGE")); //$B1A - lang.setShortDescription(loader_.getText("PROP_DESC_LANGUAGE")); //$B1A - - PropertyDescriptor dir = new PropertyDescriptor("dir", beanClass, "getDirection", "setDirection"); //$B1A - dir.setBound(true); //$B1A - dir.setConstrained(true); //$B1A - dir.setDisplayName(loader_.getText("PROP_NAME_DIRECTION")); //$B1A - dir.setShortDescription(loader_.getText("PROP_DESC_DIRECTION")); //$B1A - - PropertyDescriptor useFO = new PropertyDescriptor("useFO", beanClass, "isUseFO", "setUseFO"); //@C1A - useFO.setBound(true); //@C1A - useFO.setConstrained(false); //@C1A - useFO.setDisplayName(loader_.getText("PROP_NAME_FORMATTING_OBJECT")); //@C1A - useFO.setShortDescription(loader_.getText("PROP_DESC_FORMATTING_OBJECT")); //@C1A - - - properties_ = new PropertyDescriptor[] { columnCount, horizontalAlignment, verticalAlignment, - lang, dir, useFO }; //$B1C //@C1C - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLTableRow is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLTableRow16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLTableRow32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTagAttributes.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTagAttributes.java deleted file mode 100644 index 4bf55bbd8..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTagAttributes.java +++ /dev/null @@ -1,152 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTagAttributes.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.util.Properties; -import java.util.Enumeration; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; - -/** -* The HTMLTagAttributes class represents any additional HTML tag attributes -* not implemented in the HTML classes. -* -*

    HTMLTagAttributes objects generate the following events: -*

      -*
    • PropertyChangeEvent -*
    -**/ -public abstract class HTMLTagAttributes implements HTMLTagElement, java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - static final long serialVersionUID = -8745891871151787644L; - - private Properties attributes_; // The additional html tag attributes. - - transient PropertyChangeSupport changes_; //@CRS - - - /** - * Constructs a default HTMLTagAttributes. - **/ - public HTMLTagAttributes() - { - super(); - } - - - /** - * Adds a PropertyChangeListener. The specified PropertyChangeListener's - * propertyChange method will be called each time the value of any - * bound property is changed. - * - * @see #removePropertyChangeListener - * - * @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (changes_ == null) changes_ = new PropertyChangeSupport(this); //@CRS - changes_.addPropertyChangeListener(listener); - } - - - /** - * Returns the attribute properties object. - * - * @return The attributes. - **/ - public Properties getAttributes() - { - return attributes_; - } - - - /** - * Returns the attribute string. - * - * @return The attributes. - **/ - public String getAttributeString() - { - if (attributes_ == null) - return ""; - - StringBuffer buffer = new StringBuffer(""); - - Enumeration e = attributes_.propertyNames(); - - while(e.hasMoreElements()) - { - String s = (String)e.nextElement(); - buffer.append(" "); - buffer.append(s); - buffer.append("="); - buffer.append("\""); - buffer.append(attributes_.getProperty(s)); - buffer.append("\""); - } - - return buffer.toString(); - } - - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - - //@CRS changes_ = new PropertyChangeSupport(this); - } - - - /** - * Removes the PropertyChangeListener from the internal list. - * If the PropertyChangeListener is not on the list, nothing is done. - * - * @see #addPropertyChangeListener - * - * @param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (changes_ != null) changes_.removePropertyChangeListener(listener); //@CRS - } - - - /** - * Set the additional HTML tag attributes. - * - * @param attributes The attributes. - **/ - public void setAttributes(Properties attributes) - { - if (attributes == null) - throw new NullPointerException("attributes"); - - Properties old = attributes_; - - attributes_ = attributes; - - if (changes_ != null) changes_.firePropertyChange("attributes", old, attributes_ ); //@CRS - } -} - diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTagAttributesBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTagAttributesBeanInfo.java deleted file mode 100644 index 9aaf98bb3..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTagAttributesBeanInfo.java +++ /dev/null @@ -1,124 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTagAttributesBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - - -/** -* The HTMLTagAttributesBeanInfo class provides bean information for the HTMLTagAttributes class. -**/ -public class HTMLTagAttributesBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = HTMLTagAttributes.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = {changed}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor attributes = new PropertyDescriptor("attributes", beanClass, - "getAttributes", "setAttributes"); - attributes.setBound(true); - attributes.setConstrained(true); - attributes.setDisplayName(loader_.getText("PROP_NAME_ATTRIBUTES")); - attributes.setShortDescription(loader_.getText("PROP_DESC_ATTRIBUTES")); - - properties_ = new PropertyDescriptor[] {attributes}; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTagElement.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTagElement.java deleted file mode 100644 index bf17c1efe..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTagElement.java +++ /dev/null @@ -1,35 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTagElement.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - - -/** - The HTMLTagElement class represents an HTML tag element. -**/ -public interface HTMLTagElement -{ - /** - * Returns the element tag. - * @return The tag. - **/ - public abstract String getTag(); - - /** - * Returns the element tag in XSL-FO. Returns a comment tag if there is no associated XSL-FO tag for the element. - * @return The tag. - **/ - public abstract String getFOTag(); //@B1A - - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLText.java b/cvsroot/src/com/ibm/as400/util/html/HTMLText.java deleted file mode 100644 index 2dd2c74a8..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLText.java +++ /dev/null @@ -1,932 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLText.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; - -import java.awt.Color; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.io.Serializable; -/** -* The HTMLText class encapsulates HTML text attributes. -* -*

    This example creates an HTMLText object and sets its attributes. -* -*

    -*  HTMLText text = new HTMLText("IBM");
    -*  text.setBold(true);
    -*  text.setSize(3);
    -*  System.out.println(text.getTag());
    -*  
    -* -* Here is the output of the tag: -*

    -*  <font size="3"><b>IBM</b></font>
    -*  
    -*

    -* Here is the output of calling getFOTag(): -*

    -*  <fo:block font-size='9pt' font-weight='bold'>IBM</fo:block>
    -*  
    -* -*

    HTMLText objects generate the following events: -*

      -*
    • PropertyChangeEvent -*
    • VetoableChangeEvent -*
    -**/ -public class HTMLText extends HTMLTagAttributes implements HTMLConstants, Serializable // @Z1C -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - static final long serialVersionUID = 8640694441108878894L; - - private String text_; // The text to tag. - private String alignment_; // The horizontal alignment. "left", "center", "right" or "justify". - private Color color_; // The font color attribute. - private int size_ = 0; // The font size attribute. - private boolean bold_ = false; // The bold style attribute. - private boolean fixed_ = false; // The fixed pitch style attribute. - private boolean italic_ = false; // The italic style attribute. - private boolean underscore_ = false; // The underline style attribute. - - private String lang_; // The primary language used to display the tags contents. //$B1A - private String dir_; // The direction of the text interpretation. //$B1A - private boolean useFO_; // Indicates if XSL-FO tags are outputted. //@D1A - - transient private VetoableChangeSupport vetos_; //@CRS - - /** - * Constructs a default HTMLText object. - **/ - public HTMLText() - { - super(); - } - - /** - * Constructs an HTMLText object with the specified text. - * @param text The text. - **/ - public HTMLText(String text) - { - this(); - - try - { - setText(text); - } - catch (PropertyVetoException e) - { /* do nothing */ - } - } - - - - /** - * Adds the VetoableChangeListener. The specified VetoableChangeListener's vetoableChange - * method is called each time the value of any constrained property is changed. - * @see #removeVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); //@CRS - vetos_.addVetoableChangeListener(listener); - } - - /** - * Returns the horizontal alignment. - * @return The horizontal alignment. One of the following constants - * defined in HTMLConstants: LEFT, CENTER, RIGHT, or JUSTIFY. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public String getAlignment() - { - return alignment_; - } - - - /** - * Returns the color used to paint the text. - * @return The Color object representing the text color. - **/ - public Color getColor() // @A1 - { - return color_; - } - - - /** - * Returns the direction of the text interpretation. - * @return The direction of the text. - **/ - public String getDirection() //$B1A - { - return dir_; - } - - - /** - * Returns the direction attribute tag. - * @return The direction tag. - **/ - String getDirectionAttributeTag() //$B1A - { - if(useFO_ ) //@D1A - { //@D1A - if((dir_ != null) && (dir_.length()>0)) //@D1A - { //@D1A - if(dir_.equals(HTMLConstants.RTL)) //@D1A - return " writing-mode='rl'"; //@D1A - else //@D1A - return " writing-mode='lr'"; //@D1A - } //@D1A - else //@D1A - return ""; //@D1A - } //@D1A - else //@D1A - { //@D1A - //@C1D - - if ((dir_ != null) && (dir_.length() > 0)) - return " dir=\"" + dir_ + "\""; - else - return ""; - } //@D1A - } - - - /** - * Returns the end text alignment tag. - * @return The end text alignment tag or an empty String - * if the alignment is not set. - **/ - String getEndTextAlignmentTag() - { - if (alignment_ != null) - return(""); - else - return ""; - } - - /** - * Returns the end font tag. - * @Return The end font size tag or an empty String - * if the size is not set. - **/ - String getEndTextFontTag() - { - if (size_ != 0 || color_ != null || getAttributeString().length() != 0) - { - return(""); - } - else - { - return ""; - } - } - - /** - * Returns the end tags for the text styles. - * The tags are bold, italic, underline, and fixed. - * @return The end text style tag string or an empty String - * if the style attributes are not set. - **/ - String getEndTextStyleTag() - { - StringBuffer tag = new StringBuffer(); - - if (fixed_) - { - if( !useFO_ ) //@D1A - tag.append(""); - } - if (underscore_) - { - if( !useFO_ ) //@D1A - tag.append(""); - else //@D1A - tag.append("\n"); //@D1A - } - if (italic_) - { - if( !useFO_ ) //@D1A - tag.append(""); - } - if (bold_) - { - if( !useFO_ ) //@D1A - tag.append(""); - } - - return tag.toString(); //@D1C - } - - /** - * Returns the font color attribute. - * @return The font color attribute or an empty String if the color is not set. - **/ - String getFontColorAttribute() // @A1 - { - //@C1D - - StringBuffer colorBuffer = new StringBuffer(""); - if (color_ != null) - { - colorBuffer.append(" color=\"#"); - String rgb = Integer.toHexString(color_.getRGB()); - colorBuffer.append(rgb.substring(2)); // don't want 0xff at beginning of RGB string. - colorBuffer.append("\""); - } - return new String(colorBuffer); - } - - /** - * Returns the font size attribute. - * @Return The font size attribute or an empty String - * if the size is not set. - **/ - String getFontSizeAttribute() - { - //@C1D - - StringBuffer tag = new StringBuffer(""); - if (size_ != 0) - { - if(!useFO_ ) //@D1A - { - tag.append(" size=\""); - tag.append(size_); - tag.append("\""); - } - else - { - //@D1A - tag.append(" font-size='"); - tag.append(size_*3); - tag.append("pt'"); - } - } - return tag.toString(); //@D1C - } - - - /** - * Returns the language of the text element. - * @return The language of the input element. - **/ - public String getLanguage() //$B1A - { - return lang_; - } - - - /** - * Returns the language attribute tag. - * @return The language tag. - **/ - String getLanguageAttributeTag() //$B1A - { - //@C1D - - if ((lang_ != null) && (lang_.length() > 0)) - return " lang=\"" + lang_ + "\""; - else - return ""; - } - - - /** - * Returns the font text size. - * The default value is 0 (browser default). - * @return The font size. - **/ - public int getSize() - { - return size_; - } - - /** - * Returns the text tag. The alignment tag is not included. - * @return The tag. - **/ - public String getTag() - { - return getTag(text_, false); - } - - /** - * Returns the XSL-FO text tag. The alignment tag is not included. - * @return The tag. - **/ - public String getFOTag() - { - //@D1A - return getFOTag(text_, false); - } - - /** - * Returns the text tag. - * @param useAlignment true if the alignment tag should be included; false otherwise. - * @return The tag. - **/ - public String getTag(boolean useAlignment) - { - return getTag(text_, useAlignment); - } - - /** - * Returns the XSL-FO text tag. - * @param useAlignment true if the alignment tag should be included; false otherwise. - * @return The tag. - **/ - public String getFOTag(boolean useAlignment) - { - //@D1A - return getFOTag(text_, useAlignment); - } - - /** - * Returns the text tag with the specified text. - * The alignment tag is not included. - * @param text The text. - * @return The tag. - **/ - public String getTag(String text) - { - return getTag(text, false); - } - - /** - * Returns the XSL-FO text tag with the specified text. - * The alignment tag is not included. - * @param text The text. - * @return The tag. - **/ - public String getFOTag(String text) - { - //@D1A - return getFOTag(text, false); - } - - /** - * Returns the text tag with the specified text. - * @param text The text. - * @param useAlignment true if the alignment tag should be included; false otherwise. - * @return The tag. - **/ - public String getTag(String text, boolean useAlignment) - { - //@C1D - - if(useFO_) //@D1A - return getFOTag(text, useAlignment); //@D1A - - if (text == null) - throw new NullPointerException("text"); - - StringBuffer tag = new StringBuffer(); - - if (useAlignment) - tag.append(getTextAlignmentTag()); - - tag.append(getTextFontTag()); - - // if a BiDirectional attribute has been set, add the //$B1A - // bdo tag to the html text string. //$B1A - if (lang_ != null || dir_ != null) //$B1A - { - tag.append("\n\n"); //$B1A - tag.append(getTextStyleTag()); //$B1A - tag.append(text); //$B1A - tag.append(getEndTextStyleTag()); //$B1A - tag.append("\n\n"); //$B1A - - } - else //$B1A - { - tag.append(getTextStyleTag()); - tag.append(text); - tag.append(getEndTextStyleTag()); - } - tag.append(getEndTextFontTag()); - if (useAlignment) - tag.append(getEndTextAlignmentTag()); - return tag.toString(); //@D1C - - } - - /** - * Returns the XSL-FO text tag with the specified text. - * The fixed pitch and language attributes are not supported by XSL-FO. - * @param text The text. - * @param useAlignment true if the alignment tag should be included; false otherwise. - * @return The tag. - **/ - public String getFOTag(String text, boolean useAlignment) //@D1A - { - //Save current state of useFO_ - boolean useFO = useFO_; - - setUseFO(true); - - if (text == null) - throw new NullPointerException("text"); - - StringBuffer tag = new StringBuffer(); - - if (dir_ != null) - { - tag.append("\n"); - } - - tag.append(""); - tag.append(text); - tag.append(getEndTextStyleTag()); - tag.append("\n"); - - if (dir_ != null) - { - tag.append("\n"); - } - - //Set useFO_ to previous state - setUseFO(useFO); - return tag.toString(); - - } - - /** - * Returns the text. - * @return The text. - **/ - public String getText() - { - return text_; - } - - /** - * Returns the text alignment tag. - * @return The text alignment tag or an empty String - * if the alignment is not set. - **/ - String getTextAlignmentTag() - { - if(!useFO_ ) //@D1A - { //@D1A - //@C1D - - if (alignment_ != null) - { - StringBuffer tag = new StringBuffer(); - tag.append("
    "); - - return tag.toString(); //@D1C - } - else - return ""; - } //@D1A - else - { - //@D1A - if (alignment_!= null) - { - StringBuffer tag = new StringBuffer(); - tag.append(" text-align='"); - if(alignment_.equals("center")) - tag.append("center'"); - else if(alignment_.equals("right")) - tag.append("end'"); - else if(alignment_.equals("left")) - tag.append("start'"); - else if(alignment_.equals("justify")) - tag.append("justify'"); - return tag.toString(); - - } - else - return ""; - - } - } - - /** - * Returns the font attribute tag. - * @return The font attribute tag or an empty String if the font attributes are not set. - **/ - String getTextFontTag() // @A1 - { - StringBuffer tag = new StringBuffer(""); - - String extraAttributes = getAttributeString(); // @Z1A - - if (size_ != 0 || color_ != null || extraAttributes.length() != 0) // @Z1C - { - if( !useFO_ ) //@D1A - { - tag.append(""); - } //@D1A - else - { - //@D1A - tag.append(getFontSizeAttribute()); - tag.append(getFontColorAttribute()); - } - } - return tag.toString(); //@D1C - } - - /** - * Returns the text style tags. The tags are - * bold, italic, underline, and fixed. - * @return The text style tag string or an empty String - * if the style attributes are not set. - **/ - String getTextStyleTag() - { - //@C1D - - StringBuffer tag = new StringBuffer(); - - if (bold_) - { - if(!useFO_) //@D1A - tag.append(""); - else //@D1A - tag.append(" font-weight='bold'"); //@d1 - } - if (italic_) - { - if(!useFO_ ) //@D1A - tag.append(""); - else //@D1A - tag.append(" font-style='italic'"); //@D1A - } - if (underscore_) - { - if(!useFO_) //@D1A - tag.append(""); - else //@D1A - tag.append(">\n"); - } - - return tag.toString(); //@D1C - } - - - /** - * Indicates if bold is on. - * @return true if bold, false otherwise. - **/ - public boolean isBold() - { - return bold_; - } - - /** - * Indicates if fixed pitch font is on. - * @return true if fixed, false otherwise. - **/ - public boolean isFixed() - { - return fixed_; - } - - /** - * Indicates if italic is on. - * @return true if italic, false otherwise. - **/ - public boolean isItalic() - { - return italic_; - } - - /** - * Indicates if underline is on. - * @return true if underline, false otherwise. - **/ - public boolean isUnderscore() - { - return underscore_; - } - - - /** - * Returns if Formatting Object tags are outputted. - * The default value is false. - * @return true if the output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public boolean isUseFO() //@D1A - { - return useFO_; - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS vetos_ = new VetoableChangeSupport(this); - } - - - - /** - * Removes the VetoableChangeListener from the internal list. - * If the VetoableChangeListener is not on the list, nothing is done. - * @see #addVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ != null) vetos_.removeVetoableChangeListener(listener); //@CRS - } - - /** - * Sets the horizontal alignment. - * @param alignment The horizontal alignment. One of the following constants - * defined in HTMLConstants: LEFT, CENTER, RIGHT, or JUSTIFY. - * @exception PropertyVetoException If the change is vetoed. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setAlignment(String alignment) throws PropertyVetoException - { - if (alignment == null) - { - throw new NullPointerException("alignment"); - } - else if (alignment.equalsIgnoreCase(LEFT) || - alignment.equalsIgnoreCase(CENTER) || - alignment.equalsIgnoreCase(RIGHT) || - alignment.equalsIgnoreCase(JUSTIFY)) - { - String old = alignment_; - if (vetos_ != null) vetos_.fireVetoableChange("alignment", old, alignment ); //@CRS - - alignment_ = alignment; - - if (changes_ != null) changes_.firePropertyChange("alignment", old, alignment ); //@CRS - - } - else - { - throw new ExtendedIllegalArgumentException("alignment", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - - - - /** - * Sets bold on or off. The default is false. - * @param bold true if on, false if off. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setBold(boolean bold) throws PropertyVetoException - { - //@CRS Boolean oldBold = new Boolean(bold_); - //@CRS Boolean newBold = new Boolean(bold); - boolean oldBold = bold_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("bold", new Boolean(oldBold), new Boolean(bold)); //@CRS - - bold_ = bold; - - if (changes_ != null) changes_.firePropertyChange("bold", new Boolean(oldBold), new Boolean(bold)); //@CRS - } - - /** - * Sets the color used to paint the text. - * The default text color is determined by the browser's color settings. - * How the color is rendered is browser dependent. - * @param color The Color object. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setColor(Color color) throws PropertyVetoException // @A1 - { - Color oldColor = color_; - - if (vetos_ != null) vetos_.fireVetoableChange("color", oldColor, color); //@CRS - - color_ = color; - - if (changes_ != null) changes_.firePropertyChange("color", oldColor, color); //@CRS - } - - /** - * Sets the direction of the text interpretation. - * @param dir The direction. One of the following constants - * defined in HTMLConstants: LTR or RTL. - * - * @see com.ibm.as400.util.html.HTMLConstants - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setDirection(String dir) //$B1A - throws PropertyVetoException - { - if (dir == null) - throw new NullPointerException("dir"); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - { - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - String old = dir_; - if (vetos_ != null) vetos_.fireVetoableChange("dir", old, dir ); //@CRS - - dir_ = dir; - - if (changes_ != null) changes_.firePropertyChange("dir", old, dir ); //@CRS - } - - - - /** - * Sets fixed pitch font on or off. The default is false. - * @param fixed true if on, false if off. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setFixed(boolean fixed) throws PropertyVetoException - { - //@CRS Boolean oldFixed = new Boolean(fixed_); - //@CRS Boolean newFixed = new Boolean(fixed); - boolean oldFixed = fixed_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("fixed", new Boolean(oldFixed), new Boolean(fixed)); //@CRS - - fixed_ = fixed; - - if (changes_ != null) changes_.firePropertyChange("fixed", new Boolean(oldFixed), new Boolean(fixed)); //@CRS - } - - /** - * Sets italic on or off. The default is false. - * @param italic true if on, false if off. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setItalic(boolean italic) throws PropertyVetoException - { - //@CRS Boolean oldItalic = new Boolean(italic_); - //@CRS Boolean newItalic = new Boolean(italic); - boolean oldItalic = italic_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("italic", new Boolean(oldItalic), new Boolean(italic)); //@CRS - - italic_ = italic; - - if (changes_ != null) changes_.firePropertyChange("italic", new Boolean(oldItalic), new Boolean(italic)); //@CRS - } - - /** - * Sets the language of the text tag. - * @param lang The language. Example language tags include: - * en and en-US. - * - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setLanguage(String lang) //$B1A - throws PropertyVetoException - { - if (lang == null) - throw new NullPointerException("lang"); - - String old = lang_; - if (vetos_ != null) vetos_.fireVetoableChange("lang", old, lang ); //@CRS - - lang_ = lang; - - if (changes_ != null) changes_.firePropertyChange("lang", old, lang ); //@CRS - } - - /** - * Sets the text font size. Valid values are: 0 to 7. - * The default value is 0 (use browser default). - * @param size The font size. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setSize(int size) throws PropertyVetoException - { - if (size < 0 || size > 7) - throw new ExtendedIllegalArgumentException("size", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - //@CRS Integer oldSize = new Integer(size_); - //@CRS Integer newSize = new Integer(size); - int oldSize = size_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("size", new Integer(oldSize), new Integer(size) ); //@CRS - - size_ = size; - - if (changes_ != null) changes_.firePropertyChange("size", new Integer(oldSize), new Integer(size) ); //@CRS - } - - /** - * Sets the text. - * @param text The text. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setText(String text) throws PropertyVetoException - { - if (text == null) - throw new NullPointerException("text"); - - String old = text_; - if (vetos_ != null) vetos_.fireVetoableChange("text", old, text ); //@CRS - - text_ = text; - - if (changes_ != null) changes_.firePropertyChange("text", old, text ); //@CRS - } - - /** - * Sets underline on or off. The default is false. - * @param underscore true if on, false if off. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setUnderscore(boolean underscore) throws PropertyVetoException - { - //@CRS Boolean oldUnderscore = new Boolean(underscore_); - //@CRS Boolean newUnderscore = new Boolean(underscore); - boolean oldUnderscore = underscore_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("underscore", new Boolean(oldUnderscore), new Boolean(underscore)); //@CRS - - underscore_ = underscore; - - if (changes_ != null) changes_.firePropertyChange("underscore", new Boolean(oldUnderscore), new Boolean(underscore)); //@CRS - } - - /** - * Sets if Formatting Object tags should be used. - * The default value is false. - * @param useFO - true if output generated is an XSL formatting object, false if the output generated is HTML. - **/ - public void setUseFO(boolean useFO) //@D1A - { - boolean old = useFO_; - - useFO_ = useFO; - - if (changes_ != null) changes_.firePropertyChange("useFO", old, useFO ); - } - - /** - * Returns the HTML text tag. - * @return The tag. - **/ - public String toString() - { - return getTag(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLText16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLText16.gif deleted file mode 100644 index 8d707da9e..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLText16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLText32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLText32.gif deleted file mode 100644 index 8d4b1b159..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLText32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTextBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTextBeanInfo.java deleted file mode 100644 index dd9544b74..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTextBeanInfo.java +++ /dev/null @@ -1,232 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTextBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -The HTMLTextBeanInfo class provides -bean information for the HTMLText class. -**/ -public class HTMLTextBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class beanClass = HTMLText.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor alignment = new PropertyDescriptor("alignment", beanClass, - "getAlignment", "setAlignment"); - alignment.setBound(true); - alignment.setConstrained(true); - alignment.setDisplayName(loader_.getText("PROP_NAME_ALIGNMENT")); - alignment.setShortDescription(loader_.getText("PROP_HTXT_DESC_ALIGNMENT")); - - PropertyDescriptor bold = new PropertyDescriptor("bold", beanClass, - "isBold", "setBold"); - bold.setBound(true); - bold.setConstrained(true); - bold.setDisplayName(loader_.getText("PROP_NAME_BOLD")); - bold.setShortDescription(loader_.getText("PROP_DESC_BOLD")); - - PropertyDescriptor color = new PropertyDescriptor("color", beanClass, - "getColor", "setColor"); - color.setBound(true); - color.setConstrained(true); - color.setDisplayName(loader_.getText("PROP_NAME_COLOR")); - color.setShortDescription(loader_.getText("PROP_DESC_COLOR")); - - PropertyDescriptor fixed = new PropertyDescriptor("fixed", beanClass, - "isFixed", "setFixed"); - fixed.setBound(true); - fixed.setConstrained(true); - fixed.setDisplayName(loader_.getText("PROP_NAME_FIXED")); - fixed.setShortDescription(loader_.getText("PROP_DESC_FIXED")); - - PropertyDescriptor italic = new PropertyDescriptor("italic", beanClass, - "isItalic", "setItalic"); - italic.setBound(true); - italic.setConstrained(true); - italic.setDisplayName(loader_.getText("PROP_NAME_ITALIC")); - italic.setShortDescription(loader_.getText("PROP_DESC_ITALIC")); - - PropertyDescriptor size = new PropertyDescriptor("size", beanClass, - "getSize", "setSize"); - size.setBound(true); - size.setConstrained(true); - size.setDisplayName(loader_.getText("PROP_NAME_SIZE")); - size.setShortDescription(loader_.getText("PROP_HTXT_DESC_SIZE")); - - PropertyDescriptor text = new PropertyDescriptor("text", beanClass, - "getText", "setText"); - text.setBound(true); - text.setConstrained(true); - text.setDisplayName(loader_.getText("PROP_NAME_TEXT")); - text.setShortDescription(loader_.getText("PROP_HTXT_DESC_TEXT")); - - PropertyDescriptor underscore = new PropertyDescriptor("underscore", beanClass, - "isUnderscore", "setUnderscore"); - underscore.setBound(true); - underscore.setConstrained(true); - underscore.setDisplayName(loader_.getText("PROP_NAME_UNDERSCORE")); - underscore.setShortDescription(loader_.getText("PROP_DESC_UNDERSCORE")); - - PropertyDescriptor lang = new PropertyDescriptor("lang", beanClass, //$B3A - "getLanguage", "setLanguage"); //$B3A - lang.setBound(true); //$B3A - lang.setConstrained(true); //$B3A - lang.setDisplayName(loader_.getText("PROP_NAME_LANGUAGE")); //$B3A - lang.setShortDescription(loader_.getText("PROP_DESC_LANGUAGE")); //$B3A - - PropertyDescriptor dir = new PropertyDescriptor("dir", beanClass, //$B3A - "getDirection", "setDirection"); //$B3A - dir.setBound(true); //$B3A - dir.setConstrained(true); //$B3A - dir.setDisplayName(loader_.getText("PROP_NAME_DIRECTION")); //$B3A - dir.setShortDescription(loader_.getText("PROP_DESC_DIRECTION")); //$B3A - - PropertyDescriptor useFO = new PropertyDescriptor("useFO", beanClass, "isUseFO", "setUseFO"); //@C1A - useFO.setBound(true); //@C1A - useFO.setConstrained(false); //@C1A - useFO.setDisplayName(loader_.getText("PROP_NAME_FORMATTING_OBJECT")); //@C1A - useFO.setShortDescription(loader_.getText("PROP_DESC_FORMATTING_OBJECT")); //@C1A - - - properties_ = new PropertyDescriptor[] { alignment, bold, color, fixed, italic, //$B3C - size, text, underscore, lang, dir, useFO }; //$B3C //@C1C - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * HTMLText is a subclass of HTMLTagAttributes, this method - * will return a HTMLTagAttributesBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() // @Z1A - { - return new BeanInfo[] { new HTMLTagAttributesBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLText16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLText32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTransform.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTransform.java deleted file mode 100644 index b5cf240d0..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTransform.java +++ /dev/null @@ -1,225 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTransform.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import com.ibm.as400.access.Trace; - -/** -* The HTMLTransform class encodes and decodes a string's tags for use in -* an HTMLTagElement's control name, initial value, or displayed text. There are -* a set of special characters reserved for creating HTML tags. Those -* special characters have a corresponding set of replacement characters that allow -* users to visually see those characters in a browser. -* -*

    For example, if you wanted to set the value attribute of a TextFormInput object -* to a resource link so you could see the HTML link in the text input box, the HTML link -* tag would need to be encoded to see the special characters(<, >, and "): -*

    -*  <input type="text" name="myText" value="<a href="http://www.myLink.com/">Link</a>" />
    -*  
    -* -*

    The following example uses the HTMLEncoder class to encode and decode the value of -* a TextFormInput so it displays properly: -*

    -*  // The string to use for the TextFormInput value attribute.
    -*  String s = new String("<a href="http://www.myLink.com/">Link</a>");
    -*  // Encode the string.
    -*  String e = HTMLTransform.encode(s);
    -*  // Create the TextFormInput object.
    -*  TextFormInput input = new TextFormInput("myText", e);
    -*  // Set the input size so the entire value can be seen.
    -*  input.setSize(45);
    -*  
    -* System.out.println("TAG: " + input.getTag() + "\n"); -* // Output the string with the special characters encoded for display in a browser. -* System.out.println("Encoded: " + e + "\n"); -* // Output the string with the specials characters decoded back to the original string. -* System.out.println("Decoded: " + HTMLTransform.decode(e)); -*
    -* -*

    Here is what will be produced: -*

    -*  // The TextFormInput with an encoded string.
    -*  <input type="text" name="myText" value="&lt;a href=&quot;http://www.myLink.com/&quot;&gt;Link&lt;/a&gt;" size="45" />
    -*  // The encoded string.
    -*  &lt;a href=&quot;http://www.myLink.com/&quot;&gt;Link&lt;/a&gt;
    -*  // The decode string.
    -*  <a href="http://www.myLink.com/">Link</a>
    -*  
    -* -*

    Here is what the browser will show: -* -* -* -* -* -*

    The tags that are encoded include: -*

      -*
    • " -*
    • & -*
    • < -*
    • > -*
    -**/ -public class HTMLTransform -{ - /** - * Encodes the HTML string, which can contain HTML tags such as < , >, ", or &. - * @param source The HTML string containing HTML tags to be encoded. - * @return The encoded string. - **/ - public static String encode(String source) - { - if (source == null) - throw new NullPointerException("source"); - - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Encoding HTML string..."); - - StringBuffer dest = new StringBuffer(); - - for (int i=0; i': - dest.append(">"); - break; - default: - dest.append(source.charAt(i)); - break; - } - } - - return dest.toString(); - } - - - /** - * Decodes the HTML string, which can contain replacement characters - * for HTML tags such as &lt;, &gt;, &quot;, or &amp;. - * - * @param source The HTML string containing HTML replacement characters to be decoded. - * - * @return The decoded string. - **/ - public static String decode(String source) - { - if (source == null) - throw new NullPointerException("source"); - - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Decoding HTML string..."); - - StringBuffer dest = new StringBuffer(); - - int index = source.indexOf("&"); // location of the first special character set. - int endIndex = 0; // the end of the current special character set. - - // loop while there are more special characters to decode. - while (index >= 0) - { - // if the special characters appear at the beginning of the string. - if (index == 0) - { - // Find which character set is in the first position. - if (source.indexOf(""") == 0) - { - // Append the replacement character to the buffer if - // this is the character set found at the beginning of the string. - // Then set the endIndex to the position after the character set. - dest.append("\""); - endIndex = 6; - } - else if (source.indexOf("&") == 0) - { - dest.append("&"); - endIndex = 5; - } - else if (source.indexOf("<") == 0) - { - dest.append("<"); - endIndex = 4; - } - else if (source.indexOf(">") == 0) - { - dest.append(">"); - endIndex = 4; - } - - } - else - { - // find the end semi-colon for the special characters, so we can - // create a substring to find out which special character it matches. - int semiColon = source.indexOf(";", endIndex); - - if (source.substring(index, semiColon).equals(""")) - { - // first append the characters before the special set of characters - // and after any special characters already found - dest.append(source.substring(endIndex, index)); - // append the replacement for the special characters - dest.append("\""); - - } - else if (source.substring(index, semiColon).equals("&")) - { - dest.append(source.substring(endIndex, index)); - dest.append("&"); - - } - else if (source.substring(index, semiColon).equals("<")) - { - dest.append(source.substring(endIndex, index)); - dest.append("<"); - - } - else if (source.substring(index, semiColon).equals(">")) - { - dest.append(source.substring(endIndex, index)); - dest.append(">"); - - } - - // set the starting point for the next indexOf to the end of the special characters found, - // which is the next position after the semi-colon. - endIndex = semiColon + 1; - - } - // find the next occurrence of & after the last one we found. - index = source.indexOf("&", endIndex); - } - - // @A1A - // If the string does not contain a special character or contains text after a special character, then need to append the - // remainder of the text or the rest of the text string passed in. - if(index == -1) - { - dest.append(source.substring(endIndex,source.length())); - } - - return dest.toString(); - } -} - diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTree.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTree.java deleted file mode 100644 index acc6295e0..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTree.java +++ /dev/null @@ -1,649 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTree.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.util.Vector; -import java.util.Date; -import java.text.Collator; // @A1A -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; - -import javax.servlet.http.HttpServletRequest; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalStateException; - - -/** -* The HTMLTree class represents an HTML hierarchical tree of HTML elements. -* -*

    -* This example creates an HTMLTree object with five elements. -* The first three elements will be added directly to the HTMLTree and the remaining two -* elements will extend off one of the first three elements. -* -*

    -* -*

    -*  // Create a URLParser object.
    -*  URLParser urlParser = new URLParser(myHttpServletRequest.getRequestURI());
    -*  

    -* // Create parent HTMLTreeElements. -* HTMLTreeElement parentElement = new HTMLTreeElement(); -* parentElement.setTextUrl(new HTMLHyperlink("http://myWebPage", "My Web Page")); -*

    -* HTMLTreeElement parentElement2 = new HTMLTreeElement(); -* parentElement2.setText(new HTMLText("Parent Element 2")); -*

    -* HTMLTreeElement parentElement3 = new HTMLTreeElement(); -* parentElement3.setText(new HTMLText("Parent Element 3")); -*

    -* // Create children HTMLTreeElements. -* HTMLTreeElement childElement1 = new HTMLTreeElement(); -* childElement1.setTextUrl(new HTMLHyperlink("http://anotherWebPage", "Another Web Page")); -* parentElement.addElement(childElement1); -*

    -* // Create a child of the first Child Element. -* HTMLTreeElement subChildElement1 = new HTMLTreeElement(); -* subChildElement1.setText(new HTMLHyperlink("http://myHomePage", "Home")); -*

    -* // Add the sub-child to the parent child element. -* childElement1.addElement(subChildElement1); -*

    -* // Set the URL link for the Expand/Collapsed Icon. -* ServletHyperlink iconUrl = new ServletHyperlink(urlParser.getURI()); -* iconUrl.setHttpServletResponse(resp); -* parentElement.setIconUrl(iconUrl); -* parentElement2.setIconUrl(iconUrl); -* parentElement3.setIconUrl(iconUrl); -*

    -* // Add the parent elements to the tree. -* tree.addElement(parentElement); -* tree.addElement(parentElement2); -* tree.addElement(parentElement3); -*

    -* -*

    -* When the HTMLTree is first viewed in a browser, none of the elements in the tree will be -* expanded, so the tree will look like this: -*

    -* -* -* -* -* -* -* -* -* -* -* -* -* -* -*
    -* + -* -* My Web Page
    -* -* Parent Element 2 -*
    -* -* Parent Element 3 -*
    -* -*

    -* When the elements in the HTMLTree are expanded by traversing the hierarchy, the tree will look like: -*

    -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -*
    -* - -* -* My Web Page
      -* -* -* -* -* -* -*
    -* - -* -* Another Web Page
      -* -* -* -* -* -*
    -* -* Home -*
    -*
    -*
    -* -* Parent Element 2 -*
    -* -* Parent Element 3 -*
    -* -*

    -* HTMLTree objects generate the following events: -*

      -*
    • ElementEvent - The events fired are: -*
        -*
      • elementAdded -*
      • elementRemoved -*
      -*
    • PropertyChangeEvent -*
    -* -* @see com.ibm.as400.util.html.HTMLTreeElement -* @see com.ibm.as400.util.html.URLParser -**/ -public class HTMLTree implements HTMLTagElement, java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2002 International Business Machines Corporation and others."; - static final long serialVersionUID = 4170861562301214202L; - - private HTMLVector branches_; //@P2C - private HttpServletRequest request_; - private boolean sort_ = true; // @A1A - transient private Collator collator_; // @A1A @B2C - - transient private PropertyChangeSupport changes_; //@P2C - transient private Vector elementListeners_; // The list of element listeners @P2C - - - /** - * Constructs a default HTMLTree object. - **/ - public HTMLTree() - { - super(); - - // @B2A - // If the locale is Korean, then this throws - // an ArrayIndexOutOfBoundsException. This is - // a bug in the JDK. The workarond in that case - // is just to use String.compareTo(). - try // @B2A - { - collator_ = Collator.getInstance (); // @B2A - collator_.setStrength (Collator.PRIMARY); // @B2A - } - catch (Exception e) // @B2A - { - collator_ = null; // @B2A - } - - branches_ = new HTMLVector(); //@P2C - } - - - /** - * Constructs an HTMLTree object with the specified HttpServletRequest. - * The request is the mechanism used to provide continuity while expanding - * and collapsing the tree. - **/ - public HTMLTree(HttpServletRequest request) - { - this(); - setHttpServletRequest(request); - } - - - /** - * Adds an HTMLTreeElement to the tree. - * - * @param element The HTMLTreeElement. - **/ - public void addElement(HTMLTreeElement element) - { - if (element == null) - throw new NullPointerException("element"); - - //@B3D - - branches_.addElement(element); - - if (elementListeners_ != null) fireElementEvent(ElementEvent.ELEMENT_ADDED); //@P2C - } - - - /** - * Adds an addElementListener. - * The specified addElementListeners elementAdded method will - * be called each time a RadioFormInput is added to the group. - * The addElementListener object is added to a list of addElementListeners - * managed by this RadioFormInputGroup. It can be removed with removeElementListener. - * - * @see #removeElementListener - * - * @param listener The ElementListener. - **/ - public void addElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (elementListeners_ == null) elementListeners_ = new Vector(); //@P2A - elementListeners_.addElement(listener); - } - - /** - * Adds a PropertyChangeListener. The specified - * PropertyChangeListener's propertyChange - * method is called each time the value of any - * bound property is changed. - * - * @see #removePropertyChangeListener - * @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (changes_ == null) changes_ = new PropertyChangeSupport(this); //@P2A - changes_.addPropertyChangeListener(listener); - } - - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - // @B2A - // If the locale is Korean, then this throws - // an ArrayIndexOutOfBoundsException. This is - // a bug in the JDK. The workarond in that case - // is just to use String.compareTo(). - try // @B2A - { - collator_ = Collator.getInstance (); // @B2A - collator_.setStrength (Collator.PRIMARY); // @B2A - } - catch (Exception e) // @B2A - { - collator_ = null; // @B2A - } - - in.defaultReadObject(); - - //@P2D changes_ = new PropertyChangeSupport(this); - //@P2D elementListeners = new Vector(); - } - - - /** - * Removes an HTMLTreeElement from the tree. - * - * @param element The HTMLTreeElement. - **/ - public void removeElement(HTMLTreeElement element) - { - if (element == null) - throw new NullPointerException("element"); - - //@B3D - - if (branches_.removeElement(element) && elementListeners_ != null) //@P2C - fireElementEvent(ElementEvent.ELEMENT_REMOVED); - } - - - /** - * Removes this ElementListener from the internal list. - * If the ElementListener is not on the list, nothing is done. - * - * @see #addElementListener - * - * @param listener The ElementListener. - **/ - public void removeElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (elementListeners_ != null) elementListeners_.removeElement(listener); //@P2C - } - - - /** - * Removes the PropertyChangeListener from the internal list. - * If the PropertyChangeListener is not on the list, nothing is done. - * - * @see #addPropertyChangeListener - * @param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (changes_ != null) changes_.removePropertyChangeListener(listener); //@P2C - } - - - /** - * Fires the element event. - **/ - private void fireElementEvent(int evt) - { - Vector targets; - targets = (Vector) elementListeners_.clone(); - ElementEvent elementEvt = new ElementEvent(this, evt); - for (int i = 0; i < targets.size(); i++) - { - ElementListener target = (ElementListener)targets.elementAt(i); - if (evt == ElementEvent.ELEMENT_ADDED) - target.elementAdded(elementEvt); - else if (evt == ElementEvent.ELEMENT_REMOVED) - target.elementRemoved(elementEvt); - } - } - - - /** - * Returns the HttpServletRequest. - * - * @return The request. - **/ - public HttpServletRequest getHttpServletRequest() - { - return request_; - } - - - /** - * Returns the Collator. - * - * @return The collator. - **/ - public Collator getCollator() // @B2A - { - return collator_; - } - - - /** - * Returns a comment tag. - * This method should not be called. There is no XSL-FO support for this class. - * @return The comment tag. - **/ - public String getFOTag() //@C1A - { - Trace.log(Trace.ERROR, "Attempting to getFOTag() for an object that doesn't support it."); - return ""; - } - - /** - * Returns the HTMLTree tag. - * - * @return The tag. - **/ - public String getTag() - { - //@B3D - - if (request_ == null) - throw new ExtendedIllegalStateException("request", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - - // Get the hashcode parameter from the HTTP request. - String hcStr = request_.getParameter("hashcode"); // @B1C - - StringBuffer buf1 = new StringBuffer("\n"); - - - if (sort_) sort(collator_, branches_); // @A1A @B2C @P2C - - int size = branches_.getCount(); //@P2A - Object[] data = branches_.getData(); //@P2A - for (int i=0; i\n"); - - - return buf1.toString(); - } - - - /** - * Sets the collator. The collator allows the tree to perform - * locale-sensitive String comparisons when sorting the tree elements. - * - * @param collator The Collator. - **/ - public void setCollator(Collator collator) // @B2A - { - if (collator == null) - throw new NullPointerException("collator"); - - Collator old = collator_; - - collator_ = collator; - - if (changes_ != null) changes_.firePropertyChange("collator", old, collator_); //@P2C - } - - - /** - * Sets the Http servlet request. The request is the mechanism - * used to provide continuity while expanding and collapsing the tree. - * - * @param request The Http servlet request. - **/ - public void setHttpServletRequest(HttpServletRequest request) - { - if (request == null) - throw new NullPointerException("request"); - - HttpServletRequest old = request_; - - request_ = request; - - if (changes_ != null) changes_.firePropertyChange("request", old, request_); //@P2C - } - - - /** - * Sorts the elements within the HTMLTree. - * - * @param sort true if the elements are sorted; false otherwise. - * The default is true. - **/ - public void sort(boolean sort) // @A1A - { - sort_ = sort; - } - - - /** - * Sorts a vector of objects. - * - * @param collator The Collator, or null if the default Collator should be used. - * @param list The objects. - * - * @return The sorted Vector. - **/ - public static Vector sort (Collator collator, Vector list) // @A1A @B2C @B4C @P2C - { - heapSort(collator, list); // @B2A - - return list; - } - - - /** - * Method used to perform a heap sort, - * which is faster than a quick sort and - * a bubble sort. - * - * @param collator The collator. - * @param sortlist The list to sort. - **/ - private static void heapSort(Collator collator, Vector sortlist) // @B2A - { - int numberOfEntries = sortlist.size(); - int i; - Object temp = null; - - if (numberOfEntries > 0) - { - // convert table list map into a heap - for (i = (numberOfEntries/2); i != 0; i--) - { - adjustList(collator, sortlist,i,numberOfEntries); - } - - // sort table list - for (i = (numberOfEntries - 1); i != 0; i--) - { - // swap first and last entries in heap to get largest remaining - // table name correctly placed - temp = sortlist.elementAt(i); - sortlist.setElementAt(sortlist.elementAt(0),i); - sortlist.setElementAt(temp,0); - - // create new heap with the remaining nodes - adjustList(collator, sortlist,1,i); - } - } - - } - - - /** - * Utility routine used by heap sort - **/ - private static void adjustList(Collator collator, Vector sortlist, int rootIndex, int maxIndex) // @B2A - { - Object rootItem = sortlist.elementAt(rootIndex-1); - int j = rootIndex * 2; - Object itemAtJ = null; - Object itemAtJLess1 = null; - boolean done = false; - - // traverse tree - while ((j <= maxIndex) && (done == false)) - { - itemAtJLess1 = sortlist.elementAt(j-1); - - if (j < maxIndex) - { - itemAtJ = sortlist.elementAt(j); - - // find greater table name of left and right child - if (sortCompare(collator, itemAtJLess1, itemAtJ) < 0) - { - j++; - itemAtJLess1 = itemAtJ; - } - } - - // if root table name is greater than max child - if (sortCompare(collator, rootItem, itemAtJLess1) >= 0) - done = true; - - // root table name less than max child - else - { - // move max child up tree - sortlist.setElementAt(sortlist.elementAt(j-1),(j/2)-1); - // move to next level - j = j * 2; - } - } - - // place original root in proper place - sortlist.setElementAt(rootItem,(j/2)-1); - } - - - /** - * Compares two objects for the sort. - * - * @param objectI The ith object. - * @param objectJ The jth object. - * @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater - * than the second. - **/ - private static int sortCompare (Collator collator, Object objectI, Object objectJ) // @A1A - { - Object valueI; - Object valueJ; - - // When the object is a HTMLTreeElement or FileTreeElement the - // sort must be done against the name or viewable text - // of the element otherwise nothing will be sorted properly. - if (objectI instanceof FileTreeElement) - { // @B2C - valueI = ((FileTreeElement)objectI).getFile().getName(); - valueJ = ((FileTreeElement)objectJ).getFile().getName(); - } - else if (objectI instanceof HTMLTreeElement) // @B2C - { - valueI = ((HTMLTreeElement)objectI).getText(); - valueJ = ((HTMLTreeElement)objectJ).getText(); - } - else - { - valueI = objectI.toString(); - valueJ = objectJ.toString(); - } - - // Check for nulls. - if (valueI == null) - valueI = ""; - if (valueJ == null) - valueJ = ""; - - int comparison = 0; - - // If they are equal, then use the next column. - if (collator != null) // Otherwise, do the comparison using this column. - comparison = collator.compare (valueI.toString(), valueJ.toString()); // @B2C - else - comparison = valueI.toString().compareTo(valueJ.toString()); // @B2C - - // Return the value. - return comparison; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTree16.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLTree16.gif deleted file mode 100644 index 759ceba1b..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLTree16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTree32.gif b/cvsroot/src/com/ibm/as400/util/html/HTMLTree32.gif deleted file mode 100644 index 75962b464..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/html/HTMLTree32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTreeBeanInfo.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTreeBeanInfo.java deleted file mode 100644 index 933c49b8a..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTreeBeanInfo.java +++ /dev/null @@ -1,147 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTreeBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -The HTMLTreeBeanInfo class provides -bean information for the HTMLTree class. -**/ -public class HTMLTreeBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Class this bean info represents. - private final static Class beanClass = HTMLTree.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_h loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = { changed }; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor request = new PropertyDescriptor("httpServletRequest", beanClass, - "getHttpServletRequest", "setHttpServletRequest"); - request.setBound(true); - request.setConstrained(false); - request.setDisplayName(loader_.getText("PROP_NAME_REQUEST")); - request.setShortDescription(loader_.getText("PROP_DESC_REQUEST")); - - PropertyDescriptor collator = new PropertyDescriptor("collator", beanClass, // @B1A - "getCollator", "setCollator"); // @B1A - collator.setBound(true); // @B1A - collator.setConstrained(false); // @B1A - collator.setDisplayName(loader_.getText("PROP_NAME_COLLATOR")); // @B1A - collator.setShortDescription(loader_.getText("PROP_DESC_COLLATOR")); // @B1A - - properties_ = new PropertyDescriptor[] { request, collator }; // @B1C - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("HTMLTree16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("HTMLTree32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/html/HTMLTreeElement.java b/cvsroot/src/com/ibm/as400/util/html/HTMLTreeElement.java deleted file mode 100644 index d78359d96..000000000 --- a/cvsroot/src/com/ibm/as400/util/html/HTMLTreeElement.java +++ /dev/null @@ -1,790 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTreeElement.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.html; - -import java.util.Vector; -import java.util.Properties; -import java.text.Collator; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.util.servlet.ServletHyperlink; - -/** -* The HTMLTreeElement class represents an hierarchial element within an HTMLTree or other -* HTMLTreeElements. -* -*

    This example creates an HTMLTreeElement object. -* -*

    -*

    -*  // Create parent HTMLTreeElement.
    -*  HTMLTreeElement parentElement = new HTMLTreeElement();
    -*  parentElement.setTextUrl(new HTMLHyperlink("http://myWebPage", "My Web Page"));
    -*  

    -* // Create HTMLTreeElement Child. -* HTMLTreeElement childElement = new HTMLTreeElement(); -* childElement.setTextUrl(new HTMLHyperlink("http://anotherWebPage", "Another Web Page")); -* parentElement.addElement(childElement); -*

    -* -*

    -* -* Once the elements are added to an HTMLTree object and the elements are expanded, the -* HTMLTreeElements will look like this: -*

    -* -*

    -* -* -* -* -* -*
    -* - -* -* My Web Page -*
      -* -* -* -* -* -* -*
    -* - -* -* Another Web Page -*
    -*
    -* -*

    -* HTMLTreeElement objects generate the following events: -*

      -*
    • ElementEvent - The events fired are: -*
        -*
      • elementAdded -*
      • elementRemoved -*
      -*
    • PropertyChangeEvent -*
    -* -* @see com.ibm.as400.util.html.HTMLTree -* @see com.ibm.as400.util.html.URLParser -**/ -public class HTMLTreeElement implements HTMLTagElement, java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2002 International Business Machines Corporation and others."; - static final long serialVersionUID = -2067619739727758210L; - - private HTMLVector branches_; //@P2C - - private boolean expanded_ = false; - private HTMLHyperlink textUrl_ = null; - private HTMLHyperlink iconUrl_ = null; - private HTMLTagElement elementData_ = null; - private boolean sort_ = true; // @A1A - transient private Collator collator_; - - private static String expandedGif_ = null; - private static String collapsedGif_ = null; - private static String docGif_ = null; - - private static final String std = "\n"; // The start table definition tag. // @B2C - private static final String etd = "\n"; // The end table definition tag. // @B2C - - transient PropertyChangeSupport changes_; //@P2C - transient private Vector elementListeners_; // The list of element listeners @P2C - - - /** - * Constructs a default HTMLTreeElement object. - **/ - public HTMLTreeElement() - { - // @B2A - // If the locale is Korean, then this throws - // an ArrayIndexOutOfBoundsException. This is - // a bug in the JDK. The workarond in that case - // is just to use String.compareTo(). - try // @B2A - { - collator_ = Collator.getInstance (); // @B2A - collator_.setStrength (Collator.PRIMARY); // @B2A - } - catch (Exception e) // @B2A - { - collator_ = null; // @B2A - } - - branches_ = new HTMLVector(); //@P2C - } - - - /** - * Constructs an HTMLTreeElement with the specified text. - * - * @param text The text. - **/ - public HTMLTreeElement(String text) - { - this(); - setText(text); - } - - - /** - * Constructs an HTMLTreeElement with the specified text. - * - * @param text The text. - **/ - public HTMLTreeElement(HTMLTagElement text) - { - this(); - setText(text); - } - - - /** - * Constructs an HTMLTreeElement with the specified textUrl. - * - * @param textUrl The HTMLHyperlink. - **/ - public HTMLTreeElement(HTMLHyperlink textUrl) - { - this(); - setTextUrl(textUrl); - } - - - /** - * Adds a child element to the parent HTMLTreeElement - * - * @param element The HTMLTreeElement. - **/ - public void addElement(HTMLTreeElement element) - { - if (element == null) - throw new NullPointerException("element"); - - branches_.addElement(element); - - if (elementListeners_ != null) fireElementEvent(ElementEvent.ELEMENT_ADDED); //@P2C - } - - - /** - * Adds an addElementListener. - * The specified addElementListeners elementAdded method will - * be called each time a HTMLTreeElement is added. - * The addElementListener object is added to a list of addElementListeners - * managed by this HTMLTreeElement. It can be removed with removeElementListener. - * - * @see #removeElementListener - * - * @param listener The ElementListener. - **/ - public void addElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (elementListeners_ == null) elementListeners_ = new Vector(); //@P2A - elementListeners_.addElement(listener); - } - - - /** - * Adds a PropertyChangeListener. The specified - * PropertyChangeListener's propertyChange - * method is called each time the value of any - * bound property is changed. - * - * @see #removePropertyChangeListener - * @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (changes_ == null) changes_ = new PropertyChangeSupport(this); //@P2A - changes_.addPropertyChangeListener(listener); - } - - - /** - * Fires the element event. - **/ - private void fireElementEvent(int evt) - { - Vector targets; - targets = (Vector) elementListeners_.clone(); - ElementEvent elementEvt = new ElementEvent(this, evt); - for (int i = 0; i < targets.size(); i++) - { - ElementListener target = (ElementListener)targets.elementAt(i); - if (evt == ElementEvent.ELEMENT_ADDED) - target.elementAdded(elementEvt); - else if (evt == ElementEvent.ELEMENT_REMOVED) - target.elementRemoved(elementEvt); - } - } - - - /** - * Returns the collapsed gif. - * - * @return The collapsed gif. - **/ - public String getCollapsedGif() - { - return collapsedGif_; - } - - - /** - * Returns the document gif. - * - * @return The document gif. - **/ - public String getDocGif() - { - return docGif_; - } - - - /** - * Returns the expanded gif. - * - * @return The expanded gif. - **/ - public String getExpandedGif() - { - return expandedGif_; - } - - - /** - * Returns the icon URL. - * - * @return The icon URL. - **/ - public HTMLHyperlink getIconUrl() - { - return iconUrl_; - } - - - /** - * Returns the visible text of the HTMLTreeElement. - * - * @return text The text. - **/ - public HTMLTagElement getText() - { - return elementData_; - } - - - /** - * Returns a comment tag. - * This method should not be called. There is no XSL-FO support for this class. - * @return The comment tag. - **/ - public String getFOTag() //@C1A - { - Trace.log(Trace.ERROR, "Attempting to getFOTag() for an object that doesn't support it."); - return ""; - } - - /** - * Returns the HTMLTreeElement tag. - * - * @return The tag. - **/ - public String getTag() - { - if (iconUrl_ != null) - setIconUrl(iconUrl_); - else - throw new ExtendedIllegalStateException("iconUrl", ExtendedIllegalStateException.PROPERTY_NOT_SET); - - if (elementData_ == null) - throw new ExtendedIllegalStateException("text", ExtendedIllegalStateException.PROPERTY_NOT_SET ); - - StringBuffer buf = new StringBuffer(); // @B2C - - buf.append("\n"); - - if (isLeaf()) - { - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, " Element is a leaf."); - - buf.append(std); - - if (docGif_ != null) - { - buf.append("\"");\n"); // @B3C - } - else - buf.append(">"); - - buf.append(etd); - - buf.append(std); - buf.append(elementData_.getTag()); // @B2C - buf.append("\n"); // @B2C - buf.append(etd); - - buf.append("\n"); - } - else - { - String hcStr = com.ibm.as400.util.html.URLEncoder.encode(Integer.toString(this.hashCode())); - - buf.append(std); - - StringBuffer iconTag = new StringBuffer(); - - if (isExpanded()) - { - if (expandedGif_ != null) - { // @B2C - iconTag.append("\"");"); // @B3C - } - else // @B2C - iconTag.append("-"); - } - else - { - if (collapsedGif_ != null) - { - iconTag.append( "\"");"); // @B3C - } - else - iconTag.append("+"); - } - - - if (iconUrl_ != null) - { - try - { - iconUrl_.setName(hcStr); - - Properties iconProp = iconUrl_.getProperties(); - - if (iconProp == null) - iconProp = new Properties(); - - iconProp.put("hashcode", hcStr); // @B1C - - if (expanded_) - iconProp.put("action", "contract"); // @B1C - else - iconProp.put("action", "expand"); // @B1C - - iconUrl_.setProperties(iconProp); - URLParser parser = new URLParser(iconUrl_.getLink()); - iconUrl_.setLink(parser.getURI()); //$A3C - iconUrl_.setText(iconTag.toString()); - iconUrl_.setLocation(hcStr); //$A3A - - } - catch (PropertyVetoException e) - { /* Ignore */ - } - - buf.append(iconUrl_.getTag()); - } - else - { - buf.append(iconTag); - } - - - buf.append("\n"); - - buf.append(etd); - - buf.append(std); - - - // If the text URL has been set - if (textUrl_ != null) - { - try - { - if (textUrl_.getText() == null) - textUrl_.setText(elementData_.getTag() + "\n"); - } - catch (PropertyVetoException e) - { /* Ignore */ - } - - buf.append(textUrl_.getTag()); - } - else // If the text URL has NOT been set. - { - buf.append(elementData_.getTag()); // @B2C - buf.append("\n"); // @B2C - } - - buf.append(etd); // @B2C - - buf.append("\n"); - - if (isExpanded()) - { - buf.append(" \n\n"); //@P2C - - if (sort_) HTMLTree.sort(collator_, branches_); // @A1A // @B2C @P2C - - int size = branches_.getCount(); //@P2A - Object[] data = branches_.getData(); //@P2A - for (int i=0; i\n\n"); //@P2C - //@P2D buf.append("\n"); - } - } - - return buf.toString(); - } - - - /** - * Returns the text URL. - * - * @return The text URL. - **/ - public HTMLHyperlink getTextUrl() - { - return textUrl_; - } - - - /** - * Indicates if the HTMLTreeElement is expanded. - * - * @return true if expanded, false otherwise. - **/ - public boolean isExpanded() - { - return expanded_; - } - - - /** - * Indicates if the HTMLTreeElement is a leaf. - * - * @return true if the element is a leaf, false otherwise. - **/ - public boolean isLeaf() - { - return branches_.isEmpty(); - } - - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - // @B2A - // If the locale is Korean, then this throws - // an ArrayIndexOutOfBoundsException. This is - // a bug in the JDK. The workarond in that case - // is just to use String.compareTo(). - try // @B2A - { - collator_ = Collator.getInstance (); // @B2A - collator_.setStrength (Collator.PRIMARY); // @B2A - } - catch (Exception e) // @B2A - { - collator_ = null; // @B2A - } - - in.defaultReadObject(); - - //@P2D changes_ = new PropertyChangeSupport(this); - //@P2D elementListeners_ = new Vector(); - } - - - /** - * Removes a child element from the parent HTMLTreeElement - * - * @param element The HTMLTreeElement. - **/ - public void removeElement(HTMLTreeElement element) - { - if (element == null) - throw new NullPointerException("element"); - - if (branches_.removeElement(element) && elementListeners_ != null) //@P2C - fireElementEvent(ElementEvent.ELEMENT_REMOVED); - } - - - /** - * Removes this ElementListener from the internal list. - * If the ElementListener is not on the list, nothing is done. - * - * @see #addElementListener - * - * @param listener The ElementListener. - **/ - public void removeElementListener(ElementListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - if (elementListeners_ != null) elementListeners_.removeElement(listener); //@P2C - } - - - /** - * Removes the PropertyChangeListener from the internal list. - * If the PropertyChangeListener is not on the list, nothing is done. - * - * @see #addPropertyChangeListener - * @param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (changes_ != null) changes_.removePropertyChangeListener(listener); //@P2C - } - - - /** - * Indicates which HTMLTreeElement is selected. The hashcode is used - * to determine which element within the tree to expand or collapse. - * - * @param hashcode The hashcode. - **/ - public void selected(int hashcode) - { - if (!isLeaf()) - { - if (this.hashCode() == hashcode) - { - boolean old = expanded_; - - expanded_ = !expanded_; - - if (changes_ != null) changes_.firePropertyChange("selected", new Boolean(old), new Boolean(expanded_)); //@P2C - } - else - { - int size = branches_.getCount(); //@P2A - Object[] data = branches_.getData(); //@P2A - for (int i=0; i
    -* -* -* -* -* -* -* -* -* -* -* -* -*
    Animal ID123456
    Animal NameTimberwolf
    Date of BirthSun Mar 14 16:00:00 CDT 1999
    -**/ - -public class HTMLFormConverter extends StringConverter implements Serializable, HTMLConstants -{ - static final long serialVersionUID = -6301275216248287290L; - - private HTMLTable htmlTable_; // HTMLTable used to represent form. - private HTMLHyperlink[] links_; // The column header's hyperlink list. - - transient private Vector completedListeners_; //@CRS - transient private SectionCompletedSupport sectionCompletedSupport_; //@CRS - transient private PropertyChangeSupport changes_; //@CRS - transient private VetoableChangeSupport vetos_; //@CRS - - /** - * Constructs a default HTMLFormConverter object. - **/ - public HTMLFormConverter() - { - super(); - htmlTable_ = new HTMLTable(); - } - - /** - * Adds an ActionCompletedListener. - * The specified ActionCompletedListener's actionCompleted method is called - * each time the form conversion is complete. - * The ActionCompletedListener object is added to an internal list of ActionCompletedListeners; - * it can be removed with removeActionCompletedListener. - * - * @param listener The ActionCompletedListener. - * @see #removeActionCompletedListener - **/ - public void addActionCompletedListener(ActionCompletedListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (completedListeners_ == null) completedListeners_ = new Vector(); //@CRS - completedListeners_.addElement(listener); - } - - /** - * Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange - * method is called each time the value of any bound property is changed. - * @param listener The PropertyChangeListener. - * @see #removePropertyChangeListener - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (changes_ == null) changes_ = new PropertyChangeSupport(this); //@CRS - - changes_.addPropertyChangeListener(listener); - - // Add a listener for the table attributes. - htmlTable_.addPropertyChangeListener(listener); - } - - /** - * Adds a SectionCompletedListener. - * The specified SectionCompletedListener's sectionCompleted method is called - * each time the conversion of a single row to a form is complete. - * The SectionCompletedListener object is added to an internal list of SectionCompletedListeners; - * it can be removed with removeSectionCompletedListener. - * - * @param listener The SectionCompletedListener. - * @see #removeSectionCompletedListener - **/ - public void addSectionCompletedListener(SectionCompletedListener listener) - { - if (sectionCompletedSupport_ == null) sectionCompletedSupport_ = new SectionCompletedSupport(this); //@CRS - - sectionCompletedSupport_.addSectionCompletedListener(listener); - } - - /** - * Adds the VetoableChangeListener. The specified VetoableChangeListener's vetoableChange - * method is called each time the value of any constrained property is changed. - * @param listener The VetoableChangeListener. - * @see #removeVetoableChangeListener - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); //@CRS - - vetos_.addVetoableChangeListener(listener); - - // Add a listener for the table attributes. - htmlTable_.addVetoableChangeListener(listener); - } - - /** - * Converts the row data specified by rowdata into an array of HTMLTable objects. - * @param rowdata The RowData object that contains the row data. - * @param metadata The RowMetaData object that contains the metadata. - * @return A vector containing the tables. - * @exception PropertyVetoException If a change is vetoed. - * @exception RowDataException If a row data error occurs. - **/ - private Vector convertRowData(RowData rowdata, RowMetaData metadata) throws PropertyVetoException, RowDataException // @A1 - { - if (metadata == null) - { - Trace.log(Trace.ERROR, "The rowdata's metadata attribute is invalid."); - throw new ExtendedIllegalStateException("rowdata metadata", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Vector of HTML tables. - Vector formList = new Vector(); - - // Get the number of columns in the row data. - int numColumns = metadata.getColumnCount(); - - HTMLTableHeader[] header = createFormHeader(metadata); // @B2 - - // Process the row data. - if (rowdata.length() == 0) // @B2 - { - HTMLTable table = createDefaultTable(header); - - // End the form. - formList.addElement(table); - - // Notify the listeners that a form is completed. - if (sectionCompletedSupport_ != null) sectionCompletedSupport_.fireSectionCompleted(table.getTag()); //@CRS - } - else - { - rowdata.beforeFirst(); - } - - while (rowdata.next()) - { - HTMLTable table = createDefaultTable(header); - - // Process the row. - for (int column=0; column< numColumns; column++) - { - HTMLTableRow row = table.getRow(column); // @B2 - - // Process the meta data type and add the object. - HTMLTableCell cell = new HTMLTableCell(); - HTMLTagElement element; - - Vector properties = rowdata.getObjectProperties(column); - if (properties != null) - { - int propSize = properties.size(); - for (int index=0; index< propSize; index++) - { - // Use local cell tag if available. - if (properties.elementAt(index) instanceof HTMLTableCell) - cell = (HTMLTableCell)properties.elementAt(index); - } - } - - // Set the column data. - Object columnObject = rowdata.getObject(column); - - // If the column data is null, place a
    into the cell otherwise // @D4A - // a NullPointerException will be thrown for an empty cell elment. // @D4A - if (columnObject == null) // @D4A - columnObject = new LineLayoutFormPanel(); // @D4A - - try - { - cell.setElement((HTMLTagElement)columnObject); - } - catch (ClassCastException e) - { - cell.setElement(new HTMLText(columnObject.toString())); - } - - if (metadata.getColumnAlignment(column) != null) //@D5A - cell.setHorizontalAlignment(metadata.getColumnAlignment(column)); //@D5A - - if (metadata.getColumnDirection(column) != null) //@D5A - cell.setDirection(metadata.getColumnDirection(column)); //@D5A - - // Add the column cell to the row. - row.addColumn(cell); - // Add the row to the table. - table.setRow(row, column); // @B2 - } - - // End the form. - formList.addElement(table); - - // Notify the listeners that a form is completed. - if (sectionCompletedSupport_ != null) sectionCompletedSupport_.fireSectionCompleted(table.getTag()); //@CRS - } - - // Notify the listeners that all the forms are converted. - fireCompleted(); - - return formList; - } - - /** - * Converts the specified rowdata to an array of forms (one-row HTML tables). - * Each form is a one-row HTML table with the column headers and the data of the individual row. - * - * @param rowdata The row data. - * @return An array of HTML tables. - * @exception PropertyVetoException If a change is vetoed. - * @exception RowDataException If a row data error occurs. - **/ - public HTMLTable[] convertToForms(RowData rowdata) throws PropertyVetoException, RowDataException // @A1 - { - if (rowdata == null) - throw new NullPointerException("rowdata"); - - // Convert to a vector of forms (2-column tables). - Vector tableVector = convertRowData(rowdata, rowdata.getMetaData()); - - // Return the list of HTML tables. - HTMLTable[] tables = new HTMLTable[tableVector.size()]; - tableVector.copyInto(tables); - return tables; - } - - /** - * Creates a default HTMLTable. - * @param header The form headers. - * @return An HTMLTable object. - **/ - private HTMLTable createDefaultTable(HTMLTableHeader[] header) // @B2 - added parameter. - { - HTMLTable table = new HTMLTable(); - - try - { - if (htmlTable_.getCaption() != null) - table.setCaption(htmlTable_.getCaption()); // caption - if (htmlTable_.getAlignment() != null) - table.setAlignment(htmlTable_.getAlignment()); // alignment - table.setBorderWidth(htmlTable_.getBorderWidth()); // border width - table.setCellPadding(htmlTable_.getCellPadding()); // cell padding - table.setCellSpacing(htmlTable_.getCellSpacing()); // cell spacing - - table.setWidth(htmlTable_.getWidth(), htmlTable_.isWidthInPercent()); // width - - table.setHeaderInUse(false); // header usage - - if (htmlTable_.getLanguage() != null) // language //$B1A - table.setLanguage(htmlTable_.getLanguage()); //$B1A - if (htmlTable_.getDirection() != null) // direction //$B1A - table.setDirection(htmlTable_.getDirection()); //$B1A - - // Add a column header to each row in the table. - for (int column=0; column< header.length; column++) // @B2 - { - HTMLTableRow row = new HTMLTableRow(); // @B2 - row.addColumn(header[column]); // @B2 - table.addRow(row); // @B2 - } - } - catch (PropertyVetoException veto) { /* will never occur. */ } - return table; - } - - - /** - * Creates the form header to be used in the default HTMLTable. - * @param metadata The RowMetaData object containing the column information. - * @return An array of HTMLTableHeader objects. - * @exception PropertyVetoException If changed is vetoed. - * @exception RowDataException If a row data error occurs. - **/ // @B2 - new method. - private HTMLTableHeader[] createFormHeader(RowMetaData metadata) throws PropertyVetoException, RowDataException - { - int numColumns = metadata.getColumnCount(); - HTMLTableHeader[] header = new HTMLTableHeader[numColumns]; - for (int column=0; column< numColumns; column++) - { - header[column] = new HTMLTableHeader(); - // Write out the headings - String columnName = ""; - try - { - columnName = metadata.getColumnLabel(column); - } - catch (NullPointerException e) - { - columnName = metadata.getColumnName(column); - } - - if (links_ != null && links_[column] != null) - { - HTMLHyperlink link = links_[column]; - link.setText(columnName); - header[column].setElement(link); - } - else - { - HTMLText text = new HTMLText(columnName); - header[column].setElement(text); - } - } - return header; - } - - /** - * Converts the specified rowdata to an array of HTML strings. - * - * @param rowdata The row data. - * @param metadata The meta data. - * @return An array of HTML Strings. - * @exception PropertyVetoException If a change is vetoed. - * @exception RowDataException If a row data error occurs. - **/ - String[] doConvert(RowData rowdata, RowMetaData metadata) - throws PropertyVetoException, RowDataException - { - // Validate the metadata parameter. - if (metadata == null) - throw new NullPointerException("metadata"); - - // do the conversion. - Vector forms = convertRowData(rowdata, metadata); - - // Return the list of form as String array. - String[] data = new String[forms.size()]; - - for (int i=0; i< data.length; i++) - data[i] = ((HTMLTable)forms.elementAt(i)).getTag(); - return data; - } - - /** - * Fires a section completed event. - * @param obj The source object from which the event originated. - **/ - private void fireCompleted() - { - if (completedListeners_ == null) return; //@CRS - Vector targets = (Vector) completedListeners_.clone(); - ActionCompletedEvent event = new ActionCompletedEvent(this); - for (int i=0; i< targets.size(); i++) - { - ActionCompletedListener target = (ActionCompletedListener)targets.elementAt(i); - target.actionCompleted(event); - } - } - - /** - * Returns the form alignment. - * @return The form alignment. - **/ - public String getAlignment() - { - return htmlTable_.getAlignment(); - } - - /** - * Returns the form border width. - * @return The width in pixels. - **/ - public int getBorderWidth() - { - return htmlTable_.getBorderWidth(); - } - - /** - * Returns the form caption. - * @return An HTMLTableCaption object that contains the form caption. - **/ - public HTMLTableCaption getCaption() - { - return htmlTable_.getCaption(); - } - - /** - * Returns the form cell padding in pixels. - * @return The cell padding. - **/ - public int getCellPadding() - { - return htmlTable_.getCellPadding(); - } - - /** - * Returns the form cell spacing in pixels. - * @return The cell spacing. - **/ - public int getCellSpacing() - { - return htmlTable_.getCellSpacing(); - } - - /** - * Returns the form text interpretation direction. - * @return The direction. - **/ //$B1A - public String getDirection() //$B1A - { //$B1A - return htmlTable_.getDirection(); //$B1A - } - - /** - * Returns the form header's hyperlinks. - * @return The hyperlinks. - **/ - public HTMLHyperlink[] getHeaderHyperlinks() - { - return links_; - } - - /** - * Returns the language of the form. - * @return The language. - **/ - public String getLanguage() //$B1A - { //$B1A - return htmlTable_.getLanguage(); //$B1A - } //$B1A - - /** - * Returns the object's hyperlink at the specified column within the current row. - * @param rowdata The RowData object that contains the data. - * @param column The column number (0-based). - * @return The hyperlink. - **/ - public HTMLHyperlink getObjectHyperlink(RowData rowdata, int column) - { - // Validate the rowdata parameter. - if (rowdata == null) - throw new NullPointerException("rowdata"); - - return getObjectHyperlink(rowdata, rowdata.getCurrentPosition(), column); - } - - /** - * Returns the object's hyperlink at the specified row and column. - * @param rowdata The RowData object that contains the data. - * @param row The row number (0-based). - * @param column The column number (0-based). - * @return The hyperlink. - **/ - public HTMLHyperlink getObjectHyperlink(RowData rowdata, int row, int column) - { - // Validate the rowdata parameter. - if (rowdata == null) - throw new NullPointerException("rowdata"); - - HTMLHyperlink link = null; - - if (!rowdata.absolute(row)) - throw new ExtendedIllegalArgumentException("row", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - Vector properties = rowdata.getObjectProperties(column); - - if (properties != null) - { - int propSize = properties.size(); - for (int index=0; index < propSize; index++) { - if (properties.elementAt(index) instanceof HTMLHyperlink) - { - link = (HTMLHyperlink)properties.elementAt(index); - break; - } - } - } - return link; - } - - /** - * Returns the form width in pixels or percent. - * @return The form width. - * @see #isWidthInPercent - **/ - public int getWidth() - { - return htmlTable_.getWidth(); - } - - /** - * Indicates if the form width is in percent or pixels. - * @return True if percent, false if pixels. - * @see #getWidth - **/ - public boolean isWidthInPercent() - { - return htmlTable_.isWidthInPercent(); - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS vetos_ = new VetoableChangeSupport(this); - //@CRS completedListeners_ = new Vector(); - //@CRS sectionCompletedSupport_ = new SectionCompletedSupport(this); - } - - /** - * Removes this ActionCompletedListener from the internal list. - * If the ActionCompletedListener is not on the list, nothing is done. - * @param listener The ActionCompletedListener. - * @see #addActionCompletedListener - **/ - public void removeActionCompletedListener(ActionCompletedListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (completedListeners_ != null) completedListeners_.removeElement(listener); //@CRS - } - - /** - * Removes the PropertyChangeListener from the internal list. - * If the PropertyChangeListener is not on the list, nothing is done. - * @param listener The PropertyChangeListener. - * @see #addPropertyChangeListener - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (changes_ != null) changes_.removePropertyChangeListener(listener); //@CRS - - // Remove the listener for the table attributes. - htmlTable_.removePropertyChangeListener(listener); - } - - /** - * Removes this SectionCompletedListener from the internal list. - * If the SectionCompletedListener is not on the list, nothing is done. - * @param listener The SectionCompltedListener. - * @see #addSectionCompletedListener - **/ - public void removeSectionCompletedListener(SectionCompletedListener listener) - { - if(listener == null) //@KCA - throw new NullPointerException("listener"); //@KCA - if (sectionCompletedSupport_ != null) sectionCompletedSupport_.removeSectionCompletedListener(listener); //@CRS - } - - /** - * Removes the VetoableChangeListener from the internal list. - * If the VetoableChangeListener is not on the list, nothing is done. - * @param listener The VetoableChangeListener. - * @see #addVetoableChangeListener - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (vetos_ != null) vetos_.removeVetoableChangeListener(listener); //@CRS - - // Remove the listener for the table attributes. - htmlTable_.removeVetoableChangeListener(listener); - } - - /** - * Sets the form alignment. The default value is LEFT. - * @param alignment The form alignment. One of the following constants - * defined in HTMLConstants: CENTER, LEFT, or RIGHT. - * @exception PropertyVetoException If the change is vetoed. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setAlignment(String alignment) throws PropertyVetoException - { - htmlTable_.setAlignment(alignment); - } - - /** - * Sets the form border width in pixels. A value of zero indicates no border. - * The default value is zero. - * @param borderWidth The border width in pixels. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setBorderWidth(int borderWidth) throws PropertyVetoException - { - htmlTable_.setBorderWidth(borderWidth); - } - - /** - * Sets the form caption. - * @param caption The caption text. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setCaption(HTMLTableCaption caption) throws PropertyVetoException - { - htmlTable_.setCaption(caption); - } - - /** - * Sets the form cell padding in pixels. The cell padding is the spacing between - * data in the form and the border of the form cell. - * The default value is zero (browser default used). - * @param cellPadding The cell padding in pixels. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setCellPadding(int cellPadding) throws PropertyVetoException - { - htmlTable_.setCellPadding(cellPadding); - } - - /** - * Sets the form cell spacing in pixels. The cell spacing is the spacing between - * the form cells. The default value is zero (browser default used). - * @param cellSpacing The cell spacing in pixels. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setCellSpacing(int cellSpacing) throws PropertyVetoException - { - htmlTable_.setCellSpacing(cellSpacing); - } - - /** - * Sets the form text interpretation direction. - * @param dir The direction of text interpretation. One of the following constants - * defined in HTMLConstants: LTR or RTL - * - * @see com.ibm.as400.util.html.HTMLConstants - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setDirection(String dir) throws PropertyVetoException //$B1A - { //$B1A - // If direction is not one of the valid HTMLConstants, throw an exception. //$B1A - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) //$B1A - { //$B1A - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); //$B1A - } //$B1A - htmlTable_.setDirection(dir); //$B1A - } //$B1A - - /** - * Sets the form header's hyperlinks. - * @param links The hyperlinks. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setHeaderHyperlinks(HTMLHyperlink[] links) throws PropertyVetoException - { - if (links == null) - throw new NullPointerException("links"); - - HTMLHyperlink[] old = links_; - if (vetos_ != null) vetos_.fireVetoableChange("links", old, links); //@CRS - - links_ = links; - - if (changes_ != null) changes_.firePropertyChange("links", old, links); //@CRS - } - - /** - * Sets the language of the form. - * @param lang The language. Example language tags include: - * en and en-US. - * - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setLanguage(String lang) throws PropertyVetoException //$B1A - { //$B1A - htmlTable_.setLanguage(lang); //$B1A - } //$B1A - - /** - * Sets the object's hyperlink at the specified column within the current row. - * @param rowdata The RowData object that contains the data. - * @param link The hyperlink. - * @param column The column number (0-based). - * @exception RowDataException If a row data error occurs. - **/ - public void setObjectHyperlink(RowData rowdata, HTMLHyperlink link, int column)throws RowDataException - { - if (rowdata == null) - throw new NullPointerException("rowdata"); - - setObjectHyperlink(rowdata, link, rowdata.getCurrentPosition(), column); - } - - /** - * Sets the object's hyperlink at the specified row and column. - * @param rowdata The RowData object that contains the data. - * @param link The hyperlink. - * @param row The row number (0-based). - * @param column The column number (0-based). - * @exception RowDataException If a row data error occurs. - **/ - public void setObjectHyperlink(RowData rowdata, HTMLHyperlink link, int row, int column) throws RowDataException - { - // Validate the parameters. - if (rowdata == null) - throw new NullPointerException("rowdata"); - if (link == null) - throw new NullPointerException("link"); - - // Position to the row. - if (!rowdata.absolute(row)) - throw new ExtendedIllegalArgumentException("row", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - // Get the object's properties. - Vector properties = rowdata.getObjectProperties(column); - - if (properties == null) - { - // Create a properties list and add the hyperlink. - properties = new Vector(); - properties.addElement(link); - } - else - { - // Has properties. - HTMLHyperlink oldTag = null; // The existing hyperlink object. - int linkIndex = -1; // The property index of the existing hyperlink. - - // Check for existing hyperlink. - int propSize = properties.size(); - for (int index=0; index < propSize; index++) - { - if (properties.elementAt(index) instanceof HTMLHyperlink) - { - // Get the existing hyperlink. - oldTag = (HTMLHyperlink)properties.elementAt(index); - linkIndex = index; - break; - } - } - - if (oldTag == null) - properties.addElement(link); - else - properties.setElementAt(link, linkIndex); - } - // Set the row object's new properties list. - rowdata.setObjectProperties(properties, column); - } - - /** - * Sets the form width in pixels or percent. - * @param width The form width. - * @param widthInPercent true if the width is specified as a percent; false if the width is specified in pixels. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setWidth(int width, boolean widthInPercent) throws PropertyVetoException - { - htmlTable_.setWidth(width, widthInPercent); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/HTMLFormConverter16.gif b/cvsroot/src/com/ibm/as400/util/servlet/HTMLFormConverter16.gif deleted file mode 100644 index 137218483..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/HTMLFormConverter16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/HTMLFormConverter32.gif b/cvsroot/src/com/ibm/as400/util/servlet/HTMLFormConverter32.gif deleted file mode 100644 index 36b4983e6..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/HTMLFormConverter32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/HTMLTableConverter.java b/cvsroot/src/com/ibm/as400/util/servlet/HTMLTableConverter.java deleted file mode 100644 index b38398788..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/HTMLTableConverter.java +++ /dev/null @@ -1,814 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: HTMLTableConverter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import com.ibm.as400.util.html.HTMLHyperlink; -import com.ibm.as400.util.html.HTMLTable; -import com.ibm.as400.util.html.HTMLTableCell; -import com.ibm.as400.util.html.HTMLTableHeader; -import com.ibm.as400.util.html.HTMLTableRow; -import com.ibm.as400.util.html.HTMLTagElement; -import com.ibm.as400.util.html.HTMLText; -import com.ibm.as400.util.html.LineLayoutFormPanel; // @D4A - -import com.ibm.as400.access.ActionCompletedEvent; -import com.ibm.as400.access.ActionCompletedListener; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; - -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.io.Serializable; -import java.util.Vector; - -/** -* The HTMLTableConverter class can be used to convert the data from a RowData -* object to a single HTML table for a selected group or page of row data, an -* array of strings or HTML tables. Each resulting HTML table then can be used -* by a servlet to display the rowdata to a browser. -* -*

    HTMLTableConverter objects generate the following events: -*

    -* -*

    The following example creates an HTMLTableConverter object and does the conversion. -*

    -*  

    // Create an HTMLTableConverter object. -* HTMLTableConverter converter = new HTMLTableConverter(); -*

    // Setup the table tag with a maximum of 25 rows/table. -* HTMLTable table = new HTMLTable(); -* converter.setMaximumTableSize(25); -* converter.setTable(table); -*

    // Convert the row data. -*

    // Assume the RowData object was created and initialized in a previous step. -* String[] html = converter.convert(rowdata); -*

    -**/ -public class HTMLTableConverter extends StringConverter implements Serializable -{ - static final long serialVersionUID = 9154342923705960360L; - - private HTMLTable htmlTable_; // The html table. - private HTMLHyperlink[] links_; // The table column header hyperlinks. - private int maxTableSize_ = 0; // The maximum number of rows in a table. - private boolean useMetaData_ = false; // Whether the metadata is used to create the table header. Otherwise, the existing table header is used. - - transient private Vector completedListeners_; // The conversion completed listeners. - transient private PropertyChangeSupport changes_; // The property change listeners. - transient private VetoableChangeSupport vetos_; // The vetoable change listeners. - transient private SectionCompletedSupport sectionCompletedSupport_; // The section completed listeners. - - /** - * Constructs a default HTMLTableConverter object. - **/ - public HTMLTableConverter() - { - super(); - // Initialize the transient data (listeners). - // initializeTransient(); @CRS - } - - /** - * Adds an ActionCompletedListener. - * The specified ActionCompletedListener's actionCompleted method is called - * each time the table conversion is complete and all the row data is converted. - * The ActionCompletedListener object is added to a list of ActionCompletedListeners - * managed by this class; it can be removed with removeActionCompletedListener. - * - * @param listener The ActionCompletedListener. - * @see #removeActionCompletedListener - **/ - public void addActionCompletedListener(ActionCompletedListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (completedListeners_ == null) completedListeners_ = new Vector(); //@CRS - completedListeners_.addElement(listener); - } - - /** - * Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange - * method is called each time the value of any bound property is changed. - * @param listener The PropertyChangeListener. - * @see #removePropertyChangeListener - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (changes_ == null) changes_ = new PropertyChangeSupport(this); //@CRS - changes_.addPropertyChangeListener(listener); - } - - /** - * Adds a SectionCompletedListener. - * The specified SectionCompletedListener's sectionCompleted method is called - * each time the conversion for a single table is complete. - * The SectionCompletedListener object is added to an internal list of SectionCompletedListeners; - * it can be removed with removeSectionCompletedListener. - * - * @param listener The SectionCompletedListener. - * @see #removeSectionCompletedListener - **/ - public void addSectionCompletedListener(SectionCompletedListener listener) - { - if (sectionCompletedSupport_ == null) sectionCompletedSupport_ = new SectionCompletedSupport(this); //@CRS - sectionCompletedSupport_.addSectionCompletedListener(listener); - } - - /** - * Adds the VetoableChangeListener. The specified VetoableChangeListener's vetoableChange - * method is called each time the value of any constrained property is changed. - * @param listener The VetoableChangeListener. - * @see #removeVetoableChangeListener - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); //@CRS - vetos_.addVetoableChangeListener(listener); - } - - /** - * Calculates the number of tables in the array. - * @param numberRows The number of row in the list. - * @return The array of HTMLTables objects. - **/ - private HTMLTable[] calculateNumberOfTables(int numberRows) - { - int numTables = 1; - if (maxTableSize_ > 0 && numberRows > 0) // @C1 - { - numTables = numberRows / maxTableSize_; - if (numberRows % maxTableSize_ != 0) - numTables++; - } - return new HTMLTable[numTables]; - } - - /** - * Converts the row data specified by rowdata into an array of HTMLTable objects. - * If the default table has not been set, it is automatically created with the - * column header information being obtained from the metadata. - * @param rowdata The RowData object that contains the row data. - * @param metadata The RowMetaData object that contains the metadata. - * @return An array of HTMLTables. - * @exception PropertyVetoException If a change is vetoed. - * @exception RowDataException If a row data error occurs. - * @see #setTable - **/ - private HTMLTable[] convertRowData(RowData rowdata, RowMetaData metadata) //@A1 //$D2C - throws PropertyVetoException, RowDataException - { - HTMLTable[] tables = calculateNumberOfTables(rowdata.length()); - - for (int i = 0; i < tables.length; ++i) - { - tables[i] = convertRowData(rowdata, metadata, i); - } - - return tables; - } - - - /** - * Converts the row data specified by rowdata at a specfic page into an HTMLTable object. - * If the default table has not been set, it is automatically created with the - * column header information being obtained from the metadata. - * @param rowdata The RowData object that contains the row data. - * @param metadata The RowMetaData object that contains the metadata. - * @param page A specific page of the row data. - * @return An HTMLTable. - * @exception PropertyVetoException If a change is vetoed. - * @exception RowDataException If a row data error occurs. - * @see #setTable - **/ - private HTMLTable convertRowData(RowData rowdata, RowMetaData metadata, int page) //$D2A - throws PropertyVetoException, RowDataException - { - if (metadata == null) - { - Trace.log(Trace.ERROR, "The rowdata's metadata attribute is invalid."); - throw new ExtendedIllegalStateException("rowdata metadata", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Validate the page parameter. - if (page < 0) - throw new ExtendedIllegalArgumentException("page", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - // Create the table to be used. - if (htmlTable_ == null) - { - // Use the metadata for the column headers. - setUseMetaData(true); - try - { - htmlTable_ = new HTMLTable(); - htmlTable_.setHeaderInUse(false); - } - catch (PropertyVetoException veto) - { /* will never occur. */ - } - } - // Set the table header based on the metadata. - if (isUseMetaData()) - setTableHeader(metadata); - - // Create and initialize the Table. - HTMLTable table = createDefaultTable(); - - // If there is no rowdata, then return an empty table. //$D3A - if (rowdata.length() == 0) //$D3A - return table; //$D3A - - // Row processing variables. - long numRowsInTable = 1; - int numColumns = metadata.getColumnCount(); - - // Process the row data. - if (page == 0) - rowdata.beforeFirst(); - else - rowdata.absolute((maxTableSize_ * page)-1); - - // Keep track of which row we are at in the table. - int rowLocation = 0; - - // If no max table size is set, then the max will be the - // size of the row data. - if (maxTableSize_ == 0) - maxTableSize_ = rowdata.length(); - - while (rowdata.next() && (maxTableSize_ > rowLocation)) - { - // Determine if the table is at the maximum size. - if (maxTableSize_ > 0) - { - if (numRowsInTable > 1 && (numRowsInTable % maxTableSize_ == 1) ) - { - // Notify the listeners that a table is finished. - if (sectionCompletedSupport_ != null) sectionCompletedSupport_.fireSectionCompleted(table.getTag()); //@CRS - } - } - - // Start the row (default row from table). - HTMLTableRow row = new HTMLTableRow(); - - Vector properties; - for (int column=0; column< numColumns; column++) - { - // Create a default cell. - HTMLTableCell cell = new HTMLTableCell(); - if (metadata.isNumericData(column) == true) // @C1 - cell.setHorizontalAlignment(HTMLTableCell.RIGHT); - HTMLTagElement element; - - // Check object properties for a specific table cell to use. - properties = rowdata.getObjectProperties(column); - if (properties != null) - { - int propSize = properties.size(); - for (int index=0; index< propSize; index++) - { - // Use the local cell tag. - if (properties.elementAt(index) instanceof HTMLTableCell) - cell = (HTMLTableCell)properties.elementAt(index); - } - } - - // Set the column data. - Object columnObject = rowdata.getObject(column); - - // If the column data is null, place a
    into the cell otherwise // @D4A - // a NullPointerException will be thrown for an empty cell elment. // @D4A - if (columnObject == null) // @D4A - columnObject = new LineLayoutFormPanel(); // @D4A - - try - { - cell.setElement((HTMLTagElement)columnObject); - } - catch (ClassCastException e) - { - cell.setElement(new HTMLText(columnObject.toString())); - } - - if (metadata.getColumnAlignment(column) != null) //@D5A - cell.setHorizontalAlignment(metadata.getColumnAlignment(column)); //@D5A - - if (metadata.getColumnDirection(column) != null) //@D5A - cell.setDirection(metadata.getColumnDirection(column)); //@D5A - - - // Add the column cell to the row. - row.addColumn(cell); - } - // Add the row of data to the table. - table.addRow(row); - numRowsInTable++; - rowLocation++; - } - - // Notify section completed listeners that the last table is converted. - if (sectionCompletedSupport_ != null) sectionCompletedSupport_.fireSectionCompleted(table.getTag()); //@CRS - - - // Notify listeners that the tables have been converted. - fireCompleted(); - - return table; - } - - /** - * Converts the row data specified by rowdata into an array of HTMLTable objects. - * @param rowdata The RowData object that contains the row data. - * @return An array of HTMLTable objects. - * @exception PropertyVetoException If a change is vetoed. - * @exception RowDataException If a row data error occurs. - **/ - public HTMLTable[] convertToTables(RowData rowdata) throws PropertyVetoException, RowDataException // @A1 $D2C - { - if (rowdata == null) - throw new NullPointerException("rowdata"); - - HTMLTable[] tables = convertRowData(rowdata, rowdata.getMetaData()); - - //Return the list of HTML tables. - return tables; - } - - - /** - * Converts the row data specified by rowdata at the specified page into an HTMLTable object - * when using the maximum table size. - * @param rowdata The RowData object that contains the row data. - * @param page The specific page of the row data. - * @return An HTMLTable object. - * @exception PropertyVetoException If a change is vetoed. - * @exception RowDataException If a row data error occurs. - **/ - public HTMLTable convertToTable(RowData rowdata, int page) throws PropertyVetoException, RowDataException //$D2A - { - if (rowdata == null) - throw new NullPointerException("rowdata"); - - HTMLTable table = convertRowData(rowdata, rowdata.getMetaData(), page); - - // Return the HTML table. - return table; - } - - /** - * Creates a default HTMLTable. - * @return An HTMLTable object. - **/ - private HTMLTable createDefaultTable() - { - HTMLTable table = new HTMLTable(); - - try - { - if (htmlTable_.getHeader() != null) - table.setHeader(htmlTable_.getHeader()); // header - if (htmlTable_.getCaption() != null) - table.setCaption(htmlTable_.getCaption()); // caption - if (htmlTable_.getAlignment() != null) - table.setAlignment(htmlTable_.getAlignment()); // alignment - table.setBorderWidth(htmlTable_.getBorderWidth()); // border width - table.setCellPadding(htmlTable_.getCellPadding()); // cell padding - table.setCellSpacing(htmlTable_.getCellSpacing()); // cell spacing - table.setWidth(htmlTable_.getWidth(), htmlTable_.isWidthInPercent()); // width - table.setHeaderInUse(htmlTable_.isHeaderInUse()); // header usage - } - catch (PropertyVetoException veto) - { /* will never occur. */ - } - return table; - } - - /** - * Converts the row data to a String array of HTML tables. - * If the default table has not been set, it is automatically created with the - * column header information being obtained from the metadata. - * @param rowdata The RowData object that contains the row data. - * @param metadata The RowMetaData object that contains the metadata. - * - * @return An array of HTML strings. - * @exception PropertyVetoException If a change is vetoed. - * @exception RowDataException If a row data error occurs. - * @see #setTable - **/ - String[] doConvert(RowData rowdata, RowMetaData metadata) throws PropertyVetoException, RowDataException - { - HTMLTable[] tables = convertRowData(rowdata, metadata); //$D2C - - // Return the list of tables as String array. - String[] data = new String[tables.length]; - - for (int i=0; i< data.length; i++) - data[i] = tables[i].getTag(); - - return data; - } - - /** - * Fires a completed event to notify that all the tables have been converted. - **/ - private void fireCompleted() - { - if (completedListeners_ == null) return; //@CRS - Vector targets = (Vector) completedListeners_.clone(); - ActionCompletedEvent event = new ActionCompletedEvent(this); - for (int i=0; i< targets.size(); i++) - { - ActionCompletedListener target = (ActionCompletedListener)targets.elementAt(i); - target.actionCompleted(event); - } - } - - /** - * Returns the table header's hyperlinks. - * @return The hyperlinks. - **/ - public HTMLHyperlink[] getHeaderHyperlinks() - { - return links_; - } - - /** - * Returns the maximum number of rows in a table. - * The default maximum size is 0 (no maximum). - * @return The maximum size. - **/ - public int getMaximumTableSize() - { - return maxTableSize_; - } - - /** - * Returns the object hyperlink for the current row's specified column. - * @param rowdata The RowData object that contains the data. - * @param column The column number (0-based). - * - * @return The hyperlink. - **/ - public HTMLHyperlink getObjectHyperlink(RowData rowdata, int column) - { - // Validate the rowdata parameter. - if (rowdata == null) - throw new NullPointerException("rowdata"); - - return getObjectHyperlink(rowdata, rowdata.getCurrentPosition(), column); - } - - /** - * Returns the object's hyperlink at the specified row and column. - * @param rowdata The RowData object that contains the data. - * @param row The row number (0-based). - * @param column The column number (0-based). - * - * @return The hyperlink. - **/ - public HTMLHyperlink getObjectHyperlink(RowData rowdata, int row, int column) - { - // Validate the rowdata parameter. - if (rowdata == null) - throw new NullPointerException("rowdata"); - - // Position to the row. - if (!rowdata.absolute(row)) // Validates the row parameter. - throw new ExtendedIllegalArgumentException("row", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - // Get the object's properties. - Vector properties = rowdata.getObjectProperties(column); // Validates the column parameter. - - HTMLHyperlink link = null; - if (properties != null) - { - // Get the hyperlink associated with the object. - int size = properties.size(); - for (int index=0; index< size; index++) - { - if (properties.elementAt(index) instanceof HTMLHyperlink) - { - link = (HTMLHyperlink)properties.elementAt(index); - break; - } - } - } - return link; - } - - /** - * Returns the default HTML table. - * @return The table. - **/ - public HTMLTable getTable() - { - return htmlTable_; - } - - /** - * Initializes the transient data. - **/ - //private void initializeTransient() @CRS - //{ - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS vetos_ = new VetoableChangeSupport(this); - //@CRS sectionCompletedSupport_ = new SectionCompletedSupport(this); - //@CRS completedListeners_ = new Vector(); - //} - - /** - * Indicates whether the table header is created using the - * metadata. Default value is false (use existing table header). - * @return true if the metadata is used; false otherwise. - **/ - public boolean isUseMetaData() - { - return useMetaData_; - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - - //initializeTransient(); @CRS - } - - /** - * Removes this ActionCompletedListener from the internal list. - * If the ActionCompletedListener is not on the list, nothing is done. - * @param listener The ActionCompletedListener. - * @see #addActionCompletedListener - **/ - public void removeActionCompletedListener(ActionCompletedListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (completedListeners_ != null) completedListeners_.removeElement(listener); //@CRS - } - - /** - * Removes the PropertyChangeListener from the internal list. - * If the PropertyChangeListener is not on the list, nothing is done. - * @param listener The PropertyChangeListener. - * @see #addPropertyChangeListener - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (changes_ != null) changes_.removePropertyChangeListener(listener); //@CRS - } - - /** - * Removes this SectionCompletedListener from the internal list. - * If the SectionCompletedListener is not on the list, nothing is done. - * @param listener The SectionCompletedListener. - * @see #addSectionCompletedListener - **/ - public void removeSectionCompletedListener(SectionCompletedListener listener) - { - if(listener == null) //@KCA - throw new NullPointerException("listener"); //@KCA - if (sectionCompletedSupport_ != null) sectionCompletedSupport_.removeSectionCompletedListener(listener); //@CRS - } - - /** - * Removes the VetoableChangeListener from the internal list. - * If the VetoableChangeListener is not on the list, nothing is done. - * @param listener The VetoableChangeListener. - * @see #addVetoableChangeListener - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ != null) vetos_.removeVetoableChangeListener(listener); //@CRS - } - - /** - * Sets the table header's hyperlinks. - * @param links The hyperlinks. - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setHeaderHyperlinks(HTMLHyperlink[] links) throws PropertyVetoException - { - if (links == null) - throw new NullPointerException("links"); - - HTMLHyperlink[] old = links_; - if (vetos_ != null) vetos_.fireVetoableChange("links", old, links); //@CRS - - links_ = links; - - if (changes_ != null) changes_.firePropertyChange("links", old, links); //@CRS - } - - /** - * Sets the maximum number of rows in a table. The default value is 0 (no maximum). - * @param size The maximum size. - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setMaximumTableSize(int size) throws PropertyVetoException - { - if (size < 0) - throw new ExtendedIllegalArgumentException("size", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - //@CRS Integer oldSize = new Integer(maxTableSize_); - //@CRS Integer newSize = new Integer(size); - int oldSize = maxTableSize_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("size", new Integer(oldSize), new Integer(size)); //@CRS - - maxTableSize_ = size; - - if (changes_ != null) changes_.firePropertyChange("size", new Integer(oldSize), new Integer(size)); //@CRS - } - - /** - * Sets the object's hyperlink at the specified column within the current row. - * The hyperlink is a property of the data object that can be used to link the data object - * to an Uniform Resource Identifier (URI). - * @param rowdata The RowData object that contains the rowdata. - * @param link The hyperlink tag. - * @param column The column number (0-based). - * - * @exception RowDataException If a row data exception occurs. - **/ - public void setObjectHyperlink(RowData rowdata, HTMLHyperlink link, int column) throws RowDataException - { - // Validate the rowdata parameter. - if (rowdata == null) - throw new NullPointerException("rowdata"); - setObjectHyperlink(rowdata, link, rowdata.getCurrentPosition(), column); - } - - /** - * Sets the row object's hyperlink specified by row and column. - * The hyperlink is a property of the data object that can be used to link the data - * object to an Uniform Resource Identifier (URI). - * @param rowdata The RowData object that contains the row data. - * @param link The hyperlink tag. - * @param row The row number (0-based). - * @param column The column number (0-based). - * @exception RowDataException If a row data exception occurs. - **/ - public void setObjectHyperlink(RowData rowdata, HTMLHyperlink link, int row, int column) throws RowDataException - { - // Validate the rowdata parameter. - if (rowdata == null) - throw new NullPointerException("rowdata"); - - // Validate the link parameter. - if (link == null) - throw new NullPointerException("link"); - - // Validate the row parameter. - if (!rowdata.absolute(row)) - throw new ExtendedIllegalArgumentException("row", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - // Get the object's properties. - Vector properties = rowdata.getObjectProperties(column); - - // Add the hyperlink to the object properties list. - if (properties == null) - { - // Create the properties list and add link. - properties = new Vector(); - properties.addElement(link); - } - else - { - // Has properties. - HTMLHyperlink old = null; // The existing hyperlink object. - int linkIndex = -1; // The property index of the the existing hyperlink. - - // Check for existing hyperlink. - int size = properties.size(); - for (int index=0; index< size; index++) - { - if (properties.elementAt(index) instanceof HTMLHyperlink) - { - // Get the existing hyperlink. - old = (HTMLHyperlink)properties.elementAt(index); - linkIndex = index; - break; - } - } - if (old == null) - properties.addElement(link); - else - properties.setElementAt(link, linkIndex); - } - // Set the row object's properties with the new hyperlink. - rowdata.setObjectProperties(properties, column); - } - - /** - * Sets the default HTML table to be used during conversion. - * The default table's column headers must be set. The setUseMetaData - * method can also be used to set the column headers based on the metadata. - * @param table The HTML table. - * @exception PropertyVetoException If the change is vetoed. - * @see #setUseMetaData - **/ - public void setTable(HTMLTable table) throws PropertyVetoException - { - if (table == null) - throw new NullPointerException("table"); - - HTMLTable old = htmlTable_; - if (vetos_ != null) vetos_.fireVetoableChange("table", old, table); //@CRS - - htmlTable_ = table; - - if (changes_ != null) changes_.firePropertyChange("table", old, table); //@CRS - } - - /** - * Sets the table column header. The metadata column labels are - * used in creating the table header. If a column label does not - * exist the column name is used. - * - * @param metadata The meta data. - * @exception RowDataException If a row data error occurs. - * @exception PropertyVetoException If a property change is vetoed. - **/ - private void setTableHeader(RowMetaData metadata) - throws RowDataException, PropertyVetoException - { - // Create the header list. - int numColumns = metadata.getColumnCount(); - HTMLTableHeader[] headerList = new HTMLTableHeader[numColumns]; - - // Get the header names from the metadata. - String colName = ""; - HTMLTagElement element; - for (int column=0; column< numColumns; column++) - { - // Use the column label if it exists; otherwise use the name. - try - { - colName = metadata.getColumnLabel(column); - } - catch (NullPointerException e) - { - colName = metadata.getColumnName(column); - } - // Check for hyperlinks. - if (links_ != null && links_[column] != null) - { - HTMLHyperlink link = links_[column]; - link.setText(colName); - element = link; - } - else - element = new HTMLText(colName); - - headerList[column] = new HTMLTableHeader(element); - } - - // Set the table's header. - htmlTable_.setHeader(headerList); - if (!htmlTable_.isHeaderInUse()) - htmlTable_.setHeaderInUse(true); - } - - /** - * Sets whether the table header is created using the - * metadata. Default value is false (use existing table header). - * @param useMetaData true if the metadata is used; false otherwise. - **/ - public void setUseMetaData(boolean useMetaData) - { - useMetaData_ = useMetaData; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/util/servlet/HTMLTableConverter16.gif b/cvsroot/src/com/ibm/as400/util/servlet/HTMLTableConverter16.gif deleted file mode 100644 index 89f13b2d7..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/HTMLTableConverter16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/HTMLTableConverter32.gif b/cvsroot/src/com/ibm/as400/util/servlet/HTMLTableConverter32.gif deleted file mode 100644 index 040a7e575..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/HTMLTableConverter32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ListMetaData.java b/cvsroot/src/com/ibm/as400/util/servlet/ListMetaData.java deleted file mode 100644 index e5859d140..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/ListMetaData.java +++ /dev/null @@ -1,454 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ListMetaData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import com.ibm.as400.util.html.HTMLConstants; - -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.io.Serializable; - -/** -* A ListMetaData object can be used to find out information about the columns of a -* ListRowData object. -* -*

    ListMetaData objects generate the following events: -*

      -*
    • PropertyChangeEvent
    • -*
    • VetoableChangeEvent
    • -*
    -**/ -public class ListMetaData implements RowMetaData, Serializable -{ - static final long serialVersionUID = -230291530342866669L; - - // metadata values. - private int columnCount_ = 0; // The number of columns. - - private String[] columnName_; // The array of column names. - private String[] columnLabel_; // The array of column labels. - private int[] columnType_; // The array of column types. - private int[] columnSize_; // The array of column sizes. - - private String[] columnAlignment_; // The array of column alignments. @D5A - private String[] columnDirection_; // The array of column alignments. @D5A - - transient private PropertyChangeSupport changes_; //@CRS - transient private VetoableChangeSupport vetos_; //@CRS - - /** - * Constructs a default ListMetaData object. - **/ - public ListMetaData() - { - } - - /** - * Constructs a ListMetaData object with the specified number of columns. - * @param columns The number of columns. - **/ - public ListMetaData(int columns) - { - this(); - try - { - setColumns(columns); - } - catch (PropertyVetoException e) { /* This will never happen. */ } - } - - /** - * Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange - * method is called each time the value of any bound property is changed. - * @see #removePropertyChangeListener - * @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (changes_ == null) changes_ = new PropertyChangeSupport(this); //@CRS - changes_.addPropertyChangeListener(listener); - } - - /** - * Adds the VetoableChangeListener. The specified VetoableChangeListener's vetoableChange - * method is called each time the value of any constrained property is changed. - * @see #removeVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); //@CRS - vetos_.addVetoableChangeListener(listener); - } - - /** - * Returns the number of columns. - * @return The column count. - **/ - public int getColumnCount() - { - return columnCount_; - } - - /** - * Returns the display size in characters of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column display size in characters. - **/ - public int getColumnDisplaySize(int columnIndex) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - return columnSize_[columnIndex]; - } - - /** - * Returns the label of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column label. - **/ - public String getColumnLabel(int columnIndex) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - return columnLabel_[columnIndex]; - } - - /** - * Returns the name of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column name. - **/ - public String getColumnName(int columnIndex) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - return columnName_[columnIndex]; - } - - - /** - * Returns the data type of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column RowMetaDataType. - * @see com.ibm.as400.util.servlet.RowMetaDataType - **/ - public int getColumnType(int columnIndex) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - return columnType_[columnIndex]; - } - - - /** - * Returns the alignment of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The horizontal column alignment. One of the following constants - * defined in HTMLConstants: LEFT, CENTER, RIGHT, or JUSTIFY. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public String getColumnAlignment(int columnIndex) //@D5A - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - return columnAlignment_[columnIndex]; - } - - - /** - * Returns the direction of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column direction. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public String getColumnDirection(int columnIndex) //@D5A - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - return columnDirection_[columnIndex]; - } - - - /** - * Returns the data type name of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column data type name. - **/ - public String getColumnTypeName(int columnIndex) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - if (columnType_[columnIndex] != 0) - return RowMetaDataType.getDataTypeName(columnType_[columnIndex]); - else - return null; - } - - /** - * Returns the precision of the column specified by columnIndex. - * This value is not used. It will always return zero. - * @param columnIndex The column index (0-based). - * @return The column precision (number of decimal digits). - **/ - public int getPrecision(int columnIndex) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - return 0; - } - - /** - * Returns the scale of the column specified by columnIndex. - * This value is not used. It will always return zero. - * @param columnIndex The column index (0-based). - * @return The column scale (number of digits to the right of the decimal point). - **/ - public int getScale(int columnIndex) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - return 0; - } - - /** - * Indicates if the data type is numeric data. - * @param columnIndex The column index (0-based). - * @return true if numeric data; false otherwise. - **/ - public boolean isNumericData(int columnIndex) // @A1 - { - return RowMetaDataType.isNumericData(getColumnType(columnIndex)); - } - - /** - * Indicates if the data type is text data. - * @param columnIndex The column index (0-based). - * @return true if text data; false otherwise. - **/ - public boolean isTextData(int columnIndex) - { - return RowMetaDataType.isTextData(getColumnType(columnIndex)); - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS vetos_ = new VetoableChangeSupport(this); - } - - /** - * Removes the PropertyChangeListener from the internal list. - * If the PropertyChangeListener is not on the list, nothing is done. - * @see #addPropertyChangeListener - * @param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (changes_ != null) changes_.removePropertyChangeListener(listener); //@CRS - } - - /** - * Removes the VetoableChangeListener from the internal list. - * If the VetoableChangeListener is not on the list, nothing is done. - * @see #addVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (vetos_ != null) vetos_.removeVetoableChangeListener(listener); //@CRS - } - - /** - * Sets the specified horizontal alignment for the column data specified by columnIndex. - * @param columnIndex The column index (0-based). - * @param alignment The horizontal column alignment. One of the following constants - * defined in HTMLConstants: LEFT, CENTER, RIGHT, or JUSTIFY. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setColumnAlignment(int columnIndex, String alignment) //@D5A - { - validateColumnIndex(columnIndex); - - // If align is not one of the valid HTMLConstants, throw an exception. - if (alignment == null) - throw new NullPointerException("alignment"); - else if ( !(alignment.equals(HTMLConstants.LEFT)) && !(alignment.equals(HTMLConstants.RIGHT)) && !(alignment.equals(HTMLConstants.CENTER)) && !(alignment.equals(HTMLConstants.JUSTIFY)) ) - throw new ExtendedIllegalArgumentException("alignment", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - columnAlignment_[columnIndex] = alignment; - } - - /** - * Sets the specified direction for the column data specified by columnIndex. - * @param columnIndex The column index (0-based). - * @param dir The column direction. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setColumnDirection(int columnIndex, String dir) //@D5A - { - validateColumnIndex(columnIndex); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - columnDirection_[columnIndex] = dir; - } - - /** - * Sets the specified displaySize for the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @param displaySize The column display size in characters. - **/ - public void setColumnDisplaySize(int columnIndex, int displaySize) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - // Validate the displaySize parameter. - if (displaySize < 1) - throw new ExtendedIllegalArgumentException("displaySize", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - columnSize_[columnIndex] = displaySize; - } - - /** - * Sets the specified label for the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @param label The column label. - **/ - public void setColumnLabel(int columnIndex, String label) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - // Validate the label parameter. - if (label == null) - throw new NullPointerException("label"); - - columnLabel_[columnIndex] = label; - } - - /** - * Sets the specified name for the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @param name The column name. - **/ - public void setColumnName(int columnIndex, String name) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - // Validate the name parameter. - if (name == null) - throw new NullPointerException("name"); - - columnName_[columnIndex] = name; - - // Set the column label as well. - if (columnLabel_[columnIndex] == null) - { - columnLabel_[columnIndex] = name; - } - } - - /** - * Sets the number of columns. Any previous column information is cleared. - * @param columns The number of columns. - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setColumns(int columns) throws PropertyVetoException - { - if (columns <= 0) - throw new ExtendedIllegalArgumentException("columns", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - //@CRS Integer oldInt = new Integer(columnCount_); - //@CRS Integer newInt = new Integer(columns); - int oldInt = columnCount_; //@CRS - - if (vetos_ != null) vetos_.fireVetoableChange("columns", new Integer(oldInt), new Integer(columns)); //@CRS - - columnCount_ = columns; - - columnName_ = new String[columnCount_]; - columnLabel_ = new String[columnCount_]; - columnType_ = new int[columnCount_]; - columnSize_ = new int[columnCount_]; - - columnAlignment_ = new String[columnCount_]; //@D5A - columnDirection_ = new String[columnCount_]; //@D4A - - if (changes_ != null) changes_.firePropertyChange("columns", new Integer(oldInt), new Integer(columns)); //@CRS - } - - /** - * Sets the specified data type for the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @param type The RowMetaDataType type. - * @see com.ibm.as400.util.servlet.RowMetaDataType - **/ - public void setColumnType(int columnIndex, int type) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - // Validate the type parameter. - if (RowMetaDataType.isDataTypeValid(type)) - columnType_[columnIndex] = type; - else - throw new ExtendedIllegalArgumentException("type", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - - /** - * Validates the column index. - * @param columnIndex The column index (0-based). - **/ - private void validateColumnIndex(int columnIndex) - { - if ( columnIndex < 0 || columnIndex >= columnCount_ ) - throw new ExtendedIllegalArgumentException("columnIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ListMetaData16.gif b/cvsroot/src/com/ibm/as400/util/servlet/ListMetaData16.gif deleted file mode 100644 index 9418125b1..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/ListMetaData16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ListMetaData32.gif b/cvsroot/src/com/ibm/as400/util/servlet/ListMetaData32.gif deleted file mode 100644 index c9aff942d..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/ListMetaData32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ListMetaDataBeanInfo.java b/cvsroot/src/com/ibm/as400/util/servlet/ListMetaDataBeanInfo.java deleted file mode 100644 index 387aba37e..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/ListMetaDataBeanInfo.java +++ /dev/null @@ -1,143 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ListMetaDataBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -* The ListMetaDataBeanInfo class provides bean information -* for the ListMetaData class. -**/ -public class ListMetaDataBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private final static Class beanClass = ListMetaData.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_s loader_; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - PropertyDescriptor columnCount = new PropertyDescriptor("columnCount", beanClass, - "getColumnCount", null); - columnCount.setBound(false); - columnCount.setConstrained(false); - columnCount.setDisplayName(loader_.getText("PROP_NAME_COLUMNCOUNT")); - columnCount.setShortDescription(loader_.getText("PROP_DESC_COLUMNCOUNT")); - - properties_ = new PropertyDescriptor[] { columnCount }; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("ListMetaData16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("ListMetaData32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ListRowData.java b/cvsroot/src/com/ibm/as400/util/servlet/ListRowData.java deleted file mode 100644 index 606e0daad..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/ListRowData.java +++ /dev/null @@ -1,431 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ListRowData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import java.beans.PropertyVetoException; -import java.io.Serializable; -import java.util.Vector; -/** -* The ListRowData class represents a list of data. -*

    The list of data is formatted into a series of rows where each row -* contains a finite number of columns determined by the ListMetaData object. -* Each column within a row contains an individual data item. -* -*

    Here are some examples of what a ListRowData object can represent: -*

      -*
    • A directory in the integrated file system.
    • -*
    • A list of jobs.
    • -*
    • A list of messages in a message queue.
    • -*
    • A list of printers.
    • -*
    • A list of spooled files.
    • -*
    • A list of users.
    • -*
    -* -*

    A ListRowData object maintains a position in the list that points to its -* current row of data. The initial position in the list is set before the -* first row. The next method moves to the next row in the list. -* -*

    The getObject method is used to retrieve the column value for -* the current row indexed by the column number. Columns are numbered -* starting from 0. -* -*

    The number, types, and properties of the list's columns are provided -* by the ListMetaData object -* returned by the getMetaData method. -* -*

    ListRowData objects generate the following events: -*

      -*
    • RowDataEvent - The events fired are: -*
        -*
      • rowAdded()
      • -*
      • rowChanged()
      • -*
      • rowRemoved()
      • -*
      -*
    • -*
    -* -*

    The following example creates a ListRowData object and adds rows to represent a directory in the -* integrated file system. -*

    -*  

    // Get the files in a directory. -* AS400 mySystem = new AS400("mySystem.myCompany.com"); -* IFSFile f = new IFSFile(mySystem, pathName); -* FileListener listener = new FileListener(); -* f.list(listener); -* Vector files = listener.getFiles(); -*

    // Create a metadata object. -* ListMetaData metaData = new ListMetaData(4); -*

    // Set first column to be the file name. -* metaData.setColumnName(0, "Name"); -* metaData.setColumnLabel(0, "Name"); -* metaData.setColumnType(0, RowMetaDataType.STRING_DATA_TYPE); -*

    // Set second column to be the file size. -* metaData.setColumnName(1, "Size"); -* metaData.setColumnLabel(1, "Size"); -* metaData.setColumnType(1, RowMetaDataType.INTEGER_DATA_TYPE); -*

    // Set third column to the file data/time stamp. -* metaData.setColumnName(2, "DateTime"); -* metaData.setColumnLabel(2, "Date/Time"); -* metaData.setColumnType(2, RowMetaDataType.STRING_DATA_TYPE); -*

    // Set fourth column to the file type. -* metaData.setColumnName(3, "Type"); -* metaData.setColumnLabel(3, "Type"); -* metaData.setColumnType(3, RowMetaDataType.STRING_DATA_TYPE); -*

    // Create a ListRowData object. -* ListRowData rowData = new ListRowData(); -* rowData.setMetaData(metaData); -*

    // Add directory entries to list. -* for (int i=0; i < files.size(); i++) -* { -* Object[] row = new Object[4]; -* IFSFile file = (IFSFile)files.elementAt(i); -* row[0] = file.getName(); -* row[1] = new Long(file.length()); -* row[2] = new java.util.Date(file.lastModified()); -* if (file.isDirectory()) -* { -* row[3] = "Directory"; -* } -* else -* { -* row[3] = "File"; -* } -* rowData.addRow(row); -* } -*

    -* -* @see com.ibm.as400.util.servlet.ListMetaData -**/ -public class ListRowData extends RowData implements Serializable -{ - static final long serialVersionUID = 1232409461443729991L; - - private RowMetaData metadata_; // The metadata. - transient private RowDataSupport rowdataSupport_; // The list of row data listeners. - - /** - Constructs a default ListRowData object. - **/ - public ListRowData() - { - super(); - //@CRS rowdataSupport_ = new RowDataSupport(this); - } - - /** - * Constructs a ListRowData object with the specified metadata. - * @param metadata The metadata. - * @exception RowDataException If a row data error occurs. - **/ - public ListRowData(RowMetaData metadata) throws RowDataException - { - this(); - - try - { - setMetaData(metadata); - } - catch (PropertyVetoException e) - { /* Will never occur. */ - } - } - - /** - * Adds the specified row to the list. - * The metadata needs to be set before adding a row to the list. - * @param row The row to be added. - * @exception RowDataException If the row length does not match the number - * of columns specified in the metadata. - **/ - public void addRow(Object[] row) throws RowDataException - { - if (metadata_ == null) - { - Trace.log(Trace.ERROR, "Attempting to add a row before setting the metadata."); - throw new ExtendedIllegalStateException("metadata", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - addRow(row, new Vector[metadata_.getColumnCount()]); - } - - /** - * Adds the specified row to the list. Each object in the - * row is assigned a list of properties specified by properties. - * The metadata needs to be set before adding a row to the list. - * @param row The row to be added. - * @param properties The properties list. - * @exception RowDataException If the row length does not match the number - * of columns specified in the metadata. - **/ - public void addRow(Object[] row, Vector[] properties) throws RowDataException - { - - // Validate the row and properties parameters. - validateRow(row); - validateProperties(properties); - - // Add the values. - rows_.addElement(row); - rowProperties_.addElement(properties); - - // Notify listeners. - if (rowdataSupport_ != null) rowdataSupport_.fireAdded(); //@CRS - } - - /** - * Adds the specified row to the list at rowIndex. - * The metadata needs to be set before adding a row to the list. - * @param row The row. - * @param rowIndex The row index (0-based). - * @exception RowDataException If the row length does not match the number - * of columns specified in the metadata. - **/ - public void addRow(Object[] row, int rowIndex) throws RowDataException - { - if (metadata_ == null) - { - Trace.log(Trace.ERROR, "Attempting to add a row before setting the metadata."); - throw new ExtendedIllegalStateException("metadata", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - addRow(row, new Vector[metadata_.getColumnCount()], rowIndex); - } - - /** - * Adds the specified row to the list at rowIndex. - * Each object in row is assigned a properties list specified by properties. - * The metadata needs to be set before adding a row to the list. - * @param row The row. - * @param properties The properties list. - * @param rowIndex The row index (0-based). - * @exception RowDataException If the row length does not match the number - * of columns specified in the metadata. - **/ - public void addRow(Object[] row, Vector[] properties, int rowIndex) throws RowDataException - { - - // Validate the row and properties parameters. - validateRow(row); - validateProperties(properties); - - // Validate the rowIndex parameter. - if (rowIndex < 0 || rowIndex > rows_.size()) - throw new ExtendedIllegalArgumentException("rowIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - // Add the values. - rows_.insertElementAt(row, rowIndex); - rowProperties_.insertElementAt(properties, rowIndex); - - // notify the listeners. - if (rowdataSupport_ != null) rowdataSupport_.fireAdded(); //@CRS - } - - - /** - * Adds a RowDataListener. - * The RowDataListener object is added to an internal list of RowDataListeners; - * it can be removed with removeRowDataListener. - * - * @param listener The RowDataListener. - **/ - public void addRowDataListener(RowDataListener listener) - { - if (rowdataSupport_ == null) rowdataSupport_ = new RowDataSupport(this); //@CRS - rowdataSupport_.addRowDataListener(listener); - } - - /** - * Returns the metadata. - * @return The metadata. - **/ - public RowMetaData getMetaData() - { - return metadata_; - } - - /** - * Returns the data objects for the current row. - * @return The row. - **/ - public Object[] getRow() - { - // Validate that the list is not empty. - validateRowList("Attempting to get the row object"); - - // Get the current row. - validateListPosition("Attempting to get the row object"); - - return(Object[])rows_.elementAt(position_); - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException, RowDataException - { - in.defaultReadObject(); - //@CRS rowdataSupport_ = new RowDataSupport(this); - } - - /** - * Removes the row from the list at the specified rowIndex. - * @param rowIndex The row index (0-based). - **/ - public void removeRow(int rowIndex) - { - - // Validate that the list is not empty. - validateRowList("Attempting to remove a row"); - - // Validate the rowIndex parameter. - if ((rowIndex < 0) || (rowIndex >= rows_.size())) - throw new ExtendedIllegalArgumentException("rowIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - rows_.removeElementAt(rowIndex); - - // Remove the parameter list. - rowProperties_.removeElementAt(rowIndex); - // Notify the listeners. - if (rowdataSupport_ != null) rowdataSupport_.fireRemoved(); //@CRS - } - - /** - * Removes this RowDataListener from the internal list. - * If the RowDataListener is not on the list, nothing is done. - * @param listener The RowDataListener. - **/ - public void removeRowDataListener(RowDataListener listener) - { - if(listener == null) - throw new NullPointerException("listener"); - if (rowdataSupport_ != null) rowdataSupport_.removeRowDataListener(listener); //@CRS - } - - /** - * Sets the metadata. - * @param metadata The metadata. - * @exception RowDataException If a row data error occurs. - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setMetaData(RowMetaData metadata) throws RowDataException, PropertyVetoException - { - // Validate the metadata parameter. - if (metadata == null) - throw new NullPointerException("metaData"); - - if (metadata.getColumnCount() == 0) - { - Trace.log(Trace.ERROR, "The metadata parameter 'columns' is invalid."); - throw new ExtendedIllegalStateException("metadata columns", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - RowMetaData old = metadata_; - if (vetos_ != null) vetos_.fireVetoableChange("metadata", old, metadata); //@CRS - - metadata_ = metadata; - - if (changes_ != null) changes_.firePropertyChange("metadata", old, metadata); //@CRS - } - - /** - * Sets the row at the specified rowIndex to be the specified row. - * @param row The updated row. - * @param rowIndex The row index (0-based). - * @exception RowDataException If the row length does not match the number - * of columns specified in the metadata. - **/ - public void setRow(Object[] row, int rowIndex) throws RowDataException - { - if (metadata_ == null) - { - Trace.log(Trace.ERROR, "Attempting to add a row before setting the metadata."); - throw new ExtendedIllegalStateException("metadata", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - setRow(row, new Vector[metadata_.getColumnCount()], rowIndex); - } - - /** - * Sets the row at the specified rowIndex to be the specified row. - * Each object in the row is assigned a properties list specified by properties. - * @param row The updated row. - * @param properties The properties list. - * @param rowIndex The row index (0-based). - * @exception RowDataException If the row length does not match the number - * of columns specified in the metadata. - **/ - public void setRow(Object[] row, Vector[] properties, int rowIndex) throws RowDataException - { - - // Validate that the list is not empty. - validateRowList("Attempting to change a row"); - - // Validate the row parameter. - validateRow(row); - - // Validate the rowIndex parameter. - if (rowIndex < 0 || rowIndex >= rows_.size()) - throw new ExtendedIllegalArgumentException("rowIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - // Validate the properties parameter. - validateProperties(properties); - - // Set the new values. - rows_.setElementAt(row, rowIndex); - rowProperties_.setElementAt(properties, rowIndex); - - // Notify the listeners. - if (rowdataSupport_ != null) rowdataSupport_.fireChanged(); //@CRS - } - - /** - * Validates the row properties. - * @param properties The row properties. - * @exception RowDataException If a rowdata error occurs. - **/ - private void validateProperties(Vector[] properties) throws RowDataException - { - // Validate the properties parameter. - if (properties == null) - throw new NullPointerException("properties"); - - // Verify the length matches the number of columns. - if (properties.length != metadata_.getColumnCount()) - throw new ExtendedIllegalArgumentException("properties", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - /** - * Validates the specified row. - * @param row The row. - * @exception RowDataException If a rowdata error occurs. - **/ - private void validateRow(Object[] row) throws RowDataException - { - // Validate the row parameter. - if (row == null) - throw new NullPointerException("row"); - - // Verify that the metadata is set. Used in determining the number of columns in a row. - if (metadata_ == null) - { - Trace.log(Trace.ERROR, "Attempting to process a row before setting the metadata."); - throw new ExtendedIllegalStateException("metadata", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Verify that the length matches the number of columns specified by the metadata. - if (row.length != metadata_.getColumnCount()) - throw new ExtendedIllegalArgumentException("row", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ListRowData16.gif b/cvsroot/src/com/ibm/as400/util/servlet/ListRowData16.gif deleted file mode 100644 index 53f475dbd..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/ListRowData16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ListRowData32.gif b/cvsroot/src/com/ibm/as400/util/servlet/ListRowData32.gif deleted file mode 100644 index 55dbec570..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/ListRowData32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ListRowDataBeanInfo.java b/cvsroot/src/com/ibm/as400/util/servlet/ListRowDataBeanInfo.java deleted file mode 100644 index 2bc697fb7..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/ListRowDataBeanInfo.java +++ /dev/null @@ -1,155 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ListRowDataBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -* The ListRowDataBeanInfo class provides bean information -* for the ListRowData class. -**/ -public class ListRowDataBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private final static Class beanClass = ListRowData.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_s loader_; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - PropertyDescriptor currentPosition = new PropertyDescriptor("currentPosition", beanClass, "getCurrentPosition", null); - currentPosition.setBound(false); - currentPosition.setConstrained(false); - currentPosition.setDisplayName(loader_.getText("PROP_NAME_CURRENTPOSITION")); - currentPosition.setShortDescription(loader_.getText("PROP_DESC_CURRENTPOSITION")); - - PropertyDescriptor length = new PropertyDescriptor("length", beanClass, "length", null); - length.setBound(false); - length.setConstrained(false); - length.setDisplayName(loader_.getText("PROP_NAME_LENGTH")); - length.setShortDescription(loader_.getText("PROP_DESC_LENGTH")); - - PropertyDescriptor metadata = new PropertyDescriptor("metadata", beanClass, - "getMetaData", "setMetaData"); - metadata.setBound(true); - metadata.setConstrained(true); - metadata.setDisplayName(loader_.getText("PROP_NAME_METADATA")); - metadata.setShortDescription(loader_.getText("PROP_DESC_METADATA")); - - properties_ = new PropertyDescriptor[] { currentPosition, length, metadata }; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("ListRowData16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("ListRowData32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/RecordFormatMetaData.java b/cvsroot/src/com/ibm/as400/util/servlet/RecordFormatMetaData.java deleted file mode 100644 index 907c0a325..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/RecordFormatMetaData.java +++ /dev/null @@ -1,566 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordFormatMetaData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; - -import com.ibm.as400.util.html.HTMLConstants; - -import com.ibm.as400.access.AS400Array; -import com.ibm.as400.access.AS400DataType; -import com.ibm.as400.access.AS400Bin2; // Java Short -import com.ibm.as400.access.AS400Bin4; // Java Integer -import com.ibm.as400.access.AS400ByteArray; // Java Byte[] -import com.ibm.as400.access.AS400Float4; // Java Float -import com.ibm.as400.access.AS400Float8; // Java Double -import com.ibm.as400.access.AS400PackedDecimal; // Java BigDecimal -import com.ibm.as400.access.AS400Structure; -import com.ibm.as400.access.AS400Text; -import com.ibm.as400.access.AS400UnsignedBin2; // Java Integer -import com.ibm.as400.access.AS400UnsignedBin4; // Java Long -import com.ibm.as400.access.AS400ZonedDecimal; // Java BigDecimal -import com.ibm.as400.access.FieldDescription; -import com.ibm.as400.access.RecordFormat; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.io.Serializable; - -/** -* A RecordFormatMetaData object can be used to find out information about the columns of a -* RecordListRowData object. -* -*

    RecordFormatMetaData objects generate the following events: -*

      -*
    • PropertyChangeEvent
    • -*
    • VetoableChangeEvent
    • -*
    -**/ -public class RecordFormatMetaData implements RowMetaData, Serializable -{ - static final long serialVersionUID = 5676240820170682074L; - - private RecordFormat recordFormat_; // The record format. - transient private String[] columnLabel_; // The column label list. - - transient private PropertyChangeSupport changes_; //@CRS - transient private VetoableChangeSupport vetos_; //@CRS - - private String[] columnAlignment_; // The array of column alignments. @D5A - private String[] columnDirection_; // The array of column alignments. @D5A - - - /** - * Constructs a default RecordFormatMetaData object. - **/ - public RecordFormatMetaData() - { - } - - /** - * Constructs a RecordFormatMetaData object with the specified recordFormat. - * @param recordFormat The record format. - **/ - public RecordFormatMetaData(RecordFormat recordFormat) - { - try - { - setRecordFormat(recordFormat); - } - catch (PropertyVetoException e) { /* Will never occur. */ } - } - - /** - * Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange - * method is called each time the value of any bound property is changed. - * @see #removePropertyChangeListener - * @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (changes_ == null) changes_ = new PropertyChangeSupport(this); //@CRS - changes_.addPropertyChangeListener(listener); - } - - /** - * Adds the VetoableChangeListener. The specified VetoableChangeListener's vetoableChange - * method is called each time the value of any constrained property is changed. - * @see #removeVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); //@CRS - vetos_.addVetoableChangeListener(listener); - } - - - /** - * Returns the alignment of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The horizontal column alignment. One of the following constants - * defined in HTMLConstants: LEFT, CENTER, RIGHT, or JUSTIFY. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public String getColumnAlignment(int columnIndex) //@D5A - { - // Validate that the record format is set. - validateRecordFormat("Attempting to get the column alignment"); - - // Validate the column parameter. - validateColumnIndex(columnIndex); - - return columnAlignment_[columnIndex]; - } - - - /** - * Returns the direction of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column direction. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public String getColumnDirection(int columnIndex) //@D5A - { - // Validate that the record format is set. - validateRecordFormat("Attempting to get the column direction"); - - // Validate the column parameter. - validateColumnIndex(columnIndex); - - return columnDirection_[columnIndex]; - } - - - /** - * Returns the number of columns. - * @return The column count. - **/ - public int getColumnCount() - { - // Verify that the record format has been set. - if (recordFormat_ == null) - { - Trace.log(Trace.ERROR, "Attempting to get the column count before setting the record format."); - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - return recordFormat_.getNumberOfFields(); - } - - - /** - * Returns the display size in characters of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column display size in characters. - **/ - public int getColumnDisplaySize(int columnIndex) - { - // Validate that the record format is set. - validateRecordFormat("Attempting to get the column display size"); - - // Validate the columnIndex parameter. - validateColumnIndex(columnIndex); - - // Get the field description. - FieldDescription fd = recordFormat_.getFieldDescription(columnIndex); - return fd.getLength(); - } - - /** - * Returns the label of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column label. - **/ - public String getColumnLabel(int columnIndex) - { - // Validate that the record format is set. - validateRecordFormat("Attempting to get the column label"); - - // Validate the columnIndex parameter. - validateColumnIndex(columnIndex); - - String label = columnLabel_[columnIndex]; - - // Use column name if null. - if (label == null) - label = getColumnName(columnIndex); - columnLabel_[columnIndex] = label; - - return label; - } - - /** - * Returns the name of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column name. - **/ - public String getColumnName(int columnIndex) - { - // Validate that the record format is set. - validateRecordFormat("Attempting to get the column name"); - - // Validate the columnIndex parameter. - validateColumnIndex(columnIndex); - - // Pull the column name from the field description. - FieldDescription fd = recordFormat_.getFieldDescription(columnIndex); - return fd.getFieldName(); - } - - /** - * Returns the data type of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column RowMetaDataType. - * @see com.ibm.as400.util.servlet.RowMetaDataType - **/ - public int getColumnType(int columnIndex) - { - // Validate that the record format is set. - validateRecordFormat("Attempting to get the column type"); - - // Validate the columnIndex parameter. - validateColumnIndex(columnIndex); - - // Get the data type from the field description. - FieldDescription fd = recordFormat_.getFieldDescription(columnIndex); - AS400DataType datatype = fd.getDataType(); - - if (datatype instanceof AS400Bin2) - return RowMetaDataType.SHORT_DATA_TYPE; - else if (datatype instanceof AS400Bin4) - return RowMetaDataType.INTEGER_DATA_TYPE; - else if (datatype instanceof AS400ByteArray) - return RowMetaDataType.BYTE_ARRAY_DATA_TYPE; - else if (datatype instanceof AS400Float4) - return RowMetaDataType.FLOAT_DATA_TYPE; - else if (datatype instanceof AS400Float8) - return RowMetaDataType.DOUBLE_DATA_TYPE; - else if (datatype instanceof AS400PackedDecimal) - return RowMetaDataType.BIG_DECIMAL_DATA_TYPE; - else if (datatype instanceof AS400Structure) - return RowMetaDataType.BYTE_ARRAY_DATA_TYPE; - else if (datatype instanceof AS400Array) - return RowMetaDataType.BYTE_ARRAY_DATA_TYPE; - else if (datatype instanceof AS400Text) - return RowMetaDataType.STRING_DATA_TYPE; - else if (datatype instanceof AS400UnsignedBin2) - return RowMetaDataType.INTEGER_DATA_TYPE; - else if (datatype instanceof AS400UnsignedBin4) - return RowMetaDataType.LONG_DATA_TYPE; - else if (datatype instanceof AS400ZonedDecimal) - return RowMetaDataType.BIG_DECIMAL_DATA_TYPE; - else - return RowMetaDataType.BYTE_ARRAY_DATA_TYPE; - } - - /** - * Returns the data type name of column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column data type name. - **/ - public String getColumnTypeName(int columnIndex) - { - // Validate that the record format is set. - validateRecordFormat("Attempting to get the column type name"); - - // Validate the columnIndex parameter. - validateColumnIndex(columnIndex); - - // Get the data type from the field description. - FieldDescription fd = recordFormat_.getFieldDescription(columnIndex); - AS400DataType datatype = fd.getDataType(); - - if (datatype instanceof AS400Bin2) - return RowMetaDataType.getDataTypeName(RowMetaDataType.SHORT_DATA_TYPE); - else if (datatype instanceof AS400Bin4) - return RowMetaDataType.getDataTypeName(RowMetaDataType.INTEGER_DATA_TYPE); - else if (datatype instanceof AS400ByteArray) - return RowMetaDataType.getDataTypeName(RowMetaDataType.BYTE_ARRAY_DATA_TYPE); - else if (datatype instanceof AS400Float4) - return RowMetaDataType.getDataTypeName(RowMetaDataType.FLOAT_DATA_TYPE); - else if (datatype instanceof AS400Float8) - return RowMetaDataType.getDataTypeName(RowMetaDataType.DOUBLE_DATA_TYPE); - else if (datatype instanceof AS400PackedDecimal) - return RowMetaDataType.getDataTypeName(RowMetaDataType.BIG_DECIMAL_DATA_TYPE); - else if (datatype instanceof AS400Structure) - return RowMetaDataType.getDataTypeName(RowMetaDataType.BYTE_ARRAY_DATA_TYPE); - else if (datatype instanceof AS400Array) - return RowMetaDataType.getDataTypeName(RowMetaDataType.BYTE_ARRAY_DATA_TYPE); - else if (datatype instanceof AS400Text) - return RowMetaDataType.getDataTypeName(RowMetaDataType.STRING_DATA_TYPE); - else if (datatype instanceof AS400UnsignedBin2) - return RowMetaDataType.getDataTypeName(RowMetaDataType.INTEGER_DATA_TYPE); - else if (datatype instanceof AS400UnsignedBin4) - return RowMetaDataType.getDataTypeName(RowMetaDataType.LONG_DATA_TYPE); - else if (datatype instanceof AS400ZonedDecimal) - return RowMetaDataType.getDataTypeName(RowMetaDataType.BIG_DECIMAL_DATA_TYPE); - else - return RowMetaDataType.getDataTypeName(RowMetaDataType.BYTE_ARRAY_DATA_TYPE); - } - - /** - * Returns the precision of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column precision (number of decimal digits). - **/ - public int getPrecision(int columnIndex) - { - // Validate that the record format is set. - validateRecordFormat("Attempting to get the precision"); - - // Validate the columnIndex parameter. - validateColumnIndex(columnIndex); - - // Get the data type from the field description. - FieldDescription fd = recordFormat_.getFieldDescription(columnIndex); - AS400DataType datatype = fd.getDataType(); - - if (datatype instanceof AS400ZonedDecimal) - return ((AS400ZonedDecimal)datatype).getNumberOfDigits(); - else if (datatype instanceof AS400PackedDecimal) - return ((AS400PackedDecimal)datatype).getNumberOfDigits(); - else - return 0; - } - - /** - * Returns the record format. - * @return The record format. - **/ - public RecordFormat getRecordFormat() - { - return recordFormat_; - } - - /** - * Returns the scale of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column scale (number of digits to the right of the decimal point). - **/ - public int getScale(int columnIndex) - { - // Validate that the record format is set. - validateRecordFormat("Attempting to get the scale"); - - // Validate the columnIndex parameter. - validateColumnIndex(columnIndex); - - // Get the data type from the field description. - FieldDescription fd = recordFormat_.getFieldDescription(columnIndex); - AS400DataType datatype = fd.getDataType(); - - if (datatype instanceof AS400ZonedDecimal) - return ((AS400ZonedDecimal)datatype).getNumberOfDecimalPositions(); - else if (datatype instanceof AS400PackedDecimal) - return ((AS400PackedDecimal)datatype).getNumberOfDecimalPositions(); - else - return 0; - } - - /** - * Indicates if the column specified by columnIndex contains numeric data. - * @param columnIndex The column index (0-based). - * @return true if numeric data; false otherwise. - **/ - public boolean isNumericData(int columnIndex) // @A1 - { - return RowMetaDataType.isNumericData(getColumnType(columnIndex)); - } - - /** - * Indicates if the column specified by columnIndex contains text data. - * @param columnIndex The column index (0-based). - * @return true if text data; false otherwise. - **/ - public boolean isTextData(int columnIndex) - { - return RowMetaDataType.isTextData(getColumnType(columnIndex)); - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException, RowDataException - { - in.defaultReadObject(); - - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS vetos_ = new VetoableChangeSupport(this); - - if (recordFormat_ != null) - { - try - { - setRecordFormat(recordFormat_); - } - catch (PropertyVetoException e) { /* do nothing. */ } - } - } - - /** - * Removes the PropertyChangeListener from the internal list. - * If the PropertyChangeListener is not on the list, nothing is done. - * @see #addPropertyChangeListener - * @param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (changes_ != null) changes_.removePropertyChangeListener(listener); //@CRS - } - - /** - * Removes the VetoableChangeListener from the internal list. - * If the VetoableChangeListener is not on the list, nothing is done. - * @see #addVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (vetos_ != null) vetos_.removeVetoableChangeListener(listener); //@CRS - } - - - - /** - * Sets the specified horizontal alignment for the column data specified by columnIndex. - * @param columnIndex The column index (0-based). - * @param alignment The horizontal column alignment. One of the following constants - * defined in HTMLConstants: LEFT, CENTER, RIGHT, or JUSTIFY. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setColumnAlignment(int columnIndex, String alignment) //@D5A - { - // Validate that the record format is set. - validateRecordFormat("Attempting to set the column alignment"); - - // Validate the label parameter. - if (alignment == null) - throw new NullPointerException("alignment"); - - validateColumnIndex(columnIndex); - - // If align is not one of the valid HTMLConstants, throw an exception. - if ( !(alignment.equals(HTMLConstants.LEFT)) && !(alignment.equals(HTMLConstants.RIGHT)) && !(alignment.equals(HTMLConstants.CENTER)) && !(alignment.equals(HTMLConstants.JUSTIFY)) ) - throw new ExtendedIllegalArgumentException("alignment", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - columnAlignment_[columnIndex] = alignment; - } - - /** - * Sets the specified direction for the column data specified by columnIndex. - * @param columnIndex The column index (0-based). - * @param dir The column direction. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setColumnDirection(int columnIndex, String dir) //@D5A - { - // Validate that the record format is set. - validateRecordFormat("Attempting to set the column directionl"); - - // Validate the label parameter. - if (dir == null) - throw new NullPointerException("dir"); - - validateColumnIndex(columnIndex); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - columnDirection_[columnIndex] = dir; - } - - /** - * Sets the specified label at the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @param label The label. - **/ - public void setColumnLabel(int columnIndex, String label) - { - // Validate that the record format is set. - validateRecordFormat("Attempting to set the column label"); - - // Validate the label parameter. - if (label == null) - throw new NullPointerException("label"); - - // Validate the columnIndex parameter. - validateColumnIndex(columnIndex); - - columnLabel_[columnIndex] = label; - } - - /** - * Sets the record format. - * @param recordFormat The record format. - * @exception PropertyVetoException If a change is vetoed. - **/ - public void setRecordFormat(RecordFormat recordFormat) throws PropertyVetoException - { - // Validate the format parameter. - if (recordFormat == null) - throw new NullPointerException("recordFormat"); - - RecordFormat old = recordFormat_; - if (vetos_ != null) vetos_.fireVetoableChange("recordFormat", old, recordFormat); //@CRS - - recordFormat_ = recordFormat; - - if (changes_ != null) changes_.firePropertyChange("recordFormat", old, recordFormat); //@CRS - - // Initialize the label array. - int count = getColumnCount(); //@D5A - columnLabel_ = new String[count]; //@D5C - columnAlignment_ = new String[count]; //@D5A - columnDirection_ = new String[count]; //@D5A - } - - /** - * Validates the column index. - * @param columnIndex The column index. - **/ - private void validateColumnIndex(int columnIndex) - { - if ( (columnIndex < 0) || (columnIndex >= recordFormat_.getNumberOfFields()) ) - throw new ExtendedIllegalArgumentException("columnIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - /** - * Validates the record format. - * @param action The attempted action. - **/ - private void validateRecordFormat(String action) - { - if (recordFormat_ == null) - { - Trace.log(Trace.ERROR, action + " before setting the record format."); - throw new ExtendedIllegalStateException("recordFormat", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/RecordFormatMetaData16.gif b/cvsroot/src/com/ibm/as400/util/servlet/RecordFormatMetaData16.gif deleted file mode 100644 index 23272c1af..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/RecordFormatMetaData16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/RecordFormatMetaData32.gif b/cvsroot/src/com/ibm/as400/util/servlet/RecordFormatMetaData32.gif deleted file mode 100644 index c1066af7e..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/RecordFormatMetaData32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/RecordFormatMetaDataBeanInfo.java b/cvsroot/src/com/ibm/as400/util/servlet/RecordFormatMetaDataBeanInfo.java deleted file mode 100644 index 59dcf4569..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/RecordFormatMetaDataBeanInfo.java +++ /dev/null @@ -1,150 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordFormatMetaDataBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -* The RecordFormatMetaDataBeanInfo class provides bean information -* for the RecordFormatMetaData class. -**/ -public class RecordFormatMetaDataBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private final static Class beanClass = RecordFormatMetaData.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_s loader_; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - PropertyDescriptor columnCount = new PropertyDescriptor("columnCount", beanClass, - "getColumnCount", null); - columnCount.setBound(false); - columnCount.setConstrained(false); - columnCount.setDisplayName(loader_.getText("PROP_NAME_COLUMNCOUNT")); - columnCount.setShortDescription(loader_.getText("PROP_DESC_COLUMNCOUNT")); - - PropertyDescriptor recordFormat = new PropertyDescriptor("recordFormat", beanClass, - "getRecordFormat", "setRecordFormat"); - recordFormat.setBound(true); - recordFormat.setConstrained(true); - recordFormat.setDisplayName(loader_.getText("PROP_NAME_RECORDFORMAT")); - recordFormat.setShortDescription(loader_.getText("PROP_DESC_RECORDFORMAT")); - - properties_ = new PropertyDescriptor[] { columnCount, recordFormat }; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("RecordFormatMetaData16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("RecordFormatMetaData32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/RecordListRowData.java b/cvsroot/src/com/ibm/as400/util/servlet/RecordListRowData.java deleted file mode 100644 index 4ef292fee..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/RecordListRowData.java +++ /dev/null @@ -1,465 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordListRowData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Record; -import com.ibm.as400.access.RecordFormat; -import com.ibm.as400.access.Trace; -import java.beans.PropertyVetoException; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.util.Vector; - -/** -* The RecordListRowData class represents a list of records. -* -*

    A Record represents the data described by a RecordFormat. It can represent: -*

      -*
    • An entry in a data queue.
    • -*
    • The parameter data provided to or returned by a program call.
    • -*
    • A record to be written to or read from a file.
    • -*
    • Any data returned from the IBM i system that needs to be converted between IBM i -* format and Java format.
    • -*
    -* -*

    A RecordListRowData object maintains a position in the list that points to its -* current row of data. The initial position in the list is set before the -* first row. The next method moves to the next row in the list. -* -*

    The getObject method is used to retrieve the column value for -* the current row indexed by the column number. Columns are numbered -* starting from 0. -* -*

    The number, types, and properties of the list's columns are provided -* by the RecordFormatMetaData -* object returned by the getMetaData method. -* -*

    RecordListRowData objects generate the following events: -*

      -*
    • RowDataEvent - The events fired are: -*
        -*
      • rowAdded()
      • -*
      • rowChanged()
      • -*
      • rowRemoved()
      • -*
      -*
    • -*
    -* -*

    The following example creates a RecordListRowData object and adds the records from a -* sequential file. -*

    -*  

    // Create an object to represent the system. -* AS400 mySystem = new AS400("mySystem.myCompany.com"); -*

    // Create a file object that represents the file. -* SequentialFile sf = new SequentialFile(mySystem, ifspath); -*

    // Set the record format of the file. -* sf.setRecordFormat(); -*

    // Get the records in the file. -* Record[] records = sf.readAll(); -*

    // Create a RecordListRowData object and add the records. -* RecordListRowData rowData = new RecordListRowData(); -* for (int i=0; i < records.length; i++) -* { -*

    rowData.addRow(records[i]); -* } -*

    -**/ -public class RecordListRowData extends RowData implements Serializable -{ - static final long serialVersionUID = 7785461189425222072L; - - private RecordFormat recordFormat_; // The record format. - private RecordFormatMetaData metadata_; // The record metadata. - - transient private RowDataSupport rowdataSupport_; // The list of row data listeners. - transient private Record currentRecord_; // The current record. - transient private int currentRecordIndex_ = -1; // The row position of the current record. - - /** - Constructs a default RecordListRowData object. - **/ - public RecordListRowData() - { - super(); - //@CRS rowdataSupport_ = new RowDataSupport(this); - } - - /** - * Constructs a RecordListRowData object with the specified recordFormat. - * @param recordFormat The record format. - **/ - public RecordListRowData(RecordFormat recordFormat) - { - this(); - - try - { - setRecordFormat(recordFormat); - } - catch (PropertyVetoException e) - { /* Will never happen. */ - } - } - - /** - * Adds the specified record to the end of the record list. - * @param record The record to be added. - * @exception RowDataException If a row data error occurs. - **/ - public void addRow(Record record) throws RowDataException - { - // Validate the record parameter. - if (record == null) - throw new NullPointerException("record"); - - // Add the row. - addRow(record, new Vector[record.getRecordFormat().getNumberOfFields()]); - } - - /** - * Adds the specified record to the end of the record list. - * Each field in the record is assigned the appropriate properties list - * specified by properties. - * @param record The record to be added. - * @param properties The properties list. - **/ - public void addRow(Record record, Vector[] properties) - { - - // Validate the record parameter. - validateRecord(record); - - // Validate the properties parameter. - validateProperties(properties); - - // Add the row and properties to the list. - rows_.addElement(record); - rowProperties_.addElement(properties); - - // Notify the listeners. - if (rowdataSupport_ != null) rowdataSupport_.fireAdded(); //@CRS - } - - /** - * Adds the specified record to the record list at the specified rowIndex. - * @param record The record to be added. - * @param rowIndex The rowIndex (0-based). - * @exception RowDataException If a row data error occurs. - **/ - public void addRow(Record record, int rowIndex) throws RowDataException - { - // Validate the record parameter. - if (record == null) - throw new NullPointerException("record"); - - addRow(record, rowIndex, new Vector[record.getRecordFormat().getNumberOfFields()]); - } - - /** - * Adds the specified record to the record list at the specified rowIndex. - * Each field in the record is assigned the appropriate properties list specified by - * properties. - * @param record The record to be added. - * @param rowIndex The row index (0-based). - * @param properties The properties list. - **/ - public void addRow(Record record, int rowIndex, Vector[] properties) - { - - // Validate the record parameter. - validateRecord(record); - - // Validate the rowIndex parameter. - validateRowIndex(rowIndex); - - // Validate the properties parameter. - validateProperties(properties); - - // Add the row and properties to the list. - rows_.insertElementAt(record, rowIndex); - rowProperties_.insertElementAt(properties, rowIndex); - - // Notify the listeners. - if (rowdataSupport_ != null) rowdataSupport_.fireAdded(); //@CRS - } - - /** - * Adds a RowDataListener. - * The RowDataListener object is added to an internal list of row data listeners; - * it can be removed with removeRowDataListener. - * - * @param listener The RowDataListener. - **/ - public void addRowDataListener(RowDataListener listener) - { - if (rowdataSupport_ == null) rowdataSupport_ = new RowDataSupport(this); //@CRS - rowdataSupport_.addRowDataListener(listener); - } - - /** - * Returns the metadata. - * @return The metadata. - **/ - public RowMetaData getMetaData() - { - return metadata_; - } - - /** - * Returns the current record's field at the specified columnIndex. - * @param columnIndex The column index (0-based). - * @return The field object. - * @exception RowDataException If a row data error occurs. - **/ - public Object getObject(int columnIndex) throws RowDataException - { - String action = "Attempting to get the column object"; - - // Verify that a row has been added. - validateRowList(action); - - // Validate the columnIndex parameter. - if ((columnIndex < 0) || (columnIndex >= metadata_.getColumnCount())) - throw new ExtendedIllegalArgumentException("columnIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - // Check the current row. - validateListPosition(action); - - // Get the current record. - if (currentRecordIndex_ != position_) - { - currentRecord_ = (Record)rows_.elementAt(position_); - currentRecordIndex_ = position_; - } - - try - { - return currentRecord_.getField(columnIndex); - } - catch (UnsupportedEncodingException e) - { - Trace.log(Trace.ERROR, "Rethrowing UnsupportedEncodingException"); - throw new RowDataException(e); - } - } - - /** - * Returns the record format. - * @return The record format. - **/ - public RecordFormat getRecordFormat() - { - return recordFormat_; - } - - /** - * Returns the Record object for the current row. - * @return The row. - **/ - public Record getRow() - { - String action = "Attempting to get the row object"; - - // Validate the list is not empty. - validateRowList(action); - - // Validate the list position. - validateListPosition(action); - - return(Record)rows_.elementAt(position_); - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException, RowDataException, PropertyVetoException - { - in.defaultReadObject(); - - //@CRS rowdataSupport_ = new RowDataSupport(this); - currentRecordIndex_ = -1; - } - - /** - * Removes this RowDataListener from the internal list. - * If the RowDataListener is not on the list, nothing is done. - * @param listener The RowDataListener. - **/ - public void removeRowDataListener(RowDataListener listener) - { - if(listener == null) - throw new NullPointerException("listener"); - if (rowdataSupport_ != null) rowdataSupport_.removeRowDataListener(listener); //@CRS - } - - /** - * Removes a record from the record list at the specified rowIndex. - * @param rowIndex The row index (0-based). - **/ - public void removeRow(int rowIndex) - { - - // Verify the list is not empty. - validateRowList("Attempting to remove a row"); - - // Validate the rowIndex parameter. - if (rowIndex < 0 || rowIndex >= rows_.size()) - throw new ExtendedIllegalArgumentException("rowIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - // Remove the row and row properties from the list. - rows_.removeElementAt(rowIndex); - rowProperties_.removeElementAt(rowIndex); - - // Notify the listeners. - if (rowdataSupport_ != null) rowdataSupport_.fireRemoved(); //@CRS - } - - /** - * Sets the record at the specified rowIndex to be the specified record. - * @param record The record. - * @param rowIndex The row index (0-based). - **/ - public void setRow(Record record, int rowIndex) - { - // Validate the record parameter. - if (record == null) - throw new NullPointerException("record"); - - setRow(record, rowIndex, new Vector[record.getRecordFormat().getNumberOfFields()]); - } - - /** - * Sets the record at the specified rowIndex to be the specified record. - * Each object in the row is assigned the appropriate properties list specified by - * properties. - * @param record The record. - * @param rowIndex The row index (0-based). - * @param properties The row properties. - **/ - public void setRow(Record record, int rowIndex, Vector[] properties) - { - - // Validate that the list is not empty. - validateRowList("Attempting to change the row"); - - // Validate the record parameter. - validateRecord(record); - - // Validate the row parameter. - if (rowIndex < 0 || rowIndex >= rows_.size()) - throw new ExtendedIllegalArgumentException("rowIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - // Validate the properites parameter. - validateProperties(properties); - - // Set the row and properties to the new values. - rows_.setElementAt(record, rowIndex); - rowProperties_.setElementAt(properties, rowIndex); - - // Notify the listeners. - if (rowdataSupport_ != null) rowdataSupport_.fireChanged(); //@CRS - } - - /** - * Sets the record format for the record list. - * The metadata is set using the specified recordFormat. - * If a record format already exists, then setting a new record format - * will remove all rows from the list. - * @param recordFormat The record format. - * @exception PropertyVetoException If a change is vetoed. - * @see #getRecordFormat - * @see #getMetaData - **/ - public void setRecordFormat(RecordFormat recordFormat) throws PropertyVetoException - { - // Validate the recordFormat parameter. - if (recordFormat == null) - throw new NullPointerException("recordFormat"); - - RecordFormat old = recordFormat_; - if (vetos_ != null) vetos_.fireVetoableChange("recordFormat", old, recordFormat); //@CRS - - recordFormat_ = recordFormat; - - // Remove all existing rows and row properties. - if (!rows_.isEmpty()) - { - rows_ = new Vector(); - rowProperties_ = new Vector(); - } - - if (changes_ != null) changes_.firePropertyChange("recordFormat", old, recordFormat); //@CRS - - // Set the metadata. - if (metadata_ == null) - metadata_ = new RecordFormatMetaData(recordFormat_); - else - metadata_.setRecordFormat(recordFormat_); - } - - /** - * Validates the row properties. - * @param properties The properties for the row. - **/ - private void validateProperties(Vector[] properties) - { - if (properties == null) - throw new NullPointerException("properties"); - - // Verify the length match the number of columns. - if (properties.length != metadata_.getColumnCount()) - throw new ExtendedIllegalArgumentException("properties", ExtendedIllegalArgumentException.LENGTH_NOT_VALID); - } - - /** - * Validates the record. - * @param record The record. - **/ - private void validateRecord(Record record) - { - if (record == null) - throw new NullPointerException("record"); - - try - { - // Check the record format. - if (recordFormat_ == null) - setRecordFormat(record.getRecordFormat()); - else - { - if (record.getRecordFormat() != recordFormat_) - { - Trace.log(Trace.ERROR, "Parameter 'record' does not contain the correct record format."); - throw new ExtendedIllegalArgumentException("record", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - } - } - catch (PropertyVetoException e) - { /* Will never occur. */ - } - } - - /** - * Validates the row index parameter. - * @param rowIndex The row index. - **/ - private void validateRowIndex(int rowIndex) - { - if (rowIndex < 0 || rowIndex > rows_.size()) - throw new ExtendedIllegalArgumentException("rowIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/RecordListRowData16.gif b/cvsroot/src/com/ibm/as400/util/servlet/RecordListRowData16.gif deleted file mode 100644 index 39eb341ad..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/RecordListRowData16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/RecordListRowData32.gif b/cvsroot/src/com/ibm/as400/util/servlet/RecordListRowData32.gif deleted file mode 100644 index 7bb009adb..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/RecordListRowData32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/RecordListRowDataBeanInfo.java b/cvsroot/src/com/ibm/as400/util/servlet/RecordListRowDataBeanInfo.java deleted file mode 100644 index fb7eccf50..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/RecordListRowDataBeanInfo.java +++ /dev/null @@ -1,167 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordListRowDataBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -* The RecordListRowDataBeanInfo class provides bean information -* for the RecordListRowData class. -**/ -public class RecordListRowDataBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private final static Class beanClass = RecordListRowData.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_s loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - PropertyDescriptor currentPosition = new PropertyDescriptor("currentPosition", - beanClass, - "getCurrentPosition", - null); - currentPosition.setBound(false); - currentPosition.setConstrained(false); - currentPosition.setDisplayName(loader_.getText("PROP_NAME_CURRENTPOSITION")); - currentPosition.setShortDescription(loader_.getText("PROP_DESC_CURRENTPOSITION")); - - PropertyDescriptor length = new PropertyDescriptor("length", beanClass, - "length", null); - length.setBound(false); - length.setConstrained(false); - length.setDisplayName(loader_.getText("PROP_NAME_LENGTH")); - length.setShortDescription(loader_.getText("PROP_DESC_LENGTH")); - - PropertyDescriptor metadata = new PropertyDescriptor("metadata", beanClass, - "getMetaData", null); - metadata.setBound(false); - metadata.setConstrained(false); - metadata.setDisplayName(loader_.getText("PROP_NAME_METADATA")); - metadata.setShortDescription(loader_.getText("PROP_DESC_METADATA")); - - PropertyDescriptor recordFormat = new PropertyDescriptor("recordFormat", beanClass, - "getRecordFormat", "setRecordFormat"); - recordFormat.setBound(true); - recordFormat.setConstrained(true); - recordFormat.setDisplayName(loader_.getText("PROP_NAME_RECORDFORMAT")); - recordFormat.setShortDescription(loader_.getText("PROP_DESC_RECORDFORMAT")); - - properties_ = new PropertyDescriptor[] { currentPosition, length, metadata, recordFormat }; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("RecordListRowData16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("RecordListRowData32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ResourceBundleLoader_s.java b/cvsroot/src/com/ibm/as400/util/servlet/ResourceBundleLoader_s.java deleted file mode 100644 index 742d4050a..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/ResourceBundleLoader_s.java +++ /dev/null @@ -1,93 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceBundleLoader_s.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import com.ibm.as400.access.Copyright; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** -* A class representing the ResourceBundleLoader_s object which -* is used to load the resource bundle. -**/ -class ResourceBundleLoader_s -{ - private static MissingResourceException resourceException_; - private static ResourceBundle resources_; - - static - { - try - { - resources_ = ResourceBundle.getBundle("com.ibm.as400.util.servlet.SMRI"); - } - catch (MissingResourceException e) - { - // Save the exception and rethrow it later. This is because exceptions - // thrown from static initializers are hard to debug. - resourceException_ = e; - } - - } - - /** - * Constructs a ResourceBundleLoader_s object which loads the - * resourceBundle. - **/ - ResourceBundleLoader_s() - { - super(); - } - - - /** - * Returns the text associated with the exception. - * @param textId the id which identifies the message text to return. - * @return the translatable text which describes the exception. - **/ - static final String getText (String textId) - { - if (resources_ == null) - throw resourceException_; - return resources_.getString(textId); - } - - /** - * Replaces substitution variables in a string. - * - * @param text The text string, with substitution variables - * (e.g. "Error &0 in table &1."); - * @param values The replacement values. - * - * @return The text string with all substitution variables replaced. - **/ - static String substitute (String text, String[] values) //$B0A - { - String result = text; - for (int i = 0; i < values.length; ++i) - { - String variable = "&" + i; - int j = result.indexOf (variable); - if (j >= 0) - { - StringBuffer buffer = new StringBuffer (); - buffer.append (result.substring (0, j)); - buffer.append (values[i]); - buffer.append (result.substring (j + variable.length ())); - result = buffer.toString (); - } - } - return result; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ResourceListMetaData.java b/cvsroot/src/com/ibm/as400/util/servlet/ResourceListMetaData.java deleted file mode 100644 index d4575bcb9..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/ResourceListMetaData.java +++ /dev/null @@ -1,404 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListMetaData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import com.ibm.as400.util.html.HTMLConstants; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Trace; -import com.ibm.as400.resource.ResourceList; -import com.ibm.as400.resource.ResourceMetaData; -import com.ibm.as400.resource.ResourceException; -import com.ibm.as400.resource.Presentation; - - -class ResourceListMetaData implements RowMetaData, java.io.Serializable -{ - static final long serialVersionUID = 773517785366319026L; - - private ResourceList resourceList_; // The resource list. - private Object[] columnAttributeIDs_; // The column attributes. - private String[] columnLabel_; // The array of column labels. - - - private String[] columnAlignment_; // The array of column alignments. @D5A - private String[] columnDirection_; // The array of column alignments. @D5A - /** - * Constructs a default ResourceListMetaData object. - **/ - public ResourceListMetaData() - { - super(); - } - - - /** - * Constructs a ResourceListMetaData object with the specified resourceList and columnAttributeIDs. - * @param resourceList The resource list. - * @param columnAttributeIDs The array of column attribute IDs. - * @see com.ibm.as400.resource.ResourceList - **/ - public ResourceListMetaData(ResourceList resourceList, Object[] columnAttributeIDs) - { - this(); - - setResourceList(resourceList); - setColumnAttributeIDs(columnAttributeIDs); - - columnAlignment_ = new String[ getColumnCount() ]; - columnDirection_ = new String[ getColumnCount() ]; - - } - - - /** - * Returns the alignment of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The horizontal column alignment. One of the following constants - * defined in HTMLConstants: LEFT, CENTER, RIGHT, or JUSTIFY. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public String getColumnAlignment(int columnIndex) //@D5A - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - return columnAlignment_[columnIndex]; - } - - - /** - * Returns the direction of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column direction. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public String getColumnDirection(int columnIndex) //@D5A - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - return columnDirection_[columnIndex]; - } - - - - /** - * Returns the number of columns. - * @return The column count. - **/ - public int getColumnCount() - { - return columnAttributeIDs_.length; - } - - - /** - * Returns the display size in characters of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column display size in characters. - **/ - public int getColumnDisplaySize(int columnIndex) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - if (columnAttributeIDs_[columnIndex] == null) - return 20; - else - { - int dataWidth = 20; - ResourceMetaData attributeMetaData = resourceList_.getAttributeMetaData(columnAttributeIDs_[columnIndex]); - Class type = attributeMetaData.getType(); - Presentation[] possibleValuePresentations = attributeMetaData.getPossibleValuePresentations(); - - // If it is a numeric value, use 10. - if (Number.class.isAssignableFrom(type)) - dataWidth = 10; - - // If it has possible values, use the width of the longest. - else if (possibleValuePresentations.length > 0) - { - dataWidth = 1; - for(int i = 0; i < possibleValuePresentations.length; ++i) - { - int nameLength = possibleValuePresentations[i].getName().toString().length(); - if (nameLength > dataWidth) - dataWidth = nameLength; - } - } - - // Make sure its big enough to show the header. - int nameLength = attributeMetaData.getPresentation().getName().toString().length(); - if (nameLength > dataWidth) - dataWidth = nameLength; - - return dataWidth; - } - } - - - /** - * Returns the label of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column label. - **/ - public String getColumnLabel(int columnIndex) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - if (columnLabel_ != null && columnLabel_[columnIndex] != null) - { - return columnLabel_[columnIndex]; - } - else - { - if (columnAttributeIDs_[columnIndex] == null) - { - ResourceBundleLoader_s loader = new ResourceBundleLoader_s(); - return loader.getText("PROP_NAME_RL_NAME"); - } - else - return resourceList_.getAttributeMetaData(columnAttributeIDs_[columnIndex]).getPresentation().getFullName(); - } - } - - /** - * Returns the name of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column name. - **/ - public String getColumnName(int columnIndex) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - if (columnAttributeIDs_[columnIndex] != null) - return resourceList_.getAttributeMetaData(columnAttributeIDs_[columnIndex]).getPresentation().getName(); - else - { - ResourceBundleLoader_s loader = new ResourceBundleLoader_s(); - return loader.getText("PROP_NAME_RL_NAME"); - } - } - - - /** - * Returns the data type of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column RowMetaDataType. - * @see com.ibm.as400.util.servlet.RowMetaDataType - **/ - public int getColumnType(int columnIndex) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - if (columnAttributeIDs_[columnIndex] == null) - return RowMetaDataType.STRING_DATA_TYPE; - - Class type = resourceList_.getAttributeMetaData(columnAttributeIDs_[columnIndex]).getType(); - - if (type == byte[].class) - return RowMetaDataType.BYTE_ARRAY_DATA_TYPE; - else if (type == java.math.BigDecimal.class) - return RowMetaDataType.BIG_DECIMAL_DATA_TYPE; - else if ((type == Double.class) || (type == Double.TYPE)) - return RowMetaDataType.DOUBLE_DATA_TYPE; - else if ((type == Float.class) || (type == Float.TYPE)) - return RowMetaDataType.FLOAT_DATA_TYPE; - else if ((type == Integer.class) || (type == Integer.TYPE)) - return RowMetaDataType.INTEGER_DATA_TYPE; - else if ((type == Long.class) || (type == Long.TYPE)) - return RowMetaDataType.LONG_DATA_TYPE; - else if ((type == Short.class) || (type == Short.TYPE)) - return RowMetaDataType.SHORT_DATA_TYPE; - else - return RowMetaDataType.STRING_DATA_TYPE; - } - - - /** - * Returns the data type name of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column data type name. - **/ - public String getColumnTypeName(int columnIndex) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - return RowMetaDataType.getDataTypeName(getColumnType(columnIndex)); - } - - /** - * Returns the precision of the column specified by columnIndex. - * This value is not used. It will always return zero. - * @param columnIndex The column index (0-based). - * @return The column precision (number of decimal digits). - **/ - public int getPrecision(int columnIndex) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - return 0; - } - - - /** - * Returns the scale of the column specified by columnIndex. - * This value is not used. It will always return zero. - * @param columnIndex The column index (0-based). - * @return The column scale (number of digits to the right of the decimal point). - **/ - public int getScale(int columnIndex) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - return 0; - } - - /** - * Indicates if the data type is numeric data. - * @param columnIndex The column index (0-based). - * @return true if numeric data; false otherwise. - **/ - public boolean isNumericData(int columnIndex) - { - return RowMetaDataType.isNumericData(getColumnType(columnIndex)); - } - - /** - * Indicates if the data type is text data. - * @param columnIndex The column index (0-based). - * @return true if text data; false otherwise. - **/ - public boolean isTextData(int columnIndex) - { - return RowMetaDataType.isTextData(getColumnType(columnIndex)); - } - - - /** - * Sets the column attribute IDs. - * @param columnAttributeIDs The array of column attribute IDs. - **/ - public void setColumnAttributeIDs(Object[] columnAttributeIDs) - { - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Setting the column attribute IDs."); - - columnAttributeIDs_ = columnAttributeIDs; - } - - - /** - * Sets the specified horizontal alignment for the column data specified by columnIndex. - * @param columnIndex The column index (0-based). - * @param alignment The horizontal column alignment. One of the following constants - * defined in HTMLConstants: LEFT, CENTER, RIGHT, or JUSTIFY. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setColumnAlignment(int columnIndex, String alignment) //@D5A - { - // Validate the label parameter. - if (alignment == null) - throw new NullPointerException("alignment"); - - validateColumnIndex(columnIndex); - - // If align is not one of the valid HTMLConstants, throw an exception. - if ( !(alignment.equals(HTMLConstants.LEFT)) && !(alignment.equals(HTMLConstants.RIGHT)) && !(alignment.equals(HTMLConstants.CENTER)) && !(alignment.equals(HTMLConstants.JUSTIFY)) ) - throw new ExtendedIllegalArgumentException("alignment", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - if (columnAlignment_ == null) - columnAlignment_ = new String[getColumnCount()]; - - columnAlignment_[columnIndex] = alignment; - } - - /** - * Sets the specified direction for the column data specified by columnIndex. - * @param columnIndex The column index (0-based). - * @param dir The column direction. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public void setColumnDirection(int columnIndex, String dir) //@D5A - { - // Validate the label parameter. - if (dir == null) - throw new NullPointerException("dir"); - - validateColumnIndex(columnIndex); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - if (columnDirection_ == null) - columnDirection_ = new String[getColumnCount()]; - - columnDirection_[columnIndex] = dir; - } - - - /** - * Sets the specified label for the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @param label The column label. - **/ - public void setColumnLabel(int columnIndex, String label) - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - // Validate the label parameter. - if (label == null) - throw new NullPointerException("label"); - - if (columnLabel_ == null) - columnLabel_ = new String[getColumnCount()]; - - columnLabel_[columnIndex] = label; - } - - - /** - * Sets the resource list. - * @param resourceList The resource list. - * @see com.ibm.as400.resource.ResourceList - **/ - public void setResourceList(ResourceList resourceList) - { - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Setting the meta resource list."); - - resourceList_ = resourceList; - } - - - /** - * Validates the column index. - * @param columnIndex The column index (0-based). - **/ - private void validateColumnIndex(int columnIndex) - { - if ( columnIndex < 0 || columnIndex >= columnAttributeIDs_.length ) - throw new ExtendedIllegalArgumentException("columnIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ResourceListRowData.java b/cvsroot/src/com/ibm/as400/util/servlet/ResourceListRowData.java deleted file mode 100644 index a5a830b14..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/ResourceListRowData.java +++ /dev/null @@ -1,347 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListRowData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import com.ibm.as400.resource.Resource; -import com.ibm.as400.resource.ResourceList; -import com.ibm.as400.resource.ResourceException; -import com.ibm.as400.resource.ResourceMetaData; - -import java.beans.PropertyVetoException; -import java.beans.PropertyChangeSupport; -import java.util.Vector; - - -/** - * The ResourceListRowData class represents a resource list of data. - *

    The list of data is formatted into a series of rows where each row - * contains a finite number of columns determined by the number of column - * attribute ID's. Each column within a row contains an individual data item. - * - *

    A ResourceListRowData object can represent any implementation of the - * {@link com.ibm.as400.resource.ResourceList ResourceList} interface. The row data - * columns are specified as an array of column attribute IDs. The row data will contain a column - * for each element of the array. The following can be specified as column attribute IDs: - *

    - *

      - *
    • null - The name from each Resource's Presentation object are presented in the column. - *

      - *

    • Resource attribute IDs - These are defined by the Resource objects that make up the rows data. - * The corresponding attribute value is presented in the column. - *
    - *

    A ResourceListRowData object maintains a position in the resource list - * that points to its current row of data. The initial position in the list - * is set before the first row. The next method moves to the next row in the list. - * - *

    The getObject method is used to retrieve the column value for - * the current row indexed by the column number. Columns are numbered - * starting from 0. - * - *

    The following example creates a ResourceListRowData object using an RUserList: - *

    - * 

    // Create an object to represent the system. - * AS400 mySystem = new AS400("mySystem.myCompany.com"); - *

    // Create a resource user list. - * RUserList userList = new RUserList(sys); - *

    // Set the selection so that all user profiles - * // are included in the list. - * userList.setSelectionValue(RUserList.SELECTION_CRITERIA, RUserList.ALL); - *

    // Create an HTMLTableConverter object. - * HTMLTableConverter converter = new HTMLTableConverter(); - * // Set up the table tag with a maximum of 20 rows per table. - * converter.setMaximumTableSize(20); - *

    // Create an HTMLTable and use the meta data for the table headers. - * HTMLTable table = new HTMLTable(); - * table.setCellSpacing(6); - * table.setBorderWidth(8); - * converter.setTable(table); - * converter.setUseMetaData(true); - *

    // Create a ResourceListRowData. - * ResourceListRowData rowdata = new ResourceListRowData(userList, new Object[] { null, RUser.TEXT_DESCRIPTION } ); - *

    // Convert the ResourceListRowData into an HTMLTable. - * String[] html = converter.convert(rowdata); - *

    // Print out the first table of 20 users from the html array. - * System.out.println(html[0]); - * - *

    - */ -public class ResourceListRowData extends RowData implements java.io.Serializable -{ - static final long serialVersionUID = 1081925300369525536L; - - private ResourceListMetaData metadata_; // The metadata. - private ResourceList resourceList_; // The resource list. - private Object[] columnAttributeIDs_; // The column attributes. - private Exception lastException_; // Keeps track of exceptions. - private boolean refreshed_; - - - /** - * Constructs a default ResourceListRowData object. - **/ - public ResourceListRowData() - { - super(); - setColumnAttributeIDs(new Object[] {}); - } - - /** - * Constructs a ResourceListRowData object with the specified resourceList and - * columnAttributeIDs. - * - * @param resourceList The resource list. - * @param columnAttributeIDs The array of column attributes. - * @see com.ibm.as400.resource.ResourceList - **/ - public ResourceListRowData(ResourceList resourceList, Object[] columnAttributeIDs) - { - this(); - - setMetaData(resourceList, columnAttributeIDs); - setResourceList(resourceList); - setColumnAttributeIDs(columnAttributeIDs); - } - - - /** - * Returns the array of column attribute IDs. - * @return The column attribute IDs. - **/ - public Object[] getColumnAttributeIDs() - { - return columnAttributeIDs_; - } - - - /** - * Return the resource list length. - * @return The list length. - **/ - int getListLength() - { - try - { - if (resourceList_ == null) - return 0; - - if (!refreshed_) - { - resourceList_.refreshStatus(); - refreshed_ = true; - } - return (int)resourceList_.getListLength(); - } - catch(ResourceException e) - { - Trace.log(Trace.ERROR, "Error getting resource length.", e); - lastException_ = e; - - return 0; - } - } - - - /** - * Returns the metadata. - * @return The metadata. - **/ - public RowMetaData getMetaData() - { - return metadata_; - } - - - /** - * Returns the current row's column data specified at columnIndex. - * - * @param columnIndex The column index (0-based). - * @return The column object. - * @exception RowDataException If a row data error occurs. - **/ - public Object getObject(int columnIndex) throws RowDataException - { - try - { - if (lastException_ != null) - throw new RowDataException(lastException_); - - // Validate that there are column attribute IDs. - if (columnAttributeIDs_ == null) - throw new NullPointerException("columnAttributeIDs"); - if (columnAttributeIDs_.length == 0) - { - Trace.log(Trace.ERROR, "Attempting to get the column object before setting the column attribute IDs."); - throw new ExtendedIllegalStateException("columnAttributeIDs", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Validate that the list is not empty. - validateRowList("Attempting to get the column object"); - - // Get the current row. - validateListPosition("Attempting to get the current object"); - - // Validate the column parameter. - if ( columnIndex < 0 || columnIndex >= columnAttributeIDs_.length ) - throw new ExtendedIllegalArgumentException("columnIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - resourceList_.open(); - - if (!resourceList_.isResourceAvailable(columnIndex)) //$A2C - resourceList_.waitForResource(columnIndex); //$A2C - - // If the user specifies a null value in the columnAttributeIDs array, display the resource name. - if ( columnAttributeIDs_[columnIndex] == null) - return resourceList_.resourceAt(position_).getPresentation().getName(); - else - { - ResourceMetaData meta = resourceList_.getAttributeMetaData(columnAttributeIDs_[columnIndex]); //$A1A - Object attributeValue = resourceList_.resourceAt(position_).getAttributeValue(columnAttributeIDs_[columnIndex]); //$A1A - - // This will allow us to use the MRI attribute values. //$A1A - if (meta.getPossibleValuePresentation(attributeValue) != null) //$A1A - return meta.getPossibleValuePresentation(attributeValue).getName(); //$A1A - else //$A1A - return attributeValue; //$A1C - } - } - catch(ResourceException e) - { - throw new RowDataException(e); - } - } - - - /** - * Returns the data object's property list at the specified columnIndex. - * - * @param columnIndex The column index (0-based). - * @return The property list for the column data object. - * @see com.ibm.as400.util.servlet.RowData#setObjectProperties - **/ - public Vector getObjectProperties(int columnIndex) - { - // Validate that the list is not empty. - validateRowList("Attempting to get the column object's properties"); - - // Get the current row. - validateListPosition("Attempting to get the current object's properties"); - - // Validate the columnIndex parameter. - if ( columnIndex < 0 || columnIndex >= columnAttributeIDs_.length ) - throw new ExtendedIllegalArgumentException("columnIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - return new Vector(); - } - - - /** - * Return the resource list. - * @return The resource list. - **/ - public ResourceList getResourceList() - { - return resourceList_; - } - - - /** - * Returns the number of rows in the resource list. - * - * @return The number of rows. - **/ - public int length() - { - return getListLength(); - } - - - /** - * Sets the resource list column attribute IDs. - * - * @param columnAttributeIDs The column attribute IDs. - **/ - public void setColumnAttributeIDs(Object[] columnAttributeIDs) - { - - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Setting the column attribute IDs."); - - if (columnAttributeIDs == null) - throw new NullPointerException("columnAttributeIDs"); - - Object[] old = columnAttributeIDs_; - - columnAttributeIDs_ = columnAttributeIDs; - - if (changes_ != null) changes_.firePropertyChange("columnAttributeIDs", old, columnAttributeIDs); //@CRS - - if (metadata_ == null) - metadata_ = new ResourceListMetaData(); - - metadata_.setColumnAttributeIDs(columnAttributeIDs); - - } - - /** - * Sets the metadata. - * @param resourceList The resource list. - * @param columnAttributeIDs The column attributes. - **/ - void setMetaData(ResourceList resourceList, Object[] columnAttributeIDs) - { - // Validate the metadata parameter. - if (resourceList == null) - throw new NullPointerException("resourceList"); - if (columnAttributeIDs == null) - throw new NullPointerException("columnAttributeIDs"); - if (columnAttributeIDs.length == 0) - throw new ExtendedIllegalArgumentException("columnAttributeIDs", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - ResourceListMetaData old = metadata_; - - metadata_ = new ResourceListMetaData(resourceList, columnAttributeIDs); - - if (changes_ != null) changes_.firePropertyChange("metadata", old, metadata_); //@CRS - } - - - /** - * Sets the resource list. - * - * @param resourceList The resource list. - * @see com.ibm.as400.resource.ResourceList - **/ - public void setResourceList(ResourceList resourceList) - { - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Setting the resource list."); - - if (resourceList == null) - throw new NullPointerException("resourceList"); - - ResourceList old = resourceList_; - - resourceList_ = resourceList; - - if (changes_ != null) changes_.firePropertyChange("resourceList", old, resourceList); //@CRS - - if (metadata_ == null) - metadata_ = new ResourceListMetaData(); - - metadata_.setResourceList(resourceList); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ResourceListRowData16.gif b/cvsroot/src/com/ibm/as400/util/servlet/ResourceListRowData16.gif deleted file mode 100644 index 2e69f8f06..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/ResourceListRowData16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ResourceListRowData32.gif b/cvsroot/src/com/ibm/as400/util/servlet/ResourceListRowData32.gif deleted file mode 100644 index d5d5a3244..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/ResourceListRowData32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ResourceListRowDataBeanInfo.java b/cvsroot/src/com/ibm/as400/util/servlet/ResourceListRowDataBeanInfo.java deleted file mode 100644 index 398f9847a..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/ResourceListRowDataBeanInfo.java +++ /dev/null @@ -1,155 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListRowDataBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -* The ResourceListRowDataBeanInfo class provides bean information -* for the ResourceListRowData class. -**/ -public class ResourceListRowDataBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private final static Class beanClass = ResourceListRowData.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_s loader_; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = { changed }; - - events_ = events; - - PropertyDescriptor currentPosition = new PropertyDescriptor("currentPosition", beanClass, "getCurrentPosition", null); - currentPosition.setBound(false); - currentPosition.setConstrained(false); - currentPosition.setDisplayName(loader_.getText("PROP_NAME_CURRENTPOSITION")); - currentPosition.setShortDescription(loader_.getText("PROP_DESC_RL_CURRENTPOSITION")); - - PropertyDescriptor length = new PropertyDescriptor("length", beanClass, "length", null); - length.setBound(false); - length.setConstrained(false); - length.setDisplayName(loader_.getText("PROP_NAME_LENGTH")); - length.setShortDescription(loader_.getText("PROP_DESC_RL_LENGTH")); - - PropertyDescriptor resourceList = new PropertyDescriptor("resourceList", beanClass, - "getResourceList", "setResourceList"); - resourceList.setBound(true); - resourceList.setConstrained(false); - resourceList.setDisplayName(loader_.getText("PROP_NAME_RESOURCELIST")); - resourceList.setShortDescription(loader_.getText("PROP_DESC_RESOURCELIST")); - - PropertyDescriptor columnAttribute = new PropertyDescriptor("columnAttributeIDs", beanClass, - "getColumnAttributeIDs", "setColumnAttributeIDs"); - columnAttribute.setBound(true); - columnAttribute.setConstrained(false); - columnAttribute.setDisplayName(loader_.getText("PROP_NAME_RL_COLUMNATTRIBUTE")); - columnAttribute.setShortDescription(loader_.getText("PROP_DESC_RL_COLUMNATTRIBUTE")); - - properties_ = new PropertyDescriptor[] { currentPosition, length, resourceList, columnAttribute }; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the bean descriptor. - * @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - * Returns the index of the default event. - * @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - * Returns the index of the default property. - * @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - * Returns the descriptors for all events. - * @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an image for the icon. - * - * @param icon The icon size and color. - * @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("ResourceListRowData16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("ResourceListRowData32.gif"); - break; - } - return image; - } - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/RowData.java b/cvsroot/src/com/ibm/as400/util/servlet/RowData.java deleted file mode 100644 index a4f7b556c..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/RowData.java +++ /dev/null @@ -1,514 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RowData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.io.Serializable; -import java.util.Vector; -/** -* The RowData class defines a representation for describing and accessing -* a list of data. -* -*

    The RowData object maintains a position in the list pointing to its current row -* of data. The initial position is before the first row in the list. Row indexes are -* numbered starting with 0. -* -*

    The number, types, and properties of the list's columns are provided -* by the RowMetaData object -* returned by the getMetaData method. -* -*

    Individual data objects in the current row can have properties, or a list of objects, -* that can be associated with the data. Properties can be set with the setObjectProperties -* method. -* -*

    RowData objects generate the following events: -*

      -*
    • PropertyChangeEvent
    • -*
    • VetoableChangeEvent
    • -*
    -**/ -public abstract class RowData implements Serializable -{ - static final long serialVersionUID = -5356418530948608994L; - - // @B3C - protected Vector rows_; // The row data. - protected Vector rowProperties_; // The row data properties, where each column in the row contains a Vector of properties. @B6C - - transient int maxLoad_; // The maximum resource list items to load at 1 time (equals the max table size). - transient int position_; // The current position in the list. - transient PropertyChangeSupport changes_; // The list of property change listeners. - transient VetoableChangeSupport vetos_; // The list of vetoable change listeners. - - /** - * Constructs a default RowData object. - **/ - public RowData() - { - rows_ = new Vector(); - rowProperties_ = new Vector(); - - // Initialize the transient data. - initializeTransient(); - } - - /** - * Sets the position to the specified rowIndex. - * Attempting to move beyond the first row will move to the position before the first row. - * Attempting to move beyond the last row will move to the position after the last row. - * - * @param rowIndex The row index (0-based). The rowIndex must be zero or a positive integer which - * is less than the number of rows. - * @return true if the requested position exists; false otherwise. - **/ - public boolean absolute(int rowIndex) - { - if (length() == 0 || rowIndex < 0) // position before first row. //$B1C - { - position_ = -1; - return false; - } //$B1C - else if (rowIndex >= length()) - { - position_ = length(); // position after last row. //$B1C - return false; - } - else - { - position_ = rowIndex; // valid new position. - return true; - } - } - - /** - * Adds a PropertyChangeListener. - * The specified PropertyChangeListener's propertyChange - * method is called each time the value of any bound property is changed. - * @see #removePropertyChangeListener - * @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (changes_ == null) changes_ = new PropertyChangeSupport(this); //@CRS - changes_.addPropertyChangeListener(listener); - } - /** - * Adds the VetoableChangeListener. - * The specified VetoableChangeListener's vetoableChange - * method is called each time the value of any constrained property is changed. - * @see #removeVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); //@CRS - vetos_.addVetoableChangeListener(listener); - } - - /** - * Sets the position after the last row in the list. - * This is a valid position after the end of the list. - **/ - public void afterLast() - { - // Validate the list is not empty. -//@B4D validateRowList("Attempting to set the position in the list"); - - position_ = length(); //$B1C - } - - /** - * Sets the position before the first row in the list. - * This is a valid position before the beginning of the list. - **/ - public void beforeFirst() - { - // Validate the list is not empty. -//@B4D validateRowList("Attempting to set the position in the list"); - - position_ = -1; - } - - /** - * Sets the position to the first row in the list. - * - * @return true if the requested position exists; false if the list is empty. - **/ - public boolean first() - { - if (length() != 0) //$B1C - { - position_ = 0; - return true; - } - else - return false; - } - - /** - * Returns the current row position. - * - * @return The row position (0-based). - **/ - public int getCurrentPosition() - { - return position_; - } - - /** - * Returns the meta data. - * - * @return The meta data. - * @exception RowDataException If a row data error occurs. - **/ - public abstract RowMetaData getMetaData() throws RowDataException; - - /** - * Returns the current row's column data specified at columnIndex. - * - * @param columnIndex The column index (0-based). - * @return The column object. - * @exception RowDataException If a row data error occurs. - **/ - public Object getObject(int columnIndex) throws RowDataException - { - // Validate that the list is not empty. - validateRowList("Attempting to get the column object"); - - // Get the current row. - validateListPosition("Attempting to get the current object"); - - Object[] row = (Object[])rows_.elementAt(position_); - - // Validate the column parameter. - if ( columnIndex < 0 || columnIndex >= row.length ) - throw new ExtendedIllegalArgumentException("columnIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - return row[columnIndex]; - } - - /** - * Returns the data object's property list at the specified columnIndex. - * - * @param columnIndex The column index (0-based). - * @return The property list for the column data object. - * @see com.ibm.as400.util.servlet.RowData#setObjectProperties - **/ - public Vector getObjectProperties(int columnIndex) - { - // Validate that the list is not empty. - validateRowList("Attempting to get the column object's properties"); - - // Get the current row. - validateListPosition("Attempting to get the current object's properties"); - - Vector[] propertyList = (Vector[])rowProperties_.elementAt(position_); - - // Validate the columnIndex parameter. - if ( columnIndex < 0 || columnIndex >= propertyList.length ) - throw new ExtendedIllegalArgumentException("columnIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - return propertyList[columnIndex]; - } - - - /** - * Returns the current row's property list. - * Each Vector in the properties list corresponds to the - * appropriate data object's list of properties. - * @return The property lists for each data object in the row. - **/ - public Vector[] getRowProperties() - { - // Validate that the list is not empty. - validateRowList("Attempting to get the row's property list"); - - // Get the current row. - validateListPosition("Attempting to get the row's property list"); - - return(Vector[])rowProperties_.elementAt(position_); - } - - /** - * Initializes the transient data. - **/ - private void initializeTransient() - { - maxLoad_ = 0; - position_ = -1; // Set the initial position before the first row. - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS vetos_ = new VetoableChangeSupport(this); - } - - /** - * Indicates whether the current position is after the last row in the list. - * This is a valid position after the end of the list. - * @return true if the position is after the last row; false otherwise. - **/ - public boolean isAfterLast() - { - if (position_ == length()) //$B1C - return true; - else - return false; - } - - /** - * Indicates whether the current position is before the first row in the list. - * This is a valid position before the beginning of the list. - * @return true if the position is before the first row and the list is not empty; false otherwise. - **/ - public boolean isBeforeFirst() - { - if (length() != 0 && position_ == -1) //$B1C - return true; - else - return false; - } - - /** - * Indicates whether the current position is the first row in the list. - * - * @return true if the position is the first row; false otherwise. - **/ - public boolean isFirst() - { - if (position_ == 0) - return true; - else - return false; - } - - /** - * Indicates whether the current position is the last row in the list. - * - * @return true if the position is the last row; false otherwise. - **/ - public boolean isLast() - { - if (length() != 0 && position_ == (length() -1)) //$B1C - return true; - else - return false; - } - - /** - * Sets the position to the last row in the list. - * - * @return true if the requested position exists; false if the list is empty. - **/ - public boolean last() - { //$B1C - if (length() != 0) - { - position_ = length() - 1; //$B1C - return true; - } - else - return false; - } - - /** - * Returns the number of rows in the list. - * - * @return The number of rows. - **/ - public int length() - { - return rows_.size(); - } - - /** - * Sets the position to the next row in the list. - * The list is initially positioned before its first row. The first call - * to next makes the first row the current row, the second call makes - * the second row the current row, etc. Moving beyond last row in the list will - * result in a position after the last row. - * @return true if the requested position exists in the list; false if there are no more rows. - **/ - public boolean next() - { - if (length() == 0) //$B1C - return false; - else - { //$B1C - if (position_ < length()) - position_++; // update position if the current position is valid. - - if (position_ == length()) //$B1C - return false; // new position is after last row. - else - return true; - } - } - - /** - * Sets the position to the previous row in the list. - * Moving beyond the first row in the list will result in a position before the first row. - * @return true if the requested position exists in the list; false otherwise. - **/ - public boolean previous() - { - if (position_- 1 >= -1) // current position must be valid. (i.e. empty list - invalid) - position_--; - - if (position_ == -1) // new position is before first row. - return false; - else - return true; - } - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException, RowDataException - { - in.defaultReadObject(); - - initializeTransient(); - } - - /** - * Sets the position a relative numberOfRows based on the current position. - * Moving beyond the first/last row in the list will result in a position - * before/after the first/last row. - * - * @param numberOfRows The number of rows to move, either positive or negative. - * @return true if the requested position exists; false otherwise. - **/ - public boolean relative(int numberOfRows) - { - // Determine new position; - int temp = position_ + numberOfRows; - - // Check if new position is valid. - if (length() == 0 || temp < 0) // position before first row. //$B1C - { - position_ = -1; - return false; - } //$B1C - else if (temp >= length()) // position after last row. - { - position_ = length(); //$B1C - return false; - } - else // Valid new position. - { - position_ = temp; - return true; - } - } - - /** - * Removes the PropertyChangeListener from the internal list. - * If the PropertyChangeListener is not on the list, nothing is done. - * @see #addPropertyChangeListener - * @param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (changes_ != null) changes_.removePropertyChangeListener(listener); //@CRS - } - - /** - * Removes the VetoableChangeListener from the internal list. - * If the VetoableChangeListener is not on the list, nothing is done. - * @see #addVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ != null) vetos_.removeVetoableChangeListener(listener); //@CRS - } - - /** - * Sets the data object's properties at the specified columnIndex. - * Object properties are user defined objects that can be associated with - * the data in the row. - * - * @param properties The properties. - * @param columnIndex The column index (0-based). - * @see com.ibm.as400.util.servlet.RowData#getObjectProperties - **/ - public void setObjectProperties(Vector properties, int columnIndex) - { - if (Trace.isTraceOn()) - Trace.log(Trace.INFORMATION, "Setting the column object's properties."); - - // Validate that the list is not empty. - validateRowList("Attempting to set a column object's properties"); - - // Validate the properties parameter. - if (properties == null) - throw new NullPointerException("properties"); - - // Validate the current row. - validateListPosition("Attempting to set a column object's properties"); - - // Get the column parameter list. - Vector[] propertyList = (Vector[])rowProperties_.elementAt(position_); - - // Validate the columnIndex parameter. - if (columnIndex < 0 || columnIndex >= propertyList.length) - throw new ExtendedIllegalArgumentException("columnIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - - // Set the properties. - propertyList[columnIndex] = properties; - rowProperties_.setElementAt(propertyList, position_); - } - - /** - * Validates the position in the list. - * @param attemptedAction The attempted action on the list. - **/ - void validateListPosition(String attemptedAction) - { - if (isBeforeFirst() || isAfterLast()) - { - Trace.log(Trace.ERROR, attemptedAction + " when the position in the list is invalid."); - throw new ExtendedIllegalStateException("position", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - - /** - * Validate the row list is not empty. - * @param attemptedAction The attempted action on the list. - **/ - void validateRowList(String attemptedAction) - { - // Validate that the list is not empty. - if (length() == 0) //$B1C - { - Trace.log(Trace.ERROR, attemptedAction + " before adding a row to the list."); - throw new ExtendedIllegalStateException("rows", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/RowDataEvent.java b/cvsroot/src/com/ibm/as400/util/servlet/RowDataEvent.java deleted file mode 100644 index b36c436d0..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/RowDataEvent.java +++ /dev/null @@ -1,67 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RowDataEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import com.ibm.as400.access.Copyright; -/** -* The RowDataEvent class represents a row data event. -**/ -public class RowDataEvent extends java.util.EventObject -{ - static final long serialVersionUID = -4858159238427200024L; - - /** - * Event ID indicating that a row has been added. - **/ - public static final int ROW_ADDED = 0; - - /** - * Event ID indicating that a row has been changed. - **/ - public static final int ROW_CHANGED = 1; - - /** - * Event ID indicating that a row has been removed. - **/ - public static final int ROW_REMOVED = 2; - - private int id_; // event identifier - - - /** - * Constructs a RowDataEvent object. It uses the specified source and ID. - * @param source The object where the event originated. - * @param id The event identifier. - **/ - public RowDataEvent(Object source, int id) - { - super(source); - - if (id < ROW_ADDED || id > ROW_REMOVED) - { - throw new IndexOutOfBoundsException("id"); - } - - id_ = id; - } - - /** - * Returns the identifier for this event. - * @return The identifier for this event. - **/ - public int getID() - { - return id_; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/RowDataException.java b/cvsroot/src/com/ibm/as400/util/servlet/RowDataException.java deleted file mode 100644 index 4df8ec2ca..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/RowDataException.java +++ /dev/null @@ -1,52 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RowDataException.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import com.ibm.as400.access.Copyright; -/** -* The RowDataException class represents an exception which indicates -* that a problem occurred when working with the row data. -**/ -public class RowDataException extends Exception -{ - private Exception exception_; - - /** - * Constructs a default RowDataException. - **/ - RowDataException() - { - super(); - } - - /** - * Constructs a RowDataException. - * - * @param exception The exception. - **/ - public RowDataException(Exception exception) // @B1C - { - super(exception.getMessage()); - exception_ = exception; - } - - /** - * Returns the original exception. - * @return The exception. - **/ - public Exception getException() - { - return exception_; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/RowDataListener.java b/cvsroot/src/com/ibm/as400/util/servlet/RowDataListener.java deleted file mode 100644 index cf8db48a8..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/RowDataListener.java +++ /dev/null @@ -1,40 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RowDataListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -/** - The RowDataListener interface provides a listener - interface for receiving row data events. -**/ -public interface RowDataListener extends java.util.EventListener -{ - - /** - Invoked when a row of data has been added. - @param event The event. - **/ - public abstract void rowAdded(RowDataEvent event); - - /** - Invoked when a row of data has been changed. - @param event The event. - **/ - public abstract void rowChanged(RowDataEvent event); - - /** - Invoked when a row of data has been removed. - @param event The event. - **/ - public abstract void rowRemoved(RowDataEvent event); -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/RowDataSupport.java b/cvsroot/src/com/ibm/as400/util/servlet/RowDataSupport.java deleted file mode 100644 index 17fc0d28f..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/RowDataSupport.java +++ /dev/null @@ -1,98 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RowDataSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import java.util.Vector; - -class RowDataSupport -{ - transient private Vector rowListeners_; // The list of row listeners. - transient private Object source_; - - public RowDataSupport(Object source) - { - rowListeners_ = new Vector(); - source_ = source; - } - - /** - * Adds an RowDataListener. - * The RowDataListener object is added to an internal list of RowDataListeners; - * it can be removed with removeRowDataListener. - * - * @param listener The RowDataListener. - **/ - public void addRowDataListener(RowDataListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - rowListeners_.addElement(listener); - } - - /** - * Fire an added event. - **/ - public void fireAdded() - { - Vector targets; - targets = (Vector) rowListeners_.clone(); - RowDataEvent event = new RowDataEvent(source_, RowDataEvent.ROW_ADDED); - for (int i = 0; i < targets.size(); i++) { - RowDataListener target = (RowDataListener)targets.elementAt(i); - target.rowAdded(event); - } - } - - /** - * Fire a changed event. - **/ - public void fireChanged() - { - Vector targets; - targets = (Vector) rowListeners_.clone(); - RowDataEvent event = new RowDataEvent(source_, RowDataEvent.ROW_CHANGED); - for (int i = 0; i < targets.size(); i++) { - RowDataListener target = (RowDataListener)targets.elementAt(i); - target.rowChanged(event); - } - } - - /** - * Fire a removed event. - **/ - public void fireRemoved() - { - Vector targets; - targets = (Vector) rowListeners_.clone(); - RowDataEvent event = new RowDataEvent(source_, RowDataEvent.ROW_REMOVED); - for (int i = 0; i < targets.size(); i++) { - RowDataListener target = (RowDataListener)targets.elementAt(i); - target.rowRemoved(event); - } - } - - /** - * Removes this RowDataListener from the internal list. - * If the RowDataListener is not on the list, nothing is done. - * @param listener The RowDataListener. - **/ - public void removeRowDataListener(RowDataListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - rowListeners_.removeElement(listener); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/RowMetaData.java b/cvsroot/src/com/ibm/as400/util/servlet/RowMetaData.java deleted file mode 100644 index 857a07693..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/RowMetaData.java +++ /dev/null @@ -1,157 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RowMetaData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -/** -* A RowMetaData object can be used to find out information about the columns -* of a RowData object. -**/ -public interface RowMetaData -{ - - /** - * Returns the horizontal alignment of the column data specified by columnIndex. - * For a list of values, see {@link com.ibm.as400.util.html.HTMLConstants HTMLConstants}. - * @param columnIndex The column index (0-based). - * @return The horizontal column alignment. One of the following constants - * defined in HTMLConstants: LEFT, CENTER, RIGHT, or JUSTIFY. - * @exception RowDataException If a row data error occurred. - **/ - public abstract String getColumnAlignment(int columnIndex) throws RowDataException; //@D5A - - /** - * Returns the number of columns. - * - * @return The number of columns. - * @exception RowDataException If a row data error occurred. - **/ - public abstract int getColumnCount() throws RowDataException; - - /** - * Returns the direction of the column data specified by columnIndex. - * For a list of values, see {@link com.ibm.as400.util.html.HTMLConstants HTMLConstants}. - * @param columnIndex The column index (0-based). - * @return The direction. - * @exception RowDataException If a row data error occurred. - **/ - public abstract String getColumnDirection(int columnIndex) throws RowDataException; //@D5A - - /** - * Returns the display size in characters of the column specified by columnIndex. - * - * @param columnIndex The column index (0-based). - * @return The display size. - * @exception RowDataException If a row data error occurred. - **/ - public abstract int getColumnDisplaySize(int columnIndex) throws RowDataException; - - /** - * Returns the label of the column specified by columnIndex. - * - * @param columnIndex The column index(0-based). - * @return The label. - * @exception RowDataException If a row data error occurred. - **/ - public abstract String getColumnLabel(int columnIndex) throws RowDataException; - - /** - * Returns the name of the column specified by columnIndex. - * - * @param columnIndex The column index(0-based). - * @return The name. - * @exception RowDataException If a row data error occurred. - **/ - public abstract String getColumnName(int columnIndex) throws RowDataException; - - /** - * Returns the data type of the column specified by columnIndex. - * For a list of values, see RowMetaDataType - * @param columnIndex The column index (0-based). - * @return The data type. - * @exception RowDataException If a row data error occurred. - **/ - public abstract int getColumnType(int columnIndex) throws RowDataException; - - /** - * Returns the data type name of the column specified by columnIndex. - * - * @param columnIndex The column index (0-based). - * @return The data type name. - * @exception RowDataException If a row data error occurred. - **/ - public abstract String getColumnTypeName(int columnIndex) throws RowDataException; - - /** - * Returns the precision of the column specified by columnIndex. - * - * @param columnIndex The column index (0-based). - * @return The precision (number of decimal digits). - * @exception RowDataException If a row data error occurred. - **/ - public abstract int getPrecision(int columnIndex) throws RowDataException; - - /** - * Returns the scale of the column specified by columnIndex. - * - * @param columnIndex The column index (0-based). - * @return The scale (number of digits to the right of the decimal point). - * @exception RowDataException If a row data error occurred. - **/ - public abstract int getScale(int columnIndex) throws RowDataException; - - /** - * Indicates if the column specified by columnIndex contains numeric data. - * @param columnIndex The column index (0-based). - * @return true if numeric data; false otherwise. - * @exception RowDataException If a row data error occurred. - **/ - public abstract boolean isNumericData(int columnIndex) throws RowDataException; // @A1 - - /** - * Indicates if the column specified by columnIndex contains text data. - * @param columnIndex The column index (0-based). - * @return true if text data; false otherwise. - * @exception RowDataException If a row data error occurred. - **/ - public abstract boolean isTextData(int columnIndex) throws RowDataException; - - /** - * Sets the specified label for the column specified by columnIndex. - * - * @param columnIndex The column index (0-based). - * @param label The label. - * @exception RowDataException If a row data error occurred. - **/ - public abstract void setColumnLabel(int columnIndex, String label) throws RowDataException; - - - - /** - * Sets the specified horizontal alignment for the column data specified by columnIndex. - * @param columnIndex The column index (0-based). - * @param alignment The horizontal column alignment. One of the following constants - * defined in HTMLConstants: LEFT, CENTER, RIGHT, or JUSTIFY. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public abstract void setColumnAlignment(int columnIndex, String alignment) throws RowDataException; //@D5A - - - /** - * Sets the specified direction for the column data specified by columnIndex. - * @param columnIndex The column index (0-based). - * @param alignment The column direction. - * @see com.ibm.as400.util.html.HTMLConstants - **/ - public abstract void setColumnDirection(int columnIndex, String alignment) throws RowDataException; //@D5A -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/RowMetaDataType.java b/cvsroot/src/com/ibm/as400/util/servlet/RowMetaDataType.java deleted file mode 100644 index 5fb4c17fa..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/RowMetaDataType.java +++ /dev/null @@ -1,126 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RowMetaDataType.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -/** -* The RowMetaDataType class defines constants to identify metadata data types. -**/ -public class RowMetaDataType -{ - /** - * java.lang.Byte array data type. - **/ - public final static int BYTE_ARRAY_DATA_TYPE = 1; - /** - * java.math.BigDecimal data type. - **/ - public final static int BIG_DECIMAL_DATA_TYPE = 2; - /** - * java.lang.Double data type. - **/ - public final static int DOUBLE_DATA_TYPE = 3; - /** - * java.lang.Float data type. - **/ - public final static int FLOAT_DATA_TYPE = 4; - /** - * java.lang.Integer data type. - **/ - public final static int INTEGER_DATA_TYPE = 5; - /** - * java.lang.Long data type. - **/ - public final static int LONG_DATA_TYPE = 6; - /** - * java.lang.Short data type. - **/ - public final static int SHORT_DATA_TYPE = 7; - /** - * java.lang.String data type. - **/ - public final static int STRING_DATA_TYPE = 8; - - // The data type. - private int type_; - - /** - * Returns the data type name. - * @param type The data type. - * @return The name. - **/ - public static String getDataTypeName(int type) - { - switch(type) - { - case BYTE_ARRAY_DATA_TYPE: return "java.lang.Byte[]"; - case BIG_DECIMAL_DATA_TYPE: return "java.math.BigDecimal"; - case DOUBLE_DATA_TYPE: return "java.lang.Double"; - case FLOAT_DATA_TYPE: return "java.lang.Float"; - case INTEGER_DATA_TYPE: return "java.lang.Integer"; - case LONG_DATA_TYPE: return "java.lang.Long"; - case SHORT_DATA_TYPE: return "java.lang.Short"; - case STRING_DATA_TYPE: return "java.lang.String"; - default: return "java.lang.Byte[]"; - } - } - - /** - * Indicates if the data type is valid. - * @param type The data type. - * @return true if the data type is valid; false otherwise. - **/ - public static boolean isDataTypeValid(int type) - { - if (type >= BYTE_ARRAY_DATA_TYPE && type <= STRING_DATA_TYPE) - return true; - else - return false; - } - - /** - * Indicates if the data type is numeric data. - * @param type The data type. - * @return true if numeric data; false otherwise. - **/ - static boolean isNumericData(int type) // @A1 - buhr - { - switch(type) - { - case RowMetaDataType.BIG_DECIMAL_DATA_TYPE: return true; - case RowMetaDataType.DOUBLE_DATA_TYPE: return true; - case RowMetaDataType.FLOAT_DATA_TYPE: return true; - case RowMetaDataType.INTEGER_DATA_TYPE: return true; - case RowMetaDataType.LONG_DATA_TYPE: return true; - case RowMetaDataType.SHORT_DATA_TYPE: return true; - default: return false; - } - } - - /** - * Indicates if the data type is text data. - * @param type The data type. - * @return true if text data; false otherwise. - **/ - static boolean isTextData(int type) - { - - switch(type) - { - case RowMetaDataType.STRING_DATA_TYPE: - return true; - default: - return false; - } - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/SMRI.java b/cvsroot/src/com/ibm/as400/util/servlet/SMRI.java deleted file mode 100644 index 091e3f99f..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/SMRI.java +++ /dev/null @@ -1,192 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SMRI.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import java.util.ListResourceBundle; - -/** -Locale-specific objects for the IBM Toolbox for Java. -**/ -public class SMRI extends ListResourceBundle -{ - // NLS_MESSAGEFORMAT_NONE - // Each string is assumed NOT to be processed by the MessageFormat class. - // This means that a single quote must be coded as 1 single quote. - - // NLS_ENCODING=UTF-8 - // Instructs the translation tools to interpret the text as UTF-8. - - public Object[][] getContents() - { - return resources; - } - - private final static Object[][] resources= { - - // #TRANNOTE Before you add a new resource, please make - // #TRANNOTE sure you are not duplicating another. The - // #TRANNOTE goal is to keep the amount of translatable - // #TRANNOTE text down. - // #TRANNOTE - // #TRANNOTE NOTE TO TRANSLATORS: The format of a line of MRI - // #TRANNOTE is { "KEY", "value" }, - // #TRANNOTE - // #TRANNOTE The key must be left alone so translate only the value. - // #TRANNOTE - - - - // #TRANNOTE ##################################################### - // #TRANNOTE Short descriptions and display names for events. - // #TRANNOTE Descriptions start with EVT_DESC_ prefix, display - // #TRANNOTE names start with EVT_NAME. - // #TRANNOTE ##################################################### - - { "EVT_DESC_SC_EVENT", "A section completed event has occurred." }, - - // #TRANNOTE A section completed has occurred. - { "EVT_NAME_SC_EVENT", "sectionCompletedEvent" }, - { "EVT_DESC_RD_EVENT", "A row data event has occurred." }, - - // #TRANNOTE A row data event has occurred. - { "EVT_NAME_RD_EVENT", "rowDataEvent" }, - - // #TRANNOTE A bound property has changed. - // #TRANNOTE The meaning of 'property' here is like 'attribute'. - { "EVT_NAME_PROPERTY_CHANGE", "propertyChange" }, - { "EVT_DESC_PROPERTY_CHANGE", "A bound property has changed." }, - - // #TRANNOTE A constrained property has changed. - // #TRANNOTE The meaning of 'property' here is like 'attribute'. - { "EVT_NAME_PROPERTY_VETO", "vetoableChange" }, - { "EVT_DESC_PROPERTY_VETO", "A constrained property has changed." }, - - // #TRANNOTE ######################################################### - // #TRANNOTE Common exception messages. - // #TRANNOTE ######################################################### - // #TRANNOTE Each key starts with the prefix EXC_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE Example: - // #TRANNOTE { "EXC_ACCESS_DENIED", "Access to request was denied." }, - // #TRANNOTE ######################################################### - - - - - - // #TRANNOTE ##################################################### - // #TRANNOTE Short descriptions and display names for properties. - // #TRANNOTE Descriptions start with PROP_DESC_ prefix, display - // #TRANNOTE names start with PROP_NAME. - // #TRANNOTE ##################################################### - { "PROP_NAME_METADATA", "metadata" }, - { "PROP_DESC_METADATA", "The metadata of the list." }, - - { "PROP_NAME_CURRENTPOSITION", "currentPosition" }, - { "PROP_DESC_CURRENTPOSITION", "The current row position in the list." }, - - { "PROP_NAME_LENGTH", "length" }, - { "PROP_DESC_LENGTH", "The length of the list." }, - - { "PROP_NAME_RESULTSET", "resultSet" }, - { "PROP_DESC_RESULTSET", "The SQL ResultSet." }, - - { "PROP_NAME_RECORDFORMAT", "recordFormat" }, - { "PROP_DESC_RECORDFORMAT", "The record format of the record list." }, - - { "PROP_NAME_HEADERLINKS", "links" }, - { "PROP_TA_DESC_HEADERLINKS", "The HTML hyperlinks of the table header." }, - { "PROP_FO_DESC_HEADERLINKS", "The HTML hyperlinks of the form header." }, - - { "PROP_NAME_TABLE", "table" }, - { "PROP_DESC_TABLE", "The HTMLTable object of the converter." }, - - { "PROP_NAME_MAXTABLESIZE", "maxTableSize" }, - { "PROP_DESC_MAXTABLESIZE", "The maximum number of rows in the table." }, - - { "PROP_NAME_COLUMNCOUNT", "columnCount" }, - { "PROP_DESC_COLUMNCOUNT", "The number of columns in the list." }, - - { "PROP_NAME_PATH", "path" }, //$B1A - { "PROP_DESC_PATH", "The servlet path information." }, //$B1A - - { "PROP_NAME_RESPONSE", "response" }, //$B1A - { "PROP_DESC_RESPONSE", "The http servlet response." }, //$B1A - - { "PROP_DESC_SHUTDOWN", "The connection pool is shutting down..." }, //$B2A - - { "PROP_DESC_CLEANUP", "cleaning up connection pool..." }, //$B2A - - { "PROP_DESC_SHUTDOWNCOMP", "shutdown completed." }, //$B2A - - { "PROP_DESC_USEPOOL", "using the connection pool" }, //$B2A - - { "PROP_DESC_CREATEPOOL", "creating new connection pool..." }, //$B2A - - { "PROP_DESC_NOTUSEPOOL", "not using the connection pool" }, //$B2A - - { "PROP_DESC_CLEANUPEXT", "cleaning up existing connection pool..." }, //$B2A - - { "PROP_DESC_POOL", "setting connection pool..." }, //$B3C - - // #TRANNOTE Authenticting a userid to a system. - { "PROP_DESC_AUTHENTICATE", "authenticating &0 to &1..." }, //$B2A - - // #TRANNOTE Authenticting a system / userid. - { "PROP_DESC_AUTHENTICATING", "authenticating &0 / &1..." }, //$B2A - - // #TRANNOTE system / userid has been authenticated. - { "PROP_DESC_AUTHENTICATED", "&0 to &1 authenticated" }, //$B2A - - { "PROP_DESC_AUTHFAILED", "System authentication failed" }, //$B2A @550 - - // #TRANNOTE authentication failed for userid - (messages from error) - { "PROP_DESC_AUTHENTICATEFAILED", "authentication failed for &0 - &1" }, //$B2A - - { "PROP_DESC_NEWVALIDATE", "new validation" }, //$B2A - - { "PROP_DESC_OLDVALIDATE", "previously validated" }, //$B2A - - { "PROP_DESC_INITFAILED", "failed to get host name for localhost - using local host as realm name" }, //$B2A - - // #TRANNOTE challenging the credentials to a system. - { "PROP_DESC_CHALLENGE", "challenging credentials to &0..." }, //$B2A - - // #TRANNOTE servicing an HTTP request for a system at some IP address - { "PROP_DESC_SERVICE", "servicing request for &0 &1..." }, //$B2A - - // #TRANNOTE HTTP request failed for userid - (messages from error) - { "PROP_DESC_REQFAILED", "request failed for &0 - &1" }, //$B2A - - // #TRANNOTE HTTP request completed for system and IP address - { "PROP_DESC_REQCOMPLETED", "request completed for &0 &1" }, //$B2A - - { "PROP_DESC_REALMFAILED", "failed to get host name for localhost" }, //$B2A - - { "PROP_DESC_RL_CURRENTPOSITION", "The current row position in the resource list." }, //$B4A - - { "PROP_DESC_RL_LENGTH", "The length of the resource list." }, //$B4A - - { "PROP_NAME_RESOURCELIST", "resourceList" }, //$B4A - { "PROP_DESC_RESOURCELIST", "The resource list." }, //$B4A - - { "PROP_NAME_RL_COLUMNATTRIBUTE", "columnAttributeIDs" }, //$B4A - { "PROP_DESC_RL_COLUMNATTRIBUTE", "The column attributes." }, //$B4A - - { "PROP_NAME_RL_NAME", "Name" } //$B4A - - }; - -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetMetaData.java b/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetMetaData.java deleted file mode 100644 index 0afb6cb6b..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetMetaData.java +++ /dev/null @@ -1,649 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLResultSetMetaData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; - -import com.ibm.as400.util.html.HTMLConstants; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.Types; - -/** -* An SQLResultSetMetaData object can be used to find out information about the columns of -* an SQLResultSetRowData object. -* -*

    -* Serializing the object results in the metadata being cached with the object. -* After deserialization the cached data is used until the metadata is reset using -* the setMetaData method. -* -*

    SQLResultSetMetaData objects generate the following events: -*

      -*
    • PropertyChangeEvent
    • -*
    • VetoableChangeEvent
    • -*
    -**/ -public class SQLResultSetMetaData implements RowMetaData, Serializable -{ - static final long serialVersionUID = 6743260415904796964L; - - transient private ResultSetMetaData metadata_; // The result set metadata. - private String[] columnLabels_; // The column label list. - private boolean isCached_ = false; // Indicates if the metadata is cached or - // if the ResultSetMetaData object is used. - - // metadata information cache - private int columnCount_ = -1; // The number of columns. - private int[] columnDisplaySize_; // The column display size. - private String[] columnName_; // The column name. - private int[] columnType_; // The column type. - private String[] columnTypeName_; // The column type name. - private int[] columnPrecision_; // The column precision. - private int[] columnScale_; // The column scale. - - transient private PropertyChangeSupport changes_; //@CRS - transient private VetoableChangeSupport vetos_; //@CRS - - private String[] columnAlignment_; // The array of column alignments. @D5A - private String[] columnDirection_; // The array of column alignments. @D5A - /** - Constructs a default SQLResultSetMetaData object. - **/ - public SQLResultSetMetaData() - { - } - - /** - Constructs an SQLResultSetMetaData object with the specified metadata. - @param metadata The metadata. - @exception RowDataException If a row data error occurs. - **/ - public SQLResultSetMetaData(ResultSetMetaData metadata) throws RowDataException - { - // Set the metadata parameter. - try - { - setMetaData(metadata); - } - catch (PropertyVetoException e) { /* Will never occur. */ } - } - - /** - * Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange - * method is called each time the value of any bound property is changed. - * @see #removePropertyChangeListener - * @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (changes_ == null) changes_ = new PropertyChangeSupport(this); //@CRS - changes_.addPropertyChangeListener(listener); - } - - /** - * Adds the VetoableChangeListener. The specified VetoableChangeListener's vetoableChange - * method is called each time the value of any constrained property is changed. - * @see #removeVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (vetos_ == null) vetos_ = new VetoableChangeSupport(this); //@CRS - vetos_.addVetoableChangeListener(listener); - } - - - /** - * Returns the alignment of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The horizontal column alignment. One of the following constants - * defined in HTMLConstants: LEFT, CENTER, RIGHT, or JUSTIFY. - * @see com.ibm.as400.util.html.HTMLConstants - * @exception RowDataException If a row data error occurs. - **/ - public String getColumnAlignment(int columnIndex) throws RowDataException //@D5A - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - return columnAlignment_[columnIndex]; - } - - - /** - * Returns the direction of the column specified by columnIndex. - * @param columnIndex The column index (0-based). - * @return The column direction. - * @see com.ibm.as400.util.html.HTMLConstants - * @exception RowDataException If a row data error occurs. - **/ - public String getColumnDirection(int columnIndex) throws RowDataException //@D5A - { - // Validate the column parameter. - validateColumnIndex(columnIndex); - - return columnDirection_[columnIndex]; - } - - /** - Returns the number of columns in the result set. - @return The number of columns. - @exception RowDataException If a row data error occurs. - **/ - public int getColumnCount() throws RowDataException - { - try - { - if (isCached_) - return columnCount_; - else - { - // Validate the metadata. - validateMetaData("Attempting to get the column count"); - return metadata_.getColumnCount(); - } - } - catch (SQLException e) - { - Trace.log(Trace.INFORMATION, "Rethrowing SQLException."); - throw new RowDataException(e); - } - } - - /** - Returns the display size in characters of the column specified by columnIndex. - @param columnIndex The column index (0-based). - @return The column display size in characters. - @exception RowDataException If a row data error occurs. - **/ - public int getColumnDisplaySize(int columnIndex) throws RowDataException - { - // Validate the columnIndex parameter. - validateColumnIndex(columnIndex); - - try - { - if (isCached_) - return columnDisplaySize_[columnIndex]; - else - { - // Validate the metadata. - validateMetaData("Attempting to get the column display size"); - return metadata_.getColumnDisplaySize(columnIndex + 1); - } - } - catch (SQLException e) - { - Trace.log(Trace.INFORMATION, "Rethrowing SQLException."); - throw new RowDataException(e); - } - } - - /** - Returns the label of the column specified by columnIndex. - @param columnIndex The column index (0-based). - @return The column label. - @exception RowDataException If a row data error occurs. - **/ - public String getColumnLabel(int columnIndex) throws RowDataException - { - // Validate the metadata. - if (!isCached_) - validateMetaData("Attempting to get the column label"); - - // Validate the columnIndex parameter. - validateColumnIndex(columnIndex); - - return columnLabels_[columnIndex]; - } - - /** - Returns the name of the column specified by columnIndex. - @param columnIndex The column index (0-based). - @return The column name. - @exception RowDataException If a row data error occurs. - **/ - public String getColumnName(int columnIndex) throws RowDataException - { - // Validate the columnIndex parameter. - validateColumnIndex(columnIndex); - - try - { - if (isCached_) - return columnName_[columnIndex]; - else - { - // Validate the metadata. - validateMetaData("Attempting to get the column name"); - return metadata_.getColumnName(columnIndex + 1); - } - } - catch (SQLException e) - { - Trace.log(Trace.INFORMATION, "Rethrowing SQLException."); - throw new RowDataException(e); - } - } - - /** - Returns the SQL data type of the column specified by columnIndex. - @param columnIndex The column index (0-based). - @return The column SQL type (see java.sql.Types). - @exception RowDataException If a row data error occurs. - **/ - public int getColumnType(int columnIndex) throws RowDataException - { - // Validate the columnIndex parameter. - validateColumnIndex(columnIndex); - - try - { - if (isCached_) - return columnType_[columnIndex]; - else - { - // Validate the metadata. - validateMetaData("Attempting to get the column type"); - return metadata_.getColumnType(columnIndex + 1); - } - } - catch (SQLException e) - { - Trace.log(Trace.INFORMATION, "Rethrowing SQLException."); - throw new RowDataException(e); - } - } - - /** - Returns the data type name of the column specified by columnIndex. - @param columnIndex The column index (0-based). - @return The column data type name. - @exception RowDataException If a row data error occurs. - **/ - public String getColumnTypeName(int columnIndex) throws RowDataException - { - // Validate the columnIndex parameter. - validateColumnIndex(columnIndex); - - try - { - if (isCached_) - return columnTypeName_[columnIndex]; - else - { - // Validate the metadata. - validateMetaData("Attempting to get the column type name"); - return metadata_.getColumnTypeName(columnIndex + 1); - } - } - catch (SQLException e) - { - Trace.log(Trace.INFORMATION, "Rethrowing SQLException."); - throw new RowDataException(e); - } - } - - /** - Returns the result set metadata. - @return The metadata. - **/ - public ResultSetMetaData getMetaData() - { - return metadata_; - } - - /** - Returns the number of decimal digits for the column specified by columnIndex. - @param columnIndex The column index (0-based). - @return The column precision (number of decimal digits). - @exception RowDataException If a row data error occurs. - **/ - public int getPrecision(int columnIndex) throws RowDataException - { - // Validate the columnIndex parameter. - validateColumnIndex(columnIndex); - - try - { - if (isCached_) - return columnPrecision_[columnIndex]; - else - { - // Validate the metadata. - validateMetaData("Attempting to get the precision"); - return metadata_.getPrecision(columnIndex + 1); - } - } - catch (SQLException e) - { - Trace.log(Trace.INFORMATION, "Rethrowing SQLException."); - throw new RowDataException(e); - } - } - - /** - Returns the number of digits to the right of the decimal point for the column - specified by columnIndex. - @param columnIndex The column index (0-based). - @return The column scale (number of decimal digits to the right of the decimal point). - @exception RowDataException If a row data error occurs. - **/ - public int getScale(int columnIndex) throws RowDataException - { - // Validate the columnIndex parameter. - validateColumnIndex(columnIndex); - - try - { - if (isCached_) - return columnScale_[columnIndex]; - else - { - // Validate the metadata. - validateMetaData("Attempting to get the scale"); - return metadata_.getScale(columnIndex + 1); - } - } - catch (SQLException e) - { - Trace.log(Trace.INFORMATION, "Rethrowing SQLException."); - throw new RowDataException(e); - } - } - - /** - * Indicates if the column specified by columnIndex contains numeric data. - * @param columnIndex The column index (0-based). - * @return true if numeric data; false otherwise. - * @exception RowDataException If a row data error occurs. - **/ - public boolean isNumericData(int columnIndex) throws RowDataException // @A1 - { - // validate the columnIndex parameter. - validateColumnIndex(columnIndex); - - switch (getColumnType(columnIndex)) - { - case Types.BIGINT: - case Types.DECIMAL: - case Types.DOUBLE: - case Types.FLOAT: - case Types.INTEGER: - case Types.NUMERIC: - case Types.REAL: - case Types.SMALLINT: - case Types.TINYINT: - return true; - case Types.OTHER: //determine if we are a DECFLOAT - if(getColumnTypeName(columnIndex).equals("DECFLOAT")) - return true; - else - return false; - default: - return false; - } - } - - /** - * Indicates if the column specified by columnIndex contains text data. - * @param columnIndex The column index (0-based). - * @return true if text data; false otherwise. - * @exception RowDataException If a row data error occurs. - **/ - public boolean isTextData(int columnIndex) throws RowDataException - { - // Validate the columnIndex parameter. - validateColumnIndex(columnIndex); - - switch(getColumnType(columnIndex)) - { - case Types.CHAR: - case Types.DATE: - case Types.LONGVARCHAR: - case Types.TIME: - case Types.TIMESTAMP: - case Types.VARCHAR: - return true; - default: - return false; - } - } - - /** - * Deserializes the object and initializes the transient data. - **/ - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - - metadata_ = null; // use cached data until reset. - - // Setup the listeners. - //@CRS changes_ = new PropertyChangeSupport(this); - //@CRS vetos_ = new VetoableChangeSupport(this); - } - - /** - * Removes the PropertyChangeListener from the internal list. - * If the PropertyChangeListener is not on the list, nothing is done. - * @see #addPropertyChangeListener - * @param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (changes_ != null) changes_.removePropertyChangeListener(listener); //@CRS - } - - /** - * Removes the VetoableChangeListener from the internal list. - * If the VetoableChangeListener is not on the list, nothing is done. - * @see #addVetoableChangeListener - * @param listener The VetoableChangeListener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - if (vetos_ != null) vetos_.removeVetoableChangeListener(listener); //@CRS - } - - /** - * Sets the result set metadata. - * @param metadata The metadata. - * @exception PropertyVetoException If a change is vetoed. - * @exception RowDataException If a row data error occurs. - **/ - public void setMetaData(ResultSetMetaData metadata) throws PropertyVetoException, RowDataException - { - // Validate the metadata parameter. - if (metadata == null) - throw new NullPointerException("metadata"); - - ResultSetMetaData old = metadata_; - if (vetos_ != null) vetos_.fireVetoableChange("metadata", old, metadata); //@CRS - - try - { - metadata_ = metadata; - int count = getColumnCount(); //@D5A - columnLabels_ = new String[count]; //@D5C - for (int i=0; i< columnLabels_.length; i++) - columnLabels_[i] = metadata_.getColumnLabel(i+1); - - columnAlignment_ = new String[count]; //@D5A - columnDirection_ = new String[count]; //@D5A - } - catch (SQLException e) - { - throw new RowDataException(e); - } - - if (changes_ != null) changes_.firePropertyChange("metadata", old, metadata); //@CRS - - // clear the cached data. - if (isCached_) - { - columnCount_ = -1; - columnDisplaySize_ = null; - columnName_ = null; - columnType_ = null; - columnTypeName_ = null; - columnPrecision_ = null; - columnScale_ = null; - isCached_ = false; // Use metadata information instead of cache. - } - } - - - /** - * Sets the specified horizontal alignment for the column data specified by columnIndex. - * @param columnIndex The column index (0-based). - * @param alignment The horizontal column alignment. One of the following constants - * defined in HTMLConstants: LEFT, CENTER, RIGHT, or JUSTIFY. - * @see com.ibm.as400.util.html.HTMLConstants - * @exception RowDataException If a row data error occurs. - **/ - public void setColumnAlignment(int columnIndex, String alignment) throws RowDataException //@D5A - { - validateColumnIndex(columnIndex); - - // If align is not one of the valid HTMLConstants, throw an exception. - if (alignment == null) - throw new NullPointerException("alignment"); - else if ( !(alignment.equals(HTMLConstants.LEFT)) && !(alignment.equals(HTMLConstants.RIGHT)) && !(alignment.equals(HTMLConstants.CENTER)) && !(alignment.equals(HTMLConstants.JUSTIFY)) ) - throw new ExtendedIllegalArgumentException("alignment", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - columnAlignment_[columnIndex] = alignment; - } - - /** - * Sets the specified direction for the column data specified by columnIndex. - * @param columnIndex The column index (0-based). - * @param dir The column direction. - * @see com.ibm.as400.util.html.HTMLConstants - * @exception RowDataException If a row data error occurs. - **/ - public void setColumnDirection(int columnIndex, String dir) throws RowDataException //@D5A - { - validateColumnIndex(columnIndex); - - // If direction is not one of the valid HTMLConstants, throw an exception. - if ( !(dir.equals(HTMLConstants.LTR)) && !(dir.equals(HTMLConstants.RTL)) ) - throw new ExtendedIllegalArgumentException("dir", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - - columnDirection_[columnIndex] = dir; - } - - /** - Sets the specified label at the column specified by columnIndex. - @param columnIndex The column index (0-based). - @param label The label. - @exception RowDataException If a row data error occurs. - **/ - public void setColumnLabel(int columnIndex, String label) throws RowDataException - { - // Validate the label parameter. - if (label == null) - throw new NullPointerException("label"); - - // Validate the column parameter. - validateColumnIndex(columnIndex); - - columnLabels_[columnIndex] = label; - } - - /** - * Validates the column index. - * @param columnIndex The column index. - **/ - private void validateColumnIndex(int columnIndex) throws RowDataException - { - if ( (columnIndex < 0) || (columnIndex >= getColumnCount()) ) - throw new ExtendedIllegalArgumentException("columnIndex", ExtendedIllegalArgumentException.RANGE_NOT_VALID); - } - - /** - * Validates the metadata. - * @param action The attempted action on the metadata. - **/ - private void validateMetaData(String action) - { - if (metadata_ == null) - { - Trace.log(Trace.ERROR, action + " before setting the metadata."); - throw new ExtendedIllegalStateException("metadata", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - } - - /** - * Serializes the metadata information. - * @param out The output stream. - * @exception IOException If a file I/O error occurs. - * @exception RowDataException If a rowdata error occurs. - **/ - private void writeObject(ObjectOutputStream out) throws IOException, RowDataException - { - // cache the metadata information. - if (metadata_ != null) - { - columnCount_ = getColumnCount(); - - columnDisplaySize_ = new int[columnCount_]; - columnName_ = new String[columnCount_]; - columnType_ = new int[columnCount_]; - columnTypeName_ = new String[columnCount_]; - columnPrecision_ = new int[columnCount_]; - columnScale_ = new int[columnCount_]; - columnAlignment_ = new String[columnCount_]; //@D5A - columnDirection_ = new String[columnCount_]; //@D5A - - for (int columnIndex = 0; columnIndex < columnCount_; columnIndex++) - { - columnDisplaySize_[columnIndex] = getColumnDisplaySize(columnIndex); - columnName_[columnIndex] = getColumnName(columnIndex); - columnType_[columnIndex] = getColumnType(columnIndex); - columnTypeName_[columnIndex] = getColumnTypeName(columnIndex); - columnPrecision_[columnIndex] = getPrecision(columnIndex); - columnScale_[columnIndex] = getScale(columnIndex); - columnAlignment_[columnIndex] = getColumnAlignment(columnIndex); //@D5A - columnDirection_[columnIndex] = getColumnDirection(columnIndex); //@D5A - } - isCached_ = true; // data has now been cached. - } - - // Serialize the object. - out.defaultWriteObject(); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetMetaData16.gif b/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetMetaData16.gif deleted file mode 100644 index 403506d89..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetMetaData16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetMetaData32.gif b/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetMetaData32.gif deleted file mode 100644 index ccfbd6d85..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetMetaData32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetMetaDataBeanInfo.java b/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetMetaDataBeanInfo.java deleted file mode 100644 index 6ec87e3b0..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetMetaDataBeanInfo.java +++ /dev/null @@ -1,150 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLResultSetMetaDataBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -* The SQLResultSetMetaDataBeanInfo class provides bean information -* for the SQLResultSetMetaData class. -**/ -public class SQLResultSetMetaDataBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private final static Class beanClass = SQLResultSetMetaData.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_s loader_; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - PropertyDescriptor columnCount = new PropertyDescriptor("columnCount", beanClass, - "getColumnCount", null); - columnCount.setBound(false); - columnCount.setConstrained(false); - columnCount.setDisplayName(loader_.getText("PROP_NAME_COLUMNCOUNT")); - columnCount.setShortDescription(loader_.getText("PROP_DESC_COLUMNCOUNT")); - - PropertyDescriptor metaData = new PropertyDescriptor("metaData", beanClass, - "getMetaData", "setMetaData"); - metaData.setBound(true); - metaData.setConstrained(true); - metaData.setDisplayName(loader_.getText("PROP_NAME_METADATA")); - metaData.setShortDescription(loader_.getText("PROP_DESC_METADATA")); - - properties_ = new PropertyDescriptor[] { columnCount, metaData }; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("SQLResultSetMetaData16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("SQLResultSetMetaData32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetRowData.java b/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetRowData.java deleted file mode 100644 index 8c7546aeb..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetRowData.java +++ /dev/null @@ -1,232 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLResultSetRowData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.Trace; - -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Vector; - -/** - The SQLResultSetRowData class represents an SQL ResultSet as a list of data. - The ResultSet object is generated by an executed SQL statement. - -

    An SQLResultSetRowData object maintains a position in the list that points to its - current row of data. The initial position in the list is set before the - first row. The next method moves to the next row in the list. - -

    The getString method is used to retrieve the column value for - the current row indexed by the column number. Columns are numbered - starting from 0. - -

    The number, types, and properties of the list's columns are provided - by the SQLResultSetMetaData - object returned by the getMetaData method. - -

    The following example creates an SQLResultSetRowData object and initializes it to an - SQL ResultSet. -

    -  

    // Register and get a connection to the database. - DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver()); - Connection connection = DriverManager.getConnection("jdbc:as400://mySystem"); -

    // Execute an SQL statement and get the result set. - Statement statement = connection.createStatement(); - statement.execute("select * from qiws.qcustcdt"); - ResultSet resultSet = statement.getResultSet(); -

    // Create the SQLResultSetRowData object and initialize to the result set. - SQLResultSetRowData rowData = new SQLResultSetRowData(resultSet); -

    -**/ -public class SQLResultSetRowData extends RowData -{ - static final long serialVersionUID = 1069177903929009287L; - - private static final String CHK_POSITION = "Attempting to check the list position"; - private static final String SET_POSITION = "Attempting to set the list position"; - - /** - * The java.sql.ResultSet object associated with this RowData. - **/ - protected transient ResultSet resultSet_; // The SQL result set. @B6C - - private SQLResultSetMetaData metadata_; // The metadata. - //@B6D private int numColumns_; // The number of columns. - - /** - * Constructs a default SQLResultSetRowData object. - **/ - public SQLResultSetRowData() - { - super(); - } - - /** - * Constructs a SQLResultSetRowData object with the specified resultSet. - * The remaining rows are read from the ResultSet starting at the current - * cursor position. The ResultSet is left in an open state with the cursor - * positioned after the last row. The ResultSet can be closed using the - * close method. - * @param resultSet The SQL result set. An empty result set is invalid. - * @exception RowDataException If the cursor state of the result set is invalid or a rowdata error occurs. - * @see #close - **/ - public SQLResultSetRowData(ResultSet resultSet) throws RowDataException - { - this(); - - try - { - setResultSet(resultSet); - } - catch (PropertyVetoException e) - { /* Will never happen. */ - } - } - - /** - * Closes the SQL result set. - * @exception RowDataException If a row data error occurs. - **/ - public void close() throws RowDataException - { - // Validate the result set. - if (resultSet_ == null) - { - Trace.log(Trace.ERROR, "Attempting to close the result set before setting the result set."); - throw new ExtendedIllegalStateException("resultSet", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - try - { - resultSet_.close(); - } - catch (SQLException e) - { - Trace.log(Trace.INFORMATION, "Rethrowing SQLException."); - throw new RowDataException(e); - } - } - - /** - * Returns the metadata. - * @return The metadata. - * @exception RowDataException If a row data error occurs. - **/ - public RowMetaData getMetaData() throws RowDataException - { - // Validate the result set. -//@B4D validateResultSet("Attempting to get the metadata"); - - try - { - if (resultSet_ != null & metadata_ == null) //@D5C - metadata_ = new SQLResultSetMetaData(resultSet_.getMetaData()); - - return metadata_; - } - catch (SQLException e) - { - throw new RowDataException(e); - } - } - - /** - * Returns the SQL result set. - * Null is returned if the object was serialized. The result set data is cached - * during serialization. - * @return The SQL result set. - **/ - public ResultSet getResultSet() - { - return resultSet_; - } - - - /** - * Deserializes the object and initializes the transient data. - **/ - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - - resultSet_ = null; - } - - - /** - * Sets the SQL result set. The remaining rows are read from - * the ResultSet starting at the current cursor position. The - * ResultSet is left in an open state with the cursor positioned - * after the last row. The ResultSet can be closed using the - * close method. - * If a result set already exists, then setting the result set - * will remove all rows from the list before reading in the - * new data. - * @param resultSet The SQL result set. An empty result set is invalid. - * @exception RowDataException If the cursor state of the result set is invalid or a rowdata error occurs. - * @exception PropertyVetoException If a change is vetoed. - * @see #close - **/ - public void setResultSet(ResultSet resultSet) throws RowDataException, PropertyVetoException - { - if (resultSet == null) - throw new NullPointerException("resultSet"); - - ResultSet old = resultSet_; - if (vetos_ != null) vetos_.fireVetoableChange("resultSet", old, resultSet); //@CRS - - resultSet_ = resultSet; - - // Remove all existing rows and rows properties. - rows_ = new Vector(); - rowProperties_ = new Vector(); - - try - { - // Initialize the properties vector for each row. - final int numColumns = resultSet.getMetaData().getColumnCount(); //@B6C - - Object[] row; - - // Process the result set. - while (resultSet.next()) - { - - row = new Object[numColumns]; //@B6C - for (int column=0; column < numColumns; column++) //@B6C - row[column] = resultSet.getString(column+1); //@B5C - - - // add the row and properties. - rows_.addElement(row); - rowProperties_.addElement(new Vector[numColumns]); //@B6C - } - // Verify that a row was added to the list. - if (changes_ != null) changes_.firePropertyChange("resultSet", old, resultSet); //@CRS - // Set the starting position in the list. - beforeFirst(); - } - catch (SQLException e) - { - Trace.log(Trace.INFORMATION, "Rethrowing SQLException."); - throw new RowDataException(e); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetRowData16.gif b/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetRowData16.gif deleted file mode 100644 index 3b3908260..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetRowData16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetRowData32.gif b/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetRowData32.gif deleted file mode 100644 index 4a0e35617..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetRowData32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetRowDataBeanInfo.java b/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetRowDataBeanInfo.java deleted file mode 100644 index 99a14b6d5..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/SQLResultSetRowDataBeanInfo.java +++ /dev/null @@ -1,166 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLResultSetRowDataBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -* The SQLResultSetRowDataBeanInfo class provides bean information -* for the SQLResultSetRowData class. -**/ -public class SQLResultSetRowDataBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private final static Class beanClass = SQLResultSetRowData.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_s loader_; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - PropertyDescriptor currentPosition = new PropertyDescriptor("currentPosition", - beanClass, - "getCurrentPosition", - null); - currentPosition.setBound(false); - currentPosition.setConstrained(false); - currentPosition.setDisplayName(loader_.getText("PROP_NAME_CURRENTPOSITION")); - currentPosition.setShortDescription(loader_.getText("PROP_DESC_CURRENTPOSITION")); - - PropertyDescriptor length = new PropertyDescriptor("length", beanClass, - "length", null); - length.setBound(false); - length.setConstrained(false); - length.setDisplayName(loader_.getText("PROP_NAME_LENGTH")); - length.setShortDescription(loader_.getText("PROP_DESC_LENGTH")); - - PropertyDescriptor metadata = new PropertyDescriptor("metadata", beanClass, - "getMetaData", null); - metadata.setBound(false); - metadata.setConstrained(false); - metadata.setDisplayName(loader_.getText("PROP_NAME_METADATA")); - metadata.setShortDescription(loader_.getText("PROP_DESC_METADATA")); - - PropertyDescriptor resultSet = new PropertyDescriptor("resultSet", beanClass, - "getResultSet", "setResultSet"); - resultSet.setBound(true); - resultSet.setConstrained(true); - resultSet.setDisplayName(loader_.getText("PROP_NAME_RESULTSET")); - resultSet.setShortDescription(loader_.getText("PROP_DESC_RESULTSET")); - - properties_ = new PropertyDescriptor[] { currentPosition, length, metadata, resultSet }; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("SQLResultSetRowData16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("SQLResultSetRowData32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/SectionCompletedEvent.java b/cvsroot/src/com/ibm/as400/util/servlet/SectionCompletedEvent.java deleted file mode 100644 index 871142650..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/SectionCompletedEvent.java +++ /dev/null @@ -1,65 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SectionCompletedEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -/** - The SectionCompletedEvent class represents a SectionCompleted event. -**/ -public class SectionCompletedEvent extends java.util.EventObject -{ - static final long serialVersionUID = 5950825305973561860L; - - private String section_; // The completed section of data. - - /** - * Constructs a SectionCompletedEvent object. - * It uses the specified source object that completed the section. - * @param source The object where the event originated. - **/ - public SectionCompletedEvent(Object source) - { - super(source); - } - - /** - * Constructs a SectionCompletedEvent object with the specified data section. - * It uses the specified source object that completed the section. - * @param source The object where the event originated. - * @param section The completed section of data. - **/ - public SectionCompletedEvent(Object source, String section) - { - this(source); - section_ = section; - } - - /** - * Returns the completed section of data. - * @return The section of data. - **/ - public String getSection() - { - return section_; - } - - /** - * Sets the completed section of data. - * @param section The section of data. - **/ - public void setSection(String section) - { - section_ = section; - } -} - diff --git a/cvsroot/src/com/ibm/as400/util/servlet/SectionCompletedListener.java b/cvsroot/src/com/ibm/as400/util/servlet/SectionCompletedListener.java deleted file mode 100644 index 26170a18f..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/SectionCompletedListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SectionCompletedListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -/** - The SectionCompletedListener interface provides a listener - interface for receiving SectionCompleted events. -**/ -public interface SectionCompletedListener extends java.util.EventListener -{ - /** - Invoked when a section of data has been converted. - @param event The event. - **/ - public abstract void sectionCompleted(SectionCompletedEvent event); // @C1 -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/SectionCompletedSupport.java b/cvsroot/src/com/ibm/as400/util/servlet/SectionCompletedSupport.java deleted file mode 100644 index 3b73ece66..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/SectionCompletedSupport.java +++ /dev/null @@ -1,70 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SectionCompletedSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import java.util.Vector; - -class SectionCompletedSupport -{ - transient private Vector sectionListeners_; // The list of row listeners. - transient private Object source_; - - public SectionCompletedSupport(Object source) - { - sectionListeners_ = new Vector(); - source_ = source; - } - - /** - * Adds an SectionCompletedListener. - * The SectionCompletedListener object is added to an internal list of SectionCompletedListeners; - * it can be removed with removeSectionCompletedListener. - * - * @param listener The SectionCompletedListener. - **/ - public void addSectionCompletedListener(SectionCompletedListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - sectionListeners_.addElement(listener); - } - - /** - * Fires a section completed event to notify that a section has been converted. - * @param section The completed section of data. - **/ - public void fireSectionCompleted(String section) - { - Vector targets = (Vector) sectionListeners_.clone(); - SectionCompletedEvent event = new SectionCompletedEvent(source_, section); - for (int i = 0; i < targets.size(); i++) { - SectionCompletedListener target = (SectionCompletedListener)targets.elementAt(i); - target.sectionCompleted(event); - } - } - - /** - * Removes this SectionCompletedListener from the internal list. - * If the SectionCompletedListener is not on the list, nothing is done. - * @param listener The SectionCompletedListener. - **/ - public void removeSectionCompletedListener(SectionCompletedListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - - sectionListeners_.removeElement(listener); - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ServletEventLog.java b/cvsroot/src/com/ibm/as400/util/servlet/ServletEventLog.java deleted file mode 100644 index 29889ed4c..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/ServletEventLog.java +++ /dev/null @@ -1,77 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ServletEventLog.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import java.util.*; -import javax.servlet.*; -import com.ibm.as400.access.Log; //$A1C - -/** - * The ServletEventLog class represents an Log object. - **/ - -public class ServletEventLog implements Log //$A1C -{ - private ServletContext context_; - - - /** - * Constructs an ServletEventLog object with the specified servlet configuration. - * - * @param config The servlet configuration. - **/ - public ServletEventLog(ServletConfig config) - { - context_ = config.getServletContext(); - } - - - /** - * Logs a message to the event log. - * - * @param msg The message to log. - **/ - public void log(String msg) - { - context_.log(logMessage(msg)); - } - - - /** - * Logs an exception and message to the event log. - * - * @param msg The message to log. - * @param exception The exception to log. - */ - public void log(String msg, Throwable exception) - { - if (exception instanceof Exception) - context_.log((Exception)exception, logMessage(msg)); - else - context_.log(logMessage(msg), exception); - } - - - /** - * Return a message with thread and date information. - * - * @param msg The Message. - **/ - private String logMessage(String msg) - { - String id = Thread.currentThread().getName(); - - return " " + new Date() + " " + id + " " + msg; - } -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ServletHyperlink.java b/cvsroot/src/com/ibm/as400/util/servlet/ServletHyperlink.java deleted file mode 100644 index 33c0c0b22..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/ServletHyperlink.java +++ /dev/null @@ -1,462 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ServletHyperlink.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.util.html.HTMLHyperlink; -import com.ibm.as400.util.html.URLEncoder; -import com.ibm.as400.access.Trace; - -import java.util.Enumeration; -import java.util.Properties; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; - -import javax.servlet.http.*; - -/** -* The ServletHyperlink class represents an HTML hyperlink tag. -* -*

    This example creates an ServletHyperlink and displays the HTML tag. -*

    -*  ServletHyperlink link = new ServletHyperlink("http://www.myCompany.com", "myCompany Home Page");
    -*  link.setHttpServletResponse(resp);
    -*  link.setPathInfo("/myServletDirectory/servlet");
    -*  System.out.println(link.getTag());
    -*  
    -* -*

    Here is the output of the ServletHyperlink: -*

    -*  <a href="http://www.myCompany.com/myServletDirectory/servlet&SomeSessionID=942349280740">myCompany Home Page</a>
    -*  
    -* -*

    This example creates an ServletHyperlink and sets two properties. -*

    -*  ServletHyperlink link = new ServletHyperlink("http://www.myCompany.com", "myCompany Home Page");
    -*  Properties properties = new Properties();
    -*  properties.put("userID", "fred");
    -*  properties.put("employeeID", "01234567");
    -*  link.setProperties(properties);
    -*  link.setHttpServletResponse(resp);
    -*  link.setPathInfo("/myServletDirectory/servlet");
    -*  System.out.println(link.getTag());
    -*  
    -* -*

    Here is the output of the ServletHyperlink: -*

    -*  <a href="http://www.myCompany.com/myServletDirectory/servlet?userid=fred&employeeID=01234567&SomeSessionID=942349280740">myCompany Home Page</a>
    -*  
    -* -*

    ServletHyperlink objects generate the following events: -*

      -*
    • PropertyChangeEvent -*
    -**/ -public class ServletHyperlink extends HTMLHyperlink -{ - static final long serialVersionUID = 6349134986210346587L; - - private HttpServletResponse response_; // An http servlet response **this needs to be - // transient or else you can't do serialization. - - private String pathInfo_; // The extra path info to the servlet location. - // ex. - http://myServlet/myPathInfo - - - transient PropertyChangeSupport changes_; //@CRS - - - /** - * Creates a default ServletHyperlink object. - **/ - public ServletHyperlink() - { - } - - /** - * Creates a ServletHyperlink object with the specified resource link. - * @param link The Uniform Resource Identifier (URI). - **/ - public ServletHyperlink(String link) - { - super(link); - } - - /** - * Creates a ServletHyperlink object with the specified resource link - * represented by the specified text. - * @param link The Uniform Resource Identifier (URI). - * @param text The text representation for the resource. - **/ - public ServletHyperlink(String link, String text) - { - super(link, text); - } - - /** - * Creates a ServletHyperlink object with the specified resource link - * and target frame represented by the specified text. - * @param link The Uniform Resource Identifier (URI). - * @param text The text representation for the resource. - * @param target The target frame. - **/ - public ServletHyperlink(String link, String text, String target) - { - super(link, text, target); - } - - - /** - * Creates a ServletHyperlink object with the specified resource link, link text, - * target frame, resource link path, and HTTPServlet response. - * @param link The Uniform Resource Identifier (URI). - * @param text The text representation for the resource. - * @param target The target frame. - * @param path The resource link path information. - * @param response The Http servlet response. - **/ - public ServletHyperlink(String link, String text, String target, String path, HttpServletResponse response) - { - super(link, text, target); - - setPathInfo(path); - setHttpServletResponse(response); - } - - - /** - Adds a PropertyChangeListener. The specified - PropertyChangeListener's propertyChange - method is called each time the value of any - bound property is changed. - @see #removePropertyChangeListener - @param listener The PropertyChangeListener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (changes_ == null) changes_ = new PropertyChangeSupport(this); //@CRS - changes_.addPropertyChangeListener(listener); - - //must call the parents change listener since it is - //in a different package. - super.addPropertyChangeListener(listener); - } - - - /** - * Returns a copy of the ServletHyperlink. - * - * @return An ServletHyperlink. - **/ - public Object clone() //$A2A - { - ServletHyperlink l = new ServletHyperlink(); - - try - { - if (getHttpServletResponse() != null) - l.setHttpServletResponse(getHttpServletResponse()); - - if (getProperties() != null) - l.setProperties(getProperties()); // @A5C - - if (getLocation() != null) //$A3A - l.setLocation(getLocation()); //$A3A - - if (getPathInfo() != null) // @A4A - l.setPathInfo(getPathInfo()); // @A4A - - if (getAttributes() != null) // @A4A - l.setAttributes(getAttributes()); // @A4A - - if (getLink() != null) - l.setLink(getLink()); - - if (getTarget() != null) - l.setTarget(getTarget()); - - if (getText() != null) - l.setText(getText()); - - if (getTitle() != null) - l.setTitle(getTitle()); - - if (getDirection() != null) - l.setDirection(getDirection()); - - if (getLanguage() != null) - l.setLanguage(getLanguage()); - - if (getName() != null) - l.setName(getName()); - } - catch (PropertyVetoException e) - { /* Ignore */ - } - - return l; - } - - - /** - * Returns the direction attribute tag. - * @return The direction tag. - **/ - String getDirectionTag() - { - - if ((getDirection() != null) && (getDirection().length() > 0)) - return " dir=\"" + getDirection() + "\""; - else - return ""; - } - - - /** - * Returns the Http servlet response. - * @return The response. - **/ - public HttpServletResponse getHttpServletResponse() - { - return response_; - } - - - /** - * Returns the language attribute tag. - * @return The language tag. - **/ - String getLanguageTag() - { - - if ((getLanguage() != null) && (getLanguage().length() > 0)) - return " lang=\"" + getLanguage() + "\""; - else - return ""; - } - - - /** - * Returns the path information. - * @return The path. - **/ - public String getPathInfo() - { - return pathInfo_; - } - - - /** - * Returns the HTML tag that represents the resource link. - * @return The HTML tag. - **/ - public String getTag() - { - return getTag(getText(), getProperties()); - } - - /** - * Returns the HTML tag that represents the resource link - * with the specified text and properties. The original ServletHyperlink object text - * and properties are not changed/updated. - * @param text The text. - * @param properties The Properties. - * @return The HTML tag. - **/ - public String getTag(String text, Properties properties) - { - - // Verify that the link has been set. - if (getLink() == null) - { - Trace.log(Trace.ERROR, "Attempting to get tag before setting the link."); - throw new ExtendedIllegalStateException("link", ExtendedIllegalStateException.PROPERTY_NOT_SET); - } - - // Validate the text parameter. - if (text == null) - throw new NullPointerException("text"); - - - // create the tag. - StringBuffer link = new StringBuffer(getLink()); - - //path info for servlet ex.- http://myServer/myPathInfo - if (pathInfo_ != null) - { - // if the link ends with a "/", the path does not need a leading "/" - if (getLink().endsWith("/")) - { - if (pathInfo_.startsWith("/")) { - pathInfo_ = pathInfo_.substring(1); - } else { - // pathInfo_ = pathInfo_; - } - } - else //link does not end with a "/", so the path needs to start with "/" - { - if (pathInfo_.startsWith("/")) { - // pathInfo_ = pathInfo_; - } else { - pathInfo_ = "/" + pathInfo_; - } - } - - // place holder for real implementation... - link.append(URLEncoder.encode(pathInfo_, false)); - } - - if (properties != null) - { - String name; - String parmStart = "?"; - Enumeration propertyList = properties.propertyNames(); - while (propertyList.hasMoreElements()) - { - name = (String)propertyList.nextElement(); - link.append(parmStart); - link.append(URLEncoder.encode(name)); - link.append("="); - link.append(URLEncoder.encode(properties.getProperty(name))); - parmStart = "&"; - } - } - - StringBuffer url = new StringBuffer();; - - if (response_ != null) - url.append(response_.encodeUrl(link.toString())); - else - url.append(link.toString()); - - // create the tag. - StringBuffer buffer = new StringBuffer(); - - buffer.append(""); - buffer.append(text); - buffer.append(""); - - return buffer.toString(); - } - - - /** - * Deserializes and initializes transient data. - **/ - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - - //@CRS changes_ = new PropertyChangeSupport(this); - } - - /** - Removes the PropertyChangeListener from the internal list. - If the PropertyChangeListener is not on the list, nothing is done. - @see #addPropertyChangeListener - @param listener The PropertyChangeListener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - if (changes_ != null) changes_.removePropertyChangeListener(listener); //@CRS - - //must call the parents change listener since it is - //in a different package. - super.removePropertyChangeListener(listener); - } - - - /** - * Sets the Http servlet response for the resource link. - * - * @param response The Http servlet response. - **/ - public void setHttpServletResponse(HttpServletResponse response) - { - if (response == null) - throw new NullPointerException("response"); - - HttpServletResponse old = response_; - - response_ = response; - - if (changes_ != null) changes_.firePropertyChange("response", old, response); //@CRS - } - - - /** - * Sets the path information for the resource link. - * - * @param path The path information. - **/ - public void setPathInfo(String path) - { - - if (path == null) - throw new NullPointerException("path"); - - String old = pathInfo_; - - pathInfo_ = path; - - if (changes_ != null) changes_.firePropertyChange("path", old, path); //@CRS - } - -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ServletHyperlink16.gif b/cvsroot/src/com/ibm/as400/util/servlet/ServletHyperlink16.gif deleted file mode 100644 index 9aff9ef16..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/ServletHyperlink16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ServletHyperlink32.gif b/cvsroot/src/com/ibm/as400/util/servlet/ServletHyperlink32.gif deleted file mode 100644 index 67410ede5..000000000 Binary files a/cvsroot/src/com/ibm/as400/util/servlet/ServletHyperlink32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/util/servlet/ServletHyperlinkBeanInfo.java b/cvsroot/src/com/ibm/as400/util/servlet/ServletHyperlinkBeanInfo.java deleted file mode 100644 index bc45d5f16..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/ServletHyperlinkBeanInfo.java +++ /dev/null @@ -1,175 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ServletHyperlinkBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - - -import com.ibm.as400.util.html.HTMLHyperlink; -import com.ibm.as400.util.html.HTMLHyperlinkBeanInfo; - -import java.awt.Image; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.BeanInfo; - -/** -The ServletHyperlinkBeanInfo class provides -bean information for the ServletHyperlink class. -**/ -public class ServletHyperlinkBeanInfo extends SimpleBeanInfo -{ - // Class this bean info represents. - private final static Class beanClass = ServletHyperlink.class; - - // Handles loading the appropriate resource bundle - private static ResourceBundleLoader_s loader_; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - static - { - - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(loader_.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(loader_.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor[] events = {changed, veto}; - - events_ = events; - - // ***** PROPERTIES - PropertyDescriptor path = new PropertyDescriptor("response", beanClass, - "getHttpServletResponse", "setHttpServletResponse"); - path.setBound(true); - path.setConstrained(false); - path.setDisplayName(loader_.getText("PROP_NAME_RESPONSE")); - path.setShortDescription(loader_.getText("PROP_DESC_RESPONSE")); - - PropertyDescriptor response = new PropertyDescriptor("path", beanClass, "getPathInfo", "setPathInfo"); - response.setBound(true); - response.setConstrained(false); - response.setDisplayName(loader_.getText("PROP_NAME_PATH")); - response.setShortDescription(loader_.getText("PROP_DESC_PATH")); - - properties_ = new PropertyDescriptor[] { path, response }; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - * Returns the BeanInfo for the superclass of this bean. Since - * ButtonFormInput is a subclass of FormInput, this method - * will return a FormInputBeanInfo object. - * - * @return BeanInfo[] containing this bean's superclass BeanInfo - **/ - public BeanInfo[] getAdditionalBeanInfo() - { - return new BeanInfo[] { new HTMLHyperlinkBeanInfo() }; - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the propertyChange event - return 0; - } - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the "path" property - return 0; - } - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - Returns an image for the icon. - - @param icon The icon size and color. - @return The image. - **/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("ServletHyperlink16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("ServletHyperlink32.gif"); - break; - } - return image; - } - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} - - diff --git a/cvsroot/src/com/ibm/as400/util/servlet/StringConverter.java b/cvsroot/src/com/ibm/as400/util/servlet/StringConverter.java deleted file mode 100644 index 1173d3a58..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/StringConverter.java +++ /dev/null @@ -1,51 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: StringConverter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.util.servlet; - -import com.ibm.as400.access.Copyright; -import java.beans.PropertyVetoException; -import java.util.Vector; - -/** -* The StringConverter class represents a row data string converter to -* convert the data from RowData objects to formatted String arrays. -**/ -abstract public class StringConverter -{ - /** - * Converts the row data specified by rowdata. - * @param rowdata The row data. - * @return A String array representation of the row data. - * @exception PropertyVetoException If a change is vetoed on the conversion source object. - * @exception RowDataException If a row data error occurs. - **/ - public String[] convert(RowData rowdata) throws PropertyVetoException, RowDataException - { - if (rowdata == null) - throw new NullPointerException("rowdata"); - return doConvert(rowdata, rowdata.getMetaData()); - } - - /** - * Converts the row data specified by rowdata and described by metadata. - * - * @param rowdata The row data. - * @param metadata The meta data. - * @return An array of Strings. - * @exception PropertyVetoException If a change is vetoed on the conversion source object. - * @exception RowDataException If a row data error occurs. - **/ - abstract String[] doConvert(RowData rowdata, RowMetaData metadata) throws PropertyVetoException, RowDataException; - -} diff --git a/cvsroot/src/com/ibm/as400/util/servlet/package.html b/cvsroot/src/com/ibm/as400/util/servlet/package.html deleted file mode 100644 index 2c7903ce2..000000000 --- a/cvsroot/src/com/ibm/as400/util/servlet/package.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - -Provides classes that assist in writing servlets that manipulate IBM i data. - -

    -The servlet classes that are provided with the IBM Toolbox for Java work with -the classes in the com.ibm.as400.access package to give you access to information -located on the system. You decide how to use the servlet classes to assist -you with your own servlet projects. -

    - -

    -A typical scenario is this: A web browser connects to the web server that is running -the servlet. The jt400Servlet.jar and jt400Access.jar files reside on the web server -because the servlet classes use some of the access classes to retrieve the data, and -some of the HTML classes to present the data. The web server is connected to the IBM i -system where the data is stored. -

    - -

    -Note: The jt400Servlet.jar file includes both the HTML and Servlet classes. -You must update your CLASSPATH to point to the jt400Servlet.jar file if you want to -use the classes in the com.ibm.as400.util.servlet package. -

    - -

    Related Documentation

    - -For overviews, tutorials, examples, guides, and tool documentation, please see: - - - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS40032.gif b/cvsroot/src/com/ibm/as400/vaccess/AS40032.gif deleted file mode 100644 index b781923d5..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/AS40032.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsModel.java b/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsModel.java deleted file mode 100644 index 8b7d3fd25..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsModel.java +++ /dev/null @@ -1,653 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400DetailsModel.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.DefaultTableColumnModel; -import javax.swing.table.TableColumn; -import javax.swing.table.TableColumnModel; -import javax.swing.table.TableModel; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.Vector; - - - -/** -The AS400DetailsModel class implements an underlying model for -a table, where all information for the model is gathered -from the contents of a system resource, known as the root. -You must explicitly call load() to load the information from -the system. - -

    Use this class if you want to customize the graphical -user interface that presents a table. If you do not need -to customize the interface, then use AS400DetailsPane instead. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    AS400DetailsModel objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • TableModelEvent -
    • WorkingEvent -
    - -

    The following example creates a details model filled with -details about the jobs running on a system. It then presents -the table in a JTable object. - -

    -
    -// Set up the details model and JTable. -AS400 system = new AS400 ("MySystem", "Userid", "Password"); -VJobList jobList = new VJobList (system); -AS400DetailsModel detailsModel = new AS400DetailsModel (jobList); -detailsModel.load (); -JTable table = new JTable (detailsModel); -
    -// Add the JTable to a frame. -JFrame frame = new JFrame ("My Window"); -frame.getContentPane().add(new JScrollPane(table)); - -
    - -@see AS400DetailsPane -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class AS400DetailsModel -implements TableModel, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Properties. - VNode root_ = null; // Private. - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private VObjectListener objectListener_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient TableModelEventSupport tableModelEventSupport_; // Private. - transient private VetoableChangeSupport vetoableChangeSupport_; - transient private WorkingEventSupport workingEventSupport_; - - - -/** -Constructs an AS400DetailsModel object. -**/ - public AS400DetailsModel () - { - initializeTransient (); - } - - - -/** -Constructs an AS400DetailsModel object. - -@param root The root, or the system resource, from which all information for the model is gathered. - -**/ - public AS400DetailsModel (VNode root) - { - if (root == null) - throw new NullPointerException ("root"); - - root_ = root; - initializeTransient (); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a listener to be notified when the contents of the -table change. - -@param listener The listener. -**/ - public void addTableModelListener (TableModelListener listener) - { - tableModelEventSupport_.addTableModelListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Returns the class for objects that are contained in -a column. - -@param columnIndex The column index. -@return The column class. It will be null if the - column index is not valid or the root has - not been set. - -**/ - public Class getColumnClass (int columnIndex) - { - // Validate the root. - if (root_ == null) - return null; - - // Validate the column index. - TableColumnModel columnModel = root_.getDetailsColumnModel (); - if (columnModel == null) - return null; - if ((columnIndex < 0) || (columnIndex >= columnModel.getColumnCount ())) - return null; - - return Object.class; - } - - - -/** -Returns the number of columns. - -@return The number of columns. This will be 0 if the - root has not been set. -**/ - public int getColumnCount () - { - // Validate the root. - if (root_ == null) - return 0; - - // Validate the column model. - TableColumnModel columnModel = root_.getDetailsColumnModel (); - if (columnModel == null) - return 0; - - return root_.getDetailsColumnModel ().getColumnCount (); - } - - - -/** -Returns the name of a column. - -@param columnIndex The column index. -@return The column name. It will be null if the - column index is not valid or the root has - not been set. -**/ - public String getColumnName (int columnIndex) - { - // Validate the root. - if (root_ == null) - return null; - - // Validate the column index. - TableColumnModel columnModel = root_.getDetailsColumnModel (); - if (columnModel == null) - return null; - if ((columnIndex < 0) || (columnIndex >= columnModel.getColumnCount ())) - return null; - - return columnModel.getColumn (columnIndex).getHeaderValue ().toString (); - } - - - -/** -Returns the object at the specifed row. - -@param rowIndex The row index. -@return The object at the specified - row. It will be null if the index is - not valid or the root - has not been set. -**/ - public VObject getObjectAt (int rowIndex) - { - // Make sure the root has been set. - if (root_ == null) - return null; - - // Validate the row index. - if ((rowIndex < 0) || (rowIndex >= root_.getDetailsChildCount ())) - return null; - - // Return the object. - return root_.getDetailsChildAt (rowIndex); - } - - - -/** -Returns the root, or the system resource, from which all information for the model is gathered. - -@return The root, or the system resource, from which all information for the model is gathered. It will be null if none has been set. -**/ - public VNode getRoot () - { - return root_; - } - - - -/** -Returns the number of rows in the table. - -@return The number of rows in the table, or 0 if the root - has not been set. -**/ - public int getRowCount () - { - // Make sure the root has been set. - if (root_ == null) - return 0; - - return root_.getDetailsChildCount (); - } - - - -/** -Returns the value at the specifed row and column. - -@param rowIndex The row index. -@param columnIndex The column index. -@return The value at the specified - row and column. It will be null if the - column index is not valid or the root has - not been set. -**/ - public Object getValueAt (int rowIndex, int columnIndex) - { - // Make sure the root has been set. - if (root_ == null) - return null; - - // Validate the row index. - if ((rowIndex < 0) || (rowIndex >= getRowCount ())) - return null; - - // Validate the column index. - TableColumnModel columnModel = root_.getDetailsColumnModel (); - if (columnModel == null) - return null; - if ((columnIndex < 0) || (columnIndex >= columnModel.getColumnCount ())) - return null; - - // Get the object represented by the row. - VObject object = root_.getDetailsChildAt (rowIndex); - if (object == null) - return null; - - // Return the value. - Object value = object.getPropertyValue (columnModel.getColumn (columnIndex).getIdentifier ()); - return value; - } - - - -/** -Initializes transient data. -**/ - private void initializeTransient () - { - // Initialize event support. - errorEventSupport_ = new ErrorEventSupport (this); - objectListener_ = new VObjectListener_ (); - propertyChangeSupport_ = new PropertyChangeSupport (this); - tableModelEventSupport_ = new TableModelEventSupport (this, this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - if (root_ != null) { - root_.addErrorListener (errorEventSupport_); - root_.addVObjectListener (objectListener_); - root_.addWorkingListener (workingEventSupport_); - } - } - - - -/** -Indicates if the cell is editable. - -@param rowIndex The row index. -@param columnIndex The column index. -@return true if the cell is editable; - false if the cell is not editable, - the index is not valid, or the - root has not been set. -**/ - public boolean isCellEditable (int rowIndex, int columnIndex) - { - // Validate the root. - if (root_ == null) - return false; - - // Validate the row index. - if ((rowIndex < 0) || (rowIndex >= getRowCount ())) - return false; - - // Validate the column index. - TableColumnModel columnModel = root_.getDetailsColumnModel (); - if (columnModel == null) - return false; - if ((columnIndex < 0) || (columnIndex >= columnModel.getColumnCount ())) - return false; - - return (columnModel.getColumn (columnIndex).getCellEditor() != null); - } - - - -/** -Loads the information from the system. -**/ - public void load () - { - if (root_ != null) - root_.load (); - - tableModelEventSupport_.fireTableChanged (-1); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a table model listener. - -@param listener The listener. -**/ - public void removeTableModelListener (TableModelListener listener) - { - tableModelEventSupport_.removeTableModelListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Sets the root, or the system resource, from which all information for the model is gathered. It will not take effect until load() is done. - -@param root The root, or the system resource, from which all information for the model is gathered. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setRoot (VNode root) - throws PropertyVetoException - { - if (root == null) - throw new NullPointerException ("root"); - - VNode oldValue = root_; - VNode newValue = root; - vetoableChangeSupport_.fireVetoableChange ("root", oldValue, newValue); - - if (oldValue != newValue) { - - // Redirect error event support. - if (oldValue != null) { - oldValue.removeErrorListener (errorEventSupport_); - oldValue.removeVObjectListener (objectListener_); - oldValue.removeWorkingListener (workingEventSupport_); - } - newValue.addErrorListener (errorEventSupport_); - newValue.addVObjectListener (objectListener_); - newValue.addWorkingListener (workingEventSupport_); - - // Set the root. - root_ = newValue; - - // Change the contents of the list. - tableModelEventSupport_.fireTableChanged (-1); - } - - propertyChangeSupport_.firePropertyChange ("root", oldValue, newValue); - } - - - -/** -Sets the value at the specifed row and column. This method has no effect, the value will not change. - -@param value The value. -@param rowIndex The row index. -@param columnIndex The column index. -**/ - public void setValueAt (Object value, - int rowIndex, - int columnIndex) - { - // Nothing. - } - - - -/** -Sorts the contents. The propertyIdentifer[0], orders[0] combination is used to do the sort. If the values are equal, propertyIdentifier[1], orders[1] is used to break the tie, and so forth. - -@param propertyIdentifiers The property identifiers. If any of - the property identifiers are null, it - indicates to sort using the string - representation of the object. -@param orders The sort orders for each property - identifier; true for ascending order, - false for descending order. -**/ - public void sort (Object[] propertyIdentifiers, boolean[] orders) - { - if (propertyIdentifiers == null) - throw new NullPointerException ("propertyIdentifiers"); - if (orders == null) - throw new NullPointerException ("orders"); - - if (root_ != null) { - if (root_.isSortable ()) { - root_.sortDetailsChildren (propertyIdentifiers, orders); - tableModelEventSupport_.fireTableChanged (-1); - } - } - } - - - -/** -Listens for explorer events and adjusts the model accordingly. -**/ - private class VObjectListener_ - implements VObjectListener, Serializable - { - - - - public void objectChanged (VObjectEvent event) - { - VObject object = event.getObject (); - - // If the changed object is the root, - // then reload the whole model. - if (object == root_) { // @A1C - if (! event.isDuringLoad ()) // @A1A - load (); - tableModelEventSupport_.fireTableChanged(); // @A1A @E1C - } // @A1A - - // If the changed object is contained in the table, - // then fix up its row. - else { - int index = root_.getDetailsIndex (object); - if (index >= 0) - tableModelEventSupport_.fireTableChanged (index); - } - } - - - - public void objectCreated (VObjectEvent event) - { - VObject object = event.getObject (); - VNode parent = event.getParent (); - - // If the created object is contained in the list, - // then insert it into the list. - if (parent == root_) { - int index = root_.getDetailsIndex (object); - if (index >= 0) - tableModelEventSupport_.fireTableChanged (index - 1, - index - 1, TableModelEvent.ALL_COLUMNS, - TableModelEvent.INSERT); - } - } - - - - public void objectDeleted (VObjectEvent event) - { - VObject object = event.getObject (); - - // If the deleted object is contained in the list, - // then remove it from the list. - int index = root_.getDetailsIndex (object); - if (index >= 0) - tableModelEventSupport_.fireTableChanged (index, index, - TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE); - } - - } - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsModel16.gif b/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsModel16.gif deleted file mode 100644 index 207d4f229..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsModel16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsModel32.gif b/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsModel32.gif deleted file mode 100644 index ee52c3db3..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsModel32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsModelBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsModelBeanInfo.java deleted file mode 100644 index 95d694717..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsModelBeanInfo.java +++ /dev/null @@ -1,190 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400DetailsModelBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.event.TableModelListener; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The AS400DetailsModelBeanInfo class provides bean information -for the AS400DetailsModel class. - -@see AS400DetailsModel -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ - - -public class AS400DetailsModelBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - // Private data. - private final static Class beanClass_ = AS400DetailsModel.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor tableModel = new EventSetDescriptor (beanClass_, - "tableModel", TableModelListener.class, "tableChanged"); - tableModel.setDisplayName (ResourceLoader.getText ("EVT_NAME_TABLE_MODEL")); - tableModel.setShortDescription (ResourceLoader.getText ("EVT_DESC_TABLE_MODEL")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { error, propertyChange, tableModel, - vetoableChange, working }; - - // Properties. - PropertyDescriptor root = new PropertyDescriptor ("root", beanClass_); - root.setBound (true); - root.setConstrained (true); - root.setDisplayName (ResourceLoader.getText ("PROP_NAME_ROOT")); - root.setShortDescription (ResourceLoader.getText ("PROP_DESC_ROOT")); - - properties_ = new PropertyDescriptor[] { root }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // root. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("AS400DetailsModel16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("AS400DetailsModel32.gif"); - break; - } - return image; - } - - - -/** - Returns the descriptors for all properties. - @return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsPane.java b/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsPane.java deleted file mode 100644 index e50ca916e..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsPane.java +++ /dev/null @@ -1,786 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400DetailsPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.CellEditor; -import javax.swing.DefaultListSelectionModel; -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.JViewport; -import javax.swing.ListSelectionModel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.event.TableColumnModelEvent; -import javax.swing.event.TableColumnModelListener; -import javax.swing.event.TableModelListener; -import javax.swing.table.JTableHeader; -import javax.swing.table.TableColumn; -import javax.swing.table.TableColumnModel; -import javax.swing.table.TableModel; -import java.awt.BorderLayout; -import java.awt.Frame; -import java.awt.Point; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.Enumeration; -import java.util.Vector; - - - -/** -The AS400DetailsPane class represents a graphical user interface -that displays the details regarding the contents of a system -resource, known as the root. You must explicitly call load() to -load the information from the system. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    AS400DetailsPane objects generate the following events: -

      -
    • ErrorEvent -
    • ListSelectionEvent -
    • PropertyChangeEvent -
    - -

    The following example creates a details pane. - -

    -// Set up the details pane.
    -AS400 system = new AS400 ("MySystem", "Userid", "Password");
    -VPrinterOutput printerOutput = new VPrinterOutput (system);
    -AS400DetailsPane detailsPane = new AS400DetailsPane (printerOutput);
    -detailsPane.load ();
    -
    -// Add the details pane to a frame. -JFrame frame = new JFrame ("My Window"); -frame.getContentPane().add (detailsPane); -
    - -@see AS400DetailsModel -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -// -// Implementation notes: -// -// 1. I want to provide different views of the model (e.g. -// large icons, small icons, list, table). The view could -// be a property of this object, and could be implemented -// using an AS400DetailsView (e.g.) interface and many -// implementations. -// -// The list and table views would be easy. However the icon -// views would be too hard, since I would have to implement -// selection mechanisms for those. -// -// 2. Up to and including Swing 0.7, I was able to add function so -// that clicking on the column headings would sort the rows -// by that column. Clicking again would sort in the reverse -// order. This was all triggered by a column selection. -// -// Swing 1.0 changed the column selection mechanism so that -// column selections happen all the time (except when clicking -// on the column heading). -// -// The solution would be to listen to the buttons in the column -// headings to trigger this, but there was not enough time -// to do this rework. Given that there are still public sort() -// methods all over the place, the caller could possibly do -// this. -// -public class AS400DetailsPane -extends JComponent -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Properties. - boolean allowActions_ = true; // Private. - boolean confirm_ = true; // Private. - transient JTable table_ = null; // Private. @B0C - AS400DetailsModel model_ = null; // Private. - - - - // Private data. - transient private VActionContext actionContext_; - transient private DoubleClickAdapter doubleClickAdapter_; - transient private PopupMenuAdapter popupMenuAdapter_; - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_ ; - transient private ListSelectionEventSupport listSelectionEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - - - -/** -Constructs an AS400DetailsPane object. -**/ - public AS400DetailsPane () - { - // Initialize the model. - model_ = new AS400DetailsModel (); - - initializeTransient (); //@B0M - do this first to initialize table_ - - // Layout the pane. - setLayout (new BorderLayout ()); - JScrollPane scrollPane = new JScrollPane (table_); // @A1C - add ("Center", scrollPane); - - } - - - -/** -Constructs an AS400DetailsPane object. - -@param root The root, or the system resource, from which all information for the model is gathered. -**/ - public AS400DetailsPane (VNode root) - { - this (); - - if (root == null) - throw new NullPointerException ("root"); - - try { - model_.setRoot (root); - } - catch (PropertyVetoException e) { - // Ignore. - } - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when a list selection occurs. - -@param listener The listener. -**/ - public void addListSelectionListener (ListSelectionListener listener) - { - listSelectionEventSupport_.addListSelectionListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - super.addPropertyChangeListener (listener); - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - super.addVetoableChangeListener (listener); - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - -/** -Returns the context in which actions will be performed. - -@return The action context. -**/ - public VActionContext getActionContext () - { - return actionContext_; - } - - - -/** -Indicates if actions can be invoked on objects. - -@return true if a actions can be invoked; false otherwise. -**/ - public boolean getAllowActions () - { - return allowActions_; - } - - - -/** -Returns the column model that is used to maintain the columns. -This provides the ability to programmatically add and remove -columns. - -@return The column model. -**/ - public TableColumnModel getColumnModel () - { - return table_.getColumnModel (); - } - - - -/** -Indicates if certain actions are confirmed with the user. - -@return true if certain actions are confirmed with the user; - false otherwise. -**/ - public boolean getConfirm () - { - return confirm_; - } - - - -/** -Returns the model that contains data for the table. - -@return The model that contains data for the table. -**/ - public TableModel getModel () - { - return model_; - } - - - -/** -Returns the root, or the system resource, from which all information for the model is gathered. - -@return The parent root, or null if none. -**/ - public VNode getRoot () - { - return model_.getRoot (); - } - - -/** -Returns the indicator for whether the rows can be selected. - -@return true if rows can be selected; false otherwise. -**/ - public boolean getRowSelectionAllowed () // @A2 - { - return table_.getRowSelectionAllowed(); - } - - -/** -Returns the first selected object. - -@return The first selected object, or null if none are - selected. -**/ - public VObject getSelectedObject () - { - VObject selectedObject = null; - int[] selectedRows = table_.getSelectedRows (); - if (selectedRows.length > 0) - selectedObject = model_.getObjectAt (selectedRows[0]); - return selectedObject; - } - - - -/** -Returns the objects which are represented by the selected rows. - -@return The objects which are represented by the selected rows. -**/ - public VObject[] getSelectedObjects () - { - int[] selectedRows = table_.getSelectedRows (); - VObject[] selectedObjects = new VObject[selectedRows.length]; - for (int i = 0; i < selectedRows.length; ++i) - selectedObjects[i] = model_.getObjectAt (selectedRows[i]); - return selectedObjects; - } - - - -/** -Returns the selection model that is used to maintain row -selection state. This provides the ability to programmatically -select and deselect objects. - -@return The selection model. -**/ - public ListSelectionModel getSelectionModel () - { - return table_.getSelectionModel (); - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - addFocusListener(new SerializationListener(this)); //@B0A - - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - listSelectionEventSupport_ = new ListSelectionEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - - // Initialize the table. @B0M - moved table initialization out of ctor. - table_ = new JTable (model_); - table_.setAutoCreateColumnsFromModel (false); - table_.setAutoResizeMode (JTable.AUTO_RESIZE_OFF); - table_.setColumnSelectionAllowed (false); - table_.setRowSelectionAllowed (true); - table_.setShowGrid (false); - - model_.addErrorListener (errorEventSupport_); - model_.addPropertyChangeListener (propertyChangeSupport_); - model_.addVetoableChangeListener (vetoableChangeSupport_); - table_.getSelectionModel ().addListSelectionListener (listSelectionEventSupport_); - - // Initialize the action context. - actionContext_ = new VActionContext_ (); - - // Initialize the other adapters. - model_.addPropertyChangeListener (new ColumnAdapter_ ()); - model_.addWorkingListener (new WorkingCursorAdapter (table_)); - - VPane_ pane = new VPane_ (); - doubleClickAdapter_ = new DoubleClickAdapter (pane, actionContext_); - popupMenuAdapter_ = new PopupMenuAdapter (pane, actionContext_); - - if (allowActions_) { - table_.addMouseListener (popupMenuAdapter_); - table_.addMouseListener (doubleClickAdapter_); - } - } - - - -/** -Indicates if the object is selected. - -@param object The object. -@return true if the object is selected; false otherwise. -**/ - public boolean isSelected (VObject object) - { - if (object == null) - throw new NullPointerException ("object"); - - int[] selectedRows = table_.getSelectedRows (); - for (int i = 0; i < selectedRows.length; ++i) - if (model_.getObjectAt (selectedRows[i]).equals (object)) - return true; - return false; - } - - - -/** -Loads the information from the system. -**/ - public void load () - { - table_.clearSelection (); - model_.load (); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a list selection listener. - -@param listener The listener. -**/ - public void removeListSelectionListener (ListSelectionListener listener) - { - listSelectionEventSupport_.removeListSelectionListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - super.removePropertyChangeListener (listener); - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener (VetoableChangeListener listener) - { - super.removeVetoableChangeListener (listener); - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** -Sets whether actions are allowed. The following are enabled only when -actions are allowed: - -
      -
    • popup menu on selected object -
    • double clicking on a object sets the root object -
    - -

    The default is true. - -@param allowActions true if actions are allowed; false otherwise. -**/ - public void setAllowActions (boolean allowActions) - { - if (allowActions_ != allowActions) { - - allowActions_ = allowActions; - - // Set up adapters only when actions are allowed. - if (allowActions_) { - table_.addMouseListener (popupMenuAdapter_); - table_.addMouseListener (doubleClickAdapter_); - } - else { - table_.removeMouseListener (popupMenuAdapter_); - table_.removeMouseListener (doubleClickAdapter_); - } - - } - } - - - -/** -Sets whether certain actions are confirmed with the user. The default -is true. - -@param confirm true if certain actions are confirmed with the - user; false otherwise. -**/ - public void setConfirm (boolean confirm) - { - confirm_ = confirm; - } - - - -/** -Sets the root, or the system resource, from which all information for the model is gathered. - -@param root The root, or the system resource, from which all information for the model is gathered. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setRoot (VNode root) - throws PropertyVetoException - { - if (root == null) - throw new NullPointerException ("root"); - - table_.clearSelection (); - model_.setRoot (root); - } - - -/** -Sets the indicator for whether the rows can be selected. - -@param selectable The value indicating if the rows can be selected. -**/ - public void setRowSelectionAllowed (boolean selectable) // @A2 - { - table_.setRowSelectionAllowed(selectable); - - } - -/** -Sets the selection model that is used to maintain selection -state. This provides the ability to programmatically select -and deselect objects. - -@param selectionModel The selection model. -**/ - public void setSelectionModel (ListSelectionModel selectionModel) - { - if (selectionModel == null) - throw new NullPointerException("selectionModel"); - - // Do not dispatch events from the old selection model any more. - ListSelectionModel oldSelectionModel = table_.getSelectionModel (); - if (oldSelectionModel != null) - oldSelectionModel.removeListSelectionListener (listSelectionEventSupport_); - - table_.setSelectionModel (selectionModel); - - // Dispatch events from the new selection model. - if (selectionModel != null) - selectionModel.addListSelectionListener (listSelectionEventSupport_); - } - -/** -Sets the column widths. -**/ - void sizeColumns () // Private. - { - // Get the font size. Use M as a good sample character. - int fontSize = 0; - if (table_.getFont () != null) - fontSize = table_.getFontMetrics (table_.getFont ()).charWidth ('M'); - - if (fontSize > 0) { - - // Iterate through the columns. - TableColumnModel columnModel = table_.getColumnModel (); - int columnCount = columnModel.getColumnCount (); - for (int i = 0; i < columnCount; ++i) { - TableColumn column = columnModel.getColumn (i); - if (column instanceof VTableColumn) { - VTableColumn vcolumn = (VTableColumn) column; - //@B0 - In Swing 1.1, should use setPreferredWidth instead of setWidth. (according to Swing javadoc) - column.setPreferredWidth (vcolumn.getPreferredCharWidth () * fontSize + 10); //@B0C - } - } - } - } - - - -/** -Sorts the contents.The propertyIdentifer[0], orders[0] combination is used to do the sort. If the values are equal, propertyIdentifier[1], orders[1] is used to break the tie, and so forth. - -@param propertyIdentifiers The property identifiers. If any of - the property identifiers are null, it - means to sort using the string - representation of the object. -@param orders The sort orders for each property - identifier, true for ascending order, - false for descending order. -**/ - public void sort (Object[] propertyIdentifiers, boolean[] orders) - { - if (propertyIdentifiers == null) - throw new NullPointerException ("propertyIdentifiers"); - if (orders == null) - throw new NullPointerException ("orders"); - - model_.sort (propertyIdentifiers, orders); - } - - - -/** -The ColumnAdapter_ class listens for change in the -root object of a details model. When such a change occurs, this -class updates the columns of the table as needed. -**/ - private class ColumnAdapter_ - implements PropertyChangeListener - { - public void propertyChange (PropertyChangeEvent event) - { - // If the root object changed in the model, - // then we need to recreate the table. - if (event.getPropertyName () == "root") { - - // Remove the existing columns. Note that we - // must make our own list because the enumeration - // gets wrecked when we remove an element. - TableColumnModel columnModel = table_.getColumnModel (); - Vector oldColumns = new Vector (); - for (Enumeration e = columnModel.getColumns (); e.hasMoreElements (); ) - oldColumns.addElement (e.nextElement ()); - - for (Enumeration e = oldColumns.elements (); e.hasMoreElements (); ) { - TableColumn column = (TableColumn) e.nextElement (); - columnModel.removeColumn (column); - } - - // Add the new table columns. - TableColumnModel columnModel2 = model_.getRoot ().getDetailsColumnModel (); - if (columnModel2 != null) { - for (Enumeration e = columnModel2.getColumns (); e.hasMoreElements (); ) { - TableColumn column = (TableColumn) e.nextElement (); - columnModel.addColumn (column); - } - } - - sizeColumns (); - } - } - - } - - - -/** -Implements the VActionContext interface. -**/ - private class VActionContext_ - implements VActionContext, Serializable - { - public boolean getConfirm () - { - return confirm_; - } - - public Frame getFrame () - { - return VUtilities.getFrame (AS400DetailsPane.this); - } - - public CellEditor startEditing (VObject object, Object propertyIdentifier) - { - // Validate the parameters. - if (object == null) - throw new NullPointerException ("object"); - if (propertyIdentifier == null) - throw new NullPointerException ("propertyIdentifier"); - - if (allowActions_ == false) - return null; - - int rowIndex = model_.getRoot ().getDetailsIndex (object); - if (rowIndex < 0) - return null; - - TableColumn column = null; - try { - column = table_.getColumn (propertyIdentifier); - } - catch (IllegalArgumentException e) { - // The property is not valid. - return null; - } - - // Edit. - int columnIndex = column.getModelIndex (); - table_.editCellAt (rowIndex, columnIndex); - return column.getCellEditor(); - } - }; - - - -/** -Implements the VPane interface. -**/ - private class VPane_ - implements VPane, Serializable - { - - public VNode getRoot () - { - return AS400DetailsPane.this.getRoot (); - } - - public VObject getObjectAt (Point point) - { - VObject object = null; - int row = table_.rowAtPoint (point); - if (row != -1) - object = model_.getObjectAt (row); - return object; - } - - public void setRoot (VNode root) - throws PropertyVetoException - { - AS400DetailsPane.this.setRoot (root); - } - }; - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsPane16.gif b/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsPane16.gif deleted file mode 100644 index 4a82964bc..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsPane16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsPane32.gif b/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsPane32.gif deleted file mode 100644 index c3a9e1110..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsPane32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsPaneBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsPaneBeanInfo.java deleted file mode 100644 index 6f053d65e..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400DetailsPaneBeanInfo.java +++ /dev/null @@ -1,216 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400DetailsPaneBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.event.ListSelectionListener; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The AS400DetailsPaneBeanInfo class provides bean information -for the AS400DetailsPane class. - -@see AS400DetailsPane -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ - - -public class AS400DetailsPaneBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = AS400DetailsPane.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor listSelection = new EventSetDescriptor (beanClass_, - "listSelection", ListSelectionListener.class, "valueChanged"); - listSelection.setDisplayName (ResourceLoader.getText ("EVT_NAME_LIST_SELECTION")); - listSelection.setShortDescription (ResourceLoader.getText ("EVT_DESC_LIST_SELECTION")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - events_ = new EventSetDescriptor[] { error, listSelection, propertyChange, - vetoableChange }; - - // Properties. - PropertyDescriptor allowActions = new PropertyDescriptor ("allowActions", beanClass_); - allowActions.setBound (false); - allowActions.setConstrained (false); - allowActions.setDisplayName (ResourceLoader.getText ("PROP_NAME_ALLOW_ACTIONS")); - allowActions.setShortDescription (ResourceLoader.getText ("PROP_DESC_ALLOW_ACTIONS")); - - PropertyDescriptor columnModel = new PropertyDescriptor ("columnModel", beanClass_, - "getColumnModel", null); - columnModel.setBound (false); - columnModel.setConstrained (false); - columnModel.setDisplayName (ResourceLoader.getText ("PROP_NAME_COLUMN_MODEL")); - columnModel.setShortDescription (ResourceLoader.getText ("PROP_DESC_COLUMN_MODEL")); - - PropertyDescriptor confirm = new PropertyDescriptor ("confirm", beanClass_); - confirm.setBound (false); - confirm.setConstrained (false); - confirm.setDisplayName (ResourceLoader.getText ("PROP_NAME_CONFIRM")); - confirm.setShortDescription (ResourceLoader.getText ("PROP_DESC_CONFIRM")); - - PropertyDescriptor model = new PropertyDescriptor ("model", beanClass_, - "getModel", null); - model.setBound (false); - model.setConstrained (false); - model.setDisplayName (ResourceLoader.getText ("PROP_NAME_MODEL")); - model.setShortDescription (ResourceLoader.getText ("PROP_DESC_MODEL")); - - PropertyDescriptor root = new PropertyDescriptor ("root", beanClass_); - root.setBound (true); - root.setConstrained (true); - root.setDisplayName (ResourceLoader.getText ("PROP_NAME_ROOT")); - root.setShortDescription (ResourceLoader.getText ("PROP_DESC_ROOT")); - - PropertyDescriptor selectionModel = new PropertyDescriptor ("selectionModel", beanClass_); - selectionModel.setBound (false); - selectionModel.setConstrained (false); - selectionModel.setDisplayName (ResourceLoader.getText ("PROP_NAME_SELECTION_MODEL")); - selectionModel.setShortDescription (ResourceLoader.getText ("PROP_DESC_SELECTION_MODEL")); - - properties_ = new PropertyDescriptor[] { allowActions, columnModel, - confirm, model, root, selectionModel }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 4; // root. - } - - - -/** - Returns the descriptors for all events. - @return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("AS400DetailsPane16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("AS400DetailsPane32.gif"); - break; - } - return image; - } - - - -/** - Returns the descriptors for all properties. - @return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400ExplorerPane.java b/cvsroot/src/com/ibm/as400/vaccess/AS400ExplorerPane.java deleted file mode 100644 index 15879fe45..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400ExplorerPane.java +++ /dev/null @@ -1,793 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400ExplorerPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import javax.swing.CellEditor; -import javax.swing.JComponent; -import javax.swing.JSplitPane; -import javax.swing.JTree; -import javax.swing.JViewport; -import javax.swing.ListSelectionModel; -import javax.swing.event.ListSelectionListener; -import javax.swing.event.TableModelListener; -import javax.swing.event.TreeExpansionEvent; -import javax.swing.event.TreeExpansionListener; -import javax.swing.event.TreeModelListener; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.table.TableColumnModel; -import javax.swing.table.TableModel; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreePath; -import javax.swing.tree.TreeSelectionModel; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Point; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.Serializable; - - - -/** -The AS400ExplorerPane class represents a graphical user interface -that is useful for working with the hierarchy of objects rooted -at a system resource. The graphical user interface presents a -tree on the left side and the details of the selected resource -in the right side. You must explicitly call load() to load the -information from the system. - -

    AS400ExplorerPane objects generate the following events: -

      -
    • ErrorEvent -
    • ListSelectionEvent -
    • PropertyChangeEvent -
    • TreeSelectionEvent -
    - -

    The following example creates an explorer pane filled with -the contents of a directory in the integrated file system -of a system. - -

    -// Set up the explorer pane.
    -AS400 system = new AS400 ("MySystem", "Userid", "Password");
    -VIFSDirectory directory = new VIFSDirectory (system, "/myDirectory");
    -AS400ExplorerPane explorerPane = new AS400ExplorerPane (directory);
    -explorerPane.load ();
    -
    - -// Add the explorer pane to a frame. -JFrame frame = new JFrame ("My Window"); -frame.getContentPane().add (explorerPane); -
    - -@see AS400DetailsPane -@see AS400TreePane -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -// -// Implementation notes: -// -// 1, Object selection works as follows: -// -// * Only one object may be selected in the tree. This -// will update the details view. -// * Multiple objects may be selected in the details view. -// * The current selection is considered to be those in -// the details view, unless there are none, in which case -// it is the object selected in the tree. -// -public class AS400ExplorerPane -extends JComponent -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Properties. - AS400DetailsPane detailsPane_ = null; // Private. - AS400TreePane treePane_ = null; // Private. - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private ListSelectionEventSupport listSelectionEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private TreeSelectionEventSupport treeSelectionEventSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - - - -/** -Constructs an AS400ExplorerPane object. -**/ - public AS400ExplorerPane () - { - // Initialize the tree pane. - treePane_ = new AS400TreePane (); - - // Initialize the details pane. - detailsPane_ = new AS400DetailsPane (); - - // Set the contained panes minimum size to 0, 0. This is - // because JSplitPane will not make a component resize to - // smaller than its minimum size. This allows the user - // to move the divider anywhere, allowing one pane to - // resize to nothing. - treePane_.setMinimumSize (new Dimension (0, 0)); - detailsPane_.setMinimumSize (new Dimension (0, 0)); - - // Layout the pane. - setLayout (new BorderLayout ()); - JSplitPane splitPane = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT, - false, treePane_, detailsPane_); - splitPane.setOneTouchExpandable (true); - - add ("Center", splitPane); - - initializeTransient (); - } - - - -/** -Constructs an AS400ExplorerPane object. - -@param root The root, or the system resource, from which all information for the model is gathered. -**/ - public AS400ExplorerPane (VNode root) - { - this (); - - if (root == null) - throw new NullPointerException ("root"); - - // Set the root object in the tree and select it. Selecting - // it will automatically set it in the details. - try { - treePane_.setRoot (root); - } - catch (PropertyVetoException e) { - // Ignore. - } - - TreePath rootTreePath = treePane_.getPath (treePane_.getRoot ()); - TreeSelectionModel treeSelectionModel = treePane_.getSelectionModel (); - treeSelectionModel.clearSelection (); - treeSelectionModel.setSelectionPath (rootTreePath); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when a list selection occurs in the details pane. - -@param listener The listener. -**/ - public void addListSelectionListener (ListSelectionListener listener) - { - listSelectionEventSupport_.addListSelectionListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - super.addPropertyChangeListener (listener); - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a listener to be notified when a tree selection occurs. - -@param listener The listener. -**/ - public void addTreeSelectionListener (TreeSelectionListener listener) - { - treeSelectionEventSupport_.addTreeSelectionListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - super.addVetoableChangeListener (listener); - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - -/** -Collapses the specified object in the tree. - -@param object The object in the tree. -**/ - public void collapse (VNode object) - { - treePane_.collapse (object); - } - - - -/** -Expands the specified object in the tree. - -@param object The object in the tree. -**/ - public void expand (VNode object) - { - treePane_.expand (object); - } - - - -/** -Returns the context in which actions will be performed. - -@return The action context. -**/ - public VActionContext getActionContext () - { - // If an object is selected in the details, then - // the action will be performed there, otherwise - // it will be performed in the tree. - if (detailsPane_.getSelectedObject () != null) - return detailsPane_.getActionContext (); - else - return treePane_.getActionContext (); - } - - - -/** -Indicates if actions can be invoked on objects. - -@return true if a actions can be invoked; false otherwise. -**/ - public boolean getAllowActions () - { - return detailsPane_.getAllowActions (); - } - - - -/** -Indicates if certain actions are confirmed with the user. - -@return true if certain actions are confirmed with the user; - false otherwise. -**/ - public boolean getConfirm () - { - return treePane_.getConfirm (); - } - - - -/** -Returns the column model that is used to maintain the columns -of the details. This provides the ability to programmatically -add and remove columns. - -@return The column model. -**/ - public TableColumnModel getDetailsColumnModel () - { - return detailsPane_.getColumnModel (); - } - - - -/** -Returns the details model. - -@return The details model. -**/ - public TableModel getDetailsModel () - { - return detailsPane_.getModel (); - } - - - -/** -Returns the root of the details pane. - -@return The root the details pane, or null - if there is none. -**/ - public VNode getDetailsRoot () - { - // This is the same as the current selection - // in the tree pane. - return treePane_.getSelectedObject (); - } - - - -/** -Returns the selection model that is used to maintain -selection state in the details. This provides the ability -to programmatically select and deselect objects. - -@return The selection model, or null if selections are - not allowed. -**/ - public ListSelectionModel getDetailsSelectionModel () - { - return detailsPane_.getSelectionModel (); - } - - - -/** -Returns the path from the root to get to this object in the tree -hierarchy. The last element in the path will be this object. - -@param object The object. -@return The path, or null if the object is not a valid - object. -**/ - public TreePath getPath (VNode object) - { - return treePane_.getPath (object); - } - - - -/** -Returns the root, or the system resource, from which all information for the model is gathered. - -@return The root, or the system resource, from which all information for the model is gathered. It will be null if none has been set. -**/ - public VNode getRoot () - { - return treePane_.getRoot (); - } - - - -/** -Returns the first selected object. This is the first selected -object in the details pane. If no objects are selected in -the details pane, then this is the object selected in the -tree pane. - -@return The first selected object, or null if none are - selected. -**/ - public VObject getSelectedObject () - { - VObject selectedObject = detailsPane_.getSelectedObject (); - if (selectedObject == null) - selectedObject = treePane_.getSelectedObject (); - return selectedObject; - } - - - -/** -Returns the selected objects. These are the selected -objects in the details pane. If no objects are selected in -the details pane, then this is the object selected in the -tree pane. - -@return The selected objects. -**/ - public VObject[] getSelectedObjects () - { - VObject[] selectedObjects = detailsPane_.getSelectedObjects (); - if (selectedObjects.length == 0) - selectedObjects = treePane_.getSelectedObjects (); - return selectedObjects; - } - - - -/** -Returns the tree model. - -@return The tree model. -**/ - public TreeModel getTreeModel () - { - return treePane_.getModel (); - } - - - -/** -Returns the selection model that is used to maintain -selection state in the tree. This provides the ability to -programmatically select and deselect objects. - -@return The selection model, or null if selections are not - allowed. -**/ - public TreeSelectionModel getTreeSelectionModel () - { - return treePane_.getSelectionModel (); - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - listSelectionEventSupport_ = new ListSelectionEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - treeSelectionEventSupport_ = new TreeSelectionEventSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - - treePane_.addErrorListener (errorEventSupport_); - treePane_.addPropertyChangeListener (propertyChangeSupport_); - treePane_.addTreeSelectionListener (treeSelectionEventSupport_); - treePane_.addVetoableChangeListener (vetoableChangeSupport_); - - // @A2D Do not listen to the details pane, since all - // relevant error events bubble up through the tree - // pane. - // @A2D detailsPane_.addErrorListener (errorEventSupport_); - detailsPane_.addListSelectionListener (listSelectionEventSupport_); - detailsPane_.addPropertyChangeListener (propertyChangeSupport_); - detailsPane_.addVetoableChangeListener (vetoableChangeSupport_); - - // Initialize the other adapters. - treePane_.addTreeSelectionListener (new TreeSelectionListener_ ()); - detailsPane_.addPropertyChangeListener (new PropertyChangeListener_ ()); - } - - - -/** -Indicates if the object in the tree is currently collapsed. - -@param object The object in the tree. -@return true if the object is collapsed; false otherwise. -**/ - public boolean isCollapsed (VNode object) - { - return treePane_.isCollapsed (object); - } - - - -/** -Indicates if the object in the tree is currently expanded. - -@param object The object in the tree. -@return true if the object is expanded; false otherwise. -**/ - public boolean isExpanded (VNode object) - { - return treePane_.isExpanded (object); - } - - - -/** -Indicates if the object in the tree or the details is selected. - -@param object The object in the tree or the details. -@return true if the object is selected, false otherwise. -**/ - public boolean isSelected (VObject object) - { - if (object == null) - throw new NullPointerException ("object"); - - VObject[] selectedObjects = getSelectedObjects (); - for (int i = 0; i < selectedObjects.length; ++i) - if (selectedObjects[i] == object) - return true; - return false; - } - - - -/** -Indicates if the object in the tree is currently visible in the tree. - -@param object The object in the tree. -@return true if the object is visible; false otherwise. -**/ - public boolean isVisible (VNode object) - { - return treePane_.isVisible (object); - } - - - -/** -Loads the objects from the system. -**/ - public void load () - { - treePane_.load (); - if (treePane_.getRoot() != detailsPane_.getRoot ()) - detailsPane_.load (); - } - - - -/** -Makes the object visible in the tree by expanding its -parent objects as needed. - -@param object The object. -**/ - public void makeVisible (VNode object) - { - treePane_.makeVisible (object); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a list selection listener. - -@param listener The listener. -**/ - public void removeListSelectionListener (ListSelectionListener listener) - { - listSelectionEventSupport_.removeListSelectionListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - super.removePropertyChangeListener (listener); - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a tree selection listener. - -@param listener The listener. -**/ - public void removeTreeSelectionListener (TreeSelectionListener listener) - { - treeSelectionEventSupport_.removeTreeSelectionListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener (VetoableChangeListener listener) - { - super.removeVetoableChangeListener (listener); - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** -Sets whether actions are allowed. The following are enabled only when -actions are allowed: - -
      -
    • popup menu on selected object in the tree and details -
    • double clicking on a object sets the root object in the details -
    - -

    The default is true. - -@param allowActions true if actions are allowed; false otherwise. -**/ - public void setAllowActions (boolean allowActions) - { - treePane_.setAllowActions (allowActions); - detailsPane_.setAllowActions (allowActions); - } - - - -/** -Sets whether certain actions are confirmed with the user. The default -is true. - -@param confirm true if certain actions are confirmed with the - user; false otherwise. -**/ - public void setConfirm (boolean confirm) - { - treePane_.setConfirm (confirm); - detailsPane_.setConfirm (confirm); - } - - - -/** -Sets the selection model that is used to maintain selection -state in the details. This provides the ability to -programmatically select and deselect objects. - -@param selectionModel The selection model, or null if - selections are not allowed. -**/ - public void setDetailsSelectionModel (ListSelectionModel selectionModel) - { - detailsPane_.setSelectionModel (selectionModel); - } - - - -/** -Sets the root, or the system resource, from which all information for the model is gathered. It will not take effect until load() is done. - -@param root The root, or the system resource, from which all information for the model is gathered. - -@exception PropertyVetoException It the change is vetoed. -**/ - public void setRoot (VNode root) - throws PropertyVetoException - { - if (root == null) - throw new NullPointerException ("root"); - - treePane_.setRoot (root); - } - - - -/** -Sets the selection model that is used to maintain selection -state in the tree. This provides the ability to programmatically -select and deselect objects. - -@param selectionModel The selection model, or null if - selections are not allowed. -**/ - public void setTreeSelectionModel (TreeSelectionModel selectionModel) - { - treePane_.setSelectionModel (selectionModel); - } - - - -/** -Sorts the contents. The propertyIdentifer[0], orders[0] combination is used to do the sort. If the values are equal, propertyIdentifier[1], orders[1] is used to break the tie, and so forth. - -@param propertyIdentifiers The property identifiers. If any of - the property identifiers are null, it - means to sort using the string - representation of the object. -@param orders The sort orders for each property - identifier, true for ascending order, - false for descending order. -**/ - public void sort (Object[] propertyIdentifiers, boolean[] orders) - { - detailsPane_.sort (propertyIdentifiers, orders); - } - - - -/** -The PropertyChangeListener_ class listens to the details pane -for changes in its object. When this happens it will set the -selection in the tree pane accordingly. -**/ - private class PropertyChangeListener_ - implements PropertyChangeListener - { - public void propertyChange (PropertyChangeEvent event) - { - if ((event.getSource () == detailsPane_) - && (event.getPropertyName () == "root")) { - - VNode object = detailsPane_.getRoot (); - treePane_.makeVisible (object); - treePane_.getSelectionModel ().setSelectionPath (treePane_.getPath (object)); - } - } - } - - -/** -The TreeSelectionListener_ class listens to the tree pane for -selections. When this happens it will set the contents of the -details pane. -**/ - private class TreeSelectionListener_ - implements TreeSelectionListener - { - public void valueChanged (TreeSelectionEvent event) - { - VNode object = (VNode) event.getPath ().getLastPathComponent (); - - // Select the object in the details pane. - try { - detailsPane_.setRoot (object); - - // @A1D When this load happens, the tree was not being - // updated, so the tree sometimes listed the children - // in a different order than the details. (To - // reproduce, create a new child on the tree side, - // then click on the parent.) By not loading, - // the tree and details are always consistent, and - // I have not found any side effects. - // - // @A1D detailsPane_.load (); - } - catch (PropertyVetoException e) { - // Ignore. - } - } - - } - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400ExplorerPane16.gif b/cvsroot/src/com/ibm/as400/vaccess/AS400ExplorerPane16.gif deleted file mode 100644 index d7a16774b..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/AS400ExplorerPane16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400ExplorerPane32.gif b/cvsroot/src/com/ibm/as400/vaccess/AS400ExplorerPane32.gif deleted file mode 100644 index b8a3924da..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/AS400ExplorerPane32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400ExplorerPaneBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/AS400ExplorerPaneBeanInfo.java deleted file mode 100644 index 28e316bb2..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400ExplorerPaneBeanInfo.java +++ /dev/null @@ -1,243 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400ExplorerPaneBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.event.ListSelectionListener; -import javax.swing.event.TreeSelectionListener; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The AS400ExplorerPaneBeanInfo class provides bean information -for the AS400ExplorerPane class. - -@see AS400ExplorerPane -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ - - -public class AS400ExplorerPaneBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = AS400ExplorerPane.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor listSelection = new EventSetDescriptor (beanClass_, - "listSelection", ListSelectionListener.class, "valueChanged"); - listSelection.setDisplayName (ResourceLoader.getText ("EVT_NAME_LIST_SELECTION")); - listSelection.setShortDescription (ResourceLoader.getText ("EVT_DESC_LIST_SELECTION")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor treeSelection = new EventSetDescriptor (beanClass_, - "treeSelection", TreeSelectionListener.class, "valueChanged"); - treeSelection.setDisplayName (ResourceLoader.getText ("EVT_NAME_TREE_SELECTION")); - treeSelection.setShortDescription (ResourceLoader.getText ("EVT_DESC_TREE_SELECTION")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - events_ = new EventSetDescriptor[] { error, listSelection, propertyChange, - treeSelection, vetoableChange }; - - // Properties. - PropertyDescriptor allowActions = new PropertyDescriptor ("allowActions", beanClass_); - allowActions.setBound (false); - allowActions.setConstrained (false); - allowActions.setDisplayName (ResourceLoader.getText ("PROP_NAME_ALLOW_ACTIONS")); - allowActions.setShortDescription (ResourceLoader.getText ("PROP_DESC_ALLOW_ACTIONS")); - - PropertyDescriptor confirm = new PropertyDescriptor ("confirm", beanClass_); - confirm.setBound (false); - confirm.setConstrained (false); - confirm.setDisplayName (ResourceLoader.getText ("PROP_NAME_CONFIRM")); - confirm.setShortDescription (ResourceLoader.getText ("PROP_DESC_CONFIRM")); - - PropertyDescriptor detailsColumnModel = new PropertyDescriptor ("detailsColumnModel", beanClass_, - "getDetailsColumnModel", null); - detailsColumnModel.setBound (false); - detailsColumnModel.setConstrained (false); - detailsColumnModel.setDisplayName (ResourceLoader.getText ("PROP_NAME_COLUMN_MODEL")); - detailsColumnModel.setShortDescription (ResourceLoader.getText ("PROP_DESC_COLUMN_MODEL")); - - PropertyDescriptor detailsModel = new PropertyDescriptor ("detailsModel", beanClass_, - "getDetailsModel", null); - detailsModel.setBound (false); - detailsModel.setConstrained (false); - detailsModel.setDisplayName (ResourceLoader.getText ("PROP_NAME_MODEL")); - detailsModel.setShortDescription (ResourceLoader.getText ("PROP_DESC_MODEL")); - - PropertyDescriptor detailsRoot = new PropertyDescriptor ("detailsRoot", beanClass_, - "getDetailsRoot", null); - detailsRoot.setBound (true); - detailsRoot.setConstrained (true); - detailsRoot.setDisplayName (ResourceLoader.getText ("PROP_NAME_ROOT")); - detailsRoot.setShortDescription (ResourceLoader.getText ("PROP_DESC_ROOT")); - - PropertyDescriptor detailsSelectionModel = new PropertyDescriptor ("detailsSelectionModel", beanClass_); - detailsSelectionModel.setBound (false); - detailsSelectionModel.setConstrained (false); - detailsSelectionModel.setDisplayName (ResourceLoader.getText ("PROP_NAME_SELECTION_MODEL")); - detailsSelectionModel.setShortDescription (ResourceLoader.getText ("PROP_DESC_SELECTION_MODEL")); - - PropertyDescriptor root = new PropertyDescriptor ("root", beanClass_); - root.setBound (true); - root.setConstrained (true); - root.setDisplayName (ResourceLoader.getText ("PROP_NAME_ROOT")); - root.setShortDescription (ResourceLoader.getText ("PROP_DESC_ROOT")); - - PropertyDescriptor treeModel = new PropertyDescriptor ("treeModel", beanClass_, - "getTreeModel", null); - treeModel.setBound (false); - treeModel.setConstrained (false); - treeModel.setDisplayName (ResourceLoader.getText ("PROP_NAME_MODEL")); - treeModel.setShortDescription (ResourceLoader.getText ("PROP_DESC_MODEL")); - - PropertyDescriptor treeSelectionModel = new PropertyDescriptor ("treeSelectionModel", beanClass_); - treeSelectionModel.setBound (false); - treeSelectionModel.setConstrained (false); - treeSelectionModel.setDisplayName (ResourceLoader.getText ("PROP_NAME_SELECTION_MODEL")); - treeSelectionModel.setShortDescription (ResourceLoader.getText ("PROP_DESC_SELECTION_MODEL")); - - properties_ = new PropertyDescriptor[] { allowActions, confirm, - detailsColumnModel, detailsModel, detailsRoot, - detailsSelectionModel, root, treeModel, treeSelectionModel }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 6; // root. - } - - - -/** - Returns the descriptors for all events. - @return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("AS400ExplorerPane16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("AS400ExplorerPane32.gif"); - break; - } - return image; - } - - - -/** - Returns the descriptors for all properties. - @return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePane.java b/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePane.java deleted file mode 100644 index 5bcb0306e..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePane.java +++ /dev/null @@ -1,1440 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: AS400JDBCDataSourcePane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -// 10/20/2010: Moved from "include" to "src" -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import javax.swing.JComponent; -import javax.swing.*; -import javax.swing.JLabel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.text.JTextComponent; -import javax.swing.ListSelectionModel; -import javax.swing.SwingConstants; -import javax.swing.SwingUtilities; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ListSelectionListener; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.TableColumn; -import javax.swing.table.TableColumnModel; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.event.*; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.IOException; -import java.io.Serializable; -import java.sql.SQLWarning; -import java.sql.Types; -import java.util.Enumeration; -import java.util.Vector; - -import com.ibm.as400.access.AS400JDBCDataSource; -import com.ibm.as400.ui.framework.java.*; // Panel Manager -import com.ibm.as400.ui.framework.ResourceLoader; -import javax.swing.*; -import java.awt.*; -import com.ibm.as400.vaccess.*; - -/** - * The AS400JDBCDataSourcePane class represents a set of tabs that contain - * property values for a JDBC data source. Changes made to the pane are - * applied to the data source when applyChanges() is called. - * - *

    For example: - *

    - * import com.ibm.as400.access.*;                       
    - * import com.ibm.as400.vaccess.*;                       
    - * import javax.swing.*;
    - * import java.awt.*;
    - * import java.awt.event.*;
    - * 
    - * public class DataSourceGUIExample
    - * {                                              
    - *    static AS400JDBCDataSourcePane dataSourcePane = null;
    - *    static AS400JDBCDataSource     myDataSource   = null;
    - *    
    - *    public static void main(String[] args)
    - *    {
    - *       // Like other Java classes the Toolbox classes throw 
    - *       // exceptions when something goes wrong.  These must be 
    - *       // caught by programs that use the Toolbox.
    - *       try                                           
    - *       {
    - *       
    - *          // Create a data source.
    - *          myDataSource = new AS400JDBCDataSource();
    - * 
    - *          // Create a window to hold the pane and an OK button.
    - *          JFrame frame = new JFrame ("JDBC Data Source Properties");
    - * 
    - *          // Create a data source pane.
    - *          dataSourcePane = new AS400JDBCDataSourcePane(myDataSource);
    - * 
    - *          // Create an OK button
    - *          JButton okButton = new JButton("OK");
    - * 
    - *          // Add an ActionListener to the OK button.  When OK is 
    - *          // pressed, applyChanges() will be called to commit any
    - *          // changes to the data source.
    - *          okButton.addActionListener(new ActionListener()
    - *             {    
    - *                public void actionPerformed(ActionEvent ev)
    - *                {
    - *                   // Copy all changes made on the data source pane
    - *                   // to the data source.  
    - *                   if (dataSourcePane.applyChanges())
    - *                   {
    - *                      System.out.println("ok pressed");
    - *                      myDataSource = dataSourcePane.getDataSource();
    - *                      System.out.println(myDataSource.getServerName());
    - *                   }   
    - *                }
    - *             }
    - *          );
    - *        
    - *          // Setup the frame to show the pane and OK button.
    - *          frame.getContentPane ().setLayout (new BorderLayout ());
    - *          frame.getContentPane ().add ("Center", dataSourcePane);
    - *          frame.getContentPane ().add ("South", okButton);
    - *        
    - *          // Pack the frame.
    - *          frame.pack ();
    - *        
    - *          //Display the pane and OK button.
    - *          frame.show ();
    - *       }
    - *       catch (Exception e)
    - *       {
    - *          e.printStackTrace();
    - *       }   
    - *    }   
    - * }       
    - * 
    - * 
    - * @deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ - -public class AS400JDBCDataSourcePane -extends JComponent -implements Serializable -{ - -private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - -// The data source being displayed -private AS400JDBCDataSource m_currentDataSource; -// The databean being used by the GUI -private AS400JDBCDataSourcePaneDataBean m_dataBean; -// Our instance of tabbed pane manager -private TabbedPaneManager m_tabbedPaneManager = null; -// Indicates that we are just creating the tabs -private boolean m_justBeingCreated = true; -// Frequently through out the code we need the pane -// manager for a particular tab. They are declared -// here and set as soon as we have an instance of a -// tabbed pane manager. -private PanelManager m_generalPaneManager = null; -private PanelManager m_serverPaneManager = null; -private PanelManager m_packagePaneManager = null; -private PanelManager m_performancePaneManager = null; -private PanelManager m_languagePaneManager = null; -private PanelManager m_otherPaneManager = null; -private PanelManager m_translationPaneManager = null; -private PanelManager m_formatPaneManager = null; -private PanelManager m_connoptPaneManager = null; - -/** The index of the General tab. */ -public static final int TAB_GENERAL = 0; -/** The index of the Server tab. */ -public static final int TAB_SERVER = 1; -/** The index of the Package tab. */ -public static final int TAB_PACKAGE = 2; -/** The index of the Performance tab. */ -public static final int TAB_PERFORMANCE = 3; -/** The index of the Language tab. */ -public static final int TAB_LANGUAGE = 4; -/** The index of the Other tab. */ -public static final int TAB_OTHER = 5; -/** The index of the Translation tab. */ -public static final int TAB_TRANSLATION = 6; -/** The index of the Format tab. */ -public static final int TAB_FORMAT = 7; -/** The index of the Connection Options tab. */ -public static final int TAB_CONNECTIONOPTIONS = 8; - -private transient PropertyChangeSupport propertyChangeSupport_ = new PropertyChangeSupport(this); - -static ResourceLoader resource_Loader = new ResourceLoader(); -static -{ - // Load the resource bundle for this package - resource_Loader.setResourceName("com.ibm.as400.vaccess.AS400JDBCDataSourcePaneGUI"); -} - - -/** -Constructs an AS400JDBCDataSourcePane object. A default data source will be displayed. -**/ -public AS400JDBCDataSourcePane() -{ - super(); - - // Since no data source was passed in we need to create one - AS400JDBCDataSource defaultDataSource = new AS400JDBCDataSource(); - - createPaneAndSetDataSource(defaultDataSource); -} - - -/** -Constructs an AS400JDBCDataSourcePane object. - -@param dataSource The JDBC data source to display. -**/ -public AS400JDBCDataSourcePane (AS400JDBCDataSource dataSource) -{ - super(); - - createPaneAndSetDataSource(dataSource); -} - -private void createPaneAndSetDataSource(AS400JDBCDataSource dataSource) -{ - // Instantiate the object which supplies data to the panel. Note that - // this must be done before the call to setDataSource. - m_dataBean = new AS400JDBCDataSourcePaneDataBean(); - - // Load default values and combo box choices in the GUI databean - m_dataBean.load(); - - // Set up to pass the objects to the UI framework - DataBean[] dataBeans = {m_dataBean}; - JFrame frame = new JFrame(); - Container container = frame.getContentPane(); - - try - { - m_tabbedPaneManager = new TabbedPaneManager("com.ibm.as400.vaccess.AS400JDBCDataSourcePaneGUI", - "AJDSP_TABBEDPANE", - dataBeans, - container); - } - catch (DisplayManagerException e) { - e.displayUserMessage(null); - return; - } - - // Set the "PaneManager" variables. These are used through out this program. - m_generalPaneManager = (PanelManager)m_tabbedPaneManager.getDelegateManager("AJDSP_GENERAL"); - m_serverPaneManager = (PanelManager)m_tabbedPaneManager.getDelegateManager("AJDSP_SERVER"); - m_packagePaneManager = (PanelManager)m_tabbedPaneManager.getDelegateManager("AJDSP_PACKAGE"); - m_performancePaneManager = (PanelManager)m_tabbedPaneManager.getDelegateManager("AJDSP_PERFORMANCE"); - m_languagePaneManager = (PanelManager)m_tabbedPaneManager.getDelegateManager("AJDSP_LANGUAGE"); - m_otherPaneManager = (PanelManager)m_tabbedPaneManager.getDelegateManager("AJDSP_OTHER"); - m_translationPaneManager = (PanelManager)m_tabbedPaneManager.getDelegateManager("AJDSP_TRANSLATION"); - m_formatPaneManager = (PanelManager)m_tabbedPaneManager.getDelegateManager("AJDSP_FORMAT"); - m_connoptPaneManager = (PanelManager)m_tabbedPaneManager.getDelegateManager("AJDSP_CONNOPT"); - - - // Most GUI behavior is handled by the GUI builder. Situations that the - // GUI builder can't handled are controlled by the following method. - - enableListenersForComponentsWeCareAbout(); - - // set the current values from the data source into the pane. - setDataSource(dataSource); - - // Build the GUI - setLayout(new BorderLayout()); - add("Center",container); - - m_justBeingCreated = false; - - // The following stmts are a workaround for a PDML regression where controls are not being - // initialized as disabled //@A5A - m_packagePaneManager.getComponent("AJDSP_PACKAGE_TEXTBOX").setEnabled(false); //@A5A - m_packagePaneManager.getComponent("AJDSP_PACKAGELIB_TEXTBOX").setEnabled(false); //@A5A - m_packagePaneManager.getComponent("AJDSP_USE_RADIOBUTTON").setEnabled(false); //@A5A - m_packagePaneManager.getComponent("AJDSP_USEADD_RADIOBUTTON").setEnabled(false); //@A5A - m_packagePaneManager.getComponent("AJDSP_SEND_EXCEP_RADIOBUTTON").setEnabled(false); //@A5A - m_packagePaneManager.getComponent("AJDSP_POST_WARN_RADIOBUTTON").setEnabled(false); //@A5A - m_packagePaneManager.getComponent("AJDSP_IGNORE_RADIOBUTTON").setEnabled(false); //@A5A - m_packagePaneManager.getComponent("AJDSP_CACHE_PACKAGE_CHECKBOX").setEnabled(false); //@A5A - - m_languagePaneManager.getComponent("AJDSP_SORTTABLE_TEXTBOX").setEnabled(false); //@A5A - m_languagePaneManager.getComponent("AJDSP_SHAREDWEIGHT_RADIOBUTTON").setEnabled(false); //@A5A - m_languagePaneManager.getComponent("AJDSP_UNIQUEWEIGHT_RADIOBUTTON").setEnabled(false); //@A5A - m_languagePaneManager.getComponent("AJDSP_LANGUAGE_COMBOBOX").setEnabled(false); //@A5A -} - -private void enableListenersForComponentsWeCareAbout() -{ - // The GUI builder/PDML handles most field validation and enabling/disabling for us. For example, the GUI - // builder knows to enable/disable the fields on the Package tab when the user checks or unchecks the - // extended dynamic check box. The GUI builder also knows to require a package and package library when - // the components are enabled. - // This routine is used to set up action listeners for situations that the GUI builder can't automatically - // handle. Currently, the only one is enabling/disabling components on the Language tab when the user - // switches between the various sort types. - - JComboBox sortTypeCB = (JComboBox)((m_languagePaneManager).getComponent("AJDSP_SORTTYPE_COMBOBOX")); - sortTypeCB.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent ev) - { - enableComponentsBasedOnSortType(ev); - } - }); -} - -private void enableComponentsBasedOnSortType(ActionEvent ev) -{ - // This method gets control whenever the sort type is changed. This method looks at the new sort type - // and enables/disables components on the Language tab. - - // Get the sort type combo box - JComboBox sortTypeCB = (JComboBox)((m_languagePaneManager).getComponent("AJDSP_SORTTYPE_COMBOBOX")); - // Get the current choice. - ChoiceDescriptor sortTypeNewValue = (ChoiceDescriptor)sortTypeCB.getSelectedItem(); - - // When we invoke languagePaneManager.loadData() in the setDataSource method the framework actually - // clears the combo box and starts over... then this happens we end up here with an empty list - // which means there is no selected text. The following "if" keeps us from choking on a - // NullPointerException. - if (sortTypeNewValue == null) - return; - - // Get the title associated with the choice - String sortTypeNewValueText = sortTypeNewValue.getTitle(); - // Based on the choice title, enable/disable the appropriate controls - if (sortTypeNewValueText.equals(resource_Loader.getString("AJDSP_SORTHEX")) || - sortTypeNewValueText.equals(resource_Loader.getString("AJDSP_SORTJOB"))) - { - (m_languagePaneManager).getComponent("AJDSP_SORTTABLE_LABEL").setEnabled(false); - (m_languagePaneManager).getComponent("AJDSP_SORTTABLE_TEXTBOX").setEnabled(false); - (m_languagePaneManager).getComponent("AJDSP_SORTWEIGHT_LABEL").setEnabled(false); - (m_languagePaneManager).getComponent("AJDSP_SHAREDWEIGHT_RADIOBUTTON").setEnabled(false); - (m_languagePaneManager).getComponent("AJDSP_UNIQUEWEIGHT_RADIOBUTTON").setEnabled(false); - (m_languagePaneManager).getComponent("AJDSP_LANGUAGE_LABEL").setEnabled(false); - (m_languagePaneManager).getComponent("AJDSP_LANGUAGE_COMBOBOX").setEnabled(false); - } - else if (sortTypeNewValueText.equals(resource_Loader.getString("AJDSP_SORTLANGID"))) - { - (m_languagePaneManager).getComponent("AJDSP_SORTTABLE_LABEL").setEnabled(false); - (m_languagePaneManager).getComponent("AJDSP_SORTTABLE_TEXTBOX").setEnabled(false); - (m_languagePaneManager).getComponent("AJDSP_SORTWEIGHT_LABEL").setEnabled(true); - (m_languagePaneManager).getComponent("AJDSP_SHAREDWEIGHT_RADIOBUTTON").setEnabled(true); - (m_languagePaneManager).getComponent("AJDSP_UNIQUEWEIGHT_RADIOBUTTON").setEnabled(true); - (m_languagePaneManager).getComponent("AJDSP_LANGUAGE_LABEL").setEnabled(true); - (m_languagePaneManager).getComponent("AJDSP_LANGUAGE_COMBOBOX").setEnabled(true); - } - else if (sortTypeNewValueText.equals(resource_Loader.getString("AJDSP_SORTTABLE"))) - { - (m_languagePaneManager).getComponent("AJDSP_SORTTABLE_LABEL").setEnabled(true); - (m_languagePaneManager).getComponent("AJDSP_SORTTABLE_TEXTBOX").setEnabled(true); - (m_languagePaneManager).getComponent("AJDSP_SORTWEIGHT_LABEL").setEnabled(false); - (m_languagePaneManager).getComponent("AJDSP_SHAREDWEIGHT_RADIOBUTTON").setEnabled(false); - (m_languagePaneManager).getComponent("AJDSP_UNIQUEWEIGHT_RADIOBUTTON").setEnabled(false); - (m_languagePaneManager).getComponent("AJDSP_LANGUAGE_LABEL").setEnabled(false); - (m_languagePaneManager).getComponent("AJDSP_LANGUAGE_COMBOBOX").setEnabled(false); - } -} - -/** -Returns the data source currently being displayed. - -@return Data source for this pane. -**/ - -public AS400JDBCDataSource getDataSource() -{ - return m_currentDataSource; -} - -/** -Sets the data source to be displayed. - -@param dataSource The JDBC data source to display. -**/ - -public void setDataSource(AS400JDBCDataSource dataSource) -{ - AS400JDBCDataSource oldDataSource = m_currentDataSource; - m_currentDataSource = dataSource; - setDataSourcePreLoadData(m_currentDataSource); - - // For some reason the framework won't allow loadData to be called on the - // tabbedPaneManager more than once (actually it allows it but it won't - // call the databean gettor methods). So, the first time through we - // call loadData on the tabbedPaneManager and each time after that - // we call loadData on the individual tabs. Note that if you - // don't call loadData on the tabbedPaneManager the first time - // bad things seem to happen..... - - if (m_justBeingCreated) - { - m_tabbedPaneManager.loadData(); - } - else - { - m_generalPaneManager.loadData(); - m_serverPaneManager.loadData(); - m_packagePaneManager.loadData(); - m_performancePaneManager.loadData(); - m_languagePaneManager.loadData(); - m_otherPaneManager.loadData(); - m_translationPaneManager.loadData(); - m_formatPaneManager.loadData(); - m_connoptPaneManager.loadData(); - } - - propertyChangeSupport_.firePropertyChange("dataSource", oldDataSource, m_currentDataSource); -} - -/** -Commits the JDBC property values being displayed to the data source. - -@return true if changes were applied successfully; false otherwise. -**/ - -public boolean applyChanges() -{ - // The following try/catch block calls the applyChanges method on the tabbed pane and handles the - // IllegalUserDataExceptions that occur. An IllegalUserDataException exception is thrown when - // a rule defined by the GUI builder is broken. For instance, if a field is defined to be - // required and no value is provided the exception will be thrown. - // Assuming no exceptions are thrown, our databean will be updated with the current GUI values - // when the tabPaneManager applyChanges method returns. That is, the tabPaneManager applyChanges - // method calls all of the databean settor methods. - - try - { - m_tabbedPaneManager.applyChanges(); - } - catch (IllegalUserDataException e) - { // This will put up the error message and put focus on the offending control - Container c = (Container)e.getComponent(); - PanelManager.handleDataException(e,c); - return false; - } - - applyChangesToCurrentDataSource(m_currentDataSource); - return true; -} - -private void applyChangesToCurrentDataSource(AS400JDBCDataSource dataSource) -{ - // This method transfers the values from the databean to the data source. - - // General Tab - - dataSource.setDataSourceName(m_dataBean.getDataSourceName()); - - dataSource.setDescription(m_dataBean.getDescription()); - - dataSource.setServerName(m_dataBean.getAS400Server()); - - // Server Tab - - // The Toolbox expects the SQL library, if any, as the first entry of the libraries string. - // If there is no SQL library, the string should (and will) have a leading comma. //@A1A - String defaultLibs = m_dataBean.getDefaultLibraries().trim(); //@A1A - if (defaultLibs.length() > 0) //@A1A - dataSource.setLibraries(m_dataBean.getSQLlibrary().trim() + ", " + defaultLibs); //@A1A - else //@A1A - dataSource.setLibraries(m_dataBean.getSQLlibrary().trim()); //@A1C - - //System.out.println(">>>>>>>>>>> SQL LIB into ds: " + m_dataBean.getSQLlibrary().trim()); - //System.out.println(">>>>>>>>>>> DEFAULT LIBS into ds: " + defaultLibs); - - String scratchName = ((ChoiceDescriptor)m_dataBean.getCommitMode()).getName(); - if (scratchName.equals("AJDSP_COMMIT_NONE")) - { - dataSource.setTransactionIsolation("none"); - } - else if (scratchName.equals("AJDSP_COMMIT_CS")) - { - dataSource.setTransactionIsolation("read committed"); - } - else if (scratchName.equals("AJDSP_COMMIT_CHG")) - { - dataSource.setTransactionIsolation("read uncommitted"); - } - else if (scratchName.equals("AJDSP_COMMIT_ALL")) - { - dataSource.setTransactionIsolation("repeatable read"); - } - else if (scratchName.equals("AJDSP_COMMIT_RR")) - { - dataSource.setTransactionIsolation("serializable"); - } - - scratchName = ((ChoiceDescriptor)m_dataBean.getMaxPrecision()).getTitle(); //@A4A - if (scratchName.equals("31")) //@A4A - dataSource.setMaximumPrecision(31); //@A4A - else //@A4A - dataSource.setMaximumPrecision(63); //@A4A - - scratchName = ((ChoiceDescriptor)m_dataBean.getMaxScale()).getTitle(); //@A4A - if (scratchName.equals("0")) //@A4A - dataSource.setMaximumScale(0); //@A4A - else //@A4A - if (scratchName.equals("31")) //@A4A - dataSource.setMaximumScale(31); //@A4A - else //@A4A - dataSource.setMaximumScale(63); //@A4A - - scratchName = ((ChoiceDescriptor)m_dataBean.getMinDivideScale()).getTitle(); //@A4A - if (scratchName.equals("0")) //@A4A - dataSource.setMinimumDivideScale(0); //@A4A - else //@A4A - if (scratchName.equals("1")) //@A4A - dataSource.setMinimumDivideScale(1); //@A4A - else //@A4A - if (scratchName.equals("2")) //@A4A - dataSource.setMinimumDivideScale(2); //@A4A - else //@A4A - if (scratchName.equals("3")) //@A4A - dataSource.setMinimumDivideScale(3); //@A4A - else //@A4A - if (scratchName.equals("4")) //@A4A - dataSource.setMinimumDivideScale(4); //@A4A - else //@A4A - if (scratchName.equals("5")) //@A4A - dataSource.setMinimumDivideScale(5); //@A4A - else //@A4A - if (scratchName.equals("6")) //@A4A - dataSource.setMinimumDivideScale(6); //@A4A - else //@A4A - if (scratchName.equals("7")) //@A4A - dataSource.setMinimumDivideScale(7); //@A4A - else //@A4A - if (scratchName.equals("8")) //@A4A - dataSource.setMinimumDivideScale(8); //@A4A - else //@A4A - dataSource.setMinimumDivideScale(9); //@A4A - - // Package Tab - dataSource.setExtendedDynamic(m_dataBean.isEnableExtDynamic()); - dataSource.setPackageCriteria("select"); //@A3A - - dataSource.setPackage(m_dataBean.getPackage()); - - dataSource.setPackageLibrary(m_dataBean.getPackageLibrary()); - - if (m_dataBean.getUsageGroup().equals("AJDSP_USE_RADIOBUTTON")) - { - dataSource.setPackageAdd(false); - } - else if (m_dataBean.getUsageGroup().equals("AJDSP_USEADD_RADIOBUTTON")) - { - dataSource.setPackageAdd(true); - } - - if (m_dataBean.getUnusablePkgActionGroup().equals("AJDSP_SEND_EXCEP_RADIOBUTTON")) - { - dataSource.setPackageError("exception"); - } - else if (m_dataBean.getUnusablePkgActionGroup().equals("AJDSP_POST_WARN_RADIOBUTTON")) - { - dataSource.setPackageError("warning"); - } - else if (m_dataBean.getUnusablePkgActionGroup().equals("AJDSP_IGNORE_RADIOBUTTON")) - { - dataSource.setPackageError("none"); - } - - dataSource.setPackageCache(m_dataBean.isCachePackageLocally()); - - // Performance Tab - - dataSource.setLazyClose(m_dataBean.isEnableLazyClose()); - - dataSource.setPrefetch(m_dataBean.isEnablePrefetch()); - - dataSource.setDataCompression(m_dataBean.isEnableDataCompression()); - - scratchName = ((ChoiceDescriptor)m_dataBean.getRecordBlockingCriteria()).getName(); - if (scratchName.equals("AJDSP_RECBLK_DISABLE")) - { - dataSource.setBlockCriteria(0); - } - else if (scratchName.equals("AJDSP_RECBLK_FORFETCH")) - { - dataSource.setBlockCriteria(1); - } - else if (scratchName.equals("AJDSP_RECBLK_NOTUPDT")) - { - dataSource.setBlockCriteria(2); - } - - scratchName = ((ChoiceDescriptor)m_dataBean.getRecordBlockingSize()).getName(); - if (scratchName.equals("AJDSP_BLOCK_SIZE_0")) - { - dataSource.setBlockSize(0); - } - else if (scratchName.equals("AJDSP_BLOCK_SIZE_8")) - { - dataSource.setBlockSize(8); - } - else if (scratchName.equals("AJDSP_BLOCK_SIZE_16")) - { - dataSource.setBlockSize(16); - } - else if (scratchName.equals("AJDSP_BLOCK_SIZE_32")) - { - dataSource.setBlockSize(32); - } - else if (scratchName.equals("AJDSP_BLOCK_SIZE_64")) - { - dataSource.setBlockSize(64); - } - else if (scratchName.equals("AJDSP_BLOCK_SIZE_128")) - { - dataSource.setBlockSize(128); - } - else if (scratchName.equals("AJDSP_BLOCK_SIZE_256")) - { - dataSource.setBlockSize(256); - } - else if (scratchName.equals("AJDSP_BLOCK_SIZE_512")) - { - dataSource.setBlockSize(512); - } - - Object lobThreshInKBObject = m_dataBean.getLOBThreshold(); - // Class lobThreshInKBClass = lobThreshInKBObject.getClass(); - // if (lobThreshInKBClass.getName().equals("com.ibm.as400.ui.framework.java.ChoiceDescriptor")) - if (lobThreshInKBObject instanceof com.ibm.as400.ui.framework.java.ChoiceDescriptor) - { - ChoiceDescriptor lobThreshInKBChoice = (ChoiceDescriptor)lobThreshInKBObject; - String lobThreshInKBString = lobThreshInKBChoice.getTitle(); - Double lobThreshInKBDouble = new Double(lobThreshInKBString); - double lobThreshInKBLittleD = lobThreshInKBDouble.doubleValue(); - int lobThreshInBytesInt = (int)(lobThreshInKBLittleD * 1024.0); - dataSource.setLobThreshold(lobThreshInBytesInt); - } - // else if (lobThreshInKBClass.getName().equals("java.lang.Double")) - else if (lobThreshInKBObject instanceof java.lang.Double) - { - Double lobThreshInKBDouble = (Double)lobThreshInKBObject; - double lobThreshInKBLittleD = lobThreshInKBDouble.doubleValue(); - int lobThreshInBytesInt = (int)(lobThreshInKBLittleD * 1024.0); - dataSource.setLobThreshold(lobThreshInBytesInt); - } - - // Language Tab - - scratchName = ((ChoiceDescriptor)m_dataBean.getSortType()).getName(); - if (scratchName.equals("AJDSP_SORTHEX")) - { - dataSource.setSort("hex"); - } - else if (scratchName.equals("AJDSP_SORTJOB")) - { - dataSource.setSort("job"); - } - else if (scratchName.equals("AJDSP_SORTLANGID")) - { - dataSource.setSort("language"); - } - else if (scratchName.equals("AJDSP_SORTTABLE")) - { - dataSource.setSort("table"); - } - - dataSource.setSortTable(m_dataBean.getSortTable()); - - if (m_dataBean.getSortWeightGroup().equals("AJDSP_SHAREDWEIGHT_RADIOBUTTON")) - { - dataSource.setSortWeight("shared"); - } - else if (m_dataBean.getSortWeightGroup().equals("AJDSP_UNIQUEWEIGHT_RADIOBUTTON")) - { - dataSource.setSortWeight("unique"); - } - - Object languageObject = m_dataBean.getLanguage(); - // Class languageClass = languageObject.getClass(); - // if (languageClass.getName().equals("com.ibm.as400.ui.framework.java.ChoiceDescriptor")) - if (languageObject instanceof com.ibm.as400.ui.framework.java.ChoiceDescriptor) - - { - // If the user selected a language from the dropdown list we'll end up here. - // Since the choice descriptor contains both the name and title, for example, - // AJDSP_SORTLG_CAT_TEXT and Catalan, we can extract the name and get the - // 3 character language id. Note that for this to work ALL languages in the - // string table must follow the same naming convention. That is, they must all - // be named "AJDSP_SORTLG_" plus the 3 character id plus "_TEXT". - - ChoiceDescriptor languageChoice = (ChoiceDescriptor)languageObject; - String languageTitle = languageChoice.getName(); - String sortLanguage = languageTitle.substring(13,16).toLowerCase(); - dataSource.setSortLanguage(sortLanguage); - } - // else if (languageClass.getName().equals("java.lang.String")) - else if (languageObject instanceof java.lang.String) - { - // If the user entered thier own 3 character language id we'll end up here. - // Since we really can't validate the id we just need to set it in the data - // source. - dataSource.setSortLanguage(((String)languageObject).toLowerCase()); - } - - // Other Tab - - if (m_dataBean.getAccessTypeGroup().equals("AJDSP_ACCESSTYPE_RW")) - { - dataSource.setAccess("all"); - } - else if (m_dataBean.getAccessTypeGroup().equals("AJDSP_ACCESSTYPE_RC")) - { - dataSource.setAccess("read call"); - } - else if (m_dataBean.getAccessTypeGroup().equals("AJDSP_ACCESSTYPE_RO")) - { - dataSource.setAccess("read only"); - } - - if (m_dataBean.getRemarksSourceGroup().equals("AJDSP_SQLDESC_RADIOBUTTON")) - { - dataSource.setRemarks("sql"); - } - else if (m_dataBean.getRemarksSourceGroup().equals("AJDSP_OS400DESC_RADIOBUTTON")) - { - dataSource.setRemarks("system"); - } - - // Translation Tab - - dataSource.setTranslateBinary(m_dataBean.isTranslate65535()); - dataSource.setTranslateHex( m_dataBean.isTranslateHex() ? "binary" : "character"); //@A4A - - // Format Tab - - scratchName = ((ChoiceDescriptor)m_dataBean.getNamingConvention()).getName(); - if (scratchName.equals("AJDSP_NAMING_SQL")) - { - dataSource.setNaming("sql"); - } - else if (scratchName.equals("AJDSP_NAMING_SYSTEM")) - { - dataSource.setNaming("system"); - } - - scratchName = ((ChoiceDescriptor)m_dataBean.getDecimalSeparator()).getName(); - if (scratchName.equals("AJDSP_USE_SERVER_JOB")) - { - dataSource.setDecimalSeparator(""); - } - else if (scratchName.equals("AJDSP_DECIMAL_PERIOD")) - { - dataSource.setDecimalSeparator("."); - } - else if (scratchName.equals("AJDSP_DECIMAL_COMMA")) - { - dataSource.setDecimalSeparator(","); - } - - scratchName = ((ChoiceDescriptor)m_dataBean.getTimeFormat()).getName(); - if (scratchName.equals("AJDSP_USE_SERVER_JOB")) - { - dataSource.setTimeFormat(""); - } - else if (scratchName.equals("AJDSP_TIMEFMT_HMS")) - { - dataSource.setTimeFormat("hms"); - } - else if (scratchName.equals("AJDSP_TIMEFMT_USA")) - { - dataSource.setTimeFormat("usa"); - } - else if (scratchName.equals("AJDSP_TIMEFMT_ISO")) - { - dataSource.setTimeFormat("iso"); - } - else if (scratchName.equals("AJDSP_TIMEFMT_EUR")) - { - dataSource.setTimeFormat("eur"); - } - else if (scratchName.equals("AJDSP_TIMEFMT_JIS")) - { - dataSource.setTimeFormat("jis"); - } - - scratchName = ((ChoiceDescriptor)m_dataBean.getTimeSeparator()).getName(); - if (scratchName.equals("AJDSP_USE_SERVER_JOB")) - { - dataSource.setTimeSeparator(""); - } - else if (scratchName.equals("AJDSP_TIMESEP_COLON")) - { - dataSource.setTimeSeparator(":"); - } - else if (scratchName.equals("AJDSP_TIMESEP_PERIOD")) - { - dataSource.setTimeSeparator("."); - } - else if (scratchName.equals("AJDSP_TIMESEP_COMMA")) - { - dataSource.setTimeSeparator(","); - } - else if (scratchName.equals("AJDSP_TIMESEP_BLANK")) - { - dataSource.setTimeSeparator("b"); - } - - scratchName = ((ChoiceDescriptor)m_dataBean.getDateFormat()).getName(); - if (scratchName.equals("AJDSP_USE_SERVER_JOB")) - { - dataSource.setDateFormat(""); - } - else if (scratchName.equals("AJDSP_DATEFMT_JULIAN")) - { - dataSource.setDateFormat("julian"); - } - else if (scratchName.equals("AJDSP_DATEFMT_MDY")) - { - dataSource.setDateFormat("mdy"); - } - else if (scratchName.equals("AJDSP_DATEFMT_DMY")) - { - dataSource.setDateFormat("dmy"); - } - else if (scratchName.equals("AJDSP_DATEFMT_YMD")) - { - dataSource.setDateFormat("ymd"); - } - else if (scratchName.equals("AJDSP_DATEFMT_USA")) - { - dataSource.setDateFormat("usa"); - } - else if (scratchName.equals("AJDSP_DATEFMT_ISO")) - { - dataSource.setDateFormat("iso"); - } - else if (scratchName.equals("AJDSP_DATEFMT_EUR")) - { - dataSource.setDateFormat("eur"); - } - else if (scratchName.equals("AJDSP_DATEFMT_JIS")) - { - dataSource.setDateFormat("jis"); - } - - scratchName = ((ChoiceDescriptor)m_dataBean.getDateSeparator()).getName(); - if (scratchName.equals("AJDSP_USE_SERVER_JOB")) - { - dataSource.setDateSeparator(""); - } - else if (scratchName.equals("AJDSP_DATESEP_FORWARDSLASH")) - { - dataSource.setDateSeparator("/"); - } - else if (scratchName.equals("AJDSP_DATESEP_DASH")) - { - dataSource.setDateSeparator("-"); - } - else if (scratchName.equals("AJDSP_DATESEP_PERIOD")) - { - dataSource.setDateSeparator("."); - } - else if (scratchName.equals("AJDSP_DATESEP_COMMA")) - { - dataSource.setDateSeparator(","); - } - else if (scratchName.equals("AJDSP_DATESEP_BLANK")) - { - dataSource.setDateSeparator("b"); - } - - // Connection Options Tab - - dataSource.setUser(m_dataBean.getDefaultUserID()); - dataSource.setSecure(m_dataBean.isUseSSL()); - -} - - -private void setDataSourcePreLoadData(AS400JDBCDataSource dataSource) -{ - String scratchString; - boolean scratchBoolean; - - // General Tab - - m_dataBean.setDataSourceName(dataSource.getDataSourceName()); - m_dataBean.setDescription(dataSource.getDescription()); - m_dataBean.setAS400Server(dataSource.getServerName()); - - // Server Tab - - scratchString = dataSource.getLibraries().trim(); //@A1A - //System.out.println(">>>>>>>>>>> dataSource.getLibraries() returned: " + scratchString); - - if (scratchString.length() > 0) //@A1A - { //@A1A - // The Toolbox stores the SQL library, if any, as the 1st entry of - // the default libraries string. If the string has a leading comma, - // that means there is no SQL library. //@A1A - if (scratchString.charAt(0) == ',') //@A1A - // There is no SQL lib, only the default list //@A1A - m_dataBean.setDefaultLibraries(scratchString.substring(1).trim()); //@A1A - else //@A1A - { //@A1A - // Find first comma and/or blank //@A1A - int iComma = scratchString.indexOf(','); //@A1A - int iSpace = scratchString.indexOf(' '); //@A1A - - if (iComma == -1 && iSpace == -1) //@A1A - // No comma or space found, so there is no default list, only the SQL lib - m_dataBean.setSQLlibrary(scratchString); //@A1A - else //@A1A - { //@A1A - // A comma and/or space was found. Set iComma to lowest index of comma or space. - if (iComma >= 0) //@A1A - { //@A1A - if (iSpace >= 0 && iSpace < iComma) //@A1A - iComma = iSpace; //@A1A - } //@A1A - else //@A1A - if (iSpace >= 0) //@A1A - iComma = iSpace; //@A1A - - m_dataBean.setSQLlibrary(scratchString.substring(0,iComma)); //@A1A - m_dataBean.setDefaultLibraries(scratchString.substring(iComma + 1)); //@A1A - } //@A1A - } //@A1A - } //@A1A - - if (dataSource.getTransactionIsolation().equals("none")) - { - scratchString = resource_Loader.getString("AJDSP_COMMIT_NONE"); - m_dataBean.setCommitMode(new ChoiceDescriptor("AJDSP_COMMIT_NONE", scratchString)); - } - else if (dataSource.getTransactionIsolation().equals("read committed")) - { - scratchString = resource_Loader.getString("AJDSP_COMMIT_CS"); - m_dataBean.setCommitMode(new ChoiceDescriptor("AJDSP_COMMIT_CS", scratchString)); - } - else if (dataSource.getTransactionIsolation().equals("read uncommitted")) - { - scratchString = resource_Loader.getString("AJDSP_COMMIT_CHG"); - m_dataBean.setCommitMode(new ChoiceDescriptor("AJDSP_COMMIT_CHG", scratchString)); - } - else if (dataSource.getTransactionIsolation().equals("repeatable read")) - { - scratchString = resource_Loader.getString("AJDSP_COMMIT_ALL"); - m_dataBean.setCommitMode(new ChoiceDescriptor("AJDSP_COMMIT_ALL", scratchString)); - } - else if (dataSource.getTransactionIsolation().equals("serializable")) - { - scratchString = resource_Loader.getString("AJDSP_COMMIT_RR"); - m_dataBean.setCommitMode(new ChoiceDescriptor("AJDSP_COMMIT_RR", scratchString)); - } - - int nValue = dataSource.getMaximumPrecision(); //@A4A - if (nValue == 63) //@A4A - m_dataBean.setMaxPrecision(new ChoiceDescriptor("AJDSP_MAXPREC_63", "63")); //@A4A - else //@A4A - m_dataBean.setMaxPrecision(new ChoiceDescriptor("AJDSP_MAXPREC_31", "31")); //@A4A - - nValue = dataSource.getMaximumScale(); //@A4A - if (nValue == 63) //@A4A - m_dataBean.setMaxScale(new ChoiceDescriptor("AJDSP_MAXSCALE_63", "63")); //@A4A - else //@A4A - if (nValue >= 31) //@A4A - m_dataBean.setMaxScale(new ChoiceDescriptor("AJDSP_MAXSCALE_31", "31")); //@A4A - else //@A4A - m_dataBean.setMaxScale(new ChoiceDescriptor("AJDSP_MAXSCALE_0", "0")); //@A4A - - nValue = dataSource.getMinimumDivideScale(); //@A4A - if (nValue == 0) //@A4A - m_dataBean.setMinDivideScale(new ChoiceDescriptor("AJDSP_MINDIVSCALE_0", "0")); //@A4A - else //@A4A - if (nValue == 1) //@A4A - m_dataBean.setMinDivideScale(new ChoiceDescriptor("AJDSP_MINDIVSCALE_1", "1")); //@A4A - else //@A4A - if (nValue == 2) //@A4A - m_dataBean.setMinDivideScale(new ChoiceDescriptor("AJDSP_MINDIVSCALE_2", "2")); //@A4A - else //@A4A - if (nValue == 3) //@A4A - m_dataBean.setMinDivideScale(new ChoiceDescriptor("AJDSP_MINDIVSCALE_3", "3")); //@A4A - else //@A4A - if (nValue == 4) //@A4A - m_dataBean.setMinDivideScale(new ChoiceDescriptor("AJDSP_MINDIVSCALE_4", "4")); //@A4A - else //@A4A - if (nValue == 5) //@A4A - m_dataBean.setMinDivideScale(new ChoiceDescriptor("AJDSP_MINDIVSCALE_5", "5")); //@A4A - else //@A4A - if (nValue == 6) //@A4A - m_dataBean.setMinDivideScale(new ChoiceDescriptor("AJDSP_MINDIVSCALE_6", "6")); //@A4A - else //@A4A - if (nValue == 7) //@A4A - m_dataBean.setMinDivideScale(new ChoiceDescriptor("AJDSP_MINDIVSCALE_7", "7")); //@A4A - else //@A4A - if (nValue == 8) //@A4A - m_dataBean.setMinDivideScale(new ChoiceDescriptor("AJDSP_MINDIVSCALE_8", "8")); //@A4A - else //@A4A - m_dataBean.setMinDivideScale(new ChoiceDescriptor("AJDSP_MINDIVSCALE_9", "9")); //@A4A - - // Package Tab - m_dataBean.setEnableExtDynamic(dataSource.isExtendedDynamic()); - m_dataBean.setPackage(dataSource.getPackage()); - m_dataBean.setPackageLibrary(dataSource.getPackageLibrary()); - if (dataSource.isPackageAdd()) - { - m_dataBean.setUsageGroup("AJDSP_USEADD_RADIOBUTTON"); - } - else - { - m_dataBean.setUsageGroup("AJDSP_USE_RADIOBUTTON"); - } - if (dataSource.getPackageError().equals("exception")) - { - m_dataBean.setUnusablePkgActionGroup("AJDSP_SEND_EXCEP_RADIOBUTTON"); - } - else if (dataSource.getPackageError().equals("warning")) - { - m_dataBean.setUnusablePkgActionGroup("AJDSP_POST_WARN_RADIOBUTTON"); - } - else if (dataSource.getPackageError().equals("none")) - { - m_dataBean.setUnusablePkgActionGroup("AJDSP_IGNORE_RADIOBUTTON"); - } - m_dataBean.setCachePackageLocally(dataSource.isPackageCache()); - - // Performance Tab - m_dataBean.setEnableLazyClose(dataSource.isLazyClose()); - m_dataBean.setEnablePrefetch(dataSource.isPrefetch()); - m_dataBean.setEnableDataCompression(dataSource.isDataCompression()); - - if (dataSource.getBlockCriteria() == 0) - { - scratchString = resource_Loader.getString("AJDSP_RECBLK_DISABLE"); - m_dataBean.setRecordBlockingCriteria(new ChoiceDescriptor("AJDSP_RECBLK_DISABLE", scratchString)); - } - else if (dataSource.getBlockCriteria() == 1) - { - scratchString = resource_Loader.getString("AJDSP_RECBLK_FORFETCH"); - m_dataBean.setRecordBlockingCriteria(new ChoiceDescriptor("AJDSP_RECBLK_FORFETCH", scratchString)); - } - else if (dataSource.getBlockCriteria() == 2) - { - scratchString = resource_Loader.getString("AJDSP_RECBLK_NOTUPDT"); - m_dataBean.setRecordBlockingCriteria(new ChoiceDescriptor("AJDSP_RECBLK_NOTUPDT", scratchString)); - } - - switch(dataSource.getBlockSize()) - { - case(0): - scratchString = resource_Loader.getString("AJDSP_BLOCK_SIZE_0"); - m_dataBean.setRecordBlockingSize(new ChoiceDescriptor("AJDSP_BLOCK_SIZE_0", scratchString)); - break; - case(8): - scratchString = resource_Loader.getString("AJDSP_BLOCK_SIZE_8"); - m_dataBean.setRecordBlockingSize(new ChoiceDescriptor("AJDSP_BLOCK_SIZE_8", scratchString)); - break; - case(16): - scratchString = resource_Loader.getString("AJDSP_BLOCK_SIZE_16"); - m_dataBean.setRecordBlockingSize(new ChoiceDescriptor("AJDSP_BLOCK_SIZE_16", scratchString)); - break; - case(32): - scratchString = resource_Loader.getString("AJDSP_BLOCK_SIZE_32"); - m_dataBean.setRecordBlockingSize(new ChoiceDescriptor("AJDSP_BLOCK_SIZE_32", scratchString)); - break; - case(64): - scratchString = resource_Loader.getString("AJDSP_BLOCK_SIZE_64"); - m_dataBean.setRecordBlockingSize(new ChoiceDescriptor("AJDSP_BLOCK_SIZE_64", scratchString)); - break; - case(128): - scratchString = resource_Loader.getString("AJDSP_BLOCK_SIZE_128"); - m_dataBean.setRecordBlockingSize(new ChoiceDescriptor("AJDSP_BLOCK_SIZE_128", scratchString)); - break; - case(256): - scratchString = resource_Loader.getString("AJDSP_BLOCK_SIZE_256"); - m_dataBean.setRecordBlockingSize(new ChoiceDescriptor("AJDSP_BLOCK_SIZE_256", scratchString)); - break; - case(512): - scratchString = resource_Loader.getString("AJDSP_BLOCK_SIZE_512"); - m_dataBean.setRecordBlockingSize(new ChoiceDescriptor("AJDSP_BLOCK_SIZE_512", scratchString)); - break; - } - - double lobThresholdInKBLittleD = dataSource.getLobThreshold() / 1024.0; - Double lobThresholdInKBBigD = new Double(lobThresholdInKBLittleD); - m_dataBean.setLOBThreshold(lobThresholdInKBBigD); //@A2C - //m_dataBean.setLOBThreshold(lobThresholdInKBBigD.toString()); <----- ORIGINALLY - - // Language Tab - - if (dataSource.getSort().equals("hex")) - { - scratchString = resource_Loader.getString("AJDSP_SORTHEX"); - m_dataBean.setSortType(new ChoiceDescriptor("AJDSP_SORTHEX", scratchString)); - } - else if (dataSource.getSort().equals("job")) - { - scratchString = resource_Loader.getString("AJDSP_SORTJOB"); - m_dataBean.setSortType(new ChoiceDescriptor("AJDSP_SORTJOB", scratchString)); - } - else if (dataSource.getSort().equals("language")) - { - scratchString = resource_Loader.getString("AJDSP_SORTLANGID"); - m_dataBean.setSortType(new ChoiceDescriptor("AJDSP_SORTLANGID", scratchString)); - } - else if (dataSource.getSort().equals("table")) - { - scratchString = resource_Loader.getString("AJDSP_SORTTABLE"); - m_dataBean.setSortType(new ChoiceDescriptor("AJDSP_SORTTABLE", scratchString)); - } - - m_dataBean.setSortTable(dataSource.getSortTable()); - - if (dataSource.getSortWeight().equals("shared")) - { - m_dataBean.setSortWeightGroup("AJDSP_SHAREDWEIGHT_RADIOBUTTON"); - } - else if (dataSource.getSortWeight().equals("unique")) - { - m_dataBean.setSortWeightGroup("AJDSP_UNIQUEWEIGHT_RADIOBUTTON"); - } - - String sortLanguage = dataSource.getSortLanguage(); - if (sortLanguage.equalsIgnoreCase("afr") || sortLanguage.equalsIgnoreCase("ara") || - sortLanguage.equalsIgnoreCase("bel") || sortLanguage.equalsIgnoreCase("bgr") || - sortLanguage.equalsIgnoreCase("cat") || sortLanguage.equalsIgnoreCase("chs") || - sortLanguage.equalsIgnoreCase("cht") || sortLanguage.equalsIgnoreCase("csy") || - sortLanguage.equalsIgnoreCase("dan") || sortLanguage.equalsIgnoreCase("des") || - sortLanguage.equalsIgnoreCase("deu") || sortLanguage.equalsIgnoreCase("ell") || - sortLanguage.equalsIgnoreCase("ena") || sortLanguage.equalsIgnoreCase("enb") || - sortLanguage.equalsIgnoreCase("eng") || sortLanguage.equalsIgnoreCase("enp") || - sortLanguage.equalsIgnoreCase("enu") || sortLanguage.equalsIgnoreCase("esp") || - sortLanguage.equalsIgnoreCase("est") || sortLanguage.equalsIgnoreCase("far") || - sortLanguage.equalsIgnoreCase("fin") || sortLanguage.equalsIgnoreCase("fra") || - sortLanguage.equalsIgnoreCase("frb") || sortLanguage.equalsIgnoreCase("frc") || - sortLanguage.equalsIgnoreCase("frs") || sortLanguage.equalsIgnoreCase("gae") || - sortLanguage.equalsIgnoreCase("heb") || sortLanguage.equalsIgnoreCase("hrv") || - sortLanguage.equalsIgnoreCase("hun") || sortLanguage.equalsIgnoreCase("isl") || - sortLanguage.equalsIgnoreCase("ita") || sortLanguage.equalsIgnoreCase("its") || - sortLanguage.equalsIgnoreCase("jpn") || sortLanguage.equalsIgnoreCase("kor") || - sortLanguage.equalsIgnoreCase("lao") || sortLanguage.equalsIgnoreCase("ltu") || - sortLanguage.equalsIgnoreCase("lva") || sortLanguage.equalsIgnoreCase("mkd") || - sortLanguage.equalsIgnoreCase("nlb") || sortLanguage.equalsIgnoreCase("nld") || - sortLanguage.equalsIgnoreCase("non") || sortLanguage.equalsIgnoreCase("nor") || - sortLanguage.equalsIgnoreCase("plk") || sortLanguage.equalsIgnoreCase("ptb") || - sortLanguage.equalsIgnoreCase("ptg") || sortLanguage.equalsIgnoreCase("rms") || - sortLanguage.equalsIgnoreCase("rom") || sortLanguage.equalsIgnoreCase("rus") || - sortLanguage.equalsIgnoreCase("sky") || sortLanguage.equalsIgnoreCase("slo") || - sortLanguage.equalsIgnoreCase("sqi") || sortLanguage.equalsIgnoreCase("srb") || - sortLanguage.equalsIgnoreCase("srl") || sortLanguage.equalsIgnoreCase("sve") || - sortLanguage.equalsIgnoreCase("tha") || sortLanguage.equalsIgnoreCase("trk") || - sortLanguage.equalsIgnoreCase("ukr") || sortLanguage.equalsIgnoreCase("urd") || - sortLanguage.equalsIgnoreCase("vie")) - - { - // The following builds the name of the string table entry using the - // 3 character language id. Note that for this to work ALL languages in the - // string table must follow the same naming convention. That is, they must all - // be named "AJDSP_SORTLG_" plus the 3 character id plus "_TEXT". - - String languageChoice = "AJDSP_SORTLG_" + sortLanguage.toUpperCase() + "_TEXT"; - scratchString = resource_Loader.getString(languageChoice); - m_dataBean.setLanguage(new ChoiceDescriptor(languageChoice, scratchString)); - } - else - { - m_dataBean.setLanguage(sortLanguage); - } - int x = 1; //Without this allocation of storage, the Cafe' debugger traps if you try - // to step thru this code.... It will execute just fine, you just can't - // debug it. - - // Other Tab - - if (dataSource.getAccess().equals("all")) - { - m_dataBean.setAccessTypeGroup("AJDSP_ACCESSTYPE_RW"); - } - else if (dataSource.getAccess().equals("read call")) - { - m_dataBean.setAccessTypeGroup("AJDSP_ACCESSTYPE_RC"); - } - else if (dataSource.getAccess().equals("read only")) - { - m_dataBean.setAccessTypeGroup("AJDSP_ACCESSTYPE_RO"); - } - - if (dataSource.getRemarks().equals("sql")) - { - m_dataBean.setRemarksSourceGroup("AJDSP_SQLDESC_RADIOBUTTON"); - } - else if (dataSource.getRemarks().equals("system")) - { - m_dataBean.setRemarksSourceGroup("AJDSP_OS400DESC_RADIOBUTTON"); - } - - // Translation Tab - m_dataBean.setTranslate65535(dataSource.isTranslateBinary()); - m_dataBean.setTranslateHex(dataSource.getTranslateHex().equals("binary")); //@A4A - - // Format Tab - - if (dataSource.getNaming().equals("sql")) - { - scratchString = resource_Loader.getString("AJDSP_NAMING_SQL"); - m_dataBean.setNamingConvention(new ChoiceDescriptor("AJDSP_NAMING_SQL", scratchString)); - } - else if (dataSource.getNaming().equals("system")) - { - scratchString = resource_Loader.getString("AJDSP_NAMING_SYSTEM"); - m_dataBean.setNamingConvention(new ChoiceDescriptor("AJDSP_NAMING_SYSTEM", scratchString)); - } - - if (dataSource.getDecimalSeparator().equals("")) - { - scratchString = resource_Loader.getString("AJDSP_USE_SERVER_JOB"); - m_dataBean.setDecimalSeparator(new ChoiceDescriptor("AJDSP_USE_SERVER_JOB", scratchString)); - } - else if (dataSource.getDecimalSeparator().equals(".")) - { - scratchString = resource_Loader.getString("AJDSP_DECIMAL_PERIOD"); - m_dataBean.setDecimalSeparator(new ChoiceDescriptor("AJDSP_DECIMAL_PERIOD", scratchString)); - } - else if (dataSource.getDecimalSeparator().equals(",")) - { - scratchString = resource_Loader.getString("AJDSP_DECIMAL_COMMA"); - m_dataBean.setDecimalSeparator(new ChoiceDescriptor("AJDSP_DECIMAL_COMMA", scratchString)); - } - - if (dataSource.getTimeFormat().equals("")) - { - scratchString = resource_Loader.getString("AJDSP_USE_SERVER_JOB"); - m_dataBean.setTimeFormat(new ChoiceDescriptor("AJDSP_USE_SERVER_JOB", scratchString)); - } - else if (dataSource.getTimeFormat().equals("hms")) - { - scratchString = resource_Loader.getString("AJDSP_TIMEFMT_HMS"); - m_dataBean.setTimeFormat(new ChoiceDescriptor("AJDSP_TIMEFMT_HMS", scratchString)); - } - else if (dataSource.getTimeFormat().equals("usa")) - { - scratchString = resource_Loader.getString("AJDSP_TIMEFMT_USA"); - m_dataBean.setTimeFormat(new ChoiceDescriptor("AJDSP_TIMEFMT_USA", scratchString)); - } - else if (dataSource.getTimeFormat().equals("iso")) - { - scratchString = resource_Loader.getString("AJDSP_TIMEFMT_ISO"); - m_dataBean.setTimeFormat(new ChoiceDescriptor("AJDSP_TIMEFMT_ISO", scratchString)); - } - else if (dataSource.getTimeFormat().equals("eur")) - { - scratchString = resource_Loader.getString("AJDSP_TIMEFMT_EUR"); - m_dataBean.setTimeFormat(new ChoiceDescriptor("AJDSP_TIMEFMT_EUR", scratchString)); - } - else if (dataSource.getTimeFormat().equals("jis")) - { - scratchString = resource_Loader.getString("AJDSP_TIMEFMT_JIS"); - m_dataBean.setTimeFormat(new ChoiceDescriptor("AJDSP_TIMEFMT_JIS", scratchString)); - } - - if (dataSource.getTimeSeparator().equals("")) - { - scratchString = resource_Loader.getString("AJDSP_USE_SERVER_JOB"); - m_dataBean.setTimeSeparator(new ChoiceDescriptor("AJDSP_USE_SERVER_JOB", scratchString)); - } - else if (dataSource.getTimeSeparator().equals(":")) - { - scratchString = resource_Loader.getString("AJDSP_TIMESEP_COLON"); - m_dataBean.setTimeSeparator(new ChoiceDescriptor("AJDSP_TIMESEP_COLON", scratchString)); - } - else if (dataSource.getTimeSeparator().equals(".")) - { - scratchString = resource_Loader.getString("AJDSP_TIMESEP_PERIOD"); - m_dataBean.setTimeSeparator(new ChoiceDescriptor("AJDSP_TIMESEP_PERIOD", scratchString)); - } - else if (dataSource.getTimeSeparator().equals(",")) - { - scratchString = resource_Loader.getString("AJDSP_TIMESEP_COMMA"); - m_dataBean.setTimeSeparator(new ChoiceDescriptor("AJDSP_TIMESEP_COMMA", scratchString)); - } - else if (dataSource.getTimeSeparator().equals("b")) - { - scratchString = resource_Loader.getString("AJDSP_TIMESEP_BLANK"); - m_dataBean.setTimeSeparator(new ChoiceDescriptor("AJDSP_TIMESEP_BLANK", scratchString)); - } - - if (dataSource.getDateFormat().equals("")) - { - scratchString = resource_Loader.getString("AJDSP_USE_SERVER_JOB"); - m_dataBean.setDateFormat(new ChoiceDescriptor("AJDSP_USE_SERVER_JOB", scratchString)); - } - else if (dataSource.getDateFormat().equals("julian")) - { - scratchString = resource_Loader.getString("AJDSP_DATEFMT_JULIAN"); - m_dataBean.setDateFormat(new ChoiceDescriptor("AJDSP_DATEFMT_JULIAN", scratchString)); - } - else if (dataSource.getDateFormat().equals("mdy")) - { - scratchString = resource_Loader.getString("AJDSP_DATEFMT_MDY"); - m_dataBean.setDateFormat(new ChoiceDescriptor("AJDSP_DATEFMT_MDY", scratchString)); - } - else if (dataSource.getDateFormat().equals("dmy")) - { - scratchString = resource_Loader.getString("AJDSP_DATEFMT_DMY"); - m_dataBean.setDateFormat(new ChoiceDescriptor("AJDSP_DATEFMT_DMY", scratchString)); - } - else if (dataSource.getDateFormat().equals("ymd")) - { - scratchString = resource_Loader.getString("AJDSP_DATEFMT_YMD"); - m_dataBean.setDateFormat(new ChoiceDescriptor("AJDSP_DATEFMT_YMD", scratchString)); - } - else if (dataSource.getDateFormat().equals("usa")) - { - scratchString = resource_Loader.getString("AJDSP_DATEFMT_USA"); - m_dataBean.setDateFormat(new ChoiceDescriptor("AJDSP_DATEFMT_USA", scratchString)); - } - else if (dataSource.getDateFormat().equals("iso")) - { - scratchString = resource_Loader.getString("AJDSP_DATEFMT_ISO"); - m_dataBean.setDateFormat(new ChoiceDescriptor("AJDSP_DATEFMT_ISO", scratchString)); - } - else if (dataSource.getDateFormat().equals("eur")) - { - scratchString = resource_Loader.getString("AJDSP_DATEFMT_EUR"); - m_dataBean.setDateFormat(new ChoiceDescriptor("AJDSP_DATEFMT_EUR", scratchString)); - } - else if (dataSource.getDateFormat().equals("jis")) - { - scratchString = resource_Loader.getString("AJDSP_DATEFMT_JIS"); - m_dataBean.setDateFormat(new ChoiceDescriptor("AJDSP_DATEFMT_JIS", scratchString)); - } - - if (dataSource.getDateSeparator().equals("")) - { - scratchString = resource_Loader.getString("AJDSP_USE_SERVER_JOB"); - m_dataBean.setDateSeparator(new ChoiceDescriptor("AJDSP_USE_SERVER_JOB", scratchString)); - } - else if (dataSource.getDateSeparator().equals("/")) - { - scratchString = resource_Loader.getString("AJDSP_DATESEP_FORWARDSLASH"); - m_dataBean.setDateSeparator(new ChoiceDescriptor("AJDSP_DATESEP_FORWARDSLASH", scratchString)); - } - else if (dataSource.getDateSeparator().equals("-")) - { - scratchString = resource_Loader.getString("AJDSP_DATESEP_DASH"); - m_dataBean.setDateSeparator(new ChoiceDescriptor("AJDSP_DATESEP_DASH", scratchString)); - } - else if (dataSource.getDateSeparator().equals(".")) - { - scratchString = resource_Loader.getString("AJDSP_DATESEP_PERIOD"); - m_dataBean.setDateSeparator(new ChoiceDescriptor("AJDSP_DATESEP_PERIOD", scratchString)); - } - else if (dataSource.getDateSeparator().equals(",")) - { - scratchString = resource_Loader.getString("AJDSP_DATESEP_COMMA"); - m_dataBean.setDateSeparator(new ChoiceDescriptor("AJDSP_DATESEP_COMMA", scratchString)); - } - else if (dataSource.getDateSeparator().equals("b")) - { - scratchString = resource_Loader.getString("AJDSP_DATESEP_BLANK"); - m_dataBean.setDateSeparator(new ChoiceDescriptor("AJDSP_DATESEP_BLANK", scratchString)); - } - - // Connection Options Tab - m_dataBean.setDefaultUserID(dataSource.getUser()); - m_dataBean.setUseSSL(dataSource.isSecure()); - -} - -/** Removes the specified tab from the pane. The following constants -should be used to specify the tab number: -
      -
    • TAB_GENERAL -
    • TAB_SERVER -
    • TAB_PACKAGE -
    • TAB_PERFORMANCE -
    • TAB_LANGUAGE -
    • TAB_OTHER -
    • TAB_TRANSLATION -
    • TAB_FORMAT -
    • TAB_CONNECTIONOPTIONS -
    -**/ - -public void removeTabAt(int tabNumber) -{ - // This method removes the specified tab - - switch(tabNumber) - { - case(TAB_GENERAL): - m_tabbedPaneManager.removePane("AJDSP_GENERAL"); - break; - case(TAB_SERVER): - m_tabbedPaneManager.removePane("AJDSP_SERVER"); - break; - case(TAB_PACKAGE): - m_tabbedPaneManager.removePane("AJDSP_PACKAGE"); - break; - case(TAB_PERFORMANCE): - m_tabbedPaneManager.removePane("AJDSP_PERFORMANCE"); - break; - case(TAB_LANGUAGE): - m_tabbedPaneManager.removePane("AJDSP_LANGUAGE"); - break; - case(TAB_OTHER): - m_tabbedPaneManager.removePane("AJDSP_OTHER"); - break; - case(TAB_TRANSLATION): - m_tabbedPaneManager.removePane("AJDSP_TRANSLATION"); - break; - case(TAB_FORMAT): - m_tabbedPaneManager.removePane("AJDSP_FORMAT"); - break; - case(TAB_CONNECTIONOPTIONS): - m_tabbedPaneManager.removePane("AJDSP_CONNOPT"); - break; - } - -} - -public void addPropertyChangeListener(PropertyChangeListener listener) -{ - if (listener == null) - throw new NullPointerException("listener"); - propertyChangeSupport_.addPropertyChangeListener(listener); -} - -public void removePropertyChangeListener(PropertyChangeListener listener) -{ - if (listener == null) - throw new NullPointerException("listener"); - propertyChangeSupport_.removePropertyChangeListener(listener); -} - -private void readObject(java.io.ObjectInputStream in) -throws IOException, ClassNotFoundException -{ - in.defaultReadObject(); - propertyChangeSupport_ = new PropertyChangeSupport(this); -} - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePane16.gif b/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePane16.gif deleted file mode 100644 index ca3ccc1d6..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePane16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePane32.gif b/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePane32.gif deleted file mode 100644 index 1819a2351..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePane32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePaneBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePaneBeanInfo.java deleted file mode 100644 index 8515a3fe8..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePaneBeanInfo.java +++ /dev/null @@ -1,147 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCDataSourcePaneBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.awt.Image; - - -/** -The AS400JDBCDataSourcePaneBeanInfo class provides the bean information -for the AS400JDBCDataSourcePane class. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class AS400JDBCDataSourcePaneBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = AS400JDBCDataSourcePane.class; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor[] events = {changed}; - - events_ = events; - - PropertyDescriptor dataSource = new PropertyDescriptor("dataSource", beanClass); - dataSource.setBound(true); - dataSource.setConstrained(false); - dataSource.setDisplayName(ResourceLoader.getText("PROP_NAME_DATASOURCE")); - dataSource.setShortDescription(ResourceLoader.getText("PROP_DESC_DATASOURCE")); - - PropertyDescriptor properties[] = {dataSource}; - - properties_ = properties; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the actionCompleted event - return 0; - } - - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the "command" property - return 0; - } - - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("AS400JDBCDataSourcePane16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("AS400JDBCDataSourcePane32.gif"); - break; - } - - return image; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePaneDataBean.java b/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePaneDataBean.java deleted file mode 100644 index c493e3a10..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePaneDataBean.java +++ /dev/null @@ -1,1292 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (AS/400 Toolbox for Java - OSS version) -// -// Filename: AS400JDBCDataSourcePaneDataBean.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -// 10/20/2010: Moved from "include" to "src" -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.ui.framework.java.*; -import com.ibm.as400.access.AS400JDBCDataSource; -import java.util.*; - -/** - * The AS400JDBCDataSourcePaneDataBean class sets data in, - * and returns data from, the AS400JDBCDataSourcePane component. - * @deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access - */ - -public class AS400JDBCDataSourcePaneDataBean extends Object - implements DataBean -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // General Tab - private String m_sDataSourceName; - private String m_sDescription; - private String m_sAS400Server; - - // Server Tab - private String m_sSQLlibrary; //@A1A - private String m_sDefaultLibraries; - private Object m_oCommitMode; - private ChoiceDescriptor[] m_cdCommitMode; - private Object m_oMaxPrecision; //@A2A - private ChoiceDescriptor[] m_cdMaxPrecision; //@A2A - private Object m_oMaxScale; //@A2A - private ChoiceDescriptor[] m_cdMaxScale; //@A2A - private Object m_oMinDivideScale; //@A2A - private ChoiceDescriptor[] m_cdMinDivideScale; //@A2A - - // Package Tab - private boolean m_bEnableExtDynamic; - private String m_sPackage; - private String m_sPackageLibrary; - private String m_sUsageGroup; - private String m_sUnusablePkgActionGroup; - private boolean m_bCachePackageLocally; - - // Performance Tab - private boolean m_bEnableLazyClose; - private boolean m_bEnablePrefetch; - private boolean m_bEnableDataCompression; - private Object m_oRecordBlockingCriteria; - private ChoiceDescriptor[] m_cdRecordBlockingCriteria; - private Object m_oRecordBlockingSize; - private ChoiceDescriptor[] m_cdRecordBlockingSize; - private Object m_oLOBThreshold; - private ChoiceDescriptor[] m_cdLOBThreshold; - - // Language Tab - private Object m_oSortType; - private ChoiceDescriptor[] m_cdSortType; - private String m_sSortTable; - private String m_sSortWeightGroup; - private Object m_oLanguage; - private ChoiceDescriptor[] m_cdLanguage; - - // Other Tab - private String m_sAccessTypeGroup; - private String m_sRemarksSourceGroup; - - // Translation Tab - private boolean m_bTranslate65535; - private boolean m_bTranslateHex; //@A2A - - // Format Tab - private Object m_oNamingConvention; - private ChoiceDescriptor[] m_cdNamingConvention; - private Object m_oDecimalSeparator; - private ChoiceDescriptor[] m_cdDecimalSeparator; - private Object m_oTimeFormat; - private ChoiceDescriptor[] m_cdTimeFormat; - private Object m_oTimeSeparator; - private ChoiceDescriptor[] m_cdTimeSeparator; - private Object m_oDateFormat; - private ChoiceDescriptor[] m_cdDateFormat; - private Object m_oDateSeparator; - private ChoiceDescriptor[] m_cdDateSeparator; - - // Connection Options Tab - private String m_sDefaultUserID; - private boolean m_bUseSSL; - - ///////////////// - // General Tab // - ///////////////// - - /** Returns the value of the "Data source name" field on the - General tab. - @return The data source name. - */ - public String getDataSourceName() - { - return m_sDataSourceName; - } - - /** Sets the value of the "Data source name" field on the - General tab. - @param s The data source name. - */ - public void setDataSourceName(String s) - { - m_sDataSourceName = s; - } - - /** Returns the value of the "Description" field on the - General tab. - @return The data source description. - */ - public String getDescription() - { - return m_sDescription; - } - - /** Sets the value of the "Description" field on the - General tab. - @param s The data source description. - */ - public void setDescription(String s) - { - m_sDescription = s; - } - - /** Returns the value of the "AS/400 server" field on the General tab. - @return The server name. - */ - public String getAS400Server() - { - return m_sAS400Server; - } - - /** Sets the value of the "AS/400 server" field on the General tab. - @param s The server. - */ - public void setAS400Server(String s) - { - m_sAS400Server = s; - } - - //////////////// - // Server Tab // - //////////////// - - /* Returns the value of the "Default SQL library" field on the Server tab. - @return The Default SQL library name. //@A1A - */ - public String getSQLlibrary() //@A1A - { //@A1A - return m_sSQLlibrary; //@A1A - } //@A1A - - /* Sets the value of the "Default SQL library" field on the Server tab. - @param s The Default SQL library name. //@A1A - */ - public void setSQLlibrary(String s) //@A1A - { //@A1A - m_sSQLlibrary = s; //@A1A - } //@A1A - - /** Returns the value of the "Library list" field on the - Server tab. - @return The server name. - */ - public String getDefaultLibraries() - { - return m_sDefaultLibraries; - } - - /** Sets the value of the "Library list" field on the Server tab. - @param s The library list. - */ - public void setDefaultLibraries(String s) - { - m_sDefaultLibraries = s; - } - - /** Returns the value of the "Commit mode" field on the - Server tab. - @return The commit mode. - */ - public Object getCommitMode() - { - return m_oCommitMode; - } - - /** Sets the value of the "Commit mode" field on the Server tab. - @param o The commit mode. - */ - public void setCommitMode(Object o) - { - m_oCommitMode = o; - } - - /** Returns the list of values in the "Commit mode" drop down - list. - @return The list of values. - */ - public ChoiceDescriptor[] getCommitModeChoices() - { - return m_cdCommitMode; - } - - public Object getMaxPrecision() - { - return m_oMaxPrecision; - } - - public void setMaxPrecision(Object o) - { - m_oMaxPrecision = o; - } - - public ChoiceDescriptor[] getMaxPrecisionChoices() - { - return m_cdMaxPrecision; - } - - public Object getMaxScale() - { - return m_oMaxScale; - } - - public void setMaxScale(Object o) - { - m_oMaxScale = o; - } - - public ChoiceDescriptor[] getMaxScaleChoices() - { - return m_cdMaxScale; - } - - public Object getMinDivideScale() - { - return m_oMinDivideScale; - } - - public void setMinDivideScale(Object o) - { - m_oMinDivideScale = o; - } - - public ChoiceDescriptor[] getMinDivideScaleChoices() - { - return m_cdMinDivideScale; - } - - ///////////////// - // Package Tab // - ///////////////// - - /** Indicates whether the "Enable extended dynamic (package) - support" check box on the Package tab is checked. - @return True if the check box is checked - */ - - public boolean isEnableExtDynamic() - { - return m_bEnableExtDynamic; - } - - /** Sets the value of the "Enable extended dynamic (package) - support" check box on the Package tab. - @param b The check box state. True if it should be checked, - false otherwise. - */ - public void setEnableExtDynamic(boolean b) - { - m_bEnableExtDynamic = b; - } - - /** Returns the value of the "Package" field on the - Package tab. - @return The package name. - */ - public String getPackage() - { - return m_sPackage; - } - /** Sets the value of the "Package" field on the - Package tab. - @param s The package name. - */ - public void setPackage(String s) - { - m_sPackage = s; - } - - /** Returns the value of the "Package library" field on the - Package tab. - @return The package library. - */ - public String getPackageLibrary() - { - return m_sPackageLibrary; - } - - /** Sets the value of the "Package library" field on the - Package tab. - @param s The package library. - */ - public void setPackageLibrary(String s) - { - m_sPackageLibrary = s; - } - - /** Indicates whether the "Cache package locally" - check box on the Package tab is checked. - @return True if the check box is checked - */ - public boolean isCachePackageLocally() - { - return m_bCachePackageLocally; - } - - /** Sets the value of the "Cache package locally" check - box on the Package tab. - @param b The check box state. True if it should be checked, - false otherwise. - */ - public void setCachePackageLocally(boolean b) - { - m_bCachePackageLocally = b; - } - - /** Returns the value of the "Usage" group on the - Package tab. - @return The selected radio button. AJDSP_USE_RADIOBUTTON - returned when the "Use" radio button is selected. - AJDSP_USEADD_RADIOBUTTON returned when the "Use and add" - radio button is selected. - */ - public String getUsageGroup() - { - return m_sUsageGroup; - } - - /** Sets the value of the "Usage" group on the - Package tab. - @param s The radio button. AJDSP_USE_RADIOBUTTON if the - "Use" radio button should be selected. AJDSP_USEADD_RADIOBUTTON - if the "Use and add" radio button should be selected. - */ - public void setUsageGroup(String s) - { - m_sUsageGroup = s; - } - - /** Returns the value of the "Unusable package" group on the - Package tab. - @return The selected radio button. AJDSP_SEND_EXCEP_RADIOBUTTON - returned when the "Send exception" radio button is selected. - AJDSP_POST_WARN_RADIOBUTTON returned when the "Post warning" - radio button is selected. AJDSP_IGNORE_RADIOBUTTON returned - when the "Ignore" radio button is selected. - */ - public String getUnusablePkgActionGroup() - { - return m_sUnusablePkgActionGroup; - } - - /** Sets the value of the "Unusable package" group on the - Package tab. - @param s The radio button. AJDSP_SEND_EXCEP_RADIOBUTTON if the - "Send exception" radio button should be selected. AJDSP_POST_WARN_RADIOBUTTON - if the "Post warning" radio button should be selected. AJDSP_IGNORE_RADIOBUTTON - if the "Ignore" radio button should be selected. - */ - public void setUnusablePkgActionGroup(String s) - { - m_sUnusablePkgActionGroup = s; - } - - ///////////////////// - // Performance Tab // - ///////////////////// - - /** Indicates whether the "Enable lazy close support" - check box on the Performance tab is checked. - @return True if the check box is checked - */ - public boolean isEnableLazyClose() - { - return m_bEnableLazyClose; - } - - /** Sets the value of the "Enable lazy close support" check - box on the Performance tab. - @param b The check box state. True if it should be checked, - false otherwise. - */ - public void setEnableLazyClose(boolean b) - { - m_bEnableLazyClose = b; - } - - /** Indicates whether the "Enable pre-fetch" - check box on the Performance tab is checked. - @return True if the check box is checked - */ - public boolean isEnablePrefetch() - { - return m_bEnablePrefetch; - } - - /** Sets the value of the "Enable pre-fetch" check - box on the Performance tab. - @param b The check box state. True if it should be checked, - false otherwise. - */ - public void setEnablePrefetch(boolean b) - { - m_bEnablePrefetch = b; - } - - /** Indicates whether the "Enable data compression" - check box on the Performance tab is checked. - @return True if the check box is checked - */ - public boolean isEnableDataCompression() - { - return m_bEnableDataCompression; - } - - /** Sets the value of the "Enable data compression" check - box on the Performance tab. - @param b The check box state. True if it should be checked, - false otherwise. - */ - public void setEnableDataCompression(boolean b) - { - m_bEnableDataCompression = b; - } - - /** Returns the value of the "Record blocking criteria" field on the - Performance tab. - @return The record blocking criteria. - */ - public Object getRecordBlockingCriteria() - { - return m_oRecordBlockingCriteria; - } - - /** Sets the value of the "Record Blocking criteria" field on the - Performance tab. - @param o The record blocking criteria. - */ - public void setRecordBlockingCriteria(Object o) - { - m_oRecordBlockingCriteria = o; - } - - /** Returns the list of values in the "Record Blocking criteria"" drop down - list. - @return The list of values. - */ - public ChoiceDescriptor[] getRecordBlockingCriteriaChoices() - { - return m_cdRecordBlockingCriteria; - } - - /** Returns the value of the "Record blocking size" field on the - Performance tab. - @return The record blocking criteria. - */ - public Object getRecordBlockingSize() - { - return m_oRecordBlockingSize; - } - - /** Sets the value of the "Record Blocking size" field on the - Performance tab. - @param o The record blocking criteria. - */ - public void setRecordBlockingSize(Object o) - { - m_oRecordBlockingSize = o; - } - - /** Returns the list of values in the "Record Blocking size"" drop down - list. - @return The list of values. - */ - public ChoiceDescriptor[] getRecordBlockingSizeChoices() - { - return m_cdRecordBlockingSize; - } - - /** Returns the value of the "Large object threshold" field on the - Performance tab. - @return The large object threshold. - */ - public Object getLOBThreshold() - { - return m_oLOBThreshold; - } - - /** Sets the value of the "Large object threshold" field on the - Performance tab. - @param o The large object threshold. - */ - public void setLOBThreshold(Object o) - { - m_oLOBThreshold = o; - } - - /** Returns the list of values in the "Large object threshold" drop down - list. - @return The list of values. - */ - public ChoiceDescriptor[] getLOBThresholdChoices() - { - return m_cdLOBThreshold; - } - - ////////////////// - // Language Tab // - ////////////////// - - /** Returns the value of the "Sort type" field on the - Language tab. - @return The sort type. - */ - public Object getSortType() - { - return m_oSortType; - } - - /** Sets the value of the "Sort type" field on the - Language tab. - @param o The sort type. - */ - public void setSortType(Object o) - { - m_oSortType = o; - } - - /** Returns the list of values in the "Sort type" drop down - list. - @return The list of values. - */ - public ChoiceDescriptor[] getSortTypeChoices() - { - return m_cdSortType; - } - - /** Returns the value of the "Sort library/table name" - field on the Language tab. - @return The qualified sort table name. - */ - public String getSortTable() - { - return m_sSortTable; - } - - /** Sets the value of the "Sort library/table name" - field on the Language tab. - @param s The qualified sort table name. - */ - public void setSortTable(String s) - { - m_sSortTable = s; - } - - /** Returns the value of the "Sort weight" group on the - Language tab. - @return The selected radio button. AJDSP_SHAREDWEIGHT_RADIOBUTTON - returned when the "Shared" radio button is selected. - AJDSP_UNIQUEWEIGHT_RADIOBUTTON returned when the "Unique" - radio button is selected. - */ - public String getSortWeightGroup() - { - return m_sSortWeightGroup; - } - - /** Sets the value of the "Sort weight" group on the - Language tab. - @param s The radio button. AJDSP_SHAREDWEIGHT_RADIOBUTTON if the - "Shared" radio button should be selected. AJDSP_UNIQUEWEIGHT_RADIOBUTTON - if the "Unique" radio button should be selected. - */ - public void setSortWeightGroup(String s) - { - m_sSortWeightGroup = s; - } - - /** Returns the value of the "Language" field on the - Language tab. - @return The language. - */ - public Object getLanguage() - { - return m_oLanguage; - } - - /** Sets the value of the "Language" field on the - Language tab. - @param o The language. - */ - public void setLanguage(Object o) - { - m_oLanguage = o; - } - - /** Returns the list of values in the "Language"" drop down - list. - @return The list of values. - */ - public ChoiceDescriptor[] getLanguageChoices() - { - return m_cdLanguage; - } - - /////////////// - // Other Tab // - /////////////// - - /** Returns the value of the "Access type" group on the - Other tab. - @return The selected radio button. AJDSP_ACCESSTYPE_RW - returned when the "read/write" radio button is selected. - AJDSP_ACCESSTYPE_RC returned when the "read/call" - radio button is selected. AJDSP_ACCESSTYPE_RO returned - when the "read only" radio button is selected. - */ - public String getAccessTypeGroup() - { - return m_sAccessTypeGroup; - } - - /** Sets the value of the "Access type" group on the - Other tab. - @param s The radio button. AJDSP_ACCESSTYPE_RW if the - "read/write" radio button should be selected. - AJDSP_ACCESSTYPE_RC if the "read/call" radio button - should be selected. AJDSP_ACCESSTYPE_RO if the - (read only) radio button should be selected. - */ - public void setAccessTypeGroup(String s) - { - m_sAccessTypeGroup = s; - } - - /** Returns the value of the "Remarks source" group on the - Other tab. - @return The selected radio button. AJDSP_SQLDESC_RADIOBUTTON - returned when the "SQL" radio button is selected. - AJDSP_OS400DESC_RADIOBUTTON returned when the "OS/400" - radio button is selected. - */ - public String getRemarksSourceGroup() - { - return m_sRemarksSourceGroup; - } - - /** Sets the value of the "Remarks source" group on the - Other tab. - @param s The radio button. AJDSP_SQLDESC_RADIOBUTTON if the - "SQL" radio button should be selected. AJDSP_OS400DESC_RADIOBUTTON - if the "OS/400" radio button should be selected. - */ - public void setRemarksSourceGroup(String s) - { - m_sRemarksSourceGroup = s; - } - - ///////////////////// - // Translation Tab // - ///////////////////// - - /** Indicates whether the "Translate CCSID 65535" - check box on the Translation tab is checked. - @return True if the check box is checked - */ - public boolean isTranslate65535() - { - return m_bTranslate65535; - } - - /** Sets the value of the "Translate CCSID 65535" check - box on the Translation tab. - @param b The check box state. True if it should be checked, - false otherwise. - */ - public void setTranslate65535(boolean b) - { - m_bTranslate65535 = b; - } - - public boolean isTranslateHex() //@A2A - { //@A2A - return m_bTranslateHex; //@A2A - } //@A2A - - public void setTranslateHex(boolean b) //@A2A - { //@A2A - m_bTranslateHex = b; //@A2A - } //@A2A - - //////////////// - // Format Tab // - //////////////// - - /** Returns the value of the "Naming convention" field on the - Format tab. - @return The naming convention. - */ - public Object getNamingConvention() - { - return m_oNamingConvention; - } - - /** Sets the value of the "Naming convention" field on the - Format tab. - @param o The naming convention. - */ - public void setNamingConvention(Object o) - { - m_oNamingConvention = o; - } - - /** Returns the list of values in the "Naming convention"" drop down - list. - @return The list of values. - */ - public ChoiceDescriptor[] getNamingConventionChoices() - { - return m_cdNamingConvention; - } - - /** Returns the value of the "Decimal separator" field on the - Format tab. - @return The decimal separator. - */ - public Object getDecimalSeparator() - { - return m_oDecimalSeparator; - } - - /** Sets the value of the "Decimal separator" field on the - Format tab. - @param o The decimal separator. - */ - public void setDecimalSeparator(Object o) - { - m_oDecimalSeparator = o; - } - - /** Returns the list of values in the "Decimal separator"" drop down - list. - @return The list of values. - */ - public ChoiceDescriptor[] getDecimalSeparatorChoices() - { - return m_cdDecimalSeparator; - } - - /** Returns the value of the "Time format" field on the - Format tab. - @return The time format. - */ - public Object getTimeFormat() - { - return m_oTimeFormat; - } - - /** Sets the value of the "Time format" field on the - Format tab. - @param o The time format. - */ - public void setTimeFormat(Object o) - { - m_oTimeFormat = o; - } - - /** Returns the list of values in the "Time format" drop down - list. - @return The list of values. - */ - public ChoiceDescriptor[] getTimeFormatChoices() - { - return m_cdTimeFormat; - } - - /** Returns the value of the "Time separator" field on the - Format tab. - @return The time separator. - */ - public Object getTimeSeparator() - { - return m_oTimeSeparator; - } - - /** Sets the value of the "Time separator" field on the - Format tab. - @param o The time separator. - */ - public void setTimeSeparator(Object o) - { - m_oTimeSeparator = o; - } - - /** Returns the list of values in the "Time separator" drop down - list. - @return The list of values. - */ - public ChoiceDescriptor[] getTimeSeparatorChoices() - { - return m_cdTimeSeparator; - } - - /** Returns the value of the "Date format" field on the - Format tab. - @return The date format. - */ - public Object getDateFormat() - { - return m_oDateFormat; - } - - /** Sets the value of the "Date format" field on the - Format tab. - @param o The date format. - */ - public void setDateFormat(Object o) - { - m_oDateFormat = o; - } - - /** Returns the list of values in the "Date format" drop down - list. - @return The list of values. - */ - public ChoiceDescriptor[] getDateFormatChoices() - { - return m_cdDateFormat; - } - - /** Returns the value of the "Date separator" field on the - Format tab. - @return The date separator. - */ - public Object getDateSeparator() - { - return m_oDateSeparator; - } - - /** Sets the value of the "Date separator" field on the - Format tab. - @param o The date separator. - */ - public void setDateSeparator(Object o) - { - m_oDateSeparator = o; - } - - /** Returns the list of values in the "Date separator" drop down - list. - @return The list of values. - */ - public ChoiceDescriptor[] getDateSeparatorChoices() - { - return m_cdDateSeparator; - } - - //////////////////////////// - // Connection Options Tab // - //////////////////////////// - - /** Returns the value of the "Default user ID" field on the - Connection Options tab. - @return The naming convention. - */ - public String getDefaultUserID() - { - return m_sDefaultUserID; - } - - /** Sets the value of the "Default user ID" field on the - Connection Options tab. - @param s The user ID. - */ - public void setDefaultUserID(String s) - { - m_sDefaultUserID = s; - } - - /** Indicates whether the "SSL" - check box on the Translation tab is checked. - @return True if the check box is checked - */ - public boolean isUseSSL() - { - return m_bUseSSL; - } - - /** Sets the value of the "SSL" check - box on the Connection Options tab. - @param b The check box state. True if it should be checked, - false otherwise. - */ - public void setUseSSL(boolean b) - { - m_bUseSSL = b; - } - - /////////////////////////////////////////////////// - // General methods for dealing with all controls // - /////////////////////////////////////////////////// - - /** - Required by the framework. Not used. - */ - public Capabilities getCapabilities() - { - return null; - } - - /** - Required by the framework. Not used. - */ - public void verifyChanges() // Called with "prepareToCommit" on bean... - { - - } - - /** - Required by the framework. Not used. - */ - public void save() // Called with "commit" on bean... - { - - } - - /* Sets default values for all fields on all tabs. Also populates drop down lists. - */ - public void load() - { - String scratchString; - - // This method should be called once per pane object. It loads the pane with - // default values as well as setting up the combo box choices. - // General Tab - m_sDataSourceName = ""; - m_sDescription = ""; - m_sAS400Server = ""; - - // Server Tab - m_sSQLlibrary = ""; //@A1A - m_sDefaultLibraries = ""; - m_oCommitMode = null; - m_cdCommitMode = new ChoiceDescriptor[5]; - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_COMMIT_NONE"); - m_cdCommitMode[0] = new ChoiceDescriptor("AJDSP_COMMIT_NONE", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_COMMIT_CS"); - m_cdCommitMode[1] = new ChoiceDescriptor("AJDSP_COMMIT_CS", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_COMMIT_CHG"); - m_cdCommitMode[2] = new ChoiceDescriptor("AJDSP_COMMIT_CHG", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_COMMIT_ALL"); - m_cdCommitMode[3] = new ChoiceDescriptor("AJDSP_COMMIT_ALL", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_COMMIT_RR"); - m_cdCommitMode[4] = new ChoiceDescriptor("AJDSP_COMMIT_RR", scratchString); - - m_oMaxPrecision = null; //@A2A - m_cdMaxPrecision = new ChoiceDescriptor[2]; //@A2A - m_cdMaxPrecision[0] = new ChoiceDescriptor("AJDSP_MAXPREC_31", "31"); //@A2A - m_cdMaxPrecision[1] = new ChoiceDescriptor("AJDSP_MAXPREC_63", "63"); //@A2A - - m_oMaxScale = null; //@A2A - m_cdMaxScale = new ChoiceDescriptor[3]; //@A2A - m_cdMaxScale[0] = new ChoiceDescriptor("AJDSP_MAXSCALE_0", "0"); //@A2A - m_cdMaxScale[1] = new ChoiceDescriptor("AJDSP_MAXSCALE_31", "31"); //@A2A - m_cdMaxScale[2] = new ChoiceDescriptor("AJDSP_MAXSCALE_63", "63"); //@A2A - - m_oMinDivideScale = null; //@A2A - m_cdMinDivideScale = new ChoiceDescriptor[10]; //@A2A - m_cdMinDivideScale[0] = new ChoiceDescriptor("AJDSP_MINDIVSCALE_0", "0"); //@A2A - m_cdMinDivideScale[1] = new ChoiceDescriptor("AJDSP_MINDIVSCALE_1", "1"); //@A2A - m_cdMinDivideScale[2] = new ChoiceDescriptor("AJDSP_MINDIVSCALE_2", "2"); //@A2A - m_cdMinDivideScale[3] = new ChoiceDescriptor("AJDSP_MINDIVSCALE_3", "3"); //@A2A - m_cdMinDivideScale[4] = new ChoiceDescriptor("AJDSP_MINDIVSCALE_4", "4"); //@A2A - m_cdMinDivideScale[5] = new ChoiceDescriptor("AJDSP_MINDIVSCALE_5", "5"); //@A2A - m_cdMinDivideScale[6] = new ChoiceDescriptor("AJDSP_MINDIVSCALE_6", "6"); //@A2A - m_cdMinDivideScale[7] = new ChoiceDescriptor("AJDSP_MINDIVSCALE_7", "7"); //@A2A - m_cdMinDivideScale[8] = new ChoiceDescriptor("AJDSP_MINDIVSCALE_8", "8"); //@A2A - m_cdMinDivideScale[9] = new ChoiceDescriptor("AJDSP_MINDIVSCALE_9", "9"); //@A2A - - // Package Tab - m_bEnableExtDynamic = false; - m_sPackage = ""; - m_sPackageLibrary = ""; - m_sUsageGroup = ""; - m_sUnusablePkgActionGroup = ""; - m_bCachePackageLocally = false; - - // Performance Tab - m_bEnableLazyClose = false; - m_bEnablePrefetch = false; - m_bEnableDataCompression = false; - m_oRecordBlockingCriteria = null; - m_cdRecordBlockingCriteria = new ChoiceDescriptor[3]; - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_RECBLK_DISABLE"); - m_cdRecordBlockingCriteria[0] = new ChoiceDescriptor("AJDSP_RECBLK_DISABLE", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_RECBLK_FORFETCH"); - m_cdRecordBlockingCriteria[1] = new ChoiceDescriptor("AJDSP_RECBLK_FORFETCH", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_RECBLK_NOTUPDT"); - m_cdRecordBlockingCriteria[2] = new ChoiceDescriptor("AJDSP_RECBLK_NOTUPDT", scratchString); - m_oRecordBlockingSize = null; - m_cdRecordBlockingSize = new ChoiceDescriptor[8]; - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_BLOCK_SIZE_0"); - m_cdRecordBlockingSize[0] = new ChoiceDescriptor("AJDSP_BLOCK_SIZE_0", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_BLOCK_SIZE_8"); - m_cdRecordBlockingSize[1] = new ChoiceDescriptor("AJDSP_BLOCK_SIZE_8", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_BLOCK_SIZE_16"); - m_cdRecordBlockingSize[2] = new ChoiceDescriptor("AJDSP_BLOCK_SIZE_16", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_BLOCK_SIZE_32"); - m_cdRecordBlockingSize[3] = new ChoiceDescriptor("AJDSP_BLOCK_SIZE_32", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_BLOCK_SIZE_64"); - m_cdRecordBlockingSize[4] = new ChoiceDescriptor("AJDSP_BLOCK_SIZE_64", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_BLOCK_SIZE_128"); - m_cdRecordBlockingSize[5] = new ChoiceDescriptor("AJDSP_BLOCK_SIZE_128", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_BLOCK_SIZE_256"); - m_cdRecordBlockingSize[6] = new ChoiceDescriptor("AJDSP_BLOCK_SIZE_256", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_BLOCK_SIZE_512"); - m_cdRecordBlockingSize[7] = new ChoiceDescriptor("AJDSP_BLOCK_SIZE_512", scratchString); - m_oLOBThreshold = null; - m_cdLOBThreshold = new ChoiceDescriptor[11]; - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_LOB_THRESH_0"); - m_cdLOBThreshold[0] = new ChoiceDescriptor("AJDSP_LOB_THRESH_0", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_LOB_THRESH_32"); - m_cdLOBThreshold[1] = new ChoiceDescriptor("AJDSP_LOB_THRESH_32", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_LOB_THRESH_64"); - m_cdLOBThreshold[2] = new ChoiceDescriptor("AJDSP_LOB_THRESH_64", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_LOB_THRESH_128"); - m_cdLOBThreshold[3] = new ChoiceDescriptor("AJDSP_LOB_THRESH_128", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_LOB_THRESH_256"); - m_cdLOBThreshold[4] = new ChoiceDescriptor("AJDSP_LOB_THRESH_256", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_LOB_THRESH_512"); - m_cdLOBThreshold[5] = new ChoiceDescriptor("AJDSP_LOB_THRESH_512", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_LOB_THRESH_1024"); - m_cdLOBThreshold[6] = new ChoiceDescriptor("AJDSP_LOB_THRESH_1024", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_LOB_THRESH_2048"); - m_cdLOBThreshold[7] = new ChoiceDescriptor("AJDSP_LOB_THRESH_2048", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_LOB_THRESH_4096"); - m_cdLOBThreshold[8] = new ChoiceDescriptor("AJDSP_LOB_THRESH_4096", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_LOB_THRESH_8192"); - m_cdLOBThreshold[9] = new ChoiceDescriptor("AJDSP_LOB_THRESH_8192", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_LOB_THRESH_15360"); - m_cdLOBThreshold[10] = new ChoiceDescriptor("AJDSP_LOB_THRESH_15360", scratchString); - - // Language Tab - m_oSortType = null; - m_cdSortType = new ChoiceDescriptor[4]; - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTHEX"); - m_cdSortType[0] = new ChoiceDescriptor("AJDSP_SORTHEX", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTJOB"); - m_cdSortType[1] = new ChoiceDescriptor("AJDSP_SORTJOB", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLANGID"); - m_cdSortType[2] = new ChoiceDescriptor("AJDSP_SORTLANGID", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTTABLE"); - m_cdSortType[3] = new ChoiceDescriptor("AJDSP_SORTTABLE", scratchString); - m_sSortTable = ""; - m_sSortWeightGroup = ""; - m_oLanguage = null; - m_cdLanguage = new ChoiceDescriptor[59]; - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_AFR_TEXT"); - m_cdLanguage[0] = new ChoiceDescriptor("AJDSP_SORTLG_AFR_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_ARA_TEXT"); - m_cdLanguage[1] = new ChoiceDescriptor("AJDSP_SORTLG_ARA_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_BEL_TEXT"); - m_cdLanguage[2] = new ChoiceDescriptor("AJDSP_SORTLG_BEL_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_BGR_TEXT"); - m_cdLanguage[3] = new ChoiceDescriptor("AJDSP_SORTLG_BGR_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_CAT_TEXT"); - m_cdLanguage[4] = new ChoiceDescriptor("AJDSP_SORTLG_CAT_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_CHS_TEXT"); - m_cdLanguage[5] = new ChoiceDescriptor("AJDSP_SORTLG_CHS_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_CHT_TEXT"); - m_cdLanguage[6] = new ChoiceDescriptor("AJDSP_SORTLG_CHT_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_CSY_TEXT"); - m_cdLanguage[7] = new ChoiceDescriptor("AJDSP_SORTLG_CSY_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_DAN_TEXT"); - m_cdLanguage[8] = new ChoiceDescriptor("AJDSP_SORTLG_DAN_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_DES_TEXT"); - m_cdLanguage[9] = new ChoiceDescriptor("AJDSP_SORTLG_DES_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_DEU_TEXT"); - m_cdLanguage[10] = new ChoiceDescriptor("AJDSP_SORTLG_DEU_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_ELL_TEXT"); - m_cdLanguage[11] = new ChoiceDescriptor("AJDSP_SORTLG_ELL_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_ENA_TEXT"); - m_cdLanguage[12] = new ChoiceDescriptor("AJDSP_SORTLG_ENA_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_ENB_TEXT"); - m_cdLanguage[13] = new ChoiceDescriptor("AJDSP_SORTLG_ENB_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_ENG_TEXT"); - m_cdLanguage[14] = new ChoiceDescriptor("AJDSP_SORTLG_ENG_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_ENP_TEXT"); - m_cdLanguage[15] = new ChoiceDescriptor("AJDSP_SORTLG_ENP_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_ENU_TEXT"); - m_cdLanguage[16] = new ChoiceDescriptor("AJDSP_SORTLG_ENU_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_ESP_TEXT"); - m_cdLanguage[17] = new ChoiceDescriptor("AJDSP_SORTLG_ESP_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_EST_TEXT"); - m_cdLanguage[18] = new ChoiceDescriptor("AJDSP_SORTLG_EST_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_FAR_TEXT"); - m_cdLanguage[19] = new ChoiceDescriptor("AJDSP_SORTLG_FAR_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_FIN_TEXT"); - m_cdLanguage[20] = new ChoiceDescriptor("AJDSP_SORTLG_FIN_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_FRA_TEXT"); - m_cdLanguage[21] = new ChoiceDescriptor("AJDSP_SORTLG_FRA_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_FRB_TEXT"); - m_cdLanguage[22] = new ChoiceDescriptor("AJDSP_SORTLG_FRB_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_FRC_TEXT"); - m_cdLanguage[23] = new ChoiceDescriptor("AJDSP_SORTLG_FRC_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_FRS_TEXT"); - m_cdLanguage[24] = new ChoiceDescriptor("AJDSP_SORTLG_FRS_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_GAE_TEXT"); - m_cdLanguage[25] = new ChoiceDescriptor("AJDSP_SORTLG_GAE_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_HEB_TEXT"); - m_cdLanguage[26] = new ChoiceDescriptor("AJDSP_SORTLG_HEB_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_HRV_TEXT"); - m_cdLanguage[27] = new ChoiceDescriptor("AJDSP_SORTLG_HRV_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_HUN_TEXT"); - m_cdLanguage[28] = new ChoiceDescriptor("AJDSP_SORTLG_HUN_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_ISL_TEXT"); - m_cdLanguage[29] = new ChoiceDescriptor("AJDSP_SORTLG_ISL_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_ITA_TEXT"); - m_cdLanguage[30] = new ChoiceDescriptor("AJDSP_SORTLG_ITA_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_ITS_TEXT"); - m_cdLanguage[31] = new ChoiceDescriptor("AJDSP_SORTLG_ITS_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_JPN_TEXT"); - m_cdLanguage[32] = new ChoiceDescriptor("AJDSP_SORTLG_JPN_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_KOR_TEXT"); - m_cdLanguage[33] = new ChoiceDescriptor("AJDSP_SORTLG_KOR_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_LAO_TEXT"); - m_cdLanguage[34] = new ChoiceDescriptor("AJDSP_SORTLG_LAO_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_LTU_TEXT"); - m_cdLanguage[35] = new ChoiceDescriptor("AJDSP_SORTLG_LTU_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_LVA_TEXT"); - m_cdLanguage[36] = new ChoiceDescriptor("AJDSP_SORTLG_LVA_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_MKD_TEXT"); - m_cdLanguage[37] = new ChoiceDescriptor("AJDSP_SORTLG_MKD_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_NLB_TEXT"); - m_cdLanguage[38] = new ChoiceDescriptor("AJDSP_SORTLG_NLB_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_NLD_TEXT"); - m_cdLanguage[39] = new ChoiceDescriptor("AJDSP_SORTLG_NLD_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_NON_TEXT"); - m_cdLanguage[40] = new ChoiceDescriptor("AJDSP_SORTLG_NON_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_NOR_TEXT"); - m_cdLanguage[41] = new ChoiceDescriptor("AJDSP_SORTLG_NOR_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_PLK_TEXT"); - m_cdLanguage[42] = new ChoiceDescriptor("AJDSP_SORTLG_PLK_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_PTB_TEXT"); - m_cdLanguage[43] = new ChoiceDescriptor("AJDSP_SORTLG_PTB_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_PTG_TEXT"); - m_cdLanguage[44] = new ChoiceDescriptor("AJDSP_SORTLG_PTG_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_RMS_TEXT"); - m_cdLanguage[45] = new ChoiceDescriptor("AJDSP_SORTLG_RMS_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_ROM_TEXT"); - m_cdLanguage[46] = new ChoiceDescriptor("AJDSP_SORTLG_ROM_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_RUS_TEXT"); - m_cdLanguage[47] = new ChoiceDescriptor("AJDSP_SORTLG_RUS_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_SKY_TEXT"); - m_cdLanguage[48] = new ChoiceDescriptor("AJDSP_SORTLG_SKY_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_SLO_TEXT"); - m_cdLanguage[49] = new ChoiceDescriptor("AJDSP_SORTLG_SLO_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_SQI_TEXT"); - m_cdLanguage[50] = new ChoiceDescriptor("AJDSP_SORTLG_SQI_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_SRB_TEXT"); - m_cdLanguage[51] = new ChoiceDescriptor("AJDSP_SORTLG_SRB_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_SRL_TEXT"); - m_cdLanguage[52] = new ChoiceDescriptor("AJDSP_SORTLG_SRL_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_SVE_TEXT"); - m_cdLanguage[53] = new ChoiceDescriptor("AJDSP_SORTLG_SVE_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_THA_TEXT"); - m_cdLanguage[54] = new ChoiceDescriptor("AJDSP_SORTLG_THA_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_TRK_TEXT"); - m_cdLanguage[55] = new ChoiceDescriptor("AJDSP_SORTLG_TRK_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_UKR_TEXT"); - m_cdLanguage[56] = new ChoiceDescriptor("AJDSP_SORTLG_UKR_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_URD_TEXT"); - m_cdLanguage[57] = new ChoiceDescriptor("AJDSP_SORTLG_URD_TEXT", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_SORTLG_VIE_TEXT"); - m_cdLanguage[58] = new ChoiceDescriptor("AJDSP_SORTLG_VIE_TEXT", scratchString); - - // Other Tab - m_sAccessTypeGroup = ""; - m_sRemarksSourceGroup = ""; - - // Translation Tab - m_bTranslate65535 = false; - m_bTranslateHex = false; //@A2A - - // Format Tab - m_oNamingConvention = null; - m_cdNamingConvention = new ChoiceDescriptor[2]; - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_NAMING_SQL"); - m_cdNamingConvention[0] = new ChoiceDescriptor("AJDSP_NAMING_SQL", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_NAMING_SYSTEM"); - m_cdNamingConvention[1] = new ChoiceDescriptor("AJDSP_NAMING_SYSTEM", scratchString); - m_oDecimalSeparator = null; - m_cdDecimalSeparator = new ChoiceDescriptor[3]; - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_USE_SERVER_JOB"); - m_cdDecimalSeparator[0] = new ChoiceDescriptor("AJDSP_USE_SERVER_JOB", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_DECIMAL_PERIOD"); - m_cdDecimalSeparator[1] = new ChoiceDescriptor("AJDSP_DECIMAL_PERIOD", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_DECIMAL_COMMA"); - m_cdDecimalSeparator[2] = new ChoiceDescriptor("AJDSP_DECIMAL_COMMA", scratchString); - m_oTimeFormat = null; - m_cdTimeFormat = new ChoiceDescriptor[6]; - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_USE_SERVER_JOB"); - m_cdTimeFormat[0] = new ChoiceDescriptor("AJDSP_USE_SERVER_JOB", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_TIMEFMT_HMS"); - m_cdTimeFormat[1] = new ChoiceDescriptor("AJDSP_TIMEFMT_HMS", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_TIMEFMT_USA"); - m_cdTimeFormat[2] = new ChoiceDescriptor("AJDSP_TIMEFMT_USA", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_TIMEFMT_ISO"); - m_cdTimeFormat[3] = new ChoiceDescriptor("AJDSP_TIMEFMT_ISO", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_TIMEFMT_EUR"); - m_cdTimeFormat[4] = new ChoiceDescriptor("AJDSP_TIMEFMT_EUR", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_TIMEFMT_JIS"); - m_cdTimeFormat[5] = new ChoiceDescriptor("AJDSP_TIMEFMT_JIS", scratchString); - m_oTimeSeparator = null; - m_cdTimeSeparator = new ChoiceDescriptor[5]; - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_USE_SERVER_JOB"); - m_cdTimeSeparator[0] = new ChoiceDescriptor("AJDSP_USE_SERVER_JOB", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_TIMESEP_COLON"); - m_cdTimeSeparator[1] = new ChoiceDescriptor("AJDSP_TIMESEP_COLON", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_TIMESEP_PERIOD"); - m_cdTimeSeparator[2] = new ChoiceDescriptor("AJDSP_TIMESEP_PERIOD", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_TIMESEP_COMMA"); - m_cdTimeSeparator[3] = new ChoiceDescriptor("AJDSP_TIMESEP_COMMA", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_TIMESEP_BLANK"); - m_cdTimeSeparator[4] = new ChoiceDescriptor("AJDSP_TIMESEP_BLANK", scratchString); - m_oDateFormat = null; - m_cdDateFormat = new ChoiceDescriptor[9]; - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_USE_SERVER_JOB"); - m_cdDateFormat[0] = new ChoiceDescriptor("AJDSP_USE_SERVER_JOB", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_DATEFMT_JULIAN"); - m_cdDateFormat[1] = new ChoiceDescriptor("AJDSP_DATEFMT_JULIAN", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_DATEFMT_MDY"); - m_cdDateFormat[2] = new ChoiceDescriptor("AJDSP_DATEFMT_MDY", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_DATEFMT_DMY"); - m_cdDateFormat[3] = new ChoiceDescriptor("AJDSP_DATEFMT_DMY", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_DATEFMT_YMD"); - m_cdDateFormat[4] = new ChoiceDescriptor("AJDSP_DATEFMT_YMD", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_DATEFMT_USA"); - m_cdDateFormat[5] = new ChoiceDescriptor("AJDSP_DATEFMT_USA", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_DATEFMT_ISO"); - m_cdDateFormat[6] = new ChoiceDescriptor("AJDSP_DATEFMT_ISO", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_DATEFMT_EUR"); - m_cdDateFormat[7] = new ChoiceDescriptor("AJDSP_DATEFMT_EUR", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_DATEFMT_JIS"); - m_cdDateFormat[8] = new ChoiceDescriptor("AJDSP_DATEFMT_JIS", scratchString); - m_oDateSeparator = null; - m_cdDateSeparator = new ChoiceDescriptor[6]; - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_USE_SERVER_JOB"); - m_cdDateSeparator[0] = new ChoiceDescriptor("AJDSP_USE_SERVER_JOB", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_DATESEP_FORWARDSLASH"); - m_cdDateSeparator[1] = new ChoiceDescriptor("AJDSP_DATESEP_FORWARDSLASH", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_DATESEP_DASH"); - m_cdDateSeparator[2] = new ChoiceDescriptor("AJDSP_DATESEP_DASH", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_DATESEP_PERIOD"); - m_cdDateSeparator[3] = new ChoiceDescriptor("AJDSP_DATESEP_PERIOD", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_DATESEP_COMMA"); - m_cdDateSeparator[4] = new ChoiceDescriptor("AJDSP_DATESEP_COMMA", scratchString); - scratchString = AS400JDBCDataSourcePane.resource_Loader.getString("AJDSP_DATESEP_BLANK"); - m_cdDateSeparator[5] = new ChoiceDescriptor("AJDSP_DATESEP_BLANK", scratchString); - - // Connection Options Tab - m_sDefaultUserID = ""; - m_bUseSSL = false; - } -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePaneGUI.java b/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePaneGUI.java deleted file mode 100644 index 3ed6c2184..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePaneGUI.java +++ /dev/null @@ -1,324 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400JDBCDataSourcePaneGUI.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; -/** -Locale-specific objects for the IBM Toolbox for Java. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class AS400JDBCDataSourcePaneGUI extends java.util.ListResourceBundle { - // NLS_MESSAGEFORMAT_NONE - // Each string is assumed NOT to be processed by the MessageFormat class. - // This means that a single quote must be coded as 1 single quote. - - // NLS_ENCODING=UTF-8 - // Instructs the translation tools to interpret the text as UTF-8. - - public Object[][] getContents() { return contents; } - static final Object[][] contents = { - {"@FileEditorBounds", "31,101,428,323"}, - {"@GenerateBeans", "1"}, - {"@GenerateHandlers", "1"}, - {"@Serialize", "1"}, - {"@StringEditorBounds", "132,142,926,796"}, - {"AJDSP_BADCHARACTERS", "[]{}()?*=!@,;"}, - {"AJDSP_BADDSN", "The data source name is not valid. Make sure the data source name begins with an alphabetic character and does not contain any of the following characters: \\n [ ] { } ( ) ? * = ! @ , ;"}, - {"AJDSP_BLOCK_SIZE_0", "0"}, - {"AJDSP_BLOCK_SIZE_1", "1"}, - {"AJDSP_BLOCK_SIZE_128", "128"}, - {"AJDSP_BLOCK_SIZE_16", "16"}, - {"AJDSP_BLOCK_SIZE_2", "2"}, - {"AJDSP_BLOCK_SIZE_256", "256"}, - {"AJDSP_BLOCK_SIZE_32", "32"}, - {"AJDSP_BLOCK_SIZE_4", "4"}, - {"AJDSP_BLOCK_SIZE_512", "512"}, - {"AJDSP_BLOCK_SIZE_64", "64"}, - {"AJDSP_BLOCK_SIZE_8", "8"}, - {"AJDSP_COMMIT_ALL", "Repeatable read (*ALL)"}, - {"AJDSP_COMMIT_CHG", "Read uncommitted (*CHG)"}, - {"AJDSP_COMMIT_CS", "Read committed (*CS )"}, - {"AJDSP_COMMIT_NONE", "Commit immediate (*NONE)"}, - {"AJDSP_COMMIT_RR", "Serializable (*RR)"}, - {"AJDSP_CONNECTION", "General"}, - {"AJDSP_CONNOPT", "Connection Options"}, - {"AJDSP_CONNOPT.AJDSP_DEFAULT_USER_LABEL", "Default user ID:"}, - {"AJDSP_CONNOPT.AJDSP_DEFAULT_USERID_TEXTBOX", ""}, - {"AJDSP_CONNOPT.AJDSP_SSL_CHECKBOX", "Use Secured Sockets Layer (SSL)"}, - {"AJDSP_CONNOPT.EditorBounds", "118,25,1000,637"}, - {"AJDSP_CONNOPTTITLE", "Connection Options"}, - {"AJDSP_DATEFMT_DMY", "dd/mm/yy (*DMY)"}, - {"AJDSP_DATEFMT_EUR", "dd.mm.yyyy (*EUR)"}, - {"AJDSP_DATEFMT_ISO", "yyyy-mm-dd (*ISO)"}, - {"AJDSP_DATEFMT_JIS", "yyyy-mm-dd (*JIS)"}, - {"AJDSP_DATEFMT_JULIAN", "yy/ddd (*JUL)"}, - {"AJDSP_DATEFMT_MDY", "mm/dd/yy (*MDY)"}, - {"AJDSP_DATEFMT_USA", "mm/dd/yyyy (*USA)"}, - {"AJDSP_DATEFMT_YMD", "yy/mm/dd (*YMD)"}, - {"AJDSP_DATESEP_BLANK", " (blank)"}, - {"AJDSP_DATESEP_COMMA", ", (comma)"}, - {"AJDSP_DATESEP_DASH", "- (dash)"}, - {"AJDSP_DATESEP_FORWARDSLASH", "/ (forward slash)"}, - {"AJDSP_DATESEP_PERIOD", ". (period)"}, - {"AJDSP_DECIMAL_COMMA", ", (comma)"}, - {"AJDSP_DECIMAL_PERIOD", ". (period)"}, - {"AJDSP_ERROR", "Error"}, - {"AJDSP_FORMAT", "Format"}, - {"AJDSP_FORMAT.AJDSP_DATE_FORMAT_COMBOBOX.EditorBounds", "50,125,454,250"}, - {"AJDSP_FORMAT.AJDSP_DATE_FORMAT_LABEL", "Format: "}, - {"AJDSP_FORMAT.AJDSP_DATE_GROUPBOX", "Date"}, - {"AJDSP_FORMAT.AJDSP_DATE_SEP_COMBOBOX.EditorBounds", "75,150,454,250"}, - {"AJDSP_FORMAT.AJDSP_DATE_SEP_LABEL", "Separator: "}, - {"AJDSP_FORMAT.AJDSP_DECIMAL_COMBOBOX.EditorBounds", "0,75,454,250"}, - {"AJDSP_FORMAT.AJDSP_DECIMAL_LABEL", "Decimal separator: "}, - {"AJDSP_FORMAT.AJDSP_NAMING_COMBOBOX.EditorBounds", "70,347,454,250"}, - {"AJDSP_FORMAT.AJDSP_NAMING_LABEL", "Naming convention: "}, - {"AJDSP_FORMAT.AJDSP_TIME_FORMAT_COMBOBOX.EditorBounds", "50,125,454,250"}, - {"AJDSP_FORMAT.AJDSP_TIME_FORMAT_LABEL", "Format: "}, - {"AJDSP_FORMAT.AJDSP_TIME_GROUPBOX", "Time"}, - {"AJDSP_FORMAT.AJDSP_TIME_SEP_COMBOBOX.EditorBounds", "29,99,454,250"}, - {"AJDSP_FORMAT.AJDSP_TIME_SEP_LABEL", "Separator: "}, - {"AJDSP_FORMAT.EditorBounds", "245,280,972,648"}, - {"AJDSP_GENERAL", "General"}, - {"AJDSP_GENERAL.AJDSP_AS400SERVER_LABEL", "System:"}, //@550 - {"AJDSP_GENERAL.AJDSP_AS400SERVER_TEXTBOX", ""}, - {"AJDSP_GENERAL.AJDSP_DATASOURCE_NAME_LABEL", "Data source name:"}, - {"AJDSP_GENERAL.AJDSP_DATASOURCE_NAME_TEXTBOX", ""}, - {"AJDSP_GENERAL.AJDSP_DESCRIPTION_LABEL", "Description:"}, - {"AJDSP_GENERAL.AJDSP_DESCRIPTION_TEXTBOX", ""}, - {"AJDSP_GENERAL.EditorBounds", "285,10,1008,648"}, - {"AJDSP_LANGUAGE", "Language"}, - {"AJDSP_LANGUAGE.AJDSP_LANGUAGE_COMBOBOX.EditorBounds", "50,125,454,250"}, - {"AJDSP_LANGUAGE.AJDSP_LANGUAGE_LABEL", "Language:"}, - {"AJDSP_LANGUAGE.AJDSP_SHAREDWEIGHT_RADIOBUTTON", "Shared"}, - {"AJDSP_LANGUAGE.AJDSP_SORTTABLE_LABEL", "Sort library/table name:"}, - {"AJDSP_LANGUAGE.AJDSP_SORTTABLE_TEXTBOX", ""}, - {"AJDSP_LANGUAGE.AJDSP_SORTTYPE_COMBOBOX.EditorBounds", "25,100,454,250"}, - {"AJDSP_LANGUAGE.AJDSP_SORTTYPE_LABEL", "Sort based on:"}, - {"AJDSP_LANGUAGE.AJDSP_SORTWEIGHT_LABEL", "Sort weight:"}, - {"AJDSP_LANGUAGE.AJDSP_UNIQUEWEIGHT_RADIOBUTTON", "Unique"}, - {"AJDSP_LANGUAGE.EditorBounds", "274,27,974,662"}, - {"AJDSP_LIBVIEW_ALL", "All libraries on the system"}, - {"AJDSP_LIBVIEW_LIBLIST", "Default library list"}, - {"AJDSP_LOB_THRESH_0", "0"}, - {"AJDSP_LOB_THRESH_1024", "1024"}, - {"AJDSP_LOB_THRESH_128", "128"}, - {"AJDSP_LOB_THRESH_15360", "15360"}, - {"AJDSP_LOB_THRESH_2048", "2048"}, - {"AJDSP_LOB_THRESH_256", "256"}, - {"AJDSP_LOB_THRESH_32", "32"}, - {"AJDSP_LOB_THRESH_4096", "4096"}, - {"AJDSP_LOB_THRESH_512", "512"}, - {"AJDSP_LOB_THRESH_64", "64"}, - {"AJDSP_LOB_THRESH_8192", "8192"}, - {"AJDSP_NAMING_SQL", "SQL (*SQL)"}, - {"AJDSP_NAMING_SYSTEM", "System (*SYS)"}, - {"AJDSP_NEED_PWD", "Password must be supplied. "}, - {"AJDSP_NODSN", "A valid data source name must be supplied."}, - {"AJDSP_NOT_SET", "Not set"}, - {"AJDSP_NOTSECURE", "Not secured"}, - {"AJDSP_OTHER", "Other"}, - {"AJDSP_OTHER.AJDSP_ACCESSTYPE_LABEL", "Access type:"}, - {"AJDSP_OTHER.AJDSP_ACCESSTYPE_RC", "Allow select and call statements only (read/call)"}, - {"AJDSP_OTHER.AJDSP_ACCESSTYPE_RO", "Allow select statements only (read only)"}, - {"AJDSP_OTHER.AJDSP_ACCESSTYPE_RW", "Allow all SQL statements (read/write)"}, - {"AJDSP_OTHER.AJDSP_OS400DESC_RADIOBUTTON", "Object description "}, - {"AJDSP_OTHER.AJDSP_REMARKSSOURCE_LABEL", "Remarks source:"}, - {"AJDSP_OTHER.AJDSP_SQLDESC_RADIOBUTTON", "SQL object comment "}, - {"AJDSP_OTHER.EditorBounds", "230,32,968,662"}, - {"AJDSP_PACKAGE", "Package"}, - {"AJDSP_PACKAGE.AJDSP_CACHE_PACKAGE_CHECKBOX", "Cache package locally"}, - {"AJDSP_PACKAGE.AJDSP_EXTDYNAMIC_CHECKBOX", "Enable extended dynamic (package) support"}, - {"AJDSP_PACKAGE.AJDSP_IGNORE_RADIOBUTTON", "Ignore"}, - {"AJDSP_PACKAGE.AJDSP_PACKAGE_LABEL", "Package:"}, - {"AJDSP_PACKAGE.AJDSP_PACKAGE_TEXTBOX", ""}, - {"AJDSP_PACKAGE.AJDSP_PACKAGELIB_LABEL", "Package library:"}, - {"AJDSP_PACKAGE.AJDSP_PACKAGELIB_TEXTBOX", ""}, - {"AJDSP_PACKAGE.AJDSP_POST_WARN_RADIOBUTTON", "Post warning"}, - {"AJDSP_PACKAGE.AJDSP_SEND_EXCEP_RADIOBUTTON", "Send exception"}, - {"AJDSP_PACKAGE.AJDSP_UNUSABLE_ACTION_LABEL", "Unusable package action:"}, - {"AJDSP_PACKAGE.AJDSP_USAGE_LABEL", "Usage:"}, - {"AJDSP_PACKAGE.AJDSP_USE_RADIOBUTTON", "Use"}, - {"AJDSP_PACKAGE.AJDSP_USEADD_RADIOBUTTON", "Use and add"}, - {"AJDSP_PACKAGE.EditorBounds", "264,7,904,663"}, - {"AJDSP_PERFORMANCE", "Performance"}, - {"AJDSP_PERFORMANCE.AJDSP_BLOCKING_CRITERIA_COMBOBOX.EditorBounds", "25,100,454,250"}, - {"AJDSP_PERFORMANCE.AJDSP_BLOCKING_CRITERIA_LABEL", "Criteria: "}, - {"AJDSP_PERFORMANCE.AJDSP_BLOCKING_SIZE_COMBOBOX.EditorBounds", "0,75,454,250"}, - {"AJDSP_PERFORMANCE.AJDSP_BLOCKING_SIZE_LABEL", "Size: "}, - {"AJDSP_PERFORMANCE.AJDSP_COMPRESSION_CHECKBOX", " Enable data compression"}, - {"AJDSP_PERFORMANCE.AJDSP_LAZY_CLOSE_CHECKBOX", " Enable lazy close support "}, - {"AJDSP_PERFORMANCE.AJDSP_LOB_THRESHOLD_COMBOBOX.EditorBounds", "0,75,454,250"}, - {"AJDSP_PERFORMANCE.AJDSP_LOB_THRESHOLD_LABEL", "Large object threshold: "}, - {"AJDSP_PERFORMANCE.AJDSP_PREFETCH_CHECKBOX", " Enable pre-fetch"}, - {"AJDSP_PERFORMANCE.AJDSP_RECORD_BLOCKING_LABEL", "Record blocking:"}, - {"AJDSP_PERFORMANCE.EditorBounds", "291,3,972,648"}, - {"AJDSP_RECBLK_DISABLE", "Disabled record blocking"}, - {"AJDSP_RECBLK_FORFETCH", "Block if FOR FETCH ONLY specified"}, - {"AJDSP_RECBLK_NOTUPDT", "Block except if FOR UPDATE OF specified"}, - {"AJDSP_RMDSTITLE", "Refresh Managed Data Sources"}, - {"AJDSP_SECURESSL", "Secured with Secured Sockets Layer (SSL)"}, - {"AJDSP_SERVER", "System"}, //@550 - {"AJDSP_SERVER.AJDSP_COMMIT_MODE_COMBOBOX.EditorBounds", "12,159,454,250"}, - {"AJDSP_SERVER.AJDSP_COMMIT_MODE_LABEL", "Commit mode: "}, - {"AJDSP_SERVER.AJDSP_DFT_LIBS_LABEL", "Library list:"}, - {"AJDSP_SERVER.AJDSP_DFT_LIBS_TEXTBOX", ""}, - {"AJDSP_SERVER.AJDSP_DFT_SQLLIB_LABEL", "SQL default library:"}, - {"AJDSP_SERVER.AJDSP_SQL_DEFLIB_TEXTBOX", ""}, - {"AJDSP_SERVER.DECIMALPROPSGRPBOX", "Decimal properties"}, - {"AJDSP_SERVER.EditorBounds", "515,39,719,554"}, - {"AJDSP_SERVER.MAX_PRECISIONLBL", "Maximum precision (31 or 63):"}, - {"AJDSP_SERVER.MAX_SCALE_LBL", "Maximum scale (0-63):"}, - {"AJDSP_SERVER.MIN_DIV_SCALE_LBL", "Minimum divide scale (0-9):"}, - {"AJDSP_SERVER1", "System"}, //@550 - {"AJDSP_SORTHEX", "HEX values"}, - {"AJDSP_SORTJOB", "Job profile"}, - {"AJDSP_SORTLANGID", "Language ID"}, - {"AJDSP_SORTLG_AFR", "AFR"}, - {"AJDSP_SORTLG_AFR_TEXT", "Afrikaans"}, - {"AJDSP_SORTLG_ARA", "ARA"}, - {"AJDSP_SORTLG_ARA_TEXT", "Arabic"}, - {"AJDSP_SORTLG_BEL", "BEL"}, - {"AJDSP_SORTLG_BEL_TEXT", "Byelorussian"}, - {"AJDSP_SORTLG_BGR", "BGR"}, - {"AJDSP_SORTLG_BGR_TEXT", "Bulgarian"}, - {"AJDSP_SORTLG_CAT", "CAT"}, - {"AJDSP_SORTLG_CAT_TEXT", "Catalan"}, - {"AJDSP_SORTLG_CHS", "CHS"}, - {"AJDSP_SORTLG_CHS_TEXT", "Simplified Chinese"}, - {"AJDSP_SORTLG_CHT", "CHT"}, - {"AJDSP_SORTLG_CHT_TEXT", "Traditional Chinese"}, - {"AJDSP_SORTLG_CSY", "CSY"}, - {"AJDSP_SORTLG_CSY_TEXT", "Czech"}, - {"AJDSP_SORTLG_DAN", "DAN"}, - {"AJDSP_SORTLG_DAN_TEXT", "Danish"}, - {"AJDSP_SORTLG_DES", "DES"}, - {"AJDSP_SORTLG_DES_TEXT", "Swiss German"}, - {"AJDSP_SORTLG_DEU", "DEU"}, - {"AJDSP_SORTLG_DEU_TEXT", "German"}, - {"AJDSP_SORTLG_ELL", "ELL"}, - {"AJDSP_SORTLG_ELL_TEXT", "Greek"}, - {"AJDSP_SORTLG_ENA", "ENA"}, - {"AJDSP_SORTLG_ENA_TEXT", "Australian English"}, - {"AJDSP_SORTLG_ENB", "ENB"}, - {"AJDSP_SORTLG_ENB_TEXT", "Belgian English"}, - {"AJDSP_SORTLG_ENG", "ENG"}, - {"AJDSP_SORTLG_ENG_TEXT", "United Kingdom English"}, - {"AJDSP_SORTLG_ENP", "ENP"}, - {"AJDSP_SORTLG_ENP_TEXT", "Uppercase English"}, - {"AJDSP_SORTLG_ENU", "ENU"}, - {"AJDSP_SORTLG_ENU_TEXT", "United States English"}, - {"AJDSP_SORTLG_ESP", "ESP"}, - {"AJDSP_SORTLG_ESP_TEXT", "Spanish"}, - {"AJDSP_SORTLG_EST", "EST"}, - {"AJDSP_SORTLG_EST_TEXT", "Estonian"}, - {"AJDSP_SORTLG_FAR", "FAR"}, - {"AJDSP_SORTLG_FAR_TEXT", "Farsi"}, - {"AJDSP_SORTLG_FIN", "FIN"}, - {"AJDSP_SORTLG_FIN_TEXT", "Finnish"}, - {"AJDSP_SORTLG_FRA", "FRA"}, - {"AJDSP_SORTLG_FRA_TEXT", "French"}, - {"AJDSP_SORTLG_FRB", "FRB"}, - {"AJDSP_SORTLG_FRB_TEXT", "Belgian French"}, - {"AJDSP_SORTLG_FRC", "FRC"}, - {"AJDSP_SORTLG_FRC_TEXT", "Canadian French"}, - {"AJDSP_SORTLG_FRS", "FRS"}, - {"AJDSP_SORTLG_FRS_TEXT", "Swiss French"}, - {"AJDSP_SORTLG_GAE", "GAE"}, - {"AJDSP_SORTLG_GAE_TEXT", "Irish Gaelic"}, - {"AJDSP_SORTLG_HEB", "HEB"}, - {"AJDSP_SORTLG_HEB_TEXT", "Hebrew"}, - {"AJDSP_SORTLG_HRV", "HRV"}, - {"AJDSP_SORTLG_HRV_TEXT", "Croatian"}, - {"AJDSP_SORTLG_HUN", "HUN"}, - {"AJDSP_SORTLG_HUN_TEXT", "Hungarian"}, - {"AJDSP_SORTLG_ISL", "ISL"}, - {"AJDSP_SORTLG_ISL_TEXT", "Icelandic"}, - {"AJDSP_SORTLG_ITA", "ITA"}, - {"AJDSP_SORTLG_ITA_TEXT", "Italian"}, - {"AJDSP_SORTLG_ITS", "ITS"}, - {"AJDSP_SORTLG_ITS_TEXT", "Swiss Italian"}, - {"AJDSP_SORTLG_JPN", "JPN"}, - {"AJDSP_SORTLG_JPN_TEXT", "Japanese Katakana"}, - {"AJDSP_SORTLG_KOR", "KOR"}, - {"AJDSP_SORTLG_KOR_TEXT", "Korean"}, - {"AJDSP_SORTLG_LAO", "LAO"}, - {"AJDSP_SORTLG_LAO_TEXT", "Lao"}, - {"AJDSP_SORTLG_LTU", "LTU"}, - {"AJDSP_SORTLG_LTU_TEXT", "Lithuanian"}, - {"AJDSP_SORTLG_LVA", "LVA"}, - {"AJDSP_SORTLG_LVA_TEXT", "Latvian"}, - {"AJDSP_SORTLG_MKD", "MKD"}, - {"AJDSP_SORTLG_MKD_TEXT", "Macedonian"}, - {"AJDSP_SORTLG_NLB", "NLB"}, - {"AJDSP_SORTLG_NLB_TEXT", "Belgian Dutch"}, - {"AJDSP_SORTLG_NLD", "NLD"}, - {"AJDSP_SORTLG_NLD_TEXT", "Dutch"}, - {"AJDSP_SORTLG_NON", "NON"}, - {"AJDSP_SORTLG_NON_TEXT", "Norwegian Nynorsk"}, - {"AJDSP_SORTLG_NOR", "NOR"}, - {"AJDSP_SORTLG_NOR_TEXT", "Norwegian Bokmal"}, - {"AJDSP_SORTLG_PLK", "PLK"}, - {"AJDSP_SORTLG_PLK_TEXT", "Polish"}, - {"AJDSP_SORTLG_PTB", "PTB"}, - {"AJDSP_SORTLG_PTB_TEXT", "Brazilian Portuguese"}, - {"AJDSP_SORTLG_PTG", "PTG"}, - {"AJDSP_SORTLG_PTG_TEXT", "Portuguese"}, - {"AJDSP_SORTLG_RMS", "RMS"}, - {"AJDSP_SORTLG_RMS_TEXT", "Rhaeto-Romanic"}, - {"AJDSP_SORTLG_ROM", "ROM"}, - {"AJDSP_SORTLG_ROM_TEXT", "Romanian"}, - {"AJDSP_SORTLG_RUS", "RUS"}, - {"AJDSP_SORTLG_RUS_TEXT", "Russian"}, - {"AJDSP_SORTLG_SKY", "SKY"}, - {"AJDSP_SORTLG_SKY_TEXT", "Slovakian"}, - {"AJDSP_SORTLG_SLO", "SLO"}, - {"AJDSP_SORTLG_SLO_TEXT", "Slovenian"}, - {"AJDSP_SORTLG_SQI", "SQI"}, - {"AJDSP_SORTLG_SQI_TEXT", "Albanian"}, - {"AJDSP_SORTLG_SRB", "SRB"}, - {"AJDSP_SORTLG_SRB_TEXT", "Serbian Cyrillic"}, - {"AJDSP_SORTLG_SRL", "SRL"}, - {"AJDSP_SORTLG_SRL_TEXT", "Serbian Latin"}, - {"AJDSP_SORTLG_SVE", "SVE"}, - {"AJDSP_SORTLG_SVE_TEXT", "Swedish"}, - {"AJDSP_SORTLG_THA", "THA"}, - {"AJDSP_SORTLG_THA_TEXT", "Thai"}, - {"AJDSP_SORTLG_TRK", "TRK"}, - {"AJDSP_SORTLG_TRK_TEXT", "Turkish"}, - {"AJDSP_SORTLG_UKR", "UKR"}, - {"AJDSP_SORTLG_UKR_TEXT", "Ukrainian"}, - {"AJDSP_SORTLG_URD", "URD"}, - {"AJDSP_SORTLG_URD_TEXT", "Urdu"}, - {"AJDSP_SORTLG_VIE", "VIE"}, - {"AJDSP_SORTLG_VIE_TEXT", "Vietnamese"}, - {"AJDSP_SORTTABLE", "Specified table"}, - {"AJDSP_SORTWEIGHT99", "Sort Weight"}, - {"AJDSP_TABBEDPANE", "Tabbed Pane"}, - {"AJDSP_TABBEDPANE.EditorBounds", "8,277,454,250"}, - {"AJDSP_TIMEFMT_EUR", "hh.mm.ss (*EUR)"}, - {"AJDSP_TIMEFMT_HMS", "hh:mm:ss (*HMS)"}, - {"AJDSP_TIMEFMT_ISO", "hh.mm.ss (*ISO)"}, - {"AJDSP_TIMEFMT_JIS", "hh:mm:ss (*JIS)"}, - {"AJDSP_TIMEFMT_USA", "hh:mm AM/PM (*USA)"}, - {"AJDSP_TIMESEP_BLANK", " (blank)"}, - {"AJDSP_TIMESEP_COLON", ": (colon)"}, - {"AJDSP_TIMESEP_COMMA", ", (comma)"}, - {"AJDSP_TIMESEP_PERIOD", ". (period)"}, - {"AJDSP_TRANSLATION", "Translation"}, - {"AJDSP_TRANSLATION.AJDSP_TRANSLATE_65535_CHECKBOX", "Translate CCSID 65535"}, - {"AJDSP_TRANSLATION.AJDSP_TRANSLATE_HEX_CHECKBOX", "Interpret SQL hexadecimal constants as binary data"}, - {"AJDSP_TRANSLATION.EditorBounds", "20,102,715,554"}, - {"AJDSP_USE_SERVER_JOB", "Use server job value"}, - {"AJDSP_USE_UID_DEFAULT", "Use Default"} - }; -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePaneGUI.pdml b/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePaneGUI.pdml deleted file mode 100644 index 3f7ec620e..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400JDBCDataSourcePaneGUI.pdml +++ /dev/null @@ -1,535 +0,0 @@ - - - - - AJDSP_CONNOPT - 500,400 - - - AJDSP_CONNOPT.AJDSP_DEFAULT_USERID_TEXTBOX - 245,30 - 134,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - DefaultUserID - - - - AJDSP_CONNOPT.AJDSP_SSL_CHECKBOX - 10,75 - 472,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - UseSSL - - - - AJDSP_FORMAT - 500,400 - - - 10,35 - 300,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - NamingConvention - - - - 10,90 - 300,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - DecimalSeparator - - - AJDSP_FORMAT.AJDSP_TIME_GROUPBOX - 10,120 - 340,125 - - - - 25,161 - 300,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - TimeFormat - - - - 25,211 - 300,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - TimeSeparator - - - AJDSP_FORMAT.AJDSP_DATE_GROUPBOX - 10,255 - 340,126 - - - - 25,296 - 300,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - DateFormat - - - - 25,346 - 300,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - DateSeparator - - - - AJDSP_GENERAL - 500,400 - - - AJDSP_GENERAL.AJDSP_DATASOURCE_NAME_TEXTBOX - 10,45 - 478,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - DataSourceName - - - - - AJDSP_GENERAL.AJDSP_DESCRIPTION_TEXTBOX - 10,113 - 478,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - Description - - - - - AJDSP_GENERAL.AJDSP_AS400SERVER_TEXTBOX - 10,183 - 200,21 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - AS400Server - - - - - AJDSP_LANGUAGE - 500,400 - - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - SortWeightGroup - - - - 10,40 - 312,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - SortType - - - - AJDSP_LANGUAGE.AJDSP_SORTTABLE_TEXTBOX - 10,111 - 312,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - SortTable - - - - - AJDSP_LANGUAGE.AJDSP_SHAREDWEIGHT_RADIOBUTTON - 25,188 - 455,22 - - - AJDSP_LANGUAGE.AJDSP_UNIQUEWEIGHT_RADIOBUTTON - 25,222 - 455,22 - - - - 10,300 - 312,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - Language - - - - - AJDSP_OTHER - 500,400 - - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - AccessTypeGroup - - - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - RemarksSourceGroup - - - - AJDSP_OTHER.AJDSP_ACCESSTYPE_RW - 25,34 - 454,20 - - - AJDSP_OTHER.AJDSP_ACCESSTYPE_RC - 25,58 - 463,20 - - - AJDSP_OTHER.AJDSP_ACCESSTYPE_RO - 25,83 - 462,20 - - - - AJDSP_OTHER.AJDSP_OS400DESC_RADIOBUTTON - 25,151 - 450,20 - - - AJDSP_OTHER.AJDSP_SQLDESC_RADIOBUTTON - 25,175 - 454,20 - - - - AJDSP_PACKAGE - 500,400 - - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - UsageGroup - - - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - UnusablePkgActionGroup - - - AJDSP_PACKAGE.AJDSP_EXTDYNAMIC_CHECKBOX - 10,10 - 475,22 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - EnableExtDynamic - - AJDSP_PACKAGE_LABEL,AJDSP_PACKAGELIB_LABEL,AJDSP_PACKAGE_TEXTBOX,AJDSP_PACKAGELIB_TEXTBOX,AJDSP_USAGE_LABEL,AJDSP_USE_RADIOBUTTON,AJDSP_USEADD_RADIOBUTTON,AJDSP_UNUSABLE_ACTION_LABEL,AJDSP_SEND_EXCEP_RADIOBUTTON,AJDSP_POST_WARN_RADIOBUTTON,AJDSP_IGNORE_RADIOBUTTON,AJDSP_CACHE_PACKAGE_CHECKBOX - - - AJDSP_PACKAGE_LABEL,AJDSP_PACKAGELIB_LABEL,AJDSP_PACKAGE_TEXTBOX,AJDSP_PACKAGELIB_TEXTBOX,AJDSP_USAGE_LABEL,AJDSP_USE_RADIOBUTTON,AJDSP_USEADD_RADIOBUTTON,AJDSP_UNUSABLE_ACTION_LABEL,AJDSP_SEND_EXCEP_RADIOBUTTON,AJDSP_POST_WARN_RADIOBUTTON,AJDSP_IGNORE_RADIOBUTTON,AJDSP_CACHE_PACKAGE_CHECKBOX - - - - - AJDSP_PACKAGE.AJDSP_PACKAGE_TEXTBOX - 244,54 - 242,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - Package - - - - - AJDSP_PACKAGE.AJDSP_PACKAGELIB_TEXTBOX - 244,80 - 242,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - PackageLibrary - - - - - AJDSP_PACKAGE.AJDSP_USE_RADIOBUTTON - 40,145 - 451,22 - - - AJDSP_PACKAGE.AJDSP_USEADD_RADIOBUTTON - 40,175 - 451,22 - - - - AJDSP_PACKAGE.AJDSP_SEND_EXCEP_RADIOBUTTON - 40,244 - 290,22 - - - AJDSP_PACKAGE.AJDSP_POST_WARN_RADIOBUTTON - 40,274 - 290,22 - - - AJDSP_PACKAGE.AJDSP_IGNORE_RADIOBUTTON - 40,303 - 290,22 - - - AJDSP_PACKAGE.AJDSP_CACHE_PACKAGE_CHECKBOX - 25,350 - 318,22 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - CachePackageLocally - - - - AJDSP_PERFORMANCE - 500,400 - - AJDSP_PERFORMANCE.AJDSP_LAZY_CLOSE_CHECKBOX - 10,11 - 475,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - EnableLazyClose - - - AJDSP_PERFORMANCE.AJDSP_PREFETCH_CHECKBOX - 10,45 - 474,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - EnablePrefetch - - - AJDSP_PERFORMANCE.AJDSP_COMPRESSION_CHECKBOX - 10,79 - 472,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - EnableDataCompression - - - - - 25,170 - 320,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - RecordBlockingCriteria - - - - 25,235 - 320,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - RecordBlockingSize - - - - 10,318 - 320,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - LOBThreshold - - - - - AJDSP_SERVER - 500,400 - - - AJDSP_SERVER.AJDSP_SQL_DEFLIB_TEXTBOX - 7,42 - 182,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - SQLlibrary - - - - - AJDSP_SERVER.AJDSP_DFT_LIBS_TEXTBOX - 7,103 - 446,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - DefaultLibraries - - - - - 7,165 - 380,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - CommitMode - - - AJDSP_SERVER.DECIMALPROPSGRPBOX - 7,209 - 446,179 - - - - 27,249 - 161,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - MaxPrecision - - - - 27,302 - 161,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - MaxScale - - - - - 27,355 - 161,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - MinDivideScale - - - - AJDSP_TRANSLATION - 500,400 - - AJDSP_TRANSLATION.AJDSP_TRANSLATE_65535_CHECKBOX - 10,10 - 480,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - Translate65535 - - - AJDSP_TRANSLATION.AJDSP_TRANSLATE_HEX_CHECKBOX - 10,54 - 484,20 - com.ibm.as400.vaccess.AS400JDBCDataSourcePaneDataBean - TranslateHex - - - - AJDSP_TABBEDPANE - - - - - - - - - - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400ListModel.java b/cvsroot/src/com/ibm/as400/vaccess/AS400ListModel.java deleted file mode 100644 index 8f11c63a8..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400ListModel.java +++ /dev/null @@ -1,500 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400ListModel.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import javax.swing.ListModel; -import javax.swing.event.ListDataListener; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.Vector; - - - -/** -The AS400ListModel class implements an underlying model for -a list, where all information for the model is gathered -from the contents of a system resource, known as the root. -You must explicitly call load() to load the information from -the system. - -

    Use this class if you want to customize the graphical -user interface that presents a list. If you do not need -to customize the interface, then use AS400ListPane instead. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    AS400ListModel objects generate the following events: -

      -
    • ErrorEvent -
    • ListDataEvent -
    • PropertyChangeEvent -
    • WorkingEvent -
    - -

    The following example creates a list model filled with -the contents of a directory in the integrated file system -of a system. It then presents the list in a JList object. - -

    -// Set up the list model and JList.
    -AS400 system = new AS400 ("MySystem", "Userid", "Password");
    -VIFSDirectory directory = new VIFSDirectory (system, "/myDirectory");
    -AS400ListModel listModel = new AS400ListModel (directory);
    -listModel.load ();
    -JList list = new JList (listModel);
    -
    -// Add the JList to a frame. -JFrame frame = new JFrame ("My Window"); -frame.getContentPane().add(new JScrollPane(list)); - -
    - -@see AS400ListPane -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class AS400ListModel -implements ListModel, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Properties. - VNode root_ = null; // Private. - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient ListDataEventSupport listDataEventSupport_; // Private. - transient private VObjectListener objectListener_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - transient private WorkingEventSupport workingEventSupport_; - - - -/** -Constructs an AS400ListModel object. -**/ - public AS400ListModel () - { - initializeTransient (); - } - - - -/** -Constructs an AS400ListModel object. - -@param root The root, or the system resource, from which all information for the model is gathered. -**/ - public AS400ListModel (VNode root) - { - if (root == null) - throw new NullPointerException ("root"); - - root_ = root; - initializeTransient (); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when the contents of -the list change. - -@param listener The listener. -**/ - public void addListDataListener (ListDataListener listener) - { - listDataEventSupport_.addListDataListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Returns the element at the specifed index. - -@param index The index. -@return The element at the specified index. It will be null if the index - is not valid or the root has not been set. -**/ - public Object getElementAt (int index) - { - // Make sure the root has been set. - if (root_ == null) - return null; - - // Validate the index. - if ((index < 0) || (index >= root_.getDetailsChildCount ())) - return null; - - // Return the element. - return root_.getDetailsChildAt (index); - } - - - -/** -Returns the root, or the system resource, from which all information for the model is gathered. - -@return The root, or the system resource, from which all information for the model is gathered. It will be null if none has been set. -**/ - public VNode getRoot () - { - return root_; - } - - - -/** -Returns the number of objects in the list. - -@return The number of objects in the list. - -**/ - public int getSize () - { - // Make sure the root has been set. - if (root_ == null) - return 0; - - return root_.getDetailsChildCount (); - } - - - -/** -Initializes transient data. -**/ - private void initializeTransient () - { - // Initialize event support. - errorEventSupport_ = new ErrorEventSupport (this); - listDataEventSupport_ = new ListDataEventSupport (this); - objectListener_ = new VObjectListener_ (); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - if (root_ != null) { - root_.addErrorListener (errorEventSupport_); - root_.addVObjectListener (objectListener_); - root_.addWorkingListener (workingEventSupport_); - } - } - - - -/** -Loads the information from the system. -**/ - public void load () - { - int previousCount = getSize (); - - if (root_ != null) { - root_.load (); - - // Load each of the children so that there attributes - // are reflected. - int rowCount = root_.getDetailsChildCount (); - for (int i = 0; i < rowCount; ++i) { - VObject detailsChild = root_.getDetailsChildAt (i); - if (detailsChild != null) - root_.getDetailsChildAt (i); - } - } - - listDataEventSupport_.fireIntervalRemoved (0, previousCount); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a list data listener. - -@param listener The listener. -**/ - public void removeListDataListener (ListDataListener listener) - { - listDataEventSupport_.removeListDataListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** - Sets the root, or the system resource, from which all information for the model is gathered. It will not take effect until load() is done. - - -@param root The root, or the system resource, from which all information for the model is gathered. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setRoot (VNode root) - throws PropertyVetoException - { - if (root == null) - throw new NullPointerException ("root"); - - VNode oldValue = root_; - VNode newValue = root; - vetoableChangeSupport_.fireVetoableChange ("root", oldValue, newValue); - - if (oldValue != newValue) { - - // Get the size before. - int oldSize; - if (root_ == null) - oldSize = 0; - else - oldSize = root_.getDetailsChildCount (); - - // Redirect event support. - if (oldValue != null) { - oldValue.removeErrorListener (errorEventSupport_); - oldValue.removeVObjectListener (objectListener_); - oldValue.removeWorkingListener (workingEventSupport_); - } - newValue.addErrorListener (errorEventSupport_); - newValue.addVObjectListener (objectListener_); - newValue.addWorkingListener (workingEventSupport_); - - // Set the root. - root_ = newValue; - - // Clear the contents of the list. - listDataEventSupport_.fireContentsChanged (0, oldSize); - } - - propertyChangeSupport_.firePropertyChange ("root", oldValue, newValue); - } - - - -/** -Sorts the contents. The propertyIdentifer[0], orders[0] combination is used to do the sort. If the values are equal, propertyIdentifier[1], orders[1] is used to break the tie, and so forth. - -@param propertyIdentifiers The property identifiers. If any of - the property identifiers are null, it - indicates to sort using the string - representation of the object. -@param orders The sort orders for each property - identifier; true for ascending order, - false for descending order. -**/ - public void sort (Object[] propertyIdentifiers, boolean[] orders) - { - if (propertyIdentifiers == null) - throw new NullPointerException ("propertyIdentifiers"); - if (orders == null) - throw new NullPointerException ("orders"); - - if (root_ != null) { - if (root_.isSortable ()) { - root_.sortDetailsChildren (propertyIdentifiers, orders); - listDataEventSupport_.fireContentsChanged (0, getSize ()); - } - } - } - - - -/** -Listens for explorer events and adjusts the model accordingly. -**/ - private class VObjectListener_ - implements VObjectListener, Serializable - { - - - - public void objectChanged (VObjectEvent event) - { - VObject object = event.getObject (); - - // If the changed object is the root, - // then reload the whole model. - if (object == root_) { // @A1C - if (! event.isDuringLoad ()) // @A1A - load (); - listDataEventSupport_.fireContentsChanged (0, // @A1A - root_.getDetailsChildCount ()); // @A1A - } // @A1A - - // If the changed object is contained in the list, - // then fix up its row. - else { - int index = root_.getDetailsIndex (object); - if (index >= 0) - listDataEventSupport_.fireContentsChanged (index, index); - } - } - - - - public void objectCreated (VObjectEvent event) - { - VObject object = event.getObject (); - VNode parent = event.getParent (); - - // If the created object is contained in the list, - // then insert it into the list. - if (parent == root_) { - int index = root_.getDetailsIndex (object); - if (index >= 0) - listDataEventSupport_.fireIntervalAdded (index, index); - } - } - - - - public void objectDeleted (VObjectEvent event) - { - VObject object = event.getObject (); - - // If the deleted object is contained in the list, - // then remove it from the list. - int index = root_.getDetailsIndex (object); - if (index >= 0) - listDataEventSupport_.fireIntervalRemoved (index, index); - } - - } -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400ListModel16.gif b/cvsroot/src/com/ibm/as400/vaccess/AS400ListModel16.gif deleted file mode 100644 index b0b33a558..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/AS400ListModel16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400ListModel32.gif b/cvsroot/src/com/ibm/as400/vaccess/AS400ListModel32.gif deleted file mode 100644 index d121cdb37..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/AS400ListModel32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400ListModelBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/AS400ListModelBeanInfo.java deleted file mode 100644 index ad9f8dd01..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400ListModelBeanInfo.java +++ /dev/null @@ -1,191 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400ListModelBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.event.ListDataListener; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The AS400ListModelBeanInfo class provides bean information -for the AS400ListModel class. - -@see AS400ListModel -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class AS400ListModelBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = AS400ListModel.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - String[] listDataMethods = { "contentsChanged", "intervalAdded", "intervalRemoved" }; - EventSetDescriptor listData = new EventSetDescriptor (beanClass_, - "listData", ListDataListener.class, listDataMethods, - "addListDataListener", "removeListDataListener"); - listData.setDisplayName (ResourceLoader.getText ("EVT_NAME_LIST_DATA")); - listData.setShortDescription (ResourceLoader.getText ("EVT_DESC_LIST_DATA")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { error, listData, propertyChange, - vetoableChange, working }; - - // Properties. - PropertyDescriptor root = new PropertyDescriptor ("root", beanClass_); - root.setBound (true); - root.setConstrained (true); - root.setDisplayName (ResourceLoader.getText ("PROP_NAME_ROOT")); - root.setShortDescription (ResourceLoader.getText ("PROP_DESC_ROOT")); - - properties_ = new PropertyDescriptor[] { root }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // root. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("AS400ListModel16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("AS400ListModel32.gif"); - break; - } - return image; - } - - - -/** - Returns the descriptors for all properties. - @return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400ListPane.java b/cvsroot/src/com/ibm/as400/vaccess/AS400ListPane.java deleted file mode 100644 index 75ce7b33c..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400ListPane.java +++ /dev/null @@ -1,633 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400ListPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.CellEditor; -import javax.swing.JComponent; -import javax.swing.JList; -import javax.swing.JScrollPane; -import javax.swing.ListModel; -import javax.swing.ListSelectionModel; -import javax.swing.event.ListDataListener; -import javax.swing.event.ListSelectionListener; -import java.awt.BorderLayout; -import java.awt.Frame; -import java.awt.Point; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; - - - -/** -The AS400ListPane class represents a graphical user interface -that presents a list of the contents of a system resource, -known as the root. You must explicitly call load() to load the -information from the system. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    AS400ListPane objects generate the following events: -

      -
    • ErrorEvent -
    • ListSelectionEvent -
    • PropertyChangeEvent -
    - -

    The following example creates a list pane filled with -the list of printers on a system. - -

    -// Set up the list pane.
    -AS400 system = new AS400 ("MySystem", "Userid", "Password");
    -VPrinters printers = new VPrinters (system);
    -AS400ListPane listPane = new AS400ListPane (printers);
    -listPane.load ();
    -
    -// Add the list pane to a frame. -JFrame frame = new JFrame ("My Window"); -frame.getContentPane().add (listPane); -
    - -@see AS400ListModel -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class AS400ListPane -extends JComponent -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Properties. - boolean allowActions_ = false; // Private. - boolean confirm_ = true; // Private. - JList list_ = null; // Private. - AS400ListModel model_ = null; // Private. - - - - // Private data. - transient private VActionContext actionContext_; - transient private DoubleClickAdapter doubleClickAdapter_; - transient private PopupMenuAdapter popupMenuAdapter_; - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private ListSelectionEventSupport listSelectionEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - - - -/** -Constructs an AS400ListPane object. -**/ - public AS400ListPane () - { - // Initialize the model. - model_ = new AS400ListModel (); - - // Initialize the list. - list_ = new JList (model_); - list_.setCellRenderer (new VObjectCellRenderer ()); - - // Layout the pane. - setLayout (new BorderLayout ()); - add ("Center", new JScrollPane (list_)); - - initializeTransient (); - } - - - -/** -Constructs an AS400ListPane object. - -@param root The root, or the system resource, from which all information for the model is gathered. - -**/ - public AS400ListPane (VNode root) - { - this (); - - if (root == null) - throw new NullPointerException ("root"); - - try { - model_.setRoot (root); - } - catch (PropertyVetoException e) { - // Ignore. - } - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when a list selection occurs. - -@param listener The listener. -**/ - public void addListSelectionListener (ListSelectionListener listener) - { - listSelectionEventSupport_.addListSelectionListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - super.addPropertyChangeListener (listener); - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - super.addVetoableChangeListener (listener); - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - -/** -Returns the context in which actions will be performed. - -@return The action context. -**/ - public VActionContext getActionContext () - { - return actionContext_; - } - - - -/** -Indicates if actions can be invoked on objects. - -@return true if actions can be invoked; false otherwise. -**/ - public boolean getAllowActions () - { - return allowActions_; - } - - - -/** -Indicates if certain actions are confirmed with the user. - -@return true if certain actions are confirmed with the user; - false otherwise. -**/ - public boolean getConfirm () - { - return confirm_; - } - - - -/** -Returns the list model. - -@return The list model. -**/ - public ListModel getModel () - { - return model_; - } - - - -/** -Returns the root, or the system resource, from which all information for the model is gathered. - -@return The root, or the system resource, from which all information for the model is gathered. It will be null if none has been set. -**/ - public VNode getRoot () - { - return model_.getRoot (); - } - - - -/** -Returns the first selected object. - -@return The first selected object, or null if none are - selected. -**/ - public VObject getSelectedObject () - { - VObject selectedObject = null; - int selectedIndex = list_.getSelectedIndex (); - if (selectedIndex >= 0) - selectedObject = (VObject) model_.getElementAt (selectedIndex); - return selectedObject; - } - - - -/** -Returns the selected objects. - -@return The selected objects. -**/ - public VObject[] getSelectedObjects () - { - int[] selectedIndices = list_.getSelectedIndices (); - int selectedCount = selectedIndices.length; - VObject[] selectedObjects = new VObject[selectedCount]; - for (int i = 0; i < selectedCount; ++i) - selectedObjects[i] = (VObject) model_.getElementAt (selectedIndices[i]); - return selectedObjects; - } - - - -/** -Returns the selection model that is used to maintain -selection state. This provides the ability to programmatically -select and deselect objects. - -@return The selection model. -**/ - public ListSelectionModel getSelectionModel () - { - return list_.getSelectionModel (); - } - - - -/** -Returns the preferred number of visible rows. - -@return The preferred number of visible rows. -**/ - public int getVisibleRowCount () - { - return list_.getVisibleRowCount (); - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - listSelectionEventSupport_ = new ListSelectionEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - - - model_.addErrorListener (errorEventSupport_); - model_.addPropertyChangeListener (propertyChangeSupport_); - model_.addVetoableChangeListener (vetoableChangeSupport_); - list_.getSelectionModel ().addListSelectionListener (listSelectionEventSupport_); - - // Initialize the action context. - actionContext_ = new VActionContext_ (); - - // Initialize the other adapters. - model_.addWorkingListener (new WorkingCursorAdapter (list_)); - - VPane_ pane = new VPane_ (); - doubleClickAdapter_ = new DoubleClickAdapter (pane, actionContext_); - popupMenuAdapter_ = new PopupMenuAdapter (pane, actionContext_); - } - - - -/** -Indicates if the object is selected. - -@param object The object. -@return true if the object is selected; false otherwise. -**/ - public boolean isSelected (VObject object) - { - if (object == null) - throw new NullPointerException ("object"); - - Object[] selectedObjects = list_.getSelectedValues (); - for (int i = 0; i < selectedObjects.length; ++i) - if ((VObject) selectedObjects[i] == object) - return true; - return false; - } - - - -/** -Loads the information from the system. -**/ - public void load () - { - list_.clearSelection (); - model_.load (); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a list selection listener. - -@param listener The listener. -**/ - public void removeListSelectionListener (ListSelectionListener listener) - { - listSelectionEventSupport_.removeListSelectionListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - super.removePropertyChangeListener (listener); - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener (VetoableChangeListener listener) - { - super.removeVetoableChangeListener (listener); - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** -Sets whether actions are allowed. The following are enabled only when -actions are allowed: - -
      -
    • popup menu on selected object -
    • double clicking on a object performs the default action. -
    - -

    The default is false. - -@param allowActions true if actions are allowed; false otherwise. -**/ - public void setAllowActions (boolean allowActions) - { - if (allowActions_ != allowActions) { - - allowActions_ = allowActions; - - if (allowActions_) { - list_.addMouseListener (popupMenuAdapter_); - list_.addMouseListener (doubleClickAdapter_); - } - else { - list_.removeMouseListener (popupMenuAdapter_); - list_.removeMouseListener (doubleClickAdapter_); - } - } - } - - - -/** -Sets whether certain actions are confirmed with the user. The default -is true. - -@param confirm true if certain actions are confirmed with the - user; false otherwise. -**/ - public void setConfirm (boolean confirm) - { - confirm_ = confirm; - } - - - -/** -Sets the root, or the system resource, from which all information for the model is gathered. It will not take effect until load() is done. - -@param root The root, or the system resource, from which all information for the model is gathered. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setRoot (VNode root) - throws PropertyVetoException - { - if (root == null) - throw new NullPointerException ("root"); - - list_.clearSelection (); - model_.setRoot (root); - } - - - -/** -Sets the selection model that is used to maintain selection -state. This provides the ability to programmatically select -and deselect objects. - -@param selectionModel The selection model. -**/ - public void setSelectionModel (ListSelectionModel selectionModel) - { - if (selectionModel == null) - throw new NullPointerException ("selectionModel"); - - // Do not dispatch events from the old selection model any more. - ListSelectionModel oldSelectionModel = list_.getSelectionModel (); - oldSelectionModel.removeListSelectionListener (listSelectionEventSupport_); - - list_.setSelectionModel (selectionModel); - - // Dispatch events from the new selection model. - selectionModel.addListSelectionListener (listSelectionEventSupport_); - } - - - -/** -Sets the preferred number of visible rows. - -@param visibleRowCount The preferred number of visible rows. -**/ - public void setVisibleRowCount (int visibleRowCount) - { - list_.setVisibleRowCount (visibleRowCount); - } - - - -/** -Sorts the contents. The propertyIdentifer[0], orders[0] combination is used to do the sort. If the values are equal, propertyIdentifier[1], orders[1] is used to break the tie, and so forth. - - -@param propertyIdentifiers The property identifiers. If any of - the property identifiers are null, it - means to sort using the string - representation of the object. -@param orders The sort orders for each property - identifier; true for ascending order, - false for descending order. -**/ - public void sort (Object[] propertyIdentifiers, boolean[] orders) - { - if (propertyIdentifiers == null) - throw new NullPointerException ("propertyIdentifiers"); - if (orders == null) - throw new NullPointerException ("orders"); - - model_.sort (propertyIdentifiers, orders); - } - - - -/** -Implements the VActionContext interface. -**/ - private class VActionContext_ - implements VActionContext, Serializable - { - public boolean getConfirm () - { - return confirm_; - } - - public Frame getFrame () - { - return VUtilities.getFrame (AS400ListPane.this); - } - - public CellEditor startEditing (VObject object, Object propertyIdentifier) - { - if (object == null) - throw new NullPointerException ("object"); - if (propertyIdentifier == null) - throw new NullPointerException ("propertyIdentifier"); - - // Edits are not allowed because Swing does not - // provide a ListCellEditor. - return null; - } - }; - - - -/** -Implements the VPane interface. -**/ - private class VPane_ - implements VPane, Serializable - { - - public VObject getObjectAt (Point point) - { - VObject object = null; - int row = list_.locationToIndex (point); - if (row != -1) - object = (VObject) model_.getElementAt (row); - return object; - } - - public VNode getRoot () - { - return AS400ListPane.this.getRoot (); - } - - public void setRoot (VNode root) - throws PropertyVetoException - { - AS400ListPane.this.setRoot (root); - } - - }; - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400ListPane16.gif b/cvsroot/src/com/ibm/as400/vaccess/AS400ListPane16.gif deleted file mode 100644 index b50677025..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/AS400ListPane16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400ListPane32.gif b/cvsroot/src/com/ibm/as400/vaccess/AS400ListPane32.gif deleted file mode 100644 index 284ef1937..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/AS400ListPane32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400ListPaneBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/AS400ListPaneBeanInfo.java deleted file mode 100644 index 63d091c1d..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400ListPaneBeanInfo.java +++ /dev/null @@ -1,214 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400ListPaneBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.event.ListSelectionListener; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The AS400ListPaneBeanInfo class provides bean information -for the AS400ListPane class. - -@see AS400ListPane -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class AS400ListPaneBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = AS400ListPane.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor listSelection = new EventSetDescriptor (beanClass_, - "listSelection", ListSelectionListener.class, "valueChanged"); - listSelection.setDisplayName (ResourceLoader.getText ("EVT_NAME_LIST_SELECTION")); - listSelection.setShortDescription (ResourceLoader.getText ("EVT_DESC_LIST_SELECTION")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - events_ = new EventSetDescriptor[] { error, listSelection, propertyChange, - vetoableChange }; - - // Properties. - PropertyDescriptor allowActions = new PropertyDescriptor ("allowActions", beanClass_); - allowActions.setBound (false); - allowActions.setConstrained (false); - allowActions.setDisplayName (ResourceLoader.getText ("PROP_NAME_ALLOW_ACTIONS")); - allowActions.setShortDescription (ResourceLoader.getText ("PROP_DESC_ALLOW_ACTIONS")); - - PropertyDescriptor confirm = new PropertyDescriptor ("confirm", beanClass_); - confirm.setBound (false); - confirm.setConstrained (false); - confirm.setDisplayName (ResourceLoader.getText ("PROP_NAME_CONFIRM")); - confirm.setShortDescription (ResourceLoader.getText ("PROP_DESC_CONFIRM")); - - PropertyDescriptor model = new PropertyDescriptor ("model", beanClass_, - "getModel", null); - model.setBound (false); - model.setConstrained (false); - model.setDisplayName (ResourceLoader.getText ("PROP_NAME_MODEL")); - model.setShortDescription (ResourceLoader.getText ("PROP_DESC_MODEL")); - - PropertyDescriptor root = new PropertyDescriptor ("root", beanClass_); - root.setBound (true); - root.setConstrained (true); - root.setDisplayName (ResourceLoader.getText ("PROP_NAME_ROOT")); - root.setShortDescription (ResourceLoader.getText ("PROP_DESC_ROOT")); - - PropertyDescriptor selectionModel = new PropertyDescriptor ("selectionModel", beanClass_); - selectionModel.setBound (false); - selectionModel.setConstrained (false); - selectionModel.setDisplayName (ResourceLoader.getText ("PROP_NAME_SELECTION_MODEL")); - selectionModel.setShortDescription (ResourceLoader.getText ("PROP_DESC_SELECTION_MODEL")); - - PropertyDescriptor visibleRowCount = new PropertyDescriptor ("visibleRowCount", beanClass_); - visibleRowCount.setBound (false); - visibleRowCount.setConstrained (false); - visibleRowCount.setDisplayName (ResourceLoader.getText ("PROP_NAME_VISIBLE_ROW_COUNT")); - visibleRowCount.setShortDescription (ResourceLoader.getText ("PROP_DESC_VISIBLE_ROW_COUNT")); - - properties_ = new PropertyDescriptor[] { allowActions, confirm, model, - root, selectionModel, visibleRowCount}; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 3; // root. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("AS400ListPane16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("AS400ListPane32.gif"); - break; - } - return image; - } - - - -/** - Returns the descriptors for all properties. - @return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400TreeModel.java b/cvsroot/src/com/ibm/as400/vaccess/AS400TreeModel.java deleted file mode 100644 index b21549cd8..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400TreeModel.java +++ /dev/null @@ -1,568 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400TreeModel.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.event.TreeModelListener; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreeNode; -import javax.swing.tree.TreePath; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.Hashtable; -import java.util.Vector; - - - -/** -The AS400TreeModel class implements an underlying model for -a tree, where all information for the tree is gathered from -the hierarchy of objects rooted at a system resource. -You must explicitly call load() to load the information from -the system. - -

    Use this class if you want to customize the graphical -user interface that presents a tree. If you do not need -to customize the interface, then use AS400TreePane instead. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    AS400TreeModel objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • TreeModelEvent -
    • WorkingEvent -
    - -

    The following example creates a tree model filled with -the list of printers on a system. It then presents the tree -in a JTree object. - -

    -//Set up the tree model and JTree.
    -AS400 system = new AS400 ("MySystem", "Userid", "Password");
    -VPrinters printers = new VPrinters (system);
    -AS400TreeModel treeModel = new AS400TreeModel (printers);
    -treeModel.load ();
    -JTree tree = new JTree (treeModel);
    -
    -// Add the JTree to a frame. -JFrame frame = new JFrame ("My Window"); -frame.getContentPane().add(new JScrollPane(tree)); - - -
    - -@see AS400TreePane -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class AS400TreeModel -implements TreeModel, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Properties. - VNode root_ = null; // Private. - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private VObjectListener objectListener_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient TreeModelEventSupport treeModelEventSupport_; // Private. - transient private VetoableChangeSupport vetoableChangeSupport_; - transient private WorkingEventSupport workingEventSupport_; - - - -/** -Constructs an AS400TreeModel object. -**/ - public AS400TreeModel () - { - initializeTransient (); - } - - - -/** -Constructs an AS400TreeModel object. - -@param root The root, or the system resource, from which all information for the model is gathered. -**/ - public AS400TreeModel (VNode root) - { - if (root == null) - throw new NullPointerException ("root"); - - root_ = root; - initializeTransient (); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - - -/** -Adds a listener to be notified when the contents of -the tree change. - -@param listener The listener. -**/ - public void addTreeModelListener (TreeModelListener listener) - { - treeModelEventSupport_.addTreeModelListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Returns a child of the parent. - -@param parent The parent. -@param index The index of the child. -@return The child. It will be null if the parent is - not a valid object or if the index is not - valid for the parent. -**/ - public Object getChild (Object parent, int index) - { - // Validate the parent. - if (parent == null) - return null; - if (! (parent instanceof VNode)) - return null; - - // Validate the index. - int childCount = ((VNode) parent).getChildCount (); - if ((index < 0) || (index >= childCount)) - return null; - - return ((VNode) parent).getChildAt (index); - } - - - -/** -Returns the number of children of the parent. - -@param parent The parent. -@return The number of children of the parent, or - 0 if the parent is not a valid object. -**/ - public int getChildCount (Object parent) - { - // Validate the parent. - if (parent == null) - return 0; - if (! (parent instanceof VNode)) - return 0; - - return ((VNode) parent).getChildCount (); - } - - - -/** -Returns the index of a child in the parent. - -@param parent The parent. -@param child The child. -@return The index of the child in the parent. It will be -1 - if the parent or child are not valid objects or - if the child is not in the parent. -**/ - public int getIndexOfChild (Object parent, Object child) - { - // Validate the parent. - if (parent == null) - return -1; - if (! (parent instanceof VNode)) - return -1; - - // Validate the child. - if (child == null) - return -1; - if (! (child instanceof VNode)) - return -1; - - return ((VNode) parent).getIndex ((VNode) child); - } - - - -/** -Returns the path from the root to get to this object in the tree -hierarchy. The last element in the path will be this object. - -@param object The object. -@return The path, or null if the object is not a valid - object. -**/ - public TreePath getPath (Object object) - { - // Validate the object. - if (object == null) - return null; - if (! (object instanceof VNode)) - return null; - - Vector pathV = new Vector (); - for (TreeNode i = (VNode) object; i != null; i = i.getParent ()) - pathV.insertElementAt (i, 0); - TreeNode[] path = new TreeNode[pathV.size ()]; - pathV.copyInto (path); - return new TreePath (path); - } - - - -/** -Returns the root, or the system resource, from which all information for the model is gathered. - -@return The root, or the system resource, from which all information for the model is gathered. It will be null if none has been set. -**/ - public Object getRoot () - { - return root_; - } - - - -/** -Initializes transient data. -**/ - private void initializeTransient () - { - errorEventSupport_ = new ErrorEventSupport (this); - objectListener_ = new VObjectListener_ (); - propertyChangeSupport_ = new PropertyChangeSupport (this); - treeModelEventSupport_ = new TreeModelEventSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - if (root_ != null) { - root_.addErrorListener (errorEventSupport_); - root_.addVObjectListener (objectListener_); - root_.addWorkingListener (workingEventSupport_); - } - } - - - -/** -Indicates if the object is a leaf in the tree. - -@param object The object. -@return true if the object is a leaf or the object - is not a valid object; false if the - object is not a leaf. -**/ - public boolean isLeaf (Object object) - { - // Validate the object. - if (object == null) - return true; - if (! (object instanceof VNode)) - return true; - - return ((VNode) object).isLeaf (); - } - - -/** -Loads the information from the system. -**/ - public void load () - { - if (root_ != null) - root_.load (); - - treeModelEventSupport_.fireTreeStructureChanged (getPath (root_)); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a tree model listener. - -@param listener The listener. -**/ - public void removeTreeModelListener (TreeModelListener listener) - { - treeModelEventSupport_.removeTreeModelListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Sets the root, or the system resource, from which all information -for the model is gathered. It will not take effect until load() is done. - -@param root The root, or the system resource, from which all - information for the model is gathered. This must - be a VNode. - -@exception PropertyVetoException If the change is vetoed. -**/ -// -// Implementation note: This method takes an Object and not a VNode -// so that it matches getObject(). Otherwise -// we get a beans IntrospectionException when -// trying to introspect the bean. -// -// getObject() returns Object in order to implement -// the TreeModel interface. -// - public void setRoot (Object root) - throws PropertyVetoException - { - if (root == null) - throw new NullPointerException ("root"); - - // If they did pass a VNode, this will throw a class cast - // exception. - - VNode oldValue = root_; - VNode newValue = (VNode) root; - vetoableChangeSupport_.fireVetoableChange ("root", oldValue, newValue); - - if (oldValue != newValue) { - - // Redirect event support. - if (oldValue != null) { - oldValue.removeErrorListener (errorEventSupport_); - oldValue.removeVObjectListener (objectListener_); - oldValue.removeWorkingListener (workingEventSupport_); - } - newValue.addErrorListener (errorEventSupport_); - newValue.addVObjectListener (objectListener_); - newValue.addWorkingListener (workingEventSupport_); - - // Set the root. - root_ = newValue; - treeModelEventSupport_.fireTreeStructureChanged (getPath (root_)); - } - - propertyChangeSupport_.firePropertyChange ("root", oldValue, newValue); - } - - - -/** -Notifies the object that the value for the item identified by path -has changed. - -@param path The path of the item containing the new value. -@param value The new value. -**/ - public void valueForPathChanged (TreePath path, Object value) - { - // Ignore. We control all changes. - } - - - - -/** -Listens for explorer events and adjusts the model accordingly. -**/ - private class VObjectListener_ - implements VObjectListener, Serializable - { - - - - public void objectChanged (VObjectEvent event) - { - VObject object = event.getObject (); - - if (object != null) { // @A1C - if (! event.isDuringLoad ()) // @A1A - object.load (); - - if (object instanceof VNode) { - treeModelEventSupport_.fireTreeStructureChanged (getPath (object)); - - VNode parent = (VNode) ((VNode) object).getParent (); - if (parent != null) { - TreePath path = getPath (parent); - int index = parent.getIndex ((VNode) object); - if (index >= 0) - treeModelEventSupport_.fireTreeNodesChanged (path, - index, object); - } - } - } // @A1A - } - - - - public void objectCreated (VObjectEvent event) - { - VObject object = event.getObject (); - VNode parent = event.getParent (); - - if ((parent != null) && (object instanceof VNode)) { - int index = parent.getIndex ((VNode) object); - treeModelEventSupport_.fireTreeNodesInserted (getPath (parent), - index, object); - } - } - - - - public void objectDeleted (VObjectEvent event) - { - VObject object = event.getObject (); - - if (object instanceof VNode) { - VNode parent = (VNode) ((VNode) object).getParent (); - if (parent == null) - treeModelEventSupport_.fireTreeNodesRemoved (null, 0, object); - else { - int index = parent.getIndex ((VNode) object); - if (index >= 0) - treeModelEventSupport_.fireTreeNodesRemoved (getPath (parent), - index, object); - } - } - } - - - } -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400TreeModel16.gif b/cvsroot/src/com/ibm/as400/vaccess/AS400TreeModel16.gif deleted file mode 100644 index c4a9c8635..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/AS400TreeModel16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400TreeModel32.gif b/cvsroot/src/com/ibm/as400/vaccess/AS400TreeModel32.gif deleted file mode 100644 index b3bf11e87..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/AS400TreeModel32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400TreeModelBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/AS400TreeModelBeanInfo.java deleted file mode 100644 index f8a0fa6b1..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400TreeModelBeanInfo.java +++ /dev/null @@ -1,192 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400TreeModelBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.event.TreeModelListener; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The AS400TreeModelBeanInfo class provides bean information -for the AS400TreeModel class. - -@see AS400TreeModel -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class AS400TreeModelBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = AS400TreeModel.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - String[] treeModelMethods = { "treeNodesChanged", "treeNodesInserted", - "treeNodesRemoved", "treeStructureChanged" }; - EventSetDescriptor treeModel = new EventSetDescriptor (beanClass_, - "treeModel", TreeModelListener.class, treeModelMethods, - "addTreeModelListener", "removeTreeModelListener"); - treeModel.setDisplayName (ResourceLoader.getText ("EVT_NAME_TREE_MODEL")); - treeModel.setShortDescription (ResourceLoader.getText ("EVT_DESC_TREE_MODEL")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { error, propertyChange, treeModel, - vetoableChange, working }; - - // Properties. - PropertyDescriptor root = new PropertyDescriptor ("root", beanClass_); - root.setBound (true); - root.setConstrained (true); - root.setDisplayName (ResourceLoader.getText ("PROP_NAME_ROOT")); - root.setShortDescription (ResourceLoader.getText ("PROP_DESC_ROOT")); - - properties_ = new PropertyDescriptor[] { root }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // root. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("AS400TreeModel16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("AS400TreeModel32.gif"); - break; - } - return image; - } - - - -/** - Returns the descriptors for all properties. - @return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400TreePane.java b/cvsroot/src/com/ibm/as400/vaccess/AS400TreePane.java deleted file mode 100644 index 0705cb642..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400TreePane.java +++ /dev/null @@ -1,770 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400TreePane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.CellEditor; -import javax.swing.JComponent; -import javax.swing.JScrollPane; -import javax.swing.JTree; -import javax.swing.JViewport; -import javax.swing.event.TreeExpansionListener; -import javax.swing.event.TreeModelListener; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreePath; -import javax.swing.tree.TreeSelectionModel; -import java.awt.BorderLayout; -import java.awt.Frame; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.Serializable; - - - -/** -The AS400TreePane class represents a graphical user interface -that presents a tree, where all information for the tree is -gathered from the hierarchy of objects rooted at a system resource. -You must explicitly call load() to load the information from -the system. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    AS400TreePane objects generate the following -events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • TreeSelectionEvent -
    - -

    The following example creates a tree pane filled with -the contents of a directory in the integrated file system -of a system. - -

    -// Set up the tree pane.
    -AS400 system = new AS400 ("MySystem", "Userid", "Password");
    -VIFSDirectory directory = new VIFSDirectory (system, "/myDirectory");
    -AS400TreePane treePane = new AS400TreePane (directory);
    -treePane.load ();
    -
    -// Add the tree pane to a frame. -JFrame frame = new JFrame ("My Window"); -frame.getContentPane().add (treePane); -
    - -@see AS400TreeModel -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class AS400TreePane -extends JComponent -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Constant. - private static VNode dummyRoot_ = new VEmptyNode (); - - - - // Properties. - boolean allowActions_ = true; // Private. - boolean confirm_ = true; // Private. - AS400TreeModel model_ = null; // Private. - JTree tree_ = null; // Private. - - - - // Private data. - transient private VActionContext actionContext_; - transient private PopupMenuAdapter popupMenuAdapter_; - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private TreeSelectionEventSupport treeSelectionEventSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - - - -/** -Constructs an AS400TreePane object. -**/ - public AS400TreePane () - { - // Initialize the model. - // - // The reason that we initialize the root to something - // other than null is to workaround a Swing bug. If - // you create a JTree with a null root, just about - // everything causes a NullPointerException inside - // Swing, including setting the root to something else. - // - model_ = new AS400TreeModel (dummyRoot_); - - // Initialize the tree. - tree_ = new JTree (model_); - tree_.setCellEditor (new VObjectCellEditor ()); - tree_.setCellRenderer (new VObjectCellRenderer ()); - tree_.setEditable (true); - tree_.setRootVisible (true); - tree_.setShowsRootHandles (true); - tree_.getSelectionModel ().setSelectionMode (TreeSelectionModel.SINGLE_TREE_SELECTION); - - // Layout the pane. - setLayout (new BorderLayout ()); - add ("Center", new JScrollPane (tree_)); - - initializeTransient (); - } - - - -/** -Constructs an AS400TreePane object. - -@param root The root, or the system resource, from which all information for the model is gathered. -**/ - public AS400TreePane (VNode root) - { - this (); - - if (root == null) - throw new NullPointerException ("root"); - - try { - model_.setRoot (root); - } - catch (PropertyVetoException e) { - // Ignore. - } - - expand (root); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - super.addPropertyChangeListener (listener); - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a listener to be notified when a tree selection occurs. - -@param listener The listener. -**/ - public void addTreeSelectionListener (TreeSelectionListener listener) - { - treeSelectionEventSupport_.addTreeSelectionListener (listener); - } - - - -/**Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - super.addVetoableChangeListener (listener); - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - -/** -Collapses the specified object. - -@param object The object. -**/ - public void collapse (VNode object) - { - if (object == null) - throw new NullPointerException ("object"); - - int row = findRow (object); - if (row >= 0) - tree_.collapseRow (row); - } - - - -/** -Expands the specified object. - -@param object The object. -**/ - public void expand (VNode object) - { - if (object == null) - throw new NullPointerException ("object"); - - int row = findRow (object); - if (row >= 0) - tree_.expandRow (row); - } - - - -/** -Finds the row for the object. - -@param object The object. -@return The row, or -1 if the object is not in the - tree or is not visible. -**/ - private int findRow (VNode object) - { - if (object == null) - throw new NullPointerException ("object"); - - TreePath path = getPath (object); - if (path != null) - return tree_.getRowForPath (path); - else - return -1; - } - - - -/** -Returns the context in which actions will be performed. - -@return The action context. -**/ - public VActionContext getActionContext () - { - return actionContext_; - } - - - -/** -Indicates if actions can be invoked on objects. - -@return true if actions can be invoked; false otherwise. -**/ - public boolean getAllowActions () - { - return allowActions_; - } - - - -/** -Indicates if certain actions are confirmed with the user. - -@return true if certain actions are confirmed with the user; - false otherwise. -**/ - public boolean getConfirm() - { - return confirm_; - } - - - -/** -Returns the model which contains the data for the tree. - -@return The tree model. -**/ - public TreeModel getModel () - { - return model_; - } - - - -/** -Returns the path from the root to get to this object in the tree -hierarchy. The last element in the path will be this object. - -@param object The object. -@return The path, or null if the object is not a valid - object. -**/ - public TreePath getPath (VNode object) - { - if (object == null) - throw new NullPointerException ("object"); - - return model_.getPath (object); - } - - - -/** -Returns the root, or the system resource, from which all information for the model is gathered. - -@return The root, or the system resource, from which all information for the model is gathered. It will be null if none has been set. -**/ - public VNode getRoot () - { - VNode root = (VNode) model_.getRoot (); - if (root == dummyRoot_) - return null; - else - return root; - } - - - -/** -Returns the first selected object. - -@return The first selected object, or null if none are - selected. -**/ - public VNode getSelectedObject () - { - VNode selectedObject = null; - TreePath selectedPath = tree_.getSelectionPath (); - if (selectedPath != null) - selectedObject = (VNode) selectedPath.getLastPathComponent (); - return selectedObject; - } - - - -/** -Returns the selected objects. - -@return The selected objects. -**/ - public VNode[] getSelectedObjects () - { - VNode[] selectedObjects = null; - TreePath[] selectedPaths = tree_.getSelectionPaths (); - if (selectedPaths != null) { - selectedObjects = new VNode[selectedPaths.length]; - for (int i = 0; i < selectedPaths.length; ++i) - selectedObjects[i] = (VNode) selectedPaths[i].getLastPathComponent (); - } - else - selectedObjects = new VNode[0]; - return selectedObjects; - } - - - -/** -Returns the selection model that is used to maintain -selection state. This provides the ability to programmatically -select and deselect objects. - -@return The selection model, or null if selections are not - allowed. -**/ - public TreeSelectionModel getSelectionModel () - { - return tree_.getSelectionModel (); - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - treeSelectionEventSupport_ = new TreeSelectionEventSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - - model_.addErrorListener (errorEventSupport_); - model_.addPropertyChangeListener (propertyChangeSupport_); - model_.addVetoableChangeListener (vetoableChangeSupport_); - tree_.addTreeSelectionListener (treeSelectionEventSupport_); - - // Initialize the action context. - actionContext_ = new VActionContext_ (); - - // Initialize the other adapters. - model_.addWorkingListener (new WorkingCursorAdapter (tree_)); - - VPane_ pane = new VPane_ (); - popupMenuAdapter_ = new PopupMenuAdapter (pane, actionContext_); - - if (allowActions_) - tree_.addMouseListener (popupMenuAdapter_); - } - - - -/** -Indicates if the object is currently collapsed. - -@param object The object. -@return true if the object is collapsed; false otherwise. -**/ - public boolean isCollapsed (VNode object) - { - if (object == null) - throw new NullPointerException ("object"); - - int row = findRow (object); - if (row >= 0) - return tree_.isCollapsed (row); - else - return false; - } - - - -/** -Indicates if the object is currently expanded. - -@param object The object. -@return true if the object is expanded; false otherwise. -**/ - public boolean isExpanded (VNode object) - { - if (object == null) - throw new NullPointerException ("object"); - - int row = findRow (object); - if (row >= 0) - return tree_.isExpanded (row); - else - return false; - } - - - -/** -Indicates if the object is selected. - -@param object The object. -@return true if the object is selected; false otherwise. -**/ - public boolean isSelected (VNode object) - { - if (object == null) - throw new NullPointerException ("object"); - - int row = findRow (object); - if (row > 0) - return tree_.isRowSelected (row); - else - return false; - } - - - -/** -Indicates if the object is currently visible. - -@param object The object. -@return true if the object is visible; false otherwise. -**/ - public boolean isVisible (VNode object) - { - if (object == null) - throw new NullPointerException ("object"); - - TreePath path = getPath (object); - if (path != null) - { //@B0A - //@B0A - Swing 1.1 bug. JTree.isVisible() returns true - // when the node isn't in the tree. - if (tree_.getPathBounds(model_.getPath(object)) == null) //@B0A - { //@B0A - return false; //@B0A - } //@B0A - return tree_.isVisible (path); - } //@B0A - else - return false; - } - - - -/** -Loads the information from the system. -**/ - public void load () - { - model_.load (); - expand ((VNode) model_.getRoot ()); - } - - - -/** -Makes the object visible in the tree by expanding its -parent objects as needed. - -@param object The object. -**/ - public void makeVisible (VNode object) - { - if (object == null) - throw new NullPointerException ("object"); - - TreePath path = getPath (object); - if (path != null) - tree_.makeVisible (path); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - super.removePropertyChangeListener (listener); - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a tree selection listener. - -@param listener The listener. -**/ - public void removeTreeSelectionListener (TreeSelectionListener listener) - { - treeSelectionEventSupport_.removeTreeSelectionListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener (VetoableChangeListener listener) - { - super.removeVetoableChangeListener (listener); - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** -Sets whether actions are allowed. The following are enabled only when -actions are allowed: - -
      -
    • popup menu on selected object -
    - -

    The default is true. - -@param allowActions true if actions are allowed; false otherwise. -**/ - public void setAllowActions (boolean allowActions) - { - if (allowActions_ != allowActions) { - - allowActions_ = allowActions; - - if (allowActions_) - tree_.addMouseListener (popupMenuAdapter_); - else - tree_.removeMouseListener (popupMenuAdapter_); - } - } - - - -/** -Sets whether certain actions are confirmed with the user. The default -is true. - -@param confirm true if certain actions are confirmed with the - user; false otherwise. -**/ - public void setConfirm (boolean confirm) - { - confirm_ = confirm; - } - - - -/** -Sets the root, or the system resource, from which all information for the model is gathered. It will not take effect until load() is done. - -@param root The root, or the system resource, from which all information for the model is gathered. - - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setRoot (VNode root) - throws PropertyVetoException - { - if (root == null) - throw new NullPointerException ("root"); - - tree_.clearSelection (); - model_.setRoot (root); - expand (root); - } - - - -/** -Sets the selection model that is used to maintain selection -state. This provides the ability to programmatically select -and deselect objects. - -@param selectionModel The selection model, or null if selections - are not allowed. -**/ - public void setSelectionModel (TreeSelectionModel selectionModel) - { - // Do not dispatch events from the old selection model any more. - TreeSelectionModel oldSelectionModel = tree_.getSelectionModel (); - if (oldSelectionModel != null) - oldSelectionModel.removeTreeSelectionListener (treeSelectionEventSupport_); - - tree_.setSelectionModel (selectionModel); - - // Dispatch events from the new selection model. - if (selectionModel != null) - selectionModel.addTreeSelectionListener (treeSelectionEventSupport_); - } - - - -/** -Implements the VActionContext interface. -**/ - private class VActionContext_ - implements VActionContext, Serializable - { - public boolean getConfirm () - { - return confirm_; - } - - public Frame getFrame () - { - return VUtilities.getFrame (AS400TreePane.this); - } - - public CellEditor startEditing (VObject object, Object propertyIdentifier) - { - // Validate the parameters. - if (object == null) - throw new NullPointerException ("object"); - if (propertyIdentifier == null) - throw new NullPointerException ("propertyIdentifier"); - - if (allowActions_ == false) - return null; - - // Edit. - - //@B0A - Swing 1.1 bug. JTree.startEditingAtPath() will cause - // a NullPointerException when it calls getPathBounds() - // internally when the node isn't in the tree. - if (tree_.getPathBounds(model_.getPath(object)) != null) //@B0A - { //@B0A - tree_.startEditingAtPath (model_.getPath (object)); //@B0A - } //@B0A - - return tree_.getCellEditor (); - } - }; - - - -/** -Implements the VPane interface. -**/ - private class VPane_ - implements VPane, Serializable - { - - public VNode getRoot () - { - return AS400TreePane.this.getRoot (); - } - - public VObject getObjectAt (Point point) - { - VObject object = null; - TreePath treePath = tree_.getClosestPathForLocation (point.x, point.y); - Rectangle pathBounds = tree_.getPathBounds (treePath); - if (pathBounds.contains (point)) - object = (VObject) treePath.getLastPathComponent (); - return object; - } - - public void setRoot (VNode root) - throws PropertyVetoException - { - AS400TreePane.this.setRoot (root); - } - }; - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400TreePane16.gif b/cvsroot/src/com/ibm/as400/vaccess/AS400TreePane16.gif deleted file mode 100644 index e38c7b542..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/AS400TreePane16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400TreePane32.gif b/cvsroot/src/com/ibm/as400/vaccess/AS400TreePane32.gif deleted file mode 100644 index 3f02265ae..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/AS400TreePane32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/AS400TreePaneBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/AS400TreePaneBeanInfo.java deleted file mode 100644 index f092c4b75..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AS400TreePaneBeanInfo.java +++ /dev/null @@ -1,208 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400TreePaneBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.event.TreeSelectionListener; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The AS400TreePaneBeanInfo class provides bean information -for the AS400TreePane class. - -@see AS400TreePane -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class AS400TreePaneBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = AS400TreePane.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor treeSelection = new EventSetDescriptor (beanClass_, - "treeSelection", TreeSelectionListener.class, "valueChanged"); - treeSelection.setDisplayName (ResourceLoader.getText ("EVT_NAME_TREE_SELECTION")); - treeSelection.setShortDescription (ResourceLoader.getText ("EVT_DESC_TREE_SELECTION")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - events_ = new EventSetDescriptor[] { error, propertyChange, treeSelection, - vetoableChange }; - - // Properties. - PropertyDescriptor allowActions = new PropertyDescriptor ("allowActions", beanClass_); - allowActions.setBound (false); - allowActions.setConstrained (false); - allowActions.setDisplayName (ResourceLoader.getText ("PROP_NAME_ALLOW_ACTIONS")); - allowActions.setShortDescription (ResourceLoader.getText ("PROP_DESC_ALLOW_ACTIONS")); - - PropertyDescriptor confirm = new PropertyDescriptor ("confirm", beanClass_); - confirm.setBound (false); - confirm.setConstrained (false); - confirm.setDisplayName (ResourceLoader.getText ("PROP_NAME_CONFIRM")); - confirm.setShortDescription (ResourceLoader.getText ("PROP_DESC_CONFIRM")); - - PropertyDescriptor model = new PropertyDescriptor ("model", beanClass_, - "getModel", null); - model.setBound (false); - model.setConstrained (false); - model.setDisplayName (ResourceLoader.getText ("PROP_NAME_MODEL")); - model.setShortDescription (ResourceLoader.getText ("PROP_DESC_MODEL")); - - PropertyDescriptor root = new PropertyDescriptor ("root", beanClass_); - root.setBound (true); - root.setConstrained (true); - root.setDisplayName (ResourceLoader.getText ("PROP_NAME_ROOT")); - root.setShortDescription (ResourceLoader.getText ("PROP_DESC_ROOT")); - - PropertyDescriptor selectionModel = new PropertyDescriptor ("selectionModel", beanClass_); - selectionModel.setBound (false); - selectionModel.setConstrained (false); - selectionModel.setDisplayName (ResourceLoader.getText ("PROP_NAME_SELECTION_MODEL")); - selectionModel.setShortDescription (ResourceLoader.getText ("PROP_DESC_SELECTION_MODEL")); - - properties_ = new PropertyDescriptor[] { allowActions, confirm, model, - root, selectionModel }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 3; // root. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("AS400TreePane16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("AS400TreePane32.gif"); - break; - } - return image; - } - - - -/** - Returns the descriptors for all properties. - @return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/AbstractVAction.java b/cvsroot/src/com/ibm/as400/vaccess/AbstractVAction.java deleted file mode 100644 index 09a07f384..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/AbstractVAction.java +++ /dev/null @@ -1,295 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AbstractVAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - - - -/** -The AbstractVAction class is an abstract implementation -for an action. -**/ -abstract class AbstractVAction -implements VAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private boolean enabled_ = true; - private VObject object_ = null; - - - - // Event support. - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - - -/** -Constructs an AbstractVAction object. -**/ - public AbstractVAction () - { - object_ = null; - } - - - -/** -Constructs an AbstractVAction object. - -@param object The object. -**/ - public AbstractVAction (VObject object) - { - object_ = object; - } - - - -/** -Adds an error listener. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a VObjectListener. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a working listener. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Fires an error event. - -@param e The exeception. -**/ - protected void fireError (Exception e) - { - errorEventSupport_.fireError (e); - } - - - -/** -Fires an object changed event. -**/ - protected void fireObjectChanged () - { - objectEventSupport_.fireObjectChanged (object_); - } - - - -/** -Fires an object changed event. - -@param object The object. -**/ - protected void fireObjectChanged (VObject object) - { - objectEventSupport_.fireObjectChanged (object); - } - - - -/** -Fires an object created event. -**/ - protected void fireObjectCreated () - { - objectEventSupport_.fireObjectCreated (object_); - } - - - -/** -Fires an object created event. - -@param object The object. -**/ - protected void fireObjectCreated (VObject object, VObject child) - { - objectEventSupport_.fireObjectCreated (object); - } - - - -/** -Fires a object deleted event. -**/ - protected void fireObjectDeleted () - { - objectEventSupport_.fireObjectDeleted (object_); - } - - - -/** -Fires a object deleted event. - -@param object The object. -**/ - protected void fireObjectDeleted (VObject object) - { - objectEventSupport_.fireObjectDeleted (object); - } - - - -/** -Fires a start working event. -**/ - protected void fireStartWorking () - { - workingEventSupport_.fireStartWorking (); - } - - - -/** -Fires a stop working event. -**/ - protected void fireStopWorking () - { - workingEventSupport_.fireStopWorking (); - } - - - -/** -Returns the affected AS400 object. - -@return The server object. -**/ - public VObject getObject () - { - return object_; - } - - - -/** -Returns the text for the action. - -@return The text. -**/ - public abstract String getText (); - - - -/** -Indicates if the action is enabled. - -@return true if the action is enabled, false otherwise. -**/ - public boolean isEnabled () - { - return enabled_; - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Sets the enabled state of the action. - -@param enabled true if the action is enabled, false otherwise. -**/ - public void setEnabled (boolean enabled) - { - enabled_ = enabled; - } - - - -/** -Returns the text for the action. - -@return The text. -**/ - public String toString () - { - return getText (); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/ActionCompletedEventSupport.java b/cvsroot/src/com/ibm/as400/vaccess/ActionCompletedEventSupport.java deleted file mode 100644 index a55be0576..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ActionCompletedEventSupport.java +++ /dev/null @@ -1,137 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ActionCompletedEventSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.ActionCompletedEvent; -import com.ibm.as400.access.ActionCompletedListener; -import java.util.Enumeration; -import java.util.Vector; - - - -/** -The ActionCompletedEventSupport class represents a list of -ActionCompletedListeners. It manages the list as well as -provides notification services for ActionCompletedEvents. -**/ -class ActionCompletedEventSupport -implements ActionCompletedListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// Source of the events. -private Object source_ = null; - -// Vector of listeners, used to add and remove listeners. -transient private Vector actionListenersV_ - = new Vector(); -// Array used to send the events. Is a copy of actionListenersV_, -// used for speed. -transient private ActionCompletedListener[] actionListeners_ - = new ActionCompletedListener[0]; - - - -/** -Constructs a ActionCompletedEventSupport object. - -@param source The source of the events. -**/ -public ActionCompletedEventSupport (Object source) -{ - source_ = source; -} - - - -/** -Processes an action completed event. - -@param event The event. -**/ -public void actionCompleted (ActionCompletedEvent event) -{ - fireActionCompleted (); -} - - - -/** -Adds a listener. - -@param listener The listener. -**/ -public void addActionCompletedListener (ActionCompletedListener listener) -{ - if (listener == null) - { - throw new NullPointerException("listener"); - } - - // Add new listener. - actionListenersV_.addElement(listener); - // copyInto is synchronized, so we don't have to synchronize V. - synchronized(actionListeners_) - { - actionListeners_ = new ActionCompletedListener[actionListenersV_.size()]; - actionListenersV_.copyInto(actionListeners_); - } -} - - -/** -Fires an ActionCompletedEvent to listeners. -**/ -void fireActionCompleted() -{ - ActionCompletedEvent event = new ActionCompletedEvent(source_); - synchronized(actionListeners_) - { - for (int i=0; iCommandCallButton objects generate the following events: -

      -
    • ActionCompletedEvent -
    • ErrorEvent -
    • PropertyChangeEvent -
    - -@see com.ibm.as400.access.CommandCall -@see com.ibm.as400.access.AS400Message -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class CommandCallButton -extends JButton -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Properties. - CommandCall command_ = null; // Private. - - - - // Event support. - transient ActionCompletedEventSupport actionCompletedEventSupport_; // Private. - transient ErrorEventSupport errorEventSupport_; // Private. - transient private PropertyChangeSupport propertyChangeSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - - - - - /** - Constructs a CommandCallButton object. - **/ - public CommandCallButton() - { - command_ = new CommandCall (); - initializeTransient (); - } - - - /** - Constructs a CommandCallButton object. - - @param text The button text, or null if there is no text. - **/ - public CommandCallButton(String text) - { - super(text); - command_ = new CommandCall (); - initializeTransient (); - } - - - /** - Constructs a CommandCallButton object. - - @param text The button text, or null if there is no text. - @param icon The button icon, or null if there is no icon. - **/ - public CommandCallButton(String text, Icon icon) - { - super(text,icon); - command_ = new CommandCall (); - initializeTransient (); - } - - - /** - Constructs a CommandCallButton object. - - @param text The button text, or null if there is no text. - @param icon The button icon, or null if there is no icon. - @param system The system on which commands are run. - **/ - public CommandCallButton(String text, - Icon icon, - AS400 system) - { - super(text, icon); - command_ = new CommandCall (system); - initializeTransient (); - } - - - /** - Constructs a CommandCallButton object. - - @param text The button text, or null if there is no text. - @param icon The button icon, or null if there is no icon. - @param system The system on which commands are run. - @param command The command. - **/ - public CommandCallButton(String text, - Icon icon, - AS400 system, - String command) - { - super(text, icon); - command_ = new CommandCall (system, command); - initializeTransient (); - } - - - /** - Adds a listener to be notified when a command has been run on the system. - - @param listener The listener. - **/ - public void addActionCompletedListener(ActionCompletedListener listener) - { - actionCompletedEventSupport_.addActionCompletedListener (listener); - } - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - super.addPropertyChangeListener (listener); // @A1A - if (propertyChangeSupport_ != null) // @A1A - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - /** - Returns the command that is run when the button is pressed. - - @return The command that is run when the button is pressed. - **/ - public String getCommand() - { - return command_.getCommand(); - } - - - /** - Returns the message list resulting from the last command - that was run. - - @return The message list. - **/ - public AS400Message[] getMessageList() - { - return command_.getMessageList(); - } - - - /** - Returns the text from the first message resulting from the - last command that was run. - - @return The message text. - **/ - public String getMessageText() - { - AS400Message[] msglist = command_.getMessageList(); - if (msglist.length==0) - return ""; - else - return msglist[0].getText(); - } - - - /** - Returns the system on which commands are run. - - @return The system on which commands are run. - **/ - public AS400 getSystem() - { - return command_.getSystem(); - } - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Initialize the event support. - actionCompletedEventSupport_ = new ActionCompletedEventSupport (this); - errorEventSupport_ = new ErrorEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - - command_.addActionCompletedListener (actionCompletedEventSupport_); - command_.addPropertyChangeListener (propertyChangeSupport_); - command_.addVetoableChangeListener (vetoableChangeSupport_); - - addActionListener (new ActionListener_ ()); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes an action completed listener. - -@param listener The listener. -**/ - public void removeActionCompletedListener (ActionCompletedListener listener) - { - actionCompletedEventSupport_.removeActionCompletedListener (listener); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - - /** - Sets the command that is run when the button is pressed. - - @param command The command that is run when the button is pressed. - - @exception PropertyVetoException If the change is vetoed. - **/ - public void setCommand(String command) - throws PropertyVetoException - { - command_.setCommand( command ); - } - - - /** - Sets the system on which commands are run. - - @param system The system on which commands are run. - - @exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem(AS400 system) - throws PropertyVetoException - { - command_.setSystem( system ); - } - - - - private class ActionListener_ - implements ActionListener - { - public void actionPerformed (ActionEvent event) - { - // Set the cursor to a wait cursor. - WorkingCursorAdapter cursorAdapter = new WorkingCursorAdapter (CommandCallButton.this); - cursorAdapter.startWorking (new WorkingEvent (this)); - - // Run the command. - try { - command_.run(); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - - // Set the cursor back. - cursorAdapter.stopWorking (new WorkingEvent (this)); - } - - } - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/CommandCallButton16.gif b/cvsroot/src/com/ibm/as400/vaccess/CommandCallButton16.gif deleted file mode 100644 index dacf30b02..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/CommandCallButton16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/CommandCallButton32.gif b/cvsroot/src/com/ibm/as400/vaccess/CommandCallButton32.gif deleted file mode 100644 index 32d90655f..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/CommandCallButton32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/CommandCallButtonBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/CommandCallButtonBeanInfo.java deleted file mode 100644 index c9f8dd928..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/CommandCallButtonBeanInfo.java +++ /dev/null @@ -1,203 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CommandCallButtonBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.ActionCompletedListener; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The CommandCallButtonBeanInfo class provides bean information -for the CommandCallButton class. - -@see CommandCallButton -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class CommandCallButtonBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = CommandCallButton.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor actionCompleted = new EventSetDescriptor (beanClass_, - "actionCompleted", ActionCompletedListener.class, "actionCompleted"); - actionCompleted.setDisplayName (ResourceLoader.getText ("EVT_NAME_ACTION_COMPLETED")); - actionCompleted.setShortDescription (ResourceLoader.getText ("EVT_DESC_ACTION_COMPLETED")); - - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - events_ = new EventSetDescriptor[] { actionCompleted, error, propertyChange, - vetoableChange }; - - // Properties. - PropertyDescriptor command = new PropertyDescriptor ("command", beanClass_); - command.setBound (true); - command.setConstrained (true); - command.setDisplayName (ResourceLoader.getText ("PROP_NAME_COMMAND")); - command.setShortDescription (ResourceLoader.getText ("PROP_DESC_COMMAND")); - - PropertyDescriptor messageList = new PropertyDescriptor ("messageList", beanClass_, - "getMessageList", null); - messageList.setBound (false); - messageList.setConstrained (false); - messageList.setDisplayName (ResourceLoader.getText ("PROP_NAME_MESSAGE_LIST")); - messageList.setShortDescription (ResourceLoader.getText ("PROP_DESC_MESSAGE_LIST")); - - PropertyDescriptor system = new PropertyDescriptor ("system", beanClass_); - system.setBound (true); - system.setConstrained (true); - system.setDisplayName (ResourceLoader.getText ("PROP_NAME_SYSTEM")); - system.setShortDescription (ResourceLoader.getText ("PROP_DESC_SYSTEM")); - - PropertyDescriptor text = new PropertyDescriptor ("text", beanClass_); - text.setBound (false); - text.setConstrained (false); - text.setDisplayName (ResourceLoader.getText ("PROP_NAME_TEXT")); - text.setShortDescription (ResourceLoader.getText ("PROP_DESC_TEXT")); - - properties_ = new PropertyDescriptor[] { command, messageList, - system, text }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ActionCompletedEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // command. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("CommandCallButton16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("CommandCallButton32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/CommandCallMenuItem.java b/cvsroot/src/com/ibm/as400/vaccess/CommandCallMenuItem.java deleted file mode 100644 index a4a6b9a76..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/CommandCallMenuItem.java +++ /dev/null @@ -1,382 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CommandCallMenuItem.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.ActionCompletedListener; -import com.ibm.as400.access.ActionCompletedEvent; -import com.ibm.as400.access.CommandCall; -import javax.swing.Icon; -import javax.swing.JMenuItem; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; - - - -/** -The CommandCallMenuItem class represents a menu item -that calls a CL command when selected. -Results of the command are returned in a message list. - -

    CommandCallMenuItem objects generate the following events: -

      -
    • ActionCompletedEvent -
    • ErrorEvent -
    • PropertyChangeEvent -
    - -@see com.ibm.as400.access.CommandCall -@see com.ibm.as400.access.AS400Message -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class CommandCallMenuItem -extends JMenuItem -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Properties. - CommandCall command_ = null; // Private. - - - - // Event support. - transient ActionCompletedEventSupport actionCompletedEventSupport_; // Private. - transient ErrorEventSupport errorEventSupport_; // Private. - transient private PropertyChangeSupport propertyChangeSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - - - - - /** - Constructs a CommandCallMenuItem object. - **/ - public CommandCallMenuItem() - { - command_ = new CommandCall (); - initializeTransient (); - } - - - /** - Constructs a CommandCallMenuItem object. - - @param text The menu item text, or null if there is no text. - **/ - public CommandCallMenuItem(String text) - { - super(text); - command_ = new CommandCall (); - initializeTransient (); - } - - - /** - Constructs a CommandCallMenuItem object. - - @param text The menu item text, or null if there is no text. - @param icon The menu item icon, or null if there is no icon. - **/ - public CommandCallMenuItem(String text, Icon icon) - { - super(text,icon); - command_ = new CommandCall (); - initializeTransient (); - } - - - /** - Constructs a CommandCallMenuItem object. - - @param text The menu item text, or null if there is no text. - @param icon The menu item icon, or null if there is no icon. - @param system The system on which commands are run. - **/ - public CommandCallMenuItem(String text, - Icon icon, - AS400 system) - { - super(text, icon); - command_ = new CommandCall (system); - initializeTransient (); - } - - - /** - Constructs a CommandCallMenuItem object. - - @param text The menu item text, or null if there is no text. - @param icon The menu item icon, or null if there is no icon. - @param system The system on which commands are run. - @param command The command. - **/ - public CommandCallMenuItem(String text, - Icon icon, - AS400 system, - String command) - { - super(text, icon); - command_ = new CommandCall (system, command); - initializeTransient (); - } - - - /** - Adds a listener to be notified when a command has been run on the system. - - @param listener The listener. - **/ - public void addActionCompletedListener(ActionCompletedListener listener) - { - actionCompletedEventSupport_.addActionCompletedListener (listener); - } - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - super.addPropertyChangeListener(listener); // @C1A - if (propertyChangeSupport_ != null) // @C1A - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - /** - Returns the command. - - @return The command. - **/ - public String getCommand() - { - return command_.getCommand(); - } - - - /** - Returns the message list resulting from the last command - that was run. - - @return The message list. - **/ - public AS400Message[] getMessageList() - { - return command_.getMessageList(); - } - - - /** - Returns the text from the first message resulting from the - last command that was run. - - @return The message text. - **/ - public String getMessageText() - { - AS400Message[] msglist = command_.getMessageList(); - if (msglist.length==0) - return ""; - else - return msglist[0].getText(); - } - - - /** - Returns the system on which commands are run. - - @return The system on which commands are run. - **/ - public AS400 getSystem() - { - return command_.getSystem(); - } - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Initialize the event support. - actionCompletedEventSupport_ = new ActionCompletedEventSupport (this); - errorEventSupport_ = new ErrorEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - - command_.addActionCompletedListener (actionCompletedEventSupport_); - command_.addPropertyChangeListener (propertyChangeSupport_); - command_.addVetoableChangeListener (vetoableChangeSupport_); - - addActionListener (new ActionListener_ ()); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes a action completed listener. - -@param listener The listener. -**/ - public void removeActionCompletedListener (ActionCompletedListener listener) - { - actionCompletedEventSupport_.removeActionCompletedListener (listener); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - - /** - Sets the command that is run when the button is pressed. - - @param command The command that is run when the button is pressed. - - @exception PropertyVetoException If the change is vetoed. - **/ - public void setCommand(String command) - throws PropertyVetoException - { - command_.setCommand( command ); - } - - - /** - Sets the system on which commands are run. - - @param system The system on which commands are run. - - @exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem(AS400 system) - throws PropertyVetoException - { - command_.setSystem( system ); - } - - - - private class ActionListener_ - implements ActionListener - { - public void actionPerformed (ActionEvent event) - { - // Set the cursor to a wait cursor. - WorkingCursorAdapter cursorAdapter = new WorkingCursorAdapter (CommandCallMenuItem.this); - cursorAdapter.startWorking (new WorkingEvent (this)); - - // Run the command. - try { - command_.run(); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - - // Set the cursor back. - cursorAdapter.stopWorking (new WorkingEvent (this)); - } - - } - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/CommandCallMenuItem16.gif b/cvsroot/src/com/ibm/as400/vaccess/CommandCallMenuItem16.gif deleted file mode 100644 index 85bf0e356..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/CommandCallMenuItem16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/CommandCallMenuItem32.gif b/cvsroot/src/com/ibm/as400/vaccess/CommandCallMenuItem32.gif deleted file mode 100644 index b380400e8..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/CommandCallMenuItem32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/CommandCallMenuItemBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/CommandCallMenuItemBeanInfo.java deleted file mode 100644 index f6a918571..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/CommandCallMenuItemBeanInfo.java +++ /dev/null @@ -1,203 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: CommandCallMenuItemBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.ActionCompletedListener; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The CommandCallMenuItemBeanInfo class provides bean information -for the CommandCallMenuItem class. - -@see CommandCallMenuItem -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class CommandCallMenuItemBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = CommandCallMenuItem.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor actionCompleted = new EventSetDescriptor (beanClass_, - "actionCompleted", ActionCompletedListener.class, "actionCompleted"); - actionCompleted.setDisplayName (ResourceLoader.getText ("EVT_NAME_ACTION_COMPLETED")); - actionCompleted.setShortDescription (ResourceLoader.getText ("EVT_DESC_ACTION_COMPLETED")); - - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - events_ = new EventSetDescriptor[] { actionCompleted, error, propertyChange, - vetoableChange }; - - // Properties. - PropertyDescriptor command = new PropertyDescriptor ("command", beanClass_); - command.setBound (true); - command.setConstrained (true); - command.setDisplayName (ResourceLoader.getText ("PROP_NAME_COMMAND")); - command.setShortDescription (ResourceLoader.getText ("PROP_DESC_COMMAND")); - - PropertyDescriptor messageList = new PropertyDescriptor ("messageList", beanClass_, - "getMessageList", null); - messageList.setBound (false); - messageList.setConstrained (false); - messageList.setDisplayName (ResourceLoader.getText ("PROP_NAME_MESSAGE_LIST")); - messageList.setShortDescription (ResourceLoader.getText ("PROP_DESC_MESSAGE_LIST")); - - PropertyDescriptor system = new PropertyDescriptor ("system", beanClass_); - system.setBound (true); - system.setConstrained (true); - system.setDisplayName (ResourceLoader.getText ("PROP_NAME_SYSTEM")); - system.setShortDescription (ResourceLoader.getText ("PROP_DESC_SYSTEM")); - - PropertyDescriptor text = new PropertyDescriptor ("text", beanClass_); - text.setBound (false); - text.setConstrained (false); - text.setDisplayName (ResourceLoader.getText ("PROP_NAME_TEXT")); - text.setShortDescription (ResourceLoader.getText ("PROP_DESC_TEXT")); - - properties_ = new PropertyDescriptor[] { command, messageList, - system, text }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ActionCompletedEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // command. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("CommandCallMenuItem16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("CommandCallMenuItem32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/ConfirmedAction.java b/cvsroot/src/com/ibm/as400/vaccess/ConfirmedAction.java deleted file mode 100644 index ef1f8e76e..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ConfirmedAction.java +++ /dev/null @@ -1,99 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ConfirmedAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.JOptionPane; -import java.awt.Component; - - - -/** -The ConfirmedAction abstract class presents an optional confirmation -to the user before performing the action. The confirmation will be -presented only if the action context requires such confirmations. -**/ -abstract class ConfirmedAction -extends AbstractVAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private String messageText_; - private VObject object_; - private String titleText_; - - - -/** -Constructs a ConfirmedAction object. - -@param object The object to which the action is associated. -@param titleText The title text for the confirmation. -@param messageText The message text for the confirmation. -**/ - public ConfirmedAction (VObject object, - String titleText, - String messageText) - { - super (object); - object_ = object; - messageText_ = messageText; - titleText_ = titleText; - } - - - -/** -Performs the action. - -@param context The action context. -**/ - public void perform (VActionContext context) - { - boolean confirmed = true; - if (context.getConfirm ()) { - - // Create the full message text. - StringBuffer buffer = new StringBuffer (); - if (object_ != null) { - buffer.append (object_.toString ()); - buffer.append ("\n\n"); - } - buffer.append (messageText_); - - // Show the confirmation. - int response = JOptionPane.showConfirmDialog (context.getFrame (), - buffer.toString (), titleText_, JOptionPane.YES_NO_OPTION); - confirmed = (response == JOptionPane.YES_OPTION); - } - - if (confirmed) - perform2 (context); - } - - - -/** -Performs the action after the user has confirmed it. - -@param context The action context. -**/ - abstract void perform2 (VActionContext context); - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/Copyright_v.java b/cvsroot/src/com/ibm/as400/vaccess/Copyright_v.java deleted file mode 100644 index 3da05ffab..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/Copyright_v.java +++ /dev/null @@ -1,31 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: Copyright_v.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -/** - * This interface is used to hold the copyright string for our package. - * All classes in the package need a copyright and should get that - * by declaring a String constant as: - *
    -  *    static final private String x = Copyright_v.copyright;
    -  * 
    - * - * -**/ - -interface Copyright_v -{ - static final String copyright = "(C)Copyright IBM Corp. 1997, 1999"; -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/DBCellEditor.java b/cvsroot/src/com/ibm/as400/vaccess/DBCellEditor.java deleted file mode 100644 index fcf0ec4d7..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/DBCellEditor.java +++ /dev/null @@ -1,90 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBCellEditor.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.DefaultCellEditor; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import java.awt.Color; -import java.awt.Component; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; - - - -/** - * Used to be able to edit cell text in updatable SQLResultSetTablePanes. -**/ -class DBCellEditor extends DefaultCellEditor -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - static final JTextArea textArea_ = new JTextArea(); - static final JScrollPane scrollPane_ = new JScrollPane(textArea_); - - // Also see the DBCellSelector class. - - static - { - textArea_.setEditable(true); - textArea_.setBackground(Color.white); - textArea_.setLineWrap(false); - - // The text in the cell scrolls automatically, so we don't need a horizontal bar. - // Plus, the cell isn't big enough to hold both the scrollbar and the text. - scrollPane_.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - // The scroll pane is used for all cells when we are editable. - // We put the scroll bar there so the user knows that we are scrollable. - scrollPane_.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - } - - - /** - * Calls the DefaultCellEditor constructor with a JTextField. - **/ - public DBCellEditor() - { - super(new JTextField()); // Just so we can get constructed. - } - - - /** - * Returns the value inside the cell. This is just the text inside the JTextArea. - * This method is needed for the JTable to properly call setValueAt() on the model - * after a cell is finished being edited. - **/ - public Object getCellEditorValue() - { - return textArea_.getText(); - } - - - /** - * Always use a JTextArea, since someone could paste multi-line text into the cell. - **/ - public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) - { - // If the text is only one line, then use the regular JTextField; - // otherwise, use a JTextArea wrapped in a vertically scrollable JScrollPane. - - // Swing doesn't like it if the value is null. - String s = (value == null ? "" : value.toString()); - textArea_.setText(s); - return scrollPane_; - } -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/DBCellRenderer.java b/cvsroot/src/com/ibm/as400/vaccess/DBCellRenderer.java deleted file mode 100644 index 340ad3cc8..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/DBCellRenderer.java +++ /dev/null @@ -1,138 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBCellRenderer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.table.DefaultTableCellRenderer; -import javax.swing.JLabel; -import javax.swing.JTable; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import java.awt.Component; -import java.awt.Dimension; - - - -/** -The DBCellRenderer class renders a value by using a string -representation of the value. -Null values are represented using a dash. -**/ -class DBCellRenderer -extends DefaultTableCellRenderer -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - -/** -Constructs a DBCellRenderer object. -**/ -public DBCellRenderer () -{ - this (SwingConstants.LEFT); -} - - - -/** -Constructs a DBCellRenderer object. - -@param horizontalAlignment One of the following SwingConstants: LEFT, RIGHT, or CENTER. -**/ -public DBCellRenderer (int horizontalAlignment) -{ - super (); - setHorizontalAlignment (horizontalAlignment); - setBorder (new EmptyBorder (0,5,0,5)); -} - - - -/** -Converts a byte array to a string of hex digits. -@param data The data to convert to hex characters. -@return A string containing the hexidecimal representation -of data. -**/ -String getHexDigits(byte[] data) -{ - StringBuffer result = new StringBuffer(); - for (int i = 0; i < data.length; i++) - { - int leftDigitValue = (data[i] >>> 4) & 0xf; - int rightDigitValue = data[i] & 0xf; - char rightDigit = rightDigitValue < 10 ? - (char) (48 + rightDigitValue) : - (char) (rightDigitValue - 10 + 65); - char leftDigit = leftDigitValue < 10 ? - (char) (48 + leftDigitValue) : - (char) (leftDigitValue - 10 + 65); - result.append(leftDigit); - result.append(rightDigit); - } - return result.toString(); -} - - - - -/** -Renders the value for a table. - -@param table The table. -@param value The value. -@param selected true if the item is selected; false otherwise. -@param hasFocus true if the item has focus; false otherwise. -@param rowIndex The row index. -@param columnIndex The column index. -@return The rendered component. -**/ -public Component getTableCellRendererComponent (JTable table, - Object value, - boolean selected, - boolean hasFocus, - int rowIndex, - int columnIndex) -{ - // Note that subclasses count on this method calling getText(). - String v = getText(value); - setText (v); - return super.getTableCellRendererComponent( - table, v, selected, hasFocus, rowIndex, columnIndex); -} - - - -/** -Returns the text representation for this object. - -@param value The object for which to get the text representation for. -@return The text representation of the object. -**/ -public String getText(Object value) -{ - if (value == null) - { - return "-"; - } - else if (value instanceof byte[]) - { - return getHexDigits((byte[])value); - } - return value.toString(); -} - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/DBCellSelector.java b/cvsroot/src/com/ibm/as400/vaccess/DBCellSelector.java deleted file mode 100644 index d9fc7bf4f..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/DBCellSelector.java +++ /dev/null @@ -1,106 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBCellSelector.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.DefaultCellEditor; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import java.awt.Color; -import java.awt.Component; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; - - - -/** - * Used to be able to select cell text in non-updatable SQLResultSetTablePanes. - * It is not intended to be a typical cell editor. It is only used for selecting cell data, not editing it. -**/ -class DBCellSelector extends DefaultCellEditor -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - static final JTextField textField_ = new JTextField(); - - static final JTextArea textArea_ = new JTextArea(); - static final JScrollPane scrollPane_ = new JScrollPane(textArea_); - - static - { - textField_.setEditable(true); // So we get a cursor. We add a KeyAdapter that consumes alphabetic characters. - textArea_.setEditable(true); - textField_.setBackground(Color.white); // For some reason, the default in JDK 1.3 is gray? or transparent? - textArea_.setBackground(Color.white); - textArea_.setLineWrap(false); - - KeyAdapter adapter = new KeyAdapter() - { - public void keyTyped(KeyEvent e) - { - if (e.getModifiers() == 0) // A typical copy/paste key should have modifiers; normal keys won't. - { - e.consume(); // Don't let the user type data into the cell. - } - } - }; - - textField_.addKeyListener(adapter); - textArea_.addKeyListener(adapter); - - // The text in the cell scrolls automatically, so we don't need a horizontal bar. - // Plus, the cell isn't big enough to hold both the scrollbar and the text. - scrollPane_.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - // The scroll pane is only used for text areas which are only used for cells with multi-line values. - // So we always want a vertical scrollbar. - scrollPane_.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - - // Don't want headers or borders, since we are in a cell and don't have extra room for them. - scrollPane_.setColumnHeader(null); - scrollPane_.setRowHeader(null); - scrollPane_.setViewportBorder(null); - } - - - /** - * Calls the DefaultCellEditor constructor with a JTextField. - **/ - public DBCellSelector() - { - super(textField_); - } - - - /** - * Uses the superclass's default cell editor component unless the data value in the cell - * contains a newline, in which case we use a JTextArea inside a JScrollPane. - **/ - public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) - { - // If the text is only one line, then use the regular JTextField; - // otherwise, use a JTextArea wrapped in a vertically scrollable JScrollPane. - if (value == null) value = ""; // Swing doesn't like it if the value is null. - Component c = super.getTableCellEditorComponent(table, value, isSelected, row, column); - String s = value.toString(); - if (s.indexOf("\n") > -1) - { - textArea_.setText(s); - c = scrollPane_; - } - return c; - } -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/DBDateCellRenderer.java b/cvsroot/src/com/ibm/as400/vaccess/DBDateCellRenderer.java deleted file mode 100644 index 0c641984e..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/DBDateCellRenderer.java +++ /dev/null @@ -1,125 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DBDateCellRenderer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.JLabel; -import javax.swing.JTable; -import javax.swing.SwingConstants; -import java.awt.Component; -import java.text.DateFormat; -import java.util.Date; -import java.util.TimeZone; - - - -/** -The DBDateCellRenderer class renders a date using the -current default locale. -Null values are represented using a dash. -**/ -class DBDateCellRenderer -extends DBCellRenderer -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -// Static data. -private static DateFormat dateFormat_ = DateFormat.getDateInstance (); -private static DateFormat timeFormat_ = DateFormat.getTimeInstance (); -private static DateFormat timestampFormat_ = DateFormat.getDateTimeInstance (); - -/** -Data in column is a time. -**/ -public static final int FORMAT_TIME = 1; -/** -Data in column is a timestamp. -**/ -public static final int FORMAT_TIMESTAMP = 2; -/** -Data in column is a date. -**/ -public static final int FORMAT_DATE = 3; - -// Instance of this renderer is a date, time, or timestamp. -private int type_; - - -static -{ - dateFormat_.setTimeZone(TimeZone.getDefault()); - timeFormat_.setTimeZone(TimeZone.getDefault()); - timestampFormat_.setTimeZone(TimeZone.getDefault()); -} - -/** -Constructs a DBDateCellRenderer object. -**/ -public DBDateCellRenderer (int type) -{ - super (); - type_ = type; -} - - - -// @C1A -/** -Returns the display size for one of the formatters. -This is useful to size GUIs regardless of locale. -**/ -public static int getDisplaySize(int type) -{ - Date sample = new Date(); - switch(type) { - case FORMAT_DATE: - return dateFormat_.format(sample).length(); - case FORMAT_TIME: - return timeFormat_.format(sample).length(); - case FORMAT_TIMESTAMP: - default: - return timestampFormat_.format(sample).length(); - } -} - - -/** -Returns the text representation for this object. - -@param value The object for which to get the text representation for. -@return The text representation of the object. -**/ -public String getText(Object value) -{ - if (value instanceof Date) - { - switch (type_) - { - case FORMAT_DATE: - return dateFormat_.format ((Date) value); - case FORMAT_TIME: - return timeFormat_.format ((Date) value); - default: // timestamp - return timestampFormat_.format ((Date) value); - } - } - else if (value != null) - return value.toString (); - else - return "-"; -} - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/DataQueueDocument.java b/cvsroot/src/com/ibm/as400/vaccess/DataQueueDocument.java deleted file mode 100644 index c394c714b..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/DataQueueDocument.java +++ /dev/null @@ -1,797 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataQueueDocument.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.DataQueue; -import com.ibm.as400.access.DataQueueEntry; -import com.ibm.as400.access.DataQueueEvent; -import com.ibm.as400.access.DataQueueListener; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import javax.swing.event.UndoableEditEvent; -import javax.swing.event.UndoableEditListener; -import javax.swing.text.AttributeSet; -import javax.swing.text.BadLocationException; -import javax.swing.text.Document; -import javax.swing.text.Element; -import javax.swing.text.PlainDocument; -import javax.swing.text.Position; -import javax.swing.text.Segment; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; - - - -/** -The DataQueueDocument class represents an underlying model -for text components, where the text is entries from a -data queue on a system. - -

    Use this class in conjuction with any JTextComponent or -any other component that works with the Document interface. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    DataQueueDocument objects generate the following events: -

      -
    • DataQueueEvent -
    • DocumentEvent -
    • ErrorEvent -
    • PropertyChangeEvent -
    • UndoableEditEvent -
    • WorkingEvent -
    - -

    The following example creates a document which contains -the next entry in a data queue on a system. It then -presents the document in a JTextField object. -

    -// Set up the document and the JTextField.
    -AS400 system = new AS400 ("MySystem", "Userid", "Password");
    -DataQueueDocument document = new DataQueueDocument (system, "/QSYS.LIB/MYLIB.LIB/MYDATAQ.DTAQ");
    -JTextField textField = new JTextField (document, "", 50);
    -
    -// Add the JTextField to a frame. -JFrame frame = new JFrame ("My Window"); -frame.getContentPane().add(new JScrollPane(textField)); - - -
    -// Read the next entry from the data queue. -document.read (); -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -// -// Implementation notes: -// -// * I decided to contain the other document as opposed to extending -// it so that our interface does not need to document what type -// of document we are. -// -// * I do not think that it is necessary to test the methods -// that just do a load and the call the underlying document. -// -public class DataQueueDocument -implements Document, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Properties. - private DataQueue dataQueue_ = null; - - - - // Private data. - transient private PlainDocument document_; - - - - // Event support. - transient private DocumentEventSupport documentEventSupport_ ; - transient private DataQueueEventSupport dataQueueEventSupport_; - transient private ErrorEventSupport errorEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private UndoableEditEventSupport undoableEditEventSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - transient private WorkingEventSupport workingEventSupport_; - - - -/** -Constructs a DataQueueDocument object. -**/ - public DataQueueDocument () - { - dataQueue_ = new DataQueue (); - initializeTransient (); - } - - - -/** -Constructs a DataQueueDocument object. - -@param system The system on which the data queue resides. -@param path The fully qualified integrated file system path name of the data queue. The path must be in the format of /QSYS.LIB/libname.LIB/dataQueue.DTAQ. The library and queue name must each be 10 characters or less. -**/ - public DataQueueDocument (AS400 system, String path) - { - dataQueue_ = new DataQueue (system, path); - initializeTransient (); - } - - - -/** -Adds a listener to be notified when a data queue event occurs. - -@param listener The listener. -**/ - public void addDataQueueListener (DataQueueListener listener) - { - dataQueueEventSupport_.addDataQueueListener (listener); - } - - - -/** -Adds a listener to be notified when a document event occurs. - -@param listener The listener. -**/ - public void addDocumentListener (DocumentListener listener) - { - documentEventSupport_.addDocumentListener (listener); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds an undoable edit listener to be notified when undoable -edits are made to the document. - -@param listener The listener. -**/ - public void addUndoableEditListener (UndoableEditListener listener) - { - undoableEditEventSupport_.addUndoableEditListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Returns a position that will track changes as the document is altered. -If the relative position is null, then the start of the document will -be used. - -@param offset The offset from the start of the document. -@return The position. - -@exception BadLocationException If the given offset does not - represent a valid location in the - document. -**/ - public synchronized Position createPosition (int offset) - throws BadLocationException - { - return document_.createPosition (offset); - } - - - -/** -Returns the root element that views should be based upon -unless some other mechanism for assigning views to element -structures is provided. - -@return The root element. -**/ - public synchronized Element getDefaultRootElement () - { - return document_.getDefaultRootElement (); - } - - - -/** -Returns a position that represents the end of the document. -The position returned can be counted on to track change and stay -located at the end of the document. - -@return The end position. -**/ - public synchronized Position getEndPosition () - { - return document_.getEndPosition (); - } - - - -/** -Returns the length of the document. - -@return The length of the document in characters. -**/ - public synchronized int getLength () - { - return document_.getLength (); - } - - - -/** -Returns the fully qualified integrated file system path name of the data queue. - -@return The fully qualified integrated file system path name of the data queue. -**/ - public String getPath () - { - return dataQueue_.getPath (); - } - - - -/** -Returns a property value associated with the document. - -@param key The property key. -@return The property value. -**/ - public synchronized Object getProperty (Object key) - { - return document_.getProperty (key); - } - - - -/** -Returns the root elements. - -@return The root elements. -**/ - public synchronized Element[] getRootElements () - { - return document_.getRootElements (); - } - - - -/** -Returns a position that represents the start of the document. -The position returned can be counted on to track change and stay -located at the beginning of the document. - -@return The start position. -**/ - public synchronized Position getStartPosition () - { - return document_.getStartPosition (); - } - - - -/** -Returns the system on which the data queue resides. - -@return The system on which the data queue resides. -**/ - public AS400 getSystem() - { - return dataQueue_.getSystem (); - } - - - -/** -Returns the text contained within the specified portion of -the document. - -@param offset The offset into the document representing - the desired start of the text. -@param length The length of the text. -@return The text. - -@exception BadLocationException If the given offset and length does - not represent a valid range in the - document. -**/ - public synchronized String getText (int offset, int length) - throws BadLocationException - { - return document_.getText (offset, length); - } - - - -/** -Stores the text contained within the specified portion of -the document in a segment. - -@param offset The offset into the document representing - the desired start of the text. -@param length The length of the text. -@param text The segment in which to store the text. - -@exception BadLocationException If the given offset and length does - not represent a valid range in the - document. -**/ - public synchronized void getText (int offset, int length, Segment text) - throws BadLocationException - { - document_.getText (offset, length, text); - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - document_ = new PlainDocument (); - - // Initialize the event support. - dataQueueEventSupport_ = new DataQueueEventSupport (this); - documentEventSupport_ = new DocumentEventSupport (this); - errorEventSupport_ = new ErrorEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - undoableEditEventSupport_ = new UndoableEditEventSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - document_.addDocumentListener (documentEventSupport_); - document_.addUndoableEditListener (undoableEditEventSupport_); - dataQueue_.addDataQueueListener (dataQueueEventSupport_); - } - - - -/** -Inserts text into the document. A position marks a location -in the document between items. If the attributes that have been -defined exactly match the current attributes defined at the position, -the element representing the content at that position will simply be -expanded. If the attributes defined are different, a new content -element will be created that matches the attributes. - -@param offset The offset into the document representing - the insertion position. -@param text The text. -@param attributes The attributes to associate with the inserted content, - or null if there are no attributes. - -@exception BadLocationException If the given offset does not - represent a valid position in the - document. -**/ - public synchronized void insertString (int offset, String text, AttributeSet attributes) - throws BadLocationException - { - document_.insertString (offset, text, attributes); - } - - - -/** -Reads an entry from the data queue without removing it from the queue, -and stores the text of the entry in the document. The entry replaces the current content. This method will not wait for entries if none are on the queue. System and path must be set prior -to calling this method. -**/ - public void peek () - { - workingEventSupport_.fireStartWorking (); - - try { - // Clear the contents of the document. - document_.remove (0, document_.getLength ()); - - // Peek the data queue. - DataQueueEntry entry = dataQueue_.peek (); - String contents; - if (entry != null) - contents = entry.getString (); - else - contents = ""; - - // Store the contents of the document. - document_.insertString (0, contents, null); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - - workingEventSupport_.fireStopWorking (); - } - - - -/** -Reads an entry from the data queue without removing it from the queue, -and stores the text of the entry in the document. The entry replaces the current content. System and path must be set prior to calling this method. - -@param wait The number of seconds to wait if the queue contains no - entries. -1 means to wait until an entry is available. -**/ - public void peek (int wait) - { - workingEventSupport_.fireStartWorking (); - - try { - // Clear the contents of the document. - document_.remove (0, document_.getLength ()); - - // Peek the data queue. - DataQueueEntry entry = dataQueue_.peek (wait); - String contents; - if (entry != null) - contents = entry.getString (); - else - contents = ""; - - // Store the contents of the document. - document_.insertString (0, contents, null); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - - workingEventSupport_.fireStopWorking (); - } - - - -/** -Sets a property value associated with the document. - -@param key The property key. -@param value The property value. -**/ - public synchronized void putProperty (Object key, Object value) - { - document_.putProperty (key, value); - } - - - -/** -Reads an entry from the data queue and removes it from the queue, -and stores the text of the entry in the document. The entry replaces the current content. This method will not wait for entries if none are on the queue. System and path must be set prior -to calling this method. -**/ - public void read () - { - workingEventSupport_.fireStartWorking (); - - try { - // Clear the contents of the document. - document_.remove (0, document_.getLength ()); - - // Peek the data queue. - DataQueueEntry entry = dataQueue_.read (); - String contents; - if (entry != null) - contents = entry.getString (); - else - contents = ""; - - // Store the contents of the document. - document_.insertString (0, contents, null); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - - workingEventSupport_.fireStopWorking (); - } - - - -/** -Reads an entry from the data queue and removes it from the queue, -and stores the text of the entry in the document. The entry replaces the current content. System and path must be set prior to calling this method. - -@param wait The number of seconds to wait if the queue contains no - entries. -1 means to wait until an entry is available. -**/ - public void read (int wait) - { - workingEventSupport_.fireStartWorking (); - - try { - // Clear the contents of the document. - document_.remove (0, document_.getLength ()); - - // Peek the data queue. - DataQueueEntry entry = dataQueue_.read (wait); - String contents; - if (entry != null) - contents = entry.getString (); - else - contents = ""; - - // Store the contents of the document. - document_.insertString (0, contents, null); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - - workingEventSupport_.fireStopWorking (); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes text from the document. - -@param offset The offset into the document representing - the desired start of the text. -@param length The length of the text. - -@exception BadLocationException If the given offset and length does - not represent a valid range in the - document. -**/ - public synchronized void remove (int offset, int length) - throws BadLocationException - { - document_.remove (offset, length); - } - - - -/** -Removes a data queue listener. - -@param listener The listener. -**/ - public void removeDataQueueListener (DataQueueListener listener) - { - dataQueueEventSupport_.removeDataQueueListener (listener); - } - - - -/** -Removes a document listener. - -@param listener The listener. -**/ - public void removeDocumentListener (DocumentListener listener) - { - documentEventSupport_.removeDocumentListener (listener); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes an undoable edit listener. - -@param listener The listener. -**/ - public void removeUndoableEditListener (UndoableEditListener listener) - { - undoableEditEventSupport_.removeUndoableEditListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Renders the document. This allows the model to be safely rendered in -the presence of currency, if the model supports being updated -asynchronously. The given runnable will be executed in a way that allows -it to safely read the model with no changes while the runnable is being -executed. The runnable itself may not make any mutations. - -@param runnable The runnable. -**/ - public void render (Runnable runnable) - { - document_.render (runnable); - } - - - -/** -Sets the fully qualified integrated file system path name of the data queue. - -@param path The fully qualified integrated file system path name of the data queue. The path must be in the format of /QSYS.LIB/libname.LIB/dataQueue.DTAQ. The library and queue name must each be 10 characters or less. - - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setPath (String path) - throws PropertyVetoException - { - String oldValue = dataQueue_.getPath (); - String newValue = path; - vetoableChangeSupport_.fireVetoableChange ("path", oldValue, newValue); - - dataQueue_.setPath (newValue); - - propertyChangeSupport_.firePropertyChange ("path", oldValue, newValue); - } - - - -/** -Sets the system on which the data queue resides. - -@param system The system on which the data queue resides. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setSystem (AS400 system) - throws PropertyVetoException - { - AS400 oldValue = dataQueue_.getSystem (); - AS400 newValue = system; - vetoableChangeSupport_.fireVetoableChange ("system", oldValue, newValue); - - dataQueue_.setSystem (system); - - propertyChangeSupport_.firePropertyChange ("system", oldValue, newValue); - } - - - -/** -Writes the contents of the document to the data queue.The entry replaces the current content. System and path must be set prior -to calling this method. -**/ - public void write () - { - workingEventSupport_.fireStartWorking (); - - // Write the contents. - try { - dataQueue_.write (document_.getText (0, document_.getLength ())); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - - workingEventSupport_.fireStopWorking (); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/DataQueueDocument16.gif b/cvsroot/src/com/ibm/as400/vaccess/DataQueueDocument16.gif deleted file mode 100644 index e544f4a85..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/DataQueueDocument16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/DataQueueDocument32.gif b/cvsroot/src/com/ibm/as400/vaccess/DataQueueDocument32.gif deleted file mode 100644 index 32194fc25..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/DataQueueDocument32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/DataQueueDocumentBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/DataQueueDocumentBeanInfo.java deleted file mode 100644 index cc11b2b70..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/DataQueueDocumentBeanInfo.java +++ /dev/null @@ -1,213 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataQueueDocumentBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.DataQueueListener; -import javax.swing.event.DocumentListener; -import javax.swing.event.UndoableEditListener; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The DataQueueDocumentBeanInfo class provides bean information -for the DataQueueDocument class. - -@see DataQueueDocument -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class DataQueueDocumentBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = DataQueueDocument.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - String[] dataQueueMethods = { "cleared", "peeked", "read", "written" }; - EventSetDescriptor dataQueue = new EventSetDescriptor (beanClass_, - "dataQueue", DataQueueListener.class, dataQueueMethods, - "addDataQueueListener", "removeDataQueueListener"); - dataQueue.setDisplayName (ResourceLoader.getText ("EVT_NAME_DATA_QUEUE")); - dataQueue.setShortDescription (ResourceLoader.getText ("EVT_DESC_DATA_QUEUE")); - - String[] documentMethods = { "changedUpdate", "insertUpdate", "removeUpdate" }; - EventSetDescriptor document = new EventSetDescriptor (beanClass_, - "document", DocumentListener.class, documentMethods, - "addDocumentListener", "removeDocumentListener"); - document.setDisplayName (ResourceLoader.getText ("EVT_NAME_DOCUMENT")); - document.setShortDescription (ResourceLoader.getText ("EVT_DESC_DOCUMENT")); - - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor undoableEdit = new EventSetDescriptor (beanClass_, - "undoableEdit", UndoableEditListener.class, "undoableEditHappened"); - undoableEdit.setDisplayName (ResourceLoader.getText ("EVT_NAME_UNDOABLE_EDIT")); - undoableEdit.setShortDescription (ResourceLoader.getText ("EVT_DESC_UNDOABLE_EDIT")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { dataQueue, document, error, - propertyChange, undoableEdit, vetoableChange, working }; - - // Properties. - PropertyDescriptor path = new PropertyDescriptor ("path", beanClass_); - path.setBound (true); - path.setConstrained (true); - path.setDisplayName (ResourceLoader.getText ("PROP_NAME_PATH")); - path.setShortDescription (ResourceLoader.getText ("PROP_DESC_PATH")); - - PropertyDescriptor system = new PropertyDescriptor ("system", beanClass_); - system.setBound (true); - system.setConstrained (true); - system.setDisplayName (ResourceLoader.getText ("PROP_NAME_SYSTEM")); - system.setShortDescription (ResourceLoader.getText ("PROP_DESC_SYSTEM")); - - properties_ = new PropertyDescriptor[] { path, system }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // DataQueueEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // path. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. - -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("DataQueueDocument16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("DataQueueDocument32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/DataQueueEventSupport.java b/cvsroot/src/com/ibm/as400/vaccess/DataQueueEventSupport.java deleted file mode 100644 index e49aff93d..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/DataQueueEventSupport.java +++ /dev/null @@ -1,201 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DataQueueEventSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.DataQueueEvent; -import com.ibm.as400.access.DataQueueListener; -import java.util.Vector; - - - -/** -The DataQueueEventSupport class represents a list of DataQueueListeners. -This is also a DataQueueListener and will dispatch all DataQueueEvents -that it receives. -**/ -class DataQueueEventSupport -implements DataQueueListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private transient DataQueueListener[] listeners_ = new DataQueueListener[0]; // For speed. - private transient Vector listenersV_ = new Vector (); - private Object source_; - - - -/** -Constructs a DataQueueEventSupport object. - -@param source The source of the events. -**/ - public DataQueueEventSupport (Object source) - { - source_ = source; - } - - - -/** -Adds a listener. - -@param listener The listener. -**/ - public void addDataQueueListener (DataQueueListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - listenersV_.addElement (listener); - synchronized (listeners_) { - listeners_ = new DataQueueListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - - - -/** -Fires a data queue cleared event. - -@param event The event. -**/ - public void fireCleared (DataQueueEvent event) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].cleared (event); - } - } - - - -/** -Fires a data queue peeked event. - -@param event The event. -**/ - public void firePeeked (DataQueueEvent event) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].peeked (event); - } - } - - - -/** -Fires a data queue read event. - -@param event The event. -**/ - public void fireRead (DataQueueEvent event) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].read (event); - } - } - - - -/** -Fires a data queue written event. - -@param event The event. -**/ - public void fireWritten (DataQueueEvent event) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].written (event); - } - } - - - -/** -Processes data queue cleared events. - -@param event The event. -**/ - public void cleared (DataQueueEvent event) - { - fireCleared (event); - } - - - -/** -Processes data queue peeked events. - -@param event The event. -**/ - public void peeked (DataQueueEvent event) - { - firePeeked (event); - } - - - -/** -Processes data queue read events. - -@param event The event. -**/ - public void read (DataQueueEvent event) - { - fireRead (event); - } - - - -/** -Processes data queue written events. - -@param event The event. -**/ - public void written (DataQueueEvent event) - { - fireWritten (event); - } - - - -/** -Removes a listener. - -@param listener The listener. -**/ - public void removeDataQueueListener (DataQueueListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - if (listenersV_.removeElement (listener)) { - synchronized (listeners_) { - listeners_ = new DataQueueListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/DialogAction.java b/cvsroot/src/com/ibm/as400/vaccess/DialogAction.java deleted file mode 100644 index b618764f1..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/DialogAction.java +++ /dev/null @@ -1,200 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DialogAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JDialog; -import javax.swing.JPanel; -import javax.swing.JTextField; -import java.awt.BorderLayout; -import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - - -/** -The DialogAction class is an action that displays a -dialog box for an object in a modeless dialog. -**/ -abstract class DialogAction -extends AbstractVAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // MRI. - private static final String cancelText_ = ResourceLoader.getText ("DLG_CANCEL"); - private static final String okText_ = ResourceLoader.getText ("DLG_OK"); - private boolean dialogLocked_ = false; - - // private data - JDialog dialog = null; // Private. - -/** -Constructs a DialogAction object. -**/ - public DialogAction (VObject object) - { - super (object); - } - - -/** -Returns the component for the dialog box. - -@return The component. -**/ - abstract public JComponent getInputComponent(); - - -/** -Performs the action of displaying the dialog box. - -@param context The action context. -**/ - public void perform (VActionContext context) - { - String title = getText (); - - // Create the buttons. - JButton cancelButton = new JButton (cancelText_); - JButton okButton = new JButton (okText_); - okButton.setSelected(true); - - // Listen to the buttons. - ActionListener_ actionListener = new ActionListener_ (cancelButton, - okButton); - okButton.addActionListener (actionListener); - cancelButton.addActionListener (actionListener); - - // Set up the button pane. - JPanel buttonPanel = new JPanel (); - buttonPanel.setLayout (new FlowLayout (FlowLayout.RIGHT)); - buttonPanel.add (okButton); - buttonPanel.add (cancelButton); - - // Get the graphical component. - JComponent component = null; - try { - component = getInputComponent (); - } - catch (Exception e) - { - fireError (e); - return; - } - - // Layout the dialog. - dialog = new JDialog (context.getFrame (), title, false); - dialog.getContentPane ().setLayout (new BorderLayout ()); - dialog.getContentPane ().add ("South", buttonPanel); - dialog.getContentPane ().add ("Center", component); - dialog.setResizable (false); - dialog.pack (); - dialog.addWindowListener (new WindowListener_ ()); - - // Show the dialog. - dialog.show (); - - // @A1 - // Set default focus for QueuedMessageReplyAction - if (this instanceof QueuedMessageReplyAction) { - for (int i=0; i 1) { - - // Get the object that was double clicked, if any. - VObject object = pane_.getObjectAt (event.getPoint ()); - if (object != null) { - - // If the object has a default action, then perform it. - VAction defaultAction = object.getDefaultAction (); - if (defaultAction != null) - defaultAction.perform (actionContext_); - - // Otherwise, if the object is a VNode, then set the - // pane to display this object. - else if (object instanceof VNode) { - try { - pane_.setRoot ((VNode) object); - } - catch (PropertyVetoException e) { - // Ignore. - } - } - - } - } - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/DoubleClickList.java b/cvsroot/src/com/ibm/as400/vaccess/DoubleClickList.java deleted file mode 100644 index 48f9e003f..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/DoubleClickList.java +++ /dev/null @@ -1,176 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: DoubleClickList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.BorderLayout; -import java.awt.ItemSelectable; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.util.Enumeration; -import java.util.Vector; -import javax.swing.JComponent; -import javax.swing.JList; -import javax.swing.JScrollPane; -import javax.swing.ListModel; -import javax.swing.ListSelectionModel; - - -/** -The DoubleClickList class represents a JList which allows -only single selections and fires an item event when -an item is double clicked. -**/ -class DoubleClickList -extends JComponent -implements ItemSelectable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - JList list_; - JScrollPane scrollPane_; - - transient Vector itemListeners_; - - - - public DoubleClickList(String[] items) - { - super(); - - list_ = new JList(items); - list_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - scrollPane_ = new JScrollPane(list_); - - setLayout(new BorderLayout()); - add("Center", scrollPane_); - - initializeTransient(); - } - - - - public DoubleClickList(ListModel listModel) - { - super(); - - list_ = new JList(listModel); - list_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - scrollPane_ = new JScrollPane(list_); - - setLayout(new BorderLayout()); - add("Center", scrollPane_); - - initializeTransient(); - } - - - - public void addItemListener(ItemListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - itemListeners_.addElement(listener); - } - - - public int getSelectedIndex() - { - return list_.getSelectedIndex(); - } - - - public Object[] getSelectedObjects() - { - return list_.getSelectedValues(); - } - - - private void initializeTransient() - { - itemListeners_ = new Vector(); - - list_.addMouseListener(new MouseAdapter() { - public void mouseClicked (MouseEvent event) { - // If double click. - if (event.getClickCount() > 1) { - Object value = list_.getSelectedValue(); - if ((value != null) && (list_.isEnabled())) { - ItemEvent event2 = new ItemEvent(DoubleClickList.this, - ItemEvent.ITEM_STATE_CHANGED, - value, - ItemEvent.SELECTED); - Enumeration list = itemListeners_.elements(); - while(list.hasMoreElements()) { - ((ItemListener)list.nextElement()).itemStateChanged(event2); - } - } - } - } - }); - } - - - - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient(); - } - - - - public void removeItemListener(ItemListener listener) - { - if (listener == null) - throw new NullPointerException("listener"); - itemListeners_.removeElement(listener); - } - - - - public void setEnabled(boolean enabled) - { - list_.setEnabled(enabled); - } - - - - public void setListData(Object[] listData) - { - list_.setListData(listData); - } - - - public void setSelectedIndex(int selectedIndex) - { - list_.setSelectedIndex(selectedIndex); - } - - - public void setVisibleRowCount(int visibleRowCount) - { - list_.setVisibleRowCount(visibleRowCount); - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/ErrorDialogAdapter.java b/cvsroot/src/com/ibm/as400/vaccess/ErrorDialogAdapter.java deleted file mode 100644 index c24a9bf77..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ErrorDialogAdapter.java +++ /dev/null @@ -1,180 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ErrorDialogAdapter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import javax.swing.JDialog; -import javax.swing.JOptionPane; -import java.awt.Component; -import java.io.Serializable; - - - -/** -The ErrorDialogAdapter class represents an object -that listens for error events and displays a message dialog -for each error event. - -

    Most errors in the com.ibm.as400.vaccess package are reported using ErrorEvents -rather than throwing exceptions. An ErrorDialogAdapter object is -useful to give users feedback whenever an error occurs. - -

    The component property is used to determine the frame -that is to be the parent of message dialogs. If no -component is set, then a default frame will be used. - -

    The following example creates an explorer pane filled -with the contents of a directory in the integrated file -system. It will use an ErrorDialogAdapter -object to display all errors in a message dialog. - -

    -// Set up the explorer pane.
    -AS400ExplorerPane explorerPane = new AS400ExplorerPane ();
    -
    -// Set up the explorer pane to display the contents
    -// of a directory.
    -AS400 system = new AS400 ("MySystem", "Userid", "Password");
    -VIFSDirectory directory = new VIFSDirectory (system, "/myDirectory");
    -explorerPane.setRoot (directory);
    -
    -// Add the explorer pane to a frame.
    -frame.add (explorerPane);
    -
    -// Set up the error dialog adapter.
    -explorerPane.addErrorListener (new ErrorDialogAdapter (frame));
    -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class ErrorDialogAdapter -implements ErrorListener, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String title_ = ResourceLoader.getText ("DLG_ERROR_TITLE"); - - - - // Properties. - private Component component_ = null; - private boolean modal_ = true; //@C1A - - -/** -Constructs an ErrorDialogAdapter object. -**/ - public ErrorDialogAdapter () - { - } - - - -//@C1C - javadoc -/** -Constructs an ErrorDialogAdapter object. The dialog is modal by default. - -@param component Determines the parent frame for - dialogs. -**/ - public ErrorDialogAdapter (Component component) - { - component_ = component; - } - - -//@C1A -/** -Constructs an ErrorDialogAdapter object. - -@param component Determines the parent frame for - dialogs. -@param modal Specifies whether this dialog should be modal. -**/ - public ErrorDialogAdapter (Component component, boolean modal) - { - component_ = component; - modal_ = modal; - } - - -/** -Invoked when an error has occurred. This will display -a message dialog with the error message. - -@param event The event. -**/ - public void errorOccurred (ErrorEvent event) - { - if ((Trace.isTraceOn ()) && (Trace.isTraceErrorOn ())) // @B1A - event.getException ().printStackTrace (Trace.getPrintWriter ()); // @B1A - - String message = VUtilities.getExceptionText (event.getException ()); - message = VUtilities.formatHelp2 (message, 50); // @A1A - -//@C1D // Note: This is a modal dialog. -//@C1D JOptionPane.showMessageDialog (component_, message, title_, -//@C1D JOptionPane.ERROR_MESSAGE); -// @C1: Changed ErrorDialogAdapter to be either modal or non-modal. -// The reason for having a modal option is to allow the caller to setup -// an ErrorDialogAdapter that isn't modal by default. In some cases, -// a modal EDA will hang the Swing thread if the EDA is displayed during -// the creation of another visual component. This is a Swing bug for which -// there is no known fix. A non-modal EDA will not block the current thread -// when it is shown, which allows Swing to paint the parent component. -//@C2D Performing a dialog.toFront() seems to be as close to modal behavior -//@C2D that a non-modal dialog can get. - JOptionPane pane = new JOptionPane(message, JOptionPane.ERROR_MESSAGE); //@C1A - JDialog dialog = pane.createDialog(component_, title_); //@C1A - dialog.setModal(modal_); //@C1A - dialog.setResizable(false); //@C1A - dialog.pack(); //@C1A - // @C2D dialog.toFront(); //@C1A - dialog.show(); //@C1A - } - - - -/** -Returns the component that determines the parent frame -for dialogs. - -@return The component, or null if none has been set. -**/ - public Component getComponent () - { - return component_; - } - - - -/** -Sets the component that determines the parent frame -for dialogs. - -@param component The component, or null to use a - default frame. -**/ - public void setComponent (Component component) - { - component_ = component; - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/ErrorDialogAdapter16.gif b/cvsroot/src/com/ibm/as400/vaccess/ErrorDialogAdapter16.gif deleted file mode 100644 index db9205010..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/ErrorDialogAdapter16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/ErrorDialogAdapter32.gif b/cvsroot/src/com/ibm/as400/vaccess/ErrorDialogAdapter32.gif deleted file mode 100644 index e7adc1f59..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/ErrorDialogAdapter32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/ErrorDialogAdapterBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/ErrorDialogAdapterBeanInfo.java deleted file mode 100644 index b98b213ba..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ErrorDialogAdapterBeanInfo.java +++ /dev/null @@ -1,159 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ErrorDialogAdapterBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - - - -/** -The ErrorDialogAdapterBeanInfo class provides bean information -for the ErrorDialogAdapter class. - -@see ErrorDialogAdapter -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class ErrorDialogAdapterBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = ErrorDialogAdapter.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - events_ = new EventSetDescriptor[0]; - - // Properties. - PropertyDescriptor component = new PropertyDescriptor ("component", beanClass_); - component.setBound (false); - component.setConstrained (false); - component.setDisplayName (ResourceLoader.getText ("PROP_NAME_COMPONENT")); - component.setShortDescription (ResourceLoader.getText ("PROP_DESC_COMPONENT")); - - properties_ = new PropertyDescriptor[] { component }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // None. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // component. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("ErrorDialogAdapter16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("ErrorDialogAdapter32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/ErrorEvent.java b/cvsroot/src/com/ibm/as400/vaccess/ErrorEvent.java deleted file mode 100644 index 0d79cb53f..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ErrorEvent.java +++ /dev/null @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ErrorEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; - - - -/** - The ErrorEvent class represents an error event. - @deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class ErrorEvent extends java.util.EventObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - private Exception exception_; - - - /** - * Constructs an ErrorEvent object. - * @param source The object where the event originated. - * @param exception The exception object that further describes the error. - **/ - public ErrorEvent(Object source, - Exception exception) - { - super(source); - exception_ = exception; - - Trace.log (Trace.DIAGNOSTIC, "Error event: (" + exception.getClass () + ") " + exception.getMessage ()); // @B0C - } - - /** - * Returns the exception which triggered this event. - * @return The exception which triggered this event. - **/ - public Exception getException() - { - return exception_; - } -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/ErrorEventSupport.java b/cvsroot/src/com/ibm/as400/vaccess/ErrorEventSupport.java deleted file mode 100644 index 545c6bef7..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ErrorEventSupport.java +++ /dev/null @@ -1,246 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ErrorEventSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.util.Enumeration; -import java.util.Vector; - - - -/** -The ErrorEventSupport class represents a list of -ErrorListeners. It manages the list as well as -provides notification services for ErrorEvents. -This is also an ErrorListener and will dispatch -all error events. -**/ -// -// Implementation note: -// -// @A1A -// THIS APPLIES TO ALL "EVENT SUPPORT" CLASSES IN THIS PACKAGE: -// -// Class A is defined to fire ErrorEvents. As a result, it -// has to maintain a list of the listeners. Since many classes -// in the package have to do this, we provide an "event support" -// class to maintain this list. This is patterened after -// the java.beans.PropertyChangeSupport class provided in the JDK. -// -// public class A -// { -// private ErrorEventSupport eventSupport_ = new ErrorEventSupport (this); -// -// public void addErrorListener (ErrorListener listener) -// { -// eventSupport_.addErrorListener (listener); -// } -// -// public void removeErrorListener (ErrorListener listener) -// { -// eventSupport_.removeErrorListener (listener); -// } -// -// public void someMethod () -// { -// ... some code here ... -// eventSupport_.fireObjectChanged (anObject); -// ... some more code here ... -// } -// } -// -// There is another case where class A contains a private instance -// of class B. B fires ErrorEvents, and A needs to listen -// to B and refire all ErrorEvents. In addition, it needs -// to change the source of the event so that it looks like -// A is the source, even though B is the real source. The -// reason for this is that listeners have public access to the -// source of the event, and we don't want them to have access to B. -// -// This is all easy to accompilsh by simply adding the -// event support object as a listener to B. The event -// support object takes care of the rest. -// -// public class A -// { -// private B b_; -// private ErrorEventSupport eventSupport_ = new ErrorEventSupport (this); -// -// public A () -// { -// b_ = new B (); -// b_.addErrorListener (eventSupport_); -// } -// } -// -// This type of event dispatching happens all over in the -// vaccess package. This is because of the hierarchy of -// components. Consider an explorer pane that presents -// a view of a directory structure. Here is the hierarchy: -// -// AS400ExplorerPane -// | -// +-- AS400TreePane -// | | -// | +-- AS400TreeModel -// | | -// | +-- VIFSDirectory (root directory) <-----------+ -// | | | -// | +-- VIFSDirectory (subdirectory) | -// | | | | -// | | +-- VIFSFile (file in subdirectory) | -// | | | -// | +-- VIFSFile (file in root directory) | -// | | -// +-- AS400DetailsPane | -// | | -// +-- AS400DetailsModel | -// | | -// +----------------------------------------------+ -// -// If any object fires certain events, then all objects -// above them in the hierarchy need to hear about it. Rather -// than making all objects specifically listen to all objects -// below them, we just make them listen to the objects -// directly below them. Then they "bubble" (dispatch) them -// up the chain to the parent. All nodes in between can process -// them on the way up. -// -// Now, when one of the VIFSFile's catches an exception, it -// will fire an ErrorEvent up the chain, so that the top level -// frame can process it and, for example, put up an error -// dialog. -// -class ErrorEventSupport -implements ErrorListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// Source of the events. -private Object source_ = null; - -// Vector of listeners, used to add and remove listeners. -transient private Vector errorListenersV_ - = new Vector(); -// Array used to send the events. Is a copy of errorListenersV_, -// used for speed. -transient private ErrorListener[] errorListeners_ - = new ErrorListener[0]; - - - -/** -Constructs a ErrorEventSupport object. - -@param source The source of the events. -**/ -public ErrorEventSupport (Object source) -{ - source_ = source; -} - - - -/** -Adds a listener. - -@param listener The listener. -**/ -public void addErrorListener (ErrorListener listener) -{ - if (listener == null) - { - throw new NullPointerException("listener"); - } - - // Add new listener. - errorListenersV_.addElement(listener); - // copyInto is synchronized, so we don't have to synchronize V. - synchronized(errorListeners_) - { - errorListeners_ = new ErrorListener[errorListenersV_.size()]; - errorListenersV_.copyInto(errorListeners_); - } -} - - -/** -Processes a error event. - -@param event The event. -**/ -public void errorOccurred (ErrorEvent event) -{ - fireError ( event.getException() ); -} - - - -/** -Fires an ErrorEvent to listeners. - -@param e The exception. -**/ -void fireError(Exception e) -{ - fireError (new ErrorEvent(source_, e)); -} - - -/** -Fires an ErrorEvent to listeners. - -@param event The event. -**/ -void fireError(ErrorEvent event) -{ - synchronized(errorListeners_) - { - for (int i=0; icom.ibm.as400.access -**/ - -public interface ErrorListener extends java.util.EventListener -{ - /** - * Invoked when an error has occurred. - * @param event The error event. - **/ - public void errorOccurred(ErrorEvent event); -} - - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/FileEventSupport.java b/cvsroot/src/com/ibm/as400/vaccess/FileEventSupport.java deleted file mode 100644 index 939624cd5..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/FileEventSupport.java +++ /dev/null @@ -1,218 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FileEventSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.FileEvent; -import com.ibm.as400.access.FileListener; -import java.util.Vector; - - - -/** -The FileEventSupport class represents a list of FileListeners. -This is also a FileListener and will dispatch all file events. -**/ -class FileEventSupport -implements FileListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private transient FileListener[] listeners_ = new FileListener[0]; // For speed. - private transient Vector listenersV_ = new Vector (); - private Object source_; - - - -/** -Constructs a FileEventSupport object. - -@param source The source of the events. -**/ - public FileEventSupport (Object source) - { - source_ = source; - } - - - -/** -Adds a listener. - -@param listener The listener. -**/ - public void addFileListener (FileListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - listenersV_.addElement (listener); - synchronized (listeners_) { - listeners_ = new FileListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - - - -/** -Processes a file closed event. - -@param event The event. -**/ - public void fileClosed (FileEvent event) - { - fireFileClosed (); - } - - - -/** -Processes a file created event. - -@param event The event. -**/ - public void fileCreated (FileEvent event) - { - fireFileCreated (); - } - - - -/** -Processes a file deleted event. - -@param event The event. -**/ - public void fileDeleted (FileEvent event) - { - fireFileDeleted (); - } - - - -/** -Processes a file modified event. - -@param event The event. -**/ - public void fileModified (FileEvent event) - { - fireFileModified (); - } - - - -/** -Processes a file open event. - -@param event The event. -**/ - public void fileOpened (FileEvent event) - { - fireFileOpened (); - } - - - -/** -Fires a file closed event. -**/ - public void fireFileClosed () - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].fileClosed (new FileEvent (source_, FileEvent.FILE_CLOSED)); - } - } - - - -/** -Fires a file created event. -**/ - public void fireFileCreated () - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].fileCreated (new FileEvent (source_, FileEvent.FILE_CREATED)); - } - } - - - -/** -Fires a file deleted event. -**/ - public void fireFileDeleted () - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].fileClosed (new FileEvent (source_, FileEvent.FILE_DELETED)); - } - } - - - -/** -Fires a file modified event. -**/ - public void fireFileModified () - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].fileClosed (new FileEvent (source_, FileEvent.FILE_MODIFIED)); - } - } - - - -/** -Fires a file open event. -**/ - public void fireFileOpened () - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].fileClosed (new FileEvent (source_, FileEvent.FILE_OPENED)); - } - } - - - -/** -Removes a listener. - -@param listener The listener. -**/ - public void removeFileListener (FileListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - if (listenersV_.removeElement (listener)) { - synchronized (listeners_) { - listeners_ = new FileListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - } - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/FileFilter.java b/cvsroot/src/com/ibm/as400/vaccess/FileFilter.java deleted file mode 100644 index 2791f80e5..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/FileFilter.java +++ /dev/null @@ -1,83 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: FileFilter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; -/** - The FileFilter class provides file filtering support. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ - -public class FileFilter -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private String description_; - private String pattern_; - - /** - Constructs a FileFilter object. - **/ - public FileFilter() - { - super(); - } - - /** - Constructs a FileFilter object. - **/ - public FileFilter(String description, String pattern) - { - super(); - description_ = description; - pattern_ = pattern; - } - - /** - Returns the description. - @return The description. - **/ - public String getDescription() - { - return description_; - } - - /** - Returns the pattern. - @return The pattern. - **/ - public String getPattern() - { - return pattern_; - } - - /** - Sets the description. - @param description The description. - **/ - public void setDescription(String description) - { - description_ = description; - } - - /** - Sets the pattern. - @param pattern The pattern. - **/ - public void setPattern(String pattern) - { - pattern_ = pattern; - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/FirstIcon.gif b/cvsroot/src/com/ibm/as400/vaccess/FirstIcon.gif deleted file mode 100644 index 16e722255..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/FirstIcon.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/FitPageIcon.gif b/cvsroot/src/com/ibm/as400/vaccess/FitPageIcon.gif deleted file mode 100644 index 1bd052373..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/FitPageIcon.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/FitWidthIcon.gif b/cvsroot/src/com/ibm/as400/vaccess/FitWidthIcon.gif deleted file mode 100644 index d6fe88c89..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/FitWidthIcon.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/FlashIcon.gif b/cvsroot/src/com/ibm/as400/vaccess/FlashIcon.gif deleted file mode 100644 index 7d0192c17..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/FlashIcon.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/GoToIcon.gif b/cvsroot/src/com/ibm/as400/vaccess/GoToIcon.gif deleted file mode 100644 index fcb2e68d9..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/GoToIcon.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/IFSDeleteAction.java b/cvsroot/src/com/ibm/as400/vaccess/IFSDeleteAction.java deleted file mode 100644 index adc8d73a0..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/IFSDeleteAction.java +++ /dev/null @@ -1,125 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSDeleteAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.IFSFile; -import com.ibm.as400.access.Trace; -import java.io.IOException; - - - -/** -The IFSDeleteAction class represents the action of deleting a -file or directory. -**/ -class IFSDeleteAction -extends ConfirmedAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String confirmTitleText_ = ResourceLoader.getText ("DLG_CONFIRM_DELETION_TITLE"); - private static final String confirmMessageText_ = ResourceLoader.getText ("DLG_CONFIRM_DELETION"); - private static final String text_ = ResourceLoader.getText ("ACTION_DELETE"); - - - - // Private data. - private IFSFile file_ = null; - - - -/** -Constructs an IFSDeleteAction object. - -@param object The object representing the file or directory. -@param file The file or directory. -@param parent The parent directory. -**/ - public IFSDeleteAction (VObject object, - IFSFile file) - { - super (object, confirmTitleText_, confirmMessageText_); - file_ = file; - } - - - -/** -Returns the text for the action. - -@return The text. -**/ - public String getText () - { - return text_; - } - - - -/** -Performs the action after the user has confirmed it. - -@param context The action context. -**/ - public void perform2 (VActionContext context) - { - if (Trace.isTraceOn()) - Trace.log (Trace.INFORMATION, "Deleting file or directory [" - + file_.getPath () + "]."); - - // It is VERY important to fire the "stop working" event - // before firing the "object deleted" event. Otherwise, - // the working cursor adapters will never detect the - // "stop working" event because all of the working listener - // wiring gets disconnected by the processing of the - // "object deleted" event. - fireStartWorking (); - boolean objectDeleted = false; - - try { - - // If for some reason the file has already been deleted, - // then get rid of it on the pane, but still fire an - // error event. - if (file_.exists () == false) { - fireError (new IOException (ResourceLoader.getText ("EXC_FILE_NOT_FOUND"))); - objectDeleted = true; - } - - // Try to delete the file. - else if (file_.delete () == true) - objectDeleted = true; - else { - // Unfortunately, we do not get any information as - // to why the file or directory could not be deleted, - // so we fire a generic error event. - fireError (new IOException (ResourceLoader.getText ("EXC_FILE_NOT_DELETED"))); - } - } - catch (IOException e) { - fireError (e); - } - - fireStopWorking (); - if (objectDeleted) - fireObjectDeleted (); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/IFSDirectoryCreateAction.java b/cvsroot/src/com/ibm/as400/vaccess/IFSDirectoryCreateAction.java deleted file mode 100644 index 572de2d0f..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/IFSDirectoryCreateAction.java +++ /dev/null @@ -1,280 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSDirectoryCreateAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.IFSFile; -import com.ibm.as400.access.Trace; -import javax.swing.CellEditor; -import javax.swing.event.CellEditorListener; -import javax.swing.event.ChangeEvent; -import java.io.IOException; - - - -/** -The IFSDirectoryCreateAction class represents the action of -creating a new directory. It creates the directory with a -default name, and then prompts the user to rename it. -**/ -class IFSDirectoryCreateAction -implements VAction, CellEditorListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String newName_ = ResourceLoader.getText ("IFS_NEW_DIRECTORY"); - private static final String text_ = ResourceLoader.getText ("ACTION_DIRECTORY_CREATE"); - - - - // Private data. - private IFSFile directory_ = null; - private boolean enabled_ = true; - private IFSFile newDirectory_ = null; - private VIFSDirectory newObject_ = null; - private VIFSDirectory object_ = null; - - - - // Event support. - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - - -/** -Constructs an IFSDirectoryCreateAction object. - -@param object The object. -@param directory The directory. -**/ - public IFSDirectoryCreateAction (VIFSDirectory object, IFSFile directory) - { - directory_ = directory; - object_ = object; - } - - - -/** -Adds an error listener. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a VObjectListener. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a working listener. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Processes an editing canceled event. - -@param event The event. -**/ - public void editingCanceled (ChangeEvent event) - { - // Go with the default name, no need to - // rename. - } - - - -/** -Processes an editing stopped event. - -@param event The event. -**/ - public void editingStopped (ChangeEvent event) - { - CellEditor editor = (CellEditor) event.getSource (); - editor.removeCellEditorListener (this); - - // Rename the directory. - String newName = editor.getCellEditorValue ().toString (); - try { - if (Trace.isTraceOn()) - Trace.log (Trace.INFORMATION, "Renaming new directory [" - + newDirectory_.getName () + "] to [" + newName + "]."); - - newDirectory_.renameTo (new IFSFile (newDirectory_.getSystem (), - newDirectory_.getParent (), newName)); - objectEventSupport_.fireObjectChanged (newObject_); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - } - - - -/** -Returns the text for the action. - -@return The text. -**/ - public String getText () - { - return text_; - } - - - -/** -Indicates if the action is enabled. - -@return true if the action is enabled, false otherwise. -**/ - public boolean isEnabled () - { - return enabled_; - } - - - -/** -Performs the action. - -@param context The action context. -**/ - public void perform (VActionContext context) - { - try { - // Determine the default name for the new directory. Make - // sure that a directory with the name does not already exist. - int count = 1; - boolean success = false; - AS400 system = directory_.getSystem (); - newDirectory_ = new IFSFile (system, directory_, newName_); - while (newDirectory_.exists ()) { - ++count; - newDirectory_ = new IFSFile (system, directory_, - newName_ + " (" + count + ")"); - } - - // Create the directory. - if (Trace.isTraceOn()) - Trace.log (Trace.INFORMATION, "Creating new directory [" - + newDirectory_.getName () + "]."); - - newDirectory_.mkdir (); - newObject_ = new VIFSDirectory (object_, newDirectory_); - - // Make sure new directory is incorporated into object. - // We can do this without a reload. - objectEventSupport_.fireObjectCreated (newObject_, object_); - - // Automatically put the user into a rename. - CellEditor editor = context.startEditing (newObject_, VIFSDirectory.NAME_PROPERTY); - if (editor != null) - editor.addCellEditorListener (this); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Sets the enabled state of the action. - -@param enabled true if the action is enabled, false otherwise. -**/ - public void setEnabled (boolean enabled) - { - enabled_ = enabled; - } - - - -/** -Returns the text for the action. - -@return The text. -**/ - public String toString () - { - return getText (); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/IFSDirectoryFilter.java b/cvsroot/src/com/ibm/as400/vaccess/IFSDirectoryFilter.java deleted file mode 100644 index 0086758a6..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/IFSDirectoryFilter.java +++ /dev/null @@ -1,152 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSDirectoryFilter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.IFSFile; -import com.ibm.as400.access.IFSFileFilter; -import java.io.IOException; -import java.io.Serializable; - - - -/** -The IFSDirectoryFilter class provides support that -optionally weeds out files along with another filter. -**/ -class IFSDirectoryFilter -implements IFSFileFilter, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private int include_; - private IFSFileFilter otherFilter_; - - - -/** -Constructs an IFSDirectoryFilter object. - -@param include One of the constants: INCLUDE_FILES, - INCLUDE_DIRECTORIES, or INCLUDE_BOTH. -@param filter The other filter, or null if none. -**/ - public IFSDirectoryFilter (int include, - IFSFileFilter otherFilter) - { - include_ = include; - otherFilter_ = otherFilter; - } - - - -/** -Indicates if the file is accepted by the filter. The filter -will accept the file if and only if it is a directory. - -@param file The file. -@return true if the file is accepted by the filter, - false otherwise. -**/ - public boolean accept (IFSFile file) - { - boolean accept = true; - - // If we do not want to include files, then check - // to see if this is a directory. - try { - switch (include_) { - case VIFSDirectory.INCLUDE_FILES: - accept = ! file.isDirectory (); - break; - case VIFSDirectory.INCLUDE_DIRECTORIES: - accept = file.isDirectory (); - break; - case VIFSDirectory.INCLUDE_BOTH: - default: - accept = true; - break; - } - } - catch (IOException e) { - // Ignore. The file will not be accepted. - accept = false; - } - - // Check the other filter if necessary. - if ((accept == true) && (otherFilter_ != null)) - accept = otherFilter_.accept (file); - - return accept; - } - - - -/** -Indicates if files or directories are contained in the list of -children. - -@return One of the constants: INCLUDE_FILES, INCLUDE_DIRECTORIES, - or INCLUDE_BOTH. -**/ - public int getInclude () - { - return include_; - } - - - -/** -Returns the other filter which determines which files are -accepted. - -@return The other filter, or null if none. -**/ - public IFSFileFilter getOtherFilter () - { - return otherFilter_; - } - - - -/** -Sets whether files or directories are contained in the list of -children. - -@param include One of the constants: INCLUDE_FILES, - INCLUDE_DIRECTORIES, or INCLUDE_BOTH. -**/ - public void setInclude (int include) - { - include_ = include; - } - - - -/** -Sets the other filter which determines which files are -accepted. - -@param filter The other filter, or null if none. -**/ - public void setOtherFilter (IFSFileFilter otherFilter) - { - otherFilter_ = otherFilter; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/IFSDirectoryPropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/IFSDirectoryPropertiesPane.java deleted file mode 100644 index 5348e1593..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/IFSDirectoryPropertiesPane.java +++ /dev/null @@ -1,272 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSDirectoryPropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.IFSFile; -import com.ibm.as400.access.Trace; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ChangeListener; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.text.DateFormat; -import java.util.TimeZone; - - - -/** -The IFSDirectoryPropertiesPane class represents the properties pane -for a VIFSDirectory object. -**/ -class IFSDirectoryPropertiesPane -implements VPropertiesPane -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String byteText_ = ResourceLoader.getText ("IFS_BYTE"); - private static final String bytesText_ = ResourceLoader.getText ("IFS_BYTES"); - private static final String containsText_ = ResourceLoader.getText ("IFS_CONTAINS") + ":"; - private static final String directoryText_ = ResourceLoader.getText ("IFS_DIRECTORY"); - private static final String directoriesText_= ResourceLoader.getText ("IFS_DIRECTORIES"); - private static final String fileText_ = ResourceLoader.getText ("IFS_FILE"); - private static final String filesText_ = ResourceLoader.getText ("IFS_FILES"); - private static final String generalText_ = ResourceLoader.getText ("TAB_GENERAL"); - private static final String locationText_ = ResourceLoader.getText ("IFS_LOCATION") + ":"; - private static final String modifiedText_ = ResourceLoader.getText ("IFS_MODIFIED") + ":"; - private static final String sizeText_ = ResourceLoader.getText ("IFS_SIZE") + ":"; - - - - // Static data. - private static DateFormat dateFormat_ = DateFormat.getDateTimeInstance (); - - - - // Private data. - private VIFSDirectory object_; - - - - // Event support. - private ChangeEventSupport changeEventSupport_ = new ChangeEventSupport (this); - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - - -/** -Static initializer. -**/ - static - { - dateFormat_.setTimeZone (TimeZone.getDefault ()); - } - - - -/** -Constructs an IFSDirectoryPropertiesPane object. - -@param object The object. -**/ - public IFSDirectoryPropertiesPane (VIFSDirectory object) - { - object_ = object; - } - - - -/** -Adds a change listener. - -@param listener The listener. -**/ - public void addChangeListener (ChangeListener listener) - { - changeEventSupport_.addChangeListener (listener); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Applies the changes made by the user. - -@throws Exception If an error occurs. -**/ - public void applyChanges () - throws Exception - { - // No changes are allowed. - } - - - -/** -Returns the graphical component. - -@return The graphical component. -@throws Exception If an error occurs. -**/ - public Component getComponent () - { - // Initialize the general tab. - JPanel generalTab = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - generalTab.setLayout (layout); - generalTab.setBorder (new EmptyBorder (10, 10, 10, 10)); - - // Add the components. - int row = 0; - VUtilities.constrain (new JLabel (object_.getText (), object_.getIcon (32, false), SwingConstants.LEFT), - generalTab, layout, 0, row++, 2, 1); - - VUtilities.constrain (new JSeparator (), - generalTab, layout, 0, row++, 2, 1); - - VUtilities.constrain (new JLabel (locationText_), - generalTab, layout, 0, row, 1, 1); - VUtilities.constrain (new JLabel (object_.getParentDirectory ()), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JLabel (containsText_), - generalTab, layout, 0, row, 1, 1); - int directoryCount = object_.getDirectoryCount (); - int fileCount = object_.getFileCount (); - VUtilities.constrain (new JLabel (Integer.toString (fileCount) + " " - + ((fileCount == 1) ? fileText_ : filesText_) + ", " - + Integer.toString (directoryCount) + " " - + ((directoryCount == 1) ? directoryText_ : directoriesText_)), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JSeparator (), - generalTab, layout, 0, row++, 2, 1); - - VUtilities.constrain (new JLabel (modifiedText_), - generalTab, layout, 0, row, 1, 1); - VUtilities.constrain (new JLabel (dateFormat_.format (object_.getModified ())), - generalTab, layout, 1, row, 1, 1); - row++; - - // Build the pane. - JTabbedPane pane = new JTabbedPane (); - pane.addTab (generalText_, null, generalTab); - pane.setSelectedIndex (0); - return pane; - } - - - -/** -Removes a change listener. - -@param listener The listener. -**/ - public void removeChangeListener (ChangeListener listener) - { - changeEventSupport_.removeChangeListener (listener); - } - - - -/** -Removes a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/IFSEditAction.java b/cvsroot/src/com/ibm/as400/vaccess/IFSEditAction.java deleted file mode 100644 index 2753157c6..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/IFSEditAction.java +++ /dev/null @@ -1,382 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSEditAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.IFSFile; -import com.ibm.as400.access.FileEvent; -import com.ibm.as400.access.FileListener; -import com.ibm.as400.access.Trace; -import javax.swing.JFrame; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JScrollPane; -import javax.swing.JTextPane; -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.IOException; - - - -/** -The IFSEditAction class represents the action of editing or -viewing an IFS file. -**/ -class IFSEditAction -implements VAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String copyText_ = ResourceLoader.getText ("MENU_COPY"); - private static final String cutText_ = ResourceLoader.getText ("MENU_CUT"); - private static final String editActionText_ = ResourceLoader.getText ("ACTION_EDIT"); - private static final String editText_ = ResourceLoader.getText ("MENU_EDIT"); - private static final String exitText_ = ResourceLoader.getText ("MENU_EXIT"); - private static final String fileText_ = ResourceLoader.getText ("MENU_FILE"); - private static final String pasteText_ = ResourceLoader.getText ("MENU_PASTE"); - private static final String saveConfirmText_ = ResourceLoader.getText ("DLG_CONFIRM_SAVE"); - private static final String saveConfirmTitle_ = ResourceLoader.getText ("DLG_CONFIRM_SAVE_TITLE"); - private static final String saveText_ = ResourceLoader.getText ("MENU_SAVE"); - private static final String selectAllText_ = ResourceLoader.getText ("MENU_SELECT_ALL"); - private static final String viewActionText_ = ResourceLoader.getText ("ACTION_VIEW"); - - - - // Private data. - private boolean allowChanges_ = true; - private boolean enabled_ = true; - private IFSFile file_ = null; - private VObject object_ = null; - - - - // Event support. - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - - -/** -Constructs an IFSEditAction object. - -@param object The object. -@param file The file. -@param allowChanges true if changes are allowed, false otherwise. -**/ - public IFSEditAction (VObject object, - IFSFile file, - boolean allowChanges) - { - object_ = object; - file_ = file; - allowChanges_ = allowChanges; - } - - - -/** -Adds an error listener. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a VObjectListener. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a working listener. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Cleans up before an edit session is done. If the document has -been modified, this will the prompt the user for a save. - -@param document The document. -@param frame The frame. -@param allowCancel true to allow cancel, false otherwise. -**/ - void exit (IFSTextFileDocument document, - JFrame frame, - boolean allowCancel) // Private. - { - boolean cancelled = false; - if (document.isModified ()) { - int optionType = allowCancel ? JOptionPane.YES_NO_CANCEL_OPTION - : JOptionPane.YES_NO_OPTION; - int response = JOptionPane.showConfirmDialog (frame, - saveConfirmText_, saveConfirmTitle_, optionType); - switch (response) { - case JOptionPane.YES_OPTION: - save (document); - break; - case JOptionPane.NO_OPTION: - default: - break; - case JOptionPane.CANCEL_OPTION: - cancelled = true; - break; - } - } - - if (cancelled == false) { - // Make the frame go away. - frame.setVisible (false); - } - } - - - -/** -Returns the localized text for the action. - -@return The text. -**/ - public String getText () - { - return allowChanges_ ? editActionText_ : viewActionText_; - } - - - -/** -Indicates if the action is enabled. - -@return true if the action is enabled, false otherwise. -**/ - public boolean isEnabled () - { - return enabled_; - } - - - -/** -Performs the action. - -@param context The action context. -**/ - public void perform (VActionContext context) - { - if (Trace.isTraceOn()) { - if (allowChanges_) - Trace.log (Trace.INFORMATION, "Editing file [" - + file_.getName () + "]."); - else - Trace.log (Trace.INFORMATION, "Viewing file [" - + file_.getName () + "]."); - } - - // Create the pieces. - IFSTextFileDocument document = new IFSTextFileDocument (file_); - document.load (); - - JTextPane textPane = new JTextPane (document); - textPane.setEditable (allowChanges_); - // @A1D textPane.setPreferredSize (new java.awt.Dimension (400, 400)); - - document.addWorkingListener (new WorkingCursorAdapter (textPane)); - - JScrollPane scrollPane = new JScrollPane (textPane); - scrollPane.setHorizontalScrollBarPolicy (JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - scrollPane.setVerticalScrollBarPolicy (JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - - // Create the window, part 1. - JFrame frame = new JFrame (file_.getPath ()); - frame.getRootPane ().setPreferredSize (new java.awt.Dimension (400, 400)); // @A1A - - // Create the menu bar. - JMenuBar menuBar = new JMenuBar(); - JMenu menu; - JMenuItem menuItem; - - final IFSTextFileDocument document2 = document; - final JFrame frame2 = frame; - final JTextPane textPane2 = textPane; - - // Create the file menu. - menu = new JMenu (fileText_); - - menuItem = new JMenuItem (saveText_); - menuItem.addActionListener (new ActionListener () { - public void actionPerformed (ActionEvent event) { save (document2); } - }); - menuItem.setEnabled (allowChanges_); - menu.add (menuItem); - - menu.addSeparator (); - - menuItem = new JMenuItem (exitText_); - menuItem.addActionListener (new ActionListener () { - public void actionPerformed (ActionEvent event) { exit (document2, frame2, true); } - }); - menu.add (menuItem); - - menuBar.add (menu); - - // Create the edit menu. - menu = new JMenu (editText_); - - menuItem = new JMenuItem (cutText_); - menuItem.addActionListener (new ActionListener () { - public void actionPerformed (ActionEvent event) { textPane2.cut (); } - }); - menuItem.setEnabled (allowChanges_); - menu.add (menuItem); - - menuItem = new JMenuItem (copyText_); - menuItem.addActionListener (new ActionListener () { - public void actionPerformed (ActionEvent event) { textPane2.copy (); } - }); - menuItem.setEnabled (true); - menu.add (menuItem); - - menuItem = new JMenuItem (pasteText_); - menuItem.addActionListener (new ActionListener () { - public void actionPerformed (ActionEvent event) { textPane2.paste (); } - }); - menuItem.setEnabled (allowChanges_); - menu.add (menuItem); - - menu.addSeparator (); - - menuItem = new JMenuItem (selectAllText_); - menuItem.addActionListener (new ActionListener () { - public void actionPerformed (ActionEvent event) { textPane2.selectAll (); } - }); - menuItem.setEnabled (true); - menu.add (menuItem); - - menuBar.add (menu); - - // Create the window, part 2. - frame.addWindowListener (new WindowAdapter () { - public void windowClosing (WindowEvent event) { exit (document2, frame2, false); } - }); - frame.getRootPane ().setJMenuBar (menuBar); // @C0C - frame.getContentPane ().setLayout (new BorderLayout ()); - frame.getContentPane ().add ("Center", scrollPane); - frame.pack (); - frame.show (); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Saves the file. - -@param document The document. -**/ - void save (IFSTextFileDocument document) // Private. - { - document.save (); - object_.load (); - objectEventSupport_.fireObjectChanged (object_); - } - - - -/** -Sets the enabled state of the action. - -@param enabled true if the action is enabled, false otherwise. -**/ - public void setEnabled (boolean enabled) - { - enabled_ = enabled; - } - - - -/** -Returns the text for the action. - -@return The text. -**/ - public String toString () - { - return getText (); - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/IFSFileCreateAction.java b/cvsroot/src/com/ibm/as400/vaccess/IFSFileCreateAction.java deleted file mode 100644 index 79d4d726b..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/IFSFileCreateAction.java +++ /dev/null @@ -1,283 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileCreateAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.IFSFile; -import com.ibm.as400.access.IFSFileOutputStream; -import com.ibm.as400.access.Trace; -import javax.swing.CellEditor; -import javax.swing.event.CellEditorListener; -import javax.swing.event.ChangeEvent; -import java.io.IOException; - - - - -/** -Represents the action of creating a new file. -**/ -class IFSFileCreateAction -implements VAction, CellEditorListener -{ - // MRI. - private static final String newName_ = ResourceLoader.getText ("IFS_NEW_FILE"); - private static final String text_ = ResourceLoader.getText ("ACTION_FILE_CREATE"); - - - - // Private data. - private boolean enabled_ = true; - private IFSFile file_ = null; - private IFSFile newFile_ = null; - private VIFSFile newObject_ = null; - private VIFSDirectory object_ = null; - - - - // Event support. - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - - -/** -Constructs an IFSFileCreateAction object. - -@param object The object. -@param file The file. -**/ - public IFSFileCreateAction (VIFSDirectory object, IFSFile file) - { - file_ = file; - object_ = object; - } - - - -/** -Adds an error listener. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a VObjectListener. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a working listener. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Processes an editing canceled event. - -@param event The event. -**/ - public void editingCanceled (ChangeEvent event) - { - // Go with the default name, no need to - // rename. - } - - - -/** -Processes an editing stopped event. - -@param event The event. -**/ - public void editingStopped (ChangeEvent event) - { - CellEditor editor = (CellEditor) event.getSource (); - editor.removeCellEditorListener (this); - - // Rename the file. - String newName = editor.getCellEditorValue ().toString (); - try { - if (Trace.isTraceOn()) - Trace.log (Trace.INFORMATION, "Renaming new file [" - + newFile_.getName () + "] to [" + newName + "]."); - - newFile_.renameTo (new IFSFile (newFile_.getSystem (), - newFile_.getParent (), newName)); - objectEventSupport_.fireObjectChanged (newObject_); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - } - - - -/** -Returns the text for the action. - -@return The text. -**/ - public String getText () - { - return text_; - } - - - -/** -Indicates if the action is enabled. - -@return true if the action is enabled, false otherwise. -**/ - public boolean isEnabled () - { - return enabled_; - } - - - -/** -Performs the action. - -@param context The action context. -**/ - public void perform (VActionContext context) - { - IFSFileOutputStream outputStream = null; - try { - // Determine the default name for the new file. Make - // sure that a file with the name does not already - // exist. - int count = 1; - boolean success = false; - AS400 system = file_.getSystem (); - newFile_ = new IFSFile (system, file_, newName_); - while (newFile_.exists ()) { - ++count; - newFile_ = new IFSFile (system, file_, newName_ + " (" + count + ")"); - } - - // Create the file. - if (Trace.isTraceOn()) - Trace.log (Trace.INFORMATION, "Creating file [" - + newFile_.getName () + "]."); - - outputStream = new IFSFileOutputStream (system, - newFile_, IFSFileOutputStream.SHARE_ALL, false); // creates file - newObject_ = new VIFSFile (newFile_); - - // Make sure new directory is incorporated into object. - // We can do this without a reload. - objectEventSupport_.fireObjectCreated (newObject_, object_); - - // Automatically put the user into a rename. - CellEditor editor = context.startEditing (newObject_, VIFSDirectory.NAME_PROPERTY); - if (editor != null) - editor.addCellEditorListener (this); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - finally { - if (outputStream != null) { - try { outputStream.close(); } - catch (Throwable e) { Trace.log(Trace.ERROR, e); } - } - } - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Sets the enabled state of the action. - -@param enabled true if the action is enabled, false otherwise. -**/ - public void setEnabled (boolean enabled) - { - enabled_ = enabled; - } - - - -/** -Returns the text for the action. - -@return The text. -**/ - public String toString () - { - return getText (); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/IFSFileDialog.java b/cvsroot/src/com/ibm/as400/vaccess/IFSFileDialog.java deleted file mode 100644 index f588670a2..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/IFSFileDialog.java +++ /dev/null @@ -1,884 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileDialog.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.*; -import java.awt.event.*; -import java.io.Serializable; -import java.util.Hashtable; -import com.ibm.as400.access.*; - -/** - * The IFSFileDialog class represents a - * file dialog for the IFS file classes. This dialog allows the user to - * traverse the file system and select a file. The text on the Cancel button - * and the OK button can be set by the calling application. - * - * A filter list can be provided by the caller. - * - * This dialog is designed to emulate the Windows file dialog. - * - * Usage: - *
    -  *      AS400 sys = new AS400("system1");
    -  *      IFSFileDialog fd = new IFSFileDialog(this, "File Open", sys);
    -  *      FileFilter[] filterList = {new FileFilter("All files (*.*)", "*.*"),
    -  *                                 new FileFilter("Executables (*.exe)", "*.exe"),
    -  *                                 new FileFilter("HTML files (*.html)", "*.html"),
    -  *                                 new FileFilter("HTML files (*.htm)", "*.htm"),
    -  *                                 new FileFilter("Images (*.gif)", "*.gif"),
    -  *                                 new FileFilter("Text files (*.txt)", "*.txt")};
    -  *      fd.setFileFilter(filterList, 2);
    -  *      if (fd.show() == IFSFileDialog.OK)
    -  *      {
    -  *         String s = fd.getFileName();        // get file name
    -  *         String p = fd.getPath();            // get path
    -  *         String a = fd.getAbsolutePath();    // get fully qualified file
    -  *      }
    -  * 
    - * @deprecated Use com.ibm.as400.access.IFSSystemView instead. - **/ -public class IFSFileDialog extends Dialog -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - //{{DECLARE_CONTROLS - private Label label1; - IFSList directoryList; // Private. @A3C - private Label label2; - IFSList fileList; // Private. @A3C - private Label label3; - TextField fileName; // Private. @A3C - private Label label4; - Choice fileType; // Private. @A3C - Button open; // Private. @A3C - Button cancel; // Private. @A3C - private Label currentDirectory; - TextField status; // Private. @A3C - //}} - - AS400 sys_; // Private. @A3C - int state_; // Private. @A3C - Hashtable filters_; // Private. @A3C - - private Listeners listener_; - - // MRI. - private static String READY_TEXT = ResourceLoader.getPrintText ("READY"); //@A6A - private static String WORKING_TEXT = ResourceLoader.getText ("EVT_NAME_WORKING"); //@A6A - - /** - * Dialog still active. - **/ - public static final int ACTIVE = 0; - /** - * Dialog was dismissed with the Ok button. - **/ - public static final int OK = 1; - /** - * Dialog was dismissed with the Cancel button. - **/ - public static final int CANCEL = 2; - -/** -Constructs an IFSFileDialog object. -@param parent The parent. -@param title The title of the dialog. -@param system The system. -**/ - public IFSFileDialog(Frame parent, String title, AS400 system) - { - super(parent, title, true); - - listener_ = new Listeners(); - - //{{INIT_CONTROLS -// setLayout(null); // @A2D -// addNotify(); // @A2D - - - // - // Start of @A2C - // - - // Create a GridBagLayout manager - GridBagLayout layout = new GridBagLayout(); - GridBagConstraints constraints = new GridBagConstraints(); - constraints.fill = GridBagConstraints.BOTH; - constraints.insets = new Insets(8, 8, 0, 8); - setLayout(layout); - - // Set the background color to light gray. - setBackground(Color.lightGray); - - String text = ResourceLoader.getText ("IFS_DIRECTORY"); //@A6a - label1 = new Label(text, Label.LEFT); // @A4C @A6c - add(label1, layout, constraints, 0, 0, 3, 1); - - directoryList = new IFSList(); - constraints.ipadx = 40; - constraints.ipady = 90; - add(directoryList, layout, constraints, 0, 1, 3, 5); - - text = ResourceLoader.getText ("IFS_FILE"); //@A6a - label2 = new Label(text, Label.LEFT); //@A6c - constraints.ipadx = 0; - constraints.ipady = 0; - add(label2, layout, constraints, 3, 0, 3, 1); - - fileList = new IFSList(); - constraints.ipadx = 40; - constraints.ipady = 90; - add(fileList, layout, constraints, 3, 1, 3, 5); - - text = ResourceLoader.getText ("IFS_FILE_NAME"); //@A6a - label3 = new Label(text); //@A6c - constraints.ipadx = 0; - constraints.ipady = 0; - add(label3, layout, constraints, 0, 7, 1, 1); - - fileName = new TextField(21); - add(fileName, layout, constraints, 1, 7, 5, 1); - - text = ResourceLoader.getPrintText ("TYPE"); //@A6a - label4 = new Label(text); //@A6c - add(label4, layout, constraints, 0, 8, 1, 1); - - fileType = new Choice(); - add(fileType, layout, constraints, 1, 8, 5, 1); - - text = ResourceLoader.getPrintText ("OPEN"); //@A6a - open = new Button(text); //@A6c - constraints.ipadx = 20; - add(open, layout, constraints, 6, 0, 3, 1); - - text = ResourceLoader.getText ("DLG_CANCEL"); //@A6a - cancel = new Button(text); //@A6c - add(cancel, layout, constraints, 6, 1, 3, 1); - - currentDirectory = new Label("/"); - constraints.ipadx = 0; - constraints.ipady = 0; - add(currentDirectory, layout, constraints, 0, 6, 6, 1); - - status = new TextField(44); - add(status, layout, constraints, 0, 9, 9, 1); - - - // Arrange the components in the dialog. - pack(); - - // - // End of @A2C - - //}} - - status.setEditable(false); - - sys_ = system; - directoryList.setSystem(sys_); - fileList.setSystem(sys_); - directoryList.setSort(true); - fileList.setSort(true); - directoryList.setListType(IFSList.DIRECTORYONLY); - fileList.setListType(IFSList.FILEONLY); - - filters_ = new Hashtable(); - text = ResourceLoader.getText ("IFS_ALL_FILES_FILTER"); //@A6a - filters_.put(text, "*.*"); //@A6c - fileType.addItem(text); //@A6c - - open.addActionListener(listener_); - cancel.addActionListener(listener_); - directoryList.addActionListener(listener_); - fileList.addActionListener(listener_); - fileList.addItemListener(listener_); - addWindowListener(listener_); - fileType.addItemListener(listener_); - - label1.addKeyListener(listener_); - directoryList.addKeyListener(listener_); - label2.addKeyListener(listener_); - fileList.addKeyListener(listener_); - label3.addKeyListener(listener_); - fileName.addKeyListener(listener_); - label4.addKeyListener(listener_); - fileType.addKeyListener(listener_); - open.addKeyListener(listener_); - cancel.addKeyListener(listener_); - currentDirectory.addKeyListener(listener_); - status.addKeyListener(listener_); - addKeyListener(listener_); - - directoryList.addErrorListener(listener_); - fileList.addErrorListener(listener_); - - status.setText(READY_TEXT); //@A6c - - setResizable(false); - - state_ = ACTIVE; - } - - /** - This methods adds a user interface component to the specified - GridBagLayout manager using the specified constraints. - @param component the user interface component to add - @param layout the GridBagLayout manager - @param constraints the constraints for the component - @param x the x coordinate of the leftmost cell of the component - @param y the y coordinate of the topmost cell of the component - @param width the horizontal measurement of the component in cells - @param height the vertical measurement of the component in cells - **/ - protected void add(Component component, - GridBagLayout layout, - GridBagConstraints constraints, - int x, - int y, - int width, - int height) - { - constraints.gridx = x; - constraints.gridy = y; - constraints.gridwidth = width; - constraints.gridheight = height; - layout.setConstraints(component, constraints); - add(component); - } - - - /** - * Returns the absolute path for the file that was selected. - * - * @return The fully qualified path, including the file name. - **/ - public String getAbsolutePath() - { - if (state_ != CANCEL) - { - return getDirectory() + "/" + getFileName(); - } - else - { - return ""; - } - } - - /** - * Returns the text for the Cancel button. - * - * @return The text for the Cancel button. - **/ - public String getCancelButtonText() - { - return cancel.getLabel(); - } - - /** - * Returns the selected file name. - * - * @return The file name. - **/ - public String getFileName() - { - if (state_ != CANCEL) - { - return fileName.getText(); - } - else - { - return ""; - } - } - - /** - * Returns the filter that was selected. - * - * @return The file filter that was selected. - **/ - public FileFilter getFileFilter() - { - String desc = fileType.getSelectedItem(); - String p = (String)filters_.get(desc); - - return new FileFilter(desc, p); - } - - /** - * Returns the text for the Ok button. - * - * @return The text for the Ok button. - **/ - public String getOkButtonText() - { - return open.getLabel(); - } - - /** - * Returns the path for the file selected. The file name is not - * part of the path. - * - * @return The path for the selected file. - **/ - public String getDirectory() - { - if (state_ != CANCEL) - { - return directoryList.getPath(); - } - else - { - return ""; - } - } - - /** - * Returns the system for this dialog. - * - * @return The object that represents the system. - **/ - public AS400 getSystem() - { - return sys_; - } - - /** - * Sets the text for the Cancel button. - * - * @param buttonText The text to use for the Cancel button. - **/ - public void setCancelButtonText(String buttonText) - { - cancel.setLabel(buttonText); - } - - /** - * Sets the file name field. - * - * @param filename The name of the file. - **/ - public void setFileName(String filename) - { - fileName.setText(filename); - } - - /** - * Sets the filter list. - * - * @param filterList The list of filters to be listed in the choice control. - * @param defaultFilter The index into the list that is to be used as the default (zero-based). - **/ - public void setFileFilter(FileFilter[] filterList, int defaultFilter) - { - fileType.removeAll(); - filters_ = new Hashtable(); - for (int i=0; i 0)) - { - // we have a file name, so act like ok's hit - state_ = OK; - dispose(); - } - } - } - } - - /** - * Handles a key typed event. - * Applications should not call this method. - * It is a KeyListener method used by the dialog. - * - * @param e The event. - **/ - public void keyTyped(KeyEvent e) - { - } - - /** - * Handles a window activated event. - * Applications should not call this method. - * It is a WindowListener method used by the dialog. - * - * @param e The event. - **/ - public void windowActivated(WindowEvent e) - { - } - - /** - * Handles window closed events. - * Applications should not call this method. - * It is a WindowListener method used by the dialog. - * - * @param e The event. - **/ - public void windowClosed(WindowEvent e) - { -// sys_.disconnectService(AS400.FILE); - } - - /** - * WindowListener method used by the dialog. Applications should not - * call this method. - * - * @param e The event. - **/ - public void windowClosing(WindowEvent e) - { - fileName.setText(""); - state_ = CANCEL; - dispose(); - } - - /** - * Handles a window deactivated event. - * Applications should not call this method. - * It is a WindowListener method used by the dialog. - * - * @param e The event. - **/ - public void windowDeactivated(WindowEvent e) - { - } - - /** - * Handles a windoe deiconified event. - * Applications should not call this method. - * It is a WindowListener method used by the dialog. - * - * @param e The event. - **/ - public void windowDeiconified(WindowEvent e) - { - } - - /** - * Handles window iconified events. - * Applications should not call this method. - * It is a WindowListener method used by the dialog. - * - * @param e The event. - **/ - public void windowIconified(WindowEvent e) - { - } - - /** - * Handles window opened event. - * Applications should not call this method. - * It is a WindowListener method used by the dialog. - * - * @param e The event. - **/ - public void windowOpened(WindowEvent e) - { - } - - // @A6d Deleted copyright() method. - } - // @A6d Deleted copyright() method. -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/IFSFilePropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/IFSFilePropertiesPane.java deleted file mode 100644 index 5da71f1ef..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/IFSFilePropertiesPane.java +++ /dev/null @@ -1,287 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFilePropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.IFSFile; -import com.ibm.as400.access.Trace; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ChangeListener; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.text.DateFormat; -import java.util.TimeZone; - - - -/** -The IFSFilePropertiesPane class represents the properties pane -for a file. -**/ -class IFSFilePropertiesPane -implements VPropertiesPane -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String attributesText_ = ResourceLoader.getText ("IFS_ATTRIBUTES") + ":"; - private static final String byteText_ = ResourceLoader.getText ("IFS_BYTE"); - private static final String bytesText_ = ResourceLoader.getText ("IFS_BYTES"); - private static final String generalText_ = ResourceLoader.getText ("TAB_GENERAL"); - private static final String locationText_ = ResourceLoader.getText ("IFS_LOCATION") + ":"; - private static final String modifiedText_ = ResourceLoader.getText ("IFS_MODIFIED") + ":"; - private static final String readText_ = ResourceLoader.getText ("IFS_READ"); - private static final String sizeText_ = ResourceLoader.getText ("IFS_SIZE") + ":"; - private static final String writeText_ = ResourceLoader.getText ("IFS_WRITE"); - - - - // Static data. - private static DateFormat dateFormat_ = DateFormat.getDateTimeInstance (); - - - - // Private data. - private VIFSFile object_; - - - - // Event support. - private ChangeEventSupport changeEventSupport_ = new ChangeEventSupport (this); - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - - -/** -Static initializer. -**/ - static - { - dateFormat_.setTimeZone (TimeZone.getDefault ()); - } - - - -/** -Constructs an IFSFilePropertiesPane object. - -@param object The object. -**/ - public IFSFilePropertiesPane (VIFSFile object) - { - object_ = object; - } - - - -/** -Adds a change listener. - -@param listener The listener. -**/ - public void addChangeListener (ChangeListener listener) - { - changeEventSupport_.addChangeListener (listener); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Applies the changes made by the user. - -@throws Exception If an error occurs. -**/ - public void applyChanges () - throws Exception - { - // No changes are allowed. - } - - - -/** -Returns the graphical component. - -@return The graphical component. -**/ - public Component getComponent () - { - // Initialize the general tab. - JPanel generalTab = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - generalTab.setLayout (layout); - generalTab.setBorder (new EmptyBorder (10, 10, 10, 10)); - - // Add the components. - int row = 0; - VUtilities.constrain (new JLabel (object_.getText (), object_.getIcon (32, false), SwingConstants.LEFT), - generalTab, layout, 0, row++, 2, 1); - - VUtilities.constrain (new JSeparator (), - generalTab, layout, 0, row++, 2, 1); - - VUtilities.constrain (new JLabel (locationText_), - generalTab, layout, 0, row, 1, 1); - VUtilities.constrain (new JLabel (object_.getParentDirectory ()), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JLabel (sizeText_), - generalTab, layout, 0, row, 1, 1); - long size = object_.getSize (); - VUtilities.constrain (new JLabel (Long.toString (size) + " " - + ((size == 1) ? byteText_ : bytesText_)), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JSeparator (), - generalTab, layout, 0, row++, 2, 1); - - VUtilities.constrain (new JLabel (modifiedText_), - generalTab, layout, 0, row, 1, 1); - VUtilities.constrain (new JLabel (dateFormat_.format (object_.getModified ())), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JSeparator (), - generalTab, layout, 0, row++, 2, 1); - - // The check boxes are disabled because we do not allow attribute - // changes here. They appear gray on the GUI, and this is a good - // thing because it gives an indication to users that they can not - // change the attributes from this pane. - VUtilities.constrain (new JLabel (attributesText_), - generalTab, layout, 0, row, 1, 1); - JCheckBox readCheckBox = new JCheckBox (readText_, object_.canRead ()); - readCheckBox.setEnabled (false); - VUtilities.constrain (readCheckBox, - generalTab, layout, 1, row, 1, 1); - row++; - - JCheckBox writeCheckBox = new JCheckBox (writeText_, object_.canWrite ()); - writeCheckBox.setEnabled (false); - VUtilities.constrain (writeCheckBox, - generalTab, layout, 1, row++, 1, 1); - - // Build the pane. - JTabbedPane pane = new JTabbedPane (); - pane.addTab (generalText_, null, generalTab); - pane.setSelectedIndex (0); - return pane; - } - - - -/** -Removes a change listener. - -@param listener The listener. -**/ - public void removeChangeListener (ChangeListener listener) - { - changeEventSupport_.removeChangeListener (listener); - } - - - -/** -Removes a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/IFSFileSystemView.java b/cvsroot/src/com/ibm/as400/vaccess/IFSFileSystemView.java deleted file mode 100644 index f2af31e88..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/IFSFileSystemView.java +++ /dev/null @@ -1,443 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSFileSystemView.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.IFSJavaFile; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.io.File; -import java.io.IOException; -import java.text.MessageFormat; -import javax.swing.filechooser.FileSystemView; -import javax.swing.UIManager; -import javax.swing.Icon; - - -/** - * Provides a gateway to the IBM i integrated file system, - * for use when constructing javax.swing.JFileChooser objects. - *

    JFileChooser is a standard Java way to build dialogs for navigating - * and choosing files, and is the recommended replacement for - * {@link IFSFileDialog IFSFileDialog}. - *

    - * The following example demonstrates the use of IFSFileSystemView. - *

    -  * 
    -  * import com.ibm.as400.access.AS400;
    -  * import com.ibm.as400.access.IFSJavaFile;
    -  * import com.ibm.as400.vaccess.IFSFileSystemView;
    -  * import javax.swing.JFileChooser;
    -  * import java.awt.Frame;
    -  * 
    -  * // Work with directory /Dir on the system myAS400.
    -  * AS400 system = new AS400("myAS400");
    -  * IFSJavaFile dir = new IFSJavaFile(system, "/Dir");
    -  * JFileChooser chooser = new JFileChooser(dir, new IFSFileSystemView(system));
    -  * Frame parent = new Frame();
    -  * int returnVal = chooser.showOpenDialog(parent);
    -  * if (returnVal == JFileChooser.APPROVE_OPTION) {
    -  *    IFSJavaFile chosenFile = (IFSJavaFile)(chooser.getSelectedFile());
    -  *    System.out.println("You selected the file named " +
    -  *                        chosenFile.getName());
    -  * }
    -  * 
    - * - * @see com.ibm.as400.vaccess.IFSFileDialog - * @see com.ibm.as400.access.IFSJavaFile - * @deprecated Use com.ibm.as400.access.IFSSystemView instead. - **/ - -public class IFSFileSystemView extends FileSystemView -{ - private static final boolean DEBUG = false; - private AS400 system_; - private static final String ROOT_PATH = IFSJavaFile.separator; - - private static final String DEFAULT_FOLDER_NAME = "NewFolder"; - - private static final String NEW_FOLDER_STRING0 = - UIManager.getString("FileChooser.other.newFolder"); - private static final String NEW_FOLDER_NEXT_STRING0 = - UIManager.getString("FileChooser.other.newFolder.subsequent"); - private static final String NEW_FOLDER_STRING = ((NEW_FOLDER_STRING0 == null || NEW_FOLDER_STRING0.length() == 0) ? DEFAULT_FOLDER_NAME : NEW_FOLDER_STRING0); - private static final String NEW_FOLDER_NEXT_STRING = ((NEW_FOLDER_NEXT_STRING0 == null || NEW_FOLDER_NEXT_STRING0.length() == 0) ? DEFAULT_FOLDER_NAME+".{0}" : NEW_FOLDER_NEXT_STRING0); - - private static Icon serverIcon32_ = ResourceLoader.getIcon ("AS40032.gif"); - - - /** - Constructs an IFSFileSystemView object. - @param system The system that contains the file. - **/ - public IFSFileSystemView(AS400 system) - { - if (system == null) throw new NullPointerException("system"); - - system_ = system; - } - - /** - Returns a File object constructed in directory from the given filename. -
    Note: This method does not create an actual file in the file system. - @param containingDir The directory in which to create the file. -
    containingDir is assumed to represent an existing directory on the system. If null, it is ignored. - @param name The file name. - @return a File object representing the new file. - **/ - public File createFileObject(File containingDir, String name) - { - if (name == null) throw new NullPointerException("name"); - - IFSJavaFile file; - - if (containingDir != null) { - IFSJavaFile ifsDir; - if (DEBUG) { - ifsDir = convertToIFSJavaFile(containingDir, "createFileObject"); - } - else { - ifsDir = convertToIFSJavaFile(containingDir); - } - file = new IFSJavaFile(ifsDir, name); - } - else { - file = new IFSJavaFile(system_, name); - } - - if (isFileSystemRoot(file)) return createFileSystemRoot(file); - else return file; - } - - /** - Returns a File object constructed from the given path string. -
    Note: This method does not create an actual file in the file system. - @param path The file path name. - @return the File object. - **/ - public File createFileObject(String path) - { - if (path == null) throw new NullPointerException("path"); - IFSJavaFile file = new IFSJavaFile(system_, path); - // Note: There is logic in javax.swing.plaf.basic.BasicFileChooserUI#ApproveSelectionAction.actionPerformed() that queries if the file is "absolute". If not absolute, the logic prepends the directory path. For that reason, each instance of IFSJavaFile needs to retain an awareness of whether it was created with an absolute path or not. - if (isFileSystemRoot(file)) { - return createFileSystemRoot(file); - } - else return file; - } - - - // Note: The method createFileSystemRoot() was added to the FileSystemView class in JDK 1.4. - // We provide an implementation here to swallow the NoSuchMethodError if running on an older JDK. - protected File createFileSystemRoot(File f) { - try { - return super.createFileSystemRoot(f); - } - catch (NoSuchMethodError e) { // method added in JDK 1.4 - if (Trace.isTraceOn()) { - Trace.log(Trace.DIAGNOSTIC, e); - } - return f; - } - } - - /** - Creates a new folder with a default name. -
    Note: In the context of this class, "folder" is synonymous with "directory". - @param containingDir The parent directory in which to create the folder. -
    containingDir is assumed to represent an existing directory on the system. - @return a File object representing the new folder. - **/ - public File createNewFolder(File containingDir) - throws IOException - { - if (containingDir == null) throw new IOException("Containing directory is null:"); // This is what javax.swing.filechooser.FileSystemView does. - - IFSJavaFile ifsDir; - if (DEBUG) { - ifsDir = convertToIFSJavaFile(containingDir, "createNewFolder"); - } - else { - ifsDir = convertToIFSJavaFile(containingDir); - } - IFSJavaFile newFolder = new IFSJavaFile(ifsDir, NEW_FOLDER_STRING); - int i=1; - while (newFolder.exists() && (i<100)) - { - newFolder = new IFSJavaFile(ifsDir, - MessageFormat.format( - NEW_FOLDER_NEXT_STRING, new Object[] { new Integer(i++)})); - } - - if (newFolder.exists()) - { - throw new IOException("Directory already exists:" + newFolder.getAbsolutePath()); - } - else - { - newFolder.mkdirs(); - return newFolder; - } - } - - - // The parent's implementation works for us. If not, here's what we'd do: - // public File getChild(File parent, - // String fileName) - // { - // if (parent == null) throw new NullPointerException("parent"); - // if (fileName == null) throw new NullPointerException("fileName"); - // - // return createFileObject(parent, fileName); - // } - - - /** - * Returns the user's default starting directory for the file chooser. - * This will represent the 'root' directory on the system. - * @return A File object representing the default - * starting folder. - **/ - public File getDefaultDirectory() - { - return createFileSystemRoot(new IFSJavaFile(system_, ROOT_PATH)); - } - - - /** - Gets the list of shown (that is, not hidden) files in the directory. - @param directory The directory to search. - @param useFileHiding This parameter is ignored. - @return The list of files. - **/ - public File[] getFiles(File directory, boolean useFileHiding) - { - if (directory == null) throw new NullPointerException("directory"); - - IFSJavaFile ifsDir; - if (DEBUG) { - ifsDir = convertToIFSJavaFile(directory, "getFiles"); - } - else { - ifsDir = convertToIFSJavaFile(directory); - } - return ifsDir.listFiles(); - } - - /** - Returns the home directory. -
    The IBM i integrated file system has one home directory, the "/" directory. - @return the home directory. - **/ - public File getHomeDirectory() - { - return (new IFSJavaFile(system_, ROOT_PATH)); - } - - /** - Returns the parent directory of dir. - @param dir The directory being queried. -
    dir is assumed to represent an existing directory on the system. - @return the parent directory of dir, or null if dir is null. - **/ - public File getParentDirectory(File dir) - { - if (dir == null) return null; - - IFSJavaFile ifsDir; - if (DEBUG) { - ifsDir = convertToIFSJavaFile(dir, "getParentDirectory"); - } - else { - ifsDir = convertToIFSJavaFile(dir); - } - IFSJavaFile parent = (IFSJavaFile)ifsDir.getParentFile(); - if (isFileSystemRoot(parent)) { - return createFileSystemRoot(parent); - } - else return parent; - } - - /** - Returns all root partitions on this system. -
    The IBM i integrated file system has one root partition, the "/" directory. - @return all root partitions on this system. - **/ - public File[] getRoots() - { - return new File[] { createFileSystemRoot(new IFSJavaFile(system_, ROOT_PATH)) }; - } - - /** - * Returns the name of a file, directory, or folder as it would be displayed in - * a system file browser. - * - * @param f A File object. - * @return The file name as it would be displayed by a native file chooser. - **/ - public String getSystemDisplayName(File f) - { - if (f == null) return null; - - return f.getName(); - } - - /** - * Always returns an icon representing an IBM i system. - **/ - public Icon getSystemIcon(File f) - { - return serverIcon32_; - } - - /** - * Returns a type description for a file, directory, or folder as it would be displayed in - * a system file browser. - * @param f A File object. - * @return The file type description as it would be displayed by a native file chooser - * or null if no native information is available. - **/ - public String getSystemTypeDescription(File f) - { - return system_.getSystemName(); - } - - /** - Always returns false. - **/ - public boolean isComputerNode(File dir) - { - return false; // no "computer nodes" in IFS - } - - /** - Always returns false. - **/ - public boolean isDrive(File dir) - { - return false; // no "drives" in IFS - } - - /** - Always returns false. - **/ - public boolean isFloppyDrive(File dir) - { - return false; // no "floppy drives" in IFS - } - - // The parent's implementation works for us. If not, here's what we'd do: - // public boolean isFileSystem(File file) - // { - // if (file == null) throw new NullPointerException("file"); - // - // return (!file.getPath().startsWith("ShellFolder")); - // } - - - /** - * Returns true if f represents the root directory on the system ("/"), - * and false otherwise. - * - * @param f A File object representing a directory. - * @return true if f is a root of a filesystem - **/ - public boolean isFileSystemRoot(File f) - { - if (f == null) return false; - - return (f.getAbsolutePath().equals(ROOT_PATH)); - } - - - // The parent's implementation works for us. If not, here's what we'd do: - // public boolean isHiddenFile(File file) - // { - // if (file == null) throw new NullPointerException("file"); - // - // return file.isHidden(); - // } - - - // The parent's implementation works for us. If not, here's what we'd do: - // public boolean isParent(File folder, File file) - // { - // if (folder == null || file == null) return false; - // - // return folder.equals(file.getParentFile()); - // } - - - /** - Determines if the given file is a root in the navigatable tree(s). -
    The IBM i integrated file system has one root, the "/" directory. - @param file A File object representing a directory. - @return true if file is a root in the navigatable tree. - **/ - public boolean isRoot(File file) - { - // Note: Normally we'd just use the parent's method, but older JDK's (pre-1.4) seem to have difficulty unless we provide our own. - if (file == null || !file.isAbsolute()) { - return false; - } - - return (file.getAbsolutePath().equals(ROOT_PATH)); - } - - - // The parent's implementation works for us. If not, here's what we'd do: - // public Boolean isTraversable(File file) - // { - // if (file == null) throw new NullPointerException("file"); - // - // return Boolean.valueOf(file.isDirectory()); - // - // } - - - // Utility method. - private IFSJavaFile convertToIFSJavaFile(File file) - { - if (file instanceof IFSJavaFile) { - return (IFSJavaFile)file; - } - - if (Trace.isTraceOn()) { - Trace.log(Trace.DIAGNOSTIC, - "File is not an IFSJavaFile. File is of type " + file.getClass().getName()); - } - // Create an IFSJavaFile using the path contained in the File object. - return new IFSJavaFile(system_, file.getPath()); - } - - - // Utility method. Additionally accepts a methodName, for more-descriptive tracing. - private IFSJavaFile convertToIFSJavaFile(File file, String methodName) - { - if (DEBUG) { - if (file instanceof IFSJavaFile) { - return (IFSJavaFile)file; - } - - if (Trace.isTraceOn()) { - Trace.log(Trace.DIAGNOSTIC, - "File is not an IFSJavaFile. File is of type " + file.getClass().getName() + ". Caller was " + methodName + "."); - } - // Create an IFSJavaFile using the path contained in the File object. - return new IFSJavaFile(system_, file.getPath()); - } - else return convertToIFSJavaFile(file); - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/IFSList.java b/cvsroot/src/com/ibm/as400/vaccess/IFSList.java deleted file mode 100644 index 830280703..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/IFSList.java +++ /dev/null @@ -1,398 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.*; -import java.util.*; -import java.beans.*; -import com.ibm.as400.access.*; -import java.io.IOException; - -/** - * The IFSList class represents a - * AWT list class extension that can display a list of files, directories - * or both from a server. - * - * Error events are generated if errors are encountered. - * - * @see com.ibm.as400.access.ErrorEvent - * @see com.ibm.as400.access.ErrorListener - * @see com.ibm.as400.access.IFSFile - * @see com.ibm.as400.access.IFSFileFilter - * @see java.awt.List - **/ -class IFSList extends java.awt.List - implements IFSFileFilter -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private AS400 sys_; - private String path_ = "/"; - private String filter_ = "*"; - private boolean sort_ = true; - private IFSFile ifsFile_; - private int directory_ = DIRECTORYONLY; - private Vector fList; - private Vector actionEventList = new Vector(); - private Vector errorEventList = new Vector(); - private PropertyChangeSupport propertyList = new PropertyChangeSupport(this); - - /** - * Display directory only. - **/ - public static final int DIRECTORYONLY = 1; - /** - * Display files only. - **/ - public static final int FILEONLY = 2; - /** - * Display files and directories. - **/ - public static final int BOTH = 3; - - /** - * Constructs an IFSList object. It is a default list object. If the system is not set, - * the user will be prompted for system name and signon information. - **/ - public IFSList() - { - super(); - } - - /** - * Receives file information from the file classes - * during processing. - * - * This method should not be called by the application. - * @param file The file to process. - * @return true if the file should be added to the list; false otherwise. - **/ - public boolean accept(IFSFile file) - { - boolean fAccept = false; - int i; - - try - { - switch (directory_) - { - case 1: - if (file.isDirectory()) - { - fAccept = true; - } - else - { - fAccept = false; - } - break; - case 2: - if (file.isFile()) - { - fAccept = true; - } - else - { - fAccept = false; - } - break; - case 3: - fAccept = true; - break; - default: - fAccept = false; - break; - } - } - catch (IOException e) - { - // fire error event - fireError(e, "accept"); - return false; - } - - if (fAccept) - { - if (sort_) - { - String temp; - - for (i=0; i 0) - { - fList.insertElementAt(file.getName(), i); - break; - } - } - if (i == fList.size()) - { - fList.addElement(file.getName()); - } - } - else - { - add(file.getName()); - } - } - - return fAccept; - } - - /** - *Adds a listener to the action completed event list. - * - *@param listener The listener object. - **/ - public synchronized void addActionCompletedListener(ActionCompletedListener listener) - { - actionEventList.addElement(listener); - } - - /** - *Adds a listener to the error event list. - * - *@param listener The listener object. - **/ - public synchronized void addErrorListener(ErrorListener listener) - { - errorEventList.addElement(listener); - } - - /** - *Adds a property changed listener to the list - * - *@param listener The listener to add. - **/ - public synchronized void addPropertyChangeListener(PropertyChangeListener listener) - { - propertyList.addPropertyChangeListener(listener); - } - - private void fireAction(String sourceMethod) - { - Vector targets; - synchronized (this) - { - targets = (Vector) actionEventList.clone(); - } - ActionCompletedEvent actionEvt = new ActionCompletedEvent(this); - for (int i = 0; i < targets.size(); i++) - { - ActionCompletedListener target = (ActionCompletedListener)targets.elementAt(i); - target.actionCompleted(actionEvt); - } - } - - private void fireError(Exception e, String sourceMethod) - { - Vector targets; - synchronized (this) - { - targets = (Vector) errorEventList.clone(); - } - ErrorEvent errorEvt = new ErrorEvent(this, e); - for (int i = 0; i < targets.size(); i++) - { - ErrorListener target = (ErrorListener)targets.elementAt(i); - target.errorOccurred(errorEvt); - } - } - - /** - * Returns the filter to be used with the list. - * @return The filter to use for the list. - **/ - public String getFilter() - { - return filter_; - } - - /** - * Returns the directory to be displayed. - * @return The directory path to be displayed. - **/ - public String getPath() - { - return path_; - } - - /** - * Returns if sorting is done for the list. - * @return true if list should be sorted; false otherwise. - **/ - public boolean isSort() - { - return sort_; - } - - /** - * Returns what should be displayed in the list: File only, directory - * only or both. - * @return The value that represents the list property. - **/ - public int getListType() - { - return directory_; - } - - /** - * Returns the system object that represents the server to list. - * @return The system object that represents the server to list. - **/ - public AS400 getSystem() - { - return sys_; - } - - /** - * Fills the list with the requested information. If the system or - * system name is not set, the user will be prompted for it. The - * list is cleared and repopulated each time this method is called. - * - * - **/ - public void populateList() - throws IOException - { - setVisible(false); - removeAll(); - setVisible(true); - - if (sys_ == null) - { - sys_ = new AS400(); - } - - if (ifsFile_ == null) - { - ifsFile_ = new IFSFile(sys_, path_); - } - -// try -// { - if ((directory_ == DIRECTORYONLY) || (directory_ == BOTH)) - { - add("."); - add(".."); - } - - fList = new Vector(); - - if (filter_ != null) - { - ifsFile_.list(this, filter_); - } - else - { - ifsFile_.list(this); - } - - for (int i=0; iUse this class in conjuction with any JTextComponent or -any other component that works with the Document interface. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    IFSTextFileDocument objects generate the following events: -

      -
    • DocumentEvent -
    • ErrorEvent -
    • FileEvent -
    • PropertyChangeEvent -
    • UndoableEditEvent -
    • WorkingEvent -
    - -

    The following example creates a document which contains -the contents of a text file in the integrated file system -of a system. It then presents the document in a JTextArea -object. - -

    -// Set up the document and the JTextArea.
    -AS400 system = new AS400 ("MySystem", "Userid", "Password");
    -IFSTextFileDocument document = new IFSTextFileDocument (system, "/myFile");
    -JTextArea textArea = new JTextArea (document);
    -
    -// Add the JTextArea to a frame. -JFrame frame = new JFrame ("My Window"); -frame.getContentPane().add(new JScrollPane(textArea)); - -
    -// Load the information from the system. -document.load (); -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -// -// Implementation notes: -// -// * I decided to contain the other document as opposed to extending -// it so that our interface does not need to document what type -// of document we are. -// -// * I do not think that it is necessary to test the methods -// that just do a load and the call the underlying document. -// -// * We need to be a StyledDocument, not just a Document, in order -// for us to be usable in a JTextPane, which handles word-wrapping. -// -public class IFSTextFileDocument -implements StyledDocument, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Properties. - private IFSFile file_ = null; - - - - // Private data. - transient private StyledDocument document_; - transient boolean modified_; // Private. - - - - // Event support. - transient private DocumentEventSupport documentEventSupport_ ; - transient private DocumentListener documentListener_; - transient private ErrorEventSupport errorEventSupport_; - transient private FileEventSupport fileEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private UndoableEditEventSupport undoableEditEventSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - transient private WorkingEventSupport workingEventSupport_; - - - -/** -Constructs a IFSTextFileDocument object. -**/ - public IFSTextFileDocument () - { - file_ = new IFSFile (); - initializeTransient (); - } - - - -/** -Constructs a IFSTextFileDocument object. - -@param file The file. -**/ - public IFSTextFileDocument (IFSFile file) - { - file_ = file; - initializeTransient (); - } - - - -/** -Constructs a IFSTextFileDocument object. - -@param system The system on which the file resides. -@param path The fully qualified path name of the file that this object represents. -**/ - public IFSTextFileDocument (AS400 system, String path) - { - file_ = new IFSFile (system, path); - initializeTransient (); - } - - - -/** -Adds a listener to be notified when a document event occurs. - -@param listener The listener. -**/ - public void addDocumentListener (DocumentListener listener) - { - documentEventSupport_.addDocumentListener (listener); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when a file event occurs. - -@param listener The listener. -**/ - public void addFileListener (FileListener listener) - { - fileEventSupport_.addFileListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a style into the logical style hierarchy. - -@param name The name of the style. -@param parent The parent style. -@return The style. -**/ - public synchronized Style addStyle (String name, Style parent) - { - return document_.addStyle (name, parent); - } - - - -/** -Adds an undoable edit listener to be notified when undoable -edits are made to the document. - -@param listener The listener. -**/ - public void addUndoableEditListener (UndoableEditListener listener) - { - undoableEditEventSupport_.addUndoableEditListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Returns a position that will track change as the document is altered. -If the relative position is null, then the start of the document will -be used. - -@param offset The offset from the start of the document. -@return The position. - -@exception BadLocationException If the given offset does not - represent a valid location in the - document. -**/ - public synchronized Position createPosition (int offset) - throws BadLocationException - { - return document_.createPosition (offset); - } - - - -/** -Returns the background color based on a set of attributes. - -@param attributes The attributes. -@return The background color. -**/ - public synchronized Color getBackground (AttributeSet attributes) - { - // In Swing 1.0, the DefaultStyledDocument.getBackground() - // throws an Error - not implemented. This will hang - // testcases, so we should not pass this on. This is already - // reported in Java's Bug Parade, Bug Id 4109225. - try { - return document_.getBackground (attributes); - } - catch (Error e) { - return null; - } - } - - - -/** -Returns the element that represents the character that is at -a given offset within the document. - -@param offset The offset to the character. -@return The element. -**/ - public synchronized Element getCharacterElement (int offset) - { - return document_.getCharacterElement (offset); - } - - - -/** -Returns the root element that views should be based upon -unless some other mechanism for assigning views to element -structures is provided. - -@return The root element. -**/ - public synchronized Element getDefaultRootElement () - { - return document_.getDefaultRootElement (); - } - - - -/** -Returns a position that represents the end of the document. -The position returned can be counted on to track change and stay -located at the end of the document. - -@return The end position of the document. -**/ - public synchronized Position getEndPosition () - { - return document_.getEndPosition (); - } - - - -/** -Returns the font based on a set of attributes. - -@param attributes The attributes. -@return The font. -**/ - public synchronized Font getFont (AttributeSet attributes) - { - return document_.getFont (attributes); - } - - - -/** -Returns the foreground color based on a set of attributes. - -@param attributes The attributes. -@return The foreground color. -**/ - public synchronized Color getForeground (AttributeSet attributes) - { - return document_.getForeground (attributes); - } - - - -/** -Returns the length of the document. - -@return The length of the document in characters. -**/ - public synchronized int getLength () - { - return document_.getLength (); - } - - - -/** -Returns the logical style for a given offset within the document. - -@param offset The offset within the document. -@return The logical style at the specified offset. -**/ - public synchronized Style getLogicalStyle (int offset) - { - return document_.getLogicalStyle (offset); - } - - - -/** -Returns the element that represents the paragraph that encloses -a given offset within the document. - -@param offset The offset within the document. -@return The element that represents the paragraph. -**/ - public synchronized Element getParagraphElement (int offset) - { - return document_.getParagraphElement (offset); - } - - - -/** -The path name of the file. - -@return The path name of the file, or "" if the path has not been set. -**/ - public String getPath () - { - return file_.getPath (); - } - - - -/** -Returns a property value associated with the document. - -@param key The property key. -@return The property value. -**/ - public synchronized Object getProperty (Object key) - { - return document_.getProperty (key); - } - - - -/** -Returns the root elements. - -@return The root elements. -**/ - public synchronized Element[] getRootElements () - { - return document_.getRootElements (); - } - - - -/** -Returns a position that represents the start of the document. -The position returned can be counted on to track change and stay -located at the beginning of the document. - -@return The start position of the document. -**/ - public synchronized Position getStartPosition () - { - return document_.getStartPosition (); - } - - - -/** -Returns a named style. - -@param name The name of the style. -@return The style. -**/ - public synchronized Style getStyle (String name) - { - return document_.getStyle (name); - } - - - -/** -Returns the system on which the file resides. - -@return The system, or null if the system has not been set. -**/ - public AS400 getSystem() - { - return file_.getSystem (); - } - - - -/** -Returns the text contained within the specified portion of -the document. - -@param offset The offset into the document representing - the desired start of the text. -@param length The length of the text. -@return The text. - -@exception BadLocationException If the given offset and length does - not represent a valid range in the - document. -**/ - public synchronized String getText (int offset, int length) - throws BadLocationException - { - return document_.getText (offset, length); - } - - - -/** -Stores the text contained within the specified portion of -the document in a segment. - -@param offset The offset into the document representing - the desired start of the text. -@param length The length of the text. -@param text The segment in which to store the text. - -@exception BadLocationException If the given offset and length does - not represent a valid range in the - document. -**/ - public synchronized void getText (int offset, int length, Segment text) - throws BadLocationException - { - document_.getText (offset, length, text); - } - - - -/** -Inserts text into the document. A position marks a location -in the document between items. If the attributes that have been -defined exactly match the current attributes defined at the position, -the element representing the content at that position will simply be -expanded. If the attributes defined are different, a new content -element will be created that matches the attributes. - -@param offset The offset into the document representing - the insertion position. -@param text The text. -@param attributes The attributes to associate with the inserted content, - or null if there are no attributes. - -@exception BadLocationException If the given offset does not - represent a valid position in the - document. -**/ - public synchronized void insertString (int offset, String text, AttributeSet attributes) - throws BadLocationException - { - document_.insertString (offset, text, attributes); - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - document_ = new DefaultStyledDocument (); - modified_ = false; - - // Initialize the event support. - documentEventSupport_ = new DocumentEventSupport (this); - documentListener_ = new DocumentListener_ (); - errorEventSupport_ = new ErrorEventSupport (this); - fileEventSupport_ = new FileEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - undoableEditEventSupport_ = new UndoableEditEventSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - document_.addDocumentListener (documentEventSupport_); - document_.addDocumentListener (documentListener_); - document_.addUndoableEditListener (undoableEditEventSupport_); - file_.addFileListener (fileEventSupport_); - } - - - -/** -Indicates if the document has been modified since it was -last read or written. - -@return true if the document has been modified; false - otherwise. -**/ - public boolean isModified () - { - return modified_; - } - - - -/** -Loads the contents of the document from the file on the -system. -**/ - public void load () - { - workingEventSupport_.fireStartWorking (); - - try { - // Clear the contents of the document. - document_.remove (0, document_.getLength ()); - - // Open the input stream. - IFSTextFileInputStream input = new IFSTextFileInputStream (file_.getSystem(), - file_, IFSTextFileInputStream.SHARE_ALL); - input.addFileListener (fileEventSupport_); - ///BufferedReader reader = new BufferedReader (new InputStreamReader (input)); // @C2d - ConvTableReader reader = new ConvTableReader (input, file_.getCCSID()); // @C2a - - // Load the contents. - char[] charArray = new char[512]; - int count = 0; - int position = 0; - - while (true) { - count = reader.read (charArray, 0, 512); - if (count > 0) { - document_.insertString (position, new String (charArray, 0, count), null); - position += count; - } - else - break; - } - - // Close the input stream. - reader.close (); - input.close (); - input.removeFileListener (fileEventSupport_); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - - modified_ = false; - addDocumentListener (documentListener_); - - // Done loading. - workingEventSupport_.fireStopWorking (); - } - - - -/** -Sets a property value associated with the document. - -@param key The property key. -@param value The property value. -**/ - public synchronized void putProperty (Object key, Object value) - { - document_.putProperty (key, value); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes text from the document. - -@param offset The offset into the document representing - the desired start of the text. -@param length The length of the text. - -@exception BadLocationException If the given offset and length does - not represent a valid range in the - document. -**/ - public synchronized void remove (int offset, int length) - throws BadLocationException - { - document_.remove (offset, length); - } - - - -/** -Removes a document listener. - -@param listener The listener. -**/ - public void removeDocumentListener (DocumentListener listener) - { - documentEventSupport_.removeDocumentListener (listener); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a file listener. - -@param listener The listener. -**/ - public void removeFileListener (FileListener listener) - { - fileEventSupport_.removeFileListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a style from the logical style hierarchy. - -@param name The name of the style. -**/ - public synchronized void removeStyle (String name) - { - document_.removeStyle (name); - } - - - -/** -Removes an undoable edit listener. - -@param listener The listener. -**/ - public void removeUndoableEditListener (UndoableEditListener listener) - { - undoableEditEventSupport_.removeUndoableEditListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Renders the document. This allows the model to be safely rendered in -the presence of currency, if the model supports being updated -asynchronously. The given runnable will be executed in a way that allows -it to safely read the model with no changes while the runnable is being -executed. The runnable itself may not make any mutations. - -@param runnable The runnable. -**/ - public void render (Runnable runnable) - { - document_.render (runnable); - } - - - -/** -Saves the contents of the document to the file on the system. -This will creates the file if it does not already exist. -**/ - public void save () - { - workingEventSupport_.fireStartWorking (); - - IFSTextFileOutputStream output = null; - ///BufferedWriter writer = null; // @C2d - ConvTableWriter writer = null; // @C2a - - try { - // Open the output stream. - output = new IFSTextFileOutputStream (file_.getSystem(), - file_, IFSTextFileOutputStream.SHARE_ALL, false); - output.addFileListener (fileEventSupport_); - ///writer = new BufferedWriter (new OutputStreamWriter (output)); // @C2d - writer = new ConvTableWriter (output, file_.getCCSID()); // @C2a - - // Save the contents. - writer.write (document_.getText (0, document_.getLength ())); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - finally { - // Close the input stream. - if (writer != null) { - try { - writer.close (); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - } - if (output != null) { - try { - output.close (); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - finally { - output.removeFileListener (fileEventSupport_); - } - } - } - - modified_ = false; - addDocumentListener (documentListener_); - workingEventSupport_.fireStopWorking (); - } - - - -/** -Sets the element attributes used for the given range of -existing content in the document. - -@param offset The offset to the start of the change. -@param length The length of the change. -@param attributes The attributes. -@param replace Indicates whether or not the previous attributes should be cleared before the new attributes are set. If true, true to replace the previous attributes with these - attributes; false to merge them. -**/ - public synchronized void setCharacterAttributes (int offset, - int length, - AttributeSet attributes, - boolean replace) - { - document_.setCharacterAttributes (offset, length, attributes, replace); - } - - - -/** -Sets the logical style for a given offset within the document. - -@param offset The offset within the document. -@param style The logical style. -**/ - public synchronized void setLogicalStyle (int offset, Style style) - { - document_.setLogicalStyle (offset, style); - } - - - -/** -Sets the element attributes used for the paragraphs enclosing the -given range of existing content in the document. - -@param offset The offset to the start of the change. -@param length The length of the change. -@param attributes The attributes. -@param replace Indicates whether or not the previous attributes should be cleared before the new attributes are set. If true, this will replace the previous attributes entirely. If false, the new attributes will be merged with the previous attributes. -**/ - public synchronized void setParagraphAttributes (int offset, - int length, - AttributeSet attributes, - boolean replace) - { - document_.setParagraphAttributes (offset, length, attributes, replace); - } - - - -/** -Sets the path name of the file. - -@param path The path name of the file. - - - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setPath (String path) - throws PropertyVetoException - { - String oldValue = file_.getPath (); - String newValue = path; - vetoableChangeSupport_.fireVetoableChange ("path", oldValue, newValue); - - file_.removeFileListener (fileEventSupport_); - - AS400 system = file_.getSystem (); - file_ = new IFSFile (); - file_.setPath (path); - if (system != null) - file_.setSystem (system); - - file_.addFileListener (fileEventSupport_); - - propertyChangeSupport_.firePropertyChange ("path", oldValue, newValue); - } - - - -/** -Sets the system on which the file resides. - -@param system The system on which the file resides. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setSystem (AS400 system) - throws PropertyVetoException - { - AS400 oldValue = file_.getSystem (); - AS400 newValue = system; - vetoableChangeSupport_.fireVetoableChange ("system", oldValue, newValue); - - file_.removeFileListener (fileEventSupport_); - - String path = file_.getPath (); - file_ = new IFSFile (); - file_.setSystem (system); - if (path != null) - file_.setPath (path); - - file_.addFileListener (fileEventSupport_); - - propertyChangeSupport_.firePropertyChange ("system", oldValue, newValue); - } - - - -/** -Returns the string representation. This is the name of the file. - -@return The string representation of the file name. -**/ - public String toString () - { - return file_.getName (); - } - - - -/** -The DocumentListener_ class processes document events. Once it -is modified the first time, it will remove itself as a listener. -This saves on subsequent event firings, but must be added each -time the modified flag is set back to true. -**/ - private class DocumentListener_ implements DocumentListener - { - public void changedUpdate (DocumentEvent event) - { - modified_ = true; - removeDocumentListener (this); - } - - public void insertUpdate (DocumentEvent event) - { - modified_ = true; - removeDocumentListener (this); - } - - public void removeUpdate (DocumentEvent event) - { - modified_ = true; - removeDocumentListener (this); - } - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/IFSTextFileDocument16.gif b/cvsroot/src/com/ibm/as400/vaccess/IFSTextFileDocument16.gif deleted file mode 100644 index 9f8fa23f9..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/IFSTextFileDocument16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/IFSTextFileDocument32.gif b/cvsroot/src/com/ibm/as400/vaccess/IFSTextFileDocument32.gif deleted file mode 100644 index 8cb8fe6ab..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/IFSTextFileDocument32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/IFSTextFileDocumentBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/IFSTextFileDocumentBeanInfo.java deleted file mode 100644 index ed2db15a0..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/IFSTextFileDocumentBeanInfo.java +++ /dev/null @@ -1,213 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: IFSTextFileDocumentBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.FileListener; -import javax.swing.event.DocumentListener; -import javax.swing.event.UndoableEditListener; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The IFSTextFileDocumentBeanInfo class provides bean information -for the IFSTextFileDocument class. - -@see IFSTextFileDocument -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class IFSTextFileDocumentBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = IFSTextFileDocument.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - String[] documentMethods = { "changedUpdate", "insertUpdate", "removeUpdate" }; - EventSetDescriptor document = new EventSetDescriptor (beanClass_, - "document", DocumentListener.class, documentMethods, - "addDocumentListener", "removeDocumentListener"); - document.setDisplayName (ResourceLoader.getText ("EVT_NAME_DOCUMENT")); - document.setShortDescription (ResourceLoader.getText ("EVT_DESC_DOCUMENT")); - - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - String[] fileMethods = { "fileClosed", "fileCreated", "fileDeleted", - "fileModified", "fileOpened" }; - EventSetDescriptor file = new EventSetDescriptor (beanClass_, - "file", FileListener.class, fileMethods, - "addFileListener", "removeFileListener"); - file.setDisplayName (ResourceLoader.getText ("EVT_NAME_FILE")); - file.setShortDescription (ResourceLoader.getText ("EVT_DESC_FILE")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor undoableEdit = new EventSetDescriptor (beanClass_, - "undoableEdit", UndoableEditListener.class, "undoableEditHappened"); - undoableEdit.setDisplayName (ResourceLoader.getText ("EVT_NAME_UNDOABLE_EDIT")); - undoableEdit.setShortDescription (ResourceLoader.getText ("EVT_DESC_UNDOABLE_EDIT")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { document, error, file, propertyChange, - undoableEdit, vetoableChange, working }; - - // Properties. - PropertyDescriptor path = new PropertyDescriptor ("path", beanClass_); - path.setBound (true); - path.setConstrained (true); - path.setDisplayName (ResourceLoader.getText ("PROP_NAME_PATH")); - path.setShortDescription (ResourceLoader.getText ("PROP_DESC_PATH")); - - PropertyDescriptor system = new PropertyDescriptor ("system", beanClass_); - system.setBound (true); - system.setConstrained (true); - system.setDisplayName (ResourceLoader.getText ("PROP_NAME_SYSTEM")); - system.setShortDescription (ResourceLoader.getText ("PROP_DESC_SYSTEM")); - - properties_ = new PropertyDescriptor[] { path, system }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 1; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // path. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("IFSTextFileDocument16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("IFSTextFileDocument32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/JobLogMessagePropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/JobLogMessagePropertiesPane.java deleted file mode 100644 index 4911282ee..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/JobLogMessagePropertiesPane.java +++ /dev/null @@ -1,352 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JobLogMessagePropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.QSYSObjectPathName; -import com.ibm.as400.resource.ResourceException; -import com.ibm.as400.resource.RQueuedMessage; -import javax.swing.JLabel; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ChangeListener; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.awt.event.ItemListener; -import java.awt.event.ItemEvent; -import java.text.DateFormat; -import java.util.Date; -import java.util.TimeZone; - - - -/** -The JobLogMessagePropertiesPane class represents the properties pane -for a job log message. -**/ -class JobLogMessagePropertiesPane -implements VPropertiesPane -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String dateText_ = ResourceLoader.getText ("MESSAGE_DATE") + ":"; - private static final String fromProgramText_ = ResourceLoader.getText ("MESSAGE_FROM_PROGRAM") + ":"; - private static final String generalTabText_ = ResourceLoader.getText ("TAB_GENERAL"); - private static final String severityText_ = ResourceLoader.getText ("MESSAGE_SEVERITY") + ":"; - private static final String typeText_ = ResourceLoader.getText ("MESSAGE_TYPE") + ":"; - - - - // Static data. - private static DateFormat dateFormat_ = DateFormat.getDateTimeInstance (); - - - - // Private data. - private RQueuedMessage message_; - private VObject object_; - - - - // Event support. - private ChangeEventSupport changeEventSupport_ = new ChangeEventSupport (this); - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - - -/** -Static initializer. -**/ - static - { - dateFormat_.setTimeZone (TimeZone.getDefault ()); - } - - - -/** -Constructs a JobLogMessagePropertiesPane object. - -@param object The object. -@param message The job log message. -**/ - public JobLogMessagePropertiesPane (VObject object, - RQueuedMessage message) - { - object_ = object; - message_ = message; - } - - - -/** -Adds a change listener. - -@param listener The listener. -**/ - public void addChangeListener (ChangeListener listener) - { - changeEventSupport_.addChangeListener (listener); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Applies the changes made by the user. - -@throws Exception If an error occurs. -**/ - public void applyChanges () - throws Exception - { - // No changes are allowed. - } - - - -/** -Returns the graphical component. - -@return The graphical component. -**/ - public Component getComponent () - { - // Initialize the general tab. - JPanel generalTab = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - generalTab.setLayout (layout); - generalTab.setBorder (new EmptyBorder (10, 10, 10, 10)); - - // Add the components. - int row = 0; - VUtilities.constrain (new JLabel (object_.getText (), object_.getIcon (32, false), SwingConstants.LEFT), - generalTab, layout, 0, row++, 2, 1); - -//@B0D JTextArea text = new JTextArea (VUtilities.formatHelp (message_.getText (), 80)); - String messageText; - try { - messageText = (String)message_.getAttributeValue(RQueuedMessage.MESSAGE_TEXT); - } - catch(ResourceException e) { - errorEventSupport_.fireError(e); - messageText = ""; - } - JTextArea text = new JTextArea(messageText); //@B0A - text.setEditable (false); - text.setBackground (generalTab.getBackground ()); - text.setColumns(40); //@B0A - text.setLineWrap(true); //@B0A - text.setWrapStyleWord(true); //@B0A - VUtilities.constrain (text, - generalTab, layout, 0, row++, 2, 1); - - String help; - try { - help = (String)message_.getAttributeValue(RQueuedMessage.MESSAGE_HELP); - } - catch(ResourceException e) { - errorEventSupport_.fireError(e); - help = null; - } - if (help != null) - if (help.length () > 0) { -//@B0D JTextArea helpText = new JTextArea (VUtilities.formatHelp (help, 80)); - JTextArea helpText = new JTextArea(help); //@B0A - helpText.setEditable (false); - helpText.setBackground (generalTab.getBackground ()); - helpText.setColumns(40); //@B0A - helpText.setLineWrap(true); //@B0A - helpText.setWrapStyleWord(true); //@B0A - VUtilities.constrain (helpText, - generalTab, layout, 0, row++, 2, 1); - } - - VUtilities.constrain (new JSeparator (), - generalTab, layout, 0, row++, 2, 1); - - VUtilities.constrain (new JLabel (severityText_), - generalTab, layout, 0, row, 1, 1); - String messageSeverity; - try { - messageSeverity = (String)message_.getAttributeValue(RQueuedMessage.MESSAGE_SEVERITY); - } - catch(ResourceException e) { - messageSeverity = ""; - errorEventSupport_.fireError(e); - } - VUtilities.constrain (new JLabel(messageSeverity), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JLabel (typeText_), - generalTab, layout, 0, row, 1, 1); - String messageType; - try { - messageType = MessageUtilities.getTypeText(((Integer)message_.getAttributeValue(RQueuedMessage.MESSAGE_TEXT)).intValue()); - } - catch(ResourceException e) { - messageType = ""; - errorEventSupport_.fireError(e); - } - VUtilities.constrain (new JLabel(messageType), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JLabel (dateText_), - generalTab, layout, 0, row, 1, 1); - String date; - try { - date = dateFormat_.format((Date)message_.getAttributeValue(RQueuedMessage.DATE_SENT)); - } - catch(ResourceException e) { - date = ""; - errorEventSupport_.fireError(e); - } - if (date != null) - VUtilities.constrain (new JLabel (dateFormat_.format (date)), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JSeparator (), - generalTab, layout, 0, row++, 2, 1); - - VUtilities.constrain (new JLabel (fromProgramText_), - generalTab, layout, 0, row, 1, 1); - String sendingProgramName; - try { - sendingProgramName = (String)message_.getAttributeValue(RQueuedMessage.SENDING_PROGRAM_NAME); - } - catch(ResourceException e) { - sendingProgramName = ""; - errorEventSupport_.fireError(e); - } - VUtilities.constrain (new JLabel (sendingProgramName), - generalTab, layout, 1, row, 1, 1); - row++; - - JTabbedPane tabbedPane = new JTabbedPane (); - - tabbedPane.addTab (generalTabText_, null, generalTab ); - - tabbedPane.setSelectedIndex (0); - - return tabbedPane; - } - - - -/** -Removes a change listener. - -@param listener The listener. -**/ - public void removeChangeListener (ChangeListener listener) - { - changeEventSupport_.removeChangeListener (listener); - } - - - -/** -Removes a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/KeyedDataQueueDocument.java b/cvsroot/src/com/ibm/as400/vaccess/KeyedDataQueueDocument.java deleted file mode 100644 index 78a57be06..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/KeyedDataQueueDocument.java +++ /dev/null @@ -1,818 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: KeyedDataQueueDocument.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.DataQueueEntry; -import com.ibm.as400.access.DataQueueEvent; -import com.ibm.as400.access.DataQueueListener; -import com.ibm.as400.access.KeyedDataQueue; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import javax.swing.event.UndoableEditEvent; -import javax.swing.event.UndoableEditListener; -import javax.swing.text.AttributeSet; -import javax.swing.text.BadLocationException; -import javax.swing.text.Document; -import javax.swing.text.Element; -import javax.swing.text.PlainDocument; -import javax.swing.text.Position; -import javax.swing.text.Segment; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; - - - -/** -The KeyedDataQueueDocument class represents an underlying model -for text components, where the text is entries from a keyed -data queue on a system. - -

    Use this class in conjuction with any JTextComponent or -any other component that works with the Document interface. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    KeyedDataQueueDocument objects generate the following events: -

      -
    • DataQueueEvent -
    • DocumentEvent -
    • ErrorEvent -
    • PropertyChangeEvent -
    • UndoableEditEvent -
    • WorkingEvent -
    - -

    The following example creates a document which contains -the next entry in a data queue on a system. It then -presents the document in a JTextField object. -

    -// Set up the document and the JTextField.
    -AS400 system = new AS400 ("MySystem", "Userid", "Password");
    -KeyedDataQueueDocument document = new KeyedDataQueueDocument (system, "/QSYS.LIB/MYLIB.LIB/MYDATAQ.DTAQ");
    -JTextField textField = new JTextField (document, "", 50);
    -
    -// Add the JTextField to a frame. -JFrame frame = new JFrame ("My Window"); -frame.getContentPane().add(new JScrollPane(textField)); - - -
    -// Read the next entry from the data queue. -document.read (aKey); -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -// -// Implementation notes: -// -// * I decided to contain the other document as opposed to extending -// it so that our interface does not need to document what type -// of document we are. -// -// * I do not think that it is necessary to test the methods -// that just do a load and the call the underlying document. -// -public class KeyedDataQueueDocument -implements Document, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Properties. - private KeyedDataQueue dataQueue_ = null; - - - - // Private data. - transient private PlainDocument document_; - - - - // Event support. - transient private DocumentEventSupport documentEventSupport_ ; - transient private DataQueueEventSupport dataQueueEventSupport_; - transient private ErrorEventSupport errorEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private UndoableEditEventSupport undoableEditEventSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - transient private WorkingEventSupport workingEventSupport_; - - - -/** -Constructs a KeyedDataQueueDocument object. -**/ - public KeyedDataQueueDocument () - { - dataQueue_ = new KeyedDataQueue (); - initializeTransient (); - } - - - -/** -Constructs a KeyedDataQueueDocument object. - -@param system The system on which the data queue resides. -@param path The fully qualified integrated file system path name of the data queue. The path must be in the format of /QSYS.LIB/libname.LIB/dataQueue.DTAQ. The library and queue name must each be 10 characters or less. - -**/ - public KeyedDataQueueDocument (AS400 system, String path) - { - dataQueue_ = new KeyedDataQueue (system, path); - initializeTransient (); - } - - - -/** -Adds a listener to be notified when a data queue event occurs. - -@param listener The listener. -**/ - public void addDataQueueListener (DataQueueListener listener) - { - dataQueueEventSupport_.addDataQueueListener (listener); - } - - - -/** -Adds a listener to be notified when a document event occurs. - -@param listener The listener. -**/ - public void addDocumentListener (DocumentListener listener) - { - documentEventSupport_.addDocumentListener (listener); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds an undoable edit listener to be notified when undoable -edits are made to the document. - -@param listener The listener. -**/ - public void addUndoableEditListener (UndoableEditListener listener) - { - undoableEditEventSupport_.addUndoableEditListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Returns a position that will track change as the document is altered. -If the relative position is null, then the start of the document will -be used. - -@param offset The offset from the start of the document. -@return The position. - -@exception BadLocationException If the given offset does not - represent a valid location in the - document. -**/ - public synchronized Position createPosition (int offset) - throws BadLocationException - { - return document_.createPosition (offset); - } - - - -/** -Returns the root element that views should be based upon -unless some other mechanism for assigning views to element -structures is provided. - -@return The root element. -**/ - public synchronized Element getDefaultRootElement () - { - return document_.getDefaultRootElement (); - } - - - -/** -Returns a position that represents the end of the document. -The position returned can be counted on to track change and stay -located at the end of the document. - -@return The end position of the document. -**/ - public synchronized Position getEndPosition () - { - return document_.getEndPosition (); - } - - - -/** -Returns the length of the document. - -@return The length of the document in characters. -**/ - public synchronized int getLength () - { - return document_.getLength (); - } - - - -/** -Returns the fully qualified integrated file system path name of the data queue. - -@return The fully qualified integrated file system path name of the data queue. -**/ - public String getPath () - { - return dataQueue_.getPath (); - } - - - -/** -Returns a property value associated with the document. - -@param key The property key. -@return The property value. -**/ - public synchronized Object getProperty (Object key) - { - return document_.getProperty (key); - } - - - -/** -Returns the root elements. - -@return The root elements. -**/ - public synchronized Element[] getRootElements () - { - return document_.getRootElements (); - } - - - -/** -Returns a position that represents the start of the document. -The position returned can be counted on to track change and stay -located at the beginning of the document. - -@return The start position of the document. -**/ - public synchronized Position getStartPosition () - { - return document_.getStartPosition (); - } - - - -/** -Returns the system on which the data queue resides. - -@return The system on which the data queue resides. -**/ - public AS400 getSystem() - { - return dataQueue_.getSystem (); - } - - - -/** -Returns the text contained within the specified portion of -the document. - -@param offset The offset into the document representing - the desired start of the text. -@param length The length of the text. -@return The text. - -@exception BadLocationException If the given offset and length does - not represent a valid range in the - document. -**/ - public synchronized String getText (int offset, int length) - throws BadLocationException - { - return document_.getText (offset, length); - } - - - -/** -Stores the text contained within the specified portion of -the document in a segment. - -@param offset The offset into the document representing - the desired start of the text. -@param length The length of the text. -@param text The segment in which to store the text. - -@exception BadLocationException If the given offset and length does - not represent a valid range in the - document. -**/ - public synchronized void getText (int offset, int length, Segment text) - throws BadLocationException - { - document_.getText (offset, length, text); - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - document_ = new PlainDocument (); - - // Initialize the event support. - dataQueueEventSupport_ = new DataQueueEventSupport (this); - documentEventSupport_ = new DocumentEventSupport (this); - errorEventSupport_ = new ErrorEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - undoableEditEventSupport_ = new UndoableEditEventSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - document_.addDocumentListener (documentEventSupport_); - document_.addUndoableEditListener (undoableEditEventSupport_); - dataQueue_.addDataQueueListener (dataQueueEventSupport_); - } - - - -/** -Inserts text into the document. A position marks a location -in the document between items. If the attributes that have been -defined exactly match the current attributes defined at the position, -the element representing the content at that position will simply be -expanded. If the attributes defined are different, a new content -element will be created that matches the attributes. - -@param offset The offset into the document representing - the insertion position. -@param text The text. -@param attributes The attributes to associate with the inserted content, - or null if there are no attributes. - -@exception BadLocationException If the given offset does not - represent a valid position in the - document. -**/ - public synchronized void insertString (int offset, String text, AttributeSet attributes) - throws BadLocationException - { - document_.insertString (offset, text, attributes); - } - - - -/** -Reads an entry from the data queue without removing it from the queue, -and stores the text of the entry in the document. The entry replaces the current content. This method will not wait for entries if none are on the queue. System and path must be set prior -to calling this method. - -@param key The string that contains the key used to search for an entry. -**/ - public void peek (String key) - { - workingEventSupport_.fireStartWorking (); - - try { - // Clear the contents of the document. - document_.remove (0, document_.getLength ()); - - // Peek the data queue. - DataQueueEntry entry = dataQueue_.peek (key); - String contents; - if (entry != null) - contents = entry.getString (); - else - contents = ""; - - // Store the contents of the document. - document_.insertString (0, contents, null); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - - workingEventSupport_.fireStopWorking (); - } - - - -/** -Reads an entry from the data queue without removing it from the queue, -and stores the text of the entry in the document. The entry replaces the current content. System and path must be set prior to calling this method. - - -@param key The string that contains the key used to search for an entry. -@param wait The number of seconds to wait if the queue contains no - entries. -1 means to wait until an entry is available. -@param searchType The type of comparison to use to determine if a key - is a match. Valid values are EQ (equal), NE (not - equal), LT (less than), LE (less than or equal), GT - (greater than), and GE (greater than or equal). -**/ - public void peek (String key, int wait, String searchType) - { - workingEventSupport_.fireStartWorking (); - - try { - // Clear the contents of the document. - document_.remove (0, document_.getLength ()); - - // Peek the data queue. - DataQueueEntry entry = dataQueue_.peek (key, wait, searchType); - String contents; - if (entry != null) - contents = entry.getString (); - else - contents = ""; - - // Store the contents of the document. - document_.insertString (0, contents, null); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - - workingEventSupport_.fireStopWorking (); - } - - - -/** -Sets a property value associated with the document. - -@param key The property key. -@param value The property value. -**/ - public synchronized void putProperty (Object key, Object value) - { - document_.putProperty (key, value); - } - - - -/** -Reads an entry from the data queue and removes it from the queue, -and stores the text of the entry in the document. The entry replaces the current content. This method will not wait for entries if none are on the queue. System and path must be set prior -to calling this method. - -@param key The string that contains the key used to search for an entry. -**/ - public void read (String key) - { - workingEventSupport_.fireStartWorking (); - - try { - // Clear the contents of the document. - document_.remove (0, document_.getLength ()); - - // Peek the data queue. - DataQueueEntry entry = dataQueue_.read (key); - String contents; - if (entry != null) - contents = entry.getString (); - else - contents = ""; - - // Store the contents of the document. - document_.insertString (0, contents, null); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - - workingEventSupport_.fireStopWorking (); - } - - - -/** -Reads an entry from the data queue and removes it from the queue, -and stores the text of the entry in the document. The entry replaces the current content. System and path must be set prior to calling this method. - - - -@param key The string that contains the key used to search for an entry. -@param wait The number of seconds to wait if the queue contains no - entries. -1 means to wait until an entry is available. -@param searchType The type of comparison to use to determine if a key - is a match. Valid values are EQ (equal), NE (not - equal), LT (less than), LE (less than or equal), GT - (greater than), and GE (greater than or equal). -**/ - public void read (String key, int wait, String searchType) - { - workingEventSupport_.fireStartWorking (); - - try { - // Clear the contents of the document. - document_.remove (0, document_.getLength ()); - - // Peek the data queue. - DataQueueEntry entry = dataQueue_.read (key, wait, searchType); - String contents; - if (entry != null) - contents = entry.getString (); - else - contents = ""; - - // Store the contents of the document. - document_.insertString (0, contents, null); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - - workingEventSupport_.fireStopWorking (); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes text from the document. - -@param offset The offset into the document representing - the desired start of the text. -@param length The length of the text. - -@exception BadLocationException If the given offset and length does - not represent a valid range in the - document. -**/ - public synchronized void remove (int offset, int length) - throws BadLocationException - { - document_.remove (offset, length); - } - - - -/** -Removes a data queue listener. - -@param listener The listener. -**/ - public void removeDataQueueListener (DataQueueListener listener) - { - dataQueueEventSupport_.removeDataQueueListener (listener); - } - - - -/** -Removes a document listener. - -@param listener The listener. -**/ - public void removeDocumentListener (DocumentListener listener) - { - documentEventSupport_.removeDocumentListener (listener); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes an undoable edit listener. - -@param listener The listener. -**/ - public void removeUndoableEditListener (UndoableEditListener listener) - { - undoableEditEventSupport_.removeUndoableEditListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Renders the document. This allows the model to be safely rendered in -the presence of currency, if the model supports being updated -asynchronously. The given runnable will be executed in a way that allows -it to safely read the model with no changes while the runnable is being -executed. The runnable itself may not make any mutations. - -@param runnable The runnable. -**/ - public void render (Runnable runnable) - { - document_.render (runnable); - } - - - -/** -Sets the fully qualified integrated file system path name of the data queue. - -@param path The fully qualified integrated file system path name of the data queue. The path must be in the format of /QSYS.LIB/libname.LIB/dataQueue.DTAQ. The library and queue name must each be 10 characters or less. - - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setPath (String path) - throws PropertyVetoException - { - String oldValue = dataQueue_.getPath (); - String newValue = path; - vetoableChangeSupport_.fireVetoableChange ("path", oldValue, newValue); - - dataQueue_.setPath (newValue); - - propertyChangeSupport_.firePropertyChange ("path", oldValue, newValue); - } - - - -/** -Sets the system on which the data queue resides. - -@param system The system on which the data queue resides. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setSystem (AS400 system) - throws PropertyVetoException - { - AS400 oldValue = dataQueue_.getSystem (); - AS400 newValue = system; - vetoableChangeSupport_.fireVetoableChange ("system", oldValue, newValue); - - dataQueue_.setSystem (system); - - propertyChangeSupport_.firePropertyChange ("system", oldValue, newValue); - } - - - -/** -Writes the contents of the document to the data queue.The entry replaces the current content. System and path must be set prior -to calling this method. - -@param key The string that contains the key for this entry. -**/ - public void write (String key) - { - workingEventSupport_.fireStartWorking (); - - // Write the contents. - try { - dataQueue_.write (key, document_.getText (0, document_.getLength ())); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - - workingEventSupport_.fireStopWorking (); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/KeyedDataQueueDocument16.gif b/cvsroot/src/com/ibm/as400/vaccess/KeyedDataQueueDocument16.gif deleted file mode 100644 index d9a953266..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/KeyedDataQueueDocument16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/KeyedDataQueueDocument32.gif b/cvsroot/src/com/ibm/as400/vaccess/KeyedDataQueueDocument32.gif deleted file mode 100644 index 73ab37041..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/KeyedDataQueueDocument32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/KeyedDataQueueDocumentBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/KeyedDataQueueDocumentBeanInfo.java deleted file mode 100644 index 81340d23c..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/KeyedDataQueueDocumentBeanInfo.java +++ /dev/null @@ -1,212 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: KeyedDataQueueDocumentBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.DataQueueListener; -import javax.swing.event.DocumentListener; -import javax.swing.event.UndoableEditListener; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The KeyedDataQueueDocumentBeanInfo class provides bean information -for the KeyedDataQueueDocument class. - -@see KeyedDataQueueDocument -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class KeyedDataQueueDocumentBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = KeyedDataQueueDocument.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - String[] dataQueueMethods = { "cleared", "peeked", "read", "written" }; - EventSetDescriptor dataQueue = new EventSetDescriptor (beanClass_, - "dataQueue", DataQueueListener.class, dataQueueMethods, - "addDataQueueListener", "removeDataQueueListener"); - dataQueue.setDisplayName (ResourceLoader.getText ("EVT_NAME_DATA_QUEUE")); - dataQueue.setShortDescription (ResourceLoader.getText ("EVT_DESC_DATA_QUEUE")); - - String[] documentMethods = { "changedUpdate", "insertUpdate", "removeUpdate" }; - EventSetDescriptor document = new EventSetDescriptor (beanClass_, - "document", DocumentListener.class, documentMethods, - "addDocumentListener", "removeDocumentListener"); - document.setDisplayName (ResourceLoader.getText ("EVT_NAME_DOCUMENT")); - document.setShortDescription (ResourceLoader.getText ("EVT_DESC_DOCUMENT")); - - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor undoableEdit = new EventSetDescriptor (beanClass_, - "undoableEdit", UndoableEditListener.class, "undoableEditHappened"); - undoableEdit.setDisplayName (ResourceLoader.getText ("EVT_NAME_UNDOABLE_EDIT")); - undoableEdit.setShortDescription (ResourceLoader.getText ("EVT_DESC_UNDOABLE_EDIT")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { dataQueue, document, error, - propertyChange, undoableEdit, vetoableChange, working }; - - // Properties. - PropertyDescriptor path = new PropertyDescriptor ("path", beanClass_); - path.setBound (true); - path.setConstrained (true); - path.setDisplayName (ResourceLoader.getText ("PROP_NAME_PATH")); - path.setShortDescription (ResourceLoader.getText ("PROP_DESC_PATH")); - - PropertyDescriptor system = new PropertyDescriptor ("system", beanClass_); - system.setBound (true); - system.setConstrained (true); - system.setDisplayName (ResourceLoader.getText ("PROP_NAME_SYSTEM")); - system.setShortDescription (ResourceLoader.getText ("PROP_DESC_SYSTEM")); - - properties_ = new PropertyDescriptor[] { path, system }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // DataQueueEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // path. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("KeyedDataQueueDocument16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("KeyedDataQueueDocument32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/LabelledComponent.java b/cvsroot/src/com/ibm/as400/vaccess/LabelledComponent.java deleted file mode 100644 index fb9ef9b7c..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/LabelledComponent.java +++ /dev/null @@ -1,68 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: LabelledComponent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.BorderLayout; -import java.awt.Component; -import javax.swing.Box; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; - - - -/** -The LabelledComponent class represents a GUI component with -a label. -**/ -class LabelledComponent -extends JComponent -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - public LabelledComponent(String labelMriKey, Component component) - { - this(ResourceLoader.getQueryText(labelMriKey), component, false); - } - - - - - public LabelledComponent(String text, Component component, boolean overload) - { - // Arrange. - Box labelBox = Box.createHorizontalBox(); - labelBox.add(new JLabel(text, SwingConstants.LEFT)); - labelBox.add(Box.createHorizontalGlue()); - - Box componentBox = Box.createHorizontalBox(); - componentBox.add(component); - componentBox.add(Box.createHorizontalGlue()); - - Box overallBox = Box.createVerticalBox(); - overallBox.add(labelBox); - overallBox.add(componentBox); - setLayout(new BorderLayout()); - add("Center", overallBox); - setBorder(new EmptyBorder(5, 5, 5, 5)); - } - - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/LastIcon.gif b/cvsroot/src/com/ibm/as400/vaccess/LastIcon.gif deleted file mode 100644 index 1760416be..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/LastIcon.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/ListDataEventSupport.java b/cvsroot/src/com/ibm/as400/vaccess/ListDataEventSupport.java deleted file mode 100644 index 18f075507..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ListDataEventSupport.java +++ /dev/null @@ -1,183 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ListDataEventSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.event.ListDataEvent; -import javax.swing.event.ListDataListener; -import java.util.Vector; - - - -/** -The ListDataEvent class represents a list of ListDataListeners. -This is also a ListDataListener and will dispatch all list data -events. -**/ -class ListDataEventSupport -implements ListDataListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private transient ListDataListener[] listeners_ = new ListDataListener[0]; // For speed. - private transient Vector listenersV_ = new Vector (); - private Object source_; - - - -/** -Constructs a ListDataEventSupport object. - -@param source The source of the events. -**/ - public ListDataEventSupport (Object source) - { - source_ = source; - } - - - -/** -Adds a listener. - -@param listener The listener. -**/ - public void addListDataListener (ListDataListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - listenersV_.addElement (listener); - synchronized (listeners_) { - listeners_ = new ListDataListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - - - -/** -Processes an contents changed event. - -@param event The event. -**/ - public void contentsChanged (ListDataEvent event) - { - fireContentsChanged (event.getIndex0 (), event.getIndex1 ()); - } - - - -/** -Fires a contents changed event. - -@param index0 The index 0. -@param index1 The index 1. -**/ - public void fireContentsChanged (int index0, int index1) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].contentsChanged (new ListDataEvent (source_, - ListDataEvent.CONTENTS_CHANGED, index0, index1)); - } - } - - - -/** -Fires an interval added event. - -@param type The type. -@param index0 The index 0. -@param index1 The index 1. -**/ - public void fireIntervalAdded (int index0, int index1) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].intervalAdded (new ListDataEvent (source_, - ListDataEvent.INTERVAL_ADDED, index0, index1)); - } - } - - - -/** -Fires an interval removed event. - -@param type The type. -@param index0 The index 0. -@param index1 The index 1. -**/ - public void fireIntervalRemoved (int index0, int index1) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].intervalRemoved (new ListDataEvent (source_, - ListDataEvent.INTERVAL_REMOVED, index0, index1)); - } - } - - - -/** -Processes an interval added event. - -@param event The event. -**/ - public void intervalAdded (ListDataEvent event) - { - fireIntervalAdded (event.getIndex0 (), event.getIndex1 ()); - } - - - -/** -Processes an interval removed event. - -@param event The event. -**/ - public void intervalRemoved (ListDataEvent event) - { - fireIntervalRemoved (event.getIndex0 (), event.getIndex1 ()); - } - - - -/** -Removes a listener. - -@param listener The listener. -**/ - public void removeListDataListener (ListDataListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - if (listenersV_.removeElement (listener)) { - synchronized (listeners_) { - listeners_ = new ListDataListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - } - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/ListSelectionEventSupport.java b/cvsroot/src/com/ibm/as400/vaccess/ListSelectionEventSupport.java deleted file mode 100644 index 9a14e61a7..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ListSelectionEventSupport.java +++ /dev/null @@ -1,129 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ListSelectionEventSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.ListSelectionModel; -import java.util.Vector; - - - -/** -The ListSelectionEventSupport class represents a list of -ListSelectionListeners. This is also a ListSelectionListener -and will dispatch all list selection events. -**/ -class ListSelectionEventSupport -implements ListSelectionListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private transient ListSelectionListener[] listeners_ = new ListSelectionListener[0]; // For speed. - private transient Vector listenersV_ = new Vector (); - private Object source_; - - - -/** -Constructs a ListSelectionEventSupport object. - -@param source The source of the events. -**/ - public ListSelectionEventSupport (Object source) - { - source_ = source; - } - - - -/** -Adds a listener. - -@param listener The listener. -**/ - public void addListSelectionListener (ListSelectionListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - listenersV_.addElement (listener); - synchronized (listeners_) { - listeners_ = new ListSelectionListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - - - -/** -Fires a value changed event. - -@param firstIndex The first index. -@param lastIndex The last index. -@param isAdjusting true if this is a rapid series of events, false otherwise. -**/ - public void fireValueChanged (int firstIndex, - int lastIndex, - boolean isAdjusting) - { - synchronized (listeners_) { - ListSelectionEvent event = new ListSelectionEvent (source_, - firstIndex, lastIndex, isAdjusting); - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].valueChanged (event); - } - } - - - -/** -Removes a listener. - -@param listener The listener. -**/ - public void removeListSelectionListener (ListSelectionListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - if (listenersV_.removeElement (listener)) { - synchronized (listeners_) { - listeners_ = new ListSelectionListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - } - - - -/** -Processes a value changed event. - -@param event The event. -**/ - public void valueChanged (ListSelectionEvent event) - { - fireValueChanged (event.getFirstIndex (), - event.getLastIndex (), event.getValueIsAdjusting ()); - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/MessagePropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/MessagePropertiesPane.java deleted file mode 100644 index 687cc7179..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/MessagePropertiesPane.java +++ /dev/null @@ -1,299 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MessagePropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.Trace; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTextArea; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ChangeListener; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.text.DateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.TimeZone; - - - -/** -The MessagePropertiesPane class represents the properties pane -for a message. -**/ -class MessagePropertiesPane -implements VPropertiesPane -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String dateText_ = ResourceLoader.getText ("MESSAGE_DATE") + ": "; - private static final String generalTabText_ = ResourceLoader.getText ("TAB_GENERAL"); - private static final String messageFileText_ = ResourceLoader.getText ("MESSAGE_FILE") + ": "; - private static final String severityText_ = ResourceLoader.getText ("MESSAGE_SEVERITY") + ": "; - private static final String typeText_ = ResourceLoader.getText ("MESSAGE_TYPE") + ": "; - - - - // Static data. - private static DateFormat dateFormat_ = DateFormat.getDateTimeInstance (); - - - - // Private data. - private AS400Message message_; - private VMessage object_; - - - - // Event support. - private ChangeEventSupport changeEventSupport_ = new ChangeEventSupport (this); - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - - -/** -Static initializer. -**/ - static - { - dateFormat_.setTimeZone (TimeZone.getDefault ()); - } - - - -/** -Constructs an MessagePropertiesPane object. - -@param object The object. -@param message The message. -**/ - public MessagePropertiesPane (VMessage object, AS400Message message) - { - object_ = object; - message_ = message; - } - - - -/** -Adds a change listener. - -@param listener The listener. -**/ - public void addChangeListener (ChangeListener listener) - { - changeEventSupport_.addChangeListener (listener); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Applies the changes made by the user. - -@throws Exception If an error occurs. -**/ - public void applyChanges () - throws Exception - { - // No changes are allowed. - } - - - -/** -Returns the graphical component. - -@return The graphical component. -@throws Exception If an error occurs. -**/ - public Component getComponent () - { - // Initialize the general tab. - JPanel generalTab = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - generalTab.setLayout (layout); - generalTab.setBorder (new EmptyBorder (10, 10, 10, 10)); - - // Add the components. - int row = 0; - VUtilities.constrain (new JLabel (object_.getText (), object_.getIcon (32, false), SwingConstants.LEFT), - generalTab, layout, 0, row++, 2, 1); - -//@B0D JTextArea text = new JTextArea (VUtilities.formatHelp (message_.getText (), 80)); - JTextArea text = new JTextArea (message_.getText()); //@B0A - text.setEditable (false); - text.setBackground (generalTab.getBackground ()); - text.setColumns(40); //@B0A - text.setLineWrap(true); //@B0A - text.setWrapStyleWord(true); //@B0A - VUtilities.constrain (text, - generalTab, layout, 0, row++, 2, 1); - - String help = message_.getHelp (); - if (help != null) - if (help.length () > 0) { -//@B0D JTextArea helpText = new JTextArea (VUtilities.formatHelp (help, 80)); - JTextArea helpText = new JTextArea(help); //@B0A - helpText.setEditable (false); - helpText.setBackground (generalTab.getBackground ()); - helpText.setColumns(40); //@B0A - helpText.setLineWrap(true); //@B0A - helpText.setWrapStyleWord(true); //@B0A - VUtilities.constrain (helpText, - generalTab, layout, 0, row++, 2, 1); - } - - VUtilities.constrain (new JSeparator (), - generalTab, layout, 0, row++, 2, 1); - - VUtilities.constrain (new JLabel (severityText_), - generalTab, layout, 0, row, 1, 1); - VUtilities.constrain (new JLabel (Integer.toString (message_.getSeverity ())), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JLabel (typeText_), - generalTab, layout, 0, row, 1, 1); - VUtilities.constrain (new JLabel (MessageUtilities.getTypeText (message_.getType ())), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JLabel (dateText_), - generalTab, layout, 0, row, 1, 1); - Calendar date = message_.getDate (); - if (date != null) - VUtilities.constrain (new JLabel (dateFormat_.format (date.getTime ())), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JSeparator (), - generalTab, layout, 0, row++, 2, 1); - - VUtilities.constrain (new JLabel (messageFileText_), - generalTab, layout, 0, row, 1, 1); - VUtilities.constrain (new JLabel (message_.getPath ()), - generalTab, layout, 1, row, 1, 1); - row++; - - // Build the pane. - JTabbedPane pane = new JTabbedPane (); - pane.addTab (generalTabText_, null, generalTab); - pane.setSelectedIndex (0); - return pane; - } - - - -/** -Removes a change listener. - -@param listener The listener. -**/ - public void removeChangeListener (ChangeListener listener) - { - changeEventSupport_.removeChangeListener (listener); - } - - - -/** -Removes a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/MessageQueueClearAction.java b/cvsroot/src/com/ibm/as400/vaccess/MessageQueueClearAction.java deleted file mode 100644 index f4aa212cb..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/MessageQueueClearAction.java +++ /dev/null @@ -1,107 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MessageQueueClearAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.MessageQueue; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; - - - -/** -The MessageQueueClearAction class defines the action of -clearing a message queue. -**/ -class MessageQueueClearAction -extends ConfirmedAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String confirmTitleText_ = ResourceLoader.getText ("DLG_CONFIRM_CLEAR_TITLE"); - private static final String confirmMessageText_ = ResourceLoader.getText ("DLG_CONFIRM_CLEAR"); - private static final String text_ = ResourceLoader.getText ("ACTION_CLEAR"); - - - - // Private data. - private JComboBox messageType_; - private VMessageQueue object_; - private MessageQueue queue_; - - - -/** -Constructs a MessageQueueClearAction object. - -@param object The object. -@param queue The message queue. -**/ - public MessageQueueClearAction (VMessageQueue object, MessageQueue queue) - { - super (object, confirmTitleText_, confirmMessageText_); - object_ = object; - queue_ = queue; - } - - - -/** -Returns the text for the action. - -@return The text. -**/ - public String getText () - { - return text_; - } - - - -/** -Performs the action. -**/ - public void perform2 (VActionContext context) - { - fireStartWorking (); - - try { - int count = object_.getDetailsChildCount (); - VObject[] detailsChildren = new VObject[count]; - for (int i = 0; i < count; ++i) - detailsChildren[i] = object_.getDetailsChildAt (i); - - queue_.remove (); - - for (int i = 0; i < count; ++i) - fireObjectDeleted (detailsChildren[i]); - } - catch (Exception e) { - fireError (e); - } - - fireStopWorking (); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/MessageQueuePropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/MessageQueuePropertiesPane.java deleted file mode 100644 index eb8b1e613..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/MessageQueuePropertiesPane.java +++ /dev/null @@ -1,305 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MessageQueuePropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.MessageQueue; -import com.ibm.as400.access.Trace; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JRadioButton; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTextField; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ChangeListener; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.awt.event.ItemListener; -import java.awt.event.ItemEvent; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; - - - -/** -The MessageQueuePropertyPane class represents the properties pane -for a message queue. -**/ -class MessageQueuePropertiesPane -implements VPropertiesPane -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String allMessagesChoice_ = ResourceLoader.getText ("MESSAGE_QUEUE_CHOICE_ALL"); - private static final String generalTabText_ = ResourceLoader.getText ("TAB_GENERAL"); - private static final String messagesNeedingReplyChoice_ = ResourceLoader.getText ("MESSAGE_QUEUE_CHOICE_MNR"); - private static final String messagesNotNeedingReplyChoice_ = ResourceLoader.getText ("MESSAGE_QUEUE_CHOICE_MNNR"); - private static final String selectionPrompt_ = ResourceLoader.getText ("MESSAGE_SELECTION") + ": "; - private static final String sendersCopyNeedingReplyChoice_ = ResourceLoader.getText ("MESSAGE_QUEUE_CHOICE_SCNR"); - private static final String severityPrompt_ = ResourceLoader.getText ("MESSAGE_SEVERITY") + ": "; - - - - // Constants. - private static final String allMessagesAbbreviation_ = "*ALL"; - private static final String messagesNeedingReplyAbbreviation_ = "*MNR"; - private static final String messagesNotNeedingReplyAbbreviation_ = "*MNNR"; - private static final String sendersCopyNeedingReplyAbbreviation_ = "*SCNR"; - - - - // Private data. - private VMessageQueue object_; - private JComboBox selection_; - private JTextField severity_; - - - - // Event support. - ChangeEventSupport changeEventSupport_ = new ChangeEventSupport (this); // Private. - ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); // Private. - VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); // Private. - WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); // Private. - - - -/** -Constructs a MessageQueuePropertyPane object. - -@param object The object. -**/ - public MessageQueuePropertiesPane (VMessageQueue object) - { - object_ = object; - } - - - -/** -Adds a listener to be notified when the user makes a change. - -@param listener The listener. -**/ - public void addChangeListener (ChangeListener listener) - { - changeEventSupport_.addChangeListener (listener); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Applies the changes made by the user. - -@exception Exception If an error occurs. -**/ - public void applyChanges () - throws Exception - { - // Apply severity. - object_.setSeverity (Integer.parseInt (severity_.getText ())); - - // Apply selection. - Object userSelection = selection_.getSelectedItem (); - if (userSelection.equals (messagesNeedingReplyChoice_)) - object_.setSelection (messagesNeedingReplyAbbreviation_); - else if (userSelection.equals (sendersCopyNeedingReplyChoice_)) - object_.setSelection (sendersCopyNeedingReplyAbbreviation_); - else if (userSelection.equals (messagesNotNeedingReplyChoice_)) - object_.setSelection (messagesNotNeedingReplyAbbreviation_); - else - object_.setSelection (allMessagesAbbreviation_); - - // Reload. - object_.load (); - } - - - -/** -Returns the graphical user interface component. - -@return The component. -**/ - public Component getComponent () - { - // Initialize the general tab. - JPanel generalTab = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - generalTab.setLayout (layout); - generalTab.setBorder (new EmptyBorder (10, 10, 10, 10)); - int row = 0; - - // Initialize a key listener. - KeyListener keyListener = new KeyAdapter () { - public void keyPressed (KeyEvent event) { changeEventSupport_.fireStateChanged (); } // @C1A - public void keyTyped (KeyEvent event) { changeEventSupport_.fireStateChanged (); } - }; - - // Queue information. - VUtilities.constrain (new JLabel (object_.getText (), object_.getIcon (32, false), SwingConstants.LEFT), - generalTab, layout, 0, row++, 2, 1); - - VUtilities.constrain (new JSeparator (), - generalTab, layout, 0, row++, 2, 1); - - // Severity prompt. - VUtilities.constrain (new JLabel (severityPrompt_), - generalTab, layout, 0, row, 1, 1); - - severity_ = new JTextField (Integer.toString (object_.getSeverity ())); - severity_.addActionListener (new ActionListener () { - public void actionPerformed (ActionEvent event) { - changeEventSupport_.fireStateChanged (); - }}); - severity_.addKeyListener (keyListener); - - VUtilities.constrain (severity_, - generalTab, layout, 1, row++, 1, 1); - - // Selection prompt. - VUtilities.constrain (new JLabel (selectionPrompt_), - generalTab, layout, 0, row, 1, 1); - - selection_ = new JComboBox (); - selection_.setEditable (false); - selection_.addItem (allMessagesChoice_); - selection_.addItem (messagesNeedingReplyChoice_); - selection_.addItem (sendersCopyNeedingReplyChoice_); - selection_.addItem (messagesNotNeedingReplyChoice_); - - String initialSelection = object_.getSelection (); - if (initialSelection.equals (messagesNeedingReplyAbbreviation_)) - selection_.setSelectedItem (messagesNeedingReplyChoice_); - else if (initialSelection.equals (sendersCopyNeedingReplyAbbreviation_)) - selection_.setSelectedItem (sendersCopyNeedingReplyChoice_); - else if (initialSelection.equals (messagesNotNeedingReplyAbbreviation_)) - selection_.setSelectedItem (messagesNotNeedingReplyChoice_); - else - selection_.setSelectedItem (allMessagesChoice_); - - selection_.addItemListener (new ItemListener () { - public void itemStateChanged (ItemEvent event) { - changeEventSupport_.fireStateChanged (); - }}); - - VUtilities.constrain (selection_, - generalTab, layout, 1, row++, 1, 1); - - // Build the pane. - JTabbedPane pane = new JTabbedPane (); - pane.addTab (generalTabText_, null, generalTab); - pane.setSelectedIndex (0); - return pane; - } - - - -/** -Removes a change listener. - -@param listener The listener. -**/ - public void removeChangeListener (ChangeListener listener) - { - changeEventSupport_.removeChangeListener (listener); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/MessageUtilities.java b/cvsroot/src/com/ibm/as400/vaccess/MessageUtilities.java deleted file mode 100644 index 3dea38bc5..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/MessageUtilities.java +++ /dev/null @@ -1,91 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: MessageUtilities.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - - - -/** -The MessageUtilities class provides some commonly used routines -for implementation of the message support. -**/ -class MessageUtilities -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String completionTypeText_ = ResourceLoader.getText ("MESSAGE_TYPE_COMPLETION"); - private static final String diagnosticTypeText_ = ResourceLoader.getText ("MESSAGE_TYPE_DIAGNOSTIC"); - private static final String informationalTypeText_ = ResourceLoader.getText ("MESSAGE_TYPE_INFORMATIONAL"); - private static final String inquiryTypeText_ = ResourceLoader.getText ("MESSAGE_TYPE_INQUIRY"); - private static final String sendersCopyTypeText_ = ResourceLoader.getText ("MESSAGE_TYPE_SENDERS_COPY"); - private static final String requestTypeText_ = ResourceLoader.getText ("MESSAGE_TYPE_REQUEST"); - private static final String requestWithPromptingTypeText_ = ResourceLoader.getText ("MESSAGE_TYPE_REQUEST_WITH_PROMPTING"); - private static final String notifyTypeText_ = ResourceLoader.getText ("MESSAGE_TYPE_NOTIFY"); - private static final String escapeTypeText_ = ResourceLoader.getText ("MESSAGE_TYPE_ESCAPE"); - private static final String replyNotValidityCheckedTypeText_ = ResourceLoader.getText ("MESSAGE_TYPE_REPLY_NOT_VALIDITY_CHECKED"); - private static final String replyValidityCheckedTypeText_ = ResourceLoader.getText ("MESSAGE_TYPE_REPLY_VALIDITY_CHECKED"); - private static final String replyMessageDefaultUsedTypeText_ = ResourceLoader.getText ("MESSAGE_TYPE_REPLY_MESSAGE_DEFAULT_USED"); - private static final String replySystemDefaultUsedTypeText_ = ResourceLoader.getText ("MESSAGE_TYPE_REPLY_SYSTEM_DEFAULT_USED"); - private static final String replyFromSystemReplyListTypeText_ = ResourceLoader.getText ("MESSAGE_TYPE_REPLY_FROM_SYSTEM_REPLY_LIST"); - private static final String unexpectedTypeText_ = ResourceLoader.getText ("MESSAGE_TYPE_UNEXPECTED"); - - - -/** -Returns the text representation of a message type. - -@param The int representation. -@return The text representation. -**/ - static String getTypeText (int messageType) - { - switch (messageType) { - case 1: - return completionTypeText_; - case 2: - return diagnosticTypeText_; - case 4: - return informationalTypeText_; - case 5: - return inquiryTypeText_; - case 6: - return sendersCopyTypeText_; - case 8: - return requestTypeText_; - case 10: - return requestWithPromptingTypeText_; - case 14: - return notifyTypeText_; - case 15: - return escapeTypeText_; - case 21: - return replyNotValidityCheckedTypeText_; - case 22: - return replyValidityCheckedTypeText_; - case 23: - return replyMessageDefaultUsedTypeText_; - case 24: - return replySystemDefaultUsedTypeText_; - case 25: - return replyFromSystemReplyListTypeText_; - default: - return unexpectedTypeText_; - } - } - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/NextIcon.gif b/cvsroot/src/com/ibm/as400/vaccess/NextIcon.gif deleted file mode 100644 index f0abf67c9..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/NextIcon.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/OutputDeleteAction.java b/cvsroot/src/com/ibm/as400/vaccess/OutputDeleteAction.java deleted file mode 100644 index d552b5fb6..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/OutputDeleteAction.java +++ /dev/null @@ -1,104 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputDeleteAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.SpooledFile; -import com.ibm.as400.access.Trace; - -/** -The OutputDeleteAction class represents the action of deleting a -spooled file. -**/ -class OutputDeleteAction -extends ConfirmedAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // MRI. - private static final String confirmTitleText_ = ResourceLoader.getText ("DLG_CONFIRM_DELETION_TITLE"); - private static final String confirmMessageText_ = ResourceLoader.getText ("DLG_CONFIRM_DELETION"); - private static final String text_ = ResourceLoader.getText ("ACTION_DELETE"); - - // Private data. - private SpooledFile splF_ = null; // the spooled file - private VPrinterOutput parent_ = null; // parent (the spooled list) - -/** -Constructs an OutputDeleteAction object. - -@param object The object. -@param splF The spooled file. -**/ - public OutputDeleteAction (VObject object, SpooledFile splF, VPrinterOutput parent) - { - super (object, confirmTitleText_, confirmMessageText_); - splF_ = splF; - parent_ = parent; - } - - -/** -Returns the localized text for the action. - -@return The text. -**/ - public String getText () - { - return text_; - } - - -/** -Performs the action after the user has confirmed it. - -@param context The action context. -**/ - public void perform2 (VActionContext context) - { - try { - // fire started working event - fireStartWorking(); - - // delete the spooled file - splF_.delete (); - - // retrieve a reference to the VObject for the spooled file - VObject deletedObject = getObject (); - - // fire stopped working event - fireStopWorking(); - - if (Trace.isTraceOn()) - Trace.log (Trace.INFORMATION, "Deleted file [" - + splF_.getName () + "]."); - - // notify of the delete - fireObjectDeleted (); - - // remove the object from the list - parent_.remove (deletedObject); - - } // end try block - catch (Exception e) - { - // trace the error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR Deleting file [" + splF_.getName () + "]."); - - fireError (e); - } - } - -} // end OutputDeleteAction class - diff --git a/cvsroot/src/com/ibm/as400/vaccess/OutputHoldAction.java b/cvsroot/src/com/ibm/as400/vaccess/OutputHoldAction.java deleted file mode 100644 index 9d3630592..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/OutputHoldAction.java +++ /dev/null @@ -1,158 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputHoldAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.SpooledFile; -import com.ibm.as400.access.PrintObject; -import com.ibm.as400.access.Trace; -import javax.swing.JOptionPane; -import javax.swing.JRadioButton; -import javax.swing.ButtonGroup; -import javax.swing.JPanel; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JTextField; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import javax.swing.border.EmptyBorder; -import javax.swing.SwingConstants; - -/** -The OutputHoldAction class represents the action of holding a spooled file. -**/ -class OutputHoldAction -extends DialogAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final String displayName_ = ResourceLoader.getText("ACTION_HOLD"); - private static final String prtOutToHoldText_ = ResourceLoader.getPrintText("PRINTER_OUTPUT_TO_HOLD") + ":"; - private static final String holdOutputText_ = ResourceLoader.getPrintText("HOLD_OUTPUT") + ":"; - private static final String immediatelyText_ = ResourceLoader.getPrintText("IMMEDIATELY"); - private static final String pageEndText_ = ResourceLoader.getPrintText("AT_PAGE_END"); - - private SpooledFile splF_ = null; // the spooled file - private JRadioButton immedButton_ = null; // hold immediately - private JRadioButton endButton_ = null; // hold at end of page - -/** -Constructs an OutputHoldAction object. - -@param object The object. -@param splF The spooled file. -**/ - public OutputHoldAction (VObject object, SpooledFile splF) - { - super (object); - splF_ = splF; - } - - -/** -Returns the component for the dialog box. - -@return The component. -**/ - public JComponent getInputComponent() - { - JPanel panel = new JPanel(); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - panel.setLayout (layout); - panel.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - // build components to display the output to be held - VUtilities.constrain( new JLabel(prtOutToHoldText_), panel, layout, 0,0,1,1); - - JTextField text = new JTextField(getObject().toString()); - text.setEditable(false); - VUtilities.constrain( text, panel, layout, 0,1,1,1); - - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 2, 2, 1); - - // build components to ask user to hold *IMMED or *PAGEEND - VUtilities.constrain( new JLabel(holdOutputText_), panel, layout, 0,3,1,1); - - immedButton_ = new JRadioButton(immediatelyText_); - immedButton_.setHorizontalAlignment(SwingConstants.LEFT); - immedButton_.setSelected(true); - endButton_ = new JRadioButton(pageEndText_); - endButton_.setHorizontalAlignment(SwingConstants.LEFT); - - // group the buttons so that only one can be on at a time - ButtonGroup group = new ButtonGroup(); - group.add(immedButton_); - group.add(endButton_); - - VUtilities.constrain( immedButton_, panel, layout, 0,4,1,1); - VUtilities.constrain( endButton_, panel, layout, 0,5,1,1); - } - catch (Exception e) - { - panel = null; - fireError (e); - } - - return panel; - } - - -/** -Returns the display name for the action. - -@return The display name. -**/ - public String getText () - { - return displayName_; - } - -/** -Performs the action. -**/ - public void perform2 () - { - try { - // fire started working event - fireStartWorking(); - - // determine which hold option to send - if (immedButton_.isSelected()) splF_.hold("*IMMED"); - else splF_.hold("*PAGEEND"); - - // fire stopped working event - fireStopWorking(); - - // trace the hold - if (Trace.isTraceOn()) - Trace.log (Trace.INFORMATION, "Held file [" + splF_.getName () + "]."); - - fireObjectChanged (); - } // end try block - catch (Exception e) - { - // trace the error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR Holding file [" + splF_.getName () + "]."); - - fireError (e); - } - } - -} // end OutputHoldAction class - diff --git a/cvsroot/src/com/ibm/as400/vaccess/OutputMoveAction.java b/cvsroot/src/com/ibm/as400/vaccess/OutputMoveAction.java deleted file mode 100644 index 418589518..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/OutputMoveAction.java +++ /dev/null @@ -1,264 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputMoveAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.SpooledFile; -import com.ibm.as400.access.OutputQueue; -import com.ibm.as400.access.PrintObject; -import com.ibm.as400.access.Trace; -import javax.swing.JComboBox; -import javax.swing.JRadioButton; -import javax.swing.ButtonGroup; -import javax.swing.JPanel; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JTextField; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import javax.swing.border.EmptyBorder; -import javax.swing.SwingConstants; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -/** -The OutputMoveAction class represents the action of moving a spooled file. -**/ -class OutputMoveAction -extends DialogAction -implements ActionListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final String displayName_ = ResourceLoader.getText("ACTION_MOVE"); - private static final String prtOutToMoveText_ = ResourceLoader.getPrintText("PRINTER_OUTPUT_TO_MOVE") + ":"; - private static final String moveOutputText_ = ResourceLoader.getPrintText("MOVE_OUTPUT") + ":"; - private static final String useLibListText_ = ResourceLoader.getPrintText("USE_LIBRARY_LIST"); - private static final String printerText_ = ResourceLoader.getPrintText("PRINTER"); - private static final String outQText_ = ResourceLoader.getPrintText("OUTPUT_QUEUE"); - private static final String outQLibText_ = ResourceLoader.getPrintText("LIBRARY"); - - private SpooledFile splF_ = null; // the spooled file - private JRadioButton printerButton_ = null; // printer - private JTextField printerField_ = null; // printer name - private JRadioButton outQButton_ = null; // output queue - private JTextField outQField_ = null; // output queue name - private JComboBox outQLibBox_ = null; // output queue library - - private VPrinterOutput parent_ = null; // parent (the spooled list) - -/** -Constructs an OutputMoveAction object. - -@param object The object. -@param splF The spooled file. -**/ - public OutputMoveAction (VObject object, SpooledFile splF, VPrinterOutput parent) - { - super (object); - splF_ = splF; - parent_ = parent; - } - -/** -catches the state change of radio buttons -**/ - public void actionPerformed(ActionEvent e) - { - // if the printer radio button is selected - if (e.getActionCommand() == printerText_) - { - // enable the printer field - printerField_.setEnabled(true); - - // disable the output queue fields - outQField_.setEnabled(false); - outQLibBox_.setEnabled(false); - } - else // the output queue button is selected - { - // enable the output queue fields - outQField_.setEnabled(true); - outQLibBox_.setEnabled(true); - - // disable the printer field - printerField_.setEnabled(false); - } - } - - -/** -Returns the component for the dialog box. - -@return The component. -**/ - public JComponent getInputComponent() - { - JPanel panel = new JPanel(); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - panel.setLayout (layout); - panel.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - // build components to display the output to be moved - VUtilities.constrain( new JLabel(prtOutToMoveText_), panel, layout, 0,0,1,1); - - JTextField text = new JTextField(getObject().toString()); - text.setEditable(false); - VUtilities.constrain( text, panel, layout, 0,1,1,1); - - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 2, 2, 1); - - // build components to ask user for move input - VUtilities.constrain( new JLabel(moveOutputText_), panel, layout, 0,3,1,1); - - // build printer/output queue buttons - printerButton_ = new JRadioButton(printerText_); - printerButton_.setHorizontalAlignment(SwingConstants.LEFT); - printerButton_.setSelected(true); - outQButton_ = new JRadioButton(outQText_); - outQButton_.setHorizontalAlignment(SwingConstants.LEFT); - - // add listeners for the printer and output queue buttons - printerButton_.addActionListener(this); - outQButton_.addActionListener(this); - - // group the buttons so that only one can be on at a time - ButtonGroup group = new ButtonGroup(); - group.add(printerButton_); - group.add(outQButton_); - - // printer name - printerField_ = new JTextField(10); - VUtilities.constrain( printerButton_, panel, layout, 0,4,1,1); - VUtilities.constrain( printerField_, panel, layout, 1,4,1,1); - - // output queue name - outQField_ = new JTextField(10); - outQField_.setEnabled(false); // disable until outQButton is selected - VUtilities.constrain( outQButton_, panel, layout, 0,5,1,1); - VUtilities.constrain( outQField_, panel, layout, 1,5,1,1); - - // output queue library - outQLibBox_ = new JComboBox(); - outQLibBox_.setEditable(true); - outQLibBox_.addItem(useLibListText_); - outQLibBox_.setEnabled(false); // disable until outQButton is selected - - VUtilities.constrain( new JLabel(outQLibText_), panel, layout, 0,6,1,1); - VUtilities.constrain( outQLibBox_, panel, layout, 1,6,1,1); - } - catch (Exception e) - { - panel = null; - fireError (e); - } - - return panel; - } - - -/** -Returns the display name for the action. - -@return The display name. -**/ - public String getText () - { - return displayName_; - } - -/** -Performs the action. -**/ - public void perform2 () - { - try { - // determine if they selected printer - if (printerButton_.isSelected()) - { - // retrieve the printer name - String ptr = printerField_.getText().trim(); - - // build an output queue object using the printer name - // Note: QUSRSYS is the library name for all system printers - OutputQueue outQ = new OutputQueue(splF_.getSystem(), "/QSYS.LIB/QUSRSYS.LIB/" + ptr + ".OUTQ"); - - // fire started working event - fireStartWorking(); - - // move the spooled file to the output queue - splF_.move(outQ); - - // fire stopped working event - fireStopWorking(); - - // trace the move - if (Trace.isTraceOn()) - Trace.log (Trace.INFORMATION, "Moved file [" - + splF_.getName () + "]."); - } - // they selected output queue - else - { - // retieve the output queue name - String outputQ = outQField_.getText().trim(); - - // retrieve the library value - String outputQLib = (String)outQLibBox_.getSelectedItem(); - - OutputQueue outQ = null; - - // if use the library list was selected - if (outputQLib.equals(useLibListText_)) - // build an output queue object using name - outQ = new OutputQueue(splF_.getSystem(), "/QSYS.LIB/%LIBL%.LIB/" + outputQ + ".OUTQ"); - else - // build an output queue object using name and lib - outQ = new OutputQueue(splF_.getSystem(), "/QSYS.LIB/" + outputQLib + ".LIB/" + outputQ + ".OUTQ"); - - // fire started working event - fireStartWorking(); - - // move the spooled file to the output queue - splF_.move(outQ); - - // fire stopped working event - fireStopWorking(); - - // trace the move - if (Trace.isTraceOn()) - Trace.log (Trace.INFORMATION, "Moved file [" - + splF_.getName () + "]."); - } - - // fire the object changed passing in the object's parent so the list is - // rearranged - fireObjectChanged (parent_); - } // end try block - catch (Exception e) - { - // trace the error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR Moving file [" + splF_.getName () + "]."); - - fireError (e); - } - } - -} // end OutputMoveAction class - diff --git a/cvsroot/src/com/ibm/as400/vaccess/OutputPrintNextAction.java b/cvsroot/src/com/ibm/as400/vaccess/OutputPrintNextAction.java deleted file mode 100644 index 0df97bab2..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/OutputPrintNextAction.java +++ /dev/null @@ -1,96 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputPrintNextAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.SpooledFile; -import com.ibm.as400.access.Trace; - -/** -The OutputPrintNextAction class represents the action of moving a spooled -file to the top so it can be printed next. -**/ -class OutputPrintNextAction -extends AbstractVAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final String displayName_ = ResourceLoader.getText("ACTION_PRINTNEXT"); - private SpooledFile splF_ = null; // the spooled file - private VPrinterOutput parent_ = null; // parent (the spooled list) - -/** -Constructs an OutputPrintNextAction object. - -@param object The object. -@param splF The spooled file. -**/ - public OutputPrintNextAction (VObject object, SpooledFile splF, VPrinterOutput parent) - { - super (object); - splF_ = splF; - parent_ = parent; - } - - -/** -Returns the display name for the action. - -@return The display name. -**/ - public String getText () - { - return displayName_; - } - -/** -Performs the action. - -@param context The action context. -**/ - public void perform (VActionContext context) - { - try { - - // fire started working event - fireStartWorking(); - - // move the spooled file - splF_.moveToTop(); - - // fire stopped working event - fireStopWorking(); - - // trace the move - if (Trace.isTraceOn()) - Trace.log (Trace.INFORMATION, "Moved file [" - + splF_.getName () + "]."); - - // fire the object changed passing in the object's parent so the list is - // rearranged - fireObjectChanged (parent_); - } // end try block - catch (Exception e) - { - // trace the error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR moving file [" + splF_.getName () + "]."); - - fireError (e); - } - } - -} // end OutputPrintNextAction class - diff --git a/cvsroot/src/com/ibm/as400/vaccess/OutputPropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/OutputPropertiesPane.java deleted file mode 100644 index a9c4192e5..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/OutputPropertiesPane.java +++ /dev/null @@ -1,1098 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputPropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.SpooledFile; -import com.ibm.as400.access.PrintObject; -import com.ibm.as400.access.PrintParameterList; -import com.ibm.as400.access.QSYSObjectPathName; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTabbedPane; -import javax.swing.JComboBox; -import javax.swing.JTextField; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ItemListener; -import java.awt.event.ItemEvent; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import javax.swing.SwingConstants; -import javax.swing.event.ChangeListener; -import javax.swing.border.EmptyBorder; -import java.text.DateFormat; -import java.util.Date; -import java.util.Calendar; - - -/** -The OutputPropertiesPane class represents the property pane -for the VOutput object. -**/ -class OutputPropertiesPane -implements VPropertiesPane, ItemListener, ActionListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private VOutput object_; // our visual output object - private SpooledFile splF_; // the spooled file object - private boolean functionSupported_; // @A2A - - private JTextField userData_; // user specified data field - private JComboBox saveBox_; // save after printing field - private JTextField printer_; // printer field - private JTextField outQ_; // output queue name field - private JTextField outQLib_; // output queue library field - private JComboBox outQPtyBox_; // output queue priority field - private JTextField totalCopies_; // total copies field - private JTextField copiesLeft_; // copies left field - private JTextField formType_; // form type field - - // Event support. - private ChangeEventSupport changeEventSupport_ = new ChangeEventSupport (this); - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - // Static data. - private static DateFormat dateFormat_ = DateFormat.getDateTimeInstance (); - private static Calendar calendar_ = Calendar.getInstance (); - private static final int supportedVRM_ = 0X00040100; // @A2A - - // MRI - private static final String noText_ = ResourceLoader.getPrintText("NO"); - private static final String yesText_ = ResourceLoader.getPrintText("YES"); - private static final String jobValueText_ = ResourceLoader.getPrintText("JOB_VALUE"); - private static final String standardText_ = ResourceLoader.getPrintText("STANDARD"); - private static final String outputNameText_ = ResourceLoader.getPrintText("OUTPUT_NAME") + ":"; - private static final String numberText_ = ResourceLoader.getPrintText("NUMBER") + ":"; - private static final String statusText_ = ResourceLoader.getPrintText("STATUS") + ":"; - private static final String statusClosedText_ = ResourceLoader.getPrintText("CLOSED"); - private static final String statusHeldText_ = ResourceLoader.getPrintText("HELD"); - private static final String statusMsgWaitingText_= ResourceLoader.getPrintText("MESSAGE_WAITING"); - private static final String statusOpenText_ = ResourceLoader.getPrintText("OPEN"); - private static final String statusPendingText_ = ResourceLoader.getPrintText("PENDING"); - private static final String statusPrinterText_ = ResourceLoader.getPrintText("PRINTER"); - private static final String statusReadyText_ = ResourceLoader.getPrintText("READY"); - private static final String statusSavedText_ = ResourceLoader.getPrintText("SAVED"); - private static final String statusWritingText_ = ResourceLoader.getPrintText("WRITING"); - private static final String userSpecDataText_ = ResourceLoader.getPrintText("USER_SPEC_DATA") + ":"; - private static final String saveText_ = ResourceLoader.getPrintText("SAVE_AFTER_PRINTING") + ":"; - private static final String printerText_ = ResourceLoader.getPrintText("PRINTER") + ":"; - private static final String outQText_ = ResourceLoader.getPrintText("OUTPUT_QUEUE") + ":"; - private static final String outQLibText_ = ResourceLoader.getPrintText("OUTPUT_QUEUE_LIB") + ":"; - private static final String outQPtyText_ = ResourceLoader.getPrintText("OUTQ_PRIORITY_1_9") + ":"; - private static final String totalCopiesText_ = ResourceLoader.getPrintText("TOTAL_COPIES_1_255") + ":"; - private static final String copiesLeftText_ = ResourceLoader.getPrintText("COPIES_LEFT_1_255") + ":"; - private static final String pagesPerCopyText_ = ResourceLoader.getPrintText("PAGES_PER_COPY") + ":"; - private static final String currentPageText_ = ResourceLoader.getPrintText("CURRENT_PAGE") + ":"; - private static final String lastPageText_ = ResourceLoader.getPrintText("LAST_PAGE") + ":"; - private static final String formTypeText_ = ResourceLoader.getPrintText("FORM_TYPE") + ":"; - private static final String dateText_ = ResourceLoader.getPrintText("DATE_CREATED") + ":"; - private static final String jobText_ = ResourceLoader.getPrintText("JOB") + ":"; - private static final String userText_ = ResourceLoader.getPrintText("USER") + ":"; - private static final String jobNumberText_ = ResourceLoader.getPrintText("JOB_NUMBER") + ":"; - private static final String generalText_ = ResourceLoader.getPrintText("GENERAL"); - private static final String printerQueText_ = ResourceLoader.getPrintText("PRINTERQUEUE"); - private static final String copiesText_ = ResourceLoader.getPrintText("COPIES"); - private static final String pagesText_ = ResourceLoader.getPrintText("PAGES"); - private static final String formsText_ = ResourceLoader.getPrintText("FORMS"); - private static final String originText_ = ResourceLoader.getPrintText("ORIGIN"); - private static final String userCommentText_ = ResourceLoader.getPrintText("USER_COMMENT") + ":"; - private static final String notAssignedText_ = ResourceLoader.getPrintText("NOT_ASSIGNED"); - private static final String groupText_ = ResourceLoader.getPrintText("GROUP"); - -/** -Constructs an OutputPropertiesPane object. - -@param object The object. -@param splF The spooled file. -**/ - public OutputPropertiesPane (VOutput object, SpooledFile splF) - { - object_ = object; - splF_ = splF; - - // @A2A - try - { - int systemVRM = splF_.getSystem().getVRM(); - if (systemVRM < supportedVRM_) - { - functionSupported_ = false; - } - else - { - functionSupported_ = true; - } - } - catch (Exception e) - { - errorEventSupport_.fireError (e); - functionSupported_ = false; - } - } - -/** -catches the state change of text field -**/ - public void actionPerformed(ActionEvent e) - { - // notify that something has changed so the apply button is enabled - changeEventSupport_.fireStateChanged (); - } - - -/** -Adds a change listener. - -@param listener The listener. -**/ - public void addChangeListener (ChangeListener listener) - { - changeEventSupport_.addChangeListener (listener); - } - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - -/** -Adds a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - -/** -Applies the changes made by the user. - -@throws Exception -**/ - public void applyChanges () - throws Exception - { - // create a print parameter list to hold the attributes that were updated - PrintParameterList pList_ = new PrintParameterList(); - - //////////////// - // user data /// - //////////////// - - // get the previous value from the spooled file - String oldUserData = splF_.getStringAttribute(PrintObject.ATTR_USERDATA).trim(); - - // get the new value from the textfield - String newUserData = (String)userData_.getText().trim(); - - // compare the values to see if a change is needed, and set as necessary - if (!oldUserData.equals(newUserData)) pList_.setParameter(PrintObject.ATTR_USERDATA,newUserData); - - ////////////////////////// - // save after printing /// - ////////////////////////// - - // get the previous value from the spooled file - String oldSaveData = splF_.getStringAttribute(PrintObject.ATTR_SAVE); - - // get the new value from the combo box - String newSaveData = (String)saveBox_.getSelectedItem(); - - // change new value if necessary - if (newSaveData.equals(noText_)) newSaveData = "*NO"; - else if (newSaveData.equals(yesText_)) newSaveData = "*YES"; - - // compare the values to see if a change is needed, and set as necessary - if (!oldSaveData.equals(newSaveData)) pList_.setParameter(PrintObject.ATTR_SAVE,newSaveData); - - if (functionSupported_ == true) // @A2A - { - ////////////// - // printer /// - ////////////// - // get the previous value from the spooled file - String oldPrinter = splF_.getStringAttribute(PrintObject.ATTR_PRINTER).trim(); - - // get the new value from the textfield - String newPrinter = (String)(printer_.getText().trim()); - - // compare the values to see if a change is needed, and set as necessary - if ((!newPrinter.equals(notAssignedText_)) && (!oldPrinter.equals(newPrinter))) { - pList_.setParameter(PrintObject.ATTR_PRINTER,newPrinter); - } - - /////////////////// - // output queue /// - /////////////////// - - // extract the output queue path into an object that knows how to parse it. - QSYSObjectPathName outQPath = new QSYSObjectPathName(splF_.getStringAttribute(PrintObject.ATTR_OUTPUT_QUEUE)); - - // get the previous value from the spooled file - String oldOutQ = outQPath.getObjectName().trim(); - - // get the new value from the textfield - String newOutQ = (String)outQ_.getText().trim(); - - // flag to indicate a output queue change - boolean fNewOutQ = false; - - // compare the values to see if a change is needed, and set as necessary - if (!oldOutQ.equals(newOutQ)) - { - // create a QSYSObjectPathName object to represent the new output queue with the old outq library - QSYSObjectPathName newOutQPath = new QSYSObjectPathName(outQPath.getLibraryName(), newOutQ, "OUTQ"); - - // set the IFS output queue attribute - pList_.setParameter(PrintObject.ATTR_OUTPUT_QUEUE,newOutQPath.getPath()); - - // set the flag to say that we did have an output queuue change - fNewOutQ = true; - } - - /////////////////////////// - // output queue library /// - /////////////////////////// - - // get the previous value from the spooled file - String oldOutQLib = outQPath.getLibraryName().trim(); - - // get the new value from the textfield - String newOutQLib = (String)outQLib_.getText().trim(); - - // compare the values to see if a change is needed, and set as necessary - if (!oldOutQLib.equals(newOutQLib)) - { - QSYSObjectPathName newOutQPath; - - // check to see if we had a output queue name change also - if (fNewOutQ) - // create a QSYSObjectPathName object to represent the new output queue library and new output queue name - newOutQPath = new QSYSObjectPathName(newOutQLib, newOutQ, "OUTQ"); - else - // create a QSYSObjectPathName object to represent the new output queue library and old output queue name - newOutQPath = new QSYSObjectPathName(newOutQLib, oldOutQ, "OUTQ"); - - // set the IFS output queue attribute - pList_.setParameter(PrintObject.ATTR_OUTPUT_QUEUE,newOutQPath.getPath()); - } - } - - //////////////////////////// - // output queue priority /// - //////////////////////////// - - // get the previous value from the spooled file - String oldOutQPty = splF_.getStringAttribute(PrintObject.ATTR_OUTPTY); - - // get the new value from the combo box - String newOutQPty = (String)outQPtyBox_.getSelectedItem(); - - // check to see if user selected Job Value if so set priority to *JOB - if (newOutQPty.equals(jobValueText_)) newOutQPty = "*JOB"; - - // compare the values to see if a change is needed, and set as necessary - if (!oldOutQPty.equals(newOutQPty)) pList_.setParameter(PrintObject.ATTR_OUTPTY,newOutQPty); - - /////////////////// - // Total copies /// - /////////////////// - - // get the previous value from the spooled file - String oldTotalCopies = splF_.getIntegerAttribute(PrintObject.ATTR_COPIES).toString(); - - // get the new value from the textfield - String newTotalCopies = (String)totalCopies_.getText().trim(); - - // compare the values to see if a change is needed, and set as necessary - if (!oldTotalCopies.equals(newTotalCopies)) - pList_.setParameter(PrintObject.ATTR_COPIES,Integer.parseInt(newTotalCopies)); - - ////////////////// - // Copies left /// - ////////////////// - - // get the previous value from the spooled file - String oldCopiesLeft = splF_.getIntegerAttribute(PrintObject.ATTR_COPIESLEFT).toString(); - - // get the new value from the textfield - String newCopiesLeft = (String)copiesLeft_.getText().trim(); - - // compare the values to see if a change is needed, and set as necessary - if (!oldCopiesLeft.equals(newCopiesLeft)) - pList_.setParameter(PrintObject.ATTR_COPIESLEFT,Integer.parseInt(newCopiesLeft)); - - /////////////// - // Form type // - /////////////// - - // get the previous value from the spooled file - String oldFormType = splF_.getStringAttribute(PrintObject.ATTR_FORMTYPE).trim(); - - // get the new value from the textfield - String newFormType = (String)formType_.getText().trim(); - if (newFormType.equals(standardText_)) newFormType = "*STD"; - - // compare the values to see if a change is needed, and set as necessary - if (!oldFormType.equals(newFormType)) pList_.setParameter(PrintObject.ATTR_FORMTYPE,newFormType); - - - // fire started working event - workingEventSupport_.fireStartWorking(); - - ////////////////////////////////////////////////////// - // Set the requested attributes of the spooled file // - ////////////////////////////////////////////////////// - splF_.setAttributes(pList_); - - // fire stopped working event - workingEventSupport_.fireStopWorking(); - - // notify object that there have been changes - objectEventSupport_.fireObjectChanged(object_); - } - - -/** -Builds Copies pane for the properties pane -**/ - private JPanel buildCopiesPane() - { - JPanel thePane = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - thePane.setLayout (layout); - thePane.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - // Total copies - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (totalCopiesText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - totalCopies_ = new JTextField(splF_.getIntegerAttribute(PrintObject.ATTR_COPIES).toString()); - totalCopies_.addActionListener(this); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (totalCopies_, // @A1C - thePane, - layout, - constraints, - 1,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Copies left - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (copiesLeftText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - copiesLeft_ = new JTextField(splF_.getIntegerAttribute(PrintObject.ATTR_COPIESLEFT).toString()); - copiesLeft_.addActionListener(this); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (copiesLeft_, // @A1C - thePane, - layout, - constraints, - 1,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - } - catch (Exception e) - { - // thePane = null; @A4D - errorEventSupport_.fireError (e); - } - - return thePane; - } - - -/** -Builds General pane for the properties pane -**/ - private JPanel buildGeneralPane() - { - JPanel thePane = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - thePane.setLayout (layout); - thePane.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - // Spooled file name - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (outputNameText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (splF_.getName()), // @A1C - thePane, - layout, - constraints, - 1,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Spooled file number - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (numberText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (Integer.toString(splF_.getNumber())), // @A1C - thePane, - layout, - constraints, - 1,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Spooled file status - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (statusText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.WEST); - String status = splF_.getStringAttribute(PrintObject.ATTR_SPLFSTATUS); - String stat = null; - if (status.trim().equals("*CLOSED")) stat = statusClosedText_; - else if (status.trim().equals("*HELD")) stat = statusHeldText_; - else if (status.trim().equals("*MESSAGE")) stat = statusMsgWaitingText_; - else if (status.trim().equals("*OPEN")) stat = statusOpenText_; - else if (status.trim().equals("*PENDING")) stat = statusPendingText_; - else if (status.trim().equals("*PRINTER")) stat = statusPrinterText_; - else if (status.trim().equals("*READY")) stat = statusReadyText_; - else if (status.trim().equals("*SAVED")) stat = statusSavedText_; - else if (status.trim().equals("*WRITING")) stat = statusWritingText_; - else stat = " "; - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (stat), // @A1C - thePane, - layout, - constraints, - 1,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // User specified data - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (userSpecDataText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 3,1,1, - constraints.HORIZONTAL, - constraints.WEST); - userData_ = new JTextField(splF_.getStringAttribute(PrintObject.ATTR_USERDATA)); - userData_.addActionListener(this); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (userData_, // @A1C - thePane, - layout, - constraints, - 1,1,1, - 3,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // User comment - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (userCommentText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 4,1,1, - constraints.HORIZONTAL, - constraints.WEST); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (splF_.getStringAttribute(PrintObject.ATTR_USERCMT).trim()), // @A1C - thePane, - layout, - constraints, - 1,1,1, - 4,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Save after printing - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (saveText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 5,1,1, - constraints.HORIZONTAL, - constraints.WEST); - saveBox_ = new JComboBox(); - saveBox_.addItem(yesText_); - saveBox_.addItem(noText_); - - String curSave = splF_.getStringAttribute(PrintObject.ATTR_SAVE).trim(); - if (curSave.equals("*NO")) saveBox_.setSelectedItem(noText_); - else if (curSave.equals("*YES")) saveBox_.setSelectedItem(yesText_); - else saveBox_.setSelectedItem(curSave); - saveBox_.addItemListener(this); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (saveBox_, // @A1C - thePane, - layout, - constraints, - 1,1,1, - 5,1,1, - constraints.HORIZONTAL, - constraints.WEST); - } - catch (Exception e) - { - // thePane = null; @A4D - errorEventSupport_.fireError (e); - } - - return thePane; - } - - -/** -Builds Forms pane for the properties pane -**/ - private JPanel buildFormsPane() - { - JPanel thePane = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - thePane.setLayout (layout); - thePane.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - // Form type - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (formTypeText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - String formType = splF_.getStringAttribute(PrintObject.ATTR_FORMTYPE).trim(); - if (formType.equals("*STD")) formType_ = new JTextField(standardText_); - else formType_ = new JTextField(formType); - formType_.addActionListener(this); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (formType_, // @A1C - thePane, - layout, - constraints, - 1,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - } - catch (Exception e) - { - // thePane = null; @A4D - errorEventSupport_.fireError (e); - } - - return thePane; - } - - -/** -Builds Origin pane for the properties pane -**/ - private JPanel buildOriginPane() - { - JPanel thePane = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - thePane.setLayout (layout); - thePane.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - // Date created - - // get the date and time from spooled file - String date = splF_.getStringAttribute(PrintObject.ATTR_DATE); - String time = splF_.getStringAttribute(PrintObject.ATTR_TIME); - // @A3A - The code below used to substring (1,3) for the year, omitting - // the century field, and did not add 1900 to the result (base time). - // The code now substrings (0,3) and adds in 1900, thus - // producing the correct date. - calendar_.set((Integer.parseInt(date.substring(0,3)) + 1900),// year @A3C - Integer.parseInt(date.substring(3,5))-1,// month is zero based - Integer.parseInt(date.substring(5,7)), // day - Integer.parseInt(time.substring(0,2)), // hour - Integer.parseInt(time.substring(2,4)), // minute - Integer.parseInt(time.substring(4,6))); // second - Date newDate = calendar_.getTime(); - - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (dateText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (dateFormat_.format (newDate)), // @A1C - thePane, - layout, - constraints, - 1,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Job - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (jobText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (splF_.getStringAttribute(PrintObject.ATTR_JOBNAME)), // @A1C - thePane, - layout, - constraints, - 1,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // User - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (" " + userText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.WEST); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (splF_.getStringAttribute(PrintObject.ATTR_JOBUSER)), // @A1C - thePane, - layout, - constraints, - 1,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Job number - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (" " + jobNumberText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 3,1,1, - constraints.HORIZONTAL, - constraints.WEST); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (splF_.getStringAttribute(PrintObject.ATTR_JOBNUMBER)), // @A1C - thePane, - layout, - constraints, - 1,1,1, - 3,1,1, - constraints.HORIZONTAL, - constraints.WEST); - } - catch (Exception e) - { - // thePane = null; @A4D - errorEventSupport_.fireError (e); - } - - return thePane; - } - - -/** -Builds Pages pane for the properties pane -**/ - private JPanel buildPagesPane() - { - JPanel thePane = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - thePane.setLayout (layout); - thePane.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - // Pages per copy - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (pagesPerCopyText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (splF_.getIntegerAttribute(PrintObject.ATTR_PAGES).toString()), // @A1C - thePane, - layout, - constraints, - 1,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Current page - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (currentPageText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (splF_.getIntegerAttribute(PrintObject.ATTR_CURPAGE).toString()), // @A1C - thePane, - layout, - constraints, - 1,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Last page printed - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (lastPageText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.WEST); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (splF_.getIntegerAttribute(PrintObject.ATTR_LASTPAGE).toString()), // @A1C - thePane, - layout, - constraints, - 1,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.WEST); - } - catch (Exception e) - { - // thePane = null; @A4D - errorEventSupport_.fireError (e); - } - - - return thePane; - } - - -/** -Builds Printer/Queue pane for the properties pane -**/ - private JPanel buildPrinterQueuePane() - { - JPanel thePane = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - thePane.setLayout (layout); - thePane.setBorder (new EmptyBorder (10, 10, 10, 10)); - QSYSObjectPathName outQPath = new QSYSObjectPathName(); - - try - { - // Printer name - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (printerText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - if (functionSupported_ == true) // @A2A - { - String printer = splF_.getStringAttribute(PrintObject.ATTR_PRINTER).trim(); - String prtAssigned = splF_.getStringAttribute(PrintObject.ATTR_PRTASSIGNED).trim(); - // check to see if the spooled file is assigned to a printer or group of printers or not assigned - if (prtAssigned.equals("3")) printer_ = new JTextField(notAssignedText_); // not assigned - else if (prtAssigned.equals("2")) printer_ = new JTextField(groupText_); // group - else printer_ = new JTextField(printer); // a printer - printer_.addActionListener(this); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (printer_, // @A1C - thePane, - layout, - constraints, - 1,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - } - - // Output Queue name - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (outQText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - if (functionSupported_ == true) // @A2A - { - outQPath.setPath(splF_.getStringAttribute(PrintObject.ATTR_OUTPUT_QUEUE)); - outQ_ = new JTextField(outQPath.getObjectName()); - outQ_.addActionListener(this); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (outQ_, // @A1C - thePane, - layout, - constraints, - 1,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - } - - // Output Queue library name - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (outQLibText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.WEST); - if (functionSupported_ == true) // @A2A - { - outQLib_ = new JTextField(outQPath.getLibraryName()); - outQLib_.addActionListener(this); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (outQLib_, // @A1C - thePane, - layout, - constraints, - 1,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.WEST); - } - - // Output Queue Priority - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (outQPtyText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 3,1,1, - constraints.HORIZONTAL, - constraints.WEST); - outQPtyBox_ = new JComboBox(); - outQPtyBox_.setEditable(true); - String outqPty = splF_.getStringAttribute(PrintObject.ATTR_OUTPTY).trim(); - outQPtyBox_.addItem(jobValueText_); - // we need to check for *JOB special value which equals priority 0 - if (outqPty.equals("*JOB")) - { - outQPtyBox_.setSelectedItem(jobValueText_); - } - else - { - outQPtyBox_.addItem(outqPty); - outQPtyBox_.setSelectedItem(outqPty); - } - outQPtyBox_.addItemListener(this); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (outQPtyBox_, // @A1C - thePane, - layout, - constraints, - 1,1,1, - 3,1,1, - constraints.HORIZONTAL, - constraints.WEST); - } - catch (Exception e) - { - // thePane = null; @A4D - errorEventSupport_.fireError (e); - } - - - return thePane; - } - - -/** -Returns the properties pane. - -@return The properties pane. -@throws Exception If an error occurs. - **/ - public Component getComponent () - { - JTabbedPane tabbedPane = null; - tabbedPane = new JTabbedPane (); - tabbedPane.addTab (generalText_, null, buildGeneralPane()); - tabbedPane.setSelectedIndex (0); - tabbedPane.addTab (printerQueText_, null, buildPrinterQueuePane()); - tabbedPane.addTab (copiesText_, null, buildCopiesPane()); - tabbedPane.addTab (pagesText_, null, buildPagesPane()); - tabbedPane.addTab (formsText_, null, buildFormsPane()); - tabbedPane.addTab (originText_, null, buildOriginPane()); - return tabbedPane; - } - - -/** -catches the state change of combo boxes -**/ - public void itemStateChanged(ItemEvent e) - { - // notify that something has changed so the apply button is enabled - changeEventSupport_.fireStateChanged (); - } - - -/** -Removes a change listener. - -@param listener The listener. - -**/ - public void removeChangeListener (ChangeListener listener) - { - changeEventSupport_.removeChangeListener (listener); - } - -/** -Removes a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - -/** -Removes a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - -/** -Removes a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - -} // end OutputPropertiesPane class - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/OutputReleaseAction.java b/cvsroot/src/com/ibm/as400/vaccess/OutputReleaseAction.java deleted file mode 100644 index 416a40366..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/OutputReleaseAction.java +++ /dev/null @@ -1,91 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputReleaseAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.SpooledFile; -import com.ibm.as400.access.Trace; - -/** -The OutputReleaseAction class represents the releasing of a spooled file. -**/ -class OutputReleaseAction -extends AbstractVAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final String displayName_ = ResourceLoader.getText("ACTION_RELEASE"); - private SpooledFile splF_ = null; // the spooled file - -/** -Constructs an OutputReleaseAction object. - -@param object The object. -@param splF The spooled file. -**/ - public OutputReleaseAction (VObject object, SpooledFile splF) - { - super (object); - splF_ = splF; - } - - -/** -Returns the display name for the action. - -@return The display name. -**/ - public String getText () - { - return displayName_; - } - -/** -Performs the action. - -@param context The action context. -**/ - public void perform (VActionContext context) - { - try - { - // fire started working event - fireStartWorking(); - - // release the spooled file - splF_.release(); - - // fire stopped working event - fireStopWorking(); - - // trace the release - if (Trace.isTraceOn()) - Trace.log (Trace.INFORMATION, "Released file [" - + splF_.getName () + "]."); - - fireObjectChanged (); - } // end try block - catch (Exception e) - { - // trace the error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR releasing file [" + splF_.getName () + "]."); - - fireError (e); - } - } - -} // end OutputReleaseAction class - diff --git a/cvsroot/src/com/ibm/as400/vaccess/OutputReplyAction.java b/cvsroot/src/com/ibm/as400/vaccess/OutputReplyAction.java deleted file mode 100644 index 21303a392..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/OutputReplyAction.java +++ /dev/null @@ -1,183 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputReplyAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.SpooledFile; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.PrintObject; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JComboBox; -import javax.swing.JTextField; -import javax.swing.JTextArea; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.text.DateFormat; -import java.util.Date; - - -/** -The OutputReplyAction class represents the action of replying to a spooled file -that has a message waiting status. -**/ -class OutputReplyAction -extends DialogAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final String displayName_ = ResourceLoader.getText("ACTION_REPLY"); - private static final String replyText_ = ResourceLoader.getPrintText("REPLY") + ":"; - private static final String messageIDText_ = ResourceLoader.getPrintText("MESSAGE_ID") + ":"; - private static final String dateSentText_ = ResourceLoader.getPrintText("DATE_SENT") + ":"; - private static final String messageText_ = ResourceLoader.getPrintText("MESSAGE") + ":"; - private static final String messageHelpText_ = ResourceLoader.getPrintText("MESSAGE_HELP") + ":"; - - private static DateFormat dateFormat_ = DateFormat.getDateTimeInstance (); - - private SpooledFile splF_ = null; // spooled file - private AS400Message msg_ = null; // message to reply to - private JTextField replyField_ = null; // reply - - -/** -Constructs an OutputReplyAction object. - -@param object The object. -@param splF The spooled file. -**/ - public OutputReplyAction (VObject object, SpooledFile splF) - { - super (object); - splF_ = splF; - } - - -/** -Returns the component for the dialog box. - -@return The component. -**/ - public JComponent getInputComponent() - { - JPanel panel = new JPanel(); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - panel.setLayout (layout); - panel.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - // retrieve the message that is waiting and it's various replies - msg_ = splF_.getMessage(); - - // message ID - VUtilities.constrain( new JLabel(messageIDText_), panel, layout, 0,0,1,1); - VUtilities.constrain( new JLabel(msg_.getID().trim()), panel, layout, 1,0,1,1); - - // message date - VUtilities.constrain( new JLabel(dateSentText_), panel, layout, 0,2,1,1); - Date newDate = msg_.getDate().getTime(); - VUtilities.constrain( new JLabel (dateFormat_.format(newDate)), panel, layout, 1,2,1,1); - - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 3, 2, 1); - - // message - VUtilities.constrain( new JLabel(messageText_), panel, layout, 0,4,1,1); - VUtilities.constrain( new JLabel(msg_.getText().trim()), panel, layout, 1,4,1,1); - - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 5, 2, 1); - - // message help - String msgHelp = msg_.getHelp().trim(); - if (msgHelp != null) - { - VUtilities.constrain( new JLabel(messageHelpText_), panel, layout, 0,6,1,1); -//@B0D JTextArea helpText = new JTextArea(VUtilities.formatHelp(msgHelp,80)); - JTextArea helpText = new JTextArea(msgHelp); //@B0A - helpText.setEditable(false); - helpText.setColumns(80); //@B1C - helpText.setLineWrap(true); //@B0A - helpText.setWrapStyleWord(true); //@B0A - VUtilities.constrain (helpText, panel, layout, 1,6,1,1); - } - - // reply - VUtilities.constrain( new JLabel(replyText_), panel, layout, 0,7,1,1); - replyField_ = new JTextField(msg_.getDefaultReply().trim()); - replyField_.setEditable(true); - VUtilities.constrain( replyField_, panel, layout, 1,7,1,1); - } - catch (Exception e) - { - panel = null; - fireError (e); - } - - return panel; - } - - -/** -Returns the display name for the action. - -@return The display name. -**/ - public String getText () - { - return displayName_; - } - -/** -Performs the action. -**/ - public void perform2 () - { - try - { - // retrieve the reply - String reply = (String)replyField_.getText().trim(); - - // fire started working event - fireStartWorking(); - - // reply to the spooled file - splF_.answerMessage(reply); - - // fire stopped working event - fireStopWorking(); - - // trace the reply - if (Trace.isTraceOn()) - Trace.log (Trace.INFORMATION, "Replied to file [" - + splF_.getName () + "]."); - - fireObjectChanged (); - } // end try block - catch (Exception e) - { - // trace the error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR repling to file [" + splF_.getName () + "]."); - - fireError (e); - } - } - -} // end OutputReplyAction class - diff --git a/cvsroot/src/com/ibm/as400/vaccess/OutputSendAction.java b/cvsroot/src/com/ibm/as400/vaccess/OutputSendAction.java deleted file mode 100644 index c708e7207..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/OutputSendAction.java +++ /dev/null @@ -1,245 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputSendAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.SpooledFile; -import com.ibm.as400.access.PrintObject; -import com.ibm.as400.access.PrintParameterList; -import com.ibm.as400.access.Trace; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import com.ibm.as400.access.SpooledFile; -import javax.swing.JTextField; -import javax.swing.JComponent; -import javax.swing.JComboBox; -import javax.swing.JRadioButton; -import javax.swing.ButtonGroup; -import javax.swing.SwingConstants; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; - -/** -The OutputSendAction class represents the action of sending a spooled file. -**/ -class OutputSendAction -extends DialogAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final String displayName_ = ResourceLoader.getText("ACTION_SEND"); - private static final String prtOutToSendText_ = ResourceLoader.getPrintText("PRINTER_OUTPUT_TO_SEND") + ":"; - private static final String sendOutputText_ = ResourceLoader.getPrintText("SEND_TO") + ":"; - private static final String userNameText_ = ResourceLoader.getPrintText("USER_NAME"); - private static final String systemNameText_ = ResourceLoader.getPrintText("SYSTEM_NAME"); - private static final String recordFormatText_ = ResourceLoader.getPrintText("RECORD_FORMAT") + ":"; - private static final String recordDataOnlyText_ = ResourceLoader.getPrintText("RECORD_DATA"); - private static final String allDataText_ = ResourceLoader.getPrintText("ALL_DATA"); - private static final String vmClassText_ = ResourceLoader.getPrintText("VM_MVS_CLASS"); - private static final String sendPriorityText_ = ResourceLoader.getPrintText("SEND_PRIORITY") + ":"; - private static final String normalPriorityText_ = ResourceLoader.getPrintText("NORMAL_PRIORITY"); - private static final String highPriorityText_ = ResourceLoader.getPrintText("HIGH_PRIORITY"); - - private SpooledFile splF_ = null; // the spooled file - private JTextField userNameField_ = null; // user name - private JTextField systemNameField_ = null; // system name - private JRadioButton recordDataButton_ = null; // record data only - private JRadioButton allDataButton_ = null; // all data - private JComboBox vmClassBox_ = null; // VM/MVX class - private JRadioButton normalPriorityButton_ = null; // normal priority - private JRadioButton highPriorityButton_ = null; // high priority - -/** -Constructs an OutputSendAction object. - -@param object The object. -@param splF The spooled file. -**/ - public OutputSendAction (VObject object, SpooledFile splF) - { - super (object); - splF_ = splF; - } - - -/** -Returns the component for the dialog box. - -@return The component. -**/ - public JComponent getInputComponent() - { - JPanel panel = new JPanel(); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - panel.setLayout (layout); - panel.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - // build components to display the output to be moved - VUtilities.constrain( new JLabel(prtOutToSendText_), panel, layout, 0,0,1,1); - - JTextField text = new JTextField(getObject().toString()); - text.setEditable(false); - VUtilities.constrain( text, panel, layout, 0,1,1,1); - - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 2, 2, 1); - - // build components to ask user for send input - VUtilities.constrain( new JLabel(sendOutputText_), panel, layout, 0,3,1,1); - - // request the user name - VUtilities.constrain( new JLabel(userNameText_), panel, layout, 0,4,1,1); - userNameField_ = new JTextField(10); - VUtilities.constrain( userNameField_, panel, layout, 1,4,1,1); - - // request the system name - VUtilities.constrain( new JLabel(systemNameText_), panel, layout, 0,5,1,1); - systemNameField_ = new JTextField(10); - VUtilities.constrain( systemNameField_, panel, layout, 1,5,1,1); - - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 6, 2, 1); - - // request the record format - VUtilities.constrain( new JLabel(recordFormatText_), panel, layout, 0,7,1,1); - recordDataButton_ = new JRadioButton(recordDataOnlyText_); - recordDataButton_.setHorizontalAlignment(SwingConstants.LEFT); - allDataButton_ = new JRadioButton(allDataText_); - allDataButton_.setHorizontalAlignment(SwingConstants.LEFT); - allDataButton_.setSelected(true); - - // group the buttons so that only one can be on at a time - ButtonGroup group = new ButtonGroup(); - group.add(recordDataButton_); - group.add(allDataButton_); - - VUtilities.constrain( recordDataButton_, panel, layout, 0,8,1,1); - VUtilities.constrain( allDataButton_, panel, layout, 0,9,1,1); - - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 10, 2, 1); - - // request the VM/MVS class - VUtilities.constrain( new JLabel(vmClassText_), panel, layout, 0,11,1,1); - vmClassBox_ = new JComboBox(); - vmClassBox_.setEditable(false); - vmClassBox_.addItem("A"); vmClassBox_.addItem("B"); vmClassBox_.addItem("C"); - vmClassBox_.addItem("D"); vmClassBox_.addItem("E"); vmClassBox_.addItem("F"); - vmClassBox_.addItem("G"); vmClassBox_.addItem("H"); vmClassBox_.addItem("I"); - vmClassBox_.addItem("J"); vmClassBox_.addItem("K"); vmClassBox_.addItem("L"); - vmClassBox_.addItem("M"); vmClassBox_.addItem("N"); vmClassBox_.addItem("O"); - vmClassBox_.addItem("P"); vmClassBox_.addItem("Q"); vmClassBox_.addItem("R"); - vmClassBox_.addItem("S"); vmClassBox_.addItem("T"); vmClassBox_.addItem("U"); - vmClassBox_.addItem("V"); vmClassBox_.addItem("W"); vmClassBox_.addItem("X"); - vmClassBox_.addItem("Y"); vmClassBox_.addItem("Z"); vmClassBox_.addItem("0"); - vmClassBox_.addItem("1"); vmClassBox_.addItem("2"); vmClassBox_.addItem("3"); - vmClassBox_.addItem("4"); vmClassBox_.addItem("5"); vmClassBox_.addItem("6"); - vmClassBox_.addItem("7"); vmClassBox_.addItem("8"); vmClassBox_.addItem("9"); - vmClassBox_.setSelectedItem("A"); - VUtilities.constrain( vmClassBox_, panel, layout, 1,11,1,1); - - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 12, 2, 1); - - // request the send priority - VUtilities.constrain( new JLabel(sendPriorityText_), panel, layout, 0,13,1,1); - normalPriorityButton_ = new JRadioButton(normalPriorityText_); - normalPriorityButton_.setHorizontalAlignment(SwingConstants.LEFT); - normalPriorityButton_.setSelected(true); - highPriorityButton_ = new JRadioButton(highPriorityText_); - highPriorityButton_.setHorizontalAlignment(SwingConstants.LEFT); - - // group the buttons so that only one can be on at a time - ButtonGroup groupA = new ButtonGroup(); - groupA.add(normalPriorityButton_); - groupA.add(highPriorityButton_); - - VUtilities.constrain( normalPriorityButton_, panel, layout, 0,14,1,1); - VUtilities.constrain( highPriorityButton_, panel, layout, 0,15,1,1); - } - catch (Exception e) - { - panel = null; - fireError (e); - } - - return panel; - } - - -/** -Returns the display name for the action. - -@return The display name. -**/ - public String getText () - { - return displayName_; - } - -/** -Performs the action. -**/ - public void perform2 () - { - try - { - // create a print parm list to hold the information we need to send - PrintParameterList pList = new PrintParameterList(); - - // set the user name - pList.setParameter(PrintObject.ATTR_TOUSERID, userNameField_.getText().trim()); - - // set the system name - pList.setParameter(PrintObject.ATTR_TOADDRESS, systemNameField_.getText().trim()); - - // retrieve the record format - if (recordDataButton_.isSelected()) pList.setParameter(PrintObject.ATTR_DATAFORMAT, "*RCDDATA"); - else pList.setParameter(PrintObject.ATTR_DATAFORMAT, "*ALLDATA"); - - // retrieve the vm/mvs class - pList.setParameter(PrintObject.ATTR_VMMVSCLASS, (String)vmClassBox_.getSelectedItem()); - - // retrieve the send priority - if (normalPriorityButton_.isSelected()) pList.setParameter(PrintObject.ATTR_SENDPTY, "*NORMAL"); - else pList.setParameter(PrintObject.ATTR_SENDPTY, "*HIGH"); - - // fire started working event - fireStartWorking(); - - // send the spooled file - splF_.sendNet(pList); - - // fire stopped working event - fireStopWorking(); - - // trace the send - if (Trace.isTraceOn()) - Trace.log (Trace.INFORMATION, "Sent file [" + splF_.getName () + "]."); - - fireObjectChanged (); - } // end try block - catch (Exception e) - { - // trace the error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR Sending file [" + splF_.getName () + "]."); - - fireError (e); - } - } - -} // end OutputSendAction class - diff --git a/cvsroot/src/com/ibm/as400/vaccess/OutputViewAction.java b/cvsroot/src/com/ibm/as400/vaccess/OutputViewAction.java deleted file mode 100644 index 2f6a8c0a9..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/OutputViewAction.java +++ /dev/null @@ -1,665 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: OutputViewAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.SpooledFile; -import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JLabel; -import javax.swing.JFrame; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.FlowLayout; -import java.awt.Rectangle; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; - - -/** -The OutputViewAction class represents the action -of viewing a spooled file. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    OutputViewAction objects generate the following events: -

      -
    • ErrorEvent -
    • WorkingEvent -
    -**/ - - -class OutputViewAction -implements VAction, ActionListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // MRI. - private static final String actualSizeText_ = ResourceLoader.getText("MENU_ACTUAL_SIZE"); - private static final String cancelText_ = ResourceLoader.getText("DLG_CANCEL"); - private static final String exitConfirmText_ = ResourceLoader.getText("DLG_CONFIRM_EXIT"); - private static final String exitConfirmTitle_ = ResourceLoader.getText("DLG_CONFIRM_EXIT_TITLE"); - private static final String exitText_ = ResourceLoader.getText("MENU_EXIT"); - private static final String fidelityText_ = ResourceLoader.getPrintText("VIEWING_FIDELITY"); - private static final String fileText_ = ResourceLoader.getText("MENU_FILE"); - private static final String firstPageText_ = ResourceLoader.getText("MENU_FIRST_PAGE"); - private static final String fitPageText_ = ResourceLoader.getText("MENU_FIT_PAGE"); - private static final String fitWidthText_ = ResourceLoader.getText("MENU_FIT_WIDTH"); - private static final String flashPageText_ = ResourceLoader.getText("MENU_FLASH_PAGE"); - private static final String goToText_ = ResourceLoader.getText("MENU_GO_TO_PAGE"); - private static final String hideStatusBarText_ = ResourceLoader.getText("MENU_HIDE_STATUS_BAR"); - private static final String hideToolBarText_ = ResourceLoader.getText("MENU_HIDE_TOOL_BAR"); - private static final String lastPageText_ = ResourceLoader.getText("MENU_LAST_PAGE"); - private static final String nextPageText_ = ResourceLoader.getText("MENU_NEXT_PAGE"); - private static final String okText_ = ResourceLoader.getText("DLG_OK"); - private static final String optionsText_ = ResourceLoader.getText("MENU_OPTIONS"); - private static final String paperSizeText_ = ResourceLoader.getPrintText("PAPER_SIZE"); - private static final String prevPageText_ = ResourceLoader.getText("MENU_PREVIOUS_PAGE"); - private static final String showStatusBarText_ = ResourceLoader.getText("MENU_SHOW_STATUS_BAR"); - private static final String showToolBarText_ = ResourceLoader.getText("MENU_SHOW_TOOL_BAR"); - private static final String viewActionText_ = ResourceLoader.getText("ACTION_VIEW"); - private static final String viewText_ = ResourceLoader.getText("MENU_VIEW"); - private static final String zoomText_ = ResourceLoader.getText("MENU_ZOOM"); - private static final Icon SPLFVIcon = ResourceLoader.getIcon("SpooledFileViewer16.gif"); - - - // Private data. - private int currentPageNumber_ = 0; // current page - private boolean enabled_ = true; // action enabled? - private JFrame frame_ = null; // OutputViewAction frame - private int numberOfPages_ = 0; // total number of pages - private boolean numberOfPagesEst_ = false;// is numberOfPages valid? - private SpooledFile spooledFile_ = null; // the spooled file - private SpooledFileViewer spooledFileViewer_ = null; // the spooled file viewer - - - // Specialized menu items. - private JMenuItem firstPageMI_ = null; // first page menu item - private JMenuItem lastPageMI_ = null; // last page menu item - private JMenuItem nextPageMI_ = null; // next page menu item - private JMenuItem prevPageMI_ = null; // previous page menu item - private JMenuItem statusBarMI_ = null; // status bar menu item - private JMenuItem toolBarMI_ = null; // tool bar menu item - - - // Event support. - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport(this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport(this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport(this); - - - -/** -Constructs an OutputViewAction object. - -@param object The object. -@param spooledFile The spooled file to view. -**/ - public OutputViewAction(VObject object, SpooledFile spooledFile) { - - // store spooled file - if (spooledFile == null) { - throw new NullPointerException("spooledFile"); - } - else { - spooledFile_ = spooledFile; - } - } - - - -/** -Process the action event specified by action. - -@param action The ActionEvent to process. -**/ - public void actionPerformed(ActionEvent action) { - - // retrieve action command - String command = action.getActionCommand(); - - try { - // perform requested action - if (command.equals("actualSize")) { // set page view to actual size - spooledFileViewer_.actualSize(); - } - else if (command.equals("fitWidth")) { // set page view to width of frame - spooledFileViewer_.fitWidth(); - } - else if (command.equals("fitPage")) { // set page view so page fits in frame - spooledFileViewer_.fitPage(); - } - else if (command.equals("zoom")) { // set page view to arbitrary zoom value - spooledFileViewer_.changeZoom(); - } - else if (command.equals("firstPage")) { // set view to first page - spooledFileViewer_.setCurrentPage(1); - spooledFileViewer_.loadPage(); - } - else if (command.equals("prevPage")) { // set view to previous page - spooledFileViewer_.pageBack(); - } - else if (command.equals("nextPage")) { // set view to next page - spooledFileViewer_.pageForward(); - } - else if (command.equals("lastPage")) { // set view to last page - spooledFileViewer_.setCurrentPage(numberOfPages_); - spooledFileViewer_.loadPage(); - } - else if (command.equals("goToPage")) { // set view to specific page - spooledFileViewer_.changeCurrentPage(); - } - else if (command.equals("flashPage")) { // set view to previously viewed page - spooledFileViewer_.loadFlashPage(); - } - else if (command.equals("hideToolBar")) { // hide the tool bar - spooledFileViewer_.removeToolBar(); - toolBarMI_.setText(showToolBarText_); - toolBarMI_.setActionCommand("showToolBar"); - frame_.setVisible(true); - } - else if (command.equals("showToolBar")) { // show the tool bar - spooledFileViewer_.addToolBar(); - toolBarMI_.setText(hideToolBarText_); - toolBarMI_.setActionCommand("hideToolBar"); - frame_.setVisible(true); - } - else if (command.equals("hideStatusBar")) { // hide the status bar - spooledFileViewer_.removeStatusBar(); - statusBarMI_.setText(showStatusBarText_); - statusBarMI_.setActionCommand("showStatusBar"); - frame_.setVisible(true); - } - else if (command.equals("showStatusBar")) { // show the status bar - spooledFileViewer_.addStatusBar(); - statusBarMI_.setText(hideStatusBarText_); - statusBarMI_.setActionCommand("hideStatusBar"); - frame_.setVisible(true); - } - else if (command.equals("paperSize")) { // select/change pagesize - spooledFileViewer_.changePaperSize(); - } - else if (command.equals("viewingFidelity")) { // select/change viewing fidelity - spooledFileViewer_.changeViewingFidelity(); - } - else if (command.equals("exit")) { // exit the OutputViewAction - Object[] options = { okText_, cancelText_ }; - int exitOpt = JOptionPane.showOptionDialog(frame_, exitConfirmText_, - exitConfirmTitle_, JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, - null, options, options[0]); - if (exitOpt == 0) { - frame_.setVisible(false); - spooledFileViewer_.close(); - frame_.dispose(); - } - } - - } - catch (Exception e) { // if the SpooledFileViewer object throws an error. - errorEventSupport_.fireError(e); - } - } - - - -/** -Adds an ErrorListener. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a VObjectListener. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a WorkingListener. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Creates the menu bar. - -@return A menu bar -**/ - private JMenuBar createMenuBar() { - - JMenu menu; - JMenuItem menuItem; - - // create an instance of a menuBar - JMenuBar menuBar = new JMenuBar(); - - // create 'File' menu - menu = new JMenu(fileText_); - - // create 'Exit' menu item and add it to the menu - menuItem = new JMenuItem(exitText_); - menuItem.addActionListener(this); - menuItem.setActionCommand("exit"); - menuItem.setEnabled(true); - menu.add(menuItem); - - // add 'File' menu to menu bar - menuBar.add(menu); - - // create 'View' menu - menu = new JMenu(viewText_); - - // create 'Actual Size' menu item and add it to the menu - menuItem = new JMenuItem(actualSizeText_); - menuItem.addActionListener(this); - menuItem.setActionCommand("actualSize"); - menuItem.setEnabled(true); - menu.add(menuItem); - - // create 'Fit Width' menu item and add it to the menu - menuItem = new JMenuItem(fitWidthText_); - menuItem.addActionListener(this); - menuItem.setActionCommand("fitWidth"); - menuItem.setEnabled(true); - menu.add(menuItem); - - // create 'Fit Page' menu item and add it to the menu - menuItem = new JMenuItem(fitPageText_); - menuItem.addActionListener(this); - menuItem.setActionCommand("fitPage"); - menuItem.setEnabled(true); - menu.add(menuItem); - - // create 'Zoom' menu item and add it to the menu - menuItem = new JMenuItem(zoomText_); - menuItem.addActionListener(this); - menuItem.setActionCommand("zoom"); - menuItem.setEnabled(true); - menu.add(menuItem); - - menu.addSeparator(); - - // create 'First Page' menu item and add it to the menu - firstPageMI_= new JMenuItem(firstPageText_); - firstPageMI_.addActionListener(this); - firstPageMI_.setActionCommand("firstPage"); - menu.add(firstPageMI_); - - // create 'Previous Page' menu item and add it to the menu - prevPageMI_ = new JMenuItem(prevPageText_); - prevPageMI_.addActionListener(this); - prevPageMI_.setActionCommand("prevPage"); - menu.add(prevPageMI_); - - // create 'Next Page' menu item and add it to the menu - nextPageMI_ = new JMenuItem(nextPageText_); - nextPageMI_.addActionListener(this); - nextPageMI_.setActionCommand("nextPage"); - menu.add(nextPageMI_); - - // create 'Last Page' menu item and add it to the menu - lastPageMI_ = new JMenuItem(lastPageText_); - lastPageMI_.addActionListener(this); - lastPageMI_.setActionCommand("lastPage"); - menu.add(lastPageMI_); - - menu.addSeparator(); - - // create 'Go To Page' menu item and add it to the menu - menuItem = new JMenuItem(goToText_); - menuItem.addActionListener(this); - menuItem.setActionCommand("goToPage"); - menuItem.setEnabled(true); - menu.add(menuItem); - - // create 'Flash Page' menu item and add it to the menu - menuItem = new JMenuItem(flashPageText_); - menuItem.addActionListener(this); - menuItem.setActionCommand("flashPage"); - menuItem.setEnabled(true); - menu.add(menuItem); - - // add the 'View' menu to the menu bar - menuBar.add(menu); - - // create 'Options' menu - menu = new JMenu(optionsText_); - - // create 'ToolBar' menu item, initializing text - // to read 'Hide Toolbar', and add it to the menu - toolBarMI_ = new JMenuItem(hideToolBarText_); - toolBarMI_.addActionListener(this); - toolBarMI_.setActionCommand("hideToolBar"); - toolBarMI_.setEnabled(true); - menu.add(toolBarMI_); - - // create 'StatusBar' menu item, initializing text - // to read 'Hide Status Bar', and add it to the menu - statusBarMI_ = new JMenuItem(hideStatusBarText_); - statusBarMI_.addActionListener(this); - statusBarMI_.setActionCommand("hideStatusBar"); - statusBarMI_.setEnabled(true); - menu.add(statusBarMI_); - - menu.addSeparator(); - - // create 'Paper Size' menu item and add it to the menu - menuItem = new JMenuItem(paperSizeText_); - menuItem.addActionListener(this); - menuItem.setActionCommand("paperSize"); - menuItem.setEnabled(true); - menu.add(menuItem); - - // create 'Viewing Fidelity' menu item and add it to the menu - menuItem = new JMenuItem(fidelityText_); - menuItem.addActionListener(this); - menuItem.setActionCommand("viewingFidelity"); - menuItem.setEnabled(true); - menu.add(menuItem); - - // add 'Options' menu to menu bar - menuBar.add(menu); - - // invoke updateMenu, which determines what menu items to enable/not enable - updateMenu(); - - // return the menu bar - return menuBar; - } - - - -/** -Returns the text for this action. - -@return The text for the action. -**/ - public String getText() - { - return viewActionText_; - } - - - -/** -Indicates if the action is enabled. - -@return true if the action is enabled, false otherwise. -**/ - public boolean isEnabled () - { - return enabled_; - } - - - -/** -Invokes the method to perform the action of viewing a spooled file. - -@param actionContext The action context. -**/ - public void perform (VActionContext actionContext) - { - try { - // fire start working event - workingEventSupport_.fireStartWorking(); - - // create an instance of a SpooledFileViewer - spooledFileViewer_ = new SpooledFileViewer(spooledFile_, 1); - - // create local error listener - SFVErrorListener_ errListener = new SFVErrorListener_(); - - // add listeners - spooledFileViewer_.addErrorListener (errListener); - spooledFileViewer_.addWorkingListener(workingEventSupport_); - spooledFileViewer_.addErrorListener(errorEventSupport_); - - // load the data - spooledFileViewer_.load(); - - // if (errListener.lastEvent.getException() instanceof IOException - if (errListener.lastEvent_ == null) { - // create and add property change listener - // (This is required for notification of when the viewer has changed - // its page view, number of pages, or pages estimated value.) - SFVPropertyListener_ propListener = new SFVPropertyListener_(); - spooledFileViewer_.addPropertyChangeListener(propListener); - - // update monitored property variables - currentPageNumber_ = spooledFileViewer_.getCurrentPage(); - numberOfPages_ = spooledFileViewer_.getNumberOfPages(); - numberOfPagesEst_ = spooledFileViewer_.isNumberOfPagesEstimated(); - - // create the frame to put the SpooledFileViewer in - frame_ = new JFrame(spooledFile_.getName()); - frame_.addWindowListener(new WindowListener_()); - if (SPLFVIcon != null) { // @A1A - frame_.setIconImage(((ImageIcon)(SPLFVIcon)).getImage()); - } // @A1A - - // create and set the menu bar - frame_.setJMenuBar(createMenuBar()); - - // add the spooled file viewer to the content pane - frame_.getContentPane().add(spooledFileViewer_); - - // pack and show the frame - frame_.pack(); - frame_.setLocation(50, 50); - frame_.setVisible(true); - } - } - catch (Exception e) { - errorEventSupport_.fireError(e); - } - finally { - // fire stop working event - workingEventSupport_.fireStopWorking(); - } - } - - - -/** -Removes an ErrorListener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a WorkingListener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Sets the enabled state of the action. - -@param enabled true if the action is enabled, false otherwise. -**/ - public void setEnabled(boolean enable) - { - enabled_ = enable; - } - - - -/** -Performs the action of updating (enabling/disabling) the menu items. -**/ - private synchronized void updateMenu() - { - // enabled/disable 'first' and 'previous' page buttons - if (currentPageNumber_ > 1) { // not on first page - firstPageMI_.setEnabled(true); - prevPageMI_.setEnabled(true); - } - else { - firstPageMI_.setEnabled(false); - prevPageMI_.setEnabled(false); - } - - // enable/disable 'next' and 'last' page buttons - - // All spooled files have a 'number of pages' attribute. However, - // for some spooled files, this value is an 'estimated' quantity. - // Another attribute associated with the spooled file allows us - // to know whether this total 'number of pages' is real or estimated. - // We have stored that attribute value in numberOfPagesEst_. - if (numberOfPagesEst_ == false) { - if (currentPageNumber_ < numberOfPages_) { // not on last page - nextPageMI_.setEnabled(true); - lastPageMI_.setEnabled(true); - } - else { - nextPageMI_.setEnabled(false); - lastPageMI_.setEnabled(false); - } - } - else { - nextPageMI_.setEnabled(true); - lastPageMI_.setEnabled(false); - } - } - - - -/*************************************************************************/ - - - -/** -The WindowListener_ class processes window events. -**/ - private class WindowListener_ extends WindowAdapter { - - public void windowClosing (WindowEvent event) - { - frame_.setVisible(false); - spooledFileViewer_.close(); - frame_.dispose(); - } - - } - - - -/*************************************************************************/ - - - -/** -The SFVErrorListener_ class listens for error events. -**/ - private class SFVErrorListener_ implements ErrorListener { - - public ErrorEvent lastEvent_ = null; - public void errorOccurred (ErrorEvent event) - { - lastEvent_ = event; - } - } - - - -/*************************************************************************/ - - - -/** -The SFVPropertyListener class processes property changes by implementing a -PropertyChangeListener. -**/ - private class SFVPropertyListener_ implements PropertyChangeListener { - - public void propertyChange(PropertyChangeEvent event) - { - String changedProperty = event.getPropertyName(); - - if (changedProperty.equals("currentPage")) { - currentPageNumber_ = spooledFileViewer_.getCurrentPage(); - updateMenu(); - } - else if (changedProperty.equals("numberOfPages")) { - numberOfPages_ = spooledFileViewer_.getNumberOfPages(); - updateMenu(); - } - else if (changedProperty.equals("numberOfPagesEstimated")) { - numberOfPagesEst_ = spooledFileViewer_.isNumberOfPagesEstimated(); - updateMenu(); - } - else if (changedProperty.equals("spooledFile")) { - spooledFile_ = spooledFileViewer_.getSpooledFile(); - } - } - - } - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/PaperIcon.gif b/cvsroot/src/com/ibm/as400/vaccess/PaperIcon.gif deleted file mode 100644 index 5c21a69cd..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/PaperIcon.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/PermissionAction.java b/cvsroot/src/com/ibm/as400/vaccess/PermissionAction.java deleted file mode 100644 index 570f839ca..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/PermissionAction.java +++ /dev/null @@ -1,188 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PermissionAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.IFSFile; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.Permission; - -/** -The PermissionAction class defines a permission change action to be performed on a server resource. - -Most errors are reported as ErrorEvents rather than throwing exceptions. Users should listen for ErrorEvents in -order to diagnose and recover from error conditions. - -

    PermissionAction objects generate the following events: -

      -
    • ErrorEvent -
    • VObjectEvent -
    • WorkingEvent -
    -**/ -class PermissionAction - implements VAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - /** - * Private variable representing whether the item is enabled on the popup menu. - **/ - private boolean enabled_; - - /** - * Private variable representing object whose permission will be displayed - * and modified. - **/ - private IFSFile file_; - - /** - * Private variable representing event support. - **/ - private ErrorEventSupport errorEventSupport_= new ErrorEventSupport(this); - private VObjectEventSupport objectEventSupport_= new VObjectEventSupport(this); - private WorkingEventSupport workingEventSupport_= new WorkingEventSupport(this); - - // The Permission object for this action. - // @B1D private Permission permission_ = null; //@A2C - - /** - * Constructs a PermissionAction object. - * @param file The IFSFile object. - **/ - public PermissionAction(IFSFile file) - { - enabled_= true; - file_= file; - - // Postpone initializing the Permission object until it's needed. //@A2C - } - - /** - * Adds a listener to be notified when an error occurs. - * @param listener The listener. - **/ - public void addErrorListener(ErrorListener listener) - { - errorEventSupport_.addErrorListener(listener); - } - - /** - * Adds a VObjectListener. - * @param listener The listener. - **/ - public void addVObjectListener(VObjectListener listener) - { - objectEventSupport_.addVObjectListener(listener); - } - - /** - * Adds a working listener. - * @param listener The listener. - **/ - - public void addWorkingListener(WorkingListener listener) - { - workingEventSupport_.addWorkingListener(listener); - } - - //@A2A - /** - * Returns the Permission object. - * @return The Permission object. - **/ - Permission getPermission() - { - // @B1D if (permission_ == null) { - try { - return new Permission (file_); // @B1C - } - catch(Exception e) - { - Trace.log(Trace.ERROR, "construct Permission : "+e); - errorEventSupport_.fireError(e); - return null; // @B1A - } - // @B1D } - // @B1D return permission_; - } - - /** - * Returns the text. - * @return The text that displays as an item in the popup menu . - **/ - public String getText() - { - return ResourceLoader.getText("OBJECT_PERMISSION2"); // @C1C - } - - /** - * Indicates if the action is enabled. - * @return True if the action is enabled. - **/ - public boolean isEnabled() - { - return enabled_; - } - - /** - * Performs the action. - * @param vAction The action context. - **/ - public void perform(VActionContext vAction) - { - workingEventSupport_.fireStartWorking(); - PermissionMainPanel mainPanel = new PermissionMainPanel(getPermission()); //@A2C - mainPanel.addErrorListener(errorEventSupport_); - mainPanel.addWorkingListener(workingEventSupport_); - mainPanel.addVObjectListener(objectEventSupport_); - mainPanel.createPermissionMainPanel(); - workingEventSupport_.fireStopWorking(); - } - - /** - * Removes an error listener. - * @param listener The listener. - **/ - public void removeErrorListener(ErrorListener listener) - { - errorEventSupport_.removeErrorListener(listener); - } - - /** - * Removes a VObjectListener. - * @param listener The listener. - **/ - public void removeVObjectListener(VObjectListener listener) - { - objectEventSupport_.removeVObjectListener(listener); - } - - /** - * Removes a working listener. - * @param listener The listener. - **/ - public void removeWorkingListener(WorkingListener listener) - { - workingEventSupport_.removeWorkingListener(listener); - } - - /** - * Sets the enabled state. - * @param enable True if a user can select it. - **/ - public void setEnabled(boolean enable) - { - enabled_ = enable; - } -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/PermissionMainPanel.java b/cvsroot/src/com/ibm/as400/vaccess/PermissionMainPanel.java deleted file mode 100644 index 22b8a0de9..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/PermissionMainPanel.java +++ /dev/null @@ -1,648 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PermissionMainPanel.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Insets; -import java.awt.Color; -import java.awt.GridLayout; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JFrame; -import javax.swing.JComponent; -import javax.swing.JTable; -import javax.swing.JLabel; -import javax.swing.JDialog; -import javax.swing.JSeparator; -import javax.swing.JButton; -import javax.swing.JTextField; -import javax.swing.JOptionPane; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableCellRenderer; -import javax.swing.event.ChangeListener; -import com.ibm.as400.access.Permission; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.UserPermission; - -/** - * The PermissionMainPanel class provides three different panels according to - * different library structures of the object. - */ -class PermissionMainPanel - extends JPanel - implements ActionListener, - KeyListener -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - /** - * The following five private variables respectively representing - * five JTextField. - **/ - private JTextField objectField; - private JTextField typeField; - private JTextField ownerField; - private JTextField groupField; - private JTextField listField; - - /** - * Private variable representing a JTextfield in the dialog of Add a User. - **/ - private JTextField userNameField; - - /** - * The following five variables respectively representing five buttons in the main wondow. - **/ - private JButton addButton; - private JButton removeButton; - private JButton okButton; - private JButton cancelButton; - private JButton applyButton; - - /** - * Private variable representing the object of Permission. - **/ - private Permission permission_; - - /** - * Private variable representing JFrame. - **/ - private JFrame frame_; - - /** - * Private variable representing JTable. - **/ - private JTable table_ = null; - - /** - * Private variable representing the object of JDialog. - **/ - private JDialog removeDialog_; - - /** - * Private variable representing the object of JDialog. - **/ - private JDialog addDialog_; - - /** - * The following three variables respectively representing - * three TableModels of the JTable. - **/ - private PermissionTableModelDLO tableModelDLO_; - private PermissionTableModelQSYS tableModelQSYS_; - private PermissionTableModelRoot tableModelRoot_; - - /** - * Private variable indicating that the value of listField is changed. - **/ - private boolean listChanged = false; - - /** - * The following private variables representing the labels for displaying. - **/ - private static String addLabel_ = ResourceLoader.getText("DLG_ADD"); - private static String cancelLabel_ = ResourceLoader.getText("DLG_CANCEL"); - private static String removeLabel_ = ResourceLoader.getText("DLG_REMOVE"); - private static String okLabel_ = ResourceLoader.getText("DLG_OK"); - private static String yesLabel_ = ResourceLoader.getText("DLG_YES"); - private static String noLabel_ = ResourceLoader.getText("DLG_NO"); - private static String applyLabel_ = ResourceLoader.getText("DLG_APPLY"); - private static String objectName_ = ResourceLoader.getText("OBJECT_NAME"); - private static String objectType_ = ResourceLoader.getText("OBJECT_TYPE"); - private static String objectOwner_ = ResourceLoader.getText("OBJECT_OWNER"); - private static String primaryGroup_ = ResourceLoader.getText("OBJECT_GROUP"); - private static String authorizationList_ = ResourceLoader.getText("OBJECT_AUTHORIZATION_LIST"); - private static String objectPermission_ = ResourceLoader.getText("OBJECT_PERMISSION"); - private static String addDialogTitle_ = ResourceLoader.getText("OBJECT_ADD_DIALOG_TITLE"); - private static String removeDialogTitle_ = ResourceLoader.getText("OBJECT_REMOVE_DIALOG_TITLE"); - private static String addDialogMessage_ = ResourceLoader.getText("OBJECT_ADD_MESSAGE"); - private static String removeDialogMessage_ = ResourceLoader.getText("OBJECT_REMOVE_MESSAGE"); - private static String commitDialogMessage_ = ResourceLoader.getText("OBJECT_COMMIT_DIALOG_MESSAGE"); - private static String commitDialogTitle_ = ResourceLoader.getText("OBJECT_COMMIT_DIALOG_TITLE"); - private static String typeNoDefined_ = ResourceLoader.getText("OBJECT_TYPE_NO_DEFINED"); - private static String permissionDialogMessage_ = ResourceLoader.getText("OBJECT_PERMISSION_DIALOG_MESSAGE"); - private static String permissionDialogTitle_ = ResourceLoader.getText("OBJECT_PERMISSION_DIALOG_TITLE"); - - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - /** - * Constructs a PermissionMainPanel object. - * @param permission The Permission object. - **/ - public PermissionMainPanel(Permission permission) - { - permission_ = permission; - } - - /** - * Performs actions according to the appropriate event. - * @param event The ActionEvent. - **/ - public void actionPerformed(ActionEvent event) - { - workingEventSupport_.fireStartWorking(); - - // Add button was pressed - if(event.getSource().equals(addButton)) - { - String inputValue = JOptionPane.showInputDialog(new JFrame(), - addDialogMessage_, - addDialogTitle_, - JOptionPane.PLAIN_MESSAGE); - if(inputValue !=null) - { - int type =permission_.getType(); - switch(type) - { - case Permission.TYPE_DLO : - tableModelDLO_.addRow(inputValue ); - break; - case Permission.TYPE_QSYS : - tableModelQSYS_.addRow(inputValue ); - break; - case Permission.TYPE_ROOT : - tableModelRoot_.addRow(inputValue ); - break; - } - } - } - - // Remove button was pressed - if(event.getSource().equals(removeButton)) - { - int selectedRow = table_.getSelectedRow(); - if(selectedRow >= 0) - { - removeButton.setEnabled(false); - applyButton.setEnabled(true); - int type = permission_.getType(); - switch(type) - { - case Permission.TYPE_DLO : - tableModelDLO_.removeRow(table_.getSelectedRow()); - break; - case Permission.TYPE_QSYS : - tableModelQSYS_.removeRow(table_.getSelectedRow()); - break; - case Permission.TYPE_ROOT : - tableModelRoot_.removeRow(table_.getSelectedRow()); - break; - } - table_.clearSelection(); - } - } - - // OK button was pressed - // Commits if Apply is enabled,and closes the main window. - // If an error occurs, we don't close the main window. - if(event.getSource().equals(okButton)) - { - if(applyButton.isEnabled()) - { - try - { - if(listChanged) - { - permission_.setAuthorizationList(listField.getText()); - listChanged = false; - } - permission_.commit(); - frame_.dispose(); - } - catch (Exception err) - { - Trace.log(Trace.ERROR,"commit : "+err); - errorEventSupport_.fireError (err); - } - } - else - { - frame_.dispose(); - } - } - - // Cancel button was pressed - // Closes the main window. - if(event.getSource().equals(cancelButton)) - { - frame_.dispose(); - } - - // Apply button was pressed - // Commits and closes the main window. - if(event.getSource().equals(applyButton)) - { - try - { - if(listChanged) - { - permission_.setAuthorizationList(listField.getText()); - listChanged = false; - } - permission_.commit(); - applyButton.setEnabled(false); - } catch (Exception err) - { - Trace.log(Trace.ERROR,"commit : "+err); - errorEventSupport_.fireError (err); - } - } - - workingEventSupport_.fireStopWorking(); - } - - /** - * Adds a listener to be notified when an error occurs. - * - * @param listener The listener. - **/ - public void addErrorListener(ErrorListener listener) - { - errorEventSupport_.addErrorListener(listener); - } - - /** - * Adds a listener to be notified when a VObject is changed, created, or deleted. - * - * @param listener The listener. - **/ - public void addVObjectListener(VObjectListener listener) - { - objectEventSupport_.addVObjectListener(listener); - } - - /** - * Adds a listener to be notified when work starts and stops on potentially long-running operations - * - * @param listener The listener. - **/ - public void addWorkingListener(WorkingListener listener) - { - workingEventSupport_.addWorkingListener(listener); - } - - /** - * Creates the main panel. - **/ - void createPermissionMainPanel() - { - setLayout(new BorderLayout(5,8)); - JPanel main = this; - JPanel part1=new JPanel(new BorderLayout(0,5)); - - //starts one of part1 - JPanel box1=new JPanel(new GridLayout(2,1)); - JLabel objectLabel =new JLabel(objectName_,JLabel.LEFT); - - objectField=new JTextField(permission_.getObjectPath()); - - objectField.setEditable(false); - box1.add(objectLabel); - box1.add(objectField); - - part1.add(box1,BorderLayout.NORTH); - - //starts two of part1 - JPanel box2 = new JPanel(new GridLayout(1,4,8,0)); - JPanel column1 = new JPanel(new GridLayout(2,1)); - JPanel column2 = new JPanel(new GridLayout(2,1)); - JPanel column3 = new JPanel(new GridLayout(2,1)); - JPanel column4 = new JPanel(new GridLayout(2,1)); - - JLabel typeLabel = new JLabel(objectType_); - - int type = permission_.getType(); - typeField = new JTextField(typeNoDefined_); - switch (type) - { - case Permission.TYPE_DLO : - typeField = new JTextField("DLO"); - break; - case Permission.TYPE_QSYS : - typeField = new JTextField("QSYS"); - break; - case Permission.TYPE_ROOT : - typeField = new JTextField("ROOT"); - break; - } - typeField.setEditable(false); - column1.add(typeLabel); - column1.add(typeField); - box2.add(column1); - - JLabel ownerLabel = new JLabel(objectOwner_); - ownerField = new JTextField(permission_.getOwner()); - ownerField.setEditable(false); - column2.add(ownerLabel); - column2.add(ownerField); - box2.add(column2); - - JLabel groupLabel = new JLabel(primaryGroup_); - groupField = new JTextField(permission_.getPrimaryGroup()); - groupField.setEditable(false); - column3.add(groupLabel); - column3.add(groupField); - box2.add(column3); - - JLabel listLabel = new JLabel(authorizationList_); - listField = new JTextField(permission_.getAuthorizationList()); - listField.addKeyListener(this); - column4.add(listLabel); - column4.add(listField); - box2.add(column4); - - part1.add(box2,BorderLayout.CENTER); - - JPanel box3 = new JPanel(new GridLayout(4,1)); - box3.add(new JLabel()); - box3.add(new JLabel()); - box3.add(new JSeparator()); - box3.add(new JLabel()); - - part1.add(box3,BorderLayout.SOUTH); - - // Part3 - JPanel part3 = new JPanel(new BorderLayout(0,10)); - - // Creates two buttons - OK and Cancel. - JPanel line1 = new JPanel(new GridLayout(1,6,5,0)); - line1.add(new JLabel()); - line1.add(new JLabel()); - line1.add(new JLabel()); - line1.add(new JLabel()); - addButton = new JButton(addLabel_); - removeButton = new JButton(removeLabel_); - addButton.addActionListener(this); - removeButton.addActionListener(this); - removeButton.setEnabled(false); - line1.add(addButton); - line1.add(removeButton); - part3.add(line1,BorderLayout.NORTH); - part3.add(new JSeparator(),BorderLayout.CENTER); - - JPanel line2 = new JPanel(new GridLayout(1,6,5,0)); - line2.add(new JLabel()); - line2.add(new JLabel()); - line2.add(new JLabel()); - - okButton = new JButton(okLabel_); - cancelButton = new JButton(cancelLabel_); - applyButton = new JButton(applyLabel_); - okButton.addActionListener(this); - cancelButton.addActionListener(this); - applyButton.addActionListener(this); - applyButton.setEnabled(false); - - line2.add(okButton); - line2.add(cancelButton); - line2.add(applyButton); - part3.add(line2,BorderLayout.SOUTH); - main.add(part1,BorderLayout.NORTH); - main.add(part3,BorderLayout.SOUTH); - main.add(getTablePane(),BorderLayout.CENTER); - - frame_ = new JFrame(ResourceLoader.substitute(objectPermission_, permission_.getName())); // @C1C - frame_.getContentPane().add(main); - frame_.setSize(650,450); - frame_.setVisible(true); - } - - /** - * Invoked when an error has occurred. - * - **/ - void fireError(Exception except) - { - errorEventSupport_.fireError(new ErrorEvent(this, except)); - } - - /** - * Returns The Apply button. - * @return The Apply button. - **/ - public JButton getApplyButton() - { - return applyButton; - } - - /** - * Returns the text of the field authorization list. - * @return the text of the field authorization list. - **/ - public String getAutList() - { - return listField.getText().trim(); - } - - /** - * Return Insets object that defines the interval with the border. - * @return Insets object that defines the interval with the border. - **/ - public Insets getInsets() - { - return new Insets(5,8,5,8); - } - - /** - * Returns the authorization list field. - * @return The authorization list field. - **/ - public JTextField getListField() - { - return listField; - } - - /** - * Returns the Remove button. - * @return The Remove button. - **/ - public JButton getRemoveButton() - { - return removeButton; - } - - /** - * Return the table pane. - * @return The table component. - **/ - private JComponent getTablePane() - { - int type = permission_.getType(); - switch(type) - { - case Permission.TYPE_DLO: - tableModelDLO_ = new PermissionTableModelDLO(this,permission_); - table_= new JTable(tableModelDLO_); - tableModelDLO_.setTableInstance(table_); - table_.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - break; - case Permission.TYPE_QSYS: - tableModelQSYS_ = new PermissionTableModelQSYS(this,permission_); - table_= new JTable(tableModelQSYS_); - tableModelQSYS_.setTableInstance(table_); - table_.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - break; - case Permission.TYPE_ROOT: - tableModelRoot_ = new PermissionTableModelRoot(this,permission_); - table_= new JTable(tableModelRoot_); - tableModelRoot_.setTableInstance(table_); - table_.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - break; - } - - JScrollPane jsp = null; - if (table_ != null) - { - table_.setAutoCreateColumnsFromModel(false); - table_.setDefaultRenderer(table_.getColumnClass(0), - (TableCellRenderer)new VObjectCellRenderer()); - table_.setCellSelectionEnabled(true); - table_.selectAll(); - table_.setSelectionMode(0); - table_.setSelectionBackground(Color.gray); - table_.setShowGrid(false); - table_.clearSelection(); - // Set the width of the name column to be wide enough to - // display any username (max of 10 characters) - // The +16 is for the icon. - // The +2 is for the space between characters. - // The 'W' is used since it is a very wide character. - if (table_.getFont() != null) - { - int fontSize = table_.getFontMetrics(table_.getFont()).charWidth('W'); - table_.getColumnModel().getColumn(0).setWidth(10*(fontSize+2)+16); - } - jsp = new JScrollPane(table_); - } - return jsp; - } - - /** The key is pressed. - * @param keyEvent The key event. - **/ - public void keyPressed(KeyEvent keyEvent){} - - /** The key is released. - * @param keyEvent The key event. - **/ - public void keyReleased(KeyEvent keyEvent) - { - switch (keyEvent.getKeyCode()) - { - case KeyEvent.VK_TAB : - case KeyEvent.VK_ENTER : - case KeyEvent.VK_ALT : - case KeyEvent.VK_SHIFT : - case KeyEvent.VK_CONTROL : - case KeyEvent.VK_ESCAPE : - case KeyEvent.VK_PAGE_DOWN : - case KeyEvent.VK_PAGE_UP : - case KeyEvent.VK_UP : - case KeyEvent.VK_DOWN : - case KeyEvent.VK_RIGHT : - case KeyEvent.VK_LEFT : - case KeyEvent.VK_HOME : - case KeyEvent.VK_END : - case KeyEvent.VK_INSERT : - case KeyEvent.VK_CAPS_LOCK : - case KeyEvent.VK_NUM_LOCK : - case KeyEvent.VK_PRINTSCREEN : - case KeyEvent.VK_SCROLL_LOCK : - case KeyEvent.VK_PAUSE : - case KeyEvent.VK_F1 : - case KeyEvent.VK_F2 : - case KeyEvent.VK_F3 : - case KeyEvent.VK_F4 : - case KeyEvent.VK_F5 : - case KeyEvent.VK_F6 : - case KeyEvent.VK_F7 : - case KeyEvent.VK_F8 : - case KeyEvent.VK_F9 : - case KeyEvent.VK_F10 : - case KeyEvent.VK_F11 : - case KeyEvent.VK_F12 : - break; - default : - if (!listChanged) - { - listChanged = true; - applyButton.setEnabled(true); - } - if (listField.getText().trim().toUpperCase().equals("*NONE")) - { - // Can't call setValueAt directly because we don't know - // the row for *PUBLIC, but resetPublicAuthorizationList() does. -// permission_.getUserPermission("*PUBLIC").setFromAuthorizationList(false); - int type = permission_.getType(); - switch(type) - { - case Permission.TYPE_DLO : - tableModelDLO_.resetPublicAuthorizationList(); - break; - case Permission.TYPE_QSYS : - tableModelQSYS_.resetPublicAuthorizationList(); - break; - case Permission.TYPE_ROOT : - tableModelRoot_.resetPublicAuthorizationList(); - break; - } - } - } - } - - /** - * The key is typed. - * @param keyEvent The key event. - **/ - public void keyTyped(KeyEvent keyEvent){} - - /** - * Removes an error listener. - * - * @param listener The listener. - **/ - public void removeErrorListener(ErrorListener listener) - { - errorEventSupport_.removeErrorListener(listener); - } - - /** - * Removes a VObjectListener - * - * @param listener The listener. - **/ - public void removeVObjectListener(VObjectListener listener) - { - objectEventSupport_.removeVObjectListener(listener); - } - - /** - * Removes a working listener. - * - * @param listener The listener. - **/ - public void removeWorkingListener(WorkingListener listener) - { - workingEventSupport_.removeWorkingListener(listener); - } - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/PermissionNameCellObject.java b/cvsroot/src/com/ibm/as400/vaccess/PermissionNameCellObject.java deleted file mode 100644 index c69bae5d9..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/PermissionNameCellObject.java +++ /dev/null @@ -1,84 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PermissionNameCellObject.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.Icon; - -/** - * The PermissionNameCellObject class provides an object that contains name and icon. - **/ - -class PermissionNameCellObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - /** - * Private variable representing user name. - **/ - private String name_; - - /** - * Private variable representing the flag of the user icon. - **/ - private int groupIndicator_; - - /** - * Constructs a PermissionNameCellObject object. - * @param name The user name. - * @param group The flag that indicates the icon of the user. - **/ - public PermissionNameCellObject(String name,int group) - { - name_ = name; - groupIndicator_ = group; - } - - /** - * Returns the icon. - * @param size The icon size, either 16 or 32. If any other - * value is given, then return a default. - * @param open True for the open icon; false for the closed - * icon. If there is only one icon, then this - * parameter has no effect. - * @return The icon, or null if there is none. - **/ - public Icon getIcon (int size, boolean open) - { - Icon imageIcon = null; - if (size == 32) - { - if(groupIndicator_ != 1) - imageIcon = ResourceLoader.getIcon("group32.gif", ""); - else - imageIcon = ResourceLoader.getIcon("user32.gif", ""); - } - else - { - if(groupIndicator_ != 1) - imageIcon = ResourceLoader.getIcon("group16.gif", ""); - else - imageIcon = ResourceLoader.getIcon("user16.gif", ""); - } - return imageIcon; - } - - /** - * Returns the user name. - * @return The user name. - **/ - public String getText () - { - return name_; - } - } diff --git a/cvsroot/src/com/ibm/as400/vaccess/PermissionTableModelDLO.java b/cvsroot/src/com/ibm/as400/vaccess/PermissionTableModelDLO.java deleted file mode 100644 index 6699dce8c..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/PermissionTableModelDLO.java +++ /dev/null @@ -1,344 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PermissionTableModelDLO.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.util.Enumeration; -import java.util.Vector; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.JTable; -import javax.swing.table.DefaultTableModel; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.DLOPermission; -import com.ibm.as400.access.Permission; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.UserPermission; - -/** - * The PermissionTableModelDLO class provides the TableModel for a specified JTable, - * and provides methods to add a user to the table or remove a user from the table. - **/ -class PermissionTableModelDLO extends DefaultTableModel -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - /** - * Private variable representing the object of Permission. - **/ - private Permission permission_; - - /** - * Private variable representing the vector that stores userPermission objects - * of the specified Permission. - **/ - private Vector userPermissions_; - - /** - * Private variable representing the object of JTable . - **/ - private JTable table_; - - /** - * Private variable representing the object of PermissionMainPanel object . - **/ - private PermissionMainPanel mainPanel_; - - /** - * Private variable representing the number of selected column in the table. - **/ - private int selectedColumn_ =1; - - /** - * The String Array storing the column name of the table. - */ - private static String[] columnNames_; - - /** - * The following two private variables representing message and title in the exception dialog. - **/ - private static String addUserExceptionDialogMessage_; - private static String addUserExceptionDialogTitle_; - - /** - * Constructs a PermissionsTableTableModelDLO object. - * @param mainPanel The PermissionMainPanel object. - * @param permission The Permission object. - */ - public PermissionTableModelDLO(PermissionMainPanel mainPanel,Permission permission) - { - initializeTable(); - mainPanel_ = mainPanel; - permission_ = permission; - Enumeration userPermissions = permission_.getUserPermissions(); - userPermissions_ = new Vector(); - while(userPermissions.hasMoreElements()) - { - userPermissions_.addElement(userPermissions.nextElement()); - } - } - - /** - * Adds a new user permission in the specified permission. - * @param name The user name. - */ - public void addRow(String name) - { - try - { - permission_.addAuthorizedUser(name); - mainPanel_.getApplyButton().setEnabled(true); - table_.clearSelection(); - - // Gets the new data after adding the specified user. - Enumeration userPermissions = permission_.getUserPermissions(); - userPermissions_ = new Vector(); - while(userPermissions.hasMoreElements()) - { - userPermissions_.addElement(userPermissions.nextElement()); - } - int updatedRow = userPermissions_.size()-1; - fireTableRowsInserted(updatedRow, updatedRow); - } - catch(ExtendedIllegalArgumentException e) - { - Trace.log(Trace.ERROR,"Error in addRow : "+e); - mainPanel_.fireError(e); - } - } - /** - * Returns the lowest common denominator class in the column. - * @param column The index of column. - * @return The common ancestor class of the object values in the model. - */ - public Class getColumnClass(int column) - { - return getValueAt(0,column).getClass(); - } - - /** - * Returns the number of columns in the table. - * @return The number of columns in the table. - */ - public int getColumnCount() - { - return columnNames_.length; - } - - /** - * Returns the name of the column at column. - * @return The column number of the table. - */ - public String getColumnName(int column) - { - return columnNames_[column]; - } - - /** - * Returns the number of records in the table. - * @return The number of records in the table. - */ - public int getRowCount() - { - if (userPermissions_==null) - return 0; - return userPermissions_.size(); - } - - /** - * Returns an attribute value for the cell at column and row. - * @param row The index of row. - * @param column The index of column. - * @return The object that is at row, column. - */ - public Object getValueAt(int row, int column) - { - if (row >= userPermissions_.size()) - return null; - - if (selectedColumn_ >0) - table_.clearSelection(); - else if (table_.getSelectedRow()>=0 - && table_.getSelectedRowCount() > 0) //@B0A - mainPanel_.getRemoveButton().setEnabled(true); - - DLOPermission user=null; - - user = (DLOPermission)userPermissions_.elementAt(row); - - String authorityValue = user.getDataAuthority().toUpperCase(); - Object value = null; - switch(column) - { - case 0 : - value = new PermissionNameCellObject(user.getUserID(),user.getGroupIndicator()); - break; - case 1 : - value = new Boolean(authorityValue.equals("*USE")); - break; - case 2 : - value = new Boolean(authorityValue.equals("*CHANGE")); - break; - case 3 : - value = new Boolean(authorityValue.equals("*ALL")); - break; - case 4 : - value = new Boolean(authorityValue.equals("*EXCLUDE")); - break; - case 5 : - value = new Boolean(user.isFromAuthorizationList()); - break; - case 6: //@A2A - value = new Boolean(authorityValue.equals("USER_DEF")); //@A2A - break; //@A2A - } - return value; - } - - /** - * Defines the column name. - **/ - private void initializeTable() - { - - columnNames_ = new String[7]; //@A2C - - columnNames_[0] = ResourceLoader.getText("OBJECT_USER_NAME"); - columnNames_[1] = ResourceLoader.getText("OBJECT_AUTHORITY_USE"); - columnNames_[2] = ResourceLoader.getText("OBJECT_AUTHORITY_CHANGE"); - columnNames_[3] = ResourceLoader.getText("OBJECT_AUTHORITY_ALL"); - columnNames_[4] = ResourceLoader.getText("OBJECT_AUTHORITY_EXCLUDE"); - columnNames_[5] = ResourceLoader.getText("OBJECT_FROM_AUTHORIZATION_LIST"); - columnNames_[6] = ResourceLoader.getText("OBJECT_AUTHORITY_USER_DEF"); //@A2A - addUserExceptionDialogMessage_ = ResourceLoader.getText("OBJECT_ADD_USER_EXCEPTION_DIALOG_MESSAGE"); - addUserExceptionDialogTitle_ = ResourceLoader.getText("OBJECT_ADD_USER_EXCEPTION_DIALOG_TITLE"); - - } - - /** - * Returns true if the cell at row and column is editable. Otherwise, setValueAt() on the cell will not - * change the value of that cell. - * @param row The index of row. - * @param column The index of column. - * @return True if the cell is editable. - */ - public boolean isCellEditable(int row,int column) - { - selectedColumn_ = column; - switch (column) - { - case 0 : - return false; - case 5 : - UserPermission user = (UserPermission)userPermissions_.elementAt(row); - if (mainPanel_.getAutList().toUpperCase().equals("*NONE") || - !user.getUserID().toUpperCase().equals("*PUBLIC")) - { - return false; - } - return true; //@A2A - case 6 : //@A2A - return false; //@A2A - default : - return true; - } - } - - /** - * Removes the specified record from the table. - * @param row The index of row. - */ - public void removeRow(int row) - { - table_.clearSelection(); - DLOPermission user = (DLOPermission)userPermissions_.elementAt(row); - permission_.removeUserPermission(user); - Enumeration userPermissions = permission_.getUserPermissions(); - userPermissions_ = new Vector(); - while(userPermissions.hasMoreElements()) - { - userPermissions_.addElement(userPermissions.nextElement()); - } - fireTableRowsDeleted(row, row); - } - - /** - Used so the main panel can set the authorization list checkbox on - *PUBLIC to false. - **/ - void resetPublicAuthorizationList() - { - UserPermission up = permission_.getUserPermission("*PUBLIC"); - int row = userPermissions_.indexOf(up); - if (row >= 0) - { - setValueAt(new Boolean(false), row, 5); - } - } - - /** - * Sets the JTable object. - * @param table The JTable object. - **/ - public void setTableInstance(JTable table) - { - table_ = table; - } - - /** - * Sets an attribute value for the record in the cell at column and row. - * @param aValue The new value. - * @param row The index of row. - * @param column The index of column. - */ - public void setValueAt(Object aValue,int row,int column) - { - mainPanel_.getRemoveButton().setEnabled(false); - - DLOPermission user = (DLOPermission)userPermissions_.elementAt(row); - - boolean value; - switch(column) - { - case 1 : - value = ((Boolean)aValue).booleanValue(); - if (value == true) - user.setDataAuthority("*Use"); - break; - case 2 : - value = ((Boolean)aValue).booleanValue(); - if (value == true) - user.setDataAuthority("*Change"); - break; - case 3 : - value = ((Boolean)aValue).booleanValue(); - if (value == true) - user.setDataAuthority("*All"); - break; - case 4 : - value = ((Boolean)aValue).booleanValue(); - if (value == true) - user.setDataAuthority("*Exclude"); - break; - case 5 : - value = ((Boolean)aValue).booleanValue(); - user.setFromAuthorizationList(value); - break; - } - // We don't call fireTableCellUpdated because more than one - // cell could have changed due to one of the above sets(). - fireTableRowsUpdated(row, row); - - mainPanel_.getApplyButton().setEnabled(true); - } - } diff --git a/cvsroot/src/com/ibm/as400/vaccess/PermissionTableModelQSYS.java b/cvsroot/src/com/ibm/as400/vaccess/PermissionTableModelQSYS.java deleted file mode 100644 index 028cedb1e..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/PermissionTableModelQSYS.java +++ /dev/null @@ -1,457 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PermissionTableModelQSYS.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.util.Enumeration; -import java.util.Vector; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.JTable; -import javax.swing.table.DefaultTableModel; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Permission; -import com.ibm.as400.access.QSYSObjectPathName; -import com.ibm.as400.access.QSYSPermission; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.UserPermission; - -/** - * The PermissionTableModelQSYS provides the TableModel for a specified JTable, and provides methods - * to add a user to the table or remove a user from the table. - **/ -class PermissionTableModelQSYS extends DefaultTableModel -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - /** - * Private variable representing the object of Permission. - **/ - private Permission permission_; - - /** - * Private variable representing the vector that stores userPermission object - * of the specified Permisssions. - **/ - private Vector userPermissions_; - - /** - * Private variable representing object is an authorization list. - **/ - private boolean isAuthorizationList_; - - /** - * Private variable representing the object of JTable. - **/ - private JTable table_; - - /** - * Private variable representing the object of MainPanel. - **/ - private PermissionMainPanel mainPanel_; - - /** - * Private variable representing the number of selected column in the table. - **/ - private int selectedColumn_ =1; - - /** - * The String Array storing the column name of the table. - */ - private String[] columnNames_; - - /** - * The following two private variables representing message and title in the exception dialog. - **/ - private static String addUserExceptionDialogMessage_; - private static String addUserExceptionDialogTitle_; - - /** - * Constructs a PermissionTableModelQSYS object. - * @param mainPanel The PermissionMainPanel object. - * @param permission The Permission object . - */ - public PermissionTableModelQSYS(PermissionMainPanel mainPanel,Permission permission) - { - QSYSObjectPathName objectPathName = new QSYSObjectPathName(permission.getObjectPath()); - - if (objectPathName.getObjectType().toUpperCase().equals("AUTL")) - isAuthorizationList_ = true; - else - isAuthorizationList_ = false; - - mainPanel_ = mainPanel; - permission_ = permission; - initializeTable(); - Enumeration userPermissions = permission_.getUserPermissions(); - userPermissions_ = new Vector(); - while(userPermissions.hasMoreElements()) - { - userPermissions_.addElement(userPermissions.nextElement()); - } - } - - /** - * Adds a new user permission in the specified permission. - * @param name The user name. - */ - public void addRow(String name) - { - try - { - permission_.addAuthorizedUser(name); - mainPanel_.getApplyButton().setEnabled(true); - table_.clearSelection(); - - // Gets the new data after adding the specified user. - Enumeration userPermissions = permission_.getUserPermissions(); - userPermissions_ = new Vector(); - while(userPermissions.hasMoreElements()) - { - userPermissions_.addElement(userPermissions.nextElement()); - } - int updatedRow = userPermissions_.size()-1; - fireTableRowsInserted(updatedRow, updatedRow); - } - catch(ExtendedIllegalArgumentException e) - { - Trace.log(Trace.ERROR,"Error in addRow : "+e); - mainPanel_.fireError(e); - } - } - - /** - * Returns the lowest common denominator class in the column. - * @param column The index of column. - * @return The common ancestor class of the object values in the model. - */ - public Class getColumnClass(int column) - { - return getValueAt(0,column).getClass(); - } - - /** - * Returns the number of columns in the table. - * @return The number of columns in the table. - */ - public int getColumnCount() - { - return columnNames_.length; - } - - /** - * Returns the name of the column at column. - * @return The column number of the table. - */ - public String getColumnName(int column) - { - return columnNames_[column]; - } - - - /** - * Returns the number of records in the table. - * @return The number of records in the table. - */ - public int getRowCount() - { - if (userPermissions_==null) - return 0; - return userPermissions_.size(); - } - - /** - * Returns an attribute value for the cell at column and row. - * @param row The index of row. - * @param column The index of column. - * @return The object that is at row, column. - */ - public Object getValueAt(int row, int column) - { - if (row >= userPermissions_.size()) - return null; - if(selectedColumn_ >0) - { - table_.clearSelection(); - } else - { - if(table_.getSelectedRow()>=0 - && table_.getSelectedRowCount() > 0) //@B0A - mainPanel_.getRemoveButton().setEnabled(true); - } - - QSYSPermission user = (QSYSPermission)userPermissions_.elementAt(row); - String authorityValue = user.getObjectAuthority().toUpperCase(); - Object value = null; - switch(column) - { - case 0 : - value = new PermissionNameCellObject(user.getUserID(),user.getGroupIndicator()); - break; - case 1 : - value = new Boolean(authorityValue.equals("*USE")); - break; - case 2 : - value = new Boolean(authorityValue.equals("*CHANGE")); - break; - case 3 : - value = new Boolean(authorityValue.equals("*ALL")); - break; - case 4 : - value = new Boolean(authorityValue.equals("*EXCLUDE")); - break; - case 5 : - if (isAuthorizationList_) - value = new Boolean(user.isAuthorizationListManagement()); - else - value = new Boolean(user.isFromAuthorizationList()); - break; - case 6 : - value = new Boolean(user.isOperational()); - break; - case 7 : - value = new Boolean(user.isManagement()); - break; - case 8 : - value = new Boolean(user.isExistence()); - break; - case 9 : - value = new Boolean(user.isAlter()); - break; - case 10 : - value = new Boolean(user.isReference()); - break; - case 11 : - value = new Boolean(user.isRead()); - break; - case 12 : - value = new Boolean(user.isAdd()); - break; - case 13 : - value = new Boolean(user.isUpdate()); - break; - case 14 : - value = new Boolean(user.isDelete()); - break; - case 15 : - value = new Boolean(user.isExecute()); - break; - } - return value; - } - - /** - * Defines the column name. - **/ - private void initializeTable() - { - columnNames_ = new String[16]; - columnNames_[0] = ResourceLoader.getText("OBJECT_USER_NAME"); - columnNames_[1] = ResourceLoader.getText("OBJECT_AUTHORITY_USE"); - columnNames_[2] = ResourceLoader.getText("OBJECT_AUTHORITY_CHANGE"); - columnNames_[3] = ResourceLoader.getText("OBJECT_AUTHORITY_ALL"); - columnNames_[4] = ResourceLoader.getText("OBJECT_AUTHORITY_EXCLUDE"); - - if (isAuthorizationList_) - { - mainPanel_.getListField().setEnabled(false); - columnNames_[5] = ResourceLoader.getText("OBJECT_LIST_MANAGEMENT"); //@A3C - } - else - { - columnNames_[5] = ResourceLoader.getText("OBJECT_FROM_AUTHORIZATION_LIST"); - } - columnNames_[6] = ResourceLoader.getText("OBJECT_AUTHORITY_OPERATION"); - columnNames_[7] = ResourceLoader.getText("OBJECT_AUTHORITY_MANAGEMENT"); - columnNames_[8] = ResourceLoader.getText("OBJECT_AUTHORITY_EXISTENCE"); - columnNames_[9] = ResourceLoader.getText("OBJECT_AUTHORITY_ALTER"); - columnNames_[10] = ResourceLoader.getText("OBJECT_AUTHORITY_REFERENCE"); - columnNames_[11] = ResourceLoader.getText("OBJECT_AUTHORITY_READ"); - columnNames_[12] = ResourceLoader.getText("OBJECT_AUTHORITY_ADD"); - columnNames_[13] = ResourceLoader.getText("OBJECT_AUTHORITY_UPDATE"); - columnNames_[14] = ResourceLoader.getText("OBJECT_AUTHORITY_DELETE"); - columnNames_[15] = ResourceLoader.getText("OBJECT_AUTHORITY_EXECUTE"); - addUserExceptionDialogMessage_ = ResourceLoader.getText("OBJECT_ADD_USER_EXCEPTION_DIALOG_MESSAGE"); - addUserExceptionDialogTitle_ = ResourceLoader.getText("OBJECT_ADD_USER_EXCEPTION_DIALOG_TITLE"); - } - - /** - * Returns true if the cell at row and column is editable. Otherwise, setValueAt() - * on the cell will not change the value of that cell. - * @param row The index of row. - * @param column The index of column. - * @return True if the cell is editable. - */ - public boolean isCellEditable(int row,int column) - { - selectedColumn_ = column; - switch (column) - { - case 0 : - return false; - case 5 : - UserPermission user = (UserPermission)userPermissions_.elementAt(row); - if (isAuthorizationList_) //@A2C - { - if (user.getUserID().toUpperCase().equals("*PUBLIC")) //@A2C - return false; - } - else - { - if (mainPanel_.getAutList().toUpperCase().equals("*NONE") || - !user.getUserID().toUpperCase().equals("*PUBLIC")) - { - return false; - } - } - } - return true; - } - - /** - * Removes the specified record from the table. - * @param row The index of row. - */ - public void removeRow(int row) - { - table_.clearSelection(); - QSYSPermission user = (QSYSPermission)userPermissions_.elementAt(row); - permission_.removeAuthorizedUser(user.getUserID()); - - // Gets the new data after removing the specified user. - Enumeration userPermissions = permission_.getUserPermissions(); - userPermissions_ = new Vector(); - while(userPermissions.hasMoreElements()) - { - userPermissions_.addElement(userPermissions.nextElement()); - } - fireTableRowsDeleted(row, row); - } - - /** - Used so the main panel can set the authorization list checkbox on - *PUBLIC to false. - **/ - void resetPublicAuthorizationList() - { - UserPermission up = permission_.getUserPermission("*PUBLIC"); - int row = userPermissions_.indexOf(up); - if (row >= 0) - { - setValueAt(new Boolean(false), row, 5); - } - } - - /** - * Sets the JTable object. - * @param table The JTable object. - **/ - public void setTableInstance(JTable table) - { - table_ = table; - } - - /** - * Sets an attribute value for the record in the cell at column and row. - * @param aValue The new value. - * @param row The index of row. - * @param column The index of column. - */ - public void setValueAt(Object aValue,int row,int column) - { - mainPanel_.getRemoveButton().setEnabled(false); - - QSYSPermission user = (QSYSPermission)userPermissions_.elementAt(row); - - boolean value; - - switch(column) - { - case 1 : - value = ((Boolean)aValue).booleanValue(); - if (value) - user.setObjectAuthority("*Use"); - break; - case 2 : - value = ((Boolean)aValue).booleanValue(); - if (value) - user.setObjectAuthority("*Change"); - break; - case 3 : - value = ((Boolean)aValue).booleanValue(); - if (value) - user.setObjectAuthority("*All"); - break; - case 4 : - value = ((Boolean)aValue).booleanValue(); - if (value) - { - user.setObjectAuthority("*Exclude"); - user.setAuthorizationListManagement(false); //@A2A - } - break; - case 5 : - value = ((Boolean)aValue).booleanValue(); - if (isAuthorizationList_) - user.setAuthorizationListManagement(value); - else - user.setFromAuthorizationList(value); - break; - case 6 : - value = ((Boolean)aValue).booleanValue(); - user.setOperational(value); - break; - case 7 : - value = ((Boolean)aValue).booleanValue(); - user.setManagement(value); - break; - case 8 : - value = ((Boolean)aValue).booleanValue(); - user.setExistence(value); - break; - case 9 : - value = ((Boolean)aValue).booleanValue(); - user.setAlter(value); - break; - case 10 : - value = ((Boolean)aValue).booleanValue(); - user.setReference(value); - break; - case 11 : - value = ((Boolean)aValue).booleanValue(); - user.setRead(value); - break; - case 12 : - value = ((Boolean)aValue).booleanValue(); - user.setAdd(value); - break; - case 13 : - value = ((Boolean)aValue).booleanValue(); - user.setUpdate(value); - break; - case 14 : - value = ((Boolean)aValue).booleanValue(); - user.setDelete(value); - break; - case 15 : - value = ((Boolean)aValue).booleanValue(); - user.setExecute(value); - break; - } - // We don't call fireTableCellUpdated because more than one - // cell could have changed due to one of the above sets(). - fireTableRowsUpdated(row, row); - - mainPanel_.getApplyButton().setEnabled(true); - } -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/PermissionTableModelRoot.java b/cvsroot/src/com/ibm/as400/vaccess/PermissionTableModelRoot.java deleted file mode 100644 index 89568c352..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/PermissionTableModelRoot.java +++ /dev/null @@ -1,418 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PermissionTableModelRoot.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.util.Enumeration; -import java.util.Vector; -import javax.swing.JTable; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.table.DefaultTableModel; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.Permission; -import com.ibm.as400.access.RootPermission; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.UserPermission; - -/** - * The PermissionTableModelRoot class provides the TableModel for a specified JTable, - * and provides methods to add a user to the table or remove a user from the table. - **/ - -class PermissionTableModelRoot extends DefaultTableModel -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - /** - * Private variable representing the object of Permission. - **/ - private Permission permission_; - - /** - * Private variable representing the vector that stores userPermission object - * of the specified Permisssions. - **/ - private Vector userPermissions_; - - /** - * Private variable representing the object of JTable. - **/ - private JTable table_; - - /** - * Private variable representing the object of MainPanel. - **/ - private PermissionMainPanel mainPanel_; - - /** - * Private variable representing the number of selected column in the table. - **/ - private int selectedColumn_ = 1; - - /** - * The following three private variables representing the value of the authorities. - **/ - private boolean read = false; - private boolean write = false; - private boolean execute = false; - - /** - * The String Array storing the column name of the table. - */ - private String[] columnNames_ ; - - /** - * The following two private variables representing message and title in the exception dialog. - **/ - private static String addUserExceptionDialogMessage_; - private static String addUserExceptionDialogTitle_; - - /** - * Constructs a PermissionTableModelRoot object. - * @param mainPanel The object of the PermissionMainPanel object. - * @param permission The object of the Permission object. - */ - public PermissionTableModelRoot(PermissionMainPanel mainPanel,Permission permission) - { - initializeTable(); - mainPanel_ = mainPanel; - permission_ = permission; - Enumeration userPermissions = permission_.getUserPermissions(); - userPermissions_ = new Vector(); - while(userPermissions.hasMoreElements()) - { - userPermissions_.addElement(userPermissions.nextElement()); - } - } - - /** - * Add a new user permission in the specified permission. - * @param name The user name. - */ - public void addRow(String name) - { - try - { - permission_.addAuthorizedUser(name); - mainPanel_.getApplyButton().setEnabled(true); - table_.clearSelection(); - - // Gets the new data after adding the specified user. - Enumeration userPermissions = permission_.getUserPermissions(); - userPermissions_ = new Vector(); - while(userPermissions.hasMoreElements()) - { - userPermissions_.addElement(userPermissions.nextElement()); - } - int updatedRow = userPermissions_.size()-1; - fireTableRowsInserted(updatedRow, updatedRow); - } - catch(ExtendedIllegalArgumentException e) - { - Trace.log(Trace.ERROR,"Error in addRow : "+e); - mainPanel_.fireError(e); - } - } - - /** - * Returns the lowest common denominator class in the column. - * @param column The index of column. - * @return The common ancestor class of the object values in the model. - */ - public Class getColumnClass(int column) - { - return getValueAt(0,column).getClass(); - } - - /** - * Returns the number of columns in the table. - * @return The number of columns in the table. - */ - public int getColumnCount() - { - return columnNames_.length; - } - - /** - * Returns the name of the column at column. This is used to initialize the table's - * column header name. - * @return The row number of the table. - */ - public String getColumnName(int column) - { - return columnNames_[column]; - } - - /** - * Returns the number of records in the table. - * @return The number of records in the table. - */ - public int getRowCount() - { - if (userPermissions_==null) - return 0; - return userPermissions_.size(); - } - - /** - * Returns an attribute value for the cell at column and row. - * @param row The index of row. - * @param column The index of column. - * @return The object that is at row, column. - */ - public Object getValueAt(int row, int column) - { - if (row >= userPermissions_.size()) - return null; - if(selectedColumn_ >0) - { - table_.clearSelection(); - } else - { - if(table_.getSelectedRow()>=0 - && table_.getSelectedRowCount() > 0) //@B0A - mainPanel_.getRemoveButton().setEnabled(true); - } - RootPermission user=null; - - user = (RootPermission)userPermissions_.elementAt(row); - - String authorityValue = user.getDataAuthority().toUpperCase(); - Object value = null; - switch(column) - { - case 0 : - value = new PermissionNameCellObject(user.getUserID(),user.getGroupIndicator()); - break; - case 1 : - value = new Boolean(authorityValue.indexOf("R") > -1); - break; - case 2 : - value = new Boolean(authorityValue.indexOf("W") > -1); - break; - case 3 : - value = new Boolean((authorityValue.indexOf("X") > -1) && - (authorityValue.indexOf("E") == -1)); - break; - case 4 : - value = new Boolean(user.isManagement()); - break; - case 5 : - value = new Boolean(user.isExistence()); - break; - case 6 : - value = new Boolean(user.isAlter()); - break; - case 7 : - value = new Boolean(user.isReference()); - break; - case 8 : - value = new Boolean(user.isFromAuthorizationList()); - break; - } - return value; - } - - /** - * Defines the column name. - **/ - private void initializeTable() - { - - columnNames_ = new String[9]; - - columnNames_[0] = ResourceLoader.getText("OBJECT_USER_NAME"); - columnNames_[1] = ResourceLoader.getText("OBJECT_AUTHORITY_READ"); - columnNames_[2] = ResourceLoader.getText("OBJECT_AUTHORITY_WRITE"); - columnNames_[3] = ResourceLoader.getText("OBJECT_AUTHORITY_EXECUTE"); - columnNames_[4] = ResourceLoader.getText("OBJECT_AUTHORITY_MANAGEMENT"); - columnNames_[5] = ResourceLoader.getText("OBJECT_AUTHORITY_EXISTENCE"); - columnNames_[6] = ResourceLoader.getText("OBJECT_AUTHORITY_ALTER"); - columnNames_[7] = ResourceLoader.getText("OBJECT_AUTHORITY_REFERENCE"); - columnNames_[8] = ResourceLoader.getText("OBJECT_FROM_AUTHORIZATION_LIST"); - addUserExceptionDialogMessage_ = ResourceLoader.getText("OBJECT_ADD_USER_EXCEPTION_DIALOG_MESSAGE"); - addUserExceptionDialogTitle_ = ResourceLoader.getText("OBJECT_ADD_USER_EXCEPTION_DIALOG_TITLE"); - } - - /** - * Returns true if the cell at row and column is editable. Otherwise, setValueAt() on the cell will not - * change the value of that cell. - * @param row The index of row. - * @param column The index of column. - * @return True if the cell is editable. - */ - public boolean isCellEditable(int row,int column) - { - selectedColumn_ = column; - switch (column) - { - case 0 : - return false; - case 8 : - UserPermission user = (UserPermission)userPermissions_.elementAt(row); - if (mainPanel_.getAutList().toUpperCase().equals("*NONE") || - !user.getUserID().toUpperCase().equals("*PUBLIC")) - { - return false; - } - - default : - return true; - } - } - - /** - * Removes the specified record from the table. - * @param row The index of row. - */ - public void removeRow(int row) - { - table_.clearSelection(); - RootPermission user = (RootPermission)userPermissions_.elementAt(row); - permission_.removeAuthorizedUser(user.getUserID()); - Enumeration userPermissions = permission_.getUserPermissions(); - userPermissions_ = new Vector(); - while(userPermissions.hasMoreElements()) - { - userPermissions_.addElement(userPermissions.nextElement()); - } - fireTableRowsDeleted(row, row); - } - - /** - Used so the main panel can set the authorization list checkbox on - *PUBLIC to false. - **/ - void resetPublicAuthorizationList() - { - UserPermission up = permission_.getUserPermission("*PUBLIC"); - int row = userPermissions_.indexOf(up); - if (row >= 0) - { - setValueAt(new Boolean(false), row, 8); - } - } - - /** - * Sets the JTable object. - * @param table The JTable object. - **/ - public void setTableInstance(JTable table) - { - table_ = table; - } - - /** - * Sets an attribute value for the record in the cell at column and row. - * @param aValue The new value. - * @param row The index of row. - * @param column The index of column. - */ - public void setValueAt(Object aValue,int row,int column) - { - mainPanel_.getRemoveButton().setEnabled(false); - - boolean value; - RootPermission user = (RootPermission)userPermissions_.elementAt(row); - String authorityValue = user.getDataAuthority().trim(); - if (authorityValue.equals("*EXCLUDE")|| - authorityValue.equals("*NONE")) - { - read = false; - write = false; - execute = false; - } else - { - if(authorityValue.indexOf("R")>-1) - read = true; - else - read = false; - if(authorityValue.indexOf("W")>-1) - write = true; - else - write = false; - if(authorityValue.indexOf("X")>-1) - execute = true; - else - execute = false; - } - - String string="*"; - switch(column) - { - case 1 : - read = ((Boolean)aValue).booleanValue(); - if (read) - string += "R"; - if (write) - string += "W"; - if (execute) - string += "X"; - if (string.equals("*")) - string += "NONE"; - user.setDataAuthority(string); - break; - case 2 : - write = ((Boolean)aValue).booleanValue(); - if (read) - string += "R"; - if (write) - string += "W"; - if (execute) - string += "X"; - if (string.equals("*")) - string += "NONE"; - user.setDataAuthority(string); - break; - case 3 : - execute = ((Boolean)aValue).booleanValue(); - if (read) - string += "R"; - if (write) - string += "W"; - if (execute) - string += "X"; - if (string.equals("*")) - string += "NONE"; - user.setDataAuthority(string); - break; - case 4 : - value = ((Boolean)aValue).booleanValue(); - user.setManagement(value); - break; - case 5 : - value = ((Boolean)aValue).booleanValue(); - user.setExistence(value); - break; - case 6 : - value = ((Boolean)aValue).booleanValue(); - user.setAlter(value); - break; - case 7 : - value = ((Boolean)aValue).booleanValue(); - user.setReference(value); - break; - case 8 : - value = ((Boolean)aValue).booleanValue(); - user.setFromAuthorizationList(value); - break; - } - // We don't call fireTableCellUpdated because more than one - // cell could have changed due to one of the above sets(). - fireTableRowsUpdated(row, row); - - mainPanel_.getApplyButton().setEnabled(true); - } -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/PopupMenuAdapter.java b/cvsroot/src/com/ibm/as400/vaccess/PopupMenuAdapter.java deleted file mode 100644 index 42133ec52..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/PopupMenuAdapter.java +++ /dev/null @@ -1,180 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PopupMenuAdapter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Component; -import java.awt.Point; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import javax.swing.JMenu; -import javax.swing.JMenuItem; -import javax.swing.JPopupMenu; -import javax.swing.JTable; -import javax.swing.JTree; -import java.io.Serializable; - - - -/** -The PopupMenuAdapter class is a mouse listener that puts up -a popup menu when appropriate. The menu contains some common items -as well as an item for each action that an object supports. -**/ -class PopupMenuAdapter -extends MouseAdapter -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private VActionContext actionContext_; - private VPane pane_; - private VPropertiesAction propertiesAction_; - - - -/** -Constructs a PopupMenuAdapter object. - -@param pane The pane. -@param actionContext The action context. -**/ - public PopupMenuAdapter (VPane pane, - VActionContext actionContext) - { - pane_ = pane; - actionContext_ = actionContext; - propertiesAction_ = new VPropertiesAction (); - } - - - -/** -Processes mouse pressed events. If they are a popup -trigger, then put up the popup menu. - -@param event The event. -**/ - public void mousePressed (MouseEvent event) - { - if (event.isPopupTrigger ()) - showPopupMenu (event.getComponent (), event.getPoint ()); - } - - - -/** -Processes mouse released events. If they are a popup -trigger, then put up the popup menu. - -@param event The event. -**/ - public void mouseReleased (MouseEvent event) - { - if (event.isPopupTrigger ()) - showPopupMenu (event.getComponent (),event.getPoint ()); - } - - - -/** -Shows the popup menu. - -@param component The component. -@param point The point. -**/ - private void showPopupMenu (Component component, Point point) - { - // Initialization. - VObject pointObject = pane_.getObjectAt (point); - VObject rootObject = pane_.getRoot (); - int itemCount = 0; - - // Compute the subject object. This is the point object, - // and if not set, this is the root object. If neither - // is set, then this is null. - VObject subjectObject = null; - if (pointObject != null) - subjectObject = pointObject; - else if (rootObject != null) - { - subjectObject = rootObject; - // root object used, clear any selection. - $A1 - if (component instanceof JTree) - ((JTree)component).getSelectionModel().clearSelection(); - else if (component instanceof JTable) - ((JTable)component).getSelectionModel().clearSelection(); - } - // System.out.println ("Point object = " + pointObject); - // System.out.println ("Root object = " + rootObject); - // System.out.println ("Subject object = " + subjectObject); - - // Create the popup menu. - JPopupMenu menu = new JPopupMenu (); - JMenuItem menuItem; - - // Put up any actions for the subject object. - if (subjectObject != null) { - VAction[] actions = subjectObject.getActions (); - if (actions != null) { - for (int i = 0; i < actions.length; ++i) { - menuItem = new JMenuItem (actions[i].getText ()); - menuItem.addActionListener (new VActionAdapter (actions[i], actionContext_)); - menuItem.setEnabled (actions[i].isEnabled ()); - menu.add (menuItem); - ++itemCount; - } - - if (actions.length > 0) - menu.addSeparator (); - } - } - - // Drag and drop is currently not supported. If and when - // it is, here is some rules for it: - // - // If there is a point object, then put up cut and copy. - // However, enable them only if the point object is a - // potential drag source. - // - // If there is a subject object, then put up paste, - // but only enable it if the subject object is a potential - // drop target for what is currently in the clipboard. - - // Put up properties for the subject object. - if (subjectObject != null) { - menuItem = new JMenuItem (propertiesAction_.getText ()); - if (subjectObject.getPropertiesPane () != null) { - propertiesAction_.setObject (subjectObject); - menuItem.addActionListener (new VActionAdapter (propertiesAction_, actionContext_)); - menuItem.setEnabled (true); - } - else - menuItem.setEnabled (false); - menu.add (menuItem); - ++itemCount; - } - - // Show the menu. - if (itemCount > 0) - menu.show (component, point.x, point.y); - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/PreviousIcon.gif b/cvsroot/src/com/ibm/as400/vaccess/PreviousIcon.gif deleted file mode 100644 index 3a6b26405..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/PreviousIcon.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/PrinterAvailableAction.java b/cvsroot/src/com/ibm/as400/vaccess/PrinterAvailableAction.java deleted file mode 100644 index 3a6cf76a3..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/PrinterAvailableAction.java +++ /dev/null @@ -1,133 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterAvailableAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Printer; -import com.ibm.as400.access.CommandCall; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.Trace; - -/** -The PrinterAvailableAction class represents the releasing of a printer. -The actual affect is to release the writer that is associated with the -printer**/ - -class PrinterAvailableAction -extends AbstractVAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final String displayName_ = ResourceLoader.getText("ACTION_AVAILABLE"); - private Printer printer_ = null; // the printer - -/** -Constructs a PrinterAvailableAction object. - -@param object The object. -@param printer The printer. -**/ - public PrinterAvailableAction (VObject object, Printer printer) - { - super (object); - printer_ = printer; - } - - -/** -Returns the display name for the action. - -@return The display name. -**/ - public String getText () - { - return displayName_; - } - -/** -Performs the action. - -@param context The action context. -**/ - public void perform (VActionContext context) - { - try - { - AS400Message[] messageList; - - // fire started working event - fireStartWorking(); - - // issue the call - CommandCall cmd = new CommandCall( printer_.getSystem()); - String cmdString = "VRYCFG CFGOBJ("+ printer_.getName() + ") "; - cmdString += "CFGTYPE(*DEV) STATUS(*ON) RANGE(*OBJ)"; - try - { - if (cmd.run(cmdString) != true) - { - // Note that there was an error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR VRYCFG cmd for [" + printer_.getName () + "]."); - - // fire an error event - Exception e = new Exception(ResourceLoader.getText("EXC_AS400_ERROR")); - fireError(e); - } - else //@A1A - { - //Everything worked fine - // trace the release - if (Trace.isTraceOn()) //@A1M - Trace.log (Trace.INFORMATION, "Varied On printer [" + printer_.getName () + "].");//@A1M - - fireObjectChanged (); //@A1M - } - - // Trace the messages (returned whether or not there was an error) - if (Trace.isTraceOn()) - { - messageList = cmd.getMessageList(); - for (int i=0; i < messageList.length; i++) - { - // show each message - Trace.log (Trace.INFORMATION, messageList[i].getText()); - } - } - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR CommandCall exception for [" + printer_.getName () + "]."); - - fireError(e); //@A1A - } - - // fire stopped working event - fireStopWorking(); - } // end try block - catch (Exception e) - { - // trace the error - if (Trace.isTraceOn()) - { - Trace.log (Trace.ERROR, "ERROR Varied On printer [" + printer_.getName () + "]."); - } - fireError (e); - } - } - -} // end PrinterAvailableAction class - diff --git a/cvsroot/src/com/ibm/as400/vaccess/PrinterHoldAction.java b/cvsroot/src/com/ibm/as400/vaccess/PrinterHoldAction.java deleted file mode 100644 index 277951ba6..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/PrinterHoldAction.java +++ /dev/null @@ -1,224 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterHoldAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Printer; -import com.ibm.as400.access.CommandCall; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.PrintObject; -import com.ibm.as400.access.Trace; -import javax.swing.ButtonGroup; -import javax.swing.JPanel; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JRadioButton; -import javax.swing.JTextField; -import java.awt.GridBagLayout; -import javax.swing.border.EmptyBorder; -import javax.swing.SwingConstants; - -/** -The PrinterHoldAction class represents the action of holding a printer. -The actual affect is to hold the writer that is associated with the -printer. -**/ -class PrinterHoldAction -extends DialogAction -{ - static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final String displayName_ = ResourceLoader.getText("ACTION_HOLD"); - private static final String prtrToHoldText_ = ResourceLoader.getPrintText("PRINTER_TO_HOLD") + ":"; - private static final String holdPrinterText_ = ResourceLoader.getPrintText("HOLD_PRINTER") + ":"; - private static final String immediatelyText_ = ResourceLoader.getPrintText("IMMEDIATELY"); - private static final String pageEndText_ = ResourceLoader.getPrintText("AT_PAGE_END"); - private static final String copyEndText_ = ResourceLoader.getPrintText("AT_COPY_END"); - - private Printer printer_ = null; // the printer - private JRadioButton immedButton_ = null; // hold immediately - private JRadioButton endPageButton_ = null; // hold at end of page - private JRadioButton endCopyButton_ = null; // hold at end of current copy - -/** -Constructs an PrinterHoldAction object. - -@param object The object. -@param printer The printer. -**/ - public PrinterHoldAction (VObject object, Printer printer ) - { - super (object); - printer_ = printer; - } - - -/** -Returns the component for the dialog box. - -@return The component. -**/ - public JComponent getInputComponent() - { - JPanel panel = new JPanel(); - GridBagLayout layout = new GridBagLayout (); - // GridBagConstraints constraints; - panel.setLayout (layout); - panel.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - // build components to display the printer to be held - VUtilities.constrain( new JLabel(prtrToHoldText_), panel, layout, 0,0,1,1); - - // get the printer name - JTextField text = new JTextField(printer_.getName().trim()); - text.setEditable(false); - VUtilities.constrain( text, panel, layout, 0,1,1,1); - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 2, 2, 1); - // build components to ask user to hold *IMMED or *PAGEEND - VUtilities.constrain( new JLabel(holdPrinterText_), panel, layout, 0,3,1,1); - - immedButton_ = new JRadioButton(immediatelyText_); - immedButton_.setHorizontalAlignment(SwingConstants.LEFT); - immedButton_.setSelected(true); - endPageButton_ = new JRadioButton(pageEndText_); - endPageButton_.setHorizontalAlignment(SwingConstants.LEFT); - endCopyButton_ = new JRadioButton(copyEndText_); - endCopyButton_.setHorizontalAlignment(SwingConstants.LEFT); - - // group the buttons so that only one can be on at a time - ButtonGroup group = new ButtonGroup(); - group.add(immedButton_); - group.add(endPageButton_); - group.add(endCopyButton_); - - VUtilities.constrain( immedButton_, panel, layout, 0,4,1,1); - VUtilities.constrain( endPageButton_, panel, layout, 0,5,1,1); - VUtilities.constrain( endCopyButton_, panel, layout, 0,6,1,1); - } - catch (Exception e) - { - panel = null; - fireError (e); - } - - return panel; - } - - -/** -Returns the display name for the action. - -@return The display name. -**/ - public String getText () - { - return displayName_; - } - -/** -Performs the action. -**/ - public void perform2 () - { - try - { - // fire started working event - fireStartWorking(); - - // We need to get the status of the writer associated with this printer. - String status_ = printer_.getStringAttribute(PrintObject.ATTR_WTRJOBNAME).trim(); - - // If the writer name is null then there is no writer and we - // shouldn't even be here. - if((status_ == null) || ("".equals(status_))) - { - // Trace the error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR No writer for [" + printer_.getName () + "]."); - - Exception e = new Exception(ResourceLoader.getText("EXC_AS400_ERROR")); //@A1A - fireError(e); //@A1A - } - else - { - // The writer exists so issue the call - CommandCall cmd = new CommandCall( printer_.getSystem()); - String cmdString = "HLDWTR WTR("+ printer_.getName() + ") OPTION("; - try - { - // Finish the command string - if (immedButton_.isSelected()) - cmdString += "*IMMED)"; - else if (endPageButton_.isSelected()) - cmdString += "*PAGEEND)"; - else if (endCopyButton_.isSelected()) - cmdString += "*CNTRLD)"; - - if (cmd.run(cmdString)!=true) - { - // Note that there was an error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR HLDWTR cmd for [" + printer_.getName () + "]."); - - // fire an error event - Exception e = new Exception(ResourceLoader.getText("EXC_AS400_ERROR")); - fireError(e); - } - else //@A1A - { - // Everything worked great - // trace the hold - if (Trace.isTraceOn()) //@A1M - Trace.log (Trace.INFORMATION, "Held printer [" + printer_.getName () + "]."); //@A1M - - fireObjectChanged (); //@A1M - } - // Show the messages (returned whether or not there was an error) - if (Trace.isTraceOn()) - { - AS400Message[] messagelist = cmd.getMessageList(); - for (int i=0; i < messagelist.length; i++) - { - // show each message - Trace.log (Trace.INFORMATION, messagelist[i].getText()); //@A1C - } - } - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR CommandCall exception for [" + printer_.getName () + "]."); - - fireError(e); //@A1A - } - } - - // fire stopped working event - fireStopWorking(); - } // end try block - catch (Exception e) - { - // trace the error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR Holding printer [" + printer_.getName () + "]."); - - fireError (e); - } - } - -} // end PrinterHoldAction class - diff --git a/cvsroot/src/com/ibm/as400/vaccess/PrinterOutputPropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/PrinterOutputPropertiesPane.java deleted file mode 100644 index e2f814d98..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/PrinterOutputPropertiesPane.java +++ /dev/null @@ -1,638 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterOutputPropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.SpooledFileList; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.QSYSObjectPathName; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTabbedPane; -import javax.swing.JComboBox; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ItemListener; -import java.awt.event.ItemEvent; -import javax.swing.event.ChangeListener; -import javax.swing.border.EmptyBorder; - - -/** -The PrinterOutputPropertiesPane class represents the property pane -for the VPrinterOutput object. -**/ -class PrinterOutputPropertiesPane -implements VPropertiesPane, ItemListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private VPrinterOutput object_; // our visual object - private SpooledFileList list_; // the list of spooled files - - private JComboBox userFilter_; // user filter - JComboBox outQFilter_; // output queue name filter @A4C - JComboBox outQLibFilter_; // output queue library filter @A4C - private JComboBox formTypeFilter_; // formtype filter - private JComboBox userDataFilter_; // userdata filter - - private boolean disableFeature_; // @A1A - - // Event support. - ChangeEventSupport changeEventSupport_ = new ChangeEventSupport (this); // @A4C - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - // MRI - private static final String includeText_ = ResourceLoader.getPrintText("INCLUDE"); - private static final String userText_ = ResourceLoader.getPrintText("USER") + ":"; - private static final String currentUserText_ = ResourceLoader.getPrintText("CURRENT_USER"); - static final String allText_ = ResourceLoader.getPrintText("ALL"); // @A4C - static final String liblText_ = ResourceLoader.getPrintText("LIBRARY_LIST"); // @A4C - private static final String outQText_ = ResourceLoader.getPrintText("OUTPUT_QUEUE") + ":"; - private static final String outQLibText_ = ResourceLoader.getPrintText("OUTPUT_QUEUE_LIB") + ":"; - private static final String formTypeText_ = ResourceLoader.getPrintText("FORM_TYPE") + ":"; - private static final String standardText_ = ResourceLoader.getPrintText("STANDARD"); - private static final String userSpecDataText_ = ResourceLoader.getPrintText("USER_SPEC_DATA") + ":"; - - // package scoped data - boolean fChanges_; // @A2A - -/** -Constructs an PrinterOutputPropertiesPane object. - -@param object The object. -@param list The spooled file list. -**/ - public PrinterOutputPropertiesPane (VPrinterOutput object, SpooledFileList list) - { - object_ = object; - list_ = list; - disableFeature_ = false; // @A1A - fChanges_ = false; // @A2A - } - -// @A1A Package Scoped constructor -// Constructs an PrinterOutputPropertiesPane object with a flag -// to enable/disable output queue and output queue lib lists. - PrinterOutputPropertiesPane (VPrinterOutput object, SpooledFileList list, boolean disable) - { - object_ = object; - list_ = list; - disableFeature_ = disable; // @A1A - fChanges_ = false; // @A2A - } - -/** -Adds a change listener. - -@param listener The listener. -**/ - public void addChangeListener (ChangeListener listener) - { - changeEventSupport_.addChangeListener (listener); - } - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - -/** -Adds a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - -/** -Applies the changes made by the user. -**/ - public void applyChanges () - throws Exception - { - fChanges_ = false; // indicates an object change event should be fired @A2C - - ////////////////// - // user filter /// - ////////////////// - - // get the previous filter value from the list - String oldUser = list_.getUserFilter().trim(); - - // get the new filter value from the combo box and upper case it - String newUser = (String)userFilter_.getSelectedItem(); - newUser = newUser.trim(); - - // change new value if necessary - if (newUser.equals(currentUserText_)) - newUser = "*CURRENT"; - else if (newUser.equals(allText_)) - newUser = "*ALL"; - - // compare the filters to see if a change is needed, and set as necessary - if (!oldUser.equals(newUser)) - { - list_.setUserFilter(newUser); - fChanges_ = true; // @A2C - } - - if (disableFeature_ == false) // @A1A - { - ////////////////////////// - // Output Queue filter /// - ////////////////////////// - - // get the previous filter value from the list - String oldOutQ = list_.getQueueFilter().trim(); - - // get the new filter values from the combo boxes - String newOutQ = (String)outQFilter_.getSelectedItem(); - String newOutQLib = (String)outQLibFilter_.getSelectedItem(); - newOutQ = newOutQ.trim(); - newOutQLib = newOutQLib.trim(); - - // if outq or outq lib are empty - if ( (newOutQ.equals("")) || (newOutQLib.equals("")) ) - { - // just reset the filter - list_.setQueueFilter(""); - fChanges_ = true; // @A2C - } - else - { - // change the values if necessary - if (newOutQ.equals(allText_)) newOutQ = "%ALL%"; - if (newOutQLib.equals(allText_)) newOutQLib = "%ALL%"; - else if (newOutQLib.equals(liblText_)) newOutQLib = "%LIBL%"; - - // create a QSYSObjectPathName that represents what the user selected - QSYSObjectPathName newOutQPath = new QSYSObjectPathName(newOutQLib, newOutQ, "OUTQ"); - - // compare the filters to see if a change is needed - if (!oldOutQ.equals(newOutQPath.getPath().trim())) - { - // set the new outq and lib -// @A3C newOutQPath.setObjectName(newOutQ); -// @A3C newOutQPath.setLibraryName(newOutQLib); - - // set the new filter - list_.setQueueFilter(newOutQPath.getPath()); - fChanges_ = true; // @A2C - } // end if the filters dont match - } // end else - } - - /////////////////////// - // Form Type filter /// - /////////////////////// - - // get the previous filter value from the list - String oldFormType = list_.getFormTypeFilter().trim(); - - // get the new filter value from the combo box and upper case it - String newFormType = (String)formTypeFilter_.getSelectedItem(); - newFormType = newFormType.trim(); - - // change new value if necessary - if (newFormType.equals(standardText_)) - newFormType = "*STD"; - else if (newFormType.equals(allText_)) - newFormType = "*ALL"; - - // compare the filters to see if a change is needed, and set as necessary - if (!oldFormType.equals(newFormType)) - { - list_.setFormTypeFilter(newFormType); - fChanges_ = true; // @A2C - } - - /////////////////////// - // User Data filter /// - /////////////////////// - - // get the previous filter value from the list - String oldUserData = list_.getUserDataFilter().trim(); - - // get the new filter value from the combo box and upper case it - String newUserData = (String)userDataFilter_.getSelectedItem(); - newUserData = newUserData.trim(); - - // change new value if necessary - if (newUserData.equals(allText_)) - newUserData = "*ALL"; - - // compare the filters to see if a change is needed, and set as necessary - if (!oldUserData.equals(newUserData)) - { - list_.setUserDataFilter(newUserData); - fChanges_ = true; // @A2C - } - - // notify object that there have been changes, if necessary - if (fChanges_ == true) objectEventSupport_.fireObjectChanged(object_); // @A2C - } - -/** -Builds Include pane for the properties pane. -Also used by VPrinter class -**/ - public JPanel buildIncludePane() - { - JPanel thePane = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - thePane.setLayout (layout); - thePane.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - // User filter - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (userText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - userFilter_ = new JComboBox(); - userFilter_.setEditable(true); - userFilter_.addItem(currentUserText_); - userFilter_.addItem(allText_); - - String curUserFilter = list_.getUserFilter().trim(); - if ( (curUserFilter.equals("*CURRENT")) || - (curUserFilter.equals("")) ) - userFilter_.setSelectedItem(currentUserText_); - else if (curUserFilter.equals("*ALL")) - userFilter_.setSelectedItem(allText_); - else - { - userFilter_.addItem(curUserFilter); - userFilter_.setSelectedItem(curUserFilter); - } - - userFilter_.addItemListener(this); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (userFilter_, // @A1C - thePane, - layout, - constraints, - 1,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Output queue and library filter - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (outQText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (outQLibText_),// @A1C - thePane, - layout, - constraints, - 0,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // output queue - outQFilter_ = new JComboBox(); - outQFilter_.setEditable(true); - outQFilter_.addItem(allText_); // all - - // output queue library - outQLibFilter_ = new JComboBox(); - outQLibFilter_.setEditable(true); - outQLibFilter_.addItem(allText_); // all - outQLibFilter_.addItem(liblText_); // library list - - - // retrieve the current filter from the list - String queueFilter = list_.getQueueFilter().trim(); - - // check to see if the filter is set - if (!queueFilter.equals("")) - { - QSYSObjectPathName outQPath = new QSYSObjectPathName(queueFilter); - - // output queue - String curQueueFilter = outQPath.getObjectName(); - - // output queue name can be *ALL or a specific name - if (curQueueFilter.equals("*ALL")) - outQFilter_.setSelectedItem(allText_); - else - { - outQFilter_.addItem(curQueueFilter); - outQFilter_.setSelectedItem(curQueueFilter); - } - - // output queue library - String curQueueLibFilter = outQPath.getLibraryName(); - - // output queue library can be *ALL or *LIBL - if (curQueueLibFilter.equals("*ALL")) - outQLibFilter_.setSelectedItem(allText_); - else if (curQueueLibFilter.equals("*LIBL")) - outQLibFilter_.setSelectedItem(liblText_); - else - { - outQLibFilter_.addItem(curQueueLibFilter); - outQLibFilter_.setSelectedItem(curQueueLibFilter); - } - } // end if filter was set - else // filter was not set, so just select default values - { - // output queue - outQFilter_.setSelectedItem(allText_); - - // output queue library - outQLibFilter_.setSelectedItem(allText_); - } - - // output queue - if (disableFeature_ == true) // @A1A - { - outQFilter_.setEnabled(false); - } - else - { - outQFilter_.addItemListener( new ItemListener () - { - public void itemStateChanged(ItemEvent e) - { - String newOutQ = (String)outQFilter_.getSelectedItem(); - - // check to see if outq is all and outq lib is not all - if ( (newOutQ.trim().equals(allText_)) && - (!outQLibFilter_.getSelectedItem().equals(allText_)) ) - { - // set the outq lib to all - outQLibFilter_.setSelectedItem(allText_); - } - else if ( (!newOutQ.trim().equals(allText_)) && // @A3A - (outQLibFilter_.getSelectedItem().equals(allText_)) ) - { - // set the outq lib to library list - outQLibFilter_.setSelectedItem(liblText_); - } - - // notify that something has changed so the apply button is enabled - changeEventSupport_.fireStateChanged (); - } // end itemStateChanged method - - } // end ItemListener - ); - } - - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (outQFilter_, // @A1C - thePane, - layout, - constraints, - 1,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // output queue Library - if (disableFeature_ == true) // @A1A - { - outQLibFilter_.setEnabled(false); - } - else - { - outQLibFilter_.addItemListener( new ItemListener () - { - public void itemStateChanged(ItemEvent e) - { - String newOutQLib = (String)outQLibFilter_.getSelectedItem(); - - // check to see if outq lib is all and outq is not all - if ( (newOutQLib.trim().equals(allText_)) && - (!outQFilter_.getSelectedItem().equals(allText_)) ) - // set the outq to all - outQFilter_.setSelectedItem(allText_); - - // notify that something has changed so the apply button is enabled - changeEventSupport_.fireStateChanged (); - } // end itemStateChanged method - - } // end ItemListener - ); - } - - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (outQLibFilter_, // @A1C - thePane, - layout, - constraints, - 1,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Form type filter - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (formTypeText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 3,1,1, - constraints.HORIZONTAL, - constraints.WEST); - formTypeFilter_ = new JComboBox(); - formTypeFilter_.setEditable(true); - formTypeFilter_.addItem(allText_); - formTypeFilter_.addItem(standardText_); - - String curFormTypeFilter = list_.getFormTypeFilter().trim(); - if ( (curFormTypeFilter.equals("*ALL")) || - (curFormTypeFilter.equals("")) ) - formTypeFilter_.setSelectedItem(allText_); - else if (curFormTypeFilter.equals("*STD")) - formTypeFilter_.setSelectedItem(standardText_); - else - { - formTypeFilter_.addItem(curFormTypeFilter); - formTypeFilter_.setSelectedItem(curFormTypeFilter); - } - formTypeFilter_.addItemListener(this); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (formTypeFilter_, // @A1C - thePane, - layout, - constraints, - 1,1,1, - 3,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // User-specified data filter - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (userSpecDataText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 4,1,1, - constraints.HORIZONTAL, - constraints.WEST); - userDataFilter_ = new JComboBox(); - userDataFilter_.setEditable(true); - userDataFilter_.addItem(allText_); - - String curUserDataFilter = list_.getUserDataFilter().trim(); - if ( (curUserDataFilter.equals("*ALL")) || - (curUserDataFilter.equals("")) ) - userDataFilter_.setSelectedItem(allText_); - else - { - userDataFilter_.addItem(curUserDataFilter); - userDataFilter_.setSelectedItem(curUserDataFilter); - } - - userDataFilter_.addItemListener(this); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (userDataFilter_, // @A1C - thePane, - layout, - constraints, - 1,1,1, - 4,1,1, - constraints.HORIZONTAL, - constraints.WEST); - } - catch (Exception e) - { - thePane = null; - errorEventSupport_.fireError (e); - } - - return thePane; - } - - -/** -Returns the editor pane. - -@return The properties pane. -@throws Exception If an error occurs. -**/ - public Component getComponent () - { - JTabbedPane tabbedPane = null; - tabbedPane = new JTabbedPane (); - tabbedPane.addTab (includeText_, null, buildIncludePane()); - tabbedPane.setSelectedIndex (0); - return tabbedPane; - } - -/** -catches the state change of combo boxes -**/ - public void itemStateChanged(ItemEvent e) - { - // notify that something has changed so the apply button is enabled - changeEventSupport_.fireStateChanged (); - } - - -/** -Removes a change listener. - -@param listener The listener. - -**/ - public void removeChangeListener (ChangeListener listener) - { - changeEventSupport_.removeChangeListener (listener); - } - -/** -Removes a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - -/** -Removes a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - -/** -Removes a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - -} // end PrinterOutputPropertiesPane class - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/PrinterPropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/PrinterPropertiesPane.java deleted file mode 100644 index 2bc1dac99..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/PrinterPropertiesPane.java +++ /dev/null @@ -1,1243 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterPropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Printer; -import com.ibm.as400.access.PrintObject; -import com.ibm.as400.access.PrinterList; -import com.ibm.as400.access.QSYSObjectPathName; -import com.ibm.as400.access.Trace; - -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTabbedPane; -import javax.swing.JTextField; -import javax.swing.event.ChangeListener; -import javax.swing.border.EmptyBorder; - -import java.awt.Color; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemListener; -import java.awt.event.ItemEvent; - -import java.util.Vector; - - -/** -The PrinterPropertiesPane class represents the property pane -for the PrinterOutput object. -**/ -class PrinterPropertiesPane -implements VPropertiesPane, ItemListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private VPrinter printer_ = null; - private VPrinterOutput printerOutput_ = null; - private static final String indentString_ = " "; - private int overallStatusInt_; - private int deviceStatusInt_; - - // Event support. - private ChangeEventSupport changeEventSupport_ = new ChangeEventSupport (this); - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - // MRI - private static String advFuncPrintingText_ = null; - private static String allowDirectPrintingText_; - private static String betweenFilesText_; - private static String betweenCopiesText_; - private static String changesTakeEffectText_; - private static String curFormTypeText_; - private static String curFormTypeNtfctnText_; - private static String curNumSepPagesText_; - private static String curSepDrawerText_; - private static String curValuesText_; - private static String descriptionText_; - private static String deviceText_; - private static String deviceStatusText_; - private static String endAutomaticallyText_; - private static String endedText_; - private static String endPendingText_; - private static String formsAlignmentText_; - private static String formsText_; - private static String generalText_; - private static String heldText_; - private static String holdPendingText_; - private static String includeText_; - private static String libraryText_; - private static String messageQueueText_; - private static String messageWaitingText_; - private static String nextFormTypeText_; - private static String nextFormTypeNtfctnText_; - private static String nextNumSepPagesText_; - private static String nextOutputQueueText_; - private static String nextSepDrawerText_; - private static String numberText_; - private static String OKText_; - private static String outputQueueText_; - private static String outputQueueLibText_; - private static String outputQueueStatusText_; - private static String printerText_; - private static String printingText_; - private static String separatorsText_; - private static String startedByText_; - private static String statusText_; - private static String typeText_; - private static String userText_; - private static String waitingForDataText_; - private static String waitingForPrinterText_; - private static String waitingOnJobQueueQSPLText_; - private static String writerText_; - private static String writerStatusText_; - - // General pane data - private JLabel printerName_ = null; - private JLabel type_ = null; - private JTextField descTextField_ = null; - private JLabel descLabel_ = null; - private JLabel status_ = null; - private JLabel startedBy_ = null; - private JLabel messageQueue_ = null; - private JLabel library_ = null; - - // Form pane data - private JLabel curFormType_ = null; -// private JComboBox nextFormType_ = null; Not supported yet - private JLabel formsAlignment_ = null; -// private JLabel curFormTypeNtfctn_ = null; Not supported yet -// private JComboBox nextFormTypeNtfctn_ = null; Not supported yet - - // Separators pane data - private JLabel curNumSepPages_ = null; -// private JComboBox nextNumSepPages_ = null; Not supported yet - private JLabel curSepDrawer_ = null; -// private JComboBox nextSepDrawer_ = null; Not supported yet - - // Output Queue pane data - private JLabel outputQueue_ = null; - private JLabel outputQueueLibrary_ = null; - private JLabel outputQueueStatus_ = null; -// private JComboBox nextOutputQueue_ = null; Not supported yet -// private JLabel nextOutputQueueLib_ = null; Not supported yet - - // Writer pane data - private JLabel writer_ = null; - private JLabel user_ = null; - private JLabel number_ = null; - private JList writerStatusList_ = null; - private JButton writerStatusButton_ = null; - private JLabel allowDirectPrinting_ = null; - private JLabel endAutomatically_ = null; - - // Device pane data - private JLabel devPrinter_ = null; - private JLabel devStatus_ = null; - private JLabel devType_ = null; - private JLabel advFuncPrinting_ = null; - -/** -Constructs an PrinterPropertiesPane object. - -@param resource The printer output resource. -@param list spooled file list -**/ - public PrinterPropertiesPane (VPrinter printer, VPrinterOutput printerOutput) - { - printer_ = printer; - printerOutput_ = printerOutput; - } - -/** -Adds a change listener. - -@param listener The listener. -**/ - public void addChangeListener (ChangeListener listener) - { - changeEventSupport_.addChangeListener (listener); - } - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - -/** -Adds a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - -/** -Applies the changes made by the user. -**/ - public void applyChanges () - throws Exception - { - printerOutput_.propertiesPane_.applyChanges(); - if (printerOutput_.propertiesPane_.fChanges_ == true) // @A2A - { - objectEventSupport_.fireObjectChanged(printer_); - } - } - -/** -Builds Device pane for the properties pane -**/ - private JPanel buildDevicePane() - { - JPanel thePane = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - thePane.setLayout (layout); - thePane.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - // Printer - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (printerText_), - thePane, - layout, - constraints, - 0,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - devPrinter_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_PRINTER)); - constraints = new GridBagConstraints(); - VUtilities.constrain (devPrinter_, - thePane, - layout, - constraints, - 1,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Status - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (deviceStatusText_), - thePane, - layout, - constraints, - 0,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - devStatus_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_DEVSTATUS)); - constraints = new GridBagConstraints(); - VUtilities.constrain (devStatus_, - thePane, - layout, - constraints, - 1,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Type - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (typeText_), - thePane, - layout, - constraints, - 0,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.WEST); - devType_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_DEVTYPE)); - constraints = new GridBagConstraints(); - VUtilities.constrain (devType_, - thePane, - layout, - constraints, - 1,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Advanced Function Printing - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (advFuncPrintingText_), - thePane, - layout, - constraints, - 0,1,1, - 3,1,1, - constraints.HORIZONTAL, - constraints.WEST); - advFuncPrinting_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_AFP)); - constraints = new GridBagConstraints(); - VUtilities.constrain (advFuncPrinting_, - thePane, - layout, - constraints, - 1,1,1, - 3,1,1, - constraints.HORIZONTAL, - constraints.WEST); - } - catch (Exception e) - { - thePane = null; - errorEventSupport_.fireError (e); - } - - return thePane; - } - -/** -Builds Forms pane for the properties pane -**/ - private JPanel buildFormsPane() - { - JPanel thePane = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - thePane.setLayout (layout); - thePane.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - // Current form type - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (curFormTypeText_), - thePane, - layout, - constraints, - 0,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - curFormType_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_FORMTYPE)); - constraints = new GridBagConstraints(); - VUtilities.constrain (curFormType_, - thePane, - layout, - constraints, - 1,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - -/* Not supported yet - // Next form type - VUtilities.constrain (new JLabel (nextFormTypeText_), thePane, layout, 0, 1, 1, 1); - if (overallStatusInt_ != printer_.OVERALLSTATUS_MESSAGEWAITING) // ??? - { - nextFormType_ = new JComboBox(); -// nextFormType_.addItem(printer_.getPrinterAttribute(PrintObject.ATTR_)); - nextFormType_.addItem("Unsupported"); - nextFormType_.setSelectedIndex(0); - nextFormType_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_NEXTFORMTYPE)); - VUtilities.constrain (nextFormType_, thePane, layout, 1,1,1,1); - } -*/ - - // Forms alignment - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (formsAlignmentText_), - thePane, - layout, - constraints, - 0,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - formsAlignment_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_ALIGNFORMS)); - constraints = new GridBagConstraints(); - VUtilities.constrain (formsAlignment_, - thePane, - layout, - constraints, - 1,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); -/* - // Current form type notification - VUtilities.constrain (new JLabel (curFormTypeNtfctnText_), thePane, layout, 0, 3, 1, 1); -// curFormTypeNtfctn_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_)); - curFormTypeNtfctn_ = new JLabel("Unsupported"); - VUtilities.constrain (curFormTypeNtfctn_, thePane, layout, 1,3,1,1); -*/ -/* Not supported yet - // Next form type notification - VUtilities.constrain (new JLabel (nextFormTypeNtfctnText_), thePane, layout, 0, 4, 1, 1); - if (overallStatusInt_ != printer_.OVERALLSTATUS_MESSAGEWAITING) // ??? - { - nextFormTypeNtfctn_ = new JComboBox(); -// nextFormTypeNtfctn_.addItem(printer_.getPrinterAttribute(PrintObject.ATTR_)); - nextFormTypeNtfctn_.addItem("Unsupported"); - nextFormTypeNtfctn_.setSelectedIndex(0); - VUtilities.constrain (nextFormTypeNtfctn_, thePane, layout, 1,4,1,1); - } -*/ - } - catch (Exception e) - { - thePane = null; - errorEventSupport_.fireError (e); - } - - return thePane; - } - -/** -Builds General pane for the properties pane -**/ - private JPanel buildGeneralPane() - { - JPanel thePane = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - thePane.setLayout (layout); - thePane.setBorder (new EmptyBorder (10, 10, 10, 10)); - String attrString; - Color backgroundColor; - - try - { - // Printer - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (printerText_), - thePane, - layout, - constraints, - 0,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - printerName_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_PRINTER)); - constraints = new GridBagConstraints(); - VUtilities.constrain (printerName_, - thePane, - layout, - constraints, - 1,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Type - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (typeText_), - thePane, - layout, - constraints, - 0,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - if (deviceStatusInt_ == printer_.DEVICESTATUS_ACTIVE) - { - attrString = printer_.getPrinterAttribute(PrintObject.ATTR_PRTDEVTYPE); - } - else - { - attrString = printer_.getPrinterAttribute(PrintObject.ATTR_DEVTYPE); - } - type_ = new JLabel(attrString); - constraints = new GridBagConstraints(); - VUtilities.constrain (type_, - thePane, - layout, - constraints, - 1,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Description - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (descriptionText_), - thePane, - layout, - constraints, - 0,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.WEST); - descTextField_ = new JTextField(printer_.getPrinterAttribute(PrintObject.ATTR_DESCRIPTION)); - descTextField_.setColumns(20); - descTextField_.setEditable(false); - backgroundColor = thePane.getBackground(); - descTextField_.setBackground(backgroundColor); - constraints = new GridBagConstraints(); - VUtilities.constrain (descTextField_, - thePane, - layout, - constraints, - 1,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Status - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (statusText_), - thePane, - layout, - constraints, - 0,1,1, - 3,1,1, - constraints.HORIZONTAL, - constraints.WEST); - status_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_OVERALLSTS)); - constraints = new GridBagConstraints(); - VUtilities.constrain (status_, - thePane, - layout, - constraints, - 1,1,1, - 3,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - if (deviceStatusInt_ == printer_.DEVICESTATUS_ACTIVE) - { - // Started by - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (startedByText_), - thePane, - layout, - constraints, - 0,1,1, - 4,1,1, - constraints.HORIZONTAL, - constraints.WEST); - startedBy_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_STARTEDBY)); - constraints = new GridBagConstraints(); - VUtilities.constrain (startedBy_, - thePane, - layout, - constraints, - 1,1,1, - 4,1,1, - constraints.HORIZONTAL, - constraints.WEST); - -/* Not supported yet - // Changes take effect - VUtilities.constrain (new JLabel (changesTakeEffectText_), thePane, layout, 0, 5, 1, 1); - changesTakeEffect_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_CHANGES)); - VUtilities.constrain (changesTakeEffect_, thePane, layout, 1,5,1,1); -*/ - // Message queue - QSYSObjectPathName messageQPath = new QSYSObjectPathName(printer_.getPrinterAttribute(PrintObject.ATTR_MESSAGE_QUEUE)); - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (messageQueueText_), - thePane, - layout, - constraints, - 0,1,1, - 6,1,1, - constraints.HORIZONTAL, - constraints.WEST); - messageQueue_ = new JLabel(messageQPath.getObjectName().trim()); - constraints = new GridBagConstraints(); - VUtilities.constrain (messageQueue_, - thePane, - layout, - constraints, - 1,1,1, - 6,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Library - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (indentString_ + libraryText_), - thePane, - layout, - constraints, - 0,1,1, - 7,1,1, - constraints.HORIZONTAL, - constraints.WEST); - library_ = new JLabel(messageQPath.getLibraryName().trim()); - constraints = new GridBagConstraints(); - VUtilities.constrain (library_, - thePane, - layout, - constraints, - 1,1,1, - 7,1,1, - constraints.HORIZONTAL, - constraints.WEST); - } - } - catch (Exception e) - { - thePane = null; - errorEventSupport_.fireError (e); - } - - return thePane; - } - -/** -Builds Output Queue pane for the properties pane -**/ - private JPanel buildOutputQueuePane() - { - JPanel thePane = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - thePane.setLayout (layout); - thePane.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - // Output queue - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (outputQueueText_ + ":"), - thePane, - layout, - constraints, - 0,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - outputQueue_ = new JLabel(printer_.getPrinterOutputQueue()); - constraints = new GridBagConstraints(); - VUtilities.constrain (outputQueue_, - thePane, - layout, - constraints, - 1,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - // Output queue library - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (indentString_ + outputQueueLibText_), - thePane, - layout, - constraints, - 0,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - outputQueueLibrary_ = new JLabel(printer_.getPrinterOutputQueueLib()); - constraints = new GridBagConstraints(); - VUtilities.constrain (outputQueueLibrary_, - thePane, - layout, - constraints, - 1,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - - if (deviceStatusInt_ == printer_.DEVICESTATUS_ACTIVE) - { - // Output queue status - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (outputQueueStatusText_), - thePane, - layout, - constraints, - 0,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.WEST); - outputQueueStatus_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_OUTQSTS)); - constraints = new GridBagConstraints(); - VUtilities.constrain (outputQueueStatus_, - thePane, - layout, - constraints, - 1,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.WEST); - -/* Not supported yet - // Next output queue - VUtilities.constrain (new JLabel (nextOutputQueueText_), thePane, layout, 0, 3, 1, 1); - nextOutputQueue_ = new JComboBox(); -// nextOutputQueue_.addItem(printer_.getPrinterAttribute(PrintObject.ATTR_)); - nextOutputQueue_.addItem("Unsupported"); - nextOutputQueue_.setSelectedIndex(0); - VUtilities.constrain (nextOutputQueue_, thePane, layout, 1,3,1,1); - - // Library - VUtilities.constrain (new JLabel (indentString_ + libraryText_), thePane, layout, 0, 4, 1, 1); -// nextOutputQueueLib_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_)); - nextOutputQueueLib_ = new JLabel("Unsupported"); - VUtilities.constrain (nextOutputQueueLib_, thePane, layout, 1,4,1,1); -*/ - } - } - catch (Exception e) - { - thePane = null; - errorEventSupport_.fireError (e); - } - - return thePane; - } - -/** -Builds Separators pane for the properties pane -**/ - private JPanel buildSeparatorsPane() - { - JPanel thePane = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - thePane.setLayout (layout); - thePane.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - // Current number of separator pages - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (curNumSepPagesText_), - thePane, - layout, - constraints, - 0,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - curNumSepPages_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_FILESEP)); - constraints = new GridBagConstraints(); - VUtilities.constrain (curNumSepPages_, - thePane, - layout, - constraints, - 1,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - -/* Not supported yet - // Next number of separator pages - VUtilities.constrain (new JLabel (nextNumSepPagesText_), thePane, layout, 0, 1, 1, 1); - if (overallStatusInt_ != printer_.OVERALLSTATUS_MESSAGEWAITING) // ??? - { - nextNumSepPages_ = new JComboBox(); -// nextNumSepPages_.addItem(printer_.getPrinterAttribute(PrintObject.ATTR_)); - nextNumSepPages_.addItem("Unsupported"); - nextNumSepPages_.setSelectedIndex(0); - VUtilities.constrain (nextNumSepPages_, thePane, layout, 1,1,1,1); - } -*/ - // Current separator drawer - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (curSepDrawerText_), - thePane, - layout, - constraints, - 0,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - curSepDrawer_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_DRWRSEP)); - constraints = new GridBagConstraints(); - VUtilities.constrain (curSepDrawer_, - thePane, - layout, - constraints, - 1,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.WEST); - -/* Not supported yet - // Next separator drawer - VUtilities.constrain (new JLabel (nextSepDrawerText_), thePane, layout, 0, 3, 1, 1); - if (overallStatusInt_ != printer_.OVERALLSTATUS_MESSAGEWAITING) // ??? - { - nextSepDrawer_ = new JComboBox(); -// nextSepDrawer_.addItem(printer_.getPrinterAttribute(PrintObject.ATTR_)); - nextSepDrawer_.addItem("Unsupported"); - nextSepDrawer_.setSelectedIndex(0); - VUtilities.constrain (nextSepDrawer_, thePane, layout, 1,3,1,1); - } -*/ - } - catch (Exception e) - { - thePane = null; - errorEventSupport_.fireError (e); - } - - return thePane; - } - -/** -Builds Writer pane for the properties pane -**/ - private JPanel buildWriterPane() - { - JPanel thePane = new JPanel (); - thePane = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - thePane.setLayout (layout); - thePane.setBorder (new EmptyBorder (10, 10, 10, 10)); - String attrString, - wtrStatusString; - int index; - Vector writerStatusVector; - Color backgroundColor, - foregroundColor; - - try - { - // Writer - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (writerText_ + ":"), - thePane, - layout, - constraints, - 0,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.NORTHWEST); - writer_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_WTRJOBNAME)); - constraints = new GridBagConstraints(); - VUtilities.constrain (writer_, - thePane, - layout, - constraints, - 1,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.NORTHWEST); - - // User - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (indentString_ + userText_), - thePane, - layout, - constraints, - 0,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.NORTHWEST); - user_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_WTRJOBUSER)); - constraints = new GridBagConstraints(); - VUtilities.constrain (user_, - thePane, - layout, - constraints, - 1,1,1, - 1,1,1, - constraints.HORIZONTAL, - constraints.NORTHWEST); - - // Number - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (indentString_ + numberText_), - thePane, - layout, - constraints, - 0,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.NORTHWEST); - number_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_WTRJOBNUM)); - constraints = new GridBagConstraints(); - VUtilities.constrain (number_, - thePane, - layout, - constraints, - 1,1,1, - 2,1,1, - constraints.HORIZONTAL, - constraints.NORTHWEST); - - // Writer status - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (writerStatusText_ + ":"), - thePane, - layout, - constraints, - 0, 1, 1, - 3, 1, 1, - constraints.HORIZONTAL, - constraints.NORTHWEST); - - writerStatusVector = getWriterStatusVector(); - writerStatusList_ = new JList(writerStatusVector); - writerStatusList_.setEnabled(false); - backgroundColor = thePane.getBackground(); - writerStatusList_.setBackground(backgroundColor); - writerStatusList_.setSelectionBackground(backgroundColor); - foregroundColor = thePane.getForeground(); - writerStatusList_.setSelectionForeground(foregroundColor); - constraints = new GridBagConstraints(); - VUtilities.constrain (writerStatusList_, - thePane, - layout, - constraints, - 1,1,1, - 3,1,1, - constraints.HORIZONTAL, - constraints.NORTHWEST); - - // Allow direct printing - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (allowDirectPrintingText_), - thePane, - layout, - constraints, - 0,1,1, - 4,1,1, - constraints.HORIZONTAL, - constraints.NORTHWEST); - allowDirectPrinting_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_ALWDRTPRT)); - constraints = new GridBagConstraints(); - VUtilities.constrain (allowDirectPrinting_, - thePane, - layout, - constraints, - 1,1,1, - 4,1,1, - constraints.HORIZONTAL, - constraints.NORTHWEST); - - // End automatically - constraints = new GridBagConstraints(); - VUtilities.constrain (new JLabel (endAutomaticallyText_), - thePane, - layout, - constraints, - 0,1,1, - 5,1,1, - constraints.HORIZONTAL, - constraints.NORTHWEST); - endAutomatically_ = new JLabel(printer_.getPrinterAttribute(PrintObject.ATTR_WTRAUTOEND)); - constraints = new GridBagConstraints(); - VUtilities.constrain (endAutomatically_, - thePane, - layout, - constraints, - 1,1,1, - 5,1,1, - constraints.HORIZONTAL, - constraints.NORTHWEST); - } - catch (Exception e) - { - thePane = null; - errorEventSupport_.fireError (e); - } - - return thePane; - } - -/** -Returns the editor pane. - -@return The properties pane. -@throws Exception If an error occurs. -**/ - public Component getComponent () - { - JTabbedPane tabbedPane = null; - loadStrings(); - deviceStatusInt_ = printer_.getPrinterDeviceStatus(); - overallStatusInt_ = printer_.getPrinterOverallStatus(); - - tabbedPane = new JTabbedPane(); - tabbedPane.addTab (generalText_, null, buildGeneralPane()); - if (deviceStatusInt_ == printer_.DEVICESTATUS_ACTIVE) - { - tabbedPane.addTab (formsText_, null, buildFormsPane()); - tabbedPane.addTab (separatorsText_, null, buildSeparatorsPane()); - tabbedPane.addTab (writerText_, null, buildWriterPane()); - } - tabbedPane.addTab (outputQueueText_, null, buildOutputQueuePane()); - tabbedPane.addTab (deviceText_, null, buildDevicePane()); - VPropertiesPane includePane = printerOutput_.getPropertiesPane(); // must do - includePane.addChangeListener(changeEventSupport_); - includePane.addErrorListener(errorEventSupport_); - includePane.addVObjectListener(objectEventSupport_); - includePane.addWorkingListener(workingEventSupport_); - tabbedPane.addTab (includeText_, null, printerOutput_.propertiesPane_.buildIncludePane()); - tabbedPane.setSelectedIndex (0); - return tabbedPane; - } - - private Vector getWriterStatusVector() - { - String attrString; - Vector writerStatusVector = new Vector(); - - attrString = printer_.getPrinterAttribute(PrintObject.ATTR_WTRSTRTD); - if (attrString != null) - { - attrString.trim(); - if (attrString.equals("0")) - { - writerStatusVector.addElement(endedText_); - } - else - { - attrString = printer_.getPrinterAttribute(PrintObject.ATTR_WRTNGSTS); - if (attrString != null) - { - attrString.trim(); - if (!attrString.equals(printer_.splatNOString_)) - { - writerStatusVector.addElement(printingText_); - } - } - attrString = printer_.getPrinterAttribute(PrintObject.ATTR_WTNGMSGSTS); - if (attrString != null) - { - attrString.trim(); - if (!attrString.equals(printer_.splatNOString_)) - { - writerStatusVector.addElement(messageWaitingText_); - } - } - attrString = printer_.getPrinterAttribute(PrintObject.ATTR_HELDSTS); - if (attrString != null) - { - attrString.trim(); - if (!attrString.equals(printer_.splatNOString_)) - { - writerStatusVector.addElement(heldText_); - } - } - attrString = printer_.getPrinterAttribute(PrintObject.ATTR_ENDPNDSTS); - if (attrString != null) - { - attrString.trim(); - if (!attrString.equals(printer_.splatNOString_)) - { - writerStatusVector.addElement(endPendingText_); - } - } - attrString = printer_.getPrinterAttribute(PrintObject.ATTR_HOLDPNDSTS); - if (attrString != null) - { - attrString.trim(); - if (!attrString.equals(printer_.splatNOString_)) - { - writerStatusVector.addElement(holdPendingText_); - } - } - attrString = printer_.getPrinterAttribute(PrintObject.ATTR_BTWNFILESTS); - if (attrString != null) - { - attrString.trim(); - if (!attrString.equals(printer_.splatNOString_)) - { - writerStatusVector.addElement(betweenFilesText_); - } - } - attrString = printer_.getPrinterAttribute(PrintObject.ATTR_BTWNCPYSTS); - if (attrString != null) - { - attrString.trim(); - if (!attrString.equals(printer_.splatNOString_)) - { - writerStatusVector.addElement(betweenCopiesText_); - } - } - attrString = printer_.getPrinterAttribute(PrintObject.ATTR_WTNGDATASTS); - if (attrString != null) - { - attrString.trim(); - if (!attrString.equals(printer_.splatNOString_)) - { - writerStatusVector.addElement(waitingForDataText_); - } - } - attrString = printer_.getPrinterAttribute(PrintObject.ATTR_WTNGDEVSTS); - if (attrString != null) - { - attrString.trim(); - if (!attrString.equals(printer_.splatNOString_)) - { - writerStatusVector.addElement(waitingForPrinterText_); - } - } - attrString = printer_.getPrinterAttribute(PrintObject.ATTR_ONJOBQSTS); - if (attrString != null) - { - attrString = attrString.trim(); - if (!attrString.equals(printer_.splatNOString_)) - { - writerStatusVector.addElement(waitingOnJobQueueQSPLText_); - } - } - } - } - - return writerStatusVector; - } - -/** -catches the state change of combo boxes -**/ - public void itemStateChanged(ItemEvent e) - { - // notify that something has changed so the apply button is enabled - changeEventSupport_.fireStateChanged (); - } - - private synchronized void loadStrings() - { - if (advFuncPrintingText_ == null) - { - try { - advFuncPrintingText_ = ResourceLoader.getPrintText("ADV_FUNC_PRINTING") + ":"; - allowDirectPrintingText_ = ResourceLoader.getPrintText("ALLOW_DIRECT_PRINTING") + ":"; - betweenCopiesText_ = ResourceLoader.getPrintText("BETWEEN_COPIES"); - betweenFilesText_ = ResourceLoader.getPrintText("BETWEEN_FILES"); - changesTakeEffectText_ = ResourceLoader.getPrintText("CHANGES_TAKE_EFFECT") + ":"; - curFormTypeText_ = ResourceLoader.getPrintText("CURRENT_FORM_TYPE") + ":"; - curFormTypeNtfctnText_ = ResourceLoader.getPrintText("CURRENT_FORM_TYPE_NOTIFICATION") + ":"; - curNumSepPagesText_ = ResourceLoader.getPrintText("CURRENT_NUM_SEP_PAGES") + ":"; - curSepDrawerText_ = ResourceLoader.getPrintText("CURRENT_SEPARATOR_DRAWER") + ":"; - curValuesText_ = ResourceLoader.getPrintText("CURRENT_VALUES") + ":"; - descriptionText_ = ResourceLoader.getPrintText("DESCRIPTION") + ":"; - deviceText_ = ResourceLoader.getPrintText("DEVICE"); - deviceStatusText_ = ResourceLoader.getPrintText("DEVICE_STATUS") + ":"; - endAutomaticallyText_ = ResourceLoader.getPrintText("END_AUTOMATICALLY") + ":"; - endPendingText_ = ResourceLoader.getPrintText("END_PENDING"); - endedText_ = ResourceLoader.getPrintText("ENDED"); - formsAlignmentText_ = ResourceLoader.getPrintText("FORMS_ALIGNMENT") + ":"; - formsText_ = ResourceLoader.getPrintText("FORMS"); - generalText_ = ResourceLoader.getPrintText("GENERAL"); - heldText_ = ResourceLoader.getPrintText("HELD"); - holdPendingText_ = ResourceLoader.getPrintText("HOLD_PENDING"); - includeText_ = ResourceLoader.getPrintText("INCLUDE"); - libraryText_ = ResourceLoader.getPrintText("LIBRARY") + ":"; - messageQueueText_ = ResourceLoader.getPrintText("MESSAGE_QUEUE") + ":"; - messageWaitingText_ = ResourceLoader.getPrintText("MESSAGE_WAITING"); - nextFormTypeText_ = ResourceLoader.getPrintText("NEXT_FORM_TYPE") + ":"; - nextFormTypeNtfctnText_ = ResourceLoader.getPrintText("NEXT_FORM_TYPE_NOTIFICATION") + ":"; - nextNumSepPagesText_ = ResourceLoader.getPrintText("NEXT_NUM_SEP_PAGES") + ":"; - nextOutputQueueText_ = ResourceLoader.getPrintText("NEXT_OUTPUT_QUEUE") + ":"; - nextSepDrawerText_ = ResourceLoader.getPrintText("NEXT_SEPARATOR_DRAWER") + ":"; - numberText_ = ResourceLoader.getPrintText("NUMBER") + ":"; - OKText_ = ResourceLoader.getText("DLG_OK"); - outputQueueText_ = ResourceLoader.getPrintText("OUTPUT_QUEUE"); - outputQueueLibText_ = ResourceLoader.getPrintText("OUTPUT_QUEUE_LIB") + ":"; - outputQueueStatusText_ = ResourceLoader.getPrintText("OUTPUT_QUEUE_STATUS") + ":"; - printerText_ = ResourceLoader.getPrintText("PRINTER") + ":"; - printingText_ = ResourceLoader.getPrintText("PRINTING"); - separatorsText_ = ResourceLoader.getPrintText("SEPARATORS"); - startedByText_ = ResourceLoader.getPrintText("STARTED_BY") + ":"; - statusText_ = ResourceLoader.getPrintText("STATUS") + ":"; - typeText_ = ResourceLoader.getPrintText("TYPE") + ":"; - userText_ = ResourceLoader.getPrintText("USER") + ":"; - waitingForDataText_ = ResourceLoader.getPrintText("WAITING_FOR_DATA"); - waitingForPrinterText_ = ResourceLoader.getPrintText("WAITING_FOR_PRINTER"); - waitingOnJobQueueQSPLText_ = ResourceLoader.getPrintText("WAITING_ON_JOB_QUEUE_QSPL"); - writerText_ = ResourceLoader.getPrintText("WRITER"); - writerStatusText_ = ResourceLoader.getPrintText("WRITER_STATUS"); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - } - } - -/** -Removes a change listener. - -@param listener The listener. - -**/ - public void removeChangeListener (ChangeListener listener) - { - changeEventSupport_.removeChangeListener (listener); - } - -/** -Removes a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - -/** -Removes a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - -/** -Removes a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/PrinterReleaseAction.java b/cvsroot/src/com/ibm/as400/vaccess/PrinterReleaseAction.java deleted file mode 100644 index 62863ec33..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/PrinterReleaseAction.java +++ /dev/null @@ -1,147 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterReleaseAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Printer; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.CommandCall; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.PrintObject; - -/** -The PrinterReleaseAction class represents the releasing of a printer. -The actual affect is to release the writer that is associated with the -printer**/ - -class PrinterReleaseAction -extends AbstractVAction -{ - static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final String displayName_ = ResourceLoader.getText("ACTION_RELEASE"); - private Printer printer_ = null; // the printer - -/** -Constructs a PrinterReleaseAction object. - -@param object The object. -@param printer The printer. -**/ - public PrinterReleaseAction (VObject object, Printer printer) - { - super (object); - printer_ = printer; - } - - -/** -Returns the display name for the action. - -@return The display name. -**/ - public String getText () - { - return displayName_; - } - -/** -Performs the action. - -@param context The action context. -**/ - public void perform (VActionContext context) - { - try - { - // fire started working event - fireStartWorking(); - - // We need to get the status of the writer associated with this printer. - String status_ = printer_.getStringAttribute(PrintObject.ATTR_WTRJOBNAME).trim(); - - // If the writer name is null then there is no writer and we - // shouldn't even be here. - if((status_ == null) || (status_.equals(""))) - { - // Trace the error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR No writer for [" + printer_.getName () + "]."); - - Exception e = new Exception(ResourceLoader.getText("EXC_AS400_ERROR")); //@A1A - fireError(e); //@A1A - } - else - { - // The writer exists so issue the call - CommandCall cmd = new CommandCall( printer_.getSystem()); - String cmdString = "RLSWTR WTR("+ printer_.getName() + ")"; - try - { - if (cmd.run(cmdString)!=true) - { - // Note that there was an error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR RLSWTR cmd for [" + printer_.getName () + "]."); - - // fire an error event - Exception e = new Exception(ResourceLoader.getText("EXC_AS400_ERROR")); - fireError(e); - } - else //@A1A - { - // Everything worked great - // trace the release - if (Trace.isTraceOn()) //@A1M - Trace.log (Trace.INFORMATION, "Released printer [" + printer_.getName () + "].");//@A1M - - fireObjectChanged (); //@A1M - } - - // Trace the messages (returned whether or not there was an error) - if (Trace.isTraceOn()) - { - AS400Message[] messagelist = cmd.getMessageList(); - for (int i=0; i < messagelist.length; i++) - { - // show each message - Trace.log (Trace.INFORMATION, messagelist[i].getText()); - } - } - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR CommandCall exception for [" + printer_.getName () + "]."); - - fireError(e); //@A1A - } - } - // fire stopped working event - fireStopWorking(); - - } // end try block - catch (Exception e) - { - // trace the error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR releasing printer [" + printer_.getName () + "]."); - - fireError (e); - } - } - -} // end PrinterReleaseAction class - diff --git a/cvsroot/src/com/ibm/as400/vaccess/PrinterStartAction.java b/cvsroot/src/com/ibm/as400/vaccess/PrinterStartAction.java deleted file mode 100644 index c8c0576f5..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/PrinterStartAction.java +++ /dev/null @@ -1,704 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterStartAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Printer; -import com.ibm.as400.access.CommandCall; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.AS400Message; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import javax.swing.JComponent; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.JTabbedPane; -import javax.swing.border.EmptyBorder; - -/** -The PrinterStartAction class represents the action of starting a writer -for the selected printer. -**/ -class PrinterStartAction -extends DialogAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private static final String displayName_ = ResourceLoader.getText("ACTION_START"); - private static String generalTabText_; // @A2A - private static String prtStartWtrText_; - private static String outQText_; - private static String outQLibText_; - private static String msgQText_; - private static String msgQLibText_; - - private static String libListText_; - private static String curLibText_ ; - private static String prtrDefText_; - private static String userDefText_ ; - private static String dvceDefText_; - private static String fileDefText_ ; - private static String inqMsgTypeText_ ; - private static String inqInfoMsgTypeText_; - private static String infoMsgTypeText_ ; - private static String noneMsgTypeText_; - - private static String formTypeText_; - private static String formTypeNotifyText_; - private static String formTypeAllText_; - private static String formTypeStdText_ ; - private static String formTypeAGBTText_; - - private static String numSepPagesText_; - private static String sepDrawerText_ ; - - // Advanced tab controls - private static String advancedTabText_ ; - private static String autoEndText_ ; - private static String whenToEndText_ ; - private static String directPrintText_; - private static String formAlignText_ ; - private static String firstFileText_ ; - private static String jobNameText_ ; - private static String jobUserText_ ; - private static String jobNumberText_ ; - private static String fileNumberText_ ; - private static String startPageText_; - private static String writerNameText_ ; - - // Advanced pane option strings - private static String noText_ ; - private static String yesText_ ; - private static String onlyText_ ; - private static String afterAllText_; - private static String afterCurrentText_ ; - private static String writerDefText_ ; - private static String onlyFirstFileText_; - private static String fileFirstAvailText_; - private static String fileLastAvailText_ ; - private static String defStartPageText_ ; - private static boolean stringsLoaded_ = false; // Load MRI only once when needed - private Object stringsLock_ = new Object(); - -/* RDS- NOTE: Add "browse" buttons later */ - - private Printer printer_ = null; // the printer - private JComboBox outqBox_ = null; // Output Queue name - private JComboBox outqLibBox_ = null; // Output Queue Library name - private JComboBox msgqBox_ = null; // Message Queue name - private JComboBox msgqLibBox_ = null; // Message Queue Lib name - private JComboBox formTypeBox_ = null; // Form Type - private JComboBox formNotifyBox_ = null; // Form Type notification message - private JComboBox numSepPageBox_ = null; // Number of separator pages - private JComboBox sepDrawerBox_ = null; // Separator Drawer number - - // Advanced start options - private JComboBox writerNameBox_ = null; // Writer name - private JComboBox autoEndBox_ = null; // Automatically end? - private JComboBox whenToEndBox_ = null; // when to end - private JComboBox directPrintBox_ = null; // allow direct printing? - private JComboBox formAlignBox_ = null; // Form alignment - private JComboBox firstFileBox_ = null; // First file to print - private JComboBox fileNumberBox_ = null; // file Number - private JComboBox startingPageBox_ = null; // Starting page number - private JTextField jobNameField_ = null; // Name of owning job - private JTextField jobUserField_ = null; // user name of owning job - private JTextField jobNumberField_ = null; // number of owning job - - - -/** -Constructs an PrinterStartAction object. - -@param object The object. -@param printer The printer. -**/ - public PrinterStartAction (VObject object, Printer printer) - { - super (object); - printer_ = printer; - } - -/* Builds the general settings pane -*/ - private JPanel buildGeneralPane() - throws Exception - { - JPanel panel = new JPanel(); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - panel.setLayout (layout); - panel.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - // build components to display the start writer options - String tempStr = prtStartWtrText_; - VUtilities.constrain( new JLabel(tempStr), panel, layout, 0,0,1,1); - - // get the printer name - JTextField text = new JTextField(printer_.getName().trim()); - text.setEditable(false); - VUtilities.constrain( text, panel, layout, 1,0,1,1); - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 1, 2, 1); - - // The output queue - VUtilities.constrain (new JLabel (outQText_), panel, layout, 0, 2, 1, 1); - outqBox_ = new JComboBox(); - outqBox_.setEditable(true); - outqBox_.addItem(prtrDefText_); - outqBox_.setSelectedItem(prtrDefText_); - VUtilities.constrain( outqBox_, panel, layout, 1,2,1,1); - VUtilities.constrain (new JLabel (outQLibText_), panel, layout, 0, 3, 1, 1); - outqLibBox_ = new JComboBox(); - outqLibBox_.setEditable(true); - outqLibBox_.addItem(libListText_); - outqLibBox_.addItem(curLibText_); - outqLibBox_.setSelectedItem(libListText_); //@A1A - VUtilities.constrain( outqLibBox_, panel, layout, 1,3,1,1); - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 4, 2, 1); - - // The writer message queue - VUtilities.constrain (new JLabel (msgQText_), panel, layout, 0, 5, 1, 1); - msgqBox_ = new JComboBox(); - msgqBox_.setEditable(true); - msgqBox_.addItem(prtrDefText_); - msgqBox_.addItem(userDefText_); - msgqBox_.setSelectedItem(prtrDefText_); - VUtilities.constrain( msgqBox_, panel, layout, 1,5,1,1); - VUtilities.constrain (new JLabel (msgQLibText_), panel, layout, 0, 6, 1, 1); - msgqLibBox_ = new JComboBox(); - msgqLibBox_.setEditable(true); - msgqLibBox_.addItem(libListText_); - msgqLibBox_.addItem(curLibText_); - msgqLibBox_.setSelectedItem(libListText_); //@A1A - VUtilities.constrain( msgqLibBox_, panel, layout, 1,6,1,1); - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 7, 2, 1); - - // The form type boxes - VUtilities.constrain (new JLabel (formTypeText_), panel, layout, 0, 8, 1, 1); - formTypeBox_ = new JComboBox(); - formTypeBox_.setEditable(true); - formTypeBox_.addItem(formTypeAllText_); - formTypeBox_.addItem(formTypeStdText_); - formTypeBox_.addItem(formTypeAGBTText_); - formTypeBox_.setSelectedItem(formTypeAllText_); - VUtilities.constrain( formTypeBox_, panel, layout, 1,8,1,1); - VUtilities.constrain (new JLabel (formTypeNotifyText_), panel, layout, 0, 9, 1, 1); - formNotifyBox_ = new JComboBox(); - formNotifyBox_.setEditable(false); - formNotifyBox_.addItem(inqMsgTypeText_); - formNotifyBox_.addItem(inqInfoMsgTypeText_); - formNotifyBox_.addItem(infoMsgTypeText_); - formNotifyBox_.addItem(noneMsgTypeText_); - VUtilities.constrain( formNotifyBox_, panel, layout, 1,9,1,1); - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 10, 2, 1); - - // The separator page box - VUtilities.constrain (new JLabel (numSepPagesText_), panel, layout, 0, 11, 1, 1); - numSepPageBox_ = new JComboBox(); - numSepPageBox_.setEditable(false); - numSepPageBox_.addItem(fileDefText_); - - // Add 0 thru 9 - for(int i=0; i < 10; i++) numSepPageBox_.addItem(String.valueOf(i)); - - numSepPageBox_.addItem(userDefText_); - VUtilities.constrain( numSepPageBox_, panel, layout, 1,11,1,1); - - // The drawer box - VUtilities.constrain (new JLabel (sepDrawerText_), panel, layout, 0, 12, 1, 1); - sepDrawerBox_ = new JComboBox(); - sepDrawerBox_.setEditable(false); - sepDrawerBox_.addItem(dvceDefText_); - - // Add 255 more drawer choices - for(int i=1; i < 256; i++) sepDrawerBox_.addItem(String.valueOf(i)); - - VUtilities.constrain( sepDrawerBox_, panel, layout, 1,12,1,1); - - // Don't forget to add the browse buttons and advanced dialog someday - } - catch (Exception e) - { - panel = null; - fireError (e); - } - - return panel; - } // end buildGeneralPane() - -/* Builds the advanced settings pane -*/ - private JPanel buildAdvancedPane() - throws Exception - { - JPanel panel = new JPanel(); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - panel.setLayout (layout); - panel.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - // build components to display the start writer advanced options - // The writer name - VUtilities.constrain (new JLabel (writerNameText_), panel, layout, 0, 0, 1, 1); - writerNameBox_ = new JComboBox(); - writerNameBox_.setEditable(true); - writerNameBox_.addItem(prtrDefText_); - writerNameBox_.setSelectedItem(prtrDefText_); - VUtilities.constrain( writerNameBox_, panel, layout, 1,0,1,1); - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 1, 2, 1); - - // Auto end boxes - VUtilities.constrain (new JLabel (autoEndText_), panel, layout, 0, 2, 1, 1); - autoEndBox_ = new JComboBox(); - autoEndBox_.setEditable(false); - autoEndBox_.addItem(noText_); - autoEndBox_.addItem(yesText_); - // autoEndBox_.setSelectedItem(noText_); //@A1D - VUtilities.constrain( autoEndBox_, panel, layout, 1,2,1,1); - VUtilities.constrain (new JLabel (whenToEndText_), panel, layout, 0, 3, 1, 1); - whenToEndBox_ = new JComboBox(); - whenToEndBox_.setEditable(false); - whenToEndBox_.addItem(afterAllText_); - whenToEndBox_.addItem(afterCurrentText_); - // whenToEndBox_.setSelectedItem(afterAllText_); //@A1D - VUtilities.constrain( whenToEndBox_, panel, layout, 1,3,1,1); - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 4, 2, 1); - - // Allow Direct Printing - VUtilities.constrain (new JLabel (directPrintText_), panel, layout, 0, 5, 1, 1); - directPrintBox_ = new JComboBox(); - directPrintBox_.setEditable(false); - directPrintBox_.addItem(noText_); - directPrintBox_.addItem(yesText_); - // directPrintBox_.setSelectedItem(noText_); //@A1D - VUtilities.constrain( directPrintBox_, panel, layout, 1,5,1,1); - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 6, 2, 1); - - // Forms alignment - VUtilities.constrain (new JLabel (formAlignText_), panel, layout, 0, 7, 1, 1); - formAlignBox_ = new JComboBox(); - formAlignBox_.setEditable(false); - formAlignBox_.addItem(fileDefText_); - formAlignBox_.addItem(writerDefText_); - formAlignBox_.addItem(onlyFirstFileText_); - formAlignBox_.setSelectedItem(writerDefText_); - VUtilities.constrain( formAlignBox_, panel, layout, 1,7,1,1); - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 8, 2, 1); - - // The first file to print controls - // First file name - VUtilities.constrain (new JLabel (firstFileText_), panel, layout, 0, 9, 1, 1); - firstFileBox_ = new JComboBox(); - firstFileBox_.setEditable(true); - firstFileBox_.addItem(fileFirstAvailText_); - firstFileBox_.addItem(fileLastAvailText_); - firstFileBox_.setSelectedItem(fileFirstAvailText_); - VUtilities.constrain( firstFileBox_, panel, layout, 1,9,1,1); - - // First file job name - VUtilities.constrain (new JLabel (jobNameText_), panel, layout, 0, 10, 1, 1); - jobNameField_ = new JTextField(10); - jobNameField_.setText("*"); - jobNameField_.setEditable(true); - VUtilities.constrain( jobNameField_, panel, layout, 1,10,1,1); - - // First file job user name - VUtilities.constrain (new JLabel (jobUserText_), panel, layout, 0, 11, 1, 1); - jobUserField_ = new JTextField(10); - jobUserField_.setText(""); - jobUserField_.setEditable(true); - VUtilities.constrain( jobUserField_, panel, layout, 1,11,1,1); - - // First file job number - VUtilities.constrain (new JLabel (jobNumberText_), panel, layout, 0, 12, 1, 1); - jobNumberField_ = new JTextField(10); - jobNumberField_.setText(""); - jobNumberField_.setEditable(true); - VUtilities.constrain( jobNumberField_, panel, layout, 1,12,1,1); - - // First spooled file number - VUtilities.constrain (new JLabel (fileNumberText_), panel, layout, 0, 13, 1, 1); - fileNumberBox_ = new JComboBox(); - fileNumberBox_.setEditable(true); - fileNumberBox_.addItem(onlyText_); - fileNumberBox_.addItem(fileLastAvailText_); - fileNumberBox_.setSelectedItem(onlyText_); - VUtilities.constrain( fileNumberBox_, panel, layout, 1,13,1,1); - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 14, 2, 1); - - // The starting page box - VUtilities.constrain (new JLabel (startPageText_), panel, layout, 0, 15, 1, 1); - startingPageBox_ = new JComboBox(); - startingPageBox_.setEditable(true); - startingPageBox_.addItem(defStartPageText_); - startingPageBox_.setSelectedItem(defStartPageText_); - VUtilities.constrain( startingPageBox_, panel, layout, 1,15,1,1); - - - // Don't forget to add the browse buttons someday - } - catch (Exception e) - { - panel = null; - fireError (e); - } - - return panel; - } // end buildAdvancedPane() - - - - -/** -Returns the component for the dialog box. - -@return The component. -**/ - public JComponent getInputComponent() - { - JTabbedPane tabbedPane = null; - try - { - if(stringsLoaded_ == false) - loadMRI(); - - tabbedPane = new JTabbedPane(); - tabbedPane.addTab (generalTabText_, null, buildGeneralPane()); // @A2C - tabbedPane.addTab (advancedTabText_, null, buildAdvancedPane()); - tabbedPane.setSelectedIndex (0); - return tabbedPane; - } - catch (Exception e) { - tabbedPane = null; - fireError (e); - } - return tabbedPane; - } - - -/** -Returns the display name for the action. - -@return The display name. -**/ - public String getText () - { - return displayName_; - } - -/* -Loads the MRI strings. This is called only once per class -*/ - private void loadMRI() - { - synchronized (stringsLock_) - { - prtStartWtrText_ = ResourceLoader.getPrintText("PRINTER_TO_START")+ ":"; - generalTabText_ = ResourceLoader.getPrintText("GENERAL"); // @A2A - outQText_ = ResourceLoader.getPrintText("OUTPUT_QUEUE") + ":"; - outQLibText_ = ResourceLoader.getPrintText("OUTPUT_QUEUE_LIB")+ ":"; - msgQText_ = ResourceLoader.getText("MESSAGE_QUEUE_DESCRIPTION")+ ":"; - msgQLibText_ = ResourceLoader.getPrintText("MESSAGE_QUEUE_LIB_DESCRIPTION") + ":"; - - libListText_ = ResourceLoader.getPrintText("USE_LIBRARY_LIST"); - curLibText_ = ResourceLoader.getPrintText("USE__CURRENT_LIBRARY"); - prtrDefText_ = ResourceLoader.getPrintText("PRINTER_DEFAULT"); - userDefText_ = ResourceLoader.getPrintText("USER_DEFAULT"); - dvceDefText_ = ResourceLoader.getPrintText("DEVICE_DEFAULT"); - fileDefText_ = ResourceLoader.getPrintText("FILE_DEFAULT"); - inqMsgTypeText_ = ResourceLoader.getPrintText("MESSAGE_TYPE_INQUIRY"); - inqInfoMsgTypeText_ = ResourceLoader.getPrintText("MESSAGE_TYPE_INQ_INFO"); - infoMsgTypeText_ = ResourceLoader.getPrintText("MESSAGE_TYPE_INFO"); - noneMsgTypeText_ = ResourceLoader.getPrintText("MESSAGE_TYPE_NONE"); - - formTypeText_ = ResourceLoader.getPrintText("FORM_TYPE")+ ":"; - formTypeNotifyText_ = ResourceLoader.getPrintText("FORM_TYPE_NOTIFY")+ ":"; - formTypeAllText_ = ResourceLoader.getPrintText("FORM_TYPE_ALL"); - formTypeStdText_ = ResourceLoader.getPrintText("FORM_TYPE_STANDARD"); - formTypeAGBTText_ = ResourceLoader.getPrintText("FORM_TYPE_ALL_GBT"); - - numSepPagesText_ = ResourceLoader.getPrintText("NUMBER_OF_SEP_PAGES")+ ":"; - sepDrawerText_ = ResourceLoader.getPrintText("SEPARATOR_DRAWER") + ":"; - - // Advanced tab controls - advancedTabText_ = ResourceLoader.getPrintText("ADVANCED"); - autoEndText_ = ResourceLoader.getPrintText("WRITER_AUTO_END") + ":"; - whenToEndText_ = ResourceLoader.getPrintText("WRITER_WHEN_TO_END") + ":"; - directPrintText_ = ResourceLoader.getPrintText("DIRECT_PRINT") + ":"; - formAlignText_ = ResourceLoader.getPrintText("FORM_ALIGN") + ":"; - firstFileText_ = ResourceLoader.getPrintText("FIRST_FILE_NAME") + ":"; - jobNameText_ = ResourceLoader.getPrintText("FIRST_JOB_NAME") + ":"; - jobUserText_ = ResourceLoader.getPrintText("FIRST_JOB_USER") + ":"; - jobNumberText_ = ResourceLoader.getPrintText("FIRST_JOB_NUMBER") + ":"; - fileNumberText_ = ResourceLoader.getPrintText("FIRST_FILE_NUMBER") + ":"; - startPageText_ = ResourceLoader.getPrintText("FIRST_START_PAGE") + ":"; - writerNameText_ = ResourceLoader.getPrintText("WRITER_NAME") + ":"; - - // Advanced pane option strings - noText_ = ResourceLoader.getPrintText("NO"); - yesText_ = ResourceLoader.getPrintText("YES"); - onlyText_ = ResourceLoader.getPrintText("ONLY"); - afterAllText_ = ResourceLoader.getPrintText("FILE_AFTER_ALL"); - afterCurrentText_ = ResourceLoader.getPrintText("FILE_AFTER_CURRENT"); - writerDefText_ = ResourceLoader.getPrintText("WRITER_DEFAULT"); - onlyFirstFileText_ = ResourceLoader.getPrintText("FILE_FORM_ALIGNMENT"); - fileFirstAvailText_ = ResourceLoader.getPrintText("FILE_FIRST_AVAILABLE"); - fileLastAvailText_ = ResourceLoader.getPrintText("FILE_LAST"); - defStartPageText_ = ResourceLoader.getPrintText("DEF_START_PAGE"); - stringsLoaded_ = true; - } - } // endof loadMRI() - -/** -Performs the action. -**/ - public void perform2 () - { - try - { - String selectedItem = null; - String selectedItem2 = null; - - // fire started working event - fireStartWorking(); - - // Create a string that contains the command, printer name, and all parameters - StringBuffer cmdString_ = new StringBuffer("STRPRTWTR DEV(" + printer_.getName().trim() + ") OUTQ("); - - // Get the outq - selectedItem = (String)outqBox_.getModel().getSelectedItem(); - - if((selectedItem == null) || (selectedItem.equals(prtrDefText_))) - cmdString_.append("*DEV) MSGQ("); - else - { - // The user typed in an outq - // Get the outq Library - selectedItem2 = (String)outqLibBox_.getModel().getSelectedItem(); - - if(selectedItem2.equals(libListText_)) - cmdString_.append("*LIBL/"); - else if(selectedItem2.equals(curLibText_)) - cmdString_.append("*CURLIB/"); - else if(selectedItem2.equals("")) - cmdString_.append("*LIBL/"); - else - cmdString_.append(selectedItem2 + "/"); - - // Now add the outq name - cmdString_.append(selectedItem + ") MSGQ("); - } - - // Get the message queue - selectedItem = (String)msgqBox_.getModel().getSelectedItem(); - - if((selectedItem == null) || (selectedItem.equals(prtrDefText_))) - cmdString_.append("*DEVD) FORMTYPE("); - else if(selectedItem.equals(userDefText_)) - cmdString_.append("*REQUESTER) FORMTYPE("); - else - { - // The user typed in an msgq - // Get the msgq Library - selectedItem2 = (String)msgqLibBox_.getModel().getSelectedItem(); - - if(selectedItem2.equals(libListText_)) - cmdString_.append("*LIBL/"); - else if(selectedItem2.equals(curLibText_)) - cmdString_.append("*CURLIB/"); - else if(selectedItem2.equals("")) - cmdString_.append("*LIBL/"); - else - cmdString_.append(selectedItem2 + "/"); - - // Now add the msgq name - cmdString_.append(selectedItem + ") FORMTYPE("); - } - - // Get the form type - selectedItem = (String)formTypeBox_.getModel().getSelectedItem(); - - if((selectedItem == null) || (selectedItem.equals(formTypeAllText_))) - cmdString_.append("*ALL "); - else if(selectedItem.equals(formTypeStdText_)) - cmdString_.append("*STD "); - else if(selectedItem.equals(formTypeAGBTText_)) - cmdString_.append("*FORMS "); - else - cmdString_.append(selectedItem + " "); - - // Get the form message type - selectedItem = (String)formNotifyBox_.getModel().getSelectedItem(); - - if((selectedItem == null) || (selectedItem.equals(inqMsgTypeText_))) - cmdString_.append("*INQMSG) FILESEP("); - else if(selectedItem.equals(inqInfoMsgTypeText_)) - cmdString_.append("*MSG) FILESEP("); - else if(selectedItem.equals(infoMsgTypeText_)) - cmdString_.append("*INFOMSG) FILESEP("); - else - cmdString_.append("*NOMSG) FILESEP("); - - // Get the number of separator pages - selectedItem = (String)numSepPageBox_.getModel().getSelectedItem(); - - if((selectedItem == null) || (selectedItem.equals(fileDefText_))) - cmdString_.append("*FILE) SEPDRAWER("); - else - cmdString_.append(selectedItem + ") SEPDRAWER("); - - // Get the separator source drawer - selectedItem = (String)sepDrawerBox_.getModel().getSelectedItem(); - - if((selectedItem == null) || (selectedItem.equals(dvceDefText_))) - cmdString_.append("*DEVD)"); - else if(selectedItem.equals(fileDefText_)) - cmdString_.append("*FILE)"); - else - cmdString_.append(selectedItem + ")"); - - // Get the advanced options - // Writer name - selectedItem = (String)writerNameBox_.getModel().getSelectedItem(); - - if((selectedItem != null) && (!selectedItem.equals(prtrDefText_))) - cmdString_.append(" WTR(" + selectedItem + ")"); - - // Auto End - selectedItem = (String)autoEndBox_.getModel().getSelectedItem(); - - if((selectedItem != null) && (!selectedItem.equals(noText_))) - { - cmdString_.append(" AUTOEND(*YES "); - selectedItem = (String)whenToEndBox_.getModel().getSelectedItem(); - - if(selectedItem.equals(afterCurrentText_)) - cmdString_.append("*FILEEND)"); - else - cmdString_.append("*NORDYF)"); - } - - // Direct Printing - selectedItem = (String)directPrintBox_.getModel().getSelectedItem(); - - if((selectedItem != null) && (selectedItem.equals(yesText_))) - cmdString_.append(" ALWDRTPRT(*YES)"); - - // Forms alignment - selectedItem = (String)formAlignBox_.getModel().getSelectedItem(); - - if(selectedItem != null) - { - if(selectedItem.equals(fileDefText_)) - cmdString_.append(" ALIGN(*FILE)"); - else if(!selectedItem.equals(onlyFirstFileText_)) - cmdString_.append(" ALIGN(*FIRST)"); - } - else cmdString_.append(" ALIGN(*FIRST)"); - - // First file to print boxes - selectedItem = (String)firstFileBox_.getModel().getSelectedItem(); - - if((selectedItem != null) && (!selectedItem.equals(fileFirstAvailText_))) - { - if(selectedItem.equals(fileLastAvailText_)) - cmdString_.append(" FILE(*LAST)"); - else - { - // The user specified a file so get all the parms - cmdString_.append(" FILE(" + selectedItem + ") JOB("); - cmdString_.append(jobNumberField_.getText() + "/"); - cmdString_.append(jobUserField_.getText() + "/"); - cmdString_.append(jobNameField_.getText() + ") SPLNBR("); - selectedItem = (String)fileNumberBox_.getModel().getSelectedItem(); - - if(selectedItem.equals(onlyText_)) - cmdString_.append("*ONLY)"); - else if(selectedItem.equals(fileLastAvailText_)) - cmdString_.append("*LAST)"); - else - cmdString_.append(selectedItem + ")"); // @A2C - } - } - - // Starting page - selectedItem = (String)startingPageBox_.getModel().getSelectedItem(); - - if((selectedItem != null) && (!selectedItem.equals(defStartPageText_))) //@A1C - cmdString_.append(" PAGE(" + selectedItem + ")"); - - - // send the command to start the writer - CommandCall cmd = new CommandCall( printer_.getSystem()); - try - { - if (cmd.run(cmdString_.toString())!=true) - { - // Note that there was an error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "STRPRTWTR cmd=false for [" + printer_.getName () + "]."); - - // fire an error event - Exception e = new Exception(ResourceLoader.getText("EXC_AS400_ERROR")); - fireError(e); - } - else //@A1A - { - // trace the send - if (Trace.isTraceOn()) //@A1M - Trace.log (Trace.INFORMATION, "Started writer for printer[" + printer_.getName() + "].");//@A1M - - fireObjectChanged (); //@A1M - } - - // Trace the messages (returned whether or not there was an error) - if (Trace.isTraceOn()) - { - AS400Message[] messagelist = cmd.getMessageList(); - for (int i=0; i < messagelist.length; i++) - { - // show each message - Trace.log (Trace.INFORMATION, messagelist[i].getText()); - } - } - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR CommandCall exception for starting [" + printer_.getName () + "]."); - - fireError(e); //@A1M - } - - // fire stopped working event - fireStopWorking(); - } // end try block - catch (Exception e) - { - // trace the error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR Starting writer for printer [" + printer_.getName () + "]."); - - fireError (e); - } - } - -} // end PrinterStartAction class - diff --git a/cvsroot/src/com/ibm/as400/vaccess/PrinterStopAction.java b/cvsroot/src/com/ibm/as400/vaccess/PrinterStopAction.java deleted file mode 100644 index 0cddbc3d9..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/PrinterStopAction.java +++ /dev/null @@ -1,251 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterStopAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Printer; -import com.ibm.as400.access.CommandCall; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.PrintObject; - -import javax.swing.JRadioButton; -import javax.swing.ButtonGroup; -import javax.swing.JPanel; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JTextField; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import javax.swing.border.EmptyBorder; -import javax.swing.SwingConstants; - -/** -The PrinterStopAction class represents the action of holding a printer. -The actual affect is to hold the writer that is associated with the -printer. -**/ -class PrinterStopAction -extends DialogAction -{ - static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final String displayName_ = ResourceLoader.getText("ACTION_STOP"); - private static String prtrToStopText_ = ResourceLoader.getPrintText("PRINTER_TO_STOP") + ":"; - private static String stopPrinterText_ = ResourceLoader.getPrintText("STOP_PRINTING") + ":"; - private static String immediatelyText_ = ResourceLoader.getPrintText("IMMEDIATELY"); - private static String pageEndText_ = ResourceLoader.getPrintText("AT_PAGE_END"); - private static String copyEndText_ = ResourceLoader.getPrintText("AT_COPY_END"); - - private static boolean stringsLoaded_ = false; // Load MRI only once when needed - private Object stringsLock_ = new Object(); - - private Printer printer_ = null; // the printer - private JRadioButton immedButton_ = null; // end immediately - private JRadioButton endPageButton_ = null; // end at end of page - private JRadioButton endCopyButton_ = null; // end at end of current copy - -/** -Constructs an PrinterStopAction object. - -@param object The object. -@param printer The printer. -**/ - public PrinterStopAction (VObject object, Printer printer ) - { - super (object); - printer_ = printer; - } - - -/** -Returns the component for the dialog box. - -@return The component. -**/ - public JComponent getInputComponent() - { - JPanel panel = new JPanel(); - GridBagLayout layout = new GridBagLayout (); - // GridBagConstraints constraints; - panel.setLayout (layout); - panel.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try - { - if(stringsLoaded_ == false) - loadMRI(); - - // build components to display the printer to be held - VUtilities.constrain( new JLabel(prtrToStopText_), panel, layout, 0,0,1,1); - - // get the printer name - JTextField text = new JTextField(printer_.getName().trim()); - text.setEditable(false); - VUtilities.constrain( text, panel, layout, 1,0,1,1); - VUtilities.constrain (new JLabel (" "), panel, layout, 0, 1, 2, 1); - - // build components to ask user to hold *IMMED or *PAGEEND - VUtilities.constrain( new JLabel(stopPrinterText_), panel, layout, 0,2,1,1); - - immedButton_ = new JRadioButton(immediatelyText_); - immedButton_.setHorizontalAlignment(SwingConstants.LEFT); - immedButton_.setSelected(true); - endPageButton_ = new JRadioButton(pageEndText_); - endPageButton_.setHorizontalAlignment(SwingConstants.LEFT); - endCopyButton_ = new JRadioButton(copyEndText_); - endCopyButton_.setHorizontalAlignment(SwingConstants.LEFT); - - // group the buttons so that only one can be on at a time - ButtonGroup group = new ButtonGroup(); - group.add(immedButton_); - group.add(endPageButton_); - group.add(endCopyButton_); - - VUtilities.constrain( immedButton_, panel, layout, 0,3,1,1); - VUtilities.constrain( endPageButton_, panel, layout, 0,4,1,1); - VUtilities.constrain( endCopyButton_, panel, layout, 0,5,1,1); - } - catch (Exception e) - { - panel = null; - fireError (e); - } - - return panel; - } - - -/** -Returns the display name for the action. - -@return The display name. -**/ - public String getText () - { - return displayName_; - } - - -/* -Loads the MRI strings. This is called only once per class -*/ - private void loadMRI() - { - synchronized (stringsLock_) - { - prtrToStopText_ = ResourceLoader.getPrintText("PRINTER_TO_STOP") + ":"; - stopPrinterText_ = ResourceLoader.getPrintText("STOP_PRINTING") + ":"; - immediatelyText_ = ResourceLoader.getPrintText("IMMEDIATELY"); - pageEndText_ = ResourceLoader.getPrintText("AT_PAGE_END"); - copyEndText_ = ResourceLoader.getPrintText("AT_COPY_END"); - stringsLoaded_ = true; - } - } - -/** -Performs the action. -**/ - public void perform2 () - { - try { - // fire started working event - fireStartWorking(); - - // We need to get the status of the writer associated with this printer. - String status_ = printer_.getStringAttribute(PrintObject.ATTR_WTRJOBNAME).trim(); - - // If the writer name is null then there is no writer and we - // shouldn't even be here. - if((status_ == null) || (status_.equals(""))) - { - // Trace the error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR No writer for [" + printer_.getName () + "]."); - - // fire an error event - Exception e = new Exception(ResourceLoader.getText("EXC_AS400_ERROR")); //@A1A - fireError(e); //@A1A - } - else - { - // The writer exists so issue the call - CommandCall cmd = new CommandCall( printer_.getSystem()); - String cmdString = "ENDWTR WTR("+ printer_.getName() + ") OPTION("; - try - { - // Finish the command string - if (immedButton_.isSelected()) - cmdString += "*IMMED)"; - else if (endPageButton_.isSelected()) - cmdString += "*PAGEEND)"; - else if (endCopyButton_.isSelected()) - cmdString += "*CNTRLD)"; - - if (cmd.run(cmdString)!=true) - { - // Note that there was an error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR ENDWTR cmd for [" + printer_.getName () + "]."); - - // fire an error event - Exception e = new Exception(ResourceLoader.getText("EXC_AS400_ERROR")); - fireError(e); - } - else - { - //Everything worked fine - // trace the hold - if (Trace.isTraceOn()) //@A1M - Trace.log (Trace.INFORMATION, "Stopped printer [" + printer_.getName () + "].");//@A1M - - fireObjectChanged (); //@A1M - } - - // Show the messages (returned whether or not there was an error) - if (Trace.isTraceOn()) - { - AS400Message[] messagelist = cmd.getMessageList(); - for (int i=0; i < messagelist.length; i++) - { - // show each message - Trace.log (Trace.INFORMATION, messagelist[i].getText()); - } - } - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR CommandCall exception for [" + printer_.getName () + "]."); - - fireError(e); //@A1A - } - } - - // fire stopped working event - fireStopWorking(); - } // end try block - catch (Exception e) - { - // trace the error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR Stopping printer [" + printer_.getName () + "]."); - - fireError (e); - } - } - -} // end PrinterStopAction class - diff --git a/cvsroot/src/com/ibm/as400/vaccess/PrinterUnavailableAction.java b/cvsroot/src/com/ibm/as400/vaccess/PrinterUnavailableAction.java deleted file mode 100644 index b5b529b92..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/PrinterUnavailableAction.java +++ /dev/null @@ -1,130 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrinterUnavailableAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Printer; -import com.ibm.as400.access.CommandCall; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.Trace; - -/** -The PrinterUnavailableAction class represents the releasing of a printer. -The actual affect is to release the writer that is associated with the -printer**/ - -class PrinterUnavailableAction -extends AbstractVAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private static final String displayName_ = ResourceLoader.getText("ACTION_UNAVAILABLE"); - private Printer printer_ = null; // the printer - -/** -Constructs a PrinterUnavailableAction object. - -@param object The object. -@param printer The printer. -**/ - public PrinterUnavailableAction (VObject object, Printer printer) - { - super (object); - printer_ = printer; - } - - -/** -Returns the display name for the action. - -@return The display name. -**/ - public String getText () - { - return displayName_; - } - -/** -Performs the action. - -@param context The action context. -**/ - public void perform (VActionContext context) - { - try - { - // fire started working event - fireStartWorking(); - - // issue the call - CommandCall cmd = new CommandCall( printer_.getSystem()); - String cmdString = "VRYCFG CFGOBJ("+ printer_.getName() + ") "; - cmdString += "CFGTYPE(*DEV) STATUS(*OFF) RANGE(*OBJ)"; - try - { - if (cmd.run(cmdString)!=true) - { - // Note that there was an error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR VRYCFG cmd for [" + printer_.getName () + "]."); - - // fire an error event - Exception e = new Exception(ResourceLoader.getText("EXC_AS400_ERROR")); - fireError(e); - } - else //@A1A - { - //Everything is rosy - // trace the release - if (Trace.isTraceOn()) //@A1M - Trace.log (Trace.INFORMATION, "Varied Off printer [" + printer_.getName () + "].");//@A1M - - fireObjectChanged (); //@A1M - } - - // Trace the messages (returned whether or not there was an error) - if (Trace.isTraceOn()) - { - AS400Message[] messagelist = cmd.getMessageList(); - for (int i=0; i < messagelist.length; i++) - { - // show each message - Trace.log (Trace.INFORMATION, messagelist[i].getText()); - } - } - } - catch (Exception e) - { - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR CommandCall exception for [" + printer_.getName () + "]."); - - fireError(e); //@A1A - } - - // fire stopped working event - fireStopWorking(); - } // end try block - catch (Exception e) - { - // trace the error - if (Trace.isTraceOn()) - Trace.log (Trace.ERROR, "ERROR Varied Off printer [" + printer_.getName () + "]."); - - fireError (e); - } - } - -} // end PrinterUnavailableAction class - diff --git a/cvsroot/src/com/ibm/as400/vaccess/PrintersPropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/PrintersPropertiesPane.java deleted file mode 100644 index a17a886e1..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/PrintersPropertiesPane.java +++ /dev/null @@ -1,280 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PrintersPropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.PrinterList; -import com.ibm.as400.access.Trace; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTabbedPane; -import javax.swing.JComboBox; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ItemListener; -import java.awt.event.ItemEvent; -import javax.swing.event.ChangeListener; -import javax.swing.border.EmptyBorder; - - - -/** -The PrintersPropertiesPane class represents the property pane -for the PrinterOutput object. -**/ -class PrintersPropertiesPane -implements VPropertiesPane, ItemListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private VPrinters object_; - private PrinterList list_; - - private JComboBox printerFilter_; - private String printerFilterString_; - - // Event support. - private ChangeEventSupport changeEventSupport_ = new ChangeEventSupport (this); - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - // MRI - private static final String includeText_ = ResourceLoader.getPrintText("INCLUDE"); - private static final String printerText_ = ResourceLoader.getPrintText("PRINTER") + ":"; - private static final String allText_ = ResourceLoader.getPrintText("ALL"); - -/** -Constructs an PrintersPropertiesPane object. - -@param resource The printer output resource. -@param list spooled file list -**/ - public PrintersPropertiesPane (VPrinters object, PrinterList list) - { - object_ = object; - list_ = list; - } - -/** -Adds a change listener. - -@param listener The listener. -**/ - public void addChangeListener (ChangeListener listener) - { - changeEventSupport_.addChangeListener (listener); - } - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - -/** -Adds a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - -/** -Applies the changes made by the user. -**/ - public void applyChanges () - throws Exception - { - ///////////////////// - // Printer filter /// - ///////////////////// - - // get the previous filter value from the list - String oldPrinter = list_.getPrinterFilter().trim(); - - // get the new filter value from the combo box and upper case it - String newPrinter = (String)printerFilter_.getModel().getSelectedItem(); - - // change new value if necessary - if (newPrinter.trim().equals(allText_)) - newPrinter = "*ALL"; - - // compare the filters to see if a change is needed, and set as necessary - if (!oldPrinter.equals(newPrinter.trim())) - { - list_.setPrinterFilter(newPrinter); - - // notify object that there have been changes - objectEventSupport_.fireObjectChanged((VObject)object_); - } - } - -/** -Builds Include pane for the properties pane -**/ - private JPanel buildIncludePane() - { - JPanel thePane = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - thePane.setLayout (layout); - thePane.setBorder (new EmptyBorder (10, 10, 10, 10)); - - try { - // Printer filter - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (new JLabel (printerText_), // @A1C - thePane, - layout, - constraints, - 0,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - printerFilter_ = new JComboBox(); - printerFilter_.setEditable(true); - printerFilter_.addItem(allText_); - printerFilter_.addItemListener(this); - - String curPrinterFilter = list_.getPrinterFilter().trim(); - if (curPrinterFilter.equals("*ALL") || - curPrinterFilter.equals("")) // added because default filter is "" - printerFilter_.setSelectedItem(allText_); - else - { - printerFilter_.addItem(curPrinterFilter); - printerFilter_.setSelectedItem(curPrinterFilter); - } - - printerFilter_.addItemListener(this); - constraints = new GridBagConstraints(); // @A1A - VUtilities.constrain (printerFilter_, // @A1C - thePane, - layout, - constraints, - 1,1,1, - 0,1,1, - constraints.HORIZONTAL, - constraints.WEST); - } - catch (Exception e) - { - thePane = null; - errorEventSupport_.fireError (e); - } - - return thePane; - } - -/** -Returns the editor pane. - -@return The properties pane. -@throws Exception If an error occurs. -**/ - public Component getComponent () - { - JTabbedPane tabbedPane = null; - tabbedPane = new JTabbedPane(); - tabbedPane.addTab (includeText_, null, buildIncludePane()); - tabbedPane.setSelectedIndex (0); - return tabbedPane; - } - -/** -catches the state change of combo boxes -**/ - public void itemStateChanged(ItemEvent e) - { - // notify that something has changed so the apply button is enabled - changeEventSupport_.fireStateChanged (); - } - - -/** -Removes a change listener. - -@param listener The listener. - -**/ - public void removeChangeListener (ChangeListener listener) - { - changeEventSupport_.removeChangeListener (listener); - } - -/** -Removes a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - -/** -Removes a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - -/** -Removes a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -} // end PrintersPropertiesPane class - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/ProgramCallButton.java b/cvsroot/src/com/ibm/as400/vaccess/ProgramCallButton.java deleted file mode 100644 index bcc173fd9..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ProgramCallButton.java +++ /dev/null @@ -1,429 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProgramCallButton.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.ActionCompletedListener; -import com.ibm.as400.access.ActionCompletedEvent; -import com.ibm.as400.access.ProgramCall; -import com.ibm.as400.access.ProgramParameter; -import javax.swing.Icon; -import javax.swing.JButton; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; - - - -/** -The ProgramCallButton class represents a button -that calls a program when pressed. -Results of the program are returned in a message list. - -

    ProgramCallButton objects generate the following events: -

      -
    • ActionCompletedEvent -
    • ErrorEvent -
    • PropertyChangeEvent -
    - -@see com.ibm.as400.access.ProgramCall -@see com.ibm.as400.access.AS400Message -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class ProgramCallButton -extends JButton -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Properties. - ProgramCall program_ = null; // Private. - - - - // Event support. - transient ActionCompletedEventSupport actionCompletedEventSupport_; // Private. - transient ErrorEventSupport errorEventSupport_; // Private. - transient private PropertyChangeSupport propertyChangeSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - - - - - /** - Constructs a ProgramCallButton object. - **/ - public ProgramCallButton() - { - program_ = new ProgramCall (); - initializeTransient (); - } - - - /** - Constructs a ProgramCallButton object. - - @param text The button text, or null if there is no text. - **/ - public ProgramCallButton(String text) - { - super(text); - program_ = new ProgramCall (); - initializeTransient (); - } - - - /** - Constructs a ProgramCallButton object. - - @param text The button text, or null if there is no text. - @param icon The button icon, or null if there is no icon. - **/ - public ProgramCallButton(String text, Icon icon) - { - super(text,icon); - program_ = new ProgramCall (); - initializeTransient (); - } - - - /** - Constructs a ProgramCallButton object. - - @param text The button text, or null if there is no text. - @param icon The button icon, or null if there is no icon. - @param system The system on which the programs are run. - **/ - public ProgramCallButton(String text, - Icon icon, - AS400 system) - { - super(text, icon); - program_ = new ProgramCall (system); - initializeTransient (); - } - - - /** - Constructs a ProgramCallButton object. - - @param text The button text, or null if there is no text. - @param icon The button icon, or null if there is no icon. - @param system The system on which the programs are run. - @param program The program name as a fully qualified path name - in the library file system. - The library and program name must each be - 10 characters or less. - @param parmlist A list of up to 35 parameters with which to run the program. - **/ - public ProgramCallButton(String text, - Icon icon, - AS400 system, - String program, - ProgramParameter[] parmlist) - { - super(text, icon); - program_ = new ProgramCall (system, program, parmlist); - initializeTransient (); - } - - - /** - Adds a listener to be notified when a program has been called. - - @param listener The listener. - **/ - public void addActionCompletedListener(ActionCompletedListener listener) - { - actionCompletedEventSupport_.addActionCompletedListener (listener); - } - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - - /** - Adds a parameter to the end of the parameter list. - - @param parameter The parameter. - - @exception PropertyVetoException If the change is vetoed. - **/ - public void addParameter (ProgramParameter parameter) - throws PropertyVetoException - { - program_.addParameter (parameter); - } - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - super.addPropertyChangeListener (listener); // @A1A - if (propertyChangeSupport_ != null) // @A1A - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - - /** - Returns the message list resulting from the last program call - that was run. - - @return The message list. - **/ - public AS400Message[] getMessageList() - { - return program_.getMessageList(); - } - - - /** - Returns the message text from the last program that was run. The message will be the first message received. - - @return The message text. - **/ - public String getMessageText() - { - AS400Message[] msglist = program_.getMessageList(); - if (msglist.length==0) - return ""; - else - return msglist[0].getText(); - } - - - - /** - Returns the parameter list. - - @return The parameter list. - **/ - public ProgramParameter[] getParameterList() - { - return program_.getParameterList(); - } - - - /** - Returns the program which will be called when the button is pressed. - - @return The program which will be called when the button is pressed. - **/ - public String getProgram() - { - return program_.getProgram(); - } - - - /** - Returns the system on which programs are run. - - @return The system on which programs are run. - **/ - public AS400 getSystem() - { - return program_.getSystem(); - } - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Initialize the event support. - actionCompletedEventSupport_ = new ActionCompletedEventSupport (this); - errorEventSupport_ = new ErrorEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - - program_.addActionCompletedListener (actionCompletedEventSupport_); - program_.addPropertyChangeListener (propertyChangeSupport_); - program_.addVetoableChangeListener (vetoableChangeSupport_); - - addActionListener (new ActionListener_ ()); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes an action completed listener. - -@param listener The listener. -**/ - public void removeActionCompletedListener (ActionCompletedListener listener) - { - actionCompletedEventSupport_.removeActionCompletedListener (listener); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - - /** - Sets the list of parameters to pass to the program. - - @param parmlist A list of up to 35 parameters with which to run the program. - It will replace any parameters previously set. - - @exception PropertyVetoException If the change is vetoed. - **/ - public void setParameterList(ProgramParameter[] parmlist) - throws PropertyVetoException - { - program_.setParameterList (parmlist); - } - - - /** - Sets the program. - - @param program The program. - - @exception PropertyVetoException If the change is veoted. - **/ - public void setProgram (String program) - throws PropertyVetoException - { - program_.setProgram (program); - } - - - /** - Sets the system on which programs are run. - - @param system The system on which programs are run. - - @exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem(AS400 system) - throws PropertyVetoException - { - program_.setSystem( system ); - } - - - - private class ActionListener_ - implements ActionListener - { - public void actionPerformed (ActionEvent event) - { - // Set the cursor to a wait cursor. - WorkingCursorAdapter cursorAdapter = new WorkingCursorAdapter (ProgramCallButton.this); - cursorAdapter.startWorking (new WorkingEvent (this)); - - // Run the command. - try { - program_.run(); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - - // Set the cursor back. - cursorAdapter.stopWorking (new WorkingEvent (this)); - } - - } - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/ProgramCallButton16.gif b/cvsroot/src/com/ibm/as400/vaccess/ProgramCallButton16.gif deleted file mode 100644 index 71bf94d25..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/ProgramCallButton16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/ProgramCallButton32.gif b/cvsroot/src/com/ibm/as400/vaccess/ProgramCallButton32.gif deleted file mode 100644 index f8581ce3e..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/ProgramCallButton32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/ProgramCallButtonBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/ProgramCallButtonBeanInfo.java deleted file mode 100644 index f5ad02957..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ProgramCallButtonBeanInfo.java +++ /dev/null @@ -1,216 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProgramCallButtonBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.ActionCompletedListener; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The ProgramCallButtonBeanInfo class provides bean information -for the ProgramCallButton class. - -@see ProgramCallButton -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class ProgramCallButtonBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = ProgramCallButton.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor actionCompleted = new EventSetDescriptor (beanClass_, - "actionCompleted", ActionCompletedListener.class, "actionCompleted"); - actionCompleted.setDisplayName (ResourceLoader.getText ("EVT_NAME_ACTION_COMPLETED")); - actionCompleted.setShortDescription (ResourceLoader.getText ("EVT_DESC_ACTION_COMPLETED")); - - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - events_ = new EventSetDescriptor[] { actionCompleted, error, propertyChange, - vetoableChange }; - - // Properties. - PropertyDescriptor messageList = new PropertyDescriptor ("messageList", beanClass_, - "getMessageList", null); - messageList.setBound (false); - messageList.setConstrained (false); - messageList.setDisplayName (ResourceLoader.getText ("PROP_NAME_MESSAGE_LIST")); - messageList.setShortDescription (ResourceLoader.getText ("PROP_DESC_MESSAGE_LIST")); - - PropertyDescriptor messageText = new PropertyDescriptor ("messageText", beanClass_, - "getMessageText", null); - messageText.setBound (false); - messageText.setConstrained (false); - messageText.setDisplayName (ResourceLoader.getText ("PROP_NAME_MESSAGE_TEXT")); - messageText.setShortDescription (ResourceLoader.getText ("PROP_DESC_MESSAGE_TEXT")); - - PropertyDescriptor parameterList = new PropertyDescriptor ("parameterList", beanClass_); - parameterList.setBound (true); - parameterList.setConstrained (true); - parameterList.setDisplayName (ResourceLoader.getText ("PROP_NAME_PARAMETER_LIST")); - parameterList.setShortDescription (ResourceLoader.getText ("PROP_DESC_PARAMETER_LIST")); - - PropertyDescriptor program = new PropertyDescriptor ("program", beanClass_); - program.setBound (true); - program.setConstrained (true); - program.setDisplayName (ResourceLoader.getText ("PROP_NAME_PROGRAM")); - program.setShortDescription (ResourceLoader.getText ("PROP_DESC_PROGRAM")); - - PropertyDescriptor system = new PropertyDescriptor ("system", beanClass_); - system.setBound (true); - system.setConstrained (true); - system.setDisplayName (ResourceLoader.getText ("PROP_NAME_SYSTEM")); - system.setShortDescription (ResourceLoader.getText ("PROP_DESC_SYSTEM")); - - PropertyDescriptor text = new PropertyDescriptor ("text", beanClass_); - text.setBound (false); - text.setConstrained (false); - text.setDisplayName (ResourceLoader.getText ("PROP_NAME_TEXT")); - text.setShortDescription (ResourceLoader.getText ("PROP_DESC_TEXT")); - - properties_ = new PropertyDescriptor[] { messageList, messageText, - parameterList, program, system, text }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ActionCompletedEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 3; // program. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("ProgramCallButton16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("ProgramCallButton32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/ProgramCallMenuItem.java b/cvsroot/src/com/ibm/as400/vaccess/ProgramCallMenuItem.java deleted file mode 100644 index 2624290a1..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ProgramCallMenuItem.java +++ /dev/null @@ -1,431 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProgramCallMenuItem.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.ActionCompletedListener; -import com.ibm.as400.access.ActionCompletedEvent; -import com.ibm.as400.access.ProgramCall; -import com.ibm.as400.access.ProgramParameter; -import javax.swing.Icon; -import javax.swing.JMenuItem; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; - - - -/** -The ProgramCallMenuItem class represents a menu item -that calls a program when pressed. -The results of the program are returned in a message list. - -

    ProgramCallMenuItem objects generate the following events: -

      -
    • ActionCompletedEvent -
    • ErrorEvent -
    • PropertyChangeEvent -
    - -@see com.ibm.as400.access.ProgramCall -@see com.ibm.as400.access.AS400Message -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class ProgramCallMenuItem -extends JMenuItem -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Properties. - ProgramCall program_ = null; // Private. - - - - // Event support. - transient ActionCompletedEventSupport actionCompletedEventSupport_; // Private. - transient ErrorEventSupport errorEventSupport_; // Private. - transient private PropertyChangeSupport propertyChangeSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - - - - - /** - Constructs a ProgramCallMenuItem object. - **/ - public ProgramCallMenuItem() - { - program_ = new ProgramCall (); - initializeTransient (); - } - - - /** - Constructs a ProgramCallMenuItem object. - - @param text The menu item text, or null if there is no text. - **/ - public ProgramCallMenuItem(String text) - { - super(text); - program_ = new ProgramCall (); - initializeTransient (); - } - - - /** - Constructs a ProgramCallMenuItem object. - - @param text The menu item text, or null if there is no text. - @param icon The menu item icon, or null if there is no icon. - **/ - public ProgramCallMenuItem(String text, Icon icon) - { - super(text,icon); - program_ = new ProgramCall (); - initializeTransient (); - } - - - /** - Constructs a ProgramCallMenuItem object. - - @param text The menu item text, or null if there is no text. - @param icon The menu item icon, or null if there is no icon. - @param system The system on which the programs are run. - **/ - public ProgramCallMenuItem(String text, - Icon icon, - AS400 system) - { - super(text, icon); - program_ = new ProgramCall (system); - initializeTransient (); - } - - - /** - Constructs a ProgramCallMenuItem object. - - @param text The menu item text, or null if there is no text. - @param icon The menu item icon, or null if there is no icon. - @param system The system on which the programs are run. - @param program The program name as a fully qualified path name - in the library file system. - The library and program name must each be - 10 characters or less. - @param parmlist A list of up to 35 parameters with which to run the program. - **/ - public ProgramCallMenuItem(String text, - Icon icon, - AS400 system, - String program, - ProgramParameter[] parmlist) - { - super(text, icon); - program_ = new ProgramCall (system, program, parmlist); - initializeTransient (); - } - - - /** - Adds a listener to be notified when an action is completed. - - @param listener The listener. - **/ - public void addActionCompletedListener(ActionCompletedListener listener) - { - actionCompletedEventSupport_.addActionCompletedListener (listener); - } - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - - /** - Adds a parameter to the parameter list. - - @param parameter The parameter. - - @exception PropertyVetoException If the change is vetoed. - **/ - public void addParameter (ProgramParameter parameter) - throws PropertyVetoException - { - program_.addParameter (parameter); - } - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - super.addPropertyChangeListener(listener); // @C1A - if (propertyChangeSupport_ != null) // @C1A - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - - /** - Returns the message list resulting from the last program call that was run. - - @return The message list. - **/ - public AS400Message[] getMessageList() - { - return program_.getMessageList(); - } - - - /** - Returns the message text from the last program that was run. The message will be the first message received. - - - @return The message text. - **/ - public String getMessageText() - { - AS400Message[] msglist = program_.getMessageList(); - if (msglist.length==0) - return ""; - else - return msglist[0].getText(); - } - - - - /** - Returns the parameter list. - - @return The parameter list. - **/ - public ProgramParameter[] getParameterList() - { - return program_.getParameterList(); - } - - - /** - Returns the program which will be called when the button is pressed. - - @return The program which will be called when the button is pressed. - **/ - public String getProgram() - { - return program_.getProgram(); - } - - - /** - - Returns the system on which programs are run. - - @return The system on which programs are run. - **/ - public AS400 getSystem() - { - return program_.getSystem(); - } - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Initialize the event support. - actionCompletedEventSupport_ = new ActionCompletedEventSupport (this); - errorEventSupport_ = new ErrorEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - - program_.addActionCompletedListener (actionCompletedEventSupport_); - program_.addPropertyChangeListener (propertyChangeSupport_); - program_.addVetoableChangeListener (vetoableChangeSupport_); - - addActionListener (new ActionListener_ ()); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes a action completed listener. - -@param listener The listener. -**/ - public void removeActionCompletedListener (ActionCompletedListener listener) - { - actionCompletedEventSupport_.removeActionCompletedListener (listener); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** - -Sets the list of parameters to pass to the program. - -@param parmlist A list of up to 35 parameters with which to run the program. - It will replace any parameters previously set. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setParameterList(ProgramParameter[] parmlist) - throws PropertyVetoException - { - program_.setParameterList (parmlist); - } - - - /** - Sets the program. - - @param program The program. - - @exception PropertyVetoException If the change is vetoed. - **/ - public void setProgram (String program) - throws PropertyVetoException - { - program_.setProgram (program); - } - - - /** - Sets the system on which programs are run. - - @param system The system on which programs are run. - - @exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem(AS400 system) - throws PropertyVetoException - { - program_.setSystem( system ); - } - - - - private class ActionListener_ - implements ActionListener - { - public void actionPerformed (ActionEvent event) - { - // Set the cursor to a wait cursor. - WorkingCursorAdapter cursorAdapter = new WorkingCursorAdapter (ProgramCallMenuItem.this); - cursorAdapter.startWorking (new WorkingEvent (this)); - - // Run the command. - try { - program_.run(); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - - // Set the cursor back. - cursorAdapter.stopWorking (new WorkingEvent (this)); - } - - } - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/ProgramCallMenuItem16.gif b/cvsroot/src/com/ibm/as400/vaccess/ProgramCallMenuItem16.gif deleted file mode 100644 index 894e8ca5c..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/ProgramCallMenuItem16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/ProgramCallMenuItem32.gif b/cvsroot/src/com/ibm/as400/vaccess/ProgramCallMenuItem32.gif deleted file mode 100644 index 8493e15e9..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/ProgramCallMenuItem32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/ProgramCallMenuItemBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/ProgramCallMenuItemBeanInfo.java deleted file mode 100644 index cf784c009..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ProgramCallMenuItemBeanInfo.java +++ /dev/null @@ -1,216 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ProgramCallMenuItemBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.ActionCompletedListener; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The ProgramCallMenuItemBeanInfo class provides bean information -for the ProgramCallMenuItem class. - -@see ProgramCallMenuItem -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class ProgramCallMenuItemBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = ProgramCallMenuItem.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor actionCompleted = new EventSetDescriptor (beanClass_, - "actionCompleted", ActionCompletedListener.class, "actionCompleted"); - actionCompleted.setDisplayName (ResourceLoader.getText ("EVT_NAME_ACTION_COMPLETED")); - actionCompleted.setShortDescription (ResourceLoader.getText ("EVT_DESC_ACTION_COMPLETED")); - - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - events_ = new EventSetDescriptor[] { actionCompleted, error, propertyChange, - vetoableChange }; - - // Properties. - PropertyDescriptor messageList = new PropertyDescriptor ("messageList", beanClass_, - "getMessageList", null); - messageList.setBound (false); - messageList.setConstrained (false); - messageList.setDisplayName (ResourceLoader.getText ("PROP_NAME_MESSAGE_LIST")); - messageList.setShortDescription (ResourceLoader.getText ("PROP_DESC_MESSAGE_LIST")); - - PropertyDescriptor messageText = new PropertyDescriptor ("messageText", beanClass_, - "getMessageText", null); - messageText.setBound (false); - messageText.setConstrained (false); - messageText.setDisplayName (ResourceLoader.getText ("PROP_NAME_MESSAGE_TEXT")); - messageText.setShortDescription (ResourceLoader.getText ("PROP_DESC_MESSAGE_TEXT")); - - PropertyDescriptor parameterList = new PropertyDescriptor ("parameterList", beanClass_); - parameterList.setBound (true); - parameterList.setConstrained (true); - parameterList.setDisplayName (ResourceLoader.getText ("PROP_NAME_PARAMETER_LIST")); - parameterList.setShortDescription (ResourceLoader.getText ("PROP_DESC_PARAMETER_LIST")); - - PropertyDescriptor program = new PropertyDescriptor ("program", beanClass_); - program.setBound (true); - program.setConstrained (true); - program.setDisplayName (ResourceLoader.getText ("PROP_NAME_PROGRAM")); - program.setShortDescription (ResourceLoader.getText ("PROP_DESC_PROGRAM")); - - PropertyDescriptor system = new PropertyDescriptor ("system", beanClass_); - system.setBound (true); - system.setConstrained (true); - system.setDisplayName (ResourceLoader.getText ("PROP_NAME_SYSTEM")); - system.setShortDescription (ResourceLoader.getText ("PROP_DESC_SYSTEM")); - - PropertyDescriptor text = new PropertyDescriptor ("text", beanClass_); - text.setBound (false); - text.setConstrained (false); - text.setDisplayName (ResourceLoader.getText ("PROP_NAME_TEXT")); - text.setShortDescription (ResourceLoader.getText ("PROP_DESC_TEXT")); - - properties_ = new PropertyDescriptor[] { messageList, messageText, - parameterList, program, system, text }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ActionCompletedEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 3; // program. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("ProgramCallMenuItem16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("ProgramCallMenuItem32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/PropertyChangeSupport.java b/cvsroot/src/com/ibm/as400/vaccess/PropertyChangeSupport.java deleted file mode 100644 index 09e3ac53b..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/PropertyChangeSupport.java +++ /dev/null @@ -1,92 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: PropertyChangeSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; - - - -/** -The PropertyChangeSupport class represents a list of -PropertyChangeListeners. This is also a PropertyChangeListener -and will dispatch all property change events that it receives. -**/ -class PropertyChangeSupport -extends java.beans.PropertyChangeSupport -implements PropertyChangeListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs an PropertyChangeSupport object. - -@param source The source for the events. -**/ - public PropertyChangeSupport (Object source) - { - super (source); - } - - - -/** -Adds a listener. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - super.addPropertyChangeListener (listener); - } - - - -/** -Processes a property change event. - -@param event The event. -**/ - public void propertyChange (PropertyChangeEvent event) - { - firePropertyChange (event.getPropertyName (), event.getOldValue (), event.getNewValue ()); - } - - - -/** -Removes a listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - super.removePropertyChangeListener (listener); - } - - - -} - - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/QueuedMessagePropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/QueuedMessagePropertiesPane.java deleted file mode 100644 index f7a547bfd..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/QueuedMessagePropertiesPane.java +++ /dev/null @@ -1,342 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: QueuedMessagePropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.MessageQueue; -import com.ibm.as400.access.QueuedMessage; -import com.ibm.as400.access.QSYSObjectPathName; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.awt.event.ItemListener; -import java.awt.event.ItemEvent; -import javax.swing.JLabel; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ChangeListener; -import java.text.DateFormat; -import java.util.Date; -import java.util.TimeZone; - - - -/** -The QueuedMessagePropertyPane class represents the properties pane -for a queued message. -**/ -class QueuedMessagePropertiesPane -implements VPropertiesPane -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String dateText_ = ResourceLoader.getText ("MESSAGE_DATE") + ":"; - private static final String fromJobText_ = ResourceLoader.getText ("MESSAGE_FROM_JOB") + ":"; - private static final String fromJobNumberText_ = ResourceLoader.getText ("MESSAGE_FROM_JOB_NUMBER") + ":"; - private static final String fromProgramText_ = ResourceLoader.getText ("MESSAGE_FROM_PROGRAM") + ":"; - private static final String fromUserText_ = ResourceLoader.getText ("MESSAGE_FROM_USER") + ":"; - private static final String generalTabText_ = ResourceLoader.getText ("TAB_GENERAL"); - private static final String messageQueueText_ = ResourceLoader.getText ("MESSAGE_QUEUE") + ":"; - private static final String severityText_ = ResourceLoader.getText ("MESSAGE_SEVERITY") + ":"; - private static final String typeText_ = ResourceLoader.getText ("MESSAGE_TYPE") + ":"; - - - - // Static data. - private static DateFormat dateFormat_ = DateFormat.getDateTimeInstance (); - - - - // Private data. - private QueuedMessage message_; - private VObject object_; - - - - // Event support. - private ChangeEventSupport changeEventSupport_ = new ChangeEventSupport (this); - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - - -/** -Static initializer. -**/ - static - { - dateFormat_.setTimeZone (TimeZone.getDefault ()); - } - - - -/** -Constructs a QueuedMessagePropertiesPane object. - -@param object The object. -@param message The queued message. -**/ - public QueuedMessagePropertiesPane (VObject object, - QueuedMessage message) - { - object_ = object; - message_ = message; - } - - - -/** -Adds a change listener. - -@param listener The listener. -**/ - public void addChangeListener (ChangeListener listener) - { - changeEventSupport_.addChangeListener (listener); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Applies the changes made by the user. - -@throws Exception If an error occurs. -**/ - public void applyChanges () - throws Exception - { - // No changes are allowed. - } - - - -/** -Returns the graphical component. - -@return The graphical component. -**/ - public Component getComponent () - { - // Initialize the general tab. - JPanel generalTab = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - generalTab.setLayout (layout); - generalTab.setBorder (new EmptyBorder (10, 10, 10, 10)); - - // Add the components. - int row = 0; - VUtilities.constrain (new JLabel (object_.getText (), object_.getIcon (32, false), SwingConstants.LEFT), - generalTab, layout, 0, row++, 2, 1); - -//@B0D JTextArea text = new JTextArea (VUtilities.formatHelp (message_.getText (), 60)); // @A1C - JTextArea text = new JTextArea (message_.getText()); //@B0A - text.setEditable (false); - text.setBackground (generalTab.getBackground ()); - text.setColumns(40); //@B0A - text.setLineWrap(true); //@B0A - text.setWrapStyleWord(true); //@B0A - VUtilities.constrain (text, - generalTab, layout, 0, row++, 2, 1); - - String help = message_.getHelp (); - if (help != null) - if (help.length () > 0) { -//@B0D JTextArea helpText = new JTextArea (VUtilities.formatHelp (help, 60)); // @A1C - JTextArea helpText = new JTextArea(help); //@B0A - helpText.setEditable (false); - helpText.setBackground (generalTab.getBackground ()); - helpText.setColumns(40); //@B0A - helpText.setLineWrap(true); //@B0A - helpText.setWrapStyleWord(true); //@B0A - VUtilities.constrain (helpText, - generalTab, layout, 0, row++, 2, 1); - } - - VUtilities.constrain (new JSeparator (), - generalTab, layout, 0, row++, 2, 1); - - VUtilities.constrain (new JLabel (severityText_), - generalTab, layout, 0, row, 1, 1); - VUtilities.constrain (new JLabel (Integer.toString (message_.getSeverity ())), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JLabel (typeText_), - generalTab, layout, 0, row, 1, 1); - VUtilities.constrain (new JLabel (MessageUtilities.getTypeText (message_.getType ())), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JLabel (dateText_), - generalTab, layout, 0, row, 1, 1); - Date date = message_.getDate ().getTime (); - if (date != null) - VUtilities.constrain (new JLabel (dateFormat_.format (date)), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JSeparator (), - generalTab, layout, 0, row++, 2, 1); - - VUtilities.constrain (new JLabel (fromJobText_), - generalTab, layout, 0, row, 1, 1); - VUtilities.constrain (new JLabel (message_.getFromJobName ()), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JLabel (fromUserText_), - generalTab, layout, 0, row, 1, 1); - VUtilities.constrain (new JLabel (message_.getUser ()), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JLabel (fromJobNumberText_), - generalTab, layout, 0, row, 1, 1); - VUtilities.constrain (new JLabel (message_.getFromJobNumber ()), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JSeparator (), - generalTab, layout, 0, row++, 2, 1); - - VUtilities.constrain (new JLabel (fromProgramText_), - generalTab, layout, 0, row, 1, 1); - VUtilities.constrain (new JLabel (message_.getFromProgram ()), - generalTab, layout, 1, row, 1, 1); - row++; - - VUtilities.constrain (new JSeparator (), - generalTab, layout, 0, row++, 2, 1); - - VUtilities.constrain (new JLabel (messageQueueText_), - generalTab, layout, 0, row, 1, 1); - MessageQueue queue = message_.getQueue (); - String path = (queue == null) ? "" : queue.getPath (); - VUtilities.constrain (new JLabel (path), - generalTab, layout, 1, row, 1, 1); - row++; - - JTabbedPane tabbedPane = new JTabbedPane (); - - tabbedPane.addTab (generalTabText_, null, generalTab ); - - tabbedPane.setSelectedIndex (0); - - return tabbedPane; - } - - - -/** -Removes a change listener. - -@param listener The listener. -**/ - public void removeChangeListener (ChangeListener listener) - { - changeEventSupport_.removeChangeListener (listener); - } - - - -/** -Removes a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/QueuedMessageRemoveAction.java b/cvsroot/src/com/ibm/as400/vaccess/QueuedMessageRemoveAction.java deleted file mode 100644 index 548eecfcf..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/QueuedMessageRemoveAction.java +++ /dev/null @@ -1,126 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: QueuedMessageRemoveAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400Exception; -import com.ibm.as400.access.MessageQueue; -import com.ibm.as400.access.QueuedMessage; -import com.ibm.as400.access.Trace; - - -/** -The QueuedMessageRemoveAction class defines the action -of removing a queued message. -**/ -class QueuedMessageRemoveAction -extends ConfirmedAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String confirmTitleText_ = ResourceLoader.getText ("DLG_CONFIRM_REMOVE_TITLE"); - private static final String confirmMessageText_ = ResourceLoader.getText ("DLG_CONFIRM_REMOVE"); - private static final String text_ = ResourceLoader.getText ("ACTION_REMOVE"); - - - - // Private data. - private QueuedMessage message_ = null; - private MessageQueue queue_ = null; - - - - -/** -Constructs a QueuedMessageRemoveAction object. - -@param object The object representing the message. -@param message The queued message. -@param queue The message queue. -**/ - public QueuedMessageRemoveAction (VObject object, - QueuedMessage message, - MessageQueue queue) - { - super (object, confirmTitleText_, confirmMessageText_); - - message_ = message; - queue_ = queue; - } - - - -/** -Returns the display name for the action. - -@return The display name. -**/ - public String getText () - { - return text_; - } - - - -/** -Performs the action after the user has confirmed it. - -@param context The action context. -**/ - public void perform2 (VActionContext context) - { - if (Trace.isTraceOn()) - Trace.log (Trace.INFORMATION, "Removing queued message [" - + message_.getID () + "] from message queue [" - + queue_ + "]."); - - fireStartWorking (); - boolean deleted = false; // @D1A - - try { - queue_.remove (message_.getKey()); - deleted = true; // @D1C - } - catch (AS400Exception e) - { - fireError (e); - - // If the error is that the message is already removed, - // then remove it from the pane. - if (e.getAS400Message ().getID ().equals ("CPF2410")) - deleted = true; // @D1C - } - catch (Exception e) - { - fireError (e); - } - - fireStopWorking (); - - // It is important to fire the object deleted event after @D1A - // the stop working. The parent stops listening for events @D1A - // when it knows the object is deleted. @D1A - if (deleted) // @D1A - fireObjectDeleted(); // @D1A - } - - - -} - - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/QueuedMessageReplyAction.java b/cvsroot/src/com/ibm/as400/vaccess/QueuedMessageReplyAction.java deleted file mode 100644 index c1e049292..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/QueuedMessageReplyAction.java +++ /dev/null @@ -1,166 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: QueuedMessageReplyAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.MessageQueue; -import com.ibm.as400.access.QueuedMessage; -import com.ibm.as400.access.Trace; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import javax.swing.JPanel; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JTextField; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; - - - -/** -The QueuedMessageReplyAction class defines the action -of replying to a queued message. -**/ -class QueuedMessageReplyAction -extends DialogAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String replyPrompt_ = ResourceLoader.getText ("MESSAGE_REPLY") + ": "; - private static final String text_ = ResourceLoader.getText ("ACTION_REPLY"); - - - - // Private data. - private QueuedMessage message_ = null; - private MessageQueue queue_ = null; - private JTextField replyText_ = new JTextField (" ", 40); - - - -/** -Constructs a QueuedMessageReplyAction object. - -@param object The object representing the message. -@param message The queued message. -@param queue The message queue. -**/ - public QueuedMessageReplyAction (VObject object, - QueuedMessage message, - MessageQueue queue) - { - super (object); - - message_ = message; - queue_ = queue; - } - - - -/** -Returns the text for the action. - -@return The text. -**/ - public String getText () - { - return text_; - } - - - -/** -Indicates if the action is enabled. - -@return true if the action is enabled, false otherwise. -**/ - public boolean isEnabled () - { - // This action can only be enabled if when the - // message is replyable (5 is inquiry). - return ((super.isEnabled ()) && (message_.getType () == 5)); - } - - - -/** -Returns the component for the dialog box. - -@return The component. -**/ - public JComponent getInputComponent() - { - JPanel panel = new JPanel(); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - panel.setLayout (layout); - panel.setBorder (new EmptyBorder (10, 10, 10, 10)); - - VUtilities.constrain (new JLabel (replyPrompt_), panel, layout, - 0, 0, 1, 1); - String defaultReply = message_.getDefaultReply(); - if (defaultReply != null) - replyText_.setText (defaultReply); - VUtilities.constrain (replyText_, panel, layout, 1, 0, 1, 1); - - return panel; - } - - - - -/** -Performs the real action. -**/ - public void perform2 () - { - if (Trace.isTraceOn()) - Trace.log (Trace.INFORMATION, "Replying to queued message [" - + message_.getID () + "] in message queue [" - + queue_ + "]."); - - fireStartWorking (); - - try { - queue_.reply (message_.getKey (), replyText_.getText()); - } - catch (Exception e) { - fireError (e); - } - finally { - fireStopWorking(); // @D1A - fireObjectDeleted (); - } - - // @D1D fireStopWorking (); - } - - - -/** -Sets the enabled state of the action. - -@param enabled true if the action is enabled, false otherwise. -**/ - public void setEnabled (boolean enabled) - { - super.setEnabled (enabled); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/RecordListData.java b/cvsroot/src/com/ibm/as400/vaccess/RecordListData.java deleted file mode 100644 index 434397ed6..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/RecordListData.java +++ /dev/null @@ -1,872 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordListData.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400File; -import com.ibm.as400.access.AS400FileRecordDescription; -import com.ibm.as400.access.DateFieldDescription; // @C1A -import com.ibm.as400.access.FieldDescription; -import com.ibm.as400.access.FloatFieldDescription; -import com.ibm.as400.access.FieldDescription; -import com.ibm.as400.access.HexFieldDescription; // @D1A -import com.ibm.as400.access.KeyedFile; -import com.ibm.as400.access.PackedDecimalFieldDescription; -import com.ibm.as400.access.SequentialFile; -import com.ibm.as400.access.Record; -import com.ibm.as400.access.RecordFormat; -import com.ibm.as400.access.TimeFieldDescription; // @C1A -import com.ibm.as400.access.TimestampFieldDescription; // @C1A -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ZonedDecimalFieldDescription; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; - - -/** -Represents the records in a server file that are -accessed either sequentially or by key by using the record-level -access classes in com.ibm.as400.access. -This class handles caching and storing the data fields so they can be -retrieved and displayed by different views. - -

    The data is retrieved from the system on the -first invocation of readAllRecords() or readMoreRecords() -or whenever load() is called. - -

    Data is retrieved from the access classes as needed. - -

    It is up to the user to call close() when the -record list data is no longer needed. - -

    Most errors are reported by firing ErrorEvents, rather -than throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    RecordListData objects generate the following events: -

      -
    • ErrorEvent -
    • WorkingEvent -
    -**/ -// Note that this class throws events from within synchronized blocks, -// which could cause hangs if the handlers of these events do -// operations from a different thread an attempt to access another -// synchronized piece of code. -// At this time this seems to be an acceptable risk, since the -// events thrown are not likely to need enough processing to -// require another thread, and getting having the events thrown -// from outside a sychronized block would be nearly impossible. -// The other option is to have the firing of the events be done -// from another thread, but the overhead of creating another thread -// not only takes resources, but also delays the delivery of the event. -class RecordListData -implements Serializable -{ - -// Constants for search types -static final int KEY_EQ = KeyedFile.KEY_EQ; -static final int KEY_GT = KeyedFile.KEY_GT; -static final int KEY_GE = KeyedFile.KEY_GE; -static final int KEY_LT = KeyedFile.KEY_LT; -static final int KEY_LE = KeyedFile.KEY_LE; - - -// What the records in this object represent. -private AS400 system_ = null; -private String fileName_ = null; -private boolean newKeyed_ = false; // access currently being used -private boolean keyed_ = false; // value of access property -private int searchType_ = KEY_EQ; // search type currently being used -private int newSearchType_ = KEY_EQ; // value of search type property -private Object key_[] = null; // key currently being used -private Object newKey_[] = null; // value of key property - -// The file objects. One of these will be null. -transient private SequentialFile sequentialFile_ = null; -transient private KeyedFile keyedFile_ = null; -transient private boolean loadDone_ = false; // has load() been done -transient private boolean resourceOpen_ = false; // file is open - -// The record information -transient private Object[][] data_ = null; // the data for the table -transient Record record_; // current record - -// Column information -transient private int numColumns_ = 0; -transient FieldDescription[] fields_ = null; - -// Row information -// Number of rows data_ is bumped by when more space needed. 100 is arbitrary. -private static int ROW_INCREMENT_ = 100; -// Number of rows in the table. Always 0 until allRecordsRead_ = true. -transient private int numRows_ = 0; -// The index of the last record read. Up to this row is valid in data_. -transient private int lastRecordRead_ = -1; -// For keyed files using LE or LT, the last record. -transient private int lastLESSRecordNumber_; -// If all records in sequentialFile_ or keyedFile_ have been transferred to data_. -transient private boolean allRecordsRead_ = true; - -// Flag for if an error event was sent. -transient private boolean error_; - -// Event support. -transient private ErrorEventSupport errorListeners_ - = new ErrorEventSupport (this); -transient private WorkingEventSupport workingListeners_ - = new WorkingEventSupport (this); - -private boolean fireWorkingEvents_ = true; - -/** -Constructs a RecordListData object. -**/ -public RecordListData () -{ - super(); -} - - - -/** -Adds a listener to be notified when an error occurs. -The listener's errorOccurred method will be called. - -@param listener The listener. -**/ -public void addErrorListener (ErrorListener listener) -{ - errorListeners_.addErrorListener (listener); -} - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ -public void addWorkingListener (WorkingListener listener) -{ - workingListeners_.addWorkingListener (listener); -} - - -/** -Closes the server file this record list represents. -**/ -synchronized public void close () -{ - if (resourceOpen_) - { - try - { - if (keyed_) - { - keyedFile_.close(); - } - else - { - sequentialFile_.close(); - } - } - catch (Exception e) - { - errorListeners_.fireError(e); - } - resourceOpen_ = false; - } -} - - -/** -Returns whether all records have been processed (stored in a local -cache). - -@return true if all records have been processed; false otherwise. -**/ -synchronized public boolean getAllRecordsProcessed () -{ - return allRecordsRead_; -} - - - -/** -Returns the display size for the column at the specified index. -Indices start at 0. - -@param index Index of the column. -@return The display size for the column. -**/ -synchronized public int getColumnDisplaySize(int index) -{ - if (!loadDone_) - { - throw new IndexOutOfBoundsException("index"); - } - - // For most types, we just consult with RLA. However, for times, dates, and @C1A - // timestamps, RLA reports the display size for the server format. And these @C1A - // GUIs actually internationalize the Strings before displaying them. So for @C1A - // these types, we need to compute our own display sizes. @C1A - - FieldDescription field = fields_[index]; - if (field instanceof FloatFieldDescription || - field instanceof PackedDecimalFieldDescription || - field instanceof ZonedDecimalFieldDescription) - return field.getLength() + 2; // sign and decimal point - else if (field instanceof TimeFieldDescription) // @C1A - return DBDateCellRenderer.getDisplaySize(DBDateCellRenderer.FORMAT_TIME); // @C1A - else if (field instanceof DateFieldDescription) // @C1A - return DBDateCellRenderer.getDisplaySize(DBDateCellRenderer.FORMAT_DATE); // @C1A - else if (field instanceof TimestampFieldDescription) // @C1A - return DBDateCellRenderer.getDisplaySize(DBDateCellRenderer.FORMAT_TIMESTAMP); // @C1A - else if (field instanceof HexFieldDescription) // @D1A - return field.getLength() * 2; // @D1A - else - return field.getLength(); -} - - - -/** -Returns the label for the column at the specified index. -Indices start at 0. - -@param index Index of the column. -@return The label for the column. -**/ -synchronized public String getColumnLabel(int index) -{ - if (!loadDone_) - { - throw new IndexOutOfBoundsException("index"); - } - return fields_[index].getFieldName(); -} - - - -/** -Returns the name for the column at the specified index. -Indices start at 0. -If an error occurs, an empty string is returned. - -@param index Index of the column. -@return The name for the column. -**/ -synchronized public String getColumnName(int index) -{ - if (!loadDone_) - { - throw new IndexOutOfBoundsException("index"); - } - return fields_[index].getFieldName(); -} - - - -/** -Returns the file name. -The name is formatted as a fully qualified path name in the library file system. - -@return The file name. -**/ -public String getFileName () -{ - return fileName_; -} - - -/** -Returns the key. -The key is only used if the keyed property is true. - -@return The key. -**/ -public Object[] getKey () -{ - return newKey_; -} - - -/** -Returns whether the file will be accessed in key or sequential order. - -@return true if the file will be accessed in key order; false - if the file will be accessed in sequential order. -**/ -public boolean getKeyed () -{ - return newKeyed_; -} - - - -/** -Returns the index of the last record which had been processed (stored -in the local cache). -1 indicates no records have been -processed. - -@return The index of the last record processed. -**/ -synchronized public int getLastRecordProcessed () -{ - return lastRecordRead_; -} - - - -/** -Returns the number of fields in this result set. -If an error occurs, 0 is returned. - -@return The number of fields in this result set. -**/ -synchronized public int getNumberOfColumns() -{ - return numColumns_; -} - - - -/** -Returns the number of rows in the result set. -Note that this will result in all records being -processed. -If an error occurs, 0 is returned. - -@return The number of rows in the record list. -**/ -synchronized public int getNumberOfRows() -{ - if (!allRecordsRead_) - { - readAllRecords(); - } - return numRows_; -} - - - -/** -Returns the search type. -The search type is only used if the keyed property is true -and the key property is not null. - -@return The search type. -**/ -public int getSearchType () -{ - return newSearchType_; -} - - -/** -Returns the system where the file is located. - -@return The system where the file is located. -**/ -public AS400 getSystem () -{ - return system_; -} - - -/** -Returns the value at the specifed column and row. -Indices start at 0. -If an error occurs, an empty string is returned. - -@param rowIndex The row index. -@param columnIndex The column index. -@return The value at the specified column and row. -**/ -synchronized public Object getValueAt (int rowIndex, - int columnIndex) -{ - if (!loadDone_) - { - throw new IndexOutOfBoundsException("rowIndex"); - } - - // If we haven't yet transferred this row from the - // result set to the table cache, do so. - if (lastRecordRead_ < rowIndex) - { - readMoreRecords(rowIndex - lastRecordRead_); - } - if (lastRecordRead_ < rowIndex) - { - throw new IndexOutOfBoundsException("rowIndex"); - } - - // return the value - return data_[rowIndex][columnIndex]; -} - - - -/** -Loads the table based on the state of the system. This causes the -'query' to be run. -**/ -synchronized public void load () -{ - Trace.log(Trace.DIAGNOSTIC, "Doing data load."); - - if (system_ == null || fileName_ == null) - { - Trace.log(Trace.DIAGNOSTIC, "Data not set for load, exiting."); - return; - } - - if (fireWorkingEvents_) - workingListeners_.fireStartWorking (); - - // cleanup old data - if (resourceOpen_) - { - close(); // this sets resourceOpen_ to false - } - - // Set back fields in case there is an error. - fields_ = null; - numColumns_ = 0; - lastRecordRead_ = -1; - allRecordsRead_ = true; - loadDone_ = false; - data_ = null; - numRows_ = 0; - key_ = newKey_; - searchType_ = newSearchType_; - keyed_ = newKeyed_; - - // Retrieve the record format for the file - // Create an AS400FileRecordDescription object that represents the file - AS400FileRecordDescription recordDesc; - RecordFormat[] format; - try - { - // next line is in try block to catch runtime exceptions - // from parameter validation - recordDesc = new AS400FileRecordDescription(system_, fileName_); - format = recordDesc.retrieveRecordFormat(); - } - catch (Exception e) - { - errorListeners_.fireError(e); - return; - } - - // get info about the columns returned - fields_ = format[0].getFieldDescriptions(); - numColumns_ = fields_.length; - - // Open file and get first record. - // Note we don't process any of the result set until the - // values are asked for. - if (!keyed_) - { - // sequential access - keyedFile_ = null; - try - { - // next line is in try block to catch runtime exceptions - // from parameter validation - sequentialFile_ = new SequentialFile(system_, fileName_); - } - catch(Exception e) - { - fields_ = null; - numColumns_ = 0; - errorListeners_.fireError(e); - return; - } - // Set the record format - try {sequentialFile_.setRecordFormat(format[0]);} - catch (PropertyVetoException e) {} // should not occur - try - { - // Open the file. - sequentialFile_.open(AS400File.READ_ONLY, ROW_INCREMENT_, - AS400File.COMMIT_LOCK_LEVEL_NONE); - // Move cursor to first record. - // Note that if we can't get to first record, we scrap - // everything and fail. - record_ = sequentialFile_.readNext(); - resourceOpen_ = true; - } - catch (Exception e) - { - try {sequentialFile_.close();} catch(Exception ex){} - fields_ = null; - numColumns_ = 0; - errorListeners_.fireError(e); - return; - } - } - else - { - // keyed access - sequentialFile_ = null; - try - { - // next line is in try block to catch runtime exceptions - // from parameter validation - keyedFile_ = new KeyedFile(system_, fileName_); - } - catch(Exception e) - { - fields_ = null; - numColumns_ = 0; - errorListeners_.fireError(e); - return; - } - // Set the record format - try {keyedFile_.setRecordFormat(format[0]);} - catch (PropertyVetoException e) {} // should not occur - try - { - // Open the file. - keyedFile_.open(AS400File.READ_ONLY, ROW_INCREMENT_, - AS400File.COMMIT_LOCK_LEVEL_NONE); - resourceOpen_ = true; - if (key_ != null) - { - // Move cursor to first record. - // Note that if we can't get to first record, we scrap - // everything and fail. - record_ = keyedFile_.read(key_, searchType_); - if (searchType_ == KEY_LE) - { - // If LE, we need to move to the last record - // that has a key equal. This covers the case - // where there are duplicate keys, if we don't - // do this, we will miss all but one record - // with a key equal. - try - { - Record next = keyedFile_.readNextEqual(key_); - while (next != null) - { - record_ = next; - next = keyedFile_.readNextEqual(key_); - } - } - catch(Exception e) - { - // If we hit an error, report to users but - // otherwise ignore and continue. - errorListeners_.fireError(e); - } - } - if (searchType_ == KEY_LE || searchType_ == KEY_LT) - { - // We want the records in the 'forward' order, - // so save the last record and then reposition - // at the first record. - lastLESSRecordNumber_ = record_.getRecordNumber(); - record_ = keyedFile_.readFirst(); - } - } - else // keyed access but no key value - { - // Move cursor to first record. - // Note that if we can't get to first record, we scrap - // everything and fail. - record_ = keyedFile_.readNext(); - } - } - catch (Exception e) - { - try {keyedFile_.close();} catch(Exception ex){} - fields_ = null; - numColumns_ = 0; - errorListeners_.fireError(e); - return; - } - } - - if (record_ != null) - { - // there are records, but we don't know how many - // Create new array to hold table values. - data_ = new Object[ROW_INCREMENT_][numColumns_]; - allRecordsRead_ = false; - } - - loadDone_ = true; - if (fireWorkingEvents_) - workingListeners_.fireStopWorking (); -} - - -/** -Processes records in the result set, moving the data into local cache -so they can be retrieved via getValueAt. -**/ -synchronized public void readAllRecords() -{ - Trace.log(Trace.DIAGNOSTIC, "Reading all rows."); - workingListeners_.fireStartWorking (); - error_ = false; - while (!allRecordsRead_ && !error_) - { - fireWorkingEvents_ = false; - readMoreRecords(ROW_INCREMENT_); - fireWorkingEvents_ = true; - } - workingListeners_.fireStopWorking (); -} - - -/** -Processes records in the result set, moving the data into local cache -so they can be retrieved via getValueAt. - -@param numberToRead The number of records to process. -**/ -synchronized public void readMoreRecords(int numberToRead) -{ - Trace.log(Trace.DIAGNOSTIC, "Reading more rows:", numberToRead); - if (fireWorkingEvents_) - workingListeners_.fireStartWorking (); - - error_ = false; - // read only load done & more records to read - if (!allRecordsRead_) - { - // Make sure we have room in data_ for records. - if (lastRecordRead_ + numberToRead >= data_.length) - { - // increase by the greater of our increment or the number - // of rows needed. - int sizeNeeded = lastRecordRead_ + numberToRead + 1; - int increment = ROW_INCREMENT_>sizeNeeded?ROW_INCREMENT_:sizeNeeded; - Object[][] newData = - new Object[data_.length + increment][numColumns_]; - System.arraycopy(data_, 0, newData, 0, data_.length); - data_ = newData; - } - - for (int i=0; iload()
    is done. - -@param fileName The file name. - The name is specified as a fully qualified path name in the library file system. -**/ -public void setFileName (String fileName) -{ - fileName_ = fileName; -} - - -/** -Sets the key. -The key is only used if the keyed property is true. -Note that the data will not change until a load() is done. - -@param key The values which make up the key with which - to find the record. - This value may be null. -**/ -public void setKey (Object[] key) -{ - newKey_ = key; -} - - -/** -Sets whether the file will be accessed in key or sequential order. -Note that the data will not change until a load() is done. -The default value is false. - -@param keyed true if the file will be accessed in key order; false - if the file will be accessed in sequential order. -**/ -public void setKeyed (boolean keyed) -{ - newKeyed_ = keyed; -} - - -/** -Sets the search type. -The search type is only used if the keyed property is true -and the key property is not null. -Note that the data will not change until a load() is done. - -@param searchType Constant indicating the type of match required. -**/ -public void setSearchType (int searchType) -{ - newSearchType_ = searchType; -} - - -/** -Sets the system where the file is located. -Note that the data will not change until a load() is done. - -@param system The system where the file is located. -**/ -public void setSystem (AS400 system) -{ - system_ = system; -} - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/RecordListFormPane.java b/cvsroot/src/com/ibm/as400/vaccess/RecordListFormPane.java deleted file mode 100644 index c980b2feb..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/RecordListFormPane.java +++ /dev/null @@ -1,1067 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordListFormPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.ActionCompletedListener; -import com.ibm.as400.access.ActionCompletedEvent; -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.HexFieldDescription; -import javax.swing.SwingConstants; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JComponent; -import javax.swing.JTextField; -import javax.swing.border.EmptyBorder; -import java.awt.BorderLayout; -import java.awt.FlowLayout; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.Serializable; - - - -/** -The RecordListFormPane class represents a form that is filled in with the fields -of a file on the system. The form displays one record at a time -and provides buttons that allow the user to scroll forward, -backward, to the first or last record, or refresh the -view of the file. - -

    The data in the form is retrieved from the system -(and the GUI fields for the data are created) -when load() is called. If load() is not called, -the form will be empty. - -

    Users must call close() to ensure that the system -resources are properly freed when this form is no longer needed. - -

    Most errors are reported by firing ErrorEvents, rather -than throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    RecordListFormPane objects generate the following events: -

      -
    • ActionCompletedEvent -
    • ErrorEvent -
    • PropertyChangeEvent -
    - -
    - // Set up table for file contents.
    -AS400 system = new AS400("MySystem", "Userid", "Password");
    -String file = "/QSYS.LIB/QGPL.LIB/MyFile.FILE";
    -final RecordListFormPane pane = new RecordListFormPane(system, file);
    -
    - // Set up window to hold table
    -JFrame frame = new JFrame ("My Window");
    -WindowListener l = new WindowAdapter()
    -{
    -     // Close the model when window is closed.
    -    public void windowClosing(WindowEvent e)
    -    {
    -        pane.close();
    -    }
    -};
    -frame.addWindowListener(l);
    -
    -// Set up the error dialog adapter.
    -pane.addErrorListener (new ErrorDialogAdapter (frame));
    -
    -// Add the component and get data from system.
    -frame.getContentPane().add(pane);
    -pane.load();
    -
    - // Display the window
    -frame.setVisible(true)
    -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class RecordListFormPane -extends JComponent -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// The variables which have private commented out had to made -// package scope since currently Internet Explorer does not -// allow inner class to access private variables in their -// containing class. - -/** -Constant indicating search type of equal. -**/ -static public final int KEY_EQ = RecordListData.KEY_EQ; -/** -Constant indicating search type of greater than. -**/ -static public final int KEY_GT = RecordListData.KEY_GT; -/** -Constant indicating search type of greater than or equal. -**/ -static public final int KEY_GE = RecordListData.KEY_GE; -/** -Constant indicating search type of less than. -**/ -static public final int KEY_LT = RecordListData.KEY_LT; -/** -Constant indicating search type of less than or equal. -**/ -static public final int KEY_LE = RecordListData.KEY_LE; - - - -// Label for the record number. -transient private JLabel recordLabel_; //@B0C - made transient -// Label for the record number. -transient private JLabel recordNumber_; //@B0C - made transient -// Button for moving to the first record. -/*private*/ transient JButton firstButton_; //@B0C - made transient -// Button for moving to the last record. -/*private*/ transient JButton lastButton_; //@B0C - made transient -// Button for moving to the next record. -/*private*/ transient JButton nextButton_; //@B0C - made transient -// Button for moving to the previous record. -/*private*/ transient JButton previousButton_; //@B0C - made transient -// Button for refreshing the data. -/*private*/ transient JButton refreshButton_; //@B0C - made transient -// Labels for the description of each field. -transient private JLabel[] labels_ = new JLabel[0]; -// Textfields for the value of each field. -transient private JTextField[] values_ = new JTextField[0]; -// Formatters for the value of each field. -transient private DBCellRenderer[] formatter_ = new DBCellRenderer[0]; -// Status line. Used for errors. -private JLabel status_; -// Panel used for center data area. -private JPanel dataArea_; - -// Renderers for the different types of data, columns use these. -private DBCellRenderer leftCell_ = new DBCellRenderer(SwingConstants.LEFT); -// General types of data in columns. Used to determine column renderer. -private static final int TYPE_CHAR = 1; -private static final int TYPE_HEX = 2; - - -// Event support. -transient private ActionCompletedEventSupport actionListeners_ - = new ActionCompletedEventSupport (this); -transient /*private*/ ErrorEventSupport errorListeners_ - = new ErrorEventSupport (this); - - -// Record data -transient int current_ = -1; // Record being shown. Range is 0 to numRows-1. -private RecordListData tableData_ = new RecordListData(); - -// Flag for if an error event was sent. -transient /*private*/ boolean error_; - -// Adapter for listening for working events and enabling working cursor. -transient private WorkingCursorAdapter worker_ - = new WorkingCursorAdapter(this); - - - -/** -Constructs a RecordListFormPane object. -This constructor sets the keyed property to false. -**/ -public RecordListFormPane () -{ - super(); - - //@B0A - // We add a fake FocusListener whose real purpose is to uninstall - // the UI early so the JTable that is part of our UI does not try - // to get serialized. - // See also: source code for javax.swing.JComponent in JDK 1.2. - addFocusListener(new SerializationListener(this)); //@B0A - - // Add self as listener for errors and work events - tableData_.addErrorListener(new ErrorListener_()); - tableData_.addWorkingListener(worker_); - - init(); -} - - - -/** -Constructs a RecordListFormPane object. -This constructor sets the keyed property to false. - -@param system The system where the file is located. -@param fileName The file name. - The name is specified as a fully qualified path name in the library file system. -**/ -public RecordListFormPane (AS400 system, - String fileName) -{ - super(); - - if (system == null) - throw new NullPointerException("system"); - if (fileName == null) - throw new NullPointerException("fileName"); - - //@B0A - // We add a fake FocusListener whose real purpose is to uninstall - // the UI early so the JTable that is part of our UI does not try - // to get serialized. - // See also: source code for javax.swing.JComponent in JDK 1.2. - addFocusListener(new SerializationListener(this)); //@B0A - - tableData_.setSystem(system); - tableData_.setFileName(fileName); - - // Add self as listener for errors and work events - tableData_.addErrorListener(new ErrorListener_()); - tableData_.addWorkingListener(worker_); - - init(); -} - - - -/** -Constructs a RecordListFormPane object. -This constructor sets the keyed property to true. - -@param system The system where the file is located. -@param fileName The file name. - The name is specified as a fully qualified path name in the library file system. -@param key The values which make up the key with which - to find the record. - This value may be null. -@param searchType Constant indicating the type of match required. -**/ -public RecordListFormPane (AS400 system, - String fileName, - Object[] key, - int searchType) -{ - super(); - if (system == null) - throw new NullPointerException("system"); - if (fileName == null) - throw new NullPointerException("fileName"); - - //@B0A - // We add a fake FocusListener whose real purpose is to uninstall - // the UI early so the JTable that is part of our UI does not try - // to get serialized. - // See also: source code for javax.swing.JComponent in JDK 1.2. - addFocusListener(new SerializationListener(this)); //@B0A - - tableData_.setSystem(system); - tableData_.setFileName(fileName); - tableData_.setKeyed(true); - tableData_.setKey(key); - tableData_.setSearchType(searchType); - - // Add self as listener for errors and work events - tableData_.addErrorListener(new ErrorListener_()); - tableData_.addWorkingListener(worker_); - - init(); -} - - - -/** -Adds a listener to be notified when a new record is displayed. -The listener's actionCompleted() method will be called. - -@param listener The listener. -**/ -public void addActionCompletedListener (ActionCompletedListener listener) -{ - actionListeners_.addActionCompletedListener(listener); -} - - - -/** -Adds a listener to be notified when an error occurs. -The listener's errorOccurred() method will be called. - -@param listener The listener. -**/ -public void addErrorListener (ErrorListener listener) -{ - errorListeners_.addErrorListener (listener); -} - - -/** -Closes the file this form represents. -**/ -public void close() -{ - tableData_.close(); -} - - -/** -Displays the first record of the record list. -**/ -public void displayFirst () -{ - synchronized (this) - { - current_ = 0; - refreshScreen(); - } - - // Send event. - actionListeners_.fireActionCompleted(); -} - - - -/** -Displays the last record of the record list. -**/ -public void displayLast () -{ - synchronized (this) - { - error_ = false; - current_ = tableData_.getNumberOfRows() - 1; - if (error_) // error during getNumberOfRows - current_ = tableData_.getLastRecordProcessed(); - - refreshScreen(); - } - - // Send event. - actionListeners_.fireActionCompleted(); -} - - - -/** -Displays the next record of the record list. -If the last record is being displayed, the first record -will be displayed. -**/ -public void displayNext () -{ - synchronized (this) - { - // Move the current record index. - if (tableData_.getAllRecordsProcessed()) - { - // Do not want to do getNumberOfRows unless all records processed - // since getNumberOfRows will process all records. - // getNumberOfRows should never fire an error here. - if (current_+1 == tableData_.getNumberOfRows()) - current_ = 0; - else - ++current_; - } - else - { - ++current_; - } - - refreshScreen(); - } - - // Send event. - actionListeners_.fireActionCompleted(); -} - - - -/** -Displays the previous record of the record list. -If the first record is being displayed, the last record -will be displayed. -**/ -public void displayPrevious () -{ - synchronized (this) - { - // Move the current record index. - if (current_ < 1) - { - error_ = false; - current_ = tableData_.getNumberOfRows() - 1; - if (error_) //getNumberOfRows() failed - { - current_ = tableData_.getLastRecordProcessed(); - } - } - else - { - --current_; - } - - refreshScreen(); - } - - // Send event. - actionListeners_.fireActionCompleted(); -} - - - -/** -Returns the index of the record currently being displayed. -Indices start at 0, and increment one for each of the records -in the list. -Note that this is not the same as the record number. - -@return The index of the record currently being displayed. -If there is no record being displayed, -1 is returned. -**/ -synchronized public int getCurrentRecord() -{ - return current_; -} - - - -/** -Returns the file name. -The name is formatted as a fully qualified path name in the library file system. - -@return The file name. -**/ -public String getFileName () -{ - String result = tableData_.getFileName(); - if (result == null) - return ""; - return result; -} - - - -/** -Returns the key. -The key is only used if the keyed property is true. - -@return The key. -**/ -public Object[] getKey () -{ - return tableData_.getKey(); -} - - -/** -Returns whether the file will be accessed in key or sequential order. - -@return true if the file will be accessed in key order; false - if the file will be accessed in sequential order. -**/ -public boolean getKeyed () -{ - return tableData_.getKeyed(); -} - - - -/** -Returns the text of the label at the given index. - -@param index The index of the label. Indices start at 0. - -@return The text of the label at the given index. -**/ -synchronized public String getLabelText(int index) -{ - return labels_[index].getText(); -} - - - -/** -Returns the search type. -The search type is only used if the keyed property is true -and the key property is not null. - -@return The search type. -**/ -public int getSearchType () -{ - return tableData_.getSearchType(); -} - - - -/** -Returns the system where the file is located. - -@return The system where the file is located. -**/ -public AS400 getSystem () -{ - return tableData_.getSystem(); -} - - - -/** -Returns the string value of the current record at the given index. - -@param index The index of the value. Indices start at 0. - -@return The value at the given index as a string. -**/ -synchronized public String getStringValueAt(int index) -{ - return values_[index].getText(); -} - - - -/** -Returns the value of the current record at the given index. - -@param index Index of the value. Indices start at 0. - -@return The value at the given index. -**/ -synchronized public Object getValueAt(int index) -{ - return tableData_.getValueAt(current_, index); -} - - - -/** -Create GUI. -**/ -private void init() -{ - //------------------------------------------------------ - // Create constant screen components. Data fields will - // be created by reload(). - //------------------------------------------------------ - // Create position labels. - recordLabel_ = new JLabel(ResourceLoader.getText("DBFORM_LABEL_RECORD_NUMBER")); - recordNumber_ = new JLabel(); - - // Create all the buttons. - String text = ResourceLoader.getText("DBFORM_TOOLTIP_FIRST"); - firstButton_ = new JButton(ResourceLoader.getIcon("FirstIcon.gif", text)); - firstButton_.setToolTipText(text); - text = ResourceLoader.getText("DBFORM_TOOLTIP_LAST"); - lastButton_ = new JButton(ResourceLoader.getIcon("LastIcon.gif", text)); - lastButton_.setToolTipText(text); - text = ResourceLoader.getText("DBFORM_TOOLTIP_NEXT"); - nextButton_ = new JButton(ResourceLoader.getIcon("NextIcon.gif", text)); - nextButton_.setToolTipText(text); - text = ResourceLoader.getText("DBFORM_TOOLTIP_PREVIOUS"); - previousButton_ = new JButton(ResourceLoader.getIcon("PreviousIcon.gif", text)); - previousButton_.setToolTipText(text); - text = ResourceLoader.getText("DBFORM_TOOLTIP_REFRESH"); - refreshButton_ = new JButton(ResourceLoader.getIcon("RefreshIcon.gif", text)); - refreshButton_.setToolTipText(text); - // Add listeners to buttons to call correct functions. - ButtonListener_ l = new ButtonListener_(); - firstButton_.addActionListener(l); - lastButton_.addActionListener(l); - nextButton_.addActionListener(l); - previousButton_.addActionListener(l); - refreshButton_.addActionListener(l); - - // build center data area - dataArea_ = new JPanel(); - dataArea_.setBorder(new EmptyBorder(5,5,5,5)); - - // build status line - status_ = new JLabel(ResourceLoader.getText("DBFORM_MSG_NO_DATA")); - - //------------------------------------------------------ - // Build the constant screen components. Data fields will - // be added by reload(). - //------------------------------------------------------ - // Set main layout to border layout. - setLayout(new BorderLayout()); - // Add buttons to new panel. - JPanel panel1 = new JPanel(); - panel1.setLayout(new FlowLayout(FlowLayout.CENTER)); - panel1.add(firstButton_); - panel1.add(previousButton_); - panel1.add(nextButton_); - panel1.add(lastButton_); - panel1.add(refreshButton_); - // Add status line to new panel. - JPanel panel2 = new JPanel(); - panel2.setLayout(new FlowLayout(FlowLayout.CENTER)); - panel2.add(status_); - // Add buttons and status to bottom. - JPanel panel = new JPanel(); - panel.setLayout(new BorderLayout()); - panel.add("North", panel1); - panel.add("South", panel2); - add("South", panel); - // Add position labels. - panel = new JPanel(); - panel.setLayout(new FlowLayout(FlowLayout.LEFT)); - panel.add(recordLabel_); - panel.add(recordNumber_); - add("North", panel); - // Add center data area - add("Center", dataArea_); - -} - - - -/** -Refreshes the view based on the state of the system. -The first record will be displayed. -The labels are reconstructed, so any label customization will be lost. -The fielName and system properties -must be set before this method is called. -**/ -public void load () -{ - synchronized (this) - { - // Remove any previous components from the screen - dataArea_.removeAll(); - - // verify we have enough info to get data - IllegalStateException exception = null; - error_ = false; - if (tableData_.getSystem() == null) - { - exception = new IllegalStateException("system"); - error_ = true; - } - else if (tableData_.getFileName() == null) - { - exception = new IllegalStateException("fileName"); - error_ = true; - } - else - { - // Do a reload to make sure we have no errors. - // Other calls should not throw errors once a reload is done - // successfully. - tableData_.load(); - } - - if (error_) - { - values_ = new JTextField[0]; - labels_ = new JLabel[0]; - current_ = -1; - refreshScreen(); - if (exception != null) - throw exception; - return; - } - - // Build labels, values, and formatters. - // Add all fields to the screen. - int num = tableData_.getNumberOfColumns(); - // label variables - labels_ = new JLabel[num]; - JLabel label; - // value variables - values_ = new JTextField[num]; - JTextField value; - // formatter variables - DBCellRenderer leftCell = new DBCellRenderer(SwingConstants.LEFT); - formatter_ = new DBCellRenderer[num]; - - // panel setup - dataArea_.setLayout(new GridLayout(num,1)); - JPanel panel; - - int type, rlaType; - Class byteClass = (new byte[0]).getClass(); - // Loop through each field in the record. - for (int i=0; iload()
    is done. - -@param fileName The file name. - The name is specified as a fully qualified path name in the library file system. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setFileName (String fileName) - throws PropertyVetoException -{ - if (fileName == null) - throw new NullPointerException("fileName"); - - String old = getFileName(); - - // Fire a vetoable change event. - fireVetoableChange("fileName", old, fileName); - - // Make property change. - tableData_.setFileName(fileName); - - // Fire the property change event. - firePropertyChange("fileName", old, fileName); -} - - - -/** -Sets the key. -This property is bound and constrained. -Note that the data in the form will not change -until a load() is done. -The key is only used if the keyed property is true. - -@param key The values which make up the key with which - to find the record. - This value may be null. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setKey (Object[] key) - throws PropertyVetoException -{ - Object[] old = getKey(); - - // Fire a vetoable change event. - fireVetoableChange("key", old, key); - - // Make property change. - tableData_.setKey(key); - - // Fire the property change event. - firePropertyChange("key", old, key); -} - - -/** -Sets whether the file will be accessed in key or sequential order. -This property is bound and constrained. -Note that the data in the form will not change -until a load() is done. - -@param keyed true if the file will be accessed in key order; false - if the file will be accessed in sequential order. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setKeyed (boolean keyed) - throws PropertyVetoException -{ - Boolean old = new Boolean(getKeyed()); - - // Fire a vetoable change event. - fireVetoableChange("keyed", old, new Boolean(keyed)); - - // Make property change. - tableData_.setKeyed(keyed); - - // Fire the property change event. - firePropertyChange("keyed", old, new Boolean(keyed)); -} - - - -/** -Sets the text of the label at the given index. - -@param index The index of the label. Indices start at 0. -@param text The text of the label. -**/ -public void setLabelText(int index, - String text) -{ - labels_[index].setText(text); -} - - - -/** -Sets the search type. -This property is bound and constrained. -Note that the data in the form will not change -until a load() is done. -The search type is only used if the keyed property is true -and the key property is not null. - -@param searchType Constant indicating the type of match required. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setSearchType (int searchType) - throws PropertyVetoException -{ - int old = getSearchType(); - - // Fire a vetoable change event. - fireVetoableChange("searchType", - new Integer(old), new Integer(searchType)); - - // Make property change. - tableData_.setSearchType(searchType); - - // Fire the property change event. - firePropertyChange("searchType", - new Integer(old), new Integer(searchType)); -} - - - -/** -Sets the system where the file is located. -This property is bound and constrained. -Note that the data in the form will not change -until a load() is done. - -@param system The system where the file is located. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setSystem (AS400 system) - throws PropertyVetoException -{ - if (system == null) - throw new NullPointerException("system"); - - AS400 old = getSystem(); - - // Fire a vetoable change event. - fireVetoableChange("system", old, system); - - // Make property change. - tableData_.setSystem(system); - - // Fire the property change event. - firePropertyChange("system", old, system); -} - - - - - - - -/** -Class for listening to action events. This is used to call the -appropriate methods when buttons are pressed. -**/ -private class ButtonListener_ -implements ActionListener -{ - -public void actionPerformed(ActionEvent ev) -{ - // try to perform the appropriate action - Object source = ev.getSource(); - if (source == firstButton_) - { - displayFirst(); - } - else if (source == lastButton_) - { - displayLast(); - } - else if (source == nextButton_) - { - displayNext(); - } - else if (source == previousButton_) - { - displayPrevious(); - } - else if (source == refreshButton_) - { - load(); - } - // else unknown source - ignore -} - -} // end of class ButtonListener_ - - - - - -/** -Class for listening to error events. The error_ flag is set, -and the event's source is changed and redispatched to our listeners. -**/ -private class ErrorListener_ -implements ErrorListener -{ - -public void errorOccurred(ErrorEvent event) -{ - // set flag that an error occurred - error_ = true; - // Change the source in the event and fire - // to our listeners. - errorListeners_.fireError(event.getException()); -} - -} // end of class ErrorListener_ - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/RecordListFormPane16.gif b/cvsroot/src/com/ibm/as400/vaccess/RecordListFormPane16.gif deleted file mode 100644 index 7d93a139f..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/RecordListFormPane16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/RecordListFormPane32.gif b/cvsroot/src/com/ibm/as400/vaccess/RecordListFormPane32.gif deleted file mode 100644 index d0f7773f6..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/RecordListFormPane32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/RecordListFormPaneBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/RecordListFormPaneBeanInfo.java deleted file mode 100644 index 88b18bcb4..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/RecordListFormPaneBeanInfo.java +++ /dev/null @@ -1,191 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordListFormPaneBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - -/** -The RecordListFormPaneBeanInfo class provides bean -information for the RecordListFormPane class. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class RecordListFormPaneBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = RecordListFormPane.class; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - // ***** EVENTS - EventSetDescriptor error = new EventSetDescriptor(beanClass, - "error", - com.ibm.as400.vaccess.ErrorListener.class, - "errorOccurred"); - error.setDisplayName(ResourceLoader.getText("EVT_NAME_ERROR")); - error.setShortDescription(ResourceLoader.getText("EVT_DESC_ERROR")); - - EventSetDescriptor action = new EventSetDescriptor(beanClass, - "actionCompleted", - com.ibm.as400.access.ActionCompletedListener.class, - "actionCompleted"); - action.setDisplayName(ResourceLoader.getText("EVT_NAME_ACTION_COMPLETED")); - action.setShortDescription(ResourceLoader.getText("EVT_DESC_ACTION_COMPLETED")); - - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_VETO")); - - events_ = new EventSetDescriptor[]{error, action, changed, veto}; - - - // ***** PROPERTIES - PropertyDescriptor fileName = new PropertyDescriptor("fileName", beanClass); - fileName.setBound(true); - fileName.setConstrained(true); - fileName.setDisplayName(ResourceLoader.getText("PROP_NAME_FILE_NAME")); - fileName.setShortDescription(ResourceLoader.getText("PROP_DESC_FILE_NAME")); - - PropertyDescriptor system = new PropertyDescriptor("system", beanClass); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(ResourceLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceLoader.getText("PROP_DESC_SYSTEM")); - - PropertyDescriptor keyed = new PropertyDescriptor("keyed", beanClass); - keyed.setBound(true); - keyed.setConstrained(true); - keyed.setDisplayName(ResourceLoader.getText("PROP_NAME_KEYED")); - keyed.setShortDescription(ResourceLoader.getText("PROP_DESC_KEYED")); - - PropertyDescriptor key = new PropertyDescriptor("key", beanClass); - key.setBound(true); - key.setConstrained(true); - key.setDisplayName(ResourceLoader.getText("PROP_NAME_KEY")); - key.setShortDescription(ResourceLoader.getText("PROP_DESC_KEY")); - - PropertyDescriptor searchType = new PropertyDescriptor("searchType", beanClass); - searchType.setBound(true); - searchType.setConstrained(true); - searchType.setDisplayName(ResourceLoader.getText("PROP_NAME_SEARCH_TYPE")); - searchType.setShortDescription(ResourceLoader.getText("PROP_DESC_SEARCH_TYPE")); - - properties_ = new PropertyDescriptor[]{fileName, system, keyed, key, searchType}; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the error event - return 0; - } - - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the "fileName" property - return 0; - } - - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("RecordListFormPane16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("RecordListFormPane32.gif"); - break; - } - - return image; - } - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/RecordListTableModel.java b/cvsroot/src/com/ibm/as400/vaccess/RecordListTableModel.java deleted file mode 100644 index 3df628f15..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/RecordListTableModel.java +++ /dev/null @@ -1,909 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordListTableModel.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import javax.swing.SwingConstants; -import javax.swing.table.AbstractTableModel; -import javax.swing.table.TableColumn; -import javax.swing.event.TableModelEvent; -import com.ibm.as400.access.AS400; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.Serializable; -import java.util.Hashtable; -import java.util.Vector; - - - -/** -The RecordListTableModel class represents a table that contains -the records of a file using record-level access. -This model can be used to create a table of the results. - -

    This class should be used by users who wish to change the default -interface for the table. When the default look and behavior is -sufficient, RecordListTablePane can be used. - -

    Users must call close() to ensure that the system -resources are properly freed when this model is no longer needed. - -

    The data in the model is retrieved from the system when -load() is called. If load() is not called, -the model will contain no data. -Not all data is retrieved at once, rather data is retrieved as needed -(in chunks), to improve performance. - -

    The data in this model is not editable. The individual -cell values cannot be changed. - -

    Most errors are reported by firing ErrorEvents, rather -than throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    RecordListTableModel objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • TableModelEvent -
    • WorkingEvent -
    - -
    - // Set up table for file contents.
    -AS400 system = new AS400("MySystem", "Userid", "Password");
    -String file = "/QSYS.LIB/QGPL.LIB/MyFile.FILE";
    -final RecordListTableModel model = new RecordListTableModel(system, file);
    -
    - // Set up window to hold table
    -JFrame frame = new JFrame ("My Window");
    -WindowListener l = new WindowAdapter()
    -{
    -     // Close the model when window is closed.
    -    public void windowClosing(WindowEvent e)
    -    {
    -        model.close();
    -    }
    -};
    -frame.addWindowListener(l);
    -
    -// Set up the error dialog adapter.
    -model.addErrorListener (new ErrorDialogAdapter (frame));
    -
    -// Add the component and get data from system.
    -model.load();
    -JTable table = new JTable(model);
    -frame.getContentPane().add(new JScrollPane(table));
    -
    - // Display the window
    -frame.setVisible(true)
    -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -// Note that this class throws error and working events from within -// synchronized blocks, -// which could cause hangs if the handlers of these events do -// operations from a different thread an attempt to access another -// synchronized piece of code. -// At this time this seems to be an acceptable risk, since the -// events thrown are not likely to need enough processing to -// require another thread, and getting having the events thrown -// from outside a sychronized block would be nearly impossible. -// The other option is to have the firing of the events be done -// from another thread, but the overhead of creating another thread -// not only takes resources, but also delays the delivery of the event. -public class RecordListTableModel -extends AbstractTableModel -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// The variables which have private commented out had to made -// package scope since currently Internet Explorer does not -// allow inner class to access private variables in their -// containing class. - -/** -Constant indicating search type of equal. -**/ -static public final int KEY_EQ = RecordListData.KEY_EQ; -/** -Constant indicating search type of greater than. -**/ -static public final int KEY_GT = RecordListData.KEY_GT; -/** -Constant indicating search type of greater than or equal. -**/ -static public final int KEY_GE = RecordListData.KEY_GE; -/** -Constant indicating search type of less than. -**/ -static public final int KEY_LT = RecordListData.KEY_LT; -/** -Constant indicating search type of less than or equal. -**/ -static public final int KEY_LE = RecordListData.KEY_LE; - - -//The file from which records are being displayed. -private RecordListData tableData_ = new RecordListData(); - -// Column information -transient private int numColumns_ = 0; - -// Row information -// Number of records processed (put in local cache) at a time. -private static final int READ_INCREMENT_ = 20; -// Number of rows in the table. -// This value is only accurate if tableData_.getAllRecordsProcessed()==true. -// After load() it is 1. -// Otherwise it is data_.getLastRecordProcessed()+1. -// It is never greater than the number of actual rows, but it can be less. -transient private int numRows_ = 0; - - -// Event support. -transient private PropertyChangeSupport changeListeners_ - = new PropertyChangeSupport (this); -transient private VetoableChangeSupport vetoListeners_ - = new VetoableChangeSupport (this); -transient /*private*/ ErrorEventSupport errorListeners_ - = new ErrorEventSupport (this); -transient private WorkingEventSupport workListeners_ - = new WorkingEventSupport (this); - -// Private listener for if there errors occurred in tableData_. -transient private ErrorListener_ errorListener_ - = new ErrorListener_(); - -// Flag for if an error event was sent. -transient /*private*/ boolean error_; - - - - -/** -Constructs a RecordListTableModel object. -This constructor sets the keyed property to false. -**/ -public RecordListTableModel () -{ - super(); - - // Add self as listener for errors and work events - tableData_.addErrorListener(errorListener_); - tableData_.addWorkingListener (workListeners_); -} - - - -/** -Constructs a RecordListTableModel object. -This constructor sets the keyed property to false. - -@param system The system where the file is located. -@param fileName The file name. - The name is specified as a fully qualified path name in the library file system. -**/ -public RecordListTableModel (AS400 system, - String fileName) -{ - super(); - if (fileName == null) - throw new NullPointerException("fileName"); - if (system == null) - throw new NullPointerException("system"); - - tableData_.setFileName(fileName); - tableData_.setSystem(system); - - // Add self as listener for errors and work events - tableData_.addErrorListener(errorListener_); - tableData_.addWorkingListener (workListeners_); -} - - - -/** -Constructs a RecordListTableModel object. -This constructor sets the keyed property to true. - -@param system The system where the file is located. -@param fileName The keyed file name. - The name is specified as a fully qualified path name in the library file system. -@param key The values which make up the key with which - to find the record. - This value may be null. -@param searchType Constant indicating the type of match required. -**/ -public RecordListTableModel (AS400 system, - String fileName, - Object[] key, - int searchType) -{ - super(); - if (fileName == null) - throw new NullPointerException("fileName"); - if (system == null) - throw new NullPointerException("system"); - - tableData_.setFileName(fileName); - tableData_.setSystem(system); - tableData_.setKeyed(true); - tableData_.setKey(key); - tableData_.setSearchType(searchType); - - // Add self as listener for errors and work events - tableData_.addErrorListener(errorListener_); - tableData_.addWorkingListener (workListeners_); -} - - - -/** -Adds a listener to be notified when an error occurs. -The listener's errorOccurred() method will be called. - -@param listener The listener. -**/ -public void addErrorListener (ErrorListener listener) -{ - errorListeners_.addErrorListener (listener); -} - - - -/** -Adds a listener to be notified when the value of any bound -property is changed. -The listener's propertyChange() method will be called. - -@param listener The listener. -**/ -public void addPropertyChangeListener (PropertyChangeListener listener) -{ - changeListeners_.addPropertyChangeListener (listener); -} - - - -/** -Adds a listener to be notified when the value of any constrained -property is changed. -The listener's vetoableChange() method will be called. - -@param listener The listener. -**/ -public void addVetoableChangeListener (VetoableChangeListener listener) -{ - vetoListeners_.addVetoableChangeListener (listener); -} - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ -public void addWorkingListener (WorkingListener listener) -{ - workListeners_.addWorkingListener (listener); -} - - -/** -Closes the file this model represents. -**/ -public void close () -{ - tableData_.close(); -} - - -/** -Returns the class of the values in the column. -If an error occurs, null is returned. - -@param columnIndex The index of the column. Indices start at 0. - -@return The class of the column values. -**/ -/*@D0D synchronized */ public Class getColumnClass(int columnIndex) -{ - if (columnIndex >= numColumns_) - { - Trace.log(Trace.WARNING, "getColumnClass() error - index out of bounds."); - return null; - } - - // Try to get the value of a column. - Object value = null; - for (int i=0; i < getRowCount() && value == null; ++i) - { - value = getValueAt(i, columnIndex); - } - - if (value != null) // error getting value or all values null - return value.getClass(); - else - { - try - { - return Class.forName("java.lang.Object"); - } - catch(ClassNotFoundException e) - { - return null; - } - } -} - - -/** -Returns the number of columns in the table. - -@return The number of columns in the table. -**/ -/*@D0D synchronized */ public int getColumnCount() -{ - if (Trace.isTraceOn() && Trace.isTraceDiagnosticOn()) //@D0A - Trace.log(Trace.DIAGNOSTIC, "getColumnCount:", numColumns_); - return numColumns_; -} - - -/** -Returns the identifier of the column. This is the field name in -the database. -If an error occurs, null is returned. - -@param columnIndex The index of the column. Indices start at 0. - -@return The column identifier. -**/ -/*@D0D synchronized */ public String getColumnID(int columnIndex) -{ - if (columnIndex >= numColumns_) - { - Trace.log(Trace.WARNING, "getColumnID() error - index out of bounds."); - return null; - } - return tableData_.getColumnName(columnIndex); -} - - -/** -Returns the name of the column for use in a table heading. -If an error occurs, null is returned. - -@param columnIndex The index of the column. Indices start at 0. - -@return The column name. -**/ -/*@D0D synchronized */ public String getColumnName(int columnIndex) -{ - if (columnIndex >= numColumns_) - { - Trace.log(Trace.WARNING, "getColumnName() error - index out of bounds."); - return null; - } - return tableData_.getColumnLabel(columnIndex); -} - - - -/** -Returns the width of a column as a character count. -If an error occurs, 0 is returned. - -@param columnIndex The index of the column. Indices start at 0. - -@return The width of the column expressed as a character count. -**/ -/*@D0D synchronized */ public int getColumnWidth(int columnIndex) -{ - if (columnIndex >= numColumns_) - { - Trace.log(Trace.WARNING, "getColumnWidth() error - index out of bounds."); - return 0; - } - return tableData_.getColumnDisplaySize(columnIndex); -} - - -/** -Returns the file name. -The name is formatted as a fully qualified path name in the library file system. - -@return The file name. -**/ -public String getFileName () -{ - String result = tableData_.getFileName(); - if (result == null) - return ""; - return result; -} - - - -/** -Returns the key. -The key is only used if the keyed property is true. - -@return The key. -**/ -public Object[] getKey () -{ - return tableData_.getKey(); -} - - -/** -Returns whether the file will be accessed in key or sequential order. - -@return true if the file will be accessed in key order; false - if the file will be accessed in sequential order. -**/ -public boolean getKeyed () -{ - return tableData_.getKeyed(); -} - - - -/** -Returns the number of rows in the table. -Because of incremental data retrieval, this value may -not be accurate. - -@return The number of rows in the table. -**/ -/*@D0D synchronized */ public int getRowCount() -{ - if (Trace.isTraceOn() && Trace.isTraceDiagnosticOn()) //@D0A - Trace.log(Trace.DIAGNOSTIC, "getRowCount:", numRows_); - return numRows_; -} - - - -/** -Returns the search type. -The search type is only used if the keyed property is true -and the key property is not null. - -@return The search type. -**/ -public int getSearchType () -{ - return tableData_.getSearchType(); -} - - - -/** -Returns the system where the file is located. - -@return The system where the file is located. -**/ -public AS400 getSystem () -{ - return tableData_.getSystem(); -} - - -/** -Returns the value at the specifed column and row. -If an error occurs, null is returned. - -@param rowIndex The row index. Values start at 0. -@param columnIndex The column index. Values start at 0. - -@return The value at the specified column and row. -**/ -public Object getValueAt (int rowIndex, - int columnIndex) -{ - TableModelEvent event = null; - error_ = false; // set to true if we should return null - - synchronized(this) - { - - Trace.log(Trace.DIAGNOSTIC, "getValueAt[" +rowIndex+ "][" +columnIndex+ "]"); - if (tableData_ == null) - { - Trace.log(Trace.WARNING, "getValueAt() error - no load done."); - return null; - } - if (columnIndex >= numColumns_) - { - Trace.log(Trace.WARNING, "getValueAt() error - column index out of range."); - return null; - } - - // If all records read, verify the row is in range. - if (tableData_.getAllRecordsProcessed() && - rowIndex >= tableData_.getNumberOfRows()) - { - Trace.log(Trace.WARNING, "getValueAt() error - row out of range."); - return null; - } - - // If we haven't yet transferred this row from the - // result set to the table cache, do so. - error_ = false; - if (tableData_.getLastRecordProcessed() < rowIndex) - { - if (rowIndex - tableData_.getLastRecordProcessed() > READ_INCREMENT_) - tableData_.readMoreRecords(rowIndex - tableData_.getLastRecordProcessed()); - else - tableData_.readMoreRecords(READ_INCREMENT_); - - int oldnum = numRows_; - - if (tableData_.getAllRecordsProcessed()) - { - numRows_ = tableData_.getLastRecordProcessed()+1; // numRows is 1-based - Trace.log(Trace.INFORMATION, "All rows read, number of rows:", numRows_); - // Verify the row is in range. - if (rowIndex >= tableData_.getNumberOfRows()) - { - Trace.log(Trace.WARNING, "getValueAt() error - row out of range(2)."); - error_ = true; - } - } - else - // Add 2 - numRows_ is 1-based, plus there are more records. - numRows_ = tableData_.getLastRecordProcessed()+2; - - // Notify listeners that we've changed. - event = new TableModelEvent(this, oldnum, numRows_-1, - TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT); - } - } // end synchronized block - - if (event != null) - { - fireTableChanged(event); - Trace.log(Trace.INFORMATION, "Changed number of rows to:", numRows_); - } - - // return the value - if (error_) - return null; - return tableData_.getValueAt(rowIndex, columnIndex); -} - - - -/** -Loads the table based on the state of the system. -The system and fileName properties must be set -before this method is called. -**/ -public void load () -{ - Trace.log(Trace.DIAGNOSTIC, "Doing model load."); - - TableModelEvent event = null; - int oldnum = 0; - synchronized(this) - { - oldnum = numRows_-1; - if (numRows_ > 0) - { - // Set columns and rows to 0 while we rebuild. - numColumns_ = 0; - numRows_ = 0; - event = new TableModelEvent(this, 0, oldnum, - TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE); - } - } - - if (event != null) - { - // notify listeners that we've deleted all rows. - fireTableChanged(event); - Trace.log(Trace.INFORMATION, "Starting load, changed number of rows to:", numRows_); - } - - // verify we have enough info to get data - if (tableData_.getSystem() == null) - { - throw new IllegalStateException("system"); - } - if (tableData_.getFileName() == null) - { - throw new IllegalStateException("fileName"); - } - - synchronized(this) - { - error_ = false; - // Do a load to make sure we have no errors. - // Other calls should not throw errors once a load is done - // successfully. - tableData_.load(); - if (error_) - return; - - // get info about the columns returned - numColumns_ = tableData_.getNumberOfColumns(); - - if (tableData_.getAllRecordsProcessed()) - // covers case when no rows - numRows_ = tableData_.getNumberOfRows(); - else - // Set number of rows to default - numRows_ = 1; - } - - if (numRows_ > 0) - { - // notify listeners that we've changed - event = new TableModelEvent(this, 0, numRows_-1, - TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT); - fireTableChanged(event); - Trace.log(Trace.INFORMATION, "Did load, changed number of rows to:", numRows_); - } -} - - -/** -Restore the state of this object from an object input stream. -It is used when deserializing an object. -@param in The input stream of the object being deserialized. -@exception IOException -@exception ClassNotFoundException -**/ -private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException -{ - // Restore the non-static and non-transient fields. - in.defaultReadObject(); - // Initialize the transient fields. - changeListeners_ = new PropertyChangeSupport(this); - vetoListeners_ = new VetoableChangeSupport(this); - errorListeners_ = new ErrorEventSupport(this); - workListeners_ = new WorkingEventSupport(this); - errorListener_ = new ErrorListener_(); - numRows_ = 0; - numColumns_ = 0; - - // Add self as listener for errors and work events - tableData_.addErrorListener(errorListener_); - tableData_.addWorkingListener (workListeners_); -} - - -/** -Removes a listener from being notified when an error occurs. - -@param listener The listener. -**/ -public void removeErrorListener (ErrorListener listener) -{ - errorListeners_.removeErrorListener (listener); -} - - - -/** -Removes a listener from being notified when the value of any bound -property is changed. - -@param listener The listener. -**/ -public void removePropertyChangeListener (PropertyChangeListener listener) -{ - changeListeners_.removePropertyChangeListener (listener); -} - - - -/** -Removes a listener from being notified when the value of any constrained -property is changed. - -@param listener The listener. -**/ -public void removeVetoableChangeListener (VetoableChangeListener listener) -{ - vetoListeners_.removeVetoableChangeListener (listener); -} - - - -/** -Removes a listener from being notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ -public void removeWorkingListener (WorkingListener listener) -{ - workListeners_.removeWorkingListener (listener); -} - - - -/** -Sets the name of the file. -This property is bound and constrained. -Note that the data will not change until a load() is done. - -@param fileName The file name. - The name is specified as a fully qualified path name in the library file system. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setFileName (String fileName) - throws PropertyVetoException -{ - if (fileName == null) - throw new NullPointerException("fileName"); - - String old = getFileName(); - - // Fire a vetoable change event. - vetoListeners_.fireVetoableChange("fileName", old, fileName); - - // Make property change. - tableData_.setFileName(fileName); - - // Fire the property change event. - changeListeners_.firePropertyChange("fileName", old, fileName); -} - - - -/** -Sets the key. -This property is bound and constrained. -Note that the data will not change until a load() is done. -The key is only used if the keyed property is true. - -@param key The values which make up the key with which - to find the record. - This value may be null. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setKey (Object[] key) - throws PropertyVetoException -{ - Object[] old = getKey(); - - // Fire a vetoable change event. - vetoListeners_.fireVetoableChange("key", old, key); - - // Make property change. - tableData_.setKey(key); - - // Fire the property change event. - changeListeners_.firePropertyChange("key", old, key); -} - - -/** -Sets whether the file will be accessed in key or sequential order. -This property is bound and constrained. -Note that the data in will not change -until a load() is done. - -@param keyed true if the file will be accessed in key order; false - if the file will be accessed in sequential order. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setKeyed (boolean keyed) - throws PropertyVetoException -{ - Boolean old = new Boolean(getKeyed()); - - // Fire a vetoable change event. - vetoListeners_.fireVetoableChange("keyed", old, new Boolean(keyed)); - - // Make property change. - tableData_.setKeyed(keyed); - - // Fire the property change event. - changeListeners_.firePropertyChange("keyed", old, new Boolean(keyed)); -} - - - -/** -Sets the search type. -This property is bound and constrained. -Note that the data will not change until a load() is done. -The default is KEY_EQ. -The search type is only used if the keyed property is true -and the key property is not null. - -@param searchType Constant indicating the type of match required. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setSearchType (int searchType) - throws PropertyVetoException -{ - int old = getSearchType(); - - // Fire a vetoable change event. - vetoListeners_.fireVetoableChange("searchType", - new Integer(old), new Integer(searchType)); - - // Make property change. - tableData_.setSearchType(searchType); - - // Fire the property change event. - changeListeners_.firePropertyChange("searchType", - new Integer(old), new Integer(searchType)); -} - - - -/** -Sets the system where the file is located. -This property is bound and constrained. -Note that the data will not change until a load() is done. - -@param system The system where the file is located. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setSystem (AS400 system) - throws PropertyVetoException -{ - if (system == null) - throw new NullPointerException("system"); - - AS400 old = getSystem(); - - // Fire a vetoable change event. - vetoListeners_.fireVetoableChange("system", old, system); - - // Make property change. - tableData_.setSystem(system); - - // Fire the property change event. - changeListeners_.firePropertyChange("system", old, system); -} - - - -/** -Class for listening to error events. The error_ flag is set, -and the event's source is changed and redispatched to our listeners. -**/ -private class ErrorListener_ -implements ErrorListener -{ - -public void errorOccurred(ErrorEvent event) -{ - // set flag that an error occurred - error_ = true; - // Change the source in the event and fire - // to our listeners. - errorListeners_.fireError(event.getException()); -} - -} // end of class ErrorListener_ - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/RecordListTableModel16.gif b/cvsroot/src/com/ibm/as400/vaccess/RecordListTableModel16.gif deleted file mode 100644 index f8014e1e1..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/RecordListTableModel16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/RecordListTableModel32.gif b/cvsroot/src/com/ibm/as400/vaccess/RecordListTableModel32.gif deleted file mode 100644 index 4a15a5a68..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/RecordListTableModel32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/RecordListTableModelBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/RecordListTableModelBeanInfo.java deleted file mode 100644 index bd20a5a74..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/RecordListTableModelBeanInfo.java +++ /dev/null @@ -1,201 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordListTableModelBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - -/** -The RecordListTableModelBeanInfo class provides bean -information for the RecordListTableModel class. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class RecordListTableModelBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = RecordListTableModel.class; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - // ***** EVENTS - EventSetDescriptor error = new EventSetDescriptor(beanClass, - "error", - com.ibm.as400.vaccess.ErrorListener.class, - "errorOccurred"); - error.setDisplayName(ResourceLoader.getText("EVT_NAME_ERROR")); - error.setShortDescription(ResourceLoader.getText("EVT_DESC_ERROR")); - - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor model = new EventSetDescriptor(beanClass, - "tableModel", - javax.swing.event.TableModelListener.class, - "tableChanged"); - model.setDisplayName(ResourceLoader.getText("EVT_NAME_TABLE_MODEL")); - model.setShortDescription(ResourceLoader.getText("EVT_DESC_TABLE_MODEL")); - - String[] workingMethods = {"startWorking", "stopWorking"}; - EventSetDescriptor working = new EventSetDescriptor(beanClass, - "working", - com.ibm.as400.vaccess.WorkingListener.class, - workingMethods, - "addWorkingListener", - "removeWorkingListener"); - working.setDisplayName(ResourceLoader.getText("EVT_NAME_WORKING")); - working.setShortDescription(ResourceLoader.getText("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[]{error, changed, veto, model, working}; - - - // ***** PROPERTIES - PropertyDescriptor fileName = new PropertyDescriptor("fileName", beanClass); - fileName.setBound(true); - fileName.setConstrained(true); - fileName.setDisplayName(ResourceLoader.getText("PROP_NAME_FILE_NAME")); - fileName.setShortDescription(ResourceLoader.getText("PROP_DESC_FILE_NAME")); - - PropertyDescriptor system = new PropertyDescriptor("system", beanClass); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(ResourceLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceLoader.getText("PROP_DESC_SYSTEM")); - - PropertyDescriptor keyed = new PropertyDescriptor("keyed", beanClass); - keyed.setBound(true); - keyed.setConstrained(true); - keyed.setDisplayName(ResourceLoader.getText("PROP_NAME_KEYED")); - keyed.setShortDescription(ResourceLoader.getText("PROP_DESC_KEYED")); - - PropertyDescriptor key = new PropertyDescriptor("key", beanClass); - key.setBound(true); - key.setConstrained(true); - key.setDisplayName(ResourceLoader.getText("PROP_NAME_KEY")); - key.setShortDescription(ResourceLoader.getText("PROP_DESC_KEY")); - - PropertyDescriptor searchType = new PropertyDescriptor("searchType", beanClass); - searchType.setBound(true); - searchType.setConstrained(true); - searchType.setDisplayName(ResourceLoader.getText("PROP_NAME_SEARCH_TYPE")); - searchType.setShortDescription(ResourceLoader.getText("PROP_DESC_SEARCH_TYPE")); - - properties_ = new PropertyDescriptor[]{fileName, system, keyed, key, searchType}; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the error event - return 0; - } - - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the "fileName" property - return 0; - } - - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("RecordListTableModel16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("RecordListTableModel32.gif"); - break; - } - - return image; - } - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/RecordListTablePane.java b/cvsroot/src/com/ibm/as400/vaccess/RecordListTablePane.java deleted file mode 100644 index 61679e36d..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/RecordListTablePane.java +++ /dev/null @@ -1,1127 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordListTablePane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.ListSelectionModel; -import javax.swing.SwingConstants; -import javax.swing.SwingUtilities; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ListSelectionListener; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.TableColumn; -import javax.swing.table.TableColumnModel; -import com.ibm.as400.access.AS400; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.IOException; -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.Enumeration; - - - -/** -The RecordListTablePane class represents a table that contains -the records and fields of a file using record-level access. - -

    The data in the table is retrieved from the system when -load() is called. If load() is not called, -the table will be empty. - -

    Users must call close() to ensure that the system -resources are properly freed when this table is no longer needed. - -

    Most errors are reported by firing ErrorEvents, rather -than throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    The data in this table is not editable, the individual -cell values cannot be changed. - -

    RecordListTablePane objects generate the following events: -

      -
    • ErrorEvent -
    • ListSelectionEvent -
    • PropertyChangeEvent -
    - -
    - // Set up table for file contents.
    -AS400 system = new AS400("MySystem", "Userid", "Password");
    -String file = "/QSYS.LIB/QGPL.LIB/MyFile.FILE";
    -final RecordListTablePane pane = new RecordListTablePane(system, file);
    -
    - // Set up window to hold table
    -JFrame frame = new JFrame ("My Window");
    -WindowListener l = new WindowAdapter()
    -{
    -     // Close the model when window is closed.
    -    public void windowClosing(WindowEvent e)
    -    {
    -        pane.close();
    -    }
    -};
    -frame.addWindowListener(l);
    -
    -// Set up the error dialog adapter.
    -pane.addErrorListener (new ErrorDialogAdapter (frame));
    -
    -// Add the component and get data from system.
    -frame.getContentPane().add(pane);
    -pane.load();
    -
    - // Display the window
    -frame.setVisible(true)
    -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class RecordListTablePane -extends JComponent -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - -// The variables and methods which have private commented out -// had to be made package scope since some JVMs (IE and AS400) -// does not allow inner class to access private items in their -// containing class. - -/** -Constant indicating search type of equal. -**/ -static public final int KEY_EQ = RecordListData.KEY_EQ; -/** -Constant indicating search type of greater than. -**/ -static public final int KEY_GT = RecordListData.KEY_GT; -/** -Constant indicating search type of greater than or equal. -**/ -static public final int KEY_GE = RecordListData.KEY_GE; -/** -Constant indicating search type of less than. -**/ -static public final int KEY_LT = RecordListData.KEY_LT; -/** -Constant indicating search type of less than or equal. -**/ -static public final int KEY_LE = RecordListData.KEY_LE; - - -// The table contained in this panel. -/*private*/ transient JTable table_; //@B0C - made transient -/*private*/ transient JScrollPane tablePane_; //@B0C - made transient -// The data model for the table. -/*private*/ RecordListTableModel model_; - -//@B0 - need to save the table's state since it's transient now. -private Color tableColor_ = null; //@B0A -private boolean tableShowHorizontalLines_ = true; //@B0A -private boolean tableShowVerticalLines_ = true; //@B0A - - -// Event support. -transient private PropertyChangeSupport changeListeners_ - = new PropertyChangeSupport(this); -transient private VetoableChangeSupport vetoListeners_ - = new VetoableChangeSupport(this); -transient private ErrorEventSupport errorListeners_ - = new ErrorEventSupport(this); -transient private ListSelectionEventSupport selectionListeners_ - = new ListSelectionEventSupport(this); - -// Adapter for listening for working events and enabling working cursor. -transient private WorkingCursorAdapter worker_ - = new WorkingCursorAdapter(this); - -// Renderers for the different types of data, columns use these. -/*private*/ DBCellRenderer rightCell_ = new DBCellRenderer(SwingConstants.RIGHT); -/*private*/ DBCellRenderer leftCell_ = new DBCellRenderer(SwingConstants.LEFT); -// General types of data in columns. Used to determine column renderer. -private static final int TYPE_CHAR = 1; -private static final int TYPE_HEX = 2; -private static final int TYPE_NUMBER = 3; - - -/** -Constructs a RecordListTablePane object. -This constructor sets the keyed property to false. -**/ -public RecordListTablePane () -{ - super(); - - // Create table and model to hold data. - model_ = new RecordListTableModel(); - -/* @B0M - moved code to initializeTransient() - table_ = new JTable(); - table_.setAutoCreateColumnsFromModel(false); - table_.setModel(model_); - table_.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - - // Listen for events, pass them on to our listeners. - model_.addPropertyChangeListener(changeListeners_); - model_.addVetoableChangeListener(vetoListeners_); - model_.addErrorListener(errorListeners_); - model_.addWorkingListener(worker_); - table_.getSelectionModel().addListSelectionListener(selectionListeners_); - - // Build GUI - setLayout(new BorderLayout()); - tablePane_ = new JScrollPane (table_); // @A1C - add("Center",tablePane_); -*/ - initializeTransient(); //@B0A -} - - - -/** -Constructs a RecordListTablePane object. -This constructor sets the keyed property to false. - -@param system The system where the file is located. -@param fileName The file name. - The name is specified as a fully qualified path name in the library file system. -**/ -public RecordListTablePane (AS400 system, - String fileName) -{ - super(); - - // Create table and model to hold data. - // note: model validates parms - model_ = new RecordListTableModel(system, fileName); - -/* @B0M - moved code to initializeTransient() - table_ = new JTable(); - table_.setAutoCreateColumnsFromModel(false); - table_.setModel(model_); - table_.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - - // Listen for events, pass them on to our listeners. - model_.addPropertyChangeListener(changeListeners_); - model_.addVetoableChangeListener(vetoListeners_); - model_.addErrorListener(errorListeners_); - model_.addWorkingListener(worker_); - table_.getSelectionModel().addListSelectionListener(selectionListeners_); - - // Build GUI - setLayout(new BorderLayout()); - tablePane_ = new JScrollPane (table_); // @A1C - add("Center",tablePane_); -*/ - initializeTransient(); //@B0A -} - - - -/** -Constructs a RecordListTablePane object. -This constructor sets the keyed property to true. - -@param system The system where the file is located. -@param fileName The keyed file name. - The name is specified as a fully qualified path name in the library file system. -@param key The values which make up the key with which - to find the record. - This value may be null. -@param searchType Constant indicating the type of match required. -**/ -public RecordListTablePane (AS400 system, - String fileName, - Object[] key, - int searchType) -{ - super(); - - // Create table and model to hold data. - // note: model validates parms - model_ = new RecordListTableModel(system, fileName, key, searchType); - -/* @B0M - moved code to initializeTransient() - table_ = new JTable(); - table_.setAutoCreateColumnsFromModel(false); - table_.setModel(model_); - table_.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - - // Listen for events, pass them on to our listeners. - model_.addPropertyChangeListener(changeListeners_); - model_.addVetoableChangeListener(vetoListeners_); - model_.addErrorListener(errorListeners_); - model_.addWorkingListener(worker_); - table_.getSelectionModel().addListSelectionListener(selectionListeners_); - - // Build GUI - setLayout(new BorderLayout()); - tablePane_ = new JScrollPane (table_); // @A1C - add("Center",tablePane_); -*/ - initializeTransient(); //@B0A -} - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ -public void addErrorListener (ErrorListener listener) -{ - errorListeners_.addErrorListener(listener); -} - - -/** -Adds a listener to be notified when the selection changes. - -@param listener The listener. -**/ -public void addListSelectionListener (ListSelectionListener listener) -{ - selectionListeners_.addListSelectionListener(listener); -} - - - -/** -Adds a listener to be notified when the value of any bound -property is changed. - -@param listener The listener. -**/ -public void addPropertyChangeListener (PropertyChangeListener listener) -{ - changeListeners_.addPropertyChangeListener(listener); - super.addPropertyChangeListener(listener); -} - - -/** -Adds a listener to be notified when the value of any constrained -property is changed. - -@param listener The listener. -**/ -public void addVetoableChangeListener (VetoableChangeListener listener) -{ - vetoListeners_.addVetoableChangeListener(listener); - super.addVetoableChangeListener(listener); -} - - -/** -Closes the file this table represents. -**/ -public void close() -{ - model_.close(); -} - - - -/** -Returns the column model for this table. - -@return The model for this table's columns. -**/ -public TableColumnModel getColumnModel() -{ - return table_.getColumnModel(); -} - - - -/** -Returns the title of a column. This is used for the table column heading. -If an error occurs, null is returned. - -@param columnIndex The index of the column. Indices start at 0. - -@return The title of the column. -**/ -public String getColumnTitle(int columnIndex) -{ - try - { - return (String)(table_.getColumnModel().getColumn(columnIndex).getHeaderValue()); - } - catch (Exception e) - { - Trace.log(Trace.WARNING, "getColumnTitle() error:" + e); - return null; - } -} - - - -/** -Returns the width of a column. -If an error occurs, 0 is returned. - -@param columnIndex The index of the column. Indices start at 0. - -@return The width of the column. -**/ -public int getColumnWidth(int columnIndex) -{ - try - { - return table_.getColumnModel().getColumn(columnIndex).getPreferredWidth(); //@B1C - } - catch (Exception e) - { - Trace.log(Trace.WARNING, "getColumnWidth() error:" + e); - return 0; - } -} - - - -/** -Returns the data model for the table. - -@return The data model for the table. -**/ -public RecordListTableModel getDataModel() -{ - return model_; -} - - -/** -Returns the file name. -The name is formatted as a fully qualified path name in the library file system. - -@return The file name. -**/ -public String getFileName () -{ - return model_.getFileName(); -} - - - -/** -Returns the color used to draw grid lines. - -@return The color used to draw grid lines. -**/ -public Color getGridColor() -{ -//@B0D return table_.getGridColor(); - return tableColor_; //@B0A -} - - - -/** -Returns the key. -The key is only used if the keyed property is true. - -@return The key. -**/ -public Object[] getKey () -{ - return model_.getKey(); -} - - -/** -Returns whether the file will be accessed in key or sequential order. - -@return true if the file will be accessed in key order; false - if the file will be accessed in sequential order. -**/ -public boolean getKeyed () -{ - return model_.getKeyed(); -} - - - -/** -Returns the search type. -The search type is only used if the keyed property is true -and the key property is not null. - -@return The search type. -**/ -public int getSearchType () -{ - return model_.getSearchType(); -} - - - -/** -Returns the ListSelectionModel that is used to maintain row selection state. - -@return The model that provides row selection state. -**/ -public ListSelectionModel getSelectionModel() -{ - return table_.getSelectionModel(); -} - - - -/** -Returns whether horizontal lines are drawn between rows. -@return true if horizontal lines are to be drawn; false otherwise. -**/ -public boolean getShowHorizontalLines() -{ -//@B0D return table_.getShowHorizontalLines(); - return tableShowHorizontalLines_; //@B0A -} - - - -/** -Returns whether vertical lines are drawn between columns. -@return true if vertical lines are to be drawn; false otherwise. -**/ -public boolean getShowVerticalLines() -{ -//@B0D return table_.getShowVerticalLines(); - return tableShowVerticalLines_; //@B0A -} - - - -/** -Returns the system where the file is located. - -@return The system where the file is located. -**/ -public AS400 getSystem () -{ - return model_.getSystem(); -} - - - -/** -Returns the string value at the specifed row and column. -Indices start at 0. -If an error occurs, null is returned. - -@param rowIndex The row index. -@param columnIndex The column index. - -@return The value at the specified row and column as a string. -**/ -// Note that this method is dependent on the cell renderer of a column -// being a JLabel. -public String getStringValueAt (int rowIndex, - int columnIndex) -{ - // Try to catch row index out of range. - if (rowIndex >= model_.getRowCount() ) - { - Trace.log(Trace.WARNING, "getStringValueAt() column out of range"); - return null; - } - - try - { - TableColumnModel cmodel = getColumnModel(); - Component cellComp = cmodel.getColumn(columnIndex) - .getCellRenderer() - .getTableCellRendererComponent(table_, - getValueAt(rowIndex,columnIndex), - false, - false, - rowIndex, - columnIndex); - if (cellComp instanceof JLabel) - return ((JLabel)cellComp).getText(); - else - return null; - } - catch(Exception e) - { - Trace.log(Trace.WARNING, "getStringValueAt() error:" + e); - return null; - } -} - - - -/** -Returns the value at the specifed row and column. -Indices start at 0. -If an error occurs, null is returned. - -@param rowIndex The row index. -@param columnIndex The column index. - -@return The value at the specified row and column. -**/ -public Object getValueAt (int rowIndex, - int columnIndex) -{ - try - { - // must change the table column index to the - // model index - return model_.getValueAt(rowIndex, - getColumnModel().getColumn(columnIndex).getModelIndex()); - } - catch(Exception e) - { - Trace.log(Trace.WARNING, "getStringValueAt() error:" + e); - return null; - } -} - - -//@B0A -/** -Initializes the transient data. -**/ -private void initializeTransient() -{ - - //@B0M - moved this code out of constructors - - table_ = new JTable(); - table_.setAutoCreateColumnsFromModel(false); - table_.setModel(model_); - table_.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - - if (tableColor_ == null) tableColor_ = table_.getGridColor(); //@B1A - - // Listen for events, pass them on to our listeners. - model_.addPropertyChangeListener(changeListeners_); - model_.addVetoableChangeListener(vetoListeners_); - model_.addErrorListener(errorListeners_); - model_.addWorkingListener(worker_); - table_.getSelectionModel().addListSelectionListener(selectionListeners_); - - setLayout(new BorderLayout()); - tablePane_ = new JScrollPane (table_); // @A1C - add("Center",tablePane_); - - //@B0A - // We add a fake FocusListener whose real purpose is to uninstall - // the UI early so the JTable that is part of our UI does not try - // to get serialized. - // See also: source code for javax.swing.JComponent in JDK 1.2. - addFocusListener(new SerializationListener(this)); //@B0A - addFocusListener(new SerializationListener(model_, table_)); //@B0A - -} - - -/** -Loads the table based on the state of the system. -The fileName and system properties -must be set before this method is called. -The table heading is reconstructed to ensure it matches -the data, so any column customization will be lost. -**/ -public void load() -{ - // refresh the result set data - // note: model handles error conditions - model_.load(); - refreshHeadings(); -} - - - -/** -Moves the column and heading at columnIndex to newIndex. -The old column at columnIndex will now be found at newIndex, -the column that used to be at newIndex is shifted left or right -to make room. -Indices start at 0. - -@param columnIndex The index of column to be moved. -@param newIndex The new index to move the column to. -**/ -public void moveColumn(int columnIndex, - int newIndex) -{ - // Catch errors if index being out of range. - try - { - table_.getColumnModel().moveColumn(columnIndex,newIndex); - } - catch(Exception e) - { - Trace.log(Trace.WARNING, "moveColumn() error:" + e); - } -} - - -/** -Restore the state of this object from an object input stream. -It is used when deserializing an object. -@param in The input stream of the object being deserialized. -@throws IOException -@throws ClassNotFoundException -**/ -private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException -{ - // Restore the non-static and non-transient fields. - in.defaultReadObject(); - - // Initialize the transient fields. - changeListeners_ = new PropertyChangeSupport(this); - model_.addPropertyChangeListener(changeListeners_); - vetoListeners_ = new VetoableChangeSupport(this); - model_.addVetoableChangeListener(vetoListeners_); - errorListeners_ = new ErrorEventSupport(this); - model_.addErrorListener(errorListeners_); - worker_ = new WorkingCursorAdapter(this); - model_.addWorkingListener(worker_); - selectionListeners_ = new ListSelectionEventSupport(this); - - initializeTransient(); //@B0A - //@B0D table_.getSelectionModel().addListSelectionListener(selectionListeners_); - - - //@B0 - table_ is now transient, so we need to reset its attributes. - table_.setGridColor(tableColor_); //@B0A - table_.setShowHorizontalLines(tableShowHorizontalLines_); //@B0A - table_.setShowVerticalLines(tableShowVerticalLines_); //@B0A - -} - - - -/** -Updates the table header to match the data. -Any column customization will be lost. -**/ -public void refreshHeadings() -{ - Runnable refreshHeading = new Runnable() - { - public void run() - { - - - // Remove all columns. - // First copy enumereration, then delete each column. - TableColumnModel model = table_.getColumnModel(); - int oldColumnCount = model.getColumnCount(); - TableColumn oldColumns[] = new TableColumn[oldColumnCount]; - Enumeration e = model.getColumns(); - for (int i=0; e.hasMoreElements() ; ++i) - { - oldColumns[i] = (TableColumn)e.nextElement(); - } - for (int i=0; icolTitleSize?colDataSize:colTitleSize; - // add 10 to account for the empty border in the cells - col.setPreferredWidth(colSize*size+10); //@B1C - } - - table_.addColumn(col); - } - - // Redo the panel. This is needed in the case where there was - // no data previously, since no header would have been created - // for the table. Only done if no previous columns, and now - // there are columns. - if (oldColumnCount == 0 && numColumns > 0) - { - if (tablePane_ != null) - remove(tablePane_); - tablePane_ = new JScrollPane (table_); // @A1C - add("Center",tablePane_); - } - - // Refresh the pane. - validate(); - - - } - }; - - // Try and refresh the heading in the event dispatcher thread. - // This is done because doing it inline seems to cause hangs, - // and Swing documentation seems to suggest doing all GUI - // work in the event dispatching thread. - try - { - SwingUtilities.invokeAndWait(refreshHeading); - } - catch(Error e) - { - // Error received. Assume that the error was because we are - // already in the event dispatching thread. Do work in the - // current thread. - Trace.log(Trace.DIAGNOSTIC, "invokeAndWait error:" + e); - refreshHeading.run(); - } - catch(Exception e) - { - Trace.log(Trace.ERROR, "invokeAndWait exception:" + e); - } -} - - - -/** -Removes a column from the table. - -@param columnIndex The index of column. Indices start at 0. -**/ -public void removeColumn(int columnIndex) -{ - // Catch errors if the index being out of range. - try - { - table_.getColumnModel().removeColumn - (table_.getColumnModel().getColumn(columnIndex)); - } - catch(Exception e) - { - Trace.log(Trace.WARNING, "removeColumn() error:" + e); - } -} - - - -/** -Removes a listener from being notified when an error occurs. - -@param listener The listener. -**/ -public void removeErrorListener (ErrorListener listener) -{ - errorListeners_.removeErrorListener(listener); -} - - - -/** -Removes a listener from being notified when the selection changes. - -@param listener The listener. -**/ -public void removeListSelectionListener (ListSelectionListener listener) -{ - selectionListeners_.removeListSelectionListener(listener); -} - - - -/** -Removes a listener from being notified when the value of any bound -property is changed. - -@param listener The listener. -**/ -public void removePropertyChangeListener (PropertyChangeListener listener) -{ - changeListeners_.removePropertyChangeListener(listener); - super.removePropertyChangeListener(listener); -} - - - -/** -Removes a listener from being notified when the value of any constrained -property is changed. - -@param listener The listener. -**/ -public void removeVetoableChangeListener (VetoableChangeListener listener) -{ - vetoListeners_.removeVetoableChangeListener(listener); - super.removeVetoableChangeListener(listener); -} - - - -/** -Sets the title of a column. This is used for the table column heading. - -@param columnIndex The index of column. Indices start at 0. -@param title The title of the column. -**/ -public void setColumnTitle(int columnIndex, - String title) -{ - // Catch errors if the index being out of range. - try - { - table_.getColumnModel().getColumn(columnIndex).setHeaderValue(title); - } - catch(Exception e) - { - Trace.log(Trace.WARNING, "setColumnTitle() error:" + e); - } - // Swing doesn't repaint without a little prodding. - validate(); -} - - - -/** -Sets the width of a column. - -@param columnIndex The index of column. Indices start at 0. -@param width The column width. -**/ -public void setColumnWidth(int columnIndex, - int width) -{ - // Catch errors if the index being out of range. - try - { - table_.getColumnModel().getColumn(columnIndex).setPreferredWidth(width); //@B1C - } - catch(Exception e) - { - Trace.log(Trace.WARNING, "setColumnWidth() error:" + e); - } -} - - - -/** -Sets the name of the file. -This property is bound and constrained. -Note that the data in the table will not change until a -load() is done. - -@param fileName The file name. - The name is specified as a fully qualified path name in the library file system. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setFileName (String fileName) - throws PropertyVetoException -{ - // Note: the model handles the binding and constraining. - // note: model validates parms - model_.setFileName(fileName); -} - - - -/** -Sets the color used to draw grid lines. - -@param color The color used to draw the grid lines. -**/ -public void setGridColor(Color color) -{ - table_.setGridColor(color); - tableColor_ = color; //@B0A -} - - - -/** -Sets the key. -This property is bound and constrained. -Note that the data in the table will not change until a -load() is done. -The key is only used if the keyed property is true. - -@param key The values which make up the key with which - to find the record. - This value may be null. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setKey (Object[] key) - throws PropertyVetoException -{ - // Note: the model handles the binding and constraining. - model_.setKey(key); -} - - -/** -Sets whether the file will be accessed in key or sequential order. -This property is bound and constrained. -Note that the data in the table will not change -until a load() is done. - -@param keyed true if the file will be accessed in key order; false - if the file will be accessed in sequential order. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setKeyed (boolean keyed) - throws PropertyVetoException -{ - // Note: the model handles the binding and constraining. - model_.setKeyed(keyed); -} - - - -/** -Sets the search type. -This property is bound and constrained. -Note that the data in the table will not change until a -load() is done. -The search type is only used if the keyed property is true -and the key property is not null. - -@param searchType Constant indicating the type of match required. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setSearchType (int searchType) - throws PropertyVetoException -{ - // Note: the model handles the binding and constraining. - model_.setSearchType(searchType); -} - - - -/** -Sets the ListSelectionModel that is used to maintain row selection state. - -@param model The model that provides the row selection state. -**/ -public void setSelectionModel(ListSelectionModel model) -{ - // cleanup old listener - table_.getSelectionModel().removeListSelectionListener(selectionListeners_); - // make change - table_.setSelectionModel(model); - // listen to new model - table_.getSelectionModel().addListSelectionListener(selectionListeners_); -} - - - -/** -Sets whether horizontal lines are drawn between rows. -@param show true if horizontal lines are to be drawn; false otherwise. -**/ -public void setShowHorizontalLines(boolean show) -{ - table_.setShowHorizontalLines(show); - tableShowHorizontalLines_ = show; //@B0A -} - - - -/** -Sets whether vertical lines are drawn between columns. -@param show true if vertical lines are to be drawn; false otherwise. -**/ -public void setShowVerticalLines(boolean show) -{ - table_.setShowVerticalLines(show); - tableShowVerticalLines_ = show; //@B0A -} - - - -/** -Sets the system where the file is located. -This property is bound and constrained. -Note that the data in the table will not change until a -load() is done. - -@param system The system where the file is located. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setSystem (AS400 system) - throws PropertyVetoException -{ - // Note: the model handles the binding and constraining. - // note: model validates parms - model_.setSystem(system); -} - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/RecordListTablePane16.gif b/cvsroot/src/com/ibm/as400/vaccess/RecordListTablePane16.gif deleted file mode 100644 index 1bec5a670..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/RecordListTablePane16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/RecordListTablePane32.gif b/cvsroot/src/com/ibm/as400/vaccess/RecordListTablePane32.gif deleted file mode 100644 index ae597f040..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/RecordListTablePane32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/RecordListTablePaneBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/RecordListTablePaneBeanInfo.java deleted file mode 100644 index fecd1b564..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/RecordListTablePaneBeanInfo.java +++ /dev/null @@ -1,213 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RecordListTablePaneBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - -/** -The RecordListTablePaneBeanInfo class provides bean -information for the RecordListTablePane class. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class RecordListTablePaneBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = RecordListTablePane.class; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - // ***** EVENTS - EventSetDescriptor error = new EventSetDescriptor(beanClass, - "error", - com.ibm.as400.vaccess.ErrorListener.class, - "errorOccurred"); - error.setDisplayName(ResourceLoader.getText("EVT_NAME_ERROR")); - error.setShortDescription(ResourceLoader.getText("EVT_DESC_ERROR")); - - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor select = new EventSetDescriptor(beanClass, - "listSelection", - javax.swing.event.ListSelectionListener.class, - "valueChanged"); - select.setDisplayName(ResourceLoader.getText("EVT_NAME_LIST_SELECTION")); - select.setShortDescription(ResourceLoader.getText("EVT_DESC_LIST_SELECTION")); - - events_ = new EventSetDescriptor[]{error, changed, veto, select}; - - - // ***** PROPERTIES - PropertyDescriptor fileName = new PropertyDescriptor("fileName", beanClass); - fileName.setBound(true); - fileName.setConstrained(true); - fileName.setDisplayName(ResourceLoader.getText("PROP_NAME_FILE_NAME")); - fileName.setShortDescription(ResourceLoader.getText("PROP_DESC_FILE_NAME")); - - PropertyDescriptor system = new PropertyDescriptor("system", beanClass); - system.setBound(true); - system.setConstrained(true); - system.setDisplayName(ResourceLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription(ResourceLoader.getText("PROP_DESC_SYSTEM")); - - PropertyDescriptor keyed = new PropertyDescriptor("keyed", beanClass); - keyed.setBound(true); - keyed.setConstrained(true); - keyed.setDisplayName(ResourceLoader.getText("PROP_NAME_KEYED")); - keyed.setShortDescription(ResourceLoader.getText("PROP_DESC_KEYED")); - - PropertyDescriptor key = new PropertyDescriptor("key", beanClass); - key.setBound(true); - key.setConstrained(true); - key.setDisplayName(ResourceLoader.getText("PROP_NAME_KEY")); - key.setShortDescription(ResourceLoader.getText("PROP_DESC_KEY")); - - PropertyDescriptor searchType = new PropertyDescriptor("searchType", beanClass); - searchType.setBound(true); - searchType.setConstrained(true); - searchType.setDisplayName(ResourceLoader.getText("PROP_NAME_SEARCH_TYPE")); - searchType.setShortDescription(ResourceLoader.getText("PROP_DESC_SEARCH_TYPE")); - - PropertyDescriptor gridColor = new PropertyDescriptor("gridColor", beanClass); - gridColor.setBound(false); - gridColor.setConstrained(false); - gridColor.setExpert(true); - gridColor.setDisplayName(ResourceLoader.getText("PROP_NAME_GRID_COLOR")); - gridColor.setShortDescription(ResourceLoader.getText("PROP_DESC_GRID_COLOR")); - - PropertyDescriptor showHorizontal = new PropertyDescriptor("showHorizontalLines", beanClass); - showHorizontal.setBound(false); - showHorizontal.setConstrained(false); - showHorizontal.setExpert(true); - showHorizontal.setDisplayName(ResourceLoader.getText("PROP_NAME_SHOW_H_LINES")); - showHorizontal.setShortDescription(ResourceLoader.getText("PROP_DESC_SHOW_H_LINES")); - - PropertyDescriptor showVertical = new PropertyDescriptor("showVerticalLines", beanClass); - showVertical.setBound(false); - showVertical.setConstrained(false); - showVertical.setExpert(true); - showVertical.setDisplayName(ResourceLoader.getText("PROP_NAME_SHOW_V_LINES")); - showVertical.setShortDescription(ResourceLoader.getText("PROP_DESC_SHOW_V_LINES")); - - properties_ = new PropertyDescriptor[]{fileName, system, keyed, key, searchType, - gridColor, showHorizontal, showVertical}; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the error event - return 0; - } - - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the "fileName" property - return 0; - } - - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("RecordListTablePane16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("RecordListTablePane32.gif"); - break; - } - - return image; - } - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/RefreshIcon.gif b/cvsroot/src/com/ibm/as400/vaccess/RefreshIcon.gif deleted file mode 100644 index 8a7630d5c..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/RefreshIcon.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResetViewIcon.gif b/cvsroot/src/com/ibm/as400/vaccess/ResetViewIcon.gif deleted file mode 100644 index 522f583fc..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/ResetViewIcon.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceCellRenderer.java b/cvsroot/src/com/ibm/as400/vaccess/ResourceCellRenderer.java deleted file mode 100644 index 30d471276..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ResourceCellRenderer.java +++ /dev/null @@ -1,214 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceCellRenderer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.resource.Presentation; -import com.ibm.as400.resource.Resource; -import com.ibm.as400.resource.ResourceMetaData; -import java.awt.Component; -import java.awt.Image; -import java.io.Serializable; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JTable; -import javax.swing.ListCellRenderer; -import javax.swing.border.Border; -import javax.swing.border.EmptyBorder; -import javax.swing.border.LineBorder; -import javax.swing.table.TableCellRenderer; - - - -/** -The ResourceCellRenderer class renders the name of a resource -using a small icon and text description. -**/ -class ResourceCellRenderer -extends JLabel -implements ListCellRenderer, TableCellRenderer, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private static Border emptyBorder_ = new EmptyBorder(1, 2, 1, 2); - - private ResourceMetaData metaData_ = null; - - - -/** -Constructs a ResourceCellRenderer object. - -@param metaData The resource meta data which describes the column, - or null if none. -**/ - public ResourceCellRenderer(ResourceMetaData metaData) - { - metaData_ = metaData; - - setOpaque(true); - - if (metaData != null) { - if (Number.class.isAssignableFrom(metaData.getType())) - setHorizontalAlignment(RIGHT); - else - setHorizontalAlignment(LEFT); - } - else - setHorizontalAlignment(LEFT); - } - - - - -/** -Renders the value for a list. - -@param list The list. -@param value The value. -@param rowIndex The row index. -@param selected true if the item is selected, false otherwise. -@param hasFocus true if the item has focus, false otherwise. -@return The rendered component. -**/ - public Component getListCellRendererComponent (JList list, - Object value, - int rowIndex, - boolean selected, - boolean hasFocus) - { - setTextAndIcon(value); - - // Handle selection. - if (selected) { - setForeground(list.getSelectionForeground()); - setBackground(list.getSelectionBackground()); - } - else { - setForeground(list.getForeground()); - setBackground(list.getBackground()); - } - - // Handle focus. - if (hasFocus) - setBorder(new LineBorder(list.getForeground())); - else - setBorder(emptyBorder_); - - return this; - } - - - -/** -Renders the value for a table. - -@param table The table. -@param value The value. -@param selected true if the item is selected, false otherwise. -@param hasFocus true if the item has focus, false otherwise. -@param rowIndex The row index. -@param columnIndex The column index. -@return The rendered component. -**/ - public Component getTableCellRendererComponent(JTable table, - Object value, - boolean selected, - boolean hasFocus, - int rowIndex, - int columnIndex) - { - setTextAndIcon(value); - - // Handle selection. - if (selected) { - setForeground(table.getSelectionForeground()); - setBackground(table.getSelectionBackground()); - } - else { - setForeground(table.getForeground()); - setBackground(table.getBackground()); - } - - // Handle focus. - if (hasFocus) - setBorder(new LineBorder(table.getForeground())); - else - setBorder(emptyBorder_); - - return this; - } - - - -/** -Sets the text and icon. - -@param value The value. -**/ - private void setTextAndIcon(Object value) - { - if (value != null) { - - // If the value is a Resource object and it has a presentation, - // then use its presentation name and 16x16 icon. - if (value instanceof Resource) { - Resource resource = (Resource)value; - Presentation presentation = resource.getPresentation(); - if (presentation != null) { - setTextAndIcon(presentation); - return; - } - } - - // If there is a resource meta data object associated with - // this renderer and a presentation is available for the value, - // then use it to choose the appropriate MRI string. - if (metaData_ != null) { - Presentation presentation = metaData_.getPossibleValuePresentation(value); - if (presentation != null) { - setTextAndIcon(presentation); - return; - } - } - - // Otherwise, just toString() it and don't use an icon. - setText(value.toString()); - setIcon(null); - } - } - - - -/** -Sets the text and icon. - -@param presentation The presentation. -**/ - private void setTextAndIcon(Presentation presentation) - { - setText(presentation.getName()); - Image icon = (Image)presentation.getValue(Presentation.ICON_COLOR_16x16); - if (icon != null) - setIcon(new ImageIcon(icon)); - else - setIcon(null); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceHeaderRenderer.java b/cvsroot/src/com/ibm/as400/vaccess/ResourceHeaderRenderer.java deleted file mode 100644 index 726a27a77..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ResourceHeaderRenderer.java +++ /dev/null @@ -1,104 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceHeaderRenderer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.resource.ResourceMetaData; -import java.awt.Component; -import java.io.Serializable; -import javax.swing.JLabel; -import javax.swing.JTable; -import javax.swing.UIManager; -import javax.swing.border.BevelBorder; -import javax.swing.border.Border; -import javax.swing.border.CompoundBorder; -import javax.swing.border.EmptyBorder; -import javax.swing.table.JTableHeader; -import javax.swing.table.TableCellRenderer; - - - -/** -The ResourceHeaderRenderer class renders the header for -Resource visual components. -**/ -class ResourceHeaderRenderer -extends JLabel -implements TableCellRenderer, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private static final Border border_ = new CompoundBorder(new BevelBorder(BevelBorder.RAISED), new EmptyBorder (0,5,0,5)); - - private ResourceMetaData metaData_ = null; - - - -/** -Constructs a ResourceHeaderRenderer object. - -@param metaData The resource meta data which describes the column, - or null if none. -**/ - public ResourceHeaderRenderer(ResourceMetaData metaData) - { - metaData_ = metaData; - - setOpaque(true); - setBorder(border_); - - if (metaData != null) { - if (Number.class.isAssignableFrom(metaData.getType())) - setHorizontalAlignment(RIGHT); - else - setHorizontalAlignment(LEFT); - } - else - setHorizontalAlignment(LEFT); - } - - - - -/** -Renders the value for a table. - -@param table The table. -@param value The value. -@param selected true if the item is selected, false otherwise. -@param hasFocus true if the item has focus, false otherwise. -@param rowIndex The row index. -@param columnIndex The column index. -@return The rendered component. -**/ - public Component getTableCellRendererComponent(JTable table, - Object value, - boolean selected, - boolean hasFocus, - int rowIndex, - int columnIndex) - { - setText(value.toString()); - setFont(table.getFont()); - JTableHeader header = table.getTableHeader(); - setForeground(header.getForeground()); - setBackground(header.getBackground()); - return this; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsModel.java b/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsModel.java deleted file mode 100644 index 1e1b66013..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsModel.java +++ /dev/null @@ -1,756 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListDetailsModel.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.resource.Presentation; -import com.ibm.as400.resource.Resource; -import com.ibm.as400.resource.ResourceList; -import com.ibm.as400.resource.ResourceListEvent; -import com.ibm.as400.resource.ResourceListListener; -import com.ibm.as400.resource.ResourceMetaData; -import java.beans.PropertyChangeListener; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.TableModel; - - - -/** -The ResourceListDetailsModel class implements an underlying -model for a table, where all information for the model is gathered -from the contents of a {@link com.ibm.as400.resource.ResourceList ResourceList} -object. Every row in the table represents a -{@link com.ibm.as400.resource.Resource Resource} from the -list. You must explicitly call load() -to load the information from the resource list. - -

    The table columns are specified as an array of column attribute IDs. -The table will contain a column for each element of the array. -The following can be specified as column attribute IDs: -

      -
    • null - The entire resource is returned as the table -data for the column. -
    • Resource attribute IDs - These are defined by the -{@link com.ibm.as400.resource.Resource Resource} -objects that make up the rows of the table. The corresponding -attribute value is returned as the table data for the column. -
    - -

    Use this class if you want to customize the graphical -user interface that presents a table. If you do not need -to customize the graphical user interface, then use -{@link com.ibm.as400.vaccess.ResourceListDetailsPane ResourceListDetailsPane} -instead. - -

    Most errors are reported as -{@link com.ibm.as400.vaccess.ErrorEvent ErrorEvents} -rather than throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    ResourceListDetailsModel objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • TableModelEvent -
    • WorkingEvent -
    - -

    The following example creates a details model filled with -details about the jobs running on a system. It then presents -the table in a JTable object. - -

    -// Create the resource list.  This example creates
    -// a list of all jobs on the system.
    -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -RJobList jobList = new RJobList(system);
    -
    -// Create the ResourceListDetailsModel. In this example, -// there are four columns in the table. The first column -// contains the icons and names for each job. The remaining -// columns contain the status, type, and subtype, respectively, -// for each job. -Object[] columnAttributeIDs = new Object[] { null, RJob.JOB_STATUS, RJob.JOB_TYPE, RJob.JOB_SUBTYPE }; -ResourceListDetailsModel detailsModel = new ResourceListDetailsModel(jobList, columnAttributeIDs); -
    -// Create a JTable using the ResourceListDetailsModel. -JTable table = new JTable(detailsModel); -
    -// Add the JTable to a JFrame and show it. -JFrame frame = new JFrame("My Window"); -frame.getContentPane().add(new JScrollPane(table)); -frame.pack(); -frame.show(); -
    -// The JTable will appear empty until we tell the -// ResourceListDetailsModel to load. This gives us -// control of when the list of jobs is retrieved -// from the system. -detailsModel.load(); -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class ResourceListDetailsModel -implements TableModel, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String RESOURCE_COLUMN_NAME_ = ResourceLoader.getText("RESOURCE_COLUMN_NAME"); - - - - // Constants. - private static final int COLUMN_SOURCE_NOT_KNOWN_ = 0; - private static final int COLUMN_SOURCE_RESOURCE_ = 1; - private static final int COLUMN_SOURCE_RESOURCE_ATTRIBUTE_ = 2; - private static final int COLUMN_SOURCE_NOT_VALID_ = 99; - - - - // Private data. - private boolean exceptionOccured_ = false; - private transient boolean loaded_ = false; - private ResourceList resourceList_ = null; - private Object[] columnAttributeIDs_ = null; - private int[] columnSources_ = null; - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private ResourceListListener resourceListListener_; - transient TableModelEventSupport tableModelEventSupport_; // Private. - transient WorkingEventSupport workingEventSupport_; // Private. - - - -/** -Constructs a ResourceListDetailsModel object. -**/ - public ResourceListDetailsModel() - { - initializeTransient(); - } - - - -/** -Constructs a ResourceListDetailsModel object. - -@param resourceList The resource list from which all information for the model is gathered. -@param columnAttributeIDs The column attribute IDs. -**/ - public ResourceListDetailsModel(ResourceList resourceList, Object[] columnAttributeIDs) - { - if (resourceList == null) - throw new NullPointerException ("resourceList"); - if (columnAttributeIDs == null) - throw new NullPointerException ("columnAttributeIDs"); - - initializeTransient (); - setResourceList(resourceList); - setColumnAttributeIDs(columnAttributeIDs); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a listener to be notified when the contents of the -table change. - -@param listener The listener. -**/ - public void addTableModelListener (TableModelListener listener) - { - tableModelEventSupport_.addTableModelListener (listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Returns the column attribute IDs. - -@return The column attribute IDs. -**/ - public Object[] getColumnAttributeIDs() - { - return columnAttributeIDs_; - } - - - -/** -Returns the class for objects that are contained in a column. - -@param columnIndex The column index (0-based). -@return The column class. -**/ - public Class getColumnClass (int columnIndex) - { - switch(getColumnSource(columnIndex)) { - - case COLUMN_SOURCE_RESOURCE_: - return Resource.class; - - case COLUMN_SOURCE_RESOURCE_ATTRIBUTE_: - return resourceList_.getAttributeMetaData(columnAttributeIDs_[columnIndex]).getType(); - - default: - return null; - } - } - - - -/** -Returns the number of columns. - -@return The number of columns. -**/ - public int getColumnCount () - { - if ((resourceList_ == null) || (columnAttributeIDs_ == null)) - return 0; - - return columnAttributeIDs_.length; - } - - - -/** -Returns the name of a column. - -@param columnIndex The column index (0-based). -@return The column name. -**/ - public String getColumnName(int columnIndex) - { - if ((resourceList_ == null) || (columnAttributeIDs_ == null)) - return null; - - switch(getColumnSource(columnIndex)) { - - case COLUMN_SOURCE_RESOURCE_: - return RESOURCE_COLUMN_NAME_; - - case COLUMN_SOURCE_RESOURCE_ATTRIBUTE_: - return resourceList_.getAttributeMetaData(columnAttributeIDs_[columnIndex]).getPresentation().getName(); - - default: - if ((columnIndex < 0) || (columnIndex >= columnAttributeIDs_.length)) - return null; - else - return columnAttributeIDs_[columnIndex].toString(); - } - } - - - -/** -Returns the column source. - -@param columnIndex The column index (0-based). -@return The column source. -**/ - private int getColumnSource(int columnIndex) - { - if (columnAttributeIDs_ == null) - return COLUMN_SOURCE_NOT_VALID_; - if ((columnIndex < 0) || (columnIndex >= columnAttributeIDs_.length)) - return COLUMN_SOURCE_NOT_VALID_; - - // The first time a column is retrieved, we determine its - // source so that future lookups can be faster. - if (columnSources_[columnIndex] == COLUMN_SOURCE_NOT_KNOWN_) { - if (columnAttributeIDs_[columnIndex] == null) - columnSources_[columnIndex] = COLUMN_SOURCE_RESOURCE_; - else { - try { - ResourceMetaData attributeMetaData = resourceList_.getAttributeMetaData(columnAttributeIDs_[columnIndex]); - columnSources_[columnIndex] = COLUMN_SOURCE_RESOURCE_ATTRIBUTE_; - } - catch(IllegalArgumentException e) { - columnSources_[columnIndex] = COLUMN_SOURCE_NOT_VALID_; - } - } - } - return columnSources_[columnIndex]; - } - - - -/** -Returns the preferred column width, in characters. - -@param columnIndex The column index (0-based). -@return The preferred column width, in characters. -**/ - public int getColumnWidth(int columnIndex) - { - if ((resourceList_ == null) || (columnAttributeIDs_ == null)) - return 20; - - switch(getColumnSource(columnIndex)) { - - case COLUMN_SOURCE_RESOURCE_: - default: - return 20; - - case COLUMN_SOURCE_RESOURCE_ATTRIBUTE_: - int dataWidth = 20; - ResourceMetaData attributeMetaData = resourceList_.getAttributeMetaData(columnAttributeIDs_[columnIndex]); - Class type = attributeMetaData.getType(); - Presentation[] possibleValuePresentations = attributeMetaData.getPossibleValuePresentations(); - - // If it is a numeric value, use 10. - if (Number.class.isAssignableFrom(type)) - dataWidth = 10; - - // If it has possible values, use the width of the longest. - else if (possibleValuePresentations.length > 0) { - dataWidth = 1; - for(int i = 0; i < possibleValuePresentations.length; ++i) { - int nameLength = possibleValuePresentations[i].getName().toString().length(); - if (nameLength > dataWidth) - dataWidth = nameLength; - } - } - - // Make sure its big enough to show the header. - int nameLength = attributeMetaData.getPresentation().getName().toString().length(); - if (nameLength > dataWidth) - dataWidth = nameLength; - - return dataWidth; - - } - } - - - -/** -Returns the resource at the specified row. - -@param rowIndex The row index (0-based). -@return The object at the specified row. -**/ - public Resource getResourceAt(int rowIndex) - { - if ((resourceList_ == null) - || (columnAttributeIDs_ == null) - || (loaded_ == false) - || (exceptionOccured_)) - return null; - - try { - // Validate the index. - if ((rowIndex < 0) || ((resourceList_.isComplete()) && (rowIndex > resourceList_.getListLength()))) - return null; - - return resourceList_.resourceAt(rowIndex); - } - catch(Exception e) { - errorEventSupport_.fireError(e); - exceptionOccured_ = true; - return null; - } - } - - - -/** -Returns the resource list from which all information for the model is gathered. - -@return The resource list from which all information for the model is gathered. -**/ - public ResourceList getResourceList() - { - return resourceList_; - } - - - -/** -Returns the number of rows in the table. - -@return The number of rows in the table, or 0 if the root - has not been set. -**/ - public int getRowCount () - { - if ((resourceList_ == null) - || (columnAttributeIDs_ == null) - || (loaded_ == false) - || (exceptionOccured_)) - return 0; - - try { - // If the resource list is not complete, then refresh - // its status. This will force the reported length - // to be periodically updated. - if (! resourceList_.isComplete()) - resourceList_.refreshStatus(); - - long listLength = resourceList_.getListLength(); - return (int)listLength; - } - catch(Exception e) { - errorEventSupport_.fireError(e); - exceptionOccured_ = true; - return 0; - } - } - - - -/** -Returns the value at the specified row and column. - -@param rowIndex The row index (0-based). -@param columnIndex The column index (0-based). -@return The value at the specified - row and column. It will be null if the - column index is not valid or the root has - not been set. -**/ - public Object getValueAt (int rowIndex, int columnIndex) - { - if ((resourceList_ == null) - || (columnAttributeIDs_ == null) - || (loaded_ == false) - || (exceptionOccured_)) - return null; - - Resource resource = getResourceAt(rowIndex); - if (resource == null) - return null; - - switch(getColumnSource(columnIndex)) { - - case COLUMN_SOURCE_RESOURCE_: - return resource; - - case COLUMN_SOURCE_RESOURCE_ATTRIBUTE_: - resource.addActiveStatusListener(workingEventSupport_); - try { - return resource.getAttributeValue(columnAttributeIDs_[columnIndex]); - } - catch(Exception e) { - errorEventSupport_.fireError(e); - exceptionOccured_ = true; - return null; - } - finally { - resource.removeActiveStatusListener(workingEventSupport_); - } - - default: - return null; - } - } - - - -/** -Indicates if the cell is editable. -This always returns false. No cells are editable. - -@param rowIndex The row index (0-based). -@param columnIndex The column index (0-based). -@return Always false. -**/ - public boolean isCellEditable (int rowIndex, int columnIndex) - { - return false; - } - - - -/** -Initializes transient data. -**/ - private void initializeTransient () - { - errorEventSupport_ = new ErrorEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - resourceListListener_ = new ResourceListListener_(); - tableModelEventSupport_ = new TableModelEventSupport (this, this); - workingEventSupport_ = new WorkingEventSupport (this); - - if (resourceList_ != null) { - resourceList_.addActiveStatusListener(workingEventSupport_); - resourceList_.addResourceListListener(resourceListListener_); - } - } - - - -/** -Loads the information from the resource list. -**/ - public void load() - { - if ((loaded_) && (resourceList_ != null) && (!exceptionOccured_)) { - try { - resourceList_.refreshContents(); - } - catch(Exception e) { - errorEventSupport_.fireError(e); - exceptionOccured_ = true; - } - } - else - loaded_ = true; - - tableModelEventSupport_.fireTableChanged(-1); - } - - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a table model listener. - -@param listener The listener. -**/ - public void removeTableModelListener (TableModelListener listener) - { - tableModelEventSupport_.removeTableModelListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Sets the column attribute IDs. - -@param columnAttributeIDs The column attribute IDs. -**/ - public void setColumnAttributeIDs(Object[] columnAttributeIDs) - { - if (columnAttributeIDs == null) - throw new NullPointerException ("columnAttributeIDs"); - - Object[] oldValue = columnAttributeIDs_; - - if (oldValue != columnAttributeIDs) { - - columnAttributeIDs_ = columnAttributeIDs; - - columnSources_ = new int[columnAttributeIDs_.length]; - - // Change the contents of the list. - tableModelEventSupport_.fireTableChanged (-1); - } - - propertyChangeSupport_.firePropertyChange ("columnAttributeIDs", oldValue, columnAttributeIDs_); - } - - -/** -Sets the resource list from which all information for the model is gathered. - -@param resourceList The resource list from which all information for the model is gathered. -**/ - public void setResourceList(ResourceList resourceList) - { - if (resourceList == null) - throw new NullPointerException ("resourceList"); - - ResourceList oldValue = resourceList_; - - if (oldValue != resourceList) { - - // Redirect event support. - if (oldValue != null) { - oldValue.removeActiveStatusListener(workingEventSupport_); - oldValue.removeResourceListListener(resourceListListener_); - } - resourceList.addActiveStatusListener(workingEventSupport_); - resourceList.addResourceListListener(resourceListListener_); - - // Set the resource list. - resourceList_ = resourceList; - exceptionOccured_ = false; - if (columnAttributeIDs_ != null) - columnSources_ = new int[columnAttributeIDs_.length]; - - // Change the contents of the list. - tableModelEventSupport_.fireTableChanged (-1); - } - - propertyChangeSupport_.firePropertyChange ("resourceList", oldValue, resourceList_); - } - - - -/** -Sets the value at the specified row and column. -This has no effect, the cells are not editable. - -@param value The value. -@param rowIndex The row index (0-based). -@param columnIndex The column index (0-based). -**/ - public void setValueAt (Object value, - int rowIndex, - int columnIndex) - { - // Nothing. - } - - - -/** -The ResourceListListener_ class processes ResourceListEvents and -fires the appropriate ListDataEvents and WorkingEvents. -**/ - private class ResourceListListener_ implements ResourceListListener - { - - private long length_ = 0; - - public void lengthChanged(ResourceListEvent event) - { - long newLength = event.getLength(); - tableModelEventSupport_.fireTableChanged((int)length_, (int)newLength, TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT); - length_ = newLength; - } - - public void listClosed(ResourceListEvent event) - { - // Do nothing. - } - - public void listCompleted(ResourceListEvent event) - { - // Do nothing. - } - - public void listInError(ResourceListEvent event) - { - // Do nothing. - } - - public void listOpened(ResourceListEvent event) - { - // Do nothing. - } - - public void resourceAdded(ResourceListEvent event) - { - // Do nothing. - } - - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsModel16.gif b/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsModel16.gif deleted file mode 100644 index ebf8f0872..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsModel16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsModel32.gif b/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsModel32.gif deleted file mode 100644 index b1d5b95c5..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsModel32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsModelBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsModelBeanInfo.java deleted file mode 100644 index 8defc5f8f..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsModelBeanInfo.java +++ /dev/null @@ -1,189 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListDetailsModelBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import javax.swing.event.TableModelListener; - - - -/** -The ResourceListDetailsModelBeanInfo class provides bean information -for the ResourceListDetailsModel class. - -@see ResourceListDetailsModel -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class ResourceListDetailsModelBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = ResourceListDetailsModel.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor tableModel = new EventSetDescriptor (beanClass_, - "tableModel", TableModelListener.class, "tableChanged"); - tableModel.setDisplayName (ResourceLoader.getText ("EVT_NAME_TABLE_MODEL")); - tableModel.setShortDescription (ResourceLoader.getText ("EVT_DESC_TABLE_MODEL")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { error, tableModel, propertyChange, working }; - - // Properties. - PropertyDescriptor resourceList = new PropertyDescriptor ("resourceList", beanClass_); - resourceList.setBound (true); - resourceList.setConstrained (false); - resourceList.setDisplayName (ResourceLoader.getText ("PROP_NAME_RESOURCE_LIST")); - resourceList.setShortDescription (ResourceLoader.getText ("PROP_DESC_RESOURCE_LIST")); - - PropertyDescriptor columnAttributeIDs = new PropertyDescriptor ("columnAttributeIDs", beanClass_); - columnAttributeIDs.setBound (true); - columnAttributeIDs.setConstrained (false); - columnAttributeIDs.setDisplayName (ResourceLoader.getText ("PROP_NAME_COLUMN_ATTRIBUTE_IDS")); - columnAttributeIDs.setShortDescription (ResourceLoader.getText ("PROP_DESC_COLUMN_ATTRIBUTE_IDS")); - - properties_ = new PropertyDescriptor[] { resourceList, columnAttributeIDs }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // resource list. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("ResourceListDetailsModel16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("ResourceListDetailsModel32.gif"); - break; - default: - throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - return image; - } - - - -/** - Returns the descriptors for all properties. - @return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsPane.java b/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsPane.java deleted file mode 100644 index 989a82d63..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsPane.java +++ /dev/null @@ -1,707 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListDetailsPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.resource.Resource; -import com.ibm.as400.resource.ResourceList; -import com.ibm.as400.resource.ResourceMetaData; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Font; -import java.awt.Point; -import java.beans.PropertyChangeListener; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.Enumeration; -import java.util.Vector; -import javax.swing.JComponent; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.ListSelectionModel; -import javax.swing.event.ListSelectionListener; -import javax.swing.table.TableColumn; -import javax.swing.table.TableColumnModel; -import javax.swing.table.TableModel; - - - -/** -The ResourceListDetailsPane class represents a graphical user interface -that presents the contents of a -{@link com.ibm.as400.resource.ResourceList ResourceList } -in a table. Every row in the table represents a -{@link com.ibm.as400.resource.Resource Resource } from the -list. You must explicitly call load() -to load the information from the resource list. - -

    The table columns are specified as an array of column attribute IDs. -The table will contain a column for each element of the array. -The following can be specified as column attribute IDs: -

      -
    • null - The name and icon from each Resource's -{@link com.ibm.as400.resource.Presentation Presentation } -object are presented in the column. -
    • Resource attribute IDs - These are defined by the -Resource objects that make up the rows of the table. -The corresponding attribute value is presented in the column. -
    - -

    Pop-up menus are enabled by default. -The pop-up menus will contain a single -"Properties" menu item which, when selected, -presents one of the following Properties dialogs: -

      -
    • If a list item is clicked, the dialog presents - the corresponding Resource object's attribute - values. The layout of this Properties dialog - is defined by the resource properties specified - for this ResourceListDetailsPane object. - By default, it will contain a "General" tab - which shows the Resource object's icon and - full name. -
    • If something other than a list item is clicked, - the dialog presents the ResourceList object's - selection and sort values. -
    - -

    Most errors are reported as -ErrorEvents -rather than throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    ResourceListDetailsPane objects generate the following events: -

      -
    • ErrorEvent -
    • ListSelectionEvent -
    • PropertyChangeEvent -
    - -

    The following example creates a details pane which presents -a list of users. - -

    -// Create the resource list.  This example creates
    -// a list of all users on the system.
    -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -RUserList userList = new RUserList(system);
    -
    -// Create the ResourceListDetailsPane. In this example, -// there are two columns in the table. The first column -// contains the icons and names for each user. The -// second column contains the text description for each -// user. -Object[] columnAttributeIDs = new Object[] { null, RUser.TEXT_DESCRIPTION }; -ResourceListDetailsPane detailsPane = new ResourceListDetailsPane(); -detailsPane.setResourceList(userList); -detailsPane.setColumnAttributeIDs(columnAttributeIDs); -
    -// Add the ResourceListDetailsPane to a JFrame and show it. -JFrame frame = new JFrame("My Window"); -frame.getContentPane().add(detailsPane); -frame.pack(); -frame.show(); -
    -// The ResourceListDetailsPane will appear empty until -// we load it. This gives us control of when the list -// of users is retrieved from the system. -detailsPane.load(); -
    - -@see ResourceListDetailsModel -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class ResourceListDetailsPane -extends JComponent -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String ACTION_PROPERTIES_ = ResourceLoader.getText("ACTION_PROPERTIES"); - private static final String ACTION_LIST_PROPERTIES_ = ResourceLoader.getText("ACTION_LIST_PROPERTIES"); - - - - // Private data. - private boolean allowActions_ = true; - private ResourceListDetailsModel model_ = null; - private ResourceProperties resourceProperties_ = null; - private transient JScrollPane scrollPane_ = null; - private transient JTable table_ = null; - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_ ; - transient private ListSelectionEventSupport listSelectionEventSupport_; - transient private ResourceListPopupMenuAdapter popupMenuAdapter_; - transient private PropertyChangeSupport propertyChangeSupport_; - - - -/** -Constructs a ResourceListDetailsPane object. -**/ - public ResourceListDetailsPane() - { - initializeCommon(); - - // Set the default resource properties. - resourceProperties_ = new ResourceProperties(); - } - - - -/** -Constructs a ResourceListDetailsPane object. - -@param resourceList The resource list from which all information for the model is gathered. -@param columnAttributeIDs The column attribute IDs. -@param resourceProperties The resource properties. -**/ - public ResourceListDetailsPane(ResourceList resourceList, - Object[] columnAttributeIDs, - ResourceProperties resourceProperties) - { - if (resourceList == null) - throw new NullPointerException ("resourceList"); - if (columnAttributeIDs == null) - throw new NullPointerException ("columnAttributeIDs"); - if (resourceProperties == null) - throw new NullPointerException ("resourceProperties"); - - initializeCommon(); - resourceProperties_ = resourceProperties; - model_.setResourceList(resourceList); - model_.setColumnAttributeIDs(columnAttributeIDs); - refreshColumns(); - popupMenuAdapter_.setResourceList(resourceList); - popupMenuAdapter_.setResourceProperties(resourceProperties); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when a list selection occurs. - -@param listener The listener. -**/ - public void addListSelectionListener (ListSelectionListener listener) - { - listSelectionEventSupport_.addListSelectionListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - super.addPropertyChangeListener (listener); - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Indicates if pop-up menus are enabled. - -@return true if pop-up menus are enabled, false otherwise. -**/ - public boolean getAllowActions () - { - return allowActions_; - } - - - - -/** -Returns the column attribute IDs. - -@return The column attribute IDs. -**/ - public Object[] getColumnAttributeIDs() - { - return model_.getColumnAttributeIDs(); - } - - - -/** -Returns the column model that is used to maintain the columns. -This provides the ability to programmatically add, remove, -reorder, and resize columns in the table. - -@return The column model. -**/ - public TableColumnModel getColumnModel () - { - return table_.getColumnModel (); - } - - - -/** -Returns the model that contains data for the table. - -@return The model that contains data for the table. -**/ - public TableModel getModel () - { - return model_; - } - - - -/** -Returns the resource that corresponds to the row located at the specified -point. This can be useful for present customized pop-up menus. - -@param point The point. -@return The resource that corresponds to the row located at - the point, or null if no such resource exists. -**/ - public Resource getResourceAtPoint(Point point) - { - Resource resource = null; - int row = table_.rowAtPoint(point); - if (row != -1) - resource = model_.getResourceAt(row); - return resource; - } - - - -/** -Returns the resource list from which all information for the model is gathered. - -@return The resource list from which all information for the model is gathered. -**/ - public ResourceList getResourceList() - { - return model_.getResourceList(); - } - - - -/** -Returns the resource properties. The resource properties object -describes the arrangement of the Properties dialog that is presented -when the user right clicks on a list item and selects "Properties". -**/ - public ResourceProperties getResourceProperties() - { - return resourceProperties_; - } - - - -/** -Returns the first selected resource. - -@return The first selected resource, or null if none are selected. - -@see #getSelectionModel -@see #setSelectionModel -**/ - public Resource getSelectedResource() - { - Resource selectedResource = null; - int[] selectedRows = table_.getSelectedRows(); - if (selectedRows.length > 0) - selectedResource = model_.getResourceAt(selectedRows[0]); - return selectedResource; - } - - - -/** -Returns the resources which are represented by the selected rows. - -@return The resources which are represented by the selected rows. - The array is empty if no resources are selected. - -@see #getSelectionModel -@see #setSelectionModel -**/ - public Resource[] getSelectedResources() - { - int[] selectedRows = table_.getSelectedRows(); - Resource[] selectedResource = new Resource[selectedRows.length]; - for (int i = 0; i < selectedRows.length; ++i) - selectedResource[i] = model_.getResourceAt(selectedRows[i]); - return selectedResource; - } - - - -/** -Returns the selection model that is used to maintain row -selection state. This provides the ability to programmatically -select and deselect resources. - -@return The selection model. -**/ - public ListSelectionModel getSelectionModel () - { - return table_.getSelectionModel (); - } - - - -/** -Initializes the common data. -**/ - private void initializeCommon() - { - // Initialize the model. - model_ = new ResourceListDetailsModel(); - - initializeTransient(); - setAllowActions(true); - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Workaround for Swing JTable serialization bug. - addFocusListener(new SerializationListener(this)); - - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - listSelectionEventSupport_ = new ListSelectionEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - - // Initialize the table. - table_ = new JTable(model_); - table_.setAutoCreateColumnsFromModel(false); - table_.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - table_.setColumnSelectionAllowed(false); - table_.setRowSelectionAllowed(true); - table_.setShowGrid(false); - - model_.addErrorListener(errorEventSupport_); - model_.addPropertyChangeListener(propertyChangeSupport_); - table_.getSelectionModel().addListSelectionListener(listSelectionEventSupport_); - - // Layout the pane. - setLayout(new BorderLayout()); - scrollPane_ = new JScrollPane(table_); - add("Center", scrollPane_); - - // Scrolling performance improvement. - table_.setDoubleBuffered(true); - scrollPane_.getViewport().setBackingStoreEnabled(true); - scrollPane_.setDoubleBuffered(true); - scrollPane_.getViewport().setDoubleBuffered(true); - - // This option taken from Swing performance hints in JViewport javadoc - // and at http://java.sun.com/products/jfc/tsc/articles/performance/ - scrollPane_.getViewport().putClientProperty("EnableWindowBlit", Boolean.TRUE); - - // Initialize the other adapters. - popupMenuAdapter_ = new ResourceListPopupMenuAdapter(this, model_.getResourceList(), resourceProperties_, errorEventSupport_); - model_.addWorkingListener(new WorkingCursorAdapter(table_)); - setAllowActions(allowActions_); - } - - - -/** -Indicates if the resource is selected. - -@param resource The resource. -@return true if the resource is selected; false otherwise. - -@see #getSelectionModel -@see #setSelectionModel -**/ - public boolean isSelected(Resource resource) - { - if (resource == null) - throw new NullPointerException ("resource"); - - int[] selectedRows = table_.getSelectedRows (); - for (int i = 0; i < selectedRows.length; ++i) { - Resource selectedResource = model_.getResourceAt(selectedRows[i]); - if (selectedResource != null) - if (selectedResource.equals(resource)) - return true; - } - return false; - } - - - -/** -Loads the information from the resource list. -**/ - public void load() - { - table_.clearSelection(); - model_.load(); - } - - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient(); - } - - - -/** -Refreshes the columns. -**/ - private void refreshColumns() - { - // Remove the existing columns. Note that we - // must make our own list because the enumeration - // gets wrecked when we remove an element. - TableColumnModel tableColumnModel = table_.getColumnModel(); - Vector oldColumns = new Vector(); - for (Enumeration e = tableColumnModel.getColumns(); e.hasMoreElements(); ) - oldColumns.addElement(e.nextElement()); - - for (Enumeration e = oldColumns.elements(); e.hasMoreElements(); ) { - TableColumn column = (TableColumn)e.nextElement(); - tableColumnModel.removeColumn(column); - } - - // Add the new columns. - Object[] columnAttributeIDs = getColumnAttributeIDs(); - if (columnAttributeIDs != null) { - for(int i = 0; i < columnAttributeIDs.length; ++i) { - ResourceMetaData metaData = null; - if (columnAttributeIDs[i] != null) { - try { - metaData = getResourceList().getAttributeMetaData(columnAttributeIDs[i]); - } - catch(Exception e) { - if (Trace.isTraceErrorOn()) - Trace.log(Trace.ERROR, "Column attribute ID not valid:" + columnAttributeIDs[i], e); - // Ignore. This just means an invalid column attribute ID was passed. - } - } - - VTableColumn tableColumn = new VTableColumn(i, columnAttributeIDs[i]); - tableColumn.setCellRenderer(new ResourceCellRenderer(metaData)); - tableColumn.setHeaderValue(model_.getColumnName(i)); - tableColumn.setHeaderRenderer(new ResourceHeaderRenderer(metaData)); - tableColumn.setPreferredCharWidth(15); - tableColumnModel.addColumn(tableColumn); - } - } - - // Size the columns. Get the font size. Use M as a good sample character. - int fontSize = 0; - Font font = table_.getFont(); - if (font != null) - fontSize = table_.getFontMetrics(font).charWidth('M'); - - if (fontSize > 0) { - TableColumnModel columnModel = table_.getColumnModel(); - int columnCount = columnModel.getColumnCount(); - for (int i = 0; i < columnCount; ++i) { - TableColumn column = columnModel.getColumn(i); - column.setPreferredWidth(model_.getColumnWidth(i) * fontSize + 10); //@B0C - } - } - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a list selection listener. - -@param listener The listener. -**/ - public void removeListSelectionListener (ListSelectionListener listener) - { - listSelectionEventSupport_.removeListSelectionListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - super.removePropertyChangeListener (listener); - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Sets whether pop-up menus are enabled. - -@param allowActions true to enable pop-up menus, false otherwise. - The default is true. -**/ - public void setAllowActions(boolean allowActions) - { - Boolean oldValue = new Boolean(allowActions_); - - allowActions_ = allowActions; - if (allowActions_) { - scrollPane_.getViewport().addMouseListener(popupMenuAdapter_); - table_.addMouseListener(popupMenuAdapter_); - } - else { - scrollPane_.getViewport().removeMouseListener(popupMenuAdapter_); - table_.removeMouseListener(popupMenuAdapter_); - } - - propertyChangeSupport_.firePropertyChange("allowActions", oldValue, new Boolean(allowActions)); - } - - - -/** -Sets the column attribute IDs. - -@param columnAttributeIDs The column attribute IDs. -**/ - public void setColumnAttributeIDs(Object[] columnAttributeIDs) - { - if (columnAttributeIDs == null) - throw new NullPointerException ("columnAttributeIDs"); - - table_.clearSelection(); - model_.setColumnAttributeIDs(columnAttributeIDs); - refreshColumns(); - } - - - -/** -Sets the resource list from which all information for the model is gathered. - -@param resourceList The resource list from which all information for the model is gathered. -**/ - public void setResourceList(ResourceList resourceList) - { - if (resourceList == null) - throw new NullPointerException ("resourceList"); - - // Refresh the table and model. - table_.clearSelection(); - model_.setResourceList(resourceList); - refreshColumns(); - popupMenuAdapter_.setResourceList(resourceList); - } - - - -/** -Sets the resource properties. The resource properties object -describes the arrangement of the Properties dialog that is presented when -the user right clicks on a list item and selects "Properties". - -@param resourceProperties The resource properties. -**/ - public void setResourceProperties(ResourceProperties resourceProperties) - { - if (resourceProperties == null) - throw new NullPointerException("resourceProperties"); - - ResourceProperties oldValue = resourceProperties_; - - resourceProperties_ = resourceProperties; - popupMenuAdapter_.setResourceProperties(resourceProperties); - - propertyChangeSupport_.firePropertyChange("resourceProperties", oldValue, resourceProperties); - } - - - -/** -Sets the selection model that is used to maintain selection -state. This provides the ability to programmatically select -and deselect resources. - -@param selectionModel The selection model. -**/ - public void setSelectionModel (ListSelectionModel selectionModel) - { - if (selectionModel == null) - throw new NullPointerException("selectionModel"); - - // Do not dispatch events from the old selection model any more. - ListSelectionModel oldSelectionModel = table_.getSelectionModel (); - if (oldSelectionModel != null) - oldSelectionModel.removeListSelectionListener (listSelectionEventSupport_); - - table_.setSelectionModel (selectionModel); - - // Dispatch events from the new selection model. - if (selectionModel != null) - selectionModel.addListSelectionListener (listSelectionEventSupport_); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsPane16.gif b/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsPane16.gif deleted file mode 100644 index 483b99c5a..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsPane16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsPane32.gif b/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsPane32.gif deleted file mode 100644 index 07ed13257..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsPane32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsPaneBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsPaneBeanInfo.java deleted file mode 100644 index bfcdec050..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ResourceListDetailsPaneBeanInfo.java +++ /dev/null @@ -1,195 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListDetailsPaneBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import javax.swing.event.ListSelectionListener; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - - - -/** -The ResourceListDetailsPaneBeanInfo class provides bean information -for the ResourceListDetailsPane class. - -@see ResourceListDetailsPane -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class ResourceListDetailsPaneBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = ResourceListDetailsPane.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor listSelection = new EventSetDescriptor (beanClass_, - "listSelection", ListSelectionListener.class, "valueChanged"); - listSelection.setDisplayName (ResourceLoader.getText ("EVT_NAME_LIST_SELECTION")); - listSelection.setShortDescription (ResourceLoader.getText ("EVT_DESC_LIST_SELECTION")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - events_ = new EventSetDescriptor[] { error, listSelection, propertyChange }; - - // Properties. - PropertyDescriptor resourceList = new PropertyDescriptor ("resourceList", beanClass_); - resourceList.setBound (true); - resourceList.setConstrained (false); - resourceList.setDisplayName (ResourceLoader.getText ("PROP_NAME_RESOURCE_LIST")); - resourceList.setShortDescription (ResourceLoader.getText ("PROP_DESC_RESOURCE_LIST")); - - PropertyDescriptor columnAttributeIDs = new PropertyDescriptor ("columnAttributeIDs", beanClass_); - columnAttributeIDs.setBound (true); - columnAttributeIDs.setConstrained (false); - columnAttributeIDs.setDisplayName (ResourceLoader.getText ("PROP_NAME_COLUMN_ATTRIBUTE_IDS")); - columnAttributeIDs.setShortDescription (ResourceLoader.getText ("PROP_DESC_COLUMN_ATTRIBUTE_IDS")); - - PropertyDescriptor resourceProperties = new PropertyDescriptor ("resourceProperties", beanClass_); - resourceProperties.setBound (true); - resourceProperties.setConstrained (false); - resourceProperties.setDisplayName (ResourceLoader.getText ("PROP_NAME_RESOURCE_PROPERTIES")); - resourceProperties.setShortDescription (ResourceLoader.getText ("PROP_DESC_RESOURCE_PROPERTIES")); - - PropertyDescriptor allowActions = new PropertyDescriptor ("allowActions", beanClass_); - allowActions.setBound (true); - allowActions.setConstrained (false); - allowActions.setDisplayName (ResourceLoader.getText ("PROP_NAME_ALLOW_ACTIONS")); - allowActions.setShortDescription (ResourceLoader.getText ("PROP_DESC_ALLOW_ACTIONS")); - - properties_ = new PropertyDescriptor[] { resourceList, columnAttributeIDs, resourceProperties, allowActions }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // resource list. - } - - - -/** - Returns the descriptors for all events. - @return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("ResourceListDetailsPane16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("ResourceListDetailsPane32.gif"); - break; - default: - throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - return image; - } - - - -/** - Returns the descriptors for all properties. - @return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListModel.java b/cvsroot/src/com/ibm/as400/vaccess/ResourceListModel.java deleted file mode 100644 index d39cf13c9..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ResourceListModel.java +++ /dev/null @@ -1,454 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListModel.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.resource.Resource; -import com.ibm.as400.resource.ResourceList; -import com.ibm.as400.resource.ResourceListEvent; -import com.ibm.as400.resource.ResourceListListener; -import java.beans.PropertyChangeListener; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import javax.swing.ListModel; -import javax.swing.event.ListDataListener; - - - -/** -The ResourceListModel class implements an underlying model for -a list, where all information for the model is gathered from -the contents of a -{@link com.ibm.as400.resource.ResourceList ResourceList} -object. Every item represents a -{@link com.ibm.as400.resource.Resource Resource } from the -list. You must explicitly call -load() to load the information from the resource -list. - -

    Use this class if you want to customize the graphical -user interface that presents a list. If you do not need -to customize the interface, then use -ResourceListPane -instead. - -

    Most errors are reported as -ErrorEvents -rather than throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    ResourceListModel objects generate the following events: -

      -
    • ErrorEvent -
    • ListDataEvent -
    • PropertyChangeEvent -
    • WorkingEvent -
    - -

    The following example creates a list model filled with -the contents of a user list from a system. It then presents -the list in a JList object. - -

    -// Create the resource list.  This example creates
    -// a list of all users on the system.
    -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -RUserList userList = new RUserList(system);
    -
    -// Create the ResourceListModel. -ResourceListModel listModel = new ResourceListModel(userList); -
    -// Create a JList using the ResourceListModel. -JList list = new JList(listModel); -
    -// Add the JList to a JFrame and show it. -JFrame frame = new JFrame("My Window"); -frame.getContentPane().add(new JScrollPane(list)); -frame.pack(); -frame.show(); -
    -// The JList will appear empty until we tell the -// ResourceListModel to load. This gives us control -// of when the list of users is retrieved from the -// system. -listModel.load(); -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class ResourceListModel -implements ListModel, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private boolean exceptionOccured_ = false; - private transient boolean loaded_ = false; - private ResourceList resourceList_ = null; - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient ListDataEventSupport listDataEventSupport_; // Private. - transient private PropertyChangeSupport propertyChangeSupport_; - transient private ResourceListListener resourceListListener_; - transient private WorkingEventSupport workingEventSupport_; - - - -/** -Constructs a ResourceListModel object. -**/ - public ResourceListModel() - { - initializeTransient(); - } - - - -/** -Constructs a ResourceListModel object. - -@param resourceList The resource list. -**/ - public ResourceListModel(ResourceList resourceList) - { - if (resourceList == null) - throw new NullPointerException("resourceList"); - - resourceList_ = resourceList; - initializeTransient(); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener(ErrorListener listener) - { - errorEventSupport_.addErrorListener(listener); - } - - - -/** -Adds a listener to be notified when the contents of -the list change. - -@param listener The listener. -**/ - public void addListDataListener(ListDataListener listener) - { - listDataEventSupport_.addListDataListener(listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener(listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ - public void addWorkingListener(WorkingListener listener) - { - workingEventSupport_.addWorkingListener(listener); - } - - - -/** -Returns the element at the specified index. - -@param rowIndex The row index (0-based). -@return The element at the specified index. It will be null if the index - is not valid or the root has not been set. -**/ - public Object getElementAt(int rowIndex) - { - if ((resourceList_ == null) - || (loaded_ == false) - || (exceptionOccured_)) - return null; - - try { - // Validate the index. - if ((rowIndex < 0) || ((resourceList_.isComplete()) && (rowIndex > resourceList_.getListLength()))) - return null; - - return resourceList_.resourceAt(rowIndex); - } - catch(Exception e) { - errorEventSupport_.fireError(e); - exceptionOccured_ = true; - return null; - } - } - - - -/** -Returns the resource list from which all information for the model is gathered. - -@return The resource list from which all information for the model is gathered. - This will be null if none has been set. -**/ - public ResourceList getResourceList() - { - return resourceList_; - } - - - -/** -Returns the number of objects in the list. - -@return The number of objects in the list. -**/ - public int getSize () - { - if ((resourceList_ == null) - || (loaded_ == false) - || (exceptionOccured_)) - return 0; - - try { - // If the resource list is not complete, then refresh - // its status. This will force the reported length - // to be periodically updated. - if (! resourceList_.isComplete()) - resourceList_.refreshStatus(); - - long listLength = resourceList_.getListLength(); - return (int)listLength; - } - catch(Exception e) { - errorEventSupport_.fireError(e); - exceptionOccured_ = true; - return 0; - } - } - - - -/** -Initializes transient data. -**/ - private void initializeTransient() - { - errorEventSupport_ = new ErrorEventSupport(this); - listDataEventSupport_ = new ListDataEventSupport(this); - propertyChangeSupport_ = new PropertyChangeSupport(this); - resourceListListener_ = new ResourceListListener_(); - workingEventSupport_ = new WorkingEventSupport(this); - - if (resourceList_ != null) { - resourceList_.addActiveStatusListener(workingEventSupport_); - resourceList_.addResourceListListener (resourceListListener_); - } - } - - - -/** -Loads the information from the resource list. -**/ - public void load() - { - int previousLength = getSize(); - - if ((loaded_) && (resourceList_ != null) && (!exceptionOccured_)) { - try { - resourceList_.refreshContents(); - } - catch(Exception e) { - errorEventSupport_.fireError(e); - exceptionOccured_ = true; - } - } - else - loaded_ = true; - - listDataEventSupport_.fireContentsChanged(0, previousLength); - } - - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient(); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener(ErrorListener listener) - { - errorEventSupport_.removeErrorListener(listener); - } - - - -/** -Removes a list data listener. - -@param listener The listener. -**/ - public void removeListDataListener(ListDataListener listener) - { - listDataEventSupport_.removeListDataListener(listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener(listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener(WorkingListener listener) - { - workingEventSupport_.removeWorkingListener(listener); - } - - - -/** -Sets the resource list from which all information for the model is gathered. - -@param resourceList The resource list from which all information for the model is gathered. -**/ - public void setResourceList(ResourceList resourceList) - { - if (resourceList == null) - throw new NullPointerException ("resourceList"); - - ResourceList oldValue = resourceList_; - - if (oldValue != resourceList) { - - int previousLength = getSize(); - - // Redirect event support. - if (oldValue != null) { - oldValue.removeActiveStatusListener(workingEventSupport_); - oldValue.removeResourceListListener(resourceListListener_); - } - resourceList.addActiveStatusListener(workingEventSupport_); - resourceList.addResourceListListener(resourceListListener_); - - // Set the resource list. - resourceList_ = resourceList; - exceptionOccured_ = false; - - // Change the contents of the list. - listDataEventSupport_.fireContentsChanged(0, previousLength); - } - - propertyChangeSupport_.firePropertyChange ("resourceList", oldValue, resourceList_); - } - - - -/** -The ResourceListListener_ class processes ResourceListEvents and -fires the appropriate ListDataEvents. -**/ - private class ResourceListListener_ implements ResourceListListener - { - - private long length_ = 0; - - public void lengthChanged(ResourceListEvent event) - { - long newLength = event.getLength(); - listDataEventSupport_.fireIntervalAdded((int)length_, (int)newLength); - length_ = newLength; - } - - public void listClosed(ResourceListEvent event) - { - // Do nothing. - } - - public void listCompleted(ResourceListEvent event) - { - // Do nothing. - } - - public void listInError(ResourceListEvent event) - { - // Do nothing. - } - - public void listOpened(ResourceListEvent event) - { - // Do nothing. - } - - public void resourceAdded(ResourceListEvent event) - { - // Do nothing. - } - - } - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListModel16.gif b/cvsroot/src/com/ibm/as400/vaccess/ResourceListModel16.gif deleted file mode 100644 index cf448524e..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/ResourceListModel16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListModel32.gif b/cvsroot/src/com/ibm/as400/vaccess/ResourceListModel32.gif deleted file mode 100644 index fdb1147c4..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/ResourceListModel32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListModelBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/ResourceListModelBeanInfo.java deleted file mode 100644 index 01fcd7691..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ResourceListModelBeanInfo.java +++ /dev/null @@ -1,187 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListModelBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import javax.swing.event.ListDataListener; - - - -/** -The ResourceListModelBeanInfo class provides bean information -for the ResourceListModel class. - -@see ResourceListModel -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class ResourceListModelBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = ResourceListModel.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - String[] listDataMethods = { "contentsChanged", "intervalAdded", "intervalRemoved" }; - EventSetDescriptor listData = new EventSetDescriptor (beanClass_, - "listData", ListDataListener.class, listDataMethods, - "addListDataListener", "removeListDataListener"); - listData.setDisplayName (ResourceLoader.getText ("EVT_NAME_LIST_DATA")); - listData.setShortDescription (ResourceLoader.getText ("EVT_DESC_LIST_DATA")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { error, listData, propertyChange, working }; - - // Properties. - PropertyDescriptor resourceList = new PropertyDescriptor ("resourceList", beanClass_); - resourceList.setBound (true); - resourceList.setConstrained (false); - resourceList.setDisplayName (ResourceLoader.getText ("PROP_NAME_RESOURCE_LIST")); - resourceList.setShortDescription (ResourceLoader.getText ("PROP_DESC_RESOURCE_LIST")); - - properties_ = new PropertyDescriptor[] { resourceList }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // resource list. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("ResourceListModel16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("ResourceListModel32.gif"); - break; - default: - throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - return image; - } - - - -/** - Returns the descriptors for all properties. - @return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListPane.java b/cvsroot/src/com/ibm/as400/vaccess/ResourceListPane.java deleted file mode 100644 index 21e595765..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ResourceListPane.java +++ /dev/null @@ -1,567 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.resource.Resource; -import com.ibm.as400.resource.ResourceList; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Point; -import java.beans.PropertyChangeListener; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import javax.swing.JComponent; -import javax.swing.JList; -import javax.swing.JScrollPane; -import javax.swing.ListModel; -import javax.swing.ListSelectionModel; -import javax.swing.event.ListSelectionListener; - - - -/** -The ResourceListPane class represents a graphical user interface -that presents the contents of a -{@link com.ibm.as400.resource.ResourceList ResourceList} -in a list. Every item represents a -{@link com.ibm.as400.resource.Resource Resource} from the -list. You must explicitly call load() -to load the information from the resource list. - -

    Pop-up menus are enabled by default. -The pop-up menus will contain a single -"Properties" menu item which, when selected, -presents one of the following Properties dialogs: -

      -
    • If a list item is clicked, the dialog presents - the corresponding Resource object's attribute - values. The layout of this Properties dialog - is defined by the resource properties specified - for this ResourceListPane object. - By default, it will contain a "General" tab - which shows the Resource object's icon and - full name. -
    • If something other than a list item is clicked, - the dialog presents the ResourceList object's - selection and sort values. -
    - -

    Most errors are reported as -ErrorEvents -rather than throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    ResourceListPane objects generate the following events: -

      -
    • ErrorEvent -
    • ListSelectionEvent -
    • PropertyChangeEvent -
    - -

    The following example creates a list pane filled with -the list of messages in a message queue. - -

    -// Create the resource list.  This example creates
    -// a list of all messages in a message queue.
    -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -RMessageQueue mq = new RMessageQueue(system, "/QSYS.LIB/MYLIB.LIB/MYMQ.MSGQ");
    -
    -// Create the ResourceListPane. -ResourceListPane listPane = new ResourceListPane(); -listPane.setResourceList(mq); -
    -// Add the ResourceListPane to a JFrame and show it. -JFrame frame = new JFrame("My Window"); -frame.getContentPane().add(listPane); -frame.pack(); -frame.show(); -
    -// The ResourceListPane will appear empty until we -// load it. This gives us control of when the list -// of messages is retrieved from the system. -listPane.load(); -
    - -@see ResourceListModel -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class ResourceListPane -extends JComponent -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String ACTION_PROPERTIES_ = ResourceLoader.getText("ACTION_PROPERTIES"); - private static final String ACTION_LIST_PROPERTIES_ = ResourceLoader.getText("ACTION_LIST_PROPERTIES"); - - - - // Private data. - private boolean allowActions_ = true; - private transient JList list_ = null; - private ResourceListModel model_ = null; - private ResourceProperties resourceProperties_ = null; - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private ListSelectionEventSupport listSelectionEventSupport_; - transient private ResourceListPopupMenuAdapter popupMenuAdapter_; - transient private PropertyChangeSupport propertyChangeSupport_; - - - -/** -Constructs a ResourceListPane object. -**/ - public ResourceListPane() - { - initializeCommon(); - - // Set the default resource properties. - resourceProperties_ = new ResourceProperties(); - } - - - -/** -Constructs a ResourceListPane object. - -@param resourceList The resource list. -@param resourceProperties The resource properties. -**/ - public ResourceListPane(ResourceList resourceList, - ResourceProperties resourceProperties) - { - if (resourceList == null) - throw new NullPointerException ("resourceList"); - if (resourceProperties == null) - throw new NullPointerException ("resourceProperties"); - - initializeCommon(); - - resourceProperties_ = resourceProperties; - model_.setResourceList(resourceList); - popupMenuAdapter_.setResourceList(resourceList); - popupMenuAdapter_.setResourceProperties(resourceProperties); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener(ErrorListener listener) - { - errorEventSupport_.addErrorListener(listener); - } - - - -/** -Adds a listener to be notified when a list selection occurs. - -@param listener The listener. -**/ - public void addListSelectionListener(ListSelectionListener listener) - { - listSelectionEventSupport_.addListSelectionListener(listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - super.addPropertyChangeListener(listener); - propertyChangeSupport_.addPropertyChangeListener(listener); - } - - - -/** -Indicates if pop-up menus are enabled. - -@return true if pop-up menus are enabled, false otherwise. -**/ - public boolean getAllowActions () - { - return allowActions_; - } - - - - -/** -Returns the list model. - -@return The list model. -**/ - public ListModel getModel () - { - return model_; - } - - - -/** -Returns the resource that corresponds to the row located at the specified -point. This can be useful for present customized pop-up menus. - -@param point The point. -@return The resource that corresponds to the row located at - the point, or null if no such resource exists. -**/ - public Resource getResourceAtPoint(Point point) - { - Resource resource = null; - int row = list_.locationToIndex(point); - if (row != -1) - resource = (Resource)model_.getElementAt(row); - return resource; - } - - - -/** -Returns the resource list from which all information for the model is gathered. - -@return The resource list from which all information for the model is gathered. - This will be null if none has been set. -**/ - public ResourceList getResourceList() - { - return model_.getResourceList(); - } - - - -/** -Returns the resource properties. The resource properties object -describes the arrangement of the Properties dialog that is presented -when the user right clicks on a list item and selects "Properties". -**/ - public ResourceProperties getResourceProperties() - { - return resourceProperties_; - } - - - -/** -Returns the first selected resource. - -@return The first selected resource, or null if none are selected. - -@see #getSelectionModel -@see #setSelectionModel -**/ - public Resource getSelectedResource() - { - Resource selectedResource = null; - int selectedIndex = list_.getSelectedIndex(); - if (selectedIndex >= 0) - selectedResource = (Resource)model_.getElementAt(selectedIndex); - return selectedResource; - } - - - -/** -Returns the selected resources. - -@return The selected resources. - The array is empty if no resources are selected. - -@see #getSelectionModel -@see #setSelectionModel -**/ - public Resource[] getSelectedResources() - { - int[] selectedIndices = list_.getSelectedIndices(); - int selectedCount = selectedIndices.length; - Resource[] selectedResources = new Resource[selectedCount]; - for (int i = 0; i < selectedCount; ++i) - selectedResources[i] = (Resource)model_.getElementAt(selectedIndices[i]); - return selectedResources; - } - - - -/** -Returns the selection model that is used to maintain -selection state. This provides the ability to programmatically -select and deselect resources. - -@return The selection model. -**/ - public ListSelectionModel getSelectionModel () - { - return list_.getSelectionModel(); - } - - - -/** -Returns the preferred number of visible rows. - -@return The preferred number of visible rows. -**/ - public int getVisibleRowCount() - { - return list_.getVisibleRowCount(); - } - - - -/** -Initializes the common data. -**/ - private void initializeCommon() - { - // Initialize the model. - model_ = new ResourceListModel(); - - initializeTransient(); - - // Layout the pane. - setLayout(new BorderLayout()); - add("Center", new JScrollPane(list_)); - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient() - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport(this); - listSelectionEventSupport_ = new ListSelectionEventSupport(this); - propertyChangeSupport_ = new PropertyChangeSupport(this); - - // Initialize the list. - list_ = new JList(model_); - list_.setCellRenderer(new ResourceCellRenderer(null)); - - model_.addErrorListener(errorEventSupport_); - model_.addPropertyChangeListener(propertyChangeSupport_); - list_.getSelectionModel().addListSelectionListener(listSelectionEventSupport_); - - // Initialize the other adapters. - popupMenuAdapter_ = new ResourceListPopupMenuAdapter(this, model_.getResourceList(), resourceProperties_, errorEventSupport_); - model_.addWorkingListener(new WorkingCursorAdapter(list_)); - setAllowActions(allowActions_); - } - - - -/** -Indicates if the resource is selected. - -@param resource The resource. -@return true if the resource is selected; false otherwise. - -@see #getSelectionModel -@see #setSelectionModel -**/ - public boolean isSelected(Resource resource) - { - if (resource == null) - throw new NullPointerException ("resource"); - - Object[] selectedResources = list_.getSelectedValues(); - for (int i = 0; i < selectedResources.length; ++i) - if (selectedResources[i].equals(resource)) - return true; - return false; - } - - - -/** -Loads the information from the resource list. -**/ - public void load() - { - list_.clearSelection(); - model_.load(); - } - - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient(); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a list selection listener. - -@param listener The listener. -**/ - public void removeListSelectionListener (ListSelectionListener listener) - { - listSelectionEventSupport_.removeListSelectionListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - super.removePropertyChangeListener (listener); - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Sets whether pop-up menus are enabled. - -@param allowActions true to enable pop-up menus, false otherwise. - The default is true. -**/ - public void setAllowActions(boolean allowActions) - { - Boolean oldValue = new Boolean(allowActions_); - - allowActions_ = allowActions; - if (allowActions_) - list_.addMouseListener(popupMenuAdapter_); - else - list_.removeMouseListener(popupMenuAdapter_); - - propertyChangeSupport_.firePropertyChange("allowActions", oldValue, new Boolean(allowActions)); - } - - - -/** -Sets the resource list from which all information for the model is gathered. - -@param resourceList The resource list from which all information for the model is gathered. -**/ - public void setResourceList(ResourceList resourceList) - { - if (resourceList == null) - throw new NullPointerException ("resourceList"); - - list_.clearSelection(); - model_.setResourceList(resourceList); - popupMenuAdapter_.setResourceList(resourceList); - } - - - -/** -Sets the resource properties. The resource properties object -describes the arrangement of the Properties dialog that is presented when -the user right clicks on a list item and selects "Properties". - -@param resourceProperties The resource properties. -**/ - public void setResourceProperties(ResourceProperties resourceProperties) - { - if (resourceProperties == null) - throw new NullPointerException("resourceProperties"); - - ResourceProperties oldValue = resourceProperties_; - - resourceProperties_ = resourceProperties; - popupMenuAdapter_.setResourceProperties(resourceProperties); - - propertyChangeSupport_.firePropertyChange("resourceProperties", oldValue, resourceProperties); - } - - - -/** -Sets the selection model that is used to maintain selection -state. This provides the ability to programmatically select -and deselect resources. - -@param selectionModel The selection model. -**/ - public void setSelectionModel (ListSelectionModel selectionModel) - { - if (selectionModel == null) - throw new NullPointerException ("selectionModel"); - - // Do not dispatch events from the old selection model any more. - ListSelectionModel oldSelectionModel = list_.getSelectionModel (); - oldSelectionModel.removeListSelectionListener (listSelectionEventSupport_); - - list_.setSelectionModel (selectionModel); - - // Dispatch events from the new selection model. - selectionModel.addListSelectionListener (listSelectionEventSupport_); - } - - - -/** -Sets the preferred number of visible rows. - -@param visibleRowCount The preferred number of visible rows. -**/ - public void setVisibleRowCount (int visibleRowCount) - { - list_.setVisibleRowCount (visibleRowCount); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListPane16.gif b/cvsroot/src/com/ibm/as400/vaccess/ResourceListPane16.gif deleted file mode 100644 index d1634d788..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/ResourceListPane16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListPane32.gif b/cvsroot/src/com/ibm/as400/vaccess/ResourceListPane32.gif deleted file mode 100644 index 8405e6e92..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/ResourceListPane32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListPaneBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/ResourceListPaneBeanInfo.java deleted file mode 100644 index 0c66c61a1..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ResourceListPaneBeanInfo.java +++ /dev/null @@ -1,190 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListPaneBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import javax.swing.event.ListSelectionListener; -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - - - -/** -The ResourceListPaneBeanInfo class provides bean information -for the ResourceListPane class. - -@see ResourceListPane -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class ResourceListPaneBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = ResourceListPane.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor listSelection = new EventSetDescriptor (beanClass_, - "listSelection", ListSelectionListener.class, "valueChanged"); - listSelection.setDisplayName (ResourceLoader.getText ("EVT_NAME_LIST_SELECTION")); - listSelection.setShortDescription (ResourceLoader.getText ("EVT_DESC_LIST_SELECTION")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - events_ = new EventSetDescriptor[] { error, listSelection, propertyChange }; - - // Properties. - PropertyDescriptor resourceList = new PropertyDescriptor ("resourceList", beanClass_); - resourceList.setBound (true); - resourceList.setConstrained (false); - resourceList.setDisplayName (ResourceLoader.getText ("PROP_NAME_RESOURCE_LIST")); - resourceList.setShortDescription (ResourceLoader.getText ("PROP_DESC_RESOURCE_LIST")); - - PropertyDescriptor resourceProperties = new PropertyDescriptor ("resourceProperties", beanClass_); - resourceProperties.setBound (true); - resourceProperties.setConstrained (false); - resourceProperties.setDisplayName (ResourceLoader.getText ("PROP_NAME_RESOURCE_PROPERTIES")); - resourceProperties.setShortDescription (ResourceLoader.getText ("PROP_DESC_RESOURCE_PROPERTIES")); - - PropertyDescriptor allowActions = new PropertyDescriptor ("allowActions", beanClass_); - allowActions.setBound (true); - allowActions.setConstrained (false); - allowActions.setDisplayName (ResourceLoader.getText ("PROP_NAME_ALLOW_ACTIONS")); - allowActions.setShortDescription (ResourceLoader.getText ("PROP_DESC_ALLOW_ACTIONS")); - - properties_ = new PropertyDescriptor[] { resourceList, resourceProperties, allowActions }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // resource list. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("ResourceListPane16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("ResourceListPane32.gif"); - break; - default: - throw new ExtendedIllegalArgumentException("icon", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - } - return image; - } - - - -/** - Returns the descriptors for all properties. - @return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListPopupMenuAdapter.java b/cvsroot/src/com/ibm/as400/vaccess/ResourceListPopupMenuAdapter.java deleted file mode 100644 index ebbecde0f..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ResourceListPopupMenuAdapter.java +++ /dev/null @@ -1,177 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListPopupMenuAdapter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.resource.Resource; -import com.ibm.as400.resource.ResourceList; -import java.awt.Component; -import java.awt.Point; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import javax.swing.JDialog; -import javax.swing.JMenuItem; -import javax.swing.JPopupMenu; - - - -/** -The ResourceListPopupMenuAdapter class represents the pop-up menu for -the resource list GUI classes. -**/ -class ResourceListPopupMenuAdapter -extends MouseAdapter -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String ACTION_PROPERTIES_ = ResourceLoader.getText("ACTION_PROPERTIES"); - private static final String ACTION_LIST_PROPERTIES_ = ResourceLoader.getText("ACTION_LIST_PROPERTIES"); - - - - // Private data. - private DialogCache dialogCache_ = new DialogCache(); - private ErrorEventSupport errorEventSupport_; - private ResourceProperties resourceProperties_; - private ResourceList resourceList_; - private Object target_; - - - -/** -Constructs a ResourceListPopupMenuAdapter object. - -@param target The target resource list GUI object. -@param resourceList The resource list. -@param resourceProperties The resource properties. -@param errorEventSupport The error event support. -**/ - public ResourceListPopupMenuAdapter(Object target, - ResourceList resourceList, - ResourceProperties resourceProperties, - ErrorEventSupport errorEventSupport) - { - target_ = target; - resourceList_ = resourceList; - resourceProperties_ = resourceProperties; - errorEventSupport_ = errorEventSupport; - } - - - -/** -Shows the pop-up menu when the right mouse button is released. - -@param event The event. -**/ - public void mouseReleased(MouseEvent event) - { - if (event.isPopupTrigger()) - showPopupMenu(event.getComponent(),event.getPoint()); - } - - - -/** -Sets the resource properties. - -@param resourceProperties The resource properties. -**/ - public void setResourceProperties(ResourceProperties resourceProperties) - { - resourceProperties_ = resourceProperties; - } - - - -/** -Sets the resource list. - -@param resourceList The resource list. -**/ - public void setResourceList(ResourceList resourceList) - { - resourceList_ = resourceList; - } - - - -/** -Shows the pop-up menu. - -@param component The component which was clicked. -@param point The point. -**/ - private void showPopupMenu(Component component, Point point) - { - // Find out which resource was clicked on, if any. - Resource resource = null; - if (target_ instanceof ResourceListPane) - resource = ((ResourceListPane)target_).getResourceAtPoint(point); - else if (target_ instanceof ResourceListDetailsPane) - resource = ((ResourceListDetailsPane)target_).getResourceAtPoint(point); - else - return; - - JPopupMenu menu = new JPopupMenu(); - boolean showPopup = false; - - // If a resource was clicked on, then put up a menu for it. - if (resource != null) { - JMenuItem propertiesMenuItem = new JMenuItem(ACTION_PROPERTIES_); - final Resource resource2 = resource; - propertiesMenuItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { - JDialog dialog = dialogCache_.resolveDialog(resource2); - if (dialog == null) { - dialog = new ResourcePropertiesPane(resource2, resourceProperties_, errorEventSupport_); - dialogCache_.addDialog(resource2, dialog); - dialog.show(); - } - } - }); - menu.add(propertiesMenuItem); - showPopup = true; - } - - // If a resource list is set, then put up a menu for it. - if (resourceList_ != null) { - JMenuItem listPropertiesMenuItem = new JMenuItem(ACTION_LIST_PROPERTIES_); - listPropertiesMenuItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { - JDialog dialog = dialogCache_.resolveDialog(resourceList_); - if (dialog == null) { - dialog = new ResourceListPropertiesPane(resourceList_, errorEventSupport_); - dialogCache_.addDialog(resourceList_, dialog); - dialog.show(); - } - } - }); - if (showPopup) - menu.addSeparator(); - menu.add(listPropertiesMenuItem); - showPopup = true; - } - - if (showPopup) - menu.show(component, point.x, point.y); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListPropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/ResourceListPropertiesPane.java deleted file mode 100644 index 050229cfa..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ResourceListPropertiesPane.java +++ /dev/null @@ -1,182 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListPropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.resource.Presentation; -import com.ibm.as400.resource.ResourceException; -import com.ibm.as400.resource.ResourceList; -import com.ibm.as400.resource.ResourceMetaData; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Image; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.util.Enumeration; -import java.util.Hashtable; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.ComboBoxEditor; -import javax.swing.DefaultListCellRenderer; -import javax.swing.DefaultListModel; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JDialog; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTextField; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import javax.swing.border.EtchedBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.plaf.basic.BasicComboBoxEditor; - - - -/** -The ResourceListPropertiesPane class represents a dialog for -updating the properties of a resource list. -**/ -class ResourceListPropertiesPane -extends JDialog -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String DLG_APPLY_ = ResourceLoader.getText("DLG_APPLY"); - private static final String DLG_CANCEL_ = ResourceLoader.getText("DLG_CANCEL"); - private static final String DLG_OK_ = ResourceLoader.getText("DLG_OK"); - private static final String DLG_PROPERTIES_TITLE_ = ResourceLoader.getText("DLG_PROPERTIES_TITLE"); - private static final String RESOURCE_SORT_TAB_ = ResourceLoader.getText("RESOURCE_SORT_TAB"); - - - - // Private data. - private JButton applyButton_; - private JButton cancelButton_; - private JButton okButton_; - - private ResourceListPropertiesTabbedPane tabbedPane_; - - private ErrorEventSupport errorEventSupport_; - - - -/** -Constructs a ResourceListPropertiesPane object. - -@param resourceList The resource list. -@param errorEventSupport The error event support. -**/ - public ResourceListPropertiesPane(ResourceList resourceList, ErrorEventSupport errorEventSupport) - { - super(); - - errorEventSupport_ = errorEventSupport; - - // Set up the buttons. - okButton_ = new JButton(DLG_OK_); - cancelButton_ = new JButton(DLG_CANCEL_); - applyButton_ = new JButton(DLG_APPLY_); - - applyButton_.setEnabled(false); - - ActionListener actionListener = new ActionListener_(); - okButton_.addActionListener(actionListener); - cancelButton_.addActionListener(actionListener); - applyButton_.addActionListener(actionListener); - - JPanel buttons = new JPanel(); - buttons.setLayout(new FlowLayout(FlowLayout.RIGHT)); - buttons.add(okButton_); - buttons.add(cancelButton_); - buttons.add(applyButton_); - - // Set up the tabbed pane. - tabbedPane_ = new ResourceListPropertiesTabbedPane(resourceList); - tabbedPane_.addErrorListener(errorEventSupport_); - tabbedPane_.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent event) { - applyButton_.setEnabled(true); - } - }); - - // Arrange everything on this dialog. - setTitle(ResourceLoader.substitute(DLG_PROPERTIES_TITLE_, resourceList.getPresentation().getName())); - setResizable(false); - getContentPane().setLayout(new BorderLayout()); - getContentPane().add("Center", tabbedPane_); - getContentPane().add("South", buttons); - pack(); - } - - - -/** -Applies any changes made by the user. -**/ - public void applyChanges() - { - tabbedPane_.applyChanges(); - applyButton_.setEnabled(false); - } - - - -/** -The ActionListener_ class processes clicks of the OK, Cancel, and -Apply buttons. -**/ - private class ActionListener_ implements ActionListener - { - public void actionPerformed(ActionEvent event) - { - Object source = event.getSource(); - - if (source == okButton_) { - applyChanges(); - dispose(); - } - - else if (source == cancelButton_) - dispose(); - - else if (source == applyButton_) { - applyChanges(); - } - } - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceListPropertiesTabbedPane.java b/cvsroot/src/com/ibm/as400/vaccess/ResourceListPropertiesTabbedPane.java deleted file mode 100644 index 840753221..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ResourceListPropertiesTabbedPane.java +++ /dev/null @@ -1,661 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceListPropertiesTabbedPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.resource.Presentation; -import com.ibm.as400.resource.ResourceException; -import com.ibm.as400.resource.ResourceList; -import com.ibm.as400.resource.ResourceMetaData; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Image; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.util.Enumeration; -import java.util.Hashtable; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.ComboBoxEditor; -import javax.swing.DefaultListCellRenderer; -import javax.swing.DefaultListModel; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTextField; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import javax.swing.border.EtchedBorder; -import javax.swing.event.ChangeListener; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.plaf.basic.BasicComboBoxEditor; - - - -class ResourceListPropertiesTabbedPane -extends JComponent -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String DLG_ADD_ = ResourceLoader.getText("DLG_ADD"); - private static final String DLG_REMOVE_ = ResourceLoader.getText("DLG_REMOVE"); - - private static final String RESOURCE_ALL_SORTS_ = ResourceLoader.getText("RESOURCE_ALL_SORTS"); - private static final String RESOURCE_CURRENT_SORTS_ = ResourceLoader.getText("RESOURCE_CURRENT_SORTS"); - private static final String RESOURCE_SELECTION_TAB_ = ResourceLoader.getText("RESOURCE_SELECTION_TAB"); - private static final String RESOURCE_SORT_TAB_ = ResourceLoader.getText("RESOURCE_SORT_TAB"); - - - - // Private data. - private Hashtable changes_ = new Hashtable(); - private DefaultListModel currentSortsModel_; - private Presentation presentation_; - private ResourceList resourceList_; - - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private ChangeEventSupport changeEventSupport_ = new ChangeEventSupport (this); - - - - public ResourceListPropertiesTabbedPane(ResourceList resourceList) - { - super(); - - resourceList_ = resourceList; - presentation_ = resourceList.getPresentation(); - - // Set up the tabbed pane. - JTabbedPane tabbedPane = new JTabbedPane(); - - // Set up the tabs. - tabbedPane.addTab(RESOURCE_SELECTION_TAB_, createSelectionComponent()); - if (resourceList.getSortMetaData().length > 0) - tabbedPane.addTab(RESOURCE_SORT_TAB_, createSortComponent()); - - // Arrange everything on this dialog. - setLayout(new BorderLayout()); - add("Center", tabbedPane); - } - - - - - public void addChangeListener (ChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - changeEventSupport_.addChangeListener (listener); - } - - - - public void addErrorListener (ErrorListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - errorEventSupport_.addErrorListener (listener); - } - - - - public void applyChanges() // @A1A - { // @A1A - applyChanges(true); // @A1A - } // @A1A - - - - public void applyChanges(boolean refreshContents) // @A1C - { - synchronized(changes_) { - - try { - // Make the selection changes. - Enumeration selectionIDs = changes_.keys(); - while(selectionIDs.hasMoreElements()) { - Object selectionID = selectionIDs.nextElement(); - Object value = changes_.get(selectionID); - resourceList_.setSelectionValue(selectionID, value); - } - - // Clear out the list of changes. - changes_.clear(); - - // Set the sort value. - if (currentSortsModel_ != null) - resourceList_.setSortValue(currentSortsModel_.toArray()); - - // Load the resource list. - if (refreshContents) // @A1A - resourceList_.refreshContents(); - } - catch(Exception e) { - if(Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error applying changes", e); - errorEventSupport_.fireError(e); - } - } - } - - - -/** -Creates the component for a selection. - -@param rmd The selection meta data for the selection. -@return The component. - -@throws ResourceException If an error occurs. -**/ - private Component createSelectionComponent(ResourceMetaData rmd) - throws ResourceException - { - // Get the initial value. - Object selectionID = rmd.getID(); - Object initialValue = resourceList_.getSelectionValue(selectionID); - - // Determine if the component should be editable. - boolean editable = !rmd.isReadOnly(); - - // Create the component. Decide the type of component based - // on the type of value, etc. - Component component = null; - Class type = rmd.getType(); - Object[] possibleValues = rmd.getPossibleValues(); - - // If the type is Boolean, use a JCheckBox. - if (type == Boolean.class) { - JCheckBox checkBox = new JCheckBox("", ((Boolean)initialValue).booleanValue()); - checkBox.setEnabled(editable); - checkBox.addActionListener(new ChangeListener_(selectionID)); - component = checkBox; - } - - // If there are any possible values AND the value is - // editable, use a JComboBox. If its not editable, - // use a JLabel. - else if (possibleValues != null) { - if (possibleValues.length > 0) { - if (editable) { - JComboBox comboBox = new JComboBox(); - if (initialValue.getClass().isArray()) - initialValue = ((Object[])initialValue)[0]; - boolean initialValueFound = false; - for(int i = 0; i < possibleValues.length; ++i) { - comboBox.addItem(possibleValues[i]); - if (possibleValues[i] == initialValue) - initialValueFound = true; - } - if (!initialValueFound) - comboBox.addItem(initialValue); - comboBox.setRenderer(new JComboBoxRenderer(rmd)); - comboBox.setEditor(new JComboBoxEditor(rmd)); - comboBox.setEditable(!rmd.isValueLimited()); - ChangeListener_ changeListener = new ChangeListener_(selectionID, comboBox.getEditor()); - comboBox.addItemListener(changeListener); - comboBox.getEditor().getEditorComponent().addKeyListener(changeListener); - comboBox.setSelectedItem(initialValue); - component = comboBox; - } - else - component = new JLabel(rmd.getPossibleValuePresentation(initialValue).getFullName()); - } - } - - // Anything else, use a JTextField. - if (component == null) { - if (editable) { - JTextField textField = new JTextField(initialValue.toString()); - textField.addKeyListener(new ChangeListener_(selectionID)); - component = textField; - } - else - component = new JLabel(initialValue.toString()); - } - - return component; - } - - - -/** -Creates the selection box. This is the box that contains the main -selection GUI. - -@return The selection box. -**/ - private Component createSelectionBox() - { - // Initialize the left and right box. - Box leftBox = new Box(BoxLayout.Y_AXIS); - Box rightBox = new Box(BoxLayout.Y_AXIS); - Box selectionBox = new Box(BoxLayout.X_AXIS); - selectionBox.add(leftBox); - selectionBox.add(Box.createRigidArea(new Dimension(10, 0))); - selectionBox.add(rightBox); - selectionBox.add(Box.createHorizontalGlue()); - - // Add the components. - ResourceMetaData[] rmd = resourceList_.getSelectionMetaData(); - for(int i = 0; i < rmd.length; ++i) { - - Presentation presentation2 = rmd[i].getPresentation(); - String componentLabel = null; - if (presentation2 != null) - componentLabel = presentation2.getFullName(); - else - componentLabel = rmd[i].getID().toString(); - - // Make the left component. - Component leftComponent = new JLabel(componentLabel + ':'); - leftBox.add(leftComponent); - int leftComponentSize = leftComponent.getPreferredSize().height; - - // Make the right component. - int rightComponentSize = 0; - try { - Component rightComponent = createSelectionComponent(rmd[i]); - rightBox.add(rightComponent); - rightComponentSize = rightComponent.getPreferredSize().height; - } - catch(ResourceException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error creating property component for:" + rmd[i].getID(), e); - errorEventSupport_.fireError(e); - } - - // Add space to make the components line up. - int diff = leftComponentSize - rightComponentSize; - if (diff > 0) - rightBox.add(Box.createRigidArea(new Dimension(0, diff))); - else if (diff < 0) - leftBox.add(Box.createRigidArea(new Dimension(0, -diff))); - - // Add space between components. - leftBox.add(Box.createRigidArea(new Dimension(0, 3))); - rightBox.add(Box.createRigidArea(new Dimension(0, 3))); - } - - // Make sure any excessive space is at the bottom. - leftBox.add(Box.createVerticalGlue()); - rightBox.add(Box.createVerticalGlue()); - - return selectionBox; - } - - - -/** -Creates the selection component. This is the component -which makes up the selection tab. - -@return The selection component. -**/ - private Component createSelectionComponent() - { - // Initialize the overall box. We need to stick it in - // a JPanel just so we can add a border. - Box overallBox = new Box(BoxLayout.Y_AXIS); - JPanel panel = new JPanel(); - panel.setLayout(new BorderLayout()); - panel.add("Center", overallBox); - panel.setBorder(new EmptyBorder(10, 10, 10, 10)); - - // Create the label in a box so it won't always be centered. - JLabel label = new JLabel(presentation_.getFullName(), - new ImageIcon((Image)presentation_.getValue(Presentation.ICON_COLOR_32x32)), - SwingConstants.LEFT); - Box labelBox = new Box(BoxLayout.X_AXIS); - labelBox.add(label); - labelBox.add(Box.createHorizontalGlue()); - overallBox.add(labelBox); - - // Add a separator and some space. - JSeparator separator = new JSeparator(); - separator.setMaximumSize(new Dimension(separator.getMaximumSize().width, separator.getPreferredSize().height)); - overallBox.add(Box.createRigidArea(new Dimension(0, 6))); - overallBox.add(separator); - overallBox.add(Box.createRigidArea(new Dimension(0, 6))); - - // Add any other components. - overallBox.add(createSelectionBox()); - - // Make excess space appear at the bottom. - overallBox.add(Box.createVerticalGlue()); - - return panel; - } - - - -/** -Creates the sort component. This is the component -which makes up the sort tab. - -@return The sort component. -**/ - private Component createSortComponent() - { - // Initialize the overall box. We need to stick it in - // a JPanel just so we can add a border. - Box overallBox = new Box(BoxLayout.X_AXIS); - JPanel panel = new JPanel(); - panel.setLayout(new BorderLayout()); - panel.add("Center", overallBox); - panel.setBorder(new EmptyBorder(10, 10, 10, 10)); - - // Create the All Sorts panel. - JPanel allSortsPanel = new JPanel(); - allSortsPanel.setLayout(new BorderLayout()); - allSortsPanel.add("North", new JLabel(RESOURCE_ALL_SORTS_, SwingConstants.LEFT)); - - DefaultListModel allSortsModel = new DefaultListModel(); - ResourceMetaData[] smd = resourceList_.getSortMetaData(); - for (int i = 0; i < smd.length; ++i) - allSortsModel.addElement(smd[i].getID()); - JList allSortsList = new JList(allSortsModel); - allSortsList.setBorder(new EtchedBorder()); - allSortsList.setAlignmentX(Component.LEFT_ALIGNMENT); - ListCellRenderer_ listCellRenderer = new ListCellRenderer_(); - allSortsList.setCellRenderer(listCellRenderer); - allSortsPanel.add("Center", allSortsList); - overallBox.add(allSortsPanel); - overallBox.add(Box.createRigidArea(new Dimension(6, 0))); - - // Create the button box. - Box buttonBox = new Box(BoxLayout.Y_AXIS); - buttonBox.add(Box.createVerticalGlue()); - JButton addButton = new JButton(DLG_ADD_); - addButton.setAlignmentX(Component.CENTER_ALIGNMENT); - addButton.setEnabled(false); - buttonBox.add(addButton); - buttonBox.add(Box.createRigidArea(new Dimension(0, 6))); - - JButton removeButton = new JButton(DLG_REMOVE_); - removeButton.setAlignmentX(Component.CENTER_ALIGNMENT); - removeButton.setEnabled(false); - buttonBox.add(removeButton); - buttonBox.add(Box.createVerticalGlue()); - overallBox.add(buttonBox); - overallBox.add(Box.createRigidArea(new Dimension(6, 0))); - - // Create the Current Sorts panel. - JPanel currentSortsPanel = new JPanel(); - currentSortsPanel.setLayout(new BorderLayout()); - currentSortsPanel.add("North", new JLabel(RESOURCE_CURRENT_SORTS_, SwingConstants.LEFT)); - - currentSortsModel_ = new DefaultListModel(); - JList currentSortsList = new JList(currentSortsModel_); - currentSortsList.setBorder(new EtchedBorder()); - currentSortsList.setAlignmentX(Component.LEFT_ALIGNMENT); - currentSortsList.setCellRenderer(listCellRenderer); - currentSortsPanel.add("Center", currentSortsList); - overallBox.add(currentSortsPanel); - - // Sync the buttons with the JLists. - allSortsList.addListSelectionListener(new ListSelectionListener_(addButton)); - currentSortsList.addListSelectionListener(new ListSelectionListener_(removeButton)); - addButton.addActionListener(new SortMover_(allSortsList, allSortsModel, currentSortsModel_)); - removeButton.addActionListener(new SortMover_(currentSortsList, currentSortsModel_, allSortsModel)); - - // When the buttons are pressed, enable apply. @A1A - ActionListener applyEnabler = new ActionListener() { // @A1A - public void actionPerformed(ActionEvent event) { // @A1A - changeEventSupport_.fireStateChanged(); // @A1A - }}; // @A1A - addButton.addActionListener(applyEnabler); // @A1A - removeButton.addActionListener(applyEnabler); // @A1A - - return panel; - } - - - - private class ChangeListener_ extends KeyAdapter implements ActionListener, ItemListener - { - private Object selectionID_; - private ComboBoxEditor editor_; - - public ChangeListener_(Object selectionID) - { - selectionID_ = selectionID; - } - - public ChangeListener_(Object selectionID, ComboBoxEditor editor) - { - selectionID_ = selectionID; - editor_ = editor; - } - - public void actionPerformed(ActionEvent event) - { - registerChange(new Boolean(((JCheckBox)event.getSource()).isSelected())); - } - - public void itemStateChanged(ItemEvent event) - { - registerChange(event.getItem()); - } - - public void keyTyped(KeyEvent event) - { - registerChange(editor_.getItem()); - } - - private void registerChange(Object value) - { - synchronized(changes_) { - changes_.put(selectionID_, value); - } - changeEventSupport_.fireStateChanged(); - } - } - - - - -/** -The JComboBoxRenderer class renders a possible value for display -in the JComboBox by using its presentation full name. -**/ - private class JComboBoxRenderer extends DefaultListCellRenderer - { - private ResourceMetaData metaData_; - - public JComboBoxRenderer(ResourceMetaData metaData) - { - metaData_ = metaData; - } - - public Component getListCellRendererComponent(JList list, - Object value, - int index, - boolean isSelected, - boolean cellHasFocus) - { - Object fullName = value; - if (value != null) { - Presentation presentation = metaData_.getPossibleValuePresentation(value); - if (presentation != null) - fullName = presentation.getFullName(); - } - return super.getListCellRendererComponent(list, - fullName, - index, - isSelected, - cellHasFocus); - } - } - - - - -/** -The JComboBoxEditor class allows the editing in the JComboBox -but displays any possible values using its presentation full name. -**/ - private class JComboBoxEditor extends BasicComboBoxEditor - { - private ResourceMetaData metaData_; - private Object actualValue_ = null; - private String fullName_ = null; - - public JComboBoxEditor(ResourceMetaData metaData) - { - metaData_ = metaData; - } - - public Object getItem() { - Object value = super.getItem(); - if (fullName_ != null) - if (value.equals(fullName_)) - return actualValue_; - return value; - } - - public void setItem(Object value) - { - if (value != null) { - try { - Presentation presentation = metaData_.getPossibleValuePresentation(value); - if (presentation != null) - fullName_ = presentation.getFullName(); - else - fullName_ = value.toString(); - actualValue_ = value; - } - catch(Exception e) { - fullName_ = null; - actualValue_ = null; - } - } - super.setItem(fullName_); - } - - } - - - - -/** -The ListCellRenderer_ class renders a possible value for display -in the JList by using its presentation full name. -**/ - private class ListCellRenderer_ extends DefaultListCellRenderer - { - public Component getListCellRendererComponent(JList list, - Object value, - int index, - boolean isSelected, - boolean cellHasFocus) - { - Object fullName = value; - ResourceMetaData rmd = resourceList_.getSortMetaData(value); - if (rmd != null) - fullName = rmd.getPresentation().getFullName(); - return super.getListCellRendererComponent(list, - fullName, - index, - isSelected, - cellHasFocus); - } - } - - - - -/** -The ListSelectionListener_ class enables a button when a list selection -has been made. This is used in the sort GUI so that the appropriate -button is enabled/disabled depending on whether an item in the corresponding -JList has been selected. -**/ - private class ListSelectionListener_ implements ListSelectionListener - { - private JButton button_; - - public ListSelectionListener_(JButton button) - { - button_ = button; - } - - public void valueChanged(ListSelectionEvent event) - { - button_.setEnabled(((JList)event.getSource()).getMinSelectionIndex() >= 0); - } - } - - - -/** -The SortMover_ class moves items from one JList to another when a -button is clicked. -**/ - private class SortMover_ implements ActionListener - { - private JList fromList_; - private DefaultListModel fromModel_; - private DefaultListModel toModel_; - - public SortMover_(JList fromList, - DefaultListModel fromModel, - DefaultListModel toModel) - { - fromList_ = fromList; - fromModel_ = fromModel; - toModel_ = toModel; - } - - public void actionPerformed(ActionEvent event) - { - Object[] selectedValues = fromList_.getSelectedValues(); - for(int i = 0; i < selectedValues.length; ++i) { - fromModel_.removeElement(selectedValues[i]); - toModel_.addElement(selectedValues[i]); - } - - ((JButton)event.getSource()).setEnabled(false); - } - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceLoader.java b/cvsroot/src/com/ibm/as400/vaccess/ResourceLoader.java deleted file mode 100644 index c7e7cd10e..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ResourceLoader.java +++ /dev/null @@ -1,253 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceLoader.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import javax.swing.Icon; -import javax.swing.ImageIcon; -import java.io.File; -import java.net.URL; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - - - -/** -The ResourceLoader class is used to load the MRI resources. -**/ -class ResourceLoader -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Debug flag. This can be helpful in debugging - // ExceptionInInitializerError exceptions, which are ususally - // caused by a resource not being found. Set this to - // true and recompile. - private static final boolean DEBUG_ = false; - - - - // Private data. - private static String genericDescription_ = null; - private static ResourceBundle resources_ = null; - private static ResourceBundle printResources_ = null; - private static ResourceBundle queryResources_ = null; - - - -/** -Returns an icon. - -@param fileName The icon file name. -@return The icon. -**/ - static final Icon getIcon (String fileName) - { - return getIcon (fileName, null); - } - - - -/** -Returns an icon. - -@param fileName The icon file name. -@param description The icon description. -@return The icon. -**/ - static final Icon getIcon (String fileName, String description) - { - Icon icon = null; - - if (DEBUG_) - System.out.println ("ResourceLoader: Loading icon " + fileName + "."); - - try { - - // The generic description is for loading icons. Aparantly, the - // description is used in cases like presenting an icon to blind - // users, etc. In some cases, we just don't have a description, - // so we will put up a canned description. - if (description == null) { - if (genericDescription_ == null) - genericDescription_ = getText ("PRODUCT_TITLE"); - description = genericDescription_; - } - - URL url = ResourceLoader.class.getResource (fileName); - if (url == null) - { - fileName = "com" + File.separator + "ibm" + File.separator + - "as400" + File.separator + "vaccess" + File.separator + - fileName; - icon = new ImageIcon (fileName, description); - } - else - { - icon = new ImageIcon (url, description); - } - } - catch (Exception e) { - if (DEBUG_) - System.out.println ("ResourceLoader: Error: " + e + "."); - - Trace.log (Trace.ERROR, "Icon " + fileName + " not loaded: " + e.getMessage() + "."); - } - - return icon; - } - - - -/** -Returns a resource string. - -@param key The key in the MRI resource bundle. -@return The translatable text. -**/ - static final String getPrintText (String key) - { - if (DEBUG_) - System.out.println ("ResourceLoader: Loading text " + key + "."); - - try { - // Load the resource bundle the first time. - if (printResources_ == null) - printResources_ = ResourceBundle.getBundle ("com.ibm.as400.vaccess.VNPMRI"); - - // Load the resource. - return printResources_.getString (key); - } - catch (MissingResourceException e) { - if (DEBUG_) - System.out.println ("ResourceLoader: Error: " + e + "."); - - Trace.log (Trace.ERROR, "Error while loading print MRI resource: " + key + "."); - throw e; - } - } - - - -/** -Returns a resource string from the VQRYMRI properties file. - -@param key The key in the MRI resource bundle. -@return The translatable text. -**/ - static final String getQueryText (String key) - { - if (DEBUG_) - System.out.println ("ResourceLoader: Loading text " + key + "."); - - try { - // Load the resource bundle the first time. - if (queryResources_ == null) - queryResources_ = ResourceBundle.getBundle ("com.ibm.as400.vaccess.VQRYMRI"); - - // Load the resource. - return queryResources_.getString (key); - } - catch (MissingResourceException e) { - if (DEBUG_) - System.out.println ("ResourceLoader: Error: " + e + "."); - - Trace.log (Trace.ERROR, "Error while loading query MRI resource: " + key + "."); - throw e; - } - } - - - -/** -Returns a resource string. - -@param key The key in the MRI resource bundle. -@return The translatable text. -**/ - static final String getText (String key) - { - if (DEBUG_) - System.out.println ("ResourceLoader: Loading text " + key + "."); - - try { - // Load the resource bundle the first time. - if (resources_ == null) - resources_ = ResourceBundle.getBundle ("com.ibm.as400.vaccess.VMRI"); - - // Load the resource. - return resources_.getString (key); - } - catch (MissingResourceException e) { - if (DEBUG_) - System.out.println ("ResourceLoader: Error: " + e + "."); - - Trace.log (Trace.ERROR, "Error while loading MRI resource: " + key + "."); - throw e; - } - } - - - -// @A1A -/** -Replaces a single substitution variable in a string. - -@param text The text string, with a single substitution variable - (e.g. "Error &0 has occurred."); -@param value The replacement value. -@return The text string with the substitution variable - replaced. -**/ - static String substitute (String text, String value) - { - return substitute (text, new String[] { value }); - } - - - -// @A1A -/** -Replaces substitution variables in a string. - -@param text The text string, with substitution variables - (e.g. "Error &0 in table &1."); -@param values The replacement values. -@return The text string with all substitution variables - replaced. -**/ - static String substitute (String text, String[] values) - { - String result = text; - for (int i = 0; i < values.length; ++i) { - String variable = "&" + i; - int j = result.indexOf (variable); - if (j >= 0) { - StringBuffer buffer = new StringBuffer (); - buffer.append (result.substring (0, j)); - buffer.append (values[i]); - buffer.append (result.substring (j + variable.length ())); - result = buffer.toString (); - } - } - return result; - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourceProperties.java b/cvsroot/src/com/ibm/as400/vaccess/ResourceProperties.java deleted file mode 100644 index b9309d221..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ResourceProperties.java +++ /dev/null @@ -1,415 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourceProperties.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import java.io.Serializable; -import java.util.Hashtable; -import java.util.Vector; - - - -/** -The ResourceProperties class represents the arrangement of properties on -a properties pane for the graphical user interface representation of a -{@link com.ibm.as400.resource.Resource Resource} -or {@link com.ibm.as400.resource.ResourceList ResourceList} object. - -

    The properties pane is presented as a set of tabs, each of which can -present multiple properties. The tabs are identified by their index, -starting at 0, in the order they are added. There is always at least -one tab, created by default. The first tab always displays the icon -and full name of the object being represented. - - -

    Properties are specified using either attribute IDs (for Resource objects), -or selection or sort IDs (for ResourceList objects). Each implementation -of Resource or ResourceList documents its set of valid attribute, selection, -and sort IDs. - - -

    This class alone does not present the properties pane. It is -intended for use in conjunction with -{@link com.ibm.as400.vaccess.ResourceListDetailsPane ResourceListDetailsPane} -or {@link com.ibm.as400.vaccess.ResourceListPane ResourceListPane}. - -

    Here is an example which creates a ResourceProperties object for -a list of jobs: - -

    -// Create the resource list.  This example creates
    -// a list of all jobs on the system.
    -AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    -RJobList resourceList = new RJobList(system);
    -
    -// Create and initialize a ResourceProperties object -// which defines the arrangement of job attributes -// to be presented when the end user views the -// properties for a specific job. -ResourceProperties properties = new ResourceProperties(); -
    -// Add the job number, user name, and job type to the first tab. -properties.addProperty(RJob.JOB_NUMBER); -properties.addProperty(RJob.USER_NAME); -properties.addProperty(RJob.JOB_TYPE); -
    -// Add a new "Special" tab which contains the job status and subtype. -int specialTab = properties.addTab("Special"); -properties.addProperty(specialTab, RJob.JOB_STATUS); -properties.addProperty(specialTab, RJob.JOB_SUBTYPE); -
    -// Create the ResourceListDetailsPane. In this example, -// there are four columns in the table. The first column -// contains the icons and names for each job. The remaining -// columns contain the status, type, and subtype, respectively, -// for each job. In addition, we specify the ResourceProperties -// object defined earlier. -Object[] columnAttributes = new Object[] { null, RJob.JOB_NUMBER, RJob.USER_NAME, RJob.JOB_STATUS, RJob.JOB_TYPE, RJob.JOB_SUBTYPE }; -ResourceListDetailsPane detailsPane = new ResourceListDetailsPane(resourceList, columnAttributes, properties); -
    -// Add the ResourceListDetailsPane to a JFrame and show it. -JFrame frame = new JFrame("My Window"); -frame.getContentPane().add(detailsPane); -frame.pack(); -frame.show(); -
    -// The ResourceListDetailsPane will appear empty until -// we load it. This gives us control of when the list -// of jobs is retrieved from the system. -detailsPane.load(); -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class ResourceProperties -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String RESOURCE_GENERAL_TAB_ = ResourceLoader.getText("RESOURCE_GENERAL_TAB"); - - - - // Private data. - private static final Object FIRST_TAB_KEY_ = new Integer(0); - - private boolean editable_ = false; - private int tabCounter_ = 0; - private Hashtable tabPropertyIDs_ = new Hashtable(); - private Hashtable tabLabels_ = new Hashtable(); - - - - -/** -Constructs the ResourceProperties object. -**/ - public ResourceProperties() - { - this(new Object[0], RESOURCE_GENERAL_TAB_, true); - } - - - -/** -Constructs the ResourceProperties object. - -@param firstTabLabel The label for the first tab. -@param editable true if the properties should be editable, - false otherwise. -**/ - public ResourceProperties(String firstTabLabel, boolean editable) - { - this(new Object[0], firstTabLabel, editable); - } - - - -/** -Constructs the ResourceProperties object. - -@param propertyIDs The property IDs to add to the first tab. -@param firstTabLabel The label for the first tab. -@param editable true if the properties should be editable, - false otherwise. -**/ - public ResourceProperties(Object[] propertyIDs, String firstTabLabel, boolean editable) - { - if (propertyIDs == null) - throw new NullPointerException("propertyIDs"); - if (firstTabLabel == null) - throw new NullPointerException("firstTabLabel"); - - Vector v = new Vector(propertyIDs.length); - for(int i = 0; i < propertyIDs.length; ++i) { - if (propertyIDs[i] == null) - throw new NullPointerException("propertyIDs[" + i + "]"); - v.addElement(propertyIDs[i]); - } - - tabPropertyIDs_.put(FIRST_TAB_KEY_, v); - tabLabels_.put(FIRST_TAB_KEY_, firstTabLabel); - - editable_ = editable; - } - - - -/** -Adds a property to the first tab. The new property -is placed after all existing properties on the first -tab. - -@param propertyID The property ID to add to the first tab. -**/ - public void addProperty(Object propertyID) - { - if (propertyID == null) - throw new NullPointerException("propertyID"); - - synchronized(this) { - ((Vector)tabPropertyIDs_.get(FIRST_TAB_KEY_)).addElement(propertyID); - } - } - - - -/** -Adds a property to the specified tab. The new property -is placed after all existing properties on the tab. - -@param tab The tab. -
      -
    • 0 - indicates the first tab. -
    • A tab value returned by a previous call to addTab(). -
    -@param propertyID The property ID to add to the specified tab. -**/ - public void addProperty(int tab, Object propertyID) - { - if (propertyID == null) - throw new NullPointerException("propertyID"); - - synchronized(this) { - Object key = new Integer(tab); - if (!tabPropertyIDs_.containsKey(key)) - throw new ExtendedIllegalArgumentException("tab", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - ((Vector)tabPropertyIDs_.get(key)).addElement(propertyID); - } - } - - - -/** -Adds multiple properties to the first tab. The new properties -are placed after all existing properties on the first tab. - -@param propertyIDs The property IDs to add to the first tab. -**/ - public void addProperties(Object[] propertyIDs) - { - if (propertyIDs == null) - throw new NullPointerException("propertyIDs"); - - synchronized(this) { - Vector v = (Vector)tabPropertyIDs_.get(FIRST_TAB_KEY_); - for(int i = 0; i < propertyIDs.length; ++i) { - if (propertyIDs[i] == null) - throw new NullPointerException("propertyIDs[" + i + "]"); - v.addElement(propertyIDs[i]); - } - } - } - - - -/** -Adds multiple properties to the specified tab. The new properties -are placed after all existing properties on the tab. - -@param tab The tab. -
      -
    • 0 - indicates the first tab. -
    • A tab value returned by a previous call to addTab(). -
    -@param propertyIDs The property IDs to add to the specified tab. -**/ - public void addProperties(int tab, Object[] propertyIDs) - { - if (propertyIDs == null) - throw new NullPointerException("propertyIDs"); - - synchronized(this) { - Object key = new Integer(tab); - if (!tabPropertyIDs_.containsKey(key)) - throw new ExtendedIllegalArgumentException("tab", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - Vector v = (Vector)tabPropertyIDs_.get(key); - for(int i = 0; i < propertyIDs.length; ++i) { - if (propertyIDs[i] == null) - throw new NullPointerException("propertyIDs[" + i + "]"); - v.addElement(propertyIDs[i]); - } - } - } - - - - -/** -Adds a tab. The new tab is placed after all existing tabs. - -@param label The tab label. -@return The tab index. -**/ - public int addTab(String label) - { - if (label == null) - throw new NullPointerException("label"); - - synchronized(this) { - ++tabCounter_; - Object key = new Integer(tabCounter_); - tabPropertyIDs_.put(key, new Vector()); - tabLabels_.put(key, label); - return tabCounter_; - } - } - - - -/** -Adds a tab. The new tab is placed after all existing tabs. - -@param label The tab label. -@param propertyIDs The property IDs to add to the tab. -@return The tab index. -**/ - public int addTab(String label, Object[] propertyIDs) - { - if (label == null) - throw new NullPointerException("label"); - if (propertyIDs == null) - throw new NullPointerException("propertyIDs"); - - synchronized(this) { - Vector v = new Vector(propertyIDs.length); - for(int i = 0; i < propertyIDs.length; ++i) { - if (propertyIDs[i] == null) - throw new NullPointerException("propertyIDs[" + i + "]"); - v.addElement(propertyIDs[i]); - } - - ++tabCounter_; - Object key = new Integer(tabCounter_); - tabPropertyIDs_.put(key, v); - tabLabels_.put(key, label); - return tabCounter_; - } - } - - - -/** -Returns the label for the specified tab. - -@param tab The tab. -
      -
    • 0 - indicates the first tab. -
    • A tab value returned by a previous call to addTab(). -
    -@return The label for the specified tab. -**/ - public String getLabel(int tab) - { - synchronized(this) { - Object key = new Integer(tab); - if (!tabLabels_.containsKey(key)) - throw new ExtendedIllegalArgumentException("tab", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - else - return (String)tabLabels_.get(key); - } - } - - - -/** -Returns the property IDs that have been added to the specified tab. - -@param tab The tab. -
      -
    • 0 - indicates the first tab. -
    • A tab value returned by a previous call to addTab(). -
    -@return The property IDs that have been added to the specified tab. -**/ - public Object[] getProperties(int tab) - { - synchronized(this) { - Object key = new Integer(tab); - if (!tabPropertyIDs_.containsKey(key)) - throw new ExtendedIllegalArgumentException("tab", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); - else { - Vector asVector = (Vector)tabPropertyIDs_.get(key); - Object[] propertyIDs = new Object[asVector.size()]; - asVector.copyInto(propertyIDs); - return propertyIDs; - } - } - } - - - -/** -Returns the number of tabs. - -@return The number of tabs. -**/ - public int getTabCount() - { - return tabCounter_ + 1; - } - - - -/** -Indicates if the properties are editable. - -@return true if the properties should be editable, false otherwise. -**/ - public boolean isEditable() - { - return editable_; - } - - - -/** -Sets whether the properties are editable. Even when the properties -are set to editable, specific properties may remain not editable. This -is the case if it does not make sense to change a property. - -@param editable true if the properties should be editable, - false otherwise. The default is false. -**/ - public void setEditable(boolean editable) - { - editable_ = editable; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourcePropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/ResourcePropertiesPane.java deleted file mode 100644 index 7d8a2f8af..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ResourcePropertiesPane.java +++ /dev/null @@ -1,178 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourcePropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.resource.ChangeableResource; -import com.ibm.as400.resource.Presentation; -import com.ibm.as400.resource.Resource; -import com.ibm.as400.resource.ResourceException; -import com.ibm.as400.resource.ResourceMetaData; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Image; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.util.Enumeration; -import java.util.Hashtable; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.DefaultListCellRenderer; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JDialog; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - - -/** -The ResourcePropertiesPane class represents a dialog which -presents a set of properties for a resource. -**/ -class ResourcePropertiesPane -extends JDialog -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String DLG_APPLY_ = ResourceLoader.getText("DLG_APPLY"); - private static final String DLG_CANCEL_ = ResourceLoader.getText("DLG_CANCEL"); - private static final String DLG_OK_ = ResourceLoader.getText("DLG_OK"); - private static final String DLG_PROPERTIES_TITLE_ = ResourceLoader.getText("DLG_PROPERTIES_TITLE"); - - - - // Private data. - private JButton applyButton_; - private JButton cancelButton_; - private JButton okButton_; - - private ResourcePropertiesTabbedPane tabbedPane_; - - private ErrorEventSupport errorEventSupport_; - - - -/** -Constructs a ResourcePropertiesPane object. - -@param resource The resource. -@param properties The resource properties. -@param errorEventSupport The error event support. -**/ - public ResourcePropertiesPane(Resource resource, - ResourceProperties properties, - ErrorEventSupport errorEventSupport) - { - super(); - - errorEventSupport_ = errorEventSupport; - - // Set up the buttons. - okButton_ = new JButton(DLG_OK_); - cancelButton_ = new JButton(DLG_CANCEL_); - applyButton_ = new JButton(DLG_APPLY_); - applyButton_.setEnabled(false); - - ActionListener actionListener = new ActionListener_(); - okButton_.addActionListener(actionListener); - cancelButton_.addActionListener(actionListener); - applyButton_.addActionListener(actionListener); - - JPanel buttons = new JPanel(); - buttons.setLayout(new FlowLayout(FlowLayout.RIGHT)); - buttons.add(okButton_); - buttons.add(cancelButton_); - buttons.add(applyButton_); - - // Set up the tabbed pane. - tabbedPane_ = new ResourcePropertiesTabbedPane(resource, properties); - tabbedPane_.addErrorListener(errorEventSupport_); - tabbedPane_.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent event) { - applyButton_.setEnabled(true); - } - }); - - // Arrange everything on this dialog. - setTitle(ResourceLoader.substitute(DLG_PROPERTIES_TITLE_, resource.getPresentation().getName())); - setResizable(false); - getContentPane().setLayout(new BorderLayout()); - getContentPane().add("Center", tabbedPane_); - getContentPane().add("South", buttons); - pack(); - } - - - -/** -Applies any changes made by the user. -**/ - public void applyChanges() - { - tabbedPane_.applyChanges(); - applyButton_.setEnabled(false); - } - - - -/** -The ActionListener_ class provides the behavior of the Ok, Cancel, -and Apply buttons. -**/ - private class ActionListener_ implements ActionListener - { - public void actionPerformed(ActionEvent event) - { - Object source = event.getSource(); - - if (source == okButton_) { - applyChanges(); - dispose(); - } - - else if (source == cancelButton_) - dispose(); - - else if (source == applyButton_) { - applyChanges(); - } - } - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/ResourcePropertiesTabbedPane.java b/cvsroot/src/com/ibm/as400/vaccess/ResourcePropertiesTabbedPane.java deleted file mode 100644 index b35e9b93c..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ResourcePropertiesTabbedPane.java +++ /dev/null @@ -1,555 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ResourcePropertiesTabbedPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.resource.ChangeableResource; -import com.ibm.as400.resource.Presentation; -import com.ibm.as400.resource.Resource; -import com.ibm.as400.resource.ResourceException; -import com.ibm.as400.resource.ResourceMetaData; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Image; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.ComboBoxEditor; -import javax.swing.DefaultListCellRenderer; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ChangeListener; - - -class ResourcePropertiesTabbedPane -extends JComponent -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private Hashtable changes_ = new Hashtable(); - private ResourceMetaData[] attributeMetaData_; - private Presentation presentation_; - private ResourceProperties properties_; - private Resource resource_; - - private ChangeEventSupport changeEventSupport_ = new ChangeEventSupport (this); - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - - - - public ResourcePropertiesTabbedPane(Resource resource, - ResourceProperties properties) - { - super(); - - resource_ = resource; - properties_ = (properties != null) ? properties : new ResourceProperties(); - attributeMetaData_ = resource.getAttributeMetaData(); - presentation_ = resource.getPresentation(); - - // Set up the tabbed pane. - JTabbedPane tabbedPane = new JTabbedPane(); - - // Set up the tabs. - int tabCount = properties_.getTabCount(); - for(int i = 0; i < tabCount; ++i) - tabbedPane.addTab(properties_.getLabel(i), createTabComponent(i)); - - // Arrange everything on this component. - setLayout(new BorderLayout()); - add("Center", tabbedPane); - } - - - - public void addChangeListener (ChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - changeEventSupport_.addChangeListener (listener); - } - - - - public void addErrorListener (ErrorListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - errorEventSupport_.addErrorListener (listener); - } - - -/** -Applies any changes made by the user. -**/ - public void applyChanges() - { - synchronized(changes_) { - - try { - // Make the changes. - if (resource_ instanceof ChangeableResource) { - Enumeration attributeIDs = changes_.keys(); - while(attributeIDs.hasMoreElements()) { - Object attributeID = attributeIDs.nextElement(); - Object value = changes_.get(attributeID); - if ((resource_.getAttributeMetaData(attributeID).getType() == Integer.class) // @A1A - && (value instanceof String)) // @A1A - value = new Integer((String)value); // @A1A - ((ChangeableResource)resource_).setAttributeValue(attributeID, value); - } - ((ChangeableResource)resource_).commitAttributeChanges(); - } - } - catch(Exception e) { // @A1C - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error applying changes", e); - errorEventSupport_.fireError(e); - } - - // Clear out the list of changes. - changes_.clear(); - } - } - - - -/** -Creates a component for a single attribute. - -@param amd The attribute meta data. -@return The component. - -@exception ResourceException If an error occurs. -**/ - private Component createAttributeComponent(ResourceMetaData attributeMetaData) - throws ResourceException - { - // Get the initial value. - Object attributeID = attributeMetaData.getID(); - Object initialValue = resource_.getAttributeValue(attributeID); - - // Determine if the component should be editable. - boolean editable = properties_.isEditable() && !attributeMetaData.isReadOnly(); - - // Create the component. Decide the type of component based - // on the type of value, etc. - Component component = null; - Class type = attributeMetaData.getType(); - Object[] possibleValues = attributeMetaData.getPossibleValues(); - - // If the type is Boolean, use a JCheckBox. - if (type == Boolean.class) { - JCheckBox checkBox = new JCheckBox("", ((Boolean)initialValue).booleanValue()); - checkBox.setEnabled(editable); - checkBox.addActionListener(new ChangeListener_(attributeID)); - component = checkBox; - } - - // If the type is an array, use a list. - else if (type.isArray()) { - Object[] initialValues = (Object[])initialValue; - JList list = new JList(initialValues); - list.setEnabled(false); // For now! - list.setVisibleRowCount(Math.min(5, initialValues.length)); - component = list; - } - - // If there are any possible values AND the value is - // editable, use a JComboBox. If its not editable, - // use a JLabel. - else if (possibleValues != null) { - if (possibleValues.length > 0) { - if (editable) { - JComboBox comboBox = new JComboBox(); - for(int i = 0; i < possibleValues.length; ++i) - comboBox.addItem(possibleValues[i]); - comboBox.setRenderer(new JComboBoxRenderer(attributeMetaData)); - comboBox.setEditor(new JComboBoxEditor(attributeMetaData)); // @A1A - comboBox.setEditable(!attributeMetaData.isValueLimited()); - comboBox.setSelectedItem(initialValue); // @A1C - ChangeListener_ changeListener = new ChangeListener_(attributeID); - comboBox.addItemListener(changeListener); - comboBox.getEditor().getEditorComponent().addKeyListener(changeListener); - component = comboBox; - } - else - component = new JLabel(attributeMetaData.getPossibleValuePresentation(initialValue).getFullName()); - } - } - - // Anything else, use a JTextField (editable), JTextArea (non-editable, multiline), - // or JLabel (non-editable, single line). - if (component == null) { - if (editable) { - JTextField textField = new JTextField(initialValue.toString()); - int initialValueLength = initialValue.toString().length(); - textField.setColumns(Math.max(10, Math.min(30, initialValueLength))); - textField.addKeyListener(new ChangeListener_(attributeID)); - component = textField; - } - else { - String text = initialValue.toString(); - if (text.length() > 30) { - component = new JTextArea(VUtilities.formatHelp2(text, 40)); - ((JTextArea)component).setEditable(false); - component.setBackground(null); // Set to gray. - } - else - component = new JLabel(initialValue.toString()); - } - } - - return component; - } - - - -/** -Creates a Box for presenting a list of attributes. - -@param attributeIDs The attribute IDs. -@param firstIndex The index (within attributeIDs) to start with. -@param numberOfAttributes The number of attributes to include. -**/ - private Component createAttributeBox(Object[] attributeIDs, int firstIndex, int numberOfAttributes) - { - // Initialize the layouts. - JPanel attributePanel = new JPanel(); - GridBagLayout layout = new GridBagLayout(); - attributePanel.setLayout(layout); - GridBagConstraints constraints = new GridBagConstraints(); - constraints.anchor = GridBagConstraints.NORTHWEST; // @A1C - constraints.weightx = 1; - constraints.insets = new Insets(2, 2, 2, 2); - - // Add the components. - int row = 0; - for(int i = firstIndex; i < numberOfAttributes; ++i) { - - // Find the meta data for the attribute ID. - ResourceMetaData attributeMetaData = resource_.getAttributeMetaData(attributeIDs[i]); - - // If the meta data was found, then do the right thing. - if (attributeMetaData != null) { - Presentation presentation2 = attributeMetaData.getPresentation(); - String componentLabel = null; - if (presentation2 != null) - componentLabel = presentation2.getFullName(); - else - componentLabel = attributeMetaData.getID().toString(); - - // Make the left component. - Component leftComponent = new JLabel(componentLabel + ':'); - attributePanel.add(leftComponent); - constraints.gridx = 0; - constraints.gridy = row; - layout.setConstraints(leftComponent, constraints); - - // Make the right component. - try { - Component rightComponent = createAttributeComponent(attributeMetaData); - attributePanel.add(rightComponent); - constraints.gridx = 1; - constraints.gridy = row; - layout.setConstraints(rightComponent, constraints); - } - catch(ResourceException e) { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error creating attribute component for:" + attributeIDs[i], e); - errorEventSupport_.fireError(e); - } - - } - - // If it was not found, then add a placeholder. - else { - Component leftComponent = new JLabel(attributeIDs[i].toString() + ':'); - attributePanel.add(leftComponent); - constraints.gridx = 0; - constraints.gridy = row; - layout.setConstraints(leftComponent, constraints); - } - - ++row; - } - - // Align so that extra space appears at the bottom. - JPanel spacer = new JPanel(); - attributePanel.add(spacer); - constraints.gridx = 0; - constraints.gridy = row; - constraints.gridwidth = 2; - constraints.weighty = 1; - layout.setConstraints(spacer, constraints); - - Box attributeBox = new Box(BoxLayout.Y_AXIS); - attributeBox.add(attributePanel); - attributeBox.add(Box.createVerticalGlue()); - return attributeBox; - } - - - -/** -Creates a component for a specific tab. - -@param tab The tab. -@return The component. -**/ - private Component createTabComponent(int tab) - { - // Initialize the overall box. We need to stick it in - // a JPanel just so we can add a border. - Box overallBox = new Box(BoxLayout.Y_AXIS); - JPanel panel = new JPanel(); - panel.setLayout(new BorderLayout()); - panel.add("Center", overallBox); - panel.setBorder(new EmptyBorder(10, 10, 10, 10)); - - // Add the default components if this is the first tab. - if (tab == 0) { - - // Create the label in a box so it won't always be centered. - JLabel label = new JLabel(presentation_.getFullName(), - new ImageIcon((Image)presentation_.getValue(Presentation.ICON_COLOR_32x32)), - SwingConstants.LEFT); - Box labelBox = new Box(BoxLayout.X_AXIS); - labelBox.add(label); - labelBox.add(Box.createHorizontalGlue()); - overallBox.add(labelBox); - - // Add a separator and some space. - JSeparator separator = new JSeparator(); - separator.setMaximumSize(new Dimension(separator.getMaximumSize().width, separator.getPreferredSize().height)); - overallBox.add(Box.createRigidArea(new Dimension(0, 6))); - overallBox.add(separator); - overallBox.add(Box.createRigidArea(new Dimension(0, 6))); - } - - // Add any other components. - Object[] attributeIDs = properties_.getProperties(tab); - overallBox.add(createAttributeBox(attributeIDs, 0, attributeIDs.length)); - - // Make excess space appear at the bottom. - overallBox.add(Box.createVerticalGlue()); - - return panel; - } - - - -/** -The ChangeListener class listens for changes to any of the editable components -in the properties pane. It enables the Apply button and records any changes. -**/ - private class ChangeListener_ extends KeyAdapter implements ActionListener, ItemListener - { - private Object attributeID_; - - public ChangeListener_(Object attributeID) - { - attributeID_ = attributeID; - } - - public void actionPerformed(ActionEvent event) - { - registerChange(new Boolean(((JCheckBox)event.getSource()).isSelected())); - } - - public void itemStateChanged(ItemEvent event) - { - registerChange(event.getItem()); - } - - public void keyReleased(KeyEvent event) // @A1C - { - registerChange(((JTextField)event.getSource()).getText()); - } - - private void registerChange(Object value) - { - synchronized(changes_) { - changes_.put(attributeID_, value); - } - changeEventSupport_.fireStateChanged(); - } - } - - - -// @A1A -/** -The JComboBoxEditor class renders possible values by using their -presentation full names. -**/ - private class JComboBoxEditor implements ComboBoxEditor - { - private ResourceMetaData metaData_; - private JTextField editorComponent_ = new JTextField(); - - public JComboBoxEditor(ResourceMetaData metaData) - { - metaData_ = metaData; - } - - public void addActionListener(ActionListener listener) - { - editorComponent_.addActionListener(listener); - } - - public Component getEditorComponent() - { - return editorComponent_; - } - - public Object getItem() - { - Object item = editorComponent_.getText(); - Object[] possibleValues = metaData_.getPossibleValues(); - if (possibleValues != null) { - for(int i = 0; i < possibleValues.length; ++i) { - if (metaData_.getPossibleValuePresentation(possibleValues[i]).getFullName().equals(item)) - item = possibleValues[i]; - } - } - return item; - } - - public void removeActionListener(ActionListener listener) - { - editorComponent_.removeActionListener(listener); - } - - public void selectAll() - { - editorComponent_.selectAll(); - } - - public void setItem(Object item) - { - Object fullName = item; - if (item != null) { - Presentation presentation = metaData_.getPossibleValuePresentation(item); - if (presentation != null) - fullName = presentation.getFullName(); - } - editorComponent_.setText((fullName == null ? "" : fullName.toString())); - } - } - - - -/** -The JComboBoxRenderer class renders possible values by using their -presentation full names. -**/ - private class JComboBoxRenderer extends DefaultListCellRenderer - { - private ResourceMetaData metaData_; - - public JComboBoxRenderer(ResourceMetaData metaData) - { - metaData_ = metaData; - } - - public Component getListCellRendererComponent(JList list, - Object value, - int index, - boolean isSelected, - boolean cellHasFocus) - { - Object fullName = value; - if (value != null) - fullName = metaData_.getPossibleValuePresentation(value).getFullName(); - return super.getListCellRendererComponent(list, - fullName, - index, - isSelected, - cellHasFocus); - } - } - - - - /** - * Removes a change listener. - * - * @param listener The listener. - **/ - public void removeChangeListener (ChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - changeEventSupport_.removeChangeListener (listener); - } - - /** - * Removes a listener to be notified when an error occurs. - * - * @param listener The listener. - **/ - public void removeErrorListener (ErrorListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - errorEventSupport_.removeErrorListener (listener); - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLConnection.java b/cvsroot/src/com/ibm/as400/vaccess/SQLConnection.java deleted file mode 100644 index 1f939f5ab..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLConnection.java +++ /dev/null @@ -1,551 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLConnection.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.IOException; -import java.io.Serializable; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.DatabaseMetaData; -import java.sql.SQLException; -import java.util.Properties; -import java.util.Enumeration; - - -/** -SQLConnection objects represent a SQL Connection. A SQLConnection -object encapsulates the properties needed to make a -JDBC Connection into a Java Bean. A connection can only be made -once. Once a connection is closed, it cannot be opened again. - -

    The actual connection is made when getConnection() is -called. - -

    Users should call close() when the connection is no -longer needed. - -

    Properties cannot be changed once a connection is made. - -

    Note that the password is not serialized if it is provided -by the password parameter on the constructor or setPassword(), -or if it is provided using the 'password' property in the -constructor 'properties' parameter or using setProperties(). -If the password is supplied via the URL or other property, it -will be serialized. - -

    SQLConnection objects generate the following events: -

      -
    • PropertyChangeEvent -
    • WorkingEvent -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class SQLConnection -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// Properties. -transient private String password_ = null; -transient private String uid_ = null; // altered after connection -private String uid2_ = null; // original -private Properties properties_ = null; // excluding password -transient private Properties properties2_ = null; // including password -transient private String url_ = null; // altered after connection -private String url2_ = null; // original - -// SQL connection -transient private Connection connection_ = null; - -// Event support. -transient private PropertyChangeSupport changeListeners_ - = new PropertyChangeSupport (this); -transient private VetoableChangeSupport vetoListeners_ - = new VetoableChangeSupport (this); -transient private WorkingEventSupport workingListeners_ - = new WorkingEventSupport (this); - - -/** -Creates a SQLConnection object. -**/ -public SQLConnection() -{ -} - - - -/** -Creates a SQLConnection object. - -@param URL The URL used to connect to the database. -**/ -public SQLConnection(String URL) -{ - if (URL == null) - throw new NullPointerException("URL"); - url2_ = URL; - url_ = url2_; -} - - - -/** -Creates a SQLConnection object. - -@param URL The URL used to connect to the database. -@param userName The user name used to connect to the database. -**/ -public SQLConnection(String URL, - String userName) -{ - if (URL == null) - throw new NullPointerException("URL"); - url2_ = URL; - url_ = url2_; - if (userName == null) - throw new NullPointerException("userName"); - uid2_ = userName; - uid_ = uid2_; -} - - - -/** -Creates a SQLConnection object. - -@param URL The URL used to connect to the database. -@param userName The user name used to connect to the database. -@param password The password used to connect to the database. -**/ -public SQLConnection(String URL, - String userName, - String password) -{ - if (URL == null) - throw new NullPointerException("URL"); - url2_ = URL; - url_ = url2_; - if (userName == null) - throw new NullPointerException("userName"); - uid2_ = userName; - uid_ = uid2_; - if (password == null) - throw new NullPointerException("password"); - password_ = password; -} - - - -/** -Creates a SQLConnection object. - -@param URL The URL used to connect to the database. -@param properties The properties used to connect to the database. -**/ -public SQLConnection(String URL, - Properties properties) -{ - if (URL == null) - throw new NullPointerException("URL"); - url2_ = URL; - url_ = url2_; - if (properties == null) - throw new NullPointerException("properties"); - properties2_ = properties; - properties_ = new Properties(); - for (Enumeration e = properties2_.propertyNames(); e.hasMoreElements();) - { - String prop = (String)e.nextElement(); - properties_.put(prop, properties2_.getProperty(prop)); - } - properties_.remove("password"); -} - - - -/** -Adds a listener to be notified when the value of any bound -property is changed. -The listener's propertyChange() method will be called. - -@param listener The listener. -**/ -public void addPropertyChangeListener (PropertyChangeListener listener) -{ - changeListeners_.addPropertyChangeListener (listener); -} - - - -/** -Adds a listener to be notified when the value of any constrained -property is changed. -The listener's vetoableChange() method will be called. - -@param listener The listener. -**/ -public void addVetoableChangeListener (VetoableChangeListener listener) -{ - vetoListeners_.addVetoableChangeListener (listener); -} - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ -public void addWorkingListener (WorkingListener listener) -{ - workingListeners_.addWorkingListener (listener); -} - - -/** -Closes the SQL connection, if it is open. -Once a connection is closed, it cannot be opened again. -@exception SQLException If there is an error closing the connection. -**/ -public void close() -throws SQLException -{ - if (connection_ != null) - { - connection_.close(); - } -} - - -/** -Returns a JDBC connection. If a successful connection has not yet -been made, a new connection will be made. Subsequent -invocations will reuse the connection. It is up to the -user to close the connection, or allow garbage collection -to do so. -@return The connection. -@exception SQLException If there is an error connecting to -the database. -**/ -public Connection getConnection() -throws SQLException -{ - if (connection_ == null) - { - if (url2_ == null) - throw new IllegalStateException("URL"); - - workingListeners_.fireStartWorking (); - - // Get connection. - try - { - if (uid2_ != null) - { - Trace.log(Trace.INFORMATION, "Getting SQL Connection with uid, pwd."); - connection_ = DriverManager.getConnection(url2_, uid2_, password_); - } - else if (properties2_ != null) - { - Trace.log(Trace.INFORMATION, "Getting SQL Connection with properties."); - connection_ = DriverManager.getConnection(url2_, properties2_); - } - else - { - Trace.log(Trace.INFORMATION, "Getting SQL Connection with url only."); - connection_ = DriverManager.getConnection(url2_); - } - Trace.log(Trace.INFORMATION, "Got SQL Connection."); - } - catch (SQLException e) - { - workingListeners_.fireStopWorking (); - Trace.log(Trace.ERROR, "Error getting SQL Connection: " + e.getMessage()); - throw e; - } - - // Get userid and URL. - // Erase values in case of errors. - uid_ = null; - url_ = null; - try - { - DatabaseMetaData meta = connection_.getMetaData(); - uid_ = meta.getUserName(); - url_ = meta.getURL(); - } - catch (SQLException e) - { - // log error, but continue - Trace.log(Trace.WARNING, "Error getting SQL meta data: " + e.getMessage()); - } - - workingListeners_.fireStopWorking (); - } - - return connection_; -} - - -/** -Returns the properties for this connection. -This method will return the properties as set by the -constructor or the last setProperties() call, minus -the 'password' property, if included. -@return The properties for this connection. -**/ -public Properties getProperties() -{ - return properties_; -} - - -/** -Returns the URL for this connection. -If a connection has not yet been made, this method will -return the URL supplied on the constructor or the -last setURL() call. If a connection has been -made, the URL will be the URL for the connection. -@return The URL for this connection. -**/ -public String getURL() -{ - if (url_ == null) - return ""; - return url_; -} - - -/** -Returns the user name for this connection. -If a connection has not yet been made, this method will -return the user name supplied on the constructor or the -last setUserName() call. If a connection has been -made, the user name will be the user name being used for -the connection. -@return The user name for this connection. -**/ -public String getUserName() -{ - if (uid_ == null) - return ""; - return uid_; -} - - -/** -Restore the state of this object from an object input stream. -It is used when deserializing an object. -@param in The input stream of the object being deserialized. -@exception IOException -@exception ClassNotFoundException -**/ -private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException -{ - // Restore the non-static and non-transient fields. - in.defaultReadObject(); - // Initialize the transient fields. - changeListeners_ = new PropertyChangeSupport(this); - vetoListeners_ = new VetoableChangeSupport(this); - workingListeners_ = new WorkingEventSupport(this); - password_ = null; - connection_ = null; - url_ = url2_; - uid_ = uid2_; - properties2_ = properties_; -} - - -/** -Removes a listener from being notified when the value of any bound -property is changed. - -@param listener The listener. -**/ -public void removePropertyChangeListener (PropertyChangeListener listener) -{ - changeListeners_.removePropertyChangeListener (listener); -} - - - -/** -Removes a listener from being notified when the value of any constrained -property is changed. - -@param listener The listener. -**/ -public void removeVetoableChangeListener (VetoableChangeListener listener) -{ - vetoListeners_.removeVetoableChangeListener (listener); -} - - - -/** -Removes a listener from being notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ -public void removeWorkingListener (WorkingListener listener) -{ - workingListeners_.removeWorkingListener (listener); -} - - -/** -Sets the password used to connect to the database. -This property cannot be changed after a connection is made -by calling getConnection(). -This property is bound and constrained. The events will -always have null and an empty string for the old and -new value, respectively. - -@param password The password used to connect to the database. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setPassword(String password) - throws PropertyVetoException -{ - if (connection_ != null) - throw new IllegalStateException(); - if (password == null) - throw new NullPointerException("password"); - - // If values are the same, don't bother. - if (password_ != null && password_.equals(password)) - return; - - // Fire a vetoable change event. - vetoListeners_.fireVetoableChange("password", null, ""); - - // Make property change. - password_ = password; - - // Fire the property change event. - changeListeners_.firePropertyChange("password", null, ""); -} - - -/** -Sets the properties used to connect to the database. -This property cannot be changed after a connection is made -by calling getConnection(). -This property is bound and constrained. - -@param properties The properties used to connect to the database. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setProperties(Properties properties) - throws PropertyVetoException -{ - if (connection_ != null) - throw new IllegalStateException(); - if (properties == null) - throw new NullPointerException("properties"); - - Properties temp = new Properties(); - for (Enumeration e = properties.propertyNames(); e.hasMoreElements();) - { - String prop = (String)e.nextElement(); - temp.put(prop, properties.getProperty(prop)); - } - temp.remove("password"); - - // Fire a vetoable change event. - vetoListeners_.fireVetoableChange("properties", properties_, temp); - - // Make property change. - Properties old = properties_; - properties2_ = properties; - properties_ = temp; - - // Fire the property change event. - changeListeners_.firePropertyChange("properties", old, properties_); -} - - -/** -Sets the URL used to connect to the database. -This property cannot be changed after a connection is made -by calling getConnection(). -This property is bound and constrained. - -@param URL The URL used to connect to the database. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setURL(String URL) - throws PropertyVetoException -{ - if (connection_ != null) - throw new IllegalStateException(); - if (URL == null) - throw new NullPointerException("URL"); - - String old = getURL(); - - // Fire a vetoable change event. - vetoListeners_.fireVetoableChange("URL", old, URL); - - // Make property change. - url2_ = URL; - url_ = url2_; - - // Fire the property change event. - changeListeners_.firePropertyChange("URL", old, url_); -} - - -/** -Sets the user name used to connect to the database. -This property cannot be changed after a connection is made -by calling getConnection(). -This property is bound and constrained. - -@param userName The user name used to connect to the database. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setUserName(String userName) - throws PropertyVetoException -{ - if (connection_ != null) - throw new IllegalStateException(); - if (userName == null) - throw new NullPointerException("userName"); - - String old = getUserName(); - - // Fire a vetoable change event. - vetoListeners_.fireVetoableChange("userName", old, userName); - - // Make property change. - uid2_ = userName; - uid_ = uid2_; - - // Fire the property change event. - changeListeners_.firePropertyChange("userName", old, uid_); -} - - - - -} // end of class SQLConnection diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLConnection16.gif b/cvsroot/src/com/ibm/as400/vaccess/SQLConnection16.gif deleted file mode 100644 index 233d66d7b..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SQLConnection16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLConnection32.gif b/cvsroot/src/com/ibm/as400/vaccess/SQLConnection32.gif deleted file mode 100644 index bf8c898f3..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SQLConnection32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLConnectionBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/SQLConnectionBeanInfo.java deleted file mode 100644 index d411aca82..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLConnectionBeanInfo.java +++ /dev/null @@ -1,181 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLConnectionBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - -/** -The SQLConnectionBeanInfo class provides bean -information for the SQLConnection class. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class SQLConnectionBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = SQLConnection.class; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - // ***** EVENTS - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_VETO")); - - String[] workingMethods = {"startWorking", "stopWorking"}; - EventSetDescriptor working = new EventSetDescriptor(beanClass, - "working", - com.ibm.as400.vaccess.WorkingListener.class, - workingMethods, - "addWorkingListener", - "removeWorkingListener"); - working.setDisplayName(ResourceLoader.getText("EVT_NAME_WORKING")); - working.setShortDescription(ResourceLoader.getText("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[]{changed, veto, working}; - - - // ***** PROPERTIES - PropertyDescriptor URL = new PropertyDescriptor("URL", beanClass); - URL.setBound(true); - URL.setConstrained(true); - URL.setDisplayName(ResourceLoader.getText("PROP_NAME_URL")); - URL.setShortDescription(ResourceLoader.getText("PROP_DESC_URL")); - - PropertyDescriptor userID = new PropertyDescriptor("userName", beanClass); - userID.setBound(true); - userID.setConstrained(true); - userID.setDisplayName(ResourceLoader.getText("PROP_NAME_USER_NAME")); - userID.setShortDescription(ResourceLoader.getText("PROP_DESC_USER_NAME")); - - PropertyDescriptor password = new PropertyDescriptor("password", beanClass, null, "setPassword"); - password.setBound(true); - password.setConstrained(true); - password.setDisplayName(ResourceLoader.getText("PROP_NAME_PASSWORD")); - password.setShortDescription(ResourceLoader.getText("PROP_DESC_PASSWORD")); - - PropertyDescriptor properties = new PropertyDescriptor("properties", beanClass); - properties.setBound(true); - properties.setConstrained(true); - properties.setDisplayName(ResourceLoader.getText("PROP_NAME_PROPERTIES")); - properties.setShortDescription(ResourceLoader.getText("PROP_DESC_PROPERTIES")); - - properties_ = new PropertyDescriptor[]{URL, userID, password, properties}; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the error event - return 0; - } - - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the "URL" property - return 0; - } - - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("SQLConnection16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("SQLConnection32.gif"); - break; - } - - return image; - } - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLMetaDataTableModel.java b/cvsroot/src/com/ibm/as400/vaccess/SQLMetaDataTableModel.java deleted file mode 100644 index daf2236e5..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLMetaDataTableModel.java +++ /dev/null @@ -1,522 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLMetaDataTableModel.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import javax.swing.table.AbstractTableModel; -import javax.swing.event.TableModelEvent; -import java.io.IOException; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Types; - - - -/** -The SQLMetaDataTableModel class represents the meta data -about the columns of a set of database files. This model -is used to create a SQLMetaDataTablePane. -The rows of this table are the fields of the database files, -and the columns are the field attributes (field name, length, etc). -Rows can be removed from the table so the table only shows a subset -of the available database fields. -This class is used by SQLQueryBuilderPane and its coworkers. - -

    The data in the model is retrieved from the system only -when load() is called. - -

    SQLMetaDataTableModel objects generate the following events: -

      -
    • ErrorEvent -
    • TableModelEvent -
    • WorkingEvent -
    -**/ -class SQLMetaDataTableModel -extends AbstractTableModel -implements Cloneable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// Note that none of the JDBC resources are ever explicitly closed, -// but rather garbage collection is relied upon to close them. - -// This class is not meant to be serialized, it should be transient. -// This class has items marked transient even though it is not -// serializable because otherwise errors were received when -// serializing objects that contained this class (even though they -// were transient instances. readObject() was added to be safe. - -// Number of columns in model. -static private int NUM_COLUMNS_ = 6; - -// The columns of the table contains these meta data. -public static int FIELD_NAME_ = 0; -public static int FIELD_TYPE_ = 1; -public static int FIELD_LENGTH_ = 2; -public static int FIELD_DECIMALS_ = 3; -public static int FIELD_NULLS_ = 4; -public static int FIELD_DESC_ = 5; - -// What this table represents -transient private Connection connection_ = null; -private String[] tables_ = null; // The DB tables for which this model contains data. - -// The table data -transient private String[][] data_ = new String[0][NUM_COLUMNS_]; // table data -transient private int[] types_ = new int[0]; // sql types -// Row information -transient private int numRows_ = 0; // Number of rows in the table. - -// Flag for if an error event was sent. -transient private boolean error_; - -// Event support. -transient private ErrorEventSupport errorListeners_ - = new ErrorEventSupport (this); -transient private WorkingEventSupport workingListeners_ - = new WorkingEventSupport (this); - - - -/** -Constructs a SQLMetaDataTableModel object. The query is not done -until load is done. - -@param connection The SQL connection. -@param tables The database files to retrieve info about. - Tables should be in the form of .. -**/ -public SQLMetaDataTableModel (Connection connection, - String[] tables) -{ - super(); - connection_ = connection; - tables_ = tables; -} - - -/** -Adds a listener to be notified when an error occurs. -The listener's errorOccurred method will be called. - -@param listener The listener. -**/ -public void addErrorListener (ErrorListener listener) -{ - errorListeners_.addErrorListener (listener); -} - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ -public void addWorkingListener (WorkingListener listener) -{ - workingListeners_.addWorkingListener (listener); -} - - - -/** -Makes a clone (copy) of this table. No data (references) is shared -between this original and the new object. Listeners are not copied -to the new object. -**/ -synchronized public Object clone () -{ - // create new object - SQLMetaDataTableModel clone = - new SQLMetaDataTableModel(connection_, tables_); - // copy table data - clone.data_ = new String[data_.length][NUM_COLUMNS_]; - System.arraycopy(data_, 0, clone.data_, 0 , data_.length); - clone.numRows_ = numRows_; - clone.types_ = new int[types_.length]; - System.arraycopy(types_, 0, clone.types_, 0 , types_.length); - - return clone; -} - - -/** -Returns the number of columns in the table. - -@return The number of columns in the table. -**/ -public int getColumnCount() -{ - return NUM_COLUMNS_; -} - - -/** -Returns the number of rows in the table. - -@return The number of rows in the result set. -**/ -synchronized public int getRowCount() -{ - return numRows_; -} - - -/** -Return the SQL type of the field. Note this is not the same as -the data in FIELD_TYPE_, which is the database-dependent type name. -@see java.sql.Types - -@param index The row for which to get the type. -@return The SQL type of the field. -**/ -synchronized int getSQLType(int index) -{ - return types_[index]; -} - - -/** -Returns the database file names this table contains data for. - -@return The database file names this table contains data for. -**/ -public String[] getTables () -{ - return tables_; -} - - -/** -Returns the value at the specifed column and row. - -@param rowIndex The row index. Indices start at 0. -@param columnIndex The column index. Indices start at 0. - -@return The value at the specified column and row. -**/ -synchronized public Object getValueAt (int rowIndex, - int columnIndex) -{ - error_ = false; - - // return the value - return data_[rowIndex][columnIndex]; -} - - - - -/** -Loads the table based on the state of the system. -**/ -public void load () -{ - synchronized (this) - { - // Set back fields in case there is an error. - data_ = new String[0][0]; - types_ = new int[0]; - numRows_ = 0; - } - // notify listeners that we've changed number of rows. - TableModelEvent event = new TableModelEvent(this, -1); - fireTableChanged(event); - Trace.log(Trace.DIAGNOSTIC, "Starting load, changed number of rows to:", numRows_); - - if (tables_ == null || tables_.length == 0 || - connection_ == null) - { - //If no tables, the panel will be disabled, don't throw - //error, just leave table empty. - return; - } - - synchronized (this) - { - workingListeners_.fireStartWorking (); - - // Number of rows we create our table with and number of - // rows we bump our capacity by each time we run out of room. - int ROW_INCREMENT = 50; - - ResultSet resultSet = null; - try - { - // Get database meta data - DatabaseMetaData metaData = connection_.getMetaData(); - - // Create new array to hold table values. - data_ = new String[ROW_INCREMENT][NUM_COLUMNS_]; - types_ = new int[ROW_INCREMENT]; - - // Loop through each database file. - String library, table, tprefix; - int sepIndex; - int curRow; - for (int i=0; i 1) - tprefix = table + "."; // need to qualify field names - else - tprefix = ""; // only 1 table, can just use field names - resultSet = metaData.getColumns(null, library, table, null); - - // Loop through fields for this database file. - while (resultSet.next()) - { - curRow = numRows_; // current row in table - - // make sure we have room in table for this row. - if (curRow >= data_.length) // @D1C - { - String[][] newData = - new String[data_.length + ROW_INCREMENT][NUM_COLUMNS_]; - System.arraycopy(data_, 0, newData, 0, data_.length); - data_ = newData; - int[] newTypes = - new int[types_.length + ROW_INCREMENT]; - System.arraycopy(types_, 0, newTypes, 0, types_.length); - types_ = newTypes; - } - - // Store SQL type for use by getSQLType, - // although this is not externalized in the table. - types_[curRow] = resultSet.getInt(5); - - // Add field info to table - data_[curRow][FIELD_NAME_] = tprefix + resultSet.getString(4).trim(); - data_[curRow][FIELD_TYPE_] = resultSet.getString(6); - // The following code should not be necessary when using - // most drivers, but makes the length values correct - // when using the i5/OS JDBC driver. - // These values came from the ODBC description of precision - // (in 2.0 ref, Appendix D page 624). - switch (types_[curRow]) - { - case Types.SMALLINT: - data_[curRow][FIELD_LENGTH_] = "5"; - break; - case Types.INTEGER: - data_[curRow][FIELD_LENGTH_] = "10"; - break; - case Types.TIME: - data_[curRow][FIELD_LENGTH_] = "8"; - break; - case Types.TIMESTAMP: - // We always give length = 23, even though - // we should give 19 if there is no decimals. - // In order to not mess up 'correct' values, - // only change it if we know the value is bad. - if (resultSet.getInt(7) == 10) - data_[curRow][FIELD_LENGTH_] = "23"; - break; - case Types.DATE: - data_[curRow][FIELD_LENGTH_] = "10"; - break; - case Types.DOUBLE: - if (resultSet.getInt(7) == 4) - // single precision (type REAL) - data_[curRow][FIELD_LENGTH_] = "7"; - else - // double precison (type FLOAT) - data_[curRow][FIELD_LENGTH_] = "15"; - break; - default: - // Other types are correct. - data_[curRow][FIELD_LENGTH_] = resultSet.getString(7); - } - data_[curRow][FIELD_DECIMALS_] = resultSet.getString(9); - data_[curRow][FIELD_NULLS_] = resultSet.getString(18); - data_[curRow][FIELD_DESC_] = resultSet.getString(12); - - numRows_++; - } - } - } - } - catch (SQLException e) - { - // In case of error, set fields to init state - data_ = new String[0][0]; - types_ = new int[0]; - numRows_ = 0; - errorListeners_.fireError(e); - error_ = true; - } - finally - { - if (resultSet != null) - { - try - { - resultSet.close(); - } - catch(SQLException e) - { - errorListeners_.fireError(e); - } - } - } - } // end of synchronized block - - // notify listeners that we've changed - event = new TableModelEvent(this, -1); - fireTableChanged(event); - Trace.log(Trace.DIAGNOSTIC, "Did load, changed number of rows to:", numRows_); - - workingListeners_.fireStopWorking (); -} - - -/** -Restores the state of this object from an object input stream. -It is used when deserializing an object. -@param in The input stream of the object being deserialized. -@exception IOException -@exception ClassNotFoundException -**/ -private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException -{ - // Restore the non-static and non-transient fields. - in.defaultReadObject(); - // Initialize the transient fields. - connection_ = null; - data_ = new String[0][NUM_COLUMNS_]; - types_ = new int[0]; - numRows_ = 0; - errorListeners_ = new ErrorEventSupport (this); - workingListeners_ = new WorkingEventSupport (this); -} - - -/** -Removes a row from the table. - -@param rowIndex The row index. Indices start at 0. -**/ -public void removeRow (int rowIndex) -{ - synchronized (this) - { - Trace.log(Trace.DIAGNOSTIC, "Removing row ", rowIndex); - - // array to hold new data - String[][] newData = new String[data_.length -1][NUM_COLUMNS_]; - int[] newTypes = new int[types_.length -1]; - - // copy table data to new table less row being removed - if (rowIndex == 0) - { - // remove first row - System.arraycopy(data_, 1, newData, 0, newData.length); - System.arraycopy(types_, 1, newTypes, 0, newTypes.length); - } - else if (rowIndex == data_.length - 1) - { - // remove last row - System.arraycopy(data_, 0, newData, 0, newData.length); - System.arraycopy(types_, 0, newTypes, 0, newTypes.length); - } - else - { - // remove row in middle - System.arraycopy(data_, 0, newData, 0, rowIndex); - System.arraycopy(data_, rowIndex+1, newData, rowIndex, - newData.length-rowIndex); - System.arraycopy(types_, 0, newTypes, 0, rowIndex); - System.arraycopy(types_, rowIndex+1, newTypes, rowIndex, - newTypes.length-rowIndex); - } - - data_ = newData; - numRows_--; - } - - // notify listeners that we've changed - fireTableRowsDeleted(rowIndex, rowIndex); -} - - -/** -Removes a listener from being notified when an error occurs. - -@param listener The listener. -**/ -public void removeErrorListener (ErrorListener listener) -{ - errorListeners_.removeErrorListener (listener); -} - - -/** -Removes a listener from being notified when work starts and stops. - -@param listener The listener. -**/ -public void removeWorkingListener (WorkingListener listener) -{ - workingListeners_.removeWorkingListener (listener); -} - - -/** -Sets the database files this table contains data for. -The new value will not be in effect until a load() is done. - -@param tables The database files this table will contain data for. - Tables should be in the form of .. -**/ -public void setTables (String[] tables) -{ - tables_ = tables; -} - - -/** -Sets the SQL connection this table contains data for. -The new value will not be in effect until a load() is done. - -@param connection The SQL connection. -**/ -public void setConnection (Connection connection) -{ - connection_ = connection; -} - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLMetaDataTablePane.java b/cvsroot/src/com/ibm/as400/vaccess/SQLMetaDataTablePane.java deleted file mode 100644 index 7056846de..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLMetaDataTablePane.java +++ /dev/null @@ -1,190 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLMetaDataTablePane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.border.BevelBorder; -import javax.swing.table.TableColumn; -import java.awt.BorderLayout; - - - -/** -The SQLMetaDataTablePane class represents a table that contains the -field information for a set of tables. -**/ -class SQLMetaDataTablePane -extends JPanel -implements java.io.Serializable //@B0A - for consistency -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - -//The table contained in this panel. -transient JTable table_; //@B0C - made transient -// The data model for the table. -SQLMetaDataTableModel model_; - - -/** -Constructs a SQLMetaDataTablePane object. - -@param model The data model for table data. -**/ -public SQLMetaDataTablePane (SQLMetaDataTableModel model) -{ - super(); - addFocusListener(new SerializationListener(this)); //@B0A - for safe serialization - model_ = model; - table_ = new JTable(); - table_.setAutoCreateColumnsFromModel(false); - table_.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); //@B0C - table_.setModel(model_); - table_.setShowGrid(false); - // set up table columns - TableColumn column = new TableColumn(SQLMetaDataTableModel.FIELD_NAME_); - column.setHeaderValue(ResourceLoader.getQueryText("DBQUERY_COLUMN_NAME")); - column.setPreferredWidth(150); //@B0C - table_.addColumn(column); - column = new TableColumn(SQLMetaDataTableModel.FIELD_TYPE_); - column.setHeaderValue(ResourceLoader.getQueryText("DBQUERY_COLUMN_TYPE")); - column.setPreferredWidth(70); //@B0C - table_.addColumn(column); - column = new TableColumn(SQLMetaDataTableModel.FIELD_LENGTH_); - column.setHeaderValue(ResourceLoader.getQueryText("DBQUERY_COLUMN_LENGTH")); - column.setPreferredWidth(60); //@B0C - table_.addColumn(column); - column = new TableColumn(SQLMetaDataTableModel.FIELD_DECIMALS_); - column.setHeaderValue(ResourceLoader.getQueryText("DBQUERY_COLUMN_DECIMALS")); - column.setPreferredWidth(65); //@B0C - table_.addColumn(column); - column = new TableColumn(SQLMetaDataTableModel.FIELD_NULLS_); - column.setHeaderValue(ResourceLoader.getQueryText("DBQUERY_COLUMN_NULL")); - column.setPreferredWidth(80); //@B0C - table_.addColumn(column); - column = new TableColumn(SQLMetaDataTableModel.FIELD_DESC_); - column.setHeaderValue(ResourceLoader.getQueryText("DBQUERY_COLUMN_DESCRIPTION")); - column.setPreferredWidth(180); //@B0C - table_.addColumn(column); - // build panel with table and headings - setupPane(); -} - - - -/** -Loads the table data from the system. -**/ -public void load() -{ - // refresh the result set data - model_.load(); -} - - -//@B0A -/** -Restores the state of this object from an object input stream. -It is used when deserializing an object. -@param in The input stream of the object being deserialized. -@exception IOException -@exception ClassNotFoundException -**/ -private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException -{ - in.defaultReadObject(); - addFocusListener(new SerializationListener(this)); //@B0A - for safe serialization next time - - //@B0A: The following code is copied from the constructor since - // table_ is now transient. - table_ = new JTable(); - table_.setAutoCreateColumnsFromModel(false); - table_.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); //@B0C - table_.setModel(model_); - table_.setShowGrid(false); - // set up table columns - TableColumn column = new TableColumn(SQLMetaDataTableModel.FIELD_NAME_); - column.setHeaderValue(ResourceLoader.getQueryText("DBQUERY_COLUMN_NAME")); - column.setPreferredWidth(150); //@B0C - table_.addColumn(column); - column = new TableColumn(SQLMetaDataTableModel.FIELD_TYPE_); - column.setHeaderValue(ResourceLoader.getQueryText("DBQUERY_COLUMN_TYPE")); - column.setPreferredWidth(70); //@B0C - table_.addColumn(column); - column = new TableColumn(SQLMetaDataTableModel.FIELD_LENGTH_); - column.setHeaderValue(ResourceLoader.getQueryText("DBQUERY_COLUMN_LENGTH")); - column.setPreferredWidth(60); //@B0C - table_.addColumn(column); - column = new TableColumn(SQLMetaDataTableModel.FIELD_DECIMALS_); - column.setHeaderValue(ResourceLoader.getQueryText("DBQUERY_COLUMN_DECIMALS")); - column.setPreferredWidth(65); //@B0C - table_.addColumn(column); - column = new TableColumn(SQLMetaDataTableModel.FIELD_NULLS_); - column.setHeaderValue(ResourceLoader.getQueryText("DBQUERY_COLUMN_NULL")); - column.setPreferredWidth(80); //@B0C - table_.addColumn(column); - column = new TableColumn(SQLMetaDataTableModel.FIELD_DESC_); - column.setHeaderValue(ResourceLoader.getQueryText("DBQUERY_COLUMN_DESCRIPTION")); - column.setPreferredWidth(180); //@B0C - table_.addColumn(column); - // build panel with table and headings - setupPane(); -} - - - - -/** -Changes the data for the table. - -@param model The data model for the table. -**/ -public void setDataModel(SQLMetaDataTableModel model) -{ - model_ = model; - table_.setModel(model); -} - - - -/** -Enables or disables this pane -@param enabled true if the pane should be enabled, false otherwise. -**/ -public void setEnabled(boolean enabled) -{ - table_.setEnabled(enabled); -} - - -/** -Puts the table and heading into the panel. -**/ -private void setupPane() -{ - setLayout(new BorderLayout()); - - // Add table to panel. - JScrollPane pane = new JScrollPane (table_); // @A1C - BevelBorder border = new BevelBorder(BevelBorder.LOWERED); - pane.setBorder(border); - add("Center", pane); -} - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryBuilderPane.java b/cvsroot/src/com/ibm/as400/vaccess/SQLQueryBuilderPane.java deleted file mode 100644 index 00801d0a8..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryBuilderPane.java +++ /dev/null @@ -1,1110 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLQueryBuilderPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import javax.swing.JComponent; -import javax.swing.JTabbedPane; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import java.awt.BorderLayout; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.IOException; -import java.io.Serializable; -import java.sql.Connection; -import java.sql.SQLException; - - - -/** -The SQLQueryBuilderPane class represents a panel which allows a -user to dynamically build a SQL query using graphical interfaces. -The corresponding SQL is generated. - -

    Data for the GUI is retrieved from the system -when load() is called. If load() is not called, -the tables in the GUI will be empty. - -

    If table names are provided, then the user is presented choices -based on the fields within those tables. If userSelectTables is -true, the user may modify the tables on which the query is built. -tableSchemas and userSelectTableSchemas are used -to determine the list of tables which the user can choose from, however -the user is not prevented from using tables not in these schemas. - -

    It is up to the user to register a JDBC driver when using this class. -For example, the following code registers the IBM Toolbox for Java -JDBC driver. -

    -   DriverManager.registerDriver (new com.ibm.as400.access.AS400JDBCDriver ());
    -
    - -

    Most errors are reported by firing ErrorEvents, rather -than throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    SQLQueryBuilderPane objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    - -
    -// Register JDBC driver.
    -DriverManager.registerDriver (new com.ibm.as400.access.AS400JDBCDriver ());
    -
    - // Set up table for result set contents.
    -final SQLConnection connection = new SQLConnection("jdbc:as400://MySystem");
    -final SQLQueryBuilderPane pane = new SQLQueryBuilderPane(connection);
    -
    - // Set up window to hold table
    -JFrame frame = new JFrame ("My Window");
    -WindowListener l = new WindowAdapter()
    -{
    -     // Close the pane when window is closed.
    -    public void windowClosing(WindowEvent e)
    -    {
    -        pane.close();
    -        connection.close();
    -    }
    -};
    -frame.addWindowListener(l);
    -
    -// Set up the error dialog adapter.
    -pane.addErrorListener (new ErrorDialogAdapter (frame));
    -
    -// Add the component and get data from system.
    -frame.getContentPane().add(pane);
    -pane.load();
    -
    - // Display the window
    -frame.setVisible(true)
    -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class SQLQueryBuilderPane -extends JComponent -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// The variables and methods which have private commented out -// had to be made package scope since currently Internet Explorer -// does not allow inner class to access private items in their -// containing class. - - -// Current property values. -private SQLConnection sqlconn_ = null; -private String[] tables_; -private String[] schemas_ = new String[0]; -transient private Connection connection_ = null; - -// GUI control property values -private boolean tablesUserDefined_ = true; -private boolean schemasUserDefined_ = true; - -// GUI controls -transient /*private*/ JTabbedPane notebook_; // The notebook control -transient private SQLQueryTablePane tablePane_; // Panes for each notebook pane -transient private SQLQuerySelectPane selectPane_; -transient private SQLQueryJoinPane joinPane_; -transient private SQLQueryWherePane wherePane_; -transient private SQLQueryGroupPane groupPane_; -transient private SQLQueryHavingPane havingPane_; -transient private SQLQueryOrderPane orderPane_; -transient private SQLQuerySummaryPane summaryPane_; - -// indices of panels in notebook -static final int TABLE_ = 0; -static final int SELECT_ = 1; -static final int JOIN_ = 2; -static final int WHERE_ = 3; -static final int GROUP_ = 4; -static final int HAVING_ = 5; -static final int ORDER_ = 6; -static final int SUMMARY_ = 7; -transient /*private*/ int currentPane_ = TABLE_; - -// Whether the notebook page panel has been initialized. -transient private boolean panelInit[] = new boolean[8]; - -// Data model which represents the fields of the tables at -// the current connection. -transient SQLMetaDataTableModel fields_ = null; -// We have a separate listener list for panels to listen -// to changed to fields_. -transient private PropertyChangeSupport fieldListeners_ - = new PropertyChangeSupport (this); - -// Flag used to determine load() function. -private boolean internalLoad_ = false; -// True if the user has done load(). -transient private boolean loadDone_ = false; - -// Event support. -transient private PropertyChangeSupport changeListeners_ - = new PropertyChangeSupport (this); -transient private VetoableChangeSupport vetoListeners_ - = new VetoableChangeSupport (this); -transient private ErrorEventSupport panelErrors_ - = new ErrorEventSupport(this); - -// Adapter for listening for working events and enabling working cursor. -transient /*private*/ WorkingCursorAdapter worker_ - = new WorkingCursorAdapter(this); -transient WorkingEvent workEvent_ = new WorkingEvent(this); - - -/** -Constructs a SQLQueryBuilderPane object. -**/ -public SQLQueryBuilderPane () -{ - super(); - tables_ = new String[0]; - setupPane(); - addFocusListener(new SerializationListener(this)); //@B0A - for safe serialization -} - - - -/** -Constructs a SQLQueryBuilderPane object. - -@param connection The SQL connection. -**/ -public SQLQueryBuilderPane (SQLConnection connection) -{ - super(); - sqlconn_ = connection; - tables_ = new String[0]; - setupPane(); - addFocusListener(new SerializationListener(this)); //@B0A - for safe serialization -} - - - -/** -Constructs a SQLQueryBuilderPane object. - -@param connection The SQL connection. -@param tables The names of the tables to be used for the query. - Tables should be in the form of schema.table. -**/ -public SQLQueryBuilderPane (SQLConnection connection, - String[] tables) -{ - super(); - if (tables == null) - throw new NullPointerException("tables"); - sqlconn_ = connection; - tables_ = tables; - setupPane(); - addFocusListener(new SerializationListener(this)); //@B0A - for safe serialization -} - - -/** -Adds a listener to be notified when an error occurs. -The listener's errorOccurred() method will be called. - -@param listener The listener. -**/ -public void addErrorListener (ErrorListener listener) -{ - panelErrors_.addErrorListener(listener); -} - - - -/** -Adds a listener to be notified when fields_ is changed. -The listener's propertyChange() method will be called. - -@param listener The listener. -**/ -void addFieldListener (PropertyChangeListener listener) -{ - fieldListeners_.addPropertyChangeListener (listener); -} - - - -/** -Adds a listener to be notified when the value of any bound -property is changed. -The listener's propertyChange() method will be called. - -@param listener The listener. -**/ -public void addPropertyChangeListener (PropertyChangeListener listener) -{ - changeListeners_.addPropertyChangeListener (listener); - super.addPropertyChangeListener(listener); -} - - - -/** -Adds a listener to be notified when the selected items have changed. -The listener's propertyChange() method will be called. - -@param listener The listener. -**/ -void addSelectListener (PropertyChangeListener listener) -{ - selectPane_.addSelectListener (listener); -} - - - -/** -Adds a listener to be notified when the value of any constrained -property is changed. -The listener's vetoableChange() method will be called. - -@param listener The listener. -**/ -public void addVetoableChangeListener (VetoableChangeListener listener) -{ - vetoListeners_.addVetoableChangeListener (listener); - super.addVetoableChangeListener(listener); -} - - -/** -Saves any changes made to the current page. -**/ -synchronized /*private*/ void completePage() -{ - Trace.log(Trace.DIAGNOSTIC, "Completing page " + currentPane_); - - // Finalize the old page. - switch(currentPane_) - { - case TABLE_: - tablePane_.complete(); - if (tablePane_.getSchemas() != schemas_) - { - try {setTableSchemas(tablePane_.getSchemas());} - catch(PropertyVetoException ev) - { - // property change rejected, set tables back - tablePane_.setSchemas(schemas_); - } - } - if (tablePane_.getTables() != tables_) - { - try {setTables(tablePane_.getTables());} - catch(PropertyVetoException ev) - { - // property change rejected, set tables back - tablePane_.setTables(tables_); - } - internalLoad_ = true; - load(); - internalLoad_ = false; - if (tables_.length == 0) - { // only summary panel is valid, disable others - notebook_.setEnabledAt(SELECT_,false); - notebook_.setEnabledAt(JOIN_,false); - notebook_.setEnabledAt(WHERE_,false); - notebook_.setEnabledAt(GROUP_,false); - notebook_.setEnabledAt(HAVING_,false); - notebook_.setEnabledAt(ORDER_,false); - break; - } - else - { // enable panels - notebook_.setEnabledAt(SELECT_,true); - notebook_.setEnabledAt(WHERE_,true); - notebook_.setEnabledAt(GROUP_,true); - notebook_.setEnabledAt(HAVING_,true); - if (tables_.length == 1) - { - notebook_.setEnabledAt(JOIN_,false); - } - else - { - notebook_.setEnabledAt(JOIN_,true); - } - if (selectPane_.getSelectedItems().length > 0) - notebook_.setEnabledAt(ORDER_,true); - else - notebook_.setEnabledAt(ORDER_,false); - break; - } - } - else - { - break; - } - case SELECT_: - selectPane_.complete(); - // enable or disable order by and group by panels - if (selectPane_.getSelectedItems().length > 0) - { - notebook_.setEnabledAt(ORDER_,true); - } - else - { - notebook_.setEnabledAt(ORDER_,false); - } - break; - case JOIN_: - joinPane_.complete(); - break; - case WHERE_: - case GROUP_: - case HAVING_: - case ORDER_: - case SUMMARY_: - break; - default: - Trace.log(Trace.ERROR, "Unknown page " + currentPane_); - } -} - - - -/** -Returns the SQL connection with which to access data for the GUI. - -@return The SQL connection. -**/ -public SQLConnection getConnection () -{ - return sqlconn_; -} - - - - -/** -Returns the SQL query that corresponds to the user's selections. -An empty String is returned if no tables have been selected. - -@return The SQL query that corresponds to the user's selections. -**/ -synchronized public String getQuery () -{ - // save info from the current page - completePage(); - - // make sure there are tables - if (tables_.length == 0) - return ""; - - worker_.startWorking(workEvent_); - - StringBuffer result; - String clause; - // Get clauses from all panes that have been inited. - - // Select clause - result = new StringBuffer("SELECT " + selectPane_.getClause()); - - // join clause - boolean whereProcessed = false; - boolean fromAdded = false; - // Only process if there are at least 2 tables - if (tables_.length > 1) - { - if (joinPane_.getJoinType() == SQLQueryJoinPane.INNER_JOIN) - { - clause = joinPane_.getClause(0); - if (clause != null && !clause.equals("")) - { - // Add FROM tables - result.append(" FROM "); - for (int i = 0; i < tables_.length; ++i) - { - if (i > 0) - result.append(", "); - result.append(tables_[i]); - result.append(" AS "); - result.append(tables_[i].substring(tables_[i].lastIndexOf(".")+1)); - } - fromAdded = true; - // Add join condition in the WHERE clause - result.append(" WHERE "); - result.append(clause); - // Add WHERE clause - String where = wherePane_.getClause(); - if (where != null && !where.equals("")) - { - result.append(" AND "); - result.append(where); - } - whereProcessed = true; - } - } - else // left outer join - { - // Add tables and join conditions interspersed. - // If the join clause is empty, we do inner join, - // if not empty, we do a left outer join. - result.append(" FROM "); - result.append(tables_[0]); - result.append(" AS "); - result.append(tables_[0].substring(tables_[0].lastIndexOf(".")+1)); - for (int i = 0; i < tables_.length-1; ) - { - // clause should never be null since outer join is - // not the default join type - clause = joinPane_.getClause(i).trim(); - if (clause.equals("")) // empty join clause, do inner - { - result.append(", "); - result.append(tables_[++i]); - result.append(" AS "); - result.append(tables_[i].substring(tables_[i].lastIndexOf(".")+1)); - } - else // not empty, do left outer - { - result.append(" LEFT JOIN "); - result.append(tables_[++i]); - result.append(" AS "); - result.append(tables_[i].substring(tables_[i].lastIndexOf(".")+1)); - result.append(" ON "); - result.append(clause); - } - } - fromAdded = true; - } - } - if (!fromAdded) - { - // Add FROM tables - result.append(" FROM "); - for (int i = 0; i < tables_.length; ++i) - { - if (i > 0) - result.append(", "); - result.append(tables_[i]); - result.append(" AS "); - result.append(tables_[i].substring(tables_[i].lastIndexOf(".")+1)); - } - } - - // where clause - if (!whereProcessed) // not handled by join processing - { - clause = wherePane_.getClause(); - if (clause != null && !clause.equals("")) - { - result.append(" WHERE "); - result.append(clause); - } - } - - // group by clause - clause = groupPane_.getClause(); - if (clause != null && !clause.equals("")) - { - result.append(" GROUP BY "); - result.append(clause); - } - - // having clause - clause = havingPane_.getClause(); - if (clause != null && !clause.equals("")) - { - result.append(" HAVING "); - result.append(clause); - } - - // order by clause - clause = orderPane_.getClause(); - if (clause != null && !clause.equals("")) - { - result.append(" ORDER BY "); - result.append(clause); - } - - worker_.stopWorking(workEvent_); - - return result.toString(); -} - - - -/** -Returns the names of the fields in the select clause. - -@return The names of the fields in the select clause. -**/ -synchronized String[] getSelectedFields() -{ - worker_.startWorking(workEvent_); - String[] result = selectPane_.getSelectedFields(); - worker_.stopWorking(workEvent_); - return result; -} - - - -/** -Returns the names of the items in the select clause. - -@return The names of the items in the select clause. -**/ -synchronized String[] getSelectedItems() -{ - worker_.startWorking(workEvent_); - String[] result = selectPane_.getSelectedItems(); - worker_.stopWorking(workEvent_); - return result; -} - - - -/** -Returns the names of the tables used in the query. - -@return The table names. -**/ -public String[] getTables () -{ - return tables_; -} - - - -/** -Returns the schemas for which the tables will be listed for inclusion -in the query. - -@return The schema names. -**/ -public String[] getTableSchemas () -{ - return schemas_; -} - - -/** -Returns true if the user is able to select and change the tables that -are included in the query. This property controls when the table -page is enabled or disabled. -The default value is true. - -@return true if the user is allowed to change the tables in the - query; false otherwise. -**/ -public boolean getUserSelectTables () -{ - return tablesUserDefined_; -} - - -/** -Returns true if the user is able to select and change the schemas -for which tables are shown. -This property controls whether the -list of tables on the table page is changeable. -The default value is true. - -@return true if the user is allowed to change the schemas - whose tables are shown; false otherwise. -**/ -public boolean getUserSelectTableSchemas () -{ - return schemasUserDefined_; -} - - -/** -Gets data from the system. -If the connection is null, the system JDBC driver will -be used, and the user will be prompted for sign-on information. -**/ -synchronized public void load() -{ - Trace.log(Trace.DIAGNOSTIC, "Doing query builder load"); - worker_.startWorking(workEvent_); - - // Save info from current page. - // Don't save tables, since that will wipe out the new tables value - // if a setTables() was just done. - if (currentPane_ != TABLE_) - completePage(); - - // Only do these functions if the user called load() - // (we haven't called load ourselves). - if (!internalLoad_) - { - // If connection not set or completely specified, - // prompt for system, uid, password here. - if (sqlconn_ == null) - { - sqlconn_ = new SQLConnection("jdbc:as400"); - } - connection_ = null; - try - { - connection_ = sqlconn_.getConnection(); - } - catch (SQLException e) - { - panelErrors_.fireError(e); - return; - } - } - - // Update fields_, notify other panes that the fields have - // changed. - fields_.setConnection(connection_); - fields_.setTables(tables_); - fields_.load(); - fieldListeners_.firePropertyChange(null, null, null); - - // Only do these functions if the user called load() - // (we haven't called load ourselves). - if (!internalLoad_) - { - // Update table pane - tablePane_.setConnection(connection_); - tablePane_.setTables(tables_); - tablePane_.load(); - if (tablesUserDefined_) - { - tablePane_.setEnabled(true); - } - - // Update current page. - updatePage(); - } - - worker_.stopWorking(workEvent_); -} - - -/** -Restores the state of this object from an object input stream. -It is used when deserializing an object. -@param in The input stream of the object being deserialized. -@exception IOException -@exception ClassNotFoundException -**/ -private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException -{ - // Restore the non-static and non-transient fields. - in.defaultReadObject(); - addFocusListener(new SerializationListener(this)); //@B0A - for safe serialization later on - // Initialize the transient fields. - panelInit = new boolean[8]; - fieldListeners_ = new PropertyChangeSupport (this); - changeListeners_ = new PropertyChangeSupport (this); - vetoListeners_ = new VetoableChangeSupport (this); - panelErrors_ = new ErrorEventSupport(this); - fields_ = null; - worker_ = new WorkingCursorAdapter(this); - workEvent_ = new WorkingEvent(this); - currentPane_ = TABLE_; - loadDone_ = false; - setupPane(); -} - - -/** -Removes a listener from being notified when an error occurs. - -@param listener The listener. -**/ -public void removeErrorListener (ErrorListener listener) -{ - panelErrors_.removeErrorListener(listener); -} - - - -/** -Removes a listener from being notified when the value of any bound -property is changed. - -@param listener The listener. -**/ -public void removePropertyChangeListener (PropertyChangeListener listener) -{ - changeListeners_.removePropertyChangeListener (listener); - super.removePropertyChangeListener(listener); -} - - - -/** -Removes a listener from being notified when the value of any constrained -property is changed. - -@param listener The listener. -**/ -public void removeVetoableChangeListener (VetoableChangeListener listener) -{ - vetoListeners_.removeVetoableChangeListener (listener); - super.removeVetoableChangeListener(listener); -} - - - -/** -Sets the SQL connection with which to access data for the GUI. -This property is bound and constrained. -Note that the data in the GUI will not change -until a load() is done. - -@param connection The SQL connection. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setConnection (SQLConnection connection) - throws PropertyVetoException -{ - SQLConnection old = sqlconn_; - - // Fire a vetoable change event. - vetoListeners_.fireVetoableChange("connection", old, connection); - - // Make property change. - sqlconn_ = connection; - - // Fire the property change event. - changeListeners_.firePropertyChange("connection", old, connection); -} - - -/** -Sets the table names for the query. -This property is bound and constrained. -Note that the data in the GUI will not change -until a load() is done. - -@param tables The names of the tables used in the query. - Tables should be in the form of schema.table. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setTables (String[] tables) - throws PropertyVetoException -{ - if (tables == null) - throw new NullPointerException("tables"); - - String[] old = tables_; - - // Fire a vetoable change event. - vetoListeners_.fireVetoableChange("tables", old, tables); - - // Make property change. - tables_ = tables; - - // Fire the property change event. - changeListeners_.firePropertyChange("tables", old, tables); -} - - -/** -Sets the schemas for which the tables will be listed for inclusion -in the query. -The default is no schemas, so no tables will be listed. -This property is bound and constrained. - -@param tableSchemas The schemas for which tables will be listed. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setTableSchemas (String[] tableSchemas) - throws PropertyVetoException -{ - if (tableSchemas == null) - throw new NullPointerException("tableSchemas"); - - String[] old = schemas_; - - // Fire a vetoable change event. - vetoListeners_.fireVetoableChange("tableSchemas", old, tableSchemas); - - // Make property change. - synchronized (this) - { - schemas_ = tableSchemas; - tablePane_.setSchemas(tableSchemas); - } - - // Fire the property change event. - changeListeners_.firePropertyChange("tableSchemas", old, tableSchemas); -} - - - -/** -Sets whether the user will be able to select and change the tables that -are included in the query. This property controls when the table -page is enabled or disabled. -The default value is true. -This property is bound and constrained. - -@param flag true if the user is allowed to change the tables in the - query; false otherwise. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setUserSelectTables (boolean flag) - throws PropertyVetoException -{ - Boolean old = new Boolean(tablesUserDefined_); - - // Fire a vetoable change event. - vetoListeners_.fireVetoableChange("userSelectTables", old, new Boolean(flag)); - - // Make property change. - tablesUserDefined_ = flag; - - // Update the GUI. - tablePane_.setEnabled(flag); - - // Fire the property change event. - changeListeners_.firePropertyChange("userSelectTables", old, new Boolean(flag)); -} - - - -/** -Sets whether the user will be able to select and change the schemas -for which tables are shown. -This property controls whether the -list of tables on the table page is changeable. -The default value is true. -This property is bound and constrained. - -@param flag true if the user is allowed to change the schemas - whose tables are shown; false otherwise. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setUserSelectTableSchemas (boolean flag) - throws PropertyVetoException -{ - // Fire a vetoable change event. - vetoListeners_.fireVetoableChange("userSelectTableSchemas", - new Boolean(schemasUserDefined_), new Boolean(flag)); - - // Make property change. - boolean old = schemasUserDefined_; - schemasUserDefined_ = flag; - - // Update the GUI. - synchronized (this) - { - tablePane_.setUserSelectTableSchemas(flag); - } - - // Fire the property change event. - changeListeners_.firePropertyChange("userSelectTableSchemas", - new Boolean(old), new Boolean(flag)); -} - - -/** -Builds the tabbed panels. -**/ -private void setupPane() -{ - // Set up fields table - fields_ = new SQLMetaDataTableModel(connection_, tables_); - fields_.addErrorListener(panelErrors_); - - // Edge - setLayout(new BorderLayout()); - - // Build notebook control. - // The panels are added in the same order as the - // constants for the pane indices. - // Add error listeners to all panels - notebook_ = new JTabbedPane(); - tablePane_ = new SQLQueryTablePane(this, connection_, tables_, - schemas_, schemasUserDefined_); - tablePane_.addErrorListener(panelErrors_); - notebook_.addTab(ResourceLoader.getQueryText ("DBQUERY_LABEL_TABLES"), null, tablePane_); // @A1C - selectPane_ = new SQLQuerySelectPane(this); - notebook_.addTab("Select", null, selectPane_); - joinPane_ = new SQLQueryJoinPane(this); - notebook_.addTab("Join By", null, joinPane_); - wherePane_ = new SQLQueryWherePane(this); - notebook_.addTab("Where", null, wherePane_); - groupPane_ = new SQLQueryGroupPane(this); - notebook_.addTab("Group By", null, groupPane_); - havingPane_ = new SQLQueryHavingPane(this); - notebook_.addTab("Having", null, havingPane_); - orderPane_ = new SQLQueryOrderPane(this); - notebook_.addTab("Order By", null, orderPane_); - summaryPane_ = new SQLQuerySummaryPane(this); - notebook_.addTab(ResourceLoader.getQueryText ("DBQUERY_LABEL_SUMMARY"), null, summaryPane_); // @A1C - -//notebook_.setPreferredSize(new Dimension(600,500)); - notebook_.setSelectedIndex(0); - tablePane_.init(); // Init initial pane. - - // Enable appropriate tabs. - tablePane_.setEnabled(tablesUserDefined_); - // If only one table, do not enable join. - if (tables_.length == 1) - notebook_.setEnabledAt(JOIN_,false); - // If no tables, disable all but tables and summary pane. - else if (tables_.length == 0) - { - notebook_.setEnabledAt(SELECT_,false); - notebook_.setEnabledAt(JOIN_,false); - notebook_.setEnabledAt(WHERE_,false); - notebook_.setEnabledAt(GROUP_,false); - notebook_.setEnabledAt(HAVING_,false); - notebook_.setEnabledAt(ORDER_,false); - } - - - // Add listener for when pane changes. - notebook_.addChangeListener(new Listener_()); - add("Center", notebook_); - -} - - -/** -Updates the current page. -**/ -synchronized /*private*/ void updatePage() -{ - Trace.log(Trace.DIAGNOSTIC, "Updating page " + currentPane_); - switch(currentPane_) - { - case TABLE_: - // table panel is initialized at creation since it is - // first panel displayed - tablePane_.update(); - break; - case SELECT_: - if (!panelInit[SELECT_]) - { - selectPane_.init(); - panelInit[SELECT_] = true; - selectPane_.validate(); - } - else - { - selectPane_.update(); - } - break; - case JOIN_: - if (!panelInit[JOIN_]) - { - joinPane_.init(); - panelInit[JOIN_] = true; - joinPane_.validate(); - } - else - { - joinPane_.update(); - } - break; - case WHERE_: - if (!panelInit[WHERE_]) - { - wherePane_.init(); - panelInit[WHERE_] = true; - wherePane_.validate(); - } - else - { - wherePane_.update(); - } - break; - case GROUP_: - if (!panelInit[GROUP_]) - { - groupPane_.init(); - panelInit[GROUP_] = true; - groupPane_.validate(); - } - else - { - groupPane_.update(); - } - break; - case HAVING_: - if (!panelInit[HAVING_]) - { - havingPane_.init(); - panelInit[HAVING_] = true; - havingPane_.validate(); - } - else - { - havingPane_.update(); - } - break; - case ORDER_: - if (!panelInit[ORDER_]) - { - orderPane_.init(); - panelInit[ORDER_] = true; - orderPane_.validate(); - } - else - { - orderPane_.update(); - } - break; - case SUMMARY_: - if (!panelInit[SUMMARY_]) - { - summaryPane_.init(); - panelInit[SUMMARY_] = true; - summaryPane_.validate(); - } - else - { - summaryPane_.update(); - } - break; - default: - Trace.log(Trace.ERROR, "Unknown page " + currentPane_); - } // end switch -} - - -/** -Class used to listen for events. -Change events are used to track when the page is turned. The new -page will either be built or updated. -**/ -private class Listener_ -implements ChangeListener -{ - - public void stateChanged(ChangeEvent e) - { - worker_.startWorking(workEvent_); - - completePage(); // save current page - currentPane_ = notebook_.getSelectedIndex(); - updatePage(); // update new page - - worker_.stopWorking(workEvent_); - - } - -} // end of class Listener_ - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryBuilderPane16.gif b/cvsroot/src/com/ibm/as400/vaccess/SQLQueryBuilderPane16.gif deleted file mode 100644 index 5361cd77a..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryBuilderPane16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryBuilderPane32.gif b/cvsroot/src/com/ibm/as400/vaccess/SQLQueryBuilderPane32.gif deleted file mode 100644 index 914d6adb5..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryBuilderPane32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryBuilderPaneBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/SQLQueryBuilderPaneBeanInfo.java deleted file mode 100644 index 22d293dfc..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryBuilderPaneBeanInfo.java +++ /dev/null @@ -1,184 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLQueryBuilderPaneBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - -/** -The SQLQueryBuilderPaneBeanInfo class provides bean -information for the SQLQueryBuilderPane class. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class SQLQueryBuilderPaneBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = SQLQueryBuilderPane.class; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - // ***** EVENTS - EventSetDescriptor error = new EventSetDescriptor(beanClass, - "error", - com.ibm.as400.vaccess.ErrorListener.class, - "errorOccurred"); - error.setDisplayName(ResourceLoader.getText("EVT_NAME_ERROR")); - error.setShortDescription(ResourceLoader.getText("EVT_DESC_ERROR")); - - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_VETO")); - - events_ = new EventSetDescriptor[]{error, changed, veto}; - - - // ***** PROPERTIES - PropertyDescriptor connection = new PropertyDescriptor("connection", beanClass); - connection.setBound(true); - connection.setConstrained(true); - connection.setDisplayName(ResourceLoader.getText("PROP_NAME_CONNECTION")); - connection.setShortDescription(ResourceLoader.getText("PROP_DESC_CONNECTION")); - - PropertyDescriptor tables = new PropertyDescriptor("tables", beanClass); - tables.setBound(true); - tables.setConstrained(true); - tables.setDisplayName(ResourceLoader.getText("PROP_NAME_TABLES")); - tables.setShortDescription(ResourceLoader.getText("PROP_DESC_TABLES")); - - PropertyDescriptor select = new PropertyDescriptor("userSelectTables", beanClass); - select.setBound(true); - select.setConstrained(true); - select.setDisplayName(ResourceLoader.getText("PROP_NAME_USER_SET_TABLES")); - select.setShortDescription(ResourceLoader.getText("PROP_DESC_USER_SET_TABLES")); - - PropertyDescriptor libraries = new PropertyDescriptor("tableSchemas", beanClass); - libraries.setBound(true); - libraries.setConstrained(true); - libraries.setDisplayName(ResourceLoader.getText("PROP_NAME_TABLE_SCHEMAS")); - libraries.setShortDescription(ResourceLoader.getText("PROP_DESC_TABLE_SCHEMAS")); - - PropertyDescriptor select2 = new PropertyDescriptor("userSelectTableSchemas", beanClass); - select2.setBound(true); - select2.setConstrained(true); - select2.setDisplayName(ResourceLoader.getText("PROP_NAME_USER_SET_SCHEMAS")); - select2.setShortDescription(ResourceLoader.getText("PROP_DESC_USER_SET_SCHEMAS")); - - properties_ = new PropertyDescriptor[]{connection, tables, select, libraries, select2}; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the error event - return 0; - } - - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the "query" property - return 0; - } - - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("SQLQueryBuilderPane16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("SQLQueryBuilderPane32.gif"); - break; - } - - return image; - } - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryClause.java b/cvsroot/src/com/ibm/as400/vaccess/SQLQueryClause.java deleted file mode 100644 index 962ee915d..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryClause.java +++ /dev/null @@ -1,112 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLQueryClause.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Dimension; -import javax.swing.JTextPane; - - -/** -Class used to create a JTextPane that displays a set amount of lines -in the viewport. -**/ -class SQLQueryClause -extends JTextPane -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -private int numRows_; // Number of lines to display -private int pheight_ = 0; // Height in pixels of component - -/** -Constructs a SQLQueryClause object. -**/ -public SQLQueryClause(int rows) -{ - numRows_ = rows; -} - - - -public void appendText(String text) -{ - String oldText = getText().trim(); - if (oldText.length() == 0) - setText(text); - else { - StringBuffer buffer = new StringBuffer(oldText); - buffer.append(' '); - buffer.append(text); - setText(buffer.toString()); - } -} - - - -public void appendTextWithComma(String text) -{ - String oldText = getText().trim(); - if (oldText.length() == 0) - setText(text); - else { - StringBuffer buffer = new StringBuffer(oldText); - buffer.append(", "); - buffer.append(text); - setText(buffer.toString()); - } -} - - - -/** -Returns the preferred size of the viewport for a view component. -@return the preferred size of the viewport for a view component. -**/ -public Dimension getPreferredScrollableViewportSize() -{ - if (pheight_ == 0) - { - if (getFont() == null) - return super.getPreferredScrollableViewportSize(); - // Determine the preferred hieght - height of the font - // times the number of rows+1. - pheight_ = getFontMetrics(getFont()).getHeight() * (numRows_ + 1); - } - return new Dimension(getPreferredSize().width, pheight_); -} - - -public String getText() -{ - return super.getText().trim(); -} - - -//@B0A: Override setText() to avoid bug # 4183255. -// The bug involves the underlying Document model of a JEditorPane being -// removed when setText() is called. When the Document is removed, our -// listeners don't get notified of any changes in the text. The workaround -// is to call insertString() on the Document directly. -// This is "supposed" to be fixed in JDK 1.2.2. -public void setText(String s) -{ - try - { - this.getDocument().remove(0, this.getDocument().getLength()); - this.getDocument().insertString(0, s, null); - } - catch(javax.swing.text.BadLocationException e) {} -} -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryFieldsPane.java b/cvsroot/src/com/ibm/as400/vaccess/SQLQueryFieldsPane.java deleted file mode 100644 index 1f5dbe37f..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryFieldsPane.java +++ /dev/null @@ -1,366 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLQueryFieldsPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.JPanel; -import javax.swing.JTable; -import javax.swing.border.EmptyBorder; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeEvent; -import java.io.IOException; -import java.sql.Types; -import java.util.Vector; - - - -/** -The SQLQueryFieldsPane class represents a panel which -contains a fields table, -used for a page of the SQLQueryBuilderPane notebook. -**/ -abstract class SQLQueryFieldsPane -extends JPanel -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// This class is not meant to be serialized, it should be transient. -// This class has items marked transient even though it is not -// serializable because otherwise errors were received when -// serializing objects that contained this class (even though they -// were transient instances. readObject() was added to be safe. - -// GUI components -protected SQLMetaDataTablePane fields_; -protected SQLMetaDataTableModel fieldModel_; -protected SQLQueryBuilderPane parent_; - -// Indicates if fieldModel_ has changed. -protected boolean fieldsChanged_ = false; - -// Listen to changes in the fields table. -transient protected FieldListener_ fieldListener_ = null; - - -/** -Constructs a SQLQuerySelectPane object. -init must be called to build the GUI contents. -@param parent The parent of this panel. -**/ -public SQLQueryFieldsPane (SQLQueryBuilderPane parent) -{ - super(); - parent_ = parent; - fieldModel_ = parent_.fields_; - // Add listener to changes to table fields. - fieldListener_ = new FieldListener_(); - parent_.addFieldListener(fieldListener_); -} - - -/** -Returns the name of the field at the given row. -@param index The row of field. -@return The name of the field at the given row. -**/ -protected String fieldName(int index) -{ - return (String) - (fieldModel_.getValueAt(index, SQLMetaDataTableModel.FIELD_NAME_)); -} - - -/** -Returns the names of the fields which are characters. -@return The names of the character fields. -**/ -protected String[] getCharacterFieldNames() -{ - int numRows = fieldModel_.getRowCount(); - Vector results = new Vector(); - for (int i=0; i 1) // if double click - { - // Get the object that was double clicked, if any. - int row = table.rowAtPoint(event.getPoint()); - if (row != -1) // -1 means no object under mouse - { - rowPicked(row); - } - } - } - } - ); -} - - - -/** -Update the fieldModel if needed. -**/ -public void update() -{ - if (fieldsChanged_) - { - // Build new model. - fieldModel_ = parent_.fields_; - - // Set table to use new model. - fields_.setDataModel(fieldModel_); - - fieldsChanged_ = false; - } -} - - - -/** -Class to listen for property changes on the fields contained in the -tables associated with the query. -**/ -/* private */ class FieldListener_ //@B0C - made package scope -implements PropertyChangeListener, java.io.Serializable //@B0C - made serializable -{ - public void propertyChange(PropertyChangeEvent event) - { - fieldsChanged_ = true; - } -} - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryGroupPane.java b/cvsroot/src/com/ibm/as400/vaccess/SQLQueryGroupPane.java deleted file mode 100644 index 396217911..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryGroupPane.java +++ /dev/null @@ -1,145 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLQueryGroupPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.BorderLayout; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import javax.swing.Box; - - -/** -The SQLQueryGroupPane class represents a panel which allows a -user to dynamically build the GROUP BY portion of an SQL query. -This panel is used for a page of the SQLQueryBuilderPane notebook. -**/ -class SQLQueryGroupPane -extends SQLQueryFieldsPane -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// The variables which have private commented out had to made -// package scope since currently Internet Explorer does not -// allow inner class to access private variables in their -// containing class. - -// GUI components -private SQLQueryClause clause_; - -// Indicates if the selected items has changed. -/*private*/ boolean selectChanged_ = false; -// Listen to changes in the selected items. -private SelectListener_ selectListener_ = null; - - -/** -Constructs a SQLQueryGroupPane object. -init must be called to build the GUI contents. - -@param parent The parent of this panel. -**/ -public SQLQueryGroupPane (SQLQueryBuilderPane parent) -{ - super(parent); -} - - - - -/** -Returns the sql clause for this panel. -@return The sql clause for this panel. -**/ -public String getClause() -{ - if (clause_ == null) - return null; - return clause_.getText(); -} - - - -/** -Build the panel GUI. -**/ -public void init() -{ - // Add listener to changes to selected items. - selectListener_ = new SelectListener_(); - parent_.addSelectListener(selectListener_); - super.init(); -} - - -/** -Adds the field to the clause. - -@param index Index of the row in the table that was clicked upon. -**/ -protected void rowPicked(int index) -{ - clause_.appendTextWithComma(fieldName(index)); -} - - - -/** -Builds the panel GUI components and sets up connections -between the components by using listeners. -**/ -protected void setupPane() -{ - super.setupPane(); - - clause_ = new SQLQueryClause(5); - - Box overallBox = Box.createVerticalBox(); - overallBox.add(fields_); - overallBox.add(new LabelledComponent("DBQUERY_LABEL_CLAUSE_GROUP", new ScrollingTextPane(clause_))); - setLayout(new BorderLayout()); - add("Center", overallBox); - -} - - -/** -Update the fieldModel if needed. -**/ -public void update() -{ - // Force reload of field table if selected items have changed. - if (selectChanged_) - { - fieldListener_.propertyChange(new PropertyChangeEvent(this, "fields", null, null)); - } - - super.update(); -} - - - -/** -Class to listen for property changes on the selected items. -**/ -private class SelectListener_ -implements PropertyChangeListener -{ - public void propertyChange(PropertyChangeEvent event) - { - selectChanged_ = true; - } -} - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryHavingPane.java b/cvsroot/src/com/ibm/as400/vaccess/SQLQueryHavingPane.java deleted file mode 100644 index 4d4ddd150..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryHavingPane.java +++ /dev/null @@ -1,345 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLQueryHavingPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.BorderLayout; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import javax.swing.Box; -import javax.swing.JOptionPane; - - - -/** -The SQLQueryHavingPane class represents a panel which allows a -user to dynamically build the HAVING portion of an SQL query. -This panel is used for a page of the SQLQueryBuilderPane notebook. -**/ -class SQLQueryHavingPane -extends SQLQueryFieldsPane -// Even though this panel does not have a field table on it, it -// extend SQLQueryFields panel because it needs to be aware of -// the fields to do its processing of functions. -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// The variables and methods which have private commented out -// had to be made package scope since currently Internet Explorer -// does not allow inner class to access private items in their -// containing class. - -// GUI components -/*private*/ DoubleClickList notList_; -/*private*/ DoubleClickList functionList_; -/*private*/ DoubleClickList testList_; -/*private*/ DoubleClickList functionList2_; -/*private*/ DoubleClickList otherList_; -private SQLQueryClause clause_; - -// Values for function list boxes. Note these are not translated. -private static final String FCN_COUNT_ = "COUNT"; -private static final String FCN_SUM_ = "SUM"; -private static final String FCN_AVG_ = "AVG"; -private static final String FCN_MIN_ = "MIN"; -private static final String FCN_MAX_ = "MAX"; - -// Keeps track of last choice -private int lastChoice_; -// Is NOT in affect for this expression. -private boolean notInEffect_ = false; -// Statics for each list box user could have chosen from. -private static final int NOT_ = 1; -private static final int FUNCTION_ = 2; -private static final int TEST_ = 3; -private static final int FUNCTION2_ = 4; -private static final int OTHER_ = 5; - -private static final String [] notChoices = {"NOT"}; -private static final String [] functionChoices = {FCN_AVG_, FCN_COUNT_, FCN_MIN_, FCN_MAX_, FCN_SUM_}; -private static final String [] testChoices = {"=", "<>", "<", ">", "<=", ">="}; -private static final String [] functionChoices2 = { - "<" + ResourceLoader.getQueryText("DBQUERY_CHOICE_CONSTANT") + ">", - FCN_AVG_, FCN_COUNT_, FCN_MIN_, FCN_MAX_, FCN_SUM_}; -private static final String [] otherChoices = {"AND", "OR"}; - - -/** -Constructs a SQLQueryHavingPane object. -**/ -public SQLQueryHavingPane (SQLQueryBuilderPane parent) -{ - super(parent); -} - - -/** -Called when an item in the function list is double-clicked on. -The request is processed, requesting additional information -from the user if needed, and the completed item is added -to the clause. - -@param item The item that was chosen. -**/ -/*private*/ void functionPicked(String item) -{ - // Determine what to add to clause. - String result; - if (item.equals(FCN_COUNT_)) - { - // no extra info needed - result = "COUNT(*)"; - } - else if (item.equals(FCN_SUM_) || item.equals(FCN_MIN_) || - item.equals(FCN_MAX_) || item.equals(FCN_AVG_)) - { - // Show dialog to have user choose field. - String[] choices; - if (item.equals(FCN_SUM_) || item.equals(FCN_AVG_)) - { - // only numeric fields are valid - choices = getNumericFieldNames(); - } - else - { - // all fields are valid - choices = getFieldNames(); - } - if (choices.length ==0) - { - // put up error message and return - JOptionPane.showMessageDialog(this, // parent - ResourceLoader.getQueryText("DBQUERY_MESSAGE_NO_FIELDS") + " " + item + "()", // message - item + "() " + ResourceLoader.getQueryText("DBQUERY_TITLE_ERROR"), // title - JOptionPane.ERROR_MESSAGE ); // message type - return; - } - Object choice = JOptionPane.showInputDialog(this, // parent - ResourceLoader.getQueryText("DBQUERY_TEXT_CHOOSE") + " " + item + "()", // message - item, // title - JOptionPane.QUESTION_MESSAGE, // message type - null, // icon - choices, // choices - choices[0]); // initial choice - if (choice == null) // null means they cancelled - return; - result = item + "(" + choice + ")"; - } - else // must be constant expression - { - result = JOptionPane.showInputDialog(this, // parent - ResourceLoader.getQueryText("DBQUERY_TEXT_CONSTANT"), // message - ResourceLoader.getQueryText("DBQUERY_TITLE_CONSTANT"), // title - JOptionPane.QUESTION_MESSAGE); // message type - if (result == null) // means they cancelled - return; - } - - // Add parenthesis and spaces as needed - if (lastChoice_ == TEST_) // choice is from second function list - { - if (notInEffect_) - result = " " + result + "))"; - else - result = " " + result + ")"; - } - else // choice is from first function list - { - result = "(" + result; - } - - // Add text to clause - clause_.appendText(result); - - // Make appropriate controls available. - if (lastChoice_ == TEST_) - { - otherList_.setEnabled(true); - functionList2_.setEnabled(false); - lastChoice_ = FUNCTION2_; // choice is from second function list - } - else - { - testList_.setEnabled(true); - notList_.setEnabled(false); - functionList_.setEnabled(false); - lastChoice_ = FUNCTION_; // choice is from first function list - } - -} - - - -/** -Returns the sql clause for this panel. -@return The sql clause for this panel. -**/ -public String getClause() -{ - if (clause_ == null) - return null; - return clause_.getText(); -} - - - -/** -Build the panel GUI. -**/ -public void init() -{ - setupPane(); -} - - -/** -Called when an item in the not list is double-clicked on. -The request is processed, the completed item is added -to the clause. - -@param item The item that was chosen. -**/ -/*private*/ void notPicked(String item) -{ - notInEffect_ = true; - - // Add text to clause - clause_.appendText("(" + item); - - // Make appropriate controls available. - notList_.setEnabled(false); - lastChoice_ = NOT_; - -} - - -/** -Called when an item in the other list is double-clicked on. -The request is processed, the completed item is added -to the clause. - -@param item The item that was chosen. -**/ -/*private*/ void otherPicked(String item) -{ - // Add text to clause - clause_.appendText(item); - - // Make appropriate controls available. - notList_.setEnabled(true); - functionList_.setEnabled(true); - otherList_.setEnabled(false); - lastChoice_ = OTHER_; - notInEffect_ = false; -} - - -/** -Builds the panel GUI components and sets up connections -between the components by using listeners. -**/ -protected void setupPane() -{ - super.setupPane(); - - // List box for not - notList_ = new DoubleClickList(notChoices); - notList_.setVisibleRowCount(6); - notList_.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent event) { - notPicked((String)event.getItem()); - } - }); - - // List box for functions - functionList_ = new DoubleClickList(functionChoices); - functionList_.setVisibleRowCount(6); - functionList_.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent event) { - functionPicked((String)event.getItem()); - } - }); - - // List box for test choices. - testList_ = new DoubleClickList(testChoices); - testList_.setVisibleRowCount(6); - testList_.setEnabled(false); - testList_.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent event) { - testPicked((String)event.getItem()); - } - }); - - // List box for functions - functionList2_ = new DoubleClickList(functionChoices2); - functionList2_.setVisibleRowCount(6); - functionList2_.setEnabled(false); - functionList2_.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent event) { - functionPicked((String)event.getItem()); - } - }); - - // List box for others - otherList_ = new DoubleClickList(otherChoices); - otherList_.setVisibleRowCount(6); - otherList_.setEnabled(false); - otherList_.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent event) { - otherPicked((String)event.getItem()); - } - }); - - // Arrange the top row. - Box topRow = Box.createHorizontalBox(); - topRow.add(new LabelledComponent("DBQUERY_LABEL_NOT", notList_)); - topRow.add(new LabelledComponent("DBQUERY_LABEL_FUNCTIONS", functionList_)); - topRow.add(new LabelledComponent("DBQUERY_LABEL_TEST", testList_)); - topRow.add(new LabelledComponent("DBQUERY_LABEL_FUNCTIONS", functionList2_)); - topRow.add(new LabelledComponent("DBQUERY_LABEL_OTHER", otherList_)); - - // Edit area for having clause. - clause_ = new SQLQueryClause(5); - - // Overall layout. - Box overallBox = Box.createVerticalBox(); - overallBox.add(topRow); - overallBox.add(new LabelledComponent("DBQUERY_LABEL_CLAUSE_HAVING", new ScrollingTextPane(clause_))); - setLayout(new BorderLayout()); - add("Center", overallBox); -} - - -/** -Called when an item in the test list is double-clicked on. -The request is processed, the completed item is added -to the clause. - -@param item The item that was chosen. -**/ -/*private*/ void testPicked(String item) -{ - // Add text to clause - clause_.appendText(item); - - // Make appropriate controls available. - functionList2_.setEnabled(true); - testList_.setEnabled(false); - lastChoice_ = TEST_; - -} - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryJoinPane.java b/cvsroot/src/com/ibm/as400/vaccess/SQLQueryJoinPane.java deleted file mode 100644 index b549aa6ee..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryJoinPane.java +++ /dev/null @@ -1,415 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLQueryJoinPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.util.Vector; -import javax.swing.Box; -import javax.swing.ButtonGroup; -import javax.swing.ButtonModel; -import javax.swing.DefaultListModel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.border.TitledBorder; - - - -/** -The SQLQueryJoinPane class represents a panel which allows a -user to dynamically build the JOIN portion of an SQL query. -This panel is used for a page of the SQLQueryBuilderPane notebook. -**/ -class SQLQueryJoinPane -extends SQLQueryFieldsPane -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// The variables and methods which have private commented out -// had to be made package scope since currently Internet Explorer -// does not allow inner class to access private items in their -// containing class. - -/** -Constant indicating an inner join was chosen. -**/ -public static final int INNER_JOIN = 1; -/** -Constant indicating an outer (left) join was chosen. -**/ -public static final int OUTER_JOIN = 2; - -// GUI components -private ButtonGroup joinButtonGroup_; -private JPanel joinButtonPanel_; -private DefaultListModel tableListModel_; -/*private*/ DoubleClickList tableList_; -/*private*/ DoubleClickList testList_; -/*private*/ DoubleClickList otherList_; -/*private*/ JRadioButton innerJoinButton_; -private JRadioButton outerJoinButton_; -private SQLQueryClause clause_; - -// Keeps track of where we are in the clause. -private boolean secondField_ = false; - -// Vector of the text for each join clause. -private Vector clauses_ = new Vector(); -// The clause we are currently working on. -/*private*/ int current_ = 0; -// The clause we are currently working on if outer join. -// Used to save state if user switches between inner and outer. -/*private*/ int currentTable_ = 0; -// Keeps track of where we are in building the clause. -// This tells us which controls to enable/disable. -// 1=choose field #1, 2=choose test, 3=choose field #2 -// 4=choose other -private Vector locationInClause_ = new Vector(); - -static final String [] testChoices = {"=", "<>", "<", ">", "<=", ">="}; -static final String [] otherChoices = {"AND"}; - -/** -Constructs a SQLQueryJoinPane object. -init must be called to build the GUI contents. - -@param parent The parent of this panel. -**/ -public SQLQueryJoinPane (SQLQueryBuilderPane parent) -{ - super(parent); -} - - - -/** -Fills table list model with values, ensures the table vectors have -enough elements. -**/ -private void buildTableList() -{ - String[] tables = parent_.getTables(); - int numTables = tables.length - 1; - tableListModel_.removeAllElements(); - // First line we do the first plus the second table - if (numTables > 0) - { - tableListModel_.addElement(tables[0] + " + " + tables[1]); - } - // Remaining lines we just do the scond table - for (int i = 1; i < numTables; ++i) - { - tableListModel_.addElement("+ " + tables[i+1]); - } - // make sure the vectors contain enough elements - while (clauses_.size() < numTables) - { - clauses_.addElement(""); - locationInClause_.addElement(new Integer(1)); - } -} - - -/** -Saves the last clause. -**/ -public void complete() -{ - // clauses_ may be 0 if there are < 2 tables (pane disabled) - if (clauses_.size() > 0) - clauses_.setElementAt(clause_.getText(), current_); -} - - -/** -Gets the sql clause fo this panel. -@param The index of the join clause to return. -**/ -public String getClause(int index) -{ - if (clause_ == null || clauses_.size() == 0) - return null; - return (String)(clauses_.elementAt(index)); -} - - - -/** -Returns the type of join that should be performed. -@return The type of join that should be performed. -**/ -public int getJoinType() -{ - if (joinButtonGroup_ == null) - return INNER_JOIN; - ButtonModel selection = joinButtonGroup_.getSelection(); - if (selection == innerJoinButton_.getModel()) - return INNER_JOIN; - return OUTER_JOIN; -} - - -/** -Called when an item in the other list is double-clicked on. -The request is processed, and the completed item is added -to the clause. - -@param item The item that was chosen. -**/ -/*private*/ void otherPicked(String item) -{ - // Currently only one item in other list - AND. - // add to clause - clause_.appendText(item); - // disable other list, enable fields - otherList_.setEnabled(false); - fields_.setEnabled(true); - locationInClause_.setElementAt(new Integer(1), current_); -} - - -/** -Adds the field to the clause, enables/disables pane controls. - -@param index Index of the row in the table that was clicked upon. -**/ -protected void rowPicked(int index) -{ - if (((Integer)locationInClause_.elementAt(current_)).intValue() == 1) // first field - { - // Add field to clause - clause_.appendText("(" + fieldName(index)); - - // Enable the appropriate list box. - testList_.setEnabled(true); - locationInClause_.setElementAt(new Integer(2), current_); - } - else // second field - { - // Add field to clause - clause_.appendText(fieldName(index) + ")"); - - // Enable the appropriate list box. - otherList_.setEnabled(true); - locationInClause_.setElementAt(new Integer(4), current_); - } - - // Disable the fields table - fields_.setEnabled(false); -} - - - -/** -Builds the panel GUI components and sets up connections -between the components by using listeners. -**/ -protected void setupPane() -{ - super.setupPane(); - - // Toggle for type of join. - JoinListener_ l = new JoinListener_(); - outerJoinButton_ = new JRadioButton(ResourceLoader.getQueryText("DBQUERY_BUTTON_OUTER_JOIN"), false); - outerJoinButton_.setName("joinOuterButton"); - outerJoinButton_.addActionListener(l); - innerJoinButton_ = new JRadioButton(ResourceLoader.getQueryText("DBQUERY_BUTTON_INNER_JOIN"), true); - innerJoinButton_.setName("joinInnerButton"); - innerJoinButton_.addActionListener(l); - joinButtonGroup_ = new ButtonGroup(); - joinButtonGroup_.add(innerJoinButton_); - joinButtonGroup_.add(outerJoinButton_); - Box buttonBox = Box.createVerticalBox(); - buttonBox.add(innerJoinButton_); - buttonBox.add(outerJoinButton_); - joinButtonPanel_ = new JPanel(); - joinButtonPanel_.setLayout(new BorderLayout()); - joinButtonPanel_.setBorder(new TitledBorder(ResourceLoader.getQueryText("DBQUERY_LABEL_JOIN_TYPE"))); - joinButtonPanel_.add("Center", buttonBox); - - // List box for tables - tableListModel_ = new DefaultListModel(); - buildTableList(); - tableList_ = new DoubleClickList(tableListModel_); - tableList_.setVisibleRowCount(3); - tableList_.setSelectedIndex(current_); - tableList_.setEnabled(false); - tableList_.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent event) { - tablePicked(tableList_.getSelectedIndex()); - } - }); - - // Top row. - Box topRow = Box.createHorizontalBox(); - topRow.add(joinButtonPanel_); - topRow.add(new LabelledComponent("DBQUERY_LABEL_TABLES", tableList_)); - - // List box for test - testList_ = new DoubleClickList(testChoices); - testList_.setEnabled(false); - testList_.setVisibleRowCount(6); - testList_.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent event) { - testPicked((String)event.getItem()); - } - }); - - // List box for others - otherList_ = new DoubleClickList(otherChoices); - otherList_.setEnabled(false); - otherList_.setVisibleRowCount(6); - otherList_.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent event) { - otherPicked((String)event.getItem()); - } - }); - - // Middle row. - Box middleRow = Box.createHorizontalBox(); - middleRow.add(new LabelledComponent("DBQUERY_LABEL_TEST", testList_)); - middleRow.add(new LabelledComponent("DBQUERY_LABEL_OTHER", otherList_)); - - // Text area - clause_ = new SQLQueryClause(5); - - // Layout overall. - Box overallBox = Box.createVerticalBox(); - overallBox.add(topRow); - overallBox.add(fields_); - overallBox.add(middleRow); - overallBox.add(new LabelledComponent("DBQUERY_LABEL_CLAUSE_JOIN", new ScrollingTextPane(clause_))); - setLayout(new BorderLayout()); - add("Center", overallBox); -} - - -/** -Called when an item in the table list is double-clicked on. -The clause and enabled items are updated. - -@param item The item that was chosen. -**/ -/*private*/ void tablePicked(int item) -{ - // Save current clause - complete(); - // Update with new table - clause_.setText((String)clauses_.elementAt(item)); - current_ = item; - // enable appropriate controls - switch(((Integer)locationInClause_.elementAt(item)).intValue()) - { - case 1: // pick field 1 - case 3: // pick field 2 - fields_.setEnabled(true); - testList_.setEnabled(false); - otherList_.setEnabled(false); - break; - case 2: // pick test - fields_.setEnabled(false); - testList_.setEnabled(true); - otherList_.setEnabled(false); - break; - case 4: // pick other - fields_.setEnabled(false); - testList_.setEnabled(false); - otherList_.setEnabled(true); - break; - } -} - - -/** -Called when an item in the test list is double-clicked on. -The request is processed, and the completed item is added -to the clause. - -@param item The item that was chosen. -**/ -/*private*/ void testPicked(String item) -{ - // add to clause - clause_.appendText(item); - // disable test list, enable fields - testList_.setEnabled(false); - fields_.setEnabled(true); - locationInClause_.setElementAt(new Integer(3), current_); -} - - - -/** -Update the field model and table list if needed. -**/ -public void update() -{ - boolean update = fieldsChanged_; // save state before calling super - super.update(); // update field model - if (update) // update table list - { - // rebuild the table list - buildTableList(); - // verify the current indices are in range - if (currentTable_ > parent_.getTables().length - 1) - { - currentTable_ = 0; - if (getJoinType() == OUTER_JOIN) - current_ = currentTable_; - } - tableList_.setSelectedIndex(current_); - } -} - - - - -/** -Class which listens for click on the join type buttons -**/ -private class JoinListener_ -implements ActionListener -{ - public void actionPerformed (ActionEvent event) - { - // check who sent - if (event.getSource() == innerJoinButton_) - { - if (tableList_.isEnabled()) //@B0A - { //@B0A - // disable table list - tableList_.setEnabled(false); - // update the clause with the first join condition - tablePicked(0); - } //@B0A - } - else - { - // enable table list - tableList_.setEnabled(true); - // update the clause with the current join condition - tablePicked(currentTable_); - } - } -} - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryOrderPane.java b/cvsroot/src/com/ibm/as400/vaccess/SQLQueryOrderPane.java deleted file mode 100644 index ce58a01d5..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryOrderPane.java +++ /dev/null @@ -1,247 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLQueryOrderPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.BorderLayout; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import javax.swing.Box; -import javax.swing.JComponent; - - -/** -The SQLQueryOrderPane class represents a panel which allows a -user to dynamically build the ORDER BY portion of an SQL query. -This panel is used for a page of the SQLQueryBuilderPane notebook. -**/ -class SQLQueryOrderPane -extends JComponent -implements Serializable //@B0A - added it for consistency -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// The variables and methods which have private commented out -// had to be made package scope since currently Internet Explorer -// does not allow inner class to access private items in their -// containing class. - -// GUI components -private SQLQueryBuilderPane parent_; -private transient DoubleClickList selectItems_; //@B0C - made transient -/*private*/ DoubleClickList otherList_; -private SQLQueryClause clause_; - -// Indicates if the selected items has changed. -/*private*/ boolean selectChanged_ = false; -// The fields that are selected -private String[] selectFields_; -// Listen to changes in the selected items. -protected SelectListener_ selectListener_ = null; - -//@B0A: Has this table been init()-ed yet? (Used upon de-serialization) -private boolean inited_ = false; //@B0A - -private static final String [] otherChoices = {"ASC", "DESC"}; - -/** -Constructs a SQLQueryOrderPane object. -init must be called to build the GUI contents. - -@param parent The parent of this panel. -**/ -public SQLQueryOrderPane (SQLQueryBuilderPane parent) -{ - super(); - parent_ = parent; - initializeTransient(); //@B0A -} - - - -/** -Returns the sql clause for this panel. -@return The sql clause for this panel. -**/ -public String getClause() -{ - if (clause_ == null) - return null; - return clause_.getText(); -} - - - -/** -Build the panel GUI. -**/ -public void init() -{ - // Add listener to changes to selected items. - selectListener_ = new SelectListener_(); - parent_.addSelectListener(selectListener_); - // Set up GUI. - setupPane(); - inited_ = true; //@B0A - so we know what state we are in if deserialized -} - - -//@B0A -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - addFocusListener(new SerializationListener(this)); // for safe serialization next time - if (inited_) init(); // preserve state of object upon deserialization - } - - -/** -Called when an item in the other list is double-clicked on. -The request is processed, and the completed item is added -to the clause. - -@param item The item that was chosen. -**/ -/*private*/ void otherPicked(String item) -{ - // Add to clause - clause_.appendText(item); - otherList_.setEnabled(false); -} - - -//@B0A -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient(); - } - - -/** -Adds the field to the clause. - -@param index Index of the row in the table that was clicked upon. -**/ -protected void rowPicked() -{ - String item = (String)((Object[])selectItems_.getSelectedObjects())[0]; - clause_.appendTextWithComma(item); - otherList_.setEnabled(true); -} - - -/** -Returns whether the item is a field name. -@return true if the item is a field name, false otherwise. -**/ -private boolean isField(String item) -{ - for (int i=0; i < selectFields_.length; ++i) - { - if (item.equals(selectFields_[i])) - return true; - } - return false; -} - - -/** -Builds the panel GUI components and sets up connections -between the components by using listeners. -**/ -protected void setupPane() -{ - // Select items. - selectFields_ = parent_.getSelectedFields(); - selectItems_ = new DoubleClickList(parent_.getSelectedItems()); - selectItems_.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent event) { - rowPicked(); - } - }); - - // Other list. - otherList_ = new DoubleClickList(otherChoices); - otherList_.setVisibleRowCount(2); - otherList_.setEnabled(false); - otherList_.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent event) { - otherPicked((String)event.getItem()); - } - }); - - // Arrange top row. - Box topRow = Box.createHorizontalBox(); - topRow.add(new LabelledComponent("DBQUERY_COLUMN_SELECT", selectItems_)); - topRow.add(new LabelledComponent("DBQUERY_LABEL_OTHER", otherList_)); - - // Query clause. - clause_ = new SQLQueryClause(5); - - // Overall layout. - Box overallBox = Box.createVerticalBox(); - overallBox.add(topRow); - overallBox.add(new LabelledComponent("DBQUERY_LABEL_CLAUSE_ORDER", new ScrollingTextPane(clause_))); - setLayout(new BorderLayout()); - add("Center", overallBox); -} - - - -/** -Update the selectItems_ if needed. -**/ -public void update() -{ - if (selectChanged_) - { - selectItems_.setListData(parent_.getSelectedItems()); - - // update the selected fields - selectFields_ = parent_.getSelectedFields(); - - selectChanged_ = false; - } -} - - - -/** -Class to listen for property changes on the selected items. -**/ -private class SelectListener_ -implements PropertyChangeListener -{ - public void propertyChange(PropertyChangeEvent event) - { - selectChanged_ = true; - } -} - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLQuerySelectPane.java b/cvsroot/src/com/ibm/as400/vaccess/SQLQuerySelectPane.java deleted file mode 100644 index 70d329e89..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLQuerySelectPane.java +++ /dev/null @@ -1,434 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLQuerySelectPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.BorderLayout; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.StringTokenizer; -import java.util.Vector; -import javax.swing.Box; -import javax.swing.JOptionPane; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; - - -/** -The SQLQuerySelectPane class represents a panel which allows a -user to dynamically build the SELECT portion of an SQL query. -This panel is used for a page of the SQLQueryBuilderPane notebook. -**/ -class SQLQuerySelectPane -extends SQLQueryFieldsPane -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// This class is not meant to be serialized, it should be transient. -// This class has items marked transient even though it is not -// serializable because otherwise errors were received when -// serializing objects that contained this class (even though they -// were transient instances. - -// The variables and methods which have private commented out -// had to be made package scope since currently Internet Explorer -// does not allow inner class to access private items in their -// containing class. - -// GUI components -/*private*/ DoubleClickList functionList_; -/*private*/ SQLQueryClause clause_; - -// Values for list boxes. Note these are not translated. -private static final String FCN_COUNT_ = "COUNT"; -private static final String FCN_SUM_ = "SUM"; -private static final String FCN_AVG_ = "AVG"; -private static final String FCN_MIN_ = "MIN"; -private static final String FCN_MAX_ = "MAX"; - -// List of fields in the select clause. -/*private*/ String[] selectFields_ = new String[0]; -// List of items in the select clause. -/*private*/ String[] selectItems_ = new String[0]; - -// Tracks if the user changed the clause. -/*private*/ boolean changes_ = false; - - -static final String [] functionChoices = {FCN_AVG_, FCN_COUNT_, FCN_MIN_, FCN_MAX_, FCN_SUM_}; - - -// Tracks if this panel has been initialized (setupPane() called). -private boolean init_ = false; - -transient private DocumentListener_ docListener_; - -// We have a separate listener list for panels to listen -// to changes to the selected items. -/*private*/ PropertyChangeSupport selectListeners_ - = new PropertyChangeSupport(this); - - -/** -Constructs a SQLQuerySelectPane object. -init must be called to build the GUI contents. - -@param parent The parent of this panel. -**/ -public SQLQuerySelectPane (SQLQueryBuilderPane parent) -{ - super(parent); - // Add listener to changes to table fields. - parent_.addFieldListener(new FieldListener2_()); -} - - - -/** -Adds a listener to be notified when the selected items have changed. -The listener's propertyChange method will be called. - -@param listener The listener. -**/ -public void addSelectListener (PropertyChangeListener listener) -{ - selectListeners_.addPropertyChangeListener (listener); -} - - -/** -Adds the string to the clause text area. -If the clause is an asterisk, it is removed, otherwise the -text is appended to the clause after a comma separator. - -@param text The string to add to the clause. -**/ -private void addToClause(String text) -{ - if (clause_.getText().equals("*")) - clause_.setText(text); - else - clause_.appendTextWithComma(text); -} - - -/** -Called when an item in the function list is double-clicked on. -The request is processed, requesting additional information -from the user if needed, and the completed item is added -to the clause. - -@param item The item that was chosen. -**/ -/*private*/ void functionPicked(String item) -{ - if (item.equals(FCN_COUNT_)) - { - // add to clause - addToClause("COUNT(*)"); - } - else - // All other functions need a field name. - { - // Show dialog to have user choose field. - String[] choices; - if (item.equals(FCN_SUM_) || item.equals(FCN_AVG_)) - { - // only numeric fields are valid - choices = getNumericFieldNames(); - } - else - { - // all fields are valid - choices = getFieldNames(); - } - if (choices.length ==0) - { - // put up error message and return - JOptionPane.showMessageDialog(this, // parent - ResourceLoader.getQueryText("DBQUERY_MESSAGE_NO_FIELDS") + " " + item + "()", // message - item + "() " + ResourceLoader.getQueryText("DBQUERY_TITLE_ERROR"), // title - JOptionPane.ERROR_MESSAGE ); // message type - return; - } - Object choice = JOptionPane.showInputDialog(this, // parent - ResourceLoader.getQueryText("DBQUERY_TEXT_CHOOSE") + " " + item + "()", // message - item, // title - JOptionPane.QUESTION_MESSAGE, // message type - null, // icon - choices, // choices - choices[0]); // initial choice - if (choice != null) // null means they cancelled - { - addToClause(item + "(" + choice + ")"); - } - } -} - - - -/** -Returns the sql clause for this panel. -@return The sql clause for this panel. -**/ -public String getClause() -{ - if (clause_ == null) - return "*"; - return clause_.getText(); -} - - - -/** -Parse clause to determine the fields selected. -**/ -public void complete() -{ - if (changes_) - { - if (clause_.getText().equals("*")) - { - selectFields_ = getFieldNames(); - selectItems_ = selectFields_; - selectListeners_.firePropertyChange(null, null, null); - } - else - { - // Parse the text area for the field names. - StringTokenizer clause = new StringTokenizer(clause_.getText(), ","); - Vector fields = new Vector(); - Vector items = new Vector(); - String token; - while (clause.hasMoreTokens()) - { - token = clause.nextToken().trim(); - // Add all to items. - items.addElement(token); - // If this is not a function, add to field names - if (!token.startsWith(FCN_COUNT_ + "(") && - !token.startsWith(FCN_SUM_ + "(") && - !token.startsWith(FCN_AVG_ + "(") && - !token.startsWith(FCN_MIN_ + "(") && - !token.startsWith(FCN_MAX_ + "(") ) - fields.addElement(token); - } - String[] newFields = new String[fields.size()]; - fields.copyInto(newFields); - String[] newItems = new String[items.size()]; - items.copyInto(newItems); - - // Determine if the items have changed. - boolean different = false; - if (selectItems_.length == newItems.length) - { - for (int i=0; i < selectItems_.length; ++i) - { - // note even order changes are considered changes - if (!selectItems_[i].equals(newItems[i])) - { - different = true; - break; - } - } - } - else - different = true; - if (different) - { - selectItems_ = newItems; - selectFields_ = newFields; - selectListeners_.firePropertyChange(null, null, null); - } - } - - // Listen for more changes to the tables. - changes_ = false; - } -} - - -/** -Returns the names of the fields in the select clause. - -@return The field names. -**/ -public String[] getSelectedFields() -{ - init(); - update(); - return selectFields_; -} - - -/** -Returns the names of the items (fields and functions) in the select clause. - -@return The field names. -**/ -public String[] getSelectedItems() -{ - init(); - update(); - return selectItems_; -} - - -/** -Only init if not already done, initialize fields selected -to all. -**/ -public void init() -{ - if (!init_) - { - super.init(); // calls setupPane - selectFields_ = getFieldNames(); - selectItems_ = selectFields_; - } -} - - -/** -Adds the field to the clause. - -@param index Index of the row in the table that was clicked upon. -**/ -protected void rowPicked(int index) -{ - addToClause(fieldName(index)); -} - - - -/** -Builds the panel GUI components and sets up connections -between the components by using listeners. -**/ -protected void setupPane() -{ - super.setupPane(); - init_ = true; - - // Functions list. - functionList_ = new DoubleClickList(functionChoices); - functionList_.setVisibleRowCount(5); //@B0A - have more than 5 elements, but do this for consistency with other panes. - functionList_.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent event) { - functionPicked((String)event.getItem()); - } - }); - Box functionsBox = Box.createHorizontalBox(); - functionsBox.add(new LabelledComponent("DBQUERY_LABEL_FUNCTIONS", functionList_)); - functionsBox.add(Box.createHorizontalGlue()); - - // Text area - clause_ = new SQLQueryClause(5); - clause_.setText("*"); - docListener_ = new DocumentListener_(); - clause_.getDocument().addDocumentListener(docListener_); - - // Layout overall. - Box overallBox = Box.createVerticalBox(); - overallBox.add(fields_); - overallBox.add(functionsBox); - overallBox.add(new LabelledComponent("DBQUERY_LABEL_CLAUSE_SELECT", new ScrollingTextPane(clause_))); - setLayout(new BorderLayout()); - add("Center", overallBox); -} - - -/** -Update the document listener if needed. -**/ -public void update() -{ - if (fieldsChanged_) - changes_ = true; - super.update(); - complete(); - docListener_.orderEnabled_ = selectItems_.length==0?false:true; -} - - - -/** -Class for listening to document events. -**/ -private class DocumentListener_ -implements DocumentListener -{ - boolean orderEnabled_ = true; - - public void insertUpdate(DocumentEvent e) - { - changes_ = true; - // If there is a chance we might need to enable the - // order pane, update now. - if (!orderEnabled_ && - (selectItems_.length == 0 || - clause_.getText().equals("*"))) - { - complete(); - if (selectItems_.length != 0) - { - parent_.notebook_.setEnabledAt(parent_.ORDER_, true); - orderEnabled_ = true; - } - } - } - public void changedUpdate(DocumentEvent e) - { - } - public void removeUpdate(DocumentEvent e) - { - changes_ = true; - // If we might need to disable the order pane, update now. - if (orderEnabled_ && clause_.getText().equals("")) - { - complete(); - if (selectItems_.length == 0) - { - parent_.notebook_.setEnabledAt(parent_.ORDER_, false); - orderEnabled_ = false; - } - } - } -} - - -/** -Class to listen for property changes on the fields contained in the -tables associated with the query. -This class needs to listen to changes on the fields if the clause -is "*" in order to notify the selectListeners. -**/ -private class FieldListener2_ -implements PropertyChangeListener -{ - public void propertyChange(PropertyChangeEvent event) - { - if (clause_ == null || clause_.getText().equals("*")) - { - selectFields_ = getFieldNames(); - selectItems_ = selectFields_; - selectListeners_.firePropertyChange(null, null, null); - } - } -} - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLQuerySummaryPane.java b/cvsroot/src/com/ibm/as400/vaccess/SQLQuerySummaryPane.java deleted file mode 100644 index 3b1d639ea..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLQuerySummaryPane.java +++ /dev/null @@ -1,87 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLQuerySummaryPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.JComponent; -import java.awt.BorderLayout; - - - -/** -The SQLQuerySummaryPane class represents a panel which displays -an SQL query in a text pane. The query is not editable. -This panel is used for a page of the SQLQueryBuilderPane notebook. -**/ -class SQLQuerySummaryPane -extends JComponent -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// GUI components -private SQLQueryClause sql_; -private SQLQueryBuilderPane parent_; - - -/** -Constructs a SQLQuerySummaryPane object. -**/ -public SQLQuerySummaryPane (SQLQueryBuilderPane parent) -{ - super(); - parent_ = parent; -} - - - -/** -Build the panel GUI. -**/ -public void init() -{ - setupPane(); - update(); -} - - -/** -Builds the panel GUI components and sets up connections -between the components by using listeners. -**/ -private void setupPane() -{ - // Text Area - sql_ = new SQLQueryClause(20); - sql_.setName("summaryClause"); - sql_.setEditable(false); - - setLayout(new BorderLayout()); - add("Center", new LabelledComponent("DBQUERY_LABEL_SQL", new ScrollingTextPane(sql_))); -} - - - -/** -Update the text with new data. -**/ -public void update() -{ - String sql = parent_.getQuery(); - if (sql == null) - sql_.setText(""); - else - sql_.setText(sql); -} - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryTablePane.java b/cvsroot/src/com/ibm/as400/vaccess/SQLQueryTablePane.java deleted file mode 100644 index 740e4d0df..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLQueryTablePane.java +++ /dev/null @@ -1,873 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLQueryTablePane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.BorderLayout; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.IOException; -import java.io.Serializable; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.StringTokenizer; -import java.util.Vector; -import javax.swing.Box; -import javax.swing.DefaultListModel; -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JDialog; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.ListSelectionModel; -import javax.swing.border.CompoundBorder; -import javax.swing.border.EmptyBorder; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import javax.swing.table.DefaultTableModel; - - -/** -The SQLQueryTablePane class represents a panel which allows a -user to select the tables used to build an SQL query. -This panel is used for a page of the SQLQueryBuilderPane notebook. -**/ -class SQLQueryTablePane -extends JComponent -implements Serializable //@B0A - for consistency -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// In i5/OS language, library = schema, system = catalog. - -// This class is not meant to be serialized, it should be transient. -// This class has items marked transient even though it is not -// serializable because otherwise errors were received when -// serializing objects that contained this class (even though they -// were transient instances. readObject() was added to be safe. - -// The variables and methods which have private commented out -// had to be made package scope since currently Internet Explorer -// does not allow inner class to access private items in their -// containing class. - -// GUI components -private JButton tableButton_ = null; -private JLabel catalog_ = null; -private transient JTable tablesTable_; //@B0C - made transient -private boolean tablesShown_ = false; -private JScrollPane tablesPane_; -/*private*/ SQLQueryClause clause_; -/*private*/ JDialog dialog_; - -// Data for GUI -private String catalogName_ = ""; -private DefaultTableModel tablesTableModel_; - -// List of tables the user has chosen. -private String[] tables_; -/*private*/ String[] schemas_; -/*private*/ boolean userSelectTableSchemas_; -private DefaultListModel schemaListModel_; -transient private Connection connection_; - -// Tracks if the user changed the clause. -/*private*/ boolean changes_ = false; -transient private DocumentListener_ docListener_; - -// Event support. -transient private ErrorEventSupport errors_ = new ErrorEventSupport(this); -transient private WorkingCursorAdapter worker_ = null; // @A2 -transient private WorkingEvent workEvent_ = null; // - -/*private*/ SQLQueryBuilderPane parent_; - -private boolean enabled_ = true; // Whether this pane is enabled -private boolean buttonEnabled_; // Whether the button is enabled - -//@B0A: Has this table been init()-ed yet? (Used upon de-serialization) -private boolean inited_ = false; //@B0A - - -/** -Constructs a SQLQueryTablePane object. - -@param parent The parent of this panel. -@param connection The SQL Connection. -@param tables The tables to initialize the clause with. -@param schemas The schemas to display the tables for. -@param userSelectTableSchemas true if the user is allowed - to change the schemas - whose tables are shown; false otherwise. -**/ -public SQLQueryTablePane (SQLQueryBuilderPane parent, - Connection connection, - String[] tables, - String[] schemas, - boolean userSelectTableSchemas) -{ - super(); - parent_ = parent; - connection_ = connection; - tables_ = tables; - schemas_ = schemas; - userSelectTableSchemas_ = userSelectTableSchemas; - tablesTableModel_ = new DefaultTableModel(){ - public boolean isCellEditable(int row, int column) {return false;} - }; - addFocusListener(new SerializationListener(this)); //@B0A - for safe serialization -} - - -/** -Adds a listener to be notified when an error occurs. -The listener's errorOccurred method will be called. - -@param listener The listener. -**/ -public void addErrorListener (ErrorListener listener) -{ - errors_.addErrorListener(listener); -} - - -/** -Parse clause to determine the tables selected. -**/ -public void complete() -{ - if (changes_) - { - // Parse the text area for the table names. - if (clause_ != null) - { - StringTokenizer clause = new StringTokenizer(clause_.getText(), ","); - Vector tables = new Vector(); - while (clause.hasMoreTokens()) - { - tables.addElement(clause.nextToken().trim()); - } - String[] newTables = new String[tables.size()]; - tables.copyInto(newTables); - - // Determine if the tables have changed. - boolean different = false; - if (tables_.length == newTables.length) - { - for (int i=0; i < tables_.length; ++i) - { - // note even order changes are considered changes - if (!tables_[i].equals(newTables[i])) - { - different = true; - break; - } - } - } - else - different = true; - if (different) - tables_ = newTables; - } - // Listen for more changes to the tables. - changes_ = false; - } -} - - -/** -Set the enabled state of the button. -**/ -private void enableButton(boolean enable) -{ - buttonEnabled_ = enable; - if (enabled_) - tableButton_.setEnabled(enable); -} - - - -/** -Fills the clause with the tables. -**/ -private void fillClause() -{ - // Add tables to the edit area. - if (clause_ != null) - { - if (tables_.length > 0) - { - StringBuffer temp = new StringBuffer(tables_[0]); - for (int i = 1; i0;) - { - tablesTableModel_.removeRow(--i); - } - tablesShown_ = false; - } - - // Get catalog name. - if (connection_ != null) // if null, leave blank - { - enableButton(true); - try - { - catalog_.setText(connection_.getCatalog()); - } - catch(SQLException e) - { - errors_.fireError(e); - } - } - else - enableButton(false); -} - - -/** -Get the list of tables. -**/ -void loadTables() -{ - worker_.startWorking(workEvent_); // @A2 - - if (!tablesShown_) - { - // Change button to function as way to change schemas. - tableButton_.setText(ResourceLoader.getQueryText("DBQUERY_BUTTON_CHANGE_SCHEMAS")); - if (userSelectTableSchemas_) - enableButton(true); - else - enableButton(false); - tablesShown_ = true; - } - - // Remove any old tables. - for (int i = tablesTableModel_.getRowCount(); i>0;) - { - tablesTableModel_.removeRow(--i); - } - - // Add tables to table. - String schema; - ResultSet results = null; - try - { - DatabaseMetaData meta = connection_.getMetaData(); - results = meta.getTableTypes(); - Vector types1 = new Vector(); - while (results.next()) - { - types1.addElement(results.getString(1)); - } - String[] types = new String[types1.size()]; - types1.copyInto(types); - for (int i=0; i 1) // if double click - { - // Get the object that was double clicked, if any. - int tablerow = table2.rowAtPoint(event.getPoint()); - if (tablerow != -1) // -1 means no object under mouse - { - rowPicked(tablerow); - } - } - } - } - ); - - // Edit area for having clause. - clause_ = new SQLQueryClause(5); - - fillClause(); - - // Listen for any changes to the tables. - boolean otherPanesEnabled = tables_.length==0?false:true; - boolean enableOrder = parent_.getSelectedItems().length==0?false:true; - docListener_ = new DocumentListener_(otherPanesEnabled, enableOrder); - clause_.getDocument().addDocumentListener(docListener_); - - // Overall layout. - Box overallBox = Box.createVerticalBox(); - overallBox.add(Box.createVerticalStrut(10)); - overallBox.add(catalogBox); - overallBox.add(Box.createVerticalStrut(10)); - overallBox.add(buttonBox); - overallBox.add(Box.createVerticalStrut(10)); - overallBox.add(tablesPane_); - overallBox.add(Box.createVerticalStrut(10)); - overallBox.add(new LabelledComponent("DBQUERY_LABEL_TABLES", new ScrollingTextPane(clause_))); - setLayout(new BorderLayout()); - add("Center", overallBox); -} - - -/** -Builds the dialog in which the user selects the schemas for which -tables are displayed. -**/ -/*private*/ void setupSchemaDialog() -{ - JLabel prompt = new JLabel(ResourceLoader.getQueryText("DBQUERY_TEXT_SCHEMAS")); - JLabel prompt2 = new JLabel(ResourceLoader.getQueryText("DBQUERY_TEXT_SCHEMAS2")); - - prompt.setBorder(new EmptyBorder(10,10,5,10)); - prompt2.setBorder(new EmptyBorder(5,10,10,10)); - JPanel promptPanel = new JPanel(new BorderLayout()); - promptPanel.add("North",prompt); - promptPanel.add("South",prompt2); - promptPanel.getAccessibleContext().setAccessibleName("PROMPT"); // @A3 - - final JTextField entry = new JTextField(12); - schemaListModel_ = new DefaultListModel(); - for (int i=0; i < schemas_.length; ++i) - { - schemaListModel_.addElement(schemas_[i]); - } - final JList schemas = new JList(schemaListModel_); - JScrollPane listScroll = new JScrollPane(schemas); - schemas.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - final DefaultListModel model = schemaListModel_; - - JButton add = new JButton(ResourceLoader.getQueryText("DBQUERY_BUTTON_ADD")); - add.addActionListener( - new ActionListener(){ - public void actionPerformed(ActionEvent ev) - { - String s = entry.getText(); - if (!s.equals("")) - { - model.addElement(s); - entry.setText(""); - } - } - } // end of ActionListenerAdapter - ); - - JButton remove = new JButton(ResourceLoader.getQueryText("DBQUERY_BUTTON_REMOVE")); - remove.addActionListener( - new ActionListener(){ - public void actionPerformed(ActionEvent ev) - { - int[] selected = schemas.getSelectedIndices(); - for (int i = selected.length; i>0;) - { - model.removeElementAt(selected[--i]); - } - } - } // end of ActionListenerAdapter - ); - - JButton okButton = new JButton(ResourceLoader.getQueryText("DBQUERY_BUTTON_OK")); - okButton.addActionListener( - new ActionListener(){ - public void actionPerformed(ActionEvent ev) - { - Object[] items = model.toArray(); - String[] libs = new String[items.length]; - for (int i = 0; i < items.length; ++i) - { - libs[i] = (String)items[i]; - } - schemas_ = libs; - loadTables(); - // End dialog - dialog_.dispose(); - } - } // end of ActionListenerAdapter - ); - - JButton cancelButton = new JButton(ResourceLoader.getQueryText("DBQUERY_BUTTON_CANCEL")); - cancelButton.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent ev) - { - // Set back the list for next time. - model.removeAllElements(); - for (int i=0; i < schemas_.length; ++i) - { - model.addElement(schemas_[i]); - } - dialog_.dispose(); - } - } - ); - - GridBagLayout layout = new GridBagLayout(); - JPanel body = new JPanel(layout); - body.getAccessibleContext().setAccessibleName("BODY"); // @A3 - GridBagConstraints constraints = new GridBagConstraints(); - constraints.insets = new Insets(5,5,5,5); - VUtilities.constrain (entry, body, layout, constraints, - 0, 1, 100, - 0, 1, 0, - GridBagConstraints.BOTH, GridBagConstraints.CENTER); - VUtilities.constrain (add, body, layout, constraints, - 1, 1, 0, - 0, 1, 0, - GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); - VUtilities.constrain (listScroll, body, layout, constraints, - 0, 1, 100, - 1, 1, 100, - GridBagConstraints.BOTH, GridBagConstraints.CENTER); - VUtilities.constrain (remove, body, layout, constraints, - 1, 1, 0, - 1, 1, 100, - GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); - - JPanel buttonPanel = new JPanel(); - buttonPanel.add(okButton); - buttonPanel.add(cancelButton); - buttonPanel.getAccessibleContext().setAccessibleName("BUTTON"); // @A3 - - dialog_ = new JDialog(VUtilities.getFrame(this), // parent - ResourceLoader.getQueryText("DBQUERY_TITLE_SCHEMAS"), // title - true); // modal - dialog_.getContentPane().setLayout(new BorderLayout()); - dialog_.getContentPane().add("North", promptPanel); - dialog_.getContentPane().add("Center", body); - dialog_.getContentPane().add("South", buttonPanel); - dialog_.addWindowListener( - new WindowAdapter() { - public void windowClosing(WindowEvent ev) - {dialog_.dispose();} - } - ); - dialog_.pack(); - dialog_.setLocationRelativeTo(this); - - // @A3 - dialog_.addFocusListener(new FocusAdapter() - { - public void focusGained(FocusEvent e) - { - // Set default focus in TextField of main body panel. - for (int index=0; index< dialog_.getContentPane().getComponentCount(); index++) { - JComponent inputPanel = (JComponent) dialog_.getContentPane().getComponent(index); - if (inputPanel.getAccessibleContext().getAccessibleName().equals("BODY")) { - // get TextField component and request focus. - for (int i=0; i", "<", ">", "<=", ">=", - TEST_BETWEEN_, TEST_IN_, TEST_NOT_NULL_, TEST_NULL_, TEST_LIKE_}; -private static final String [] otherChoices = {"AND", "OR"}; - -/** -Constructs a SQLQueryWherePane object. -Note init must be called to build the GUI contents. - -@param parent The parent of this panel. -**/ -public SQLQueryWherePane (SQLQueryBuilderPane parent) -{ - super(parent); -} - - -/** -Enables the appropriate controls after a function is chosen. -**/ -void functionComplete() -{ - // Make appropriate controls available. - fields_.setEnabled(false); - notList_.setEnabled(false); - functionList_.setEnabled(false); - testList_.setEnabled(true); -} - - -/** -Called when an item in the function list is double-clicked on. -The request is processed, requesting additional information -from the user if needed, and the completed item is added -to the clause. - -@param item The item that was chosen. -**/ -/*private*/ void functionPicked(String item) -{ - // Variables used when putting up an additional dialog. - String[] choices; // choices for the user - Object choice; // what the user selected - - // ------------------------- - // FCN_CURRENT_ - // ------------------------- - // Current requires a second value for date, time or timestamp. - if (item.equals(FCN_CURRENT_)) - { - choices = new String[]{"DATE", "TIME", "TIMESTAMP"}; - choice = JOptionPane.showInputDialog(this, // parent - item, // message - item, // title - JOptionPane.QUESTION_MESSAGE, // message type - null, // icon - choices, // choices - choices[0]); // initial choice - if (choice == null) // null means they cancelled - return; - String text = "(CURRENT " + choice ; - clause_.appendText(text); - functionComplete(); - } - - // ------------------------- - // FCN_CAST_ - // ------------------------- - // On AS400, cast is only valid at V4R2 or later. - // Cast requires a field name and an SQL type. - else if (item.equals(FCN_CAST_)) - { - choices = getFieldNames(); - if (choices.length ==0) - { - // put up error message and return - noFields(item); - return; - } - list1 = new JComboBox(); - for (int i=0; i< choices.length; ++i) - list1.addItem(choices[i]); - JLabel asLabel = new JLabel("AS"); - list2 = new JComboBox(); - list2.setEditable(true); // allow users to change type - ie CHAR(10) - list2.addItem("CHARACTER()"); - list2.addItem("DATE"); - list2.addItem("DECIMAL(,)"); - list2.addItem("DOUBLE"); - list2.addItem("FLOAT()"); - list2.addItem("GRAPHIC()"); - list2.addItem("INTEGER"); - list2.addItem("NUMERIC(,)"); - list2.addItem("REAL"); - list2.addItem("SMALLINT"); - list2.addItem("TIME"); - list2.addItem("TIMESTAMP"); - list2.addItem("VARCHAR()"); - list2.addItem("VARGRAPHIC()"); - JPanel choicePanel = new JPanel(); - choicePanel.add(list1); - choicePanel.add(asLabel); - choicePanel.add(list2); - - // Create buttons - JButton okButton = new JButton(ResourceLoader.getQueryText("DBQUERY_BUTTON_OK")); - final String fitem = item; - okButton.addActionListener( - new ActionListener(){ - public void actionPerformed(ActionEvent ev) - { - String choice1 = (String)list1.getSelectedItem(); - String choice2 = (String)list2.getSelectedItem(); - if (choice2 == null || choice2.equals("")) - { - // put up error message and return (leave dialog up) - JOptionPane.showMessageDialog(parent_, // parent - ResourceLoader.getQueryText("DBQUERY_MESSAGE_VALUE_MISSING") + " AS", // message - fitem + "() " + ResourceLoader.getQueryText("DBQUERY_TITLE_ERROR"), // title - JOptionPane.ERROR_MESSAGE ); // message type - return; - } - if (choice2.endsWith("()")) - { - // Create dialog for getting one length - String type = choice2.substring(0,choice2.length()-2); - boolean required = type.startsWith("VAR"); - String prompt2; - if (required) - prompt2 = ResourceLoader.getQueryText("DBQUERY_TEXT_LENGTH_REQ"); - else - prompt2 = ResourceLoader.getQueryText("DBQUERY_TEXT_LENGTH"); - boolean error = true; - while (error) - { - String result = JOptionPane.showInputDialog(parent_, // parent - prompt2, // message - type + " " + ResourceLoader.getQueryText("DBQUERY_TITLE_LENGTH"), // title - JOptionPane.QUESTION_MESSAGE ); // message type - if (result.equals("")) - { - if (required) - { - // put up error message - JOptionPane.showMessageDialog(parent_, // parent - ResourceLoader.getQueryText("DBQUERY_MESSAGE_INVALID_INT_VALUE3"), // message - fitem + "() " + ResourceLoader.getQueryText("DBQUERY_TITLE_ERROR"), // title - JOptionPane.ERROR_MESSAGE ); // message type - } - else - { - choice2 = type; // use default length, remove parens - error = false; - } - } - else - { - // verify input is a number - try - { - int i = Integer.parseInt(result); - if (i > 0) error = false; - } - catch(NumberFormatException e) {} - if (error) - { - // put up error message - JOptionPane.showMessageDialog(parent_, // parent - ResourceLoader.getQueryText("DBQUERY_MESSAGE_INVALID_INT_VALUE3"), // message - fitem + "() " + ResourceLoader.getQueryText("DBQUERY_TITLE_ERROR"), // title - JOptionPane.ERROR_MESSAGE ); // message type - } - else - choice2 = type + "(" + result + ")"; // add length - } - } - } - else if (choice2.endsWith("(,)")) - { - // Create dialog for getting the total length (precision). - String type = choice2.substring(0,choice2.length()-3); - boolean error = true; - while (error) - { - String result = JOptionPane.showInputDialog(parent_, // parent - ResourceLoader.getQueryText("DBQUERY_TEXT_LENGTH_TOTAL"), // message - type + " " + ResourceLoader.getQueryText("DBQUERY_TITLE_LENGTH"), // title - JOptionPane.QUESTION_MESSAGE ); // message type - if (result.equals("")) - { - choice2 = type; // use default length, remove parens - error = false; - } - else - { - // verify input is a number - try - { - int i = Integer.parseInt(result); - if (i >= 0) error = false; - } - catch(NumberFormatException e) {} - if (error) - { - // put up error message - JOptionPane.showMessageDialog(parent_, // parent - ResourceLoader.getQueryText("DBQUERY_MESSAGE_INVALID_INT_VALUE3"), // message - fitem + "() " + ResourceLoader.getQueryText("DBQUERY_TITLE_ERROR"), // title - JOptionPane.ERROR_MESSAGE ); // message type - } - else - { - choice2 = type + "(" + result + ")"; // add length - - // Put up second dialog asking for scale (decimal positions) - error = true; - while (error) - { - String result2 = JOptionPane.showInputDialog(parent_, // parent - ResourceLoader.getQueryText("DBQUERY_TEXT_LENGTH_DECIMAL"), // message - type + " " + ResourceLoader.getQueryText("DBQUERY_TITLE_LENGTH"), // title - JOptionPane.QUESTION_MESSAGE ); // message type - if (result2 == null) - { - choice2 = type + "(" + result + ")"; // add one length - error = false; - } - else if (result2.equals("")) - { - choice2 = type + "(" + result + ")"; // add one length - error = false; - } - else - { - // verify input is a number - try - { - int i = Integer.parseInt(result2); - if (i >= 0) error = false; - } - catch(NumberFormatException e) {} - if (error) - { - // put up error message - JOptionPane.showMessageDialog(parent_, // parent - ResourceLoader.getQueryText("DBQUERY_MESSAGE_INVALID_INT_VALUE3"), // message - fitem + "() " + ResourceLoader.getQueryText("DBQUERY_TITLE_ERROR"), // title - JOptionPane.ERROR_MESSAGE ); // message type - } - else - choice2 = type + "(" + result + "," + result2 + ")"; // add two lengths - } - } - } - } - } - } - String text; - /*if (choice2.indexOf("GRAPHIC") == 0 || - choice2.indexOf("VARGRAPHIC") == 0) - // cast to graphic requires CCSID 13488 - text = "(" + fitem + "(" + choice1 + " AS " + choice2 + " CCSID 13488)"; - else*/ - text = "(" + fitem + "(" + choice1 + " AS " + choice2 + ")"; - clause_.appendText(text); - dialog.dispose(); - functionComplete(); - } - } // end of ActionListenerAdapter - ); - JButton cancelButton = new JButton(ResourceLoader.getQueryText("DBQUERY_BUTTON_CANCEL")); - cancelButton.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent ev) - { - dialog.dispose(); - } - } - ); - JPanel buttonPanel = new JPanel(); - buttonPanel.add(okButton); - buttonPanel.add(cancelButton); - - dialog = new JDialog(VUtilities.getFrame(this), item, true); - dialog.getContentPane().setLayout(new BorderLayout()); - - dialog.getContentPane().add("Center",new LabelledComponent(ResourceLoader.getQueryText("DBQUERY_TEXT_CHOOSE2") + " " + item + "()", choicePanel, false)); - dialog.getContentPane().add("South", buttonPanel); - dialog.addWindowListener( - new WindowAdapter() { - public void windowClosing(WindowEvent ev) - { - dialog.dispose(); - } - } - ); - dialog.pack(); - dialog.setLocationRelativeTo(this); - dialog.setVisible(true); - } - - // ------------------------- - // FCN_CHAR_ - // ------------------------- - // Char requires a date, time or timestamp field, and then an - // optional SQL datetime format. - else if (item.equals(FCN_CHAR_)) - { - choices = getDateTimeFieldNames(); - if (choices.length ==0) - { - // put up error message and return - noFields(item); - return; - } - list1 = new JComboBox(); - for (int i=0; i< choices.length; ++i) - list1.addItem(choices[i]); - list2 = new JComboBox(); - list2.addItem(" "); // Blank for no choice - list2.addItem("ISO"); - list2.addItem("USA"); - list2.addItem("EUR"); - list2.addItem("JIS"); - - // Create buttons - JButton okButton = new JButton(ResourceLoader.getQueryText("DBQUERY_BUTTON_OK")); - final String fitem = item; - okButton.addActionListener( - new ActionListener(){ - public void actionPerformed(ActionEvent ev) - { - String choice1 = (String)list1.getSelectedItem(); - String choice2 = (String)list2.getSelectedItem(); - String text; - if (choice2.equals(" ")) - text = "(" + fitem + "(" + choice1 + ")"; - else - text = "(" + fitem + "(" + choice1 + ", " + choice2 + ")"; - clause_.appendText(text); - dialog.dispose(); - functionComplete(); - } - } // end of ActionListenerAdapter - ); - JButton cancelButton = new JButton(ResourceLoader.getQueryText("DBQUERY_BUTTON_CANCEL")); - cancelButton.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent ev) - { - dialog.dispose(); - } - } - ); - JPanel buttonPanel = new JPanel(); - buttonPanel.add(okButton); - buttonPanel.add(cancelButton); - - dialog = new JDialog(VUtilities.getFrame(this), item, true); - dialog.getContentPane().setLayout(new BorderLayout()); - JPanel listPanel = new JPanel(); - listPanel.add(list1); - listPanel.add(list2); - dialog.getContentPane().add("Center", new LabelledComponent(ResourceLoader.getQueryText("DBQUERY_TEXT_CHOOSE2") + " " + item + "()", listPanel, false)); - dialog.getContentPane().add("South", buttonPanel); - dialog.addWindowListener( - new WindowAdapter() { - public void windowClosing(WindowEvent ev) - {dialog.dispose();} - } - ); - dialog.pack(); - dialog.setLocationRelativeTo(this); - dialog.setVisible(true); - } - - // ------------------------- - // FCN_SUBSTR_ - // ------------------------- - // Substring requires a character field name, start index, and stop index. - else if (item.equals(FCN_SUBSTR_)) - { - // Substring requires a character field name and then two numbers - // for the start and end. We use the FROM/FOR syntax, so it - // looks like this: "SUBSTRING( FROM 2 FOR 6) - // The FOR part is optional. - choices = getCharacterFieldNames(); - if (choices.length ==0) - { - // put up error message and return - noFields(item); - return; - } - list1 = new JComboBox(); - for (int i=0; i< choices.length; ++i) - list1.addItem(choices[i]); - final String fieldFROM = "FROM"; - final String fieldFOR = "FOR"; - JLabel fromLabel = new JLabel(fieldFROM); - JLabel forLabel = new JLabel(fieldFOR); - textField1 = new JTextField("1", 3); - textField2 = new JTextField(3); - JPanel choicePanel = new JPanel(); - choicePanel.add(list1); - choicePanel.add(fromLabel); - choicePanel.add(textField1); - choicePanel.add(forLabel); - choicePanel.add(textField2); - - // Create buttons - JButton okButton = new JButton(ResourceLoader.getQueryText("DBQUERY_BUTTON_OK")); - final String fitem = item; - okButton.addActionListener( - new ActionListener(){ - public void actionPerformed(ActionEvent ev) - { - String choice1 = (String)list1.getSelectedItem(); - String choice2 = textField1.getText().trim(); - String choice3 = textField2.getText().trim(); - String text; - if (choice2.equals("")) - { - // put up error message and return (leave dialog up) - JOptionPane.showMessageDialog(parent_, // parent - ResourceLoader.getQueryText("DBQUERY_MESSAGE_VALUE_MISSING") + " " + fieldFROM, // message - fitem + "() " + ResourceLoader.getQueryText("DBQUERY_TITLE_ERROR"), // title - JOptionPane.ERROR_MESSAGE ); // message type - return; - } - else - { - // verify input is a number - boolean error = false; - try - { - int i = Integer.parseInt(choice2); - if (i<1) error = true; - } - catch(NumberFormatException e) {error = true;} - if (error) - { - // put up error message and return (leave dialog up) - JOptionPane.showMessageDialog(parent_, // parent - fieldFROM + " " + ResourceLoader.getQueryText("DBQUERY_MESSAGE_INVALID_INT_VALUE2"), // message - fitem + "() " + ResourceLoader.getQueryText("DBQUERY_TITLE_ERROR"), // title - JOptionPane.ERROR_MESSAGE ); // message type - return; - } - } - if (choice3.equals("")) - text = fitem + "(" + choice1 + " FROM " + choice2 + ")"; - else - { - // verify input is a number - boolean error = false; - try - { - int i = Integer.parseInt(choice3); - if (i<0) error = true; - } - catch(NumberFormatException e) {error = true;} - if (error) - { - // put up error message and return (leave dialog up) - JOptionPane.showMessageDialog(parent_, // parent - fieldFOR + " " + ResourceLoader.getQueryText("DBQUERY_MESSAGE_INVALID_INT_VALUE"), // message - fitem + "() " + ResourceLoader.getQueryText("DBQUERY_TITLE_ERROR"), // title - JOptionPane.ERROR_MESSAGE ); // message type - return; - } - text = fitem + "(" + choice1 + " FROM " + choice2 + " FOR " + choice3 + ")"; - } - clause_.appendText("(" + text); - dialog.dispose(); - functionComplete(); - } - } // end of ActionListenerAdapter - ); - JButton cancelButton = new JButton(ResourceLoader.getQueryText("DBQUERY_BUTTON_CANCEL")); - cancelButton.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent ev) - { - dialog.dispose(); - } - } - ); - JPanel buttonPanel = new JPanel(); - buttonPanel.add(okButton); - buttonPanel.add(cancelButton); - - dialog = new JDialog(VUtilities.getFrame(this), item, true); - dialog.getContentPane().setLayout(new BorderLayout()); - dialog.getContentPane().add("Center",new LabelledComponent(ResourceLoader.getQueryText("DBQUERY_TEXT_CHOOSE2") + " " + item + "()", - choicePanel, false)); - dialog.getContentPane().add("South", buttonPanel); - dialog.addWindowListener( - new WindowAdapter() { - public void windowClosing(WindowEvent ev) - {dialog.dispose();} - } - ); - dialog.pack(); - dialog.setLocationRelativeTo(this); - dialog.setVisible(true); - } - - // ------------------------- - // FCN_TIMESTAMP_ - // ------------------------- - // Timestamp requires either a timestamp field or a date field and - // a time field. - else if (item.equals(FCN_TIMESTAMP_)) - { - // Make two panels, one for choosing a 1 date and 1 time field, - // the other for choosing a timestamp field. Have radio - // buttons to switch between the panes. Disable the pane and - // button if the appropriate fields do not exist. - - // Get fields for each list. - String[] dateFields = getFieldNamesOfType(Types.DATE); - String[] timeFields = getFieldNamesOfType(Types.TIME); - String[] timestampFields = getFieldNamesOfType(Types.TIMESTAMP); - // Verify there are fields appropriate for this function - boolean pane1valid = !(dateFields.length == 0 || timeFields.length == 0); - boolean pane2valid = !(timestampFields.length == 0); - if (!pane1valid && !pane2valid) - { - // put up error message and return - noFields(item); - return; - } - - dialog = new JDialog(VUtilities.getFrame(this), item, true); - dialog.getContentPane().setLayout(new BorderLayout()); - JPanel choicePane = new JPanel(new BorderLayout()); - pane1Active = pane1valid; // switch for which pane active; - JRadioButton pane1Button=null, pane2Button; - // Make first panel for date and time fields - if (pane1valid) - { - JPanel pane1 = new JPanel(new BorderLayout()); - pane1.setBorder(new CompoundBorder( - new EmptyBorder(10,10,10,10), - new CompoundBorder(LineBorder.createBlackLineBorder(), - new EmptyBorder(10,10,10,10)))); - if (pane2valid) // need buttons only if both panes valid - { - pane1Button = new JRadioButton( - ResourceLoader.getQueryText("DBQUERY_BUTTON_TIMESTAMP_2_FIELDS"), true); - pane1Button.setBorder(new EmptyBorder(0,10,10,10)); - pane1Button.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent ev) - { - list1.setEnabled(true); - list2.setEnabled(true); - list3.setEnabled(false); - pane1Active = true; - } - } - ); - pane1.add("North", pane1Button); - } - list1 = new JComboBox(); - for (int i=0; iThe data is retrieved from the system when load() is called. - -

    It is up to the user to call close() when the -result set is no longer needed. - -

    Most errors are reported by firing ErrorEvents, rather -than throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    SQLResultSetData objects generate the following events: -

      -
    • ErrorEvent -
    • WorkingEvent -
    -**/ -// Note that this class throws events from within synchronized blocks, -// which could cause hangs if the handlers of these events do -// operations from a different thread an attempt to access another -// synchronized piece of code. -// At this time this seems to be an acceptable risk, since the -// events thrown are not likely to need enough processing to -// require another thread, and getting having the events thrown -// from outside a sychronized block would be nearly impossible. -// The other option is to have the firing of the events be done -// from another thread, but the overhead of creating another thread -// not only takes resources, but also delays the delivery of the event. -class SQLResultSetData -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// What this result set represents -private SQLConnection connection_ = null; -private String query_ = null; - -// The result set information -transient private Object[][] data_ = null; // the result set data -transient private ResultSet resultSet_ = null; // result set for this data -transient private Statement stmt_ = null; -transient private boolean resourceOpen_ = false;// jdbc resources open - -// Column information -transient private int numColumns_ = 0; -transient private ResultSetMetaData resultSetMetaData_ = null; // describes result set columns - -// Row information -// Number of rows data_ is bumped by when more space needed. 100 is arbitrary. -private static int ROW_INCREMENT_ = 100; -// Number of rows in the table. Always 0 until allRecordsRead_ = true. -transient private int numRows_ = 0; -// The index of the last record read. Up to this row is valid in data_. -transient private int lastRecordRead_ = -1; -// If all records in resultSet_ have been transferred to data_. -transient private boolean allRecordsRead_ = true; - -// Warnings -transient private SQLWarning warnings_; - -// Flag for if an error event was sent. -transient private boolean error_; - -// Event support. -transient private ErrorEventSupport errorListeners_ - = new ErrorEventSupport (this); -transient private WorkingEventSupport workingListeners_ - = new WorkingEventSupport (this); - -private boolean fireWorkingEvents_ = true; - -/** -Constructs a SQLResultSetData object. -**/ -public SQLResultSetData () -{ - super(); -} - - -/** -Adds a listener to be notified when an error occurs. -The listener's errorOccurred method will be called. - -@param listener The listener. -**/ -public void addErrorListener (ErrorListener listener) -{ - errorListeners_.addErrorListener (listener); -} - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ -public void addWorkingListener (WorkingListener listener) -{ - workingListeners_.addWorkingListener (listener); -} - - -/** -Closes the JDBC resources. -**/ -synchronized public void close () -{ - if (resourceOpen_) - { - try - { - resultSet_.close(); - } - catch (SQLException e) - { - errorListeners_.fireError(e); - } - } - if (stmt_ != null) - { - try - { - stmt_.close(); - } - catch (SQLException e) - { - errorListeners_.fireError(e); - } - } - resourceOpen_ = false; -} - - - -/** -Clears all SQL warnings. -**/ -public void clearWarnings () -{ - warnings_ = null; - if (resultSet_ != null) - { - try - { - resultSet_.clearWarnings(); - } - catch (SQLException e) - { - errorListeners_.fireError(e); - } - } -} - - -/** -Returns whether all records have been processed (stored in a local -cache). - -@return true if all records have been processed; false otherwise. -**/ -synchronized public boolean getAllRecordsProcessed () -{ - return allRecordsRead_; -} - - - -/** -Returns the display size for the column at the specified index. -Indices start at 0. - -@param index Index of the column. -@return The display size for the column. -**/ -synchronized public int getColumnDisplaySize(int index) -{ - if (resultSet_ == null) - { - throw new IndexOutOfBoundsException("index"); - } - - int result = 0; - try - { - // For most types, we just consult with JDBC. However, for times, dates, and @C1A - // timestamps, JDBC reports the display size for the server format. And these @C1A - // GUIs actually internationalize the Strings before displaying them. So for @C1A - // these types, we need to compute our own display sizes. @C1A - switch(resultSetMetaData_.getColumnType(index+1)) { // @C1A - case Types.TIME: // @C1A - result = DBDateCellRenderer.getDisplaySize(DBDateCellRenderer.FORMAT_TIME); // @C1A - break; // @C1A - case Types.DATE: // @C1A - result = DBDateCellRenderer.getDisplaySize(DBDateCellRenderer.FORMAT_DATE); // @C1A - break; // @C1A - case Types.TIMESTAMP: // @C1A - result = DBDateCellRenderer.getDisplaySize(DBDateCellRenderer.FORMAT_TIMESTAMP);// @C1A - break; // @C1A - default: // @C1A - result = resultSetMetaData_.getColumnDisplaySize(index+1); - } // @C1A - } - catch (SQLException e) - { - errorListeners_.fireError(e); - } - return result; -} - - - -/** -Returns the label for the column at the specified index. -Indices start at 0. - -@param index Index of the column. -@return The label for the column. -**/ -synchronized public String getColumnLabel(int index) -{ - if (resultSet_ == null) - { - throw new IndexOutOfBoundsException("index"); - } - - try - { - return resultSetMetaData_.getColumnLabel(index+1); - } - catch (SQLException e) - { - errorListeners_.fireError(e); - return ""; - } -} - - -/** -Returns the name for the column at the specified index. -Indices start at 0. - -@param index Index of the column. -@return The name for the column. -**/ -synchronized public String getColumnName(int index) -{ - if (resultSet_ == null) - { - throw new IndexOutOfBoundsException("index"); - } - - try - { - return resultSetMetaData_.getColumnName(index+1); - } - catch (SQLException e) - { - errorListeners_.fireError(e); - return ""; - } -} - - -/** -Returns the SQL type of the data in this column. -Indices start at 0. - -@param index Index of the column. -@return The SQL type of data in this column. -**/ -synchronized public int getColumnType(int index) -{ - if (resultSet_ == null) - { - throw new IndexOutOfBoundsException("index"); - } - - try - { - return resultSetMetaData_.getColumnType(index+1); - } - catch (SQLException e) - { - errorListeners_.fireError(e); - return Types.CHAR; - } -} - - - -/** -Returns the SQL connection used when load() is called.. - -@return The SQL connection. -**/ -public SQLConnection getConnection() -{ - return connection_; -} - - - -/** -Returns the index of the last record which had been processed (tored -in the local cache). -1 indicates no records have been -processed. - -@return The index of the last record processed. -**/ -synchronized public int getLastRecordProcessed () -{ - return lastRecordRead_; -} - - -/** -Returns the number of fields in this result set. -If an error occurs, 0 is returned. - -@return The number of fields in this result set. -**/ -synchronized public int getNumberOfColumns() -{ - return numColumns_; -} - - -/** -Returns the number of rows in the result set. - -@return The number of rows in the result set. -**/ -synchronized public int getNumberOfRows() -{ - if (!allRecordsRead_) - { - readAllRecords(); - } - return numRows_; -} - - -/** -Returns the SQL query used to get the result set when load() -is called. - -@return The SQL query. -**/ -public String getQuery () -{ - return query_; -} - - - -/** -Returns the value at the specifed column and row. -Indices start at 0. -If an error occurs, an empty string is returned. - -@param rowIndex The row index. -@param columnIndex The column index. -@return The value at the specified column and row. -**/ -synchronized public Object getValueAt (int rowIndex, - int columnIndex) -{ - if (resultSet_ == null) - { - throw new IndexOutOfBoundsException("rowIndex"); - } - - // If we haven't yet transferred this row from the - // result set to the table cache, do so. - if (lastRecordRead_ < rowIndex) - { - readMoreRecords(rowIndex - lastRecordRead_); - } - if (lastRecordRead_ < rowIndex) - { - throw new IndexOutOfBoundsException("rowIndex"); - } - - // return the value - return data_[rowIndex][columnIndex]; -} - - -/** -Returns the warnings generated by the SQL connection, statement, and -result set. -Warnings are cleared when load or clearWarnings -is called. -The warnings from the result set will be -linked to the end of any statement warnings, which in turn are linked -to the end of any connection warnings. - -@return The warnings generated by the connection, statement, and -result set, or null if none. -**/ -synchronized public SQLWarning getWarnings () -{ - SQLWarning result = null; - // If no result set, we are not in a state to have warnings. - if (resultSet_ != null) - { - // get result set warnings - SQLWarning rs_warnings = null; - try - { - rs_warnings = resultSet_.getWarnings(); - } - catch (SQLException e) - { - // pass on error, but continue - errorListeners_.fireError(e); - } - // If connection or statement warnings... - if (warnings_ != null) - { - if (rs_warnings != null) - { - // We have both connection and statement warnings. - // Find the last warning in the connection chain. - SQLWarning last = warnings_; - SQLWarning next; - while ((next = last.getNextWarning()) != null) - { - last = next; - } - // Add statement warnings to the end of connection chain. - last.setNextWarning(rs_warnings); - } - result = warnings_; - } - else - { - // otherwise, just return result set warnings - result = rs_warnings; - } - } - return result; -} - - -/** -Loads the table based on the state of the system. This causes the -query to be run. -**/ -synchronized public void load () -{ - Trace.log(Trace.DIAGNOSTIC, "Doing data load."); - - if (connection_ == null || query_ == null) - { - Trace.log(Trace.DIAGNOSTIC, "Data not set for load, exiting."); - return; - } - - if (fireWorkingEvents_) - workingListeners_.fireStartWorking (); - - // cleanup old data - if (resourceOpen_) - { - try - { - resultSet_.close(); - // leave statement open - } - catch (SQLException e) - { - errorListeners_.fireError(e); - } - resourceOpen_ = false; - } - - // Set back fields in case there is an error. - resultSetMetaData_ = null; - numColumns_ = 0; - lastRecordRead_ = -1; - allRecordsRead_ = true; - data_ = null; - numRows_ = 0; - - // get data - try - { - // Create statement - if (stmt_ == null) - { - Connection conn = connection_.getConnection(); - stmt_ = conn.createStatement(); - // Save warnings from connection. - try - { - warnings_ = conn.getWarnings(); - } - catch (SQLException e) - { // pass on errors but continue - errorListeners_.fireError(e); - } - } - // Get result set - resultSet_ = stmt_.executeQuery(query_); - resourceOpen_ = true; - // Save warnings from statement. - try - { - SQLWarning s_warnings = stmt_.getWarnings(); - if (s_warnings != null) - { - if (warnings_ == null) - { - // statement warnings but no connection warnings - warnings_ = s_warnings; - } - else - { - // We have both connection and statement warnings. - // Find the last warning in the connection chain. - SQLWarning last = warnings_; - SQLWarning next; - while ((next = last.getNextWarning()) != null) - { - last = next; - } - // Add statement warnings to the end of connection chain. - last.setNextWarning(s_warnings); - } - } - } - catch (SQLException e) - { // pass on errors but continue - errorListeners_.fireError(e); - } - - // get info about the columns returned - resultSetMetaData_ = resultSet_.getMetaData(); - numColumns_ = resultSetMetaData_.getColumnCount(); - - // Move cursor to first record in result set. - // Note that if we can't get to first record, we scrap - // everything and fail. - if (!resultSet_.next()) - { - // no records - try - { - resultSet_.close(); - } - catch(SQLException e) - { - // pass on error, continue - errorListeners_.fireError(e); - } - } - else // there are records, but we don't know how many - { - allRecordsRead_ = false; - // Create new array to hold table values. - data_ = new Object[ROW_INCREMENT_][numColumns_]; - } - } - catch (SQLException e) - { - // In case of error, set fields to init state - resultSet_ = null; - resultSetMetaData_ = null; - numColumns_ = 0; - errorListeners_.fireError(e); - error_ = true; - } - - // Note we don't process any of the result set until the - // values are asked for. - - if (fireWorkingEvents_) - workingListeners_.fireStopWorking (); -} - - - -/** -Processes records in the result set, moving the data into local cache -so they can be retrieved via getValueAt. -**/ -synchronized public void readAllRecords() -{ - Trace.log(Trace.DIAGNOSTIC, "Reading all rows."); - workingListeners_.fireStartWorking (); - error_ = false; - while (!allRecordsRead_ && !error_) - { - fireWorkingEvents_ = false; - readMoreRecords(ROW_INCREMENT_); - fireWorkingEvents_ = true; - } - workingListeners_.fireStopWorking (); -} - - -/** -Processes records in the result set, moving the data into local cache -so they can be retrieved via getValueAt. - -@param numberToRead The number of records to process. -**/ -synchronized public void readMoreRecords(int numberToRead) -{ - Trace.log(Trace.DIAGNOSTIC, "Reading more rows:", numberToRead); - if (fireWorkingEvents_) - workingListeners_.fireStartWorking (); - - error_ = false; - // read only load done & more records to read - if (!allRecordsRead_) - { - // Make sure we have room in data_ for records. - if (lastRecordRead_ + numberToRead >= data_.length) - { - // increase by the greater of our increment or the number - // of rows needed. - int sizeNeeded = lastRecordRead_ + numberToRead + 1; - int increment = ROW_INCREMENT_>sizeNeeded?ROW_INCREMENT_:sizeNeeded; - Object[][] newData = - new Object[data_.length + increment][numColumns_]; - System.arraycopy(data_, 0, newData, 0, data_.length); - data_ = newData; - } - - // Try to avoid sending many errors if they are all the same. - java.util.Vector errors = null; - boolean dupErr; - for (int i=1; i<=numberToRead; ++i) - { - for (int j=1; j<=numColumns_; ++j) - { - try - { - // Note resultSet_ is always valid since load() - // and this loop ensure the next record is valid - // but do not transfer the data into data_. - data_[lastRecordRead_+1][j-1] = resultSet_.getObject(j); - } - catch (SQLException e) - { - // We don't set error_=true, since we are - // continuing to process, and are not aborting. - data_[lastRecordRead_+1][j-1] = null; // set data to null - // Don't send this error if it is a duplicate. - dupErr = false; - if (errors == null) // this is the first error - { - errors = new java.util.Vector(); - errors.addElement(e); - } - else // we have had previous errors, look for duplicate - { - SQLException e1; - for (int k=0; k< errors.size(); ++k) - { - e1 = (SQLException)errors.elementAt(k); - if (e.getSQLState().equals(e1.getSQLState()) && - e.getErrorCode() == e1.getErrorCode() && - e.getMessage().equals(e1.getMessage())) - { - dupErr = true; - Trace.log(Trace.DIAGNOSTIC, - "Duplicate error getting column value, swallowing error: " + - e.getSQLState() +" : "+ e.getErrorCode() +" : "+ e.getMessage()); - break; - } - } - errors.addElement(e); - } - if (!dupErr) - errorListeners_.fireError(e); - } - } - ++lastRecordRead_; - // Move cursor to next record. - boolean valid = false; - try - { - valid = resultSet_.next(); - } - catch(SQLException e) - { - errorListeners_.fireError(e); - error_ = true; - valid = false; - } - if (!valid) - { - // No more records or error reading next record. - allRecordsRead_ = true; - try - { - resultSet_.close(); - resourceOpen_ = false; - // leave statement open - } - catch(SQLException e) - { - // fire error, continue - errorListeners_.fireError(e); - } - numRows_ = lastRecordRead_+1; - break; - } - } - } // end if able to read records - - if (fireWorkingEvents_) - workingListeners_.fireStopWorking (); -} - - -/** -Restore the state of this object from an object input stream. -It is used when deserializing an object. -@param in The input stream of the object being deserialized. -@exception IOException -@exception ClassNotFoundException -**/ -private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException -{ - // Restore the non-static and non-transient fields. - in.defaultReadObject(); - // Initialize the transient fields. - data_ = null; - resultSet_ = null; - stmt_ = null; - resourceOpen_ = false; - numColumns_ = 0; - resultSetMetaData_ = null; - numRows_ = 0; - lastRecordRead_ = -1; - allRecordsRead_ = true; - errorListeners_ = new ErrorEventSupport (this); - workingListeners_ = new WorkingEventSupport (this); -} - - -/** -Removes a listener from being notified when an error occurs. - -@param listener The listener. -**/ -public void removeErrorListener (ErrorListener listener) -{ - errorListeners_.removeErrorListener (listener); -} - - -/** -Removes a listener from being notified when work starts and stops. - -@param listener The listener. -**/ -public void removeWorkingListener (WorkingListener listener) -{ - workingListeners_.removeWorkingListener (listener); -} - -/** -Constructs a SQLResultSetData object. -The new attribute won't go into effect until load(). - -@param connection The SQL connection. -**/ -public void setConnection(SQLConnection connection) -{ - if (connection != connection_) - { - connection_ = connection; - if (stmt_ != null) - { - try - { - stmt_.close(); - } - catch (SQLException e) - { - errorListeners_.fireError(e); - } - } - stmt_ = null; - warnings_ = null; - } -} - -/** -Constructs a SQLResultSetData object. -The new attribute won't go into effect until load(). - -@param query The SQL query. -**/ -public void setQuery(String query) -{ - query_ = query; -} - - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetFormPane.java b/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetFormPane.java deleted file mode 100644 index 29ec14af4..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetFormPane.java +++ /dev/null @@ -1,931 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLResultSetFormPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.ActionCompletedListener; -import com.ibm.as400.access.ActionCompletedEvent; -import javax.swing.SwingConstants; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JComponent; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.border.EmptyBorder; -import java.awt.BorderLayout; -import java.awt.FlowLayout; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.Serializable; -import java.sql.SQLWarning; -import java.sql.Statement; -import java.sql.Types; - - - -/** -The SQLResultSetFormPane class represents a form that is filled in with the -result set generated by a SQL query using JDBC. The -form displays one record of the result set at a time and provides -buttons that allow the user to scroll forward, -backward, to the first or last record, or refresh the -view of the result set. - -

    The data in the form is retrieved from the system -(and the GUI fields for the data are created) -when load() is called. If load() is not called, -the form will be empty. - -

    It is up to the user to register a JDBC driver when using this class. -For example, the following code registers the IBM Toolbox for Java -JDBC driver. -

    -   DriverManager.registerDriver (new com.ibm.as400.access.AS400JDBCDriver ());
    -
    - -

    Users should call close() to ensure that the result set -is closed when this table is no longer needed. close() should -also be called on the SQLConnection object as well to close the connection. - -

    Most errors are reported by firing ErrorEvents, rather -than throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    SQLResultSetFormPane objects generate the following events: -

      -
    • ActionCompletedEvent -
    • ErrorEvent -
    • PropertyChangeEvent -
    - -
    -// Register JDBC driver.
    -DriverManager.registerDriver (new com.ibm.as400.access.AS400JDBCDriver ());
    -
    - // Set up table for result set contents.
    -final SQLConnection connection = new SQLConnection("jdbc:as400://MySystem", "Userid", "Password");
    -String query = "SELECT * FROM MYLIB.MYTABLE";
    -final SQLResultSetFormPane pane = new SQLResultSetFormPane(connection, query);
    -
    - // Set up window to hold table
    -JFrame frame = new JFrame ("My Window");
    -WindowListener l = new WindowAdapter()
    -{
    -     // Close the pane when window is closed.
    -    public void windowClosing(WindowEvent e)
    -    {
    -        pane.close();
    -        connection.close();
    -    }
    -};
    -frame.addWindowListener(l);
    -
    -// Set up the error dialog adapter.
    -pane.addErrorListener (new ErrorDialogAdapter (frame));
    -
    -// Add the component and get data from system.
    -frame.getContentPane().add(pane);
    -pane.load();
    -
    - // Display the window
    -frame.setVisible(true)
    -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class SQLResultSetFormPane -extends JComponent -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// The variables which have private commented out had to made -// package scope since currently Internet Explorer does not -// allow inner class to access private variables in their -// containing class. - -// Label for the record number. -transient private JLabel recordLabel_; //@B0C - made transient -// Label for the record number. -transient private JLabel recordNumber_; //@B0C - made transient -// Button for moving to the first record. -/*private*/ transient JButton firstButton_; //@B0C - made transient -// Button for moving to the last record. -/*private*/ transient JButton lastButton_; //@B0C - made transient -// Button for moving to the next record. -/*private*/ transient JButton nextButton_; //@B0C - made transient -// Button for moving to the previous record. -/*private*/ transient JButton previousButton_; //@B0C - made transient -// Button for refreshing the result set. -/*private*/ transient JButton refreshButton_; //@B0C - made transient -// Labels for the description of each field. -transient private JLabel[] labels_ = new JLabel[0]; -// Textfields for the value of each field. -transient private JTextField[] values_ = new JTextField[0]; -// Formatters for the value of each field. -transient private DBCellRenderer[] formatter_ = new DBCellRenderer[0]; -// Status line. Used for errors. -private JLabel status_; -// Panel used for center data area. -private JPanel dataArea_; - -// Renderers for the different types of data, textfields use these. -private DBCellRenderer leftCell_ = new DBCellRenderer(SwingConstants.LEFT); -private DBDateCellRenderer dateCell_ = new DBDateCellRenderer(DBDateCellRenderer.FORMAT_DATE); -private DBDateCellRenderer timeCell_ = new DBDateCellRenderer(DBDateCellRenderer.FORMAT_TIME); -private DBDateCellRenderer timestampCell_ = new DBDateCellRenderer(DBDateCellRenderer.FORMAT_TIMESTAMP); -// General types of data in columns. Used to determine column renderer. -private static final int TYPE_CHAR = 1; -private static final int TYPE_TIME = 2; -private static final int TYPE_TIMESTAMP = 3; -private static final int TYPE_DATE = 4; -private static final int TYPE_BIT = 5; - - -// Event support. -transient private ActionCompletedEventSupport actionListeners_ - = new ActionCompletedEventSupport (this); -transient /*private*/ ErrorEventSupport errorListeners_ - = new ErrorEventSupport (this); - - -// Result set data -transient int current_ = -1; // Record being shown. Range is 0 to numRows-1. -private SQLResultSetData tableData_ = new SQLResultSetData(); - -// Flag for if an error event was sent. -transient /*private*/ boolean error_; - -// Adapter for listening for working events and enabling working cursor. -transient private WorkingCursorAdapter worker_ - = new WorkingCursorAdapter(this); - - - -/** -Constructs a SQLResultSetFormPane object. -**/ -public SQLResultSetFormPane () -{ - super(); - - //@B0A - // We add a fake FocusListener whose real purpose is to uninstall - // the UI early so the JTable that is part of our UI does not try - // to get serialized. - // See also: source code for javax.swing.JComponent in JDK 1.2. - addFocusListener(new SerializationListener(this)); //@B0A - - // Add self as listener for errors and work events - tableData_.addErrorListener(new ErrorListener_()); - tableData_.addWorkingListener(worker_); - - init(); -} - - - -/** -Constructs a SQLResultSetFormPane object. - -@param connection The SQL connection. -@param query The SQL query. -**/ -public SQLResultSetFormPane (SQLConnection connection, - String query) -{ - super(); - if (connection == null) - throw new NullPointerException("connection"); - if (query == null) - throw new NullPointerException("query"); - - //@B0A - // We add a fake FocusListener whose real purpose is to uninstall - // the UI early so the JTable that is part of our UI does not try - // to get serialized. - // See also: source code for javax.swing.JComponent in JDK 1.2. - addFocusListener(new SerializationListener(this)); //@B0A - - tableData_.setConnection(connection); - tableData_.setQuery(query); - - // Add self as listener for errors and work events - tableData_.addErrorListener(new ErrorListener_()); - tableData_.addWorkingListener(worker_); - - init(); -} - - - -/** -Adds a listener to be notified when a new record is displayed. -The listener's actionCompleted() method will be called. - -@param listener The listener. -**/ -public void addActionCompletedListener (ActionCompletedListener listener) -{ - actionListeners_.addActionCompletedListener(listener); -} - - - -/** -Adds a listener to be notified when an error occurs. -The listener's errorOccurred() method will be called. - -@param listener The listener. -**/ -public void addErrorListener (ErrorListener listener) -{ - errorListeners_.addErrorListener (listener); -} - - - -/** -Clears all SQL warnings. -**/ -public void clearWarnings () -{ - tableData_.clearWarnings(); -} - - -/** -Closes the SQL result set this form represents. -**/ -public void close() -{ - tableData_.close(); -} - - - -/** -Displays the first record of the result set. -**/ -public void displayFirst () -{ - synchronized (this) - { - current_ = 0; - refreshScreen(); - } - - // Send event. - actionListeners_.fireActionCompleted(); -} - - - -/** -Displays the last record of the result set. -**/ -public void displayLast () -{ - synchronized (this) - { - error_ = false; - current_ = tableData_.getNumberOfRows() - 1; - if (error_) // error during getNumberOfRows - current_ = tableData_.getLastRecordProcessed(); - - refreshScreen(); - } - - // Send event. - actionListeners_.fireActionCompleted(); -} - - - -/** -Displays the next record of the result set. -If the last record is being displayed, the first record -will be displayed. -**/ -public void displayNext () -{ - synchronized (this) - { - // Move the current record index. - if (tableData_.getAllRecordsProcessed()) - { - // Do not want to do getNumberOfRows unless all records processed - // since getNumberOfRows will process all records. - // getNumberOfRows should never fire an error here. - if (current_+1 == tableData_.getNumberOfRows()) - current_ = 0; - else - ++current_; - } - else - { - ++current_; - } - - refreshScreen(); - } - - // Send event. - actionListeners_.fireActionCompleted(); -} - - - -/** -Displays the previous record of the result set. -If the first record is being displayed, the last record -will be displayed. -**/ -public void displayPrevious () -{ - synchronized (this) - { - // Move the current record index. - if (current_ < 1) - { - error_ = false; - current_ = tableData_.getNumberOfRows() - 1; - if (error_) //getNumberOfRows() failed - { - current_ = tableData_.getLastRecordProcessed(); - } - } - else - { - --current_; - } - - refreshScreen(); - } - - // Send event. - actionListeners_.fireActionCompleted(); -} - - - -/** -Returns the SQL connection with which to access data. - -@return The SQL connection. -**/ -public SQLConnection getConnection () -{ - return tableData_.getConnection(); -} - - - -/** -Returns the index of the record currently being displayed. -Indices start at 0, and increment one for each of the records -in the result set. -Note that this is not the same as the record number. - -@return The index of the record currently being displayed. -If there is no record being displayed, -1 is returned. -**/ -synchronized public int getCurrentRecord() -{ - return current_; -} - - - -/** -Returns the text of the label at the given index. - -@param index The index of the label. Indices start at 0. - -@return The text of the label at the given index. -**/ -synchronized public String getLabelText(int index) -{ - return labels_[index].getText(); -} - - - -/** -Returns the SQL query used to generate the form data. - -@return The SQL query. -**/ -public String getQuery () -{ - String result = tableData_.getQuery(); - if (result == null) - return ""; - return result; -} - - - -/** -Returns the string value of the current record at the given index. - -@param index The index of the value. Indices start at 0. - -@return The value at the given index as a string. -**/ -synchronized public String getStringValueAt(int index) -{ - return values_[index].getText(); -} - - - -/** -Returns the value of the current record at the given index. - -@param index The index of the value. Indices start at 0. - -@return The value at the given index. -**/ -synchronized public Object getValueAt(int index) -{ - return tableData_.getValueAt(current_, index); -} - - - -/** -Returns the warnings generated by the JDBC connection, statement, and -result set. -The warnings from the result set will be -linked to the end of any statement warnings, which in turn are linked -to the end of any connection warnings. -Warnings are cleared when load() or clearWarnings() -is called. - -@return The warnings generated by the connection, statement, and -result set, or null if none. -**/ -public SQLWarning getWarnings () -{ - return tableData_.getWarnings(); -} - - - -/** -Create GUI. -**/ -private void init() -{ - //------------------------------------------------------ - // Create constant screen components. Data fields will - // be created by load(). - //------------------------------------------------------ - // Create position labels. - recordLabel_ = new JLabel(ResourceLoader.getText("DBFORM_LABEL_RECORD_NUMBER")); - recordNumber_ = new JLabel(); - - // Create all the buttons. - String text = ResourceLoader.getText("DBFORM_TOOLTIP_FIRST"); - firstButton_ = new JButton(ResourceLoader.getIcon("FirstIcon.gif", text)); - firstButton_.setToolTipText(text); - text = ResourceLoader.getText("DBFORM_TOOLTIP_LAST"); - lastButton_ = new JButton(ResourceLoader.getIcon("LastIcon.gif", text)); - lastButton_.setToolTipText(text); - text = ResourceLoader.getText("DBFORM_TOOLTIP_NEXT"); - nextButton_ = new JButton(ResourceLoader.getIcon("NextIcon.gif", text)); - nextButton_.setToolTipText(text); - text = ResourceLoader.getText("DBFORM_TOOLTIP_PREVIOUS"); - previousButton_ = new JButton(ResourceLoader.getIcon("PreviousIcon.gif", text)); - previousButton_.setToolTipText(text); - text = ResourceLoader.getText("DBFORM_TOOLTIP_REFRESH"); - refreshButton_ = new JButton(ResourceLoader.getIcon("RefreshIcon.gif", null)); - refreshButton_.setToolTipText(text); - // Add listeners to buttons to call correct functions. - ButtonListener_ l = new ButtonListener_(); - firstButton_.addActionListener(l); - lastButton_.addActionListener(l); - nextButton_.addActionListener(l); - previousButton_.addActionListener(l); - refreshButton_.addActionListener(l); - - // build center data area - dataArea_ = new JPanel(); - dataArea_.setBorder(new EmptyBorder(5,5,5,5)); - - // build status line - status_ = new JLabel(ResourceLoader.getText("DBFORM_MSG_NO_DATA")); - - //------------------------------------------------------ - // Build the constant screen components. Data fields will - // be added by load(). - //------------------------------------------------------ - // Set main layout to border layout. - setLayout(new BorderLayout()); - // Add buttons to panel. - JPanel panel1 = new JPanel(); - panel1.setLayout(new FlowLayout(FlowLayout.CENTER)); - panel1.add(firstButton_); - panel1.add(previousButton_); - panel1.add(nextButton_); - panel1.add(lastButton_); - panel1.add(refreshButton_); - // Add status line to panel. - JPanel panel2 = new JPanel(); - panel2.setLayout(new FlowLayout(FlowLayout.CENTER)); - panel2.add(status_); - // Add buttons and status to bottom. - JPanel panel = new JPanel(); - panel.setLayout(new BorderLayout()); - panel.add("North", panel1); - panel.add("South", panel2); - add("South", panel); - // Add position labels. - panel = new JPanel(); - panel.setLayout(new FlowLayout(FlowLayout.LEFT)); - panel.add(recordLabel_); - panel.add(recordNumber_); - add("North", panel); - // Add center data area - add("Center", dataArea_); -} - - - -/** -Refreshes the view based on the state of the system. This runs -the SQL query. The first record will be displayed. -The labels are reconstructed, so any label text customization will be lost. -The query and connection properties -must be set before this method is called. -**/ -public void load () -{ - synchronized (this) - { - // Remove any previous components from the screen - dataArea_.removeAll(); - - // verify we have enough info to get data - IllegalStateException exception = null; - error_ = false; - if (tableData_.getConnection() == null) - { - exception = new IllegalStateException("connection"); - error_ = true; - } - else if (tableData_.getQuery() == null) - { - exception = new IllegalStateException("query"); - error_ = true; - } - else - { - // Do a load to make sure we have no errors. - // Other calls should not throw errors once a load is done - // successfully. - tableData_.load(); - } - - if (error_) - { - values_ = new JTextField[0]; - labels_ = new JLabel[0]; - current_ = -1; - refreshScreen(); - if (exception != null) - throw exception; - return; - } - - // Build labels, values and formatters. - // Add all fields to the screen. - int num = tableData_.getNumberOfColumns(); - // label variables - labels_ = new JLabel[num]; - JLabel label; - // value variables - values_ = new JTextField[num]; - JTextField value; - // formatter variables - formatter_ = new DBCellRenderer[num]; - - // panel setup - dataArea_.setLayout(new GridLayout(num,1)); - JPanel panel; - - int type, sqltype; - // Loop through each field in the record. - for (int i=0; iload() is done. - -@param connection The SQL connection. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setConnection (SQLConnection connection) - throws PropertyVetoException -{ - if (connection == null) - throw new NullPointerException("connection"); - - SQLConnection old = getConnection(); - - // Fire a vetoable change event. - fireVetoableChange("connection", old, connection); - - // Make property change. - tableData_.setConnection(connection); - - // Fire the property change event. - firePropertyChange("connection", old, connection); -} - - - -/** -Sets the text of the label at the given index. - -@param index The index of the label. Indices start at 0. -@param text The text of the label. -**/ -synchronized public void setLabelText(int index, - String text) -{ - labels_[index].setText(text); -} - - - -/** -Sets the SQL query used to generate the result set. -This property is bound and constrained. -Note that the data in the form will not change -until a load() is done. - -@param query The SQL query. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setQuery (String query) - throws PropertyVetoException -{ - if (query == null) - throw new NullPointerException("query"); - - String old = getQuery(); - - // Fire a vetoable change event. - fireVetoableChange("query", old, query); - - // Make property change. - tableData_.setQuery(query); - - // Fire the property change event. - firePropertyChange("query", old, query); -} - - - -/** -Class for listening to action events. This is used to run the -SQL statement when the button is pressed. -**/ -private class ButtonListener_ -implements ActionListener -{ - -public void actionPerformed(ActionEvent ev) -{ - // try to perform the appropriate action - Object source = ev.getSource(); - if (source == firstButton_) - { - displayFirst(); - } - else if (source == lastButton_) - { - displayLast(); - } - else if (source == nextButton_) - { - displayNext(); - } - else if (source == previousButton_) - { - displayPrevious(); - } - else if (source == refreshButton_) - { - load(); - } - // else unknown source - ignore -} - -} // end of class ButtonListener_ - - - - - -/** -Class for listening to error events. The error_ flag is set, -and the event's source is changed and redispatched to our listeners. -**/ -private class ErrorListener_ -implements ErrorListener -{ - -public void errorOccurred(ErrorEvent event) -{ - // set flag that an error occurred - error_ = true; - // Change the source in the event and fire - // to our listeners. - errorListeners_.fireError(event.getException()); -} - -} // end of class ErrorListener_ - - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetFormPane16.gif b/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetFormPane16.gif deleted file mode 100644 index 8ecb2825d..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetFormPane16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetFormPane32.gif b/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetFormPane32.gif deleted file mode 100644 index 479f76af4..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetFormPane32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetFormPaneBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetFormPaneBeanInfo.java deleted file mode 100644 index 3dcc5bcdc..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetFormPaneBeanInfo.java +++ /dev/null @@ -1,173 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLResultSetFormPaneBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - -/** -The SQLResultSetFormPaneBeanInfo class provides bean -information for the SQLResultSetFormPane class. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class SQLResultSetFormPaneBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = SQLResultSetFormPane.class; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - // ***** EVENTS - EventSetDescriptor error = new EventSetDescriptor(beanClass, - "error", - com.ibm.as400.vaccess.ErrorListener.class, - "errorOccurred"); - error.setDisplayName(ResourceLoader.getText("EVT_NAME_ERROR")); - error.setShortDescription(ResourceLoader.getText("EVT_DESC_ERROR")); - - EventSetDescriptor action = new EventSetDescriptor(beanClass, - "actionCompleted", - com.ibm.as400.access.ActionCompletedListener.class, - "actionCompleted"); - action.setDisplayName(ResourceLoader.getText("EVT_NAME_ACTION_COMPLETED")); - action.setShortDescription(ResourceLoader.getText("EVT_DESC_ACTION_COMPLETED")); - - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_VETO")); - - events_ = new EventSetDescriptor[]{error, action, changed, veto}; - - - // ***** PROPERTIES - PropertyDescriptor query = new PropertyDescriptor("query", beanClass); - query.setBound(true); - query.setConstrained(true); - query.setDisplayName(ResourceLoader.getText("PROP_NAME_QUERY")); - query.setShortDescription(ResourceLoader.getText("PROP_DESC_QUERY")); - - PropertyDescriptor connection = new PropertyDescriptor("connection", beanClass); - connection.setBound(true); - connection.setConstrained(true); - connection.setDisplayName(ResourceLoader.getText("PROP_NAME_CONNECTION")); - connection.setShortDescription(ResourceLoader.getText("PROP_DESC_CONNECTION")); - - properties_ = new PropertyDescriptor[]{query, connection}; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the error event - return 0; - } - - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the "query" property - return 0; - } - - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("SQLResultSetFormPane16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("SQLResultSetFormPane32.gif"); - break; - } - - return image; - } - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTableModel.java b/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTableModel.java deleted file mode 100644 index 2b532b9c7..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTableModel.java +++ /dev/null @@ -1,1302 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLResultSetTableModel.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; - -import javax.swing.JTable; -import javax.swing.table.AbstractTableModel; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.Statement; -import java.sql.Types; -import java.util.Vector; - - - -/** -The SQLResultSetTableModel class represents the data in a JDBC -result set generated by an SQL query. This class implements the -underlying model for a table in a graphical user interface. -Use this class if you want to customize the graphical user interface -that presents a table. If you do not need to customize the graphical user -interface, then use -SQLResultSetTablePane instead. - -

    You must specify an -SQLConnection object and SQL query string to use for generating -the data. Alternately, you can specify a ResultSet object directly. -If you specify a ResultSet object, it will override any SQLConnection -or SQL query previously set. In addition, if you specify a ResultSet, -this class will use memory more efficiently if you create the ResultSet as scrollable. - -

    You must explicitly call load() to load the information -from the result set. The model will be empty until load() is called. -If the query or result set includes updatable columns, then the respective -columns will be editable. - -

    This class assumes that the necessary JDBC driver(s) are already registered. - -

    Call close() to ensure that the result set -is closed when this table is no longer needed. - -

    Most errors are reported as ErrorEvents -rather than throwing exceptions. Listen for ErrorEvents in order to diagnose and recover -from error conditions. - -

    SQLResultSetTableModel objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • TableModelEvent -
    • WorkingEvent -
    - -

    This example creates an SQLResultSetTableModel using an SQLConnection -and query and displays it using a JTable: - -

    -// Register the IBM Toolbox for Java JDBC driver.
    -DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver());
    -
    -// Create the SQLResultSetTableModel object. -SQLConnection connection = new SQLConnection("jdbc:as400://MySystem", "Userid", "Password"); -String query = "SELECT * FROM MYLIB.MYTABLE"; -SQLResultSetTableModel model = new SQLResultSetTableModel(connection, query); -
    -// Create the enclosing JTable and put it in a JFrame. -JTable table = new JTable(model); -JFrame frame = new JFrame("My Window"); -frame.getContentPane().add(new JScrollPane(table)); -
    -// Set up the error dialog adapter. -model.addErrorListener(new ErrorDialogAdapter(frame)); -
    -// Display the JFrame. -frame.pack(); -frame.show(); -
    -// Load the contents of the model. -model.load(); -
    - -

    This example creates an SQLResultSetTableModel using a ResultSet -and displays it using a JTable: - -

    -// Register the IBM Toolbox for Java JDBC driver.
    -DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver());
    -
    -// Use JDBC to execute the SQL query directly. -Connection connection = DriverManager.getConnection("MySystem", "Userid", "Password"); -Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); -ResultSet rs = statement.executeQuery("SELECT * FROM MYLIB.MYTABLE"); -
    -// Create the SQLResultSetTableModel object. -SQLResultSetTableModel model = new SQLResultSetTableModel(rs); -
    -// Create the enclosing JTable and put it in a JFrame. -JTable table = new JTable(model); -JFrame frame = new JFrame("My Window"); -frame.getContentPane().add(new JScrollPane(table)); -
    -// Set up the error dialog adapter. -model.addErrorListener(new ErrorDialogAdapter(frame)); -
    -// Display the JFrame. -frame.pack(); -frame.show(); -
    -// Load the contents of the model. -model.load(); -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -// -// Implementation notes: -// -// * Note that this class throws error and working events from within -// synchronized blocks, which could cause hangs if the listeners for -// these events do operations from a different thread an attempt to -// access another synchronized piece of code. -// -// At this time this seems to be an acceptable risk, since the -// events thrown are not likely to need enough processing to -// require another thread, and getting having the events thrown -// from outside a sychronized block would be nearly impossible. -// The other option is to have the firing of the events be done -// from another thread, but the overhead of creating another thread -// not only takes resources, but also delays the delivery of the event. -// -// * We do two sets of synchronization. The internalMonitor_ -// synchronization prevents data corrruption when multiple threads -// are accessing the same SQLResultSetTableModel object. -// The resultSet_ synchronization prevents data corruption when -// multiple SQLResultSetTableModels are accessing the same -// ResultSet object. -// -// * The variables which have private commented out had to made -// package scope since currently Internet Explorer does not -// allow inner class to access private variables in their -// containing class. -// -public class SQLResultSetTableModel - extends AbstractTableModel - implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - - - // Private data. - private boolean cacheAll_ = false; - private SQLConnection sqlConnection_ = null; - private String query_ = null; - private ResultSet explicitResultSet_ = null; - - private transient Vector cachedRows_; - private transient int cachedRowCount_; - private transient int columnCount_; - private transient boolean error_; - private transient int firstCachedRow_; - private transient Object internalMonitor_; - private transient int lastCachedRow_; - private transient ResultSet resultSet_; - private transient ResultSetMetaData resultSetMetaData_; - private transient int rowCount_; - private transient boolean rowCountComplete_; - private transient boolean scrollable_; - private transient Statement statement_; - private transient boolean updatable_; - - private transient JTable table_; /* Keep a reference to the table so we can maintain selection information @B6A*/ - private static final int CACHE_SIZE_ = 500; // In rows. - private static final int READ_INCREMENT_ = 50; // In rows. - - - - // Event support. - private transient PropertyChangeSupport propertyChangeSupport_; - private transient VetoableChangeSupport vetoableChangeSupport_; - private transient ErrorEventSupport errorEventSupport_; - private transient WorkingEventSupport workingEventSupport_; - - - - /** - Constructs a SQLResultSetTableModel object. - **/ - public SQLResultSetTableModel() - { - super(); - initializeTransient(); - } - - - - /** - Constructs a SQLResultSetTableModel object. - - @param connection The SQL connection. - @param query The SQL query. - **/ - public SQLResultSetTableModel(SQLConnection connection, String query) - { - super(); - if(connection == null) - throw new NullPointerException("connection"); - if(query == null) - throw new NullPointerException("query"); - - sqlConnection_ = connection; - query_ = query; - - initializeTransient(); - } - - - - // @D0A - /** - Constructs a SQLResultSetTableModel object. - - @param resultSet The SQL result set. - @param cacheAll true to cache the entire result set when load() - is called, false to cache parts of the result set as they are - needed. Passing true may result in slow initial presentation of - the data. However, it may be necessary to pass true if the result - set is expected to close when the model is still needed. - **/ - public SQLResultSetTableModel(ResultSet resultSet, boolean cacheAll) - { - super(); - if(resultSet == null) - throw new NullPointerException("resultSet"); - - explicitResultSet_ = resultSet; - cacheAll_ = cacheAll; - - initializeTransient(); - } - - - - /** - Adds a listener to be notified when an error occurs. - - @param listener The listener. - **/ - public void addErrorListener(ErrorListener listener) - { - errorEventSupport_.addErrorListener(listener); - } - - - - /** - Adds a listener to be notified when the value of any - bound property changes. - - @param listener The listener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener(listener); - } - - - - /** - Adds a listener to be notified when the value of any - constrained property changes. - - @param listener The listener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener(listener); - } - - - - /** - Adds a listener to be notified when work starts and stops - on potentially long-running operations. - - @param listener The listener. - **/ - public void addWorkingListener(WorkingListener listener) - { - workingEventSupport_.addWorkingListener(listener); - } - - - - /** - Clears all SQL warnings. - **/ - public void clearWarnings() - { - try - { - if(resultSet_ != null) - resultSet_.clearWarnings(); - if(statement_ != null) - statement_.clearWarnings(); - } - catch(SQLException e) - { - markError(e); - } - } - - - - /** - Closes the result set. - **/ - public void close() - { - try - { - if(resultSet_ != null) - { - resultSet_.close(); - resultSet_ = null; - } - } - catch(SQLException e) - { - markError(e); - } - - try - { - if(statement_ != null) - { - statement_.close(); - statement_ = null; - } - } - catch(SQLException e) - { - markError(e); - } - } - - - - /** - Returns the class of the values in the column. - - @param columnIndex The column index (0-based). - @return The class of the column values, or null - if an error occurs. - **/ - public Class getColumnClass(int columnIndex) - { - // Returning Object seems to be sufficient. - return Object.class; - } - - - - /** - Returns the number of columns in the table. - - @return The number of columns in the table, or 0 - if an error occurs. - **/ - public int getColumnCount() - { - synchronized(internalMonitor_) - { - Trace.log(Trace.DIAGNOSTIC, "SQLResultSetTableModel.getColumnCount() = " + columnCount_); - return columnCount_; - } - } - - - - /** - Returns the column identifier. This corresponds to the - field name in the database. - - @param columnIndex The column index (0-based). - @return The column identifier, or null - if an error occurs. - **/ - public String getColumnID(int columnIndex) - { - synchronized(internalMonitor_) - { - if((columnIndex < 0) || (columnIndex >= columnCount_)) - return null; - if(resultSet_ == null) - return null; - - try - { - return resultSetMetaData_.getColumnName(columnIndex+1); - } - catch(SQLException e) - { - markError(e); - return null; - } - } - } - - - - /** - Returns the column name. This corresponds to the column - label in the database. - - @param columnIndex The column index (0-based). - @return The column name, or null - if an error occurs. - **/ - public String getColumnName(int columnIndex) - { - synchronized(internalMonitor_) - { - if((columnIndex < 0) || (columnIndex >= columnCount_)) - return null; - if(resultSet_ == null) - return null; - - try - { - String col = resultSetMetaData_.getColumnLabel(columnIndex+1); //@pdc extended metadata - //columnLabel is a concatonation of up to three columns (each 20 length) with the 20 length padded with spaces - int colLength = col.length(); //@pda extended metadata - if( colLength > 20) //@pda - { //@pda - - if( colLength > 40) //@pda - { //@pda - //contains three column concats - String space1 = col.substring(19,20).equals(" ") ? " " : ""; //column separator - String space2 = col.substring(39,40).equals(" ") ? " " : ""; //column separator - col = col.substring(0, 20).trim() + space1 + col.substring(20, 40).trim() + space2 + col.substring(40).trim(); //@pda - } //@pda - else //@pda - { //@pda - //contains two column concats - String space1 = col.substring(19,20).equals(" ") ? " " : ""; //column separator - col = col.substring(0, 20).trim() + space1 + col.substring(20).trim(); //@pda - } //@pda - } //@pda - return col; //@pda - } - catch(SQLException e) - { - markError(e); - return null; - } - } - } - - - - /** - Returns the column type. - - @param columnIndex The column index (0-based). - @return The column type, or 0 if an error occurs. - **/ - public int getColumnType(int columnIndex) - { - synchronized(internalMonitor_) - { - if((columnIndex < 0) || (columnIndex >= columnCount_)) - return 0; - if(resultSet_ == null) - return 0; - - try - { - return resultSetMetaData_.getColumnType(columnIndex+1); - } - catch(SQLException e) - { - markError(e); - return 0; - } - } - } - - - - /** - Returns the column width. - - @param columnIndex The column index (0-based). - @return The column width, in characters, or 0 if an error occurs. - **/ - public int getColumnWidth(int columnIndex) - { - synchronized(internalMonitor_) - { - if((columnIndex < 0) || (columnIndex >= columnCount_)) - return 0; - if(resultSet_ == null) - return 0; - - try - { - /* @D3D - // For most types, we just consult with JDBC. However, for times, dates, and - // timestamps, JDBC reports the display size for the server format. And these - // GUIs actually internationalize the Strings before displaying them. So for - // these types, we need to compute our own display sizes. - switch(resultSetMetaData_.getColumnType(columnIndex+1)) { - case Types.TIME: - return DBDateCellRenderer.getDisplaySize(DBDateCellRenderer.FORMAT_TIME); - case Types.DATE: - return DBDateCellRenderer.getDisplaySize(DBDateCellRenderer.FORMAT_DATE); - case Types.TIMESTAMP: - return DBDateCellRenderer.getDisplaySize(DBDateCellRenderer.FORMAT_TIMESTAMP); - default: - */ - return Math.min(resultSetMetaData_.getColumnDisplaySize(columnIndex+1), 50); - // @D3D } - } - catch(SQLException e) - { - markError(e); - return 0; - } - } - } - - - - /** - Returns the SQL connection. - - @return The SQL connection. - **/ - public SQLConnection getConnection() - { - return sqlConnection_; - } - - - - /** - Returns the SQL query. - - @return The SQL query. - **/ - public String getQuery() - { - return(query_ == null) ? "" : query_; - } - - - - // @D0A - /** - Returns the SQL result set. - - @return The SQL result set. - **/ - public ResultSet getResultSet() - { - return explicitResultSet_; - } - - - - /** - Returns the number of rows in the table. - Because of incremental data retrieval, this value may - not be accurate. - - @return The number of rows in the table. - **/ - public int getRowCount() - { - if(resultSet_ == null) - return 0; - - // If we are not complete, report 2 more than actually here. - // This will trick JTable into continuing to ask for more. - int reportedRowCount = rowCount_; - if(!rowCountComplete_) - reportedRowCount += 2; - - // This should not be in a synchronized block, otherwise - // a hang may occur. - Trace.log(Trace.DIAGNOSTIC, "SQLResultSetTableModel.getRowCount() = " + reportedRowCount + "(actually " + rowCount_ + ")"); - return reportedRowCount; - } - - - - // @D4A - private Object getSingleValue(int columnIndex) throws SQLException - { - int type = resultSetMetaData_.getColumnType(columnIndex); - if(type == Types.BINARY - || type == Types.VARBINARY - || type == Types.LONGVARBINARY) - { - return resultSet_.getBytes(columnIndex); - } - else - { - // Use getString() so that dates and times get converted to strings - // by the JDBC driver so that their formats reflect the settings - // in the data source. - //@KKB return resultSet_.getString(columnIndex); - String s = resultSet_.getString(columnIndex); //@KKB - if(checkDataMappingWarning(resultSet_, columnIndex)) //@KKB - s="++++++++++++++"; //@KKB - return s; //@KKB - } - } - - - - /** - Returns the value at the specifed row and column. - - @param rowIndex The row index (0-based). - @param columnIndex The column index (0-based). - - @return The value at the specified row and column. - **/ - public Object getValueAt(int rowIndex, int columnIndex) - { - int oldRowCount; - int newRowCount; - Object[] row = null; - - synchronized(internalMonitor_) - { - if((columnIndex < 0) || (columnIndex >= columnCount_)) - return null; - if(rowIndex < 0) - return null; - if((rowCountComplete_) && (rowIndex >= rowCount_)) - return null; - if(resultSet_ == null) - return null; - - oldRowCount = rowCount_; - - // Case 1: If this row is in the cache, just read it from there. - // If cacheAll_ is set, then this case should always occur. - if((rowIndex >= firstCachedRow_) && (rowIndex <= lastCachedRow_)) - { - row = (Object[])cachedRows_.elementAt(rowIndex - firstCachedRow_); - } - - // Case 2: If this row comes before whats in the cache, read the rows - // and move the cache window up in the result set. This will only - // occur if the result set is scrollable - if it is not, then the - // cache always includes everything read so far. - else if((rowIndex < firstCachedRow_) && (error_ == false)) - { - workingEventSupport_.fireStartWorking(); - for(int i = firstCachedRow_ - 1; i >= rowIndex; --i) - { - try - { - row = new Object[columnCount_]; - synchronized(resultSet_) - { - - // If we are just reading the next row since the last - // time, it can be significantly faster to call next(). - // This is especially true when using the Toolbox - // JDBC driver since it does record blocking only - // when using next(). - // - // I tried keeping the last read row locally, but it - // messes things up when result sets are shared - // between multiple models. - // - if(i == resultSet_.getRow()) - resultSet_.next(); - else - resultSet_.absolute(i+1); - - // Store the contents of the row. - for(int j = 0; j < columnCount_; ++j) - row[j] = getSingleValue(j+1); // @D4C - } - cachedRows_.insertElementAt(row, 0); - --firstCachedRow_; - if(++cachedRowCount_ > CACHE_SIZE_) - { - cachedRows_.removeElementAt(--cachedRowCount_); - --lastCachedRow_; - } - } - catch(SQLException e) - { - markError(e); - } - } - workingEventSupport_.fireStopWorking(); - } - - // Case 3: If this row comes after whats in the cache, read the rows - // and move the cache window down in the result set. If we do not - // know the final row count, then jump a little bit ahead to discover - // this. - else if((rowIndex > lastCachedRow_) && (error_ == false)) - { - - // Determine how far to go. If we are not complete yet, push it - // ahead to force the table to read even further. - int endPoint = rowIndex; - if(!rowCountComplete_) - endPoint = rowIndex + READ_INCREMENT_; - - // Loop through the rows, quit if we get to the end. - workingEventSupport_.fireStartWorking(); - boolean valid = true; - for(int i = lastCachedRow_ + 1; (i <= endPoint) && (valid); ++i) - { - try - { - synchronized(resultSet_) - { - - // If we are just reading the next row since the last - // time, it can be significantly faster to call next(). - // This is especially true when using the Toolbox - // JDBC driver since it does record blocking only - // when using next(). We also take this route if - // the result set is not scrollable. - if((i == resultSet_.getRow()) || (!scrollable_)) - valid = resultSet_.next(); - else - valid = resultSet_.absolute(i+1); - - // If this is a valid row, then add it to the cache. - if(valid) - { - Object[] tempRow = new Object[columnCount_]; - for(int j = 0; j < columnCount_; ++j) - tempRow[j] = getSingleValue(j+1); // @D4C - if(i == rowIndex) - row = tempRow; - cachedRows_.insertElementAt(tempRow, cachedRowCount_++); - ++lastCachedRow_; - if((scrollable_) && (cachedRowCount_ > CACHE_SIZE_)) - { - cachedRows_.removeElementAt(0); - cachedRowCount_--; - ++firstCachedRow_; - } - - // If this is greater than our current count, add record it. - if((!rowCountComplete_) && (i >= rowCount_)) - rowCount_ = i; - } - - // If this is not a valid row, then mark the row count as - // complete. - else if(!rowCountComplete_) - { - rowCountComplete_ = true; - rowCount_ = i; - } - } - } - catch(SQLException e) - { - markError(e); - } - } - workingEventSupport_.fireStopWorking(); - } - - // If the row count changed, record the change so we can fire the table - // model event (outside of the synchronized block). - newRowCount = rowCount_; - } - - // If the row count changed, fire the table model event. If we are - // not complete, then add 2 to keep the JTable asking for more. - if(oldRowCount != newRowCount) - { - // In JDK 1.5 and 1.6, there is a problem with the selection in the JTable being cleared. - // This causes problems if the user is using the page down key to scroll through the results. - // - // The call to fireTableRowsInserted may be the code that is clearing the selection. - // For a similar problem see: http://stackoverflow.com/questions/254212/preserve-jtable-selection-across-tablemodel-change - // I tried setting the first parameter to oldRowCount+1 to see if that fixes the problem. - // That did not fix the problem. The row at the bottom retains it's highlight, but the next - // PageDown jumps to the top of the area. - // - // Instead we need to remember the selected rows and restore them after. - // For now, we'll only handle the simple case where a single cell is selected. - // - // We also only want to change the selection if the selected row has changed after - // fireTableRowsInserted. In the case where the use of the scroll bar causes new - // entries to be loaded, the selectedRow does not change, so we do not need to - // change the selection back to their original values. - // - // @B6A - - - int selectedRow = -1; - if (table_ != null) selectedRow = table_.getSelectedRow(); - int selectedColumn = -1; - if (table_ != null) selectedColumn = table_.getSelectedColumn(); - - fireTableRowsInserted(oldRowCount, getRowCount()); - - - - // Restore the selected cell. @B6A - int afterSelectedRow = -1 ; - if (table_ != null) afterSelectedRow = table_.getSelectedRow(); - if ((selectedRow >= 0 && selectedColumn >= 0 ) && - ((afterSelectedRow != selectedRow) )) { - table_.changeSelection(selectedRow, selectedColumn, false /* toggle */ , false /* extend */); - - } - } - - // Return the value. - if(row == null) - return null; - else - return row[columnIndex]; - } - - - - /** - Returns the SQL warnings. - - @return The SQL warnings. - **/ - public SQLWarning getWarnings() - { - SQLWarning warnings = null; - try - { - if(resultSet_ != null) - warnings = resultSet_.getWarnings(); - if(statement_ != null) - { - if(warnings == null) - warnings = statement_.getWarnings(); - else - warnings.setNextWarning(statement_.getWarnings()); - } - } - catch(SQLException e) - { - markError(e); - } - return warnings; - } - - - - /** - Initializes the common data. - **/ - private void initializeCommon() - { - synchronized(internalMonitor_) - { - cachedRows_ = new Vector(CACHE_SIZE_); - cachedRowCount_ = 0; - columnCount_ = 0; - error_ = false; - firstCachedRow_ = 0; - lastCachedRow_ = -1; - rowCount_ = 0; - rowCountComplete_ = false; - } - } - - - - /** - Initializes the transient data. - **/ - private void initializeTransient() - { - internalMonitor_ = new Object(); - - initializeCommon(); - - // Event support. - propertyChangeSupport_ = new PropertyChangeSupport(this); - vetoableChangeSupport_ = new VetoableChangeSupport(this); - errorEventSupport_ = new ErrorEventSupport(this); - workingEventSupport_ = new WorkingEventSupport(this); - } - - - //@D6A - /** - * Used by SQLResultSetTablePane to determine whether or not the default - * cell editor should be replaced. - **/ - boolean isUpdatable() - { - return updatable_; - } - - - // @D2A - /** - Indicates if the cell is editable. - - @param rowIndex The row index (0-based). - @param columnIndex The column index (0-based). - @return true if the cell is editable, false otherwise - or if an error occurs. - **/ - public boolean isCellEditable(int rowIndex, int columnIndex) - { - synchronized(internalMonitor_) - { - if((columnIndex < 0) || (columnIndex >= columnCount_)) - return false; - if(rowIndex < 0) - return false; - if((rowCountComplete_) && (rowIndex >= rowCount_)) - return false; - if(resultSet_ == null) - return false; - - //@D6D try { - //@D6D return (updatable_ && resultSetMetaData_.isWritable(columnIndex+1)); - //@D6D } - //@D6D catch(SQLException e) { - //@D6D markError(e); - //@D6D return false; - //@D6D } - return true; //@D6A - } - } - - - - /** - Loads the data in the table. - **/ - public void load() - { - Trace.log(Trace.DIAGNOSTIC, "SQLResultSetTableModel.load()"); - workingEventSupport_.fireStartWorking(); - - // Make sure we have enough data to load. - if(explicitResultSet_ == null) - { - if(sqlConnection_ == null) - throw new IllegalStateException("connection"); - if(query_ == null) - throw new IllegalStateException("query"); - } - - synchronized(internalMonitor_) - { - - // Clear the old data. - initializeCommon(); - - // Load the new data. - try - { - if(explicitResultSet_ == null) - { - if(statement_ == null) - { - Connection connection = sqlConnection_.getConnection(); - statement_ = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - } - - resultSet_ = statement_.executeQuery(query_); - } - else - resultSet_ = explicitResultSet_; - - scrollable_ = (resultSet_.getType() != ResultSet.TYPE_FORWARD_ONLY); - updatable_ = (resultSet_.getConcurrency() == ResultSet.CONCUR_UPDATABLE); // @D2A - resultSetMetaData_ = resultSet_.getMetaData(); - columnCount_ = resultSetMetaData_.getColumnCount(); - - if(Trace.isTraceOn()) - { - Trace.log(Trace.DIAGNOSTIC, "SQLResultSetTableModel-scrollable? " + scrollable_); - Trace.log(Trace.DIAGNOSTIC, "SQLResultSetTableModel-updatable? " + updatable_); // @D2A - } - - //@KBD removed since a stored procedure may or may not return a scrollable cursor - // if the user specified ResultSet.TYPE_SCROLL_SENSITIVE or ResultSet.TYPE_SCROLL_INSENSITVE - //@KBD if(scrollable_) - //@KBD { - //@KBD resultSet_.beforeFirst(); - //@KBD } - } - catch(SQLException e) - { - markError(e); - rowCountComplete_ = true; - } - - // If we are supposed to, then cache all. - if(cacheAll_) - { - try - { - while(resultSet_.next()) - { - Object[] tempRow = new Object[columnCount_]; - for(int j = 0; j < columnCount_; ++j) - tempRow[j] = getSingleValue(j+1); // @D4C - cachedRows_.addElement(tempRow); - } - } - catch(SQLException e) - { - markError(e); - } - lastCachedRow_ = cachedRows_.size(); - rowCount_ = lastCachedRow_; - rowCountComplete_ = true; - } - - // Otherwise, try to read 1 row. This will handle the case where there are no rows. - else - { - getValueAt(0, 0); - } - } - - // Tell the JTable that we've changed. - fireTableStructureChanged(); - - workingEventSupport_.fireStopWorking(); - } - - - - /** - Marks that an error has occurred. - **/ - private void markError(Exception e) - { - if(Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error gathering SQLResultSetTableModel data", e); - - // Only fire if this is the first error. That way, we don't - // barrage the poor user. - if(!error_) - { - error_ = true; - errorEventSupport_.fireError(e); - } - } - - - - /** - Restores the state of the object from an input stream. - This is used when deserializing an object. - - @param in The input stream. - **/ - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient(); - } - - - - /** - Removes an error listener. - - @param listener The listener. - **/ - public void removeErrorListener(ErrorListener listener) - { - errorEventSupport_.removeErrorListener(listener); - } - - - - /** - Removes a property change listener. - - @param listener The listener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener(listener); - } - - - - /** - Removes a vetoable change listener. - - @param listener The listener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener(listener); - } - - - - /** - Removes a working listener. - - @param listener The listener. - **/ - public void removeWorkingListener(WorkingListener listener) - { - workingEventSupport_.removeWorkingListener(listener); - } - - - - /** - Sets the SQL connection. - The data will not change until load() is called. - - @param connection The SQL connection. - - @exception PropertyVetoException If the change is vetoed. - **/ - public void setConnection(SQLConnection connection) - throws PropertyVetoException - { - if(connection == null) - throw new NullPointerException("connection"); - - SQLConnection oldValue = sqlConnection_; - vetoableChangeSupport_.fireVetoableChange("connection", oldValue, connection); - sqlConnection_ = connection; - statement_ = null; - propertyChangeSupport_.firePropertyChange("connection", oldValue, connection); - } - - - - /** - Sets the SQL query. - The data will not change until load() is called. - - @param query The SQL query. - - @exception PropertyVetoException If the change is vetoed. - **/ - public void setQuery(String query) - throws PropertyVetoException - { - if(query == null) - throw new NullPointerException("query"); - - String oldValue = query_; - vetoableChangeSupport_.fireVetoableChange("query", oldValue, query); - query_ = query; - propertyChangeSupport_.firePropertyChange("query", oldValue, query); - } - - - - // @D0A - /** - Sets the SQL result set used to build the table. If this is set, - it is used instead of the SQL connection and SQL query. - The data will not change until load() is called. - - @param resultSet The SQL result set. - **/ - public void setResultSet(ResultSet resultSet) - { - if(resultSet == null) - throw new NullPointerException("resultSet"); - - ResultSet oldValue = explicitResultSet_; - explicitResultSet_ = resultSet; - propertyChangeSupport_.firePropertyChange("resultSet", oldValue, resultSet); - } - - - - // @D2A - /** - Sets the value at the specifed row and column. - - @param value The value. - @param rowIndex The row index (0-based). - @param columnIndex The column index (0-based). - **/ - public void setValueAt(Object value, int rowIndex, int columnIndex) - { - synchronized(internalMonitor_) - { - if((columnIndex < 0) || (columnIndex >= columnCount_)) - return; - if(rowIndex < 0) - return; - if((rowCountComplete_) && (rowIndex >= rowCount_)) - return; - if(resultSet_ == null) - return; - - if(!updatable_) return; //@D6A - - if(scrollable_) - { - try - { - // Update the value in the result set. - synchronized(resultSet_) - { - resultSet_.absolute(rowIndex+1); - resultSet_.updateObject(columnIndex+1, value); - resultSet_.updateRow(); - } - - // Update the value in the cache. - ((Object[])cachedRows_.elementAt(rowIndex - firstCachedRow_))[columnIndex] = value; - } - catch(SQLException e) - { - // Don't set error_ to true, because that will ruin the whole - // model. Just fire an event and do not update the cache. - errorEventSupport_.fireError(e); - } - - } - } - } - - //@KKB - Checks if a Data Mapping Warning was issued - private boolean checkDataMappingWarning(ResultSet rs, int columnIndex) throws SQLException{ - boolean dataMapping = false; - SQLWarning w = rs.getWarnings(); - if(w!=null){ - do{ - if(w.getSQLState().equals("01004") && ((java.sql.DataTruncation)w).getDataSize() == -1 && ((java.sql.DataTruncation)w).getTransferSize() == -1 && ((java.sql.DataTruncation)w).getIndex() == columnIndex) - dataMapping = true; - - w=w.getNextWarning(); - }while(w!=null); - } - - return dataMapping; - } - - - -/** - * Set a reference to the JTable so that the selected row can be updated after - * fireTableRowsInserted. - * - * @param table - */ -public void setTable(JTable table) { - table_ = table; - -} - - - - -} - - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTableModel16.gif b/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTableModel16.gif deleted file mode 100644 index 2724c55d2..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTableModel16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTableModel32.gif b/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTableModel32.gif deleted file mode 100644 index 4cc32f09a..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTableModel32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTableModelBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTableModelBeanInfo.java deleted file mode 100644 index 541b6aea5..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTableModelBeanInfo.java +++ /dev/null @@ -1,183 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLResultSetTableModelBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - -/** -The SQLResultSetTableModelBeanInfo class provides bean -information for the SQLResultSetTableModel class. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class SQLResultSetTableModelBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = SQLResultSetTableModel.class; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - // ***** EVENTS - EventSetDescriptor error = new EventSetDescriptor(beanClass, - "error", - com.ibm.as400.vaccess.ErrorListener.class, - "errorOccurred"); - error.setDisplayName(ResourceLoader.getText("EVT_NAME_ERROR")); - error.setShortDescription(ResourceLoader.getText("EVT_DESC_ERROR")); - - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor model = new EventSetDescriptor(beanClass, - "tableModel", - javax.swing.event.TableModelListener.class, - "tableChanged"); - model.setDisplayName(ResourceLoader.getText("EVT_NAME_TABLE_MODEL")); - model.setShortDescription(ResourceLoader.getText("EVT_DESC_TABLE_MODEL")); - - String[] workingMethods = {"startWorking", "stopWorking"}; - EventSetDescriptor working = new EventSetDescriptor(beanClass, - "working", - com.ibm.as400.vaccess.WorkingListener.class, - workingMethods, - "addWorkingListener", - "removeWorkingListener"); - working.setDisplayName(ResourceLoader.getText("EVT_NAME_WORKING")); - working.setShortDescription(ResourceLoader.getText("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[]{error, changed, veto, model, working}; - - - // ***** PROPERTIES - PropertyDescriptor query = new PropertyDescriptor("query", beanClass); - query.setBound(true); - query.setConstrained(true); - query.setDisplayName(ResourceLoader.getText("PROP_NAME_QUERY")); - query.setShortDescription(ResourceLoader.getText("PROP_DESC_QUERY")); - - PropertyDescriptor connection = new PropertyDescriptor("connection", beanClass); - connection.setBound(true); - connection.setConstrained(true); - connection.setDisplayName(ResourceLoader.getText("PROP_NAME_CONNECTION")); - connection.setShortDescription(ResourceLoader.getText("PROP_DESC_CONNECTION")); - - properties_ = new PropertyDescriptor[]{query, connection}; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the error event - return 0; - } - - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the "query" property - return 0; - } - - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("SQLResultSetTableModel16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("SQLResultSetTableModel32.gif"); - break; - } - - return image; - } - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTablePane.java b/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTablePane.java deleted file mode 100644 index 66f754696..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTablePane.java +++ /dev/null @@ -1,1283 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLResultSetTablePane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import javax.swing.JComponent; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.ListSelectionModel; -import javax.swing.SwingConstants; -import javax.swing.SwingUtilities; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ListSelectionListener; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.TableColumn; -import javax.swing.table.TableColumnModel; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.event.FocusEvent; // @C2A -import java.awt.event.FocusListener; // @C2A -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Serializable; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; // @C0A -import java.sql.SQLWarning; -import java.sql.Statement; -import java.sql.Types; -import java.util.Enumeration; - -import java.awt.datatransfer.StringSelection; //@D6A -import javax.swing.JTextField; //@D6A -import javax.swing.ActionMap; //@D6A -import javax.swing.InputMap; //@D6A -import javax.swing.text.DefaultEditorKit; //@D6A -import javax.swing.KeyStroke; //@D6A -import javax.swing.Action; //@D6A -import java.awt.event.ActionEvent; //@D6A -import javax.swing.AbstractAction; //@D6A -import java.awt.Toolkit; //@D6A - - -/** -The SQLResultSetTablePane class represents a graphical user -interface that presents the contents of a JDBC result set -generated by an SQL query in a JTable. - -

    You must specify an -SQLConnection object and SQL query string to use for generating -the data. Alternately, you can specify a ResultSet object directly. -If you specify a ResultSet object, it will override any SQLConnection -or SQL query previously set. In addition, if you specify a ResultSet, -this class will use memory more efficiently if you create the ResultSet as scrollable. - -

    You must explicitly call load() to load the information -from the result set. The table will be empty until load() is called. -If the query or result set includes updatable columns, then the respective -columns will be editable. - -

    This class assumes that the necessary JDBC driver(s) are already registered. - -

    Call close() to ensure that the result set -is closed when this table is no longer needed. - -

    Most errors are reported as ErrorEvents -rather than throwing exceptions. Listen for ErrorEvents in order to diagnose and recover -from error conditions. - -

    SQLResultSetTablePane objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • TableModelEvent -
    • WorkingEvent -
    - -

    This example creates an SQLResultSetTablePane using an SQLConnection -and query and displays it using a JTable: - -

    -// Register the IBM Toolbox for Java JDBC driver.
    -DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver());
    -
    -// Create the SQLResultSetTablePane object. -SQLConnection connection = new SQLConnection("jdbc:as400://MySystem", "Userid", "Password"); -String query = "SELECT * FROM MYLIB.MYTABLE"; -SQLResultSetTablePane table = new SQLResultSetTablePane(connection, query); -
    -// Put the table in a JFrame. -JFrame frame = new JFrame("My Window"); -frame.getContentPane().add(table); -
    -// Set up the error dialog adapter. -table.addErrorListener(new ErrorDialogAdapter(frame)); -
    -// Display the JFrame. -frame.pack(); -frame.show(); -
    -// Load the contents of the table. -table.load(); -
    - -

    This example creates an SQLResultSetTablePane using a ResultSet -and displays it using a JTable: - -

    -// Register the IBM Toolbox for Java JDBC driver.
    -DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver());
    -
    -// Use JDBC to execute the SQL query directly. -Connection connection = DriverManager.getConnection("jdbc:as400://MySystem", "Userid", "Password"); -Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); -ResultSet rs = statement.executeQuery("SELECT * FROM MYLIB.MYTABLE"); -
    -// Create the SQLResultSetTablePane object. -SQLResultSetTablePane table = new SQLResultSetTablePane(rs); -
    -// Put the table in a JFrame. -JFrame frame = new JFrame("My Window"); -frame.getContentPane().add(table); -
    -// Set up the error dialog adapter. -table.addErrorListener(new ErrorDialogAdapter(frame)); -
    -// Display the JFrame. -frame.pack(); -frame.show(); -
    -// Load the contents of the table. -table.load(); -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class SQLResultSetTablePane - extends JComponent - implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; - - // The variables and methods which have private commented out - // had to be made package scope since some JVMs (IE and AS400) - // does not allow inner class to access private items in their - // containing class. - - - // The table contained in this panel. - /*private*/ - transient JTable table_; //@B0C - made transient - /*private*/transient JScrollPane tablePane_; //@B0C - made transient - // The data model for the table. - /*private*/SQLResultSetTableModel model_; //@B0C - made transient - - //@B0 - need to save the table's state since it's transient now. - private Color tableColor_ = null; //@B0A - private boolean tableShowHorizontalLines_ = true; //@B0A - private boolean tableShowVerticalLines_ = true; //@B0A - - // Event support. - transient private PropertyChangeSupport changeListeners_ - = new PropertyChangeSupport(this); - transient private VetoableChangeSupport vetoListeners_ - = new VetoableChangeSupport(this); - transient private ErrorEventSupport errorListeners_ - = new ErrorEventSupport(this); - transient private ListSelectionEventSupport selectionListeners_ - = new ListSelectionEventSupport(this); - - // Adapter for listening for working events and enabling working cursor. - transient private WorkingCursorAdapter worker_ - = new WorkingCursorAdapter(this); - - // Renderers for the different types of data, columns use these. - /*private*/DBCellRenderer rightCell_ = new DBCellRenderer(SwingConstants.RIGHT); - /*private*/DBCellRenderer leftCell_ = new DBCellRenderer(SwingConstants.LEFT); - // @C1D /*private*/ DBDateCellRenderer dateCell_ = new DBDateCellRenderer(DBDateCellRenderer.FORMAT_DATE); - // @C1D /*private*/ DBDateCellRenderer timeCell_ = new DBDateCellRenderer(DBDateCellRenderer.FORMAT_TIME); - // @C1D /*private*/ DBDateCellRenderer timestampCell_ = new DBDateCellRenderer(DBDateCellRenderer.FORMAT_TIMESTAMP); - - DBCellSelector cellSelector_ = new DBCellSelector(); //@D6A - DBCellEditor cellEditor_ = new DBCellEditor(); //@D6A - - // General types of data in columns. Used to determine column renderer. - private static final int TYPE_CHAR = 1; - private static final int TYPE_TIME = 2; - private static final int TYPE_TIMESTAMP = 3; - private static final int TYPE_DATE = 4; - private static final int TYPE_BIT = 5; - private static final int TYPE_NUMBER = 6; - - /** - Constructs a SQLResultSetTablePane object. - **/ - public SQLResultSetTablePane() - { - super(); - - // Create table and model to hold data. - model_ = new SQLResultSetTableModel(); - - /* @B0M - moved to initializeTransient() - - table_ = new JTable(); - table_.setAutoCreateColumnsFromModel(false); - table_.setModel(model_); - table_.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - - // Listen for events, pass them on to our listeners. - model_.addPropertyChangeListener(changeListeners_); - model_.addVetoableChangeListener(vetoListeners_); - model_.addErrorListener(errorListeners_); - model_.addWorkingListener(worker_); - table_.getSelectionModel().addListSelectionListener(selectionListeners_); - - // Build GUI - setLayout(new BorderLayout()); - tablePane_ = new JScrollPane(table_); // @A1C - add("Center",tablePane_); - - */ - - initializeTransient(); //@B0A - } - - - /** - Constructs a SQLResultSetTablePane object. - - @param connection The SQL connection. - @param query The SQL query. - **/ - public SQLResultSetTablePane(SQLConnection connection, String query) - { - super(); - - // Create table and model to hold data. - // note: model validates parms - model_ = new SQLResultSetTableModel(connection, query); - - /* @B0M - moved to initializeTransient() - - table_ = new JTable(); - table_.setAutoCreateColumnsFromModel(false); - table_.setModel(model_); - table_.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - - // Listen for events, pass them on to our listeners. - model_.addPropertyChangeListener(changeListeners_); - model_.addVetoableChangeListener(vetoListeners_); - model_.addErrorListener(errorListeners_); - model_.addWorkingListener(worker_); - table_.getSelectionModel().addListSelectionListener(selectionListeners_); - - // Build GUI - setLayout(new BorderLayout()); - tablePane_ = new JScrollPane(table_); // @A1C - add("Center",tablePane_); - - */ - - initializeTransient(); //@B0A - } - - - // @C0A - /** - Constructs a SQLResultSetTablePane object. - - @param resultSet The SQL result set. - @param cacheAll true to cache the entire result set when load() - is called, false to cache parts of the result set as they are - needed. Passing true may result in slow initial presentation of - the data. However, it may be necessary to pass true if the result - set is expected to close when the model is still needed. - **/ - public SQLResultSetTablePane(ResultSet resultSet, boolean cacheAll) - { - super(); - - // Create table and model to hold data. - // note: model validates parms - model_ = new SQLResultSetTableModel(resultSet, cacheAll); - initializeTransient(); - } - - - /** - Adds a listener to be notified when an error occurs. - - @param listener The listener. - **/ - public void addErrorListener(ErrorListener listener) - { - errorListeners_.addErrorListener(listener); - } - - - /** - Adds a listener to be notified when the selection changes. - - @param listener The listener. - **/ - public void addListSelectionListener(ListSelectionListener listener) - { - selectionListeners_.addListSelectionListener(listener); - } - - - /** - Adds a listener to be notified when the value of any bound - property is changed. - - @param listener The listener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - changeListeners_.addPropertyChangeListener(listener); - super.addPropertyChangeListener(listener); - } - - - /** - Adds a listener to be notified when the value of any constrained - property is changed. - - @param listener The listener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - vetoListeners_.addVetoableChangeListener(listener); - super.addVetoableChangeListener(listener); - } - - - - /** - Clears all SQL warnings. - **/ - public void clearWarnings() - { - model_.clearWarnings(); - } - - - /** - Closes the SQL result set this table represents. - **/ - public void close() - { - model_.close(); - } - - - - /** - Returns the column model for this table. - - @return Model for this table's columns. - **/ - public TableColumnModel getColumnModel() - { - return table_.getColumnModel(); - } - - - - /** - Returns the title of a column. This is used for the table column heading. - If an error occurs, null is returned. - - @param columnIndex The index of the column. Indices start at 0. - - @return The title of the column. - **/ - public String getColumnTitle(int columnIndex) - { - try - { - return(String)(table_.getColumnModel().getColumn(columnIndex).getHeaderValue()); - } - catch(Exception e) - { - Trace.log(Trace.WARNING, "getColumnTitle() error:" + e); - return null; - } - } - - - - /** - Returns the width of a column. - If an error occurs, 0 is returned. - - @param columnIndex The index of the column. Indices start at 0. - - @return The width of the column. - **/ - public int getColumnWidth(int columnIndex) - { - try - { - return table_.getColumnModel().getColumn(columnIndex).getPreferredWidth(); //@B1C - } - catch(Exception e) - { - Trace.log(Trace.WARNING, "getColumnWidth() error:" + e); - return 0; - } - } - - - - /** - Returns the SQL connection with which to access data. - - @return The SQL connection. - **/ - public SQLConnection getConnection() - { - return model_.getConnection(); - } - - - - /** - Returns the data model for the table. - - @return The data model for the table. - **/ - public SQLResultSetTableModel getDataModel() - { - return model_; - } - - - - /** - Returns the color used to draw grid lines. - - @return The color used to draw grid lines. - **/ - public Color getGridColor() - { - //@B0D return table_.getGridColor(); - return tableColor_; //@B0A - } - - - - /** - Returns the SQL query used to generate the table data. - - @return The SQL query. - **/ - public String getQuery() - { - return model_.getQuery(); - } - - - - // @C0A - /** - Returns the SQL result set. - - @return The SQL result set. - **/ - public ResultSet getResultSet() - { - return model_.getResultSet(); - } - - - - /** - Returns the ListSelectionModel that is used to maintain row selection state. - - @return The model that provides row selection state. - **/ - public ListSelectionModel getSelectionModel() - { - return table_.getSelectionModel(); - } - - - - /** - Returns whether horizontal lines are drawn between rows. - @return true if horizontal lines are to be drawn; false otherwise. - **/ - public boolean getShowHorizontalLines() - { - //@B0D return table_.getShowHorizontalLines(); - return tableShowHorizontalLines_; //@B0A - } - - - - /** - Returns whether vertical lines are drawn between columns. - @return true if vertical lines are to be drawn; false otherwise. - **/ - public boolean getShowVerticalLines() - { - //@B0D return table_.getShowVerticalLines(); - return tableShowVerticalLines_; //@B0A - } - - - - /** - Returns the string value at the specifed row and column. - Indices start at 0. - If an error occurs, null is returned. - - @param rowIndex The row index. - @param columnIndex The column index. - - @return The value at the specified row and column as a string. - **/ - // Note that this method is dependent on the cell renderer of a column - // being a JLabel. - public String getStringValueAt(int rowIndex, int columnIndex) - { - // Try to catch row index out of range. - if(rowIndex >= model_.getRowCount()) - { - Trace.log(Trace.WARNING, "getStringValueAt() column out of range"); - return null; - } - - try - { - TableColumnModel cmodel = getColumnModel(); - Component cellComp = cmodel.getColumn(columnIndex) - .getCellRenderer() - .getTableCellRendererComponent(table_, - getValueAt(rowIndex,columnIndex), - false, - false, - rowIndex, - columnIndex); - if(cellComp instanceof JLabel) - return((JLabel)cellComp).getText(); - else - return null; - } - catch(Exception e) - { - Trace.log(Trace.WARNING, "getStringValueAt() error:" + e); - return null; - } - } - - - - /** - Returns the value at the specifed row and column. - Indices start at 0. - If an error occurs, null is returned. - - @param rowIndex The row index. - @param columnIndex The column index. - - @return The value at the specified row and column. - **/ - public Object getValueAt(int rowIndex, int columnIndex) - { - try - { - // must change the table column index to the - // model index - return model_.getValueAt(rowIndex, - getColumnModel().getColumn(columnIndex).getModelIndex()); - } - catch(Exception e) - { - Trace.log(Trace.WARNING, "getStringValueAt() error:" + e); - return null; - } - } - - - - /** - Returns the warnings generated by the JDBC connection, statement, and - result set. - The warnings from the result set will be - linked to the end of any statement warnings, which in turn are linked - to the end of any connection warnings. - Warnings are cleared when load() or clearWarnings() - is called. - - @return The warnings generated by the connection, statement, and - result set, or null if none. - **/ - public SQLWarning getWarnings() - { - return model_.getWarnings(); - } - - - - void handleFocus(FocusEvent event) // @C2A - { // @C2A - // Can not call this directly from inner @C2A - // class, since it is protected. @C2A - processFocusEvent(new FocusEvent(this, event.getID(), event.isTemporary())); // @C2A - } // @C2A - - - /** - * Initializes transient data. - **/ - private void initializeTransient() - { - //@B0M - this code moved out of ctor - - table_ = new JTable(); - table_.setAutoCreateColumnsFromModel(false); - table_.setModel(model_); - model_.setTable(table_); /* Let the model know about the table so that the selected cell can be preserved @B6A*/ - table_.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - - table_.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); //@D6A - table_.setRowSelectionAllowed(true); //@D6A - table_.setColumnSelectionAllowed(true); //@D6A - table_.setCellSelectionEnabled(true); //@D6A - - //@D6A - See if we can use the new JDK 1.3 function - boolean useNewBehavior; - try - { - Class.forName("javax.swing.ActionMap"); - useNewBehavior = true; - } - catch(Throwable t) - { - Trace.log(Trace.WARNING, "Unable to load JDK 1.3 classes. Will use old behavior for SQLResultSetTablePane."); - useNewBehavior = false; - } - - if (useNewBehavior) //@D6A - { - //@D6A - JTextField has a copy action already associated with it - // that was put there by the Swing implementation for this platform. - // We look that up and get the correct key mappings for this platform's - // copy function. We then add those mappings to the JTable. - Object keyToLookFor = null; - JTextField dummyField = new JTextField(); - ActionMap dummyActions = dummyField.getActionMap(); - Object[] allKeys = dummyActions.allKeys(); - for(int i=0; i 0) - { - Action copyAction = new AbstractAction("copy") - { - public void actionPerformed(ActionEvent e) - { - if(e.getSource() == table_) - { - StringBuffer textToCopy = new StringBuffer(); - int[] rows = table_.getSelectedRows(); - int[] columns = table_.getSelectedColumns(); - for (int i=0; iquery and connection properties - must be set before this method is called. - The table heading is reconstructed to ensure it matches - the data, so any column customization will be lost. - **/ - public void load() - { - // refresh the result set data - // note: model handles error conditions - model_.load(); - refreshHeadings(); - } - - - /** - Restore the state of this object from an object input stream. - It is used when deserializing an object. - @param in The input stream of the object being deserialized. - @exception IOException - @exception ClassNotFoundException - **/ - private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - // Restore the non-static and non-transient fields. - in.defaultReadObject(); - - // Initialize the transient fields. - changeListeners_ = new PropertyChangeSupport(this); - model_.addPropertyChangeListener(changeListeners_); - vetoListeners_ = new VetoableChangeSupport(this); - model_.addVetoableChangeListener(vetoListeners_); - errorListeners_ = new ErrorEventSupport(this); - model_.addErrorListener(errorListeners_); - worker_ = new WorkingCursorAdapter(this); - model_.addWorkingListener(worker_); - selectionListeners_ = new ListSelectionEventSupport(this); - - initializeTransient(); //@B0A - //@B0D table_.getSelectionModel().addListSelectionListener(selectionListeners_); - - //@B0 - table_ is now transient, so we need to reset its attributes. - table_.setGridColor(tableColor_); //@B0A - table_.setShowHorizontalLines(tableShowHorizontalLines_); //@B0A - table_.setShowVerticalLines(tableShowVerticalLines_); //@B0A - - } - - - - /** - Updates the table header to match the result set data. - Any column customization will be lost. - **/ - public void refreshHeadings() - { - Runnable refreshHeading = new Runnable() - { - public void run() - { - - // Remove all columns. - // First copy enumereration, then delete each column. - TableColumnModel model = table_.getColumnModel(); - int oldColumnCount = model.getColumnCount(); - TableColumn oldColumns[] = new TableColumn[oldColumnCount]; - Enumeration e = model.getColumns(); - for(int i=0; e.hasMoreElements() ; ++i) - { - oldColumns[i] = (TableColumn)e.nextElement(); - } - for(int i=0; icolTitleSize?colDataSize:colTitleSize; - // add 10 to account for the empty border in the cells - col.setPreferredWidth(colSize*size+10); //@B1C - } - - if(!model_.isUpdatable()) //@D6A - { - col.setCellEditor(cellSelector_); //@D6A - } - else if (type == TYPE_CHAR) //@D6C - { - col.setCellEditor(cellEditor_); //@D6A - } - // otherwise, just use the table's default editor. - - - table_.addColumn(col); - } - - // Redo the panel. This is needed in the case where there was - // no data previously, since no header would have been created - // for the table. Only done if no previous columns, and now - // there are columns. - if(oldColumnCount == 0 && numColumns > 0) - { - if(tablePane_ != null) - remove(tablePane_); - tablePane_ = new JScrollPane(table_); // @A1C - add("Center",tablePane_); - } - - // Refresh the pane. - validate(); - - } - }; - - // Try and refresh the heading in the event dispatcher thread. - // This is done because doing it inline seems to cause hangs, - // and Swing documentation seems to suggest doing all GUI - // work in the event dispatching thread. - try - { - SwingUtilities.invokeAndWait(refreshHeading); - } - catch(Error e) - { - // Error received. Assume that the error was because we are - // already in the event dispatching thread. Do work in the - // current thread. - Trace.log(Trace.DIAGNOSTIC, "invokeAndWait error:" + e); - refreshHeading.run(); - } - catch(Exception e) - { - Trace.log(Trace.ERROR, "invokeAndWait exception:" + e); - } - } - - - - /** - Removes a listener from being notified when an error occurs. - - @param listener The listener. - **/ - public void removeErrorListener(ErrorListener listener) - { - errorListeners_.removeErrorListener(listener); - } - - - - /** - Removes a listener from being notified when the selection changes. - - @param listener The listener. - **/ - public void removeListSelectionListener(ListSelectionListener listener) - { - selectionListeners_.removeListSelectionListener(listener); - } - - - - /** - Removes a listener from being notified when the value of any bound - property is changed. - - @param listener The listener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - changeListeners_.removePropertyChangeListener(listener); - super.removePropertyChangeListener(listener); - } - - - - /** - Removes a listener from being notified when the value of any constrained - property is changed. - - @param listener The listener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetoListeners_.removeVetoableChangeListener(listener); - super.removeVetoableChangeListener(listener); - } - - - - /** - Sets the title of a column. This is used for the table column heading. - - @param columnIndex The index of column. Indices start at 0. - @param title The title for the column. - **/ - public void setColumnTitle(int columnIndex, - String title) - { - // Catch errors if the index is out of range. - try - { - table_.getColumnModel().getColumn(columnIndex).setHeaderValue(title); - } - catch(Exception e) - { - Trace.log(Trace.WARNING, "setColumnTitle() error:" + e); - } - // Swing doesn't repaint without a little prodding. - validate(); - repaint(); // @B2A - } - - - - /** - Sets the width of a column. - - @param columnIndex The index of column. Indices start at 0. - @param width The column width. - **/ - public void setColumnWidth(int columnIndex, - int width) - { - // Catch errors if the index being out of range. - try - { - table_.getColumnModel().getColumn(columnIndex).setPreferredWidth(width); //@B1C - table_.getColumnModel().getColumn(columnIndex).setWidth(width); // @B2A - } - catch(Exception e) - { - Trace.log(Trace.WARNING, "setColumnWidth() error:" + e); - } - validate(); // @B2A - repaint(); // @B2A - } - - - - /** - Sets the SQL connection with which to access data. - This property is bound and constrained. - Note that the data in the table will not change until a - load() is done. - - @param connection The SQL connection. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setConnection(SQLConnection connection) - throws PropertyVetoException - { - // Note: the model handles the binding and constraining. - // note: model validates parms - model_.setConnection(connection); - } - - - - /** - Sets the color used to draw grid lines. - - @param color The color used to draw the grid lines. - **/ - public void setGridColor(Color color) - { - table_.setGridColor(color); - tableColor_ = color; //@B0A - } - - - - /** - Sets the SQL query used to build the table. - This property is bound and constrained. - Note that the data in the table will not change until a - load() is done. - - @param query The SQL query. - @exception PropertyVetoException If the change is vetoed. - **/ - public void setQuery(String query) - throws PropertyVetoException - { - // Note: the model handles the binding and constraining. - // note: model validates parms - model_.setQuery(query); - } - - - - // @C0A - /** - Sets the SQL result set used to build the table. - If this is set, it is used instead of the SQL connection - and SQL query. - Note that the data in the table will not change until a - load() is done. - - @param resultSet The SQL result set. - **/ - public void setResultSet(ResultSet resultSet) - { - model_.setResultSet(resultSet); - } - - - - /** - Sets the ListSelectionModel that is used to maintain row selection state. - - @param model The model that provides the row selection state. - **/ - public void setSelectionModel(ListSelectionModel model) - { - // cleanup old listener - table_.getSelectionModel().removeListSelectionListener(selectionListeners_); - // make change - table_.setSelectionModel(model); - // listen to new model - table_.getSelectionModel().addListSelectionListener(selectionListeners_); - } - - - - /** - Sets whether horizontal lines are drawn between rows. - @param show true if horizontal lines are to be drawn; false otherwise. - **/ - public void setShowHorizontalLines(boolean show) - { - table_.setShowHorizontalLines(show); - tableShowHorizontalLines_ = show; //@B0A - } - - - - /** - Sets whether vertical lines are drawn between columns. - @param show true if vertical lines are to be drawn; false otherwise. - **/ - public void setShowVerticalLines(boolean show) - { - table_.setShowVerticalLines(show); - tableShowVerticalLines_ = show; //@B0A - } - - // - // Temporary testcase code. -- Leave here if we need to test @B6A - // - public static void main(String args[]) { - BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); - - try { - String line = "X"; - boolean loop=true; - while (line != null && !"exit".equalsIgnoreCase(line)) { - // Register the IBM Toolbox for Java JDBC driver. - - Class.forName("com.ibm.as400.access.AS400JDBCDriver"); - // Use JDBC to execute the SQL query directly. - Connection connection = DriverManager.getConnection("jdbc:as400://"+args[0], args[1], args[2]); - Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - ResultSet rs = statement.executeQuery("SELECT * FROM QSYS2.SYSCOLUMNS"); - // Create the SQLResultSetTablePane object. - SQLResultSetTablePane table = new SQLResultSetTablePane(rs, false); - // Put the table in a JFrame. - JFrame frame = new JFrame("My Window"); - frame.getContentPane().add(table); - // Set up the error dialog adapter. - table.addErrorListener(new ErrorDialogAdapter(frame)); - // Display the JFrame. - frame.pack(); - frame.show(); - // Load the contents of the table. - table.load(); - - System.out.println("Table loaded Sleeping for 10 minutes"); - try { - Thread.sleep(600000); - } catch (Exception e) { - e.printStackTrace(); - } - line = input.readLine(); - - } - } catch (Exception e) { - e.printStackTrace(); - } - } - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTablePane16.gif b/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTablePane16.gif deleted file mode 100644 index 9f4039a0a..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTablePane16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTablePane32.gif b/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTablePane32.gif deleted file mode 100644 index 1772a11c7..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTablePane32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTablePaneBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTablePaneBeanInfo.java deleted file mode 100644 index fee75b810..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLResultSetTablePaneBeanInfo.java +++ /dev/null @@ -1,195 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLResultSetTablePaneBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - -/** -The SQLResultSetTablePaneBeanInfo class provides bean -information for the SQLResultSetTablePane class. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class SQLResultSetTablePaneBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = SQLResultSetTablePane.class; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - // ***** EVENTS - EventSetDescriptor error = new EventSetDescriptor(beanClass, - "error", - com.ibm.as400.vaccess.ErrorListener.class, - "errorOccurred"); - error.setDisplayName(ResourceLoader.getText("EVT_NAME_ERROR")); - error.setShortDescription(ResourceLoader.getText("EVT_DESC_ERROR")); - - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_VETO")); - - EventSetDescriptor select = new EventSetDescriptor(beanClass, - "listSelection", - javax.swing.event.ListSelectionListener.class, - "valueChanged"); - select.setDisplayName(ResourceLoader.getText("EVT_NAME_LIST_SELECTION")); - select.setShortDescription(ResourceLoader.getText("EVT_DESC_LIST_SELECTION")); - - events_ = new EventSetDescriptor[]{error, changed, veto, select}; - - - // ***** PROPERTIES - PropertyDescriptor query = new PropertyDescriptor("query", beanClass); - query.setBound(true); - query.setConstrained(true); - query.setDisplayName(ResourceLoader.getText("PROP_NAME_QUERY")); - query.setShortDescription(ResourceLoader.getText("PROP_DESC_QUERY")); - - PropertyDescriptor connection = new PropertyDescriptor("connection", beanClass); - connection.setBound(true); - connection.setConstrained(true); - connection.setDisplayName(ResourceLoader.getText("PROP_NAME_CONNECTION")); - connection.setShortDescription(ResourceLoader.getText("PROP_DESC_CONNECTION")); - - PropertyDescriptor gridColor = new PropertyDescriptor("gridColor", beanClass); - gridColor.setBound(false); - gridColor.setConstrained(false); - gridColor.setExpert(true); - gridColor.setDisplayName(ResourceLoader.getText("PROP_NAME_GRID_COLOR")); - gridColor.setShortDescription(ResourceLoader.getText("PROP_DESC_GRID_COLOR")); - - PropertyDescriptor showHorizontal = new PropertyDescriptor("showHorizontalLines", beanClass); - showHorizontal.setBound(false); - showHorizontal.setConstrained(false); - showHorizontal.setExpert(true); - showHorizontal.setDisplayName(ResourceLoader.getText("PROP_NAME_SHOW_H_LINES")); - showHorizontal.setShortDescription(ResourceLoader.getText("PROP_DESC_SHOW_H_LINES")); - - PropertyDescriptor showVertical = new PropertyDescriptor("showVerticalLines", beanClass); - showVertical.setBound(false); - showVertical.setConstrained(false); - showVertical.setExpert(true); - showVertical.setDisplayName(ResourceLoader.getText("PROP_NAME_SHOW_V_LINES")); - showVertical.setShortDescription(ResourceLoader.getText("PROP_DESC_SHOW_V_LINES")); - - properties_ = new PropertyDescriptor[]{query, connection, - gridColor, showHorizontal, showVertical}; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the error event - return 0; - } - - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the "query" property - return 0; - } - - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("SQLResultSetTablePane16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("SQLResultSetTablePane32.gif"); - break; - } - - return image; - } - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementButton.java b/cvsroot/src/com/ibm/as400/vaccess/SQLStatementButton.java deleted file mode 100644 index ee9d0979e..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementButton.java +++ /dev/null @@ -1,615 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLStatementButton.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.ActionCompletedListener; -import com.ibm.as400.access.ActionCompletedEvent; -import com.ibm.as400.access.Trace; -import javax.swing.Icon; -import javax.swing.JButton; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.Serializable; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.Statement; - - - -/** -The SQLStatementButton class represents a button control that issues a -SQL statement when pressed. - -

    It is up to the user to register a JDBC driver when using this class. -For example, the following code registers the IBM Toolbox for Java -JDBC driver. -

    -   DriverManager.registerDriver (new com.ibm.as400.access.AS400JDBCDriver ());
    -
    - -

    Most errors are reported by firing ErrorEvents, rather -than throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    SQLStatementButton objects generate the following events: -

      -
    • ActionCompletedEvent -
    • ErrorEvent -
    • PropertyChangeEvent -
    • WorkingEvent -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -// Note that the JDBC resources are not explicitly closed, -// the user or garbage collection is relied upon to close them. -public class SQLStatementButton -extends JButton -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// The variables which have private commented out had to made -// package scope since currently Internet Explorer does not -// allow inner class to access private variables in their -// containing class. - -// Event support. -transient /*private*/ ActionCompletedEventSupport actionListeners_ - = new ActionCompletedEventSupport (this); -transient /*private*/ ErrorEventSupport errorListeners_ - = new ErrorEventSupport (this); -transient /*private*/ WorkingEventSupport workingListeners_ - = new WorkingEventSupport (this); - -// Adapter for listening for working events and enabling working cursor. -transient /*private*/ WorkingCursorAdapter worker_ - = new WorkingCursorAdapter(this); - -// properties -/*private*/ SQLConnection connection_ = null; -/*private*/ String sql_ = null; -transient /*private*/ SQLWarning warnings_ = null; - -// SQL statement -transient /*private*/ Statement statement_ = null; - - -/** -Constructs a SQLStatementButton object. -**/ -public SQLStatementButton () -{ - super(); - addActionListener(new ButtonListener_()); -} - - - -/** -Constructs a SQLStatementButton object. - -@param icon The icon to be placed on the button. -**/ -public SQLStatementButton (Icon icon) -{ - super(icon); - addActionListener(new ButtonListener_()); -} - - - -/** -Constructs a SQLStatementButton object. - -@param text The text to be placed on the button. -**/ -public SQLStatementButton (String text) -{ - super(text); - addActionListener(new ButtonListener_()); -} - - - -/** -Constructs a SQLStatementButton object. - -@param text The text to be placed on the button. -@param icon The icon to be placed on the button. -**/ -public SQLStatementButton (String text, - Icon icon) -{ - super(text, icon); - addActionListener(new ButtonListener_()); -} - - - -/** -Constructs a SQLStatementButton object. - -@param text The text to be placed on the button. -@param icon The icon to be placed on the button. -@param connection The SQL connection. -@param SQLStatement The SQL statement. -**/ -public SQLStatementButton (String text, - Icon icon, - SQLConnection connection, - String SQLStatement) -{ - super(text, icon); - if (connection == null) - throw new NullPointerException("connection"); - connection_ = connection; - if (SQLStatement == null) - throw new NullPointerException("SQLStatement"); - sql_ = SQLStatement; - addActionListener(new ButtonListener_()); -} - - - -/** -Adds a listener to be notified when a SQL statement is executed. -The listener's actionCompleted() method will be called. - -@param listener The listener. -**/ -public void addActionCompletedListener (ActionCompletedListener listener) -{ - actionListeners_.addActionCompletedListener(listener); -} - - - -/** -Adds a listener to be notified when an error occurs. -The listener's errorOccurred() method will be called. - -@param listener The listener. -**/ -public void addErrorListener (ErrorListener listener) -{ - errorListeners_.addErrorListener (listener); -} - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ -public void addWorkingListener (WorkingListener listener) -{ - workingListeners_.addWorkingListener (listener); -} - - - -/** -Returns the SQL connection used to execute statements. - -@return The SQL connection. -**/ -public SQLConnection getConnection () -{ - return connection_; -} - - - -/** -Makes the next result of the last statement run the current result. -Nothing is done if no statement has been executed. -

    Refer to JDBC documentation for more information. -**/ -public void getMoreResults() -{ - if (statement_ != null) - { - workingListeners_.fireStartWorking (); - try - { - statement_.getMoreResults(); - } - catch (SQLException e) - { - // Throw error event. - errorListeners_.fireError(e); - } - workingListeners_.fireStopWorking (); - } -} - - - -/** -Returns the current results of the last SQL statement run. -Multiple results can be obtained by -calling getUpdateCount() and/or getResultSet() multiple -times, with intervening getMoreResults() calls. -

    Refer to JDBC documentation for more information. - -@return The result set or null if the result was not a -result set, or if there are no results. -**/ -public ResultSet getResultSet() -{ - // If we haven't run anything, return null. - if (statement_ == null) - { - return null; - } - // Get the result set from the statement. - workingListeners_.fireStartWorking (); - ResultSet result = null; - try - { - result = statement_.getResultSet(); - } - catch(SQLException e) - { - // Throw error event. - errorListeners_.fireError(e); - } - workingListeners_.fireStopWorking (); - return result; -} - - - -/** -Returns the SQL statement that will be run when this button is pressed. - -@return The SQL statement that will be run when this button is pressed. -**/ -public String getSQLStatement () -{ - if (sql_ == null) - return ""; - return sql_; -} - - - -/** -Returns the number of rows affected by the last SQL statement run. -Multiple results can be obtained by -calling getUpdateCount() and/or getResultSet() multiple -times, with intervening getMoreResults() calls. -If an error occurs, 0 is returned. -

    Refer to JDBC documentation for more information. - -@return The number of rows that were -affected. If no rows were affected or the SQL statement was -a DDL command, 0 is returned. If there are no results or the results -are a result set, -1 is returned. -**/ -public int getUpdateCount() -{ - // If we haven't run anything, return -1. - if (statement_ == null) - { - return -1; - } - // Get the update count from the statement. - try - { - return statement_.getUpdateCount(); - } - catch(SQLException e) - { - // Throw error event. - errorListeners_.fireError(e); - return 0; - } -} - - - -/** -Returns the warnings generated by the JDBC connection and statement. -Each time the button is pressed (the SQL statement is run), the -warnings are cleared. Connection warnings are only available after the -first time a statement is executed. The warnings from the statement will -be linked to the end of any connection warnings. - -@return The warnings generated by the connection and statement, -or null if none. -**/ -public SQLWarning getWarnings () -{ - // If no statement, we are not in a state to have warnings. - if (statement_ == null) - return null; - - // Get statement warnings. - SQLWarning s_warnings = null; - try - { - s_warnings = statement_.getWarnings(); - } - catch(SQLException e) - { - // Throw error event, then continue. - errorListeners_.fireError(e); - } - - // If connection warnings... - if (warnings_ != null) - { - // If no statement warnings, just return connection warnings. - if (s_warnings == null) - { - return warnings_; - } - - // We have both connection and statement warnings. - // Find the last warning in the connection chain. - SQLWarning last = warnings_; - SQLWarning next; - while ((next = last.getNextWarning()) != null) - { - last = next; - } - // Add statement warnings to the end of connection chain. - last.setNextWarning(s_warnings); - return warnings_; - } - else - { - // otherwise, just return statement warnings - return s_warnings; - } -} - - -/** -Restore the state of this object from an object input stream. -It is used when deserializing an object. -@param in The input stream of the object being deserialized. -@exception IOException -@exception ClassNotFoundException -**/ -private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException -{ - // Restore the non-static and non-transient fields. - in.defaultReadObject(); - // Initialize the transient fields. - actionListeners_ = new ActionCompletedEventSupport(this); - errorListeners_ = new ErrorEventSupport(this); - workingListeners_ = new WorkingEventSupport(this); - worker_ = new WorkingCursorAdapter(this); - warnings_ = null; - statement_ = null; - // Restore listener - addActionListener(new ButtonListener_()); -} - - - -/** -Removes a listener from being notified when a SQL statement is issued. - -@param listener The listener. -**/ -public void removeActionCompletedListener(ActionCompletedListener listener) -{ - actionListeners_.removeActionCompletedListener(listener); -} - - -/** -Removes a listener from being notified when an error occurs. - -@param listener The listener. -**/ -public void removeErrorListener (ErrorListener listener) -{ - errorListeners_.removeErrorListener (listener); -} - - - -/** -Removes a listener from being notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ -public void removeWorkingListener (WorkingListener listener) -{ - workingListeners_.removeWorkingListener (listener); -} - - - -/** -Sets the SQL connection used to execute statements. -This property is bound and constrained. - -@param connection The SQL connection. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setConnection (SQLConnection connection) - throws PropertyVetoException -{ - if (connection == null) - throw new NullPointerException("connection"); - - // Fire a vetoable change event. - fireVetoableChange("connection", connection_, connection); - - // Make property change. - SQLConnection old = connection_; - connection_ = connection; - - // Statement is no longer valid, must be reconstructed. - if (old != connection) - { - if (statement_ != null) - { - try - { - statement_.close(); - } - catch (SQLException e) - { - errorListeners_.fireError(e); - } - } - statement_ = null; - warnings_ = null; - } - - // Fire the property change event. - firePropertyChange("connection", old, connection_); -} - - - -/** -Sets the SQL statement to run. This property -is bound and constrained. - -@param SQLStatement The SQL statement. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setSQLStatement (String SQLStatement) - throws PropertyVetoException -{ - if (SQLStatement == null) - throw new NullPointerException("SQLStatement"); - - String old = getSQLStatement(); - - // Fire a vetoable change event. - fireVetoableChange("SQLStatement", old, SQLStatement); - - // Make property change. - sql_ = SQLStatement; - - // Fire the property change event. - firePropertyChange("SQLStatement", old, sql_); -} - - - -/** -Class for listening to action events. This is used to run the -SQL statement when the button is pressed. -**/ -private class ButtonListener_ -implements ActionListener -{ - -public void actionPerformed(ActionEvent ev) -{ - // Ensure required properties have been set. - if (connection_ == null) - { - Exception e = new IllegalStateException("connection"); - errorListeners_.fireError(e); - return; - } - if (sql_ == null) - { - Exception e = new IllegalStateException("SQLStatement"); - errorListeners_.fireError(e); - return; - } - - Trace.log(Trace.INFORMATION, "Running button, sql is: " + sql_); - - workingListeners_.fireStartWorking (); - // Change cursor to working. - worker_.startWorking(new WorkingEvent(this)); - - // Make sure we have a valid statement to use. - if (statement_ == null) - { - Connection conn; - try - { - conn = connection_.getConnection(); - statement_ = conn.createStatement(); - } - catch(SQLException e) - { - // Cannot continue, so send event and return. - errorListeners_.fireError(e); - worker_.stopWorking(new WorkingEvent(this)); - workingListeners_.fireStopWorking (); - return; - } - // Store warnings to chain if warnings are requested. - try - { - warnings_ = conn.getWarnings(); - } - catch (SQLException e) - { - // Fire error event, but continue. - errorListeners_.fireError(e); - } - } - else - { - // clear all warnings - warnings_ = null; - try - { - statement_.clearWarnings(); - } - catch(SQLException e) - { - // Fire error event, but continue. - errorListeners_.fireError(e); - } - } - - // try to execute the statement - try - { - statement_.execute(sql_); - } - catch(SQLException e) - { - // Throw error event. - errorListeners_.fireError(e); - } - - // Send completion event. - actionListeners_.fireActionCompleted(); - - // Set cursor back. - worker_.stopWorking(new WorkingEvent(this)); - - workingListeners_.fireStopWorking (); -} - -} // end of class ButtonListener_ - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementButton16.gif b/cvsroot/src/com/ibm/as400/vaccess/SQLStatementButton16.gif deleted file mode 100644 index 1c1f00298..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementButton16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementButton32.gif b/cvsroot/src/com/ibm/as400/vaccess/SQLStatementButton32.gif deleted file mode 100644 index 207393ddc..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementButton32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementButtonBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/SQLStatementButtonBeanInfo.java deleted file mode 100644 index 07fb005e2..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementButtonBeanInfo.java +++ /dev/null @@ -1,189 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLStatementButtonBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - -/** -The SQLStatementButtonBeanInfo class provides bean -information for the SQLStatementButton class. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class SQLStatementButtonBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = SQLStatementButton.class; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - // ***** EVENTS - EventSetDescriptor error = new EventSetDescriptor(beanClass, - "error", - com.ibm.as400.vaccess.ErrorListener.class, - "errorOccurred"); - error.setDisplayName(ResourceLoader.getText("EVT_NAME_ERROR")); - error.setShortDescription(ResourceLoader.getText("EVT_DESC_ERROR")); - - EventSetDescriptor action = new EventSetDescriptor(beanClass, - "actionCompleted", - com.ibm.as400.access.ActionCompletedListener.class, - "actionCompleted"); - action.setDisplayName(ResourceLoader.getText("EVT_NAME_ACTION_COMPLETED")); - action.setShortDescription(ResourceLoader.getText("EVT_DESC_ACTION_COMPLETED")); - - String[] workingMethods = {"startWorking", "stopWorking"}; - EventSetDescriptor working = new EventSetDescriptor(beanClass, - "working", - com.ibm.as400.vaccess.WorkingListener.class, - workingMethods, - "addWorkingListener", - "removeWorkingListener"); - working.setDisplayName(ResourceLoader.getText("EVT_NAME_WORKING")); - working.setShortDescription(ResourceLoader.getText("EVT_DESC_WORKING")); - - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_VETO")); - - events_ = new EventSetDescriptor[]{error, action, changed, veto, working}; - - - // ***** PROPERTIES - PropertyDescriptor query = new PropertyDescriptor("SQLStatement", beanClass); - query.setBound(true); - query.setConstrained(true); - query.setDisplayName(ResourceLoader.getText("PROP_NAME_SQL")); - query.setShortDescription(ResourceLoader.getText("PROP_DESC_SQL")); - - PropertyDescriptor connection = new PropertyDescriptor("connection", beanClass); - connection.setBound(true); - connection.setConstrained(true); - connection.setDisplayName(ResourceLoader.getText("PROP_NAME_CONNECTION")); - connection.setShortDescription(ResourceLoader.getText("PROP_DESC_CONNECTION")); - - PropertyDescriptor text = new PropertyDescriptor("text", beanClass); - text.setBound(false); - text.setConstrained(false); - text.setDisplayName(ResourceLoader.getText("PROP_NAME_TEXT")); - text.setShortDescription(ResourceLoader.getText("PROP_DESC_TEXT")); - - properties_ = new PropertyDescriptor[]{query, connection, text}; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the error event - return 0; - } - - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the "SQLStatement" property - return 0; - } - - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("SQLStatementButton16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("SQLStatementButton32.gif"); - break; - } - - return image; - } - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementDocument.java b/cvsroot/src/com/ibm/as400/vaccess/SQLStatementDocument.java deleted file mode 100644 index e001b9fef..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementDocument.java +++ /dev/null @@ -1,579 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLStatementDocument.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.ActionCompletedEvent; -import com.ibm.as400.access.ActionCompletedListener; -import javax.swing.text.BadLocationException; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import javax.swing.text.PlainDocument; -import javax.swing.text.Position; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.IOException; -import java.io.Serializable; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.Statement; - - - -/** -The SQLStatementDocument class represents SQL statement that is -issued when execute() is called. - -

    It is up to the user to register a JDBC driver when using this class. -For example, the following code registers the IBM Toolbox for Java -JDBC driver. -

    -   DriverManager.registerDriver (new com.ibm.as400.access.AS400JDBCDriver ());
    -
    - -

    Most errors are reported by firing ErrorEvents, rather -than throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    SQLStatementDocument objects generate the following events: -

      -
    • ActionCompletedEvent -
    • ErrorEvent -
    • PropertyChangeEvent -
    • DocumentEvent -
    • WorkingEvent -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -// Because the information from SQLStatement Documents may be the result -// of SQL that is no longer equal to the text of the document, -// getSQLStatement is provided. -// Note that the JDBC resources are not explicitly closed, -// the user or garbage collection is relied upon to close them. -public class SQLStatementDocument -extends PlainDocument -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - -// Event support. -transient private PropertyChangeSupport changeListeners_ - = new PropertyChangeSupport (this); -transient private VetoableChangeSupport vetoListeners_ - = new VetoableChangeSupport (this); -transient private ActionCompletedEventSupport actionListeners_ - = new ActionCompletedEventSupport (this); -transient private ErrorEventSupport errorListeners_ - = new ErrorEventSupport (this); -transient private WorkingEventSupport workingListeners_ - = new WorkingEventSupport (this); - -// properties -private SQLConnection connection_ = null; -transient private SQLWarning warnings_ = null; - -transient private Statement statement_ = null; -transient private String sql_ = ""; // Last SQL statement submitted. - - -/** -Constructs a SQLStatementDocument object. -**/ -public SQLStatementDocument () -{ - super(); -} - - - -/** -Constructs a SQLStatementDocument object. - -@param connection The SQL connection. -@param text The text for the document -**/ -public SQLStatementDocument (SQLConnection connection, - String text) -{ - super(); - if (connection == null) - throw new NullPointerException("connection"); - if (text == null) - throw new NullPointerException("text"); - try - { - insertString(0, text, null); - } - catch(BadLocationException e) {} // will never happen - connection_ = connection; -} - - - -/** -Adds a listener to be notified when a SQL statement is executed. -The listener's actionCompleted() method will be called. - -@param listener The listener. -**/ -public void addActionCompletedListener (ActionCompletedListener listener) -{ - actionListeners_.addActionCompletedListener(listener); -} - - - -/** -Adds a listener to be notified when an error occurs. -The listener's errorOccurred() method will be called. - -@param listener The listener. -**/ -public void addErrorListener (ErrorListener listener) -{ - errorListeners_.addErrorListener (listener); -} - - - -/** -Adds a listener to be notified when the value of any bound -property is changed. -The listener's propertyChange() method will be called. - -@param listener The listener. -**/ -public void addPropertyChangeListener (PropertyChangeListener listener) -{ - changeListeners_.addPropertyChangeListener (listener); -} - - - -/** -Adds a listener to be notified when the value of any constrained -property is changed. -The listener's vetoableChange() method will be called. - -@param listener The listener. -**/ -public void addVetoableChangeListener (VetoableChangeListener listener) -{ - vetoListeners_.addVetoableChangeListener (listener); -} - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ -public void addWorkingListener (WorkingListener listener) -{ - workingListeners_.addWorkingListener (listener); -} - - - -/** -Runs the contents of this document as a SQL statement. -**/ -public void execute() -{ - // Ensure required properties have been set. - if (connection_ == null) - { - Exception e = new IllegalStateException("connection"); - errorListeners_.fireError(e); - return; - } - - workingListeners_.fireStartWorking (); - - // Make sure we have a valid statement to use. - if (statement_ == null) - { - Connection conn; - try - { - conn = connection_.getConnection(); - statement_ = conn.createStatement(); - } - catch (SQLException e) - { - // Cannot continue, so send event and return. - errorListeners_.fireError(e); - return; - } - // Store warnings to chain if warnings are requested. - try - { - warnings_ = conn.getWarnings(); - } - catch (SQLException e) - { - // Fire error event, but continue. - errorListeners_.fireError(e); - } - } - else - { - // clear all warnings - warnings_ = null; - try - { - statement_.clearWarnings(); - } - catch(SQLException e) - { - // Fire error event, but continue. - errorListeners_.fireError(e); - } - } - - // try to execute the statement - try - { - sql_ = getText(0, getLength()); - statement_.execute(sql_); - } - catch (BadLocationException e)// {} // should not occur - { - errorListeners_.fireError(e); - } - catch (SQLException e) - { - errorListeners_.fireError(e); - } - - // Send events. - actionListeners_.fireActionCompleted(); - workingListeners_.fireStopWorking (); -} - - - -/** -Returns the SQL connection used to execute statements. - -@return The SQL connection. -**/ -public SQLConnection getConnection () -{ - return connection_; -} - - - -/** -Makes the next result of the last statement run the current result. -Nothing is done if no statement has been executed. -

    Refer to JDBC documentation for more information. -**/ -public void getMoreResults() -{ - if (statement_ != null) - { - workingListeners_.fireStartWorking (); - try - { - statement_.getMoreResults(); - } - catch (SQLException e) - { - // Throw error event. - errorListeners_.fireError(e); - } - workingListeners_.fireStopWorking (); - } -} - - - -/** -Returns the current results of the last SQL statement run. -Multiple results can be obtained by -calling getUpdateCount() and/or getResultSet() multiple -times, with intervening getMoreResults() calls. -

    Refer to JDBC documentation for more information. - -@return The result set or null if the result was not a -result set, or if there are no results. -**/ -public ResultSet getResultSet() -{ - // If we haven't run anything, return null. - if (statement_ == null) - { - return null; - } - // Get the result set from the statement. - workingListeners_.fireStartWorking (); - ResultSet result = null; - try - { - result = statement_.getResultSet(); - } - catch(SQLException e) - { - // Throw error event. - errorListeners_.fireError(e); - } - workingListeners_.fireStopWorking (); - return result; -} - - - -/** -Returns the SQL statement that was last executed -which the results in this object represent. - -@return The SQL statement that the results in this object represent. -**/ -public String getSQLStatement () -{ - return sql_; -} - - - -/** -Returns the number of rows affected by the last SQL statement run. -Multiple results can be obtained by -calling getUpdateCount() and/or getResultSet() multiple -times, with intervening getMoreResults() calls. -If an error occurs, 0 is returned. -

    Refer to JDBC documentation for more information. - -@return The number of rows that were -affected. If no rows were affected or the SQL statement was -a DDL command, 0 is returned. If there are no results or the results -are a result set, -1 is returned. -**/ -public int getUpdateCount() -{ - // If we haven't run anything, return -1. - if (statement_ == null) - { - return -1; - } - // Get the update count from the statement. - try - { - return statement_.getUpdateCount(); - } - catch(SQLException e) - { - // Throw error event. - errorListeners_.fireError(e); - return 0; - } -} - - - -/** -Returns the warnings generated by the JDBC connection and statement. -Each time the execute() is called (the SQL statement is run), the -warnings are cleared. Connection warnings are only available after the -first time a statement is executed. The warnings from the statement will -be linked to the end of any connection warnings. - -@return The warnings generated by the connection and statement, -or null if none. -**/ -public SQLWarning getWarnings () -{ - // If no statement, we are not in a state to have warnings. - if (statement_ == null) - return null; - - // Get statement warnings. - SQLWarning s_warnings = null; - try - { - s_warnings = statement_.getWarnings(); - } - catch(SQLException e) - { - // Throw error event, then continue. - errorListeners_.fireError(e); - } - - // If connection warnings... - if (warnings_ != null) - { - // If no statement warnings, just return connection warnings. - if (s_warnings == null) - { - return warnings_; - } - - // We have both connection and statement warnings. - // Find the last warning in the connection chain. - SQLWarning last = warnings_; - SQLWarning next; - while ((next = last.getNextWarning()) != null) - { - last = next; - } - // Add statement warnings to the end of connection chain. - last.setNextWarning(s_warnings); - return warnings_; - } - else - { - // otherwise, just return statement warnings - return s_warnings; - } -} - - - -/** -Restore the state of this object from an object input stream. -It is used when deserializing an object. -@param in The input stream of the object being deserialized. -@exception IOException -@exception ClassNotFoundException -**/ -private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException -{ - // Restore the non-static and non-transient fields. - in.defaultReadObject(); - // Initialize the transient fields. - changeListeners_ = new PropertyChangeSupport(this); - vetoListeners_ = new VetoableChangeSupport(this); - actionListeners_ = new ActionCompletedEventSupport(this); - errorListeners_ = new ErrorEventSupport(this); - workingListeners_ = new WorkingEventSupport(this); - warnings_ = null; - statement_ = null; - sql_ = ""; -} - - - -/** -Removes a listener from being notified when a SQL statement is issued. - -@param listener The listener. -**/ -public void removeActionCompletedListener(ActionCompletedListener listener) -{ - actionListeners_.removeActionCompletedListener(listener); -} - - -/** -Removes a listener from being notified when an error occurs. - -@param listener The listener. -**/ -public void removeErrorListener (ErrorListener listener) -{ - errorListeners_.removeErrorListener (listener); -} - - - -/** -Removes a listener from being notified when the value of any bound -property is changed. - -@param listener The listener. -**/ -public void removePropertyChangeListener (PropertyChangeListener listener) -{ - changeListeners_.removePropertyChangeListener (listener); -} - - - -/** -Removes a listener from being notified when the value of any constrained -property is changed. - -@param listener The listener. -**/ -public void removeVetoableChangeListener (VetoableChangeListener listener) -{ - vetoListeners_.removeVetoableChangeListener (listener); -} - - - -/** -Removes a listener from being notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ -public void removeWorkingListener (WorkingListener listener) -{ - workingListeners_.removeWorkingListener (listener); -} - - - -/** -Sets the SQL connection used to execute statements. -This property is bound and constrained. - -@param connection The SQL connection. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setConnection (SQLConnection connection) - throws PropertyVetoException -{ - if (connection == null) - throw new NullPointerException("connection"); - - // Fire a vetoable change event. - vetoListeners_.fireVetoableChange("connection", connection_, connection); - - // Make property change. - SQLConnection old = connection_; - connection_ = connection; - - // Statement is no longer valid, must be reconstructed. - if (old != connection) - { - if (statement_ != null) - { - try - { - statement_.close(); - } - catch (SQLException e) - { - errorListeners_.fireError(e); - } - } - statement_ = null; - warnings_ = null; - } - - // Fire the property change event. - changeListeners_.firePropertyChange("connection", old, connection_); -} - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementDocument16.gif b/cvsroot/src/com/ibm/as400/vaccess/SQLStatementDocument16.gif deleted file mode 100644 index e9897c81c..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementDocument16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementDocument32.gif b/cvsroot/src/com/ibm/as400/vaccess/SQLStatementDocument32.gif deleted file mode 100644 index eb9ac2f2e..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementDocument32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementDocumentBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/SQLStatementDocumentBeanInfo.java deleted file mode 100644 index b2f7b47f4..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementDocumentBeanInfo.java +++ /dev/null @@ -1,186 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLStatementDocumentBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - -/** -The SQLStatementDocumentBeanInfo class provides bean -information for the SQLStatementDocument class. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class SQLStatementDocumentBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = SQLStatementDocument.class; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - // ***** EVENTS - EventSetDescriptor error = new EventSetDescriptor(beanClass, - "error", - com.ibm.as400.vaccess.ErrorListener.class, - "errorOccurred"); - error.setDisplayName(ResourceLoader.getText("EVT_NAME_ERROR")); - error.setShortDescription(ResourceLoader.getText("EVT_DESC_ERROR")); - - EventSetDescriptor action = new EventSetDescriptor(beanClass, - "actionCompleted", - com.ibm.as400.access.ActionCompletedListener.class, - "actionCompleted"); - action.setDisplayName(ResourceLoader.getText("EVT_NAME_ACTION_COMPLETED")); - action.setShortDescription(ResourceLoader.getText("EVT_DESC_ACTION_COMPLETED")); - - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_VETO")); - - String[] workingMethods = {"startWorking", "stopWorking"}; - EventSetDescriptor working = new EventSetDescriptor(beanClass, - "working", - com.ibm.as400.vaccess.WorkingListener.class, - workingMethods, - "addWorkingListener", - "removeWorkingListener"); - working.setDisplayName(ResourceLoader.getText("EVT_NAME_WORKING")); - working.setShortDescription(ResourceLoader.getText("EVT_DESC_WORKING")); - - String[] docMethods = {"changedUpdate", "insertUpdate", "removeUpdate"}; - EventSetDescriptor document = new EventSetDescriptor(beanClass, - "document", - javax.swing.event.DocumentListener.class, - docMethods, - "addDocumentListener", - "removeDocumentListener"); - document.setDisplayName(ResourceLoader.getText("EVT_NAME_DOCUMENT")); - document.setShortDescription(ResourceLoader.getText("EVT_DESC_DOCUMENT")); - - events_ = new EventSetDescriptor[]{error, action, changed, veto, working, document}; - - // ***** PROPERTIES - PropertyDescriptor connection = new PropertyDescriptor("connection", beanClass); - connection.setBound(true); - connection.setConstrained(true); - connection.setDisplayName(ResourceLoader.getText("PROP_NAME_CONNECTION")); - connection.setShortDescription(ResourceLoader.getText("PROP_DESC_CONNECTION")); - - properties_ = new PropertyDescriptor[]{connection}; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the error event - return 0; - } - - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the "connection" property - return 0; - } - - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("SQLStatementDocument16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("SQLStatementDocument32.gif"); - break; - } - - return image; - } - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementMenuItem.java b/cvsroot/src/com/ibm/as400/vaccess/SQLStatementMenuItem.java deleted file mode 100644 index a60a8f581..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementMenuItem.java +++ /dev/null @@ -1,614 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLStatementMenuItem.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.ActionCompletedListener; -import com.ibm.as400.access.ActionCompletedEvent; -import com.ibm.as400.access.Trace; -import javax.swing.Icon; -import javax.swing.JMenuItem; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.Serializable; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.Statement; - - - -/** -The SQLStatementMenuItem class represents a menu item that issues a -SQL statement when chosen. - -

    It is up to the user to register a JDBC driver when using this class. -For example, the following code registers the IBM Toolbox for Java -JDBC driver. -

    -   DriverManager.registerDriver (new com.ibm.as400.access.AS400JDBCDriver ());
    -
    - -

    Most errors are reported by firing ErrorEvents, rather -than throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    SQLStatementMenuItem objects generate the following events: -

      -
    • ActionCompletedEvent -
    • ErrorEvent -
    • PropertyChangeEvent -
    • WorkingEvent -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -// Note that the JDBC resources are not explicitly closed, -// the user or garbage collection is relied upon to close them. -public class SQLStatementMenuItem -extends JMenuItem -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - -// The variables which have private commented out had to made -// package scope since currently Internet Explorer does not -// allow inner class to access private variables in their -// containing class. - -// Event support. -transient /*private*/ ActionCompletedEventSupport actionListeners_ - = new ActionCompletedEventSupport (this); -transient /*private*/ ErrorEventSupport errorListeners_ - = new ErrorEventSupport (this); -transient /*private*/ WorkingEventSupport workingListeners_ - = new WorkingEventSupport (this); - -// Adapter for listening for working events and enabling working cursor. -transient /*private*/ WorkingCursorAdapter worker_ - = new WorkingCursorAdapter(this); - -// properties -/*private*/ SQLConnection connection_ = null; -/*private*/ String sql_ = null; -transient /*private*/ SQLWarning warnings_ = null; - -// SQL statement -transient /*private*/ Statement statement_ = null; - - - -/** -Constructs a SQLStatementMenuItem object. -**/ -public SQLStatementMenuItem () -{ - super(); - addActionListener(new MenuListener_()); -} - - - -/** -Constructs a SQLStatementMenuItem object. - -@param icon The icon to be placed on the menu item. -**/ -public SQLStatementMenuItem (Icon icon) -{ - super(icon); - addActionListener(new MenuListener_()); -} - - - -/** -Constructs a SQLStatementMenuItem object. - -@param text The text to be placed on the menu item. -**/ -public SQLStatementMenuItem (String text) -{ - super(text); - addActionListener(new MenuListener_()); -} - - - -/** -Constructs a SQLStatementMenuItem object. - -@param text The text to be placed on the menu item. -@param icon The icon to be placed on the menu item. -**/ -public SQLStatementMenuItem (String text, - Icon icon) -{ - super(text, icon); - addActionListener(new MenuListener_()); -} - - - -/** -Constructs a SQLStatementMenuItem object. - -@param text The text to be placed on the menu item. -@param icon The icon to be placed on the menu item. -@param connection The SQL connection. -@param SQLStatement The SQL statement. -**/ -public SQLStatementMenuItem (String text, - Icon icon, - SQLConnection connection, - String SQLStatement) -{ - super(text, icon); - if (connection == null) - throw new NullPointerException("connection"); - connection_ = connection; - if (SQLStatement == null) - throw new NullPointerException("SQLStatement"); - sql_ = SQLStatement; - addActionListener(new MenuListener_()); -} - - - -/** -Adds a listener to be notified when a SQL statement is executed. -The listener's actionCompleted() method will be called. - -@param listener The listener. -**/ -public void addActionCompletedListener (ActionCompletedListener listener) -{ - actionListeners_.addActionCompletedListener(listener); -} - - - -/** -Adds a listener to be notified when an error occurs. -The listener's errorOccurred() method will be called. - -@param listener The listener. -**/ -public void addErrorListener (ErrorListener listener) -{ - errorListeners_.addErrorListener (listener); -} - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ -public void addWorkingListener (WorkingListener listener) -{ - workingListeners_.addWorkingListener (listener); -} - - - -/** -Returns the SQL connection used to execute statements. - -@return The SQL connection. -**/ -public SQLConnection getConnection () -{ - return connection_; -} - - - -/** -Makes the next result of the last statement run the current result. -Nothing is done if no statement has been executed. -

    Refer to JDBC documentation for more information. -**/ -public void getMoreResults() -{ - if (statement_ != null) - { - workingListeners_.fireStartWorking (); - try - { - statement_.getMoreResults(); - } - catch (SQLException e) - { - // Throw error event. - errorListeners_.fireError(e); - } - workingListeners_.fireStopWorking (); - } -} - - - -/** -Returns the current results of the last SQL statement run. -Multiple results can be obtained by -calling getUpdateCount() and/or getResultSet() multiple -times, with intervening getMoreResults() calls. -

    Refer to JDBC documentation for more information. - -@return The result set or null if the result was not a -result set, or if there are no results. -**/ -public ResultSet getResultSet() -{ - // If we haven't run anything, return null. - if (statement_ == null) - { - return null; - } - // Get the result set from the statement. - workingListeners_.fireStartWorking (); - ResultSet result = null; - try - { - result = statement_.getResultSet(); - } - catch(SQLException e) - { - // Throw error event. - errorListeners_.fireError(e); - } - workingListeners_.fireStopWorking (); - return result; -} - - - -/** -Returns the SQL statement that will be run when this menu item is chosen. - -@return The SQL statement that will be run when this menu item is chosen. -**/ -public String getSQLStatement () -{ - if (sql_ == null) - return ""; - return sql_; -} - - - -/** -Returns the number of rows affected by the last SQL statement run. -Multiple results can be obtained by -calling getUpdateCount() and/or getResultSet() multiple -times, with intervening getMoreResults() calls. -If an error occurs, 0 is returned. -

    Refer to JDBC documentation for more information. - -@return The number of rows that were -affected. If no rows were affected or the SQL statement was -a DDL command, 0 is returned. If there are no results or the results -are a result set, -1 is returned. -**/ -public int getUpdateCount() -{ - // If we haven't run anything, return -1. - if (statement_ == null) - { - return -1; - } - // Get the update count from the statement. - try - { - return statement_.getUpdateCount(); - } - catch(SQLException e) - { - // Throw error event. - errorListeners_.fireError(e); - return 0; - } -} - - - -/** -Returns the warnings generated by the JDBC connection and statement. -Each time the menu item is selected (the SQL statement is run), the -warnings are cleared. Connection warnings are only available after the -first time a statement is executed. The warnings from the statement will -be linked to the end of any connection warnings. - -@return The warnings generated by the connection and statement, -or null if none. -**/ -public SQLWarning getWarnings () -{ - // If no statement, we are not in a state to have warnings. - if (statement_ == null) - return null; - - // Get statement warnings. - SQLWarning s_warnings = null; - try - { - s_warnings = statement_.getWarnings(); - } - catch(SQLException e) - { - // Throw error event, then continue. - errorListeners_.fireError(e); - } - - // If connection warnings... - if (warnings_ != null) - { - // If no statement warnings, just return connection warnings. - if (s_warnings == null) - { - return warnings_; - } - - // We have both connection and statement warnings. - // Find the last warning in the connection chain. - SQLWarning last = warnings_; - SQLWarning next; - while ((next = last.getNextWarning()) != null) - { - last = next; - } - // Add statement warnings to the end of connection chain. - last.setNextWarning(s_warnings); - return warnings_; - } - else - { - // otherwise, just return statement warnings - return s_warnings; - } -} - - -/** -Restore the state of this object from an object input stream. -It is used when deserializing an object. -@param in The input stream of the object being deserialized. -@exception IOException -@exception ClassNotFoundException -**/ -private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException -{ - // Restore the non-static and non-transient fields. - in.defaultReadObject(); - // Initialize the transient fields. - actionListeners_ = new ActionCompletedEventSupport(this); - errorListeners_ = new ErrorEventSupport(this); - workingListeners_ = new WorkingEventSupport(this); - worker_ = new WorkingCursorAdapter(this); - warnings_ = null; - statement_ = null; - // Restore listener - addActionListener(new MenuListener_()); -} - - - -/** -Removes a listener from being notified when a SQL statement is issued. - -@param listener The listener. -**/ -public void removeActionCompletedListener(ActionCompletedListener listener) -{ - actionListeners_.removeActionCompletedListener(listener); -} - - -/** -Removes a listener from being notified when an error occurs. - -@param listener The listener. -**/ -public void removeErrorListener (ErrorListener listener) -{ - errorListeners_.removeErrorListener (listener); -} - - - -/** -Removes a listener from being notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ -public void removeWorkingListener (WorkingListener listener) -{ - workingListeners_.removeWorkingListener (listener); -} - - - -/** -Sets the SQL connection used to execute statements. -This property is bound and constrained. - -@param connection The SQL connection. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setConnection (SQLConnection connection) - throws PropertyVetoException -{ - if (connection == null) - throw new NullPointerException("connection"); - - // Fire a vetoable change event. - fireVetoableChange("connection", connection_, connection); - - // Make property change. - SQLConnection old = connection_; - connection_ = connection; - - // Statement is no longer valid, must be reconstructed. - if (old != connection) - { - if (statement_ != null) - { - try - { - statement_.close(); - } - catch (SQLException e) - { - errorListeners_.fireError(e); - } - } - statement_ = null; - warnings_ = null; - } - - // Fire the property change event. - firePropertyChange("connection", old, connection_); -} - - - -/** -Sets the SQL statement to run. This property -is bound and constrained. - -@param SQLStatement The SQL statement. -@exception PropertyVetoException If the change is vetoed. -**/ -public void setSQLStatement (String SQLStatement) - throws PropertyVetoException -{ - if (SQLStatement == null) - throw new NullPointerException("SQLStatement"); - - String old = getSQLStatement(); - - // Fire a vetoable change event. - fireVetoableChange("SQLStatement", old, SQLStatement); - - // Make property change. - sql_ = SQLStatement; - - // Fire the property change event. - firePropertyChange("SQLStatement", old, sql_); -} - - -/** -Class for listening to action events. This is used to run the -SQL statement when the menu item is chosen. -**/ -private class MenuListener_ -implements ActionListener -{ - -public void actionPerformed(ActionEvent ev) -{ - // Ensure required properties have been set. - if (connection_ == null) - { - Exception e = new IllegalStateException("connection"); - errorListeners_.fireError(e); - return; - } - if (sql_ == null) - { - Exception e = new IllegalStateException("SQLStatement"); - errorListeners_.fireError(e); - return; - } - - Trace.log(Trace.INFORMATION, "Running menu, sql is: " + sql_); - - workingListeners_.fireStartWorking (); - // Change cursor to working. - worker_.startWorking(new WorkingEvent(this)); - - // Make sure we have a valid statement to use. - if (statement_ == null) - { - Connection conn; - try - { - conn = connection_.getConnection(); - statement_ = conn.createStatement(); - } - catch(SQLException e) - { - // Cannot continue, so send event and return. - errorListeners_.fireError(e); - worker_.stopWorking(new WorkingEvent(this)); - workingListeners_.fireStopWorking (); - return; - } - // Store warnings to chain if warnings are requested. - try - { - warnings_ = conn.getWarnings(); - } - catch (SQLException e) - { - // Fire error event, but continue. - errorListeners_.fireError(e); - } - } - else - { - // clear all warnings - warnings_ = null; - try - { - statement_.clearWarnings(); - } - catch(SQLException e) - { - // Fire error event, but continue. - errorListeners_.fireError(e); - } - } - - // try to execute the statement - try - { - statement_.execute(sql_); - } - catch(SQLException e) - { - // Throw error event. - errorListeners_.fireError(e); - } - - // Send completion event. - actionListeners_.fireActionCompleted(); - - // Set cursor back. - worker_.stopWorking(new WorkingEvent(this)); - - workingListeners_.fireStopWorking (); -} - -} // end of class MenuListener_ - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementMenuItem16.gif b/cvsroot/src/com/ibm/as400/vaccess/SQLStatementMenuItem16.gif deleted file mode 100644 index 6846cd9af..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementMenuItem16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementMenuItem32.gif b/cvsroot/src/com/ibm/as400/vaccess/SQLStatementMenuItem32.gif deleted file mode 100644 index af7e1eeea..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementMenuItem32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementMenuItemBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/SQLStatementMenuItemBeanInfo.java deleted file mode 100644 index be41539fa..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SQLStatementMenuItemBeanInfo.java +++ /dev/null @@ -1,189 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SQLStatementMenuItemBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - - -/** -The SQLStatementMenuItemBeanInfo class provides bean -information for the SQLStatementMenuItem class. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class SQLStatementMenuItemBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Class this bean info represents. - private final static Class beanClass = SQLStatementMenuItem.class; - - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - static - { - try - { - // ***** EVENTS - EventSetDescriptor error = new EventSetDescriptor(beanClass, - "error", - com.ibm.as400.vaccess.ErrorListener.class, - "errorOccurred"); - error.setDisplayName(ResourceLoader.getText("EVT_NAME_ERROR")); - error.setShortDescription(ResourceLoader.getText("EVT_DESC_ERROR")); - - EventSetDescriptor action = new EventSetDescriptor(beanClass, - "actionCompleted", - com.ibm.as400.access.ActionCompletedListener.class, - "actionCompleted"); - action.setDisplayName(ResourceLoader.getText("EVT_NAME_ACTION_COMPLETED")); - action.setShortDescription(ResourceLoader.getText("EVT_DESC_ACTION_COMPLETED")); - - EventSetDescriptor changed = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.PropertyChangeListener.class, - "propertyChange"); - changed.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_CHANGE")); - changed.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor veto = new EventSetDescriptor(beanClass, - "propertyChange", - java.beans.VetoableChangeListener.class, - "vetoableChange"); - veto.setDisplayName(ResourceLoader.getText("EVT_NAME_PROPERTY_VETO")); - veto.setShortDescription(ResourceLoader.getText("EVT_DESC_PROPERTY_VETO")); - - String[] workingMethods = {"startWorking", "stopWorking"}; - EventSetDescriptor working = new EventSetDescriptor(beanClass, - "working", - com.ibm.as400.vaccess.WorkingListener.class, - workingMethods, - "addWorkingListener", - "removeWorkingListener"); - working.setDisplayName(ResourceLoader.getText("EVT_NAME_WORKING")); - working.setShortDescription(ResourceLoader.getText("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[]{error, action, changed, veto, working}; - - // ***** PROPERTIES - PropertyDescriptor query = new PropertyDescriptor("SQLStatement", beanClass); - query.setBound(true); - query.setConstrained(true); - query.setDisplayName(ResourceLoader.getText("PROP_NAME_SQL")); - query.setShortDescription(ResourceLoader.getText("PROP_DESC_SQL")); - - PropertyDescriptor connection = new PropertyDescriptor("connection", beanClass); - connection.setBound(true); - connection.setConstrained(true); - connection.setDisplayName(ResourceLoader.getText("PROP_NAME_CONNECTION")); - connection.setShortDescription(ResourceLoader.getText("PROP_DESC_CONNECTION")); - - PropertyDescriptor text = new PropertyDescriptor("text", beanClass); - text.setBound(false); - text.setConstrained(false); - text.setDisplayName(ResourceLoader.getText("PROP_NAME_TEXT")); - text.setShortDescription(ResourceLoader.getText("PROP_DESC_TEXT")); - - properties_ = new PropertyDescriptor[]{query, connection, text}; - } - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - - /** - Returns the bean descriptor. - @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor(beanClass); - } - - - /** - Returns the index of the default event. - @return The index to the default event. - **/ - public int getDefaultEventIndex() - { - // the index for the error event - return 0; - } - - - /** - Returns the index of the default property. - @return The index to the default property. - **/ - public int getDefaultPropertyIndex() - { - // the index for the "SQLStatement" property - return 0; - } - - - /** - Returns the descriptors for all events. - @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - **/ - public Image getIcon(int icon) - { - Image image = null; - - switch(icon) - { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("SQLStatementMenuItem16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("SQLStatementMenuItem32.gif"); - break; - } - - return image; - } - - - /** - Returns the descriptors for all properties. - @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/ScrollingTextPane.java b/cvsroot/src/com/ibm/as400/vaccess/ScrollingTextPane.java deleted file mode 100644 index bd77aa92f..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/ScrollingTextPane.java +++ /dev/null @@ -1,84 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: ScrollingTextPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.BorderLayout; -import javax.swing.JComponent; -import javax.swing.JScrollPane; -import javax.swing.JTextPane; - - -/** -The ScrollingTextPane class represents a scrollable text -pane which expands to fill its area. -**/ -class ScrollingTextPane -extends JComponent -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - private JTextPane textPane_; - - - - public ScrollingTextPane(boolean editable) - { - textPane_ = new JTextPane(); - textPane_.setEditable(editable); - setLayout(new BorderLayout()); - add("Center", new JScrollPane(textPane_)); - } - - - - public ScrollingTextPane(JTextPane textPane) - { - textPane_ = textPane; - setLayout(new BorderLayout()); - add("Center", new JScrollPane(textPane_)); - } - - - - public void appendText(String text) - { - StringBuffer buffer = new StringBuffer(textPane_.getText()); - buffer.append(text); - textPane_.setText(buffer.toString()); - } - - - - public String getText() - { - return textPane_.getText(); - } - - - - - public void setText(String text) - { - if (text == null) - textPane_.setText(""); - else - textPane_.setText(text); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SerializationListener.java b/cvsroot/src/com/ibm/as400/vaccess/SerializationListener.java deleted file mode 100644 index ab7d89cfd..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SerializationListener.java +++ /dev/null @@ -1,104 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SerializationListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Container; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.io.IOException; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import javax.swing.event.TableModelListener; -import javax.swing.table.TableModel; - -/** - * Used to enable serialization of a Container with Swing 1.1. - * Intended for Toolbox classes that extend JComponent and contain - * an internal JTable object. (In Swing 1.1, JTable has a bug which - * makes it un-Serializable). - * See also: source code for javax.swing.JComponent in JDK 1.2. - * - * It should be noted that a SerializationListener is itself - * Serializable and contains a transient Container. In order for - * multiple serializations to work, the calling class should add - * a SerializationListener as a FocusListener to itself in its - * initializeTransient() method, not in its constructor. -*/ -class SerializationListener implements FocusListener, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private String x = Copyright_v.copyright; - - // This is the component that we want to safely serialize. - transient private Container component_ = null; - // This is the table model that needs to have its listener removed. - transient private TableModel model_ = null; - // This is the listener to be removed from the table model. - transient private TableModelListener listener_ = null; - - /** - * Construct a SerializationListener object with the specified component. - * @parm component The component whose UI will be uninstalled before serialization. - **/ - public SerializationListener(Container component) - { - component_ = component; - } - - /** - * Construct a SerializationListener object with the specified model and component. - * @parm model The table model whose listeners we need to remove before serialization. - * @parm listener The component to be removed from listening to the model. - **/ - public SerializationListener(TableModel model, TableModelListener listener) - { - listener_ = listener; - model_ = model; - } - - /** - * Does nothing. - */ - public void focusGained(FocusEvent e) {} - - - /** - * Does nothing. - */ - public void focusLost(FocusEvent e) {} - - - /** - * When the Container is serialized, this listener will presumably - * get serialized first. At that time, it removes ALL the sub-components - * that have been added to the parent Container (including any JTables) - * before the parent is serialized. By doing so, we avoid the - * NotSerializableException that would normally get thrown when trying - * to serialize a component that contains a JTable in Swing 1.1. - */ - private void writeObject(ObjectOutputStream s) - throws IOException - { - s.defaultWriteObject(); - if (component_ != null) - { - component_.removeAll(); - } - if (model_ != null) - { - model_.removeTableModelListener(listener_); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SpooledFileViewer.java b/cvsroot/src/com/ibm/as400/vaccess/SpooledFileViewer.java deleted file mode 100644 index 04443e8f2..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SpooledFileViewer.java +++ /dev/null @@ -1,2772 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SpooledFileViewer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.PrintObject; -import com.ibm.as400.access.PrintObjectPageInputStream; -import com.ibm.as400.access.PrintParameterList; -import com.ibm.as400.access.SpooledFile; -import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; // @A5A -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.JViewport; -import javax.swing.ScrollPaneConstants; -import java.awt.BorderLayout; -import java.awt.Checkbox; -import java.awt.CheckboxGroup; -import java.awt.Color; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.Event; -import java.awt.FlowLayout; -import java.awt.Frame; -import java.awt.Graphics; -import java.awt.GridLayout; -import java.awt.Image; -import java.awt.image.ColorModel; -import java.awt.image.IndexColorModel; -import java.awt.image.MemoryImageSource; -import java.awt.Insets; -import java.awt.MediaTracker; -import java.awt.Rectangle; -import java.awt.TextField; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.Serializable; -import java.util.Locale; -import java.util.MissingResourceException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.*; - -/** -The SpooledFileViewer class represents a system spooled file viewer. -You can create an instance of this class to view an individual -AFPDS or SCS spooled file on the system. Viewer functions such as page forward, -page back, set current page, and so on, are provided. - -The following properties can be set directly, but require the -invocation of load() to load the information from the system. -

      -
    • paper size -
    • spooled file -
    • viewing fidelity -
    - -The following properties can be set directly, but require the -invocation of loadPage() to load the information from the system. -
      -
    • current page -
    - - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    SpooledFileViewer objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • VetoableChangeEvent -
    • WorkingEvent -
    - -(To create new spooled files on the system, use the -SpooledFileOutputStream class. - -See Spooled File Attributes for -valid attributes.) - -

    The following example creates a spooled file viewer -to display a spooled file previously created on the system. - -

    -// Assume splf is the spooled file.
    -// Create the spooled file viewer
    -SpooledFileViewer splfv = new SpooledFileViewer(splf, 1);
    -splfv.load();
    -
    -// Add the spooled file viewer to a frame
    -JFrame frame = new JFrame("My Window");
    -frame.getContentPane().add(splfv);
    -
    - -@see SpooledFile -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ - - -public class SpooledFileViewer -extends JComponent -implements Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - /** Represents *ABSOLUTE viewing fidelity **/ - public static final int ABSOLUTE_FIDELITY = 0; - /** Represents *CONTENT viewing fidelity **/ - public static final int CONTENT_FIDELITY = 1; - /** Represents letter paper size (8.5 x 11 inches) **/ - public static final int LETTER = 0; - /** Represents legal paper size (8.5 x 14 inches) **/ - public static final int LEGAL = 1; - /** Represents A3 paper size (297 x 420 mm) **/ - public static final int A3 = 2; - /** Represents A4 paper size (210 x 297 mm) **/ - public static final int A4 = 3; - /** Represents A5 paper size (148 x 210 mm) **/ - public static final int A5 = 4; - /** Represents B4 paper size (257 x 364 mm) **/ - public static final int B4 = 5; - /** Represents B5 paper size (182 x 257 mm) **/ - public static final int B5 = 6; - /** Represents executive paper size (7.25 x 10.5 inches) **/ - public static final int EXECUTIVE = 7; - /** Represents ledger paper size (17 x 11 inches) **/ - public static final int LEDGER = 8; - /** Represents continuous feed 80 paper size (8 x 11 inches) **/ - public static final int CONT80 = 9; - /** Represents continuous feed 132 paper size (13.2 x 11 inches) **/ - public static final int CONT132 = 10; - /** Represents no paper size **/ - public static final int NONE = 11; - - // Private constants. - private static final int BSIZE_ = 36; // size of (square) button edge - private static final int LISTBOXWIDTH_ = 300; // width of list box - private static final int LISTBOXHEIGHT_ = 175; // height of list box - private static final int PREF_WIDTH = 465; // preferred width of viewer - private static final int PREF_HEIGHT = 600; // preferred height of viewer - private static final int TOOLBARSIZE_ = 38; // size of tool bar - private static final int TOPOFFSET_ = 1; // offset from top - private static final String WSCSTOBJ = "/QSYS.LIB/QWPGIF.WSCST"; // wkrstn cust object - - - // MRI. - private static final String a3Text_ = ResourceLoader.getPrintText("PAPER_SIZE_A3"); - private static final String a4Text_ = ResourceLoader.getPrintText("PAPER_SIZE_A4"); - private static final String a5Text_ = ResourceLoader.getPrintText("PAPER_SIZE_A5"); - private static final String absoluteText_ = ResourceLoader.getPrintText("FIDELITY_ABSOLUTE"); - private static final String actualSizeText_ = ResourceLoader.getText("MENU_ACTUAL_SIZE"); - private static final String b4Text_ = ResourceLoader.getPrintText("PAPER_SIZE_B4"); - private static final String b5Text_ = ResourceLoader.getPrintText("PAPER_SIZE_B5"); - private static final String cancelText_ = ResourceLoader.getText("DLG_CANCEL"); - private static final String cont80Text_ = ResourceLoader.getPrintText("PAPER_SIZE_CONT80"); - private static final String cont132Text_ = ResourceLoader.getPrintText("PAPER_SIZE_CONT132"); - private static final String contentText_ = ResourceLoader.getPrintText("FIDELITY_CONTENT"); - private static final String curPaperText_ = ResourceLoader.getPrintText("CURRENT_PAPER_SIZE"); - private static final String curVFidelityText_ = ResourceLoader.getPrintText("CURRENT_VIEWING_FIDELITY"); - private static final String executiveText_ = ResourceLoader.getPrintText("PAPER_SIZE_EXECUTIVE"); - private static final String firstPageText_ = ResourceLoader.getText("MENU_FIRST_PAGE"); - private static final String fitPageText_ = ResourceLoader.getText("MENU_FIT_PAGE"); - private static final String fitWidthText_ = ResourceLoader.getText("MENU_FIT_WIDTH"); - private static final String flashPageText_ = ResourceLoader.getText("MENU_FLASH_PAGE"); - private static final String goToText_ = ResourceLoader.getText("MENU_GO_TO_PAGE"); - private static final String goToPageText_ = ResourceLoader.getPrintText("GO_TO_PAGE"); - private static final String lastPageText_ = ResourceLoader.getText("MENU_LAST_PAGE"); - private static final String ledgerText_ = ResourceLoader.getPrintText("PAPER_SIZE_LEDGER"); - private static final String legalText_ = ResourceLoader.getPrintText("PAPER_SIZE_LEGAL"); - private static final String letterText_ = ResourceLoader.getPrintText("PAPER_SIZE_LETTER"); - private static final String nextPageText_ = ResourceLoader.getText("MENU_NEXT_PAGE"); - private static final String noneText_ = ResourceLoader.getPrintText("NONE"); - private static final String okText_ = ResourceLoader.getText("DLG_OK"); - private static final String paperSizeText_ = ResourceLoader.getPrintText("PAPER_SIZE"); - private static final String paperSizeWarnText_ = ResourceLoader.getPrintText("WARNING_PAPER_SIZE"); - private static final String prevPageText_ = ResourceLoader.getText("MENU_PREVIOUS_PAGE"); - private static final String vFidelityText_ = ResourceLoader.getPrintText("VIEWING_FIDELITY"); - private static final String vFidelityWarnText_ = ResourceLoader.getPrintText("WARNING_FIDELITY"); - private static final String warningText_ = ResourceLoader.getPrintText("WARNING"); - private static final String zoomText_ = ResourceLoader.getText("MENU_ZOOM"); - - - // Icons. - private static final Icon iconActualSize_ = ResourceLoader.getIcon("ResetViewIcon.gif"); - private static final Icon iconFirstPage_ = ResourceLoader.getIcon("FirstIcon.gif"); - private static final Icon iconFitPage_ = ResourceLoader.getIcon("FitPageIcon.gif"); - private static final Icon iconFitWidth_ = ResourceLoader.getIcon("FitWidthIcon.gif"); - private static final Icon iconFlashPage_ = ResourceLoader.getIcon("FlashIcon.gif"); - private static final Icon iconGoToPage_ = ResourceLoader.getIcon("GoToIcon.gif"); - private static final Icon iconLastPage_ = ResourceLoader.getIcon("LastIcon.gif"); - private static final Icon iconNextPage_ = ResourceLoader.getIcon("NextIcon.gif"); - private static final Icon iconPaperSize_ = ResourceLoader.getIcon("PaperIcon.gif"); - private static final Icon iconPrevPage_ = ResourceLoader.getIcon("PreviousIcon.gif"); - private static final Icon iconViewFidelity_ = ResourceLoader.getIcon("VFIcon.gif"); - private static final Icon iconZoom_ = ResourceLoader.getIcon("ZoomIcon.gif"); - - - // Paper sizes. - private static final String[] paperSizes = {letterText_, legalText_, a3Text_, - a4Text_, a5Text_, b4Text_, - b5Text_, executiveText_, ledgerText_, - cont80Text_, cont132Text_, noneText_ }; - - private static final String[] paperSizeValues = {"*LETTER", "*LEGAL", "*A3", "*A4", - "*A5", "*B4", "*B5", "*EXECUTIVE", "*LEDGER", - "*CONT80", "*CONT132", "*NONE"}; - // Viewing fidelities. - private static final String[] viewingFidelities = {absoluteText_, contentText_ }; - private static final String[] viewingValues = {"*ABSOLUTE", "*CONTENT"}; - - - // Static variables. - private static int sPaperSize_ = LETTER; // default paper size - private static int sViewingFidelity_ = CONTENT_FIDELITY; // default viewing fidelity - private static boolean paperSizeChecked_ = false; // default to false - - - // Transient data. - transient private Image currentPageImage_ = null; // Image of page currently in view - transient private Image flashPageImage_ = null; // Image of previously viewed page - transient private PrintObjectPageInputStream spooledFileIS_ = null; // the input stream - - - // Serializable data. - private boolean initialized_ = false;// indicates if a spooled file has been loaded - private boolean numberOfPagesEst_ = false;// is numberOfPages estimated? - private int currentPageNumber_ = 0; // page number of current page - private int flashPageNumber_ = 0; // page number of previously viewed page - private int knownPages_ = 0; // total number of pages known to exist - private int numberOfPages_ = 0; // total number of pages - private int oldCurrentPage_ = 0; // old current page (most recently loaded) - private int paperSize_ = 0; // current paper size - private int viewingFidelity_ = 0; // current viewing fidelity - private float zoomPercentage_ = 100; // zoom percentage @A1C changed int to float - - - // Buttons. - //@A3C - Made all JButtons transient. - transient private JButton actualButton_ = null; // 'return page to actual size' button - transient private JButton firstPageButton_ = null; // 'view first page' button - transient private JButton fitPageButton_ = null; // 'fit page in view' button - transient private JButton fitWidthButton_ = null; // 'view flash page' button - transient private JButton flashButton_ = null; // 'view previously viewed page' button - transient private JButton gotoButton_ = null; // 'go to specific page' button - transient private JButton lastPageButton_ = null; // 'view last page' button - transient private JButton nextPageButton_ = null; // 'view next page' button - transient private JButton paperSizeButton_ = null; // 'select paper size' button - transient private JButton prevPageButton_ = null; // 'view previous page' button - transient private JButton viewingFidelityButton_= null; // 'select viewing fidelity' button - transient private JButton zoomButton_ = null; // 'zoom' button - - //@A3C - Made the JPanels, JScrollPane, and JTextFields transient. - transient private JPanel statusBar_ = null; // the status bar (for text fields) - transient private JPanel toolBar_ = null; // the tool bar (for action buttons) - transient private JScrollPane scrollView_ = null; // container for the viewport - private SpooledFile spooledFile_ = null; // the spooled file - private SpooledFilePageView_ pageView_ = null; // view of a spooled file page (image) - private String estimateStar_ = ""; // visual indicator that numberOfPages is estimated - transient private JTextField pageInfo_ = null; // text field indicating current page - transient private JTextField zoomInfo_ = null; // text field indicating zoom percentage - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - transient private WorkingEventSupport workingEventSupport_; - - - -/** -Constructs a SpooledFileViewer object. A call to setSpooledFile() must -be done after calling this method in order to set the spooled -file to be viewed. -**/ - public SpooledFileViewer() - { - spooledFile_ = null; - createViewer(); - } - - - -/** -Constructs a SpooledFileViewer object. By default, the current page is set to -the first page of the spooled file. A call to load() must be done -after calling this method in order to load the spooled file. - -@param spooledFile The spooled file to view. -**/ - public SpooledFileViewer(SpooledFile spooledFile) - { - if (spooledFile == null) - throw new NullPointerException("spooledFile"); - spooledFile_ = spooledFile; - createViewer(); - currentPageNumber_ = 1; - } - - - -/** -Constructs a SpooledFileViewer object. Page page of the spooled file -is loaded as the initial view. If page is less than 1, an error is thrown. -A call to load() must be done after calling this method in order to -load the spooled file. - -@param spooledFile The spooled file to view. -@param page The initial page to view. -**/ - public SpooledFileViewer(SpooledFile spooledFile, int page) - { - if (spooledFile == null) - throw new NullPointerException("spooledFile"); - if (page < 1) { - throw new IllegalArgumentException("page"); - } - - spooledFile_ = spooledFile; - createViewer(); - currentPageNumber_ = page; - } - - - -/** -Resets the size of the page image to its original size. This method is only -valid after a spooled file has been loaded. -**/ - public void actualSize() - { - if (initialized_ == true) { - // clear view - pageView_.clearView(); - - // adjust width and height of page image to image's actual size - Dimension d = new Dimension(currentPageImage_.getWidth(this), - currentPageImage_.getHeight(this)); - pageView_.setViewSize(d); - - // calculate the new viewing zoom percentage - calculateZoom(); - - // update the viewer - updateViewer(); - } - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener(ErrorListener listener) - { - errorEventSupport_.addErrorListener(listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - super.addPropertyChangeListener(listener); - propertyChangeSupport_.addPropertyChangeListener(listener); - } - - - -/** -Adds the status bar. -**/ - public void addStatusBar() - { - add("South", statusBar_); - validate(); // @A4A - validate forces redraw - // paintAll(this.getGraphics()); @A4D - } - - - -/** -Adds the tool bar. -**/ - public void addToolBar() - { - add("North", toolBar_); - validate(); // @A4A - validate forces redraw - // paintAll(this.getGraphics()); @A4D - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - super.addVetoableChangeListener(listener); - vetoableChangeSupport_.addVetoableChangeListener(listener); - } - - - -/** -Adds a listener to be notified of a working state. - -@param listener The listener. -**/ - public void addWorkingListener(WorkingListener listener) - { - workingEventSupport_.addWorkingListener(listener); - } - - - -/** -Calculate zoom percentage. -**/ - private void calculateZoom() - { - float imageWidth = (float)getPageImageSize().width; // @A1C double to float - if (imageWidth != 0) { - /* zoomPercentage_ = (int)java.lang.Math.ceil((((double)pageView_.getWidth()/ - imageWidth) * 100.0)); */ - zoomPercentage_ = (((float)pageView_.getWidth()/imageWidth) * 100); // @A1C - } - else - errorEventSupport_.fireError(new ArithmeticException()); - } - - - -/** -Creates and shows a 'Go To Page' dialog. This dialog will allow -the user to graphically input a page to view. -**/ - void changeCurrentPage() - { - GoToBox_ theGoToBox; - theGoToBox = new GoToBox_((JFrame)VUtilities.getFrame(this)); - theGoToBox.setVisible(true); - } - - - -/** -Creates and shows a 'Paper Size' dialog. This dialog will -display a list of valid paper sizes and allow the user to select one. -**/ - void changePaperSize() - { - PaperSizeBox_ thePaperSizeBox; - thePaperSizeBox = new PaperSizeBox_((JFrame)VUtilities.getFrame(this)); - thePaperSizeBox.setVisible(true); - } - - - -/** -Creates and shows a 'Viewing Fidelity' dialog Box. This dialog will -display a list of valid viewing fidelities and allow the user to select -one. -**/ - void changeViewingFidelity() - { - ViewingFidelityBox_ theViewingFidelityBox; - theViewingFidelityBox = new ViewingFidelityBox_((JFrame)VUtilities.getFrame(this)); - theViewingFidelityBox.setVisible(true); - } - - - -/** -Creates and shows a 'Zoom' Dialog Box. This dialog box will -display a set of radio buttons and a data entry field for entering -a magnification (zoom) percentage. -**/ - void changeZoom() - { - ZoomToBox_ theZoomToBox; - theZoomToBox = new ZoomToBox_((JFrame)VUtilities.getFrame(this)); - theZoomToBox.setVisible(true); - } - - - -/** -Closes the viewer. -**/ - public void close() - { - try { - // close the page input stream and return the conversation - if (spooledFileIS_ != null) { - spooledFileIS_.close(); - spooledFileIS_ = null; // @A2A - } - } - catch (IOException e) {} - } - - - -/** -Creates the status bar. - -@return The status bar. -**/ - private JPanel createStatusBar() - { - // create a panel for the status bar - JPanel statusBar = new JPanel(); - - // create page information field - pageInfo_ = new JTextField(22); - pageInfo_.setEditable(false); - pageInfo_.transferFocus(); - - // create zoom percentage field - zoomInfo_ = new JTextField(8); - zoomInfo_.setEditable(false); - zoomInfo_.transferFocus(); - - // set layout... - statusBar.setLayout(new FlowLayout(FlowLayout.LEFT)); - - // add both fields to the status bar - statusBar.add(pageInfo_); - statusBar.add(zoomInfo_); - - // return the status bar - return statusBar; - } - - - -/** -Creates the tool bar - -@return The tool bar. -**/ - private JPanel createToolBar() - { - // create an instance of a JPanel for a tool bar - JPanel toolBar = new JPanel(); - Insets insets = toolBar.getInsets(); - ViewerActionListener_ listener = new ViewerActionListener_(); - - // set preferred size - toolBar.setPreferredSize(new Dimension(TOOLBARSIZE_,TOOLBARSIZE_)); - - // set null layout...we will position the buttons manually - toolBar.setLayout(null); - - // create the 'Actual size' button and add it to the tool bar - actualButton_ = new JButton(iconActualSize_); - toolBar.add(actualButton_); - actualButton_.setBounds(insets.left + 1, insets.top + TOPOFFSET_, BSIZE_, BSIZE_); - actualButton_.addActionListener(listener); - actualButton_.setToolTipText(actualSizeText_); - actualButton_.setActionCommand("actualSize"); - - // create the 'Fit Width' button and add it to the tool bar - fitWidthButton_ = new JButton(iconFitWidth_); - toolBar.add(fitWidthButton_); - fitWidthButton_.setBounds(insets.left + 37, insets.top + TOPOFFSET_, BSIZE_, BSIZE_); - fitWidthButton_.addActionListener(listener); - fitWidthButton_.setToolTipText(fitWidthText_); - fitWidthButton_.setActionCommand("fitWidth"); - - // create the 'Fit Page' button and add it to the tool bar - fitPageButton_ = new JButton(iconFitPage_); - toolBar.add(fitPageButton_); - fitPageButton_.setBounds(insets.left + 73, insets.top + TOPOFFSET_, BSIZE_, BSIZE_); - fitPageButton_.addActionListener(listener); - fitPageButton_.setToolTipText(fitPageText_); - fitPageButton_.setActionCommand("fitPage"); - - // create the 'Zoom' button and add it to the tool bar - zoomButton_ = new JButton(iconZoom_); - toolBar.add(zoomButton_); - zoomButton_.setBounds(insets.left + 109, insets.top + TOPOFFSET_, BSIZE_, BSIZE_); - zoomButton_.addActionListener(listener); - zoomButton_.setToolTipText(zoomText_); - zoomButton_.setActionCommand("zoom"); - - // create the 'Go To Page' button and add it to the tool bar - gotoButton_ = new JButton(iconGoToPage_); - toolBar.add(gotoButton_); - gotoButton_.setBounds(insets.left + 152, insets.top + TOPOFFSET_, BSIZE_, BSIZE_); - gotoButton_.addActionListener(listener); - gotoButton_.setToolTipText(goToText_); - gotoButton_.setActionCommand("goToPage"); - - // create the 'First Page' button and add it to the tool bar - firstPageButton_= new JButton(iconFirstPage_); - toolBar.add(firstPageButton_); - firstPageButton_.setBounds(insets.left + 195, insets.top + TOPOFFSET_, BSIZE_, BSIZE_); - firstPageButton_.addActionListener(listener); - firstPageButton_.setToolTipText(firstPageText_); - firstPageButton_.setActionCommand("firstPage"); - - // create the 'Previous Page' button and add it to the tool bar - prevPageButton_= new JButton(iconPrevPage_); - toolBar.add(prevPageButton_); - prevPageButton_.setBounds(insets.left + 231,insets.top + TOPOFFSET_, BSIZE_, BSIZE_); - prevPageButton_.addActionListener(listener); - prevPageButton_.setToolTipText(prevPageText_); - prevPageButton_.setActionCommand("prevPage"); - - // create the 'Next Page' button and add it to the tool bar - nextPageButton_= new JButton(iconNextPage_); - toolBar.add(nextPageButton_); - nextPageButton_.setBounds(insets.left + 267, insets.top + TOPOFFSET_, BSIZE_, BSIZE_); - nextPageButton_.addActionListener(listener); - nextPageButton_.setToolTipText(nextPageText_); - nextPageButton_.setActionCommand("nextPage"); - - // create the 'Last Page' button and add it to the tool bar - lastPageButton_= new JButton(iconLastPage_); - toolBar.add(lastPageButton_); - lastPageButton_.setBounds(insets.left + 303,insets.top + TOPOFFSET_, BSIZE_, BSIZE_); - lastPageButton_.addActionListener(listener); - lastPageButton_.setToolTipText(lastPageText_); - lastPageButton_.setActionCommand("lastPage"); - - // create the 'Flash Page' button and add it to the tool bar - flashButton_ = new JButton(iconFlashPage_); - toolBar.add(flashButton_); - flashButton_.setBounds(insets.left + 346, insets.top + TOPOFFSET_, BSIZE_, BSIZE_); - flashButton_.addActionListener(listener); - flashButton_.setToolTipText(flashPageText_); - flashButton_.setActionCommand("flashPage"); - - // create the 'Paper Size' button and add it to the tool bar - paperSizeButton_ = new JButton(iconPaperSize_); - toolBar.add(paperSizeButton_); - paperSizeButton_.setBounds(insets.left + 389, insets.top + TOPOFFSET_, BSIZE_, BSIZE_); - paperSizeButton_.addActionListener(listener); - paperSizeButton_.setToolTipText(paperSizeText_); - paperSizeButton_.setActionCommand("changePaperSize"); - - // create the 'Viewing Fidelity' button and add it to the tool bar - viewingFidelityButton_ = new JButton(iconViewFidelity_); - toolBar.add(viewingFidelityButton_); - viewingFidelityButton_.setBounds(insets.left + 425, insets.top + TOPOFFSET_, BSIZE_, BSIZE_); - viewingFidelityButton_.addActionListener(listener); - viewingFidelityButton_.setToolTipText(vFidelityText_); - viewingFidelityButton_.setActionCommand("changeViewingFidelity"); - - // return the tool bar - return toolBar; - } - - - -/** -Constructs the viewer for the spooled file object. All visual aspects of the -viewer (toolbar, scrolling view window, status bar) are created. This -method also calls initializeTransient() to initialize the transient data. -**/ - private void createViewer() - { - // initialize transient data - initializeTransient(); - - // initialize paper size - if (paperSizeChecked_ == false) { // if paper size hasn't been initialized - try { - // get default locale for determining paper size - Locale country = Locale.getDefault(); - - String cntry = country.getISO3Country(); - if ((cntry.equals("USA")) || (cntry.equals("CAN")) || - (cntry.equals("BRA")) || (cntry.equals("MEX"))) { - // non metric country, select LETTER paper size - paperSize_ = LETTER; - } - else { - // metric country, select A4 paper size - paperSize_ = A4; - } - } - // catch MissingResourceException - catch (MissingResourceException mre) { - // trace the error - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Default paper size selected"); - paperSize_ = A4; - } - finally { - paperSizeChecked_ = true; // paper size has been initialized - } - } - else { - paperSize_ = sPaperSize_; - } - - viewingFidelity_ = sViewingFidelity_; - - // set border layout for the frame - setLayout(new BorderLayout()); - - // create the tool bar and add it - toolBar_ = createToolBar(); - addToolBar(); - - // create the scolling view pane and add it - scrollView_ = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, - ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); - add("Center", scrollView_); - - // create the staus bar and add it - statusBar_ = createStatusBar(); - addStatusBar(); - - // disable the viewer buttons - disableViewerButtons(); - - // show the viewer - repaint(); - } - - - -/** -Disables the viewer buttons. -**/ - private void disableViewerButtons() - { - actualButton_.setEnabled(false); // 'return page to actual size' button - firstPageButton_.setEnabled(false); // 'view first page' button - fitPageButton_.setEnabled(false); // 'fit page in view' button - fitWidthButton_.setEnabled(false); // 'view flash page' button - flashButton_.setEnabled(false); // 'view previously viewed page' button - gotoButton_.setEnabled(false); // 'go to specific page' button - lastPageButton_.setEnabled(false); // 'view last page' button - nextPageButton_.setEnabled(false); // 'view next page' button - paperSizeButton_.setEnabled(false); // 'select paper size' button - prevPageButton_.setEnabled(false); // 'view previous page' button - viewingFidelityButton_.setEnabled(false); // 'viewing fidelity' button - zoomButton_.setEnabled(false); // 'zoom' button - } - - - -/** -Creates and shows a 'Warning' dialog. This dialog is displayed to warn -that the property being changed will cause the spooled file being viewed to -be closed and re-opened. The appropriate 'set ' method is then invoked, depending -on the property being changed. - -@param property The property requested to be changed. -
    - May be any of the following values: -
      -
    • PAPER_SIZE - The paper size -
    • VIEWING_FIDELITY - The viewing fidelity -
    -

    -@param value The new property value. -

    - For PAPER_SIZE, this parameter may be any of the - following values: -

      -
    • LETTER - Letter (8.5 x 11 inches) -
    • LEGAL - Legal (8.5 x 14 inches) -
    • A3 - A3 (297 x 420 mm) -
    • A4 - A4 (210 x 297 mm) -
    • A5 - A5 (148 x 210 mm) -
    • B4 - B4 (257 x 364 mm) -
    • B5 - B5 (182 x 257 mm) -
    • EXECUTIVE - Executive (7.25 x 10.5 inches) -
    • LEDGER - Ledger (17 x 11 inches) -
    • CONT80 - Continuous feed 80 (8 x 11 inches) -
    • CONT132 - Continuous feed 132 (12.2 x 11 inches) -
    • NONE - None -
    -

    - For VIEWING_FIDLEITY, this parameter may be any - of the following values: -

      -
    • ABSOLUTE -
    • CONTENT -
    -**/ - void displayPropertyChangeWarning(String property, - int value) - { - boolean internetExplorer = false; // @A5A - int selectedValue; - Object[] options = { okText_, cancelText_ }; - - Class policyEngineClass = null; // @A5A - try { // @A5A - policyEngineClass = Class.forName("com.ms.security.PolicyEngine"); // @A5A - } // @A5A - catch (Throwable e) {} // @A5A - if (policyEngineClass != null) { // @A5A - internetExplorer = true; // @A5A - } // @A5A - - if (property.equals("viewingFidelity")) { - // display viewing fidelity warning and set accordingly - if (!internetExplorer) { // @A5A - selectedValue = JOptionPane.showOptionDialog(this, vFidelityWarnText_, - warningText_, JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, - null, options, options[0]); - if (selectedValue == 0) { - try { - setViewingFidelity(value); - load(); - } - catch (Exception e) {} // absorb all exceptions - if an error - // occurred - an error event was fired. - } - } // @A5A - else { // @A5A - WarningDialogBox_ wDialog = new WarningDialogBox_((JFrame)VUtilities.getFrame(this), - vFidelityWarnText_, property, value); // @A5A - wDialog.setVisible(true); // @A5A - } // @A5A - } - else if (property.equals("paperSize")) { - // display paper size warning and set accordingly - if (!internetExplorer) { // @A5A - selectedValue = JOptionPane.showOptionDialog(this, paperSizeWarnText_, - warningText_, JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, - null, options, options[0]); - if (selectedValue == 0) { - try { - setPaperSize(value); - load(); - } - catch (Exception e) {} // absorb all exceptions - if an error - // occurred - an error event was fired. - } - } // @A5A - else { // @A5A - WarningDialogBox_ wDialog = new WarningDialogBox_((JFrame)VUtilities.getFrame(this), - paperSizeWarnText_, property, value); // @A5A - wDialog.setVisible(true); // @A5A - } // @A5A - } - else { - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Property for 'displayPropertyChangeWarning' not valid"); - } - } - - - -/** -Enables the viewer buttons. -**/ - private void enableViewerButtons() - { - actualButton_.setEnabled(true); // 'return page to actual size' button - firstPageButton_.setEnabled(true); // 'view first page' button - fitPageButton_.setEnabled(true); // 'fit page in view' button - fitWidthButton_.setEnabled(true); // 'view flash page' button - flashButton_.setEnabled(true); // 'view previously viewed page' button - gotoButton_.setEnabled(true); // 'go to specific page' button - lastPageButton_.setEnabled(true); // 'view last page' button - nextPageButton_.setEnabled(true); // 'view next page' button - paperSizeButton_.setEnabled(true); // 'select paper size' button - prevPageButton_.setEnabled(true); // 'view previous page' button - viewingFidelityButton_.setEnabled(true); // 'viewing fidelity' button - zoomButton_.setEnabled(true); // 'zoom' button - } - - - -/** -Closes the viewer. -@exception Throwable If an error occurs during cleanup. -**/ - protected void finalize() throws Throwable - { - try { - // close the page input stream and return the conversation - if (spooledFileIS_ != null) - spooledFileIS_.close(); - } - catch (IOException e) {} - super.finalize(); - } - - - -/** -Stretches the size of the page image vertically to the edges -of the viewing window. This method is only valid after a spooled -file has been loaded. -**/ - public void fitHeight() - { - if (initialized_ == true) { - // clear view - pageView_.clearView(); - - // retrieve viewport from scroll pane - JViewport viewPort = scrollView_.getViewport(); - - // retrieve visible viewport size - Dimension viewPortSize = viewPort.getExtentSize(); - - // ensure viewport size is valid - if (viewPortSize.width < 0) viewPortSize.width = 0; - if (viewPortSize.height < 0) viewPortSize.height = 0; - - // adjust width and height of page image to fit height of viewport - Dimension d = new Dimension(); - d.height = viewPortSize.height; - d.width = ((currentPageImage_.getWidth(this) * viewPortSize.height)/ - currentPageImage_.getHeight(this)); - pageView_.setViewSize(d); - - // calculate the new viewing zoom percentage - calculateZoom(); - - // update the viewer - updateViewer(); - } - } - - - -/** -Stretches the size of the page image horizontally or vertically so the -entire view is contained within the edges of the viewing window. This method -is only valid after a spooled file has been loaded. -**/ - public void fitPage() - { - if (initialized_ == true) { - Dimension d1 = scrollView_.getSize(); - Dimension d2 = scrollView_.getViewport().getExtentSize(); - - // ensure viewport size is valid - if (d2.width < 0) d2.width = 0; - if (d2.height < 0) d2.height = 0; - - int viewWidth = pageView_.getWidth(); - int viewHeight = pageView_.getHeight(); - - if ((viewWidth <= d2.width) && (viewHeight >= d2.height)) - fitHeight(); - else if ((viewWidth >= d2.width) && (viewHeight <= d2.height)) - fitWidth(); - else if (viewWidth < d2.width) { - if (java.lang.Math.abs(d1.width - viewWidth) < - java.lang.Math.abs(d1.height - viewHeight)) - fitWidth(); - else - fitHeight(); - } - else { - if (java.lang.Math.abs(d1.width - viewWidth) < - java.lang.Math.abs(d1.height - viewHeight)) - fitHeight(); - else - fitWidth(); - } - } - } - - - -/** -Stretches the size of the page image horizontally to the edges of -the viewing window. This method is only valid after a spooled file -has been loaded. -**/ - public void fitWidth() - { - if (initialized_ == true) { - // clear view - pageView_.clearView(); - - // retrieve viewport from scroll pane - JViewport viewPort = scrollView_.getViewport(); - - // retrieve visible viewport size - Dimension viewPortSize = viewPort.getExtentSize(); - - // ensure viewport size is valid - if (viewPortSize.width < 0) viewPortSize.width = 0; - if (viewPortSize.height < 0) viewPortSize.height = 0; - - // adjust width and height of page image to fit width of viewport - Dimension d = new Dimension(); - d.width = viewPortSize.width; - d.height = ((currentPageImage_.getHeight(this) * viewPortSize.width)/ - currentPageImage_.getWidth(this)); - - pageView_.setViewSize(d); - - // calculate the new viewing zoom percentage - calculateZoom(); - - // update the viewer - updateViewer(); - } - } - - - -/** -Returns the page number of the current page. - -@return The current page number. -**/ - public int getCurrentPage() - { - return currentPageNumber_; - } - - - -/** -Returns the number of pages in the spooled file. -This value may be estimated, depending on the origin of spooled file. -If the spooled file was created natively on a system, the -value is valid. If the spooled file was created on another -type of system, the value may be estimated. - -@see #isNumberOfPagesEstimated - -@return The number of pages. -**/ - public int getNumberOfPages() - { - return numberOfPages_; - } - - - -/** -Returns the Image for page page - -@param page The page to return an Image of. - -@return The page Image. - -@exception IOException Thrown if the specified page cannot be retrieved. -**/ - private synchronized Image getPageImage(int page) throws IOException - { - Image image = null; // GIF image to create - if (spooledFileIS_ == null) { - throw new IOException(); - } - - try { - // select page in page input stream - boolean pageSelected = spooledFileIS_.selectPage(page); // @A1C - if (pageSelected == false) { // @A1A - throw new IOException(); // @A1A - } // @A1A - - // retrieve size of page data in bytes - int bytesAvailable = spooledFileIS_.available(); - if (bytesAvailable == 0) { - throw new IOException(); - } - - byte[] imageData = new byte[bytesAvailable]; - - // read image data - spooledFileIS_.read(imageData, 0, bytesAvailable); - - // retrieve the frame's toolkit (needed for 'createImage' method) - Frame frame = new Frame(); - Toolkit kit = frame.getToolkit(); - - // create imageLoader to track image loading - MediaTracker imageLoader = new MediaTracker(frame); - - // create the Image - image = (kit.createImage(imageData)); - - if (image != null) { - // ensure the image loaded correctly in memory - imageLoader.addImage(image, 0); - imageLoader.waitForID(0); - - // free imageLoader: it has served its purpose - imageLoader = null; - } - } - catch (Exception e) { - // error generating page image - throw new IOException(); - } - - // return the image - return image; - } - - - -/** -Returns the Dimension of the page image being viewed. - -@return The Dimension of the current page image. -**/ - private Dimension getPageImageSize() - { - if (currentPageImage_ != null) { - return (new Dimension(currentPageImage_.getWidth(this), - currentPageImage_.getHeight(this))); - } - else - return new Dimension(0,0); - } - - - -/** -Returns the paper size. The paper size is used to determine how to -process pages from the spooled file. - -@return The paper size. -**/ - public int getPaperSize() - { - return paperSize_; - } - - - -/** -Returns the preferred size of the viewer. - -@return The preferred size. -**/ - public Dimension getPreferredSize() - { - if ((pageView_ != null) - && ((pageView_.getWidth() < 500) && (pageView_.getHeight() < 700))) { - return new Dimension(pageView_.getWidth() + 25, - pageView_.getHeight() + TOOLBARSIZE_ + statusBar_.getPreferredSize().height); - } - else - return new Dimension(PREF_WIDTH,PREF_HEIGHT); - } - - - -/** -Returns the spooled file being viewed. - -@return The spooled file. -**/ - public SpooledFile getSpooledFile() - { - return spooledFile_; - } - - - -/** -Returns the viewing fidelity. The viewing fidelity is used to determine how to -process pages from the spooled file. - -@return The viewing fidelity. -**/ - public int getViewingFidelity() - { - return viewingFidelity_; - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient() - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport(this); - propertyChangeSupport_ = new PropertyChangeSupport(this); - vetoableChangeSupport_ = new VetoableChangeSupport(this); - workingEventSupport_ = new WorkingEventSupport(this); - - addWorkingListener(new WorkingCursorAdapter(this)); - - addFocusListener(new SerializationListener(this)); //@A3A - } - - - -/** -Indicates if the number of pages associated with the spooled file being viewed -is estimated. - -@see #getNumberOfPages - -@return Returns true if the number of pages is estimated; false otherwise. -**/ - public boolean isNumberOfPagesEstimated() - { - return numberOfPagesEst_; - } - - - -/** -Loads the spooled file for viewing. A call to this method must be made after -the constructor has been invoked or the spooled file has changed -in order to load the spooled file and properly initialize the viewer. - -@exception IOException Thrown if the spooled file cannot be initialized. -@exception PropertyVetoException Thrown if the property change is vetoed. -**/ - public void load() throws IOException, PropertyVetoException - { - if (spooledFile_ == null) { - errorEventSupport_.fireError(new IllegalStateException("spooledFile")); - } - else { - // fire started working event. - workingEventSupport_.fireStartWorking(); - - try { - // set intialized to false, and disable the viewer buttons - // until we have successfully retrieved the spooled file - initialized_ = false; - disableViewerButtons(); - - // set up the print parms for creating the spooled file input stream - // These parms will ensure we get page-at-a-time data, with each - // page being represented as a 'block' of GIF binary data - - PrintParameterList printParms = new PrintParameterList(); - printParms.setParameter(PrintObject.ATTR_WORKSTATION_CUST_OBJECT, WSCSTOBJ); - printParms.setParameter(PrintObject.ATTR_MFGTYPE, "*WSCST"); - printParms.setParameter(PrintObject.ATTR_VIEWING_FIDELITY, viewingValues[viewingFidelity_]); - printParms.setParameter(PrintObject.ATTR_PAPER_SOURCE_1, paperSizeValues[paperSize_]); - - // close previous spooled file page input stream - if (spooledFileIS_ != null) { - spooledFileIS_.close(); - } - - // retrieve page input stream from spooled file - spooledFileIS_ = spooledFile_.getPageInputStream(printParms); - - // throw exception for spooledFileIS_ == null - if (spooledFileIS_ == null) { - throw new IOException(); - } - - // warn of numberOfPages property change - int newValue = spooledFileIS_.getNumberOfPages(); - - vetoableChangeSupport_.fireVetoableChange("numberOfPages", - new Integer(numberOfPages_), - new Integer(newValue)); - - int oldValue = numberOfPages_; - numberOfPages_ = newValue; - - // fire numberOfPages property change - propertyChangeSupport_.firePropertyChange("numberOfPages", - new Integer(oldValue), - new Integer(numberOfPages_)); - - - // determine if number of pages is estimated - boolean newEstimated = spooledFileIS_.isPagesEstimated(); - - // warn of pagesEstimated property change - vetoableChangeSupport_.fireVetoableChange("numberOfPagesEstimated", - new Boolean(numberOfPagesEst_), - new Boolean(newEstimated)); - - // we know the number of pages is estimated - boolean oldEstimated = numberOfPagesEst_; - numberOfPagesEst_ = newEstimated; - - // fire numberOfPagesEstimated property change - propertyChangeSupport_.firePropertyChange("numberOfPagesEstimated", - new Boolean(oldEstimated), - new Boolean(numberOfPagesEst_)); - - // display '*' if the number of pages is estimated - if (numberOfPagesEst_ == true) { - estimateStar_ = "*"; - } - - try { - // retrieve the starting page view - currentPageImage_ = getPageImage(currentPageNumber_); - - // no exception thrown means the page was found successfully - // update instance variables accordingly - oldCurrentPage_ = currentPageNumber_; - knownPages_ = currentPageNumber_; - } - catch (IOException e) { // error getting page, default to page one... - if (currentPageNumber_ != 1) { // if we didn't try to get page one above... - - // default to setting current page to 1 - setCurrentPage(1); - - // retrieve starting page image - currentPageImage_ = getPageImage(currentPageNumber_); - - // no exception thrown means the page was found successfully - // update instance variables accordingly - oldCurrentPage_ = currentPageNumber_; - knownPages_ = currentPageNumber_; - } - else { - // the page stream doesn't have page 1 available... - // trace the error - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error initializing spooled file viewer"); - - // throw the exception - throw(e); - - } - } - - // if we have gotten here, we successfully retrieved a - // spooled file page image - - // create the page view for the viewer - pageView_ = new SpooledFilePageView_(); - scrollView_.setViewportView(pageView_); - - // enable the viewer buttons - enableViewerButtons(); - - // initialization complete - initialized_ = true; - - // (re)set viewing zoom percentage - calculateZoom(); - - // update the viewer - updateViewer(); - - // repaint all - validate(); // @A4A - validate forces redraw - // paintAll(this.getGraphics()); @A4D - - } - catch (Exception e) { - initialized_ = false; - // trace the error - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, "Error initializing spooled file viewer"); - errorEventSupport_.fireError(e); - } - finally { - // fire stopped working event - workingEventSupport_.fireStopWorking(); - } - } - } - - - -/** -Loads the previously viewed page. If a different page was not previously -viewed (loaded), no action is taken. This method can only be called after -a spooled file has been loaded. If a spooled file has not been successfully -loaded into the viewer previously, an error event is fired. - - -@exception PropertyVetoException Thrown if the property change is vetoed. -**/ - public void loadFlashPage() - throws PropertyVetoException - { - if (initialized_ == true) { - if (flashPageImage_!= null) { // flash page defined - vetoableChangeSupport_.fireVetoableChange("currentPage", - new Integer(oldCurrentPage_), - new Integer(flashPageNumber_)); - - // clear current page view - pageView_.clearView(); - - // perform swap of flash/current page number - int tempPageNumber = flashPageNumber_; - flashPageNumber_ = oldCurrentPage_; - currentPageNumber_ = tempPageNumber; - - // perform swap of flash/current page image - Image tempPageImage = flashPageImage_; - flashPageImage_ = currentPageImage_; - currentPageImage_ = tempPageImage; - oldCurrentPage_ = currentPageNumber_; - - Dimension d1 = getPageImageSize(); // @A1A - Dimension d2 = new Dimension(); // @A1A - d2.width =(int)((float)d1.width * (zoomPercentage_/100)); // @A1A - d2.height=(int)((float)d1.height * (zoomPercentage_/100)); // @A1A - pageView_.setViewSize(d2); // @A1A - - // update the view - updateViewer(); - - propertyChangeSupport_.firePropertyChange("currentPage", - new Integer(flashPageNumber_), - new Integer(currentPageNumber_)); - } - } - else { - errorEventSupport_.fireError(new IllegalStateException()); - } - } - - - -/** -Loads the current page for viewing. This method can only be called -after a spooled file has been successfully loaded. If the current page -is not a valid page of the spooled file, the current page is set to the -previously viewed page, and an error event is fired. -If a spooled file has not been successfully loaded into the viewer previously, -an error event is fired. - -@exception PropertyVetoException Thrown if the property change is vetoed. -**/ - public void loadPage() - throws PropertyVetoException - { - Image newPageImage; - - // fire started working event - workingEventSupport_.fireStartWorking(); - - if (initialized_ == true) { // a spooled file has been loaded - if (currentPageNumber_ == oldCurrentPage_) { - // optimization - current page already loaded - } - else if (currentPageNumber_ == flashPageNumber_) { - // optimization - load flash page - loadFlashPage(); - } - else { // possible new page to read - try { - // attempt to retrieve current page - newPageImage = getPageImage(currentPageNumber_); - - // no exception thrown means the page was found successfully - - // update flash page information - flashPageNumber_ = oldCurrentPage_; - flashPageImage_ = currentPageImage_; - - // update current page information - oldCurrentPage_ = currentPageNumber_; - currentPageImage_ = newPageImage; - - // check number of pages, update known count - if ((numberOfPagesEst_ == true) && - (currentPageNumber_ > knownPages_)) { - knownPages_ = currentPageNumber_; - } - } - catch (IOException e) { // couldn't retrieve currentPageNumber_ - // check to see if we found the last page if we have - // the number of pages estimated! - if ((numberOfPagesEst_ == true) && - (currentPageNumber_ == (knownPages_ + 1))) { - // we've found the last page! - - // warn of property change - vetoableChangeSupport_.fireVetoableChange("numberOfPages", - new Integer(numberOfPages_), - new Integer(knownPages_)); - - // we now know the number of pages - int oldValue = numberOfPages_; - numberOfPages_ = knownPages_; - - // fire numberOfPages property change - propertyChangeSupport_.firePropertyChange("numberOfPages", - new Integer(oldValue), - new Integer(numberOfPages_)); - - - // warn of property change, only from true to false - vetoableChangeSupport_.fireVetoableChange("numberOfPagesEstimated", - new Boolean(true), - new Boolean(false)); - - // we know the number of pages is valid - numberOfPagesEst_ = false; - estimateStar_ = ""; - - // fire numberOfPagesEstimated property change, only from true to false - propertyChangeSupport_.firePropertyChange("numberOfPagesEstimated", - new Boolean(true), - new Boolean(false)); - - } - // warn of property change - vetoableChangeSupport_.fireVetoableChange("currentPage", - new Integer(currentPageNumber_), - new Integer(oldCurrentPage_)); - - int oldPage = currentPageNumber_; - currentPageNumber_ = oldCurrentPage_; - - // fire currentPage property change - propertyChangeSupport_.firePropertyChange("currentPage", - new Integer(oldPage), - new Integer(currentPageNumber_)); - // fire error event - errorEventSupport_.fireError(new IOException()); - } - } - - Dimension d1 = getPageImageSize(); // @A1A - Dimension d2 = new Dimension(); // @A1A - d2.width =(int)((float)d1.width * (zoomPercentage_/100)); // @A1A - d2.height=(int)((float)d1.height * (zoomPercentage_/100)); // @A1A - pageView_.setViewSize(d2); // @A1A - - // update the viewer - updateViewer(); - } // (initialized == false) - else { - errorEventSupport_.fireError(new IllegalStateException()); - } - // fire stopped working event - workingEventSupport_.fireStopWorking(); - } - - - -/** -Sets the view back one page. - -@exception PropertyVetoException Thrown if the property change is vetoed. -**/ - public void pageBack() - throws PropertyVetoException - { - setCurrentPage(currentPageNumber_ - 1); - loadPage(); - } - - - -/** -Sets the view forward one page. - -@exception PropertyVetoException Thrown if the property change is vetoed. -**/ - public void pageForward() - throws PropertyVetoException - { - setCurrentPage(currentPageNumber_ + 1); - loadPage(); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. - -@exception IOException Thrown if an IO error occurs. -@exception ClassNotFoundException Thrown if class is not found. -**/ - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient(); - initialized_ = false; - } - - - -/** -Removes an ErrorListener. - -@param listener The listener. -**/ - public void removeErrorListener(ErrorListener listener) - { - errorEventSupport_.removeErrorListener(listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - super.removePropertyChangeListener(listener); - propertyChangeSupport_.removePropertyChangeListener(listener); - } - - - -/** -Removes the tool bar. -**/ - public void removeToolBar() - { - remove(toolBar_); - validate(); // @A4A - validate forces redraw - // paintAll(this.getGraphics()); @A4D - } - - - -/** -Removes the status bar. -**/ - public void removeStatusBar() - { - remove(statusBar_); - validate(); // @A4A - validate forces redraw - // paintAll(this.getGraphics()); @A4D - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - super.removeVetoableChangeListener(listener); - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** -Removes a WorkingListener. - -@param listener The listener. -**/ - public void removeWorkingListener(WorkingListener listener) - { - workingEventSupport_.removeWorkingListener(listener); - } - - - -/** -Sets the current page. - -@param newPage The page to view. - -@exception PropertyVetoException Thrown if the property change is vetoed. -**/ - public synchronized void setCurrentPage(int newPage) - throws PropertyVetoException - { - if ((1 <= newPage) && ((newPage <= numberOfPages_) || - (numberOfPagesEst_ == true) || (initialized_ == false))) { - - // warn of property change - vetoableChangeSupport_.fireVetoableChange("currentPage", - new Integer(currentPageNumber_), - new Integer(newPage)); - - // update current page - int oldPage = currentPageNumber_; - currentPageNumber_ = newPage; - - // fire currentPage property change - propertyChangeSupport_.firePropertyChange("currentPage", - new Integer(oldPage), - new Integer(currentPageNumber_)); - } - } - - - -/** -Sets the papersize. If paper size specified by paperSize is not valid, -no action is taken. - -@param paperSize The paper size to be used for processing spooled file pages. -

    - May be any of the following values: -

      -
    • LETTER - Letter (8.5 x 11 inches) -
    • LEGAL - Legal (8.5 x 14 inches) -
    • A3 - A3 (297 x 420 mm) -
    • A4 - A4 (210 x 297 mm) -
    • A5 - A5 (148 x 210 mm) -
    • B4 - B4 (257 x 364 mm) -
    • B5 - B5 (182 x 257 mm) -
    • EXECUTIVE - Executive (7.25 x 10.5 inches) -
    • LEDGER - Ledger (17 x 11 inches) -
    • CONT80 - Continuous feed 80 (8 x 11 inches) -
    • CONT132 - Continuous feed 132 (13.2 x 11 inches) -
    • NONE - None -
    - -@exception PropertyVetoException Thrown if the property change is vetoed. -**/ - public synchronized void setPaperSize(int paperSize) - throws PropertyVetoException - { - if ((LETTER <= paperSize) && (paperSize <= NONE)) { - - // warn of property change - vetoableChangeSupport_.fireVetoableChange("paperSize", - new Integer(paperSize_), - new Integer(paperSize)); - - // update paper size - int oldValue = paperSize_; - paperSize_ = paperSize; - - // set static initializer - sPaperSize_ = paperSize_; - paperSizeChecked_ = true; - - // fire property change to all listeners - propertyChangeSupport_.firePropertyChange("paperSize", - new Integer(oldValue), - new Integer(paperSize_)); - } - else - errorEventSupport_.fireError(new IllegalArgumentException("paperSize")); - } - - - -/** -Sets the spooled file. - -@param spooledFile The spooled file to view. - -@exception PropertyVetoException Thrown if the property change is vetoed. -**/ - public void setSpooledFile(SpooledFile spooledFile) - throws PropertyVetoException - { - if (spooledFile == null) - throw new NullPointerException("spooledFile"); - - // warn of property change - vetoableChangeSupport_.fireVetoableChange("spooledFile", - spooledFile_, - spooledFile); - - // update spooled file - SpooledFile oldValue = spooledFile_; - spooledFile_ = spooledFile; - - // fire spooledFile property change - propertyChangeSupport_.firePropertyChange("spooledFile", - oldValue, - spooledFile_); - } - - - -/** -Sets the viewing fidelity. - -@param viewingFidelity The viewing fidelity. If viewing fidelity specified -by viewingFidelity is not valid, no action is taken. -

    - May be any of the following values: -

      -
    • ABSOLUTE - Absolute. When this is specified, the spooled file data - is scanned and all non-raster data is processed up through - the current page. -
    • CONTENT - Content. When this is specified, the spooled file data is - processed according to datastream type: -
        -
      • SCS - Process open-time commands and current page commands - only. -
      • AFPDS - Process the first page without rasterizing, then the - current page. -
      -
    - -@exception PropertyVetoException Thrown if the property change is vetoed. -**/ - public synchronized void setViewingFidelity(int viewingFidelity) - throws PropertyVetoException - { - if ((ABSOLUTE_FIDELITY <= viewingFidelity) && - (viewingFidelity <= CONTENT_FIDELITY)) { - - // warn of property change - vetoableChangeSupport_.fireVetoableChange("viewingFidelity", - new Integer(viewingFidelity_), - new Integer(viewingFidelity)); - // update viewing fidelity - int oldValue = viewingFidelity_; - viewingFidelity_ = viewingFidelity; - - // set static initializer - sViewingFidelity_ = viewingFidelity_; - - // fire property change to all listeners - propertyChangeSupport_.firePropertyChange("viewingFidelity", - new Integer(oldValue), - new Integer(viewingFidelity_)); - } - else - errorEventSupport_.fireError(new IllegalArgumentException("viewingFidelity")); - } - - - -/** -Performs the action of updating viewer information; specifically, updating the -current page number, calculating the zoom ration, and (enabling/disabling) -the viewer buttons items, -**/ - private void updateViewer() { - if ((pageView_ != null) && (initialized_ == true)) { - // update pageview - pageView_.repaint(); - - // currentPageNumber_ = getCurrentPage(); - zoomInfo_.setText((int)zoomPercentage_ + "%"); // @A1C added (int) - - String pageText = ResourceLoader.substitute(ResourceLoader.getPrintText("PAGE_OF"), - new String[]{Integer.toString(currentPageNumber_), - Integer.toString(numberOfPages_)}); - pageInfo_.setText(pageText + estimateStar_); - - // enabled/disable 'first' and 'previous' page buttons - if (currentPageNumber_ > 1) { - firstPageButton_.setEnabled(true); - prevPageButton_.setEnabled(true); - } - else { - firstPageButton_.setEnabled(false); - prevPageButton_.setEnabled(false); - } - - // enable/disable 'next' and 'last' page buttons - // NOTE: All spooled files have a 'number of pages' attribute. - // For some spooled files, this value is an 'estimated' quantity. - // Another attribute associated with the spooled file allows us - // to know whether this total 'number of pages' is real or estimated. - // We have stored the value of this attribute in numberOfPagesEst_. - if (numberOfPagesEst_ == false) { - if (currentPageNumber_ < numberOfPages_) { - lastPageButton_.setEnabled(true); - nextPageButton_.setEnabled(true); - } - else { - lastPageButton_.setEnabled(false); - nextPageButton_.setEnabled(false); - } - } - else { - lastPageButton_.setEnabled(false); - nextPageButton_.setEnabled(true); - } - - } - } - - - -/*************************************************************************/ - - - - private class ViewerActionListener_ implements ActionListener { - - /** - Performs the action. - - @param e The ActionEvent - **/ - public void actionPerformed(ActionEvent e) - { - String command = e.getActionCommand(); - try { - // perform requested action - if (command.equals("actualSize")) { - actualSize(); - } - else if (command.equals("fitWidth")) { - fitWidth(); - } - else if (command.equals("fitPage")) { - fitPage(); - } - else if (command.equals("zoom")) { - changeZoom(); - } - else if (command.equals("goToPage")) { - changeCurrentPage(); - } - else if (command.equals("firstPage")) { - setCurrentPage(1); - loadPage(); - } - else if (command.equals("prevPage")) { - pageBack(); - } - else if (command.equals("nextPage")) { - pageForward(); - } - else if (command.equals("lastPage")) { - setCurrentPage(numberOfPages_); - loadPage(); - } - else if (command.equals("flashPage")) { - loadFlashPage(); - } - else if (command.equals("changeViewingFidelity")) { - changeViewingFidelity(); - } - else if (command.equals("changePaperSize")) { - changePaperSize(); - } - } - catch (Exception err) { - // do nothing - } - } - } - - - -/*************************************************************************/ - - -/** -The SpooledFilePageView_ class represents the view of one page of -a spooled file. -**/ - - private class SpooledFilePageView_ extends JLabel - { - Dimension viewSize_; - - - public SpooledFilePageView_() - { - viewSize_ = new Dimension(currentPageImage_.getWidth(this), - currentPageImage_.getHeight(this)); - } - - - - /** - Clears the current view. - **/ - synchronized public void clearView() - { - Rectangle r = getVisibleRect(); - getGraphics().clearRect(r.x, r.y, r.width, r.height); - } - - - - /** - Returns the view height. - - @return The height. - **/ - public int getHeight() - { - // in IE, Super class JLabel needs valid values even before - // this object is constructed. To comply, a value - // of 10 is returned temporarily... - if (viewSize_ == null) // @A5A - return 10; // @A5A - else // @A5A - return viewSize_.height; - } - - - - /** - Returns the view width. - - @return The width. - **/ - public int getWidth() - { - // in IE, Super class JLabel needs valid values even before - // this object is constructed. To comply, a value - // of 10 is returned temporarily... - if (viewSize_ == null) // @A5A - return 10; // @A5A - else // @A5A - return viewSize_.width; - } - - - - /** - Paints the view. - - @param g The specified Graphics environment. - **/ - public void paint(Graphics g) - { - //@PDD causes recursive paint events to fire and eats up cpu setSize(viewSize_); - g.drawImage(currentPageImage_,0,0,viewSize_.width, viewSize_.height, this); - } - - - - /** - Sets the view size. - - @param d The new dimension for the view size. - **/ - public void setViewSize(Dimension d) - { - viewSize_.width = d.width; - viewSize_.height = d.height; - } - - - - /** - Updates the view. - - @param g The specified Graphics environment. - **/ - public void update(Graphics g) - { - clearView(); - paint(g); - } - - } - - - -/*************************************************************************/ - - - -/** -The PaperSizeBox_ class represents a dialog for selecting a paper size -to be used when rendering the pages of spooled file for viewing. -**/ - private class PaperSizeBox_ - extends JDialog - implements ActionListener - { - - JButton okButton, cancelButton; - final JList dataList; - - /** - Constructs a PaperSizeBox_ Dialog - **/ - public PaperSizeBox_(JFrame parent) - { - super(parent, paperSizeText_, true); - setResizable(false); - getContentPane().setLayout(new BorderLayout()); - - // set the size of the list box - setSize(LISTBOXWIDTH_, LISTBOXHEIGHT_); - - // create text label indicating current paper size - JPanel textPanel = new JPanel(); - textPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); - textPanel.add(new JLabel(curPaperText_ + " : " + paperSizes[paperSize_])); - getContentPane().add("North", textPanel); - - // create the data list of available paper sizes - dataList = new JList(paperSizes); - JScrollPane scrollPane = new JScrollPane(dataList); - getContentPane().add("Center", scrollPane); - - // set a default index - dataList.setSelectedIndex(paperSize_); - - // create the mouse event listener - MouseListener mouseListener = new MouseAdapter() { - public void mouseClicked(MouseEvent e) { - if (e.getClickCount() == 2) { - int index = dataList.locationToIndex(e.getPoint()); - // dispose(); - setVisible(false); - displayPropertyChangeWarning("paperSize", index); - } - } - }; - dataList.addMouseListener(mouseListener); - - // create "OK" button - okButton = new JButton(okText_); - okButton.addActionListener(this); - okButton.setActionCommand("ok"); - - // create "Cancel" button - cancelButton = new JButton(cancelText_); - cancelButton.addActionListener(this); - cancelButton.setActionCommand("cancel"); - - // create button panel and add buttons - JPanel buttonPanel = new JPanel(); - buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); - buttonPanel.add(okButton); - buttonPanel.add(cancelButton); - getContentPane().add("South", buttonPanel); - - addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent event) { - setVisible(false); - } - }); - } - - - - /** - Perform the requested action. - - @param e The ActionEvent - **/ - public void actionPerformed(ActionEvent e) { - String command = e.getActionCommand(); - // dispose(); - setVisible(false); - if (command.equals("ok")) { - int index = dataList.getSelectedIndex(); - displayPropertyChangeWarning("paperSize", index); - updateViewer(); - } - - } - - - - /** - Show the dialog in the middle of the parent frame. - **/ - public void setVisible(boolean b) - { - if (b == true) { - Rectangle bounds = getParent().getBounds(); - Rectangle bounds2 = getBounds(); - setLocation(bounds.x + (bounds.width - bounds2.width)/ 2, - bounds.y + (bounds.height - bounds2.height)/2); - super.setVisible(true); - } - else - super.setVisible(false); - } - - } - - - -/*************************************************************************/ - - - -/** -The ViewingFidelityBox_ class represents a dialog for selecting the -viewing fidelity to be used when rendering the pages of spooled file -for viewing. -**/ - private class ViewingFidelityBox_ - extends JDialog - implements ActionListener - { - - JButton okButton, cancelButton; - final JList dataList; - - /** - Constructs a ViewingFidelityBox_ Dialog - **/ - public ViewingFidelityBox_(JFrame parent) - { - super(parent, vFidelityText_, true); - setResizable(false); - getContentPane().setLayout(new BorderLayout()); - - // set the size of the list box - setSize(LISTBOXWIDTH_, LISTBOXHEIGHT_); - - // create text label indicating current paper size - JPanel textPanel = new JPanel(); - textPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); - textPanel.add(new JLabel(curVFidelityText_ + " : " + - viewingFidelities[viewingFidelity_])); - getContentPane().add("North", textPanel); - - // create the data list of available viewing fidelities - dataList = new JList(viewingFidelities); - - // set a default index - dataList.setSelectedIndex(viewingFidelity_); - - JScrollPane scrollPane = new JScrollPane(dataList); - getContentPane().add("Center", scrollPane); - - MouseListener mouseListener = new MouseAdapter() { - public void mouseClicked(MouseEvent e) { - if (e.getClickCount() == 2) { - int index = dataList.locationToIndex(e.getPoint()); - // dispose(); - setVisible(false); - displayPropertyChangeWarning("viewingFidelity", index); - } - } - }; - dataList.addMouseListener(mouseListener); - - // create "OK" button - okButton = new JButton(okText_); - okButton.addActionListener(this); - okButton.setActionCommand("ok"); - - // create "Cancel" button - cancelButton = new JButton(cancelText_); - cancelButton.addActionListener(this); - cancelButton.setActionCommand("cancel"); - - // create button panel and add buttons - JPanel buttonPanel = new JPanel(); - buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); - buttonPanel.add(okButton); - buttonPanel.add(cancelButton); - getContentPane().add("South", buttonPanel); - - addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent event) { - setVisible(false); - } - }); - } - - - - /** - Perform the requested action. - - @param e The ActionEvent - **/ - public void actionPerformed(ActionEvent e) { - String command = e.getActionCommand(); - setVisible(false); - if (command.equals("ok")) { - int index = dataList.getSelectedIndex(); - // dispose(); - displayPropertyChangeWarning("viewingFidelity", index); - updateViewer(); - } - } - - - - /** - Show the dialog in the middle of the parent frame. - **/ - public void setVisible(boolean b) - { - if (b == true) { - Rectangle bounds = getParent().getBounds(); - Rectangle bounds2 = getBounds(); - setLocation(bounds.x + (bounds.width - bounds2.width)/ 2, - bounds.y + (bounds.height - bounds2.height)/2); - super.setVisible(true); - } - else - super.setVisible(false); - } - - } - - - -/*************************************************************************/ - - - -/** -The GoToBox_ class represents a dialog for selecting a page -to view. -**/ - private class GoToBox_ - extends JDialog - implements ActionListener { - - JButton okButton, cancelButton; - TextField pageNumber; - - /** - Constructs a GoToBox_ Dialog - **/ - public GoToBox_(JFrame parent) - { - super(parent, goToPageText_, true); - setResizable(false); - getContentPane().setLayout(new BorderLayout()); - - // set the size of the dialog - setSize(250, 100); - - // create text elements - JLabel desc = new JLabel(goToPageText_); - - pageNumber = new TextField("1", 6); // default 'go to' page - pageNumber.setBackground(new Color(255,255,255)); // set background white - pageNumber.setEditable(true); - pageNumber.setVisible(true); - pageNumber.addActionListener(this); - - // create text panel and add above elements - JPanel textPanel = new JPanel(); - textPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); - textPanel.add(desc); - textPanel.add(pageNumber); - - // add text panel to dialog box - getContentPane().add("Center",textPanel); - - // create "OK" button - okButton = new JButton(okText_); - okButton.addActionListener(this); - okButton.setActionCommand("ok"); - - // create "Cancel" button - cancelButton = new JButton(cancelText_); - cancelButton.addActionListener(this); - cancelButton.setActionCommand("cancel"); - - // create button panel and add buttons - JPanel buttonPanel = new JPanel(); - buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); - buttonPanel.add(okButton); - buttonPanel.add(cancelButton); - getContentPane().add("South", buttonPanel); - - addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent event) { - setVisible(false); - } - }); - - } - - - - /** - Perform the requested action. - - @param e The ActionEvent - **/ - public void actionPerformed(ActionEvent e) { - String command = e.getActionCommand(); - setVisible(false); - if (!(command.equals("cancel"))) { - try { - setCurrentPage(Integer.valueOf(pageNumber.getText()).intValue()); - loadPage(); - } - catch (Exception error) {} - } - - } - - - - /** - Show the dialog in the middle of the parent frame. - **/ - public void setVisible(boolean b) - { - if (b == true) { - Rectangle bounds = getParent().getBounds(); - Rectangle bounds2 = getBounds(); - setLocation(bounds.x + (bounds.width - bounds2.width)/ 2, - bounds.y + (bounds.height - bounds2.height)/2); - super.setVisible(true); - } - else - super.setVisible(false); - } - - } - - -/*************************************************************************/ - -// @A5A - Added inner class -/** -The WarningDialogBox_ class represents a dialog for displaying a warning. -**/ - private class WarningDialogBox_ - extends JDialog - implements ActionListener { - - JButton okButton, cancelButton; - String property; - int value; - - /** - Constructs a WarningDialogBox_ Dialog - **/ - public WarningDialogBox_(JFrame parent, - String warning, - String prop, - int val) - { - super(parent, warningText_, true); - property = prop; - value = val; - - getContentPane().setLayout(new BorderLayout()); - - // set the size of the dialog - setSize(250, 150); - - // create text element - JTextArea desc = new JTextArea(warning); - desc.setEditable(false); - - // create text panel and add text element - JPanel textPanel = new JPanel(); - textPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); - textPanel.add(desc); - - // add text panel to dialog box - getContentPane().add("Center",textPanel); - - // create "OK" button - okButton = new JButton(okText_); - okButton.addActionListener(this); - okButton.setActionCommand("ok"); - - // create "Cancel" button - cancelButton = new JButton(cancelText_); - cancelButton.addActionListener(this); - cancelButton.setActionCommand("cancel"); - - // create button panel and add buttons - JPanel buttonPanel = new JPanel(); - buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); - buttonPanel.add(okButton); - buttonPanel.add(cancelButton); - getContentPane().add("South", buttonPanel); - - addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent event) { - setVisible(false); - } - }); - - } - - - - /** - Perform the requested action. - - @param e The ActionEvent - **/ - public void actionPerformed(ActionEvent e) { - String command = e.getActionCommand(); - setVisible(false); - if (!(command.equals("cancel"))) { - if (property.equals("viewingFidelity")) { - try { - setViewingFidelity(value); - load(); - } - catch (Exception e1) {} // absorb all exceptions - if an error - // occurred - an error event was fired. - } - else if (property.equals("paperSize")) { - try { - setPaperSize(value); - load(); - } - catch (Exception e1) {} // absorb all exceptions - if an error - // occurred - an error event was fired. - } - } - } - - - - /** - Show the dialog in the middle of the parent frame. - **/ - public void setVisible(boolean b) - { - if (b == true) { - Rectangle bounds = getParent().getBounds(); - Rectangle bounds2 = getBounds(); - setLocation(bounds.x + (bounds.width - bounds2.width)/ 2, - bounds.y + (bounds.height - bounds2.height)/2); - super.setVisible(true); - } - else - super.setVisible(false); - } - - } - - - -/*************************************************************************/ - - - -/** -The ZoomToBox_ class represents a dialog for selecting a magnification -(zoom) ratio to for displaying the images of the spooled file pages. -**/ - private class ZoomToBox_ - extends JDialog - implements ActionListener - { - private JButton okButton, cancelButton; - private Checkbox[] radioButtons; - private float zoomAmount; - private TextField zoomPerc; - - /** - Constructs a ZoomToBox_ Dialog - **/ - public ZoomToBox_(JFrame parent) - { - super(parent, zoomText_, true); - Container zoomDialog = getContentPane(); - setResizable(false); - zoomDialog.setLayout(new BorderLayout()); - - // set the size of the dialog - setSize(250, 175); - - // create zoom percentages group - CheckboxGroup zoomPGroup= new CheckboxGroup(); - - // set all buttons off - boolean[] buttonOn = new boolean[5]; - for (int i = 0; i < 5; i++) { - buttonOn[i] = false; - } - - switch ((int)zoomPercentage_) { // @A1C added (int) - case 50: buttonOn[0] = true; - break; - case 75: buttonOn[1] = true; - break; - case 125: buttonOn[2] = true; - break; - case 150: buttonOn[3] = true; - break; - default: buttonOn[4] = true; - break; - } - - // The checkbox group is a collection of zoom percentage checkboxes - // with the special property that no more than one checkbox - // in the same group can be selected at a time. - radioButtons = new Checkbox[5]; - radioButtons[0] = new Checkbox(" 50%", zoomPGroup, buttonOn[0]); - radioButtons[1] = new Checkbox(" 75%", zoomPGroup, buttonOn[1]); - radioButtons[2] = new Checkbox("125%", zoomPGroup, buttonOn[2]); - radioButtons[3] = new Checkbox("150%", zoomPGroup, buttonOn[3]); - radioButtons[4] = new Checkbox("", zoomPGroup, buttonOn[4]); - - // create blank panel to 'adjust' radio buttons in from right - JPanel rightBorder = new JPanel(); - zoomDialog.add("West", rightBorder); - - // create the radio button panel and add the buttons - JPanel radioPanel = new JPanel(); - radioPanel.setLayout(new GridLayout(4,1)); - radioPanel.add(radioButtons[0]); - radioPanel.add(radioButtons[1]); - radioPanel.add(radioButtons[2]); - radioPanel.add(radioButtons[3]); - zoomDialog.add("Center",radioPanel); - - // create zoom percentage panel - JPanel zoomPercPanel = new JPanel(); - zoomPercPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); - - // create zoom percentage input field - if (buttonOn[4]) - zoomPerc = new TextField((Integer.toString((int)zoomPercentage_)),4); //@A1C - else - zoomPerc = new TextField("100",4); - zoomPerc.setEditable(true); - zoomPerc.setBackground(new Color(255,255,255)); // white - zoomPerc.addActionListener(this); - - // fill zoom percentage panel - JLabel percentage = new JLabel("%"); - zoomPercPanel.add(radioButtons[4]); - zoomPercPanel.add(zoomPerc); - zoomPercPanel.add(percentage); - - // create "OK" button - okButton = new JButton(okText_); - okButton.addActionListener(this); - okButton.setActionCommand("ok"); - - // create "Cancel" button - cancelButton = new JButton(cancelText_); - cancelButton.addActionListener(this); - cancelButton.setActionCommand("cancel"); - - // create button panel and add buttons - JPanel buttonPanel = new JPanel(); - buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); - buttonPanel.add(okButton); - buttonPanel.add(cancelButton); - - // add both panels to the zoomRightPanel - JPanel zoomRightPanel = new JPanel(); - zoomRightPanel.setLayout(new BorderLayout()); - zoomRightPanel.add("Center", zoomPercPanel); - zoomRightPanel.add("South", buttonPanel); - - zoomDialog.add("East",zoomRightPanel); - - // set up window listener for window closing event - addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent event) { - setVisible(false); - } - }); - - } - - - - /** - Performs the requested action - - @param e The ActionEvent - **/ - public void actionPerformed(ActionEvent e) - { - String command = e.getActionCommand(); - setVisible(false); - if (!(command.equals("cancel"))) { - if (radioButtons[0].getState()) { - zoomAmount = (float).50; // 50% - } - else if (radioButtons[1].getState()) { - zoomAmount = (float).75; // 75% - } - else if (radioButtons[2].getState()) { - zoomAmount = (float)1.25; // 125% - } - else if (radioButtons[3].getState()) { - zoomAmount = (float)1.50; // 150% - } - else if (radioButtons[4].getState()) { - float userValue = Float.valueOf(zoomPerc.getText()).floatValue(); - if (userValue >= 1.0) { - zoomAmount = (float)(userValue/100.0); - } - else { - errorEventSupport_.fireError(new IllegalArgumentException("userValue")); - zoomAmount = 0; - } - } - - // below added to simplify viewer maximum zoom exceeded - if (zoomAmount > 8) zoomAmount = (float)8.0; - - if (zoomAmount > 0) { - Dimension d1 = getPageImageSize(); - Dimension d2 = new Dimension(); - d2.width = (int)((float)d1.width * zoomAmount); - d2.height = (int)((float)d1.height * zoomAmount); - pageView_.setViewSize(d2); - - // calculate the new viewing zoom percentage - zoomPercentage_ = zoomAmount * 100; // @A1A - // calculateZoom(); @A1D - - // update the viewer - updateViewer(); - } - } - } - - - - /** - Show the dialog in the middle of the parent frame. - **/ - public void setVisible(boolean b) - { - if (b == true) { - Rectangle bounds = getParent().getBounds(); - Rectangle bounds2 = getBounds(); - setLocation(bounds.x + (bounds.width - bounds2.width)/ 2, - bounds.y + (bounds.height - bounds2.height)/2); - super.setVisible(true); - } - else - super.setVisible(false); - } - - } - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/SpooledFileViewer16.gif b/cvsroot/src/com/ibm/as400/vaccess/SpooledFileViewer16.gif deleted file mode 100644 index ce71b41f7..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SpooledFileViewer16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SpooledFileViewer32.gif b/cvsroot/src/com/ibm/as400/vaccess/SpooledFileViewer32.gif deleted file mode 100644 index 85c15203d..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/SpooledFileViewer32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/SpooledFileViewerBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/SpooledFileViewerBeanInfo.java deleted file mode 100644 index cde80ffc2..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SpooledFileViewerBeanInfo.java +++ /dev/null @@ -1,244 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SpooledFileViewerBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The SpooledFileViewerBeanInfo class provides bean information -for the SpooledFileViewer class. - -@see SpooledFileViewer -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ - - -public class SpooledFileViewerBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = SpooledFileViewer.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", - ErrorListener.class, - "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", - PropertyChangeListener.class, - "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", - VetoableChangeListener.class, - "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", - WorkingListener.class, - workingMethods, - "addWorkingListener", - "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { error, propertyChange, vetoableChange, working }; - - - // Properties. - PropertyDescriptor currentPage = new PropertyDescriptor ("currentPage", - beanClass_, - "getCurrentPage", - "setCurrentPage"); - currentPage.setBound (true); - currentPage.setConstrained (true); - currentPage.setDisplayName (ResourceLoader.getPrintText ("PROP_NAME_CURRENT_PAGE")); - currentPage.setShortDescription (ResourceLoader.getPrintText ("PROP_DESC_CURRENT_PAGE")); - - PropertyDescriptor numberOfPages = new PropertyDescriptor ("numberOfPages", - beanClass_, - "getNumberOfPages", - null); - numberOfPages.setBound (true); - numberOfPages.setConstrained (true); - numberOfPages.setDisplayName (ResourceLoader.getPrintText ("PROP_NAME_NUMBER_OF_PAGES")); - numberOfPages.setShortDescription (ResourceLoader.getPrintText ("PROP_DESC_NUMBER_OF_PAGES")); - - PropertyDescriptor numberOfPagesEstimated = new PropertyDescriptor ("numberOfPagesEstimated", - beanClass_, - "isNumberOfPagesEstimated", - null); - numberOfPagesEstimated.setBound (true); - numberOfPagesEstimated.setConstrained (true); - numberOfPagesEstimated.setDisplayName (ResourceLoader.getPrintText ("PROP_NAME_NUMBER_OF_PAGES_ESTIMATED")); - numberOfPagesEstimated.setShortDescription (ResourceLoader.getPrintText ("PROP_DESC_NUMBER_OF_PAGES_ESTIMATED")); - - PropertyDescriptor paperSize = new PropertyDescriptor ("paperSize", - beanClass_, - "getPaperSize", - "setPaperSize"); - paperSize.setBound (true); - paperSize.setConstrained (true); - paperSize.setDisplayName (ResourceLoader.getPrintText ("PROP_NAME_PAPER_SIZE")); - paperSize.setShortDescription (ResourceLoader.getPrintText ("PROP_DESC_PAPER_SIZE")); - - PropertyDescriptor spooledFile = new PropertyDescriptor ("spooledFile", - beanClass_, - "getSpooledFile", - "setSpooledFile"); - spooledFile.setBound (true); - spooledFile.setConstrained (true); - spooledFile.setDisplayName (ResourceLoader.getPrintText ("PROP_NAME_SPLF")); - spooledFile.setShortDescription (ResourceLoader.getPrintText ("PROP_DESC_SPLF")); - - PropertyDescriptor viewingFidelity = new PropertyDescriptor ("viewingFidelity", - beanClass_, - "getViewingFidelity", - "setViewingFidelity"); - viewingFidelity.setBound (true); - viewingFidelity.setConstrained (true); - viewingFidelity.setDisplayName (ResourceLoader.getPrintText ("PROP_NAME_VIEWING_FIDELITY")); - viewingFidelity.setShortDescription (ResourceLoader.getPrintText ("PROP_DESC_VIEWING_FIDELITY")); - - properties_ = new PropertyDescriptor[] { currentPage, - numberOfPages, - numberOfPagesEstimated, - paperSize, - spooledFile, - viewingFidelity }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor() - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex() - { - return 0; // error. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex() - { - return 0; // currentPage. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon(int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("SpooledFileViewer16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("SpooledFileViewer32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/SystemPoolPropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/SystemPoolPropertiesPane.java deleted file mode 100644 index 914c489eb..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/SystemPoolPropertiesPane.java +++ /dev/null @@ -1,307 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: SystemPoolPropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - - -import com.ibm.as400.access.SystemPool; -import com.ibm.as400.access.Trace; - -import javax.swing.border.EmptyBorder; -import javax.swing.event.ChangeListener; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JScrollPane; -import javax.swing.JTabbedPane; -import javax.swing.SwingConstants; - -import java.awt.Component; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.awt.event.ItemListener; -import java.awt.event.ItemEvent; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.lang.Integer; -import java.text.DateFormat; -import java.util.Date; - -/** - * The SystemPoolPropertiesPane class represents the system pool properties pane. -**/ -class SystemPoolPropertiesPane implements VPropertiesPane -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // MRI start. - private static final String otherTabText_ = ResourceLoader.getText ("TAB_OTHER"); - private static final String generalTabText_ = ResourceLoader.getText ("TAB_GENERAL"); - - private static final String maximumActiveThreadsText_ = ResourceLoader.getText ("SYSTEM_POOL_MAXIMUM_ACTIVE_THREADS")+": "; - private static final String databaseFaultsText_ = ResourceLoader.getText ("SYSTEM_POOL_DATABASE_FAULTS")+": "; - private static final String databasePagesText_ = ResourceLoader.getText ("SYSTEM_POOL_DATABASE_PAGES")+": "; - private static final String nondatabaseFaultsText_ = ResourceLoader.getText ("SYSTEM_POOL_NONDATABASE_FAULTS")+": "; - private static final String nondatabasePagesText_ = ResourceLoader.getText ("SYSTEM_POOL_NONDATABASE_PAGES")+": "; - private static final String activeToWaitText_ = ResourceLoader.getText ("SYSTEM_POOL_ACTIVE_TO_WAIT")+": "; - private static final String waitToIneligibleText_ = ResourceLoader.getText ("SYSTEM_POOL_WAIT_TO_INELIGIBLE")+": "; - private static final String activeToIneligibleText_ = ResourceLoader.getText ("SYSTEM_POOL_ACTIVE_TO_INELIGIBLE")+": "; - private static final String poolNameText_ = ResourceLoader.getText ("SYSTEM_POOL_POOL_NAME")+": "; - private static final String subsystemNameText_ = ResourceLoader.getText ("SYSTEM_POOL_SUBSYSTEM_NAME")+": "; - private static final String subsystemLibraryNameText_ = ResourceLoader.getText ("SYSTEM_POOL_SUBSYSTEM__LIBRARY_NAME")+": "; - private static final String pagingOptionText_ = ResourceLoader.getText ("SYSTEM_POOL_PAGING_OPTION")+": "; - // MRI end - - // Private data. - private String[] names_; - private Object[] values_; - private VSystemPool object_; - private SystemPool systemPool_; - - // Event support. - private ChangeEventSupport changeEventSupport_ = new ChangeEventSupport (this); - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - /** - * Constructs an SystemPoolPropertiesPane object. - * - * @param object The object. - * @param SystemPool The SystemPool object. - **/ - public SystemPoolPropertiesPane (VSystemPool object, SystemPool systemPool) - { - object_ = object; - systemPool_ = systemPool; - } - - /** - * Adds a change listener. - * - * @param listener The listener. - **/ - public void addChangeListener (ChangeListener listener) - { - changeEventSupport_.addChangeListener (listener); - } - - /** - * Adds a listener to be notified when an error occurs. - * - * @param listener The listener. - **/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - /** - * Adds a listener to be notified when a VObject is changed, created, - * or deleted. - * - * @param listener The listener. - **/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - /** - * Adds a listener to be notified when work in a different thread - * starts and stops. - * - * @param listener The listener. - **/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - /** - * Applies the changes made by the SystemPool. - * - * @throws Exception If an error occurs. - **/ - public void applyChanges () - throws Exception - { - // No changes are allowed. - } - - /** - * Returns the general tab. - * - * @return The general tab. - **/ - private Component getGeneralTab() - { - // Initialize the general tab. - JPanel generalTab = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - generalTab.setLayout (layout); - generalTab.setBorder (new EmptyBorder (10, 10, 10, 10)); - - // Icon and name. - int row = 0; - - try //@B0A - { - VUtilities.constrain (poolNameText_, - (String)(systemPool_.getPoolName()), - generalTab, layout, row++); - - VUtilities.constrain (maximumActiveThreadsText_, - Integer.toString(systemPool_.getMaximumActiveThreads()), - generalTab, layout, row++); - - VUtilities.constrain (subsystemNameText_, - (String)(systemPool_.getSubsystemName()), - generalTab, layout, row++); - - VUtilities.constrain (pagingOptionText_, - (String)(systemPool_.getPagingOption()), - generalTab, layout, row++); - } - catch(Exception e) //@B0A - { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) //@B0A - { - Trace.log(Trace.ERROR, "Unable to properly create general tab for system pool properties pane.", e); //@B0A - } - errorEventSupport_.fireError(e); //@B0A - } - return generalTab; - } - - /** - * Returns the other tab. - * - * @return The other tab. - **/ - private Component getOtherTab() - { - // Initialize the other tab. - JPanel otherTab = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - otherTab.setLayout (layout); - otherTab.setBorder (new EmptyBorder (10, 10, 10, 10)); - - // Icon and name. - int row = 0; - - try //@B0A - { - VUtilities.constrain (databaseFaultsText_, - Float.toString(systemPool_.getDatabaseFaults()), - otherTab, layout, row++); - - VUtilities.constrain (databasePagesText_, - Float.toString(systemPool_.getDatabasePages()), - otherTab, layout, row++); - - VUtilities.constrain (nondatabaseFaultsText_, - Float.toString(systemPool_.getNonDatabaseFaults()), - otherTab, layout, row++); - - VUtilities.constrain (nondatabasePagesText_, - Float.toString(systemPool_.getNonDatabasePages()), - otherTab, layout, row++); - - VUtilities.constrain (activeToWaitText_, - Float.toString(systemPool_.getActiveToWait()), - otherTab, layout, row++); - - VUtilities.constrain (waitToIneligibleText_, - Float.toString(systemPool_.getWaitToIneligible()), - otherTab, layout, row++); - - VUtilities.constrain (activeToIneligibleText_, - Float.toString(systemPool_.getActiveToIneligible()), - otherTab, layout, row++); - } - catch(Exception e) //@B0A - { - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) //@B0A - { - Trace.log(Trace.ERROR, "Unable to properly create other tab for system pool properties pane.", e); //@B0A - } - errorEventSupport_.fireError(e); //@B0A - } - return otherTab; - } - - /** - * Returns the graphical component. - * - * @return The graphical component. - **/ - public Component getComponent () - { - JTabbedPane tabbedPane = new JTabbedPane (); - - tabbedPane.addTab (generalTabText_, null, getGeneralTab ()); - - tabbedPane.addTab(otherTabText_,null,getOtherTab()); - tabbedPane.setSelectedIndex (0); - - return tabbedPane; - } - - /** - * Removes a change listener. - * - * @param listener The listener. - **/ - public void removeChangeListener (ChangeListener listener) - { - changeEventSupport_.removeChangeListener (listener); - } - - /** - * Removes a listener to be notified when an error occurs. - * - * @param listener The listener. - **/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - /** - * Removes a listener to be notified when a VObject is changed, - * created, or deleted. - * - * @param listener The listener. - **/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - /** - * Removes a listener to be notified when work in a different thread - * starts and stops. - * - * @param listener The listener. - **/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/TableModelEventSupport.java b/cvsroot/src/com/ibm/as400/vaccess/TableModelEventSupport.java deleted file mode 100644 index cdae045a2..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/TableModelEventSupport.java +++ /dev/null @@ -1,166 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: TableModelEventSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.TableModel; -import java.util.Vector; - - - -/** -The TableModelEventSupport class represents a list of -TableModelListeners. This is also a TableModelListener and -will dispatch all table model events. -**/ -class TableModelEventSupport -implements TableModelListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private TableModel actualSource_ = null; - private transient TableModelListener[] listeners_ = new TableModelListener[0]; // For speed. - private transient Vector listenersV_ = new Vector (); - private Object source_; - - - -/** -Constructs a TableModelEventSupport object. - -@param source The source of the events. -@param actualSource The actual source of the events. This is - necessary because only table models - can be the event source. -**/ - public TableModelEventSupport (Object source, - TableModel actualSource) - { - source_ = source; - actualSource_ = actualSource; - } - - - -/** -Adds a listener. - -@param listener The listener. -**/ - public void addTableModelListener (TableModelListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - listenersV_.addElement (listener); - synchronized (listeners_) { - listeners_ = new TableModelListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - - - -// @C1A -/** -Fires a table changed event. -**/ - public void fireTableChanged() - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].tableChanged (new TableModelEvent (actualSource_)); - } - } - - - -/** -Fires a table changed event. - -@param rowIndex The row index. -**/ - public void fireTableChanged (int rowIndex) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].tableChanged (new TableModelEvent (actualSource_, rowIndex)); - } - } - - - -/** -Fires a table changed event. - -@param firstRowIndex The first row index. -@param lastRowIndex The last row index. -@param columnIndex The column index. -@param type The type. -**/ - public void fireTableChanged (int firstRowIndex, - int lastRowIndex, - int columnIndex, - int type) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].tableChanged (new TableModelEvent (actualSource_, - firstRowIndex, lastRowIndex, columnIndex, type)); - } - } - - - -/** -Removes a listener. - -@param listener The listener. -**/ - public void removeTableModelListener (TableModelListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - if (listenersV_.removeElement (listener)) { - synchronized (listeners_) { - listeners_ = new TableModelListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - } - - -/** -Processes a table changed event. - -@param event The event. -**/ - public void tableChanged (TableModelEvent event) - { - fireTableChanged (event.getFirstRow (), event.getLastRow (), - event.getColumn (), event.getType ()); - } - - - -} - - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/TreeModelEventSupport.java b/cvsroot/src/com/ibm/as400/vaccess/TreeModelEventSupport.java deleted file mode 100644 index 973c313e5..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/TreeModelEventSupport.java +++ /dev/null @@ -1,258 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: TreeModelEventSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.event.TreeModelEvent; -import javax.swing.event.TreeModelListener; -import javax.swing.tree.TreePath; -import java.util.Vector; - - - -/** -The TreeModelEventSupport represents a list of TreeModelListeners. -This is also a TreeModelListener and will dispatch all tree model -events that it receives. -**/ -class TreeModelEventSupport -implements TreeModelListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private transient TreeModelListener[] listeners_ = new TreeModelListener[0]; // For speed. - private transient Vector listenersV_ = new Vector (); - private Object source_; - - - -/** -Constructs a TreeModelEventSupport object. - -@param source The source of the events. -**/ - public TreeModelEventSupport (Object source) - { - source_ = source; - } - - - -/** -Adds a listener. - -@param listener The listener. -**/ - public void addTreeModelListener (TreeModelListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - listenersV_.addElement (listener); - synchronized (listeners_) { - listeners_ = new TreeModelListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - - - -/** -Fires a tree nodes changed event. - -@param path The path. -@param childIndices The child indices. -@param children The children. -**/ - public void fireTreeNodesChanged (TreePath path, int[] childIndices, Object[] children) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].treeNodesChanged (new TreeModelEvent (source_, path, childIndices, children)); - } - } - - - -/** -Fires a tree nodes changed event. - -@param path The path. -@param childIndices The child index. -@param children The child. -**/ - public void fireTreeNodesChanged (TreePath path, int childIndex, Object child) - { - int[] childIndices = { childIndex }; - Object[] children = { child }; - fireTreeNodesChanged (path, childIndices, children); - } - - - -/** -Fires a tree nodes inserted event. - -@param path The path. -@param childIndices The child indices. -@param children The children. -**/ - public void fireTreeNodesInserted (TreePath path, int[] childIndices, Object[] children) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].treeNodesInserted (new TreeModelEvent (source_, path, childIndices, children)); - } - } - - - -/** -Fires a tree nodes inserted event. - -@param path The path. -@param childIndices The child index. -@param children The child. -**/ - public void fireTreeNodesInserted (TreePath path, int childIndex, Object child) - { - int[] childIndices = { childIndex }; - Object[] children = { child }; - fireTreeNodesInserted (path, childIndices, children); - } - - - -/** -Fires a tree nodes removed event. - -@param path The path. -@param childIndices The child indices. -@param children The children. -**/ - public void fireTreeNodesRemoved (TreePath path, int[] childIndices, Object[] children) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].treeNodesRemoved (new TreeModelEvent (source_, path, childIndices, children)); - } - } - - - -/** -Fires a tree nodes removed event. - -@param path The path. -@param childIndices The child index. -@param children The child. -**/ - public void fireTreeNodesRemoved (TreePath path, int childIndex, Object child) - { - int[] childIndices = { childIndex }; - Object[] children = { child }; - fireTreeNodesRemoved (path, childIndices, children); - } - - - -/** -Fires a tree structure changed event. - -@param path The path. -**/ - public void fireTreeStructureChanged (TreePath path) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].treeStructureChanged (new TreeModelEvent (source_, path)); - } - } - - - -/** -Removes a listener. - -@param listener The listener. -**/ - public void removeTreeModelListener (TreeModelListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - if (listenersV_.removeElement (listener)) { - synchronized (listeners_) { - listeners_ = new TreeModelListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - } - - - -/** -Processes a tree nodes changed event. - -@param event The event. -**/ - public void treeNodesChanged (TreeModelEvent event) - { - fireTreeNodesChanged (event.getTreePath (), event.getChildIndices (), event.getChildren()); - } - - - -/** -Processes a tree nodes inserted event. - -@param event The event. -**/ - public void treeNodesInserted (TreeModelEvent event) - { - fireTreeNodesInserted (event.getTreePath (), event.getChildIndices (), event.getChildren()); - } - - - -/** -Processes a tree nodes removed event. - -@param event The event. -**/ - public void treeNodesRemoved (TreeModelEvent event) - { - fireTreeNodesRemoved (event.getTreePath (), event.getChildIndices (), event.getChildren()); - } - - - -/** -Processes a tree structure changed event. - -@param event The event. -**/ - public void treeStructureChanged (TreeModelEvent event) - { - fireTreeStructureChanged (event.getTreePath ()); - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/TreeSelectionEventSupport.java b/cvsroot/src/com/ibm/as400/vaccess/TreeSelectionEventSupport.java deleted file mode 100644 index 7e5ab2346..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/TreeSelectionEventSupport.java +++ /dev/null @@ -1,123 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: TreeSelectionEventSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.TreePath; -import java.util.Vector; - - - -/** -The TreeSelectionEventSupport class represents a list of -TreeSelectionListeners. This is also a TreeSelectionListener -and will dispatch all tree selection events that it receives. -**/ -class TreeSelectionEventSupport -implements TreeSelectionListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private transient TreeSelectionListener[] listeners_ = new TreeSelectionListener[0]; // For speed. - private transient Vector listenersV_ = new Vector (); - private Object source_; - - - -/** -Constructs a TreeSelectionEventSupport object. - -@param source The source of the events. -**/ - public TreeSelectionEventSupport (Object source) - { - source_ = source; - } - - - -/** -Adds a listener. - -@param listener The listener. -**/ - public void addTreeSelectionListener (TreeSelectionListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - listenersV_.addElement (listener); - synchronized (listeners_) { - listeners_ = new TreeSelectionListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - - - -/** -Fires a value changed event. - -@param event The event. -**/ - public void fireValueChanged (TreeSelectionEvent event) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].valueChanged ((TreeSelectionEvent) event.cloneWithSource (source_)); - } - } - - - -/** -Removes a listener. - -@param listener The listener. -**/ - public void removeTreeSelectionListener (TreeSelectionListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - if (listenersV_.removeElement (listener)) { - synchronized (listeners_) { - listeners_ = new TreeSelectionListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - } - - - -/** -Processes a value changed event. - -@param event The event. -**/ - public void valueChanged (TreeSelectionEvent event) - { - fireValueChanged (event); - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/UndoableEditEventSupport.java b/cvsroot/src/com/ibm/as400/vaccess/UndoableEditEventSupport.java deleted file mode 100644 index 4ebdd396f..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/UndoableEditEventSupport.java +++ /dev/null @@ -1,122 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UndoableEditEventSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.event.UndoableEditEvent; -import javax.swing.event.UndoableEditListener; -import java.util.Vector; - - - -/** -The UndoableEditEventSupport class represents a list of -UndoableEditListeners. This is also a UndoableEditListener -and will dispatch all undoable edit events. -**/ -class UndoableEditEventSupport -implements UndoableEditListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private transient UndoableEditListener[] listeners_ = new UndoableEditListener[0]; // For speed. - private transient Vector listenersV_ = new Vector (); - private Object source_; - - - -/** -Constructs a UndoableEditEventSupport object. - -@param source The source of the events. -**/ - public UndoableEditEventSupport (Object source) - { - source_ = source; - } - - - -/** -Adds a listener. - -@param listener The listener. -**/ - public void addUndoableEditListener (UndoableEditListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - listenersV_.addElement (listener); - synchronized (listeners_) { - listeners_ = new UndoableEditListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - - - -/** -Fires an undoable edit happened event. - -@param event The event. -**/ - public void fireUndoableEditHappened (UndoableEditEvent event) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].undoableEditHappened (event); - } - } - - - -/** -Removes a listener. - -@param listener The listener. -**/ - public void removeUndoableEditListener (UndoableEditListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - if (listenersV_.removeElement (listener)) { - synchronized (listeners_) { - listeners_ = new UndoableEditListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - } - - -/** -Processes an undoable edit happened event. - -@param event The event. -**/ - public void undoableEditHappened (UndoableEditEvent event) - { - fireUndoableEditHappened (event); - } - - - -} - - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/UserListPropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/UserListPropertiesPane.java deleted file mode 100644 index ad968f721..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/UserListPropertiesPane.java +++ /dev/null @@ -1,277 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserListPropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.UserList; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; - - - -/** -The UserListPropertiesPane class represents the properties pane -for a user list. -**/ -class UserListPropertiesPane -implements VPropertiesPane -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String generalTabText_ = ResourceLoader.getText ("TAB_GENERAL"); - private static final String groupInfoPrompt_ = ResourceLoader.getText ("USER_LIST_GROUPINFO_PROMPT") + ": "; - private static final String userInfoPrompt_ = ResourceLoader.getText ("USER_LIST_USERINFO_PROMPT") + ": "; - - - - // Private data. - private VUserList object_; - private JComboBox groupInfo_; - private JComboBox userInfo_; - - - - // Event support. - ChangeEventSupport changeEventSupport_ = new ChangeEventSupport (this); // Private. - ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); // Private. - VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); // Private. - WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); // Private. - - - -/** -Constructs a UserListPropertyPane object. - -@param object The object. -**/ - public UserListPropertiesPane (VUserList object, UserList list) //@A1C - { - object_ = object; - } - - - -/** -Adds a listener to be notified when the user makes a change. - -@param listener The listener. -**/ - public void addChangeListener (ChangeListener listener) - { - changeEventSupport_.addChangeListener (listener); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Applies the changes made by the user. - -@exception Exception If an error occurs. -**/ - public void applyChanges () - throws Exception - { - object_.setUserInfo (userInfo_.getSelectedItem ().toString ()); - object_.setGroupInfo (groupInfo_.getSelectedItem ().toString ()); - object_.load (); - } - - - -/** -Returns the graphical user interface component. - -@return The component. -**/ - public Component getComponent () - { - // Initialize the general tab. - JPanel generalTab = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - generalTab.setLayout (layout); - generalTab.setBorder (new EmptyBorder (10, 10, 10, 10)); - int row = 0; - - // Initialize a change listener. - ChangeListener changeListener = new ChangeListener () { - public void stateChanged (ChangeEvent event) { - changeEventSupport_.fireStateChanged (); - }}; - - // Initialize an item listener. - ItemListener itemListener = new ItemListener () { - public void itemStateChanged (ItemEvent event) { - changeEventSupport_.fireStateChanged (); - }}; - - // Initialize a key listener. - KeyListener keyListener = new KeyAdapter () { - public void keyTyped (KeyEvent event) { changeEventSupport_.fireStateChanged (); } - }; - - // User list information. - VUtilities.constrain (new JLabel (object_.getText (), object_.getIcon (32, false), SwingConstants.LEFT), - generalTab, layout, 0, row++, 2, 1); - - VUtilities.constrain (new JSeparator (), - generalTab, layout, 0, row++, 2, 1); - - // User info prompt. - VUtilities.constrain (new JLabel (userInfoPrompt_), - generalTab, layout, 0, row, 1, 1); - - userInfo_ = new JComboBox (); - userInfo_.setEditable (false); - userInfo_.addItem (UserList.ALL); - userInfo_.addItem (UserList.USER); - userInfo_.addItem (UserList.GROUP); - userInfo_.addItem (UserList.MEMBER); - userInfo_.setSelectedItem (object_.getUserInfo ()); - userInfo_.addItemListener (itemListener); - - VUtilities.constrain (userInfo_, - generalTab, layout, 1, row++, 1, 1); - - // Group info prompt. - VUtilities.constrain (new JLabel (groupInfoPrompt_), - generalTab, layout, 0, row, 1, 1); - - groupInfo_ = new JComboBox (); - groupInfo_.setEditable (true); - groupInfo_.addItem (UserList.NONE); - groupInfo_.addItem (UserList.NOGROUP); - groupInfo_.setSelectedItem (object_.getGroupInfo ()); - groupInfo_.addItemListener (itemListener); - groupInfo_.getEditor ().getEditorComponent ().addKeyListener (keyListener); // This does not really work! - - VUtilities.constrain (groupInfo_, - generalTab, layout, 1, row++, 1, 1); - - // Build the pane. - JTabbedPane pane = new JTabbedPane (); - pane.addTab (generalTabText_, null, generalTab); - pane.setSelectedIndex (0); - return pane; - } - - - -/** -Removes a change listener. - -@param listener The listener. -**/ - public void removeChangeListener (ChangeListener listener) - { - changeEventSupport_.removeChangeListener (listener); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/UserPropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/UserPropertiesPane.java deleted file mode 100644 index c99f894ac..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/UserPropertiesPane.java +++ /dev/null @@ -1,966 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: UserPropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.User; -// @A1A : Added group. -import com.ibm.as400.access.UserGroup; -import com.ibm.as400.access.Trace; -import java.util.Vector; -import java.util.Date; -import java.text.DateFormat; -import java.util.Enumeration; -import java.awt.Color; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.JScrollPane; -import javax.swing.JList; -import javax.swing.Icon; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JCheckBox; -import javax.swing.JRadioButton; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.SwingConstants; - - - -/** -The UserPropertiesPane class represents the properties pane -for a user. -**/ -class UserPropertiesPane -implements VPropertiesPane -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - // MRI. - private static final String descriptionText_ = ResourceLoader.getText ("USER_DESCRIPTION_PROMPT") + ": "; - - // @A1A - private static final String generalTabText_ = ResourceLoader.getText ("TAB_GENERAL"); - private static final String sessionStartupTabText_ = ResourceLoader.getText ("TAB_SESSION_STARTUP"); - private static final String displaySessionTabText_ = ResourceLoader.getText ("TAB_DISPLAY_SESSION"); - private static final String outputTabText_ = ResourceLoader.getText ("TAB_OUTPUT"); - private static final String internationalTabText_ = ResourceLoader.getText ("TAB_INTERNATIONAL"); - private static final String otherTabText_ = ResourceLoader.getText ("TAB_OTHER"); - private static final String securityTabText_ = ResourceLoader.getText ("TAB_SECURITY"); - private static final String groupInformationTabText_ = ResourceLoader.getText ("TAB_GROUP_INFORMATION"); - - private static final String groupProfileNameText_ = ResourceLoader.getText ("USER_GROUP_PROFILE_NAME")+" : "; - private static final String groupIDNumberText_ = ResourceLoader.getText ("USER_GROUP_ID_NUMBER")+" : "; - private static final String groupAuthorityText_ = ResourceLoader.getText ("USER_GROUP_AUTHORITY")+" : "; - private static final String groupAuthorityTypeText_ = ResourceLoader.getText ("USER_GROUP_AUTHORITY_TYPE")+" : "; - private static final String groupHasMemberText_ = ResourceLoader.getText ("USER_GROUP_HAS_MEMBER"); //@A2C - private static final String groupMembersText_ = ResourceLoader.getText ("USER_GROUPS_MEMBERS")+" : "; - - private static final String languageIDText_ = ResourceLoader.getText ("USER_LANGUAGE_ID")+" : "; - private static final String countryIDText_ = ResourceLoader.getText ("USER_COUNTRY_ID")+" : "; - private static final String codedCharacterSetIDText_ = ResourceLoader.getText ("USER_CODED_CHARACTER_SET_ID")+" : "; - private static final String localePathNameText_ = ResourceLoader.getText ("USER_LOCALE_PATH_NAME")+" : "; - private static final String localeJobAttributesText_ = ResourceLoader.getText ("USER_LOCALE_JOB_ATTRIBUTES")+" : "; - private static final String customText_ = ResourceLoader.getText ("USER_CUSTOM")+" : "; - - private static final String outputQueueText_ = ResourceLoader.getText ("USER_OUTPUT_QUEUE") + ": "; -//@A2D private static final String outputQueueLibText_ = ResourceLoader.getText ("USER_OUTPUT_QUEUE_LIB") + ": "; - private static final String messageQueueText_ = ResourceLoader.getText ("USER_MESSAGE_QUEUE") + ": "; -//@A2D private static final String messageQueueLibText_ = ResourceLoader.getText ("USER_MESSAGE_QUEUE_LIB") + ": "; - private static final String printDeviceText_ = ResourceLoader.getText ("USER_PRINT_DEVICE") + ": "; - private static final String messageDeliveryText_ = ResourceLoader.getText ("USER_MESSAGE_DELIVERY") + ": "; - private static final String messageSeverityLevelText_ = ResourceLoader.getText ("USER_MESSAGE_SEVERITY_LEVEL") + ": "; - private static final String ownerText_ = ResourceLoader.getText ("USER_OWNER") + ": "; - private static final String objectAuditingValueText_ = ResourceLoader.getText ("USER_OBJECT_AUDITING_VALUE") + ": "; - - private static final String userActionAuditLevelText_ = ResourceLoader.getText ("USER_ACTION_AUDIT_LEVEL") + ": "; - private static final String specialAuthorityText_ = ResourceLoader.getText ("USER_SPECIAL_AUTHORITY") + ": "; - private static final String sortSequeneceTableText_ = ResourceLoader.getText ("USER_SORT_SEQUENCE_TABLE") + ": "; - -//@A2D private static final String sortSequeneceTableLibText_ = ResourceLoader.getText ("USER_SORT_SEQUENCE_TABLE_LIB") + ": "; - private static final String storageUsedText_ = ResourceLoader.getText ("USER_STORAGE_USED") + ": "; - private static final String supplementalGroupsNumberText_ = ResourceLoader.getText ("USER_SUPPLEMENTAL_GROUPS_NUMBER") + ": "; - private static final String supplementalGroupsText_ = ResourceLoader.getText ("USER_SUPPLEMENTAL_GROUPS") + ": "; - private static final String specialEnvironmentText_ = ResourceLoader.getText ("USER_SPECIAL_ENVIRONMENT") + ": "; - - private static final String daysUntilPasswordExpireText_ = ResourceLoader.getText ("USER_DAYS_UNTIL_PASSWORD_EXPIRE")+" : "; - private static final String isNoPasswordText_ = ResourceLoader.getText ("USER_IS_NO_PASSWORD")+" : "; - private static final String isPasswordSetExpireText_ = ResourceLoader.getText ("USER_IS_PASSWORD_SET_EXPIRE")+" : "; - private static final String isWithDigitalCertificatesText_ = ResourceLoader.getText ("USER_IS_WITH_DIGITAL_CERTIFICATES")+" : "; - private static final String passwordExpireDateText_ = ResourceLoader.getText ("USER_PASSWORD_EXPIRE_DATE")+" : "; - private static final String passwordExpirationIntervalText_ = ResourceLoader.getText ("USER_PASSWORD_EXPIRATION_INTERVAL")+" : "; - private static final String passwordLastChangedDateText_ = ResourceLoader.getText ("USER_PASSWORD_LAST_CHANGED_DATE")+" : "; - private static final String previousSignedOnDateText_ = ResourceLoader.getText ("USER_PREVIOUS_SIGNED_ON_DATE")+" : "; - private static final String signedOnAttemptsNotValidText_ = ResourceLoader.getText ("USER_SIGNED_ON_ATTEMPTS_NOT_VALID")+" : "; - - private static final String assistanceLevelText_ = ResourceLoader.getText ("USER_ASSISTANCE_LEVEL")+" : "; -//@A2D private static final String attentionProgramLibText_ = ResourceLoader.getText ("USER_ATTENTION_PROGRAM_LIB")+" : "; - private static final String attentionProgramNameText_ = ResourceLoader.getText ("USER_ATTENTION_PROGRAM_NAME")+" : "; - private static final String limitCapabilitiesText_ = ResourceLoader.getText ("USER_LIMIT_CAPABILITIES")+" : "; - - private static final String initialProgramText_ = ResourceLoader.getText ("USER_INITIAL_PROGRAM")+" : "; -//@A2D private static final String initialProgramLibText_ = ResourceLoader.getText ("USER_INITIAL_PROGRAM_LIB")+" : "; - private static final String initialMenuText_ = ResourceLoader.getText ("USER_INITIAL_MENU")+" : "; -//@A2D private static final String initialMenuLibText_ = ResourceLoader.getText ("USER_INITIAL_MENU_LIB")+" : "; - private static final String displaySignOnInformationText_ = ResourceLoader.getText ("USER_DISPLAY_SIGNON_INFORMATION")+" : "; - private static final String limitDeviceSessionsText_ = ResourceLoader.getText ("USER_LIMIT_DEVICE_SESSIONS")+" : "; - - private static final String accountingCodeText_ = ResourceLoader.getText ("USER_ACCOUNTING_CODE")+" : "; - private static final String currentLibText_ = ResourceLoader.getText ("USER_CURRENT_LIB")+" : "; - - private static final String highestSchedulePriorityText_ = ResourceLoader.getText ("USER_HIGHEST_SCHEDULE_PRIORITY")+" : "; - private static final String homeDirectoryText_ = ResourceLoader.getText ("USER_HOME_DIRECTORY")+" : "; - private static final String jobDescriptionNameText_ = ResourceLoader.getText ("USER_JOB_DESCRIPTION_NAME")+" : "; -//@A2D private static final String jobDescriptionLibText_ = ResourceLoader.getText ("USER_JOB_DESCRIPTION_LIB")+" : "; - private static final String maximumAllowedStorageText_ = ResourceLoader.getText ("USER_MAXIMUM_ALLOWED_STORAGE")+" : "; - private static final String statusText_ = ResourceLoader.getText ("USER_STATUS")+" : "; - private static final String userClassNameText_ = ResourceLoader.getText ("USER_CLASS_NAME")+" : "; - private static final String userIDNumberText_ = ResourceLoader.getText ("USER_ID_NUMBER")+" : "; - private static final String userProfileNameText_ = ResourceLoader.getText ("USER_PROFILE_NAME")+" : "; - - // Static data. -//@D2D private static SimpleDateFormat dateFormat_ = new SimpleDateFormat(ResourceLoader.getText("DATE_FORMAT")); -//@D2D private static SimpleDateFormat timeFormat_ = new SimpleDateFormat(ResourceLoader.getText("TIME_FORMAT")); - private static final DateFormat dateFormat_ = DateFormat.getDateInstance(); //@D2A - private static final DateFormat timeFormat_ = DateFormat.getTimeInstance(); //@D2A - - private static final String trueText_ = ResourceLoader.getText ("DLG_TRUE"); //@D1A - private static final String falseText_ = ResourceLoader.getText ("DLG_FALSE"); //@D1A - - //MRI end - // @A1A end - - - // Private data. - private VUser object_; - private User user_; - - // Event support. - private ChangeEventSupport changeEventSupport_ = new ChangeEventSupport (this); - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - /** - Constructs an UserPropertiesPane object. - - @param object The object. - @param user The user. - **/ - public UserPropertiesPane (VUser object, User user) - { - object_ = object; - user_ = user; - - } - - /** - Adds a change listener. - - @param listener The listener. - **/ - public void addChangeListener (ChangeListener listener) - { - changeEventSupport_.addChangeListener (listener); - } - - /** - Adds a listener to be notified when an error occurs. - - @param listener The listener. - **/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - /** - Adds a listener to be notified when a VObject is changed, - created, or deleted. - - @param listener The listener. - **/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - /** - Adds a listener to be notified when work in a different thread - starts and stops. - - @param listener The listener. - **/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - /** - Applies the changes made by the user. - - @throws Exception If an error occurs. - **/ - public void applyChanges () - throws Exception - { - // No changes are allowed. - } - - /** - Returns the graphical component. - - @return The graphical component. - **/ - public Component getComponent () - { - // @A1C : Uses JTabbedPane instead JPanel - JTabbedPane tabbedPane = new JTabbedPane (); - - // @A1A : Adds tabs. - tabbedPane.addTab (generalTabText_, null, getGeneralTab ()); - - tabbedPane.addTab (sessionStartupTabText_, null, getSessionStartupTab ()); - - tabbedPane.addTab (displaySessionTabText_, null, getDisplaySessionTab ()); - - tabbedPane.addTab (outputTabText_, null, getOutputTab ()); - - tabbedPane.addTab (internationalTabText_, null, getInternationalTab ()); - - tabbedPane.addTab (securityTabText_, null, getSecurityTab ()); - - tabbedPane.addTab (groupInformationTabText_, null, getGroupInformationTab ()); - - tabbedPane.addTab (otherTabText_, null, getOtherTab ()); - - tabbedPane.setSelectedIndex (0); - - return tabbedPane; - } - - // @A1A - /** - *Returns the display session tab component. - * - *@return The component for the display session tab. - **/ - private Component getDisplaySessionTab() - { - // Initialize the display session tab. - JPanel panel = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - panel.setLayout (layout); - panel.setBorder (new EmptyBorder (10, 10, 10, 10)); - - int row = 0; - - String fullPathName = user_.getAttentionKeyHandlingProgram(); - - VUtilities.constrain (attentionProgramNameText_, - fullPathName, - panel, layout, row++); - - - VUtilities.constrain (limitCapabilitiesText_, - user_.getLimitCapabilities(), - panel, layout, row++); - - VUtilities.constrain (assistanceLevelText_, - user_.getAssistanceLevel(), - panel, layout, row++); - - return panel; - } - - // @A1A - /** - * Returns the general tab component. - * - * @return The component for the general tab. - **/ - private Component getGeneralTab() - { - - String fullPathName; - - // Initialize the general tab. - JPanel panel= new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - panel.setLayout (layout); - panel.setBorder (new EmptyBorder (10, 10, 10, 10)); - - // Icon and name. - int row = 0; - VUtilities.constrain ( - new JLabel (userProfileNameText_,object_.getIcon (32, false), SwingConstants.LEFT), - new JLabel (object_.getText ()), - panel, layout, row++); - - - VUtilities.constrain (descriptionText_, - user_.getDescription(), - panel, layout, row++); - - VUtilities.constrain (userClassNameText_, - user_.getUserClassName(), - panel, layout, row++); - - VUtilities.constrain (userIDNumberText_, - Integer.toString(user_.getUserIDNumber()), - panel, layout, row++); - - VUtilities.constrain (statusText_, - user_.getStatus(), - panel, layout, row++); - - VUtilities.constrain (currentLibText_, - user_.getCurrentLibraryName(), - panel, layout, row++); - String str; - int maxStorageUsed=user_.getMaximumStorageAllowed(); - if(maxStorageUsed==-1) - str="*NOMAX"; - else - str=Integer.toString(maxStorageUsed); - VUtilities.constrain (maximumAllowedStorageText_, - str, - panel, layout, row++); - - // @A3A - moved from other tab - // Storage used - VUtilities.constrain (storageUsedText_, // @A3A - Integer.toString(user_.getStorageUsed()), // @A3A - panel, layout, row++); // @A3A - - VUtilities.constrain (highestSchedulePriorityText_, - Integer.toString(user_.getHighestSchedulingPriority()), - panel, layout, row++); - - VUtilities.constrain (accountingCodeText_, - user_.getAccountingCode(), - panel, layout, row++); - - fullPathName = user_.getJobDescription(); - - VUtilities.constrain (jobDescriptionNameText_, - fullPathName, - panel, layout, row++); - - - - VUtilities.constrain (homeDirectoryText_, - user_.getHomeDirectory(), - panel, layout, row++); - - return panel; - } - - // @A1A - /** - * Returns the group information tab component. - * - * @return The component for the group information tab. - **/ - private Component getGroupInformationTab() - { - // Initialize the group information tab. - JPanel panel = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - panel.setLayout (layout); - panel.setBorder (new EmptyBorder (10, 10, 10, 10)); - - int row = 0; - - VUtilities.constrain (groupProfileNameText_, - user_.getGroupProfileName(), - panel, layout, row++); - - String grpstr = ""; //@A2A - int grp = user_.getGroupIDNumber(); //@A2A - if (grp == 0) //@A2A - grpstr = "*NONE"; //@A2A - else //@A2A - grpstr = ""+grp; //@A2A - VUtilities.constrain (groupIDNumberText_, grpstr, //@A2C - panel, layout, row++); - - VUtilities.constrain (groupAuthorityText_, - user_.getGroupAuthority(), - panel, layout, row++); - - VUtilities.constrain (groupAuthorityTypeText_, - user_.getGroupAuthorityType(), - panel, layout, row++); - -//@A2D JCheckBox checkBox=new JCheckBox(groupHasMemberText_, user_.isGroupHasMember()); -//@A2D checkBox.setEnabled(false); -//@A2D VUtilities.constrain (checkBox, -//@A2D panel, layout, row++); - - String value = falseText_; //@D1A - if (user_.isGroupHasMember()) //@D1A - value = trueText_; //@D1A - - VUtilities.constrain (groupHasMemberText_, //@A2A - value, //@A2A @D1C - panel, layout, row++); //@A2A - - if(user_.isGroupHasMember()) - { - Enumeration users; - Vector userList = new Vector(); - try - { - UserGroup userGroup = new UserGroup(user_.getSystem(), user_.getName()); // @E1A - for (users = userGroup.getMembers();users.hasMoreElements();) // @E1C - { - String userName=((User)users.nextElement()).getUserProfileName(); - userList.addElement(userName); - } - } catch (Exception err) - { - Trace.log(Trace.ERROR,"error when retrieve members : "+err); - errorEventSupport_.fireError(err); - } - - JList list = new JList(userList); - list.setBackground(Color.lightGray); - VUtilities.constrain ( - new JLabel(groupMembersText_), - list, - panel, layout, row++); - } - - return panel; - } - - // @A1A - /** - * Returns the international tab component. - * - * @return The component for the international tab. - **/ - private Component getInternationalTab() - { - // Initialize the international tab. - JPanel panel = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - panel.setLayout (layout); - panel.setBorder (new EmptyBorder (10, 10, 10, 10)); - - int row = 0; - - VUtilities.constrain (languageIDText_, - user_.getLanguageID(), - panel, layout, row++); - - VUtilities.constrain (countryIDText_, - user_.getCountryID(), - panel, layout, row++); - - int id=user_.getCCSID(); - String idStr; - if(id==-2) - idStr="QCCSID"; - else - idStr=Integer.toString(id); - - VUtilities.constrain (codedCharacterSetIDText_, - idStr, - panel, layout, row++); - - VUtilities.constrain (localePathNameText_, - user_.getLocalePathName(), - panel, layout, row++); - - //Local job attributes. - VUtilities.constrain (new JLabel(localeJobAttributesText_), - panel, layout, row++); - String[] localJobAttributes = user_.getLocaleJobAttributes(); // @A3C - - JRadioButton[] radioButton=new JRadioButton[3]; - JCheckBox[] checkBox = new JCheckBox[6]; - boolean[] radio = {false,false,false}; - boolean[] check = {false,false,false,false,false,false}; - - if (searchArray (localJobAttributes, "*NONE")) // @A3C - { - radio[0] = true; - } else if (searchArray (localJobAttributes, "*SYSVAL")) // @A3C - { - radio[1] = true; - } else - { - radio[2] = true; - } - - String[] localJobAttributesStr={"*NONE","*SYSVAL","CUSTOM","*CCSID", "*DATFMT","*DATSEP", - "*DECFMT","*SRTSEQ","*TIMSEP"}; // @A3C - for(int i=0;i<6;i++) - { - if (searchArray (localJobAttributes, localJobAttributesStr[i+3])) // @A3C - check[i]=true; - } - for(int i=0;i<3;i++) - { - radioButton[i]=new JRadioButton(localJobAttributesStr[i],radio[i]); - radioButton[i].setEnabled(false); - } - - // @A3C - Removed the "custom" bullet and header to match the green screen. - for(int i=0;i<2;i++) // @A3C - VUtilities.constrain ( - radioButton[i], - panel, layout, 1, row++, 1, 1); - for(int i=0;i<6;i++) - { - checkBox[i]=new JCheckBox(localJobAttributesStr[i+3],check[i]); - checkBox[i].setEnabled(false); - } - - // @A3D VUtilities.constrain (new JLabel(customText_), - // @A3D panel, layout, 0, row++, 1, 1); - - for(int i=0;i<2;i++) - { - for(int j=0;j<3;j++) - { - VUtilities.constrain (checkBox[i*3+j], - panel, layout, j+1, row, 1, 1); - } - row++; - } - - return panel; - } - - // @A1A - /** - * Returns the other tab component. - * - * @return The component for the other tab. - **/ - private Component getOtherTab() - { - // Initializes the other tab. - JPanel otherTab = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - otherTab.setLayout (layout); - otherTab.setBorder (new EmptyBorder (10, 10, 10, 10)); - - int row = 0; - - // Object owner - VUtilities.constrain (ownerText_, - user_.getOwner(), - otherTab, layout, row++); - // Object auditing value - VUtilities.constrain (objectAuditingValueText_, - user_.getObjectAuditingValue(), - otherTab, layout, row++); - // @A3D - moved to general tab - // @A3D // Storage used - // @A3D VUtilities.constrain (storageUsedText_, - // @A3D Integer.toString(user_.getStorageUsed()), - // @A3D otherTab, layout, row++); - // Special environment - VUtilities.constrain (specialEnvironmentText_, - user_.getSpecialEnvironment(), - otherTab, layout, row++); - // Sort sequence table - String str=user_.getSortSequenceTable(); - - VUtilities.constrain (sortSequeneceTableText_, - str, - otherTab, layout, row++); - - - //Supplement groups number - int number=user_.getSupplementalGroupsNumber(); - String suplgrp = ""; //@A2A - if (number == 0) //@A2A - suplgrp = "*NONE"; //@A2A - else //@A2A - suplgrp = ""+number; //@A2A - VUtilities.constrain (supplementalGroupsNumberText_, suplgrp, //@A2C - otherTab, layout, row++); - - //Supplement groups - if(number>0) - { - String[] libl = user_.getSupplementalGroups(); - JList list = new JList(libl); - JScrollPane scroll = new JScrollPane(list); - int height = Math.max(1,libl.length); - scroll.setSize(120,20*height); - VUtilities.constrain ( - new JLabel(supplementalGroupsText_), - list, - otherTab, layout, row++); - } - - //User action audit level - String[] levelStr=user_.getUserActionAuditLevel(); // @A3C - - JCheckBox[] levelCheckBox=new JCheckBox[13]; - boolean[] b=new boolean[13]; - for(int i=0;i<13;i++) - b[i]=false; - String[] checkStr={"*CMD","*CREATE","*DELETE","*JOBDTA","*OBJMGT", - "*OFCSRV","*OPTICAL","*PGMADP","*SAVRST","*SECURITY", - "*SERVICE","*SPLFDTA","*SYSMGT"}; - for(int i=0;i<13;i++) - { - if(searchArray (levelStr, checkStr[i])) // @A3C - b[i]=true; - } - for(int i=0;i<13;i++) - { - levelCheckBox[i]=new JCheckBox(checkStr[i],b[i]); - levelCheckBox[i].setEnabled(false); - } - - - VUtilities.constrain (new JLabel(userActionAuditLevelText_), - otherTab, layout, 0, row++, 1, 1); - - for(int i=0;i<4;i++) - { - for(int j=0;j<3;j++) - { - VUtilities.constrain (levelCheckBox[i*3+j], - otherTab, layout, j+1, row, 1, 1); - } - row++; - } - - VUtilities.constrain (levelCheckBox[12], - otherTab, layout,1, row++,1,1); - - // Special authorities - String[] autStr=user_.getSpecialAuthority(); // @A3C - - JCheckBox[] autCheckBox=new JCheckBox[8]; - - for(int i=0;i<8;i++) - b[i]=false; - String[] autCheckStr={"*ALLOBJ","*AUDIT","*IOSYSCFG","*JOBCTL", // @A3C - "*SAVSYS","*SECADM","*SERVICE","*SPLCTL" }; // @A3C - for(int i=0;i<8;i++) - { - if(searchArray (autStr, autCheckStr[i])) // @A3C - b[i]=true; - } - for(int i=0;i<8;i++) - { - autCheckBox[i]=new JCheckBox(autCheckStr[i],b[i]); - autCheckBox[i].setEnabled(false); - } - - VUtilities.constrain (new JLabel(specialAuthorityText_), - otherTab, layout, 0, row++, 1, 1); - - for(int i=0;i<2;i++) - { - for(int j=0;j<3;j++) - { - VUtilities.constrain (autCheckBox[i*3+j], - otherTab, layout, j+1, row, 1, 1); - } - row++; - } - - VUtilities.constrain (autCheckBox[6], - otherTab, layout,1,row,1,1); - VUtilities.constrain (autCheckBox[7], - otherTab, layout,2,row++,1,1); - return otherTab; - } - - // @A1A - /** - * Returns the output tab component. - * - * @return The component for the output tab. - **/ - private Component getOutputTab () - { - // Initializes the active tab. - JPanel outputTab = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - outputTab.setLayout (layout); - outputTab.setBorder (new EmptyBorder (10, 10, 10, 10)); - - int row = 0; - - String fullPathName; - - - // Print device name - VUtilities.constrain (printDeviceText_, - user_.getPrintDevice(), - outputTab, layout, row++); - - // Output queue ane output queue priority - fullPathName = user_.getOutputQueue(); - - VUtilities.constrain (outputQueueText_, - fullPathName, - outputTab, layout, row++); - - - - fullPathName=user_.getMessageQueue(); - - VUtilities.constrain (messageQueueText_, - fullPathName, - outputTab, layout, row++); - - - - VUtilities.constrain (messageDeliveryText_, - user_.getMessageQueueDeliveryMethod(), - outputTab, layout, row++); - - VUtilities.constrain (messageSeverityLevelText_, - Integer.toString(user_.getMessageQueueSeverity()), - outputTab, layout, row++); - - - return outputTab; - } - - // @A1A - /** - *Returns the security tab component. - * - *@return The component for the security tab. - **/ - private Component getSecurityTab() - { - // Initialize the security tab. - JPanel panel = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - panel.setLayout (layout); - panel.setBorder (new EmptyBorder (10, 10, 10, 10)); - - int row = 0; - - String pwdexpitv = ""; //@A2A - int days = user_.getPasswordExpirationInterval(); //@A2A - if (days == 0) //@A2A - pwdexpitv = "*SYSVAL"; //@A2A - else if (days == -1) //@A2A - pwdexpitv = "*NOMAX"; //@A2A - else //@A2A - pwdexpitv = ""+days; //@A2A - VUtilities.constrain (passwordExpirationIntervalText_, pwdexpitv, //@A2C - panel, layout, row++); - - Date date = user_.getPasswordExpireDate(); - String dateTimeString = "NONE"; - if (date!=null) - { - dateTimeString = dateFormat_.format(date)+" "+timeFormat_.format(date); - - } - VUtilities.constrain (passwordExpireDateText_, - dateTimeString, - panel, layout, row++); - - VUtilities.constrain (daysUntilPasswordExpireText_, - Integer.toString(user_.getDaysUntilPasswordExpire()), - panel, layout, row++); - - date = user_.getPasswordLastChangedDate(); - if (date!=null) - { - dateTimeString = dateFormat_.format(date)+" "+timeFormat_.format(date); - } - else - { - dateTimeString = "NONE"; - } - VUtilities.constrain (passwordLastChangedDateText_, - dateTimeString, - panel, layout, row++); - - date = user_.getPreviousSignedOnDate(); - if (date!=null) - { - dateTimeString = dateFormat_.format(date)+" "+timeFormat_.format(date); - } - else - { - dateTimeString = "NONE"; - } - VUtilities.constrain (previousSignedOnDateText_, - dateTimeString, - panel, layout, row++); - - VUtilities.constrain (signedOnAttemptsNotValidText_, - Integer.toString(user_.getSignedOnAttemptsNotValid()), - panel, layout, row++); - - String value = falseText_; //@D1A - if (user_.isNoPassword()) //@D1A - value = trueText_; //@D1A - - VUtilities.constrain (isNoPasswordText_, - value, //@D1C - panel, layout, row++); - - - value = falseText_; //@D1A - if (user_.isPasswordSetExpire()) //@D1A - value = trueText_; //@D1A - - VUtilities.constrain (isPasswordSetExpireText_, - value, //@D1A - panel, layout, row++); - - - value = falseText_; //@D1A - if (user_.isWithDigitalCertificates()) //@D1A - value = trueText_; //@D1A - - VUtilities.constrain (isWithDigitalCertificatesText_, - value, - panel, layout, row++); - - return panel; - } - - // @A1A - /** - * Returns the sessionStartup tab component. - * - * @return The component for the sessionStartup tab. - **/ - private Component getSessionStartupTab () - { - // Initializes the active tab. - JPanel sessionStartupTab = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - sessionStartupTab.setLayout (layout); - sessionStartupTab.setBorder (new EmptyBorder (10, 10, 10, 10)); - - int row = 0; - - String string; - - - // Initial program. - string=user_.getInitialProgram(); - - - VUtilities.constrain (initialProgramText_, - string, - sessionStartupTab, layout, row++); - - - string=user_.getInitialMenu(); - - VUtilities.constrain (initialMenuText_, - string, - sessionStartupTab, layout, row++); - - VUtilities.constrain (displaySignOnInformationText_, - user_.getDisplaySignOnInformation(), - sessionStartupTab, layout, row++); - - VUtilities.constrain (limitDeviceSessionsText_, - user_.getLimitDeviceSessions(), - sessionStartupTab, layout, row++); - - - return sessionStartupTab; - } - - /** - Removes a change listener. - - @param listener The listener. - **/ - public void removeChangeListener (ChangeListener listener) - { - changeEventSupport_.removeChangeListener (listener); - } - - - - /** - Removes a listener to be notified when an error occurs. - - @param listener The listener. - **/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - - /** - Removes a listener to be notified when a VObject is changed, - created, or deleted. - - @param listener The listener. - **/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - - /** - Removes a listener to be notified when work in a different thread - starts and stops. - - @param listener The listener. - **/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - - // @A3A - private boolean searchArray (String[] array, String check) - { - for (int i = 0; i < array.length; ++i) - if (array[i].equalsIgnoreCase (check)) - return true; - return false; - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VAction.java b/cvsroot/src/com/ibm/as400/vaccess/VAction.java deleted file mode 100644 index f4ee8d183..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VAction.java +++ /dev/null @@ -1,146 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - - - -/** -The VAction interface defines an action to be performed -on a system resource. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VAction objects generate the following events: -

      -
    • ErrorEvent -
    • VObjectEvent -
    • WorkingEvent -
    - -@see VObject#getActions -@see VObject#getDefaultAction -@see VActionAdapter -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -// -// Implementation note: -// -// This action does not relate directly to the Swing defined -// Action. The reason is that our actions need to have some state -// passed at perform-time that is not available at construction -// time, hence VActionContext. -// -// VActionAdapter is what ties this action to the Swing action. -// -public interface VAction -{ - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - abstract public void addErrorListener (ErrorListener listener); - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - abstract public void addVObjectListener (VObjectListener listener); - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ - abstract public void addWorkingListener (WorkingListener listener); - - - -/** -Returns the text for the action. - -@return The text. -**/ - abstract public String getText (); - - - -/** -Indicates if the action is enabled. - -@return true if the action is enabled; false otherwise. -**/ - abstract public boolean isEnabled (); - - - -/** -Performs the action. - -@param context The action context. -**/ - abstract public void perform (VActionContext context); - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - abstract public void removeErrorListener (ErrorListener listener); - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - abstract public void removeVObjectListener (VObjectListener listener); - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - abstract public void removeWorkingListener (WorkingListener listener); - - - -/** -Sets the enabled state of the action. - -@param enabled true if the action is enabled; false otherwise. -**/ - abstract public void setEnabled (boolean enabled); - - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VActionAdapter.java b/cvsroot/src/com/ibm/as400/vaccess/VActionAdapter.java deleted file mode 100644 index 7eee73f33..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VActionAdapter.java +++ /dev/null @@ -1,339 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VActionAdapter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.Action; -import javax.swing.Icon; -import java.awt.event.ActionEvent; -import java.beans.PropertyChangeListener; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.Hashtable; - - - -/** -The VActionAdapter class represents an object that listens for -action events and subsequently performs a VAction. - -

    A VActionAdapter object is useful when an action listener is -needed to perform a VAction. For example, this can be used to -as an action listener for button clicks or menu item selections. - -

    This class essentially adapts the VAction -class hierarchy to the javax.swing.Action class hierarchy. - -

    The following example creates an action adapter which is -used to put up a properties pane for a directory in the integrated -file system. The action adapter is then attached -to a menu item, so that the action is performed when the menu -item is selected. - -

    -// Set up the directory object.
    -AS400 system = new AS400 ("MySystem", "Userid", "Password");
    -VIFSDirectory directory = new VIFSDirectory (system, "/myDirectory");
    -
    -// Set up a pane and add it to a frame. -AS400ExplorerPane pane = new AS400ExplorerPane (directory); - -JFrame frame = new JFrame ("My Window"); -frame.getContentPane().add(new JScrollPane(pane)); - - -
    -// Set up the properties action adapter. -VActionAdapter adapter = new VActionAdapter (directory, - new VPropertiesAction (), pane.getActionContext ()); -
    -// Set up the menu item. -JMenuItem menuItem = new JMenuItem ("Properties"); -menuItem.setEnabled (true); -menuItem.addActionListener (adapter); -
    - -@see VAction -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VActionAdapter -implements Action, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Properties. - private VAction action_ = null; - private VActionContext actionContext_ = null; - private boolean enabled_ = false; - - - - // Private data. - transient private Hashtable propertyDictionary_; - - - - // Event support. - transient private PropertyChangeSupport propertyChangeSupport_; - - - -/** -Constructs a VActionAdapter object. -**/ - public VActionAdapter () - { - initializeTransient (); - } - - - -/** -Constructs a VActionAdapter object. - -@param action The action. -@param actionContext The action context. -**/ - public VActionAdapter (VAction action, - VActionContext actionContext) - { - if (action == null) - throw new NullPointerException ("action"); - if (actionContext == null) - throw new NullPointerException ("actionContext"); - - action_ = action; - actionContext_ = actionContext; - - initializeTransient (); - } - - - -/** -Invoked when an action is performed. This will cause the -specified event to also be performed. - -@param event The event. -**/ - public void actionPerformed (ActionEvent event) - { - if ((action_ != null) - && (actionContext_ != null) - && (isEnabled () == true)) { - - action_.perform (actionContext_); - - } - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Returns the action with which the action adapter -is associated. - -@return The action, or null if none has been set. -**/ - public VAction getAction () - { - return action_; - } - - - -/** -Returns the context in which the associated action will be -performed. - -@return The action context, or null if none has been set. -**/ - public VActionContext getActionContext () - { - return actionContext_; - } - - - -/** -Returns the value of the property associated with the given key. - -@param key The key. -@return The value. -**/ - public Object getValue (String key) - { - if (key == null) - throw new NullPointerException ("key"); - - if (propertyDictionary_.containsKey (key)) - return propertyDictionary_.get (key); - else - return null; - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Private data. - propertyDictionary_ = new Hashtable (); - - // Event support. - propertyChangeSupport_ = new PropertyChangeSupport (this); - } - - - -/** -Indicates if the action is enabled. - -@return true if the action is enabled; false otherwise. -**/ - public boolean isEnabled () - { - if (action_ != null) - return action_.isEnabled (); - else - return enabled_; - } - - - -/** -Sets the value of the property associated with the given key. - -@param key The key. -@param value The value of the property. -**/ - public void putValue (String key, Object value) - { - if (key == null) - throw new NullPointerException ("key"); - if (value == null) - throw new NullPointerException ("value"); - - propertyDictionary_.put (key, value); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Sets the action with which the action adapter -is associated. - -@param action The action. -**/ - public void setAction (VAction action) - { - if (action == null) - throw new NullPointerException ("action"); - - VAction oldValue = action_; - VAction newValue = action; - - action_ = action; - - propertyChangeSupport_.firePropertyChange ("action", oldValue, newValue); - } - - - -/** -Sets the context in which the associated action will be -performed. - -@param actionContext The action context. -**/ - public void setActionContext (VActionContext actionContext) - { - if (actionContext == null) - throw new NullPointerException ("actionContext"); - - VActionContext oldValue = actionContext_; - VActionContext newValue = actionContext; - - actionContext_ = actionContext; - - propertyChangeSupport_.firePropertyChange ("actionContext", oldValue, newValue); - } - - - -/** -Sets the enabled state of the action. - -@param enabled true if the action is enabled; false otherwise. -**/ - public void setEnabled (boolean enabled) - { - Boolean oldValue = new Boolean (enabled_); - Boolean newValue = new Boolean (enabled); - - enabled_ = enabled; - if (action_ != null) - action_.setEnabled (enabled); - - propertyChangeSupport_.firePropertyChange ("enabled", oldValue, newValue); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VActionAdapter16.gif b/cvsroot/src/com/ibm/as400/vaccess/VActionAdapter16.gif deleted file mode 100644 index 4190bd9e0..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VActionAdapter16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VActionAdapter32.gif b/cvsroot/src/com/ibm/as400/vaccess/VActionAdapter32.gif deleted file mode 100644 index 91ab75dcb..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VActionAdapter32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VActionAdapterBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/VActionAdapterBeanInfo.java deleted file mode 100644 index ed4e00b9a..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VActionAdapterBeanInfo.java +++ /dev/null @@ -1,178 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VActionAdapterBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - - - -/** -The VActionAdapterBeanInfo class provides bean information -for the VActionAdapter class. - -@see VActionAdapter -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VActionAdapterBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = VActionAdapter.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - events_ = new EventSetDescriptor[] { propertyChange }; - - // Properties. - PropertyDescriptor action = new PropertyDescriptor ("action", beanClass_); - action.setBound (true); - action.setConstrained (false); - action.setDisplayName (ResourceLoader.getText ("PROP_NAME_ACTION")); - action.setShortDescription (ResourceLoader.getText ("PROP_DESC_ACTION")); - - PropertyDescriptor actionContext = new PropertyDescriptor ("actionContext", beanClass_); - actionContext.setBound (true); - actionContext.setConstrained (false); - actionContext.setDisplayName (ResourceLoader.getText ("PROP_NAME_ACTION_CONTEXT")); - actionContext.setShortDescription (ResourceLoader.getText ("PROP_DESC_ACTION_CONTEXT")); - - PropertyDescriptor enabled = new PropertyDescriptor ("enabled", beanClass_); - enabled.setBound (true); - enabled.setConstrained (false); - enabled.setDisplayName (ResourceLoader.getText ("PROP_NAME_ENABLED")); - enabled.setShortDescription (ResourceLoader.getText ("PROP_DESC_ENABLED")); - - properties_ = new PropertyDescriptor[] { action, - actionContext, enabled }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // Property change event. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // action. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("VActionAdapter16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("VActionAdapter32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VActionContext.java b/cvsroot/src/com/ibm/as400/vaccess/VActionContext.java deleted file mode 100644 index a534db47e..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VActionContext.java +++ /dev/null @@ -1,82 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VActionContext.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.CellEditor; -import java.awt.Frame; - - - -/** -The VActionContext interface defines the context within which an -action is performed. An action context provides various aspects -of a graphical user interface to an action, so that the action can -interact with the user. - -

    An action context is always needed when peforming actions. -Many graphical user interface components provided in this package -provide a getActionContext() method which will return an action -context. - -@see VAction -@see VActionAdapter -@see AS400DetailsPane#getActionContext -@see AS400ExplorerPane#getActionContext -@see AS400ListPane#getActionContext -@see AS400TreePane#getActionContext -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public interface VActionContext -{ - - - -/** -Indicates if certain actions should be confirmed with -the user. Such actions will likely prompt the user -before continuing. - -@return true if certain actions should be confirmed with - the user; false otherwise. -**/ - public abstract boolean getConfirm (); - - - -/** -Returns the frame. This is useful for actions that need -to create dialogs. - -@return The frame. -**/ - public abstract Frame getFrame (); - - - -/** -Prompts the user to edit the text for a system resource. -This will start an edit session usually within -a graphical component. - -@param object The object to be edited. -@param propertyIdentifier The property identifier of the object which will be edited. -@return The cell editor, or null if editing - is not allowed. -**/ - public abstract CellEditor startEditing (VObject object, - Object propertyIdentifier); - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VEmptyNode.java b/cvsroot/src/com/ibm/as400/vaccess/VEmptyNode.java deleted file mode 100644 index adfd9d96f..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VEmptyNode.java +++ /dev/null @@ -1,373 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VEmptyNode.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.Icon; -import javax.swing.table.DefaultTableColumnModel; -import javax.swing.table.TableColumnModel; -import javax.swing.tree.TreeNode; -import java.io.Serializable; -import java.util.Enumeration; - - - -/** -The VEmptyNode class is an empty node for use in representing -a tree with no root. This is used to workaround a Swing -bug documented in AS400TreePane constructor. -**/ -class VEmptyNode -implements VNode, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - } - - - -/** -Adds a listener to be notified when work in a different thread -starts and stops. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - } - - - -/** -Returns the children of the node. - -@return An empty enumeration. -**/ - public Enumeration children () - { - return new Enumeration () { - public boolean hasMoreElements () { return false; } - public Object nextElement () { return null; } - }; - } - - - -/** -Returns the list of actions that can be performed. - -@return Always null. -**/ - public VAction[] getActions () - { - return null; - } - - - -/** -Indiciates if the node allows children. - -@param Always true. -**/ - public boolean getAllowsChildren () - { - return true; - } - - - -/** -Returns the child node at the specified index. - -@param index The index. -@return Always null. -**/ - public TreeNode getChildAt (int index) - { - return null; - } - - - -/** -Returns the number of children. - -@return Always 0. -**/ - public int getChildCount () - { - return 0; - } - - - -/** -Returns the default action. - -@return Always null. -**/ - public VAction getDefaultAction () - { - return null; - } - - - -/** -Returns the child for the details at the specified index. - -@param index The index. -@return Always null. -**/ - public VObject getDetailsChildAt (int index) - { - return null; - } - - - -/** -Returns the number of children for the details. - -@param Always 0. -**/ - public int getDetailsChildCount () - { - return 0; - } - - - -/** -Returns the index of the specified child for the details. - -@param detailsChild The detailsChild. -@return Always -1. -**/ - public int getDetailsIndex (VObject detailsChild) - { - return -1; - } - - - -/** -Returns the table column model to use in the details -when representing the children. This column model -describes the details values for the children. - -@return The details column model. -**/ - public TableColumnModel getDetailsColumnModel () - { - return new DefaultTableColumnModel (); - } - - - -/** -Returns the icon. - -@param size The icon size, either 16 or 32. If any other - value is given, then return a default. -@param open true for the open icon, false for the closed - icon. -@return Always null. -**/ - public Icon getIcon (int size, boolean open) - { - return null; - } - - - -/** -Returns the index of the specified child. - -@param child The child. -@return Always -1. -**/ - public int getIndex (TreeNode child) - { - return -1; - } - - - -/** -Returns the parent node. - -@return Always null. -**/ - public TreeNode getParent () - { - return null; - } - - - -/** -Returns the properties pane. - -@return Always null. -**/ - public VPropertiesPane getPropertiesPane () - { - return null; - } - - - -/** -Returns a property value. - -@param propertyIdentifier The property identifier. -@return Always null. -**/ - public Object getPropertyValue (Object propertyIdentifier) - { - return null; - } - - - -/** -Returns the text. This is the name of the directory. - -@return Always "". -**/ - public String getText () - { - return ""; - } - - - -/** -Indicates if the node is a leaf. - -@param Always true. -**/ - public boolean isLeaf () - { - return true; - } - - - -/** -Indicates if the details children are sortable. - -@return Always false. -**/ - public boolean isSortable () - { - return false; - } - - -/** -Loads the information from the server. -**/ - public void load () - { - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - } - - - -/** -Sorts the children for the details. - -@param propertyIdentifiers The property identifiers. If any of - the property identifiers are null, it - means to sort using the string - representation of the object. -@param orders The sort orders for each property - identifier, true for ascending order, - false for descending order. -**/ - public void sortDetailsChildren (Object[] propertyIdentifiers, - boolean[] orders) - { - } - - - -/** -Returns the string representation. This is the name of the directory. - -@return Always "". -**/ - public String toString () - { - return ""; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VEnumeration.java b/cvsroot/src/com/ibm/as400/vaccess/VEnumeration.java deleted file mode 100644 index 86009f3b5..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VEnumeration.java +++ /dev/null @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VEnumeration.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.util.Enumeration; - -/** - * A simple wrapper to enumerate VObject children. - **/ -class VEnumeration -implements Enumeration -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - VNode vobj_; - int pos=0; - - - - VEnumeration( VNode vobj ) - { - vobj_ = vobj; - } - - - - public boolean hasMoreElements() - { - return pos < vobj_.getChildCount(); - } - - - - public Object nextElement() - { - try { - return vobj_.getChildAt(pos++); - } catch (Exception e) - { - throw new java.util.NoSuchElementException(); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VFIcon.gif b/cvsroot/src/com/ibm/as400/vaccess/VFIcon.gif deleted file mode 100644 index 42a00ca6b..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VFIcon.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VIFSConstants.java b/cvsroot/src/com/ibm/as400/vaccess/VIFSConstants.java deleted file mode 100644 index ebdeecafe..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VIFSConstants.java +++ /dev/null @@ -1,48 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VIFSConstants.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - - - -/** -The VIFSConstants interface defines property identifiers -for IFS components. - -@see VIFSDirectory -@see VIFSFile -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public interface VIFSConstants -{ - - - -/** -Property identifier for the attributes. -**/ - public static final Object ATTRIBUTES_PROPERTY = "Attributes"; - -/** -Property identifier for the modified time. -**/ - public static final Object MODIFIED_PROPERTY = "Modified"; - -/** -Property identifier for the size. -**/ - public static final Object SIZE_PROPERTY = "Size"; - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectory.java b/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectory.java deleted file mode 100644 index 802d8abd7..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectory.java +++ /dev/null @@ -1,1390 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VIFSDirectory.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.IFSFile; -import com.ibm.as400.access.IFSFileFilter; -import com.ibm.as400.access.Permission; -import com.ibm.as400.access.Trace; -import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.SwingConstants; -import javax.swing.table.DefaultTableColumnModel; -import javax.swing.table.TableColumn; -import javax.swing.table.TableColumnModel; -import javax.swing.tree.TreeNode; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.net.URL; -import java.util.Date; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - - - -/** -The VIFSDirectory class defines the representation of a -directory in the integrated file system for use -in various models and panes in this package. -You must explicitly call load() to load the information from -the system. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VIFSDirectory objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • VObjectEvent -
    • WorkingEvent -
    - -@see com.ibm.as400.access.IFSFile -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VIFSDirectory -implements VNode, VIFSConstants, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constant for including files only. -**/ - public static final int INCLUDE_FILES = 0; - -/** -Constant for including directories only. -**/ - public static final int INCLUDE_DIRECTORIES = 1; - -/** -Constant for including both files and directories. -**/ - public static final int INCLUDE_BOTH = 2; - - - - // MRI. - private static String attributesColumnHeader_ = ResourceLoader.getText ("COLUMN_ATTRIBUTES"); - private static String description_ = ResourceLoader.getText ("IFS_DIRECTORY_DESCRIPTION"); - private static Icon closedIcon16_ = ResourceLoader.getIcon ("VIFSDirectory16.gif", description_); - private static Icon closedIcon32_ = ResourceLoader.getIcon ("VIFSDirectory32.gif", description_); - private static String modifiedColumnHeader_ = ResourceLoader.getText ("COLUMN_MODIFIED"); - private static String nameColumnHeader_ = ResourceLoader.getText ("COLUMN_NAME"); - private static Icon openIcon16_ = ResourceLoader.getIcon ("VIFSDirectoryOpen16.gif", description_); - private static Icon openIcon32_ = ResourceLoader.getIcon ("VIFSDirectoryOpen32.gif", description_); - private static String sizeColumnHeader_ = ResourceLoader.getText ("COLUMN_SIZE"); - - - - // Properties. - private IFSDirectoryFilter actualFilter_ = new IFSDirectoryFilter (INCLUDE_BOTH, null); - private IFSFile directory_ = null; - private VNode parent_ = null; - private String pattern_ = "*"; - - - - // Static data. - private static TableColumnModel detailsColumnModel_ = null; - - - - // Private data. - transient private VAction[] actions_; - transient private boolean actionsInitialized_; //@C2A - transient VNode[] children_; // Private. - transient private boolean childrenLoaded_; - transient boolean deleted_; // Private. @A1A - transient VObject[] detailsChildren_; // Private. - transient private Date modified_; - transient private VPropertiesPane propertiesPane_; - - - - // Event support. - transient ErrorEventSupport errorEventSupport_; // Private. - transient VObjectEventSupport objectEventSupport_; // Private. - transient VObjectListener_ objectListener_; // Private. - transient PropertyChangeSupport propertyChangeSupport_; // Private. - transient VetoableChangeSupport vetoableChangeSupport_; // Private. - transient WorkingEventSupport workingEventSupport_; // Private. - - - -/** -Static initializer. -**/ -// -// Implementation note: -// -// * The column widths are completely arbitrary. -// - static - { - detailsColumnModel_ = new DefaultTableColumnModel (); - int columnIndex = 0; - - // Name column. - VTableColumn nameColumn = new VTableColumn (columnIndex++, NAME_PROPERTY); - nameColumn.setCellEditor (new VObjectCellEditor ()); - nameColumn.setCellRenderer (new VObjectCellRenderer ()); - nameColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - nameColumn.setHeaderValue (nameColumnHeader_); - nameColumn.setPreferredCharWidth (25); - detailsColumnModel_.addColumn (nameColumn); - - // Size column. - VTableColumn sizeColumn = new VTableColumn (columnIndex++, SIZE_PROPERTY); - sizeColumn.setCellRenderer (new VObjectCellRenderer (SwingConstants.RIGHT)); - sizeColumn.setHeaderRenderer (new VObjectHeaderRenderer (SwingConstants.RIGHT)); - sizeColumn.setHeaderValue (sizeColumnHeader_); - sizeColumn.setPreferredCharWidth (8); - detailsColumnModel_.addColumn (sizeColumn); - - // Modified column. - VTableColumn modifiedColumn = new VTableColumn (columnIndex++, MODIFIED_PROPERTY); - modifiedColumn.setCellRenderer (new VObjectCellRenderer ()); - modifiedColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - modifiedColumn.setHeaderValue (modifiedColumnHeader_); - modifiedColumn.setPreferredCharWidth (20); - detailsColumnModel_.addColumn (modifiedColumn); - - // Attributes column. - VTableColumn attributesColumn = new VTableColumn (columnIndex++, ATTRIBUTES_PROPERTY); - attributesColumn.setCellRenderer (new VObjectCellRenderer ()); - attributesColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - attributesColumn.setHeaderValue (attributesColumnHeader_); - attributesColumn.setPreferredCharWidth (10); - detailsColumnModel_.addColumn (attributesColumn); - } - - - -/** -Constructs a VIFSDirectory object. -**/ - public VIFSDirectory () - { - directory_ = new IFSFile (); - initializeTransient (); - } - - - -/** -Constructs a VIFSDirectory object. - -@param directory The directory. -**/ - public VIFSDirectory (IFSFile directory) - { - if (directory == null) - throw new NullPointerException ("directory"); - - directory_ = directory; - initializeTransient (); - } - - - -/** -Constructs a VIFSDirectory object. - -@param parent The parent. -@param directory The directory. -**/ - public VIFSDirectory (VNode parent, IFSFile directory) - { - if (parent == null) - throw new NullPointerException ("parent"); - if (directory == null) - throw new NullPointerException ("directory"); - - parent_ = parent; - directory_ = directory; - initializeTransient (); - } - - - -/** -Constructs a VIFSDirectory object. - -@param system The system on which the file resides. -@param path The fully qualified path name of the file. -**/ - public VIFSDirectory (AS400 system, String path) - { - if (system == null) - throw new NullPointerException ("system"); - if (path == null) - throw new NullPointerException ("path"); - - directory_ = new IFSFile (system, path); - initializeTransient (); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Returns the children of the node. -The children are the subdirectories. - -@return The children. -**/ - public synchronized Enumeration children () - { - return new VEnumeration (this); - } - - - -/** -Returns the list of actions that can be performed. -
      -
    • create file -
    • create directory -
    • rename -
    • delete -
    - -@return The actions. -**/ - public VAction[] getActions () - { - initializeCreationActions (); //@C2A - return actions_; - } - - - -/** -Indiciates if the node allows children. - -@return Always true. -**/ - public boolean getAllowsChildren () - { - return true; - } - - - -/** -Returns the child node at the specified index. - -@param index The index. -@return The child node, or null if the - index is not valid. -**/ - public /* @A2D synchronized */ TreeNode getChildAt (int index) - { - if (childrenLoaded_ == false) - loadChildren (); - - if (index < 0 || index >= children_.length) - return null; - - return children_[index]; - } - - - -/** -Returns the number of children. -This is the number of subdirectories. - -@return The number of children. -**/ - public /* @A2D synchronized */ int getChildCount () - { - if (childrenLoaded_ == false) - loadChildren (); - - return children_.length; - } - -/** -Returns the default action. - -@return Always null. There is no default action. -**/ - public VAction getDefaultAction () - { - return null; - } - - - -/** -Returns the child for the details at the specified index. - -@param index The index. -@return The child, or null if the index is not - valid. -**/ - public /* @A2D synchronized */ VObject getDetailsChildAt (int index) - { - if (childrenLoaded_ == false) - loadChildren (); - - synchronized (detailsChildren_) { // @C3A - if (index < 0 || index >= detailsChildren_.length) - return null; - - return detailsChildren_[index]; - } - } - - - -/** -Returns the number of children for the details. -This is the number of subdirectories and files. - -@return The number of children for the details. -**/ - public /* @A2D synchronized */ int getDetailsChildCount () - { - if (childrenLoaded_ == false) - loadChildren (); - - return detailsChildren_.length; - } - - - -/** -Returns the table column model to use in the details -when representing the children. This column model -describes the details values for the children. - -@return The details column model. -**/ - public TableColumnModel getDetailsColumnModel () - { - return detailsColumnModel_; - } - - - -/** -Returns the index of the specified child for the details. - -@param detailsChild The details child. -@return The index, or -1 if the child is not found - in the details. -**/ - public /* @A2D synchronized */ int getDetailsIndex (VObject detailsChild) - { - if (childrenLoaded_ == false) - loadChildren (); - - synchronized (detailsChildren_) { // @C3A - for (int i = 0; i < detailsChildren_.length; ++i) - if (detailsChildren_[i] == detailsChild) - return i; - } - return -1; - } - - - -/** -Returns the number of children that are directories. - -@return The number of children that are directories. -**/ - int getDirectoryCount () - { - return getChildCount (); - } - - - -/** -Returns the number of children that are files. - -@return The number of children that are files. -**/ - int getFileCount () - { - return getDetailsChildCount () - getChildCount (); - } - - - -/** -Returns the filter which determines which files and directories -are included as children. - -@return The filter which determines which files are included - as children, or null to include all files and - directories. -**/ - public IFSFileFilter getFilter () - { - return actualFilter_.getOtherFilter (); - } - - - -/** -Returns the icon. - -@param size The icon size, either 16 or 32. If any other - value is given, then return a default. -@param open true for the open icon; false for the closed - icon. -@return The icon. -**/ - public Icon getIcon (int size, boolean open) - { - if (size == 32) { - if (open) - return openIcon32_; - else - return closedIcon32_; - } - else { - if (open) - return openIcon16_; - else - return closedIcon16_; - } - } - - - -/** -Indicates if files, directories, or both are contained in the -list of details children. - -@return One of the constants: INCLUDE_FILES, INCLUDE_DIRECTORIES, - or INCLUDE_BOTH. -**/ - public int getInclude () - { - return actualFilter_.getInclude (); - } - - - -/** -Returns the index of the specified child. - -@param child The child. -@return The index. -**/ - public /* @A2D synchronized */ int getIndex (TreeNode child) - { - if (childrenLoaded_ == false) - loadChildren (); - - synchronized (children_) { // @C3A - for (int i = 0; i < children_.length; ++i) - if (children_[i] == child) - return i; - } - return -1; - } - - - -/** -Returns the last modified date. - -@return The last modified date. -**/ - Date getModified () - { - return modified_; - } - - - -/** -Returns the directory name. - -@return The directory name. - -@see com.ibm.as400.access.IFSFile#getName -**/ - public String getName () - { - return directory_.getName (); - } - - - -/** -Returns the parent node. - -@return The parent node, or null if there is no parent. -**/ - public TreeNode getParent () - { - return parent_; - } - - - -/** -Returns the parent directory name. - -@return The parent directory name. - -@see com.ibm.as400.access.IFSFile#getParent -**/ - public String getParentDirectory () - { - return directory_.getParent (); - } - - - -/** -Returns the pattern that all file and directory names must match -to be included as children. The pattern is defined in terms -of * and ?. - -@return The pattern that all file and directory names must match - to be included as children, or null to include all files - and directories. -**/ - public String getPattern () - { - return pattern_; - } - - - -/** -Returns the fully qualified path name of the file. - -@return The fully qualified path name of the file. - -@see com.ibm.as400.access.IFSFile#getPath -**/ - public String getPath () - { - return directory_.getPath (); - } - - - -/** -Returns the properties pane. - -@return The properties pane. -**/ - public VPropertiesPane getPropertiesPane () - { - return propertiesPane_; - } - - - -/** -Returns a property value. - -@param propertyIdentifier The property identifier. The choices are -
      -
    • NAME_PROPERTY -
    • DESCRIPTION_PROPERTY -
    • SIZE_PROPERTY -
    • MODIFIED_PROPERTY -
    • ATTRIBUTES_PROPERTY -
    -@return The property value, or null if the - property identifier is not recognized. -**/ - public /* @A2D synchronized */ Object getPropertyValue (Object propertyIdentifier) - { - // Get the name. - if (propertyIdentifier == NAME_PROPERTY) - return this; - - // Get the description. - else if (propertyIdentifier == DESCRIPTION_PROPERTY) - return description_; - - // Size column. - else if (propertyIdentifier == SIZE_PROPERTY) - return ""; // Not applicable for directories. - - // Modified column. - else if (propertyIdentifier == MODIFIED_PROPERTY) - return modified_; - - // Attributes column. - else if (propertyIdentifier == ATTRIBUTES_PROPERTY) - return ""; // Not applicable for directories. - - // By default, return null. - return null; - } - - - -/** -Returns the system on which the file resides. - -@return The system on which the file resides. - -@see com.ibm.as400.access.IFSFile#getSystem -**/ - public AS400 getSystem () - { - return directory_.getSystem (); - } - - - -/** -Returns the text. This is the name of the directory. - -@return The text which is the name of the directory. -**/ - public String getText () - { - String text = directory_.getName (); - if (text.length() == 0) - text = "/"; - return text; - } - - -//@C2A -/** -If we are dealing with an object that is under QDLS or QSYS, -disables the "creation" actions. -**/ - private void initializeCreationActions () - { - if (actionsInitialized_) return; //@C2A - // @C2C - This block was formerly located in initializeTransient(). - // @B3A - // If we are operating on an object that is in QDLS or QSYS, - // we want to disable the creation - // actions, since there are problems with creating folders and - // things in areas of the file system that aren't normal IFS. - // Note: The Rename and Delete actions will work on "non-IFS" - // objects because the objects were pre-existing so there - // wouldn't be any naming problems. This is assuming the - // user knows the naming convention of the object they - // are trying to rename. - -// Permission perm = ((PermissionAction)actions_[4]).getPermission ();//@C2C @C4D -// if (perm != null && perm.getType() != Permission.TYPE_ROOT) @C4D - - String pathPrefix = directory_.getPath().toUpperCase(); //@C4A - if (pathPrefix.startsWith("/QSYS.LIB/") || //@C4A - pathPrefix.startsWith("/QDLS/")) //@C4A - { - for (int i=0; i<2; ++i) - actions_[i].setEnabled(false); - } - actionsInitialized_ = true; //@C2A - - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - objectEventSupport_ = new VObjectEventSupport (this); - objectListener_ = new VObjectListener_ (); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - directory_.addPropertyChangeListener (propertyChangeSupport_); - directory_.addVetoableChangeListener (vetoableChangeSupport_); - - // Initialize the actions. - actions_ = new VAction[5]; //@B2C Changed from [4] to [5] - actions_[0] = new IFSFileCreateAction (this, directory_); - actions_[1] = new IFSDirectoryCreateAction (this, directory_); - actions_[2] = new IFSRenameAction (this, directory_); - actions_[3] = new IFSDeleteAction (this, directory_); - actions_[4] = new PermissionAction(directory_); // @B2A Add PermissionAction. - - //@C2C - // Postpone disabling the creation actions until we need to use the actions. - actionsInitialized_ = false; //@C2C - - for (int i = 0; i < actions_.length; ++i) { - actions_[i].addErrorListener (errorEventSupport_); - actions_[i].addVObjectListener (objectListener_); -//@C0D actions_[i].addVObjectListener (objectEventSupport_); // @B2A - actions_[i].addWorkingListener (workingEventSupport_); - } - - // Initialize the properties pane. - propertiesPane_ = new IFSDirectoryPropertiesPane (this); - - propertiesPane_.addErrorListener (errorEventSupport_); - propertiesPane_.addVObjectListener (objectListener_); -//@C0D propertiesPane_.addVObjectListener (objectEventSupport_); //@B2A - propertiesPane_.addWorkingListener (workingEventSupport_); - - // Initialize the details values. - children_ = new VNode[0]; - detailsChildren_ = new VObject[0]; - modified_ = new Date (); //@C1C - - // Initialize the children loaded flag to true. This - // makes sure that we do not go to the system until - // after load() has been called. - childrenLoaded_ = true; - - deleted_ = false; // @A1A - } - - - -/** -Indicates if the node is a leaf. - -@return true if the node if a leaf; false otherwise. -**/ - public boolean isLeaf () - { - // This is a performance kludge to help avoid - // loading the grandchild of the root right away. - // All nodes will look like non-leafs, until - // actually loaded for some other (more important) - // reason. - if (childrenLoaded_) - return (getChildCount () == 0); - else - return false; - } - - - -/** -Indicates if the details children are sortable. - -@return Always true. -**/ - public boolean isSortable () - { - return true; - } - - - -/** -Loads information about the object from the system. -**/ - public void load () - { - workingEventSupport_.fireStartWorking (); - - // @A2D synchronized (this) { - initializeCreationActions (); //@C2A - - // Load the modified date. - try { - modified_ = new Date (directory_.lastModified()); - } - catch (Exception e) { - modified_ = new Date (0); - errorEventSupport_.fireError (e); - } - - // Reset children. Force a reload of children - // the next time that they are needed. - childrenLoaded_ = false; - // @A2D } - - // Done loading. - workingEventSupport_.fireStopWorking (); - } - - - -/** -Loads the children from the system. -**/ - private void loadChildren () - { - workingEventSupport_.fireStartWorking (); - - try { - - // @A2D synchronized (this) { - - // Keep a list of current children. This is necessary - // because we do not want to recreate objects that - // that continue to exist. If we did this, the explorer - // pane does not work as expected. (I.e. we end up - // with 2 different objects representing the same - // directory.) - Hashtable cache = new Hashtable (); - for (int i = 0; i < detailsChildren_.length; ++i) - cache.put (detailsChildren_[i].getText (), detailsChildren_[i]); - - // Get the list of file names. Handle the case where - // a system or path may not have been set yet. - if (Trace.isTraceOn ()) - Trace.log (Trace.INFORMATION, "Loading IFS file list [" - + directory_.getName () + "]."); - - // Make sure all necessary properties have been set. - Vector directories = null; - synchronized (detailsChildren_) { // @C3A - if (directory_.getPath ().length () > 0) { - - //@C5C Change to use listFiles() rather than list(). - //@C5C Rename the array from fileNames to files to reflect change in meaning. - IFSFile[] files = directory_.listFiles (actualFilter_, pattern_); - - // If list returns null, it could be because we - // just don't have authority (in which case we should - // pretend that the directory is empty) or it may not - // exist (in which we should report an error). - if (files == null) { - Trace.log(Trace.DIAGNOSTIC, "File list returned as null"); //@C5A - if (directory_.exists ()) - files = new IFSFile[0]; //@C5C - else - throw new IOException (ResourceLoader.getText ("EXC_FILE_NOT_FOUND")); - } - - // Build a list of children. Actually build two lists. - // One contains all children, and one contains only the - // subdirectories, which gets used for trees. - int fileCount = files.length; - //AS400 system = directory_.getSystem (); //@C5D Delete these two lines. - //String path = directory_.getPath (); - detailsChildren_ = new VObject[fileCount]; - directories = new Vector (fileCount); - - // For each file and directory that came back from the - // system... - for (int i = 0; i < fileCount; ++i) { - - // Check to see if the VObject already exists. - // If not, then create a new one. - VObject child = null; - //@C5C Change to use getName(). - if (cache.containsKey (files[i].getName())) - child = (VObject) cache.remove (files[i].getName()); - else { - IFSFile file = files[i]; //@C5A - //IFSFile file = new IFSFile (system, path, fileNames[i]); //@C5D - if (file.isDirectory ()) - child = new VIFSDirectory (VIFSDirectory.this, file); - else - child = new VIFSFile (file); - - // Listen to the new child. - child.addErrorListener (errorEventSupport_); - child.addVObjectListener (objectEventSupport_); - child.addVObjectListener (objectListener_); - child.addWorkingListener (workingEventSupport_); - } - - // Load the child. - child.load (); - - // Add to the lists. - detailsChildren_[i] = child; - if ((child instanceof VIFSDirectory) && - (!directories.contains (child))) // @C3A - directories.addElement (child); - } - } - } - - // Create the children array for directories only. - if (directories != null) { - synchronized (children_) { // @C3A - children_ = new VNode[directories.size ()]; - directories.copyInto (children_); - } - } - - // Stop listening to children that are no more, if any. - Enumeration list = cache.elements (); - while (list.hasMoreElements ()) { - VObject child = (VObject) list.nextElement (); - child.removeErrorListener (errorEventSupport_); - child.removeVObjectListener (objectEventSupport_); - child.removeVObjectListener (objectListener_); - child.removeWorkingListener (workingEventSupport_); - } - - childrenLoaded_ = true; - // @A2D } - } - catch (Exception e) { - - // @A2D synchronized (this) { - children_ = new VNode[0]; - detailsChildren_ = new VObject[0]; - childrenLoaded_ = true; - // @A2D } - - if (! deleted_) // @A1A - errorEventSupport_.fireError (e); - } - - workingEventSupport_.fireStopWorking (); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Sets the filter which determines which files and directories -are included as children. - -@param filter The filter which determines which files are included - as children, or null to include all files and - directories. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setFilter (IFSFileFilter filter) - throws PropertyVetoException - { - if (filter == null) - throw new NullPointerException ("filter"); - - IFSFileFilter oldValue = actualFilter_.getOtherFilter (); - IFSFileFilter newValue = filter; - vetoableChangeSupport_.fireVetoableChange ("filter", oldValue, newValue); - - if (oldValue != newValue) - actualFilter_.setOtherFilter (newValue); - - propertyChangeSupport_.firePropertyChange ("filter", oldValue, newValue); - } - - - -/** -Sets whether files, directories, or both are contained in the -list of details children. - -@param include One of the constants: INCLUDE_FILES, - INCLUDE_DIRECTORIES, or INCLUDE_BOTH. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setInclude (int include) - throws PropertyVetoException - { - Integer oldValue = new Integer (actualFilter_.getInclude ()); - Integer newValue = new Integer (include); - vetoableChangeSupport_.fireVetoableChange ("includeFiles", oldValue, newValue); - - if (!oldValue.equals(newValue)) - actualFilter_.setInclude (include); - - propertyChangeSupport_.firePropertyChange ("includeFiles", oldValue, newValue); - } - - - -/** -Sets the fully qualified path name of the file. - -@param path The fully qualified path name of the file. - - -@exception PropertyVetoException If the change is vetoed. - -@see com.ibm.as400.access.IFSFile#setPath -**/ - public void setPath (String path) - throws PropertyVetoException - { - if (path == null) - throw new NullPointerException ("path"); - - directory_.setPath (path); - } - - - -/** -Sets the pattern that all file and directory names must match -to be included as children. The pattern is defined in terms -of * and ?. The default is to include all files and directories. - -@param pattern The pattern that all file and directory names - must match to be included as children, or null - to include all files and directories. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setPattern (String pattern) - throws PropertyVetoException - { - if (pattern == null) - throw new NullPointerException ("pattern"); - - String oldValue = pattern_; - String newValue = pattern; - vetoableChangeSupport_.fireVetoableChange ("pattern", oldValue, newValue); - - if (! oldValue.equals (newValue)) - pattern_ = newValue; - - propertyChangeSupport_.firePropertyChange ("pattern", oldValue, newValue); - } - - - -/** -Sets the system on which the file resides. - -@param system The system on which the file resides. - -@exception PropertyVetoException If the change is vetoed. - -@see com.ibm.as400.access.IFSFile#setSystem -**/ - public void setSystem (AS400 system) - throws PropertyVetoException - { - if (system == null) - throw new NullPointerException ("system"); - - directory_.setSystem (system); - } - - - -/** -Sorts the children for the details. - -@param propertyIdentifiers The property identifiers. If any of - the property identifiers are null, it - means to sort using the string - representation of the object. -@param orders The sort orders for each property - identifier, true for ascending order, - false for descending order. -**/ - public synchronized void sortDetailsChildren (Object[] propertyIdentifiers, - boolean[] orders) - { - if (propertyIdentifiers == null) - throw new NullPointerException ("propertyIdentifiers"); - if (orders == null) - throw new NullPointerException ("orders"); - - VUtilities.sort (detailsChildren_, propertyIdentifiers, orders); - } - - - -/** -Returns the string representation. This is the name of the directory. - -@return The string representation of the directory. -**/ - public String toString () - { - return directory_.getName (); - } - - - -/** -Listens for events and adjusts the children accordingly. -**/ - private class VObjectListener_ - implements VObjectListener, Serializable - { - public void objectChanged (VObjectEvent event) - { - // Forward this event to the event support. - objectEventSupport_.objectChanged (event); - } - - - - public void objectCreated (VObjectEvent event) - { - VObject object = event.getObject (); - VNode parent = event.getParent (); - - if (parent == VIFSDirectory.this) { - - // @C3D synchronized (VIFSDirectory.this) { - - // Add to the details children. - synchronized (detailsChildren_) { // @C3A - VObject[] oldDetailsChildren = detailsChildren_; - int count = detailsChildren_.length; - detailsChildren_ = new VObject[count + 1]; - System.arraycopy (oldDetailsChildren, 0, - detailsChildren_, 0, count); - detailsChildren_[count] = object; - } - - // If its a directory, then add to the tree children. - if (object instanceof VIFSDirectory) { - synchronized (children_) { // @C3A - VNode[] oldChildren = children_; - int countX = children_.length; - children_ = new VNode[countX + 1]; - System.arraycopy (oldChildren, 0, children_, - 0, countX); - children_[countX] = (VIFSDirectory) object; - } - } - } - - // Listen to the new object. - object.addErrorListener (errorEventSupport_); - object.addVObjectListener (objectListener_); - object.addVObjectListener (objectEventSupport_); - object.addWorkingListener (workingEventSupport_); - // @C3D } - - // Forward this event to the event support last, - // so the the listener can handle it in the case - // that we just added it to our list. - objectEventSupport_.objectCreated (event); - } - - - - public void objectDeleted (VObjectEvent event) - { - VObject object = event.getObject (); - - if (object == VIFSDirectory.this) { // @A1A - deleted_ = true; // @A1A - - // Forward this event to the event support first, - // so the the listener can handle it before our parent - // goes and removes the object from its list. - objectEventSupport_.objectDeleted (event); - - return; // @A1A - } // @A1A - - // If the deleted object is contained in the list, - // then remove it from the list. - // @C3D synchronized (VIFSDirectory.this) { - - // Remove from the details children. - int count; - int index = getDetailsIndex (object); - if (index >= 0) { - synchronized (detailsChildren_) { // @C3A - VObject[] oldDetailsChildren = detailsChildren_; - count = detailsChildren_.length; - detailsChildren_ = new VObject[count - 1]; - System.arraycopy (oldDetailsChildren, 0, - detailsChildren_, 0, index); - System.arraycopy (oldDetailsChildren, index + 1, - detailsChildren_, index, count - index - 1); - } - }; - - // If its a directory, then remove from the tree children. - if (object instanceof VIFSDirectory) { - index = getIndex ((VIFSDirectory) object); - if (index >= 0) { - synchronized (children_) { // @C3A - VNode[] oldChildren = children_; - count = children_.length; - children_ = new VNode[count - 1]; - System.arraycopy (oldChildren, 0, - children_, 0, index); - System.arraycopy (oldChildren, index + 1, - children_, 0, count - index - 1); - } - } - } - // @C3D } - - // Stop listening to the object. - object.removeErrorListener (errorEventSupport_); - object.removeVObjectListener (objectEventSupport_); - object.removeVObjectListener (objectListener_); - object.removeWorkingListener (workingEventSupport_); - } - - - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectory16.gif b/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectory16.gif deleted file mode 100644 index 7c896c65f..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectory16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectory32.gif b/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectory32.gif deleted file mode 100644 index 23d332105..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectory32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectoryBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectoryBeanInfo.java deleted file mode 100644 index d32e39915..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectoryBeanInfo.java +++ /dev/null @@ -1,217 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VIFSDirectoryBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The VIFSDirectoryBeanInfo class provides bean information -for the VIFSDirectory class. - -@see VIFSDirectory -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VIFSDirectoryBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = VIFSDirectory.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - String[] vobjectMethods = { "objectChanged", "objectCreated", "objectDeleted" }; - EventSetDescriptor vobject = new EventSetDescriptor (beanClass_, - "vobject", VObjectListener.class, vobjectMethods, - "addVObjectListener", "removeVObjectListener"); - vobject.setDisplayName (ResourceLoader.getText ("EVT_NAME_VOBJECT")); - vobject.setShortDescription (ResourceLoader.getText ("EVT_DESC_VOBJECT")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { error, propertyChange, - vetoableChange, vobject, working }; - - // Properties. - PropertyDescriptor filter = new PropertyDescriptor ("filter", beanClass_); - filter.setBound (true); - filter.setConstrained (true); - filter.setDisplayName (ResourceLoader.getText ("PROP_NAME_FILTER")); - filter.setShortDescription (ResourceLoader.getText ("PROP_DESC_FILTER")); - - PropertyDescriptor include = new PropertyDescriptor ("include", beanClass_); - include.setBound (true); - include.setConstrained (true); - include.setDisplayName (ResourceLoader.getText ("PROP_NAME_INCLUDE")); - include.setPropertyEditorClass (VIFSDirectoryIncludeEditor.class); - include.setShortDescription (ResourceLoader.getText ("PROP_DESC_INCLUDE")); - - PropertyDescriptor path = new PropertyDescriptor ("path", beanClass_); - path.setBound (true); - path.setConstrained (true); - path.setDisplayName (ResourceLoader.getText ("PROP_NAME_PATH")); - path.setShortDescription (ResourceLoader.getText ("PROP_DESC_PATH")); - - PropertyDescriptor pattern = new PropertyDescriptor ("pattern", beanClass_); - pattern.setBound (true); - pattern.setConstrained (true); - pattern.setDisplayName (ResourceLoader.getText ("PROP_NAME_PATTERN")); - pattern.setShortDescription (ResourceLoader.getText ("PROP_DESC_PATTERN")); - - PropertyDescriptor system = new PropertyDescriptor ("system", beanClass_); - system.setBound (true); - system.setConstrained (true); - system.setDisplayName (ResourceLoader.getText ("PROP_NAME_SYSTEM")); - system.setShortDescription (ResourceLoader.getText ("PROP_DESC_SYSTEM")); - - properties_ = new PropertyDescriptor[] { filter, include, path, - pattern, system }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 2; // path. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("VIFSDirectory16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("VIFSDirectory32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectoryIncludeEditor.java b/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectoryIncludeEditor.java deleted file mode 100644 index cec554e98..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectoryIncludeEditor.java +++ /dev/null @@ -1,139 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VIFSDirectoryIncludeEditor.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.beans.PropertyEditorSupport; - - - -/** -The VIFSDirectoryIncludeEditor class provides the list of choices -for the include property. -**/ -class VIFSDirectoryIncludeEditor -extends PropertyEditorSupport -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Static data. - private static final int default_ = 2; - - private static final String[] initialization_ = { "VIFSDirectory.INCLUDE_FILES", - "VIFSDirectory.INCLUDE_DIRECTORIES", - "VIFSDirectory.INCLUDE_BOTH" }; - - private static final String[] tags_ = { ResourceLoader.getText ("PROP_VALUE_INCLUDE_FILES"), - ResourceLoader.getText ("PROP_VALUE_INCLUDE_DIRECTORIES"), - ResourceLoader.getText ("PROP_VALUE_INCLUDE_BOTH") }; - - - - // Private data. - private int value_ = default_; - - - -/** -Returns the property value as text. - -@return The property value as text. -**/ - public String getAsText () - { - return tags_[value_]; - } - - - -/** -Returns the Java initialization string. - -@return The Java initialization string. -**/ - public String getJavaInitializationString () - { - return initialization_[value_]; - } - - - -/** -Returns the list of choices. - -@return The list of choices. -**/ - public String[] getTags() - { - return tags_; - } - - - -/** -Returns the property value. - -@return The property value. -**/ - public Object getValue () - { - return new Integer (value_); - } - - - -/** -Sets the property value as text. - -@param text The property value as text. -**/ - public void setAsText (String text) - { - boolean found = false; - for (int i = 0; i < tags_.length; ++i) - if (text.equals (tags_[i])) { - value_ = i; - found = true; - break; - } - - if (found) - firePropertyChange (); - else - throw new IllegalArgumentException (); - } - - - -/** -Sets the property value. - -@param value The property value. -**/ - public void setValue (Object value) - { - if (value instanceof Integer) { - value_ = ((Integer) value).intValue (); - if ((value_ < 0) || (value_ >= tags_.length)) - value_ = default_; - } - else - value_ = default_; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectoryOpen16.gif b/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectoryOpen16.gif deleted file mode 100644 index a53b93c1e..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectoryOpen16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectoryOpen32.gif b/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectoryOpen32.gif deleted file mode 100644 index a456fd07d..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VIFSDirectoryOpen32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VIFSFile.java b/cvsroot/src/com/ibm/as400/vaccess/VIFSFile.java deleted file mode 100644 index 2b4a569f1..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VIFSFile.java +++ /dev/null @@ -1,740 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VIFSFile.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.IFSFile; -import com.ibm.as400.access.Permission; -import com.ibm.as400.access.Trace; -import javax.swing.Icon; -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.Date; -import java.util.Enumeration; -import java.util.Vector; - - - -/** -The VIFSFile class defines the representation of a file -in the integrated file system for use in -various models and panes in this package. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VIFSFile objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • VObjectEvent -
    • WorkingEvent -
    - -@see com.ibm.as400.access.IFSFile -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -// -// Implementation note: -// -// * I made a conscious decision not to make this fire -// file events. The reason is that I just don't think -// it will be used that way. -// -public class VIFSFile -implements VObject, VIFSConstants, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String description_ = ResourceLoader.getText ("IFS_FILE_DESCRIPTION"); - private static final Icon icon16_ = ResourceLoader.getIcon ("VIFSFile16.gif", description_); - private static final Icon icon32_ = ResourceLoader.getIcon ("VIFSFile32.gif", description_); - private static final String readAbbreviationText_ = ResourceLoader.getText ("IFS_READ_ABBREVIATION"); - private static final String writeAbbreviationText_ = ResourceLoader.getText ("IFS_WRITE_ABBREVIATION"); - - - - // Properties. - IFSFile file_ = null; // @C2C - - - - // Private data. - transient private VAction[] actions_; - transient private boolean actionsInitialized_; //@B4A - transient private String attributes_; - transient private VAction defaultAction_; - transient private Date modified_; - transient private VPropertiesPane propertiesPane_; - transient private boolean readable_; - transient private Long size_; - transient private boolean writable_; - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private VObjectEventSupport objectEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - transient private WorkingEventSupport workingEventSupport_; - - - -/** -Constructs a VIFSFile object. The system and path properties -will need to be set before using any method requiring a -connection to the system. -**/ - public VIFSFile () - { - file_ = new IFSFile (); - initializeTransient (); - } - - - -/** -Constructs a VIFSFile object. - -@param file The file. -**/ - public VIFSFile (IFSFile file) - { - if (file == null) - throw new NullPointerException ("file"); - - file_ = file; - initializeTransient (); - } - - - -/** -Constructs a VIFSFile object. - -@param system The system on which the file resides. -@param path The fully qualified path name of the file. -**/ - public VIFSFile (AS400 system, String path) - { - if (system == null) - throw new NullPointerException ("system"); - if (path == null) - throw new NullPointerException ("path"); - - file_ = new IFSFile (system, path); - initializeTransient (); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Indicates if the file is readable. - -@return true if the file is readable, false otherwise. -**/ - boolean canRead () - { - return readable_; - } - - - -/** -Indicates if the file is writable. - -@return true if the file is writable; false otherwise. -**/ - boolean canWrite () - { - return writable_; - } - - - -/** -Returns the list of actions that can be performed. -
      -
    • edit -
    • view -
    • rename -
    • delete -
    - -@return The actions that can be performed. -**/ - public VAction[] getActions () - { - initializeCreationActions (); //@B4A - return actions_; - } - - - -/** -Returns the default action. The default action is to edit -the file. - -@return The default action. -**/ - public VAction getDefaultAction () - { - return defaultAction_; - } - - - -/** -Returns the icon. - -@param size The icon size, either 16 or 32. If any other - value is given, then return a default. -@param open This parameter has no effect. -@return The icon. -**/ - public Icon getIcon (int size, boolean open) - { - if (size == 32) - return icon32_; - else - return icon16_; - } - - - -/** -Returns the last modified date. - -@return The last modified date. -**/ - Date getModified () - { - return modified_; - } - - - -/** -Returns the file name. - -@return The file name. - -@see com.ibm.as400.access.IFSFile#getName -**/ - public String getName () - { - return file_.getName (); - } - - - -/** -Returns the parent directory name. - -@return The parent directory name. - -@see com.ibm.as400.access.IFSFile#getParent -**/ - public String getParentDirectory () - { - return file_.getParent (); - } - - - -/** -Returns the fully qualified path name of the file. - -@return The fully qualified path name of the file. - -@see com.ibm.as400.access.IFSFile#getPath -**/ - public String getPath () - { - return file_.getPath (); - } - - - -/** -Returns the properties pane. - -@return The properties pane. -**/ - public VPropertiesPane getPropertiesPane () - { - return propertiesPane_; - } - - - -/** -Returns a property value. - -@param propertyIdentifier The property identifier. The choices are -
      -
    • NAME_PROPERTY -
    • DESCRIPTION_PROPERTY -
    • SIZE_PROPERTY -
    • MODIFIED_PROPERTY -
    • ATTRIBUTES_PROPERTY -
    -@return The property value, or null if the - property identifier is not recognized. -**/ - public synchronized Object getPropertyValue (Object propertyIdentifier) - { - // Get the file name. - if (propertyIdentifier == NAME_PROPERTY) - return this; - - // Get the description. - else if (propertyIdentifier == DESCRIPTION_PROPERTY) - return description_; - - // Get the file size. - else if (propertyIdentifier == SIZE_PROPERTY) - return size_; - - // Get the file modified timestamp. - else if (propertyIdentifier == MODIFIED_PROPERTY) - return modified_; - - // Get the file attributes. - else if (propertyIdentifier == ATTRIBUTES_PROPERTY) - return attributes_; - - // By default, return null. - return null; - } - - - -/** -Returns the size. - -@return The size. -**/ - long getSize () - { - return size_.longValue (); - } - - - -/** -Returns the system on which the file resides. - -@return The system on which the file resides. - -@see com.ibm.as400.access.IFSFile#getSystem -**/ - public AS400 getSystem () - { - return file_.getSystem (); - } - - - -/** -Returns the text. This is the name of the file. - -@return The text which is the name of the file. -**/ - public String getText () - { - return file_.getName (); - } - - -//@B4A -/** -If we are dealing with an object that is under QDLS or QSYS, -disables the "creation" actions. -**/ - private void initializeCreationActions () - { - if (actionsInitialized_) return; //@B4A - // @B4C - This block was formerly located in initializeTransient(). - // @B3A - // If we are operating on an object that is in QDLS or QSYS, - // we want to disable the creation and editing - // actions, since there are problems with creating folders and - // things in areas of the file system that aren't normal IFS. - // Note: The Rename action works, assuming the user knows the - // proper naming convention for the object they are changing. - // The Delete action works since the object was pre-existing - // and there wouldn't be naming problems. - // The Edit and View actions are useless on almost all objects - // so we disable them. - -// Permission perm = ((PermissionAction)actions_[4]).getPermission (); //@B4C @B5D -// if (perm != null && perm.getType() != Permission.TYPE_ROOT) @B5D - - String pathPrefix = file_.getPath().toUpperCase(); //@B5A - if (pathPrefix.startsWith("/QSYS.LIB/") || //@B5A - pathPrefix.startsWith("/QDLS/")) //@B5A - { - for (int i=0; i<2; ++i) - actions_[i].setEnabled(false); - defaultAction_ = actions_[4]; // Change default action to Permission. - } - actionsInitialized_ = true; //@B4A - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - objectEventSupport_ = new VObjectEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - file_.addPropertyChangeListener (propertyChangeSupport_); - file_.addVetoableChangeListener (vetoableChangeSupport_); - addVObjectListener(new VObjectListener_()); // @C2A - - // Initialize the actions. - actions_ = new VAction[5]; //@A1C Changed from [4] to [5] - actions_[0] = new IFSEditAction (this, file_, true); // Edit - actions_[1] = new IFSEditAction (this, file_, false); // View. - actions_[2] = new IFSRenameAction (this, file_); - actions_[3] = new IFSDeleteAction (this, file_); - actions_[4] = new PermissionAction(file_); // @A1A Add PermissionAction - defaultAction_ = actions_[0]; - - //@B4C - // Postpone disabling the creation actions until we need to use the actions. - actionsInitialized_ = false; //@B4C - - for (int i = 0; i < actions_.length; ++i) { - actions_[i].addErrorListener (errorEventSupport_); - actions_[i].addVObjectListener (objectEventSupport_); - actions_[i].addWorkingListener (workingEventSupport_); - } - - // Initialize the properties pane. - propertiesPane_ = new IFSFilePropertiesPane (this); - - propertiesPane_.addErrorListener (errorEventSupport_); - propertiesPane_.addVObjectListener (objectEventSupport_); - propertiesPane_.addWorkingListener (workingEventSupport_); - - // Initialize the details values. - attributes_ = ""; - - // $B2 - Use the system current date for file creation - modified_ = new Date (); - - readable_ = false; - size_ = new Long (0); - writable_ = false; - } - - - -/** -Loads information about the object from the system. -**/ - public void load () - { - workingEventSupport_.fireStartWorking (); - initializeCreationActions (); //@B4A - - // Load the size. - try { - size_ = new Long (file_.length()); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - size_ = new Long (0); - } - - // Load the modified date. - try { - modified_ = new Date (file_.lastModified()); - } - catch (Exception e) { - modified_ = new Date (0); - errorEventSupport_.fireError (e); - } - - // Load the attributes. - try { - readable_ = file_.canRead (); - } - catch (Exception e) { - readable_ = false; - errorEventSupport_.fireError (e); - } - - try { - writable_ = file_.canWrite (); - } - catch (Exception e) { - writable_ = false; - errorEventSupport_.fireError (e); - } - - StringBuffer buffer = new StringBuffer (); - if (readable_) - buffer.append (readAbbreviationText_); - if (writable_) - buffer.append (writeAbbreviationText_); - attributes_ = buffer.toString (); - - // Done loading. - workingEventSupport_.fireStopWorking (); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Sets the fully qualified path name of the file. - -@param path The fully qualified path name of the file. - -@exception PropertyVetoException If the change is vetoed. - -@see com.ibm.as400.access.IFSFile#setPath -**/ - public void setPath (String path) - throws PropertyVetoException - { - if (path == null) - throw new NullPointerException ("path"); - - file_.setPath (path); - } - - - -/** -Sets the system on which the file resides. - -@param system The system on which the file resides. - -@exception PropertyVetoException If the change is vetoed. - -@see com.ibm.as400.access.IFSFile#setSystem -**/ - public void setSystem (AS400 system) - throws PropertyVetoException - { - if (system == null) - throw new NullPointerException ("system"); - - file_.setSystem (system); - } - - - -/** -Returns the string representation of the name of the file. - -@return The string representation of the name of the file. -**/ - public String toString () - { - return file_.getName (); - } - - - - -// @C2A -/** -Listens for events and clears the cached attributes when -the object changes. This will ensure the the file size -and last modification date, etc., will be reflected. -**/ - private class VObjectListener_ - implements VObjectListener, Serializable - { - public void objectChanged (VObjectEvent event) - { - file_.clearCachedAttributes(); - } - - - - public void objectCreated (VObjectEvent event) - { - } - - - - public void objectDeleted (VObjectEvent event) - { - } - - - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VIFSFile16.gif b/cvsroot/src/com/ibm/as400/vaccess/VIFSFile16.gif deleted file mode 100644 index dcac2e9a4..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VIFSFile16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VIFSFile32.gif b/cvsroot/src/com/ibm/as400/vaccess/VIFSFile32.gif deleted file mode 100644 index 2ee958841..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VIFSFile32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VJavaApplicationCall.java b/cvsroot/src/com/ibm/as400/vaccess/VJavaApplicationCall.java deleted file mode 100644 index 667d550ac..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VJavaApplicationCall.java +++ /dev/null @@ -1,1039 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VJavaApplicationCall.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.BorderLayout; -import java.awt.event.*; -import java.awt.Rectangle; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.PrintWriter; -import java.util.Properties; -import java.util.StringTokenizer; -import java.util.Vector; -import java.util.Enumeration; - -import com.ibm.as400.access.ExtendedIllegalStateException; -import com.ibm.as400.access.ActionCompletedListener; -import com.ibm.as400.access.ActionCompletedEvent; -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.JavaApplicationCall; -import com.ibm.as400.access.Trace; - -import javax.swing.JComponent; -import javax.swing.JPanel; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import javax.swing.JLabel; -import javax.swing.JScrollPane; - -/** - * - *

    - *Provides a visual interface to - *{@link com.ibm.as400.access.JavaApplicationCall JavaApplicationCall}. The visual interface - *consists of two components: an input field where the program - *to run is specified and input is sent to the program, and - *an output text area where the output from the program is displayed. - * - *

    - *GUI output generated by the Java program running on the system - *is not handled by this class. - *As in JavaApplicationCall, the Java program running on the system - *receives input via standard. The output text area displays output - *the system java program writes to standard out and standard error. - *GUI input/output must be handled via another mechanism such as - *Remote AWT. - * - *

    - *There are two ways to set up the system Java environment: - *

      - *
    1. VJavaApplicationCall - *must have a JavaApplicationCall object. After creating the JavaApplicationCall - *object, the application can set environment parameters on the JavaApplicationCall, - *object, then construct - *the VJavaApplicationCall object passing it the JavaApplicationCall object. - *The advantage to this method is the application sets up the environment instead - *of the user. - *
    2. - *The environment can be set up via - *set commands entered in the GUI. - *For additional information on these commands, - *see the on-line help for the Java command. Valid commands are: - *
        - *
      • Classpath - the value of the CLASSPATH environment variable. Directories are separated by colons. - *
      • DefaultPort - the default port for communicating standard in, standard out and standard error between the client and the system java environment. - *
      • FindPort - indicates if the client should search for a free port if the default port is in use. - *
      • Interpret - indicates if all Java class files should be run interpretively. - *
      • Optimize - the optimization level for classes not yet optimized. - *
      • Options - additional options used when running the Java class. - *
      • SecurityCheckLevel - the level of warnings given for directories in the CLASSPATH that have public write authority. - *
      • GarbageCollectionFrequency - the relative frequency that garbage collection runs. - *
      • GarbageCollectionInitialSize - the initial size, in kilobytes, of the garbage collection heap. - *
      • GarbageCollectionMaximumSize - the maximum size, in kilobytes, that the garbage collection heap can grow to. - *
      • GarbageCollectionPriority - the priority of the tasks running garbage collection. - *
      - *For example, to send the optimization level to 30, enter
      - *
      - *set optimize=30
      - *
      - *
    - * - *

    - *You start the Java application using the java command. The - *syntax for this command is much like the syntax when running the command - *on the client. It is - *

    - *java [-classpath=value] [-verbose] [-Dproperty=value -Dproperty=value [...]] class [parm1 parm2 [...]]]
    - *
    - *Note, this class correctly sets the standard in, standard out and standard - *error properties so os400.stdin, os400.stdout - *or os400.stderr properties are ignored. - *For example, to run Java application - *
    - *java -classpath=/myClasses:/myClasses/lib/package.jar myProgram parm1 parm2
    - *
    - * - *To use this class you simply create a frame to contain the class - *then call the load() method to run the start the application. For example, - * - * - *
    - *AS400 system = new AS400("myAS400");
    - *
    - * JavaApplicationCall javaCall  = new  JavaApplicationCall(system);
    - *VJavaApplicationCall vJavaCall = new VJavaApplicationCall(javaCall);
    - *
    - *JFrame f = new JFrame ("JavaApplicationCallExample");
    - *f.getContentPane().setLayout(new BorderLayout ());
    - *f.getContentPane().add("Center", vJavaCall);
    - *f.pack();
    - *f.show();
    - *
    - -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VJavaApplicationCall extends JComponent - implements KeyListener -{ - // These variables represent event support. - private transient ErrorEventSupport errorEventSupport_; - private transient PropertyChangeSupport propertyChangeSupport_; - private transient VetoableChangeSupport vetoableChangeSupport_; - private transient WorkingEventSupport workingEventSupport_; - - // Private variable representing the object of JavaApplicationCall. - private JavaApplicationCall javaAppCall_ = null; - - // Private variable representing the initial value of the classpath. - private String classPath_ = ""; - - // List of user commands - private Vector inputVector_ ; - - // Index of current command in input vector - private int inputIndex_ = 0; - - // Private variable representing string input by user. - private String inputStr_; - - // Private variable representing the object of JTextField into which user input command. - private JTextField inputText_; - private JScrollPane scrollPane_; - - // Private variable, if true the program is complete - private boolean javaRunOver_ = true; - - // Private variable representing the default value of Options. - private String [] optionArray_ = {"*NONE"}; - - // Private variable representing the object of JTextArea on which the output and error - // messages are displayed. - private JTextArea outputText_; - - // Private variable representing the number of parameter in command string. - private int paramNum_; - - // Private variable representing the object of StringTokenizer. - // messages are displayed. - private StringTokenizer strToken_; - - // Private variable representing the object of VJavaGetResult which is responsible - // for running the remote java application and getting the result. - private VJavaGetResult vJavaGetResult_; - - private boolean hasNext = false; - private boolean hasPrevious = false; - private boolean firstDraw = true; - - private long linesWritten_ = 0; - private static final int ROWS = 24; - private static final int COLUMNS = 72; - - /** - * Constructs a VJavaApplicationCall object. - **/ - public VJavaApplicationCall() - { - // javaAppCall_ = new JavaApplicationCall(); - initialize(); - } - - - - /** - * Constructs a VJavaApplicationCall object. A JavaApplicationCall - * object defines the Java program to run. - * - * @param javaApplicationCall The access class which defines the - * Java application to run. - **/ - public VJavaApplicationCall(JavaApplicationCall javaApplicationCall) - { - if(javaApplicationCall == null) - throw new NullPointerException ("JavaApplicationCall"); - - javaAppCall_ = javaApplicationCall; - initialize(); - } - - /** - * Adds a listener to be notified when an error occurs. - * - * @see #removeErrorListener - * @param listener The listener. - **/ - public void addErrorListener( ErrorListener listener ) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - errorEventSupport_.addErrorListener(listener); - } - - - /** - * Notification to VJavaApplicationCall that it now has a parent component. - * The windowing system calls this method - * when VJavaApplicationCall gets a parent frame. When called - * VJavaApplicationCall - * requsts input focus be given to the input field. - *

    - * Since this method is - * called by Swing at the appropriate time, application code should not - * call this method. - **/ - public void addNotify() - { - super.addNotify(); - inputText_.requestFocus(); - } - - - /** - * Adds a listener to be notified when the value of any bound property - * changes. - * - * @see #removePropertyChangeListener - * @param listener The listener. - **/ - public void addPropertyChangeListener( PropertyChangeListener listener ) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - - propertyChangeSupport_.addPropertyChangeListener(listener); - } - - /** - * Adds a listener to be notified when the value of any constrained - * property changes. - * - * @see #removeVetoableChangeListener - * @param listener The listener. - **/ - public void addVetoableChangeListener( VetoableChangeListener listener ) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - - vetoableChangeSupport_.addVetoableChangeListener(listener); - } - - /** - * Adds a listener to be notified when work starts and stops on potentially long running operations. - * - * @param listener The listener. - **/ - public void addWorkingListener(WorkingListener listener) - { - if (listener == null) - { - throw new NullPointerException("listener"); - } - - workingEventSupport_.addWorkingListener(listener); - } - - - - // write output to the text window then move the scrollbar so the - // user always sees the latest text. - void appendOutput(String output) - { - outputText_.append(output); - - linesWritten_ ++; - - int tx = outputText_.getSize().width; - int ty = outputText_.getSize().height; - - Rectangle rect = new Rectangle(0,ty-2,tx-1,ty-1); - - if (linesWritten_ < ROWS) - { - int pixelsPerLine = ty / ROWS; - - if (pixelsPerLine > 0) - { - int visableLines = scrollPane_.getSize().height / pixelsPerLine; - if (linesWritten_ > visableLines) - outputText_.scrollRectToVisible(rect); - } - } - else - { - if(ty > scrollPane_.getSize().height) - outputText_.scrollRectToVisible(rect); - } - } - - - - - - /** - * Stops all threads. - @exception Throwable If an error occurs during cleanup. - **/ - protected void finalize() throws Throwable - { - vJavaGetResult_ = null; - super.finalize(); - } - - /** - * Returns the access class which defines the Java application to run. - * - * @return The the com.ibm.as400.access.JavaApplicationCall object - * which defines the Java application to run. - **/ - public JavaApplicationCall getJavaApplicationCall() - { - return javaAppCall_; - } - - /** - * Returns a reference to the JTextArea object. Standard output and - * standard error information from the system Java program are displayed - * in this text area. The - * application can use the reference to the JTextArea to modify - * attributes such as the size of the text area - * or the font used to display text in the text area. - * - * @return The JTextArea object which displays standard output - * and standard error from the system Java program. - **/ - public JTextArea getOutputText() - { - return outputText_; - } - - - /** - * Initializes the event support and displays the GUI. - **/ - private void initialize() - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport(this); - propertyChangeSupport_ = new PropertyChangeSupport(this); - vetoableChangeSupport_ = new VetoableChangeSupport(this); - workingEventSupport_ = new WorkingEventSupport (this); - inputVector_ = new Vector(); - - setLayout(new BorderLayout()); - JPanel part1=new JPanel(new BorderLayout()); - - JLabel outputLabel = new JLabel(ResourceLoader.getText("REMOTE_OUTPUT_LABEL")); - JLabel inputLabel = new JLabel(ResourceLoader.getText("REMOTE_INPUT_LABEL")); - outputText_ = new JTextArea(); - outputText_.setEditable(false); - outputText_.setRows(ROWS); - outputText_.setColumns(COLUMNS); - scrollPane_ = new JScrollPane(outputText_); - scrollPane_.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - inputText_ = new JTextField(); - - part1.add(outputLabel,BorderLayout.NORTH); - part1.add(scrollPane_,BorderLayout.CENTER); - - JPanel part2=new JPanel(new BorderLayout()); - part2.add(inputLabel,BorderLayout.NORTH); - part2.add(inputText_,BorderLayout.CENTER); - - add(part1,BorderLayout.CENTER); - add(part2,BorderLayout.SOUTH); - - inputText_.addKeyListener(this); - appendOutput(ResourceLoader.getText("REMOTE_PROMPT")); - } - - - /** - * A key is pressed. - * @param keyEvent The key event. - **/ - public void keyPressed(KeyEvent keyEvent){} - - - /** - * The key is released. - * @param keyEvent The key event. - **/ - public void keyReleased(KeyEvent keyEvent) - { - if (javaAppCall_ == null) - throw new ExtendedIllegalStateException("JavaApplicationCall", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - - switch (keyEvent.getKeyCode()) - { - case KeyEvent.VK_ENTER : - processEnter(); - break; - case KeyEvent.VK_PAGE_DOWN : - if(inputVector_.size() >0) - { - inputIndex_ = inputVector_.size() -1; - inputText_.setText((String) inputVector_.elementAt(inputIndex_)); - } - break; - case KeyEvent.VK_PAGE_UP : - if(inputVector_.size()>0) - { - inputIndex_ = 0; - inputText_.setText((String) inputVector_.elementAt(inputIndex_)); - } - break; - case KeyEvent.VK_UP : - if(inputVector_.size()>0) - { - if(hasPrevious) // press Up and get the previous command. - { - if(inputIndex_ >0) - inputIndex_ -= 1; - inputText_.setText((String) inputVector_.elementAt(inputIndex_)); - } - else - inputText_.setText((String) inputVector_.elementAt(inputIndex_)); - hasPrevious = true; - hasNext = true; - } - break; - case KeyEvent.VK_DOWN : - if(inputVector_.size()>0) - { - if(hasNext) // press Down and get the next command. - { - if(inputIndex_ < inputVector_.size()-1) - inputIndex_ +=1; - inputText_.setText((String) inputVector_.elementAt(inputIndex_)); - hasPrevious = true; - } - } - break; - case KeyEvent.VK_ESCAPE : - inputText_.setText(""); - } - } - - /** - * The key is typed. - * @param keyEvent The key event. - **/ - public void keyTyped(KeyEvent keyEvent){} - - - - - /** - * Loads information produced by the Java Application run on the system. - **/ - private void load() - { - if (vJavaGetResult_ == null) - vJavaGetResult_ = new VJavaGetResult(this); - - try - { - javaAppCall_.getSystem().connectService(AS400.COMMAND); - } - catch (Exception e) - { - appendOutput(e.toString() + "\n"); - appendOutput("\n"+ResourceLoader.getText("REMOTE_PROMPT")); - return; - } - - appendOutput(ResourceLoader.getText("REMOTE_JAVA_START")); - appendOutput(javaAppCall_.getJavaApplication()+"\n\n"); - vJavaGetResult_.play(); - } - - /** - * - * Displays the values of the corresponding properties. - **/ - private void processDCommand() - { - if(paramNum_>1) - { - appendOutput(ResourceLoader.getText("REMOTE_COMMAND_ERROR")+"\n"); - appendOutput("\n"+ResourceLoader.getText("REMOTE_PROMPT")); - } - else - { - appendOutput(ResourceLoader.getText("REMOTE_D_LINE1")+"\n"); - appendOutput(ResourceLoader.getText("REMOTE_D_LINE2")); - appendOutput(javaAppCall_.getSecurityCheckLevel()+"\n"); - appendOutput(ResourceLoader.getText("REMOTE_D_LINE3")); - appendOutput(classPath_+"\n"); - appendOutput(ResourceLoader.getText("REMOTE_D_LINE4")); - appendOutput(javaAppCall_.getGarbageCollectionFrequency()+"\n"); - appendOutput(ResourceLoader.getText("REMOTE_D_LINE5")); - appendOutput(javaAppCall_.getGarbageCollectionInitialSize()+"\n"); - appendOutput(ResourceLoader.getText("REMOTE_D_LINE6")); - appendOutput(javaAppCall_.getGarbageCollectionMaximumSize()+"\n"); - appendOutput(ResourceLoader.getText("REMOTE_D_LINE7")); - appendOutput(javaAppCall_.getGarbageCollectionPriority()+"\n"); - appendOutput(ResourceLoader.getText("REMOTE_D_LINE8")); - appendOutput(javaAppCall_.getInterpret()+"\n"); - appendOutput(ResourceLoader.getText("REMOTE_D_LINE9")); - appendOutput(javaAppCall_.getOptimization()+"\n"); - appendOutput(ResourceLoader.getText("REMOTE_D_LINE10")); - // get the value of Options - StringBuffer optionStr = new StringBuffer(); - for(int i=0;i< optionArray_.length;i++) - { - optionStr.append(optionArray_[i]); - optionStr.append(" "); - } - appendOutput(optionStr.toString() +"\n"); - - appendOutput(ResourceLoader.getText("REMOTE_D_LINE11")); - appendOutput(javaAppCall_.getDefaultPort()+"\n"); - appendOutput(ResourceLoader.getText("REMOTE_D_LINE12")); - appendOutput(javaAppCall_.isFindPort()+"\n"); - - appendOutput("\n"+ResourceLoader.getText("REMOTE_PROMPT")); - } - } - - - /** - * Invoked when the user presses the enter key. - * - * @param event The ActionEvent. - **/ - void processEnter() - { - if (javaAppCall_ == null) - throw new ExtendedIllegalStateException("JavaApplicationCall", - ExtendedIllegalStateException.PROPERTY_NOT_SET); - - // check the application whether completed - if(javaRunOver_) - { - if(inputText_.getText().trim().equals(""))// process Return key - { - appendOutput("\n"+ResourceLoader.getText("REMOTE_PROMPT")); - } - else - { - if(inputVector_.size() >0) - { - int tempIndex = inputIndex_; - int vectorSize = inputVector_.size(); - - String lastInput = (String)inputVector_.lastElement(); - String currentInput = (String) inputVector_.elementAt(tempIndex); - // enter a command that is not the same as the last command - if(!lastInput.equalsIgnoreCase(inputText_.getText())) - { - inputVector_.addElement(inputText_.getText()); - } - hasNext = false; // Press Down, can not get next command. - hasPrevious = false; - vectorSize = inputVector_.size(); - inputIndex_ = vectorSize -1 ; - // keep the original command and press enter - if((tempIndex < vectorSize -1)&&inputText_.getText().equals(currentInput)) - { - inputIndex_ = tempIndex; - hasNext = true; // Press Down , can get next command. - } - } - else - { - inputVector_.addElement(inputText_.getText()); - inputIndex_ = 0; - hasNext = false; - hasPrevious = false; - } - // Get the original height of the outputText_ - appendOutput(inputText_.getText()+"\n"); - inputStr_ = inputText_.getText().trim(); - inputText_.setText(""); - strToken_ = new StringTokenizer(inputStr_ ," "); - paramNum_ = strToken_.countTokens(); - String commandStr = strToken_.nextToken().toUpperCase(); - if(commandStr.equals("JAVA")) - { - processJavaCommand(); - } - else if(commandStr.equals("D")) - { - processDCommand(); - } - else if(commandStr.equals("SET")) - { - processSetCommand(); - } - else if ((commandStr.equals("HELP")) || - (commandStr.equals("?")) || - (commandStr.equals("H"))) - { - processHelpCommand(); - } - else if ((commandStr.equals("QUIT")) || (commandStr.equals("Q"))) - { - if(paramNum_ > 1) - { - appendOutput(ResourceLoader.getText("REMOTE_COMMAND_ERROR")+"\n"); - appendOutput("\n"+ResourceLoader.getText("REMOTE_PROMPT")); - } - else - System.exit(0); - } - else - { - appendOutput(ResourceLoader.getText("REMOTE_COMMAND_ERROR")+"\n"); - appendOutput("\n"+ResourceLoader.getText("REMOTE_PROMPT")); - } - } - } - else // This is data to be sent to the application. - { - appendOutput(inputText_.getText()+"\n"); - inputStr_ = inputText_.getText(); - inputText_.setText(""); - javaAppCall_.sendStandardInString(inputStr_); - } - } - - - /** - * - * Process the help command. - **/ - private void processHelpCommand() - { - if(paramNum_>1) - { - appendOutput(ResourceLoader.getText("REMOTE_COMMAND_ERROR")+"\n"); - appendOutput("\n"+ResourceLoader.getText("REMOTE_PROMPT")); - } - else - { - appendOutput(ResourceLoader.getText("REMOTE_HELP")); - appendOutput("\n"+ResourceLoader.getText("REMOTE_PROMPT")); - } - } - - /** - * - * Process the java command. - **/ - private void processJavaCommand() - { - Properties prop = new Properties(); ; - String javaAppName = "" ; - String classPath = ""; - Vector param = new Vector(); - - if(paramNum_ == 1) - { - appendOutput(ResourceLoader.getText("REMOTE_JAVA_ERROR")+"\n"); - appendOutput("\n"+ResourceLoader.getText("REMOTE_PROMPT")); - } - else - { - Vector cmdVector = new Vector(); - while(strToken_.hasMoreTokens()) - { - cmdVector.addElement(strToken_.nextToken()); - } - int vectorSize = cmdVector.size(); - - // find the java application - int javaIndex = 0; - boolean findJavaApp = false; - while(javaIndex < vectorSize) - { - if(!(( String) cmdVector.elementAt(javaIndex)).startsWith("-")) - { - javaAppName = (String) cmdVector.elementAt(javaIndex); - findJavaApp = true; - break; - } - javaIndex += 1; - } - if(findJavaApp) // java application is found - { - boolean findError = false; - boolean findClassPath = false; - boolean findVerbose = false; - boolean findProperty = false; - int i = 0; - while( i < javaIndex) - { - if(( (String) cmdVector.elementAt(i)).toUpperCase().startsWith("-CLASSPATH")) - { - if (!findClassPath) // only allow setting classpath one time in one command string - { - findClassPath = true; - String propertyValue = (String) cmdVector.elementAt(i); - int index = propertyValue.indexOf("="); - // check the format of the classpath - if ((index >0)&& ( index +1 < propertyValue.length())) - { - classPath = propertyValue.substring(index+1); - } - else - { - findError = true; - break; - } - } - else - { - findError = true; - break; - } - } - else if(( (String) cmdVector.elementAt(i)).toUpperCase().startsWith("-D")) - { - String tempStr = (String) cmdVector.elementAt(i); - String propStr = tempStr.substring(2); - StringTokenizer propToken = new StringTokenizer(propStr,"="); - - if ( propToken.countTokens() >= 2) - { - String propKey = propToken.nextToken(); - String propertyValue = (String) cmdVector.elementAt(i); - int index = propertyValue.indexOf("="); - String propValue = propertyValue.substring(index+1); - prop.put(propKey,propValue); - } - else - { - findError = true; - break; - } - findProperty = true; - } - else if(( (String) cmdVector.elementAt(i)).toUpperCase().startsWith("-VERBOSE")) - { - if (!findVerbose) - { - findVerbose = true; - } - else - { - findError = true; - break; - } - } - else - { - findError = true; - break; - } - i += 1; - } - // find the parameters of the java application - i = javaIndex + 1; - boolean findParam = false; - while(( i < vectorSize) && !findError) - { - findParam = true; - param.addElement(cmdVector.elementAt(i)); - i += 1; - } - if(!findError) // No error in the command string. - { - try - { - javaAppCall_.setJavaApplication(javaAppName); - if (findParam) - { - String [] paramArray = new String[param.size()]; - for(int j=0;jcom.ibm.as400.access -**/ -public class VJavaApplicationCallBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private final static Class beanClass_ = VJavaApplicationCall.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - // Static initializer. - static - { - try - { - // Events. - EventSetDescriptor propertyChange = new EventSetDescriptor ( - beanClass_, - "propertyChange", - PropertyChangeListener.class, - "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - events_ = new EventSetDescriptor[] { propertyChange }; - - // Properties. - PropertyDescriptor javaAppCall = - new PropertyDescriptor("javaApplicationCallObject", beanClass_, - "getJavaApplicationCall", - "setJavaApplicationCall"); - javaAppCall.setBound(true); - javaAppCall.setConstrained(true); - javaAppCall.setDisplayName(ResourceLoader.getText("PROP_NAME_JAC")); - javaAppCall.setShortDescription(ResourceLoader.getText("PROP_DESC_JAC")); - - properties_ = new PropertyDescriptor[]{ - javaAppCall - }; - } - catch(IntrospectionException e) - { - throw new Error(e.toString()); - } - } - /** - * Returns the bean descriptor. - * - * @return The bean descriptor. - **/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - /** - * Returns the default event index. - * @return The default event index (always 1). - **/ - public int getDefaultEventIndex() - { - return 1; - } - - /** - * Returns the default property index. - * @return The default property index (always 0). - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - * Returns the descriptors for all events. - * @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an Image for this bean's icon. - * @param icon The desired icon size and color. - * @return The Image for the icon. - */ - public Image getIcon(int icon) - { - Image image = null; - - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage("VJavaApplicationCall16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage("VJavaApplicationCall32.gif"); - break; - } - return image; - } - - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VJavaGetResult.java b/cvsroot/src/com/ibm/as400/vaccess/VJavaGetResult.java deleted file mode 100644 index 43a26f923..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VJavaGetResult.java +++ /dev/null @@ -1,199 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VJavaGetResult.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.JTextArea; -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.JavaApplicationCall; -import com.ibm.as400.access.Trace; - -/** - * The VJavaGetResult class runs the java application - * and returns its results to the VJavaApplicationCall. - */ -class VJavaGetResult implements Runnable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private variable representing the object of VJavaApplicationCall. - private VJavaApplicationCall vJavaAppCall_; - - // Private variable representing the object of JavaApplicationCall. - private JavaApplicationCall javaAppCall_; - - // Private variable indicating when the java application is - // complete. - private boolean javaAppRunOver_ = false; - - // Private variable representing the thread that runs the method call - // of JavaApplicationCall. - private Thread runAppThread_; - - // Private variable representing the thread that gets the results - // from the java application. - private Thread outputThread_; - - // Private variable representing the thread that gets the error information. - private Thread errorThread_; - - // This counter is used to make sure we don't close the sockets - // before all output is out of the pipe. The main thread (the - // one just returned from the the program call) will wait to - // close sockets until all data is out of the sockets. - long readCounter_ = 0; // @D1A - - /** - * Constructs a VJavaGetResult object. - * - * @param vJavaAppCall The VJavaApplicationCall object. - **/ - public VJavaGetResult(VJavaApplicationCall vJavaAppCall) - { - vJavaAppCall_ = vJavaAppCall; - javaAppCall_ = vJavaAppCall_.getJavaApplicationCall(); - } - - - private void delay() //@D1a - { //@D1a - try { Thread.sleep(100); } //@D1a - catch (Exception e) {} //@D1a - } //@D1a - - - /** - * Stops the threads. - **/ - protected void finalize() throws Throwable - { - runAppThread_ = null; - errorThread_ = null; - outputThread_ = null; - super.finalize(); - } - - /** - * Starts the threads for running java application and gets the results. - **/ - public void play() - { - javaAppRunOver_ = false; - outputThread_ = new Thread(this); - errorThread_ = new Thread(this); - outputThread_.start(); - errorThread_.start(); - - runAppThread_ = new Thread(this); - runAppThread_.start(); - } - - /** - * Runs the java application and gets the results. - **/ - public void run() - { - - if(Thread.currentThread() == runAppThread_) - { - vJavaAppCall_.setJavaAppRunOver(false); - try - { - javaAppCall_.run(); - } - catch(Exception e) - { - Trace.log(Trace.ERROR,e.toString()); - vJavaAppCall_.appendOutput(e.toString()); - } - - com.ibm.as400.access.AS400Message[] messageList = javaAppCall_.getMessageList(); - if ((messageList != null) && (messageList.length > 0 )) - { - for(int i=0; iMost errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VJob objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • VObjectEvent -
    • WorkingEvent -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ - -public class VJob -implements VNode, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // MRI - private static String description_ = ResourceLoader.getText ("JOB_DESCRIPTION"); - private static Icon icon16_ = ResourceLoader.getIcon ("VJob16.gif", description_); - private static Icon icon32_ = ResourceLoader.getIcon ("VJob32.gif", description_); - private static String dateColumnHeader_ = ResourceLoader.getText ("MESSAGE_DATE"); - private static String fromProgramColumnHeader_ = ResourceLoader.getText ("MESSAGE_FROM_PROGRAM"); - private static String nameColumnHeader_ = ResourceLoader.getText ("MESSAGE_ID"); - private static String textColumnHeader_ = ResourceLoader.getText ("MESSAGE_TEXT"); - private static String typeColumnHeader_ = ResourceLoader.getText ("MESSAGE_TYPE"); - private static String severityColumnHeader_ = ResourceLoader.getText ("MESSAGE_SEVERITY"); - - - // Properties. - private VNode parent_ = null; - private RJob job_ = null; - private RJobLog jobLog_ = null; - // @A1A : Added action. - transient private VAction[] actions_; //@A3C - - - // Static data. - private static TableColumnModel detailsColumnModel_ = null; - - - - // Private data. - transient private VObject[] detailsChildren_; - transient private boolean loaded_; //@A2A - transient private VPropertiesPane propertiesPane_; - - - // Event support. - transient private ErrorEventSupport errorEventSupport_ /*@A3D= new ErrorEventSupport(this)*/; - transient private PropertyChangeSupport propertyChangeSupport_/*@A3D= new PropertyChangeSupport(this)*/; - transient private VetoableChangeSupport vetoableChangeSupport_/*@A3D= new VetoableChangeSupport(this)*/; - transient private VObjectEventSupport objectEventSupport_ /*@A3D= new VObjectEventSupport(this)*/; - transient private WorkingEventSupport workingEventSupport_ /*@A3D= new WorkingEventSupport(this)*/; - - -// @A1A : Added properties. -/** -Property identifier for the break message handling. -**/ - public static final Object BREAK_MESSAGE_HANDLING_PROPERTY = "BreakMessageHandling"; -/** -Property identifier for the coded character set identifier. -**/ - public static final Object CCSID_PROPERTY = "CCSID"; -/** -Property identifier for the completion status. -**/ - public static final Object COMPLETION_STATUS_PROPERTY = "CompletionStatus"; -/** -Property identifier for the country identifier. -**/ - public static final Object COUNTRY_ID_PROPERTY = "CountryID"; - -/** -Property identifier for the CPU used. -**/ - public static final Object CPUUSED_PROPERTY = "CPUUsed"; - -/** -Property identifier for the current library existence. -**/ - public static final Object CURRENT_LIBRARY_EXISTENCE_PROPERTY = "CurrentLibraryExistence"; - -/** -Property identifier for the current library if one exists. -**/ - public static final Object CURRENT_LIBRARY_PROPERTY = "CurrentLibrary"; - -/** -Property identifier for the date format. -**/ - public static final Object DATE_FORMAT_PROPERTY = "DateFormat"; - -/** -Property identifier for the date and time the job become active. -**/ - public static final Object DATE_JOB_BECAME_ACTIVE_PROPERTY = "DateJobBecomeActive"; - -/** -Property identifier for the date and time the job entered system. -**/ - public static final Object DATE_JOB_ENTERED_SYSTEM_PROPERTY = "DateJobEnterSystem"; - -/** -Property identifier for the date and time the job is scheduled to run. -**/ - public static final Object DATE_JOB_SCHEDULE_TO_RUN_PROPERTY = "DateScheduleRun"; - -/** -Property identifier for the date. -**/ - public static final Object DATE_PROPERTY = "Date"; - -/** -Property identifier for the date and time the job was put on this job queue. -**/ - public static final Object DATE_PUT_ON_JOB_QUEUE_PROPERTY = "DatePutOnJobQueue"; - -/** -Property identifier for the date separator. -**/ - public static final Object DATE_SEPARATOR_PROPERTY = "DateSeparator"; - -/** -Property identifier for the DDM conversation handling. -**/ - public static final Object DDM_CONVERSATION_HANDLING_PROPERTY = "DDMConversationHandling"; - -/** -Property identifier for the decimal format. -**/ - public static final Object DECIMAL_FORMAT_PROPERTY = "DecimalFormat"; - -/** -Property identifier for the default coded character set identifier. -**/ - public static final Object DEFAULT_CCSID_PROPERTY = "DefaultCCSID"; - -/** -Property identifier for the device recovery action. -**/ - public static final Object DEVICE_RECOVERY_ACTION_PROPERTY = "DeviceRecoveryAction"; - -/** -Property identifier for the end severity. -**/ - public static final Object END_SEVERITY_PROPERTY = "EndSeverity"; - -/** -Property identifier for the function. -**/ - public static final Object FUNCTION_PROPERTY = "Function"; - -/** -Property identifier for the inquiry message reply. -**/ - public static final Object INQUIRY_MESSAGE_REPLY_PROPERTY = "InquiryMessageReply"; - -/** -Property identifier for the job accounting code. -**/ - public static final Object JOB_ACCOUNTING_CODE_PROPERTY = "JobAccountingCode"; - -/** -Property identifier for the job date. -**/ - public static final Object JOB_DATE_PROPERTY = "JobDate"; - -/** -Property identifier for the job description. -**/ - public static final Object JOB_DESCRIPTION_PROPERTY = "JobDescription"; - -/** -Property identifier for the job message queue action. -**/ - public static final Object JOB_MESSAGE_QUEUE_FULL_ACTION_PROPERTY = "JobMessageQueueFullAction"; - - /** -Property identifier for the job message maximum size. -**/ - public static final Object JOB_MESSAGE_QUEUE_MAXIMUM_SIZE_PROPERTY = "JobMessageQueueMaximumSize"; - -/** -Property identifier for the job queue priority. -**/ - public static final Object JOB_QUEUE_PRIORITY_PROPERTY = "JobQueuePriority"; - - /** -Property identifier for the job queue. -**/ - public static final Object JOB_QUEUE_PROPERTY = "JobQueue"; - - /** -Property identifier for the job switches. -**/ - public static final Object JOB_SWITCHES_PROPERTY = "JobSwitches"; - -/** -Property identifier for the language identifier. -**/ - public static final Object LANGUAGE_ID_PROPERTY = "LanguageID"; - -/** -Property identifier for the logging of CL programs . -**/ - public static final Object LOGGING_CL_PROGRAMS_PROPERTY = "LoggingCLPrograms"; - -/** -Property identifier for the logging level. -**/ - public static final Object LOGGING_LEVEL_PROPERTY = "LoggingLevel"; - -/** -Property identifier for the logging severity. -**/ - public static final Object LOGGING_SEVERITY_PROPERTY = "LoggingSeverity"; - - /** -Property identifier for the logging text. -**/ - public static final Object LOGGING_TEXT_PROPERTY = "LoggingText"; - - /** -Property identifier for the mode name. -**/ - public static final Object MODE_NAME_PROPERTY = "ModeName"; - -/** -Property identifier for the number. -**/ - public static final Object NUMBER_PROPERTY = "Number"; - -/** -Property identifier for the number of libraries in SYSLIBL. -**/ - public static final Object NUMBER_OF_LIBRARIES_IN_SYSLIBL_PROPERTY = "NumberOfLibrariesInSYSLIBL"; - -/** -Property identifier for the number of libraries in USRLIBL. -**/ - public static final Object NUMBER_OF_LIBRARIES_IN_USRLIBL_PROPERTY = "NumberOfLibrariesInUSRLIBL"; - -/** -Property identifier for the number of product libaries. -**/ - public static final Object NUMBER_OF_PRODUCT_LIBRARIES_PROPERTY = "NumberOfProductLibraries"; - -/** -Property identifier for the output queue priority. -**/ - public static final Object OUTPUT_QUEUE_PRIORITY_PROPERTY = "OutputQueue"; - -/** -Property identifier for the output queue. -**/ - public static final Object OUTPUT_QUEUE_PROPERTY = "OutputQueue"; - - /** -Property identifier for the print key format. -**/ - public static final Object PRINT_KEY_FORMAT_PROPERTY = "PrintKeyFormat"; - -/** -Property identifier for the print text. -**/ - public static final Object PRINT_TEXT_PROPERTY = "PrintText"; - -/** -Property identifier for the printer device name. -**/ - public static final Object PRINTER_DEVICE_NAME_PROPERTY = "PrinterDeviceName"; - -/** -Property identifier for the product libraries if they exist. -**/ - public static final Object PRODUCT_LIBRARIES_PROPERTY = "ProductLibraries"; - - /** -Property identifier for the routing data. -**/ - public static final Object ROUTING_DATA_PROPERTY = "RoutingData"; - -/** -Property identifier for the signed-on job. -**/ - public static final Object SIGNED_ON_JOB_PROPERTY = "SignedOnJob"; - -/** -Property identifier for the sort sequence table. -**/ - public static final Object SORT_SEQUENCE_TABLE_PROPERTY = "SortSequenceTable"; - -/** -Property identifier for the status of the job on the job queue. -**/ - public static final Object STATUS_OF_JOB_ON_JOB_QUEUE_PROPERTY = "StatusOfJobOnJobQueue"; - -/** -Property identifier for the status message handling. -**/ - public static final Object STATUS_MESSAGE_HANDLING_PROPERTY = "StatusMessageHandling"; - -/** -Property identifier for the status. -**/ - public static final Object STATUS_PROPERTY = "Status"; - -/** -Property identifier for the subsystem. -**/ - public static final Object SUBSYSTEM_PROPERTY = "Subsystem"; - -/** -Property identifier for the subtype. -**/ - public static final Object SUBTYPE_PROPERTY = "Subtype"; - - /** -Property identifier for the system library list (for each library in the list). -**/ - public static final Object SYSTEM_LIBRARY_LIST_PROPERTY = "SystemLibraryList"; - -/** -Property identifier for the time separator. -**/ - public static final Object TIME_SEPARATOR_PROPERTY = "TimeSeparator"; - -/** -Property identifier for the type. -**/ - public static final Object TYPE_PROPERTY = "Type"; - -/** -Property identifier for the unit of work identifier. -**/ - public static final Object WORK_ID_UNIT_PROPERTY = "WorkIDUnit"; - -/** -Property identifier for the user library list -**/ - public static final Object USER_LIBRARY_LIST_PROPERTY = "UserLibraryList"; - -/** -Property identifier for the user. -**/ - public static final Object USER_PROPERTY = "User"; - - - - // Map vaccess property identifiers to resource attribute IDs: - private static final Hashtable map_ = new Hashtable(); - static { - map_.put(BREAK_MESSAGE_HANDLING_PROPERTY, RJob.BREAK_MESSAGE_HANDLING); - map_.put(CCSID_PROPERTY , RJob.CCSID); - map_.put(COMPLETION_STATUS_PROPERTY , RJob.COMPLETION_STATUS); - map_.put(COUNTRY_ID_PROPERTY , RJob.COUNTRY_ID); - map_.put(CPUUSED_PROPERTY, RJob.CPU_TIME_USED); - map_.put(CURRENT_LIBRARY_EXISTENCE_PROPERTY , RJob.CURRENT_LIBRARY_EXISTENCE); - map_.put(CURRENT_LIBRARY_PROPERTY , RJob.CURRENT_LIBRARY); - map_.put(DATE_FORMAT_PROPERTY , RJob.DATE_FORMAT); - map_.put(DATE_JOB_BECAME_ACTIVE_PROPERTY , RJob.DATE_STARTED); - map_.put(DATE_JOB_ENTERED_SYSTEM_PROPERTY , RJob.DATE_ENTERED_SYSTEM); - map_.put(DATE_JOB_SCHEDULE_TO_RUN_PROPERTY , RJob.SCHEDULE_DATE); - map_.put(DATE_PROPERTY , RJob.DATE_ENTERED_SYSTEM); - map_.put(DATE_PUT_ON_JOB_QUEUE_PROPERTY , RJob.JOB_QUEUE_DATE); - map_.put(DATE_SEPARATOR_PROPERTY , RJob.DATE_SEPARATOR); - map_.put(DDM_CONVERSATION_HANDLING_PROPERTY , RJob.KEEP_DDM_CONNECTIONS_ACTIVE); - map_.put(DECIMAL_FORMAT_PROPERTY , RJob.DECIMAL_FORMAT); - map_.put(DEFAULT_CCSID_PROPERTY , RJob.DEFAULT_CCSID); - map_.put(DEVICE_RECOVERY_ACTION_PROPERTY , RJob.DEVICE_RECOVERY_ACTION); - map_.put(END_SEVERITY_PROPERTY , RJob.END_SEVERITY); - map_.put(FUNCTION_PROPERTY , RJob.FUNCTION_NAME); - map_.put(INQUIRY_MESSAGE_REPLY_PROPERTY , RJob.INQUIRY_MESSAGE_REPLY); - map_.put(JOB_ACCOUNTING_CODE_PROPERTY , RJob.ACCOUNTING_CODE); - map_.put(JOB_DATE_PROPERTY , RJob.JOB_DATE ); - map_.put(JOB_DESCRIPTION_PROPERTY , RJob.JOB_DESCRIPTION); - map_.put(JOB_MESSAGE_QUEUE_FULL_ACTION_PROPERTY , RJob.MESSAGE_QUEUE_ACTION); - map_.put(JOB_MESSAGE_QUEUE_MAXIMUM_SIZE_PROPERTY , RJob.MESSAGE_QUEUE_MAX_SIZE); - map_.put(JOB_QUEUE_PRIORITY_PROPERTY , RJob.JOB_QUEUE_PRIORITY); - map_.put(JOB_QUEUE_PROPERTY , RJob.JOB_QUEUE ); - map_.put(JOB_SWITCHES_PROPERTY , RJob.JOB_SWITCHES); - map_.put(LANGUAGE_ID_PROPERTY , RJob.LANGUAGE_ID); - map_.put(LOGGING_CL_PROGRAMS_PROPERTY , RJob.LOG_CL_PROGRAMS ); - map_.put(LOGGING_LEVEL_PROPERTY , RJob.LOGGING_LEVEL); - map_.put(LOGGING_SEVERITY_PROPERTY , RJob.LOGGING_SEVERITY); - map_.put(LOGGING_TEXT_PROPERTY , RJob.LOGGING_TEXT); - map_.put(MODE_NAME_PROPERTY , RJob.MODE); - map_.put(NUMBER_PROPERTY , RJob.JOB_NUMBER); - map_.put(NUMBER_OF_LIBRARIES_IN_SYSLIBL_PROPERTY , RJob.SYSTEM_LIBRARY_LIST); - map_.put(NUMBER_OF_LIBRARIES_IN_USRLIBL_PROPERTY , RJob.USER_LIBRARY_LIST); - map_.put(NUMBER_OF_PRODUCT_LIBRARIES_PROPERTY , RJob.PRODUCT_LIBRARIES); - map_.put(OUTPUT_QUEUE_PRIORITY_PROPERTY , RJob.OUTPUT_QUEUE_PRIORITY ); - map_.put(OUTPUT_QUEUE_PROPERTY , RJob.OUTPUT_QUEUE); - map_.put(PRINT_KEY_FORMAT_PROPERTY , RJob.PRINT_KEY_FORMAT); - map_.put(PRINT_TEXT_PROPERTY , RJob.PRINT_TEXT); - map_.put(PRINTER_DEVICE_NAME_PROPERTY , RJob.PRINTER_DEVICE_NAME); - map_.put(PRODUCT_LIBRARIES_PROPERTY , RJob.PRODUCT_LIBRARIES); - map_.put(ROUTING_DATA_PROPERTY , RJob.ROUTING_DATA); - map_.put(SIGNED_ON_JOB_PROPERTY , RJob.SIGNED_ON_JOB); - map_.put(SORT_SEQUENCE_TABLE_PROPERTY , RJob.SORT_SEQUENCE_TABLE); - map_.put(STATUS_OF_JOB_ON_JOB_QUEUE_PROPERTY , RJob.JOB_QUEUE_STATUS); - map_.put(STATUS_MESSAGE_HANDLING_PROPERTY , RJob.STATUS_MESSAGE_HANDLING); - map_.put(STATUS_PROPERTY , RJob.JOB_STATUS); - map_.put(SUBSYSTEM_PROPERTY , RJob.SUBSYSTEM); - map_.put(SUBTYPE_PROPERTY , RJob.JOB_SUBTYPE); - map_.put(SYSTEM_LIBRARY_LIST_PROPERTY , RJob.SYSTEM_LIBRARY_LIST); - map_.put(TIME_SEPARATOR_PROPERTY , RJob.TIME_SEPARATOR); - map_.put(TYPE_PROPERTY , RJob.JOB_TYPE); - map_.put(WORK_ID_UNIT_PROPERTY , RJob.LOCATION_NAME); - map_.put(USER_LIBRARY_LIST_PROPERTY , RJob.USER_LIBRARY_LIST); - map_.put(USER_PROPERTY , RJob.USER_NAME); - } - - - - -/** -Static initializer. -**/ -// -// Implementation note: -// -// * The column widths are completely arbitrary. -// - static - { - detailsColumnModel_ = new DefaultTableColumnModel (); - int columnIndex = 0; - - // Name column. - VTableColumn nameColumn = new VTableColumn (columnIndex++, VJobLogMessage.NAME_PROPERTY); - nameColumn.setCellRenderer (new VObjectCellRenderer ()); - nameColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - nameColumn.setHeaderValue (nameColumnHeader_); - nameColumn.setPreferredCharWidth (10); - detailsColumnModel_.addColumn (nameColumn); - - // Text column. - VTableColumn textColumn = new VTableColumn (columnIndex++, VJobLogMessage.TEXT_PROPERTY); - textColumn.setCellRenderer (new VObjectCellRenderer ()); - textColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - textColumn.setHeaderValue (textColumnHeader_); - textColumn.setPreferredCharWidth (80); - detailsColumnModel_.addColumn (textColumn); - - // Severity column. - VTableColumn severityColumn = new VTableColumn (columnIndex++, VJobLogMessage.SEVERITY_PROPERTY); - severityColumn.setCellRenderer (new VObjectCellRenderer (SwingConstants.RIGHT)); - severityColumn.setHeaderRenderer (new VObjectHeaderRenderer (SwingConstants.RIGHT)); - severityColumn.setHeaderValue (severityColumnHeader_); - severityColumn.setPreferredCharWidth (8); - detailsColumnModel_.addColumn (severityColumn); - - // Type column. - VTableColumn typeColumn = new VTableColumn (columnIndex++, VJobLogMessage.TYPE_PROPERTY); - typeColumn.setCellRenderer (new VObjectCellRenderer ()); - typeColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - typeColumn.setHeaderValue (typeColumnHeader_); - typeColumn.setPreferredCharWidth (20); - detailsColumnModel_.addColumn (typeColumn); - - // Date column. - VTableColumn dateColumn = new VTableColumn (columnIndex++, VJobLogMessage.DATE_PROPERTY); - dateColumn.setCellRenderer (new VObjectCellRenderer ()); - dateColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - dateColumn.setHeaderValue (dateColumnHeader_); - dateColumn.setPreferredCharWidth (20); - detailsColumnModel_.addColumn (dateColumn); - - // From program column. - VTableColumn fromProgramColumn = new VTableColumn (columnIndex++, VJobLogMessage.FROM_PROGRAM_PROPERTY); - fromProgramColumn.setCellRenderer (new VObjectCellRenderer ()); - fromProgramColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - fromProgramColumn.setHeaderValue (fromProgramColumnHeader_); - fromProgramColumn.setPreferredCharWidth (10); - detailsColumnModel_.addColumn (fromProgramColumn); - - } - - - - // Properties pane layout. - private static ResourceProperties properties_ = null; - static { - // Resource properties pane layout. - properties_ = new ResourceProperties(); - properties_.addProperties(new Object[] { RJob.JOB_TYPE, RJob.JOB_SUBTYPE, RJob.JOB_STATUS, - RJob.DATE_ENTERED_SYSTEM, RJob.JOB_DATE, - RJob.JOB_DESCRIPTION, - RJob.JOB_QUEUE, RJob.JOB_QUEUE_PRIORITY, RJob.JOB_QUEUE_STATUS }); - properties_.addProperties(properties_.addTab(ResourceLoader.getText ("TAB_PRINTER_OUTPUT")), - new Object[] { RJob.OUTPUT_QUEUE, RJob.OUTPUT_QUEUE_PRIORITY, - RJob.PRINTER_DEVICE_NAME, RJob.PRINT_KEY_FORMAT, RJob.PRINT_TEXT }); - properties_.addProperties(properties_.addTab(ResourceLoader.getText ("TAB_ACTIVE")), - new Object[] { RJob.RUN_PRIORITY, RJob.SUBSYSTEM, RJob.SYSTEM_POOL_ID, - RJob.AUXILIARY_IO_REQUESTS, RJob.INTERACTIVE_TRANSACTIONS, - RJob.TOTAL_RESPONSE_TIME, RJob.DEFAULT_WAIT_TIME, RJob.ELIGIBLE_FOR_PURGE, - RJob.JOB_SWITCHES, RJob.TIME_SLICE, - RJob.TIME_SLICE_END_POOL }); - properties_.addProperties(properties_.addTab(ResourceLoader.getText ("TAB_MESSAGE")), - new Object[] { RJob.INQUIRY_MESSAGE_REPLY, RJob.BREAK_MESSAGE_HANDLING, - RJob.STATUS_MESSAGE_HANDLING, RJob.LOG_CL_PROGRAMS, RJob.LOGGING_SEVERITY, - RJob.LOGGING_LEVEL, RJob.LOGGING_TEXT, RJob.MESSAGE_QUEUE_ACTION }); - properties_.addProperties(properties_.addTab(ResourceLoader.getText ("TAB_DATETIME")), - new Object[] { RJob.JOB_QUEUE_DATE, RJob.DATE_ENTERED_SYSTEM, RJob.DATE_FORMAT, - RJob.DATE_SEPARATOR, RJob.TIME_SEPARATOR, RJob.SCHEDULE_DATE }); - properties_.addProperties(properties_.addTab(ResourceLoader.getText ("TAB_LANGUAGE")), - new Object[] { RJob.CCSID, RJob.DEFAULT_CCSID, RJob.COUNTRY_ID, - RJob.LANGUAGE_ID, RJob.SORT_SEQUENCE_TABLE }); - properties_.addProperties(properties_.addTab(ResourceLoader.getText ("TAB_LIBRARY_LIST")), - new Object[] { RJob.SYSTEM_LIBRARY_LIST, RJob.USER_LIBRARY_LIST, - RJob.PRODUCT_LIBRARIES, - RJob.CURRENT_LIBRARY }); - properties_.addProperties(properties_.addTab(ResourceLoader.getText ("TAB_OTHER")), - new Object[] { RJob.LOCATION_NAME, RJob.MODE, RJob.DEVICE_RECOVERY_ACTION, - RJob.KEEP_DDM_CONNECTIONS_ACTIVE, RJob.COMPLETION_STATUS, - RJob.ROUTING_DATA, - RJob.DECIMAL_FORMAT, RJob.ACCOUNTING_CODE, RJob.FUNCTION_NAME, - RJob.FUNCTION_TYPE, RJob.SIGNED_ON_JOB }); - - } - - -/** -Constructs a VJob object. -**/ - public VJob () - { - job_ = new RJob(); - jobLog_ = new RJobLog (); - initializeTransient (); - } - - - -/** -Constructs a VJob object. - -@param system The system on which the job resides. -@param job The job. -**/ - public VJob (AS400 system, Job job) - { - if (system == null) - throw new NullPointerException ("system"); - if (job == null) - throw new NullPointerException ("job"); - - job_ = new RJob(system, job.getName(), job.getUser(), job.getNumber()); - jobLog_ = new RJobLog (system); - - try { - jobLog_.setName (job.getName ()); - jobLog_.setNumber (job.getNumber ()); - jobLog_.setUser (job.getUser ()); - } - catch (PropertyVetoException e) { - // Ignore. - Trace.log(Trace.ERROR,"VJob constructor : "+e); - } - - initializeTransient (); - } - - - -/** -Constructs a VJob object. - -@param system The system on which the job resides. -@param job The job. -**/ - public VJob (AS400 system, RJob job) - { - if (system == null) - throw new NullPointerException ("system"); - if (job == null) - throw new NullPointerException ("job"); - - job_ = job; - jobLog_ = new RJobLog (system); - - try { - jobLog_.setName (job.getName ()); - jobLog_.setNumber (job.getNumber ()); - jobLog_.setUser (job.getUser ()); - } - catch (PropertyVetoException e) { - // Ignore. - Trace.log(Trace.ERROR,"VJob constructor : "+e); - } - - initializeTransient (); - } - - - -/** -Constructs a VJob object. - -@param parent The parent. -@param system The system on which the job resides. -@param job The job. -**/ - public VJob (VNode parent, AS400 system, Job job) - { - if (parent == null) - throw new NullPointerException ("parent"); - if (system == null) - throw new NullPointerException ("system"); - if (job == null) - throw new NullPointerException ("job"); - - parent_ = parent; - job_ = new RJob(system, job.getName(), job.getUser(), job.getNumber()); - jobLog_ = new RJobLog (system); - - try { - jobLog_.setName (job.getName ()); - jobLog_.setNumber (job.getNumber ()); - jobLog_.setUser (job.getUser ()); - } - catch (PropertyVetoException e) { - // Ignore. - Trace.log(Trace.ERROR,"VJob constructor : "+e); - } - - initializeTransient (); - } - - - -/** -Constructs a VJob object. - -@param parent The parent. -@param system The system on which the job resides. -@param job The job. -**/ - public VJob (VNode parent, AS400 system, RJob job) - { - if (parent == null) - throw new NullPointerException ("parent"); - if (system == null) - throw new NullPointerException ("system"); - if (job == null) - throw new NullPointerException ("job"); - - parent_ = parent; - job_ = job; - jobLog_ = new RJobLog (system); - - try { - jobLog_.setName (job.getName ()); - jobLog_.setNumber (job.getNumber ()); - jobLog_.setUser (job.getUser ()); - } - catch (PropertyVetoException e) { - // Ignore. - Trace.log(Trace.ERROR,"VJob constructor : "+e); - } - - initializeTransient (); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - workingEventSupport_.addWorkingListener (listener); - } - - - - /** - Returns the children of the node. - @return The children. - **/ - public Enumeration children () - { - return new VEnumeration (this); - } - - - /** - Returns the list of actions that can be performed. - @return The list of actions. - **/ - public VAction[] getActions () - { - return actions_; - } - - - -/** -Indiciates if the node allows children. - -@return Always false. -**/ - public boolean getAllowsChildren () - { - return false; - } - - - -/** -Returns the child node at the specified index. - -@param index The index. -@return Always null. -**/ - public TreeNode getChildAt (int index) - { - return null; - } - - - -/** -Returns the number of children. - -@return Always 0. -**/ - public int getChildCount () - { - return 0; - } - - - -/** -Returns the default action. - -@return Always null. There is no default action. -**/ - public VAction getDefaultAction () - { - return null; - } - - - -/** -Returns the child for the details at the specified index. - -@param index The index. -@return The child, or null if the index is not - valid. -**/ - public VObject getDetailsChildAt (int index) - { - if (!loaded_) - return null; - if (detailsChildren_ == null) - loadFirst(); - if ((index < 0) || (index >= detailsChildren_.length)) - return null; - if (detailsChildren_[index] == null) - loadSingle(index); - return detailsChildren_[index]; - } - - - -/** -Returns the number of children for the details. - -@return The number of children for the details. -**/ - public /* @A2D synchronized */ int getDetailsChildCount () - { - if (!loaded_) - return 0; - if (detailsChildren_ == null) - loadFirst(); - return detailsChildren_.length; - } - - - -/** -Returns the table column model to use in the details -when representing the children. This column model -describes the details values for the children. - -@return The details column model. -**/ - public TableColumnModel getDetailsColumnModel () - { - return detailsColumnModel_; - } - - - -/** -Returns the index of the specified child for the details. - -@param detailsChild The details child. -@return The index, or -1 if the child is not found - in the details. -**/ - public /* @A2D synchronized */ int getDetailsIndex (VObject detailsChild) - { - if (detailsChildren_ == null) - loadFirst(); - if (detailsChild == null) - return -1; - for (int i = 0; i < detailsChildren_.length; ++i) //@A2C - if (detailsChildren_[i] == detailsChild) - return i; - return -1; - } - - - -/** -Returns the icon. - -@param size The icon size, either 16 or 32. If any other - value is given, then return a default. -@param open This parameter has no effect. -@return The icon. -**/ - public Icon getIcon (int size, boolean open) - { - if (size == 32) - return icon32_; - else - return icon16_; - } - - - -/** -Returns the index of the specified child. - -@param child The child. -@return Always -1. -**/ - public int getIndex (TreeNode child) - { - return -1; - } - - - -/** -Returns the job. - -@return The job, or null if it has not been set. -**/ - public Job getJob () - { - Job job = new Job(); - try { - if (job_.getSystem() != null) - job.setSystem(job_.getSystem()); - if (job_.getName() != null) - job.setName(job_.getName()); - if (job_.getUser() != null) - job.setUser(job_.getUser()); - if (job_.getNumber() != null) - job.setNumber(job_.getNumber()); - } - catch(PropertyVetoException e) { - // Ignore. - } - return job; - } - - - - -/** -Returns the job. - -@return The job, or null if it has not been set. -**/ - public RJob getRJob () - { - return job_; - } - - - - - //@A1A Get Job type field from type and subtype value. - private String getJobType(char type,char subtype) - { - switch (type) - { - case 'A' : - switch (subtype) - { - case ' ' : - return "ASJ"; - default : - break; - } - break; - case 'B' : - switch (subtype) - { - case ' ' : - return "BCH"; - case 'D' : - return "BCI"; - case 'E' : - return "EVK"; - case 'F' : - return "M36"; - case 'T' : - return "MRT"; - case 'J' : - return "PJ"; - case 'U' : - return ""; - default : - break; - } - break; - case 'I' : - switch (subtype) - { - case ' ' : - return "INT"; - default : - break; - } - break; - case 'W' : - switch (subtype) - { - case ' ' : - return "WTR"; - case 'P' : - return "PDJ"; - default : - break; - } - break; - case 'R' : - switch (subtype) - { - case ' ' : - return "RDR"; - default : - break; - } - break; - case 'M' : - switch (subtype) - { - case ' ' : - return "SBS"; - default : - break; - } - break; - case 'S' : - case 'X' : - switch (subtype) - { - case ' ' : - return "SYS"; - default : - break; - } - break; - default : - break; - } - return ""; - } - - -/** -Returns the parent node. - -@return The parent node, or null if there is no parent. -**/ - public TreeNode getParent () - { - return parent_; - } - - - -/** -Returns the properties pane. - -@return The properties pane. -**/ - public VPropertiesPane getPropertiesPane () - { - return propertiesPane_; - } - - - -/** -Returns a property value. - -@param propertyIdentifier The property identifier. The choices are -
      -
    • BREAK_MESSAGE_HANDLING_PROPERTY -
    • CCSID_PROPERTY -
    • COMPLETION_STATUS_PROPERTY -
    • COUNTRY_ID_PROPERTY -
    • CPUUSED_PROPERTY -
    • CURRENT_LIBRARY_EXISTENCE_PROPERTY -
    • CURRENT_LIBRARY_PROPERTY -
    • DATE_FORMAT_PROPERTY -
    • DATE_JOB_BECAME_ACTIVE_PROPERTY -
    • DATE_JOB_ENTERED_SYSTEM_PROPERTY -
    • DATE_JOB_SCHEDULE_TO_RUN_PROPERTY -
    • DATE_PROPERTY -
    • DATE_PUT_ON_JOB_QUEUE_PROPERTY -
    • DATE_SEPARATOR_PROPERTY -
    • DDM_CONVERSATION_HANDLING_PROPERTY -
    • DECIMAL_FORMAT_PROPERTY -
    • DEFAULT_CCSID_PROPERTY -
    • DESCRIPTION_PROPERTY -
    • DEVICE_RECOVERY_ACTION_PROPERTY -
    • END_SEVERITY_PROPERTY -
    • FUNCTION_PROPERTY -
    • INQUIRY_MESSAGE_REPLY_PROPERTY -
    • JOB_ACCOUNTING_CODE_PROPERTY -
    • JOB_DATE_PROPERTY -
    • JOB_DESCRIPTION_PROPERTY -
    • JOB_MESSAGE_QUEUE_FULL_ACTION_PROPERTY -
    • JOB_MESSAGE_QUEUE_MAXIMUM_SIZE_PROPERTY -
    • JOB_QUEUE_PRIORITY_PROPERTY -
    • JOB_QUEUE_PROPERTY -
    • JOB_SWITCHES_PROPERTY -
    • LANGUAGE_ID_PROPERTY -
    • LOGGING_CL_PROGRAMS_PROPERTY -
    • LOGGING_LEVEL_PROPERTY -
    • LOGGING_SEVERITY_PROPERTY -
    • LOGGING_TEXT_PROPERTY -
    • MODE_NAME_PROPERTY -
    • NAME_PROPERTY -
    • NUMBER_PROPERTY -
    • NUMBER_OF_LIBRARIES_IN_SYSLIBL_PROPERTY -
    • NUMBER_OF_LIBRARIES_IN_USRLIBL_PROPERTY -
    • NUMBER_OF_PRODUCT_LIBRARIES_PROPERTY -
    • OUTPUT_QUEUE_PRIORITY_PROPERTY -
    • OUTPUT_QUEUE_PROPERTY -
    • PRINT_KEY_FORMAT_PROPERTY -
    • PRINT_TEXT_PROPERTY -
    • PRINTER_DEVICE_NAME_PROPERTY -
    • PRODUCT_LIBRARIES_PROPERTY -
    • ROUTING_DATA_PROPERTY -
    • SIGNED_ON_JOB_PROPERTY -
    • SORT_SEQUENCE_TABLE_PROPERTY -
    • STATUS_MESSAGE_HANDLING_PROPERTY -
    • STATUS_OF_JOB_ON_JOB_QUEUE_PROPERTY -
    • STATUS_PROPERTY -
    • SUBSYSTEM_PROPERTY -
    • SUBTYPE_PROPERTY -
    • SYSTEM_LIBRARY_LIST_PROPERTY -
    • TIME_SEPARATOR_PROPERTY -
    • TYPE_PROPERTY -
    • WORK_ID_UNIT_PROPERTY -
    • USER_LIBRARY_LIST_PROPERTY -
    • USER_PROPERTY -
    -@return The property value, or null if the - property identifier is not recognized. -**/ - public Object getPropertyValue (Object propertyIdentifier) - { - // Get the name. - if (propertyIdentifier == NAME_PROPERTY) - return this; - - // Get the description. - else if (propertyIdentifier == DESCRIPTION_PROPERTY) - return description_; - - else if (job_ == null) - return ""; - - else if (propertyIdentifier == FUNCTION_PROPERTY) { - try { - StringBuffer buffer = new StringBuffer(); - buffer.append(job_.getAttributeValue(RJob.FUNCTION_TYPE)); - buffer.append('-'); - buffer.append(job_.getAttributeValue(RJob.FUNCTION_NAME)); - return buffer.toString(); - } - catch(Exception e) { - errorEventSupport_.fireError(e); - return ""; - } - } - - else if (propertyIdentifier == TYPE_PROPERTY) { - char type,subtype; - try { - String typeAsString = ((String)job_.getAttributeValue(RJob.JOB_TYPE)).trim().toUpperCase(); - if (typeAsString.length()!=0) - type = typeAsString.charAt(0); - else - type = ' '; - String subtypeAsString = ((String)job_.getAttributeValue(RJob.JOB_SUBTYPE)).trim().toUpperCase(); - if (subtypeAsString.length()!=0) - subtype = subtypeAsString.charAt(0); - else - subtype = ' '; - } - catch(Exception e) { - errorEventSupport_.fireError(e); - type = ' '; - subtype = ' '; - } - return getJobType(type,subtype); - } - - else if (propertyIdentifier == null) - return null; - - else { - Object attributeID = map_.get(propertyIdentifier); - if (attributeID == null) - return null; - try { - return job_.getAttributeValue(attributeID); - } - catch(Exception e) { - errorEventSupport_.fireError(e); - return ""; - } - } - } - - - -/** -Returns the system on which the job resides. - -@return The system on which the job resides. -**/ - public AS400 getSystem () - { - return jobLog_.getSystem (); - } - - - - //@A1A separate name from full queue path. - private String getQueueName(String fullQueuePath) - { - if (fullQueuePath.trim().equals("/")) - return ""; - int separator = fullQueuePath.indexOf('/'); - if (separator > 0) - return fullQueuePath.substring(separator+1); - else - return fullQueuePath; - } - - - -/** -Returns the text. This is the job name. - -@return The text which is the job name. -**/ - public String getText () - { - if (job_ != null) - return job_.getName(); - else - return ""; - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - //@A3C: Uncommented the event support section. - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport(this); - propertyChangeSupport_= new PropertyChangeSupport(this); - vetoableChangeSupport_= new VetoableChangeSupport(this); - objectEventSupport_ = new VObjectEventSupport(this); - workingEventSupport_ = new WorkingEventSupport(this); - - // Initialize the private data. - detailsChildren_ = new VObject[0]; - loaded_ = false; //@A2A - - // Initialize the properties pane. - propertiesPane_ = new VResourcePropertiesPane(this, job_, properties_); - propertiesPane_.addErrorListener (errorEventSupport_); - propertiesPane_.addVObjectListener (objectEventSupport_); - propertiesPane_.addWorkingListener (workingEventSupport_); - - // This is no longer needed, since the properties pane is editable. -/* actions_ = new VAction[1]; - actions_[0]= new VJobModifyAction(this,job_); - actions_[0].addErrorListener((ErrorListener)errorEventSupport_); - actions_[0].addVObjectListener((VObjectListener)objectEventSupport_); - actions_[0].addWorkingListener((WorkingListener)workingEventSupport_);*/ - } - - - -/** -Indicates if the node is a leaf. - -@return Always true. -**/ - public boolean isLeaf () - { - return true; - } - - - -/** -Indicates if the details children are sortable. - -@return Always false. -**/ -// -// Implementation note: We do not allow sorting because of the fact -// that we load the list incrementally. -// - public boolean isSortable () - { - return false; - } - - - -/** -Loads information about the object from the system. -**/ - public void load() - { - // Stop listening to the previous children. - if (detailsChildren_ != null) { - for (int i = 0; i < detailsChildren_.length; ++i) { //@A2C - if (detailsChildren_[i] != null) { - detailsChildren_[i].removeErrorListener (errorEventSupport_); - detailsChildren_[i].removeVObjectListener (objectEventSupport_); - detailsChildren_[i].removeWorkingListener (workingEventSupport_); - } - } - } - - detailsChildren_ = null; - loaded_ = true; //@A2A - } - - - - private void loadFirst() - { - workingEventSupport_.fireStartWorking (); - - try { - jobLog_.open(); - jobLog_.waitForComplete(); - detailsChildren_ = new VJobLogMessage[(int)jobLog_.getListLength()]; - } - catch (Exception e) { - errorEventSupport_.fireError(e); - detailsChildren_ = new VJobLogMessage[0]; - } - - workingEventSupport_.fireStopWorking (); - } - - - - private void loadSingle(int index) - { - workingEventSupport_.fireStartWorking (); - - try { - RQueuedMessage message = (RQueuedMessage)jobLog_.resourceAt(index); - detailsChildren_[index] = new VJobLogMessage (message); - detailsChildren_[index].addErrorListener (errorEventSupport_); - detailsChildren_[index].addVObjectListener (objectEventSupport_); - detailsChildren_[index].addWorkingListener (workingEventSupport_); - } - catch (Exception e) { - errorEventSupport_.fireError(e); - } - - workingEventSupport_.fireStopWorking (); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Sets the job. - -@param job The job. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setJob (Job job) - throws PropertyVetoException - { - if (job == null) - throw new NullPointerException ("job"); - - Job oldValue = getJob(); - Job newValue = job; - vetoableChangeSupport_.fireVetoableChange ("job", oldValue, newValue); - - if (oldValue != newValue) { - - job_ = new RJob(job.getSystem(), job.getName(), job.getUser(), job.getNumber()); - jobLog_ = new RJobLog(job.getSystem(), job.getName(), job.getUser(), job.getNumber()); - } - - propertyChangeSupport_.firePropertyChange ("job", oldValue, newValue); - } - - - -/** -Sets the job. - -@param job The job. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setRJob (RJob job) - throws PropertyVetoException - { - if (job == null) - throw new NullPointerException ("job"); - - RJob oldValue = job_; - RJob newValue = job; - vetoableChangeSupport_.fireVetoableChange ("job", oldValue, newValue); - - if (oldValue != newValue) { - - job_ = job; - - try { - jobLog_.setName (job.getName ()); - jobLog_.setNumber (job.getNumber ()); - jobLog_.setUser (job.getUser ()); - } - catch (PropertyVetoException e) { - // Ignore. - Trace.log(Trace.ERROR,"VJob setJob : "+e); - } - } - - propertyChangeSupport_.firePropertyChange ("job", oldValue, newValue); - } - - - -/** -Sets the system on which the job resides. - -@param system The system on which the job resides. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setSystem (AS400 system) - throws PropertyVetoException - { - if (system == null) - throw new NullPointerException ("system"); - - AS400 oldValue = jobLog_.getSystem (); - AS400 newValue = system; - vetoableChangeSupport_.fireVetoableChange ("system", oldValue, newValue); - - if (oldValue != newValue) { - - try { - jobLog_.setSystem (system); - } - catch (PropertyVetoException e) { - // Ignore. - Trace.log(Trace.ERROR,"VJob setSystem : "+e); - } - } - - propertyChangeSupport_.firePropertyChange ("system", oldValue, newValue); - } - - - -/** -Sorts the children for the details. Since sorting is not supported, -this method does nothing. - -@param propertyIdentifiers The property identifiers. -@param orders The sort orders for each property - identifier. true for ascending order; - false for descending order. -**/ - public void sortDetailsChildren (Object[] propertyIdentifiers, - boolean[] orders) - { - // No sorting here! - } - - - -/** -Returns the string representation of the job name. - -@return The string representation of the job name. -**/ - public String toString () - { - return getText (); - } -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VJob16.gif b/cvsroot/src/com/ibm/as400/vaccess/VJob16.gif deleted file mode 100644 index c47621035..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VJob16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VJob32.gif b/cvsroot/src/com/ibm/as400/vaccess/VJob32.gif deleted file mode 100644 index a3b4854fc..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VJob32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VJobBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/VJobBeanInfo.java deleted file mode 100644 index afbdb064f..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VJobBeanInfo.java +++ /dev/null @@ -1,186 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VJobBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The VJobBeanInfo class provides bean information -for the VJob class. - -@see VJob -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VJobBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = VJob.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - String[] vobjectMethods = { "objectChanged", "objectCreated", "objectDeleted" }; - EventSetDescriptor vobject = new EventSetDescriptor (beanClass_, - "vobject", VObjectListener.class, vobjectMethods, - "addVObjectListener", "removeVObjectListener"); - vobject.setDisplayName (ResourceLoader.getText ("EVT_NAME_VOBJECT")); - vobject.setShortDescription (ResourceLoader.getText ("EVT_DESC_VOBJECT")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { error, vobject, working }; - - // Properties. - PropertyDescriptor job = new PropertyDescriptor ("job", beanClass_); - job.setBound (true); - job.setConstrained (true); - job.setDisplayName (ResourceLoader.getText ("PROP_NAME_JOB")); - job.setShortDescription (ResourceLoader.getText ("PROP_DESC_JOB")); - - PropertyDescriptor system = new PropertyDescriptor ("system", beanClass_); - system.setBound (true); - system.setConstrained (true); - system.setDisplayName (ResourceLoader.getText ("PROP_NAME_SYSTEM")); - system.setShortDescription (ResourceLoader.getText ("PROP_DESC_SYSTEM")); - - properties_ = new PropertyDescriptor[] { job, system }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 1; // system. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("VJob16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("VJob32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VJobList.java b/cvsroot/src/com/ibm/as400/vaccess/VJobList.java deleted file mode 100644 index 463f691c3..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VJobList.java +++ /dev/null @@ -1,985 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VJobList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.Trace; -import com.ibm.as400.resource.ResourceException; -import com.ibm.as400.resource.RJob; -import com.ibm.as400.resource.RJobList; -import javax.swing.Icon; -import javax.swing.SwingConstants; -import javax.swing.table.TableColumnModel; -import javax.swing.table.DefaultTableColumnModel; -import javax.swing.tree.TreeNode; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.Enumeration; -import java.util.Vector; - -/** -The VJobList class defines the representation of a job list on -a system for use in various models and panes in this package. -You must explicitly call load() to load the information from -the system. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VJobList objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • VObjectEvent -
    • WorkingEvent -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VJobList -implements VNode, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static String description_ = ResourceLoader.getText ("JOB_LIST_DESCRIPTION"); - private static Icon icon16_ = ResourceLoader.getIcon ("VJobList16.gif", description_); - private static Icon icon32_ = ResourceLoader.getIcon ("VJobList32.gif", description_); - private static String cpuUsedColumnHeader_ = ResourceLoader.getText ("JOB_CPU_USED"); - private static String dateColumnHeader_ = ResourceLoader.getText ("JOB_DATE"); - private static String functionColumnHeader_ = ResourceLoader.getText ("JOB_FUNCTION"); - private static String nameColumnHeader_ = ResourceLoader.getText ("JOB_NAME"); - private static String numberColumnHeader_ = ResourceLoader.getText ("JOB_NUMBER"); - private static String statusColumnHeader_ = ResourceLoader.getText ("JOB_STATUS"); - private static String subsystemColumnHeader_ = ResourceLoader.getText ("JOB_SUBSYSTEM"); - private static String subtypeColumnHeader_ = ResourceLoader.getText ("JOB_SUBTYPE"); - private static String typeColumnHeader_ = ResourceLoader.getText ("JOB_TYPE"); - private static String userColumnHeader_ = ResourceLoader.getText ("JOB_USER"); - - - - // Properties. - private RJobList jobList_ = null; - private String name_ = null; - private String number_ = null; - private VNode parent_ = null; - private String user_ = null; - - - - // Static data. - private static TableColumnModel detailsColumnModel_ = null; - - - - // Private data. - transient private VNode[] children_; - transient private Object childrenLock_; - transient private boolean loaded_ = false; - transient private VPropertiesPane propertiesPane_; - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - transient private VObjectEventSupport objectEventSupport_; - transient private WorkingEventSupport workingEventSupport_; - - - -/** -Static initializer. -**/ -// -// Implementation note: -// -// * The column widths are completely arbitrary. -// - static - { - detailsColumnModel_ = new DefaultTableColumnModel (); - int columnIndex = 0; - - /* @C2D - // Subsystem column. - VTableColumn subsystemColumn = new VTableColumn (columnIndex++, VJob.SUBSYSTEM_PROPERTY); - subsystemColumn.setCellRenderer (new VObjectCellRenderer ()); - subsystemColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - subsystemColumn.setHeaderValue (subsystemColumnHeader_); - subsystemColumn.setPreferredCharWidth (10); - detailsColumnModel_.addColumn (subsystemColumn); - */ - - // Name column. - VTableColumn nameColumn = new VTableColumn (columnIndex++, VJob.NAME_PROPERTY); - nameColumn.setCellRenderer (new VObjectCellRenderer ()); - nameColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - nameColumn.setHeaderValue (nameColumnHeader_); - nameColumn.setPreferredCharWidth (10); - detailsColumnModel_.addColumn (nameColumn); - - // User column. - VTableColumn userColumn = new VTableColumn (columnIndex++, VJob.USER_PROPERTY); - userColumn.setCellRenderer (new VObjectCellRenderer ()); - userColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - userColumn.setHeaderValue (userColumnHeader_); - userColumn.setPreferredCharWidth (10); - detailsColumnModel_.addColumn (userColumn); - - // Type column. - VTableColumn typeColumn = new VTableColumn (columnIndex++, VJob.TYPE_PROPERTY); - typeColumn.setCellRenderer (new VObjectCellRenderer ()); - typeColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - typeColumn.setHeaderValue (typeColumnHeader_); - typeColumn.setPreferredCharWidth (10); - detailsColumnModel_.addColumn (typeColumn); - - /* @C2D - // CPU used column. - VTableColumn cpuUsedColumn = new VTableColumn (columnIndex++, VJob.CPUUSED_PROPERTY); - cpuUsedColumn.setCellRenderer (new VObjectCellRenderer (SwingConstants.RIGHT)); - cpuUsedColumn.setHeaderRenderer (new VObjectHeaderRenderer (SwingConstants.RIGHT)); - cpuUsedColumn.setHeaderValue (cpuUsedColumnHeader_); - cpuUsedColumn.setPreferredCharWidth (10); - detailsColumnModel_.addColumn (cpuUsedColumn); - - // Function column. - VTableColumn functionColumn = new VTableColumn (columnIndex++, VJob.FUNCTION_PROPERTY); - functionColumn.setCellRenderer (new VObjectCellRenderer ()); - functionColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - functionColumn.setHeaderValue (functionColumnHeader_); - functionColumn.setPreferredCharWidth (20); - detailsColumnModel_.addColumn (functionColumn); - */ - - // Status column. - VTableColumn statusColumn = new VTableColumn (columnIndex++, VJob.STATUS_PROPERTY); - statusColumn.setCellRenderer (new VObjectCellRenderer ()); - statusColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - statusColumn.setHeaderValue (statusColumnHeader_); - statusColumn.setPreferredCharWidth (10); - detailsColumnModel_.addColumn (statusColumn); - - // Number column. - VTableColumn numberColumn = new VTableColumn (columnIndex++, VJob.NUMBER_PROPERTY); - numberColumn.setCellRenderer (new VObjectCellRenderer ()); - numberColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - numberColumn.setHeaderValue (numberColumnHeader_); - numberColumn.setPreferredCharWidth (6); - detailsColumnModel_.addColumn (numberColumn); - - /* @C2D - // Date column. - VTableColumn dateColumn = new VTableColumn (columnIndex++, VJob.DATE_PROPERTY); - dateColumn.setCellRenderer (new VObjectCellRenderer ()); - dateColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - dateColumn.setHeaderValue (dateColumnHeader_); - dateColumn.setPreferredCharWidth (20); - detailsColumnModel_.addColumn (dateColumn); - */ - } - - - -/** -Constructs a VJobList object. -**/ - public VJobList () - { - jobList_ = new RJobList (); - try { - jobList_.setSelectionValue(RJobList.PRIMARY_JOB_STATUSES, new String[] { RJob.JOB_STATUS_ACTIVE }); - jobList_.setSortValue(new Object[] {RJob.JOB_NAME, RJob.USER_NAME, RJob.JOB_NUMBER }); // @C3A - } - catch(ResourceException e) { } - initializeTransient (); - } - - - -/** -Constructs a VJobList object. - -@param system The system on which the list resides. -**/ - public VJobList (AS400 system) - { - if (system == null) - throw new NullPointerException ("system"); - - jobList_ = new RJobList (system); - try { - jobList_.setSelectionValue(RJobList.PRIMARY_JOB_STATUSES, new String[] { RJob.JOB_STATUS_ACTIVE }); - jobList_.setSortValue(new Object[] {RJob.JOB_NAME, RJob.USER_NAME, RJob.JOB_NUMBER }); // @C3A - } - catch(ResourceException e) { } - initializeTransient (); - } - - - -/** -Constructs a VJobList object. - -@param parent The parent. -@param system The system on which the list resides. -**/ - public VJobList (VNode parent, AS400 system) - { - if (parent == null) - throw new NullPointerException ("parent"); - if (system == null) - throw new NullPointerException ("system"); - - parent_ = parent; - jobList_ = new RJobList (system); - try { - jobList_.setSelectionValue(RJobList.PRIMARY_JOB_STATUSES, new String[] { RJob.JOB_STATUS_ACTIVE }); - jobList_.setSortValue(new Object[] {RJob.JOB_NAME, RJob.USER_NAME, RJob.JOB_NUMBER }); // @C3A - } - catch(ResourceException e) { } - initializeTransient (); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Returns the children of the node. - -@return The children. -**/ - public Enumeration children () - { - return new VEnumeration (this); - } - - - -/** -Returns the list of actions that can be performed. - -@return Always null. There are no actions. -**/ - public VAction[] getActions () - { - return null; - } - - - -/** -Indiciates if the node allows children. - -@return Always true. -**/ - public boolean getAllowsChildren () - { - return true; - } - - - -/** -Returns the child node at the specified index. - -@param index The index. -@return The child, or null if the index is not - valid. -**/ - public TreeNode getChildAt (int index) - { - if (!loaded_) - return null; - if (children_ == null) - loadFirst(); - if ((index < 0) || (index >= children_.length)) - return null; - if (children_[index] == null) - loadSingle(index); - return children_[index]; - } - - - -/** -Returns the number of children. - -@return The number of children. -**/ - public int getChildCount () - { - if (!loaded_) - return 0; - if (children_ == null) - loadFirst(); - return children_.length; - } - - - - -/** -Returns the default action. - -@return Always null. There is no default action. -**/ - public VAction getDefaultAction () - { - return null; - } - - - -/** -Returns the child for the details at the specified index. - -@param index The index. -@return The child, or null if the index is not - valid. -**/ - public VObject getDetailsChildAt (int index) - { - return (VObject)getChildAt(index); - } - - - -/** -Returns the number of children for the details. - -@return The number of children for the details. -**/ - public int getDetailsChildCount () - { - return getChildCount(); - } - - - -/** -Returns the table column model to use in the details -when representing the children. This column model -describes the details values for the children. - -@return The details column model. -**/ - public TableColumnModel getDetailsColumnModel () - { - return detailsColumnModel_; - } - - - -/** -Returns the index of the specified child for the details. - -@param detailsChild The details child. -@return The index, or -1 if the child is not found - in the details. -**/ - public int getDetailsIndex (VObject detailsChild) - { - if (detailsChild instanceof TreeNode) - return getIndex((TreeNode)detailsChild); - else - return -1; - } - - - - -/** -Returns the icon. - -@param size The icon size, either 16 or 32. If any other - value is given, then return a default. -@param open This parameter has no effect. -@return The icon. -**/ - public Icon getIcon (int size, boolean open) - { - if (size == 32) - return icon32_; - else - return icon16_; - } - - - -/** -Returns the index of the specified child. - -@param child The child. -@return The index, or -1 if the child is not found. -**/ - public int getIndex (TreeNode child) - { - if (!loaded_) - return -1; - if (child == null) - return -1; - if (children_ == null) - loadFirst(); - for (int i = 0; i < children_.length; ++i) - if (children_[i] == child) - return i; - return -1; - } - - - -/** -Returns the job name. - -@return The job name. - -@see com.ibm.as400.access.JobList#getName -**/ - public String getName () - { - if (name_ == null) - return RJobList.ALL; - else - return name_; - } - - - -/** -Returns the job number. - -@return The job number. - -@see com.ibm.as400.access.JobList#getNumber -**/ - public String getNumber () - { - if (number_ == null) - return RJobList.ALL; - else - return number_; - } - - - -/** -Returns the parent node. - -@return The parent node, or null if there is no parent. -**/ - public TreeNode getParent () - { - return parent_; - } - - - -/** -Returns the properties pane. - -@return The properties pane. -**/ - public VPropertiesPane getPropertiesPane () - { - return propertiesPane_; - } - - - -/** -Returns a property value. - -@param propertyIdentifier The property identifier. The choices are - NAME_PROPERTY and DESCRIPTION_PROPERTY. -@return The property value, or null if the - property identifier is not recognized. -**/ - public Object getPropertyValue (Object propertyIdentifier) - { - // Get the name. - if (propertyIdentifier == NAME_PROPERTY) - return this; - - // Get the description. - else if (propertyIdentifier == DESCRIPTION_PROPERTY) - return description_; - - // By default, return null. - return null; - } - - - -/** -Returns the system on which the list resides. - -@return The system on which the list resides. -**/ - public AS400 getSystem () - { - return jobList_.getSystem (); - } - - - -/** -Returns the text. - -@return The text. -**/ - public String getText () - { - return description_; - } - - - -/** -Returns the user name. - -@return The user name. - -@see com.ibm.as400.access.JobList#getUser -**/ - public String getUser () - { - if (user_ == null) - return RJobList.ALL; - else - return user_; - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - objectEventSupport_ = new VObjectEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - jobList_.addPropertyChangeListener (propertyChangeSupport_); - jobList_.addVetoableChangeListener (vetoableChangeSupport_); - - // Initialize the private data. - children_ = new VNode[0]; - childrenLock_ = new Object(); - - // Initialize the properties pane. - propertiesPane_ = new VResourceListPropertiesPane(this, jobList_); - - propertiesPane_.addErrorListener (errorEventSupport_); - propertiesPane_.addVObjectListener (objectEventSupport_); - propertiesPane_.addWorkingListener (workingEventSupport_); - } - - - -/** -Indicates if the node is a leaf. - -@return true if the node if a leaf; false otherwise. -**/ - public boolean isLeaf () - { - return (getChildCount () == 0); - } - - - -/** -Indicates if the details children are sortable. -@return Always false. -**/ - public boolean isSortable () - { - return false; //@A2C @C1C - } - - - -/** -Loads information about the object from the system. -**/ - public void load() - { - synchronized(childrenLock_) { - - // Stop listening to the previous children. - if (children_ != null) { - for (int i = 0; i < children_.length; ++i) { //@A2C - if (children_[i] != null) { - children_[i].removeErrorListener (errorEventSupport_); - children_[i].removeVObjectListener (objectEventSupport_); - children_[i].removeWorkingListener (workingEventSupport_); - } - } - } - - children_ = null; - loaded_ = true; //@A2A - } - - objectEventSupport_.fireObjectChanged(this, true); - } - - - - private void loadFirst() - { - workingEventSupport_.fireStartWorking (); - Exception e = null; - synchronized(childrenLock_) { - if (children_ == null) { - try { - // @C3D jobList_.setSortValue(new Object[] {RJob.JOB_NAME, RJob.USER_NAME, RJob.JOB_NUMBER }); - jobList_.refreshContents(); - jobList_.waitForComplete(); - children_ = new VJob[(int)jobList_.getListLength()]; - } - catch (Exception e2) { - e = e2; - children_ = new VJob[0]; // Avoid future errors. - } - } - } - if (e != null) - errorEventSupport_.fireError(e); - workingEventSupport_.fireStopWorking (); - } - - - - private void loadSingle(int index) - { - workingEventSupport_.fireStartWorking (); - Exception e = null; - synchronized(childrenLock_) { - if (children_[index] == null) { - try { - RJob job = (RJob)jobList_.resourceAt(index); - children_[index] = new VJob(this, jobList_.getSystem(), job); - children_[index].addErrorListener (errorEventSupport_); - children_[index].addVObjectListener (objectEventSupport_); - children_[index].addWorkingListener (workingEventSupport_); - children_[index].load(); - } - catch (Exception e2) { - e = e2; - children_ = new VJob[0]; // Avoid future errors. - } - } - } - if (e != null) - errorEventSupport_.fireError(e); - workingEventSupport_.fireStopWorking (); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Sets the job name. The default is *ALL. - -@param name The job name, or *ALL to list jobs with any name. - -@exception PropertyVetoException If the change is vetoed. - -@see com.ibm.as400.access.JobList#setName -**/ - public void setName (String name) - throws PropertyVetoException - { - if (name == null) - throw new NullPointerException ("name"); - - String oldValue = name_; - vetoableChangeSupport_.fireVetoableChange("name", oldValue, name); - name_ = name; - try { - jobList_.setSelectionValue(RJobList.JOB_NAME, name_); - } - catch(ResourceException e) { - errorEventSupport_.fireError(e); - } - propertyChangeSupport_.firePropertyChange("name", oldValue, name); - } - - - -/** -Sets the job number. The default is *ALL. - -@param number The job number, or *ALL to list jobs with any number. - -@exception PropertyVetoException If the change is vetoed. - -@see com.ibm.as400.access.JobList#setNumber -**/ - public void setNumber (String number) - throws PropertyVetoException - { - if (number == null) - throw new NullPointerException ("number"); - - String oldValue = number_; - vetoableChangeSupport_.fireVetoableChange("number", oldValue, number); - number_ = number; - try { - jobList_.setSelectionValue(RJobList.JOB_NUMBER, number_); - } - catch(ResourceException e) { - errorEventSupport_.fireError(e); - } - propertyChangeSupport_.firePropertyChange("number", oldValue, number); - } - - - -/** -Sets the system on which the list resides. - -@param system The system on which the list resides. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setSystem (AS400 system) - throws PropertyVetoException - { - if (system == null) - throw new NullPointerException ("system"); - - AS400 oldValue = jobList_.getSystem(); - vetoableChangeSupport_.fireVetoableChange("system", oldValue, system); - jobList_.setSystem (system); - propertyChangeSupport_.firePropertyChange("system", oldValue, system); - } - - - -/** -Sets the job user. The default is *ALL. - -@param user The job user. - -@exception PropertyVetoException If the change is vetoed. - -@see com.ibm.as400.access.JobList#setUser -**/ - public void setUser (String user) - throws PropertyVetoException - { - if (user == null) - throw new NullPointerException ("user"); - - String oldValue = user_; - vetoableChangeSupport_.fireVetoableChange("user", oldValue, user); - user_ = user; - try { - jobList_.setSelectionValue(RJobList.USER_NAME, user_); - } - catch(ResourceException e) { - errorEventSupport_.fireError(e); - } - propertyChangeSupport_.firePropertyChange("user", oldValue, user); - } - - - -/** -Sorts the children for the details. -@param propertyIdentifiers The property identifiers. -@param orders The sort orders for each property - identifier. true for ascending order; - false for descending order. -**/ - public void sortDetailsChildren (Object[] propertyIdentifiers, - boolean[] orders) - { -//@A2D if (propertyIdentifiers == null) -//@A2D throw new NullPointerException ("propertyIdentifiers"); -//@A2D if (orders == null) -//@A2D throw new NullPointerException ("orders"); - if (propertyIdentifiers == null) //@B0A - throw new NullPointerException ("propertyIdentifiers"); //@B0A - if (orders == null) //@B0A - throw new NullPointerException ("orders"); //@B0A - // @C1D VUtilities.sort(children_, propertyIdentifiers, orders); //@A2A - } - - - -/** -Returns the string representation of the description. - -@return The string representation of the description. -**/ - public String toString () - { - return description_; - } -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VJobList16.gif b/cvsroot/src/com/ibm/as400/vaccess/VJobList16.gif deleted file mode 100644 index 37fa92633..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VJobList16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VJobList32.gif b/cvsroot/src/com/ibm/as400/vaccess/VJobList32.gif deleted file mode 100644 index 2765c4d95..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VJobList32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VJobListBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/VJobListBeanInfo.java deleted file mode 100644 index 30ae19163..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VJobListBeanInfo.java +++ /dev/null @@ -1,199 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VJobListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The VJobListBeanInfo class provides bean information -for the VJobList class. - -@see VJobList -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VJobListBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = VJobList.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - String[] vobjectMethods = { "objectChanged", "objectCreated", "objectDeleted" }; - EventSetDescriptor vobject = new EventSetDescriptor (beanClass_, - "vobject", VObjectListener.class, vobjectMethods, - "addVObjectListener", "removeVObjectListener"); - vobject.setDisplayName (ResourceLoader.getText ("EVT_NAME_VOBJECT")); - vobject.setShortDescription (ResourceLoader.getText ("EVT_DESC_VOBJECT")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { error, vobject, working }; - - // Properties. - PropertyDescriptor name = new PropertyDescriptor ("name", beanClass_); - name.setBound (true); - name.setConstrained (true); - name.setDisplayName (ResourceLoader.getText ("PROP_NAME_NAME")); - name.setShortDescription (ResourceLoader.getText ("PROP_DESC_NAME")); - - PropertyDescriptor number = new PropertyDescriptor ("number", beanClass_); - number.setBound (true); - number.setConstrained (true); - number.setDisplayName (ResourceLoader.getText ("PROP_NAME_NUMBER")); - number.setShortDescription (ResourceLoader.getText ("PROP_DESC_NUMBER")); - - PropertyDescriptor system = new PropertyDescriptor ("system", beanClass_); - system.setBound (true); - system.setConstrained (true); - system.setDisplayName (ResourceLoader.getText ("PROP_NAME_SYSTEM")); - system.setShortDescription (ResourceLoader.getText ("PROP_DESC_SYSTEM")); - - PropertyDescriptor user = new PropertyDescriptor ("user", beanClass_); - user.setBound (true); - user.setConstrained (true); - user.setDisplayName (ResourceLoader.getText ("PROP_NAME_USER")); - user.setShortDescription (ResourceLoader.getText ("PROP_DESC_USER")); - - properties_ = new PropertyDescriptor[] { name, number, - system, user }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 2; // system. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("VJobList16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("VJobList32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VJobLogMessage.java b/cvsroot/src/com/ibm/as400/vaccess/VJobLogMessage.java deleted file mode 100644 index d28e26dc1..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VJobLogMessage.java +++ /dev/null @@ -1,406 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VJobLogMessage.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.QSYSObjectPathName; -import com.ibm.as400.resource.ResourceException; -import com.ibm.as400.resource.RQueuedMessage; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.Hashtable; -import javax.swing.Icon; - - - -/** -The VJobLogMessage class defines the representation of -a job log message on a system for use in various models -and panes in this package. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VJobLogMessage objects generate the following events: -

      -
    • ErrorEvent -
    • VObjectEvent -
    • WorkingEvent -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VJobLogMessage -implements VObject, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String description_ = ResourceLoader.getText ("JOB_LOG_MESSAGE_DESCRIPTION"); - private static final Icon icon16_ = ResourceLoader.getIcon ("VMessage16.gif", description_); - private static final Icon icon32_ = ResourceLoader.getIcon ("VMessage32.gif", description_); - - - - // Properties. - private RQueuedMessage message_ = null; - - - - // Private data. - transient private VPropertiesPane propertiesPane_; - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private VObjectEventSupport objectEventSupport_; - transient private WorkingEventSupport workingEventSupport_; - - - -/** -Property identifier for the date and time that the message was sent. -**/ - public static final Object DATE_PROPERTY = "Date"; - -/** -Property identifier for the from program. -**/ - public static final Object FROM_PROGRAM_PROPERTY = "From program"; - -/** -Property identifier for the ID. -**/ - public static final Object ID_PROPERTY = "ID"; - -/** -Property identifier for the severity. -**/ - public static final Object SEVERITY_PROPERTY = "Severity"; - -/** -Property identifier for the text. -**/ - public static final Object TEXT_PROPERTY = "Text"; - -/** -Property identifier for the type. -**/ - public static final Object TYPE_PROPERTY = "Type"; - - - -// Map vaccess property identifiers to resource attribute IDs: - private static final Hashtable map_ = new Hashtable(); - static { - map_.put(DATE_PROPERTY, RQueuedMessage.DATE_SENT); - map_.put(FROM_PROGRAM_PROPERTY, RQueuedMessage.SENDING_PROGRAM_NAME); - map_.put(ID_PROPERTY, RQueuedMessage.MESSAGE_ID); - map_.put(SEVERITY_PROPERTY, RQueuedMessage.MESSAGE_SEVERITY); - map_.put(TEXT_PROPERTY, RQueuedMessage.MESSAGE_TEXT); - map_.put(TYPE_PROPERTY, RQueuedMessage.MESSAGE_TYPE); - } - - - - // Properties pane layout. - private static ResourceProperties properties_ = null; - static { - // Resource properties pane layout. - properties_ = new ResourceProperties(); - properties_.addProperties(new Object[] { RQueuedMessage.MESSAGE_TEXT, RQueuedMessage.MESSAGE_HELP, - RQueuedMessage.MESSAGE_SEVERITY, RQueuedMessage.MESSAGE_TYPE, - RQueuedMessage.DATE_SENT, RQueuedMessage.SENDING_PROGRAM_NAME }); - - } - - - -/** -Constructs a VJobLogMessage object. - -@param message The job log message. -**/ - VJobLogMessage (RQueuedMessage message) - { - if (message == null) - throw new NullPointerException ("message"); - - message_ = message; - - initializeTransient (); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Returns the list of actions that can be performed. - -@return Always null. There are no actions. -**/ - public VAction[] getActions () - { - return null; - } - - - -/** -Returns the default action. - -@return Always null. There is no default action. -**/ - public VAction getDefaultAction () - { - return null; - } - - - -/** -Returns the icon. - -@param size The icon size, either 16 or 32. If any other - value is given, then return a default. -@param open This parameter has no effect. -@return The icon. -**/ - public Icon getIcon (int size, boolean open) - { - if (size == 32) - return icon32_; - else - return icon16_; - } - - - -/** -Returns the properties pane. - -@return The properties pane. -**/ - public VPropertiesPane getPropertiesPane () - { - return propertiesPane_; - } - - - -/** -Returns a property value. - -@param propertyIdentifier The property identifier. The choices are -
      -
    • NAME_PROPERTY -
    • DESCRIPTION_PROPERTY -
    • ID_PROPERTY -
    • TEXT_PROPERTY -
    • SEVERITY_PROPERTY -
    • TYPE_PROPERTY -
    • DATE_PROPERTY -
    • FROM_PROGRAM_PROPERTY -
    -@return The property value, or null if the - property identifier is not recognized. -**/ - public Object getPropertyValue (Object propertyIdentifier) - { - // Get the name. - if (propertyIdentifier == NAME_PROPERTY) - return this; - - // Get the description. - else if (propertyIdentifier == DESCRIPTION_PROPERTY) - return description_; - - else if (propertyIdentifier == null) - return null; - - else { - Object attributeID = map_.get(propertyIdentifier); - if (attributeID == null) - return null; - Object propertyValue; - try { - propertyValue = message_.getAttributeValue(attributeID); - } - catch(ResourceException e) { - errorEventSupport_.fireError(e); - return null; - } - if (propertyIdentifier == TYPE_PROPERTY) - return MessageUtilities.getTypeText(((Integer)propertyValue).intValue()); - else - return propertyValue; - } - } - - - -/** -Returns the text. This is the message ID. - -@return The message ID text. -**/ - public String getText () - { - String id; - try { - return (String)message_.getAttributeValue(RQueuedMessage.MESSAGE_ID); - } - catch(ResourceException e) { - return ""; - } - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - objectEventSupport_ = new VObjectEventSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - // Initialize the properties pane. - propertiesPane_ = new VResourcePropertiesPane(this, message_, properties_); - - propertiesPane_.addErrorListener (errorEventSupport_); - propertiesPane_.addVObjectListener (objectEventSupport_); - propertiesPane_.addWorkingListener (workingEventSupport_); - } - - - -/** -Loads information about the object from the system. -**/ - public void load () - { - // This does nothing. - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Returns the string representation. This is the message ID. - -@return The string representation of the message ID. -**/ - public String toString () - { - return getText(); - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VMRI.java b/cvsroot/src/com/ibm/as400/vaccess/VMRI.java deleted file mode 100644 index d164b4d0a..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VMRI.java +++ /dev/null @@ -1,1194 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VMRI.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.util.*; - -/** -Locale-specific objects for the IBM Toolbox for Java. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VMRI extends ListResourceBundle -{ - // NLS_MESSAGEFORMAT_NONE - // Each string is assumed NOT to be processed by the MessageFormat class. - // This means that a single quote must be coded as 1 single quote. - - // NLS_ENCODING=UTF-8 - // Instructs the translation tools to interpret the text as UTF-8. - - public Object[][] getContents() - { - return resources; - } - - private final static Object[][] resources= { - // #TRANNOTE Before you add a new resource, please make - // #TRANNOTE sure you are not duplicating another. The - // #TRANNOTE goal is to keep the amount of translatable - // #TRANNOTE text down. - // #TRANNOTE - // #TRANNOTE NOTE TO TRANSLATORS: The format of a line of MRI - // #TRANNOTE is { "KEY", "value" }, - // #TRANNOTE - // #TRANNOTE The key must be left alone so translate only the value. - // #TRANNOTE - // #TRANNOTE - - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for actions. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix ACTION_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - { "ACTION_AVAILABLE", "Make available" }, - { "ACTION_CLEAR", "Clear" }, - { "ACTION_DIRECTORY_CREATE", "Create Directory" }, - { "ACTION_DELETE", "Delete" }, - { "ACTION_EDIT", "Edit" }, - { "ACTION_FILE_CREATE", "Create File" }, - { "ACTION_HOLD", "Hold" }, - { "ACTION_LIST_PROPERTIES", "List properties" }, // @D0A - { "ACTION_MODIFY", "Modify" }, - { "ACTION_MOVE", "Move" }, - { "ACTION_PRINTNEXT", "Print next" }, - { "ACTION_PROPERTIES", "Properties" }, - { "ACTION_RELEASE", "Release" }, - { "ACTION_REMOVE", "Remove" }, - { "ACTION_RENAME", "Rename" }, - { "ACTION_REPLY", "Reply" }, - { "ACTION_SEND", "Send" }, - { "ACTION_START", "Start" }, - { "ACTION_STOP", "Stop" }, - { "ACTION_UNAVAILABLE", "Make unavailable" }, - { "ACTION_VIEW", "View" }, - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for column names. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix COLUMN_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - { "COLUMN_ATTRIBUTES", "Attributes" }, - { "COLUMN_DESCRIPTION", "Description" }, - { "COLUMN_GROUP", "Group" }, - { "COLUMN_MODIFIED", "Modified" }, - { "COLUMN_NAME", "Name" }, - { "COLUMN_SIZE", "Size" }, - { "COLUMN_VALUE", "Value" }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for SQLResultSetForm and RecordListForm GUI. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix DBFORM_ and - // #TRANNOTE then a short identifier to describe the text. - - // #TRANNOTE The number (index) of the record in this result set. - // #TRANNOTE The ending colon is a separator between this label - // #TRANNOTE and the value. - { "DBFORM_LABEL_RECORD_NUMBER", "Record number:" }, - - // #TRANNOTE Status message telling the user that there are no database - // #TRANNOTE records to display. - { "DBFORM_MSG_NO_DATA", "No data records available." }, - - // #TRANNOTE Tooltip to display the first record. - { "DBFORM_TOOLTIP_FIRST", "First" }, - - // #TRANNOTE Tooltip to display the last record. - { "DBFORM_TOOLTIP_LAST", "Last" }, - - // #TRANNOTE Tooltip to display the next record. - { "DBFORM_TOOLTIP_NEXT", "Next" }, - - // #TRANNOTE Tooltip to display the previous record. - { "DBFORM_TOOLTIP_PREVIOUS", "Previous" }, - - // #TRANNOTE Tooltip to refresh the data. - { "DBFORM_TOOLTIP_REFRESH", "Refresh" }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for dialog boxes. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix DLG_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - { "DLG_ADD", "Add" }, - { "DLG_APPLY", "Apply" }, - { "DLG_CANCEL", "Cancel" }, - { "DLG_CHANGE", "Change" }, - { "DLG_CONFIRM_CLEAR", "Are you sure you want to clear this message queue?" }, - { "DLG_CONFIRM_CLEAR_TITLE", "Confirm Clear" }, - { "DLG_CONFIRM_DELETION", "Are you sure you want to delete this object?" }, - { "DLG_CONFIRM_DELETION_TITLE", "Confirm Delete" }, - { "DLG_CONFIRM_EXIT", "Are you sure you want to exit?" }, // @A1A - { "DLG_CONFIRM_EXIT_TITLE", "Confirm Exit" }, // @A1A - { "DLG_CONFIRM_REMOVE", "Are you sure you want to remove this object?" }, - { "DLG_CONFIRM_REMOVE_TITLE", "Confirm Remove" }, - { "DLG_CONFIRM_SAVE", "The text in the file has changed. Do you want to save the changes?" }, - { "DLG_CONFIRM_SAVE_TITLE", "Confirm Save" }, - { "DLG_ERROR_TITLE", "Error" }, - { "DLG_FALSE", "False" }, - { "DLG_INVALID_INPUT", "Input not valid" }, // @A3A //@A8C - { "DLG_OK", "OK" }, - { "DLG_NO", "No" }, - { "DLG_MODIFY", "Modify" }, - { "DLG_MODIFY_0", "Modify &0" }, // @D1A - { "DLG_PROPERTIES_TITLE", "&0 Properties" }, // @A2C - { "DLG_REMOVE", "Remove" }, - { "DLG_REPLACE", "Replace" }, - { "DLG_TRUE", "True" }, - { "DLG_YES", "Yes" }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE Events. - // #TRANNOTE ##################################################### - // #TRANNOTE Event descriptors starts with the prefix EVT_DESC, - // #TRANNOTE event names start with EVT_NAME and - // #TRANNOTE then a short identifier to describe the message. - // #TRANNOTE - { "EVT_DESC_DATA_QUEUE", "A data queue event has occurred." }, - - // #TRANNOTE A data queue event has occurred. - { "EVT_NAME_DATA_QUEUE", "dataQueue" }, - - { "EVT_DESC_DOCUMENT", "A document event has occurred." }, - - // #TRANNOTE A document event has occurred. - { "EVT_NAME_DOCUMENT", "document" }, - - { "EVT_DESC_ERROR", "An error has occurred." }, - - // #TRANNOTE An error has occurred. - { "EVT_NAME_ERROR", "error" }, - - { "EVT_DESC_FILE", "A file event has occurred." }, - - // #TRANNOTE A file event has occurred. - { "EVT_NAME_FILE", "file" }, - - { "EVT_DESC_ACTION_COMPLETED", "The action has completed." }, - - // #TRANNOTE The action has completed. - { "EVT_NAME_ACTION_COMPLETED", "actionCompleted" }, - - { "EVT_DESC_DOCUMENT", "The document has changed." }, - - // #TRANNOTE The document has changed. - { "EVT_NAME_DOCUMENT", "document" }, - - { "EVT_DESC_LIST_DATA", "The data in the list model has changed." }, - - // #TRANNOTE The data in the list model has changed. - { "EVT_NAME_LIST_DATA", "listData" }, - - { "EVT_DESC_LIST_SELECTION", "A selection was made." }, - - // #TRANNOTE A selection was made. - { "EVT_NAME_LIST_SELECTION", "listSelection" }, - - // #TRANNOTE The meaning of 'property' here is like 'attribute'. - { "EVT_DESC_PROPERTY_CHANGE", "A bound property has changed." }, - - // #TRANNOTE A bound property has changed. - // #TRANNOTE The meaning of 'property' here is like 'attribute'. - { "EVT_NAME_PROPERTY_CHANGE", "propertyChange" }, - - // #TRANNOTE The meaning of 'property' here is like 'attribute'. - { "EVT_DESC_PROPERTY_VETO", "A constrained property has changed." }, - - // #TRANNOTE A constrained property has changed. - // #TRANNOTE The meaning of 'property' here is like 'attribute'. - { "EVT_NAME_PROPERTY_VETO", "vetoableChange" }, - - { "EVT_DESC_TABLE_MODEL", "The data in the table model has changed." }, - - // #TRANNOTE The data in the table model has changed. - { "EVT_NAME_TABLE_MODEL", "tableModel" }, - - { "EVT_DESC_TREE_EXPANSION", "Part of the tree was expanded or collapsed." }, - - // #TRANNOTE Part of the tree was expanded or collapsed. - { "EVT_NAME_TREE_EXPANSION", "treeExpansion" }, - - { "EVT_DESC_TREE_MODEL", "The data in the tree model has changed." }, - - // #TRANNOTE The data in the tree model has changed. - { "EVT_NAME_TREE_MODEL", "treeModel" }, - - { "EVT_DESC_TREE_SELECTION", "A tree selection was made." }, - - // #TRANNOTE A tree selection was made. - { "EVT_NAME_TREE_SELECTION", "treeSelection" }, - - { "EVT_DESC_UNDOABLE_EDIT", "An edit operation which is undoable occurred." }, - - // #TRANNOTE An edit operation which is undoable occurred. - { "EVT_NAME_UNDOABLE_EDIT", "undoableEdit" }, - - { "EVT_DESC_VOBJECT", "An AS400 object has been changed, created, or deleted." }, - - // #TRANNOTE An AS400 object has been changed, created, or deleted. - { "EVT_NAME_VOBJECT", "vobject" }, - - { "EVT_DESC_WORKING", "A request has started or completed." }, - - // #TRANNOTE A request has started or completed. - { "EVT_NAME_WORKING", "working" }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE Common exception messages. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix EXC_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - { "EXC_AS400_ERROR", "An error occurred on the system." }, //@550 - { "EXC_DIRECTORY_NOT_CREATED", "Directory not created." }, - { "EXC_FILE_ALREADY_EXISTS", "File already exists." }, - { "EXC_FILE_NOT_CREATED", "File not created." }, - { "EXC_FILE_NOT_DELETED", "File or directory not deleted." }, - { "EXC_FILE_NOT_FOUND", "File not found." }, - { "EXC_FILE_NOT_RENAMED", "File or directory not renamed." }, - - // #TRANNOTE The database connection or table property - // #TRANNOTE has not been set. - { "EXC_NO_TABLE", "No tables were specified." }, - - // #TRANNOTE The table property is not formatted correctly. - { "EXC_TABLE_SPEC_NOT_VALID", "Table specification not valid." }, - - // #TRANNOTE The specified column identifier is not in the table. - { "EXC_COLUMN_NOT_VALID", "Column identifier not valid." }, - - // #TRANNOTE The row index is not in the valid range for the table. - { "EXC_ROW_NOT_VALID", "Row index out of range." }, - - - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for general text that does not fit into the other - // #TRANNOTE categories and may be used by more than one component. - // #TRANNOTE ##################################################### - // #TRANNOTE There is no set pattern for these keys. - // #TRANNOTE -//@B1D { "DATE_FORMAT" , "MM/dd/yyyy" }, -//@B1D { "TIME_FORMAT" , "hh:mm:ss" }, - { "LIBRARY", "Library" }, //@A5A - - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for IFS GUIs. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix IFS_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - { "IFS_ATTRIBUTES", "Attributes" }, - { "IFS_BYTE", "byte" }, - { "IFS_BYTES", "bytes" }, - { "IFS_CONTAINS", "Contains" }, - { "IFS_ALL_FILES_FILTER", "All files" }, - { "IFS_DIRECTORIES", "Directories" }, - { "IFS_DIRECTORY", "Directory" }, - { "IFS_DIRECTORY_DESCRIPTION", "Directory" }, - { "IFS_FILE", "File" }, - { "IFS_FILE_DESCRIPTION", "File" }, - { "IFS_FILE_NAME", "File name" }, - { "IFS_FILES", "Files" }, - { "IFS_FILES_OF_TYPE", "Files of type" }, - { "IFS_LOCATION", "Location" }, - { "IFS_MODIFIED", "Modified" }, - { "IFS_NAME", "File System" }, - { "IFS_NEW_DIRECTORY", "New Folder" }, - { "IFS_NEW_FILE", "New File" }, - { "IFS_READ", "Read" }, - { "IFS_READ_ABBREVIATION", "R" }, - { "IFS_SIZE", "Size" }, - { "IFS_ALL_FILES_FILTER", "Text files" }, - { "IFS_WRITE", "Write" }, - { "IFS_WRITE_ABBREVIATION", "W" }, - - - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for Job GUIs. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix JOB_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - { "JOB_ACCOUNTING_CODE", "Job accounting code"}, - { "JOB_ACTIVE_DATE", "Date job became active"}, - { "JOB_ACTIVE_TIME", "Time job became active"}, - { "JOB_AUXILIARY_IO_REQUESTS", "Auxiliary I/O Requests" }, - { "JOB_BREAK_MESSAGE_HANDLING", "Break message handling"}, - { "JOB_CCSID", "CCSID"}, - { "JOB_COMPLETION_STATUS", "Job completion status"}, - { "JOB_COUNTRY_ID", "Country or Region ID"}, // @D4C - { "JOB_CPU_USED", "CPU Used" }, - { "JOB_CURRENT_LIB_EXISTENCE", "Current library existence"}, - { "JOB_CURRENT_LIB", "Current library if one exists"}, - { "JOB_DATE", "Job date" }, - { "JOB_DATE_ENTERED_SYSTEM", "Date entered system" }, - { "JOB_DATE_FORMAT", "Date format"}, - { "JOB_DATE_SEPARATOR", "Date separator"}, - { "JOB_DDM_CONVERSATION_HANDLING", "DDM conversation action"}, - { "JOB_DECIMAL_FORMAT", "Decimal format"}, - { "JOB_DEFAULT_CCSID", "Default CCSID"}, - { "JOB_DEFAULT_WAIT", "Default waiting time"}, - { "JOB_DESCRIPTION" , "Description" }, - { "JOB_DESCRIPTION_NAME", "Job description" }, -//@A5D { "JOB_DESCRIPTION_LIB", " Library" }, - { "JOB_DEVICE_RECOVERY_ACTION", "Device recovery action"}, - { "JOB_END_SEVERITY", "End severity"}, - { "JOB_ENTERED_SYSTEM_DATE", "Date entered system"}, - { "JOB_ENTERED_SYSTEM_TIME", "Time entered system"}, - { "JOB_FUNCTION", "Function" }, - { "JOB_FUNCTION_NAME", "Function name" }, - { "JOB_FUNCTION_TYPE", "Function type" }, - { "JOB_INTERACTIVE_TRANSACTIONS", "Interactive transactions" }, - { "JOB_INQUIRY_MESSAGE_REPLY", "Inquiry message reply"}, - { "JOB_LANGUAGE_ID", "Language ID"}, - { "JOB_LIST_DESCRIPTION", "Job list" }, - { "JOB_LOG_MESSAGE_DESCRIPTION", "Job log message" }, - { "JOB_LOGGING_CL_PROGRAMS", "Logging of CL programs"}, - { "JOB_LOGGING_LEVEL", "Logging level"}, - { "JOB_LOGGING_SEVERITY", "Logging severity"}, - { "JOB_LOGGING_TEXT", "Logging text"}, - { "JOB_MESSAGE_QUEUE_FULL_ACTION", "Message queue full action"}, - { "JOB_MESSAGE_QUEUE_MAXIMUM_SIZE", "Message queue maximum size"}, - { "JOB_MODE_NAME", "Job mode"}, - { "JOB_NAME", "Job name" }, - { "JOB_NUMBER", "Job number" }, - { "JOB_NUMBER_OF_LIBRARIES_IN_SYSLIBL", "Number of libraries in SYSLIBL"}, - { "JOB_NUMBER_OF_LIBRARIES_IN_USRLIBL", "Number of libraries in USRLIBL"}, - { "JOB_NUMBER_OF_PRODUCT_LIBRARIES", "Number of product libraries"}, - { "JOB_POOL_IDENTIFIER", "Pool identifier"}, - { "JOB_PRINTER_DEVICE_NAME", "Printer device"}, - { "JOB_PRINT_KEYFORMAT", "Print key format"}, - { "JOB_PRINT_TEXT", "Print text"}, //@A5C: Removed leading blanks - { "JOB_PRODUCT_LIBL", "Product libraries if they exist"}, - { "JOB_PURGE", "Eligible for purge"}, - { "JOB_PUTON_JOBQUEUE_DATE", "Date job put on job queue"}, - { "JOB_PUTON_JOBQUEUE_TIME", "Time job put on job queue"}, - { "JOB_QUEUE", "Job queue" }, - { "JOB_QUEUE_NAME", "Job queue" }, -//@A5D { "JOB_QUEUE_LIB", " Library" }, - { "JOB_OUTPUT_QUEUE_NAME", "Output queue" }, -//@A5D { "JOB_OUTPUT_QUEUE_LIB", " Library" }, - { "JOB_OUTPUT_QUEUE_PRIORITY", "Output queue priority" }, - { "JOB_QUEUE_PRIORITY", "Job queue priority" }, - { "JOB_ROUTING_DATA", "Routing data"}, - { "JOB_RUN_PRIORITY", "Run priority" }, - { "JOB_SCHEDULE_DATE", "Date scheduled to run"}, - { "JOB_SCHEDULE_TIME", "Time scheduled to run"}, - { "JOB_SIGNED_ON_JOB", "Signed-on job"}, - { "JOB_SORT_SEQUENCE_NAME", "Sort sequence"}, -//@A5D { "JOB_SORT_SEQUENCE_LIB", " Library"}, - { "JOB_STATUS", "Status" }, - { "JOB_STATUS_IN_JOBQUEUE", "Job status in job queue" }, - { "JOB_STATUS_MESSAGE_HANDLING", "Status message handling"}, - { "JOB_SUBSYSTEM", "Subsystem" }, - { "JOB_SUBSYSTEM_NAME", "Subsystem name" }, -//@A5D { "JOB_SUBSYSTEM_LIB", " Library" }, - { "JOB_SUBTYPE", "Subtype" }, - { "JOB_SWITCHES", "Job switches"}, - { "JOB_SYSTEM_LIBL", "System library list"}, - { "JOB_SYSTEM_POOL_IDENTIFIER", "System pool identifier" }, - { "JOB_TIME_SEPARATOR", "Time separator"}, - { "JOB_TIME_SLICE", "Time slice"}, - { "JOB_TIME_SLICE_END_POOL", "Time slice end pool"}, - { "JOB_TOTAL_RESPONSE_TIME", "Total response time" }, - { "JOB_TYPE", "Type" }, - { "JOB_USER", "User" }, - { "JOB_USER_LIBL", "User library list"}, - { "JOB_WORK_ID_UNIT", "Unit of work ID"}, - - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for menus. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix MENU_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - { "MENU_ACTUAL_SIZE", "Actual Size" }, // @A1A - { "MENU_COPY", "Copy" }, - { "MENU_CUT", "Cut" }, - { "MENU_EDIT", "Edit" }, - { "MENU_EXIT", "Exit" }, - { "MENU_FILE", "File" }, - { "MENU_FIRST_PAGE", "First Page" }, // @A1A - { "MENU_FIT_PAGE", "Fit Page" }, // @A1A - { "MENU_FIT_WIDTH", "Fit Width" }, // @A1A - { "MENU_FLASH_PAGE", "Flash Page" }, // @A1A - { "MENU_GO_TO_PAGE", "Go To Page" }, // @A1A - { "MENU_HIDE_STATUS_BAR", "Hide Status Bar" }, // @A1A - { "MENU_HIDE_TOOL_BAR", "Hide Tool Bar" }, // @A1A - { "MENU_LAST_PAGE", "Last Page" }, // @A1A - { "MENU_NEXT_PAGE", "Next Page" }, // @A1A - { "MENU_OPTIONS", "Options" }, // @A1A - { "MENU_PASTE", "Paste" }, - { "MENU_PREVIOUS_PAGE" , "Previous Page" }, // @A1A - { "MENU_SHOW_STATUS_BAR", "Show Status Bar" }, // @A1A - { "MENU_SHOW_TOOL_BAR", "Show Tool Bar" }, // @A1A - { "MENU_SAVE", "Save" }, - { "MENU_SELECT_ALL", "Select All" }, - { "MENU_VIEW", "View" }, // @A1A - { "MENU_ZOOM", "Zoom" }, // @A1A - - - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for Message GUIs. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix MESSAGE_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - { "MESSAGE_DATE", "Date" }, - { "MESSAGE_DESCRIPTION", "Message" }, - { "MESSAGE_FILE", "Message file" }, - { "MESSAGE_FROM_JOB", "From job" }, - { "MESSAGE_FROM_JOB_NUMBER", "From job number" }, - { "MESSAGE_FROM_PROGRAM", "From program" }, - { "MESSAGE_FROM_USER", "From user" }, - { "MESSAGE_ID", "ID" }, - { "MESSAGE_LIST_DESCRIPTION", "Message list" }, - { "MESSAGE_QUEUE", "Message queue" }, - { "MESSAGE_QUEUE_CHOICE_ALL", "All" }, - { "MESSAGE_QUEUE_CHOICE_MNR", "Messages needing reply" }, - { "MESSAGE_QUEUE_CHOICE_MNNR", "Messages not needing reply" }, - { "MESSAGE_QUEUE_CHOICE_SCNR", "Senders copy needing reply" }, - { "MESSAGE_QUEUE_DESCRIPTION", "Message queue" }, - { "MESSAGE_QUEUED_DESCRIPTION", "Queued message" }, - { "MESSAGE_REPLY", "Reply" }, - { "MESSAGE_SELECTION", "Selection" }, - { "MESSAGE_SEVERITY", "Severity" }, - { "MESSAGE_TEXT", "Text" }, - { "MESSAGE_TYPE", "Type" }, - - { "MESSAGE_TYPE_COMPLETION", "Completion" }, - { "MESSAGE_TYPE_DIAGNOSTIC", "Diagnostic" }, - { "MESSAGE_TYPE_INFORMATIONAL", "Informational" }, - { "MESSAGE_TYPE_INQUIRY", "Inquiry" }, - { "MESSAGE_TYPE_SENDERS_COPY", "Senders copy" }, - { "MESSAGE_TYPE_REQUEST", "Request" }, - { "MESSAGE_TYPE_REQUEST_WITH_PROMPTING", "Request with prompting" }, - { "MESSAGE_TYPE_NOTIFY", "Notify" }, - { "MESSAGE_TYPE_ESCAPE", "Escape" }, - { "MESSAGE_TYPE_REPLY_NOT_VALIDITY_CHECKED", "Reply not validity checked" }, - { "MESSAGE_TYPE_REPLY_VALIDITY_CHECKED", "Reply validity checked" }, - { "MESSAGE_TYPE_REPLY_MESSAGE_DEFAULT_USED", "Reply message default used" }, - { "MESSAGE_TYPE_REPLY_SYSTEM_DEFAULT_USED", "Reply system default used" }, - { "MESSAGE_TYPE_REPLY_FROM_SYSTEM_REPLY_LIST", "Reply from system reply list" }, - { "MESSAGE_TYPE_UNEXPECTED", "Unexpected" }, - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for Object Authority GUIs. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix OBJECT_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - - - { "OBJECT_ADD_DIALOG_TITLE", "Add a User" }, - { "OBJECT_ADD_MESSAGE", "User Name: " }, - { "OBJECT_ADD_USER_EXCEPTION_DIALOG_MESSAGE" , "The user already exists." }, //@A8C - { "OBJECT_ADD_USER_EXCEPTION_DIALOG_TITLE" , "Error" }, - { "OBJECT_AUTHORITY_ADD" , "Add" }, - { "OBJECT_AUTHORITY_ALL", "All" }, - { "OBJECT_AUTHORITY_ALTER" , "Alter" }, - { "OBJECT_AUTHORITY_CHANGE", "Change" }, - { "OBJECT_AUTHORITY_DELETE" , "Delete" }, - { "OBJECT_AUTHORITY_EXCLUDE" , "Exclude" }, - { "OBJECT_AUTHORITY_EXECUTE" , "Execute" }, - { "OBJECT_AUTHORITY_EXISTENCE" , "Existence" }, - { "OBJECT_AUTHORITY_MANAGEMENT" , "Management" }, - { "OBJECT_AUTHORITY_OPERATION" , "Operation" }, - { "OBJECT_AUTHORITY_READ" , "Read" }, - { "OBJECT_AUTHORITY_REFERENCE" , "Reference" }, - { "OBJECT_AUTHORITY_UPDATE" , "Update" }, - { "OBJECT_AUTHORITY_USE", "Use" }, - { "OBJECT_AUTHORITY_USER_DEF", "User Defined" }, //@A8A - { "OBJECT_AUTHORITY_WRITE" , "Write" }, - { "OBJECT_AUTHORIZATION_LIST", "Authorization List" }, //@A8C - { "OBJECT_COMMIT_DIALOG_MESSAGE" , "Data commit error." }, //@A8C - { "OBJECT_COMMIT_DIALOG_TITLE" , "Error" }, - { "OBJECT_FROM_AUTHORIZATION_LIST" , "From Authorization List" }, - { "OBJECT_GROUP", "Primary Group" }, - { "OBJECT_LIST_MANAGEMENT", "List Management" }, //@A8A - { "OBJECT_NAME", "Object" }, - { "OBJECT_OWNER", "Owner" }, - { "OBJECT_PERMISSION", "&0 Permissions" }, // @D2C - { "OBJECT_PERMISSION2", "Permissions" }, // @D2A - { "OBJECT_PERMISSION_DIALOG_MESSAGE" , "Can not display the permission of the object." }, //@A8C - { "OBJECT_PERMISSION_DIALOG_TITLE" , "Error" }, - { "OBJECT_REMOVE_DIALOG_TITLE", "Remove a User" }, - { "OBJECT_REMOVE_MESSAGE", "Are you sure you want to remove the user?" }, - { "OBJECT_TYPE", "Type" }, - { "OBJECT_TYPE_NO_DEFINED" , "Not defined." }, - { "OBJECT_USER_NAME", "Name" }, - - - - - // #TRANNOTE ##################################################### - // #TRANNOTE This is information about this product. - // #TRANNOTE ##################################################### - { "PRODUCT_TITLE", "Toolbox for Java" }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE Short descriptions, display names, and values for - // #TRANNOTE properties. Descriptions start with PROP_DESC_ prefix, - // #TRANNOTE display names start with PROP_NAME, values start with - // #TRANNOTE PROP_VALUE. - // #TRANNOTE ##################################################### - { "PROP_DESC_ACTION", "The action to perform." }, - - // #TRANNOTE The action to perform. - { "PROP_NAME_ACTION", "action" }, - - { "PROP_DESC_ACTION_CONTEXT", "The context in which actions will be performed." }, - - // #TRANNOTE The context in which actions will be performed. - { "PROP_NAME_ACTION_CONTEXT", "actionContext" }, - - { "PROP_DESC_ALLOW_ACTIONS", "Determines if actions are allowed." }, - - // #TRANNOTE Determines if actions are allowed. - { "PROP_NAME_ALLOW_ACTIONS", "allowActions" }, - - { "PROP_DESC_CANCEL_BUTTON_TEXT", "The text for the Cancel button." }, - - // #TRANNOTE The text for the Cancel button. - { "PROP_NAME_CANCEL_BUTTON_TEXT", "cancelButtonText" }, - - { "PROP_DESC_COLUMN_MODEL", "The column model." }, - - { "PROP_DESC_COLUMN_ATTRIBUTE_IDS", "The column attribute IDs." }, // @D0A - - // #TRANNOTE The resource list for various models and panes. - { "PROP_NAME_COLUMN_ATTRIBUTE_IDS", "columnAttributeIDs" }, // @D0A - - // #TRANNOTE The column model. - { "PROP_NAME_COLUMN_MODEL", "columnModel" }, - - { "PROP_DESC_COMMAND", "The command." }, - - // #TRANNOTE The command. - { "PROP_NAME_COMMAND", "command" }, - - { "PROP_DESC_COMPONENT", "The component that determined the parent frame for dialogs." }, - - // #TRANNOTE The component that determined that parent frame for dialogs. - { "PROP_NAME_COMPONENT", "component" }, - - { "PROP_DESC_CONFIRM", "Determines if certain actions are confirmed." }, - - // #TRANNOTE Determines if certain actions are confirmed. - { "PROP_NAME_CONFIRM", "confirm" }, - - { "PROP_DESC_CONNECTION", "The SQL connection." }, - - // #TRANNOTE The SQL connection. - { "PROP_NAME_CONNECTION", "connection" }, - - { "PROP_DESC_DIRECTORY", "The path name of the directory." }, - - // #TRANNOTE The path name of the directory. - { "PROP_NAME_DIRECTORY", "directory" }, - - { "PROP_DESC_ENABLED", "Determines if the action is enabled." }, - - // #TRANNOTE Whether the action is enabled. - { "PROP_NAME_ENABLED", "enabled" }, - - { "PROP_DESC_FILE_NAME", "The name of the file." }, - - // #TRANNOTE The name of the file. - { "PROP_NAME_FILE_NAME", "fileName" }, - - { "PROP_DESC_FILE_ENABLE", "Determines if the control is enabled." }, - - // #TRANNOTE Whether the control is enabled or disabled. - { "PROP_NAME_FILE_ENABLE", "enabled" }, - - { "PROP_DESC_FILTER", "The file filter." }, - - // #TRANNOTE The file filter. - { "PROP_NAME_FILTER", "filter" }, - - { "PROP_DESC_GRID_COLOR", "The color of the grid lines in the table." }, - - // #TRANNOTE The color of the grid lines in the table. - { "PROP_NAME_GRID_COLOR", "gridColor" }, - - { "PROP_DESC_GROUP_INFO", "The group information." }, - - // #TRANNOTE The group information. - { "PROP_NAME_GROUP_INFO", "groupInfo" }, - - { "PROP_DESC_ICON", "The icon displayed on this control." }, - - // #TRANNOTE The icon displayed on this control. - { "PROP_NAME_ICON", "icon" }, - - { "PROP_DESC_INCLUDE", "Indicates if files, directories, or both are included." }, - - // #TRANNOTE Indicates if files, directories, or both are included. - { "PROP_NAME_INCLUDE", "include" }, - { "PROP_VALUE_INCLUDE_DIRECTORIES", "Include directories" }, - { "PROP_VALUE_INCLUDE_FILES", "Include files" }, - { "PROP_VALUE_INCLUDE_BOTH", "Include both" }, - - { "PROP_DESC_JOB", "The job." }, - - // #TRANNOTE The job. - { "PROP_NAME_JOB", "job" }, - - { "PROP_DESC_KEY", "The values for the key fields." }, - - // #TRANNOTE The values for the key fields. - { "PROP_NAME_KEY", "key" }, - - { "PROP_DESC_KEYED", "Indicates if keyed or sequential access should be used." }, - - // #TRANNOTE Indicates if keyed or sequential access should be used for a file. - { "PROP_NAME_KEYED", "keyed" }, - - { "PROP_DESC_MESSAGE_LIST", "The messages resulting from a command or program call." }, - - // #TRANNOTE The messages resulting from a command or program call. - { "PROP_NAME_MESSAGE_LIST", "messageList" }, - - { "PROP_DESC_MESSAGE_TEXT", "The last message resulting from a command or program call." }, - - // #TRANNOTE The last message resulting from a command or program call. - { "PROP_NAME_MESSAGE_TEXT", "messageText" }, - - { "PROP_DESC_MODEL", "The data model that is presented." }, - - // #TRANNOTE The data model that is presented. - { "PROP_NAME_MODEL", "model" }, - - { "PROP_DESC_NAME", "The job name." }, - - // #TRANNOTE The job name. - { "PROP_NAME_NAME", "name" }, - - { "PROP_DESC_NUMBER", "The job number." }, - - // #TRANNOTE The job number. - { "PROP_NAME_NUMBER", "number" }, - - { "PROP_DESC_OBJECT", "The object." }, - - // #TRANNOTE The object. - { "PROP_NAME_OBJECT", "object" }, - - { "PROP_DESC_OK_BUTTON_TEXT", "The text for the OK button." }, - - // #TRANNOTE The text for the OK button. - { "PROP_NAME_OK_BUTTON_TEXT", "okButtonText" }, - - { "PROP_DESC_PARAMETER_LIST", "The parameter list." }, - - // #TRANNOTE The parameter list. - { "PROP_NAME_PARAMETER_LIST", "parameterList" }, - - { "PROP_DESC_PASSWORD", "The password." }, - - // #TRANNOTE The password for this database connection. - { "PROP_NAME_PASSWORD", "password" }, - - { "PROP_DESC_PATH", "The path name." }, - - // #TRANNOTE The path name. - { "PROP_NAME_PATH", "path" }, - - { "PROP_DESC_PATTERN", "The pattern that all file and directory names must match." }, - - // #TRANNOTE The pattern that all file and directory names must match. - { "PROP_NAME_PATTERN", "pattern" }, - - { "PROP_DESC_PROGRAM", "The program." }, - - // #TRANNOTE The program. - { "PROP_NAME_PROGRAM", "program" }, - - { "PROP_DESC_PROPERTIES", "The properties." }, - - // #TRANNOTE The properties for this database connection. - { "PROP_NAME_PROPERTIES", "properties" }, - - { "PROP_DESC_QUERY", "The SQL query." }, - - // #TRANNOTE The SQL query. - { "PROP_NAME_QUERY", "query" }, - - { "PROP_DESC_RESOURCE_LIST", "The resource list." }, // @D0A - - // #TRANNOTE The resource list for various models and panes. - { "PROP_NAME_RESOURCE_LIST", "resourceList" }, // @D0A - - { "PROP_DESC_RESOURCE_PROPERTIES", "The resource properties." }, // @D0A - - // #TRANNOTE The resource properties for various models and panes. - { "PROP_NAME_RESOURCE_PROPERTIES", "resourceProperties" }, // @D0A - - { "PROP_DESC_ROOT", "The root object." }, - - // #TRANNOTE The root object for various models and panes. - { "PROP_NAME_ROOT", "root" }, - - { "PROP_DESC_SEARCH_TYPE", "The search type used for keyed access." }, - - // #TRANNOTE The search type used for keyed access. - { "PROP_NAME_SEARCH_TYPE", "searchType" }, - - { "PROP_DESC_SELECTION_MODEL", "The selection model." }, - - // #TRANNOTE The selection model. - { "PROP_NAME_SELECTION_MODEL", "selectionModel" }, - - { "PROP_DESC_SELECTION", "The type of messages to include in the list." }, - - // #TRANNOTE The type of messages to include in the list. - { "PROP_NAME_SELECTION", "selection" }, - - { "PROP_DESC_SEVERITY", "The severity of messages to include in the list." }, - - // #TRANNOTE The severity of messages to include in the list. - { "PROP_NAME_SEVERITY", "severity" }, - - { "PROP_DESC_SHOW_H_LINES", "Display horizontal lines between rows in the table." }, - - // #TRANNOTE Display horizontal lines between rows in the table. - { "PROP_NAME_SHOW_H_LINES", "showHorizontalLines" }, - - { "PROP_DESC_SHOW_V_LINES", "Display vertical lines between columns in the table." }, - - // #TRANNOTE Display vertical lines between columns in the table. - { "PROP_NAME_SHOW_V_LINES", "showVerticalLines" }, - - { "PROP_DESC_SQL", "The SQL statement which will be run." }, - - // #TRANNOTE The SQL statement which will be run. - { "PROP_NAME_SQL", "SQLStatement" }, - - { "PROP_DESC_STATE", "The state of the dialog." }, - - // #TRANNOTE The state of the dialog. - { "PROP_NAME_STATE", "state" }, - { "PROP_VALUE_STATE_ACTIVE", "Active" }, - { "PROP_VALUE_STATE_OK", "OK" }, - { "PROP_VALUE_STATE_CANCEL", "Cancel" }, - - { "PROP_DESC_SYSTEM", "The system on which the object resides." }, //@550 - - // #TRANNOTE The system on which the object resides. //@550 - { "PROP_NAME_SYSTEM", "system" }, - - { "PROP_DESC_TABLE_SCHEMAS", "The database schemas for which tables are shown." }, - - // #TRANNOTE The schemas for which tables are shown. - { "PROP_NAME_TABLE_SCHEMAS", "tableSchemas" }, - - { "PROP_DESC_TABLES", "The tables for the query." }, - - // #TRANNOTE The tables for the query. - { "PROP_NAME_TABLES", "tables" }, - - { "PROP_DESC_TEXT", "The text displayed on this control." }, - - // #TRANNOTE The text displayed on this control. - { "PROP_NAME_TEXT", "text" }, - - { "PROP_DESC_URL", "The URL for this database connection." }, - - // #TRANNOTE The URL for this database connection. - { "PROP_NAME_URL", "URL" }, - - { "PROP_DESC_USER", "The user." }, - - // #TRANNOTE The user. - { "PROP_NAME_USER", "user" }, - - { "PROP_DESC_USER_INFO", "The user information." }, - - // #TRANNOTE The user information. - { "PROP_NAME_USER_INFO", "userInfo" }, - - { "PROP_DESC_USER_NAME", "The user name." }, - - // #TRANNOTE The user name. - { "PROP_NAME_USER_NAME", "userName" }, - - { "PROP_DESC_USER_SET_SCHEMAS", "Whether the user can set the schemas for which tables are shown." }, - - // #TRANNOTE Whether the user can set the schemas for which tables are shown. - { "PROP_NAME_USER_SET_SCHEMAS", "userSelectTableSchemas" }, - - { "PROP_DESC_USER_SET_TABLES", "Whether the user can set the tables used for the query." }, - - // #TRANNOTE Whether the user can set the tables used for the query. - { "PROP_NAME_USER_SET_TABLES", "userSelectTables" }, - - { "PROP_DESC_VISIBLE_ROW_COUNT", "The visible row count." }, - - // #TRANNOTE The visible row count. - { "PROP_NAME_VISIBLE_ROW_COUNT", "visibleRowCount" }, - - // #TRANNOTE The data source. // @D3A - { "PROP_NAME_DATASOURCE", "dataSource" }, // @D3A - - { "PROP_DESC_DATASOURCE", "The data source being used." }, // @D3A - - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for System Pool GUIs. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix SYSTEM_POOL_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - //@A1C - { "SYSTEM_POOL_ACTIVE_TO_INELIGIBLE", "Active to ineligible" }, - { "SYSTEM_POOL_ACTIVE_TO_WAIT", "Active to wait" }, - { "SYSTEM_POOL_ACTIVITY_LEVEL", "Pool activity level" }, - { "SYSTEM_POOL_DATABASE_FAULTS", "Database faults" }, - { "SYSTEM_POOL_DATABASE_PAGES", "Database pages" }, - { "SYSTEM_POOL_IDENTIFIER", "System pool" }, - { "SYSTEM_POOL_MAXIMUM_ACTIVE_THREADS", "Maximum active threads" }, - { "SYSTEM_POOL_MAXIMUM_FAULTS", "Maximum faults" }, - { "SYSTEM_POOL_MAXIMUM_POOL_SIZE", "% Maximum pool size" }, - { "SYSTEM_POOL_MESSAGE_LOGGING", "Message logging" }, - { "SYSTEM_POOL_MINIMUM_FAULTS", "Minimum faults" }, - { "SYSTEM_POOL_MINIMUM_POOL_SIZE", "% Minimum pool size" }, - { "SYSTEM_POOL_NONDATABASE_FAULTS", "Nondatabase faults" }, - { "SYSTEM_POOL_NONDATABASE_PAGES", "Nondatabase pages" }, - { "SYSTEM_POOL_PAGING_OPTION", "Paging option" }, - { "SYSTEM_POOL_PERTHREADS_FAULTS", "Per-thread faults" }, - { "SYSTEM_POOL_PRIORITY", "Priority" }, - { "SYSTEM_POOL_POOL_DESCRIPTION", "Pool description" }, - { "SYSTEM_POOL_POOL_NAME", "Pool name" }, - { "SYSTEM_POOL_POOL_SIZE", "Pool size" }, - { "SYSTEM_POOL_RESERVED_SIZE", "Reserved size" }, - { "SYSTEM_POOL_SUBSYSTEM_NAME", "Subsystem name" }, - { "SYSTEM_POOL_SUBSYSTEM__LIBRARY_NAME", "Subsystem library name" }, - { "SYSTEM_POOL_WAIT_TO_INELIGIBLE", "Wait to ineligible" }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for System Status GUIs. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix SYSTEM_STATUS_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - //@A1C - { "SYSTEM_STATUS_AUXILIARY_STORAGE", "Auxiliary Storage" }, - { "SYSTEM_STATUS_BATCH_JOBS_RUNNING", "Batch jobs running" }, // @A7C: Removed leading blanks - { "SYSTEM_STATUS_CPU", "CPU" }, - { "SYSTEM_STATUS_DATE_TIME", "Date and Time" }, - { "SYSTEM_STATUS_JOBS", "Jobs" }, - { "SYSTEM_STATUS_JOBS_IN_SYSTEM", "Jobs in system" }, // @A7C: Removed leading blanks - { "SYSTEM_STATUS_STORAGE_POOLS", "Storage Pools" }, - { "SYSTEM_STATUS_SYSTEM", "System" }, - { "SYSTEM_STATUS_SYSTEM_ASP", "System ASP" }, // @A7C: Removed leading blanks - { "SYSTEM_STATUS_SYSTEM_ASP_USED", "% System ASP used" }, // @A7C: Removed leading blanks - { "SYSTEM_STATUS_SYSTEM_STATUS","System Status"}, - { "SYSTEM_STATUS_TOTAL_AUXILIARY_STORAGE", "Total auxiliary storage" }, // @A7C: Removed leading blanks - { "SYSTEM_STATUS_USERS", "Users" }, - { "SYSTEM_STATUS_USERS_CURRENTLY_SIGNED_ON", "Users currently signed on" }, // @A7C: Removed leading blanks - { "SYSTEM_STATUS_UTILIZATION", "% Utilization" }, // @A7C: Removed leading blanks - - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for system values group's name. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix SYSTEM_VALUE_GROUP_, a short - // #TRANNOTE identifier to describe the system value group and - // #TRANNOTE a postfix _NAME. - // #TRANNOTE - { "SYSTEM_VALUE_GROUP_ALL_NAME" , "All" }, - { "SYSTEM_VALUE_GROUP_ALC_NAME" , "Allocation" }, - { "SYSTEM_VALUE_GROUP_DATTIM_NAME" , "Date and Time" }, - { "SYSTEM_VALUE_GROUP_EDT_NAME" , "Editing" }, - { "SYSTEM_VALUE_GROUP_LIBL_NAME" , "Library List" }, - { "SYSTEM_VALUE_GROUP_MSG_NAME" , "Message and Logging" }, - { "SYSTEM_VALUE_GROUP_SEC_NAME" , "Security" }, - { "SYSTEM_VALUE_GROUP_STG_NAME" , "Storage" }, - { "SYSTEM_VALUE_GROUP_SYSCTL_NAME" , "System control" }, - { "SYSTEM_VALUE_GROUP_NET_NAME" , "Network Attributes" }, - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for system values group's description. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix SYSTEM_VALUE_GROUP_, a short - // #TRANNOTE identifier to describe the system value group and - // #TRANNOTE a postfix _DESC. - // #TRANNOTE - - { "SYSTEM_VALUE_GROUP_ALL_DESC" , "All system values in the system" }, - { "SYSTEM_VALUE_GROUP_ALC_DESC" , "Allocation system values" }, - { "SYSTEM_VALUE_GROUP_DATTIM_DESC" , "Date and time system values" }, - { "SYSTEM_VALUE_GROUP_EDT_DESC" , "Editing system values" }, - { "SYSTEM_VALUE_GROUP_LIBL_DESC" , "Library list system values" }, - { "SYSTEM_VALUE_GROUP_MSG_DESC" , "Message and logging system values" }, - { "SYSTEM_VALUE_GROUP_SEC_DESC" , "Security system values" }, - { "SYSTEM_VALUE_GROUP_STG_DESC" , "Storage system values" }, - { "SYSTEM_VALUE_GROUP_SYSCTL_DESC" , "System control system values" }, - { "SYSTEM_VALUE_GROUP_NET_DESC" , "Network attributes of the system" }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for System Value GUIs. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix SYSTEM_VALUE_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - - { "SYSTEM_VALUE_LIST_DESCRIPTION", "System Value List" }, - { "SYSTEM_VALUE_GROUP_DESCRIPTION", "System Value Group" }, - - - - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for Tabbed Panes. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix TAB_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - - { "TAB_ACTIVE", "Active" }, - { "TAB_DATETIME", "Date/Time" }, - { "TAB_DISPLAY_SESSION","Display session"}, - { "TAB_GENERAL", "General" }, - { "TAB_GROUP_INFORMATION","Group information"}, - { "TAB_INTERNATIONAL","International"}, - { "TAB_LANGUAGE", "Language" }, - { "TAB_LIBRARY_LIST" , "Library List" }, - { "TAB_MESSAGE", "Message" }, - { "TAB_OTHER", "Other" }, - { "TAB_OUTPUT"," Output"}, - { "TAB_PRINTER_OUTPUT", "Printer Output" }, - { "TAB_SECURITY","Security"}, - { "TAB_SESSION_STARTUP","Session startup"}, - - - - - - - - // #TRANNOTE ##################################################### - // #TRANNOTE Text for User GUIs. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix USER_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - - { "USER_ACCOUNTING_CODE","Accounting code"}, - { "USER_ACTION_AUDIT_LEVEL","User action audit level"}, - { "USER_ALL_USERS", "All users"}, - { "USER_ALL_USERS_DES", "The profiles of all users in the system"}, - { "USER_ASSISTANCE_LEVEL", "Assistance level" }, - { "USER_ATTENTION_PROGRAM_NAME", "Attention program" }, -//@A4D { "USER_ATTENTION_PROGRAM_LIB", " Library" }, - { "USER_CLASS_NAME","User class name"}, - { "USER_CODED_CHARACTER_SET_ID","Coded character set ID"}, - { "USER_COUNTRY_ID","Country or Region ID"}, // @D4C - { "USER_CURRENT_LIB","Current library"}, - { "USER_CUSTOM","Custom"}, //@A4C: Removed leading blanks - { "USER_DAYS_UNTIL_PASSWORD_EXPIRE", "Days until password expires" }, //@A4C - { "USER_DESCRIPTION", "User" }, - { "USER_DESCRIPTION_PROMPT", "Description" }, - { "USER_DISPLAY_SIGNON_INFORMATION","Display sign-on information"}, - { "USER_GROUP_AUTHORITY","Group authority"}, - { "USER_GROUP_AUTHORITY_TYPE","Group authority type"}, - { "USER_GROUP_HAS_MEMBER","Group member indicator"}, // @A4C - { "USER_GROUP_ID_NUMBER","Group ID"}, - { "USER_GROUPS_MEMBERS","Group members"}, // @A4C: Removed leading blanks - { "USER_GROUP_PROFILE_NAME","Group profile name"}, - { "USER_GROUPS", "Groups"}, - { "USER_GROUPS_DES", "The profiles of all groups in the system"}, - - { "USER_HIGHEST_SCHEDULE_PRIORITY","Highest schedule priority"}, - { "USER_HOME_DIRECTORY","Home directory"}, - { "USER_ID_NUMBER","User ID number"}, - - { "USER_INITIAL_MENU","Initial menu"}, -//@A4D { "USER_INITIAL_MENU_LIB","Library"}, // @A4C: Removed leading blanks - { "USER_INITIAL_PROGRAM","Initial program"}, -//@A4D { "USER_INITIAL_PROGRAM_LIB","Library"}, // @A4C: Removed leading blanks - { "USER_IS_NO_PASSWORD", "No password indicator" }, //@A4C - { "USER_IS_PASSWORD_SET_EXPIRE", "Set password to expire" }, //@A4C - { "USER_IS_WITH_DIGITAL_CERTIFICATES", "Digital certificate indicator" }, //@A4C - { "USER_JOB_DESCRIPTION_NAME","Job description"}, -//@A4D { "USER_JOB_DESCRIPTION_LIB" ,"Library"}, // @A4C: Removed leading blanks - { "USER_LANGUAGE_ID","Language ID"}, - - { "USER_LIMIT_CAPABILITIES", "Limit initial program/menu capabilities" }, - { "USER_LIMIT_DEVICE_SESSIONS","Limit device sessions"}, - - { "USER_LIST_DESCRIPTION", "User list" }, - { "USER_LIST_GROUPINFO_PROMPT", "Group info" }, - { "USER_LIST_NAME","List name"}, - { "USER_LIST_USERINFO_PROMPT", "User info" }, - { "USER_LOCALE_JOB_ATTRIBUTES","Locale job attributes"}, - { "USER_LOCALE_PATH_NAME","Locale path name"}, - { "USER_MAXIMUM_ALLOWED_STORAGE","Maximum allowed storage"}, - { "USER_MESSAGE_DELIVERY","Message delivery"}, - { "USER_MESSAGE_QUEUE","Message queue"}, -//@A4D { "USER_MESSAGE_QUEUE_LIB","Library"}, // @A4C: Removed leading blanks - { "USER_MESSAGE_SEVERITY_LEVEL","Message severity level"}, - { "USER_NAME", "Name" }, - { "USER_OBJECT_AUDITING_VALUE","Object auditing level"}, - { "USER_OUTPUT_QUEUE","Output queue"}, -//@A4D { "USER_OUTPUT_QUEUE_LIB","Library"}, // @A4C: Removed leading blanks - { "USER_OWNER","Owner"}, //@A4C - { "USER_PASSWORD_EXPIRE_DATE", "Date password expires" }, //@A4C - { "USER_PASSWORD_EXPIRATION_INTERVAL", "Password expiration interval" }, - { "USER_PASSWORD_LAST_CHANGED_DATE", "Date password last changed" }, //@A4C - { "USER_PREVIOUS_SIGNED_ON_DATE", "Previous sign-on" }, //@A4C - { "USER_PRINT_DEVICE","Printer device"}, // @A6C - - { "USER_PROFILE_NAME","User profile name"}, - { "USER_SIGNED_ON_ATTEMPTS_NOT_VALID", "Sign-on attempts not valid" }, //@A4C - { "USER_SORT_SEQUENCE_TABLE","Sort sequence table"}, -//@A4D { "USER_SORT_SEQUENCE_TABLE_LIB","Library"}, // @A4C: Removed leading blanks - { "USER_SPECIAL_AUTHORITY","Special authority"}, - { "USER_SPECIAL_ENVIRONMENT","Special environment"}, - { "USER_STATUS","Status"}, - { "USER_STORAGE_USED","Storage used"}, - { "USER_SUPPLEMENTAL_GROUPS_NUMBER","Number of supplemental groups"}, //@A4C - { "USER_SUPPLEMENTAL_GROUPS","Supplemental groups"}, - { "USER_SYSTEM_NAME", "System name" }, - { "USER_USER_AND_GROUP","Users and groups"}, // @A6C - { "USER_USER_NAME","User name"}, - { "USER_USERS_NOT_IN_GROUPS", "Users not in groups"}, - { "USER_USERS_NOT_IN_GROUPS_DES", "The profiles of the users not in any group of the system"}, - - // @D0A Start - // #TRANNOTE ##################################################### - // #TRANNOTE Text for Resource GUI components. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix RESOURCE_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - { "RESOURCE_ALL_SORTS", "All Sorts"}, - { "RESOURCE_COLUMN_NAME", "Name"}, - { "RESOURCE_CURRENT_SORTS", "Current Sorts"}, - { "RESOURCE_GENERAL_TAB", "General"}, - { "RESOURCE_SELECTION_TAB", "Selection"}, - { "RESOURCE_SORT_TAB", "Sort"}, - // @D0A End - - // @B2A - // #TRANNOTE ##################################################### - // #TRANNOTE Text for Remote Java Application GUIs. - // #TRANNOTE ##################################################### - // #TRANNOTE Each key starts with the prefix REMOTE_ and - // #TRANNOTE then a short identifier to describe the - // #TRANNOTE message. - // #TRANNOTE - { "REMOTE_OUTPUT_LABEL","Output:"}, - { "REMOTE_INPUT_LABEL","Command:"}, - { "REMOTE_JAVA_START","Starting program "}, - { "REMOTE_JAVA_END1","Program "}, - { "REMOTE_JAVA_END2"," ended"}, - { "REMOTE_PROMPT","=> "}, - { "REMOTE_JAVA_ERROR","Java command error. Usage:\n" - +" java [-classpath=]" - +" [-verbose]" - +" [-D=" - +" -D=" - +" [...]]" - +" " - +" [" - +" " - +" [...]]\n" }, - { "REMOTE_SET_ERROR","Set command error.\n" - +"Usage: set "}, - { "REMOTE_PROPERTY_ERROR_HEAD","The option "}, - { "REMOTE_PROPERTY_ERROR_END"," does not exist."}, - { "REMOTE_COMMAND_ERROR","Incorrect command."}, - { "REMOTE_COMMAND_MESSAGE_SEP", " : "}, - { "REMOTE_PORT_VALUE_ERROR","The value must be true or false."}, - { "REMOTE_HELP", "To run a java application:\n" - +" java [-classpath=]" - +" [-verbose]" - +" [-D=" - +" -D=" - +" [...]]" - +" " - +" [" - +" " - +" [...]]\n" - +" Example:\n" - +" java -classpath=/myClasses:/myClasses/lib/xx.zip com.myCompany.appl myparm1 myparm2 \n\n" - +"To set an option:\n" - +" set option=\n" - +" where option is one of:\n" - +" Classpath, DefaultPort, FindPort, Interpret, Optimize, Option,\n" - +" SecurityCheckLevel, GarbageCollectionFrequency,\n" - +" GarbageCollectionInitialSize, GarbageCollectionMaximumSize,\n" - +" or GarbageCollectionPriority\n" - +" Example:\n" - +" set Optimize=30\n\n" - +"To display the value of current options:\n" - +" d \n\n" - +"To display help:\n" - +" help, h or ? \n\n" - +"To end this program:\n" - +" quit or q \n"}, - { "REMOTE_D_LINE1","Current option settings:"}, - { "REMOTE_D_LINE2", " SecurityCheckLevel="}, - { "REMOTE_D_LINE3", " Classpath="}, - { "REMOTE_D_LINE4", " GarbageCollectionFrequency="}, - { "REMOTE_D_LINE5", " GarbageCollectionInitialSize="}, - { "REMOTE_D_LINE6", " GarbageCollectionMaximumSize="}, - { "REMOTE_D_LINE7", " GarbageCollectionPriority="}, - { "REMOTE_D_LINE8", " Interpret="}, - { "REMOTE_D_LINE9", " Optimize="}, - { "REMOTE_D_LINE10"," Option="}, - { "REMOTE_D_LINE11"," DefaultPort="}, - { "REMOTE_D_LINE12"," FindPort="}, - - { "PROP_NAME_JAC", "JavaApplicationCall" }, - { "PROP_DESC_JAC", "The java application call object." } // end @B2A - }; - - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VMessage.java b/cvsroot/src/com/ibm/as400/vaccess/VMessage.java deleted file mode 100644 index e932f674a..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VMessage.java +++ /dev/null @@ -1,368 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VMessage.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400Message; -import javax.swing.Icon; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; - - - -/** -The VMessage class defines the representation of a message -returned from a system for use in various models and panes -in this package. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VMessage objects generate the following events: -

      -
    • ErrorEvent -
    • VObjectEvent -
    • WorkingEvent -
    - -@see com.ibm.as400.access.AS400Message -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VMessage -implements VObject, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String description_ = ResourceLoader.getText ("MESSAGE_DESCRIPTION"); - private static final Icon icon16_ = ResourceLoader.getIcon ("VMessage16.gif", description_); - private static final Icon icon32_ = ResourceLoader.getIcon ("VMessage32.gif", description_); - - - - // Properties. - private AS400Message message_ = null; - - - - // Private data. - transient private VPropertiesPane propertiesPane_; - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private VObjectEventSupport objectEventSupport_; - transient private WorkingEventSupport workingEventSupport_; - - - -/** -Property identifier for the message ID. -**/ - public static final Object ID_PROPERTY = "ID"; - -/** -Property identifier for the message severity. -**/ - public static final Object SEVERITY_PROPERTY = "Severity"; - -/** -Property identifier for the message text. -**/ - public static final Object TEXT_PROPERTY = "Text"; - -/** -Property identifier for the message type. -**/ - public static final Object TYPE_PROPERTY = "Type"; - - - -/** -Constructs a VMessage object. - -@param message The message. -**/ - VMessage (AS400Message message) - { - if (message == null) - throw new NullPointerException ("message"); - - message_ = message; - - initializeTransient (); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Returns the list of actions that can be performed. - -@return Always null. There are no actions. -**/ - public VAction[] getActions () - { - return null; - } - - - -/** -Returns the default action. - -@return Always null. There is no default action. -**/ - public VAction getDefaultAction () - { - return null; - } - - - -/** -Returns the icon. - -@param size The icon size, either 16 or 32. If any other - value is given, then return a default. -@param open This parameter has no effect. -@return The icon. -**/ - public Icon getIcon (int size, boolean open) - { - if (size == 32) - return icon32_; - else - return icon16_; - } - - - -/** -Returns the properties pane. - -@return The properties pane. -**/ - public VPropertiesPane getPropertiesPane () - { - return propertiesPane_; - } - - - -/** -Returns a property value. - -@param propertyIdentifier The property identifier. The choices are -
      -
    • NAME_PROPERTY -
    • DESCRIPTION_PROPERTY -
    • ID_PROPERTY -
    • TEXT_PROPERTY -
    • TYPE_PROPERTY -
    • SEVERITY_PROPERTY -
    -@return The property value, or null if the - property identifier is not recognized. -**/ - public synchronized Object getPropertyValue (Object propertyIdentifier) - { - // Get the name. - if (propertyIdentifier == NAME_PROPERTY) - return this; - - // Get the description. - else if (propertyIdentifier == DESCRIPTION_PROPERTY) - return description_; - - // Get the ID. - if (propertyIdentifier == ID_PROPERTY) - return message_.getID (); - - // Get the text. - else if (propertyIdentifier == TEXT_PROPERTY) - return message_.getText (); - - // Get the severity. - else if (propertyIdentifier == SEVERITY_PROPERTY) - return new Integer (message_.getSeverity ()); - - // Get the type. - else if (propertyIdentifier == TYPE_PROPERTY) - return MessageUtilities.getTypeText (message_.getType ()); - - // By default, return null. - return null; - } - - - -/** -Returns the text. This is the message ID. - -@return The message ID text. -**/ - public String getText () - { - String id = message_.getID (); - if (id == null) - return ""; - else - return id; - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - objectEventSupport_ = new VObjectEventSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - // Initialize the properties pane. - propertiesPane_ = new MessagePropertiesPane (this, message_); - - propertiesPane_.addErrorListener (errorEventSupport_); - propertiesPane_.addVObjectListener (objectEventSupport_); - propertiesPane_.addWorkingListener (workingEventSupport_); - } - - - -/** -Loads information about the object from the system. -**/ - public void load () - { - // This does nothing. - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Returns the string representation. This is the message ID. - -@return The string representation of the message ID. -**/ - public String toString () - { - String id = message_.getID (); - if (id == null) - return ""; - else - return id; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VMessage16.gif b/cvsroot/src/com/ibm/as400/vaccess/VMessage16.gif deleted file mode 100644 index 2182f521a..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VMessage16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VMessage32.gif b/cvsroot/src/com/ibm/as400/vaccess/VMessage32.gif deleted file mode 100644 index 9174019ed..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VMessage32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VMessageList.java b/cvsroot/src/com/ibm/as400/vaccess/VMessageList.java deleted file mode 100644 index 6d5acdeb6..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VMessageList.java +++ /dev/null @@ -1,710 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VMessageList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400Message; -import com.ibm.as400.access.Trace; -import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.SwingConstants; -import javax.swing.table.DefaultTableColumnModel; -import javax.swing.table.TableColumn; -import javax.swing.table.TableColumnModel; -import javax.swing.tree.TreeNode; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.net.URL; -import java.util.Enumeration; - - - -/** -The VMessageList class defines the representation of a -list of messages returned from a system for use -in various models and panes in this package. -You must explicitly call load() to load the information from -the system. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VIFSDirectory objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • VObjectEvent -
    • WorkingEvent -
    - -@see com.ibm.as400.access.AS400Message -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VMessageList -implements VNode, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static String description_ = ResourceLoader.getText ("MESSAGE_LIST_DESCRIPTION"); - private static Icon icon16_ = ResourceLoader.getIcon ("VMessageList16.gif", description_); - private static Icon icon32_ = ResourceLoader.getIcon ("VMessageList32.gif", description_); - private static String nameColumnHeader_ = ResourceLoader.getText ("MESSAGE_ID"); - private static String textColumnHeader_ = ResourceLoader.getText ("MESSAGE_TEXT"); - private static String typeColumnHeader_ = ResourceLoader.getText ("MESSAGE_TYPE"); - private static String severityColumnHeader_ = ResourceLoader.getText ("MESSAGE_SEVERITY"); - - - - // Properties. - private AS400Message[] messageList_ = new AS400Message[0]; - private VNode parent_ = null; - - - - // Static data. - private static TableColumnModel detailsColumnModel_ = null; - - - - // Private data. - transient private VObject[] detailsChildren_; - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private VObjectEventSupport objectEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - transient private WorkingEventSupport workingEventSupport_; - - - -/** -Static initializer. -**/ -// -// Implementation note: -// -// * The column widths are completely arbitrary. -// - static - { - detailsColumnModel_ = new DefaultTableColumnModel (); - int columnIndex = 0; - - // Name column. - VTableColumn nameColumn = new VTableColumn (columnIndex++, VMessage.NAME_PROPERTY); - nameColumn.setCellRenderer (new VObjectCellRenderer ()); - nameColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - nameColumn.setHeaderValue (nameColumnHeader_); - nameColumn.setPreferredCharWidth (10); - detailsColumnModel_.addColumn (nameColumn); - - // Text column. - VTableColumn textColumn = new VTableColumn (columnIndex++, VMessage.TEXT_PROPERTY); - textColumn.setCellRenderer (new VObjectCellRenderer ()); - textColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - textColumn.setHeaderValue (textColumnHeader_); - textColumn.setPreferredCharWidth (80); - detailsColumnModel_.addColumn (textColumn); - - // Severity column. - VTableColumn severityColumn = new VTableColumn (columnIndex++, VMessage.SEVERITY_PROPERTY); - severityColumn.setCellRenderer (new VObjectCellRenderer (SwingConstants.RIGHT)); - severityColumn.setHeaderRenderer (new VObjectHeaderRenderer (SwingConstants.RIGHT)); - severityColumn.setHeaderValue (severityColumnHeader_); - severityColumn.setPreferredCharWidth (8); - detailsColumnModel_.addColumn (severityColumn); - - // Type column. - VTableColumn typeColumn = new VTableColumn (columnIndex++, VMessage.TYPE_PROPERTY); - typeColumn.setCellRenderer (new VObjectCellRenderer ()); - typeColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - typeColumn.setHeaderValue (typeColumnHeader_); - typeColumn.setPreferredCharWidth (20); - detailsColumnModel_.addColumn (typeColumn); - } - - - -/** -Constructs a VMessageList object. -**/ - public VMessageList () - { - initializeTransient (); - } - - - -/** -Constructs a VMessageList object. - -@param messageList The message list. -**/ - public VMessageList (AS400Message[] messageList) - { - if (messageList == null) - throw new NullPointerException ("messageList"); - - messageList_ = messageList; - initializeTransient (); - } - - - -/** -Constructs a VMessageList object. - -@param parent The parent. -@param messageList The message list. -**/ - public VMessageList (VNode parent, AS400Message[] messageList) - { - if (parent == null) - throw new NullPointerException ("parent"); - if (messageList == null) - throw new NullPointerException ("messageList"); - - parent_ = parent; - messageList_ = messageList; - initializeTransient (); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Returns the children of the node. - -@return The children. -**/ - public Enumeration children () - { - return new VEnumeration (this); - } - - - -/** -Returns the list of actions that can be performed. - -@return Always null. There are no actions. -**/ - public VAction[] getActions () - { - return null; - } - - - -/** -Indicates if the node allows children. - -@return Always false. -**/ - public boolean getAllowsChildren () - { - return false; - } - - - -/** -Returns the child node at the specified index. - -@param index The index. -@return Always null. -**/ - public TreeNode getChildAt (int index) - { - return null; - } - - - -/** -Returns the number of children. - -@return Always 0. -**/ - public int getChildCount () - { - return 0; - } - - - -/** -Returns the default action. - -@return Always null. There is no default action. -**/ - public VAction getDefaultAction () - { - return null; - } - - - -/** -Returns the child for the details at the specified index. - -@param index The index. -@return The child, or null if the index is not - valid. -**/ - public synchronized VObject getDetailsChildAt (int index) - { - if ((index < 0) || (index >= detailsChildren_.length)) - return null; - - return detailsChildren_[index]; - } - - - -/** -Returns the number of children for the details. - -@return The number of children for the details. -**/ - public synchronized int getDetailsChildCount () - { - return detailsChildren_.length; - } - - - -/** -Returns the index of the specified child for the details. - -@param detailsChild The details child. -@return The index, or -1 if the child is not found - in the details. -**/ - public synchronized int getDetailsIndex (VObject detailsChild) - { - for (int i = 0; i < detailsChildren_.length; ++i) - if (detailsChildren_[i] == detailsChild) - return i; - return -1; - } - - - -/** -Returns the table column model to use in the details -when representing the children. This column model -describes the details values for the children. - -@return The details column model. -**/ - public TableColumnModel getDetailsColumnModel () - { - return detailsColumnModel_; - } - - - -/** -Returns the icon. - -@param size The icon size, either 16 or 32. If any other - value is given, then return a default. -@param open This parameter has no effect. -@return The icon. -**/ - public Icon getIcon (int size, boolean open) - { - if (size == 32) - return icon32_; - else - return icon16_; - } - - - -/** -Returns the index of the specified child. - -@param child The child. -@return Always -1. -**/ - public synchronized int getIndex (TreeNode child) - { - return -1; - } - - - -/** -Returns the message list. - -@return The message list. -**/ - public AS400Message[] getMessageList () - { - return messageList_; - } - - - -/** -Returns the parent node. - -@return The parent node, or null if there is no parent. -**/ - public TreeNode getParent () - { - return parent_; - } - - - -/** -Returns the properties pane. - -@return Always null. There is no properties pane. -**/ - public VPropertiesPane getPropertiesPane () - { - return null; - } - - - -/** -Returns a property value. - -@param propertyIdentifier The property identifier. The choices are - NAME_PROPERTY or DESCRIPTION_PROPERTY, -@return The property value, or null if the - property identifier is not recognized. -**/ - public Object getPropertyValue (Object propertyIdentifier) - { - // Get the name. - if (propertyIdentifier == NAME_PROPERTY) - return this; - - // Get the description. - else if (propertyIdentifier == DESCRIPTION_PROPERTY) - return description_; - - // By default, return null. - return null; - } - - - -/** -Returns the text. It is the description - -@return The description text. -**/ - public String getText () - { - return description_; - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - objectEventSupport_ = new VObjectEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - // Initialize private data. - detailsChildren_ = new VObject[0]; - } - - - -/** -Indicates if the node is a leaf. - -@return Always true. -**/ - public boolean isLeaf () - { - return true; - } - - - -/** -Indicates if the details children are sortable. - -@return Always true. -**/ - public boolean isSortable () - { - return true; - } - - - -/** -Loads information about the object from the system. -**/ - public void load () - { - workingEventSupport_.fireStartWorking (); - - synchronized (this) { - - // Stop listening to the previous children. - for (int i = 0; i < detailsChildren_.length; ++i) { - detailsChildren_[i].removeErrorListener (errorEventSupport_); - detailsChildren_[i].removeVObjectListener (objectEventSupport_); - detailsChildren_[i].removeWorkingListener (workingEventSupport_); - } - - // Refresh the details children based on the message list. - detailsChildren_ = new VObject[messageList_.length]; - for (int i = 0; i < messageList_.length; ++i) { - detailsChildren_[i] = new VMessage (messageList_[i]); - - detailsChildren_[i].addErrorListener (errorEventSupport_); - detailsChildren_[i].addVObjectListener (objectEventSupport_); - detailsChildren_[i].addWorkingListener (workingEventSupport_); - } - } - - // Done loading. - workingEventSupport_.fireStopWorking (); - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Sets the message list. - -@param messageList The message list. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setMessageList (AS400Message[] messageList) - throws PropertyVetoException - { - if (messageList == null) - throw new NullPointerException ("messageList"); - - AS400Message[] oldValue = messageList_; - AS400Message[] newValue = messageList; - vetoableChangeSupport_.fireVetoableChange ("messageList", oldValue, newValue); - - if (oldValue != newValue) - messageList_ = messageList; - - propertyChangeSupport_.firePropertyChange ("messageList", oldValue, newValue); - } - - - -/** -Sorts the children for the details. - -@param propertyIdentifiers The property identifiers. If any of - the property identifiers are null, it - indicates to sort using the string - representation of the object. -@param orders The sort orders for each property - identifier. true for ascending order; - false for descending order. -**/ - public synchronized void sortDetailsChildren (Object[] propertyIdentifiers, - boolean[] orders) - { - if (propertyIdentifiers == null) - throw new NullPointerException ("propertyIdentifiers"); - if (orders == null) - throw new NullPointerException ("orders"); - - VUtilities.sort (detailsChildren_, propertyIdentifiers, orders); - } - - - -/** -Returns the string representation of the description. - -@return The string representation of the description. -**/ - public String toString () - { - return description_; - } - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VMessageList16.gif b/cvsroot/src/com/ibm/as400/vaccess/VMessageList16.gif deleted file mode 100644 index 73d0723bd..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VMessageList16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VMessageList32.gif b/cvsroot/src/com/ibm/as400/vaccess/VMessageList32.gif deleted file mode 100644 index 447b5f9fe..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VMessageList32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VMessageListBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/VMessageListBeanInfo.java deleted file mode 100644 index d4e9f5839..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VMessageListBeanInfo.java +++ /dev/null @@ -1,191 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VMessageListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The VMessageListBeanInfo class provides bean information -for the VMessageList class. - -@see VMessageList -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VMessageListBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = VMessageList.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - String[] vobjectMethods = { "objectChanged", "objectCreated", "objectDeleted" }; - EventSetDescriptor vobject = new EventSetDescriptor (beanClass_, - "vobject", VObjectListener.class, vobjectMethods, - "addVObjectListener", "removeVObjectListener"); - vobject.setDisplayName (ResourceLoader.getText ("EVT_NAME_VOBJECT")); - vobject.setShortDescription (ResourceLoader.getText ("EVT_DESC_VOBJECT")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { error, propertyChange, - vetoableChange, vobject, working }; - - // Properties. - PropertyDescriptor messageList = new PropertyDescriptor ("messageList", beanClass_); - messageList.setBound (true); - messageList.setConstrained (true); - messageList.setDisplayName (ResourceLoader.getText ("PROP_NAME_MESSAGE_LIST")); - messageList.setShortDescription (ResourceLoader.getText ("PROP_DESC_MESSAGE_LIST")); - - properties_ = new PropertyDescriptor[] { messageList }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // messageList. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("VMessageList16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("VMessageList32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VMessageQueue.java b/cvsroot/src/com/ibm/as400/vaccess/VMessageQueue.java deleted file mode 100644 index 99c69d627..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VMessageQueue.java +++ /dev/null @@ -1,1044 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VMessageQueue.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.MessageQueue; -import com.ibm.as400.access.QSYSObjectPathName; -import com.ibm.as400.access.QueuedMessage; -import com.ibm.as400.access.Trace; -import javax.swing.Icon; -import javax.swing.SwingConstants; -import javax.swing.table.TableColumnModel; -import javax.swing.table.DefaultTableColumnModel; -import javax.swing.tree.TreeNode; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.Enumeration; - - - -/** -The VMessageQueue class defines the representation of a -message queue on a system for use in various models and -panes in this package. -You must explicitly call load() to load the information from -the system. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VMessageQueue objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • VObjectEvent -
    • WorkingEvent -
    - -@see com.ibm.as400.access.MessageQueue -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VMessageQueue -implements VNode, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI - private static String description_ = ResourceLoader.getText ("MESSAGE_QUEUE_DESCRIPTION"); - private static Icon icon16_ = ResourceLoader.getIcon ("VMessageList16.gif", description_); - private static Icon icon32_ = ResourceLoader.getIcon ("VMessageList32.gif", description_); - private static String dateColumnHeader_ = ResourceLoader.getText ("MESSAGE_DATE"); - private static String fromJobColumnHeader_ = ResourceLoader.getText ("MESSAGE_FROM_JOB"); - private static String fromJobNumberColumnHeader_ = ResourceLoader.getText ("MESSAGE_FROM_JOB_NUMBER"); - private static String fromProgramColumnHeader_ = ResourceLoader.getText ("MESSAGE_FROM_PROGRAM"); - private static String fromUserColumnHeader_ = ResourceLoader.getText ("MESSAGE_FROM_USER"); - private static String messageQueueColumnHeader_ = ResourceLoader.getText ("MESSAGE_QUEUE"); - private static String nameColumnHeader_ = ResourceLoader.getText ("MESSAGE_ID"); - private static String textColumnHeader_ = ResourceLoader.getText ("MESSAGE_TEXT"); - private static String typeColumnHeader_ = ResourceLoader.getText ("MESSAGE_TYPE"); - private static String severityColumnHeader_ = ResourceLoader.getText ("MESSAGE_SEVERITY"); - - - - // Properties. - private VNode parent_ = null; - private MessageQueue queue_ = null; - - - - // Static data. - private static TableColumnModel detailsColumnModel_ = null; - - - - // Private data. - transient private VAction[] actions_; - transient VObject[] detailsChildren_; // Private. - transient private Enumeration enum_; - transient private int loaded_; - transient private VPropertiesPane propertiesPane_; - - - - // Event support. - transient ErrorEventSupport errorEventSupport_; // Private. - transient VObjectEventSupport objectEventSupport_; // Private. - transient VObjectListener_ objectListener_; // Private. - transient PropertyChangeSupport propertyChangeSupport_; // Private. - transient VetoableChangeSupport vetoableChangeSupport_; // Private. - transient WorkingEventSupport workingEventSupport_; // Private. - - - -/** -Static initializer. -**/ -// -// Implementation note: -// -// * The column widths are completely arbitrary. -// - static - { - detailsColumnModel_ = new DefaultTableColumnModel (); - int columnIndex = 0; - - // Name column. - VTableColumn nameColumn = new VTableColumn (columnIndex++, VQueuedMessage.NAME_PROPERTY); - nameColumn.setCellRenderer (new VObjectCellRenderer ()); - nameColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - nameColumn.setHeaderValue (nameColumnHeader_); - nameColumn.setPreferredCharWidth (10); - detailsColumnModel_.addColumn (nameColumn); - - // Text column. - VTableColumn textColumn = new VTableColumn (columnIndex++, VQueuedMessage.TEXT_PROPERTY); - textColumn.setCellRenderer (new VObjectCellRenderer ()); - textColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - textColumn.setHeaderValue (textColumnHeader_); - textColumn.setPreferredCharWidth (40); - detailsColumnModel_.addColumn (textColumn); - - // Severity column. - VTableColumn severityColumn = new VTableColumn (columnIndex++, VQueuedMessage.SEVERITY_PROPERTY); - severityColumn.setCellRenderer (new VObjectCellRenderer (SwingConstants.RIGHT)); - severityColumn.setHeaderRenderer (new VObjectHeaderRenderer (SwingConstants.RIGHT)); - severityColumn.setHeaderValue (severityColumnHeader_); - severityColumn.setPreferredCharWidth (10); - detailsColumnModel_.addColumn (severityColumn); - - // Type column. - VTableColumn typeColumn = new VTableColumn (columnIndex++, VQueuedMessage.TYPE_PROPERTY); - typeColumn.setCellRenderer (new VObjectCellRenderer ()); - typeColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - typeColumn.setHeaderValue (typeColumnHeader_); - typeColumn.setPreferredCharWidth (20); - detailsColumnModel_.addColumn (typeColumn); - - // Date column. - VTableColumn dateColumn = new VTableColumn (columnIndex++, VQueuedMessage.DATE_PROPERTY); - dateColumn.setCellRenderer (new VObjectCellRenderer ()); - dateColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - dateColumn.setHeaderValue (dateColumnHeader_); - dateColumn.setPreferredCharWidth (20); - detailsColumnModel_.addColumn (dateColumn); - - // From job column. - VTableColumn fromJobColumn = new VTableColumn (columnIndex++, VQueuedMessage.FROM_JOB_PROPERTY); - fromJobColumn.setCellRenderer (new VObjectCellRenderer ()); - fromJobColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - fromJobColumn.setHeaderValue (fromJobColumnHeader_); - fromJobColumn.setPreferredCharWidth (10); - detailsColumnModel_.addColumn (fromJobColumn); - - // From user column. - VTableColumn fromUserColumn = new VTableColumn (columnIndex++, VQueuedMessage.FROM_USER_PROPERTY); - fromUserColumn.setCellRenderer (new VObjectCellRenderer ()); - fromUserColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - fromUserColumn.setHeaderValue (fromUserColumnHeader_); - fromUserColumn.setPreferredCharWidth (10); - detailsColumnModel_.addColumn (fromUserColumn); - - // From job number column. - VTableColumn fromJobNumberColumn = new VTableColumn (columnIndex++, VQueuedMessage.FROM_JOB_NUMBER_PROPERTY); - fromJobNumberColumn.setCellRenderer (new VObjectCellRenderer ()); - fromJobNumberColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - fromJobNumberColumn.setHeaderValue (fromJobNumberColumnHeader_); //@C1C - fromJobNumberColumn.setPreferredCharWidth (20); //@C1C - detailsColumnModel_.addColumn (fromJobNumberColumn); - - // From program column. - VTableColumn fromProgramColumn = new VTableColumn (columnIndex++, VQueuedMessage.FROM_PROGRAM_PROPERTY); - fromProgramColumn.setCellRenderer (new VObjectCellRenderer ()); - fromProgramColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - fromProgramColumn.setHeaderValue (fromProgramColumnHeader_); - fromProgramColumn.setPreferredCharWidth (20); - detailsColumnModel_.addColumn (fromProgramColumn); - - // Message queue column. - VTableColumn messageQueueColumn = new VTableColumn (columnIndex++, VQueuedMessage.MESSAGE_QUEUE_PROPERTY); - messageQueueColumn.setCellRenderer (new VObjectCellRenderer ()); - messageQueueColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - messageQueueColumn.setHeaderValue (messageQueueColumnHeader_); - messageQueueColumn.setPreferredCharWidth (20); - detailsColumnModel_.addColumn (messageQueueColumn); - } - - - -/** -Constructs a VMessageQueue object. -**/ - public VMessageQueue () - { - queue_ = new MessageQueue (); - initializeTransient (); - } - - - -/** -Constructs a VMessageQueue object. - -@param system The system on which the message queue resides. -**/ - public VMessageQueue (AS400 system) - { - if (system == null) - throw new NullPointerException ("system"); - - queue_ = new MessageQueue (system); - initializeTransient (); - } - - - -/** -Constructs a VMessageQueue object. - -@param system The system on which the message queue resides. -@param path The fully qualified integrated file system path name of the message queue. The path must be in the format of /QSYS.LIB/libname.LIB/messageQueue.MSGQ. -**/ - public VMessageQueue (AS400 system, String path) - { - if (system == null) - throw new NullPointerException ("system"); - if (path == null) - throw new NullPointerException ("path"); - - queue_ = new MessageQueue (system, path); - initializeTransient (); - } - - - -/** -Constructs a VMessageQueue object. - -@param parent The parent. -@param system The system on which the message queue resides. -@param path The fully qualified integrated file system path name of the message queue. The path must be in the format of /QSYS.LIB/libname.LIB/messageQueue.MSGQ. -**/ - public VMessageQueue (VNode parent, AS400 system, String path) - { - if (parent == null) - throw new NullPointerException ("parent"); - if (system == null) - throw new NullPointerException ("system"); - if (path == null) - throw new NullPointerException ("path"); - - parent_ = parent; - queue_ = new MessageQueue (system, path); - initializeTransient (); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Returns the children of the node. - -@return The children. -**/ - public Enumeration children () - { - return new VEnumeration (this); - } - - - -/** -Returns the list of actions that can be performed. -
      -
    • clear -
    - -@return The actions. -**/ - public VAction[] getActions () - { - return actions_; - } - - - -/** -Indiciates if the node allows children. - -@return Always false. -**/ - public boolean getAllowsChildren () - { - return false; - } - - - -/** -Returns the child node at the specified index. - -@param index The index. -@return Always null. -**/ - public TreeNode getChildAt (int index) - { - return null; - } - - - -/** -Returns the number of children. - -@return Always 0. -**/ - public int getChildCount () - { - return 0; - } - - - -/** -Returns the default action. - -@return Always null. There is no default action. -**/ - public VAction getDefaultAction () - { - return null; - } - - - -/** -Returns the child for the details at the specified index. - -@param index The index. -@return The child, or null if the index is not - valid. -**/ - public VObject getDetailsChildAt (int index) - { - if ((index < 0) || (index >= detailsChildren_.length)) - return null; - - loadMore (index); - return detailsChildren_[index]; - } - - - -/** -Returns the number of children for the details. - -@return The number of children for the details. -**/ - public synchronized int getDetailsChildCount () - { - return detailsChildren_.length; - } - - - -/** -Returns the index of the specified child for the details. - -@param detailsChild The details child. -@return The index, or -1 if the child is not found - in the details. -**/ - public synchronized int getDetailsIndex (VObject detailsChild) - { - for (int i = 0; i < loaded_; ++i) - if (detailsChildren_[i] == detailsChild) - return i; - return -1; - } - - - -/** -Returns the table column model to use in the details -when representing the children. This column model -describes the details values for the children. - -@return The details column model. -**/ - public TableColumnModel getDetailsColumnModel () - { - return detailsColumnModel_; - } - - - -/** -Returns the icon. - -@param size The icon size, either 16 or 32. If any other - value is given, then return a default. -@param open This parameter has no effect. -@return The icon. -**/ - public Icon getIcon (int size, boolean open) - { - if (size == 32) - return icon32_; - else - return icon16_; - } - - - -/** -Returns the index of the specified child. - -@param child The child. -@return Always -1. -**/ - public int getIndex (TreeNode child) - { - return -1; - } - - - -/** -Returns the parent node. - -@return The parent node, or null if there is no parent. -**/ - public TreeNode getParent () - { - return parent_; - } - - - -/** -Returns the fully qualified integrated file system path name of the message queue. - -@return The fully qualified integrated file system path name of the message queue. - -@see com.ibm.as400.access.MessageQueue#getPath -**/ - public String getPath () - { - return queue_.getPath (); - } - - - -/** -Returns the properties pane. - -@return The properties pane. -**/ - public VPropertiesPane getPropertiesPane () - { - return propertiesPane_; - } - - - -/** -Returns a property value. - -@param propertyIdentifier The property identifier. The choices are - NAME_PROPERTY or DESCRIPTION_PROPERTY. -@return The property value, or null if the - property identifier is not recognized. -**/ - public Object getPropertyValue (Object propertyIdentifier) - { - // Get the name. - if (propertyIdentifier == NAME_PROPERTY) - return this; - - // Get the description. - else if (propertyIdentifier == DESCRIPTION_PROPERTY) - return description_; - - // By default, return null. - return null; - } - - - -/** -Returns the selection. - -@return The selection. - -@see com.ibm.as400.access.MessageQueue#getSelection -**/ - public String getSelection () - { - return queue_.getSelection (); - } - - - -/** -Returns the severity. - -@return The severity. - -@see com.ibm.as400.access.MessageQueue#getSeverity -**/ - public int getSeverity () - { - return queue_.getSeverity (); - } - - - -/** -Returns the system on which the message queue exists. - -@return The system on which the message queue exists. -**/ - public AS400 getSystem () - { - return queue_.getSystem (); - } - - - -/** -Returns the name of the message queue. - -@return The name of the message queue. -**/ - public String getText () - { - String pathName = queue_.getPath (); - if (pathName.equals (MessageQueue.CURRENT)) { - AS400 system = queue_.getSystem (); - if (system != null) - return system.getUserId (); - else - return ""; - } - else { - QSYSObjectPathName path = new QSYSObjectPathName (pathName); - return path.getObjectName (); - } - } - - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - objectEventSupport_ = new VObjectEventSupport (this); - objectListener_ = new VObjectListener_ (); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - queue_.addPropertyChangeListener (propertyChangeSupport_); - queue_.addVetoableChangeListener (vetoableChangeSupport_); - - // Initialize the private data. - detailsChildren_ = new VObject[0]; - enum_ = null; - loaded_ = -1; - - // Initialize the actions. - actions_ = new VAction[] { - new MessageQueueClearAction (this, queue_) - }; - - for (int i = 0; i < actions_.length; ++i) { - actions_[i].addErrorListener (errorEventSupport_); - actions_[i].addVObjectListener (objectEventSupport_); - actions_[i].addVObjectListener (objectListener_); - actions_[i].addWorkingListener (workingEventSupport_); - } - - // Initialize the properties pane. - propertiesPane_ = new MessageQueuePropertiesPane (this); - - propertiesPane_.addErrorListener (errorEventSupport_); - propertiesPane_.addVObjectListener (objectEventSupport_); - propertiesPane_.addVObjectListener (objectListener_); - propertiesPane_.addWorkingListener (workingEventSupport_); - } - - - -/** -Indicates if the node is a leaf. - -@return Always true. -**/ - public boolean isLeaf () - { - return true; - } - - - -/** -Indicates if the details children are sortable. - -@return Always false. -**/ -// -// Implementation note: We do not allow sorting because of the fact -// that we load the list incrementally. -// - public boolean isSortable () - { - return false; - } - - - -/** -Loads information about the object from the system. -**/ - public void load () - { - if (Trace.isTraceOn ()) - Trace.log (Trace.INFORMATION, "Loading messages from message queue " + this + "."); - - workingEventSupport_.fireStartWorking (); - - Exception error = null; - - try { // @A1A - enum_ = queue_.getMessages(); // @A1A - } // @A1A - catch (Exception e) { // @A1A - error = e; // @A1A - } // @A1A - - synchronized (this) { - - // Stop listening to the previous children. - for (int i = 0; i < loaded_; ++i) { - detailsChildren_[i].removeErrorListener (errorEventSupport_); - detailsChildren_[i].removeVObjectListener (objectEventSupport_); - detailsChildren_[i].removeVObjectListener (objectListener_); - detailsChildren_[i].removeWorkingListener (workingEventSupport_); - } - - // Refresh the children based on the queue. - loaded_ = 0; - // @A1D try { - // @A1D enum_ = queue_.getMessages (); - if (error == null) // @A1A - detailsChildren_ = new VQueuedMessage[queue_.getLength ()]; - else // @A1A - detailsChildren_ = new VQueuedMessage[0]; // @A1A - - // @A1D } - // @A1D catch (Exception e) { - // @A1D error = e; - // @A1D detailsChildren_ = new VUser[0]; - // @A1D } - } - - if (error != null) - errorEventSupport_.fireError (error); - - objectEventSupport_.fireObjectChanged (this, true); // @A1A - - workingEventSupport_.fireStopWorking (); - } - - - -/** -Loads more messages from the system. - -@param index The index needed. -**/ - private void loadMore (int index) - { - if (index >= loaded_) { - - workingEventSupport_.fireStartWorking (); - - Exception error = null; - // @A1D synchronized (this) { - - for (int i = loaded_; i <= index; ++i) { - QueuedMessage message = (QueuedMessage) enum_.nextElement (); - detailsChildren_[i] = new VQueuedMessage (message, queue_); - detailsChildren_[i].addErrorListener (errorEventSupport_); - detailsChildren_[i].addVObjectListener (objectEventSupport_); - detailsChildren_[i].addVObjectListener (objectListener_); - detailsChildren_[i].addWorkingListener (workingEventSupport_); - } - - // @A1D } - - loaded_ = index + 1; - - if (error != null) - errorEventSupport_.fireError (error); - - workingEventSupport_.fireStopWorking (); - } - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** - -Sets the fully qualified integrated file system path name of the message queue. This does not take effect the data until load() is done. - -@param path The fully qualified integrated file system path name of the message queue. The path must be in the format of /QSYS.LIB/libname.LIB/messageQueue.MSGQ. The library and queue name must each be 10 characters or less. - - -@exception PropertyVetoException If the change is vetoed. - -@see com.ibm.as400.access.MessageQueue#setPath -**/ - public void setPath (String path) - throws PropertyVetoException - { - if (path == null) - throw new NullPointerException ("path"); - - queue_.setPath (path); - } - - - -/** -Sets the selection. - -@param selection The selection. - -@exception PropertyVetoException If the change is vetoed. - -@see com.ibm.as400.access.MessageQueue#setSelection -**/ - public void setSelection (String selection) - throws PropertyVetoException - { - if (selection == null) - throw new NullPointerException ("selection"); - - queue_.setSelection (selection); - } - - - -/** -Sets the severity. - -@param severity The severity. - -@exception PropertyVetoException If the change is vetoed. - -@see com.ibm.as400.access.MessageQueue#setSeverity -**/ - public void setSeverity (int severity) - throws PropertyVetoException - { - queue_.setSeverity (severity); - } - - - -/** -Sets the system on which the message queue resides. - -@param system The system on which the message queue resides. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setSystem (AS400 system) - throws PropertyVetoException - { - if (system == null) - throw new NullPointerException ("system"); - - queue_.setSystem (system); - } - - - -/** -Sorts the children for the details. Since sorting is not supported, -this method does nothing. - -@param propertyIdentifiers The property identifiers. -@param orders The sort orders for each property - identifier. true for ascending order; - false for descending order. -**/ - public void sortDetailsChildren (Object[] propertyIdentifiers, - boolean[] orders) - { - // No sorting here! - } - - - -/** -Returns the string representation of the description. - -@return The string representation of the description. -**/ - public String toString () - { - return getText (); - } - - - -/** -Listens for events and adjusts the children accordingly. -**/ - private class VObjectListener_ - implements VObjectListener, Serializable - { - - - - public void objectChanged (VObjectEvent event) - { - // Nothing here. - } - - - - public void objectCreated (VObjectEvent event) - { - // Nothing here. - } - - - - public void objectDeleted (VObjectEvent event) - { - VObject object = event.getObject (); - - // Forward this event to the event support first, - // so the the listener can handle it before we - // go and remove the object from our list. - objectEventSupport_.objectDeleted (event); - - // If the deleted object is contained in the list, - // then remove it from the list. - synchronized (VMessageQueue.this) { - - // Remove from the details children. - int count; - int index = getDetailsIndex (object); - if (index >= 0) { - VObject[] oldDetailsChildren = detailsChildren_; - count = detailsChildren_.length; - detailsChildren_ = new VObject[count - 1]; - System.arraycopy (oldDetailsChildren, 0, - detailsChildren_, 0, index); - System.arraycopy (oldDetailsChildren, index + 1, - detailsChildren_, index, count - index - 1); - --loaded_; // @B1A - }; - - } - - // Stop listening to the object. - object.removeErrorListener (errorEventSupport_); - object.removeVObjectListener (objectEventSupport_); - object.removeVObjectListener (objectListener_); - object.removeWorkingListener (workingEventSupport_); - } - - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VMessageQueueBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/VMessageQueueBeanInfo.java deleted file mode 100644 index 149fb37a3..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VMessageQueueBeanInfo.java +++ /dev/null @@ -1,199 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VMessageQueueBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The VMessageQueueBeanInfo class provides bean information -for the VMessageQueue class. - -@see VMessageQueue -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VMessageQueueBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = VMessageQueue.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - String[] vobjectMethods = { "objectChanged", "objectCreated", "objectDeleted" }; - EventSetDescriptor vobject = new EventSetDescriptor (beanClass_, - "vobject", VObjectListener.class, vobjectMethods, - "addVObjectListener", "removeVObjectListener"); - vobject.setDisplayName (ResourceLoader.getText ("EVT_NAME_VOBJECT")); - vobject.setShortDescription (ResourceLoader.getText ("EVT_DESC_VOBJECT")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { error, vobject, working }; - - // Properties. - PropertyDescriptor path = new PropertyDescriptor ("path", beanClass_); - path.setBound (true); - path.setConstrained (true); - path.setDisplayName (ResourceLoader.getText ("PROP_NAME_PATH")); - path.setShortDescription (ResourceLoader.getText ("PROP_DESC_PATH")); - - PropertyDescriptor selection = new PropertyDescriptor ("selection", beanClass_); - selection.setBound (true); - selection.setConstrained (true); - selection.setDisplayName (ResourceLoader.getText ("PROP_NAME_SELECTION")); - selection.setShortDescription (ResourceLoader.getText ("PROP_DESC_SELECTION")); - - PropertyDescriptor severity = new PropertyDescriptor ("severity", beanClass_); - severity.setBound (true); - severity.setConstrained (true); - severity.setDisplayName (ResourceLoader.getText ("PROP_NAME_SEVERITY")); - severity.setShortDescription (ResourceLoader.getText ("PROP_DESC_SEVERITY")); - - PropertyDescriptor system = new PropertyDescriptor ("system", beanClass_); - system.setBound (true); - system.setConstrained (true); - system.setDisplayName (ResourceLoader.getText ("PROP_NAME_SYSTEM")); - system.setShortDescription (ResourceLoader.getText ("PROP_DESC_SYSTEM")); - - properties_ = new PropertyDescriptor[] { path, selection, - severity, system }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // path. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("VMessageList16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("VMessageList32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VNPMRI.java b/cvsroot/src/com/ibm/as400/vaccess/VNPMRI.java deleted file mode 100644 index 20b808b8d..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VNPMRI.java +++ /dev/null @@ -1,369 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VNPMRI.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.util.*; - -/** -Locale-specific objects for the IBM Toolbox for Java. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VNPMRI extends ListResourceBundle -{ - // NLS_MESSAGEFORMAT_NONE - // Each string is assumed NOT to be processed by the MessageFormat class. - // This means that a single quote must be coded as 1 single quote. - - // NLS_ENCODING=UTF-8 - // Instructs the translation tools to interpret the text as UTF-8. - - public Object[][] getContents() - { - return resources; - } - - private final static Object[][] resources= { - // #TRANNOTE Before you add a new resource, please make - // #TRANNOTE sure you are not duplicating another. The - // #TRANNOTE goal is to keep the amount of translatable - // #TRANNOTE text down. - // #TRANNOTE - // #TRANNOTE NOTE TO TRANSLATORS: The format of a line of MRI - // #TRANNOTE is { "KEY", "value" }, - // #TRANNOTE - // #TRANNOTE The key must be left alone so translate only the value. - // #TRANNOTE - - { "ACTIVE", "Active" }, - { "ACTIVE_READER", "Active reader" }, - { "ACTIVE_WRITER", "Active writer" }, - { "ADV_FUNC_PRINTING", "Advanced Function Printing" }, - { "ADVANCED", "Advanced" }, - { "AFTER_ALL_FILES_PRINT", "After all files print" }, - { "AFTER_CURRENT_FILE_PRINTS", "After current file prints" }, - { "ALL", "All" }, - { "ALL_DATA", "All data" }, - { "ALLOW_DIRECT_PRINTING", "Allow direct printing" }, - { "AS36_DISABLED", "AS/36 disabled" }, - { "AS36_ENABLED", "AS/36 enabled" }, - { "AS400", "AS400" }, - { "AS400_PRINTER", "Printer" }, - { "AS400_PRINTERS", "Printers" }, - { "AT_COPY_END", "After the current copy" }, - { "AT_PAGE_END", "At the end of the page" }, - { "AUTOMATIC", "Automatic" }, - { "AVAILABLE", "Available" }, - { "AVAILABLE_PENDING", "Available pending" }, - - { "BEING_CREATED", "Being created" }, - { "BEING_SENT", "Being sent" }, - { "BEING_SERVICED", "Being serviced" }, - { "BETWEEN_COPIES", "Between copies" }, - { "BETWEEN_FILES", "Between files" }, - - { "CHANGES_TAKE_EFFECT", "Changes take effect" }, - { "CLOSED", "Closed" }, - { "CONNECT_PENDING", "Connect pending" }, - { "CONVERTING_FOR_AFP_PRINTER", "Converting for AFP printer" }, - { "COPIES", "Copies" }, - { "COPIES_LEFT", "Copies left" }, - { "COPIES_LEFT_1_255", "Copies left (1-255)" }, - { "CURRENT_FORM_TYPE", "Current form type" }, - { "CURRENT_FORM_TYPE_NOTIFICATION", "Current form type notification" }, - { "CURRENT_JOB", "Current job" }, - { "CURRENT_NUM_SEP_PAGES", "Current number of separator pages" }, - { "CURRENT_PAGE", "Current page" }, - { "CURRENT_PAPER_SIZE", "Current paper size" }, // @A1A - { "CURRENT_SEPARATOR_DRAWER", "Current separator drawer" }, - { "CURRENT_USER", "Current user" }, - { "CURRENT_VALUES", "Current values" }, - { "CURRENT_VIEWING_FIDELITY", "Current viewing fidelity" }, // @A1A - - { "DAMAGED", "Damaged" }, - { "DATE_CREATED", "Date created" }, - { "DATE_SENT", "Date sent" }, - { "DEF_START_PAGE", "Default start page" }, - { "DEFERRED", "Deferred" }, - { "DELETE_AFTER_SENDING", "Delete after sending" }, - { "DESCRIPTION", "Description" }, - { "DESTINATION_OPTION", "Destination option" }, - { "DESTINATION_TYPE", "Destination type" }, - { "DEVICE", "Device" }, - { "DEVICE_DEFAULT", "Device default" }, - { "DEVICE_STATUS", "Device status" }, - { "DIAGNOSTIC_MODE", "Diagnostic mode" }, - { "DIRECT_PRINT", "Allow direct printing" }, - - { "END_AUTOMATICALLY", "End automatically" }, - { "END_PENDING", "End pending" }, - { "ENDED", "Ended" }, - - { "FAILED", "Failed" }, - { "FAILED_READER", "Failed reader" }, - { "FAILED_WRITER", "Failed writer" }, - { "FIDELITY_ABSOLUTE", "Absolute" }, // @A1A - { "FIDELITY_CONTENT", "Content" }, // @A1A - { "FILE_AFTER_ALL", "After all files print" }, - { "FILE_AFTER_CURRENT", "After the current file prints" }, - { "FILE_DEFAULT", "File default" }, - { "FILE_FIRST_AVAILABLE", "First available file" }, - { "FILE_FORM_ALIGNMENT", "Only on first file" }, - { "FILE_LAST", "Last file" }, - { "FINISHED", "Finished" }, - { "FINISHED_PRINTING", "Finished printing" }, - { "FIRST_FILE_NAME", "First file to print" }, - { "FIRST_FILE_NUMBER", "File number" }, - { "FIRST_JOB_NAME", "Job name" }, - { "FIRST_JOB_USER", "Job user" }, - { "FIRST_JOB_NUMBER", "Job number" }, - { "FIRST_START_PAGE", "Starting page" }, - { "FORM_ALIGN", "Forms alignment" }, - { "FORM_TYPE", "Form type" }, - { "FORM_TYPE_ALL", "All" }, - { "FORM_TYPE_NOTIFY", "Form type notification" }, - { "FORM_TYPE_STANDARD", "Standard" }, - { "FORM_TYPE_ALL_GBT", "All, grouped by type" }, - { "FORMS", "Forms" }, - { "FORMS_ALIGNMENT", "Forms alignment" }, - - { "GENERAL", "General" }, - { "GO_TO_PAGE", "Go to page"}, // @A1A - { "GROUP", "Group" }, - - { "HELD", "Held" }, - { "HIGH_PRIORITY", "High priority" }, - { "HOLD_OUTPUT", "Hold output" }, - { "HOLD_PENDING", "Hold pending" }, - { "HOLD_PRINTER", "Hold printer" }, - - { "IMMEDIATELY", "Immediately" }, - { "INCLUDE", "Include" }, - { "INFORMATION_MESSAGE", "Information message" }, - { "INFO_AND_INQUIRY_MESSAGE", "Informational and inquiry messages" }, - { "INQUIRY_MESSAGE", "Inquiry message" }, - { "INTERNET_ADDRESS", "Internet address" }, - - { "JOB", "Job" }, - { "JOB_NAME", "Job name" }, - { "JOB_NUMBER", "Job number" }, - { "JOB_VALUE", "Job value" }, - - { "LAST_PAGE", "Last page printed" }, - { "LIBRARY", "Library" }, - { "LIBRARY_LIST", "Library list" }, - { "LOCKED", "Locked" }, - - { "MANUFACTURER_TYPE", "Manufacturer type" }, - { "MESSAGE", "Message" }, - { "MESSAGE_ID", "Message ID" }, - { "MESSAGE_HELP", "Message help" }, - { "MESSAGE_QUEUE", "Message queue" }, - { "MESSAGE_QUEUE_LIB_DESCRIPTION", "Message queue library" }, - { "MESSAGE_TYPE_INQUIRY", "Inquiry message" }, - { "MESSAGE_TYPE_INQ_INFO", "Informational and inquiry message" }, - { "MESSAGE_TYPE_INFO", "Informational message" }, - { "MESSAGE_TYPE_NONE", "No message" }, - { "MESSAGE_WAITING", "Message waiting" }, - - { "MOVE_OUTPUT", "Move the output" }, - - { "NEXT_FORM_TYPE", "Next form type" }, - { "NEXT_FORM_TYPE_NOTIFICATION", "Next form type notification" }, - { "NEXT_NUM_SEP_PAGES", "Next number of separator pages (0-9)" }, - { "NEXT_OUTPUT_QUEUE", "Next output queue" }, - { "NEXT_SEPARATOR_DRAWER", "Next separator drawer (1-255)" }, - { "NO", "No" }, - { "NO_MESSAGE", "No message" }, - { "NONE", "None" }, // @A1A - { "NORMAL_PRIORITY", "Normal priority" }, - { "NOT_ASSIGNED", "Not assigned" }, - { "NOT_SCHEDULED_TO_PRINT_YET", "Not scheduled to print yet" }, - { "NUMBER", "Number" }, - { "NUMBER_OF_SEP_PAGES", "Number of separator pages" }, - - { "ON_JOB_QUEUE", "On job queue" }, - { "ONLY", "Only" }, - { "OPEN", "Open" }, - { "ORIGIN", "Origin" }, - { "OTHER", "Other" }, - { "OUTPUT_NAME", "Output name" }, - { "OUTPUT_QUEUE", "Output queue" }, - { "OUTPUT_QUEUE_LIB", "Output queue library" }, - { "OUTPUT_QUEUE_STATUS", "Output queue status" }, - { "OUTPUT_DESCRIPTION", "Output" }, - { "OUTQ_PRIORITY_1_9", "Priority on output queue (1-9)" }, - - { "PAGE_LIMIT_EXCEEDED", "Page limit exceeded" }, - { "PAGE_OF", "Page &0 of &1" }, // @A1A - { "PAGES", "Pages" }, - { "PAGES_PER_COPY", "Pages per copy" }, - { "PAPER_SIZE", "Paper Size" }, // @A1A - { "PAPER_SIZE_LETTER", "Letter" }, // @A1A - { "PAPER_SIZE_LEGAL", "Legal" }, // @A1A - { "PAPER_SIZE_EXECUTIVE", "Executive" }, // @A1A - { "PAPER_SIZE_LEDGER", "Ledger" }, // @A1A - { "PAPER_SIZE_A3", "A3" }, // @A1A - { "PAPER_SIZE_A4", "A4" }, // @A1A - { "PAPER_SIZE_A5", "A5" }, // @A1A - { "PAPER_SIZE_B4", "B4" }, // @A1A - { "PAPER_SIZE_B5", "B5" }, // @A1A - { "PAPER_SIZE_CONT80", "CONT80" }, // @A1A - { "PAPER_SIZE_CONT132", "CONT132" }, // @A1A - { "PENDING", "Pending" }, - { "POWERED_OFF_NOT_AVAILABLE", "Powered off or not yet available" }, - { "POWERED_OFF", "Powered off" }, - { "PRINTED_AND_KEPT", "Printed and kept" }, - { "PRINTER", "Printer" }, - { "PRINTER_DEFAULT", " Printer default" }, - { "PRINTER_OUTPUT_TO_HOLD", "Printer output to hold" }, - { "PRINTER_OUTPUT_TO_MOVE", "Printer output to move" }, - { "PRINTER_OUTPUT_TO_SEND", "Printer output to send" }, - { "PRINTER_TO_HOLD", "Printer to hold" }, - { "PRINTER_TO_START", "Printer to start" }, - { "PRINTER_TO_STOP", "Printer to stop" }, - { "PRINT_QUEUE", "Print queue" }, - { "PRINT_SEPARATOR_PAGE", "Print separator page" }, - { "PRINTERS", "Printers" }, - { "PRINTEROUTPUT_DESCRIPTION", "Printer Output" }, - { "PRINTEROUTPUT_NAME", "Printer Output" }, - { "PRINTERQUEUE", "Printer/Queue" }, - { "PRINTING", "Printing" }, - { "PRINT_SERVICES_FACILITY", "Print Services Facility/2" }, - { "PRIORITY", "Priority on output queue" }, - { "PROP_DESC_CURRENT_PAGE", "The page currently being viewed." },// @A1A - { "PROP_NAME_CURRENT_PAGE", "currentPage" }, // @A1A - { "PROP_DESC_NUMBER_OF_PAGES", "The number of pages in the spooled file." }, // @A1A - { "PROP_NAME_NUMBER_OF_PAGES", "numberOfPages" }, // @A1A - { "PROP_DESC_NUMBER_OF_PAGES_ESTIMATED", "Indicates if the number of pages value is estimated." }, // @A1A - { "PROP_NAME_NUMBER_OF_PAGES_ESTIMATED", "numberOfPagesEstimated" }, // @A1A - { "PROP_DESC_PAPER_SIZE", "The paper size." }, // @A1A - { "PROP_NAME_PAPER_SIZE", "paperSize" }, // @A1A - { "PROP_DESC_PRINTER_PRINTER", "The printer that is associated with this object." }, - { "PROP_NAME_PRINTER_PRINTER", "printer" }, - { "PROP_DESC_PRINTERS_PRINTER_FILTER", "The filter that selects printers by name." }, - { "PROP_NAME_PRINTERS_PRINTER_FILTER", "printerFilter" }, - { "PROP_DESC_SPLF", "The spooled file." }, // @A1A - { "PROP_NAME_SPLF", "spooledFile" }, // @A1A - { "PROP_DESC_SPLF_FORMTYPE_FILTER", "The filter that selects files by their form type." }, - { "PROP_NAME_SPLF_FORMTYPE_FILTER", "formTypeFilter" }, - { "PROP_DESC_SPLF_OUTQ_FILTER", "The filter that selects files by the integrated file system name of the output queue containing them." }, - { "PROP_NAME_SPLF_OUTQ_FILTER", "queueFilter" }, - { "PROP_DESC_SPLF_USER_FILTER", "The filter that selects files by the user that created them." }, - { "PROP_NAME_SPLF_USER_FILTER", "userFilter" }, - { "PROP_DESC_SPLF_USERDATA_FILTER", "The filter that selects files by their user data." }, - { "PROP_NAME_SPLF_USERDATA_FILTER", "userDataFilter" }, - { "PROP_DESC_VIEWING_FIDELITY", "The fidelity used to format the spooled file for viewing." },// @A1A - { "PROP_NAME_VIEWING_FIDELITY", "viewingFidelity" }, // @A1A - - { "READY", "Ready" }, - { "REPLY", "Reply" }, - { "RECORD_FORMAT", "Record format" }, - { "RECORD_DATA", "Record data only" }, - { "RECOVERY_CANCELLED", "Recovery canceled" }, - { "RECOVERY_PENDING", "Recovery pending" }, - { "RELEASED", "Released" }, - { "REMOTE_SYSTEM", "Remote system" }, - - { "SAVE_AFTER_PRINTING", "Save after printing" }, - { "SAVED", "Saved" }, - { "SCS", "SNA character string" }, - { "SEND_PRIORITY", "Send priority" }, - { "SEND_TO", "Send to" }, - { "SENDING", "Sending" }, - { "SENT_TO_PRINTER", "Sent to printer" }, - { "SEPARATOR_DRAWER", "Separator Drawer" }, - { "SEPARATORS", "Separators" }, - { "SIGNON_DISPLAY", "Signon display" }, - { "STANDARD", "Standard" }, - { "STARTED", "Started" }, - { "STARTED_BY", "Started by" }, - { "STATUS", "Status" }, - { "STILL_BEING_CREATED", "Still being created" }, - { "STOP_PENDING", "Stop pending" }, - { "STOP_PRINTING", "Stop printing" }, - { "STOPPED", "Stopped" }, - { "SYSTEM_NAME", "System name" }, - - { "TIME_CREATED", "Time created" }, - { "TOTAL_COPIES_1_255", "Total copies (1-255)" }, - { "TRANSFORM_DATA", "Transform data" }, - { "TYPE", "Type" }, - - { "UNABLE_TO_VIEW", "Unable to view spooled file" }, // @A1A - { "UNAVAILABLE", "Unavailable" }, - { "UNAVAILABLE_PENDING", "Unavailable pending" }, - { "UNKNOWN", "Unknown" }, - { "UNUSABLE", "Unusable" }, - { "USER", "User" }, - { "USER_COMMENT", "User comment" }, - { "USER_DEFAULT", "User default" }, - { "USER_DATA_TRANSFORM", "User data transform" }, - { "USER_DATA_TRANSFORM_LIB", "User data transform library" }, - { "USER_NAME", "User name" }, - { "USER_SPEC_DATA", "User-specified data" }, - { "USE__CURRENT_LIBRARY", "Use current library" }, - { "USE_LIBRARY_LIST", "Use library list" }, - - { "VARIED_OFF", "Varied off" }, - { "VARIED_ON", "Varied on" }, - { "VARY_OFF_PENDING", "Vary off pending" }, - { "VARY_ON_PENDING", "Vary on pending" }, - { "VIEWING_FIDELITY", "Viewing Fidelity" }, // @A1A - { "VM_MVS_CLASS", "VM/MVS Class" }, - - { "WAITING_FOR_DATA", "Waiting for data" }, - { "WAITING_FOR_DEVICE", "Waiting for device" }, - { "WAITING_FOR_OUTQ", "Waiting for output queue" }, - { "WAITING_FOR_PRINTER", "Waiting for printer" }, - { "WAITING_FOR_PRINTER_OUTPUT", "Waiting for printer output" }, - { "WAITING_ON_JOB_QUEUE_QSPL", "Waiting on job queue QSPL" }, - { "WAITING_ON_MESSAGE", "Waiting on message" }, - { "WAITING_TO_START", "Waiting to start" }, - - // #TRANNOTE ######################################### // @A1A - // #TRANNOTE Text for panels appearing when // @A1A - // #TRANNOTE viewing fidelity or paper size is // @A1A - // #TRANNOTE requested to be changed. // @A1A - // #TRANNOTE ######################################### // @A1A - // #TRANNOTE When the user elects to change the // @A1A - // #TRANNOTE viewing fidelity or the paper size while // @A1A - // #TRANNOTE using the spooled file viewer, a warning // @A1A - // #TRANNOTE dialog box is displayed indicating the // @A1A - // #TRANNOTE spooled file will be reloaded // @A1A - // #TRANNOTE using the new attribute setting. // @A1A - // #TRANNOTE (The \n forces a new line) // @A1A - { "WARNING_FIDELITY", " Changing the viewing fidelity will \n cause the viewer to reload the \n spooled file being viewed, adjusting for \n the new attribute setting." }, // @A1A - { "WARNING_PAPER_SIZE", " Changing the paper size will cause \n the viewer to reload the \n spooled file being viewed, adjusting for \n the new attribute setting." }, // @A1A - { "WARNING", "Warning" }, // @A1A - - - { "WORKSTATION_CUST_OBJECT", "Workstation customization object" }, - { "WORKSTATION_CUST_OBJECT_LIB", "Workstation customization object library" }, - { "WRITER", "Writer" }, - { "WRITER_AUTO_END", "Automatically end writer" }, - { "WRITER_DEFAULT", "Writer default" }, - { "WRITER_NAME", " Writer name" }, - { "WRITER_STATUS", "Writer status" }, - { "WRITER_WHEN_TO_END", "When to end" }, - { "WRITING", "Writing" }, - - { "YES", "Yes" }, - - }; - - - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VNode.java b/cvsroot/src/com/ibm/as400/vaccess/VNode.java deleted file mode 100644 index bd1cf1da2..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VNode.java +++ /dev/null @@ -1,158 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VNode.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.table.TableColumnModel; -import javax.swing.tree.TreeNode; - - -/** -The VNode interface defines the representation of an -system resource that exists in a hierarchy. - -

    In the hierarchy, a node has exactly one parent and -any number of children. Note that there may be a different -set of children for the "tree" hierarchy than those represented -in the "details" hierarchy. The tree hierarchy is for displaying -in tree views, while the details hierarchy is for list and details -views. - -

    Many of these methods are not called directly by -programs. Instead, they are called by the server panes -to respond to the user interface as needed. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VNode objects generate the following events: -

      -
    • ErrorEvent -
    • VObjectEvent -
    • WorkingEvent -
    - -

    An implementation of this interface should pass on all -events fired by its children to its listeners. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -// @A1C - javadoc -public interface VNode -extends VObject, TreeNode -{ - - - -/** -Returns the table column model to use in the details -when representing the children. Each of the columns -in this column model has an identifier that identifies -the property with which it is associated. The property -values of the children are then displayed in that column. - -

    This is called on the root of an AS400DetailsPane -or AS400DetailsModel to determine the structure of the -table. - -@return The details column model, or null if there is none. - -@see VObject#getPropertyValue -**/ -// @A1C - javadoc - abstract public TableColumnModel getDetailsColumnModel (); - - - -/** -Returns the child for the details at the specified index. -This is called in order to determine the list of children -to be displayed in an AS400DetailsPane, AS400DetailsModel, -AS400ListPane, or AS400ListModel. - -@param index The index. -@return The child, or null if the index is not valid. -**/ -// @A1C - javadoc - abstract public VObject getDetailsChildAt (int index); - - - -/** -Returns the number of children for the details. -This is called in order to determine the list of children -to be displayed in an AS400DetailsPane, AS400DetailsModel, -AS400ListPane, or AS400ListModel. - -@return The number of children for the details. -**/ -// @A1C - javadoc - abstract public int getDetailsChildCount (); - - - -/** -Returns the index of the specified child for the details. -This is called in order to determine the list of children -to be displayed in an AS400DetailsPane, AS400DetailsModel, -AS400ListPane, or AS400ListModel. - -@param detailsChild The details child. -@return The index, or -1 if the child is not - found in the details. -**/ -// @A1C - javadoc - abstract public int getDetailsIndex (VObject detailsChild); - - - -/** -Indicates if the details children are sortable. An -implementation that contains a large number of children or -children that are not all loaded from the system at once -may not want its' children to be sortable. - -@return true if the details children are sortable; false - otherwise. -**/ - abstract public boolean isSortable (); - - - -/** -Sorts the children for the details. The propertyIdentifer[0], -orders[0] combination is used to do the sort. If the values -are equal, propertyIdentifier[1], orders[1] is used to break -the tie, and so forth. - -

    An implementation that contains a large number of children -or children that are not all loaded from the system at once may -not want to allow sorting of its children. In that case, this -method will have no effect. - -@param propertyIdentifiers The property identifiers. If any of - the property identifiers are null, it - means to sort using the string - representation of the object. -@param orders The sort orders for each property - identifier. true for ascending order; - false for descending order. -**/ - abstract public void sortDetailsChildren (Object[] propertyIdentifiers, - boolean[] orders); - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VObject.java b/cvsroot/src/com/ibm/as400/vaccess/VObject.java deleted file mode 100644 index 543f65639..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VObject.java +++ /dev/null @@ -1,233 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VObject.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.Icon; - - - -/** -The VObject interface defines the representation of an -system resource for use in various models and panes in this -package. - -

    An object has any number of properties. These are -attributes of the object itself and are identified by -property identifiers. Every object has at least name and -desctiption properties, and most will define more. - -

    Many of these methods are not called directly by -programs. Instead, they are called by the server panes -to respond to the user interface as needed. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VObject objects generate the following events: -

      -
    • ErrorEvent -
    • VObjectEvent -
    • WorkingEvent -
    - -

    An implementation of this interface should pass on all -events fired by its actions and properties pane to its -listeners. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -// @A1C - javadoc -public interface VObject -{ - - - -/** -Property identifier for the name. -**/ - public static final Object NAME_PROPERTY = "Name"; - -/** -Property identifier for the description. -**/ - public static final Object DESCRIPTION_PROPERTY = "Description"; - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - abstract public void addErrorListener (ErrorListener listener); - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - abstract public void addVObjectListener (VObjectListener listener); - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - - -@param listener The listener. -**/ - abstract public void addWorkingListener (WorkingListener listener); - - - -/** -Returns the list of actions that can be performed. This is called -when the user brings up a popup menu on this VObject. The popup -menu will contain a menu item for each returned VAction. - -@return The actions, or null if there are no actions. -**/ -// @A1C - javadoc - abstract public VAction[] getActions (); - - - -/** -Returns the default action. This is called when the user double-clicks -on this VObject. The returned action will then be performed. - -@return The default action, or null if there is no default - action. -**/ -// @A1C - javadoc - abstract public VAction getDefaultAction (); - - - -/** -Returns the icon. This is called to determine which icon to show -with this VObject. - -@param size The icon size, either 16 or 32. If any other - value is given, then return a default. -@param open true for the open icon; false for the closed - icon. If there is only one icon, then this - parameter has no effect. -@return The icon, or null if there is none. -**/ -// @A1C - javadoc - abstract public Icon getIcon (int size, boolean open); - - - -/** -Returns the properties pane. This is called when the user -selects the "Properties" menu item on this VObject's popup -menu. The return VPropertiesPane object will be presented -as a properties dialog. - -@return The properties pane, or null if there is none. -**/ -// @A1C - javadoc - abstract public VPropertiesPane getPropertiesPane (); - - - -/** -Returns a property value. This is called in order to -fill the contents of cells in an AS400DetailsPane or -AS400DetailsModel object. - -

    An implementation of this interface should describe the -properties that it supports. At minimum, it should support -the following property identifiers: - - - - - - - - - - - - - - -
    PropertyReturn value
    NAME_PROPERTYReturns the VObject itself ("this"). This will - be rendered using an icon and a name.
    DESCRIPTION_PROPERTYReturns a text description of the VObject.
    - -@param propertyIdentifier The property identifier. -@return The property value, or null - if the property identifier - is not recognized. -**/ -// @A1C - javadoc - abstract public Object getPropertyValue (Object propertyIdentifier); - - - -/** -Returns the descriptive text associated with this object. -This is called when rendering the VObject in a user interface. - -@return The descriptive text associated with this object. -**/ -// @A1C - javadoc - abstract public String getText (); - - - -/** -Loads information about the object from the system. -**/ - abstract public void load (); - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - abstract public void removeErrorListener (ErrorListener listener); - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - abstract public void removeVObjectListener (VObjectListener listener); - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - abstract public void removeWorkingListener (WorkingListener listener); - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VObjectCellEditor.java b/cvsroot/src/com/ibm/as400/vaccess/VObjectCellEditor.java deleted file mode 100644 index 5a6fc9e62..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VObjectCellEditor.java +++ /dev/null @@ -1,131 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VObjectCellEditor.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.DefaultCellEditor; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.JTree; -import java.awt.BorderLayout; -import java.awt.Component; - - - -/** -The VObjectCellEditor class allows editing of the -name of an object. -**/ -class VObjectCellEditor -extends DefaultCellEditor -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a VObjectCellEditor object. -**/ - public VObjectCellEditor () - { - super (new JTextField ()); - - // We do not want double clicks to start an edit, - // since that means invoke the default action. - setClickCountToStart (100); // @C0C - } - - - -/** -Builds the component as needed. - -@param value The value. -@param open true if the icon should be open, - false otherwise. -@param defaultComponent The component built by default. -**/ - private Component buildComponent (Object value, - boolean open, - Component defaultComponent) - { - JLabel label = new JLabel (); - if (value instanceof VObject) - label.setIcon (((VObject) value).getIcon (16, open)); - else - label.setIcon (null); - - JPanel panel = new JPanel (); - panel.setLayout (new BorderLayout ()); - panel.add ("West", label); - panel.add ("Center", defaultComponent); - - return panel; - } - - - -/** -Edits the value for a table. - -@param table The table. -@param value The value. -@param selected true if the item is selected, false otherwise. -@param rowIndex The row index. -@param columnIndex The column index. -@return The rendered component. -**/ - public Component getTableCellEditorComponent (JTable table, - Object value, - boolean selected, - int rowIndex, - int columnIndex) - { - Component defaultComponent = super.getTableCellEditorComponent (table, - value, selected, rowIndex, columnIndex); - return buildComponent (value, false, defaultComponent); - } - - - -/** -Edits the value for a tree. - - -@param tree The tree. -@param value The value. -@param selected true if the item is selected, false otherwise. -@param expanded true if the item is expanded, false otherwise. -@param leaf true if the item is a leaf, false otherwise. -@param row The index within the tree. -@return The rendered component. -**/ - public Component getTreeCellEditorComponent (JTree tree, - Object value, - boolean selected, - boolean expanded, - boolean leaf, - int index) - { - Component defaultComponent = super.getTreeCellEditorComponent (tree, - value, selected, expanded, leaf, index); - return buildComponent (value, selected, defaultComponent); - } - - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VObjectCellRenderer.java b/cvsroot/src/com/ibm/as400/vaccess/VObjectCellRenderer.java deleted file mode 100644 index 6cffe7970..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VObjectCellRenderer.java +++ /dev/null @@ -1,285 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VObjectCellRenderer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.Icon; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JTable; -import javax.swing.JTree; -import javax.swing.ListCellRenderer; -import javax.swing.SwingConstants; -import javax.swing.border.LineBorder; -import javax.swing.border.EmptyBorder; -import javax.swing.table.TableCellRenderer; -import javax.swing.tree.TreeCellRenderer; -import java.awt.Component; -import java.awt.Dimension; -import java.io.Serializable; -import java.text.DateFormat; -import java.util.Date; -import java.util.TimeZone; - - - -/** -The VObjectCellRenderer class renders the name of an object -using a small icon and text description. -**/ -class VObjectCellRenderer -extends JLabel -implements ListCellRenderer, TableCellRenderer, TreeCellRenderer, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private static DateFormat dateTimeFormat_ = DateFormat.getDateTimeInstance (); //@A1C - private static DateFormat dateFormat_ = DateFormat.getDateInstance (); //@A1A - private static DateFormat timeFormat_ = DateFormat.getTimeInstance (); //@A1A - private static EmptyBorder emptyBorder_ = new EmptyBorder (1, 2, 1, 2); - private static EmptyBorder emptyBorder2_ = new EmptyBorder (0, 5, 0, 5); - - - -/** -Static initializer. -**/ - static - { - dateTimeFormat_.setTimeZone (TimeZone.getDefault ()); //@A1C - dateFormat_.setTimeZone (TimeZone.getDefault ()); //@A1A - timeFormat_.setTimeZone (TimeZone.getDefault ()); //@A1A - } - - - -/** -Constructs a VObjectCellRenderer object. -**/ - public VObjectCellRenderer () - { - initialize (); - setHorizontalAlignment (SwingConstants.LEFT); - } - - - -/** -Constructs a VObjectCellRenderer object. - -@param horizontalAlignment One of the following SwingConstants: LEFT, RIGHT, or CENTER. -**/ - public VObjectCellRenderer (int horizontalAlignment) - { - initialize (); - setHorizontalAlignment (horizontalAlignment); - } - - - -/** -Renders the value for a list. - -@param list The list. -@param value The value. -@param rowIndex The row index. -@param selected true if the item is selected, false otherwise. -@param hasFocus true if the item has focus, false otherwise. -@return The rendered component. -**/ - public Component getListCellRendererComponent (JList list, - Object value, - int rowIndex, - boolean selected, - boolean hasFocus) - { - normalize (value, false); - - // Handle selection. - if (selected) { - setForeground (list.getSelectionForeground ()); - setBackground (list.getSelectionBackground ()); - } - else { - setForeground (list.getForeground ()); - setBackground (list.getBackground ()); - } - - // Handle focus. - if (hasFocus) - setBorder (new LineBorder (list.getForeground ())); - else - setBorder (emptyBorder_); - - return this; - } - - - -/** -Renders the value for a table. - -@param table The table. -@param value The value. -@param selected true if the item is selected, false otherwise. -@param hasFocus true if the item has focus, false otherwise. -@param rowIndex The row index. -@param columnIndex The column index. -@return The rendered component. -**/ - public Component getTableCellRendererComponent (JTable table, - Object value, - boolean selected, - boolean hasFocus, - int rowIndex, - int columnIndex) - { - normalize (value, false); - - // Handle selection. - if (selected) { - setForeground (table.getSelectionForeground ()); - setBackground (table.getSelectionBackground ()); - } - else { - setForeground (table.getForeground ()); - setBackground (table.getBackground ()); - } - - // Handle focus. - if (hasFocus) - setBorder (new LineBorder (table.getForeground ())); - else - setBorder (emptyBorder_); - - return this; - } - - - -/** -Renders the value for a tree. - - -@param tree The tree. -@param value The value. -@param selected true if the item is selected, false otherwise. -@param expanded true if the item is expanded, false otherwise. -@param leaf true if the item is a leaf, false otherwise. -@param row The index within the tree. -@param hasFocus true if the item has focus, false otherwise. -@return The rendered component. -**/ - public Component getTreeCellRendererComponent (JTree tree, - Object value, - boolean selected, - boolean expanded, - boolean leaf, - int index, - boolean hasFocus) - { - normalize (value, false); - - // Handle selection. - if (selected) { - setForeground (tree.getBackground ()); - setBackground (tree.getForeground ()); - - // Handle focus. - if (hasFocus) - setBorder (new LineBorder (tree.getForeground ())); - else - setBorder (emptyBorder_); - } - else { - setBorder (emptyBorder_); - setForeground (tree.getForeground ()); - setBackground (tree.getBackground ()); - } - - return this; - } - - - -/** -Initializes the component. -**/ - private void initialize () - { - setBorder (emptyBorder2_); - setOpaque (true); - } - - - -/** -Normalizes the component. - -@param value The value. -@param open true if the icon should be open, false otherwise. -**/ - private void normalize(Object value, boolean open) - { - // If its a VObject, then set the text and icon. - if (value instanceof VObject) - { - VObject object = (VObject)value; - setText (object.getText ()); - setIcon (object.getIcon (16, open)); - } - - //@A1A - else if (value instanceof java.sql.Date) { - setText (dateFormat_.format ((java.util.Date) value)); - setIcon (null); - } - - //@A1A - else if (value instanceof java.sql.Time) { - setText (timeFormat_.format ((java.util.Date) value)); - setIcon (null); - } - - // If its a date, then format it based on the locale. - else if (value instanceof java.util.Date) { //@A1C - setText (dateTimeFormat_.format ((java.util.Date) value)); //@A1C - setIcon (null); - } - - //@A2A - // If it's a name cell in a Permission table, handle it. - else if (value instanceof PermissionNameCellObject) - { - setText(((PermissionNameCellObject)value).getText()); - setIcon(((PermissionNameCellObject)value).getIcon(16, open)); - } - - // Otherwise, set the text using toString(). - else if (value != null) { - setText (value.toString ()); - setIcon (null); - } - - // Handle a null value. - else { - setText (null); - setIcon (null); - } - } -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VObjectEvent.java b/cvsroot/src/com/ibm/as400/vaccess/VObjectEvent.java deleted file mode 100644 index fb618a9a1..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VObjectEvent.java +++ /dev/null @@ -1,118 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VObjectEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.util.EventObject; - - - -/** -The VObjectEvent class represents an event that -is fired when a system resource is changed, -created, or deleted. - -@see VObjectListener -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VObjectEvent -extends EventObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private boolean duringLoad_ = false; // @A1A - private VObject object_ = null; - private VNode parent_ = null; - - - -/** -Constructs a VObjectEvent object. - -@param source The event source. -@param object The affected system resource. -**/ - public VObjectEvent (Object source, VObject object) - { - super (source); - object_ = object; - } - - - -// @A1A - VObjectEvent (Object source, VObject object, boolean duringLoad) - { - super (source); - object_ = object; - duringLoad_ = duringLoad; - } - - - -/** -Constructs a VObjectEvent object. - -@param source The event source. -@param object The affected system resource. -@param parent The parent of the affected system resource. - This is only relevant for object created - events. -**/ - public VObjectEvent (Object source, VObject object, VNode parent) - { - super (source); - object_ = object; - parent_ = parent; - } - - - -/** -Returns the affected system resource. - -@return The system resource. -**/ - public VObject getObject () - { - return object_; - } - - - -/** -Returns the parent of the affected system resource. -This is only relevant for object created events. - -@return The parent, or null if none was set. -**/ - public VNode getParent () - { - return parent_; - } - - - -// @A1A - public boolean isDuringLoad () - { - return duringLoad_; - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VObjectEventSupport.java b/cvsroot/src/com/ibm/as400/vaccess/VObjectEventSupport.java deleted file mode 100644 index d1ee4e6fa..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VObjectEventSupport.java +++ /dev/null @@ -1,330 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VObjectEventSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.util.Vector; - - - -/** -The VObjectEventSupport class represents a list of VObjectListeners. -This is also a VObjectListener and will dispatch all VObjectEvents -that it receives. -**/ -// -// Implementation note: -// -// THIS APPLIES TO ALL "EVENT SUPPORT" CLASSES IN THIS PACKAGE: -// -// Class A is defined to fire VObjectEvents. As a result, it -// has to maintain a list of the listeners. Since many classes -// in the package have to do this, we provide an "event support" -// class to maintain this list. This is patterened after -// the java.beans.PropertyChangeSupport class provided in the JDK. -// -// public class A -// { -// private VObjectEventSupport eventSupport_ = new VObjectEventSupport (this); -// -// public void addVObjectListener (VObjectListener listener) -// { -// eventSupport_.addVObjectListener (listener); -// } -// -// public void removeVObjectListener (VObjectListener listener) -// { -// eventSupport_.removeVObjectListener (listener); -// } -// -// public void someMethod () -// { -// ... some code here ... -// eventSupport_.fireObjectChanged (anObject); -// ... some more code here ... -// } -// } -// -// There is another case where class A contains a private instance -// of class B. B fires VObjectEvents, and A needs to listen -// to B and refire all VObjectEvents. In addition, it needs -// to change the source of the event so that it looks like -// A is the source, even though B is the real source. The -// reason for this is that listeners have public access to the -// source of the event, and we don't want them to have access to B. -// -// This is all easy to accompilsh by simply adding the -// event support object as a listener to B. The event -// support object takes care of the rest. -// -// public class A -// { -// private B b_; -// private VObjectEventSupport eventSupport_ = new VObjectEventSupport (this); -// -// public A () -// { -// b_ = new B (); -// b_.addVObjectListener (eventSupport_); -// } -// } -// -// This type of event dispatching happens all over in the -// vaccess package. This is because of the hierarchy of -// components. Consider an explorer pane that presents -// a view of a directory structure. Here is the hierarchy: -// -// AS400ExplorerPane -// | -// +-- AS400TreePane -// | | -// | +-- AS400TreeModel -// | | -// | +-- VIFSDirectory (root directory) <-----------+ -// | | | -// | +-- VIFSDirectory (subdirectory) | -// | | | | -// | | +-- VIFSFile (file in subdirectory) | -// | | | -// | +-- VIFSFile (file in root directory) | -// | | -// +-- AS400DetailsPane | -// | | -// +-- AS400DetailsModel | -// | | -// +----------------------------------------------+ -// -// If any object fires certain events, then all objects -// above them in the hierarchy need to hear about it. Rather -// than making all objects specifically listen to all objects -// below them, we just make them listen to the objects -// directly below them. Then they "bubble" (dispatch) them -// up the chain to the parent. All nodes in between can process -// them on the way up. -// -// Now, when one of the VIFSFile's is deleted, it will -// fire a VObjectEvent up the chain, so that: -// -// 1. The VIFSDirectory can modify its list of children. -// 2. The AS400TreeModel can remove the file from the model. -// 3. The AS400TreePane can update its view. -// 4. The AS400DetailsModel can remove the file from the model. -// 5. The AS400DetailsPane can update its view. -// 6. The AS400ExplorerPane can refire the event to its listeners. -// 7. The caller (application) can process it. -// -class VObjectEventSupport -implements VObjectListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private transient VObjectListener[] listeners_ = new VObjectListener[0]; // For speed. - private transient Vector listenersV_ = new Vector (); - private Object source_; - - - -/** -Constructs a VObjectEventSupport object. - -@param source The source of the events. -**/ - public VObjectEventSupport (Object source) - { - source_ = source; - } - - - -/** -Adds a listener. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - listenersV_.addElement (listener); - synchronized (listeners_) { - listeners_ = new VObjectListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - - - -/** -Fires an object changed event. - -@param object The object. -**/ - public void fireObjectChanged (VObject object) - { - fireObjectChanged (new VObjectEvent (source_, object)); - } - - - -// @A1A - public void fireObjectChanged (VObject object, boolean duringLoad) - { - fireObjectChanged (new VObjectEvent (source_, object, duringLoad)); - } - - - -/** -Fires an object changed event. - -@param event The event. -**/ - public void fireObjectChanged (VObjectEvent event) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].objectChanged (event); - } - } - - - -/** -Fires an object created event. - -@param object The object. -**/ - public void fireObjectCreated (VObject object) - { - fireObjectCreated (new VObjectEvent (source_, object)); - } - - - -/** -Fires an object created event. - -@param object The object. -@param parent The parent. -**/ - public void fireObjectCreated (VObject object, VNode parent) - { - fireObjectCreated (new VObjectEvent (source_, object, parent)); - } - - - -/** -Fires an object created event. - -@param event The event. -**/ - public void fireObjectCreated (VObjectEvent event) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].objectCreated (event); - } - } - - - -/** -Fires an object deleted event. - -@param object The object. -**/ - public void fireObjectDeleted (VObject object) - { - fireObjectDeleted (new VObjectEvent (source_, object)); - } - - - -/** -Fires an object deleted event. - -@param event The event. -**/ - public void fireObjectDeleted (VObjectEvent event) - { - synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].objectDeleted (event); - } - } - - - -/** -Processes object created events. - -@param event The event. -**/ - public void objectCreated (VObjectEvent event) - { - fireObjectCreated (event); - } - - - -/** -Processes object changed events. - -@param event The event. -**/ - public void objectChanged (VObjectEvent event) - { - fireObjectChanged (event); - } - - - -/** -Processes object deleted events. - -@param event The event. -**/ - public void objectDeleted (VObjectEvent event) - { - fireObjectDeleted (event); - } - - - -/** -Removes a listener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - if (listenersV_.removeElement (listener)) { - synchronized (listeners_) { - listeners_ = new VObjectListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - } - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VObjectHeaderRenderer.java b/cvsroot/src/com/ibm/as400/vaccess/VObjectHeaderRenderer.java deleted file mode 100644 index 261451353..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VObjectHeaderRenderer.java +++ /dev/null @@ -1,111 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VObjectHeaderRenderer.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.JButton; -import javax.swing.JTable; -import javax.swing.SwingConstants; -import javax.swing.border.Border; -import javax.swing.border.BevelBorder; -import javax.swing.border.EmptyBorder; -import javax.swing.border.CompoundBorder; -import javax.swing.table.TableCellRenderer; -import java.awt.Component; - - - -/** -The VObjectHeaderRenderer class renders the name of an object -using a small icon and text description. -**/ -class VObjectHeaderRenderer -extends JButton -implements TableCellRenderer -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a VObjectHeaderRenderer object. -**/ - public VObjectHeaderRenderer () - { - this ("", SwingConstants.LEFT); - } - - -/** -Constructs a VObjectHeaderRenderer object. - -@param text The text for the header -**/ - public VObjectHeaderRenderer (String text) - { - this (text, SwingConstants.LEFT); - } - - -/** -Constructs a VObjectHeaderRenderer object. - -@param horizontalAlignment One of the following SwingConstants: LEFT, RIGHT, or CENTER. -**/ - public VObjectHeaderRenderer (int horizontalAlignment) - { - this ("", horizontalAlignment); - } - - -/** -Constructs a VObjectHeaderRenderer object. - -@param text The text for the header -@param horizontalAlignment One of the following SwingConstants: LEFT, RIGHT, or CENTER. -**/ - public VObjectHeaderRenderer (String text, int horizontalAlignment) - { - super (text); - setHorizontalAlignment (horizontalAlignment); - setBorder (new CompoundBorder (new BevelBorder(BevelBorder.RAISED), new EmptyBorder (0,5,0,5))); - } - - - -/** -Renders the value for a table. - -@param table The table. -@param value The value. -@param selected true if the item is selected, false otherwise. -@param hasFocus true if the item has focus, false otherwise. -@param rowIndex The row index. -@param columnIndex The column index. -@return The rendered component. -**/ - public Component getTableCellRendererComponent (JTable table, - Object value, - boolean selected, - boolean hasFocus, - int rowIndex, - int columnIndex) - { - setText (value.toString ()); - return this; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VObjectListener.java b/cvsroot/src/com/ibm/as400/vaccess/VObjectListener.java deleted file mode 100644 index 7b6530da2..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VObjectListener.java +++ /dev/null @@ -1,61 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VObjectListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.util.EventListener; - - - -/** -The VObjectListener interface provides a listener interface for -receiving VObjectEvents. - -@see VObjectEvent -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public interface VObjectListener -extends EventListener -{ - - - -/** -Invoked when a system resource is changed. - -@param event The event. -**/ - abstract public void objectChanged (VObjectEvent event); - - - -/** -Invoked when a system resource is created. - -@param event The event. -**/ - abstract public void objectCreated (VObjectEvent event); - - - -/** -Invoked when a system resource is deleted. - -@param event The event. -**/ - abstract public void objectDeleted (VObjectEvent event); - - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VOutput.java b/cvsroot/src/com/ibm/as400/vaccess/VOutput.java deleted file mode 100644 index be7c56d12..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VOutput.java +++ /dev/null @@ -1,596 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VOutput.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.SpooledFile; -import com.ibm.as400.access.PrintObject; -import com.ibm.as400.access.QSYSObjectPathName; -import javax.swing.Icon; -import java.util.Calendar; - -/** -The VOutput class defines the representation of a -spooled file output on a system for use in various -models and panes in this package. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VOutput objects generate the following events: -

      -
    • ErrorEvent -
    • VObjectEvent -
    • WorkingEvent -
    - -@see com.ibm.as400.access.SpooledFile -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VOutput -implements VObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - -/** -Property identifier for the output name. -**/ - public static final Object OUTPUTNAME_PROPERTY = "Output name"; - -/** -Property identifier for the user specified data. -**/ - public static final Object USERSPECDATA_PROPERTY = "User-specified data"; - -/** -Property identifier for the name of the user of the job which produced the output. -**/ - public static final Object USER_PROPERTY = "User"; - -/** -Property identifier for the status of the output. -**/ - public static final Object STATUS_PROPERTY = "Status"; - -/** -Property identifier for the printer name. -**/ - public static final Object PRINTER_PROPERTY = "Printer"; - -/** -Property identifier for the number of pages per copy. -**/ - public static final Object PAGESPERCOPY_PROPERTY = "Pages per copy"; - -/** -Property identifier for the number of copies left. -**/ - public static final Object COPIESLEFT_PROPERTY = "Copies left"; - -/** -Property identifier for the date the output was created. -**/ - public static final Object DATE_PROPERTY = "Date created"; - -/** -Property identifier for the form type. -**/ - public static final Object FORMTYPE_PROPERTY = "Form type"; - -/** -Property identifier for the name of the job which produced the output. -**/ - public static final Object JOB_PROPERTY = "Job"; - -/** -Property identifier for the number of the job which produced the output. -**/ - public static final Object JOBNUMBER_PROPERTY = "Job number"; - -/** -Property identifier for the number of the output. -**/ - public static final Object NUMBER_PROPERTY = "Number"; - -/** -Property identifier for the output queue. -**/ - public static final Object OUTPUTQUEUE_PROPERTY = "Output queue"; - -/** -Property identifier for the output queue library. -**/ - public static final Object OUTPUTQUEUELIB_PROPERTY = "Output queue library"; - -/** -Property identifier for the priority of the output on the output queue. -**/ - public static final Object PRIORITY_PROPERTY = "Priority on output queue"; - -/** -Property identifier for the user comment. -**/ - public static final Object USERCOMMENT_PROPERTY = "User comment"; - - - // Static data. - private static final String description_ = ResourceLoader.getPrintText ("OUTPUT_DESCRIPTION"); - private static final Icon icon16_ = ResourceLoader.getIcon ("VOutput16.gif", description_); - private static final Icon icon32_ = ResourceLoader.getIcon ("VOutput32.gif", description_); - private static final String closedText_ = ResourceLoader.getPrintText ("CLOSED"); - private static final String heldText_ = ResourceLoader.getPrintText ("HELD"); - private static final String msgWaitingText_ = ResourceLoader.getPrintText ("MESSAGE_WAITING"); - private static final String openText_ = ResourceLoader.getPrintText ("OPEN"); - private static final String pendingText_ = ResourceLoader.getPrintText ("PENDING"); - private static final String printerText_ = ResourceLoader.getPrintText ("PRINTER"); - private static final String readyText_ = ResourceLoader.getPrintText ("READY"); - private static final String savedText_ = ResourceLoader.getPrintText ("SAVED"); - private static final String writingText_ = ResourceLoader.getPrintText ("WRITING"); - private static final String standardText_ = ResourceLoader.getPrintText ("STANDARD"); - private static final String jobValueText_ = ResourceLoader.getPrintText ("JOB_VALUE"); - private static final String notAssignedText_ = ResourceLoader.getPrintText ("NOT_ASSIGNED"); - private static final String groupText_ = ResourceLoader.getPrintText ("GROUP"); - private static Calendar calendar_ = Calendar.getInstance (); - - // private data. - private VAction[] actions_ = null; - private Integer actionsLock_ = new Integer (0); - private SpooledFile splF_ = null; - private VPrinterOutput parent_ = null; - private VPropertiesPane propertiesPane_ = null; - private Integer propertiesPaneLock_ = new Integer (0); - private Integer reloadLock_ = new Integer (0); - - // event support - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - -/** -Constructs a VOutput object. - -@param parent The parent. -@param spooledFile The spooled file. -**/ - public VOutput (VPrinterOutput parent, SpooledFile spooledFile) - { - if (spooledFile == null) - throw new NullPointerException ("spooledFile"); - - if (parent == null) - throw new NullPointerException ("parent"); - - parent_ = parent; - splF_ = spooledFile; - - // create the actions - actions_ = new VAction[8]; /* @A1C - changed from 7 to 8 */ - - actions_[0] = new OutputReplyAction (this, spooledFile); // reply - actions_[1] = new OutputHoldAction (this, spooledFile); // hold - actions_[2] = new OutputReleaseAction (this, spooledFile); // release - actions_[3] = new OutputPrintNextAction (this, spooledFile, parent); // print next - actions_[4] = new OutputSendAction (this, spooledFile); // send - actions_[5] = new OutputMoveAction (this, spooledFile, parent);// move - actions_[6] = new OutputDeleteAction (this, spooledFile, parent);// delete - actions_[7] = new OutputViewAction (this, spooledFile); // view @A1A - - // Listen to the actions - for (int i = 0; i< actions_.length; ++i) - { - actions_[i].addErrorListener (errorEventSupport_); - actions_[i].addVObjectListener (objectEventSupport_); - actions_[i].addWorkingListener (workingEventSupport_); - } // end for - - // create the properties pane and listen for the events - propertiesPane_ = new OutputPropertiesPane (this, spooledFile); - propertiesPane_.addErrorListener (errorEventSupport_); - propertiesPane_.addVObjectListener (objectEventSupport_); - propertiesPane_.addWorkingListener (workingEventSupport_); - } - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - -/** -Returns the list of actions that can be performed. -
      -
    • reply -
    • hold -
    • release -
    • print next -
    • send -
    • move -
    • delete -
    • view -
    - -@return The actions. -**/ - public synchronized VAction[] getActions () - { - // need to enable/disable the correct ones - try { - // retrieve the spooled file status - String status = splF_.getStringAttribute(PrintObject.ATTR_SPLFSTATUS).trim(); - - // reply action valid when status is message waiting - if (status.equals("*MESSAGE")) actions_[0].setEnabled(true); - else actions_[0].setEnabled(false); - - // hold action valid only when status is released - if (status.equals("*READY")) actions_[1].setEnabled(true); - else actions_[1].setEnabled(false); - - // release action valid only when status is held - if (status.equals("*HELD")) actions_[2].setEnabled(true); - else actions_[2].setEnabled(false); - - } // end try block - catch (Exception e) - { - errorEventSupport_.fireError (e); - } // end catch block - - return actions_; - } - - -/** -Returns the default action. - -@return Always null. There is no default action. -**/ - public VAction getDefaultAction () - { - return null; - } - - -/** -Returns the icon. - -@param size The icon size, either 16 or 32. If any other - value is given, then return the default of 16. -@param open This parameter has no effect. -@return The icon. -**/ - public Icon getIcon (int size, boolean open) - { - if (size == 32) - return icon32_; - else - return icon16_; - } - - -/** -Returns the properties pane. - -@return The properties pane. -**/ - public VPropertiesPane getPropertiesPane () - { - return propertiesPane_; - } - - -/** -Returns a property value. - -@param propertyIdentifier The property identifier. The choices are -
      -
    • NAME_PROPERTY -
    • DESCRIPTION_PROPERTY -
    • OUTPUTNAME_PROPERTY -
    • USERSPECDATA_PROPERTY -
    • USER_PROPERTY -
    • STATUS_PROPERTY -
    • PRINTER_PROPERTY -
    • PAGESPERCOPY_PROPERTY -
    • COPIESLEFT_PROPERTY -
    • DATE_PROPERTY -
    • FORMTYPE_PROPERTY -
    • JOB_PROPERTY -
    • JOBNUMBER_PROPERTY -
    • NUMBER_PROPERTY -
    • OUTPUTQUEUE_PROPERTY -
    • OUTPUTQUEUELIB_PROPERTY -
    • PRIORITY_PROPERTY -
    • USERCOMMENT_PROPERTY -
    -@return The property value, or null if the - property identifier is not recognized. -**/ - public synchronized Object getPropertyValue (Object propertyIdentifier) - { - try { - // Get the file name. - if (propertyIdentifier == NAME_PROPERTY) - return this; - - // Get the description. - else if (propertyIdentifier == DESCRIPTION_PROPERTY) - return description_; - - // Output name - if (propertyIdentifier == OUTPUTNAME_PROPERTY) - return this; - - // user-specified data - else if (propertyIdentifier == USERSPECDATA_PROPERTY) - return splF_.getStringAttribute(PrintObject.ATTR_USERDATA); - - // user - else if (propertyIdentifier == USER_PROPERTY) - return splF_.getJobUser(); - - // status - else if (propertyIdentifier == STATUS_PROPERTY) - { - String status = splF_.getStringAttribute(PrintObject.ATTR_SPLFSTATUS); - if (status.trim().equals("*CLOSED")) return closedText_; - if (status.trim().equals("*HELD")) return heldText_; - if (status.trim().equals("*MESSAGE")) return msgWaitingText_; - if (status.trim().equals("*OPEN")) return openText_; - if (status.trim().equals("*PENDING")) return pendingText_; - if (status.trim().equals("*PRINTER")) return printerText_; - if (status.trim().equals("*READY")) return readyText_; - if (status.trim().equals("*SAVED")) return savedText_; - if (status.trim().equals("*WRITING")) return writingText_; - return null; - } - - // printer - else if (propertyIdentifier == PRINTER_PROPERTY) - { - String ptrAssigned = splF_.getStringAttribute(PrintObject.ATTR_PRTASSIGNED).trim(); - if (ptrAssigned.equals("1")) // splf is assigned to a printer - return splF_.getStringAttribute(PrintObject.ATTR_PRINTER); - else if (ptrAssigned.equals("2")) // splf is assigned to multiple printers - return groupText_; - else // splf is not assigned - return notAssignedText_; - } - - // pages per copy - else if (propertyIdentifier == PAGESPERCOPY_PROPERTY) - return splF_.getIntegerAttribute(PrintObject.ATTR_PAGES); - - // copies left - else if (propertyIdentifier == COPIESLEFT_PROPERTY) - return splF_.getIntegerAttribute(PrintObject.ATTR_COPIESLEFT); - - // date - else if (propertyIdentifier == DATE_PROPERTY) - { - // return the string that represents the date - String date = splF_.getStringAttribute(PrintObject.ATTR_DATE); - String time = splF_.getStringAttribute(PrintObject.ATTR_TIME); - // @A2A - The code below used to substring (1,3) for the year, omitting - // the century field, and did not add 1900 to the result (base time). - // The code now substrings (0,3) and adds in 1900, thus - // producing the correct date. - calendar_.set((Integer.parseInt(date.substring(0,3)) + 1900),// year @A2C - Integer.parseInt(date.substring(3,5))-1,// month is zero based - Integer.parseInt(date.substring(5,7)), // day - Integer.parseInt(time.substring(0,2)), // hour - Integer.parseInt(time.substring(2,4)), // minute - Integer.parseInt(time.substring(4,6))); // second - - return calendar_.getTime(); - } - - // formtype - else if (propertyIdentifier == FORMTYPE_PROPERTY) - { - // we need to check for *STD - String formType = splF_.getStringAttribute(PrintObject.ATTR_FORMTYPE).trim(); - if (formType.equals("*STD")) return standardText_; - else return formType; - } - - // job - else if (propertyIdentifier == JOB_PROPERTY) - return splF_.getJobName(); - - // job number - else if (propertyIdentifier == JOBNUMBER_PROPERTY) - return splF_.getJobNumber(); - - // spooled file number - else if (propertyIdentifier == NUMBER_PROPERTY) - return new Integer(splF_.getNumber()); - - // output queue - else if (propertyIdentifier == OUTPUTQUEUE_PROPERTY) - { - // extract the IFS path name of the output queue - QSYSObjectPathName outQPath = new QSYSObjectPathName(splF_.getStringAttribute(PrintObject.ATTR_OUTPUT_QUEUE)); - // send back just the output queue name - return outQPath.getObjectName(); - } - - // output queue library - else if (propertyIdentifier == OUTPUTQUEUELIB_PROPERTY) - { - // extract the IFS path name of the output queue - QSYSObjectPathName outQPath = new QSYSObjectPathName(splF_.getStringAttribute(PrintObject.ATTR_OUTPUT_QUEUE)); - // send back just the output queue library - return outQPath.getLibraryName(); - } - - // priority - else if (propertyIdentifier == PRIORITY_PROPERTY) - { - // we need to check for *JOB - String outQPty = splF_.getStringAttribute(PrintObject.ATTR_OUTPTY).trim(); - if (outQPty.equals("*JOB")) return jobValueText_; - else return outQPty; - } - - // user comment - else if (propertyIdentifier == USERCOMMENT_PROPERTY) - return splF_.getStringAttribute(PrintObject.ATTR_USERCMT); - - // By default, return null. - return null; - } // end try block - - catch (Exception e) - { - errorEventSupport_.fireError (e); - } // end catch block - - // By default, return null. - return null; - } - - -// @A3A -/** -Returns the spooled file. - -@return The spooled file. -**/ - public SpooledFile getSpooledFile() - { - return splF_; - } - - - -/** -Loads information about the object from the system. -**/ - public synchronized void load () - { - workingEventSupport_.fireStartWorking(); - - try { - // just update the spooled file attributes - splF_.update(); - } // end try block - - catch (Exception e) - { - errorEventSupport_.fireError (e); - } // end catch block - - workingEventSupport_.fireStopWorking (); - } - - -/** -Returns the text. This is the name of the spooled file (output). - -@return The text, which is the name of the spooled file. -**/ - public String getText () - { - // return the name of the spooled file - return splF_.getName(); - } - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - -/** -Returns the string representation. -This is the spooled file (output) name, number, job user, -job number and job name, all separated with blanks. - -@return The string representation. -**/ - public String toString () - { - return splF_.getName().trim() + " " + - Integer.toString(splF_.getNumber()) + " " + - splF_.getJobUser().trim() + " " + - splF_.getJobNumber().trim() + " " + - splF_.getJobName().trim(); - } - - - -} // end VOutput class - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VOutput16.gif b/cvsroot/src/com/ibm/as400/vaccess/VOutput16.gif deleted file mode 100644 index 845cd02c3..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VOutput16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VOutput32.gif b/cvsroot/src/com/ibm/as400/vaccess/VOutput32.gif deleted file mode 100644 index 0813fafab..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VOutput32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VPane.java b/cvsroot/src/com/ibm/as400/vaccess/VPane.java deleted file mode 100644 index 1dc4d73a6..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VPane.java +++ /dev/null @@ -1,74 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Point; -import java.beans.PropertyVetoException; - - - -/** -The VPane interface defines information about and access -to the various panes in this package. -**/ -// -// Implementation note: -// -// The reasons for this class are: -// -// 1. To encapsulate all common interface stuff from the related -// panes. Originally, I just had all of the panes implement -// this class. But since this commonality is really only -// convenient from an internal implementation point of view, -// I did not want to make this public. I felt that that would -// would show that there is some cosmic connection between -// trees, details, etc., when there really is not. -// -interface VPane -{ - - - -/** -Returns the root. - -@return The root, or null if none. -**/ - public abstract VNode getRoot (); - - - -/** -Returns the object at a given point on the pane. - -@param point The point. -@return The object, or null if there is none. -**/ - public abstract VObject getObjectAt (Point point); - - - -/** -Sets the root. - -@param root The root, or null if none. -**/ - public abstract void setRoot (VNode root) - throws PropertyVetoException; - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VPrinter.java b/cvsroot/src/com/ibm/as400/vaccess/VPrinter.java deleted file mode 100644 index ae1ddaed3..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VPrinter.java +++ /dev/null @@ -1,1765 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VPrinter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -// Toolbox imports -import com.ibm.as400.access.AS400; // @A15A -import com.ibm.as400.access.Printer; -import com.ibm.as400.access.PrintObject; -import com.ibm.as400.access.QSYSObjectPathName; -import com.ibm.as400.access.RequestNotSupportedException; // @A15A -import com.ibm.as400.access.Trace; - -// swing imports -import javax.swing.Icon; -import javax.swing.table.DefaultTableColumnModel; -import javax.swing.table.TableColumn; -import javax.swing.table.TableColumnModel; -import javax.swing.tree.TreeNode; - -// Java awt imports -import java.awt.Component; - -// Java bean imports -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.PropertyVetoException; - - -// Java imports -import java.io.Serializable; -import java.net.URL; -import java.util.Enumeration; - - -/** -The VPrinter class defines the representation of a -system printer for use in various models and panes -in this package. - -

    A VPrinter object has no children. Its details -children are the spooled files (VOutput objects) -on the printer. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VPrinter objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • VObjectEvent -
    • WorkingEvent -
    - -@see com.ibm.as400.access.Printer -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ - - -public class VPrinter -implements VNode, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - -/** -Property identifier for the output queue. -**/ - public static final Object OUTPUTQUEUE_PROPERTY = "Output queue"; - -/** -Property identifier for the printer name. -**/ - public static final Object PRINTER_PROPERTY = "Printer"; - -/** -Property identifier for the status. -**/ - public static final Object STATUS_PROPERTY = "Status"; - - // Static data. - private static String description_ = ResourceLoader.getPrintText("AS400_PRINTER"); - private static Icon icon16_ = ResourceLoader.getIcon ("VPrinter16.gif", description_); - private static Icon icon32_ = ResourceLoader.getIcon ("VPrinter32.gif", description_); - private static final int supportedVRM_ = 0X00040100; // @A15A - private static boolean requestNotSupportedFired_ = false; // @A15A - - // private data. - private Printer printer_ = null; - - // @A9A - transient private VNode parent_; - transient private VPrinterOutput printerOutput_; - transient private VAction[] actions_; - transient private PrinterPropertiesPane propertiesPane_; - transient private boolean systemNotSupported_ = false; // @A15A - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private VObjectEventSupport objectEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - transient private WorkingEventSupport workingEventSupport_; - transient private VObjectListener_ objectListener_; //@A8A - - // Constants for Actions - private static final int HOLD_ACTION = 0; - private static final int RELEASE_ACTION = 1; - private static final int START_ACTION = 2; - private static final int STOP_ACTION = 3; - private static final int AVAILABLE_ACTION = 4; - private static final int UNAVAILABLE_ACTION = 5; - private static final int LAST_ACTION = UNAVAILABLE_ACTION; - - // MRI - private static String activeReaderText_ = null; - private static String activeText_; - private static String activeWriterText_; - private static String afterAllFilesPrintText_; - private static String afterCurFilePrintsText_; - private static String allText_; - private static String as36DisabledText_; - private static String as36EnabledText_; - private static String automaticText_; - private static String availableText_; - private static String availablePendingText_; - private static String beingServicedText_; - private static String connectPendingText_; - private static String damagedText_; - private static String deviceDefaultText_; - private static String diagnosticModeText_; - private static String endedText_; - private static String failedReaderText_; - private static String failedText_; - private static String failedWriterText_; - private static String fileDefaultText_; - private static String formsText_; - private static String heldText_; - private static String holdPendingText_; - private static String lockedText_; - private static String messageWaitingText_; - private static String noText_; - private static String onJobQueueText_; - private static String onlyFirstFileText_; - private static String poweredOffText_; - private static String poweredOffNotAvailText_; - private static String printingText_; - private static String recoveryCancelledText_; - private static String recoveryPendingText_; - private static String releasedText_; - private static String signonDisplayText_; - private static String standardText_; - private static String startedText_; - private static String stopPendingText_; - private static String stoppedText_; - private static String unavailableText_; - private static String unavailablePendingText_; - private static String unknownText_; - private static String unusableText_; - private static String variedOffText_; - private static String variedOnText_; - private static String varyOffPendingText_; - private static String varyOnPendingText_; - private static String waitingForOutQText_; - private static String waitingForPrinterText_; - private static String waitingOnMessageText_; - private static String waitingOnJobQueueQSPL_; - private static String yesText_; - - // Overall status values - static final int OVERALLSTATUS_UNAVAILABLE = 1; - static final int OVERALLSTATUS_POWEREDOFFNOTAVAILALBE = 2; - static final int OVERALLSTATUS_STOPPED = 3; - static final int OVERALLSTATUS_MESSAGEWAITING = 4; - static final int OVERALLSTATUS_HELD = 5; - static final int OVERALLSTATUS_STOPPENDING = 6; - static final int OVERALLSTATUS_HOLDPENDING = 7; - static final int OVERALLSTATUS_WAITINGFORPRINTER = 8; - static final int OVERALLSTATUS_WAITINGTOSTART = 9; - static final int OVERALLSTATUS_PRINTING = 10; - static final int OVERALLSTATUS_WAITINGFOROUTQ = 11; - static final int OVERALLSTATUS_CONNECTPENDING = 12; - static final int OVERALLSTATUS_POWEREDOFF = 13; - static final int OVERALLSTATUS_UNUSABLE = 14; - static final int OVERALLSTATUS_BEINGSERVICED = 15; - static final int OVERALLSTATUS_UNKNOWN = 999; - - // Device status values - static final int DEVICESTATUS_VARIEDOFF = 0; - static final int DEVICESTATUS_AS36DISABLED = 5; - static final int DEVICESTATUS_VARYOFFPENDING = 10; - static final int DEVICESTATUS_VARYONPENDING = 20; - static final int DEVICESTATUS_VARIEDON = 30; - static final int DEVICESTATUS_CONNECTPENDING = 40; - static final int DEVICESTATUS_SIGNONDISPLAY = 50; - static final int DEVICESTATUS_ACTIVE = 60; - static final int DEVICESTATUS_AS36ENABLED = 62; - static final int DEVICESTATUS_ACTIVEREADER = 63; - static final int DEVICESTATUS_ACTIVEWRITER = 66; - static final int DEVICESTATUS_HELD = 70; - static final int DEVICESTATUS_POWEREDOFF = 75; - static final int DEVICESTATUS_RECOVERYPENDING = 80; - static final int DEVICESTATUS_RECOVERYCANCELLED = 90; - static final int DEVICESTATUS_FAILED = 100; - static final int DEVICESTATUS_FAILED_READER = 103; - static final int DEVICESTATUS_FAILED_WRITER = 106; - static final int DEVICESTATUS_DIAGNOSTICMODE = 110; - static final int DEVICESTATUS_DAMAGED = 111; - static final int DEVICESTATUS_LOCKED = 112; - static final int DEVICESTATUS_UNKNOWN = 113; - - // Drawer separator values - static final int DRAWERSEP_FILE = -1; - static final int DRAWERSEP_DEVD = -2; - - // Server strings - static final String ENDString_ = "END"; - static final String HELDString_ = "HELD"; - static final String HLDString_ = "HLD"; - static final String JOBQString_ = "JOBQ"; - static final String MSGWString_ = "MSGW"; - static final String RELEASEDString_ = "RELEASED"; - static final String STRString_ = "STR"; - static final String splatAFPDSString_ = "*AFPDS"; - static final String splatALLString_ = "*ALL"; - static final String splatCURRENTString_ = "*CURRENT"; - static final String splatFILEString_ = "*FILE"; - static final String splatFILEENDString_ = "*FILEEND"; - static final String splatFIRSTString_ = "*FIRST"; - static final String splatFORMSString_ = "*FORMS"; - static final String splatIPDSString_ = "*IPDS"; - static final String splatNORDYFString_ = "*NORDYF"; - static final String splatNOString_ = "*NO"; - static final String splatSCSString_ = "*SCS"; - static final String splatSTDString_ = "*STD"; - static final String splatUSERASCIIString_ = "*USERASCII"; - static final String splatWTRString_ = "*WTR"; - static final String splatYESString_ = "*YES"; - - // Printer device type strings - static final String ASCIIString_ = "ASCII"; - static final String AFPDSString_ = "AFPDS"; - static final String IPDSString_ = "IPDS"; - static final String SCSString_ = "SCS"; - -/** -Constructs a VPrinter object. -**/ -// -// This constructor is provided for visual application -// builders that support JavaBeans. It is not -// intended for use by application programmers. -// - public VPrinter() //@A2C - { - printer_ = new Printer(); //@A10A - - // initialize transient data - parent_ = null; - printerOutput_ = new VPrinterOutput(true); // @A7C - initializeTransient(); // @A9A - } - -/** -Constructs a VPrinter object. - -@param printer The printer. -**/ - public VPrinter( Printer printer ) //@A2C - { - if (printer == null) - throw new NullPointerException ("printer"); - - printer_ = printer; - - // @A15A - try - { - AS400 system = printer_.getSystem(); - int systemVRM = system.getVRM(); - if (systemVRM < supportedVRM_) - { - systemNotSupported_ = true; - } - } - catch (Exception e) { - if (errorEventSupport_ != null) { - errorEventSupport_.fireError (e); - } - } - - // initialize transient data - parent_ = null; - printerOutput_ = new VPrinterOutput(printer.getSystem(),true); // @A7C // Set the new outq name - - initializeTransient(); // @A9A - } - -/** -Constructs a VPrinter object. - -@param parent The parent. -@param printer The printer. -**/ - public VPrinter( VNode parent, Printer printer ) //@A2C - { - if (parent == null) - throw new NullPointerException ("parent"); - if (printer == null) - throw new NullPointerException ("printer"); - - printer_ = printer; - - // @A15A - try - { - AS400 system = printer_.getSystem(); - int systemVRM = system.getVRM(); - if (systemVRM < supportedVRM_) - { - systemNotSupported_ = true; - } - } - catch (Exception e) { - if (errorEventSupport_ != null) { - errorEventSupport_.fireError (e); - } - } - - // initialize transient data - parent_ = parent; - printerOutput_ = new VPrinterOutput(printer.getSystem(),true); // @A7C - initializeTransient(); // @A9A - } - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - // Used by VPrinterOutput - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - // Used by VPrinterOutput - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - -/** -Returns the children of the node. - -@return An empty enumeration. -**/ - public Enumeration children () - { - return new Enumeration () { - public boolean hasMoreElements() { return false;} - public Object nextElement() { return null; } - }; - } - - -/** -Returns the list of actions that can be performed. -
      -
    • hold -
    • release -
    • start -
    • stop -
    • make available -
    • make unavailable -
    - -@return The actions. -**/ - public VAction[] getActions () - { - reloadActions (); - - return actions_; - } - -/** -Indiciates if the node allows children. - -@return Always false. -**/ - public boolean getAllowsChildren () - { - return false; - } - -/** -Returns the child node at the specified index. - -@param index The index. - -@return Always null. -**/ - public TreeNode getChildAt (int index) - { - return null; - } - -/** -Returns the number of children. - -@return Always 0. -**/ - public int getChildCount () - { - return 0; - } - -/** -Returns the default action. - -@return Always null. There is no default action. -**/ - public VAction getDefaultAction () - { - return null; - } - -/** -Returns the child for the details at the specified index. -The details children are the spooled files (VOutput objects) -on the printer. - -@param index The index. -@return The child, or null if the index is not - valid. -**/ - public VObject getDetailsChildAt (int index) - { - return printerOutput_.getDetailsChildAt(index); - } - -/** -Returns the number of children for the details. -The details children are the spooled files (VOutput objects) -on the printer. - -@return The number of children for the details. -**/ - public int getDetailsChildCount () - { - return printerOutput_.getDetailsChildCount(); - } - - -/** -Returns the table column model to use in the details -when representing the children. This column model -describes the details values for the children. -The details children are the spooled files (VOutput objects) -on the printer. - -@return The details column model. -**/ - public TableColumnModel getDetailsColumnModel () - { - return printerOutput_.getDetailsColumnModel(); - } - -/** -Returns the index of the specified child for the details. -The details children are the spooled files (VOutput objects) -on the printer. - -@param child The details child. -@return The index, or -1 if the child is not found - in the details. -**/ - public int getDetailsIndex (VObject child) - { - return printerOutput_.getDetailsIndex(child); - } - -/** -Returns the icon. - -@param size The icon size, either 16 or 32. If any other - value is given, then return the default of 16. -@param open This parameter has no effect. -@return The icon. -**/ - public Icon getIcon (int size, boolean open) - { - if (size == 32) - return icon32_; - else - return icon16_; - } - -/** -Returns the index of the specified child. - -@param child The child. -@return Always -1. -**/ - public int getIndex (TreeNode child) - { - return -1; - } - -/** -Returns the parent node. - -@return The parent node, or null if there is no parent. -**/ - public TreeNode getParent () - { - return parent_; - } - -/** -Returns the printer associated with this object. - -@return The Printer class that is associated with this object. -**/ -public Printer getPrinter() //@A6A -{ - return printer_; //@A6A -} - -/** -Returns the attribute of the printer in a String. - -@return The attribute of the printer in a String. -**/ -String getPrinterAttribute(int attributeID) -{ - Integer attrInteger; - String attrString; - - loadStrings(); - - if ((systemNotSupported_ == true) && - (requestNotSupportedFired_ == true)) // @A16A - { - switch (attributeID) - { - case PrintObject.ATTR_ALIGNFORMS: - case PrintObject.ATTR_ALWDRTPRT: - case PrintObject.ATTR_BTWNCPYSTS: - case PrintObject.ATTR_BTWNFILESTS: - case PrintObject.ATTR_CHANGES: - case PrintObject.ATTR_DEVSTATUS: - case PrintObject.ATTR_ENDPNDSTS: - case PrintObject.ATTR_FILESEP: - case PrintObject.ATTR_FORMTYPE: - case PrintObject.ATTR_FORMTYPEMSG: - case PrintObject.ATTR_HELDSTS: - case PrintObject.ATTR_HOLDPNDSTS: - case PrintObject.ATTR_JOBUSER: - case PrintObject.ATTR_ONJOBQSTS: - case PrintObject.ATTR_OUTQSTS: - case PrintObject.ATTR_OVERALLSTS: - case PrintObject.ATTR_PRTDEVTYPE: - case PrintObject.ATTR_SPOOLFILE: - case PrintObject.ATTR_SPLFNUM: - case PrintObject.ATTR_STARTEDBY: - case PrintObject.ATTR_USERDATA: - case PrintObject.ATTR_WRTNGSTS: - case PrintObject.ATTR_WTNGDATASTS: - case PrintObject.ATTR_WTNGDEVSTS: - case PrintObject.ATTR_WTNGMSGSTS: - case PrintObject.ATTR_WTRJOBNAME: - case PrintObject.ATTR_WTRJOBNUM: - case PrintObject.ATTR_WTRJOBSTS: - case PrintObject.ATTR_WTRJOBUSER: - case PrintObject.ATTR_WTRAUTOEND: - case PrintObject.ATTR_WTRSTRTD: - return ""; - } - } - - try { - switch (attributeID) - { - case PrintObject.ATTR_AFP: - case PrintObject.ATTR_ALWDRTPRT: - attrString = printer_.getStringAttribute(attributeID); //@A4C - if (attrString == null) - { - return ""; - } - else // @A4A - { - attrString.trim(); - if (attrString.compareTo(splatYESString_) == 0) - { - return yesText_; - } - else if (attrString.compareTo(splatNOString_) == 0) - { - return noText_; - } - else - { - return ""; - } - } - case PrintObject.ATTR_ALIGNFORMS: - attrString = printer_.getStringAttribute(attributeID); //@A4C - if (attrString == null) - { - return ""; - } - else // @A4A - { - attrString.trim(); - if (attrString.compareTo(splatFILEString_) == 0) - { - return fileDefaultText_; - } - else if (attrString.compareTo(splatFIRSTString_) == 0) - { - return onlyFirstFileText_; - } - else if (attrString.compareTo(splatWTRString_) == 0) - { - return automaticText_; - } - else - { - return ""; - } - } - case PrintObject.ATTR_CHANGES: - attrString = printer_.getStringAttribute(attributeID); //@A4C - if (attrString == null) - { - return ""; - } - else // @A4A - { - attrString.trim(); - if (attrString.compareTo(splatNORDYFString_) == 0) - { - return afterCurFilePrintsText_; - } - else if (attrString.compareTo(splatFILEENDString_) == 0) - { - return afterAllFilesPrintText_; - } - else - { - return ""; - } - } - case PrintObject.ATTR_DEVSTATUS: - attrInteger = printer_.getIntegerAttribute(attributeID); // @A5C - if (attrInteger == null) // @A5A - { - return ""; - } - else - { - switch (attrInteger.intValue()) - { - case DEVICESTATUS_VARIEDOFF: - return unavailableText_; - case DEVICESTATUS_AS36DISABLED: // Op Nav doesn't show - return as36DisabledText_; - case DEVICESTATUS_VARYOFFPENDING: - return unavailablePendingText_; - case DEVICESTATUS_VARYONPENDING: - return availablePendingText_; - case DEVICESTATUS_VARIEDON: - return availableText_; - case DEVICESTATUS_CONNECTPENDING: - return connectPendingText_; - case DEVICESTATUS_SIGNONDISPLAY: // Op Nav doesn't show - return signonDisplayText_; - case DEVICESTATUS_ACTIVE: - return activeText_; - case DEVICESTATUS_AS36ENABLED: // Op Nav doesn't show - return as36EnabledText_; - case DEVICESTATUS_ACTIVEREADER: // Op Nav doesn't show - return activeReaderText_; - case DEVICESTATUS_ACTIVEWRITER: - return activeWriterText_; - case DEVICESTATUS_HELD: - return heldText_; - case DEVICESTATUS_POWEREDOFF: - return poweredOffText_; - case DEVICESTATUS_RECOVERYPENDING: - return recoveryPendingText_; - case DEVICESTATUS_RECOVERYCANCELLED: - return recoveryCancelledText_; - case DEVICESTATUS_FAILED: - return unusableText_; - case DEVICESTATUS_FAILED_READER: // Op Nav doesn't show - return failedReaderText_; - case DEVICESTATUS_FAILED_WRITER: - return failedWriterText_; - case DEVICESTATUS_DIAGNOSTICMODE: - return beingServicedText_; - case DEVICESTATUS_DAMAGED: - return damagedText_; - case DEVICESTATUS_LOCKED: - return lockedText_; - case DEVICESTATUS_UNKNOWN: - return unknownText_; - default: - return ""; - } - } - case PrintObject.ATTR_DRWRSEP: - attrInteger = printer_.getIntegerAttribute(attributeID); // @A5C - if (attrInteger == null) // @A5A - { - return ""; - } - else - { - switch (attrInteger.intValue()) - { - case DRAWERSEP_FILE: - return fileDefaultText_; - case DRAWERSEP_DEVD: - return deviceDefaultText_; - case 1: - case 2: - case 3: - return attrInteger.toString(); - default: - return ""; - } - } - case PrintObject.ATTR_FILESEP: - attrInteger = printer_.getIntegerAttribute(attributeID); // @A5C - if (attrInteger == null) // @A5A - { - return ""; - } - else if (attrInteger.intValue() == -1) - { - return fileDefaultText_; - } - else - { - return attrInteger.toString(); - } - case PrintObject.ATTR_FORMTYPE: - attrString = printer_.getStringAttribute(attributeID); //@A4C - if (attrString == null) - { - return ""; - } - else // @A4A - { - attrString.trim(); - if (attrString.compareTo(splatALLString_) == 0) - { - return allText_; - } - else if (attrString.compareTo(splatFORMSString_) == 0) - { - return formsText_; - } - else if (attrString.compareTo(splatSTDString_) == 0) - { - return standardText_; - } - else - { - return ""; - } - } - case PrintObject.ATTR_OUTQSTS: - attrString = printer_.getStringAttribute(attributeID); //@A4C - if (attrString == null) - { - return ""; - } - else // @A4A - { - attrString.trim(); - if (attrString.compareTo(RELEASEDString_) == 0) - { - return releasedText_; - } - else if (attrString.compareTo(HELDString_) == 0) - { - return heldText_; - } - else - { - return ""; - } - } - case PrintObject.ATTR_OVERALLSTS: - attrInteger = printer_.getIntegerAttribute(attributeID); // @A5C - if (attrInteger == null) // @A5A - { - return ""; - } - else - { - switch (attrInteger.intValue()) - { - case OVERALLSTATUS_UNAVAILABLE: - return unavailableText_; - case OVERALLSTATUS_POWEREDOFFNOTAVAILALBE: - return poweredOffNotAvailText_; - case OVERALLSTATUS_STOPPED: - return stoppedText_; - case OVERALLSTATUS_MESSAGEWAITING: - return messageWaitingText_; - case OVERALLSTATUS_HELD: - return heldText_; - case OVERALLSTATUS_STOPPENDING: - return stopPendingText_; - case OVERALLSTATUS_HOLDPENDING: - return holdPendingText_; - case OVERALLSTATUS_WAITINGFORPRINTER: - return waitingForPrinterText_; - case OVERALLSTATUS_WAITINGTOSTART: - return waitingOnJobQueueQSPL_; - case OVERALLSTATUS_PRINTING: - return printingText_; - case OVERALLSTATUS_WAITINGFOROUTQ: - return waitingForOutQText_; - case OVERALLSTATUS_CONNECTPENDING: - return connectPendingText_; - case OVERALLSTATUS_POWEREDOFF: - return poweredOffText_; - case OVERALLSTATUS_UNUSABLE: - return unusableText_; - case OVERALLSTATUS_BEINGSERVICED: - return beingServicedText_; - case OVERALLSTATUS_UNKNOWN: - return unknownText_; - default: - return ""; - } - } - case PrintObject.ATTR_DEVTYPE: - case PrintObject.ATTR_PRTDEVTYPE: - attrString = printer_.getStringAttribute(attributeID); //@A4C - if (attrString == null) - { - return ""; - } - else // @A4A - { - attrString.trim(); - if (attrString.compareTo(splatAFPDSString_) == 0) - { - return AFPDSString_; - } - else if (attrString.compareTo(splatIPDSString_) == 0) - { - return IPDSString_; - } - else if (attrString.compareTo(splatSCSString_) == 0) - { - return SCSString_; - } - else if (attrString.compareTo(splatUSERASCIIString_) == 0) - { - return ASCIIString_; - } - else - { - return attrString; - } - } - case PrintObject.ATTR_WTRAUTOEND: - attrString = printer_.getStringAttribute(attributeID); //@A4C - if (attrString == null) - { - return ""; - } - else // @A4A - { - attrString.trim(); - if (attrString.compareTo(splatYESString_) == 0) - { - return yesText_; - } - else if (attrString.compareTo(splatNOString_) == 0) - { - return noText_; - } - else if (attrString.compareTo(splatNORDYFString_) == 0) // @A14C - { - return afterCurFilePrintsText_; // ??? - } - else if (attrString.compareTo(splatFILEENDString_) == 0) - { - return afterAllFilesPrintText_; // ??? - } - else - { - return ""; - } - } - case PrintObject.ATTR_WTRJOBSTS: - attrString = printer_.getStringAttribute(attributeID); //@A4C - if (attrString == null) - { - return ""; - } - else // @A4A - { - attrString = attrString.trim(); - if (attrString.compareTo(ENDString_) == 0) - { - return endedText_; - } - else if (attrString.compareTo(HLDString_) == 0) - { - return heldText_; - } - else if (attrString.compareTo(JOBQString_) == 0) - { - return onJobQueueText_; - } - else if (attrString.compareTo(MSGWString_) == 0) - { - return waitingOnMessageText_; - } - else if (attrString.compareTo(STRString_) == 0) - { - return startedText_; - } - else - { - return ""; - } - } - default: - // @A4A - attrString = printer_.getStringAttribute(attributeID); - if (attrString == null) - { - return ""; - } - else - { - return attrString.trim(); - } - } - } - catch (RequestNotSupportedException e) { // @A15A - if (Trace.isTraceOn()) { - Trace.log(Trace.ERROR,"VPrinter::getPrinterDeviceStatus failed getting attribute"); - } - if (systemNotSupported_ == true) - { - if (requestNotSupportedFired_ == false) - { - errorEventSupport_.fireError (e); - requestNotSupportedFired_ = true; - } - } - else - { - errorEventSupport_.fireError (e); - } - } - catch (Exception e) { - if (Trace.isTraceOn()) { - Trace.log(Trace.ERROR,"VPrinter::getPrinterAttribute failed getting attribute ",attributeID); - } - errorEventSupport_.fireError (e); - } - return ""; -} - -int getPrinterDeviceStatus() -{ - Integer attrInteger; - - if ((systemNotSupported_ == true) && - (requestNotSupportedFired_ == true)) // @A16A - { - return DEVICESTATUS_UNKNOWN; - } - - try { - attrInteger = printer_.getIntegerAttribute(PrintObject.ATTR_DEVSTATUS); // @A5C - if (attrInteger != null) // @A5A - { - return attrInteger.intValue(); - } - } - catch (RequestNotSupportedException e) { // @A15A - if (Trace.isTraceOn()) { - Trace.log(Trace.ERROR,"VPrinter::getPrinterDeviceStatus failed getting attribute"); - } - if (systemNotSupported_ == true) - { - if (requestNotSupportedFired_ == false) - { - errorEventSupport_.fireError (e); - requestNotSupportedFired_ = true; - } - } - else - { - errorEventSupport_.fireError (e); - } - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - return DEVICESTATUS_UNKNOWN; -} - -/** -Returns the output queue of the printer in a String. - -@return The output queue of the printer in a String. -**/ -String getPrinterOutputQueue() -{ - String attrString; - - if ((systemNotSupported_ == true) && - (requestNotSupportedFired_ == true)) // @A16A - { - return ""; - } - - try { - attrString = printer_.getStringAttribute(PrintObject.ATTR_OUTPUT_QUEUE); - if (attrString != null) // @A7A - { - QSYSObjectPathName outQPath = new QSYSObjectPathName(attrString); - if (outQPath != null) // @A7A - { - attrString = outQPath.getObjectName(); // @A4A - if (attrString != null) // @A7A - { - return attrString.trim(); - } - } - } - } - catch (RequestNotSupportedException e) { // @A15A - if (Trace.isTraceOn()) { - Trace.log(Trace.ERROR,"VPrinter::getPrinterOutputQueue failed getting attribute"); - } - if (systemNotSupported_ == true) - { - if (requestNotSupportedFired_ == false) - { - errorEventSupport_.fireError (e); - requestNotSupportedFired_ = true; - } - } - else - { - errorEventSupport_.fireError (e); - } - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - return ""; -} - -/** -Returns the output queue library of the printer in a String. - -@return The output queue library of the printer in a String. -**/ -String getPrinterOutputQueueLib() -{ - String attrString; - - if ((systemNotSupported_ == true) && - (requestNotSupportedFired_ == true)) // @A16A - { - return ""; - } - - try { - attrString = printer_.getStringAttribute(PrintObject.ATTR_OUTPUT_QUEUE); - if (attrString != null) // @A7A - { - QSYSObjectPathName outQPath = new QSYSObjectPathName(attrString); - if (outQPath != null) // @A7A - { - attrString = outQPath.getLibraryName(); // @A4A - if (attrString != null) // @A7A - { - return attrString.trim(); - } - } - } - } - catch (RequestNotSupportedException e) { // @A15A - if (Trace.isTraceOn()) { - Trace.log(Trace.ERROR,"VPrinter::getPrinterOutputQueueLib failed getting attribute "); - } - if (systemNotSupported_ == true) - { - if (requestNotSupportedFired_ == false) - { - errorEventSupport_.fireError (e); - requestNotSupportedFired_ = true; - } - } - else - { - errorEventSupport_.fireError (e); - } - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - return ""; -} - -int getPrinterOverallStatus() -{ - Integer attrInteger; - - if ((systemNotSupported_ == true) && - (requestNotSupportedFired_ == true)) // @A16A - { - return OVERALLSTATUS_UNKNOWN; - } - - try { - attrInteger = printer_.getIntegerAttribute(PrintObject.ATTR_OVERALLSTS); // @A5C - if (attrInteger != null) // @A5C - { - return attrInteger.intValue(); - } - } - catch (RequestNotSupportedException e) { // @A15A - if (Trace.isTraceOn()) { - Trace.log(Trace.ERROR,"VPrinter::getPrinterOverallStatus failed getting attribute "); - } - if (systemNotSupported_ == true) - { - if (requestNotSupportedFired_ == false) - { - errorEventSupport_.fireError (e); - requestNotSupportedFired_ = true; - } - } - else - { - errorEventSupport_.fireError (e); - } - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - return OVERALLSTATUS_UNKNOWN; -} - -/** -Returns the properties pane. - -@return The properties pane. -**/ - public VPropertiesPane getPropertiesPane () - { - return propertiesPane_; - } - - -/** -Returns a property value. - -@param propertyIdentifier The property identifier. The choices are -
      -
    • PRINTER_PROPERTY -
    • STATUS_PROPERTY -
    • DESCRIPTION_PROPERTY -
    • OUTPUTQUEUE_PROPERTY -
    -@return The property value, or null if the - property identifier is not recognized. -**/ - - public Object getPropertyValue (Object propertyIdentifier) - { - try { - if (propertyIdentifier == PRINTER_PROPERTY) - return this; - - else if (propertyIdentifier == STATUS_PROPERTY) - { - return getPrinterAttribute(PrintObject.ATTR_OVERALLSTS); - } - - else if (propertyIdentifier == DESCRIPTION_PROPERTY) - { - return getPrinterAttribute(PrintObject.ATTR_DESCRIPTION); - } - else if (propertyIdentifier == OUTPUTQUEUE_PROPERTY) - { - return getPrinterOutputQueue(); - } - else - { - return null; //@A10C - } - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - return null; //@A10C - - } - -/** -Returns the text. This is the name of the printer. - -@return The text. -**/ - public String getText () - { - return printer_.getName(); - } - -/** -Indicates if the node is a leaf. - -@return Always true. -**/ - public boolean isLeaf () - { - return true; - } - -/** -Indicates if the details children are sortable. - -@return Always true. -**/ - public boolean isSortable () - { - return true; - } - -/** -Initializes the transient data. -**/ - private void initializeTransient () // @A9A - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - objectEventSupport_ = new VObjectEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - objectListener_ = new VObjectListener_(); //@A8A - - printerOutput_.addErrorListener (errorEventSupport_); //@A6A - printerOutput_.addVObjectListener (objectEventSupport_); //@A6A - printerOutput_.addWorkingListener (workingEventSupport_); //@A6A - printerOutput_.addPropertyChangeListener (propertyChangeSupport_); //@A6A - printerOutput_.addVetoableChangeListener (vetoableChangeSupport_); //@A6A - - actions_ = new VAction[LAST_ACTION + 1]; - actions_[HOLD_ACTION] = new PrinterHoldAction (this, printer_); - actions_[RELEASE_ACTION] = new PrinterReleaseAction (this, printer_); - actions_[START_ACTION] = new PrinterStartAction (this, printer_); - actions_[STOP_ACTION] = new PrinterStopAction (this, printer_); - actions_[AVAILABLE_ACTION] = new PrinterAvailableAction (this, printer_); - actions_[UNAVAILABLE_ACTION]= new PrinterUnavailableAction (this, printer_); - - // Listen to the actions - for (int i = 0; i< actions_.length; ++i) - { - actions_[i].addErrorListener (errorEventSupport_); - actions_[i].addVObjectListener (objectEventSupport_); - actions_[i].addVObjectListener (objectListener_); //@A8A - actions_[i].addWorkingListener (workingEventSupport_); - } // end for - - // set printerOuput filters so that properties pane appears correct @A13A - try - { - printerOutput_.setUserFilter(splatCURRENTString_); - printerOutput_.setFormTypeFilter(splatALLString_); - printerOutput_.setUserDataFilter(splatALLString_); - - if ((printer_ != null) && - (systemNotSupported_ == false)) // @A16A - { - String outqPath = printer_.getStringAttribute(PrintObject.ATTR_OUTPUT_QUEUE); - if (outqPath != null) - { - outqPath = outqPath.toUpperCase(); - printerOutput_.setQueueFilter(outqPath); - } - } - } - catch (RequestNotSupportedException e) { // @A15A - if (Trace.isTraceOn()) { - Trace.log(Trace.ERROR,"VPrinter::getPrinterOutputQueueLib failed getting attribute "); - } - if (systemNotSupported_ == true) - { - if (requestNotSupportedFired_ == false) - { - errorEventSupport_.fireError (e); - } - } - else - { - errorEventSupport_.fireError (e); - } - } - catch (Exception e) - { - errorEventSupport_.fireError (e); - } - - // Initialize the properties pane. - propertiesPane_ = new PrinterPropertiesPane(this,printerOutput_); - propertiesPane_.addErrorListener (errorEventSupport_); //@A3A - propertiesPane_.addVObjectListener (objectEventSupport_); //@A3A @A6D - propertiesPane_.addWorkingListener (workingEventSupport_); //@A3A @A6D - - } - -/** -Loads information about the object from the system. A printer must be -specified either on construction or from a call to setPrinter() inorder -to get information about the object from the system. -**/ - public void load () - { - try - { - // First check to see if the queue filter has been set. If not, - // set it. - if(printerOutput_.getQueueFilter().equals("")) - { - String outqPath = printer_.getStringAttribute(PrintObject.ATTR_OUTPUT_QUEUE); //@A6A - if (outqPath != null) // @A7A - { - outqPath = outqPath.toUpperCase(); //@A6C - printerOutput_.setQueueFilter(outqPath); //@A6C - } - } - - // if queue filter not set don't load printer output - if(!(printerOutput_.getQueueFilter().equals(""))) // @A7A @A8C - { - // just update the printer attributes - printer_.update(); - printerOutput_.load(); - } - } - catch (Exception e) - { - errorEventSupport_.fireError (e); - } // end catch block - } - -/* Loads the MRI strings once for the object during the getComponent() method -*/ - private synchronized void loadStrings() - { - if (activeReaderText_ == null) - { - try { - activeReaderText_ = ResourceLoader.getPrintText("ACTIVE_READER"); - activeText_ = ResourceLoader.getPrintText("ACTIVE"); - activeWriterText_ = ResourceLoader.getPrintText("ACTIVE_WRITER"); - afterAllFilesPrintText_ = ResourceLoader.getPrintText("AFTER_ALL_FILES_PRINT"); - afterCurFilePrintsText_ = ResourceLoader.getPrintText("AFTER_CURRENT_FILE_PRINTS"); - allText_ = ResourceLoader.getPrintText("ALL"); - as36DisabledText_ = ResourceLoader.getPrintText("AS36_DISABLED"); - as36EnabledText_ = ResourceLoader.getPrintText("AS36_ENABLED"); - automaticText_ = ResourceLoader.getPrintText("AUTOMATIC"); - availableText_ = ResourceLoader.getPrintText("AVAILABLE"); - availablePendingText_ = ResourceLoader.getPrintText("AVAILABLE_PENDING"); - beingServicedText_ = ResourceLoader.getPrintText("BEING_SERVICED"); - connectPendingText_ = ResourceLoader.getPrintText("CONNECT_PENDING"); - damagedText_ = ResourceLoader.getPrintText("DAMAGED"); - deviceDefaultText_ = ResourceLoader.getPrintText("DEVICE_DEFAULT"); - diagnosticModeText_ = ResourceLoader.getPrintText("DIAGNOSTIC_MODE"); - endedText_ = ResourceLoader.getPrintText("ENDED"); - failedReaderText_ = ResourceLoader.getPrintText("FAILED_READER"); - failedText_ = ResourceLoader.getPrintText("FAILED"); - failedWriterText_ = ResourceLoader.getPrintText("FAILED_WRITER"); - fileDefaultText_ = ResourceLoader.getPrintText("FILE_DEFAULT"); - formsText_ = ResourceLoader.getPrintText("FORMS"); - heldText_ = ResourceLoader.getPrintText("HELD"); - holdPendingText_ = ResourceLoader.getPrintText("HOLD_PENDING"); - lockedText_ = ResourceLoader.getPrintText("LOCKED"); - messageWaitingText_ = ResourceLoader.getPrintText("MESSAGE_WAITING"); - noText_ = ResourceLoader.getPrintText("NO"); - onJobQueueText_ = ResourceLoader.getPrintText("ON_JOB_QUEUE"); - onlyFirstFileText_ = ResourceLoader.getPrintText("FILE_FORM_ALIGNMENT"); - poweredOffText_ = ResourceLoader.getPrintText("POWERED_OFF"); - poweredOffNotAvailText_ = ResourceLoader.getPrintText("POWERED_OFF_NOT_AVAILABLE"); - printingText_ = ResourceLoader.getPrintText("PRINTING"); - recoveryCancelledText_ = ResourceLoader.getPrintText("RECOVERY_CANCELLED"); - recoveryPendingText_ = ResourceLoader.getPrintText("RECOVERY_PENDING"); - releasedText_ = ResourceLoader.getPrintText("RELEASED"); - signonDisplayText_ = ResourceLoader.getPrintText("SIGNON_DISPLAY"); - standardText_ = ResourceLoader.getPrintText("STANDARD"); - startedText_ = ResourceLoader.getPrintText("STARTED"); - stopPendingText_ = ResourceLoader.getPrintText("STOP_PENDING"); - stoppedText_ = ResourceLoader.getPrintText("STOPPED"); - unavailableText_ = ResourceLoader.getPrintText("UNAVAILABLE"); - unavailablePendingText_ = ResourceLoader.getPrintText("UNAVAILABLE_PENDING"); - unknownText_ = ResourceLoader.getPrintText("UNKNOWN"); - unusableText_ = ResourceLoader.getPrintText("UNUSABLE"); - variedOffText_ = ResourceLoader.getPrintText("VARIED_OFF"); - variedOnText_ = ResourceLoader.getPrintText("VARIED_ON"); - varyOffPendingText_ = ResourceLoader.getPrintText("VARY_OFF_PENDING"); - varyOnPendingText_ = ResourceLoader.getPrintText("VARY_ON_PENDING"); - waitingForOutQText_ = ResourceLoader.getPrintText("WAITING_FOR_OUTQ"); - waitingForPrinterText_ = ResourceLoader.getPrintText("WAITING_FOR_PRINTER"); - waitingOnMessageText_ = ResourceLoader.getPrintText("WAITING_ON_MESSAGE"); - waitingOnJobQueueQSPL_ = ResourceLoader.getPrintText("WAITING_ON_JOB_QUEUE_QSPL"); - yesText_ = ResourceLoader.getPrintText("YES"); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - } - } - - -/** -Reloads the actions. -
      -
    • Hold -
    • Release -
    • Start -
    • Stop -
    • Make Available -
    • Make Unavailable -
    • Properties - handled by parent for us -
    -**/ - -/* RDS- These should be added sometime -
  • Reply -
  • Restart -*/ - - private void reloadActions () - { - String statusStr; - int statusInt; - - // @A15A - if (systemNotSupported_ == true) - { - // The device is not varied on so only MAKE AVAILABLE is enabled - actions_[HOLD_ACTION].setEnabled(false); - actions_[RELEASE_ACTION].setEnabled(false); - actions_[START_ACTION].setEnabled(false); - actions_[STOP_ACTION].setEnabled(false); - actions_[AVAILABLE_ACTION].setEnabled(false); - actions_[UNAVAILABLE_ACTION].setEnabled(false); - return; - } - - // Now we need to figure out which ones are active - try - { - // Get device status - statusInt = getPrinterDeviceStatus(); - - if((statusInt == DEVICESTATUS_VARIEDON) || - (statusInt == DEVICESTATUS_ACTIVE) || - (statusInt == DEVICESTATUS_ACTIVEWRITER) || - (statusInt == DEVICESTATUS_HELD)) - { - // The device is varied on - actions_[AVAILABLE_ACTION].setEnabled(false); - actions_[UNAVAILABLE_ACTION].setEnabled(true); - - // Check to see if a writer is started - // Get the writer name. Use this call because it's faster. - statusStr = printer_.getStringAttribute(PrintObject.ATTR_WTRJOBSTS); // @A4C - - // Start is active only if writer does not exist - // Stop is active if writer exists - if(statusStr == null) // @A4C - { - // The writer is not started so only START is enabled - actions_[HOLD_ACTION].setEnabled(false); - actions_[RELEASE_ACTION].setEnabled(false); - actions_[START_ACTION].setEnabled(true); - actions_[STOP_ACTION].setEnabled(false); - } - else - { - statusStr = statusStr.trim(); // @A4A - if (statusStr.equals("END")) // @A4A - { - // The writer is not started so only START is enabled - actions_[HOLD_ACTION].setEnabled(false); - actions_[RELEASE_ACTION].setEnabled(false); - actions_[START_ACTION].setEnabled(true); - actions_[STOP_ACTION].setEnabled(false); - } - else // @A4A - { - // There is a writer so STOP is enabled - actions_[START_ACTION].setEnabled(false); - actions_[STOP_ACTION].setEnabled(true); - - // Is the writer held? - if(statusStr.equals("HLD")) - { - // The writer is held so RELEASE is enabled - actions_[HOLD_ACTION].setEnabled(false); - actions_[RELEASE_ACTION].setEnabled(true); - } - else - { - // HOLD is enabled - actions_[HOLD_ACTION].setEnabled(true); - actions_[RELEASE_ACTION].setEnabled(false); - } - } - } - } - else - { - // The device is not varied on so only MAKE AVAILABLE is enabled - actions_[HOLD_ACTION].setEnabled(false); - actions_[RELEASE_ACTION].setEnabled(false); - actions_[START_ACTION].setEnabled(false); - actions_[STOP_ACTION].setEnabled(false); - actions_[AVAILABLE_ACTION].setEnabled(true); - actions_[UNAVAILABLE_ACTION].setEnabled(false); - } - - // Reply is active only if writer message exists (ADD LATER) - // Restart is active only if writer is currently writing - // RDS- Add these later - - } // end try block - catch (Exception e) - { - errorEventSupport_.fireError (e); - } // end catch block - } - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - -/** -Removes a property change listener. - -@param listener The listener. -**/ - // Used by VPrinterOutput - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - // Used by VPrinterOutput - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); //@A11C - } - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - -/** -Sets the printer. A call to load() must be done after calling this -funtion inorder to update the details children. - -@param printer The printer. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setPrinter(Printer printer) - throws PropertyVetoException - { - try - { - printer_ = printer; - - // @A15A - AS400 system = printer_.getSystem(); - int systemVRM = system.getVRM(); - if (systemVRM < supportedVRM_) - { - systemNotSupported_ = true; - } - - if(printerOutput_ == null) - printerOutput_ = new VPrinterOutput(printer.getSystem()); - else - printerOutput_.setSystem(printer.getSystem()); - - // Set the new outq name filter - String outqPath = printer_.getStringAttribute(PrintObject.ATTR_OUTPUT_QUEUE); //@A12A - if (outqPath != null) // @A12A - { - outqPath = outqPath.toUpperCase(); //@A12a - printerOutput_.setQueueFilter(outqPath); //@A12a - } - // no error reported for outqPath == null? - } - catch (RequestNotSupportedException e) { // @A16A - if (Trace.isTraceOn()) { - Trace.log(Trace.ERROR,"VPrinter::setPrinter failed getting attribute"); - } - errorEventSupport_.fireError (e); - requestNotSupportedFired_ = true; - } - catch (Exception e) - { - errorEventSupport_.fireError (e); - } // end catch block - - } - -/** -Sorts the children for the details. - -@param propertyIdentifiers The property identifiers. -@param orders The sort orders for each property - identifier, true for ascending order, - false for descending order. -**/ -public void sortDetailsChildren (Object[] propertyIdentifiers, boolean[] orders) -{ - printerOutput_.sortDetailsChildren(propertyIdentifiers, orders); -} - -/** -Returns the string representation. This is the name of the printer. - -@return The string representation. -**/ - public String toString () - { - return printer_.getName(); - } - -/** -Listens for events from the actions and adjusts the actions accordingly. -**/ - private class VObjectListener_ //@A8A - implements VObjectListener, Serializable - { - - public void objectChanged (VObjectEvent event) - { - // need to reload the actions to reflect the change - reloadActions(); - } - - public void objectCreated (VObjectEvent event) - { - // Nothing here. - } - - public void objectDeleted (VObjectEvent event) - { - // Nothing here. - } - } -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VPrinter16.gif b/cvsroot/src/com/ibm/as400/vaccess/VPrinter16.gif deleted file mode 100644 index 82e0513ff..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VPrinter16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VPrinter32.gif b/cvsroot/src/com/ibm/as400/vaccess/VPrinter32.gif deleted file mode 100644 index f8d723d71..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VPrinter32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VPrinterBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/VPrinterBeanInfo.java deleted file mode 100644 index 1b95d156c..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VPrinterBeanInfo.java +++ /dev/null @@ -1,183 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VPrinterBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** -The VPrinterBeanInfo class provides bean information -for the VPrinter class. - -@see VPrinter -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VPrinterBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private final static Class beanClass_ = VPrinter.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - -/** -Static initializer. -**/ - static - { - try - { - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", - ErrorListener.class, - "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", - PropertyChangeListener.class, - "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", - VetoableChangeListener.class, - "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - String[] vobjectMethods = { "objectChanged" }; - EventSetDescriptor vobject = new EventSetDescriptor (beanClass_, - "vobject", - VObjectListener.class, - vobjectMethods, - "addVObjectListener", - "removeVObjectListener"); - vobject.setDisplayName (ResourceLoader.getText ("EVT_NAME_VOBJECT")); - vobject.setShortDescription (ResourceLoader.getText ("EVT_DESC_VOBJECT")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { error, propertyChange, vetoableChange, vobject, working }; - - // Properties. - PropertyDescriptor printer = new PropertyDescriptor("printer", beanClass_); - printer.setBound(true); - printer.setConstrained(true); - printer.setDisplayName(ResourceLoader.getPrintText("PROP_DESC_PRINTER_PRINTER")); - printer.setShortDescription(ResourceLoader.getPrintText("PROP_DESC_PRINTER_PRINTER")); - - properties_ = new PropertyDescriptor[] {printer}; - } - - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // printer. - } - -/** -Returns the event set descriptors. - -@return The event set descriptors. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("VPrinter16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("VPrinter32.gif"); - break; - } - return image; - } - - -/** -Returns the property descriptors. - -@return The property descriptors. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VPrinterOutput.java b/cvsroot/src/com/ibm/as400/vaccess/VPrinterOutput.java deleted file mode 100644 index ee2cab01a..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VPrinterOutput.java +++ /dev/null @@ -1,1196 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VPrinterOutput.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.SpooledFileList; -import com.ibm.as400.access.SpooledFile; -import com.ibm.as400.access.PrintObject; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.AS400; -import javax.swing.Icon; -import javax.swing.table.DefaultTableColumnModel; -import javax.swing.table.TableColumnModel; -import javax.swing.SwingConstants; -import javax.swing.tree.TreeNode; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.PropertyVetoException; -import java.io.Serializable; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.util.Enumeration; -import java.util.Vector; - - -/** -The VPrinterOutput class defines the representation of a -list of spooled files on a system for use in various models -and panes in this package. - -

    A VPrinterOutput object has no children. Its details -children are the spooled files (VOutput objects) in -this list. - -

    You must explicitly call load() to load the information from -the system. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VPrinterOutput objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • VObjectEvent -
    • WorkingEvent -
    - -@see com.ibm.as400.access.SpooledFileList -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ - -public class VPrinterOutput -implements VNode, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Static data. - private static final String name_ = ResourceLoader.getPrintText ("PRINTEROUTPUT_NAME"); - private static final String description_ = ResourceLoader.getPrintText ("PRINTEROUTPUT_DESCRIPTION"); - private static final Icon icon16_ = ResourceLoader.getIcon ("VPrinterOutput16.gif", description_); - private static final Icon icon32_ = ResourceLoader.getIcon ("VPrinterOutput32.gif", description_); - private static final String outputNameText_ = ResourceLoader.getPrintText ("OUTPUT_NAME"); - private static final String userSpecDataText_ = ResourceLoader.getPrintText ("USER_SPEC_DATA"); - private static final String userText_ = ResourceLoader.getPrintText ("USER"); - private static final String statusText_ = ResourceLoader.getPrintText ("STATUS"); - private static final String printerText_ = ResourceLoader.getPrintText ("PRINTER"); - private static final String pagesPerCopyText_ = ResourceLoader.getPrintText ("PAGES_PER_COPY"); - private static final String copiesLeftText_ = ResourceLoader.getPrintText ("COPIES_LEFT"); - private static final String dateCreatedText_ = ResourceLoader.getPrintText ("DATE_CREATED"); - private static final String formTypeText_ = ResourceLoader.getPrintText ("FORM_TYPE"); - private static final String jobText_ = ResourceLoader.getPrintText ("JOB"); - private static final String jobNumberText_ = ResourceLoader.getPrintText ("JOB_NUMBER"); - private static final String numberText_ = ResourceLoader.getPrintText ("NUMBER"); - private static final String outQText_ = ResourceLoader.getPrintText ("OUTPUT_QUEUE"); - private static final String outQLibText_ = ResourceLoader.getPrintText ("OUTPUT_QUEUE_LIB"); - private static final String priorityText_ = ResourceLoader.getPrintText ("PRIORITY"); - private static final String userCommentText_ = ResourceLoader.getPrintText ("USER_COMMENT"); - - private static TableColumnModel detailsColumnModel_ = null; - private static int[] attrsToList_ = null; - - // @A1A - private static final int dfltOutputNameColWidth = 15; - private static final int dfltUserSpecDataColWidth = 15; - private static final int dfltUserColWidth = 10; - private static final int dfltStatusColWidth = 15; - private static final int dfltPrinterColWidth = 10; - private static final int dfltPagesPerCopyColWidth = 10; - private static final int dfltCopiesLeftColWidth = 10; - private static final int dfltDateCreatedColWidth = 25; - private static final int dfltFormTypeColWidth = 10; - private static final int dfltJobColWidth = 15; - private static final int dfltJobNumberColWidth = 12; - private static final int dfltNumberColWidth = 12; - private static final int dfltOutQueColWidth = 12; - private static final int dfltOutQueLibColWidth = 12; - private static final int dfltPriorityColWidth = 10; - private static final int dfltUserCommentColWidth = 25; - - // Properties - private SpooledFileList list_ = null; - - // Transient data - transient private Vector children_ ; - transient private boolean childrenLoaded_; - transient private boolean disableFeature_; // @A1A - transient private VNode parent_; - transient PrinterOutputPropertiesPane propertiesPane_; - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private VObjectEventSupport objectEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - transient private WorkingEventSupport workingEventSupport_; - -/** -Static Initializer -**/ - static - { - // initalize the detailsColumnModel_ - detailsColumnModel_ = new DefaultTableColumnModel (); - int columnIndex = 0; - int iLen; - - // output name - VTableColumn outputNameColumn = new VTableColumn (columnIndex++, VOutput.OUTPUTNAME_PROPERTY); - outputNameColumn.setCellRenderer (new VObjectCellRenderer ()); - outputNameColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - outputNameColumn.setHeaderValue(outputNameText_); - iLen = outputNameText_.length(); // @A1A - if (iLen < dfltOutputNameColWidth) - { - iLen = dfltOutputNameColWidth; - } - outputNameColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (outputNameColumn); - - // user data - VTableColumn userDataColumn = new VTableColumn (columnIndex++, VOutput.USERSPECDATA_PROPERTY); - userDataColumn.setCellRenderer (new VObjectCellRenderer ()); - userDataColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - userDataColumn.setHeaderValue(userSpecDataText_); - iLen = userSpecDataText_.length(); // @A1A - if (iLen < dfltUserSpecDataColWidth) - { - iLen = dfltUserSpecDataColWidth; - } - userDataColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (userDataColumn); - - // user - VTableColumn userColumn = new VTableColumn (columnIndex++, VOutput.USER_PROPERTY); - userColumn.setCellRenderer (new VObjectCellRenderer ()); - userColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - userColumn.setHeaderValue (userText_); - iLen = userText_.length(); // @A1A - if (iLen < dfltUserColWidth) - { - iLen = dfltUserColWidth; - } - userColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (userColumn); - - // status - VTableColumn statusColumn = new VTableColumn (columnIndex++, VOutput.STATUS_PROPERTY); - statusColumn.setCellRenderer (new VObjectCellRenderer ()); - statusColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - statusColumn.setHeaderValue (statusText_); - iLen = statusText_.length(); // @A1A - if (iLen < dfltStatusColWidth) - { - iLen = dfltStatusColWidth; - } - statusColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (statusColumn); - - // printer - VTableColumn printerColumn = new VTableColumn (columnIndex++, VOutput.PRINTER_PROPERTY); - printerColumn.setCellRenderer (new VObjectCellRenderer ()); - printerColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - printerColumn.setHeaderValue (printerText_); - iLen = printerText_.length(); // @A1A - if (iLen < dfltPrinterColWidth) - { - iLen = dfltPrinterColWidth; - } - printerColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (printerColumn); - - // pages - VTableColumn pagesColumn = new VTableColumn (columnIndex++, VOutput.PAGESPERCOPY_PROPERTY); - pagesColumn.setCellRenderer (new VObjectCellRenderer (SwingConstants.CENTER)); - pagesColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - pagesColumn.setHeaderValue (pagesPerCopyText_); - iLen = pagesPerCopyText_.length(); // @A1A - if (iLen < dfltPagesPerCopyColWidth) - { - iLen = dfltPagesPerCopyColWidth; - } - pagesColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (pagesColumn); - - // copies - VTableColumn copiesColumn = new VTableColumn (columnIndex++, VOutput.COPIESLEFT_PROPERTY); - copiesColumn.setCellRenderer (new VObjectCellRenderer (SwingConstants.CENTER)); - copiesColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - copiesColumn.setHeaderValue (copiesLeftText_); - iLen = copiesLeftText_.length(); // @A1A - if (iLen < dfltCopiesLeftColWidth) - { - iLen = dfltCopiesLeftColWidth; - } - copiesColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (copiesColumn); - - // date - VTableColumn dateColumn = new VTableColumn (columnIndex++, VOutput.DATE_PROPERTY); - dateColumn.setCellRenderer (new VObjectCellRenderer ()); - dateColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - dateColumn.setHeaderValue (dateCreatedText_); - iLen = dateCreatedText_.length(); // @A1A - if (iLen < dfltDateCreatedColWidth) - { - iLen = dfltDateCreatedColWidth; - } - dateColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (dateColumn); - - // form type - VTableColumn formTypeColumn = new VTableColumn (columnIndex++, VOutput.FORMTYPE_PROPERTY); - formTypeColumn.setCellRenderer (new VObjectCellRenderer ()); - formTypeColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - formTypeColumn.setHeaderValue (formTypeText_); - iLen = formTypeText_.length(); // @A1A - if (iLen < dfltFormTypeColWidth) - { - iLen = dfltFormTypeColWidth; - } - formTypeColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (formTypeColumn); - - // job - VTableColumn jobColumn = new VTableColumn (columnIndex++, VOutput.JOB_PROPERTY); - jobColumn.setCellRenderer (new VObjectCellRenderer ()); - jobColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - jobColumn.setHeaderValue (jobText_); - iLen = jobText_.length(); // @A1A - if (iLen < dfltJobColWidth) - { - iLen = dfltJobColWidth; - } - jobColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (jobColumn); - - // job number - VTableColumn jobNumberColumn = new VTableColumn (columnIndex++, VOutput.JOBNUMBER_PROPERTY); - jobNumberColumn.setCellRenderer (new VObjectCellRenderer ()); - jobNumberColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - jobNumberColumn.setHeaderValue (jobNumberText_); - iLen = jobNumberText_.length(); // @A1A - if (iLen < dfltJobNumberColWidth) - { - iLen = dfltJobNumberColWidth; - } - jobNumberColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (jobNumberColumn); - - // number - VTableColumn numberColumn = new VTableColumn (columnIndex++, VOutput.NUMBER_PROPERTY); - numberColumn.setCellRenderer (new VObjectCellRenderer (SwingConstants.CENTER)); - numberColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - numberColumn.setHeaderValue (numberText_); - iLen = numberText_.length(); // @A1A - if (iLen < dfltNumberColWidth) - { - iLen = dfltNumberColWidth; - } - numberColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (numberColumn); - - // output queue - VTableColumn outQColumn = new VTableColumn (columnIndex++, VOutput.OUTPUTQUEUE_PROPERTY); - outQColumn.setCellRenderer (new VObjectCellRenderer ()); - outQColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - outQColumn.setHeaderValue (outQText_); - iLen = outQText_.length(); // @A1A - if (iLen < dfltOutQueColWidth) - { - iLen = dfltOutQueColWidth; - } - outQColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (outQColumn); - - // output queue library - VTableColumn outQLibColumn = new VTableColumn (columnIndex++, VOutput.OUTPUTQUEUELIB_PROPERTY); - outQLibColumn.setCellRenderer (new VObjectCellRenderer ()); - outQLibColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - outQLibColumn.setHeaderValue (outQLibText_); - iLen = outQLibText_.length(); // @A1A - if (iLen < dfltOutQueLibColWidth) - { - iLen = dfltOutQueLibColWidth; - } - outQLibColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (outQLibColumn); - - // priority - VTableColumn priorityColumn = new VTableColumn (columnIndex++, VOutput.PRIORITY_PROPERTY); - priorityColumn.setCellRenderer (new VObjectCellRenderer (SwingConstants.CENTER)); - priorityColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - priorityColumn.setHeaderValue (priorityText_); - iLen = priorityText_.length(); // @A1A - if (iLen < dfltPriorityColWidth) - { - iLen = dfltPriorityColWidth; - } - priorityColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (priorityColumn); - - // user comment - VTableColumn userCommentColumn = new VTableColumn (columnIndex++, VOutput.USERCOMMENT_PROPERTY); - userCommentColumn.setCellRenderer (new VObjectCellRenderer ()); - userCommentColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - userCommentColumn.setHeaderValue (userCommentText_); - iLen = userCommentText_.length(); // @A1A - if (iLen < dfltUserCommentColWidth) - { - iLen = dfltUserCommentColWidth; - } - userCommentColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (userCommentColumn); - - // initalize the attributes to be retrieved in the list - attrsToList_ = new int[19]; - attrsToList_[0] = PrintObject.ATTR_COPIES; - attrsToList_[1] = PrintObject.ATTR_COPIESLEFT; - attrsToList_[2] = PrintObject.ATTR_CURPAGE; - attrsToList_[3] = PrintObject.ATTR_DATE; - attrsToList_[4] = PrintObject.ATTR_FORMTYPE; - attrsToList_[5] = PrintObject.ATTR_JOBNAME; - attrsToList_[6] = PrintObject.ATTR_JOBNUMBER; - attrsToList_[7] = PrintObject.ATTR_JOBUSER; - attrsToList_[8] = PrintObject.ATTR_LASTPAGE; - attrsToList_[9] = PrintObject.ATTR_OUTPTY; - attrsToList_[10] = PrintObject.ATTR_OUTPUT_QUEUE; - attrsToList_[11] = PrintObject.ATTR_PAGES; - attrsToList_[12] = PrintObject.ATTR_PRINTER; - attrsToList_[13] = PrintObject.ATTR_PRTASSIGNED; - attrsToList_[14] = PrintObject.ATTR_SAVE; - attrsToList_[15] = PrintObject.ATTR_SPLFSTATUS; - attrsToList_[16] = PrintObject.ATTR_TIME; - attrsToList_[17] = PrintObject.ATTR_USERCMT; - attrsToList_[18] = PrintObject.ATTR_USERDATA; - } - - -/** -Constructs a VPrinterOutput object. -**/ - public VPrinterOutput () - { - list_ = new SpooledFileList(); - - // initialize transient data - disableFeature_ = false; - parent_ = null; - initializeTransient (); - } - - // @A1A - // Special package scoped constructor to used to disable - // output queue and output queue lib lists in properties pane. - VPrinterOutput (boolean disable) - { - list_ = new SpooledFileList(); - - // initialize transient data - disableFeature_ = disable; - parent_ = null; - initializeTransient (); - } - -/** -Constructs a VPrinterOutput object. - -@param system The system on which the output resides. -**/ - public VPrinterOutput (AS400 system) - { - if (system == null) - throw new NullPointerException ("system"); - - list_ = new SpooledFileList(system); - - // initialize transient data - disableFeature_ = false; - parent_ = null; - initializeTransient (); - } - - // @A1A - // Special package scoped constructor to used to disable - // output queue and output queue lib lists in properties pane. - VPrinterOutput (AS400 system, boolean disable) - { - if (system == null) - throw new NullPointerException ("system"); - - list_ = new SpooledFileList(system); - - // initialize transient data - disableFeature_ = disable; - parent_ = null; - initializeTransient (); - } - -/** -Constructs a VPrinterOutput object. - -@param parent The parent. -@param system The system on which the output resides. -**/ - public VPrinterOutput (VNode parent, AS400 system) - { - if (parent == null) - throw new NullPointerException ("parent"); - if (system == null) - throw new NullPointerException ("system"); - - list_ = new SpooledFileList(system); - - // initialize transient data - disableFeature_ = false; - parent_ = parent; - initializeTransient (); - } - - // @A1A - // Special package scoped constructor to used to disable - // output queue and output queue lib lists in properties pane. - VPrinterOutput (VNode parent, AS400 system, boolean disable) - { - if (parent == null) - throw new NullPointerException ("parent"); - if (system == null) - throw new NullPointerException ("system"); - - list_ = new SpooledFileList(system); - - // initialize transient data - disableFeature_ = disable; - parent_ = parent; - initializeTransient (); - } - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - -/** -Returns the children of the node. - -@return An empty enumeration. -**/ - public synchronized Enumeration children () - { - return new Enumeration () - { - public boolean hasMoreElements () { return false; } - public Object nextElement () { throw new java.util.NoSuchElementException (); } - }; - } - - -/** -Returns the list of actions that can be performed. - -@return Always null. There are no actions. -**/ - public VAction[] getActions () - { - return null; - } - - -/** -Indiciates if the node allows children. - -@return Always false. -**/ - public boolean getAllowsChildren () - { - return false; - } - - -/** -Returns the child node at the specified index. - -@param index The index. - -@return Always null. -**/ - public TreeNode getChildAt (int index) - { - return null; - } - - -/** -Returns the number of children. - -@return Always 0. -**/ - public int getChildCount () - { - return 0; - } - - -/** -Returns the default action. - -@return Always null. There is no default action. -**/ - public VAction getDefaultAction () - { - return null; - } - - -/** -Returns the child for the details at the specified index. -The details child is a spooled file (VOutput object) in -this list. - -@param index The index. -@return The child, or null if the index is not - valid. -**/ - public synchronized VObject getDetailsChildAt (int index) - { - if (childrenLoaded_ == false) - { - loadChildren (); - } - - if (true == children_.isEmpty()) - return null; - else - return (VObject) children_.elementAt (index); - } - - - -/** -Returns the number of children for the details. -The details children are the spooled files (VOutput objects) in -this list. - -@return The number of children for the details. -**/ - public synchronized int getDetailsChildCount () - { - if (childrenLoaded_ == false) - { - loadChildren (); - } - - return children_.size (); - } - - -/** -Returns the table column model to use in the details -when representing the children. This column model -describes the details values for the children. -The details children are the spooled files (VOutput objects) in -this list. - -@return The details column model. -**/ - public TableColumnModel getDetailsColumnModel () - { - return detailsColumnModel_; - } - - -/** -Returns the index of the specified child for the details. -The details child is a spooled file (VOutput object) in -this list. - -@param child The details child. -@return The index, or -1 if the child is not found - in the details. -**/ - public synchronized int getDetailsIndex (VObject child) - { - if (childrenLoaded_ == false) - { - loadChildren (); - } - - return children_.indexOf (child); - } - - -/** -Returns the form type filter for the list. -The filter contains the form type a spooled file must be -to be included in the list. - -@return The form type filter. -**/ - public String getFormTypeFilter() - { - return list_.getFormTypeFilter(); - } - - -/** -Returns the icon. - -@param size The icon size, either 16 or 32. If any other - value is given, then return the default of 16. -@param open This parameter has no effect. -@return The icon. -**/ - public Icon getIcon (int size, boolean open) - { - if (size == 32) - return icon32_; - else - return icon16_; - } - - -/** -Returns the index of the specified child. - -@param child The child. -@return Always -1. -**/ - public int getIndex (TreeNode child) - { - return -1; - } - - -/** -Returns the parent node. - -@return The parent node, or null if there is no parent. -**/ - public TreeNode getParent () - { - return parent_; - } - - -/** -Returns the properties pane. - -@return The properties pane. -**/ - public VPropertiesPane getPropertiesPane () - { - return propertiesPane_; - } - - -/** -Returns a property value. - -@param propertyIdentifier The property identifier. The choices are - NAME_PROPERTY or DESCRIPTION_PROPERTY. -@return The property value, or null if the - property identifier is not recognized. -**/ - public synchronized Object getPropertyValue (Object propertyIdentifier) - { - // Get the name. - if (propertyIdentifier == NAME_PROPERTY) - return this; - - // Get the description. - else if (propertyIdentifier == DESCRIPTION_PROPERTY) - return description_; - - // By default, return null. - return null; - } - - -/** -Returns the output queue list filter. - -@return The output queue filter. -**/ - public String getQueueFilter() - { - return list_.getQueueFilter(); - } - - -/** -Returns the system on which the output resides. - -@return The system on which the output resides. -**/ - public AS400 getSystem () - { - return list_.getSystem(); - } - - -/** -Returns the text. This is a constant string which -identifies this object as a list of printer output. - -@return The text. -**/ - public String getText () - { - return name_; - } - - -/** -Returns the user data list filter. - -@return The user data filter. -**/ - public String getUserDataFilter() - { - return list_.getUserDataFilter(); - } - - -/** -Returns the user ID list filter. - -@return The user ID filter. -**/ - public String getUserFilter() - { - return list_.getUserFilter(); - } - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Initialize event support - errorEventSupport_ = new ErrorEventSupport (this); - objectEventSupport_ = new VObjectEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - list_.setAttributesToRetrieve(attrsToList_); - list_.addPropertyChangeListener (propertyChangeSupport_); - list_.addVetoableChangeListener (vetoableChangeSupport_); - - // initialize the properties pane - propertiesPane_ = new PrinterOutputPropertiesPane (this, list_, disableFeature_); - - // Listen to the properties pane. - propertiesPane_.addErrorListener (errorEventSupport_); - propertiesPane_.addVObjectListener (objectEventSupport_); - propertiesPane_.addWorkingListener (workingEventSupport_); - - // Initialize the children - children_ = new Vector (); - childrenLoaded_ = true;//@A2C set to true so beans don't call to system without load() - } - -/** -Indicates if the node is a leaf. - -@return Always true. -**/ - public boolean isLeaf () - { - return true; - } - - - -/** -Indicates if the details children are sortable. - -@return Always true. -**/ - public boolean isSortable () - { - return true; - } - -/** -Loads information about the object from the system. -**/ - public synchronized void load () - { -//@B0D workingEventSupport_.fireStartWorking (); - - // Reset children flag so that kids get loaded - // on next getDetails call. - childrenLoaded_ = false; - - loadChildren(); //@B0A - -//@B0D workingEventSupport_.fireStopWorking (); - } - - -/** -Loads the children. -**/ - private synchronized void loadChildren () - { - workingEventSupport_.fireStartWorking (); - - // stop listening to children - for (Enumeration e = children_.elements (); e.hasMoreElements (); ) { - VObject child = (VObject) e.nextElement (); - child.removeErrorListener (errorEventSupport_); - child.removeVObjectListener (objectEventSupport_); - child.removeWorkingListener (workingEventSupport_); - } - - children_.removeAllElements (); - - // build the list - try { - // open the list and fill it with objects - list_.openSynchronously(); - - int listSize = list_.size(); - - // trace the size of the list - if (Trace.isTraceOn()) - Trace.log (Trace.INFORMATION, "ListSize:" + listSize); - - // allocate the array of childern objects - children_ = new Vector(listSize); - - SpooledFile splF = null; - VObject child = null; - - // load the children array from the list - for (int i=0; iNote that this does not actually delete the file. -That is the responsibility of the caller. - -@param object The child object. -**/ - synchronized void remove (VObject object) - { - children_.removeElement (object); - - object.removeErrorListener (errorEventSupport_); - object.removeVObjectListener (objectEventSupport_); - object.removeWorkingListener (workingEventSupport_); - } - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - -/** -Removes a property change listener. - -@param listener The listener. -**/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - -/** -Removes a vetoable change listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - -/** -Sets the form type filter for the list. A call to load() must be done after -calling this funtion inorder to update the details children. - -@param formTypeFilter The form type the spooled file must be to be included -in the list. It cannot be greater than 10 characters. -The value can be any specific value or any of these special values: -
      -
    • *ALL - Spooled files with any form type will be included in the list. -
    • *STD - Spooled files with the form type *STD will be included in the list. -
    -The default is *ALL. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setFormTypeFilter(String formTypeFilter) - throws PropertyVetoException - { - list_.setFormTypeFilter(formTypeFilter); - } - - -/** -Sets the output queue filter. A call to load() must be done after calling -this funtion inorder to update the details children. - -@param queueFilter The library and output queues on which to list spooled - files. The format of the queueFilter string must be in the - format of /QSYS.LIB/libname.LIB/queuename.OUTQ where -
    - libname is the library name that contains the queues to search. - It can be a specific name or one of these special values: -
      -
    • %LIBL% - The server job's library list. -
    • %ALL% - All libraries are searched. This value is only valid - if the queuename is %ALL%. -
    - queuename is the name of the output queues to search. - It can be a specific name or the special value %ALL%. - If it is %ALL%, then the libname must also be %ALL%. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setQueueFilter(String queueFilter) - throws PropertyVetoException - { - list_.setQueueFilter(queueFilter); - } - -/** -Sets the system on which the output resides. A call to load() must be done -after calling this funtion inorder to update the details children. - -@param system The system on which the output resides. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setSystem (AS400 system) - throws PropertyVetoException - { - list_.setSystem (system); - } - - -/** -Sets the user data list filter. A call to load() must be done after -calling this funtion inorder to update the details children. - -@param userDataFilter The user data the spooled file must - have for it to be included in the list. The value can be - any specific value or the special value *ALL. The value cannot be - greater than 10 characters. - The default is *ALL. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setUserDataFilter(String userDataFilter) - throws PropertyVetoException - { - list_.setUserDataFilter(userDataFilter); - } - - -/** -Sets the user ID list filter. A call to load() must be done after calling -this funtion inorder to update the details children. - -@param userFilter The user or users for which to list spooled files. -The value cannot be greater than 10 characters. -The value can be any specific user ID or any of these special values: -
      -
    • *ALL - Spooled files created by all users will be included in the list. -
    • *CURRENT - Spooled files created by the current user only will be in the list. -
    -The default is *CURRENT. - -@exception PropertyVetoException If the change is vetoed. -**/ - public void setUserFilter(String userFilter) - throws PropertyVetoException - { - list_.setUserFilter(userFilter); - } - - -/** -Sorts the children for the details. -The propertyIdentifer[0], orders[0] combination is used to do the sort. -If the values are equal, propertyIdentifier[1], orders[1] is used to -break the tie, and so forth. - -@param propertyIdentifiers The property identifiers. -@param orders The sort orders for each property - identifier; true for ascending order, - false for descending order. -**/ - public synchronized void sortDetailsChildren (Object[] propertyIdentifiers, boolean[] orders) - { - if (propertyIdentifiers == null) - throw new NullPointerException ("propertyIdentifiers"); - if (orders == null) - throw new NullPointerException ("orders"); - - if (childrenLoaded_ == false) - { - loadChildren (); - } - - VUtilities.sort (children_, propertyIdentifiers, orders); - } - - -/** -Returns the string representation. -This is a constant string which -identifies this object as a list of printer output. - -@return The string representation. -**/ - public String toString () - { - return name_; - } - -} // end VPrinterOutput class diff --git a/cvsroot/src/com/ibm/as400/vaccess/VPrinterOutput16.gif b/cvsroot/src/com/ibm/as400/vaccess/VPrinterOutput16.gif deleted file mode 100644 index 2a3809cc3..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VPrinterOutput16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VPrinterOutput32.gif b/cvsroot/src/com/ibm/as400/vaccess/VPrinterOutput32.gif deleted file mode 100644 index bd8ec42be..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VPrinterOutput32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VPrinterOutputBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/VPrinterOutputBeanInfo.java deleted file mode 100644 index 17d1dab63..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VPrinterOutputBeanInfo.java +++ /dev/null @@ -1,198 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VPrinterOutputBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - -/** -The VPrinterOutputBeanInfo class provides bean information -for the VPrinterOutput class. - -@see VPrinterOutput -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VPrinterOutputBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private final static Class beanClass_ = VPrinterOutput.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - -/** -Static initializer. -**/ - static - { - try - { - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - String[] vobjectMethods = { "objectChanged", "objectDeleted" }; - EventSetDescriptor vobject = new EventSetDescriptor (beanClass_, - "vobject", VObjectListener.class, vobjectMethods, - "addVObjectListener", "removeVObjectListener"); - vobject.setDisplayName (ResourceLoader.getText ("EVT_NAME_VOBJECT")); - vobject.setShortDescription (ResourceLoader.getText ("EVT_DESC_VOBJECT")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { error, propertyChange, vetoableChange, vobject, working }; - - // Properties. - PropertyDescriptor system = new PropertyDescriptor ("system", beanClass_); - system.setBound (true); - system.setConstrained (true); - system.setDisplayName (ResourceLoader.getText ("PROP_NAME_SYSTEM")); - system.setShortDescription (ResourceLoader.getText ("PROP_DESC_SYSTEM")); - - PropertyDescriptor formTypeFilter = new PropertyDescriptor("formTypeFilter", beanClass_); - formTypeFilter.setBound(true); - formTypeFilter.setConstrained(true); - formTypeFilter.setDisplayName(ResourceLoader.getPrintText("PROP_NAME_SPLF_FORMTYPE_FILTER")); - formTypeFilter.setShortDescription(ResourceLoader.getPrintText("PROP_DESC_SPLF_FORMTYPE_FILTER")); - - PropertyDescriptor outQFilter = new PropertyDescriptor("queueFilter", beanClass_); - outQFilter.setBound(true); - outQFilter.setConstrained(true); - outQFilter.setDisplayName(ResourceLoader.getPrintText("PROP_NAME_SPLF_OUTQ_FILTER")); - outQFilter.setShortDescription(ResourceLoader.getPrintText("PROP_DESC_SPLF_OUTQ_FILTER")); - - PropertyDescriptor userFilter = new PropertyDescriptor("userFilter", beanClass_); - userFilter.setBound(true); - userFilter.setConstrained(true); - userFilter.setDisplayName(ResourceLoader.getPrintText("PROP_NAME_SPLF_USER_FILTER")); - userFilter.setShortDescription(ResourceLoader.getPrintText("PROP_DESC_SPLF_USER_FILTER")); - - PropertyDescriptor userDataFilter = new PropertyDescriptor("userDataFilter", beanClass_); - userDataFilter.setBound(true); - userDataFilter.setConstrained(true); - userDataFilter.setDisplayName(ResourceLoader.getPrintText("PROP_NAME_SPLF_USERDATA_FILTER")); - userDataFilter.setShortDescription(ResourceLoader.getPrintText("PROP_DESC_SPLF_USERDATA_FILTER")); - - properties_ = new PropertyDescriptor[] {system, formTypeFilter, outQFilter, userFilter, userDataFilter }; - } - - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 1; // system. - } - -/** -Returns the event set descriptors. - -@return The event set descriptors. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("VPrinterOutput16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("VPrinterOutput32.gif"); - break; - } - return image; - } - - -/** -Returns the property descriptors. - -@return The property descriptors. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VPrinters.java b/cvsroot/src/com/ibm/as400/vaccess/VPrinters.java deleted file mode 100644 index 8dffb58f5..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VPrinters.java +++ /dev/null @@ -1,817 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VPrinters.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -// Toolbox imports -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.Printer; -import com.ibm.as400.access.PrinterList; -import com.ibm.as400.access.PrintObject; -import com.ibm.as400.access.Trace; - -// swing imports -import javax.swing.Icon; -import javax.swing.JTabbedPane; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.table.DefaultTableColumnModel; -import javax.swing.table.TableColumn; -import javax.swing.table.TableColumnModel; -import javax.swing.tree.TreeNode; - -// awt imports -import java.awt.Component; -import java.awt.GridLayout; - -// Java beans imports -import java.beans.PropertyChangeListener; -//import java.beans.PropertyChangeSupport; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -//import java.beans.VetoableChangeSupport; - -// Java imports -import java.io.Serializable; -import java.util.Enumeration; -import java.util.Vector; - - -/** -The VPrinters class represents -a list of system printers for use in various models -and panes in this package. - -

    Both the children and details children of a VPrinters -object are the printers (VPrinter objects) in this list. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VPrinters objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • VObjectEvent -
    • WorkingEvent -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VPrinters -implements VNode, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // MRI. - private static String description_ = ResourceLoader.getPrintText("AS400_PRINTERS"); - private static String descriptionColumnHeader_ = ResourceLoader.getPrintText ("DESCRIPTION"); - private static Icon icon16_ = ResourceLoader.getIcon ("VPrinters16.gif", description_); - private static Icon icon32_ = ResourceLoader.getIcon ("VPrinters32.gif", description_); - private static String name_ = ResourceLoader.getPrintText ("PRINTERS"); - private static String outputQueueColumnHeader_ = ResourceLoader.getPrintText ("OUTPUT_QUEUE"); - private static String printerColumnHeader_ = ResourceLoader.getPrintText ("PRINTER"); - private static String statusColumnHeader_ = ResourceLoader.getPrintText ("STATUS"); - - private static TableColumnModel detailsColumnModel_ = null; - private static Object detailsColumnModelLock_ = new Object(); - - // Default column widths - private static final int dfltPrinterColWidth = 15; - private static final int dfltStatusColWidth = 25; - private static final int dfltDescriptionColWidth = 25; - private static final int dfltOutputQueueColWidth = 12; - - // Attributes to retreive - private static int attrsToRetrieve[] = - { - PrintObject.ATTR_AFP, - PrintObject.ATTR_ALIGNFORMS, - PrintObject.ATTR_ALWDRTPRT, - PrintObject.ATTR_CHANGES, - PrintObject.ATTR_DESCRIPTION, - PrintObject.ATTR_DEVSTATUS, - PrintObject.ATTR_DEVTYPE, - PrintObject.ATTR_DRWRSEP, - PrintObject.ATTR_PRINTER, - PrintObject.ATTR_FILESEP, - PrintObject.ATTR_FORMTYPE, - PrintObject.ATTR_MESSAGE_QUEUE, - PrintObject.ATTR_OUTPUT_QUEUE, - PrintObject.ATTR_OUTQSTS, - PrintObject.ATTR_OVERALLSTS, - PrintObject.ATTR_PRTDEVTYPE, - PrintObject.ATTR_STARTEDBY, - PrintObject.ATTR_WTRAUTOEND, - PrintObject.ATTR_WTRJOBNAME, - PrintObject.ATTR_WTRJOBNUM, - PrintObject.ATTR_WTRJOBSTS, - PrintObject.ATTR_WTRJOBUSER, - PrintObject.ATTR_WTRSTRTD, // @A1A - PrintObject.ATTR_WRTNGSTS, // @A1A - PrintObject.ATTR_WTNGMSGSTS, // @A1A - PrintObject.ATTR_HELDSTS, // @A1A - PrintObject.ATTR_ENDPNDSTS, // @A1A - PrintObject.ATTR_HOLDPNDSTS, // @A1A - PrintObject.ATTR_BTWNFILESTS, // @A1A - PrintObject.ATTR_BTWNCPYSTS, // @A1A - PrintObject.ATTR_WTNGDATASTS, // @A1A - PrintObject.ATTR_WTNGDEVSTS, // @A1A - PrintObject.ATTR_ONJOBQSTS // @A1A - }; - - // Properites - private PrinterList list_ = null; //@A3C - - // Private data. - transient private VObject[] children_; - transient private boolean childrenLoaded_; - transient private boolean childrenLoading_; //@A4A - transient private VNode parent_; - transient private VPropertiesPane propertiesPane_; - transient private VPrinters thisPointer_; - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private VObjectEventSupport objectEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - transient private WorkingEventSupport workingEventSupport_; - -/** -Constructs a VPrinters object. -**/ - public VPrinters() - { - list_ = new PrinterList(); - - // initialize transient data - parent_ = null; - initializeTransient(); - } - -/** -Constructs a VPrinters object. - -@param system The system from which the list will be retrieved. -**/ - public VPrinters( AS400 system ) - { - if (system == null) - throw new NullPointerException ("system"); - - list_ = new PrinterList(system); - - // initialize transient data - parent_ = null; - initializeTransient(); - } - -/** -Constructs a VPrinters object. - -@param parent The parent. -@param system The system from which the list will be retrieved. -**/ - public VPrinters(VNode parent, AS400 system ) - { - if (parent == null) - throw new NullPointerException ("parent"); - if (system == null) - throw new NullPointerException ("system"); - - list_ = new PrinterList(system); - - // initialize transient data - parent_ = parent; - initializeTransient(); - } - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - -/** -Adds a listener to be notified when the value of any -bound property changes. - -@param listener The listener. -**/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - -/** -Adds a listener to be notified when the value of any -constrained property changes. - -@param listener The listener. -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - -/** -Returns the children of the node. -The children are the printers. - -@return The children. -**/ - public Enumeration children () - { - return new VEnumeration (this); - } - -/** -Returns the list of actions that can be performed. - -@return Always null. There are no actions. -**/ - public VAction[] getActions () - { - return null; - } - -/** -Indiciates if the node allows children. - -@return Always true. -**/ - public boolean getAllowsChildren () - { - return true; - } - -/** -Returns the child node at the specified index. - -@param index The index. -@return The child node, or null if the - index is not valid. -**/ - public synchronized TreeNode getChildAt (int index) - { - updateChildren(); - - if (index < 0 || index >= children_.length) - return null; - - return (TreeNode) children_[index]; - } - -/** -Returns the number of children. -This is the number of printers. - -@return The number of children. -**/ - public synchronized int getChildCount () - { - updateChildren(); - - return children_.length; - } - -/** -Returns the default action. - -@return Always null. There is no default action. -**/ - public VAction getDefaultAction () - { - return null; - } - -/** -Returns the child for the details at the specified index. - -@param index The index. -@return The child, or null if the index is not - valid. -**/ - public synchronized VObject getDetailsChildAt (int index) - { - updateChildren(); - - if (index < 0 || index >= children_.length) - return null; - - return children_[index]; - } - -/** -Returns the number of children for the details. - -@return The number of children for the details. -**/ - public /* @A4D synchronized */ int getDetailsChildCount () - { - updateChildren(); - - return children_.length; - } - -/** -Returns the table column model to use in the details -when representing the children. This column model -describes the details values for the children. - -@return The details column model. -**/ - public TableColumnModel getDetailsColumnModel () - { - int iLen; - - synchronized (detailsColumnModelLock_) { - - if (detailsColumnModel_ == null) { - - detailsColumnModel_ = new DefaultTableColumnModel (); - - // printer column - VTableColumn printerColumn = new VTableColumn (0,VPrinter.PRINTER_PROPERTY); - printerColumn.setCellRenderer (new VObjectCellRenderer()); - printerColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - printerColumn.setHeaderValue (printerColumnHeader_); - iLen = printerColumnHeader_.length(); - if (iLen < dfltPrinterColWidth) - { - iLen = dfltPrinterColWidth; - } - printerColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (printerColumn); - - // status column - VTableColumn statusColumn = new VTableColumn (1,VPrinter.STATUS_PROPERTY); - statusColumn.setCellRenderer (new VObjectCellRenderer()); - statusColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - statusColumn.setHeaderValue (statusColumnHeader_); - iLen = statusColumnHeader_.length(); - if (iLen < dfltStatusColWidth) - { - iLen = dfltStatusColWidth; - } - statusColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (statusColumn); - - // description column - VTableColumn descriptionColumn = new VTableColumn (2,VPrinter.DESCRIPTION_PROPERTY); - descriptionColumn.setCellRenderer (new VObjectCellRenderer()); - descriptionColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - descriptionColumn.setHeaderValue (descriptionColumnHeader_); - iLen = descriptionColumnHeader_.length(); - if (iLen < dfltDescriptionColWidth) - { - iLen = dfltDescriptionColWidth; - } - descriptionColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (descriptionColumn); - - // output queue column - VTableColumn outputQueueColumn = new VTableColumn (3,VPrinter.OUTPUTQUEUE_PROPERTY); - outputQueueColumn.setCellRenderer (new VObjectCellRenderer()); - outputQueueColumn.setHeaderRenderer (new VObjectHeaderRenderer ()); - outputQueueColumn.setHeaderValue (outputQueueColumnHeader_); - iLen = outputQueueColumnHeader_.length(); - if (iLen < dfltOutputQueueColWidth) - { - iLen = dfltOutputQueueColWidth; - } - outputQueueColumn.setPreferredCharWidth (iLen); - detailsColumnModel_.addColumn (outputQueueColumn); - } - } - - return detailsColumnModel_; - } - -/** -Returns the index of the specified child for the details. - -@param detailsChild The details child. -@return The index, or -1 if the child is not found - in the details. -**/ - public synchronized int getDetailsIndex (VObject detailsChild) - { - updateChildren(); - - for (int i = 0; i < children_.length; ++i) { - if (children_[i] == detailsChild) { - return i; - } - } - return -1; - } - -/** -Returns the icon. - -@param size The icon size, either 16 or 32. If any other - value is given, then return the default of 16. -@param open This parameter has no effect. -@return The icon. -**/ - public Icon getIcon (int size, boolean open) - { - if (size == 32) - return icon32_; - else - return icon16_; - } - -/** -Returns the index of the specified child. - -@param child The child. -@return The index, or -1 if the child is not found. -**/ - public synchronized int getIndex (TreeNode child) - { - updateChildren(); - - for (int i = 0; i < children_.length; ++i) { - if (children_[i] == child) { - return i; - } - } - return -1; - } - -/** -Returns the parent node. - -@return The parent node, or null if there is no parent. -**/ - public TreeNode getParent () - { - return parent_; - } - -/** -Returns the printer list filter. - -@return The printer filter. -**/ - public String getPrinterFilter() - { - return list_.getPrinterFilter(); - } - -/** -Returns the properties pane. - -@return The properties pane. -**/ - public VPropertiesPane getPropertiesPane() - { - return propertiesPane_; - } - -/** -Returns a property value. - -@param propertyIdentifier The property identifier. The choices are -
      -
    • NAME_PROPERTY -
    • DESCRIPTION_PROPERTY -
    -@return The property value, or null if the - property identifier is not recognized. -**/ - public synchronized Object getPropertyValue (Object propertyIdentifier) - { - // Get the name. - if (propertyIdentifier == NAME_PROPERTY) - return this; - - // Get the description. - else if (propertyIdentifier == DESCRIPTION_PROPERTY) - return description_; - - // By default, return null. - return null; - } - -/** -Returns the system from which the list will be retrieved. - -@return The system from which the list will be retrieved. -**/ - public AS400 getSystem () - { - return list_.getSystem(); - } - -/** -Returns the text. This is a constant string which -identifies this object as a list of printers. - -@return The text. -**/ - public String getText () - { - return name_; - } - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - objectEventSupport_ = new VObjectEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - children_ = new VNode[0]; - - propertiesPane_ = new PrintersPropertiesPane(this,list_); - propertiesPane_.addErrorListener (errorEventSupport_); - propertiesPane_.addVObjectListener (objectEventSupport_); - // propertiesPane_.addWorkingListener (workingEventSupport_); @A2D - - thisPointer_ = this; // used by the loader - - // Initialize the children loaded flag to true. This - // makes sure that we do not go to the system until - // after load() has been called. - childrenLoaded_ = true; - childrenLoading_ = false; // @A4A - - list_.setAttributesToRetrieve(attrsToRetrieve); - list_.addPropertyChangeListener(propertyChangeSupport_); //@A2A - list_.addVetoableChangeListener(vetoableChangeSupport_); //@A2A - } - -/** -Indicates if the node is a leaf. - -@return true if the node if a leaf; false otherwise. -**/ - public boolean isLeaf () - { - return (getChildCount () == 0); - } - -/** -Indicates if the details children are sortable. - -@return Always false. -**/ - public boolean isSortable () - { - return false; - } - -/** -Loads information about the object from the system. -**/ - public /* @A4D synchronized */ void load () - { - workingEventSupport_.fireStartWorking (); - - childrenLoaded_ = false; - - workingEventSupport_.fireStopWorking (); - } - -/** -Loads the children (printers) from the system -**/ - private /* @A4D synchronized */ void loadChildren () - throws Exception - { - if (childrenLoading_ == false) // @A4A - { // @A4A - childrenLoading_ = true; // @A4A - - if (children_ != null) - { - // Stop listening to the previous children, if any. - for (int i = 0; i < children_.length; ++i) { - children_[i].removeErrorListener (errorEventSupport_); - children_[i].removeVObjectListener (objectEventSupport_); - children_[i].removeWorkingListener (workingEventSupport_); - } - } - - // open the list and fill it with objects - list_.openSynchronously(); - - int listSize = list_.size(); - - // trace the size of the list - if (Trace.isTraceOn()) { - Trace.log (Trace.INFORMATION, "ListSize:" + listSize); - } - - // allocate the array of childern objects - children_ = new VObject[listSize]; - - Printer prtD = null; - VObject child = null; - - // load the children array from the list - for (int i=0; icom.ibm.as400.access -**/ -public class VPrintersBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private final static Class beanClass_ = VPrinters.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - -/** -Static initializer. -**/ - static - { - try - { - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", - ErrorListener.class, - "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", - PropertyChangeListener.class, - "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", - VetoableChangeListener.class, - "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - String[] vobjectMethods = { "objectChanged", "objectDeleted" }; - EventSetDescriptor vobject = new EventSetDescriptor (beanClass_, - "vobject", - VObjectListener.class, - vobjectMethods, - "addVObjectListener", - "removeVObjectListener"); - vobject.setDisplayName (ResourceLoader.getText ("EVT_NAME_VOBJECT")); - vobject.setShortDescription (ResourceLoader.getText ("EVT_DESC_VOBJECT")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { error, propertyChange, vetoableChange, vobject, working }; - - // Properties. - PropertyDescriptor system = new PropertyDescriptor ("system", beanClass_); - system.setBound (true); - system.setConstrained (true); - system.setDisplayName (ResourceLoader.getText ("PROP_NAME_SYSTEM")); - system.setShortDescription (ResourceLoader.getText ("PROP_DESC_SYSTEM")); - - PropertyDescriptor printerFilter = new PropertyDescriptor("printerFilter", beanClass_); - printerFilter.setBound(true); - printerFilter.setConstrained(true); - printerFilter.setDisplayName(ResourceLoader.getPrintText("PROP_NAME_PRINTERS_PRINTER_FILTER")); - printerFilter.setShortDescription(ResourceLoader.getPrintText("PROP_DESC_PRINTERS_PRINTER_FILTER")); - - properties_ = new PropertyDescriptor[] {system, printerFilter }; - } - - catch (Exception e) - { - throw new Error(e.toString()); - } - } - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // system. - } - -/** -Returns the event set descriptors. - -@return The event set descriptors. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("VPrinters16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("VPrinters32.gif"); - break; - } - return image; - } - - -/** -Returns the property descriptors. - -@return The property descriptors. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VPropertiesAction.java b/cvsroot/src/com/ibm/as400/vaccess/VPropertiesAction.java deleted file mode 100644 index 95ffc71ee..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VPropertiesAction.java +++ /dev/null @@ -1,432 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VPropertiesAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.Hashtable; - - - -/** -The VPropertiesAction class is an action that presents a -properties pane for a system resource in a modeless dialog. - -

    If a property dialog is already visible for the object, -then it will be given focus. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VPropertiesAction objects generate the following events: -

      -
    • ErrorEvent -
    • VObjectEvent -
    • WorkingEvent -
    - -@see VPropertiesPane -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VPropertiesAction -implements VAction, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String applyText_ = ResourceLoader.getText ("DLG_APPLY"); - private static final String cancelText_ = ResourceLoader.getText ("DLG_CANCEL"); - private static final String okText_ = ResourceLoader.getText ("DLG_OK"); - private static final String propertiesActionText_ = ResourceLoader.getText ("ACTION_PROPERTIES"); - private static final String propertiesDialogText_ = ResourceLoader.getText ("DLG_PROPERTIES_TITLE"); - - - - // Properties. - private boolean enabled_ = true; - private VObject object_ = null; - - - - // Private data. - private static Hashtable visibleDialogs_ = new Hashtable (); - - - - // Event support. - transient ErrorEventSupport errorEventSupport_; // Private. - transient VObjectEventSupport objectEventSupport_; // Private. - transient WorkingEventSupport workingEventSupport_; // Private. - - - -/** -Constructs a VPropertiesAction object. -**/ - public VPropertiesAction () - { - initializeTransient (); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Applies the changes. - -@param propertiesPane The properties pane. -**/ - void applyChanges (VPropertiesPane propertiesPane) // Private. - { - try { - propertiesPane.applyChanges (); - } - catch (Exception e) { - errorEventSupport_.fireError (e); - } - } - - - -/** -Disposes a property dialog. - -@param object The object. -**/ - static void disposeDialog (VObject object) // Private. - { - JDialog dialog = (JDialog) visibleDialogs_.get (object); - dialog.dispose (); - visibleDialogs_.remove (object); - } - - - - -/** -Returns the object with which the action is associated. - -@return The object. -**/ - public VObject getObject () - { - return object_; - } - - - -/** -Returns the text for the properties action. - -@return The text for the properties action. -**/ - public String getText () - { - return propertiesActionText_; - } - - - -/** -Indicates if the action is enabled. - -@return true if the action is enabled; false otherwise. -**/ - public boolean isEnabled () - { - return enabled_; - } - - - -/** -Initializes transient data. -**/ - private void initializeTransient () - { - // Initialize event support. - errorEventSupport_ = new ErrorEventSupport (this); - objectEventSupport_ = new VObjectEventSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - } - - - -/** -Performs the action. - -@param context The action context. -**/ - public void perform (VActionContext context) - { - if (context == null) - throw new NullPointerException ("context"); - - if ((enabled_ == true) && (object_ != null)) { - - VPropertiesPane propertiesPane = object_.getPropertiesPane (); - final VPropertiesPane propertiesPane2 = propertiesPane; // For inner classes. - - final VObject object2 = object_; // For inner classes. - - if (propertiesPane != null) { - - // If the dialog is already showing, then just - // give it the focus. - if (visibleDialogs_.containsKey (object_)) { - JDialog dialog = (JDialog) visibleDialogs_.get (object_); - dialog.toFront (); - dialog.requestFocus (); - } - - // Otherwise, create and show a new dialog. - else { - String title = ResourceLoader.substitute (propertiesDialogText_, object_.getText ()); // @A1C - - // Bubble events up from properties pane. - propertiesPane.addErrorListener (errorEventSupport_); - propertiesPane.addVObjectListener (objectEventSupport_); - propertiesPane.addWorkingListener (workingEventSupport_); - - // Apply button. - JButton applyButton = new JButton (applyText_); - final JButton applyButton2 = applyButton; // For inner classes. - applyButton.addActionListener (new ActionListener () { - public void actionPerformed (ActionEvent event) { - applyChanges (propertiesPane2); - applyButton2.setEnabled (false); - }}); - applyButton.setEnabled (false); - - // Cancel button. - JButton cancelButton = new JButton (cancelText_); - cancelButton.addActionListener (new ActionListener () { - public void actionPerformed (ActionEvent event) { - propertiesPane2.removeErrorListener (errorEventSupport_); - propertiesPane2.removeVObjectListener (objectEventSupport_); - propertiesPane2.removeWorkingListener (workingEventSupport_); - disposeDialog (object2); - }}); - - // Ok button. - JButton okButton = new JButton (okText_); - okButton.addActionListener (new ActionListener () { - public void actionPerformed (ActionEvent event) { - applyChanges (propertiesPane2); - propertiesPane2.removeErrorListener (errorEventSupport_); - propertiesPane2.removeVObjectListener (objectEventSupport_); - propertiesPane2.removeWorkingListener (workingEventSupport_); - disposeDialog (object2); - }}); - - // Set up the button pane. - JPanel buttonPanel = new JPanel (); - buttonPanel.setLayout (new FlowLayout (FlowLayout.RIGHT)); - buttonPanel.add (okButton); - buttonPanel.add (cancelButton); - buttonPanel.add (applyButton); - okButton.setSelected (true); - - // Get the graphical component. - Component component = propertiesPane.getComponent (); - - // Layout the dialog. - JDialog dialog = new JDialog (context.getFrame (), title, false); - dialog.getContentPane ().setLayout (new BorderLayout ()); - dialog.getContentPane ().add ("South", buttonPanel); - dialog.getContentPane ().add ("Center", component); - dialog.setResizable (false); - dialog.pack (); - dialog.addWindowListener (new WindowAdapter () { - public void windowClosing (WindowEvent event) { - disposeDialog (object2); - }}); - - // Listen to the properties pane, so that we can - // enable the apply button when needed. - propertiesPane.addChangeListener (new ChangeListener () { - public void stateChanged (ChangeEvent event) { - applyButton2.setEnabled (true); - }}); - - // Show the dialog. - showDialog (object2, dialog); - } - } - } - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Sets the enabled state of the action. - -@param enabled true if the action is enabled; false otherwise. -**/ - public void setEnabled (boolean enabled) - { - enabled_ = enabled; - } - - - -/** -Sets the object with which the action is associated. - -@param object The object. -**/ - public void setObject (VObject object) - { - if (object == null) - throw new NullPointerException ("object"); - - object_ = object; - } - - - -/** -Shows a property dialog. - -@param object The object. -@param dialog The dialog. -**/ - static void showDialog (VObject object, JDialog dialog) // Private. - { - visibleDialogs_.put (object, dialog); - dialog.show (); - } - - - -/** -Returns the string representation of the properties action. - -@return The string representation of the properties action. -**/ - public String toString () - { - return propertiesActionText_; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VPropertiesAction16.gif b/cvsroot/src/com/ibm/as400/vaccess/VPropertiesAction16.gif deleted file mode 100644 index 4e5d18061..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VPropertiesAction16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VPropertiesAction32.gif b/cvsroot/src/com/ibm/as400/vaccess/VPropertiesAction32.gif deleted file mode 100644 index 9893b18fe..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VPropertiesAction32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VPropertiesActionBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/VPropertiesActionBeanInfo.java deleted file mode 100644 index 55256b981..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VPropertiesActionBeanInfo.java +++ /dev/null @@ -1,185 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VPropertiesActionBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - - - -/** -The VPropertiesActionBeanInfo class provides bean information -for the VPropertiesAction class. - -@see VPropertiesAction -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VPropertiesActionBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = VPropertiesAction.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - String[] vobjectMethods = { "objectChanged", "objectCreated", "objectDeleted" }; - EventSetDescriptor vobject = new EventSetDescriptor (beanClass_, - "vobject", VObjectListener.class, vobjectMethods, - "addVObjectListener", "removeVObjectListener"); - vobject.setDisplayName (ResourceLoader.getText ("EVT_NAME_VOBJECT")); - vobject.setShortDescription (ResourceLoader.getText ("EVT_DESC_VOBJECT")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { error, vobject, working }; - - // Properties. - PropertyDescriptor enabled = new PropertyDescriptor ("enabled", beanClass_); - enabled.setBound (true); - enabled.setConstrained (false); - enabled.setDisplayName (ResourceLoader.getText ("PROP_NAME_ENABLED")); - enabled.setShortDescription (ResourceLoader.getText ("PROP_DESC_ENABLED")); - - PropertyDescriptor object = new PropertyDescriptor ("object", beanClass_); - object.setBound (true); - object.setConstrained (false); - object.setDisplayName (ResourceLoader.getText ("PROP_NAME_OBJECT")); - object.setShortDescription (ResourceLoader.getText ("PROP_DESC_OBJECT")); - - properties_ = new PropertyDescriptor[] { enabled, object}; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // Error event. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 1; // object. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("VPropertiesAction16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("VPropertiesAction32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VPropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/VPropertiesPane.java deleted file mode 100644 index 444e4b4a2..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VPropertiesPane.java +++ /dev/null @@ -1,154 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VPropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.event.ChangeListener; -import java.awt.Component; - - -/** -The VPropertiesPane interface defines the representation of a -properties pane. A properties pane is a graphical user interface -that allows the user to view and optionally edit properties of -a system resource. - -

    When the user makes a change using the editor, the properties -pane fires a change event. This signals to the dialog that a -change was made so that it can enable the Apply button. The change -to the underlying system resource is not made at this time. This -way the user can still choose to cancel the changes. - -

    When the user clicks the OK or Apply button, then applyChanges() -is called. The change to the underlying system resource is made at -this time. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VPropertiesPane objects generate the following events: -

      -
    • ChangeEvent -
    • ErrorEvent -
    • VObjectEvent -
    • WorkingEvent -
    - -@see VObject#getPropertiesPane -@see VPropertiesAction -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public interface VPropertiesPane -{ - - - -/** -Adds a listener to be notified when the user makes a change. - -@param listener The listener. -**/ - abstract public void addChangeListener (ChangeListener listener); - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - abstract public void addErrorListener (ErrorListener listener); - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - abstract public void addVObjectListener (VObjectListener listener); - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - - -@param listener The listener. -**/ - abstract public void addWorkingListener (WorkingListener listener); - - - -/** -Applies the changes made by the user. -It will change the resources on the system. - -@exception Exception If an error occurs. -**/ - abstract public void applyChanges () - throws Exception; - - - -/** -Returns the graphical user interface component. This -does not include the dialog or the OK, Cancel, and Apply -buttons. - -@return The graphical user interface component. -**/ - abstract public Component getComponent (); - - - -/** -Removes a change listener. - -@param listener The listener. -**/ - abstract public void removeChangeListener (ChangeListener listener); - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - abstract public void removeErrorListener (ErrorListener listener); - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - abstract public void removeVObjectListener (VObjectListener listener); - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - abstract public void removeWorkingListener (WorkingListener listener); - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VQRYMRI.java b/cvsroot/src/com/ibm/as400/vaccess/VQRYMRI.java deleted file mode 100644 index cb1a4bd1e..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VQRYMRI.java +++ /dev/null @@ -1,328 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VQRYMRI.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2002 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.util.*; - -/** -Locale-specific objects for the IBM Toolbox for Java. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VQRYMRI extends ListResourceBundle -{ - // NLS_MESSAGEFORMAT_NONE - // Each string is assumed NOT to be processed by the MessageFormat class. - // This means that a single quote must be coded as 1 single quote. - - // NLS_ENCODING=UTF-8 - // Instructs the translation tools to interpret the text as UTF-8. - - public Object[][] getContents() - { - return resources; - } - - private final static Object[][] resources= { - // #TRANNOTE ##################################################### - // #TRANNOTE Text for SQL Query GUI. - // #TRANNOTE ##################################################### - // #TRANNOTE Before you add a new resource, please make - // #TRANNOTE sure you are not duplicating another. The - // #TRANNOTE goal is to keep the amount of translatable - // #TRANNOTE text down. - // #TRANNOTE - // #TRANNOTE NOTE TO TRANSLATORS: The format of a line of MRI - // #TRANNOTE is { "KEY", "value" }, - // #TRANNOTE - // #TRANNOTE The key must be left alone so translate only the value. - // #TRANNOTE - // #TRANNOTE - - - // #TRANNOTE ##################################################### - // #TRANNOTE Button labels - // #TRANNOTE ##################################################### - - // #TRANNOTE Label for adding an item to a list. - { "DBQUERY_BUTTON_ADD", "Add" }, - - // #TRANNOTE Button label which exits the dialog without accepting the choices. - { "DBQUERY_BUTTON_CANCEL", "Cancel" }, - - // #TRANNOTE Label for button to change the schemas for which tables are shown - { "DBQUERY_BUTTON_CHANGE_SCHEMAS", "Set schemas" }, - - // #TRANNOTE Label for button to display a list of tables - { "DBQUERY_BUTTON_DISPLAY_TABLES", "Show table list" }, - - // #TRANNOTE Button label which accepts the current choice and exits the dialog. - { "DBQUERY_BUTTON_OK", "OK" }, - - // #TRANNOTE Button label which indicates an SQL inner join. - { "DBQUERY_BUTTON_INNER_JOIN", "inner join" }, - - // #TRANNOTE Button label which indicates an SQL outer join. - { "DBQUERY_BUTTON_OUTER_JOIN", "outer join" }, - - // #TRANNOTE Label for removing an item from a list. - { "DBQUERY_BUTTON_REMOVE", "Remove" }, - - // #TRANNOTE Label for button to specify a date and time field. - { "DBQUERY_BUTTON_TIMESTAMP_2_FIELDS", "Date and time field" }, - - // #TRANNOTE Label for button to specify a timestamp field. - { "DBQUERY_BUTTON_TIMESTAMP_1_FIELDS", "Timestamp field" }, - - - - // #TRANNOTE ##################################################### - // #TRANNOTE Choices (items in list boxes) - // #TRANNOTE ##################################################### - - // #TRANNOTE List box choice which means the user can enter a constant expression. - // #TRANNOTE This should be the same as DBQUERY_TITLE_CONSTANT except for - // #TRANNOTE the case of the first letter. - { "DBQUERY_CHOICE_CONSTANT", "constant" }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE Column headings - // #TRANNOTE ##################################################### - - // #TRANNOTE Column heading for the name of the database field. - { "DBQUERY_COLUMN_NAME", "Name" }, - - // #TRANNOTE Column heading for the type of the database field. - { "DBQUERY_COLUMN_TYPE", "Type" }, - - // #TRANNOTE Column heading for the length of the database field. - { "DBQUERY_COLUMN_LENGTH", "Length" }, - - // #TRANNOTE Column heading for the number of decimal places of the database field. - { "DBQUERY_COLUMN_DECIMALS", "Decimals" }, - - // #TRANNOTE Column heading for whether the database field can have null values. - { "DBQUERY_COLUMN_NULL", "Null capable" }, - - // #TRANNOTE Column heading for the description of the database field. - { "DBQUERY_COLUMN_DESCRIPTION", "Description" }, - - // #TRANNOTE Column heading for items in the SELECT clause. Only "items" - // #TRANNOTE should be translated, "SELECT" shold not be translated. - { "DBQUERY_COLUMN_SELECT", "SELECT items" }, - - // #TRANNOTE Column heading for a database schema. - { "DBQUERY_COLUMN_TABLE_SCHEMA", "Schema" }, - - // #TRANNOTE Column heading for a database table table name. - { "DBQUERY_COLUMN_TABLE_NAME", "Table" }, - - // #TRANNOTE Column heading for a database table type. - { "DBQUERY_COLUMN_TABLE_TYPE", "Type" }, - - // #TRANNOTE Column heading for a database table description. - { "DBQUERY_COLUMN_TABLE_TEXT", "Description" }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE Labels - // #TRANNOTE ##################################################### - - // #TRANNOTE Label for the database catalog. The colon is a separator between - // #TRANNOTE the label and the value. - { "DBQUERY_LABEL_CATALOG", "Catalog:" }, - - // #TRANNOTE Label for text field which contains the WHERE portion of an - // #TRANNOTE SQL query. - { "DBQUERY_LABEL_CLAUSE_WHERE", "Where clause" }, - - // #TRANNOTE Label for text field which contains the SELECT portion of an - // #TRANNOTE SQL query. - { "DBQUERY_LABEL_CLAUSE_SELECT", "Select clause" }, - - // #TRANNOTE Label for text field which contains the ORDER BY portion of an - // #TRANNOTE SQL query. - { "DBQUERY_LABEL_CLAUSE_ORDER", "Order By clause" }, - - // #TRANNOTE Label for text field which contains the JOIN portion of an - // #TRANNOTE SQL query. - { "DBQUERY_LABEL_CLAUSE_JOIN", "Join By clause" }, - - // #TRANNOTE Label for text field which contains the HAVING portion of an - // #TRANNOTE SQL query. - { "DBQUERY_LABEL_CLAUSE_HAVING", "Having clause" }, - - // #TRANNOTE Label for text field which contains the GROUP BY portion of an - // #TRANNOTE SQL query. - { "DBQUERY_LABEL_CLAUSE_GROUP", "Group By clause" }, - - // #TRANNOTE Label for list box that contains SQL functions. - { "DBQUERY_LABEL_FUNCTIONS", "Functions" }, - - // #TRANNOTE Label for a group of buttons where the user chooses the type - // #TRANNOTE of SQL join. - { "DBQUERY_LABEL_JOIN_TYPE", "Type of join" }, - - // #TRANNOTE Label for list box that contains the "NOT" function. - { "DBQUERY_LABEL_NOT", "Not" }, - - // #TRANNOTE Label for list box that contains miscellaneous SQL components. - { "DBQUERY_LABEL_OTHER", "Other" }, - - // #TRANNOTE Label for text field which contains an SQL statement. - { "DBQUERY_LABEL_SQL", "SQL statement" }, - - // #TRANNOTE Label for Summary tab. @A1A - { "DBQUERY_LABEL_SUMMARY", "Summary" }, - - // #TRANNOTE Label for text field that contains the tables for the query. - { "DBQUERY_LABEL_TABLES", "Tables" }, - - // #TRANNOTE Label for list box that contains test conditions (such as equals, - // #TRANNOTE less than, contains). - { "DBQUERY_LABEL_TEST", "Test" }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE Error messages - // #TRANNOTE ##################################################### - - // #TRANNOTE Message used when no fields are available for a chosen function. - // #TRANNOTE A function name will be appended to this message, so it should be - // #TRANNOTE open-ended. For example, the full message text will be - // #TRANNOTE "No fields suitable for function MAX()" - { "DBQUERY_MESSAGE_NO_FIELDS", "No fields suitable for function" }, - - // #TRANNOTE Message used when a invalid value was entered when a - // #TRANNOTE positve integer was required. - // #TRANNOTE A function name will be prepended to this message, so it should be - // #TRANNOTE open at the start. For example, the full message text will be - // #TRANNOTE "FROM value must be a positive integer." - { "DBQUERY_MESSAGE_INVALID_INT_VALUE", "value must be a positive integer." }, - - // #TRANNOTE Message used when a invalid value was entered when a - // #TRANNOTE integer greater than 0 was required. - // #TRANNOTE A function name will be prepended to this message, so it should be - // #TRANNOTE open at the start. For example, the full message text will be - // #TRANNOTE "FOR value must be an integer greater than 0." - { "DBQUERY_MESSAGE_INVALID_INT_VALUE2", "value must be an integer greater than 0." }, - - // #TRANNOTE Message used when a invalid value was entered when a - // #TRANNOTE integer greater than 0 was required. - { "DBQUERY_MESSAGE_INVALID_INT_VALUE3", "Value must be an integer greater than 0." }, - - // #TRANNOTE Message used when the user tries to complete a function dialog - // #TRANNOTE without specifying a required value. A field name will - // #TRANNOTE be appended to this message, so it should be open-ended. - // #TRANNOTE For example, the full message text will be - // #TRANNOTE "A value must be specified for FROM" - { "DBQUERY_MESSAGE_VALUE_MISSING", "A value must be specified for" }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE Prompts - // #TRANNOTE ##################################################### - - // #TRANNOTE Message used when the user is prompted for which field a - // #TRANNOTE SQL function should be applied to. A function name will - // #TRANNOTE be appended to this message, so it should be open-ended. - // #TRANNOTE For example, the full message text will be - // #TRANNOTE "Field for function MAX()" - { "DBQUERY_TEXT_CHOOSE", "Field for function" }, - - // #TRANNOTE Message used when the user is prompted for values for an - // #TRANNOTE SQL function. A function name will - // #TRANNOTE be appended to this message, so it should be open-ended. - // #TRANNOTE For example, the full message text will be - // #TRANNOTE "Values for function MAX()" - { "DBQUERY_TEXT_CHOOSE2", "Values for function" }, - - // #TRANNOTE Message used when the user is prompted for values for an - // #TRANNOTE test (comparison). A test name will - // #TRANNOTE be appended to this message, so it should be open-ended. - // #TRANNOTE For example, the full message text will be - // #TRANNOTE "Values for test <" - { "DBQUERY_TEXT_CHOOSE3", "Values for test" }, - - // #TRANNOTE Message for when the user is prompted for a value to use in a - // #TRANNOTE comparison (ie equal, less than) operation. - { "DBQUERY_TEXT_COMPARE", "Enter or select a value for comparison." }, - - // #TRANNOTE Message used to prompt the user to type an expression. - { "DBQUERY_TEXT_CONSTANT", "Enter a constant expression" }, - - // #TRANNOTE Message used to prompt the user to type a length. - // #TRANNOTE If they don't type anything, a default length will be used. - { "DBQUERY_TEXT_LENGTH", "Enter a length, or nothing to use the default length." }, - - // #TRANNOTE Message used to prompt the user to enter the number of decimal postions. - // #TRANNOTE If they don't type anything, a default will be used. - { "DBQUERY_TEXT_LENGTH_DECIMAL", "Enter the number of decimal positions, or nothing to use the default." }, - - // #TRANNOTE Message used to prompt the user to type a length. - // #TRANNOTE A value is required, there is no default. - { "DBQUERY_TEXT_LENGTH_REQ", "Enter a length (required)." }, - - // #TRANNOTE Message used to prompt the user to type a length. - // #TRANNOTE The length is the total length, including decimal positions. - // #TRANNOTE If they don't type anything, a default length will be used. - { "DBQUERY_TEXT_LENGTH_TOTAL", "Enter the total length, or nothing to use the default." }, - - // #TRANNOTE Prompt telling the user to select the libraries for - // #TRANNOTE which tables will be shown. - { "DBQUERY_TEXT_SCHEMAS", "Select the schemas for which tables will be shown." }, - - // #TRANNOTE Prompt which tells the user special character values that can be used. - // #TRANNOTE Do not translate the characters in single quotes. - { "DBQUERY_TEXT_SCHEMAS2", "Wildcard characters '%'(percent) and '_'(underscore) are allowed." }, - - // #TRANNOTE Message used to prompt the user to type a constant value. - // #TRANNOTE A test name will - // #TRANNOTE be appended to this message, so it should be open-ended. - // #TRANNOTE For example, the full message text will be - // #TRANNOTE "Enter a constant for test <" - { "DBQUERY_TEXT_TEST_CONSTANT", "Enter a constant for test" }, - - - // #TRANNOTE ##################################################### - // #TRANNOTE Title bar text - // #TRANNOTE ##################################################### - - // #TRANNOTE Dialog box title which means the user will be chosing a value - // #TRANNOTE for a comparison (ie equal, less than). - { "DBQUERY_TITLE_COMPARE", "Comparison" }, - - // #TRANNOTE Dialog box title which means the user can enter a constant expression. - // #TRANNOTE This should be the same as DBQUERY_CHOICE_CONSTANT except for - // #TRANNOTE the case of the first letter. - { "DBQUERY_TITLE_CONSTANT", "Constant" }, - - // #TRANNOTE Word or phrase indicating an error. Will be used along with - // #TRANNOTE a function name to build a title bar, for example "MAX() error". - { "DBQUERY_TITLE_ERROR", "error" }, - - // #TRANNOTE Text for title bar for dialog which prompts user for a length. - { "DBQUERY_TITLE_LENGTH", "Length" }, - - // #TRANNOTE Dialog box title for choosing a set of schemas - { "DBQUERY_TITLE_SCHEMAS", "Schemas" }, - - // #TRANNOTE Text for title bar for SQL query application. - { "DBQUERY_TITLE", "SQL Query" } - }; - - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VQueuedMessage.java b/cvsroot/src/com/ibm/as400/vaccess/VQueuedMessage.java deleted file mode 100644 index f031a8265..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VQueuedMessage.java +++ /dev/null @@ -1,455 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VQueuedMessage.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.MessageQueue; -import com.ibm.as400.access.QSYSObjectPathName; -import com.ibm.as400.access.QueuedMessage; -import javax.swing.Icon; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; - - - -/** -The VQueuedMessage class defines the representation of -a queued message on a system for use in various models -and panes in this package. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VQueuedMessage objects generate the following events: -

      -
    • ErrorEvent -
    • VObjectEvent -
    • WorkingEvent -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VQueuedMessage -implements VObject, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // MRI. - private static final String description_ = ResourceLoader.getText ("MESSAGE_QUEUED_DESCRIPTION"); - private static final Icon icon16_ = ResourceLoader.getIcon ("VMessage16.gif", description_); - private static final Icon icon32_ = ResourceLoader.getIcon ("VMessage32.gif", description_); - - - - // Properties. - private QueuedMessage message_ = null; - private MessageQueue queue_ = null; - - - - // Private data. - transient private VAction[] actions_; - transient private VPropertiesPane propertiesPane_; - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private VObjectEventSupport objectEventSupport_; - transient private WorkingEventSupport workingEventSupport_; - - - -/** -Property identifier for the date. -**/ - public static final Object DATE_PROPERTY = "Date"; - -/** -Property identifier for the from job name. -**/ - public static final Object FROM_JOB_PROPERTY = "From job"; - -/** -Property identifier for the from job number. -**/ - public static final Object FROM_JOB_NUMBER_PROPERTY = "From job number"; - -/** -Property identifier for the from program. -**/ - public static final Object FROM_PROGRAM_PROPERTY = "From program"; - -/** -Property identifier for the from user name. -**/ - public static final Object FROM_USER_PROPERTY = "From user"; - -/** -Property identifier for the message ID. -**/ - public static final Object ID_PROPERTY = "ID"; - -/** -Property identifier for the message queue. -**/ - public static final Object MESSAGE_QUEUE_PROPERTY = "Message queue"; - -/** -Property identifier for the message severity. -**/ - public static final Object SEVERITY_PROPERTY = "Severity"; - -/** -Property identifier for the message text. -**/ - public static final Object TEXT_PROPERTY = "Text"; - -/** -Property identifier for the message type. -**/ - public static final Object TYPE_PROPERTY = "Type"; - - - -/** -Constructs a VQueuedMessage object. - -@param message The queued message. -@param queue The message queue. -**/ - VQueuedMessage (QueuedMessage message, MessageQueue queue) - { - if (message == null) - throw new NullPointerException ("message"); - if (queue == null) - throw new NullPointerException ("queue"); - - message_ = message; - queue_ = queue; - - initializeTransient (); - } - - - -/** -Adds a listener to be notified when an error occurs. - -@param listener The listener. -**/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - -/** -Adds a listener to be notified when a VObject is changed, -created, or deleted. - -@param listener The listener. -**/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - -/** -Adds a listener to be notified when work starts and stops -on potentially long-running operations. - - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - -/** -Returns the actions that can be performed. -
      -
    • reply -
    • remove -
    - -@return The actions that can be performed. -**/ - public VAction[] getActions () - { - return actions_; - } - - - -/** -Returns the default action. - -@return Always null. There is no default action. -**/ - public VAction getDefaultAction () - { - return null; - } - - - -/** -Returns the icon. - -@param size The icon size, either 16 or 32. If any other - value is given, then return a default. -@param open This parameter has no effect. -@return The icon. -**/ - public Icon getIcon (int size, boolean open) - { - if (size == 32) - return icon32_; - else - return icon16_; - } - - - -/** -Returns the properties pane. - -@return The properties pane. -**/ - public VPropertiesPane getPropertiesPane () - { - return propertiesPane_; - } - - - -/** -Returns a property value. - -@param propertyIdentifier The property identifier. The choices are: -
      -
    • NAME_PROPERTY -
    • DESCRIPTION_PROPERTY -
    • ID_PROPERTY -
    • TEXT_PROPERTY -
    • SEVERITY_PROPERTY -
    • TYPE_PROPERTY -
    • DATE_PROPERTY -
    • FROM_JOB_PROPERTY -
    • FROM_USER_PROPERTY -
    • FROM_JOB_NUMBER_PROPERTY -
    • FROM_PROGRAM_PROPERTY -
    • MESSAGE_QUEUE_PROPERTY -
    -@return The property value, or null if the - property identifier is not recognized. -**/ - public Object getPropertyValue (Object propertyIdentifier) - { - // Get the name. - if (propertyIdentifier == NAME_PROPERTY) - return this; - - // Get the description. - else if (propertyIdentifier == DESCRIPTION_PROPERTY) - return description_; - - // Get the ID. - if (propertyIdentifier == ID_PROPERTY) - return message_.getID (); - - // Get the text. - else if (propertyIdentifier == TEXT_PROPERTY) - return message_.getText (); - - // Get the severity. - else if (propertyIdentifier == SEVERITY_PROPERTY) - return new Integer (message_.getSeverity ()); - - // Get the type. - else if (propertyIdentifier == TYPE_PROPERTY) - return MessageUtilities.getTypeText (message_.getType ()); - - // Get the date. - else if (propertyIdentifier == DATE_PROPERTY) - return message_.getDate ().getTime (); - - // Get the from job. - else if (propertyIdentifier == FROM_JOB_PROPERTY) - return message_.getFromJobName (); - - // Get the from user. - else if (propertyIdentifier == FROM_USER_PROPERTY) - return message_.getUser (); - - // Get the from job number. - else if (propertyIdentifier == FROM_JOB_NUMBER_PROPERTY) - return message_.getFromJobNumber (); - - // Get the from program. - else if (propertyIdentifier == FROM_PROGRAM_PROPERTY) - return message_.getFromProgram (); - - // Get the message queue. - else if (propertyIdentifier == MESSAGE_QUEUE_PROPERTY) { - MessageQueue queue = message_.getQueue (); - if (queue == null) - return ""; - else - return queue.getPath (); - } - - // By default, return null. - return null; - } - - - -/** -Returns the text. This is the message ID. - -@return The message ID text. -**/ - public String getText () - { - String id = message_.getID (); - if (id == null) - return ""; - else - return id; - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - objectEventSupport_ = new VObjectEventSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - // Initialize the actions. - actions_ = new VAction[] { - new QueuedMessageReplyAction (this, message_, queue_), - new QueuedMessageRemoveAction (this, message_, queue_) - }; - - for (int i = 0; i < actions_.length; ++i) { - actions_[i].addErrorListener (errorEventSupport_); - actions_[i].addVObjectListener (objectEventSupport_); - actions_[i].addWorkingListener (workingEventSupport_); - } - - // Initialize the properties pane. - propertiesPane_ = new QueuedMessagePropertiesPane (this, message_); - - propertiesPane_.addErrorListener (errorEventSupport_); - propertiesPane_.addVObjectListener (objectEventSupport_); - propertiesPane_.addWorkingListener (workingEventSupport_); - } - - - -/** -Loads information about the object from the system. -**/ - public void load () - { - // This does nothing. - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Removes an error listener. - -@param listener The listener. -**/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - -/** -Removes a VObjectListener. - -@param listener The listener. -**/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - -/** -Removes a working listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - -/** -Returns the string representation. This is the message ID. - -@return The string representation of the message ID. -**/ - public String toString () - { - String id = message_.getID (); - if (id == null) - return ""; - else - return id; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VResourceListPropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/VResourceListPropertiesPane.java deleted file mode 100644 index eaef0a767..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VResourceListPropertiesPane.java +++ /dev/null @@ -1,184 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VResourceListPropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.resource.ResourceList; -import java.awt.Component; -import javax.swing.event.ChangeListener; - - -class VResourceListPropertiesPane implements VPropertiesPane -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - // Private data. - private VObject object_; - private ResourceList resourceList_; - private ResourceListPropertiesTabbedPane tabbedPane_; - - // Event support. - private ChangeEventSupport changeEventSupport_ = new ChangeEventSupport (this); - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - - - public VResourceListPropertiesPane (VObject object, ResourceList resourceList) - { - object_ = object; - tabbedPane_ = null; - resourceList_ = resourceList; - } - - - - public void addChangeListener (ChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - changeEventSupport_.addChangeListener (listener); - } - - - - public void addErrorListener (ErrorListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - errorEventSupport_.addErrorListener (listener); - } - - - public void addVObjectListener (VObjectListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - objectEventSupport_.addVObjectListener (listener); - } - - - public void addWorkingListener (WorkingListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - workingEventSupport_.addWorkingListener (listener); - } - - - - public void applyChanges () - throws Exception - { - tabbedPane_.applyChanges(false); // @A1C - object_.load(); - } - - - - /** - * Returns the graphical component. - * - * @return The graphical component. - **/ - public Component getComponent () - { - if (tabbedPane_ == null) { - tabbedPane_ = new ResourceListPropertiesTabbedPane(resourceList_); - tabbedPane_.addErrorListener(errorEventSupport_); - tabbedPane_.addChangeListener(changeEventSupport_); - } - return tabbedPane_; - } - - - - /** - * Removes a change listener. - * - * @param listener The listener. - **/ - public void removeChangeListener (ChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - changeEventSupport_.removeChangeListener (listener); - } - - /** - * Removes a listener to be notified when an error occurs. - * - * @param listener The listener. - **/ - public void removeErrorListener (ErrorListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - errorEventSupport_.removeErrorListener (listener); - } - - /** - * Removes a listener to be notified when a VObject is changed, - * created, or deleted. - * - * @param listener The listener. - **/ - public void removeVObjectListener (VObjectListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - objectEventSupport_.removeVObjectListener (listener); - } - - /** - * Removes a listener to be notified when work in a different thread - * starts and stops. - * - * @param listener The listener. - **/ - public void removeWorkingListener (WorkingListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - workingEventSupport_.removeWorkingListener (listener); - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VResourcePropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/VResourcePropertiesPane.java deleted file mode 100644 index 2fb37c79d..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VResourcePropertiesPane.java +++ /dev/null @@ -1,187 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VResourcePropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import com.ibm.as400.resource.Resource; -import java.awt.Component; -import javax.swing.event.ChangeListener; - - -class VResourcePropertiesPane implements VPropertiesPane -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - // Private data. - private VObject object_; - private ResourceProperties properties_; - private Resource resource_; - private ResourcePropertiesTabbedPane tabbedPane_; - - // Event support. - private ChangeEventSupport changeEventSupport_ = new ChangeEventSupport (this); - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport (this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport (this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport (this); - - - - public VResourcePropertiesPane (VObject object, Resource resource, ResourceProperties properties) - { - object_ = object; - resource_ = resource; - properties_ = properties; - tabbedPane_ = null; - } - - - - public void addChangeListener (ChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - changeEventSupport_.addChangeListener (listener); - } - - - - public void addErrorListener (ErrorListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - errorEventSupport_.addErrorListener (listener); - } - - - public void addVObjectListener (VObjectListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - objectEventSupport_.addVObjectListener (listener); - } - - - public void addWorkingListener (WorkingListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - workingEventSupport_.addWorkingListener (listener); - } - - - - public void applyChanges () - throws Exception - { - tabbedPane_.applyChanges(); - } - - - - /** - * Returns the graphical component. - * - * @return The graphical component. - **/ - public Component getComponent () - { - workingEventSupport_.fireStartWorking(); - if (tabbedPane_ == null) { - tabbedPane_ = new ResourcePropertiesTabbedPane(resource_, properties_); - tabbedPane_.addErrorListener(errorEventSupport_); - tabbedPane_.addChangeListener(changeEventSupport_); - } - workingEventSupport_.fireStopWorking(); - return tabbedPane_; - } - - - - /** - * Removes a change listener. - * - * @param listener The listener. - **/ - public void removeChangeListener (ChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - changeEventSupport_.removeChangeListener (listener); - } - - /** - * Removes a listener to be notified when an error occurs. - * - * @param listener The listener. - **/ - public void removeErrorListener (ErrorListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - errorEventSupport_.removeErrorListener (listener); - } - - /** - * Removes a listener to be notified when a VObject is changed, - * created, or deleted. - * - * @param listener The listener. - **/ - public void removeVObjectListener (VObjectListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - objectEventSupport_.removeVObjectListener (listener); - } - - /** - * Removes a listener to be notified when work in a different thread - * starts and stops. - * - * @param listener The listener. - **/ - public void removeWorkingListener (WorkingListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - workingEventSupport_.removeWorkingListener (listener); - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VSystemPool.java b/cvsroot/src/com/ibm/as400/vaccess/VSystemPool.java deleted file mode 100644 index baef61312..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VSystemPool.java +++ /dev/null @@ -1,461 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VSystemPool.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.SystemPool; -import com.ibm.as400.access.SystemStatus; - -import javax.swing.Icon; -import javax.swing.SwingConstants; -import javax.swing.table.DefaultTableColumnModel; -import javax.swing.table.TableCellRenderer; -import javax.swing.table.TableColumn; -import javax.swing.table.TableColumnModel; -import javax.swing.tree.TreeNode; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.Enumeration; - -/** - * The VSystemPool class defines the representation of system pool on a - * system for use in various models and panes in this package. - * - *

    Most errors are reported as ErrorEvents rather than throwing exceptions. - * Users should listen for ErrorEvents in order to diagnose and recover - * from error conditions. - * - *

    VSystemPool objects generate the following events: - *

      - *
    • ErrorEvent - *
    • VObjectEvent - *
    • WorkingEvent - *
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VSystemPool -implements VObject, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - private static final Icon icon16_ = ResourceLoader.getIcon("VSystemPool16.gif"); - private static final Icon icon32_ = ResourceLoader.getIcon("VSystemPool32.gif"); - - /** - The property identifier for the system pool identifier. - **/ - public static String IDENTIFIER_PROPERTY = "System pool"; - /** - The property identifier for the pool size. - **/ - public static String POOL_SIZE_PROPERTY = "Pool size"; - /** - The property identifier for the reserved size. - **/ - public static String RESERVED_SIZE_PROPERTY = "Reserved size"; - - private SystemPool systemPool_ = null; - private transient VAction[] actions_; - - transient private VPropertiesPane propertiesPane_; - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - transient private VObjectEventSupport objectEventSupport_; - transient private WorkingEventSupport workingEventSupport_; - - // The variable representing if the modify action is allowed. - private boolean allowModify_ = false; - - /** - * Constructs a VSystemPool object. - **/ - public VSystemPool () - { - systemPool_ = null; - initializeTransient (); - } - - /** - * Constructs a VSystemPool object. - * - * @param systemPool The SystemPool object. - **/ - public VSystemPool (SystemPool systemPool) - { - if (systemPool == null) - throw new NullPointerException ("systemPool"); - - systemPool_ = systemPool; - systemPool_.setCaching(true); //@B1A - - initializeTransient (); - } - - /** - * Adds a listener to be notified when an error occurs. - * - * @param listener The listener. - **/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - /** - * Adds a listener to be notified when the value of any bound property - * changes. - * - * @param listener The listener. - **/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - /** - * Adds a listener to be notified when the value of any constrained - * property changes. - * - * @param listener The listener. - **/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - /** - * Adds a listener to be notified when a VObject is changed, created, - * or deleted. - * - * @param listener The listener. - **/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - /** - * Adds a listener to be notified when work starts and stops - * on potentially long-running operations. - * - * @param listener The listener. - **/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - /** - * Invoked when an error has occurred. - * - * @param event The error event. - **/ - public void errorOccurred (ErrorEvent event) - { - errorEventSupport_.errorOccurred(event); - } - - /** - * Returns the list of actions that can be performed. - * - * @return Always null. There are no actions. - **/ - public VAction[] getActions () - { - return actions_; - } - - /** - * Returns the default action. - * - * @return Always null. There is no default action. - **/ - public VAction getDefaultAction () - { - return null; - } - - /** - * Returns the icon. - * - * @param size The icon's size, either 16 or 32. If any other value - * is given, a default one will be returned. - * @param open This parameter has no effect. - * @return The icon. - **/ - public Icon getIcon (int size, boolean open) - { - if (size == 32) - return icon32_; - else - return icon16_; - } - - /** - * Returns the properties pane. - * - * @return The properties pane. - **/ - public VPropertiesPane getPropertiesPane () - { - return propertiesPane_; - } - - /** - * Returns a property value. - * - * @param propertyIdentifier The property identifier. - * @return The property value, or null if the property identifier - * is not recognized. - **/ - public Object getPropertyValue (Object propertyIdentifier) - { - try //@B1A - { - // Get the name. - if (propertyIdentifier==NAME_PROPERTY) - return this; - else if(propertyIdentifier==DESCRIPTION_PROPERTY) - { - return systemPool_.getDescription(); - } - else if(propertyIdentifier==IDENTIFIER_PROPERTY) - { - return Integer.toString(systemPool_.getPoolIdentifier()); - } - else if(propertyIdentifier==POOL_SIZE_PROPERTY) - { - return Integer.toString(systemPool_.getPoolSize()); - } - else if(propertyIdentifier==RESERVED_SIZE_PROPERTY) - { - return Integer.toString(systemPool_.getReservedSize()); - } - else - return null; // By default, return null. - } - catch(Exception e) //@B1A - { - Trace.log(Trace.ERROR, "Unable to getPropertyValue for VSystemPool.", e); //@B1A - errorEventSupport_.fireError(e); //@B1A - return null; - } - } - - /** - * Returns the system in which the system pool information resides. - * - * @return The system in which the system pool information resides. - **/ - public AS400 getSystem () - { - return systemPool_.getSystem(); - } - - /** - * Returns the systemPool. - * - * @return The systemPool, or null if it has not been set. - **/ - public SystemPool getSystemPool () - { - return systemPool_; - } - - /** - * Returns the text which is the system pool name. - * - * @return The text which is the system pool name. - **/ - public String getText () - { - if (systemPool_ != null) - return systemPool_.getPoolName (); - else - return ""; - } - - /** - * Initializes the transient data. - **/ - private void initializeTransient () - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - objectEventSupport_ = new VObjectEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - // Initialize the properties pane. - propertiesPane_ = new SystemPoolPropertiesPane (this, systemPool_); - - propertiesPane_.addErrorListener (errorEventSupport_); - propertiesPane_.addVObjectListener (objectEventSupport_); - propertiesPane_.addWorkingListener (workingEventSupport_); - actions_ = new VAction[1]; - actions_[0]= new VSystemPoolModifyAction(this,systemPool_); - - actions_[0].addErrorListener(((ErrorListener)errorEventSupport_)); - actions_[0].addWorkingListener(((WorkingListener)workingEventSupport_)); - } - - /** - * Returns true if the modify action is allowed, false otherwise. - * - * @return true if the modify action is allowed, false otherwise. - **/ - public boolean isAllowModify() - { - return allowModify_; - } - - - /** - * Loads information about the object from the system. - **/ - public void load () - { - if (systemPool_ != null) systemPool_.refreshCache(); //@B1A - } - - /** - * Restores the state of the object from an input stream. - * This is used when deserializing an object. - * - * @param in The input stream. - **/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - /** - * Removes an error listener. - * - * @param listener The listener. - **/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - /** - * Removes a property change listener. - * - * @param listener The listener. - **/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - /** - * Removes a vetoable change listener. - * - * @param listener The listener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - /** - * Removes a VObjectListener. - * - * @param listener The listener. - **/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - /** - * Removes a working listener. - * - * @param listener The listener. - **/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - /** - * Set the state of modify action. - * - * @param allowModify The boolean value. - **/ - public void setAllowModify(boolean allowModify) - { - allowModify_ = allowModify; - for(int i=0; icom.ibm.as400.access -**/ -public class VSystemPoolBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private final static Class beanClass_ = VSystemPool.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - // Static initializer. - static - { - try - { - // Events. - String[] propertyChangeMethods = {"propertyChange"}; - EventSetDescriptor propertyChange = new EventSetDescriptor( - beanClass_, - "propertyChange", - java.beans.PropertyChangeListener.class, - propertyChangeMethods, - "addPropertyChangeListener", - "removePropertyChangeListener"); - - propertyChange.setDisplayName(ResourceLoader.getText - ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText - ("EVT_DESC_PROPERTY_CHANGE")); - - events_ = new EventSetDescriptor[] { propertyChange }; - - // Properties. - PropertyDescriptor system = new PropertyDescriptor ( - "system", - beanClass_, - "getSystem", - null); - system.setBound (true); - system.setConstrained (true); - system.setDisplayName (ResourceLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription (ResourceLoader.getText( - "PROP_DESC_SYSTEM")); - - properties_ = new PropertyDescriptor[] { system }; - } - catch (IntrospectionException e) - { - throw new Error(e.toString()); - } - } - - /** - * Returns the default event index. - * @return The default event index. - **/ - public int getDefaultEventIndex() - { - return 1; - } - - /** - * Returns the default property index. - * @return The default property index. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - * Returns the descriptors for all events. - * @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an image for this bean's icon. - * @param icon The desired icon size. - * @return The image for the icon. - */ - public Image getIcon(int icon) - { - if(icon== BeanInfo.ICON_MONO_16x16) - { - java.awt.Image img = loadImage("VSystemPool16.gif"); - return img; - } - else if(icon== BeanInfo.ICON_COLOR_16x16) - { - java.awt.Image img = loadImage("VSystemPool16.gif"); - return img; - } - else if(icon == BeanInfo.ICON_MONO_32x32) - { - java.awt.Image img = loadImage("VSystemPool32.gif"); - return img; - } - else if(icon == BeanInfo.ICON_COLOR_32x32) - { - java.awt.Image img = loadImage("VSystemPool32.gif"); - return img; - } - return null; - } - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VSystemPoolModifyAction.java b/cvsroot/src/com/ibm/as400/vaccess/VSystemPoolModifyAction.java deleted file mode 100644 index b46ecb715..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VSystemPoolModifyAction.java +++ /dev/null @@ -1,211 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VSystemPoolModifyAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.SystemPool; -import com.ibm.as400.access.IFSFileOutputStream; -import com.ibm.as400.access.Trace; - -import javax.swing.border.*; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.event.ChangeEvent; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; - -import java.awt.BorderLayout; -import java.awt.Frame; -import java.awt.GridLayout; -import java.util.EventObject; - -/** - * The VSystemPoolModifyAction class represents the VSystemPool modify action. -**/ -class VSystemPoolModifyAction implements VAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private SystemPool systemPool_; - - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport(this); - private VObjectEventSupport objectEventSupport_ = new VObjectEventSupport(this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport(this); - - private boolean enabled_ = true; - - /** - * Constructs a VSystemPoolModifyAction object. - * - * @param vObject The VObject object. - * @param systemPool The SystemPool object. - **/ - public VSystemPoolModifyAction(VObject vObject, SystemPool systemPool) - { - systemPool_ = systemPool; - } - - /** - * Adds a listener to be notified when an error occurs. - * - * @param listener The listener. - **/ - public void addErrorListener(ErrorListener listener) - { - errorEventSupport_.addErrorListener(listener); - } - - /** - * Adds a listener to be notified when a VObject is changed, created, - * or deleted. - * - * @param listener The listener. - **/ - public void addVObjectListener(VObjectListener listener) - { - objectEventSupport_.addVObjectListener(listener); - } - - /** - * Adds a listener to be notified when work starts and stops on - * potentially long-running operations. - * - * @param listener The listener. - **/ - public void addWorkingListener(WorkingListener listener) - { - workingEventSupport_.addWorkingListener(listener); - } - - /** - * Invoked when an error has occurred. - * - * @param event The error event. - **/ - public void errorOccurred(ErrorEvent event) - { - errorEventSupport_.errorOccurred(event); - } - - /** - * Returns the text. - * - * @return The text. - **/ - public String getText() - { - return ResourceLoader.getText("ACTION_MODIFY"); - } - - - /** - * Returns true if the action is enabled, false otherwise. - * - * @return true if the action is enabled, false otherwise. - **/ - public boolean isEnabled() - { - return enabled_; - } - - /** - * Perform the modify action. - * - * @param vAction The Vaction context. - **/ - public void perform(VActionContext context) - { - VSystemPoolModifyDialog systemPoolDialog = new VSystemPoolModifyDialog(context.getFrame(), systemPool_); - systemPoolDialog.addErrorListener(errorEventSupport_); - systemPoolDialog.addWorkingListener(workingEventSupport_); //@B1A - systemPoolDialog.show(); //@B1A - } - - /** - * Removes an error listener. - * - * @param listener The listener. - **/ - public void removeErrorListener(ErrorListener listener) - { - errorEventSupport_.removeErrorListener(listener); - } - - /** - * Removes a VObjectListener. - * - * @param listener The listener. - **/ - public void removeVObjectListener(VObjectListener listener) - { - objectEventSupport_.removeVObjectListener(listener); - } - - /** - * Removes a working listener. - * - * @param listener The listener. - **/ - public void removeWorkingListener(WorkingListener listener) - { - workingEventSupport_.removeWorkingListener(listener); - } - - - /** - * Set the modify action enabled. - * - * @param enabled The boolean value. - **/ - public void setEnabled(boolean enabled) - { - enabled_= enabled; - } - - /** - * Invoked when a potentially long-running unit of work is about to begin. - * - * @param event The event. - **/ - public void startWorking(WorkingEvent event) - { - workingEventSupport_.startWorking(event); - } - - /** - * Invoked when a potentially long-running unit of work has completed. - * - * @param event The event. - **/ - public void stopWorking(WorkingEvent event) - { - workingEventSupport_.stopWorking(event); - } - - /** - * Returns the string representation of this object. - * - * @return The string representation of this object. - **/ - public String toString() - { - return getText(); - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VSystemPoolModifyDialog.java b/cvsroot/src/com/ibm/as400/vaccess/VSystemPoolModifyDialog.java deleted file mode 100644 index abf977ba0..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VSystemPoolModifyDialog.java +++ /dev/null @@ -1,679 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VSystemPoolModifyDialog.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - - -import com.ibm.as400.access.SystemPool; -import com.ibm.as400.access.Trace; - -import javax.swing.border.Border; -import javax.swing.border.EmptyBorder; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.JComboBox; - -import java.awt.Container; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Frame; -import java.awt.GridBagLayout; -import java.awt.LayoutManager; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; - -import java.lang.NumberFormatException; -import java.util.Vector; - - - -/** - * VSystemPoolModifiyDialog class represents VSystem Pool Modify Dialog. -**/ - -class VSystemPoolModifyDialog extends JDialog - implements ActionListener, WindowListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - //MRI start. - private static final String invalidInputText_ = ResourceLoader.getText ("DLG_INVALID_INPUT")+": "; - - private static final String maximumFalutsText_ = ResourceLoader.getText ("SYSTEM_POOL_MAXIMUM_FAULTS")+": "; - private static final String maximumPoolSizeText_ = ResourceLoader.getText ("SYSTEM_POOL_MAXIMUM_POOL_SIZE")+": "; - private static final String messageLoggingText_ = ResourceLoader.getText ("SYSTEM_POOL_MESSAGE_LOGGING")+": "; - private static final String minimumFaultsText_ = ResourceLoader.getText ("SYSTEM_POOL_MINIMUM_FAULTS")+": "; - private static final String minimumPoolSizeText_ = ResourceLoader.getText ("SYSTEM_POOL_MINIMUM_POOL_SIZE")+": "; - private static final String newActivityLevelText_ = ResourceLoader.getText ("SYSTEM_POOL_ACTIVITY_LEVEL")+": "; - private static final String newPoolSizeText_ = ResourceLoader.getText ("SYSTEM_POOL_POOL_SIZE")+": "; - private static final String pagingOptionText_ = ResourceLoader.getText ("SYSTEM_POOL_PAGING_OPTION")+": "; - private static final String perThreadFaultsText_ = ResourceLoader.getText ("SYSTEM_POOL_PERTHREADS_FAULTS")+": "; - private static final String priorityText_ = ResourceLoader.getText ("SYSTEM_POOL_PRIORITY")+": "; - private static final String systemPoolIdentifierText_ = ResourceLoader.getText ("SYSTEM_POOL_IDENTIFIER")+": "; - private static final String title_ = ResourceLoader.getText ("DLG_MODIFY"); //@D1A - //MRI end - - private static final String same_ = "*SAME"; - private static final String calc_ = "*CALC"; - - // Added event support. - private ErrorEventSupport errorEventSupport_ = new ErrorEventSupport(this); - private WorkingEventSupport workingEventSupport_ = new WorkingEventSupport(this); //@B1A - - // The system pool object. - private SystemPool sysPool_ = null; - - // The text field used to display the system pool identifier. - private String sysPoolID_ = ""; - - // The text field used to modify the new pool size. - private JTextField sysPoolNewPoolSiz_ = null; - - // The text field used to modify the new pool activity level. - private JComboBox sysPoolNewPoolActLev_ = null; - - // The Choice used to decide whether to log the change messages or not. - private JComboBox sysPoolMesLog_ = null; - - // The Choice used to decide whether the system should dynamically adjust - // the paging characteristics of the storage pool for optimum performance. - private JComboBox sysPoolPagOpt_ = null; - - // The text field used to modify the priority of this pool. - private JComboBox sysPoolPri_ = null; - - // The text field used to modify the minimum amount of storage - // to this storage pool. - private JComboBox sysPoolMinPoolSiz_ = null; - - // The text field used to modify the maximum amount of storage - // to this storage pool. - private JComboBox sysPoolMaxPoolSiz_ = null; - - // The text field used to modify the minimum faults-per-second - // guideline to use for this storage pool. - private JComboBox sysPoolMinFau_ = null; - - // The text field used to modify the faults per second for each - // active thread in this storage pool. - private JComboBox sysPoolPerThrFau_ = null; - - // The text field used to modify the maximum faults-per-second - // guideline to use for this storage pool. - private JComboBox sysPoolMaxFau_ = null; - - - // The "Apply", "Cancel" and "Ok" button. - private JButton applyButton_ = null; - private JButton cancelButton_ = null; - private JButton okButton_ = null; - - - private boolean isMachinePool_; //@B2A - indicates if this system pool is *MACHINE - - - /** - * Constructs a VSystemPoolModifyDialog object. - * - * @param frame The frame. - * @param sysPool The SystemPool object. - **/ - public VSystemPoolModifyDialog(Frame frame, SystemPool sysPool) - { - super(frame, title_, true); - sysPool_ = sysPool; - //@B2 - see CPF1165 for the values that aren't allowed to be set when pool is *MACHINE - isMachinePool_ = sysPool_.getPoolName().trim().equalsIgnoreCase("*MACHINE"); //@B2A - init(); - } - - /** - * The action is performed. - * - * @param event The action event. - **/ - public void actionPerformed(ActionEvent e) - { - Object aSource = e.getSource(); - - if(aSource == okButton_) - { - if(!applyButton_.isEnabled()) - dispose(); - else - if (setChanges()) - dispose(); - } - else if(aSource == applyButton_) - { - if(setChanges()) - { - applyButton_.setEnabled(false); - } - } - else if(aSource == cancelButton_) - { - dispose(); - } - sysPool_.refreshCache(); //@B3A better reload our information - } - - /** - * Adds a listener to be notified when an error occurs. - * - * @param listener The listener. - **/ - public void addErrorListener(ErrorListener listener) - { - if (listener == null) throw new NullPointerException("listener"); - errorEventSupport_.addErrorListener(listener); - } - - /** - * Adds a listener to be notified when work starts and stops on - * potentially long-running operations. - * - * @param listener The listener. - **/ - public void addWorkingListener(WorkingListener listener) - { - if (listener == null) throw new NullPointerException("listener"); - workingEventSupport_.addWorkingListener(listener); - } - - /** - * Returns the main pane. - * - * @return The main pane. - **/ - private JPanel getMainPane() - { - JPanel p = new JPanel(); - GridBagLayout layout = new GridBagLayout(); - p.setLayout(layout); - p.setBorder(((Border) new EmptyBorder( 5, 5, 5, 5) )); - - int index = 0; - - // System pool identifier. - VUtilities.constrain (systemPoolIdentifierText_, - sysPoolID_, - p, layout, index++); - - // New pool size. - VUtilities.constrain ((Component) new JLabel(newPoolSizeText_), - (Component) sysPoolNewPoolSiz_, - p, layout, index++); - - // New pool activity level. - VUtilities.constrain ((Component) new JLabel(newActivityLevelText_), - (Component) sysPoolNewPoolActLev_, - p, layout, index++); - - // Message logging. - VUtilities.constrain ((Component) new JLabel(messageLoggingText_), - (Component) sysPoolMesLog_, - p, layout, index++); - - // Paging option. - VUtilities.constrain ((Component) new JLabel(pagingOptionText_), - (Component) sysPoolPagOpt_, - p, layout, index++); - - // Priority. - VUtilities.constrain ((Component) new JLabel(priorityText_), - (Component) sysPoolPri_, - p, layout, index++); - - // Minimum pool size. - VUtilities.constrain ((Component) new JLabel(minimumPoolSizeText_), - (Component) sysPoolMinPoolSiz_, - p, layout, index++); - - // Maximum pool size. - VUtilities.constrain ((Component) new JLabel(maximumPoolSizeText_), - (Component) sysPoolMaxPoolSiz_, - p, layout, index++); - - // Minimum faults - VUtilities.constrain ((Component) new JLabel(minimumFaultsText_), - (Component) sysPoolMinFau_, - p, layout, index++); - - // Per-thread faults. - VUtilities.constrain ((Component) new JLabel(perThreadFaultsText_), - (Component) sysPoolPerThrFau_, - p, layout, index++); - - // Maximum faults. - VUtilities.constrain ((Component) new JLabel(maximumFalutsText_), - (Component) sysPoolMaxFau_, - p, layout, index++); - - return p; - } - - /** - * This listener will enable the apply button when a component's - * value is changed by either selecting a different one from the - * drop-down list, or by typing a new value. - **/ - private class VSPMDListener implements KeyListener, ItemListener - { - VSPMDListener() {} - VSPMDListener(JComboBox box) - { - box.addItemListener(this); - box.getEditor().getEditorComponent().addKeyListener(this); // this line makes it possible to receive events when user types in a combo box - } - public void itemStateChanged(ItemEvent event) - { - applyButton_.setEnabled(true); - } - public void keyPressed(KeyEvent event) - { - applyButton_.setEnabled(true); - } - public void keyReleased(KeyEvent event) {} - public void keyTyped(KeyEvent event) {} - } - - /** - * Initializes the transient data. - **/ - private void init() - { - try //@B1A - { - sysPoolID_ = Integer.toString(sysPool_.getPoolIdentifier()); - VSPMDListener listener = null; - - // New pool size. - sysPoolNewPoolSiz_ = new JTextField(); - String currentPoolSizeStr = String.valueOf(sysPool_.getPoolSize()); - sysPoolNewPoolSiz_.setText(currentPoolSizeStr); - - if(sysPool_.getPoolName().trim().equals("*BASE")) - sysPoolNewPoolSiz_.setEditable(false); - else - sysPoolNewPoolSiz_.setEditable(true); - sysPoolNewPoolSiz_.addKeyListener(new VSPMDListener()); - - // New pool activity level. - sysPoolNewPoolActLev_ = new JComboBox(); - sysPoolNewPoolActLev_.addItem(same_); - sysPoolNewPoolActLev_.setSelectedItem(same_); - if(isMachinePool_) //@B2C - { - sysPoolNewPoolActLev_.setEditable(false); - sysPoolNewPoolActLev_.setEnabled(false); - } - else - { - sysPoolNewPoolActLev_.setEditable(true); - sysPoolNewPoolActLev_.setEnabled(true); - } - listener = new VSPMDListener(sysPoolNewPoolActLev_); - - // Message logging. - sysPoolMesLog_ = new JComboBox(); - sysPoolMesLog_.setEditable(false); - sysPoolMesLog_.addItem(ResourceLoader.getText("DLG_YES")); //@C0C - sysPoolMesLog_.addItem(ResourceLoader.getText("DLG_NO")); //@C0C - sysPoolMesLog_.setSelectedItem(ResourceLoader.getText("DLG_YES")); //@C0C - listener = new VSPMDListener(sysPoolMesLog_); - - // Paging option. - sysPoolPagOpt_ = new JComboBox(); - sysPoolPagOpt_.setEditable(false); - String currentPagingOption = sysPool_.getPagingOption().trim(); - if( (!currentPagingOption.equals("*FIXED")) && - (!currentPagingOption.equals("*CALC"))) - { - sysPoolPagOpt_.addItem(currentPagingOption); - } - sysPoolPagOpt_.addItem("*FIXED"); - sysPoolPagOpt_.addItem("*CALC"); - sysPoolPagOpt_.setSelectedItem(currentPagingOption); - if (isMachinePool_) //@B2A - { //@B2A - sysPoolPagOpt_.setEnabled(false); //@B2A - } //@B2A - listener = new VSPMDListener(sysPoolPagOpt_); - - // Priority. - sysPoolPri_ = new JComboBox(); - if(isMachinePool_) //@B2C - { - sysPoolPri_.addItem("1"); - sysPoolPri_.setSelectedItem("1"); - sysPoolPri_.setEditable(false); - sysPoolPri_.setEnabled(false); - } - else - { - sysPoolPri_.addItem(same_); - sysPoolPri_.addItem(calc_); - sysPoolPri_.setEditable(true); - sysPoolPri_.setEnabled(true); - } - listener = new VSPMDListener(sysPoolPri_); - - // Minimum pool size. - sysPoolMinPoolSiz_ = new JComboBox(); - sysPoolMinPoolSiz_.setEditable(true); - sysPoolMinPoolSiz_.addItem(same_); - sysPoolMinPoolSiz_.addItem(calc_); - sysPoolMinPoolSiz_.setSelectedItem(same_); - listener = new VSPMDListener(sysPoolMinPoolSiz_); - - // Maximum pool size. - sysPoolMaxPoolSiz_ = new JComboBox(); - sysPoolMaxPoolSiz_.setEditable(true); - sysPoolMaxPoolSiz_.addItem(same_); - sysPoolMaxPoolSiz_.addItem(calc_); - sysPoolMaxPoolSiz_.setSelectedItem(same_); - listener = new VSPMDListener(sysPoolMaxPoolSiz_); - - // Minimum faults - sysPoolMinFau_ = new JComboBox(); - sysPoolMinFau_.setEditable(true); - sysPoolMinFau_.addItem(same_); - sysPoolMinFau_.addItem(calc_); - sysPoolMinFau_.setSelectedItem(same_); - listener = new VSPMDListener(sysPoolMinFau_); - - // Per-thread faults. - sysPoolPerThrFau_ = new JComboBox(); - sysPoolPerThrFau_.setEditable(true); - sysPoolPerThrFau_.addItem(same_); - sysPoolPerThrFau_.addItem(calc_); - sysPoolPerThrFau_.setSelectedItem(same_); - listener = new VSPMDListener(sysPoolPerThrFau_); - - // Maximum faults. - sysPoolMaxFau_ = new JComboBox(); - sysPoolMaxFau_.setEditable(true); - sysPoolMaxFau_.addItem(same_); - sysPoolMaxFau_.addItem(calc_); - sysPoolMaxFau_.setSelectedItem(same_); - listener = new VSPMDListener(sysPoolMaxFau_); - - okButton_ = new JButton(ResourceLoader.getText("DLG_OK")); - cancelButton_ = new JButton(ResourceLoader.getText("DLG_CANCEL")); - applyButton_ = new JButton(ResourceLoader.getText("DLG_APPLY")); - applyButton_.setEnabled(false); - - okButton_.addActionListener(this); - cancelButton_.addActionListener(this); - applyButton_.addActionListener(this); - addWindowListener(this); - - // Arrange components - JPanel buttonsPane = new JPanel(); - buttonsPane.add(okButton_); - buttonsPane.add(cancelButton_); - buttonsPane.add(applyButton_); - - Container c = getContentPane(); - c.add("North", getMainPane()); - c.add("South", buttonsPane); - pack(); - } - catch(Exception e) //@B1A - { - Trace.log(Trace.ERROR, "Unable to create VSystemPoolModifyDialog.", e); //@B1A - errorEventSupport_.fireError(e); //@B1A - } - } - - /** - * Removes an error listener. - * - * @param listener The listener. - **/ - public void removeErrorListener(ErrorListener listener) - { - if (listener == null) throw new NullPointerException("listener"); - errorEventSupport_.removeErrorListener(listener); - } - - /** - * Removes a working listener. - * - * @param listener The listener. - **/ - public void removeWorkingListener(WorkingListener listener) - { - if (listener == null) throw new NullPointerException("listener"); - workingEventSupport_.removeWorkingListener(listener); - } - - - /** - * Returns if the changes are set successfully. - * - * @return If the changes are set successfully. - **/ - private boolean setChanges() - { - workingEventSupport_.fireStartWorking(); - boolean caching = sysPool_.isCaching(); - sysPool_.setCaching(true); - try - { - String txt; - - // System pool size. - txt = sysPoolNewPoolSiz_.getText().trim(); - if (!txt.equals(same_) && txt.length() > 0) - sysPool_.setPoolSize(Integer.parseInt(txt)); - - // Pool activity level. - if (!isMachinePool_) //@B2A - CPF1165 occurs - { //@B2A - txt = sysPoolNewPoolActLev_.getSelectedItem().toString().trim(); - if (!txt.equals(same_) && txt.length() > 0) - sysPool_.setPoolActivityLevel(Integer.parseInt(txt)); - } //@B2A - - // Message logging. - txt = sysPoolMesLog_.getSelectedItem().toString(); - sysPool_.setMessageLogging(txt.equals(ResourceLoader.getText("DLG_YES"))); // default is "Y", no *SAME @C0C - - // Paging option. - if (!isMachinePool_) //@B2A - will get CPF1880 if we set this and we're *MACHINE - { //@B2A - txt = sysPoolPagOpt_.getSelectedItem().toString(); - sysPool_.setPagingOption(txt); // only have 3 choices, all are valid - } //@B2A - - // Pool priority. - if (!isMachinePool_) //@B2A - { //@B2A - txt = sysPoolPri_.getSelectedItem().toString().trim(); - if (txt.equals(calc_)) - sysPool_.setPriority(SystemPool.CALCULATE_INT); - else if (!txt.equals(same_) && txt.length() > 0) - sysPool_.setPriority(Integer.parseInt(txt)); - } //@B2A - - // Minimum pool size. - txt = sysPoolMinPoolSiz_.getSelectedItem().toString().trim(); - if (txt.equals(calc_)) - sysPool_.setMinimumPoolSize(SystemPool.CALCULATE); - else if (!txt.equals(same_) && txt.length() > 0) - sysPool_.setMinimumPoolSize(Float.valueOf(txt).floatValue()); - - // Maximum pool size. - txt = sysPoolMaxPoolSiz_.getSelectedItem().toString().trim(); - if (txt.equals(calc_)) - sysPool_.setMaximumPoolSize(SystemPool.CALCULATE); - else if (!txt.equals(same_) && txt.length() > 0) - sysPool_.setMaximumPoolSize(Float.valueOf(txt).floatValue()); - - // Minimum faults. - txt = sysPoolMinFau_.getSelectedItem().toString().trim(); - if (txt.equals(calc_)) - sysPool_.setMinimumFaults(SystemPool.CALCULATE); - else if (!txt.equals(same_) && txt.length() > 0) - sysPool_.setMinimumFaults(Float.valueOf(txt).floatValue()); - - // Per thread faults. - txt = sysPoolPerThrFau_.getSelectedItem().toString().trim(); - if (txt.equals(calc_)) - sysPool_.setPerThreadFaults(SystemPool.CALCULATE); - else if (!txt.equals(same_) && txt.length() > 0) - sysPool_.setPerThreadFaults(Float.valueOf(txt).floatValue()); - - // Maximum faults. - txt = sysPoolMaxFau_.getSelectedItem().toString().trim(); - if (txt.equals(calc_)) - sysPool_.setMaximumFaults(SystemPool.CALCULATE); - else if (!txt.equals(same_) && txt.length() > 0) - sysPool_.setMaximumFaults(Float.valueOf(txt).floatValue()); - - sysPool_.commitCache(); - - workingEventSupport_.fireStopWorking(); - sysPool_.setCaching(caching); // reset the caching behavior - sysPool_.refreshCache(); // better reload our information - } - catch(Exception e) - { - workingEventSupport_.fireStopWorking(); - sysPool_.setCaching(caching); // reset the caching behavior - sysPool_.refreshCache(); //@B3A better reload our information - if (Trace.isTraceOn()) Trace.log(Trace.ERROR, "Unable to set values in VSystemPoolModifyDialog.", e); - errorEventSupport_.fireError(e); - return false; - } - return true; - } - - - - /** - * Invoked when a potentially long-running unit of work is about to begin. - * - * @param event The event. - **/ - public void startWorking(WorkingEvent event) - { - workingEventSupport_.startWorking(event); - } - - /** - * Invoked when a potentially long-running unit of work has completed. - * - * @param event The event. - **/ - public void stopWorking(WorkingEvent event) - { - workingEventSupport_.stopWorking(event); - } - - /** - * The window is activated. - * - * @param event The window event. - **/ - public void windowActivated(WindowEvent e) - { - return; - } - - /** - * The window is closed. - * - * @param event The window event. - **/ - public void windowClosed(WindowEvent e) - { -//@B0: This was causing an infinite loop when the window was -// closed by the cancel button. When the cancel button was -// pressed, we call dispose(), which in turn, calls this method. -// Which calls dispose(). Which calls this method. You get the -// point. -// Note that clicking the 'X' in the upper right corner to close -// the window is not affected by this change, since doing that -// calls windowClosing(), not windowClosed(). -//@B0D if(e.getSource() == this) -//@B0D dispose(); -//@B0D return; - } - - /** - * The window is closing. - * - * @param event The window event. - **/ - public void windowClosing(WindowEvent e) - { - if(e.getSource() == this) - dispose(); - return; - } - - /** - * The window is deactivated. - * - * @param event The window event. - **/ - public void windowDeactivated(WindowEvent e) - { - return; - } - - /** - * The window is deiconified. - * - * @param event The window event. - **/ - public void windowDeiconified(WindowEvent e) - { - return; - } - - /** - * The window is iconified. - * - * @param event The window event. - **/ - public void windowIconified(WindowEvent e) - { - return; - } - - /** - * The window is opened. - * - * @param event The window event. - **/ - public void windowOpened(WindowEvent e) - { - return; - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VSystemStatus.java b/cvsroot/src/com/ibm/as400/vaccess/VSystemStatus.java deleted file mode 100644 index e1266c96a..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VSystemStatus.java +++ /dev/null @@ -1,825 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VSystemStatus.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.SystemPool; -import com.ibm.as400.access.SystemStatus; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.AS400Exception; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.ConnectionDroppedException; -import com.ibm.as400.access.ErrorCompletingRequestException; -import com.ibm.as400.access.ObjectDoesNotExistException; - - -import javax.swing.Icon; -import javax.swing.SwingConstants; -import javax.swing.table.DefaultTableColumnModel; -import javax.swing.table.TableCellRenderer; -import javax.swing.table.TableColumn; -import javax.swing.table.TableColumnModel; -import javax.swing.tree.TreeNode; - -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyVetoException; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.util.Enumeration; - -/** - * The VSystemStatus class defines the representation of system status on a - * system for use in various models and panes in this package. - * The method load() must be explicitly called to load the information from - * the system. - - *

    Most errors are reported as ErrorEvents rather than throwing exceptions. - * Users should listen for ErrorEvents in order to diagnose and recover - * from error conditions. - * - *

    VSystemStatus objects generate the following events: - *

      - *
    • ErrorEvent - *
    • PropertyChangeEvent - *
    • VObjectEvent - *
    • WorkingEvent - *
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VSystemStatus implements VNode, Serializable //@B0C -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Static data. - private static TableColumnModel detailsColumnModel_ = null; - - // MRI. - private static String description_ = - ResourceLoader.getText ("SYSTEM_STATUS_SYSTEM_STATUS"); - - private static final Icon icon16_ = - ResourceLoader.getIcon ("VSystemStatus16.gif", description_); - - private static final Icon icon32_ = - ResourceLoader.getIcon ("VSystemStatus32.gif", description_); - - private static String nameColumnHeader_ = - ResourceLoader.getText ("SYSTEM_POOL_POOL_NAME"); - - private static String descriptionColumnHeader_ = - ResourceLoader.getText ("SYSTEM_POOL_POOL_DESCRIPTION"); - - private static String identifierColumnHeader_ = - ResourceLoader.getText ("SYSTEM_POOL_IDENTIFIER"); - - private static String poolSizeColumnHeader_ = - ResourceLoader.getText ("SYSTEM_POOL_POOL_SIZE"); - - private static String reservedSizeColumnHeader_ = - ResourceLoader.getText ("SYSTEM_POOL_RESERVED_SIZE"); - // MRI - bottom. - - private SystemStatus systemStatus_ = null; - private VNode parent_ = null; - private boolean allowModifyAllPools_ = false; - - transient private VObject[] detailsChildren_; - transient private Enumeration enum_; - transient private int loaded_; - transient private VPropertiesPane propertiesPane_; - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - transient private VObjectEventSupport objectEventSupport_; - transient private WorkingEventSupport workingEventSupport_; - - // Static initializer. - static - { - // The column widths are completely arbitrary. - detailsColumnModel_= null; - detailsColumnModel_= new DefaultTableColumnModel(); - int i= 0; - - VTableColumn vTable1= new VTableColumn(i++, VSystemPool.IDENTIFIER_PROPERTY); - vTable1.setCellRenderer(((TableCellRenderer)new VObjectCellRenderer())); - vTable1.setHeaderRenderer(((TableCellRenderer)new VObjectHeaderRenderer())); - vTable1.setHeaderValue(identifierColumnHeader_); - vTable1.setPreferredCharWidth(5); - detailsColumnModel_.addColumn(((TableColumn)vTable1)); - - VTableColumn vTable2= new VTableColumn(i++, VSystemPool.POOL_SIZE_PROPERTY); - vTable2.setCellRenderer(((TableCellRenderer)new VObjectCellRenderer())); - vTable2.setHeaderRenderer(((TableCellRenderer)new VObjectHeaderRenderer())); - vTable2.setHeaderValue(poolSizeColumnHeader_); - vTable2.setPreferredCharWidth(8); - detailsColumnModel_.addColumn(((TableColumn)vTable2)); - - VTableColumn vTable3= new VTableColumn(i++, VSystemPool.RESERVED_SIZE_PROPERTY); - vTable3.setCellRenderer(((TableCellRenderer)new VObjectCellRenderer())); - vTable3.setHeaderRenderer(((TableCellRenderer)new VObjectHeaderRenderer())); - vTable3.setHeaderValue(reservedSizeColumnHeader_); - vTable3.setPreferredCharWidth(8); - detailsColumnModel_.addColumn(((TableColumn)vTable3)); - - VTableColumn vTable4= new VTableColumn(i++, NAME_PROPERTY); - vTable4.setCellRenderer(((TableCellRenderer)new VObjectCellRenderer())); - vTable4.setHeaderRenderer(((TableCellRenderer)new VObjectHeaderRenderer())); - vTable4.setHeaderValue(nameColumnHeader_); - vTable4.setPreferredCharWidth(10); - detailsColumnModel_.addColumn(((TableColumn)vTable4)); - - VTableColumn vTable5= new VTableColumn(i++, DESCRIPTION_PROPERTY); - vTable5.setCellRenderer(((TableCellRenderer)new VObjectCellRenderer())); - vTable5.setHeaderRenderer(((TableCellRenderer)new VObjectHeaderRenderer())); - vTable5.setHeaderValue(descriptionColumnHeader_); - vTable5.setPreferredCharWidth(50); - detailsColumnModel_.addColumn(((TableColumn)vTable5)); - } - - /** - * Constructs a VSystemStatus object. - * @exception AS400Exception If the system returns an error - message. - * @exception AS400SecurityException If a security or authority error - occurs. - * @exception ConnectionDroppedException If the connection is dropped - unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - the system. - * @exception ObjectDoesNotExistException If the system object does not - exist. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - not supported. - **/ - public VSystemStatus() - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException, - UnsupportedEncodingException, - PropertyVetoException - - { - systemStatus_ = new SystemStatus (); - initializeTransient (); - } - - - /** - * Constructs a VSystemStatus object. - * - * @param system The system in which the system status information - * resides. - * @exception AS400Exception If the system returns an error - message. - * @exception AS400SecurityException If a security or authority error - occurs. - * @exception ConnectionDroppedException If the connection is dropped - unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - the system. - * @exception ObjectDoesNotExistException If the system object does not - exist. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - not supported. - **/ - public VSystemStatus (AS400 system) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException, - UnsupportedEncodingException, - PropertyVetoException - { - if (system == null) - throw new NullPointerException ("system"); - - systemStatus_ = new SystemStatus (system); - - initializeTransient (); - } - - - - /** - * Constructs a VSystemStatus object. - * - * @param systemStatus The underlying system status object. - * @exception AS400Exception If the system returns an error - message. - * @exception AS400SecurityException If a security or authority error - occurs. - * @exception ConnectionDroppedException If the connection is dropped - unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - the system. - * @exception ObjectDoesNotExistException If the system object does not - exist. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - not supported. - **/ - public VSystemStatus(SystemStatus systemStatus) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException, - UnsupportedEncodingException, - PropertyVetoException - { - systemStatus_ = systemStatus; - initializeTransient(); - } - - /** - * Constructs a VSystemStatus object. - * - * @param parent The parent. - * @param system The system from which the user will be retrieved. - * @exception AS400Exception If the system returns an error - message. - * @exception AS400SecurityException If a security or authority error - occurs. - * @exception ConnectionDroppedException If the connection is dropped - unexpectedly. - * @exception ErrorCompletingRequestException If an error occurs before - the request is completed. - * @exception InterruptedException If this thread is interrupted. - * @exception IOException If an error occurs while communicating with - the system. - * @exception ObjectDoesNotExistException If the system object does not - exist. - * @exception PropertyVetoException If the change is vetoed. - * @exception UnsupportedEncodingException If the character encoding is - not supported. - **/ - public VSystemStatus (VNode parent, AS400 system) - throws AS400Exception, - AS400SecurityException, - ConnectionDroppedException, - ErrorCompletingRequestException, - InterruptedException, - ObjectDoesNotExistException, - IOException, - UnsupportedEncodingException, - PropertyVetoException - { - if (parent == null) - throw new NullPointerException ("parent"); - if (system == null) - throw new NullPointerException ("system"); - - parent_ = parent; - - systemStatus_ = new SystemStatus (system); - - initializeTransient (); - } - - /** - * Adds a listener to be notified when an error occurs. - * - * @param listener The listener. - **/ - public void addErrorListener (ErrorListener listener) - { - if (listener == null) //@B0A - throw new NullPointerException("listener"); //@B0A - errorEventSupport_.addErrorListener (listener); - } - - /** - * Adds a listener to be notified when the value of any - * bound property changes. - * - * @param listener The listener. - **/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - if (listener == null) //@B0A - throw new NullPointerException("listener"); //@B0A - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - /** - * Adds a listener to be notified when the value of any - * constrained property changes. - * - * @param listener The listener. - **/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - if (listener == null) //@B0A - throw new NullPointerException("listener"); //@B0A - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - /** - * Adds a listener to be notified when a VObject is changed, - * created, or deleted. - * - * @param listener The listener. - **/ - public void addVObjectListener (VObjectListener listener) - { - if (listener == null) //@B0A - throw new NullPointerException("listener"); //@B0A - objectEventSupport_.addVObjectListener (listener); - } - - /** - * Adds a listener to be notified when work starts and stops - * on potentially long-running operations. - * - * @param listener The listener. - **/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - /** - * Returns the children of the node. - * - * @return The children. - **/ - public Enumeration children () - { - return new VEnumeration (this); - } - - - /** - * Returns the list of actions that can be performed. - * - * @return Always null. There are no actions. - **/ - public VAction[] getActions () - { - return null; - } - - /** - * Indicates if the node allows children. - * - * @return Always false. - **/ - public boolean getAllowsChildren () - { - return false; - } - - /** - * Returns the child node at the specified index. - * - * @param index The index. - * @return Always null. - **/ - public TreeNode getChildAt (int index) - { - return null; - } - - /** - * Returns the number of children. - * - * @return Always 0. - **/ - public /*@B0D synchronized */ int getChildCount () - { - return 0; - } - - /** - * Returns the default action. - * - * @return Always null. There is no default action. - **/ - public VAction getDefaultAction () - { - return null; - } - - /** - * Returns the child for the details at the specified index. - * - * @param index The index. - * @return The child, or null if the index is not valid. - **/ - public VObject getDetailsChildAt (int index) - { - if ((index < 0) || (index >= detailsChildren_.length)) - return null; - - loadMore (index); - return detailsChildren_[index]; - } - - /** - * Returns the number of children for the details. - * - * @return The number of children for the details. - **/ - public /*@B0D synchronized */ int getDetailsChildCount () - { - return detailsChildren_.length; - } - - /** - * Returns the table column model to use in the details when - * representing the children. - * This column model describes the details values for the children. - * - * @return The details column model. - **/ - public TableColumnModel getDetailsColumnModel () - { - return detailsColumnModel_; - } - - /** - * Returns the index of the specified child for the details. - * - * @param detailsChild The details child. - * @return The index, or -1 if the child is not found - * in the details. - **/ - public /*@B0D synchronized */ int getDetailsIndex (VObject detailsChild) - { - for (int i = 0; i < loaded_; ++i) - if (detailsChildren_[i] == detailsChild) - return i; - return -1; - } - - /** - * Returns the icon. - * - * @param size The icon size, either 16 or 32. If any other - * value is given, then return a default. - * @param open This parameter has no effect. - * @return The icon. - **/ - public Icon getIcon (int size, boolean open) - { - if (size == 32) - return icon32_; - else - return icon16_; - } - - /** - * Returns the index of the specified child. - * - * @param child The child. - * @return Always -1. - **/ - public /*@B0D synchronized */ int getIndex (TreeNode child) - { - return -1; - } - - /** - * Returns the parent node. - * - * @return The parent node, or null if there is no parent. - **/ - public TreeNode getParent () - { - return parent_; - } - - /** - * Returns the properties pane. - * - * @return The properties pane. - **/ - public VPropertiesPane getPropertiesPane () - { - return propertiesPane_; - } - - /** - * Returns a property value. - * - * @param object The property identifier. - * @return The property value, or null if the - * property identifier is not recognized. - **/ - public Object getPropertyValue(Object object) - { - return null; - } - - /** - * Returns the system in which the system status information resides. - * - * @return The system in which the system status information resides. - * - * @see com.ibm.as400.access.SystemStatus#getSystem - **/ - public AS400 getSystem () - { - return systemStatus_.getSystem (); - } - - /** - * Returns the description text. - * - * @return The description text. - **/ - public String getText () - { - return description_; - } - - /** - * Initializes the transient data. - **/ - private synchronized void initializeTransient () - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - objectEventSupport_ = new VObjectEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - workingEventSupport_ = new WorkingEventSupport (this); - - systemStatus_.addPropertyChangeListener (propertyChangeSupport_); //@B0C - systemStatus_.addVetoableChangeListener (vetoableChangeSupport_); - // Initialize the private data. - detailsChildren_ = new VObject[0]; - enum_ = null; - loaded_ = -1; - } - - /** - * Return true if the modify action to all system pools is allowed, otherwise false. - * - * @return True if the modify action to all system pools is allowed, otherwise false. - **/ - public boolean isAllowModifyAllPools() - { - return allowModifyAllPools_; - } - - /** - * Indicates if the node is a leaf. - * - * @return Always true. - **/ - public boolean isLeaf () - { - return true; - } - - /** - * Indicates if the details children are sortable. - * - * @return Always false. - **/ - public boolean isSortable () - { - return false; - } - - /** - * Loads information about the object from the system. - **/ - public void load () - { - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) //@B0C - Trace.log(Trace.INFORMATION, "VSystemStatus: loading"); //@B0C - - workingEventSupport_.fireStartWorking (); - - Exception error = null; - synchronized (this) { - // Stop listening to the previous children. - for (int i = 0; i < loaded_; ++i) - { - detailsChildren_[i].removeErrorListener (errorEventSupport_); - detailsChildren_[i].removeVObjectListener (objectEventSupport_); - detailsChildren_[i].removeWorkingListener (workingEventSupport_); - } - - // Refresh the children based on the user list. - loaded_ = 0; - try - { - systemStatus_.refreshCache(); //@B0A //@B0C - 06/17/1999 - enum_ = systemStatus_.getSystemPools(); - - detailsChildren_ = new VSystemPool[systemStatus_.getPoolsNumber()]; - - } - catch (Exception e) - { - error = e; - detailsChildren_ = new VSystemPool[0]; - } - } - if (error != null) - errorEventSupport_.fireError (error); - - workingEventSupport_.fireStopWorking (); - } - - /** - * Loads more messages from the enumeration, if needed. - * - * @param index The index needed. - **/ - private void loadMore (int index) - { - if (index >= loaded_) - { - - workingEventSupport_.fireStartWorking (); - - Exception error = null; - synchronized (this) { - - for (int i = loaded_; i <= index; ++i) - { - SystemPool systemPool = (SystemPool) enum_.nextElement (); - - VSystemPool vSystemPool = new VSystemPool (systemPool); - vSystemPool.setAllowModify(allowModifyAllPools_); - detailsChildren_[i] = vSystemPool; - detailsChildren_[i].addErrorListener (errorEventSupport_); - detailsChildren_[i].addVObjectListener (objectEventSupport_); - detailsChildren_[i].addWorkingListener (workingEventSupport_); - } - } - - loaded_ = index + 1; - - if (error != null) - errorEventSupport_.fireError (error); - - workingEventSupport_.fireStopWorking (); - } - } - - - /** - * Restores the state of the object from an input stream. - * This is used when deserializing an object. - * - * @param in The input stream. - **/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - /** - * Removes an error listener. - * - * @param listener The listener. - **/ - public void removeErrorListener (ErrorListener listener) - { - if (listener == null) //@B0A - throw new NullPointerException("listener"); //@B0A - errorEventSupport_.removeErrorListener (listener); - } - - /** - * Removes a property change listener. - * - * @param listener The listener. - **/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - if (listener == null) //@B0A - throw new NullPointerException("listener"); //@B0A - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - /** - * Removes a vetoable change listener. - * - * @param listener The listener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) //@B0A - throw new NullPointerException("listener"); //@B0A - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - /** - * Removes a VObjectListener. - * - * @param listener The listener. - **/ - public void removeVObjectListener (VObjectListener listener) - { - if (listener == null) //@B0A - throw new NullPointerException("listener"); //@B0A - objectEventSupport_.removeVObjectListener (listener); - } - - /** - * Removes a working listener. - * - * @param listener The listener. - **/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - /** - * Sets the system in which the system status information resides. - * - * @see com.ibm.as400.access.SystemStatus#setSystem - * @param system The system in which the system status information - * resides. - * @exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem (AS400 system) - throws PropertyVetoException //@B0C - { - systemStatus_.setSystem (system); - } - /** - * Set the state of modify action of all the pools. - * - * @param allow The boolean value. - **/ - public void setAllowModifyAllPools(boolean allow) - { - allowModifyAllPools_ = allow; - } - - /** - * Sorts the children for the details. Since sorting is not supported, - this method does nothing. - * - * @param propertyIdentifiers The property identifiers. - * @param orders The sort orders for each property identifier: - * true for ascending order; false for descending order. - **/ - public void sortDetailsChildren ( - Object[] propertyIdentifiers, boolean[] orders) - { - // No sorting here! - } - - /** - * Returns the string representation of the description. - * - * @return The string representation of the description. - **/ - public String toString () - { - return description_; - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VSystemStatus16.gif b/cvsroot/src/com/ibm/as400/vaccess/VSystemStatus16.gif deleted file mode 100644 index e14c270fc..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VSystemStatus16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VSystemStatus32.gif b/cvsroot/src/com/ibm/as400/vaccess/VSystemStatus32.gif deleted file mode 100644 index 7a31daaf1..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VSystemStatus32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VSystemStatusBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/VSystemStatusBeanInfo.java deleted file mode 100644 index 48df08b25..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VSystemStatusBeanInfo.java +++ /dev/null @@ -1,152 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VSystemStatusBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanInfo; -import java.beans.SimpleBeanInfo; -import java.beans.PropertyDescriptor; -import java.beans.EventSetDescriptor; -import java.beans.MethodDescriptor; -import java.beans.ParameterDescriptor; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.IndexedPropertyDescriptor; -import java.lang.Class; -import java.lang.reflect.Method; - -/** - * The VSystemStatusBeanInfo class provides bean - * information for the VSystemStatus class. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VSystemStatusBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private final static Class beanClass_ = VSystemStatus.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - // Static initializer. - static - { - try - { - // Events - String[] propertyChangeMethods = {"propertyChange"}; - EventSetDescriptor propertyChange = new EventSetDescriptor( - beanClass_, - "propertyChange", - java.beans.PropertyChangeListener.class, - propertyChangeMethods, - "addPropertyChangeListener", - "removePropertyChangeListener"); - - propertyChange.setDisplayName(ResourceLoader.getText - ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText - ("EVT_DESC_PROPERTY_CHANGE")); - - events_ = new EventSetDescriptor[] { propertyChange }; - - // Properties. - PropertyDescriptor system = new PropertyDescriptor ( - "system", beanClass_, - "getSystem", "setSystem"); - system.setBound (true); - system.setConstrained (true); - system.setDisplayName (ResourceLoader.getText("PROP_NAME_SYSTEM")); - system.setShortDescription (ResourceLoader.getText( - "PROP_DESC_SYSTEM")); - - properties_ = new PropertyDescriptor[] { system }; - } - catch (IntrospectionException e) - { - throw new Error(e.toString()); - } - } - - /** - * Returns the default event index. - * @return The default event index. - **/ - public int getDefaultEventIndex() - { - return 1; - } - - /** - * Returns the default property index. - * @return The default property index. - **/ - public int getDefaultPropertyIndex() - { - return 0; - } - - /** - * Returns the descriptors for all events. - * @return The descriptors for all events. - **/ - public EventSetDescriptor[] getEventSetDescriptors() - { - return events_; - } - - /** - * Returns an image for this bean's icon. - * @param icon The desired icon size and color. - * @return The image for the icon. - */ - public Image getIcon(int icon) - { - if(icon== BeanInfo.ICON_MONO_16x16) - { - java.awt.Image img = loadImage("VSystemStatus16.gif"); - return img; - } - else if(icon== BeanInfo.ICON_COLOR_16x16) - { - java.awt.Image img = loadImage("VSystemStatus16.gif"); - return img; - } - else if(icon == BeanInfo.ICON_MONO_32x32) - { - java.awt.Image img = loadImage("VSystemStatus32.gif"); - return img; - } - else if(icon == BeanInfo.ICON_COLOR_32x32) - { - java.awt.Image img = loadImage("VSystemStatus32.gif"); - return img; - } - return null; - } - - /** - * Returns the descriptors for all properties. - * @return The descriptors for all properties. - **/ - public PropertyDescriptor[] getPropertyDescriptors() - { - return properties_; - } - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VSystemStatusPane.java b/cvsroot/src/com/ibm/as400/vaccess/VSystemStatusPane.java deleted file mode 100644 index 399e38c54..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VSystemStatusPane.java +++ /dev/null @@ -1,629 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VSystemStatusPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.SystemStatus; -import com.ibm.as400.access.SystemPool; -import com.ibm.as400.access.AS400Exception; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.ConnectionDroppedException; -import com.ibm.as400.access.ErrorCompletingRequestException; -import com.ibm.as400.access.ObjectDoesNotExistException; - -import java.io.IOException; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; - - -import javax.swing.border.Border; -import javax.swing.border.EmptyBorder; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JOptionPane; -import javax.swing.ListSelectionModel; -import javax.swing.event.ListSelectionListener; -import javax.swing.table.TableColumnModel; -import javax.swing.table.TableModel; - -import java.awt.Component; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.BorderLayout; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.LayoutManager; - -import java.beans.PropertyVetoException; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeEvent; -import java.beans.VetoableChangeListener; - -import java.text.DateFormat; -import java.util.Date; -import java.util.Enumeration; - -/** - * The VSystemStatusPane class represents a visual pane which shows - * the system status information. -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VSystemStatusPane extends JPanel implements Serializable //@B0C -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - AS400DetailsPane detailsPane_; - private AS400 system_; - private SystemStatus systemStatus_; - private VSystemStatus vSystemStatus_; - private JLabel systemLabel_=new JLabel(); - private JLabel dateTimeLabel_=new JLabel(); - private JLabel utilizationLabel_=new JLabel(); - private JLabel systemASPLabel_=new JLabel(); - private JLabel systemASPUsedLabel_=new JLabel(); - private JLabel totalAuxiliaryStorageLabel_=new JLabel(); - private JLabel jobsInSystemLabel_=new JLabel(); - private JLabel batchJobsRunningLabel_=new JLabel(); - private JLabel usersCurrentlySignedOnLabel_=new JLabel(); - private boolean allowModifyAllPools_ = false; - - // Static data. - private static DateFormat dateFormat_ = DateFormat.getDateInstance(); - private static DateFormat timeFormat_ = DateFormat.getTimeInstance(); - - // MRI start. - private static final String systemStatusText_ - = ResourceLoader.getText ("SYSTEM_STATUS_SYSTEM_STATUS"); - private static final String systemText_ - = ResourceLoader.getText ("SYSTEM_STATUS_SYSTEM")+":"; - private static final String datetimeText_ - = ResourceLoader.getText ("SYSTEM_STATUS_DATE_TIME")+":"; - private static final String cpuText_ - = ResourceLoader.getText ("SYSTEM_STATUS_CPU"); - private static final String utilizationText_ - = " " + ResourceLoader.getText ("SYSTEM_STATUS_UTILIZATION")+":"; - private static final String auxiliaryStorageText_ - = ResourceLoader.getText ("SYSTEM_STATUS_AUXILIARY_STORAGE"); - private static final String systemAspText_ - = " " + ResourceLoader.getText ("SYSTEM_STATUS_SYSTEM_ASP")+":"; - private static final String systemAspUsedText_ - = " " + ResourceLoader.getText ("SYSTEM_STATUS_SYSTEM_ASP_USED")+":"; - private static final String totalAuxiliaryStorageText_ - = " " + ResourceLoader.getText ("SYSTEM_STATUS_TOTAL_AUXILIARY_STORAGE")+":"; - private static final String jobsText_ - = ResourceLoader.getText ("SYSTEM_STATUS_JOBS"); - private static final String jobsInSystemText_ - = " " + ResourceLoader.getText ("SYSTEM_STATUS_JOBS_IN_SYSTEM")+":"; - private static final String batchJobsRunningText_ - = " " + ResourceLoader.getText ("SYSTEM_STATUS_BATCH_JOBS_RUNNING")+":"; - private static final String usersText_ - = ResourceLoader.getText ("SYSTEM_STATUS_USERS"); - private static final String usersCurrentlySignedOnText_ - = " " + ResourceLoader.getText ("SYSTEM_STATUS_USERS_CURRENTLY_SIGNED_ON")+":"; - private static final String storagePoolsText_ - = ResourceLoader.getText ("SYSTEM_STATUS_STORAGE_POOLS"); - //MRI end - - private transient ErrorEventSupport errorEventSupport_; - private transient ListSelectionEventSupport listSelectionEventSupport_; - private transient PropertyChangeSupport propertyChangeSupport_; - - private transient VetoableChangeSupport vetoableChangeSupport_; - - private transient WorkingEventSupport workingEventSupport_; //@B0A - - /** - * Constructs a VSystemStatusPane object. - * - * @param system The system in which the system status information - * resides. - **/ - public VSystemStatusPane(AS400 system) - { - if (system == null) - throw new NullPointerException("system"); - system_ = system; - - GridBagLayout panelLayout = new GridBagLayout(); - setLayout(panelLayout); - setBorder(new EmptyBorder(10,10,10,10)); - - GridBagConstraints gbc = new GridBagConstraints(); //@B0A - VUtilities.constrain (getPanel0(), //@B0C - this, panelLayout, gbc, //@B0C - 0, 1, 1, 0, 1, 0, //@B0A - GridBagConstraints.NONE, //@B0A - GridBagConstraints.CENTER); //@B0A - VUtilities.constrain (getPanel1(), //@B0C - this, panelLayout, gbc, //@B0C - 0, 1, 1, 1, 1, 0, //@B0A - GridBagConstraints.NONE, //@B0A - GridBagConstraints.CENTER); //@B0A - VUtilities.constrain (new JLabel(storagePoolsText_), - this, panelLayout, gbc, //@B0C - 0, 1, 1, 2, 1, 0, //@B0A - GridBagConstraints.NONE, //@B0A - GridBagConstraints.WEST); //@B0A - VUtilities.constrain (getPanel2(), //@B0C - this, panelLayout, gbc, //@B0C - 0, 1, 1, 3, 1, 1, //@B0A - GridBagConstraints.BOTH, //@B0A - GridBagConstraints.CENTER); //@B0A - - initializeTransient(); - } - - /** - * Adds a listener to be notified when an error occurs. - * - * @param listener The listener. - **/ - public void addErrorListener( ErrorListener listener ) - { - if (listener == null) //@B0A - throw new NullPointerException("listener"); //@B0A - errorEventSupport_.addErrorListener(listener); - } - - /** - * Adds a listener to be notified when a list selection occurs in the - * details pane. - * - * @param listener The listener. - **/ - public void addListSelectionListener( ListSelectionListener listener ) - { - if (listener == null) //@B0A - throw new NullPointerException("listener"); //@B0A - listSelectionEventSupport_.addListSelectionListener(listener); - } - - /** - * Adds a listener to be notified when the value of any bound property - * changes. - * - * @param listener The listener. - **/ - public void addPropertyChangeListener( PropertyChangeListener listener ) - { - if (listener == null) //@B0A - throw new NullPointerException("listener"); //@B0A - - propertyChangeSupport_.addPropertyChangeListener(listener); - } - - /** - * Adds a listener to be notified when the value of any constrained - * property changes. - * - * @param listener The listener. - **/ - public void addVetoableChangeListener( VetoableChangeListener listener ) - { - if (listener == null) //@B0A - throw new NullPointerException("listener"); //@B0A - - vetoableChangeSupport_.addVetoableChangeListener(listener); - } - - - /** - * Returns the context in which actions will be performed. - * - * @return The context. - **/ - public VActionContext getActionContext() - { - return detailsPane_.getActionContext(); - } - - /** - * Returns the value indicating if actions can be invoked on objects. - * - * @return true if actions can be invoked; false otherwise. - **/ - public boolean getAllowActions() - { - return detailsPane_.getAllowActions(); - } - - /** - * Returns the column model that is used to maintain the columns - * of the details. - * - * @return The column model. - **/ - public TableColumnModel getDetailsColumnModel() - { - return detailsPane_.getColumnModel(); - } - - /** - * Returns the details model. - * - * @return The details model. - **/ - public TableModel getDetailsModel() - { - return detailsPane_.getModel(); - } - - /** - * Returns the selection model that is used to maintain selection state - * in the details. - * - * @return The selection model, or null if selections are not allowed. - **/ - public ListSelectionModel getDetailsSelectionModel() - { - return detailsPane_.getSelectionModel(); - } - - /** - * Returns a title panel of the system status. - * - * @return The panel of the title of system status. - **/ - private JPanel getPanel0() - { - JPanel panel0= new JPanel(); - panel0.add(new JLabel(systemStatusText_)); - return panel0; - } - - /** - * Returns a details panel of the system status. - * - * @return The panel of the system status. - **/ - private JPanel getPanel1() - { - JPanel panel1= new JPanel(); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - panel1.setLayout (layout); - - int row=0; - VUtilities.constrain (new JLabel(systemText_), - systemLabel_, - panel1, layout, row++); - VUtilities.constrain (new JLabel(datetimeText_), - dateTimeLabel_, - panel1, layout, row++); - VUtilities.constrain (new JLabel(cpuText_), - panel1, layout, row++); - VUtilities.constrain (new JLabel(utilizationText_), - utilizationLabel_, - panel1, layout, row++); - VUtilities.constrain (new JLabel(auxiliaryStorageText_), - panel1, layout, row++); - VUtilities.constrain (new JLabel(systemAspText_), - systemASPLabel_, - panel1, layout, row++); - VUtilities.constrain (new JLabel(systemAspUsedText_), - systemASPUsedLabel_, - panel1, layout, row++); - VUtilities.constrain (new JLabel(totalAuxiliaryStorageText_), - totalAuxiliaryStorageLabel_, - panel1, layout, row++); - VUtilities.constrain (new JLabel(jobsText_), - panel1, layout, row++); - VUtilities.constrain (new JLabel(jobsInSystemText_), - jobsInSystemLabel_, - panel1, layout, row++); - VUtilities.constrain (new JLabel(batchJobsRunningText_), - batchJobsRunningLabel_, - panel1, layout, row++); - VUtilities.constrain (new JLabel(usersText_), - panel1, layout, row++); - VUtilities.constrain (new JLabel(usersCurrentlySignedOnText_), - usersCurrentlySignedOnLabel_, - panel1, layout, row++); - return panel1; - } - - /** - * Returns a details panel of the system pools. - * - * @return The panel of the system pools. - **/ - private JPanel getPanel2() - { - JPanel panel2 = new JPanel(); - - detailsPane_= new AS400DetailsPane(); - - panel2.setLayout(new BorderLayout()); //@B0A - panel2.add("Center", detailsPane_); //@B0A - return panel2; - } - - - /** - * Returns the first selected object. - * - * @return The first selected object. - **/ - public VObject getSelectedObject() - { - VObject vObjec1= detailsPane_.getSelectedObject(); - - return vObjec1; - } - - /** - * Returns the selected objects. - * - * @return The selected objects. - **/ - public VObject[] getSelectedObjects() - { - VObject[] vObjec1= detailsPane_.getSelectedObjects(); - - return vObjec1; - } - - /** - * Returns the VSystemStatus contained in VSystemStatusPane. - * - * @return The VSystemStatus contained in VSystemStatusPane. - **/ - public VSystemStatus getVSystemStatus() - { - return vSystemStatus_; - } - - /** - * Initializes the transient data. - **/ - private void initializeTransient() - { - errorEventSupport_= new ErrorEventSupport(this); - listSelectionEventSupport_= new ListSelectionEventSupport(this); - propertyChangeSupport_= new PropertyChangeSupport(this); - - vetoableChangeSupport_= new VetoableChangeSupport(this); - workingEventSupport_ = new WorkingEventSupport(this); //@B0A - - detailsPane_.addErrorListener(((ErrorListener)errorEventSupport_)); - detailsPane_.addListSelectionListener(((ListSelectionListener)listSelectionEventSupport_)); - detailsPane_.addPropertyChangeListener(((PropertyChangeListener)propertyChangeSupport_)); - detailsPane_.addVetoableChangeListener(((VetoableChangeListener)vetoableChangeSupport_)); - } - - /** - * Return true if the modify action to all system pools is allowed; false otherwise. - * - * @return true if the modify action to all system pools is allowed; false otherwise. - **/ - - public boolean isAllowModifyAllPools() - { - return allowModifyAllPools_; - } - - /** - * Loads system status information from the system. - **/ - public void load() - - { - workingEventSupport_.fireStartWorking(); //@B0A - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) //@B0C - Trace.log(Trace.INFORMATION, "VSystemStatusPane: loading"); //@B0C - try - { - if (systemStatus_ == null) //@B0A - systemStatus_ = new SystemStatus(system_); //@B0A - else //@B0A - systemStatus_.refreshCache(); //@B0C //@B0C - 06/17/1999 - for (Enumeration e=systemStatus_.getSystemPools();e.hasMoreElements();) - { - ((SystemPool)e.nextElement()).addPropertyChangeListener(propertyChangeSupport_); //@B0C - } - } - catch (Exception ex) - { - Trace.log(Trace.ERROR, ex.toString()); - errorEventSupport_.fireError(ex); - } - - try - { - - if (vSystemStatus_ == null) //@B0A - vSystemStatus_ = new VSystemStatus(systemStatus_); //@B0A - else //@B0A - vSystemStatus_.load(); //@B0A - } - catch (Exception ex) - { - Trace.log(Trace.ERROR, ex.toString()); - errorEventSupport_.fireError(ex); - } - - vSystemStatus_.setAllowModifyAllPools(allowModifyAllPools_); - - systemLabel_.setText(systemStatus_.getSystem().getSystemName()); - - try //@B0A - { - //@B0A - Date date = systemStatus_.getDateAndTimeStatusGathered(); - - String dateStr = dateFormat_.format(date); - String timeStr = timeFormat_.format(date); - dateTimeLabel_.setText(dateStr+" "+timeStr); - - utilizationLabel_.setText(Float.toString(systemStatus_.getPercentProcessingUnitUsed())); - systemASPLabel_.setText(Integer.toString(systemStatus_.getSystemASP())); - systemASPUsedLabel_.setText(Float.toString(systemStatus_.getPercentSystemASPUsed())); - totalAuxiliaryStorageLabel_.setText(Integer.toString(systemStatus_.getTotalAuxiliaryStorage())); - jobsInSystemLabel_.setText(Integer.toString(systemStatus_.getJobsInSystem())); - batchJobsRunningLabel_.setText(Integer.toString(systemStatus_.getBatchJobsRunning())); - usersCurrentlySignedOnLabel_.setText(Integer.toString(systemStatus_.getUsersCurrentSignedOn())); - - } //@B0A - catch (Exception e) //@B0A - { - //@B0A - if (Trace.isTraceOn() && Trace.isTraceErrorOn()) //@B0A - Trace.log(Trace.ERROR, e); //@B0A - errorEventSupport_.fireError(e); //@B0A - } //@B0A - - try - { - detailsPane_.setRoot(vSystemStatus_); - } - catch (java.beans.PropertyVetoException PropertyVetoException0) - { - } - detailsPane_.load(); - - if (Trace.isTraceOn() && Trace.isTraceInformationOn()) //@B0A - Trace.log(Trace.INFORMATION, "VSystemStatusPane: load finished"); //@B0C - workingEventSupport_.fireStopWorking(); //@B0A - } - - - /** - * Removes an error listener. - * - * @param listener The listener. - **/ - public void removeErrorListener( ErrorListener listener ) - { - if (listener == null) //@B0A - throw new NullPointerException("listener"); //@B0A - errorEventSupport_.removeErrorListener(listener); - } - - /** - * Removes a list selection listener. - * - * @param listener The listener. - **/ - public void removeListSelectionListener( ListSelectionListener listener ) - { - if (listener == null) //@B0A - throw new NullPointerException("listener"); //@B0A - listSelectionEventSupport_.removeListSelectionListener(listener); - } - - /** - * Removes a property change listener. - * - * @param listener The listener. - **/ - public void removePropertyChangeListener( PropertyChangeListener listener ) - { - if (listener == null) //@B0A - throw new NullPointerException("listener"); //@B0A - - propertyChangeSupport_.removePropertyChangeListener(listener); - } - - /** - * Removes a vetoable change listener. - * - * @param listener The listener. - **/ - public void removeVetoableChangeListener( VetoableChangeListener listener ) - { - - if (listener == null) //@B0A - throw new NullPointerException("listener"); //@B0A - vetoableChangeSupport_.removeVetoableChangeListener(listener ); - } - - - /** - * Sets the value indicating whether actions are allowed. - * - * @param allowAction true if actions are allowed; false otherwise. - **/ - public void setAllowActions( boolean allowAction ) - { - detailsPane_.setAllowActions(allowAction); - } - /** - * Set the state of modify action of all the pools. - * - * @param allow The boolean value. - **/ - public void setAllowModifyAllPools(boolean allow) - { - allowModifyAllPools_ = allow; - } - - /** - * Sets the value indicating whether certain actions are confirmed - * with the user. - * - * @param confirm true if certain actions are confirmed with the user; - * false otherwise. - **/ - public void setConfirm( boolean confirm ) - { - detailsPane_.setConfirm(confirm); - } - - /** - * Sets the selection model that is used to maintain selection state - * in the details. - * - * @param listSe1 The selection model, or null if selections are not allowed. - **/ - public void setDetailsSelectionModel( ListSelectionModel listSe1 ) - { - detailsPane_.setSelectionModel(listSe1); - } - - - /** - * Sets the root, or the system resource, from which all information - * for the model is gathered. - * - * @param root The root, or the system resource, from which all - * information for the model is gathered. - * @exception PropertyVetoException If the proposed change to root - * is unacceptable. - **/ - public void setRoot( VNode root ) - throws PropertyVetoException - { - if (root!=null) - detailsPane_.setRoot(root); - else - throw new NullPointerException("root"); - } - - /** - * Sorts the contents. - * - * @param propertyIdentifiers The property identifiers. - * @param orders The sort orders for each property identifier. - **/ - public void sort( Object[] propertyIdentifiers, boolean[] orders ) - { - detailsPane_.sort(propertyIdentifiers, orders); - } - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VSystemValue.java b/cvsroot/src/com/ibm/as400/vaccess/VSystemValue.java deleted file mode 100644 index a39d3c884..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VSystemValue.java +++ /dev/null @@ -1,409 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VSystemValue.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.SystemValue; -import com.ibm.as400.access.SystemValueList; - -import javax.swing.Icon; - -import java.io.ObjectInputStream; -import java.text.SimpleDateFormat; -import java.util.Date; - -import java.beans.PropertyVetoException; - -/** - * The VSystemValue class defines the representation of a - * system value in a server for use in various models - * and panes in this package. - * You must explicitly call load() to load the information from - * the server. - * - *

    Most errors are reported as ErrorEvents rather than - * throwing exceptions. Users should listen for ErrorEvents - * in order to diagnose and recover from error conditions. - * - *

    VSystemValue objects generate the following events: - *

      - *
    • ErrorEvent - *
    • PropertyChangeEvent - *
    • VObjectEvent - *
    • WorkingEvent - *
    -**/ -class VSystemValue implements VObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Property. - private SystemValue systemValue_; - - // Private data. - private VObject[] detailsChildren_; - private VObject[] children_; - - private VAction[] actions_; - - // Event support. - VPropertiesPane propertiesPane_; - ErrorEventSupport errorEventSupport_; - VObjectEventSupport objectEventSupport_; - WorkingEventSupport workingEventSupport_; - - // MRI - final static private Icon icon16_; - final static private Icon icon32_; - - static - { - // The icon description is not MRI. - icon16_= ResourceLoader.getIcon("VSystemValue16.gif", "System Values"); - icon32_= ResourceLoader.getIcon("VSystemValue32.gif", "System Values"); - } - - /** - * Constants indicating property for system value information. - * - **/ - final public static String VALUE_PROPERTY = "Value"; - - - /** - * Constructs a VSystemValue object. - * @param systemValue The SystemValue object. - **/ - public VSystemValue(SystemValue systemValue) - { - systemValue_ = systemValue; - - errorEventSupport_= new ErrorEventSupport(this); - objectEventSupport_= new VObjectEventSupport(this); - workingEventSupport_= new WorkingEventSupport(this); - - actions_ = new VAction[1]; - actions_[0]= new VSystemValueModifyAction(this); - if (systemValue_.isReadOnly()) - actions_[0].setEnabled(false); - - actions_[0].addErrorListener(errorEventSupport_); - actions_[0].addVObjectListener(objectEventSupport_); - actions_[0].addWorkingListener(workingEventSupport_); - - propertiesPane_= new VSystemValueDetailsPropertiesPane(this, systemValue_); - - propertiesPane_.addErrorListener(errorEventSupport_); - propertiesPane_.addVObjectListener(objectEventSupport_); - propertiesPane_.addWorkingListener(workingEventSupport_); - } - - - /** - * Adds a listener to be notified when an error occurs. - * @param listener The error listener. - **/ - public void addErrorListener(ErrorListener listener) - { - errorEventSupport_.addErrorListener(listener); - } - - - /** - * Adds a listener to be notified when a VObject is changed, - * created, or deleted. - * @param listener The VObject listener. - **/ - public void addVObjectListener(VObjectListener listener) - { - objectEventSupport_.addVObjectListener(listener); - } - - /** - * Adds a listener to be notified when work starts and stops on - * potentially long-running operations. - * @param listener The working listener. - **/ - public void addWorkingListener(WorkingListener workin1) - { - workingEventSupport_.addWorkingListener(workin1); - } - - /** - * Returns the list of actions that can be performed. - * - * @return Always null. There are no actions. - * - **/ - public VAction[] getActions() - { - return actions_; - } - - /** - * Returns the default action. - * - * @return Always null. There is no default action. - **/ - public VAction getDefaultAction() - { - return null; - } - - - /** - * Returns the description. - * @return The system value description. - * - **/ - public String getDescription() - { - return systemValue_.getDescription(); - } - - /** - * Returns the icon. - * - * @param size The icon size, either 16 or 32. If any other - * value is given, then returns a default. - * @param open This parameter has no effect. - * @return The icon. - **/ - public Icon getIcon(int size, boolean open) - { - if (size != 32) - { - return icon16_; - } - return icon32_; - } - - /** - * Returns the system value name. - * @return The system value name. - * - **/ - public String getName() - { - return systemValue_.getName(); - } - - /** - * Returns the properties pane. - * - * @return The properties pane. - **/ - public VPropertiesPane getPropertiesPane() - { - return propertiesPane_; - } - - /** - * Returns a property value. - * - * @param propertyIdentifier The property identifier. - * The choices are - *
      - *
    • NAME_PROPERTY - *
    • VALUE_PROPERTY - *
    • DESCRIPTION_PROPERTY - *
    - * @return The property value, or null if the - * property identifier is not recognized. - **/ - public Object getPropertyValue(Object propertyIdentifier) - { - if (propertyIdentifier == NAME_PROPERTY) - { - return this; // The renderer will call toString() on us. - } - if (propertyIdentifier == DESCRIPTION_PROPERTY) - { - return systemValue_.getDescription(); - } - if (propertyIdentifier == VALUE_PROPERTY) - { -//@B0D workingEventSupport_.fireStartWorking(); - Object value = null; - try - { - value = systemValue_.getValue(); - } - catch(Exception e) - { - errorEventSupport_.fireError(e); - } -//@B0D workingEventSupport_.fireStopWorking(); - if (value != null && - systemValue_.getType() == SystemValueList.TYPE_ARRAY) - { - String[] valStrs = (String[]) value; - StringBuffer strBuf = new StringBuffer(); - for (int i=0; i 0) - { - // Have we added any items to the string yet? - if (strBuf.length() > 0) - { - strBuf.append(","); - } - strBuf.append(temp); - } - } - return strBuf.toString(); - } - return value; - } - return null; - } - - /** - * Returns the text. This is the system value name. - * @return The text which is the system value name. - **/ - public String getText() - { - return systemValue_.getName(); - } - - /** - * Returns the system value type. - * @return The system value type. - **/ - public int getType() - { - return systemValue_.getType(); - } - - /** - * Returns the system value information. - * @return The system value information. - * - **/ - public Object getValue() - { - Object value = null; - try - { -//@B0D workingEventSupport_.fireStartWorking(); - value = systemValue_.getValue(); - } - catch(Exception e) - { - errorEventSupport_.fireError(e); - } -//@B0D workingEventSupport_.fireStopWorking(); - return value; - } - - - /** - * Loads information about the object from the server. - **/ - public void load() - { - workingEventSupport_.fireStartWorking(); - try - { - systemValue_.clear(); // This clears the system value cache so - // that we get the new value from the 400. - systemValue_.getValue(); // This causes a connection in case we haven't made one yet. - } - catch(Exception e) - { - errorEventSupport_.fireError(e); - } - workingEventSupport_.fireStopWorking(); - } - - /** - * Removes an error listener. - * - * @param listener The listener. - **/ - public void removeErrorListener(ErrorListener listener) - { - errorEventSupport_.removeErrorListener(listener); - } - - /** - * Removes a VObjectListener. - * - * @param listener The listener. - **/ - public void removeVObjectListener(VObjectListener listener) - { - objectEventSupport_.removeVObjectListener(listener); - } - - /** - * Removes a working listener. - * - * @param listener The listener. - **/ - public void removeWorkingListener(WorkingListener workin1) - { - workingEventSupport_.removeWorkingListener(workin1); - } - - /** - * Sets the system value. - * @param value The value to be set. - * Example: - *
    -     *   AS400 theSystem = new AS400("My400");
    -     *   VSystemValue sysVal = new VSystemValue(theSystem, "QUSRLIBL");
    -     *   // QUSRLIBL is of type TYPE_ARRAY
    -     *   String[] theList = new String[] { "QGPL", "QTEMP" };
    -     *   sysVal.setValue(theList);
    -     *
    -     *   sysVal = new VSystemValue(theSystem, "QTIME");
    -     *   // QTIME is of type TYPE_DATE
    -     *   java.sql.Time theTime = new java.sql.Time(12, 30, 0);
    -     *   sysVal.setValue(theTime);
    -     *
    -     *   sysVal = new VSystemValue(theSystem, "QCCSID");
    -     *   // QCCSID is of type TYPE_INTEGER
    -     *   Integer theCcsid = new Integer(37);
    -     *   sysVal.setValue(theCcsid);
    -     * 
    - * - **/ - public void setValue(Object value) - { -//@B0D workingEventSupport_.fireStartWorking(); - try - { - systemValue_.setValue(value); - // fireStopWorking should occur before fireObjectChanged - // because VSystemValueGroup listens for the objectChanged - // and could possibly "disconnect all of the wiring" of - // the group, which has the result of disabling the - // explorer pane. -//@B0D workingEventSupport_.fireStopWorking(); - objectEventSupport_.fireObjectChanged(this); - } - catch(Exception e) - { - errorEventSupport_.fireError(e); - // Need to fire a stopWorking, but don't want to - // fire two of them. -//@B0D workingEventSupport_.fireStopWorking(); - } - } -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VSystemValue16.gif b/cvsroot/src/com/ibm/as400/vaccess/VSystemValue16.gif deleted file mode 100644 index 92c28ce6e..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VSystemValue16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VSystemValue32.gif b/cvsroot/src/com/ibm/as400/vaccess/VSystemValue32.gif deleted file mode 100644 index d54eed317..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VSystemValue32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VSystemValueDetailsPropertiesPane.java b/cvsroot/src/com/ibm/as400/vaccess/VSystemValueDetailsPropertiesPane.java deleted file mode 100644 index ab08cf1e9..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VSystemValueDetailsPropertiesPane.java +++ /dev/null @@ -1,368 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VSystemValueDetailsPropertiesPane.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.lang.String; -import java.lang.Integer; -import java.lang.Boolean; - - -import com.ibm.as400.access.SystemValue; -import com.ibm.as400.access.SystemValueList; -import com.ibm.as400.access.Trace; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JTextField; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTextArea; -import javax.swing.JList; -import javax.swing.SwingConstants; -import javax.swing.border.Border; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ChangeListener; -import javax.swing.text.JTextComponent; -import java.awt.Color; -import java.awt.Component; -import java.awt.Container; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.LayoutManager; -import java.text.DateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.TimeZone; -import java.awt.event.KeyListener; -import java.awt.event.ItemListener; - -/** - * The VSystemValueDetailsPropertiesPane class defines the property panel - * of a system value on a server for use in various models - * and panes in this package. - * - *

    Most errors are reported as ErrorEvents rather than - * throwing exceptions. Users should listen for ErrorEvents - * in order to diagnose and recover from error conditions. - * - *

    VSystemValueDetailsPropertiesPane objects generate the following events: - *

      - *
    • ErrorEvent - *
    • PropertyChangeEvent - *
    • VObjectEvent - *
    • WorkingEvent - *
    -**/ -class VSystemValueDetailsPropertiesPane - implements VPropertiesPane -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private VSystemValue object_; - private SystemValue systemValue_; - - - // Event support. - private ChangeEventSupport changeEventSupport_; - private ErrorEventSupport errorEventSupport_; - private VObjectEventSupport objectEventSupport_; - private WorkingEventSupport workingEventSupport_; - - // MRI - final private static String valueDescription_ = (String)ResourceLoader.getText("COLUMN_DESCRIPTION") + ": "; - final private static String valueInformation_ = (String)ResourceLoader.getText("COLUMN_VALUE") + ": "; - final private static String generalTabText_ = (String)ResourceLoader.getText("TAB_GENERAL"); - - private static DateFormat dateFormat_ = DateFormat.getDateInstance(); - private static DateFormat timeFormat_ = DateFormat.getTimeInstance(); - - static - { - dateFormat_.setTimeZone (TimeZone.getDefault ()); - timeFormat_.setTimeZone (TimeZone.getDefault ()); - } - - - - /** - * Constructs a VSystemValueDetailsPropertiesPane object. This creates a - * property panel. - * @param systemValue The VSystemValue object. - **/ - public VSystemValueDetailsPropertiesPane(VSystemValue vSystemValue, - SystemValue systemValue) - { - if( systemValue != null) - { - systemValue_ = systemValue; - } - changeEventSupport_= new ChangeEventSupport(this); - errorEventSupport_= new ErrorEventSupport(this); - objectEventSupport_= new VObjectEventSupport(this); - workingEventSupport_= new WorkingEventSupport(this); - object_ = vSystemValue; - } - - /** - * Adds the specified change listener - * to receive change event from this - * component. - * @param listener The property change - * listener. - **/ - public void addChangeListener( - ChangeListener listener) - { - changeEventSupport_.addChangeListener(listener); - } - - /** - * Adds the specified error listener - * to receive error event from this - * component. - * @param listener The error listener. - **/ - public void addErrorListener( - ErrorListener listener) - { - errorEventSupport_.addErrorListener(listener); - } - - /** - * Adds the specified VObject listener - * to receive VObject event from this - * component. - * @param listener The VObject listener. - **/ - public void addVObjectListener( - VObjectListener listener) - { - objectEventSupport_.addVObjectListener(listener); - } - - /** - * Adds the specified working listener - * to receive working event from this - * component. - * @param listener The working listener. - **/ - public void addWorkingListener( - WorkingListener listener) - { - workingEventSupport_.addWorkingListener(listener); - } - - /** - * Processes the change event. - **/ - public void applyChanges() throws Exception - { - } - - /** - * Returns the display tabbed panel for array values. - * @return The display tabbed panel for array values. - **/ - private Component getArrayTab() - { - // Initialize the general tab. - JPanel generalTab = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - generalTab.setLayout (layout); - generalTab.setBorder (new EmptyBorder (10, 10, 10, 10)); - - // Icon and name. - int row = 0; - VUtilities.constrain (new JLabel (object_.getText (), object_.getIcon (32, false), SwingConstants.LEFT), - generalTab, layout, 0, row++, 2, 1); - - // Description. - VUtilities.constrain (valueDescription_, - object_.getDescription (), generalTab, layout, row++); - - // Array of values. - try - { - Object[] objs = (Object[])systemValue_.getValue(); - int count = objs.length; - String[] values = new String[count]; - for (int i=0;iMost errors are reported as ErrorEvents rather than - * throwing exceptions. Users should listen for ErrorEvents - * in order to diagnose and recover from error conditions. - * - *

    VSystemValueGroup objects generate the following events: - *

      - *
    • ErrorEvent - *
    • PropertyChangeEvent - *
    • VObjectEvent - *
    • WorkingEvent - *
    -**/ - -class VSystemValueGroup implements VNode -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private VSystemValueList systemValueList_; - private int group_; - private String groupName_; - private String groupDescription_; - - private VNode parent_ = null; - private boolean loaded_ = false; - - private Vector systemValues_; - - private VObject[] detailsChildren_; - private VPropertiesPane propertiesPane_; - - - // Event support. - private ErrorEventSupport errorEventSupport_; - private VObjectEventSupport objectEventSupport_; - private WorkingEventSupport workingEventSupport_; - // This one is for refreshing all other date and time values - // if one of them should change. - private VObjectListener_ dateTimeListener_; - - // Static data. - static public final String VALUE_PROPERTY = "Value"; - - private static TableColumnModel detailsColumnModel_; - - // MRI - private static String nameColumnHeader_; - private static String descriptionColumnHeader_; - private static String valueColumnHeader_; - private static String description_; - private static Icon icon16_; - private static Icon icon32_; - - /** - * Static initializer - **/ - static - { - nameColumnHeader_ = (String)ResourceLoader.getText("COLUMN_NAME"); - valueColumnHeader_ = (String)ResourceLoader.getText("COLUMN_VALUE"); - descriptionColumnHeader_ = (String)ResourceLoader.getText("COLUMN_DESCRIPTION"); - description_ = (String)ResourceLoader.getText("COLUMN_GROUP"); - - icon16_= ResourceLoader.getIcon("VSystemValueGroup16.gif", description_); - icon32_= ResourceLoader.getIcon("VSystemValueGroup32.gif", description_); - - detailsColumnModel_= new DefaultTableColumnModel(); - int i = 0; - - // These are the columns to display for the children. - // The children are VSystemValues. - - // Name column. - VTableColumn vTable1= new VTableColumn(i++, NAME_PROPERTY); - vTable1.setCellRenderer(((TableCellRenderer)new VObjectCellRenderer())); - vTable1.setHeaderRenderer(((TableCellRenderer)new VObjectHeaderRenderer())); - vTable1.setHeaderValue(nameColumnHeader_); - vTable1.setPreferredCharWidth(10); - detailsColumnModel_.addColumn(((TableColumn)vTable1)); - - // Value column. - VTableColumn vTable2= new VTableColumn(i++, VALUE_PROPERTY); - vTable2.setCellRenderer(((TableCellRenderer)new VObjectCellRenderer())); - vTable2.setHeaderRenderer(((TableCellRenderer)new VObjectHeaderRenderer())); - vTable2.setHeaderValue(valueColumnHeader_); - vTable2.setPreferredCharWidth(15); - detailsColumnModel_.addColumn(((TableColumn)vTable2)); - - // Description column - VTableColumn vTable3= new VTableColumn(i++, DESCRIPTION_PROPERTY); - vTable3.setCellRenderer(((TableCellRenderer)new VObjectCellRenderer())); - vTable3.setHeaderRenderer(((TableCellRenderer)new VObjectHeaderRenderer())); - vTable3.setHeaderValue(descriptionColumnHeader_); - vTable3.setPreferredCharWidth(40); - detailsColumnModel_.addColumn(((TableColumn)vTable3)); - } - - - /** - * Constructs a VSystemValueGroup object. - * @param systemValueList The SystemValueList object. - * @param group The group type. - **/ - public VSystemValueGroup(VSystemValueList systemValueList, int group) - { - systemValueList_ = systemValueList; - group_ = group; - groupName_ = SystemValueList.getGroupName(group_); - groupDescription_ = SystemValueList.getGroupDescription(group_); - parent_ = systemValueList; - - errorEventSupport_= new ErrorEventSupport(this); - objectEventSupport_= new VObjectEventSupport(this); - workingEventSupport_= new WorkingEventSupport(this); - dateTimeListener_ = new VObjectListener_(); - - propertiesPane_= new VSystemValueGroupPropertiesPane(this); - propertiesPane_.addErrorListener(errorEventSupport_); - propertiesPane_.addVObjectListener(objectEventSupport_); - propertiesPane_.addWorkingListener(workingEventSupport_); - propertiesPane_.addVObjectListener(dateTimeListener_); - - systemValues_ = new Vector(); - - detailsChildren_= new VSystemValue[0]; - - loaded_ = false; - } - - /** - * Adds the specified error listener - * to receive error event from this - * component. - * @param listener The error listener. - **/ - public void addErrorListener(ErrorListener listener) - { - errorEventSupport_.addErrorListener(listener); - } - - /** - * Adds the specified VObject listener - * to receive VObject event from this - * component. - * @param listener The VObject listener. - **/ - public void addVObjectListener(VObjectListener listener) - { - objectEventSupport_.addVObjectListener(listener); - } - - /** - * Adds the specified working listener - * to receive working event from this - * component. - * @param listener The working listener. - **/ - public void addWorkingListener(WorkingListener listener) - { - workingEventSupport_.addWorkingListener(listener); - } - - /** - * Returns the children of the node. - * - * @return The children. - **/ - public Enumeration children() - { - return (Enumeration)(new VEnumeration((VNode)this)); - } - - /** - * Returns the list of actions that can be performed. - * - * @return Always null. There are no actions. - * - **/ - public VAction[] getActions() - { - return null; - } - - - /** - * Indicates if the node allows children. - * - * @return Always false. - **/ - public boolean getAllowsChildren() - { - return false; - } - - /** - * Returns the child node at the specified index. - * - * @param index The index. - * @return Always null. - **/ - public TreeNode getChildAt(int index) - { - return null; - } - - /** - * Returns the number of children. - * - * @return The number of the children. - **/ - public int getChildCount() - { - return 0; - } - - /** - * Returns the description. - * @return The description. - **/ - public String getDescription() - { - return groupDescription_; - } - - /** - * Returns the default action. - * - * @return Always null. There is no default action. - **/ - public VAction getDefaultAction() - { - return null; - } - - - - /** - * Returns the child for the details at the specified index. - * - * @param index The index. - * @return The child, or null if the index is not - * valid. - **/ - public VObject getDetailsChildAt(int index) - { - if (index < 0 || index >= detailsChildren_.length) - return null; - loadChildren(); - return detailsChildren_[index]; - } - - /** - * Returns the number of children for the details. - * - * @return The number of children for the details. - **/ - public int getDetailsChildCount() - { - loadChildren(); - return detailsChildren_.length; - } - - /** - * Returns the table column model to use in the details - * when representing the children. This column model - * describes the details values for the children. - * - * @return The details column model. - **/ - public TableColumnModel getDetailsColumnModel() - { - return detailsColumnModel_; - } - - /** - * Returns the index of the specified child for the details. - * - * @param detailsChild The details child. - * @return The index, or -1 if the child is not found - * in the details. - **/ - public int getDetailsIndex(VObject vObject) - { - loadChildren(); - for (int i=0; i - *
  • NAME_PROPERTY - *
  • DESCRIPTION_PROPERTY - * - * @return The property value, or null if the - * property identifier is not recognized. - **/ - public Object getPropertyValue(Object object) - { - if (object == NAME_PROPERTY) - { - return groupName_; - } - if (object == DESCRIPTION_PROPERTY) - { - return groupDescription_; - } - return null; - } - - /** - * Returns the text. This is the system value group name - * - * @return The text which is the system value group name. - **/ - public String getText() - { - return groupName_; - } - - /** - * Indicates if the node is a leaf. - * - * @return Always true. - **/ - public boolean isLeaf() - { - return true; - } - - /** - * Indicates if the details children are sortable. - * - * @return Always false. - **/ - public boolean isSortable() - { - return false; - } - - /** - * Loads information about the object from the server. - **/ - public void load() - { - workingEventSupport_.fireStartWorking(); - - for (int i=0; iMost errors are reported as ErrorEvents rather than - * throwing exceptions. Users should listen for ErrorEvents - * in order to diagnose and recover from error conditions. - * - *

    VSystemValueGroup objects generate the following events: - *

      - *
    • ErrorEvent - *
    • PropertyChangeEvent - *
    • VObjectEvent - *
    • WorkingEvent - *
    -**/ - -class VSystemValueGroupPropertiesPane implements VPropertiesPane -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private VSystemValueGroup object_; - - // MRI - private static final String generalTabText_ = ResourceLoader.getText ("TAB_GENERAL"); - private static final String descriptionText_ = ResourceLoader.getText ("COLUMN_DESCRIPTION") + ": "; - - // Event support. - ChangeEventSupport changeEventSupport_; - ErrorEventSupport errorEventSupport_; - VObjectEventSupport objectEventSupport_; - WorkingEventSupport workingEventSupport_; - - /** - * Constructs a VSystemValueGroupPropertiesPane object. It creates a - * properties panel for VSystemValueGroup. - * @param vSystemValueGroup The specified system values group. - * @param systemValueList The list of the system values. - **/ - public VSystemValueGroupPropertiesPane(VSystemValueGroup vSystemValueGroup) - { - changeEventSupport_= new ChangeEventSupport(this); - errorEventSupport_= new ErrorEventSupport(this); - objectEventSupport_= new VObjectEventSupport(this); - workingEventSupport_= new WorkingEventSupport(this); - object_= vSystemValueGroup; - } - - /** - * Adds the specified change listener - * to receive change event from this - * component. - * @param listener The property change - * listener. - **/ - public void addChangeListener(ChangeListener listener) - { - changeEventSupport_.addChangeListener(listener); - } - - /** - * Adds the specified error listener - * to receive error event from this - * component. - * @param listener The error listener. - **/ - public void addErrorListener(ErrorListener listener) - { - errorEventSupport_.addErrorListener(listener); - } - - /** - * Adds the specified VObject listener - * to receive VObject event from this - * component. - * @param listener The VObject listener. - **/ - public void addVObjectListener(VObjectListener listener) - { - objectEventSupport_.addVObjectListener(listener); - } - - /** - * Adds the specified working listener - * to receive working event from this - * component. - * @param listener The working listener. - **/ - public void addWorkingListener(WorkingListener listener) - { - workingEventSupport_.addWorkingListener(listener); - } - - /** - * Processes the change event. - **/ - public void applyChanges() throws Exception - { - } - - /** - * Returns the component. - * @return The component to display the properties. - **/ - public Component getComponent() - { - // Initialize the general tab. - JPanel generalTab = new JPanel (); - GridBagLayout layout = new GridBagLayout (); - GridBagConstraints constraints; - generalTab.setLayout (layout); - generalTab.setBorder (new EmptyBorder (10, 10, 10, 10)); - - // Icon and name. - int row = 0; - VUtilities.constrain (new JLabel (object_.getText (), object_.getIcon (32, false), SwingConstants.LEFT), - generalTab, layout, 0, row++, 2, 1); - - // Description. - VUtilities.constrain (descriptionText_, - object_.getDescription (), generalTab, layout, row++); - - // Build the pane. - JTabbedPane pane = new JTabbedPane (); - pane.addTab (generalTabText_, null, generalTab); - pane.setSelectedIndex (0); - return pane; - } - - /** - * Removes a change listener. - * - * @param listener The listener. - **/ - public void removeChangeListener(ChangeListener listener) - { - changeEventSupport_.removeChangeListener(listener); - } - - /** - * Removes an error listener. - * - * @param listener The listener. - **/ - public void removeErrorListener(ErrorListener listener) - { - errorEventSupport_.removeErrorListener(listener); - } - - /** - * Removes a VObjectListener. - * - * @param listener The listener. - **/ - public void removeVObjectListener(VObjectListener listener) - { - objectEventSupport_.removeVObjectListener(listener); - } - - /** - * Removes a working listener. - * - * @param listener The listener. - **/ - public void removeWorkingListener(WorkingListener listener) - { - workingEventSupport_.removeWorkingListener(listener); - } -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VSystemValueList.java b/cvsroot/src/com/ibm/as400/vaccess/VSystemValueList.java deleted file mode 100644 index fcfe5dcdf..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VSystemValueList.java +++ /dev/null @@ -1,633 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VSystemValueList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.SystemValueList; -import com.ibm.as400.access.SystemValue; - -import javax.swing.Icon; - -import java.beans.VetoableChangeListener; -import java.beans.PropertyChangeListener; - -import java.beans.PropertyVetoException; - - -import javax.swing.table.TableColumnModel; -import java.io.ObjectInputStream; -import javax.swing.tree.TreeNode; -import javax.swing.table.DefaultTableColumnModel; -import javax.swing.table.TableCellRenderer; -import javax.swing.table.TableColumn; - -import java.util.Enumeration; - - -/** - * The VSystemValueList class defines the representation of a - * system value list in a system for use in various models - * and panes in this package. - * You must explicitly call load() to load the information from - * the system. - * - *

    Most errors are reported as ErrorEvents rather than - * throwing exceptions. Users should listen for ErrorEvents - * in order to diagnose and recover from error conditions. - * - *

    VSystemValueList objects generate the following events: - *

      - *
    • ErrorEvent - *
    • PropertyChangeEvent - *
    • VObjectEvent - *
    • WorkingEvent - *
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VSystemValueList implements VNode, java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Properties. - private SystemValueList systemValueList_; - private VNode parent_; - - // Private data. - private transient VNode[] children_; // These are VSystemValueGroups - - // Event support. - private transient ErrorEventSupport errorEventSupport_; - private transient PropertyChangeSupport propertyChangeSupport_; - private transient VetoableChangeSupport vetoableChangeSupport_; - private transient VObjectEventSupport objectEventSupport_; - private transient WorkingEventSupport workingEventSupport_; - - // Static data. - private static String description_; - private static Icon icon16_; - private static Icon icon32_; - private static TableColumnModel detailsColumnModel_; - private static String nameColumnHeader_; - private static String descriptionColumnHeader_; - - // MRI - final private static String groupName_; - final private static String groupDescription_; - - final private static int groupCount_ = SystemValueList.getGroupCount(); - - static - { - description_ = (String)ResourceLoader.getText("SYSTEM_VALUE_LIST_DESCRIPTION"); - groupName_ = (String)ResourceLoader.getText("COLUMN_GROUP"); - groupDescription_= (String)ResourceLoader.getText("COLUMN_DESCRIPTION"); - icon16_= ResourceLoader.getIcon("VSystemValueList16.gif", description_); - icon32_= ResourceLoader.getIcon("VSystemValueList32.gif", description_); - - nameColumnHeader_ = groupName_; - descriptionColumnHeader_ = groupDescription_; - - detailsColumnModel_= new DefaultTableColumnModel(); - - int i= 0; - - // These are the columns to display for the children. - // The children are VSystemValueGroups. - - // Name Column - VTableColumn vTable1= new VTableColumn(i++, NAME_PROPERTY); - vTable1.setCellRenderer(((TableCellRenderer)new VObjectCellRenderer())); - vTable1.setHeaderRenderer(((TableCellRenderer)new VObjectHeaderRenderer())); - vTable1.setHeaderValue(nameColumnHeader_); - vTable1.setPreferredCharWidth(10); - detailsColumnModel_.addColumn(((TableColumn)vTable1)); - - // Description Column - VTableColumn vTable2= new VTableColumn(i++, DESCRIPTION_PROPERTY); - vTable2.setCellRenderer(((TableCellRenderer)new VObjectCellRenderer())); - vTable2.setHeaderRenderer(((TableCellRenderer)new VObjectHeaderRenderer())); - vTable2.setHeaderValue(descriptionColumnHeader_); - vTable2.setPreferredCharWidth(40); - detailsColumnModel_.addColumn(((TableColumn)vTable2)); - } - - /** - * Constructs a VSystemValueList object. - **/ - public VSystemValueList() - { - systemValueList_ = new SystemValueList(); - initializeTransient(); - } - - /** - * Constructs a VSystemValueList object. - * @param system The system. - **/ - public VSystemValueList(AS400 system) - { - systemValueList_ = new SystemValueList(system); - initializeTransient(); - } - - /** - * Constructs a VSystemValueList object. - * @param parentNode The parent node. - * @param system The system. - **/ - public VSystemValueList(VNode parentNode, AS400 system) - { - if (parentNode == null) - throw new NullPointerException("parent"); - - systemValueList_ = new SystemValueList(system); - parent_ = parentNode; - initializeTransient(); - } - - /** - * Adds a listener to be notified when an error occurs. - * @param listener The listener. - **/ - public void addErrorListener(ErrorListener listener) - { - errorEventSupport_.addErrorListener(listener); - } - - /** - * Adds a listener to be notified when the value of any bound - * property changes. - * @param listener The listener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener(listener); - } - - /** - * Adds a listener to be notified when the value of any constrained - * property changes. - * @param listener The listener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener(listener); - } - - /** - * Adds a listener to be notified when a VObject is changed, - * created, or deleted. - * @param listener The listener. - **/ - public void addVObjectListener(VObjectListener listener) - { - objectEventSupport_.addVObjectListener(listener); - } - - /** - * Adds a listener to be notified when work starts and stops - * on potentially long-running operations. - * @param listener The listener. - **/ - public void addWorkingListener(WorkingListener listener) - { - workingEventSupport_.addWorkingListener(listener); - } - - /** - * Returns the children of the node. - * - * @return The children. - **/ - public Enumeration children() - { - return (Enumeration)(new VEnumeration(this)); - } - - /** - * Returns the list of actions that can be performed. - * - * @return Always null. There are no actions. - * - **/ - public VAction[] getActions() - { - return null; - } - - /** - * Indiciates if the node allows children. - * - * @return Always true. - **/ - public boolean getAllowsChildren() - { - return true; - } - - - /** - * Returns the child node at the specified index. - * - * @param index The index. - * @return The child node at the specified index. - **/ - public TreeNode getChildAt(int index) - { - if (index < 0 || index >= children_.length) - { - return null; - } - return (TreeNode)children_[index]; - } - - /** - * Returns the number of the children. - * - * @return The number of the children. - **/ - public int getChildCount() - { - return children_.length; - } - - - /** - * Returns the default action. - * - * @return Always null. There is no default action. - **/ - public VAction getDefaultAction() - { - return null; - } - - /** - * Returns the child for the details at the specified index. - * - * @param index The index. - * @return The child, or null if the index is not - * valid. - **/ - public VObject getDetailsChildAt(int index) - { - if (index < 0 || index >= children_.length) - { - return null; - } - return children_[index]; - } - - /** - * Returns the number of children for the details. - * - * @return The number of children for the details. - **/ - public int getDetailsChildCount() - { - return children_.length; - } - - /** - * Returns the table column model to be used in the details - * when representing the children. This column model - * describes the details values for the children. - * - * @return The details column model. - **/ - public TableColumnModel getDetailsColumnModel() - { - return detailsColumnModel_; - } - - /** - * Returns the index of the specified child for the details. - * - * @param detailsChild The details child. - * @return The index, or -1 if the child is not found - * in the details. - **/ - public int getDetailsIndex(VObject detailsChild) - { - for (int i=0; i < groupCount_; i++) - { - if (children_[i] == detailsChild) - { - return i; - } - } - return -1; - } - - - /** - * Returns the icon. - * - * @param size The icon size, either 16 or 32. If any other - * value is given, then returns a default. - * @param open This parameter has no effect. - * @return The icon. - **/ - public Icon getIcon(int size, boolean open) - { - if (size != 32) - { - return icon16_; - } - return icon32_; - } - - /** - * Returns the index of the specified child. - * - * @param child The child. - * @return The index of the specified child. - **/ - public int getIndex(TreeNode child) - { - for (int index=0; index < groupCount_; index++) - { - if (children_[index] == child) - { - return index; - } - } - return -1; - } - - - /** - * Returns the parent node. - * - * @return The parent node, or null if there is no parent. - **/ - public TreeNode getParent() - { - return parent_; - } - - - /** - * Returns the properties pane. - * - * @return The properties pane. - **/ - public VPropertiesPane getPropertiesPane() - { - return null; - } - - /** - * Returns a property value. - * - * @param propertyIdentifier The property identifier. - * The choices are - *
      - *
    • NAME_PROPERTY - *
    • DESCRIPTION_PROPERTY - *
    - * @return The property value, or null if the - * property identifier is not recognized. - **/ - public Object getPropertyValue(Object propertyIdentifier) - { - if (propertyIdentifier == NAME_PROPERTY) - { - return this; - } - if (propertyIdentifier == DESCRIPTION_PROPERTY) - { - return description_; - } - return null; - } - - /** - * Returns the system in which the system - * values resides. - * - * @return The system in which the system - * values resides. - * - * @see com.ibm.as400.access.SystemValueList - **/ - public AS400 getSystem() - { - return systemValueList_.getSystem(); - } - - /** - * Returns the system value list. - * @return The SystemValueList object. - **/ - public SystemValueList getSystemValueList() - { - return systemValueList_; - } - - /** - * Returns the text representation of the system value list. - * - * @return The text representation of the system value list. - **/ - public String getText() - { - return description_; - } - - /** - * Initializes the transient data. - **/ - private void initializeTransient() - { - errorEventSupport_= new ErrorEventSupport(this); - objectEventSupport_= new VObjectEventSupport(this); - propertyChangeSupport_= new PropertyChangeSupport(this); - vetoableChangeSupport_= new VetoableChangeSupport(this); - workingEventSupport_= new WorkingEventSupport(this); - - children_ = new VSystemValueGroup[groupCount_]; - for (int i=0; icom.ibm.as400.access -**/ -public class VSystemValueListBeanInfo extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private final static Class beanClass_ = VSystemValueList.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try - { - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - String[] vobjectMethods = { "objectChanged", "objectCreated", "objectDeleted" }; - EventSetDescriptor vobject = new EventSetDescriptor (beanClass_, - "vobject", VObjectListener.class, vobjectMethods, - "addVObjectListener", "removeVObjectListener"); - vobject.setDisplayName (ResourceLoader.getText ("EVT_NAME_VOBJECT")); - vobject.setShortDescription (ResourceLoader.getText ("EVT_DESC_VOBJECT")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { error, propertyChange, vetoableChange, vobject, working }; - - // Properties. - PropertyDescriptor system = new PropertyDescriptor ("system", beanClass_); - system.setBound (true); - system.setConstrained (true); - system.setDisplayName (ResourceLoader.getText ("PROP_NAME_SYSTEM")); - system.setShortDescription (ResourceLoader.getText ("PROP_DESC_SYSTEM")); - - properties_ = new PropertyDescriptor[] { system }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // system. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("VSystemValueList16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("VSystemValueList32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VSystemValueModifyAction.java b/cvsroot/src/com/ibm/as400/vaccess/VSystemValueModifyAction.java deleted file mode 100644 index bfcefc3ec..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VSystemValueModifyAction.java +++ /dev/null @@ -1,202 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VSystemValueModifyAction.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.SystemValue; -import com.ibm.as400.access.SystemValueList; -import com.ibm.as400.access.IFSFileOutputStream; -import com.ibm.as400.access.Trace; - -import java.util.Date; -import java.util.Vector; -import java.util.EventObject; - - -/** - * The VSystemValueModifyAction class defines the modify action - * of a system value on a server . - * - *

    Most errors are reported as ErrorEvents rather than - * throwing exceptions. Users should listen for ErrorEvents - * in order to diagnose and recover from error conditions. - * - *

    VSystemValueModifyAction objects generate the following events: - *

      - *
    • ErrorEvent - *
    • VObjectEvent - *
    • WorkingEvent - *
    -**/ -class VSystemValueModifyAction implements VAction -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - // Private data. - private boolean enabled_; - private VSystemValue systemValue_; - - // Events support. - private ErrorEventSupport errorEventSupport_; - private VObjectEventSupport objectEventSupport_; - private WorkingEventSupport workingEventSupport_; - - - // MRI - final private static String modifyActionText_; - - static - { - modifyActionText_ = (String)ResourceLoader.getText("ACTION_MODIFY"); - } - - - /** - * Constructs a VSystemValueModifyAction object. - * @param systemValue The VSystemValue to modify. - **/ - public VSystemValueModifyAction(VSystemValue systemValue) - { - systemValue_ = systemValue; - errorEventSupport_= new ErrorEventSupport(this); - objectEventSupport_= new VObjectEventSupport(this); - workingEventSupport_= new WorkingEventSupport(this); - enabled_ = true; - } - - /** - * Adds the specified error listener - * to receive error event from this - * component. - * @param listener The error listener. - **/ - public void addErrorListener(ErrorListener listener) - { - errorEventSupport_.addErrorListener(listener); - } - - /** - * Adds the specified VObject listener - * to receive VObject event from this - * component. - * @param listener The VObject listener. - **/ - public void addVObjectListener(VObjectListener listener) - { - objectEventSupport_.addVObjectListener(listener); - } - - /** - * Adds the specified working listener - * to receive working event from this - * component. - * @param listener The working listener. - **/ - public void addWorkingListener(WorkingListener listener) - { - workingEventSupport_.addWorkingListener(listener); - } - - /** - * Returns the display text of this action. - * @return The text string to be displayed. - **/ - public String getText() - { - return modifyActionText_; - } - - /** - * Indicates whether the action is enabled or not. - * @return The value which indicates whether the action is - * enabled or not. - **/ - public boolean isEnabled() - { - return enabled_; - } - - /** - * The action is performed. - * @param vAction The action performed. - **/ - public void perform(VActionContext vAction) - { - int type = systemValue_.getType(); - switch(type) - { - case SystemValueList.TYPE_INTEGER: - case SystemValueList.TYPE_STRING: - case SystemValueList.TYPE_DECIMAL: - { - VSysvalTextDialog propertiesDialog - = new VSysvalTextDialog(systemValue_, vAction.getFrame()); - propertiesDialog.setVisible(true); - } - break; - case SystemValueList.TYPE_ARRAY: - VSysvalArrayDialog arrayDialog - = new VSysvalArrayDialog(vAction.getFrame(), systemValue_); - arrayDialog.setVisible(true); - break; - case SystemValueList.TYPE_DATE: - VSysvalDateDialog dateDlg - = new VSysvalDateDialog(systemValue_, vAction.getFrame()); - dateDlg.setVisible(true); - break; - } - } - - /** - * Removes an error listener. - * - * @param listener The listener. - **/ - public void removeErrorListener(ErrorListener errorL1) - { - errorEventSupport_.removeErrorListener(errorL1); - } - - /** - * Removes a VObjectListener. - * - * @param listener The listener. - **/ - public void removeVObjectListener(VObjectListener vObjec1) - { - objectEventSupport_.removeVObjectListener(vObjec1); - } - - /** - * Removes a working listener. - * - * @param listener The listener. - **/ - public void removeWorkingListener(WorkingListener workin1) - { - workingEventSupport_.removeWorkingListener(workin1); - } - - /** - * Sets the component to be enabled. - * - * @param enabled The value indicating whether the - * component is enable or not. - **/ - public void setEnabled(boolean enabled) - { - enabled_= enabled; - } -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VSysvalArrayDialog.java b/cvsroot/src/com/ibm/as400/vaccess/VSysvalArrayDialog.java deleted file mode 100644 index 536a7e041..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VSysvalArrayDialog.java +++ /dev/null @@ -1,535 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VSysvalArrayDialog.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.SystemValue; - -import javax.swing.JDialog; -import javax.swing.JPanel; -import java.awt.event.WindowListener; -import java.awt.event.WindowEvent; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.awt.event.KeyListener; -import java.awt.event.KeyEvent; - -import javax.swing.JLabel; -import javax.swing.JButton; -import javax.swing.JTextField; -import javax.swing.JList; - -import javax.swing.BoxLayout; -import javax.swing.Box; -import javax.swing.JTabbedPane; -import javax.swing.JDialog; -import javax.swing.JScrollPane; -import javax.swing.ButtonGroup; -import javax.swing.Icon; -import javax.swing.JRadioButton; -import javax.swing.ListSelectionModel; -import javax.swing.border.Border; -import javax.swing.border.EmptyBorder; - -import javax.swing.event.ListSelectionListener; -import javax.swing.event.ListSelectionEvent; - -import java.awt.Frame; -import java.awt.Component; - -import java.util.Vector; -import java.awt.Container; -import java.awt.BorderLayout; -import java.awt.GridLayout; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.LayoutManager; - -import com.ibm.as400.access.AS400Exception; - - - /** - * The VsysvalArrayDialog class defines a dialog - * for the user to modify system values of - * array type. - **/ - class VSysvalArrayDialog - extends JDialog - implements ActionListener, - ListSelectionListener, - KeyListener - { - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - // Private data. - private VSystemValue systemValue_; - - private JButton addButton_; - private JButton removeButton_; - private JButton changeButton_; - private JButton okButton_; - private JButton cancelButton_; - private JButton applyButton_; - - private JList list_; - private JTextField textField_; - private Vector vector_; - private Frame parent_; - - private boolean changed_; - - // MRI - final private static String okButtonText_; - final private static String cancelButtonText_; - final private static String applyButtonText_; - final private static String modifyDialogTitle_; - final private static String modifyActionTab_; - final private static String valueName_; - final private static String valueDescription_; - final private static String valueInformation_; - final private static String addButtonText_; - final private static String removeButtonText_; - final private static String changeButtonText_; - - static - { - - okButtonText_ = (String)ResourceLoader.getText("DLG_OK"); - cancelButtonText_ = (String)ResourceLoader.getText("DLG_CANCEL"); - applyButtonText_ = (String)ResourceLoader.getText("DLG_APPLY"); - modifyDialogTitle_ = (String)ResourceLoader.getText("DLG_MODIFY_0"); // @C1C - modifyActionTab_ = (String)ResourceLoader.getText("ACTION_MODIFY"); - valueName_ = (String)ResourceLoader.getText("COLUMN_NAME"); - valueDescription_ = (String)ResourceLoader.getText("COLUMN_DESCRIPTION"); - valueInformation_ = (String)ResourceLoader.getText("COLUMN_VALUE"); - addButtonText_ = (String)ResourceLoader.getText("DLG_ADD"); - removeButtonText_ = (String)ResourceLoader.getText("DLG_REMOVE"); - changeButtonText_ = (String)ResourceLoader.getText("DLG_CHANGE"); - } - - - /** - * Constructs a VSysvalArrayDialog object. it creates a dialog to modify - * the array value. - * @param frame The parent Frame object. - * @param sysval The SystemValue object. - * - **/ - public VSysvalArrayDialog(Frame frame, VSystemValue sysval) - { - super(frame, ResourceLoader.substitute(modifyDialogTitle_, sysval.getName()),true); // @C1C - parent_ = frame; - - systemValue_ = sysval; - vector_ = new Vector(); - Object[] obj = null; - obj = (Object[])systemValue_.getValue(); - - for (int i=0;i 0) - { - vector_.addElement(text); - list_.setListData(vector_); - changed_ = true; - list_.setSelectedValue(text,true); - changeButton_.setEnabled(false); - applyButton_.setEnabled(true); - } - } - // Remove - else if(source.equals(removeButton_)) - { - index = list_.getSelectedIndex(); - if (index!=-1) - { - vector_.removeElementAt(index); - list_.setListData(vector_); - changed_ = true; - applyButton_.setEnabled(true); - int size = vector_.size(); - if (index0) - list_.setSelectedIndex(size-1); - if (list_.getSelectedIndex()==-1) - { - removeButton_.setEnabled(false); - changeButton_.setEnabled(false); - } - } - } - // Change - else if(source.equals(changeButton_)) - { - index = list_.getSelectedIndex(); - text = textField_.getText(); - if (index!=-1) - { - if (vector_.indexOf(text)==-1) - { - vector_.setElementAt(text,index); - list_.setListData(vector_); // this is to refresh the list - changed_ = true; - applyButton_.setEnabled(true); - changeButton_.setEnabled(false); - } - } - } - // OK - else if(source.equals(okButton_)) - { - if (changed_) - { - int count = vector_.size(); - String[] value= new String[count]; - for (int i=0;i -
  • a property identifier to which the column is associated -
  • the minimum and maximum column width in terms of characters, - rather than pixels - -**/ -class VTableColumn -extends TableColumn -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private int preferredCharWidth_ = 10; - - - -/** -Constructs a VTableColumn object. - -@param columnIndex The column index. -@param propertyIdentifier The property identifier. -**/ - public VTableColumn (int columnIndex, Object propertyIdentifier) - { - super (columnIndex); - setIdentifier (propertyIdentifier); - } - - - -/** -Returns the preferred column width in characters. - -@return The preferred column width in characters. -**/ - public int getPreferredCharWidth () - { - return preferredCharWidth_; - } - - - -/** -Sets the preferred column width in characters. - -@param preferredCharWidth The preferred column width in characters. -**/ - public void setPreferredCharWidth (int preferredCharWidth) - { - preferredCharWidth_ = preferredCharWidth; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VUser.java b/cvsroot/src/com/ibm/as400/vaccess/VUser.java deleted file mode 100644 index 4b7d967be..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VUser.java +++ /dev/null @@ -1,452 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VUser.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400;//@A1A -import com.ibm.as400.access.User; - -import com.ibm.as400.access.QueuedMessage;//@A1A -import com.ibm.as400.access.Trace;//@A1A -import javax.swing.Icon; -import javax.swing.SwingConstants;//@A1A -import javax.swing.table.DefaultTableColumnModel;//@A1A -import javax.swing.table.TableColumnModel;//@A1A -import javax.swing.tree.TreeNode;//@A1A -import java.beans.PropertyChangeListener;//@A1A -import java.beans.VetoableChangeListener;//@A1A -import java.beans.PropertyVetoException;//@A1A -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.Enumeration;//@A1A - - - -/** -The VUser class defines the representation of a user on a -system for use in various models and panes in this package. -You must explicitly call load() to load the information from -the system. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VUser objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • VObjectEvent -
    • WorkingEvent -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VUser -implements VObject, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - private static final String description_ = ResourceLoader.getText ("USER_DESCRIPTION"); - private static final Icon icon16_ = ResourceLoader.getIcon ("VUser16.gif", description_); - private static final Icon icon32_ = ResourceLoader.getIcon ("VUser32.gif", description_); - - private User user_ = null; - - - - - transient private VPropertiesPane propertiesPane_; - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_;//@A1A - transient private VetoableChangeSupport vetoableChangeSupport_;//@A1A - transient private VObjectEventSupport objectEventSupport_; - transient private WorkingEventSupport workingEventSupport_; - - - - - - - - //@A1A - /** - Constructs a VUser object. - **/ - public VUser () - { - user_ = null; - - initializeTransient (); - } - - - - /** - Constructs a VUser object. - - @param user The user. - **/ - public VUser (User user) - { - - if (user == null) - throw new NullPointerException ("user"); - - user_ = user; - - initializeTransient (); - } - - - - - - /** - Adds a listener to be notified when an error occurs. - - @param listener The listener. - **/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - //@A1A - /** - Adds a listener to be notified when the value of any - bound property changes. - - @param listener The listener. - **/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - //@A1A - /** - Adds a listener to be notified when the value of any - constrained property changes. - - @param listener The listener. - **/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - /** - Adds a listener to be notified when a VObject is changed, - created, or deleted. - - @param listener The listener. - **/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - /** - Adds a listener to be notified when work starts and stops - on potentially long-running operations. - - @param listener The listener. - **/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - - /** - Returns the default action. - - @return Always null. There is no default action. - **/ - public VAction getDefaultAction () - { - return null; - } - - - /** - Returns the list of actions that can be performed. - - @return Always null. There are no actions. - **/ - public VAction[] getActions () - { - return null; - } - /** - Returns the description. - - @return The description. - - @see com.ibm.as400.access.User#getDescription - **/ - public String getDescription () - { - return user_.getDescription (); - } - - /** - Returns the icon. - - @param size The icon size, either 16 or 32. If any other - value is given, then return a default. - @param open This parameter has no effect. - @return The icon. - **/ - public Icon getIcon (int size, boolean open) - { - if (size == 32) - return icon32_; - else - return icon16_; - } - //@A1C Changed from return user_.getName(); because if new a VUser object with the - //VUser() constructor, user_ is null. - /** - Returns the user name. - - @return The user name. - **/ - public String getName () - { - if (user_ != null) - return user_.getName (); - else - return ""; - } - - - - - - /** - Returns the properties pane. - - @return The properties pane. - **/ - public VPropertiesPane getPropertiesPane () - { - return propertiesPane_; - } - - - - /** - Returns a property value. - - @param propertyIdentifier The property identifier. The choices are - NAME_PROPERTY and DESCRIPTION_PROPERTY. - @return The property value, or null if the - property identifier is not recognized. - **/ - public Object getPropertyValue (Object propertyIdentifier) - { - // Get the name. - if (propertyIdentifier== NAME_PROPERTY) - return this; - - - else if (propertyIdentifier== DESCRIPTION_PROPERTY) - return user_.getDescription(); - // By default, return null. - return null; - } - - //@A1A - /** - Returns the system on which the user resides. - - @return The system on which the user resides. - - **/ - public AS400 getSystem () - { - return user_.getSystem(); - } - - /** - Returns the text. This is the user name. - - @return The text which is the user name. - **/ - public String getText () - { - if (user_ != null) - return user_.getName (); - else - return ""; - } - //@A1A - /** - Returns the user. - - @return The user, or null if it has not been set. - **/ - public User getUser () - { - return user_; - } - /** - Initializes the transient data. - **/ - private void initializeTransient () - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - objectEventSupport_ = new VObjectEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this);//@A1A - vetoableChangeSupport_ = new VetoableChangeSupport (this);//@A1A - workingEventSupport_ = new WorkingEventSupport (this); - - - - // Initialize the properties pane. - propertiesPane_ = new UserPropertiesPane (this, user_); - - propertiesPane_.addErrorListener (errorEventSupport_); - propertiesPane_.addVObjectListener (objectEventSupport_); - propertiesPane_.addWorkingListener (workingEventSupport_); - } - - - /** - Loads information about the object from the system. - **/ - public void load () - { - - - } - - - /** - Restores the state of the object from an input stream. - This is used when deserializing an object. - - @param in The input stream. - **/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - /** - Removes an error listener. - - @param listener The listener. - **/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - //@A1A - /** - Removes a property change listener. - - @param listener The listener. - **/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - //@A1A - /** - Removes a vetoable change listener. - - @param listener The listener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - /** - Removes a VObjectListener. - - @param listener The listener. - **/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - /** - Removes a working listener. - - @param listener The listener. - **/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - //@A1A - /** - Sets the user. - - @param user The user. - - @exception PropertyVetoException If the change is vetoed. - **/ - public void setUser (User user) - throws PropertyVetoException - { - if (user == null) - throw new NullPointerException ("user"); - - User oldValue = user_; - User newValue = user; - vetoableChangeSupport_.fireVetoableChange ("user", oldValue, newValue); - - if (oldValue != newValue) { - - user_ = user; - - - } - - propertyChangeSupport_.firePropertyChange ("user", oldValue, newValue); - } - - /** - Returns the string representation of the user name. - - @return The string representation of the user name. - **/ - public String toString () - { - return getText (); - } - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VUser16.gif b/cvsroot/src/com/ibm/as400/vaccess/VUser16.gif deleted file mode 100644 index 0a35fe116..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VUser16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VUser32.gif b/cvsroot/src/com/ibm/as400/vaccess/VUser32.gif deleted file mode 100644 index 6c0bd075b..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VUser32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VUserAndGroup.java b/cvsroot/src/com/ibm/as400/vaccess/VUserAndGroup.java deleted file mode 100644 index 1993d8589..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VUserAndGroup.java +++ /dev/null @@ -1,588 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VUserAndGroup.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.UserList; -import javax.swing.Icon; -import javax.swing.table.TableColumnModel; -import javax.swing.table.DefaultTableColumnModel; -import javax.swing.table.TableCellRenderer; -import javax.swing.table.TableColumn; -import javax.swing.tree.TreeNode; -// @A3D import java.beans.PropertyChangeSupport; -// @A3D import java.beans.VetoableChangeSupport; -import java.beans.VetoableChangeListener; -import java.beans.PropertyChangeListener; -import java.io.ObjectInputStream; -import java.util.Enumeration; - -/** - * The VUserAndGroup class represents the users and groups. - * -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VUserAndGroup - implements VNode, java.io.Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - //MRI - // @A1A - private static final String allUsersText_ =ResourceLoader.getText("USER_ALL_USERS").trim(); - private static final String usersNotInGroupsText_ =ResourceLoader.getText("USER_USERS_NOT_IN_GROUPS").trim(); - private static final String groupsText_ =ResourceLoader.getText("USER_GROUPS").trim(); - // @A1A end - //MRI end - - private static Icon icon16_ = ResourceLoader.getIcon ("VUserList16.gif", ResourceLoader.getText ("USER_LIST_DESCRIPTION")); - private static Icon icon32_ = ResourceLoader.getIcon ("VUserList32.gif", ResourceLoader.getText ("USER_LIST_DESCRIPTION")); - private AS400 as400_; - private VNode parent_; - - private transient VNode[] children_; // These are VUserList objects - - private transient ErrorEventSupport errorEventSupport_; - private transient PropertyChangeSupport propertyChangeSupport_; - private transient VetoableChangeSupport vetoableChangeSupport_; - private transient VObjectEventSupport objectEventSupport_; - private transient WorkingEventSupport workingEventSupport_; - - private static TableColumnModel detailsColumnModel_; - private static String nameColumnHeader_ = ResourceLoader.getText ("USER_LIST_NAME"); - private static String descriptionColumnHeader_ = ResourceLoader.getText ("USER_DESCRIPTION_PROMPT"); - private static String description_ = ResourceLoader.getText ("USER_USER_AND_GROUP"); - - /** - Static initializer. - **/ - static - { - detailsColumnModel_= new DefaultTableColumnModel(); - int i= 0; - - VTableColumn vTable1= new VTableColumn(i++, NAME_PROPERTY); - vTable1.setCellRenderer(((TableCellRenderer)new VObjectCellRenderer())); - vTable1.setHeaderRenderer(((TableCellRenderer)new VObjectHeaderRenderer())); - vTable1.setHeaderValue(nameColumnHeader_); - vTable1.setPreferredCharWidth(10); - detailsColumnModel_.addColumn(((TableColumn)vTable1)); - - VTableColumn vTable2= new VTableColumn(i++, DESCRIPTION_PROPERTY); - vTable2.setCellRenderer(((TableCellRenderer)new VObjectCellRenderer())); - vTable2.setHeaderRenderer(((TableCellRenderer)new VObjectHeaderRenderer())); - vTable2.setHeaderValue(descriptionColumnHeader_); - vTable2.setPreferredCharWidth(70); - detailsColumnModel_.addColumn(((TableColumn)vTable2)); - - } - - /** - Constructs a VUserAndGroup object. - @param as400 The system in which the user information resides. - **/ - public VUserAndGroup(AS400 as400) - { - if (as400 == null) - { - throw new NullPointerException("system"); - } - as400_ = as400; - initializeTransient(); - } - - /** - Constructs a VUserAndGroup object. - @param parent The parent. - @param system The system in which the user information resides. - **/ - public VUserAndGroup(VNode parent, AS400 system) - { - if (parent == null) - { - throw new NullPointerException("parent"); - } - if (system == null) - { - throw new NullPointerException("system"); - } - as400_ = system; - parent_ = parent; - initializeTransient(); - } - - /** - Adds a listener to be notified when an error occurs. - @param listener The listener. - **/ - public void addErrorListener(ErrorListener listener) - { - errorEventSupport_.addErrorListener(listener); - } - - /** - Adds a listener to be notified when the value of any - bound property changes. - @param listener The listener. - **/ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - propertyChangeSupport_.addPropertyChangeListener(listener); - } - - /** - Adds a listener to be notified when the value of any - constrained property changes. - @param listener The listener. - **/ - public void addVetoableChangeListener(VetoableChangeListener listener) - { - vetoableChangeSupport_.addVetoableChangeListener(listener); - } - - /** - Adds a listener to be notified when a VObject is changed, - created, or deleted. - @param listener The listener. - **/ - public void addVObjectListener(VObjectListener listener) - { - objectEventSupport_.addVObjectListener(listener); - } - - /** - Adds a listener to be notified when work starts and stops - on potentially long-running operations. - @param listener The listener. - **/ - public void addWorkingListener(WorkingListener listener) - { - workingEventSupport_.addWorkingListener(listener); - } - - /** - Returns the children of the node. - @return The children. - **/ - public Enumeration children() - { - return (Enumeration)(new VEnumeration(this)); - } - - /** - Returns the list of actions that can be performed. - @return Always null. There are no actions. - **/ - public VAction[] getActions() - { - return null; - } - - /** - Indiciates if the node allows children. - @return Always false. - **/ - public boolean getAllowsChildren() - { - return true; - } - - /** - Returns the child node at the specified index. - @param index The index. - @return Always null. - **/ - public TreeNode getChildAt(int index) - { - if ( (index < 0) || (index >= children_.length)) - { - return null; - } - return children_[index]; - } - - /** - Returns the number of children. - @return Always 0. - **/ - public int getChildCount() - { - return children_.length; - } - - /** - Returns the default action. - @return Always null. There is no default action. - **/ - public VAction getDefaultAction() - { - return null; - } - - /** - Returns the child for the details at the specified index. - @param index The index. - @return The child, or null if the index is not - valid. - **/ - public VObject getDetailsChildAt(int index) - { - if ( (index < 0) || (index >= children_.length)) - { - return null; - } - return children_[index]; - } - - /** - Returns the number of children for the details. - @return The number of children for the details. - **/ - public int getDetailsChildCount() - { - return children_.length; - } - - - /** - Returns the table column model to use in the details - when representing the children. This column model - describes the details values for the children. - - @return The details column model. - **/ - public TableColumnModel getDetailsColumnModel() - { - return detailsColumnModel_; - } - - /** - Returns the index of the specified child for the details. - @param detailsChild The details child. - @return The index, or -1 if the child is not found - in the details. - **/ - public int getDetailsIndex(VObject detailsChild) - { - for (int i = 0; i < children_.length; i++) - { - if (children_[i].equals(detailsChild)) - { - return i; - } - } - return -1; - } - - /** - Returns the icon. - @param size The icon size, either 16 or 32. If any other - value is given, then return a default. - @param open This parameter has no effect. - @return The icon. - **/ - public Icon getIcon(int size, boolean open) - { - if (size != 32) - { - return icon16_; - } - return icon32_; - } - - - /** - Returns the index of the specified child. - @param child The child. - @return Always -1. - **/ - public int getIndex(TreeNode child) - { - for (int index = 0; index < children_.length; index++) - { - if (children_[index].equals(child)) - { - return index; - } - } - return -1; - } - - // @A1A : Gets user list name. - private String getListName(UserList userList) - { - String userInfo = userList.getUserInfo(); - String groupInfo = userList.getGroupInfo(); - // @A3D if (userInfo == null) - // @A3D { - // @A3D Trace.log(Trace.ERROR, "Parameter 'userInfo' of userList is null."); - // @A3D throw new NullPointerException("userInfo"); - // @A3D } - // @A3D if (groupInfo == null) - // @A3D { - // @A3D Trace.log(Trace.ERROR, "Parameter 'groupInfo' of userList is null."); - // @A3D throw new NullPointerException("groupInfo"); - // @A3D } - - if (userInfo.toLowerCase().equals("*all")) - { - if (groupInfo.toLowerCase().equals("*none")) - return allUsersText_; - } - if (userInfo.toLowerCase().equals("*member")) - { - if (groupInfo.toLowerCase().equals("*nogroup")) - return usersNotInGroupsText_; - } - if (userInfo.toLowerCase().equals("*group")) - { - if (groupInfo.toLowerCase().equals("*none")) - return groupsText_; - } - - Trace.log(Trace.ERROR,"userInfo or groupInfo's value is invalid"); - Trace.log(Trace.INFORMATION,"userInfo : "+userInfo); - Trace.log(Trace.INFORMATION,"groupInfo : "+groupInfo); - return ""; - } - - /** - Returns the parent node. - @return The parent node, or null if there is no parent. - **/ - public TreeNode getParent() - { - return parent_; - } - - /** - Returns the properties pane. - @return The properties pane. - **/ - public VPropertiesPane getPropertiesPane() - { - return null; - } - - - /** - Returns a property value. - @param propertyIdentifier The property identifier. - The choices are NAME_PROPERTY - and DESCRIPTION_PROPERTY. - @return The property value, or null if the property - identifier is not recognized. - **/ - public Object getPropertyValue(Object propertyIdentifier) - { - if (propertyIdentifier == NAME_PROPERTY) - { - return this; - } - if (propertyIdentifier == DESCRIPTION_PROPERTY) - { - return description_; - } - return null; - } - - /** - Returns the system in which the user information resides. - @return The system in which the user information resides. - **/ - public AS400 getSystem() - { - return as400_; - } - - /** - Returns the description text. - @return The description text. - **/ - public String getText() - { - return description_; - } - - /** - Initializes the transient data. - **/ - private void initializeTransient() - { - errorEventSupport_= new ErrorEventSupport(this); - objectEventSupport_= new VObjectEventSupport(this); - propertyChangeSupport_= new PropertyChangeSupport(this); - vetoableChangeSupport_= new VetoableChangeSupport(this); - workingEventSupport_= new WorkingEventSupport(this); - - children_= new VUserList[3]; - UserList[] listchild = new UserList[3]; - listchild[0] = new UserList(as400_, "*ALL", "*NONE"); - listchild[1] = new UserList(as400_, "*GROUP", "*NONE"); - listchild[2] = new UserList(as400_, "*MEMBER", "*NOGROUP"); - for (int i=0; i<3; ++i) - { - children_[i] = new VUserList(listchild[i], getListName(listchild[i])); - //@B0 - Need to set the parent to this, otherwise will get NullPointerExceptions - // when Swing tries to repaint. - ((VUserList)children_[i]).parent_ = this; //@B0A - children_[i].addErrorListener(errorEventSupport_); - children_[i].addVObjectListener(objectEventSupport_); - children_[i].addWorkingListener(workingEventSupport_); - } - } - - /** - Indicates if the node is a leaf. - @return If the node is a leaf. - **/ - public boolean isLeaf() - { - return false; - } - - /** - Indicates if the details children are sortable. - @return Always false. - **/ - public boolean isSortable() - { - return false; - } - - /** - Loads information about the object from the system. - **/ - public void load() - { - workingEventSupport_.fireStartWorking(); - try - { - // We make a connection here so that a signon dialog does - // not appear when we are loading a VUserList. If - // that should happen, it will hang. - as400_.connectService(AS400.COMMAND); - for(int i = 0; i < children_.length; ++i) // @C1A - children_[i].load(); // @C1A - } - catch(Exception e) - { - errorEventSupport_.fireError(e); - } - workingEventSupport_.fireStopWorking(); - } - - /** - Restores the state of the object from an input stream. - This is used when deserializing an object. - @param in The input stream. - **/ - private void readObject(ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - in.defaultReadObject(); - initializeTransient(); - } - - /** - Removes an error listener. - @param listener The listener. - **/ - public void removeErrorListener(ErrorListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - - errorEventSupport_.removeErrorListener(listener); - } - - /** - Removes a property change listener. - @param listener The listener. - **/ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - propertyChangeSupport_.removePropertyChangeListener(listener); - } - - /** - Removes a vetoable change listener. - @param listener The listener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - vetoableChangeSupport_.removeVetoableChangeListener(listener); - } - - /** - Removes a VObjectListener. - @param listener The listener. - **/ - public void removeVObjectListener(VObjectListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - - objectEventSupport_.removeVObjectListener(listener); - } - - /** - Removes a working listener. - @param listener The listener. - **/ - public void removeWorkingListener(WorkingListener listener) - { - workingEventSupport_.removeWorkingListener(listener); - } - - /** - Sorts the children for the details. Since sorting is not supported, - this method does nothing. - @param propertyIdentifiers The property identifiers. - @param orders The sort orders for each property - identifier. true for ascending order; - false for descending order. - **/ - public void sortDetailsChildren(Object[] propertyIdentifiers, boolean[] orders) - { - // No sorting here! - } - - /** - Returns the string representation of the description. - @return The string representation of the description. - **/ - public String toString() - { - return description_; - } -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VUserList.java b/cvsroot/src/com/ibm/as400/vaccess/VUserList.java deleted file mode 100644 index 02215ebf4..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VUserList.java +++ /dev/null @@ -1,981 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VUserList.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import javax.swing.table.TableCellRenderer;//@A1A - -import javax.swing.table.TableColumn;//@A1A -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.User; -import com.ibm.as400.access.UserList; -import javax.swing.Icon; -import javax.swing.SwingConstants; -import javax.swing.table.TableColumnModel; -import javax.swing.table.DefaultTableColumnModel; -import javax.swing.tree.TreeNode; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.Enumeration; - - - -/** -The VUserList class defines the representation of a user list -on a system for use in various models and panes in this package. -You must explicitly call load() to load the information from -the system. - -

    Most errors are reported as ErrorEvents rather than -throwing exceptions. Users should listen for ErrorEvents -in order to diagnose and recover from error conditions. - -

    VUserList objects generate the following events: -

      -
    • ErrorEvent -
    • PropertyChangeEvent -
    • VObjectEvent -
    • WorkingEvent -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VUserList -implements VNode, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - private static final String genericDescription_ = ResourceLoader.getText ("USER_LIST_DESCRIPTION"); // @A5A - private String description_ = genericDescription_; // @A5C - - // MRI. - private static Icon icon16_ = ResourceLoader.getIcon ("VUserList16.gif", ResourceLoader.getText ("USER_LIST_DESCRIPTION")); - private static Icon icon32_ = ResourceLoader.getIcon ("VUserList32.gif", ResourceLoader.getText ("USER_LIST_DESCRIPTION")); - private static String nameColumnHeader_ = ResourceLoader.getText ("USER_USER_NAME");// @A1A - private static String descriptionColumnHeader_ =ResourceLoader.getText ("USER_DESCRIPTION_PROMPT");// @A1A - - // @A1A - private static final String allUsersText_ =ResourceLoader.getText("USER_ALL_USERS").trim();// @A1A - private static final String allUsersDescription_ =ResourceLoader.getText("USER_ALL_USERS_DES").trim();// @A1A - private static final String usersNotInGroupsText_ =ResourceLoader.getText("USER_USERS_NOT_IN_GROUPS").trim();// @A1A - private static final String usersNotInGroupsDescription_=ResourceLoader.getText("USER_USERS_NOT_IN_GROUPS_DES").trim();// @A1A - private static final String groupsText_ =ResourceLoader.getText("USER_GROUPS").trim();// @A1A - private static final String groupsDescription_ =ResourceLoader.getText("USER_GROUPS_DES").trim();// @A1A - // end - - - // Properties. - private UserList userList_ = null; - //@B0 - Made parent_ package scope so that VUserAndGroup can set it. - VNode parent_ = null; //@B0C - made package scope - private boolean isLoaded_ = false; // @A3A - - - // Static data. - private static TableColumnModel detailsColumnModel_ = null; - - - - // Private data. - transient private VObject[] detailsChildren_; - transient private Enumeration enum_; - transient private int loaded_; - transient private VPropertiesPane propertiesPane_; - - - - // Event support. - transient private ErrorEventSupport errorEventSupport_; - transient private PropertyChangeSupport propertyChangeSupport_; - transient private VetoableChangeSupport vetoableChangeSupport_; - transient private VObjectEventSupport objectEventSupport_; - transient private WorkingEventSupport workingEventSupport_; - - - - /** - Static initializer. - **/ - // - // Implementation note: - // - // * The column widths are completely arbitrary. - // - static - { - detailsColumnModel_= null; - detailsColumnModel_= new DefaultTableColumnModel(); - int i= 0; - - VTableColumn vTable1= new VTableColumn(i++, NAME_PROPERTY); - vTable1.setCellRenderer(((TableCellRenderer)new VObjectCellRenderer())); - vTable1.setHeaderRenderer(((TableCellRenderer)new VObjectHeaderRenderer())); - vTable1.setHeaderValue(nameColumnHeader_); - vTable1.setPreferredCharWidth(15); - detailsColumnModel_.addColumn(((TableColumn)vTable1)); - - - VTableColumn vTable2= new VTableColumn(i++, DESCRIPTION_PROPERTY); - vTable2.setCellRenderer(((TableCellRenderer)new VObjectCellRenderer())); - vTable2.setHeaderRenderer(((TableCellRenderer)new VObjectHeaderRenderer())); - vTable2.setHeaderValue(descriptionColumnHeader_); - vTable2.setPreferredCharWidth(70); - detailsColumnModel_.addColumn(((TableColumn)vTable2)); - - } - - - /** - Constructs a VUserList object. - **/ - public VUserList() - { - userList_ = new UserList (); - initializeTransient (); - } - - - - /** - Constructs a VUserList object. - - @param system The system from which the user will be retrieved. - **/ - public VUserList (AS400 system) - { - if (system == null) - throw new NullPointerException ("system"); - - userList_ = new UserList (system); - initializeTransient (); - } - // @A1A - /** - * Constructs a VUserList object. - * @param userList The UserList object. - * @param listName The name of the user list. - * - **/ - public VUserList (UserList userList,String listName) - { - - description_=listName; - userList_ =userList; - initializeTransient (); - } - - /** - Constructs a VUserList object. - - @param parent The parent. - @param system The system from which the user will be retrieved.. - **/ - public VUserList (VNode parent, AS400 system) - { - if (parent == null) - throw new NullPointerException ("parent"); - if (system == null) - throw new NullPointerException ("system"); - - parent_ = parent; - userList_ = new UserList (system); - initializeTransient (); - } - - - - /** - Adds a listener to be notified when an error occurs. - - @param listener The listener. - **/ - public void addErrorListener (ErrorListener listener) - { - errorEventSupport_.addErrorListener (listener); - } - - - - /** - Adds a listener to be notified when the value of any - bound property changes. - - @param listener The listener. - **/ - public void addPropertyChangeListener (PropertyChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - propertyChangeSupport_.addPropertyChangeListener (listener); - } - - - - /** - Adds a listener to be notified when the value of any - constrained property changes. - - @param listener The listener. - **/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - vetoableChangeSupport_.addVetoableChangeListener (listener); - } - - - - /** - Adds a listener to be notified when a VObject is changed, - created, or deleted. - - @param listener The listener. - **/ - public void addVObjectListener (VObjectListener listener) - { - objectEventSupport_.addVObjectListener (listener); - } - - - - /** - Adds a listener to be notified when work starts and stops - on potentially long-running operations. - - @param listener The listener. - **/ - public void addWorkingListener (WorkingListener listener) - { - workingEventSupport_.addWorkingListener (listener); - } - - - - /** - Returns the children of the node. - - @return The children. - **/ - public Enumeration children () - { - return new VEnumeration (this); - } - - - - /** - Returns the list of actions that can be performed. - - @return Always null. There are no actions. - **/ - public VAction[] getActions () - { - return null; - } - - - - /** - Indiciates if the node allows children. - - @return Always false. - **/ - public boolean getAllowsChildren () - { - return false; - } - - - - /** - Returns the child node at the specified index. - - @param index The index. - @return Always null. - **/ - public TreeNode getChildAt (int index) - { - return null; - } - - - - /** - Returns the number of children. - - @return Always 0. - **/ - public /* @A3D synchronized */ int getChildCount () - { - return 0; - } - - - - /** - Returns the default action. - - @return Always null. There is no default action. - **/ - public VAction getDefaultAction () - { - return null; - } - - // @A1A : Gets user list description. - private String getDescription(UserList userList) - { - String userInfo = userList.getUserInfo(); - String groupInfo = userList.getGroupInfo(); - // @A5D if (userInfo == null) - // @A5D { - // @A5D Trace.log(Trace.ERROR, "Parameter 'userInfo' of userList is null."); - // @A5D throw new NullPointerException("userInfo"); - // @A5D } - // @A5D if (groupInfo == null) - // @A5D { - // @A5D Trace.log(Trace.ERROR, "Parameter 'groupInfo' of userList is null."); - // @A5D throw new NullPointerException("groupInfo"); - // @A5D } - - if (userInfo.toLowerCase().equals("*all")) - { - if (groupInfo.toLowerCase().equals("*none")) - return allUsersDescription_; - } - if (userInfo.toLowerCase().equals("*member")) - { - if (groupInfo.toLowerCase().equals("*nogroup")) - return usersNotInGroupsDescription_; - } - if (userInfo.toLowerCase().equals("*group")) - { - if (groupInfo.toLowerCase().equals("*none")) - return groupsDescription_; - } - - Trace.log(Trace.ERROR,"userInfo or groupInfo's value is invalid"); - Trace.log(Trace.INFORMATION,"userInfo : "+userInfo); - Trace.log(Trace.INFORMATION,"groupInfo : "+groupInfo); - return ""; - } - - /** - Returns the child for the details at the specified index. - - @param index The index. - @return The child, or null if the index is not - valid. - **/ - public VObject getDetailsChildAt (int index) - { - if ((index < 0) || (index >= detailsChildren_.length)) - return null; - loadMore (index); - return detailsChildren_[index]; - } - - - - /** - Returns the number of children for the details. - - @return The number of children for the details. - **/ - public /* @A3D synchronized */ int getDetailsChildCount () - { - // @C1D if (!isLoaded_) //@A3A - // @C1D load(); //@A3A - return detailsChildren_.length; - } - - - - /** - Returns the table column model to use in the details - when representing the children. This column model - describes the details values for the children. - - @return The details column model. - **/ - public TableColumnModel getDetailsColumnModel () - { - return detailsColumnModel_; - } - - - - /** - Returns the index of the specified child for the details. - - @param detailsChild The details child. - @return The index, or -1 if the child is not found - in the details. - **/ - public /* @A3D synchronized */ int getDetailsIndex (VObject detailsChild) - { - // @C1D if (!isLoaded_) //@A3A - // @C1D load(); //@A3A - for (int i = 0; i < loaded_; ++i) - if (detailsChildren_[i].equals(detailsChild)) - return i; - return -1; - } - - - /** - Returns the group information. - - @return The group information. - - @see com.ibm.as400.access.UserList#getGroupInfo - **/ - public String getGroupInfo () - { - return userList_.getGroupInfo (); - } - - - - /** - Returns the icon. - - @param size The icon size, either 16 or 32. If any other - value is given, then return a default. - @param open This parameter has no effect. - @return The icon. - **/ - public Icon getIcon (int size, boolean open) - { - if (size == 32) - return icon32_; - else - return icon16_; - } - - - - /** - Returns the index of the specified child. - - @param child The child. - @return Always -1. - **/ - public /* @A3D synchronized */ int getIndex (TreeNode child) - { - return -1; - } - - - - /** - Returns the parent node. - - @return The parent node, or null if there is no parent. - **/ - public TreeNode getParent () - { - return parent_; - } - - /* @A5D - // @A1A : Gets user list name. - private String getListName(UserList userList) - { - String userInfo = userList.getUserInfo(); - String groupInfo = userList.getGroupInfo(); - if (userInfo == null) - { - Trace.log(Trace.ERROR, "Parameter 'userInfo' of userList is null."); - throw new NullPointerException("userInfo"); - } - if (groupInfo == null) - { - Trace.log(Trace.ERROR, "Parameter 'groupInfo' of userList is null."); - throw new NullPointerException("groupInfo"); - } - - if (userInfo.toLowerCase().equals("*all")) - { - if (groupInfo.toLowerCase().equals("*none")) - return allUsersText_; - } - if (userInfo.toLowerCase().equals("*member")) - { - if (groupInfo.toLowerCase().equals("*nogroup")) - return usersNotInGroupsText_; - } - if (userInfo.toLowerCase().equals("*group")) - { - if (groupInfo.toLowerCase().equals("*none")) - return groupsText_; - } - - Trace.log(Trace.ERROR,"userInfo or groupInfo's value is invalid"); - Trace.log(Trace.INFORMATION,"userInfo : "+userInfo); - Trace.log(Trace.INFORMATION,"groupInfo : "+groupInfo); - return ""; - - } - */ - - /** - Returns the properties pane. - - @return The properties pane. - **/ - public VPropertiesPane getPropertiesPane () - { - return propertiesPane_; - } - - - - /** - Returns a property value. - - @param propertyIdentifier The property identifier. The choices are - NAME_PROPERTY and DESCRIPTION_PROPERTY. - @return The property value, or null if the - property identifier is not recognized. - **/ - public Object getPropertyValue( - Object propertyIdentifier) - { - if( propertyIdentifier==NAME_PROPERTY) - { - // @A5D return getListName(userList_); - return this; // @A5A - } - else if( propertyIdentifier==DESCRIPTION_PROPERTY) - { - return getDescription(userList_); - } - return null; - } - - - /** - Returns the system from which the user will be retrieved. - - @return The system from which the user will be retrieved. - **/ - public AS400 getSystem () - { - return userList_.getSystem (); - } - - - - /** - Returns the description text. - - @return The description text. - **/ - public String getText () - { - return description_; - } - - - - /** - Returns the user information. - - @return The user information. - - @see com.ibm.as400.access.UserList#getUserInfo - **/ - public String getUserInfo () - { - return userList_.getUserInfo (); - } - - - - /** - Initializes the transient data. - **/ - private void initializeTransient () - { - // Initialize the event support. - errorEventSupport_ = new ErrorEventSupport (this); - objectEventSupport_ = new VObjectEventSupport (this); - propertyChangeSupport_ = new PropertyChangeSupport (this); - vetoableChangeSupport_ = new VetoableChangeSupport (this); - - workingEventSupport_ = new WorkingEventSupport (this); - - userList_.addPropertyChangeListener (propertyChangeSupport_); - userList_.addVetoableChangeListener (vetoableChangeSupport_); - - // Initialize the private data. - detailsChildren_ = new VObject[0]; - enum_ = null; - loaded_ = -1; - - // Initialize the properties pane. - propertiesPane_ = new UserListPropertiesPane (this,userList_);// @A1C - - propertiesPane_.addErrorListener (errorEventSupport_); - propertiesPane_.addVObjectListener (objectEventSupport_); - propertiesPane_.addWorkingListener (workingEventSupport_); - - } - - - - /** - Indicates if the node is a leaf. - - @return Always true. - **/ - public boolean isLeaf () - { - return true; - } - - - - /** - Indicates if the details children are sortable. - - @return Always false. - **/ - // - // Implementation note: We do not allow sorting because of the fact - // that we load the list incrementally. - // - public boolean isSortable () - { - return false; - } - - - - /** - Loads information about the object from the system. - **/ - public void load() - { - if (Trace.isTraceOn ()) - Trace.log (Trace.INFORMATION, "Loading users for user list."); - - workingEventSupport_.fireStartWorking (); - - Exception error = null; - - try { // @A2A - enum_ = userList_.getUsers(); // @A2A - } // @A2A - catch (Exception e) { // @A2A - error = e; // @A2A - } // @A2A - - synchronized (this) { - - // Stop listening to the previous children. - for (int i = 0; i < loaded_; ++i) { - detailsChildren_[i].removeErrorListener (errorEventSupport_); - detailsChildren_[i].removeVObjectListener (objectEventSupport_); - detailsChildren_[i].removeWorkingListener (workingEventSupport_); - } - - // Refresh the children based on the user list. - loaded_ = 0; - // @A2D try { - // @A2D enum_ = userList_.getUsers (); - if (error == null) // @A2A - // @A2D detailsChildren_ = new VObject[userList_.getLength ()];// @A1C - detailsChildren_ = new VUser[userList_.getLength()];// @A2A - else // @A2A - detailsChildren_ = new VUser[0]; // @A2A - // @A2D } - // @A2D catch (Exception e) { - // @A2D error = e; - // @A2D detailsChildren_ = new VObject[0];// @A1C - // @A2D } - } - - // This line used to be the last line in the method but - // that caused an infininte loop. The event support - // calls load(). Since isLoaded_ is still - // false, userList ran to the system to get user info again. - // My moving isLoaded=true to here, the event support - // knows we have the info and there is no need to go to the system. - isLoaded_ = true; // @B1m - - if (error != null) - errorEventSupport_.fireError (error); - - workingEventSupport_.fireStopWorking (); //@B0M - moved this to before fireObjectChanged - - objectEventSupport_.fireObjectChanged (this, true); // @A2A - - } - - - - - /** - Loads more messages from the enumeration, if needed - - @param index The index needed. - **/ - private void loadMore (int index) - { - // @A5D if (enum_ == null) // @A3A - // @A5D load(); // @A3A - - if (index >= loaded_) { - - workingEventSupport_.fireStartWorking (); - - Exception error = null; - // @A2D synchronized (this) { - - for (int i = loaded_; i <= index; ++i) { - User user = (User) enum_.nextElement (); - - detailsChildren_[i] = new VUser (user); - - detailsChildren_[i].addErrorListener (errorEventSupport_); - detailsChildren_[i].addVObjectListener (objectEventSupport_); - detailsChildren_[i].addWorkingListener (workingEventSupport_); - } - - // @A2D } - - loaded_ = index + 1; - - if (error != null) - errorEventSupport_.fireError (error); - - workingEventSupport_.fireStopWorking (); - } - } - - - - /** - Restores the state of the object from an input stream. - This is used when deserializing an object. - - @param in The input stream. - **/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - - - /** - Removes an error listener. - - @param listener The listener. - **/ - public void removeErrorListener (ErrorListener listener) - { - errorEventSupport_.removeErrorListener (listener); - } - - - - /** - Removes a property change listener. - - @param listener The listener. - **/ - public void removePropertyChangeListener (PropertyChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - propertyChangeSupport_.removePropertyChangeListener (listener); - } - - - - /** - Removes a vetoable change listener. - - @param listener The listener. - **/ - public void removeVetoableChangeListener(VetoableChangeListener listener) - { - if (listener == null) - { - Trace.log(Trace.ERROR, "Parameter 'listener' is null."); - throw new NullPointerException("listener"); - } - vetoableChangeSupport_.removeVetoableChangeListener (listener); - } - - - - /** - Removes a VObjectListener. - - @param listener The listener. - **/ - public void removeVObjectListener (VObjectListener listener) - { - objectEventSupport_.removeVObjectListener (listener); - } - - - - /** - Removes a working listener. - - @param listener The listener. - **/ - public void removeWorkingListener (WorkingListener listener) - { - workingEventSupport_.removeWorkingListener (listener); - } - - - - /** - Sets the group information. The default is UserList.NONE. - - @param groupInfo The group information, either - a group name, UserList.NOGROUP - or UserList.NONE. - - - @exception PropertyVetoException If the change is vetoed. - - @see com.ibm.as400.access.UserList#setGroupInfo - **/ - public void setGroupInfo (String groupInfo) - throws PropertyVetoException - { - if (groupInfo == null) - throw new NullPointerException ("groupInfo"); - - userList_.setGroupInfo (groupInfo); - } - - - - /** - Sets the system in which the user information resides. - - @param system The system in which the user information resides. - - @exception PropertyVetoException If the change is vetoed. - **/ - public void setSystem (AS400 system) - throws PropertyVetoException - { - if (system == null) - throw new NullPointerException ("system"); - AS400 oldValue = userList_.getSystem ();// @A1C - AS400 newValue = system;// @A1C - vetoableChangeSupport_.fireVetoableChange ("system", oldValue, newValue);// @A1C - - if (oldValue != newValue) - { - try - { - userList_.setSystem (system); - } - catch (PropertyVetoException e) - { - // Ignore. - } - }// @A1C - - propertyChangeSupport_.firePropertyChange ("system", oldValue, newValue);// @A1C - - } - - - - /** - Sets the user information. The default is UserList.ALL. - - @param userInfo The user information, one of: -
      -
    • UserList.ALL -
    • UserList.USER -
    • UserList.GROUP -
    • UserList.MEMBER -
    - - - @exception PropertyVetoException If the change is vetoed. - - @see com.ibm.as400.access.UserList#setUserInfo - **/ - public void setUserInfo (String userInfo) - throws PropertyVetoException - { - if (userInfo == null) - throw new NullPointerException ("userInfo"); - - userList_.setUserInfo (userInfo); - } - - - - - /** - Sorts the children for the details. Since sorting is not supported, - this method does nothing. - - @param propertyIdentifiers The property identifiers. - @param orders The sort orders for each property - identifier. true for ascending order; - false for descending order. - **/ - public void sortDetailsChildren (Object[] propertyIdentifiers, - boolean[] orders) - { - // No sorting here! - } - - - - /** - Returns the string representation of the description. - - @return The string representation of the description. - **/ - public String toString () - { - return description_; - } - - - -} diff --git a/cvsroot/src/com/ibm/as400/vaccess/VUserList16.gif b/cvsroot/src/com/ibm/as400/vaccess/VUserList16.gif deleted file mode 100644 index 4031c3ac9..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VUserList16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VUserList32.gif b/cvsroot/src/com/ibm/as400/vaccess/VUserList32.gif deleted file mode 100644 index e4ac5091c..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VUserList32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VUserListBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/VUserListBeanInfo.java deleted file mode 100644 index 5966bf25a..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VUserListBeanInfo.java +++ /dev/null @@ -1,204 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VUserListBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; -import java.beans.VetoableChangeListener; - - - -/** -The VUserListBeanInfo class provides bean information -for the VUserList class. - -@see VUserList -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class VUserListBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = VUserList.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - EventSetDescriptor error = new EventSetDescriptor (beanClass_, - "error", ErrorListener.class, "errorOccurred"); - error.setDisplayName (ResourceLoader.getText ("EVT_NAME_ERROR")); - error.setShortDescription (ResourceLoader.getText ("EVT_DESC_ERROR")); - - EventSetDescriptor propertyChange = new EventSetDescriptor (beanClass_, - "propertyChange", PropertyChangeListener.class, "propertyChange"); - propertyChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_CHANGE")); - propertyChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_CHANGE")); - - EventSetDescriptor vetoableChange = new EventSetDescriptor (beanClass_, - "propertyChange", VetoableChangeListener.class, "vetoableChange"); - vetoableChange.setDisplayName (ResourceLoader.getText ("EVT_NAME_PROPERTY_VETO")); - vetoableChange.setShortDescription (ResourceLoader.getText ("EVT_DESC_PROPERTY_VETO")); - - String[] vobjectMethods = { "objectChanged", "objectCreated", "objectDeleted" }; - EventSetDescriptor vobject = new EventSetDescriptor (beanClass_, - "vobject", VObjectListener.class, vobjectMethods, - "addVObjectListener", "removeVObjectListener"); - vobject.setDisplayName (ResourceLoader.getText ("EVT_NAME_VOBJECT")); - vobject.setShortDescription (ResourceLoader.getText ("EVT_DESC_VOBJECT")); - - String[] workingMethods = { "startWorking", "stopWorking" }; - EventSetDescriptor working = new EventSetDescriptor (beanClass_, - "working", WorkingListener.class, workingMethods, - "addWorkingListener", "removeWorkingListener"); - working.setDisplayName (ResourceLoader.getText ("EVT_NAME_WORKING")); - working.setShortDescription (ResourceLoader.getText ("EVT_DESC_WORKING")); - - events_ = new EventSetDescriptor[] { error, propertyChange, - vetoableChange, vobject, working }; - - // Properties. - PropertyDescriptor groupInfo = new PropertyDescriptor ("groupInfo", beanClass_); - groupInfo.setBound (true); - groupInfo.setConstrained (true); - groupInfo.setDisplayName (ResourceLoader.getText ("PROP_NAME_GROUP_INFO")); - groupInfo.setShortDescription (ResourceLoader.getText ("PROP_DESC_GROUP_INFO")); - - PropertyDescriptor system = new PropertyDescriptor ("system", beanClass_); - system.setBound (true); - system.setConstrained (true); - system.setDisplayName (ResourceLoader.getText ("PROP_NAME_SYSTEM")); - system.setShortDescription (ResourceLoader.getText ("PROP_DESC_SYSTEM")); - - PropertyDescriptor userInfo = new PropertyDescriptor ("userInfo", beanClass_); - userInfo.setBound (true); - userInfo.setConstrained (true); - userInfo.setDisplayName (ResourceLoader.getText ("PROP_NAME_USER_INFO")); - userInfo.setShortDescription (ResourceLoader.getText ("PROP_DESC_USER_INFO")); - - properties_ = new PropertyDescriptor[] { groupInfo, system, - userInfo }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // ErrorEvent. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 1; // system. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("VUserList16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("VUserList32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VUsersNotInGroups16.gif b/cvsroot/src/com/ibm/as400/vaccess/VUsersNotInGroups16.gif deleted file mode 100644 index 031f216af..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VUsersNotInGroups16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VUsersNotInGroups32.gif b/cvsroot/src/com/ibm/as400/vaccess/VUsersNotInGroups32.gif deleted file mode 100644 index 5de7acc24..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/VUsersNotInGroups32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/VUtilities.java b/cvsroot/src/com/ibm/as400/vaccess/VUtilities.java deleted file mode 100644 index 5e8cf8abe..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VUtilities.java +++ /dev/null @@ -1,547 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VUtilities.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.access.Trace; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.border.EmptyBorder; -import javax.swing.border.Border; -import javax.swing.border.CompoundBorder; -import java.awt.Component; -import java.awt.Frame; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.text.Collator; -import java.util.Date; -import java.util.Vector; - - - -/** -The VUtilities class provides miscellanous utilities. -**/ -class VUtilities -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - - // Private data. - private static Collator collator_; - - - -/** -Static initializer. -**/ - static - { - // If the locale is Korean, then this throws - // an ArrayIndexOutOfBoundsException. This is - // a bug in the JDK. The workarond in that case - // is just to use String.compareTo(). - try { - collator_ = Collator.getInstance (); - collator_.setStrength (Collator.PRIMARY); - } - catch (Exception e) { - collator_ = null; - } - } - - -/** -Adds the component and sets its grid bag constraints. - -@param component The component. -@param panel The panel. -@param layout The grid bag layout. -@param gridx The grid x position. -@param gridwidth The grid width. -@param weightx How much extra horizontal space the component will get. -@param gridy The grid y position. -@param gridheight The grid height. -@param weighty How much extra vertical space the component will get. -@param fill Whether the component should expand to fill its space. -@param anchor Where to place the component if it doesn't fill its space. -**/ - public static void constrain (Component component, - JPanel panel, - GridBagLayout layout, - GridBagConstraints constraints, - int gridx, int gridwidth, int weightx, - int gridy, int gridheight, int weighty, - int fill, int anchor) - { - panel.add (component); - - constraints.gridx = gridx; - constraints.gridy = gridy; - constraints.gridwidth = gridwidth; - constraints.gridheight = gridheight; - constraints.fill = fill; - constraints.anchor = anchor; - constraints.weightx = weightx; - constraints.weighty = weighty; - - layout.setConstraints (component, constraints); - } - - -/** -Adds the component and sets its grid bag constraints. - -@param component The component. -@param panel The panel. -@param layout The grid bag layout. -@param gridx The grid x position. -@param gridy The grid y position. -@param gridwidth The grid width. -@param gridheight The grid height. -**/ - public static void constrain (Component component, - JPanel panel, - GridBagLayout layout, - int gridx, int gridy, int gridwidth, int gridheight) - { - panel.add (component); - - GridBagConstraints constraints = new GridBagConstraints (); - - constraints.gridx = gridx; - constraints.gridy = gridy; - constraints.gridwidth = gridwidth; - constraints.gridheight = gridheight; - constraints.fill = GridBagConstraints.BOTH; - constraints.ipady = 2; - constraints.insets = new Insets (2, 0, 2, 0); - constraints.anchor = GridBagConstraints.WEST; - constraints.weightx = 1; - constraints.weighty = 1; - - layout.setConstraints (component, constraints); - } - - -/** -Adds 2 component as a row and sets its grid bag constraints. - -@param component The left component. -@param component2 The right component. -@param panel The panel. -@param layout The grid bag layout. -@param gridy The grid y position. -**/ - public static void constrain (Component component, - Component component2, - JPanel panel, - GridBagLayout layout, - int gridy ) - { - constrain( component, panel, layout, 0, gridy, 1,1 ); - constrain( component2, panel, layout, 1, gridy, 1,1 ); - } - - -/** -Adds 2 strings as a row and sets its grid bag constraints. - -@param string1 The left component. -@param string2 The right component. -@param panel The panel. -@param layout The grid bag layout. -@param gridy The grid y position. -**/ - public static void constrain (String string1, - String string2, - JPanel panel, - GridBagLayout layout, - int gridy ) - { - constrain( new JLabel(string1), new JLabel(string2), - panel, layout, gridy ); - } - - -/** -Adds the component as a row and sets its grid bag constraints. - -@param component The component. -@param panel The panel. -@param layout The grid bag layout. -@param gridy The grid y position. -**/ - public static void constrain (Component component, - JPanel panel, - GridBagLayout layout, - int gridy ) - { - constrain( component, panel, layout, 0, gridy, 2,1 ); - } - - -/** -Formats help text from an AS400Message. This text may have -imbed \n's in it. - -

    Remember that JLabels and Labels do not handle -these as expected. Instead, use a JTextArea, setEditable (false), -and set its background color to the same as the panel. This -gives you the same effect as a JLabel. -**/ - public static String formatHelp(String helpText, int width) - { - StringBuffer newHelp = new StringBuffer(); - int len = helpText.length(); - - int j=0; - for (int i=0; iRemember that JLabels and Labels do not handle -these as expected. Instead, use a JTextArea, setEditable (false), -and set its background color to the same as the panel. This -gives you the same effect as a JLabel. -**/ - public static String formatHelp2(String input, int width) - { - StringBuffer output = new StringBuffer(input); - - // Insert newlines so that each line is no longer than the specified width. - int lowEnd = 0; - int highEnd = width; - while (highEnd < output.length()) - { - int i = highEnd; - while (i > lowEnd) - { - // This only checks for single-byte space characters. - // For DBCS, it may look a little ugly since we'll break - // in the middle of a word. - // Also, we assume the string is read from left-to-right, - // so BiDi strings may end up with weird breaks. This shouldn't happen - // since all the BiDi languages we support are single-byte so we - // should usually find a single-byte space, assuming the specified width - // is large enough. - if (output.charAt(i) == ' ') - { - output.setCharAt(i, '\n'); // Wrap to new line. - break; - } - --i; - } - if (i == lowEnd) // We hit the bottom, so just break the line. - { - output = output.insert(highEnd, '\n'); - lowEnd = highEnd; - highEnd += width; - } - else - { - // Set new "window" - highEnd = i+width; - lowEnd = i; - } - } - return output.toString(); - - -/*@B0D int current = width; - int i = width; - - while (i < output.length()) - { - if (current >= width) - { - while (output.charAt(i) != ' ' && ) - { - --i; - } - output.setCharAt(i, '\n'); - current = 0; - } - else if (output.charAt(i) == '\n') - { - current = 0; - } - - ++current; - ++i; - } - - return output.toString(); -*/ //@B0D - - } - - - -/** -Returns the text associated with an exception. This handles -exceptions with "" and null text, in which case the exception -class name will be used. -**/ - public static String getExceptionText (Exception e) - { - String text = e.getMessage (); - if (text == null) - text = e.getClass ().toString (); - else if (text.length() == 0) - text = e.getClass ().toString (); - return text; - } - - - -/** -Returns the frame which contains a component. This only works if -the component has already been added to a frame. - -@return The frame, or null if the component has not yet been added - to a frame. -**/ - public static Frame getFrame (Component component) - { - Component c; - for (c = component; - (c != null) && (! (c instanceof Frame)); - c = getParentComponent (c)) - ; - return (Frame) c; - } - - - -/** -Returns the parent component (used to trace up to a frame). - -@param compnent The component. -@return The parent component. -**/ - private static Component getParentComponent (Component component) - { - Component parent; - - // JPopupMenus don't have parents. I reported this to - // Swing and they responded that I should use getInvoker() - // instead. - if (component instanceof JPopupMenu) - parent = ((JPopupMenu) component).getInvoker (); - - else - parent = component.getParent (); - - return parent; - } - - - -/** -Sorts an array of objects. - -@param objects The objects. -@param propertyIdentifiers The property identifiers. If any of - the property identifiers are null, it - means to sort using the string - representation of the object. -@param orders The sort orders for each property - identifier, true for ascending order, - false for descending order. -**/ - public static void sort (VObject[] objects, - Object[] propertyIdentifiers, - boolean[] orders) - { - // Normalize the orders array. - boolean[] orders2; - if (propertyIdentifiers.length > orders.length) { - orders2 = new boolean[propertyIdentifiers.length]; - System.arraycopy (orders, 0, orders2, 0, orders.length); - } - else - orders2 = orders; - - // Put out a trace. - if (Trace.isTraceOn()) { - StringBuffer b1 = new StringBuffer (); - for (int i = 0; i < propertyIdentifiers.length; ++i) { - b1.append (propertyIdentifiers[i]); - b1.append (" ("); - b1.append (orders2[i] ? "ascending" : "descending"); - b1.append (")"); - if (i != propertyIdentifiers.length - 1) - b1.append (", "); - } - Trace.log (Trace.INFORMATION, "Sorting by " + b1 + "."); - } - - // This uses a bubble sort for now, which is not the most - // efficient sort in the world, but most of the time the array size - // is small. - // - // Apparantly, something is coming along in the JDK 2.0 Collection - // classes to do sorts (java.util.Array). - // - VObject temp; - int length = objects.length; - for (int i = 0; i < length; ++i) { - for (int j = i + 1; j < length; ++j) { - if (sortCompare (objects[i], - objects[j], - propertyIdentifiers, - orders)) { - temp = objects[i]; - objects[i] = objects[j]; - objects[j] = temp; - } - } - } - } - - - -/** -Sorts a vector of objects. - -@param objects The objects. -@param propertyIdentifiers The property identifiers. If any of - the property identifiers are null, it - means to sort using the string - representation of the object. -@param orders The sort orders for each property - identifier, true for ascending order, - false for descending order. -**/ - public static void sort (Vector objects, - Object[] propertyIdentifiers, - boolean[] orders) - { - VObject[] objectArray = new VObject[objects.size ()]; - objects.copyInto (objectArray); - - sort (objectArray, propertyIdentifiers, orders); - - objects.removeAllElements (); - for (int i = 0; i < objectArray.length; ++i) - objects.addElement (objectArray[i]); - } - - - -/** -Compares two objects for the sort. - -@param objectI The ith object. -@param objectJ The jth object. -@param propertyIdentifiers The property identifiers. If any of - the property identifiers are null, it - means to sort using the string - representation of the object. -@param orders The sort orders for each property - identifier, true for ascending order, - false for descending order. -@return true if the ith object is before the - jth object, false otherwise. -**/ - private static boolean sortCompare (VObject objectI, - VObject objectJ, - Object[] propertyIdentifiers, - boolean[] orders) - { - Object valueI; - Object valueJ; - - for (int i = 0; i < propertyIdentifiers.length; ++i) { - - // Determine the values to compare. - if (propertyIdentifiers[i] != null) { - valueI = objectI.getPropertyValue (propertyIdentifiers[i]); - valueJ = objectJ.getPropertyValue (propertyIdentifiers[i]); - } - else { - valueI = objectI.toString (); - valueJ = objectJ.toString (); - } - - // Check for nulls. - if (valueI == null) - valueI = ""; - if (valueJ == null) - valueJ = ""; - boolean comparison; - - // If we are comparing Date's, toString() doesn't report msec's. @A3C - if (valueI instanceof Date) - comparison = ((Date) valueI).after ((Date) valueJ); - - // If they are equal, then use the next column. - else if (valueI.toString ().equals (valueJ.toString ())) // @A2C - continue; - - // Otherwise, do the comparison using this column. - - else if ((valueI instanceof Number) || (valueJ instanceof Number)) { - long li = (valueI instanceof Number) ? ((Number) valueI).longValue () : -1; - long lj = (valueJ instanceof Number) ? ((Number) valueJ).longValue () : -1; - comparison = (li < lj); - } - - else if (collator_ != null) - comparison = (collator_.compare (valueI.toString (), valueJ.toString ()) < 0); - - else - comparison = (valueI.toString ().compareTo (valueJ.toString ()) < 0); - - // Return the value. - return (comparison != orders[i]); - } - - // All columns were equal. - return true; - } - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/VetoableChangeSupport.java b/cvsroot/src/com/ibm/as400/vaccess/VetoableChangeSupport.java deleted file mode 100644 index a8e189819..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/VetoableChangeSupport.java +++ /dev/null @@ -1,96 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: VetoableChangeSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyVetoException; -import java.beans.VetoableChangeListener; - - - -/** -The PropertyChangeSupport class represents a list of -VetoableChangeListeners. This is also a VetoableChangeListener -and will dispatch all vetoable change events that it receives. -**/ -class VetoableChangeSupport -extends java.beans.VetoableChangeSupport -implements VetoableChangeListener -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs an VetoableChangeSupport object. - -@param source The source for the events. -**/ - public VetoableChangeSupport (Object source) - { - super (source); - } - - - -/** -Adds a listener. - -@param listener The listener. - -If listener is null, no exception is thrown and no action is taken. -(See JDK 1.6 doc for java.beans.VetoableChangeSupport) -**/ - public void addVetoableChangeListener (VetoableChangeListener listener) - { - - super.addVetoableChangeListener (listener); - } - - - -/** -Removes a listener. - -@param listener The listener. -**/ - public void removeVetoableChangeListener (VetoableChangeListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - super.removeVetoableChangeListener (listener); - } - - - -/** -Processes a vetoable change event. - -@param event The event. - -@exception PropertyVetoException The property change has been rejected. -**/ - public void vetoableChange (PropertyChangeEvent event) - throws PropertyVetoException - { - fireVetoableChange (event.getPropertyName (), event.getOldValue (), event.getNewValue ()); - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/WorkingCursorAdapter.java b/cvsroot/src/com/ibm/as400/vaccess/WorkingCursorAdapter.java deleted file mode 100644 index 70fa3b5f3..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/WorkingCursorAdapter.java +++ /dev/null @@ -1,281 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: WorkingCursorAdapter.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Component; -import java.awt.Cursor; -import java.awt.Frame; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; - - - -/** -The WorkingCursorAdapter class represents an object that listens -for working events and sets the cursor as needed. When an event -source starts working, the cursor is changed to the "wait" cursor. -When an event source stops working, the cursor is changed back to the -original cursor. - -

    If multiple start events are fired, then the same number of stop -events must be fired to get the cursor back to its original state. - -

    The component property is used to determine the frame where -the cursor is changed. If no component is set, or a parent frame -is not available, then the cursor will not be changed. - -

    The following example creates a tree model filled with -the contents of a directory in the integrated file system. It will use a WorkingCursorAdapter object to change the -cursor as needed. - -

    -// Set up the tree model in a JTree.
    -AS400TreeModel treeModel = new AS400TreeModel ();
    -JTree tree = new JTree (treeModel);
    -
    -// Set up the working cursor adapter. -treeModel.addWorkingListener (new WorkingCursorAdapter (tree)); -
    -// Set up the tree model to contain the contents of -// a directory. -AS400 system = new AS400 (); -VIFSDirectory directory = new VIFSDirectory (system, "/myDirectory"); -treeModel.setRoot (directory); -
    -// Create a frame and add the tree. -JFrame frame = new JFrame (); -frame.getContentPane ().add (directory); -
    -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -// -// Implementation notes: -// -// 1. This sometimes does not work as you might expect because the -// component does not redraw until after you have already stopped -// working. The solution to this is to do the work in a background -// thread, giving the component a chance to redraw. -// -// 2. We always set the cursor on the enclosing frame, because some -// components (even thought they are documented as such) do not -// handle cursors correctly. If the component is not part of a -// frame, then we do not need to set it, because the component is -// not visible anyway. -// -public class WorkingCursorAdapter -implements WorkingListener, Serializable -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Static data. - private static final Cursor defaultCursor_ = Cursor.getDefaultCursor(); // @C1A - private static final Cursor waitCursor_ = Cursor.getPredefinedCursor (Cursor.WAIT_CURSOR); - - - - // Properties. - private Component component_ = null; - - - - // Private data. - transient private Component disabledComponent_; - transient private Frame frame_; - transient private Cursor originalCursor_; - transient private int startCount_; - - - -/** -Constructs a WorkingCursorAdapter object. -**/ - public WorkingCursorAdapter () - { - initializeTransient (); - } - - - -/** -Constructs a WorkingCursorAdapter object. - -@param component The component. -**/ - public WorkingCursorAdapter (Component component) - { - if (component == null) - throw new NullPointerException ("component"); - - component_ = component; - initializeTransient (); - } - - - -/** -Returns the component that determines the frame for -cursor changes. - -@return The component, or null if none has been set. -**/ - public Component getComponent () - { - return component_; - } - - - -/** -Initializes the transient data. -**/ - private void initializeTransient () - { - disabledComponent_ = null; - frame_ = null; - originalCursor_ = null; - startCount_ = 0; - } - - - -/** -Restores the state of the object from an input stream. -This is used when deserializing an object. - -@param in The input stream. -**/ - private void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject (); - initializeTransient (); - } - - - -/** -Sets the component that determines the frame for -cursor changes. - -@param component The component. -**/ - public void setComponent (Component component) - { - if (component == null) - throw new NullPointerException ("component"); - - component_ = component; - } - - - -/** -Processes a start working event. If the component has -been added to a frame, then this will set the cursor to the -wait cursor. - -@param event The event. -**/ - public /* @C2D synchronized */ void startWorking (WorkingEvent event) - { - Component componentToDisable = null; // @C2A - Cursor cursorToSet = null; // @C2A - - synchronized(this) { // @C2A - // If this is the first working event, or at least - // the first one since the component was set, then - // disable the component to inhibit input while - // working. - if ((component_ != null) - && ((startCount_ == 0) || (disabledComponent_ == null))) { - disabledComponent_ = component_; - componentToDisable = disabledComponent_; // @C2C - } - - // If this is the first working event, or at least - // the first one since the component was added to - // a frame, then set the cursor to a wait cursor. - if ((startCount_ == 0) || (frame_ == null)) { - frame_ = VUtilities.getFrame (component_); - if (frame_ != null) { - originalCursor_ = frame_.getCursor (); - if (originalCursor_.getType() == waitCursor_.getType()) // @C1A - originalCursor_ = defaultCursor_; // @C1A - cursorToSet = waitCursor_; // @C2C - } - } - - ++startCount_; - } // @C2A - - // Set these outside of the synchronized block to avoid deadlock @C2A - // within Swing code. @C2A - if (componentToDisable != null) // @C2A - componentToDisable.setEnabled(false); // @C2A - if (cursorToSet != null) // @C2A - frame_.setCursor(cursorToSet); // @C2A - } - - - -/** -Processes a stop working event. This will set the cursor -back to its previous form. If there are, however, -multiple calls to startWorking(), the cursor is not changed back -until all starts have matching stops. - -@param event The event. -**/ - public /* @C2D synchronized */ void stopWorking (WorkingEvent event) - { - Component componentToEnable = null; // @C2A - Cursor cursorToSet = null; // @C2A - Frame frameToSet = null; // @C2A - - synchronized(this) { // @C2A - --startCount_; - - // If nobody is working anymore and the cursor - // had been set to a wait cursor, then set it - // back to its original. - if ((startCount_ == 0) && (frame_ != null)) { - cursorToSet = originalCursor_; // @C2C - frameToSet = frame_; // @C2A - frame_ = null; - } - - // If nobody is working anymore and a component was - // disabled, then re-enable the component. - if ((startCount_ == 0) && (disabledComponent_ != null)) { - componentToEnable = disabledComponent_; // @C2C - disabledComponent_ = null; - } - } // @C2A - - // Set these outside of the synchronized block to avoid deadlock @C2A - // within Swing code. @C2A - if (componentToEnable != null) // @C2A - componentToEnable.setEnabled(true); // @C2A - if ((cursorToSet != null) && (frameToSet != null)) // @C2A - frameToSet.setCursor(cursorToSet); // @C2A - } - - - -} - diff --git a/cvsroot/src/com/ibm/as400/vaccess/WorkingCursorAdapter16.gif b/cvsroot/src/com/ibm/as400/vaccess/WorkingCursorAdapter16.gif deleted file mode 100644 index 21f089d5f..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/WorkingCursorAdapter16.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/WorkingCursorAdapter32.gif b/cvsroot/src/com/ibm/as400/vaccess/WorkingCursorAdapter32.gif deleted file mode 100644 index 368906fb5..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/WorkingCursorAdapter32.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/WorkingCursorAdapterBeanInfo.java b/cvsroot/src/com/ibm/as400/vaccess/WorkingCursorAdapterBeanInfo.java deleted file mode 100644 index 4d039f28e..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/WorkingCursorAdapterBeanInfo.java +++ /dev/null @@ -1,159 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: WorkingCursorAdapterBeanInfo.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.awt.Image; -import java.beans.BeanDescriptor; -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - - - -/** -The WorkingCursorAdapterBeanInfo class provides bean information -for the WorkingCursorAdapter class. - -@see WorkingCursorAdapter -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class WorkingCursorAdapterBeanInfo -extends SimpleBeanInfo -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private final static Class beanClass_ = WorkingCursorAdapter.class; - private static EventSetDescriptor[] events_; - private static PropertyDescriptor[] properties_; - - - -/** -Static initializer. -**/ - static - { - try { - - // Events. - events_ = new EventSetDescriptor[0]; - - // Properties. - PropertyDescriptor component = new PropertyDescriptor ("component", beanClass_); - component.setBound (false); - component.setConstrained (false); - component.setDisplayName (ResourceLoader.getText ("PROP_NAME_COMPONENT")); - component.setShortDescription (ResourceLoader.getText ("PROP_DESC_COMPONENT")); - - properties_ = new PropertyDescriptor[] { component }; - } - catch (Exception e) { - throw new Error (e.toString ()); - } - } - - - -/** -Returns the bean descriptor. - -@return The bean descriptor. -**/ - public BeanDescriptor getBeanDescriptor () - { - return new BeanDescriptor (beanClass_); - } - - - -/** -Returns the index of the default event. - -@return The index of the default event. -**/ - public int getDefaultEventIndex () - { - return 0; // None. - } - - - -/** -Returns the index of the default property. - -@return The index of the default property. -**/ - public int getDefaultPropertyIndex () - { - return 0; // component. - } - - - -/** -Returns the descriptors for all events. - -@return The descriptors for all events. -**/ - public EventSetDescriptor[] getEventSetDescriptors () - { - return events_; - } - - - -/** -Returns an image for the icon. - -@param icon The icon size and color. -@return The image. -**/ - public Image getIcon (int icon) - { - Image image = null; - switch (icon) { - case BeanInfo.ICON_MONO_16x16: - case BeanInfo.ICON_COLOR_16x16: - image = loadImage ("WorkingCursorAdapter16.gif"); - break; - case BeanInfo.ICON_MONO_32x32: - case BeanInfo.ICON_COLOR_32x32: - image = loadImage ("WorkingCursorAdapter32.gif"); - break; - } - return image; - } - - - -/** -Returns the descriptors for all properties. - -@return The descriptors for all properties. -**/ - public PropertyDescriptor[] getPropertyDescriptors () - { - return properties_; - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/WorkingEvent.java b/cvsroot/src/com/ibm/as400/vaccess/WorkingEvent.java deleted file mode 100644 index eeac516e2..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/WorkingEvent.java +++ /dev/null @@ -1,52 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: WorkingEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.util.EventObject; - - - -/** -The WorkingEvent class represents an event that signals that -a model is working on a request. This is useful for -graphical user interfaces that need to give the user some -feedback that work is being done. - -@see WorkingListener -@see WorkingCursorAdapter -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public class WorkingEvent -extends EventObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - -/** -Constructs a WorkingEvent object. - -@param source The source of the event. -**/ - public WorkingEvent (Object source) - { - super (source); - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/WorkingEventSupport.java b/cvsroot/src/com/ibm/as400/vaccess/WorkingEventSupport.java deleted file mode 100644 index 60dd9d087..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/WorkingEventSupport.java +++ /dev/null @@ -1,256 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: WorkingEventSupport.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import com.ibm.as400.resource.ActiveStatusEvent; // @C1A -import com.ibm.as400.resource.ActiveStatusListener; // @C1A -import java.util.Vector; - - - -/** -The WorkingEventSupport class represents a list of WorkingListeners. -This implements the WorkingListener interface and will dispatch all -working events that it receives. -**/ -// -// Implementation note: -// -// @A1A -// THIS APPLIES TO ALL "EVENT SUPPORT" CLASSES IN THIS PACKAGE: -// -// Class A is defined to fire WorkingEvents. As a result, it -// has to maintain a list of the listeners. Since many classes -// in the package have to do this, we provide an "event support" -// class to maintain this list. This is patterened after -// the java.beans.PropertyChangeSupport class provided in the JDK. -// -// public class A -// { -// private WorkingEventSupport eventSupport_ = new WorkingEventSupport (this); -// -// public void addWorkingListener (WorkingListener listener) -// { -// eventSupport_.addWorkingListener (listener); -// } -// -// public void removeWorkingListener (WorkingListener listener) -// { -// eventSupport_.removeWorkingListener (listener); -// } -// -// public void someMethod () -// { -// ... some code here ... -// eventSupport_.fireObjectChanged (anObject); -// ... some more code here ... -// } -// } -// -// There is another case where class A contains a private instance -// of class B. B fires WorkingEvents, and A needs to listen -// to B and refire all WorkingEvents. In addition, it needs -// to change the source of the event so that it looks like -// A is the source, even though B is the real source. The -// reason for this is that listeners have public access to the -// source of the event, and we don't want them to have access to B. -// -// This is all easy to accompilsh by simply adding the -// event support object as a listener to B. The event -// support object takes care of the rest. -// -// public class A -// { -// private B b_; -// private WorkingEventSupport eventSupport_ = new WorkingEventSupport (this); -// -// public A () -// { -// b_ = new B (); -// b_.addWorkingListener (eventSupport_); -// } -// } -// -// This type of event dispatching happens all over in the -// vaccess package. This is because of the hierarchy of -// components. Consider an explorer pane that presents -// a view of a directory structure. Here is the hierarchy: -// -// AS400ExplorerPane -// | -// +-- AS400TreePane -// | | -// | +-- AS400TreeModel -// | | -// | +-- VIFSDirectory (root directory) <-----------+ -// | | | -// | +-- VIFSDirectory (subdirectory) | -// | | | | -// | | +-- VIFSFile (file in subdirectory) | -// | | | -// | +-- VIFSFile (file in root directory) | -// | | -// +-- AS400DetailsPane | -// | | -// +-- AS400DetailsModel | -// | | -// +----------------------------------------------+ -// -// If any object fires certain events, then all objects -// above them in the hierarchy need to hear about it. Rather -// than making all objects specifically listen to all objects -// below them, we just make them listen to the objects -// directly below them. Then they "bubble" (dispatch) them -// up the chain to the parent. All nodes in between can process -// them on the way up. -// -// Now, when one of the VIFSFile's goes to the system, it will -// fire a WorkingEvent up the chain, so that the top level -// frame can process it and, for example, change its cursor -// to reflect the working state. -// -class WorkingEventSupport -implements WorkingListener, ActiveStatusListener // @C1C -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - - - - - // Private data. - private transient WorkingListener[] listeners_ = new WorkingListener[0]; // For speed. - private transient Vector listenersV_ = new Vector (); - private Object source_; - - - -/** -Constructs a WorkingEventSupport object. - -@param source The source of the events. -**/ - public WorkingEventSupport (Object source) - { - source_ = source; - } - - - -/** -Adds a listener. - -@param listener The listener. -**/ - public void addWorkingListener (WorkingListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - listenersV_.addElement (listener); - synchronized (listeners_) { - listeners_ = new WorkingListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - - - - public void busy(ActiveStatusEvent event) // @C1A - { // @C1A - fireStartWorking(); // @C1A - } // @C1A - - - -/** -Fires a start working event. -**/ - public void fireStartWorking () - { - // @C2D synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].startWorking (new WorkingEvent (source_)); - // @C2D } - } - - - -/** -Fires a stop working event. -**/ - public void fireStopWorking () - { - // @C2D synchronized (listeners_) { - for (int i = 0; i < listeners_.length; ++i) - listeners_[i].stopWorking (new WorkingEvent (source_)); - // @C2D } - } - - - - - public void idle(ActiveStatusEvent event) // @C1A - { // @C1A - fireStopWorking(); // @C1A - } // @C1A - - - -/** -Removes a listener. - -@param listener The listener. -**/ - public void removeWorkingListener (WorkingListener listener) - { - if (listener == null) - throw new NullPointerException ("listener"); - - if (listenersV_.removeElement (listener)) { - synchronized (listeners_) { - listeners_ = new WorkingListener[listenersV_.size()]; - listenersV_.copyInto (listeners_); - } - } - } - - - -/** -Processes a start working event. - -@param event The event. -**/ - public void startWorking (WorkingEvent event) - { - fireStartWorking (); - } - - - -/** -Processes a stop working event. - -@param event The event. -**/ - public void stopWorking (WorkingEvent event) - { - fireStopWorking (); - } - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/WorkingListener.java b/cvsroot/src/com/ibm/as400/vaccess/WorkingListener.java deleted file mode 100644 index 7790fe9b6..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/WorkingListener.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: WorkingListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package com.ibm.as400.vaccess; - -import java.util.EventListener; - - - -/** -The WorkingListener interface provides a listener interface -for working events. This is useful for graphical user -interfaces that need to give the user some feedback that -work is being done. - -@see WorkingEvent -@see WorkingCursorAdapter -@deprecated Use Java Swing instead, along with the classes in package com.ibm.as400.access -**/ -public interface WorkingListener -extends EventListener -{ - - - -/** -Invoked when a potentially long-running unit of work -is about to begin. - -@param event The event. -**/ - abstract public void startWorking (WorkingEvent event); - - - -/** -Invoked when a potentially long-running unit of work -has completed. - -@param event The event. -**/ - abstract public void stopWorking (WorkingEvent event); - - - -} - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/ZoomIcon.gif b/cvsroot/src/com/ibm/as400/vaccess/ZoomIcon.gif deleted file mode 100644 index 1b3ba1225..000000000 Binary files a/cvsroot/src/com/ibm/as400/vaccess/ZoomIcon.gif and /dev/null differ diff --git a/cvsroot/src/com/ibm/as400/vaccess/doc-files/PrintAttributes.html b/cvsroot/src/com/ibm/as400/vaccess/doc-files/PrintAttributes.html deleted file mode 100644 index 7c022be51..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/doc-files/PrintAttributes.html +++ /dev/null @@ -1,4883 +0,0 @@ - - - - - IBM Toolbox for Java: Object Keys - - - - - - - - - -

    Print Object Attributes

    - -

    -


    - -

    Table of Contents

    - - - -

    -


    - -

    Advanced Function -Printing

    - -
    -
    ID
    - -
    ATTR_AFP
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Indicates whether this spooled file uses AFP resources external to -the spooled file. Valid values are *YES and *NO.
    -
    - -

    -


    - -

    AFP Resource

    - -
    -
    ID
    - -
    ATTR_AFP_RESOURCE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The Integrated File System path of the external AFP (Advanced Function Print) resource. -The format of the Integrated File System path is "/QSYS.LIB/library.LIB/resource.type" where -library is the library that contains the resource, resource is -the name of the resource and type is the resource type. Valid values -for type include "FNTRSC", "FORMDF", "OVL", "PAGSEG", and "PAGDFN". -
    -
    - -

    -


    - -

    Align Forms

    - -
    -
    ID
    - -
    ATTR_ALIGNFORMS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The time at which a forms alignment message will be sent. Valid values are *WTR, *FILE, *FIRST.
    -
    - -

    -


    - -

    Align Page

    - -
    -
    ID
    - -
    ATTR_ALIGN
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Indicates whether a forms alignment message is sent prior to printing -this spooled file. Valid values are *YES, *NO.
    -
    - -

    -


    - -

    Allow Direct -Print

    - -
    -
    ID
    - -
    ATTR_ALWDRTPRT
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Indicates whether the printer writer allows the printer to be allocated -to a job that prints directly to a printer. Valid values are *YES, *NO. -
    -
    - -

    -


    - -

    Authority

    - -
    -
    ID
    - -
    ATTR_AUT
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Specifies the authority that is given to users who do not have specific -authority to the output queue. Valid values are *USE, *ALL, *CHANGE, *EXCLUDE, -*LIBCRTAUT.
    -
    - -

    -


    - -

    Authority to -Check

    - -
    -
    ID
    - -
    ATTR_AUTCHK
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Indicates what type of authorities to the output queue allow the user -to control all the files on the output queue. Valid values are *OWNER, -*DTAAUT.
    -
    - -

    -


    - -

    Automatically -End Writer

    - -
    -
    ID
    - -
    ATTR_AUTOEND
    - -
    Type
    - -
    String
    -
    Description
    - -
    Specifies if the writer should be automatically ended. Valid values -are *NO, *YES.
    -
    - -

    -


    - - -

    Auxiliary Storage

    -
    -
    ID
    -
    ATTR_AUX_POOL
    -
    Type
    -
    Integer
    -
    Description
    -
    Specifies the number of the auxiliary storage pool (ASP) that the spooled file is stored on. -The possible values are: -
      -
    • 1: System ASP
    • -
    • 2-32: One of the user ASPs
    • -
    -
    -

    -


    -

    Back Margin Offset -Across

    - -
    -
    ID
    - -
    ATTR_BACKMGN_ACR
    - -
    Type
    - -
    Float
    - -
    Description
    - -
    For the back side of a piece of paper, it specifies, how far in from -the left side of the page printing starts. The special value *FRONTMGN -will be encoded as -1.
    -
    - -

    -


    - -

    Back Margin Offset -Down

    - -
    -
    ID
    - -
    ATTR_BACKMGN_DWN
    - -
    Type
    - -
    Float
    - -
    Description
    - -
    For the back side of a piece of paper, it specifies, how far down from -the top of the page printing starts. The special value *FRONTMGN will be -encoded as -1.
    -
    - -

    -


    - -

    Back Overlay

    - -
    -
    ID
    - -
    ATTR_BACK_OVERLAY
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The Integrated File System path of the back overlay or a special value. If the value is an - Integrated File System path it will have the format "/QSYS.LIB/library.LIB/overlay.OVL" where - library is the library of the resource and overlay is the - name of the overlay. - Valid special values include *FRONTOVL. -
    -
    - -

    -


    - -

    Back Overlay -offset across

    - -
    -
    ID
    - -
    ATTR_BKOVL_ACR
    - -
    Type
    - -
    Float
    - -
    Description
    - -
    The offset across from the point of origin where the overlay is printed. -
    -
    - -

    -


    - -

    Back Overlay -Offset Down

    - -
    -
    ID
    - -
    ATTR_BKOVL_DWN
    - -
    Type
    - -
    Float
    - -
    Description
    - -
    The offset down from the point of origin where the overlay is printed. -
    -
    - -

    -


    - -

    Between Copies Status

    - -
    -
    ID
    - -
    ATTR_BTWNCPYSTS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether or not the writer is between copies of a multiple copy spooled file. Returned -values are *YES or *NO. -
    -
    - -

    -


    - -

    Between Files Status

    - -
    -
    ID
    - -
    ATTR_BTWNFILESTS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether or not the writer is between files. Returned values are *YES or *NO. -
    -
    - -

    -


    - -

    Changes

    - -
    -
    ID
    - -
    ATTR_CHANGES
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The time at which pending changes take effect. Valid values are *NORDYF, *FILEEND, or blank which implies no changes pending to the writer.
    -
    - -

    -


    - -

    Characters -per Inch

    - -
    -
    ID
    - -
    ATTR_CPI
    - -
    Type
    - -
    Float
    - -
    Description
    - -
    The number of characters per horizontal inch.
    -
    - -

    -


    - -

    Code Page

    - -
    -
    ID
    - -
    ATTR_CODEPAGE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The mapping of graphic characters to code points for this spooled file. -If the graphic character set field contains a special value, this field -may contain a zero (0).
    -
    - -

    -


    - -

    Code Font -Name

    - -
    -
    ID
    - -
    ATTR_CODEDFNT
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The name of the coded font. A coded font is an AFP resource that is -composed of a character set and a code page. Special values include *FNTCHRSET. -
    -
    - -

    -


    - -

    Coded Font -Library Name

    - -
    -
    ID
    - -
    ATTR_CODEDFNTLIB
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The name of the library that contains the coded font. This field may -contain blanks if the coded font name field has a special value.
    -
    - -

    -


    - -

    Control Character

    - -
    -
    ID
    - -
    ATTR_CONTROLCHAR
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether this file uses the American National Standards printer control character. The possible values are *NONE for no print control characters are passed in the data that is printed or *FCFC which means that the first character of every record is an American National Standards printer control character.
    -
    - - -

    -


    -

    Convert Line Data

    - -
    -
    ID
    - -
    ATTR_CONVERT_LINEDATA
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether the line data is converted to AFPDS before it is written to spool. The possible values are *NO and *YES.
    -
    - -

    -


    - -

    Copies

    - -
    -
    ID
    - -
    ATTR_COPIES
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The total number of copies to be produced for this spooled file.
    -
    - -

    -


    - -

    Copies left -to Produce

    - -
    -
    ID
    - -
    ATTR_COPIESLEFT
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The remaining number of copies to be produced for this spooled file. -
    -
    - -

    -


    -

    Corner Staple

    - -
    -
    ID
    - -
    ATTR_CORNER_STAPLE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The reference corner to be used for a corner staple. A staple is driven into the media at the reference corner. Valid values are *NONE, *DEVD, *BOTRIGHT, *TOPRIGHT, *TOPLEFT, and *BOTLEFT. -
    - -

    -


    - -

    Current Page

    - -
    -
    ID
    - -
    ATTR_CURPAGE
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    Current page that is being written by the writer job.
    -
    - -

    -


    - -

    Data Format

    - -
    -
    ID
    - -
    ATTR_DATAFORMAT
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Data format. Valid values are *RCDDATA, *ALLDATA.
    -
    - -

    -


    - -

    Data Queue

    - -
    -
    ID
    - -
    ATTR_DATA_QUEUE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Specifies the Integrated File System path of the data queue that is associated with the output -queue or "*NONE" if no data queue is associated with the the output queue. The -format of the Integrated File System path is "/QSYS.LIB/library.LIB/dataqueue.DTAQ" where library -is the library that contains the data queue and dataqueue is the name of -the data queue. -
    -
    - -

    -


    - -

    Date File -Opened

    - -
    -
    ID
    - -
    ATTR_DATE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    For spooled files this is the date the spooled file was opened. -For AFP resources this is the date the object was last modified. -The date is encoded in a character -string with the following format, C YY MM DD.
    -
    - - -

    -


    - - -

    Date Spooled File Job Create End

    -
    -
    ID
    -
    ATTR_DATE_END
    -
    Type
    -
    String
    -
    Description
    -
    The date the job ended that created the spooled file on the system. If the Starting spooled file create date field is set to *ALL, then -this field must be set to blanks. If a date has been specified for the Starting spooled file create date field, then this field must be set to a valid date. The date -must be in the CYYMMDD format or be one of the following special values:
    -
    • *LAST: All spooled files with a create date and time equal to or later than the starting spooled file create date are to be returned.
    • -
    • Date: All spooled files with a create date and time equal to or later than the starting spooled file create date and time and less than or equal to the ending spooled file create date and time are to be returned.
    • -
    -The date format CYYMMDD is defined as follows: -
    • C is the Century, where 0 indicates years 19xx and 1 indicates years 20xx
    • -
    • YY is the Year
    • -
    • MM is the Month
    • -
    • DD is the Day
    -
    - - -

    -


    - -

    Date Writer Began Processing Spooled File

    - -
    -
    ID
    - -
    ATTR_DATE_WTR_BEGAN_FILE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Indicates the date at which the writer began processing this spooled file. The date is encoded in a character string with the following format, C YY MM DD.
    -
    - -

    -


    - -

    Date Writer Completed Processing Spooled File

    - -
    -
    ID
    - -
    ATTR_DATE_WTR_CMPL_FILE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Indicates the date at which the writer began finished this spooled file. The date is encoded in a character string with the following format, C YY MM DD.
    -
    -

    -


    - -

    User Specified -DBCS Data

    - -
    -
    ID
    - -
    ATTR_DBCSDATA
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether the spooled file contains double-byte character set (DBCS) -data. Valid values are *NO and *YES.
    -
    - -

    -


    - -

    DBCS Extension -Characters

    - -
    -
    ID
    - -
    ATTR_DBCSEXTENSN
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether the system is to process the DBCS extension characters. Valid -values are *NO and *YES.
    -
    - -

    -


    - -

    DBCS Character -Rotation

    - -
    -
    ID
    - -
    ATTR_DBCAROTATE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether the DBCS characters are rotated 90 degrees counterclockwise -before printing. Valid values are *NO and *YES.
    -
    - -

    -


    - -

    DBCS Characters -per Inch

    - -
    -
    ID
    - -
    ATTR_DBCSCPI
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The number of double-byte characters to be printed per inch. Valid -values are -1, -2, 5, 6, and 10. The value *CPI is encoded as -1. The value -*CONDENSED is encoded as -2.
    -
    - -

    -


    - -

    DBCS SO/SI -Spacing

    - -
    -
    ID
    - -
    ATTR_DBCSSISO
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Determines the presentation of shift-out and shift-in characters when -printed. Valid values are *NO, *YES, and *RIGHT.
    -
    - -

    -


    - -

    Defer Write

    - -
    -
    ID
    - -
    ATTR_DFR_WRITE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether print data is held in system buffers before
    -
    - -

    -


    - -

    Degree of -Page Rotation

    - -
    -
    ID
    - -
    ATTR_PAGRTT
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The degree of rotation of the text on the page, with respect to the -way the form is loaded into the printer. Valid values are -1, -2, -3, 0, -90, 180, 270. The value *AUTO is encoded as -1, the value *DEVD is encoded -as -2, and the value *COR is encoded as -3.
    -
    - -

    -


    - -

    Delete File -After Sending

    - -
    -
    ID
    - -
    ATTR_DELETESPLF
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Delete the spooled file after sending? Valid values are *NO and *YES. -
    -
    - -

    -


    - -

    Destination -Option

    - -
    -
    ID
    - -
    ATTR_DESTOPTION
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Destination option. A text string that allows the user to pass options -to the receiving system.
    -
    - -

    -


    - -

    Destination -Type

    - -
    -
    ID
    - -
    ATTR_DESTINATION
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Destination type. Valid values are *OTHER, *AS400, *PSF2.
    -
    - -

    -


    - -

    Device Class

    - -
    -
    ID
    - -
    ATTR_DEVCLASS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The device class.
    -
    - -

    -


    - -

    Device Model

    - -
    -
    ID
    - -
    ATTR_DEVMODEL
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The model number of the device.
    -
    - -

    -


    - -

    Device Status

    - -
    -
    ID
    - -
    ATTR_DEVSTATUS
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The status of the printer device. Valid values are 0 (varied off), 10 (vary off pending), 20 (vary on pending), 30 (varied on), 40 (connect pending), 60 (active), 66 (active writer), 70 (held), 75 (powered off), 80 (recovery pending), 90 (recovery canceled), 100 (failed), 106 (failed writer), 110 (being serviced), 111 (damaged), 112 (locked), 113 (unknown).
    -
    - -

    -


    - -

    Device Type

    - -
    -
    ID
    - -
    ATTR_DEVTYPE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The device type.
    -
    - -

    -


    - -

    Display any -File

    - -
    -
    ID
    - -
    ATTR_DISPLAYANY
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether users who have authority to read this output queue can display -the output data of any output file on this queue or only the data in their -own files. Valid values are *YES, *NO, *OWNER.
    -
    - -

    -


    - -

    Drawer for -Separators

    - -
    -
    ID
    - -
    ATTR_DRWRSEP
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    Identifies the drawer from which the job and file separator pages are -to be taken. Valid values are -1, -2, 1, 2, 3. The value *FILE is encoded -as -1, and the value *DEVD is encoded as -2.
    -
    - -

    -


    - -

    Edge Stitch Number of Staples

    - -
    -
    ID
    - -
    ATTR_EDGESTITCH_NUMSTAPLES
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The number of staples that are applied along the finishing operation axis.
    -
    - -

    -


    - -

    Edge Stitch Reference

    - -
    -
    ID
    - -
    ATTR_EDGESTITCH_REF
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Where one or more staples are driven into the media along the finishing operation axis. Valid values are *NONE, *DEVD, *BOTTOM, *RIGHT, *TOP, and *LEFT.
    -
    - -

    -


    - -

    Edge Stitch Reference Offset

    - -
    -
    ID
    - -
    ATTR_EDGESTITCH_REFOFF
    - -
    Type
    - -
    Float
    - -
    Description
    - -
    The offset of the edge stitch from the reference edge toward the center of the media.
    -
    - -

    -


    - -

    End Pending Status

    - -
    -
    ID
    - -
    ATTR_ENDPNDSTS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether an End Writer (ENDWTR) command has been issued for this writer. Possible -values are *NO - no ENDWTR command was issued, *IMMED - the writer ends as soon as its -output buffers are empty, *CTRLD - the writer ends after the current copy of the spooled -file has printed, *PAGEEND - the writer ends at the end of the page.
    -
    - -

    -


    - -

    Ending Page

    - -
    -
    ID
    - -
    ATTR_ENDPAGE
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The page number at which to end printing the spooled file. Valid values -are 0 or the ending page number. The value *END is encoded as 0.
    -
    - -

    -


    - -

    Envelope Source

    - -
    -
    ID
    - -
    ATTR_ENVLP_SOURCE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The size of the envelope in the envelope source. If this field -is not specified or the value is not valid, the special value of *MFRTYPMDL -is used. Valid values are *NONE - there is no envelope source, -*MFRTYPMDL - the envelope size suggested by the manufacturer type -and model is used, *MONARCH (3.875 x 7.5 inches), *NUMBER9 (3.875 x 8.875 inches), -*NUMBER10 (4.125 x 9.5 inches), *B5 (176mm x 250mm), -*C5 (162mm x 229mm), *DL (110mm x 220mm).
    -
    - -

    -


    - -

    File Separators

    - -
    -
    ID
    - -
    ATTR_FILESEP
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The number of file separator pages that are placed at the beginning -of each copy of the spooled file. Valid values are -1, or the number of -separators. The value *FILE is encoded as -1.
    -
    - -

    -


    - -

    Fold Records

    - -
    -
    ID
    - -
    ATTR_FOLDREC
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether records that exceed the printer forms width are folded (wrapped) -to the next line. Valid values are *YES, *NO.
    -
    - -

    -


    - -

    Font Identifier

    - -
    -
    ID
    - -
    ATTR_FONTID
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The printer font that is used. Valid special values include *CPI and -*DEVD.
    -
    - -

    -


    - -

    Form Definition

    - -
    -
    ID
    - -
    ATTR_FORM_DEFINITION
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The Integrated File System path name of the form definition or a special value. - If an Integrated File System path is specified the format is "/QSYS.LIB/library.LIB/formdef.FORMDF" - where library is the library of the form definition and - formdef is the name of the form definition. - Valid special values include *NONE, *INLINE, *INLINED, and *DEVD. -
    -
    - -

    -


    - -

    Form Feed

    - -
    -
    ID
    - -
    ATTR_FORMFEED
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The manner in which forms feed to the printer. Valid values are *CONT, -*CUT, *AUTOCUT, *DEVD.
    -
    - -

    -


    - -

    Form Type

    - -
    -
    ID
    - -
    ATTR_FORMTYPE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The type of form to be loaded in the printer to print this spooled -file.
    -
    - -

    -


    - -

    Form Type -Message Option

    - -
    -
    ID
    - -
    ATTR_FORMTYPEMSG
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Message option for sending a message to the writer's message queue -when the current form type is finished. Valid values are *MSG, *NOMSG, -*INFOMSG, *INQMSG.
    -
    - -

    -


    - -

    Front Margin -Offset Across

    - -
    -
    ID
    - -
    ATTR_FTMGN_ACR
    - -
    Type
    - -
    Float
    - -
    Description
    - -
    For the front side of a piece of paper, it specifies, how far in from -the left side of the page printing starts. The special value *DEVD is encoded -as -2.
    -
    - -

    -


    - -

    Front Margin -Offset Down

    - -
    -
    ID
    - -
    ATTR_FTMGN_DWN
    - -
    Type
    - -
    Float
    - -
    Description
    - -
    For the front side of a piece of paper, it specifies, how far down -from the top of the page printing starts. The special value *DEVD is encoded -as -2.
    -
    - -

    -


    - -

    Front Overlay

    - -
    -
    ID
    - -
    ATTR_FRONT_OVERLAY
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The Integrated File System path of the front overlay. The format of the Integrated File System path is - "/QSYS.LIB/library.LIB/overlay.OVL" where - library is the library of the resource and overlay is the - name of the overlay. - The string "*NONE" is used to indicate that no front overlay is specified. -
    -
    - -

    -


    - -

    Front Overlay -Offset Across

    - -
    -
    ID
    - -
    ATTR_FTOVL_ACR
    - -
    Type
    - -
    Float
    - -
    Description
    - -
    The offset across from the point of origin where the overlay is printed. -
    -
    - -

    -


    - -

    Front Overlay -Offset Down

    - -
    -
    ID
    - -
    ATTR_FTOVL_DWN
    - -
    Type
    - -
    Float
    - -
    Description
    - -
    The offset down from the point of origin where the overlay is printed. -
    -
    - -

    -


    - -

    Graphic Character -Set

    - -
    -
    ID
    - -
    ATTR_CHAR_ID
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The set of graphic characters to be used when printing this file. Valid -special values include *DEVD, *SYSVAL, and *JOBCCSID.
    -
    - -

    -


    - -

    Hardware Justification

    - -
    -
    ID
    - -
    ATTR_JUSTIFY
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The percentage that the output is right justified. Valid values are -0, 50, 100.
    -
    - -

    -


    - -

    Held Status

    - -
    -
    ID
    - -
    ATTR_HELDSTS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether the writer is held. Valid values are *YES, *NO.
    -
    - -

    -


    - -

    Hold Spool -File

    - -
    -
    ID
    - -
    ATTR_HOLD
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether the spooled file is held. Valid values are *YES, *NO.
    -
    - -

    -


    - -

    Hold Pending Status

    - -
    -
    ID
    - -
    ATTR_HOLDPNDSTS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether a Hold Writer (HLDWTR) command has been issued for this writer. Possible values -are *NO - no HLDWTR command was issued, *IMMED - the writer is held when its output buffers -are empty, *CTRLD - writer held after the current copy of the spooled file has printed, -*PAGEEND - writer held at the end of the page.
    -
    - -

    -


    - - -

    Image Configuration

    -
    -
    ID
    -
    ATTR_IMGCFG
    -
    Type
    -
    String
    -
    Description
    -
    The transform services for a variety of image and print data-stream formats.
    -
    - - -


    - -

    Initialize -the writer

    - -
    -
    ID
    - -
    ATTR_WTRINIT
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The user can specify when to initialize the printer device. Valid values -are *WTR, *FIRST, *ALL.
    -
    - -

    -


    - -

    Internet Address

    - -
    -
    ID
    - -
    ATTR_INTERNETADDR
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The internet address of the receiving system.
    -
    - -

    -


    - -

    IPP Attributes-charset

    - -
    -
    ID
    - -
    ATTR_IPP_ATTR_CHARSET
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Indicates the charset (coded character set and encoding method) of the IPP specified spooled file attributes.
    -
    - -

    -


    - -

    IPP Job ID

    - -
    -
    ID
    - -
    ATTR_IPP_JOB_ID
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    IPP Job ID relative to the IPP printer that created the job.
    -
    - -

    -


    - -

    IPP Job Name

    - -
    -
    ID
    - -
    ATTR_IPP_ATR_CHARSET
    - -
    Type
    - -
    String
    - -
    Description
    - -
    User friendly name of job.
    -
    - -

    -


    - -

    IPP Job Name NL

    - -
    -
    ID
    - -
    ATTR_IPP_JOB_NAME_NL
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Natural language of job name.
    -
    - - -

    -


    - -

    IPP Job Originating User Name

    - -
    -
    ID
    - -
    ATTR_IPP_JOB_ORIGUSER
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Identifies the end user that submitted this IPP job.
    -
    - -

    -


    - -

    IPP Job Originating User Name NL

    - -
    -
    ID
    - -
    ATTR_IPP_JOB_ORIGUSER_NL
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Identifies the natural language of job-originating user name.
    -
    - -

    -


    - -

    IPP Printer Name

    - -
    -
    ID
    - -
    ATTR_IPP_PRINTER_NAME
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Identifies the IPP printer that created this job.
    -
    - -

    -


    - -

    Job Name

    - -
    -
    ID
    - -
    ATTR_JOBNAME
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The name of the job that created the spooled file.
    -
    - -

    -


    - -

    Job Number

    - -
    -
    ID
    - -
    ATTR_JOBNUMBER
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The number of the job that created the spooled file.
    -
    - -

    -


    - -

    Job Separators

    - -
    -
    ID
    - -
    ATTR_JOBSEPRATR
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The number of job separators to be placed at the beginning of the output -for each job having spooled files on this output queue. Valid values are --2, 0-9. The value *MSG is encoded as -2. Job separators are specified -when the output queue is created.
    -
    - -

    -


    - - -

    Job System

    -
    -
    ID
    -
    ATTR_JOBSYSTEM
    -
    Type
    -
    String
    -
    Description
    -
    The system job which created spooled file was running.
    -
    -


    - -

    Job User

    - -
    -
    ID
    - -
    ATTR_JOBUSER
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The name of the user that created the spooled file.
    -
    - -

    -


    - -

    Last Page -Printed

    - -
    -
    ID
    - -
    ATTR_LASTPAGE
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The number of the last printed page is the file if printing ended before -the job completed processing.
    -
    - -

    -


    - -

    Length of -Page

    - -
    -
    ID
    - -
    ATTR_PAGELEN
    - -
    Type
    - -
    Float
    - -
    Description
    - -
    The length of a page. Units of measurement are specified in the measurement -method attribute.
    -
    - -

    -


    - -

    Library Name

    - -
    -
    ID
    - -
    ATTR_LIBRARY
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The name of the library.
    -
    - -

    -


    - -

    Lines Per -Inch

    - -
    -
    ID
    - -
    ATTR_LPI
    - -
    Type
    - -
    Float
    - -
    Description
    - -
    The number of lines per vertical inch in the spooled file.
    -
    - -

    -


    - -

    Line Spacing

    - -
    -
    ID
    - -
    ATTR_LINESPACING
    - -
    Type
    - -
    String
    - -
    Description
    - -
    How a file's line data records are spaced when printed. The information is returned only for *LINE and *AFPDSLINE printer device types files. Valid values are *SINGLE, *DOUBLE, *TRIPLE, or *CTLCHAR.
    -
    - -

    -


    - -

    Manufacturer -Type and Model

    - -
    -
    ID
    - -
    ATTR_MFGTYPE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Specifies the manufacturer, type, and model when transforming print -data from SCS to ASCII.
    -
    - -

    -


    - -

    Maximum Jobs per Client List

    - -
    -
    ID
    - -
    ATTR_MAX_JOBS_PER_CLIENT
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    Supplied by the client to indicate the maximum printer queue size of limitation.
    -
    -

    -


    - -

    Maximum Spooled -Output Records

    - -
    -
    ID
    - -
    ATTR_MAXRECORDS
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The maximum number of records allowed in this file at the time this -file was opened. The value *NOMAX is encoded as 0.
    -
    - -

    -


    - -

    Measurement -Method

    - -
    -
    ID
    - -
    ATTR_MEASMETHOD
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The measurement method that is used for the length of page and width -of page attributes. Valid values are *ROWCOL, *UOM.
    -
    - -

    -


    - -

    Message Help

    - -
    -
    ID
    - -
    ATTR_MSGHELP
    - -
    Type
    - -
    char(*)
    - -
    Description
    - -
    The message help, which is sometimes known as second-level text, can -be returned by a "retrieve message" request. The system limits -the length to 3000 characters (English version must be 30% less to allow -for translation).
    -
    - -

    -


    - -

    Message ID

    - -
    -
    ID
    - -
    ATTR_MESSAGEID
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The message ID.
    -
    - -

    -


    - -

    Message Queue

    - -
    -
    ID
    - -
    ATTR_MESSAGE_QUEUE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The Integrated File System path of the message queue that the writer uses for operational -messages. The format of the Integrated File System path is "/QSYS.LIB/library.LIB/messageque.MSGQ" -where library is the library that contains the message queue and -messageque is the name of the message queue. -
    -
    - -

    -


    - -

    Message Reply

    - -
    -
    ID
    - -
    ATTR_MSGREPLY
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The message reply. Text string to be provided by the client which answers -a message of type "inquiry". In the case of message retrieved, -the attribute value is returned by the system and contains the default -reply which the client can use. The system limits the length to 132 characters. -Should be null-terminated due to variable length.
    -
    - -

    -


    - -

    Message Text

    - -
    -
    ID
    - -
    ATTR_MSGTEXT
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The message text, that is sometimes known as first-level text, can -be returned by a "retrieve message" request. The system limits -the length to 132 characters.
    -
    - -

    -


    - -

    Message Type

    - -
    -
    ID
    - -
    ATTR_MSGTYPE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The message type, a 2-digit, EBCDIC encoding. Two types of messages -indicate whether one can "answer" a "retrieved" message: -'04' Informational messages convey information without asking for a reply -(may require a corrective action instead), '05' Inquiry messages convey -information and ask for a reply.
    -
    - -

    -


    - -

    Message -Severity

    - -
    -
    ID
    - -
    ATTR_MSGSEV
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    Message severity. Values range from 00 to 99. The higher the value, -the more severe or important the condition.
    -
    - -

    -


    - -

    Multi-item Reply Capability

    - -
    -
    ID
    - -
    ATTR_MULTI_ITEM_REPLY
    - -
    Type
    - -
    String
    - -
    Description
    - -
    When this attribute value is set to *YES by the client, the performance of list spooled file operations can be greatly improved. The default value is *NO.
    -
    -

    -


    - -

    Network Identifier

    - -
    -
    ID
    - -
    ATTR_NETWORK
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The network identifier of the system where the file was created.
    -
    - -

    -


    - -

    Number of Bytes - in Spooled File

    - -
    -
    ID
    - -
    ATTR_NUMBYTES_SPLF
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The total number of bytes available in the stream or spooled file. -The value indicates the number of bytes BEFORE any transform of the data takes place. -In order to accommodate files of sizes greater than 2**31 - 1 bytes, this value -is scaled; the user needs to multiply the value by 10K to get the actual number of bytes. -This attribute is not valid for spooled files being viewed in page-at-a-time mode.
    -
    - -

    -


    - -

    Number of -Bytes to Read/Write

    - -
    -
    ID
    - -
    ATTR_NUMBYTES
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The number of bytes to read for a read operation, or the number of -bytes to write for a write operation. The object action determines how -to interpret this attribute.
    -
    - -

    -


    - -

    Number of -Files

    - -
    -
    ID
    - -
    ATTR_NUMFILES
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The number of spooled files that exist on the output queue.
    -
    - -

    -


    - -

    Number of -Writers Started to Queue

    - -
    -
    ID
    - -
    ATTR_NUMWRITERS
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The number of writer jobs started to the output queue.
    -
    - -

    -


    - -

    Object Extended -Attribute

    - -
    -
    ID
    - -
    ATTR_OBJEXTATTR
    - -
    Type
    - -
    String
    - -
    Description
    - -
    An "extended" attribute used by some objects like font resources. -This value shows up via WRKOBJ and DSPOBJD commands on the system. The -title on a system screen may just indicate "Attribute". In the -case of object types of font resources, for example, common values are -CDEPAG, CDEFNT, and FNTCHRSET.
    -
    - -

    -


    - -

    On Job -Queue Status

    - -
    -
    ID
    - -
    ATTR_ONJOBQSTS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether the writer is on a job queue and therefore is not currently -running. The possible values are *YES, *NO.
    -
    - -

    -


    - -

    Open time -commands

    - -
    -
    ID
    - -
    ATTR_OPENCMDS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Specifies whether user wants SCS open time commands to be inserted -into datastream prior to spool file data. Valid values are *YES, *NO.
    -
    - -

    -


    - -

    Operator Controlled

    - -
    -
    ID
    - -
    ATTR_OPCNTRL
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether users with job control authority are allowed to manage or control -the spooled files on this queue. Valid values are *YES, *NO.
    -
    - -

    -


    - -

    Order of Files -On Queue

    - -
    -
    ID
    - -
    ATTR_ORDER
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The order of spooled files on this output queue. Valid values are *FIFO, -*JOBNBR.
    -
    - -

    -


    - -

    Output Bin

    - -
    -
    ID
    - -
    ATTR_OUTPUTBIN
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The output bin the printer uses for the printed output. Values range from 1 to 65535. The value *DEVD is encoded as 0.
    -
    - -

    -


    - -

    Output Priority

    - -
    -
    ID
    - -
    ATTR_OUTPTY
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The priority of the spooled file. The priority ranges from 1 (highest) -to 9 (lowest). Valid values are 0-9, where 0 represents *JOB.
    -
    - -

    -


    - -

    Output Queue

    - -
    -
    ID
    - -
    ATTR_OUTPUT_QUEUE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The Integrated File System path of the output queue. The format of the Integrated File System path is - "/QSYS.LIB/library.LIB/queue.OUTQ" where library is the library - that contains the output queue and queue is the name of the - output queue. -
    -
    - -

    -


    - -

    Output Queue -Status

    - -
    -
    ID
    - -
    ATTR_OUTQSTS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The status of the output queue. Valid values are RELEASED, HELD.
    -
    - -

    -


    - -

    Overall Status

    - -
    -
    ID
    - -
    ATTR_OVERALLSTS
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The overall status of the "logical printer". "Logical printer" refers to printer device, output queue and writer job. Valid values are 1 (unavailable), 2 (powered off or not yet available), 3 (stopped), 4 (message waiting), 5 (held), 6 (stop pending), 7 (hold pending), 8 (waiting for printer), 9 (waiting to start), 10 (printing), 11 (waiting for output queue), 12 (connect pending), 13 (powered off), 14 (unusable), 15 (being serviced), 999 (unknown).
    -
    - -

    -


    - -

    Overflow Line -Number

    - -
    -
    ID
    - -
    ATTR_OVERFLOW
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The last line to be printed before the data that is being printed overflows -to the next page.
    -
    - -

    -


    - -

    Page At A Time

    - -
    -
    ID
    - -
    ATTR_PAGE_AT_A_TIME
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Specifies whether the spooled file is to be opened in page-at-a-time mode. -Valid values are *YES and *NO.
    -
    - -

    -


    - -

    Page Count -Estimated

    - -
    -
    ID
    - -
    ATTR_PAGES_EST
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Specifies whether the page count is estimated rather than actual. Valid -values are *YES and *NO.
    -
    - -

    -


    - -

    Page Definition

    - -
    -
    ID
    - -
    ATTR_PAGE_DEFINITION
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The Integrated File System path name of the page definition or a special value. If an Integrated File System path is specified the format is "/QSYS.LIB/library.LIB/pagedef.PAGDFN" where library is the library of the page definition and pagedef is the name of the page definition. Valid special values include *NONE.
    -
    - -

    -


    - -

    Page Number

    - -
    -
    ID
    - -
    ATTR_PAGENUMBER
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The number of the page to be read from a spooled file opened in page-at-a-time mode.
    -
    - -

    -


    - -

    Pages Per -Side

    - -
    -
    ID
    - -
    ATTR_MULTIUP
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The number of logical pages that print on each side of each physical -page when the file is printed. Valid values are 1, 2, 4.
    -
    - -

    -


    - -

    Paper Source 1

    - -
    -
    ID
    - -
    ATTR_PAPER_SOURCE_1
    - -
    Type
    - -
    String
    - -
    Description
    -
    The size of the paper in paper source one. If this field -is not specified or the value is not valid, the special value of *MFRTYPMDL -is used. Valid values are *NONE - there is no paper source one or the -paper is manually fed into the printer, -*MFRTYPMDL - the paper size suggested by the manufacturer type -and model is used, *LETTER (8.5 x 11.0 inches), *LEGAL (8.5 x 14.0 inches), -*EXECUTIVE (7.25 x 10.5 inches), *LEDGER (17.0 x 11.0 inches), -*A3 (297mm x 420mm), *A4 (210mm x 297mm), *A5 (148mm x 210mm), -*B4 (257mm x 364mm), *B5 (182mm x 257mm), *CONT80 (8.0 inches wide with -continuous form), *CONT132 (13.2 inches wide with continuous form).
    -
    - -

    -


    - -

    Paper Source 2

    - -
    -
    ID
    - -
    ATTR_PAPER_SOURCE_2
    - -
    Type
    - -
    String
    - -
    Description
    -
    The size of the paper in paper source two. If this field -is not specified or the value is not valid, the special value of *MFRTYPMDL -is used. Valid values are *NONE - there is no paper source two or the -paper is manually fed into the printer, -*MFRTYPMDL - the paper size suggested by the manufacturer type -and model is used, *LETTER (8.5 x 11.0 inches), *LEGAL (8.5 x 14.0 inches), -*EXECUTIVE (7.25 x 10.5 inches), *LEDGER (17.0 x 11.0 inches), -*A3 (297mm x 420mm), *A4 (210mm x 297mm), *A5 (148mm x 210mm), -*B4 (257mm x 364mm), *B5 (182mm x 257mm), *CONT80 (8.0 inches wide with -continuous form), *CONT132 (13.2 inches wide with continuous form).
    -
    - -

    -


    - -

    Pel Density

    - -
    -
    ID
    - -
    ATTR_PELDENSITY
    - -
    Type
    - -
    String
    - -
    Description
    - -
    For font resources only, this value is an encoding of the number of -pels ("1" represents a pel size of 240, "2" represents -a pel size of 320). Additional values may become meaningful as the system defines them.
    -
    - -

    -


    - -

    Point Size

    - -
    -
    ID
    - -
    ATTR_POINTSIZE
    - -
    Type
    - -
    Float
    - -
    Description
    - -
    The point size in which this spooled file's text is printed. The special -value *NONE will be encoded as 0.
    -
    - -

    -


    - -

    Print Fidelity

    - -
    -
    ID
    - -
    ATTR_FIDELITY
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The kind of error handling that is performed when printing. Valid values -are *ABSOLUTE, *CONTENT.
    -
    - -

    -


    - -

    Print on Both -Sides

    - -
    -
    ID
    - -
    ATTR_DUPLEX
    - -
    Type
    - -
    String
    - -
    Description
    - -
    How the information prints. Valid values are *FORMDF, *NO, *YES, *TUMBLE. -
    -
    - -

    -


    - -

    Print Quality

    - -
    -
    ID
    - -
    ATTR_PRTQUALITY
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The print quality that is used when printing this spooled file. Valid -values are *STD, *DRAFT, *NLQ, *FASTDRAFT.
    -
    - -

    -


    - -

    Print Sequence

    - -
    -
    ID
    - -
    ATTR_PRTSEQUENCE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Print sequence. Valid values are *NEXT.
    -
    - -

    -


    - -

    Print Text

    - -
    -
    ID
    - -
    ATTR_PRTTEXT
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The text that is printed at the bottom of each page of printed output -and on separator pages. Valid special values include *BLANK and *JOB.
    -
    - -

    -


    - -

    Printer

    - -
    -
    ID
    - -
    ATTR_PRINTER
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The name of the printer device.
    -
    - -

    -


    - -

    Printer Assigned

    - -
    -
    ID
    - -
    ATTR_PRTASSIGNED
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Indicates if the printer is assigned. Valid values are 1 (assigned to a specific printer), 2 (assigned to multiple printers), 3 (not assigned).
    -
    - -

    -


    - -

    Printer Device -Type

    - -
    -
    ID
    - -
    ATTR_PRTDEVTYPE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The printer data stream type. Valid values are *SCS, *IPDS, *USERASCII, -*AFPDS, *LINE.
    -
    - -

    -


    - -

    Printer File

    - -
    -
    ID
    - -
    ATTR_PRINTER_FILE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The Integrated File System path of the printer file. The format of the Integrated File System path is - "/QSYS.LIB/library.LIB/printerfile.FILE" where library is the library - that contains the printer file and printerfile is the name of - the printer file. -
    -
    - -

    -


    - -

    Printer Queue

    - -
    -
    ID
    - -
    ATTR_RMTPRTQ
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The name of the destination printer queue when sending spooled files -via SNDTCPSPLF (LPR).
    -
    - -

    -


    - - -

    Publishing Info Color Supported

    -
    -
    ID
    -
    ATTR_PUBINF_COLOR_SUP
    -
    Type
    -
    String
    -
    Description
    -
    Indicates color is supported for this publishing list entry.
    -
    -

    -


    - - -

    Publishing Info Pages per Minute (Color)

    -
    -
    ID
    -
    ATTR_PUBINF_PPM_COLOR
    -
    Type
    -
    Integer
    -
    Description
    -
    The pages per minute supported in color mode for this publishing list entry.
    -
    - -

    -


    - - -

    Publishing Info Pages per Minute (Monochrome)

    -
    -
    ID
    -
    ATTR_PUBINF_PPM
    -
    Type
    -
    Integer
    -
    Description
    -
    The pages per minute supported in monochrome for this publishing list entry.
    -
    -

    -


    - - -

    Publishing Info Duplex Support

    -
    -
    ID
    -
    ATTR_PUBINF_DUPLEX_SUP
    -
    Type
    -
    String
    -
    Description
    -
    The duplex supported indicator for this publishing list entry.
    -
    - -

    -


    - - -

    Publishing Info Location

    -
    -
    ID
    -
    ATTR_PUBINF_LOCATION
    -
    Type
    -
    String
    -
    Description
    -
    The location description for this publishing list entry.
    -
    - -

    -


    - - -

    Remote Location Name

    -
    -
    ID
    -
    ATTR_RMTLOCNAME
    -
    Type
    -
    String
    -
    Description
    -
    The printer device location name.
    -
    - -

    -


    - -

    Record Length

    - -
    -
    ID
    - -
    ATTR_RECLENGTH
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    Record length.
    -
    - -

    -


    - -

    Reduce Output

    - -
    -
    ID
    - -
    ATTR_REDUCE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The manner in which multiple logical pages print on each side of a physical page. Valid values *TEXT or ????.
    -
    - -

    -


    - -

    Remote System

    - -
    -
    ID
    - -
    ATTR_RMTSYSTEM
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Remote system name. Valid special values include *INTNETADR.
    -
    - -

    -


    - -

    Replace Unprintable -Characters

    - -
    -
    ID
    - -
    ATTR_RPLUNPRT
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether characters that cannot be printed are to be replaced with another -character. Valid values are *YES or *NO.
    -
    - -

    -


    - -

    Replacement -Character

    - -
    -
    ID
    - -
    ATTR_RPLCHAR
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The character that replaces any unprintable characters.
    -
    - -

    -


    - -

    Restart -Printing

    - -
    -
    ID
    - -
    ATTR_RESTART
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    Restart printing. Valid values are -1, -2, -3, or the page number to -restart at. The value *STRPAGE is encoded as -1, the value *ENDPAGE is -encoded as -2, and the value *NEXT is encoded as -3.
    -
    - -

    -


    - -

    Saddle Stitch Number of Staples

    - -
    -
    ID
    - -
    ATTR_SADDLESTITCH_NUMSTAPLES
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The number of staples that are to be applied along the finishing operation axis.
    -
    - -

    -


    - -

    Saddle Stitch Reference

    - -
    -
    ID
    - -
    ATTR_SADDLESTITCH_REF
    - -
    Type
    - -
    String
    - -
    Description
    - -
    One or more staples are driven into the media along the finishing operation axis, which is positioned at the center of the media parallel to the reference edge. Valid values are *NONE, *DEVD, *TOP, and *LEFT.
    -
    - -

    -


    - -

    Save Spooled -File

    - -
    -
    ID
    - -
    ATTR_SAVESPLF
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether the spooled file is to be saved after it is written. Valid -values are *YES, *NO.
    -
    - -

    -


    - -

    Seek Offset

    - -
    -
    ID
    - -
    ATTR_SEEKOFF
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    Seek offset. Allows both positive and negative values relative to the -seek origin.
    -
    - -

    -


    - -

    Seek Origin

    - -
    -
    ID
    - -
    ATTR_SEEKORG
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    Valid values include 1 (beginning or top), 2 (current), and 3 (end -or bottom).
    -
    - -

    -


    - -

    Send Priority

    - -
    -
    ID
    - -
    ATTR_SENDPTY
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Send priority. Valid values are *NORMAL, *HIGH.
    -
    - -

    -


    - -

    Separator -page

    - -
    -
    ID
    - -
    ATTR_SEPPAGE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Allows a user the option of printing a banner page or not. Valid values -are *YES or *NO.
    -
    - -

    -


    - -

    Source -Drawer

    - -
    -
    ID
    - -
    ATTR_SRCDRWR
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The drawer to be used when the automatic cut sheet feed option is selected. -Valid values are -1, -2, 1-255. The value *E1 is encoded as -1, and the -value *FORMDF is encoded as -2.
    -
    - -

    -


    - -

    Spool -SCS

    - -
    -
    ID
    - -
    ATTR_SPLSCS
    - -
    Type
    - -
    Long
    - -
    Description
    - -
    Determines how SCS data is used during create spool file.
    -
    - -

    -


    - -

    Spool the -Data

    - -
    -
    ID
    - -
    ATTR_SPOOL
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether the output data for the printer device is spooled. Valid values -are *YES, *NO.
    -
    - -

    -


    - -

    Spooled File Creation Authentication Method

    - -
    -
    ID
    - -
    ATTR_SPLF_AUTH_METHOD
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    Indicates the client authentication method used to create this spooled file. Valid values include x'00'(*NONE), x'01'(*REQUESTER), x'02'(*BASIC), x'03'(*CERTIFICATE), and 'x'04'(*DIGEST).
    -
    - -

    -


    - -

    Spooled File Creation Security Method

    - -
    -
    ID
    - -
    ATTR_SPLF_SECURITY_METHOD
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Indicates the security method used to create this spooled file. Valid values are x'00'(*NONE), x'01'(*SSL3), and x'02'(*TLS).
    -
    -

    -


    - -

    Spooled -File Name

    - -
    -
    ID
    - -
    ATTR_SPOOLFILE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The name of the spooled file.
    -
    - -

    -


    - -

    Spooled -File Number

    - -
    -
    ID
    - -
    ATTR_SPLFNUM
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The spooled file number. Special values allowed are -1 and 0. -The value *LAST is encoded as -1, the value *ONLY is -encoded as 0.
    -
    - -

    -


    - -

    Spooled -File Status

    - -
    -
    ID
    - -
    ATTR_SPLFSTATUS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The status of the spooled file. Valid values are *CLOSED, *HELD, *MESSAGE, -*OPEN, *PENDING, *PRINTER, *READY, *SAVED, *WRITING.
    -
    - -

    -


    - -

    Spooled -Output Schedule

    - -
    -
    ID
    - -
    ATTR_SCHEDULE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Specifies, for spooled files only, when the spooled file is available -to the writer. Valid values are *IMMED, *FILEEND, *JOBEND.
    -
    - -

    -


    - -

    Started By User

    - -
    -
    ID
    - -
    ATTR_STARTEDBY
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The name of the user who started the writer.
    -
    - -

    -


    - -

    Starting -Page

    - -
    -
    ID
    - -
    ATTR_STARTPAGE
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The page number at which to start printing the spooled file. Valid -values are -1, 0, 1, or the page number. The value *ENDPAGE is encoded -as -1. For the value 0, printing starts on page 1. For the value 1, the -entire file prints.
    -
    - -

    -


    - -

    System Where Created

    - -
    -
    ID
    - -
    ATTR_SYSTEM
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The name of the system where the spooled file was created. When the name of the system where this spooled file was created cannot be determined, the receiving system name is used.
    -
    - -

    -


    - -

    Text Description

    - -
    -
    ID
    - -
    ATTR_DESCRIPTION
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Text to describe an instance of an AS400 object.
    -
    - -

    -


    - -

    Time File -Opened

    - -
    -
    ID
    - -
    ATTR_TIMEOPEN
    - -
    Type
    - -
    String
    - -
    Description
    - -
    For spooled files this is the time this spooled file was opened. -For AFP resources this is the time the object was last modified. -The time is encoded in a character string with the following format, - HH MM SS.
    -
    - -

    -


    - - -

    Time Spooled File Create Job End

    -
    -
    ID
    -
    ATTR_TIME_END
    -
    Type
    -
    String
    -
    Description
    -
    The time the job that created the spooled file on the system ended. This field must be set to blanks when special value *ALL is used -for field Starting spooled file create date or when special value *LAST is used for field Ending spooled file create date. This field must have a value set if a -date is specified for field Ending spooled file create date. The time must be in the HHMMSS format, defined as follows: -
      -
    • HH - Hour
    • -
    • MM - Minutes
    • -
    • SS - Seconds
    • -
    -
    - - -

    -


    - -

    Time Writer Began Processing Spooled File

    - -
    -
    ID
    - -
    ATTR_TIME_WTR_BEGAN_FILE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Indicates the time at which the writer began processing the spooled file. -The time is encoded in a character string with the following format, - HH MM SS.
    -
    - -

    -


    - -

    Time Writer Completed Processing Spooled File

    - -
    -
    ID
    - -
    ATTR_TIME_WTR_CMPL_FILE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Indicates the time at which the writer finished processing the spooled file. -The time is encoded in a character string with the following format, - HH MM SS.
    -
    - - -

    -


    - -

    Total Pages

    - -
    -
    ID
    - -
    ATTR_PAGES
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    The number of pages that are contained in a spooled file.
    -
    - -

    -


    - -

    Transform -SCS to ASCII

    - -
    -
    ID
    - -
    ATTR_SCS2ASCII
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether the print data is to be transformed from SCS to ASCII. Valid -values are *YES, *NO.
    -
    - -

    -


    - -

    Unit of -Measure

    - -
    -
    ID
    - -
    ATTR_UNITOFMEAS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The unit of measure to use for specifying distances. Valid values are -*CM, *INCH.
    -
    - -

    -


    - -

    User Comment

    - -
    -
    ID
    - -
    ATTR_USERCMT
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The 100 characters of user-specified comment that describe the spooled -file.
    -
    - -

    -


    - -

    User Data

    - -
    -
    ID
    - -
    ATTR_USERDATA
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The 10 characters of user-specified data that describe the spooled -file. Valid special values include *SOURCE.
    -
    - -

    -


    - -

    User -Defined Data

    - -
    -
    ID
    - -
    ATTR_USRDFNDTA
    - -
    Type
    - -
    String
    - -
    Description
    - -
    User defined data to be utilized by user applications or user specified -programs that process spool files. All characters are acceptable. Max size -is 255.
    -
    - -

    -


    - -

    User -Defined File

    - -
    -
    ID
    - -
    ATTR_USRDEFFILE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether the spooled file was created using an API. Valid values are *YES, or *NO.
    -
    - -

    -


    - -

    User Defined -Object

    - -
    -
    ID
    - -
    ATTR_USER_DEFINED_OBJECT
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The Integrated File System path of the user defined object to be utilized - by user applications that process spool files. If an Integrated File System path the format - of the Integrated File System path is "/QSYS.LIB/library.LIB/object.type" where library - is the name of the library that contains the object or one of the special - values %LIBL% or %CURLIB%. object is the name of the object and - type is the object type. Valid values for type include - "DTAARA", "DTAQ", "FILE", "PSFCFG", "USRIDX", "USRQ" and "USRSPC". - The string "*NONE" is used to indicate no user defined object is to - be used. -
    -
    - -

    -


    - -

    User -Defined Option(s)

    - -
    -
    ID
    - -
    ATTR_USEDFNOPTS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    User defined options to be utilized by user applications that process -spool files. Up to 4 options may be specifies, each value is length char(10). -All characters are acceptable.
    -
    - -

    -


    - -

    User -Driver Program Data

    - -
    -
    ID
    - -
    ATTR_USRDRVPGMDTA
    - -
    Type
    - -
    String
    - -
    Description
    - -
    User data to be used with the user driver program. All characters are -acceptable. Maximum size is 5000 characters.
    -
    -

    -


    - -

    User -Driver Program

    - -
    -
    ID
    - -
    ATTR_USER_DRIVER_PROG
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The Integrated File System path of the user defined driver program that processes spooled files. - The format of the Integrated File System path is "/QSYS.LIB/library.LIB/program.PGM" where - library is the name of the library that contains the program and - program is the program name. The library may be one of the - special values %LIBL% and %CURLIB% or a specific library name. - The string "*NONE" is used to indicate that no driver program is defined. -
    -
    - -

    -


    - -

    User ID

    - -
    -
    ID
    - -
    ATTR_TOUSERID
    - -
    Type
    - -
    String
    - -
    Description
    - -
    User id to whom the spooled file is sent.
    -
    - -

    -


    - -

    User ID -Address

    - -
    -
    ID
    - -
    ATTR_TOADDRESS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Address of user to whom the spooled file is sent.
    -
    - -

    -


    - -

    User -Transform Program

    - -
    -
    ID
    - -
    ATTR_USER_TRANSFORM_PROG
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The Integrated File System path of the user defined transform program that - transforms spool file data before it is processed by the driver program. - The format of the Integrated File System path is "/QSYS.LIB/library.LIB/program.PGM" where - library is the name of the library that contains the program and - program is the program name. The library may be one of the - special values %LIBL% and %CURLIB% or a specific library name. - The string "*NONE" is used to indicate that no transform program is defined. -
    -
    - -

    -


    - -

    Viewing Fidelity

    - -
    -
    ID
    - -
    ATTR_VIEWING_FIDELITY
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The processing to take place when viewing a page of -spooled file data (in page-at-a-time mode). -Valid values are *ABSOLUTE and *CONTENT(default). To process all non-raster data (commands) prior -to the current page, *ABSOLUTE is used. For SCS files, *CONTENT is used to process -only open time commands plus the current page. For AFPDS files, *CONTENT -is used to process the first page of data plus the current page.
    -
    - -

    -


    - -

    VM/MVS -Class

    - -
    -
    ID
    - -
    ATTR_VMMVSCLASS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    VM/MVS class. Valid values are A-Z and 0-9.
    -
    - -

    -


    - -

    When to -Automatically End Writer

    - -
    -
    ID
    - -
    ATTR_WTRAUTOEND
    - -
    Type
    - -
    String
    - -
    Description
    - -
    When to end the writer if it is to be ended automatically. Valid values -are *NORDYF, *FILEEND. Attribute Automatically end writer must be set to -*YES.
    -
    - -

    -


    - -

    Waiting -for Data Status

    - -
    -
    ID
    - -
    ATTR_WTNGDATASTS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether the writer has written all the data currently in the spooled file -and is waiting for more data. Possible values are *NO - the writer is not -waiting for more data, *YES - the writer has written all the data currently in -the spooled file and is waiting for more data. This condition occurs when the -writer is producing an open spooled file with SCHEDULE(*IMMED) specified.
    -
    - -

    -


    - -

    Waiting -for Device Status

    - -
    -
    ID
    - -
    ATTR_WTNGDEVSTS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether the writer is waiting to get the device from a job that is printing -directly to the printer. Values are *NO - the writer is not waiting for the -device, *YES - the writer is waiting for the device.
    -
    - -

    -


    - -

    Waiting -for Message Status

    - -
    -
    ID
    - -
    ATTR_WTNGMSGSTS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Whether the writer is waiting for a reply to an inquiry message. Values are -*NO and *YES.
    -
    - -

    -


    - -

    When to -End Writer

    - -
    -
    ID
    - -
    ATTR_WTREND
    - -
    Type
    - -
    String
    - -
    Description
    - -
    When to end the writer. Valid value are *CNTRLD, *IMMED, and *PAGEEND. -This is different from when to automatically end the writer.
    -
    - -

    -


    - -

    When to -Hold File

    - -
    -
    ID
    - -
    ATTR_HOLDTYPE
    - -
    Type
    - -
    String
    - -
    Description
    - -
    When to hold the spooled file. Valid values are *IMMED, and *PAGEEND. -
    -
    - -

    -


    - -

    Width of -Page

    - -
    -
    ID
    - -
    ATTR_PAGEWIDTH
    - -
    Type
    - -
    Float
    - -
    Description
    - -
    The width of a page. Units of measurement are specified in the measurement -method attribute.
    -
    - -

    -


    - -

    Workstation -Customizing Object

    - -
    -
    ID
    - -
    ATTR_WORKSTATION_CUST_OBJECT
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The Integrated File System path of the workstation customizing object. The format of the Integrated File System path -is "/QSYS.LIB/library.LIB/custobj.WSCST" where library is the library that -contains the customization object and custobj is the name of the workstation -customization object. -
    -
    - -

    -


    - -

    Writer -Job Name

    - -
    -
    ID
    - -
    ATTR_WRITER
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The name of the writer job.
    -
    - -

    -


    - -

    Writer -Job Number

    - -
    -
    ID
    - -
    ATTR_WTRJOBNUM
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The writer job number.
    -
    - -

    -


    - -

    Writer -Job Status

    - -
    -
    ID
    - -
    ATTR_WTRJOBSTS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The status of the writer job. Valid values are STR, END, JOBQ, HLD, -MSGW.
    -
    - -

    -


    - -

    Writer -Job User Name

    - -
    -
    ID
    - -
    ATTR_WTRJOBUSER
    - -
    Type
    - -
    String
    - -
    Description
    - -
    The name of the user that started the writer job.
    -
    - -

    -


    - -

    Writer -Started

    - -
    -
    ID
    - -
    ATTR_WTRSTRTD
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Indicates whether or not a writer is started for this printer. Values -are 1 - yes a writer is started, 0 - no writer is started.
    -
    - -

    -


    - -

    Writer -Starting Page

    - -
    -
    ID
    - -
    ATTR_WTRSTRPAGE
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    Specifies the page number of the first page to print from the first -spooled file when the writer job starts. This is only valid if the spooled -file name is also specified when the writer starts.
    -
    - -

    -


    - -

    Writing -Status

    - -
    -
    ID
    - -
    ATTR_WRTNGSTS
    - -
    Type
    - -
    String
    - -
    Description
    - -
    Indicates whether the print writer is in writing status. Values are -*YES - the writer is in writing status, *NO - the writer is not in writing -status, *FILE - the writer is writing the file separators.
    -
    - -

    -


    - -

    Network -Print Server Object Attributes

    - -

    NPS CCSID

    - -
    -
    ID
    - -
    ATTR_NPSCCSID
    - -
    Type
    - -
    Integer
    - -
    Description
    - -
    CCSID that the Network Print Server expects that all strings will be -encoded in.
    -
    - -

    NPS Level

    - -
    -
    ID
    - -
    ATTR_NPSLEVEL
    - -
    Description
    - -
    The version, release, and modification level of the Network Print Server. -This attribute is a character string encoded as VXRYMY (ie. "V3R1M0") -where - -
         X is in (0..9)
    -     Y is in (0..9,A..Z)
    -
    - -

    - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/doc-files/SpooledFileAttrs.html b/cvsroot/src/com/ibm/as400/vaccess/doc-files/SpooledFileAttrs.html deleted file mode 100644 index 076e5b31e..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/doc-files/SpooledFileAttrs.html +++ /dev/null @@ -1,429 +0,0 @@ - - - - -IBM Toolbox for Java: Spooled file attributes - - - -

    Spooled file attributes

    - -
    - -

    Retrieve attributes

    - -

    The following attributes may be retrieved for a spooled file using the appropriate - getIntegerAttribute(), getStringAttribute(), or getFloatAttribute() method : - -

    - -
    - -

    Set attributes

    - -

    The following attributes may be set for a spooled file - using the setAttributes() method: - -

    - -
    - - - diff --git a/cvsroot/src/com/ibm/as400/vaccess/package.html b/cvsroot/src/com/ibm/as400/vaccess/package.html deleted file mode 100644 index 2236e148f..000000000 --- a/cvsroot/src/com/ibm/as400/vaccess/package.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - -Deprecated Provides classes that graphically present IBM i data to the user. - -

    -This package has been deprecated, and is no longer being enhanced. Users are advised to build their own GUI applications using Java Swing, on top of the classes in package com.ibm.as400.access. -

    - -

    -These classes use the com.ibm.as400.access classes to retrieve data and -then present that data to the user. -

    - -

    -The various pane classes are graphical user interface components that -present and allow manipulation of one or more IBM i resources. The behavior -of each resource varies depending on its type. -

    - -

    -All panes extend the javax.swing.JComponent class. As a result, they can be added to -any AWT or Swing frame, window, or container. -

    - -IBM i resources are represented in the graphical user interface with an icon -and text. IBM i resources are defined with hierarchical relationships where a -resoure might have a parent and zero or more children. These are predefined -relationships and are used to specify what resources are displayed in a pane. For example, VJobList is the parent to zero or more VJob objects, and this -hierarchical relationship is represented graphically in a pane. - -

    -Java programs that use the IBM Toolbox for Java GUI (graphical user interface) -classes need Swing 1.1. You get Swing 1.1 by running Java 2 or by downloading -Swing 1.1 from Sun Microsystems, Inc. In the past, IBM Toolbox for Java has -required Swing 1.0.3, and V4R5 is the first release that Swing 1.1 is supported. -To move to Swing 1.1, some programming changes were made; therefore, you may have -to make some programming changes as well. See the -Java Foundation Classes documentation for more information about Swing. -

    - -

    Related Documentation

    - -For overviews, tutorials, examples, guides, and tool documentation, please see: - - - - diff --git a/cvsroot/src/utilities/AS400ToolboxInstaller.java b/cvsroot/src/utilities/AS400ToolboxInstaller.java deleted file mode 100644 index 35ecfee5a..000000000 --- a/cvsroot/src/utilities/AS400ToolboxInstaller.java +++ /dev/null @@ -1,2146 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400ToolboxInstaller.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package utilities; - -import java.util.Vector; -import java.util.StringTokenizer; -import java.util.Hashtable; -import java.util.Enumeration; -import java.util.ResourceBundle; -import java.io.InputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.PrintStream; -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.MalformedURLException; -/** - * Provides a utility to - * install, update, compare, and uninstall the IBM Toolbox for Java - * packages. Note that this class writes to the local file system, - * so it may fail if used in an applet. - * - *

    The AS400ToolboxInstaller class can be included in the user's program, - * or it can be run as a command line program, as follows: - *

    - *
    - * java utilities.AS400ToolboxInstaller [ options ]
    - * 
    - *
    - * - *

    - * Options - * - *

    - *

    - *
    -install - *
    Indicates that the specified packages are to be installed. - * If the -package option is not specified, all packages will be installed. - * The source and target options must be specified when using this option. - * The -install option may be abbreviated to -i. - * - *
    -uninstall - *
    Indicates that the specified packages are to be removed. - * The package and target options must be specified when using this option. - * The -uninstall option may be abbreviated to -u. - * - *
    -compare - *
    Indicates that the source package with be compared with the - * target package to determine if - * an update is needed. The package, source, and target options must - * be specified when using this option. - * The -compare option may be abbreviated to -c. - * - * - *
    -package package1[,package2[, ...]] - *
    Specifies the package to install, compare, or uninstall. - * If -package is specified, at - * least one package name must be specified. - * The -package option may be abbreviated to -p. - * - * - *
    -source sourceURL - *
    Specifies the location of the source files. The HTTP server is used - * to access the files. The system name or the fully-qualified URL - * may be specified. If the system name is specified, it will automatically - * be converted to the URL where the licensed program installed the files. - * For example, if mySystem is specified, http://mySystem/QIBM/ProdData/HTTP/Public/jt400/ - * will be used. - * The -source option may be abbreviated to -s. - * - *
    -target targetDirectory - *
    Specifies the fully-qualified path name of where to store the files. - * The -target option may be abbreviated to -t. - * - *
    -prompt - *
    Specifies that the user will be prompted before updating the packages on - * the workstation. If not specified, the packages will be updated. - * The -prompt option may be abbreviated to -pr. - * - *
    -? - *
    Displays the help text. - * - *
    -help - *
    Displays the help text. - * The -help parameter may be abbreviated to -h. - *
    - * - * - *

    Install Example

    - *

    The following example will install all packages. - * - *

    - * java AS400ToolboxInstaller -install
    - *                            -source http://myAS400/QIBM/ProdData/HTTP/Public/jt400/
    - *                            -target c:\java\
    - *
    - * 
    - * - *

    The following examples will install the access package. - * - *

    - * java AS400ToolboxInstaller -install -package ACCESS
    - *                            -source http://myAS400/QIBM/ProdData/HTTP/Public/jt400/
    - *                            -target c:\java\
    - *
    - * java AS400ToolboxInstaller -install -package ACCESS
    - *                            -source mySystem
    - *                            -target c:\java\
    - *
    - * java AS400ToolboxInstaller -i -p ACCESS
    - *                            -s mySystem
    - *                            -t c:\java\
    - * 
    - * - * - *

    Uninstall Example

    - *

    This example will remove the access package. - * - *

    - * java AS400ToolboxInstaller -uninstall -package ACCESS -target c:\java\
    - * 
    - * - * - * - * - *

    Compare Example

    - *

    This example will compare the current level of the OPNAV package. - * - *

    - * java AS400ToolboxInstaller -compare
    - *                            -package OPNAV
    - *                            -source http://myAS400/QIBM/ProdData/HTTP/Public/jt400/
    - *                            -target c:\java\
    - * 
    - * - * - *

    Help Example

    - *

    The following will display help information: - *

    - * java AS400ToolboxInstaller -? 
    - * java AS400ToolboxInstaller -help
    - * java AS400ToolboxInstaller -h - *
    - * - * @deprecated This class is no longer being enhanced, since it has no known users. -**/ -public class AS400ToolboxInstaller -{ -private static final int INSTALL = 0; // when installing @A2a -private static final int UNINSTALL = 1; // when uninstalling @A2a -private static final int COMPARE = 2; // when comparing @A2a - -private static boolean isPrompt_ =false; // indicate if -pr is specified @A2a -// Changes required to the classpath as a result of the latest -// install operation. -private static Vector classpathAdditions_ = new Vector(); -private static Vector classpathRemovals_ = new Vector(); -private static Vector unexpandedFiles_ = new Vector(); - -// Return values for classpathContains method. -private static final int NOT_IN_CLASSPATH=0; -private static final int IN_CLASSPATH=1; -private static final int UNKNOWN_CLASSPATH=2; // could not examine classpath - -// $D1a constants for the difference between the code on the server -// and the code on the client -private static final int NO_CHANGE = 0; -private static final int SERVER_HAS_NEW_PTF = 1; -private static final int SERVER_HAS_NEW_RELEASE = 2; - -// Byte array used to store data read from files. Size is arbitrary. -private static byte[] data_ = new byte[2560]; - -// Where MRI comes from. -private static ResourceBundle resources_; - -// Control files use a forward slash for a path separator. This flag -// says whether the slash has to be changed to a backward slash when -// writing to the local file system. -private static boolean changeSlash_ = !File.separator.equals("/"); - -// To prevent instantiation. All methods in this class are static. -private AS400ToolboxInstaller() -{} - - - -/** -Adds a trailing separator to the path if it does not already have one. -If the path is blank, -a separator is not added, since that would change the meaning of the -path to be the root directory rather than the curent directory. - -@param path The path to which to add a separator. - -@return The path with a trailing separator. -**/ -private static String addTrailingSeparator(String path) -{ - if (path.length() > 0 && - path.substring(path.length()-1).equals(File.separator)); - else if (path.length() > 0) - path = path + File.separator; - return path; -} - - -/** -Checks to see if path is in the CLASSPATH. If the CLASSPATH -is not accessible, UNKNOWN_CLASSPATH will be returned. This method -is not case-sensitive. - -@param path The path for which to check the CLASSPATH. - -@return NOT_IN_CLASSPATH if path is not in the CLASSPATH, - IN_CLASSPATH if path is in the CLASSPATH, - UNKNOWN_CLASSPATH if the CLASSPATH cannot be accessed. -**/ -private static int classpathContains(String path) -{ - try - { - // Search with leading and trailing semicolons to make sure - // paths match exactly. Uppercase to make our check case- - // insensitive. - String separator = System.getProperty("path.separator"); - String classpath = separator + - System.getProperty("java.class.path") + - separator; - classpath = classpath.toUpperCase(); - path = path.toUpperCase(); - if (classpath.lastIndexOf(separator + path + separator) != -1) - return IN_CLASSPATH; - else - return NOT_IN_CLASSPATH; - } - catch(Exception e) - { - return UNKNOWN_CLASSPATH; - } -} - - - - -// @D1a The following routine (comparePackageFiles) is new. - -/** -Determines if an update is needed. - -@param sourceControlFile File that contains VRM info from the server -@param targetControlFile File that contains VRM info on the client. -@return updateNeeded Int that indicates if the files are the same, - the server has a new PTF, or the server has - a new release. - -

    -This routine compares the first line of the control files. VRM -information must be the first line of the file and must be in VnRnMnxx -format. If VRM information is not in the first line, the original -check is used. That check assumes the only difference between the -source and target is PTF level. This means if the source is larger -than the target, the source has a new PTF. -

    -An example of the control file is on a system with two PTFs: -

    -V3R2M0 -V3R2M01 -V3R2M02 - - -**/ - -private static int comparePackageFiles(String serverFile, String clientFile) -{ - int result = NO_CHANGE; - boolean useOriginalCheck = true; - - try - { - StringTokenizer parseServerFile = new StringTokenizer(serverFile, "\n\r"); - StringTokenizer parseClientFile = new StringTokenizer(clientFile, "\n\r"); - - // get the first line out of each file - String ServerVRM = parseServerFile.nextToken().toUpperCase(); - String ClientVRM = parseClientFile.nextToken().toUpperCase(); - - // If the first line looks like a VRM string then check the contents - // of the strings. - if ((ServerVRM.charAt(0) == 'V') && (ClientVRM.charAt(0) == 'V') && - (ServerVRM.charAt(2) == 'R') && (ClientVRM.charAt(2) == 'R') && - (ServerVRM.charAt(4) == 'M') && (ClientVRM.charAt(4) == 'M')) - { - // If the server has a newer version indicate an update is needed - if (ServerVRM.charAt(1) > ClientVRM.charAt(1)) - { - result = SERVER_HAS_NEW_RELEASE; - useOriginalCheck = false; - } - - // if the client has a newer version then return saying no - // updated needed. - else if (ServerVRM.charAt(1) < ClientVRM.charAt(1)) - { - useOriginalCheck = false; - } - - // else the version is the same ... - else - { - // if the server has a newer release indicate an update is needed - if (ServerVRM.charAt(3) > ClientVRM.charAt(3)) - { - result = SERVER_HAS_NEW_RELEASE; - useOriginalCheck = false; - } - - // if the client has a newer release then return saying no - // update is needed. - else if (ServerVRM.charAt(3) < ClientVRM.charAt(3)) - { - useOriginalCheck = false; - } - - // else the releases are the same, now check the mod levels - else - { - // if the server has a newer mod level then return indicating - // an updated is needed. - if (ServerVRM.charAt(5) > ClientVRM.charAt(5)) - { - result = SERVER_HAS_NEW_RELEASE; - useOriginalCheck = false; - } - - // if the client has a newer mod level then return - // saying no update is needed. - else if (ServerVRM.charAt(5) < ClientVRM.charAt(5)) - { - useOriginalCheck = false; - } - - // note there is no else. This is the case where - // the Version, Release and first digit of the mods are - // the same. We will use the old check to see if a - // PTF is needed. - } - } - } - } - catch (Exception e) {} - - - // else we cannot find VRM info in the server and/or client - // file. Use the original check -- determine if an update is - // needed by comparing the lengths of the package files. If - // the server's file is larger assume a PTF has been applied - // to the server. - if (useOriginalCheck) - { - if (serverFile.length() > clientFile.length()) - result = SERVER_HAS_NEW_PTF; - } - - return result; -} - - -/** -Copies the file pointed to by sourceURL to targetFile. -If the target file exists, it will be replaced, not appended. - -@param targetFile The file (on the local system) in which to write the data. -@param sourceURL The location of file to copy. - -@exception IOException If an error occurs while communicating to the server. -**/ -private static void copyFile(String targetFile, URL sourceURL) - throws IOException -{ - InputStream in = sourceURL.openStream(); - - // Make sure the target directory exists. - if ((new File(targetFile)).getParent() != null) - { - File dir = new File((new File(targetFile)).getParent()); - if (!dir.exists()) - { - if (!dir.mkdirs() && !dir.isDirectory()) // @D8C - { - throw new IOException("CANNOT_CREATE_DIRECTORY"); - } - } - } - - FileOutputStream out = new FileOutputStream(targetFile); - - int n = in.read(data_); - while (n != -1) - { - out.write(data_, 0, n); - n = in.read(data_); - } - - in.close(); - out.close(); -} - - -/** -Returns the names of all the IBM Toolbox for Java packages. - -@param source The directory in which the Toolbox exists. - -@return The vector of Strings which contain the names of all the - packages in the IBM Toolbox for Java. - -@exception IOException If the package list file cannot be found. -**/ -private static Vector getAllPackageNames(String source) - throws IOException -{ - // Get contents of source package list - String packageList = readFile(new FileInputStream(source + "JT400.PKG")); - - // Loop through each of the packages in the package list. - StringTokenizer packages = new StringTokenizer(packageList); - Vector list = new Vector(); - while (packages.hasMoreTokens()) - { - list.addElement(packages.nextToken()); - } - return list; -} - - -/** -Returns the names of all the IBM Toolbox for Java packages installed -on the source. - -@param source The location of the Toolbox. - -@return The vector of Strings which contain the names of all the - packages in the IBM Toolbox for Java. - -@exception IOException If the package list file cannot be found. -**/ -private static Vector getAllPackageNames(URL source) - throws IOException -{ - // Get contents of source package list - String packageList = readFile( - new URL(source.toExternalForm() + "JT400.PKG")); - - // Loop through each of the packages in the package list. - StringTokenizer packages = new StringTokenizer(packageList); - Vector list = new Vector(); - while (packages.hasMoreTokens()) - { - list.addElement(packages.nextToken()); - } - return list; -} - - -/** -Returns the set of paths that should be added to the CLASSPATH as a -result of the latest install or uninstall operation. The returned -vector will always be empty after an uninstall. - -@return The vector of Strings which contain the paths that should be - added to the CLASSPATH - as a result of the latest install or uninstall operation. -**/ -public static Vector getClasspathAdditions() -{ - return classpathAdditions_; -} - - -/** -Returns the set of paths that should be removed from the CLASSPATH as a -result of the latest install or uninstall operation. -
    Note: -Removing directories from the classpath may cause Java programs -to fail if the directory contains code required by the Java program. -Extraneous directories in the CLASSPATH -do no harm. Therefore, you may not wish to remove any CLASSPATH -entries, or remove only directories which do not contain any Java -code. - -@return The vector of Strings which contain the paths that should be - removed from the CLASSPATH - as a result of the latest install or uninstall operation. -**/ -public static Vector getClasspathRemovals() -{ - return classpathRemovals_; -} - - - -/** -Loads the resource bundle if not already done. - -@return The resource bundle for this class. -**/ -private static ResourceBundle getMRIResource() -{ - // Initialize resource bundle if not already done. - if (resources_ == null) - resources_ = ResourceBundle.getBundle("utilities.INMRI"); - return resources_; -} - - -/** -Returns the set of files that should be expanded as a -result of the latest install or uninstall operation. -Note that not all *.zip files will be in this list. Only those files -designated to be expanded by the package will be included. The returned -vector will always be empty after an uninstall. - -@return The vector of Strings which contain the files that should be - expanded as a result of the latest install or uninstall operation. -**/ -public static Vector getUnexpandedFiles() -{ - return unexpandedFiles_; -} - - -/** -Installs/updates an IBM Toolbox for Java package. -If the package is already installed, -it will be updated if needed. This method just copies files, it will -not modify the CLASSPATH, or expand any 'zipped' files. -
    -URL sourceURL = new URL("http://myAS400/QIBM/ProdData/HTTP/Public/jt400/");
    -AS400ToolboxInstaller.install("ACCESS", "C:\\java\\", sourceURL);
    -
    - -@param packageName The package which to install. - "*ALL" can be used to install all the IBM - Toolbox for Java packages. -@param targetPath The path in which to install. The directory will be - created if it does not exist. -@param source The URL which contains the location which contains the - current package. File names will be appended - to this location, so a trailing path separator - is required. - -@return true if an install/update occurred, false if no updates were - needed. - -@exception IOException If an error occurs while communicating with the system. -**/ -public static boolean install(String packageName, - String targetPath, - URL source) - throws IOException -{ - // Verify parms - if (packageName == null) - throw new NullPointerException("packageName"); - if (targetPath == null) - throw new NullPointerException("targetPath"); - if (source == null) - throw new NullPointerException("source"); - - // If *ALL passed for the package, get list of packages - // and call self with 'real' package names. - if (packageName.equalsIgnoreCase("*ALL")) //@D5C - { - Vector packageList = getAllPackageNames(source); - boolean results = false; - Vector cpa = new Vector(); - Vector cpr = new Vector(); - Vector uf = new Vector(); - int size = packageList.size(); - for (int i=0; i 1) - { - File parent = new File(targetPath.substring(0, targetPath.length()-1)); - if (!parent.exists() || !parent.isDirectory()) - { - if (!parent.mkdirs() && !parent.isDirectory()) // @D8C - { - throw new IOException("(" + parent.toString() + ") " + - getMRIResource().getString("EXC_CANNOT_CREATE_DIRECTORY")); - } - } - } - } - - // @D1c See if an update is needed. - int updateType = comparePackageFiles(sourcePackageFile, targetPackageFile); - - // return false if no update is needed. - if (updateType == NO_CHANGE) - return false; - -// End of code that is a copy (almost) of code in isUpdateNeeded(). - - StringTokenizer sourceUpdates = new StringTokenizer(sourcePackageFile); - StringTokenizer targetUpdates = new StringTokenizer(targetPackageFile); - - // @D1a Adjust the files only if a new PTF is on the server. We need - // the entire file if the server has a new release. - - if (updateType == SERVER_HAS_NEW_PTF) - { - // Loop through each of the updates in the source package file. - // Throw away any updates that have a corresponding line in the - // target package file. The package files contain a line for - // each update. We depend on the package files being - // left alone by the user. If this is true then the only - // lines in the package files are the list of updates. The top - // section of the source and target file should match. By - // deleting lines, when the target file is emply all that remains - // in the source file is the set of updates to make. - while (targetUpdates.hasMoreTokens()) - { - sourceUpdates.nextToken(); - targetUpdates.nextToken(); - } - } - - // Process updates which have not been applied to the target. - // This combines all the updates that have not been applied to - // the target into one set of updates in order to minimize the - // amount of downloads from the remote source system. - String updateFile, update, prevUpdate, fileName, oldAction, newAction; - StringBuffer updateFileURL, workStr; - StringTokenizer updates; - Hashtable finalUpdates = new Hashtable(); - Hashtable classpathUpdates = new Hashtable(); - while (sourceUpdates.hasMoreTokens()) - { - // Read contents of source update file - updateFileURL = new StringBuffer(source.toExternalForm()); - updateFileURL.append(sourceUpdates.nextToken()); - updateFileURL.append(".LST"); - updateFile = readFile(new URL(updateFileURL.toString())); - - // Loop through lines in update file, determining - // files that need updating. - // The format of the update file is as follows: - // Column Description - // ------ ---------------- - // 1-8 Package affected - // 9 Reserved //@D4A - // 10-13 ADD, UPD, RMV, PADD, or PRMV - // 14 Reserved //@D4A - // 15 Expand file? Y or N - // 16 Classpath affected? Y or N - // 17-19 Reserved //@D4A - // 20-end File name, with possible subdirectory - updates = new StringTokenizer(updateFile, "\n\r"); - while (updates.hasMoreTokens()) - { - update = updates.nextToken(); - // Determine if this line affects our package. - String str = update.substring(0,8).trim(); - if (str.equalsIgnoreCase(packageName)) //@D5C - { - newAction = update.substring(9, 13); - - if (update.length() > 19) //@D4A - { //@D4A - // get file name - fileName = update.substring(19); - } else //@D4A - fileName = ""; //@D4A - - // if we are dealing with a class path action... - if (newAction.equalsIgnoreCase("PADD") || newAction.equalsIgnoreCase("PRMV")) //@D5C - { - // We don't need to check the hashtable to check - // if the classpath is already contained in it - // since we always want the latest action to - // be the action that we take. - // This will set the action as follows: - // Old action New action Final action - // PADD PADD PADD - // PADD PRMV PRMV - // PRMV PADD PADD - // PRMV PRMV PRMV - if (fileName.length() > 0) //@D4A - { //@D4A - // add to set of classpath updates - classpathUpdates.put(fileName, update); - } //@D4A - } - // else we are dealing with a file action - else - { - // Determine if this file is already in the set of updates. - prevUpdate = (String)finalUpdates.get(fileName); - if (prevUpdate != null) - { - // Determine if we want to change the action. - // This set of code will set the action as follows: - // Old action New action Final action - // ADD ADD ADD - // ADD RMV RMV - // ADD UPD ADD - // RMV ADD UPD - // RMV RMV RMV - // RMV UPD UPD - // UPD ADD UPD - // UPD RMV RMV - // UPD UPD UPD - oldAction = prevUpdate.substring(9, 13); - // if new action is RMV, change to RMV - if (newAction.equalsIgnoreCase("RMV ")) //@D5C - { - finalUpdates.put(fileName, update); - } - // if old action is ADD, leave as is - else if (oldAction.equalsIgnoreCase("ADD ")) //@D5C - {} - // if new action is ADD... - else if (newAction.equalsIgnoreCase("ADD ")) //@D5C - { - // change action to update - workStr = new StringBuffer(update); - workStr.setCharAt(9, 'U'); - workStr.setCharAt(10, 'P'); - workStr.setCharAt(11, 'D'); - workStr.setCharAt(12, ' '); - finalUpdates.put(fileName, workStr.toString()); - } - // otherwise take the new action - else - { - finalUpdates.put(fileName, update); - } - } - else - { - // add file to set of updates - finalUpdates.put(fileName, update); - } - } - } - } - } - - - // Copy the package list control file to the target. - // Do this first, so an uninstall(*ALL) can be done if the install - // bombs midstream. - copyFile(targetPath.toString() + "JT400.PKG", - new URL(source.toExternalForm() + "JT400.PKG")); - - // Copy the package file list control file to the target. - // Do this first, so an uninstall can be done if the install bombs - // midstream. - copyFile(targetPath.toString() + packageName + ".LST", - new URL(source.toExternalForm() + packageName + ".LST")); - - // Make needed updates to the files on the target. - String temp; - for (Enumeration e = finalUpdates.elements(); e.hasMoreElements();) - { - update = (String)e.nextElement(); - fileName = update.substring(19); - // remove the file if action is RMV - String urlFile = fileName; // save filename with forward slashes - if (changeSlash_) // change slashes if needed - fileName = fileName.replace('/', '\\'); - if (update.substring(9, 13).equalsIgnoreCase("RMV ")) //@D5C - { - try - { - File file = new File(targetPath.toString() + fileName); - file.delete(); - } - catch(Exception ex) {} // don't worry if can't delete file - // Note that the expand flag is ignored for the RMV action. - // Check if classpath should be updated. - if (update.charAt(15) == 'Y') // remove file from CP - { - // See if it is contained in the classpath - temp = targetPath.toString() + fileName; - temp = (new File(temp)).getAbsolutePath(); - if (classpathContains(temp)!=NOT_IN_CLASSPATH) - classpathRemovals_.addElement(temp); - } - } - else - if ((update.substring(9, 13).equalsIgnoreCase("ADD ")) //@D5A - || (update.substring(9, 13).equalsIgnoreCase("UPD ")) //@D5A - || (update.substring(9, 13).equalsIgnoreCase("OADD"))) //@D5A - { - // copy the file - boolean miaFile = false; - try - { - copyFile(targetPath.toString() + fileName, - new URL(source.toExternalForm() + urlFile)); - } - catch (IOException ex) - { // assume error is file not found, which is OK if - // this is a .properties or an optional (OADD) file //@D5C - if ((update.substring(9, 13).equalsIgnoreCase("OADD")) //@D5A - || ((fileName.length() > 11 - && fileName.substring(fileName.length() - 11).equalsIgnoreCase(".properties")))) //@D5C - { - miaFile = true; // mark file as missing so not added to Vectors - } else // otherwise this is a problem, rethrow the error - { - throw ex; - } - } - - // Only add file to unexpanded vector if it existed. - if (!miaFile) - { - // Check if file needs to be expanded. - if (update.charAt(14) == 'Y') - { - temp = targetPath.toString() + fileName; - temp = (new File(temp)).getAbsolutePath(); - unexpandedFiles_.addElement(temp); - } - // For ADDs, check if classpath should be updated. - if ((update.substring(9, 13).equalsIgnoreCase("ADD ")) || //@D5C - (update.substring(9, 13).equalsIgnoreCase("OADD"))) //@D7a - { - if (update.charAt(15) == 'Y') // add file to CP - { - // See if it is contained in the classpath - temp = targetPath.toString() + fileName; - temp = (new File(temp)).getAbsolutePath(); - if (classpathContains(temp)!=IN_CLASSPATH) - classpathAdditions_.addElement(temp); - } - } - } - } else - { - // we don't recognize this tag. - } - } - - // Make needed updates to the classpath arrays. - for (Enumeration e = classpathUpdates.elements(); e.hasMoreElements();) - { - update = (String)e.nextElement(); - - if (update.length() > 19) //@D4A - { //@D4A - // get file name - fileName = update.substring(19); - } else //@D4A - fileName = ""; //@D4A - - fileName = update.substring(19).trim(); - if (changeSlash_) // change slashes if needed - fileName = fileName.replace('/', '\\'); - // get full path name - if (fileName.length() > 0) - { - temp = targetPath.toString() + fileName; - temp = (new File(temp)).getAbsolutePath(); - } else // no path, need to add target directory to classpath - { - if (targetPath.length() > 1) - { - temp = targetPath.substring(0,targetPath.length()-1); - } else - { - temp = ""; - } - temp = (new File(temp)).getAbsolutePath(); - } - // If this is a classpath addition - if (update.substring(9, 13).equalsIgnoreCase("PADD")) //@D5C - { - // See if it is contained in the classpath - if (classpathContains(temp)!=IN_CLASSPATH) - classpathAdditions_.addElement(temp); - } - // else is a classpath removal - else - { - // See if it is contained in the classpath - if (classpathContains(temp)!=NOT_IN_CLASSPATH) - classpathRemovals_.addElement(temp); - } - } - - // Copy the source package file to the target. - // Do this last, after all other updates have been successful, - // so if there is an error midstream, another update can be - // attempted. - FileOutputStream out = new FileOutputStream( - targetPackageFileName.toString() ); - int numBytes; - int position = 0; -/* while (position < sourcePackageFile.length()) - { - numBytes = - (data_.length < sourcePackageFile.length() - position ? - data_.length : - sourcePackageFile.length() - position); - sourcePackageFile.getBytes(position, position+numBytes, data_, 0); - out.write(data_, 0, numBytes); - position += numBytes; - } -replaced with following 2 lines */ - byte[] data = sourcePackageFile.getBytes(); - out.write(data, 0, data.length); - out.close(); - - return true; -} - - -/** -Indicates if the package is installed. Installation is determined -by examining the target directory for the *.LVL file. This method -does not check for a partial installation, if installation is -incomplete, this method may return true or false. -
    -AS400ToolboxInstaller.isInstalled("ACCESS", "C:\\java\\");
    -
    - -@param packageName The package which will be checked. - Note that *ALL is not supported. -@param targetPath The path in which the package is installed. - -@return true if the package has been installed, false if the - package has not been installed. -**/ -public static boolean isInstalled(String packageName, - String targetPath) -{ - // Verify parms - if (packageName == null) - throw new NullPointerException("packageName"); - if (targetPath == null) - throw new NullPointerException("targetPath"); - - // Make sure the target path has a trailing separator. - targetPath = addTrailingSeparator(targetPath); - - // Look for the .LVL file in the target directory. - // If it is there, return true, if not, return false. - StringBuffer filename = new StringBuffer(targetPath); - filename.append(packageName); - filename.append(".LVL"); - File file = new File(filename.toString()); - if (file.exists()) - return true; - return false; -} - - -/** -Returns whether the package is downlevel. This method will return -true if the package is not installed. -
    -URL sourceURL = new URL("http://myAS400/QIBM/ProdData/HTTP/Public/jt400/");
    -AS400ToolboxInstaller.isUpdateNeeded("ACCESS", "C:\\java\\", sourceURL);
    -
    - -@param packageName The package which will be checked. - "*ALL" can be used to check all the IBM - Toolbox for Java packages. -@param targetPath The path in which the package is installed. -@param source The URL which contains the location which contains the - current package. File names will be appended - to this location, so a trailing path separator - is required. - -@return true if an update is needed, false if no updates are - needed. - -@exception IOException If an error occurs while communicating with the system. -**/ -public static boolean isUpdateNeeded(String packageName, - String targetPath, - URL source) - throws IOException -{ - // Verify parms - if (packageName == null) - throw new NullPointerException("packageName"); - if (targetPath == null) - throw new NullPointerException("targetPath"); - if (source == null) - throw new NullPointerException("source"); - - // If *ALL passed for the package, get list of packages - // and call self with 'real' package names. - if (packageName.equalsIgnoreCase("*ALL")) //@D5C - { - Vector packageList = getAllPackageNames(source); - int size = packageList.size(); - for (int i=0; i= 0) - { - StringBuffer buffer = new StringBuffer(); - buffer.append(result.substring(0, j)); - buffer.append(value); - buffer.append(result.substring(j + variable.length ())); - result = buffer.toString (); - } - return result; -} - -/** -Returns the contents of the file. - -@param file The file to read. - -@return The contents of the file - -@exception IOException If an error occurs while communicating with the server. -**/ -private static String readFile(FileInputStream file) - throws IOException -{ - StringBuffer s = new StringBuffer(); - int n = file.read(data_); - while (n != -1) - { - s.append(new String(data_, 0, n)); - n = file.read(data_); - } - file.close(); - return s.toString(); -} - - -/** -Returns the contents of the file located at the URL url. - -@param url The URL of the file to read. - -@return The contents of the file - -@exception IOException If an error occurs while communicating with the server. -**/ -private static String readFile(URL url) - throws IOException -{ - InputStream in = url.openStream(); - StringBuffer s = new StringBuffer(); - int n = in.read(data_); - while ( n!= -1) - { - s.append(new String(data_, 0, n)); - n = in.read(data_); - } - in.close(); - return s.toString(); -} - - -/** -Removes a package from the target. This method deletes all the files -in the package, and deletes directories if they are empty. -It does not modify the CLASSPATH. -
    -AS400ToolboxInstaller.unInstall("ACCESS", "C:\\java\\");
    -
    - -@param packageName The package to remove. - "*ALL" can be used to remove all the IBM - Toolbox for Java packages. -@param targetPath The path from which to remove the package. - -@return The vector of Strings which contain the names (including path) of - files and directories which exist but could not be deleted. - -@exception IOException If the package is not installed. -**/ -// Note that if packages are removed individually, the JT400.PKG file -// will never be deleted from the client. This file is only deleted -// when *ALL is specified for the package name. -public static Vector unInstall(String packageName, - String targetPath) - throws IOException -{ - // Verify parms - if (packageName == null) - throw new NullPointerException("packageName"); - if (targetPath == null) - throw new NullPointerException("targetPath"); - - // Make sure the target path has a trailing separator. - targetPath = addTrailingSeparator(targetPath); - - // If *ALL passed for the package, get list of packages - // and call self with 'real' package names. - if (packageName.equalsIgnoreCase("*ALL")) //@D5C - { - Vector packageList; - try { - packageList = getAllPackageNames(targetPath); - } - catch (FileNotFoundException e) - { - throw new IOException( - getMRIResource().getString("EXC_NO_PACKAGES_INSTALLED")); - } - boolean packageFound = false; // was any package installed - Vector results = new Vector(); - Vector tempResults = new Vector(); - Vector cpr = new Vector(); - int size = packageList.size(); - for (int i=0; i 1) - { - file = new File(targetPath.substring(0,targetPath.length()-1)); - file.delete(); - } - return results; - } - - // Initialize - classpathAdditions_.removeAllElements(); - classpathRemovals_.removeAllElements(); - unexpandedFiles_.removeAllElements(); - Vector errors = new Vector(); - - // Get contents of package file list file. An exception will - // be thrown if the file does not exist. - StringBuffer listFileName = new StringBuffer(targetPath); - listFileName.append(packageName); - listFileName.append(".LST"); - String listFile = ""; - try { - listFile = readFile(new FileInputStream(listFileName.toString())); - } - catch(IOException e) - { - throw new IOException("(" + packageName + ") " + - getMRIResource().getString("EXC_PACKAGE_NOT_INSTALLED")); - } - - // Delete the package change list file if it exists. - // Do this first, in case the uninstall bombs midstream, user - // can recover by reinstalling. - File file = new File(targetPath + packageName + ".LVL"); - if (file.exists()) - { - if (!file.delete()) - errors.addElement(file.getAbsolutePath()); - } - - // Loop through lines in the list file, deleting files. - StringTokenizer deletes = new StringTokenizer(listFile, "\n\r"); - String name, type, temp; - Vector paths = new Vector(); // keep track of directories - while (deletes.hasMoreTokens()) - { - name = deletes.nextToken(); - if (changeSlash_) - name = name.replace('/', '\\'); - file = new File(targetPath + name); - if (file.exists()) // don't want to fail if file doesn't exist - { - if (!file.delete()) - errors.addElement(file.getAbsolutePath()); - } - // Add any zip or jar files to the classpath removal list - // if they are in the classpath, and not already in the list. - type = name.substring(name.lastIndexOf('.')+1).toUpperCase(); - temp = (new File(targetPath + name)).getAbsolutePath(); - if ((type.equalsIgnoreCase("JAR") || type.equalsIgnoreCase("ZIP")) && //@D5C - classpathContains(temp)!=NOT_IN_CLASSPATH && - !classpathRemovals_.contains(temp)) - classpathRemovals_.addElement(temp); - // Keep track of the subdirectories so they can be deleted - // and added to classpath removals. - temp = file.getParent(); - if (temp != null) - { - if (!paths.contains(temp)) - paths.addElement(temp); - } - } - - // Add targetpath to the classpath removal list, - // without trailing delimiter, if in the classpath, - // and not already in list. - if (targetPath.length() > 1) - { - temp = targetPath.substring(0,targetPath.length()-1); - temp = (new File(temp)).getAbsolutePath(); - if (classpathContains(temp)!=NOT_IN_CLASSPATH && - !classpathRemovals_.contains(temp)) - classpathRemovals_.addElement(temp); - } - - // Delete the package file list file itself. - // Do this last, only if there are no errors, so uninstall can - // be attempted again if we only partially uninstalled. - if (errors.size() == 0) - { - file = new File(listFileName.toString()); - if (!file.delete()) - errors.addElement(file.getAbsolutePath()); - } - - // Delete all subdirectories of the target path. - // Note a delete will fail if the directory is not empty. - // Add subdirectories to the classpath removals if in - // the classpath, and not already in the list. - int size = paths.size(); - String dir; - if (targetPath.length() > 1) - temp = targetPath.substring(0,targetPath.length()-1); - else - temp = ""; - - for (int j=0; j 1) - { - file = new File(targetPath.substring(0,targetPath.length()-1)); - file.delete(); - } - - return errors; -} - - -} // end class AS400ToolboxInstaller diff --git a/cvsroot/src/utilities/AS400ToolboxJarMaker.java b/cvsroot/src/utilities/AS400ToolboxJarMaker.java deleted file mode 100644 index 625fe80a2..000000000 --- a/cvsroot/src/utilities/AS400ToolboxJarMaker.java +++ /dev/null @@ -1,696 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AS400ToolboxJarMaker.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package utilities; - -import java.io.File; -import java.io.IOException; -import java.io.PrintStream; -import java.util.Enumeration; -import java.util.StringTokenizer; -import java.util.Vector; -import java.util.Arrays; - - -/** -The AS400ToolboxJarMaker class is used to generate a smaller -JAR or ZIP file from the shipped IBM Toolbox for Java -JAR or ZIP file, based on the user's requirements. -

    -In addition, AS400ToolboxJarMaker can also be used to: -

      -
    • extract desired files from a JAR or ZIP file; or -
    • split a JAR or ZIP file into smaller JAR or ZIP files. -
    -

    -An AS400ToolboxJarMaker object can be included in the user's program, -or AS400ToolboxJarMaker can be run as a command line program, as follows: -

    -
    -java utilities.AS400ToolboxJarMaker [ options ]
    -
    -
    -AS400ToolboxJarMaker extends the functionality of JarMaker by -additionally allowing the user to specify one or more -IBM Toolbox for Java components, -languages, and/or CCSIDs, and whether or not to include -Java Beans files that are associated with the specified components. - -

    -Options - -

    -

    -
    -source sourceJarFile -
    -Specifies the source JAR or ZIP file from which to derive -the destination JAR or ZIP file. The source file is expected to contain the IBM Toolbox for Java product, and is typically named jt400.jar. -To process a JAR or ZIP other than the Toolbox, use {@link JarMaker JarMaker}. -If a relative path is specified, the path is assumed to be relative to -the current directory. -If this option is specified as the first positional argument, -the tag (-source) is optional. -The -source option may be abbreviated to -s. -The default is jt400.jar, in the current directory. - -

    -

    -destination destinationJarFile -
    -Specifies the destination JAR or ZIP file, which will contain -the desired subset of the files in the source JAR or ZIP file. -If a pathname is not specified, the file is created in the current directory. -The -destination option may be abbreviated to -d. -The default name is generated by appending "Small" to the -source file name. For example, if the source file is jt400.jar, -then the default destination file would be jt400Small.jar. - -

    -

    -fileRequired jarEntry1[,jarEntry2[...] ] -
    -The files in the source JAR or ZIP file that are to be copied to the destination. -Entries are separated by commas (no spaces). -The specified files, along with all of their dependencies, -will be considered required. -Files are specified in JAR entry name syntax, such as com/ibm/as400/access/DataQueue.class. -The -fileRequired option may be abbreviated to -fr. - -

    -

    -fileExcluded jarEntry1[,jarEntry2[...] ] -
    -The files in the source JAR or ZIP file that are to be excluded from the destination, -and from dependency analysis. -Entries are separated by commas (no spaces). -Files are specified in JAR entry name syntax, such as com/ibm/as400/access/DataQueue.class. -The -fileExcluded option may be abbreviated to -fx. - -

    -

    -additionalFile file1[,file2[...] ] -
    -Specifies additional files (not included in the source jar) which are -to be copied to the destination. -Entries are separated by commas (no spaces). -Files are specified by either their -absolute path, or their path relative to the current directory. -
    The specified files will be included, regardless of the settings of -other options. -The -additionalFile option may be abbreviated to -af. - -

    -

    -additionalFilesDirectory baseDirectory -
    -Specifies the base directory for additional files. -This should be the parent directory of the -directory where the package path starts. For example, if file foo.class -in package com.ibm.mypackage is located in directory -C:\dir1\subdir2\com\ibm\mypackage\, then specify base directory C:\dir1\subdir2. -
    The -additionalFilesDirectory option may be abbreviated to -afd. -The default is the current directory. - -

    -

    -package package1[,package2[...] ] -
    -The packages that are required. -Entries are separated by commas (no spaces). -The -package option may be abbreviated to -p. -Package names are specified in standard syntax, such as com.ibm.component. -
    Note: The specified packages are simply included in the output. -No additional dependency analysis is done on the files in a package, -unless they are explicitly specified as required files. - -

    -

    -packageExcluded package1[,package2[...] ] -
    -The packages that are to be excluded. -Entries are separated by commas (no spaces). -The -packageExcluded option may be abbreviated to -px. -Package names are specified in standard syntax, such as com.ibm.component. - -

    -

    -extract [baseDirectory] -
    -Extracts the desired entries of the source JAR into the specified base directory, -without generating a new JAR or ZIP file. This option enables the -user to build up a customized JAR or ZIP file empirically, -based on the requirements of their particular application. -When this option is specified, -additionalFile, --additionalFilesDirectory, and -destination -are ignored. -The -extract option may be abbreviated to -x. -By default, no extraction is done. -The default base directory is the current directory. - -

    -

    -split [splitSize] -
    -Splits the source JAR or ZIP file into smaller JAR or ZIP files. -No ZIP entries are added or removed; -the entries in the source JAR or ZIP file are simply distributed -among the destination JAR or ZIP files. -The split size is in units of kilobytes (1024 bytes), -and specifies the maximum size for the destination files. -The destination files are created in the current directory, -and are named by appending integers to the source file name; -any existing files by the same name are overwritten. -For example, if the source JAR file is myfile.jar, -then the destination JAR files would be -myfile0.jar, myfile1.jar, and so on. -When this option is specified, all other options except --source and -verbose are ignored. -The -split option may be abbreviated to -sp. -The default split size is 2 megabytes (2048 kilobytes). - -

    -

    -component componentID1[,componentID2[...] ] -
    -The IBM Toolbox for Java components that are required. -Entries are separated by commas (no spaces), and are case insensitive. -The -component option may be abbreviated to -c. -
    -See the list of components -that are supported by IBM Toolbox for Java. - -

    -

    -beans -
    -Causes inclusion of all Java Beans files (classes, gifs) that are -directly associated with the specified components. -This option is valid only if -component is also specified. -The -beans option may be abbreviated to -b. -The default is no Beans. - -

    -

    -language language1[,language2[...]] -
    -Specifies the desired languages for the messages produced by the Toolbox classes. -Entries are separated by commas (no spaces). -The languages are identified by their Java locale name, such as fr_CA -(for Canadian French). -
    Note: The shipped jt400.jar file contains only English messages. -The -language option may be abbreviated to -l. -By default, only English messages are included. - -

    -

    -languageDirectory baseDirectory -
    -Specifies the base directory for additional Toolbox language files. -The path below this directory should correspond to the package name -the language files. -For example, if the desired MRI files are located in directories -/usr/myDir/com/ibm/as400/access/ and -/usr/myDir/com/ibm/as400/vaccess/, -then the base directory should be set to /usr/myDir. -
    The -languageDirectory option may be abbreviated to -ld. -By default, language files are searched for relative to the -current directory. - -

    -

    -ccsid ccsid1[,ccsid2[...]] -
    -Specifies the CCSIDs whose conversion tables should be included. -Conversion tables for other CCSIDs will not be included. -Entries are separated by commas (no spaces). -The -ccsid option may be abbreviated to -cc. -By default, all CCSIDs are included. -See the list of CCSIDs and encodings -that are specifically supported by IBM Toolbox for Java. - -

    -

    -ccsidExcluded ccsid1[,ccsid2[...]] -
    -Specifies the CCSIDs whose conversion tables should not be included. -Entries are separated by commas (no spaces). If a CCSID is specified on -both the -ccsid and -ccsidExcluded, it is included, -and a warning message is sent to System.err. -The -ccsidExcluded option may be abbreviated to -cx or -ccx. -By default, all CCSIDs are included. -See the list of CCSIDs and encodings -that are specifically supported by IBM Toolbox for Java. - -

    -

    -excludeSomeDependencies -
    -Indicates that AS400ToolboxJarMaker is allowed to selectively limit -dependency expansion, and exclude certain classes, components and packages -that are unlikely to be needed. -By default, this option is not in effect; that is, all directly- and -indirectly-referenced files in the source JAR file are included. - -

    -

    -noProxy -
    -Specifies that proxy-related class files should not be included. -Proxy files are used internally by the Toolbox's Proxy Service. -If the Proxy Service will not be used, the proxy files are not needed. -The -noProxy option may be abbreviated to -np. -By default, proxy files in the source JAR file are included. - -

    -

    -verbose -
    -Causes progress messages to be displayed. -The -verbose option may be abbreviated to -v. -The default is non-verbose. - -

    -

    -help -
    -Displays the help text. -The -help option may be abbreviated to -h. -The default is non-verbose. - -
    - -

    -At least one of the following options must be specified: -

      -
    • -fileRequired -
    • -fileExcluded -
    • -additionalFile -
    • -package -
    • -packageExcluded -
    • -extract -
    • -split -
    • -component -
    • -language -
    • -ccsid -
    • -ccsidExcluded -
    • -noProxy -
    • -excludeSomeDependencies -
    - -

    -If the following options are specified multiple times in a single command -string, only the final specification applies: -

      -
    • -source -
    • -destination -
    • -additionalFilesDirectory -
    • -extract -
    • -split -
    • -languageDirectory -
    -Other options have a cumulative effect when specified multiple times -in a single command string. - -

    -Example usage -

    -

    -To create a JAR file that contains only those files needed -by the CommandCall and ProgramCall components, -do the following: -

      -
    1. Go to the directory where the jt400.jar file is located. -
    2. Type: -
      -java utilities.AS400ToolboxJarMaker -component CommandCall,ProgramCall
      -
      -
    3. Save a copy of the original jt400.jar for future reference. -
    4. Rename jt400Small.jar to jt400.jar. -
    -

    -To extract from jt400.jar only those files needed -by class com.ibm.as400.access.JDSQLStatement, -using the current directory as the base directory for output, do the following: -

    -java utilities.AS400ToolboxJarMaker -extract -s jt400.jar
    -     -fr com/ibm/as400/access/JDSQLStatement.class
    -
    -Any additional files could then be manually copied into appropriate locations -in the directory tree, and a customized JAR file could be generated using the -jar tool provided as part of the JDK. - - - -@deprecated Use {@link ToolboxJarMaker ToolboxJarMaker} instead. -**/ - -// Design notes -/* -Assumptions: - -This tool will be used only by programmers -and administrators for whom English messages are acceptable. -Hence, no translated MRI is provided with this tool. - -This tool will be used on JDK 1.1 or later. -When we move to JDK 1.2, the implementation of this tool can take -advantage of the utilities in the new java.util.jar package. - -The manifest will be altered based on the list of functions the user specifies. - -We need to generate and put our own Javadoc for this tool. The build process does -not run Javadoc twice because the 'extra' output files (index, table of contents, ...) -would get overlayed. It is easier to run javadoc locally then just put the output file. -(As an alternative in this release, we could ask the builders if they could generate -this javadoc at the same time as our access and vaccess stuff.) - -We are going to include only run-time gifs. Compile time gifs needed by visual builders -will not be put in the JAR unless explicitly specified. -*/ - -// * On-going TBDs: -// * Implementation: Add new components as they are added to Toolbox. -// -// * Implementation: Add new language MRI suffixes as they are supported. -// -// * Implementation: When we move to JDK 1.2, -// we can take advantage of the java.util.jar support. -// - -public class AS400ToolboxJarMaker extends ToolboxJarMaker -{ - private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others."; - - - // Constants. - - // Note: The following list must be kept in sync with VALID_COMPONENTS. - - /** Constant for specifying the AS400 component. **/ - public static final Integer AS400 = ToolboxJarMaker.AS400; - /** Constant for specifying the Command Call component. **/ - public static final Integer COMMAND_CALL = ToolboxJarMaker.COMMAND_CALL; - /** Constant for specifying the Data Area component. **/ - public static final Integer DATA_AREA = ToolboxJarMaker.DATA_AREA; - /** Constant for specifying the Data Description component. **/ - public static final Integer DATA_DESCRIPTION = ToolboxJarMaker.DATA_DESCRIPTION; - /** Constant for specifying the Data Queue component. **/ - public static final Integer DATA_QUEUE = ToolboxJarMaker.DATA_QUEUE; - /** Constant for specifying the Digital Certificate component. **/ - public static final Integer DIGITAL_CERTIFICATE = ToolboxJarMaker.DIGITAL_CERTIFICATE; - /** Constant for specifying the FTP component. **/ - public static final Integer FTP = ToolboxJarMaker.FTP; - /** Constant for specifying the Integrated File System component. **/ - public static final Integer INTEGRATED_FILE_SYSTEM = ToolboxJarMaker.INTEGRATED_FILE_SYSTEM; - /** Constant for specifying the JAAS component. **/ - public static final Integer JAAS = ToolboxJarMaker.JAAS; - /** Constant for specifying the Java Application Call component. **/ - public static final Integer JAVA_APPLICATION_CALL = ToolboxJarMaker.JAVA_APPLICATION_CALL; - /** Constant for specifying the JDBC component. **/ - public static final Integer JDBC = ToolboxJarMaker.JDBC; - /** Constant for specifying the Job component. **/ - public static final Integer JOB = ToolboxJarMaker.JOB; - /** Constant for specifying the Message Queue component. **/ - public static final Integer MESSAGE = ToolboxJarMaker.MESSAGE; - /** Constant for specifying the Numeric Data Types component. **/ - public static final Integer NUMERIC_DATA_TYPES = ToolboxJarMaker.NUMERIC_DATA_TYPES; - /** Constant for specifying the Network Print component. **/ - public static final Integer PRINT = ToolboxJarMaker.PRINT; - /** Constant for specifying the Program Call component. **/ - public static final Integer PROGRAM_CALL = ToolboxJarMaker.PROGRAM_CALL; - /** Constant for specifying the Record Level Access component. **/ - public static final Integer RECORD_LEVEL_ACCESS = ToolboxJarMaker.RECORD_LEVEL_ACCESS; - /** Constant for specifying the Secure AS400 component. - This component performs SSL (Secure Sockets Layer) processing. **/ - public static final Integer SECURE_AS400 = ToolboxJarMaker.SECURE_AS400; - /** Constant for specifying the Service Program Call component. **/ - public static final Integer SERVICE_PROGRAM_CALL = ToolboxJarMaker.SERVICE_PROGRAM_CALL; - /** Constant for specifying the System Status component. **/ - public static final Integer SYSTEM_STATUS = ToolboxJarMaker.SYSTEM_STATUS; - /** Constant for specifying the System Value component. **/ - public static final Integer SYSTEM_VALUE = ToolboxJarMaker.SYSTEM_VALUE; - /** Constant for specifying the Trace component. **/ - public static final Integer TRACE = ToolboxJarMaker.TRACE; - /** Constant for specifying the User component. **/ - public static final Integer USER = ToolboxJarMaker.USER; - /** Constant for specifying the User Space component. **/ - public static final Integer USER_SPACE = ToolboxJarMaker.USER_SPACE; - /** Constant for specifying the Visual AS400 component. **/ - public static final Integer AS400_VISUAL = ToolboxJarMaker.AS400_VISUAL; - /** Constant for specifying the Visual Command Call component. **/ - public static final Integer COMMAND_CALL_VISUAL = ToolboxJarMaker.COMMAND_CALL_VISUAL; - /** Constant for specifying the Visual Data Queue component. **/ - public static final Integer DATA_QUEUE_VISUAL = ToolboxJarMaker.DATA_QUEUE_VISUAL; - /** Constant for specifying the Visual Integrated File System component. **/ - public static final Integer INTEGRATED_FILE_SYSTEM_VISUAL = ToolboxJarMaker.INTEGRATED_FILE_SYSTEM_VISUAL; - /** Constant for specifying the Visual Java Application Call component. **/ - public static final Integer JAVA_APPLICATION_CALL_VISUAL = ToolboxJarMaker.JAVA_APPLICATION_CALL_VISUAL; - /** Constant for specifying the Visual JDBC component. **/ - public static final Integer JDBC_VISUAL = ToolboxJarMaker.JDBC_VISUAL; // and Visual SQL - /** Constant for specifying the Visual Job component. **/ - public static final Integer JOB_VISUAL = ToolboxJarMaker.JOB_VISUAL; - /** Constant for specifying the Visual Message Queue component. **/ - public static final Integer MESSAGE_VISUAL = ToolboxJarMaker.MESSAGE_VISUAL; - /** Constant for specifying the Visual Network Print component. **/ - public static final Integer PRINT_VISUAL = ToolboxJarMaker.PRINT_VISUAL; - /** Constant for specifying the Visual Program Call component. **/ - public static final Integer PROGRAM_CALL_VISUAL = ToolboxJarMaker.PROGRAM_CALL_VISUAL; - /** Constant for specifying the Visual Record Level Access component. **/ - public static final Integer RECORD_LEVEL_ACCESS_VISUAL = ToolboxJarMaker.RECORD_LEVEL_ACCESS_VISUAL; - /** Constant for specifying the Visual User component. **/ - public static final Integer USER_VISUAL = ToolboxJarMaker.USER_VISUAL; - /** Constant for specifying the Connection Pool component. **/ - public static final Integer CONNECTION_POOL = ToolboxJarMaker.CONNECTION_POOL; // @A2a - /** Constant for specifying the NetServer component. **/ - public static final Integer NETSERVER = ToolboxJarMaker.NETSERVER; // @A3a - - - - - /** - Constructs an AS400ToolboxJarMaker object. - **/ - public AS400ToolboxJarMaker() - { - } - - - /** - Returns the CCSIDs explicitly to be included. - - @return The CCSIDs explicitly to be included. - The list will be empty if none has been specified. - The list will contain only Integer objects. - **/ - public Vector getCCSIDs() { return super.getCCSIDs(); } - - - /** - Returns CCSIDs to be excluded. - - @return The CCSIDs to be excluded. - The list will be empty if none has been specified. - The list will contain only Integer objects. - **/ - public Vector getCCSIDsExcluded() { return super.getCCSIDsExcluded(); } - - - /** - Returns the required components specified by the user. - - @return The components specified by the user. - The list will be empty if none has been specified. - The list will contain only Integer objects. - See component list for - a list of integer values and associated components. - **/ - public Vector getComponents() { return super.getComponents(); } - - - /** - Returns the base directory under which the Toolbox language files - will be searched for. - This value is set by setLanguageDirectory(). - @return The base directory for the language files. - **/ - public File getLanguageDirectory() { return super.getLanguageDirectory(); } - - - /** - Returns the national languages that explicitly are to be supported. - The languages are identified by their Java locale name, such as fr_CA - (for Canadian French). - Note: Locale en is always implicitly supported. - - @return The national languages that explicitly are to be supported. - The list will be empty if none has been specified. - The list will contain only String objects. - **/ - public Vector getLanguages() { return super.getLanguages(); } - - - - /** - Resets the AS400ToolboxJarMaker object to a clean, default state, - to facilitate object reuse. - **/ - public void reset() - { - super.reset(); - } - - - /** - Specifies the CCSIDs explicitly to be included. - The conversion tables for only these CCSIDs (and CCSIDs - specified in any prior invocations) will be included in the output. - Conversion tables for other CCSIDs will not be included. -
    Note: This augments any previously specified CCSIDs. - This method does not verify the existence of the specified CCSIDs. - - @param ccsidList The CCSIDs explicitly to be included. - The list should contain only Integer objects. - See CCSIDs and encodings - for valid values. - **/ - public void setCCSIDs(Vector ccsidList) - { - super.setCCSIDs(ccsidList); - } - - /** - Specifies CCSIDs to be excluded. - The conversion tables for these CCSIDs will not be included in the output. -
    Note: This augments any previously specified CCSIDs. - This method does not verify the existence of the specified CCSIDs. - - @param ccsidList The CCSIDs to be excluded. - The list should contain only Integer objects. - **/ - public void setCCSIDsExcluded(Vector ccsidList) - { - super.setCCSIDsExcluded(ccsidList); - } - - - /** - Specifies required IBM Toolbox for Java components. - Java Beans files associated with the components are not - automatically included. -
    Note: This augments any previously specified components. - If an unrecognized component is specified, a warning message is - sent to System.err, and the component is ignored. - - @param components The required components. - The list should contain only Integer objects. - See component list for valid values. - **/ - public void setComponents(Vector components) - { - super.setComponents(components); - } - - - /** - Specifies required IBM Toolbox for Java components. -
    Note: This augments any previously specified components. - If an unrecognized component is specified, a warning message is - sent to System.err, and the component is ignored. - - @param components The required components. - The list should contain only Integer objects. - See component list for valid values. - @param includeBeans Whether or not Java Beans files associated - with the components are to be included. - **/ - public void setComponents(Vector components, boolean includeBeans) - { - super.setComponents(components, includeBeans); - } - - - /** - Specifies the base directory for additional Toolbox language files. - The path below this directory should correspond to the package name - the language files. -
    - For example, if the MRI files are located in directories - /usr/myDir/com/ibm/as400/access and - /usr/myDir/com/ibm/as400/vaccess, - then the base directory should be set to /usr/myDir. -
    This method does not verify the existence of the specified directory. -
    The default language directory is the current directory. - - @param baseDirectory The base directory for the language files. - **/ - public void setLanguageDirectory(File baseDirectory) - { - super.setLanguageDirectory(baseDirectory); - } - - - /** - Specifies national languages that explicitly are to be supported. - Languages are identified by their Java locale name, such as - fr_CA. - The language files for the specified languages will be searched for - in the directory tree specified by setLanguageDirectory, - or, if no directory has been specified, in the directory tree - under the current directory. -
    Note: This augments any previously specified languages. - This method does not verify the existence of files for the specified - languages. - Locale en is always implicitly supported. - If an unrecognized language is specified, a warning message is - sent to System.err, and the language is ignored. - - @param languages The languages to be supported. - The list should contain only String objects. - **/ - public void setLanguages(Vector languages) - { - super.setLanguages(languages); - } - - - /** - Specifies whether proxy-only files are to be excluded. - Proxy files are needed only if the Toolbox's Proxy Service - will be used. - By default, all proxy files in the source JAR file are included. - - @param excludeProxies Whether or not proxy-only files - are to be excluded. - **/ - public void setProxyFilesExcluded(boolean excludeProxies) - { - super.setProxyFilesExcluded(excludeProxies); - } - - - // @A4a - /** - Specifies whether AS400ToolboxJarMaker is allowed to selectively limit - dependency expansion, and exclude certain components and packages - that are unlikely to be needed. - By default, this option is not in effect; that is, all directly- and - indirectly-referenced files in the source JAR file are included. - Examples of files that may be excluded from the output: -
      -
    • JDBC classes, if component {@link #JDBC JDBC} has not been specified -
    • class {@link com.ibm.as400.resource.RJob RJob}, if neither component {@link com.ibm.as400.access.Job Job} nor package com.ibm.as400.resource has been specified -
    - Note: Dependency exclusion is not recommended for pre-V5R2 Toolbox JAR files. - - @param excludeSomeDependencies Whether or not AS400ToolboxJarMaker should - selectively limit dependency expansion. - **/ - public void setExcludeSomeDependencies(boolean excludeSomeDependencies) - { - super.setExcludeSomeDependencies(excludeSomeDependencies); - } - - - /** - Performs the actions specified in the invocation arguments. - - @param args The command line arguments. - **/ - public static void main(String[] args) - { - ToolboxJarMaker.main(args); - System.exit(0); - } - -} diff --git a/cvsroot/src/utilities/AboutToolbox.java b/cvsroot/src/utilities/AboutToolbox.java deleted file mode 100644 index d19023c67..000000000 --- a/cvsroot/src/utilities/AboutToolbox.java +++ /dev/null @@ -1,113 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: AboutToolbox.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2003 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// -// -// AboutToolbox. This program displays the Version, Release, and PTF -// level of the user's IBM Toolbox for Java. -// -// This program will only report version information if the Toolbox is -// Modification 2 with PTF SF57202, or a later modification, -// otherwise a message is displayed informing the user why the version -// cannot be retrieved. -// -// Command syntax: -// java utilities.AboutToolbox -// -////////////////////////////////////////////////////////////////////////// - -package utilities; - -import java.lang.reflect.*; - -import com.ibm.as400.access.AS400JDBCDriver; - -/** - * Prints the current version of the Toolbox that is found in the user's CLASSPATH. - *

    - * Syntax: java utilities.AboutToolbox - * @see java.lang.Package - * @see com.ibm.as400.access.Copyright - **/ -public class AboutToolbox -{ - public static void main(String args[]) - { - String versionInfo = getVersionDescription(); - System.out.println(versionInfo); - } - - /** - Returns version information about the Toolbox. - @return Version information about the Toolbox. - **/ - public static String getVersionDescription() - { - StringBuffer sbuf = new StringBuffer(200); - sbuf.append("\nIBM Toolbox for Java:\n"); - - try - { - Class copyright = Class.forName("com.ibm.as400.access.Copyright"); - Field version = copyright.getDeclaredField("version"); - - // Running with mod2 (with 2nd PTF) or later. - sbuf.append(version.get(null)); - - // JDBC version designators were added after JTOpen 6.1. - try - { - Class driver = Class.forName("com.ibm.as400.access.AS400JDBCDriver"); - Field majorVersion = driver.getDeclaredField("JDBC_MAJOR_VERSION_"); - Field minorVersion = driver.getDeclaredField("JDBC_MINOR_VERSION_"); - sbuf.append("\nSupports JDBC version " + - majorVersion.getInt(null) + "." + - minorVersion.getInt(null)); - } - catch(NoSuchFieldException e) - { - // We're running JTOpen 6.1 or earlier, so JDBC 4.0 not supported yet. - } - - try{ - //driver level - AS400JDBCDriver d = new AS400JDBCDriver(); - int driverMajor = d.getMajorVersion(); - int driverMinor = d.getMinorVersion(); - - sbuf.append("\nToolbox driver version " + driverMajor + "." + driverMinor ); - }catch(Throwable t) - { - // Skip if get any error - } - - } - catch(NoSuchFieldException e) - { - // Running with an older version of Toolbox. - sbuf.append("\nYour version of IBM Toolbox for Java is either:"); - sbuf.append("\n - Modification 0,"); - sbuf.append("\n - Modification 1, or"); - sbuf.append("\n - Modification 2 without PTF SF57202\n"); - sbuf.append("\nIn order for \"AboutToolbox\" to more precisely determine your level " + - "of the Toolbox, you need to have at least Toolbox Modification 2 " + - "with PTF SF57202 or later."); - } - catch(Exception e) - { - //e.printStackTrace(); - sbuf.append("\nUnexpected error occurred: " + e); - } - - return sbuf.toString(); - } - -} diff --git a/cvsroot/src/utilities/INMRI.pro b/cvsroot/src/utilities/INMRI.pro deleted file mode 100644 index 343f7ec3b..000000000 --- a/cvsroot/src/utilities/INMRI.pro +++ /dev/null @@ -1,71 +0,0 @@ -############################################################################### -## -## JTOpen (IBM Toolbox for Java - OSS version) -## -## Filename: INMRI.pro -## -## The source code contained herein is licensed under the IBM Public License -## Version 1.0, which has been approved by the Open Source Initiative. -## Copyright (C) 1997-2000 International Business Machines Corporation and -## others. All rights reserved. -## -############################################################################### - -#TRANNOTE -#TRANNOTE Exception messages used by installer. -#TRANNOTE -#TRANNOTE THIS FILE NOT CURRENTLY TRANSLATED!!!!! -#TRANNOTE NOTE TO TRANSLATOR: Translate only the part -#TRANNOTE after the first equal sign (=). -#TRANNOTE - -ERR_INVALID_ARGUMENT =Error: Option is not valid: -ERR_OPTION_NOT_COMPATIBLE =Error: Option is not compatible with other options: -ERR_MISSING_OPTION_VALUE =Error: Option value missing for option -ERR_MISSING_OPTION =Error: Missing option: -ERR_NO_I_U_C =Error: One and only one of the options -i, -u, and -c can be specified. -ERR_TOO_MANY_OPTIONS =Error: Too many options: -ERR_UNEXPECTED_OPTION_VALUE =Error: Unexpected option value: -ERR_UNEXPECTED_OPTION =Error: Unexpected option: -ERR_NOT_VALID_URL =URL is not valid: - -EXC_CANNOT_CREATE_DIRECTORY =Cannot create directory. -EXC_INSTALLATION_ABORTED =Installation aborted. -EXC_NO_PACKAGES_INSTALLED =No packages were installed. -EXC_PACKAGE_NOT_INSTALLED =Package is not installed. - -HELP01=Usage: -HELP02= java utilities.AS400ToolboxInstaller -HELP03= [-package(p) package1[,package2[...]] -HELP04= [-source(s) sourceURL] -HELP05= [-target(t) directory] -HELP06= [-install(i)] -HELP07= [-uninstall(u)] -HELP08= [-compare(c)] -HELP09= [-prompt(pr)] -HELP10= [-? or -help] \n -HELP11= When installing packages, the following options must be specified: -HELP12= -install -source, -target \n -HELP13= When uninstalling packages, the following options must be specified: -HELP14= -uninstall -target \n -HELP15= When comparing packages, the following options must be specified: -HELP16= -compare, -source, -target -HELP17= If you want to install, uninstall, or compare specific packages,\n the option -package must be specified. \n -HELP18= If -package is omitted, all packages are used. \n -HELP19= -? or -help also displays this text. \n -HELP20=For example, to install all packages, run -HELP21= java utilities.AS400ToolboxInstaller -i -s myAS400 -t c:\\target - -PROMPT_IF_REPLACE_ONE =Package &0 is out of date, replace it? [1 for yes, 0 for no]: -PROMPT_IF_REPLACE_TWO =Package &0 does not exist, add it? [1 for yes, 0 for no]: - -RESULT_ADD_CLASSPATHS =To use the Toolbox, the CLASSPATH environment variable must be updated by adding the following: -RESULT_PACKAGE_NEEDS_UPDATED =Package &0 is out of date. -RESULT_PACKAGE_NOT_NEED_UPDATED=Package &0 is up to date. -RESULT_REMOVE_CLASSPATHS =The following can be removed from the CLASSPATH environement variable: -RESULT_PACKAGE_INSTALLED =Package &0 is installed. -RESULT_PACKAGE_UNINSTALLED =Package &0 is uninstalled. -RESULT_UNEXPANDED_FILES =The following are unexpanded files: - -WARNING_SOURCE_URL_NOT_USED =Source URL is not used when uninstalling packages. - diff --git a/cvsroot/src/utilities/JPing.java b/cvsroot/src/utilities/JPing.java deleted file mode 100644 index 05a927b46..000000000 --- a/cvsroot/src/utilities/JPing.java +++ /dev/null @@ -1,266 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JPing.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2004 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package utilities; - -import com.ibm.as400.access.AS400JPing; -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.Trace; -import com.ibm.as400.access.ExtendedIllegalArgumentException; -import com.ibm.as400.access.CommandLineArguments; - -import java.io.PrintWriter; -import java.util.Vector; -import java.util.Hashtable; -import java.util.ResourceBundle; - - - -/** - * Determines if services are running on the IBM i system. - *

    - * - * JPing can be run as a command line program, as follows: - *

    - *  java utilities.JPing  systemName   [ options ]
    - *  
    - * Options: - *

    - *

    - * - *
    -help - *
    Displays the help text. - * The -help option may be abbreviated to -h. - * - *
    -service serviceName - *
    Specifies the specific service to ping. - * The -service option may be abbreviated to -s. The valid - * services include: as-file, as-netprt, as-rmtcmd, as-dtaq, - * as-database, as-ddm, as-central, and as-signon. If this - * option is not specified, by default, all of the services - * will be pinged. - * - *
    -ssl - *
    Specifies whether or not to ping the SSL port(s). - * The default setting will not ping the SSL port(s). - * - *
    -timeout - *
    Specifies the timeout period in milliseconds. - * The -timeout option may be abbreviated to -t. The default - * setting is 20000 (20 sec). - * - *
    -verbose - *
    Specifies verbose output. - * The -verbose option may be abbreviated to -v. The default - * setting is non-verbose. - * - *
    - * - *

    - *
    - * Here is an example of calling JPing from the command line: - *
    - *

    - *  java utilities.JPing myServer -service as-signon -ssl -timeout 10000
    - *  
    - * The JPing output will look something like the following: - *
    - *  Verifying connections to system myServer...
    - *  
    - *  Successfully connected to server application: as-signon-s
    - *  Connection Verified
    - *  
    - * - * To determine from within a program, if the services are running, use - * {@link com.ibm.as400.access.AS400JPing AS400JPing}. - * - **/ -public class JPing -{ - // These are the temp variables for the option values passed in - // via the command line. To eliminate the need of using static variables - // throughout the class, I needed to create some temporary static - // variables for use in main, where they will then set the private - // non-static variables for use throughout the entire class. - private static String sys_; - private static int srv_ = AS400JPing.ALL_SERVICES; - private static boolean ssl_ = false; - private static boolean verbose_ = false; - private static long time_ = 20000; - - // Where MRI comes from. - private static ResourceBundle resource_ = ResourceBundle.getBundle("utilities.UTMRI"); - - - - /** - * Run JPing. - **/ - public static void main(String args[]) - { - PrintWriter writer = new PrintWriter(System.out, true); //The PrintWriter used when running via the command line. - - try - { - // Determine which command line argument were used. - if (!parseParms(args, writer)) { - usage(writer); - return; - } - - if (verbose_) { - Trace.setTraceDiagnosticOn(true); - Trace.setTraceOn(true); - } - AS400JPing obj = new AS400JPing(sys_, srv_, ssl_); - obj.setTimeout(time_); - obj.setPrintWriter(System.out); - - writer.println(); - writer.print(resource_.getString("JPING_VERIFYING")); - writer.print(sys_); - writer.println("..."); - writer.println(); - - boolean rtn; - if (srv_ == AS400JPing.ALL_SERVICES) rtn = obj.pingAllServices(); - else rtn = obj.ping(); - - if (rtn) - writer.println(resource_.getString("JPING_VERIFIED")); - else - writer.println(resource_.getString("JPING_NOTVERIFIED")); - } - catch(Throwable e) - { - e.printStackTrace(writer); - if (Trace.isTraceOn()) - Trace.log(Trace.ERROR, e); - } - finally - { - System.exit(0); // this is necessary in case a signon dialog popped up - } - } - - - /** - * Parse out the command line arguments for the JPing command. - **/ - private static boolean parseParms(String args[], PrintWriter writer) throws Exception - { - if (args.length == 0) return false; - - Vector options = new Vector(); - options.addElement("-service"); - options.addElement("-ssl"); - options.addElement("-timeout"); - options.addElement("-verbose"); - - Hashtable shortcuts = new Hashtable(); - shortcuts.put("-h", "-help"); - shortcuts.put("-?", "-help"); - shortcuts.put("-s", "-service"); - shortcuts.put("-t", "-timeout"); - shortcuts.put("-v", "-verbose"); - - CommandLineArguments arguments = new CommandLineArguments(args, options, shortcuts); - - // If this flag is specified by the user, just display the help text. - if (arguments.isOptionSpecified("-help")) { - return false; - } - - // Get the system that the user wants to ping. - sys_ = arguments.getOptionValue(""); - if (sys_ == null || sys_.length() == 0 || sys_.indexOf(' ') != -1) { - return false; - } - - // Get the specific IBM i service the user wants to ping. - String s = arguments.getOptionValue("-service"); - if (s != null && s.length() != 0) - { - srv_ = toServiceNumber(s); - if (srv_ == UNRECOGNIZED) { - writer.println ("Service value not recognized: " + s); - return false; - } - } - - // The user wants to use SSL if they specify this flag. - ssl_ = (arguments.isOptionSpecified("-ssl")); - - // Get the JPing timeout value. - String t = arguments.getOptionValue("-timeout"); - if (t != null) - time_ = (new Integer(t)).intValue(); - - // The user wants verbose output if they specify this flag. - verbose_ = (arguments.isOptionSpecified("-verbose")); - - return true; - } - - - private static final int UNRECOGNIZED = -1; - private static int toServiceNumber(String serviceName) - { - int serviceNumber; - String s = serviceName.toLowerCase(); - - if (s.indexOf("file") != -1 || // as-file - s.indexOf("ifs") != -1) - serviceNumber = AS400.FILE; - else if (s.indexOf("prt") != -1 || // as-netprt - s.indexOf("print") != -1) - serviceNumber = AS400.PRINT; - else if (s.indexOf("cmd") != -1 || // as-rmtcmd - s.indexOf("command") != -1) - serviceNumber = AS400.COMMAND; - else if (s.indexOf("dtaq") != -1 || // as-dtaq - s.indexOf("dq") != -1) - serviceNumber = AS400.DATAQUEUE; - else if (s.indexOf("database") != -1 || // as-database - s.indexOf("db") != -1) - serviceNumber = AS400.DATABASE; - else if (s.indexOf("ddm") != -1 || // as-ddm - s.indexOf("rla") != -1) - serviceNumber = AS400.RECORDACCESS; - else if (s.indexOf("central") != -1) // as-central - serviceNumber = AS400.CENTRAL; - else if (s.indexOf("sign") != -1) // as-signon - serviceNumber = AS400.SIGNON; - else - serviceNumber = UNRECOGNIZED; - - return serviceNumber; - } - - - /** - * Print out the usage for the JPing command. - **/ - static void usage(PrintWriter writer) - { - writer.println (); - writer.println (resource_.getString("JPING_USAGE")); - writer.println (resource_.getString("JPING_HELP")); - writer.println (resource_.getString("JPING_SERVICE") + - resource_.getString("JPING_SERVICE2") + - resource_.getString("JPING_SERVICE3")); - writer.println (resource_.getString("JPING_SSL")); - writer.println (resource_.getString("JPING_TIMEOUT")); - writer.println (resource_.getString("JPING_VERBOSE")); - } -} diff --git a/cvsroot/src/utilities/JarMaker.java b/cvsroot/src/utilities/JarMaker.java deleted file mode 100644 index ee6b4a4a2..000000000 --- a/cvsroot/src/utilities/JarMaker.java +++ /dev/null @@ -1,3947 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JarMaker.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2001 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package utilities; - -import com.ibm.as400.access.CommandLineArguments; -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.BufferedReader; -import java.io.DataInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintStream; -import java.io.UnsupportedEncodingException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.StringTokenizer; -import java.util.Vector; -import java.util.zip.ZipEntry; -import java.util.zip.ZipException; -import java.util.zip.ZipFile; -import java.util.zip.ZipInputStream; -import java.util.zip.ZipOutputStream; -import sun.misc.BASE64Encoder; - - -/** -The JarMaker class is used to generate a smaller (and therefore -faster loading) JAR or ZIP file from a larger one, -based on the user's requirements. -

    -In addition, JarMaker can also be used to: -

      -
    • extract desired files from a JAR or ZIP file; or -
    • split a JAR or ZIP file into smaller JAR or ZIP files. -
    -

    -A JarMaker object can be included in the user's program, -or JarMaker can be run as a command line program, as follows: -

    -
    -java utilities.JarMaker [ options ]
    -
    -
    - -

    -Options - -

    -

    -
    -source sourceJarFile -
    -Specifies the source JAR or ZIP file from which to derive the -destination JAR or ZIP file. -If a relative path is specified, the path is assumed to be relative to -the current directory. -If this option is specified as the first positional argument, -the tag (-source) is optional. -The -source option may be abbreviated to -s. - -

    -

    -destination destinationJarFile -
    -Specifies the destination JAR or ZIP file, which will contain the desired subset -of the files in the source JAR or ZIP file. -If a pathname is not specified, the file is created in the current directory. -The -destination option may be abbreviated to -d. -The default name is generated by appending "Small" to the -source file name. For example, if the source file is myfile.jar, -then the default destination file would be myfileSmall.jar. - -

    -

    -fileRequired jarEntry1[,jarEntry2[...] ] -
    -The files in the source JAR or ZIP file that are to be copied to the destination. -Entries are separated by commas (no spaces). -The specified files, along with all of their dependencies, -will be considered required. -Files are specified in JAR entry name syntax, such as com/ibm/as400/access/DataQueue.class. -The -fileRequired option may be abbreviated to -f. - -

    -

    -fileExcluded jarEntry1[,jarEntry2[...] ] -
    -The files in the source JAR or ZIP file that are to be excluded from the destination, -and from dependency analysis. -Entries are separated by commas (no spaces). -Files are specified in JAR entry name syntax, such as com/ibm/as400/access/DataQueue.class. -The -fileExcluded option may be abbreviated to -fx. - -

    -

    -additionalFile file1[,file2[...] ] -
    -Specifies additional files (not included in the source JAR or ZIP file) -which are to be copied to the destination. -Entries are separated by commas (no spaces). -Files are specified by either their -absolute path, or their path relative to the current directory. -
    The specified files will be included, regardless of the settings of -other options. -The -additionalFile option may be abbreviated to -af. - -

    -

    -additionalFilesDirectory baseDirectory -
    -Specifies the base directory for additional files. -This should be the parent directory of the -directory where the package path starts. For example, if file foo.class -in package com.ibm.mypackage is located in directory -C:\dir1\subdir2\com\ibm\mypackage\, then specify base directory C:\dir1\subdir2. -
    The -additionalFilesDirectory option may be abbreviated to -afd. -The default is the current directory. - -

    -

    -package package1[,package2[...] ] -
    -The packages that are required. -Entries are separated by commas (no spaces). -The -package option may be abbreviated to -p. -Package names are specified in standard syntax, such as com.ibm.component. -
    Note: The specified packages are simply included in the output. -No additional dependency analysis is done on the files in a package, -unless they are explicitly specified as required files. - -

    -

    -packageExcluded package1[,package2[...] ] -
    -The packages that are to be excluded. -Entries are separated by commas (no spaces). -The -packageExcluded option may be abbreviated to -px. -Package names are specified in standard syntax, such as com.ibm.component. - -

    -

    -extract [baseDirectory] -
    -Extracts the desired entries of the source JAR or ZIP file -into the specified base directory, without generating a new JAR or ZIP file. -This option enables the user to build up a customized JAR or ZIP file -empirically, based on the requirements of their particular application. -When this option is specified, -additionalFile, --additionalFilesDirectory, and -destination -are ignored. -The -extract option may be abbreviated to -x. -By default, no extraction is done. -The default base directory is the current directory. - -

    -

    -split [splitSize] -
    -Splits the source JAR or ZIP file into smaller JAR or ZIP files. -No ZIP entries are added or removed; -the entries in the source JAR or ZIP file are simply distributed -among the destination JAR or ZIP files. -The split size is in units of kilobytes (1024 bytes), -and specifies the maximum size for the destination files. -The destination files are created in the current directory, -and are named by appending integers to the source file name; -any existing files by the same name are overwritten. -For example, if the source JAR file is myfile.jar, -then the destination JAR files would be -myfile0.jar, myfile1.jar, and so on. -When this option is specified, all other options except --source and -verbose are ignored. -The -split option may be abbreviated to -sp. -The default split size is 2 megabytes (2048 kilobytes). - -

    -

    -verbose -
    -Causes progress messages to be displayed. -The -verbose option may be abbreviated to -v. -The default is non-verbose. - -

    -

    -help -
    -Displays the help text. -The -help option may be abbreviated to -h. -The default is no help text. - -
    - -

    -At least one of the following options must be specified: -

      -
    • -fileRequired -
    • -fileExcluded -
    • -additionalFile -
    • -package -
    • -packageExcluded -
    • -extract -
    • -split -
    - -

    -If the following options are specified multiple times in a single command -string, only the final specification applies: -

      -
    • -source -
    • -destination -
    • -additionalFilesDirectory -
    • -extract -
    • -split -
    -Other options have a cumulative effect when specified multiple times -in a single command string. - -

    -Example usage -

    -

    -Suppose the source JAR file is named myJar.jar, -and is in the current directory. -To create a JAR file that contains only the classes -mypackage.MyClass1 and -mypackage.MyClass2, along with their dependencies, -do the following: - -

    -import utilities.JarMaker;
    -

    -// Set up the list of required files. -Vector classList = new Vector(); -classList.addElement ("mypackage/MyClass1.class"); -classList.addElement ("mypackage/MyClass2.class"); -JarMaker jm = new JarMaker(); -jm.setFilesRequired (classList); -

    -// Make a new JAR file, that contains only MyClass1, MyClass2, -// and their dependencies. -File sourceJar = new File ("myJar.jar"); -File newJar = jm.makeJar (sourceJar); // smaller JAR file -

    -

    -Alternatively, the above action can be performed directly -from the command line as follows: -

    -java utilities.JarMaker -source myJar.jar
    -        -fileRequired mypackage/MyClass1.class,mypackage/MyClass2.class
    -
    - - -**/ - -// -// * Implementation note: We can use the java.util.jar support -// when we start supporting JDK 1.2. -// - -public class JarMaker -{ - // Constants. - static final boolean DEBUG = false; - private static final boolean DEBUG_MANIFEST = false; - private static final boolean DEBUG_CP = false; - private static final boolean DEBUG_ZIP = false; - private static final boolean DEBUG_REF = false; - static final String CLASS_SUFFIX = ".class"; - private static final String MANIFEST_DIR_NAME = "META-INF/"; - private static final String MANIFEST_ENTRY_NAME = "META-INF/MANIFEST.MF"; - private static final String MANIFEST_NAME_KEYWORD = "Name:"; - private static final String MANIFEST_VERSION_KEYWORD = "Manifest-Version:"; - private static final String MANIFEST_REQVERS_KEYWORD = "Required-Version:"; - private static final int BUFFER_SIZE = 2*1024; // bytes - private static final int SPLIT_SIZE_KBYTES = 2*1024; // kilobytes - private static final char FILE_SEPARATOR = - System.getProperty("file.separator").charAt(0); - static final File CURRENT_DIR = new File(System.getProperty("user.dir")); - // Constants for copyVector() method: - static final boolean CHECK_DUPS = true; // @A3a - static final boolean NO_CHECK_DUPS = false; // @A3a - // Constants for removeElements() method: - static final int STARTS_WITH = 1; - static final int ENDS_WITH = 2; - static final int CONTAINS = 3; - - private static boolean noSHA_ = false; // turns on if we don't find SHA algorithm - private static boolean noMD5_ = false; // turns on if we don't find MD5 algorithm - - - // Variables. - - boolean verbose_; // Verbose output mode. - boolean requestedUsageInfo_; // Indicates whether -help option was detected. - private File sourceJarFile_; // Source JAR or ZIP file. - private File destinationJarFile_; // Destination JAR or ZIP file. - - // Required files (ZIP entries), as specified by user. (String objects) - private Vector filesRequired_ = new Vector(); // Never null. - // Files (ZIP entries) to be excluded, as specified by user. (String objects) - private Vector filesExcluded_ = new Vector(); // Never null. - - // Packages specified by user (String's). - private Vector packages_ = new Vector(); // Never null. - // Packages to exclude (String's). - private Vector packagesExcluded_ = new Vector(); // Never null. - // Additional files specified by user (File's). - private Hashtable additionalFiles_ = new Hashtable(); - // Key=File, value=base directory (File). - // Never null. - boolean excludeSomeDependencies_; // Indicates whether -excludeSomeDependencies was specified. @A4a - Vector dependenciesToExclude_ = new Vector(); // Never null. - // Dependendencies which should be ignored. @A4a - - private boolean extract_ = false; // Whether or not to do an extract. - // Base directory for extracting. - private File baseDirectoryForExtract_ = new File(System.getProperty("user.dir")); - - private boolean split_ = false; // Whether or not to do a split. - private int splitSize_ = SPLIT_SIZE_KBYTES; // kilobytes - - // The following literals specify the context package prefix, - // for example, "com/ibm/myPackage". - // These are used when analyzing class dependencies, - // to test whether a reference might be to a properties file - // or to a class loaded by Class.forName(). - private String jarEntryDefaultPrefix_; - private String jarEntryDefaultPrefixDotted_; - // Same as jarEntryDefaultPrefix_, - // but with slashes replaced by dots. - private transient Vector eventListeners_ = new Vector(); - - // Invocation arguments. This is used only when JarMaker is invoked - // from the command line. - private Arguments arguments_ = new Arguments(); - - - /** - Constructs a JarMaker object. - **/ - public JarMaker() - { - } - - - /** - Constructs a JarMaker object. This constructor is provided for use - by subclasses. - - @param jarEntryDefaultPrefix Default prefix for use when parsing class files. - **/ - JarMaker(String jarEntryDefaultPrefix) - { - jarEntryDefaultPrefix_ = jarEntryDefaultPrefix; - jarEntryDefaultPrefixDotted_ = jarEntryDefaultPrefix.replace('/', '.'); - } - - - //@A1a - // Adds an element to a Vector, only if not already a member. - // @return false if object was already a member of the vector. - static boolean addElement(Vector vector, Object object) - { - if (vector.contains(object)) - return false; - - vector.addElement(object); - return true; - } - - - // Removes elements (matching a pattern) from a Vector of Strings. - // If patternLocation==STARTS_WITH, namePattern is a "startsWith" pattern. - // If patternLocation==ENDS_WITH, namePattern is an "endsWith" pattern. - // Otherwise, namePattern is a "contains String" pattern. - static void removeElements(Vector vector, String namePattern, int patternLocation) - { - Vector entriesToRemove = new Vector(); - Enumeration e = vector.elements(); - while (e.hasMoreElements()) - { - String entry = (String)e.nextElement(); - boolean removeEntry = false; - switch (patternLocation) { - case STARTS_WITH: - if (entry.startsWith(namePattern)) removeEntry = true; - break; - case ENDS_WITH: - if (entry.endsWith(namePattern)) removeEntry = true; - break; - default: // CONTAINS - if (entry.indexOf(namePattern) != -1) removeEntry = true; - } - if (removeEntry) { - // Note: Must not remove elements from underneath the current Enumeration. - entriesToRemove.addElement(entry); - if (/*verbose_ ||*/ DEBUG) { - System.out.println("Excluding entry: " + entry); - } - } - } - Enumeration e2 = entriesToRemove.elements(); - while (e2.hasMoreElements()) - vector.removeElement((String)e2.nextElement()); - } - - - /** - Adds a listener to the listener list. - - @param listener The listener. - **/ - public synchronized void addJarMakerListener(JarMakerListener listener) - { - if (listener == null) throw new NullPointerException("listener"); - eventListeners_.addElement(listener); - } - - - // @A3a - /** - Adds files for any specified packages to the additional files list. - - @param neededJarEntries The current list of required files - and their dependencies. - The list should contain only String objects. - @param jarMap A map of the source JAR or ZIP file. - **/ - static void addPackageFiles(Vector neededJarEntries, JarMap jarMap, Vector packages) - throws IOException - { - // Load the entry names associated with any required packages. - // Note that these files will not be explicitly analyzed. - Enumeration pkgs = packages.elements(); - while (pkgs.hasMoreElements()) - { - String packageName = (String)pkgs.nextElement(); - String packagePrefix = packageName.replace('.', '/'); - Vector entriesInPackage = - getEntryNamesForPackage(packagePrefix, jarMap); - if (entriesInPackage.size() == 0) { - System.err.println("Error: Specified package not found in source file:"); - System.err.println(" " + packageName); - throw new ZipException(packageName); - } - copyVector(entriesInPackage, neededJarEntries, CHECK_DUPS); // @A3c - } - } - - - /** - Removes files for any specified packages from the additional files list. - - @param neededJarEntries The current list of required files - and their dependencies. - The list should contain only String objects. - @param jarMap A map of the source JAR or ZIP file. - **/ - static void removePackageFiles(Vector neededJarEntries, JarMap jarMap, Vector packages) - throws IOException - { - // Load the entry names associated with any required packages. - Enumeration pkgs = packages.elements(); - while (pkgs.hasMoreElements()) - { - String packageName = (String)pkgs.nextElement(); - String packagePrefix = packageName.replace('.', '/'); - Vector entriesInPackage = - getEntryNamesForPackage(packagePrefix, jarMap); - if (entriesInPackage.size() == 0) { - System.err.println("Error: Specified package not found in source file:"); - System.err.println(" " + packageName); - throw new ZipException(packageName); - } - removeElements(neededJarEntries, entriesInPackage); - } - } - - - /** - Adds or removes ZIP entry names from the "required files" list, - prior to initial generation of the dependencies list. - This method is provided so that subclasses of JarMaker can override it. -
    This method is meant to be called by the JarMaker class only. - - @param neededJarEntries An unsorted list of names of ZIP entries. - @param jarMap A map of the source JAR or ZIP file. - that should be included in the output. - @return The modified list of ZIP entry names - (must never be null. - This should be a Vector of Strings. - @exception IOException If an I/O error occurs when reading the JAR file. - **/ - Vector adjustDependencies1(Vector neededJarEntries, JarMap jarMap) - throws IOException - { - return neededJarEntries; - } - - - /** - Adds or removes ZIP entry names from the dependencies list, - prior to final presentation of the dependencies list. - This method is provided so that subclasses of JarMaker can override it. -
    This method is meant to be called by the JarMaker class only. - - @param neededJarEntries An unsorted list of names of ZIP entries. - @param jarMap A map of the source JAR or ZIP file. - that should be included in the output. - @return The modified list of ZIP entry names - (must never be null. - This should be a Vector of Strings. - @exception IOException If an I/O error occurs when reading the JAR file. - **/ - Vector adjustDependencies2(Vector neededJarEntries, JarMap jarMap) - throws IOException - { - // Remove excluded packages. - removePackageFiles(neededJarEntries, jarMap, packagesExcluded_); - - // Load the entry names associated with any required packages. - // Note that these files will not be explicitly analyzed. - addPackageFiles(neededJarEntries, jarMap, packages_); // @A3a - - return neededJarEntries; - } - - - /** - Determines the dependencies of a single file in the source JAR or ZIP file. - - @param jarEntryName The entry name for the file. - @param unanalyzedEntries List of as-yet unanalyzed entry names (Strings). - @param referencedJarEntries Cumulative list of referenced ZIP entries. - @param jarMap A map of the source JAR or ZIP file. - @exception IOException If an I/O error occurs when reading the source file. - **/ - void analyzeJarEntry( String jarEntryName, - Vector unanalyzedEntries, - Vector referencedJarEntries, - JarMap jarMap ) - throws IOException - { - fireAnalysisEvent(true, jarEntryName); - if (jarEntryName.endsWith(CLASS_SUFFIX)) - { - if (excludeSomeDependencies_ && - dependenciesToExclude_.contains(jarEntryName)) // @A4a - { - if (verbose_ || DEBUG) - System.out.println("\nExcluding entry from dependency analysis: " + - jarEntryName + "\n"); // @A4a - addElement(referencedJarEntries, jarEntryName); // keep this one. - } - else - { - // Start with list of directly referenced entries. - Vector referencedEntries = - getReferencedEntries(jarEntryName, jarMap); - if (DEBUG_REF) { - System.out.println(jarEntryName + " references: "); - Enumeration e1 = referencedEntries.elements(); // entry names - while (e1.hasMoreElements()) - System.out.println(" " + (String)e1.nextElement()); - } - // Now recurse through the list and add indirectly referenced entries. - Enumeration e = referencedEntries.elements(); // entry names - while (e.hasMoreElements()) - { - String entryName = (String)e.nextElement(); - if (unanalyzedEntries.contains(entryName)) - { - unanalyzedEntries.removeElement(entryName); - analyzeJarEntry(entryName, unanalyzedEntries, - referencedJarEntries, jarMap); - addElement(referencedJarEntries, entryName); - } - } - } - } - else {} // Not a class file, so no analysis to do - fireAnalysisEvent(false, jarEntryName); - } - - - /** - Constructs a manifest entry for the specified additional file, - and adds the entry to the buffer. - - @param buffer The buffer to which to append the new manifest entry. - @param file The file to create a manifest entry for. - @param entryName Name for the ZIP entry. - @exception IOException If an I/O error occurs when reading the JAR file. - **/ - private static void constructManifestEntry(StringBuffer buffer, File file, - String entryName) - throws IOException - { - String lineSHA = null; // SHA-Digest: - String lineMD5 = null; // MD5-Digest: - - byte[] fileContents = getBytes(file); // read file into byte array - - if (!noSHA_) - { - try - { - MessageDigest shaMD = MessageDigest.getInstance("SHA"); - byte[] shaDigest = shaMD.digest(fileContents); - String encodedStr = (new BASE64Encoder()).encodeBuffer(shaDigest); - lineSHA = "SHA-Digest: " + encodedStr; - } - catch (NoSuchAlgorithmException e) { - noSHA_ = true; - if (DEBUG) { - System.err.println("Debug: Warning: Manifest entry " + - "will contain no SHA digest:"); - System.err.println(" " + file.getAbsolutePath()); - } - } - } - - if (!noMD5_) - { - try - { - MessageDigest md5MD = MessageDigest.getInstance("MD5"); - byte[] md5Digest = md5MD.digest(fileContents); - String encodedStr = (new BASE64Encoder()).encodeBuffer(md5Digest); - lineMD5 = "MD5-Digest: " + encodedStr; - } - catch (NoSuchAlgorithmException e) { - noMD5_ = true; - if (DEBUG) { - System.err.println("Debug: Warning: Manifest entry " + - "will contain no MD5 digest:"); - System.err.println(" " + file.getAbsolutePath()); - } - } - } - - if (lineSHA != null || lineMD5 != null) - { - buffer.append("Name: " + entryName + "\n"); - buffer.append("Digest-Algorithms:"); - if (lineSHA != null) buffer.append(" SHA"); - if (lineMD5 != null) buffer.append(" MD5"); - buffer.append('\n'); - if (lineSHA != null) - { - buffer.append(lineSHA); - // Note: BASE64Encoder.encodeBuffer() likes to append a newline. - if (!lineSHA.endsWith("\n")) { buffer.append('\n'); } - } - if (lineMD5 != null) - { - buffer.append(lineMD5); - if (!lineMD5.endsWith("\n")) { buffer.append('\n'); } - } - buffer.append('\n'); // terminate the section with a zero-length line - } - else { - System.err.println("Error: Failed to construct manifest entry for file"); - System.err.println(" " + file.getAbsolutePath()); - } - } - - - // Utility method to determine if an int array contains a specific value. - // Assumes that the array is sorted in ascending order. - static final boolean contains(int[] list, int element) - { - if (Arrays.binarySearch(list, element) >= 0) return true; - else return false; - } - - - /** - Copies specified number of bytes from input stream to output stream. - @param inStream The input stream from which the entry is being read. - @param outStream The output stream being copied to. - @param bytesToCopy The number of bytes to copy. - - @exception IOException If an I/O error occurs when reading the input stream - or writing to the output stream. - **/ - private static void copyBytes(InputStream inStream, OutputStream outStream, - long bytesToCopy) - throws IOException - { - byte[] buffer = new byte[BUFFER_SIZE]; - int bytesRead = 0; - int totalBytes = 0; - boolean done = false; - while (!done && totalBytes < bytesToCopy) - { - bytesRead = inStream.read(buffer, 0, buffer.length); - if (bytesRead == -1) done = true; - else { - outStream.write(buffer, 0, bytesRead); - totalBytes += bytesRead; - } - } - } - - - /** - Copies a file onto another file (replacing it if it exists). - **/ - static void copyFile(File sourceFile, File destinationFile) - throws IOException - { - if (sourceFile == null) - throw new NullPointerException("sourceFile"); - if (destinationFile == null) - throw new NullPointerException("destinationFile"); - BufferedInputStream source = null; - BufferedOutputStream destination = null; - String parentDirName = destinationFile.getParent(); - if (parentDirName == null) - throw new NullPointerException("parentDirectory"); - File outFileDir = new File(parentDirName); - if (!outFileDir.exists() && !outFileDir.mkdirs()) { - throw new IOException(outFileDir.getAbsolutePath() + - ": Cannot create directory."); - } - byte[] buffer = new byte[BUFFER_SIZE]; - try - { - source = - new BufferedInputStream(new FileInputStream(sourceFile), - BUFFER_SIZE); - destination = - new BufferedOutputStream(new FileOutputStream(destinationFile), - BUFFER_SIZE); - boolean done = false; - while (!done) - { - int bytesRead = source.read(buffer); - if (bytesRead == -1) done = true; - else destination.write(buffer, 0, bytesRead); - } - destination.flush(); - } - catch (IOException e) { - System.err.println("Error: IOException when copying file"); - System.err.println(" " + destinationFile.getAbsolutePath() + ":"); - System.err.println(e.toString()); - if (DEBUG) e.printStackTrace(System.err); - throw e; - } - finally - { - if (source != null) { try { source.close(); } catch (Throwable t) {} } - if (destination != null) { destination.close(); } - } - } - - - /** - Copies (appends) a vector into another vector. - **/ - static void copyVector(Vector fromList, Vector toList, boolean checkDups) - { - Enumeration e = fromList.elements(); - while (e.hasMoreElements()) { - Object element = e.nextElement(); - if (!checkDups || !toList.contains(element)) - toList.addElement(element); - } - } - - - /** - Removes the entries listed in one vector from another vector. - **/ - static void removeElements(Vector list, Vector entriesToRemove) - { - Enumeration e = entriesToRemove.elements(); - while (e.hasMoreElements()) { - list.remove(e.nextElement()); - } - } - - - /** - Copies a ZIP entry from an input stream to an output stream. - **/ - static void copyZipEntry(ZipEntry inZipEntry, - InputStream inStream, - ZipOutputStream zipOutStream) - throws IOException - { - if (inZipEntry == null) throw new NullPointerException("inZipEntry"); - if (inStream == null) throw new NullPointerException("inStream"); - if (zipOutStream == null) throw new NullPointerException("zipOutStream"); - - // Create a new ZipEntry for the output ZipFile - ZipEntry outZipEntry = new ZipEntry(inZipEntry.getName()); - outZipEntry.setComment(inZipEntry.getComment()); - - long crc = inZipEntry.getCrc(); - if ( crc != -1 ) outZipEntry.setCrc(crc); - - outZipEntry.setExtra(inZipEntry.getExtra()); - - int method = inZipEntry.getMethod(); - if ( method != -1 ) outZipEntry.setMethod(method); - - long size = inZipEntry.getSize(); - if ( size != -1 ) outZipEntry.setSize(size); - - long time = inZipEntry.getTime(); - if (time != -1) outZipEntry.setTime(time); - - // Put the entry into the output ZIP file. - zipOutStream.putNextEntry(outZipEntry); - - // If the entry is not a directory, then there is also data to write. - byte[] buffer = new byte [BUFFER_SIZE]; - if ( !inZipEntry.isDirectory() ) { - // Loop until all output is read and written. - int bytesRead = 0; - int totalBytes = 0; - boolean done = false; - while (!done && totalBytes < size) { - bytesRead = inStream.read(buffer); - if (bytesRead == -1) done = true; - else { - zipOutStream.write(buffer,0,bytesRead); - totalBytes += bytesRead; - } - } - } - } - - - /** - Calculates the size of the zip metadata that will be associated - with a given list of directory names. - **/ - private static int determineDirMetadataSize(Vector dirNames, - int baseMetadataPerZipEntry) - { - int result = 0; - Enumeration e = dirNames.elements(); - while (e.hasMoreElements()) { - String dirName = (String)e.nextElement(); - result += dirName.length(); - result += baseMetadataPerZipEntry; - } - return result; - } - - - /** - Extracts the desired entries and their dependencies from - the specified JAR or ZIP file. - The extracted files are placed under the current directory. -
    Note: No "additional files" are copied. - - @param sourceJarFile The source JAR or ZIP file. - @return The base directory under which the extracted files were written. - @exception FileNotFoundException If the source file does not exist. - @exception IOException If an I/O error occurs when reading the source file - or writing the extracted files. - @exception ZipException If a ZIP error occurs when reading the source file. - **/ - public File extract(File sourceJarFile) - throws FileNotFoundException, IOException, ZipException - { - if (sourceJarFile == null) throw new NullPointerException("sourceJarFile"); - // Default: Extract into current directory. - File outputDirectory = new File(System.getProperty("user.dir")); - extract(sourceJarFile, outputDirectory); - return outputDirectory; - } - - - /** - Extracts the desired entries and their dependencies from - the specified JAR or ZIP file. -
    Note: No "additional files" are copied. - - @param sourceJarFile The source JAR or ZIP file. - @param outputDirectory The directory under which to put the extracted files. - @exception FileNotFoundException If the source file does not exist. - @exception IOException If an I/O error occurs when reading the source file - or writing the extracted files. - @exception ZipException If a ZIP error occurs when reading the source file. - **/ - public void extract(File sourceJarFile, File outputDirectory) - throws FileNotFoundException, IOException, ZipException - { - if (sourceJarFile == null) throw new NullPointerException("sourceJarFile"); - if (outputDirectory == null) - throw new NullPointerException("outputDirectory"); - if (!sourceJarFile.exists()) - throw new FileNotFoundException(sourceJarFile.getAbsolutePath()); - if (verbose_ || DEBUG) { - System.out.println("Source file is " + sourceJarFile.getAbsolutePath()); - System.out.println("Extraction output directory is " + outputDirectory.getAbsolutePath()); - } - - BufferedOutputStream destinationFile = null; - InputStream inStream = null; - String basePath = outputDirectory.getAbsolutePath(); - JarMap jarMap = null; - - // Warn the user if additional files were specified. - if (additionalFiles_.size() != 0) - System.err.println("Warning: Additional files were specified. " + - "They are ignored by extract()."); - try - { - // Make a map of the source JAR or ZIP file. - jarMap = new JarMap(sourceJarFile, verbose_); - - // Get list of the names of the ZIP entries that will be extracted. - Vector referencedJarEntries = identifyDependencies(jarMap); - - // Make sure to copy the Manifest also. - if (jarMap.hasManifest() && - !referencedJarEntries.contains(MANIFEST_ENTRY_NAME)) - { - int dirIndex = referencedJarEntries.indexOf(MANIFEST_DIR_NAME); - if (dirIndex == -1) { - referencedJarEntries.insertElementAt(MANIFEST_DIR_NAME, 0); - dirIndex = 0; - } - referencedJarEntries.insertElementAt(MANIFEST_ENTRY_NAME, dirIndex+1); - } - - // Copy the referenced files to the destination. - if (verbose_ || DEBUG) System.out.println("Extracting files"); - Enumeration e = referencedJarEntries.elements(); - while (e.hasMoreElements()) - { - String entryName = (String)e.nextElement(); - - // If the entry represents a directory, simply create the - // directory. Otherwise extract the file. - String filePath = generateFilePath(basePath, entryName); - if (DEBUG) System.out.println(filePath); - else if (verbose_) System.out.print("."); - if (entryName.endsWith("/")) - { // Simply create the directory. Remove the final separator. - File outFileDir = new File(filePath.substring(0, filePath.length()-1)); - if (!outFileDir.exists() && !outFileDir.mkdirs()) { - throw new IOException(outFileDir.getAbsolutePath() + - ": Cannot create directory."); - } - } - else - { - // We assume that the referencedJarEntries list is sorted, - // and already contains all needed directory entries. - - // Open the destination file for writing. - destinationFile = - new BufferedOutputStream(new FileOutputStream(filePath), - BUFFER_SIZE); - - // Gather information from the source file. - ZipEntry entry = jarMap.getEntry(entryName); - if (entry == null) - throw new FileNotFoundException(entryName); - inStream = jarMap.getInputStream(entry); - - // Design note: Experimentation reveals that ZipFile.getInputStream() - // actually returns a java.util.zip.InflaterInputStream object, - // which does automatic decompression. - - if (DEBUG_ZIP) - { - int avail = inStream.available(); - long entrySize = entry.getSize(); - long compressedSize = entry.getCompressedSize(); - if (avail == entrySize) System.out.println("Debug: Sizes match"); - else - { - System.out.println("Debug: File sizes mismatch for " + - entry.getName()); - System.out.println(" available = " + avail); - System.out.println(" compressed = " + compressedSize); - System.out.println(" uncompressed= " + entrySize); - } - } - // Copy the referenced file to the destination. - copyBytes(inStream, destinationFile, entry.getSize()); - destinationFile.close(); - destinationFile = null; - inStream.close(); - inStream = null; - } - } // ... while - } - catch (ZipException e) { - System.err.println("Error: ZipException when extracting source file"); - System.err.println(" " + sourceJarFile.getAbsolutePath() + ":"); - System.err.println(e.toString()); - if (DEBUG) e.printStackTrace(System.err); - throw e; - } - catch (IOException e) { - System.err.println("Error: IOException when extracting source file"); - System.err.println(" " + sourceJarFile.getAbsolutePath() + ":"); - System.err.println(e.toString()); - if (DEBUG) e.printStackTrace(System.err); - throw e; - } - finally - { - if (DEBUG) System.out.println(); - if (jarMap != null) { - try { jarMap.close(); } catch (Throwable t) {} - } - - if (destinationFile != null) { - try { destinationFile.close(); } catch (Throwable t) {} - } - - if (inStream != null) { - try { inStream.close(); } catch (Throwable t) {} - } - } - - } - - - /** - Fires the appropriate Event. - - @param start If true, fires a - dependencyAnalysisStarted event; - otherwise fires a dependencyAnalysisCompleted event. - @param entryName The name of the ZIP entry. - **/ - private void fireAnalysisEvent(boolean start, String entryName) - { - Vector targets; - synchronized (this) - { - targets = (Vector) eventListeners_.clone(); - } - JarMakerEvent event = new JarMakerEvent(this, entryName); - for (int i = 0; i < targets.size(); i++) - { - JarMakerListener target = (JarMakerListener)targets.elementAt(i); - if (start) - { - target.dependencyAnalysisStarted(event); - } - else - { - target.dependencyAnalysisCompleted(event); - } - } - } - - - /** - Generates any needed ZIP directory entries to add to the destination file, - that are prerequisite to the specifed ZIP entry. - For example, if entryName is "com/ibm/comp1/someFile", - and listSoFar contains "com/", - then the returned list will contain "com/ibm/" and "com/ibm/comp1/". - If the specified entry is a directory entry, it does not get included - in the returned list. - - @param entryName The name of the ZIP entry about to be added. - @param listSoFar The ZIP directory entries that have already been - added to the destination file. - @return The list of needed additional ZIP directory entries. - **/ - private static Vector generateDirEntries(String entryName, - Vector listSoFar) - { - Vector outList = new Vector(); - String pathPrefix = entryName.substring(0, entryName.lastIndexOf("/")+1); - if (pathPrefix.length() != 0) - { - int slashPos = pathPrefix.indexOf("/"); - while (slashPos != -1 && - slashPos < entryName.length()-1) - { - String subPrefix = pathPrefix.substring(0, slashPos+1); - if (!listSoFar.contains(subPrefix)) - outList.addElement(subPrefix); - slashPos = pathPrefix.indexOf("/", slashPos+1); - } - } - return outList; - } - - - /** - Converts a ZIP entry name to a file pathname. - For example, in a Windows environment, converts - "com/ibm/as400/access/CommandCall.class" to - "com\ibm\as400\access\CommandCall.class". - - @param baseDirectory The base directory for the file. - @param entryName The ZIP entry name. - **/ - static String generateFilePath(File baseDirectory, - String entryName) - { - if (baseDirectory == null) throw new NullPointerException("baseDirectory"); - return generateFilePath(baseDirectory.getAbsolutePath(), entryName); - } - - - /** - Converts a ZIP entry name to a file pathname. - - @param basePath The absolute path of the base directory for the file. - @param entryName The ZIP entry name. - **/ - static String generateFilePath(String basePath, String entryName) - { - if (basePath == null) throw new NullPointerException("basePath"); - if (entryName == null) throw new NullPointerException("entryName"); - StringBuffer pathBuf = new StringBuffer(basePath.trim()); - if (pathBuf.charAt(pathBuf.length()-1) != FILE_SEPARATOR) - pathBuf.append(FILE_SEPARATOR); - - // Replace all occurrences of "/" with fileSeparator. - StringBuffer convertedName = - new StringBuffer(entryName.trim().replace('/',FILE_SEPARATOR)); - - pathBuf.append(convertedName); - String path = pathBuf.toString(); - - return path; - } - - - /** - Generates the ZIP entry names for a list of files. - - @param fileList A Hashtable of (File, File) pairs, where the - second arg is the "base path" for the first arg. - @return The derived ZIP entry names - a map of (File, String). - **/ - private static Hashtable generateJarEntryMap(Hashtable fileList) - { - Hashtable entryNames; - if (fileList.size() != 0) entryNames = new Hashtable(fileList.size()); - else entryNames = new Hashtable(); - Enumeration e = fileList.keys(); - while (e.hasMoreElements()) - { - File file = (File)e.nextElement(); - File baseDir = (File)fileList.get(file); - String entryName = generateJarEntryName(file, baseDir); - entryNames.put(file, entryName); - } - return entryNames; - } - - - /** - Generates the ZIP entry name for a given file. - - @param file The file. - @param baseDir The base directory for the file. - @return The derived ZIP entry name. - **/ - private static String generateJarEntryName(File file, File baseDir) - { - if (DEBUG) System.out.println("Debug: File = " + file.getAbsolutePath() + - ", baseDir = " + baseDir.getAbsolutePath()); - // Strip off the base path, if it matches the beginning of the file path. - String filePath = file.getAbsolutePath(); - String basePath = baseDir.getAbsolutePath(); - if (filePath.startsWith(basePath)) - filePath = filePath.substring(basePath.length()); - else - { - System.err.println("Warning: File path does not begin with " + - "base path for additional files."); - System.err.println(" File path: " + filePath); - System.err.println(" Base path: " + basePath); - } - - // Replace all filepath separators with "/". - String entryName = filePath.replace(FILE_SEPARATOR, '/'); - - // Remove leading filepath separator if present. - if (entryName.startsWith("/")) - entryName = entryName.substring(1); - - if (DEBUG) System.out.println("Debug: Generated entry name: "+entryName); - - return entryName; - } - - - /** - Returns the additional files that are to be included in - the destination JAR or ZIP file. - - @return The additional files specified by the user. - The list will be empty if none has been specified. - The list will contain only java.io.File objects. - **/ - public Vector getAdditionalFiles() - { - Vector files = new Vector(); - Enumeration e = additionalFiles_.keys(); - while (e.hasMoreElements()) - files.addElement((File)e.nextElement()); - return files; - } - - - /** - Returns the contents of the specified file as a byte array. - - @return The contents of the specified file as a byte array. - @exception IOException If an I/O error occurs when reading the file. - **/ - static byte[] getBytes(File file) - throws IOException - { - long fileSize = file.length(); - byte[] buffer = new byte[(int)fileSize]; - InputStream inStream = new FileInputStream(file); - try - { - int bytesRead = inStream.read(buffer); - if (bytesRead < fileSize) { - throw new IOException(file.getAbsolutePath() + - ": Failed to read entire file."); - } - } - catch (IOException e) { - System.err.println("Error: IOException when reading file"); - System.err.println(" " + file.getAbsolutePath() + ":"); - System.err.println(e.toString()); - if (DEBUG) e.printStackTrace(System.err); - throw e; - } - finally { if (inStream != null) inStream.close(); } - return buffer; - } - - - /** - Returns the destination JAR or ZIP file. - This method is provided for internal use. - - @return The destination JAR or ZIP file. - **/ - File getDestinationJar() { return destinationJarFile_; } - - - /** - Returns the names of ZIP entries associated with a specific package. - - @param packagePrefix The ZIP entry prefix for the package of interest. - Does not include the final '/'. - May be zero-length, indicating the default package. - @param jarMap A map of the JAR or ZIP file. - @return The names of the ZIP entries for the specified package (Strings). - **/ - private static Vector getEntryNamesForPackage(String packagePrefix, - JarMap jarMap) - { - Vector entriesInPackage = new Vector(); - int prefixLength = packagePrefix.length(); - Enumeration e = jarMap.elements(); - while (e.hasMoreElements()) - { - String entryName = (String)e.nextElement(); - switch (prefixLength) - { - case 0: // No package specifier, so assume the default package. - if (entryName.indexOf('/') == -1) - entriesInPackage.addElement(entryName); - if (DEBUG) - System.out.println("getEntryNamesForPackage: " + - "Zero-length packagePrefix encountered."); - break; - default: - if (entryName.startsWith(packagePrefix) && - entryName.lastIndexOf('/') == prefixLength) - entriesInPackage.addElement(entryName); - } - } - return entriesInPackage; - } - - - /** - Returns the base directory for the directory tree into which the - source JAR or ZIP file is to be extracted. - This method is provided for internal use. - - @return The directory at the base of the tree into which the - source JAR or ZIP file will be extracted. - **/ - File getExtractionDirectory() { return baseDirectoryForExtract_; } - - - /** - Returns the ZIP entries directly referenced by a specified file - in a JAR or ZIP file. - - @param jarEntryName The name of the ZIP entry. - @param jarMap A map of the JAR or ZIP file. - @return The names of referenced ZIP entries (String's). - - @exception IOException If an I/O error occurs when reading the JAR or ZIP file. - **/ - private Vector getReferencedEntries(String jarEntryName, JarMap jarMap) - throws IOException - { - if (DEBUG && false) - System.out.println("Debug: getReferencedEntries(" + jarEntryName + ")"); - - // Open up the class file and process its bytecodes, looking - // for referenced files. - if (verbose_) System.out.print("."); - ZipEntry entry = jarMap.getEntry(jarEntryName); - String entryName = entry.getName(); - String contextPackageName = ""; - int finalSlashPos = entryName.lastIndexOf('/'); - if (finalSlashPos != -1) - contextPackageName = - entryName.substring(0, finalSlashPos).replace('/','.'); - InputStream inStream = null; - try - { - inStream = jarMap.getInputStream(entry); - Vector classIndexes = prescanForClassIndexes(inStream, - contextPackageName, - jarMap); - inStream.close(); - inStream = jarMap.getInputStream(entry); - Vector referenced = processBytecodeStream(inStream, - contextPackageName, - jarMap, - classIndexes); - inStream.close(); - inStream = null; - return referenced; - } - finally { if (inStream != null) inStream.close(); } - - } - - - /** - @deprecated Use getFilesRequired() instead. - **/ - public Vector getRequiredFiles() { return filesRequired_; } - - - /** - Returns the names of the required files specified by the user. - - @return The names of required files specified by the user. - The list will be empty if none has been specified. - The list will contain only String objects. - **/ - public Vector getFilesRequired() { return filesRequired_; } - - - /** - Returns the names of the required files specified by the user. - - @return The names of required files specified by the user. - The list will be empty if none has been specified. - The list will contain only String objects. - **/ - public Vector getFilesExcluded() { return filesExcluded_; } - - - /** - Returns the names of the packages that are to be included in the output. - - @return The names of the required packages specified by the user. - The list will be empty if none has been specified. - The list will contain only String objects. - **/ - public Vector getPackages() { return packages_; } - - - /** - Returns the names of the packages that are to be excluded from the output. - - @return The names of the excluded packages specified by the user. - The list will be empty if none has been specified. - The list will contain only String objects. - **/ - public Vector getPackagesExcluded() { return packagesExcluded_; } - - - /** - Returns the source JAR or ZIP file. - This method is provided for internal use. - - @return The source JAR or ZIP file. - **/ - File getSourceJar() { return sourceJarFile_; } - - - /** - Returns the maximum file size for the destination JAR or ZIP files that - are produced by the split() method. - - @return The maximum file size for the destination JAR or ZIP files; - in units of kilobytes (1024 bytes). - **/ - int getSplitSize() { return splitSize_; } - - - /** - Returns the command line arguments that were not recognized. - This method is provided for use by subclasses. - - @return The command line arguments that were not recognized. - **/ - String [] getUnrecognizedArgs() { return arguments_.getUnrecognized(); } - - - /** - Determines which entries in the source file should be included in the output. - - @param jarMap A map of the JAR or ZIP file. - @return The source entry names that should be included in the output. - (empty list if no dependencies are found). - This will be a Strings, sorted alphabetically. - @exception IOException If an I/O error occurs when reading the JAR file. - **/ - private Vector identifyDependencies(JarMap jarMap) - throws IOException - { - if (verbose_ || DEBUG) - System.out.println("Analyzing source file"); - - // Set up lists. - Vector referencedJarEntries = new Vector(); // referenced entry names - Vector unanalyzedEntries = new Vector(); // entry names not yet looked at - Enumeration e = jarMap.entries(); // all entries in the jar - while (e.hasMoreElements()) - { - unanalyzedEntries.addElement(((ZipEntry)e.nextElement()).getName()); - } - // We don't need to do dependency analysis on the manifest entry. - unanalyzedEntries.removeElement(MANIFEST_ENTRY_NAME); - - // Give the subclass an opportunity to modify the list. - Vector filesToInclude = new Vector(); - copyVector(filesRequired_, filesToInclude, NO_CHECK_DUPS); - copyVector(filesExcluded_, dependenciesToExclude_, CHECK_DUPS); - filesToInclude = adjustDependencies1(filesToInclude, jarMap); - - // Start marking referenced files, starting with the required files - // that were specified. - if (filesToInclude.size() == 0) - { - if (verbose_ || DEBUG) - System.out.println("No required JAR or ZIP entries were specified"); - } - else - { - if (verbose_ || DEBUG) - System.out.println("Analyzing " + filesToInclude.size() + - " required entries, starting with " + - filesToInclude.elementAt(0) + "."); - Enumeration reqEntries = filesToInclude.elements(); - while (reqEntries.hasMoreElements()) - { - String entryName = (String)reqEntries.nextElement(); - if (DEBUG) System.out.print(":"); - // Verify that the source JAR or ZIP actually contains the required file. - if (!jarMap.contains(entryName)) { - System.err.println("Warning: The source file does not contain " + - "the specified required file: " + entryName); - filesToInclude.removeElement(entryName); - } - else if (unanalyzedEntries.contains(entryName)) - { - unanalyzedEntries.removeElement(entryName); - analyzeJarEntry(entryName, unanalyzedEntries, - referencedJarEntries, jarMap); - addElement(referencedJarEntries, entryName); - } - } - if (verbose_ || DEBUG) System.out.println(); - } - - if (referencedJarEntries.size() == 0 && packages_.size() == 0) // @A3c - { // Assume user wants all the files copied. - if (DEBUG) - System.out.println("Debug: identifyDependencies(): " + - "Adding all files to list"); - copyVector(jarMap.getEntryNames(), referencedJarEntries, NO_CHECK_DUPS); // @A3c - } - - // Give the subclass an opportunity to modify the list. - referencedJarEntries = adjustDependencies2(referencedJarEntries, jarMap); - - // Make sure the "excluded files" don't end up in the jar. - removeElements(referencedJarEntries, filesExcluded_); - - // Sort the list alphabetically. - referencedJarEntries = sortStrings(referencedJarEntries); - - // Add directory entries, e.g. com/, com/ibm/, com/ibm/myproduct/ - referencedJarEntries = insertDirectoryEntries(referencedJarEntries); - - return referencedJarEntries; - } - - - /** - Inserts directory entries into a list of ZIP entry names. - For example, if the list contains - com/ibm/product/foo.class, - this method will insert the following entries (if they aren't - already in the list): - com/ - com/ibm/ - com/ibm/product/ - @param oldList The list of ZIP entry names (String objects). - Assumed to be sorted alphabetically. - @return The list with directory entries added. - **/ - private static Vector insertDirectoryEntries(Vector oldList) - { - String priorPrefix = ""; - Vector newList = new Vector(oldList.size()); - Enumeration e = oldList.elements(); - while (e.hasMoreElements()) - { - String listEntry = (String)e.nextElement(); - String prefix = listEntry.substring(0, listEntry.lastIndexOf("/")+1); - if (!prefix.equals(priorPrefix)) - { - priorPrefix = prefix; - // Add any parent directories if not already in list. - int slashPos = prefix.indexOf("/"); - while (slashPos != -1) - { - String subPrefix = prefix.substring(0, slashPos+1); - if (!(newList.contains(subPrefix)) && - !(subPrefix.equals(listEntry))) - { - newList.addElement(subPrefix); - } - slashPos = prefix.indexOf("/",slashPos+1); - } - } - newList.addElement(listEntry); - } - return newList; - } - - - /** - Indicates if extract was specified. - This method is provided for internal use. - @return true if extract was specified, - false otherwise. - **/ - boolean isExtract() { return extract_; } - - - /** - Indicates if sufficient option information was specified. - This method is provided for use by subclasses. - @return true if sufficient info was specified, - false otherwise. - **/ - boolean isOptionInfoSufficient() { return arguments_.isOptionInfoSufficient(); } - - - /** - Indicates if split was specified. - This method is provided for internal use. - @return true if split was specified, - false otherwise. - **/ - boolean isSplit() { return split_; } - - - /** - Indicates whether verbose mode is in effect. - This method is provided for internal use. - @return true if verbose mode has been set; - false otherwise. - **/ - boolean isVerbose() { return verbose_; } - - - /** Internal utility that prints out the command-line options, when in verbose mode. **/ - static String listCommandOptions(CommandLineArguments arguments, boolean listAll) - { - StringBuffer sb = new StringBuffer(); - Enumeration opts; - if (listAll) opts = arguments.getOptionNames(); - else opts = arguments.getExtraOptions(); - - while (opts.hasMoreElements()) { - String name = (String)opts.nextElement(); - sb.append(" [" + name); - String val = arguments.getOptionValue(name); - if (val != null && val.length() != 0) sb.append(" " + val); - sb.append("]"); - } - return sb.toString().trim(); - } - - - /** - Generates a smaller JAR or ZIP file, containing only the desired entries - and their dependencies. - - @param sourceJarFile The source JAR or ZIP file. - @return The destination JAR or ZIP file. - @exception FileNotFoundException If the source file does not exist. - @exception IOException If an I/O error occurs when reading the source file - or writing the destination file. - @exception ZipException If a ZIP error occurs when reading the source file - or writing the destination file. - **/ - public File makeJar(File sourceJarFile) - throws FileNotFoundException, IOException, ZipException - { - if (sourceJarFile == null) throw new NullPointerException("sourceJarFile"); - File destinationJarFile = - setupDefaultDestinationJarFile(sourceJarFile); - makeJar(sourceJarFile, destinationJarFile); - return destinationJarFile; - } - - - /** - Generates a smaller JAR or ZIP file, containing only the desired entries - and their dependencies. - - @param sourceJarFile The source JAR or ZIP file. - @param destinationJarFile The destination JAR or ZIP file. - @exception FileNotFoundException If the source file does not exist. - @exception IOException If an I/O error occurs when reading the source file - or writing the destination file. - @exception ZipException If a ZIP error occurs when reading the source file - or writing the destination file. - **/ - public void makeJar(File sourceJarFile, File destinationJarFile) - throws FileNotFoundException, IOException, ZipException - { - if (sourceJarFile == null) - throw new NullPointerException("sourceJarFile"); - if (destinationJarFile == null) - throw new NullPointerException("destinationJarFile"); - if (!sourceJarFile.exists()) - throw new FileNotFoundException(sourceJarFile.getAbsolutePath()); - if (destinationJarFile.exists() && !destinationJarFile.canWrite()) { - System.err.println("Error: Cannot write file"); - System.err.println(" " + destinationJarFile.getAbsolutePath()); - throw new IOException(destinationJarFile.getAbsolutePath()); - } - - if (verbose_ || DEBUG) { - System.out.println("Source file is " + sourceJarFile.getAbsolutePath()); - System.out.println("Destination file is " + - destinationJarFile.getAbsolutePath()); - } - - // Check that the destination files isn't the source file. - if (destinationJarFile.getAbsolutePath().equals(sourceJarFile.getAbsolutePath())) - { - System.err.println("Error: Destination file is same as source file."); - throw new IllegalArgumentException("destinationJarFile(" + - destinationJarFile.getAbsolutePath() + ")"); - } - - JarMap jarMap = null; // Map of entries in the source JAR or ZIP. - ManifestMap manifestMap = null; // Map of the source JAR's manifest. - // (If ZIP file, the map will be empty.) - ZipOutputStream zipOutStream = null; // Stream for writing destination file. - InputStream inStream = null; - BufferedOutputStream bufferedOutStream = null; - - try - { - // Make a map of the source file. - jarMap = new JarMap(sourceJarFile, verbose_); - - // Get sorted list of the names of the entries that will be required - // in the destination file. - Vector referencedJarEntries = identifyDependencies(jarMap); - - // Verify the existence of any "additional files" that were specified. - Enumeration e1 = additionalFiles_.keys(); - while (e1.hasMoreElements()) - { - File file = (File)e1.nextElement(); - if (!file.exists() || !file.isFile()) - { - System.err.println("Error: A specified additional file was not found:"); - System.err.println(" " + file.getAbsolutePath()); - } - } - - // Prepare a list of ZIP entry names for any additional files that - // were specified. If any of these match an existing ZIP entry, - // withhold the existing ZIP entry from the destination file. - - // Make a map of (File) to (ZIP entry name) - Hashtable additionalFilesMap = generateJarEntryMap(additionalFiles_); - - // Open a stream for writing to the destination file. - if (verbose_ || DEBUG) - { - System.out.println(); - System.out.println("Opening destination file " + - destinationJarFile.getAbsolutePath()); - } - bufferedOutStream = - new BufferedOutputStream(new FileOutputStream(destinationJarFile), - BUFFER_SIZE); - zipOutStream = new ZipOutputStream(bufferedOutStream); - - // Regenerate the manifest file. We need to read it completely before - // writing, so we can set up the ZIP entry with the correct size. - - if (jarMap.hasManifest()) - { - manifestMap = new ManifestMap(jarMap); - StringBuffer buffer = new StringBuffer(); - - // Copy the manifest header entries if present. - String manifestHeader = manifestMap.getHeader(); - if (manifestHeader.length() != 0) - buffer.append(manifestHeader); - - // Copy manifest entries for all referenced files. - Enumeration e3 = manifestMap.elements(); - while (e3.hasMoreElements()) - { - String fileName = (String)e3.nextElement(); - if (referencedJarEntries.contains(fileName) && - !additionalFilesMap.contains(fileName)) - { - String manifestEntryText = (String)(manifestMap.get(fileName)); - buffer.append(manifestEntryText); - } - } - - // Create manifest entries for any additional files. - if (additionalFiles_.size() != 0) - { - if (verbose_ || DEBUG) System.out.println("Creating manifest entries " + - "for additional files"); - Enumeration af = additionalFiles_.keys(); - while (af.hasMoreElements()) - { - File file = (File)af.nextElement(); - String entryName = (String)(additionalFilesMap.get(file)); - constructManifestEntry(buffer, file, entryName); - } - } - - // Now that we know how big the new manifest file is, - // write it to the destination JAR. - byte[] bufferBytes = buffer.toString().getBytes(); - ZipEntry newManifestEntry = new ZipEntry(MANIFEST_ENTRY_NAME); - newManifestEntry.setSize(bufferBytes.length); - zipOutStream.putNextEntry(newManifestEntry); - zipOutStream.write(bufferBytes); - zipOutStream.flush(); - bufferedOutStream.flush(); // java bug 4077821 - zipOutStream.closeEntry(); - bufferedOutStream.flush(); // this might be overkill - } - - // Copy the referenced files to the destination. - if (DEBUG) - System.out.println("Debug: Copying referenced ZIP entries(" + - referencedJarEntries.size() + ")"); - Vector directoriesSoFar = new Vector(); // directory entries created - Enumeration refEntries = referencedJarEntries.elements(); - while (refEntries.hasMoreElements()) - { - String referencedEntry = (String)refEntries.nextElement(); - if (verbose_) System.out.print("."); - if (DEBUG) System.out.println(referencedEntry); - - // Copy this entry if it's not also in the "additional files" list. - if (!additionalFilesMap.contains(referencedEntry)) - { - if (referencedEntry.endsWith("/")) - directoriesSoFar.addElement(referencedEntry); - - // Gather information from the source file. - ZipEntry entry = jarMap.getEntry(referencedEntry); - if (entry == null) - { - // Tolerate missing directory entries in source jar. - if (referencedEntry.endsWith("/")) { - if (DEBUG) System.err.println(referencedEntry + - ": Missing directory entry in source file."); - } - else - throw new IOException(referencedEntry + - ": No such entry in source file."); - } - else - { - inStream = jarMap.getInputStream(entry); - // Design note - ZipFile.getInputStream() returns a - // java.util.zip.InflaterInputStream object. Therefore - // the current implementation causes each ZIP entry to be - // decompressed and recompressed as it is copied from the - // source file to the destination file. - // If we need to improve performance, try to - // find a way to copy entries without decompressing. - // (See Java bug 4085767) - - // Copy the ZIP entry to the destination file. - copyZipEntry(entry, inStream, zipOutStream); - zipOutStream.flush(); - bufferedOutStream.flush(); // java bug 4077821 - zipOutStream.closeEntry(); - bufferedOutStream.flush(); // this might be overkill - inStream.close(); - inStream = null; - } - } - } // ... while - if (verbose_ || DEBUG) System.out.println(); - - - // Copy any additional files to destination file. - - if (DEBUG) System.out.println("Debug: Copying " + - additionalFiles_.size() + - " additional files"); - Enumeration addlFiles = additionalFiles_.keys(); - while (addlFiles.hasMoreElements()) - { - File file = (File)addlFiles.nextElement(); - - // Prepare to copy the file to the destination file. - String entryName = (String)(additionalFilesMap.get(file)); - - // Make sure any needed directory entries get added first. - Vector dirsToAdd = - generateDirEntries(entryName, directoriesSoFar); - Enumeration de = dirsToAdd.elements(); - while (de.hasMoreElements()) { - String dirName = (String)de.nextElement(); - ZipEntry dirEntry = new ZipEntry(dirName); - dirEntry.setSize(0); - zipOutStream.putNextEntry(dirEntry); - zipOutStream.flush(); - bufferedOutStream.flush(); // java bug 4077821 - zipOutStream.closeEntry(); - bufferedOutStream.flush(); // this might be overkill - directoriesSoFar.addElement(dirName); - } - - ZipEntry entry = new ZipEntry(entryName); - entry.setSize(file.length()); - - // Note for future enhancement: Verify timestamps on the various platforms, - // since lastModified() is system dependent. Javadoc says: - // "The return value is system dependent and should only be - // used to compare with other values returned by last modified. - // It should not be interpreted as an absolute time." - entry.setTime(file.lastModified()); - - inStream = - new BufferedInputStream(new FileInputStream(file), BUFFER_SIZE); - // Copy the entry to the destination file. - zipOutStream.putNextEntry(entry); - copyBytes(inStream, zipOutStream, entry.getSize()); - zipOutStream.flush(); - bufferedOutStream.flush(); // java bug 4077821 - zipOutStream.closeEntry(); - bufferedOutStream.flush(); // this might be overkill - inStream.close(); - inStream = null; - } - } - catch (ZipException e) { - System.err.println("Error: ZipException when writing file"); - System.err.println(" " + destinationJarFile.getAbsolutePath() + ":"); - System.err.println(e.toString()); - if (DEBUG) e.printStackTrace(System.err); - throw e; - } - catch (IOException e) { - System.err.println("Error: IOException when writing file"); - System.err.println(" " + destinationJarFile.getAbsolutePath() + ":"); - System.err.println(e.toString()); - if (DEBUG) e.printStackTrace(System.err); - throw e; - } - finally - { - if (manifestMap != null) { - try { manifestMap.close(); } catch (Throwable e) {} - } - if (jarMap != null) { - try { jarMap.close(); } catch (Throwable e) {} - } - if (zipOutStream != null) { - try { zipOutStream.close(); } catch (Throwable e) {} // @A1c - } - if (bufferedOutStream != null) { - try { bufferedOutStream.close(); } catch (Throwable e) {} // @A1c - } - if (inStream != null) { - try { inStream.close(); } catch (Throwable e) {} - } - - } - - } - - - /** - Parses and validates the arguments specified on the command line. - - @param args The command line arguments. - @param tolerateUnrecognizedArgs Whether to tolerate unrecognized args. - @return An indication of whether the parse succeeded. - **/ - boolean parseArgs(String[] args, boolean tolerateUnrecognizedArgs) - { - boolean succeeded = false; - // Wipe the slate clean, in case this JarMaker object is being recycled. - reset(); - if (arguments_.parse(args, this, tolerateUnrecognizedArgs)) - succeeded = true; - return succeeded; - } - - - static final boolean OPTIONS_ALL = true; // list all options - static final boolean OPTIONS_UNRECOGNIZED = false; // list only the 'extra' options - - - /** - Prescan the Constant Pool from a bytecode stream (from a JAR or ZIP file), - looking for class names. - - @param inStream The input stream. - @param contextPackageName The package name for the referencing entry. - @param jarMap A map of the JAR or ZIP file. - @returns The list of constant_pool indexes for class names, as Integer's. - - @exception IOException If an I/O error occurs when reading the JAR or ZIP file. - **/ - // Design note: - // The .class file format is documented at: - // http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html - // - private Vector prescanForClassIndexes(InputStream inStream, - String contextPackageName, - JarMap jarMap) - throws IOException - { - // Initialization. - Vector classIndexes = new Vector(); // List of constant_pool indexes - // for class names. - DataInputStream dataInput = new DataInputStream(inStream); - - // Read the prefix information. - skipBytes(dataInput, 4); // Magic. - skipBytes(dataInput, 2); // Minor version. - skipBytes(dataInput, 2); // Major version. - - // Read the constant pool. Constant pool indices are - // numbered from 1 to constantPoolCount - 1. - int cpCount = dataInput.readUnsignedShort(); - if (DEBUG_CP) - System.out.println("Constant pool count = " + cpCount); - - for (int cpIndex = 1; cpIndex < cpCount; ++cpIndex) - { - // Read the tag. - byte tag = dataInput.readByte(); - if (DEBUG_CP) - System.out.println("Tag number " + cpIndex + " = " + tag); - - // If a "class" entry in the constant_pool pointed to this index - // for its class name, verify that this entry is a utf8 entry. - if (DEBUG_CP && - (tag != 1) && - (classIndexes.contains(new Integer(cpIndex)))) - System.err.println("Error: Class file format"); - - // Decide what to do based on the tag. - switch (tag) - { - case 1: // CONSTANT_Utf8 - int length = dataInput.readUnsignedShort(); - skipBytes(dataInput, length); - break; - - case 3: // CONSTANT_Integer - case 4: // CONSTANT_Float - skipBytes(dataInput, 4); // Bytes. - break; - - case 5: // CONSTANT_Long - case 6: // CONSTANT_Double - skipBytes(dataInput, 8); // Bytes. - ++cpIndex; // These take up 2 slots! - break; - - case 7: // CONSTANT_Class - int nameIndex = dataInput.readUnsignedShort(); - if (DEBUG_CP) - System.out.println("Found class constant pointing to index " - + nameIndex); - classIndexes.addElement(new Integer(nameIndex)); - break; - - case 8: // CONSTANT_String - skipBytes(dataInput, 2); // String index. - break; - - case 9: // CONSTANT_Fieldref - case 10: // CONSTANT_Methodref - case 11: // CONSTANT_InterfaceMethodref - skipBytes(dataInput, 2); // Class index. - skipBytes(dataInput, 2); // Name and type index. - break; - - case 12: // CONSTANT_NameAndType - skipBytes(dataInput, 2); // Name index. - skipBytes(dataInput, 2); // Descriptor index. - break; - - default: - if (DEBUG_CP) - System.err.println("Ignoring unrecognized tag during prescan: " + tag); - break; - } - } - return classIndexes; - } - - - /** - Processes a bytecode stream (from a JAR or ZIP file), - looking for referenced files. - - @param inStream The input stream. - @param packagePrefix The package prefix for the referencing entry. - @param jarMap A map of the JAR or ZIP file. - @param classIndexes The list of indices that contain references - to classes. List elements are Integer objects. - @returns The output list of referenced classes (ZIP entry names), as String's. - - @exception IOException If an I/O error occurs when reading the JAR or ZIP file. - **/ - // Design note: - // The .class file format is documented at: - // http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html - // - private Vector processBytecodeStream(InputStream inStream, - String packagePrefix, - JarMap jarMap, - Vector classIndexes) - throws IOException - { - // Initialization. - Vector allReferences = new Vector(); // Resulting list of references. - DataInputStream dataInput = new DataInputStream(inStream); - - // Read the prefix information. - skipBytes(dataInput, 4); // Magic. - skipBytes(dataInput, 2); // Minor version. - skipBytes(dataInput, 2); // Major version. - - // Read the constant pool. Constant pool indices are - // numbered from 1 to constantPoolCount - 1. - int cpCount = dataInput.readUnsignedShort(); - if (DEBUG_CP) - System.out.println("Constant pool count = " + cpCount); - for (int cpIndex = 1; cpIndex < cpCount; ++cpIndex) - { - // Read the tag. - byte tag = dataInput.readByte(); - if (DEBUG_CP) - System.out.println("Tag number " + cpIndex + " = " + tag); - - // If a "class" entry in the constant_pool pointed to this index - // for its class name, verify that this entry is a utf8 entry. - if (DEBUG_CP) - if ((tag != 1) && (classIndexes.contains(new Integer(cpIndex)))) - System.err.println("Error: Class file format"); - - // Decide what to do based on the tag. - switch (tag) - { - case 1: // CONSTANT_Utf8 - int length = dataInput.readUnsignedShort(); - if (length <= 0) - { - if (DEBUG_CP) - System.err.println("Bad length in apparent CONSTANT_Utf8: " + length); - } - else - { - byte[] bytes = new byte[length]; - dataInput.readFully(bytes); - String referencedJarEntry = - processUtf8(cpIndex, new String(bytes,"UTF8"), - classIndexes, packagePrefix, jarMap); - if (referencedJarEntry != null) - allReferences.addElement(referencedJarEntry); - } - break; - - case 3: // CONSTANT_Integer - case 4: // CONSTANT_Float - skipBytes(dataInput, 4); // Bytes. - break; - - case 5: // CONSTANT_Long - case 6: // CONSTANT_Double - skipBytes(dataInput, 8); // Bytes. - ++cpIndex; // These take up 2 slots! - break; - - case 7: // CONSTANT_Class - int nameIndex = dataInput.readUnsignedShort(); - if (DEBUG_CP) - System.out.println("Found class constant pointing to index " - + nameIndex); - break; - - case 8: // CONSTANT_String - skipBytes(dataInput, 2); // String index. - break; - - case 9: // CONSTANT_Fieldref - case 10: // CONSTANT_Methodref - case 11: // CONSTANT_InterfaceMethodref - skipBytes(dataInput, 2); // Class index. - skipBytes(dataInput, 2); // Name and type index. - break; - - case 12: // CONSTANT_NameAndType - skipBytes(dataInput, 2); // Name index. - skipBytes(dataInput, 2); // Descriptor index. - break; - - default: - if (DEBUG_CP) - System.err.println("Ignoring unrecognized tag: " + tag); - break; - } - } - return allReferences; - } - - - /** - Processes a Utf8 literal. - - @param cpIndex The constant pool index. - @param literal The literal. - @param classIndexes The list of indices that contain references - to classes. - @param contextPackageName The package name to prepend to gif files. - @param jarMap A map of the source JAR or ZIP file. - @returns The name of the referenced ZIP entry name. - null if a corresponding ZIP entry was not found in source file. - **/ - private String processUtf8(int cpIndex, - String literal, - Vector classIndexes, - String contextPackageName, - JarMap jarMap) - { - if (DEBUG_CP) System.out.println("processUtf8(" + literal + ")"); - String result = null; - - // If this index was flagged as one with a CONSTANT_class - // structure, then it is a referenced class. - if (classIndexes.contains(new Integer(cpIndex))) - { - // Also verify that the class is in the source file, and - // not the JDK or some primitive class like [[B (byte array). - String classFileName = literal + CLASS_SUFFIX; - if (jarMap.contains(classFileName)) - result = classFileName; - } - - // Check if this could be a reference to a properties - // file or a class loaded with Class.forName(). - else if ((contextPackageName.length() != 0 && - literal.startsWith(contextPackageName)) || - ((jarEntryDefaultPrefix_ != null) && - ((literal.startsWith(jarEntryDefaultPrefix_)) || - (literal.startsWith(jarEntryDefaultPrefixDotted_))))) - { - // Check if it might be a properties file. - String propertiesFileName = literal.replace('.','/') + ".properties"; - if (jarMap.contains(propertiesFileName)) - result = propertiesFileName; - - // Check if it is a class loaded with Class.forName(). - else - // Design note: Might want to make both checks regardless. - // The mystery literal might refer to either a properties file, - // a class file, both, or neither. For example, there might be - // both "foo.class" and "foo.properties" in the source JAR or ZIP. - { - String classFileName = literal.replace('.','/') + CLASS_SUFFIX; - if (jarMap.contains(classFileName)) - result = classFileName; - } - } - - // Check if this could be a reference to a gif or jpg file. - // The Unity JAR may also contain files of type html, pdml, - // pcml, and ser. - - // These references do not necessarily include the package name. - // Thus we use the contextPackageName to make our best guess. - // Note for future enhancement - May need to add logic to look for other occurrences - // of the file in other packages within the source JAR or ZIP. - - else - { - String suffix = null; - int dotPos = literal.lastIndexOf('.'); - if (dotPos != -1) suffix = literal.substring(dotPos).toLowerCase(); - if ((suffix != null) && - (suffix.equals(".gif") || - suffix.equals(".jpg") || - suffix.equals(".html") || - suffix.equals(".pdml") || - suffix.equals(".pcml") || - suffix.equals(".ser"))) - { - String gifFileName = null; - if (contextPackageName.length() != 0) - { - gifFileName = contextPackageName.replace('.','/') + - "/" + literal; - if (jarMap.contains(gifFileName)) // try with package prefix - result = gifFileName; - else if (jarMap.contains(literal)) // try with no package prefix - result = literal; - else if (DEBUG) - System.err.println("Debug: Referenced file not found in jar: " + - literal); - } - else if (jarMap.contains(literal)) // try with no package prefix - result = literal; - else if (DEBUG) - System.err.println("Debug: JAR does not contain referenced file: " + - literal); - } - else if (DEBUG_CP) - { - int endIndex = 80; // just print out the first 80 chars - if (literal.length() < 80) endIndex = literal.length(); - System.err.println("processUtf8: Ignoring reference: " + - literal.substring(0,endIndex)); - } - } - return result; - } - - - /** - Removes a listener from the listener list. - - @param listener The listener. - **/ - public synchronized void removeJarMakerListener(JarMakerListener listener) - { - if (listener == null) throw new NullPointerException("listener"); - eventListeners_.removeElement(listener); - } - - - /** - Resets the JarMaker object to a clean, default state, - to facilitate object reuse. - **/ - public void reset() - { - sourceJarFile_ = null; - destinationJarFile_ = null; - filesRequired_.removeAllElements(); - filesExcluded_.removeAllElements(); - packages_.removeAllElements(); - packagesExcluded_.removeAllElements(); - additionalFiles_.clear(); - verbose_ = false; - extract_ = false; - baseDirectoryForExtract_ = new File(System.getProperty("user.dir")); - split_ = false; - splitSize_ = SPLIT_SIZE_KBYTES; - eventListeners_.removeAllElements(); - arguments_ = new Arguments(); - - // Note: jarEntryDefaultPrefix_ and jarEntryDefaultPrefixDotted_ - // are set in the constructor only, so leave them unchanged. - } - - - /** - Specifies additional files to include in the destination JAR or ZIP file. - These are files that reside outside of the source JAR or ZIP file. - If an additional file resolves to the same entry name as an existing - entry in the source file, the additional file will replace the - existing entry in the generated JAR or ZIP file. - When deriving ZIP entry names, - the base directory for the files is the current directory. -
    Note: This augments any previously specified additional files. - This method does not verify the existence of the specified files. - - @param fileList The additional files to include in the - destination JAR or ZIP file. - The list should contain only java.io.File objects. - **/ - public void setAdditionalFiles(Vector fileList) - { - // Default: Base directory is current directory. - File baseDirectory = new File(System.getProperty("user.dir")); - setAdditionalFiles(fileList, baseDirectory); - } - - - /** - Specifies additional files to include in the destination JAR or ZIP file. - These are files that reside outside of the source JAR or ZIP file. - If an additional file resolves to the same entry name as an existing - entry in the source file, the additional file will replace the - existing entry in the generated JAR or ZIP file. -
    Note: This augments any previously specified additional files. - This method does not verify the existence of the specified files or directory. - - @param fileList The additional files to include in the - destination JAR or ZIP file. - The list should contain only java.io.File objects. - @param baseDirectory The base directory for the specifed files. This path - is used when assigning a ZIP entry name for the additional file. -
    The path below this directory - should match the package name sequence for the files. - For example, if the additional file is - C:\dir1\subdir2\com\ibm\myproduct\MyClass.class, - and class MyClass is in package com.ibm.myproduct, - then the base directory should be set to C:\dir1\subdir2. - **/ - public void setAdditionalFiles(Vector fileList, File baseDirectory) - { - if (fileList == null) - throw new NullPointerException("fileList"); - if (baseDirectory == null) - throw new NullPointerException("baseDirectory"); - // Check for nulls and for correct element type. - fileList = validateList(fileList, "additionalFile", - "java.io.File", verbose_); - Enumeration e = fileList.elements(); - while (e.hasMoreElements()) - { - File file = (File)e.nextElement(); - if (!additionalFiles_.containsKey(file)) { - additionalFiles_.put(file, baseDirectory); - } - } - // Postpone verification of files' existence until we need to read them, - // since we don't want setter throwing "file not found" exceptions. - } - - - /** - Sets the destination JAR or ZIP file. - This method is provided for internal use. - - @param destinationJarFile The destination JAR or ZIP file. - **/ - void setDestinationJar(File destinationJarFile) { - if (destinationJarFile == null) - throw new NullPointerException("destinationJarFile"); - destinationJarFile_ = destinationJarFile; - } - - - /** - Sets the extract mode on or off. - This method is provided for internal use when parsing command-line args. - - @param extract If true, turn extract mode on; - otherwise turn extract mode off. - **/ - void setExtract(boolean extract) { extract_ = extract; } - - - /** - Sets the base directory for the directory tree into which the - source JAR or ZIP file is to be extracted. - This method is provided for internal use. - - @param baseDirectory The base directory for the extraction. - **/ - void setExtractionDirectory(File baseDirectory) - { baseDirectoryForExtract_ = baseDirectory; } - - - /** - Specifies the names of packages that are to be included in the output. - Packages are specified in standard syntax, such as com.ibm.component. - The specified packages are simply included in the output. - No additional dependency analysis is done on the files in a package, - unless those files are also specified as required files. -
    Note: This augments any previously specified packages. - This method does not verify the existence of the specified packages - in the source JAR or ZIP file. - - @param packages The required packages. - The list should contain only String objects. - **/ - public void setPackages(Vector packages) - { - if (packages == null) - throw new NullPointerException("packages"); - // Check for nulls and for correct element type. - packages = validateList(packages, "packageName", - "java.lang.String", verbose_); - copyVector(packages, packages_, CHECK_DUPS); // @A3c - } - - - /** - Specifies the names of packages that are to be excluded from the output. - Packages are specified in standard syntax, such as com.ibm.component. -
    Note: This augments any previously specified packages. - - @param packages The packages to be excluded. - The list should contain only String objects. - **/ - public void setPackagesExcluded(Vector packages) - { - if (packages == null) - throw new NullPointerException("packages"); - // Check for nulls and for correct element type. - packages = validateList(packages, "packageName", - "java.lang.String", verbose_); - copyVector(packages, packagesExcluded_, CHECK_DUPS); - } - - - /** - @deprecated Use setFilesRequired() instead. - **/ - public void setRequiredFiles(Vector entryList) - { - setFilesRequired(entryList); - } - - - /** - Specifies the names of required entries in the source JAR or ZIP file. - The names are specified in JAR entry name syntax, such as - com/ibm/component/className.class. -
    Note: This augments any previously specified required entries. - This method does not verify the existence of the specified entries - in the source file. - - @param entryList The names of required JAR or ZIP entries. - The list should contain only String objects. - **/ - public void setFilesRequired(Vector entryList) - { - if (entryList == null) - throw new NullPointerException("entryList"); - // Check for nulls and for correct element type. - entryList = validateList(entryList, "entryName", - "java.lang.String", verbose_); - copyVector(entryList, filesRequired_, CHECK_DUPS); // @A3c - } - - - /** - Specifies the names of entries in the source JAR or ZIP file that are to be excluded from the target. - The names are specified in JAR entry name syntax, such as - com/ibm/component/className.class. -
    Note: This augments any previously specified excluded entries. - This method does not verify the existence of the specified entries - in the source file. - - @param entryList The names of JAR or ZIP entries to be excluded. - The list should contain only String objects. - **/ - public void setFilesExcluded(Vector entryList) - { - if (entryList == null) - throw new NullPointerException("entryList"); - // Check for nulls and for correct element type. - entryList = validateList(entryList, "entryName", - "java.lang.String", verbose_); - copyVector(entryList, filesExcluded_, CHECK_DUPS); - } - - - /** - Sets the source JAR or ZIP file. - This method is provided for internal use. - - @param sourceJarFile The source JAR or ZIP file. - **/ - void setSourceJar(File sourceJarFile) - { - if (sourceJarFile == null) - throw new NullPointerException("sourceJarFile"); - sourceJarFile_ = sourceJarFile; - } - - - /** - Sets the split mode on or off. - This method is provided for internal use. - - @param split If true, turn split mode on; - otherwise turn split mode off. - **/ - void setSplit(boolean split) { split_ = split; } - - - /** - Sets the maximum file size for the destination JAR or ZIP files that - are produced by the split() method. - This method is provided for internal use. - - @param splitSize The maximum file size for the destination JAR or ZIP files; - in units of kilobytes (1024 bytes). - **/ - void setSplitSize(int splitSize) { splitSize_ = splitSize; } - - - /** - Generates a default destination JAR or ZIP file name, - based on the name of the source file. - - @param sourceJarFile The source JAR or ZIP file. - @return A default destination JAR or ZIP file. - **/ - static File setupDefaultDestinationJarFile(File sourceJarFile) - { - String sourceJarName = sourceJarFile.getName(); - int index = sourceJarName.lastIndexOf('.'); - String destinationJarName; - String suffix = "Small"; - if (index == -1) - destinationJarName = sourceJarName + suffix; - else - destinationJarName = sourceJarName.substring(0, index) - + suffix + sourceJarName.substring(index); - // Put it in the current directory. - return new File(CURRENT_DIR, destinationJarName); - } - - - /** - Generates a destination JAR or ZIP file name, - based on the name of the source file. - Inserts the specified suffix, before the final ".". - - @param sourceJarFile The source JAR or ZIP file. - @param suffix The suffix to append to the name. - @return A destination JAR or ZIP file. - **/ - private static File setupSplitJarFile(File sourceJarFile, int suffix) - { - String sourceJarName = sourceJarFile.getName(); - String destinationJarName; - int index = sourceJarName.lastIndexOf('.'); - if (index == -1) - destinationJarName = sourceJarName + suffix; - else - destinationJarName = sourceJarName.substring(0, index) - + Integer.toString(suffix) + sourceJarName.substring(index); - // Put it in the current directory. - return new File(CURRENT_DIR, destinationJarName); - } - - - /** - Sets verbose mode 'on'. - **/ - public void setVerbose() { setVerbose(true); } - - - /** - Sets verbose mode on or off. - - @param verbose If true, turn verbose mode on; - otherwise turn verbose mode off. - **/ - public void setVerbose(boolean verbose) { verbose_ = verbose; } - - - private static final void skipBytes(DataInputStream dataInput, int length) - throws IOException - { - int bytesSkipped = dataInput.skipBytes(length); - if (bytesSkipped != length) { - throw new IOException("Fewer bytes skipped ("+bytesSkipped+") than specified ("+length+")."); - } - } - - - /** - Sorts a list of Strings lexicographically. - List entries are compared using String.compareTo(String). - @param originalList The list of Strings to sort. - @return The sorted list. - **/ - static Vector sortStrings(Vector originalList) - { - Vector sortedList = new Vector(originalList.size()); - Enumeration e = originalList.elements(); - while (e.hasMoreElements()) - { - String oldEntry = (String)e.nextElement(); - boolean done = false; - int insertionPosition = sortedList.size(); // default: add at end - Enumeration sorted = sortedList.elements(); - for (int i=0; !done && sorted.hasMoreElements(); ++i) - { - String sortedEntry = (String)sorted.nextElement(); - if ((oldEntry.compareTo(sortedEntry)) < 0) - { - insertionPosition = i; - done = true; - } - } - sortedList.insertElementAt(oldEntry, insertionPosition); - } - return sortedList; - } - - - /** - Splits the specified JAR or ZIP file into smaller JAR or ZIP files - whose size does not exceed 2 megabytes. - No files are added or removed; the entries in the source file - are simply distributed among the generated JAR or ZIP files. - If any single file within the source JAR or ZIP file exceeds - 2 megabytes, a warning is printed to System.err. - - @param sourceJarFile The source JAR or ZIP file. - @return The generated files. - This is a list of java.io.File objects. - @exception FileNotFoundException If the source file does not exist. - @exception IOException If an I/O error occurs when reading the source file - or writing a generated file. - @exception ZipException If a ZIP error occurs when reading the source file - or writing a generated file. - **/ - public Vector split(File sourceJarFile) - throws FileNotFoundException, IOException, ZipException - { - return split(sourceJarFile, SPLIT_SIZE_KBYTES); - } - - - /** - Splits the specified source JAR or ZIP file into smaller JAR or ZIP files - whose size does not exceed the specified number of kilobytes. - No files are added or removed; the entries in the source file - are simply distributed among the destination files. - If any single file within the source file exceeds - the specified size, a warning is printed to System.err. - - @param sourceJarFile The source JAR or ZIP file. - @param splitSizeKbytes The maximum size for the generated JAR or ZIP files - (in kilobytes). Must be greater than zero. - @return The generated files. - This is a list of java.io.File objects. - @exception FileNotFoundException If the source file does not exist. - @exception IOException If an I/O error occurs when reading the source file - or writing a generated file. - @exception ZipException If a ZIP error occurs when reading the source file - or writing a generated file. - **/ - public Vector split(File sourceJarFile, int splitSizeKbytes) - throws FileNotFoundException, IOException, ZipException - { - if (sourceJarFile == null) - throw new NullPointerException("sourceJarFile"); - if (splitSizeKbytes < 1) - throw new IllegalArgumentException("splitSizeKbytes (" + - splitSizeKbytes + ")"); - if (!sourceJarFile.exists()) - throw new FileNotFoundException(sourceJarFile.getAbsolutePath()); - if (verbose_ || DEBUG) { - System.out.println("Source file is " + - sourceJarFile.getAbsolutePath()); - System.out.println("Split size is " + splitSizeKbytes + " kilobytes"); - } - - Vector destJarList = new Vector(); - JarMap jarMap = null; - ManifestMap manifestMap = null; - Long splitSizeLong = new Long(splitSizeKbytes); - long splitSize = splitSizeLong.longValue() * 1024; // Kbytes -> bytes - File currentOutputFile = null; - - try - { - // Design note: Refrain from first deleting any existing JAR files, - // on the chance that the user might actually want to keep them. - - int outFileIndex = 0; - currentOutputFile = setupSplitJarFile(sourceJarFile, outFileIndex++); - - // Simplest case: If the source file is smaller than splitSize, - // just copy it to a single destination file. - if (sourceJarFile.length() <= splitSize) - { - copyFile(sourceJarFile, currentOutputFile); - destJarList.addElement(currentOutputFile); - return destJarList; - } - - // Make a map of the source file. - if (DEBUG) System.out.println("Debug: Making JarMap"); - jarMap = new JarMap(sourceJarFile, verbose_); - manifestMap = new ManifestMap(jarMap); - boolean manifestExists = jarMap.hasManifest(); - int baseMetadataPerZipEntry = jarMap.getSizeOfZipMetadataPerEntry(); - - // Get size of ZIP "end of central directory" record. - int baseMetadataPerZip = jarMap.getSizeOfZipMetadataPerZip(); - // Allow for ZIP metadata for the Manifest entry. - if (manifestExists) - baseMetadataPerZip += - baseMetadataPerZipEntry + 2*(MANIFEST_ENTRY_NAME.length()); - // Design note: For a complete description of the ZIP file - // format, including detailed descriptions of the metadata fields, - // refer to the ZIP specification. It may be downloaded from: - // http://www.pkware.com/download.html - - // Gather names of entries to write to the next output file. - Vector entriesToWriteNext = new Vector(); // ZIP entry names (String's) - // Running total (compressed) size of entries: - long cumulativeSize = baseMetadataPerZip; - - Vector directoriesSoFar = new Vector(); - Vector dirsToAddForThisEntry = null; - - Enumeration e = jarMap.elements(); - while (e.hasMoreElements()) - { - String entryName = (String)e.nextElement(); - ZipEntry entry = jarMap.getEntry(entryName); - if (entry == null) - throw new RuntimeException("Programming error: No JarMap entry for " + - entryName); - if (entry.isDirectory()) directoriesSoFar.addElement(entryName); - - // Get the uncompressed size of this ZIP entry. - // Design note: Since we're not sure we'll be able - // to recompress it to the original compressed size, err on the - // conservative side, rather than risk generating an oversize file. - long entrySize = entry.getSize(); - long entryMetadataSize = baseMetadataPerZipEntry + 2*(entryName.length()); - - // Add size of comment. - String comment = entry.getComment(); - if (comment != null) entryMetadataSize += comment.length(); - - // Add size of extra field data (twice, since it will appear - // in both the Local Field Header and in the Central Directory). - byte[] extraFieldData = entry.getExtra(); - if (extraFieldData != null) { - entryMetadataSize += 2*extraFieldData.length; - if (false && DEBUG_ZIP) - System.out.println("Debug: extraFieldData.length = " + - extraFieldData.length); - } - - // Add size of manifest entry for this file. - // This is the uncompressed size, - // so we will err on the conservative side. - if (manifestExists) - entryMetadataSize += manifestMap.getEntrySize(entryName); - - // Add the size of metadata for any additional directory entries - // that will be needed for this entry. - dirsToAddForThisEntry = - generateDirEntries(entryName, directoriesSoFar); - int directoriesMetadataSize = - determineDirMetadataSize(dirsToAddForThisEntry, - baseMetadataPerZipEntry); - - // If the size of this single entry equals or exceeds the split size, - // write it to its own separate JAR file. - if ((entrySize + entryMetadataSize + baseMetadataPerZip + - directoriesMetadataSize) - >= splitSize) - { - Vector entryToWriteNow = new Vector(); - entryToWriteNow.addElement(entryName); - writeJarEntries(entryToWriteNow, currentOutputFile, jarMap, manifestMap, splitSize, verbose_); - if (currentOutputFile.length() > splitSize) - { - System.err.println("Warning: Oversize ZIP entry " + entryName); - System.err.println(" was written to file " + - currentOutputFile.getAbsolutePath()+"."); - } - destJarList.addElement(currentOutputFile); - currentOutputFile = setupSplitJarFile(sourceJarFile, outFileIndex++); - } - else - { - if ((cumulativeSize + entrySize + entryMetadataSize + - directoriesMetadataSize) > splitSize) - { // Flush the buffer before adding this entry. - writeJarEntries(entriesToWriteNext, currentOutputFile, - jarMap, manifestMap, splitSize, verbose_); - entriesToWriteNext.removeAllElements(); - destJarList.addElement(currentOutputFile); - currentOutputFile = setupSplitJarFile(sourceJarFile, outFileIndex++); - cumulativeSize = baseMetadataPerZip; - - // Recalculate the size of metadata for needed directories. - directoriesSoFar.removeAllElements(); - dirsToAddForThisEntry = - generateDirEntries(entryName, directoriesSoFar); - directoriesMetadataSize = - determineDirMetadataSize(dirsToAddForThisEntry, - baseMetadataPerZipEntry); - } - entriesToWriteNext.addElement(entryName); - if (dirsToAddForThisEntry != null) { - copyVector(dirsToAddForThisEntry, directoriesSoFar, NO_CHECK_DUPS); // @A3c - } - cumulativeSize += (entrySize + entryMetadataSize + - directoriesMetadataSize); - } - } // end of 'while' - - // Write any pending entries. - if (entriesToWriteNext.size() != 0) { - writeJarEntries(entriesToWriteNext, currentOutputFile, - jarMap, manifestMap, splitSize, verbose_); - entriesToWriteNext.removeAllElements(); - destJarList.addElement(currentOutputFile); - } - - // Design note - ZipFile.getInputStream() returns a - // java.util.zip.InflaterInputStream object. Therefore - // the current implementation causes each ZIP entry to be - // decompressed and recompressed as it is copied from the - // source file to the destination file. - // If we need to improve performance, try to - // find a way to copy entries without decompressing. - } - catch (ZipException e) { - System.err.println("Error: ZipException when splitting file"); - System.err.println(" " + sourceJarFile.getAbsolutePath() + ":"); - System.err.println(e.toString()); - if (DEBUG) e.printStackTrace(System.err); - throw e; - } - catch (IOException e) { - System.err.println("Error: IOException when splitting file"); - System.err.println(" " + sourceJarFile.getAbsolutePath() + ":"); - System.err.println(e.toString()); - if (DEBUG) e.printStackTrace(System.err); - throw e; - } - finally - { - if (manifestMap != null) { - try { manifestMap.close(); } catch (Throwable t) {} - } - if (jarMap != null) { - try { jarMap.close(); } catch (Throwable t) {} - } - - } - - return destJarList; - } - - /** - Checks for null pointers, verifies that list entries are of correct - type, and removes duplicate list entries. Checks that Integers have - non-negative values. Trims leading and trailing whitespace from Strings - and checks that they have nonzero length. - Only references to the same object are considered duplicates. - The element sequence is preserved in the returned list. - Does not verify existence of referenced Files. - @param oldList The list to remove duplicate entries from. - @param className The name of the parameter. - @param className The name of the class that the list members are - supposed to be instances of. - @param verbose The verbose output mode. - @return The list without duplicates. - @exception IllegalArgumentException If any element is not of correct - class, or is out of range. - **/ - static Vector validateList(Vector oldList, String parmName, - String className, boolean verbose) - { - if (oldList == null) throw new NullPointerException("list"); - if (parmName == null) throw new NullPointerException("parmName"); - if (className == null) throw new NullPointerException("className"); - // Note: The above exceptions would be due to internal programming errors. - Class expectedClass = null; - try { expectedClass = Class.forName(className); } - catch (ClassNotFoundException e) { // This can only happen if JarMaker has defect - throw new RuntimeException("Programming error: Class not found: " + - className); - } - - Vector newList = new Vector(oldList.size()); - Enumeration e = oldList.elements(); - for (int i=0; e.hasMoreElements(); i++) - { - Object element = e.nextElement(); - if (element == null) - throw new NullPointerException(parmName); - if (!(expectedClass.isInstance(element))) { - String actualClass = element.getClass().getName(); - throw new IllegalArgumentException(parmName + - " (object of class " + actualClass + ")"); - } - if (element instanceof Integer) { - int value = ((Integer)element).intValue(); - if (value < 0) - throw new IllegalArgumentException(parmName + " (" + value + ")"); - } - else if (element instanceof String) { - String elem = ((String)element).trim(); // strip leading/trailing blanks - if (elem.length() == 0) - throw new IllegalArgumentException(parmName + "()"); - element = elem; - } - if (!newList.contains(element)) - newList.addElement(element); - else if (DEBUG) { - System.err.print("Debug: Ignoring duplicate list entry: "); - if (element instanceof String) - System.err.println((String)element); - else if (element instanceof File) - System.err.println(((File)element).getPath()); - else if (element instanceof Integer) - System.err.println(((Integer)element).toString()); - else System.err.println(parmName + " at offset " + i); - } - } - return newList; - } - - - /** - Writes the specified ZIP entries (along with their manifest entries, - in the case of a JAR file) to the specified destination file. - - @param entryNames The names of the entries to copy. This is a list of Strings. - @param outFile The destination file. - @param jarMap A map of the source file. - @param manifestMap A map of the manifest of the source JAR or ZIP file. - In the case of a ZIP file, this is an empty map. - @param splitSize The desired maximum size (bytes) for generated files. - @param verbose The verbose output mode. - @exception FileNotFoundException If the source file does not exist. - @exception IOException If an I/O error occurs when reading the source file - or writing the destination file. - @exception ZipException If a ZIP error occurs when reading the source file - or writing the destination file. - **/ - private static void writeJarEntries(Vector entryNames, File outFile, - JarMap jarMap, ManifestMap manifestMap, - long splitSize, boolean verbose) - throws FileNotFoundException, IOException, ZipException - { - if (entryNames == null) throw new NullPointerException("entryNames"); - if (outFile == null) throw new NullPointerException("outFile"); - if (jarMap == null) throw new NullPointerException("jarMap"); - if (manifestMap == null) throw new NullPointerException("manifestMap"); - - if (verbose) System.out.println("writeJarEntries( " + - outFile.getName() + " )"); - ZipOutputStream zipOutStream = null; - BufferedOutputStream bufferedOutStream = null; - InputStream inStream = null; - - try - { - // Set up a stream through which to write the file. - bufferedOutStream = new BufferedOutputStream(new FileOutputStream(outFile), BUFFER_SIZE); - zipOutStream = new ZipOutputStream(bufferedOutStream); - - // Build the manifest (if needed). - StringBuffer manifestBuffer = new StringBuffer(); - if (jarMap.hasManifest()) - { - String manifestHeader = manifestMap.getHeader(); - if (manifestHeader.length() != 0) - manifestBuffer.append(manifestHeader); - - Enumeration e = entryNames.elements(); - while (e.hasMoreElements()) - { - String entryName = (String)e.nextElement(); - String manifestText = manifestMap.get(entryName); - if (manifestText != null) - manifestBuffer.append(manifestText); - } - } - - // Write the manifest to the file. - if (manifestBuffer.length() != 0) - { - byte[] bufferBytes = manifestBuffer.toString().getBytes(); - ZipEntry newManifestEntry = new ZipEntry(MANIFEST_ENTRY_NAME); - newManifestEntry.setSize(bufferBytes.length); - - try { - zipOutStream.putNextEntry(newManifestEntry); - zipOutStream.write(bufferBytes); - zipOutStream.flush(); - bufferedOutStream.flush(); // java bug 4077821 - zipOutStream.closeEntry(); - bufferedOutStream.flush(); // this might be overkill - } - catch (ZipException e) { - System.err.println("Error: ZipException for manifest entry"); - System.err.println(" " + newManifestEntry.getName() + ":"); - System.err.println(e.toString()); - if (DEBUG) e.printStackTrace(System.err); - throw e; - } - catch (IOException e) { - System.err.println("Error: IOException for manifest entry"); - System.err.println(" " + newManifestEntry.getName() + ":"); - System.err.println(e.toString()); - if (DEBUG) e.printStackTrace(System.err); - throw e; - } - } - - // Write the entries to the file. - Vector directoriesSoFar = new Vector(); // directory entries created - Enumeration e1 = entryNames.elements(); - while (e1.hasMoreElements()) - { - String entryName = (String)e1.nextElement(); - ZipEntry entry = jarMap.getEntry(entryName); - if (entry == null) - System.err.println("Error: Entry not found in source file: " + - entryName); - else - { - // Make sure any needed 'directory' entries get added first. - Vector dirsToAdd = - generateDirEntries(entryName, directoriesSoFar); - Enumeration e2 = dirsToAdd.elements(); - while (e2.hasMoreElements()) { - String dirName = (String)e2.nextElement(); - ZipEntry dirEntry = new ZipEntry(dirName); - dirEntry.setSize(0); - zipOutStream.putNextEntry(dirEntry); - zipOutStream.flush(); - bufferedOutStream.flush(); // java bug 4077821 - zipOutStream.closeEntry(); - bufferedOutStream.flush(); // this might be overkill - directoriesSoFar.addElement(dirName); - } - - // Get an input stream from which to read the ZIP entry. - inStream = jarMap.getInputStream(entry); - // Design note - ZipFile.getInputStream() returns a - // java.util.zip.InflaterInputStream object. Therefore - // the current implementation causes each ZIP entry to be - // decompressed and recompressed as it is copied from the - // source file to the destination file. - // If we need to improve performance, try to - // find a way to copy the entry without decompressing. - - // Copy the ZIP entry to the destination file. - copyZipEntry(entry, inStream, zipOutStream); - zipOutStream.flush(); - bufferedOutStream.flush(); // java bug 4077821 - zipOutStream.closeEntry(); - bufferedOutStream.flush(); // this might be overkill - inStream.close(); - inStream = null; - - // If this is a directory entry, remember that we've seen it. - if (entry.isDirectory()) - directoriesSoFar.addElement(entryName); - } - } // end of 'while' loop - - if (outFile.length() > splitSize) { - System.err.println("Error: Generated file exceeds specified size:"); - System.err.println(" " + outFile.getAbsolutePath()); - } - } - catch (ZipException e) { - System.err.println("Error: ZipException when writing to file"); - System.err.println(" " + outFile.getAbsolutePath() + ":"); - System.err.println(e.toString()); - if (DEBUG) e.printStackTrace(System.err); - throw e; - } - catch (IOException e) { - System.err.println("Error: IOException when writing to file"); - System.err.println(" " + outFile.getAbsolutePath() + ":"); - System.err.println(e.toString()); - if (DEBUG) e.printStackTrace(System.err); - throw e; - } - finally - { - if (inStream != null) { - try { inStream.close(); } catch (Throwable t) {} - } - if (zipOutStream != null) { - try { zipOutStream.close(); } catch (Throwable t) {} - } - if (bufferedOutStream != null) { - try { bufferedOutStream.close(); } catch (Throwable t) {} - } - } - } - - - /** - Performs the actions specified in the invocation arguments. - - @param args The command line arguments. - **/ - public static void main(String[] args) - { - try - { - JarMaker jm = new JarMaker(); - - if (jm.parseArgs(args, false)) - { - if (jm.isSplit()) // -split overrides all other options - { - File srcJar = jm.getSourceJar(); - int splitSize = jm.getSplitSize(); - jm.split(srcJar, splitSize); // unpack required files - } - else if (jm.isExtract()) - { - File srcJar = jm.getSourceJar(); - File outputDir = jm.getExtractionDirectory(); - jm.extract(srcJar, outputDir); // unpack required files - } - else - { - File srcJar = jm.getSourceJar(); - File destJar = jm.getDestinationJar(); - jm.makeJar(srcJar, destJar); // create a new JAR file - } - } - else System.exit(1); - } - catch (Throwable e) { - System.err.println(e.toString()); - e.printStackTrace(System.err); - System.exit(1); - } - - System.exit(0); - } - - - - class Arguments - { - private Vector unrecognizedArgs_ = new Vector(); - private boolean optionsAreSufficient_; - - String [] getUnrecognized() - { - String [] stringArray = new String [unrecognizedArgs_.size()]; - unrecognizedArgs_.copyInto(stringArray); - return stringArray; - } - - - /** - Indicates if sufficient option information was specified. - @return true if sufficient info was specified, - false otherwise. - **/ - boolean isOptionInfoSufficient() { return optionsAreSufficient_; } - - /** - Parses and validates the arguments specified on the command line. - - @param args The command line arguments. - @param jmaker The object to apply the arguments to. - @param tolerateUnrecognizedArgs Whether to tolerate unrecognized args. - @return An indication of whether the parse succeeded. - **/ - boolean parse(String[] args, JarMaker jmaker, - boolean tolerateUnrecognizedArgs) - { - if (args.length == 0) - { - System.err.println("Error: No options were specified."); - // Don't print usage info yet if a subclass will complete the parse. - if (!tolerateUnrecognizedArgs) printUsage(System.err); - return false; - } - - Vector options = new Vector(); - options.addElement("-source"); - options.addElement("-destination"); - options.addElement("-fileRequired"); - options.addElement("-fileExcluded"); - options.addElement("-additionalFile"); - options.addElement("-additionalFilesDirectory"); - options.addElement("-package"); - options.addElement("-packageExcluded"); - options.addElement("-extract"); - options.addElement("-split"); - options.addElement("-verbose"); - options.addElement("-help"); - - Hashtable shortcuts = new Hashtable(); - shortcuts.put("-s", "-source"); - shortcuts.put("-src", "-source"); - shortcuts.put("-so", "-source"); - shortcuts.put("-d", "-destination"); - shortcuts.put("-dest", "-destination"); - shortcuts.put("-fr", "-fileRequired"); - shortcuts.put("-file", "-fileRequired"); - shortcuts.put("-rf", "-fileRequired"); - shortcuts.put("-req", "-fileRequired"); - shortcuts.put("-required", "-fileRequired"); - shortcuts.put("-requiredfile", "-fileRequired"); - shortcuts.put("-fx", "-fileExcluded"); - shortcuts.put("-fileex", "-fileExcluded"); - shortcuts.put("-filesex", "-fileExcluded"); - shortcuts.put("-af", "-additionalFile"); - shortcuts.put("-additional", "-additionalFile"); - shortcuts.put("-afd", "-additionalFilesDirectory"); - shortcuts.put("-additionalfilesdir", "-additionalFilesDirectory"); - shortcuts.put("-p", "-package"); - shortcuts.put("-px", "-packageExcluded"); - shortcuts.put("-packageex", "-packageExcluded"); - shortcuts.put("-packagesex", "-packageExcluded"); - shortcuts.put("-x", "-extract"); - shortcuts.put("-sp", "-split"); - shortcuts.put("-v", "-verbose"); - shortcuts.put("-h", "-help"); - - CommandLineArguments arguments = new CommandLineArguments(args, options, shortcuts); - - boolean destinationWasSpecified = false; - Vector filesRequired = null; // Strings - Vector filesExcluded = null; // Strings - Vector additionalFiles = null; // Files - File additionalFilesDir = null; - Vector packages = null; // Strings - Vector packagesExcluded = null; // Strings - String extractionDirName = null; - boolean succeeded = true; - - unrecognizedArgs_ = new Vector(); - - // Examine the arguments. - - String val; - - if (arguments.isOptionSpecified("-verbose")) { - - jmaker.setVerbose(true); - - System.out.print("Arguments parsed by JarMaker:"); - String opts = JarMaker.listCommandOptions(arguments, JarMaker.OPTIONS_ALL); - System.out.println(opts); - - opts = JarMaker.listCommandOptions(arguments, JarMaker.OPTIONS_UNRECOGNIZED); - if (opts.length() != 0) { - System.out.print("Arguments unrecognized by JarMaker: "); - System.out.println(opts); - } - } - - requestedUsageInfo_ = arguments.isOptionSpecified("-help"); - - // See if any args were specified preceding the options. - val = arguments.getOptionValue(""); - if (val != null && val.length() != 0) { - // See if more than 1 token was specified. - val = val.trim(); - StringTokenizer st = new StringTokenizer(val, " "); - if (st.countTokens() > 1) - { - val = st.nextToken(); - StringBuffer sb = new StringBuffer(); - while (st.hasMoreTokens()) { - sb.append(st.nextToken() + " "); - } - System.err.println("Warning: Ignoring extra arguments: " + sb.toString()); - } - setSourceJar(new File(val)); - } - - val = arguments.getOptionValue("-source"); - if (val != null) { - if (val.length() != 0) { - setSourceJar(new File(val)); - } - else { - System.err.println("Warning: No file specified after -source."); - } - } - - val = arguments.getOptionValue("-destination"); - if (val != null) { - if (val.length() != 0) { - setDestinationJar(new File(val)); - destinationWasSpecified = true; // remember not to take the default - } - else { - System.err.println("Warning: No file specified after -destination."); - } - } - - val = arguments.getOptionValue("-fileRequired"); - if (val != null) { - if (val.length() != 0) { - // Parse the list of ZIP entries, separated by commas. - StringTokenizer st = new StringTokenizer(val, ","); - if (st.countTokens() != 0) - { - if (filesRequired == null) - filesRequired = new Vector(st.countTokens()); - while (st.hasMoreTokens()) - filesRequired.addElement(st.nextToken()); - } - } - else { - System.err.println("Warning: No file specified after -fileRequired."); - } - } - - val = arguments.getOptionValue("-fileExcluded"); - if (val != null) { - if (val.length() != 0) { - // Parse the list of ZIP entries, separated by commas. - StringTokenizer st = new StringTokenizer(val, ","); - if (st.countTokens() != 0) - { - if (filesExcluded == null) - filesExcluded = new Vector(st.countTokens()); - while (st.hasMoreTokens()) - filesExcluded.addElement(st.nextToken()); - } - } - else { - System.err.println("Warning: No package specified after -fileExcluded."); - } - } - - val = arguments.getOptionValue("-package"); - if (val != null) { - if (val.length() != 0) { - // Parse the list of packages, separated by commas. - StringTokenizer st = new StringTokenizer(val, ","); - if (st.countTokens() != 0) - { - if (packages == null) { - packages = new Vector(st.countTokens()); - } - while (st.hasMoreTokens()) - packages.addElement(st.nextToken()); - } - } - else { - System.err.println("Warning: No package specified after -package."); - } - } - - val = arguments.getOptionValue("-packageExcluded"); - if (val != null) { - if (val.length() != 0) { - // Parse the list of packages, separated by commas. - StringTokenizer st = new StringTokenizer(val, ","); - if (st.countTokens() != 0) - { - if (packagesExcluded == null) - packagesExcluded = new Vector(st.countTokens()); - while (st.hasMoreTokens()) - packagesExcluded.addElement(st.nextToken()); - } - } - else { - System.err.println("Warning: No package specified after -packageExcluded."); - } - } - - val = arguments.getOptionValue("-additionalFile"); - if (val != null) { - if (val.length() != 0) { - // Parse the list of files, separated by commas. - StringTokenizer st = new StringTokenizer(val, ","); - if (st.countTokens() != 0) - { - if (additionalFiles == null) - additionalFiles = new Vector(st.countTokens()); - while (st.hasMoreTokens()) { - additionalFiles.addElement(new File(st.nextToken())); - } - } - } - else { - System.err.println("Warning: No file specified after -additionalFile."); - } - } - - val = arguments.getOptionValue("-additionalFilesDirectory"); - if (val != null) { - if (val.length() != 0) { - additionalFilesDir = new File(val); - } - else { - System.err.println("Warning: No directory specified after -additionalFilesDirectory."); - } - } - - val = arguments.getOptionValue("-extract"); - if (val != null) { - jmaker.setExtract(true); - if (val.length() != 0) { - jmaker.setExtractionDirectory(new File(val)); - } - } - - val = arguments.getOptionValue("-split"); - if (val != null) { - jmaker.setSplit(true); - if (val.length() != 0) { - int size = 0; - boolean badValue = false; - try { size = Integer.parseInt(val); } - catch (NumberFormatException e) { - System.err.println("Error: Non-integer split size: " + val); - succeeded = false; - badValue = true; - } - if (size < 0) { - System.err.println("Error: Negative split size: " + val); - succeeded = false; - badValue = true; - } - if (!badValue) - jmaker.setSplitSize(size); - } - } - - - // Check for any extra arguments. - Enumeration enum1 = arguments.getExtraOptions(); - while (enum1.hasMoreElements()) { - String optionName = (String)enum1.nextElement(); - String optionVal = arguments.getOptionValue(optionName); - unrecognizedArgs_.addElement(optionName); - if (optionVal != null) unrecognizedArgs_.addElement(optionVal); - if (!tolerateUnrecognizedArgs) { - String optionWithVal = ( optionVal == null ? optionName : optionName + " " + optionVal ); - System.err.println("Error: Unrecognized option: " + optionWithVal); - succeeded = false; - } - } - - if (requestedUsageInfo_) // the -help option was specified - { - if (tolerateUnrecognizedArgs) - return succeeded; // let the subclass print the usage info - else - { - printUsage(System.out); - return false; - } - } - - if (jmaker.getSourceJar() == null) - { - System.err.println("Error: Source JAR or ZIP file was not specified."); - succeeded = false; - } - - else if (jmaker.isSplit()) - { - optionsAreSufficient_ = true; - jmaker.setExtract(false); // '-split' overrides '-extract' - if ((destinationWasSpecified == true) || - (filesRequired != null) || - (filesExcluded != null) || - (packages != null) || - (packagesExcluded != null) || - (additionalFiles != null)) - { - System.err.println("Warning: When -split is specified, " + - "all other options are ignored, except " + - "-source, and -verbose."); - } - } - - else // not a split - { - // Check for sufficient options. - if ((filesRequired == null) && - (filesExcluded == null) && - (additionalFiles == null) && - (packages == null) && - (packagesExcluded == null) && - (!jmaker.isExtract())) - { - if (unrecognizedArgs_.size() == 0 || !tolerateUnrecognizedArgs) { - System.err.println("Error: Need to specify more options."); - succeeded = false; - } - } - else optionsAreSufficient_ = true; - - if (jmaker.isExtract()) - { - if ((destinationWasSpecified == true) || - (additionalFiles != null)) - { - System.err.println ("Warning: When -extract is specified, " + - "the following options are ignored: " + - "-destination, -additionalFile, and " + - "-additionalFilesDirectory."); - } - } - - // Wrap up. - if (!destinationWasSpecified) - { - File destJar = JarMaker.setupDefaultDestinationJarFile(jmaker.getSourceJar()); - jmaker.setDestinationJar(destJar); - } - - // Set any additional files. - if (additionalFilesDir == null) - additionalFilesDir = new File(System.getProperty("user.dir")); - if (additionalFiles != null) - setAdditionalFiles(additionalFiles, additionalFilesDir); - - // Set other lists, now that they've been accumulated. - - if (filesRequired != null) - setFilesRequired(filesRequired); - - if (filesExcluded != null) - setFilesExcluded(filesExcluded); - - if (packages != null) - { - if (packages.size() > 0) - setPackages(packages); - else succeeded = false; // bogus packages - } - - if (packagesExcluded != null) - { - if (packagesExcluded.size() > 0) - setPackagesExcluded(packagesExcluded); - else succeeded = false; // bogus packages - } - - } - - if (!tolerateUnrecognizedArgs && !succeeded) - printUsage(System.err); - - return succeeded; - } - - /** - Prints the usage information. - - @param output The output stream. - **/ - private void printUsage(PrintStream output) - { - output.println(""); - output.println("Usage: "); - output.println(""); - output.println(" JarMaker -source sourceJarFile"); - output.println(" [-destination jarFile]"); - output.println(" [-fileRequired entry1[,entry2[...]]]"); - output.println(" [-fileExcluded entry1[,entry2[...]]]"); - output.println(" [-additionalFile file1[,file2[...]]]"); - output.println(" [-additionalFilesDirectory directory"); - output.println(" [-package pkg1[,pkg2[...]]]"); - output.println(" [-packageExcluded pkg1[,pkg2[...]]]"); - output.println(" [-extract [directory]]"); - output.println(" [-split [kilobytes]]"); - output.println(" [-verbose]"); - output.println(" [-help]"); - output.println(""); - output.println("At least one of the following options must be specified: "); - output.println("-fileRequired, -fileExcluded, -additionalFile, -package, -packageExcluded, -extract, -split"); - } - - } - - - - - static class JarMap - { - private ZipFile zipFile_; // ZipFile view of the JAR file. - private ZipEntry manifest_; // The Manifest entry. - // Null if JAR has no manifest. - - // Names of all entries (except for the Manifest) in the JAR file. - // Entries are arranged in alphabetical order. - // Never null. - private Vector entryList_ = new Vector(); - - //private File jarFile_; - private boolean verbose_; - - // Length of the zipfile comment in the Central Directory Record. - private int zipfileCommentLength_; - - /** - Constructs a JarMap object for the JAR file. - @param jarFile The JAR file. - @exception IOException If an I/O error occurs when reading the JAR file. - @exception ZipException If a ZIP error occurs when reading the JAR file. - **/ - JarMap(File jarFile, boolean verbose) - throws IOException, ZipException - { - if (jarFile == null) - throw new NullPointerException("jarFile"); - - if (!jarFile.isFile()) - throw new FileNotFoundException(jarFile.getAbsolutePath()); - - if (DEBUG) System.out.println("Debug: Creating ZipFile"); - zipFile_ = new ZipFile(jarFile); - //jarFile_ = jarFile; - verbose_ = verbose; - - if (DEBUG) System.out.println("Debug: Getting manifest"); - manifest_ = zipFile_.getEntry(MANIFEST_ENTRY_NAME); - - // Avoid having to sort the entry name list, - // since this can take a very long time if there are many - // entries in the source zip or JAR file. - if (DEBUG) System.out.println("Debug: Gathering entry names"); - InputStream inStream = null; - ZipInputStream zipInStream = null; - try - { - inStream = - new BufferedInputStream(new FileInputStream(jarFile), BUFFER_SIZE); - zipInStream = new ZipInputStream(inStream); - ZipEntry entry = zipInStream.getNextEntry(); - while (entry != null) - { - entryList_.addElement(entry.getName()); - entry = zipInStream.getNextEntry(); - } - } - finally - { - if (zipInStream != null) { - try { zipInStream.close(); inStream = null; } catch (Throwable t) {} - } - if (inStream != null) { - try { inStream.close(); } catch (Throwable t) {} - } - } - - // Design note: ZipFile.entries() does not preserve the - // original sequencing of the ZIP entries. - // We could theoretically build the entryList using - // ZipInputStream.getNextEntry() instead of ZipFile.entries(), - // and thereby preserve the entry sequencing, - // if not for Java bug 4079029, documented at: - // http://developer.java.sun.com/developer/bugParade/bugs/4079029.html - - // Leave the Manifest out of the ZIP entry list. - entryList_.removeElement(MANIFEST_ENTRY_NAME); - } - - // Closes this JarMap. - void close() - { - if (verbose_ || DEBUG) System.out.println("Closing source file"); - entryList_.removeAllElements(); - manifest_ = null; - if (zipFile_ != null) - { - try { zipFile_.close(); } - catch (Exception e) { - System.err.println("Error: While closing source file:"); - System.err.println(e.toString()); - if (DEBUG) e.printStackTrace(System.err); - } - zipFile_ = null; - } - } - - // Indicates whether the JAR contains the specified entry. - boolean contains(String entryName) - { return entryList_.contains(entryName); } - - // Returns the names of all entries in the JAR (except for the Manifest). - // These are String objects. - Enumeration elements() { return entryList_.elements(); } - - // Returns an enumeration of all the entries in the JAR file - // (including the Manifest). - // These are ZipEntry objects. - Enumeration entries() { return zipFile_.entries(); } - - // Returns the names of all entries in the JAR (except for the Manifest). - // These are String objects. - Vector getEntryNames() - { return entryList_; } - - - // Returns the entries (String objects). - ZipEntry getEntry(String entryName) - { return zipFile_.getEntry(entryName); } - - // Returns an input stream for reading the specified entry in the jar. - InputStream getInputStream(ZipEntry entry) - throws IOException, ZipException - { return zipFile_.getInputStream(entry); } - - // Returns the Manifest as a ZIP entry. - // Returns null if the JAR contains no manifest. - ZipEntry getManifest() { return manifest_; } - - int getSizeOfZipMetadataPerZip() - { - int result = 0; - // Add size of fixed fields in the End of Central Directory Record: - result += 22; - // Add size of the "zipfile comment": - result += zipfileCommentLength_; - return result; - } - - int getSizeOfZipMetadataPerEntry() - throws IOException, UnsupportedEncodingException - { - // Total length of all fixed-length zip fields per ZIP entry. - return 88; - } - - // Indicates whether the JAR has a manifest entry. - boolean hasManifest() { return(manifest_ != null); } - - } - - - - - static class ManifestMap - { - - // Names of all entries in the JAR file's manifest. - // Entries are in the order in which they appear in the manifest. - // Never null. - private Vector entryList_ = new Vector(); - - // Map of all entries in the JAR file's manifest. - // Key=entry name, value=String (uncompressed text of the manifest entry). - // Never null. - private Hashtable entryMap_ = new Hashtable(); - - // A map of the JAR which contains this Manifest. - private JarMap jarMap_; - - /** - Constructs a ManifestMap object for a JAR or ZIP file. - In the case of a ZIP file, the ManifestMap will represent an empty list. - @param jarMap A map of the JAR file. - @exception IOException If an I/O error occurs when reading the JAR file. - @exception ZipException If a ZIP error occurs when reading the JAR file. - **/ - ManifestMap(JarMap jarMap) - throws IOException, ZipException - { - if (jarMap == null) - throw new NullPointerException("jarMap"); - - jarMap_ = jarMap; - - ZipEntry manifestEntry = jarMap_.getEntry(MANIFEST_ENTRY_NAME); - if (manifestEntry == null) - System.err.println("Warning: Source file has no manifest." + - " No manifest will be created."); - else - { - BufferedReader reader = null; - try - { - // Set up for reading. We must use a reader because we - // are dealing with text. - reader = new BufferedReader(new InputStreamReader(jarMap.getInputStream(manifestEntry))); - - // Read the manifest file. - if (DEBUG) System.out.println("Debug: Analyzing manifest"); - boolean alreadySawVersion = false; - boolean alreadySawRequiredVersion = false; - String line; - while (reader.ready()) - { - line = reader.readLine(); - if (line != null) // @A1a - { - if (line.startsWith(MANIFEST_NAME_KEYWORD)) // is this a "name" line - { - StringBuffer buffer = new StringBuffer(); - String entryName = line.substring(MANIFEST_NAME_KEYWORD.length()).trim(); - if (DEBUG_MANIFEST) System.out.println("Manifest entry: "); - if (DEBUG_MANIFEST) System.out.println(line); - buffer.append(line); - buffer.append('\n'); - // Copy the rest of this manifest section. - // (sections are terminated by zero-length line) - while (reader.ready() && (line.length() != 0)) - { - line = reader.readLine(); - if (DEBUG_MANIFEST) System.out.println(line); - if (line != null) // @A1a - { - buffer.append(line); - buffer.append('\n'); - } - } - String string = buffer.toString(); - entryMap_.put(entryName, string); - entryList_.addElement(entryName); // this will preserve the sequence - } - else if (!alreadySawVersion && - line.startsWith(MANIFEST_VERSION_KEYWORD)) - { // "Manifest-Version:" - alreadySawVersion = true; - if (DEBUG_MANIFEST) { - String version = line.substring(MANIFEST_VERSION_KEYWORD.length()).trim(); - System.out.println("Manifest version: " + version); - } - entryMap_.put(MANIFEST_VERSION_KEYWORD, line + '\n'); - } - else if (!alreadySawRequiredVersion && - line.startsWith(MANIFEST_REQVERS_KEYWORD)) - { // "Required-Version:" - alreadySawRequiredVersion = true; - if (DEBUG_MANIFEST) { - String version = line.substring(MANIFEST_REQVERS_KEYWORD.length()).trim(); - System.out.println("Required version: " + version); - } - entryMap_.put(MANIFEST_REQVERS_KEYWORD, line + '\n'); - } - } - } // ... while - } - finally - { - if (reader != null) { reader.close(); } - } - } - } - - // Closes this ManifestMap. - void close() - { - if (DEBUG) System.out.println("Closing manifest"); - entryList_.removeAllElements(); - entryMap_.clear(); - jarMap_ = null; - } - - // Indicates whether there is a manifest entry for the specified ZIP entry. - boolean contains(String entryName) - { return entryList_.contains(entryName); } - - // Returns names of all entries in the manifest. These are String objects. - Enumeration elements() { return entryList_.elements(); } - - // Returns the manifest text for the specified entry. - String get(String entryName) - { return (String)(entryMap_.get(entryName)); } - - // Returns the uncompressed size of the specified entry in the manifest. - // If there is no such entry in the manifest, returns zero. - // Design note: For better precision, figure out how to get the - // compressed size. - int getEntrySize(String entryName) - { - int size = 0; - String entryText = (String)(entryMap_.get(entryName)); - if (entryText != null) size = entryText.length(); - return size; - } - - // Returns the manifest header information. - // If no header info, returns zero-length string. - String getHeader() - { - String version = get(MANIFEST_VERSION_KEYWORD); - String reqVersion = get(MANIFEST_REQVERS_KEYWORD); - StringBuffer buffer = new StringBuffer(); - if (version != null) buffer.append(version); - if (reqVersion != null) buffer.append(reqVersion); - return buffer.toString(); - } - - } - -} diff --git a/cvsroot/src/utilities/JarMakerEvent.java b/cvsroot/src/utilities/JarMakerEvent.java deleted file mode 100644 index af576a9dd..000000000 --- a/cvsroot/src/utilities/JarMakerEvent.java +++ /dev/null @@ -1,53 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JarMakerEvent.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package utilities; - -/** - The JarMakerEvent class represents a JarMaker event. -**/ -public class JarMakerEvent extends java.util.EventObject -{ - private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; - static final long serialVersionUID = -8608410039955840303L; - - String jarEntryName_; - - /** - * Constructs a JarMakerEvent object. - * @param source The object where the event originated. - * @param jarEntryName The name of the jar entry being processed. - * For example, com/ibm/as400/access/AS400.class - **/ - public JarMakerEvent (Object source, String jarEntryName) - { - super (source); // note: the superclass checks for null - if (jarEntryName == null) throw new NullPointerException ("jarEntryName"); - - jarEntryName_ = jarEntryName; - } - - /** - * Returns the name of the jar entry being processed. - * @return The name of the jar entry being processed. - * For example, com/ibm/as400/access/AS400.class - **/ - public String getJarEntryName () { return jarEntryName_; } - - /** - * Returns the name of the jar entry being processed. - * @return The name of the jar entry being processed. - * For example, com/ibm/as400/access/AS400.class - **/ - public String toString () { return jarEntryName_; } -} diff --git a/cvsroot/src/utilities/JarMakerListener.java b/cvsroot/src/utilities/JarMakerListener.java deleted file mode 100644 index 11a86db79..000000000 --- a/cvsroot/src/utilities/JarMakerListener.java +++ /dev/null @@ -1,33 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: JarMakerListener.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package utilities; -/** - The JarMakerListener interface provides a listener interface for receiving - JarMaker events. -**/ - -public interface JarMakerListener extends java.util.EventListener -{ - /** - * Reports the start of dependency analysis on a specific entry in a jar file. - * @param event The "analysis started" event. - **/ - public void dependencyAnalysisStarted (JarMakerEvent event); - - /** - * Reports completion of dependency analysis on a specific entry in a jar file. - * @param event The "analysis completed" event. - **/ - public void dependencyAnalysisCompleted (JarMakerEvent event); -} diff --git a/cvsroot/src/utilities/RunJavaApplication.java b/cvsroot/src/utilities/RunJavaApplication.java deleted file mode 100644 index 439e6fd43..000000000 --- a/cvsroot/src/utilities/RunJavaApplication.java +++ /dev/null @@ -1,587 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RunJavaApplication.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package utilities; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.AS400SecurityException; -import com.ibm.as400.access.JavaApplicationCall; -import com.ibm.as400.access.Trace; -import java.beans.PropertyVetoException; -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintStream; -import java.io.PrintWriter; -import java.util.Properties; -import java.util.ResourceBundle; -import java.util.StringTokenizer; -import java.util.Vector; - -/** - * Demonstrates the use of {@link com.ibm.as400.access.JavaApplicationCall JavaApplicationCall}. - * It gathers information from the user about the class to run, then uses a - * JavaApplicationCall object to run the program on the IBM i system's JVM. It - * uses the capabilities of JavaApplicationCall to send input to the Java - * program and displays output the Java program writes to standard out and - * standard error. - * - *

    - * RunJavaApplication has three command line parameters. All parameters are optional. - * - *

      - *
    • system - the name of the system. - *
    • userid - run the Java program under this userid. - *
    • password - the password of the user. - *
    - * - *

    - * Once started, four commands can be run: - *

      - *
    • set - set options to define the JVM environment on the system. - *
    • java - run a Java application on IBM i system. - *
    • help - display help. - *
    • quit - end the application. - *
    - * - *

    - * You can set the following options via the set command. For more information - * on each option display the on-line help for the Java command on the system. - *

      - *
    • Classpath - the CLASSPATH environment variable on the system. - *
    • DefaultPort - the default port for communicating standard in, standard out - * and standard error between the client and the server Java program. - *
    • FindPort - Indicates to search for a port if the specified port is in use - *
    • Interpret - Indicates if all Java class files should be run interpretively. - *
    • Optimize - Optimization level of the Java classes that are not already optimized. - *
    • Options - Options to pass to the IBM i system's JVM. - *
    • SecurityCheckLevel - The level of warnings for writable directories in CLASSPATH. - *
    • GarbageCollectionFrequency - The relative frequency that garbage collection runs. - *
    • GarbageCollectionInitialSize - The initial size, in kilobytes, of the garbage collection heap. - *
    • GarbageCollectionMaximumSize - The maximum size, in kilobytes, that the garbage collection heap can grow to. - *
    • GarbageCollectionPriority - The priority of the tasks running garbage collection. - *
    - * - *

    - * The format of the java command is: - * - *

    -  * java [-classpath=] [-verbose] [-D= [...]] class [ [...]]
    -  * 
    - * - **/ - -public class RunJavaApplication -{ - private static JavaApplicationCall runMain_ = null; - // Where MRI comes from. - private static ResourceBundle resources_ = ResourceBundle.getBundle("utilities.UTMRI"); - private static RunJavaApplicationThread errorThread_ = null; - private static RunJavaApplicationThread inputThread_ = null; - private static RunJavaApplicationThread outputThread_ = null; - private static RunJavaApplicationThread runApplication_ = null; - private static Vector inputLines_ = new Vector(); - private static String classpath_ = ""; - private static String[] option_ = {"*NONE"}; - - /** - * Runs Java programs on the IBM i system's JVM. - * @param parameters The command line parameters. See the prolog - * of this class for information on the command line parameters. - **/ - public static void main(String[] parameters) - { - RunJavaApplication rja = null; - String inputString = null; - - AS400 as400 = new AS400(); - - try - { - if (parameters.length > 0) - as400.setSystemName(parameters[0]); - - if (parameters.length > 1) - as400.setUserId(parameters[1]); - - if (parameters.length > 2) - as400.setPassword(parameters[2]); - - runMain_ = new JavaApplicationCall(as400); - - // starts input,output,error thread - inputThread_ = new RunJavaApplicationThread(runMain_, RunJavaApplicationThread.INPUT); - inputThread_.start(); - - outputThread_ = new RunJavaApplicationThread(runMain_, RunJavaApplicationThread.OUTPUT); - outputThread_.start(); - - errorThread_ = new RunJavaApplicationThread(runMain_, RunJavaApplicationThread.ERROR); - errorThread_.start(); - - runApplication_ = new RunJavaApplicationThread(runMain_, RunJavaApplicationThread.RUN_APPLICATION); - - System.out.print(resources_.getString("REMOTE_PROMPT")); - - while(true) - { - String is = null; - - if (inputLines_.size() > 0) - { - is = (String)inputLines_.elementAt(0); - inputLines_.removeElementAt(0); - } - - if (is != null) - { - if (!runApplication_.isAlive()) - { - inputString = is.toUpperCase().trim(); - - if ((inputString.equals("QUIT")) || (inputString.equals("Q"))) // quit - { - System.exit(0); - } - - else if (inputString.startsWith("JAVA ")) // java - { - if (preProcessJavaCommand(runMain_, is.substring(4))) - { - runApplication_ = new RunJavaApplicationThread(runMain_, RunJavaApplicationThread.RUN_APPLICATION); - runApplication_.start(); - } - else - showPrompt(); - } - - else if (inputString.startsWith("SET ")) // set properties - { - String pair = is.substring("SET ".length()); - String property = null; - String value = null; - int index = pair.indexOf("="); - if ((index > 0) && (!pair.endsWith("="))) - { - property = pair.substring(0,index); - value = pair.substring(index+1); - property = property.trim(); - setProperty(runMain_, property.toUpperCase(), value); - } - else - { - System.out.println(resources_.getString("REMOTE_ERR_SET")); - } - showPrompt(); - } - - else if ((inputString.equals("HELP")) || - (inputString.equals("?")) || - (inputString.equals("H"))) // help - { - showHelp(); - showPrompt(); - } - - else if (inputString.equals("D")) // display properties - { - displayProperties(); - showPrompt(); - } - - else - { - if (inputString.equals("")); // enter - - else if (inputString.equals("JAVA")) - System.out.println(resources_.getString("REMOTE_ERR_JAVA")); - - else if (inputString.equals("SET")) - { - displayProperties(); - // System.out.println(resources_.getString("REMOTE_ERR_SET")); - } - - else - System.out.println(getMRIResource().getString("REMOTE_BAD_COMMAND")); - - showPrompt(); - } - } - else - { // send the string to system - runMain_.sendStandardInString(is); - } - } - - Thread.sleep(100); - - } // end of the loop - } - catch (Throwable e) - { - e.printStackTrace(); - } - } - - /** - Displays the properties. - **/ - private static void displayProperties() - { - StringBuffer optionString = new StringBuffer(); - for (int i = 0 ; i < option_.length ; i++) { - optionString.append(option_[i]); - optionString.append(" "); - } - - System.out.println(getMRIResource().getString("REMOTE_D_LINE1")); - System.out.println(" "+getMRIResource().getString("REMOTE_D_LINE2") + runMain_.getSecurityCheckLevel()); - System.out.println(" "+getMRIResource().getString("REMOTE_D_LINE3") + classpath_); - System.out.println(" "+getMRIResource().getString("REMOTE_D_LINE4") + runMain_.getGarbageCollectionFrequency()); - System.out.println(" "+getMRIResource().getString("REMOTE_D_LINE5") + runMain_.getGarbageCollectionInitialSize()); - System.out.println(" "+getMRIResource().getString("REMOTE_D_LINE6") + runMain_.getGarbageCollectionMaximumSize()); - System.out.println(" "+getMRIResource().getString("REMOTE_D_LINE7") + runMain_.getGarbageCollectionPriority()); - System.out.println(" "+getMRIResource().getString("REMOTE_D_LINE8") + runMain_.getInterpret()); - System.out.println(" "+getMRIResource().getString("REMOTE_D_LINE9") + runMain_.getOptimization()); - System.out.println(" "+getMRIResource().getString("REMOTE_D_LINE10") + optionString.toString()); - System.out.println(" "+getMRIResource().getString("REMOTE_D_LINE11") + runMain_.getDefaultPort()); - System.out.println(" "+getMRIResource().getString("REMOTE_D_LINE12") + runMain_.isFindPort()); - - } - - /** - Loads the resource bundle if not already done. - - @return The resource bundle for this class. - **/ - private static ResourceBundle getMRIResource() - { - if (resources_ == null) - resources_ = ResourceBundle.getBundle("utilities.UTMRI"); - return resources_; - } - - /** - Returns input buffer. - - @return The input buffer used by command line input. - **/ - protected static Vector getInputBuffer() - { - return inputLines_; - } - - /** - Preprocess the java command. - **/ - private static boolean preProcessJavaCommand(JavaApplicationCall jac, String inputStr) - { - - StringTokenizer strToken = new StringTokenizer(inputStr.trim() , " "); - int paramNum = strToken.countTokens(); - - // save strings of strToken into Vector command. - Vector command = new Vector(); - for (int i = 0 ; i < paramNum ; i++) - command.addElement(strToken.nextToken()); - - // 1. find class name - int indexOfClass = 0; - boolean classExist = false; - while(indexOfClass < paramNum) - { - String str = (String)command.elementAt(indexOfClass); - if (str.indexOf("-") == -1) - { - classExist = true; - break; - } - indexOfClass++; - } - - if (!classExist) - { - System.out.println(resources_.getString("REMOTE_ERR_JAVA")); - return false; - } - else - { - // 2. handle -classpath, -verbose, -D - int numOfClasspath = 0; - int numOfVerbose = 0; - int numOfProperty = 0; - boolean tempClasspathExist = false; - boolean verboseExist = false; - - // String properties = ""; - Properties properties = new Properties();; - - for (int i = 0 ; i < indexOfClass ; i++) - { - String env = (String)command.elementAt(0); - command.removeElementAt(0); - String upperEnv = env.toUpperCase(); - if (upperEnv.indexOf("-CLASSPATH=") == 0) - { - numOfClasspath++; - if (numOfClasspath > 1) - { - System.out.println(resources_.getString("REMOTE_ERR_JAVA")); - return false; - } - try - { - int index = env.indexOf("="); - String path = env.substring(index); - if (!(path.endsWith("=") || index <0)) - path = path.replace((char)('='),(char)(' ')) + " "; - else - throw new Exception("classPath"); - jac.setClassPath(path.trim()); - tempClasspathExist = true; - } - catch (Exception e) - { - System.out.println(resources_.getString("REMOTE_ERR_JAVA")); - return false; - } - } - else if (upperEnv.indexOf("-VERBOSE") == 0) - { - numOfVerbose++; - if (numOfVerbose > 1) - { - System.out.println(resources_.getString("REMOTE_ERR_JAVA")); - return false; - } - - String[] curOption = jac.getOptions(); - boolean alreadyExist = false; - for (int j = 0 ; j < curOption.length ; j++) - if (curOption[j].equals("*VERBOSE")) - { - alreadyExist = true; - verboseExist = true; - break; - } - - try - { - if (!alreadyExist) - { - String[] newOpt = new String[curOption.length + 1]; - for (int optidx = 0 ; optidx < curOption.length ; optidx++) - newOpt[optidx] = curOption[optidx]; - newOpt[newOpt.length-1] = "*VERBOSE"; - jac.setOptions(newOpt); - verboseExist = true; - } - } - catch (PropertyVetoException e) - { - System.out.println(resources_.getString("REMOTE_ERR_JAVA")); - return false; - } - } - else if (upperEnv.indexOf("-D") == 0) - { - try - { - int len = "-D".length(); - String prop =env.substring(len); - int index = prop.indexOf("="); - if (!(prop.endsWith("=") || index <=0)) - properties.put(prop.substring(0,index), prop.substring(index+1)); - else - throw new Exception("properties"); - } - catch(Exception e) - { - System.out.println(resources_.getString("REMOTE_ERR_JAVA")); - return false; - } - } - else - { - System.out.println(resources_.getString("REMOTE_ERR_JAVA")); - return false; - } - - } - - // set java application, -D - String application = (String)command.elementAt(0); - command.removeElementAt(0); - try - { - if (!tempClasspathExist) - jac.setClassPath(classpath_); - - if (!verboseExist) - jac.setOptions(option_); - - if (!properties.isEmpty()) - jac.setProperties(properties); - - jac.setJavaApplication(application); - } - catch(Exception e) - { - } - - // 3. handle parameters of java application - Vector appParm = new Vector(); - for (int parmNum = 0 ; parmNum < command.size(); parmNum++) - appParm.addElement((String)command.elementAt(parmNum)); - - try - { - if (appParm.size() > 0) - { - String[] parmArray = new String[appParm.size()]; - for (int i = 0 ; i < appParm.size() ; i++) - parmArray[i] = (String)appParm.elementAt(i); - jac.setParameters(parmArray); - } - } - catch (Exception e) - { - } - } - return true; - } - - - /** - Sets JavaApplicationCall object's property. - **/ - private static void setProperty(JavaApplicationCall jac, String property, String value) - { - try - { - value = value.trim(); - - if (value.length() == 0) - { - System.out.println(resources_.getString("REMOTE_ERR_SET")); - } - else - { - if (property.equals("CLASSPATH")) - { - jac.setClassPath(value); - classpath_ = value; - } - - else if (property.equals("SECURITYCHECKLEVEL")) - jac.setSecurityCheckLevel(value); - - else if (property.equals("OPTION")) - { - StringTokenizer st = new StringTokenizer(value.trim()," "); - String[] options = new String[st.countTokens()]; - - for (int i = 0 ; i < options.length ; i++) - options[i] = st.nextToken(); - - jac.setOptions(options); - option_ = options; - } - - else if (property.equals("INTERPRET")) - jac.setInterpret(value); - - else if (property.equals("GARBAGECOLLECTIONINITIALSIZE")) - { - Integer val = new Integer(value); - jac.setGarbageCollectionInitialSize(val.intValue()); - } - - else if (property.equals("GARBAGECOLLECTIONMAXIMUMSIZE")) - jac.setGarbageCollectionMaximumSize(value); - - else if (property.equals("GARBAGECOLLECTIONFREQUENCY")) - { - Integer val = new Integer(value); - jac.setGarbageCollectionFrequency(val.intValue()); - } - - else if (property.equals("GARBAGECOLLECTIONPRIORITY")) - { - Integer val = new Integer(value); - jac.setGarbageCollectionPriority(val.intValue()); - } - - else if (property.equals("OPTIMIZE")) - jac.setOptimization(value); - - else if (property.equals("DEFAULTPORT")) - { - Integer val = new Integer(value); - jac.setDefaultPort(val.intValue()); - } - - else if (property.equals("FINDPORT")) - { - String val = value.toUpperCase(); - - if (val.equals("TRUE")) - jac.setFindPort(true); - else if (val.equals("FALSE")) - jac.setFindPort(false); - else - System.out.println(getMRIResource().getString("REMOTE_PORT_VALUE_ERROR")); - } - - else - System.out.println(getMRIResource().getString("REMOTE_SET_PROPERTY_1") - + " "+property + " " - + getMRIResource().getString("REMOTE_SET_PROPERTY_2")); - } - } - catch (Throwable e) - { - System.out.println(e); - } - } - - /** - Displays command syntax. - **/ - private static void showHelp() - { - //System.out.println(getMRIResource().getString("REMOTE_HELP_LINE0")); - System.out.println(getMRIResource().getString("REMOTE_HELP_LINE1")); - System.out.println(" " + getMRIResource().getString("REMOTE_HELP_LINE2")); - System.out.println(" " + getMRIResource().getString("REMOTE_HELP_LINE3")); - System.out.println(getMRIResource().getString("REMOTE_HELP_LINE4")); - System.out.println(" " + getMRIResource().getString("REMOTE_HELP_LINE5")); - System.out.println(" " + getMRIResource().getString("REMOTE_HELP_LINE6")); - System.out.println(" " + getMRIResource().getString("REMOTE_HELP_LINE7")); - System.out.println(" " + getMRIResource().getString("REMOTE_HELP_LINE8")); - System.out.println(" " + getMRIResource().getString("REMOTE_HELP_LINE9")); - System.out.println(" " + getMRIResource().getString("REMOTE_HELP_LINE10")); - System.out.println(getMRIResource().getString("REMOTE_HELP_LINE11")); - System.out.println(getMRIResource().getString("REMOTE_HELP_LINE12")); - System.out.println(getMRIResource().getString("REMOTE_HELP_LINE13")); - } - - private static void showPrompt() - { - System.out.println(); - System.out.print(resources_.getString("REMOTE_PROMPT")); - } -} diff --git a/cvsroot/src/utilities/RunJavaApplicationThread.java b/cvsroot/src/utilities/RunJavaApplicationThread.java deleted file mode 100644 index 10ba8af74..000000000 --- a/cvsroot/src/utilities/RunJavaApplicationThread.java +++ /dev/null @@ -1,150 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// JTOpen (IBM Toolbox for Java - OSS version) -// -// Filename: RunJavaApplicationThread.java -// -// The source code contained herein is licensed under the IBM Public License -// Version 1.0, which has been approved by the Open Source Initiative. -// Copyright (C) 1997-2000 International Business Machines Corporation and -// others. All rights reserved. -// -/////////////////////////////////////////////////////////////////////////////// - -package utilities; - -import com.ibm.as400.access.AS400; -import com.ibm.as400.access.JavaApplicationCall; -import com.ibm.as400.access.Trace; -import java.io.InputStreamReader; -import java.io.BufferedReader; -import java.util.ResourceBundle; - -/** - This class is only used by RunJavaApplication class. -**/ -class RunJavaApplicationThread extends Thread -{ - // Indicates which thread should be started. - final static int RUN_APPLICATION = 1; - final static int OUTPUT = 2; - final static int INPUT = 3; - final static int ERROR = 4; - // Where MRI comes from. - private static ResourceBundle resources_ = ResourceBundle.getBundle("utilities.UTMRI"); - - private int threadID_ = 0; - private JavaApplicationCall runMain_ = null; - - /** - Constructor. - **/ - RunJavaApplicationThread(JavaApplicationCall jac, int whichThread) - { - runMain_ = jac; - threadID_ = whichThread; - } - - /** - Start the threads. - **/ - public void run() - { - if (threadID_ == RUN_APPLICATION) - { - System.out.println(resources_.getString("REMOTE_START_PROGRAM") - +" "+runMain_.getJavaApplication()+"\n"); - - boolean success = false; - - try - { - success = runMain_.run(); - } - catch (Exception e) - { - System.out.println(resources_.getString("REMOTE_CALL_JAVA_ERROR")); - System.out.println(e.toString()); - } - - com.ibm.as400.access.AS400Message[] messageList = runMain_.getMessageList(); - - if ((messageList != null) && (messageList.length > 0)) - { - for(int i=0; iIBM Toolbox for Java -JAR or ZIP file, based on the user's requirements. -

    -In addition, ToolboxJarMaker can also be used to: -

      -
    • extract desired files from a JAR or ZIP file; or -
    • split a JAR or ZIP file into smaller JAR or ZIP files. -
    -

    -An ToolboxJarMaker object can be included in the user's program, -or ToolboxJarMaker can be run as a command line program, as follows: -

    -
    -java utilities.ToolboxJarMaker [ options ]
    -
    -
    -ToolboxJarMaker extends the functionality of JarMaker by -additionally allowing the user to specify one or more -IBM Toolbox for Java components, -languages, and/or CCSIDs, and whether or not to include -Java Beans files that are associated with the specified components. - -

    -Options - -

    -

    -
    -source sourceJarFile -
    -Specifies the source JAR or ZIP file from which to derive -the destination JAR or ZIP file. The source file is expected to contain the IBM Toolbox for Java product, and is typically named jt400.jar. -To process a JAR or ZIP other than the Toolbox, use {@link JarMaker JarMaker}. -If a relative path is specified, the path is assumed to be relative to -the current directory. -If this option is specified as the first positional argument, -the tag (-source) is optional. -The -source option may be abbreviated to -s. -The default is jt400.jar, in the current directory. - -

    -

    -destination destinationJarFile -
    -Specifies the destination JAR or ZIP file, which will contain -the desired subset of the files in the source JAR or ZIP file. -If a pathname is not specified, the file is created in the current directory. -The -destination option may be abbreviated to -d. -The default name is generated by appending "Small" to the -source file name. For example, if the source file is jt400.jar, -then the default destination file would be jt400Small.jar. - -

    -

    -fileRequired jarEntry1[,jarEntry2[...] ] -
    -The files in the source JAR or ZIP file that are to be copied to the destination. -Entries are separated by commas (no spaces). -The specified files, along with all of their dependencies, -will be considered required. -Files are specified in JAR entry name syntax, such as com/ibm/as400/access/DataQueue.class. -The -fileRequired option may be abbreviated to -fr. - -

    -

    -fileExcluded jarEntry1[,jarEntry2[...] ] -
    -The files in the source JAR or ZIP file that are to be excluded from the destination, -and from dependency analysis. -Entries are separated by commas (no spaces). -Files are specified in JAR entry name syntax, such as com/ibm/as400/access/DataQueue.class. -The -fileExcluded option may be abbreviated to -fx. - -

    -

    -additionalFile file1[,file2[...] ] -
    -Specifies additional files (not included in the source jar) which are -to be copied to the destination. -Entries are separated by commas (no spaces). -Files are specified by either their -absolute path, or their path relative to the current directory. -
    The specified files will be included, regardless of the settings of -other options. -The -additionalFile option may be abbreviated to -af. - -

    -

    -additionalFilesDirectory baseDirectory -
    -Specifies the base directory for additional files. -This should be the parent directory of the -directory where the package path starts. For example, if file foo.class -in package com.ibm.mypackage is located in directory -C:\dir1\subdir2\com\ibm\mypackage\, then specify base directory C:\dir1\subdir2. -
    The -additionalFilesDirectory option may be abbreviated to -afd. -The default is the current directory. - -

    -

    -package package1[,package2[...] ] -
    -The packages that are required. -Entries are separated by commas (no spaces). -The -package option may be abbreviated to -p. -Package names are specified in standard syntax, such as com.ibm.component. -
    Note: The specified packages are simply included in the output. -No additional dependency analysis is done on the files in a package, -unless they are explicitly specified as required files. - -

    -

    -packageExcluded package1[,package2[...] ] -
    -The packages that are to be excluded. -Entries are separated by commas (no spaces). -The -packageExcluded option may be abbreviated to -px. -Package names are specified in standard syntax, such as com.ibm.component. - -

    -

    -extract [baseDirectory] -
    -Extracts the desired entries of the source JAR into the specified base directory, -without generating a new JAR or ZIP file. This option enables the -user to build up a customized JAR or ZIP file empirically, -based on the requirements of their particular application. -When this option is specified, -additionalFile, --additionalFilesDirectory, and -destination -are ignored. -The -extract option may be abbreviated to -x. -By default, no extraction is done. -The default base directory is the current directory. - -

    -

    -split [splitSize] -
    -Splits the source JAR or ZIP file into smaller JAR or ZIP files. -No ZIP entries are added or removed; -the entries in the source JAR or ZIP file are simply distributed -among the destination JAR or ZIP files. -The split size is in units of kilobytes (1024 bytes), -and specifies the maximum size for the destination files. -The destination files are created in the current directory, -and are named by appending integers to the source file name; -any existing files by the same name are overwritten. -For example, if the source JAR file is myfile.jar, -then the destination JAR files would be -myfile0.jar, myfile1.jar, and so on. -When this option is specified, all other options except --source and -verbose are ignored. -The -split option may be abbreviated to -sp. -The default split size is 2 megabytes (2048 kilobytes). - -

    -

    -component componentID1[,componentID2[...] ] -
    -The IBM Toolbox for Java components that are required. -Entries are separated by commas (no spaces), and are case insensitive. -The -component option may be abbreviated to -c. -
    -See the list of components -that are supported by IBM Toolbox for Java. - -

    -

    -beans -
    -Causes inclusion of all Java Beans files (classes, gifs) that are -directly associated with the specified components. -This option is valid only if -component is also specified. -The -beans option may be abbreviated to -b. -The default is no Beans. - -

    -

    -language language1[,language2[...]] -
    -Specifies the desired languages for the messages produced by the Toolbox classes. -Entries are separated by commas (no spaces). -The languages are identified by their Java locale name, such as fr_CA -(for Canadian French). -
    Note: The shipped jt400.jar file contains only English messages. -The -language option may be abbreviated to -l. -By default, only English messages are included. - -

    -

    -languageDirectory baseDirectory -
    -Specifies the base directory for additional Toolbox language files. -The path below this directory should correspond to the package name -the language files. -For example, if the desired MRI files are located in directories -/usr/myDir/com/ibm/as400/access/ and -/usr/myDir/com/ibm/as400/vaccess/, -then the base directory should be set to /usr/myDir. -
    The -languageDirectory option may be abbreviated to -ld. -By default, language files are searched for relative to the -current directory. - -

    -

    -ccsid ccsid1[,ccsid2[...]] -
    -Specifies the CCSIDs whose conversion tables should be included. -Conversion tables for other CCSIDs will not be included. -Entries are separated by commas (no spaces). -The -ccsid option may be abbreviated to -cc. -By default, all CCSIDs are included. -See the list of CCSIDs and encodings -that are specifically supported by IBM Toolbox for Java. - -

    -

    -ccsidExcluded ccsid1[,ccsid2[...]] -
    -Specifies the CCSIDs whose conversion tables should not be included. -Entries are separated by commas (no spaces). If a CCSID is specified on -both the -ccsid and -ccsidExcluded, it is included, -and a warning message is sent to System.err. -The -ccsidExcluded option may be abbreviated to -cx or -ccx. -By default, all CCSIDs are included. -See the list of CCSIDs and encodings -that are specifically supported by IBM Toolbox for Java. - -

    -

    -excludeSomeDependencies -
    -Indicates that ToolboxJarMaker is allowed to selectively limit -dependency expansion, and exclude certain classes, components and packages -that are unlikely to be needed. -By default, this option is not in effect; that is, all directly- and -indirectly-referenced files in the source JAR file are included. - -

    -

    -noProxy -
    -Specifies that proxy-related class files should not be included. -Proxy files are used internally by the Toolbox's Proxy Service. -If the Proxy Service will not be used, the proxy files are not needed. -The -noProxy option may be abbreviated to -np. -By default, proxy files in the source JAR file are included. - -

    -

    -verbose -
    -Causes progress messages to be displayed. -The -verbose option may be abbreviated to -v. -The default is non-verbose. - -

    -

    -help -
    -Displays the help text. -The -help option may be abbreviated to -h. -The default is non-verbose. - -
    - -

    -At least one of the following options must be specified: -

      -
    • -fileRequired -
    • -fileExcluded -
    • -additionalFile -
    • -package -
    • -packageExcluded -
    • -extract -
    • -split -
    • -component -
    • -language -
    • -ccsid -
    • -ccsidExcluded -
    • -noProxy -
    • -excludeSomeDependencies -
    - -

    -If the following options are specified multiple times in a single command -string, only the final specification applies: -

      -
    • -source -
    • -destination -
    • -additionalFilesDirectory -
    • -extract -
    • -split -
    • -languageDirectory -
    -Other options have a cumulative effect when specified multiple times -in a single command string. - -

    -Example usage -

    -

    -To create a JAR file that contains only those files needed -by the CommandCall and ProgramCall components, -do the following: -

      -
    1. Go to the directory where the jt400.jar file is located. -
    2. Type: -
      -java utilities.ToolboxJarMaker -component CommandCall,ProgramCall
      -
      -
    3. Save a copy of the original jt400.jar for future reference. -
    4. Rename jt400Small.jar to jt400.jar. -
    -

    -To extract from jt400.jar only those files needed -by class com.ibm.as400.access.JDSQLStatement, -using the current directory as the base directory for output, do the following: -

    -java utilities.ToolboxJarMaker -extract -s jt400.jar
    -     -fr com/ibm/as400/access/JDSQLStatement.class
    -
    -Any additional files could then be manually copied into appropriate locations -in the directory tree, and a customized JAR file could be generated using the -jar tool provided as part of the JDK. - - -**/ - -// Design notes -/* -Assumptions: - -This tool will be used only by programmers -and administrators for whom English messages are acceptable. -Hence, no translated MRI is provided with this tool. - -This tool will be used on JDK 1.1 or later. -When we move to JDK 1.2, the implementation of this tool can take -advantage of the utilities in the new java.util.jar package. - -The manifest will be altered based on the list of functions the user specifies. - -We need to generate and put our own Javadoc for this tool. The build process does -not run Javadoc twice because the 'extra' output files (index, table of contents, ...) -would get overlayed. It is easier to run javadoc locally then just put the output file. -(As an alternative in this release, we could ask the builders if they could generate -this javadoc at the same time as our access and vaccess stuff.) - -We are going to include only run-time gifs. Compile time gifs needed by visual builders -will not be put in the JAR unless explicitly specified. -*/ - -// * On-going TBDs: -// * Implementation: Add new components as they are added to Toolbox. -// -// * Implementation: Add new language MRI suffixes as they are supported. -// -// * Implementation: When we move to JDK 1.2, -// we can take advantage of the java.util.jar support. -// - -public class ToolboxJarMaker extends JarMaker -{ - // Constants. - - // Component names that can be specified on the -component option. - static final String[] VALID_COMPONENTS = { - "AS400", "CommandCall", "ConnectionPool", - "DataArea", "DataDescription", "DataQueue", "DigitalCertificate", - "FTP", "IntegratedFileSystem", "JAAS", - "JavaApplicationCall", - "JDBC", "Job", "Message", - "NetServer", "NumericDataTypes", - "PCML", "Print", "ProgramCall", "RecordLevelAccess", "SecureAS400", - "ServiceProgramCall", "SystemStatus", "SystemValue", - "Trace", "User", "UserSpace", - "AS400Visual", "CommandCallVisual", "DataQueueVisual", - "IntegratedFileSystemVisual", "JavaApplicationCallVisual", - "JDBCVisual", "JobVisual", - "MessageVisual", "PrintVisual", "ProgramCallVisual", - "RecordLevelAccessVisual", "UserVisual" - }; - - // Component abbreviations can be specified on the -component option. - static final String[] VALID_COMPONENT_ABBREVS = { - "AS400", "CmdCall", "ConnPool", - "DA", "DD", "DQ", "DigCert", - "FTP", "IFS", "JAAS", - "JavaApp", - "JDBC", "Job", "Msg", - "NetS", "DataType", - "PCML", "Prt", "PgmCall", "RLA", "Secure", - "SvcPgmCall", "SysStat", "SysVal", - "Trace", "User", "UserSpc", - "AS400V", "CmdCallV", "DQV", - "IFSV", "JavaAppV", - "JDBCV", "JobV", - "MsgV", "PrtV", "PgmCallV", - "RLAV", "UserV", - }; - // Note: The following list must be kept in sync with VALID_COMPONENTS. - - /** Specifies the AS400 component. **/ - public static final Integer AS400 = new Integer(0); - /** Specifies the Command Call component. **/ - public static final Integer COMMAND_CALL = new Integer(1); - /** Specifies the Connection Pool component. **/ - public static final Integer CONNECTION_POOL = new Integer(2); - /** Specifies the Data Area component. **/ - public static final Integer DATA_AREA = new Integer(3); - /** Specifies the Data Description component. **/ - public static final Integer DATA_DESCRIPTION = new Integer(4); - /** Specifies the Data Queue component. **/ - public static final Integer DATA_QUEUE = new Integer(5); - /** Specifies the Digital Certificate component. **/ - public static final Integer DIGITAL_CERTIFICATE = new Integer(6); - /** Specifies the FTP component. **/ - public static final Integer FTP = new Integer(7); - /** Specifies the Integrated File System component. **/ - public static final Integer INTEGRATED_FILE_SYSTEM = new Integer(8); - /** Specifies the JAAS component. **/ - public static final Integer JAAS = new Integer(9); - /** Specifies the Java Application Call component. **/ - public static final Integer JAVA_APPLICATION_CALL = new Integer(10); - /** Specifies the JDBC component. **/ - public static final Integer JDBC = new Integer(11); - /** Specifies the Job component. **/ - public static final Integer JOB = new Integer(12); - /** Specifies the Message Queue component. **/ - public static final Integer MESSAGE = new Integer(13); - /** Specifies the NetServer component. **/ - public static final Integer NETSERVER = new Integer(14); - /** Specifies the Numeric Data Types component. **/ - public static final Integer NUMERIC_DATA_TYPES = new Integer(15); - /** Specifies the PCML component. **/ - public static final Integer PCML = new Integer(16); - /** Specifies the Network Print component. **/ - public static final Integer PRINT = new Integer(17); - /** Specifies the Program Call component. **/ - public static final Integer PROGRAM_CALL = new Integer(18); - /** Specifies the Record Level Access component. **/ - public static final Integer RECORD_LEVEL_ACCESS = new Integer(19); - /** Specifies the Secure AS400 component. - This component performs SSL (Secure Sockets Layer) processing. **/ - public static final Integer SECURE_AS400 = new Integer(20); - /** Specifies the Service Program Call component. **/ - public static final Integer SERVICE_PROGRAM_CALL = new Integer(21); - /** Specifies the System Status component. **/ - public static final Integer SYSTEM_STATUS = new Integer(22); - /** Specifies the System Value component. **/ - public static final Integer SYSTEM_VALUE = new Integer(23); - /** Specifies the Trace component. **/ - public static final Integer TRACE = new Integer(24); - /** Specifies the User component. **/ - public static final Integer USER = new Integer(25); - /** Specifies the User Space component. **/ - public static final Integer USER_SPACE = new Integer(26); - /** Specifies the Visual AS400 component. **/ - public static final Integer AS400_VISUAL = new Integer(27); - /** Specifies the Visual Command Call component. **/ - public static final Integer COMMAND_CALL_VISUAL = new Integer(28); - /** Specifies the Visual Data Queue component. **/ - public static final Integer DATA_QUEUE_VISUAL = new Integer(29); - /** Specifies the Visual Integrated File System component. **/ - public static final Integer INTEGRATED_FILE_SYSTEM_VISUAL = new Integer(30); - /** Specifies the Visual Java Application Call component. **/ - public static final Integer JAVA_APPLICATION_CALL_VISUAL = new Integer(31); - /** Specifies the Visual JDBC component. **/ - public static final Integer JDBC_VISUAL = new Integer(32); // and Visual SQL - /** Specifies the Visual Job component. **/ - public static final Integer JOB_VISUAL = new Integer(33); - /** Specifies the Visual Message Queue component. **/ - public static final Integer MESSAGE_VISUAL = new Integer(34); - /** Specifies the Visual Network Print component. **/ - public static final Integer PRINT_VISUAL = new Integer(35); - /** Specifies the Visual Program Call component. **/ - public static final Integer PROGRAM_CALL_VISUAL = new Integer(36); - /** Specifies the Visual Record Level Access component. **/ - public static final Integer RECORD_LEVEL_ACCESS_VISUAL = new Integer(37); - /** Specifies the Visual User component. **/ - public static final Integer USER_VISUAL = new Integer(38); - - - private static final String CIAA = "com/ibm/as400/access/"; // for convenience - private static final String CIAD = "com/ibm/as400/data/"; - private static final String CIAV = "com/ibm/as400/vaccess/"; - private static final String CIASA = "com/ibm/as400/security/auth/"; - - private static final String COPYRIGHT_ENTRY_NAME = CIAA + "Copyright.class"; - - static final String DEFAULT_SOURCE_JAR_NAME = "jt400.jar"; - - // The components specified by the user (Integer's). - private Vector components_ = new Vector(); // Never null. - - // The languages (locales) specified by the user (String's). - private Vector languages_ = new Vector(); // Never null. - - // Directory where language files (if languages are specified). - // are to be searched for. Default is the current directory. - private File languageDirectory_ = new File(System.getProperty("user.dir")); - - // The CCSIDs specified by the user (Integer's). - private Vector ccsids_= new Vector(); // Never null. - // The excluded CCSIDs specified by the user (Integer's). - private Vector ccsidsExcluded_= new Vector(); // Never null. - - private boolean noProxy_; // If true, exclude proxy files. - - private boolean excludeResource_; // exclude resource pkg - private boolean excludeJDBC_; // exclude JDBC classes - private boolean excludeRLA_; // exclude RLA classes - private boolean excludeSysVal_; // exclude SystemValue classes - private boolean excludeDirEntryClass_; // exclude DirectoryEntry* classes - private boolean excludeSecAuth_; // exclude security.auth dependencies - private boolean excludeValidationList_; // exclude ValidationList classes - private boolean excludePathOptimizer_; // exclude AS400ClassPathOptimizer class - private boolean excludeBidi_; // exclude some BIDI classes - - // Invocation arguments. This is used only when ToolboxJarMaker - // is invoked from the command line. - private Arguments arguments_ = new Arguments(); // class defined in JarMaker - - - /** - Constructs an ToolboxJarMaker object. - **/ - public ToolboxJarMaker() - { - super("com/ibm/as400"); // Default entry-name prefix. - File defaultSourceJar = new File(DEFAULT_SOURCE_JAR_NAME); - setSourceJar(defaultSourceJar); - } - - - /** - Adds MRI files to the additional files list. -
    Note: This augments any previously specified language files. - - @param baseDirectory The base directory for the language files. - @param neededJarEntries The current list of required files - and their dependencies. - The list should contain only String objects. - @param jarMap A map of the source JAR or ZIP file. - **/ - private void addLanguageFiles(File baseDirectory, - Vector neededJarEntries, JarMap jarMap) - { - // Note: If any of the arguments is null, it is due to an - // internal programming error. - if (baseDirectory == null) - throw new NullPointerException("baseDirectory"); - if (neededJarEntries == null) - throw new NullPointerException("neededJarEntries"); - if (jarMap == null) - throw new NullPointerException("jarMap"); - - // Get a list of the MRI files in the source jar. - // The list should look something like: - // com/ibm/as400/access/MRI.properties, - // com/ibm/as400/access/JDMRI.properties, ... - // (Note: Beginning with V4R4, MRI's are "*.class" - // rather than "*.properties". This design handles that.) - - // Make a list of the MRI files in the "needed JAR entries" list. - Vector neededLanguageEntries = new Vector(); // String's - Enumeration e = neededJarEntries.elements(); - while (e.hasMoreElements()) - { - String entryName = (String)e.nextElement(); - // See if the filename has "MRI" in it. - if (entryName.lastIndexOf("MRI") > entryName.lastIndexOf('/')) - neededLanguageEntries.addElement(entryName); - } - - if (languages_.size() != 0) - { - // Add the language-specific *MRI_xx_XX.[properties|class] files to - // the "additional files" list. - Vector filesToAdd = new Vector(); - Enumeration e1 = languages_.elements(); - while (e1.hasMoreElements()) - { - String languageSuffix = (String)e1.nextElement(); - Enumeration e2 = neededLanguageEntries.elements(); - while (e2.hasMoreElements()) - { - String entryName = (String)e2.nextElement(); - // Insert the language ID after the "MRI". - String newEntryName = addMriSuffix(entryName, languageSuffix); - String filePath = generateFilePath(languageDirectory_, newEntryName); - if (DEBUG) System.out.println("Debug: Adding MRI file " + filePath); - filesToAdd.addElement(new File(filePath)); - } - } - - // Add the list of language files to the additional files list. - setAdditionalFiles(filesToAdd, baseDirectory); - } - else // User specified no specific languages. - { - // Go through the list of referenced MRI files, - // and mark as "needed" the corresponding _en and _en_US - // entries if they exist. - Enumeration e1 = neededLanguageEntries.elements(); - while (e1.hasMoreElements()) - { - String entryName = (String)e1.nextElement(); - String entryName_en = addMriSuffix(entryName, "en"); - String entryName_en_US = addMriSuffix(entryName, "en_US"); - if (DEBUG) { - System.out.println("Debug: entryName_en = " + entryName_en); - System.out.println(" entryName_en_US = " + entryName_en_US); - } - if (jarMap.contains(entryName_en) && - !neededJarEntries.contains(entryName_en)) - neededJarEntries.addElement(entryName_en); - if (jarMap.contains(entryName_en_US) && - !neededJarEntries.contains(entryName_en_US)) - neededJarEntries.addElement(entryName_en_US); - } - } - } - - /** - Constructs a new ZIP entry name by inserting the specified - language suffix into the specified entry name. - @param entryName The ZIP entry name into which to insert the suffix. - @param languageSuffix The language suffix to insert. For example, "en_US". - @return The constructed entry name, with suffix inserted. - **/ - private static String addMriSuffix(String entryName, String languageSuffix) - { - // Insert the language ID into the entry name after the "MRI". - // Note that MRI entries are named "com/ibm/as400/xxx/xxxMRIxxx.class". - int insertionPosition = entryName.lastIndexOf('.'); - // If no '.' found, then simply append suffix to end. - if (insertionPosition == -1) insertionPosition = entryName.length(); - StringBuffer buf = new StringBuffer(entryName); - buf.insert(insertionPosition, "_"+languageSuffix); - return buf.toString(); - } - - - /** - Adds any needed PCML files to the additional files list. -
    Note: This augments any previously specified PCML files. - - @param neededJarEntries The current list of required files - and their dependencies. - The list should contain only String objects. - @param jarMap A map of the source JAR or ZIP file. - **/ - private static void addPcmlFiles(Vector neededJarEntries, JarMap jarMap) - { - // Note: If any of the arguments is null, it is due to an - // internal programming error. - if (neededJarEntries == null) - throw new NullPointerException("neededJarEntries"); - if (jarMap == null) - throw new NullPointerException("jarMap"); - - // Get a list of the PCML files in the source jar. - // The list should look something like: - // com/ibm/as400/resource/RJob.pcml, - // com/ibm/as400/resource/RJob.pcml.ser, ... - // That is, look for any files with names ending ".pcml" or ".pcml.ser". - - // Make a list of the PCML files in the source jar file. - Enumeration e = jarMap.elements(); - Vector neededPcmlEntries = new Vector(); - while (e.hasMoreElements()) - { - String entryName = (String)e.nextElement(); - // See if the filename ends with ".pcml" or ".pcml.ser". - if (entryName.endsWith(".pcml") || entryName.endsWith(".pcml.ser")) - neededPcmlEntries.addElement(entryName); - } - - // Go through the list of PCML files contained in the source jar file, - // and mark as "needed" any that have a corresponding class file in the - // "needed files" list. - Enumeration e1 = neededPcmlEntries.elements(); - while (e1.hasMoreElements()) - { - String pcmlEntryName = (String)e1.nextElement(); - // Get the associated class file entry name. - String classEntryName = getClassEntryForPcml(pcmlEntryName); - if (neededJarEntries.contains(classEntryName) && - !neededJarEntries.contains(pcmlEntryName)) - neededJarEntries.addElement(pcmlEntryName); - } - } - - - /** - Adds or removes ZIP entry names from the "required files" list, - prior to initial generation of the dependencies list. - This method is provided so that subclasses of JarMaker can override it. -
    This method is meant to be called by the JarMaker class only. - - @param neededJarEntries An unsorted list of names of ZIP entries - that should be included in the output. - @param jarMap A map of the source JAR or ZIP file. - @return The modified list of ZIP entry names - (must never be null. - This should be a Vector of Strings. - @exception IOException If an error occurs when reading the source file. - **/ - Vector adjustDependencies1(Vector neededJarEntries, JarMap jarMap) - throws IOException - { - // Add selected ConvTableXXX files, per -ccsid list. - if (ccsids_.size() == 0) - { // User specified no particular ccsids. - // We will add *all* of the ccsids (if appropriate) in adjustDependencies2(). - } - else // User specified one or more particular ccsids. - { - // If the IFS component was specified, be sure to include - // the "old Unicode" ccsid. @A0a - if (components_.contains(INTEGRATED_FILE_SYSTEM)) - addElement(ccsids_, new Integer(61952)); - - // In all cases, be sure to include the "new Unicode" ccsid. @A2a - addElement(ccsids_, new Integer(13488)); - - // Add the ConvTableXXX's for the selected CCSIDs. - Enumeration e3 = ccsids_.elements(); - while (e3.hasMoreElements()) - { - Integer ccsid = (Integer)e3.nextElement(); - String entry = CIAA + "ConvTable" + ccsid.toString() + - CLASS_SUFFIX; - if (!neededJarEntries.contains(entry)) - { - if (jarMap.contains(entry)) - { - neededJarEntries.addElement(entry); - } - else - System.err.println("Warning: No entry in source file for " + - "CCSID " + ccsid.toString() + "."); - } - } - - } - - if (noProxy_) - { - addElement(dependenciesToExclude_, "com/ibm/as400/access/ProxyClientConnection.class"); - addElement(dependenciesToExclude_, "com/ibm/as400/access/ProxyReturnValue.class"); - if (verbose_ || DEBUG) { - System.out.println("Excluding Proxy* class dependencies."); - } - } - - // See if user gave the OK to selectively limit dependency expansion. @A4a - if (excludeSomeDependencies_) - { - // Note: As of V5R2, AS400ThreadedServer references DBReplyRequestedDS. - // We can't just exclude DBReplyRequestedDS, nor can we exclude its - // direct dependents (DBBaseReplyDS and DBDSPool), but we *can* exclude - // the files that *those* classes depend on. @A4a - - // If neither JDBC nor Visual JDBC is on the components list, - // and DBReplyRequestedDS isn't on the required files list, - // then exclude a couple of JDBC files. @A4a - boolean accessPackageWasSpecified = getPackages().contains("com.ibm.as400.access"); - if (!accessPackageWasSpecified && - !(components_.isEmpty()) && - !(components_.contains(JDBC)) && - !(components_.contains(JDBC_VISUAL))) - { - excludeJDBC_ = true; - if (verbose_ || DEBUG) { - System.out.println("Excluding JDBC classes."); - } - if (!getFilesRequired().contains("com/ibm/as400/access/DBBaseReplyDS.class")) - { - addElement(dependenciesToExclude_, "com/ibm/as400/access/DBBaseReplyDS.class"); - if (verbose_ || DEBUG) { - System.out.println("Excluding dependency: " + "com/ibm/as400/access/DBBaseReplyDS.class"); - } - - if (!getFilesRequired().contains("com/ibm/as400/access/DBDSPool.class")) - { - addElement(dependenciesToExclude_, "com/ibm/as400/access/DBDSPool.class"); - if (verbose_ || DEBUG) { - System.out.println("Excluding dependency: " + "com/ibm/as400/access/DBDSPool.class"); - } - } - } - } - - // Note: In V5R1, we added a getJob() method to CommandCall and ProgramCall, - // that returns an RJob object. Unfortunately this introduced a new - // dependency on the 'resource' package. - // In V5R2 we added method getServerJob() that returns a Job object, - // and we intend to deprecate getJob(). @A4a - - // Note: If we're dealing with a pre-V5R2 jt400.jar file, the user will need to specify RJob as a "required file" if they want to use it. - // Note: The getJob() method was eliminated from CommandCall and ProgramCall in JTOpen 6.5. - - // If the 'resource' package isn't on the packages list, - // and neither RJob nor JobLog is on the required files list, - // and neither Job nor Visual Job is on the components list, - // then exclude the 'resource' package. - if (!(getPackages().contains("com.ibm.as400.resource")) && - !(getFilesRequired().contains("com/ibm/as400/resource/RJob.class")) && - !(getFilesRequired().contains("com/ibm/as400/access/JobLog.class")) && - !(components_.isEmpty()) && - !(components_.contains(JOB)) && - !(components_.contains(JOB_VISUAL))) - { - excludeResource_ = true; - addElement(dependenciesToExclude_, "com/ibm/as400/resource/RJob.class"); - if (verbose_ || DEBUG) { - System.out.println("Excluding package com.ibm.as400.resource"); - } - } - - // If RecordLevelAccess and RecordLevelAccessVisual aren't on the components list, - // and the required files list contains no file named com/ibm/as400/access/DDM*, - // then exclude DDM* classes. - if (!accessPackageWasSpecified && - !(containsPattern(getFilesRequired(), "com/ibm/as400/access/DDM")) && - !(containsPattern(getFilesRequired(), "com/ibm/as400/access/Record")) && - !(components_.isEmpty()) && - !(components_.contains(RECORD_LEVEL_ACCESS)) && - !(components_.contains(RECORD_LEVEL_ACCESS_VISUAL)) && - !(components_.contains(DATA_DESCRIPTION))) - { - excludeRLA_ = true; - addElement(dependenciesToExclude_, "com/ibm/as400/access/Record.class"); - addElement(dependenciesToExclude_, "com/ibm/as400/access/CharacterFieldDescription.class"); - if (verbose_ || DEBUG) { - System.out.println("Excluding Record Level Access classes."); - } - } - - if (excludeJDBC_) - { - // referenced by AS400BidiTransform: - addElement(dependenciesToExclude_, "com/ibm/as400/access/AS400JDBCConnection.class"); - addElement(dependenciesToExclude_, "com/ibm/as400/access/JDProperties.class"); - if (verbose_ || DEBUG) { - System.out.println("Excluding dependencies: " + "com/ibm/as400/access/AS400JDBCConnection.class, " + - "com/ibm/as400/access/JDProperties.class"); - } - } - - if (excludeJDBC_ && excludeRLA_) - { - addElement(dependenciesToExclude_, "com/ibm/as400/access/ClassDecoupler.class"); - if (verbose_ || DEBUG) { - System.out.println("Excluding dependency: " + "com/ibm/as400/access/ClassDecoupler.class"); - } - } - - // If SystemValue isn't on the components list, - // and the required files list contains no file named com/ibm/as400/access/SystemValue*, - // then exclude SV* classes. - if (!accessPackageWasSpecified && - !(containsPattern(getFilesRequired(), "com/ibm/as400/access/SystemValue")) && - !(containsPattern(getFilesRequired(), "com/ibm/as400/access/SV")) && - !(components_.isEmpty()) && - !(components_.contains(SYSTEM_VALUE))) - { - excludeSysVal_ = true; - if (verbose_ || DEBUG) { - System.out.println("Excluding System Value classes."); - } - } - - - // If the required files list doesn't contain com.ibm.as400.security.auth.ProfileTokenCredential, - // then exclude that class. - if (!(getPackages().contains("com.ibm.as400.security.auth")) && - !(getFilesRequired().contains("com/ibm/as400/security/auth/ProfileTokenCredential.class"))) - { - excludeSecAuth_ = true; - addElement(dependenciesToExclude_, "com/ibm/as400/security/auth/ProfileTokenCredential.class"); - addElement(dependenciesToExclude_, "com/ibm/as400/security/auth/AS400Credential.class"); - if (verbose_ || DEBUG) { - System.out.println("Excluding ProfileTokenCredential dependencies."); - } - } - - - // If User and UserVisual aren't on the components list, - // and the required files list contains no file named com/ibm/as400/access/Directory*, - // then exclude Directory* classes. - if (!accessPackageWasSpecified && - !(containsPattern(getFilesRequired(), "com/ibm/as400/access/Directory")) && - !(components_.isEmpty()) && - !(components_.contains(USER)) && - !(components_.contains(USER_VISUAL))) - { - excludeDirEntryClass_ = true; - if (verbose_ || DEBUG) { - System.out.println("Excluding DirectoryEntry classes."); - } - } - - // If components list doesn't include Job or Visual Job, - // and Job.class isn't on the required files list, - // then exclude Job.class from dependency analysis. - if (!accessPackageWasSpecified && - !(components_.isEmpty()) && - !(components_.contains(JOB)) && - !(components_.contains(JOB_VISUAL))) - { - if (verbose_ || DEBUG) { - System.out.println("Excluding Job classes from dependency analysis."); - } - if (!getFilesRequired().contains("com/ibm/as400/access/Job.class")) - { - addElement(dependenciesToExclude_, "com/ibm/as400/access/Job.class"); - if (verbose_ || DEBUG) { - System.out.println("Excluding dependency: " + "com/ibm/as400/access/Job.class"); - } - } - } - - - // If the required files list contains no file named com/ibm/as400/access/ValidationList*, - // then exclude ValidationList* classes. - if (!accessPackageWasSpecified && - !(containsPattern(getFilesRequired(), "com/ibm/as400/access/ValidationList"))) - { - excludeValidationList_ = true; - addElement(dependenciesToExclude_, "com/ibm/as400/access/ValidationList.class"); - if (verbose_ || DEBUG) { - System.out.println("Excluding ValidationList classes."); - } - } - - - // If the required files list doesn't contain com/ibm/as400/util/AS400ClassPathOptimizer, - // then exclude it. - if (!(getPackages().contains("com.ibm.as400.util")) && - !(getFilesRequired().contains("com/ibm/as400/util/AS400ClassPathOptimizer.class"))) - { - excludePathOptimizer_ = true; - // This class is small, no need to add it to the exclusions list. - if (verbose_ || DEBUG) { - System.out.println("Excluding AS400ClassPathOptimizer."); - } - } - - // If the specified languages don't include 'he' and 'ar', and no BIDI CCSID was specified, exclude some BIDI classes. - if (isOkToExcludeBidi(components_, languages_, ccsids_)) - { - excludeBidi_ = true; - } - - } // if excludeSomeDependencies_ - - return neededJarEntries; - } - - private final static boolean isOkToExcludeBidi(Vector components, Vector languages, Vector ccsidList) - { - // If caller indicated no specific language or CCSID, assume they want all languages and CCSIDs. - if (languages.isEmpty() && ccsidList.isEmpty()) return false; - - // If caller specified either Arabic nor Hebrew, we'll definitely need Bidi classes. - if (languages.contains("ar") || - languages.contains("he")) - return false; - - // Caller specified a language, neither Arabic nor Hebrew. - // If no bidi CCSID was specified, then exclude *Bidi* and Arabic* classes. - - if (ccsidList.isEmpty()) return true; - - // Convert CCSIDs vector to an array of int, for quick searching. - int[] ccsids = new int[ccsidList.size()]; - for (int i=0; iThis method is meant to be called by the JarMaker class only. - - @param neededJarEntries An unsorted list of names of ZIP entries - that should be included in the output. - @param jarMap A map of the source JAR or ZIP file. - @return The modified list of ZIP entry names - (must never be null. - This should be a Vector of Strings. - @exception IOException If an error occurs when reading the source file. - **/ - Vector adjustDependencies2(Vector neededJarEntries, JarMap jarMap) - throws IOException - { - - // If the source jar file contains ConvTableJavaMap.class, it is Mod4 or later. - // Otherwise it is pre-Mod4. - boolean jarIsPreMod4; - String entry1 = CIAA + "ConvTableJavaMap" + CLASS_SUFFIX; - if (jarMap.contains(entry1)) - jarIsPreMod4 = false; - else - jarIsPreMod4 = true; - - // See if ConvTable.class was referenced. If so, make sure we end up with - // exactly the ConvTableXXX entries that we need, no more and no less. - if (neededJarEntries.contains(CIAA + "ConvTable" + CLASS_SUFFIX)) - { // Some or all of the ConvTableXXX files are needed, so include the right ones. - - if (ccsids_.size() == 0) - { // User specified no particular ccsids, so include them all. - - if (jarIsPreMod4) - { // Nothing to do, all the ConvTableXXX files are all referenced in ConvTable.java. - } - else - { // The ConvTableXXX files need to be added explicitly. - Vector entriesToAdd = new Vector(); - Enumeration e = jarMap.elements(); - while (e.hasMoreElements()) - { - String entry = (String)e.nextElement(); - // We are looking for entries like "..../ConvTableXXX.yyyy", - // where xxx is an integer greater than 0. - String className = entry.substring(1 + entry.lastIndexOf('/')); - if (className.startsWith("ConvTable") && - Character.isDigit(className.charAt(9))) // char after "ConvTable" - entriesToAdd.addElement(entry); - } - - // Determine the dependencies for the ConvTableXXX's. - Enumeration e1 = entriesToAdd.elements(); - Vector unanalyzedEntries = jarMap.getEntryNames(); - Vector referencedJarEntries = new Vector(); - while (e1.hasMoreElements()) - { - String entryName = (String)e1.nextElement(); - if (unanalyzedEntries.contains(entryName)) - { - unanalyzedEntries.removeElement(entryName); - analyzeJarEntry(entryName, unanalyzedEntries, - referencedJarEntries, jarMap); - addElement(referencedJarEntries, entryName); - } - } - copyVector(referencedJarEntries, neededJarEntries, CHECK_DUPS); - } - } // ... no particular ccsids were specified. - - else // User specified one or more particular ccsids. - { - - if (!jarIsPreMod4) - { - // We are dealing with a Mod4 or later Toolbox jar file. - // No special action is required. - } - else - // We are dealing with a pre-Mod4 Toolbox jar file. - // Weed out any unneeded ConvTableXXX entries that get dragged in - // (because their names are all referenced in ConvTable.java). - { - if (ccsids_.size() != 0) // Did the user specify any particular CCSIDs. - { - // First clear all ConvTableXXX entries from the dependencies list. - Vector entriesToRemove = new Vector(); - Enumeration e = neededJarEntries.elements(); - while (e.hasMoreElements()) - { - String entry = (String)e.nextElement(); - // We are looking for entries like "..../ConvTableXXX.yyyy", - // where xxx is an integer greater than 0. - String className = entry.substring(1 + entry.lastIndexOf('/')); - if (className.startsWith("ConvTable") && - Character.isDigit(className.charAt(9))) // char after "ConvTable" - entriesToRemove.addElement(entry); - } - Enumeration e2 = entriesToRemove.elements(); - while (e2.hasMoreElements()) - { - neededJarEntries.removeElement((String)e2.nextElement()); - } - - // If the IFS component was specified, be sure to include - // the "old Unicode" ccsid. @A0a - if (components_.contains(INTEGRATED_FILE_SYSTEM)) - addElement(ccsids_, new Integer(61952)); - - // In all cases, be sure to include the "new Unicode" ccsid. @A2a - addElement(ccsids_, new Integer(13488)); - - // Now add back in the ConvTableXXX's for the selected CCSIDs. - Enumeration e3 = ccsids_.elements(); - while (e3.hasMoreElements()) - { - Integer ccsid = (Integer)e3.nextElement(); - String entry = CIAA + "ConvTable" + ccsid.toString() + - CLASS_SUFFIX; - if (!neededJarEntries.contains(entry)) - { - if (jarMap.contains(entry)) - { - neededJarEntries.addElement(entry); - } - else - System.err.println("Warning: No entry in source file for " + - "CCSID " + ccsid.toString() + "."); - } - } - } - } - } - } // ... include the right ConvTableXXX files, per the -ccsid list. - - // Remove selected ConvTableXXX files, per -ccsidExcluded list. - if (ccsidsExcluded_.size() != 0) - { - Enumeration e = ccsidsExcluded_.elements(); - while (e.hasMoreElements()) - { - Integer ccsid = (Integer)e.nextElement(); - String entry = CIAA + "ConvTable" + ccsid.toString() + - CLASS_SUFFIX; - neededJarEntries.removeElement(entry); - if (!jarMap.contains(entry)) - System.err.println("Warning: No entry in source file for " + - "excluded CCSID " + ccsid.toString() + "."); - } - } - - - // Remove excluded packages. - removePackageFiles(neededJarEntries, jarMap, getPackagesExcluded()); - - // Load the entry names associated with any required packages. - // Note that these files will not be explicitly analyzed. - addPackageFiles(neededJarEntries, jarMap, getPackages()); - - // Add any needed MRI files to the "additional files" list. - // Note: Regardless of language selection, don't remove the base MRI files. - // That way, we always have a last-ditch default for messages (English), - // no matter what locale the JAR file is used in. - addLanguageFiles(languageDirectory_, neededJarEntries, jarMap); - - // Add any needed PCML files to the "additional files" list. - addPcmlFiles(neededJarEntries, jarMap); - - // If -noproxy option was specified, remove proxy files. - if (noProxy_) - { - Vector entriesToRemove = new Vector(); - Enumeration e = neededJarEntries.elements(); - while (e.hasMoreElements()) - { - String entry = (String)e.nextElement(); - // We are looking for entries like: - // "..../###Proxy.class", - // "..../###ProxyImpl.class", - // "..../Proxy###.class", - // "..../Px###.class", - String className = entry.substring(1 + entry.lastIndexOf('/')); - if (className.endsWith(CLASS_SUFFIX)) - { - className = className.substring(0,className.lastIndexOf(CLASS_SUFFIX)); - if ((className.endsWith("Proxy")) || - (className.endsWith("ProxyImpl")) || - (className.startsWith("Proxy")) || - (className.startsWith("Px")) ) - { - entriesToRemove.addElement(entry); - if (verbose_ || DEBUG) { - System.out.println("Excluding proxy class: " + className); - } - } - } - } - Enumeration e2 = entriesToRemove.elements(); - while (e2.hasMoreElements()) - neededJarEntries.removeElement((String)e2.nextElement()); - } - - if (excludeJDBC_) - { - neededJarEntries.removeElement("com/ibm/as400/access/DBDSPool.class"); - // Note: The AS400 class has dependencies on some DB* classes. - } - - if (excludeResource_) - { - removeElements(neededJarEntries, "com/ibm/as400/resource/", STARTS_WITH); - } - - if (excludeRLA_) - { - removeElements(neededJarEntries, "com/ibm/as400/access/Record", STARTS_WITH); - removeElements(neededJarEntries, "FieldDescription.class", ENDS_WITH); - } - - if (excludeSysVal_) - { - removeElements(neededJarEntries, "com/ibm/as400/access/SV", STARTS_WITH); - } - - if (excludeSecAuth_) - { - // The AS400 class needs ProfileTokenCredential, which needs some other security.auth classes, so add them back in. - addElement(neededJarEntries, "com/ibm/as400/security/auth/ProfileTokenCredential.class"); - addElement(neededJarEntries, "com/ibm/as400/security/auth/AS400Credential.class"); - addElement(neededJarEntries, "com/ibm/as400/security/auth/AS400BasicAuthenticationCredential.class"); - addElement(neededJarEntries, "com/ibm/as400/security/auth/AS400SwappableCredential.class"); - } - - if (excludeDirEntryClass_) - { - removeElements(neededJarEntries, "com/ibm/as400/access/DirectoryEntry", STARTS_WITH); - } - - if (excludeValidationList_) - { - neededJarEntries.removeElement("com/ibm/as400/access/PersistenceException.class"); - removeElements(neededJarEntries, "com/ibm/as400/access/ValidationList", STARTS_WITH); - } - - if (excludePathOptimizer_) - { - neededJarEntries.removeElement("com/ibm/as400/util/AS400ClassPathOptimizer.class"); - } - - if (excludeBidi_) - { - // Note: ConverterImplRemote needs several Bidi* classes regardless. - removeElements(neededJarEntries, "Arabic", CONTAINS); - } - - // Make sure that the copyright gets included. - if (jarMap.contains(COPYRIGHT_ENTRY_NAME)) - { - addElement(neededJarEntries, COPYRIGHT_ENTRY_NAME); - } - - return neededJarEntries; - } - - private static boolean containsPattern(Vector list, String pattern) - { - Enumeration e = list.elements(); - while (e.hasMoreElements()) { - String elem = (String)e.nextElement(); - if (elem.startsWith(pattern)) { - return true; - } - } - return false; - } - - - /** - Returns the base dependencies for a component. - - @param comp The component ID. - @return The names of the ZIP entries that comprise the "base dependency list" - for the specified component. (String's) - **/ - private static Vector getBaseDependenciesForComponent(Integer comp, - boolean includeBeans) - { - // Implementation note: These are the base dependency lists for the - // various Toolbox components as of mod1 (v3r2m1). The lists will need - // to be updated in future releases, as components are added and - // as component designs evolve. - - Vector deps = new Vector(); // base ZIP entries for component - - if (comp.equals(AS400)) - { - deps.addElement (CIAA+"AS400.class"); - if (includeBeans) - { - deps.addElement (CIAA+"AS400BeanInfo.class"); - } - } - else if (comp.equals (COMMAND_CALL)) - { - deps.addElement (CIAA+"CommandCall.class"); - if (includeBeans) - { - deps.addElement (CIAA+"CommandCallBeanInfo.class"); - } - } - else if (comp.equals (CONNECTION_POOL)) - { - deps.addElement (CIAA+"AS400ConnectionPool.class"); - if (includeBeans) - { - deps.addElement (CIAA+"AS400ConnectionPoolBeanInfo.class"); - deps.addElement (CIAA+"ConnectionPoolBeanInfo.class"); - } - } - else if (comp.equals (DATA_AREA)) - { - deps.addElement (CIAA+"CharacterDataArea.class"); - deps.addElement (CIAA+"DecimalDataArea.class"); - deps.addElement (CIAA+"LocalDataArea.class"); - deps.addElement (CIAA+"LogicalDataArea.class"); - if (includeBeans) - { - deps.addElement (CIAA+"CharacterDataAreaBeanInfo.class"); - deps.addElement (CIAA+"DecimalDataAreaBeanInfo.class"); - deps.addElement (CIAA+"LocalDataAreaBeanInfo.class"); - deps.addElement (CIAA+"LogicalDataAreaBeanInfo.class"); - } - } - else if (comp.equals (DATA_DESCRIPTION)) - { - // Field description classes: - deps.addElement (CIAA+"ArrayFieldDescription.class"); - deps.addElement (CIAA+"BinaryFieldDescription.class"); - deps.addElement (CIAA+"CharacterFieldDescription.class"); - deps.addElement (CIAA+"DateFieldDescription.class"); - deps.addElement (CIAA+"DBCSEitherFieldDescription.class"); - deps.addElement (CIAA+"DBCSGraphicFieldDescription.class"); - deps.addElement (CIAA+"DBCSOnlyFieldDescription.class"); - deps.addElement (CIAA+"DBCSOpenFieldDescription.class"); - deps.addElement (CIAA+"FloatFieldDescription.class"); - deps.addElement (CIAA+"HexFieldDescription.class"); - deps.addElement (CIAA+"PackedDecimalFieldDescription.class"); - deps.addElement (CIAA+"TimeFieldDescription.class"); - deps.addElement (CIAA+"TimestampFieldDescription.class"); - deps.addElement (CIAA+"VariableLengthFieldDescription.class"); - deps.addElement (CIAA+"ZonedDecimalFieldDescription.class"); - - deps.addElement (CIAA+"AS400Array.class"); - deps.addElement (CIAA+"AS400Bin2.class"); - deps.addElement (CIAA+"AS400Bin4.class"); - deps.addElement (CIAA+"AS400ByteArray.class"); - deps.addElement (CIAA+"AS400Float4.class"); - deps.addElement (CIAA+"AS400Float8.class"); - deps.addElement (CIAA+"AS400PackedDecimal.class"); - deps.addElement (CIAA+"AS400Structure.class"); - deps.addElement (CIAA+"AS400Text.class"); - deps.addElement (CIAA+"AS400UnsignedBin2.class"); - deps.addElement (CIAA+"AS400UnsignedBin4.class"); - deps.addElement (CIAA+"AS400ZonedDecimal.class"); - deps.addElement (CIAA+"Record.class"); // references RecordFormat - if (includeBeans) - { - deps.addElement (CIAA+"AS400ArrayBeanInfo.class"); - deps.addElement (CIAA+"AS400StructureBeanInfo.class"); - deps.addElement (CIAA+"RecordBeanInfo.class"); - deps.addElement (CIAA+"RecordFormatBeanInfo.class"); - } - } - else if (comp.equals (DATA_QUEUE)) - { - deps.addElement (CIAA+"DataQueue.class"); - deps.addElement (CIAA+"KeyedDataQueue.class"); - if (includeBeans) - { - deps.addElement (CIAA+"BaseDataQueueBeanInfo.class"); - deps.addElement (CIAA+"DataQueueAttributesBeanInfo.class"); - deps.addElement (CIAA+"DataQueueBeanInfo.class"); - deps.addElement (CIAA+"KeyedDataQueueBeanInfo.class"); - } - } - else if (comp.equals (DIGITAL_CERTIFICATE)) - { - deps.addElement (CIAA+"AS400Certificate.class"); - deps.addElement (CIAA+"AS400CertificateAttribute.class"); - deps.addElement (CIAA+"AS400CertificateUserProfileUtil.class"); - deps.addElement (CIAA+"AS400CertificateVldlUtil.class"); - if (includeBeans) - { - deps.addElement (CIAA+"AS400CertificateUserProfileUtilBeanInfo.class"); - deps.addElement (CIAA+"AS400CertificateUtilBeanInfo.class"); - deps.addElement (CIAA+"AS400CertificateVldlUtilBeanInfo.class"); - } - } - else if (comp.equals (FTP)) - { - deps.addElement (CIAA+"AS400FTP.class"); - if (includeBeans) - { - deps.addElement (CIAA+"AS400FTPBeanInfo.class"); - deps.addElement (CIAA+"FTPBeanInfo.class"); - } - } - else if (comp.equals (INTEGRATED_FILE_SYSTEM)) - { - deps.addElement (CIAA+"IFSFile.class"); - deps.addElement (CIAA+"IFSRandomAccessFile.class"); - deps.addElement (CIAA+"IFSTextFileInputStream.class"); // deprecated - deps.addElement (CIAA+"IFSTextFileOutputStream.class"); // deprecated - deps.addElement (CIAA+"IFSFileReader.class"); - deps.addElement (CIAA+"IFSFileWriter.class"); - if (includeBeans) - { - deps.addElement (CIAA+"IFSFileBeanInfo.class"); - deps.addElement (CIAA+"IFSRandomAccessFileBeanInfo.class"); - deps.addElement (CIAA+"IFSTextFileInputStreamBeanInfo.class"); - deps.addElement (CIAA+"IFSTextFileOutputStreamBeanInfo.class"); - } - } - else if (comp.equals (JAAS)) - { - deps.addElement (CIASA+"ProfileHandleCredential.class"); - deps.addElement (CIASA+"ProfileTokenCredential.class"); - deps.addElement (CIASA+"UserProfilePrincipal.class"); - if (includeBeans) - { - deps.addElement (CIASA+"ProfileHandleCredentialBeanInfo.class"); - deps.addElement (CIASA+"ProfileTokenCredentialBeanInfo.class"); - deps.addElement (CIASA+"UserProfilePrincipalBeanInfo.class"); - } - } - else if (comp.equals (JAVA_APPLICATION_CALL)) - { - deps.addElement (CIAA+"JavaApplicationCall.class"); - if (includeBeans) - { - deps.addElement (CIAA+"JavaApplicationCallBeanInfo.class"); - } - } - else if (comp.equals (JDBC)) - { - deps.addElement (CIAA+"AS400JDBCDriver.class"); - deps.addElement (CIAA+"AS400JDBCRowSet.class"); - deps.addElement (CIAA+"AS400JDBCXAConnection.class"); - deps.addElement (CIAA+"AS400JDBCConnectionPool.class"); - if (includeBeans) - { - deps.addElement (CIAA+"AS400JDBCRowSetBeanInfo.class"); - deps.addElement (CIAA+"AS400JDBCDataSourceBeanInfo.class"); - deps.addElement (CIAA+"AS400JDBCXADataSourceBeanInfo.class"); - deps.addElement (CIAA+"AS400JDBCConnectionPoolBeanInfo.class"); - deps.addElement (CIAA+"AS400JDBCConnectionPoolDataSourceBeanInfo.class"); - deps.addElement (CIAA+"ConnectionPoolBeanInfo.class"); - } - } - else if (comp.equals (JOB)) - { - deps.addElement (CIAA+"JobList.class"); - deps.addElement (CIAA+"JobLog.class"); - if (includeBeans) - { // No beans for this component. - } - } - else if (comp.equals (MESSAGE)) - { - deps.addElement (CIAA+"MessageQueue.class"); - if (includeBeans) - { // No beans for this component. - } - } - else if (comp.equals (NETSERVER)) - { - deps.addElement (CIAA+"ISeriesNetServer.class"); - // TBD: The following NetServer* classes are deprecated in favor of ISeriesNetServer. Delete them from JarMaker eventually. - deps.addElement (CIAA+"NetServer.class"); - if (includeBeans) - { - deps.addElement (CIAA+"NetServerBeanInfo.class"); - deps.addElement (CIAA+"NetServerFileShareBeanInfo.class"); - deps.addElement (CIAA+"NetServerPrintShareBeanInfo.class"); - } - } - else if (comp.equals (NUMERIC_DATA_TYPES)) - { // All the DataType classes except for AS400Text. - deps.addElement (CIAA+"AS400Array.class"); - deps.addElement (CIAA+"AS400Bin2.class"); - deps.addElement (CIAA+"AS400Bin4.class"); - deps.addElement (CIAA+"AS400ByteArray.class"); - deps.addElement (CIAA+"AS400Float4.class"); - deps.addElement (CIAA+"AS400Float8.class"); - deps.addElement (CIAA+"AS400PackedDecimal.class"); - deps.addElement (CIAA+"AS400Structure.class"); - deps.addElement (CIAA+"AS400UnsignedBin2.class"); - deps.addElement (CIAA+"AS400UnsignedBin4.class"); - deps.addElement (CIAA+"AS400ZonedDecimal.class"); - if (includeBeans) - { - deps.addElement (CIAA+"AS400ArrayBeanInfo.class"); - deps.addElement (CIAA+"AS400StructureBeanInfo.class"); - } - } - else if (comp.equals (PCML)) - { - deps.addElement (CIAD+"ProgramCallDocument.class"); - deps.addElement (CIAD+"RecordFormatDocument.class"); - if (includeBeans) - { // No beans for this component. - } - } - else if (comp.equals (PRINT)) - { - deps.addElement (CIAA+"AFPResourceList.class"); - deps.addElement (CIAA+"OutputQueueList.class"); - deps.addElement (CIAA+"PrinterList.class"); - deps.addElement (CIAA+"PrintObjectInputStream.class"); - deps.addElement (CIAA+"SpooledFileList.class"); - deps.addElement (CIAA+"SpooledFileOutputStream.class"); - deps.addElement (CIAA+"SCS3812Writer.class"); - deps.addElement (CIAA+"SCS5553Writer.class"); - if (includeBeans) - { - deps.addElement (CIAA+"AFPResourceBeanInfo.class"); - deps.addElement (CIAA+"AFPResourceListBeanInfo.class"); - deps.addElement (CIAA+"OutputQueueBeanInfo.class"); - deps.addElement (CIAA+"OutputQueueListBeanInfo.class"); - deps.addElement (CIAA+"PrintObjectBeanInfo.class"); - deps.addElement (CIAA+"PrintObjectListBeanInfo.class"); - deps.addElement (CIAA+"PrinterBeanInfo.class"); - deps.addElement (CIAA+"PrinterFileBeanInfo.class"); - deps.addElement (CIAA+"PrinterFileListBeanInfo.class"); - deps.addElement (CIAA+"PrinterListBeanInfo.class"); - deps.addElement (CIAA+"SpooledFileListBeanInfo.class"); - deps.addElement (CIAA+"WriterJobListBeanInfo.class"); - } - } - else if (comp.equals (PROGRAM_CALL)) - { - deps.addElement (CIAA+"ProgramCall.class"); - if (includeBeans) - { - deps.addElement (CIAA+"ProgramCallBeanInfo.class"); - deps.addElement (CIAA+"ProgramParameterBeanInfo.class"); - } - } - else if (comp.equals (RECORD_LEVEL_ACCESS)) - { - deps.addElement (CIAA+"AS400FileRecordDescription.class"); - deps.addElement (CIAA+"KeyedFile.class"); // extends AS400File - deps.addElement (CIAA+"SequentialFile.class"); - deps.addElement (CIAA+"DDMAS400MessageReply.class"); // extends DDMReplyDataStream - deps.addElement (CIAA+"DDMEndUnitOfWorkReply.class"); - deps.addElement (CIAA+"DDMObjectDataStream.class"); // extends DDMDataStream - deps.addElement (CIAA+"DDMRecordCache.class"); - deps.addElement (CIAA+"DDMRequestDataStream.class"); // extends DDMDataStream - deps.addElement (CIAA+"DDMS38IOFB.class"); - // Field description classes: - deps.addElement (CIAA+"ArrayFieldDescription.class"); - deps.addElement (CIAA+"BinaryFieldDescription.class"); - deps.addElement (CIAA+"CharacterFieldDescription.class"); - deps.addElement (CIAA+"DBCSEitherFieldDescription.class"); - deps.addElement (CIAA+"DBCSGraphicFieldDescription.class"); - deps.addElement (CIAA+"DBCSOnlyFieldDescription.class"); - deps.addElement (CIAA+"DBCSOpenFieldDescription.class"); - deps.addElement (CIAA+"DateFieldDescription.class"); - deps.addElement (CIAA+"FloatFieldDescription.class"); - deps.addElement (CIAA+"HexFieldDescription.class"); - deps.addElement (CIAA+"PackedDecimalFieldDescription.class"); - deps.addElement (CIAA+"TimeFieldDescription.class"); - deps.addElement (CIAA+"TimestampFieldDescription.class"); - deps.addElement (CIAA+"ZonedDecimalFieldDescription.class"); - if (includeBeans) - { - deps.addElement (CIAA+"AS400FileBeanInfo.class"); - deps.addElement (CIAA+"AS400FileRecordDescriptionBeanInfo.class"); - deps.addElement (CIAA+"KeyedFileBeanInfo.class"); - deps.addElement (CIAA+"SequentialFileBeanInfo.class"); - } - } - else if (comp.equals (SECURE_AS400)) - { - deps.addElement (CIAA+"SecureAS400.class"); - if (includeBeans) - { - deps.addElement (CIAA+"SecureAS400BeanInfo.class"); - } - } - else if (comp.equals (SERVICE_PROGRAM_CALL)) - { - deps.addElement (CIAA+"ServiceProgramCall.class"); - if (includeBeans) - { - deps.addElement (CIAA+"ServiceProgramCallBeanInfo.class"); - } - } - else if (comp.equals (SYSTEM_STATUS)) - { - deps.addElement (CIAA+"SystemStatus.class"); - deps.addElement (CIAA+"SystemPool.class"); - if (includeBeans) - { - deps.addElement (CIAA+"SystemStatusBeanInfo.class"); - deps.addElement (CIAA+"SystemPoolBeanInfo.class"); - } - } - else if (comp.equals (SYSTEM_VALUE)) - { - deps.addElement (CIAA+"SystemValueList.class"); - if (includeBeans) - { - deps.addElement (CIAA+"SystemValueListBeanInfo.class"); - deps.addElement (CIAA+"SystemValueBeanInfo.class"); - } - } - else if (comp.equals (TRACE)) - { - deps.addElement (CIAA+"Trace.class"); - } - else if (comp.equals (USER)) - { - deps.addElement (CIAA+"UserList.class"); - if (includeBeans) - { // No beans for this component. - } - } - else if (comp.equals (USER_SPACE)) - { - deps.addElement (CIAA+"UserSpace.class"); - if (includeBeans) - { - deps.addElement (CIAA+"UserSpaceBeanInfo.class"); - } - } - else if (comp.equals (AS400_VISUAL)) - { - deps.addElement (CIAV+"AS400ListPane.class"); - deps.addElement (CIAV+"AS400ExplorerPane.class"); - deps.addElement (CIAV+"ErrorDialogAdapter.class"); - if (includeBeans) - { - deps.addElement (CIAV+"AS400DetailsModelBeanInfo.class"); - deps.addElement (CIAV+"AS400DetailsPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400ExplorerPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400ListModelBeanInfo.class"); - deps.addElement (CIAV+"AS400ListPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400TreeModelBeanInfo.class"); - deps.addElement (CIAV+"AS400TreePaneBeanInfo.class"); - deps.addElement (CIAV+"ErrorDialogAdapterBeanInfo.class"); - deps.addElement (CIAV+"VActionAdapterBeanInfo.class"); - deps.addElement (CIAV+"VPropertiesActionBeanInfo.class"); - deps.addElement (CIAV+"WorkingCursorAdapterBeanInfo.class"); - } - } - else if (comp.equals (COMMAND_CALL_VISUAL)) - { - deps.addElement (CIAV+"CommandCallButton.class"); - deps.addElement (CIAV+"CommandCallMenuItem.class"); - if (includeBeans) - { - deps.addElement (CIAV+"CommandCallButtonBeanInfo.class"); - deps.addElement (CIAV+"CommandCallMenuItemBeanInfo.class"); - } - } - else if (comp.equals (DATA_QUEUE_VISUAL)) - { - deps.addElement (CIAV+"DataQueueDocument.class"); - deps.addElement (CIAV+"KeyedDataQueueDocument.class"); - if (includeBeans) - { - deps.addElement (CIAV+"DataQueueDocumentBeanInfo.class"); - deps.addElement (CIAV+"KeyedDataQueueDocumentBeanInfo.class"); - } - } - else if (comp.equals (INTEGRATED_FILE_SYSTEM_VISUAL)) - { - deps.addElement (CIAV+"IFSFileDialog.class"); // not a bean - deps.addElement (CIAV+"IFSTextFileDocument.class"); - deps.addElement (CIAV+"VIFSDirectory.class"); - deps.addElement (CIAV+"AS400ExplorerPane.class"); - deps.addElement (CIAV+"AS400ListPane.class"); - if (includeBeans) - { - deps.addElement (CIAV+"IFSTextFileDocumentBeanInfo.class"); - deps.addElement (CIAV+"VIFSDirectoryBeanInfo.class"); - deps.addElement (CIAV+"AS400DetailsModelBeanInfo.class"); - deps.addElement (CIAV+"AS400DetailsPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400ExplorerPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400ListModelBeanInfo.class"); - deps.addElement (CIAV+"AS400ListPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400TreeModelBeanInfo.class"); - deps.addElement (CIAV+"AS400TreePaneBeanInfo.class"); - } - } - else if (comp.equals (JAVA_APPLICATION_CALL_VISUAL)) - { - deps.addElement (CIAV+"VJavaApplicationCall.class"); - if (includeBeans) - { - deps.addElement (CIAV+"VJavaApplicationCallBeanInfo.class"); - } - } - else if (comp.equals (JDBC_VISUAL)) - { - deps.addElement (CIAV+"SQLResultSetFormPane.class"); - deps.addElement (CIAV+"SQLResultSetTablePane.class"); - deps.addElement (CIAV+"SQLStatementButton.class"); - deps.addElement (CIAV+"SQLStatementMenuItem.class"); - deps.addElement (CIAV+"SQLStatementDocument.class"); - deps.addElement (CIAV+"SQLQueryBuilderPane.class"); - if (includeBeans) - { - deps.addElement (CIAV+"SQLConnectionBeanInfo.class"); - deps.addElement (CIAV+"SQLQueryBuilderPaneBeanInfo.class"); - deps.addElement (CIAV+"SQLResultSetFormPaneBeanInfo.class"); - deps.addElement (CIAV+"SQLResultSetTableModelBeanInfo.class"); - deps.addElement (CIAV+"SQLResultSetTablePaneBeanInfo.class"); - deps.addElement (CIAV+"SQLStatementButtonBeanInfo.class"); - deps.addElement (CIAV+"SQLStatementDocumentBeanInfo.class"); - deps.addElement (CIAV+"SQLStatementMenuItemBeanInfo.class"); - } - } - else if (comp.equals (JOB_VISUAL)) - { - deps.addElement (CIAV+"VJobList.class"); - deps.addElement (CIAV+"AS400ExplorerPane.class"); - deps.addElement (CIAV+"AS400ListPane.class"); - if (includeBeans) - { - deps.addElement (CIAV+"VJobBeanInfo.class"); - deps.addElement (CIAV+"VJobListBeanInfo.class"); - deps.addElement (CIAV+"AS400DetailsModelBeanInfo.class"); - deps.addElement (CIAV+"AS400DetailsPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400ExplorerPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400ListModelBeanInfo.class"); - deps.addElement (CIAV+"AS400ListPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400TreeModelBeanInfo.class"); - deps.addElement (CIAV+"AS400TreePaneBeanInfo.class"); - } - } - else if (comp.equals (MESSAGE_VISUAL)) - { - deps.addElement (CIAV+"VMessageList.class"); - deps.addElement (CIAV+"VMessageQueue.class"); - deps.addElement (CIAV+"AS400ExplorerPane.class"); - deps.addElement (CIAV+"AS400ListPane.class"); - if (includeBeans) - { - deps.addElement (CIAV+"VMessageListBeanInfo.class"); - deps.addElement (CIAV+"VMessageQueueBeanInfo.class"); - deps.addElement (CIAV+"AS400DetailsModelBeanInfo.class"); - deps.addElement (CIAV+"AS400DetailsPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400ExplorerPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400ListModelBeanInfo.class"); - deps.addElement (CIAV+"AS400ListPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400TreeModelBeanInfo.class"); - deps.addElement (CIAV+"AS400TreePaneBeanInfo.class"); - } - } - else if (comp.equals (PRINT_VISUAL)) - { - deps.addElement (CIAV+"VPrinters.class"); - deps.addElement (CIAV+"AS400ExplorerPane.class"); - deps.addElement (CIAV+"AS400ListPane.class"); - // Note - Pre-mod2 Toolbox erroneously refers to - // VOutput16.GIF, VOutput32.GIF (uppercase), - // therefore they won't get included. - if (includeBeans) - { - deps.addElement (CIAV+"VPrinterBeanInfo.class"); - deps.addElement (CIAV+"VPrinterOutputBeanInfo.class"); - deps.addElement (CIAV+"VPrintersBeanInfo.class"); - deps.addElement (CIAV+"AS400DetailsModelBeanInfo.class"); - deps.addElement (CIAV+"AS400DetailsPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400ExplorerPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400ListModelBeanInfo.class"); - deps.addElement (CIAV+"AS400ListPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400TreeModelBeanInfo.class"); - deps.addElement (CIAV+"AS400TreePaneBeanInfo.class"); - } - } - else if (comp.equals (PROGRAM_CALL_VISUAL)) - { - deps.addElement (CIAV+"ProgramCallButton.class"); - deps.addElement (CIAV+"ProgramCallMenuItem.class"); - if (includeBeans) - { - deps.addElement (CIAV+"ProgramCallButtonBeanInfo.class"); - deps.addElement (CIAV+"ProgramCallMenuItemBeanInfo.class"); - } - } - else if (comp.equals (RECORD_LEVEL_ACCESS_VISUAL)) - { - deps.addElement (CIAV+"RecordListFormPane.class"); - deps.addElement (CIAV+"RecordListTablePane.class"); - if (includeBeans) - { - deps.addElement (CIAV+"RecordListFormPaneBeanInfo.class"); - deps.addElement (CIAV+"RecordListTableModelBeanInfo.class"); - deps.addElement (CIAV+"RecordListTablePaneBeanInfo.class"); - } - } - else if (comp.equals (USER_VISUAL)) - { - deps.addElement (CIAV+"VUserList.class"); - deps.addElement (CIAV+"AS400ExplorerPane.class"); - deps.addElement (CIAV+"AS400ListPane.class"); - if (includeBeans) - { - deps.addElement (CIAV+"VUserListBeanInfo.class"); - deps.addElement (CIAV+"AS400DetailsModelBeanInfo.class"); - deps.addElement (CIAV+"AS400DetailsPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400ExplorerPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400ListModelBeanInfo.class"); - deps.addElement (CIAV+"AS400ListPaneBeanInfo.class"); - deps.addElement (CIAV+"AS400TreeModelBeanInfo.class"); - deps.addElement (CIAV+"AS400TreePaneBeanInfo.class"); - } - } - - else // none of the above component values - throw new IllegalArgumentException("component (" + - comp.intValue() + ")"); - - return deps; - } - - - /** - Returns the CCSIDs explicitly to be included. - - @return The CCSIDs explicitly to be included. - The list will be empty if none has been specified. - The list will contain only Integer objects. - **/ - public Vector getCCSIDs() { return ccsids_; } - - - /** - Returns CCSIDs to be excluded. - - @return The CCSIDs to be excluded. - The list will be empty if none has been specified. - The list will contain only Integer objects. - **/ - public Vector getCCSIDsExcluded() { return ccsidsExcluded_; } - - - - /** - Returns the name of the class file corresponding to a PCML file. - - @param pcmlEntryName The PCML entry name. - @return The name of the class file corresponding to a PCML file. - **/ - private static String getClassEntryForPcml(String pcmlEntryName) - { - int suffixPos = pcmlEntryName.lastIndexOf(".pcml"); - return (pcmlEntryName.substring(0,suffixPos) + ".class"); - } - - - /** - Returns the component ID for a component. - - @param componentName The component name. - @return The associated ID for the component, or null - if the component name is not recognized. - **/ - private static Integer getComponentID(String componentName) - { - String comp = componentName.trim(); - Integer id = null; // default - - for (int i=0; iInteger objects. - See component list for - a list of integer values and associated components. - **/ - public Vector getComponents() { return components_; } - - - /** - Returns the base directory under which the Toolbox language files - will be searched for. - This value is set by setLanguageDirectory(). - @return The base directory for the language files. - **/ - public File getLanguageDirectory() { return languageDirectory_; } - - - /** - Returns the national languages that explicitly are to be supported. - The languages are identified by their Java locale name, such as fr_CA - (for Canadian French). - Note: Locale en is always implicitly supported. - - @return The national languages that explicitly are to be supported. - The list will be empty if none has been specified. - The list will contain only String objects. - **/ - public Vector getLanguages() { return languages_; } - - - /** - Returns the best-fit shipped MRI suffix (such as "_fr") - for a given language specifier (such as "_fr_FR"). - - @param langId The language ID specified by the user. - @param verbose The verbose mode. - @return The shipped suffix most closely matching that ID; - null if the language is not supported. - **/ - private static String getShippedLanguageSuffixFor(String langId, - boolean verbose) - { - // Shipped suffixes are: de, de_CH, es, fr, fr_BE, fr_CA, fr_CH, - // it, it_CH, ja, ko, zh, zh_TW, cs, hu, pl. - - // Note: cs, hu, and pl were not supported prior to mod1. - - // This routine will need to be updated if any languages are - // added or dropped in subsequent releases of the Toolbox. - - String result = null; - String id = normalizeLanguageSuffix(langId); - - if (id.startsWith("en")) { - if (verbose) - System.out.println("English MRI files are included by default."); - } - else if (id.startsWith("de_CH")) result = "de_CH"; - else if (id.startsWith("de")) result = "de"; - else if (id.startsWith("es")) result = "es"; - else if (id.startsWith("fr_BE")) result = "fr_BE"; - else if (id.startsWith("fr_CA")) result = "fr_CA"; - else if (id.startsWith("fr_CH")) result = "fr_CH"; - else if (id.startsWith("fr")) result = "fr"; - else if (id.startsWith("it_CH")) result = "it_CH"; - else if (id.startsWith("it")) result = "it"; - else if (id.startsWith("ja")) result = "ja"; - else if (id.startsWith("ko")) result = "ko"; - else if (id.startsWith("zh_TW")) result = "zh_TW"; - else if (id.startsWith("zh")) result = "zh"; - else if (id.startsWith("cs")) result = "cs"; // added in mod1 - else if (id.startsWith("hu")) result = "hu"; // added in mod1 - else if (id.startsWith("pl")) result = "pl"; // added in mod1 - - else { - System.err.println("Warning: Unsupported language ID specified: " + - langId + "."); - result = id; // try it anyway, it might be a new one - } - - if (DEBUG) - System.out.println("Debug: Specified language suffix " + langId + - " maps to " + result); - return result; - } - - - /** - Reformats a user-supplied language specifier so that we have the - best chance of recognizing it. - @param language The language suffix. - @return The normalized version of the suffix. Never returns null. - **/ - private static String normalizeLanguageSuffix(String language) - { - String result; - String languageID = language; - - // Strip off any leading or trailing blanks, underscores. - String id = language.trim(); - while (id.charAt(0) == '_') - id = id.substring(1); - while (id.endsWith("_")) - id = id.substring(0, id.length()-1); - - if (id.length() < 2) - throw new IllegalArgumentException("language (" + language + ")"); - else if (id.indexOf("_") == 2) - languageID = id; - else { - StringBuffer buf = new StringBuffer(id); - buf.insert(2, '_'); - languageID = buf.toString(); - } - - // Lower-case the chars before the first underscore, and uppercase the rest. - String part1 = languageID.substring(0,2).toLowerCase(); - String part2 = languageID.substring(2).toUpperCase(); - result = part1 + part2; - if (DEBUG) System.out.println("Debug: Normalized language specifier: " + - result); - return result; - } - - /** - Parses and validates the arguments specified on the command line. - - @param args The command line arguments. - @return An indication of whether the parse succeeded. - **/ - private boolean parseArgs(String[] args) - { - boolean succeeded = false; - - // Wipe the slate clean, in case this ToolboxJarMaker object is - // being recycled. - reset(); - - succeeded = arguments_.parse(args, this); - return succeeded; - } - - - /** - Resets the ToolboxJarMaker object to a clean, default state, - to facilitate object reuse. - **/ - public void reset() - { - super.reset(); - arguments_ = new Arguments(); - File defaultSourceJar = new File(DEFAULT_SOURCE_JAR_NAME); - setSourceJar(defaultSourceJar); - - components_.removeAllElements(); - languages_.removeAllElements(); - languageDirectory_ = new File(System.getProperty("user.dir")); - ccsids_.removeAllElements(); - ccsidsExcluded_.removeAllElements(); - } - - - /** - Specifies the CCSIDs explicitly to be included. - The conversion tables for only these CCSIDs (and CCSIDs - specified in any prior invocations) will be included in the output. - Conversion tables for other CCSIDs will not be included. -
    Note: This augments any previously specified CCSIDs. - This method does not verify the existence of the specified CCSIDs. - - @param ccsidList The CCSIDs explicitly to be included. - The list should contain only Integer objects. - See CCSIDs and encodings - for valid values. - **/ - public void setCCSIDs(Vector ccsidList) - { - if (ccsidList == null) - throw new NullPointerException("ccsidList"); - // Check for nulls and for correct element type. - ccsidList = validateList(ccsidList, "CCSID", - "java.lang.Integer", verbose_); - Enumeration e = ccsidList.elements(); - while (e.hasMoreElements()) - { - Integer ccsid = (Integer)e.nextElement(); - addElement(ccsids_, ccsid); - if (ccsidsExcluded_.contains(ccsid)) - { - System.err.println("Warning: CCSID " + ccsid.intValue() + - ", specified for both inclusion " + - "and exclusion, will be included."); - ccsidsExcluded_.removeElement(ccsid); - } - - // If adding an ebcdic mixed-byte ccsid, also add associated ccsids - // for "single-byte portion" and "double-byte portion". - switch (ccsid.intValue()) - { - case 930: - case 5026: - addElement(ccsids_, new Integer(290)); - addElement(ccsids_, new Integer(300)); - break; - - case 933: - case 1364: - addElement(ccsids_, new Integer(833)); - addElement(ccsids_, new Integer(834)); - break; - - case 935: - case 1388: - addElement(ccsids_, new Integer(836)); - addElement(ccsids_, new Integer(837)); - break; - - case 937: - addElement(ccsids_, new Integer( 37)); - addElement(ccsids_, new Integer(835)); - break; - - case 939: - case 5035: - addElement(ccsids_, new Integer(1027)); - addElement(ccsids_, new Integer( 300)); - break; - - case 1399: - addElement(ccsids_, new Integer( 5123)); - addElement(ccsids_, new Integer(16684)); - break; - - default: - // None of the above, so nothing special to do. - } - } - } - - /** - Specifies CCSIDs to be excluded. - The conversion tables for these CCSIDs will not be included in the output. -
    Note: This augments any previously specified CCSIDs. - This method does not verify the existence of the specified CCSIDs. - - @param ccsidList The CCSIDs to be excluded. - The list should contain only Integer objects. - **/ - public void setCCSIDsExcluded(Vector ccsidList) - { - if (ccsidList == null) - throw new NullPointerException("ccsidList"); - // Check for nulls and for correct element type. - ccsidList = validateList(ccsidList, "CCSID", - "java.lang.Integer", verbose_); - Enumeration e = ccsidList.elements(); - while (e.hasMoreElements()) - { - Integer ccsid = (Integer)e.nextElement(); - // See if the CCSID was also specified to be *included*. - if (ccsids_.contains(ccsid)) - System.err.println("Warning: CCSID " + ccsid.intValue() + - ", specified for both exclusion " + - "and inclusion, will be included."); - else - addElement(ccsidsExcluded_, ccsid); - } - } - - - /** - Specifies required IBM Toolbox for Java components. - Java Beans files associated with the components are not - automatically included. -
    Note: This augments any previously specified components. - If an unrecognized component is specified, a warning message is - sent to System.err, and the component is ignored. - - @param components The required components. - The list should contain only Integer objects. - See component list for valid values. - **/ - public void setComponents(Vector components) - { - setComponents(components, false); // do not include beans - } - - - /** - Specifies required IBM Toolbox for Java components. -
    Note: This augments any previously specified components. - If an unrecognized component is specified, a warning message is - sent to System.err, and the component is ignored. - - @param components The required components. - The list should contain only Integer objects. - See component list for valid values. - @param includeBeans Whether or not Java Beans files associated - with the components are to be included. - **/ - public void setComponents(Vector components, boolean includeBeans) - { - if (components == null) - throw new NullPointerException("componentList"); - // Check for nulls and for correct element type. - components = validateList(components, "component", - "java.lang.Integer", verbose_); - Vector filesForComponents = new Vector(); - Enumeration e = components.elements(); - while (e.hasMoreElements()) - { - Integer comp = (Integer)e.nextElement(); - if (addElement(components_, comp)) // if not already in list... - { - Vector filesForThisComp = getBaseDependenciesForComponent(comp, includeBeans); - copyVector(filesForThisComp, filesForComponents, CHECK_DUPS); - } - } - - // Add the component files to list of required files. - setFilesRequired(filesForComponents); - } - - - /** - Specifies the base directory for additional Toolbox language files. - The path below this directory should correspond to the package name - the language files. -
    - For example, if the MRI files are located in directories - /usr/myDir/com/ibm/as400/access and - /usr/myDir/com/ibm/as400/vaccess, - then the base directory should be set to /usr/myDir. -
    This method does not verify the existence of the specified directory. -
    The default language directory is the current directory. - - @param baseDirectory The base directory for the language files. - **/ - public void setLanguageDirectory(File baseDirectory) - { - if (baseDirectory == null) - throw new NullPointerException("baseDirectory"); - else - languageDirectory_ = baseDirectory; - } - - - /** - Specifies national languages that explicitly are to be supported. - Languages are identified by their Java locale name, such as - fr_CA. - The language files for the specified languages will be searched for - in the directory tree specified by setLanguageDirectory, - or, if no directory has been specified, in the directory tree - under the current directory. -
    Note: This augments any previously specified languages. - This method does not verify the existence of files for the specified - languages. - Locale en is always implicitly supported. - If an unrecognized language is specified, a warning message is - sent to System.err, and the language is ignored. - - @param languages The languages to be supported. - The list should contain only String objects. - **/ - public void setLanguages(Vector languages) - { - if (languages == null) - throw new NullPointerException("languageList"); - // Check for nulls and for correct element type. - languages = validateList(languages, "language", - "java.lang.String", verbose_); - - // Map the specified languages to the actual shipped MRI name extensions. - Enumeration e = languages.elements(); - while (e.hasMoreElements()) - { - String specifiedLanguage = (String)e.nextElement(); // e.g. "fr_CA" - String mriSuffix = getShippedLanguageSuffixFor(specifiedLanguage, verbose_); - addElement(languages_, mriSuffix); - } - // Note: Postpone calling setAdditionalFiles() until we need to, since - // it needs to read the source JAR file and therefore may throw exceptions. - } - - - /** - Specifies whether proxy-only files are to be excluded. - Proxy files are needed only if the Toolbox's Proxy Service - will be used. - By default, all proxy files in the source JAR file are included. - - @param excludeProxies Whether or not proxy-only files - are to be excluded. - **/ - public void setProxyFilesExcluded(boolean excludeProxies) - { - noProxy_ = excludeProxies; - } - - - - /** - Specifies whether ToolboxJarMaker is allowed to selectively limit - dependency expansion, and exclude certain components and packages - that are unlikely to be needed. - By default, this option is not in effect; that is, all directly- and - indirectly-referenced files in the source JAR file are included. - Examples of files that may be excluded from the output: -
      -
    • JDBC classes, if component {@link #JDBC JDBC} has not been specified -
    • class {@link com.ibm.as400.resource.RJob RJob}, if neither component {@link com.ibm.as400.access.Job Job} nor package com.ibm.as400.resource has been specified -
    - Note: Dependency exclusion is not recommended for pre-V5R2 Toolbox JAR files. - - @param excludeSomeDependencies Whether or not ToolboxJarMaker should - selectively limit dependency expansion. - **/ - public void setExcludeSomeDependencies(boolean excludeSomeDependencies) - { - excludeSomeDependencies_ = excludeSomeDependencies; - } - - - /** - Performs the actions specified in the invocation arguments. - - @param args The command line arguments. - **/ - public static void main(String[] args) - { - try - { - ToolboxJarMaker jm = new ToolboxJarMaker(); - - if (jm.parseArgs(args)) - { - if (jm.isSplit()) // -split overrides all other options - { - File srcJar = jm.getSourceJar(); - int splitSize = jm.getSplitSize(); - jm.split(srcJar, splitSize); // unpack required files - } - else if (jm.isExtract()) - { - File srcJar = jm.getSourceJar(); - File outputDir = jm.getExtractionDirectory(); - jm.extract(srcJar, outputDir); // unpack required files - } - else - { - File srcJar = jm.getSourceJar(); - File destJar = jm.getDestinationJar(); - jm.makeJar(srcJar, destJar); // create a new JAR file - } - } - else System.exit(1); - } - catch (Throwable e) { - System.err.println(e.toString()); - e.printStackTrace(System.err); - System.exit(1); - } - - System.exit(0); - } - - - - class Arguments - { - - /** - Parses and validates the arguments specified on the command line. - - @param arguments The command line arguments. - @param jmaker The object to apply the arguments to. - @return An indication of whether the parse succeeded. - **/ - boolean parse(String[] argList, ToolboxJarMaker jmaker) - { - Vector components = null; // Strings - Vector languages = null; // Strings - Vector ccsids = null; // Integers - Vector ccsidsExcluded = null; // Integers - boolean includeBeans = false; - boolean noProxySpecified = false; - boolean succeeded = true; - - // Submit the arguments to the superclass first. - if (!jmaker.parseArgs(argList, true)) // 2nd arg tells superclass - { // to tolerate unrecognized options. - printUsage(System.err); - return false; - } - - // Get the args that the superclass didn't recognize. - String[] args = jmaker.getUnrecognizedArgs(); - if (DEBUG) - { - System.out.print("ToolboxJarMaker.parse(): Arguments leftover from JarMaker parse: "); - for (int i=0; i -REMOTE_ERR_JAVA = Java command incorrect.\nUsage: Java [-classpath=] [-verbose] [<-Dproperty=value>] \n class [ [...]] -REMOTE_PORT_VALUE_ERROR = The value must be true or false. -REMOTE_HELP_LINE0 = -REMOTE_HELP_LINE1 = \nRun a Java program: -REMOTE_HELP_LINE2 = java [-classpath=] [-verbose]\n [-D= [-D=] [...]] -REMOTE_HELP_LINE3 = [ [] [...]] -REMOTE_HELP_LINE4 = \nSet an option: -REMOTE_HELP_LINE5 = set